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
path: root/source
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2007-12-24 21:27:28 +0300
committerTon Roosendaal <ton@blender.org>2007-12-24 21:27:28 +0300
commita1c8543f2acd7086d412cb794b32f96794b00659 (patch)
tree449643369b86531dbbd883193efaeee7d1fb4418 /source
parent8a07e665c28a94ffd188daa431a4fd0c5a460eba (diff)
Step 3 for the initial commits for 2.5: removing src/ and python,
adding new windowmanager module, and the first bits of new editors module.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/datafiles/B.blend.c (renamed from source/blender/src/B.blend.c)0
-rw-r--r--source/blender/editors/datafiles/Bfont.c (renamed from source/blender/src/Bfont.c)2
-rw-r--r--source/blender/editors/datafiles/Makefile49
-rw-r--r--source/blender/editors/datafiles/bfont.ttf.c (renamed from source/blender/src/bfont.ttf.c)0
-rw-r--r--source/blender/editors/datafiles/blenderbuttons.c (renamed from source/blender/src/blenderbuttons.c)0
-rw-r--r--source/blender/editors/datafiles/splash.jpg.c (renamed from source/blender/src/splash.jpg.c)0
-rw-r--r--source/blender/editors/include/BDR_drawaction.h88
-rw-r--r--source/blender/editors/include/BDR_drawmesh.h84
-rw-r--r--source/blender/editors/include/BDR_drawobject.h82
-rw-r--r--source/blender/editors/include/BDR_editcurve.h105
-rw-r--r--source/blender/editors/include/BDR_editface.h61
-rw-r--r--source/blender/editors/include/BDR_editmball.h (renamed from source/blender/python/api2_2x/IDProp.h)53
-rw-r--r--source/blender/editors/include/BDR_editobject.h128
-rw-r--r--source/blender/editors/include/BDR_imagepaint.h44
-rw-r--r--source/blender/editors/include/BDR_sculptmode.h142
-rw-r--r--source/blender/editors/include/BDR_unwrapper.h51
-rw-r--r--source/blender/editors/include/BDR_vpaint.h (renamed from source/blender/python/api2_2x/windowTheme.h)48
-rw-r--r--source/blender/editors/include/BIF_butspace.h140
-rw-r--r--source/blender/editors/include/BIF_cursors.h103
-rw-r--r--source/blender/editors/include/BIF_drawimage.h74
-rw-r--r--source/blender/editors/include/BIF_drawoops.h (renamed from source/blender/python/api2_2x/meshPrimitive.h)23
-rw-r--r--source/blender/editors/include/BIF_drawscene.h (renamed from source/blender/src/cre/license.jpeg.c)9
-rw-r--r--source/blender/editors/include/BIF_drawscript.h (renamed from source/blender/python/api2_2x/Sys.h)19
-rw-r--r--source/blender/editors/include/BIF_drawseq.h46
-rw-r--r--source/blender/editors/include/BIF_drawtext.h (renamed from source/blender/python/api2_2x/sceneRadio.h)41
-rw-r--r--source/blender/editors/include/BIF_editaction.h162
-rw-r--r--source/blender/editors/include/BIF_editarmature.h142
-rw-r--r--source/blender/editors/include/BIF_editconstraint.h72
-rw-r--r--source/blender/editors/include/BIF_editdeform.h76
-rw-r--r--source/blender/editors/include/BIF_editfont.h (renamed from source/blender/src/imasel.c)80
-rw-r--r--source/blender/editors/include/BIF_editgroup.h40
-rw-r--r--source/blender/editors/include/BIF_editkey.h70
-rw-r--r--source/blender/editors/include/BIF_editlattice.h45
-rw-r--r--source/blender/editors/include/BIF_editmesh.h265
-rw-r--r--source/blender/editors/include/BIF_editmode_undo.h (renamed from source/blender/python/api2_2x/EXPP_interface.h)47
-rw-r--r--source/blender/editors/include/BIF_editnla.h65
-rw-r--r--source/blender/editors/include/BIF_editoops.h47
-rw-r--r--source/blender/editors/include/BIF_editparticle.h92
-rw-r--r--source/blender/editors/include/BIF_editsca.h (renamed from source/blender/python/api2_2x/Types.h)22
-rw-r--r--source/blender/editors/include/BIF_editseq.h135
-rw-r--r--source/blender/editors/include/BIF_editsima.h112
-rw-r--r--source/blender/editors/include/BIF_editsound.h87
-rw-r--r--source/blender/editors/include/BIF_editview.h61
-rw-r--r--source/blender/editors/include/BIF_filelist.h86
-rw-r--r--source/blender/editors/include/BIF_fsmenu.h76
-rw-r--r--source/blender/editors/include/BIF_gl.h82
-rw-r--r--source/blender/editors/include/BIF_glutil.h225
-rw-r--r--source/blender/editors/include/BIF_graphics.h (renamed from source/blender/python/api2_2x/Text.h)49
-rw-r--r--source/blender/editors/include/BIF_imasel.h51
-rw-r--r--source/blender/editors/include/BIF_interface.h331
-rw-r--r--source/blender/editors/include/BIF_interface_icons.h72
-rw-r--r--source/blender/editors/include/BIF_keyval.h (renamed from source/blender/python/api2_2x/Window.h)22
-rw-r--r--source/blender/editors/include/BIF_language.h (renamed from source/blender/python/api2_2x/vector.h)60
-rw-r--r--source/blender/editors/include/BIF_mainqueue.h47
-rw-r--r--source/blender/editors/include/BIF_meshlaplacian.h87
-rw-r--r--source/blender/editors/include/BIF_meshtools.h (renamed from source/blender/python/api2_2x/Font.h)36
-rw-r--r--source/blender/editors/include/BIF_mywindow.h145
-rw-r--r--source/blender/editors/include/BIF_oops.h71
-rw-r--r--source/blender/editors/include/BIF_outliner.h106
-rw-r--r--source/blender/editors/include/BIF_poseobject.h71
-rw-r--r--source/blender/editors/include/BIF_previewrender.h94
-rw-r--r--source/blender/editors/include/BIF_renderwin.h67
-rw-r--r--source/blender/editors/include/BIF_resources.h600
-rw-r--r--source/blender/editors/include/BIF_retopo.h110
-rw-r--r--source/blender/editors/include/BIF_scrarea.h (renamed from source/blender/src/scrarea.c)45
-rw-r--r--source/blender/editors/include/BIF_screen.h137
-rw-r--r--source/blender/editors/include/BIF_space.h148
-rw-r--r--source/blender/editors/include/BIF_spacetypes.h67
-rw-r--r--source/blender/editors/include/BIF_tbcallback.h42
-rw-r--r--source/blender/editors/include/BIF_toets.h41
-rw-r--r--source/blender/editors/include/BIF_toolbox.h68
-rw-r--r--source/blender/editors/include/BIF_transform.h110
-rw-r--r--source/blender/editors/include/BIF_usiblender.h54
-rw-r--r--source/blender/editors/include/BIF_verse.h142
-rw-r--r--source/blender/editors/include/BIF_writeavicodec.h44
-rw-r--r--source/blender/editors/include/BIF_writeimage.h45
-rw-r--r--source/blender/editors/include/BIF_writemovie.h41
-rw-r--r--source/blender/editors/include/BPI_script.h71
-rw-r--r--source/blender/editors/include/BSE_drawimasel.h60
-rw-r--r--source/blender/editors/include/BSE_drawipo.h76
-rw-r--r--source/blender/editors/include/BSE_drawnla.h (renamed from source/blender/python/api2_2x/bpy_config.h)36
-rw-r--r--source/blender/editors/include/BSE_drawoops.h50
-rw-r--r--source/blender/editors/include/BSE_drawview.h88
-rw-r--r--source/blender/editors/include/BSE_edit.h55
-rw-r--r--source/blender/editors/include/BSE_editaction_types.h77
-rw-r--r--source/blender/editors/include/BSE_editipo.h179
-rw-r--r--source/blender/editors/include/BSE_editipo_types.h53
-rw-r--r--source/blender/editors/include/BSE_editnla_types.h41
-rw-r--r--source/blender/editors/include/BSE_filesel.h66
-rw-r--r--source/blender/editors/include/BSE_headerbuttons.h158
-rw-r--r--source/blender/editors/include/BSE_node.h137
-rw-r--r--source/blender/editors/include/BSE_seqaudio.h53
-rw-r--r--source/blender/editors/include/BSE_seqeffects.h96
-rw-r--r--source/blender/editors/include/BSE_seqscopes.h38
-rw-r--r--source/blender/editors/include/BSE_sequence.h89
-rw-r--r--source/blender/editors/include/BSE_time.h71
-rw-r--r--source/blender/editors/include/BSE_trans_types.h90
-rw-r--r--source/blender/editors/include/BSE_types.h69
-rw-r--r--source/blender/editors/include/BSE_view.h97
-rw-r--r--source/blender/editors/include/LOD_DependKludge.h40
-rw-r--r--source/blender/editors/include/blendef.h465
-rw-r--r--source/blender/editors/include/butspace.h762
-rw-r--r--source/blender/editors/include/datatoc.h (renamed from source/blender/python/api2_2x/Lamp.h)54
-rw-r--r--source/blender/editors/include/editlattice_ext.h42
-rw-r--r--source/blender/editors/include/editmesh.h110
-rw-r--r--source/blender/editors/include/interface.h236
-rw-r--r--source/blender/editors/include/keyed_functions.h (renamed from source/blender/python/api2_2x/Ipo.h)51
-rw-r--r--source/blender/editors/include/license_key.h95
-rw-r--r--source/blender/editors/include/multires.h81
-rw-r--r--source/blender/editors/include/mydevice.h260
-rw-r--r--source/blender/editors/include/nla.h45
-rw-r--r--source/blender/editors/include/objfnt.h105
-rw-r--r--source/blender/editors/include/particle_effect.h47
-rw-r--r--source/blender/editors/include/playanim_ext.h41
-rw-r--r--source/blender/editors/include/transform.h458
-rw-r--r--source/blender/python/BPY_extern.h136
-rw-r--r--source/blender/python/BPY_interface.c2659
-rw-r--r--source/blender/python/BPY_menus.c1118
-rw-r--r--source/blender/python/BPY_menus.h128
-rw-r--r--source/blender/python/CMakeLists.txt57
-rw-r--r--source/blender/python/SConscript26
-rw-r--r--source/blender/python/api2_2x/Armature.c1490
-rw-r--r--source/blender/python/api2_2x/Armature.h70
-rw-r--r--source/blender/python/api2_2x/BGL.c1590
-rw-r--r--source/blender/python/api2_2x/BGL.h333
-rw-r--r--source/blender/python/api2_2x/BezTriple.c716
-rw-r--r--source/blender/python/api2_2x/BezTriple.h64
-rw-r--r--source/blender/python/api2_2x/Blender.c1004
-rw-r--r--source/blender/python/api2_2x/Blender.h41
-rw-r--r--source/blender/python/api2_2x/Bone.c1425
-rw-r--r--source/blender/python/api2_2x/Bone.h76
-rw-r--r--source/blender/python/api2_2x/Camera.c1057
-rw-r--r--source/blender/python/api2_2x/Camera.h82
-rw-r--r--source/blender/python/api2_2x/Constraint.c2692
-rw-r--r--source/blender/python/api2_2x/Constraint.h76
-rw-r--r--source/blender/python/api2_2x/CurNurb.c1098
-rw-r--r--source/blender/python/api2_2x/CurNurb.h70
-rw-r--r--source/blender/python/api2_2x/Curve.c1696
-rw-r--r--source/blender/python/api2_2x/Curve.h78
-rw-r--r--source/blender/python/api2_2x/Draw.c2197
-rw-r--r--source/blender/python/api2_2x/Draw.h77
-rw-r--r--source/blender/python/api2_2x/EXPP_interface.c230
-rw-r--r--source/blender/python/api2_2x/Effect.c1575
-rw-r--r--source/blender/python/api2_2x/Effect.h58
-rw-r--r--source/blender/python/api2_2x/Font.c403
-rw-r--r--source/blender/python/api2_2x/Geometry.c428
-rw-r--r--source/blender/python/api2_2x/Geometry.h42
-rw-r--r--source/blender/python/api2_2x/Group.c813
-rw-r--r--source/blender/python/api2_2x/Group.h66
-rw-r--r--source/blender/python/api2_2x/IDProp.c895
-rw-r--r--source/blender/python/api2_2x/Image.c1339
-rw-r--r--source/blender/python/api2_2x/Image.h60
-rw-r--r--source/blender/python/api2_2x/Ipo.c1842
-rw-r--r--source/blender/python/api2_2x/Ipocurve.c1080
-rw-r--r--source/blender/python/api2_2x/Ipocurve.h58
-rw-r--r--source/blender/python/api2_2x/Key.c681
-rw-r--r--source/blender/python/api2_2x/Key.h68
-rw-r--r--source/blender/python/api2_2x/Lamp.c1570
-rw-r--r--source/blender/python/api2_2x/Lattice.c813
-rw-r--r--source/blender/python/api2_2x/Lattice.h60
-rw-r--r--source/blender/python/api2_2x/Library.c1192
-rw-r--r--source/blender/python/api2_2x/Library.h78
-rw-r--r--source/blender/python/api2_2x/MTex.c827
-rw-r--r--source/blender/python/api2_2x/MTex.h63
-rw-r--r--source/blender/python/api2_2x/Material.c3048
-rw-r--r--source/blender/python/api2_2x/Material.h78
-rw-r--r--source/blender/python/api2_2x/Mathutils.c1804
-rw-r--r--source/blender/python/api2_2x/Mathutils.h85
-rw-r--r--source/blender/python/api2_2x/Mesh.c8677
-rw-r--r--source/blender/python/api2_2x/Mesh.h127
-rw-r--r--source/blender/python/api2_2x/Metaball.c1189
-rw-r--r--source/blender/python/api2_2x/Metaball.h81
-rw-r--r--source/blender/python/api2_2x/Modifier.c1693
-rw-r--r--source/blender/python/api2_2x/Modifier.h72
-rw-r--r--source/blender/python/api2_2x/NLA.c1590
-rw-r--r--source/blender/python/api2_2x/NLA.h77
-rw-r--r--source/blender/python/api2_2x/NMesh.c4164
-rw-r--r--source/blender/python/api2_2x/NMesh.h157
-rw-r--r--source/blender/python/api2_2x/Node.c1213
-rw-r--r--source/blender/python/api2_2x/Node.h91
-rw-r--r--source/blender/python/api2_2x/Noise.c713
-rw-r--r--source/blender/python/api2_2x/Object.c5964
-rw-r--r--source/blender/python/api2_2x/Object.h62
-rw-r--r--source/blender/python/api2_2x/Particle.c1040
-rw-r--r--source/blender/python/api2_2x/Particle.h67
-rw-r--r--source/blender/python/api2_2x/Pose.c1395
-rw-r--r--source/blender/python/api2_2x/Pose.h71
-rw-r--r--source/blender/python/api2_2x/Registry.c245
-rw-r--r--source/blender/python/api2_2x/Registry.h50
-rw-r--r--source/blender/python/api2_2x/Scene.c1868
-rw-r--r--source/blender/python/api2_2x/Scene.h70
-rw-r--r--source/blender/python/api2_2x/Sound.c607
-rw-r--r--source/blender/python/api2_2x/Sound.h57
-rw-r--r--source/blender/python/api2_2x/SurfNurb.c857
-rw-r--r--source/blender/python/api2_2x/SurfNurb.h68
-rw-r--r--source/blender/python/api2_2x/Sys.c400
-rw-r--r--source/blender/python/api2_2x/Text.c576
-rw-r--r--source/blender/python/api2_2x/Text3d.c1206
-rw-r--r--source/blender/python/api2_2x/Text3d.h56
-rw-r--r--source/blender/python/api2_2x/Texture.c2516
-rw-r--r--source/blender/python/api2_2x/Texture.h64
-rw-r--r--source/blender/python/api2_2x/Types.c262
-rw-r--r--source/blender/python/api2_2x/Window.c1594
-rw-r--r--source/blender/python/api2_2x/World.c1034
-rw-r--r--source/blender/python/api2_2x/World.h58
-rw-r--r--source/blender/python/api2_2x/bpy.c86
-rw-r--r--source/blender/python/api2_2x/bpy.h41
-rw-r--r--source/blender/python/api2_2x/bpy_config.c414
-rw-r--r--source/blender/python/api2_2x/bpy_data.c817
-rw-r--r--source/blender/python/api2_2x/bpy_data.h55
-rw-r--r--source/blender/python/api2_2x/bpy_types.h93
-rw-r--r--source/blender/python/api2_2x/charRGBA.c475
-rw-r--r--source/blender/python/api2_2x/charRGBA.h59
-rw-r--r--source/blender/python/api2_2x/constant.c269
-rw-r--r--source/blender/python/api2_2x/constant.h53
-rw-r--r--source/blender/python/api2_2x/doc/API_intro.py247
-rw-r--r--source/blender/python/api2_2x/doc/API_related.py564
-rw-r--r--source/blender/python/api2_2x/doc/Armature.py368
-rw-r--r--source/blender/python/api2_2x/doc/BGL.py1778
-rw-r--r--source/blender/python/api2_2x/doc/BezTriple.py96
-rw-r--r--source/blender/python/api2_2x/doc/Blender.py240
-rw-r--r--source/blender/python/api2_2x/doc/Blender_API.css44
-rw-r--r--source/blender/python/api2_2x/doc/Bpy.py25
-rw-r--r--source/blender/python/api2_2x/doc/Bpy_config.py38
-rw-r--r--source/blender/python/api2_2x/doc/Bpy_data.py281
-rw-r--r--source/blender/python/api2_2x/doc/Camera.py257
-rw-r--r--source/blender/python/api2_2x/doc/Constraint.py248
-rw-r--r--source/blender/python/api2_2x/doc/Curve.py723
-rw-r--r--source/blender/python/api2_2x/doc/Curvedoc.txt105
-rw-r--r--source/blender/python/api2_2x/doc/Draw.py880
-rw-r--r--source/blender/python/api2_2x/doc/Effect.py590
-rw-r--r--source/blender/python/api2_2x/doc/Effectdoc.txt257
-rw-r--r--source/blender/python/api2_2x/doc/Font.py69
-rw-r--r--source/blender/python/api2_2x/doc/Geometry.py97
-rw-r--r--source/blender/python/api2_2x/doc/Group.py127
-rw-r--r--source/blender/python/api2_2x/doc/IDProp.py130
-rw-r--r--source/blender/python/api2_2x/doc/Image.py374
-rw-r--r--source/blender/python/api2_2x/doc/Ipo.py437
-rw-r--r--source/blender/python/api2_2x/doc/IpoCurve.py226
-rw-r--r--source/blender/python/api2_2x/doc/Ipodoc.txt66
-rw-r--r--source/blender/python/api2_2x/doc/Key.py124
-rw-r--r--source/blender/python/api2_2x/doc/Lamp.py521
-rw-r--r--source/blender/python/api2_2x/doc/Lattice.py209
-rw-r--r--source/blender/python/api2_2x/doc/LibData.py137
-rw-r--r--source/blender/python/api2_2x/doc/Library.py114
-rw-r--r--source/blender/python/api2_2x/doc/Material.py1061
-rw-r--r--source/blender/python/api2_2x/doc/Mathutils.py864
-rw-r--r--source/blender/python/api2_2x/doc/Mesh.py1215
-rw-r--r--source/blender/python/api2_2x/doc/MeshPrimitives.py157
-rw-r--r--source/blender/python/api2_2x/doc/Metaball.py246
-rw-r--r--source/blender/python/api2_2x/doc/Metaballdoc.txt58
-rw-r--r--source/blender/python/api2_2x/doc/Modifier.py226
-rw-r--r--source/blender/python/api2_2x/doc/NLA.py245
-rw-r--r--source/blender/python/api2_2x/doc/NMesh.py823
-rw-r--r--source/blender/python/api2_2x/doc/Noise.py300
-rw-r--r--source/blender/python/api2_2x/doc/Object.py1757
-rw-r--r--source/blender/python/api2_2x/doc/Pose.py245
-rw-r--r--source/blender/python/api2_2x/doc/Radio.py351
-rw-r--r--source/blender/python/api2_2x/doc/Registry.py122
-rw-r--r--source/blender/python/api2_2x/doc/Render.py1192
-rw-r--r--source/blender/python/api2_2x/doc/Scene.py392
-rw-r--r--source/blender/python/api2_2x/doc/Sound.py147
-rw-r--r--source/blender/python/api2_2x/doc/Sys.py167
-rw-r--r--source/blender/python/api2_2x/doc/Text.py129
-rw-r--r--source/blender/python/api2_2x/doc/Text3d.py302
-rw-r--r--source/blender/python/api2_2x/doc/Texture.py557
-rw-r--r--source/blender/python/api2_2x/doc/Theme.py211
-rw-r--r--source/blender/python/api2_2x/doc/TimeLine.py80
-rw-r--r--source/blender/python/api2_2x/doc/Types.py70
-rw-r--r--source/blender/python/api2_2x/doc/Window.py538
-rw-r--r--source/blender/python/api2_2x/doc/World.py351
-rw-r--r--source/blender/python/api2_2x/doc/Worlddoc.txt55
-rw-r--r--source/blender/python/api2_2x/doc/epy_docgen-3.sh12
-rw-r--r--source/blender/python/api2_2x/doc/epy_docgen.sh12
-rw-r--r--source/blender/python/api2_2x/doc/id_generics.py30
-rw-r--r--source/blender/python/api2_2x/doc/testbgl.py45
-rw-r--r--source/blender/python/api2_2x/doc/testcamera.py137
-rw-r--r--source/blender/python/api2_2x/doc/testcurve.py20
-rw-r--r--source/blender/python/api2_2x/doc/testeffect.py65
-rw-r--r--source/blender/python/api2_2x/doc/testipo.py24
-rw-r--r--source/blender/python/api2_2x/doc/testmball.py37
-rw-r--r--source/blender/python/api2_2x/doc/testtext.py29
-rw-r--r--source/blender/python/api2_2x/doc/testworld.py21
-rw-r--r--source/blender/python/api2_2x/euler.c502
-rw-r--r--source/blender/python/api2_2x/euler.h67
-rw-r--r--source/blender/python/api2_2x/gen_library.c332
-rw-r--r--source/blender/python/api2_2x/gen_library.h94
-rw-r--r--source/blender/python/api2_2x/gen_utils.c948
-rw-r--r--source/blender/python/api2_2x/gen_utils.h176
-rw-r--r--source/blender/python/api2_2x/logic.c529
-rw-r--r--source/blender/python/api2_2x/logic.h61
-rw-r--r--source/blender/python/api2_2x/matrix.c975
-rw-r--r--source/blender/python/api2_2x/matrix.h80
-rw-r--r--source/blender/python/api2_2x/meshPrimitive.c279
-rw-r--r--source/blender/python/api2_2x/modules.h65
-rw-r--r--source/blender/python/api2_2x/point.c526
-rw-r--r--source/blender/python/api2_2x/point.h67
-rw-r--r--source/blender/python/api2_2x/quat.c668
-rw-r--r--source/blender/python/api2_2x/quat.h73
-rw-r--r--source/blender/python/api2_2x/rgbTuple.c420
-rw-r--r--source/blender/python/api2_2x/rgbTuple.h56
-rw-r--r--source/blender/python/api2_2x/sceneRadio.c893
-rw-r--r--source/blender/python/api2_2x/sceneRender.c3216
-rw-r--r--source/blender/python/api2_2x/sceneRender.h52
-rw-r--r--source/blender/python/api2_2x/sceneSequence.c1163
-rw-r--r--source/blender/python/api2_2x/sceneSequence.h83
-rw-r--r--source/blender/python/api2_2x/sceneTimeLine.c319
-rw-r--r--source/blender/python/api2_2x/sceneTimeLine.h58
-rw-r--r--source/blender/python/api2_2x/vector.c1264
-rw-r--r--source/blender/python/api2_2x/windowTheme.c828
-rw-r--r--source/blender/src/.BCkey1
-rw-r--r--source/blender/src/CMakeLists.txt85
-rw-r--r--source/blender/src/Makefile149
-rw-r--r--source/blender/src/SConscript82
-rw-r--r--source/blender/src/booleanops.c566
-rw-r--r--source/blender/src/booleanops_mesh.c296
-rw-r--r--source/blender/src/butspace.c801
-rw-r--r--source/blender/src/buttons_editing.c6153
-rw-r--r--source/blender/src/buttons_logic.c2814
-rw-r--r--source/blender/src/buttons_object.c4749
-rw-r--r--source/blender/src/buttons_scene.c2082
-rw-r--r--source/blender/src/buttons_script.c384
-rw-r--r--source/blender/src/buttons_shading.c4372
-rw-r--r--source/blender/src/cmap.tga.c92
-rw-r--r--source/blender/src/cmovie.tga.c205
-rw-r--r--source/blender/src/cre/license_key.c197
-rw-r--r--source/blender/src/drawaction.c1294
-rw-r--r--source/blender/src/drawarmature.c2279
-rw-r--r--source/blender/src/drawdeps.c316
-rw-r--r--source/blender/src/drawimage.c2721
-rw-r--r--source/blender/src/drawimasel.c735
-rw-r--r--source/blender/src/drawipo.c2730
-rw-r--r--source/blender/src/drawmesh.c1222
-rw-r--r--source/blender/src/drawnla.c862
-rw-r--r--source/blender/src/drawnode.c2886
-rw-r--r--source/blender/src/drawobject.c5555
-rw-r--r--source/blender/src/drawoops.c521
-rw-r--r--source/blender/src/drawscene.c135
-rw-r--r--source/blender/src/drawscript.c153
-rw-r--r--source/blender/src/drawseq.c1482
-rw-r--r--source/blender/src/drawsound.c240
-rw-r--r--source/blender/src/drawtext.c2230
-rw-r--r--source/blender/src/drawtime.c454
-rw-r--r--source/blender/src/drawview.c3633
-rw-r--r--source/blender/src/edit.c1936
-rw-r--r--source/blender/src/editaction.c3097
-rw-r--r--source/blender/src/editarmature.c4770
-rw-r--r--source/blender/src/editconstraint.c1103
-rw-r--r--source/blender/src/editcurve.c4632
-rw-r--r--source/blender/src/editdeform.c944
-rw-r--r--source/blender/src/editface.c1437
-rw-r--r--source/blender/src/editfont.c1291
-rw-r--r--source/blender/src/editgroup.c186
-rw-r--r--source/blender/src/editimasel.c1156
-rw-r--r--source/blender/src/editipo.c5790
-rw-r--r--source/blender/src/editipo_lib.c401
-rw-r--r--source/blender/src/editipo_mods.c1403
-rw-r--r--source/blender/src/editkey.c777
-rw-r--r--source/blender/src/editlattice.c323
-rw-r--r--source/blender/src/editmball.c544
-rw-r--r--source/blender/src/editmesh.c2205
-rw-r--r--source/blender/src/editmesh_add.c1349
-rw-r--r--source/blender/src/editmesh_lib.c2239
-rw-r--r--source/blender/src/editmesh_loop.c954
-rw-r--r--source/blender/src/editmesh_mods.c4139
-rw-r--r--source/blender/src/editmesh_tools.c6800
-rw-r--r--source/blender/src/editmode_undo.c348
-rw-r--r--source/blender/src/editnla.c2054
-rw-r--r--source/blender/src/editnode.c2244
-rw-r--r--source/blender/src/editobject.c5620
-rw-r--r--source/blender/src/editoops.c675
-rw-r--r--source/blender/src/editparticle.c3141
-rw-r--r--source/blender/src/editscreen.c3818
-rw-r--r--source/blender/src/editseq.c3705
-rw-r--r--source/blender/src/editsima.c2436
-rw-r--r--source/blender/src/editsound.c1063
-rw-r--r--source/blender/src/edittime.c1008
-rw-r--r--source/blender/src/editview.c2777
-rw-r--r--source/blender/src/eventdebug.c195
-rw-r--r--source/blender/src/filelist.c1135
-rw-r--r--source/blender/src/filesel.c2611
-rw-r--r--source/blender/src/fluidsim.c1147
-rw-r--r--source/blender/src/fsmenu.c257
-rw-r--r--source/blender/src/ghostwinlay.c835
-rw-r--r--source/blender/src/glutil.c695
-rw-r--r--source/blender/src/hddaudio.c577
-rw-r--r--source/blender/src/header_action.c1285
-rw-r--r--source/blender/src/header_buttonswin.c729
-rw-r--r--source/blender/src/header_filesel.c194
-rw-r--r--source/blender/src/header_image.c1305
-rw-r--r--source/blender/src/header_imasel.c211
-rw-r--r--source/blender/src/header_info.c2181
-rw-r--r--source/blender/src/header_ipo.c1408
-rw-r--r--source/blender/src/header_nla.c566
-rw-r--r--source/blender/src/header_node.c673
-rw-r--r--source/blender/src/header_oops.c578
-rw-r--r--source/blender/src/header_script.c280
-rw-r--r--source/blender/src/header_seq.c729
-rw-r--r--source/blender/src/header_sound.c444
-rw-r--r--source/blender/src/header_text.c847
-rw-r--r--source/blender/src/header_time.c539
-rw-r--r--source/blender/src/header_view3d.c5489
-rw-r--r--source/blender/src/headerbuttons.c2091
-rw-r--r--source/blender/src/imagepaint.c790
-rw-r--r--source/blender/src/interface.c6699
-rw-r--r--source/blender/src/interface_draw.c2467
-rw-r--r--source/blender/src/interface_icons.c1074
-rw-r--r--source/blender/src/interface_panel.c1957
-rw-r--r--source/blender/src/keyval.c354
-rw-r--r--source/blender/src/language.c453
-rw-r--r--source/blender/src/lorem.c516
-rw-r--r--source/blender/src/mainqueue.c102
-rw-r--r--source/blender/src/meshlaplacian.c1891
-rw-r--r--source/blender/src/meshtools.c1132
-rw-r--r--source/blender/src/multires-firstlevel.c410
-rw-r--r--source/blender/src/multires.c1650
-rw-r--r--source/blender/src/mywindow.c744
-rw-r--r--source/blender/src/oops.c1104
-rw-r--r--source/blender/src/outliner.c3640
-rw-r--r--source/blender/src/parametrizer.c4200
-rw-r--r--source/blender/src/parametrizer.h85
-rw-r--r--source/blender/src/parametrizer_intern.h192
-rw-r--r--source/blender/src/playanim.c813
-rw-r--r--source/blender/src/poseobject.c1258
-rw-r--r--source/blender/src/preview.blend.c13901
-rw-r--r--source/blender/src/previewrender.c912
-rw-r--r--source/blender/src/prvicons.c436
-rw-r--r--source/blender/src/pub/license_key.c447
-rw-r--r--source/blender/src/reeb.c1923
-rw-r--r--source/blender/src/renderwin.c1449
-rw-r--r--source/blender/src/resources.c923
-rw-r--r--source/blender/src/retopo.c921
-rw-r--r--source/blender/src/screendump.c161
-rw-r--r--source/blender/src/sculptmode-stroke.c279
-rw-r--r--source/blender/src/sculptmode.c2267
-rw-r--r--source/blender/src/seqaudio.c553
-rw-r--r--source/blender/src/seqeffects.c3032
-rw-r--r--source/blender/src/seqscopes.c340
-rw-r--r--source/blender/src/sequence.c1776
-rw-r--r--source/blender/src/space.c6678
-rw-r--r--source/blender/src/spacetypes.c161
-rw-r--r--source/blender/src/swapbuffers.c289
-rw-r--r--source/blender/src/toets.c983
-rw-r--r--source/blender/src/toolbox.c2245
-rw-r--r--source/blender/src/transform.c4115
-rw-r--r--source/blender/src/transform_constraints.c1046
-rw-r--r--source/blender/src/transform_conversions.c3616
-rw-r--r--source/blender/src/transform_generics.c1061
-rw-r--r--source/blender/src/transform_manipulator.c1720
-rw-r--r--source/blender/src/transform_numinput.c247
-rw-r--r--source/blender/src/transform_snap.c712
-rw-r--r--source/blender/src/unwrapper.c480
-rw-r--r--source/blender/src/verse_common.c298
-rw-r--r--source/blender/src/verse_image.c343
-rw-r--r--source/blender/src/verse_mesh.c1629
-rw-r--r--source/blender/src/verse_object.c600
-rw-r--r--source/blender/src/view.c1863
-rw-r--r--source/blender/src/vpaint.c1621
-rw-r--r--source/blender/src/winlay.h88
-rw-r--r--source/blender/src/writeavicodec.c835
-rw-r--r--source/blender/src/writeimage.c243
-rw-r--r--source/blender/src/writemovie.c502
-rw-r--r--source/blender/windowmanager/Makefile (renamed from source/blender/python/Makefile)17
-rw-r--r--source/blender/windowmanager/WM_api.h77
-rw-r--r--source/blender/windowmanager/WM_types.h70
-rw-r--r--source/blender/windowmanager/intern/Makefile (renamed from source/blender/python/api2_2x/Makefile)84
-rw-r--r--source/blender/windowmanager/intern/wm.c164
-rw-r--r--source/blender/windowmanager/intern/wm_apple.c138
-rw-r--r--source/blender/windowmanager/intern/wm_cursors.c (renamed from source/blender/src/cursors.c)163
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c470
-rw-r--r--source/blender/windowmanager/intern/wm_files.c (renamed from source/blender/src/usiblender.c)549
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c302
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c112
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c125
-rw-r--r--source/blender/windowmanager/intern/wm_window.c491
-rw-r--r--source/blender/windowmanager/wm.h43
-rw-r--r--source/blender/windowmanager/wm_cursors.h115
-rw-r--r--source/blender/windowmanager/wm_event_system.h97
-rw-r--r--source/blender/windowmanager/wm_event_types.h255
-rw-r--r--source/blender/windowmanager/wm_files.h36
-rw-r--r--source/blender/windowmanager/wm_window.h59
481 files changed, 13698 insertions, 366027 deletions
diff --git a/source/blender/src/B.blend.c b/source/blender/editors/datafiles/B.blend.c
index 0a33fc99013..0a33fc99013 100644
--- a/source/blender/src/B.blend.c
+++ b/source/blender/editors/datafiles/B.blend.c
diff --git a/source/blender/src/Bfont.c b/source/blender/editors/datafiles/Bfont.c
index 2d442e2cf73..676b0c55b58 100644
--- a/source/blender/src/Bfont.c
+++ b/source/blender/editors/datafiles/Bfont.c
@@ -1,6 +1,6 @@
/* DataToC output of file <Bfont> */
/*
- * $Id$
+ * $Id: Bfont.c 125 2002-11-25 12:02:15Z mein $
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
diff --git a/source/blender/editors/datafiles/Makefile b/source/blender/editors/datafiles/Makefile
new file mode 100644
index 00000000000..302267be505
--- /dev/null
+++ b/source/blender/editors/datafiles/Makefile
@@ -0,0 +1,49 @@
+#
+# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+#
+# ***** 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# The Original Code is Copyright (C) 2007 Blender Foundation
+# All rights reserved.
+#
+# The Original Code is: all of this file.
+#
+# Contributor(s): none yet.
+#
+# ***** END GPL LICENSE BLOCK *****
+#
+# Makes module object directory and bounces make to subdirectories.
+
+LIBNAME = editors_datafiles
+DIR = $(OCGDIR)/blender/$(LIBNAME)
+
+include nan_compile.mk
+
+CFLAGS += $(LEVEL_1_C_WARNINGS)
+
+CPPFLAGS += -I$(OPENGL_HEADERS)
+
+# not very neat....
+CPPFLAGS += -I../../../blenkernel
+CPPFLAGS += -I../../../blenlib
+CPPFLAGS += -I../../../makesdna
+CPPFLAGS += -I../../../imbuf
+CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
+
+# own include
+
+CPPFLAGS += -I../include
diff --git a/source/blender/src/bfont.ttf.c b/source/blender/editors/datafiles/bfont.ttf.c
index a52d6ded28a..a52d6ded28a 100644
--- a/source/blender/src/bfont.ttf.c
+++ b/source/blender/editors/datafiles/bfont.ttf.c
diff --git a/source/blender/src/blenderbuttons.c b/source/blender/editors/datafiles/blenderbuttons.c
index c8fb9ec7a7a..c8fb9ec7a7a 100644
--- a/source/blender/src/blenderbuttons.c
+++ b/source/blender/editors/datafiles/blenderbuttons.c
diff --git a/source/blender/src/splash.jpg.c b/source/blender/editors/datafiles/splash.jpg.c
index c1ca8b575e6..c1ca8b575e6 100644
--- a/source/blender/src/splash.jpg.c
+++ b/source/blender/editors/datafiles/splash.jpg.c
diff --git a/source/blender/editors/include/BDR_drawaction.h b/source/blender/editors/include/BDR_drawaction.h
new file mode 100644
index 00000000000..28f8af534fb
--- /dev/null
+++ b/source/blender/editors/include/BDR_drawaction.h
@@ -0,0 +1,88 @@
+/**
+ * $Id: BDR_drawaction.h 11183 2007-07-06 09:59:18Z aligorith $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BDR_DRAWACTION_H
+#define BDR_DRAWACTION_H
+
+struct BezTriple;
+struct Ipo;
+struct IpoCurve;
+struct gla2DDrawInfo;
+struct bAction;
+struct Object;
+struct ListBase;
+
+/* ****************************** Base Structs ****************************** */
+
+/* Keyframe Column Struct */
+typedef struct ActKeyColumn {
+ struct ActKeyColumn *next, *prev;
+ short sel, handle_type;
+ float cfra;
+
+ /* only while drawing - used to determine if long-keyframe needs to be drawn */
+ short modified;
+ short totcurve;
+} ActKeyColumn;
+
+/* 'Long Keyframe' Struct */
+typedef struct ActKeyBlock {
+ struct ActKeyBlock *next, *prev;
+ short sel, handle_type;
+ float val;
+ float start, end;
+
+ /* only while drawing - used to determine if block needs to be drawn */
+ short modified;
+ short totcurve;
+} ActKeyBlock;
+
+
+/* ******************************* Methods ****************************** */
+
+/* Action Generics */
+void draw_cfra_action(void);
+
+/* Channel Drawing */
+void draw_icu_channel(struct gla2DDrawInfo *di, struct IpoCurve *icu, float ypos);
+void draw_ipo_channel(struct gla2DDrawInfo *di, struct Ipo *ipo, float ypos);
+void draw_action_channel(struct gla2DDrawInfo *di, bAction *act, float ypos);
+void draw_object_channel(struct gla2DDrawInfo *di, Object *ob, float ypos);
+
+/* Keydata Generation */
+void icu_to_keylist(struct IpoCurve *icu, ListBase *keys, ListBase *blocks);
+void ipo_to_keylist(struct Ipo *ipo, ListBase *keys, ListBase *blocks);
+void action_to_keylist(bAction *act, ListBase *keys, ListBase *blocks);
+void ob_to_keylist(Object *ob, ListBase *keys, ListBase *blocks);
+
+#endif /* BDR_DRAWACTION_H */
+
diff --git a/source/blender/editors/include/BDR_drawmesh.h b/source/blender/editors/include/BDR_drawmesh.h
new file mode 100644
index 00000000000..1c389799127
--- /dev/null
+++ b/source/blender/editors/include/BDR_drawmesh.h
@@ -0,0 +1,84 @@
+/**
+ * $Id: BDR_drawmesh.h 11860 2007-08-28 08:53:36Z blendix $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BDR_DRAWMESH_H
+#define BDR_DRAWMESH_H
+
+struct Image;
+struct MTFace;
+struct Object;
+struct DerivedMesh;
+struct Mesh;
+struct EdgeHash;
+
+/**
+ * Enables or disable mipmapping for realtime images (textures).
+ * Note that this will will destroy all texture bindings in OpenGL.
+ * @see free_realtime_image()
+ * @param mipmap Turn mipmapping on (mipmap!=0) or off (mipmap==0).
+ */
+void set_mipmap(int mipmap);
+
+/**
+ * Enables or disable linear mipmap setting for realtime images (textures).
+ * Note that this will will destroy all texture bindings in OpenGL.
+ * @see free_realtime_image()
+ * @param mipmap Turn linear mipmapping on (linear!=0) or off (linear==0).
+ */
+void set_linear_mipmap(int linear);
+
+/**
+ * Returns the current setting for linear mipmapping.
+ */
+int get_linear_mipmap(void);
+
+/**
+ * Resets the realtime image cache variables.
+ */
+void clear_realtime_image_cache(void);
+
+
+void update_realtime_image(struct Image *ima, int x, int y, int w, int h);
+void free_realtime_image(struct Image *ima);
+void free_all_realtime_images(void);
+void make_repbind(struct Image *ima);
+int set_tpage(struct MTFace *tface);
+
+void texpaint_enable_mipmap(void);
+void texpaint_disable_mipmap(void);
+
+void draw_mesh_textured(struct Object *ob, struct DerivedMesh *dm, int facesel);
+struct EdgeHash *get_tface_mesh_marked_edge_info(struct Mesh *me);
+void init_realtime_GL(void);
+
+#endif /* BDR_DRAWMESH_H */
+
diff --git a/source/blender/editors/include/BDR_drawobject.h b/source/blender/editors/include/BDR_drawobject.h
new file mode 100644
index 00000000000..be512c7a154
--- /dev/null
+++ b/source/blender/editors/include/BDR_drawobject.h
@@ -0,0 +1,82 @@
+/**
+ * $Id: BDR_drawobject.h 10455 2007-04-04 13:18:41Z campbellbarton $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BDR_DRAWOBJECT_H
+#define BDR_DRAWOBJECT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+struct Object;
+struct Nurb;
+struct Lamp;
+struct ListBase;
+struct BoundBox;
+struct Base;
+struct BPoint;
+struct BezTriple;
+struct EditVert;
+struct EditFace;
+struct EditEdge;
+
+int set_gl_material(int nr);
+int init_gl_materials(struct Object *ob, int check_alpha);
+
+void mesh_foreachScreenVert(void (*func)(void *userData, struct EditVert *eve, int x, int y, int index), void *userData, int clipVerts);
+void mesh_foreachScreenEdge(void (*func)(void *userData, struct EditEdge *eed, int x0, int y0, int x1, int y1, int index), void *userData, int clipVerts);
+void mesh_foreachScreenFace(void (*func)(void *userData, struct EditFace *efa, int x, int y, int index), void *userData);
+
+void lattice_foreachScreenVert(void (*func)(void *userData, struct BPoint *bp, int x, int y), void *userData);
+void nurbs_foreachScreenVert(void (*func)(void *userData, struct Nurb *nu, struct BPoint *bp, struct BezTriple *bezt, int beztindex, int x, int y), void *userData);
+
+void drawcircball(int mode, float *cent, float rad, float tmat[][4]);
+void get_local_bounds(struct Object *ob, float *center, float *size);
+
+/* drawing flags: */
+#define DRAW_PICKING 1
+#define DRAW_CONSTCOLOR 2
+void draw_object(struct Base *base, int flag);
+void drawaxes(float size, int flag, char drawtype);
+
+void draw_object_ext(struct Base *base);
+void drawsolidcube(float size);
+extern void draw_object_backbufsel(struct Object *ob);
+void draw_object_instance(struct Object *ob, int dt, int outline);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BDR_DRAWOBJECT_H */
+
diff --git a/source/blender/editors/include/BDR_editcurve.h b/source/blender/editors/include/BDR_editcurve.h
new file mode 100644
index 00000000000..889bf135972
--- /dev/null
+++ b/source/blender/editors/include/BDR_editcurve.h
@@ -0,0 +1,105 @@
+/**
+ * $Id: BDR_editcurve.h 12519 2007-11-08 00:06:48Z campbellbarton $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BDR_EDITCURVE_H
+#define BDR_EDITCURVE_H
+
+struct Object;
+struct Curve;
+struct Nurb;
+struct BezTriple;
+struct BPoint;
+struct BezTripleNurb;
+
+short isNurbsel(struct Nurb *nu);
+int isNurbsel_count(struct Nurb *nu);
+void printknots(void);
+void load_editNurb(void);
+void make_editNurb(void);
+void remake_editNurb(void);
+void separate_nurb(void);
+short isNurbselUV(struct Nurb *nu, int *u, int *v, int flag);
+void setflagsNurb(short flag);
+void rotateflagNurb(short flag, float *cent, float rotmat[][3]);
+void translateflagNurb(short flag, float *vec);
+void weightflagNurb(short flag, float w, int mode);
+void deleteflagNurb(short flag);
+short extrudeflagNurb(int flag);
+void adduplicateflagNurb(short flag);
+void switchdirectionNurb2(void);
+void switchdirection_knots(float *base, int tot);
+void deselectall_nurb(void);
+void hideNurb(int swap);
+void revealNurb(void);
+void selectswapNurb(void);
+void subdivideNurb(void);
+
+int convertspline(short type, struct Nurb *nu);
+void setsplinetype(short type);
+void rotate_direction_nurb(struct Nurb *nu);
+int is_u_selected(struct Nurb *nu, int u);
+void make_selection_list_nurb(void);
+void merge_2_nurb(struct Nurb *nu1, struct Nurb *nu2);
+void merge_nurb(void);
+void addsegment_nurb(void);
+void mouse_nurb(void);
+void spinNurb(float *dvec, short mode);
+void addvert_Nurb(int mode);
+void extrude_nurb(void);
+void makecyclicNurb(void);
+void selectconnected_nurb(void);
+void selectrow_nurb(void);
+void selectend_nurb(short selfirst, short doswap, short selstatus);
+void select_more_nurb(void);
+void select_less_nurb(void);
+void select_next_nurb(void);
+void select_prev_nurb(void);
+void select_random_nurb(void);
+void select_every_nth_nurb(void);
+void adduplicate_nurb(void);
+void delNurb(void);
+void nurb_set_smooth(short event);
+int join_curve(int type);
+struct Nurb *addNurbprim(int type, int stype, int newname);
+void default_curve_ipo(struct Curve *cu);
+void add_primitiveCurve(int stype);
+void add_primitiveNurb(int type);
+void clear_tilt(void);
+void clever_numbuts_curve(void);
+int bezt_compare (const void *e1, const void *e2);
+void setweightNurb( void );
+void setradiusNurb( void );
+void smoothradiusNurb( void );
+
+extern void undo_push_curve(char *name);
+
+#endif /* BDR_EDITCURVE_H */
diff --git a/source/blender/editors/include/BDR_editface.h b/source/blender/editors/include/BDR_editface.h
new file mode 100644
index 00000000000..c9f8bdb589f
--- /dev/null
+++ b/source/blender/editors/include/BDR_editface.h
@@ -0,0 +1,61 @@
+/**
+ * $Id: BDR_editface.h 12139 2007-09-25 03:31:12Z campbellbarton $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BDR_EDITFACE_H
+#define BDR_EDITFACE_H
+
+struct MTFace;
+struct EditFace;
+struct Mesh;
+struct MCol;
+
+struct MTFace *get_active_mtface(struct EditFace **efa, struct MCol **mcol, short sloppy);
+void calculate_uv_map(unsigned short mapmode);
+void default_uv(float uv[][2], float size);
+void make_tfaces(struct Mesh *me);
+void reveal_tface(void);
+void hide_tface(void);
+void select_linked_tfaces(int mode);
+void deselectall_tface(void);
+void selectswap_tface(void);
+void rotate_uv_tface(void);
+void mirror_uv_tface(void);
+int minmax_tface(float *min, float *max);
+void face_select(void);
+void face_borderselect(void);
+void uv_autocalc_tface(void);
+void set_texturepaint(void);
+void get_same_uv(void);
+void seam_mark_clear_tface(short mode);
+
+#endif /* BDR_EDITFACE_H */
+
diff --git a/source/blender/python/api2_2x/IDProp.h b/source/blender/editors/include/BDR_editmball.h
index 5fcf4f6e1b7..b7b852c4206 100644
--- a/source/blender/python/api2_2x/IDProp.h
+++ b/source/blender/editors/include/BDR_editmball.h
@@ -1,5 +1,5 @@
/**
- * $Id: IDProp.h
+ * $Id: BDR_editmball.h 10893 2007-06-08 14:17:13Z jiri $
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
@@ -23,39 +23,34 @@
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
- * Contributor(s): Joseph Eagar
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
-
-#include <Python.h>
-
-struct ID;
-struct IDProperty;
-struct BPy_IDGroup_Iter;
-typedef struct BPy_IDProperty {
- PyObject_VAR_HEAD
- struct ID *id;
- struct IDProperty *prop, *parent;
- PyObject *data_wrap;
-} BPy_IDProperty;
+#ifndef BDR_EDITMBALL_H
+#define BDR_EDITMBALL_H
-typedef struct BPy_IDArray {
- PyObject_VAR_HEAD
- struct ID *id;
- struct IDProperty *prop;
-} BPy_IDArray;
+void make_editMball(void);
+void load_editMball(void);
-typedef struct BPy_IDGroup_Iter {
- PyObject_VAR_HEAD
- BPy_IDProperty *group;
- struct IDProperty *cur;
- int mode;
-} BPy_IDGroup_Iter;
+/**
+ * @attention The argument is discarded. It is there for
+ * compatibility.
+ */
+void add_primitiveMball(int);
+void deselectall_mball(void);
+void selectinverse_mball(void);
+void selectrandom_mball(void);
+void mouse_mball(void);
+void adduplicate_mball(void);
+void delete_mball(void);
+void freeMetaElemlist(struct ListBase *lb);
+void undo_push_mball(char *name);
+void hide_mball(char hide);
+void reveal_mball(void);
-PyObject *BPy_Wrap_IDProperty(struct ID *id, struct IDProperty *prop, struct IDProperty *parent);
-void IDProp_Init_Types(void);
+#endif /* BDR_EDITMBALL_H */
-#define IDPROP_ITER_KEYS 0
-#define IDPROP_ITER_ITEMS 1
diff --git a/source/blender/editors/include/BDR_editobject.h b/source/blender/editors/include/BDR_editobject.h
new file mode 100644
index 00000000000..5aeeb4d5c1b
--- /dev/null
+++ b/source/blender/editors/include/BDR_editobject.h
@@ -0,0 +1,128 @@
+/**
+ * $Id: BDR_editobject.h 12696 2007-11-27 19:23:26Z campbellbarton $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BDR_EDITOBJECT_H
+#define BDR_EDITOBJECT_H
+
+struct Object;
+struct Tex;
+struct Material;
+struct Base;
+struct HookModifierData;
+struct Scene;
+
+void add_object_draw(int type);
+void add_objectLamp(short type);
+void free_and_unlink_base_from_scene(struct Scene *scene, struct Base *base);
+void free_and_unlink_base(struct Base *base);
+void delete_obj(int ok);
+void make_track(void);
+void apply_obmat(struct Object *ob);
+void clear_parent(void);
+void clear_track(void);
+void clear_object(char mode);
+void reset_slowparents(void);
+void set_slowparent(void);
+void make_vertex_parent(void);
+int test_parent_loop(struct Object *par, struct Object *ob);
+void make_parent(void);
+void make_proxy(void);
+
+#define EM_WAITCURSOR (1 << 0)
+#define EM_FREEDATA (1 << 1)
+#define EM_FREEUNDO (1 << 2)
+
+void exit_editmode(int flag);
+void check_editmode(int type);
+void enter_editmode(int wc);
+
+void exit_paint_modes(void);
+
+void docenter(int centermode);
+void docenter_new(void);
+void docenter_cursor(void);
+void movetolayer(void);
+void special_editmenu(void);
+void convertmenu(void);
+void copy_attr_menu(void);
+void copy_attr(short event);
+void link_to_scene(unsigned short nr);
+void make_links_menu(void);
+void make_links(short event);
+void make_duplilist_real(void);
+void apply_object(void);
+
+/* old transform */
+void apply_keyb_grid(float *val, float fac1, float fac2, float fac3, int invert);
+void headerprint(char *str);
+/* used for old game engine collision optimize */
+int cylinder_intersect_test(void);
+int sphere_intersect_test(void);
+
+
+void std_rmouse_transform(void (*xf_func)(int, int));
+void rightmouse_transform(void);
+void single_object_users(int flag);
+void new_id_matar(struct Material **matar, int totcol);
+void single_obdata_users(int flag);
+void single_mat_users(int flag);
+void do_single_tex_user(struct Tex **from);
+void single_tex_users_expand(void);
+void single_mat_users_expand(void);
+void single_user(void);
+void make_local_menu(void);
+void make_local(int mode);
+void adduplicate(int mode, int dupflag); /* when the dupflag is 0 no data is duplicated */
+void selectlinks_menu(void);
+void selectlinks(int nr);
+void image_aspect(void);
+void set_ob_ipoflags(void);
+void select_select_keys(void);
+int vergbaseco(const void *a1, const void *a2);
+void auto_timeoffs(void);
+void texspace_edit(void);
+void flip_subdivison(int);
+void mirrormenu(void);
+void hookmenu(void); /* object mode hook menu */
+
+
+void add_hook(void);
+void hook_select(struct HookModifierData *hmd);
+int hook_getIndexArray(int *tot, int **indexar, char *name, float *cent_r);
+
+int object_is_libdata(struct Object *ob);
+int object_data_is_libdata(struct Object *ob);
+void hide_objects(int select);
+void show_objects(void);
+
+#endif /* BDR_EDITOBJECT_H */
+
diff --git a/source/blender/editors/include/BDR_imagepaint.h b/source/blender/editors/include/BDR_imagepaint.h
new file mode 100644
index 00000000000..f40e9a3102a
--- /dev/null
+++ b/source/blender/editors/include/BDR_imagepaint.h
@@ -0,0 +1,44 @@
+/**
+ * $Id: BDR_imagepaint.h 8390 2006-08-27 13:29:00Z blendix $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BDR_IMAGEPAINT_H
+#define BDR_IMAGEPAINT_H
+
+void imagepaint_redraw_tool(void);
+void imagepaint_pick(short mousebutton);
+void imagepaint_paint(short mousebutton, short texturepaint);
+
+void imagepaint_undo();
+void free_imagepaint();
+
+#endif /* BDR_IMAGEPAINT_H */
+
diff --git a/source/blender/editors/include/BDR_sculptmode.h b/source/blender/editors/include/BDR_sculptmode.h
new file mode 100644
index 00000000000..f1b5170f395
--- /dev/null
+++ b/source/blender/editors/include/BDR_sculptmode.h
@@ -0,0 +1,142 @@
+/*
+ * $Id: BDR_sculptmode.h 11036 2007-06-24 22:28:28Z nicholasbishop $
+ *
+ * ***** 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2006 by Nicholas Bishop
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef BDR_SCULPTMODE_H
+#define BDR_SCULPTMODE_H
+
+#include "DNA_listBase.h"
+#include "DNA_vec_types.h"
+/* For bglMats */
+#include "BIF_glutil.h"
+#include "transform.h"
+
+struct uiBlock;
+struct BrushData;
+struct EditData;
+struct IndexNode;
+struct KeyBlock;
+struct Mesh;
+struct Object;
+struct PartialVisibility;
+struct Scene;
+struct ScrArea;
+struct SculptData;
+struct SculptStroke;
+
+typedef enum PropsetMode {
+ PropsetNone = 0,
+ PropsetSize,
+ PropsetStrength,
+ PropsetTexRot
+} PropsetMode;
+typedef struct PropsetData {
+ PropsetMode mode;
+ unsigned int tex;
+ short origloc[2];
+ float *texdata;
+
+ short origsize;
+ char origstrength;
+ float origtexrot;
+
+ NumInput num;
+} PropsetData;
+
+typedef struct SculptSession {
+ bglMats mats;
+
+ /* An array of lists; array is sized as
+ large as the number of verts in the mesh,
+ the list for each vert contains the index
+ for all the faces that use that vertex */
+ struct ListBase *vertex_users;
+ struct IndexNode *vertex_users_mem;
+ int vertex_users_size;
+
+ /* Used temporarily per-stroke */
+ float *vertexcosnos;
+ ListBase damaged_rects;
+ ListBase damaged_verts;
+
+ /* Used to cache the render of the active texture */
+ unsigned int texcache_w, texcache_h, *texcache;
+
+ PropsetData *propset;
+
+ /* For rotating around a pivot point */
+ vec3f pivot;
+
+ struct SculptStroke *stroke;
+} SculptSession;
+
+SculptSession *sculpt_session(void);
+struct SculptData *sculpt_data(void);
+
+/* Memory */
+void sculptmode_init(struct Scene *);
+void sculptmode_free_all(struct Scene *);
+void sculptmode_correct_state(void);
+
+/* Interface */
+void sculptmode_draw_interface_tools(struct uiBlock *block,unsigned short cx, unsigned short cy);
+void sculptmode_draw_interface_textures(struct uiBlock *block,unsigned short cx, unsigned short cy);
+void sculptmode_rem_tex(void*,void*);
+void sculptmode_propset_init(PropsetMode mode);
+void sculptmode_propset(const unsigned short event);
+void sculptmode_selectbrush_menu(void);
+void sculptmode_draw_mesh(int);
+void sculpt_paint_brush(char clear);
+void sculpt_stroke_draw();
+
+struct BrushData *sculptmode_brush(void);
+float tex_angle(void);
+void do_symmetrical_brush_actions(struct EditData *e, short *, short *);
+
+void sculptmode_update_tex(void);
+char sculpt_modifiers_active(struct Object *ob);
+void sculpt(void);
+void set_sculptmode(void);
+
+/* Stroke */
+void sculpt_stroke_new(const int max);
+void sculpt_stroke_free();
+void sculpt_stroke_add_point(const short x, const short y);
+void sculpt_stroke_apply(struct EditData *);
+void sculpt_stroke_apply_all(struct EditData *e);
+void sculpt_stroke_draw();
+
+
+/* Partial Mesh Visibility */
+struct PartialVisibility *sculptmode_copy_pmv(struct PartialVisibility *);
+void sculptmode_pmv_free(struct PartialVisibility *);
+void sculptmode_revert_pmv(struct Mesh *me);
+void sculptmode_pmv_off(struct Mesh *me);
+void sculptmode_pmv(int mode);
+
+#endif
diff --git a/source/blender/editors/include/BDR_unwrapper.h b/source/blender/editors/include/BDR_unwrapper.h
new file mode 100644
index 00000000000..24f32a11211
--- /dev/null
+++ b/source/blender/editors/include/BDR_unwrapper.h
@@ -0,0 +1,51 @@
+/**
+ * $Id: BDR_unwrapper.h 10331 2007-03-22 20:32:20Z blendix $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BDR_UNWRAPPER_H
+#define BDR_UNWRAPPER_H
+
+struct Mesh;
+
+void set_seamtface(void); /* set TF_SEAM flags in tfaces */
+void select_linked_tfaces_with_seams(int mode, struct Mesh *me, unsigned int index);
+
+void unwrap_lscm(short seamcut); /* unwrap faces selected in 3d view */
+void minimize_stretch_tface_uv(void); /* optimize faces selected in uv editor */
+void pack_charts_tface_uv(void);
+
+/* for live mode: no undo pushes, caching for quicky re-unwrap */
+void unwrap_lscm_live_begin(void);
+void unwrap_lscm_live_re_solve(void);
+void unwrap_lscm_live_end(short cancel);
+
+#endif /* BDR_UNWRAPPER_H */
+
diff --git a/source/blender/python/api2_2x/windowTheme.h b/source/blender/editors/include/BDR_vpaint.h
index 45900830706..0bda2010a74 100644
--- a/source/blender/python/api2_2x/windowTheme.h
+++ b/source/blender/editors/include/BDR_vpaint.h
@@ -1,5 +1,5 @@
-/*
- * $Id: windowTheme.h 8774 2006-11-07 11:24:11Z jesterking $
+/**
+ * $Id: BDR_vpaint.h 8971 2006-11-20 12:08:06Z ton $
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
@@ -23,38 +23,36 @@
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
- * This is a new part of Blender.
+ * The Original Code is: all of this file.
*
- * Contributor(s): Willian P. Germano
+ * Contributor(s): none yet.
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
+ */
-#ifndef EXPP_WINDOWTHEME_H
-#define EXPP_WINDOWTHEME_H
+#ifndef BDR_VPAINT_H
+#define BDR_VPAINT_H
-#include <Python.h>
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_userdef_types.h"
+struct Mesh;
+struct MDeformVert; /* __NLA */
-typedef struct {
- PyObject_HEAD struct bTheme *theme;
- struct ThemeUI *tui;
+unsigned int rgba_to_mcol(float r, float g, float b, float a);
+void do_shared_vertexcol(struct Mesh *me);
+void make_vertexcol(int shade);
-} BPy_ThemeUI;
+void clear_vpaint(void);
+void clear_vpaint_selectedfaces(void);
+void vpaint_dogamma(void);
+void sample_vpaint(void);
-typedef struct {
- PyObject_HEAD struct bTheme *theme;
- struct ThemeSpace *tsp;
+void free_vertexpaint(void);
+void vertex_paint(void);
+void set_vpaint(void);
-} BPy_ThemeSpace;
+void set_wpaint(void);
+void clear_wpaint_selectedfaces(void);
+void weight_paint(void);
-typedef struct {
- PyObject_HEAD struct bTheme *theme;
-} BPy_Theme;
+#endif /* BDR_VPAINT_H */
-PyObject *Theme_Init( void );
-
-#endif /* EXPP_WINDOWTHEME_H */
diff --git a/source/blender/editors/include/BIF_butspace.h b/source/blender/editors/include/BIF_butspace.h
new file mode 100644
index 00000000000..dae86df7712
--- /dev/null
+++ b/source/blender/editors/include/BIF_butspace.h
@@ -0,0 +1,140 @@
+/**
+ * $Id: BIF_butspace.h 12682 2007-11-26 22:09:57Z blendix $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+#ifndef BIF_BUTSPACE_H
+#define BIF_BUTSPACE_H
+
+/* all internal/external calls and event codes for buttons space */
+/* should be split in 2 parts... */
+
+struct Base;
+struct ID;
+
+/* external, butspace.c */
+extern void do_butspace(unsigned short event);
+extern void redraw_test_buttons(struct Object *new);
+
+extern char *image_type_pup(void);
+
+/* buttons_editing.c */
+extern void validate_editbonebutton_cb(void *bonev, void *namev);
+
+/* buts->mainb old */
+#define BUTS_VIEW 0
+#define BUTS_LAMP 1
+#define BUTS_MAT 2
+#define BUTS_TEX 3
+#define BUTS_ANIM 4
+#define BUTS_WORLD 5
+#define BUTS_RENDER 6
+#define BUTS_EDIT 7
+#define BUTS_GAME 8
+#define BUTS_FPAINT 9
+#define BUTS_RADIO 10
+#define BUTS_SCRIPT 11
+#define BUTS_SOUND 12
+#define BUTS_CONSTRAINT 13
+#define BUTS_EFFECTS 14
+
+/* warning: the values of these defines are used in sbuts->tabs[7] */
+/* buts->mainb new */
+#define CONTEXT_SCENE 0
+#define CONTEXT_OBJECT 1
+#define CONTEXT_TYPES 2
+#define CONTEXT_SHADING 3
+#define CONTEXT_EDITING 4
+#define CONTEXT_SCRIPT 5
+#define CONTEXT_LOGIC 6
+
+/* buts->tab new */
+#define TAB_SHADING_MAT 0
+#define TAB_SHADING_TEX 1
+#define TAB_SHADING_RAD 2
+#define TAB_SHADING_WORLD 3
+#define TAB_SHADING_LAMP 4
+
+#define TAB_OBJECT_OBJECT 0
+#define TAB_OBJECT_PHYSICS 1
+#define TAB_OBJECT_PARTICLE 2
+
+#define TAB_SCENE_RENDER 0
+#define TAB_SCENE_WORLD 1
+#define TAB_SCENE_ANIM 2
+#define TAB_SCENE_SOUND 3
+
+
+/* buts->scaflag */
+#define BUTS_SENS_SEL 1
+#define BUTS_SENS_ACT 2
+#define BUTS_SENS_LINK 4
+#define BUTS_CONT_SEL 8
+#define BUTS_CONT_ACT 16
+#define BUTS_CONT_LINK 32
+#define BUTS_ACT_SEL 64
+#define BUTS_ACT_ACT 128
+#define BUTS_ACT_LINK 256
+
+
+/* buttons grid */
+#define PANELX 320
+#define PANELY 0
+#define PANELW 318
+#define PANELH 204
+
+#define BUTW1 300
+#define BUTW2 145
+#define BUTW3 93
+#define BUTW4 67
+#define ICONBUTW 20
+#define BUTH 22
+
+#define YSPACE 6
+#define XSPACE 10
+#define PANEL_YMAX 210
+#define PANEL_XMAX 310
+
+#define X1CLM1 10
+
+#define X2CLM1 X1CLM1
+#define X2CLM2 165
+
+#define X3CLM1 X1CLM1
+#define X3CLM2 113
+#define X3CLM3 217
+
+#define X4CLM1 X1CLM1
+#define X4CLM2 77
+#define X4CLM3 165
+#define X4CLM4 232
+
+
+#endif
+
diff --git a/source/blender/editors/include/BIF_cursors.h b/source/blender/editors/include/BIF_cursors.h
new file mode 100644
index 00000000000..cdbe5293dc7
--- /dev/null
+++ b/source/blender/editors/include/BIF_cursors.h
@@ -0,0 +1,103 @@
+/**
+ * $Id: BIF_cursors.h 7739 2006-06-15 14:22:59Z broken $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+
+
+#ifndef __BLI_CURSORS_DOT_H__
+#define __BLI_CURSORS_DOT_H__
+
+void InitCursorData(void);
+short GetBlenderCursor(void);
+void SetBlenderCursor(short cursornum);
+
+//typedef struct BCursor_s BCursor;
+typedef struct BCursor {
+
+ char *small_bm;
+ char *small_mask;
+
+ char small_sizex;
+ char small_sizey;
+ char small_hotx;
+ char small_hoty;
+
+ char *big_bm;
+ char *big_mask;
+
+ char big_sizex;
+ char big_sizey;
+ char big_hotx;
+ char big_hoty;
+
+ char fg_color;
+ char bg_color;
+
+} BCursor;
+
+#define LASTCURSOR -2
+#define SYSCURSOR -1
+enum {
+ BC_NW_ARROWCURSOR=0,
+ BC_NS_ARROWCURSOR,
+ BC_EW_ARROWCURSOR,
+ BC_WAITCURSOR,
+ BC_CROSSCURSOR,
+ BC_EDITCROSSCURSOR,
+ BC_BOXSELCURSOR,
+ BC_KNIFECURSOR,
+ BC_VLOOPCURSOR,
+ BC_TEXTEDITCURSOR,
+ BC_PAINTBRUSHCURSOR,
+ BC_HANDCURSOR,
+ BC_NSEW_SCROLLCURSOR,
+ BC_NS_SCROLLCURSOR,
+ BC_EW_SCROLLCURSOR,
+ BC_EYEDROPPER_CURSOR,
+/* --- ALWAYS LAST ----- */
+ BC_NUMCURSORS,
+};
+
+
+enum {
+ BC_BLACK=0,
+ BC_WHITE,
+ BC_RED,
+ BC_BLUE,
+ BC_GREEN,
+ BC_YELLOW
+};
+
+#define SMALL_CURSOR 0
+#define BIG_CURSOR 1
+
+#endif
+
diff --git a/source/blender/editors/include/BIF_drawimage.h b/source/blender/editors/include/BIF_drawimage.h
new file mode 100644
index 00000000000..3d48df0ea31
--- /dev/null
+++ b/source/blender/editors/include/BIF_drawimage.h
@@ -0,0 +1,74 @@
+/**
+ * $Id: BIF_drawimage.h 12198 2007-10-03 10:36:04Z campbellbarton $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_DRAWIMAGE_H
+#define BIF_DRAWIMAGE_H
+
+struct ScrArea;
+struct SpaceImage;
+struct Render;
+struct Image;
+struct ImBuf;
+struct uiBlock;
+struct MTFace;
+
+void do_imagebuts(unsigned short event);
+void calc_image_view(struct SpaceImage *sima, char mode);
+void drawimagespace(struct ScrArea *sa, void *spacedata);
+void image_changed(struct SpaceImage *sima, struct Image *image);
+int draw_uvs_face_check(void);
+void tface_center(struct MTFace *tf, float cent[2], void * isquad);
+void draw_uvs_sima(void);
+void image_set_tile(struct SpaceImage *sima, int dotile);
+void image_home(void);
+void image_viewmove(int mode);
+void image_viewzoom(unsigned short event, int invert);
+void image_viewcenter(void);
+void uvco_to_areaco(float *vec, short *mval);
+void uvco_to_areaco_noclip(float *vec, int *mval);
+void what_image(struct SpaceImage *sima);
+void image_preview_event(int event);
+
+void image_info(struct Image *ima, struct ImBuf *ibuf, char *str);
+void imagespace_composite_flipbook(struct ScrArea *sa);
+
+void imagewindow_render_callbacks(struct Render *re);
+void imagewindow_toggle_render(void);
+void imagewindow_swap_render_rects(void);
+void imagewin_store_spare(void);
+struct ImBuf *imagewindow_get_ibuf(struct SpaceImage *sima);
+
+void image_editvertex_buts(struct uiBlock *block);
+void image_editcursor_buts(struct uiBlock *block);
+
+#endif
+
diff --git a/source/blender/python/api2_2x/meshPrimitive.h b/source/blender/editors/include/BIF_drawoops.h
index e864ffd0d17..38c38c1ba04 100644
--- a/source/blender/python/api2_2x/meshPrimitive.h
+++ b/source/blender/editors/include/BIF_drawoops.h
@@ -1,5 +1,5 @@
-/*
- * $Id: meshPrimitive.h 7512 2006-05-25 16:45:24Z khughes $
+/**
+ * $Id: BIF_drawoops.h 6135 2005-12-16 13:50:45Z campbellbarton $
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
@@ -23,24 +23,19 @@
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
- * This is a new part of Blender.
+ * The Original Code is: all of this file.
*
- * Contributor(s): Ken Hughes
+ * Contributor(s): none yet.
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
-#ifndef EXPP_MESHPRIMITIVES_H
-#define EXPP_MESHPRIMITIVES_H
+#ifndef BIF_DRAWOOPS_H
+#define BIF_DRAWOOPS_H
-#include <Python.h>
+void give_oopslink_line(Oops *oops, OopsLink *ol, float *v1, float *v2);
+void mysbox(float x1, float y1, float x2, float y2);
+void boundbox_oops(short sel);
-#ifdef HAVE_CONFIG_H
-#include <config.h>
#endif
-/* PROTOS */
-
-PyObject *MeshPrimitives_Init( void );
-
-#endif /* EXPP_MESHPRIMITIVES_H */
diff --git a/source/blender/src/cre/license.jpeg.c b/source/blender/editors/include/BIF_drawscene.h
index 880d3dbde2e..88e0ae906d4 100644
--- a/source/blender/src/cre/license.jpeg.c
+++ b/source/blender/editors/include/BIF_drawscene.h
@@ -1,5 +1,5 @@
/**
- * $Id$
+ * $Id: BIF_drawscene.h 229 2002-12-27 13:11:01Z mein $
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
@@ -30,9 +30,6 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+struct Scene;
+void set_scene(struct Scene *sce);
-int datatoc_tonize= 0;
-char datatoc_ton[]= {0};
diff --git a/source/blender/python/api2_2x/Sys.h b/source/blender/editors/include/BIF_drawscript.h
index 3e5f78f4922..b50f12e836b 100644
--- a/source/blender/python/api2_2x/Sys.h
+++ b/source/blender/editors/include/BIF_drawscript.h
@@ -1,5 +1,5 @@
-/*
- * $Id: Sys.h 4803 2005-07-18 03:50:37Z ascotan $
+/**
+ *
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
@@ -25,16 +25,17 @@
*
* This is a new part of Blender.
*
- * Contributor(s): Willian P. Germano
+ * Contributor(s): Willian P. Germano.
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
+ */
-#ifndef EXPP_sys_H
-#define EXPP_sys_H
+#ifndef BIF_DRAWSCRIPT_H
+#define BIF_DRAWSCRIPT_H
-#include <Python.h>
+struct ScrArea;
+struct SpaceScript;
-PyObject *sys_Init( void );
+void free_scriptspace(struct SpaceScript *sc);
-#endif /* EXPP_sys_H */
+#endif /* BIF_DRAWSCRIPT_H */
diff --git a/source/blender/editors/include/BIF_drawseq.h b/source/blender/editors/include/BIF_drawseq.h
new file mode 100644
index 00000000000..495c99c47d7
--- /dev/null
+++ b/source/blender/editors/include/BIF_drawseq.h
@@ -0,0 +1,46 @@
+/**
+ * $Id: BIF_drawseq.h 12177 2007-10-01 08:03:11Z schlaile $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_DRAWSEQ_H
+#define BIF_DRAWSEQ_H
+
+struct ScrArea;
+struct Sequence;
+
+void drawprefetchseqspace(struct ScrArea *sa, void *spacedata);
+void drawseqspace(struct ScrArea *sa, void *spacedata);
+void set_special_seq_update(int val);
+
+void seq_viewmove(SpaceSeq *sseq);
+void seq_reset_imageofs(SpaceSeq *sseq);
+#endif
+
diff --git a/source/blender/python/api2_2x/sceneRadio.h b/source/blender/editors/include/BIF_drawtext.h
index 98604d9afb2..e08e67b8052 100644
--- a/source/blender/python/api2_2x/sceneRadio.h
+++ b/source/blender/editors/include/BIF_drawtext.h
@@ -1,5 +1,5 @@
-/*
- * $Id: sceneRadio.h 10269 2007-03-15 01:09:14Z campbellbarton $
+/**
+ * $Id: BIF_drawtext.h 4428 2005-05-13 16:11:28Z ton $
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
@@ -23,29 +23,32 @@
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
- * This is a new part of Blender.
+ * The Original Code is: all of this file.
*
- * Contributor(s): Willian P. Germano
+ * Contributor(s): none yet.
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
+ */
-#ifndef EXPP_SCENERADIO_H
-#define EXPP_SCENERADIO_H
+#ifndef BIF_DRAWTEXT_H
+#define BIF_DRAWTEXT_H
-#include <Python.h>
-#include "DNA_radio_types.h"
-#include "DNA_scene_types.h"
+struct ScrArea;
+struct SpaceText;
+struct Text;
-/* BPy_Radio declaration */
-typedef struct {
- PyObject_HEAD
- struct Radio *radio;
- struct Scene *scene;
-} BPy_Radio;
+void unlink_text(struct Text *text);
-PyObject *Radio_Init( void );
+void free_textspace(struct SpaceText *st);
-PyObject *Radio_CreatePyObject( struct Scene *scene );
+void txt_write_file(struct Text *text);
+void add_text_fs(char *file);
+
+void free_txt_data(void);
+void pop_space_text(struct SpaceText *st);
+
+void get_format_string(void);
+void do_brackets(void);
+
+#endif
-#endif /* EXPP_SCENERADIO_H */
diff --git a/source/blender/editors/include/BIF_editaction.h b/source/blender/editors/include/BIF_editaction.h
new file mode 100644
index 00000000000..9fa098bc846
--- /dev/null
+++ b/source/blender/editors/include/BIF_editaction.h
@@ -0,0 +1,162 @@
+/**
+ * $Id: BIF_editaction.h 12065 2007-09-17 11:41:12Z aligorith $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): 2007, Joshua Leung, Action Editor Recode
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_EDITACTION_H
+#define BIF_EDITACTION_H
+
+/* some interface related sizes*/
+#define CHANNELHEIGHT 16
+#define CHANNELSKIP 2
+#define NAMEWIDTH 164
+#define SLIDERWIDTH 125
+#define ACTWIDTH (G.saction->actwidth)
+
+/* Some types for easier type-testing */
+enum {
+ ACTTYPE_NONE= 0,
+ ACTTYPE_ACHAN,
+ ACTTYPE_CONCHAN,
+ ACTTYPE_ICU,
+ ACTTYPE_FILLIPO,
+ ACTTYPE_FILLCON,
+ ACTTYPE_IPO,
+ ACTTYPE_SHAPEKEY
+};
+
+/* Macros for easier/more consistant state testing */
+#define VISIBLE_ACHAN(achan) ((achan->flag & ACHAN_HIDDEN)==0)
+#define EDITABLE_ACHAN(achan) ((VISIBLE_ACHAN(achan)) && ((achan->flag & ACHAN_PROTECTED)==0))
+#define EXPANDED_ACHAN(achan) ((VISIBLE_ACHAN(achan)) && (achan->flag & ACHAN_EXPANDED))
+#define SEL_ACHAN(achan) ((achan->flag & ACHAN_SELECTED) || (achan->flag & ACHAN_HILIGHTED))
+#define FILTER_IPO_ACHAN(achan) ((achan->flag & ACHAN_SHOWIPO))
+#define FILTER_CON_ACHAN(achan) ((achan->flag & ACHAN_SHOWCONS))
+
+#define EDITABLE_CONCHAN(conchan) ((conchan->flag & CONSTRAINT_CHANNEL_PROTECTED)==0)
+#define SEL_CONCHAN(conchan) (conchan->flag & CONSTRAINT_CHANNEL_SELECT)
+
+#define EDITABLE_ICU(icu) ((icu->flag & IPO_PROTECT)==0)
+#define SEL_ICU(icu) (icu->flag & IPO_SELECT)
+
+#define NLA_ACTION_SCALED (G.saction->pin==0 && OBACT && OBACT->action)
+#define NLA_IPO_SCALED (OBACT && OBACT->action && G.sipo->pin==0 && G.sipo->actname)
+
+/* constants for setting ipo-interpolation type */
+enum {
+ SET_IPO_MENU = -1,
+ SET_IPO_POPUP = 0,
+
+ SET_IPO_CONSTANT,
+ SET_IPO_LINEAR,
+ SET_IPO_BEZIER,
+};
+
+/* constants for setting ipo-extrapolation type */
+enum {
+
+ SET_EXTEND_MENU = 9,
+ SET_EXTEND_POPUP = 10,
+
+ SET_EXTEND_CONSTANT,
+ SET_EXTEND_EXTRAPOLATION,
+ SET_EXTEND_CYCLIC,
+ SET_EXTEND_CYCLICEXTRAPOLATION
+};
+
+
+struct bAction;
+struct bActionChannel;
+struct bPoseChannel;
+struct Object;
+struct Ipo;
+struct BWinEvent;
+struct Key;
+struct ListBase;
+
+/* Key operations */
+void transform_action_keys(int mode, int dummy);
+void duplicate_action_keys(void);
+void snap_action_keys(short mode);
+void mirror_action_keys(short mode);
+void insertkey_action(void);
+void delete_action_keys(void);
+void delete_action_channels(void);
+void clean_action(void);
+
+/* Column/Channel Key select */
+void column_select_action_keys(int mode);
+void selectall_action_keys(short mval[], short mode, short selectmode);
+void markers_selectkeys_between(void);
+
+/* Action Data Copying */
+void free_actcopybuf(void);
+void copy_actdata(void);
+void paste_actdata(void);
+
+/* channel/strip operations */
+void up_sel_action(void);
+void down_sel_action(void);
+void top_sel_action(void);
+void bottom_sel_action(void);
+
+/* IPO/Handle Types */
+void sethandles_action_keys(int code);
+void action_set_ipo_flags(short mode, short event);
+
+/* Select */
+void borderselect_action(void);
+void deselect_action_keys(short test, short sel);
+void deselect_action_channels(short test);
+void deselect_actionchannels(struct bAction *act, short test);
+int select_channel(struct bAction *act, struct bActionChannel *achan, int selectmode);
+void select_actionchannel_by_name(struct bAction *act, char *name, int select);
+
+/* ShapeKey stuff */
+struct Key *get_action_mesh_key(void);
+int get_nearest_key_num(struct Key *key, short *mval, float *x);
+
+void *get_nearest_act_channel(short mval[], short *ret_type);
+
+/* Action */
+struct bActionChannel *get_hilighted_action_channel(struct bAction* action);
+struct bAction *add_empty_action(char *name);
+struct bAction *ob_get_action(struct Object *ob);
+
+void actdata_filter(ListBase *act_data, int filter_mode, void *data, short datatype);
+void *get_action_context(short *datatype);
+
+void remake_action_ipos(struct bAction *act);
+
+/* event handling */
+void winqreadactionspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
+
+#endif
+
diff --git a/source/blender/editors/include/BIF_editarmature.h b/source/blender/editors/include/BIF_editarmature.h
new file mode 100644
index 00000000000..1b2ad78c881
--- /dev/null
+++ b/source/blender/editors/include/BIF_editarmature.h
@@ -0,0 +1,142 @@
+/**
+ * $Id: BIF_editarmature.h 11981 2007-09-09 11:05:21Z aligorith $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+#ifndef BIF_EDITARMATURE_H
+#define BIF_EDITARMATURE_H
+
+struct Object;
+struct Base;
+struct Bone;
+struct bArmature;
+struct ListBase;
+
+typedef struct EditBone
+{
+ struct EditBone *next, *prev;
+ struct EditBone *parent;/* Editbones have a one-way link (i.e. children refer
+ to parents. This is converted to a two-way link for
+ normal bones when leaving editmode. */
+ void *temp; /* Used to store temporary data */
+
+ char name[32];
+ float roll; /* Roll along axis. We'll ultimately use the axis/angle method
+ for determining the transformation matrix of the bone. The axis
+ is tail-head while roll provides the angle. Refer to Graphics
+ Gems 1 p. 466 (section IX.6) if it's not already in here somewhere*/
+
+ float head[3]; /* Orientation and length is implicit during editing */
+ float tail[3];
+ /* All joints are considered to have zero rotation with respect to
+ their parents. Therefore any rotations specified during the
+ animation are automatically relative to the bones' rest positions*/
+ int flag;
+
+ int parNr; /* Used for retrieving values from the menu system */
+
+ float dist, weight;
+ float xwidth, length, zwidth; /* put them in order! transform uses this as scale */
+ float ease1, ease2;
+ float rad_head, rad_tail;
+ short layer, segments;
+
+ float oldlength; /* for envelope scaling */
+
+} EditBone;
+
+
+void adduplicate_armature(void);
+void addvert_armature(void);
+void add_primitiveArmature(int type);
+void apply_rot_armature (struct Object *ob, float mat[3][3]);
+void docenter_armature (struct Object *ob, int centermode);
+
+void clear_armature(struct Object *ob, char mode);
+
+void delete_armature(void);
+void deselectall_armature(int toggle, int doundo);
+void deselectall_posearmature (struct Object *ob, int test, int doundo);
+int draw_armature(struct Base *base, int dt);
+void extrude_armature(int forked);
+void subdivide_armature(int numcuts);
+
+void free_editArmature(void);
+
+int join_armature(void);
+void load_editArmature(void);
+
+void make_bone_parent(void);
+void clear_bone_parent(void);
+struct Bone *get_indexed_bone (struct Object *ob, int index);
+
+void make_editArmature(void);
+void make_trans_bones (char mode);
+
+int do_pose_selectbuffer(struct Base *base, unsigned int *buffer, short hits);
+
+void mouse_armature(void);
+void remake_editArmature(void);
+void selectconnected_armature(void);
+void selectconnected_posearmature(void);
+void select_bone_parent(void);
+void unique_editbone_name (struct ListBase *ebones, char *name);
+
+void auto_align_armature(short mode);
+
+void create_vgroups_from_armature(struct Object *ob, struct Object *par);
+void add_verts_to_dgroups(struct Object *ob, struct Object *par, int heat, int mirror);
+
+void hide_selected_pose_bones(void);
+void hide_unselected_pose_bones(void);
+void show_all_pose_bones(void);
+
+int bone_looper(struct Object *ob, struct Bone *bone, void *data,
+ int (*bone_func)(struct Object *, struct Bone *, void *));
+
+void undo_push_armature(char *name);
+void armature_bone_rename(struct bArmature *arm, char *oldname, char *newname);
+void armature_flip_names(void);
+EditBone *armature_bone_get_mirrored(struct EditBone *ebo);
+void transform_armature_mirror_update(void);
+
+void hide_selected_armature_bones(void);
+void hide_unselected_armature_bones(void);
+void show_all_armature_bones(void);
+
+#define BONESEL_ROOT 0x10000000
+#define BONESEL_TIP 0x20000000
+#define BONESEL_BONE 0x40000000
+#define BONESEL_ANY (BONESEL_TIP|BONESEL_ROOT|BONESEL_BONE)
+
+#define BONESEL_NOSEL 0x80000000 /* Indicates a negative number */
+
+#endif
+
+
diff --git a/source/blender/editors/include/BIF_editconstraint.h b/source/blender/editors/include/BIF_editconstraint.h
new file mode 100644
index 00000000000..edc1a610694
--- /dev/null
+++ b/source/blender/editors/include/BIF_editconstraint.h
@@ -0,0 +1,72 @@
+/**
+ * $Id: BIF_editconstraint.h 12339 2007-10-22 10:49:34Z aligorith $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_EDITCONSTRAINT_H
+#define BIF_EDITCONSTRAINT_H
+
+struct ID;
+struct ListBase;
+struct Object;
+struct bConstraint;
+struct bConstraintChannel;
+struct Text;
+
+/* generic constraint editing functions */
+
+struct bConstraint *add_new_constraint(short type);
+
+void add_constraint_to_object(struct bConstraint *con, struct Object *ob);
+
+struct ListBase *get_active_constraints(struct Object *ob);
+struct bConstraint *get_active_constraint(struct Object *ob);
+struct ListBase *get_active_constraint_channels (struct Object *ob, int forcevalid);
+struct bConstraintChannel *get_active_constraint_channel(struct Object *ob);
+
+void object_test_constraints(struct Object *owner);
+
+void add_constraint(int only_IK);
+void ob_clear_constraints(void);
+
+void rename_constraint(struct Object *ob, struct bConstraint *con, char *newname);
+
+
+/* a few special functions for PyConstraints */
+char *buildmenu_pyconstraints(struct Text *con_text, int *pyconindex);
+void validate_pyconstraint_cb(void *arg1, void *arg2);
+void update_pyconstraint_cb(void *arg1, void *arg2);
+
+/* two special functions for ChildOf Constriant */
+void childof_const_setinv (void *conv, void *unused);
+void childof_const_clearinv(void *conv, void *unused);
+
+#endif
+
diff --git a/source/blender/editors/include/BIF_editdeform.h b/source/blender/editors/include/BIF_editdeform.h
new file mode 100644
index 00000000000..771ee87ab77
--- /dev/null
+++ b/source/blender/editors/include/BIF_editdeform.h
@@ -0,0 +1,76 @@
+/**
+ * $Id: BIF_editdeform.h 12697 2007-11-27 21:16:47Z blendix $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_DEFORM_H
+#define BIF_DEFORM_H
+
+#define WEIGHT_REPLACE 1
+#define WEIGHT_ADD 2
+#define WEIGHT_SUBTRACT 3
+
+struct Object;
+struct Mesh;
+struct MDeformVert;
+struct MDeformWeight;
+struct bDeformGroup;
+
+struct bDeformGroup *add_defgroup_name (struct Object *ob, char *name);
+void add_defgroup (struct Object *ob);
+void del_defgroup_in_object_mode ( Object *ob );
+void del_defgroup (struct Object *ob);
+void duplicate_defgroup ( struct Object *ob );
+void assign_verts_defgroup (void);
+void remove_verts_defgroup (int allverts);
+void sel_verts_defgroup (int select);
+
+struct MDeformWeight *get_defweight (struct MDeformVert *dv, int defgroup);
+struct MDeformWeight *verify_defweight (struct MDeformVert *dv, int defgroup);
+
+
+void add_vert_to_defgroup (struct Object *ob, struct bDeformGroup *dg,
+ int vertnum, float weight,
+ int assignmode);
+void remove_vert_defgroup (struct Object *ob, struct bDeformGroup *dg,
+ int vertnum);
+float get_vert_defgroup (struct Object *ob, struct bDeformGroup *dg,
+ int vertnum);
+void create_dverts(ID *id);
+
+void vertexgroup_select_by_name(struct Object *ob, char *name);
+
+extern void object_apply_deform(struct Object *ob);
+
+void vgroup_assign_with_menu(void);
+void vgroup_operation_with_menu(void);
+
+#endif
+
diff --git a/source/blender/src/imasel.c b/source/blender/editors/include/BIF_editfont.h
index 78fc3f1be2a..64187e46862 100644
--- a/source/blender/src/imasel.c
+++ b/source/blender/editors/include/BIF_editfont.h
@@ -1,5 +1,5 @@
/**
- * $Id$
+ * $Id: BIF_editfont.h 5286 2005-09-15 17:32:24Z ton $
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
@@ -30,56 +30,44 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include <wchar.h>
-#ifndef WIN32
-#include <unistd.h>
-#else
-#include "BLI_winstuff.h"
-#include <io.h>
-#include <direct.h>
-#endif
-#include <fcntl.h>
-#include "MEM_guardedalloc.h"
+#ifndef BIF_EDITFONT_H
+#define BIF_EDITFONT_H
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+struct Text;
-#include "IMB_imbuf_types.h"
-#include "IMB_imbuf.h"
+extern char *BIF_lorem;
+extern wchar_t *copybuf;
+extern wchar_t *copybufinfo;
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-
-#include "BKE_utildefines.h"
-#include "BKE_global.h"
-
-#include "BIF_imasel.h"
-#include "BIF_filelist.h"
-#include "BIF_space.h"
-#include "BIF_screen.h"
+typedef struct unicodect
+{
+ char *name;
+ char *longname;
+ int start;
+ int end;
+} unicodect;
-#include "blendef.h"
-#include "mydevice.h"
+void do_textedit(unsigned short event, short val, unsigned long _ascii);
+void make_editText(void);
+void load_editText(void);
+void remake_editText(void);
+void free_editText(void);
+void paste_editText(void);
+void txt_export_to_object(struct Text *text);
+void txt_export_to_objects(struct Text *text);
+void undo_push_font(char *);
+void load_3dtext_fs(char *);
+void add_lorem(void);
+void paste_unicodeText(char *filename);
+/**
+ * @attention The argument is discarded. It is there for
+ * compatibility.
+ */
+void add_primitiveFont(int);
+void to_upper(void);
-void free_imasel(SpaceImaSel *simasel)
-{
- /* do not free imasel itself */
- if(simasel->files) {
- BIF_filelist_freelib(simasel->files);
- BIF_filelist_free(simasel->files);
- MEM_freeN(simasel->files);
- simasel->files = NULL;
- }
- if (simasel->img) {
- IMB_freeImBuf(simasel->img);
- }
- if(simasel->pupmenu) {
- MEM_freeN(simasel->pupmenu);
- simasel->pupmenu = NULL;
- }
-}
+#endif
diff --git a/source/blender/editors/include/BIF_editgroup.h b/source/blender/editors/include/BIF_editgroup.h
new file mode 100644
index 00000000000..dded79541bc
--- /dev/null
+++ b/source/blender/editors/include/BIF_editgroup.h
@@ -0,0 +1,40 @@
+/**
+ * $Id: BIF_editgroup.h 7877 2006-06-24 18:37:21Z desoto $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+struct Group;
+struct Base;
+
+void add_selected_to_group(struct Group *group);
+void rem_selected_from_group(void);
+void group_operation_with_menu(void);
+void group_operation(int mode);
+
diff --git a/source/blender/editors/include/BIF_editkey.h b/source/blender/editors/include/BIF_editkey.h
new file mode 100644
index 00000000000..760809f7b1e
--- /dev/null
+++ b/source/blender/editors/include/BIF_editkey.h
@@ -0,0 +1,70 @@
+/**
+ * $Id: BIF_editkey.h 10579 2007-04-25 11:57:02Z aligorith $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_EDITKEY_H
+#define BIF_EDITKEY_H
+
+struct Key;
+struct KeyBlock;
+struct Mesh;
+struct Object;
+struct Lattice;
+struct Curve;
+struct uiBlock;
+struct BezTriple;
+struct IpoCurve;
+
+void mesh_to_key(struct Mesh *me, struct KeyBlock *kb);
+void key_to_mesh(struct KeyBlock *kb, struct Mesh *me);
+void insert_meshkey(struct Mesh *me, short rel);
+
+void latt_to_key(struct Lattice *lt, struct KeyBlock *kb);
+void key_to_latt(struct KeyBlock *kb, struct Lattice *lt);
+void insert_lattkey(struct Lattice *lt, short rel);
+
+void curve_to_key(struct Curve *cu, struct KeyBlock *kb, ListBase *nurb);
+void key_to_curve(struct KeyBlock *kb, struct Curve *cu, ListBase *nurb);
+void insert_curvekey(struct Curve *cu, short rel);
+
+void insert_shapekey(struct Object *ob);
+
+void delete_key(struct Object *ob);
+void move_keys(struct Object *ob);
+
+void make_rvk_slider(struct uiBlock *block, struct Object *ob, int keynum,
+ int x, int y, int w, int h, char *tip);
+
+// FIXME: move me somewhere else
+struct BezTriple *get_bezt_icu_time(struct IpoCurve *icu, float *frame, float *val);
+
+#endif
+
diff --git a/source/blender/editors/include/BIF_editlattice.h b/source/blender/editors/include/BIF_editlattice.h
new file mode 100644
index 00000000000..7b74893c693
--- /dev/null
+++ b/source/blender/editors/include/BIF_editlattice.h
@@ -0,0 +1,45 @@
+/**
+ * $Id: BIF_editlattice.h 3405 2004-11-07 21:14:21Z ton $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_EDITLATTICE_H
+#define BIF_EDITLATTICE_H
+
+void free_editLatt(void);
+void make_editLatt(void);
+void load_editLatt(void);
+void remake_editLatt(void);
+void deselectall_Latt(void);
+void mouse_lattice(void);
+void undo_push_lattice(char *name);
+
+#endif
+
diff --git a/source/blender/editors/include/BIF_editmesh.h b/source/blender/editors/include/BIF_editmesh.h
new file mode 100644
index 00000000000..1a31ae1ee45
--- /dev/null
+++ b/source/blender/editors/include/BIF_editmesh.h
@@ -0,0 +1,265 @@
+/**
+ * $Id: BIF_editmesh.h 12290 2007-10-18 21:47:55Z campbellbarton $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+/* External for editmesh_xxxx.c functions */
+
+#ifndef BIF_EDITMESH_H
+#define BIF_EDITMESH_H
+
+#include "BKE_mesh.h"
+
+struct EditMesh;
+struct EditFace;
+struct EditEdge;
+struct EditVert;
+struct Mesh;
+struct bDeformGroup;
+struct View3D;
+struct EditSelection;
+struct CustomData;
+
+// edge and face flag both
+#define EM_FGON 2
+// face flag
+#define EM_FGON_DRAW 1
+
+extern unsigned int em_vertoffs, em_solidoffs, em_wireoffs;
+
+/* ******************* editmesh.c */
+extern void make_editMesh(void);
+extern void load_editMesh(void);
+extern void free_editMesh(struct EditMesh *);
+extern void remake_editMesh(void);
+
+ /* Editmesh Undo code */
+extern void undo_push_mesh(char *name);
+
+extern void separatemenu(void);
+extern void separate_mesh(void);
+extern void separate_mesh_loose(void);
+extern void separate_material(void);
+
+/* ******************* editmesh_add.c */
+extern void make_prim(int type, float imat[3][3], int tot, int seg,
+ int subdiv, float dia, float d, int ext, int fill,
+ float cent[3] );
+extern void add_primitiveMesh(int type);
+extern void adduplicate_mesh(void);
+extern void add_click_mesh(void);
+extern void addedgeface_mesh(void);
+void addfaces_from_edgenet();
+
+/* ******************* editmesh_lib.c */
+
+extern void EM_set_flag_all(int flag);
+extern void EM_clear_flag_all(int flag);
+
+extern void EM_select_face(struct EditFace *efa, int sel);
+extern void EM_select_edge(struct EditEdge *eed, int sel);
+extern float EM_face_area(struct EditFace *efa);
+extern float EM_face_perimeter(struct EditFace *efa);
+extern void EM_editselection_center(float *center, struct EditSelection *ese);
+extern void EM_editselection_normal(float *normal, struct EditSelection *ese);
+extern void EM_editselection_plane(float *plane, struct EditSelection *ese);
+
+extern void EM_deselect_flush(void); // vertices to edges/faces (exception!)
+extern void EM_select_flush(void); // vertices to edges/faces (exception!)
+extern void EM_selectmode_set(void); // when mode changes
+extern void EM_selectmode_flush(void); // when selection changes
+extern void EM_convertsel(short oldmode, short selectmode);
+extern void EM_remove_selection(void *data, int type);
+extern void EM_store_selection(void *data, int type);
+extern void EM_validate_selections(void);
+
+extern int EM_nfaces_selected(void);
+extern int EM_nvertices_selected(void);
+
+extern int faceselectedAND(struct EditFace *efa, int flag);
+extern void recalc_editnormals(void);
+extern void flip_editnormals(void);
+
+extern void EM_data_interp_from_verts(struct EditVert *v1,
+ struct EditVert *v2, struct EditVert *eve, float fac);
+extern struct EditFace *EM_face_from_faces(struct EditFace *efa1,
+ struct EditFace *efa2, int i1, int i2, int i3, int i4);
+extern void EM_data_interp_from_faces(struct EditFace *efa1,
+ struct EditFace *efa2, struct EditFace *efan, int i1, int i2, int i3, int i4);
+
+void EM_add_data_layer(struct CustomData *data, int type);
+void EM_free_data_layer(struct CustomData *data, int type);
+
+/* ******************* editmesh_mods.c */
+
+extern void EM_init_index_arrays(int forVert, int forEdge, int forFace);
+extern void EM_free_index_arrays(void);
+
+extern struct EditVert *EM_get_vert_for_index(int index);
+extern struct EditEdge *EM_get_edge_for_index(int index);
+extern struct EditFace *EM_get_face_for_index(int index);
+
+extern void EM_select_face_fgon(struct EditFace *efa, int sel);
+
+extern int EM_init_backbuf_border(short xmin, short ymin, short xmax, short ymax);
+extern int EM_mask_init_backbuf_border(short mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax);
+extern int EM_init_backbuf_circle(short xs, short ys, short rads);
+extern int EM_check_backbuf(unsigned int index);
+extern void EM_free_backbuf(void);
+
+extern void EM_selectmode_menu(void);
+
+
+extern void vertexnoise(void);
+extern void vertexsmooth(void);
+extern void righthandfaces(int select);
+extern void mouse_mesh(void);
+
+extern void deselectall_mesh(void);
+extern void selectconnected_mesh_all(void);
+extern void selectconnected_mesh(void);
+extern void selectconnected_delimit_mesh(void);
+extern void selectconnected_delimit_mesh_all(void);
+extern void selectswap_mesh(void);
+
+extern void hide_mesh(int swap);
+extern void reveal_mesh(void);
+
+extern void vertices_to_sphere(void);
+
+ /** Aligns the selected MTFace's of @a me to the @a v3d,
+ * using the given axis (0-2). Can give a user error.
+ */
+extern void faceselect_align_view_to_selected(struct View3D *v3d, struct Mesh *me, int axis);
+ /** Aligns the selected faces or vertices of @a me to the @a v3d,
+ * using the given axis (0-2). Can give a user error.
+ */
+extern void editmesh_align_view_to_selected(struct View3D *v3d, int axis);
+
+ /* Selection */
+extern void select_non_manifold(void);
+extern void select_sharp_edges(void);
+extern void select_linked_flat_faces(void);
+extern void select_faces_by_numverts(int numverts);
+extern void select_more(void);
+extern void select_less(void);
+extern void selectrandom_mesh(void);
+extern void editmesh_select_by_material(int index);
+extern void editmesh_deselect_by_material(int index);
+
+extern void Vertex_Menu(void);
+extern void Edge_Menu(void);
+extern void Face_Menu(void);
+extern void select_mesh_group_menu(void);
+extern void editmesh_mark_seam(int clear);
+extern void loop_multiselect(int looptype);
+
+
+/* ******************* editmesh_loop.c */
+
+#define KNIFE_PROMPT 0
+#define KNIFE_EXACT 1
+#define KNIFE_MIDPOINT 2
+#define KNIFE_MULTICUT 3
+
+extern void CutEdgeloop(int numcuts);
+extern void KnifeSubdivide(char mode);
+extern void LoopMenu(void);
+
+#define LOOP_SELECT 1
+#define LOOP_CUT 2
+
+extern short sharesFace(struct EditEdge* e1, struct EditEdge* e2);
+
+/* ******************* editmesh_tools.c */
+
+#define SUBDIV_SELECT_ORIG 0
+#define SUBDIV_SELECT_INNER 1
+#define SUBDIV_SELECT_INNER_SEL 2
+#define SUBDIV_SELECT_LOOPCUT 3
+
+extern void convert_to_triface(int direction);
+extern int removedoublesflag(short flag, short automerge, float limit);
+extern void xsortvert_flag(int flag);
+extern void hashvert_flag(int flag);
+
+extern void esubdivideflag(int flag, float rad, int beauty, int numcuts, int selecttype);
+
+extern void extrude_mesh(void);
+extern void split_mesh(void);
+extern void extrude_repeat_mesh(int steps, float offs);
+extern void spin_mesh(int steps,float degr,float *dvec, int mode);
+extern void screw_mesh(int steps,int turns);
+extern void delete_mesh(void);
+extern void beauty_fill(void);
+extern void join_triangles(void);
+extern void edge_flip(void);
+extern void fill_mesh(void);
+extern void bevel_menu();
+void mesh_set_face_flags(short mode);
+extern void mesh_set_smooth_faces(short event);
+extern void mesh_rotate_uvs(void);
+extern void mesh_mirror_uvs(void);
+extern void mesh_rotate_colors(void);
+extern void mesh_mirror_colors(void);
+void mesh_copy_menu(void);
+void edge_rotate_selected(int dir);
+int EdgeSlide(short immediate, float imperc);
+int EdgeLoopDelete(void);
+void mesh_rip(void);
+
+struct EditVert *editedge_getOtherVert(struct EditEdge *eed, struct EditVert *ev);
+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);
+
+void shape_copy_select_from(void);
+void shape_propagate(void);
+
+int collapseEdges(void);
+int merge_firstlast(int first, int uvmerge);
+int merge_target( int target, int uvmerge);
+
+void pathselect(void);
+void loop_to_region(void);
+void region_to_loop(void);
+
+UvVertMap *make_uv_vert_map_EM(int selected, int do_face_idx_array, float *limit);
+UvMapVert *get_uv_map_vert_EM(UvVertMap *vmap, unsigned int v);
+void free_uv_vert_map_EM(UvVertMap *vmap);
+
+int EM_texFaceCheck(void); /* can we edit UV's for this mesh?*/
+int EM_vertColorCheck(void); /* can we edit colors for this mesh?*/
+
+void EM_set_actFace(struct EditFace *efa);
+struct EditFace * EM_get_actFace(void);
+
+#endif
diff --git a/source/blender/python/api2_2x/EXPP_interface.h b/source/blender/editors/include/BIF_editmode_undo.h
index 8ed0836820d..b03b4160166 100644
--- a/source/blender/python/api2_2x/EXPP_interface.h
+++ b/source/blender/editors/include/BIF_editmode_undo.h
@@ -1,5 +1,5 @@
-/*
- * $Id: EXPP_interface.h 7338 2006-04-30 16:22:31Z ianwill $
+/**
+ * $Id:
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
@@ -23,34 +23,37 @@
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
- * This is a new part of Blender.
+ * The Original Code is: all of this file.
*
- * Contributor(s): Michel Selten, Willian P. Germano
+ * Contributor(s): none yet.
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
+ */
-#ifndef EXPP_INTERFACE_H
-#define EXPP_INTERFACE_H
-struct Object;
-struct Script;
-struct LinkNode;
+#ifndef BIF_EDITMODE_UNDO_H
+#define BIF_EDITMODE_UNDO_H
+
+// Add this in your local code:
+
+extern void undo_editmode_push(char *name,
+ void (*freedata)(void *), // pointer to function freeing data
+ void (*to_editmode)(void *), // data to editmode conversion
+ void *(*from_editmode)(void)); // editmode to data conversion
-extern struct LinkNode *bpy_pydriver_oblist;
-void initBlenderApi2_2x( void );
-char *bpy_gethome( int append_scriptsdir );
-void discardFromBDict( char *key );
-void EXPP_Library_Close( void ); /* in Library.c, used by BPY_end_python */
+// Further exported for UI is:
-/* PyDrivers */
+struct uiBlock;
-void bpy_pydriver_freeList(void);
-void bpy_pydriver_appendToList(struct Object *ob);
-struct Object **bpy_pydriver_obArrayFromList(void);
+extern void undo_editmode_step(int step); // undo and redo
+extern void undo_editmode_clear(void); // free & clear all data
+extern void undo_editmode_menu(void); // history menu
+extern struct uiBlock *editmode_undohistorymenu(void *arg_unused);
+
+/* Hack to avoid multires undo data taking up insane amounts of memory */
+struct Object;
+void *undo_editmode_get_prev(struct Object *ob);
-int bpy_during_pydriver(void);
-void bpy_pydriver_running(int state);
+#endif
-#endif /* EXPP_INTERFACE_H */
diff --git a/source/blender/editors/include/BIF_editnla.h b/source/blender/editors/include/BIF_editnla.h
new file mode 100644
index 00000000000..3f065d8f6a6
--- /dev/null
+++ b/source/blender/editors/include/BIF_editnla.h
@@ -0,0 +1,65 @@
+/**
+ * $Id: BIF_editnla.h 9722 2007-01-12 02:34:47Z aligorith $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_EDITNLA_H
+#define BIF_EDITNLA_H
+
+struct BWinEvent;
+
+extern void winqreadnlaspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
+
+/* NLA channel operations */
+void delete_nlachannel_keys(void);
+void duplicate_nlachannel_keys(void);
+void transform_nlachannel_keys(int mode, int dummy);
+
+/* Select */
+void borderselect_nla(void);
+void deselect_nlachannel_keys (int test);
+void deselect_nlachannels(int test);
+
+/* NLA Strip operations */
+void shift_nlastrips_up(void);
+void shift_nlastrips_down(void);
+void reset_action_strips(int val);
+void synchronize_action_strips(void);
+void snap_action_strips(int snap_mode);
+void add_nlablock(void);
+void add_empty_nlablock(void);
+void convert_nla(void);
+void copy_action_modifiers(void);
+
+/* Baking */
+void bake_all_to_action(void);
+
+#endif
+
diff --git a/source/blender/editors/include/BIF_editoops.h b/source/blender/editors/include/BIF_editoops.h
new file mode 100644
index 00000000000..9f1f8c20ff2
--- /dev/null
+++ b/source/blender/editors/include/BIF_editoops.h
@@ -0,0 +1,47 @@
+/**
+ * $Id: BIF_editoops.h 4345 2005-04-30 21:19:19Z ton $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_EDITOOPS_H
+#define BIF_EDITOOPS_H
+
+void borderselect_oops(void);
+void deselect_all_area_oops(void);
+void mouse_select_oops(void);
+void select_backlinked_oops(void);
+void select_linked_oops(void);
+void set_select_flag_oops(void);
+void swap_select_all_oops(void);
+void transform_oops(int mode, int context);
+
+void clever_numbuts_oops(void);
+#endif
+
diff --git a/source/blender/editors/include/BIF_editparticle.h b/source/blender/editors/include/BIF_editparticle.h
new file mode 100644
index 00000000000..d4c6a92b8c8
--- /dev/null
+++ b/source/blender/editors/include/BIF_editparticle.h
@@ -0,0 +1,92 @@
+/* BIF_editparticle.h
+ *
+ *
+ * $Id: BIF_editparticle.h $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2007 by Janne Karhu.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_EDITPARTICLE_H
+#define BIF_EDITPARTICLE_H
+
+struct Object;
+struct ParticleSystem;
+struct ParticleEditSettings;
+
+/* particle edit mode */
+void PE_set_particle_edit(void);
+void PE_create_particle_edit(struct Object *ob, struct ParticleSystem *psys);
+void PE_free_particle_edit(struct ParticleSystem *psys);
+
+void PE_change_act(void *ob_v, void *act_v);
+
+/* access */
+struct ParticleSystem *PE_get_current(struct Object *ob);
+short PE_get_current_num(struct Object *ob);
+int PE_minmax(float *min, float *max);
+void PE_get_colors(char sel[4], char nosel[4]);
+struct ParticleEditSettings *PE_settings(void);
+
+/* update calls */
+void PE_hide_keys_time(struct ParticleSystem *psys, float cfra);
+void PE_update_object(struct Object *ob, int useflag);
+void PE_update_selection(struct Object *ob, int useflag);
+void PE_recalc_world_cos(struct Object *ob, struct ParticleSystem *psys);
+
+/* selection tools */
+void PE_select_root(void);
+void PE_select_tip(void);
+void PE_deselectall(void);
+void PE_select_linked(void);
+void PE_select_less(void);
+void PE_select_more(void);
+
+void PE_mouse_particles(void);
+void PE_borderselect(void);
+void PE_selectionCB(short selecting, struct Object *editobj, short *mval, float rad);
+void PE_do_lasso_select(short mcords[][2], short moves, short select);
+
+/* tools */
+void PE_hide(int mode);
+void PE_rekey(void);
+void PE_subdivide(void);
+int PE_brush_particles(void);
+void PE_delete_particle(void);
+void PE_remove_doubles(void);
+void PE_mirror_x(int tagged);
+
+/* undo */
+void PE_undo_push(char *str);
+void PE_undo_step(int step);
+void PE_undo(void);
+void PE_redo(void);
+void PE_undo_menu(void);
+
+#endif
+
diff --git a/source/blender/python/api2_2x/Types.h b/source/blender/editors/include/BIF_editsca.h
index b905ab75d62..df636621b99 100644
--- a/source/blender/python/api2_2x/Types.h
+++ b/source/blender/editors/include/BIF_editsca.h
@@ -1,5 +1,5 @@
-/*
- * $Id: Types.h 7266 2006-04-16 15:28:50Z stiv $
+/**
+ * $Id: BIF_editsca.h 229 2002-12-27 13:11:01Z mein $
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
@@ -23,19 +23,19 @@
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
- * This is a new part of Blender.
+ * The Original Code is: all of this file.
*
- * Contributor(s): Willian P. Germano, Alex Mole
+ * Contributor(s): none yet.
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
+ */
-#ifndef EXPP_TYPES_H
-#define EXPP_TYPES_H
+#ifndef BIF_EDITSCA_H
+#define BIF_EDITSCA_H
-#include <Python.h>
+void make_unique_prop_names(char *str);
+void do_gamebuts(unsigned short event);
+void gamebuts(void);
-PyObject *Types_Init( void );
-void types_InitAll( void );
+#endif
-#endif /* EXPP_TYPES_H */
diff --git a/source/blender/editors/include/BIF_editseq.h b/source/blender/editors/include/BIF_editseq.h
new file mode 100644
index 00000000000..dc9722aa2fb
--- /dev/null
+++ b/source/blender/editors/include/BIF_editseq.h
@@ -0,0 +1,135 @@
+/**
+ * $Id: BIF_editseq.h 12524 2007-11-08 13:02:59Z campbellbarton $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_EDITSEQ_H
+#define BIF_EDITSEQ_H
+
+struct Sequence;
+
+void add_duplicate_seq(void);
+void add_sequence(int type);
+void borderselect_seq(void);
+void boundbox_seq(void);
+void change_sequence(void);
+void reload_sequence(void);
+void update_seq_ipo_rect(struct Sequence * seq);
+void update_seq_icu_rects(struct Sequence * seq);
+struct Sequence* get_last_seq();
+struct Sequence* get_forground_frame_seq( int frame );
+void set_last_seq(struct Sequence * seq);
+void clear_last_seq();
+void del_seq(void);
+void enter_meta(void);
+void exit_meta(void);
+struct Sequence* find_neighboring_sequence(struct Sequence *test, int lr, int sel);
+struct Sequence* find_next_prev_sequence(struct Sequence *test, int lr, int sel);
+struct Sequence* find_nearest_seq(int *hand);
+int insert_gap(int gap, int cfra);
+void make_meta(void);
+void select_channel_direction(struct Sequence *test,int lr);
+void select_more_seq(void);
+void select_less_seq(void);
+void mouse_select_seq(void);
+void no_gaps(void);
+void seq_snap(short event);
+void seq_snap_menu(void);
+void set_filter_seq(void);
+void swap_select_seq(void);
+void touch_seq_files(void);
+void seq_remap_paths(void);
+void transform_seq(int mode, int context);
+void transform_seq_nomarker(int mode, int context);
+void un_meta(void);
+void seq_cut(int cutframe);
+void seq_separate_images(void);
+void reassign_inputs_seq_effect(void);
+void select_surrounding_handles(struct Sequence *test);
+void select_surround_from_last();
+void select_dir_from_last(int lr);
+void select_neighbor_from_last(int lr);
+void select_linked_seq(int mode);
+struct Sequence* alloc_sequence(ListBase *lb, int cfra, int machine); /*used from python*/
+int check_single_seq(struct Sequence *seq);
+
+/* sequence transform functions, for internal used */
+int seq_tx_get_start(struct Sequence *seq);
+int seq_tx_get_end(struct Sequence *seq);
+
+int seq_tx_get_final_left(struct Sequence *seq);
+int seq_tx_get_final_right(struct Sequence *seq);
+
+void seq_tx_set_final_left(struct Sequence *seq, int i);
+void seq_tx_set_final_right(struct Sequence *seq, int i);
+
+/* check if one side can be transformed */
+int seq_tx_check_left(struct Sequence *seq);
+int seq_tx_check_right(struct Sequence *seq);
+
+#define SEQ_DEBUG_INFO(seq) printf("seq into '%s' -- len:%i start:%i startstill:%i endstill:%i startofs:%i endofs:%i\n",\
+ seq->name, seq->len, seq->start, seq->startstill, seq->endstill, seq->startofs, seq->endofs)
+
+/* seq macro's for transform
+ notice the difference between start/end and left/right.
+
+ left and right are the bounds at which the setuence is rendered,
+start and end are from the start and fixed length of the sequence.
+*/
+/*
+#define SEQ_GET_START(seq) (seq->start)
+#define SEQ_GET_END(seq) (seq->start+seq->len)
+
+#define SEQ_GET_FINAL_LEFT(seq) ((seq->start - seq->startstill) + seq->startofs)
+#define SEQ_GET_FINAL_RIGHT(seq) (((seq->start+seq->len) + seq->endstill) - seq->endofs)
+
+#define SEQ_SET_FINAL_LEFT(seq, val) \
+ if (val < (seq)->start) { \
+ (seq)->startstill = abs(val - (seq)->start); \
+ (seq)->startofs = 0; \
+} else { \
+ (seq)->startofs = abs(val - (seq)->start); \
+ (seq)->startstill = 0; \
+}
+
+#define SEQ_SET_FINAL_RIGHT(seq, val) \
+ if (val > (seq)->start + (seq)->len) { \
+ (seq)->endstill = abs(val - ((seq)->start + (seq)->len)); \
+ (seq)->endofs = 0; \
+} else { \
+ (seq)->endofs = abs(val - ((seq)->start + (seq)->len)); \
+ (seq)->endstill = 0; \
+}
+*/
+/* drawseq.c */
+void do_seqbuttons(short);
+
+#endif
+
diff --git a/source/blender/editors/include/BIF_editsima.h b/source/blender/editors/include/BIF_editsima.h
new file mode 100644
index 00000000000..530c07a2778
--- /dev/null
+++ b/source/blender/editors/include/BIF_editsima.h
@@ -0,0 +1,112 @@
+/**
+ * $Id: BIF_editsima.h 12667 2007-11-25 13:43:14Z campbellbarton $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+struct Mesh;
+struct EditMesh;
+struct SpaceImage;
+struct EditFace;
+struct MTFace;
+
+/* id can be from 0 to 3 */
+#define TF_PIN_MASK(id) (TF_PIN1 << id)
+#define TF_SEL_MASK(id) (TF_SEL1 << id)
+
+struct Object;
+
+void object_uvs_changed(struct Object *ob);
+void object_tface_flags_changed(struct Object *ob, int updateButtons);
+
+int is_uv_tface_editing_allowed(void);
+int is_uv_tface_editing_allowed_silent(void);
+
+void get_connected_limit_tface_uv(float *limit);
+int minmax_tface_uv(float *min, float *max);
+int cent_tface_uv(float *cent, int mode);
+
+void transform_width_height_tface_uv(int *width, int *height);
+void transform_aspect_ratio_tface_uv(float *aspx, float *aspy);
+
+void mouseco_to_cursor_sima(void);
+void borderselect_sima(short whichuvs);
+void mouseco_to_curtile(void);
+void mouse_select_sima(void);
+void snap_menu_sima(void);
+void aspect_sima(struct SpaceImage *sima, float *x, float *y);
+
+void select_invert_tface_uv(void);
+void select_swap_tface_uv(void);
+void mirrormenu_tface_uv(void);
+void mirror_tface_uv(char mirroraxis);
+void hide_tface_uv(int swap);
+void reveal_tface_uv(void);
+void stitch_limit_uv_tface(void);
+void stitch_vert_uv_tface(void);
+void unlink_selection(void);
+void uvface_setsel__internal(short select);
+void select_linked_tface_uv(int mode);
+void pin_tface_uv(int mode);
+void weld_align_menu_tface_uv(void);
+void weld_align_tface_uv(char tool);
+void be_square_tface_uv(struct EditMesh *em);
+void select_pinned_tface_uv(void);
+
+void sima_sample_color(void);
+
+#define UV_SELECT_ALL 1
+#define UV_SELECT_PINNED 2
+
+void new_image_sima(void);
+void reload_image_sima(void);
+void save_image_sima(void);
+void save_as_image_sima(void);
+void save_image_sequence_sima(void);
+void replace_image_sima(short imageselect);
+void open_image_sima(short imageselect);
+void pack_image_sima(void);
+
+/* checks images for forced updates on frame change */
+void BIF_image_update_frame(void);
+
+void find_nearest_uv(struct MTFace **nearesttf, struct EditFace **nearestefa, unsigned int *nearestv, int *nearestuv);
+
+/* face selection check functions */
+
+int simaFaceDraw_Check_nolocal( struct EditFace *efa );
+int simaFaceDraw_Check( struct EditFace *efa, struct MTFace *tf );
+
+int simaFaceSel_Check( struct EditFace *efa, struct MTFace *tf );
+void simaFaceSel_Set( struct EditFace *efa, struct MTFace *tf );
+void simaFaceSel_UnSet( struct EditFace *efa, struct MTFace *tf );
+
+int simaUVSel_Check( struct EditFace *efa, struct MTFace *tf, int i);
+void simaUVSel_Set( struct EditFace *efa, struct MTFace *tf, int i);
+void simaUVSel_UnSet( struct EditFace *efa, struct MTFace *tf, int i);
diff --git a/source/blender/editors/include/BIF_editsound.h b/source/blender/editors/include/BIF_editsound.h
new file mode 100644
index 00000000000..e326409af89
--- /dev/null
+++ b/source/blender/editors/include/BIF_editsound.h
@@ -0,0 +1,87 @@
+/**
+ * $Id: BIF_editsound.h 12320 2007-10-21 15:42:08Z schlaile $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_EDITSOUND_H
+#define BIF_EDITSOUND_H
+
+struct bSound;
+struct bSample;
+struct ListBase;
+struct PackedFile;
+struct hdaudio;
+
+void sound_init_audio(void);
+void sound_initialize_sounds(void);
+void sound_exit_audio(void);
+int sound_get_mixrate(void);
+
+void* sound_get_audiodevice(void);
+void* sound_get_listener(void);
+
+int sound_set_sample(struct bSound* sound, struct bSample* sample);
+int sound_sample_is_null(struct bSound* sound);
+int sound_load_sample(struct bSound* sound);
+
+struct bSample* sound_find_sample(struct bSound* sound);
+struct bSample* sound_new_sample(struct bSound* sound);
+
+struct bSound* sound_new_sound(char *name);
+struct bSound* sound_make_copy(struct bSound* originalsound);
+void sound_end_all_sounds(void);
+
+void sound_initialize_sample(struct bSound * sound);
+void sound_load_samples(void);
+
+void sound_play_sound(struct bSound *sound);
+void sound_stop_all_sounds(void);
+
+void sound_set_position(void *object,
+ struct bSound *sound,
+ float obmatrix[4][4]);
+
+struct hdaudio * sound_open_hdaudio(char * name);
+struct hdaudio * sound_copy_hdaudio(struct hdaudio * c);
+
+long sound_hdaudio_get_duration(struct hdaudio * hdaudio, double frame_rate);
+void sound_hdaudio_extract(struct hdaudio * hdaudio,
+ short * target_buffer,
+ int sample_position /* units of target_rate */,
+ int target_rate,
+ int target_channels,
+ int nb_samples /* in target */);
+
+void sound_close_hdaudio(struct hdaudio * hdaudio);
+
+
+
+#endif
+
diff --git a/source/blender/editors/include/BIF_editview.h b/source/blender/editors/include/BIF_editview.h
new file mode 100644
index 00000000000..17d7d53ee93
--- /dev/null
+++ b/source/blender/editors/include/BIF_editview.h
@@ -0,0 +1,61 @@
+/**
+ * $Id: BIF_editview.h 12682 2007-11-26 22:09:57Z blendix $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_EDITVIEW_H
+#define BIF_EDITVIEW_H
+
+struct Base;
+struct Object;
+struct Camera;
+struct View3D;
+
+void arrows_move_cursor(unsigned short event);
+int lasso_inside(short mcords[][2], short moves, short sx, short sy);
+void borderselect(void);
+void circle_select(void);
+void deselectall(void);
+void selectswap(void);
+void selectall_type(short obtype);
+void selectall_layer(unsigned int layernum);
+void draw_sel_circle(short *mval, short *mvalo, float rad, float rado, int selecting);
+void fly(void);
+int gesture(void);
+void mouse_cursor(void);
+void mouse_select(void);
+void set_active_base(struct Base *base);
+void set_active_object(struct Object *ob);
+void set_render_border(void);
+void view3d_border_zoom(void);
+void view3d_edit_clipping(struct View3D *v3d);
+
+#endif
+
diff --git a/source/blender/editors/include/BIF_filelist.h b/source/blender/editors/include/BIF_filelist.h
new file mode 100644
index 00000000000..e2e70054f8b
--- /dev/null
+++ b/source/blender/editors/include/BIF_filelist.h
@@ -0,0 +1,86 @@
+/**
+ * $Id: BIF_filelist.h 12544 2007-11-10 09:11:42Z elubie $
+ *
+ * ***** 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2007 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_FILELIST_H
+#define BIF_FILELIST_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct FileList;
+struct direntry;
+struct BlendHandle;
+
+struct FileList * BIF_filelist_new();
+void BIF_filelist_init_icons();
+void BIF_filelist_free_icons();
+struct FileList * BIF_filelist_copy(struct FileList* filelist);
+int BIF_filelist_find(struct FileList* filelist, char *file);
+void BIF_filelist_free(struct FileList* filelist);
+void BIF_filelist_freelib(struct FileList* filelist);
+void BIF_filelist_sort(struct FileList* filelist, short sort);
+int BIF_filelist_numfiles(struct FileList* filelist);
+const char * BIF_filelist_dir(struct FileList* filelist);
+void BIF_filelist_setdir(struct FileList* filelist, const char *dir);
+struct direntry * BIF_filelist_file(struct FileList* filelist, int index);
+void BIF_filelist_hidedot(struct FileList* filelist, short hide);
+void BIF_filelist_setfilter(struct FileList* filelist, unsigned int filter);
+void BIF_filelist_filter(struct FileList* filelist);
+void BIF_filelist_swapselect(struct FileList* filelist);
+void BIF_filelist_imgsize(struct FileList* filelist, short w, short h);
+void BIF_filelist_loadimage(struct FileList* filelist, int index);
+struct ImBuf * BIF_filelist_getimage(struct FileList* filelist, int index);
+
+void BIF_filelist_readdir(struct FileList* filelist);
+
+int BIF_filelist_empty(struct FileList* filelist);
+void BIF_filelist_parent(struct FileList* filelist);
+void BIF_filelist_setfiletypes(struct FileList* filelist, short has_quicktime);
+int BIF_filelist_islibrary (struct FileList* filelist, char* dir, char* group);
+void BIF_filelist_from_main(struct FileList* filelist);
+void BIF_filelist_from_library(struct FileList* filelist);
+void BIF_filelist_append_library(struct FileList* filelist, char *dir, char* file, short flag, int idcode);
+void BIF_filelist_settype(struct FileList* filelist, int type);
+short BIF_filelist_gettype(struct FileList* filelist);
+void BIF_filelist_setipotype(struct FileList* filelist, short ipotype);
+void BIF_filelist_hasfunc(struct FileList* filelist, int has_func);
+
+struct BlendHandle *BIF_filelist_lib(struct FileList* filelist);
+int BIF_groupname_to_code(char *group); /* TODO: where should this go */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/source/blender/editors/include/BIF_fsmenu.h b/source/blender/editors/include/BIF_fsmenu.h
new file mode 100644
index 00000000000..9f1844e34d3
--- /dev/null
+++ b/source/blender/editors/include/BIF_fsmenu.h
@@ -0,0 +1,76 @@
+/**
+ * $Id: BIF_fsmenu.h 11920 2007-09-02 17:25:03Z elubie $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ *
+ */
+
+#ifndef BSE_FSMENU_H
+#define BSE_FSMENU_H
+
+ /** Returns the number of entries in the Fileselect Menu */
+int fsmenu_get_nentries (void);
+
+ /** Returns true if the fsmenu entry at @a index exists and
+ * is a seperator.
+ */
+int fsmenu_is_entry_a_seperator (int index);
+
+ /** Returns the fsmenu entry at @a index (or NULL if a bad index)
+ * or a seperator.
+ */
+char* fsmenu_get_entry (int index);
+
+ /** Returns a new menu description string representing the
+ * fileselect menu. Should be free'd with MEM_freeN.
+ */
+char* fsmenu_build_menu (void);
+
+ /** Append a seperator to the FSMenu, inserts always follow the
+ * last seperator.
+ */
+void fsmenu_append_separator (void);
+
+ /** Inserts a new fsmenu entry with the given @a path.
+ * Duplicate entries are not added.
+ * @param sorted Should entry be inserted in sorted order?
+ */
+void fsmenu_insert_entry (char *path, int sorted, short save);
+
+ /** Removes the fsmenu entry at the given @a index. */
+void fsmenu_remove_entry (int index);
+
+ /** saves the 'favourites' to the specified file */
+void fsmenu_write_file(const char *filename);
+
+ /** Free's all the memory associated with the fsmenu */
+void fsmenu_free (void);
+
+#endif
+
diff --git a/source/blender/editors/include/BIF_gl.h b/source/blender/editors/include/BIF_gl.h
new file mode 100644
index 00000000000..3b23e534229
--- /dev/null
+++ b/source/blender/editors/include/BIF_gl.h
@@ -0,0 +1,82 @@
+/**
+ * $Id: BIF_gl.h 10455 2007-04-04 13:18:41Z campbellbarton $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ * os dependent include locations of gl.h
+ */
+
+#ifndef BIF_GL_H
+#define BIF_GL_H
+
+ /* Although not really a great idea to copy these defines
+ * from Windows' winnt.h, this lets us use GL without including
+ * windows.h everywhere (or BLI_winstuff.h) which is a good thing.
+ */
+#ifdef WIN32
+#ifndef APIENTRY
+#define APIENTRY __stdcall
+#endif
+
+#ifndef CALLBACK
+#define CALLBACK __stdcall
+#endif
+
+#ifndef WINGDIAPI
+#define WINGDIAPI __declspec(dllimport)
+#endif
+#endif
+
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#include <OpenGL/glu.h>
+#else
+#include <GL/gl.h>
+#include <GL/glu.h>
+#endif
+ /*
+ * these should be phased out. cpack should be replaced in
+ * code with calls to glColor3ub, lrectwrite probably should
+ * change to a function. - zr
+ */
+
+/*
+ *
+ * This define converts a numerical value to the equivalent 24-bit
+ * color, while not being endian-sensitive. On little-endians, this
+ * is the same as doing a 'naive'indexing, on big-endian, it is not!
+ * */
+#define cpack(x) glColor3ub( ((x)&0xFF), (((x)>>8)&0xFF), (((x)>>16)&0xFF) )
+
+#define glMultMatrixf(x) glMultMatrixf( (float *)(x))
+#define glLoadMatrixf(x) glLoadMatrixf( (float *)(x))
+
+#define lrectwrite(a, b, c, d, rect) {glRasterPos2i(a, b);glDrawPixels((c)-(a)+1, (d)-(b)+1, GL_RGBA, GL_UNSIGNED_BYTE, rect);}
+
+#endif /* #ifdef BIF_GL_H */
+
diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h
new file mode 100644
index 00000000000..93ca90ce12f
--- /dev/null
+++ b/source/blender/editors/include/BIF_glutil.h
@@ -0,0 +1,225 @@
+/**
+ * @file BIF_glutil.h
+ *
+ * OpenGL drawing utility functions.
+ *
+ * $Id: BIF_glutil.h 10207 2007-03-06 03:39:15Z halley $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_GLUTIL_H
+#define BIF_GLUTIL_H
+
+struct rcti;
+struct rctf;
+
+void sdrawXORline(int x0, int y0, int x1, int y1);
+void sdrawXORline4(int nr, int x0, int y0, int x1, int y1);
+
+void fdrawXORellipse(float xofs, float yofs, float hw, float hh);
+void fdrawXORcirc(float xofs, float yofs, float rad);
+
+ /**
+ * Draw an XOR'd line in the front buffer between
+ * the given points.
+ *
+ * @attention This function also handles flushing the GL
+ * pipeline, which means it is inappropriate for drawing
+ * a large number of lines at once.
+ */
+void glutil_draw_front_xor_line(int x0, int y0, int x1, int y1);
+
+ /**
+ * Draw a lined (non-looping) arc with the given
+ * @a radius, starting at angle @a start and arcing
+ * through @a angle. The arc is centered at the origin
+ * and drawn in the XY plane.
+ *
+ * @param start The initial angle (in radians).
+ * @param angle The length of the arc (in radians).
+ * @param radius The arc radius.
+ * @param nsegments The number of segments to use in drawing the arc.
+ */
+void glutil_draw_lined_arc (float start, float angle, float radius, int nsegments);
+
+ /**
+ * Draw a filled arc with the given @a radius,
+ * starting at angle @a start and arcing through
+ * @a angle. The arc is centered at the origin
+ * and drawn in the XY plane.
+ *
+ * @param start The initial angle (in radians).
+ * @param angle The length of the arc (in radians).
+ * @param radius The arc radius.
+ * @param nsegments The number of segments to use in drawing the arc.
+ */
+void glutil_draw_filled_arc (float start, float angle, float radius, int nsegments);
+
+ /**
+ * Routines an integer value as obtained by glGetIntegerv.
+ * The param must cause only one value to be gotten from GL.
+ */
+int glaGetOneInteger (int param);
+
+ /**
+ * Routines a float value as obtained by glGetIntegerv.
+ * The param must cause only one value to be gotten from GL.
+ */
+float glaGetOneFloat (int param);
+
+ /**
+ * Functions like glRasterPos2i, except ensures that the resulting
+ * raster position is valid. @a known_good_x and @a known_good_y
+ * should be coordinates of a point known to be within the current
+ * view frustum.
+ * @attention This routine should be used when the distance of @a x
+ * and @y away from the known good point is small (ie. for small icons
+ * and for bitmap characters), when drawing large+zoomed images it is
+ * possible for overflow to occur, the glaDrawPixelsSafe routine should
+ * be used instead.
+ */
+void glaRasterPosSafe2f (float x, float y, float known_good_x, float known_good_y);
+
+ /**
+ * Functions like a limited glDrawPixels, except ensures that
+ * the image is displayed onscreen even if the @a x and @a y
+ * coordinates for would be clipped. The routine respects the
+ * glPixelZoom values, pixel unpacking parameters are _not_
+ * respected.
+
+ * @attention This routine makes many assumptions: the rect data
+ * is expected to be in RGBA unsigned byte format, the coordinate
+ * (0.375, 0.375) is assumed to be within the view frustum, and the
+ * modelview and projection matrices are assumed to define a
+ * 1-to-1 mapping to screen space.
+ * @attention Furthmore, in the case of zoomed or unpixel aligned
+ * images extending outside the view frustum, but still within the
+ * window, some portion of the image may be visible left and/or
+ * below of the given @a x and @a y coordinates. It is recommended
+ * to use the glScissor functionality if images are to be drawn
+ * with an inset view matrix.
+ */
+void glaDrawPixelsSafe (float x, float y, int img_w, int img_h, int row_w, int format, int type, void *rect);
+
+ /**
+ * Functions like a limited glDrawPixels, but actually draws the
+ * image using textures, which can be tremendously faster on low-end
+ * cards, and also avoids problems with the raster position being
+ * clipped when offscreen. The routine respects the glPixelZoom values,
+ * pixel unpacking parameters are _not_ respected.
+
+ * @attention This routine makes many assumptions: the rect data
+ * is expected to be in RGBA byte or float format, and the
+ * modelview and projection matrices are assumed to define a
+ * 1-to-1 mapping to screen space.
+ */
+
+ /* only for float rects, converts to 32 bits and draws */
+void glaDrawPixelsSafe_to32(float fx, float fy, int img_w, int img_h, int row_w, float *rectf);
+
+
+void glaDrawPixelsTex (float x, float y, int img_w, int img_h, int format, void *rect);
+
+ /* 2D Drawing Assistance */
+
+ /** Define a 2D area (viewport, scissor, matrices) for OpenGL rendering.
+ * This routine sets up an OpenGL state appropriate for drawing using
+ * both vertice (glVertex, etc) and raster (glRasterPos, glRect) commands.
+ * All coordinates should be at integer positions. There is little to
+ * no reason to use glVertex2f etc. functions during 2D rendering, and
+ * thus no reason to +-0.5 the coordinates or perform other silly
+ * tricks.
+ *
+ * @param screen_rect The screen rectangle to be defined for 2D drawing.
+ */
+void glaDefine2DArea (struct rcti *screen_rect);
+
+typedef struct gla2DDrawInfo gla2DDrawInfo;
+
+ /** Save the current OpenGL state and initialize OpenGL for 2D
+ * rendering. glaEnd2DDraw should be called on the returned structure
+ * to free it and to return OpenGL to its previous state. The
+ * scissor rectangle is set to match the viewport.
+ *
+ * This routine sets up an OpenGL state appropriate for drawing using
+ * both vertice (glVertex, etc) and raster (glRasterPos, glRect) commands.
+ * All coordinates should be at integer positions. There is little to
+ * no reason to use glVertex2f etc. functions during 2D rendering, and
+ * thus no reason to +-0.5 the coordinates or perform other silly
+ * tricks.
+ *
+ * @param screen_rect The screen rectangle to be used for 2D drawing.
+ * @param world_rect The world rectangle that the 2D area represented
+ * by @a screen_rect is supposed to represent. If NULL it is assumed the
+ * world has a 1 to 1 mapping to the screen.
+ */
+gla2DDrawInfo* glaBegin2DDraw (struct rcti *screen_rect, struct rctf *world_rect);
+
+ /** Translate the (@a wo_x, @a wo_y) point from world coordinates into screen space. */
+void gla2DDrawTranslatePt (gla2DDrawInfo *di, float wo_x, float wo_y, int *sc_x_r, int *sc_y_r);
+
+ /** Translate the @a world point from world coordiantes into screen space. */
+void gla2DDrawTranslatePtv (gla2DDrawInfo *di, float world[2], int screen_r[2]);
+
+ /* Restores the previous OpenGL state and free's the auxilary
+ * gla data.
+ */
+void glaEnd2DDraw (gla2DDrawInfo *di);
+
+ /** Adjust the transformation mapping of a 2d area */
+void gla2DGetMap(gla2DDrawInfo *di, struct rctf *rect);
+void gla2DSetMap(gla2DDrawInfo *di, struct rctf *rect);
+
+
+/* use this for platform hacks. glPointSize is solved here */
+void bglBegin(int mode);
+void bglEnd(void);
+void bglVertex3fv(float *vec);
+void bglVertex3f(float x, float y, float z);
+void bglVertex2fv(float *vec);
+/* intel gfx cards frontbuffer problem */
+void bglFlush(void);
+int is_a_really_crappy_intel_card(void);
+void set_inverted_drawing(int enable);
+
+
+/* own working polygon offset */
+void bglPolygonOffset(float dist);
+
+/* For caching opengl matrices (gluProject/gluUnProject) */
+typedef struct bglMats {
+ double modelview[16];
+ double projection[16];
+ int viewport[4];
+} bglMats;
+void bgl_get_mats(bglMats *mats);
+
+#endif /* BIF_GLUTIL_H */
+
diff --git a/source/blender/python/api2_2x/Text.h b/source/blender/editors/include/BIF_graphics.h
index 90de82f1254..3cc4098a7c4 100644
--- a/source/blender/python/api2_2x/Text.h
+++ b/source/blender/editors/include/BIF_graphics.h
@@ -1,5 +1,5 @@
-/*
- * $Id: Text.h 10136 2007-02-25 01:07:28Z campbellbarton $
+/**
+ * $Id: BIF_graphics.h 6596 2006-01-29 22:25:53Z broken $
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
@@ -23,30 +23,37 @@
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
- * This is a new part of Blender.
+ * The Original Code is: all of this file.
*
- * Contributor(s): Willian P. Germano
+ * Contributor(s): none yet.
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
+ */
-#ifndef EXPP_TEXT_H
-#define EXPP_TEXT_H
+#ifndef BIF_GRAPHICS_H
+#define BIF_GRAPHICS_H
-#include <Python.h>
-#include "DNA_text_types.h"
+ /* XXX, should move somewhere else, with collected windowing
+ * stuff, to be done once the proper windowing stuff has
+ * been formed.
+ */
+
+enum {
+ CURSOR_VPAINT,
+ CURSOR_FACESEL,
+ CURSOR_WAIT,
+ CURSOR_EDIT,
+ CURSOR_X_MOVE,
+ CURSOR_Y_MOVE,
+ CURSOR_HELP,
+ CURSOR_STD,
+ CURSOR_NONE,
+ CURSOR_PENCIL,
+ CURSOR_TEXTEDIT
+};
-extern PyTypeObject Text_Type;
+void set_cursor(int curs);
+int get_cursor(void);
-/* Type checking for EXPP PyTypes */
-#define BPy_Text_Check(v) ((v)->ob_type == &Text_Type)
+#endif /* BIF_GRAPHICS_H */
-typedef struct {
- PyObject_HEAD
- Text * text; /* libdata must be second */
-} BPy_Text;
-
-PyObject *Text_Init( void );
-PyObject *Text_CreatePyObject( Text * txt );
-
-#endif /* EXPP_TEXT_H */
diff --git a/source/blender/editors/include/BIF_imasel.h b/source/blender/editors/include/BIF_imasel.h
new file mode 100644
index 00000000000..b08f6664e2a
--- /dev/null
+++ b/source/blender/editors/include/BIF_imasel.h
@@ -0,0 +1,51 @@
+/**
+ * $Id: BIF_imasel.h 11920 2007-09-02 17:25:03Z elubie $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+#ifndef BIF_IMASEL_H
+#define BIF_IMASEL_H
+
+struct SpaceImaSel;
+struct ScrArea;
+
+void free_imasel(struct SpaceImaSel *simasel);
+
+void clever_numbuts_imasel(void);
+
+void activate_imageselect(int type, char *title, char *file, void (*func)(char *));
+void activate_imageselect_menu(int type, char *title, char *file, char *pupmenu, short *menup, void (*func)(char *));
+void activate_imageselect_args(int type, char *title, char *file, void (*func)(char *, void *, void *), void *arg1, void *arg2);
+
+void activate_databrowse_imasel(struct ID *id, int idcode, int fromcode, int retval, short *menup, void (*func)(unsigned short));
+/*
+void activate_databrowse_imasel_args(struct ID *id, int idcode, int fromcode, short *menup, void (*func)(char *, void *, void *), void *arg1, void *arg2);
+*/
+#endif
+
diff --git a/source/blender/editors/include/BIF_interface.h b/source/blender/editors/include/BIF_interface.h
new file mode 100644
index 00000000000..d430105ab35
--- /dev/null
+++ b/source/blender/editors/include/BIF_interface.h
@@ -0,0 +1,331 @@
+/**
+ * $Id: BIF_interface.h 11429 2007-07-30 15:59:16Z pidhash $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_INTERFACE_H
+#define BIF_INTERFACE_H
+
+struct ID;
+struct ListBase;
+struct ScrArea;
+struct AutoComplete;
+
+/* uiBlock->dt */
+#define UI_EMBOSS 0 /* use one of the themes for drawing */
+#define UI_EMBOSSN 1 /* Nothing */
+#define UI_EMBOSSM 2 /* Minimal builtin emboss, also for logic buttons */
+#define UI_EMBOSSP 3 /* Pulldown */
+#define UI_EMBOSSR 4 /* Rounded */
+
+#define UI_EMBOSSX 0 /* for a python file, which i can't change.... duh! */
+
+/* uiBlock->direction */
+#define UI_TOP 1
+#define UI_DOWN 2
+#define UI_LEFT 4
+#define UI_RIGHT 8
+#define UI_DIRECTION 15
+#define UI_CENTER 16
+#define UI_SHIFT_FLIPPED 32
+
+/* uiBlock->autofill */
+#define UI_BLOCK_COLLUMNS 1
+#define UI_BLOCK_ROWS 2
+
+/* return from uiDoBlock */
+#define UI_CONT 0
+#define UI_NOTHING 1
+#define UI_RETURN_CANCEL 2
+#define UI_RETURN_OK 4
+#define UI_RETURN_OUT 8
+#define UI_RETURN 14
+#define UI_EXIT_LOOP 16
+
+/* uiBlock->flag (controls) */
+#define UI_BLOCK_LOOP 1
+#define UI_BLOCK_REDRAW 2
+#define UI_BLOCK_RET_1 4
+#define UI_BLOCK_BUSY 8
+#define UI_BLOCK_NUMSELECT 16
+#define UI_BLOCK_ENTER_OK 32
+#define UI_BLOCK_NOSHADOW 64
+#define UI_BLOCK_FRONTBUFFER 128
+#define UI_BLOCK_NO_HILITE 256
+
+ /* block->flag bits 12-15 are identical to but->flag bits */
+
+/* block->font, for now: bold = medium+1 */
+#define UI_HELV 0
+#define UI_HELVB 1
+
+/* panel controls */
+#define UI_PNL_TRANSP 1
+#define UI_PNL_SOLID 2
+
+#define UI_PNL_CLOSE 32
+#define UI_PNL_STOW 64
+#define UI_PNL_TO_MOUSE 128
+#define UI_PNL_UNSTOW 256
+#define UI_PNL_SCALE 512
+
+/* warning the first 4 flags are internal */
+/* but->flag */
+#define UI_TEXT_LEFT 16
+#define UI_ICON_LEFT 32
+#define UI_ICON_RIGHT 64
+ /* control for button type block */
+#define UI_MAKE_TOP 128
+#define UI_MAKE_DOWN 256
+#define UI_MAKE_LEFT 512
+#define UI_MAKE_RIGHT 1024
+ /* dont draw hilite on mouse over */
+#define UI_NO_HILITE 2048
+ /* button align flag, for drawing groups together */
+#define UI_BUT_ALIGN (15<<12)
+#define UI_BUT_ALIGN_TOP (1<<12)
+#define UI_BUT_ALIGN_LEFT (1<<13)
+#define UI_BUT_ALIGN_RIGHT (1<<14)
+#define UI_BUT_ALIGN_DOWN (1<<15)
+
+
+/* Button types, bits stored in 1 value... and a short even!
+- bits 0-4: bitnr (0-31)
+- bits 5-7: pointer type
+- bit 8: for 'bit'
+- bit 9-15: button type (now 6 bits, 64 types)
+*/
+
+#define CHA 32
+#define SHO 64
+#define INT 96
+#define FLO 128
+#define FUN 192
+#define BIT 256
+
+#define BUTPOIN (128+64+32)
+
+#define BUT (1<<9)
+#define ROW (2<<9)
+#define TOG (3<<9)
+#define SLI (4<<9)
+#define NUM (5<<9)
+#define TEX (6<<9)
+#define TOG3 (7<<9)
+#define TOGR (8<<9)
+#define TOGN (9<<9)
+#define LABEL (10<<9)
+#define MENU (11<<9)
+#define ICONROW (12<<9)
+#define ICONTOG (13<<9)
+#define NUMSLI (14<<9)
+#define COL (15<<9)
+#define IDPOIN (16<<9)
+#define HSVSLI (17<<9)
+#define SCROLL (18<<9)
+#define BLOCK (19<<9)
+#define BUTM (20<<9)
+#define SEPR (21<<9)
+#define LINK (22<<9)
+#define INLINK (23<<9)
+#define KEYEVT (24<<9)
+#define ICONTEXTROW (25<<9)
+#define HSVCUBE (26<<9)
+#define PULLDOWN (27<<9)
+#define ROUNDBOX (28<<9)
+#define CHARTAB (29<<9)
+#define BUT_COLORBAND (30<<9)
+#define BUT_NORMAL (31<<9)
+#define BUT_CURVE (32<<9)
+#define BUT_TOGDUAL (33<<9)
+#define ICONTOGN (34<<9)
+#define FTPREVIEW (35<<9)
+#define BUTTYPE (63<<9)
+
+
+
+typedef struct uiBut uiBut;
+typedef struct uiBlock uiBlock;
+
+void uiEmboss(float x1, float y1, float x2, float y2, int sel);
+void uiRoundBoxEmboss(float minx, float miny, float maxx, float maxy, float rad, int active);
+void uiRoundBox(float minx, float miny, float maxx, float maxy, float rad);
+void uiSetRoundBox(int type);
+void uiRoundRect(float minx, float miny, float maxx, float maxy, float rad);
+
+void uiDrawMenuBox(float minx, float miny, float maxx, float maxy, short flag);
+void uiTextBoundsBlock(uiBlock *block, int addval);
+void uiBoundsBlock(struct uiBlock *block, int addval);
+void uiDrawBlock(struct uiBlock *block);
+void uiGetMouse(int win, short *adr);
+void uiComposeLinks(uiBlock *block);
+void uiSetButLock(int val, char *lockstr);
+void uiClearButLock(void);
+int uiDoBlocks(struct ListBase *lb, int event);
+void uiSetCurFont(uiBlock *block, int index);
+void uiDefFont(unsigned int index, void *xl, void *large, void *medium, void *small);
+void uiFreeBlock(uiBlock *block);
+void uiFreeBlocks(struct ListBase *lb);
+void uiFreeBlocksWin(struct ListBase *lb, int win);
+uiBlock *uiNewBlock(struct ListBase *lb, char *name, short dt, short font, short win);
+uiBlock *uiGetBlock(char *name, struct ScrArea *sa);
+
+void uiBlockPickerButtons(struct uiBlock *block, float *col, float *hsv, float *old, char *hexcol, char mode, short retval);
+
+
+/* automatic aligning, horiz or verical */
+void uiBlockBeginAlign(uiBlock *block);
+void uiBlockEndAlign(uiBlock *block);
+
+uiBut *uiDefBut(uiBlock *block,
+ int type, int retval, char *str,
+ short x1, short y1,
+ short x2, short y2,
+ void *poin,
+ float min, float max,
+ float a1, float a2, char *tip);
+uiBut *uiDefButF(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip);
+uiBut *uiDefButBitF(uiBlock *block, int type, int bit, int retval, char *str, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip);
+uiBut *uiDefButI(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip);
+uiBut *uiDefButBitI(uiBlock *block, int type, int bit, int retval, char *str, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip);
+uiBut *uiDefButS(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip);
+uiBut *uiDefButBitS(uiBlock *block, int type, int bit, int retval, char *str, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip);
+uiBut *uiDefButC(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip);
+uiBut *uiDefButBitC(uiBlock *block, int type, int bit, int retval, char *str, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip);
+
+uiBut *uiDefIconBut(uiBlock *block,
+ int type, int retval, int icon,
+ short x1, short y1,
+ short x2, short y2,
+ void *poin,
+ float min, float max,
+ float a1, float a2, char *tip);
+uiBut *uiDefIconButF(uiBlock *block, int type, int retval, int icon, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip);
+uiBut *uiDefIconButBitF(uiBlock *block, int type, int bit, int retval, int icon, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip);
+uiBut *uiDefIconButI(uiBlock *block, int type, int retval, int icon, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip);
+uiBut *uiDefIconButBitI(uiBlock *block, int type, int bit, int retval, int icon, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip);
+uiBut *uiDefIconButS(uiBlock *block, int type, int retval, int icon, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip);
+uiBut *uiDefIconButBitS(uiBlock *block, int type, int bit, int retval, int icon, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip);
+uiBut *uiDefIconButC(uiBlock *block, int type, int retval, int icon, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip);
+uiBut *uiDefIconButBitC(uiBlock *block, int type, int bit, int retval, int icon, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip);
+
+uiBut *uiDefIconTextBut(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip);
+
+uiBut *uiDefIconTextButF(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip);
+uiBut *uiDefIconTextButBitF(uiBlock *block, int type, int bit, int retval, int icon, char *str, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip);
+uiBut *uiDefIconTextButI(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip);
+uiBut *uiDefIconTextButBitI(uiBlock *block, int type, int bit, int retval, int icon, char *str, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip);
+uiBut *uiDefIconTextButS(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip);
+uiBut *uiDefIconTextButBitS(uiBlock *block, int type, int bit, int retval, int icon, char *str, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip);
+uiBut *uiDefIconTextButC(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip);
+uiBut *uiDefIconTextButBitC(uiBlock *block, int type, int bit, int retval, int icon, char *str, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip);
+
+typedef void (*uiIDPoinFuncFP) (char *str, struct ID **idpp);
+uiBut *uiDefIDPoinBut(struct uiBlock *block, uiIDPoinFuncFP func, short blocktype, int retval, char *str,
+ short x1, short y1, short x2, short y2, void *idpp, char *tip);
+
+typedef uiBlock* (*uiBlockFuncFP) (void *arg1);
+uiBut *uiDefBlockBut(uiBlock *block, uiBlockFuncFP func, void *func_arg1, char *str, short x1, short y1, short x2, short y2, char *tip);
+uiBut *uiDefPulldownBut(uiBlock *block, uiBlockFuncFP func, void *func_arg1, char *str, short x1, short y1, short x2, short y2, char *tip);
+
+uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, int icon, char *str, short x1, short y1, short x2, short y2, char *tip);
+uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, int retval, int icon, short x1, short y1, short x2, short y2, char *tip);
+
+void uiDefKeyevtButS(uiBlock *block, int retval, char *str, short x1, short y1, short x2, short y2, short *spoin, char *tip);
+
+void uiAutoBlock(struct uiBlock *block,
+ float minx, float miny,
+ float sizex, float sizey, int flag);
+void uiSetButLink(struct uiBut *but,
+ void **poin,
+ void ***ppoin,
+ short *tot,
+ int from, int to);
+
+int uiBlocksGetYMin (ListBase *lb);
+int uiBlockGetCol (uiBlock *block);
+void* uiBlockGetCurFont (uiBlock *block);
+
+void uiBlockSetCol (uiBlock *block, int col);
+void uiBlockSetEmboss (uiBlock *block, int emboss);
+void uiBlockSetDirection (uiBlock *block, int direction);
+void uiBlockFlipOrder (uiBlock *block);
+void uiBlockSetFlag (uiBlock *block, int flag);
+void uiBlockSetXOfs (uiBlock *block, int xofs);
+
+int uiButGetRetVal (uiBut *but);
+
+void uiButSetFlag (uiBut *but, int flag);
+void uiButClearFlag (uiBut *but, int flag);
+
+void uiBlockSetButmFunc (uiBlock *block, void (*butmfunc)(void *arg, int but_a2), void *arg);
+
+void uiBlockSetFunc (uiBlock *block, void (*func)(void *arg1, void *arg2), void *arg1, void *arg2);
+void uiButSetFunc (uiBut *but, void (*func)(void *arg1, void *arg2), void *arg1, void *arg2);
+
+void uiButSetCompleteFunc(uiBut *but, void (*func)(char *str, void *arg), void *arg);
+
+void uiBlockSetDrawExtraFunc(uiBlock *block, void (*func)(struct ScrArea *sa, uiBlock *block));
+
+
+extern void pupmenu_set_active(int val);
+extern short pupmenu(char *instr);
+extern short pupmenu_col(char *instr, int maxrow);
+
+extern void uiFreePanels(struct ListBase *lb);
+extern void uiNewPanelTabbed(char *, char *);
+extern int uiNewPanel(struct ScrArea *sa, struct uiBlock *block, char *panelname, char *tabname, int ofsx, int ofsy, int sizex, int sizey);
+
+extern void uiSetPanel_view2d(struct ScrArea *sa);
+extern void uiMatchPanel_view2d(struct ScrArea *sa);
+
+extern void uiDrawBlocksPanels(struct ScrArea *sa, int re_align);
+extern void uiNewPanelHeight(struct uiBlock *block, int sizey);
+extern void uiNewPanelTitle(struct uiBlock *block, char *str);
+extern void uiPanelPush(struct uiBlock *block);
+extern void uiPanelPop(struct uiBlock *block);
+extern uiBlock *uiFindOpenPanelBlockName(ListBase *lb, char *name);
+extern int uiAlignPanelStep(struct ScrArea *sa, float fac);
+extern void uiPanelControl(int);
+extern void uiSetPanelHandler(int);
+
+extern void uiDrawBoxShadow(unsigned char alpha, float minx, float miny, float maxx, float maxy);
+extern void *uiSetCurFont_ext(float aspect);
+
+void shade_buttons_change_3d(void);
+
+typedef struct AutoComplete AutoComplete;
+
+AutoComplete *autocomplete_begin(char *startname, int maxlen);
+void autocomplete_do_name(AutoComplete *autocpl, const char *name);
+void autocomplete_end(AutoComplete *autocpl, char *autoname);
+
+#endif /* BIF_INTERFACE_H */
+
diff --git a/source/blender/editors/include/BIF_interface_icons.h b/source/blender/editors/include/BIF_interface_icons.h
new file mode 100644
index 00000000000..63ce89eef62
--- /dev/null
+++ b/source/blender/editors/include/BIF_interface_icons.h
@@ -0,0 +1,72 @@
+/**
+ * $Id: BIF_interface_icons.h 11920 2007-09-02 17:25:03Z elubie $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_PREVIEW_ICONS_H
+#define BIF_PREVIEW_ICONS_H
+
+struct Image;
+struct ImBuf;
+struct World;
+struct Tex;
+struct Lamp;
+struct Material;
+
+typedef struct IconFile {
+ struct IconFile *next, *prev;
+ char filename[80]; // FILE_MAXFILE size
+ int index;
+} IconFile;
+
+
+#define ICON_DEFAULT_HEIGHT 16
+#define PREVIEW_DEFAULT_HEIGHT 96
+
+/*
+ Resizable Icons for Blender
+*/
+void BIF_icons_init(int first_dyn_id);
+int BIF_icon_get_width(int icon_id);
+int BIF_icon_get_height(int icon_id);
+
+void BIF_icon_draw(float x, float y, int icon_id);
+void BIF_icon_draw_preview(float x, float y, int icon_id, int nocreate);
+
+void BIF_icon_draw_aspect(float x, float y, int icon_id, float aspect);
+void BIF_icon_draw_aspect_blended(float x, float y, int icon_id, float aspect, int shade);
+void BIF_icons_free();
+void BIF_icons_free_drawinfo(void *drawinfo);
+
+struct ListBase *BIF_iconfile_list(void);
+int BIF_iconfile_get_index(char *filename);
+
+
+#endif /* BIF_ICONS_H */
diff --git a/source/blender/python/api2_2x/Window.h b/source/blender/editors/include/BIF_keyval.h
index a39856ecd58..acc34ddfa11 100644
--- a/source/blender/python/api2_2x/Window.h
+++ b/source/blender/editors/include/BIF_keyval.h
@@ -1,5 +1,5 @@
-/*
- * $Id:*
+/**
+ * $Id: BIF_keyval.h 229 2002-12-27 13:11:01Z mein $
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
@@ -23,21 +23,17 @@
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
- * This is a new part of Blender.
+ * The Original Code is: all of this file.
*
- * Contributor(s): Willian P. Germano
+ * Contributor(s): none yet.
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
+ */
-/* This file is useless now, CAN BE REMOVED. */
+#ifndef BIF_KEYVAL_H
+#define BIF_KEYVAL_H
-#ifndef EXPP_WINDOW_H
-#define EXPP_WINDOW_H
+char *key_event_to_string(unsigned short event);
-#include <Python.h>
+#endif
-PyObject *Window_Init( void );
-PyObject *M_Window_Redraw( PyObject * self, PyObject * args );
-
-#endif /* EXPP_WINDOW_H */
diff --git a/source/blender/python/api2_2x/vector.h b/source/blender/editors/include/BIF_language.h
index 040f1ba5594..a1044101bce 100644
--- a/source/blender/python/api2_2x/vector.h
+++ b/source/blender/editors/include/BIF_language.h
@@ -1,4 +1,5 @@
-/* $Id: vector.h 10313 2007-03-20 12:07:02Z campbellbarton $
+/**
+ * $Id: BIF_language.h 11725 2007-08-20 01:02:12Z broken $
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
@@ -24,38 +25,45 @@
*
* The Original Code is: all of this file.
*
- * Contributor(s): Willian P. Germano & Joseph Gilbert
+ * Contributor(s): none yet.
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
- *
*/
-#ifndef EXPP_vector_h
-#define EXPP_vector_h
+#ifndef BIF_LANGUAGE_H
+#define BIF_LANGUAGE_H
+
+#include "DNA_vec_types.h"
+
+struct BMF_Font;
+
+int read_languagefile(void); /* usiblender.c */
+void free_languagemenu(void); /* usiblender.c */
+
+void set_interface_font(char *str); /* headerbuttons.c */
+void start_interface_font(void); /* headerbuttons.c */
+void lang_setlanguage(void); /* usiblender.c */
+
+char *language_pup(void);
+char *fontsize_pup(void);
-#include <Python.h>
+int BIF_DrawString(struct BMF_Font* font, char *str, int translate);
+float BIF_GetStringWidth(struct BMF_Font* font, char *str, int translate);
+void BIF_GetBoundingBox(struct BMF_Font* font, char* str, int translate, rctf* bbox);
-extern PyTypeObject vector_Type;
+void BIF_RasterPos(float x, float y);
+void BIF_SetScale(float aspect);
+void refresh_interface_font(void);
-#define VectorObject_Check(v) ((v)->ob_type == &vector_Type)
+struct LANGMenuEntry {
+ struct LANGMenuEntry *next;
+ char *line;
+ char *language;
+ char *code;
+ int id;
+};
-typedef struct {
- PyObject_VAR_HEAD
- float *vec; /*1D array of data (alias), wrapped status depends on wrapped status */
- short size; /* vec size 2,3 or 4 */
- short wrapped; /* is wrapped data? */
-} VectorObject;
+struct LANGMenuEntry *find_language(short langid);
-/*prototypes*/
-PyObject *Vector_Zero( VectorObject * self );
-PyObject *Vector_Normalize( VectorObject * self );
-PyObject *Vector_Negate( VectorObject * self );
-PyObject *Vector_Resize2D( VectorObject * self );
-PyObject *Vector_Resize3D( VectorObject * self );
-PyObject *Vector_Resize4D( VectorObject * self );
-PyObject *Vector_toPoint( VectorObject * self );
-PyObject *Vector_ToTrackQuat( VectorObject * self, PyObject * args );
-PyObject *Vector_copy( VectorObject * self );
-PyObject *newVectorObject(float *vec, int size, int type);
+#endif /* BIF_LANGUAGE_H */
-#endif /* EXPP_vector_h */
diff --git a/source/blender/editors/include/BIF_mainqueue.h b/source/blender/editors/include/BIF_mainqueue.h
new file mode 100644
index 00000000000..3d87a32119d
--- /dev/null
+++ b/source/blender/editors/include/BIF_mainqueue.h
@@ -0,0 +1,47 @@
+/*
+ * Central queue handling functions.
+ *
+ * $Id: BIF_mainqueue.h 9981 2007-01-31 11:24:13Z artificer $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_MAINQUEUE_H
+#define BIF_MAINQUEUE_H
+
+#define MAXQUEUE 4096
+
+unsigned short mainqtest (void);
+unsigned short mainqread (short *val, char *ascii);
+void mainqenter (unsigned short event, short val);
+void mainqenter_ext (unsigned short event, short val, char ascii);
+void mainqpushback (unsigned short event, short val, char ascii);
+
+#endif /* BIF_MAINQUEUE_H */
+
diff --git a/source/blender/editors/include/BIF_meshlaplacian.h b/source/blender/editors/include/BIF_meshlaplacian.h
new file mode 100644
index 00000000000..74e4fef0937
--- /dev/null
+++ b/source/blender/editors/include/BIF_meshlaplacian.h
@@ -0,0 +1,87 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ * BIF_meshlaplacian.h: Algorithms using the mesh laplacian.
+ */
+
+#ifndef BIF_MESHLAPLACIAN_H
+#define BIF_MESHLAPLACIAN_H
+
+//#define RIGID_DEFORM
+
+struct Object;
+struct Mesh;
+struct bDeformGroup;
+struct MeshDeformModifierData;
+
+#ifdef RIGID_DEFORM
+struct EditMesh;
+#endif
+
+/* Laplacian System */
+
+struct LaplacianSystem;
+typedef struct LaplacianSystem LaplacianSystem;
+
+LaplacianSystem *laplacian_construct_begin(int totvert, int totface);
+
+void laplacian_add_vertex(LaplacianSystem *sys, float *co, int pinned);
+void laplacian_add_triangle(LaplacianSystem *sys, int v1, int v2, int v3);
+
+void laplacian_construct_end(LaplacianSystem *sys);
+void laplacian_delete(LaplacianSystem *sys);
+
+void laplacian_begin_solve(LaplacianSystem *sys, int index);
+void laplacian_add_right_hand_side(LaplacianSystem *sys, int v, float value);
+int laplacian_system_solve(LaplacianSystem *sys);
+float laplacian_system_get_solution(int v);
+
+/* Heat Weighting */
+
+void heat_bone_weighting(struct Object *ob, struct Mesh *me, float (*verts)[3],
+ int numbones, struct bDeformGroup **dgrouplist,
+ struct bDeformGroup **dgroupflip, float (*root)[3], float (*tip)[3],
+ int *selected);
+
+#ifdef RIGID_DEFORM
+/* As-Rigid-As-Possible Deformation */
+
+void rigid_deform_begin(struct EditMesh *em);
+void rigid_deform_iteration(void);
+void rigid_deform_end(int cancel);
+#endif
+
+/* Harmonic Coordinates */
+
+void harmonic_coordinates_bind(struct MeshDeformModifierData *mmd,
+ float (*vertexcos)[3], int totvert, float cagemat[][4]);
+
+#endif
+
diff --git a/source/blender/python/api2_2x/Font.h b/source/blender/editors/include/BIF_meshtools.h
index 75867c5b6e7..17bbb2393ef 100644
--- a/source/blender/python/api2_2x/Font.h
+++ b/source/blender/editors/include/BIF_meshtools.h
@@ -1,5 +1,5 @@
-/*
- * $Id: Font.h 10269 2007-03-15 01:09:14Z campbellbarton $
+/**
+ * $Id:
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
@@ -23,31 +23,29 @@
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
- * This is a new part of Blender.
+ * The Original Code is: all of this file.
*
- * Contributor(s): Joilnen Leite
+ * Contributor(s): none yet.
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
+ */
-#ifndef EXPP_FONT_H
-#define EXPP_FONT_H
+#ifndef BIF_MESHTOOLS_H
+#define BIF_MESHTOOLS_H
-#include <Python.h>
-#include "DNA_vfont_types.h"
+struct Object;
+struct EditVert;
-extern PyTypeObject Font_Type;
+extern int join_mesh(void);
-typedef struct {
- PyObject_HEAD /* required py macro */
- VFont * font; /* libdata must be second */
-} BPy_Font;
+extern void sort_faces(void);
+extern void objects_bake_render_menu(void);
+extern void objects_bake_render(short event);
-/*------------------------------visible prototypes----------------------*/
-PyObject *Font_CreatePyObject( struct VFont * font );
-struct VFont *Font_FromPyObject( PyObject * py_obj );
-PyObject *Font_Init( void );
+extern long mesh_octree_table(struct Object *ob, float *co, char mode);
+extern int mesh_get_x_mirror_vert(struct Object *ob, int index);
+extern struct EditVert *editmesh_get_x_mirror_vert(struct Object *ob, float *co);
+extern int *mesh_get_x_mirror_faces(struct Object *ob);
#endif
-
diff --git a/source/blender/editors/include/BIF_mywindow.h b/source/blender/editors/include/BIF_mywindow.h
new file mode 100644
index 00000000000..56976edaba0
--- /dev/null
+++ b/source/blender/editors/include/BIF_mywindow.h
@@ -0,0 +1,145 @@
+
+/**
+ * $Id: BIF_mywindow.h 10466 2007-04-05 12:42:07Z broken $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ * These are the protos for mywindow.c -- an emulation of the
+ * (obsolete) IrisGL command set
+ */
+
+#ifndef BIF_MYWINDOW_H
+#define BIF_MYWINDOW_H
+
+struct rcti;
+
+/*---*/
+
+typedef struct BWinEvent {
+ unsigned short event;
+ short val;
+ char ascii;
+} BWinEvent;
+
+/*---*/
+
+int mywinget(void);
+void mywinclose(int winid);
+void mywinposition(int winid,
+ int xmin, int xmax,
+ int ymin, int ymax);
+/*---*/
+
+ /** Test if there are events available on a BWin queue.
+ *
+ * @param winid The ID of the window to query.
+ * @return True if there is an event available for _qread'ing.
+ */
+int bwin_qtest(int winid);
+
+ /** Read an event off of the BWin queue (if available).
+ *
+ * @param winid The ID of the window to read from.
+ * @param event_r A pointer to return the event in.
+ * @return True if an event was read and @a event_r filled.
+ */
+int bwin_qread(int winid, BWinEvent *event_r);
+
+ /** Add an event to the BWin queue.
+ *
+ * @param winid The ID of the window to add to.
+ * @param event A pointer to copy the event from.
+ */
+void bwin_qadd(int winid, BWinEvent *event);
+
+/*---*/
+
+void bwin_load_viewmatrix(int winid, float mat[][4]);
+void bwin_load_winmatrix(int winid, float mat[][4]);
+
+void bwin_get_viewmatrix(int winid, float mat[][4]);
+void bwin_get_winmatrix(int winid, float mat[][4]);
+
+void bwin_multmatrix(int winid, float mat[][4]);
+void bwin_scalematrix(int winid, float x, float y, float z);
+
+void bwin_ortho(int winid, float x1, float x2, float y1, float y2, float n, float f);
+void bwin_ortho2(int win, float x1, float x2, float y1, float y2);
+void bwin_frustum(int winid, float x1, float x2, float y1, float y2, float n, float f);
+
+void bwin_getsize(int winid, int *x, int *y);
+void bwin_getsuborigin(int winid, int *x, int *y);
+void bwin_get_rect(int winid, struct rcti *rect_r);
+void bwin_getsinglematrix(int winid, float mat[][4]);
+void bwin_clear_viewmat(int winid);
+
+int myswinopen(int parentid, int xmin, int xmax, int ymin, int ymax);
+int myswinopen_allowed(void);
+void myswapbuffers(void);
+
+void mygetmatrix(float mat[][4]);
+void mymultmatrix(float [][4]);
+
+void myloadmatrix(float mat[][4]);
+void mywinset(int wid);
+void myortho(float x1, float x2, float y1, float y2, float n, float f);
+void myortho2(float x1, float x2, float y1, float y2);
+void mywindow(float x1, float x2, float y1, float y2, float n, float f);
+void mygetsingmatrix(float (*)[4]);
+
+void setlinestyle(int nr);
+
+void BIF_wait_for_statechange(void);
+
+#define L_MOUSE 1
+#define M_MOUSE 2
+#define R_MOUSE 4
+short get_mbut(void);
+short get_qual(void);
+void getmouse(short *mval);
+
+float get_pressure(void);
+void get_tilt(float *xtilt, float *ytilt);
+#define DEV_MOUSE 0
+#define DEV_STYLUS 1
+#define DEV_ERASER 2
+short get_activedevice(void);
+
+void warp_pointer(int x, int y);
+
+int framebuffer_to_index(unsigned int col);
+void set_framebuffer_index_color(int index);
+
+int mywin_inmenu(void);
+void mywin_getmenu_rect(int *x, int *y, int *sx, int *sy);
+
+void my_put_frontbuffer_image(void);
+void my_get_frontbuffer_image(int x, int y, int sx, int sy);
+
+#endif
+
diff --git a/source/blender/editors/include/BIF_oops.h b/source/blender/editors/include/BIF_oops.h
new file mode 100644
index 00000000000..4de725f3021
--- /dev/null
+++ b/source/blender/editors/include/BIF_oops.h
@@ -0,0 +1,71 @@
+/**
+ * $Id: BIF_oops.h 3919 2005-03-09 19:45:59Z lukep $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_OOPS_H
+#define BIF_OOPS_H
+
+struct Curve;
+struct Oops;
+struct OopsLink;
+struct SpaceOops;
+struct Material;
+struct Mesh;
+struct MetaBall;
+struct Object;
+struct Lamp;
+void add_curve_oopslinks(struct Curve *cu, struct Oops *oops, short flag);
+void add_from_link(struct Oops *from, struct Oops *oops);
+void add_material_oopslinks(struct Material *ma, struct Oops *oops, short flag);
+void add_mball_oopslinks(struct MetaBall *mb, struct Oops *oops, short flag);
+void add_mesh_oopslinks(struct Mesh *me, struct Oops *oops, short flag);
+void add_object_oopslinks(struct Object *ob, struct Oops *oops, short flag);
+void add_lamp_oopslinks(struct Lamp *la, struct Oops *oops, short flag);
+struct Oops *add_oops(void *id);
+struct OopsLink *add_oopslink(char *name, struct Oops *oops, short type, void *from, float xof, float yof);
+struct Oops *add_test_oops(void *id); /* incl links */
+void add_texture_oops(struct Material *ma);
+void build_oops(void);
+struct Oops *find_oops(ID *id);
+void free_oops(struct Oops *oops); /* ook oops zelf */
+void free_oopspace(struct SpaceOops *so);
+void new_oops_location(struct Oops *);
+int oops_test_overlap(struct Oops *test);
+int oops_test_overlaphide(struct Oops *test);
+float oopslink_totlen(struct Oops *oops);
+void shrink_oops(void);
+void shuffle_oops(void);
+int test_oops(struct Oops *oops);
+void test_oopslink(struct OopsLink *ol);
+void test_oopslinko(struct OopsLink *ol);
+
+#endif
+
diff --git a/source/blender/editors/include/BIF_outliner.h b/source/blender/editors/include/BIF_outliner.h
new file mode 100644
index 00000000000..34ed7950421
--- /dev/null
+++ b/source/blender/editors/include/BIF_outliner.h
@@ -0,0 +1,106 @@
+/**
+ * $Id: BIF_outliner.h
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2004 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_OUTLINER_H
+#define BIF_OUTLINER_H
+
+struct TreeStoreElem;
+
+typedef struct TreeElement {
+ struct TreeElement *next, *prev, *parent;
+ ListBase subtree;
+ float xs, ys; // do selection
+ int store_index; // offset in tree store
+ short flag, index; // flag for non-saved stuff, index for data arrays
+ short idcode; // from TreeStore id
+ short xend; // width of item display, for select
+ char *name;
+ void *directdata; // Armature Bones, Base, ...
+} TreeElement;
+
+/* TreeElement->flag */
+#define TE_ACTIVE 1
+#define TE_ICONROW 2
+
+/* TreeStoreElem types */
+#define TSE_NLA 1
+#define TSE_NLA_ACTION 2
+#define TSE_DEFGROUP_BASE 3
+#define TSE_DEFGROUP 4
+#define TSE_BONE 5
+#define TSE_EBONE 6
+#define TSE_CONSTRAINT_BASE 7
+#define TSE_CONSTRAINT 8
+#define TSE_MODIFIER_BASE 9
+#define TSE_MODIFIER 10
+#define TSE_LINKED_OB 11
+#define TSE_SCRIPT_BASE 12
+#define TSE_POSE_BASE 13
+#define TSE_POSE_CHANNEL 14
+/*#ifdef WITH_VERSE*/
+#define TSE_VERSE_SESSION 15
+#define TSE_VERSE_OBJ_NODE 16
+#define TSE_VERSE_GEOM_NODE 17
+/*#endif*/
+#define TSE_PROXY 18
+#define TSE_R_LAYER_BASE 19
+#define TSE_R_LAYER 20
+#define TSE_R_PASS 21
+#define TSE_LINKED_MAT 22
+ /* NOTE, is used for light group */
+#define TSE_LINKED_LAMP 23
+
+/* outliner search flags */
+#define OL_FIND 0
+#define OL_FIND_CASE 1
+#define OL_FIND_COMPLETE 2
+#define OL_FIND_COMPLETE_CASE 3
+
+/* button events */
+#define OL_NAMEBUTTON 1
+
+extern void draw_outliner(struct ScrArea *sa, struct SpaceOops *so);
+extern void outliner_free_tree(struct ListBase *lb);
+extern void outliner_mouse_event(struct ScrArea *sa, short event);
+extern void outliner_toggle_visible(struct ScrArea *sa);
+extern void outliner_show_active(struct ScrArea *sa);
+extern void outliner_show_hierarchy(struct ScrArea *sa);
+extern void outliner_one_level(struct ScrArea *sa, int add);
+extern void outliner_select(struct ScrArea *sa);
+extern void outliner_toggle_selected(struct ScrArea *sa);
+extern void outliner_del(struct ScrArea *sa);
+extern void outliner_operation_menu(struct ScrArea *sa);
+extern void outliner_page_up_down(struct ScrArea *sa, int up);
+extern void outliner_find_panel(struct ScrArea *sa, int again, int flags);
+
+#endif
+
diff --git a/source/blender/editors/include/BIF_poseobject.h b/source/blender/editors/include/BIF_poseobject.h
new file mode 100644
index 00000000000..b427646bffe
--- /dev/null
+++ b/source/blender/editors/include/BIF_poseobject.h
@@ -0,0 +1,71 @@
+/**
+ * $Id: BIF_poseobject.h 11403 2007-07-28 14:04:02Z blendix $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_POSEOBJECT
+#define BIF_POSEOBJECT
+
+
+struct Object;
+struct bPoseChannel;
+
+void enter_posemode(void);
+void exit_posemode(void);
+
+ // sets chan->flag to POSE_KEY if bone selected
+void set_pose_keys(struct Object *ob);
+
+struct bPoseChannel *get_active_posechannel (struct Object *ob);
+int pose_channel_in_IK_chain(struct Object *ob, struct bPoseChannel *pchan);
+
+/* tools */
+void pose_select_constraint_target(void);
+void pose_special_editmenu(void);
+void pose_add_IK(void);
+void pose_clear_IK(void);
+void pose_clear_constraints(void);
+void pose_copy_menu(void);
+
+void free_posebuf(void);
+void copy_posebuf (void);
+void paste_posebuf (int flip);
+
+void pose_adds_vgroups(struct Object *meshobj, int heatweights);
+
+void pose_calculate_path(struct Object *ob);
+void pose_clear_paths(struct Object *ob);
+
+void pose_flip_names(void);
+void pose_activate_flipped_bone(void);
+void pose_movetolayer(void);
+
+#endif
+
diff --git a/source/blender/editors/include/BIF_previewrender.h b/source/blender/editors/include/BIF_previewrender.h
new file mode 100644
index 00000000000..0482ee29ebc
--- /dev/null
+++ b/source/blender/editors/include/BIF_previewrender.h
@@ -0,0 +1,94 @@
+/**
+ * $Id: BIF_previewrender.h 8761 2006-11-06 01:08:26Z nicholasbishop $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_PREVIEWRENDER_H
+#define BIF_PREVIEWRENDER_H
+
+#include "DNA_vec_types.h"
+
+struct View3D;
+struct SpaceButs;
+struct RenderInfo;
+struct Image;
+struct ScrArea;
+struct uiBlock;
+struct Render;
+
+#define PREVIEW_RENDERSIZE 140
+
+typedef void (*VectorDrawFunc)(int x, int y, int w, int h, float alpha);
+
+/* stores rendered preview - is also used for icons */
+typedef struct RenderInfo {
+ int pr_rectx;
+ int pr_recty;
+ short curtile, tottile, status;
+ rcti disprect; /* storage for view3d preview rect */
+ unsigned int* rect;
+ struct Render *re; /* persistant render */
+} RenderInfo;
+
+/* ri->status */
+#define PR_DBASE 1
+#define PR_DISPRECT 2
+#define PR_PROJECTED 4
+#define PR_ROTATED 8
+
+/* Render the preview
+
+pr_method:
+- PR_DRAW_RENDER: preview is rendered and drawn, as indicated by called context (buttons panel)
+- PR_ICON_RENDER: the preview is not drawn and the function is not dynamic,
+ so no events are processed. Hopefully fast enough for at least 32x32
+- PR_DO_RENDER: preview is rendered, not drawn, but events are processed for afterqueue,
+ in use for node editor now.
+*/
+
+#define PR_DRAW_RENDER 0
+#define PR_ICON_RENDER 1
+#define PR_DO_RENDER 2
+
+void BIF_previewrender (struct ID *id, struct RenderInfo *ri, struct ScrArea *area, int pr_method);
+void BIF_previewrender_buts (struct SpaceButs *sbuts);
+void BIF_previewdraw (struct ScrArea *sa, struct uiBlock *block);
+void BIF_preview_changed (short id_code);
+
+void BIF_preview_init_dbase (void);
+void BIF_preview_free_dbase (void);
+
+void BIF_view3d_previewrender(struct ScrArea *sa);
+void BIF_view3d_previewdraw (struct ScrArea *sa, struct uiBlock *block);
+void BIF_view3d_previewrender_free(struct View3D *v3d);
+void BIF_view3d_previewrender_clear(struct ScrArea *sa);
+void BIF_view3d_previewrender_signal(struct ScrArea *sa, short signal);
+
+#endif
diff --git a/source/blender/editors/include/BIF_renderwin.h b/source/blender/editors/include/BIF_renderwin.h
new file mode 100644
index 00000000000..f73ce53f8dc
--- /dev/null
+++ b/source/blender/editors/include/BIF_renderwin.h
@@ -0,0 +1,67 @@
+/**
+ * $Id: BIF_renderwin.h 9376 2006-12-20 17:57:56Z ton $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+struct Render;
+struct ScrArea;
+struct RenderStats;
+
+void calc_renderwin_rectangle(int rectx, int recty, int posmask, int renderpos_r[2], int rendersize_r[2]);
+
+void BIF_close_render_display(void);
+
+void BIF_do_render(int anim);
+
+/**
+ * @param v3d The View3D space to render.
+ */
+void BIF_do_ogl_render(struct View3D *v3d, int anim);
+
+void BIF_renderwin_set_for_ogl_render(void);
+void BIF_renderwin_set_custom_cursor(unsigned char mask[16][2], unsigned char bitmap[16][2]);
+
+void BIF_redraw_render_rect(void);
+void BIF_swap_render_rects(void);
+void BIF_store_spare(void);
+void BIF_toggle_render_display(void);
+
+void BIF_init_render_callbacks(struct Render *re, int do_display);
+void BIF_end_render_callbacks(void);
+
+/* should not be here, ~WIP~ */
+void make_renderinfo_string(struct RenderStats *rs, char *str);
+
+/* space for info text */
+#define RW_HEADERY 18
+
+/* header print for window */
+#define RW_MAXTEXT 512
+
diff --git a/source/blender/editors/include/BIF_resources.h b/source/blender/editors/include/BIF_resources.h
new file mode 100644
index 00000000000..96d4cb58f53
--- /dev/null
+++ b/source/blender/editors/include/BIF_resources.h
@@ -0,0 +1,600 @@
+/**
+ * $Id: BIF_resources.h 12755 2007-12-02 05:50:38Z aligorith $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_RESOURCES_H
+#define BIF_RESOURCES_H
+
+/* elubie: TODO: move the typedef for icons to BIF_interface_icons.h */
+/* and add/replace include of BIF_resources.h by BIF_interface_icons.h */
+typedef enum {
+#define BIFICONID_FIRST (ICON_VIEW3D)
+ ICON_VIEW3D,
+ ICON_IPO,
+ ICON_OOPS,
+ ICON_BUTS,
+ ICON_FILESEL,
+ ICON_IMAGE_COL,
+ ICON_INFO,
+ ICON_SEQUENCE,
+ ICON_TEXT,
+ ICON_IMASEL,
+ ICON_SOUND,
+ ICON_ACTION,
+ ICON_NLA,
+ ICON_SCRIPTWIN,
+ ICON_TIME,
+ ICON_NODE,
+ ICON_SPACE2,
+ ICON_SPACE3,
+ ICON_SPACE4,
+ ICON_TRIA_LEFT,
+ ICON_TRIA_UP,
+ ICON_FONTPREVIEW,
+ ICON_BLANK4,
+ ICON_BLANK5,
+ ICON_BLANK6,
+
+ ICON_ORTHO,
+ ICON_PERSP,
+ ICON_CAMERA,
+ ICON_PARTICLES,
+ ICON_BBOX,
+ ICON_WIRE,
+ ICON_SOLID,
+ ICON_SMOOTH,
+ ICON_POTATO,
+ ICON_MARKER_HLT,
+ ICON_NORMALVIEW,
+ ICON_LOCALVIEW,
+ ICON_UNUSEDVIEW,
+ ICON_VIEWZOOM,
+ ICON_SORTALPHA,
+ ICON_SORTTIME,
+ ICON_SORTSIZE,
+ ICON_LONGDISPLAY,
+ ICON_SHORTDISPLAY,
+ ICON_TRIA_DOWN,
+ ICON_TRIA_RIGHT,
+ ICON_BLANK7,
+ ICON_BLANK8,
+ ICON_BLANK9,
+ ICON_BLANK10,
+
+ ICON_VIEW_AXIS_ALL,
+ ICON_VIEW_AXIS_NONE,
+ ICON_VIEW_AXIS_NONE2,
+ ICON_VIEW_AXIS_TOP,
+ ICON_VIEW_AXIS_FRONT,
+ ICON_VIEW_AXIS_SIDE,
+ ICON_POSE_DEHLT,
+ ICON_POSE_HLT,
+ ICON_BORDERMOVE,
+ ICON_MAYBE_ITS_A_LASSO,
+ ICON_BLANK1, /* ATTENTION, someone decided to use this throughout blender
+ and didn't care to neither rename it nor update the PNG */
+ ICON_VERSE,
+ ICON_MOD_BOOLEAN,
+ ICON_ARMATURE,
+ ICON_PAUSE,
+ ICON_ALIGN,
+ ICON_REC,
+ ICON_PLAY,
+ ICON_FF,
+ ICON_REW,
+ ICON_PYTHON,
+ ICON_BLANK11,
+ ICON_BLANK12,
+ ICON_BLANK13,
+ ICON_BLANK14,
+
+
+ ICON_DOTSUP,
+ ICON_DOTSDOWN,
+ ICON_MENU_PANEL,
+ ICON_AXIS_SIDE,
+ ICON_AXIS_FRONT,
+ ICON_AXIS_TOP,
+ ICON_STICKY_UVS_LOC,
+ ICON_STICKY_UVS_DISABLE,
+ ICON_STICKY_UVS_VERT,
+ ICON_PREV_KEYFRAME,
+ ICON_NEXT_KEYFRAME,
+ ICON_ENVMAP,
+ ICON_TRANSP_HLT,
+ ICON_TRANSP_DEHLT,
+ ICON_CIRCLE_DEHLT,
+ ICON_CIRCLE_HLT,
+ ICON_TPAINT_DEHLT,
+ ICON_TPAINT_HLT,
+ ICON_WPAINT_DEHLT,
+ ICON_WPAINT_HLT,
+ ICON_MARKER,
+ ICON_BLANK15,
+ ICON_BLANK16,
+ ICON_BLANK17,
+ ICON_BLANK18,
+
+ ICON_X,
+ ICON_GO_LEFT,
+ ICON_NO_GO_LEFT,
+ ICON_UNLOCKED,
+ ICON_LOCKED,
+ ICON_PARLIB,
+ ICON_DATALIB,
+ ICON_AUTO,
+ ICON_MATERIAL_DEHLT2,
+ ICON_RING,
+ ICON_GRID,
+ ICON_PROPEDIT,
+ ICON_KEEPRECT,
+ ICON_DESEL_CUBE_VERTS,
+ ICON_EDITMODE_DEHLT,
+ ICON_EDITMODE_HLT,
+ ICON_VPAINT_DEHLT,
+ ICON_VPAINT_HLT,
+ ICON_FACESEL_DEHLT,
+ ICON_FACESEL_HLT,
+ ICON_EDIT_DEHLT,
+ ICON_BOOKMARKS,
+ ICON_BLANK20,
+ ICON_BLANK21,
+ ICON_BLANK22,
+
+ ICON_HELP,
+ ICON_ERROR,
+ ICON_FOLDER_DEHLT,
+ ICON_FOLDER_HLT,
+ ICON_BLUEIMAGE_DEHLT,
+ ICON_BLUEIMAGE_HLT,
+ ICON_BPIBFOLDER_DEHLT,
+ ICON_BPIBFOLDER_HLT,
+ ICON_BPIBFOLDER_ERR,
+ ICON_UGLY_GREEN_RING,
+ ICON_GHOST,
+ ICON_SORTBYEXT,
+ ICON_SCULPTMODE_HLT,
+ ICON_VERTEXSEL,
+ ICON_EDGESEL,
+ ICON_FACESEL,
+ ICON_PLUS,
+ ICON_BPIBFOLDER_X,
+ ICON_BPIBFOLDERGREY,
+ ICON_MAGNIFY,
+ ICON_INFO2,
+ ICON_BLANK23,
+ ICON_BLANK24,
+ ICON_BLANK25,
+ ICON_BLANK26,
+
+ ICON_RIGHTARROW,
+ ICON_DOWNARROW_HLT,
+ ICON_ROUNDBEVELTHING,
+ ICON_FULLTEXTURE,
+ ICON_HOOK,
+ ICON_DOT,
+ ICON_WORLD_DEHLT,
+ ICON_CHECKBOX_DEHLT,
+ ICON_CHECKBOX_HLT,
+ ICON_LINK,
+ ICON_INLINK,
+ ICON_ZOOMIN,
+ ICON_ZOOMOUT,
+ ICON_PASTEDOWN,
+ ICON_COPYDOWN,
+ ICON_CONSTANT,
+ ICON_LINEAR,
+ ICON_CYCLIC,
+ ICON_KEY_DEHLT,
+ ICON_KEY_HLT,
+ ICON_GRID2,
+ ICON_BLANK27,
+ ICON_BLANK28,
+ ICON_BLANK29,
+ ICON_BLANK30,
+
+ ICON_EYE,
+ ICON_LAMP,
+ ICON_MATERIAL,
+ ICON_TEXTURE,
+ ICON_ANIM,
+ ICON_WORLD,
+ ICON_SCENE,
+ ICON_EDIT,
+ ICON_GAME,
+ ICON_PAINT,
+ ICON_RADIO,
+ ICON_SCRIPT,
+ ICON_SPEAKER,
+ ICON_PASTEUP,
+ ICON_COPYUP,
+ ICON_PASTEFLIPUP,
+ ICON_PASTEFLIPDOWN,
+ ICON_CYCLICLINEAR,
+ ICON_PIN_DEHLT,
+ ICON_PIN_HLT,
+ ICON_LITTLEGRID,
+ ICON_BLANK31,
+ ICON_BLANK32,
+ ICON_BLANK33,
+ ICON_BLANK34,
+
+ ICON_FULLSCREEN,
+ ICON_SPLITSCREEN,
+ ICON_RIGHTARROW_THIN,
+ ICON_DISCLOSURE_TRI_RIGHT,
+ ICON_DISCLOSURE_TRI_DOWN,
+ ICON_SCENE_SEPIA,
+ ICON_SCENE_DEHLT,
+ ICON_OBJECT,
+ ICON_MESH,
+ ICON_CURVE,
+ ICON_MBALL,
+ ICON_LATTICE,
+ ICON_LAMP_DEHLT,
+ ICON_MATERIAL_DEHLT,
+ ICON_TEXTURE_DEHLT,
+ ICON_IPO_DEHLT,
+ ICON_LIBRARY_DEHLT,
+ ICON_IMAGE_DEHLT,
+ ICON_EYEDROPPER,
+ ICON_WINDOW_WINDOW,
+ ICON_PANEL_CLOSE,
+ ICON_PHYSICS,
+ ICON_BLANK36,
+ ICON_BLANK37,
+ ICON_BLANK38,
+
+ ICON_BLENDER,
+ ICON_PACKAGE,
+ ICON_UGLYPACKAGE,
+ ICON_MATPLANE,
+ ICON_MATSPHERE,
+ ICON_MATCUBE,
+ ICON_SCENE_HLT,
+ ICON_OBJECT_HLT,
+ ICON_MESH_HLT,
+ ICON_CURVE_HLT,
+ ICON_MBALL_HLT,
+ ICON_LATTICE_HLT,
+ ICON_LAMP_HLT,
+ ICON_MATERIAL_HLT,
+ ICON_TEXTURE_HLT,
+ ICON_IPO_HLT,
+ ICON_LIBRARY_HLT,
+ ICON_IMAGE_HLT,
+ ICON_CONSTRAINT,
+ ICON_CAMERA_DEHLT,
+ ICON_ARMATURE_DEHLT,
+ ICON_SNAP_GEAR,
+ ICON_SNAP_GEO,
+ ICON_BLANK41,
+ ICON_BLANK42,
+
+ ICON_SMOOTHCURVE,
+ ICON_SPHERECURVE,
+ ICON_ROOTCURVE,
+ ICON_SHARPCURVE,
+ ICON_LINCURVE,
+ ICON_NOCURVE,
+ ICON_RNDCURVE,
+ ICON_PROP_OFF,
+ ICON_PROP_ON,
+ ICON_PROP_CON,
+ ICON_SYNTAX,
+ ICON_SYNTAX_OFF,
+ ICON_MONKEY,
+ ICON_HAIR,
+ ICON_VIEWMOVE,
+ ICON_HOME,
+ ICON_CLIPUV_DEHLT,
+ ICON_CLIPUV_HLT,
+ ICON_BLANK2,
+ ICON_BLANK3,
+ ICON_VPAINT_COL,
+ ICON_RESTRICT_SELECT_OFF,
+ ICON_RESTRICT_SELECT_ON,
+ ICON_MUTE_IPO_OFF,
+ ICON_MUTE_IPO_ON,
+
+ ICON_MAN_TRANS,
+ ICON_MAN_ROT,
+ ICON_MAN_SCALE,
+ ICON_MANIPUL,
+ ICON_BLANK_47,
+ ICON_MODIFIER,
+ ICON_MOD_WAVE,
+ ICON_MOD_BUILD,
+ ICON_MOD_DECIM,
+ ICON_MOD_MIRROR,
+ ICON_MOD_SOFT,
+ ICON_MOD_SUBSURF,
+ ICON_SEQ_SEQUENCER,
+ ICON_SEQ_PREVIEW,
+ ICON_SEQ_LUMA_WAVEFORM,
+ ICON_SEQ_CHROMA_SCOPE,
+ ICON_ROTATE,
+ ICON_CURSOR,
+ ICON_ROTATECOLLECTION,
+ ICON_ROTATECENTER,
+ ICON_ROTACTIVE,
+ ICON_RESTRICT_VIEW_OFF,
+ ICON_RESTRICT_VIEW_ON,
+ ICON_RESTRICT_RENDER_OFF,
+ ICON_RESTRICT_RENDER_ON,
+
+ VICON_VIEW3D,
+ VICON_EDIT,
+ VICON_EDITMODE_DEHLT,
+ VICON_EDITMODE_HLT,
+ VICON_DISCLOSURE_TRI_RIGHT,
+ VICON_DISCLOSURE_TRI_DOWN,
+ VICON_MOVE_UP,
+ VICON_MOVE_DOWN,
+ VICON_X
+
+#define BIFICONID_LAST (VICON_X)
+#define BIFNICONIDS (BIFICONID_LAST-BIFICONID_FIRST + 1)
+} BIFIconID;
+
+typedef enum {
+#define BIFCOLORSHADE_FIRST (COLORSHADE_DARK)
+ COLORSHADE_DARK,
+ COLORSHADE_GREY,
+ COLORSHADE_MEDIUM,
+ COLORSHADE_HILITE,
+ COLORSHADE_LIGHT,
+ COLORSHADE_WHITE
+#define BIFCOLORSHADE_LAST (COLORSHADE_WHITE)
+#define BIFNCOLORSHADES (BIFCOLORSHADE_LAST-BIFCOLORSHADE_FIRST + 1)
+} BIFColorShade;
+
+typedef enum {
+#define BIFCOLORID_FIRST (BUTGREY)
+ BUTGREY = 0,
+ BUTGREEN,
+ BUTBLUE,
+ BUTSALMON,
+ MIDGREY,
+ BUTPURPLE,
+ BUTYELLOW,
+ REDALERT,
+ BUTRUST,
+ BUTWHITE,
+ BUTDBLUE,
+ BUTPINK,
+ BUTDPINK,
+ BUTMACTIVE,
+
+ BUTIPO,
+ BUTAUDIO,
+ BUTCAMERA,
+ BUTRANDOM,
+ BUTEDITOBJECT,
+ BUTPROPERTY,
+ BUTSCENE,
+ BUTMOTION,
+ BUTMESSAGE,
+ BUTACTION,
+ BUTCD,
+ BUTGAME,
+ BUTVISIBILITY,
+ BUTYUCK,
+ BUTSEASICK,
+ BUTCHOKE,
+ BUTIMPERIAL,
+
+ BUTTEXTCOLOR,
+ BUTTEXTPRESSED,
+ BUTSBACKGROUND,
+
+ VIEWPORTBACKCOLOR,
+ VIEWPORTGRIDCOLOR,
+ VIEWPORTACTIVECOLOR,
+ VIEWPORTSELECTEDCOLOR,
+ VIEWPORTUNSELCOLOR,
+
+ EDITVERTSEL,
+ EDITVERTUNSEL,
+ EDITEDGESEL,
+ EDITEDGEUNSEL
+
+#define BIFCOLORID_LAST (EDITEDGEUNSEL)
+#define BIFNCOLORIDS (BIFCOLORID_LAST-BIFCOLORID_FIRST + 1)
+
+} BIFColorID;
+
+/* XXX WARNING: this is saved in file, so do not change order! */
+enum {
+ TH_AUTO, /* for buttons, to signal automatic color assignment */
+
+// uibutton colors
+ TH_BUT_OUTLINE,
+ TH_BUT_NEUTRAL,
+ TH_BUT_ACTION,
+ TH_BUT_SETTING,
+ TH_BUT_SETTING1,
+ TH_BUT_SETTING2,
+ TH_BUT_NUM,
+ TH_BUT_TEXTFIELD,
+ TH_BUT_POPUP,
+ TH_BUT_TEXT,
+ TH_BUT_TEXT_HI,
+ TH_MENU_BACK,
+ TH_MENU_ITEM,
+ TH_MENU_HILITE,
+ TH_MENU_TEXT,
+ TH_MENU_TEXT_HI,
+
+ TH_BUT_DRAWTYPE,
+
+ TH_REDALERT,
+ TH_CUSTOM,
+
+ TH_BUT_TEXTFIELD_HI,
+ TH_ICONFILE,
+
+ TH_THEMEUI,
+// common colors among spaces
+
+ TH_BACK,
+ TH_TEXT,
+ TH_TEXT_HI,
+ TH_HEADER,
+ TH_HEADERDESEL,
+ TH_PANEL,
+ TH_SHADE1,
+ TH_SHADE2,
+ TH_HILITE,
+
+ TH_GRID,
+ TH_WIRE,
+ TH_SELECT,
+ TH_ACTIVE,
+ TH_GROUP,
+ TH_GROUP_ACTIVE,
+ TH_TRANSFORM,
+ TH_VERTEX,
+ TH_VERTEX_SELECT,
+ TH_VERTEX_SIZE,
+ TH_EDGE,
+ TH_EDGE_SELECT,
+ TH_EDGE_SEAM,
+ TH_EDGE_FACESEL,
+ TH_FACE,
+ TH_FACE_SELECT,
+ TH_NORMAL,
+ TH_FACE_DOT,
+ TH_FACEDOT_SIZE,
+ TH_CFRAME,
+
+ TH_SYNTAX_B,
+ TH_SYNTAX_V,
+ TH_SYNTAX_C,
+ TH_SYNTAX_L,
+ TH_SYNTAX_N,
+
+ TH_BONE_SOLID,
+ TH_BONE_POSE,
+
+ TH_STRIP,
+ TH_STRIP_SELECT,
+
+ TH_LAMP,
+
+ TH_NODE,
+ TH_NODE_IN_OUT,
+ TH_NODE_OPERATOR,
+ TH_NODE_CONVERTOR,
+ TH_NODE_GROUP,
+
+ TH_SEQ_MOVIE,
+ TH_SEQ_IMAGE,
+ TH_SEQ_SCENE,
+ TH_SEQ_AUDIO,
+ TH_SEQ_EFFECT,
+ TH_SEQ_PLUGIN,
+ TH_SEQ_TRANSITION,
+ TH_SEQ_META,
+
+ TH_EDGE_SHARP,
+ TH_EDITMESH_ACTIVE,
+};
+/* XXX WARNING: previous is saved in file, so do not change order! */
+
+/* theme drawtypes */
+#define TH_MINIMAL 0
+#define TH_SHADED 1
+#define TH_ROUNDED 2
+#define TH_OLDSKOOL 3
+
+/* specific defines per space should have higher define values */
+
+struct bTheme;
+
+// THE CODERS API FOR THEMES:
+
+// sets the color
+void BIF_ThemeColor(int colorid);
+
+// sets the color plus alpha
+void BIF_ThemeColor4(int colorid);
+
+// sets color plus offset for shade
+void BIF_ThemeColorShade(int colorid, int offset);
+
+// sets color plus offset for alpha
+void BIF_ThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset);
+
+// sets color, which is blend between two theme colors
+void BIF_ThemeColorBlend(int colorid1, int colorid2, float fac);
+// same, with shade offset
+void BIF_ThemeColorBlendShade(int colorid1, int colorid2, float fac, int offset);
+
+// returns one value, not scaled
+float BIF_GetThemeValuef(int colorid);
+int BIF_GetThemeValue(int colorid);
+
+// get three color values, scaled to 0.0-1.0 range
+void BIF_GetThemeColor3fv(int colorid, float *col);
+
+// get the 3 or 4 byte values
+void BIF_GetThemeColor3ubv(int colorid, char *col);
+void BIF_GetThemeColor4ubv(int colorid, char *col);
+
+// get a theme color from specified space type
+void BIF_GetThemeColorType4ubv(int colorid, int spacetype, char *col);
+
+// blends and shades between two color pointers
+void BIF_ColorPtrBlendShade3ubv(char *cp1, char *cp2, float fac, int offset);
+
+// get a 3 byte color, blended and shaded between two other char color pointers
+void BIF_GetColorPtrBlendShade3ubv(char *cp1, char *cp2, char *col, float fac, int offset);
+
+
+struct ScrArea;
+
+// internal (blender) usage only, for init and set active
+void BIF_InitTheme(void);
+void BIF_SetTheme(struct ScrArea *sa);
+void BIF_resources_init (void);
+void BIF_resources_free (void);
+void BIF_colors_init (void);
+void BIF_load_ui_colors (void);
+
+/* only for buttons in theme editor! */
+char *BIF_ThemeGetColorPtr(struct bTheme *btheme, int spacetype, int colorid);
+char *BIF_ThemeColorsPup(int spacetype);
+
+
+void BIF_def_color (BIFColorID colorid, unsigned char r, unsigned char g, unsigned char b);
+
+#endif /* BIF_ICONS_H */
diff --git a/source/blender/editors/include/BIF_retopo.h b/source/blender/editors/include/BIF_retopo.h
new file mode 100644
index 00000000000..5cf9b512fc5
--- /dev/null
+++ b/source/blender/editors/include/BIF_retopo.h
@@ -0,0 +1,110 @@
+/*
+ * $Id: BIF_retopo.h 9804 2007-01-17 03:57:01Z nicholasbishop $
+ *
+ * ***** 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2006 by Nicholas Bishop
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_RETOPO_H
+#define BIF_RETOPO_H
+
+#include "DNA_vec_types.h"
+
+/* For bglMats */
+#include "BIF_glutil.h"
+
+struct EditVert;
+struct Mesh;
+struct View3D;
+
+typedef struct RetopoViewData {
+ bglMats mats;
+
+ char queue_matrix_update;
+} RetopoViewData;
+
+typedef struct RetopoPaintPoint {
+ struct RetopoPaintPoint *next, *prev;
+ vec2s loc;
+ short index;
+ float co[3];
+ struct EditVert *eve;
+} RetopoPaintPoint;
+
+typedef struct RetopoPaintLine {
+ struct RetopoPaintLine *next, *prev;
+ ListBase points;
+ ListBase hitlist; /* RetopoPaintHit */
+ RetopoPaintPoint *cyclic;
+} RetopoPaintLine;
+
+typedef struct RetopoPaintSel {
+ struct RetopoPaintSel *next, *prev;
+ RetopoPaintLine *line;
+ char first;
+} RetopoPaintSel;
+
+typedef struct RetopoPaintData {
+ char in_drag;
+ short sloc[2];
+
+ ListBase lines;
+ ListBase intersections; /* RetopoPaintPoint */
+
+ short seldist;
+ RetopoPaintSel nearest;
+
+ struct View3D *paint_v3d;
+} RetopoPaintData;
+
+RetopoPaintData *get_retopo_paint_data();
+
+char retopo_mesh_check();
+char retopo_curve_check();
+
+void retopo_end_okee();
+
+void retopo_free_paint_data(RetopoPaintData *rpd);
+void retopo_free_paint();
+
+char retopo_mesh_paint_check();
+void retopo_paint_view_update(struct View3D *v3d);
+void retopo_force_update();
+void retopo_paint_toggle(void*,void*);
+char retopo_paint(const unsigned short event);
+void retopo_draw_paint_lines();
+RetopoPaintData *retopo_paint_data_copy(RetopoPaintData *rpd);
+
+void retopo_toggle(void*,void*);
+void retopo_do_vert(struct View3D *v3d, float *v);
+void retopo_do_all();
+void retopo_do_all_cb(void *, void *);
+void retopo_queue_updates(struct View3D *v3d);
+
+void retopo_matrix_update(struct View3D *v3d);
+
+void retopo_free_view_data(struct View3D *v3d);
+
+#endif
diff --git a/source/blender/src/scrarea.c b/source/blender/editors/include/BIF_scrarea.h
index c9076a105a8..d71fb38c7a2 100644
--- a/source/blender/src/scrarea.c
+++ b/source/blender/editors/include/BIF_scrarea.h
@@ -1,5 +1,5 @@
/**
- * $Id$
+ * $Id: BIF_scrarea.h 229 2002-12-27 13:11:01Z mein $
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
@@ -29,41 +29,26 @@
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "BIF_scrarea.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
+#ifdef __cplusplus
+extern "C" {
#endif
-void *scrarea_find_space_of_type(ScrArea *sa, int type)
-{
- SpaceLink *sl;
+struct ScrArea;
- for (sl= sa->spacedata.first; sl; sl= sl->next)
- if (sl->spacetype==type)
- return (void*) sl;
+ /**
+ * Finds the first spacedata of @a type within
+ * the scrarea.
+ */
+void *scrarea_find_space_of_type(ScrArea *sa, int type);
- return 0;
-}
-
-int scrarea_get_win_x(ScrArea *sa)
-{
- return sa->winrct.xmin;
-}
+int scrarea_get_win_x (struct ScrArea *sa);
+int scrarea_get_win_y (struct ScrArea *sa);
+int scrarea_get_win_width (struct ScrArea *sa);
+int scrarea_get_win_height (struct ScrArea *sa);
-int scrarea_get_win_y(ScrArea *sa)
-{
- return sa->winrct.ymin;
+#ifdef __cplusplus
}
-int scrarea_get_win_width(ScrArea *sa)
-{
- return sa->winx;
-}
+#endif
-int scrarea_get_win_height(ScrArea *sa)
-{
- return sa->winy;
-}
diff --git a/source/blender/editors/include/BIF_screen.h b/source/blender/editors/include/BIF_screen.h
new file mode 100644
index 00000000000..e221fcace1e
--- /dev/null
+++ b/source/blender/editors/include/BIF_screen.h
@@ -0,0 +1,137 @@
+/* replacement for screen.h */
+/*
+ *
+ * Leftovers here are actually editscreen.c thingies
+ *
+ * $Id: BIF_screen.h 10543 2007-04-17 18:15:31Z campbellbarton $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_SCREEN_H
+#define BIF_SCREEN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* externs in editscreen.c */
+extern int displaysizex, displaysizey;
+extern struct ScrArea *curarea;
+
+struct View3D;
+struct bScreen;
+struct ScrArea;
+struct ScrVert;
+struct ScrEdge;
+struct ListBase;
+
+struct View3D *find_biggest_view3d(void);
+struct ScrArea *find_biggest_area_of_type(int spacecode);
+struct ScrArea *find_biggest_area(void);
+
+void scrarea_queue_redraw(struct ScrArea *area);
+void scrarea_queue_winredraw(struct ScrArea *area);
+void scrarea_queue_headredraw(struct ScrArea *area);
+
+int blender_test_break(void);
+
+void duplicate_screen(void);
+void init_screen_cursors(void);
+void set_timecursor(int nr);
+void waitcursor(int val);
+void wich_cursor(struct ScrArea *sa);
+void setcursor_space(int spacetype, short cur);
+void set_g_activearea(struct ScrArea *sa);
+void getmouseco_sc(short *mval);
+void getmouseco_areawin(short *mval);
+void getmouseco_headwin(short *mval);
+int qtest(void);
+int anyqtest(void);
+void areawinset(short win);
+void headerbox(struct ScrArea *sa);
+void defheaddraw(void);
+void defheadchange(void);
+unsigned short winqtest(struct ScrArea *sa);
+unsigned short headqtest(struct ScrArea *sa);
+void winqdelete(struct ScrArea *sa);
+void winqclear(struct ScrArea *sa);
+void addqueue(short win, unsigned short event, short val);
+void addafterqueue(short win, unsigned short event, short val);
+void add_readfile_event(char *filename);
+short ext_qtest(void);
+unsigned short extern_qread(short *val);
+unsigned short extern_qread_ext(short *val, char *ascii);
+
+extern void markdirty_all(void); // also sets redraw event
+extern void markdirty_all_back(void);
+extern void markdirty_win_back(short winid);
+
+void screen_swapbuffers(void);
+void set_debug_swapbuffers_ovveride(struct bScreen *sc, int mode);
+int is_allowed_to_change_screen(struct bScreen *newp);
+void splash(void * data, int datasizei, char * string);
+void screen_delayed_undo_push(char *name);
+void screenmain(void);
+void getdisplaysize(void);
+void setprefsize(int stax, int stay, int sizx, int sizy, int maximized);
+void calc_arearcts(struct ScrArea *sa);
+void resize_screen(int x, int y, int w, int h);
+struct ScrArea *closest_bigger_area(void);
+int mywinopen(int mode, short posx, short posy, short sizex, short sizey);
+void setscreen(struct bScreen *sc);
+void area_fullscreen(void);
+int select_area(int spacetype);
+struct bScreen *default_twosplit(void);
+void initscreen(void);
+void unlink_screen(struct bScreen *sc);
+void reset_autosave(void);
+int area_is_active_area(struct ScrArea *area);
+void draw_area_emboss(struct ScrArea *sa);
+
+void headerprint(char *str);
+
+/* ******* handlers ****** */
+void add_screenhandler(struct bScreen *sc, short eventcode, short val);
+void rem_screenhandler(struct bScreen *sc, short eventcode);
+int do_screenhandlers(struct bScreen *sc);
+int has_screenhandler(struct bScreen *sc, short eventcode);
+
+ /***/
+
+/* return all layers of all 3d windows in a screen */
+unsigned int screen_view3d_layers(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BIF_SCREEN_H */
+
diff --git a/source/blender/editors/include/BIF_space.h b/source/blender/editors/include/BIF_space.h
new file mode 100644
index 00000000000..2e91568437b
--- /dev/null
+++ b/source/blender/editors/include/BIF_space.h
@@ -0,0 +1,148 @@
+/**
+ * $Id: BIF_space.h 12177 2007-10-01 08:03:11Z schlaile $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_SPACE_H
+#define BIF_SPACE_H
+
+struct ListBase;
+struct ScrArea;
+struct SpaceButs;
+struct View2D;
+struct BWinEvent;
+struct SpaceOops;
+
+#define REMAKEIPO 1
+#define OOPS_TEST 2
+
+#define BUT_HORIZONTAL 1
+#define BUT_VERTICAL 2
+
+/* is hardcoded in DNA_space_types.h */
+#define SPACE_MAXHANDLER 8
+
+/* view3d handler codes */
+#define VIEW3D_HANDLER_BACKGROUND 1
+#define VIEW3D_HANDLER_PROPERTIES 2
+#define VIEW3D_HANDLER_OBJECT 3
+#define VIEW3D_HANDLER_PREVIEW 4
+#define VIEW3D_HANDLER_MULTIRES 5
+
+/* ipo handler codes */
+#define IPO_HANDLER_PROPERTIES 20
+
+/* image handler codes */
+#define IMAGE_HANDLER_PROPERTIES 30
+#define IMAGE_HANDLER_PAINT 31
+#define IMAGE_HANDLER_CURVES 32
+#define IMAGE_HANDLER_PREVIEW 33
+#define IMAGE_HANDLER_GAME_PROPERTIES 34
+#define IMAGE_HANDLER_VIEW_PROPERTIES 35
+/*#define IMAGE_HANDLER_TRANSFORM_PROPERTIES 36*/
+
+/* action handler codes */
+#define ACTION_HANDLER_PROPERTIES 40
+
+/* nla handler codes */
+#define NLA_HANDLER_PROPERTIES 50
+
+/* sequence handler codes */
+#define SEQ_HANDLER_PROPERTIES 60
+
+/* imasel handler codes */
+#define IMASEL_HANDLER_IMAGE 70
+
+/* theme codes */
+#define B_ADD_THEME 3301
+#define B_DEL_THEME 3302
+#define B_NAME_THEME 3303
+#define B_THEMECOL 3304
+#define B_UPDATE_THEME 3305
+#define B_CHANGE_THEME 3306
+#define B_THEME_COPY 3307
+#define B_THEME_PASTE 3308
+#define B_UPDATE_THEME_ICONS 3309
+
+#define B_RECALCLIGHT 3310
+
+
+void scrarea_do_winprefetchdraw (struct ScrArea *sa);
+void scrarea_do_windraw (struct ScrArea *sa);
+void scrarea_do_winchange (struct ScrArea *sa);
+void scrarea_do_winhandle (struct ScrArea *sa, struct BWinEvent *evt);
+void scrarea_do_headdraw (struct ScrArea *sa);
+void scrarea_do_headchange (struct ScrArea *sa);
+
+/* space.c */
+extern void add_blockhandler(struct ScrArea *sa, short eventcode, short action);
+extern void rem_blockhandler(struct ScrArea *sa, short eventcode);
+extern void toggle_blockhandler(struct ScrArea *sa, short eventcode, short action);
+
+extern void space_set_commmandline_options(void);
+extern void allqueue(unsigned short event, short val);
+extern void allspace(unsigned short event, short val);
+extern void copy_view3d_lock(short val);
+extern void drawemptyspace(struct ScrArea *sa, void *spacedata);
+extern void drawinfospace(struct ScrArea *sa, void *spacedata);
+extern void duplicatespacelist(struct ScrArea *area, struct ListBase *lb1, struct ListBase *lb2);
+extern void extern_set_butspace(int fkey, int do_cycle);
+extern void force_draw(int header);
+extern void force_draw_all(int header);
+extern void force_draw_plus(int type, int header);
+extern void freespacelist(struct ScrArea *sa);
+extern void handle_view3d_around(void);
+extern void handle_view3d_lock(void);
+extern void init_v2d_oops(struct ScrArea *, struct SpaceOops *);
+extern void initipo(struct ScrArea *sa);
+extern void newspace(struct ScrArea *sa, int type);
+extern void set_rects_butspace(struct SpaceButs *buts);
+extern void test_butspace(void);
+extern void start_game(void);
+extern void select_object_grouped(short nr);
+extern void join_menu(void);
+
+extern void BIF_undo_push(char *str);
+extern void BIF_undo(void);
+extern void BIF_redo(void);
+extern void BIF_undo_menu(void);
+
+#if 0
+//#ifdef _WIN32 // FULLSCREEN
+extern void mainwindow_toggle_fullscreen(int fullscreen);
+#endif
+
+extern void mainwindow_set_filename_to_title(char *title);
+extern void mainwindow_raise(void);
+extern void mainwindow_make_active(void);
+extern void mainwindow_close(void);
+
+#endif
+
diff --git a/source/blender/editors/include/BIF_spacetypes.h b/source/blender/editors/include/BIF_spacetypes.h
new file mode 100644
index 00000000000..eb4608f91cf
--- /dev/null
+++ b/source/blender/editors/include/BIF_spacetypes.h
@@ -0,0 +1,67 @@
+/**
+ * $Id: BIF_spacetypes.h 12177 2007-10-01 08:03:11Z schlaile $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+struct ScrArea;
+struct BWinEvent;
+
+typedef struct _SpaceType SpaceType;
+
+typedef void (*SpacePrefetchDrawFP) (struct ScrArea *sa, void *spacedata);
+typedef void (*SpaceDrawFP) (struct ScrArea *sa, void *spacedata);
+typedef void (*SpaceChangeFP) (struct ScrArea *sa, void *spacedata);
+typedef void (*SpaceHandleFP) (struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
+
+ /***/
+
+SpaceType* spacetype_new (char *name);
+
+void spacetype_set_winfuncs (SpaceType *st, SpacePrefetchDrawFP prefetch, SpaceDrawFP draw, SpaceChangeFP change, SpaceHandleFP handle);
+
+ /***/
+
+SpaceType *spaceaction_get_type (void);
+SpaceType *spacebuts_get_type (void);
+SpaceType *spacefile_get_type (void);
+SpaceType *spaceimage_get_type (void);
+SpaceType *spaceimasel_get_type (void);
+SpaceType *spaceinfo_get_type (void);
+SpaceType *spaceipo_get_type (void);
+SpaceType *spacenla_get_type (void);
+SpaceType *spaceoops_get_type (void);
+SpaceType *spaceseq_get_type (void);
+SpaceType *spacesound_get_type (void);
+SpaceType *spacetext_get_type (void);
+SpaceType *spacescript_get_type (void);
+SpaceType *spaceview3d_get_type (void);
+SpaceType *spacetime_get_type (void);
+SpaceType *spacenode_get_type (void);
+
diff --git a/source/blender/editors/include/BIF_tbcallback.h b/source/blender/editors/include/BIF_tbcallback.h
new file mode 100644
index 00000000000..4e92b3c32b0
--- /dev/null
+++ b/source/blender/editors/include/BIF_tbcallback.h
@@ -0,0 +1,42 @@
+/* $Id: BIF_tbcallback.h 206 2002-12-20 09:41:25Z mein $
+*/
+/*
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****/
+
+/* defines callback structure for toolbox menu */
+typedef struct _TBcallback {
+ char *desc;
+ char *key;
+ void (*cb)(int v); /* callback function takes value */
+ int val;
+} TBcallback;
+
+typedef TBcallback * (*Tbox_callbackfunc)(int l, int x);
+void tboxSetCallback(Tbox_callbackfunc f);
+
diff --git a/source/blender/editors/include/BIF_toets.h b/source/blender/editors/include/BIF_toets.h
new file mode 100644
index 00000000000..2885d325a27
--- /dev/null
+++ b/source/blender/editors/include/BIF_toets.h
@@ -0,0 +1,41 @@
+/**
+ * $Id: BIF_toets.h 6568 2006-01-28 18:33:28Z hos $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_TOETS_H
+#define BIF_TOETS_H
+
+int blenderqread(unsigned short event, short val);
+void persptoetsen(unsigned short event); /* dutch rules man */
+int untitled(char *name);
+
+#endif
+
diff --git a/source/blender/editors/include/BIF_toolbox.h b/source/blender/editors/include/BIF_toolbox.h
new file mode 100644
index 00000000000..46e81719aec
--- /dev/null
+++ b/source/blender/editors/include/BIF_toolbox.h
@@ -0,0 +1,68 @@
+/* toolbox (SPACEKEY) related
+ * $Id: BIF_toolbox.h 10571 2007-04-22 22:08:19Z campbellbarton $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_TOOLBOX_H
+#define BIF_TOOLBOX_H
+
+/* toolbox.c */
+void asciitoraw (int ch, short unsigned int *event, short unsigned int *qual);
+
+void toolbox_n(void);
+void toolbox_n_add(void);
+void reset_toolbox(void);
+
+void notice (char *str, ...);
+void error (char *fmt, ...);
+
+void error_libdata (void);
+
+int saveover (char *filename);
+int okee (char *fmt, ...);
+
+short button (short *var, short min, short max, char *str);
+short fbutton (float *var, float min, float max, float a1, float a2, char *str);
+short sbutton (char *var, float min, float max, char *str); /* __NLA */
+
+int movetolayer_buts (unsigned int *lay, char *title);
+int movetolayer_short_buts (short *lay, char *title);
+
+void draw_numbuts_tip (char *str, int x1, int y1, int x2, int y2);
+int do_clever_numbuts (char *name, int tot, int winevent);
+void clever_numbuts_buts(void);
+void add_numbut (int nr, int type, char *str, float min, float max, void *poin, char *tip);
+void clever_numbuts (void);
+void replace_names_but (void);
+
+void BIF_screendump(int fscreen);
+void write_screendump(char *name);
+
+#endif
diff --git a/source/blender/editors/include/BIF_transform.h b/source/blender/editors/include/BIF_transform.h
new file mode 100644
index 00000000000..9c8798a54ee
--- /dev/null
+++ b/source/blender/editors/include/BIF_transform.h
@@ -0,0 +1,110 @@
+/**
+ * $Id: BIF_transform.h 12682 2007-11-26 22:09:57Z blendix $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_TRANSFORM_H
+#define BIF_TRANSFORM_H
+
+/* ******************** Macros & Prototypes *********************** */
+
+/* MODE AND NUMINPUT FLAGS */
+#define TFM_INIT -1
+#define TFM_DUMMY 0
+#define TFM_TRANSLATION 1
+#define TFM_ROTATION 2
+#define TFM_RESIZE 3
+#define TFM_TOSPHERE 4
+#define TFM_SHEAR 5
+#define TFM_WARP 7
+#define TFM_SHRINKFATTEN 8
+#define TFM_TILT 9
+#define TFM_LAMP_ENERGY 10
+#define TFM_TRACKBALL 11
+#define TFM_PUSHPULL 12
+#define TFM_CREASE 13
+#define TFM_MIRROR 14
+#define TFM_BONESIZE 15
+#define TFM_BONE_ENVELOPE 16
+#define TFM_CURVE_SHRINKFATTEN 17
+#define TFM_BONE_ROLL 18
+#define TFM_TIME_TRANSLATE 19
+#define TFM_TIME_SLIDE 20
+#define TFM_TIME_SCALE 21
+#define TFM_TIME_EXTEND 22
+#define TFM_BAKE_TIME 23
+
+/* TRANSFORM CONTEXTS */
+#define CTX_NONE 0
+#define CTX_TEXTURE 1
+#define CTX_EDGE 2
+#define CTX_NO_PET 4
+#define CTX_TWEAK 8
+#define CTX_NO_MIRROR 16
+
+void initTransform(int mode, int context);
+void Transform(void);
+void Mirror(short mode);
+
+/* Standalone call to get the transformation center corresponding to the current situation
+ * returns 1 if successful, 0 otherwise (usually means there's no selection)
+ * (if 0 is returns, *vec is unmodified)
+ * */
+int calculateTransformCenter(int centerMode, float *vec);
+
+struct TransInfo;
+struct ScrArea;
+
+struct TransInfo * BIF_GetTransInfo(void);
+void BIF_setSingleAxisConstraint(float vec[3], char *text);
+void BIF_setDualAxisConstraint(float vec1[3], float vec2[3], char *text);
+void BIF_setLocalAxisConstraint(char axis, char *text);
+void BIF_setLocalLockConstraint(char axis, char *text);
+
+/* Drawing callbacks */
+void BIF_drawConstraint(void);
+void BIF_drawPropCircle(void);
+void BIF_drawSnap(void);
+
+void BIF_getPropCenter(float *center);
+
+void BIF_TransformSetUndo(char *str);
+
+void BIF_selectOrientation(void);
+
+/* view3d manipulators */
+void initManipulator(int mode);
+void ManipulatorTransform();
+
+int BIF_do_manipulator(struct ScrArea *sa);
+void BIF_draw_manipulator(struct ScrArea *sa);
+
+#endif
+
diff --git a/source/blender/editors/include/BIF_usiblender.h b/source/blender/editors/include/BIF_usiblender.h
new file mode 100644
index 00000000000..bdc12053861
--- /dev/null
+++ b/source/blender/editors/include/BIF_usiblender.h
@@ -0,0 +1,54 @@
+/**
+ * $Id: BIF_usiblender.h 12552 2007-11-11 15:18:53Z campbellbarton $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_USIBLENDER_H
+#define BIF_USIBLENDER_H
+
+typedef struct RecentFile {
+ struct RecentFile *next, *prev;
+ char *filename;
+} RecentFile;
+
+void exit_usiblender(void);
+
+void BIF_init(void);
+
+void BIF_read_file(char *name);
+int BIF_read_homefile(int from_memory);
+void BIF_read_autosavefile(void);
+
+void BIF_write_file(char *target);
+void BIF_write_homefile(void);
+void BIF_write_autosave(void);
+
+#endif
+
diff --git a/source/blender/editors/include/BIF_verse.h b/source/blender/editors/include/BIF_verse.h
new file mode 100644
index 00000000000..be4f73ccd54
--- /dev/null
+++ b/source/blender/editors/include/BIF_verse.h
@@ -0,0 +1,142 @@
+/**
+ * $Id: BIF_verse.h 9683 2007-01-09 11:50:45Z jiri $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Contributor(s): Jiri Hnidek.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifdef WITH_VERSE
+
+#ifndef BIF_VERSE_H
+#define BIF_VERSE_H
+
+#include "BKE_verse.h"
+#include "DNA_meshdata_types.h"
+
+struct Object;
+
+struct EditMesh;
+struct EditVert;
+struct EditFace;
+struct Mesh;
+struct MVert;
+struct Mface;
+
+/* verse_object.c */
+void unsubscribe_from_obj_node(struct VNode *vnode);
+void unsubscribe_from_geom_node(struct VNode *vnode);
+void unsubscribe_from_bitmap_node(struct VNode *vnode);
+
+void test_and_send_idbutton_cb(void *obj, void *ob_name);
+
+struct Object *create_object_from_verse_node(struct VNode *vnode);
+
+void b_verse_pop_node(struct VNode *vnode);
+void b_verse_unsubscribe(VNode *vnode);
+void b_verse_push_object(struct VerseSession *session, struct Object *ob);
+void b_verse_delete_object(struct Object *ob);
+void b_verse_ms_get(void);
+
+void post_transform_pos(struct VNode *vnode);
+void post_transform_rot(struct VNode *vnode);
+void post_transform_scale(struct VNode *vnode);
+
+/*void post_transform(struct VNode *vnode);*/
+void post_link_set(struct VLink *vlink);
+void post_link_destroy(struct VLink *vlink);
+void post_object_free_constraint(struct VNode *vnode);
+
+void b_verse_send_transformation(struct Object *ob);
+
+/* verse_mesh.c */
+void b_verse_send_vertex_delete(struct EditVert *eve);
+void send_versevert_pos(struct VerseVert *vvert);
+
+void b_verse_send_face_delete(struct EditFace *efa);
+
+void sync_all_versefaces_with_editfaces(struct VNode *vnode);
+void sync_all_verseverts_with_editverts(struct VNode *vnode);
+
+void createVerseVert(struct EditVert *ev);
+void createVerseFace(struct EditFace *efa);
+
+void b_verse_duplicate_object(struct VerseSession *session, struct Object *ob, struct Object *n_ob);
+struct VNode *create_geom_vnode_from_geom_vnode(struct VNode *vnode);
+struct VNode *create_geom_vnode_data_from_editmesh(struct VerseSession *session, struct EditMesh *em);
+struct VNode *create_geom_vnode_data_from_mesh(struct VerseSession *session, struct Mesh *me);
+
+void destroy_unused_geometry(struct VNode *vnode);
+void destroy_binding_between_versemesh_and_editmesh(struct VNode *vnode);
+
+void destroy_versemesh(struct VNode *vnode);
+
+void unsubscribe_from_geom_node(struct VNode *vnode);
+
+void create_edit_mesh_from_geom_node(struct VNode *vnode);
+struct Mesh *create_mesh_from_geom_node(struct VNode *vnode);
+void create_meshdata_from_geom_node(struct Mesh *me, struct VNode *vnode);
+
+/* geometry post callback functions */
+void post_layer_create(struct VLayer *vlayer);
+void post_layer_destroy(struct VLayer *vlayer);
+
+void post_vertex_create(struct VerseVert *vvert);
+void post_vertex_set_xyz(struct VerseVert *vvert);
+void post_vertex_delete(struct VerseVert *vvert);
+void post_vertex_free_constraint(struct VerseVert *vvert);
+
+void post_polygon_set_uint8(struct VerseFace *vface);
+void post_polygon_create(struct VerseFace *vface);
+void post_polygon_set_corner(struct VerseFace *vface);
+void post_polygon_delete(struct VerseFace *vface);
+void post_polygon_free_constraint(struct VerseFace *vface);
+
+void post_geometry_free_constraint(struct VNode *vnode);
+
+/* verse_common.c */
+struct VerseSession *session_menu(void);
+char *verse_client_name(void);
+
+void post_tag_change(struct VTag *vtag);
+void post_taggroup_create(struct VTagGroup *vtaggroup);
+
+void post_node_create(struct VNode *vnode);
+void post_node_destroy(struct VNode *vnode);
+void post_node_name_set(struct VNode *vnode);
+
+void post_connect_accept(struct VerseSession *session);
+void post_connect_terminated(struct VerseSession *session);
+void post_connect_update(struct VerseSession *session);
+void post_server_add(void);
+
+/* verse_image.c */
+
+void sync_blender_image_with_verse_bitmap_node(struct VNode *vnode);
+void post_bitmap_dimension_set(struct VNode *vnode);
+void post_bitmap_layer_create(struct VBitmapLayer *vblayer);
+void post_bitmap_layer_destroy(struct VBitmapLayer *vblayer);
+void post_bitmap_tile_set(struct VBitmapLayer *vblayer, unsigned int xs, unsigned int ys);
+
+#endif
+
+#endif
diff --git a/source/blender/editors/include/BIF_writeavicodec.h b/source/blender/editors/include/BIF_writeavicodec.h
new file mode 100644
index 00000000000..842c2eade1a
--- /dev/null
+++ b/source/blender/editors/include/BIF_writeavicodec.h
@@ -0,0 +1,44 @@
+/**
+ * Functions for writing windows avi-format files.
+ *
+ * $Id: BIF_writeavicodec.h 6589 2006-01-29 17:46:19Z bjornmose $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ *
+ */
+
+#ifdef _WIN32
+
+void start_avi_codec(RenderData *rd,int rectx, int recty );
+void append_avi_codec(int frame,int *pixels,int rectx, int recty);
+void end_avi_codec(void);
+int get_avicodec_settings(void);
+
+#endif
+
diff --git a/source/blender/editors/include/BIF_writeimage.h b/source/blender/editors/include/BIF_writeimage.h
new file mode 100644
index 00000000000..0a71da0ba50
--- /dev/null
+++ b/source/blender/editors/include/BIF_writeimage.h
@@ -0,0 +1,45 @@
+/**
+ * $Id: BIF_writeimage.h 9376 2006-12-20 17:57:56Z ton $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_WRITEIMAGE_H
+#define BIF_WRITEIMAGE_H
+
+struct ImBuf;
+struct EnvMap;
+
+void BIF_save_rendered_image(char *name);
+void BIF_save_rendered_image_fs(void);
+void BIF_save_envmap(struct EnvMap *env, char *str);
+void save_image_filesel_str(char *str);
+
+#endif
+
diff --git a/source/blender/editors/include/BIF_writemovie.h b/source/blender/editors/include/BIF_writemovie.h
new file mode 100644
index 00000000000..2ba28a88448
--- /dev/null
+++ b/source/blender/editors/include/BIF_writemovie.h
@@ -0,0 +1,41 @@
+/**
+ * $Id: BIF_writemovie.h 229 2002-12-27 13:11:01Z mein $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_WRITEMOVIE_H
+#define BIF_WRITEMOVIE_H
+
+void start_movie(void);
+void append_movie(int fnum);
+void end_movie(void);
+
+#endif
+
diff --git a/source/blender/editors/include/BPI_script.h b/source/blender/editors/include/BPI_script.h
new file mode 100644
index 00000000000..9fef7ae74a8
--- /dev/null
+++ b/source/blender/editors/include/BPI_script.h
@@ -0,0 +1,71 @@
+/**
+ * include/BPI_script.h (jan-2004 ianwill)
+ *
+ * $Id: BPI_script.h 4590 2005-06-11 05:30:14Z ianwill $
+ *
+ * Header for BPython's script structure. BPI: Blender Python external include
+ * file.
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * This is a new part of Blender.
+ *
+ * Contributor(s): Willian P. Germano.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BPI_SCRIPT_H
+#define BPI_SCRIPT_H
+
+//#include "DNA_listBase.h"
+#include "DNA_ID.h"
+
+typedef struct Script {
+ ID id;
+
+ void *py_draw;
+ void *py_event;
+ void *py_button;
+ void *py_browsercallback;
+ void *py_globaldict;
+
+ int flags, lastspace;
+
+} Script;
+
+/* Note: a script that registers callbacks in the script->py_* pointers
+ * above (or calls the file or image selectors) needs to keep its global
+ * dictionary until Draw.Exit() is called and the callbacks removed.
+ * Unsetting SCRIPT_RUNNING means the interpreter reached the end of the
+ * script and returned control to Blender, but we can't get rid of its
+ * namespace (global dictionary) while SCRIPT_GUI or SCRIPT_FILESEL is set,
+ * because of the callbacks. The flags and the script name are saved in
+ * each running script's global dictionary, under '__script__'. */
+
+/* Flags */
+#define SCRIPT_RUNNING 0x01
+#define SCRIPT_GUI 0x02
+#define SCRIPT_FILESEL 0x04
+
+#endif /* BPI_SCRIPT_H */
diff --git a/source/blender/editors/include/BSE_drawimasel.h b/source/blender/editors/include/BSE_drawimasel.h
new file mode 100644
index 00000000000..6e95bcca2f9
--- /dev/null
+++ b/source/blender/editors/include/BSE_drawimasel.h
@@ -0,0 +1,60 @@
+/**
+ * $Id: BSE_drawimasel.h 11920 2007-09-02 17:25:03Z elubie $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BSE_DRAWIMASEL_H
+#define BSE_DRAWIMASEL_H
+
+
+/* button events */
+#define B_FS_FILENAME 1
+#define B_FS_DIRNAME 2
+#define B_FS_DIR_MENU 3
+#define B_FS_PARDIR 4
+#define B_FS_LOAD 5
+#define B_FS_CANCEL 6
+#define B_FS_LIBNAME 7
+#define B_FS_BOOKMARK 8
+
+/* ui geometry */
+#define IMASEL_BUTTONS_HEIGHT 60
+#define TILE_BORDER_X 8
+#define TILE_BORDER_Y 8
+
+struct ScrArea;
+struct SpaceImaSel;
+
+void drawimaselspace(struct ScrArea *sa, void *spacedata);
+void calc_imasel_rcts(SpaceImaSel *simasel, int winx, int winy);
+void do_imasel_buttonevents(short event, SpaceImaSel *simasel);
+
+#endif /* BSE_DRAWIMASEL_H */
+
diff --git a/source/blender/editors/include/BSE_drawipo.h b/source/blender/editors/include/BSE_drawipo.h
new file mode 100644
index 00000000000..e0ab9e18acb
--- /dev/null
+++ b/source/blender/editors/include/BSE_drawipo.h
@@ -0,0 +1,76 @@
+/**
+ * $Id: BSE_drawipo.h 5523 2005-10-20 14:41:10Z ton $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BSE_DRAWIPO_H
+#define BSE_DRAWIPO_H
+
+#define IN_2D_VERT_SCROLL(A) (BLI_in_rcti(&G.v2d->vert, A[0], A[1]))
+#define IN_2D_HORIZ_SCROLL(A) (BLI_in_rcti(&G.v2d->hor, A[0], A[1]))
+
+#define SELECT_REPLACE 1
+#define SELECT_ADD 2
+#define SELECT_SUBTRACT 4
+#define SELECT_INVERT 16
+
+struct ScrArea;
+struct EditIpo;
+struct View2D;
+struct rctf;
+
+void calc_ipogrid(void);
+void draw_ipogrid(void);
+
+void areamouseco_to_ipoco (struct View2D *v2d, short *mval, float *x, float *y);
+void ipoco_to_areaco (struct View2D *v2d, float *vec, short *mval);
+void ipoco_to_areaco_noclip (struct View2D *v2d, float *vec, short *mval);
+
+void view2d_do_locks (struct ScrArea *cursa, int flag);
+void view2d_zoom (struct View2D *v2d, float factor, int winx, int winy);
+void test_view2d (struct View2D *v2d, int winx, int winy);
+void calc_scrollrcts (struct ScrArea *sa, struct View2D *v2d, int winx, int winy);
+
+int in_ipo_buttons(void);
+void draw_view2d_numbers_horiz(int drawframes);
+void drawscroll(int disptype);
+void drawipospace(struct ScrArea *sa, void *spacedata);
+
+void center_currframe(void);
+void scroll_ipobuts(void);
+int view2dzoom(unsigned short event);
+int view2dmove(unsigned short event);
+void view2dborder(void);
+
+struct EditIpo *select_proj_ipo(struct rctf *rectf, int event);
+
+
+#endif /* BSE_DRAWIPO_H */
+
diff --git a/source/blender/python/api2_2x/bpy_config.h b/source/blender/editors/include/BSE_drawnla.h
index ae1f114dc81..b04bde8de7c 100644
--- a/source/blender/python/api2_2x/bpy_config.h
+++ b/source/blender/editors/include/BSE_drawnla.h
@@ -1,5 +1,5 @@
-/*
- * $Id: bpy_config.h 10546 2007-04-18 14:40:01Z campbellbarton $
+/**
+ * $Id: BSE_drawnla.h 5478 2005-10-10 18:05:30Z ton $
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
@@ -23,30 +23,30 @@
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
- * This is a new part of Blender.
+ * The Original Code is: all of this file.
*
- * Contributor(s): Campbell Barton
+ * Contributor(s): none yet.
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
+ */
-#ifndef EXPP_BPY_CONFIG_H
-#define EXPP_BPY_CONFIG_H
+#ifndef BSE_DRAWNLA_H
+#define BSE_DRAWNLA_H
-#include <Python.h>
+struct ScrArea;
+struct Base;
+struct gla2DDrawInfo;
+struct Object;
-/* The Main PyType Object defined in Main.c */
-extern PyTypeObject Config_Type;
+void drawnlaspace(struct ScrArea *sa, void *spacedata);
+void do_nlabuts(unsigned short event);
-#define BPy_Config_Check(v) \
- ((v)->ob_type == &Config_Type)
+int count_nla_levels(void);
+int nla_filter (struct Base* base);
-/* Main sequence, iterate on the libdatas listbase*/
-typedef struct {
- PyObject_VAR_HEAD /* required python macro */
-} BPy_Config;
+ /* changes the gla2d system to map the strip transform */
+void map_active_strip(struct gla2DDrawInfo *di, struct Object *ob, int restore);
-PyObject *Config_CreatePyObject();
+#endif /* BSE_DRAWNLA */
-#endif /* EXPP_BPY_CONFIG_H */
diff --git a/source/blender/editors/include/BSE_drawoops.h b/source/blender/editors/include/BSE_drawoops.h
new file mode 100644
index 00000000000..e00e02fa6f7
--- /dev/null
+++ b/source/blender/editors/include/BSE_drawoops.h
@@ -0,0 +1,50 @@
+/**
+ * $Id: BSE_drawoops.h 6135 2005-12-16 13:50:45Z campbellbarton $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BSE_DRAWOOPS_H
+#define BSE_DRAWOOPS_H
+
+struct ScrArea;
+struct Oops;
+
+void boundbox_oops(short sel);
+void give_oopslink_line(struct Oops *oops, struct OopsLink *ol, float *v1, float *v2);
+void draw_oopslink(struct Oops *oops);
+void draw_icon_oops(float *co, short type);
+void mysbox(float x1, float y1, float x2, float y2);
+unsigned int give_oops_color(short type, short sel, unsigned int *border);
+void calc_oopstext(char *str, float *v1);
+void draw_oops(struct Oops *oops);
+void drawoopsspace(struct ScrArea *sa, void *spacedata);
+
+#endif /* BSE_DRAWOOPS */
+
diff --git a/source/blender/editors/include/BSE_drawview.h b/source/blender/editors/include/BSE_drawview.h
new file mode 100644
index 00000000000..f26856f76ac
--- /dev/null
+++ b/source/blender/editors/include/BSE_drawview.h
@@ -0,0 +1,88 @@
+/**
+ * $Id: BSE_drawview.h 12747 2007-12-01 19:29:50Z blendix $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BSE_DRAWVIEW_H
+#define BSE_DRAWVIEW_H
+
+struct Object;
+struct BGpic;
+struct rctf;
+struct ScrArea;
+struct ImBuf;
+
+void default_gl_light(void);
+void init_gl_stuff(void);
+void circf(float x, float y, float rad);
+void circ(float x, float y, float rad);
+
+void do_viewbuts(unsigned short event);
+
+/* View3DAfter->type */
+#define V3D_XRAY 1
+#define V3D_TRANSP 2
+void add_view3d_after(struct View3D *v3d, struct Base *base, int type);
+
+void backdrawview3d(int test);
+void check_backbuf(void);
+unsigned int sample_backbuf(int x, int y);
+struct ImBuf *read_backbuf(short xmin, short ymin, short xmax, short ymax);
+unsigned int sample_backbuf_rect(short mval[2], int size, unsigned int min, unsigned int max, int *dist, short strict, unsigned int (*indextest)(unsigned int index));
+
+void drawview3dspace(struct ScrArea *sa, void *spacedata);
+void drawview3d_render(struct View3D *v3d, int winx, int winy, float winmat[][4]);
+
+int update_time(void);
+void calc_viewborder(struct View3D *v3d, struct rctf *viewborder_r);
+void view3d_set_1_to_1_viewborder(struct View3D *v3d);
+
+int view3d_test_clipping(struct View3D *v3d, float *vec);
+void view3d_set_clipping(struct View3D *v3d);
+void view3d_clr_clipping(void);
+
+void sumo_callback(void *obp);
+void init_anim_sumo(void);
+void update_anim_sumo(void);
+void end_anim_sumo(void);
+
+void inner_play_anim_loop(int init, int mode);
+int play_anim(int mode);
+
+void make_axis_color(char *col, char *col2, char axis);
+
+/* SMOOTHVIEW */
+void smooth_view(struct View3D *v3d, float *ofs, float *quat, float *dist, float *lens);
+void smooth_view_to_camera(struct View3D *v3d);
+void view_settings_from_ob(struct Object *ob, float *ofs, float *quat, float *dist, float *lens);
+void object_view_settings(struct Object *ob, float *lens, float *clipsta, float *clipend);
+
+#endif /* BSE_DRAWVIEW_H */
+
diff --git a/source/blender/editors/include/BSE_edit.h b/source/blender/editors/include/BSE_edit.h
new file mode 100644
index 00000000000..bd693e0c521
--- /dev/null
+++ b/source/blender/editors/include/BSE_edit.h
@@ -0,0 +1,55 @@
+/**
+ * $Id: BSE_edit.h 10524 2007-04-14 13:18:24Z campbellbarton $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BSE_EDIT_H
+#define BSE_EDIT_H
+
+struct Object;
+struct rcti;
+
+int get_border(struct rcti *rect, short col);
+void countall(void);
+void snapmenu(void);
+void mergemenu(void);
+void delete_context_selected(void);
+void duplicate_context_selected(void);
+void toggle_shading(void);
+int minmax_verts(float *min, float *max);
+
+void snap_sel_to_grid(void);
+void snap_sel_to_curs(void);
+void snap_curs_to_grid(void);
+void snap_curs_to_sel(void);
+void snap_to_center(void);
+
+#endif /* BSE_EDIT_H */
+
diff --git a/source/blender/editors/include/BSE_editaction_types.h b/source/blender/editors/include/BSE_editaction_types.h
new file mode 100644
index 00000000000..48f0bc39ffc
--- /dev/null
+++ b/source/blender/editors/include/BSE_editaction_types.h
@@ -0,0 +1,77 @@
+/**
+ * $Id: BIF_editaction.h 10519 2007-04-13 11:15:08Z aligorith $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): 2007, Joshua Leung (major Action Editor recode)
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_EDITACTION_TYPES_H
+#define BIF_EDITACTION_TYPES_H
+
+/******************************************************* */
+/* FILTERED ACTION DATA - TYPES */
+
+/* types of keyframe data in ActListElem */
+#define ALE_NONE 0
+#define ALE_IPO 1
+#define ALE_ICU 2
+
+/* This struct defines a structure used for quick access */
+typedef struct bActListElem {
+ struct bActListElem *next, *prev;
+
+ void *data; /* source data this elem represents */
+ int type; /* one of the ACTTYPE_* values */
+ int flag; /* copy of elem's flags for quick access */
+ int index; /* copy of adrcode where applicable */
+
+ void *key_data; /* motion data - ipo or ipo-curve */
+ short datatype; /* type of motion data to expect */
+
+ void *owner; /* will either be an action channel or fake ipo-channel (for keys) */
+ short ownertype; /* type of owner */
+} bActListElem;
+
+/******************************************************* */
+/* FILTER ACTION DATA - METHODS/TYPES */
+
+/* filtering flags - under what circumstances should a channel be added */
+#define ACTFILTER_VISIBLE 0x001 /* should channels be visible */
+#define ACTFILTER_SEL 0x002 /* should channels be selected */
+#define ACTFILTER_FOREDIT 0x004 /* does editable status matter */
+#define ACTFILTER_CHANNELS 0x008 /* do we only care that it is a channel */
+#define ACTFILTER_IPOKEYS 0x010 /* only channels referencing ipo's */
+#define ACTFILTER_ONLYICU 0x020 /* only reference ipo-curves */
+#define ACTFILTER_FORDRAWING 0x040 /* make list for interface drawing */
+
+/* Action Editor - Main Data types */
+#define ACTCONT_NONE 0
+#define ACTCONT_ACTION 1
+#define ACTCONT_SHAPEKEY 2
+
+#endif
diff --git a/source/blender/editors/include/BSE_editipo.h b/source/blender/editors/include/BSE_editipo.h
new file mode 100644
index 00000000000..bc181743dac
--- /dev/null
+++ b/source/blender/editors/include/BSE_editipo.h
@@ -0,0 +1,179 @@
+/**
+ * $Id: BSE_editipo.h 12703 2007-11-28 12:11:06Z ton $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BSE_EDITIPO_H
+#define BSE_EDITIPO_H
+
+struct TransVert;
+struct IpoCurve;
+struct BezTriple;
+struct Ipo;
+struct EditIpo;
+struct ID;
+struct ListBase;
+struct Object;
+struct IpoKey;
+struct TransOb;
+struct Tex;
+struct TransInfo;
+
+void remake_object_ipos(struct Object *ob);
+char *getname_ac_ei(int nr);
+char *getname_co_ei(int nr);
+char *getname_ob_ei(int nr, int colipo);
+char *getname_mtex_ei(int nr);
+char *getname_tex_ei(int nr);
+char *getname_mat_ei(int nr);
+char *getname_world_ei(int nr);
+char *getname_seq_ei(int nr);
+char *getname_cu_ei(int nr);
+char *getname_la_ei(int nr);
+char *getname_cam_ei(int nr);
+char *getname_snd_ei(int nr);
+char *getname_fluidsim_ei(int nr);
+char *getname_part_ei(int nr);
+
+char *getname_ipocurve(struct IpoCurve *icu, struct Object *ob);
+int geticon_ipo_blocktype(short blocktype);
+
+struct EditIpo *get_active_editipo(void);
+
+void boundbox_ipocurve(struct IpoCurve *icu, int selectedonly);
+void boundbox_ipo(struct Ipo *ipo, struct rctf *bb, int selectedonly);
+void editipo_changed(struct SpaceIpo *si, int doredraw);
+void scale_editipo(void);
+
+unsigned int ipo_rainbow(int cur, int tot);
+
+void test_editipo(int doit);
+void get_status_editipo(void);
+void update_editipo_flags(void);
+void set_editflag_editipo(void);
+void ipo_toggle_showkey(void);
+void swap_selectall_editipo(void);
+void swap_visible_editipo(void);
+void deselectall_editipo(void);
+
+void move_to_frame(void);
+void do_ipowin_buts(short event);
+void do_ipo_selectbuttons(void);
+
+
+/* gets ipo curve, creates if needed */
+struct IpoCurve *verify_ipocurve(struct ID *, short, char *, char *, char *, int);
+struct Ipo *verify_ipo(struct ID *, short, char *, char *, char *);
+int texchannel_to_adrcode(int channel);
+
+int insert_bezt_icu(struct IpoCurve *icu, struct BezTriple *bezt);
+void insert_vert_icu(struct IpoCurve *icu, float x, float y, short fast);
+void add_vert_ipo(void);
+
+void add_duplicate_editipo(void);
+void remove_doubles_ipo(void);
+void clean_ipo(void);
+void clean_ipo_curve(struct IpoCurve *icu);
+void smooth_ipo(void);
+void join_ipo_menu(void);
+void join_ipo(int mode);
+void ipo_snap_menu(void);
+void ipo_snap(short event);
+void ipo_mirror_menu(void);
+void ipo_mirror(short event);
+void mouse_select_ipo(void);
+void sethandles_ipo(int code);
+void select_ipo_bezier_keys(struct Ipo *ipo, int selectmode);
+void select_icu_bezier_keys(struct IpoCurve *icu, int selectmode);
+void set_ipotype(void);
+void borderselect_ipo(void);
+void del_ipo(int need_check);
+void del_ipoCurve ( struct IpoCurve * icu );
+void free_ipocopybuf(void);
+void copy_editipo(void);
+void paste_editipo(void);
+
+void set_exprap_ipo(int mode);
+
+void set_speed_editipo(float speed);
+void insertkey(ID *id, int blocktype, char *actname, char *constname, int adrcode, short fast);
+void insertkey_smarter(ID *id, int blocktype, char *actname, char *constname, int adrcode);
+void insertkey_editipo(void);
+void common_insertkey(void);
+void free_ipokey(struct ListBase *lb);
+void add_to_ipokey(struct ListBase *lb, struct BezTriple *bezt, int nr, int len);
+void make_ipokey(void);
+void make_ipokey_spec(struct ListBase *lb, struct Ipo *ipo);
+void make_ipokey_transform(struct Object *ob, struct ListBase *lb, int sel);
+void update_ipokey_val(void);
+void set_tob_old(float *old, float *poin);
+void set_ipo_pointers_transob(struct IpoKey *ik, struct TransOb *tob);
+void nextkey(struct ListBase *elems, int dir);
+void movekey_ipo(int dir);
+void movekey_obipo(int dir);
+void nextkey_ipo(int dir);
+void nextkey_obipo(int dir);
+void filter_sampledata(float *data, int sfra, int efra);
+void sampledata_to_ipocurve(float *data, int sfra, int efra, struct IpoCurve *icu);
+void ipo_record(void);
+
+void make_ipo_transdata(struct TransInfo *t);
+void remake_ipo_transdata(struct TransInfo *t);
+void transform_ipo(int mode);
+
+void actstrip_map_ipo_keys(struct Object *ob, struct Ipo *ipo, short restore, short only_keys);
+
+void sethandles_ipo_keys(struct Ipo *ipo, int code);
+void snap_ipo_keys(struct Ipo *ipo, short snaptype);
+void mirror_ipo_keys(struct Ipo *ipo, short mirror_mode);
+void setipotype_ipo(struct Ipo *ipo, int code);
+void set_ipo_key_selection(struct Ipo *ipo, int sel);
+int is_ipo_key_selected(struct Ipo *ipo);
+void delete_icu_key(struct IpoCurve *icu, int index);
+void delete_ipo_keys(struct Ipo *ipo);
+int fullselect_ipo_keys(struct Ipo *ipo);
+int add_trans_ipo_keys(struct Ipo *ipo, struct TransVert *tv, int tvtot);
+void duplicate_ipo_keys(struct Ipo *ipo);
+void borderselect_ipo_key(struct Ipo *ipo, float xmin, float xmax, int val);
+void borderselect_icu_key(struct IpoCurve *icu, float xmin, float xmax,
+ int (*select_function)(struct BezTriple *));
+int insertmatrixkey(ID *id, int blocktype, char *actname, char *constname, int adrcode);
+void insertfloatkey(ID *id, int blocktype, char *actname, char *constname, int adrcode, float floatkey);
+void select_ipo_key(struct Ipo *ipo, float selx, int sel);
+void select_icu_key(struct IpoCurve *icu, float selx, int selectmode);
+void setexprap_ipoloop(struct Ipo *ipo, int code);
+
+/* callbacks */
+int select_bezier_add(struct BezTriple *bezt);
+int select_bezier_subtract(struct BezTriple *bezt);
+int select_bezier_invert(struct BezTriple *bezt);
+
+#endif /* BSE_EDITIPO_H */
+
diff --git a/source/blender/editors/include/BSE_editipo_types.h b/source/blender/editors/include/BSE_editipo_types.h
new file mode 100644
index 00000000000..1a409f53f1e
--- /dev/null
+++ b/source/blender/editors/include/BSE_editipo_types.h
@@ -0,0 +1,53 @@
+/**
+ * $Id: BSE_editipo_types.h 2747 2004-07-05 09:15:02Z jesterking $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BSE_EDITIPO_TYPES_H
+#define BSE_EDITIPO_TYPES_H
+
+struct BezTriple;
+
+typedef struct IpoKey {
+ struct IpoKey *next, *prev;
+ short flag, rt;
+ float val;
+ struct BezTriple **data;
+} IpoKey;
+
+typedef struct EditIpo {
+ char name[32]; // same length as keyblock->name
+ IpoCurve *icu;
+ short adrcode, flag;
+ short disptype, rt;
+ unsigned int col;
+} EditIpo;
+
+#endif /* BSE_EDITIPO_TYPES_H */
diff --git a/source/blender/editors/include/BSE_editnla_types.h b/source/blender/editors/include/BSE_editnla_types.h
new file mode 100644
index 00000000000..d63e373d085
--- /dev/null
+++ b/source/blender/editors/include/BSE_editnla_types.h
@@ -0,0 +1,41 @@
+/**
+ * $Id: BSE_editnla_types.h 5478 2005-10-10 18:05:30Z ton $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BSE_EDITNLA_TYPES_H
+#define BSE_EDITNLA_TYPES_H
+
+#define NLAWIDTH 196
+#define NLACHANNELHEIGHT 16
+#define NLACHANNELSKIP 1
+
+#endif /* BSE_EDITNLA_TYPES_H */
+
diff --git a/source/blender/editors/include/BSE_filesel.h b/source/blender/editors/include/BSE_filesel.h
new file mode 100644
index 00000000000..0fdfde7c976
--- /dev/null
+++ b/source/blender/editors/include/BSE_filesel.h
@@ -0,0 +1,66 @@
+/**
+ * $Id: BSE_filesel.h 11920 2007-09-02 17:25:03Z elubie $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ *
+ */
+
+#ifndef BSE_FILESEL_H
+#define BSE_FILESEL_H
+
+struct SpaceFile;
+struct direntry;
+struct ID;
+struct ScrArea;
+struct BWinEvent;
+
+void filesel_statistics(struct SpaceFile *sfile, int *totfile, int *selfile, float *totlen, float *sellen);
+void test_flags_file(struct SpaceFile *sfile);
+void sort_filelist(struct SpaceFile *sfile);
+void read_dir(struct SpaceFile *sfile);
+void freefilelist(struct SpaceFile *sfile);
+void parent(struct SpaceFile *sfile);
+void swapselect_file(struct SpaceFile *sfile);
+void drawfilespace(struct ScrArea *sa, void *spacedata);
+
+void activate_fileselect(int type, char *title, char *file, void (*func)(char *));
+void activate_fileselect_menu(int type, char *title, char *file, char *pupmenu, short *menup, void (*func)(char *));
+void activate_fileselect_args(int type, char *title, char *file, void (*func)(char *, void *, void *), void *arg1, void *arg2);
+
+void activate_databrowse(struct ID *id, int idcode, int fromcode, int retval, short *menup, void (*func)(unsigned short));
+void activate_databrowse_args(struct ID *id, int idcode, int fromcode, short *menup, void (*func)(char *, void *, void *), void *arg1, void *arg2);
+
+void filesel_prevspace(void);
+void free_filesel_spec(char *dir);
+void winqreadfilespace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
+void main_to_filelist(struct SpaceFile *sfile);
+
+void clever_numbuts_filesel(void);
+#endif
+
diff --git a/source/blender/editors/include/BSE_headerbuttons.h b/source/blender/editors/include/BSE_headerbuttons.h
new file mode 100644
index 00000000000..7c7ca0957de
--- /dev/null
+++ b/source/blender/editors/include/BSE_headerbuttons.h
@@ -0,0 +1,158 @@
+/**
+ * $Id: BSE_headerbuttons.h 10893 2007-06-08 14:17:13Z jiri $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BSE_HEADERBUTTONS_H
+#define BSE_HEADERBUTTONS_H
+
+struct uiBlock;
+struct ScrArea;
+struct ID;
+struct SpaceIpo;
+struct Ipo;
+
+/* these used to be in blender/src/headerbuttons.c: */
+#define XIC 20
+#define YIC 20
+
+int std_libbuttons(struct uiBlock *block,
+ short xco, short yco, int pin, short *pinpoin,
+ int browse, short id_code, short special, struct ID *id, struct ID *parid,
+ short *menupoin, int users,
+ int lib, int del, int autobut, int keepbut);
+
+char *windowtype_pup(void);
+
+int GetButStringLength(char *str);
+void load_space_sound(char *str);
+void load_sound_buttons(char *str);
+/* end of declarations moved from old headerbuttons.c */
+
+void update_for_newframe_muted(void);
+void update_for_newframe_nodraw(int nosound);
+void free_matcopybuf(void);
+void clear_matcopybuf(void);
+void write_vrml_fs(void);
+void write_dxf_fs(void);
+void write_stl_fs(void);
+int buttons_do_unpack(void);
+struct Scene *copy_scene(struct Scene *sce, int level);
+
+void buttons_active_id(struct ID **id, struct ID **idfrom);
+
+int start_progress_bar(void);
+void end_progress_bar(void);
+int progress_bar(float done, char *busy_info);
+
+void update_for_newframe(void);
+
+void action_buttons(void);
+void buts_buttons(void);
+void file_buttons(void);
+void image_buttons(void);
+void imasel_buttons(void);
+void info_buttons(void);
+void ipo_buttons(void);
+void nla_buttons(void);
+void oops_buttons(void);
+void seq_buttons(void);
+void sound_buttons(void);
+void text_buttons(void);
+void script_buttons(void);
+void view3d_buttons(void);
+void time_buttons(struct ScrArea *sa);
+void node_buttons(struct ScrArea *sa);
+
+void do_global_buttons(unsigned short event);
+void do_global_buttons2(short event);
+
+void do_action_buttons(unsigned short event);
+void do_buts_buttons(short event);
+void do_file_buttons(short event);
+void do_image_buttons(unsigned short event);
+void do_imasel_buttons(short event);
+void do_info_buttons(unsigned short event);
+void do_ipo_buttons(short event);
+void do_layer_buttons(short event);
+void do_nla_buttons(unsigned short event);
+void do_oops_buttons(short event);
+void do_seq_buttons(short event);
+void do_sound_buttons(unsigned short event);
+void do_text_buttons(unsigned short event);
+void do_script_buttons(unsigned short event);
+void do_view3d_buttons(short event);
+void do_time_buttons(struct ScrArea *sa, unsigned short event);
+void do_node_buttons(struct ScrArea *sa, unsigned short event);
+
+void do_headerbuttons(short event);
+
+/* header_ipo.c */
+void spaceipo_assign_ipo(struct SpaceIpo *si, struct Ipo *ipo);
+
+/* header_text.c */
+void do_text_editmenu_to3dmenu(void *arg, int event);
+void do_text_formatmenu_convert(void *arg, int event);
+
+/* header_info.c */
+void do_info_add_meshmenu(void *arg, int event);
+void do_info_add_curvemenu(void *arg, int event);
+void do_info_add_surfacemenu(void *arg, int event);
+void do_info_add_metamenu(void *arg, int event);
+void do_info_add_lampmenu(void *arg, int event);
+void do_info_addmenu(void *arg, int event);
+
+/* header_node.c */
+void do_node_addmenu(void *arg, int event);
+
+/* header_view3d.c */
+void do_view3d_select_objectmenu(void *arg, int event);
+void do_view3d_select_object_groupedmenu(void *arg, int event);
+void do_view3d_select_object_linkedmenu(void *arg, int event);
+void do_view3d_select_object_layermenu(void *arg, int event);
+void do_view3d_select_object_typemenu(void *arg, int event);
+void do_view3d_select_faceselmenu(void *arg, int event);
+void do_view3d_select_meshmenu(void *arg, int event);
+void do_view3d_select_curvemenu(void *arg, int event);
+void do_view3d_select_metaballmenu(void *arg, int event);
+void do_view3d_edit_snapmenu(void *arg, int event);
+void do_view3d_edit_mirrormenu(void *arg, int event);
+void do_view3d_transform_moveaxismenu(void *arg, int event);
+void do_view3d_transform_rotateaxismenu(void *arg, int event);
+void do_view3d_transform_scaleaxismenu(void *arg, int event);
+void do_view3d_object_mirrormenu(void *arg, int event);
+void do_view3d_edit_mesh_normalsmenu(void *arg, int event);
+void do_view3d_edit_mesh_verticesmenu(void *arg, int event);
+void do_view3d_edit_mesh_edgesmenu(void *arg, int event);
+void do_view3d_edit_mesh_facesmenu(void *arg, int event);
+void do_view3d_edit_curve_segmentsmenu(void *arg, int event);
+void do_view3d_edit_curve_showhidemenu(void *arg, int event);
+
+#endif /* BSE_HEADERBUTTONS_H */
diff --git a/source/blender/editors/include/BSE_node.h b/source/blender/editors/include/BSE_node.h
new file mode 100644
index 00000000000..171a277e8e6
--- /dev/null
+++ b/source/blender/editors/include/BSE_node.h
@@ -0,0 +1,137 @@
+/**
+ * $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 opt ion) 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2005 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL BLOCK *****
+ */
+
+#ifndef BSE_NODE_H
+#define BSE_NODE_H
+
+/* ********** drawing sizes *********** */
+#define NODE_DY 20
+#define NODE_DYS 10
+#define NODE_SOCKSIZE 5
+#define BASIS_RAD 8.0f
+#define HIDDEN_RAD 15.0f
+
+
+struct SpaceNode;
+struct bNode;
+struct bNodeTree;
+struct Material;
+struct ID;
+struct Scene;
+struct Image;
+struct ImageUser;
+
+/* ************* API for editnode.c *********** */
+
+ /* helper calls to retreive active context for buttons, does groups */
+struct Material *editnode_get_active_material(struct Material *ma);
+struct bNode *editnode_get_active_idnode(struct bNodeTree *ntree, short id_code);
+struct bNode *editnode_get_active(struct bNodeTree *ntree);
+
+void snode_tag_dirty(struct SpaceNode *snode);
+
+void snode_set_context(struct SpaceNode *snode);
+
+void snode_home(struct ScrArea *sa, struct SpaceNode *snode);
+void snode_zoom_in(struct ScrArea *sa);
+void snode_zoom_out(struct ScrArea *sa);
+
+void node_deselectall(struct SpaceNode *snode, int swap);
+void node_border_select(struct SpaceNode *snode);
+
+void node_delete(struct SpaceNode *snode);
+void node_make_group(struct SpaceNode *snode);
+void node_ungroup(struct SpaceNode *snode);
+void snode_make_group_editable(struct SpaceNode *snode, struct bNode *gnode);
+void node_hide(struct SpaceNode *snode);
+void node_read_renderlayers(struct SpaceNode *snode);
+void clear_scene_in_nodes(struct Scene *sce);
+
+void node_transform_ext(int mode, int unused);
+void node_shader_default(struct Material *ma);
+void node_composit_default(struct Scene *scene);
+
+int node_has_hidden_sockets(struct bNode *node);
+
+struct bNode *node_add_node(struct SpaceNode *snode, int type, float locx, float locy);
+void node_adduplicate(struct SpaceNode *snode);
+
+void snode_autoconnect(struct SpaceNode *snode, struct bNode *node_to, int flag);
+void node_select_linked(struct SpaceNode *snode, int out);
+
+struct ImageUser *ntree_get_active_iuser(struct bNodeTree *ntree);
+
+void imagepaint_composite_tags(struct bNodeTree *ntree, struct Image *image, struct ImageUser *iuser);
+
+
+
+/* ************* drawnode.c *************** */
+struct SpaceNode;
+struct bNodeLink;
+void node_draw_link(struct SpaceNode *snode, struct bNodeLink *link);
+
+void init_node_butfuncs(void);
+
+/* exported to CMP and SHD nodes */
+//void node_ID_title_cb(void *node_v, void *unused_v);
+//void node_but_title_cb(void *node_v, void *but_v);
+//void node_texmap_cb(void *texmap_v, void *unused_v);
+//void node_new_mat_cb(void *ntree_v, void *node_v);
+//void node_browse_mat_cb(void *ntree_v, void *node_v);
+//void node_mat_alone_cb(void *node_v, void *unused);
+
+
+//void node_browse_image_cb(void *ntree_v, void *node_v);
+//void node_active_cb(void *ntree_v, void *node_v);
+//void node_image_type_cb(void *node_v, void *unused);
+//char *node_image_type_pup(void);
+//char *layer_menu(struct RenderResult *rr);
+//void image_layer_cb(void *ima_v, void *iuser_v);
+//void set_render_layers_title(void *node_v, void *unused);
+//char *scene_layer_menu(struct Scene *sce);
+//void node_browse_scene_cb(void *ntree_v, void *node_v);
+
+
+//int node_buts_curvevec(struct uiBlock *block, struct bNodeTree *ntree, struct bNode *node, struct rctf *butr);
+//int node_buts_curvecol(struct uiBlock *block, struct bNodeTree *ntree, struct bNode *node, struct rctf *butr);
+//int node_buts_rgb(struct uiBlock *block, struct bNodeTree *ntree, struct bNode *node, struct rctf *butr);
+//int node_buts_texture(struct uiBlock *block, struct bNodeTree *ntree, struct bNode *node, struct rctf *butr);
+//int node_buts_valtorgb(struct uiBlock *block, struct bNodeTree *ntree, struct bNode *node, struct rctf *butr);
+//int node_buts_value(struct uiBlock *block, struct bNodeTree *ntree, struct bNode *node, struct rctf *butr);
+//int node_buts_mix_rgb(struct uiBlock *block, struct bNodeTree *ntree, struct bNode *node, struct rctf *butr);
+//int node_buts_group(struct uiBlock *block, struct bNodeTree *ntree, struct bNode *node, struct rctf *butr);
+//int node_buts_normal(struct uiBlock *block, struct bNodeTree *ntree, struct bNode *node, struct rctf *butr);
+//int node_buts_math(struct uiBlock *block, struct bNodeTree *ntree, struct bNode *node, struct rctf *butr) ;
+
+
+/* ************* Shader nodes ***************** */
+
+
+#endif
+
diff --git a/source/blender/editors/include/BSE_seqaudio.h b/source/blender/editors/include/BSE_seqaudio.h
new file mode 100644
index 00000000000..985c4be73d2
--- /dev/null
+++ b/source/blender/editors/include/BSE_seqaudio.h
@@ -0,0 +1,53 @@
+/**
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2003 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ *
+ */
+
+#ifndef BSE_SEQAUDIO_H
+#define BSE_SEQAUDIO_H
+
+#include "SDL.h"
+/* muha, we don't init (no SDL_main)! */
+#ifdef main
+# undef main
+#endif
+
+#include "DNA_sound_types.h"
+
+void audio_mixdown();
+void audio_makestream(bSound *sound);
+void audiostream_play(Uint32 startframe, Uint32 duration, int mixdown);
+void audiostream_fill(Uint8* mixdown, int len);
+void audiostream_start(Uint32 frame);
+void audiostream_scrub(Uint32 frame);
+void audiostream_stop(void);
+int audiostream_pos(void);
+
+#endif
+
diff --git a/source/blender/editors/include/BSE_seqeffects.h b/source/blender/editors/include/BSE_seqeffects.h
new file mode 100644
index 00000000000..f76906bec50
--- /dev/null
+++ b/source/blender/editors/include/BSE_seqeffects.h
@@ -0,0 +1,96 @@
+/**
+ * $Id: BSE_seqeffects.h 9554 2006-12-31 15:38:14Z schlaile $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Peter Schlaile < peter [at] schlaile [dot] de >
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ *
+ */
+
+#ifndef BSE_SEQUENCE_EFFECTS_H
+#define BSE_SEQUENCE_EFFECTS_H
+
+/* Wipe effect */
+enum {DO_SINGLE_WIPE, DO_DOUBLE_WIPE, DO_BOX_WIPE, DO_CROSS_WIPE,
+ DO_IRIS_WIPE,DO_CLOCK_WIPE};
+
+struct Sequence;
+struct ImBuf;
+
+struct SeqEffectHandle {
+ /* constructors & destructor */
+ /* init & init_plugin are _only_ called on first creation */
+ void (*init)(struct Sequence *seq);
+ void (*init_plugin)(struct Sequence * seq, const char * fname);
+
+ /* number of input strips needed
+ (called directly after construction) */
+ int (*num_inputs)();
+
+ /* load is called first time after readblenfile in
+ get_sequence_effect automatically */
+ void (*load)(struct Sequence *seq);
+
+ /* duplicate */
+ void (*copy)(struct Sequence *dst, struct Sequence * src);
+
+ /* destruct */
+ void (*free)(struct Sequence *seq);
+
+ /* returns: -1: no input needed,
+ 0: no early out,
+ 1: out = ibuf1,
+ 2: out = ibuf2 */
+ int (*early_out)(struct Sequence *seq,
+ float facf0, float facf1);
+
+ /* stores the y-range of the effect IPO */
+ void (*store_icu_yrange)(struct Sequence * seq,
+ short adrcode, float * ymin, float * ymax);
+
+ /* stores the default facf0 and facf1 if no IPO is present */
+ void (*get_default_fac)(struct Sequence * seq, int cfra,
+ float * facf0, float * facf1);
+
+ /* execute the effect
+ sequence effects are only required to either support
+ float-rects or byte-rects
+ (mixed cases are handled one layer up...) */
+
+ void (*execute)(struct Sequence *seq, int cfra,
+ float facf0, float facf1,
+ int x, int y,
+ struct ImBuf *ibuf1, struct ImBuf *ibuf2,
+ struct ImBuf *ibuf3, struct ImBuf *out);
+};
+
+struct SeqEffectHandle get_sequence_effect(struct Sequence * seq);
+int get_sequence_effect_num_inputs(int seq_type);
+void sequence_effect_speed_rebuild_map(struct Sequence * seq, int force);
+
+#endif
+
diff --git a/source/blender/editors/include/BSE_seqscopes.h b/source/blender/editors/include/BSE_seqscopes.h
new file mode 100644
index 00000000000..ac803100b8a
--- /dev/null
+++ b/source/blender/editors/include/BSE_seqscopes.h
@@ -0,0 +1,38 @@
+/**
+ * $Id: BSE_seqscopes.h 6983 2006-03-07 20:01:12Z schlaile $
+ *
+ * ***** 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Author: Peter Schlaile < peter [at] schlaile [dot] de >
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ *
+ */
+
+#ifndef BSE_SEQUENCE_SCOPES_H
+#define BSE_SEQUENCE_SCOPES_H
+
+struct ImBuf;
+
+struct ImBuf *make_waveform_view_from_ibuf(struct ImBuf * ibuf);
+struct ImBuf *make_vectorscope_view_from_ibuf(struct ImBuf * ibuf);
+
+#endif
+
diff --git a/source/blender/editors/include/BSE_sequence.h b/source/blender/editors/include/BSE_sequence.h
new file mode 100644
index 00000000000..28143828568
--- /dev/null
+++ b/source/blender/editors/include/BSE_sequence.h
@@ -0,0 +1,89 @@
+/**
+ * $Id: BSE_sequence.h 12615 2007-11-18 17:39:30Z schlaile $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ *
+ */
+
+#ifndef BSE_SEQUENCE_H
+#define BSE_SEQUENCE_H
+
+
+struct PluginSeq;
+struct StripElem;
+struct TStripElem;
+struct Strip;
+struct Sequence;
+struct ListBase;
+struct Editing;
+struct ImBuf;
+struct Scene;
+
+void free_tstripdata(int len, struct TStripElem *se);
+void free_strip(struct Strip *strip);
+void new_tstripdata(struct Sequence *seq);
+void free_sequence(struct Sequence *seq);
+void build_seqar(struct ListBase *seqbase, struct Sequence ***seqar, int *totseq);
+void free_editing(struct Editing *ed);
+void calc_sequence(struct Sequence *seq);
+void calc_sequence_disp(struct Sequence *seq);
+void sort_seq(void);
+void clear_scene_in_allseqs(struct Scene *sce);
+
+int evaluate_seq_frame(int cfra);
+struct StripElem *give_stripelem(struct Sequence *seq, int cfra);
+struct TStripElem *give_tstripelem(struct Sequence *seq, int cfra);
+void set_meta_stripdata(struct Sequence *seqm);
+struct ImBuf *give_ibuf_seq(int rectx, int recty, int cfra, int chansel);
+/* chansel: render this channel. Default=0 (renders end result)*/
+struct ImBuf *give_ibuf_seq_direct(int rectx, int recty, int cfra,
+ struct Sequence * seq);
+
+/* sequence prefetch API */
+void seq_start_threads();
+void seq_stop_threads();
+void give_ibuf_prefetch_request(int rectx, int recty, int cfra, int chanshown);
+void seq_wait_for_prefetch_ready();
+struct ImBuf * give_ibuf_seq_threaded(int rectx, int recty, int cfra,
+ int chanshown);
+
+
+void free_imbuf_seq_except(int cfra);
+void free_imbuf_seq_with_ipo(struct Ipo * ipo);
+void free_imbuf_seq(void);
+
+void update_changed_seq_and_deps(struct Sequence *seq, int len_change, int ibuf_change);
+
+/* still bad level call... */
+struct RenderResult;
+void do_render_seq(struct RenderResult *rr, int cfra);
+
+
+#endif
+
diff --git a/source/blender/editors/include/BSE_time.h b/source/blender/editors/include/BSE_time.h
new file mode 100644
index 00000000000..d5cff9f5e5f
--- /dev/null
+++ b/source/blender/editors/include/BSE_time.h
@@ -0,0 +1,71 @@
+/**
+ * $Id:
+ *
+ * ***** BEGIN GPL/BL DUAL 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 opt ion) any later version. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2005 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BSE_TIME_H
+#define BSE_TIME_H
+
+struct ListBase;
+struct View2D;
+
+/* ******** Markers - General Api ********* */
+void add_marker(int frame);
+void duplicate_marker(void);
+void remove_marker(void);
+void rename_marker(void);
+void transform_markers(int mode, int smode);
+
+void borderselect_markers(void);
+void deselect_markers(short test, short sel);
+struct TimeMarker *find_nearest_marker(int clip_y);
+
+void nextprev_marker(short dir);
+void get_minmax_markers(short sel, float *first, float *last);
+int find_nearest_marker_time(float dx);
+
+void add_marker_to_cfra_elem(struct ListBase *lb, struct TimeMarker *marker, short only_sel);
+void make_marker_cfra_list(struct ListBase *lb, short only_sel);
+
+void draw_markers_timespace(int lines);
+TimeMarker *get_frame_marker(int frame);
+
+/* ******** Animation - Preview Range ************* */
+void anim_previewrange_set(void);
+void anim_previewrange_clear(void);
+
+void draw_anim_preview_timespace(void);
+
+/* *********** TimeLine Specific ***************/
+void timeline_frame_to_center(void);
+void nextprev_timeline_key(short dir);
+
+#endif
+
diff --git a/source/blender/editors/include/BSE_trans_types.h b/source/blender/editors/include/BSE_trans_types.h
new file mode 100644
index 00000000000..5513c3c5fe3
--- /dev/null
+++ b/source/blender/editors/include/BSE_trans_types.h
@@ -0,0 +1,90 @@
+/**
+ * $Id: BSE_trans_types.h 12441 2007-10-31 13:56:07Z ton $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef BSE_TRANS_TYPES_H
+#define BSE_TRANS_TYPES_H
+
+struct Object;
+struct MDeformVert;
+struct ColorBand;
+
+typedef struct TransOb {
+ float *loc;
+ float oldloc[9];
+ float *eff;
+ float oldeff[3];
+ float *rot;
+ float oldrot[12];
+ float olddrot[3];
+ float *quat;
+ float oldquat[16];
+ float olddquat[4];
+ float *size;
+ float oldsize[12];
+ float olddsize[3];
+ float obmat[3][3];
+ float obinv[3][3];
+ float parmat[3][3];
+ float parinv[3][3];
+ float obvec[3];
+ int flag; /* keys */
+ float *locx, *locy, *locz;
+ float *rotx, *roty, *rotz;
+ float *quatx, *quaty, *quatz, *quatw;
+ float *sizex, *sizey, *sizez;
+ /* __NLA */
+ float axismat[3][3]; /* Restmat of object (for localspace transforms) */
+ void *data; /* Arbitrary data */
+ /* end __NLA */
+ struct Object *ob;
+} TransOb;
+
+typedef struct TransVert {
+ float *loc;
+ float oldloc[3], fac;
+ float *val, oldval;
+ int flag;
+ float *nor;
+} TransVert;
+
+typedef struct VPaint {
+ float r, g, b, a;
+ float size; /* of brush */
+ float gamma, mul;
+ short mode, flag;
+ int tot, pad; /* allocation size of prev buffers */
+ unsigned int *vpaint_prev; /* previous mesh colors */
+ struct MDeformVert *wpaint_prev; /* previous vertex weights */
+} VPaint;
+
+#endif /* BSE_TRANS_TYPES_H */
+
diff --git a/source/blender/editors/include/BSE_types.h b/source/blender/editors/include/BSE_types.h
new file mode 100644
index 00000000000..b4b84c2dbf0
--- /dev/null
+++ b/source/blender/editors/include/BSE_types.h
@@ -0,0 +1,69 @@
+/**
+ * $Id: BSE_types.h 8957 2006-11-20 04:28:02Z blendix $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+/* forward declarations for some prototype header */
+/* these may wildly occur in other header files, too */
+
+struct BGpic;
+struct SpaceText;
+struct Oops;
+struct OopsLink;
+struct uiBlock;
+struct BoundBox;
+struct Image;
+struct ImBuf;
+struct SpaceImaSel;
+struct Sequence;
+struct Scene;
+struct IpoCurve;
+struct Ipo;
+struct IpoKey;
+struct Mesh;
+struct MTFace;
+struct Object;
+struct TransOb;
+struct TransVert;
+struct BPoint;
+struct BezTriple;
+
+struct Nurb;
+
+struct EditFace;
+struct EditVert;
+struct EditEdge;
+struct EditIpo;
+
+struct bArmature;
+struct Bone;
+
+/* interface crap */
+struct uiBut;
+
diff --git a/source/blender/editors/include/BSE_view.h b/source/blender/editors/include/BSE_view.h
new file mode 100644
index 00000000000..684113060f5
--- /dev/null
+++ b/source/blender/editors/include/BSE_view.h
@@ -0,0 +1,97 @@
+/**
+ * $Id: BSE_view.h 12237 2007-10-08 22:17:51Z broken $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ * protos for view.c -- not complete
+ */
+
+#ifndef BSE_VIEW_H
+#define BSE_VIEW_H
+
+struct Object;
+struct BoundBox;
+struct View3D;
+struct ScrArea;
+
+typedef struct ViewDepths {
+ unsigned short w, h;
+ float *depths;
+ double depth_range[2];
+
+ char damaged;
+} ViewDepths;
+
+#define PERSP_WIN 0
+#define PERSP_VIEW 1
+#define PERSP_STORE 2
+
+void persp_general(int a);
+void persp(int a);
+
+/* note, the define below is still used for shorts, to calc distances... */
+#define IS_CLIPPED 12000
+void view3d_get_object_project_mat(struct ScrArea *area, struct Object *ob, float pmat[4][4], float vmat[4][4]);
+void view3d_project_float(struct ScrArea *area, float *vec, float *adr, float mat[4][4]);
+void view3d_project_short_clip(struct ScrArea *area, float *vec, short *adr, float projmat[4][4], float viewmat[4][4]);
+void view3d_project_short_noclip(struct ScrArea *area, float *vec, short *adr, float mat[4][4]);
+
+void initgrabz(float x, float y, float z);
+void window_to_3d(float *vec, short mx, short my);
+void project_short(float *vec, short *adr);
+void project_short_noclip(float *vec, short *adr);
+void project_int(float *vec, int *adr);
+void project_float(float *vec, float *adr);
+
+int boundbox_clip(float obmat[][4], struct BoundBox *bb);
+void fdrawline(float x1, float y1, float x2, float y2);
+void fdrawbox(float x1, float y1, float x2, float y2);
+void sdrawline(short x1, short y1, short x2, short y2);
+void sdrawbox(short x1, short y1, short x2, short y2);
+void calctrackballvecfirst(struct rcti *area, short *mval, float *vec);
+void calctrackballvec(struct rcti *area, short *mval, float *vec);
+void viewmove(int mode);
+void view_zoom_mouseloc(float dfac, short *mouseloc);
+
+int get_view3d_viewplane(int winxi, int winyi, rctf *viewplane, float *clipsta, float *clipend, float *pixsize);
+void setwinmatrixview3d(int winx, int winy, struct rctf *rect);
+
+void obmat_to_viewmat(struct Object *ob, short smooth);
+void setviewmatrixview3d(void);
+float *give_cursor(void);
+unsigned int free_localbit(void);
+void initlocalview(void);
+void centerview(void);
+void restore_localviewdata(struct View3D *vd);
+void endlocalview(struct ScrArea *sa);
+void view3d_home(int center);
+short view3d_opengl_select(unsigned int *buffer, unsigned int buffsize, short x1, short y1, short x2, short y2);
+void view3d_align_axis_to_vector(struct View3D *v3d, int axisidx, float vec[3]);
+
+#endif
+
diff --git a/source/blender/editors/include/LOD_DependKludge.h b/source/blender/editors/include/LOD_DependKludge.h
new file mode 100644
index 00000000000..b844552f32a
--- /dev/null
+++ b/source/blender/editors/include/LOD_DependKludge.h
@@ -0,0 +1,40 @@
+/*
+ * $Id: LOD_DependKludge.h 229 2002-12-27 13:11:01Z mein $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ * Decimation file dependency fix (and kludge)
+ * Use together with a NAN_DECIMATIONTEST env.var. for Makefile-based linking
+ */
+#ifndef LOD_DEPENDKLUDGE_H
+#define LOD_DEPENDKLUDGE_H
+
+#define NAN_DECIMATION
+
+#endif //LOD_DEPENDKLUDGE_H
+
diff --git a/source/blender/editors/include/blendef.h b/source/blender/editors/include/blendef.h
new file mode 100644
index 00000000000..96bd6d10591
--- /dev/null
+++ b/source/blender/editors/include/blendef.h
@@ -0,0 +1,465 @@
+/* $Id: blendef.h 12752 2007-12-01 23:25:00Z campbellbarton $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+#ifndef BLENDEF_H
+#define BLENDEF_H
+
+
+/* **************** MAX ********************* */
+
+#define MAXFRAME 300000
+#define MAXFRAMEF 300000.0f
+
+#define MINFRAME 1
+#define MINFRAMEF 1.0
+
+/* max length material array, 16 because of bits in matfrom */
+#define MAXPICKBUF 10000
+#define MAXSEQ 32
+
+/* in buttons.c */
+#define MAX_EFFECT 20
+
+#ifndef MAXFLOAT
+#define MAXFLOAT ((float)3.40282347e+38)
+#endif
+
+/* also fill in structs itself, dna cannot handle defines, duplicate with utildefines.h still */
+#ifndef FILE_MAXDIR
+#define FILE_MAXDIR 160
+#define FILE_MAXFILE 80
+#endif
+
+
+#include <float.h>
+
+
+
+
+/* **************** GENERAL ********************* */
+
+// return values
+
+#define RET_OK 0
+#define RET_ERROR 1
+#define RET_CANCEL 2
+#define RET_YES (1 == 1)
+#define RET_NO (1 == 0)
+
+#if defined(__sgi) || defined(__sparc) || defined(__sparc__) || defined (__PPC__) || defined (__ppc__) || defined (__BIG_ENDIAN__)
+/* big endian */
+#define MAKE_ID2(c, d) ( (c)<<8 | (d) )
+#define MOST_SIG_BYTE 0
+#define BBIG_ENDIAN
+#else
+/* little endian */
+#define MAKE_ID2(c, d) ( (d)<<8 | (c) )
+#define MOST_SIG_BYTE 1
+#define BLITTLE_ENDIAN
+#endif
+
+#define SELECT 1
+#define HIDDEN 1
+#define FIRST 1
+#define ACTIVE 2
+/*#ifdef WITH_VERSE*/
+#define VERSE 3
+/*#endif*/
+#define DESELECT 0
+#define NOT_YET 0
+#define VISIBLE 0
+#define LAST 0
+
+#define TESTBASE(base) ( ((base)->flag & SELECT) && ((base)->lay & G.vd->lay) && (((base)->object->restrictflag & OB_RESTRICT_VIEW)==0) )
+#define TESTBASELIB(base) ( ((base)->flag & SELECT) && ((base)->lay & G.vd->lay) && ((base)->object->id.lib==0) && (((base)->object->restrictflag & OB_RESTRICT_VIEW)==0))
+#define BASE_SELECTABLE(base) ((base->lay & G.vd->lay) && (base->object->restrictflag & (OB_RESTRICT_SELECT|OB_RESTRICT_VIEW))==0)
+#define FIRSTBASE G.scene->base.first
+#define LASTBASE G.scene->base.last
+#define BASACT (G.scene->basact)
+#define OBACT (BASACT? BASACT->object: 0)
+#define ID_NEW(a) if( (a) && (a)->id.newid ) (a)= (void *)(a)->id.newid
+#define ID_NEW_US(a) if( (a)->id.newid) {(a)= (void *)(a)->id.newid; (a)->id.us++;}
+#define ID_NEW_US2(a) if( ((ID *)a)->newid) {(a)= ((ID *)a)->newid; ((ID *)a)->us++;}
+#define CFRA (G.scene->r.cfra)
+#define F_CFRA ((float)(G.scene->r.cfra))
+#define SFRA (G.scene->r.sfra)
+#define EFRA (G.scene->r.efra)
+#define PSFRA ((G.scene->r.psfra != 0)? (G.scene->r.psfra): (G.scene->r.sfra))
+#define PEFRA ((G.scene->r.psfra != 0)? (G.scene->r.pefra): (G.scene->r.efra))
+#define FRA2TIME(a) ((((double) G.scene->r.frs_sec_base) * (a)) / G.scene->r.frs_sec)
+#define TIME2FRA(a) ((((double) G.scene->r.frs_sec) * (a)) / G.scene->r.frs_sec_base)
+#define FPS (((double) G.scene->r.frs_sec) / G.scene->r.frs_sec_base)
+
+#define ISPOIN(a, b, c) ( (a->b) && (a->c) )
+#define ISPOIN3(a, b, c, d) ( (a->b) && (a->c) && (a->d) )
+#define ISPOIN4(a, b, c, d, e) ( (a->b) && (a->c) && (a->d) && (a->e) )
+
+#define BEZSELECTED(bezt) (((bezt)->f1 & 1) || ((bezt)->f2 & 1) || ((bezt)->f3 & 1))
+/* for curve objects in editmode that can have hidden handles - may use for IPO's later */
+#define BEZSELECTED_HIDDENHANDLES(bezt) ((G.f & G_HIDDENHANDLES) ? (bezt)->f2 & 1 : BEZSELECTED(bezt))
+
+/* psfont */
+#define FNT_PDRAW 1
+#define FNT_HAEBERLI 2
+
+/* getbutton */
+
+/* do_global_buttons(event) */
+
+// (first event)
+#define B_LOCAL_ALONE 20
+
+
+#define B_ACTLOCAL 24 /* __NLA */
+#define B_ACTALONE 25 /* __NLA */
+#define B_ARMLOCAL 26 /* __NLA */
+#define B_ARMALONE 27 /* __NLA */
+
+#define B_WORLDLOCAL 28
+#define B_WORLDALONE 29
+#define B_LATTLOCAL 30
+#define B_MBALLLOCAL 31
+#define B_CAMERALOCAL 32
+#define B_OBLOCAL 33
+#define B_IPOLOCAL 34
+#define B_LAMPLOCAL 35
+#define B_MATLOCAL 36
+#define B_TEXLOCAL 37
+#define B_MESHLOCAL 38
+#define B_CURVELOCAL 39
+
+#define B_LATTALONE 40
+#define B_MBALLALONE 41
+#define B_CAMERAALONE 42
+#define B_OBALONE 43
+#define B_IPOALONE 44
+#define B_LAMPALONE 45
+#define B_MATALONE 46
+#define B_TEXALONE 47
+#define B_MESHALONE 48
+#define B_CURVEALONE 49
+
+/* EVENT < 50: alones en locals */
+
+#define B_KEEPDATA 60
+#define B_CONSOLETOG 61
+#define B_DRAWINFO 62
+#define B_REDRCURW3D 63
+#define B_FLIPINFOMENU 64
+#define B_FLIPFULLSCREEN 65
+#define B_PLAINMENUS 66
+
+
+#define B_GLRESLIMITCHANGED 69
+#define B_SHOWSPLASH 70
+#define B_RESETAUTOSAVE 71
+#define B_SOUNDTOGGLE 72
+#define B_MIPMAPCHANGED 73
+#define B_CONSTRAINTBROWSE 74 /* __NLA */
+#define B_ACTIONDELETE 75 /* __NLA */
+#define B_ACTIONBROWSE 76 /* __NLA */
+#define B_IMAGEDELETE 77
+#define B_LTEXBROWSE 78
+#define B_MESHBROWSE 79
+#define B_EXTEXBROWSE 80
+#define B_LOADTEMP 81
+#define B_MATDELETE 82
+#define B_TEXDELETE 83
+#define B_IPODELETE 84
+#define B_WORLDDELETE 85
+#define B_WTEXBROWSE 86
+#define B_WORLDBROWSE 87
+#define B_IPOBROWSE 88
+#define B_NEWFRAME 89
+#define B_LAMPBROWSE 90
+#define B_MATBROWSE 91
+#define B_TEXBROWSE 92
+#define B_EDITBROWSE 93
+#define B_AUTOTEXNAME 94
+#define B_AUTOMATNAME 95
+#define B_MATLOCK 96
+#define B_IDNAME 97
+#define B_NEWSPACE 98
+#define B_FULL 99
+#define B_REDR 100
+
+
+/* VIEW3D: 100 */
+#define B_HOME 101
+#define B_LAY 102
+/* watch: codes 102-132 in in use for layers */
+#define B_AUTOKEY 139
+#define B_SCENELOCK 140
+#define B_LOCALVIEW 141
+#define B_U_CAPSLOCK 142
+
+#define B_VIEWBUT 146
+#define B_PERSP 147
+#define B_PROPTOOL 148
+#define B_VIEWRENDER 149
+#define B_STARTGAME 150
+
+#define B_MODESELECT 156
+#define B_AROUND 157
+#define B_SEL_VERT 158
+#define B_SEL_EDGE 159
+#define B_SEL_FACE 160
+#define B_MAN_TRANS 161
+#define B_MAN_ROT 162
+#define B_MAN_SCALE 163
+#define B_SEL_PATH 166
+#define B_SEL_POINT 167
+#define B_SEL_END 168
+
+/* IPO: 200 */
+#define B_IPOHOME 201
+#define B_IPOBORDER 202
+#define B_IPOCOPY 203
+#define B_IPOPASTE 204
+#define B_IPOCONT 205
+#define B_IPOEXTRAP 206
+#define B_IPOCYCLIC 207
+#define B_IPOMAIN 208
+#define B_IPOSHOWKEY 209
+#define B_IPOCYCLICX 210
+ /* warn: also used for oops and seq */
+#define B_VIEW2DZOOM 211
+#define B_IPOPIN 212
+#define B_IPO_ACTION_OB 213
+#define B_IPO_ACTION_KEY 214
+#define B_IPOVIEWCENTER 215
+#define B_IPOVIEWALL 216
+#define B_IPOREDRAW 217
+
+/* OOPS: 250 */
+#define B_OOPSHOME 251
+#define B_OOPSBORDER 252
+#define B_NEWOOPS 253
+#define B_OOPSVIEWSEL 254
+
+/* INFO: 300 */
+/* watch: also in filesel.c and editobject.c */
+#define B_INFOSCR 301
+#define B_INFODELSCR 302
+#define B_INFOSCE 304
+#define B_INFODELSCE 305
+#define B_FILEMENU 306
+#define B_PACKFILE 307
+
+#define B_CONSOLEOUT 308
+#define B_CONSOLENUMLINES 309
+#define B_USERPREF 310
+#define B_LOADUIFONT 311
+#define B_SETLANGUAGE 312
+#define B_SETFONTSIZE 313
+#define B_SETENCODING 314
+#define B_SETTRANSBUTS 315
+#define B_DOLANGUIFONT 316
+#define B_RESTOREFONT 317
+#define B_USETEXTUREFONT 318
+
+#define B_UITHEMECHANGED 320
+#define B_UITHEMECOLORMOD 321
+#define B_UITHEMERESET 322
+#define B_UITHEMEIMPORT 323
+#define B_UITHEMEEXPORT 324
+
+#define B_MEMCACHELIMIT 325
+#define B_WPAINT_RANGE 326
+
+/* Definitions for the fileselect buttons in user prefs */
+#define B_FONTDIRFILESEL 330
+#define B_TEXTUDIRFILESEL 331
+#define B_PLUGTEXDIRFILESEL 332
+#define B_PLUGSEQDIRFILESEL 333
+#define B_RENDERDIRFILESEL 334
+#define B_PYTHONDIRFILESEL 335
+#define B_SOUNDDIRFILESEL 336
+#define B_TEMPDIRFILESEL 337
+/* yafray: for exportdir select */
+#define B_YAFRAYDIRFILESEL 338
+#define B_PYMENUEVAL 339 /* re-eval scripts registration in menus */
+/* END Definitions for the fileselect buttons in user prefs */
+
+/* IMAGE: 350 */
+#define B_SIMAGEHOME 351
+#define B_SIMABROWSE 352
+#define B_SIMAGELOAD 353
+#define B_SIMA_REDR_IMA_3D 354
+#define B_SIMAGETILE 355
+#define B_BE_SQUARE 356
+#define B_TWINANIM 357
+#define B_SIMAGEREPLACE 358
+#define B_CLIP_UV 359
+#define B_SIMAGELOAD1 360
+#define B_SIMAGEREPLACE1 361
+#define B_SIMAGEPAINTTOOL 362
+#define B_SIMAPACKIMA 363
+#define B_SIMAGESAVE 364
+#define B_SIMACLONEBROWSE 365
+#define B_SIMACLONEDELETE 366
+#define B_SIMANOTHING 368
+#define B_SIMACURVES 369
+#define B_SIMARANGE 370
+#define B_SIMA_USE_ALPHA 371
+#define B_SIMA_SHOW_ALPHA 372
+#define B_SIMA_SHOW_ZBUF 373
+#define B_SIMABRUSHBROWSE 374
+#define B_SIMABRUSHDELETE 375
+#define B_SIMABRUSHLOCAL 376
+#define B_SIMABRUSHCHANGE 377
+#define B_SIMABTEXBROWSE 378
+#define B_SIMABTEXDELETE 379
+#define B_SIMARELOAD 380
+#define B_SIMANAME 381
+#define B_SIMAMULTI 382
+#define B_TRANS_IMAGE 383
+#define B_CURSOR_IMAGE 384
+#define B_SIMA_REPACK 385
+#define B_SIMA_PLAY 386
+#define B_SIMA_RECORD 387
+#define B_SIMAPIN 388
+#define B_SIMA3DVIEWDRAW 389
+
+
+/* BUTS: 400 */
+#define B_BUTSHOME 401
+#define B_BUTSPREVIEW 402
+#define B_MATCOPY 403
+#define B_MATPASTE 404
+#define B_MESHTYPE 405
+#define B_CONTEXT_SWITCH 406
+
+/* IMASEL: 450 */
+/* in imasel.h - not any more - elubie */
+#define B_SORTIMASELLIST 451
+#define B_RELOADIMASELDIR 452
+#define B_FILTERIMASELDIR 453
+
+/* TEXT: 500 */
+#define B_TEXTBROWSE 501
+#define B_TEXTALONE 502
+#define B_TEXTLOCAL 503
+#define B_TEXTDELETE 504
+#define B_TEXTFONT 505
+#define B_TEXTSTORE 506
+#define B_TEXTLINENUM 507
+#define B_TAB_NUMBERS 508
+#define B_SYNTAX 509
+
+/* SCRIPT: 525 */
+#define B_SCRIPTBROWSE 526
+#define B_SCRIPT2PREV 527
+
+/* FILE: 550 */
+#define B_SORTFILELIST 551
+#define B_RELOADDIR 552
+
+/* SEQUENCE: 600 */
+#define B_SEQHOME 601
+#define B_SEQCLEAR 602
+
+/* SOUND: 650 */
+#define B_SOUNDBROWSE 651
+#define B_SOUNDBROWSE2 652
+#define B_SOUNDHOME 653
+#define B_PACKSOUND 654
+
+/* ACTION: 701 - 750 */
+#define B_ACTHOME 701
+#define B_ACTCOPY 702
+#define B_ACTPASTE 703
+#define B_ACTPASTEFLIP 704
+#define B_ACTCYCLIC 705
+#define B_ACTCONT 706
+#define B_ACTMAIN 707
+#define B_ACTPIN 708
+#define B_ACTBAKE 709
+#define B_ACTCOPYKEYS 710
+#define B_ACTPASTEKEYS 711
+
+/* TIME: 751 - 800 */
+#define B_TL_REW 751
+#define B_TL_PLAY 752
+#define B_TL_FF 753
+#define B_TL_PREVKEY 754
+#define B_TL_NEXTKEY 755
+#define B_TL_STOP 756
+#define B_TL_PREVIEWON 757
+
+/* NLA: 801-850 */
+#define B_NLAHOME 801
+
+/* NODE: 851-900 */
+#define B_NODEHOME 851
+#define B_NODE_USEMAT 852
+#define B_NODE_USESCENE 853
+
+/* FREE 901 - 999 */
+
+
+#define B_NOP -1
+
+
+/* editbutflag */
+#define B_CLOCKWISE 1
+#define B_KEEPORIG 2
+#define B_BEAUTY 4
+#define B_SMOOTH 8
+#define B_BEAUTY_SHORT 16
+#define B_AUTOFGON 32
+#define B_KNIFE 0x80
+#define B_PERCENTSUBD 0x40
+#define B_MESH_X_MIRROR 0x100
+#define B_JOINTRIA_UV 0x200
+#define B_JOINTRIA_VCOL 0X400
+#define B_JOINTRIA_SHARP 0X800
+#define B_JOINTRIA_MAT 0X1000
+
+/* DISPLAYMODE */
+#define R_DISPLAYIMAGE 0
+#define R_DISPLAYWIN 1
+#define R_DISPLAYSCREEN 2
+
+/* Gvp.flag and Gwp.flag */
+#define VP_COLINDEX 1
+#define VP_AREA 2
+#define VP_SOFT 4
+#define VP_NORMALS 8
+#define VP_SPRAY 16
+#define VP_MIRROR_X 32
+#define VP_HARD 64
+#define VP_ONLYVGROUP 128
+
+/* Error messages */
+#define ERROR_LIBDATA_MESSAGE "Can't edit external libdata"
+
+
+#endif
diff --git a/source/blender/editors/include/butspace.h b/source/blender/editors/include/butspace.h
new file mode 100644
index 00000000000..e48ca941a13
--- /dev/null
+++ b/source/blender/editors/include/butspace.h
@@ -0,0 +1,762 @@
+/**
+ * $Id: butspace.h 12708 2007-11-28 18:43:09Z ton $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+#ifndef BUTSPACE_H
+#define BUTSPACE_H
+
+/* all internal calls and event codes for buttons space */
+
+struct Base;
+struct Object;
+struct ID;
+struct ColorBand;
+struct uiBlock;
+struct rctf;
+struct CurveMap;
+struct ImageUser;
+struct RenderResult;
+struct Image;
+
+/* buts->scaflag */
+#define BUTS_SENS_SEL 1
+#define BUTS_SENS_ACT 2
+#define BUTS_SENS_LINK 4
+#define BUTS_CONT_SEL 8
+#define BUTS_CONT_ACT 16
+#define BUTS_CONT_LINK 32
+#define BUTS_ACT_SEL 64
+#define BUTS_ACT_ACT 128
+#define BUTS_ACT_LINK 256
+
+/* internal */
+
+/* scene */
+extern void render_panels(void);
+extern void do_render_panels(unsigned short event);
+extern void anim_panels(void);
+extern void sound_panels(void);
+extern void do_soundbuts(unsigned short event);
+
+/* object */
+extern void object_panels(void);
+extern void physics_panels(void);
+extern void particle_panels(void);
+extern void do_object_panels(unsigned short event);
+extern void do_constraintbuts(unsigned short event);
+extern void object_panel_constraint(char *context);
+extern void autocomplete_bone(char *str, void *arg_v);
+extern void autocomplete_vgroup(char *str, void *arg_v);
+
+/* effects */
+extern void effects_panels(void);
+extern void do_effects_panels(unsigned short event);
+
+/* modifiers */
+extern int mod_moveUp(void *ob_v, void *md_v);
+extern int mod_moveDown(void *ob_v, void *md_v);
+
+/* constraint */
+extern void const_moveUp(void *ob_v, void *con_v);
+extern void const_moveDown(void *ob_v, void *con_v);
+extern void del_constr_func (void *ob_v, void *con_v);
+
+/* editing */
+extern void editing_panels(void);
+extern void do_common_editbuts(unsigned short event);
+extern void do_meshbuts(unsigned short event);
+extern void do_vgroupbuts(unsigned short event);
+extern void do_curvebuts(unsigned short event);
+extern void do_fontbuts(unsigned short event);
+extern void do_mballbuts(unsigned short event);
+extern void do_latticebuts(unsigned short event);
+extern void do_fpaintbuts(unsigned short event);
+extern void do_cambuts(unsigned short event);
+extern void do_armbuts(unsigned short event);
+extern void do_uvcalculationbuts(unsigned short event);
+extern void weight_paint_buttons(struct uiBlock *);
+extern void particle_edit_buttons(struct uiBlock *);
+
+extern char *get_vertexgroup_menustr(struct Object *ob); // used in object buttons
+
+/* shading */
+extern void draw_colorband_buts_small(struct uiBlock *block, struct ColorBand *coba, rctf *rct, int event);
+extern void material_panels(void);
+extern void do_matbuts(unsigned short event);
+extern void lamp_panels(void);
+extern void do_lampbuts(unsigned short event);
+extern void world_panels(void);
+extern void do_worldbuts(unsigned short event);
+extern void radio_panels(void);
+extern void do_radiobuts(unsigned short event);
+extern void texture_panels(void);
+extern void do_texbuts(unsigned short event);
+void uiblock_image_panel(struct uiBlock *block, struct Image **ima_pp, struct ImageUser *iuser,
+ short redraw, short imagechanged);
+void uiblock_layer_pass_buttons(struct uiBlock *block, struct RenderResult *rr,
+ struct ImageUser *iuser, int event, int x, int y, int w);
+
+/* logic */
+extern void do_logic_buts(unsigned short event);
+extern void logic_buts(void);
+
+/* script */
+extern void script_panels(void);
+extern void do_scriptbuts(unsigned short event);
+
+/* ipowindow */
+extern void do_ipobuts(unsigned short event); // drawipo.c (bad! ton)
+
+/* butspace.c */
+void test_meshpoin_but(char *name, struct ID **idpp);
+void test_obpoin_but(char *name, struct ID **idpp);
+void test_meshobpoin_but(char *name, struct ID **idpp);
+void test_scenepoin_but(char *name, struct ID **idpp);
+void test_matpoin_but(char *name, struct ID **idpp);
+void test_scriptpoin_but(char *name, struct ID **idpp);
+void test_actionpoin_but(char *name, ID **idpp);
+void test_grouppoin_but(char *name, ID **idpp);
+void test_texpoin_but(char *name, ID **idpp);
+void test_imapoin_but(char *name, ID **idpp);
+
+void test_idbutton_cb(void *namev, void *arg2_unused);
+
+struct CurveMapping;
+void curvemap_buttons(struct uiBlock *block, struct CurveMapping *cumap, char labeltype, short event, short redraw, struct rctf *rect);
+
+/* -------------- internal event defines ------------ */
+
+
+#define B_DIFF 1
+
+/* *********************** */
+#define B_VIEWBUTS 1100
+
+#define B_OBJECTPANELROT 1007
+#define B_OBJECTPANELMEDIAN 1008
+#define B_ARMATUREPANEL1 1009
+#define B_ARMATUREPANEL2 1010
+#define B_OBJECTPANELPARENT 1011
+#define B_OBJECTPANEL 1012
+#define B_ARMATUREPANEL3 1013
+#define B_OBJECTPANELSCALE 1014
+#define B_OBJECTPANELDIMS 1015
+
+/* *********************** */
+#define B_LAMPBUTS 1200
+
+#define B_LAMPREDRAW 1101
+#define B_COLLAMP 1102
+#define B_TEXCLEARLAMP 1103
+#define B_SBUFF 1104
+#define B_SHADBUF 1105
+#define B_SHADRAY 1106
+#define B_LMTEXPASTE 1107
+#define B_LMTEXCOPY 1108
+#define B_LFALLOFFCHANGED 1109
+
+/* *********************** */
+#define B_MATBUTS 1300
+
+#define B_MATCOL 1201
+#define B_SPECCOL 1202
+#define B_MIRCOL 1203
+#define B_ACTCOL 1204
+#define B_MATFROM 1205
+#define B_MATPRV 1206
+#define B_LAMPPRV 1207
+#define B_WORLDPRV 1208
+#define B_MTEXCOL 1210
+#define B_TEXCLEAR 1211
+#define B_MTEXPASTE 1212
+#define B_MTEXCOPY 1213
+#define B_MATLAY 1214
+#define B_MATHALO 1215
+#define B_MATZTRANSP 1216
+#define B_MATRAYTRANSP 1217
+#define B_MATCOLORBAND 1218
+ /* yafray: material preset menu event */
+#define B_MAT_YF_PRESET 1219
+
+#define B_MAT_LAYERBROWSE 1220
+#define B_MAT_USENODES 1221
+#define B_MAT_VCOL_PAINT 1222
+#define B_MAT_VCOL_LIGHT 1223
+
+ /* world buttons: buttons-preview update, and redraw 3dview */
+#define B_WORLDPRV2 1224
+
+#define B_MAT_PARTICLE 1225
+
+/* *********************** */
+#define B_TEXBUTS 1400
+
+#define B_TEXTYPE 1301
+#define B_DEFTEXVAR 1302
+
+#define B_NAMEIMA 1304
+#define B_TEXCHANNEL 1305
+#define B_TEXREDR_PRV 1306
+#define B_IMAGECHANGED 1307
+
+#define B_LOADPLUGIN 1310
+#define B_NAMEPLUGIN 1311
+#define B_COLORBAND 1312
+#define B_ADDCOLORBAND 1313
+#define B_DELCOLORBAND 1314
+#define B_CALCCBAND 1315
+#define B_CALCCBAND2 1316
+#define B_DOCOLORBAND 1317
+#define B_REDRAWCBAND 1318
+#define B_BANDCOL 1319
+#define B_LOADTEXIMA1 1320
+#define B_TEXPRV 1321
+
+
+#define B_PLUGBUT 1325
+/* B_PLUGBUT reserves 24 buttons at least! */
+
+#define B_ENV_MAKE 1350
+#define B_ENV_FREE 1351
+#define B_ENV_DELETE 1352
+#define B_ENV_SAVE 1353
+#define B_ENV_OB 1354
+
+#define B_ENV_FREE_ALL 1357
+
+
+/* **************** animbuts = object buttons ******* */
+#define B_ANIMBUTS 1500
+
+#define B_RECALCPATH 1401
+#define B_TRACKBUTS 1402
+#define B_DUPLI_FRAME 1403
+#define B_DUPLI_VERTS 1404
+#define B_DUPLI_FACES 1405
+#define B_DUPLI_GROUP 1406
+
+
+#define B_PRINTSPEED 1413
+#define B_PRINTLEN 1414
+#define B_RELKEY 1415
+#define B_CURVECHECK 1416
+
+#define B_SOFTBODY_CHANGE 1420
+#define B_SOFTBODY_DEL_VG 1421
+#define B_SOFTBODY_BAKE 1422
+#define B_SOFTBODY_BAKE_FREE 1423
+
+/* this has MAX_EFFECT settings! Next free define is 1450... */
+#define B_SELEFFECT 1430
+
+/* Fluidsim button defines */
+#define B_FLUIDSIM_BAKE 1450
+#define B_FLUIDSIM_SELDIR 1451
+#define B_FLUIDSIM_FORCEREDRAW 1452
+#define B_FLUIDSIM_MAKEPART 1453
+
+#define B_GROUP_RELINK 1460
+#define B_OBJECT_IPOFLAG 1461
+
+#define B_BAKEABLE_CHANGE 1470
+
+/* *********************** */
+#define B_WORLDBUTS 1600
+
+#define B_TEXCLEARWORLD 1501
+#define B_COLHOR 1502
+#define B_COLZEN 1503
+#define B_WMTEXPASTE 1504
+#define B_WMTEXCOPY 1505
+#define B_AO_FALLOFF 1506
+
+/* *********************** */
+#define B_RENDERBUTS 1700
+
+#define B_FS_PIC 1601
+#define B_FS_BACKBUF 1602
+
+#define B_FS_FTYPE 1604
+#define B_DORENDER 1605
+#define B_DOANIM 1606
+#define B_PLAYANIM 1607
+#define B_PR_PAL 1608
+#define B_PR_FULL 1609
+#define B_PR_PRV 1610
+#define B_PR_HD 1611
+#define B_PR_PAL169 1612
+
+#define B_REDRAWDISP 1615
+#define B_SETBROWSE 1616
+#define B_CLEARSET 1617
+#define B_PR_PRESET 1618
+#define B_PR_PANO 1619
+#define B_PR_NTSC 1620
+
+#define B_IS_FTYPE 1622
+#define B_IS_BACKBUF 1623
+#define B_PR_PC 1624
+
+#define B_PR_PANO360 1627
+#define B_PR_HALFFIELDS 1628
+#define B_NEWRENDERPIPE 1629
+#define B_R_SCALE 1630
+#define B_G_SCALE 1631
+#define B_B_SCALE 1632
+#define B_USE_R_SCALE 1633
+#define B_USE_G_SCALE 1634
+#define B_USE_B_SCALE 1635
+#define B_EDGECOLSLI 1636
+#define B_GAMMASLI 1637
+
+#define B_FILETYPEMENU 1638
+#define B_SELECTCODEC 1639
+#define B_RTCHANGED 1640
+#define B_SWITCHRENDER 1641
+#define B_FBUF_REDO 1642
+
+#define B_SET_EDGE 1643
+#define B_SET_ZBLUR 1644
+#define B_ADD_RENDERLAYER 1645
+#define B_SET_PASS 1646
+
+/* *********************** */
+#define B_ARMATUREBUTS 1800
+#define B_POSE 1701
+
+/* *********************** */
+#define B_COMMONEDITBUTS 2049
+
+#define B_CHANGEDEP 2002
+#define B_MATWICH 2003
+#define B_MATNEW 2004
+#define B_MATDEL 2005
+#define B_MATASS 2006
+#define B_MATSEL 2007
+#define B_MATDESEL 2008
+#define B_HIDE 2009
+#define B_REVEAL 2010
+#define B_SELSWAP 2011
+#define B_SETSMOOTH 2012
+#define B_SETSOLID 2013
+#define B_AUTOTEX 2014
+#define B_DOCENTER 2015
+#define B_DOCENTERNEW 2016
+#define B_DOCENTERCURSOR 2017
+#define B_MATASS_BROWSE 2018
+
+ /* 20 values! */
+#define B_OBLAY 2019
+
+#define B_ADDKEY 2041
+#define B_SETKEY 2042
+#define B_DELKEY 2043
+#define B_NAMEKEY 2044
+#define B_PREVKEY 2045
+#define B_NEXTKEY 2046
+#define B_LOCKKEY 2047
+#define B_MATCOL2 2048
+
+#define B_MESHBUTS 2090
+
+#define B_FLIPNORM 2050
+#define B_SPIN 2051
+#define B_SPINDUP 2052
+#define B_EXTR 2053
+#define B_SCREW 2054
+#define B_EXTREP 2055
+#define B_SPLIT 2056
+#define B_REMDOUB 2057
+#define B_SUBDIV 2058
+#define B_FRACSUBDIV 2059
+#define B_XSORT 2060
+#define B_HASH 2061
+#define B_MAKESTICKY 2062
+#define B_DELSTICKY 2063
+#define B_NEWMCOL 2064
+#define B_DELMCOL 2065
+#define B_TOSPHERE 2066
+#define B_DECIM_FACES 2067
+#define B_DECIM_CANCEL 2068
+#define B_DECIM_APPLY 2069
+/* B_SLOWERDRAW and B_FASTERDRAW removed */
+#define B_VERTEXNOISE 2072
+#define B_VERTEXSMOOTH 2073
+#define B_NEWTFACE 2074
+#define B_DELTFACE 2075
+#define B_CHROMADEPTH 2076
+#define B_DRAWEDGES 2077
+#define B_DRAWCREASES 2078
+#define B_SETTFACE 2079
+#define B_SETMCOL 2080
+#define B_JOINTRIA 2081
+#define B_SETTFACE_RND 2082
+#define B_SETMCOL_RND 2083
+
+/* *********************** */
+#define B_VGROUPBUTS 2100
+
+#define B_NEWVGROUP 2091
+#define B_DELVGROUP 2092
+#define B_ASSIGNVGROUP 2093
+#define B_REMOVEVGROUP 2094
+#define B_SELVGROUP 2095
+#define B_DESELVGROUP 2096
+#define B_AUTOVGROUP 2097
+#define B_LINKEDVGROUP 2098
+#define B_COPYVGROUP 2099
+
+
+
+/* *********************** */
+#define B_CURVEBUTS 2200
+
+#define B_CONVERTPOLY 2101
+#define B_CONVERTBEZ 2102
+#define B_CONVERTBSPL 2103
+#define B_CONVERTCARD 2104
+#define B_CONVERTNURB 2105
+#define B_UNIFU 2106
+#define B_ENDPU 2107
+#define B_BEZU 2108
+#define B_UNIFV 2109
+#define B_ENDPV 2110
+#define B_BEZV 2111
+#define B_SETWEIGHT 2112
+#define B_SETW1 2113
+#define B_SETW2 2114
+#define B_SETW3 2115
+#define B_SETORDER 2116
+#define B_MAKEDISP 2117
+#define B_SUBDIVCURVE 2118
+#define B_SPINNURB 2119
+#define B_CU3D 2120
+#define B_SETRESOLU 2121
+#define B_SETW4 2122
+#define B_SUBSURFTYPE 2123
+#define B_TILTINTERP 2124
+#define B_SETPT_AUTO 2125
+#define B_SETPT_VECTOR 2126
+#define B_SETPT_ALIGN 2127
+#define B_SETPT_FREE 2128
+
+/* *********************** */
+#define B_FONTBUTS 2300
+
+#define B_MAKEFONT 2201
+#define B_TOUPPER 2202
+#define B_SETFONT 2203
+#define B_LOADFONT 2204
+#define B_TEXTONCURVE 2205
+#define B_PACKFONT 2206
+#define B_LOAD3DTEXT 2207
+#define B_LOREM 2208
+#define B_FASTFONT 2209
+#define B_INSTB 2210
+#define B_DELTB 2211
+#define B_STYLETOSELB 2212
+#define B_STYLETOSELU 2213
+#define B_STYLETOSELI 2214
+
+#define B_SETCHAR 2215
+#define B_SETUPCHAR 2216
+#define B_SETDOWNCHAR 2217
+#define B_SETCAT 2218
+#define B_SETUNITEXT 2219
+
+/* *********************** */
+#define B_ARMBUTS 2400
+
+#define B_ARM_RECALCDATA 2301
+#define B_ARM_STRIDE 2302
+#define B_ARM_CALCPATHS 2303
+#define B_ARM_CLEARPATHS 2304
+
+/* *********************** */
+#define B_CAMBUTS 2500
+
+/* *********************** */
+#define B_MBALLBUTS 2600
+
+#define B_RECALCMBALL 2501
+
+/* *********************** */
+#define B_LATTBUTS 2700
+
+#define B_RESIZELAT 2601
+#define B_DRAWLAT 2602
+#define B_LATTCHANGED 2603
+#define B_REGULARLAT 2604
+
+/* *********************** */
+#define B_GAMEBUTS 2800
+
+#define B_ADD_PROP 2701
+#define B_CHANGE_PROP 2702
+
+#define B_ADD_SENS 2703
+#define B_CHANGE_SENS 2704
+#define B_DEL_SENS 2705
+
+#define B_ADD_CONT 2706
+#define B_CHANGE_CONT 2707
+#define B_DEL_CONT 2708
+
+#define B_ADD_ACT 2709
+#define B_CHANGE_ACT 2710
+#define B_DEL_ACT 2711
+
+#define B_SOUNDACT_BROWSE 2712
+
+#define B_SETSECTOR 2713
+#define B_SETPROP 2714
+#define B_SETACTOR 2715
+#define B_SETMAINACTOR 2716
+#define B_SETDYNA 2717
+
+/* *********************** */
+#define B_FPAINTBUTS 2900
+
+#define B_VPCOLSLI 2801
+#define B_VPGAMMA 2802
+
+#define B_COPY_TF_MODE 2804
+#define B_COPY_TF_UV 2805
+#define B_COPY_TF_COL 2806
+#define B_REDR_3D_IMA 2807
+#define B_SET_VCOL 2808
+
+#define B_COPY_TF_TEX 2814
+#define B_TFACE_HALO 2815
+#define B_TFACE_BILLB 2816
+
+#define B_SHOWTEX 2832
+#define B_ASSIGNMESH 2833
+
+#define B_WEIGHT0_0 2840
+#define B_WEIGHT1_4 2841
+#define B_WEIGHT1_2 2842
+#define B_WEIGHT3_4 2843
+#define B_WEIGHT1_0 2844
+
+#define B_OPA1_8 2845
+#define B_OPA1_4 2846
+#define B_OPA1_2 2847
+#define B_OPA3_4 2848
+#define B_OPA1_0 2849
+
+#define B_CLR_WPAINT 2850
+
+#define B_BRUSHBROWSE 2851
+#define B_BRUSHDELETE 2852
+#define B_BRUSHLOCAL 2853
+#define B_BRUSHCHANGE 2854
+#define B_BTEXBROWSE 2855
+#define B_BTEXDELETE 2856
+#define B_BRUSHKEEPDATA 2857
+
+/* Sculptmode */
+#define B_SCULPT_TEXBROWSE 2860
+
+/* Particles */
+#define B_BAKE_OLENGTH 2870
+#define B_BAKE_APPLY_AV 2871
+#define B_BAKE_KEYTIME 2872
+#define B_BAKE_AV_CHANGE 2873
+#define B_BAKE_REDRAWEDIT 2874
+#define B_BAKE_RECACHE 2875
+
+/* *********************** */
+#define B_RADIOBUTS 3000
+
+#define B_RAD_GO 2901
+#define B_RAD_INIT 2902
+#define B_RAD_LIMITS 2903
+#define B_RAD_FAC 2904
+#define B_RAD_NODELIM 2905
+#define B_RAD_NODEFILT 2906
+#define B_RAD_FACEFILT 2907
+#define B_RAD_ADD 2908
+#define B_RAD_DELETE 2909
+#define B_RAD_COLLECT 2910
+#define B_RAD_SHOOTP 2911
+#define B_RAD_SHOOTE 2912
+#define B_RAD_REPLACE 2913
+#define B_RAD_DRAW 2914
+#define B_RAD_FREE 2915
+#define B_RAD_ADDMESH 2916
+
+/* *********************** */
+#define B_SCRIPTBUTS 3100
+
+#define B_SCRIPT_ADD 3001
+#define B_SCRIPT_DEL 3002
+#define B_SCRIPT_TYPE 3003
+
+/* Scene script buttons */
+#define B_SSCRIPT_ADD 3004
+#define B_SSCRIPT_DEL 3005
+#define B_SSCRIPT_TYPE 3006
+
+/* *********************** */
+#define B_SOUNDBUTS 3200
+enum B_SOUND_BUTTONS {
+ B_SOUND_CHANGED = 3101,
+ B_SOUND_REDRAW,
+ B_SOUND_VOLUME,
+ B_SOUND_PANNING,
+ B_SOUND_PITCH,
+ B_SOUND_LOAD_SAMPLE,
+ B_SOUND_MENU_SAMPLE,
+ B_SOUND_NAME_SAMPLE,
+ B_SOUND_UNLINK_SAMPLE,
+ B_SOUND_RELOAD_SAMPLE,
+ B_SOUND_UNPACK_SAMPLE,
+ B_SOUND_PLAY_SAMPLE,
+ B_SOUND_COPY_SOUND,
+ B_SOUND_LOOPSTART,
+ B_SOUND_LOOPEND,
+ B_SOUND_BIDIRECTIONAL,
+ B_SOUND_RECALC,
+ B_SOUND_RATECHANGED,
+ B_SOUND_MIXDOWN
+};
+
+/* *********************** */
+#define B_CONSTRAINTBUTS 3300
+enum {
+ B_CONSTRAINT_TEST = 3201,
+ B_CONSTRAINT_CHANGETARGET,
+ B_CONSTRAINT_ADD_NULL,
+ B_CONSTRAINT_ADD_KINEMATIC,
+ B_CONSTRAINT_ADD_TRACKTO,
+ B_CONSTRAINT_ADD_MINMAX,
+ B_CONSTRAINT_ADD_ROTLIKE,
+ B_CONSTRAINT_ADD_LOCLIKE,
+ B_CONSTRAINT_ADD_SIZELIKE,
+ B_CONSTRAINT_ADD_ACTION,
+ B_CONSTRAINT_ADD_LOCKTRACK,
+ B_CONSTRAINT_ADD_FOLLOWPATH,
+ B_CONSTRAINT_ADD_DISTANCELIMIT,
+ B_CONSTRAINT_ADD_STRETCHTO,
+ B_CONSTRAINT_ADD_LOCLIMIT,
+ B_CONSTRAINT_ADD_ROTLIMIT,
+ B_CONSTRAINT_ADD_SIZELIMIT,
+ B_CONSTRAINT_ADD_RIGIDBODYJOINT,
+ B_CONSTRAINT_ADD_CHILDOF,
+ B_CONSTRAINT_ADD_PYTHON,
+ B_CONSTRAINT_ADD_CLAMPTO,
+ B_CONSTRAINT_ADD_TRANSFORM,
+ B_CONSTRAINT_INF
+};
+
+/* *********************** */
+#define B_UVAUTOCALCBUTS 3400
+enum {
+ B_UVAUTO_REDRAW = 3301,
+ B_UVAUTO_SPHERE,
+ B_UVAUTO_CYLINDER,
+ B_UVAUTO_CYLRADIUS,
+ B_UVAUTO_WINDOW,
+ B_UVAUTO_CUBE,
+ B_UVAUTO_CUBESIZE,
+ B_UVAUTO_RESET,
+ B_UVAUTO_BOUNDS,
+ B_UVAUTO_TOP,
+ B_UVAUTO_FACE,
+ B_UVAUTO_OBJECT,
+ B_UVAUTO_ALIGNX,
+ B_UVAUTO_ALIGNY,
+ B_UVAUTO_UNWRAP,
+ B_UVAUTO_DRAWFACES
+};
+
+#define B_EFFECTSBUTS 3500
+
+#define B_AUTOTIMEOFS 3403
+#define B_FRAMEMAP 3404
+#define B_NEWEFFECT 3405
+#define B_PREVEFFECT 3406
+#define B_NEXTEFFECT 3407
+#define B_CHANGEEFFECT 3408
+#define B_CALCEFFECT 3409
+#define B_DELEFFECT 3410
+#define B_RECALCAL 3411
+#define B_RECALC_DEFL 3412
+#define B_EFFECT_DEP 3413
+#define B_FIELD_DEP 3414
+#define B_FIELD_CHANGE 3415
+#define B_PAF_SET_VG 3416
+#define B_PAF_SET_VG1 3417
+#define B_PARTBROWSE 3418
+#define B_PARTDELETE 3419
+#define B_PARTALONE 3420
+#define B_PARTLOCAL 3421
+#define B_PARTAUTONAME 3422
+#define B_PART_ALLOC 3423
+#define B_PART_DISTR 3424
+#define B_PART_INIT 3425
+#define B_PART_RECALC 3426
+#define B_PART_REDRAW 3427
+#define B_PARTTYPE 3428
+#define B_PARTACT 3429
+#define B_PARTTARGET 3430
+#define B_PART_ALLOC_CHILD 3431
+#define B_PART_DISTR_CHILD 3432
+#define B_PART_INIT_CHILD 3433
+#define B_PART_RECALC_CHILD 3434
+#define B_PART_EDITABLE 3435
+
+#define B_PART_REKEY 3436
+
+#define B_MODIFIER_BUTS 3600
+
+#define B_MODIFIER_RECALC 3501
+#define B_MODIFIER_REDRAW 3502
+
+/* *********************** */
+#define B_NODE_BUTS 4000
+ /* 400 slots reserved, we want an exec event for each node */
+#define B_NODE_LOADIMAGE 3601
+#define B_NODE_TREE_EXEC 3602
+
+ /* exec should be last in this list */
+#define B_NODE_EXEC 3610
+
+
+/* *********************** */
+/* BUTTON 4001-4032: layers? (sort this out!) */
+
+/* *********************** */
+/* event code 0x4000 (16384) and larger: general events (redraws, etc) */
+
+
+#endif
+
diff --git a/source/blender/python/api2_2x/Lamp.h b/source/blender/editors/include/datatoc.h
index 01c80e0006b..250418f8a9d 100644
--- a/source/blender/python/api2_2x/Lamp.h
+++ b/source/blender/editors/include/datatoc.h
@@ -1,5 +1,7 @@
-/*
- * $Id: Lamp.h 10269 2007-03-15 01:09:14Z campbellbarton $
+/*
+ * datatoc.h
+ *
+ * $Id: datatoc.h 11920 2007-09-02 17:25:03Z elubie $
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
@@ -23,39 +25,39 @@
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
- * This is a new part of Blender.
+ * The Original Code is: all of this file.
*
- * Contributor(s): Willian P. Germano, Nathan Letwory
+ * Contributor(s): none yet.
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
+ */
-#ifndef EXPP_LAMP_H
-#define EXPP_LAMP_H
+#ifndef DATATOC_H
+#define DATATOC_H
-#include <Python.h>
-#include "DNA_lamp_types.h"
-#include "rgbTuple.h"
+extern int datatoc_B_blend_size;
+extern char datatoc_B_blend[];
-extern PyTypeObject Lamp_Type;
+extern int datatoc_Bfs_size;
+extern char datatoc_Bfs[];
-#define BPy_Lamp_Check(v) \
- ((v)->ob_type == &Lamp_Type) /* for type checking */
+extern int datatoc_blenderbuttons_size;
+extern char datatoc_blenderbuttons[];
-/* Python BPy_Lamp structure definition */
-typedef struct {
- PyObject_HEAD /* required py macro */
- Lamp * lamp; /* libdata must be second */
- BPy_rgbTuple *color;
-} BPy_Lamp;
+extern int datatoc_prvicons_size;
+extern char datatoc_prvicons[];
+extern int datatoc_Bfont_size;
+extern char datatoc_Bfont[];
-/*
- * prototypes
- */
+extern int datatoc_bfont_ttf_size;
+extern char datatoc_bfont_ttf[];
+
+extern int datatoc_cmap_tga_size;
+extern char datatoc_cmap_tga[];
+
+extern int datatoc_cmovie_tga_size;
+extern char datatoc_cmovie_tga[];
-PyObject *Lamp_Init( void );
-PyObject *Lamp_CreatePyObject( struct Lamp *lamp );
-Lamp *Lamp_FromPyObject( PyObject * pyobj );
+#endif /* DATATOC_H */
-#endif /* EXPP_LAMP_H */
diff --git a/source/blender/editors/include/editlattice_ext.h b/source/blender/editors/include/editlattice_ext.h
new file mode 100644
index 00000000000..b0cb186a587
--- /dev/null
+++ b/source/blender/editors/include/editlattice_ext.h
@@ -0,0 +1,42 @@
+/*
+ * editlattice_ext.h
+ *
+ * $Id: editlattice_ext.h 229 2002-12-27 13:11:01Z mein $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef EDITLATTICE_EXT_H
+#define EDITLATTICE_EXT_H "$Id: editlattice_ext.h 229 2002-12-27 13:11:01Z mein $"
+#define EDITLATTICE_EXT_H "Copyright (C) 2001 NaN Technologies B.V.
+
+void end_latt_deform(void);
+
+#endif /* EDITLATTICE_EXT_H */
+
diff --git a/source/blender/editors/include/editmesh.h b/source/blender/editors/include/editmesh.h
new file mode 100644
index 00000000000..1b2d91e22b8
--- /dev/null
+++ b/source/blender/editors/include/editmesh.h
@@ -0,0 +1,110 @@
+/**
+ * $Id:
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+/* Internal for editmesh_xxxx.c functions */
+
+#ifndef EDITMESH_H
+#define EDITMESH_H
+
+#define TEST_EDITMESH if(G.obedit==0) return; \
+ if( (G.vd->lay & G.obedit->lay)==0 ) return;
+
+#define UVCOPY(t, s) memcpy(t, s, 2 * sizeof(float));
+
+
+
+/* ******************* editmesh.c */
+extern void free_editvert(EditVert *eve);
+extern void free_editedge(EditEdge *eed);
+extern void free_editface(EditFace *efa);
+
+extern void free_vertlist(ListBase *edve);
+extern void free_edgelist(ListBase *lb);
+extern void free_facelist(ListBase *lb);
+
+extern void remedge(EditEdge *eed);
+
+extern struct EditVert *addvertlist(float *vec, struct EditVert *example);
+extern struct EditEdge *addedgelist(struct EditVert *v1, struct EditVert *v2, struct EditEdge *example);
+extern struct EditFace *addfacelist(struct EditVert *v1, struct EditVert *v2, struct EditVert *v3, struct EditVert *v4, struct EditFace *example, struct EditFace *exampleEdges);
+extern struct EditEdge *findedgelist(struct EditVert *v1, struct EditVert *v2);
+
+/* ******************* editmesh_add.c */
+
+
+/* ******************* editmesh_lib.c */
+extern void EM_fgon_flags(void);
+extern void EM_hide_reset(void);
+
+extern int faceselectedOR(EditFace *efa, int flag);
+extern int faceselectedAND(EditFace *efa, int flag);
+
+extern EditFace *exist_face(EditVert *v1, EditVert *v2, EditVert *v3, EditVert *v4);
+extern void flipface(EditFace *efa); // flips for normal direction
+extern int compareface(EditFace *vl1, EditFace *vl2);
+
+/* flag for selection bits, *nor will be filled with normal for extrusion constraint */
+/* return value defines if such normal was set */
+extern short extrudeflag_face_indiv(short flag, float *nor);
+extern short extrudeflag_verts_indiv(short flag, float *nor);
+extern short extrudeflag_edges_indiv(short flag, float *nor);
+extern short extrudeflag_vert(short flag, float *nor);
+extern short extrudeflag(short flag, float *nor);
+
+extern void adduplicateflag(int flag);
+extern void delfaceflag(int flag);
+
+extern void rotateflag(short flag, float *cent, float rotmat[][3]);
+extern void translateflag(short flag, float *vec);
+
+extern int convex(float *v1, float *v2, float *v3, float *v4);
+
+/* ******************* editmesh_mods.c */
+extern EditEdge *findnearestedge(int *dist);
+extern void EM_automerge(int update);
+
+/**
+ * findnearestvert
+ *
+ * dist (in/out): minimal distance to the nearest and at the end, actual distance
+ * sel: selection bias
+ * if SELECT, selected vertice are given a 5 pixel bias to make them farter than unselect verts
+ * if 0, unselected vertice are given the bias
+ * strict: if 1, the vertice corresponding to the sel parameter are ignored and not just biased
+ */
+extern EditVert *findnearestvert(int *dist, short sel, short strict);
+
+/* ******************* editmesh_tools.c */
+
+
+#endif
+
diff --git a/source/blender/editors/include/interface.h b/source/blender/editors/include/interface.h
new file mode 100644
index 00000000000..18f0db03881
--- /dev/null
+++ b/source/blender/editors/include/interface.h
@@ -0,0 +1,236 @@
+/**
+ * $Id: interface.h 11920 2007-09-02 17:25:03Z elubie $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef INTERFACE_H
+#define INTERFACE_H
+
+#include "BIF_resources.h"
+
+/* general defines */
+
+#define UI_MAX_DRAW_STR 400
+#define UI_MAX_NAME_STR 64
+#define UI_ARRAY 29
+
+/* panel limits */
+#define UI_PANEL_MINX 100
+#define UI_PANEL_MINY 70
+
+/* uiBut->flag */
+#define UI_SELECT 1
+#define UI_MOUSE_OVER 2
+#define UI_ACTIVE 4
+#define UI_HAS_ICON 8
+/* warn: rest of uiBut->flag in BIF_interface.c */
+
+
+/* internal panel drawing defines */
+#define PNL_GRID 4
+#define PNL_DIST 8
+#define PNL_SAFETY 8
+#define PNL_HEADER 20
+
+/* panel->flag */
+#define PNL_SELECT 1
+#define PNL_CLOSEDX 2
+#define PNL_CLOSEDY 4
+#define PNL_CLOSED 6
+#define PNL_TABBED 8
+#define PNL_OVERLAP 16
+
+/* Button text selection:
+ * extension direction, selextend, inside ui_do_but_TEX */
+#define EXTEND_LEFT 1
+#define EXTEND_RIGHT 2
+
+typedef struct {
+ short xim, yim;
+ unsigned int *rect;
+ short xofs, yofs;
+} uiIconImage;
+
+typedef struct {
+ short mval[2];
+ short qual, val;
+ int event;
+} uiEvent;
+
+typedef struct {
+ void *xl, *large, *medium, *small;
+} uiFont;
+
+typedef struct uiLinkLine { /* only for draw/edit */
+ struct uiLinkLine *next, *prev;
+
+ short flag, pad;
+
+ struct uiBut *from, *to;
+} uiLinkLine;
+
+typedef struct {
+ void **poin; /* pointer to original pointer */
+ void ***ppoin; /* pointer to original pointer-array */
+ short *totlink; /* if pointer-array, here is the total */
+
+ short maxlink, pad;
+ short fromcode, tocode;
+
+ ListBase lines;
+} uiLink;
+
+struct uiBut {
+ struct uiBut *next, *prev;
+ short type, pointype, bit, bitnr, retval, strwidth, ofs, pos, selsta, selend;
+ int flag;
+
+ char *str;
+ char strdata[UI_MAX_NAME_STR];
+ char drawstr[UI_MAX_DRAW_STR];
+
+ float x1, y1, x2, y2;
+
+ char *poin;
+ float min, max;
+ float a1, a2, hsv[3]; // hsv is temp memory for hsv buttons
+ float aspect;
+
+ void (*func)(void *, void *);
+ void *func_arg1;
+ void *func_arg2;
+
+ void (*embossfunc)(int , int , float, float, float, float, float, int);
+ void (*sliderfunc)(int , float, float, float, float, float, float, int);
+
+ void (*autocomplete_func)(char *, void *);
+ void *autofunc_arg;
+
+ uiLink *link;
+
+ char *tip, *lockstr;
+
+ int themecol; /* themecolor id */
+ void *font;
+
+ BIFIconID icon;
+ short but_align; /* aligning buttons, horiz/vertical */
+ short lock, win;
+ short iconadd, dt;
+
+ /* IDPOIN data */
+ uiIDPoinFuncFP idpoin_func;
+ ID **idpoin_idpp;
+
+ /* BLOCK data */
+ uiBlockFuncFP block_func;
+
+ /* BUTM data */
+ void (*butm_func)(void *arg, int event);
+ void *butm_func_arg;
+
+ /* pointer back */
+ uiBlock *block;
+};
+
+struct uiBlock {
+ uiBlock *next, *prev;
+
+ ListBase buttons;
+ Panel *panel;
+
+ char name[UI_MAX_NAME_STR];
+
+ float winmat[4][4];
+
+ float minx, miny, maxx, maxy;
+ float aspect;
+
+ void (*butm_func)(void *arg, int event);
+ void *butm_func_arg;
+
+ void (*func)(void *arg1, void *arg2);
+ void *func_arg1;
+ void *func_arg2;
+
+ /* extra draw function for custom blocks */
+ void (*drawextra)();
+
+ int themecol; /* themecolor id */
+
+ short font; /* indices */
+ int afterval, flag;
+ void *curfont;
+
+ short autofill, win, winq, direction, dt;
+ short needflush, auto_open, in_use, pad; //flush see below
+ void *overdraw;
+ struct uiBlock *parent; // nested pulldowns
+
+ float xofs, yofs; // offset to parent button
+ rctf parentrct; // for pulldowns, rect the mouse is allowed outside of menu (parent button)
+ rctf safety; // pulldowns, to detect outside, can differ per case how it is created
+
+ rctf flush; // rect to be flushed to frontbuffer
+ int handler; // for panels in other windows than buttonswin... just event code
+};
+
+/* interface.c */
+
+extern void ui_graphics_to_window(int win, float *x, float *y);
+extern void ui_graphics_to_window_rct(int win, rctf *graph, rcti *winr);
+extern void ui_window_to_graphics(int win, float *x, float *y);
+
+extern void ui_block_flush_back(uiBlock *block);
+extern void ui_block_set_flush(uiBlock *block, uiBut *but);
+
+extern void ui_check_but(uiBut *but);
+extern double ui_get_but_val(uiBut *but);
+extern void ui_get_but_vectorf(uiBut *but, float *vec);
+extern void ui_set_but_vectorf(uiBut *but, float *vec);
+extern void ui_autofill(uiBlock *block);
+
+/* interface_panel.c */
+extern void ui_draw_panel(uiBlock *block);
+extern void ui_do_panel(uiBlock *block, uiEvent *uevent);
+extern void ui_scale_panel(uiBlock *block);
+extern void gl_round_box(int mode, float minx, float miny, float maxx, float maxy, float rad);
+extern void gl_round_box_shade(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadetop, float shadedown);
+
+/* interface_draw.c */
+extern void ui_set_embossfunc(uiBut *but, int drawtype);
+extern void ui_draw_but(uiBut *but);
+extern void ui_rasterpos_safe(float x, float y, float aspect);
+extern void ui_draw_tria_icon(float x, float y, float aspect, char dir);
+extern void ui_draw_anti_x(float x1, float y1, float x2, float y2);
+extern void ui_dropshadow(rctf *rct, float radius, float aspect, int select);
+
+#endif
+
diff --git a/source/blender/python/api2_2x/Ipo.h b/source/blender/editors/include/keyed_functions.h
index 35893015a79..3549795b399 100644
--- a/source/blender/python/api2_2x/Ipo.h
+++ b/source/blender/editors/include/keyed_functions.h
@@ -1,6 +1,5 @@
-/*
- * $Id: Ipo.h 10269 2007-03-15 01:09:14Z campbellbarton $
- *
+/**
+ * $Id: keyed_functions.h 540 2003-03-23 21:42:31Z zuster $
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
@@ -23,41 +22,37 @@
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
- * This is a new part of Blender.
+ * The Original Code is: all of this file.
*
- * Contributor(s): Jacques Guignot
+ * Contributor(s): none yet.
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
+ */
-#ifndef EXPP_IPO_H
-#define EXPP_IPO_H
+#define KEY_GETPTR(x) (g_ptrtab ? g_ptrtab[x] : 0)
-#include <Python.h>
-#include "DNA_ipo_types.h"
+/* these are the defines for the keyed functions:
-/*****************************************************************************/
-/* Python BPy_Ipo structure definition: */
-/*****************************************************************************/
-typedef struct {
- PyObject_HEAD /* required macro */
- Ipo * ipo; /* libdata must be second */
- short iter;
- short mtex;
-} BPy_Ipo;
+ #define key_func<n> <function name to be behind key>
-extern PyTypeObject Ipo_Type;
+ This function must be of type "int func(void*)"
-#define BPy_Ipo_Check(v) ((v)->ob_type == &Ipo_Type) /* for type checking */
+ To prevent symbol table dumpers from retrieving certain key
+ functions too easily, some of those functions have nonsense names.
+*/
+#define key_func1 key_return_true
+/* add the corresponding function pointer defines here.
+ Example:
-/*
- * prototypes
- */
+ #define key_func4 my_protected_function_name
+ #define MY_PROTECTED_FUNCTION_PTR KEY_GETPTR(KEY_FUNC3)
-PyObject *Ipo_Init( void );
-PyObject *Ipo_CreatePyObject( struct Ipo *ipo );
-Ipo *Ipo_FromPyObject( PyObject * py_obj );
+ KEY_GETPTR(KEY_FUNC3) corresponds to the function pointer to function
+ key_func3 after the python key code unscrambled the function pointer tables.
+ Also add pointer initializations to these functions in
+ license_key.c:init_ftable() if necessary.
+*/
+#define KEY_RETURN_TRUE KEY_GETPTR(KEY_FUNC1)
-#endif /* EXPP_IPO_H */
diff --git a/source/blender/editors/include/license_key.h b/source/blender/editors/include/license_key.h
new file mode 100644
index 00000000000..1f9fa09a1f5
--- /dev/null
+++ b/source/blender/editors/include/license_key.h
@@ -0,0 +1,95 @@
+/**
+ * $Id: license_key.h 229 2002-12-27 13:11:01Z mein $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+#ifndef LICENCEKEY_H
+#define LICENCEKEY_H
+
+#define I_AM_PUBLISHER temp_val2
+#define LICENSE_KEY_VALID temp_val
+#define SHOW_LICENSE_KEY rotop
+
+extern int LICENSE_KEY_VALID;
+extern int I_AM_PUBLISHER;
+
+extern char * license_key_name;
+extern void loadKeyboard(char * name);
+extern void checkhome(void);
+extern void SHOW_LICENSE_KEY(void);
+
+#define LICENSE_CHECK_0 (0==0)
+
+// Stuff from the Python files from Strubi
+
+typedef int (*Fptr)(void *);
+
+extern Fptr g_functab[];
+extern Fptr g_ptrtab[];
+
+// TODO: From here on, this should be a generated header file...
+
+// change all KEY_FUNC values
+// if you change PYKEY_TABLEN or PYKEY_SEED
+// see below
+
+#define PYKEY_TABLEN 21 // don't change this unless needed. Other values
+ // may yield bad random orders
+
+#define PYKEY_SEED {26,8,1972}
+
+// these values are generated by $HOME/develop/intern/keymaker/makeseed.py
+// from the above seed value.
+
+// DO NOT EDIT THESE VALUES BY HAND!
+
+#define KEY_FUNC1 12
+#define KEY_FUNC2 8
+#define KEY_FUNC3 1
+#define KEY_FUNC4 16
+#define KEY_FUNC5 20
+#define KEY_FUNC6 18
+#define KEY_FUNC7 13
+#define KEY_FUNC8 6
+#define KEY_FUNC9 9
+#define KEY_FUNC10 7
+#define KEY_FUNC11 14
+#define KEY_FUNC12 0
+#define KEY_FUNC13 5
+#define KEY_FUNC14 10
+#define KEY_FUNC15 19
+#define KEY_FUNC16 2
+#define KEY_FUNC17 11
+#define KEY_FUNC18 3
+#define KEY_FUNC19 17
+#define KEY_FUNC20 15
+#define KEY_FUNC21 4
+
+#endif
+
diff --git a/source/blender/editors/include/multires.h b/source/blender/editors/include/multires.h
new file mode 100644
index 00000000000..470084e9c5f
--- /dev/null
+++ b/source/blender/editors/include/multires.h
@@ -0,0 +1,81 @@
+/*
+ * $Id: multires.h 11480 2007-08-03 16:33:08Z campbellbarton $
+ *
+ * ***** 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2006 by Nicholas Bishop
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef MULTIRES_H
+#define MULTIRES_H
+
+struct CustomData;
+struct EditMesh;
+struct Object;
+struct MDeformVert;
+struct Mesh;
+struct MultiresLevel;
+struct Multires;
+struct uiBlock;
+
+/* For canceling operations that don't work with multires on or on a non-base level */
+int multires_test();
+int multires_level1_test();
+
+struct MultiresLevel *multires_level_n(struct Multires *mr, int n);
+
+void multires_draw_interface(struct uiBlock *block, unsigned short cx, unsigned short cy);
+void multires_disp_map(void *, void*);
+
+void multires_make(void *ob, void *me);
+void multires_delete(void *ob, void *me);
+struct Multires *multires_copy(struct Multires *orig);
+void multires_free(struct Multires *mr);
+void multires_free_level(struct MultiresLevel *lvl);
+void multires_del_lower(void *ob, void *me);
+void multires_del_higher(void *ob, void *me);
+void multires_add_level(void *ob, void *me);
+void multires_set_level_cb(void *ob, void *me);
+void multires_set_level(struct Object *ob, struct Mesh *me, const int render);
+void multires_update_levels(struct Mesh *me, const int render);
+void multires_level_to_mesh(struct Object *ob, struct Mesh *me, const int render);
+void multires_edge_level_update(void *ob, void *me);
+int multires_modifier_warning();
+
+/* after adding or removing vcolor layers, run this */
+void multires_load_cols(Mesh *me);
+
+/* multires-firstlevel.c */
+/* Generic */
+void multires_update_first_level(struct Mesh *me, struct EditMesh *em);
+void multires_update_customdata(struct MultiresLevel *lvl1, struct CustomData *src,
+ struct CustomData *dst, const int type);
+void multires_customdata_to_mesh(struct Mesh *me, struct EditMesh *em, struct MultiresLevel *lvl,
+ struct CustomData *src, struct CustomData *dst, const int type);
+void multires_del_lower_customdata(struct Multires *mr, struct MultiresLevel *cr_lvl);
+
+void multires_add_layer(struct Mesh *me, struct CustomData *cd, const int type, const int n);
+void multires_delete_layer(struct Mesh *me, struct CustomData *cd, const int type, int n);
+
+#endif
diff --git a/source/blender/editors/include/mydevice.h b/source/blender/editors/include/mydevice.h
new file mode 100644
index 00000000000..e2b9b529e9b
--- /dev/null
+++ b/source/blender/editors/include/mydevice.h
@@ -0,0 +1,260 @@
+
+#ifndef __MYDEVICE_H__
+#define __MYDEVICE_H__
+
+/*
+ * This file has its origin at sgi, where all device defines were written down.
+ * Blender copied this concept quite some, and expanded it with internal new defines (ton)
+ *
+ * mouse / timer / window: until 0x020
+ * custom codes: 0x4...
+ *
+ * $Id: mydevice.h 12385 2007-10-24 18:58:26Z campbellbarton $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+/* MOUSE : 0x00x */
+
+#define LEFTMOUSE 0x001
+#define MIDDLEMOUSE 0x002
+#define RIGHTMOUSE 0x003
+#define MOUSEX 0x004
+#define MOUSEY 0x005
+#define WHEELUPMOUSE 0x00a
+#define WHEELDOWNMOUSE 0x00b
+
+/* timers */
+
+#define TIMER0 0x006
+#define TIMER1 0x007
+#define TIMER2 0x008
+#define TIMER3 0x009
+
+/* SYSTEM : 0x01x */
+
+#define KEYBD 0x010 /* keyboard */
+#define RAWKEYBD 0x011 /* raw keyboard for keyboard manager */
+#define REDRAW 0x012 /* used by port manager to signal redraws */
+#define INPUTCHANGE 0x013 /* input connected or disconnected */
+#define QFULL 0x014 /* queue was filled */
+#define WINFREEZE 0x015 /* user wants process in this win to shut up */
+#define WINTHAW 0x016 /* user wants process in this win to go again */
+#define WINCLOSE 0x017 /* window close */
+#define WINQUIT 0x018 /* signal from user that app is to go away */
+#define Q_FIRSTTIME 0x019 /* on startup */
+
+/* standard keyboard */
+
+#define AKEY 'a'
+#define BKEY 'b'
+#define CKEY 'c'
+#define DKEY 'd'
+#define EKEY 'e'
+#define FKEY 'f'
+#define GKEY 'g'
+#define HKEY 'h'
+#define IKEY 'i'
+#define JKEY 'j'
+#define KKEY 'k'
+#define LKEY 'l'
+#define MKEY 'm'
+#define NKEY 'n'
+#define OKEY 'o'
+#define PKEY 'p'
+#define QKEY 'q'
+#define RKEY 'r'
+#define SKEY 's'
+#define TKEY 't'
+#define UKEY 'u'
+#define VKEY 'v'
+#define WKEY 'w'
+#define XKEY 'x'
+#define YKEY 'y'
+#define ZKEY 'z'
+
+#define ZEROKEY '0'
+#define ONEKEY '1'
+#define TWOKEY '2'
+#define THREEKEY '3'
+#define FOURKEY '4'
+#define FIVEKEY '5'
+#define SIXKEY '6'
+#define SEVENKEY '7'
+#define EIGHTKEY '8'
+#define NINEKEY '9'
+
+#define CAPSLOCKKEY 211
+
+#define LEFTCTRLKEY 212
+#define LEFTALTKEY 213
+#define RIGHTALTKEY 214
+#define RIGHTCTRLKEY 215
+#define RIGHTSHIFTKEY 216
+#define LEFTSHIFTKEY 217
+
+#define ESCKEY 218
+#define TABKEY 219
+#define RETKEY 220
+#define SPACEKEY 221
+#define LINEFEEDKEY 222
+#define BACKSPACEKEY 223
+#define DELKEY 224
+#define SEMICOLONKEY 225
+#define PERIODKEY 226
+#define COMMAKEY 227
+#define QUOTEKEY 228
+#define ACCENTGRAVEKEY 229
+#define MINUSKEY 230
+#define SLASHKEY 232
+#define BACKSLASHKEY 233
+#define EQUALKEY 234
+#define LEFTBRACKETKEY 235
+#define RIGHTBRACKETKEY 236
+
+#define LEFTARROWKEY 137
+#define DOWNARROWKEY 138
+#define RIGHTARROWKEY 139
+#define UPARROWKEY 140
+
+#define PAD0 150
+#define PAD1 151
+#define PAD2 152
+#define PAD3 153
+#define PAD4 154
+#define PAD5 155
+#define PAD6 156
+#define PAD7 157
+#define PAD8 158
+#define PAD9 159
+
+
+#define PADPERIOD 199
+#define PADSLASHKEY 161
+#define PADASTERKEY 160
+
+
+#define PADMINUS 162
+#define PADENTER 163
+#define PADPLUSKEY 164
+
+
+#define F1KEY 300
+#define F2KEY 301
+#define F3KEY 302
+#define F4KEY 303
+#define F5KEY 304
+#define F6KEY 305
+#define F7KEY 306
+#define F8KEY 307
+#define F9KEY 308
+#define F10KEY 309
+#define F11KEY 310
+#define F12KEY 311
+
+#define PAUSEKEY 165
+#define INSERTKEY 166
+#define HOMEKEY 167
+#define PAGEUPKEY 168
+#define PAGEDOWNKEY 169
+#define ENDKEY 170
+
+#define UNKNOWNKEY 171
+#define COMMANDKEY 172
+#define GRLESSKEY 173
+
+/* used as fake leftmouse events, special handled in interface.c */
+#define BUT_ACTIVATE 200
+#define BUT_NEXT 201
+#define BUT_PREV 202
+
+/* **************** BLENDER QUEUE EVENTS ********************* */
+
+#define CHANGED 0x4000
+#define DRAWEDGES 0x4001
+#define AFTERQUEUE 0x4002
+#define BACKBUFDRAW 0x4003
+#define EXECUTE 0x4004
+#define IGNORE_REDRAW 0x4005
+#define LOAD_FILE 0x4006
+#define RESHAPE 0x4007
+#define UI_BUT_EVENT 0x4008
+#define AUTOSAVE_FILE 0x4009
+#define UNDOPUSH 0x400A
+
+/* REDRAWVIEW3D has to be the first one (lowest number) for buttons! */
+#define REDRAWVIEW3D 0x4010
+#define REDRAWVIEWCAM 0x4011
+#define REDRAWVIEW3D_Z 0x4012
+
+#define REDRAWALL 0x4013
+#define REDRAWHEADERS 0x4014
+
+#define REDRAWBUTSHEAD 0x4015
+#define REDRAWBUTSALL 0x4016
+
+#define REDRAWBUTSSCENE 0x4017
+#define REDRAWBUTSOBJECT 0x4018
+#define REDRAWBUTSEDIT 0x4019
+#define REDRAWBUTSSCRIPT 0x401A
+#define REDRAWBUTSLOGIC 0x401B
+#define REDRAWBUTSSHADING 0x401C
+#define REDRAWBUTSGAME 0x401D
+#define REDRAWBUTSEFFECTS 0x401D
+
+#define REDRAWINFO 0x4021
+#define RENDERPREVIEW 0x4022
+#define REDRAWIPO 0x4023
+#define REDRAWDATASELECT 0x4024
+#define REDRAWSEQ 0x4025
+#define REDRAWIMAGE 0x4026
+#define REDRAWOOPS 0x4027
+#define REDRAWIMASEL 0x4028
+#define AFTERIMASELIMA 0x4029
+#define AFTERIMASELGET 0x402A
+#define AFTERIMAWRITE 0x402B
+#define IMALEFTMOUSE 0x402C
+#define AFTERPIBREAD 0x402D
+#define REDRAWTEXT 0x402E
+#define REDRAWSOUND 0x402F
+#define REDRAWACTION 0x4030
+#define REDRAWNLA 0x4031
+#define REDRAWSCRIPT 0x4032
+#define REDRAWTIME 0x4033
+#define REDRAWBUTSCONSTRAINT 0x4034
+#define ONLOAD_SCRIPT 0x4035
+#define SCREEN_HANDLER 0x4036
+#define REDRAWANIM 0x4037
+#define REDRAWNODE 0x4038
+#define RECALC_COMPOSITE 0x4039
+#define REDRAWMARKER 0x4040 /* all views that display markers */
+#define REDRAWVIEW3D_IMAGE 0x4041
+
+#endif /* !__MYDEVICE_H__ */
+
diff --git a/source/blender/editors/include/nla.h b/source/blender/editors/include/nla.h
new file mode 100644
index 00000000000..fd3a0b74d01
--- /dev/null
+++ b/source/blender/editors/include/nla.h
@@ -0,0 +1,45 @@
+/* nla.h May 2001
+ * $Id: nla.h 4664 2005-07-09 19:37:38Z ton $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ *
+ * XXX THIS FILE SHOULD BE REMOVED! (TON)
+ * $Id: nla.h 4664 2005-07-09 19:37:38Z ton $
+ */
+
+#ifndef NLA_H
+#define NLA_H
+
+#define __NLA
+
+#define __CON_IPO // Not for Release: Not yet fully implemented
+//#define __NLA_ACTION_BY_MOTION_ACTUATOR // Not for release: Not yet fully implemented
+
+#endif
+
diff --git a/source/blender/editors/include/objfnt.h b/source/blender/editors/include/objfnt.h
new file mode 100644
index 00000000000..7ba8d1b03e5
--- /dev/null
+++ b/source/blender/editors/include/objfnt.h
@@ -0,0 +1,105 @@
+/* $Id: objfnt.h 229 2002-12-27 13:11:01Z mein $
+*/
+/*
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+#ifndef OBJFNTDEF
+#define OBJFNTDEF
+
+typedef struct chardesc {
+ short movex, movey; /* advance */
+ short llx, lly; /* bounding box */
+ short urx, ury;
+ short *data; /* char data */
+ long datalen;
+} chardesc;
+
+typedef struct objfnt {
+ struct objfnt *freeaddr; /* if freeaddr != 0, objfnt is one chunck */
+ short type;
+ short charmin, charmax;
+ short my_nchars;
+ short scale;
+ chardesc *my_chars;
+} objfnt;
+
+#define OFMAGIC 0x93339333
+
+#define TM_TYPE 1
+#define PO_TYPE 2
+#define SP_TYPE 3
+
+/* ops for tmesh characters */
+
+#define TM_BGNTMESH (1)
+#define TM_SWAPTMESH (2)
+#define TM_ENDBGNTMESH (3)
+#define TM_RETENDTMESH (4)
+#define TM_RET (5)
+
+/* ops for poly characters */
+
+#define PO_BGNLOOP (1)
+#define PO_ENDBGNLOOP (2)
+#define PO_RETENDLOOP (3)
+#define PO_RET (4)
+
+/* ops for spline characters */
+
+#define SP_MOVETO (1)
+#define SP_LINETO (2)
+#define SP_CURVETO (3)
+#define SP_CLOSEPATH (4)
+#define SP_RETCLOSEPATH (5)
+#define SP_RET (6)
+
+
+#define MIN_ASCII ' '
+#define MAX_ASCII '~'
+#define NASCII (256 - 32)
+
+#define NOBBOX (30000)
+
+typedef struct pschar {
+ char *name;
+ int code;
+ int prog;
+} pschar;
+
+extern pschar charlist[NASCII];
+
+/* objfnt *fontname(void); */
+/* objfnt *readobjfnt(void); */
+/* objfnt *newobjfnt(void); */
+/* float fontstringwidth(void); */
+/* short *getcharprog(void); */
+/* chardesc *BLI_getchardesc(void); */
+/* char *asciiname(void); */
+
+#endif
+
diff --git a/source/blender/editors/include/particle_effect.h b/source/blender/editors/include/particle_effect.h
new file mode 100644
index 00000000000..656c88c5618
--- /dev/null
+++ b/source/blender/editors/include/particle_effect.h
@@ -0,0 +1,47 @@
+/* dec 95
+ * jan feb 96
+ * $Id: particle_effect.h 4851 2005-07-20 04:14:21Z zuster $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef PARTICLE_EFFECT_H
+#define PARTICLE_EFFECT_H
+
+/* effect.c */
+extern Effect *add_effect(int type);
+extern PartEff *give_parteff(Object *ob);
+extern void where_is_particle(PartEff *paf, Particle *pa, float ctime, float *vec);
+extern void free_effect(Effect *eff);
+extern void free_effects(ListBase *lb);
+extern void copy_effects(ListBase *lbn, ListBase *lb);
+extern void build_particle_system(Object *ob);
+
+#endif
+
diff --git a/source/blender/editors/include/playanim_ext.h b/source/blender/editors/include/playanim_ext.h
new file mode 100644
index 00000000000..353ed04f3d7
--- /dev/null
+++ b/source/blender/editors/include/playanim_ext.h
@@ -0,0 +1,41 @@
+/*
+ * external interface
+ * $Id: playanim_ext.h 229 2002-12-27 13:11:01Z mein $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef PLAYANIM_EXT_H
+#define PLAYANIM_EXT_H
+
+/* used in apps */
+void playanim(int argc, char **argv);
+
+#endif
+
diff --git a/source/blender/editors/include/transform.h b/source/blender/editors/include/transform.h
new file mode 100644
index 00000000000..bf9d96a6658
--- /dev/null
+++ b/source/blender/editors/include/transform.h
@@ -0,0 +1,458 @@
+/**
+ * $Id: transform.h 12682 2007-11-26 22:09:57Z blendix $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef TRANSFORM_H
+#define TRANSFORM_H
+
+#include "BIF_transform.h"
+
+/* ************************** Types ***************************** */
+
+struct TransInfo;
+struct TransData;
+struct TransSnap;
+struct NumInput;
+struct Object;
+struct View3D;
+struct ScrArea;
+struct bPose;
+
+
+typedef struct NumInput {
+ short idx;
+ short idx_max;
+ short flag; /* Different flags to indicate different behaviors */
+ float val[3]; /* Direct value of the input */
+ int ctrl[3]; /* Control to indicate what to do with the numbers that are typed */
+} NumInput ;
+
+/*
+ The ctrl value has different meaning:
+ 0 : No value has been typed
+
+ otherwise, |value| - 1 is where the cursor is located after the period
+ Positive : number is positive
+ Negative : number is negative
+*/
+
+typedef struct TransSnap {
+ short modePoint;
+ short modeTarget;
+ int status;
+ float snapPoint[3];
+ float snapTarget[3];
+ float dist; // Distance from snapPoint to snapTarget
+ double last;
+ void (*applySnap)(struct TransInfo *, float *);
+ void (*calcSnap)(struct TransInfo *, float *);
+ void (*targetSnap)(struct TransInfo *);
+ float (*distance)(struct TransInfo *, float p1[3], float p2[3]); // Get the transform distance between two points (used by Closest snap)
+} TransSnap;
+
+typedef struct TransCon {
+ char text[50]; /* Description of the Constraint for header_print */
+ float mtx[3][3]; /* Matrix of the Constraint space */
+ float imtx[3][3]; /* Inverse Matrix of the Constraint space */
+ float pmtx[3][3]; /* Projection Constraint Matrix (same as imtx with some axis == 0) */
+ float center[3]; /* transformation center to define where to draw the view widget
+ ALWAYS in global space. Unlike the transformation center */
+ short imval[2]; /* initial mouse value for visual calculation */
+ /* the one in TransInfo is not garanty to stay the same (Rotates change it) */
+ int mode; /* Mode flags of the Constraint */
+ void (*drawExtra)(struct TransInfo *);
+ /* For constraints that needs to draw differently from the other
+ uses this instead of the generic draw function */
+ void (*applyVec)(struct TransInfo *, struct TransData *, float *, float *, float *);
+ /* Apply function pointer for linear vectorial transformation */
+ /* The last three parameters are pointers to the in/out/printable vectors */
+ void (*applySize)(struct TransInfo *, struct TransData *, float [3][3]);
+ /* Apply function pointer for rotation transformation (prototype will change */
+ void (*applyRot)(struct TransInfo *, struct TransData *, float [3]);
+ /* Apply function pointer for rotation transformation (prototype will change */
+} TransCon;
+
+typedef struct TransDataIpokey {
+ int flag; /* which keys */
+ float *locx, *locy, *locz; /* channel pointers */
+ float *rotx, *roty, *rotz;
+ float *quatx, *quaty, *quatz, *quatw;
+ float *sizex, *sizey, *sizez;
+ float oldloc[9]; /* storage old values */
+ float oldrot[9];
+ float oldsize[9];
+ float oldquat[12];
+} TransDataIpokey;
+
+typedef struct TransDataExtension {
+ float drot[3]; /* Initial object drot */
+ float dsize[3]; /* Initial object dsize */
+ float *rot; /* Rotation of the data to transform (Faculative) */
+ float irot[3]; /* Initial rotation */
+ float *quat; /* Rotation quaternion of the data to transform (Faculative) */
+ float iquat[4]; /* Initial rotation quaternion */
+ float *size; /* Size of the data to transform (Faculative) */
+ float isize[3]; /* Initial size */
+ float obmat[3][3]; /* Object matrix */
+} TransDataExtension;
+
+typedef struct TransData2D {
+ float loc[3]; /* Location of data used to transform (x,y,0) */
+ float *loc2d; /* Pointer to real 2d location of data */
+} TransData2D;
+
+typedef struct TransData {
+ float dist; /* Distance needed to affect element (for Proportionnal Editing) */
+ float rdist; /* Distance to the nearest element (for Proportionnal Editing) */
+ float factor; /* Factor of the transformation (for Proportionnal Editing) */
+ float *loc; /* Location of the data to transform */
+ float iloc[3]; /* Initial location */
+ float *val; /* Value pointer for special transforms */
+ float ival; /* Old value*/
+ float center[3]; /* Individual data center */
+ float mtx[3][3]; /* Transformation matrix from data space to global space */
+ float smtx[3][3]; /* Transformation matrix from global space to data space */
+ float axismtx[3][3];/* Axis orientation matrix of the data */
+ struct Object *ob;
+ TransDataExtension *ext; /* for objects, poses. 1 single malloc per TransInfo! */
+ TransDataIpokey *tdi; /* for objects, ipo keys. per transdata a malloc */
+ void *tdmir; /* mirrored element pointer, in editmode mesh to EditVert */
+ short flag; /* Various flags */
+ short protectflag; /* If set, copy of Object or PoseChannel protection */
+/*#ifdef WITH_VERSE*/
+ void *verse; /* pointer at verse data struct (VerseVert, etc.) */
+/*#endif*/
+} TransData;
+
+typedef struct TransInfo {
+ int mode; /* current mode */
+ int flag; /* generic flags for special behaviors */
+ short state; /* current state (running, canceled,...)*/
+ int context; /* current context */
+ float val; /* init value for some transformations (and rotation angle) */
+ float fac; /* factor for distance based transform */
+ int (*transform)(struct TransInfo *, short *);
+ /* transform function pointer */
+ int (*handleEvent)(struct TransInfo *, unsigned short event, short val);
+ /* event handler function pointer RETURN 1 if redraw is needed */
+ int total; /* total number of transformed data */
+ TransData *data; /* transformed data (array) */
+ TransDataExtension *ext; /* transformed data extension (array) */
+ TransData2D *data2d; /* transformed data for 2d (array) */
+ TransCon con; /* transformed constraint */
+ TransSnap tsnap;
+ NumInput num; /* numerical input */
+ char redraw; /* redraw flag */
+ float propsize; /* proportional circle radius */
+ char proptext[20]; /* proportional falloff text */
+ float center[3]; /* center of transformation */
+ int center2d[2]; /* center in screen coordinates */
+ short imval[2]; /* initial mouse position */
+ short shiftmval[2]; /* mouse position when shift was pressed */
+ short idx_max; /* maximum index on the input vector */
+ float snap[3]; /* Snapping Gears */
+
+ float viewmat[4][4]; /* copy from G.vd, prevents feedback, */
+ float viewinv[4][4]; /* and to make sure we don't have to */
+ float persmat[4][4]; /* access G.vd from other space types */
+ float persinv[4][4];
+ short persp;
+ short around;
+ char spacetype; /* spacetype where transforming is */
+
+ float vec[3]; /* translation, to show for widget */
+ float mat[3][3]; /* rot/rescale, to show for widget */
+
+ char *undostr; /* if set, uses this string for undo */
+ float spacemtx[3][3]; /* orientation matrix of the current space */
+ char spacename[32]; /* name of the current space */
+
+ struct Object *poseobj; /* if t->flag & T_POSE, this denotes pose object */
+
+ void *customData; /* Per Transform custom data */
+} TransInfo;
+
+
+/* ******************** Macros & Prototypes *********************** */
+
+/* NUMINPUT FLAGS */
+#define NUM_NULL_ONE 2
+#define NUM_NO_NEGATIVE 4
+#define NUM_NO_ZERO 8
+#define NUM_NO_FRACTION 16
+#define NUM_AFFECT_ALL 32
+
+/* transinfo->state */
+#define TRANS_RUNNING 0
+#define TRANS_CONFIRM 1
+#define TRANS_CANCEL 2
+
+/* transinfo->flag */
+#define T_OBJECT (1 << 0)
+#define T_EDIT (1 << 1)
+#define T_POSE (1 << 2)
+#define T_TEXTURE (1 << 3)
+#define T_CAMERA (1 << 4)
+ // when shift pressed, higher resolution transform. cannot rely on G.qual, need event!
+#define T_SHIFT_MOD (1 << 5)
+ // trans on points, having no rotation/scale
+#define T_POINTS (1 << 6)
+ // for manipulator exceptions, like scaling using center point, drawing help lines
+#define T_USES_MANIPULATOR (1 << 7)
+
+/* restrictions flags */
+#define T_ALL_RESTRICTIONS ((1 << 8)|(1 << 9)|(1 << 10))
+#define T_NO_CONSTRAINT (1 << 8)
+#define T_NULL_ONE (1 << 9)
+#define T_NO_ZERO (1 << 10)
+
+#define T_PROP_EDIT (1 << 11)
+#define T_PROP_CONNECTED (1 << 12)
+
+/* if MMB is pressed or not */
+#define T_MMB_PRESSED (1 << 13)
+
+#define T_V3D_ALIGN (1 << 14)
+#define T_2D_EDIT (1 << 15) /* for 2d views like uv or ipo */
+#define T_CLIP_UV (1 << 16)
+
+#define T_FREE_CUSTOMDATA (1 << 17)
+
+/* ******************************************************************************** */
+
+/* transinfo->con->mode */
+#define CON_APPLY 1
+#define CON_AXIS0 2
+#define CON_AXIS1 4
+#define CON_AXIS2 8
+#define CON_SELECT 16
+#define CON_NOFLIP 32 /* does not reorient vector to face viewport when on */
+#define CON_LOCAL 64
+#define CON_USER 128
+
+/* transdata->flag */
+#define TD_SELECTED 1
+#define TD_NOACTION 2
+#define TD_USEQUAT 4
+#define TD_NOTCONNECTED 8
+#define TD_SINGLESIZE 16 /* used for scaling of MetaElem->rad */
+#ifdef WITH_VERSE
+ #define TD_VERSE_OBJECT 32
+ #define TD_VERSE_VERT 64
+#endif
+#define TD_TIMEONLY 128
+#define TD_NOCENTER 256
+#define TD_NO_EXT 512 /* ext abused for particle key timing */
+#define TD_SKIP 1024 /* don't transform this data */
+
+/* transsnap->status */
+#define SNAP_ON 1
+#define TARGET_INIT 2
+#define POINT_INIT 4
+
+/* transsnap->modePoint */
+#define SNAP_GRID 0
+#define SNAP_GEO 1
+
+/* transsnap->modeTarget */
+#define SNAP_CLOSEST 0
+#define SNAP_CENTER 1
+#define SNAP_MEDIAN 2
+
+void checkFirstTime(void);
+
+void setTransformViewMatrices(TransInfo *t);
+void convertViewVec(TransInfo *t, float *vec, short dx, short dy);
+void projectIntView(TransInfo *t, float *vec, int *adr);
+void projectFloatView(TransInfo *t, float *vec, float *adr);
+
+void convertVecToDisplayNum(float *vec, float *num);
+void convertDisplayNumToVec(float *num, float *vec);
+
+void initWarp(TransInfo *t);
+int Warp(TransInfo *t, short mval[2]);
+
+void initShear(TransInfo *t);
+int handleEventShear(TransInfo *t, unsigned short evenl, short val);
+int Shear(TransInfo *t, short mval[2]);
+
+void initResize(TransInfo *t);
+int Resize(TransInfo *t, short mval[2]);
+
+void initTranslation(TransInfo *t);
+int Translation(TransInfo *t, short mval[2]);
+
+void initToSphere(TransInfo *t);
+int ToSphere(TransInfo *t, short mval[2]);
+
+void initRotation(TransInfo *t);
+int Rotation(TransInfo *t, short mval[2]);
+
+void initShrinkFatten(TransInfo *t);
+int ShrinkFatten(TransInfo *t, short mval[2]);
+
+void initTilt(TransInfo *t);
+int Tilt(TransInfo *t, short mval[2]);
+
+void initCurveShrinkFatten(TransInfo *t);
+int CurveShrinkFatten(TransInfo *t, short mval[2]);
+
+void initTrackball(TransInfo *t);
+int Trackball(TransInfo *t, short mval[2]);
+
+void initPushPull(TransInfo *t);
+int PushPull(TransInfo *t, short mval[2]);
+
+void initCrease(TransInfo *t);
+int Crease(TransInfo *t, short mval[2]);
+
+void initBoneSize(TransInfo *t);
+int BoneSize(TransInfo *t, short mval[2]);
+
+void initBoneEnvelope(TransInfo *t);
+int BoneEnvelope(TransInfo *t, short mval[2]);
+
+void initBoneRoll(TransInfo *t);
+int BoneRoll(TransInfo *t, short mval[2]);
+
+void initTimeTranslate(TransInfo *t);
+int TimeTranslate(TransInfo *t, short mval[2]);
+
+void initTimeSlide(TransInfo *t);
+int TimeSlide(TransInfo *t, short mval[2]);
+
+void initTimeScale(TransInfo *t);
+int TimeScale(TransInfo *t, short mval[2]);
+
+void initBakeTime(TransInfo *t);
+int BakeTime(TransInfo *t, short mval[2]);
+
+/*********************** transform_conversions.c ********** */
+struct ListBase;
+void flushTransIpoData(TransInfo *t);
+void flushTransUVs(TransInfo *t);
+void flushTransParticles(TransInfo *t);
+int clipUVTransform(TransInfo *t, float *vec, int resize);
+
+/*********************** exported from transform_manipulator.c ********** */
+void draw_manipulator_ext(struct ScrArea *sa, int type, char axis, int col, float vec[3], float mat[][3]);
+int calc_manipulator_stats(struct ScrArea *sa);
+float get_drawsize(struct View3D *v3d);
+
+/*********************** TransData Creation and General Handling *********** */
+void createTransData(TransInfo *t);
+void sort_trans_data_dist(TransInfo *t);
+void add_tdi_poin(float *poin, float *old, float delta);
+void special_aftertrans_update(TransInfo *t);
+
+/* auto-keying stuff used by special_aftertrans_update */
+void autokeyframe_ob_cb_func(struct Object *ob, int tmode);
+void autokeyframe_pose_cb_func(struct Object *ob, int tmode, short targetless_ik);
+
+/*********************** Constraints *****************************/
+
+void getConstraintMatrix(TransInfo *t);
+void setConstraint(TransInfo *t, float space[3][3], int mode, const char text[]);
+void setLocalConstraint(TransInfo *t, int mode, const char text[]);
+void setUserConstraint(TransInfo *t, int mode, const char text[]);
+
+void constraintNumInput(TransInfo *t, float vec[3]);
+
+void getConstraintMatrix(TransInfo *t);
+int isLockConstraint(TransInfo *t);
+int getConstraintSpaceDimension(TransInfo *t);
+char constraintModeToChar(TransInfo *t);
+
+void startConstraint(TransInfo *t);
+void stopConstraint(TransInfo *t);
+
+void initSelectConstraint(TransInfo *t, float mtx[3][3]);
+void selectConstraint(TransInfo *t);
+void postSelectConstraint(TransInfo *t);
+
+void setNearestAxis(TransInfo *t);
+
+/*********************** Snapping ********************************/
+
+typedef enum {
+ NO_GEARS = 0,
+ BIG_GEARS = 1,
+ SMALL_GEARS = 2
+} GearsType;
+
+void snapGrid(TransInfo *t, float *val);
+void snapGridAction(TransInfo *t, float *val, GearsType action);
+
+void initSnapping(struct TransInfo *t);
+void applySnapping(TransInfo *t, float *vec);
+void resetSnapping(TransInfo *t);
+int handleSnapping(TransInfo *t, int event);
+void drawSnapping(TransInfo *t);
+
+/*********************** Generics ********************************/
+
+void initTrans(TransInfo *t);
+void initTransModeFlags(TransInfo *t, int mode);
+void postTrans (TransInfo *t);
+
+void drawLine(float *center, float *dir, char axis, short options);
+
+/* DRAWLINE options flags */
+#define DRAWLIGHT 1
+#define DRAWDASHED 2
+#define DRAWBOLD 4
+
+void applyTransObjects(TransInfo *t);
+void restoreTransObjects(TransInfo *t);
+void recalcData(TransInfo *t);
+
+void calculateCenter(TransInfo *t);
+void calculateCenter2D(TransInfo *t);
+void calculateCenterBound(TransInfo *t);
+void calculateCenterMedian(TransInfo *t);
+void calculateCenterCursor(TransInfo *t);
+
+void calculateCenterCursor2D(TransInfo *t);
+void calculatePropRatio(TransInfo *t);
+
+void getViewVector(float coord[3], float vec[3]);
+
+TransInfo * BIF_GetTransInfo(void);
+
+/*********************** NumInput ********************************/
+
+void outputNumInput(NumInput *n, char *str);
+short hasNumInput(NumInput *n);
+void applyNumInput(NumInput *n, float *vec);
+char handleNumInput(NumInput *n, unsigned short event);
+
+#endif
+
diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h
deleted file mode 100644
index e4986727ab1..00000000000
--- a/source/blender/python/BPY_extern.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code was in: source/blender/bpython/include/BPY_extern.h
- *
- * Contributor(s): Michel Selten, Willian P. Germano, Chris Keith
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#ifndef BPY_EXTERN_H
-#define BPY_EXTERN_H
-
-extern char bprogname[]; /* holds a copy of argv[0], from creator.c */
-
-struct Text; /* defined in DNA_text_types.h */
-struct ID; /* DNA_ID.h */
-struct Object; /* DNA_object_types.h */
-struct IpoDriver; /* DNA_curve_types.h */
-struct ScriptLink; /* DNA_scriptlink_types.h */
-struct ListBase; /* DNA_listBase.h */
-struct SpaceText; /* DNA_space_types.h */
-struct SpaceScript; /* DNA_space_types.h */
-struct Script; /* BPI_script.h */
-struct ScrArea; /* DNA_screen_types.h */
-struct bScreen; /* DNA_screen_types.h */
-struct bConstraint; /* DNA_constraint_types.h */
-struct bPythonConstraint; /* DNA_constraint_types.h */
-struct bConstraintOb; /* DNA_constraint_types.h */
-struct bConstraintTarget; /* DNA_constraint_types.h*/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- /*These two next functions are important for making sure the Draw module
- works correctly. Before calling any gui callback using the Draw module,
- the following code must be executed:
-
- if (some_drawspace_pylist) {
- BPy_Set_DrawButtonsList(some_drawspace_pylist->but_refs);
- BPy_Free_DrawButtonsList();
- }
- some_drawspace_pylist = PyList_New(0);
- BPy_Set_DrawButtonsList(some_drawspace_pylist);
-
- Also, BPy_Free_DrawButtonsList() must be called as necassary when a drawspace
- with python callbacks is destroyed.
-
- This is necassary to avoid blender buttons storing invalid pointers to freed
- python data.*/
- void BPy_Set_DrawButtonsList(void *list);
- void BPy_Free_DrawButtonsList(void);
-
- void BPY_pyconstraint_eval(struct bPythonConstraint *con, struct bConstraintOb *cob, struct ListBase *targets);
- void BPY_pyconstraint_settings(void *arg1, void *arg2);
- void BPY_pyconstraint_target(struct bPythonConstraint *con, struct bConstraintTarget *ct);
- void BPY_pyconstraint_update(struct Object *owner, struct bConstraint *con);
- int BPY_is_pyconstraint(struct Text *text);
-
- void BPY_start_python( int argc, char **argv );
- void BPY_end_python( void );
- void BPY_post_start_python( void );
- void init_syspath( int first_time );
- void syspath_append( char *dir );
-
- int BPY_Err_getLinenumber( void );
- const char *BPY_Err_getFilename( void );
-
- int BPY_txt_do_python_Text( struct Text *text );
- int BPY_menu_do_python( short menutype, int event );
- void BPY_run_python_script( char *filename );
- void BPY_free_compiled_text( struct Text *text );
-
- void BPY_clear_bad_scriptlinks( struct Text *byebye );
- int BPY_has_onload_script( void );
- void BPY_do_all_scripts( short event );
- int BPY_check_all_scriptlinks( struct Text *text );
- void BPY_do_pyscript( struct ID *id, short event );
- void BPY_free_scriptlink( struct ScriptLink *slink );
- void BPY_copy_scriptlink( struct ScriptLink *scriptlink );
-
- int BPY_is_spacehandler(struct Text *text, char spacetype);
- int BPY_del_spacehandler(struct Text *text, struct ScrArea *sa);
- int BPY_add_spacehandler(struct Text *txt, struct ScrArea *sa,char spacetype);
- int BPY_has_spacehandler(struct Text *text, struct ScrArea *sa);
- void BPY_screen_free_spacehandlers(struct bScreen *sc);
- int BPY_do_spacehandlers(struct ScrArea *sa, unsigned short event,
- unsigned short space_event);
-
- void BPY_pydriver_update(void);
- float BPY_pydriver_eval(struct IpoDriver *driver);
- struct Object **BPY_pydriver_get_objects(struct IpoDriver *driver);
-
- int BPY_button_eval(char *expr, double *value);
-
-/* format importer hook */
- int BPY_call_importloader( char *name );
-
- void BPY_spacescript_do_pywin_draw( struct SpaceScript *sc );
- void BPY_spacescript_do_pywin_event( struct SpaceScript *sc,
- unsigned short event, short val, char ascii );
- void BPY_clear_script( struct Script *script );
- void BPY_free_finished_script( struct Script *script );
-
-/* void BPY_Err_Handle(struct Text *text); */
-/* void BPY_clear_bad_scriptlink(struct ID *id, struct Text *byebye); */
-/* void BPY_clear_bad_scriptlist(struct ListBase *, struct Text *byebye); */
-/* int BPY_spacetext_is_pywin(struct SpaceText *st); */
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* BPY_EXTERN_H */
diff --git a/source/blender/python/BPY_interface.c b/source/blender/python/BPY_interface.c
deleted file mode 100644
index 770fbf13931..00000000000
--- a/source/blender/python/BPY_interface.c
+++ /dev/null
@@ -1,2659 +0,0 @@
-/*
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Michel Selten, Willian P. Germano, Stephen Swaney,
- * Chris Keith, Chris Want, Ken Hughes
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#include <Python.h>
-
-#include "compile.h" /* for the PyCodeObject */
-#include "eval.h" /* for PyEval_EvalCode */
-#include "BLI_blenlib.h" /* for BLI_last_slash() */
-#include "BIF_interface.h" /* for pupmenu() */
-#include "BIF_space.h"
-#include "BIF_screen.h"
-#include "BIF_toolbox.h"
-#include "BKE_action.h" /* for get_pose_channel() */
-#include "BKE_library.h"
-#include "BKE_object.h" /* during_scriptlink() */
-#include "BKE_text.h"
-#include "BKE_constraint.h" /* for bConstraintOb */
-#include "BKE_idprop.h"
-
-#include "DNA_curve_types.h" /* for struct IpoDriver */
-#include "DNA_ID.h" /* ipo driver */
-#include "DNA_object_types.h" /* ipo driver */
-#include "DNA_constraint_types.h" /* for pyconstraint */
-
-#include "DNA_screen_types.h"
-#include "DNA_userdef_types.h" /* for U.pythondir */
-#include "MEM_guardedalloc.h"
-#include "BPY_extern.h"
-#include "BPY_menus.h"
-#include "BPI_script.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_armature.h"
-#include "api2_2x/EXPP_interface.h"
-#include "api2_2x/constant.h"
-#include "api2_2x/gen_utils.h"
-#include "api2_2x/gen_library.h" /* GetPyObjectFromID */
-#include "api2_2x/BGL.h"
-#include "api2_2x/Blender.h"
-#include "api2_2x/Camera.h"
-#include "api2_2x/Draw.h"
-#include "api2_2x/Object.h"
-#include "api2_2x/Registry.h"
-#include "api2_2x/Pose.h"
-#include "api2_2x/bpy.h" /* for the new "bpy" module */
-
-/*these next two are for pyconstraints*/
-#include "api2_2x/IDProp.h"
-#include "api2_2x/matrix.h"
-
-/* for scriptlinks */
-#include "DNA_lamp_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_world_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_material_types.h"
-
-/* bpy_registryDict is declared in api2_2x/Registry.h and defined
- * in api2_2x/Registry.c
- * This Python dictionary will be used to store data that scripts
- * choose to preserve after they are executed, so user changes can be
- * restored next time the script is used. Check the Blender.Registry module.
- */
-/*#include "api2_2x/Registry.h" */
-
-/* for pydrivers (ipo drivers defined by one-line Python expressions) */
-PyObject *bpy_pydriver_Dict = NULL;
-
-/*
- * set up a weakref list for Armatures
- * creates list in __main__ module dict
- */
-
-int setup_armature_weakrefs()
-{
- PyObject *maindict;
- PyObject *main_module;
- char *list_name = ARM_WEAKREF_LIST_NAME;
-
- main_module = PyImport_AddModule( "__main__");
- if(main_module){
- PyObject *weakreflink;
- maindict= PyModule_GetDict(main_module);
-
- /* check if there is already a dict entry for the armature weakrefs,
- * and delete if so before making another one */
-
- weakreflink= PyDict_GetItemString(maindict,list_name);
- if( weakreflink != NULL ) {
- PyDict_DelItemString(maindict,list_name);
- Py_XDECREF( weakreflink );
- }
-
- if (PyDict_SetItemString(maindict,
- list_name,
- PyList_New(0)) == -1){
- printf("Oops - setup_armature_weakrefs()\n");
-
- return 0;
- }
- }
- return 1;
-}
-
-/* Declares the modules and their initialization functions
- * These are TOP-LEVEL modules e.g. import `module` - there is no
- * support for packages here e.g. import `package.module` */
-
-static struct _inittab BPy_Inittab_Modules[] = {
- {"Blender", M_Blender_Init},
- {"bpy", m_bpy_init},
- {NULL, NULL}
-};
-
-/*************************************************************************
-* Structure definitions
-**************************************************************************/
-#define FILENAME_LENGTH 24
-
-typedef struct _ScriptError {
- char filename[FILENAME_LENGTH];
- int lineno;
-} ScriptError;
-
-/****************************************************************************
-* Global variables
-****************************************************************************/
-ScriptError g_script_error;
-
-/***************************************************************************
-* Function prototypes
-***************************************************************************/
-PyObject *RunPython( Text * text, PyObject * globaldict );
-char *GetName( Text * text );
-PyObject *CreateGlobalDictionary( void );
-void ReleaseGlobalDictionary( PyObject * dict );
-void DoAllScriptsFromList( ListBase * list, short event );
-PyObject *importText( char *name );
-void init_ourImport( void );
-void init_ourReload( void );
-PyObject *blender_import( PyObject * self, PyObject * args );
-PyObject *RunPython2( Text * text, PyObject * globaldict, PyObject *localdict );
-
-
-void BPY_Err_Handle( char *script_name );
-PyObject *traceback_getFilename( PyObject * tb );
-
-/****************************************************************************
-* Description: This function will start the interpreter and load all modules
-* as well as search for a python installation.
-****************************************************************************/
-void BPY_start_python( int argc, char **argv )
-{
- static int argc_copy = 0;
- static char **argv_copy = NULL;
- int first_time = argc;
-
- /* we keep a copy of the values of argc and argv so that the game engine
- * can call BPY_start_python(0, NULL) whenever a game ends, without having
- * to know argc and argv there (in source/blender/src/space.c) */
- if( first_time ) {
- argc_copy = argc;
- argv_copy = argv;
- }
-
- //stuff for Registry module
- bpy_registryDict = PyDict_New( );/* check comment at start of this file */
- if( !bpy_registryDict )
- printf( "Error: Couldn't create the Registry Python Dictionary!" );
- Py_SetProgramName( "blender" );
-
- /* Py_Initialize() will attempt to import the site module and
- * print an error if not found. See init_syspath() for the
- * rest of our init msgs.
- */
-
- /* print Python version
- * Py_GetVersion() returns a ptr to a static string "9.9.9 (aaaa..."
- */
- {
- int count = 3; /* a nice default for major.minor. example 2.5 */
- const char *version = Py_GetVersion();
- /* we know a blank is there somewhere! */
- char *blank_ptr = strchr( version, ' ');
- if(blank_ptr)
- count = blank_ptr - version;
-
- printf( "Compiled with Python version %.*s.\n", count, version );
- }
-
-
- //Initialize the TOP-LEVEL modules
- PyImport_ExtendInittab(BPy_Inittab_Modules);
-
- //Start the interpreter
- Py_Initialize( );
- PySys_SetArgv( argc_copy, argv_copy );
-
- //Overrides __import__
- init_ourImport( );
- init_ourReload( );
-
- //init a global dictionary
- g_blenderdict = NULL;
-
- //Look for a python installation
- init_syspath( first_time ); /* not first_time: some msgs are suppressed */
-
- return;
-}
-
-/*****************************************************************************/
-/* Description: This function will terminate the Python interpreter */
-/*****************************************************************************/
-void BPY_end_python( void )
-{
- Script *script = NULL;
-
- if( bpy_registryDict ) {
- Py_DECREF( bpy_registryDict );
- bpy_registryDict = NULL;
- }
-
- if( bpy_pydriver_Dict ) {
- Py_DECREF( bpy_pydriver_Dict );
- bpy_pydriver_Dict = NULL;
- }
-
- /* Freeing all scripts here prevents problems with the order in which
- * Python is finalized and G.main is freed in exit_usiblender() */
- for (script = G.main->script.first; script; script = script->id.next) {
- BPY_clear_script(script);
- free_libblock( &G.main->script, script );
- }
-
- Py_Finalize( );
-
- BPyMenu_RemoveAllEntries( ); /* freeing bpymenu mem */
-
- /* a script might've opened a .blend file but didn't close it, so: */
- EXPP_Library_Close( );
-
- return;
-}
-
-void syspath_append( char *dirname )
-{
- PyObject *mod_sys= NULL, *dict= NULL, *path= NULL, *dir= NULL;
- short ok=1;
- PyErr_Clear( );
-
- dir = Py_BuildValue( "s", dirname );
-
- mod_sys = PyImport_ImportModule( "sys" ); /* new ref */
-
- if (mod_sys) {
- dict = PyModule_GetDict( mod_sys ); /* borrowed ref */
- path = PyDict_GetItemString( dict, "path" ); /* borrowed ref */
- if ( !PyList_Check( path ) ) {
- ok = 0;
- }
- } else {
- /* cant get the sys module */
- ok = 0;
- }
-
- if (ok && PyList_Append( path, dir ) != 0)
- ok = 0; /* append failed */
-
- if( (ok==0) || PyErr_Occurred( ) )
- Py_FatalError( "could import or build sys.path, can't continue" );
-
- Py_XDECREF( mod_sys );
-}
-
-void init_syspath( int first_time )
-{
- PyObject *path;
- PyObject *mod, *d;
- char *progname;
- char execdir[FILE_MAXDIR]; /*defines from DNA_space_types.h */
-
- int n;
-
- path = Py_BuildValue( "s", bprogname );
-
- mod = PyImport_ImportModule( "Blender.sys" );
-
- if( mod ) {
- d = PyModule_GetDict( mod );
- EXPP_dict_set_item_str( d, "progname", path );
- Py_DECREF( mod );
- } else
- printf( "Warning: could not set Blender.sys.progname\n" );
-
- progname = BLI_last_slash( bprogname ); /* looks for the last dir separator */
-
- n = progname - bprogname;
- if( n > 0 ) {
- strncpy( execdir, bprogname, n );
- if( execdir[n - 1] == '.' )
- n--; /*fix for when run as ./blender */
- execdir[n] = '\0';
-
- syspath_append( execdir ); /* append to module search path */
- } else
- printf( "Warning: could not determine argv[0] path\n" );
-
- /*
- attempt to import 'site' module as a check for valid
- python install found.
- */
-
- printf("Checking for installed Python... "); /* appears after msg "Compiled with Python 2.x" */
- mod = PyImport_ImportModule( "site" ); /* new ref */
-
- if( mod ) {
- printf("got it!\n");
- Py_DECREF( mod );
- } else { /* import 'site' failed */
- PyErr_Clear( );
- if( first_time ) {
- printf( "No installed Python found.\n" );
- printf( "Only built-in modules are available. Some scripts may not run.\n" );
- printf( "Continuing happily.\n" );
- }
- }
-
-
- /*
- * initialize the sys module
- * set sys.executable to the Blender exe
- */
-
- mod = PyImport_ImportModule( "sys" ); /* new ref */
-
- if( mod ) {
- d = PyModule_GetDict( mod ); /* borrowed ref */
- EXPP_dict_set_item_str( d, "executable",
- Py_BuildValue( "s", bprogname ) );
- Py_DECREF( mod );
- } else{
- printf("import of sys module failed\n");
- }
-}
-
-/****************************************************************************
-* Description: This function finishes Python initialization in Blender.
-
-Because U.pythondir (user defined dir for scripts) isn't
-initialized when BPY_start_Python needs to be executed, we
-postpone adding U.pythondir to sys.path and also BPyMenus
-(mechanism to register scripts in Blender menus) for when
-that dir info is available.
-****************************************************************************/
-void BPY_post_start_python( void )
-{
- char dirpath[FILE_MAX];
- char *sdir = NULL;
-
- if(U.pythondir[0] != '\0' ) {
- char modpath[FILE_MAX];
- int upyslen = strlen(U.pythondir);
-
- /* check if user pydir ends with a slash and, if so, remove the slash
- * (for eventual implementations of c library's stat function that might
- * not like it) */
- if (upyslen > 2) { /* avoids doing anything if dir == '//' */
- char ending = U.pythondir[upyslen - 1];
-
- if (ending == '/' || ending == '\\')
- U.pythondir[upyslen - 1] = '\0';
- }
-
- BLI_strncpy(dirpath, U.pythondir, FILE_MAX);
- BLI_convertstringcode(dirpath, G.sce, 0);
- syspath_append(dirpath); /* append to module search path */
-
- BLI_make_file_string("/", modpath, dirpath, "bpymodules");
- if (BLI_exists(modpath)) syspath_append(modpath);
- }
-
- sdir = bpy_gethome(1);
- if (sdir) {
-
- syspath_append(sdir);
-
- BLI_make_file_string("/", dirpath, sdir, "bpymodules");
- if (BLI_exists(dirpath)) syspath_append(dirpath);
- }
-
- BPyMenu_Init( 0 ); /* get dynamic menus (registered scripts) data */
-
- return;
-}
-
-/****************************************************************************
-* Description: This function will return the linenumber on which an error
-* has occurred in the Python script.
-****************************************************************************/
-int BPY_Err_getLinenumber( void )
-{
- return g_script_error.lineno;
-}
-
-/*****************************************************************************/
-/* Description: This function will return the filename of the python script. */
-/*****************************************************************************/
-const char *BPY_Err_getFilename( void )
-{
- return g_script_error.filename;
-}
-
-/*****************************************************************************/
-/* Description: Return PyString filename from a traceback object */
-/*****************************************************************************/
-PyObject *traceback_getFilename( PyObject * tb )
-{
- PyObject *v = NULL;
-
-/* co_filename is in f_code, which is in tb_frame, which is in tb */
-
- v = PyObject_GetAttrString( tb, "tb_frame" );
- if (v) {
- Py_DECREF( v );
- v = PyObject_GetAttrString( v, "f_code" );
- if (v) {
- Py_DECREF( v );
- v = PyObject_GetAttrString( v, "co_filename" );
- }
- }
-
- if (v) return v;
- else return PyString_FromString("unknown");
-}
-
-/****************************************************************************
-* Description: Blender Python error handler. This catches the error and
-* stores filename and line number in a global
-*****************************************************************************/
-void BPY_Err_Handle( char *script_name )
-{
- PyObject *exception, *err, *tb, *v;
-
- if( !script_name ) {
- printf( "Error: script has NULL name\n" );
- return;
- }
-
- PyErr_Fetch( &exception, &err, &tb );
-
- if (!script_name) script_name = "untitled";
- //if( !exception && !tb ) {
- // printf( "FATAL: spurious exception\n" );
- // return;
- //}
-
- strcpy( g_script_error.filename, script_name );
-
- if( exception
- && PyErr_GivenExceptionMatches( exception, PyExc_SyntaxError ) ) {
- /* no traceback available when SyntaxError */
- PyErr_Restore( exception, err, tb ); /* takes away reference! */
- PyErr_Print( );
- v = PyObject_GetAttrString( err, "lineno" );
- if( v ) {
- g_script_error.lineno = PyInt_AsLong( v );
- Py_DECREF( v );
- } else {
- g_script_error.lineno = -1;
- }
- /* this avoids an abort in Python 2.3's garbage collecting: */
- PyErr_Clear( );
- return;
- } else {
- PyErr_NormalizeException( &exception, &err, &tb );
- PyErr_Restore( exception, err, tb ); /* takes away reference! */
- PyErr_Print( );
- tb = PySys_GetObject( "last_traceback" );
-
- if( !tb ) {
- printf( "\nCan't get traceback\n" );
- return;
- }
-
- Py_INCREF( tb );
-
-/* From old bpython BPY_main.c:
- * 'check traceback objects and look for last traceback in the
- * same text file. This is used to jump to the line of where the
- * error occured. "If the error occured in another text file or module,
- * the last frame in the current file is adressed."'
- */
-
- for(;;) {
- v = PyObject_GetAttrString( tb, "tb_next" );
-
- if( !v || v == Py_None ||
- strcmp(PyString_AsString(traceback_getFilename(v)), script_name)) {
- break;
- }
-
- Py_DECREF( tb );
- tb = v;
- }
-
- v = PyObject_GetAttrString( tb, "tb_lineno" );
- if (v) {
- g_script_error.lineno = PyInt_AsLong(v);
- Py_DECREF(v);
- }
- v = traceback_getFilename( tb );
- if (v) {
- strncpy( g_script_error.filename, PyString_AsString( v ),
- FILENAME_LENGTH );
- Py_DECREF(v);
- }
- Py_DECREF( tb );
- }
-
- return;
-}
-
-/****************************************************************************
-* Description: This function executes the script passed by st.
-* Notes: It is called by blender/src/drawtext.c when a Blender user
-* presses ALT+PKEY in the script's text window.
-*****************************************************************************/
-int BPY_txt_do_python_Text( struct Text *text )
-{
- PyObject *py_dict, *py_result;
- BPy_constant *info;
- char textname[24];
- Script *script = G.main->script.first;
-
- if( !text )
- return 0;
-
- /* check if this text is already running */
- while( script ) {
- if( !strcmp( script->id.name + 2, text->id.name + 2 ) ) {
- /* if this text is already a running script,
- * just move to it: */
- SpaceScript *sc;
- newspace( curarea, SPACE_SCRIPT );
- sc = curarea->spacedata.first;
- sc->script = script;
- return 1;
- }
- script = script->id.next;
- }
-
- /* Create a new script structure and initialize it: */
- script = alloc_libblock( &G.main->script, ID_SCRIPT, GetName( text ) );
-
- if( !script ) {
- printf( "couldn't allocate memory for Script struct!" );
- return 0;
- }
-
- /* if in the script Blender.Load(blendfile) is not the last command,
- * an error after it will call BPY_Err_Handle below, but the text struct
- * will have been deallocated already, so we need to copy its name here.
- */
- BLI_strncpy( textname, GetName( text ),
- strlen( GetName( text ) ) + 1 );
-
- script->id.us = 1;
- script->flags = SCRIPT_RUNNING;
- script->py_draw = NULL;
- script->py_event = NULL;
- script->py_button = NULL;
- script->py_browsercallback = NULL;
-
- py_dict = CreateGlobalDictionary( );
-
- if( !setup_armature_weakrefs()){
- printf("Oops - weakref dict\n");
- return 0;
- }
-
- script->py_globaldict = py_dict;
-
- info = ( BPy_constant * ) PyConstant_New( );
- if( info ) {
- PyConstant_Insert( info, "name",
- PyString_FromString( script->id.name + 2 ) );
- Py_INCREF( Py_None );
- PyConstant_Insert( info, "arg", Py_None );
- EXPP_dict_set_item_str( py_dict, "__script__",
- ( PyObject * ) info );
- }
-
- py_result = RunPython( text, py_dict ); /* Run the script */
-
- if( !py_result ) { /* Failed execution of the script */
-
- BPY_Err_Handle( textname );
- ReleaseGlobalDictionary( py_dict );
- script->py_globaldict = NULL;
- if( G.main->script.first )
- free_libblock( &G.main->script, script );
-
- return 0;
- } else {
- Py_DECREF( py_result );
- script->flags &= ~SCRIPT_RUNNING;
- if( !script->flags ) {
- ReleaseGlobalDictionary( py_dict );
- script->py_globaldict = NULL;
- free_libblock( &G.main->script, script );
- }
- }
-
- return 1; /* normal return */
-}
-
-/****************************************************************************
-* Description: Called from command line to run a Python script
-* automatically. The script can be a file or a Blender Text in the current
-* .blend.
-****************************************************************************/
-void BPY_run_python_script( char *fn )
-{
- Text *text = NULL;
- int is_blender_text = 0;
-
- if (!BLI_exists(fn)) { /* if there's no such filename ... */
- text = G.main->text.first; /* try an already existing Blender Text */
-
- while (text) {
- if (!strcmp(fn, text->id.name + 2)) break;
- text = text->id.next;
- }
-
- if (text == NULL) {
- printf("\nError: no such file or Blender text -- %s.\n", fn);
- return;
- }
- else is_blender_text = 1; /* fn is already a Blender Text */
- }
-
- else {
- text = add_text(fn);
-
- if (text == NULL) {
- printf("\nError in BPY_run_python_script:\n"
- "couldn't create Blender text from %s\n", fn);
- /* Chris: On Windows if I continue I just get a segmentation
- * violation. To get a baseline file I exit here. */
- exit(2);
- /* return; */
- }
- }
-
- if (BPY_txt_do_python_Text(text) != 1) {
- printf("\nError executing Python script from command-line:\n"
- "%s (at line %d).\n", fn, BPY_Err_getLinenumber());
- }
-
- if (!is_blender_text) {
- /* We can't simply free the text, since the script might have called
- * Blender.Load() to load a new .blend, freeing previous data.
- * So we check if the pointer is still valid. */
- Text *txtptr = G.main->text.first;
- while (txtptr) {
- if (txtptr == text) {
- free_libblock(&G.main->text, text);
- break;
- }
- txtptr = txtptr->id.next;
- }
- }
-}
-
-/****************************************************************************
-* Description: This function executes the script chosen from a menu.
-* Notes: It is called by the ui code in src/header_???.c when a user
-* clicks on a menu entry that refers to a script.
-* Scripts are searched in the BPyMenuTable, using the given
-* menutype and event values to know which one was chosen.
-*****************************************************************************/
-int BPY_menu_do_python( short menutype, int event )
-{
- PyObject *py_dict, *py_res, *pyarg = NULL;
- BPy_constant *info;
- BPyMenu *pym;
- BPySubMenu *pysm;
- FILE *fp = NULL;
- char *buffer, *s;
- char filestr[FILE_MAXDIR + FILE_MAXFILE];
- char scriptname[21];
- Script *script = NULL;
- int len;
-
- pym = BPyMenu_GetEntry( menutype, ( short ) event );
-
- if( !pym )
- return 0;
-
- if( pym->version > G.version )
- notice( "Version mismatch: script was written for Blender %d. "
- "It may fail with yours: %d.", pym->version,
- G.version );
-
-/* if there are submenus, let the user choose one from a pupmenu that we
- * create here.*/
- pysm = pym->submenus;
- if( pysm ) {
- char *pupstr;
- int arg;
-
- pupstr = BPyMenu_CreatePupmenuStr( pym, menutype );
-
- if( pupstr ) {
- arg = pupmenu( pupstr );
- MEM_freeN( pupstr );
-
- if( arg >= 0 ) {
- while( arg-- )
- pysm = pysm->next;
- pyarg = PyString_FromString( pysm->arg );
- } else
- return 0;
- }
- }
-
- if( !pyarg ) { /* no submenus */
- Py_INCREF( Py_None );
- pyarg = Py_None;
- }
-
- if( pym->dir ) { /* script is in U.pythondir */
- char upythondir[FILE_MAXDIR];
-
- /* dirs in Blender can be "//", which has a special meaning */
- BLI_strncpy(upythondir, U.pythondir, FILE_MAXDIR);
- BLI_convertstringcode(upythondir, G.sce, 0); /* if so, this expands it */
- BLI_make_file_string( "/", filestr, upythondir, pym->filename );
- }
- else { /* script is in default scripts dir */
- char *scriptsdir = bpy_gethome(1);
-
- if (!scriptsdir) {
- printf("Error loading script: can't find default scripts dir!");
- return 0;
- }
-
- BLI_make_file_string( "/", filestr, scriptsdir, pym->filename );
- }
-
- fp = fopen( filestr, "rb" );
- if( !fp ) {
- printf( "Error loading script: couldn't open file %s\n",
- filestr );
- return 0;
- }
-
- BLI_strncpy(scriptname, pym->name, 21);
- len = strlen(scriptname) - 1;
- /* by convention, scripts that open the file browser or have submenus
- * display '...'. Here we remove them from the datablock name */
- while ((len > 0) && scriptname[len] == '.') {
- scriptname[len] = '\0';
- len--;
- }
-
- /* Create a new script structure and initialize it: */
- script = alloc_libblock( &G.main->script, ID_SCRIPT, scriptname );
-
- if( !script ) {
- printf( "couldn't allocate memory for Script struct!" );
- fclose( fp );
- return 0;
- }
-
- /* let's find a proper area for an eventual script gui:
- * (still experimenting here, need definition on which win
- * each group will be put to code this properly) */
- switch ( menutype ) {
-
- case PYMENU_IMPORT: /* first 4 were handled in header_info.c */
- case PYMENU_EXPORT:
- case PYMENU_HELP:
- case PYMENU_RENDER:
- case PYMENU_WIZARDS:
- case PYMENU_SCRIPTTEMPLATE:
- case PYMENU_MESHFACEKEY:
- break;
-
- default:
- if( curarea->spacetype != SPACE_SCRIPT ) {
- ScrArea *sa = NULL;
-
- sa = find_biggest_area_of_type( SPACE_BUTS );
- if( sa ) {
- if( ( 1.5 * sa->winx ) < sa->winy )
- sa = NULL; /* too narrow? */
- }
-
- if( !sa )
- sa = find_biggest_area_of_type( SPACE_SCRIPT );
- if( !sa )
- sa = find_biggest_area_of_type( SPACE_TEXT );
- if( !sa )
- sa = find_biggest_area_of_type( SPACE_IMAGE ); /* group UV */
- if( !sa )
- sa = find_biggest_area_of_type( SPACE_VIEW3D );
-
- if( !sa )
- sa = find_biggest_area( );
-
- areawinset( sa->win );
- }
- break;
- }
-
- script->id.us = 1;
- script->flags = SCRIPT_RUNNING;
- script->py_draw = NULL;
- script->py_event = NULL;
- script->py_button = NULL;
- script->py_browsercallback = NULL;
-
- py_dict = CreateGlobalDictionary( );
-
- script->py_globaldict = py_dict;
-
- info = ( BPy_constant * ) PyConstant_New( );
- if( info ) {
- PyConstant_Insert( info, "name",
- PyString_FromString( script->id.name + 2 ) );
- PyConstant_Insert( info, "arg", pyarg );
- EXPP_dict_set_item_str( py_dict, "__script__",
- ( PyObject * ) info );
- }
-
- /* Previously we used PyRun_File to run directly the code on a FILE
- * object, but as written in the Python/C API Ref Manual, chapter 2,
- * 'FILE structs for different C libraries can be different and
- * incompatible'.
- * So now we load the script file data to a buffer */
-
- fseek( fp, 0L, SEEK_END );
- len = ftell( fp );
- fseek( fp, 0L, SEEK_SET );
-
- buffer = MEM_mallocN( len + 2, "pyfilebuf" ); /* len+2 to add '\n\0' */
- len = fread( buffer, 1, len, fp );
-
- buffer[len] = '\n'; /* fix syntax error in files w/o eol */
- buffer[len + 1] = '\0';
-
- /* fast clean-up of dos cr/lf line endings: change '\r' to space */
-
- /* we also have to check for line splitters: '\\' */
- /* to avoid possible syntax errors on dos files on win */
- /**/
- /* but first make sure we won't disturb memory below &buffer[0]: */
- if( *buffer == '\r' )
- *buffer = ' ';
-
- /* now handle the whole buffer */
- for( s = buffer + 1; *s != '\0'; s++ ) {
- if( *s == '\r' ) {
- if( *( s - 1 ) == '\\' ) { /* special case: long lines split with '\': */
- *( s - 1 ) = ' '; /* we write ' \', because '\ ' is a syntax error */
- *s = '\\';
- } else
- *s = ' '; /* not a split line, just replace '\r' with ' ' */
- }
- }
-
- fclose( fp );
-
-
- if( !setup_armature_weakrefs()){
- printf("Oops - weakref dict\n");
- MEM_freeN( buffer );
- return 0;
- }
-
- /* run the string buffer */
-
- py_res = PyRun_String( buffer, Py_file_input, py_dict, py_dict );
-
- MEM_freeN( buffer );
-
- if( !py_res ) { /* Failed execution of the script */
-
- BPY_Err_Handle( script->id.name + 2 );
- ReleaseGlobalDictionary( py_dict );
- script->py_globaldict = NULL;
- if( G.main->script.first )
- free_libblock( &G.main->script, script );
- error( "Python script error: check console" );
-
- return 0;
- } else {
- Py_DECREF( py_res );
- script->flags &= ~SCRIPT_RUNNING;
-
- if( !script->flags ) {
- ReleaseGlobalDictionary( py_dict );
- script->py_globaldict = NULL;
- free_libblock( &G.main->script, script );
-
- /* special case: called from the menu in the Scripts window
- * we have to change sc->script pointer, since it'll be freed here.*/
- if( curarea->spacetype == SPACE_SCRIPT ) {
- SpaceScript *sc = curarea->spacedata.first;
- sc->script = G.main->script.first; /* can be null, which is ok ... */
- /* ... meaning no other script is running right now. */
- }
-
- }
- }
-
- return 1; /* normal return */
-}
-
-/*****************************************************************************
-* Description:
-* Notes:
-*****************************************************************************/
-void BPY_free_compiled_text( struct Text *text )
-{
- if( !text->compiled )
- return;
- Py_DECREF( ( PyObject * ) text->compiled );
- text->compiled = NULL;
-
- return;
-}
-
-/*****************************************************************************
-* Description: This function frees a finished (flags == 0) script.
-*****************************************************************************/
-void BPY_free_finished_script( Script * script )
-{
- if( !script )
- return;
-
- if( PyErr_Occurred( ) ) { /* if script ended after filesel */
- PyErr_Print( ); /* eventual errors are handled now */
- error( "Python script error: check console" );
- }
-
- free_libblock( &G.main->script, script );
- return;
-}
-
-static void unlink_script( Script * script )
-{ /* copied from unlink_text in drawtext.c */
- bScreen *scr;
- ScrArea *area;
- SpaceLink *sl;
-
- for( scr = G.main->screen.first; scr; scr = scr->id.next ) {
- for( area = scr->areabase.first; area; area = area->next ) {
- for( sl = area->spacedata.first; sl; sl = sl->next ) {
- if( sl->spacetype == SPACE_SCRIPT ) {
- SpaceScript *sc = ( SpaceScript * ) sl;
-
- if( sc->script == script ) {
- sc->script = NULL;
-
- if( sc ==
- area->spacedata.first ) {
- scrarea_queue_redraw
- ( area );
- }
- }
- }
- }
- }
- }
-}
-
-void BPY_clear_script( Script * script )
-{
- PyObject *dict;
-
- if( !script )
- return;
-
- if (!Py_IsInitialized()) {
- printf("\nError: trying to free script data after finalizing Python!");
- printf("\nScript name: %s\n", script->id.name+2);
- return;
- }
-
- Py_XDECREF( ( PyObject * ) script->py_draw );
- Py_XDECREF( ( PyObject * ) script->py_event );
- Py_XDECREF( ( PyObject * ) script->py_button );
- Py_XDECREF( ( PyObject * ) script->py_browsercallback );
- script->py_draw = NULL;
- script->py_event = NULL;
- script->py_button = NULL;
- script->py_browsercallback = NULL;
-
- dict = script->py_globaldict;
-
- if( dict ) {
- PyDict_Clear( dict );
- Py_DECREF( dict ); /* Release dictionary. */
- script->py_globaldict = NULL;
- }
-
- unlink_script( script );
-}
-
-/* PyDrivers */
-
-/* PyDrivers are Ipo Drivers governed by expressions written in Python.
- * Expressions here are one-liners that evaluate to a float value. */
-
-/* For faster execution we keep a special dictionary for pydrivers, with
- * the needed modules and aliases. */
-static int bpy_pydriver_create_dict(void)
-{
- PyObject *d, *mod;
-
- if (bpy_pydriver_Dict) return -1;
-
- d = PyDict_New();
- if (!d) return -1;
-
- bpy_pydriver_Dict = d;
-
- /* import some modules: builtins, Blender, math, Blender.noise */
-
- PyDict_SetItemString(d, "__builtins__", PyEval_GetBuiltins());
-
- mod = PyImport_ImportModule("Blender");
- if (mod) {
- PyDict_SetItemString(d, "Blender", mod);
- PyDict_SetItemString(d, "b", mod);
- Py_DECREF(mod);
- }
-
- mod = PyImport_ImportModule("math");
- if (mod) {
- PyDict_Merge(d, PyModule_GetDict(mod), 0); /* 0 - dont overwrite existing values */
-
- /* Only keep for backwards compat! - just import all math into root, they are standard */
- PyDict_SetItemString(d, "math", mod);
- PyDict_SetItemString(d, "m", mod);
- Py_DECREF(mod);
- }
-
- mod = PyImport_ImportModule("Blender.Noise");
- if (mod) {
- PyDict_SetItemString(d, "noise", mod);
- PyDict_SetItemString(d, "n", mod);
- Py_DECREF(mod);
- }
-
- /* If there's a Blender text called pydrivers.py, import it.
- * Users can add their own functions to this module. */
- mod = importText("pydrivers"); /* can also use PyImport_Import() */
- if (mod) {
- PyDict_SetItemString(d, "pydrivers", mod);
- PyDict_SetItemString(d, "p", mod);
- Py_DECREF(mod);
- }
- else
- PyErr_Clear();
-
- /* short aliases for some Get() functions: */
-
- /* ob(obname) == Blender.Object.Get(obname) */
- mod = PyImport_ImportModule("Blender.Object");
- if (mod) {
- PyObject *fcn = PyObject_GetAttrString(mod, "Get");
- Py_DECREF(mod);
- if (fcn) {
- PyDict_SetItemString(d, "ob", fcn);
- Py_DECREF(fcn);
- }
- }
-
- /* TODO - change these */
- /* me(meshname) == Blender.Mesh.Get(meshname) */
- mod = PyImport_ImportModule("Blender.Mesh");
- if (mod) {
- PyObject *fcn = PyObject_GetAttrString(mod, "Get");
- Py_DECREF(mod);
- if (fcn) {
- PyDict_SetItemString(d, "me", fcn);
- Py_DECREF(fcn);
- }
- }
-
- /* ma(matname) == Blender.Material.Get(matname) */
- mod = PyImport_ImportModule("Blender.Material");
- if (mod) {
- PyObject *fcn = PyObject_GetAttrString(mod, "Get");
- Py_DECREF(mod);
- if (fcn) {
- PyDict_SetItemString(d, "ma", fcn);
- Py_DECREF(fcn);
- }
- }
-
- return 0;
-}
-
-/* error return function for BPY_eval_pydriver */
-static float pydriver_error(IpoDriver *driver) {
-
- if (bpy_pydriver_oblist)
- bpy_pydriver_freeList();
-
- if (bpy_pydriver_Dict) { /* free the global dict used by pydrivers */
- PyDict_Clear(bpy_pydriver_Dict);
- Py_DECREF(bpy_pydriver_Dict);
- bpy_pydriver_Dict = NULL;
- }
-
- driver->flag |= IPO_DRIVER_FLAG_INVALID; /* py expression failed */
-
- if (driver->ob)
- fprintf(stderr, "\nError in Ipo Driver: Object %s\nThis is the failed Python expression:\n'%s'\n\n", driver->ob->id.name+2, driver->name);
- else
- fprintf(stderr, "\nError in Ipo Driver: No Object\nThis is the failed Python expression:\n'%s'\n\n", driver->name);
-
- PyErr_Print();
-
- return 0.0f;
-}
-
-
-/********PyConstraints*********/
-
-/* This function checks whether a text-buffer is a PyConstraint candidate.
- * It uses simple text parsing that could be easily confused!
- */
-int BPY_is_pyconstraint(Text *text)
-{
- TextLine *tline = text->lines.first;
-
- if (tline && (tline->len > 10)) {
- char *line = tline->line;
-
- /* Expected format: #BPYCONSTRAINT
- * The actual checks are forgiving, so slight variations also work. */
- if (line && line[0] == '#' && strstr(line, "BPYCONSTRAINT")) return 1;
- }
- return 0;
-}
-
-/* This function is called to update PyConstraint data so that it is compatible with the script.
- * Some of the allocating/freeing of memory for constraint targets occurs here, espcially
- * if the number of targets changes.
- */
-void BPY_pyconstraint_update(Object *owner, bConstraint *con)
-{
- bPythonConstraint *data= con->data;
-
- if (data->text) {
- /* script does exist. it is assumed that this is a valid pyconstraint script */
- PyObject *globals;
- PyObject *retval, *gval;
- int num, i;
-
- /* clear the relevant flags first */
- data->flag = 0;
-
- /* populate globals dictionary */
- globals = CreateGlobalDictionary();
- retval = RunPython(data->text, globals);
-
- if (retval == NULL) {
- BPY_Err_Handle(data->text->id.name);
- ReleaseGlobalDictionary(globals);
- data->flag |= PYCON_SCRIPTERROR;
- return;
- }
-
- Py_XDECREF(retval);
- retval = NULL;
-
- /* try to find NUM_TARGETS */
- gval = PyDict_GetItemString(globals, "NUM_TARGETS");
- if ( (gval) && (num= PyInt_AsLong(gval)) ) {
- /* NUM_TARGETS is defined... and non-zero */
- bConstraintTarget *ct;
-
- /* check if it is valid (just make sure it is not negative)
- * TODO: PyInt_AsLong may return -1 as sign of invalid input...
- */
- num = abs(num);
- data->flag |= PYCON_USETARGETS;
-
- /* check if the number of targets has changed */
- if (num < data->tarnum) {
- /* free a few targets */
- num= data->tarnum - num;
- for (i = 0; i < num; i++, data->tarnum--) {
- ct= data->targets.last;
- BLI_freelinkN(&data->targets, ct);
- }
- }
- else if (num > data->tarnum) {
- /* add a few targets */
- num = num - data->tarnum;
- for (i = 0; i < num; i++, data->tarnum++) {
- ct= MEM_callocN(sizeof(bConstraintTarget), "PyConTarget");
- BLI_addtail(&data->targets, ct);
- }
- }
-
- /* validate targets */
- con->flag &= ~CONSTRAINT_DISABLE;
- for (ct= data->targets.first; ct; ct= ct->next) {
- if (!exist_object(ct->tar)) {
- ct->tar = NULL;
- con->flag |= CONSTRAINT_DISABLE;
- break;
- }
-
- if ((ct->tar == owner) && (ct->subtarget[0] != 0)) {
- if (get_named_bone(get_armature(owner), ct->subtarget) == NULL) {
- con->flag |= CONSTRAINT_DISABLE;
- break;
- }
- }
- }
-
- /* clear globals */
- ReleaseGlobalDictionary(globals);
- }
- else {
- /* NUM_TARGETS is not defined or equals 0 */
- ReleaseGlobalDictionary(globals);
-
- /* free all targets */
- BLI_freelistN(&data->targets);
- data->tarnum = 0;
- data->flag &= ~PYCON_USETARGETS;
-
- return;
- }
- }
- else {
- /* no script, so clear any settings/data now */
- data->tarnum = 0;
- data->flag = 0;
- con->flag &= ~CONSTRAINT_DISABLE;
-
- BLI_freelistN(&data->targets);
-
- /* supposedly this should still leave the base struct... */
- IDP_FreeProperty(data->prop);
- }
-}
-
-/* PyConstraints Evaluation Function (only called from evaluate_constraint)
- * This function is responsible for modifying the ownermat that it is passed.
- */
-void BPY_pyconstraint_eval(bPythonConstraint *con, bConstraintOb *cob, ListBase *targets)
-{
- PyObject *srcmat, *tarmat, *tarmats, *idprop;
- PyObject *globals;
- PyObject *gval;
- PyObject *pyargs, *retval;
- bConstraintTarget *ct;
- MatrixObject *retmat;
- int row, col, index;
-
- if (!con->text) return;
- if (con->flag & PYCON_SCRIPTERROR) return;
-
- globals = CreateGlobalDictionary();
-
- /* wrap blender-data as PyObjects for evaluation
- * - we expose the owner's matrix as pymatrix
- * - id-properties are wrapped using the id-properties pyapi
- * - targets are presented as a list of matrices
- */
- srcmat = newMatrixObject((float *)cob->matrix, 4, 4, Py_NEW);
- idprop = BPy_Wrap_IDProperty(NULL, con->prop, NULL);
-
- tarmats= PyList_New(con->tarnum);
- for (ct=targets->first, index=0; ct; ct=ct->next, index++) {
- tarmat = newMatrixObject((float *)ct->matrix, 4, 4, Py_NEW);
- PyList_SET_ITEM(tarmats, index, tarmat);
- }
-
-
-/* since I can't remember what the armature weakrefs do, I'll just leave this here
- commented out. This function was based on pydrivers, and it might still be relevent.
- if( !setup_armature_weakrefs()){
- fprintf( stderr, "Oops - weakref dict setup\n");
- return result;
- }
-*/
-
- retval = RunPython(con->text, globals);
-
- if (retval == NULL) {
- BPY_Err_Handle(con->text->id.name);
- con->flag |= PYCON_SCRIPTERROR;
-
- /* free temp objects */
- Py_XDECREF(idprop);
- Py_XDECREF(srcmat);
- Py_XDECREF(tarmats);
-
- ReleaseGlobalDictionary(globals);
-
- return;
- }
-
- if (retval) {Py_XDECREF( retval );}
- retval = NULL;
-
- gval = PyDict_GetItemString(globals, "doConstraint");
- if (!gval) {
- printf("ERROR: no doConstraint function in constraint!\n");
-
- /* free temp objects */
- Py_XDECREF(idprop);
- Py_XDECREF(srcmat);
- Py_XDECREF(tarmats);
-
- ReleaseGlobalDictionary(globals);
-
- return;
- }
-
- /* Now for the fun part! Try and find the functions we need. */
- if (PyFunction_Check(gval)) {
- pyargs = Py_BuildValue("OOO", srcmat, tarmats, idprop);
- retval = PyObject_CallObject(gval, pyargs);
- Py_XDECREF(pyargs);
- }
- else {
- printf("ERROR: doConstraint is supposed to be a function!\n");
- con->flag |= PYCON_SCRIPTERROR;
-
- Py_XDECREF(idprop);
- Py_XDECREF(srcmat);
- Py_XDECREF(tarmats);
-
- ReleaseGlobalDictionary(globals);
-
- return;
- }
-
- if (!retval) {
- BPY_Err_Handle(con->text->id.name);
- con->flag |= PYCON_SCRIPTERROR;
-
- /* free temp objects */
- Py_XDECREF(idprop);
- Py_XDECREF(srcmat);
- Py_XDECREF(tarmats);
-
- ReleaseGlobalDictionary(globals);
-
- return;
- }
-
-
- if (!PyObject_TypeCheck(retval, &matrix_Type)) {
- printf("Error in PyConstraint - doConstraint: Function not returning a matrix!\n");
- con->flag |= PYCON_SCRIPTERROR;
-
- Py_XDECREF(idprop);
- Py_XDECREF(srcmat);
- Py_XDECREF(tarmats);
- Py_XDECREF(retval);
-
- ReleaseGlobalDictionary(globals);
-
- return;
- }
-
- retmat = (MatrixObject *)retval;
- if (retmat->rowSize != 4 || retmat->colSize != 4) {
- printf("Error in PyConstraint - doConstraint: Matrix returned is the wrong size!\n");
- con->flag |= PYCON_SCRIPTERROR;
-
- Py_XDECREF(idprop);
- Py_XDECREF(srcmat);
- Py_XDECREF(tarmats);
- Py_XDECREF(retval);
-
- ReleaseGlobalDictionary(globals);
-
- return;
- }
-
- /* this is the reverse of code taken from newMatrix() */
- for(row = 0; row < 4; row++) {
- for(col = 0; col < 4; col++) {
- cob->matrix[row][col] = retmat->contigPtr[row*4+col];
- }
- }
-
- /* free temp objects */
- Py_XDECREF(idprop);
- Py_XDECREF(srcmat);
- Py_XDECREF(tarmats);
- Py_XDECREF(retval);
-
- /* clear globals */
- ReleaseGlobalDictionary(globals);
-}
-
-/* This evaluates the target matrix for each target the PyConstraint uses.
- * NOTE: it only does one target at a time!
- */
-void BPY_pyconstraint_target(bPythonConstraint *con, bConstraintTarget *ct)
-{
- PyObject *tar, *subtar;
- PyObject *tarmat, *idprop;
- PyObject *globals;
- PyObject *gval;
- PyObject *pyargs, *retval;
- MatrixObject *retmat;
- int row, col;
-
- if (!con->text) return;
- if (con->flag & PYCON_SCRIPTERROR) return;
- if (!ct) return;
-
- globals = CreateGlobalDictionary();
-
- tar = Object_CreatePyObject(ct->tar);
- if ((ct->tar) && (ct->tar->type==OB_ARMATURE)) {
- bPoseChannel *pchan;
- pchan = get_pose_channel(ct->tar->pose, ct->subtarget);
- subtar = PyPoseBone_FromPosechannel(pchan);
- }
- else
- subtar = PyString_FromString(ct->subtarget);
-
- tarmat = newMatrixObject((float *)ct->matrix, 4, 4, Py_NEW);
- idprop = BPy_Wrap_IDProperty( NULL, con->prop, NULL);
-
-/* since I can't remember what the armature weakrefs do, I'll just leave this here
- commented out. This function was based on pydrivers, and it might still be relevent.
- if( !setup_armature_weakrefs()){
- fprintf( stderr, "Oops - weakref dict setup\n");
- return result;
- }
-*/
- retval = RunPython(con->text, globals);
-
- if (retval == NULL) {
- BPY_Err_Handle(con->text->id.name);
- con->flag |= PYCON_SCRIPTERROR;
-
- /* free temp objects */
- Py_XDECREF(tar);
- Py_XDECREF(subtar);
- Py_XDECREF(idprop);
- Py_XDECREF(tarmat);
-
- ReleaseGlobalDictionary(globals);
-
- return;
- }
-
- Py_XDECREF(retval);
- retval = NULL;
-
- /* try to find doTarget function to set the target matrix */
- gval = PyDict_GetItemString(globals, "doTarget");
- if (!gval) {
- /* free temp objects */
- Py_XDECREF(tar);
- Py_XDECREF(subtar);
- Py_XDECREF(idprop);
- Py_XDECREF(tarmat);
-
- ReleaseGlobalDictionary(globals);
-
- return;
- }
-
- /* Now for the fun part! Try and find the functions we need.*/
- if (PyFunction_Check(gval)) {
- pyargs = Py_BuildValue("OOOO", tar, subtar, tarmat, idprop);
- retval = PyObject_CallObject(gval, pyargs);
- Py_XDECREF(pyargs);
- }
- else {
- printf("ERROR: doTarget is supposed to be a function!\n");
- con->flag |= PYCON_SCRIPTERROR;
-
- Py_XDECREF(tar);
- Py_XDECREF(subtar);
- Py_XDECREF(idprop);
- Py_XDECREF(tarmat);
-
- ReleaseGlobalDictionary(globals);
- return;
- }
-
- if (!retval) {
- BPY_Err_Handle(con->text->id.name);
- con->flag |= PYCON_SCRIPTERROR;
-
-
- /* free temp objects */
- Py_XDECREF(tar);
- Py_XDECREF(subtar);
- Py_XDECREF(idprop);
- Py_XDECREF(tarmat);
-
- ReleaseGlobalDictionary(globals);
- return;
- }
-
- if (!PyObject_TypeCheck(retval, &matrix_Type)) {
- con->flag |= PYCON_SCRIPTERROR;
-
- Py_XDECREF(tar);
- Py_XDECREF(subtar);
- Py_XDECREF(idprop);
- Py_XDECREF(tarmat);
- Py_XDECREF(retval);
-
- ReleaseGlobalDictionary(globals);
- return;
- }
-
- retmat = (MatrixObject *)retval;
- if (retmat->rowSize != 4 || retmat->colSize != 4) {
- printf("Error in PyConstraint - doTarget: Matrix returned is the wrong size!\n");
- con->flag |= PYCON_SCRIPTERROR;
-
- Py_XDECREF(tar);
- Py_XDECREF(subtar);
- Py_XDECREF(idprop);
- Py_XDECREF(tarmat);
- Py_XDECREF(retval);
-
- ReleaseGlobalDictionary(globals);
- return;
- }
-
- /* this is the reverse of code taken from newMatrix() */
- for(row = 0; row < 4; row++) {
- for(col = 0; col < 4; col++) {
- ct->matrix[row][col] = retmat->contigPtr[row*4+col];
- }
- }
-
- /* free temp objects */
- Py_XDECREF(tar);
- Py_XDECREF(subtar);
- Py_XDECREF(idprop);
- Py_XDECREF(tarmat);
- Py_XDECREF(retval);
-
- /* clear globals */
- ReleaseGlobalDictionary(globals);
-}
-
-/* This draws+handles the user-defined interface for editing pyconstraints idprops */
-void BPY_pyconstraint_settings(void *arg1, void *arg2)
-{
- bPythonConstraint *con= (bPythonConstraint *)arg1;
- PyObject *idprop;
- PyObject *globals;
- PyObject *gval;
- PyObject *retval;
-
- if (!con->text) return;
- if (con->flag & PYCON_SCRIPTERROR) return;
-
- globals = CreateGlobalDictionary();
-
- idprop = BPy_Wrap_IDProperty( NULL, con->prop, NULL);
-
- retval = RunPython(con->text, globals);
-
- if (retval == NULL) {
- BPY_Err_Handle(con->text->id.name);
- ReleaseGlobalDictionary(globals);
- con->flag |= PYCON_SCRIPTERROR;
-
- /* free temp objects */
- Py_XDECREF(idprop);
- return;
- }
-
- if (retval) {Py_XDECREF( retval );}
- retval = NULL;
-
- gval = PyDict_GetItemString(globals, "getSettings");
- if (!gval) {
- printf("ERROR: no getSettings function in constraint!\n");
-
- /* free temp objects */
- ReleaseGlobalDictionary( globals );
- Py_XDECREF(idprop);
- return;
- }
-
- /* Now for the fun part! Try and find the functions we need. */
- if (PyFunction_Check(gval)) {
- retval = PyObject_CallFunction(gval, "O", idprop);
- }
- else {
- printf("ERROR: getSettings is supposed to be a function!\n");
- ReleaseGlobalDictionary( globals );
-
- Py_XDECREF(idprop);
- return;
- }
-
- if (!retval) {
- BPY_Err_Handle(con->text->id.name);
- con->flag |= PYCON_SCRIPTERROR;
-
- /* free temp objects */
- ReleaseGlobalDictionary(globals);
- Py_XDECREF(idprop);
- return;
- }
- else {
- /* clear globals */
- ReleaseGlobalDictionary(globals);
-
- /* free temp objects */
- Py_XDECREF(idprop);
- Py_DECREF(retval);
- return;
- }
-}
-
-/* Update function, it gets rid of pydrivers global dictionary, forcing
- * BPY_pydriver_eval to recreate it. This function is used to force
- * reloading the Blender text module "pydrivers.py", if available, so
- * updates in it reach pydriver evaluation. */
-void BPY_pydriver_update(void)
-{
- if (bpy_pydriver_Dict) { /* free the global dict used by pydrivers */
- PyDict_Clear(bpy_pydriver_Dict);
- Py_DECREF(bpy_pydriver_Dict);
- bpy_pydriver_Dict = NULL;
- }
-
- return;
-}
-
-/* for depsgraph.c, runs py expr once to collect all refs. made
- * to objects (self refs. to the object that owns the py driver
- * are not allowed). */
-struct Object **BPY_pydriver_get_objects(IpoDriver *driver)
-{
- /*if (!driver || !driver->ob || driver->name[0] == '\0')
- return NULL;*/
-
- /*PyErr_Clear();*/
-
- /* clear the flag that marks invalid python expressions */
- driver->flag &= ~IPO_DRIVER_FLAG_INVALID;
-
- /* tell we're running a pydriver, so Get() functions know they need
- * to add the requested obj to our list */
- bpy_pydriver_running(1);
-
- /* append driver owner object as the 1st ob in the list;
- * we put it there to make sure it is not itself referenced in
- * its pydriver expression */
- bpy_pydriver_appendToList(driver->ob);
-
- /* this will append any other ob referenced in expr (driver->name)
- * or set the driver's error flag if driver's py expression fails */
- BPY_pydriver_eval(driver);
-
- bpy_pydriver_running(0); /* ok, we're done */
-
- return bpy_pydriver_obArrayFromList(); /* NULL if eval failed */
-}
-
-/* This evals py driver expressions, 'expr' is a Python expression that
- * should evaluate to a float number, which is returned. */
-float BPY_pydriver_eval(IpoDriver *driver)
-{
- char *expr = NULL;
- PyObject *retval, *bpy_ob = NULL;
- float result = 0.0f; /* default return */
- int setitem_retval;
-
- if (!driver) return result;
-
- expr = driver->name; /* the py expression to be evaluated */
- if (!expr || expr[0]=='\0') return result;
-
- if (!bpy_pydriver_Dict) {
- if (bpy_pydriver_create_dict() != 0) {
- fprintf(stderr, "Pydriver error: couldn't create Python dictionary");
- return result;
- }
- }
-
- if (driver->ob)
- bpy_ob = Object_CreatePyObject(driver->ob);
-
- if (!bpy_ob) {
- Py_INCREF(Py_None);
- bpy_ob = Py_None;
- }
-
- setitem_retval = EXPP_dict_set_item_str(bpy_pydriver_Dict, "self", bpy_ob);
-
- if( !setup_armature_weakrefs()){
- fprintf( stderr, "Oops - weakref dict setup\n");
- return result;
- }
-
- retval = PyRun_String(expr, Py_eval_input, bpy_pydriver_Dict,
- bpy_pydriver_Dict);
-
- if (retval == NULL) {
- return pydriver_error(driver);
- }
-
- result = ( float )PyFloat_AsDouble( retval );
-
- if (result == -1 && PyErr_Occurred())
- return pydriver_error(driver);
-
- /* remove 'self', since this dict is also used by py buttons */
- if (setitem_retval == 0) PyDict_DelItemString(bpy_pydriver_Dict, "self");
-
- /* all fine, make sure the "invalid expression" flag is cleared */
- driver->flag &= ~IPO_DRIVER_FLAG_INVALID;
-
- return result;
-}
-
-/* Button Python Evaluation */
-
-/* Python evaluation for gui buttons:
- * users can write any valid Python expression (that evals to an int or float)
- * inside Blender's gui number buttons and have them evaluated to their
- * actual int or float value.
- *
- * The global dict used for pydrivers is also used here, so all imported
- * modules for pydrivers (including the pydrivers.py Blender text) are
- * available for button py eval, too. */
-
-static int bpy_button_eval_error(char *expr) {
-
- if (bpy_pydriver_oblist)
- bpy_pydriver_freeList();
-
- if (bpy_pydriver_Dict) { /* free the persistent global dict */
- /* it's the same dict used by pydrivers */
- PyDict_Clear(bpy_pydriver_Dict);
- Py_DECREF(bpy_pydriver_Dict);
- bpy_pydriver_Dict = NULL;
- }
-
- fprintf(stderr, "\nError in button evaluation:\nThis is the failed Python expression:\n'%s'\n\n", expr);
-
- PyErr_Print();
-
- return -1;
-}
-
-int BPY_button_eval(char *expr, double *value)
-{
- PyObject *retval, *floatval;
-
- if (!value || !expr || expr[0]=='\0') return -1;
-
- *value = 0.0; /* default value */
-
- if (!bpy_pydriver_Dict) {
- if (bpy_pydriver_create_dict() != 0) {
- fprintf(stderr,
- "Button Python Eval error: couldn't create Python dictionary");
- return -1;
- }
- }
-
-
- if( !setup_armature_weakrefs()){
- fprintf(stderr, "Oops - weakref dict\n");
- return -1;
- }
-
- retval = PyRun_String(expr, Py_eval_input, bpy_pydriver_Dict,
- bpy_pydriver_Dict);
-
- if (retval == NULL) {
- return bpy_button_eval_error(expr);
- }
- else {
- floatval = PyNumber_Float(retval);
- Py_DECREF(retval);
- }
-
- if (floatval == NULL)
- return bpy_button_eval_error(expr);
- else {
- *value = (float)PyFloat_AsDouble(floatval);
- Py_DECREF(floatval);
- }
-
- return 0; /* successful exit */
-}
-
-
-/*****************************************************************************/
-/* ScriptLinks */
-/*****************************************************************************/
-
-/*****************************************************************************/
-/* Description: */
-/* Notes: Not implemented yet */
-/*****************************************************************************/
-void BPY_clear_bad_scriptlinks( struct Text *byebye )
-{
-/*
- BPY_clear_bad_scriptlist(getObjectList(), byebye);
- BPY_clear_bad_scriptlist(getLampList(), byebye);
- BPY_clear_bad_scriptlist(getCameraList(), byebye);
- BPY_clear_bad_scriptlist(getMaterialList(), byebye);
- BPY_clear_bad_scriptlist(getWorldList(), byebye);
- BPY_clear_bad_scriptlink(&scene_getCurrent()->id, byebye);
-
- allqueue(REDRAWBUTSSCRIPT, 0);
-*/
- return;
-}
-
-/*****************************************************************************
-* Description: Loop through all scripts of a list of object types, and
-* execute these scripts.
-* For the scene, only the current active scene the scripts are
-* executed (if any).
-*****************************************************************************/
-void BPY_do_all_scripts( short event )
-{
- DoAllScriptsFromList( &( G.main->object ), event );
- DoAllScriptsFromList( &( G.main->lamp ), event );
- DoAllScriptsFromList( &( G.main->camera ), event );
- DoAllScriptsFromList( &( G.main->mat ), event );
- DoAllScriptsFromList( &( G.main->world ), event );
-
- BPY_do_pyscript( &( G.scene->id ), event );
-
- return;
-}
-
-/*****************************************************************************
-* Description: Execute a Python script when an event occurs. The following
-* events are possible: frame changed, load script and redraw.
-* Only events happening to one of the following object types
-* are handled: Object, Lamp, Camera, Material, World and
-* Scene.
-*****************************************************************************/
-
-static ScriptLink *ID_getScriptlink( ID * id )
-{
- switch ( MAKE_ID2( id->name[0], id->name[1] ) ) {
- case ID_OB:
- return &( ( Object * ) id )->scriptlink;
- case ID_LA:
- return &( ( Lamp * ) id )->scriptlink;
- case ID_CA:
- return &( ( Camera * ) id )->scriptlink;
- case ID_MA:
- return &( ( Material * ) id )->scriptlink;
- case ID_WO:
- return &( ( World * ) id )->scriptlink;
- case ID_SCE:
- return &( ( Scene * ) id )->scriptlink;
- default:
- return NULL;
- }
-}
-
-int BPY_has_onload_script( void )
-{
- ScriptLink *slink = &G.scene->scriptlink;
- int i;
-
- if( !slink || !slink->totscript )
- return 0;
-
- for( i = 0; i < slink->totscript; i++ ) {
- if( ( slink->flag[i] == SCRIPT_ONLOAD )
- && ( slink->scripts[i] != NULL ) )
- return 1;
- }
-
- return 0;
-}
-
-void BPY_do_pyscript( ID * id, short event )
-{
- ScriptLink *scriptlink;
-
- if( !id ) return;
-
- scriptlink = ID_getScriptlink( id );
-
- if( scriptlink && scriptlink->totscript ) {
- PyObject *value;
- PyObject *dict;
- PyObject *ret;
- int index, during_slink = during_scriptlink( );
-
- /* invalid scriptlinks (new .blend was just loaded), return */
- if( during_slink < 0 )
- return;
-
- if( !setup_armature_weakrefs()){
- printf("Oops - weakref dict, this is a bug\n");
- return;
- }
-
- value = GetPyObjectFromID( id );
- if( !value){
- printf("Oops - could not get a valid python object for Blender.link, this is a bug\n");
- return;
- }
-
- /* tell we're running a scriptlink. The sum also tells if this script
- * is running nested inside another. Blender.Load needs this info to
- * avoid trouble with invalid slink pointers. */
- during_slink++;
- disable_where_scriptlink( (short)during_slink );
-
- /* set globals in Blender module to identify scriptlink */
- PyDict_SetItemString( g_blenderdict, "bylink", Py_True);
- EXPP_dict_set_item_str( g_blenderdict, "link", value );
- EXPP_dict_set_item_str( g_blenderdict, "event",
- PyString_FromString( event_to_name
- ( event ) ) );
- if (event == SCRIPT_POSTRENDER) event = SCRIPT_RENDER;
-
- for( index = 0; index < scriptlink->totscript; index++ ) {
- if( ( scriptlink->flag[index] == event ) &&
- ( scriptlink->scripts[index] != NULL ) ) {
- dict = CreateGlobalDictionary( );
- ret = RunPython( ( Text * ) scriptlink->
- scripts[index], dict );
- ReleaseGlobalDictionary( dict );
-
- if( !ret ) {
- /* Failed execution of the script */
- BPY_Err_Handle( scriptlink->
- scripts[index]->name +
- 2 );
- //BPY_end_python ();
- //BPY_start_python ();
- } else {
- Py_DECREF( ret );
- }
- /* If a scriptlink has just loaded a new .blend file, the
- * scriptlink pointer became invalid (see api2_2x/Blender.c),
- * so we stop here. */
- if( during_scriptlink( ) == -1 ) {
- during_slink = 1;
- break;
- }
- }
- }
-
- disable_where_scriptlink( (short)(during_slink - 1) );
-
- /* cleanup bylink flag and clear link so PyObject
- * can be released
- */
- PyDict_SetItemString(g_blenderdict, "bylink", Py_False);
- PyDict_SetItemString( g_blenderdict, "link", Py_None );
- EXPP_dict_set_item_str( g_blenderdict, "event", PyString_FromString( "" ) );
- }
-}
-
-
-/* SPACE HANDLERS */
-
-/* These are special script links that can be assigned to ScrArea's to
- * (EVENT type) receive events sent to a given space (and use or ignore them) or
- * (DRAW type) be called after the space is drawn, to draw anything on top of
- * the space area. */
-
-/* How to add space handlers to other spaces:
- * - add the space event defines to DNA_scriptlink_types.h, as done for
- * 3d view: SPACEHANDLER_VIEW3D_EVENT, for example;
- * - add the new defines to Blender.SpaceHandler dictionary in Blender.c;
- * - check space.c for how to call the event handlers;
- * - check drawview.c for how to call the draw handlers;
- * - check header_view3d.c for how to add the "Space Handler Scripts" menu.
- * Note: DRAW handlers should be called with 'event = 0', chech drawview.c */
-
-int BPY_has_spacehandler(Text *text, ScrArea *sa)
-{
- ScriptLink *slink;
- int index;
-
- if (!sa || !text) return 0;
-
- slink = &sa->scriptlink;
-
- for (index = 0; index < slink->totscript; index++) {
- if (slink->scripts[index] && (slink->scripts[index] == (ID *)text))
- return 1;
- }
-
- return 0;
-}
-
-int BPY_is_spacehandler(Text *text, char spacetype)
-{
- TextLine *tline = text->lines.first;
- unsigned short type = 0;
-
- if (tline && (tline->len > 10)) {
- char *line = tline->line;
-
- /* Expected format: # SPACEHANDLER.SPACE.TYPE
- * Ex: # SPACEHANDLER.VIEW3D.DRAW
- * The actual checks are forgiving, so slight variations also work. */
- if (line && line[0] == '#' && strstr(line, "HANDLER")) {
- line++; /* skip '#' */
-
- /* only done for 3D View right now, trivial to add for others: */
- switch (spacetype) {
- case SPACE_VIEW3D:
- if (strstr(line, "3D")) { /* VIEW3D, 3DVIEW */
- if (strstr(line, "DRAW")) type = SPACEHANDLER_VIEW3D_DRAW;
- else if (strstr(line, "EVENT")) type = SPACEHANDLER_VIEW3D_EVENT;
- }
- break;
- }
- }
- }
- return type; /* 0 if not a space handler */
-}
-
-int BPY_del_spacehandler(Text *text, ScrArea *sa)
-{
- ScriptLink *slink;
- int i, j;
-
- if (!sa || !text) return -1;
-
- slink = &sa->scriptlink;
- if (slink->totscript < 1) return -1;
-
- for (i = 0; i < slink->totscript; i++) {
- if (text == (Text *)slink->scripts[i]) {
-
- for (j = i; j < slink->totscript - 1; j++) {
- slink->flag[j] = slink->flag[j+1];
- slink->scripts[j] = slink->scripts[j+1];
- }
- slink->totscript--;
- /* like done in buttons_script.c we just free memory
- * if all slinks have been removed -- less fragmentation,
- * these should be quite small arrays */
- if (slink->totscript == 0) {
- if (slink->scripts) MEM_freeN(slink->scripts);
- if (slink->flag) MEM_freeN(slink->flag);
- break;
- }
- }
- }
- return 0;
-}
-
-int BPY_add_spacehandler(Text *text, ScrArea *sa, char spacetype)
-{
- unsigned short handlertype;
-
- if (!sa || !text) return -1;
-
- handlertype = (unsigned short)BPY_is_spacehandler(text, spacetype);
-
- if (handlertype) {
- ScriptLink *slink = &sa->scriptlink;
- void *stmp, *ftmp;
- unsigned short space_event = SPACEHANDLER_VIEW3D_EVENT;
-
- /* extend slink */
-
- stmp= slink->scripts;
- slink->scripts= MEM_mallocN(sizeof(ID*)*(slink->totscript+1),
- "spacehandlerscripts");
-
- ftmp= slink->flag;
- slink->flag= MEM_mallocN(sizeof(short*)*(slink->totscript+1),
- "spacehandlerflags");
-
- if (slink->totscript) {
- memcpy(slink->scripts, stmp, sizeof(ID*)*(slink->totscript));
- MEM_freeN(stmp);
-
- memcpy(slink->flag, ftmp, sizeof(short)*(slink->totscript));
- MEM_freeN(ftmp);
- }
-
- switch (spacetype) {
- case SPACE_VIEW3D:
- if (handlertype == 1) space_event = SPACEHANDLER_VIEW3D_EVENT;
- else space_event = SPACEHANDLER_VIEW3D_DRAW;
- break;
- default:
- break;
- }
-
- slink->scripts[slink->totscript] = (ID *)text;
- slink->flag[slink->totscript]= space_event;
-
- slink->totscript++;
- slink->actscript = slink->totscript;
-
- }
- return 0;
-}
-
-int BPY_do_spacehandlers( ScrArea *sa, unsigned short event,
- unsigned short space_event )
-{
- ScriptLink *scriptlink;
- int retval = 0;
-
- if (!sa || !(G.f & G_DOSCRIPTLINKS)) return 0;
-
- scriptlink = &sa->scriptlink;
-
- if (scriptlink->totscript > 0) {
- PyObject *dict;
- PyObject *ret;
- int index, during_slink = during_scriptlink();
-
- /* invalid scriptlinks (new .blend was just loaded), return */
- if (during_slink < 0) return 0;
-
- /* tell we're running a scriptlink. The sum also tells if this script
- * is running nested inside another. Blender.Load needs this info to
- * avoid trouble with invalid slink pointers.
- * Update (test): allow EVENT space handlers to call file/image selectors,
- * still disabled for DRAW space handlers: */
- if (event == 0) { /* event = 0: DRAW space handler */
- during_slink++;
- disable_where_scriptlink( (short)during_slink );
- }
-
- if( !setup_armature_weakrefs()){
- printf("Oops - weakref dict, this is a bug\n");
- return 0;
- }
-
- /* set globals in Blender module to identify space handler scriptlink */
- PyDict_SetItemString(g_blenderdict, "bylink", Py_True);
- /* unlike normal scriptlinks, here Blender.link is int (space event type) */
- EXPP_dict_set_item_str(g_blenderdict, "link", PyInt_FromLong(space_event));
- /* note: DRAW space_events set event to 0 */
- EXPP_dict_set_item_str(g_blenderdict, "event", PyInt_FromLong(event));
- /* now run all assigned space handlers for this space and space_event */
- for( index = 0; index < scriptlink->totscript; index++ ) {
-
- /* for DRAW handlers: */
- if (event == 0) {
- glPushAttrib(GL_ALL_ATTRIB_BITS);
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- }
-
- if( ( scriptlink->flag[index] == space_event ) &&
- ( scriptlink->scripts[index] != NULL ) ) {
- dict = CreateGlobalDictionary();
- ret = RunPython( ( Text * ) scriptlink->scripts[index], dict );
- ReleaseGlobalDictionary( dict );
-
- if (!ret) { /* Failed execution of the script */
- BPY_Err_Handle( scriptlink->scripts[index]->name+2 );
- } else {
- Py_DECREF(ret);
-
- /* an EVENT type (event != 0) script can either accept an event or
- * ignore it:
- * if the script sets Blender.event to None it accepted it;
- * otherwise the space's event handling callback that called us
- * can go on processing the event */
- if (event && (PyDict_GetItemString(g_blenderdict,"event") == Py_None))
- retval = 1; /* event was swallowed */
- }
-
- /* If a scriptlink has just loaded a new .blend file, the
- * scriptlink pointer became invalid (see api2_2x/Blender.c),
- * so we stop here. */
- if( during_scriptlink( ) == -1 ) {
- during_slink = 1;
- if (event == 0) glPopAttrib();
- break;
- }
- }
-
- /* for DRAW handlers: */
- if (event == 0) {
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
- glPopAttrib();
- disable_where_scriptlink( (short)(during_slink - 1) );
- }
-
- }
-
- PyDict_SetItemString(g_blenderdict, "bylink", Py_False);
- PyDict_SetItemString(g_blenderdict, "link", Py_None );
- EXPP_dict_set_item_str(g_blenderdict, "event", PyString_FromString(""));
- }
-
- /* retval:
- * space_event is of type EVENT:
- * 0 - event was returned,
- * 1 - event was processed;
- * space_event is of type DRAW:
- * 0 always */
-
- return retval;
-}
-
-/*****************************************************************************
-* Description:
-* Notes:
-*****************************************************************************/
-void BPY_free_scriptlink( struct ScriptLink *slink )
-{
- if( slink->totscript ) {
- if( slink->flag ) {
- MEM_freeN( slink->flag );
- slink->flag= NULL;
- }
- if( slink->scripts ) {
- MEM_freeN( slink->scripts );
- slink->scripts= NULL;
- }
- }
-
- return;
-}
-
-static int CheckAllSpaceHandlers(Text *text)
-{
- bScreen *screen;
- ScrArea *sa;
- ScriptLink *slink;
- int fixed = 0;
-
- for (screen = G.main->screen.first; screen; screen = screen->id.next) {
- for (sa = screen->areabase.first; sa; sa = sa->next) {
- slink = &sa->scriptlink;
- if (!slink->totscript) continue;
- if (BPY_del_spacehandler(text, sa) == 0) fixed++;
- }
- }
- return fixed;
-}
-
-static int CheckAllScriptsFromList( ListBase * list, Text * text )
-{
- ID *id;
- ScriptLink *scriptlink;
- int index;
- int fixed = 0;
-
- id = list->first;
-
- while( id != NULL ) {
- scriptlink = ID_getScriptlink( id );
- if( scriptlink && scriptlink->totscript ) {
- for( index = 0; index < scriptlink->totscript; index++) {
- if ((Text *)scriptlink->scripts[index] == text) {
- scriptlink->scripts[index] = NULL;
- fixed++;
- }
- }
- }
- id = id->next;
- }
-
- return fixed;
-}
-
-/* When a Text is deleted, we need to unlink it from eventual scriptlinks */
-int BPY_check_all_scriptlinks( Text * text )
-{
- int fixed = 0;
- fixed += CheckAllScriptsFromList( &( G.main->object ), text );
- fixed += CheckAllScriptsFromList( &( G.main->lamp ), text );
- fixed += CheckAllScriptsFromList( &( G.main->camera ), text );
- fixed += CheckAllScriptsFromList( &( G.main->mat ), text );
- fixed += CheckAllScriptsFromList( &( G.main->world ), text );
- fixed += CheckAllScriptsFromList( &( G.main->scene ), text );
- fixed += CheckAllSpaceHandlers(text);
-
- return fixed;
-}
-
-/*****************************************************************************
-* Description:
-* Notes:
-*****************************************************************************/
-void BPY_copy_scriptlink( struct ScriptLink *scriptlink )
-{
- void *tmp;
-
- if( scriptlink->totscript ) {
-
- tmp = scriptlink->scripts;
- scriptlink->scripts =
- MEM_mallocN( sizeof( ID * ) * scriptlink->totscript,
- "scriptlistL" );
- memcpy( scriptlink->scripts, tmp,
- sizeof( ID * ) * scriptlink->totscript );
-
- tmp = scriptlink->flag;
- scriptlink->flag =
- MEM_mallocN( sizeof( short ) * scriptlink->totscript,
- "scriptlistF" );
- memcpy( scriptlink->flag, tmp,
- sizeof( short ) * scriptlink->totscript );
- }
-
- return;
-}
-
-/****************************************************************************
-* Description:
-* Notes: Not implemented yet
-*****************************************************************************/
-int BPY_call_importloader( char *name )
-{ /* XXX Should this function go away from Blender? */
- printf( "In BPY_call_importloader(name=%s)\n", name );
- return ( 0 );
-}
-
-/*****************************************************************************
-* Private functions
-*****************************************************************************/
-
-/*****************************************************************************
-* Description: This function executes the python script passed by text.
-* The Python dictionary containing global variables needs to
-* be passed in globaldict.
-*****************************************************************************/
-PyObject *RunPython( Text * text, PyObject * globaldict )
-{
- char *buf = NULL;
-
-/* The script text is compiled to Python bytecode and saved at text->compiled
- * to speed-up execution if the user executes the script multiple times */
-
- if( !text->compiled ) { /* if it wasn't already compiled, do it now */
- buf = txt_to_buf( text );
-
- text->compiled =
- Py_CompileString( buf, GetName( text ),
- Py_file_input );
-
- MEM_freeN( buf );
-
- if( PyErr_Occurred( ) ) {
- BPY_free_compiled_text( text );
- return NULL;
- }
-
- }
-
- return PyEval_EvalCode( text->compiled, globaldict, globaldict );
-}
-
-/*****************************************************************************
-* Description: This function returns the value of the name field of the
-* given Text struct.
-*****************************************************************************/
-char *GetName( Text * text )
-{
- return ( text->id.name + 2 );
-}
-
-/*****************************************************************************
-* Description: This function creates a new Python dictionary object.
-*****************************************************************************/
-PyObject *CreateGlobalDictionary( void )
-{
- PyObject *dict = PyDict_New( );
-
- PyDict_SetItemString( dict, "__builtins__", PyEval_GetBuiltins( ) );
- EXPP_dict_set_item_str( dict, "__name__",
- PyString_FromString( "__main__" ) );
-
- return dict;
-}
-
-/*****************************************************************************
-* Description: This function deletes a given Python dictionary object.
-*****************************************************************************/
-void ReleaseGlobalDictionary( PyObject * dict )
-{
- PyDict_Clear( dict );
- Py_DECREF( dict ); /* Release dictionary. */
-
- return;
-}
-
-/***************************************************************************
-* Description: This function runs all scripts (if any) present in the
-* list argument. The event by which the function has been
-* called, is passed in the event argument.
-*****************************************************************************/
-void DoAllScriptsFromList( ListBase * list, short event )
-{
- ID *id;
-
- id = list->first;
-
- while( id != NULL ) {
- BPY_do_pyscript( id, event );
- id = id->next;
- }
-
- return;
-}
-
-PyObject *importText( char *name )
-{
- Text *text;
- char *txtname;
- char *buf = NULL;
- int namelen = strlen( name );
-
- txtname = malloc( namelen + 3 + 1 );
- if( !txtname )
- return NULL;
-
- memcpy( txtname, name, namelen );
- memcpy( &txtname[namelen], ".py", 4 );
-
- text = ( Text * ) & ( G.main->text.first );
-
- while( text ) {
- if( !strcmp( txtname, GetName( text ) ) )
- break;
- text = text->id.next;
- }
-
- if( !text ) {
- free( txtname );
- return NULL;
- }
-
- if( !text->compiled ) {
- buf = txt_to_buf( text );
- text->compiled =
- Py_CompileString( buf, GetName( text ),
- Py_file_input );
- MEM_freeN( buf );
-
- if( PyErr_Occurred( ) ) {
- PyErr_Print( );
- BPY_free_compiled_text( text );
- free( txtname );
- return NULL;
- }
- }
-
- free( txtname );
- return PyImport_ExecCodeModule( name, text->compiled );
-}
-
-static PyMethodDef bimport[] = {
- {"blimport", blender_import, METH_VARARGS, "our own import"}
-};
-
-PyObject *blender_import( PyObject * self, PyObject * args )
-{
- PyObject *exception, *err, *tb;
- char *name;
- PyObject *globals = NULL, *locals = NULL, *fromlist = NULL;
- PyObject *m;
-
- if( !PyArg_ParseTuple( args, "s|OOO:bimport",
- &name, &globals, &locals, &fromlist ) )
- return NULL;
-
- m = PyImport_ImportModuleEx( name, globals, locals, fromlist );
-
- if( m )
- return m;
- else
- PyErr_Fetch( &exception, &err, &tb ); /*restore for probable later use */
-
- m = importText( name );
- if( m ) { /* found module, ignore above exception */
- PyErr_Clear( );
- Py_XDECREF( exception );
- Py_XDECREF( err );
- Py_XDECREF( tb );
- printf( "imported from text buffer...\n" );
- } else {
- PyErr_Restore( exception, err, tb );
- }
- return m;
-}
-
-void init_ourImport( void )
-{
- PyObject *m, *d;
- PyObject *import = PyCFunction_New( bimport, NULL );
-
- m = PyImport_AddModule( "__builtin__" );
- d = PyModule_GetDict( m );
-
- EXPP_dict_set_item_str( d, "__import__", import );
-}
-
-/*
- * find in-memory module and recompile
- */
-
-static PyObject *reimportText( PyObject *module )
-{
- Text *text;
- char *txtname;
- char *name;
- char *buf = NULL;
-
- /* get name, filename from the module itself */
-
- txtname = PyModule_GetFilename( module );
- name = PyModule_GetName( module );
- if( !txtname || !name)
- return NULL;
-
- /* look up the text object */
- text = ( Text * ) & ( G.main->text.first );
- while( text ) {
- if( !strcmp( txtname, GetName( text ) ) )
- break;
- text = text->id.next;
- }
-
- /* uh-oh.... didn't find it */
- if( !text )
- return NULL;
-
- /* if previously compiled, free the object */
- /* (can't see how could be NULL, but check just in case) */
- if( text->compiled ){
- Py_DECREF( (PyObject *)text->compiled );
- }
-
- /* compile the buffer */
- buf = txt_to_buf( text );
- text->compiled = Py_CompileString( buf, GetName( text ),
- Py_file_input );
- MEM_freeN( buf );
-
- /* if compile failed.... return this error */
- if( PyErr_Occurred( ) ) {
- PyErr_Print( );
- BPY_free_compiled_text( text );
- return NULL;
- }
-
- /* make into a module */
- return PyImport_ExecCodeModule( name, text->compiled );
-}
-
-/*
- * our reload() module, to handle reloading in-memory scripts
- */
-
-static PyObject *blender_reload( PyObject * self, PyObject * args )
-{
- PyObject *exception, *err, *tb;
- PyObject *module = NULL;
- PyObject *newmodule = NULL;
-
- /* check for a module arg */
- if( !PyArg_ParseTuple( args, "O:breload", &module ) )
- return NULL;
-
- /* try reimporting from file */
- newmodule = PyImport_ReloadModule( module );
- if( newmodule )
- return newmodule;
-
- /* no file, try importing from memory */
- PyErr_Fetch( &exception, &err, &tb ); /*restore for probable later use */
-
- newmodule = reimportText( module );
- if( newmodule ) { /* found module, ignore above exception */
- PyErr_Clear( );
- Py_XDECREF( exception );
- Py_XDECREF( err );
- Py_XDECREF( tb );
- } else
- PyErr_Restore( exception, err, tb );
-
- return newmodule;
-}
-
-static PyMethodDef breload[] = {
- {"blreload", blender_reload, METH_VARARGS, "our own reload"}
-};
-
-void init_ourReload( void )
-{
- PyObject *m, *d;
- PyObject *reload = PyCFunction_New( breload, NULL );
-
- m = PyImport_AddModule( "__builtin__" );
- d = PyModule_GetDict( m );
- EXPP_dict_set_item_str( d, "reload", reload );
-}
diff --git a/source/blender/python/BPY_menus.c b/source/blender/python/BPY_menus.c
deleted file mode 100644
index 5f16aa0241b..00000000000
--- a/source/blender/python/BPY_menus.c
+++ /dev/null
@@ -1,1118 +0,0 @@
-/*
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano, Michael Reimpell
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-/*
- *This is the main file responsible for having bpython scripts accessible
- * from Blender menus. To know more, please start with its header file.
- */
-
-#include "BPY_menus.h"
-
-#include <Python.h>
-#ifndef WIN32
- #include <dirent.h>
-#else
- #include "BLI_winstuff.h"
-#endif
-#include "BKE_global.h"
-#include "BKE_utildefines.h"
-#include "BLI_blenlib.h"
-#include "MEM_guardedalloc.h"
-#include "DNA_userdef_types.h" /* for U.pythondir */
-#include "api2_2x/EXPP_interface.h" /* for bpy_gethome() */
-
-#define BPYMENU_DATAFILE "Bpymenus"
-#define MAX_DIR_DEPTH 4 /* max depth for traversing scripts dirs */
-#define MAX_DIR_NUMBER 30 /* max number of dirs in scripts dirs trees */
-
-static int DEBUG;
-static int Dir_Depth;
-static int Dirs_Number;
-
-/* BPyMenuTable holds all registered pymenus, as linked lists for each menu
- * where they can appear (see PYMENUHOOKS enum in BPY_menus.h).
-*/
-BPyMenu *BPyMenuTable[PYMENU_TOTAL];
-
-static int bpymenu_group_atoi( char *str )
-{
- if( !strcmp( str, "Export" ) )
- return PYMENU_EXPORT;
- else if( !strcmp( str, "Import" ) )
- return PYMENU_IMPORT;
- else if( !strcmp( str, "Help" ) )
- return PYMENU_HELP;
- else if( !strcmp( str, "HelpWebsites" ) )
- return PYMENU_HELPWEBSITES;
- else if( !strcmp( str, "HelpSystem" ) )
- return PYMENU_HELPSYSTEM;
- else if( !strcmp( str, "Render" ) )
- return PYMENU_RENDER;
- else if( !strcmp( str, "System" ) )
- return PYMENU_SYSTEM;
- else if( !strcmp( str, "Object" ) )
- return PYMENU_OBJECT;
- else if( !strcmp( str, "Mesh" ) )
- return PYMENU_MESH;
- else if( !strncmp( str, "Theme", 5 ) )
- return PYMENU_THEMES;
- else if( !strcmp( str, "Add" ) )
- return PYMENU_ADD;
- else if( !strcmp( str, "Wizards" ) )
- return PYMENU_WIZARDS;
- else if( !strcmp( str, "Animation" ) )
- return PYMENU_ANIMATION;
- else if( !strcmp( str, "Materials" ) )
- return PYMENU_MATERIALS;
- else if( !strcmp( str, "UV" ) )
- return PYMENU_UV;
- else if( !strcmp( str, "Image" ) )
- return PYMENU_IMAGE;
- else if( !strcmp( str, "FaceSelect" ) )
- return PYMENU_FACESELECT;
- else if( !strcmp( str, "WeightPaint" ) )
- return PYMENU_WEIGHTPAINT;
- else if( !strcmp( str, "VertexPaint" ) )
- return PYMENU_VERTEXPAINT;
- else if( !strcmp( str, "UVCalculation" ) )
- return PYMENU_UVCALCULATION;
- else if( !strcmp( str, "Armature" ) )
- return PYMENU_ARMATURE;
- else if( !strcmp( str, "ScriptTemplate" ) )
- return PYMENU_SCRIPTTEMPLATE;
- else if( !strcmp( str, "MeshFaceKey" ) )
- return PYMENU_MESHFACEKEY;
- else if( !strcmp( str, "AddMesh" ) )
- return PYMENU_ADDMESH;
- /* "Misc" or an inexistent group name: use misc */
- else
- return PYMENU_MISC;
-}
-
-char *BPyMenu_group_itoa( short menugroup )
-{
- switch ( menugroup ) {
- case PYMENU_EXPORT:
- return "Export";
- break;
- case PYMENU_IMPORT:
- return "Import";
- break;
- case PYMENU_ADD:
- return "Add";
- break;
- case PYMENU_HELP:
- return "Help";
- break;
- case PYMENU_HELPWEBSITES:
- return "HelpWebsites";
- break;
- case PYMENU_HELPSYSTEM:
- return "HelpSystem";
- break;
- case PYMENU_RENDER:
- return "Render";
- break;
- case PYMENU_SYSTEM:
- return "System";
- break;
- case PYMENU_OBJECT:
- return "Object";
- break;
- case PYMENU_MESH:
- return "Mesh";
- break;
- case PYMENU_THEMES:
- return "Themes";
- break;
- case PYMENU_WIZARDS:
- return "Wizards";
- break;
- case PYMENU_ANIMATION:
- return "Animation";
- break;
- case PYMENU_MATERIALS:
- return "Materials";
- break;
- case PYMENU_UV:
- return "UV";
- break;
- case PYMENU_IMAGE:
- return "Image";
- break;
- case PYMENU_FACESELECT:
- return "FaceSelect";
- break;
- case PYMENU_WEIGHTPAINT:
- return "WeightPaint";
- break;
- case PYMENU_VERTEXPAINT:
- return "VertexPaint";
- break;
- case PYMENU_UVCALCULATION:
- return "UVCalculation";
- break;
- case PYMENU_ARMATURE:
- return "Armature";
- break;
- case PYMENU_SCRIPTTEMPLATE:
- return "ScriptTemplate";
- break;
- case PYMENU_MESHFACEKEY:
- return "MeshFaceKey";
- break;
- case PYMENU_ADDMESH:
- return "AddMesh";
- break;
- case PYMENU_MISC:
- return "Misc";
- break;
- }
- return NULL;
-}
-
-/* BPyMenu_CreatePupmenuStr:
- * build and return a meaninful string to be used by pupmenu(). The
- * string is made of a bpymenu name as title and its submenus as possible
- * choices for the user.
-*/
-char *BPyMenu_CreatePupmenuStr( BPyMenu * pym, short menugroup )
-{
- BPySubMenu *pysm = pym->submenus;
- char str[1024], str2[100];
- int i = 0, rlen;
-
- if( !pym || !pysm )
- return NULL;
-
- str[0] = '\0';
-
- PyOS_snprintf( str2, sizeof( str2 ), "%s: %s%%t",
- BPyMenu_group_itoa( menugroup ), pym->name );
- strcat( str, str2 );
-
- while( pysm ) {
- PyOS_snprintf( str2, sizeof( str2 ), "|%s%%x%d", pysm->name,
- i );
- rlen = sizeof( str ) - strlen( str );
- strncat( str, str2, rlen );
- i++;
- pysm = pysm->next;
- }
-
- return BLI_strdup( str );
-}
-
-static void bpymenu_RemoveAllSubEntries( BPySubMenu * smenu )
-{
- BPySubMenu *tmp;
-
- while( smenu ) {
- tmp = smenu->next;
- if( smenu->name )
- MEM_freeN( smenu->name );
- if( smenu->arg )
- MEM_freeN( smenu->arg );
- MEM_freeN( smenu );
- smenu = tmp;
- }
- return;
-}
-
-void BPyMenu_RemoveAllEntries( void )
-{
- BPyMenu *tmp, *pymenu;
- int i;
-
- for( i = 0; i < PYMENU_TOTAL; i++ ) {
- pymenu = BPyMenuTable[i];
- while( pymenu ) {
- tmp = pymenu->next;
- if( pymenu->name )
- MEM_freeN( pymenu->name );
- if( pymenu->filename )
- MEM_freeN( pymenu->filename );
- if( pymenu->tooltip )
- MEM_freeN( pymenu->tooltip );
- if( pymenu->submenus )
- bpymenu_RemoveAllSubEntries( pymenu->
- submenus );
- MEM_freeN( pymenu );
- pymenu = tmp;
- }
- BPyMenuTable[i] = NULL;
- }
-
- Dirs_Number = 0;
- Dir_Depth = 0;
-
- return;
-}
-
-static BPyMenu *bpymenu_FindEntry( short group, char *name )
-{
- BPyMenu *pymenu;
-
- if( ( group < 0 ) || ( group >= PYMENU_TOTAL ) )
- return NULL;
-
- pymenu = BPyMenuTable[group];
-
- while( pymenu ) {
- if( !strcmp( pymenu->name, name ) )
- return pymenu;
- pymenu = pymenu->next;
- }
-
- return NULL;
-}
-
-/* BPyMenu_GetEntry:
- * given a group and a position, return the entry in that position from
- * that group.
-*/
-BPyMenu *BPyMenu_GetEntry( short group, short pos )
-{
- BPyMenu *pym = NULL;
-
- if( ( group < 0 ) || ( group >= PYMENU_TOTAL ) )
- return NULL;
-
- pym = BPyMenuTable[group];
-
- while( pos-- ) {
- if( pym )
- pym = pym->next;
- else
- break;
- }
-
- return pym; /* found entry or NULL */
-}
-
-static void bpymenu_set_tooltip( BPyMenu * pymenu, char *tip )
-{
- if( !pymenu )
- return;
-
- if( pymenu->tooltip )
- MEM_freeN( pymenu->tooltip );
- pymenu->tooltip = BLI_strdup( tip );
-
- return;
-}
-
-/* bpymenu_AddEntry:
- * try to find an existing pymenu entry with the given type and name;
- * if found, update it with new info, otherwise create a new one and fill it.
- */
-static BPyMenu *bpymenu_AddEntry( short group, short version, char *name,
- char *fname, int is_userdir, char *tooltip )
-{
- BPyMenu *menu, *next = NULL, **iter;
- int nameclash = 0;
-
- if( ( group < 0 ) || ( group >= PYMENU_TOTAL ) )
- return NULL;
- if( !name || !fname )
- return NULL;
-
- menu = bpymenu_FindEntry( group, name ); /* already exists? */
-
- /* if a menu with this name already exists in the same group:
- * - if one script is in the default dir and the other in U.pythondir,
- * accept and let the new one override the other.
- * - otherwise, report the error and return NULL. */
- if( menu ) {
- if( menu->dir < is_userdir ) { /* new one is in U.pythondir */
- nameclash = 1;
- if( menu->name )
- MEM_freeN( menu->name );
- if( menu->filename )
- MEM_freeN( menu->filename );
- if( menu->tooltip )
- MEM_freeN( menu->tooltip );
- if( menu->submenus )
- bpymenu_RemoveAllSubEntries( menu->submenus );
- next = menu->next;
- } else { /* they are in the same dir */
- if (DEBUG) {
- fprintf(stderr, "\n\
-Warning: script %s's menu name is already in use.\n\
-Edit the script and change its \n\
-Name: '%s'\n\
-field, please.\n\
-Note: if you really want to have two scripts for the same menu with\n\
-the same name, keep one in the default dir and the other in\n\
-the user defined dir (only the later will be registered).\n", fname, name);
- }
- return NULL;
- }
- } else
- menu = MEM_mallocN( sizeof( BPyMenu ), "pymenu" );
-
- if( !menu )
- return NULL;
-
- menu->name = BLI_strdup( name );
- menu->version = version;
- menu->filename = BLI_strdup( fname );
- menu->tooltip = NULL;
- if( tooltip )
- menu->tooltip = BLI_strdup( tooltip );
- menu->dir = is_userdir;
- menu->submenus = NULL;
- menu->next = next; /* non-NULL if menu already existed */
-
- if( nameclash )
- return menu; /* no need to place it, it's already at the list */
- else { /* insert the new entry in its correct position at the table */
- BPyMenu *prev = NULL;
- char *s = NULL;
-
- iter = &BPyMenuTable[group];
- while( *iter ) {
- s = ( *iter )->name;
- if( s )
- if( strcmp( menu->name, s ) < 0 )
- break; /* sort by names */
- prev = *iter;
- iter = &( ( *iter )->next );
- }
-
- if( *iter ) { /* prepend */
- menu->next = *iter;
- if( prev )
- prev->next = menu;
- else
- BPyMenuTable[group] = menu; /* is first entry */
- } else
- *iter = menu; /* append */
- }
-
- return menu;
-}
-
-/* bpymenu_AddSubEntry:
- * add a submenu to an existing python menu.
- */
-static int bpymenu_AddSubEntry( BPyMenu * mentry, char *name, char *arg )
-{
- BPySubMenu *smenu, **iter;
-
- smenu = MEM_mallocN( sizeof( BPySubMenu ), "pysubmenu" );
- if( !smenu )
- return -1;
-
- smenu->name = BLI_strdup( name );
- smenu->arg = BLI_strdup( arg );
- smenu->next = NULL;
-
- if( !smenu->name || !smenu->arg )
- return -1;
-
- iter = &( mentry->submenus );
- while( *iter )
- iter = &( ( *iter )->next );
-
- *iter = smenu;
-
- return 0;
-}
-
-/* bpymenu_CreateFromFile:
- * parse the bpymenus data file where Python menu data is stored;
- * based on this data, create and fill the pymenu structs.
- */
-static int bpymenu_CreateFromFile( void )
-{
- FILE *fp;
- char line[255], w1[255], w2[255], tooltip[255], *tip;
- char *homedir = NULL;
- int parsing, version, is_userdir;
- short group;
- BPyMenu *pymenu = NULL;
-
- /* init global bpymenu table (it is a list of pointers to struct BPyMenus
- * for each available cathegory: import, export, etc.) */
- for( group = 0; group < PYMENU_TOTAL; group++ )
- BPyMenuTable[group] = NULL;
-
- /* let's try to open the file with bpymenu data */
- homedir = bpy_gethome(0);
- if (!homedir) {
- if( DEBUG )
- fprintf(stderr,
- "BPyMenus error: couldn't open config file Bpymenus: no home dir.\n");
- return -1;
- }
-
- BLI_make_file_string( "/", line, homedir, BPYMENU_DATAFILE );
-
- fp = fopen( line, "rb" );
-
- if( !fp ) {
- if( DEBUG )
- fprintf(stderr, "BPyMenus error: couldn't open config file %s.\n", line );
- return -1;
- }
-
- fgets( line, 255, fp ); /* header */
-
- /* check if the U.pythondir we saved at the file is different from the
- * current one. If so, return to force updating from dirs */
- w1[0] = '\0';
- fscanf( fp, "# User defined scripts dir: %[^\n]\n", w1 );
- if( w1 ) {
- char upythondir[FILE_MAXDIR];
-
- BLI_strncpy(upythondir, U.pythondir, FILE_MAXDIR);
- BLI_convertstringcode(upythondir, G.sce, 0);
- if( strcmp( w1, upythondir ) != 0 )
- return -1;
- w1[0] = '\0';
- }
-
- while( fgets( line, 255, fp ) ) { /* parsing file lines */
-
- switch ( line[0] ) { /* check first char */
- case '#': /* comment */
- continue;
- break;
- case '\n':
- continue;
- break;
- default:
- parsing = sscanf( line, "%s {\n", w1 ); /* menu group */
- break;
- }
-
- if( parsing == 1 ) { /* got menu group string */
- group = (short)bpymenu_group_atoi( w1 );
- if( group < 0 && DEBUG ) { /* invalid type */
- fprintf(stderr,
- "BPyMenus error parsing config file: wrong group: %s,\n\
-will use 'Misc'.\n", w1 );
- }
- } else
- continue;
-
- for(;;) {
- tip = NULL; /* optional tooltip */
- fgets( line, 255, fp );
- if( line[0] == '}' )
- break;
- else if( line[0] == '\n' )
- continue;
- else if( line[0] == '\'' ) { /* menu entry */
- parsing =
- sscanf( line,
- "'%[^']' %d %s %d '%[^']'\n",
- w1, &version, w2, &is_userdir,
- tooltip );
-
- if( parsing <= 0 ) { /* invalid line, get rid of it */
- fgets( line, 255, fp );
- } else if( parsing == 5 )
- tip = tooltip; /* has tooltip */
-
- pymenu = bpymenu_AddEntry( group,
- ( short ) version,
- w1, w2, is_userdir,
- tip );
- if( !pymenu ) {
- puts( "BPyMenus error: couldn't create bpymenu entry.\n" );
- fclose( fp );
- return -1;
- }
- } else if( line[0] == '|' && line[1] == '_' ) { /* menu sub-entry */
- if( !pymenu )
- continue; /* no menu yet, skip this line */
- sscanf( line, "|_%[^:]: %s\n", w1, w2 );
- bpymenu_AddSubEntry( pymenu, w1, w2 );
- }
- }
- }
-
- fclose( fp );
- return 0;
-}
-
-/* bpymenu_WriteDataFile:
- * writes the registered scripts info to the user's home dir, for faster
- * access when the scripts dir hasn't changed.
-*/
-static void bpymenu_WriteDataFile( void )
-{
- BPyMenu *pymenu;
- BPySubMenu *smenu;
- FILE *fp;
- char fname[FILE_MAXDIR], *homedir;
- int i;
-
- homedir = bpy_gethome(0);
-
- if (!homedir) {
- if( DEBUG )
- fprintf(stderr,
- "BPyMenus error: couldn't write Bpymenus file: no home dir.\n\n");
- return;
- }
-
- BLI_make_file_string( "/", fname, homedir, BPYMENU_DATAFILE );
-
- fp = fopen( fname, "w" );
- if( !fp ) {
- if( DEBUG )
- fprintf(stderr, "BPyMenus error: couldn't write %s file.\n\n",
- fname );
- return;
- }
-
- fprintf( fp,
- "# Blender: registered menu entries for bpython scripts\n" );
-
- if (U.pythondir[0] != '\0' &&
- strcmp(U.pythondir, "/") != 0 && strcmp(U.pythondir, "//") != 0)
- {
- char upythondir[FILE_MAXDIR];
-
- BLI_strncpy(upythondir, U.pythondir, FILE_MAXDIR);
- BLI_convertstringcode(upythondir, G.sce, 0);
- fprintf( fp, "# User defined scripts dir: %s\n", upythondir );
- }
-
- for( i = 0; i < PYMENU_TOTAL; i++ ) {
- pymenu = BPyMenuTable[i];
- if( !pymenu )
- continue;
- fprintf( fp, "\n%s {\n", BPyMenu_group_itoa( (short)i ) );
- while( pymenu ) {
- fprintf( fp, "'%s' %d %s %d", pymenu->name,
- pymenu->version, pymenu->filename,
- pymenu->dir );
- if( pymenu->tooltip )
- fprintf( fp, " '%s'\n", pymenu->tooltip );
- else
- fprintf( fp, "\n" );
- smenu = pymenu->submenus;
- while( smenu ) {
- fprintf( fp, "|_%s: %s\n", smenu->name,
- smenu->arg );
- smenu = smenu->next;
- }
- pymenu = pymenu->next;
- }
- fprintf( fp, "}\n" );
- }
-
- fclose( fp );
- return;
-}
-
-/* BPyMenu_PrintAllEntries:
- * useful for debugging.
- */
-void BPyMenu_PrintAllEntries( void )
-{
- BPyMenu *pymenu;
- BPySubMenu *smenu;
- int i;
-
- printf( "# Blender: registered menu entries for bpython scripts\n" );
-
- for( i = 0; i < PYMENU_TOTAL; i++ ) {
- pymenu = BPyMenuTable[i];
- printf( "\n%s {\n", BPyMenu_group_itoa( (short)i ) );
- while( pymenu ) {
- printf( "'%s' %d %s %d", pymenu->name, pymenu->version,
- pymenu->filename, pymenu->dir );
- if( pymenu->tooltip )
- printf( " '%s'\n", pymenu->tooltip );
- else
- printf( "\n" );
- smenu = pymenu->submenus;
- while( smenu ) {
- printf( "|_%s: %s\n", smenu->name,
- smenu->arg );
- smenu = smenu->next;
- }
- pymenu = pymenu->next;
- }
- printf( "}\n" );
- }
-}
-
-/* bpymenu_ParseFile:
- * recursively scans folders looking for scripts to register.
- *
- * This function scans the scripts directory looking for .py files with the
- * right header and menu info, using that to fill the bpymenu structs.
- * is_userdir defines if the script is in the default scripts dir or the
- * user defined one (U.pythondir: is_userdir == 1).
- * Speed is important.
- *
- * The first line of the script must be '#!BPY'.
- * The header registration lines must appear between the first pair of
- * '\"\"\"' and follow this order (the single-quotes are part of
- * the format):
- *
- * # \"\"\"<br>
- * # Name: 'script name for the menu'
- * # Blender: <code>short int</code> (minimal Blender version)
- * # Group: 'group name' (defines menu)
- * # Submenu: 'submenu name' related_1word_arg
- * # Tooltip: 'tooltip for the menu'
- * # \"\"\"
- *
- * Notes:
- *
- * - Commenting out header lines with "#" is optional, but recommended.
- * - There may be more than one submenu line, or none:
- * submenus and the tooltip are optional;
- * - The Blender version is the same number reported by
- * Blender.Get('version') in BPython or G.version in C;
- * - Line length must be less than 99.
- */
-static int bpymenu_ParseFile(FILE *file, char *fname, int is_userdir)
-{
- char line[100];
- char head[100];
- char middle[100];
- char tail[100];
- int matches;
- int parser_state;
-
- char script_name[100];
- int script_version = 1;
- int script_group;
-
- BPyMenu *scriptMenu = NULL;
-
- if (file != NULL) {
- parser_state = 1; /* state of parser, 0 to terminate */
-
- while ((parser_state != 0) && (fgets(line, 100, file) != NULL)) {
-
- switch (parser_state) {
-
- case 1: /* !BPY */
- if (strncmp(line, "#!BPY", 5) == 0) {
- parser_state++;
- } else {
- parser_state = 0;
- }
- break;
-
- case 2: /* \"\"\" */
- if ((strstr(line, "\"\"\""))) {
- parser_state++;
- }
- break;
-
- case 3: /* Name: 'script name for the menu' */
- matches = sscanf(line, "%[^']'%[^']'%c", head, script_name, tail);
- if ((matches == 3) && (strstr(head, "Name:") != NULL)) {
- parser_state++;
- } else {
- if (DEBUG)
- fprintf(stderr, "BPyMenus error: Wrong 'Name' line: %s\n", fname);
- parser_state = 0;
- }
- break;
-
- case 4: /* Blender: <short int> */
- matches = sscanf(line, "%[^1234567890]%i%c", head, &script_version,
- tail);
- if (matches == 3) {
- parser_state++;
- } else {
- if (DEBUG)
- fprintf(stderr,"BPyMenus error: Wrong 'Blender' line: %s\n",fname);
- parser_state = 0;
- }
- break;
-
- case 5: /* Group: 'group name' */
- matches = sscanf(line, "%[^']'%[^']'%c", head, middle, tail);
- if ((matches == 3) && (strstr(head, "Group:") != NULL)) {
- script_group = bpymenu_group_atoi(middle);
- if (script_group < 0) {
- if (DEBUG)
- fprintf(stderr, "BPyMenus error: Unknown group \"%s\": %s\n",
- middle, fname);
- parser_state = 0;
- }
-
- else { /* register script */
- scriptMenu = bpymenu_AddEntry((short)script_group,
- (short int)script_version, script_name, fname, is_userdir,NULL);
- if (scriptMenu == NULL) {
- if (DEBUG)
- fprintf(stderr,
- "BPyMenus error: Couldn't create entry for: %s\n", fname);
- parser_state = 0;
- } else {
- parser_state++;
- }
- }
-
- } else {
- if (DEBUG)
- fprintf(stderr, "BPyMenus error: Wrong 'Group' line: %s\n",fname);
- parser_state = 0;
- }
- break;
-
- case 6: /* optional elements */
- /* Submenu: 'submenu name' related_1word_arg */
- matches = sscanf(line, "%[^']'%[^']'%s\n", head, middle, tail);
- if ((matches == 3) && (strstr(head, "Submenu:") != NULL)) {
- bpymenu_AddSubEntry(scriptMenu, middle, tail);
- } else {
- /* Tooltip: 'tooltip for the menu */
- matches = sscanf(line, "%[^']'%[^']'%c", head, middle, tail);
- if ((matches == 3) && ((strstr(head, "Tooltip:") != NULL) ||
- (strstr(head, "Tip:") != NULL))) {
- bpymenu_set_tooltip(scriptMenu, middle);
- }
- parser_state = 0;
- }
- break;
-
- default:
- parser_state = 0;
- break;
- }
- }
- }
-
- else { /* shouldn't happen, it's checked in bpymenus_ParseDir */
- if (DEBUG)
- fprintf(stderr, "BPyMenus error: Couldn't open %s.\n", fname);
- return -1;
- }
-
- return 0;
-}
-
-/* bpymenu_ParseDir:
- * recursively scans folders looking for scripts to register.
- *
- * This function scans the scripts directory looking for .py files with the
- * right header and menu info.
- * - is_userdir defines if the script is in the default scripts dir or the
- * user defined one (U.pythondir: is_userdir == 1);
- * - parentdir is the parent dir name to store as part of the script filename,
- * if we're down a subdir.
- * Speed is important.
- */
-static int bpymenu_ParseDir(char *dirname, char *parentdir, int is_userdir )
-{
- DIR *dir;
- FILE *file = NULL;
- struct dirent *de;
- struct stat status;
- char *file_extension;
- char path[FILE_MAX];
- char subdir[FILE_MAX];
- char *s = NULL;
-
- dir = opendir(dirname);
-
- if (dir != NULL) {
- while ((de = readdir(dir)) != NULL) {
-
- /* skip files and dirs starting with '.' or 'bpy' */
- if ((de->d_name[0] == '.') || !strncmp(de->d_name, "bpy", 3)) {
- continue;
- }
-
- BLI_make_file_string("/", path, dirname, de->d_name);
-
- if (stat(path, &status) != 0) {
- if (DEBUG)
- fprintf(stderr, "stat %s failed: %s\n", path, strerror(errno));
- }
-
- if (S_ISREG(status.st_mode)) { /* is file */
-
- file_extension = strstr(de->d_name, ".py");
-
- if (file_extension && *(file_extension + 3) == '\0') {
- file = fopen(path, "rb");
-
- if (file) {
- s = de->d_name;
- if (parentdir) {
- /* Join parentdir and de->d_name */
- BLI_join_dirfile(subdir, parentdir, de->d_name);
-
- s = subdir;
- }
- bpymenu_ParseFile(file, s, is_userdir);
- fclose(file);
- }
-
- else {
- if (DEBUG)
- fprintf(stderr, "BPyMenus error: Couldn't open %s.\n", path);
- }
- }
- }
-
- else if (S_ISDIR(status.st_mode)) { /* is subdir */
- Dirs_Number++;
- Dir_Depth++;
- if (Dirs_Number > MAX_DIR_NUMBER) {
- if (DEBUG) {
- fprintf(stderr, "BPyMenus error: too many subdirs.\n");
- }
- closedir(dir);
- return -1;
- }
- else if (Dir_Depth > MAX_DIR_DEPTH) {
- if (DEBUG)
- fprintf(stderr,
- "BPyMenus error: max depth reached traversing dir tree.\n");
- closedir(dir);
- return -1;
- }
- s = de->d_name;
- if (parentdir) {
- /* Join parentdir and de->d_name */
- BLI_join_dirfile(subdir, parentdir, de->d_name);
- s = subdir;
- }
- if (bpymenu_ParseDir(path, s, is_userdir) == -1) {
- closedir(dir);
- return -1;
- }
- Dir_Depth--;
- }
-
- }
- closedir(dir);
- }
-
- else { /* open directory stream failed */
- if (DEBUG)
- fprintf(stderr, "opendir %s failed: %s\n", dirname, strerror(errno));
- return -1;
- }
-
- return 0;
-}
-
-static int bpymenu_GetStatMTime( char *name, int is_file, time_t * mtime )
-{
- struct stat st;
- int result;
-
- result = stat( name, &st );
-
- if( result == -1 )
- return -1;
-
- if( is_file ) {
- if( !S_ISREG( st.st_mode ) )
- return -2;
- } else if( !S_ISDIR( st.st_mode ) )
- return -2;
-
- *mtime = st.st_mtime;
-
- return 0;
-}
-
-/* BPyMenu_Init:
- * import the bpython menus data to Blender, either from:
- * - the BPYMENU_DATAFILE file (?/.blender/Bpymenus) or
- * - the scripts dir(s), case newer than the datafile (then update the file).
- * then fill the bpymenu table with this data.
- * if param usedir != 0, then the data is recreated from the dir(s) anyway.
-*/
-int BPyMenu_Init( int usedir )
-{
- char fname[FILE_MAXDIR];
- char dirname[FILE_MAXDIR];
- char upythondir[FILE_MAXDIR];
- char *upydir = U.pythondir, *sdir = NULL;
- time_t time_dir1 = 0, time_dir2 = 0, time_file = 0;
- int stat_dir1 = 0, stat_dir2 = 0, stat_file = 0;
- int i;
-
- DEBUG = G.f & G_DEBUG; /* is Blender in debug mode (started with -d) ? */
-
- /* init global bpymenu table (it is a list of pointers to struct BPyMenus
- * for each available group: import, export, etc.) */
- for( i = 0; i < PYMENU_TOTAL; i++ )
- BPyMenuTable[i] = NULL;
-
- if( DEBUG )
- fprintf(stdout, "\nRegistering scripts in Blender menus ...\n\n" );
-
- if( U.pythondir[0] == '\0') {
- upydir = NULL;
- }
- else if (strcmp(U.pythondir, "/") == 0 || strcmp(U.pythondir, "//") == 0) {
- /* these are not accepted to prevent possible slight slowdowns on startup;
- * they should not be used as user defined scripts dir, anyway, also from
- * speed considerations, since they'd not be dedicated scripts dirs */
- if (DEBUG) fprintf(stderr,
- "BPyMenus: invalid user defined Python scripts dir: \"/\" or \"//\".\n");
- upydir = NULL;
- }
- else {
- BLI_strncpy(upythondir, upydir, FILE_MAXDIR);
- BLI_convertstringcode(upythondir, G.sce, 0);
- }
-
- sdir = bpy_gethome(1);
-
- if (sdir) {
- BLI_strncpy(dirname, sdir, FILE_MAXDIR);
- stat_dir1 = bpymenu_GetStatMTime( dirname, 0, &time_dir1 );
-
- if( stat_dir1 < 0 ) {
- time_dir1 = 0;
- if( DEBUG ) {
- fprintf(stderr,
- "\nDefault scripts dir: %s:\n%s\n", dirname, strerror(errno));
- if( upydir )
- fprintf(stdout,
- "Getting scripts menu data from user defined dir: %s.\n",
- upythondir );
- }
- }
- }
- else stat_dir1 = -1;
-
- if( upydir ) {
- stat_dir2 = bpymenu_GetStatMTime( upythondir, 0, &time_dir2 );
-
- if( stat_dir2 < 0 ) {
- time_dir2 = 0;
- upydir = NULL;
- if( DEBUG )
- fprintf(stderr, "\nUser defined scripts dir: %s:\n%s.\n",
- upythondir, strerror( errno ) );
- if( stat_dir1 < 0 ) {
- if( DEBUG )
- fprintf(stderr, "\
-To have scripts in menus, please add them to the default scripts dir:\n\
-%s\n\
-and / or go to 'Info window -> File Paths tab' and set a valid path for\n\
-the user defined Python scripts dir.\n", dirname );
- return -1;
- }
- }
- }
- else stat_dir2 = -1;
-
- if( ( stat_dir1 < 0 ) && ( stat_dir2 < 0 ) ) {
- if( DEBUG ) {
- fprintf(stderr, "\nCannot register scripts in menus, no scripts dir"
- " available.\nExpected default dir at: %s \n", dirname );
- }
- return -1;
- }
-
- if (usedir) stat_file = -1;
- else { /* if we're not forced to use the dir */
- char *homedir = bpy_gethome(0);
-
- if (homedir) {
- BLI_make_file_string( "/", fname, homedir, BPYMENU_DATAFILE );
- stat_file = bpymenu_GetStatMTime( fname, 1, &time_file );
- if( stat_file < 0 )
- time_file = 0;
-
- /* comparing dates */
-
- if((stat_file == 0)
- && (time_file > time_dir1) && (time_file > time_dir2))
- { /* file is newer */
- stat_file = bpymenu_CreateFromFile( ); /* -1 if an error occurred */
- if( !stat_file && DEBUG )
- fprintf(stdout,
- "Getting menu data for scripts from file:\n%s\n\n", fname );
- }
- else stat_file = -1;
- }
- else stat_file = -1; /* -1 to use dirs: didn't use file or it was corrupted */
- }
-
- if( stat_file == -1 ) { /* use dirs */
- if( DEBUG ) {
- fprintf(stdout,
- "Getting menu data for scripts from dir(s):\ndefault: %s\n", dirname );
- if( upydir )
- fprintf(stdout, "user defined: %s\n", upythondir );
- fprintf(stdout, "\n");
- }
- if( stat_dir1 == 0 ) {
- i = bpymenu_ParseDir( dirname, NULL, 0 );
- if (i == -1 && DEBUG)
- fprintf(stderr, "Default scripts dir does not seem valid.\n\n");
- }
- if( stat_dir2 == 0 ) {
- BLI_strncpy(dirname, U.pythondir, FILE_MAXDIR);
- BLI_convertstringcode(dirname, G.sce, 0);
- i = bpymenu_ParseDir( dirname, NULL, 1 );
- if (i == -1 && DEBUG)
- fprintf(stderr, "User defined scripts dir does not seem valid.\n\n");
- }
-
- /* check if we got any data */
- for( i = 0; i < PYMENU_TOTAL; i++ )
- if( BPyMenuTable[i] )
- break;
-
- /* if we got, recreate the file */
- if( i < PYMENU_TOTAL )
- bpymenu_WriteDataFile( );
- else if( DEBUG ) {
- fprintf(stderr, "\n\
-Warning: Registering scripts in menus -- no info found.\n\
-Either your scripts dirs have no .py scripts or the scripts\n\
-don't have a header with registration data.\n\
-Default scripts dir is:\n\
-%s\n", dirname );
- if( upydir )
- fprintf(stderr, "User defined scripts dir is: %s\n",
- upythondir );
- }
- }
-
- return 0;
-}
diff --git a/source/blender/python/BPY_menus.h b/source/blender/python/BPY_menus.h
deleted file mode 100644
index 89491ce3ef2..00000000000
--- a/source/blender/python/BPY_menus.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano, Matt Ebb
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef BPY_MENUS_H
-#define BPY_MENUS_H
-
-/* This header exposes BPyMenu related public declarations. The implementation
- * adds 'dynamic' menus to Blender, letting scripts register themselves in any
- * of a few pre-defined (trivial to upgrade) places in menus. These places or
- * slots are called groups here (Import, Export, etc). This is how it works:
- * - scripts at dirs user pref U.pythondir and .blender/scripts/ are scanned
- * for registration info.
- * - this data is also saved to a Bpymenus file at the user's .blender/ dir and
- * only re-created when the scripts folder gets modified.
- * - on start-up Blender uses this info to fill a table, which is used to
- * create the menu entries when they are needed (see header_info.c or
- * header_script.c, under source/blender/src/, for examples).
-*/
-
-/* These two structs hold py menu/submenu info.
- * BPyMenu holds a script's name (as should appear in the menu) and filename,
- * plus an optional list of submenus. Each submenu is related to a string
- * (arg) that the script can get from the __script__ pydict, to know which
- * submenu was chosen. */
-
-typedef struct BPySubMenu {
- char *name;
- char *arg;
- struct BPySubMenu *next;
-} BPySubMenu;
-
-typedef struct BPyMenu {
- char *name;
- char *filename;
- char *tooltip;
- short version; /* Blender version */
- int dir; /* 0: default, 1: U.pythondir */
- struct BPySubMenu *submenus;
- struct BPyMenu *next;
-} BPyMenu;
-
-/* Scripts can be added to only a few pre-defined places in menus, like
- * File->Import, File->Export, etc. (for speed and better control).
- * To make a new menu 'slot' available for scripts:
- * - add an entry to the enum below, before PYMENU_TOTAL, of course;
- * - update the bpymenu_group_atoi() and BPyMenu_group_itoa() functions in
- * BPY_menus.c;
- * - add the necessary code to the header_***.c file in
- * source/blender/src/, like done in header_info.c for import/export;
-*/
-typedef enum {
- PYMENU_ADD,/* creates new objects */
- PYMENU_ANIMATION,
- PYMENU_EXPORT,
- PYMENU_IMPORT,
- PYMENU_MATERIALS,
- PYMENU_MESH,
- PYMENU_MISC,
- PYMENU_OBJECT,
- PYMENU_RENDER,/* exporters to external renderers */
- PYMENU_SYSTEM,
- PYMENU_THEMES,
- PYMENU_UV,/* UV editing tools, to go in UV/Image editor space, 'UV' menu */
- PYMENU_IMAGE,/* Image editing tools, to go in UV/Image editor space, 'Image' menu */
- PYMENU_WIZARDS,/* complex 'app' scripts */
-
- /* entries put after Wizards don't appear at the Scripts win->Scripts menu;
- * see define right below */
-
- PYMENU_FACESELECT,
- PYMENU_WEIGHTPAINT,
- PYMENU_VERTEXPAINT,
- PYMENU_UVCALCULATION,
- PYMENU_ARMATURE,
- PYMENU_SCRIPTTEMPLATE,
- PYMENU_HELP,/*Main Help menu items - prob best to leave for 'official' ones*/
- PYMENU_HELPSYSTEM,/* Resources, troubleshooting, system tools */
- PYMENU_HELPWEBSITES,/* Help -> Websites submenu */
- PYMENU_MESHFACEKEY, /* face key in mesh editmode */
- PYMENU_ADDMESH, /* adds mesh */
- PYMENU_TOTAL
-} PYMENUHOOKS;
-
-#define PYMENU_SCRIPTS_MENU_TOTAL (PYMENU_WIZARDS + 1)
-
-/* BPyMenuTable holds all registered pymenus, as linked lists for each menu
- * where they can appear (see PYMENUHOOKS enum above).
-*/
-extern BPyMenu *BPyMenuTable[]; /* defined in BPY_menus.c */
-
-/* public functions: */
-int BPyMenu_Init( int usedir );
-void BPyMenu_RemoveAllEntries( void );
-void BPyMenu_PrintAllEntries( void );
-char *BPyMenu_CreatePupmenuStr( BPyMenu * pym, short group );
-char *BPyMenu_group_itoa( short group );
-struct BPyMenu *BPyMenu_GetEntry( short group, short pos );
-
-#endif /* BPY_MENUS_H */
diff --git a/source/blender/python/CMakeLists.txt b/source/blender/python/CMakeLists.txt
deleted file mode 100644
index 7df1f8a02d5..00000000000
--- a/source/blender/python/CMakeLists.txt
+++ /dev/null
@@ -1,57 +0,0 @@
-# $Id$
-# ***** BEGIN GPL/BL DUAL 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. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# The Original Code is Copyright (C) 2006, Blender Foundation
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jacques Beaurain.
-#
-# ***** END GPL/BL DUAL LICENSE BLOCK *****
-
-FILE(GLOB SRC api2_2x/*.c)
-SET(SRC ${SRC}
- BPY_interface.c
- BPY_menus.c
-)
-
-SET(INC
- api2_2x ../blenkernel ../blenlib ../blenloader
- ../render/extern/include ../radiosity/extern/include
- ../makesdna ../../../intern/guardedalloc ../../../intern/bmfont ../imbuf ../include
- ${PYTHON_INC}
-)
-
-IF(WITH_QUICKTIME)
- SET(INC ${INC} ${QUICKTIME_INC})
- ADD_DEFINITIONS(-DWITH_QUICKTIME)
-ENDIF(WITH_QUICKTIME)
-
-IF(WITH_OPENEXR)
- ADD_DEFINITIONS(-DWITH_OPENEXR)
-ENDIF(WITH_OPENEXR)
-
-IF(WITH_FFMPEG)
- ADD_DEFINITIONS(-DWITH_FFMPEG)
-ENDIF(WITH_FFMPEG)
-
-BLENDERLIB_NOLIST(blender_python "${SRC}" "${INC}")
-#env.BlenderLib ( libname='blender_python', sources = Split(sources), includes = Split(incs), defines = defs, libtype=['core','game2'], priority = [60,115] )
diff --git a/source/blender/python/SConscript b/source/blender/python/SConscript
deleted file mode 100644
index 9cd245394b0..00000000000
--- a/source/blender/python/SConscript
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/python
-Import ('env')
-
-sources = Split('BPY_interface.c BPY_menus.c') + env.Glob('api2_2x/*.c')
-
-incs = 'api2_2x ../blenkernel ../blenlib ../blenloader'
-incs += ' ../render/extern/include ../radiosity/extern/include'
-incs += ' ../makesdna #intern/guardedalloc #intern/bmfont ../imbuf ../include'
-incs += ' ' + env['BF_PYTHON_INC']
-incs += ' ' + env['BF_OPENGL_INC']
-
-defs = []
-if env['OURPLATFORM'] in ('win32-mingw') and env['BF_DEBUG']:
- defs.append('Py_TRACE_REFS')
-
-if env['WITH_BF_QUICKTIME']==1:
- incs += ' ' + env['BF_QUICKTIME_INC']
- defs.append('WITH_QUICKTIME')
-
-if env['WITH_BF_OPENEXR'] == 1:
- defs.append('WITH_OPENEXR')
-
-if env['WITH_BF_FFMPEG'] == 1:
- defs.append('WITH_FFMPEG')
-
-env.BlenderLib ( libname='blender_python', sources = Split(sources), includes = Split(incs), defines = defs, libtype=['core','game2'], priority = [60,115] )
diff --git a/source/blender/python/api2_2x/Armature.c b/source/blender/python/api2_2x/Armature.c
deleted file mode 100644
index f1fb3812625..00000000000
--- a/source/blender/python/api2_2x/Armature.c
+++ /dev/null
@@ -1,1490 +0,0 @@
-/*
- * $Id: Armature.c 12813 2007-12-07 09:51:02Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#include <stddef.h>
-
-#include "Armature.h" //This must come first
-
-#include "BKE_main.h"
-#include "BKE_global.h"
-#include "BKE_armature.h"
-#include "BKE_library.h"
-#include "BKE_depsgraph.h"
-#include "BKE_utildefines.h"
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "MEM_guardedalloc.h"
-#include "Bone.h"
-#include "NLA.h"
-#include "gen_utils.h"
-#include "gen_library.h"
-
-#include "DNA_object_types.h" //This must come before BIF_editarmature.h...
-#include "BIF_editarmature.h"
-
-//------------------EXTERNAL PROTOTYPES--------------------
-extern void make_boneList(ListBase* list, ListBase *bones, EditBone *parent);
-extern void editbones_to_armature (ListBase *list, Object *ob);
-
-//------------------------ERROR CODES---------------------------------
-//This is here just to make me happy and to have more consistant error strings :)
-static const char sBoneDictError[] = "ArmatureType.bones - Error: ";
-static const char sBoneDictBadArgs[] = "ArmatureType.bones - Bad Arguments: ";
-static const char sArmatureError[] = "ArmatureType - Error: ";
-static const char sArmatureBadArgs[] = "ArmatureType - Bad Arguments: ";
-static const char sModuleError[] = "Blender.Armature - Error: ";
-static const char sModuleBadArgs[] = "Blender.Armature - Bad Arguments: ";
-
-PyObject * arm_weakref_callback_weakref_dealloc(PyObject *self, PyObject *weakref);
-/* python callable */
-PyObject * arm_weakref_callback_weakref_dealloc__pyfunc;
-
-//################## BonesDict_Type (internal) ########################
-/*This is an internal psuedo-dictionary type that allows for manipulation
-* of bones inside of an armature. It is a subobject of armature.
-* i.e. Armature.bones['key']*/
-//#####################################################################
-
-//------------------METHOD IMPLEMENTATIONS-----------------------------
-//------------------------Armature.bones.items()
-//Returns a list of key:value pairs like dict.items()
-static PyObject* BonesDict_items(BPy_BonesDict *self)
-{
- if (self->editmode_flag){
- return PyDict_Items(self->editbonesMap);
- }else{
- return PyDict_Items(self->bonesMap);
- }
-}
-//------------------------Armature.bones.keys()
-//Returns a list of keys like dict.keys()
-static PyObject* BonesDict_keys(BPy_BonesDict *self)
-{
- if (self->editmode_flag){
- return PyDict_Keys(self->editbonesMap);
- }else{
- return PyDict_Keys(self->bonesMap);
- }
-}
-//------------------------Armature.bones.values()
-//Returns a list of values like dict.values()
-static PyObject* BonesDict_values(BPy_BonesDict *self)
-{
- if (self->editmode_flag){
- return PyDict_Values(self->editbonesMap);
- }else{
- return PyDict_Values(self->bonesMap);
- }
-}
-//------------------ATTRIBUTE IMPLEMENTATION---------------------------
-//------------------TYPE_OBECT IMPLEMENTATION-----------------------
-//------------------------tp_doc
-//The __doc__ string for this object
-static char BPy_BonesDict_doc[] = "This is an internal subobject of armature\
-designed to act as a Py_Bone dictionary.";
-
-//------------------------tp_methods
-//This contains a list of all methods the object contains
-static PyMethodDef BPy_BonesDict_methods[] = {
- {"items", (PyCFunction) BonesDict_items, METH_NOARGS,
- "() - Returns the key:value pairs from the dictionary"},
- {"keys", (PyCFunction) BonesDict_keys, METH_NOARGS,
- "() - Returns the keys the dictionary"},
- {"values", (PyCFunction) BonesDict_values, METH_NOARGS,
- "() - Returns the values from the dictionary"},
- {NULL, NULL, 0, NULL}
-};
-//-----------------(internal)
-static int BoneMapping_Init(PyObject *dictionary, ListBase *bones){
- Bone *bone = NULL;
- PyObject *py_bone = NULL;
-
- for (bone = bones->first; bone; bone = bone->next){
- py_bone = PyBone_FromBone(bone);
- if (!py_bone)
- return -1;
-
- if(PyDict_SetItemString(dictionary, bone->name, py_bone) == -1) {
- /* unlikely but possible */
- Py_DECREF(py_bone);
- return -1;
- }
-
- Py_DECREF(py_bone);
- if (bone->childbase.first)
- BoneMapping_Init(dictionary, &bone->childbase);
- }
- return 0;
-}
-//-----------------(internal)
-static int EditBoneMapping_Init(PyObject *dictionary, ListBase *editbones){
- EditBone *editbone = NULL;
- PyObject *py_editbone = NULL;
-
- for (editbone = editbones->first; editbone; editbone = editbone->next){
- py_editbone = PyEditBone_FromEditBone(editbone);
- if (!py_editbone)
- return -1;
-
- if(PyDict_SetItemString(dictionary, editbone->name, py_editbone) == -1) {
- Py_DECREF(py_editbone);
- return -1;
- }
- Py_DECREF(py_editbone);
- }
- return 0;
-}
-//----------------- BonesDict_InitBones
-static int BonesDict_InitBones(BPy_BonesDict *self)
-{
- PyDict_Clear(self->bonesMap);
- if (BoneMapping_Init(self->bonesMap, self->bones) == -1)
- return 0;
- return 1;
-}
-//----------------- BonesDict_InitEditBones
-static int BonesDict_InitEditBones(BPy_BonesDict *self)
-{
- PyDict_Clear(self->editbonesMap);
- if (EditBoneMapping_Init(self->editbonesMap, &self->editbones) == -1)
- return 0;
- return 1;
-}
-//------------------------tp_repr
-//This is the string representation of the object
-static PyObject *BonesDict_repr(BPy_BonesDict *self)
-{
- char str[2048];
- PyObject *key, *value;
- int pos = 0;
- char *p = str;
- char *keys, *vals;
-
- p += sprintf(str, "[Bone Dict: {");
-
- if (self->editmode_flag){
- while (PyDict_Next(self->editbonesMap, &pos, &key, &value)) {
- keys = PyString_AsString(key);
- vals = PyString_AsString(value->ob_type->tp_repr(value));
- if( strlen(str) + strlen(keys) + strlen(vals) < sizeof(str)-20 )
- p += sprintf(p, "%s : %s, ", keys, vals );
- else {
- p += sprintf(p, "...." );
- break;
- }
- }
- }else{
- while (PyDict_Next(self->bonesMap, &pos, &key, &value)) {
- keys = PyString_AsString(key);
- vals = PyString_AsString(value->ob_type->tp_repr(value));
- if( strlen(str) + strlen(keys) + strlen(vals) < sizeof(str)-20 )
- p += sprintf(p, "%s : %s, ", keys, vals );
- else {
- p += sprintf(p, "...." );
- break;
- }
- }
- }
- sprintf(p, "}]");
- return PyString_FromString(str);
-}
-
-//------------------------tp_dealloc
-//This tells how to 'tear-down' our object when ref count hits 0
-static void BonesDict_dealloc(BPy_BonesDict * self)
-{
- Py_DECREF(self->bonesMap);
- Py_DECREF(self->editbonesMap);
- BLI_freelistN(&self->editbones);
- PyObject_DEL( self );
- return;
-}
-//------------------------mp_length
-//This gets the size of the dictionary
-static int BonesDict_len(BPy_BonesDict *self)
-{
- if (self->editmode_flag){
- return BLI_countlist(&self->editbones);
- }else{
- return BLI_countlist(self->bones);
- }
-}
-//-----------------------mp_subscript
-//This defines getting a bone from the dictionary - x = Bones['key']
-static PyObject *BonesDict_GetItem(BPy_BonesDict *self, PyObject* key)
-{
- PyObject *value = NULL;
-
- if (self->editmode_flag){
- value = PyDict_GetItem(self->editbonesMap, key);
- }else{
- value = PyDict_GetItem(self->bonesMap, key);
- }
- if(value == NULL){ /* item not found in dict. throw exception */
- char* key_str = PyString_AsString( key );
- if (key_str) {
- return EXPP_ReturnPyObjError(PyExc_KeyError, "bone key must be a string" );
- } else {
- char buffer[128];
- PyOS_snprintf( buffer, sizeof(buffer), "bone %s not found", key_str);
- return EXPP_ReturnPyObjError(PyExc_KeyError, buffer );
- }
- }
- return EXPP_incr_ret(value);
-}
-//-----------------------mp_ass_subscript
-//This does dict assignment - Bones['key'] = value
-static int BonesDict_SetItem(BPy_BonesDict *self, PyObject *key, PyObject *value)
-{
- BPy_EditBone *editbone_for_deletion;
- struct EditBone *editbone = NULL;
- char *key_str = PyString_AsString(key);
-
- if (!self->editmode_flag)
- return EXPP_intError(PyExc_AttributeError, "%s%s",
- sBoneDictBadArgs, "You must call makeEditable() first");
-
- if (!key_str)
- return EXPP_intError(PyExc_AttributeError, "%s%s",
- sBoneDictBadArgs, "The key must be the name of an editbone");
-
- if (value && !EditBoneObject_Check(value))
- return EXPP_intError(PyExc_AttributeError, "%s%s",
- sBoneDictBadArgs, "Can only assign editbones as values");
-
- //parse value for assignment
- if (value){ /* we know this must be an editbone from the above check */
- //create a new editbone
- editbone = MEM_callocN(sizeof(EditBone), "eBone");
- BLI_strncpy(editbone->name, key_str, 32);
- unique_editbone_name(NULL, editbone->name);
- editbone->dist = ((BPy_EditBone*)value)->dist;
- editbone->ease1 = ((BPy_EditBone*)value)->ease1;
- editbone->ease2 = ((BPy_EditBone*)value)->ease2;
- editbone->flag = ((BPy_EditBone*)value)->flag;
- editbone->parent = ((BPy_EditBone*)value)->parent;
- editbone->rad_head = ((BPy_EditBone*)value)->rad_head;
- editbone->rad_tail = ((BPy_EditBone*)value)->rad_tail;
- editbone->roll = ((BPy_EditBone*)value)->roll;
- editbone->segments = ((BPy_EditBone*)value)->segments;
- editbone->weight = ((BPy_EditBone*)value)->weight;
- editbone->xwidth = ((BPy_EditBone*)value)->xwidth;
- editbone->zwidth = ((BPy_EditBone*)value)->zwidth;
- VECCOPY(editbone->head, ((BPy_EditBone*)value)->head);
- VECCOPY(editbone->tail, ((BPy_EditBone*)value)->tail);
- editbone->layer= ((BPy_EditBone*)value)->layer;
-
- //set object pointer
- ((BPy_EditBone*)value)->editbone = editbone;
-
- //fix the bone's head position if flags indicate that it is 'connected'
- if (editbone->flag & BONE_CONNECTED){
- if(!editbone->parent){
- ((BPy_EditBone*)value)->editbone = NULL;
- MEM_freeN(editbone);
- return EXPP_intError(PyExc_AttributeError, "%s%s",
- sBoneDictBadArgs, "The 'connected' flag is set but the bone has no parent!");
- }else{
- VECCOPY(editbone->head, editbone->parent->tail);
- }
- }
-
- //set in editbonelist
- BLI_addtail(&self->editbones, editbone);
-
- //set the new editbone in the mapping
- if(PyDict_SetItemString(self->editbonesMap, key_str, value) == -1){
- ((BPy_EditBone*)value)->editbone = NULL;
- BLI_freelinkN(&self->editbones, editbone);
- return EXPP_intError(PyExc_RuntimeError, "%s%s",
- sBoneDictError, "Unable to access dictionary!");
- }
- }else {
- //they are trying to delete the bone using 'del'
- editbone_for_deletion = (BPy_EditBone*)PyDict_GetItem(self->editbonesMap, key);
-
- if (!editbone_for_deletion)
- return EXPP_intError(PyExc_KeyError, "%s%s%s%s",
- sBoneDictError, "The key: ", key_str, " is not present in this dictionary!");
-
- /*first kill the datastruct then remove the item from the dict
- and wait for GC to pick it up.
- We have to delete the datastruct here because the tp_dealloc
- doesn't handle it*/
-
- /*this is ugly but you have to set the parent to NULL for else
- editbones_to_armature will crash looking for this bone*/
- for (editbone = self->editbones.first; editbone; editbone = editbone->next){
- if (editbone->parent == editbone_for_deletion->editbone) {
- editbone->parent = NULL;
- /* remove the connected flag or else the 'root' ball
- * doesn't get drawn */
- editbone->flag &= ~BONE_CONNECTED;
- }
- }
- BLI_freelinkN(&self->editbones, editbone_for_deletion->editbone);
- if(PyDict_DelItem(self->editbonesMap, key) == -1)
- return EXPP_intError(PyExc_RuntimeError, "%s%s",
- sBoneDictError, "Unable to access dictionary!");
- }
- return 0;
-}
-//------------------TYPE_OBJECT DEFINITION--------------------------
-//Mapping Protocol
-static PyMappingMethods BonesDict_MapMethods = {
- (inquiry) BonesDict_len, //mp_length
- (binaryfunc)BonesDict_GetItem, //mp_subscript
- (objobjargproc)BonesDict_SetItem, //mp_ass_subscript
-};
-//BonesDict TypeObject
-PyTypeObject BonesDict_Type = {
- PyObject_HEAD_INIT(NULL) //tp_head
- 0, //tp_internal
- "BonesDict", //tp_name
- sizeof(BPy_BonesDict), //tp_basicsize
- 0, //tp_itemsize
- (destructor)BonesDict_dealloc, //tp_dealloc
- 0, //tp_print
- 0, //tp_getattr
- 0, //tp_setattr
- 0, //tp_compare
- (reprfunc) BonesDict_repr, //tp_repr
- 0, //tp_as_number
- 0, //tp_as_sequence
- &BonesDict_MapMethods, //tp_as_mapping
- 0, //tp_hash
- 0, //tp_call
- 0, //tp_str
- 0, //tp_getattro
- 0, //tp_setattro
- 0, //tp_as_buffer
- Py_TPFLAGS_DEFAULT, //tp_flags
- BPy_BonesDict_doc, //tp_doc
- 0, //tp_traverse
- 0, //tp_clear
- 0, //tp_richcompare
- 0, //tp_weaklistoffset
- 0, //tp_iter
- 0, //tp_iternext
- BPy_BonesDict_methods, //tp_methods
- 0, //tp_members
- 0, //tp_getset
- 0, //tp_base
- 0, //tp_dict
- 0, //tp_descr_get
- 0, //tp_descr_set
- 0, //tp_dictoffset
- 0, //tp_init
- 0, //tp_alloc
- 0, //tp_new
- 0, //tp_free
- 0, //tp_is_gc
- 0, //tp_bases
- 0, //tp_mro
- 0, //tp_cache
- 0, //tp_subclasses
- 0, //tp_weaklist
- 0 //tp_del
-};
-//-----------------------PyBonesDict_FromPyArmature
-static PyObject *PyBonesDict_FromPyArmature(BPy_Armature *py_armature)
-{
- BPy_BonesDict *py_BonesDict = (BPy_BonesDict *)PyObject_NEW( BPy_BonesDict, &BonesDict_Type );
- if (!py_BonesDict)
- goto RuntimeError;
-
- py_BonesDict->bones = NULL;
- py_BonesDict->editbones.first = py_BonesDict->editbones.last = NULL;
-
- //create internal dictionaries
- py_BonesDict->bonesMap = PyDict_New();
- py_BonesDict->editbonesMap = PyDict_New();
- if (!py_BonesDict->bonesMap || !py_BonesDict->editbonesMap)
- goto RuntimeError;
-
- //set listbase pointer
- py_BonesDict->bones = &py_armature->armature->bonebase;
-
- //now that everything is setup - init the mappings
- if (!BonesDict_InitBones(py_BonesDict))
- goto RuntimeError;
- if (!BonesDict_InitEditBones(py_BonesDict))
- goto RuntimeError;
-
- //set editmode flag
- py_BonesDict->editmode_flag = 0;
-
- return (PyObject*)py_BonesDict;
-
-RuntimeError:
- return EXPP_objError(PyExc_RuntimeError, "%s%s",
- sBoneDictError, "Failed to create class");
-}
-
-//######################### Armature_Type #############################
-/*This type represents a thin wrapper around bArmature data types
-* internal to blender. It contains the psuedo-dictionary BonesDict
-* as an assistant in manipulating it's own bone collection*/
-//#################################################################
-
-//------------------METHOD IMPLEMENTATION------------------------------
-//------------------------Armature.makeEditable()
-static PyObject *Armature_makeEditable(BPy_Armature *self)
-{
- if (self->armature->flag & ARM_EDITMODE)
- goto AttributeError;
-
- make_boneList(&self->Bones->editbones, self->Bones->bones, NULL);
- if (!BonesDict_InitEditBones(self->Bones))
- return NULL;
- self->Bones->editmode_flag = 1;
- return EXPP_incr_ret(Py_None);
-
-AttributeError:
- return EXPP_objError(PyExc_AttributeError, "%s%s",
- sArmatureBadArgs, "The armature cannot be placed manually in editmode before you call makeEditable()!");
-}
-
-//------------------------Armature.update()
-//This is a bit ugly because you need an object link to do this
-static PyObject *Armature_update(BPy_Armature *self)
-{
- Object *obj = NULL;
-
- for (obj = G.main->object.first; obj; obj = obj->id.next){
- if (obj->data == self->armature)
- break;
- }
- if (obj){
- editbones_to_armature (&self->Bones->editbones, obj);
- if (!BonesDict_InitBones(self->Bones))
- return NULL;
- self->Bones->editmode_flag = 0;
- BLI_freelistN(&self->Bones->editbones);
- }else{
- goto AttributeError;
-
- }
- return EXPP_incr_ret(Py_None);
-
-AttributeError:
- return EXPP_objError(PyExc_AttributeError, "%s%s",
- sArmatureBadArgs, "The armature must be linked to an object before you can save changes!");
-}
-
-//------------------------Armature.__copy__()
-static PyObject *Armature_copy(BPy_Armature *self)
-{
- PyObject *py_armature = NULL;
- bArmature *bl_armature;
- bl_armature= copy_armature(self->armature);
- bl_armature->id.us= 0;
- py_armature= Armature_CreatePyObject( bl_armature );
- return py_armature;
-}
-
-//------------------ATTRIBUTE IMPLEMENTATION---------------------------
-//------------------------Armature.autoIK (getter)
-static PyObject *Armature_getAutoIK(BPy_Armature *self, void *closure)
-{
- if (self->armature->flag & ARM_AUTO_IK)
- return EXPP_incr_ret(Py_True);
- else
- return EXPP_incr_ret(Py_False);
-}
-//------------------------Armature.autoIK (setter)
-static int Armature_setAutoIK(BPy_Armature *self, PyObject *value, void *closure)
-{
- if(value){
- if(PyBool_Check(value)){
- if (value == Py_True){
- self->armature->flag |= ARM_AUTO_IK;
- return 0;
- }else if (value == Py_False){
- self->armature->flag &= ~ARM_AUTO_IK;
- return 0;
- }
- }
- }
- goto AttributeError;
-
-AttributeError:
- return EXPP_intError(PyExc_AttributeError, "%s%s",
- sArmatureBadArgs, "Expects True or False");
-}
-//------------------------Armature.layers (getter)
-static PyObject *Armature_getLayers(BPy_Armature *self, void *closure)
-{
- int layers, bit = 0, val = 0;
- PyObject *item = NULL, *laylist = PyList_New( 0 );
-
- if( !laylist )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create pylist!" );
-
- layers = self->armature->layer;
-
- while( bit < 20 ) {
- val = 1 << bit;
- if( layers & val ) {
- item = Py_BuildValue( "i", bit + 1 );
- PyList_Append( laylist, item );
- Py_DECREF( item );
- }
- bit++;
- }
- return laylist;
-}
-//------------------------Armature.layer (setter)
-static int Armature_setLayers(BPy_Armature *self, PyObject *value, void *closure)
-{
- if(value){
- if(PyList_Check(value)){
- int layers = 0, len_list = 0;
- int val;
- PyObject *item = NULL;
-
- len_list = PyList_Size(value);
-
- if( len_list == 0 )
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "list can't be empty, at least one layer must be set" );
-
- while( len_list ) {
- --len_list;
- item = PyList_GetItem( value, len_list );
- if( !PyInt_Check( item ) )
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "list must contain only integer numbers" );
-
- val = ( int ) PyInt_AsLong( item );
- if( val < 1 || val > 20 )
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "layer values must be in the range [1, 20]" );
-
- layers |= 1 << ( val - 1 );
- }
-
- /* update any bases pointing to our object */
- self->armature->layer = (short)layers;
-
- return 0;
- }
- }
- goto AttributeError;
-
-AttributeError:
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a list of integers" );
-}
-
-//------------------------Armature.mirrorEdit (getter)
-static PyObject *Armature_getMirrorEdit(BPy_Armature *self, void *closure)
-{
- if (self->armature->flag & ARM_MIRROR_EDIT)
- return EXPP_incr_ret(Py_True);
- else
- return EXPP_incr_ret(Py_False);
-}
-//------------------------Armature.mirrorEdit (setter)
-static int Armature_setMirrorEdit(BPy_Armature *self, PyObject *value, void *closure)
-{
- if(value){
- if(PyBool_Check(value)){
- if (value == Py_True){
- self->armature->flag |= ARM_MIRROR_EDIT;
- return 0;
- }else if (value == Py_False){
- self->armature->flag &= ~ARM_MIRROR_EDIT;
- return 0;
- }
- }
- }
- goto AttributeError;
-
-AttributeError:
- return EXPP_intError(PyExc_AttributeError, "%s%s",
- sArmatureBadArgs, "Expects True or False");
-}
-//------------------------Armature.drawType (getter)
-static PyObject *Armature_getDrawType(BPy_Armature *self, void *closure)
-{
- if (self->armature->drawtype == ARM_OCTA){
- return EXPP_GetModuleConstant("Blender.Armature", "OCTAHEDRON") ;
- }else if (self->armature->drawtype == ARM_LINE){
- return EXPP_GetModuleConstant("Blender.Armature", "STICK") ;
- }else if (self->armature->drawtype == ARM_B_BONE){
- return EXPP_GetModuleConstant("Blender.Armature", "BBONE") ;
- }else if (self->armature->drawtype == ARM_ENVELOPE){
- return EXPP_GetModuleConstant("Blender.Armature", "ENVELOPE") ;
- }else{
- goto RuntimeError;
- }
-
-RuntimeError:
- return EXPP_objError(PyExc_RuntimeError, "%s%s%s",
- sArmatureError, "drawType: ", "Internal failure!");
-}
-//------------------------Armature.drawType (setter)
-static int Armature_setDrawType(BPy_Armature *self, PyObject *value, void *closure)
-{
- PyObject *val = NULL, *name = NULL;
- long numeric_value;
-
- if(value){
- if(BPy_Constant_Check(value)){
- name = PyDict_GetItemString(((BPy_constant*)value)->dict, "name");
- if (!STREQ2(PyString_AsString(name), "OCTAHEDRON", "STICK") &&
- !STREQ2(PyString_AsString(name), "BBONE", "ENVELOPE"))
- goto ValueError;
- val = PyDict_GetItemString(((BPy_constant*)value)->dict, "value");
- if (PyInt_Check(val)){
- numeric_value = PyInt_AS_LONG(val);
- self->armature->drawtype = (int)numeric_value;
- return 0;
- }
- }
- }
- goto AttributeError;
-
-AttributeError:
- return EXPP_intError(PyExc_AttributeError, "%s%s",
- sArmatureBadArgs, "Expects module constant");
-
-ValueError:
- return EXPP_intError(PyExc_AttributeError, "%s%s",
- sArmatureBadArgs, "Argument must be the constant OCTAHEDRON, STICK, BBONE, or ENVELOPE");
-}
-//------------------------Armature.ghostStep (getter)
-static PyObject *Armature_getStep(BPy_Armature *self, void *closure)
-{
- return PyInt_FromLong((long)self->armature->ghostsize);
-}
-//------------------------Armature.ghostStep (setter)
-static int Armature_setStep(BPy_Armature *self, PyObject *value, void *closure)
-{
- long numerical_value;
-
- if(value){
- if(PyInt_Check(value)){
- numerical_value = PyInt_AS_LONG(value);
- if (numerical_value > 20.0f || numerical_value < 1.0f)
- goto ValueError;
- self->armature->ghostsize = (short)numerical_value;
- return 0;
- }
- }
- goto AttributeError;
-
-AttributeError:
- return EXPP_intError(PyExc_AttributeError, "%s%s",
- sArmatureBadArgs, "Expects Integer");
-
-ValueError:
- return EXPP_intError(PyExc_AttributeError, "%s%s",
- sArmatureBadArgs, "Argument must fall within 1-20");
-}
-//------------------------Armature.ghost (getter)
-static PyObject *Armature_getGhost(BPy_Armature *self, void *closure)
-{
- return PyInt_FromLong((long)self->armature->ghostep);
-}
-//------------------------Armature.ghost (setter)
-static int Armature_setGhost(BPy_Armature *self, PyObject *value, void *closure)
-{
- long numerical_value;
-
- if(value){
- if(PyInt_Check(value)){
- numerical_value = PyInt_AS_LONG(value);
- if (numerical_value > 30.0f || numerical_value < 0.0f)
- goto ValueError;
- self->armature->ghostep = (short)numerical_value;
- return 0;
- }
- }
- goto AttributeError;
-
-AttributeError:
- return EXPP_intError(PyExc_AttributeError, "%s%s",
- sArmatureBadArgs, "Expects Integer");
-
-ValueError:
- return EXPP_intError(PyExc_AttributeError, "%s%s",
- sArmatureBadArgs, "Argument must fall within 0-30");
-}
-//------------------------Armature.drawNames (getter)
-static PyObject *Armature_getDrawNames(BPy_Armature *self, void *closure)
-{
- if (self->armature->flag & ARM_DRAWNAMES)
- return EXPP_incr_ret(Py_True);
- else
- return EXPP_incr_ret(Py_False);
-}
-//------------------------Armature.drawNames (setter)
-static int Armature_setDrawNames(BPy_Armature *self, PyObject *value, void *closure)
-{
- if(value){
- if(PyBool_Check(value)){
- if (value == Py_True){
- self->armature->flag |= ARM_DRAWNAMES;
- return 0;
- }else if (value == Py_False){
- self->armature->flag &= ~ARM_DRAWNAMES;
- return 0;
- }
- }
- }
- goto AttributeError;
-
-AttributeError:
- return EXPP_intError(PyExc_AttributeError, "%s%s",
- sArmatureBadArgs, "Expects True or False");
-}
-//------------------------Armature.drawAxes (getter)
-static PyObject *Armature_getDrawAxes(BPy_Armature *self, void *closure)
-{
- if (self->armature->flag & ARM_DRAWAXES)
- return EXPP_incr_ret(Py_True);
- else
- return EXPP_incr_ret(Py_False);
-}
-//------------------------Armature.drawAxes (setter)
-static int Armature_setDrawAxes(BPy_Armature *self, PyObject *value, void *closure)
-{
- if(value){
- if(PyBool_Check(value)){
- if (value == Py_True){
- self->armature->flag |= ARM_DRAWAXES;
- return 0;
- }else if (value == Py_False){
- self->armature->flag &= ~ARM_DRAWAXES;
- return 0;
- }
- }
- }
- goto AttributeError;
-
-AttributeError:
- return EXPP_intError(PyExc_AttributeError, "%s%s",
- sArmatureBadArgs, "Expects True or False");
-}
-//------------------------Armature.delayDeform (getter)
-static PyObject *Armature_getDelayDeform(BPy_Armature *self, void *closure)
-{
- if (self->armature->flag & ARM_DELAYDEFORM)
- return EXPP_incr_ret(Py_True);
- else
- return EXPP_incr_ret(Py_False);
-}
-//------------------------Armature.delayDeform (setter)
-static int Armature_setDelayDeform(BPy_Armature *self, PyObject *value, void *closure)
-{
- if(value){
- if(PyBool_Check(value)){
- if (value == Py_True){
- self->armature->flag |= ARM_DELAYDEFORM;
- return 0;
- }else if (value == Py_False){
- self->armature->flag &= ~ARM_DELAYDEFORM;
- return 0;
- }
- }
- }
- goto AttributeError;
-
-AttributeError:
- return EXPP_intError(PyExc_AttributeError, "%s%s",
- sArmatureBadArgs, "Expects True or False");
-}
-//------------------------Armature.restPosition (getter)
-static PyObject *Armature_getRestPosition(BPy_Armature *self, void *closure)
-{
- if (self->armature->flag & ARM_RESTPOS)
- return EXPP_incr_ret(Py_True);
- else
- return EXPP_incr_ret(Py_False);
-}
-//------------------------Armature.restPosition (setter)
-static int Armature_setRestPosition(BPy_Armature *self, PyObject *value, void *closure)
-{
- if(value){
- if(PyBool_Check(value)){
- if (value == Py_True){
- self->armature->flag |= ARM_RESTPOS;
- return 0;
- }else if (value == Py_False){
- self->armature->flag &= ~ARM_RESTPOS;
- return 0;
- }
- }
- }
- goto AttributeError;
-
-AttributeError:
- return EXPP_intError(PyExc_AttributeError, "%s%s",
- sArmatureBadArgs, "Expects True or False");
-}
-//------------------------Armature.envelopes (getter)
-static PyObject *Armature_getEnvelopes(BPy_Armature *self, void *closure)
-{
- if (self->armature->deformflag & ARM_DEF_ENVELOPE)
- return EXPP_incr_ret(Py_True);
- else
- return EXPP_incr_ret(Py_False);
-}
-//------------------------Armature.envelopes (setter)
-static int Armature_setEnvelopes(BPy_Armature *self, PyObject *value, void *closure)
-{
- if(value){
- if(PyBool_Check(value)){
- if (value == Py_True){
- self->armature->deformflag |= ARM_DEF_ENVELOPE;
- return 0;
- }else if (value == Py_False){
- self->armature->deformflag &= ~ARM_DEF_ENVELOPE;
- return 0;
- }
- }
- }
- goto AttributeError;
-
-AttributeError:
- return EXPP_intError(PyExc_AttributeError, "%s%s",
- sArmatureBadArgs, "Expects True or False");
-}
-//------------------------Armature.vertexGroups (getter)
-static PyObject *Armature_getVertexGroups(BPy_Armature *self, void *closure)
-{
- if (self->armature->deformflag & ARM_DEF_VGROUP)
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
-}
-//------------------------Armature.vertexGroups (setter)
-static int Armature_setVertexGroups(BPy_Armature *self, PyObject *value, void *closure)
-{
- if(value){
- if(PyBool_Check(value)){
- if (value == Py_True){
- self->armature->deformflag |= ARM_DEF_VGROUP;
- return 0;
- }else if (value == Py_False){
- self->armature->deformflag &= ~ARM_DEF_VGROUP;
- return 0;
- }
- }
- }
- goto AttributeError;
-
-AttributeError:
- return EXPP_intError(PyExc_AttributeError, "%s%s",
- sArmatureBadArgs, "Expects True or False");
-}
-
-//------------------------Armature.bones (getter)
-//Gets the name of the armature
-static PyObject *Armature_getBoneDict(BPy_Armature *self, void *closure)
-{
- return EXPP_incr_ret((PyObject*)self->Bones);
-}
-//------------------------Armature.bones (setter)
-//Sets the name of the armature
-/*TODO*/
-/*Copy Bones through x = y*/
-static int Armature_setBoneDict(BPy_Armature *self, PyObject *value, void *closure)
-{
- goto AttributeError;
-
-AttributeError:
- return EXPP_intError(PyExc_AttributeError, "%s%s",
- sArmatureError, "You are not allowed to change the .Bones attribute");
-}
-
-//------------------------Bone.layerMask (get)
-static PyObject *Armature_getLayerMask(BPy_Armature *self)
-{
- /* do this extra stuff because the short's bits can be negative values */
- unsigned short laymask = 0;
- laymask |= self->armature->layer;
- return PyInt_FromLong((int)laymask);
-}
-//------------------------Bone.layerMask (set)
-static int Armature_setLayerMask(BPy_Armature *self, PyObject *value)
-{
- int laymask;
- if (!PyInt_Check(value)) {
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "expected an integer (bitmask) as argument" );
- }
-
- laymask = PyInt_AsLong(value);
-
- if (laymask <= 0 || laymask > (1<<16) - 1)
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "bitmask must have from 1 up to 16 bits set");
-
- self->armature->layer = 0;
- self->armature->layer |= laymask;
-
- return 0;
-}
-
-//------------------TYPE_OBECT IMPLEMENTATION--------------------------
-//------------------------tp_doc
-//The __doc__ string for this object
-static char BPy_Armature_doc[] = "This object wraps a Blender Armature object.";
-//------------------------tp_methods
-//This contains a list of all methods the object contains
-static PyMethodDef BPy_Armature_methods[] = {
- {"makeEditable", (PyCFunction) Armature_makeEditable, METH_NOARGS,
- "() - Unlocks the ability to modify armature bones"},
- {"update", (PyCFunction) Armature_update, METH_NOARGS,
- "() - Rebuilds the armature based on changes to bones since the last call to makeEditable"},
- {"__copy__", (PyCFunction) Armature_copy, METH_NOARGS,
- "() - Return a copy of the armature."},
- {"copy", (PyCFunction) Armature_copy, METH_NOARGS,
- "() - Return a copy of the armature."},
- {NULL, NULL, 0, NULL}
-};
-//------------------------tp_getset
-//This contains methods for attributes that require checking
-static PyGetSetDef BPy_Armature_getset[] = {
- GENERIC_LIB_GETSETATTR,
- {"bones", (getter)Armature_getBoneDict, (setter)Armature_setBoneDict,
- "The armature's Bone dictionary", NULL},
- {"vertexGroups", (getter)Armature_getVertexGroups, (setter)Armature_setVertexGroups,
- "Enable/Disable vertex group defined deformation", NULL},
- {"envelopes", (getter)Armature_getEnvelopes, (setter)Armature_setEnvelopes,
- "Enable/Disable bone envelope defined deformation", NULL},
- {"restPosition", (getter)Armature_getRestPosition, (setter)Armature_setRestPosition,
- "Show armature rest position - disables posing", NULL},
- {"delayDeform", (getter)Armature_getDelayDeform, (setter)Armature_setDelayDeform,
- "Don't deform children when manipulating bones in pose mode", NULL},
- {"drawAxes", (getter)Armature_getDrawAxes, (setter)Armature_setDrawAxes,
- "Enable/Disable drawing the bone axes", NULL},
- {"drawNames", (getter)Armature_getDrawNames, (setter)Armature_setDrawNames,
- "Enable/Disable drawing the bone names", NULL},
- {"ghost", (getter)Armature_getGhost, (setter)Armature_setGhost,
- "Draw a number of ghosts around the current frame for current Action", NULL},
- {"ghostStep", (getter)Armature_getStep, (setter)Armature_setStep,
- "The number of frames between ghost instances", NULL},
- {"drawType", (getter)Armature_getDrawType, (setter)Armature_setDrawType,
- "The type of drawing currently applied to the armature", NULL},
- {"mirrorEdit", (getter)Armature_getMirrorEdit, (setter)Armature_setMirrorEdit,
- "Enable/Disable X-axis mirrored editing", NULL},
- {"autoIK", (getter)Armature_getAutoIK, (setter)Armature_setAutoIK,
- "Adds temporal IK chains while grabbing bones", NULL},
- {"layers", (getter)Armature_getLayers, (setter)Armature_setLayers,
- "List of layers for the armature", NULL},
- {"layerMask", (getter)Armature_getLayerMask, (setter)Armature_setLayerMask,
- "Layer bitmask", NULL },
- {NULL, NULL, NULL, NULL, NULL}
-};
-//------------------------tp_new
-//This methods creates a new object (note it does not initialize it - only the building)
-//This can be called through python by myObject.__new__() however, tp_init is not called
-static PyObject *Armature_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
- BPy_Armature *py_armature = NULL;
- bArmature *bl_armature;
-
- bl_armature = add_armature("Armature");
- if(bl_armature) {
- bl_armature->id.us = 0; // return count to 0 - add_armature() inc'd it
-
- py_armature = (BPy_Armature*)type->tp_alloc(type, 0); //*new*
- if (py_armature == NULL)
- goto RuntimeError;
-
- py_armature->armature = bl_armature;
-
- //create armature.bones
- py_armature->Bones = (BPy_BonesDict*)PyBonesDict_FromPyArmature(py_armature);
- if (!py_armature->Bones)
- goto RuntimeError;
-
- } else {
- goto RuntimeError;
- }
- return (PyObject*)py_armature;
-
-RuntimeError:
- return EXPP_objError(PyExc_RuntimeError, "%s%s%s",
- sArmatureError, " __new__: ", "couldn't create Armature Data in Blender");
-}
-//------------------------tp_init
-//This methods does initialization of the new object
-//This method will get called in python by 'myObject(argument, keyword=value)'
-//tp_new will be automatically called before this
-static int Armature_init(BPy_Armature *self, PyObject *args, PyObject *kwds)
-{
- char buf[21];
- char *name = "myArmature";
- static char *kwlist[] = {"name", NULL};
-
- if(!PyArg_ParseTupleAndKeywords(args, kwds, "|s", kwlist, &name)){
- goto AttributeError;
- }
-
- //rename the armature if a name is supplied
- if(!BLI_streq(name, "myArmature")){
- PyOS_snprintf(buf, sizeof(buf), "%s", name);
- rename_id(&self->armature->id, buf);
- }
- return 0;
-
-AttributeError:
- return EXPP_intError(PyExc_AttributeError, "%s%s%s",
- sArmatureBadArgs, " __init__: ", "Expects string(name)");
-}
-
-
-/*****************************************************************************/
-/* Function: Armature_compare */
-/* Description: This is a callback function for the BPy_Armature type. It */
-/* compares two Armature_Type objects. Only the "==" and "!=" */
-/* comparisons are meaninful. Returns 0 for equality and -1 if */
-/* they don't point to the same Blender Object struct. */
-/* In Python it becomes 1 if they are equal, 0 otherwise. */
-/*****************************************************************************/
-static int Armature_compare( BPy_Armature * a, BPy_Armature * b )
-{
- return ( a->armature == b->armature ) ? 0 : -1;
-}
-
-//------------------------tp_repr
-//This is the string representation of the object
-static PyObject *Armature_repr(BPy_Armature *self)
-{
- return PyString_FromFormat( "[Armature: \"%s\"]", self->armature->id.name + 2 ); //*new*
-}
-//------------------------tp_dealloc
-//This tells how to 'tear-down' our object when ref count hits 0
-///tp_dealloc
-static void Armature_dealloc(BPy_Armature * self)
-{
- if (self->weaklist != NULL)
- PyObject_ClearWeakRefs((PyObject *) self); /* this causes the weakref dealloc func to be called */
-
- Py_DECREF(self->Bones);
- PyObject_DEL( self );
-}
-//------------------TYPE_OBECT DEFINITION--------------------------
-PyTypeObject Armature_Type = {
- PyObject_HEAD_INIT(NULL) //tp_head
- 0, //tp_internal
- "Armature", //tp_name
- sizeof(BPy_Armature), //tp_basicsize
- 0, //tp_itemsize
- (destructor)Armature_dealloc, //tp_dealloc
- 0, //tp_print
- 0, //tp_getattr
- 0, //tp_setattr
- (cmpfunc) Armature_compare, //tp_compare
- (reprfunc) Armature_repr, //tp_repr
- 0, //tp_as_number
- 0, //tp_as_sequence
- 0, //tp_as_mapping
- ( hashfunc ) GenericLib_hash, //tp_hash
- 0, //tp_call
- 0, //tp_str
- 0, //tp_getattro
- 0, //tp_setattro
- 0, //tp_as_buffer
- Py_TPFLAGS_DEFAULT| Py_TPFLAGS_HAVE_WEAKREFS, //tp_flags
- BPy_Armature_doc, //tp_doc
- 0, //tp_traverse
- 0, //tp_clear
- 0, //tp_richcompare
- offsetof(BPy_Armature, weaklist), //tp_weaklistoffset
- 0, //tp_iter
- 0, //tp_iternext
- BPy_Armature_methods, //tp_methods
- 0, //tp_members
- BPy_Armature_getset, //tp_getset
- 0, //tp_base
- 0, //tp_dict
- 0, //tp_descr_get
- 0, //tp_descr_set
- 0, //tp_dictoffset
- (initproc)Armature_init, //tp_init
- 0, //tp_alloc
- (newfunc)Armature_new, //tp_new
- 0, //tp_free
- 0, //tp_is_gc
- 0, //tp_bases
- 0, //tp_mro
- 0, //tp_cache
- 0, //tp_subclasses
- 0, //tp_weaklist
- 0 //tp_del
-};
-
-//-------------------MODULE METHODS IMPLEMENTATION------------------------
-//----------------Blender.Armature.Get()
-/* This function will return a Py_Armature when a single string is passed
-* or else it will return a {key:value} dictionary when mutliple strings are passed
-* or it will return a {key:value} dictionary of all armatures when nothing is passed */
-static PyObject *M_Armature_Get(PyObject * self, PyObject * args)
-{
- PyObject *seq = NULL, *item = NULL, *dict = NULL, *py_armature = NULL;
- char *name = "", buffer[24];
- int size = 0, i;
- void *data;
-
- //GET ARGUMENTS - () ('s') ('s',..) (['s',..]) are exceptable
- size = PySequence_Length(args);
- if (size == 1) {
- seq = PySequence_GetItem(args, 0); //*new*
- if (!seq)
- goto RuntimeError;
- if(!PyString_Check(seq)){
- if (PySequence_Check(seq)) {
- size = PySequence_Length(seq);
- } else {
- Py_DECREF(seq);
- goto AttributeError;
- }
- }
- } else {
- seq = EXPP_incr_ret(args); //*take ownership*
- }
- //'seq' should be a list, empty tuple or string - check list for strings
- if(!PyString_Check(seq)){
- for(i = 0; i < size; i++){
- item = PySequence_GetItem(seq, i); //*new*
- if (!item) {
- Py_DECREF(seq);
- goto RuntimeError;
- }
- if(!PyString_Check(item)){
- EXPP_decr2(item, seq);
- goto AttributeError;
- }
- Py_DECREF(item);
- }
- }
-
- //GET ARMATURES
- if(size != 1){
- dict = PyDict_New(); //*new*
- if(!dict){
- Py_DECREF(seq);
- goto RuntimeError;
- }
- if(size == 0){ //GET ALL ARMATURES
- data = G.main->armature.first; //get the first data ID from the armature library
- while (data){
- py_armature = Armature_CreatePyObject(data); //*new*
- if (!py_armature) {
- EXPP_decr2(seq, dict);
- return NULL; /* error is set from Armature_CreatePyObject */
- }
- sprintf(buffer, "%s", ((bArmature*)data)->id.name +2);
- if(PyDict_SetItemString(dict, buffer, py_armature) == -1){ //add to dictionary
- EXPP_decr3(seq, dict, py_armature);
- goto RuntimeError;
- }
- Py_DECREF(py_armature);
- data = ((ID*)data)->next;
- }
- Py_DECREF(seq);
- }else{ //GET ARMATURE LIST
- for (i = 0; i < size; i++) {
- item = PySequence_GetItem(seq, i); //*new*
- name = PyString_AsString(item);
- Py_DECREF(item);
- data = find_id("AR", name); //get data from library
- if (data != NULL){
- py_armature = Armature_CreatePyObject(data); //*new*
- if (!py_armature) {
- EXPP_decr2(seq, dict);
- return NULL; /* error is set from Armature_CreatePyObject */
- }
-
- if(PyDict_SetItemString(dict, name, py_armature) == -1){ //add to dictionary
- EXPP_decr3(seq, dict, py_armature);
- goto RuntimeError;
- }
- Py_DECREF(py_armature);
- }else{
- if(PyDict_SetItemString(dict, name, Py_None) == -1){ //add to dictionary
- EXPP_decr2(seq, dict);
- goto RuntimeError;
- }
- Py_DECREF(Py_None);
- }
- }
- Py_DECREF(seq);
- }
- return dict;
- }else{ //GET SINGLE ARMATURE
- if(!PyString_Check(seq)){ //This handles the bizarre case where (['s']) is passed
- item = PySequence_GetItem(seq, 0); //*new*
- name = PyString_AsString(item);
- Py_DECREF(item);
- }else{
- name = PyString_AsString(seq);
- }
- Py_DECREF(seq);
- data = find_id("AR", name); //get data from library
- if (data != NULL){
- return Armature_CreatePyObject(data); //*new*
- }else{
- char buffer[128];
- PyOS_snprintf( buffer, sizeof(buffer),
- "Armature \"%s\" not found", name);
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- buffer );
- }
- }
-
-RuntimeError:
- return EXPP_objError(PyExc_RuntimeError, "%s%s%s",
- sModuleError, "Get(): ", "Internal Error Ocurred");
-
-AttributeError:
- return EXPP_objError(PyExc_AttributeError, "%s%s%s",
- sModuleBadArgs, "Get(): ", "- Expects (optional) string sequence");
-}
-
-
-//----------------Blender.Armature.New()
-static PyObject *M_Armature_New(PyObject * self, PyObject * args)
-{
- char *name = "Armature";
- struct bArmature *armature;
- BPy_Armature *obj;
-
- if( !PyArg_ParseTuple( args, "|s", &name ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected nothing or a string as argument" );
-
- armature= add_armature(name);
- armature->id.us = 0;
- obj = (BPy_Armature *)Armature_CreatePyObject(armature); /*new*/
-
- if( !obj )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyObject_New() failed" );
-
- obj->armature = armature;
- return (PyObject *)obj;
-}
-
-
-//-------------------MODULE METHODS DEFINITION-----------------------------
-
-static char M_Armature_Get_doc[] = "(name) - return the armature with the name 'name', \
- returns None if not found.\n If 'name' is not specified, it returns a list of all \
- armatures in the\ncurrent scene.";
-
-static char M_Armature_New_doc[] = "(name) - return a new armature object.";
-
-struct PyMethodDef M_Armature_methods[] = {
- {"Get", M_Armature_Get, METH_VARARGS, M_Armature_Get_doc},
- {"New", M_Armature_New, METH_VARARGS, M_Armature_New_doc},
- {NULL, NULL, 0, NULL}
-};
-//------------------VISIBLE PROTOTYPE IMPLEMENTATION-----------------------
-//------------------------Armature_RebuildEditbones (internal)
-PyObject * Armature_RebuildEditbones(PyObject *pyarmature)
-{
- return Armature_makeEditable((BPy_Armature*)pyarmature);
-}
-
-//------------------------Armature_RebuildBones (internal)
-PyObject *Armature_RebuildBones(PyObject *pyarmature)
-{
- return Armature_update((BPy_Armature*)pyarmature);
-}
-
-/* internal func to remove weakref from weakref list */
-PyObject * arm_weakref_callback_weakref_dealloc(PyObject *self, PyObject *weakref)
-{
- char *list_name = ARM_WEAKREF_LIST_NAME;
- PyObject *maindict = NULL, *armlist = NULL;
- int i;
-
- maindict= PyModule_GetDict(PyImport_AddModule( "__main__"));
- armlist = PyDict_GetItemString(maindict, list_name);
- if( !armlist){
- printf("Oops - update_armature_weakrefs()\n");
- Py_RETURN_NONE;
- }
-
- i = PySequence_Index(armlist, weakref);
- if (i==-1) {
- printf("callback weakref internal error, weakref not in list\n\tthis should never happen.\n");
- Py_RETURN_NONE;
- }
- PySequence_DelItem(armlist, i);
- Py_RETURN_NONE;
-}
-
-/*-----------------(internal)
- * Converts a bArmature to a PyArmature */
-
-PyObject *Armature_CreatePyObject(struct bArmature *armature)
-{
- BPy_Armature *py_armature = NULL;
- PyObject *maindict = NULL, *weakref = NULL;
- PyObject *armlist = NULL; /* list of armature weak refs */
- char *list_name = ARM_WEAKREF_LIST_NAME;
- int i;
-
- //put a weakreference in __main__
- maindict= PyModule_GetDict(PyImport_AddModule( "__main__"));
-
- armlist = PyDict_GetItemString(maindict, list_name);
- if(!armlist) {
- printf("Oops - can't get the armature weakref list\n");
- goto RuntimeError;
- }
-
- /* see if we alredy have it */
- for (i=0; i< PyList_Size(armlist); i++) {
- py_armature = (BPy_Armature *)PyWeakref_GetObject(PyList_GET_ITEM(armlist, i));
- if (BPy_Armature_Check(py_armature) && py_armature->armature == armature) {
- Py_INCREF(py_armature);
- /*printf("reusing armature\n");*/
- return (PyObject *)py_armature;
- }
- }
-
-
- /*create armature type*/
- py_armature = PyObject_NEW( BPy_Armature, &Armature_Type );
-
- if (!py_armature){
- printf("Oops - can't create py armature\n");
- goto RuntimeError;
- }
-
- py_armature->armature = armature;
- py_armature->weaklist = NULL; //init the weaklist
-
- //create armature.bones
- py_armature->Bones = (BPy_BonesDict*)PyBonesDict_FromPyArmature(py_armature);
- if (!py_armature->Bones){
- printf("Oops - creating armature.bones\n");
- goto RuntimeError;
- }
-
- weakref = PyWeakref_NewRef((PyObject*)py_armature, arm_weakref_callback_weakref_dealloc__pyfunc);
- if (PyList_Append(armlist, weakref) == -1){
- printf("Oops - list-append failed\n");
- goto RuntimeError;
- }
- Py_DECREF(weakref);
-
- return (PyObject *) py_armature;
-
-RuntimeError:
- return EXPP_objError(PyExc_RuntimeError, "%s%s%s",
- sModuleError, "Armature_CreatePyObject: ", "Internal Error Ocurred");
-}
-//-----------------(internal)
-//Converts a PyArmature to a bArmature
-struct bArmature *PyArmature_AsArmature(BPy_Armature *py_armature)
-{
- return (py_armature->armature);
-}
-
-struct bArmature *Armature_FromPyObject( PyObject * py_obj )
-{
- return PyArmature_AsArmature((BPy_Armature*)py_obj);
-}
-
-/* internal use only */
-static PyMethodDef bpy_arm_weakref_callback_weakref_dealloc[] = {
- {"arm_weakref_callback_weakref_dealloc", arm_weakref_callback_weakref_dealloc, METH_O, ""}
-};
-
-//-------------------MODULE INITIALIZATION--------------------------------
-PyObject *Armature_Init(void)
-{
- PyObject *module, *dict;
-
- //Initializes TypeObject.ob_type
- if (PyType_Ready(&Armature_Type) < 0 || PyType_Ready(&BonesDict_Type) < 0 ||
- PyType_Ready(&EditBone_Type) < 0 || PyType_Ready(&Bone_Type) < 0) {
- return EXPP_incr_ret(Py_None);
- }
-
- /* Weakref management - used for callbacks so we can
- * tell when a callback has been removed that a UI button referenced */
- arm_weakref_callback_weakref_dealloc__pyfunc = PyCFunction_New(bpy_arm_weakref_callback_weakref_dealloc, NULL);
-
-
- //Register the module
- module = Py_InitModule3("Blender.Armature", M_Armature_methods,
- "The Blender Armature module");
-
- //Add TYPEOBJECTS to the module
- PyModule_AddObject(module, "Armature",
- EXPP_incr_ret((PyObject *)&Armature_Type)); //*steals*
- PyModule_AddObject(module, "Bone",
- EXPP_incr_ret((PyObject *)&Bone_Type)); //*steals*
- PyModule_AddObject(module, "Editbone",
- EXPP_incr_ret((PyObject *)&EditBone_Type)); //*steals*
-
- //Add CONSTANTS to the module
- PyModule_AddObject(module, "CONNECTED",
- PyConstant_NewInt("CONNECTED", BONE_CONNECTED));
- PyModule_AddObject(module, "HINGE",
- PyConstant_NewInt("HINGE", BONE_HINGE));
- PyModule_AddObject(module, "NO_DEFORM",
- PyConstant_NewInt("NO_DEFORM", BONE_NO_DEFORM));
- PyModule_AddObject(module, "MULTIPLY",
- PyConstant_NewInt("MULTIPLY", BONE_MULT_VG_ENV));
- PyModule_AddObject(module, "HIDDEN_EDIT",
- PyConstant_NewInt("HIDDEN_EDIT", BONE_HIDDEN_A));
- PyModule_AddObject(module, "ROOT_SELECTED",
- PyConstant_NewInt("ROOT_SELECTED", BONE_ROOTSEL));
- PyModule_AddObject(module, "BONE_SELECTED",
- PyConstant_NewInt("BONE_SELECTED", BONE_SELECTED));
- PyModule_AddObject(module, "TIP_SELECTED",
- PyConstant_NewInt("TIP_SELECTED", BONE_TIPSEL));
-
- PyModule_AddObject(module, "OCTAHEDRON",
- PyConstant_NewInt("OCTAHEDRON", ARM_OCTA));
- PyModule_AddObject(module, "STICK",
- PyConstant_NewInt("STICK", ARM_LINE));
- PyModule_AddObject(module, "BBONE",
- PyConstant_NewInt("BBONE", ARM_B_BONE));
- PyModule_AddObject(module, "ENVELOPE",
- PyConstant_NewInt("ENVELOPE", ARM_ENVELOPE));
-
- //Add SUBMODULES to the module
- dict = PyModule_GetDict( module ); //borrowed
- PyDict_SetItemString(dict, "NLA", NLA_Init()); //creates a *new* module
-
- return module;
-}
diff --git a/source/blender/python/api2_2x/Armature.h b/source/blender/python/api2_2x/Armature.h
deleted file mode 100644
index bafd49772b0..00000000000
--- a/source/blender/python/api2_2x/Armature.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * $Id: Armature.h 10269 2007-03-15 01:09:14Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * Contributor(s): Joseph gilbert
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_ARMATURE_H
-#define EXPP_ARMATURE_H
-
-#include <Python.h>
-#include "DNA_armature_types.h"
-
-//-------------------TYPE CHECKS---------------------------------
-#define BPy_Armature_Check(v) ((v)->ob_type == &Armature_Type)
-#define BPy_BonesDict_Check(v) ((v)->ob_type == &BonesDict_Type)
-//-------------------MODULE INIT---------------------------------
-PyObject *Armature_Init( void );
-//-------------------TYPEOBJECT----------------------------------
-extern PyTypeObject Armature_Type;
-extern PyTypeObject BonesDict_Type;
-//-------------------STRUCT DEFINITION---------------------------
-typedef struct {
- PyObject_HEAD
- PyObject *bonesMap; //wrapper for bones
- PyObject *editbonesMap; //wrapper for editbones
- ListBase *bones; //pointer to armature->bonebase
- ListBase editbones; //allocated list of EditBones
- short editmode_flag; //1 = in , 0 = not in
-} BPy_BonesDict;
-
-typedef struct {
- PyObject_HEAD
- struct bArmature * armature;
- BPy_BonesDict *Bones; //BPy_BonesDict
- PyObject *weaklist;
-} BPy_Armature;
-
-//-------------------VISIBLE PROTOTYPES-------------------------
-PyObject *Armature_CreatePyObject(struct bArmature *armature);
-struct bArmature *PyArmature_AsArmature(BPy_Armature *py_armature);
-PyObject * Armature_RebuildEditbones(PyObject *pyarmature);
-PyObject *Armature_RebuildBones(PyObject *pyarmature);
-
-struct bArmature *Armature_FromPyObject( PyObject * py_obj );
-
-#endif
diff --git a/source/blender/python/api2_2x/BGL.c b/source/blender/python/api2_2x/BGL.c
deleted file mode 100644
index 5d78fd09e2d..00000000000
--- a/source/blender/python/api2_2x/BGL.c
+++ /dev/null
@@ -1,1590 +0,0 @@
-/*
- * $Id: BGL.c 12267 2007-10-17 09:51:13Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-/* This file is the Blender.BGL part of opy_draw.c, from the old
- * bpython/intern dir, with minor changes to adapt it to the new Python
- * implementation. The BGL submodule "wraps" OpenGL functions and constants,
- * allowing script writers to make OpenGL calls in their Python scripts. */
-
-#include "BGL.h" /*This must come first */
-
-#include "MEM_guardedalloc.h"
-#include "gen_utils.h"
-
-static int type_size( int type );
-static Buffer *make_buffer( int type, int ndimensions, int *dimensions );
-
-static char Method_Buffer_doc[] =
- "(type, dimensions, [template]) - Create a new Buffer object\n\n\
-(type) - The format to store data in\n\
-(dimensions) - An int or sequence specifying the dimensions of the buffer\n\
-[template] - A sequence of matching dimensions to the buffer to be created\n\
- which will be used to initialize the Buffer.\n\n\
-If a template is not passed in all fields will be initialized to 0.\n\n\
-The type should be one of GL_BYTE, GL_SHORT, GL_INT, GL_FLOAT, or GL_DOUBLE.\n\
-If the dimensions are specified as an int a linear buffer will be\n\
-created. If a sequence is passed for the dimensions the buffer\n\
-will have len(sequence) dimensions, where the size for each dimension\n\
-is determined by the value in the sequence at that index.\n\n\
-For example, passing [100, 100] will create a 2 dimensional\n\
-square buffer. Passing [16, 16, 32] will create a 3 dimensional\n\
-buffer which is twice as deep as it is wide or high.";
-
-static PyObject *Method_Buffer( PyObject * self, PyObject * args );
-
-/* Buffer sequence methods */
-
-static int Buffer_len( PyObject * self );
-static PyObject *Buffer_item( PyObject * self, int i );
-static PyObject *Buffer_slice( PyObject * self, int begin, int end );
-static int Buffer_ass_item( PyObject * self, int i, PyObject * v );
-static int Buffer_ass_slice( PyObject * self, int begin, int end,
- PyObject * seq );
-
-static PySequenceMethods Buffer_SeqMethods = {
- ( inquiry ) Buffer_len, /*sq_length */
- ( binaryfunc ) 0, /*sq_concat */
- ( intargfunc ) 0, /*sq_repeat */
- ( intargfunc ) Buffer_item, /*sq_item */
- ( intintargfunc ) Buffer_slice, /*sq_slice */
- ( intobjargproc ) Buffer_ass_item, /*sq_ass_item */
- ( intintobjargproc ) Buffer_ass_slice, /*sq_ass_slice */
-};
-
-static void Buffer_dealloc( PyObject * self );
-static PyObject *Buffer_tolist( PyObject * self );
-static PyObject *Buffer_dimensions( PyObject * self );
-static PyObject *Buffer_getattr( PyObject * self, char *name );
-static PyObject *Buffer_repr( PyObject * self );
-
-PyTypeObject buffer_Type = {
- PyObject_HEAD_INIT( NULL ) /* required python macro */
- 0, /*ob_size */
- "buffer", /*tp_name */
- sizeof( Buffer ), /*tp_basicsize */
- 0, /*tp_itemsize */
- ( destructor ) Buffer_dealloc, /*tp_dealloc */
- ( printfunc ) 0, /*tp_print */
- ( getattrfunc ) Buffer_getattr, /*tp_getattr */
- ( setattrfunc ) 0, /*tp_setattr */
- ( cmpfunc ) 0, /*tp_compare */
- ( reprfunc ) Buffer_repr, /*tp_repr */
- 0, /*tp_as_number */
- &Buffer_SeqMethods, /*tp_as_sequence */
-};
-
-/* #ifndef __APPLE__ */
-
-#define BGL_Wrap(nargs, funcname, ret, arg_list) \
-static PyObject *Method_##funcname (PyObject *self, PyObject *args) {\
- arg_def##nargs arg_list; \
- ret_def_##ret; \
- if(!PyArg_ParseTuple(args, arg_str##nargs arg_list, arg_ref##nargs arg_list)) return NULL;\
- ret_set_##ret gl##funcname (arg_var##nargs arg_list);\
- ret_ret_##ret; \
-}
-
-#define BGLU_Wrap(nargs, funcname, ret, arg_list) \
-static PyObject *Method_##funcname (PyObject *self, PyObject *args) {\
- arg_def##nargs arg_list; \
- ret_def_##ret; \
- if(!PyArg_ParseTuple(args, arg_str##nargs arg_list, arg_ref##nargs arg_list)) return NULL;\
- ret_set_##ret glu##funcname (arg_var##nargs arg_list);\
- ret_ret_##ret; \
-}
-
-/* #endif */
-
-PyObject *BGL_Init( void );
-
-/********/
-static int type_size(int type)
-{
- switch (type) {
- case GL_BYTE:
- return sizeof(char);
- case GL_SHORT:
- return sizeof(short);
- case GL_INT:
- return sizeof(int);
- case GL_FLOAT:
- return sizeof(float);
- case GL_DOUBLE:
- return sizeof(double);
- }
- return -1;
-}
-
-static Buffer *make_buffer(int type, int ndimensions, int *dimensions)
-{
- Buffer *buffer;
- void *buf= NULL;
- int i, size, length;
-
- length= 1;
- for (i=0; i<ndimensions; i++)
- length*= dimensions[i];
-
- size= type_size(type);
-
- buf= MEM_mallocN(length*size, "Buffer buffer");
-
- buffer= (Buffer *) PyObject_NEW(Buffer, &buffer_Type);
- buffer->parent= NULL;
- buffer->ndimensions= ndimensions;
- buffer->dimensions= dimensions;
- buffer->type= type;
- buffer->buf.asvoid= buf;
-
- for (i= 0; i<length; i++) {
- if (type==GL_BYTE)
- buffer->buf.asbyte[i]= 0;
- else if (type==GL_SHORT)
- buffer->buf.asshort[i]= 0;
- else if (type==GL_INT)
- buffer->buf.asint[i]= 0;
- else if (type==GL_FLOAT)
- buffer->buf.asfloat[i]= 0.0f;
- else if (type==GL_DOUBLE)
- buffer->buf.asdouble[i]= 0.0;
- }
- return buffer;
-}
-
-static PyObject *Method_Buffer (PyObject *self, PyObject *args)
-{
- PyObject *length_ob= NULL, *template= NULL;
- Buffer *buffer;
-
- int i, type;
- int *dimensions = 0, ndimensions = 0;
-
- if (!PyArg_ParseTuple(args, "iO|O", &type, &length_ob, &template))
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "expected an int and one or two PyObjects");
-
- if (type!=GL_BYTE && type!=GL_SHORT && type!=GL_INT && type!=GL_FLOAT && type!=GL_DOUBLE) {
- PyErr_SetString(PyExc_AttributeError, "type");
- return NULL;
- }
-
- if (PyNumber_Check(length_ob)) {
- ndimensions= 1;
- dimensions= MEM_mallocN(ndimensions*sizeof(int), "Buffer dimensions");
- dimensions[0]= PyInt_AsLong(length_ob);
- } else if (PySequence_Check(length_ob)) {
- ndimensions= PySequence_Length(length_ob);
- dimensions= MEM_mallocN(ndimensions*sizeof(int), "Buffer dimensions");
- for (i=0; i<ndimensions; i++) {
- PyObject *ob= PySequence_GetItem(length_ob, i);
-
- if (!PyNumber_Check(ob)) dimensions[i]= 1;
- else dimensions[i]= PyInt_AsLong(ob);
- Py_DECREF(ob);
- }
- }
-
- buffer= make_buffer(type, ndimensions, dimensions);
- if (template && ndimensions) {
- if (Buffer_ass_slice((PyObject *) buffer, 0, dimensions[0], template)) {
- Py_DECREF(buffer);
- return NULL;
- }
- }
-
- return (PyObject *) buffer;
-}
-
-/*@ Buffer sequence methods */
-
-static int Buffer_len(PyObject *self)
-{
- Buffer *buf= (Buffer *) self;
- return buf->dimensions[0];
-}
-
-static PyObject *Buffer_item(PyObject *self, int i)
-{
- Buffer *buf= (Buffer *) self;
-
- if (i >= buf->dimensions[0]) {
- PyErr_SetString(PyExc_IndexError, "array index out of range");
- return NULL;
- }
-
- if (buf->ndimensions==1) {
- switch (buf->type) {
- case GL_BYTE: return Py_BuildValue("b", buf->buf.asbyte[i]);
- case GL_SHORT: return Py_BuildValue("h", buf->buf.asshort[i]);
- case GL_INT: return Py_BuildValue("i", buf->buf.asint[i]);
- case GL_FLOAT: return PyFloat_FromDouble(buf->buf.asfloat[i]);
- case GL_DOUBLE: return Py_BuildValue("d", buf->buf.asdouble[i]);
- }
- } else {
- Buffer *newbuf;
- int j, length, size;
-
- length= 1;
- for (j=1; j<buf->ndimensions; j++) {
- length*= buf->dimensions[j];
- }
- size= type_size(buf->type);
-
- newbuf= (Buffer *) PyObject_NEW(Buffer, &buffer_Type);
-
- Py_INCREF(self);
- newbuf->parent= self;
-
- newbuf->ndimensions= buf->ndimensions-1;
- newbuf->type= buf->type;
- newbuf->buf.asvoid= buf->buf.asbyte + i*length*size;
- newbuf->dimensions= MEM_mallocN(newbuf->ndimensions*sizeof(int),
- "Buffer dimensions");
- memcpy(newbuf->dimensions, buf->dimensions+1,
- newbuf->ndimensions*sizeof(int));
-
- return (PyObject *) newbuf;
- }
-
- return NULL;
-}
-
-static PyObject *Buffer_slice(PyObject *self, int begin, int end)
-{
- Buffer *buf= (Buffer *) self;
- PyObject *list;
- int count;
-
- if (begin<0) begin= 0;
- if (end>buf->dimensions[0])
- end= buf->dimensions[0];
- if (begin>end) begin= end;
-
- list= PyList_New(end-begin);
-
- for (count= begin; count<end; count++)
- PyList_SetItem(list, count-begin, Buffer_item(self, count));
-
- return list;
-}
-
-static int Buffer_ass_item(PyObject *self, int i, PyObject *v)
-{
- Buffer *buf= (Buffer *) self;
-
- if (i >= buf->dimensions[0]) {
- PyErr_SetString(PyExc_IndexError, "array assignment index out of range");
- return -1;
- }
-
- if (buf->ndimensions!=1) {
- PyObject *row= Buffer_item(self, i);
- int ret;
-
- if (!row) return -1;
- ret= Buffer_ass_slice(row, 0, buf->dimensions[1], v);
- Py_DECREF(row);
- return ret;
- }
-
- if (buf->type==GL_BYTE) {
- if (!PyArg_Parse(v, "b;Coordinates must be ints", &buf->buf.asbyte[i]))
- return -1;
- } else if (buf->type==GL_SHORT) {
- if (!PyArg_Parse(v, "h;Coordinates must be ints", &buf->buf.asshort[i]))
- return -1;
-
- } else if (buf->type==GL_INT) {
- if (!PyArg_Parse(v, "i;Coordinates must be ints", &buf->buf.asint[i]))
- return -1;
- } else if (buf->type==GL_FLOAT) {
- if (!PyArg_Parse(v, "f;Coordinates must be floats", &buf->buf.asfloat[i]))
- return -1;
- } else if (buf->type==GL_DOUBLE) {
- if (!PyArg_Parse(v, "d;Coordinates must be floats", &buf->buf.asdouble[i]))
- return -1;
- }
- return 0;
-}
-
-static int Buffer_ass_slice(PyObject *self, int begin, int end, PyObject *seq)
-{
- Buffer *buf= (Buffer *) self;
- PyObject *item;
- int count, err=0;
-
- if (begin<0) begin= 0;
- if (end>buf->dimensions[0]) end= buf->dimensions[0];
- if (begin>end) begin= end;
-
- if (!PySequence_Check(seq)) {
- PyErr_SetString(PyExc_TypeError,
- "illegal argument type for built-in operation");
- return -1;
- }
-
- if (PySequence_Length(seq)!=(end-begin)) {
- PyErr_SetString(PyExc_TypeError, "size mismatch in assignment");
- return -1;
- }
-
- for (count= begin; count<end; count++) {
- item= PySequence_GetItem(seq, count-begin);
- err= Buffer_ass_item(self, count, item);
- Py_DECREF(item);
- if (err) break;
- }
- return err;
-}
-
-static void Buffer_dealloc(PyObject *self)
-{
- Buffer *buf = (Buffer *)self;
-
- if (buf->parent) Py_DECREF (buf->parent);
- else MEM_freeN (buf->buf.asvoid);
-
- MEM_freeN (buf->dimensions);
-
- PyObject_DEL (self);
-}
-
-static PyObject *Buffer_tolist(PyObject *self)
-{
- int i, len= ((Buffer *)self)->dimensions[0];
- PyObject *list= PyList_New(len);
-
- for (i=0; i<len; i++) {
- PyList_SetItem(list, i, Buffer_item(self, i));
- }
-
- return list;
-}
-
-static PyObject *Buffer_dimensions(PyObject *self)
-{
- Buffer *buffer= (Buffer *) self;
- PyObject *list= PyList_New(buffer->ndimensions);
- int i;
-
- for (i= 0; i<buffer->ndimensions; i++) {
- PyList_SetItem(list, i, PyInt_FromLong(buffer->dimensions[i]));
- }
-
- return list;
-}
-
-static PyObject *Buffer_getattr(PyObject *self, char *name)
-{
- if (strcmp(name, "list")==0) return Buffer_tolist(self);
- else if (strcmp(name, "dimensions")==0) return Buffer_dimensions(self);
-
- PyErr_SetString(PyExc_AttributeError, name);
- return NULL;
-}
-
-static PyObject *Buffer_repr(PyObject *self)
-{
- PyObject *list= Buffer_tolist(self);
- PyObject *repr= PyObject_Repr(list);
- Py_DECREF(list);
-
- return repr;
-}
-
-
-BGL_Wrap(2, Accum, void, (GLenum, GLfloat))
-BGL_Wrap(2, AlphaFunc, void, (GLenum, GLclampf))
-BGL_Wrap(3, AreTexturesResident, GLboolean, (GLsizei, GLuintP, GLbooleanP))
-BGL_Wrap(1, Begin, void, (GLenum))
-BGL_Wrap(2, BindTexture, void, (GLenum, GLuint))
-BGL_Wrap(7, Bitmap, void, (GLsizei, GLsizei, GLfloat,
- GLfloat, GLfloat, GLfloat, GLubyteP))
-BGL_Wrap(2, BlendFunc, void, (GLenum, GLenum))
-BGL_Wrap(1, CallList, void, (GLuint))
-BGL_Wrap(3, CallLists, void, (GLsizei, GLenum, GLvoidP))
-BGL_Wrap(1, Clear, void, (GLbitfield))
-BGL_Wrap(4, ClearAccum, void, (GLfloat, GLfloat, GLfloat, GLfloat))
-BGL_Wrap(4, ClearColor, void, (GLclampf, GLclampf, GLclampf, GLclampf))
-BGL_Wrap(1, ClearDepth, void, (GLclampd))
-BGL_Wrap(1, ClearIndex, void, (GLfloat))
-BGL_Wrap(1, ClearStencil, void, (GLint))
-BGL_Wrap(2, ClipPlane, void, (GLenum, GLdoubleP))
-BGL_Wrap(3, Color3b, void, (GLbyte, GLbyte, GLbyte))
-BGL_Wrap(1, Color3bv, void, (GLbyteP))
-BGL_Wrap(3, Color3d, void, (GLdouble, GLdouble, GLdouble))
-BGL_Wrap(1, Color3dv, void, (GLdoubleP))
-BGL_Wrap(3, Color3f, void, (GLfloat, GLfloat, GLfloat))
-BGL_Wrap(1, Color3fv, void, (GLfloatP))
-BGL_Wrap(3, Color3i, void, (GLint, GLint, GLint))
-BGL_Wrap(1, Color3iv, void, (GLintP))
-BGL_Wrap(3, Color3s, void, (GLshort, GLshort, GLshort))
-BGL_Wrap(1, Color3sv, void, (GLshortP))
-BGL_Wrap(3, Color3ub, void, (GLubyte, GLubyte, GLubyte))
-BGL_Wrap(1, Color3ubv, void, (GLubyteP))
-BGL_Wrap(3, Color3ui, void, (GLuint, GLuint, GLuint))
-BGL_Wrap(1, Color3uiv, void, (GLuintP))
-BGL_Wrap(3, Color3us, void, (GLushort, GLushort, GLushort))
-BGL_Wrap(1, Color3usv, void, (GLushortP))
-BGL_Wrap(4, Color4b, void, (GLbyte, GLbyte, GLbyte, GLbyte))
-BGL_Wrap(1, Color4bv, void, (GLbyteP))
-BGL_Wrap(4, Color4d, void, (GLdouble, GLdouble, GLdouble, GLdouble))
-BGL_Wrap(1, Color4dv, void, (GLdoubleP))
-BGL_Wrap(4, Color4f, void, (GLfloat, GLfloat, GLfloat, GLfloat))
-BGL_Wrap(1, Color4fv, void, (GLfloatP))
-BGL_Wrap(4, Color4i, void, (GLint, GLint, GLint, GLint))
-BGL_Wrap(1, Color4iv, void, (GLintP))
-BGL_Wrap(4, Color4s, void, (GLshort, GLshort, GLshort, GLshort))
-BGL_Wrap(1, Color4sv, void, (GLshortP))
-BGL_Wrap(4, Color4ub, void, (GLubyte, GLubyte, GLubyte, GLubyte))
-BGL_Wrap(1, Color4ubv, void, (GLubyteP))
-BGL_Wrap(4, Color4ui, void, (GLuint, GLuint, GLuint, GLuint))
-BGL_Wrap(1, Color4uiv, void, (GLuintP))
-BGL_Wrap(4, Color4us, void, (GLushort, GLushort, GLushort, GLushort))
-BGL_Wrap(1, Color4usv, void, (GLushortP))
-BGL_Wrap(4, ColorMask, void, (GLboolean, GLboolean, GLboolean, GLboolean))
-BGL_Wrap(2, ColorMaterial, void, (GLenum, GLenum))
-BGL_Wrap(5, CopyPixels, void, (GLint, GLint, GLsizei, GLsizei, GLenum))
-BGL_Wrap(1, CullFace, void, (GLenum))
-BGL_Wrap(2, DeleteLists, void, (GLuint, GLsizei))
-BGL_Wrap(2, DeleteTextures, void, (GLsizei, GLuintP))
-BGL_Wrap(1, DepthFunc, void, (GLenum))
-BGL_Wrap(1, DepthMask, void, (GLboolean))
-BGL_Wrap(2, DepthRange, void, (GLclampd, GLclampd))
-BGL_Wrap(1, Disable, void, (GLenum))
-BGL_Wrap(1, DrawBuffer, void, (GLenum))
-BGL_Wrap(5, DrawPixels, void, (GLsizei, GLsizei, GLenum, GLenum, GLvoidP))
-BGL_Wrap(1, EdgeFlag, void, (GLboolean))
-BGL_Wrap(1, EdgeFlagv, void, (GLbooleanP))
-BGL_Wrap(1, Enable, void, (GLenum))
-BGL_Wrap(1, End, void, (void))
-BGL_Wrap(1, EndList, void, (void))
-BGL_Wrap(1, EvalCoord1d, void, (GLdouble))
-BGL_Wrap(1, EvalCoord1dv, void, (GLdoubleP))
-BGL_Wrap(1, EvalCoord1f, void, (GLfloat))
-BGL_Wrap(1, EvalCoord1fv, void, (GLfloatP))
-BGL_Wrap(2, EvalCoord2d, void, (GLdouble, GLdouble))
-BGL_Wrap(1, EvalCoord2dv, void, (GLdoubleP))
-BGL_Wrap(2, EvalCoord2f, void, (GLfloat, GLfloat))
-BGL_Wrap(1, EvalCoord2fv, void, (GLfloatP))
-BGL_Wrap(3, EvalMesh1, void, (GLenum, GLint, GLint))
-BGL_Wrap(5, EvalMesh2, void, (GLenum, GLint, GLint, GLint, GLint))
-BGL_Wrap(1, EvalPoint1, void, (GLint))
-BGL_Wrap(2, EvalPoint2, void, (GLint, GLint))
-BGL_Wrap(3, FeedbackBuffer, void, (GLsizei, GLenum, GLfloatP))
-BGL_Wrap(1, Finish, void, (void))
-BGL_Wrap(1, Flush, void, (void))
-BGL_Wrap(2, Fogf, void, (GLenum, GLfloat))
-BGL_Wrap(2, Fogfv, void, (GLenum, GLfloatP))
-BGL_Wrap(2, Fogi, void, (GLenum, GLint))
-BGL_Wrap(2, Fogiv, void, (GLenum, GLintP))
-BGL_Wrap(1, FrontFace, void, (GLenum))
-BGL_Wrap(6, Frustum, void, (GLdouble, GLdouble,
- GLdouble, GLdouble, GLdouble, GLdouble))
-BGL_Wrap(1, GenLists, GLuint, (GLsizei))
-BGL_Wrap(2, GenTextures, void, (GLsizei, GLuintP))
-BGL_Wrap(2, GetBooleanv, void, (GLenum, GLbooleanP))
-BGL_Wrap(2, GetClipPlane, void, (GLenum, GLdoubleP))
-BGL_Wrap(2, GetDoublev, void, (GLenum, GLdoubleP))
-BGL_Wrap(1, GetError, GLenum, (void))
-BGL_Wrap(2, GetFloatv, void, (GLenum, GLfloatP))
-BGL_Wrap(2, GetIntegerv, void, (GLenum, GLintP))
-BGL_Wrap(3, GetLightfv, void, (GLenum, GLenum, GLfloatP))
-BGL_Wrap(3, GetLightiv, void, (GLenum, GLenum, GLintP))
-BGL_Wrap(3, GetMapdv, void, (GLenum, GLenum, GLdoubleP))
-BGL_Wrap(3, GetMapfv, void, (GLenum, GLenum, GLfloatP))
-BGL_Wrap(3, GetMapiv, void, (GLenum, GLenum, GLintP))
-BGL_Wrap(3, GetMaterialfv, void, (GLenum, GLenum, GLfloatP))
-BGL_Wrap(3, GetMaterialiv, void, (GLenum, GLenum, GLintP))
-BGL_Wrap(2, GetPixelMapfv, void, (GLenum, GLfloatP))
-BGL_Wrap(2, GetPixelMapuiv, void, (GLenum, GLuintP))
-BGL_Wrap(2, GetPixelMapusv, void, (GLenum, GLushortP))
-BGL_Wrap(1, GetPolygonStipple,void, (GLubyteP))
-BGL_Wrap(1, GetString, GLstring, (GLenum))
-BGL_Wrap(3, GetTexEnvfv, void, (GLenum, GLenum, GLfloatP))
-BGL_Wrap(3, GetTexEnviv, void, (GLenum, GLenum, GLintP))
-BGL_Wrap(3, GetTexGendv, void, (GLenum, GLenum, GLdoubleP))
-BGL_Wrap(3, GetTexGenfv, void, (GLenum, GLenum, GLfloatP))
-BGL_Wrap(3, GetTexGeniv, void, (GLenum, GLenum, GLintP))
-BGL_Wrap(5, GetTexImage, void, (GLenum, GLint, GLenum, GLenum, GLvoidP))
-BGL_Wrap(4, GetTexLevelParameterfv, void, (GLenum, GLint, GLenum, GLfloatP))
-BGL_Wrap(4, GetTexLevelParameteriv, void, (GLenum, GLint, GLenum, GLintP))
-BGL_Wrap(3, GetTexParameterfv, void, (GLenum, GLenum, GLfloatP))
-BGL_Wrap(3, GetTexParameteriv, void, (GLenum, GLenum, GLintP))
-BGL_Wrap(2, Hint, void, (GLenum, GLenum))
-BGL_Wrap(1, IndexMask, void, (GLuint))
-BGL_Wrap(1, Indexd, void, (GLdouble))
-BGL_Wrap(1, Indexdv, void, (GLdoubleP))
-BGL_Wrap(1, Indexf, void, (GLfloat))
-BGL_Wrap(1, Indexfv, void, (GLfloatP))
-BGL_Wrap(1, Indexi, void, (GLint))
-BGL_Wrap(1, Indexiv, void, (GLintP))
-BGL_Wrap(1, Indexs, void, (GLshort))
-BGL_Wrap(1, Indexsv, void, (GLshortP))
-BGL_Wrap(1, InitNames, void, (void))
-BGL_Wrap(1, IsEnabled, GLboolean, (GLenum))
-BGL_Wrap(1, IsList, GLboolean, (GLuint))
-BGL_Wrap(1, IsTexture, GLboolean, (GLuint))
-BGL_Wrap(2, LightModelf, void, (GLenum, GLfloat))
-BGL_Wrap(2, LightModelfv, void, (GLenum, GLfloatP))
-BGL_Wrap(2, LightModeli, void, (GLenum, GLint))
-BGL_Wrap(2, LightModeliv, void, (GLenum, GLintP))
-BGL_Wrap(3, Lightf, void, (GLenum, GLenum, GLfloat))
-BGL_Wrap(3, Lightfv, void, (GLenum, GLenum, GLfloatP))
-BGL_Wrap(3, Lighti, void, (GLenum, GLenum, GLint))
-BGL_Wrap(3, Lightiv, void, (GLenum, GLenum, GLintP))
-BGL_Wrap(2, LineStipple, void, (GLint, GLushort))
-BGL_Wrap(1, LineWidth, void, (GLfloat))
-BGL_Wrap(1, ListBase, void, (GLuint))
-BGL_Wrap(1, LoadIdentity, void, (void))
-BGL_Wrap(1, LoadMatrixd, void, (GLdoubleP))
-BGL_Wrap(1, LoadMatrixf, void, (GLfloatP))
-BGL_Wrap(1, LoadName, void, (GLuint))
-BGL_Wrap(1, LogicOp, void, (GLenum))
-BGL_Wrap(6, Map1d, void, (GLenum, GLdouble, GLdouble,
- GLint, GLint, GLdoubleP))
-BGL_Wrap(6, Map1f, void, (GLenum, GLfloat, GLfloat,
- GLint, GLint, GLfloatP))
-BGL_Wrap(10, Map2d, void, (GLenum, GLdouble, GLdouble,
- GLint, GLint, GLdouble, GLdouble, GLint, GLint, GLdoubleP))
-BGL_Wrap(10, Map2f, void, (GLenum, GLfloat, GLfloat,
- GLint, GLint, GLfloat, GLfloat, GLint, GLint, GLfloatP))
-BGL_Wrap(3, MapGrid1d, void, (GLint, GLdouble, GLdouble))
-BGL_Wrap(3, MapGrid1f, void, (GLint, GLfloat, GLfloat))
-BGL_Wrap(6, MapGrid2d, void, (GLint, GLdouble, GLdouble,
- GLint, GLdouble, GLdouble))
-BGL_Wrap(6, MapGrid2f, void, (GLint, GLfloat, GLfloat,
- GLint, GLfloat, GLfloat))
-BGL_Wrap(3, Materialf, void, (GLenum, GLenum, GLfloat))
-BGL_Wrap(3, Materialfv, void, (GLenum, GLenum, GLfloatP))
-BGL_Wrap(3, Materiali, void, (GLenum, GLenum, GLint))
-BGL_Wrap(3, Materialiv, void, (GLenum, GLenum, GLintP))
-BGL_Wrap(1, MatrixMode, void, (GLenum))
-BGL_Wrap(1, MultMatrixd, void, (GLdoubleP))
-BGL_Wrap(1, MultMatrixf, void, (GLfloatP))
-BGL_Wrap(2, NewList, void, (GLuint, GLenum))
-BGL_Wrap(3, Normal3b, void, (GLbyte, GLbyte, GLbyte))
-BGL_Wrap(1, Normal3bv, void, (GLbyteP))
-BGL_Wrap(3, Normal3d, void, (GLdouble, GLdouble, GLdouble))
-BGL_Wrap(1, Normal3dv, void, (GLdoubleP))
-BGL_Wrap(3, Normal3f, void, (GLfloat, GLfloat, GLfloat))
-BGL_Wrap(1, Normal3fv, void, (GLfloatP))
-BGL_Wrap(3, Normal3i, void, (GLint, GLint, GLint))
-BGL_Wrap(1, Normal3iv, void, (GLintP))
-BGL_Wrap(3, Normal3s, void, (GLshort, GLshort, GLshort))
-BGL_Wrap(1, Normal3sv, void, (GLshortP))
-BGL_Wrap(6, Ortho, void, (GLdouble, GLdouble,
- GLdouble, GLdouble, GLdouble, GLdouble))
-BGL_Wrap(1, PassThrough, void, (GLfloat))
-BGL_Wrap(3, PixelMapfv, void, (GLenum, GLint, GLfloatP))
-BGL_Wrap(3, PixelMapuiv, void, (GLenum, GLint, GLuintP))
-BGL_Wrap(3, PixelMapusv, void, (GLenum, GLint, GLushortP))
-BGL_Wrap(2, PixelStoref, void, (GLenum, GLfloat))
-BGL_Wrap(2, PixelStorei, void, (GLenum, GLint))
-BGL_Wrap(2, PixelTransferf, void, (GLenum, GLfloat))
-BGL_Wrap(2, PixelTransferi, void, (GLenum, GLint))
-BGL_Wrap(2, PixelZoom, void, (GLfloat, GLfloat))
-BGL_Wrap(1, PointSize, void, (GLfloat))
-BGL_Wrap(2, PolygonMode, void, (GLenum, GLenum))
-BGL_Wrap(2, PolygonOffset, void, (GLfloat, GLfloat))
-BGL_Wrap(1, PolygonStipple, void, (GLubyteP))
-BGL_Wrap(1, PopAttrib, void, (void))
-BGL_Wrap(1, PopClientAttrib, void, (void))
-BGL_Wrap(1, PopMatrix, void, (void))
-BGL_Wrap(1, PopName, void, (void))
-BGL_Wrap(3, PrioritizeTextures, void, (GLsizei, GLuintP, GLclampfP))
-BGL_Wrap(1, PushAttrib, void, (GLbitfield))
-BGL_Wrap(1, PushClientAttrib, void, (GLbitfield))
-BGL_Wrap(1, PushMatrix, void, (void))
-BGL_Wrap(1, PushName, void, (GLuint))
-BGL_Wrap(2, RasterPos2d, void, (GLdouble, GLdouble))
-BGL_Wrap(1, RasterPos2dv, void, (GLdoubleP))
-BGL_Wrap(2, RasterPos2f, void, (GLfloat, GLfloat))
-BGL_Wrap(1, RasterPos2fv, void, (GLfloatP))
-BGL_Wrap(2, RasterPos2i, void, (GLint, GLint))
-BGL_Wrap(1, RasterPos2iv, void, (GLintP))
-BGL_Wrap(2, RasterPos2s, void, (GLshort, GLshort))
-BGL_Wrap(1, RasterPos2sv, void, (GLshortP))
-BGL_Wrap(3, RasterPos3d, void, (GLdouble, GLdouble, GLdouble))
-BGL_Wrap(1, RasterPos3dv, void, (GLdoubleP))
-BGL_Wrap(3, RasterPos3f, void, (GLfloat, GLfloat, GLfloat))
-BGL_Wrap(1, RasterPos3fv, void, (GLfloatP))
-BGL_Wrap(3, RasterPos3i, void, (GLint, GLint, GLint))
-BGL_Wrap(1, RasterPos3iv, void, (GLintP))
-BGL_Wrap(3, RasterPos3s, void, (GLshort, GLshort, GLshort))
-BGL_Wrap(1, RasterPos3sv, void, (GLshortP))
-BGL_Wrap(4, RasterPos4d, void, (GLdouble, GLdouble, GLdouble, GLdouble))
-BGL_Wrap(1, RasterPos4dv, void, (GLdoubleP))
-BGL_Wrap(4, RasterPos4f, void, (GLfloat, GLfloat, GLfloat, GLfloat))
-BGL_Wrap(1, RasterPos4fv, void, (GLfloatP))
-BGL_Wrap(4, RasterPos4i, void, (GLint, GLint, GLint, GLint))
-BGL_Wrap(1, RasterPos4iv, void, (GLintP))
-BGL_Wrap(4, RasterPos4s, void, (GLshort, GLshort, GLshort, GLshort))
-BGL_Wrap(1, RasterPos4sv, void, (GLshortP))
-BGL_Wrap(1, ReadBuffer, void, (GLenum))
-BGL_Wrap(7, ReadPixels, void, (GLint, GLint, GLsizei,
- GLsizei, GLenum, GLenum, GLvoidP))
-BGL_Wrap(4, Rectd, void, (GLdouble, GLdouble, GLdouble, GLdouble))
-BGL_Wrap(2, Rectdv, void, (GLdoubleP, GLdoubleP))
-BGL_Wrap(4, Rectf, void, (GLfloat, GLfloat, GLfloat, GLfloat))
-BGL_Wrap(2, Rectfv, void, (GLfloatP, GLfloatP))
-BGL_Wrap(4, Recti, void, (GLint, GLint, GLint, GLint))
-BGL_Wrap(2, Rectiv, void, (GLintP, GLintP))
-BGL_Wrap(4, Rects, void, (GLshort, GLshort, GLshort, GLshort))
-BGL_Wrap(2, Rectsv, void, (GLshortP, GLshortP))
-BGL_Wrap(1, RenderMode, GLint, (GLenum))
-BGL_Wrap(4, Rotated, void, (GLdouble, GLdouble, GLdouble, GLdouble))
-BGL_Wrap(4, Rotatef, void, (GLfloat, GLfloat, GLfloat, GLfloat))
-BGL_Wrap(3, Scaled, void, (GLdouble, GLdouble, GLdouble))
-BGL_Wrap(3, Scalef, void, (GLfloat, GLfloat, GLfloat))
-BGL_Wrap(4, Scissor, void, (GLint, GLint, GLsizei, GLsizei))
-BGL_Wrap(2, SelectBuffer, void, (GLsizei, GLuintP))
-BGL_Wrap(1, ShadeModel, void, (GLenum))
-BGL_Wrap(3, StencilFunc, void, (GLenum, GLint, GLuint))
-BGL_Wrap(1, StencilMask, void, (GLuint))
-BGL_Wrap(3, StencilOp, void, (GLenum, GLenum, GLenum))
-BGL_Wrap(1, TexCoord1d, void, (GLdouble))
-BGL_Wrap(1, TexCoord1dv, void, (GLdoubleP))
-BGL_Wrap(1, TexCoord1f, void, (GLfloat))
-BGL_Wrap(1, TexCoord1fv, void, (GLfloatP))
-BGL_Wrap(1, TexCoord1i, void, (GLint))
-BGL_Wrap(1, TexCoord1iv, void, (GLintP))
-BGL_Wrap(1, TexCoord1s, void, (GLshort))
-BGL_Wrap(1, TexCoord1sv, void, (GLshortP))
-BGL_Wrap(2, TexCoord2d, void, (GLdouble, GLdouble))
-BGL_Wrap(1, TexCoord2dv, void, (GLdoubleP))
-BGL_Wrap(2, TexCoord2f, void, (GLfloat, GLfloat))
-BGL_Wrap(1, TexCoord2fv, void, (GLfloatP))
-BGL_Wrap(2, TexCoord2i, void, (GLint, GLint))
-BGL_Wrap(1, TexCoord2iv, void, (GLintP))
-BGL_Wrap(2, TexCoord2s, void, (GLshort, GLshort))
-BGL_Wrap(1, TexCoord2sv, void, (GLshortP))
-BGL_Wrap(3, TexCoord3d, void, (GLdouble, GLdouble, GLdouble))
-BGL_Wrap(1, TexCoord3dv, void, (GLdoubleP))
-BGL_Wrap(3, TexCoord3f, void, (GLfloat, GLfloat, GLfloat))
-BGL_Wrap(1, TexCoord3fv, void, (GLfloatP))
-BGL_Wrap(3, TexCoord3i, void, (GLint, GLint, GLint))
-BGL_Wrap(1, TexCoord3iv, void, (GLintP))
-BGL_Wrap(3, TexCoord3s, void, (GLshort, GLshort, GLshort))
-BGL_Wrap(1, TexCoord3sv, void, (GLshortP))
-BGL_Wrap(4, TexCoord4d, void, (GLdouble, GLdouble, GLdouble, GLdouble))
-BGL_Wrap(1, TexCoord4dv, void, (GLdoubleP))
-BGL_Wrap(4, TexCoord4f, void, (GLfloat, GLfloat, GLfloat, GLfloat))
-BGL_Wrap(1, TexCoord4fv, void, (GLfloatP))
-BGL_Wrap(4, TexCoord4i, void, (GLint, GLint, GLint, GLint))
-BGL_Wrap(1, TexCoord4iv, void, (GLintP))
-BGL_Wrap(4, TexCoord4s, void, (GLshort, GLshort, GLshort, GLshort))
-BGL_Wrap(1, TexCoord4sv, void, (GLshortP))
-BGL_Wrap(3, TexEnvf, void, (GLenum, GLenum, GLfloat))
-BGL_Wrap(3, TexEnvfv, void, (GLenum, GLenum, GLfloatP))
-BGL_Wrap(3, TexEnvi, void, (GLenum, GLenum, GLint))
-BGL_Wrap(3, TexEnviv, void, (GLenum, GLenum, GLintP))
-BGL_Wrap(3, TexGend, void, (GLenum, GLenum, GLdouble))
-BGL_Wrap(3, TexGendv, void, (GLenum, GLenum, GLdoubleP))
-BGL_Wrap(3, TexGenf, void, (GLenum, GLenum, GLfloat))
-BGL_Wrap(3, TexGenfv, void, (GLenum, GLenum, GLfloatP))
-BGL_Wrap(3, TexGeni, void, (GLenum, GLenum, GLint))
-BGL_Wrap(3, TexGeniv, void, (GLenum, GLenum, GLintP))
-BGL_Wrap(8, TexImage1D, void, (GLenum, GLint, GLint,
- GLsizei, GLint, GLenum, GLenum, GLvoidP))
-BGL_Wrap(9, TexImage2D, void, (GLenum, GLint, GLint,
- GLsizei, GLsizei, GLint, GLenum, GLenum, GLvoidP))
-BGL_Wrap(3, TexParameterf, void, (GLenum, GLenum, GLfloat))
-BGL_Wrap(3, TexParameterfv, void, (GLenum, GLenum, GLfloatP))
-BGL_Wrap(3, TexParameteri, void, (GLenum, GLenum, GLint))
-BGL_Wrap(3, TexParameteriv, void, (GLenum, GLenum, GLintP))
-BGL_Wrap(3, Translated, void, (GLdouble, GLdouble, GLdouble))
-BGL_Wrap(3, Translatef, void, (GLfloat, GLfloat, GLfloat))
-BGL_Wrap(2, Vertex2d, void, (GLdouble, GLdouble))
-BGL_Wrap(1, Vertex2dv, void, (GLdoubleP))
-BGL_Wrap(2, Vertex2f, void, (GLfloat, GLfloat))
-BGL_Wrap(1, Vertex2fv, void, (GLfloatP))
-BGL_Wrap(2, Vertex2i, void, (GLint, GLint))
-BGL_Wrap(1, Vertex2iv, void, (GLintP))
-BGL_Wrap(2, Vertex2s, void, (GLshort, GLshort))
-BGL_Wrap(1, Vertex2sv, void, (GLshortP))
-BGL_Wrap(3, Vertex3d, void, (GLdouble, GLdouble, GLdouble))
-BGL_Wrap(1, Vertex3dv, void, (GLdoubleP))
-BGL_Wrap(3, Vertex3f, void, (GLfloat, GLfloat, GLfloat))
-BGL_Wrap(1, Vertex3fv, void, (GLfloatP))
-BGL_Wrap(3, Vertex3i, void, (GLint, GLint, GLint))
-BGL_Wrap(1, Vertex3iv, void, (GLintP))
-BGL_Wrap(3, Vertex3s, void, (GLshort, GLshort, GLshort))
-BGL_Wrap(1, Vertex3sv, void, (GLshortP))
-BGL_Wrap(4, Vertex4d, void, (GLdouble, GLdouble, GLdouble, GLdouble))
-BGL_Wrap(1, Vertex4dv, void, (GLdoubleP))
-BGL_Wrap(4, Vertex4f, void, (GLfloat, GLfloat, GLfloat, GLfloat))
-BGL_Wrap(1, Vertex4fv, void, (GLfloatP))
-BGL_Wrap(4, Vertex4i, void, (GLint, GLint, GLint, GLint))
-BGL_Wrap(1, Vertex4iv, void, (GLintP))
-BGL_Wrap(4, Vertex4s, void, (GLshort, GLshort, GLshort, GLshort))
-BGL_Wrap(1, Vertex4sv, void, (GLshortP))
-BGL_Wrap(4, Viewport, void, (GLint, GLint, GLsizei, GLsizei))
-BGLU_Wrap(4, Perspective, void, (GLdouble, GLdouble, GLdouble, GLdouble))
-BGLU_Wrap(9, LookAt, void, (GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble))
-BGLU_Wrap(4, Ortho2D, void, (GLdouble, GLdouble, GLdouble, GLdouble))
-BGLU_Wrap(5, PickMatrix, void, (GLdouble, GLdouble, GLdouble, GLdouble, GLintP))
-BGLU_Wrap(9, Project, GLint, (GLdouble, GLdouble, GLdouble, GLdoubleP, GLdoubleP, GLintP, GLdoubleP, GLdoubleP, GLdoubleP))
-BGLU_Wrap(9, UnProject, GLint, (GLdouble, GLdouble, GLdouble, GLdoubleP, GLdoubleP, GLintP, GLdoubleP, GLdoubleP, GLdoubleP))
-
-#undef MethodDef
-#define MethodDef(func) {"gl"#func, Method_##func, METH_VARARGS, "no string"}
-#define MethodDefu(func) {"glu"#func, Method_##func, METH_VARARGS, "no string"}
-/* So that MethodDef(Accum) becomes:
- * {"glAccum", Method_Accumfunc, METH_VARARGS} */
-
-static struct PyMethodDef BGL_methods[] = {
- {"Buffer", Method_Buffer, METH_VARARGS, Method_Buffer_doc},
-
-/* #ifndef __APPLE__ */
- MethodDef(Accum),
- MethodDef(AlphaFunc),
- MethodDef(AreTexturesResident),
- MethodDef(Begin),
- MethodDef(BindTexture),
- MethodDef(Bitmap),
- MethodDef(BlendFunc),
- MethodDef(CallList),
- MethodDef(CallLists),
- MethodDef(Clear),
- MethodDef(ClearAccum),
- MethodDef(ClearColor),
- MethodDef(ClearDepth),
- MethodDef(ClearIndex),
- MethodDef(ClearStencil),
- MethodDef(ClipPlane),
- MethodDef(Color3b),
- MethodDef(Color3bv),
- MethodDef(Color3d),
- MethodDef(Color3dv),
- MethodDef(Color3f),
- MethodDef(Color3fv),
- MethodDef(Color3i),
- MethodDef(Color3iv),
- MethodDef(Color3s),
- MethodDef(Color3sv),
- MethodDef(Color3ub),
- MethodDef(Color3ubv),
- MethodDef(Color3ui),
- MethodDef(Color3uiv),
- MethodDef(Color3us),
- MethodDef(Color3usv),
- MethodDef(Color4b),
- MethodDef(Color4bv),
- MethodDef(Color4d),
- MethodDef(Color4dv),
- MethodDef(Color4f),
- MethodDef(Color4fv),
- MethodDef(Color4i),
- MethodDef(Color4iv),
- MethodDef(Color4s),
- MethodDef(Color4sv),
- MethodDef(Color4ub),
- MethodDef(Color4ubv),
- MethodDef(Color4ui),
- MethodDef(Color4uiv),
- MethodDef(Color4us),
- MethodDef(Color4usv),
- MethodDef(ColorMask),
- MethodDef(ColorMaterial),
- MethodDef(CopyPixels),
- MethodDef(CullFace),
- MethodDef(DeleteLists),
- MethodDef(DeleteTextures),
- MethodDef(DepthFunc),
- MethodDef(DepthMask),
- MethodDef(DepthRange),
- MethodDef(Disable),
- MethodDef(DrawBuffer),
- MethodDef(DrawPixels),
- MethodDef(EdgeFlag),
- MethodDef(EdgeFlagv),
- MethodDef(Enable),
- MethodDef(End),
- MethodDef(EndList),
- MethodDef(EvalCoord1d),
- MethodDef(EvalCoord1dv),
- MethodDef(EvalCoord1f),
- MethodDef(EvalCoord1fv),
- MethodDef(EvalCoord2d),
- MethodDef(EvalCoord2dv),
- MethodDef(EvalCoord2f),
- MethodDef(EvalCoord2fv),
- MethodDef(EvalMesh1),
- MethodDef(EvalMesh2),
- MethodDef(EvalPoint1),
- MethodDef(EvalPoint2),
- MethodDef(FeedbackBuffer),
- MethodDef(Finish),
- MethodDef(Flush),
- MethodDef(Fogf),
- MethodDef(Fogfv),
- MethodDef(Fogi),
- MethodDef(Fogiv),
- MethodDef(FrontFace),
- MethodDef(Frustum),
- MethodDef(GenLists),
- MethodDef(GenTextures),
- MethodDef(GetBooleanv),
- MethodDef(GetClipPlane),
- MethodDef(GetDoublev),
- MethodDef(GetError),
- MethodDef(GetFloatv),
- MethodDef(GetIntegerv),
- MethodDef(GetLightfv),
- MethodDef(GetLightiv),
- MethodDef(GetMapdv),
- MethodDef(GetMapfv),
- MethodDef(GetMapiv),
- MethodDef(GetMaterialfv),
- MethodDef(GetMaterialiv),
- MethodDef(GetPixelMapfv),
- MethodDef(GetPixelMapuiv),
- MethodDef(GetPixelMapusv),
- MethodDef(GetPolygonStipple),
- MethodDef(GetString),
- MethodDef(GetTexEnvfv),
- MethodDef(GetTexEnviv),
- MethodDef(GetTexGendv),
- MethodDef(GetTexGenfv),
- MethodDef(GetTexGeniv),
- MethodDef(GetTexImage),
- MethodDef(GetTexLevelParameterfv),
- MethodDef(GetTexLevelParameteriv),
- MethodDef(GetTexParameterfv),
- MethodDef(GetTexParameteriv),
- MethodDef(Hint),
- MethodDef(IndexMask),
- MethodDef(Indexd),
- MethodDef(Indexdv),
- MethodDef(Indexf),
- MethodDef(Indexfv),
- MethodDef(Indexi),
- MethodDef(Indexiv),
- MethodDef(Indexs),
- MethodDef(Indexsv),
- MethodDef(InitNames),
- MethodDef(IsEnabled),
- MethodDef(IsList),
- MethodDef(IsTexture),
- MethodDef(LightModelf),
- MethodDef(LightModelfv),
- MethodDef(LightModeli),
- MethodDef(LightModeliv),
- MethodDef(Lightf),
- MethodDef(Lightfv),
- MethodDef(Lighti),
- MethodDef(Lightiv),
- MethodDef(LineStipple),
- MethodDef(LineWidth),
- MethodDef(ListBase),
- MethodDef(LoadIdentity),
- MethodDef(LoadMatrixd),
- MethodDef(LoadMatrixf),
- MethodDef(LoadName),
- MethodDef(LogicOp),
- MethodDef(Map1d),
- MethodDef(Map1f),
- MethodDef(Map2d),
- MethodDef(Map2f),
- MethodDef(MapGrid1d),
- MethodDef(MapGrid1f),
- MethodDef(MapGrid2d),
- MethodDef(MapGrid2f),
- MethodDef(Materialf),
- MethodDef(Materialfv),
- MethodDef(Materiali),
- MethodDef(Materialiv),
- MethodDef(MatrixMode),
- MethodDef(MultMatrixd),
- MethodDef(MultMatrixf),
- MethodDef(NewList),
- MethodDef(Normal3b),
- MethodDef(Normal3bv),
- MethodDef(Normal3d),
- MethodDef(Normal3dv),
- MethodDef(Normal3f),
- MethodDef(Normal3fv),
- MethodDef(Normal3i),
- MethodDef(Normal3iv),
- MethodDef(Normal3s),
- MethodDef(Normal3sv),
- MethodDef(Ortho),
- MethodDef(PassThrough),
- MethodDef(PixelMapfv),
- MethodDef(PixelMapuiv),
- MethodDef(PixelMapusv),
- MethodDef(PixelStoref),
- MethodDef(PixelStorei),
- MethodDef(PixelTransferf),
- MethodDef(PixelTransferi),
- MethodDef(PixelZoom),
- MethodDef(PointSize),
- MethodDef(PolygonMode),
- MethodDef(PolygonOffset),
- MethodDef(PolygonStipple),
- MethodDef(PopAttrib),
- MethodDef(PopClientAttrib),
- MethodDef(PopMatrix),
- MethodDef(PopName),
- MethodDef(PrioritizeTextures),
- MethodDef(PushAttrib),
- MethodDef(PushClientAttrib),
- MethodDef(PushMatrix),
- MethodDef(PushName),
- MethodDef(RasterPos2d),
- MethodDef(RasterPos2dv),
- MethodDef(RasterPos2f),
- MethodDef(RasterPos2fv),
- MethodDef(RasterPos2i),
- MethodDef(RasterPos2iv),
- MethodDef(RasterPos2s),
- MethodDef(RasterPos2sv),
- MethodDef(RasterPos3d),
- MethodDef(RasterPos3dv),
- MethodDef(RasterPos3f),
- MethodDef(RasterPos3fv),
- MethodDef(RasterPos3i),
- MethodDef(RasterPos3iv),
- MethodDef(RasterPos3s),
- MethodDef(RasterPos3sv),
- MethodDef(RasterPos4d),
- MethodDef(RasterPos4dv),
- MethodDef(RasterPos4f),
- MethodDef(RasterPos4fv),
- MethodDef(RasterPos4i),
- MethodDef(RasterPos4iv),
- MethodDef(RasterPos4s),
- MethodDef(RasterPos4sv),
- MethodDef(ReadBuffer),
- MethodDef(ReadPixels),
- MethodDef(Rectd),
- MethodDef(Rectdv),
- MethodDef(Rectf),
- MethodDef(Rectfv),
- MethodDef(Recti),
- MethodDef(Rectiv),
- MethodDef(Rects),
- MethodDef(Rectsv),
- MethodDef(RenderMode),
- MethodDef(Rotated),
- MethodDef(Rotatef),
- MethodDef(Scaled),
- MethodDef(Scalef),
- MethodDef(Scissor),
- MethodDef(SelectBuffer),
- MethodDef(ShadeModel),
- MethodDef(StencilFunc),
- MethodDef(StencilMask),
- MethodDef(StencilOp),
- MethodDef(TexCoord1d),
- MethodDef(TexCoord1dv),
- MethodDef(TexCoord1f),
- MethodDef(TexCoord1fv),
- MethodDef(TexCoord1i),
- MethodDef(TexCoord1iv),
- MethodDef(TexCoord1s),
- MethodDef(TexCoord1sv),
- MethodDef(TexCoord2d),
- MethodDef(TexCoord2dv),
- MethodDef(TexCoord2f),
- MethodDef(TexCoord2fv),
- MethodDef(TexCoord2i),
- MethodDef(TexCoord2iv),
- MethodDef(TexCoord2s),
- MethodDef(TexCoord2sv),
- MethodDef(TexCoord3d),
- MethodDef(TexCoord3dv),
- MethodDef(TexCoord3f),
- MethodDef(TexCoord3fv),
- MethodDef(TexCoord3i),
- MethodDef(TexCoord3iv),
- MethodDef(TexCoord3s),
- MethodDef(TexCoord3sv),
- MethodDef(TexCoord4d),
- MethodDef(TexCoord4dv),
- MethodDef(TexCoord4f),
- MethodDef(TexCoord4fv),
- MethodDef(TexCoord4i),
- MethodDef(TexCoord4iv),
- MethodDef(TexCoord4s),
- MethodDef(TexCoord4sv),
- MethodDef(TexEnvf),
- MethodDef(TexEnvfv),
- MethodDef(TexEnvi),
- MethodDef(TexEnviv),
- MethodDef(TexGend),
- MethodDef(TexGendv),
- MethodDef(TexGenf),
- MethodDef(TexGenfv),
- MethodDef(TexGeni),
- MethodDef(TexGeniv),
- MethodDef(TexImage1D),
- MethodDef(TexImage2D),
- MethodDef(TexParameterf),
- MethodDef(TexParameterfv),
- MethodDef(TexParameteri),
- MethodDef(TexParameteriv),
- MethodDef(Translated),
- MethodDef(Translatef),
- MethodDef(Vertex2d),
- MethodDef(Vertex2dv),
- MethodDef(Vertex2f),
- MethodDef(Vertex2fv),
- MethodDef(Vertex2i),
- MethodDef(Vertex2iv),
- MethodDef(Vertex2s),
- MethodDef(Vertex2sv),
- MethodDef(Vertex3d),
- MethodDef(Vertex3dv),
- MethodDef(Vertex3f),
- MethodDef(Vertex3fv),
- MethodDef(Vertex3i),
- MethodDef(Vertex3iv),
- MethodDef(Vertex3s),
- MethodDef(Vertex3sv),
- MethodDef(Vertex4d),
- MethodDef(Vertex4dv),
- MethodDef(Vertex4f),
- MethodDef(Vertex4fv),
- MethodDef(Vertex4i),
- MethodDef(Vertex4iv),
- MethodDef(Vertex4s),
- MethodDef(Vertex4sv),
- MethodDef(Viewport),
- MethodDefu(Perspective),
- MethodDefu(LookAt),
- MethodDefu(Ortho2D),
- MethodDefu(PickMatrix),
- MethodDefu(Project),
- MethodDefu(UnProject),
-/* #endif */
- {NULL, NULL, 0, NULL}
-};
-
-PyObject *BGL_Init(void)
-{
- PyObject *mod= Py_InitModule("Blender.BGL", BGL_methods);
- PyObject *dict= PyModule_GetDict(mod);
-
- if( PyType_Ready( &buffer_Type) < 0)
- Py_RETURN_NONE;
-
-#define EXPP_ADDCONST(x) EXPP_dict_set_item_str(dict, #x, PyInt_FromLong(x))
-
-/* So, for example:
- * EXPP_ADDCONST(GL_CURRENT_BIT) becomes
- * EXPP_dict_set_item_str(dict, "GL_CURRENT_BIT", PyInt_FromLong(GL_CURRENT_BIT)) */
-
- EXPP_ADDCONST(GL_CURRENT_BIT);
- EXPP_ADDCONST(GL_POINT_BIT);
- EXPP_ADDCONST(GL_LINE_BIT);
- EXPP_ADDCONST(GL_POLYGON_BIT);
- EXPP_ADDCONST(GL_POLYGON_STIPPLE_BIT);
- EXPP_ADDCONST(GL_PIXEL_MODE_BIT);
- EXPP_ADDCONST(GL_LIGHTING_BIT);
- EXPP_ADDCONST(GL_FOG_BIT);
- EXPP_ADDCONST(GL_DEPTH_BUFFER_BIT);
- EXPP_ADDCONST(GL_ACCUM_BUFFER_BIT);
- EXPP_ADDCONST(GL_STENCIL_BUFFER_BIT);
- EXPP_ADDCONST(GL_VIEWPORT_BIT);
- EXPP_ADDCONST(GL_TRANSFORM_BIT);
- EXPP_ADDCONST(GL_ENABLE_BIT);
- EXPP_ADDCONST(GL_COLOR_BUFFER_BIT);
- EXPP_ADDCONST(GL_HINT_BIT);
- EXPP_ADDCONST(GL_EVAL_BIT);
- EXPP_ADDCONST(GL_LIST_BIT);
- EXPP_ADDCONST(GL_TEXTURE_BIT);
- EXPP_ADDCONST(GL_SCISSOR_BIT);
- EXPP_ADDCONST(GL_ALL_ATTRIB_BITS);
-
- EXPP_ADDCONST(GL_FALSE);
- EXPP_ADDCONST(GL_TRUE);
-
- EXPP_ADDCONST(GL_POINTS);
- EXPP_ADDCONST(GL_LINES);
- EXPP_ADDCONST(GL_LINE_LOOP);
- EXPP_ADDCONST(GL_LINE_STRIP);
- EXPP_ADDCONST(GL_TRIANGLES);
- EXPP_ADDCONST(GL_TRIANGLE_STRIP);
- EXPP_ADDCONST(GL_TRIANGLE_FAN);
- EXPP_ADDCONST(GL_QUADS);
- EXPP_ADDCONST(GL_QUAD_STRIP);
- EXPP_ADDCONST(GL_POLYGON);
-
- EXPP_ADDCONST(GL_ACCUM);
- EXPP_ADDCONST(GL_LOAD);
- EXPP_ADDCONST(GL_RETURN);
- EXPP_ADDCONST(GL_MULT);
- EXPP_ADDCONST(GL_ADD);
-
- EXPP_ADDCONST(GL_NEVER);
- EXPP_ADDCONST(GL_LESS);
- EXPP_ADDCONST(GL_EQUAL);
- EXPP_ADDCONST(GL_LEQUAL);
- EXPP_ADDCONST(GL_GREATER);
- EXPP_ADDCONST(GL_NOTEQUAL);
- EXPP_ADDCONST(GL_GEQUAL);
- EXPP_ADDCONST(GL_ALWAYS);
-
- EXPP_ADDCONST(GL_ZERO);
- EXPP_ADDCONST(GL_ONE);
- EXPP_ADDCONST(GL_SRC_COLOR);
- EXPP_ADDCONST(GL_ONE_MINUS_SRC_COLOR);
- EXPP_ADDCONST(GL_SRC_ALPHA);
- EXPP_ADDCONST(GL_ONE_MINUS_SRC_ALPHA);
- EXPP_ADDCONST(GL_DST_ALPHA);
- EXPP_ADDCONST(GL_ONE_MINUS_DST_ALPHA);
-
- EXPP_ADDCONST(GL_DST_COLOR);
- EXPP_ADDCONST(GL_ONE_MINUS_DST_COLOR);
- EXPP_ADDCONST(GL_SRC_ALPHA_SATURATE);
-
- EXPP_ADDCONST(GL_NONE);
- EXPP_ADDCONST(GL_FRONT_LEFT);
- EXPP_ADDCONST(GL_FRONT_RIGHT);
- EXPP_ADDCONST(GL_BACK_LEFT);
- EXPP_ADDCONST(GL_BACK_RIGHT);
- EXPP_ADDCONST(GL_FRONT);
- EXPP_ADDCONST(GL_BACK);
- EXPP_ADDCONST(GL_LEFT);
- EXPP_ADDCONST(GL_RIGHT);
- EXPP_ADDCONST(GL_FRONT_AND_BACK);
- EXPP_ADDCONST(GL_AUX0);
- EXPP_ADDCONST(GL_AUX1);
- EXPP_ADDCONST(GL_AUX2);
- EXPP_ADDCONST(GL_AUX3);
-
- EXPP_ADDCONST(GL_NO_ERROR);
- EXPP_ADDCONST(GL_INVALID_ENUM);
- EXPP_ADDCONST(GL_INVALID_VALUE);
- EXPP_ADDCONST(GL_INVALID_OPERATION);
- EXPP_ADDCONST(GL_STACK_OVERFLOW);
- EXPP_ADDCONST(GL_STACK_UNDERFLOW);
- EXPP_ADDCONST(GL_OUT_OF_MEMORY);
-
- EXPP_ADDCONST(GL_2D);
- EXPP_ADDCONST(GL_3D);
- EXPP_ADDCONST(GL_3D_COLOR);
- EXPP_ADDCONST(GL_3D_COLOR_TEXTURE);
- EXPP_ADDCONST(GL_4D_COLOR_TEXTURE);
-
- EXPP_ADDCONST(GL_PASS_THROUGH_TOKEN);
- EXPP_ADDCONST(GL_POINT_TOKEN);
- EXPP_ADDCONST(GL_LINE_TOKEN);
- EXPP_ADDCONST(GL_POLYGON_TOKEN);
- EXPP_ADDCONST(GL_BITMAP_TOKEN);
- EXPP_ADDCONST(GL_DRAW_PIXEL_TOKEN);
- EXPP_ADDCONST(GL_COPY_PIXEL_TOKEN);
- EXPP_ADDCONST(GL_LINE_RESET_TOKEN);
-
- EXPP_ADDCONST(GL_EXP);
- EXPP_ADDCONST(GL_EXP2);
-
- EXPP_ADDCONST(GL_CW);
- EXPP_ADDCONST(GL_CCW);
-
- EXPP_ADDCONST(GL_COEFF);
- EXPP_ADDCONST(GL_ORDER);
- EXPP_ADDCONST(GL_DOMAIN);
-
- EXPP_ADDCONST(GL_PIXEL_MAP_I_TO_I);
- EXPP_ADDCONST(GL_PIXEL_MAP_S_TO_S);
- EXPP_ADDCONST(GL_PIXEL_MAP_I_TO_R);
- EXPP_ADDCONST(GL_PIXEL_MAP_I_TO_G);
- EXPP_ADDCONST(GL_PIXEL_MAP_I_TO_B);
- EXPP_ADDCONST(GL_PIXEL_MAP_I_TO_A);
- EXPP_ADDCONST(GL_PIXEL_MAP_R_TO_R);
- EXPP_ADDCONST(GL_PIXEL_MAP_G_TO_G);
- EXPP_ADDCONST(GL_PIXEL_MAP_B_TO_B);
- EXPP_ADDCONST(GL_PIXEL_MAP_A_TO_A);
-
- EXPP_ADDCONST(GL_CURRENT_COLOR);
- EXPP_ADDCONST(GL_CURRENT_INDEX);
- EXPP_ADDCONST(GL_CURRENT_NORMAL);
- EXPP_ADDCONST(GL_CURRENT_TEXTURE_COORDS);
- EXPP_ADDCONST(GL_CURRENT_RASTER_COLOR);
- EXPP_ADDCONST(GL_CURRENT_RASTER_INDEX);
- EXPP_ADDCONST(GL_CURRENT_RASTER_TEXTURE_COORDS);
- EXPP_ADDCONST(GL_CURRENT_RASTER_POSITION);
- EXPP_ADDCONST(GL_CURRENT_RASTER_POSITION_VALID);
- EXPP_ADDCONST(GL_CURRENT_RASTER_DISTANCE);
- EXPP_ADDCONST(GL_POINT_SMOOTH);
- EXPP_ADDCONST(GL_POINT_SIZE);
- EXPP_ADDCONST(GL_POINT_SIZE_RANGE);
- EXPP_ADDCONST(GL_POINT_SIZE_GRANULARITY);
- EXPP_ADDCONST(GL_LINE_SMOOTH);
- EXPP_ADDCONST(GL_LINE_WIDTH);
- EXPP_ADDCONST(GL_LINE_WIDTH_RANGE);
- EXPP_ADDCONST(GL_LINE_WIDTH_GRANULARITY);
- EXPP_ADDCONST(GL_LINE_STIPPLE);
- EXPP_ADDCONST(GL_LINE_STIPPLE_PATTERN);
- EXPP_ADDCONST(GL_LINE_STIPPLE_REPEAT);
- EXPP_ADDCONST(GL_LIST_MODE);
- EXPP_ADDCONST(GL_MAX_LIST_NESTING);
- EXPP_ADDCONST(GL_LIST_BASE);
- EXPP_ADDCONST(GL_LIST_INDEX);
- EXPP_ADDCONST(GL_POLYGON_MODE);
- EXPP_ADDCONST(GL_POLYGON_SMOOTH);
- EXPP_ADDCONST(GL_POLYGON_STIPPLE);
- EXPP_ADDCONST(GL_EDGE_FLAG);
- EXPP_ADDCONST(GL_CULL_FACE);
- EXPP_ADDCONST(GL_CULL_FACE_MODE);
- EXPP_ADDCONST(GL_FRONT_FACE);
- EXPP_ADDCONST(GL_LIGHTING);
- EXPP_ADDCONST(GL_LIGHT_MODEL_LOCAL_VIEWER);
- EXPP_ADDCONST(GL_LIGHT_MODEL_TWO_SIDE);
- EXPP_ADDCONST(GL_LIGHT_MODEL_AMBIENT);
- EXPP_ADDCONST(GL_SHADE_MODEL);
- EXPP_ADDCONST(GL_COLOR_MATERIAL_FACE);
- EXPP_ADDCONST(GL_COLOR_MATERIAL_PARAMETER);
- EXPP_ADDCONST(GL_COLOR_MATERIAL);
- EXPP_ADDCONST(GL_FOG);
- EXPP_ADDCONST(GL_FOG_INDEX);
- EXPP_ADDCONST(GL_FOG_DENSITY);
- EXPP_ADDCONST(GL_FOG_START);
- EXPP_ADDCONST(GL_FOG_END);
- EXPP_ADDCONST(GL_FOG_MODE);
- EXPP_ADDCONST(GL_FOG_COLOR);
- EXPP_ADDCONST(GL_DEPTH_RANGE);
- EXPP_ADDCONST(GL_DEPTH_TEST);
- EXPP_ADDCONST(GL_DEPTH_WRITEMASK);
- EXPP_ADDCONST(GL_DEPTH_CLEAR_VALUE);
- EXPP_ADDCONST(GL_DEPTH_FUNC);
- EXPP_ADDCONST(GL_ACCUM_CLEAR_VALUE);
- EXPP_ADDCONST(GL_STENCIL_TEST);
- EXPP_ADDCONST(GL_STENCIL_CLEAR_VALUE);
- EXPP_ADDCONST(GL_STENCIL_FUNC);
- EXPP_ADDCONST(GL_STENCIL_VALUE_MASK);
- EXPP_ADDCONST(GL_STENCIL_FAIL);
- EXPP_ADDCONST(GL_STENCIL_PASS_DEPTH_FAIL);
- EXPP_ADDCONST(GL_STENCIL_PASS_DEPTH_PASS);
- EXPP_ADDCONST(GL_STENCIL_REF);
- EXPP_ADDCONST(GL_STENCIL_WRITEMASK);
- EXPP_ADDCONST(GL_MATRIX_MODE);
- EXPP_ADDCONST(GL_NORMALIZE);
- EXPP_ADDCONST(GL_VIEWPORT);
- EXPP_ADDCONST(GL_MODELVIEW_STACK_DEPTH);
- EXPP_ADDCONST(GL_PROJECTION_STACK_DEPTH);
- EXPP_ADDCONST(GL_TEXTURE_STACK_DEPTH);
- EXPP_ADDCONST(GL_MODELVIEW_MATRIX);
- EXPP_ADDCONST(GL_PROJECTION_MATRIX);
- EXPP_ADDCONST(GL_TEXTURE_MATRIX);
- EXPP_ADDCONST(GL_ATTRIB_STACK_DEPTH);
- EXPP_ADDCONST(GL_ALPHA_TEST);
- EXPP_ADDCONST(GL_ALPHA_TEST_FUNC);
- EXPP_ADDCONST(GL_ALPHA_TEST_REF);
- EXPP_ADDCONST(GL_DITHER);
- EXPP_ADDCONST(GL_BLEND_DST);
- EXPP_ADDCONST(GL_BLEND_SRC);
- EXPP_ADDCONST(GL_BLEND);
- EXPP_ADDCONST(GL_LOGIC_OP_MODE);
- EXPP_ADDCONST(GL_LOGIC_OP);
- EXPP_ADDCONST(GL_AUX_BUFFERS);
- EXPP_ADDCONST(GL_DRAW_BUFFER);
- EXPP_ADDCONST(GL_READ_BUFFER);
- EXPP_ADDCONST(GL_SCISSOR_BOX);
- EXPP_ADDCONST(GL_SCISSOR_TEST);
- EXPP_ADDCONST(GL_INDEX_CLEAR_VALUE);
- EXPP_ADDCONST(GL_INDEX_WRITEMASK);
- EXPP_ADDCONST(GL_COLOR_CLEAR_VALUE);
- EXPP_ADDCONST(GL_COLOR_WRITEMASK);
- EXPP_ADDCONST(GL_INDEX_MODE);
- EXPP_ADDCONST(GL_RGBA_MODE);
- EXPP_ADDCONST(GL_DOUBLEBUFFER);
- EXPP_ADDCONST(GL_STEREO);
- EXPP_ADDCONST(GL_RENDER_MODE);
- EXPP_ADDCONST(GL_PERSPECTIVE_CORRECTION_HINT);
- EXPP_ADDCONST(GL_POINT_SMOOTH_HINT);
- EXPP_ADDCONST(GL_LINE_SMOOTH_HINT);
- EXPP_ADDCONST(GL_POLYGON_SMOOTH_HINT);
- EXPP_ADDCONST(GL_FOG_HINT);
- EXPP_ADDCONST(GL_TEXTURE_GEN_S);
- EXPP_ADDCONST(GL_TEXTURE_GEN_T);
- EXPP_ADDCONST(GL_TEXTURE_GEN_R);
- EXPP_ADDCONST(GL_TEXTURE_GEN_Q);
- EXPP_ADDCONST(GL_PIXEL_MAP_I_TO_I_SIZE);
- EXPP_ADDCONST(GL_PIXEL_MAP_S_TO_S_SIZE);
- EXPP_ADDCONST(GL_PIXEL_MAP_I_TO_R_SIZE);
- EXPP_ADDCONST(GL_PIXEL_MAP_I_TO_G_SIZE);
- EXPP_ADDCONST(GL_PIXEL_MAP_I_TO_B_SIZE);
- EXPP_ADDCONST(GL_PIXEL_MAP_I_TO_A_SIZE);
- EXPP_ADDCONST(GL_PIXEL_MAP_R_TO_R_SIZE);
- EXPP_ADDCONST(GL_PIXEL_MAP_G_TO_G_SIZE);
- EXPP_ADDCONST(GL_PIXEL_MAP_B_TO_B_SIZE);
- EXPP_ADDCONST(GL_PIXEL_MAP_A_TO_A_SIZE);
- EXPP_ADDCONST(GL_UNPACK_SWAP_BYTES);
- EXPP_ADDCONST(GL_UNPACK_LSB_FIRST);
- EXPP_ADDCONST(GL_UNPACK_ROW_LENGTH);
- EXPP_ADDCONST(GL_UNPACK_SKIP_ROWS);
- EXPP_ADDCONST(GL_UNPACK_SKIP_PIXELS);
- EXPP_ADDCONST(GL_UNPACK_ALIGNMENT);
- EXPP_ADDCONST(GL_PACK_SWAP_BYTES);
- EXPP_ADDCONST(GL_PACK_LSB_FIRST);
- EXPP_ADDCONST(GL_PACK_ROW_LENGTH);
- EXPP_ADDCONST(GL_PACK_SKIP_ROWS);
- EXPP_ADDCONST(GL_PACK_SKIP_PIXELS);
- EXPP_ADDCONST(GL_PACK_ALIGNMENT);
- EXPP_ADDCONST(GL_MAP_COLOR);
- EXPP_ADDCONST(GL_MAP_STENCIL);
- EXPP_ADDCONST(GL_INDEX_SHIFT);
- EXPP_ADDCONST(GL_INDEX_OFFSET);
- EXPP_ADDCONST(GL_RED_SCALE);
- EXPP_ADDCONST(GL_RED_BIAS);
- EXPP_ADDCONST(GL_ZOOM_X);
- EXPP_ADDCONST(GL_ZOOM_Y);
- EXPP_ADDCONST(GL_GREEN_SCALE);
- EXPP_ADDCONST(GL_GREEN_BIAS);
- EXPP_ADDCONST(GL_BLUE_SCALE);
- EXPP_ADDCONST(GL_BLUE_BIAS);
- EXPP_ADDCONST(GL_ALPHA_SCALE);
- EXPP_ADDCONST(GL_ALPHA_BIAS);
- EXPP_ADDCONST(GL_DEPTH_SCALE);
- EXPP_ADDCONST(GL_DEPTH_BIAS);
- EXPP_ADDCONST(GL_MAX_EVAL_ORDER);
- EXPP_ADDCONST(GL_MAX_LIGHTS);
- EXPP_ADDCONST(GL_MAX_CLIP_PLANES);
- EXPP_ADDCONST(GL_MAX_TEXTURE_SIZE);
- EXPP_ADDCONST(GL_MAX_PIXEL_MAP_TABLE);
- EXPP_ADDCONST(GL_MAX_ATTRIB_STACK_DEPTH);
- EXPP_ADDCONST(GL_MAX_MODELVIEW_STACK_DEPTH);
- EXPP_ADDCONST(GL_MAX_NAME_STACK_DEPTH);
- EXPP_ADDCONST(GL_MAX_PROJECTION_STACK_DEPTH);
- EXPP_ADDCONST(GL_MAX_TEXTURE_STACK_DEPTH);
- EXPP_ADDCONST(GL_MAX_VIEWPORT_DIMS);
- EXPP_ADDCONST(GL_SUBPIXEL_BITS);
- EXPP_ADDCONST(GL_INDEX_BITS);
- EXPP_ADDCONST(GL_RED_BITS);
- EXPP_ADDCONST(GL_GREEN_BITS);
- EXPP_ADDCONST(GL_BLUE_BITS);
- EXPP_ADDCONST(GL_ALPHA_BITS);
- EXPP_ADDCONST(GL_DEPTH_BITS);
- EXPP_ADDCONST(GL_STENCIL_BITS);
- EXPP_ADDCONST(GL_ACCUM_RED_BITS);
- EXPP_ADDCONST(GL_ACCUM_GREEN_BITS);
- EXPP_ADDCONST(GL_ACCUM_BLUE_BITS);
- EXPP_ADDCONST(GL_ACCUM_ALPHA_BITS);
- EXPP_ADDCONST(GL_NAME_STACK_DEPTH);
- EXPP_ADDCONST(GL_AUTO_NORMAL);
- EXPP_ADDCONST(GL_MAP1_COLOR_4);
- EXPP_ADDCONST(GL_MAP1_INDEX);
- EXPP_ADDCONST(GL_MAP1_NORMAL);
- EXPP_ADDCONST(GL_MAP1_TEXTURE_COORD_1);
- EXPP_ADDCONST(GL_MAP1_TEXTURE_COORD_2);
- EXPP_ADDCONST(GL_MAP1_TEXTURE_COORD_3);
- EXPP_ADDCONST(GL_MAP1_TEXTURE_COORD_4);
- EXPP_ADDCONST(GL_MAP1_VERTEX_3);
- EXPP_ADDCONST(GL_MAP1_VERTEX_4);
- EXPP_ADDCONST(GL_MAP2_COLOR_4);
- EXPP_ADDCONST(GL_MAP2_INDEX);
- EXPP_ADDCONST(GL_MAP2_NORMAL);
- EXPP_ADDCONST(GL_MAP2_TEXTURE_COORD_1);
- EXPP_ADDCONST(GL_MAP2_TEXTURE_COORD_2);
- EXPP_ADDCONST(GL_MAP2_TEXTURE_COORD_3);
- EXPP_ADDCONST(GL_MAP2_TEXTURE_COORD_4);
- EXPP_ADDCONST(GL_MAP2_VERTEX_3);
- EXPP_ADDCONST(GL_MAP2_VERTEX_4);
- EXPP_ADDCONST(GL_MAP1_GRID_DOMAIN);
- EXPP_ADDCONST(GL_MAP1_GRID_SEGMENTS);
- EXPP_ADDCONST(GL_MAP2_GRID_DOMAIN);
- EXPP_ADDCONST(GL_MAP2_GRID_SEGMENTS);
- EXPP_ADDCONST(GL_TEXTURE_1D);
- EXPP_ADDCONST(GL_TEXTURE_2D);
-
- EXPP_ADDCONST(GL_TEXTURE_WIDTH);
- EXPP_ADDCONST(GL_TEXTURE_HEIGHT);
- EXPP_ADDCONST(GL_TEXTURE_COMPONENTS);
- EXPP_ADDCONST(GL_TEXTURE_BORDER_COLOR);
- EXPP_ADDCONST(GL_TEXTURE_BORDER);
-
- EXPP_ADDCONST(GL_DONT_CARE);
- EXPP_ADDCONST(GL_FASTEST);
- EXPP_ADDCONST(GL_NICEST);
-
- EXPP_ADDCONST(GL_AMBIENT);
- EXPP_ADDCONST(GL_DIFFUSE);
- EXPP_ADDCONST(GL_SPECULAR);
- EXPP_ADDCONST(GL_POSITION);
- EXPP_ADDCONST(GL_SPOT_DIRECTION);
- EXPP_ADDCONST(GL_SPOT_EXPONENT);
- EXPP_ADDCONST(GL_SPOT_CUTOFF);
- EXPP_ADDCONST(GL_CONSTANT_ATTENUATION);
- EXPP_ADDCONST(GL_LINEAR_ATTENUATION);
- EXPP_ADDCONST(GL_QUADRATIC_ATTENUATION);
-
- EXPP_ADDCONST(GL_COMPILE);
- EXPP_ADDCONST(GL_COMPILE_AND_EXECUTE);
-
- EXPP_ADDCONST(GL_BYTE);
- EXPP_ADDCONST(GL_UNSIGNED_BYTE);
- EXPP_ADDCONST(GL_SHORT);
- EXPP_ADDCONST(GL_UNSIGNED_SHORT);
- EXPP_ADDCONST(GL_INT);
- EXPP_ADDCONST(GL_UNSIGNED_INT);
- EXPP_ADDCONST(GL_FLOAT);
- EXPP_ADDCONST(GL_DOUBLE);
- EXPP_ADDCONST(GL_2_BYTES);
- EXPP_ADDCONST(GL_3_BYTES);
- EXPP_ADDCONST(GL_4_BYTES);
-
- EXPP_ADDCONST(GL_CLEAR);
- EXPP_ADDCONST(GL_AND);
- EXPP_ADDCONST(GL_AND_REVERSE);
- EXPP_ADDCONST(GL_COPY);
- EXPP_ADDCONST(GL_AND_INVERTED);
- EXPP_ADDCONST(GL_NOOP);
- EXPP_ADDCONST(GL_XOR);
- EXPP_ADDCONST(GL_OR);
- EXPP_ADDCONST(GL_NOR);
- EXPP_ADDCONST(GL_EQUIV);
- EXPP_ADDCONST(GL_INVERT);
- EXPP_ADDCONST(GL_OR_REVERSE);
- EXPP_ADDCONST(GL_COPY_INVERTED);
- EXPP_ADDCONST(GL_OR_INVERTED);
- EXPP_ADDCONST(GL_NAND);
- EXPP_ADDCONST(GL_SET);
-
- EXPP_ADDCONST(GL_EMISSION);
- EXPP_ADDCONST(GL_SHININESS);
- EXPP_ADDCONST(GL_AMBIENT_AND_DIFFUSE);
- EXPP_ADDCONST(GL_COLOR_INDEXES);
-
- EXPP_ADDCONST(GL_MODELVIEW);
- EXPP_ADDCONST(GL_PROJECTION);
- EXPP_ADDCONST(GL_TEXTURE);
-
- EXPP_ADDCONST(GL_COLOR);
- EXPP_ADDCONST(GL_DEPTH);
- EXPP_ADDCONST(GL_STENCIL);
-
- EXPP_ADDCONST(GL_COLOR_INDEX);
- EXPP_ADDCONST(GL_STENCIL_INDEX);
- EXPP_ADDCONST(GL_DEPTH_COMPONENT);
- EXPP_ADDCONST(GL_RED);
- EXPP_ADDCONST(GL_GREEN);
- EXPP_ADDCONST(GL_BLUE);
- EXPP_ADDCONST(GL_ALPHA);
- EXPP_ADDCONST(GL_RGB);
- EXPP_ADDCONST(GL_RGBA);
- EXPP_ADDCONST(GL_LUMINANCE);
- EXPP_ADDCONST(GL_LUMINANCE_ALPHA);
-
- EXPP_ADDCONST(GL_BITMAP);
-
- EXPP_ADDCONST(GL_POINT);
- EXPP_ADDCONST(GL_LINE);
- EXPP_ADDCONST(GL_FILL);
-
- EXPP_ADDCONST(GL_RENDER);
- EXPP_ADDCONST(GL_FEEDBACK);
- EXPP_ADDCONST(GL_SELECT);
-
- EXPP_ADDCONST(GL_FLAT);
- EXPP_ADDCONST(GL_SMOOTH);
-
- EXPP_ADDCONST(GL_KEEP);
- EXPP_ADDCONST(GL_REPLACE);
- EXPP_ADDCONST(GL_INCR);
- EXPP_ADDCONST(GL_DECR);
-
- EXPP_ADDCONST(GL_VENDOR);
- EXPP_ADDCONST(GL_RENDERER);
- EXPP_ADDCONST(GL_VERSION);
- EXPP_ADDCONST(GL_EXTENSIONS);
-
- EXPP_ADDCONST(GL_S);
- EXPP_ADDCONST(GL_T);
- EXPP_ADDCONST(GL_R);
- EXPP_ADDCONST(GL_Q);
-
- EXPP_ADDCONST(GL_MODULATE);
- EXPP_ADDCONST(GL_DECAL);
-
- EXPP_ADDCONST(GL_TEXTURE_ENV_MODE);
- EXPP_ADDCONST(GL_TEXTURE_ENV_COLOR);
-
- EXPP_ADDCONST(GL_TEXTURE_ENV);
-
- EXPP_ADDCONST(GL_EYE_LINEAR);
- EXPP_ADDCONST(GL_OBJECT_LINEAR);
- EXPP_ADDCONST(GL_SPHERE_MAP);
-
- EXPP_ADDCONST(GL_TEXTURE_GEN_MODE);
- EXPP_ADDCONST(GL_OBJECT_PLANE);
- EXPP_ADDCONST(GL_EYE_PLANE);
-
- EXPP_ADDCONST(GL_NEAREST);
- EXPP_ADDCONST(GL_LINEAR);
-
- EXPP_ADDCONST(GL_NEAREST_MIPMAP_NEAREST);
- EXPP_ADDCONST(GL_LINEAR_MIPMAP_NEAREST);
- EXPP_ADDCONST(GL_NEAREST_MIPMAP_LINEAR);
- EXPP_ADDCONST(GL_LINEAR_MIPMAP_LINEAR);
-
- EXPP_ADDCONST(GL_TEXTURE_MAG_FILTER);
- EXPP_ADDCONST(GL_TEXTURE_MIN_FILTER);
- EXPP_ADDCONST(GL_TEXTURE_WRAP_S);
- EXPP_ADDCONST(GL_TEXTURE_WRAP_T);
-
- EXPP_ADDCONST(GL_CLAMP);
- EXPP_ADDCONST(GL_REPEAT);
-
- EXPP_ADDCONST(GL_CLIP_PLANE0);
- EXPP_ADDCONST(GL_CLIP_PLANE1);
- EXPP_ADDCONST(GL_CLIP_PLANE2);
- EXPP_ADDCONST(GL_CLIP_PLANE3);
- EXPP_ADDCONST(GL_CLIP_PLANE4);
- EXPP_ADDCONST(GL_CLIP_PLANE5);
-
- EXPP_ADDCONST(GL_LIGHT0);
- EXPP_ADDCONST(GL_LIGHT1);
- EXPP_ADDCONST(GL_LIGHT2);
- EXPP_ADDCONST(GL_LIGHT3);
- EXPP_ADDCONST(GL_LIGHT4);
- EXPP_ADDCONST(GL_LIGHT5);
- EXPP_ADDCONST(GL_LIGHT6);
- EXPP_ADDCONST(GL_LIGHT7);
-
- EXPP_ADDCONST(GL_POLYGON_OFFSET_UNITS);
- EXPP_ADDCONST(GL_POLYGON_OFFSET_POINT);
- EXPP_ADDCONST(GL_POLYGON_OFFSET_LINE);
- EXPP_ADDCONST(GL_POLYGON_OFFSET_FILL);
- EXPP_ADDCONST(GL_POLYGON_OFFSET_FACTOR);
-
- EXPP_ADDCONST(GL_TEXTURE_PRIORITY);
- EXPP_ADDCONST(GL_TEXTURE_RESIDENT);
- EXPP_ADDCONST(GL_TEXTURE_BINDING_1D);
- EXPP_ADDCONST(GL_TEXTURE_BINDING_2D);
-
- return mod;
-}
-
diff --git a/source/blender/python/api2_2x/BGL.h b/source/blender/python/api2_2x/BGL.h
deleted file mode 100644
index f8dea726d73..00000000000
--- a/source/blender/python/api2_2x/BGL.h
+++ /dev/null
@@ -1,333 +0,0 @@
-/*
- * $Id: BGL.h 5407 2005-10-02 17:09:11Z zuster $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-/* This is the Blender.BGL part of opy_draw.c, from the old bpython/intern
- * dir, with minor changes to adapt it to the new Python implementation.
- * The BGL submodule "wraps" OpenGL functions and constants, allowing script
- * writers to make OpenGL calls in their Python scripts for Blender. The
- * more important original comments are marked with an @ symbol. */
-
-#ifndef EXPP_BGL_H
-#define EXPP_BGL_H
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <Python.h>
-#include "BIF_gl.h"
-
-
-/*@ Buffer Object */
-/*@ For Python access to OpenGL functions requiring a pointer. */
-
-typedef struct _Buffer {
- PyObject_VAR_HEAD
- PyObject * parent;
-
- int type; /* GL_BYTE, GL_SHORT, GL_INT, GL_FLOAT */
- int ndimensions;
- int *dimensions;
-
- union {
- char *asbyte;
- short *asshort;
- int *asint;
- float *asfloat;
- double *asdouble;
-
- void *asvoid;
- } buf;
-} Buffer;
-
-
-/*@ By golly George! It looks like fancy pants macro time!!! */
-
-/*
-#define int_str "i"
-#define int_var(number) bgl_int##number
-#define int_ref(number) &bgl_int##number
-#define int_def(number) int int_var(number)
-
-#define float_str "f"
-#define float_var(number) bgl_float##number
-#define float_ref(number) &bgl_float##number
-#define float_def(number) float float_var(number)
-*/
-
-/* TYPE_str is the string to pass to Py_ArgParse (for the format) */
-/* TYPE_var is the name to pass to the GL function */
-/* TYPE_ref is the pointer to pass to Py_ArgParse (to store in) */
-/* TYPE_def is the C initialization of the variable */
-
-#define void_str ""
-#define void_var(num)
-#define void_ref(num) &bgl_var##num
-#define void_def(num) char bgl_var##num
-
-#define buffer_str "O!"
-#define buffer_var(number) (bgl_buffer##number)->buf.asvoid
-#define buffer_ref(number) &buffer_Type, &bgl_buffer##number
-#define buffer_def(number) Buffer *bgl_buffer##number
-
-/* GL Pointer fields, handled by buffer type */
-/* GLdoubleP, GLfloatP, GLintP, GLuintP, GLshortP */
-
-#define GLbooleanP_str "O!"
-#define GLbooleanP_var(number) (bgl_buffer##number)->buf.asvoid
-#define GLbooleanP_ref(number) &buffer_Type, &bgl_buffer##number
-#define GLbooleanP_def(number) Buffer *bgl_buffer##number
-
-#define GLbyteP_str "O!"
-#define GLbyteP_var(number) (bgl_buffer##number)->buf.asvoid
-#define GLbyteP_ref(number) &buffer_Type, &bgl_buffer##number
-#define GLbyteP_def(number) Buffer *bgl_buffer##number
-
-#define GLubyteP_str "O!"
-#define GLubyteP_var(number) (bgl_buffer##number)->buf.asvoid
-#define GLubyteP_ref(number) &buffer_Type, &bgl_buffer##number
-#define GLubyteP_def(number) Buffer *bgl_buffer##number
-
-#define GLintP_str "O!"
-#define GLintP_var(number) (bgl_buffer##number)->buf.asvoid
-#define GLintP_ref(number) &buffer_Type, &bgl_buffer##number
-#define GLintP_def(number) Buffer *bgl_buffer##number
-
-#define GLuintP_str "O!"
-#define GLuintP_var(number) (bgl_buffer##number)->buf.asvoid
-#define GLuintP_ref(number) &buffer_Type, &bgl_buffer##number
-#define GLuintP_def(number) Buffer *bgl_buffer##number
-
-#define GLshortP_str "O!"
-#define GLshortP_var(number) (bgl_buffer##number)->buf.asvoid
-#define GLshortP_ref(number) &buffer_Type, &bgl_buffer##number
-#define GLshortP_def(number) Buffer *bgl_buffer##number
-
-#define GLushortP_str "O!"
-#define GLushortP_var(number) (bgl_buffer##number)->buf.asvoid
-#define GLushortP_ref(number) &buffer_Type, &bgl_buffer##number
-#define GLushortP_def(number) Buffer *bgl_buffer##number
-
-#define GLfloatP_str "O!"
-#define GLfloatP_var(number) (bgl_buffer##number)->buf.asvoid
-#define GLfloatP_ref(number) &buffer_Type, &bgl_buffer##number
-#define GLfloatP_def(number) Buffer *bgl_buffer##number
-
-#define GLdoubleP_str "O!"
-#define GLdoubleP_var(number) (bgl_buffer##number)->buf.asvoid
-#define GLdoubleP_ref(number) &buffer_Type, &bgl_buffer##number
-#define GLdoubleP_def(number) Buffer *bgl_buffer##number
-
-#define GLclampfP_str "O!"
-#define GLclampfP_var(number) (bgl_buffer##number)->buf.asvoid
-#define GLclampfP_ref(number) &buffer_Type, &bgl_buffer##number
-#define GLclampfP_def(number) Buffer *bgl_buffer##number
-
-#define GLvoidP_str "O!"
-#define GLvoidP_var(number) (bgl_buffer##number)->buf.asvoid
-#define GLvoidP_ref(number) &buffer_Type, &bgl_buffer##number
-#define GLvoidP_def(number) Buffer *bgl_buffer##number
-
-#define buffer_str "O!"
-#define buffer_var(number) (bgl_buffer##number)->buf.asvoid
-#define buffer_ref(number) &buffer_Type, &bgl_buffer##number
-#define buffer_def(number) Buffer *bgl_buffer##number
-
-/*@The standard GL typedefs are used as prototypes, we can't
- * use the GL type directly because Py_ArgParse expects normal
- * C types.
- *
- * Py_ArgParse doesn't grok writing into unsigned variables,
- * so we use signed everything (even stuff that should be unsigned.
- */
-
-/* typedef unsigned int GLenum; */
-#define GLenum_str "i"
-#define GLenum_var(num) bgl_var##num
-#define GLenum_ref(num) &bgl_var##num
-#define GLenum_def(num) /* unsigned */ int GLenum_var(num)
-
-/* typedef unsigned int GLboolean; */
-#define GLboolean_str "b"
-#define GLboolean_var(num) bgl_var##num
-#define GLboolean_ref(num) &bgl_var##num
-#define GLboolean_def(num) /* unsigned */ char GLboolean_var(num)
-
-/* typedef unsigned int GLbitfield; */
-#define GLbitfield_str "i"
-#define GLbitfield_var(num) bgl_var##num
-#define GLbitfield_ref(num) &bgl_var##num
-#define GLbitfield_def(num) /* unsigned */ int GLbitfield_var(num)
-
-/* typedef signed char GLbyte; */
-#define GLbyte_str "b"
-#define GLbyte_var(num) bgl_var##num
-#define GLbyte_ref(num) &bgl_var##num
-#define GLbyte_def(num) signed char GLbyte_var(num)
-
-/* typedef short GLshort; */
-#define GLshort_str "h"
-#define GLshort_var(num) bgl_var##num
-#define GLshort_ref(num) &bgl_var##num
-#define GLshort_def(num) short GLshort_var(num)
-
-/* typedef int GLint; */
-#define GLint_str "i"
-#define GLint_var(num) bgl_var##num
-#define GLint_ref(num) &bgl_var##num
-#define GLint_def(num) int GLint_var(num)
-
-/* typedef int GLsizei; */
-#define GLsizei_str "i"
-#define GLsizei_var(num) bgl_var##num
-#define GLsizei_ref(num) &bgl_var##num
-#define GLsizei_def(num) int GLsizei_var(num)
-
-/* typedef unsigned char GLubyte; */
-#define GLubyte_str "b"
-#define GLubyte_var(num) bgl_var##num
-#define GLubyte_ref(num) &bgl_var##num
-#define GLubyte_def(num) /* unsigned */ char GLubyte_var(num)
-
-/* typedef unsigned short GLushort; */
-#define GLushort_str "h"
-#define GLushort_var(num) bgl_var##num
-#define GLushort_ref(num) &bgl_var##num
-#define GLushort_def(num) /* unsigned */ short GLushort_var(num)
-
-/* typedef unsigned int GLuint; */
-#define GLuint_str "i"
-#define GLuint_var(num) bgl_var##num
-#define GLuint_ref(num) &bgl_var##num
-#define GLuint_def(num) /* unsigned */ int GLuint_var(num)
-
-/* typedef float GLfloat; */
-#define GLfloat_str "f"
-#define GLfloat_var(num) bgl_var##num
-#define GLfloat_ref(num) &bgl_var##num
-#define GLfloat_def(num) float GLfloat_var(num)
-
-/* typedef float GLclampf; */
-#define GLclampf_str "f"
-#define GLclampf_var(num) bgl_var##num
-#define GLclampf_ref(num) &bgl_var##num
-#define GLclampf_def(num) float GLclampf_var(num)
-
-/* typedef double GLdouble; */
-#define GLdouble_str "d"
-#define GLdouble_var(num) bgl_var##num
-#define GLdouble_ref(num) &bgl_var##num
-#define GLdouble_def(num) double GLdouble_var(num)
-
-/* typedef double GLclampd; */
-#define GLclampd_str "d"
-#define GLclampd_var(num) bgl_var##num
-#define GLclampd_ref(num) &bgl_var##num
-#define GLclampd_def(num) double GLclampd_var(num)
-
-/* typedef void GLvoid; */
-/* #define GLvoid_str "" */
-/* #define GLvoid_var(num) bgl_var##num */
-/* #define GLvoid_ref(num) &bgl_var##num */
-/* #define GLvoid_def(num) char bgl_var##num */
-
-#define arg_def1(a1) a1##_def(1)
-#define arg_def2(a1, a2) arg_def1(a1); a2##_def(2)
-#define arg_def3(a1, a2, a3) arg_def2(a1, a2); a3##_def(3)
-#define arg_def4(a1, a2, a3, a4) arg_def3(a1, a2, a3); a4##_def(4)
-#define arg_def5(a1, a2, a3, a4, a5) arg_def4(a1, a2, a3, a4); a5##_def(5)
-#define arg_def6(a1, a2, a3, a4, a5, a6)arg_def5(a1, a2, a3, a4, a5); a6##_def(6)
-#define arg_def7(a1, a2, a3, a4, a5, a6, a7)arg_def6(a1, a2, a3, a4, a5, a6); a7##_def(7)
-#define arg_def8(a1, a2, a3, a4, a5, a6, a7, a8)arg_def7(a1, a2, a3, a4, a5, a6, a7); a8##_def(8)
-#define arg_def9(a1, a2, a3, a4, a5, a6, a7, a8, a9)arg_def8(a1, a2, a3, a4, a5, a6, a7, a8); a9##_def(9)
-#define arg_def10(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)arg_def9(a1, a2, a3, a4, a5, a6, a7, a8, a9); a10##_def(10)
-
-#define arg_var1(a1) a1##_var(1)
-#define arg_var2(a1, a2) arg_var1(a1), a2##_var(2)
-#define arg_var3(a1, a2, a3) arg_var2(a1, a2), a3##_var(3)
-#define arg_var4(a1, a2, a3, a4) arg_var3(a1, a2, a3), a4##_var(4)
-#define arg_var5(a1, a2, a3, a4, a5) arg_var4(a1, a2, a3, a4), a5##_var(5)
-#define arg_var6(a1, a2, a3, a4, a5, a6)arg_var5(a1, a2, a3, a4, a5), a6##_var(6)
-#define arg_var7(a1, a2, a3, a4, a5, a6, a7)arg_var6(a1, a2, a3, a4, a5, a6), a7##_var(7)
-#define arg_var8(a1, a2, a3, a4, a5, a6, a7, a8)arg_var7(a1, a2, a3, a4, a5, a6, a7), a8##_var(8)
-#define arg_var9(a1, a2, a3, a4, a5, a6, a7, a8, a9)arg_var8(a1, a2, a3, a4, a5, a6, a7, a8), a9##_var(9)
-#define arg_var10(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)arg_var9(a1, a2, a3, a4, a5, a6, a7, a8, a9), a10##_var(10)
-
-#define arg_ref1(a1) a1##_ref(1)
-#define arg_ref2(a1, a2) arg_ref1(a1), a2##_ref(2)
-#define arg_ref3(a1, a2, a3) arg_ref2(a1, a2), a3##_ref(3)
-#define arg_ref4(a1, a2, a3, a4) arg_ref3(a1, a2, a3), a4##_ref(4)
-#define arg_ref5(a1, a2, a3, a4, a5) arg_ref4(a1, a2, a3, a4), a5##_ref(5)
-#define arg_ref6(a1, a2, a3, a4, a5, a6)arg_ref5(a1, a2, a3, a4, a5), a6##_ref(6)
-#define arg_ref7(a1, a2, a3, a4, a5, a6, a7)arg_ref6(a1, a2, a3, a4, a5, a6), a7##_ref(7)
-#define arg_ref8(a1, a2, a3, a4, a5, a6, a7, a8)arg_ref7(a1, a2, a3, a4, a5, a6, a7), a8##_ref(8)
-#define arg_ref9(a1, a2, a3, a4, a5, a6, a7, a8, a9)arg_ref8(a1, a2, a3, a4, a5, a6, a7, a8), a9##_ref(9)
-#define arg_ref10(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)arg_ref9(a1, a2, a3, a4, a5, a6, a7, a8, a9), a10##_ref(10)
-
-#define arg_str1(a1) a1##_str
-#define arg_str2(a1, a2) arg_str1(a1) a2##_str
-#define arg_str3(a1, a2, a3) arg_str2(a1, a2) a3##_str
-#define arg_str4(a1, a2, a3, a4) arg_str3(a1, a2, a3) a4##_str
-#define arg_str5(a1, a2, a3, a4, a5) arg_str4(a1, a2, a3, a4) a5##_str
-#define arg_str6(a1, a2, a3, a4, a5, a6)arg_str5(a1, a2, a3, a4, a5) a6##_str
-#define arg_str7(a1, a2, a3, a4, a5, a6, a7)arg_str6(a1, a2, a3, a4, a5, a6) a7##_str
-#define arg_str8(a1, a2, a3, a4, a5, a6, a7, a8)arg_str7(a1, a2, a3, a4, a5, a6, a7) a8##_str
-#define arg_str9(a1, a2, a3, a4, a5, a6, a7, a8, a9)arg_str8(a1, a2, a3, a4, a5, a6, a7, a8) a9##_str
-#define arg_str10(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)arg_str9(a1, a2, a3, a4, a5, a6, a7, a8, a9) a10##_str
-
-#define ret_def_void
-#define ret_set_void
-#define ret_ret_void return EXPP_incr_ret(Py_None)
-
-#define ret_def_GLint int ret_int
-#define ret_set_GLint ret_int=
-#define ret_ret_GLint return PyInt_FromLong(ret_int);
-
-#define ret_def_GLuint unsigned int ret_uint
-#define ret_set_GLuint ret_uint=
-#define ret_ret_GLuint return PyInt_FromLong((long) ret_uint);
-
-#define ret_def_GLenum unsigned int ret_uint
-#define ret_set_GLenum ret_uint=
-#define ret_ret_GLenum return PyInt_FromLong((long) ret_uint);
-
-#define ret_def_GLboolean unsigned char ret_bool
-#define ret_set_GLboolean ret_bool=
-#define ret_ret_GLboolean return PyInt_FromLong((long) ret_bool);
-
-#define ret_def_GLstring const unsigned char *ret_str;
-#define ret_set_GLstring ret_str=
-#define ret_ret_GLstring return PyString_FromString(ret_str);
-
-
-
-#endif /* EXPP_BGL_H */
diff --git a/source/blender/python/api2_2x/BezTriple.c b/source/blender/python/api2_2x/BezTriple.c
deleted file mode 100644
index e4a872c52c0..00000000000
--- a/source/blender/python/api2_2x/BezTriple.c
+++ /dev/null
@@ -1,716 +0,0 @@
-/*
- * $Id: BezTriple.c 11241 2007-07-12 11:51:21Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Jacques Guignot RIP 2005,
- * Stephen Swaney, Ken Hughes
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include "BezTriple.h" /*This must come first */
-#include "DNA_ipo_types.h"
-
-#include "MEM_guardedalloc.h"
-#include "gen_utils.h"
-
-
-/***************************************************************************
- Python API function prototypes for the BezTriple module.
-***************************************************************************/
-static PyObject *M_BezTriple_New( PyObject * self, PyObject * args );
-static PyObject *M_BezTriple_Get( PyObject * self, PyObject * args );
-
-/*************************************
- Doc strings for the BezTriple module
-*************************************/
-
-static char M_BezTriple_doc[] = "The Blender BezTriple module\n";
-
-/****************************************************************************
- Python BPy_BezTriple instance methods declarations:
-****************************************************************************/
-static PyObject *BezTriple_oldsetPoints( BPy_BezTriple * self, PyObject * args );
-static int BezTriple_setPoints( BPy_BezTriple * self, PyObject * args );
-static PyObject *BezTriple_getPoints( BPy_BezTriple * self );
-static PyObject *BezTriple_getTriple( BPy_BezTriple * self );
-
-/****************************************************************************
- Python method structure definition for Blender.BezTriple module:
-****************************************************************************/
-
-struct PyMethodDef M_BezTriple_methods[] = {
- {"New", ( PyCFunction ) M_BezTriple_New, METH_VARARGS | METH_KEYWORDS,
- 0},
-/* {"New", ( PyCFunction ) M_BezTriple_New, METH_O, 0}, */
- {"Get", M_BezTriple_Get, METH_VARARGS, 0},
- {"get", M_BezTriple_Get, METH_VARARGS, 0},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Python BPy_BezTriple methods table: */
-/*****************************************************************************/
-static PyMethodDef BPy_BezTriple_methods[] = {
- /* name, method, flags, doc */
- {"setPoints", ( PyCFunction ) BezTriple_oldsetPoints, METH_VARARGS,
- "(str) - Change BezTriple point coordinates"},
- {"getPoints", ( PyCFunction ) BezTriple_getPoints, METH_NOARGS,
- "() - return BezTriple knot point x and y coordinates"},
- {"getTriple", ( PyCFunction ) BezTriple_getTriple, METH_NOARGS,
- "() - return list of 3 floating point triplets. order is H1, knot, H2"},
- {NULL, NULL, 0, NULL}
-};
-
-/****************************************************************************
- Function: M_BezTriple_New
- Python equivalent: Blender.BezTriple.New
-****************************************************************************/
-
-static PyObject *M_BezTriple_New( PyObject* self, PyObject * args )
-{
- float numbuf[9];
- PyObject* in_args = NULL;
- int length;
-
- /* accept list, tuple, or 3 or 9 args (which better be floats) */
-
- length = PyTuple_Size( args );
- if( length == 3 || length == 9 )
- in_args = args;
- else if( !PyArg_ParseTuple( args, "|O", &in_args) )
- goto TypeError;
-
- if( !in_args ) {
- numbuf[0] = 0.0f; numbuf[1] = 0.0f; numbuf[2] = 0.0f;
- numbuf[3] = 0.0f; numbuf[4] = 0.0f; numbuf[5] = 0.0f;
- numbuf[6] = 0.0f; numbuf[7] = 0.0f; numbuf[8] = 0.0f;
- } else {
- int i, length;
- if( !PySequence_Check( in_args ) )
- goto TypeError;
-
- length = PySequence_Length( in_args );
- if( length != 9 && length != 3 )
- goto TypeError;
-
- for( i = 0; i < length; i++ ) {
- PyObject *item, *pyfloat;
- item = PySequence_ITEM( in_args, i);
- if( !item )
- goto TypeError;
- pyfloat = PyNumber_Float( item );
- Py_DECREF( item );
- if( !pyfloat )
- goto TypeError;
- numbuf[i] = ( float )PyFloat_AS_DOUBLE( pyfloat );
- Py_DECREF( pyfloat );
- }
-
- if( length == 3 ) {
- numbuf[3] = numbuf[0]; numbuf[6] = numbuf[0];
- numbuf[4] = numbuf[1]; numbuf[7] = numbuf[1];
- numbuf[5] = numbuf[2]; numbuf[8] = numbuf[2];
- }
- }
-
- return newBezTriple( numbuf );
-
-TypeError:
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected sequence of 3 or 9 floats or nothing" );
-}
-
-/****************************************************************************
- Function: M_BezTriple_Get
- Python equivalent: Blender.BezTriple.Get
- Description: Receives a string and returns the ipo data obj
- whose name matches the string. If no argument is
- passed in, a list of all ipo data names in the
- current scene is returned.
-****************************************************************************/
-static PyObject *M_BezTriple_Get( PyObject * self, PyObject * args )
-{
- return 0;
-}
-
-/****************************************************************************
- Function: BezTriple_dealloc
- Description: This is a callback function for the BPy_BezTriple type. It is
- the destructor function.
-****************************************************************************/
-static void BezTriple_dealloc( BPy_BezTriple * self )
-{
- if( self->own_memory)
- MEM_freeN( self->beztriple );
-
- PyObject_DEL( self );
-}
-
-/*
- * BezTriple_getTriple
- *
- * Get the coordinate data for a BezTriple. Returns a list of 3 points.
- * List order is handle1, knot, handle2. each point consists of a list
- * of x,y,z float values.
- */
-
-static PyObject *BezTriple_getTriple( BPy_BezTriple * self )
-{
- BezTriple *bezt = self->beztriple;
- return Py_BuildValue( "[[fff][fff][fff]]",
- bezt->vec[0][0], bezt->vec[0][1], bezt->vec[0][2],
- bezt->vec[1][0], bezt->vec[1][1], bezt->vec[1][2],
- bezt->vec[2][0], bezt->vec[2][1], bezt->vec[2][2] );
-}
-
-/*
- * BezTriple_setTriple
- *
- * Set the cordinate data for a BezTriple. Takes a sequence of 3 points,
- * of the same format at BezTriple_getTriple.
- */
-
-static int BezTriple_setTriple( BPy_BezTriple * self, PyObject * args )
-{
- int i, j;
- struct BezTriple *bezt = self->beztriple;
- float vec[3][3];
-
- if( !PySequence_Check( args ) || PySequence_Size( args ) != 3 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected three sequences of three floats" );
-
- for( i = 0; i < 3; i++ ) {
- PyObject *obj1 = PySequence_ITEM( args, i );
- if( !PySequence_Check( obj1 ) || PySequence_Size( obj1 ) != 3 ) {
- Py_DECREF( obj1 );
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected three sequences of three floats" );
- }
- for( j = 0; j < 3; j++ ) {
- PyObject *obj2 = PySequence_ITEM( obj1, j );
- PyObject *num = PyNumber_Float( obj2 );
- Py_DECREF( obj2 );
-
- if( !num ) {
- Py_DECREF( obj1 );
- return EXPP_ReturnIntError( PyExc_ValueError,
- "expected float parameter" );
- }
- vec[i][j] = ( float )PyFloat_AsDouble( num );
- Py_DECREF( num );
- }
- Py_DECREF( obj1 );
- }
-
- for( i = 0; i < 3; i++ )
- for( j = 0; j < 3; j++ )
- bezt->vec[i][j] = vec[i][j];
-
- return 0;
-}
-
-/*
- * BezTriple_getPoint
- *
- * Get the coordinate data for a BezTriple. Returns the control point,
- * as a list of x,y float values.
- */
-
-static PyObject *BezTriple_getPoints( BPy_BezTriple * self )
-{
- BezTriple *bezt = self->beztriple;
- return Py_BuildValue( "[ff]", bezt->vec[1][0], bezt->vec[1][1] );
-}
-
-/*
- * BezTriple_setPoint
- *
- * Set the coordinate data for a BezTriple. Accepts the x,y for the control
- * point and builds handle values based on control point.
- */
-
-static int BezTriple_setPoints( BPy_BezTriple * self, PyObject * args )
-{
- int i;
- struct BezTriple *bezt = self->beztriple;
- float vec[2];
-
- if( !PySequence_Check( args ) || PySequence_Size( args ) != 2 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected sequence of two floats" );
-
- for( i = 0; i < 2; i++ ) {
- PyObject *obj = PySequence_ITEM( args, i );
- PyObject *num = PyNumber_Float( obj );
- Py_DECREF( obj );
-
- if( !num )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "expected float parameter" );
- vec[i] = ( float )PyFloat_AsDouble( num );
- Py_DECREF( num );
- }
-
- for( i = 0; i < 2; i++ ) {
- bezt->vec[0][i] = vec[i] - 1;
- bezt->vec[1][i] = vec[i];
- bezt->vec[2][i] = vec[i] + 1;
- }
-
- /* experimental fussing with handles - ipo.c: calchandles_ipocurve */
- if( bezt->vec[0][0] > bezt->vec[1][0] )
- bezt->vec[0][0] = bezt->vec[1][0];
-
- if( bezt->vec[2][0] < bezt->vec[1][0] )
- bezt->vec[2][0] = bezt->vec[1][0];
-
- return 0;
-}
-
-static PyObject *BezTriple_getTilt( BPy_BezTriple * self )
-{
- return PyFloat_FromDouble( self->beztriple->alfa );
-}
-
-static int BezTriple_setTilt( BPy_BezTriple * self, PyObject *value )
-{
- PyObject *num = PyNumber_Float( value );
-
- if( !num )
- return EXPP_ReturnIntError( PyExc_TypeError, "expected a float" );
-
- self->beztriple->alfa = (float)PyFloat_AsDouble( num );
- Py_DECREF( num );
- return 0;
-}
-
-static PyObject *BezTriple_getWeight( BPy_BezTriple * self )
-{
- return PyFloat_FromDouble( self->beztriple->weight );
-}
-
-static int BezTriple_setWeight( BPy_BezTriple * self, PyObject *value )
-{
- PyObject *num = PyNumber_Float( value );
-
- if( !num )
- return EXPP_ReturnIntError( PyExc_TypeError, "expected a float" );
-
- self->beztriple->weight = (float)PyFloat_AsDouble( num );
- Py_DECREF( num );
- return 0;
-}
-
-static PyObject *BezTriple_getRadius( BPy_BezTriple * self )
-{
- return PyFloat_FromDouble( self->beztriple->radius );
-}
-
-static int BezTriple_setRadius( BPy_BezTriple * self, PyObject *value )
-{
- PyObject *num = PyNumber_Float( value );
-
- if( !num )
- return EXPP_ReturnIntError( PyExc_TypeError, "expected a float" );
-
- self->beztriple->radius = (float)PyFloat_AsDouble( num );
- Py_DECREF( num );
- return 0;
-}
-
-static PyObject *BezTriple_getHide( BPy_BezTriple * self )
-{
- return PyInt_FromLong( self->beztriple->hide == IPO_BEZ );
-}
-
-static int BezTriple_setHide( BPy_BezTriple * self, PyObject *value )
-{
- int param = PyObject_IsTrue( value );
- if( param == -1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected True/False or 0/1" );
-
- if( param )
- self->beztriple->hide = IPO_BEZ;
- else
- self->beztriple->hide = 0;
- return 0;
-}
-
-static PyObject *BezTriple_getSelects( BPy_BezTriple * self )
-{
- BezTriple *bezt = self->beztriple;
-
- return Py_BuildValue( "[iii]", bezt->f1, bezt->f2, bezt->f3 );
-}
-
-static int BezTriple_setSelects( BPy_BezTriple * self, PyObject *args )
-{
- struct BezTriple *bezt = self->beztriple;
- PyObject *ob1, *ob2, *ob3;
- int param1, param2, param3;
-
- /* only accept a sequence of three booleans */
-
- if( !PySequence_Check( args ) || PySequence_Size( args ) != 3 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected sequence of three integers" );
-
- ob1 = PySequence_ITEM( args, 0 );
- ob2 = PySequence_ITEM( args, 1 );
- ob3 = PySequence_ITEM( args, 2 );
-
- param1 = PyObject_IsTrue( ob1 );
- param2 = PyObject_IsTrue( ob2 );
- param3 = PyObject_IsTrue( ob3 );
-
- if (param1==-1 || param2==-1 || param3==-1)
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a sequence of 3 items: True/False or 0/1" );
-
- /* assign the selects */
- bezt->f1 = (char)param1;
- bezt->f2 = (char)param2;
- bezt->f3 = (char)param3;
-
- Py_DECREF( ob1 );
- Py_DECREF( ob2 );
- Py_DECREF( ob3 );
- return 0;
-}
-
-static PyObject *BezTriple_getHandles( BPy_BezTriple * self )
-{
- BezTriple *bezt = self->beztriple;
-
- return Py_BuildValue( "[ii]", bezt->h1, bezt->h2 );
-}
-
-static int BezTriple_setHandles( BPy_BezTriple * self, PyObject *args )
-{
- struct BezTriple *bezt = self->beztriple;
- PyObject *ob1, *ob2;
- short h1, h2;
-
- /* only accept a sequence of two ints */
-
- if( !PySequence_Check( args ) || PySequence_Size( args ) != 2 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected sequence of two integers" );
-
- ob1 = PySequence_ITEM( args, 0 );
- ob2 = PySequence_ITEM( args, 1 );
-
- if( !PyInt_Check( ob1 ) || !PyInt_Check( ob2 ) ) {
- Py_DECREF( ob1 );
- Py_DECREF( ob2 );
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected sequence of two integers" );
- }
-
- h1 = ( short ) PyInt_AsLong( ob1 );
- h2 = ( short ) PyInt_AsLong( ob2 );
- Py_DECREF( ob1 );
- Py_DECREF( ob2 );
-
- if( h1 < HD_FREE || h2 < HD_FREE ||
- h1 > HD_AUTO_ANIM || h2 > HD_AUTO_ANIM )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "expected int in range [0,4]" );
-
- /* assign the handles */
-
- bezt->h1 = h1;
- bezt->h2 = h2;
-
- return 0;
-}
-
-/*
- * Python BezTriple attributes get/set structure
- */
-
-static PyGetSetDef BPy_BezTriple_getseters[] = {
- {"pt",
- (getter)BezTriple_getPoints, (setter)BezTriple_setPoints,
- "point knot values",
- NULL},
- {"vec",
- (getter)BezTriple_getTriple, (setter)BezTriple_setTriple,
- "point handle and knot values",
- NULL},
- {"tilt",
- (getter)BezTriple_getTilt, (setter)BezTriple_setTilt,
- "point tilt",
- NULL},
- {"hide",
- (getter)BezTriple_getHide, (setter)BezTriple_setHide,
- "point hide status",
- NULL},
- {"selects",
- (getter)BezTriple_getSelects, (setter)BezTriple_setSelects,
- "point select statuses",
- NULL},
- {"handleTypes",
- (getter)BezTriple_getHandles, (setter)BezTriple_setHandles,
- "point handle types",
- NULL},
- {"weight",
- (getter)BezTriple_getWeight, (setter)BezTriple_setWeight,
- "point weight",
- NULL},
- {"radius",
- (getter)BezTriple_getRadius, (setter)BezTriple_setRadius,
- "point radius",
- NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-/*****************************************************************************/
-/* Function: BezTriple_repr */
-/* Description: This is a callback function for the BPy_BezTriple type. It */
-/* builds a meaninful string to represent BezTriple objects. */
-/*****************************************************************************/
-static PyObject *BezTriple_repr( BPy_BezTriple * self )
-{
- char str[512];
- sprintf( str,
- "[BezTriple [%.6f, %.6f, %.6f] [%.6f, %.6f, %.6f] [%.6f, %.6f, %.6f]\n",
- self->beztriple->vec[0][0], self->beztriple->vec[0][1], self->beztriple->vec[0][2],
- self->beztriple->vec[1][0], self->beztriple->vec[1][1], self->beztriple->vec[1][2],
- self->beztriple->vec[2][0], self->beztriple->vec[2][1], self->beztriple->vec[2][2]);
- return PyString_FromString( str );
-}
-
-/************************************************************************
- *
- * Python BezTriple_Type structure definition
- *
- ************************************************************************/
-
-PyTypeObject BezTriple_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "BezTriple", /* char *tp_name; */
- sizeof( BPy_BezTriple ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- ( destructor ) BezTriple_dealloc,/* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- NULL, /* cmpfunc tp_compare; */
- ( reprfunc ) BezTriple_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- 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; */
- 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, /* 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, /* 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 ***/
- BPy_BezTriple_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_BezTriple_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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 PyObject *M_BezTriple_HandleDict( void )
-{
- PyObject *HM = PyConstant_New( );
-
- if( HM ) {
- BPy_constant *d = ( BPy_constant * ) HM;
-
- PyConstant_Insert( d, "FREE", PyInt_FromLong( HD_FREE ) );
- PyConstant_Insert( d, "AUTO", PyInt_FromLong( HD_AUTO ) );
- PyConstant_Insert( d, "VECT", PyInt_FromLong( HD_VECT ) );
- PyConstant_Insert( d, "ALIGN", PyInt_FromLong( HD_ALIGN ) );
- PyConstant_Insert( d, "AUTOANIM", PyInt_FromLong( HD_AUTO_ANIM ) );
- }
- return HM;
-}
-
-/*
- BezTriple_Init
-*/
-
-PyObject *BezTriple_Init( void )
-{
- PyObject *submodule;
- PyObject *HandleTypes = M_BezTriple_HandleDict( );
-
- if( PyType_Ready( &BezTriple_Type ) < 0 )
- return NULL;
-
- submodule = Py_InitModule3( "Blender.BezTriple",
- M_BezTriple_methods,
- M_BezTriple_doc );
- if( HandleTypes )
- PyModule_AddObject( submodule, "HandleTypes", HandleTypes );
-
-
- return submodule;
-}
-
-/* Three Python BezTriple_Type helper functions needed by the Object module: */
-
-/****************************************************************************
- Function: BezTriple_CreatePyObject
- Description: This function will create a new BPy_BezTriple from an existing
- Blender ipo structure.
-****************************************************************************/
-PyObject *BezTriple_CreatePyObject( BezTriple * bzt )
-{
- BPy_BezTriple *pybeztriple;
-
- pybeztriple =
- ( BPy_BezTriple * ) PyObject_NEW( BPy_BezTriple, &BezTriple_Type );
-
- if( !pybeztriple )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create BPy_BezTriple object" );
-
- pybeztriple->beztriple = bzt;
- pybeztriple->own_memory = 0;
-
- return ( PyObject * ) pybeztriple;
-}
-
-
-/*****************************************************************************/
-/* Function: BezTriple_FromPyObject */
-/* Description: This function returns the Blender beztriple from the given */
-/* PyObject. */
-/*****************************************************************************/
-BezTriple *BezTriple_FromPyObject( PyObject * pyobj )
-{
- return ( ( BPy_BezTriple * ) pyobj )->beztriple;
-}
-
-
-/*
- Create a new BezTriple
- input args is a sequence - either 3 or 9 floats
-*/
-
-PyObject *newBezTriple( float *numbuf )
-{
- int i, j, num;
- PyObject *pyobj = NULL;
- BezTriple *bzt = NULL;
-
- /* create our own beztriple data */
- bzt = MEM_callocN( sizeof( BezTriple ), "new bpytriple");
-
- /* check malloc */
- if( !bzt )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "MEM_callocN failed");
-
- /* copy the data */
- num = 0;
- for( i = 0; i < 3; i++ ) {
- for( j = 0; j < 3; j++) {
- bzt->vec[i][j] = numbuf[num++];
- }
- }
- bzt->h1 = HD_ALIGN;
- bzt->h2 = HD_ALIGN;
-
- /* wrap it */
- pyobj = BezTriple_CreatePyObject( bzt );
-
- /* we own it. must free later */
- ( ( BPy_BezTriple * )pyobj)->own_memory = 1;
-
- return pyobj;
-}
-
-/* #####DEPRECATED###### */
-
-static PyObject *BezTriple_oldsetPoints( BPy_BezTriple * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)BezTriple_setPoints );
-}
diff --git a/source/blender/python/api2_2x/BezTriple.h b/source/blender/python/api2_2x/BezTriple.h
deleted file mode 100644
index 38c9b88e185..00000000000
--- a/source/blender/python/api2_2x/BezTriple.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * $Id: BezTriple.h 10269 2007-03-15 01:09:14Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Jacques Guignot, Stephen Swaney
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_BEZTRIPLE_H
-#define EXPP_BEZTRIPLE_H
-
-#include <Python.h>
-#include "DNA_curve_types.h"
-
-extern PyTypeObject BezTriple_Type;
-
-/* type check macro */
-#define BPy_BezTriple_Check(o) \
- ( (o)->ob_type == &BezTriple_Type)
-
-/****************************************************************************
- Python BPy_BezTriple structure definition:
-****************************************************************************/
-
-typedef struct {
- PyObject_HEAD /* required python macro */
- BezTriple * beztriple;
- int own_memory; /* true == we own this memory and must delete. */
-} BPy_BezTriple;
-
-/*
- * prototypes
- */
-
-PyObject *BezTriple_CreatePyObject( BezTriple * bzt );
-BezTriple *BezTriple_FromPyObject( PyObject * pyobj );
-PyObject *newBezTriple( float *args );
-PyObject *BezTriple_Init( void );
-
-#endif /* EXPP_BEZTRIPLE_H */
diff --git a/source/blender/python/api2_2x/Blender.c b/source/blender/python/api2_2x/Blender.c
deleted file mode 100644
index 05eb82802b8..00000000000
--- a/source/blender/python/api2_2x/Blender.c
+++ /dev/null
@@ -1,1004 +0,0 @@
-/*
- * $Id: Blender.c 12702 2007-11-27 23:15:51Z campbellbarton $
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Michel Selten, Willian P. Germano, Joseph Gilbert,
- * Campbell Barton
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-struct ID; /*keep me up here */
-
-#include "Blender.h" /*This must come first */
-
-/* for open, close in Blender_Load */
-#include <fcntl.h>
-#include "BDR_editobject.h" /* exit_editmode() */
-#include "BIF_usiblender.h"
-#include "BLI_blenlib.h"
-#include "BLO_writefile.h"
-#include "BKE_blender.h"
-#include "BKE_exotic.h"
-#include "BKE_global.h"
-#include "BKE_packedFile.h"
-#include "BKE_utildefines.h"
-#include "BKE_object.h"
-#include "BKE_scene.h"
-#include "BKE_text.h"
-#include "BKE_ipo.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
-#include "BPI_script.h"
-#include "BSE_headerbuttons.h"
-#include "DNA_screen_types.h" /* for SPACE_VIEW3D */
-#include "DNA_userdef_types.h"
-#include "DNA_packedFile_types.h"
-#include "EXPP_interface.h" /* for bpy_gethome() */
-#include "gen_utils.h"
-#include "modules.h"
-#include "constant.h"
-#include "../BPY_extern.h" /* BPY_txt_do_python_Text */
-#include "../BPY_menus.h" /* to update menus */
-#include "Armature.h"
-#include "BezTriple.h"
-#include "Camera.h"
-#include "Constraint.h"
-#include "Curve.h"
-#include "CurNurb.h"
-#include "Draw.h"
-#include "Effect.h"
-#include "Ipo.h"
-#include "Ipocurve.h"
-#include "IDProp.h"
-#include "Key.h"
-#include "Lamp.h"
-#include "Lattice.h"
-#include "Library.h"
-#include "Mathutils.h"
-#include "Geometry.h"
-#include "Mesh.h"
-#include "Metaball.h"
-#include "Modifier.h"
-#include "NMesh.h"
-#include "Object.h"
-#include "Group.h"
-#include "Registry.h"
-#include "Scene.h"
-#include "Sound.h"
-#include "SurfNurb.h"
-#include "Sys.h"
-#include "Text.h"
-#include "Texture.h"
-#include "Window.h"
-#include "World.h"
-#include "Types.h"
-
-/**********************************************************/
-/* Python API function prototypes for the Blender module. */
-/**********************************************************/
-static PyObject *Blender_Set( PyObject * self, PyObject * args );
-static PyObject *Blender_Get( PyObject * self, PyObject * value );
-static PyObject *Blender_Redraw( PyObject * self, PyObject * args );
-static PyObject *Blender_Quit( PyObject * self );
-static PyObject *Blender_Load( PyObject * self, PyObject * args );
-static PyObject *Blender_Save( PyObject * self, PyObject * args );
-static PyObject *Blender_Run( PyObject * self, PyObject * value );
-static PyObject *Blender_ShowHelp( PyObject * self, PyObject * script );
-static PyObject *Blender_UpdateMenus( PyObject * self);
-static PyObject *Blender_PackAll( PyObject * self);
-static PyObject *Blender_UnpackAll( PyObject * self, PyObject * value);
-static PyObject *Blender_CountPackedFiles( PyObject * self );
-
-extern PyObject *Text3d_Init( void ); /* missing in some include */
-
-/*****************************************************************************/
-/* The following string definitions are used for documentation strings. */
-/* In Python these will be written to the console when doing a */
-/* Blender.__doc__ */
-/*****************************************************************************/
-static char Blender_Set_doc[] =
- "(request, data) - Update settings in Blender\n\
-\n\
-(request) A string identifying the setting to change\n\
- 'curframe' - Sets the current frame using the number in data";
-
-static char Blender_Get_doc[] = "(request) - Retrieve settings from Blender\n\
-\n\
-(request) A string indentifying the data to be returned\n\
- 'curframe' - Returns the current animation frame\n\
- 'curtime' - Returns the current animation time\n\
- 'staframe' - Returns the start frame of the animation\n\
- 'endframe' - Returns the end frame of the animation\n\
- 'filename' - Returns the name of the last file read or written\n\
- 'homedir' - Returns Blender's home dir\n\
- 'datadir' - Returns the dir where scripts can save their data, if available\n\
- 'scriptsdir' - Returns the main dir where scripts are kept, if available\n\
- 'uscriptsdir' - Returns the user defined dir for scripts, if available\n\
- 'version' - Returns the Blender version number";
-
-static char Blender_Redraw_doc[] = "() - Redraw all 3D windows";
-
-static char Blender_Quit_doc[] =
- "() - Quit Blender. The current data is saved as 'quit.blend' before leaving.";
-
-static char Blender_Load_doc[] = "(filename) - Load the given file.\n\
-Supported formats:\n\
-Blender, DXF, Inventor 1.0 ASCII, VRML 1.0 asc, STL, Videoscape, radiogour.\n\
-\n\
-Notes:\n\
-1 - () - an empty argument loads the default .B.blend file;\n\
-2 - if the substring '.B.blend' occurs inside 'filename', the default\n\
-.B.blend file is loaded;\n\
-3 - If a Blender file is loaded the script ends immediately.\n\
-4 - The current data is always preserved as an autosave file, for safety;\n\
-5 - This function only works if the script where it's executed is the\n\
-only one running at the moment.";
-
-static char Blender_Save_doc[] =
- "(filename) - Save data to a file based on the filename's extension.\n\
-Supported are: Blender's .blend and the builtin exporters:\n\
-VRML 1.0 (.wrl), Videoscape (.obj), DXF (.dxf) and STL (.stl)\n\
-(filename) - A filename with one of the supported extensions.\n\
-Note 1: 'filename' should not contain the substring \".B.blend\" in it.\n\
-Note 2: only .blend raises an error if file wasn't saved.\n\
-\tYou can use Blender.sys.exists(filename) to make sure the file was saved\n\
-\twhen writing to one of the other formats.";
-
-static char Blender_Run_doc[] =
- "(script) - Run the given Python script.\n\
-(script) - the path to a file or the name of an available Blender Text.";
-
-static char Blender_ShowHelp_doc[] =
-"(script) - Show help for the given Python script.\n\
- This will try to open the 'Scripts Help Browser' script, so to have\n\
-any help displayed the passed 'script' must be properly documented\n\
-with the expected strings (check API ref docs or any bundled script\n\
-for examples).\n\n\
-(script) - the filename of a script in the default or user defined\n\
- scripts dir (no need to supply the full path name).";
-
-static char Blender_UpdateMenus_doc[] =
- "() - Update the menus where scripts are registered. Only needed for\n\
-scripts that save other new scripts in the default or user defined folders.";
-
-static char Blender_PackAll_doc[] =
-"() - Pack all files.\n\
-All files will packed into the blend file.";
-static char Blender_UnpackAll_doc[] =
-"(mode) - Unpack files.\n\
-All files will be unpacked using specified mode.\n\n\
-(mode) - the unpack mode.";
-
-static char Blender_CountPackedFiles_doc[] =
-"() - Returns the number of packed files.";
-
-/*****************************************************************************/
-/* Python method structure definition. */
-/*****************************************************************************/
-static struct PyMethodDef Blender_methods[] = {
- {"Set", Blender_Set, METH_VARARGS, Blender_Set_doc},
- {"Get", Blender_Get, METH_O, Blender_Get_doc},
- {"Redraw", Blender_Redraw, METH_VARARGS, Blender_Redraw_doc},
- {"Quit", ( PyCFunction ) Blender_Quit, METH_NOARGS, Blender_Quit_doc},
- {"Load", Blender_Load, METH_VARARGS, Blender_Load_doc},
- {"Save", Blender_Save, METH_VARARGS, Blender_Save_doc},
- {"Run", Blender_Run, METH_O, Blender_Run_doc},
- {"ShowHelp", Blender_ShowHelp, METH_O, Blender_ShowHelp_doc},
- {"CountPackedFiles", ( PyCFunction ) Blender_CountPackedFiles, METH_NOARGS, Blender_CountPackedFiles_doc},
- {"PackAll", ( PyCFunction ) Blender_PackAll, METH_NOARGS, Blender_PackAll_doc},
- {"UnpackAll", Blender_UnpackAll, METH_O, Blender_UnpackAll_doc},
- {"UpdateMenus", ( PyCFunction ) Blender_UpdateMenus, METH_NOARGS,
- Blender_UpdateMenus_doc},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Global variables */
-/*****************************************************************************/
-PyObject *g_blenderdict;
-
-/*****************************************************************************/
-/* Function: Blender_Set */
-/* Python equivalent: Blender.Set */
-/*****************************************************************************/
-static PyObject *Blender_Set( PyObject * self, PyObject * args )
-{
- char *name, *dir = NULL;
- PyObject *arg;
-
- if( !PyArg_ParseTuple( args, "sO", &name, &arg ) )
- return EXPP_ReturnPyObjError( PyExc_ValueError, "expected 2 args, where the first is always a string" );
-
- if( StringEqual( name, "curframe" ) ) {
- if( !PyInt_Check( arg ) )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "expected an integer" );
-
- G.scene->r.cfra = (short)PyInt_AsLong( arg ) ;
-
- /* update all objects, so python scripts can export all objects
- in a scene without worrying about the view layers */
- scene_update_for_newframe(G.scene, (1<<20) - 1);
-
- } else if (StringEqual( name , "uscriptsdir" ) ) {
- if ( !PyArg_Parse( arg , "s" , &dir ))
- return EXPP_ReturnPyObjError( PyExc_ValueError, "expected a string" );
- BLI_strncpy(U.pythondir, dir, FILE_MAXDIR);
- } else if (StringEqual( name , "yfexportdir" ) ) {
- if ( !PyArg_Parse( arg , "s" , &dir ))
- return EXPP_ReturnPyObjError( PyExc_ValueError, "expected a string" );
- BLI_strncpy(U.yfexportdir, dir, FILE_MAXDIR);
- } else if (StringEqual( name , "fontsdir" ) ) {
- if ( !PyArg_Parse( arg , "s" , &dir ))
- return EXPP_ReturnPyObjError( PyExc_ValueError, "expected a string" );
- BLI_strncpy(U.fontdir, dir, FILE_MAXDIR);
- } else if (StringEqual( name , "texturesdir" ) ) {
- if ( !PyArg_Parse( arg , "s" , &dir ))
- return EXPP_ReturnPyObjError( PyExc_ValueError, "expected a string" );
- BLI_strncpy(U.textudir, dir, FILE_MAXDIR);
- } else if (StringEqual( name , "texpluginsdir" ) ) {
- if ( !PyArg_Parse( arg , "s" , &dir ))
- return EXPP_ReturnPyObjError( PyExc_ValueError, "expected a string" );
- BLI_strncpy(U.plugtexdir, dir, FILE_MAXDIR);
- } else if (StringEqual( name , "seqpluginsdir" ) ) {
- if ( !PyArg_Parse( arg , "s" , &dir ))
- return EXPP_ReturnPyObjError( PyExc_ValueError, "expected a string" );
- BLI_strncpy(U.plugseqdir, dir, FILE_MAXDIR);
- } else if (StringEqual( name , "renderdir" ) ) {
- if ( !PyArg_Parse( arg , "s" , &dir ))
- return EXPP_ReturnPyObjError( PyExc_ValueError, "expected a string" );
- BLI_strncpy(U.renderdir, dir, FILE_MAXDIR);
- } else if (StringEqual( name , "soundsdir" ) ) {
- if ( !PyArg_Parse( arg , "s" , &dir ))
- return EXPP_ReturnPyObjError( PyExc_ValueError, "expected a string" );
- BLI_strncpy(U.sounddir, dir, FILE_MAXDIR);
- } else if (StringEqual( name , "tempdir" ) ) {
- if ( !PyArg_Parse( arg , "s" , &dir ))
- return EXPP_ReturnPyObjError( PyExc_ValueError, "expected a string" );
- BLI_strncpy(U.tempdir, dir, FILE_MAXDIR);
- } else if (StringEqual( name , "compressfile" ) ) {
- int value = PyObject_IsTrue( arg );
-
- if (value==-1)
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "expected an integer" );
-
- if (value)
- U.flag |= USER_FILECOMPRESS;
- else
- U.flag &= ~USER_FILECOMPRESS;
-
- }else
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "value given is not a blender setting" ) );
- Py_RETURN_NONE;
-}
-
-/*****************************************************************************/
-/* Function: Blender_Get */
-/* Python equivalent: Blender.Get */
-/*****************************************************************************/
-static PyObject *Blender_Get( PyObject * self, PyObject * value )
-{
- PyObject *ret = NULL;
- char *str = PyString_AsString(value);
-
- if( !str )
- return EXPP_ReturnPyObjError (PyExc_TypeError,
- "expected string argument");
-
- if( StringEqual( str, "curframe" ) )
- ret = PyInt_FromLong( G.scene->r.cfra );
- else if( StringEqual( str, "curtime" ) )
- ret = PyFloat_FromDouble( frame_to_float( G.scene->r.cfra ) );
- else if( StringEqual( str, "rt" ) )
- ret = PyInt_FromLong( (long)frame_to_float( G.rt ) );
- else if( StringEqual( str, "staframe" ) )
- ret = PyInt_FromLong( G.scene->r.sfra );
- else if( StringEqual( str, "endframe" ) )
- ret = PyInt_FromLong( G.scene->r.efra );
- else if( StringEqual( str, "filename" ) ) {
- if ( strstr(G.main->name, ".B.blend") != 0)
- ret = PyString_FromString("");
- else
- ret = PyString_FromString(G.main->name);
- }
- else if( StringEqual( str, "homedir" ) ) {
- char *hdir = bpy_gethome(0);
- if( hdir && BLI_exists( hdir ))
- ret = PyString_FromString( hdir );
- else
- ret = EXPP_incr_ret( Py_None );
- }
- else if( StringEqual( str, "datadir" ) ) {
- char datadir[FILE_MAXDIR];
- char *sdir = bpy_gethome(1);
-
- if (sdir) {
- BLI_make_file_string( "/", datadir, sdir, "bpydata" );
- if( BLI_exists( datadir ) )
- ret = PyString_FromString( datadir );
- }
- if (!ret) ret = EXPP_incr_ret( Py_None );
- }
- else if(StringEqual(str, "udatadir")) {
- if (U.pythondir[0] != '\0') {
- char upydir[FILE_MAXDIR];
-
- BLI_strncpy(upydir, U.pythondir, FILE_MAXDIR);
- BLI_convertstringcode(upydir, G.sce, 0);
-
- if (BLI_exists(upydir)) {
- char udatadir[FILE_MAXDIR];
-
- BLI_make_file_string("/", udatadir, upydir, "bpydata");
-
- if (BLI_exists(udatadir))
- ret = PyString_FromString(udatadir);
- }
- }
- if (!ret) ret = EXPP_incr_ret(Py_None);
- }
- else if( StringEqual( str, "scriptsdir" ) ) {
- char *sdir = bpy_gethome(1);
-
- if (sdir)
- ret = PyString_FromString(sdir);
- else
- ret = EXPP_incr_ret( Py_None );
- }
- else if( StringEqual( str, "uscriptsdir" ) ) {
- if (U.pythondir[0] != '\0') {
- char upydir[FILE_MAXDIR];
-
- BLI_strncpy(upydir, U.pythondir, FILE_MAXDIR);
- BLI_convertstringcode(upydir, G.sce, 0);
-
- if( BLI_exists( upydir ) )
- ret = PyString_FromString( upydir );
- }
- if (!ret) ret = EXPP_incr_ret(Py_None);
- }
- /* USER PREFS: */
- else if( StringEqual( str, "yfexportdir" ) ) {
- if (U.yfexportdir[0] != '\0') {
- char yfexportdir[FILE_MAXDIR];
-
- BLI_strncpy(yfexportdir, U.yfexportdir, FILE_MAXDIR);
- BLI_convertstringcode(yfexportdir, G.sce, 0);
-
- if( BLI_exists( yfexportdir ) )
- ret = PyString_FromString( yfexportdir );
- }
- if (!ret) ret = EXPP_incr_ret(Py_None);
- }
- /* fontsdir */
- else if( StringEqual( str, "fontsdir" ) ) {
- if (U.fontdir[0] != '\0') {
- char fontdir[FILE_MAXDIR];
-
- BLI_strncpy(fontdir, U.fontdir, FILE_MAXDIR);
- BLI_convertstringcode(fontdir, G.sce, 0);
-
- if( BLI_exists( fontdir ) )
- ret = PyString_FromString( fontdir );
- }
- if (!ret) ret = EXPP_incr_ret(Py_None);
- }
- /* texturesdir */
- else if( StringEqual( str, "texturesdir" ) ) {
- if (U.textudir[0] != '\0') {
- char textudir[FILE_MAXDIR];
-
- BLI_strncpy(textudir, U.textudir, FILE_MAXDIR);
- BLI_convertstringcode(textudir, G.sce, 0);
-
- if( BLI_exists( textudir ) )
- ret = PyString_FromString( textudir );
- }
- if (!ret) ret = EXPP_incr_ret(Py_None);
- }
- /* texpluginsdir */
- else if( StringEqual( str, "texpluginsdir" ) ) {
- if (U.plugtexdir[0] != '\0') {
- char plugtexdir[FILE_MAXDIR];
-
- BLI_strncpy(plugtexdir, U.plugtexdir, FILE_MAXDIR);
- BLI_convertstringcode(plugtexdir, G.sce, 0);
-
- if( BLI_exists( plugtexdir ) )
- ret = PyString_FromString( plugtexdir );
- }
- if (!ret) ret = EXPP_incr_ret(Py_None);
- }
- /* seqpluginsdir */
- else if( StringEqual( str, "seqpluginsdir" ) ) {
- if (U.plugseqdir[0] != '\0') {
- char plugseqdir[FILE_MAXDIR];
-
- BLI_strncpy(plugseqdir, U.plugseqdir, FILE_MAXDIR);
- BLI_convertstringcode(plugseqdir, G.sce, 0);
-
- if( BLI_exists( plugseqdir ) )
- ret = PyString_FromString( plugseqdir );
- }
- if (!ret) ret = EXPP_incr_ret(Py_None);
- }
- /* renderdir */
- else if( StringEqual( str, "renderdir" ) ) {
- if (U.renderdir[0] != '\0') {
- char renderdir[FILE_MAXDIR];
-
- BLI_strncpy(renderdir, U.renderdir, FILE_MAXDIR);
- BLI_convertstringcode(renderdir, G.sce, 0);
-
- if( BLI_exists( renderdir ) )
- ret = PyString_FromString( renderdir );
- }
- if (!ret) ret = EXPP_incr_ret(Py_None);
- }
- /* soundsdir */
- else if( StringEqual( str, "soundsdir" ) ) {
- if (U.sounddir[0] != '\0') {
- char sounddir[FILE_MAXDIR];
-
- BLI_strncpy(sounddir, U.sounddir, FILE_MAXDIR);
- BLI_convertstringcode(sounddir, G.sce, 0);
-
- if( BLI_exists( sounddir ) )
- ret = PyString_FromString( sounddir );
- }
- if (!ret) ret = EXPP_incr_ret(Py_None);
- }
- /* tempdir */
- else if( StringEqual( str, "tempdir" ) ) {
- if (U.tempdir[0] != '\0') {
- char tempdir[FILE_MAXDIR];
-
- BLI_strncpy(tempdir, U.tempdir, FILE_MAXDIR);
- BLI_convertstringcode(tempdir, G.sce, 0);
-
- if( BLI_exists( tempdir ) )
- ret = PyString_FromString( tempdir );
- }
- if (!ret) ret = EXPP_incr_ret(Py_None);
- }
- /* icondir */
- else if( StringEqual( str, "icondir" ) ) {
-
- char icondirstr[FILE_MAXDIR];
-
- #ifdef WIN32
- BLI_make_file_string("/", icondirstr, BLI_gethome(), "icons");
- #else
- BLI_make_file_string("/", icondirstr, BLI_gethome(), ".blender/icons");
- #endif
-
- if( BLI_exists( icondirstr ) )
- ret = PyString_FromString( icondirstr );
-
- if (!ret) ret = EXPP_incr_ret(Py_None);
- }
- /* According to the old file (opy_blender.c), the following if
- statement is a quick hack and needs some clean up. */
- else if( StringEqual( str, "vrmloptions" ) ) {
- ret = PyDict_New( );
-
- EXPP_dict_set_item_str( ret, "twoside",
- PyInt_FromLong( U.vrmlflag & USER_VRML_TWOSIDED ) );
-
- EXPP_dict_set_item_str( ret, "layers",
- PyInt_FromLong( U.vrmlflag & USER_VRML_LAYERS ) );
-
- EXPP_dict_set_item_str( ret, "autoscale",
- PyInt_FromLong( U.vrmlflag & USER_VRML_AUTOSCALE ) );
-
- } /* End 'quick hack' part. */
- else if(StringEqual( str, "version" ))
- ret = PyInt_FromLong( G.version );
-
- else if(StringEqual( str, "compressfile" ))
- ret = PyInt_FromLong( (U.flag & USER_FILECOMPRESS) >> 15 );
-
- else
- return EXPP_ReturnPyObjError( PyExc_AttributeError, "unknown attribute" );
-
- if (ret) return ret;
- else
- return EXPP_ReturnPyObjError (PyExc_MemoryError,
- "could not create pystring!");
-}
-
-/*****************************************************************************/
-/* Function: Blender_Redraw */
-/* Python equivalent: Blender.Redraw */
-/*****************************************************************************/
-static PyObject *Blender_Redraw( PyObject * self, PyObject * args )
-{
- return M_Window_Redraw( self, args );
-}
-
-/*****************************************************************************/
-/* Function: Blender_Quit */
-/* Python equivalent: Blender.Quit */
-/*****************************************************************************/
-static PyObject *Blender_Quit( PyObject * self )
-{
- BIF_write_autosave( ); /* save the current data first */
-
- exit_usiblender( ); /* renames last autosave to quit.blend */
-
- Py_RETURN_NONE;
-}
-
-/**
- * Blender.Load
- * loads Blender's .blend, DXF, radiogour(?), STL, Videoscape,
- * Inventor 1.0 ASCII, VRML 1.0 asc.
- */
-static PyObject *Blender_Load( PyObject * self, PyObject * args )
-{
- char *fname = NULL;
- int keep_oldfname = 0;
- Script *script = NULL;
- char str[32], name[FILE_MAXDIR];
- int file, is_blend_file = 0;
-
- if( !PyArg_ParseTuple( args, "|si", &fname, &keep_oldfname ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected filename and optional int or nothing as arguments" );
-
- if( fname ) {
- if( strlen( fname ) > FILE_MAXDIR ) /* G.main->name's max length */
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "filename too long!" );
- else if( !BLI_exists( fname ) )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "requested file doesn't exist!" );
-
- if( keep_oldfname )
- BLI_strncpy( name, G.sce, FILE_MAXDIR );
- }
-
- /* We won't let a new .blend file be loaded if there are still other
- * scripts running, since loading a new file will close and remove them. */
-
- if( G.main->script.first != G.main->script.last )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "there are other scripts running at the Scripts win, close them first!" );
-
- if( fname ) {
- file = open( fname, O_BINARY | O_RDONLY );
-
- if( file <= 0 ) {
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "cannot open file!" );
- } else {
- read( file, str, 31 );
- close( file );
-
- if( strncmp( str, "BLEN", 4 ) == 0 )
- is_blend_file = 1;
- }
- } else
- is_blend_file = 1; /* no arg given means default: .B.blend */
-
- if( is_blend_file ) {
-
- int during_slink = during_scriptlink( );
-
- /* when loading a .blend file from a scriptlink, the scriptlink pointer
- * in BPY_do_pyscript becomes invalid during a loop. Inform it here.
- * Also do not allow a nested scriptlink (called from inside another)
- * to load .blend files, to avoid nasty problems. */
- if( during_slink >= 1 ) {
- if( during_slink == 1 )
- disable_where_scriptlink( -1 );
- else {
- return EXPP_ReturnPyObjError
- ( PyExc_EnvironmentError,
- "Blender.Load: cannot load .blend files from a nested scriptlink." );
- }
- }
-
- /* trick: mark the script so that its script struct won't be freed after
- * the script is executed (to avoid a double free warning on exit): */
- script = G.main->script.first;
- if( script )
- script->flags |= SCRIPT_GUI;
-
- BIF_write_autosave( ); /* for safety let's preserve the current data */
- }
-
- if( G.obedit )
- exit_editmode(EM_FREEDATA);
-
- if (G.background) { /* background mode */
- if (is_blend_file)
- BKE_read_file(fname, NULL);
- else {
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "only .blend files can be loaded from command line,\n\
- other file types require interactive mode.");
- }
- }
- else { /* interactive mode */
- /* for safety, any filename with .B.blend is considered the default one.
- * It doesn't seem necessary to compare file attributes (like st_ino and
- * st_dev, according to the glibc info pages) to find out if the given
- * filename, that may have been given with a twisted misgiving path, is the
- * default one for sure. Taking any .B.blend file as the default is good
- * enough here. Note: the default file requires extra clean-up done by
- * BIF_read_homefile: freeing the user theme data. */
- if( !fname || ( strstr( fname, ".B.blend" ) && is_blend_file ) )
- BIF_read_homefile(0);
- else
- BIF_read_file( fname );
-
- if( fname && keep_oldfname ) {
- /*BLI_strncpy(G.main->name, name, FILE_MAXDIR); */
- BLI_strncpy( G.sce, name, FILE_MAXDIR );
- }
- }
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Blender_Save( PyObject * self, PyObject * args )
-{
- char *fname = NULL;
- int overwrite = 0, len = 0;
- char *error = NULL;
- Library *li;
-
- if( !PyArg_ParseTuple( args, "s|i", &fname, &overwrite ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected filename and optional int (overwrite flag) as arguments" );
-
- for( li = G.main->library.first; li; li = li->id.next ) {
- if( BLI_streq( li->name, fname ) ) {
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "cannot overwrite used library" );
- }
- }
-
- /* for safety, any filename with .B.blend is considered the default one
- * and not accepted here. */
- if( strstr( fname, ".B.blend" ) )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "filename can't contain the substring \".B.blend\" in it." );
-
- len = strlen( fname );
-
- if( len > FILE_MAXDIR + FILE_MAXFILE )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "filename is too long!" );
- else if( BLI_exists( fname ) && !overwrite )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "file already exists and overwrite flag was not given." );
-
- disable_where_script( 1 ); /* to avoid error popups in the write_* functions */
-
- if( BLI_testextensie( fname, ".blend" ) ) {
- int writeflags;
- if( G.fileflags & G_AUTOPACK )
- packAll( );
-
- writeflags= G.fileflags & ~G_FILE_COMPRESS;
- if(U.flag & USER_FILECOMPRESS)
- writeflags |= G_FILE_COMPRESS;
-
- if( !BLO_write_file( fname, writeflags, &error ) ) {
- disable_where_script( 0 );
- return EXPP_ReturnPyObjError( PyExc_SystemError,
- error );
- }
- } else if( BLI_testextensie( fname, ".dxf" ) )
- write_dxf( fname );
- else if( BLI_testextensie( fname, ".stl" ) )
- write_stl( fname );
- else if( BLI_testextensie( fname, ".wrl" ) )
- write_vrml( fname );
- else if( BLI_testextensie( fname, ".obj" ) )
- write_videoscape( fname );
- else {
- disable_where_script( 0 );
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "unknown file extension." );
- }
-
- disable_where_script( 0 );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Blender_ShowHelp(PyObject *self, PyObject *script)
-{
- char hspath[FILE_MAXDIR + FILE_MAXFILE]; /* path to help_browser.py */
- char *sdir = bpy_gethome(1);
- PyObject *rkeyd = NULL, *arglist = NULL;
-
- if (!PyString_Check(script))
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "expected a script filename as argument");
-
- /* first we try to find the help_browser script */
-
- if (sdir) BLI_make_file_string("/", hspath, sdir, "help_browser.py");
-
- if (!sdir || (!BLI_exists(hspath) && (U.pythondir[0] != '\0'))) {
- char upydir[FILE_MAXDIR];
-
- BLI_strncpy(upydir, U.pythondir, FILE_MAXDIR);
- BLI_convertstringcode(upydir, G.sce, 0);
- BLI_make_file_string("/", hspath, upydir, "help_browser.py");
-
- if (!BLI_exists(hspath))
- return EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "can't find script help_browser.py");
- }
-
- /* now we store the passed script in the registry dict and call the
- * help_browser to show help info for it */
- rkeyd = PyDict_New();
- if (!rkeyd)
- return EXPP_ReturnPyObjError(PyExc_MemoryError,
- "can't create py dictionary!");
-
- /* note: don't use EXPP_dict_set_item_str for 'script', which is an
- * argument to the function we're in and so shouldn't be decref'ed: */
- PyDict_SetItemString(rkeyd, "script", script);
-
- EXPP_dict_set_item_str(bpy_registryDict, "__help_browser", rkeyd);
-
- arglist = Py_BuildValue("(s)", hspath);
- Blender_Run(self, arglist);
- Py_DECREF(arglist);
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Blender_Run(PyObject *self, PyObject *value)
-{
- char *fname = PyString_AsString(value);
- Text *text = NULL;
- int is_blender_text = 0;
- Script *script = NULL;
-
- if (!fname)
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "expected a filename or a Blender Text name as argument");
-
- if (!BLI_exists(fname)) { /* if there's no such filename ... */
- text = G.main->text.first; /* try an already existing Blender Text */
-
- while (text) {
- if (!strcmp(fname, text->id.name + 2)) break;
- text = text->id.next;
- }
-
- if (!text) {
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "no such file or Blender text");
- }
- else is_blender_text = 1; /* fn is already a Blender Text */
- }
-
- else {
- text = add_text(fname);
-
- if (!text) {
- return EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "couldn't create Blender Text from given file");
- }
- }
-
- /* (this is messy, check Draw.c's Method_Register and Window.c's file
- * selector for more info)
- * - caller script is the one that called this Blender_Run function;
- * - called script is the argument to this function: fname;
- * To mark scripts whose global dicts can't be freed right after
- * the script execution (or better, 'first pass', since these scripts
- * leave callbacks for gui or file/image selectors) we flag them. But to
- * get a pointer to them we need to check which one is currently
- * running (if none we're already at a spacescript). To make sure only
- * the called script will have the SCRIPT_RUNNING flag on, we unset it
- * for the caller script here: */
- script = G.main->script.first;
- while (script) {
- if (script->flags & SCRIPT_RUNNING) break;
- script = script->id.next;
- }
-
- if (script) script->flags &= ~SCRIPT_RUNNING; /* unset */
-
- BPY_txt_do_python_Text(text); /* call new script */
-
- if (script) script->flags |= SCRIPT_RUNNING; /* set */
-
- if (!is_blender_text) free_libblock(&G.main->text, text);
-
- Py_RETURN_NONE;
-}
-
-static PyObject * Blender_UpdateMenus( PyObject * self )
-{
-
- BPyMenu_RemoveAllEntries();
-
- if (BPyMenu_Init(1) == -1)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "invalid scripts dir");
-
- Py_RETURN_NONE;
-}
-
-/*****************************************************************************/
-/* Function: Blender_PackAll */
-/* Python equivalent: Blender.PackAll */
-/*****************************************************************************/
-static PyObject *Blender_PackAll( PyObject * self)
-{
- packAll();
- Py_RETURN_NONE;
-}
-
-/*****************************************************************************/
-/* Function: Blender_UnpackAll */
-/* Python equivalent: Blender.UnpackAll */
-/*****************************************************************************/
-static PyObject *Blender_UnpackAll( PyObject * self, PyObject *value)
-{
- int mode = PyInt_AsLong(value);
-
- if (mode==-1)
- return EXPP_ReturnPyObjError( PyExc_ValueError, "expected an int Blender.UnpackModes");
- unpackAll(mode);
- Py_RETURN_NONE;
-}
-
-/*****************************************************************************/
-/* Function: Blender_CountPackedFiles */
-/* Python equivalent: Blender.CountPackedFiles */
-/*****************************************************************************/
-static PyObject *Blender_CountPackedFiles( PyObject * self )
-{
- int nfiles = countPackedFiles();
- return PyInt_FromLong( nfiles );
-}
-static PyObject *Blender_UnpackModesDict( void )
-{
- PyObject *UnpackModes = PyConstant_New( );
- if( UnpackModes ) {
- BPy_constant *d = ( BPy_constant * ) UnpackModes;
- PyConstant_Insert( d, "EQUAL", PyInt_FromLong((long)PF_EQUAL) );
- PyConstant_Insert( d, "DIFFERS",PyInt_FromLong((long)PF_DIFFERS) );
- PyConstant_Insert( d, "NOFILE", PyInt_FromLong((long)PF_NOFILE) );
- PyConstant_Insert( d, "WRITE_ORIGINAL", PyInt_FromLong((long)PF_WRITE_ORIGINAL) );
- PyConstant_Insert( d, "WRITE_LOCAL", PyInt_FromLong((long)PF_WRITE_LOCAL) );
- PyConstant_Insert( d, "USE_LOCAL", PyInt_FromLong((long)PF_USE_LOCAL) );
- PyConstant_Insert( d, "USE_ORIGINAL", PyInt_FromLong((long)PF_USE_ORIGINAL) );
- PyConstant_Insert( d, "KEEP", PyInt_FromLong((long)PF_KEEP) );
- PyConstant_Insert( d, "NOOP", PyInt_FromLong((long)PF_NOOP) );
- PyConstant_Insert( d, "ASK", PyInt_FromLong((long)PF_EQUAL) );
- }
- return UnpackModes;
-}
-
-/*****************************************************************************/
-/* Function: initBlender */
-/*****************************************************************************/
-
-void M_Blender_Init(void)
-{
- PyObject *module;
- PyObject *dict, *smode, *SpaceHandlers, *UnpackModes;
-
- /* G.scene should only aver be NULL if blender is executed in
- background mode, not loading a blend file and executing a python script eg.
- blender -P somescript.py -b
- The if below solves the segfaults that happen when python runs and
- G.scene is NULL */
- if(G.background && G.main->scene.first==NULL) {
- Scene *sce= add_scene("1");
- /*set_scene(sce);*/ /* causes a crash */
- G.scene= sce;
- }
-
- module = Py_InitModule3("Blender", Blender_methods,
- "The main Blender module");
-
- types_InitAll(); /* set all our pytypes to &PyType_Type */
-
- /* constants for packed files*/
- UnpackModes = Blender_UnpackModesDict( );
- if( UnpackModes )
- PyModule_AddObject( module, "UnpackModes", UnpackModes );
-
- SpaceHandlers = PyConstant_New();
- if (SpaceHandlers) {
- BPy_constant *d = (BPy_constant *)SpaceHandlers;
-
- PyConstant_Insert(d,"VIEW3D_EVENT",PyInt_FromLong(SPACEHANDLER_VIEW3D_EVENT));
- PyConstant_Insert(d,"VIEW3D_DRAW", PyInt_FromLong(SPACEHANDLER_VIEW3D_DRAW));
-
- PyModule_AddObject(module, "SpaceHandlers", SpaceHandlers);
- }
-
- if (G.background)
- smode = PyString_FromString("background");
- else
- smode = PyString_FromString("interactive");
-
- dict = PyModule_GetDict(module);
- g_blenderdict = dict;
-
- PyModule_AddIntConstant(module, "TRUE", 1);
- PyModule_AddIntConstant( module, "FALSE", 0 );
-
- EXPP_dict_set_item_str(dict, "bylink", EXPP_incr_ret_False());
- PyDict_SetItemString(dict, "link", Py_None);
- EXPP_dict_set_item_str(dict, "event", PyString_FromString(""));
- EXPP_dict_set_item_str(dict, "mode", smode);
-
- PyDict_SetItemString(dict, "Armature", Armature_Init());
- PyDict_SetItemString(dict, "BezTriple", BezTriple_Init());
- PyDict_SetItemString(dict, "BGL", BGL_Init());
- PyDict_SetItemString(dict, "CurNurb", CurNurb_Init());
- PyDict_SetItemString(dict, "Constraint", Constraint_Init());
- PyDict_SetItemString(dict, "Curve", Curve_Init());
- PyDict_SetItemString(dict, "Camera", Camera_Init());
- PyDict_SetItemString(dict, "Draw", Draw_Init());
- PyDict_SetItemString(dict, "Effect", Effect_Init());
- PyDict_SetItemString(dict, "Ipo", Ipo_Init());
- PyDict_SetItemString(dict, "IpoCurve", IpoCurve_Init());
- PyDict_SetItemString(dict, "Image", Image_Init());
- PyDict_SetItemString(dict, "Key", Key_Init());
- PyDict_SetItemString(dict, "Lamp", Lamp_Init());
- PyDict_SetItemString(dict, "Lattice", Lattice_Init());
- PyDict_SetItemString(dict, "Library", oldLibrary_Init());
- PyDict_SetItemString(dict, "Material", Material_Init());
- PyDict_SetItemString(dict, "Mesh", Mesh_Init());
- PyDict_SetItemString(dict, "Metaball", Metaball_Init());
- PyDict_SetItemString(dict, "Mathutils", Mathutils_Init());
- PyDict_SetItemString(dict, "Geometry", Geometry_Init());
- PyDict_SetItemString(dict, "Modifier", Modifier_Init());
- PyDict_SetItemString(dict, "NMesh", NMesh_Init());
- PyDict_SetItemString(dict, "Noise", Noise_Init());
- PyDict_SetItemString(dict, "Object", Object_Init());
- PyDict_SetItemString(dict, "Group", Group_Init());
- PyDict_SetItemString(dict, "Registry", Registry_Init());
- PyDict_SetItemString(dict, "Scene", Scene_Init());
- PyDict_SetItemString(dict, "Sound", Sound_Init());
- PyDict_SetItemString(dict, "SurfNurb", SurfNurb_Init());
- PyDict_SetItemString(dict, "sys", sys_Init());
- PyDict_SetItemString(dict, "Types", Types_Init());
- PyDict_SetItemString(dict, "Text", Text_Init());
- PyDict_SetItemString(dict, "Text3d", Text3d_Init());
- PyDict_SetItemString(dict, "Texture", Texture_Init());
- PyDict_SetItemString(dict, "Window", Window_Init());
- PyDict_SetItemString(dict, "World", World_Init());
-
-}
diff --git a/source/blender/python/api2_2x/Blender.h b/source/blender/python/api2_2x/Blender.h
deleted file mode 100644
index 77f21ed333c..00000000000
--- a/source/blender/python/api2_2x/Blender.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * $Id: Blender.h 4803 2005-07-18 03:50:37Z ascotan $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Michel Selten, Willian P. Germano
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_BLENDER_H
-#define EXPP_BLENDER_H
-
-#include <Python.h>
-
-extern PyObject *g_blenderdict;
-void M_Blender_Init( void );
-
-#endif /* EXPP_BLENDER_H */
diff --git a/source/blender/python/api2_2x/Bone.c b/source/blender/python/api2_2x/Bone.c
deleted file mode 100644
index 704fe20d6db..00000000000
--- a/source/blender/python/api2_2x/Bone.c
+++ /dev/null
@@ -1,1425 +0,0 @@
-/*
- * $Id: Bone.c 12399 2007-10-26 08:19:40Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * Contributor(s): Joseph Gilbert
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#include "Bone.h"
-#include "vector.h"
-#include "matrix.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BKE_utildefines.h"
-#include "gen_utils.h"
-#include "BKE_armature.h"
-#include "Mathutils.h"
-#include "BKE_library.h"
-
-//these must come in this order
-#include "DNA_object_types.h" //1
-#include "BIF_editarmature.h" //2
-
-//------------------------ERROR CODES---------------------------------
-//This is here just to make me happy and to have more consistant error strings :)
-static const char sEditBoneError[] = "EditBone - Error: ";
-// static const char sEditBoneBadArgs[] = "EditBone - Bad Arguments: ";
-static const char sBoneError[] = "Bone - Error: ";
-// static const char sBoneBadArgs[] = "Bone - Bad Arguments: ";
-
-//----------------------(internal)
-//gets the bone->roll (which is a localspace roll) and puts it in parentspace
-//(which is the 'roll' value the user sees)
-static double boneRoll_ToArmatureSpace(struct Bone *bone)
-{
- float head[3], tail[3], delta[3];
- float premat[3][3], postmat[3][3];
- float imat[3][3], difmat[3][3];
- double roll = 0.0f;
-
- VECCOPY(head, bone->arm_head);
- VECCOPY(tail, bone->arm_tail);
- VECSUB (delta, tail, head);
- vec_roll_to_mat3(delta, 0.0f, postmat);
- Mat3CpyMat4(premat, bone->arm_mat);
- Mat3Inv(imat, postmat);
- Mat3MulMat3(difmat, imat, premat);
-
- roll = atan2(difmat[2][0], difmat[2][2]);
- if (difmat[0][0] < 0.0){
- roll += M_PI;
- }
- return roll; //result is in radians
-}
-
-//################## EditBone_Type ########################
-/*This type is a wrapper for a tempory bone. This is an 'unparented' bone
-*object. The armature->bonebase will be calculated from these temporary
-*python tracked objects.*/
-//####################################################
-
-//------------------METHOD IMPLEMENTATIONS-----------------------------
-//-------------------------EditBone.hasParent()
-static PyObject *EditBone_hasParent(BPy_EditBone *self)
-{
- if (self->editbone){
- if (self->editbone->parent)
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
- }else{
- goto AttributeError;
- }
-
-AttributeError:
- return EXPP_objError(PyExc_AttributeError, "%s%s%s",
- sEditBoneError, ".hasParent: ", "EditBone must be added to the armature first");
-}
-//-------------------------EditBone.clearParent()
-static PyObject *EditBone_clearParent(BPy_EditBone *self)
-{
- if (self->editbone){
- if (self->editbone->parent)
- self->editbone->parent = NULL;
- Py_RETURN_NONE;
- }else{
- goto AttributeError;
- }
-
-AttributeError:
- return EXPP_objError(PyExc_AttributeError, "%s%s%s",
- sEditBoneError, ".clearParent: ", "EditBone must be added to the armature first");
-}
-//------------------ATTRIBUTE IMPLEMENTATION---------------------------
-//------------------------EditBone.name (get)
-static PyObject *EditBone_getName(BPy_EditBone *self, void *closure)
-{
- if (self->editbone)
- return PyString_FromString(self->editbone->name);
- else
- return PyString_FromString(self->name);
-}
-//------------------------EditBone.name (set)
-//check for char[] overflow here...
-static int EditBone_setName(BPy_EditBone *self, PyObject *value, void *closure)
-{
- char *name = "";
-
- if (!PyArg_Parse(value, "s", &name))
- goto AttributeError;
-
- if (self->editbone)
- BLI_strncpy(self->editbone->name, name, 32);
- else
- BLI_strncpy(self->name, name, 32);
- return 0;
-
-AttributeError:
- return EXPP_intError(PyExc_AttributeError, "%s%s%s",
- sEditBoneError, ".name: ", "expects a string");
-}
-//------------------------EditBone.roll (get)
-static PyObject *EditBone_getRoll(BPy_EditBone *self, void *closure)
-{
- if (self->editbone){
- return PyFloat_FromDouble((self->editbone->roll * (180/Py_PI)));
- }else{
- return PyFloat_FromDouble((self->roll * (180/Py_PI)));
- }
-}
-//------------------------EditBone.roll (set)
-static int EditBone_setRoll(BPy_EditBone *self, PyObject *value, void *closure)
-{
- float roll = 0.0f;
-
- if (!PyArg_Parse(value, "f", &roll))
- goto AttributeError;
-
- if (self->editbone){
- self->editbone->roll = (float)(roll * (Py_PI/180));
- }else{
- self->roll = (float)(roll * (Py_PI/180));
- }
- return 0;
-
-AttributeError:
- return EXPP_intError(PyExc_AttributeError, "%s%s%s",
- sEditBoneError, ".roll: ", "expects a float");
-}
-//------------------------EditBone.head (get)
-static PyObject *EditBone_getHead(BPy_EditBone *self, void *closure)
-{
- if (self->editbone){
- return newVectorObject(self->editbone->head, 3, Py_WRAP);
- }else{
- return newVectorObject(self->head, 3, Py_NEW);
- }
-}
-//------------------------EditBone.head (set)
-static int EditBone_setHead(BPy_EditBone *self, PyObject *value, void *closure)
-{
- VectorObject *vec = NULL;
- int x;
-
- if (!PyArg_Parse(value, "O!", &vector_Type, &vec))
- goto AttributeError;
- if (vec->size != 3)
- goto AttributeError2;
-
- if (self->editbone){
- for (x = 0; x < 3; x++){
- self->editbone->head[x] = vec->vec[x];
- }
- }else{
- for (x = 0; x < 3; x++){
- self->head[x] = vec->vec[x];
- }
- }
- return 0;
-
-AttributeError:
- return EXPP_intError(PyExc_AttributeError, "%s%s%s",
- sEditBoneError, ".head: ", "expects a Vector Object");
-
-AttributeError2:
- return EXPP_intError(PyExc_AttributeError, "%s%s%s",
- sEditBoneError, ".head: ", "Vector Object needs to be (x,y,z)");
-}
-//------------------------EditBone.tail (get)
-static PyObject *EditBone_getTail(BPy_EditBone *self, void *closure)
-{
- if (self->editbone){
- return newVectorObject(self->editbone->tail, 3, Py_WRAP);
- }else{
- return newVectorObject(self->tail, 3, Py_NEW);
- }
-}
-//------------------------EditBone.tail (set)
-static int EditBone_setTail(BPy_EditBone *self, PyObject *value, void *closure)
-{
- VectorObject *vec = NULL;
- int x;
-
- if (!PyArg_Parse(value, "O!", &vector_Type, &vec))
- goto AttributeError;
- if (vec->size != 3)
- goto AttributeError2;
-
- if (self->editbone){
- for (x = 0; x < 3; x++){
- self->editbone->tail[x] = vec->vec[x];
- }
- }else{
- for (x = 0; x < 3; x++){
- self->tail[x] = vec->vec[x];
- }
- }
- return 0;
-
-AttributeError:
- return EXPP_intError(PyExc_AttributeError, "%s%s%s",
- sEditBoneError, ".tail: ", "expects a Vector Object");
-
-AttributeError2:
- return EXPP_intError(PyExc_AttributeError, "%s%s%s",
- sEditBoneError, ".tail: ", "Vector Object needs to be (x,y,z)");
-}
-//------------------------EditBone.weight (get)
-static PyObject *EditBone_getWeight(BPy_EditBone *self, void *closure)
-{
- if (self->editbone)
- return PyFloat_FromDouble(self->editbone->weight);
- else
- return PyFloat_FromDouble(self->weight);
-}
-//------------------------EditBone.weight (set)
-static int EditBone_setWeight(BPy_EditBone *self, PyObject *value, void *closure)
-{
- float weight;
-
- if (!PyArg_Parse(value, "f", &weight))
- goto AttributeError;
- CLAMP(weight, 0.0f, 1000.0f);
-
- if (self->editbone)
- self->editbone->weight = weight;
- else
- self->weight = weight;
- return 0;
-
-AttributeError:
- return EXPP_intError(PyExc_AttributeError, "%s%s%s",
- sEditBoneError, ".weight: ", "expects a float");
-}
-//------------------------EditBone.deform_dist (get)
-static PyObject *EditBone_getDeform_dist(BPy_EditBone *self, void *closure)
-{
- if (self->editbone)
- return PyFloat_FromDouble(self->editbone->dist);
- else
- return PyFloat_FromDouble(self->dist);
-}
-//------------------------EditBone.deform_dist (set)
-static int EditBone_setDeform_dist(BPy_EditBone *self, PyObject *value, void *closure)
-{
- float deform;
-
- if (!PyArg_Parse(value, "f", &deform))
- goto AttributeError;
- CLAMP(deform, 0.0f, 1000.0f);
-
- if (self->editbone)
- self->editbone->dist = deform;
- else
- self->dist = deform;
- return 0;
-
-AttributeError:
- return EXPP_intError(PyExc_AttributeError, "%s%s%s",
- sEditBoneError, ".deform_dist: ", "expects a float");
-}
-//------------------------EditBone.subdivisions (get)
-static PyObject *EditBone_getSubdivisions(BPy_EditBone *self, void *closure)
-{
- if (self->editbone)
- return PyInt_FromLong(self->editbone->segments);
- else
- return PyInt_FromLong(self->segments);
-}
-//------------------------EditBone.subdivisions (set)
-static int EditBone_setSubdivisions(BPy_EditBone *self, PyObject *value, void *closure)
-{
- int segs;
-
- if (!PyArg_Parse(value, "i", &segs))
- goto AttributeError;
- CLAMP(segs, 1, 32);
-
- if (self->editbone)
- self->editbone->segments = (short)segs;
- else
- self->segments = (short)segs;
- return 0;
-
-AttributeError:
- return EXPP_intError(PyExc_AttributeError, "%s%s%s",
- sEditBoneError, ".subdivisions: ", "expects a integer");
-}
-//------------------------EditBone.options (get)
-static PyObject *EditBone_getOptions(BPy_EditBone *self, void *closure)
-{
- PyObject *list = NULL;
-
- list = PyList_New(0);
- if (!list)
- goto RuntimeError;
-
- if(self->editbone){
- if(self->editbone->flag & BONE_CONNECTED)
- if (PyList_Append(list,
- EXPP_GetModuleConstant("Blender.Armature", "CONNECTED")) == -1)
- goto RuntimeError;
- if(self->editbone->flag & BONE_HINGE)
- if (PyList_Append(list,
- EXPP_GetModuleConstant("Blender.Armature", "HINGE")) == -1)
- goto RuntimeError;
- if(self->editbone->flag & BONE_NO_DEFORM)
- if (PyList_Append(list,
- EXPP_GetModuleConstant("Blender.Armature", "NO_DEFORM")) == -1)
- goto RuntimeError;
- if(self->editbone->flag & BONE_MULT_VG_ENV)
- if (PyList_Append(list,
- EXPP_GetModuleConstant("Blender.Armature", "MULTIPLY")) == -1)
- goto RuntimeError;
- if(self->editbone->flag & BONE_HIDDEN_A)
- if (PyList_Append(list,
- EXPP_GetModuleConstant("Blender.Armature", "HIDDEN_EDIT")) == -1)
- goto RuntimeError;
- if(self->editbone->flag & BONE_ROOTSEL)
- if (PyList_Append(list,
- EXPP_GetModuleConstant("Blender.Armature", "ROOT_SELECTED")) == -1)
- goto RuntimeError;
- if(self->editbone->flag & BONE_SELECTED)
- if (PyList_Append(list,
- EXPP_GetModuleConstant("Blender.Armature", "BONE_SELECTED")) == -1)
- goto RuntimeError;
- if(self->editbone->flag & BONE_TIPSEL)
- if (PyList_Append(list,
- EXPP_GetModuleConstant("Blender.Armature", "TIP_SELECTED")) == -1)
- goto RuntimeError;
- }else{
- if(self->flag & BONE_CONNECTED)
- if (PyList_Append(list,
- EXPP_GetModuleConstant("Blender.Armature", "CONNECTED")) == -1)
- goto RuntimeError;
- if(self->flag & BONE_HINGE)
- if (PyList_Append(list,
- EXPP_GetModuleConstant("Blender.Armature", "HINGE")) == -1)
- goto RuntimeError;
- if(self->flag & BONE_NO_DEFORM)
- if (PyList_Append(list,
- EXPP_GetModuleConstant("Blender.Armature", "NO_DEFORM")) == -1)
- goto RuntimeError;
- if(self->flag & BONE_MULT_VG_ENV)
- if (PyList_Append(list,
- EXPP_GetModuleConstant("Blender.Armature", "MULTIPLY")) == -1)
- goto RuntimeError;
- if(self->flag & BONE_HIDDEN_A)
- if (PyList_Append(list,
- EXPP_GetModuleConstant("Blender.Armature", "HIDDEN_EDIT")) == -1)
- goto RuntimeError;
- if(self->flag & BONE_ROOTSEL)
- if (PyList_Append(list,
- EXPP_GetModuleConstant("Blender.Armature", "ROOT_SELECTED")) == -1)
- goto RuntimeError;
- if(self->flag & BONE_SELECTED)
- if (PyList_Append(list,
- EXPP_GetModuleConstant("Blender.Armature", "BONE_SELECTED")) == -1)
- goto RuntimeError;
- if(self->flag & BONE_TIPSEL)
- if (PyList_Append(list,
- EXPP_GetModuleConstant("Blender.Armature", "TIP_SELECTED")) == -1)
- goto RuntimeError;
- }
-
- return list;
-
-RuntimeError:
- Py_XDECREF( list );
- return EXPP_objError(PyExc_RuntimeError, "%s%s%s",
- sEditBoneError, ".options: ", "Internal failure!");
-}
-//----------------------(internal) EditBone_CheckValidConstant
-static int EditBone_CheckValidConstant(PyObject *constant)
-{
- PyObject *name = NULL;
-
- if (constant){
- if (BPy_Constant_Check(constant)){
- name = PyDict_GetItemString(((BPy_constant*)constant)->dict, "name");
- if (!name)
- return 0;
- if (!STREQ3(PyString_AsString(name), "CONNECTED", "HINGE", "NO_DEFORM") &&
- !STREQ3(PyString_AsString(name), "ROOT_SELECTED", "BONE_SELECTED", "TIP_SELECTED") &&
- !STREQ2(PyString_AsString(name), "MULTIPLY", "HIDDEN_EDIT"))
- return 0;
- else
- return 1;
- }else{
- return 0;
- }
- }else{
- return 0;
- }
-}
-
-//------------------------EditBone.options (set)
-static int EditBone_setOptions(BPy_EditBone *self, PyObject *value, void *closure)
-{
- int length, numeric_value, new_flag = 0, x;
- PyObject *val = NULL, *index = NULL;
-
- if (PyList_Check(value)){
- length = PyList_Size(value);
- for (x = 0; x < length; x++){
- index = PyList_GetItem(value, x);
- if (!EditBone_CheckValidConstant(index))
- goto AttributeError2;
- val = PyDict_GetItemString(((BPy_constant*)index)->dict, "value");
- if (PyInt_Check(val)){
- numeric_value = (int)PyInt_AS_LONG(val);
- new_flag |= numeric_value;
- }else{
- goto AttributeError2;
- }
- }
-
- //set the options
- if(self->editbone){
- //make sure the 'connected' property is set up correctly
- if (new_flag & BONE_CONNECTED) {
- if(!self->editbone->parent)
- goto AttributeError3;
- else
- VECCOPY(self->editbone->head, self->editbone->parent->tail);
- }
- self->editbone->flag = new_flag;
- }else{
- self->flag = new_flag;
- }
- return 0;
- }else if (BPy_Constant_Check(value)){
- if (!EditBone_CheckValidConstant(value))
- goto AttributeError2;
- val = PyDict_GetItemString(((BPy_constant*)value)->dict, "value");
- if (PyInt_Check(val)){
- numeric_value = (int)PyInt_AS_LONG(val);
-
- if(self->editbone){
- //make sure the 'connected' property is set up correctly
- if (numeric_value & BONE_CONNECTED) {
- if(!self->editbone->parent)
- goto AttributeError3;
- else
- VECCOPY(self->editbone->head, self->editbone->parent->tail);
- }
- self->editbone->flag = numeric_value;
- }else{
- self->flag = numeric_value;
- }
- return 0;
- }else{
- goto AttributeError2;
- }
- }else{
- goto AttributeError1;
- }
-
-AttributeError1:
- return EXPP_intError(PyExc_AttributeError, "%s%s%s",
- sEditBoneError, ".options: ", "Expects a constant or list of constants");
-AttributeError2:
- return EXPP_intError(PyExc_AttributeError, "%s%s%s",
- sEditBoneError, ".options: ", "Please use a constant defined in the Armature module");
-AttributeError3:
- return EXPP_intError(PyExc_AttributeError, "%s%s%s",
- sEditBoneError, ".options: ", "You can't connect to parent because no parent is set");
-}
-//------------------------EditBone.parent (get)
-static PyObject *EditBone_getParent(BPy_EditBone *self, void *closure)
-{
- if (self->editbone){
- if (self->editbone->parent)
- return PyEditBone_FromEditBone(self->editbone->parent);
- else
- Py_RETURN_NONE;
- }else{
- Py_RETURN_NONE; //not in the list yet can't have a parent
- }
-}
-//------------------------EditBone.parent (set)
-static int EditBone_setParent(BPy_EditBone *self, PyObject *value, void *closure)
-{
- BPy_EditBone *parent = NULL;
-
- if (!PyArg_Parse(value, "O!", &EditBone_Type, &parent))
- goto AttributeError;
-
- if (!parent->editbone)
- goto AttributeError2;
-
- if (self->editbone){
- self->editbone->parent = parent->editbone;
- }else{
- self->parent = parent->editbone;
- }
- return 0;
-
-AttributeError:
- return EXPP_intError(PyExc_AttributeError, "%s%s%s",
- sEditBoneError, ".parent: ", "expects a EditBone Object");
-AttributeError2:
- return EXPP_intError(PyExc_AttributeError, "%s%s%s",
- sEditBoneError, ".parent: ", "This object is not in the armature's bone list!");
-}
-//------------------------EditBone.matrix (get)
-static PyObject *EditBone_getMatrix(BPy_EditBone *self, void *closure)
-{
- float boneMatrix[3][3];
- float axis[3];
-
- if (self->editbone){
- VECSUB(axis, self->editbone->tail, self->editbone->head);
- vec_roll_to_mat3(axis, self->editbone->roll, boneMatrix);
- }else{
- VECSUB(axis, self->tail, self->head);
- vec_roll_to_mat3(axis, self->roll, boneMatrix);
- }
-
- return newMatrixObject((float*)boneMatrix, 3, 3, Py_NEW);
-}
-//------------------------EditBone.matrix (set)
-static int EditBone_setMatrix(BPy_EditBone *self, PyObject *value, void *closure)
-{
- PyObject *matrix;
- float roll, length, vec[3], axis[3], mat3[3][3];
-
- if (!PyArg_Parse(value, "O!", &matrix_Type, &matrix))
- goto AttributeError;
-
- //make sure we have the right sizes
- if (((MatrixObject*)matrix)->rowSize != 3 && ((MatrixObject*)matrix)->colSize != 3){
- if(((MatrixObject*)matrix)->rowSize != 4 && ((MatrixObject*)matrix)->colSize != 4){
- goto AttributeError;
- }
- }
-
- /*vec will be a normalized directional vector
- * together with the length of the old bone vec*length = the new vector*/
- /*The default rotation is 0,1,0 on the Y axis (see mat3_to_vec_roll)*/
- if (((MatrixObject*)matrix)->rowSize == 4){
- Mat3CpyMat4(mat3, ((float (*)[4])*((MatrixObject*)matrix)->matrix));
- }else{
- Mat3CpyMat3(mat3, ((float (*)[3])*((MatrixObject*)matrix)->matrix));
- }
- mat3_to_vec_roll(mat3, vec, &roll);
-
- //if a 4x4 matrix was passed we'll translate the vector otherwise not
- if (self->editbone){
- self->editbone->roll = roll;
- VecSubf(axis, self->editbone->tail, self->editbone->head);
- length = VecLength(axis);
- VecMulf(vec, length);
- if (((MatrixObject*)matrix)->rowSize == 4)
- VecCopyf(self->editbone->head, ((MatrixObject*)matrix)->matrix[3]);
- VecAddf(self->editbone->tail, self->editbone->head, vec);
- return 0;
- }else{
- self->roll = roll;
- VecSubf(axis, self->tail, self->head);
- length = VecLength(axis);
- VecMulf(vec, length);
- if (((MatrixObject*)matrix)->rowSize == 4)
- VecCopyf(self->head, ((MatrixObject*)matrix)->matrix[3]);
- VecAddf(self->tail, self->head, vec);
- return 0;
- }
-
-AttributeError:
- return EXPP_intError(PyExc_AttributeError, "%s%s%s",
- sEditBoneError, ".matrix: ", "expects a 3x3 or 4x4 Matrix Object");
-}
-//------------------------Bone.length (get)
-static PyObject *EditBone_getLength(BPy_EditBone *self, void *closure)
-{
- float delta[3];
- double dot = 0.0f;
- int x;
-
- if (self->editbone){
- VECSUB(delta, self->editbone->tail, self->editbone->head);
- for(x = 0; x < 3; x++){
- dot += (delta[x] * delta[x]);
- }
- return PyFloat_FromDouble(sqrt(dot));
- }else{
- VECSUB(delta, self->tail, self->head);
- for(x = 0; x < 3; x++){
- dot += (delta[x] * delta[x]);
- }
- return PyFloat_FromDouble(sqrt(dot));
- }
-}
-//------------------------Bone.length (set)
-static int EditBone_setLength(BPy_EditBone *self, PyObject *value, void *closure)
-{
- printf("Sorry this isn't implemented yet.... :/");
- return 1;
-}
-
-
-//------------------------Bone.headRadius (get)
-static PyObject *EditBone_getHeadRadius(BPy_EditBone *self, void *closure)
-{
- if (self->editbone)
- if (self->editbone->parent && self->editbone->flag & BONE_CONNECTED)
- return PyFloat_FromDouble(self->editbone->parent->rad_tail);
- else
- return PyFloat_FromDouble(self->editbone->rad_head);
- else
- if (self->parent && self->flag & BONE_CONNECTED)
- return PyFloat_FromDouble(self->parent->rad_tail);
- else
- return PyFloat_FromDouble(self->rad_head);
-}
-//------------------------Bone.headRadius (set)
-static int EditBone_setHeadRadius(BPy_EditBone *self, PyObject *value, void *closure)
-{
- float radius;
- if (!PyArg_Parse(value, "f", &radius))
- goto AttributeError;
- CLAMP(radius, 0.0f, 10000.0f);
-
- if (self->editbone)
- if (self->editbone->parent && self->editbone->flag & BONE_CONNECTED)
- self->editbone->parent->rad_tail= radius;
- else
- self->editbone->rad_head= radius;
- else
- if (self->parent && self->flag & BONE_CONNECTED)
- self->parent->rad_tail= radius;
- else
- self->rad_head= radius;
- return 0;
-
-AttributeError:
- return EXPP_intError(PyExc_AttributeError, "%s%s%s",
- sEditBoneError, ".headRadius: ", "expects a float");
-}
-
-
-//------------------------Bone.tailRadius (get)
-static PyObject *EditBone_getTailRadius(BPy_EditBone *self, void *closure)
-{
- if (self->editbone)
- return PyFloat_FromDouble(self->editbone->rad_tail);
- else
- return PyFloat_FromDouble(self->rad_tail);
-}
-//------------------------Bone.tailRadius (set)
-static int EditBone_setTailRadius(BPy_EditBone *self, PyObject *value, void *closure)
-{
- float radius;
- if (!PyArg_Parse(value, "f", &radius))
- goto AttributeError;
- CLAMP(radius, 0.0f, 10000.0f);
-
- if (self->editbone)
- self->editbone->rad_tail = radius;
- else
- self->rad_tail = radius;
- return 0;
-
-AttributeError:
- return EXPP_intError(PyExc_AttributeError, "%s%s%s",
- sEditBoneError, ".tailRadius: ", "expects a float");
-}
-
-//------------------------Bone.layerMask (get)
-static PyObject *EditBone_getLayerMask(BPy_EditBone *self)
-{
- /* do this extra stuff because the short's bits can be negative values */
- unsigned short laymask = 0;
- if (self->editbone) laymask |= self->editbone->layer;
- else laymask |= self->layer;
- return PyInt_FromLong((int)laymask);
-}
-//------------------------Bone.layerMask (set)
-static int EditBone_setLayerMask(BPy_EditBone *self, PyObject *value)
-{
- int laymask;
- if (!PyInt_Check(value)) {
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "expected an integer (bitmask) as argument" );
- }
-
- laymask = PyInt_AsLong(value);
-
- if (laymask <= 0 || laymask > (1<<16) - 1)
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "bitmask must have from 1 up to 16 bits set");
-
- if (self->editbone) {
- self->editbone->layer = 0;
- self->editbone->layer |= laymask;
- } else {
- self->layer = 0;
- self->layer |= laymask;
- }
-
- return 0;
-}
-
-//------------------TYPE_OBECT IMPLEMENTATION--------------------------
-//------------------------tp_methods
-//This contains a list of all methods the object contains
-static PyMethodDef BPy_EditBone_methods[] = {
- {"hasParent", (PyCFunction) EditBone_hasParent, METH_NOARGS,
- "() - True/False - Bone has a parent"},
- {"clearParent", (PyCFunction) EditBone_clearParent, METH_NOARGS,
- "() - sets the parent to None"},
- {NULL, NULL, 0, NULL}
-};
-///------------------------tp_getset
-//This contains methods for attributes that require checking
-static PyGetSetDef BPy_EditBone_getset[] = {
- {"name", (getter)EditBone_getName, (setter)EditBone_setName,
- "The name of the bone", NULL},
- {"roll", (getter)EditBone_getRoll, (setter)EditBone_setRoll,
- "The roll (or rotation around the axis) of the bone", NULL},
- {"head", (getter)EditBone_getHead, (setter)EditBone_setHead,
- "The start point of the bone", NULL},
- {"tail", (getter)EditBone_getTail, (setter)EditBone_setTail,
- "The end point of the bone", NULL},
- {"matrix", (getter)EditBone_getMatrix, (setter)EditBone_setMatrix,
- "The matrix of the bone", NULL},
- {"weight", (getter)EditBone_getWeight, (setter)EditBone_setWeight,
- "The weight of the bone in relation to a parented mesh", NULL},
- {"deformDist", (getter)EditBone_getDeform_dist, (setter)EditBone_setDeform_dist,
- "The distance at which deformation has effect", NULL},
- {"subdivisions", (getter)EditBone_getSubdivisions, (setter)EditBone_setSubdivisions,
- "The number of subdivisions (for B-Bones)", NULL},
- {"options", (getter)EditBone_getOptions, (setter)EditBone_setOptions,
- "The options effective on this bone", NULL},
- {"parent", (getter)EditBone_getParent, (setter)EditBone_setParent,
- "The parent bone of this bone", NULL},
- {"length", (getter)EditBone_getLength, (setter)EditBone_setLength,
- "The length of this bone", NULL},
- {"tailRadius", (getter)EditBone_getTailRadius, (setter)EditBone_setTailRadius,
- "Set the radius of this bones tip", NULL},
- {"headRadius", (getter)EditBone_getHeadRadius, (setter)EditBone_setHeadRadius,
- "Set the radius of this bones head", NULL},
- {"layerMask", (getter)EditBone_getLayerMask, (setter)EditBone_setLayerMask,
- "Layer bitmask", NULL },
- {NULL, NULL, NULL, NULL,NULL}
-};
-
-//------------------------tp_repr
-//This is the string representation of the object
-static PyObject *EditBone_repr(BPy_EditBone *self)
-{
- if (self->editbone)
- return PyString_FromFormat( "[EditBone \"%s\"]", self->editbone->name );
- else
- return PyString_FromFormat( "[EditBone \"%s\"]", self->name );
-}
-
-static int EditBone_compare( BPy_EditBone * a, BPy_EditBone * b )
-{
- /* if they are not wrapped, then they cant be the same */
- if (a->editbone==NULL && b->editbone==NULL) return -1;
- return ( a->editbone == b->editbone ) ? 0 : -1;
-}
-
-
-//------------------------tp_doc
-//The __doc__ string for this object
-static char BPy_EditBone_doc[] = "This is an internal subobject of armature\
-designed to act as a wrapper for an 'edit bone'.";
-
-//------------------------tp_new
-//This methods creates a new object (note it does not initialize it - only the building)
-static PyObject *EditBone_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
- char *name = "myEditBone";
- BPy_EditBone *py_editBone = NULL;
- float head[3], tail[3];
-
- py_editBone = (BPy_EditBone*)type->tp_alloc(type, 0); //new
- if (py_editBone == NULL)
- goto RuntimeError;
-
- //this pointer will be set when this bone is placed in ListBase
- //otherwise this will act as a py_object
- py_editBone->editbone = NULL;
-
- unique_editbone_name(NULL, name);
- BLI_strncpy(py_editBone->name, name, 32);
- py_editBone->parent = NULL;
- py_editBone->weight= 1.0f;
- py_editBone->dist= 0.25f;
- py_editBone->xwidth= 0.1f;
- py_editBone->zwidth= 0.1f;
- py_editBone->ease1= 1.0f;
- py_editBone->ease2= 1.0f;
- py_editBone->rad_head= 0.10f;
- py_editBone->rad_tail= 0.05f;
- py_editBone->segments= 1;
- py_editBone->layer= 1;
- py_editBone->flag = 0;
- py_editBone->roll = 0.0f;
-
- head[0] = head[1] = head[2] = 0.0f;
- tail[1] = tail[2] = 0.0f;
- tail[0] = 1.0f;
- VECCOPY(py_editBone->head, head);
- VECCOPY(py_editBone->tail, tail);
-
- return (PyObject*)py_editBone;
-
-RuntimeError:
- return EXPP_objError(PyExc_RuntimeError, "%s%s%s",
- sEditBoneError, " __new__: ", "Internal Error");
-}
-//------------------------tp_dealloc
-//This tells how to 'tear-down' our object when ref count hits 0
-//the struct EditBone pointer will be handled by the BPy_BonesDict class
-static void EditBone_dealloc(BPy_EditBone * self)
-{
- EditBone_Type.tp_free(self);
- return;
-}
-//------------------TYPE_OBECT DEFINITION--------------------------
-PyTypeObject EditBone_Type = {
- PyObject_HEAD_INIT(NULL) //tp_head
- 0, //tp_internal
- "EditBone", //tp_name
- sizeof(BPy_EditBone), //tp_basicsize
- 0, //tp_itemsize
- (destructor)EditBone_dealloc, //tp_dealloc
- 0, //tp_print
- 0, //tp_getattr
- 0, //tp_setattr
- (cmpfunc)EditBone_compare, //tp_compare
- (reprfunc)EditBone_repr, //tp_repr
- 0, //tp_as_number
- 0, //tp_as_sequence
- 0, //tp_as_mapping
- 0, //tp_hash
- 0, //tp_call
- 0, //tp_str
- 0, //tp_getattro
- 0, //tp_setattro
- 0, //tp_as_buffer
- Py_TPFLAGS_DEFAULT, //tp_flags
- BPy_EditBone_doc, //tp_doc
- 0, //tp_traverse
- 0, //tp_clear
- 0, //tp_richcompare
- 0, //tp_weaklistoffset
- 0, //tp_iter
- 0, //tp_iternext
- BPy_EditBone_methods, //tp_methods
- 0, //tp_members
- BPy_EditBone_getset, //tp_getset
- 0, //tp_base
- 0, //tp_dict
- 0, //tp_descr_get
- 0, //tp_descr_set
- 0, //tp_dictoffset
- 0, //tp_init
- 0, //tp_alloc
- (newfunc)EditBone_new, //tp_new
- 0, //tp_free
- 0, //tp_is_gc
- 0, //tp_bases
- 0, //tp_mro
- 0, //tp_cache
- 0, //tp_subclasses
- 0, //tp_weaklist
- 0 //tp_del
-};
-
-//------------------METHOD IMPLEMENTATIONS--------------------------------
-//------------------------(internal) PyBone_ChildrenAsList
-static int PyBone_ChildrenAsList(PyObject *list, ListBase *bones){
- Bone *bone = NULL;
- PyObject *py_bone = NULL;
-
- for (bone = bones->first; bone; bone = bone->next){
- py_bone = PyBone_FromBone(bone);
- if (py_bone == NULL)
- return 0;
-
- if(PyList_Append(list, py_bone) == -1){
- return 0;
- }
- Py_DECREF(py_bone);
- if (bone->childbase.first)
- if (!PyBone_ChildrenAsList(list, &bone->childbase))
- return 0;
- }
- return 1;
-}
-//-------------------------Bone.hasParent()
-static PyObject *Bone_hasParent(BPy_Bone *self)
-{
- if (self->bone->parent)
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
-}
-//-------------------------Bone.hasChildren()
-static PyObject *Bone_hasChildren(BPy_Bone *self)
-{
- if (self->bone->childbase.first)
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
-}
-//-------------------------Bone.getAllChildren()
-static PyObject *Bone_getAllChildren(BPy_Bone *self)
-{
- PyObject *list = PyList_New(0);
- if (!self->bone->childbase.first) {
- /* do nothing */
- } else if (!PyBone_ChildrenAsList(list, &self->bone->childbase)) {
- Py_XDECREF(list);
- EXPP_objError(PyExc_RuntimeError, "%s%s",
- sBoneError, "Internal error trying to wrap blender bones!");
- }
- return list;
-}
-
-//------------------ATTRIBUTE IMPLEMENTATIONS-----------------------------
-//------------------------Bone.name (get)
-static PyObject *Bone_getName(BPy_Bone *self, void *closure)
-{
- return PyString_FromString(self->bone->name);
-}
-//------------------------Bone.name (set)
-//check for char[] overflow here...
-static int Bone_setName(BPy_Bone *self, PyObject *value, void *closure)
-{
- return EXPP_intError(PyExc_ValueError, "%s%s",
- sBoneError, "You must first call .makeEditable() to edit the armature");
-}
-//------------------------Bone.roll (get)
-static PyObject *Bone_getRoll(BPy_Bone *self, void *closure)
-{
- return Py_BuildValue("{s:f, s:f}",
- "BONESPACE", self->bone->roll * (180/Py_PI),
- "ARMATURESPACE", boneRoll_ToArmatureSpace(self->bone) * (180/Py_PI));
-}
-//------------------------Bone.roll (set)
-static int Bone_setRoll(BPy_Bone *self, PyObject *value, void *closure)
-{
- return EXPP_intError(PyExc_ValueError, "%s%s",
- sBoneError, "You must first call .makeEditable() to edit the armature");
-}
-//------------------------Bone.head (get)
-static PyObject *Bone_getHead(BPy_Bone *self, void *closure)
-{
- PyObject *val1 = newVectorObject(self->bone->head, 3, Py_WRAP);
- PyObject *val2 = newVectorObject(self->bone->arm_head, 3, Py_WRAP);
- PyObject *ret = Py_BuildValue(
- "{s:O, s:O}", "BONESPACE", val1, "ARMATURESPACE", val2);
-
- Py_DECREF(val1);
- Py_DECREF(val2);
- return ret;
-}
-//------------------------Bone.head (set)
-static int Bone_setHead(BPy_Bone *self, PyObject *value, void *closure)
-{
- return EXPP_intError(PyExc_ValueError, "%s%s",
- sBoneError, "You must first call .makeEditable() to edit the armature");
-}
-//------------------------Bone.tail (get)
-static PyObject *Bone_getTail(BPy_Bone *self, void *closure)
-{
- PyObject *val1 = newVectorObject(self->bone->tail, 3, Py_WRAP);
- PyObject *val2 = newVectorObject(self->bone->arm_tail, 3, Py_WRAP);
- PyObject *ret = Py_BuildValue("{s:O, s:O}",
- "BONESPACE", val1, "ARMATURESPACE", val2);
-
- Py_DECREF(val1);
- Py_DECREF(val2);
- return ret;
-}
-//------------------------Bone.tail (set)
-static int Bone_setTail(BPy_Bone *self, PyObject *value, void *closure)
-{
- return EXPP_intError(PyExc_ValueError, "%s%s",
- sBoneError, "You must first call .makeEditable() to edit the armature");
-}
-//------------------------Bone.weight (get)
-static PyObject *Bone_getWeight(BPy_Bone *self, void *closure)
-{
- return PyFloat_FromDouble(self->bone->weight);
-}
-//------------------------Bone.weight (set)
-static int Bone_setWeight(BPy_Bone *self, PyObject *value, void *closure)
-{
- return EXPP_intError(PyExc_ValueError, "%s%s",
- sBoneError, "You must first call .makeEditable() to edit the armature");
-}
-//------------------------Bone.deform_dist (get)
-static PyObject *Bone_getDeform_dist(BPy_Bone *self, void *closure)
-{
- return PyFloat_FromDouble(self->bone->dist);
-}
-//------------------------Bone.deform_dist (set)
-static int Bone_setDeform_dist(BPy_Bone *self, PyObject *value, void *closure)
-{
- return EXPP_intError(PyExc_ValueError, "%s%s",
- sBoneError, "You must first call .makeEditable() to edit the armature");
-}
-//------------------------Bone.subdivisions (get)
-static PyObject *Bone_getSubdivisions(BPy_Bone *self, void *closure)
-{
- return PyInt_FromLong(self->bone->segments);
-}
-//------------------------Bone.subdivisions (set)
-static int Bone_setSubdivisions(BPy_Bone *self, PyObject *value, void *closure)
-{
- return EXPP_intError(PyExc_ValueError, "%s%s",
- sBoneError, "You must first call .makeEditable() to edit the armature");
-}
-//------------------------Bone.connected (get)
-static PyObject *Bone_getOptions(BPy_Bone *self, void *closure)
-{
- PyObject *list = NULL;
-
- list = PyList_New(0);
- if (list == NULL)
- goto RuntimeError;
-
- if(self->bone->flag & BONE_CONNECTED)
- if (PyList_Append(list,
- EXPP_GetModuleConstant("Blender.Armature", "CONNECTED")) == -1)
- goto RuntimeError;
- if(self->bone->flag & BONE_HINGE)
- if (PyList_Append(list,
- EXPP_GetModuleConstant("Blender.Armature", "HINGE")) == -1)
- goto RuntimeError;
- if(self->bone->flag & BONE_NO_DEFORM)
- if (PyList_Append(list,
- EXPP_GetModuleConstant("Blender.Armature", "NO_DEFORM")) == -1)
- goto RuntimeError;
- if(self->bone->flag & BONE_MULT_VG_ENV)
- if (PyList_Append(list,
- EXPP_GetModuleConstant("Blender.Armature", "MULTIPLY")) == -1)
- goto RuntimeError;
- if(self->bone->flag & BONE_HIDDEN_A)
- if (PyList_Append(list,
- EXPP_GetModuleConstant("Blender.Armature", "HIDDEN_EDIT")) == -1)
- goto RuntimeError;
- if(self->bone->flag & BONE_ROOTSEL)
- if (PyList_Append(list,
- EXPP_GetModuleConstant("Blender.Armature", "ROOT_SELECTED")) == -1)
- goto RuntimeError;
- if(self->bone->flag & BONE_SELECTED)
- if (PyList_Append(list,
- EXPP_GetModuleConstant("Blender.Armature", "BONE_SELECTED")) == -1)
- goto RuntimeError;
- if(self->bone->flag & BONE_TIPSEL)
- if (PyList_Append(list,
- EXPP_GetModuleConstant("Blender.Armature", "TIP_SELECTED")) == -1)
- goto RuntimeError;
-
- return list;
-
-RuntimeError:
- Py_XDECREF(list);
- return EXPP_objError(PyExc_RuntimeError, "%s%s%s",
- sBoneError, "getOptions(): ", "Internal failure!");
-}
-//------------------------Bone.connected (set)
-static int Bone_setOptions(BPy_Bone *self, PyObject *value, void *closure)
-{
- return EXPP_intError(PyExc_ValueError, "%s%s",
- sBoneError, "You must first call .makeEditable() to edit the armature");
-}
-//------------------------Bone.parent (get)
-static PyObject *Bone_getParent(BPy_Bone *self, void *closure)
-{
- if (self->bone->parent)
- return PyBone_FromBone(self->bone->parent);
- else
- Py_RETURN_NONE;
-}
-//------------------------Bone.parent (set)
-static int Bone_setParent(BPy_Bone *self, PyObject *value, void *closure)
-{
- return EXPP_intError(PyExc_ValueError, "%s%s",
- sBoneError, "You must first call .makeEditable() to edit the armature");
-}
-//------------------------Bone.children (get)
-static PyObject *Bone_getChildren(BPy_Bone *self, void *closure)
-{
- PyObject *list = PyList_New(0);
- Bone *bone = NULL;
- PyObject *py_bone = NULL;
-
- if (self->bone->childbase.first){
- for (bone = self->bone->childbase.first; bone; bone = bone->next){
- py_bone = PyBone_FromBone(bone);
- if (py_bone == NULL)
- goto RuntimeError;
- if (PyList_Append(list, py_bone) == -1)
- goto RuntimeError;
- Py_DECREF(py_bone);
- }
- }
- return list;
-
-RuntimeError:
- Py_XDECREF(list);
- Py_XDECREF(py_bone);
- return EXPP_objError(PyExc_RuntimeError, "%s%s",
- sBoneError, "Internal error trying to wrap blender bones!");
-}
-//------------------------Bone.children (set)
-static int Bone_setChildren(BPy_Bone *self, PyObject *value, void *closure)
-{
- return EXPP_intError(PyExc_ValueError, "%s%s",
- sBoneError, "You must first call .makeEditable() to edit the armature");
-}
-//------------------------Bone.matrix (get)
-static PyObject *Bone_getMatrix(BPy_Bone *self, void *closure)
-{
- PyObject *val1 = newMatrixObject((float*)self->bone->bone_mat, 3,3, Py_WRAP);
- PyObject *val2 = newMatrixObject((float*)self->bone->arm_mat, 4,4, Py_WRAP);
- PyObject *ret = Py_BuildValue("{s:O, s:O}",
- "BONESPACE", val1, "ARMATURESPACE", val2);
- Py_DECREF(val1);
- Py_DECREF(val2);
- return ret;
-
-
-}
-//------------------------Bone.matrix (set)
-static int Bone_setMatrix(BPy_Bone *self, PyObject *value, void *closure)
-{
- return EXPP_intError(PyExc_ValueError, "%s%s",
- sBoneError, "You must first call .makeEditable() to edit the armature");
-}
-//------------------------Bone.length (get)
-static PyObject *Bone_getLength(BPy_Bone *self, void *closure)
-{
- return PyFloat_FromDouble(self->bone->length);
-}
-//------------------------Bone.length (set)
-static int Bone_setLength(BPy_Bone *self, PyObject *value, void *closure)
-{
- return EXPP_intError(PyExc_ValueError, "%s%s",
- sBoneError, "You must first call .makeEditable() to edit the armature");
-}
-
-//------------------------Bone.headRadius (get)
-static PyObject *Bone_getHeadRadius(BPy_Bone *self, void *closure)
-{
-
- if (self->bone->parent && self->bone->flag & BONE_CONNECTED)
- return PyFloat_FromDouble(self->bone->parent->rad_tail);
- else
- return PyFloat_FromDouble(self->bone->rad_head);
-}
-//------------------------Bone.headRadius (set)
-static int Bone_setHeadRadius(BPy_Bone *self, PyObject *value, void *closure)
-{
- float radius;
- if (!PyArg_Parse(value, "f", &radius))
- goto AttributeError;
- CLAMP(radius, 0.0f, 10000.0f);
-
- if (self->bone->parent && self->bone->flag & BONE_CONNECTED)
- self->bone->parent->rad_tail= radius;
- else
- self->bone->rad_head= radius;
- return 0;
-
-AttributeError:
- return EXPP_intError(PyExc_AttributeError, "%s%s%s",
- sEditBoneError, ".headRadius: ", "expects a float");
-}
-
-//------------------------Bone.tailRadius (get)
-static PyObject *Bone_getTailRadius(BPy_Bone *self, void *closure)
-{
- return PyFloat_FromDouble(self->bone->rad_tail);
-}
-
-//------------------------Bone.headRadius (set)
-static int Bone_setTailRadius(BPy_Bone *self, PyObject *value, void *closure)
-{
- float radius;
- if (!PyArg_Parse(value, "f", &radius))
- goto AttributeError;
- CLAMP(radius, 0.0f, 10000.0f);
- self->bone->rad_tail= radius;
- return 0;
-
-AttributeError:
- return EXPP_intError(PyExc_AttributeError, "%s%s%s",
- sEditBoneError, ".headRadius: ", "expects a float");
-}
-
-//------------------------Bone.layerMask (get)
-static PyObject *Bone_getLayerMask(BPy_Bone *self)
-{
- /* do this extra stuff because the short's bits can be negative values */
- unsigned short laymask = 0;
- laymask |= self->bone->layer;
- return PyInt_FromLong((int)laymask);
-}
-//------------------------Bone.layerMask (set)
-static int Bone_setLayerMask(BPy_Bone *self, PyObject *value)
-{
- int laymask;
- if (!PyInt_Check(value)) {
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "expected an integer (bitmask) as argument" );
- }
-
- laymask = PyInt_AsLong(value);
-
- if (laymask <= 0 || laymask > (1<<16) - 1)
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "bitmask must have from 1 up to 16 bits set");
-
- self->bone->layer = 0;
- self->bone->layer |= laymask;
-
- return 0;
-}
-
-//------------------TYPE_OBECT IMPLEMENTATION--------------------------
-//------------------------tp_methods
-//This contains a list of all methods the object contains
-static PyMethodDef BPy_Bone_methods[] = {
- {"hasParent", (PyCFunction) Bone_hasParent, METH_NOARGS,
- "() - True/False - Bone has a parent"},
- {"hasChildren", (PyCFunction) Bone_hasChildren, METH_NOARGS,
- "() - True/False - Bone has 1 or more children"},
- {"getAllChildren", (PyCFunction) Bone_getAllChildren, METH_NOARGS,
- "() - All the children for this bone - including children's children"},
- {NULL, NULL, 0, NULL}
-};
-//------------------------tp_getset
-//This contains methods for attributes that require checking
-static PyGetSetDef BPy_Bone_getset[] = {
- {"name", (getter)Bone_getName, (setter)Bone_setName,
- "The name of the bone", NULL},
- {"roll", (getter)Bone_getRoll, (setter)Bone_setRoll,
- "The roll (or rotation around the axis) of the bone", NULL},
- {"head", (getter)Bone_getHead, (setter)Bone_setHead,
- "The start point of the bone", NULL},
- {"tail", (getter)Bone_getTail, (setter)Bone_setTail,
- "The end point of the bone", NULL},
- {"matrix", (getter)Bone_getMatrix, (setter)Bone_setMatrix,
- "The matrix of the bone", NULL},
- {"weight", (getter)Bone_getWeight, (setter)Bone_setWeight,
- "The weight of the bone in relation to a parented mesh", NULL},
- {"deform_dist", (getter)Bone_getDeform_dist, (setter)Bone_setDeform_dist,
- "The distance at which deformation has effect", NULL},
- {"subdivisions", (getter)Bone_getSubdivisions, (setter)Bone_setSubdivisions,
- "The number of subdivisions (for B-Bones)", NULL},
- {"options", (getter)Bone_getOptions, (setter)Bone_setOptions,
- "The options effective on this bone", NULL},
- {"parent", (getter)Bone_getParent, (setter)Bone_setParent,
- "The parent bone of this bone", NULL},
- {"children", (getter)Bone_getChildren, (setter)Bone_setChildren,
- "The child bones of this bone", NULL},
- {"length", (getter)Bone_getLength, (setter)Bone_setLength,
- "The length of this bone", NULL},
- {"tailRadius", (getter)Bone_getTailRadius, (setter)Bone_setTailRadius,
- "Set the radius of this bones tip", NULL},
- {"headRadius", (getter)Bone_getHeadRadius, (setter)Bone_setHeadRadius,
- "Set the radius of this bones head", NULL},
- {"layerMask", (getter)Bone_getLayerMask, (setter)Bone_setLayerMask,
- "Layer bitmask", NULL },
- {NULL, NULL, NULL, NULL,NULL}
-};
-//------------------------tp_repr
-//This is the string representation of the object
-static PyObject *Bone_repr(BPy_Bone *self)
-{
- return PyString_FromFormat( "[Bone \"%s\"]", self->bone->name );
-}
-static int Bone_compare( BPy_Bone * a, BPy_Bone * b )
-{
- return ( a->bone == b->bone ) ? 0 : -1;
-}
-//------------------------tp_dealloc
-//This tells how to 'tear-down' our object when ref count hits 0
-static void Bone_dealloc(BPy_Bone * self)
-{
- Bone_Type.tp_free(self);
- return;
-}
-//------------------------tp_doc
-//The __doc__ string for this object
-static char BPy_Bone_doc[] = "This object wraps a Blender Boneobject.\n\
- This object is a subobject of the Armature object.";
-
-//------------------TYPE_OBECT DEFINITION--------------------------
-PyTypeObject Bone_Type = {
- PyObject_HEAD_INIT(NULL) //tp_head
- 0, //tp_internal
- "Bone", //tp_name
- sizeof(BPy_Bone), //tp_basicsize
- 0, //tp_itemsize
- (destructor)Bone_dealloc, //tp_dealloc
- 0, //tp_print
- 0, //tp_getattr
- 0, //tp_setattr
- (cmpfunc) Bone_compare, //tp_compare
- (reprfunc) Bone_repr, //tp_repr
- 0, //tp_as_number
- 0, //tp_as_sequence
- 0, //tp_as_mapping
- 0, //tp_hash
- 0, //tp_call
- 0, //tp_str
- 0, //tp_getattro
- 0, //tp_setattro
- 0, //tp_as_buffer
- Py_TPFLAGS_DEFAULT, //tp_flags
- BPy_Bone_doc, //tp_doc
- 0, //tp_traverse
- 0, //tp_clear
- 0, //tp_richcompare
- 0, //tp_weaklistoffset
- 0, //tp_iter
- 0, //tp_iternext
- BPy_Bone_methods, //tp_methods
- 0, //tp_members
- BPy_Bone_getset, //tp_getset
- 0, //tp_base
- 0, //tp_dict
- 0, //tp_descr_get
- 0, //tp_descr_set
- 0, //tp_dictoffset
- 0, //tp_init
- 0, //tp_alloc
- 0, //tp_new
- 0, //tp_free
- 0, //tp_is_gc
- 0, //tp_bases
- 0, //tp_mro
- 0, //tp_cache
- 0, //tp_subclasses
- 0, //tp_weaklist
- 0 //tp_del
-};
-//------------------VISIBLE PROTOTYPE IMPLEMENTATION-----------------------
-//-----------------(internal)
-//Converts a struct EditBone to a BPy_EditBone
-PyObject *PyEditBone_FromEditBone(struct EditBone *editbone)
-{
- BPy_EditBone *py_editbone = NULL;
-
- py_editbone = (BPy_EditBone*)EditBone_Type.tp_alloc(&EditBone_Type, 0); //*new*
- if (!py_editbone)
- goto RuntimeError;
-
- py_editbone->editbone = editbone;
-
- return (PyObject *) py_editbone;
-
-RuntimeError:
- return EXPP_objError(PyExc_RuntimeError, "%s%s%s",
- sEditBoneError, "PyEditBone_FromEditBone: ", "Internal Error Ocurred");
-}
-//-----------------(internal)
-//Converts a struct Bone to a BPy_Bone
-PyObject *PyBone_FromBone(struct Bone *bone)
-{
- BPy_Bone *py_Bone = ( BPy_Bone * ) PyObject_NEW( BPy_Bone, &Bone_Type );
-
- py_Bone->bone = bone;
-
- return (PyObject *) py_Bone;
-}
-//-----------------(internal)
-//Converts a PyBone to a bBone
-struct Bone *PyBone_AsBone(BPy_Bone *py_Bone)
-{
- return (py_Bone->bone);
-}
diff --git a/source/blender/python/api2_2x/Bone.h b/source/blender/python/api2_2x/Bone.h
deleted file mode 100644
index da7efe27931..00000000000
--- a/source/blender/python/api2_2x/Bone.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * $Id: Bone.h 12399 2007-10-26 08:19:40Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * Contributor(s): Joseph Gilbert
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_BONE_H
-#define EXPP_BONE_H
-
-#include <Python.h>
-#include "DNA_armature_types.h"
-
-/*-------------------TYPE CHECKS---------------------------------*/
-#define BoneObject_Check(v) ((v)->ob_type == &Bone_Type)
-#define EditBoneObject_Check(v) ((v)->ob_type == &EditBone_Type)
-/*-------------------TYPEOBJECT----------------------------------*/
-extern PyTypeObject EditBone_Type;
-extern PyTypeObject Bone_Type;
-/*-------------------STRUCT DEFINITION----------------------------*/
-
-typedef struct {
- PyObject_HEAD
- Bone * bone;
-} BPy_Bone;
-
-typedef struct {
- PyObject_HEAD
- struct EditBone *editbone;
- struct EditBone *parent;
- char name[32];
- float roll;
- float head[3];
- float tail[3];
- int flag;
- float dist;
- float weight;
- float xwidth;
- float zwidth;
- float ease1;
- float ease2;
- float rad_head;
- float rad_tail;
- short segments;
- short layer;
-} BPy_EditBone;
-/*-------------------VISIBLE PROTOTYPES-------------------------*/
-PyObject *PyBone_FromBone(struct Bone *bone);
-struct Bone *PyBone_AsBone(BPy_Bone *py_Bone);
-PyObject *PyEditBone_FromBone(Bone *bone);
-PyObject *PyEditBone_FromEditBone(struct EditBone *editbone);
-
-#endif
diff --git a/source/blender/python/api2_2x/Camera.c b/source/blender/python/api2_2x/Camera.c
deleted file mode 100644
index bd1e7932f5c..00000000000
--- a/source/blender/python/api2_2x/Camera.c
+++ /dev/null
@@ -1,1057 +0,0 @@
-/*
- * $Id: Camera.c 12078 2007-09-18 06:41:29Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano, Johnny Matthews, Ken Hughes
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#include "Camera.h" /*This must come first */
-
-#include "BKE_main.h"
-#include "BKE_global.h"
-#include "BKE_object.h"
-#include "BKE_library.h"
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h" /* for M_PI */
-#include "BSE_editipo.h"
-#include "BIF_space.h"
-#include "mydevice.h"
-#include "gen_utils.h"
-#include "gen_library.h"
-#include "Ipo.h"
-
-
-#define IPOKEY_LENS 0
-#define IPOKEY_CLIPPING 1
-
-
-
-enum cam_consts {
- EXPP_CAM_ATTR_LENS = 0,
- EXPP_CAM_ATTR_ANGLE,
- EXPP_CAM_ATTR_DOFDIST,
- EXPP_CAM_ATTR_CLIPEND,
- EXPP_CAM_ATTR_CLIPSTART,
- EXPP_CAM_ATTR_SCALE,
- EXPP_CAM_ATTR_DRAWSIZE,
- EXPP_CAM_ATTR_SHIFTX,
- EXPP_CAM_ATTR_SHIFTY,
- EXPP_CAM_ATTR_ALPHA,
-};
-
-/*****************************************************************************/
-/* Python API function prototypes for the Camera module. */
-/*****************************************************************************/
-static PyObject *M_Camera_New( PyObject * self, PyObject * args,
- PyObject * keywords );
-static PyObject *M_Camera_Get( PyObject * self, PyObject * args );
-
-/*****************************************************************************/
-/* The following string definitions are used for documentation strings. */
-/* In Python these will be written to the console when doing a */
-/* Blender.Camera.__doc__ */
-/*****************************************************************************/
-static char M_Camera_doc[] = "The Blender Camera module\n\
-\n\
-This module provides access to **Camera Data** objects in Blender\n\
-\n\
-Example::\n\
-\n\
- from Blender import Camera, Object, Scene\n\
- c = Camera.New('ortho') # create new ortho camera data\n\
- c.scale = 6.0 # set scale value\n\
- scn = Scene.GetCurrent() # get current Scene\n\
- ob = scn.objects.new(c) # Make an object from this data in the scene\n\
- cur.setCurrentCamera(ob) # make this camera the active";
-
-static char M_Camera_New_doc[] =
- "Camera.New (type = 'persp', name = 'CamData'):\n\
- Return a new Camera Data object with the given type and name.";
-
-static char M_Camera_Get_doc[] = "Camera.Get (name = None):\n\
- Return the camera data with the given 'name', None if not found, or\n\
- Return a list with all Camera Data objects in the current scene,\n\
- if no argument was given.";
-
-/*****************************************************************************/
-/* Python method structure definition for Blender.Camera module: */
-/*****************************************************************************/
-struct PyMethodDef M_Camera_methods[] = {
- {"New", ( PyCFunction ) M_Camera_New, METH_VARARGS | METH_KEYWORDS,
- M_Camera_New_doc},
- {"Get", M_Camera_Get, METH_VARARGS, M_Camera_Get_doc},
- {"get", M_Camera_Get, METH_VARARGS, M_Camera_Get_doc},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Python BPy_Camera methods declarations: */
-/*****************************************************************************/
-static PyObject *Camera_oldgetType( BPy_Camera * self );
-static PyObject *Camera_oldgetMode( BPy_Camera * self );
-static PyObject *Camera_oldgetLens( BPy_Camera * self );
-static PyObject *Camera_oldgetClipStart( BPy_Camera * self );
-static PyObject *Camera_oldgetClipEnd( BPy_Camera * self );
-static PyObject *Camera_oldgetDrawSize( BPy_Camera * self );
-static PyObject *Camera_oldgetScale( BPy_Camera * self );
-static PyObject *Camera_getIpo( BPy_Camera * self );
-static int Camera_setIpo( BPy_Camera * self, PyObject * value );
-static PyObject *Camera_oldsetIpo( BPy_Camera * self, PyObject * args );
-static PyObject *Camera_oldsetType( BPy_Camera * self, PyObject * args );
-static PyObject *Camera_oldsetMode( BPy_Camera * self, PyObject * args );
-static PyObject *Camera_oldsetLens( BPy_Camera * self, PyObject * args );
-static PyObject *Camera_oldsetClipStart( BPy_Camera * self, PyObject * args );
-static PyObject *Camera_oldsetClipEnd( BPy_Camera * self, PyObject * args );
-static PyObject *Camera_oldsetDrawSize( BPy_Camera * self, PyObject * args );
-static PyObject *Camera_oldsetScale( BPy_Camera * self, PyObject * args );
-static PyObject *Camera_oldgetScriptLinks( BPy_Camera * self, PyObject * value );
-static PyObject *Camera_addScriptLink( BPy_Camera * self, PyObject * args );
-static PyObject *Camera_oldclearIpo( BPy_Camera * self );
-static PyObject *Camera_clearScriptLinks( BPy_Camera * self, PyObject * args );
-static PyObject *Camera_insertIpoKey( BPy_Camera * self, PyObject * args );
-static PyObject *Camera_copy( BPy_Camera * self );
-
-
-/*****************************************************************************/
-/* Python BPy_Camera methods table: */
-/*****************************************************************************/
-static PyMethodDef BPy_Camera_methods[] = {
- /* name, method, flags, doc */
- {"getIpo", ( PyCFunction ) Camera_getIpo, METH_NOARGS,
- "() - Return Camera Data Ipo"},
- {"getName", ( PyCFunction ) GenericLib_getName, METH_NOARGS,
- "() - Return Camera Data name"},
- {"getType", ( PyCFunction ) Camera_oldgetType, METH_NOARGS,
- "() - Return Camera type - 'persp':0, 'ortho':1"},
- {"getMode", ( PyCFunction ) Camera_oldgetMode, METH_NOARGS,
- "() - Return Camera mode flags (or'ed value) -\n"
- " 'showLimits':1, 'showMist':2"},
- {"getLens", ( PyCFunction ) Camera_oldgetLens, METH_NOARGS,
- "() - Return *perspective* Camera lens value"},
- {"getScale", ( PyCFunction ) Camera_oldgetScale, METH_NOARGS,
- "() - Return *ortho* Camera scale value"},
- {"getClipStart", ( PyCFunction ) Camera_oldgetClipStart, METH_NOARGS,
- "() - Return Camera clip start value"},
- {"getClipEnd", ( PyCFunction ) Camera_oldgetClipEnd, METH_NOARGS,
- "() - Return Camera clip end value"},
- {"getDrawSize", ( PyCFunction ) Camera_oldgetDrawSize, METH_NOARGS,
- "() - Return Camera draw size value"},
- {"setIpo", ( PyCFunction ) Camera_oldsetIpo, METH_VARARGS,
- "(Blender Ipo) - Set Camera Ipo"},
- {"clearIpo", ( PyCFunction ) Camera_oldclearIpo, METH_NOARGS,
- "() - Unlink Ipo from this Camera."},
- {"insertIpoKey", ( PyCFunction ) Camera_insertIpoKey, METH_VARARGS,
- "( Camera IPO type ) - Inserts a key into IPO"},
- {"setName", ( PyCFunction ) GenericLib_setName_with_method, METH_VARARGS,
- "(s) - Set Camera Data name"},
- {"setType", ( PyCFunction ) Camera_oldsetType, METH_O,
- "(s) - Set Camera type, which can be 'persp' or 'ortho'"},
- {"setMode", ( PyCFunction ) Camera_oldsetMode, METH_VARARGS,
- "(<s<,s>>) - Set Camera mode flag(s): 'showLimits' and 'showMist'"},
- {"setLens", ( PyCFunction ) Camera_oldsetLens, METH_O,
- "(f) - Set *perpective* Camera lens value"},
- {"setScale", ( PyCFunction ) Camera_oldsetScale, METH_O,
- "(f) - Set *ortho* Camera scale value"},
- {"setClipStart", ( PyCFunction ) Camera_oldsetClipStart, METH_O,
- "(f) - Set Camera clip start value"},
- {"setClipEnd", ( PyCFunction ) Camera_oldsetClipEnd, METH_O,
- "(f) - Set Camera clip end value"},
- {"setDrawSize", ( PyCFunction ) Camera_oldsetDrawSize, METH_O,
- "(f) - Set Camera draw size value"},
- {"getScriptLinks", ( PyCFunction ) Camera_oldgetScriptLinks, METH_O,
- "(eventname) - Get a list of this camera's scriptlinks (Text names) "
- "of the given type\n"
- "(eventname) - string: FrameChanged, Redraw or Render."},
- {"addScriptLink", ( PyCFunction ) Camera_addScriptLink, METH_VARARGS,
- "(text, evt) - Add a new camera scriptlink.\n"
- "(text) - string: an existing Blender Text name;\n"
- "(evt) string: FrameChanged, Redraw or Render."},
- {"clearScriptLinks", ( PyCFunction ) Camera_clearScriptLinks,
- METH_NOARGS,
- "() - Delete all scriptlinks from this camera.\n"
- "([s1<,s2,s3...>]) - Delete specified scriptlinks from this camera."},
- {"__copy__", ( PyCFunction ) Camera_copy, METH_NOARGS,
- "() - Return a copy of the camera."},
- {"copy", ( PyCFunction ) Camera_copy, METH_NOARGS,
- "() - Return a copy of the camera."},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Python Camera_Type callback function prototypes: */
-/*****************************************************************************/
-static int Camera_compare( BPy_Camera * a, BPy_Camera * b );
-static PyObject *Camera_repr( BPy_Camera * self );
-
-static PyObject *M_Camera_New( PyObject * self, PyObject * args,
- PyObject * kwords )
-{
- char *type_str = "persp"; /* "persp" is type 0, "ortho" is type 1 */
- char *name_str = "Camera";
- static char *kwlist[] = { "type_str", "name_str", NULL };
- PyObject *pycam; /* for Camera Data object wrapper in Python */
- Camera *blcam; /* for actual Camera Data we create in Blender */
-
- /* Parse the arguments passed in by the Python interpreter */
- if( !PyArg_ParseTupleAndKeywords( args, kwords, "|ss", kwlist,
- &type_str, &name_str ) )
- /* We expected string(s) (or nothing) as argument, but we didn't get that. */
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected zero, one or two strings as arguments" );
-
- blcam = add_camera( name_str ); /* first create the Camera Data in Blender */
-
- if( blcam ) /* now create the wrapper obj in Python */
- pycam = Camera_CreatePyObject( blcam );
- else
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't create Camera Data in Blender" );
-
- /* let's return user count to zero, because ... */
- blcam->id.us = 0; /* ... add_camera() incref'ed it */
- /* XXX XXX Do this in other modules, too */
-
- if( pycam == NULL )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create Camera PyObject" );
-
- if( strcmp( type_str, "persp" ) == 0 )
- /* default, no need to set, so */
- /*blcam->type = (short)EXPP_CAM_TYPE_PERSP */
- ;
- /* we comment this line */
- else if( strcmp( type_str, "ortho" ) == 0 )
- blcam->type = ( short ) EXPP_CAM_TYPE_ORTHO;
- else
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "unknown camera type" );
-
- return pycam;
-}
-
-static PyObject *M_Camera_Get( PyObject * self, PyObject * args )
-{
- char *name = NULL;
- Camera *cam_iter;
-
- if( !PyArg_ParseTuple( args, "|s", &name ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument (or nothing)" );
-
- cam_iter = G.main->camera.first;
-
- if( name ) { /* (name) - Search camera by name */
-
- PyObject *wanted_cam = NULL;
-
- while( cam_iter && !wanted_cam ) {
-
- if( strcmp( name, cam_iter->id.name + 2 ) == 0 ) {
- wanted_cam = Camera_CreatePyObject( cam_iter );
- break;
- }
-
- cam_iter = cam_iter->id.next;
- }
-
- if( !wanted_cam ) { /* Requested camera doesn't exist */
- char error_msg[64];
- PyOS_snprintf( error_msg, sizeof( error_msg ),
- "Camera \"%s\" not found", name );
- return EXPP_ReturnPyObjError( PyExc_NameError,
- error_msg );
- }
-
- return wanted_cam;
- }
-
- else { /* () - return a list of wrappers for all cameras in the scene */
- int index = 0;
- PyObject *cam_pylist, *pyobj;
-
- cam_pylist =
- PyList_New( BLI_countlist( &( G.main->camera ) ) );
-
- if( !cam_pylist )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create PyList" );
-
- while( cam_iter ) {
- pyobj = Camera_CreatePyObject( cam_iter );
-
- if( !pyobj ) {
- Py_DECREF(cam_pylist);
- return EXPP_ReturnPyObjError
- ( PyExc_MemoryError,
- "couldn't create Camera PyObject" );
- }
- PyList_SET_ITEM( cam_pylist, index, pyobj );
-
- cam_iter = cam_iter->id.next;
- index++;
- }
-
- return cam_pylist;
- }
-}
-
-PyObject *Camera_Init( void )
-{
- PyObject *submodule;
-
- if( PyType_Ready( &Camera_Type ) < 0 )
- return NULL;
-
- submodule = Py_InitModule3( "Blender.Camera",
- M_Camera_methods, M_Camera_doc );
-
- PyModule_AddIntConstant( submodule, "LENS", IPOKEY_LENS );
- PyModule_AddIntConstant( submodule, "CLIPPING", IPOKEY_CLIPPING );
-
- return submodule;
-}
-
-/* Three Python Camera_Type helper functions needed by the Object module: */
-
-PyObject *Camera_CreatePyObject( Camera * cam )
-{
- BPy_Camera *pycam;
-
- pycam = ( BPy_Camera * ) PyObject_NEW( BPy_Camera, &Camera_Type );
-
- if( !pycam )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create BPy_Camera PyObject" );
-
- pycam->camera = cam;
- return ( PyObject * ) pycam;
-}
-
-Camera *Camera_FromPyObject( PyObject * pyobj )
-{
- return ( ( BPy_Camera * ) pyobj )->camera;
-}
-
-/*****************************************************************************/
-/* Python BPy_Camera methods: */
-/*****************************************************************************/
-
-static PyObject *Camera_oldgetType( BPy_Camera * self )
-{
- return PyInt_FromLong( self->camera->type );
-}
-
-static PyObject *Camera_oldgetMode( BPy_Camera * self )
-{
- return PyInt_FromLong( self->camera->flag );
-}
-
-static PyObject *Camera_oldgetLens( BPy_Camera * self )
-{
- return PyFloat_FromDouble( self->camera->lens );
-}
-
-static PyObject *Camera_oldgetScale( BPy_Camera * self )
-{
- return PyFloat_FromDouble( self->camera->ortho_scale );
-}
-
-static PyObject *Camera_oldgetClipStart( BPy_Camera * self )
-{
- return PyFloat_FromDouble( self->camera->clipsta );
-}
-
-static PyObject *Camera_oldgetClipEnd( BPy_Camera * self )
-{
- return PyFloat_FromDouble( self->camera->clipend );
-}
-
-static PyObject *Camera_oldgetDrawSize( BPy_Camera * self )
-{
- return PyFloat_FromDouble( self->camera->drawsize );
-}
-
-
-
-static PyObject *Camera_oldsetIpo( BPy_Camera * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Camera_setIpo );
-}
-
-static PyObject *Camera_oldclearIpo( BPy_Camera * self )
-{
- Camera *cam = self->camera;
- Ipo *ipo = ( Ipo * ) cam->ipo;
-
- if( ipo ) {
- ID *id = &ipo->id;
- if( id->us > 0 )
- id->us--;
- cam->ipo = NULL;
-
- return EXPP_incr_ret_True();
- }
-
- return EXPP_incr_ret_False(); /* no ipo found */
-}
-
-static PyObject *Camera_oldsetType( BPy_Camera * self, PyObject * value )
-{
- char *type = PyString_AsString(value);
-
- if(!value)
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument" );
-
- if( strcmp( type, "persp" ) == 0 )
- self->camera->type = ( short ) EXPP_CAM_TYPE_PERSP;
- else if( strcmp( type, "ortho" ) == 0 )
- self->camera->type = ( short ) EXPP_CAM_TYPE_ORTHO;
- else
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "unknown camera type" );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Camera_oldsetMode( BPy_Camera * self, PyObject * args )
-{
- char *mode_str1 = NULL, *mode_str2 = NULL;
- short flag = 0;
-
- if( !PyArg_ParseTuple( args, "|ss", &mode_str1, &mode_str2 ) )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected one or two strings as arguments" );
-
- if( mode_str1 != NULL ) {
- if( strcmp( mode_str1, "showLimits" ) == 0 )
- flag |= ( short ) EXPP_CAM_MODE_SHOWLIMITS;
- else if( strcmp( mode_str1, "showMist" ) == 0 )
- flag |= ( short ) EXPP_CAM_MODE_SHOWMIST;
- else
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "first argument is an unknown camera flag" );
-
- if( mode_str2 != NULL ) {
- if( strcmp( mode_str2, "showLimits" ) == 0 )
- flag |= ( short ) EXPP_CAM_MODE_SHOWLIMITS;
- else if( strcmp( mode_str2, "showMist" ) == 0 )
- flag |= ( short ) EXPP_CAM_MODE_SHOWMIST;
- else
- return EXPP_ReturnPyObjError
- ( PyExc_AttributeError,
- "second argument is an unknown camera flag" );
- }
- }
-
- self->camera->flag = flag;
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Camera_oldsetLens( BPy_Camera * self, PyObject * value )
-{
- float param = PyFloat_AsDouble(value);
-
- if( !PyFloat_Check(value) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected float argument" );
-
- self->camera->lens = EXPP_ClampFloat( param,
- EXPP_CAM_LENS_MIN,
- EXPP_CAM_LENS_MAX );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Camera_oldsetScale( BPy_Camera * self, PyObject * value )
-{
- float param = PyFloat_AsDouble(value);
-
- if( !PyFloat_Check(value) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected float argument" );
-
- self->camera->ortho_scale = EXPP_ClampFloat( param,
- EXPP_CAM_SCALE_MIN,
- EXPP_CAM_SCALE_MAX );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Camera_oldsetClipStart( BPy_Camera * self, PyObject * value )
-{
- float param = PyFloat_AsDouble(value);
-
- if( !PyFloat_Check(value) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected float argument" );
-
- self->camera->clipsta = EXPP_ClampFloat( param,
- EXPP_CAM_CLIPSTART_MIN,
- EXPP_CAM_CLIPSTART_MAX );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Camera_oldsetClipEnd( BPy_Camera * self, PyObject * value )
-{
- float param = PyFloat_AsDouble(value);
-
- if( !PyFloat_Check(value) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected float argument" );
-
- self->camera->clipend = EXPP_ClampFloat( param,
- EXPP_CAM_CLIPEND_MIN,
- EXPP_CAM_CLIPEND_MAX );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Camera_oldsetDrawSize( BPy_Camera * self, PyObject * value )
-{
- float param = PyFloat_AsDouble(value);
-
- if( !PyFloat_Check(value) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected float argument" );
-
- self->camera->drawsize = EXPP_ClampFloat( param,
- EXPP_CAM_DRAWSIZE_MIN,
- EXPP_CAM_DRAWSIZE_MAX );
-
- Py_RETURN_NONE;
-}
-
-/* cam.addScriptLink */
-static PyObject *Camera_addScriptLink( BPy_Camera * self, PyObject * args )
-{
- Camera *cam = self->camera;
- ScriptLink *slink = NULL;
-
- slink = &( cam )->scriptlink;
-
- return EXPP_addScriptLink( slink, args, 0 );
-}
-
-/* cam.clearScriptLinks */
-static PyObject *Camera_clearScriptLinks( BPy_Camera * self, PyObject * args )
-{
- Camera *cam = self->camera;
- ScriptLink *slink = NULL;
-
- slink = &( cam )->scriptlink;
-
- return EXPP_clearScriptLinks( slink, args );
-}
-
-/* cam.getScriptLinks */
-static PyObject *Camera_oldgetScriptLinks( BPy_Camera * self, PyObject * value )
-{
- Camera *cam = self->camera;
- ScriptLink *slink = NULL;
- PyObject *ret = NULL;
-
- slink = &( cam )->scriptlink;
-
- ret = EXPP_getScriptLinks( slink, value, 0 );
-
- if( ret )
- return ret;
- else
- return NULL;
-}
-
-/* cam.__copy__ */
-static PyObject *Camera_copy( BPy_Camera * self )
-{
- PyObject *pycam; /* for Camera Data object wrapper in Python */
- Camera *blcam; /* for actual Camera Data we create in Blender */
-
- blcam = copy_camera( self->camera ); /* first create the Camera Data in Blender */
-
- if( blcam ) /* now create the wrapper obj in Python */
- pycam = Camera_CreatePyObject( blcam );
- else
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't create Camera Data in Blender" );
-
- /* let's return user count to zero, because ... */
- blcam->id.us = 0; /* ... copy_camera() incref'ed it */
- /* XXX XXX Do this in other modules, too */
-
- if( pycam == NULL )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create Camera PyObject" );
-
- return pycam;
-}
-
-static PyObject *Camera_getType( BPy_Camera * self )
-{
- if (self->camera->type == EXPP_CAM_TYPE_PERSP)
- return PyString_FromString("persp");
- else /* must be EXPP_CAM_TYPE_ORTHO */
- return PyString_FromString("ortho");
-}
-
-static int Camera_setType( BPy_Camera * self, PyObject * value )
-{
- char *type = NULL;
- type = PyString_AsString(value);
-
- if (!type)
- return EXPP_ReturnIntError( PyExc_ValueError,
- "expected a string" );
- if (strcmp("persp", type)==0) {
- self->camera->type = EXPP_CAM_TYPE_PERSP;
- return 0;
- } else if (strcmp("ortho", type)==0) {
- self->camera->type = EXPP_CAM_TYPE_ORTHO;
- return 0;
- }
-
- return EXPP_ReturnIntError( PyExc_ValueError,
- "expected a string \"ortho\" or \"persp\"" );
-}
-
-
-
-static PyObject *Camera_getMode( BPy_Camera * self )
-{
- return PyInt_FromLong(self->camera->flag);
-}
-
-static int Camera_setMode( BPy_Camera * self, PyObject * value )
-{
- unsigned int flag = 0;
-
- if( !PyInt_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected an integer (bitmask) as argument" );
-
- flag = ( unsigned int )PyInt_AS_LONG( value );
-
- self->camera->flag = flag;
- return 0;
-}
-
-static PyObject *Camera_getIpo( BPy_Camera * self )
-{
- struct Ipo *ipo = self->camera->ipo;
-
- if( ipo )
- return Ipo_CreatePyObject( ipo );
- Py_RETURN_NONE;
-}
-
-static int Camera_setIpo( BPy_Camera * self, PyObject * value )
-{
- return GenericLib_assignData(value, (void **) &self->camera->ipo, 0, 1, ID_IP, ID_CA);
-}
-
-/*
- * get floating point attributes
- */
-
-static PyObject *getFloatAttr( BPy_Camera *self, void *type )
-{
- float param;
- struct Camera *cam= self->camera;
-
- switch( (int)type ) {
- case EXPP_CAM_ATTR_LENS:
- param = cam->lens;
- break;
- case EXPP_CAM_ATTR_ANGLE:
- param = 360.0f * atan(16.0f/cam->lens) / M_PI;
- break;
- case EXPP_CAM_ATTR_DOFDIST:
- param = cam->YF_dofdist;
- break;
- case EXPP_CAM_ATTR_CLIPSTART:
- param = cam->clipsta;
- break;
- case EXPP_CAM_ATTR_CLIPEND:
- param = cam->clipend;
- break;
- case EXPP_CAM_ATTR_DRAWSIZE:
- param = cam->drawsize;
- break;
- case EXPP_CAM_ATTR_SCALE:
- param = cam->ortho_scale;
- break;
- case EXPP_CAM_ATTR_ALPHA:
- param = cam->passepartalpha;
- break;
- case EXPP_CAM_ATTR_SHIFTX:
- param = cam->shiftx;
- break;
- case EXPP_CAM_ATTR_SHIFTY:
- param = cam->shifty;
- break;
-
- default:
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "undefined type in getFloatAttr" );
- }
-
- return PyFloat_FromDouble( param );
-}
-
-
-
-/*
- * set floating point attributes which require clamping
- */
-
-static int setFloatAttrClamp( BPy_Camera *self, PyObject *value, void *type )
-{
- float *param;
- struct Camera *cam = self->camera;
- float min, max;
- int ret;
-
- switch( (int)type ) {
- case EXPP_CAM_ATTR_LENS:
- min = 1.0;
- max = 250.0;
- param = &cam->lens;
- break;
- case EXPP_CAM_ATTR_ANGLE:
- min = 7.323871;
- max = 172.847331;
- param = &cam->lens;
- break;
- case EXPP_CAM_ATTR_DOFDIST:
- min = 0.0;
- max = 5000.0;
- param = &cam->YF_dofdist;
- break;
- case EXPP_CAM_ATTR_CLIPSTART:
- min = 0.0;
- max = 100.0;
- param = &cam->clipsta;
- break;
- case EXPP_CAM_ATTR_CLIPEND:
- min = 1.0;
- max = 5000.0;
- param = &cam->clipend;
- break;
- case EXPP_CAM_ATTR_DRAWSIZE:
- min = 0.1f;
- max = 10.0;
- param = &cam->drawsize;
- break;
- case EXPP_CAM_ATTR_SCALE:
- min = 0.01f;
- max = 1000.0;
- param = &cam->ortho_scale;
- break;
- case EXPP_CAM_ATTR_ALPHA:
- min = 0.0;
- max = 1.0;
- param = &cam->passepartalpha;
- break;
- case EXPP_CAM_ATTR_SHIFTX:
- min = -2.0;
- max = 2.0;
- param = &cam->shiftx;
- break;
- case EXPP_CAM_ATTR_SHIFTY:
- min = -2.0;
- max = 2.0;
- param = &cam->shifty;
- break;
-
- default:
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "undefined type in setFloatAttrClamp" );
- }
-
- ret = EXPP_setFloatClamped( value, param, min, max );
-
- if (ret==0) {
- if ((int)type == EXPP_CAM_ATTR_ANGLE) {
- cam->lens = 16.0f / tan(M_PI*cam->lens/360.0f);
- }
- }
- return ret;
-}
-
-
-/*
- * get floating point attributes
- */
-
-static PyObject *getFlagAttr( BPy_Camera *self, void *type )
-{
- if (self->camera->flag & (int)type)
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
-}
-
-/*
- * set floating point attributes which require clamping
- */
-
-static int setFlagAttr( BPy_Camera *self, PyObject *value, void *type )
-{
- int param = PyObject_IsTrue( value );
- if( param == -1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected True/False or 0/1" );
-
- if (param)
- self->camera->flag |= (int)type;
- else
- self->camera->flag &= ~(int)type;
- return 0;
-}
-
-
-/*****************************************************************************/
-/* Python attributes get/set structure: */
-/*****************************************************************************/
-static PyGetSetDef BPy_Camera_getseters[] = {
- GENERIC_LIB_GETSETATTR,
- {"type",
- (getter)Camera_getType, (setter)Camera_setType,
- "camera type \"persp\" or \"ortho\"",
- NULL},
- {"mode",
- (getter)Camera_getMode, (setter)Camera_setMode,
- "Cameras mode",
- NULL},
- {"ipo",
- (getter)Camera_getIpo, (setter)Camera_setIpo,
- "Cameras ipo",
- NULL},
-
- /* float settings */
- {"lens",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "lens angle for perspective cameras",
- (void *)EXPP_CAM_ATTR_LENS},
- {"angle",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "lens angle for perspective cameras",
- (void *)EXPP_CAM_ATTR_ANGLE},
-
- {"scale",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "scale for ortho cameras",
- (void *)EXPP_CAM_ATTR_SCALE},
- {"clipStart",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "the cameras clip start",
- (void *)EXPP_CAM_ATTR_CLIPSTART},
- {"clipEnd",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "the cameras clip end",
- (void *)EXPP_CAM_ATTR_CLIPEND},
- {"shiftX",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "the cameras X perspective shift",
- (void *)EXPP_CAM_ATTR_SHIFTX},
- {"shiftY",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "the cameras Y perspective shift",
- (void *)EXPP_CAM_ATTR_SHIFTY},
- {"dofDist",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "cameras dof distance",
- (void *)EXPP_CAM_ATTR_DOFDIST},
- {"drawSize",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "the cameras display size",
- (void *)EXPP_CAM_ATTR_DRAWSIZE},
- {"alpha",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "passepart alpha value for display",
- (void *)EXPP_CAM_ATTR_ALPHA},
-
- /* flags - use flags as defined in DNA_camera_types.h */
- {"drawLimits",
- (getter)getFlagAttr, (setter)setFlagAttr,
- "toggle the draw limits display flag",
- (void *)CAM_SHOWLIMITS},
- {"drawMist",
- (getter)getFlagAttr, (setter)setFlagAttr,
- "toggle the draw mist display flag",
- (void *)CAM_SHOWMIST},
- {"drawName",
- (getter)getFlagAttr, (setter)setFlagAttr,
- "toggle the draw name display flag",
- (void *)CAM_SHOWNAME},
- {"drawTileSafe",
- (getter)getFlagAttr, (setter)setFlagAttr,
- "toggle the tile safe display flag",
- (void *)CAM_SHOWTITLESAFE},
- {"drawPassepartout",
- (getter)getFlagAttr, (setter)setFlagAttr,
- "toggle the passPartOut display flag",
- (void *)CAM_SHOWPASSEPARTOUT},
- {"angleToggle",
- (getter)getFlagAttr, (setter)setFlagAttr,
- "toggle the camera input unit flag",
- (void *)CAM_ANGLETOGGLE},
- {NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-
-/*****************************************************************************/
-/* Python Camera_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject Camera_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender Camera", /* char *tp_name; */
- sizeof( BPy_Camera ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL, /* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- ( cmpfunc ) Camera_compare, /* cmpfunc tp_compare; */
- ( reprfunc ) Camera_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- 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; */
- 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, /* 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, /* 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 ***/
- BPy_Camera_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_Camera_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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 int Camera_compare( BPy_Camera * a, BPy_Camera * b )
-{
- Camera *pa = a->camera, *pb = b->camera;
- return ( pa == pb ) ? 0 : -1;
-}
-
-static PyObject *Camera_repr( BPy_Camera * self )
-{
- return PyString_FromFormat( "[Camera \"%s\"]",
- self->camera->id.name + 2 );
-}
-
-/*
- * Camera_insertIpoKey()
- * inserts Camera IPO key for LENS and CLIPPING
- */
-
-static PyObject *Camera_insertIpoKey( BPy_Camera * self, PyObject * args )
-{
- int key = 0;
-
- if( !PyArg_ParseTuple( args, "i", &( key ) ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected int argument" ) );
-
- if (key == IPOKEY_LENS){
- insertkey((ID *)self->camera, ID_CA, NULL, NULL, CAM_LENS, 0);
- }
- else if (key == IPOKEY_CLIPPING){
- insertkey((ID *)self->camera, ID_CA, NULL, NULL, CAM_STA, 0);
- insertkey((ID *)self->camera, ID_CA, NULL, NULL, CAM_END, 0);
- }
-
- allspace(REMAKEIPO, 0);
- EXPP_allqueue(REDRAWIPO, 0);
- EXPP_allqueue(REDRAWVIEW3D, 0);
- EXPP_allqueue(REDRAWACTION, 0);
- EXPP_allqueue(REDRAWNLA, 0);
-
- Py_RETURN_NONE;
-}
diff --git a/source/blender/python/api2_2x/Camera.h b/source/blender/python/api2_2x/Camera.h
deleted file mode 100644
index bb751a8849a..00000000000
--- a/source/blender/python/api2_2x/Camera.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * $Id: Camera.h 10269 2007-03-15 01:09:14Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_CAMERA_H
-#define EXPP_CAMERA_H
-
-#include <Python.h>
-#include "DNA_camera_types.h"
-
-extern PyTypeObject Camera_Type;
-
-#define BPy_Camera_Check(v) \
- ((v)->ob_type == &Camera_Type) /* for type checking */
-
-/* Python BPy_Camera structure definition */
-typedef struct {
- PyObject_HEAD /* required py macro */
- Camera * camera;
-
-} BPy_Camera;
-
-/*****************************************************************************/
-/* Python BPy_Camera defaults: */
-/*****************************************************************************/
-
-/* Camera types */
-
-#define EXPP_CAM_TYPE_PERSP 0
-#define EXPP_CAM_TYPE_ORTHO 1
-
-/* Camera mode flags */
-
-#define EXPP_CAM_MODE_SHOWLIMITS 1
-#define EXPP_CAM_MODE_SHOWMIST 2
-
-/* Camera MIN, MAX values */
-
-#define EXPP_CAM_LENS_MIN 1.0
-#define EXPP_CAM_LENS_MAX 250.0
-#define EXPP_CAM_SCALE_MIN 0.01f
-#define EXPP_CAM_SCALE_MAX 1000.0
-#define EXPP_CAM_CLIPSTART_MIN 0.0
-#define EXPP_CAM_CLIPSTART_MAX 100.0
-#define EXPP_CAM_CLIPEND_MIN 1.0
-#define EXPP_CAM_CLIPEND_MAX 5000.0
-#define EXPP_CAM_DRAWSIZE_MIN 0.1f
-#define EXPP_CAM_DRAWSIZE_MAX 10.0
-
-PyObject *Camera_Init( void );
-PyObject *Camera_CreatePyObject( Camera * cam );
-Camera *Camera_FromPyObject( PyObject * pyobj );
-
-#endif /* EXPP_CAMERA_H */
diff --git a/source/blender/python/api2_2x/Constraint.c b/source/blender/python/api2_2x/Constraint.c
deleted file mode 100644
index 51dbe6a85f9..00000000000
--- a/source/blender/python/api2_2x/Constraint.c
+++ /dev/null
@@ -1,2692 +0,0 @@
-/*
- * $Id: Constraint.c 12705 2007-11-28 12:42:36Z ton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Joseph Gilbert, Ken Hughes, Joshua Leung
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include "Constraint.h" /*This must come first*/
-
-#include "DNA_object_types.h"
-#include "DNA_effect_types.h"
-#include "DNA_vec_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_text_types.h"
-
-#include "BKE_main.h"
-#include "BKE_global.h"
-#include "BKE_library.h"
-#include "BKE_action.h"
-#include "BKE_armature.h"
-#include "BKE_constraint.h"
-#include "BLI_blenlib.h"
-#include "BIF_editconstraint.h"
-#include "BSE_editipo.h"
-#include "MEM_guardedalloc.h"
-#include "butspace.h"
-#include "blendef.h"
-#include "mydevice.h"
-
-#include "IDProp.h"
-#include "Object.h"
-#include "NLA.h"
-#include "Text.h"
-#include "gen_utils.h"
-
-enum constraint_constants {
- EXPP_CONSTR_XROT = 0,
- EXPP_CONSTR_YROT = 1,
- EXPP_CONSTR_ZROT = 2,
- EXPP_CONSTR_XSIZE = 10,
- EXPP_CONSTR_YSIZE = 11,
- EXPP_CONSTR_ZSIZE = 12,
- EXPP_CONSTR_XLOC = 20,
- EXPP_CONSTR_YLOC = 21,
- EXPP_CONSTR_ZLOC = 22,
-
- EXPP_CONSTR_MAXX = TRACK_X,
- EXPP_CONSTR_MAXY = TRACK_Y,
- EXPP_CONSTR_MAXZ = TRACK_Z,
- EXPP_CONSTR_MINX = TRACK_nX,
- EXPP_CONSTR_MINY = TRACK_nY,
- EXPP_CONSTR_MINZ = TRACK_nZ,
-
- EXPP_CONSTR_TARGET = 100,
- EXPP_CONSTR_STRETCH,
- EXPP_CONSTR_ITERATIONS,
- EXPP_CONSTR_BONE,
- EXPP_CONSTR_CHAINLEN,
- EXPP_CONSTR_POSWEIGHT,
- EXPP_CONSTR_ROTWEIGHT,
- EXPP_CONSTR_ROTATE,
- EXPP_CONSTR_USETIP,
-
- EXPP_CONSTR_ACTION,
- EXPP_CONSTR_START,
- EXPP_CONSTR_END,
- EXPP_CONSTR_MIN,
- EXPP_CONSTR_MAX,
- EXPP_CONSTR_KEYON,
-
- EXPP_CONSTR_TRACK,
- EXPP_CONSTR_UP,
-
- EXPP_CONSTR_RESTLENGTH,
- EXPP_CONSTR_VOLVARIATION,
- EXPP_CONSTR_VOLUMEMODE,
- EXPP_CONSTR_PLANE,
-
- EXPP_CONSTR_FOLLOW,
- EXPP_CONSTR_OFFSET,
- EXPP_CONSTR_FORWARD,
-
- EXPP_CONSTR_LOCK,
-
- EXPP_CONSTR_MINMAX,
- EXPP_CONSTR_STICKY,
-
- EXPP_CONSTR_COPY,
- EXPP_CONSTR_LIMIT,
- EXPP_CONSTR_CLAMP,
-
- EXPP_CONSTR_LIMXMIN = LIMIT_XMIN,
- EXPP_CONSTR_LIMXMAX = LIMIT_XMAX,
- EXPP_CONSTR_LIMYMIN = LIMIT_YMIN,
- EXPP_CONSTR_LIMYMAX = LIMIT_YMAX,
- EXPP_CONSTR_LIMZMIN = LIMIT_ZMIN,
- EXPP_CONSTR_LIMZMAX = LIMIT_ZMAX,
-
- EXPP_CONSTR_LIMXROT = LIMIT_XROT,
- EXPP_CONSTR_LIMYROT = LIMIT_YROT,
- EXPP_CONSTR_LIMZROT = LIMIT_ZROT,
-
- EXPP_CONSTR_CLAMPCYCLIC,
-
- EXPP_CONSTR_XMIN,
- EXPP_CONSTR_XMAX,
- EXPP_CONSTR_YMIN,
- EXPP_CONSTR_YMAX,
- EXPP_CONSTR_ZMIN,
- EXPP_CONSTR_ZMAX,
-
- EXPP_CONSTR_SCRIPT,
- EXPP_CONSTR_PROPS,
-
- EXPP_CONSTR_FROM,
- EXPP_CONSTR_TO,
- EXPP_CONSTR_EXPO,
- EXPP_CONSTR_FROMMINX,
- EXPP_CONSTR_FROMMAXX,
- EXPP_CONSTR_FROMMINY,
- EXPP_CONSTR_FROMMAXY,
- EXPP_CONSTR_FROMMINZ,
- EXPP_CONSTR_FROMMAXZ,
- EXPP_CONSTR_TOMINX,
- EXPP_CONSTR_TOMAXX,
- EXPP_CONSTR_TOMINY,
- EXPP_CONSTR_TOMAXY,
- EXPP_CONSTR_TOMINZ,
- EXPP_CONSTR_TOMAXZ,
- EXPP_CONSTR_MAPX,
- EXPP_CONSTR_MAPY,
- EXPP_CONSTR_MAPZ,
-
- EXPP_CONSTR_OWNSPACE,
- EXPP_CONSTR_TARSPACE,
-
- EXPP_CONSTR_RB_TYPE,
- EXPP_CONSTR_RB_BALL,
- EXPP_CONSTR_RB_HINGE,
- EXPP_CONSTR_RB_GENERIC6DOF,
- EXPP_CONSTR_RB_VEHICLE,
- EXPP_CONSTR_RB_PIVX,
- EXPP_CONSTR_RB_PIVY,
- EXPP_CONSTR_RB_PIVZ,
- EXPP_CONSTR_RB_AXX,
- EXPP_CONSTR_RB_AXY,
- EXPP_CONSTR_RB_AXZ,
- EXPP_CONSTR_RB_MINLIMIT0,
- EXPP_CONSTR_RB_MINLIMIT1,
- EXPP_CONSTR_RB_MINLIMIT2,
- EXPP_CONSTR_RB_MINLIMIT3,
- EXPP_CONSTR_RB_MINLIMIT4,
- EXPP_CONSTR_RB_MINLIMIT5,
- EXPP_CONSTR_RB_MAXLIMIT0,
- EXPP_CONSTR_RB_MAXLIMIT1,
- EXPP_CONSTR_RB_MAXLIMIT2,
- EXPP_CONSTR_RB_MAXLIMIT3,
- EXPP_CONSTR_RB_MAXLIMIT4,
- EXPP_CONSTR_RB_MAXLIMIT5,
- EXPP_CONSTR_RB_EXTRAFZ,
- EXPP_CONSTR_RB_FLAG,
-
-};
-
-/*****************************************************************************/
-/* Python BPy_Constraint methods declarations: */
-/*****************************************************************************/
-static PyObject *Constraint_getName( BPy_Constraint * self );
-static int Constraint_setName( BPy_Constraint * self, PyObject *arg );
-static PyObject *Constraint_getType( BPy_Constraint * self );
-static PyObject *Constraint_getInfluence( BPy_Constraint * self );
-static int Constraint_setInfluence( BPy_Constraint * self, PyObject * arg );
-
-static PyObject *Constraint_insertKey( BPy_Constraint * self, PyObject * arg );
-
-static PyObject *Constraint_getData( BPy_Constraint * self, PyObject * key );
-static int Constraint_setData( BPy_Constraint * self, PyObject * key,
- PyObject * value );
-
-/*****************************************************************************/
-/* Python BPy_Constraint methods table: */
-/*****************************************************************************/
-static PyMethodDef BPy_Constraint_methods[] = {
- /* name, method, flags, doc */
- {"insertKey", ( PyCFunction ) Constraint_insertKey, METH_O,
- "Insert influence keyframe for constraint"},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Python BPy_Constraint attributes get/set structure: */
-/*****************************************************************************/
-static PyGetSetDef BPy_Constraint_getseters[] = {
- {"name",
- (getter)Constraint_getName, (setter)Constraint_setName,
- "Constraint name", NULL},
- {"type",
- (getter)Constraint_getType, (setter)NULL,
- "Constraint type (read only)", NULL},
- {"influence",
- (getter)Constraint_getInfluence, (setter)Constraint_setInfluence,
- "Constraint influence", NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-/*****************************************************************************/
-/* Python Constraint_Type Mapping Methods table: */
-/*****************************************************************************/
-static PyMappingMethods Constraint_as_mapping = {
- NULL, /* mp_length */
- ( binaryfunc ) Constraint_getData, /* mp_subscript */
- ( objobjargproc ) Constraint_setData, /* mp_ass_subscript */
-};
-
-/*****************************************************************************/
-/* Python Constraint_Type callback function prototypes: */
-/*****************************************************************************/
-static PyObject *Constraint_repr( BPy_Constraint * self );
-static int Constraint_compare( BPy_Constraint * a, BPy_Constraint * b );
-
-/*****************************************************************************/
-/* Python Constraint_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject Constraint_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender Constraint", /* char *tp_name; */
- sizeof( BPy_Constraint ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL, /* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- ( cmpfunc ) Constraint_compare, /* cmpfunc tp_compare; */
- ( reprfunc ) Constraint_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- &Constraint_as_mapping, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- NULL, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
- 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, /* 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, /* 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 ***/
- BPy_Constraint_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_Constraint_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-/*****************************************************************************/
-/* Python BPy_Constraint methods: */
-/*****************************************************************************/
-
-/*
- * return the name of this constraint
- */
-
-static PyObject *Constraint_getName( BPy_Constraint * self )
-{
- if( !self->con )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This constraint has been removed!" );
-
- return PyString_FromString( self->con->name );
-}
-
-/*
- * set the name of this constraint
- */
-
-static int Constraint_setName( BPy_Constraint * self, PyObject * attr )
-{
- char *name = PyString_AsString( attr );
- if( !name )
- return EXPP_ReturnIntError( PyExc_TypeError, "expected string arg" );
-
- if( !self->con )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "This constraint has been removed!" );
-
- BLI_strncpy( self->con->name, name, sizeof( self->con->name ) );
-
- return 0;
-}
-
-/*
- * return the influence of this constraint
- */
-
-static PyObject *Constraint_getInfluence( BPy_Constraint * self )
-{
- if( !self->con )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This constraint has been removed!" );
-
- return PyFloat_FromDouble( (double)self->con->enforce );
-}
-
-/*
- * set the influence of this constraint
- */
-
-static int Constraint_setInfluence( BPy_Constraint * self, PyObject * value )
-{
- if( !self->con )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "This constraint has been removed!" );
-
- return EXPP_setFloatClamped( value, &self->con->enforce, 0.0, 1.0 );
-}
-
-/*
- * return the type of this constraint
- */
-
-static PyObject *Constraint_getType( BPy_Constraint * self )
-{
- if( !self->con )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This constraint has been removed!" );
-
- return PyInt_FromLong( self->con->type );
-}
-
-/*
- * add keyframe for influence
- base on code in add_influence_key_to_constraint_func()
- */
-static PyObject *Constraint_insertKey( BPy_Constraint * self, PyObject * value )
-{
- bConstraint *con = self->con;
- Object *ob = self->obj;
- bPoseChannel *pchan = self->pchan;
- IpoCurve *icu;
- float cfra = (float)PyFloat_AsDouble(value);
- char actname[32] = "";
-
- if( !self->con )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This constraint has been removed!" );
-
- /* get frame for inserting key */
- if( PyFloat_Check(value) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a float argument" );
-
- /* find actname for locating that action-channel that a constraint channel should be added to */
- if (ob) {
- if (pchan) {
- /* actname is the name of the pchan that this constraint belongs to */
- BLI_strncpy(actname, pchan->name, 32);
- }
- else {
- /* hardcoded achan name -> "Object" (this may change in future) */
- strcpy(actname, "Object");
- }
- }
- else {
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "constraint doesn't belong to anything" );
- }
- icu= verify_ipocurve((ID *)ob, ID_CO, actname, con->name, NULL, CO_ENFORCE);
-
- if (!icu)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "cannot get a curve from this IPO, may be using libdata" );
-
- if( ob->action )
- insert_vert_icu( icu, get_action_frame(ob, cfra), con->enforce, 0);
- else
- insert_vert_icu( icu, cfra, con->enforce, 0);
-
- Py_RETURN_NONE;
-}
-
-/******************************************************************************/
-/* Constraint Space Conversion get/set procedures */
-/* - These are called before/instead of individual constraint */
-/* get/set procedures when OWNERSPACE or TARGETSPACE are chosen */
-/* - They are only called from Constraint_g/setData */
-/******************************************************************************/
-
-static PyObject *constspace_getter( BPy_Constraint * self, int type )
-{
- bConstraint *con= (bConstraint *)(self->con);
-
- /* depends on type being asked for
- * NOTE: not all constraints support all space types
- */
- if (type == EXPP_CONSTR_OWNSPACE) {
- switch (con->type) {
- /* all of these support this... */
- case CONSTRAINT_TYPE_PYTHON:
- case CONSTRAINT_TYPE_LOCLIKE:
- case CONSTRAINT_TYPE_ROTLIKE:
- case CONSTRAINT_TYPE_SIZELIKE:
- case CONSTRAINT_TYPE_TRACKTO:
- case CONSTRAINT_TYPE_LOCLIMIT:
- case CONSTRAINT_TYPE_ROTLIMIT:
- case CONSTRAINT_TYPE_SIZELIMIT:
- case CONSTRAINT_TYPE_TRANSFORM:
- return PyInt_FromLong( (long)con->ownspace );
- }
- }
- else if (type == EXPP_CONSTR_TARSPACE) {
- switch (con->type) {
- /* all of these support this... */
- case CONSTRAINT_TYPE_PYTHON:
- case CONSTRAINT_TYPE_ACTION:
- case CONSTRAINT_TYPE_LOCLIKE:
- case CONSTRAINT_TYPE_ROTLIKE:
- case CONSTRAINT_TYPE_SIZELIKE:
- case CONSTRAINT_TYPE_TRACKTO:
- case CONSTRAINT_TYPE_TRANSFORM:
- return PyInt_FromLong( (long)con->tarspace );
- }
- }
-
- /* raise error if failed */
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
-}
-
-static int constspace_setter( BPy_Constraint *self, int type, PyObject *value )
-{
- bConstraint *con= (bConstraint *)(self->con);
-
- /* depends on type being asked for
- * NOTE: not all constraints support all space types
- */
- if (type == EXPP_CONSTR_OWNSPACE) {
- switch (con->type) {
- /* all of these support this... */
- case CONSTRAINT_TYPE_PYTHON:
- case CONSTRAINT_TYPE_LOCLIKE:
- case CONSTRAINT_TYPE_ROTLIKE:
- case CONSTRAINT_TYPE_SIZELIKE:
- case CONSTRAINT_TYPE_TRACKTO:
- case CONSTRAINT_TYPE_LOCLIMIT:
- case CONSTRAINT_TYPE_ROTLIMIT:
- case CONSTRAINT_TYPE_SIZELIMIT:
- case CONSTRAINT_TYPE_TRANSFORM:
- {
- /* only copy depending on ownertype */
- if (self->pchan) {
- return EXPP_setIValueClamped( value, &con->ownspace,
- CONSTRAINT_SPACE_WORLD, CONSTRAINT_SPACE_PARLOCAL, 'h' );
- }
- else {
- return EXPP_setIValueClamped( value, &con->ownspace,
- CONSTRAINT_SPACE_WORLD, CONSTRAINT_SPACE_LOCAL, 'h' );
- }
- }
- break;
- }
- }
- else if (type == EXPP_CONSTR_TARSPACE) {
- switch (con->type) {
- /* all of these support this... */
- case CONSTRAINT_TYPE_PYTHON:
- case CONSTRAINT_TYPE_ACTION:
- case CONSTRAINT_TYPE_LOCLIKE:
- case CONSTRAINT_TYPE_ROTLIKE:
- case CONSTRAINT_TYPE_SIZELIKE:
- case CONSTRAINT_TYPE_TRACKTO:
- case CONSTRAINT_TYPE_TRANSFORM:
- {
- Object *tar;
- char *subtarget;
-
- // FIXME!!!
- //tar= get_constraint_target(con, &subtarget);
- tar = NULL;
- subtarget = NULL;
-
- /* only copy depending on target-type */
- if (tar && subtarget[0]) {
- return EXPP_setIValueClamped( value, &con->tarspace,
- CONSTRAINT_SPACE_WORLD, CONSTRAINT_SPACE_PARLOCAL, 'h' );
- }
- else if (tar) {
- return EXPP_setIValueClamped( value, &con->tarspace,
- CONSTRAINT_SPACE_WORLD, CONSTRAINT_SPACE_LOCAL, 'h' );
- }
- }
- break;
- }
- }
-
- /* raise error if failed */
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
-}
-
-/*****************************************************************************/
-/* Specific constraint get/set procedures */
-/*****************************************************************************/
-
-static PyObject *kinematic_getter( BPy_Constraint * self, int type )
-{
- bKinematicConstraint *con = (bKinematicConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_TARGET:
- return Object_CreatePyObject( con->tar );
- case EXPP_CONSTR_BONE:
- return PyString_FromString( con->subtarget );
- case EXPP_CONSTR_STRETCH:
- return PyBool_FromLong( (long)( con->flag & CONSTRAINT_IK_STRETCH ) ) ;
- case EXPP_CONSTR_ITERATIONS:
- return PyInt_FromLong( (long)con->iterations );
- case EXPP_CONSTR_CHAINLEN:
- return PyInt_FromLong( (long)con->rootbone );
- case EXPP_CONSTR_POSWEIGHT:
- return PyFloat_FromDouble( (double)con->weight );
- case EXPP_CONSTR_ROTWEIGHT:
- return PyFloat_FromDouble( (double)con->orientweight );
- case EXPP_CONSTR_ROTATE:
- return PyBool_FromLong( (long)( con->flag & CONSTRAINT_IK_ROT ) ) ;
- case EXPP_CONSTR_USETIP:
- return PyBool_FromLong( (long)( con->flag & CONSTRAINT_IK_TIP ) ) ;
- default:
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
- }
-}
-
-static int kinematic_setter( BPy_Constraint *self, int type, PyObject *value )
-{
- bKinematicConstraint *con = (bKinematicConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_TARGET: {
- Object *obj = (( BPy_Object * )value)->object;
- if( !BPy_Object_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected BPy object argument" );
- con->tar = obj;
- return 0;
- }
- case EXPP_CONSTR_BONE: {
- char *name = PyString_AsString( value );
- if( !name )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected string arg" );
-
- BLI_strncpy( con->subtarget, name, sizeof( con->subtarget ) );
-
- return 0;
- }
- case EXPP_CONSTR_STRETCH:
- return EXPP_setBitfield( value, &con->flag, CONSTRAINT_IK_STRETCH, 'h' );
- case EXPP_CONSTR_ITERATIONS:
- return EXPP_setIValueClamped( value, &con->iterations, 1, 10000, 'h' );
- case EXPP_CONSTR_CHAINLEN:
- return EXPP_setIValueClamped( value, &con->rootbone, 0, 255, 'i' );
- case EXPP_CONSTR_POSWEIGHT:
- return EXPP_setFloatClamped( value, &con->weight, 0.01f, 1.0 );
- case EXPP_CONSTR_ROTWEIGHT:
- return EXPP_setFloatClamped( value, &con->orientweight, 0.01f, 1.0 );
- case EXPP_CONSTR_ROTATE:
- return EXPP_setBitfield( value, &con->flag, CONSTRAINT_IK_ROT, 'h' );
- case EXPP_CONSTR_USETIP:
- return EXPP_setBitfield( value, &con->flag, CONSTRAINT_IK_TIP, 'h' );
- default:
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
- }
-}
-
-static PyObject *action_getter( BPy_Constraint * self, int type )
-{
- bActionConstraint *con = (bActionConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_TARGET:
- return Object_CreatePyObject( con->tar );
- case EXPP_CONSTR_BONE:
- return PyString_FromString( con->subtarget );
- case EXPP_CONSTR_ACTION:
- return Action_CreatePyObject( con->act );
- case EXPP_CONSTR_START:
- return PyInt_FromLong( (long)con->start );
- case EXPP_CONSTR_END:
- return PyInt_FromLong( (long)con->end );
- case EXPP_CONSTR_MIN:
- return PyFloat_FromDouble( (double)con->min );
- case EXPP_CONSTR_MAX:
- return PyFloat_FromDouble( (double)con->max );
- case EXPP_CONSTR_KEYON:
- return PyInt_FromLong( (long)con->type );
- default:
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
- }
-}
-
-static int action_setter( BPy_Constraint *self, int type, PyObject *value )
-{
- bActionConstraint *con = (bActionConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_TARGET: {
- Object *obj = (( BPy_Object * )value)->object;
- if( !BPy_Object_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected BPy object argument" );
- con->tar = obj;
- return 0;
- }
- case EXPP_CONSTR_BONE: {
- char *name = PyString_AsString( value );
- if( !name )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected string arg" );
-
- BLI_strncpy( con->subtarget, name, sizeof( con->subtarget ) );
-
- return 0;
- }
- case EXPP_CONSTR_ACTION: {
- bAction *act = (( BPy_Action * )value)->action;
- if( !BPy_Action_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected BPy action argument" );
- con->act = act;
- return 0;
- }
- case EXPP_CONSTR_START:
- return EXPP_setIValueClamped( value, &con->start, 1, MAXFRAME, 'h' );
- case EXPP_CONSTR_END:
- return EXPP_setIValueClamped( value, &con->end, 1, MAXFRAME, 'h' );
- case EXPP_CONSTR_MIN:
- if (con->type < 10)
- return EXPP_setFloatClamped( value, &con->min, -180.0, 180.0 );
- else if (con->type < 20)
- return EXPP_setFloatClamped( value, &con->min, 0.0001, 1000.0 );
- else
- return EXPP_setFloatClamped( value, &con->min, -1000.0, 1000.0 );
- case EXPP_CONSTR_MAX:
- if (con->type < 10)
- return EXPP_setFloatClamped( value, &con->max, -180.0, 180.0 );
- else if (con->type < 20)
- return EXPP_setFloatClamped( value, &con->max, 0.0001, 1000.0 );
- else
- return EXPP_setFloatClamped( value, &con->max, -1000.0, 1000.0 );
- case EXPP_CONSTR_KEYON:
- return EXPP_setIValueRange( value, &con->type,
- EXPP_CONSTR_XROT, EXPP_CONSTR_ZLOC, 'h' );
- default:
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
- }
-}
-
-static PyObject *trackto_getter( BPy_Constraint * self, int type )
-{
- bTrackToConstraint *con = (bTrackToConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_TARGET:
- return Object_CreatePyObject( con->tar );
- case EXPP_CONSTR_BONE:
- return PyString_FromString( con->subtarget );
- case EXPP_CONSTR_TRACK:
- return PyInt_FromLong( (long)con->reserved1 );
- case EXPP_CONSTR_UP:
- return PyInt_FromLong( (long)con->reserved2 );
- default:
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
- }
-}
-
-static int trackto_setter( BPy_Constraint *self, int type, PyObject *value )
-{
- bTrackToConstraint *con = (bTrackToConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_TARGET: {
- Object *obj = (( BPy_Object * )value)->object;
- if( !BPy_Object_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected BPy object argument" );
- con->tar = obj;
- return 0;
- }
- case EXPP_CONSTR_BONE: {
- char *name = PyString_AsString( value );
- if( !name )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected string arg" );
-
- BLI_strncpy( con->subtarget, name, sizeof( con->subtarget ) );
-
- return 0;
- }
- case EXPP_CONSTR_TRACK:
- return EXPP_setIValueRange( value, &con->reserved1,
- TRACK_X, TRACK_nZ, 'i' );
- case EXPP_CONSTR_UP:
- return EXPP_setIValueRange( value, &con->reserved2,
- UP_X, UP_Z, 'i' );
- default:
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
- }
-}
-
-static PyObject *stretchto_getter( BPy_Constraint * self, int type )
-{
- bStretchToConstraint *con = (bStretchToConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_TARGET:
- return Object_CreatePyObject( con->tar );
- case EXPP_CONSTR_BONE:
- return PyString_FromString( con->subtarget );
- case EXPP_CONSTR_RESTLENGTH:
- return PyFloat_FromDouble( (double)con->orglength );
- case EXPP_CONSTR_VOLVARIATION:
- return PyFloat_FromDouble( (double)con->bulge );
- case EXPP_CONSTR_VOLUMEMODE:
- return PyInt_FromLong( (long)con->volmode );
- case EXPP_CONSTR_PLANE:
- return PyInt_FromLong( (long)con->plane );
- default:
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
- }
-}
-
-static int stretchto_setter( BPy_Constraint *self, int type, PyObject *value )
-{
- bStretchToConstraint *con = (bStretchToConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_TARGET: {
- Object *obj = (( BPy_Object * )value)->object;
- if( !BPy_Object_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected BPy object argument" );
- con->tar = obj;
- return 0;
- }
- case EXPP_CONSTR_BONE: {
- char *name = PyString_AsString( value );
- if( !name )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected string arg" );
-
- BLI_strncpy( con->subtarget, name, sizeof( con->subtarget ) );
-
- return 0;
- }
- case EXPP_CONSTR_RESTLENGTH:
- return EXPP_setFloatClamped( value, &con->orglength, 0.0, 100.0 );
- case EXPP_CONSTR_VOLVARIATION:
- return EXPP_setFloatClamped( value, &con->bulge, 0.0, 100.0 );
- case EXPP_CONSTR_VOLUMEMODE:
- return EXPP_setIValueRange( value, &con->volmode,
- VOLUME_XZ, NO_VOLUME, 'h' );
- case EXPP_CONSTR_PLANE: {
- int status, oldcode = con->plane;
- status = EXPP_setIValueRange( value, &con->plane,
- PLANE_X, PLANE_Z, 'h' );
- if( !status && con->plane == PLANE_Y ) {
- con->plane = oldcode;
- return EXPP_ReturnIntError( PyExc_ValueError,
- "value must be either PLANEX or PLANEZ" );
- }
- return status;
- }
- default:
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
- }
-}
-
-static PyObject *followpath_getter( BPy_Constraint * self, int type )
-{
- bFollowPathConstraint *con = (bFollowPathConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_TARGET:
- return Object_CreatePyObject( con->tar );
- case EXPP_CONSTR_FOLLOW:
- return PyBool_FromLong( (long)( con->followflag & SELECT ) );
- case EXPP_CONSTR_OFFSET:
- return PyFloat_FromDouble( (double)con->offset );
- case EXPP_CONSTR_FORWARD:
- return PyInt_FromLong( (long)con->trackflag );
- case EXPP_CONSTR_UP:
- return PyInt_FromLong( (long)con->upflag );
- default:
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
- }
-}
-
-static int followpath_setter( BPy_Constraint *self, int type, PyObject *value )
-{
- bFollowPathConstraint *con = (bFollowPathConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_TARGET: {
- Object *obj = (( BPy_Object * )value)->object;
- if( !BPy_Object_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected BPy object argument" );
- con->tar = obj;
- return 0;
- }
- case EXPP_CONSTR_FOLLOW:
- return EXPP_setBitfield( value, &con->followflag, SELECT, 'i' );
- case EXPP_CONSTR_OFFSET:
- return EXPP_setFloatClamped( value, &con->offset,
- -MAXFRAMEF, MAXFRAMEF );
- case EXPP_CONSTR_FORWARD:
- return EXPP_setIValueRange( value, &con->trackflag,
- TRACK_X, TRACK_nZ, 'i' );
- case EXPP_CONSTR_UP:
- return EXPP_setIValueRange( value, &con->upflag,
- UP_X, UP_Z, 'i' );
- default:
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
- }
-}
-
-static PyObject *clampto_getter( BPy_Constraint * self, int type )
-{
- bClampToConstraint *con = (bClampToConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_TARGET:
- return Object_CreatePyObject( con->tar );
- case EXPP_CONSTR_CLAMP:
- return PyInt_FromLong( (long)con->flag );
- case EXPP_CONSTR_CLAMPCYCLIC:
- return PyBool_FromLong( (long)(con->flag2 & CLAMPTO_CYCLIC) );
- default:
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
- }
-}
-
-static int clampto_setter( BPy_Constraint *self, int type, PyObject *value )
-{
- bClampToConstraint *con = (bClampToConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_TARGET: {
- Object *obj = (( BPy_Object * )value)->object;
- if( !BPy_Object_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected BPy object argument" );
- con->tar = obj;
- return 0;
- }
- case EXPP_CONSTR_CLAMP:
- return EXPP_setIValueRange( value, &con->flag,
- CLAMPTO_AUTO, CLAMPTO_Z, 'i' );
- case EXPP_CONSTR_CLAMPCYCLIC:
- return EXPP_setBitfield( value, &con->flag2, CLAMPTO_CYCLIC, 'i' );
- default:
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
- }
-}
-static PyObject *locktrack_getter( BPy_Constraint * self, int type )
-{
- bLockTrackConstraint *con = (bLockTrackConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_TARGET:
- return Object_CreatePyObject( con->tar );
- case EXPP_CONSTR_BONE:
- return PyString_FromString( con->subtarget );
- case EXPP_CONSTR_TRACK:
- return PyInt_FromLong( (long)con->trackflag );
- case EXPP_CONSTR_LOCK:
- return PyInt_FromLong( (long)con->lockflag );
- default:
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
- }
-}
-
-static int locktrack_setter( BPy_Constraint *self, int type, PyObject *value )
-{
- bLockTrackConstraint *con = (bLockTrackConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_TARGET: {
- Object *obj = (( BPy_Object * )value)->object;
- if( !BPy_Object_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected BPy object argument" );
- con->tar = obj;
- return 0;
- }
- case EXPP_CONSTR_BONE: {
- char *name = PyString_AsString( value );
- if( !name )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected string arg" );
-
- BLI_strncpy( con->subtarget, name, sizeof( con->subtarget ) );
-
- return 0;
- }
- case EXPP_CONSTR_TRACK:
- return EXPP_setIValueRange( value, &con->trackflag,
- TRACK_X, TRACK_nZ, 'i' );
- case EXPP_CONSTR_LOCK:
- return EXPP_setIValueRange( value, &con->lockflag,
- LOCK_X, LOCK_Z, 'i' );
- default:
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
- }
-}
-
-static PyObject *floor_getter( BPy_Constraint * self, int type )
-{
- bMinMaxConstraint *con = (bMinMaxConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_TARGET:
- return Object_CreatePyObject( con->tar );
- case EXPP_CONSTR_BONE:
- return PyString_FromString( con->subtarget );
- case EXPP_CONSTR_MINMAX:
- return PyInt_FromLong( (long)con->minmaxflag );
- case EXPP_CONSTR_OFFSET:
- return PyFloat_FromDouble( (double)con->offset );
- case EXPP_CONSTR_STICKY:
- return PyBool_FromLong( (long)( con->flag & MINMAX_STICKY ) ) ;
- default:
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
- }
-}
-
-static int floor_setter( BPy_Constraint *self, int type, PyObject *value )
-{
- bMinMaxConstraint *con = (bMinMaxConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_TARGET: {
- Object *obj = (( BPy_Object * )value)->object;
- if( !BPy_Object_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected BPy object argument" );
- con->tar = obj;
- return 0;
- }
- case EXPP_CONSTR_BONE: {
- char *name = PyString_AsString( value );
- if( !name )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected string arg" );
-
- BLI_strncpy( con->subtarget, name, sizeof( con->subtarget ) );
-
- return 0;
- }
- case EXPP_CONSTR_MINMAX:
- return EXPP_setIValueRange( value, &con->minmaxflag,
- EXPP_CONSTR_MAXX, EXPP_CONSTR_MINZ, 'i' );
- case EXPP_CONSTR_OFFSET:
- return EXPP_setFloatClamped( value, &con->offset, -100.0, 100.0 );
- case EXPP_CONSTR_STICKY:
- return EXPP_setBitfield( value, &con->flag, MINMAX_STICKY, 'h' );
- default:
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
- }
-}
-
-static PyObject *locatelike_getter( BPy_Constraint * self, int type )
-{
- bLocateLikeConstraint *con = (bLocateLikeConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_TARGET:
- return Object_CreatePyObject( con->tar );
- case EXPP_CONSTR_BONE:
- return PyString_FromString( con->subtarget );
- case EXPP_CONSTR_COPY:
- return PyInt_FromLong( (long)con->flag );
- default:
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
- }
-}
-
-static int locatelike_setter( BPy_Constraint *self, int type, PyObject *value )
-{
- bLocateLikeConstraint *con = (bLocateLikeConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_TARGET: {
- Object *obj = (( BPy_Object * )value)->object;
- if( !BPy_Object_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected BPy object argument" );
- con->tar = obj;
- return 0;
- }
- case EXPP_CONSTR_BONE: {
- char *name = PyString_AsString( value );
- if( !name )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected string arg" );
-
- BLI_strncpy( con->subtarget, name, sizeof( con->subtarget ) );
-
- return 0;
- }
- case EXPP_CONSTR_COPY:
- return EXPP_setIValueRange( value, &con->flag,
- 0, LOCLIKE_X | LOCLIKE_Y | LOCLIKE_Z | LOCLIKE_X_INVERT | LOCLIKE_Y_INVERT | LOCLIKE_Z_INVERT, 'i' );
- default:
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
- }
-}
-
-static PyObject *rotatelike_getter( BPy_Constraint * self, int type )
-{
- bRotateLikeConstraint *con = (bRotateLikeConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_TARGET:
- return Object_CreatePyObject( con->tar );
- case EXPP_CONSTR_BONE:
- return PyString_FromString( con->subtarget );
- case EXPP_CONSTR_COPY:
- return PyInt_FromLong( (long)con->flag );
- default:
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
- }
-}
-
-static int rotatelike_setter( BPy_Constraint *self, int type, PyObject *value )
-{
- bRotateLikeConstraint *con = (bRotateLikeConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_TARGET: {
- Object *obj = (( BPy_Object * )value)->object;
- if( !BPy_Object_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected BPy object argument" );
- con->tar = obj;
- return 0;
- }
- case EXPP_CONSTR_BONE: {
- char *name = PyString_AsString( value );
- if( !name )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected string arg" );
-
- BLI_strncpy( con->subtarget, name, sizeof( con->subtarget ) );
-
- return 0;
- }
- case EXPP_CONSTR_COPY:
- return EXPP_setIValueRange( value, &con->flag,
- 0, ROTLIKE_X | ROTLIKE_Y | ROTLIKE_Z | ROTLIKE_X_INVERT | ROTLIKE_Y_INVERT | ROTLIKE_Z_INVERT, 'i' );
- default:
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
- }
-}
-
-static PyObject *sizelike_getter( BPy_Constraint * self, int type )
-{
- bSizeLikeConstraint *con = (bSizeLikeConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_TARGET:
- return Object_CreatePyObject( con->tar );
- case EXPP_CONSTR_BONE:
- return PyString_FromString( con->subtarget );
- case EXPP_CONSTR_COPY:
- return PyInt_FromLong( (long)con->flag );
- default:
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
- }
-}
-
-static int sizelike_setter( BPy_Constraint *self, int type, PyObject *value )
-{
- bSizeLikeConstraint *con = (bSizeLikeConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_TARGET: {
- Object *obj = (( BPy_Object * )value)->object;
- if( !BPy_Object_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected BPy object argument" );
- con->tar = obj;
- return 0;
- }
- case EXPP_CONSTR_BONE: {
- char *name = PyString_AsString( value );
- if( !name )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected string arg" );
-
- BLI_strncpy( con->subtarget, name, sizeof( con->subtarget ) );
-
- return 0;
- }
- case EXPP_CONSTR_COPY:
- return EXPP_setIValueRange( value, &con->flag,
- 0, SIZELIKE_X | SIZELIKE_Y | SIZELIKE_Z, 'i' );
- default:
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
- }
-}
-
-static PyObject *loclimit_getter( BPy_Constraint * self, int type)
-{
- bLocLimitConstraint *con = (bLocLimitConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_LIMIT:
- return PyInt_FromLong( (long)con->flag );
- case EXPP_CONSTR_XMIN:
- return PyFloat_FromDouble( (double)con->xmin );
- case EXPP_CONSTR_XMAX:
- return PyFloat_FromDouble( (double)con->xmax );
- case EXPP_CONSTR_YMIN:
- return PyFloat_FromDouble( (double)con->ymin );
- case EXPP_CONSTR_YMAX:
- return PyFloat_FromDouble( (double)con->ymax );
- case EXPP_CONSTR_ZMIN:
- return PyFloat_FromDouble( (double)con->zmin );
- case EXPP_CONSTR_ZMAX:
- return PyFloat_FromDouble( (double)con->zmax );
- default:
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
- }
-}
-
-static int loclimit_setter( BPy_Constraint *self, int type, PyObject *value )
-{
- bLocLimitConstraint *con = (bLocLimitConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_LIMIT:
- return EXPP_setIValueRange( value, &con->flag, 0,
- LIMIT_XMIN | LIMIT_XMAX | LIMIT_YMIN | LIMIT_YMAX | LIMIT_ZMIN | LIMIT_ZMAX , 'i' );
- case EXPP_CONSTR_XMIN:
- return EXPP_setFloatClamped( value, &con->xmin, -1000.0, 1000.0 );
- case EXPP_CONSTR_XMAX:
- return EXPP_setFloatClamped( value, &con->xmax, -1000.0, 1000.0 );
- case EXPP_CONSTR_YMIN:
- return EXPP_setFloatClamped( value, &con->ymin, -1000.0, 1000.0 );
- case EXPP_CONSTR_YMAX:
- return EXPP_setFloatClamped( value, &con->ymax, -1000.0, 1000.0 );
- case EXPP_CONSTR_ZMIN:
- return EXPP_setFloatClamped( value, &con->zmin, -1000.0, 1000.0 );
- case EXPP_CONSTR_ZMAX:
- return EXPP_setFloatClamped( value, &con->zmax, -1000.0, 1000.0 );
- default:
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
- }
-}
-
-static PyObject *rotlimit_getter( BPy_Constraint * self, int type )
-{
- bRotLimitConstraint *con = (bRotLimitConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_LIMIT:
- return PyInt_FromLong( (long)con->flag );
- case EXPP_CONSTR_XMIN:
- return PyFloat_FromDouble( (double)con->xmin );
- case EXPP_CONSTR_XMAX:
- return PyFloat_FromDouble( (double)con->xmax );
- case EXPP_CONSTR_YMIN:
- return PyFloat_FromDouble( (double)con->ymin );
- case EXPP_CONSTR_YMAX:
- return PyFloat_FromDouble( (double)con->ymax );
- case EXPP_CONSTR_ZMIN:
- return PyFloat_FromDouble( (double)con->zmin );
- case EXPP_CONSTR_ZMAX:
- return PyFloat_FromDouble( (double)con->zmax );
- default:
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
- }
-}
-
-static int rotlimit_setter( BPy_Constraint *self, int type, PyObject *value )
-{
- bRotLimitConstraint *con = (bRotLimitConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_LIMIT:
- return EXPP_setIValueRange( value, &con->flag, 0,
- LIMIT_XROT | LIMIT_YROT | LIMIT_ZROT, 'i' );
- case EXPP_CONSTR_XMIN:
- return EXPP_setFloatClamped( value, &con->xmin, -360.0, 360.0 );
- case EXPP_CONSTR_XMAX:
- return EXPP_setFloatClamped( value, &con->xmax, -360.0, 360.0 );
- case EXPP_CONSTR_YMIN:
- return EXPP_setFloatClamped( value, &con->ymin, -360.0, 360.0 );
- case EXPP_CONSTR_YMAX:
- return EXPP_setFloatClamped( value, &con->ymax, -360.0, 360.0 );
- case EXPP_CONSTR_ZMIN:
- return EXPP_setFloatClamped( value, &con->zmin, -360.0, 360.0 );
- case EXPP_CONSTR_ZMAX:
- return EXPP_setFloatClamped( value, &con->zmax, -360.0, 360.0 );
- default:
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
- }
-}
-
-static PyObject *sizelimit_getter( BPy_Constraint * self, int type)
-{
- bSizeLimitConstraint *con = (bSizeLimitConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_LIMIT:
- return PyInt_FromLong( (long)con->flag );
- case EXPP_CONSTR_XMIN:
- return PyFloat_FromDouble( (double)con->xmin );
- case EXPP_CONSTR_XMAX:
- return PyFloat_FromDouble( (double)con->xmax );
- case EXPP_CONSTR_YMIN:
- return PyFloat_FromDouble( (double)con->ymin );
- case EXPP_CONSTR_YMAX:
- return PyFloat_FromDouble( (double)con->ymax );
- case EXPP_CONSTR_ZMIN:
- return PyFloat_FromDouble( (double)con->zmin );
- case EXPP_CONSTR_ZMAX:
- return PyFloat_FromDouble( (double)con->zmax );
- default:
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
- }
-}
-
-static int sizelimit_setter( BPy_Constraint *self, int type, PyObject *value )
-{
- bSizeLimitConstraint *con = (bSizeLimitConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_LIMIT:
- return EXPP_setIValueRange( value, &con->flag, 0,
- LIMIT_XMIN | LIMIT_XMAX | LIMIT_YMIN | LIMIT_YMAX | LIMIT_ZMIN | LIMIT_ZMAX, 'i' );
- case EXPP_CONSTR_XMIN:
- return EXPP_setFloatClamped( value, &con->xmin, -1000.0, 1000.0 );
- case EXPP_CONSTR_XMAX:
- return EXPP_setFloatClamped( value, &con->xmax, -1000.0, 1000.0 );
- case EXPP_CONSTR_YMIN:
- return EXPP_setFloatClamped( value, &con->ymin, -1000.0, 1000.0 );
- case EXPP_CONSTR_YMAX:
- return EXPP_setFloatClamped( value, &con->ymax, -1000.0, 1000.0 );
- case EXPP_CONSTR_ZMIN:
- return EXPP_setFloatClamped( value, &con->zmin, -1000.0, 1000.0 );
- case EXPP_CONSTR_ZMAX:
- return EXPP_setFloatClamped( value, &con->zmax, -1000.0, 1000.0 );
- default:
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
- }
-}
-
-static PyObject *script_getter( BPy_Constraint * self, int type )
-{
- bPythonConstraint *con = (bPythonConstraint *)(self->con->data);
-
- switch( type ) {
- // FIXME!!!
- //case EXPP_CONSTR_TARGET:
- // return Object_CreatePyObject( con->tar );
- //case EXPP_CONSTR_BONE:
- // return PyString_FromString( con->subtarget );
- case EXPP_CONSTR_SCRIPT:
- return Text_CreatePyObject( con->text );
- case EXPP_CONSTR_PROPS:
- return BPy_Wrap_IDProperty( NULL, con->prop, NULL);
- default:
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
- }
-}
-
-static int script_setter( BPy_Constraint *self, int type, PyObject *value )
-{
- bPythonConstraint *con = (bPythonConstraint *)(self->con->data);
-
- switch( type ) {
- // FIXME!!!
- //case EXPP_CONSTR_TARGET: {
- // Object *obj = (( BPy_Object * )value)->object;
- // if( !BPy_Object_Check( value ) )
- // return EXPP_ReturnIntError( PyExc_TypeError,
- // "expected BPy object argument" );
- // con->tar = obj;
- // return 0;
- // }
- //case EXPP_CONSTR_BONE: {
- // char *name = PyString_AsString( value );
- // if( !name )
- // return EXPP_ReturnIntError( PyExc_TypeError,
- // "expected string arg" );
- //
- // BLI_strncpy( con->subtarget, name, sizeof( con->subtarget ) );
- //
- // return 0;
- // }
- case EXPP_CONSTR_SCRIPT: {
- Text *text = (( BPy_Text * )value)->text;
- if( !BPy_Object_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected BPy text argument" );
- con->text = text;
- return 0;
- }
- case EXPP_CONSTR_PROPS:
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "setting ID-Properties of PyConstraints this way is not supported" );
- default:
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
- }
-}
-
-
-static PyObject *rigidbody_getter( BPy_Constraint * self, int type)
-{
- bRigidBodyJointConstraint *con = (bRigidBodyJointConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_TARGET:
- return Object_CreatePyObject( con->tar );
- case EXPP_CONSTR_RB_PIVX:
- return PyFloat_FromDouble( (double)con->pivX );
- case EXPP_CONSTR_RB_PIVY:
- return PyFloat_FromDouble( (double)con->pivY );
- case EXPP_CONSTR_RB_PIVZ:
- return PyFloat_FromDouble( (double)con->pivZ );
- case EXPP_CONSTR_RB_AXX:
- return PyFloat_FromDouble( (double)con->axX );
- case EXPP_CONSTR_RB_AXY:
- return PyFloat_FromDouble( (double)con->axY );
- case EXPP_CONSTR_RB_AXZ:
- return PyFloat_FromDouble( (double)con->axZ );
- case EXPP_CONSTR_RB_MINLIMIT0:
- return PyFloat_FromDouble( (double)con->minLimit[0] );
- case EXPP_CONSTR_RB_MINLIMIT1:
- return PyFloat_FromDouble( (double)con->minLimit[1] );
- case EXPP_CONSTR_RB_MINLIMIT2:
- return PyFloat_FromDouble( (double)con->minLimit[2] );
- case EXPP_CONSTR_RB_MINLIMIT3:
- return PyFloat_FromDouble( (double)con->minLimit[3] );
- case EXPP_CONSTR_RB_MINLIMIT4:
- return PyFloat_FromDouble( (double)con->minLimit[4] );
- case EXPP_CONSTR_RB_MINLIMIT5:
- return PyFloat_FromDouble( (double)con->minLimit[5] );
- case EXPP_CONSTR_RB_MAXLIMIT0:
- return PyFloat_FromDouble( (double)con->maxLimit[0] );
- case EXPP_CONSTR_RB_MAXLIMIT1:
- return PyFloat_FromDouble( (double)con->maxLimit[1] );
- case EXPP_CONSTR_RB_MAXLIMIT2:
- return PyFloat_FromDouble( (double)con->maxLimit[2] );
- case EXPP_CONSTR_RB_MAXLIMIT3:
- return PyFloat_FromDouble( (double)con->maxLimit[3] );
- case EXPP_CONSTR_RB_MAXLIMIT4:
- return PyFloat_FromDouble( (double)con->maxLimit[4] );
- case EXPP_CONSTR_RB_MAXLIMIT5:
- return PyFloat_FromDouble( (double)con->maxLimit[5] );
- case EXPP_CONSTR_RB_EXTRAFZ:
- return PyFloat_FromDouble( (double)con->extraFz );
- case EXPP_CONSTR_LIMIT:
- return PyInt_FromLong( (int)con->flag );
-
- case EXPP_CONSTR_RB_TYPE:
- return PyInt_FromLong( (int)con->type );
- default:
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
- }
-}
-
-
-static int rigidbody_setter( BPy_Constraint *self, int type, PyObject *value )
-{
- bRigidBodyJointConstraint *con = (bRigidBodyJointConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_TARGET: {
- Object *obj = (( BPy_Object * )value)->object;
- if( !BPy_Object_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected BPy object argument" );
- con->tar = obj;
- return 0;
- }
- case EXPP_CONSTR_RB_PIVX:
- return EXPP_setFloatClamped( value, &con->pivX , -1000.0, 1000.0 );
- case EXPP_CONSTR_RB_PIVY:
- return EXPP_setFloatClamped( value, &con->pivY , -1000.0, 1000.0 );
- case EXPP_CONSTR_RB_PIVZ:
- return EXPP_setFloatClamped( value, &con->pivZ , -1000.0, 1000.0 );
- case EXPP_CONSTR_RB_AXX:
- return EXPP_setFloatClamped( value, &con->axX , -1000.0, 1000.0 );
- case EXPP_CONSTR_RB_AXY:
- return EXPP_setFloatClamped( value, &con->axY , -1000.0, 1000.0 );
- case EXPP_CONSTR_RB_AXZ:
- return EXPP_setFloatClamped( value, &con->axZ , -1000.0, 1000.0 );
- case EXPP_CONSTR_RB_MINLIMIT0:
- return EXPP_setFloatClamped( value, &con->minLimit[0] , -1000.0, 1000.0 );
- case EXPP_CONSTR_RB_MINLIMIT1:
- return EXPP_setFloatClamped( value, &con->minLimit[1] , -1000.0, 1000.0 );
- case EXPP_CONSTR_RB_MINLIMIT2:
- return EXPP_setFloatClamped( value, &con->minLimit[2] , -1000.0, 1000.0 );
- case EXPP_CONSTR_RB_MINLIMIT3:
- return EXPP_setFloatClamped( value, &con->minLimit[3] , -1000.0, 1000.0 );
- case EXPP_CONSTR_RB_MINLIMIT4:
- return EXPP_setFloatClamped( value, &con->minLimit[4] , -1000.0, 1000.0 );
- case EXPP_CONSTR_RB_MINLIMIT5:
- return EXPP_setFloatClamped( value, &con->minLimit[5] , -1000.0, 1000.0 );
- case EXPP_CONSTR_RB_MAXLIMIT0:
- return EXPP_setFloatClamped( value, &con->maxLimit[0] , -1000.0, 1000.0 );
- case EXPP_CONSTR_RB_MAXLIMIT1:
- return EXPP_setFloatClamped( value, &con->maxLimit[1] , -1000.0, 1000.0 );
- case EXPP_CONSTR_RB_MAXLIMIT2:
- return EXPP_setFloatClamped( value, &con->maxLimit[2] , -1000.0, 1000.0 );
- case EXPP_CONSTR_RB_MAXLIMIT3:
- return EXPP_setFloatClamped( value, &con->maxLimit[3] , -1000.0, 1000.0 );
- case EXPP_CONSTR_RB_MAXLIMIT4:
- return EXPP_setFloatClamped( value, &con->maxLimit[4] , -1000.0, 1000.0 );
- case EXPP_CONSTR_RB_MAXLIMIT5:
- return EXPP_setFloatClamped( value, &con->maxLimit[5] , -1000.0, 1000.0 );
- case EXPP_CONSTR_RB_EXTRAFZ:
- return EXPP_setFloatClamped( value, &con->extraFz , -1000.0, 1000.0 );
- case EXPP_CONSTR_LIMIT:
- return EXPP_setIValueRange( value, &con->flag, 0,
- LIMIT_XMIN | LIMIT_XMAX | LIMIT_YMIN | LIMIT_YMAX | LIMIT_ZMIN | LIMIT_ZMAX, 'i' );
- case EXPP_CONSTR_RB_TYPE:
- return EXPP_setIValueRange( value, &con->type, 0,
- EXPP_CONSTR_RB_BALL | EXPP_CONSTR_RB_HINGE | EXPP_CONSTR_RB_GENERIC6DOF | EXPP_CONSTR_RB_VEHICLE, 'i' );
- default:
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
- }
-}
-
-static PyObject *childof_getter( BPy_Constraint * self, int type )
-{
- bChildOfConstraint *con = (bChildOfConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_TARGET:
- return Object_CreatePyObject( con->tar );
- case EXPP_CONSTR_BONE:
- return PyString_FromString( con->subtarget );
- case EXPP_CONSTR_COPY:
- return PyInt_FromLong( (long)con->flag );
- default:
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
- }
-}
-
-static int childof_setter( BPy_Constraint *self, int type, PyObject *value )
-{
- bChildOfConstraint *con = (bChildOfConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_TARGET: {
- Object *obj = (( BPy_Object * )value)->object;
- if( !BPy_Object_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected BPy object argument" );
- con->tar = obj;
- return 0;
- }
- case EXPP_CONSTR_BONE: {
- char *name = PyString_AsString( value );
- if( !name )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected string arg" );
-
- BLI_strncpy( con->subtarget, name, sizeof( con->subtarget ) );
-
- return 0;
- }
- case EXPP_CONSTR_COPY:
- return EXPP_setIValueRange( value, &con->flag,
- 0, CHILDOF_LOCX| CHILDOF_LOCY | CHILDOF_LOCZ | CHILDOF_ROTX | CHILDOF_ROTY | CHILDOF_ROTZ |
- CHILDOF_SIZEX |CHILDOF_SIZEY| CHILDOF_SIZEZ, 'i' );
- default:
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
- }
-}
-
-static PyObject *transf_getter( BPy_Constraint * self, int type )
-{
- bTransformConstraint *con = (bTransformConstraint *)(self->con->data);
-
- switch( type ) {
- case EXPP_CONSTR_TARGET:
- return Object_CreatePyObject( con->tar );
- case EXPP_CONSTR_BONE:
- return PyString_FromString( con->subtarget );
- case EXPP_CONSTR_FROM:
- return PyInt_FromLong( (long)con->from );
- case EXPP_CONSTR_TO:
- return PyInt_FromLong( (long)con->to );
- case EXPP_CONSTR_MAPX:
- return PyInt_FromLong( (long)con->map[0] );
- case EXPP_CONSTR_MAPY:
- return PyInt_FromLong( (long)con->map[1] );
- case EXPP_CONSTR_MAPZ:
- return PyInt_FromLong( (long)con->map[2] );
- case EXPP_CONSTR_FROMMINX:
- return PyFloat_FromDouble( (double)con->from_min[0] );
- case EXPP_CONSTR_FROMMAXX:
- return PyFloat_FromDouble( (double)con->from_max[0] );
- case EXPP_CONSTR_FROMMINY:
- return PyFloat_FromDouble( (double)con->from_min[1] );
- case EXPP_CONSTR_FROMMAXY:
- return PyFloat_FromDouble( (double)con->from_max[1] );
- case EXPP_CONSTR_FROMMINZ:
- return PyFloat_FromDouble( (double)con->from_min[2] );
- case EXPP_CONSTR_FROMMAXZ:
- return PyFloat_FromDouble( (double)con->from_max[2] );
- case EXPP_CONSTR_TOMINX:
- return PyFloat_FromDouble( (double)con->to_min[0] );
- case EXPP_CONSTR_TOMAXX:
- return PyFloat_FromDouble( (double)con->to_max[0] );
- case EXPP_CONSTR_TOMINY:
- return PyFloat_FromDouble( (double)con->to_min[1] );
- case EXPP_CONSTR_TOMAXY:
- return PyFloat_FromDouble( (double)con->to_max[1] );
- case EXPP_CONSTR_TOMINZ:
- return PyFloat_FromDouble( (double)con->to_min[2] );
- case EXPP_CONSTR_TOMAXZ:
- return PyFloat_FromDouble( (double)con->to_max[2] );
- case EXPP_CONSTR_EXPO:
- return PyBool_FromLong( (long)con->expo );
- default:
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
- }
-}
-
-static int transf_setter( BPy_Constraint *self, int type, PyObject *value )
-{
- bTransformConstraint *con = (bTransformConstraint *)(self->con->data);
- float fmin, fmax, tmin, tmax;
-
- if (con->from == 2) {
- fmin = 0.0001;
- fmax = 1000.0;
- }
- else if (con->from == 1) {
- fmin = -360.0;
- fmax = 360.0;
- }
- else {
- fmin = -1000.0;
- fmax = 1000.0;
- }
-
- if (con->to == 2) {
- tmin = 0.0001;
- tmax = 1000.0;
- }
- else if (con->to == 1) {
- tmin = -360.0;
- tmax = 360.0;
- }
- else {
- tmin = -1000.0;
- tmax = 1000.0;
- }
-
- switch( type ) {
- case EXPP_CONSTR_TARGET: {
- Object *obj = (( BPy_Object * )value)->object;
- if( !BPy_Object_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected BPy object argument" );
- con->tar = obj;
- return 0;
- }
- case EXPP_CONSTR_BONE: {
- char *name = PyString_AsString( value );
- if( !name )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected string arg" );
-
- BLI_strncpy( con->subtarget, name, sizeof( con->subtarget ) );
-
- return 0;
- }
- case EXPP_CONSTR_FROM:
- return EXPP_setIValueClamped( value, &con->from, 0, 3, 'h' );
- case EXPP_CONSTR_TO:
- return EXPP_setIValueClamped( value, &con->to, 0, 3, 'h' );
- case EXPP_CONSTR_MAPX:
- return EXPP_setIValueClamped( value, &con->map[0], 0, 3, 'h' );
- case EXPP_CONSTR_MAPY:
- return EXPP_setIValueClamped( value, &con->map[1], 0, 3, 'h' );
- case EXPP_CONSTR_MAPZ:
- return EXPP_setIValueClamped( value, &con->map[2], 0, 3, 'h' );
- case EXPP_CONSTR_FROMMINX:
- return EXPP_setFloatClamped( value, &con->from_min[0], fmin, fmax );
- case EXPP_CONSTR_FROMMAXX:
- return EXPP_setFloatClamped( value, &con->from_max[0], fmin, fmax );
- case EXPP_CONSTR_FROMMINY:
- return EXPP_setFloatClamped( value, &con->from_min[1], fmin, fmax );
- case EXPP_CONSTR_FROMMAXY:
- return EXPP_setFloatClamped( value, &con->from_max[1], fmin, fmax );
- case EXPP_CONSTR_FROMMINZ:
- return EXPP_setFloatClamped( value, &con->from_min[2], fmin, fmax );
- case EXPP_CONSTR_FROMMAXZ:
- return EXPP_setFloatClamped( value, &con->from_max[2], fmin, fmax );
- case EXPP_CONSTR_TOMINX:
- return EXPP_setFloatClamped( value, &con->to_min[0], tmin, tmax );
- case EXPP_CONSTR_TOMAXX:
- return EXPP_setFloatClamped( value, &con->to_max[0], tmin, tmax );
- case EXPP_CONSTR_TOMINY:
- return EXPP_setFloatClamped( value, &con->to_min[1], tmin, tmax );
- case EXPP_CONSTR_TOMAXY:
- return EXPP_setFloatClamped( value, &con->to_max[1], tmin, tmax );
- case EXPP_CONSTR_TOMINZ:
- return EXPP_setFloatClamped( value, &con->to_min[2], tmin, tmax );
- case EXPP_CONSTR_TOMAXZ:
- return EXPP_setFloatClamped( value, &con->to_max[2], tmin, tmax );
- case EXPP_CONSTR_EXPO:
- return EXPP_setBitfield( value, &con->expo, 1, 'h' );
- default:
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
- }
-}
-
-/*
- * get data from a constraint
- */
-
-static PyObject *Constraint_getData( BPy_Constraint * self, PyObject * key )
-{
- int setting;
-
- if( !PyInt_Check( key ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected an int arg" );
-
- if( !self->con )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This constraint has been removed!" );
-
- setting = PyInt_AsLong( key );
-
- /* bypass doing settings of individual constraints, if we're just doing
- * constraint space access-stuff
- */
- if ((setting==EXPP_CONSTR_OWNSPACE) || (setting==EXPP_CONSTR_TARSPACE)) {
- return constspace_getter( self, setting );
- }
- switch( self->con->type ) {
- case CONSTRAINT_TYPE_NULL:
- Py_RETURN_NONE;
- case CONSTRAINT_TYPE_TRACKTO:
- return trackto_getter( self, setting );
- case CONSTRAINT_TYPE_KINEMATIC:
- return kinematic_getter( self, setting );
- case CONSTRAINT_TYPE_FOLLOWPATH:
- return followpath_getter( self, setting );
- case CONSTRAINT_TYPE_ACTION:
- return action_getter( self, setting );
- case CONSTRAINT_TYPE_LOCKTRACK:
- return locktrack_getter( self, setting );
- case CONSTRAINT_TYPE_STRETCHTO:
- return stretchto_getter( self, setting );
- case CONSTRAINT_TYPE_MINMAX:
- return floor_getter( self, setting );
- case CONSTRAINT_TYPE_LOCLIKE:
- return locatelike_getter( self, setting );
- case CONSTRAINT_TYPE_ROTLIKE:
- return rotatelike_getter( self, setting );
- case CONSTRAINT_TYPE_SIZELIKE:
- return sizelike_getter( self, setting );
- case CONSTRAINT_TYPE_ROTLIMIT:
- return rotlimit_getter( self, setting );
- case CONSTRAINT_TYPE_LOCLIMIT:
- return loclimit_getter( self, setting );
- case CONSTRAINT_TYPE_SIZELIMIT:
- return sizelimit_getter( self, setting );
- case CONSTRAINT_TYPE_RIGIDBODYJOINT:
- return rigidbody_getter( self, setting );
- case CONSTRAINT_TYPE_CLAMPTO:
- return clampto_getter( self, setting );
- case CONSTRAINT_TYPE_PYTHON:
- return script_getter( self, setting );
- case CONSTRAINT_TYPE_CHILDOF:
- return childof_getter( self, setting );
- case CONSTRAINT_TYPE_TRANSFORM:
- return transf_getter( self, setting );
- default:
- return EXPP_ReturnPyObjError( PyExc_KeyError,
- "unknown constraint type" );
- }
-}
-
-static int Constraint_setData( BPy_Constraint * self, PyObject * key,
- PyObject * arg )
-{
- int key_int, result;
-
- if( !PyNumber_Check( key ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected an int arg" );
- if( !self->con )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "This constraint has been removed!" );
-
- key_int = PyInt_AsLong( key );
-
- /* bypass doing settings of individual constraints, if we're just doing
- * constraint space access-stuff
- */
- if ((key_int==EXPP_CONSTR_OWNSPACE) || (key_int==EXPP_CONSTR_TARSPACE)) {
- result = constspace_setter( self, key_int, arg );
- }
- else {
- switch( self->con->type ) {
- case CONSTRAINT_TYPE_KINEMATIC:
- result = kinematic_setter( self, key_int, arg );
- break;
- case CONSTRAINT_TYPE_ACTION:
- result = action_setter( self, key_int, arg );
- break;
- case CONSTRAINT_TYPE_TRACKTO:
- result = trackto_setter( self, key_int, arg );
- break;
- case CONSTRAINT_TYPE_STRETCHTO:
- result = stretchto_setter( self, key_int, arg );
- break;
- case CONSTRAINT_TYPE_FOLLOWPATH:
- result = followpath_setter( self, key_int, arg );
- break;
- case CONSTRAINT_TYPE_LOCKTRACK:
- result = locktrack_setter( self, key_int, arg );
- break;
- case CONSTRAINT_TYPE_MINMAX:
- result = floor_setter( self, key_int, arg );
- break;
- case CONSTRAINT_TYPE_LOCLIKE:
- result = locatelike_setter( self, key_int, arg );
- break;
- case CONSTRAINT_TYPE_ROTLIKE:
- result = rotatelike_setter( self, key_int, arg );
- break;
- case CONSTRAINT_TYPE_SIZELIKE:
- result = sizelike_setter( self, key_int, arg );
- break;
- case CONSTRAINT_TYPE_ROTLIMIT:
- result = rotlimit_setter( self, key_int, arg );
- break;
- case CONSTRAINT_TYPE_LOCLIMIT:
- result = loclimit_setter( self, key_int, arg );
- break;
- case CONSTRAINT_TYPE_SIZELIMIT:
- result = sizelimit_setter( self, key_int, arg);
- break;
- case CONSTRAINT_TYPE_RIGIDBODYJOINT:
- result = rigidbody_setter( self, key_int, arg);
- break;
- case CONSTRAINT_TYPE_CLAMPTO:
- result = clampto_setter( self, key_int, arg);
- break;
- case CONSTRAINT_TYPE_PYTHON:
- result = script_setter( self, key_int, arg);
- break;
- case CONSTRAINT_TYPE_CHILDOF:
- result = childof_setter( self, key_int, arg);
- break;
- case CONSTRAINT_TYPE_TRANSFORM:
- result = transf_setter( self, key_int, arg);
- break;
- case CONSTRAINT_TYPE_NULL:
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
- default:
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "unsupported constraint setting" );
- }
- }
- if( !result && self->pchan )
- update_pose_constraint_flags( self->obj->pose );
- return result;
-}
-
-/*****************************************************************************/
-/* Function: Constraint_compare */
-/* Description: This compares 2 constraint python types, == or != only. */
-/*****************************************************************************/
-static int Constraint_compare( BPy_Constraint * a, BPy_Constraint * b )
-{
- return ( a->con == b->con ) ? 0 : -1;
-}
-
-/*****************************************************************************/
-/* Function: Constraint_repr */
-/* Description: This is a callback function for the BPy_Constraint type. It */
-/* builds a meaningful string to represent constraint objects. */
-/*****************************************************************************/
-
-static PyObject *Constraint_repr( BPy_Constraint * self )
-{
- bConstraintTypeInfo *cti;
-
- if (!self->con)
- return PyString_FromString("[Constraint - Removed]");
- else
- cti= constraint_get_typeinfo(self->con);
-
- if (cti) {
- return PyString_FromFormat("[Constraint \"%s\", Type \"%s\"]",
- self->con->name, cti->name);
- }
- else {
- return PyString_FromString("[Constraint \"%s\", Type \"Unknown\"]");
- }
-}
-
-/* Three Python Constraint_Type helper functions needed by the Object module: */
-
-/*****************************************************************************/
-/* Function: Constraint_CreatePyObject */
-/* Description: This function will create a new BPy_Constraint from an */
-/* existing Blender constraint structure. */
-/*****************************************************************************/
-PyObject *Constraint_CreatePyObject( bPoseChannel *pchan, Object *obj,
- bConstraint *con )
-{
- BPy_Constraint *pycon;
- pycon = ( BPy_Constraint * ) PyObject_NEW( BPy_Constraint,
- &Constraint_Type );
- if( !pycon )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create BPy_Constraint object" );
-
- pycon->con = con;
-
- /* one of these two will be NULL */
- pycon->obj = obj;
- pycon->pchan = pchan;
- return ( PyObject * ) pycon;
-}
-
-/*****************************************************************************/
-/* Function: Constraint_FromPyObject */
-/* Description: This function returns the Blender constraint from the given */
-/* PyObject. */
-/*****************************************************************************/
-bConstraint *Constraint_FromPyObject( BPy_Constraint * self )
-{
- return self->con;
-}
-
-/*****************************************************************************/
-/* Constraint Sequence wrapper */
-/*****************************************************************************/
-
-/*
- * Initialize the interator
- */
-
-static PyObject *ConstraintSeq_getIter( BPy_ConstraintSeq * self )
-{
- if( self->pchan )
- self->iter = (bConstraint *)self->pchan->constraints.first;
- else
- self->iter = (bConstraint *)self->obj->constraints.first;
- return EXPP_incr_ret ( (PyObject *) self );
-}
-
-/*
- * Get the next Constraint
- */
-
-static PyObject *ConstraintSeq_nextIter( BPy_ConstraintSeq * self )
-{
- bConstraint *this = self->iter;
- if( this ) {
- self->iter = this->next;
- return Constraint_CreatePyObject( self->pchan, self->obj, this );
- }
-
- return EXPP_ReturnPyObjError( PyExc_StopIteration,
- "iterator at end" );
-}
-
-/* return the number of constraints */
-
-static int ConstraintSeq_length( BPy_ConstraintSeq * self )
-{
- return BLI_countlist( self->pchan ?
- &self->pchan->constraints : &self->obj->constraints );
-}
-
-/* return a constraint */
-
-static PyObject *ConstraintSeq_item( BPy_ConstraintSeq * self, int i )
-{
- bConstraint *con = NULL;
-
- /* if index is negative, start counting from the end of the list */
- if( i < 0 )
- i += ConstraintSeq_length( self );
-
- /* skip through the list until we get the constraint or end of list */
-
- if( self->pchan )
- con = self->pchan->constraints.first;
- else
- con = self->obj->constraints.first;
-
- while( i && con ) {
- --i;
- con = con->next;
- }
-
- if( con )
- return Constraint_CreatePyObject( self->pchan, self->obj, con );
- else
- return EXPP_ReturnPyObjError( PyExc_IndexError,
- "array index out of range" );
-}
-
-/*****************************************************************************/
-/* Python BPy_ConstraintSeq sequence table: */
-/*****************************************************************************/
-static PySequenceMethods ConstraintSeq_as_sequence = {
- ( inquiry ) ConstraintSeq_length, /* sq_length */
- ( binaryfunc ) 0, /* sq_concat */
- ( intargfunc ) 0, /* sq_repeat */
- ( intargfunc ) ConstraintSeq_item, /* sq_item */
- ( intintargfunc ) 0, /* sq_slice */
- ( intobjargproc ) 0, /* sq_ass_item */
- ( intintobjargproc ) 0, /* sq_ass_slice */
- ( objobjproc ) 0, /* sq_contains */
- ( binaryfunc ) 0, /* sq_inplace_concat */
- ( intargfunc ) 0, /* sq_inplace_repeat */
-};
-
-/*
- * helper function to check for a valid constraint argument
- */
-
-static bConstraint *locate_constr( BPy_ConstraintSeq *self, BPy_Constraint * value )
-{
- bConstraint *con;
-
- /* check that argument is a modifier */
- if (!BPy_Constraint_Check(value))
- return (bConstraint *)EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a constraint as an argument" );
-
- /* check whether constraint has been removed */
- if( !value->con )
- return (bConstraint *)EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This constraint has been removed!" );
-
- /* verify the constraint is still exists in the stack */
- if( self->pchan )
- con = self->pchan->constraints.first;
- else
- con = self->obj->constraints.first;
- while( con && con != value->con )
- con = con->next;
-
- /* if we didn't find it, exception */
- if( !con )
- return (bConstraint *)EXPP_ReturnPyObjError( PyExc_AttributeError,
- "This constraint is no longer in the object's stack" );
-
- return con;
-}
-
-
-/* create a new constraint at the end of the list */
-
-static PyObject *ConstraintSeq_append( BPy_ConstraintSeq *self, PyObject *value )
-{
- int type = (int)PyInt_AsLong(value);
- bConstraint *con;
-
- /* type 0 is CONSTRAINT_TYPE_NULL, should we be able to add one of these?
- * if the value is not an int it will be -1 */
- if( type < CONSTRAINT_TYPE_NULL || type > CONSTRAINT_TYPE_RIGIDBODYJOINT )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "arg not in int or out of range" );
-
- con = add_new_constraint( type );
- if( self->pchan ) {
- BLI_addtail( &self->pchan->constraints, con );
- update_pose_constraint_flags( self->obj->pose );
- }
- else
- BLI_addtail( &self->obj->constraints, con );
-
- return Constraint_CreatePyObject( self->pchan, self->obj, con );
-}
-
-/* move the constraint up in the stack */
-
-static PyObject *ConstraintSeq_moveUp( BPy_ConstraintSeq *self, BPy_Constraint *value )
-{
- bConstraint *con = locate_constr( self, value );
-
- /* if we can't locate the constraint, return (exception already set) */
- if( !con )
- return (PyObject *)NULL;
-
- const_moveUp( self->obj, con );
- Py_RETURN_NONE;
-}
-
-/* move the constraint down in the stack */
-
-static PyObject *ConstraintSeq_moveDown( BPy_ConstraintSeq *self, BPy_Constraint *value )
-{
- bConstraint *con = locate_constr( self, value );
-
- /* if we can't locate the constraint, return (exception already set) */
- if( !con )
- return (PyObject *)NULL;
-
- const_moveDown( self->obj, con );
- Py_RETURN_NONE;
-}
-
-/* remove an existing constraint */
-
-static PyObject *ConstraintSeq_remove( BPy_ConstraintSeq *self, BPy_Constraint *value )
-{
- bConstraint *con = locate_constr( self, value );
-
- /* if we can't locate the constraint, return (exception already set) */
- if( !con )
- return (PyObject *)NULL;
-
- /* do the actual removal */
- if( self->pchan )
- BLI_remlink( &self->pchan->constraints, con );
- else
- BLI_remlink( &self->obj->constraints, con);
- del_constr_func( self->obj, con );
-
- /* erase the link to the constraint */
- value->con = NULL;
-
- Py_RETURN_NONE;
-}
-
-/*****************************************************************************/
-/* Function: ConstraintSeq_dealloc */
-/* Description: This is a callback function for the BPy_ConstraintSeq type. */
-/* It destroys data when the object is deleted. */
-/*****************************************************************************/
-static void ConstraintSeq_dealloc( BPy_Constraint * self )
-{
- PyObject_DEL( self );
-}
-
-/*****************************************************************************/
-/* Python BPy_ConstraintSeq methods table: */
-/*****************************************************************************/
-static PyMethodDef BPy_ConstraintSeq_methods[] = {
- /* name, method, flags, doc */
- {"append", ( PyCFunction ) ConstraintSeq_append, METH_O,
- "(type) - add a new constraint, where type is the constraint type"},
- {"remove", ( PyCFunction ) ConstraintSeq_remove, METH_O,
- "(con) - remove an existing constraint, where con is a constraint from this object."},
- {"moveUp", ( PyCFunction ) ConstraintSeq_moveUp, METH_O,
- "(con) - Move constraint up in stack"},
- {"moveDown", ( PyCFunction ) ConstraintSeq_moveDown, METH_O,
- "(con) - Move constraint down in stack"},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Python ConstraintSeq_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject ConstraintSeq_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender.Constraints", /* char *tp_name; */
- sizeof( BPy_ConstraintSeq ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- ( destructor ) ConstraintSeq_dealloc,/* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- NULL, /* cmpfunc tp_compare; */
- ( reprfunc ) NULL, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- &ConstraintSeq_as_sequence, /* 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; */
- 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, /* 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, /* richcmpfunc tp_richcompare; */
-
- /*** weak reference enabler ***/
- 0, /* long tp_weaklistoffset; */
-
- /*** Added in release 2.2 ***/
- /* Iterators */
- ( getiterfunc )ConstraintSeq_getIter, /* getiterfunc tp_iter; */
- ( iternextfunc )ConstraintSeq_nextIter, /* iternextfunc tp_iternext; */
-
- /*** Attribute descriptor and subclassing stuff ***/
- BPy_ConstraintSeq_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- NULL, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-/*****************************************************************************/
-/* Function: PoseConstraintSeq_CreatePyObject */
-/* Description: This function will create a new BPy_ConstraintSeq from an */
-/* existing ListBase structure. */
-/*****************************************************************************/
-PyObject *PoseConstraintSeq_CreatePyObject( bPoseChannel *pchan )
-{
- BPy_ConstraintSeq *pyseq;
- Object *ob;
-
- for( ob = G.main->object.first; ob; ob = ob->id.next ) {
- if( ob->type == OB_ARMATURE ) {
- bPoseChannel *p = ob->pose->chanbase.first;
- while( p ) {
- if( p == pchan ) {
- pyseq = ( BPy_ConstraintSeq * ) PyObject_NEW(
- BPy_ConstraintSeq, &ConstraintSeq_Type );
- if( !pyseq )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create BPy_ConstraintSeq object" );
- pyseq->pchan = pchan;
- pyseq->obj = ob;
- return ( PyObject * ) pyseq;
- } else
- p = p->next;
- }
- }
- }
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't find ANY armature with the pose!" );
-
-}
-
-/*****************************************************************************/
-/* Function: ObConstraintSeq_CreatePyObject */
-/* Description: This function will create a new BPy_ConstraintSeq from an */
-/* existing ListBase structure. */
-/*****************************************************************************/
-PyObject *ObConstraintSeq_CreatePyObject( Object *obj )
-{
- BPy_ConstraintSeq *pyseq;
- pyseq = ( BPy_ConstraintSeq * ) PyObject_NEW( BPy_ConstraintSeq,
- &ConstraintSeq_Type );
- if( !pyseq )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create BPy_ConstraintSeq object" );
- pyseq->obj = obj;
- pyseq->pchan = NULL;
- return ( PyObject * ) pyseq;
-}
-
-static PyObject *M_Constraint_TypeDict( void )
-{
- PyObject *S = PyConstant_New( );
-
- if( S ) {
- BPy_constant *d = ( BPy_constant * ) S;
- PyConstant_Insert( d, "NULL",
- PyInt_FromLong( CONSTRAINT_TYPE_NULL ) );
- PyConstant_Insert( d, "TRACKTO",
- PyInt_FromLong( CONSTRAINT_TYPE_TRACKTO ) );
- PyConstant_Insert( d, "IKSOLVER",
- PyInt_FromLong( CONSTRAINT_TYPE_KINEMATIC ) );
- PyConstant_Insert( d, "FOLLOWPATH",
- PyInt_FromLong( CONSTRAINT_TYPE_FOLLOWPATH ) );
- PyConstant_Insert( d, "COPYROT",
- PyInt_FromLong( CONSTRAINT_TYPE_ROTLIKE ) );
- PyConstant_Insert( d, "COPYLOC",
- PyInt_FromLong( CONSTRAINT_TYPE_LOCLIKE ) );
- PyConstant_Insert( d, "COPYSIZE",
- PyInt_FromLong( CONSTRAINT_TYPE_SIZELIKE ) );
- PyConstant_Insert( d, "ACTION",
- PyInt_FromLong( CONSTRAINT_TYPE_ACTION ) );
- PyConstant_Insert( d, "LOCKTRACK",
- PyInt_FromLong( CONSTRAINT_TYPE_LOCKTRACK ) );
- PyConstant_Insert( d, "STRETCHTO",
- PyInt_FromLong( CONSTRAINT_TYPE_STRETCHTO ) );
- PyConstant_Insert( d, "FLOOR",
- PyInt_FromLong( CONSTRAINT_TYPE_MINMAX ) );
- PyConstant_Insert( d, "LIMITLOC",
- PyInt_FromLong( CONSTRAINT_TYPE_LOCLIMIT ) );
- PyConstant_Insert( d, "LIMITROT",
- PyInt_FromLong( CONSTRAINT_TYPE_ROTLIMIT ) );
- PyConstant_Insert( d, "LIMITSIZE",
- PyInt_FromLong( CONSTRAINT_TYPE_SIZELIMIT ) );
- PyConstant_Insert( d, "RIGIDBODYJOINT",
- PyInt_FromLong( CONSTRAINT_TYPE_RIGIDBODYJOINT ) );
- PyConstant_Insert( d, "CLAMPTO",
- PyInt_FromLong( CONSTRAINT_TYPE_CLAMPTO ) );
- PyConstant_Insert( d, "PYTHON",
- PyInt_FromLong( CONSTRAINT_TYPE_PYTHON ) );
- PyConstant_Insert( d, "CHILDOF",
- PyInt_FromLong( CONSTRAINT_TYPE_CHILDOF ) );
- PyConstant_Insert( d, "TRANSFORM",
- PyInt_FromLong( CONSTRAINT_TYPE_TRANSFORM ) );
- }
- return S;
-}
-
-static PyObject *M_Constraint_SettingsDict( void )
-{
- PyObject *S = PyConstant_New( );
-
- if( S ) {
- BPy_constant *d = ( BPy_constant * ) S;
- PyConstant_Insert( d, "XROT",
- PyInt_FromLong( EXPP_CONSTR_XROT ) );
- PyConstant_Insert( d, "YROT",
- PyInt_FromLong( EXPP_CONSTR_YROT ) );
- PyConstant_Insert( d, "ZROT",
- PyInt_FromLong( EXPP_CONSTR_ZROT ) );
- PyConstant_Insert( d, "XSIZE",
- PyInt_FromLong( EXPP_CONSTR_XSIZE ) );
- PyConstant_Insert( d, "YSIZE",
- PyInt_FromLong( EXPP_CONSTR_YSIZE ) );
- PyConstant_Insert( d, "ZSIZE",
- PyInt_FromLong( EXPP_CONSTR_ZSIZE ) );
- PyConstant_Insert( d, "XLOC",
- PyInt_FromLong( EXPP_CONSTR_XLOC ) );
- PyConstant_Insert( d, "YLOC",
- PyInt_FromLong( EXPP_CONSTR_YLOC ) );
- PyConstant_Insert( d, "ZLOC",
- PyInt_FromLong( EXPP_CONSTR_ZLOC ) );
-
- PyConstant_Insert( d, "UPX",
- PyInt_FromLong( UP_X ) );
- PyConstant_Insert( d, "UPY",
- PyInt_FromLong( UP_Y ) );
- PyConstant_Insert( d, "UPZ",
- PyInt_FromLong( UP_Z ) );
-
- PyConstant_Insert( d, "TRACKX",
- PyInt_FromLong( TRACK_X ) );
- PyConstant_Insert( d, "TRACKY",
- PyInt_FromLong( TRACK_Y ) );
- PyConstant_Insert( d, "TRACKZ",
- PyInt_FromLong( TRACK_Z ) );
- PyConstant_Insert( d, "TRACKNEGX",
- PyInt_FromLong( TRACK_nX ) );
- PyConstant_Insert( d, "TRACKNEGY",
- PyInt_FromLong( TRACK_nY ) );
- PyConstant_Insert( d, "TRACKNEGZ",
- PyInt_FromLong( TRACK_nZ ) );
-
- PyConstant_Insert( d, "VOLUMEXZ",
- PyInt_FromLong( VOLUME_XZ ) );
- PyConstant_Insert( d, "VOLUMEX",
- PyInt_FromLong( VOLUME_X ) );
- PyConstant_Insert( d, "VOLUMEZ",
- PyInt_FromLong( VOLUME_Z ) );
- PyConstant_Insert( d, "VOLUMENONE",
- PyInt_FromLong( NO_VOLUME ) );
-
- PyConstant_Insert( d, "PLANEX",
- PyInt_FromLong( PLANE_X ) );
- PyConstant_Insert( d, "PLANEY",
- PyInt_FromLong( PLANE_Y ) );
- PyConstant_Insert( d, "PLANEZ",
- PyInt_FromLong( PLANE_Z ) );
-
- PyConstant_Insert( d, "LOCKX",
- PyInt_FromLong( LOCK_X ) );
- PyConstant_Insert( d, "LOCKY",
- PyInt_FromLong( LOCK_Y ) );
- PyConstant_Insert( d, "LOCKZ",
- PyInt_FromLong( LOCK_Z ) );
-
- PyConstant_Insert( d, "MAXX",
- PyInt_FromLong( EXPP_CONSTR_MAXX ) );
- PyConstant_Insert( d, "MAXY",
- PyInt_FromLong( EXPP_CONSTR_MAXY ) );
- PyConstant_Insert( d, "MAXZ",
- PyInt_FromLong( EXPP_CONSTR_MAXZ ) );
- PyConstant_Insert( d, "MINX",
- PyInt_FromLong( EXPP_CONSTR_MINX ) );
- PyConstant_Insert( d, "MINY",
- PyInt_FromLong( EXPP_CONSTR_MINY ) );
- PyConstant_Insert( d, "MINZ",
- PyInt_FromLong( EXPP_CONSTR_MINZ ) );
-
- PyConstant_Insert( d, "COPYX",
- PyInt_FromLong( LOCLIKE_X ) );
- PyConstant_Insert( d, "COPYY",
- PyInt_FromLong( LOCLIKE_Y ) );
- PyConstant_Insert( d, "COPYZ",
- PyInt_FromLong( LOCLIKE_Z ) );
- PyConstant_Insert( d, "COPYXINVERT",
- PyInt_FromLong( LOCLIKE_X_INVERT ) );
- PyConstant_Insert( d, "COPYYINVERT",
- PyInt_FromLong( LOCLIKE_Y_INVERT ) );
- PyConstant_Insert( d, "COPYZINVERT",
- PyInt_FromLong( LOCLIKE_Z_INVERT ) );
-
- PyConstant_Insert( d, "PARLOCX",
- PyInt_FromLong( CHILDOF_LOCX ) );
- PyConstant_Insert( d, "PARLOCY",
- PyInt_FromLong( CHILDOF_LOCY ) );
- PyConstant_Insert( d, "PARLOCZ",
- PyInt_FromLong( CHILDOF_LOCZ ) );
- PyConstant_Insert( d, "PARROTX",
- PyInt_FromLong( CHILDOF_ROTX ) );
- PyConstant_Insert( d, "PARROTY",
- PyInt_FromLong( CHILDOF_ROTY ) );
- PyConstant_Insert( d, "PARROTZ",
- PyInt_FromLong( CHILDOF_ROTZ ) );
- PyConstant_Insert( d, "PARSIZEX",
- PyInt_FromLong( CHILDOF_LOCX ) );
- PyConstant_Insert( d, "PARSIZEY",
- PyInt_FromLong( CHILDOF_SIZEY ) );
- PyConstant_Insert( d, "PARSIZEZ",
- PyInt_FromLong( CHILDOF_SIZEZ ) );
-
- PyConstant_Insert( d, "CLAMPAUTO",
- PyInt_FromLong( CLAMPTO_AUTO ) );
- PyConstant_Insert( d, "CLAMPX",
- PyInt_FromLong( CLAMPTO_X ) );
- PyConstant_Insert( d, "CLAMPY",
- PyInt_FromLong( CLAMPTO_Y ) );
- PyConstant_Insert( d, "CLAMPZ",
- PyInt_FromLong( CLAMPTO_Z ) );
- PyConstant_Insert( d, "CLAMPCYCLIC",
- PyInt_FromLong( EXPP_CONSTR_CLAMPCYCLIC ));
-
- PyConstant_Insert( d, "TARGET",
- PyInt_FromLong( EXPP_CONSTR_TARGET ) );
- PyConstant_Insert( d, "STRETCH",
- PyInt_FromLong( EXPP_CONSTR_STRETCH ) );
- PyConstant_Insert( d, "ITERATIONS",
- PyInt_FromLong( EXPP_CONSTR_ITERATIONS ) );
- PyConstant_Insert( d, "BONE",
- PyInt_FromLong( EXPP_CONSTR_BONE ) );
- PyConstant_Insert( d, "CHAINLEN",
- PyInt_FromLong( EXPP_CONSTR_CHAINLEN ) );
- PyConstant_Insert( d, "POSWEIGHT",
- PyInt_FromLong( EXPP_CONSTR_POSWEIGHT ) );
- PyConstant_Insert( d, "ROTWEIGHT",
- PyInt_FromLong( EXPP_CONSTR_ROTWEIGHT ) );
- PyConstant_Insert( d, "ROTATE",
- PyInt_FromLong( EXPP_CONSTR_ROTATE ) );
- PyConstant_Insert( d, "USETIP",
- PyInt_FromLong( EXPP_CONSTR_USETIP ) );
-
- PyConstant_Insert( d, "ACTION",
- PyInt_FromLong( EXPP_CONSTR_ACTION ) );
- PyConstant_Insert( d, "START",
- PyInt_FromLong( EXPP_CONSTR_START ) );
- PyConstant_Insert( d, "END",
- PyInt_FromLong( EXPP_CONSTR_END ) );
- PyConstant_Insert( d, "MIN",
- PyInt_FromLong( EXPP_CONSTR_MIN ) );
- PyConstant_Insert( d, "MAX",
- PyInt_FromLong( EXPP_CONSTR_MAX ) );
- PyConstant_Insert( d, "KEYON",
- PyInt_FromLong( EXPP_CONSTR_KEYON ) );
-
- PyConstant_Insert( d, "TRACK",
- PyInt_FromLong( EXPP_CONSTR_TRACK ) );
- PyConstant_Insert( d, "UP",
- PyInt_FromLong( EXPP_CONSTR_UP ) );
-
- PyConstant_Insert( d, "RESTLENGTH",
- PyInt_FromLong( EXPP_CONSTR_RESTLENGTH ) );
- PyConstant_Insert( d, "VOLVARIATION",
- PyInt_FromLong( EXPP_CONSTR_VOLVARIATION ) );
- PyConstant_Insert( d, "VOLUMEMODE",
- PyInt_FromLong( EXPP_CONSTR_VOLUMEMODE ) );
- PyConstant_Insert( d, "PLANE",
- PyInt_FromLong( EXPP_CONSTR_PLANE ) );
-
- PyConstant_Insert( d, "FOLLOW",
- PyInt_FromLong( EXPP_CONSTR_FOLLOW ) );
- PyConstant_Insert( d, "OFFSET",
- PyInt_FromLong( EXPP_CONSTR_OFFSET ) );
- PyConstant_Insert( d, "FORWARD",
- PyInt_FromLong( EXPP_CONSTR_FORWARD ) );
-
- PyConstant_Insert( d, "LOCK",
- PyInt_FromLong( EXPP_CONSTR_LOCK ) );
-
- PyConstant_Insert( d, "COPY",
- PyInt_FromLong( EXPP_CONSTR_COPY ) );
- PyConstant_Insert( d, "LIMIT",
- PyInt_FromLong( EXPP_CONSTR_LIMIT ) );
- PyConstant_Insert( d, "CLAMP",
- PyInt_FromLong( EXPP_CONSTR_CLAMP ) );
-
- PyConstant_Insert( d, "LIMIT_XMIN",
- PyInt_FromLong( EXPP_CONSTR_LIMXMIN ) );
- PyConstant_Insert( d, "LIMIT_XMAX",
- PyInt_FromLong( EXPP_CONSTR_LIMXMAX ) );
- PyConstant_Insert( d, "LIMIT_YMIN",
- PyInt_FromLong( EXPP_CONSTR_LIMYMIN ) );
- PyConstant_Insert( d, "LIMIT_YMAX",
- PyInt_FromLong( EXPP_CONSTR_LIMYMAX ) );
- PyConstant_Insert( d, "LIMIT_ZMIN",
- PyInt_FromLong( EXPP_CONSTR_LIMZMIN ) );
- PyConstant_Insert( d, "LIMIT_ZMAX",
- PyInt_FromLong( EXPP_CONSTR_LIMZMAX ) );
-
- PyConstant_Insert( d, "LIMIT_XROT",
- PyInt_FromLong( EXPP_CONSTR_LIMXROT ) );
- PyConstant_Insert( d, "LIMIT_YROT",
- PyInt_FromLong( EXPP_CONSTR_LIMYROT ) );
- PyConstant_Insert( d, "LIMIT_ZROT",
- PyInt_FromLong( EXPP_CONSTR_LIMZROT ) );
-
- PyConstant_Insert( d, "XMIN",
- PyInt_FromLong( EXPP_CONSTR_XMIN ) );
- PyConstant_Insert( d, "XMAX",
- PyInt_FromLong( EXPP_CONSTR_XMAX ) );
- PyConstant_Insert( d, "YMIN",
- PyInt_FromLong( EXPP_CONSTR_YMIN ) );
- PyConstant_Insert( d, "YMAX",
- PyInt_FromLong( EXPP_CONSTR_YMAX ) );
- PyConstant_Insert( d, "ZMIN",
- PyInt_FromLong( EXPP_CONSTR_ZMIN ) );
- PyConstant_Insert( d, "ZMAX",
- PyInt_FromLong( EXPP_CONSTR_ZMAX ) );
-
- PyConstant_Insert( d, "SCRIPT",
- PyInt_FromLong( EXPP_CONSTR_SCRIPT ) );
- PyConstant_Insert( d, "PROPERTIES",
- PyInt_FromLong( EXPP_CONSTR_PROPS ) );
-
- PyConstant_Insert( d, "FROM",
- PyInt_FromLong( EXPP_CONSTR_FROM ) );
- PyConstant_Insert( d, "TO",
- PyInt_FromLong( EXPP_CONSTR_TO ) );
- PyConstant_Insert( d, "EXTRAPOLATE",
- PyInt_FromLong( EXPP_CONSTR_EXPO ) );
- PyConstant_Insert( d, "MAPX",
- PyInt_FromLong( EXPP_CONSTR_MAPX ) );
- PyConstant_Insert( d, "MAPY",
- PyInt_FromLong( EXPP_CONSTR_MAPY ) );
- PyConstant_Insert( d, "MAPZ",
- PyInt_FromLong( EXPP_CONSTR_MAPZ ) );
- PyConstant_Insert( d, "FROM_MINX",
- PyInt_FromLong( EXPP_CONSTR_FROMMINX ) );
- PyConstant_Insert( d, "FROM_MAXX",
- PyInt_FromLong( EXPP_CONSTR_FROMMAXX ) );
- PyConstant_Insert( d, "FROM_MINY",
- PyInt_FromLong( EXPP_CONSTR_FROMMINY ) );
- PyConstant_Insert( d, "FROM_MAXY",
- PyInt_FromLong( EXPP_CONSTR_FROMMAXY ) );
- PyConstant_Insert( d, "FROM_MINZ",
- PyInt_FromLong( EXPP_CONSTR_FROMMINZ ) );
- PyConstant_Insert( d, "FROM_MAXZ",
- PyInt_FromLong( EXPP_CONSTR_FROMMAXZ ) );
- PyConstant_Insert( d, "TO_MINX",
- PyInt_FromLong( EXPP_CONSTR_TOMINX ) );
- PyConstant_Insert( d, "TO_MAXX",
- PyInt_FromLong( EXPP_CONSTR_TOMAXX ) );
- PyConstant_Insert( d, "TO_MINY",
- PyInt_FromLong( EXPP_CONSTR_TOMINY ) );
- PyConstant_Insert( d, "TO_MAXY",
- PyInt_FromLong( EXPP_CONSTR_TOMAXY ) );
- PyConstant_Insert( d, "TO_MINZ",
- PyInt_FromLong( EXPP_CONSTR_TOMINZ ) );
- PyConstant_Insert( d, "TO_MAXZ",
- PyInt_FromLong( EXPP_CONSTR_TOMAXZ ) );
-
- PyConstant_Insert( d, "LOC",
- PyInt_FromLong( 0 ) );
- PyConstant_Insert( d, "ROT",
- PyInt_FromLong( 1 ) );
- PyConstant_Insert( d, "SCALE",
- PyInt_FromLong( 2 ) );
-
- PyConstant_Insert( d, "CONSTR_RB_TYPE",
- PyInt_FromLong( EXPP_CONSTR_RB_TYPE ) );
- PyConstant_Insert( d, "CONSTR_RB_BALL",
- PyInt_FromLong( EXPP_CONSTR_RB_BALL ) );
- PyConstant_Insert( d, "CONSTR_RB_HINGE",
- PyInt_FromLong( EXPP_CONSTR_RB_HINGE ) );
- PyConstant_Insert( d, "CONSTR_RB_GENERIC6DOF",
- PyInt_FromLong( EXPP_CONSTR_RB_GENERIC6DOF ) );
- PyConstant_Insert( d, "CONSTR_RB_VEHICLE",
- PyInt_FromLong( EXPP_CONSTR_RB_VEHICLE ) );
- PyConstant_Insert( d, "CONSTR_RB_PIVX",
- PyInt_FromLong( EXPP_CONSTR_RB_PIVX ) );
- PyConstant_Insert( d, "CONSTR_RB_PIVY",
- PyInt_FromLong( EXPP_CONSTR_RB_PIVY ) );
- PyConstant_Insert( d, "CONSTR_RB_PIVZ",
- PyInt_FromLong( EXPP_CONSTR_RB_PIVZ ) );
- PyConstant_Insert( d, "CONSTR_RB_AXX",
- PyInt_FromLong( EXPP_CONSTR_RB_AXX ) );
- PyConstant_Insert( d, "CONSTR_RB_AXY",
- PyInt_FromLong( EXPP_CONSTR_RB_AXY ) );
- PyConstant_Insert( d, "CONSTR_RB_AXZ",
- PyInt_FromLong( EXPP_CONSTR_RB_AXZ ) );
- PyConstant_Insert( d, "CONSTR_RB_MINLIMIT0",
- PyInt_FromLong( EXPP_CONSTR_RB_MINLIMIT0 ) );
- PyConstant_Insert( d, "CONSTR_RB_MINLIMIT1",
- PyInt_FromLong( EXPP_CONSTR_RB_MINLIMIT1 ) );
- PyConstant_Insert( d, "CONSTR_RB_MINLIMIT2",
- PyInt_FromLong( EXPP_CONSTR_RB_MINLIMIT2 ) );
- PyConstant_Insert( d, "CONSTR_RB_MINLIMIT3",
- PyInt_FromLong( EXPP_CONSTR_RB_MINLIMIT3 ) );
- PyConstant_Insert( d, "CONSTR_RB_MINLIMIT4",
- PyInt_FromLong( EXPP_CONSTR_RB_MINLIMIT4 ) );
- PyConstant_Insert( d, "CONSTR_RB_MINLIMIT5",
- PyInt_FromLong( EXPP_CONSTR_RB_MINLIMIT5 ) );
- PyConstant_Insert( d, "CONSTR_RB_MAXLIMIT0",
- PyInt_FromLong( EXPP_CONSTR_RB_MAXLIMIT0 ) );
- PyConstant_Insert( d, "CONSTR_RB_MAXLIMIT1",
- PyInt_FromLong( EXPP_CONSTR_RB_MAXLIMIT1 ) );
- PyConstant_Insert( d, "CONSTR_RB_MAXLIMIT2",
- PyInt_FromLong( EXPP_CONSTR_RB_MAXLIMIT2 ) );
- PyConstant_Insert( d, "CONSTR_RB_MAXLIMIT3",
- PyInt_FromLong( EXPP_CONSTR_RB_MAXLIMIT3 ) );
- PyConstant_Insert( d, "CONSTR_RB_MAXLIMIT4",
- PyInt_FromLong( EXPP_CONSTR_RB_MAXLIMIT4 ) );
- PyConstant_Insert( d, "CONSTR_RB_MAXLIMIT5",
- PyInt_FromLong( EXPP_CONSTR_RB_MAXLIMIT5 ) );
- PyConstant_Insert( d, "CONSTR_RB_EXTRAFZ",
- PyInt_FromLong( EXPP_CONSTR_RB_EXTRAFZ ) );
- PyConstant_Insert( d, "CONSTR_RB_FLAG",
- PyInt_FromLong( EXPP_CONSTR_RB_FLAG ) );
-
-
- PyConstant_Insert( d, "OWNERSPACE",
- PyInt_FromLong( EXPP_CONSTR_OWNSPACE ) );
- PyConstant_Insert( d, "TARGETSPACE",
- PyInt_FromLong( EXPP_CONSTR_TARSPACE ) );
-
- PyConstant_Insert( d, "SPACE_WORLD",
- PyInt_FromLong( CONSTRAINT_SPACE_WORLD) );
- PyConstant_Insert( d, "SPACE_LOCAL",
- PyInt_FromLong( CONSTRAINT_SPACE_LOCAL ) );
- PyConstant_Insert( d, "SPACE_POSE",
- PyInt_FromLong( CONSTRAINT_SPACE_POSE) );
- PyConstant_Insert( d, "SPACE_PARLOCAL",
- PyInt_FromLong( CONSTRAINT_SPACE_PARLOCAL ) );
- }
- return S;
-}
-
-/*****************************************************************************/
-/* Function: Constraint_Init */
-/*****************************************************************************/
-PyObject *Constraint_Init( void )
-{
- PyObject *submodule;
- PyObject *TypeDict = M_Constraint_TypeDict( );
- PyObject *SettingsDict = M_Constraint_SettingsDict( );
-
- if( PyType_Ready( &ConstraintSeq_Type ) < 0
- || PyType_Ready( &Constraint_Type ) < 0 )
- return NULL;
-
- submodule = Py_InitModule3( "Blender.Constraint", NULL,
- "Constraint module for accessing and creating constraint data" );
-
- if( TypeDict )
- PyModule_AddObject( submodule, "Type", TypeDict );
-
- if( SettingsDict )
- PyModule_AddObject( submodule, "Settings", SettingsDict );
-
- return submodule;
-}
diff --git a/source/blender/python/api2_2x/Constraint.h b/source/blender/python/api2_2x/Constraint.h
deleted file mode 100644
index a9b983fadb4..00000000000
--- a/source/blender/python/api2_2x/Constraint.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * $Id: Constraint.h 10269 2007-03-15 01:09:14Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Joseph Gilbert, Ken Hughes
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_CONSTRAINT_H
-#define EXPP_CONSTRAINT_H
-
-#include <Python.h>
-#include "DNA_object_types.h"
-#include "DNA_action_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_listBase.h"
-
-/*****************************************************************************/
-/* Python BPy_Modifier structure definition: */
-/*****************************************************************************/
-typedef struct {
- PyObject_HEAD /* required macro */
- Object *obj; /* "parent" object */
- bPoseChannel *pchan;/* "parent" pose channel */
- /* if con this is null, the constraint has been removed and we need to
- * raise an error when its data is accessed */
- bConstraint *con;
-} BPy_Constraint;
-
-extern PyTypeObject Constraint_Type;
-
-#define BPy_Constraint_Check(v) ((v)->ob_type == &Constraint_Type) /* for type checking */
-typedef struct {
- PyObject_HEAD /* required macro */
- Object *obj; /* "parent" object */
- bPoseChannel *pchan;/* "parent" pose channel */
- bConstraint *iter;
-} BPy_ConstraintSeq;
-
-/*
- * prototypes
- */
-
-PyObject *Constraint_Init( void );
-PyObject *Constraint_CreatePyObject( bPoseChannel *pchan, Object *obj,
- bConstraint *con );
-bConstraint *Constraint_FromPyObject( BPy_Constraint * obj );
-
-PyObject *PoseConstraintSeq_CreatePyObject( bPoseChannel *pchan );
-PyObject *ObConstraintSeq_CreatePyObject( Object *obj );
-
-#endif /* EXPP_CONSTRAINT_H */
diff --git a/source/blender/python/api2_2x/CurNurb.c b/source/blender/python/api2_2x/CurNurb.c
deleted file mode 100644
index fc79296e952..00000000000
--- a/source/blender/python/api2_2x/CurNurb.c
+++ /dev/null
@@ -1,1098 +0,0 @@
-/*
- * $Id: CurNurb.c 12813 2007-12-07 09:51:02Z campbellbarton $
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Stephen Swaney, Campbell Barton, Ken Hughes
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include "CurNurb.h" /*This must come first */
-
-#include "BKE_curve.h"
-#include "BDR_editcurve.h" /* for convertspline */
-#include "MEM_guardedalloc.h"
-#include "gen_utils.h"
-#include "BezTriple.h"
-
-/* Only for ME_SMOOTH */
-#include "DNA_meshdata_types.h"
-
-/*
- * forward declarations go here
- */
-
-static PyObject *M_CurNurb_New( PyObject * self, PyObject * args );
-static PyObject *CurNurb_oldsetMatIndex( BPy_CurNurb * self, PyObject * args );
-static int CurNurb_setMatIndex( BPy_CurNurb * self, PyObject * args );
-static PyObject *CurNurb_getMatIndex( BPy_CurNurb * self );
-static PyObject *CurNurb_getFlagU( BPy_CurNurb * self );
-static PyObject *CurNurb_oldsetFlagU( BPy_CurNurb * self, PyObject * args );
-static int CurNurb_setFlagU( BPy_CurNurb * self, PyObject * args );
-static PyObject *CurNurb_getFlagV( BPy_CurNurb * self );
-static PyObject *CurNurb_oldsetFlagV( BPy_CurNurb * self, PyObject * args );
-static int CurNurb_setFlagV( BPy_CurNurb * self, PyObject * args );
-static PyObject *CurNurb_getType( BPy_CurNurb * self );
-static PyObject *CurNurb_oldsetType( BPy_CurNurb * self, PyObject * args );
-static int CurNurb_setType( BPy_CurNurb * self, PyObject * args );
-static PyObject *CurNurb_getKnotsU( BPy_CurNurb * self );
-static PyObject *CurNurb_getKnotsV( BPy_CurNurb * self );
-static PyObject *CurNurb_getPoints( BPy_CurNurb * self );
-/* static PyObject* CurNurb_setXXX( BPy_CurNurb* self, PyObject* args ); */
-static int CurNurb_setPoint( BPy_CurNurb * self, int index, PyObject * ob );
-static int CurNurb_length( PyInstanceObject * inst );
-static PyObject *CurNurb_getIter( BPy_CurNurb * self );
-static PyObject *CurNurb_iterNext( BPy_CurNurb * self );
-PyObject *CurNurb_append( BPy_CurNurb * self, PyObject * value );
-
-static PyObject *CurNurb_isNurb( BPy_CurNurb * self );
-static PyObject *CurNurb_isCyclic( BPy_CurNurb * self );
-static PyObject *CurNurb_dump( BPy_CurNurb * self );
-static PyObject *CurNurb_switchDirection( BPy_CurNurb * self );
-static PyObject *CurNurb_recalc( BPy_CurNurb * self );
-static PyObject *CurNurb_getFlagBits( BPy_CurNurb * self, void *type );
-static int CurNurb_setFlagBits( BPy_CurNurb * self, PyObject *value, void *type );
-char M_CurNurb_doc[] = "CurNurb";
-
-
-/*
- CurNurb_Type callback function prototypes:
-*/
-
-static int CurNurb_compare( BPy_CurNurb * a, BPy_CurNurb * b );
-static PyObject *CurNurb_repr( BPy_CurNurb * self );
-
-/*
- table of module methods
- these are the equivalent of class or static methods.
- you do not need an object instance to call one.
-
-*/
-
-static PyMethodDef M_CurNurb_methods[] = {
-/* name, method, flags, doc_string */
- {"New", ( PyCFunction ) M_CurNurb_New, METH_VARARGS | METH_KEYWORDS,
- " () - doc string"},
-/* {"Get", (PyCFunction) M_CurNurb_method, METH_NOARGS, " () - doc string"}, */
-/* {"method", (PyCFunction) M_CurNurb_method, METH_NOARGS, " () - doc string"}, */
-
- {NULL, NULL, 0, NULL}
-};
-
-
-
-/*
- * method table
- * table of instance methods
- * these methods are invoked on an instance of the type.
-*/
-
-static PyMethodDef BPy_CurNurb_methods[] = {
-/* name, method, flags, doc */
-/* {"method", (PyCFunction) CurNurb_method, METH_NOARGS, " () - doc string"} */
- {"setMatIndex", ( PyCFunction ) CurNurb_oldsetMatIndex, METH_VARARGS,
- "( index ) - set index into materials list"},
- {"getMatIndex", ( PyCFunction ) CurNurb_getMatIndex, METH_NOARGS,
- "( ) - get current material index"},
- {"setFlagU", ( PyCFunction ) CurNurb_oldsetFlagU, METH_VARARGS,
- "( index ) - set flagU and recalculate the knots (0: uniform, 1: endpoints, 2: bezier)"},
- {"getFlagU", ( PyCFunction ) CurNurb_getFlagU, METH_NOARGS,
- "( ) - get flagU of the knots"},
- {"setFlagV", ( PyCFunction ) CurNurb_oldsetFlagV, METH_VARARGS,
- "( index ) - set flagV and recalculate the knots (0: uniform, 1: endpoints, 2: bezier)"},
- {"getFlagV", ( PyCFunction ) CurNurb_getFlagV, METH_NOARGS,
- "( ) - get flagV of the knots"},
- {"setType", ( PyCFunction ) CurNurb_oldsetType, METH_VARARGS,
- "( type ) - change the type of the curve (Poly: 0, Bezier: 1, NURBS: 4)"},
- {"getType", ( PyCFunction ) CurNurb_getType, METH_NOARGS,
- "( ) - get the type of the curve (Poly: 0, Bezier: 1, NURBS: 4)"},
- {"append", ( PyCFunction ) CurNurb_append, METH_O,
- "( point ) - add a new point. arg is BezTriple or list of x,y,z,w floats"},
- {"isNurb", ( PyCFunction ) CurNurb_isNurb, METH_NOARGS,
- "( ) - boolean function tests if this spline is type nurb or bezier"},
- {"isCyclic", ( PyCFunction ) CurNurb_isCyclic, METH_NOARGS,
- "( ) - boolean function tests if this spline is cyclic (closed) or not (open)"},
- {"dump", ( PyCFunction ) CurNurb_dump, METH_NOARGS,
- "( ) - dumps Nurb data)"},
- {"switchDirection", ( PyCFunction ) CurNurb_switchDirection, METH_NOARGS,
- "( ) - swaps curve beginning and end)"},
- {"recalc", ( PyCFunction ) CurNurb_recalc, METH_NOARGS,
- "( ) - recalc Nurb data)"},
- {NULL, NULL, 0, NULL}
-};
-
-/*
- * methods for CurNurb as sequece
- */
-
-static PySequenceMethods CurNurb_as_sequence = {
- ( inquiry ) CurNurb_length, /* sq_length */
- ( binaryfunc ) 0, /* sq_concat */
- ( intargfunc ) 0, /* sq_repeat */
- ( intargfunc ) CurNurb_getPoint, /* sq_item */
- ( intintargfunc ) 0, /* sq_slice */
- ( intobjargproc ) CurNurb_setPoint, /* sq_ass_item */
- 0, /* sq_ass_slice */
- ( objobjproc ) 0, /* sq_contains */
- 0,
- 0
-};
-
-static PyGetSetDef BPy_CurNurb_getseters[] = {
- {"mat_index",
- (getter)CurNurb_getMatIndex, (setter)CurNurb_setMatIndex,
- "CurNurb's material index",
- NULL},
- {"points",
- (getter)CurNurb_getPoints, (setter)NULL,
- "The number of curve points",
- NULL},
- {"flagU",
- (getter)CurNurb_getFlagU, (setter)CurNurb_setFlagU,
- "The knot type in the U direction",
- NULL},
- {"flagV",
- (getter)CurNurb_getFlagV, (setter)CurNurb_setFlagV,
- "The knot type in the V direction",
- NULL},
- {"type",
- (getter)CurNurb_getType, (setter)CurNurb_setType,
- "The curve type (poly: bezier, or NURBS)",
- NULL},
- {"knotsU",
- (getter)CurNurb_getKnotsU, (setter)NULL,
- "The The knot vector in the U direction",
- NULL},
- {"knotsV",
- (getter)CurNurb_getKnotsV, (setter)NULL,
- "The The knot vector in the V direction",
- NULL},
- {"smooth",
- (getter)CurNurb_getFlagBits, (setter)CurNurb_setFlagBits,
- "The smooth bool setting",
- (void *)ME_SMOOTH},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-/*
- Object Type definition
- full blown 2.3 struct
- if you are having trouble building with an earlier version of python,
- this is why.
-*/
-
-PyTypeObject CurNurb_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "CurNurb", /* char *tp_name; */
- sizeof( CurNurb_Type ), /* int tp_basicsize, */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL, /* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- ( cmpfunc ) CurNurb_compare, /* cmpfunc tp_compare; */
- ( reprfunc ) CurNurb_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- 0, /* PyNumberMethods *tp_as_number; */
- &CurNurb_as_sequence, /* PySequenceMethods *tp_as_sequence; */
- 0, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- 0, /* hashfunc tp_hash; */
- 0, /* ternaryfunc tp_call; */
- 0, /* reprfunc tp_str; */
- 0, /* getattrofunc tp_getattro; */
- 0, /* setattrofunc tp_setattro; */
-
- /* Functions to access object as input/output buffer */
- 0, /* PyBufferProcs *tp_as_buffer; */
-
- /*** Flags to define presence of optional/expanded features ***/
- Py_TPFLAGS_DEFAULT, /* long tp_flags; */
-
- 0, /* char *tp_doc; Documentation string */
- /*** Assigned meaning in release 2.0 ***/
- /* call function for all accessible objects */
- 0, /* traverseproc tp_traverse; */
-
- /* delete references to contained objects */
- 0, /* inquiry tp_clear; */
-
- /*** Assigned meaning in release 2.1 ***/
- /*** rich comparisons ***/
- 0, /* richcmpfunc tp_richcompare; */
-
- /*** weak reference enabler ***/
- 0, /* long tp_weaklistoffset; */
-
- /*** Added in release 2.2 ***/
- /* Iterators */
- ( getiterfunc ) CurNurb_getIter, /* getiterfunc tp_iter; */
- ( iternextfunc ) CurNurb_iterNext, /* iternextfunc tp_iternext; */
-
- /*** Attribute descriptor and subclassing stuff ***/
- BPy_CurNurb_methods, /* struct PyMethodDef *tp_methods; */
- 0, /* struct PyMemberDef *tp_members; */
- BPy_CurNurb_getseters, /* struct PyGetSetDef *tp_getset; */
- 0, /* struct _typeobject *tp_base; */
- 0, /* PyObject *tp_dict; */
- 0, /* descrgetfunc tp_descr_get; */
- 0, /* descrsetfunc tp_descr_set; */
- 0, /* long tp_dictoffset; */
- 0, /* initproc tp_init; */
- 0, /* allocfunc tp_alloc; */
- 0, /* newfunc tp_new; */
- /* Low-level free-memory routine */
- 0, /* freefunc tp_free; */
- /* For PyObject_IS_GC */
- 0, /* inquiry tp_is_gc; */
- 0, /* PyObject *tp_bases; */
- /* method resolution order */
- 0, /* PyObject *tp_mro; */
- 0, /* PyObject *tp_cache; */
- 0, /* PyObject *tp_subclasses; */
- 0, /* PyObject *tp_weaklist; */
- 0
-};
-
-/*
- compare
- in this case, we consider two CurNurbs equal, if they point to the same
- blender data.
-*/
-
-static int CurNurb_compare( BPy_CurNurb * a, BPy_CurNurb * b )
-{
- Nurb *pa = a->nurb;
- Nurb *pb = b->nurb;
-
- return ( pa == pb ) ? 0 : -1;
-}
-
-
-/*
- factory method to create a BPy_CurNurb from a Blender Nurb
-*/
-
-PyObject *CurNurb_CreatePyObject( Nurb * blen_nurb )
-{
- BPy_CurNurb *pyNurb;
-
- pyNurb = ( BPy_CurNurb * ) PyObject_NEW( BPy_CurNurb, &CurNurb_Type );
-
- if( !pyNurb )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "could not create BPy_CurNurb PyObject" );
-
- pyNurb->nurb = blen_nurb;
- return ( PyObject * ) pyNurb;
-}
-
-
-/*
- * CurNurb_repr
- */
-static PyObject *CurNurb_repr( BPy_CurNurb * self )
-{ /* used by 'repr' */
-
- return PyString_FromFormat( "[CurNurb \"%d\"]", self->nurb->type );
-}
-
-/* XXX Can't this be simply removed? */
-static PyObject *M_CurNurb_New( PyObject * self, PyObject * args )
-{
- return ( PyObject * ) 0;
-
-}
-
-/*
- * Curve.getType
- */
-static PyObject *CurNurb_getType( BPy_CurNurb * self )
-{
- /* type is on 3 first bits only */
- return PyInt_FromLong( self->nurb->type & 7 );
-}
-
-/*
- * Curve.setType
- *
- * Convert the curve using Blender's convertspline fonction
- */
-static int CurNurb_setType( BPy_CurNurb * self, PyObject * args )
-{
- PyObject* integer = PyNumber_Int( args );
- short value;
-
- if( !integer )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected integer argument" );
-
- value = ( short )PyInt_AS_LONG( integer );
- Py_DECREF( integer );
-
- /* parameter value checking */
- if (value != CU_POLY && value != CU_BEZIER && value != CU_NURBS)
- return EXPP_ReturnIntError( PyExc_ValueError,
- "expected integer argument" );
-
- /* convert and raise error if impossible */
- if (convertspline(value, self->nurb))
- return EXPP_ReturnIntError( PyExc_ValueError,
- "Conversion Impossible" );
-
- return 0;
-}
-
-/*
- * CurNurb_getKnotsU
- *
- * returns curve's knotsU in a tuple. Empty tuple is returned if curve
- * isn't Nurbs or it doesn't have knots in U
- */
-
-static PyObject *CurNurb_getKnotsU( BPy_CurNurb * self )
-{
- if(self->nurb->knotsu) {
- int len = KNOTSU(self->nurb);
- int i;
- PyObject *knotsu = PyTuple_New(len);
- if( !knotsu )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "could not get CurNurb.knotsU attribute" );
-
- for(i = 0; i < len; ++i)
- PyTuple_SetItem(knotsu, i,
- PyFloat_FromDouble(self->nurb->knotsu[i]));
-
- return knotsu;
- }
- return PyTuple_New(0);
-}
-
-/*
- * CurNurb_getKnotsV
- *
- * returns curve's knotsV in a tuple. Empty tuple is returned if curve doesn't have knots in V
- */
-
-static PyObject *CurNurb_getKnotsV( BPy_CurNurb * self )
-{
- if(self->nurb->knotsv) {
- int len = KNOTSV(self->nurb);
- int i;
- PyObject *knotsv = PyTuple_New(len);
- if( !knotsv )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "could not get CurNurb.knotsV index" );
-
- for(i = 0; i < len; ++i)
- PyTuple_SetItem(knotsv, i,
- PyFloat_FromDouble(self->nurb->knotsv[i] ));
-
- return knotsv;
- }
- return PyTuple_New(0);
-}
-
-static PyObject *CurNurb_getPoints( BPy_CurNurb * self )
-{
- return PyInt_FromLong( ( long ) self->nurb->pntsu );
-}
-
-static PyObject *CurNurb_getFlagBits( BPy_CurNurb * self, void *type )
-{
- return EXPP_getBitfield( (void *)&self->nurb->flag,
- (int)type, 'h' );
-}
-
-static int CurNurb_setFlagBits( BPy_CurNurb * self, PyObject *value,
- void *type )
-{
- return EXPP_setBitfield( value, (void *)&self->nurb->flag,
- (int)type, 'h' );
-}
-
-/*
- * CurNurb_append( point )
- * append a new point to a nurb curve.
- * arg is BezTriple or list of xyzw floats
- */
-
-PyObject *CurNurb_append( BPy_CurNurb * self, PyObject * value )
-{
- return CurNurb_appendPointToNurb( self->nurb, value );
-}
-
-
-/*
- * CurNurb_appendPointToNurb
- * this is a non-bpy utility func to add a point to a given nurb.
- * notice the first arg is Nurb*.
- */
-
-PyObject *CurNurb_appendPointToNurb( Nurb * nurb, PyObject * value )
-{
-
- int i;
- int size;
- int npoints = nurb->pntsu;
-
- /*
- do we have a list of four floats or a BezTriple?
- */
-
- /* if curve is empty, adjust type depending on input type */
- if (nurb->bezt==NULL && nurb->bp==NULL) {
- if (BPy_BezTriple_Check( value ))
- nurb->type |= CU_BEZIER;
- else if (PySequence_Check( value ))
- nurb->type |= CU_NURBS;
- else
- return( EXPP_ReturnPyObjError( PyExc_TypeError,
- "Expected a BezTriple or a Sequence of 4 (or 5) floats" ) );
- }
-
-
-
- if ((nurb->type & 7)==CU_BEZIER) {
- BezTriple *tmp;
-
- if( !BPy_BezTriple_Check( value ) )
- return( EXPP_ReturnPyObjError( PyExc_TypeError,
- "Expected a BezTriple\n" ) );
-
-/* printf("\ndbg: got a BezTriple\n"); */
- tmp = nurb->bezt; /* save old points */
- nurb->bezt =
- ( BezTriple * ) MEM_mallocN( sizeof( BezTriple ) *
- ( npoints + 1 ),
- "CurNurb_append2" );
-
- if( !nurb->bezt )
- return ( EXPP_ReturnPyObjError
- ( PyExc_MemoryError, "allocation failed" ) );
-
- /* copy old points to new */
- if( tmp ) {
- memmove( nurb->bezt, tmp, sizeof( BezTriple ) * npoints );
- MEM_freeN( tmp );
- }
-
- nurb->pntsu++;
- /* add new point to end of list */
- memcpy( nurb->bezt + npoints,
- BezTriple_FromPyObject( value ), sizeof( BezTriple ) );
-
- }
- else if( PySequence_Check( value ) ) {
- size = PySequence_Size( value );
-/* printf("\ndbg: got a sequence of size %d\n", size ); */
- if( size == 4 || size == 5 ) {
- BPoint *tmp;
-
- tmp = nurb->bp; /* save old pts */
-
- nurb->bp =
- ( BPoint * ) MEM_mallocN( sizeof( BPoint ) *
- ( npoints + 1 ),
- "CurNurb_append1" );
- if( !nurb->bp )
- return ( EXPP_ReturnPyObjError
- ( PyExc_MemoryError,
- "allocation failed" ) );
-
- memmove( nurb->bp, tmp, sizeof( BPoint ) * npoints );
- if( tmp )
- MEM_freeN( tmp );
-
- ++nurb->pntsu;
- /* initialize new BPoint from old */
- memcpy( nurb->bp + npoints, nurb->bp,
- sizeof( BPoint ) );
-
- for( i = 0; i < 4; ++i ) {
- PyObject *item = PySequence_GetItem( value, i );
-
- if (item == NULL)
- return NULL;
-
-
- nurb->bp[npoints].vec[i] = ( float ) PyFloat_AsDouble( item );
- Py_DECREF( item );
- }
-
- if (size == 5) {
- PyObject *item = PySequence_GetItem( value, i );
-
- if (item == NULL)
- return NULL;
-
- nurb->bp[npoints].alfa = ( float ) PyFloat_AsDouble( item );
- Py_DECREF( item );
- }
- else {
- nurb->bp[npoints].alfa = 0.0f;
- }
-
- makeknots( nurb, 1, nurb->flagu >> 1 );
-
- } else {
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a sequence of 4 or 5 floats" );
- }
-
- } else {
- /* bail with error */
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a sequence of 4 or 5 floats" );
-
- }
-
- Py_RETURN_NONE;
-}
-
-
-/*
- * CurNurb_setMatIndex
- *
- * set index into material list
- */
-
-static int CurNurb_setMatIndex( BPy_CurNurb * self, PyObject * args )
-{
- printf ("%d\n", self->nurb->mat_nr);
- return EXPP_setIValueRange( args, &self->nurb->mat_nr, 0, 15, 'h' );
-}
-
-/*
- * CurNurb_getMatIndex
- *
- * returns index into material list
- */
-
-static PyObject *CurNurb_getMatIndex( BPy_CurNurb * self )
-{
- PyObject *index = PyInt_FromLong( ( long ) self->nurb->mat_nr );
-
- if( index )
- return index;
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "could not get material index" );
-}
-
-/*
- * CurNurb_getFlagU
- *
- * returns curve's flagu
- */
-
-static PyObject *CurNurb_getFlagU( BPy_CurNurb * self )
-{
- PyObject *flagu = PyInt_FromLong( ( long ) self->nurb->flagu );
-
- if( flagu )
- return flagu;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "could not get CurNurb.flagu index" ) );
-}
-
-/*
- * CurNurb_setFlagU
- *
- * set curve's flagu and recalculate the knots
- *
- * Possible values: 0 - uniform, 2 - endpoints, 4 - bezier
- * bit 0 controls CU_CYCLIC
- */
-
-static int CurNurb_setFlagU( BPy_CurNurb * self, PyObject * args )
-{
- PyObject* integer = PyNumber_Int( args );
- short value;
-
- if( !integer )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected integer argument" );
-
- value = ( short )PyInt_AS_LONG( integer );
- Py_DECREF( integer );
-
- if( value < 0 || value > 5 )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "expected integer argument in range [0,5]" );
-
- if( self->nurb->flagu != value ) {
- self->nurb->flagu = (short)value;
- makeknots( self->nurb, 1, self->nurb->flagu >> 1 );
- }
-
- return 0;
-}
-
-/*
- * CurNurb_getFlagV
- *
- * returns curve's flagu
- */
-
-static PyObject *CurNurb_getFlagV( BPy_CurNurb * self )
-{
- PyObject *flagv = PyInt_FromLong( ( long ) self->nurb->flagv );
-
- if( flagv )
- return flagv;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "could not get CurNurb.flagv" ) );
-}
-
-/*
- * CurNurb_setFlagV
- *
- * set curve's flagu and recalculate the knots
- *
- * Possible values: 0 - uniform, 1 - endpoints, 2 - bezier
- */
-
-static int CurNurb_setFlagV( BPy_CurNurb * self, PyObject * args )
-{
- PyObject* integer = PyNumber_Int( args );
- short value;
-
- if( !integer )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected integer argument" );
-
- value = ( short )PyInt_AS_LONG( integer );
- Py_DECREF( integer );
-
- if( value < 0 || value > 5 )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "expected integer argument in range [0,5]" );
-
- if( self->nurb->flagv != value ) {
- self->nurb->flagv = (short)value;
- makeknots( self->nurb, 2, self->nurb->flagv >> 1 );
- }
-
- return 0;
-}
-
-/*
- * CurNurb_getIter
- *
- * create an iterator for our CurNurb.
- * this iterator returns the points for this CurNurb.
- */
-
-static PyObject *CurNurb_getIter( BPy_CurNurb * self )
-{
- self->bp = self->nurb->bp;
- self->bezt = self->nurb->bezt;
- self->atEnd = 0;
- self->nextPoint = 0;
-
- /* set exhausted flag if both bp and bezt are zero */
- if( ( !self->bp ) && ( !self->bezt ) )
- self->atEnd = 1;
-
- Py_INCREF( self );
- return ( PyObject * ) self;
-}
-
-
-static PyObject *CurNurb_iterNext( BPy_CurNurb * self )
-{
- PyObject *po; /* return value */
- Nurb *pnurb = self->nurb;
- int npoints = pnurb->pntsu;
-
- /* are we at end already? */
- if( self->atEnd )
- return ( EXPP_ReturnPyObjError( PyExc_StopIteration,
- "iterator at end" ) );
-
- if( self->nextPoint < npoints ) {
-
- po = CurNurb_pointAtIndex( self->nurb, self->nextPoint );
- self->nextPoint++;
-
- return po;
-
- } else {
- self->atEnd = 1; /* set flag true */
- }
-
- return ( EXPP_ReturnPyObjError( PyExc_StopIteration,
- "iterator at end" ) );
-}
-
-
-
-/*
- * CurNurb_isNurb()
- * test whether spline nurb or bezier
- */
-
-static PyObject *CurNurb_isNurb( BPy_CurNurb * self )
-{
- /* NOTE: a Nurb has bp and bezt pointers
- * depending on type.
- * It is possible both are NULL if no points exist.
- * in that case, we return False
- */
-
- if( self->nurb->bp ) {
- Py_RETURN_TRUE;
- } else {
- Py_RETURN_FALSE;
- }
-}
-
-/*
- * CurNurb_isCyclic()
- * test whether spline cyclic (closed) or not (open)
- */
-
-static PyObject *CurNurb_isCyclic( BPy_CurNurb * self )
-{
- /* supposing that the flagu is always set */
-
- if( self->nurb->flagu & CU_CYCLIC ) {
- Py_RETURN_TRUE;
- } else {
- Py_RETURN_FALSE;
- }
-}
-
-/*
- * CurNurb_length
- * returns the number of points in a Nurb
- * this is a tp_as_sequence method, not a regular instance method.
- */
-
-static int CurNurb_length( PyInstanceObject * inst )
-{
- Nurb *nurb;
- int len;
-
- if( BPy_CurNurb_Check( ( PyObject * ) inst ) ) {
- nurb = ( ( BPy_CurNurb * ) inst )->nurb;
- len = nurb->pntsu;
- return len;
- }
-
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "arg is not a BPy_CurNurb" );
-}
-
-/*
- * CurNurb_getPoint
- * returns the Nth point in a Nurb
- * this is one of the tp_as_sequence methods, hence the int N argument.
- * it is called via the [] operator, not as a usual instance method.
- */
-
-PyObject *CurNurb_getPoint( BPy_CurNurb * self, int index )
-{
- Nurb *myNurb;
-
- int npoints;
-
- /* for convenince */
- myNurb = self->nurb;
- npoints = myNurb->pntsu;
-
- /* DELETED: bail if index < 0 */
- /* actually, this check is not needed since python treats */
- /* negative indices as starting from the right end of a sequence */
- /*
- THAT IS WRONG, when passing a negative index, python adjusts it to be positive
- BUT it can still overflow in the negatives if the index is too small.
- For example, list[-6] when list contains 5 items means index = -1 in here.
- (theeth)
- */
-
- /* bail if no Nurbs in Curve */
- if( npoints == 0 )
- return ( EXPP_ReturnPyObjError( PyExc_IndexError,
- "no points in this CurNurb" ) );
-
- /* check index limits */
- if( index >= npoints || index < 0 )
- return ( EXPP_ReturnPyObjError( PyExc_IndexError,
- "index out of range" ) );
-
- return CurNurb_pointAtIndex( myNurb, index );
-}
-
-/*
- * CurNurb_setPoint
- * modifies the Nth point in a Nurb
- * this is one of the tp_as_sequence methods, hence the int N argument.
- * it is called via the [] = operator, not as a usual instance method.
- */
-static int CurNurb_setPoint( BPy_CurNurb * self, int index, PyObject * pyOb )
-{
- Nurb *nurb = self->nurb;
- int size;
-
- /* check index limits */
- if( index < 0 || index >= nurb->pntsu )
- return EXPP_ReturnIntError( PyExc_IndexError,
- "array assignment index out of range" );
-
-
- /* branch by curve type */
- if ((nurb->type & 7)==CU_BEZIER) { /* BEZIER */
- /* check parameter type */
- if( !BPy_BezTriple_Check( pyOb ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a BezTriple" );
-
- /* copy bezier in array */
- memcpy( nurb->bezt + index,
- BezTriple_FromPyObject( pyOb ), sizeof( BezTriple ) );
-
- return 0; /* finished correctly */
- }
- else { /* NURBS or POLY */
- int i;
-
- /* check parameter type */
- if (!PySequence_Check( pyOb ))
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a list of 4 (or optionally 5 if the curve is 3D) floats" );
-
- size = PySequence_Size( pyOb );
-
- /* check sequence size */
- if( size != 4 && size != 5 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a list of 4 (or optionally 5 if the curve is 3D) floats" );
-
- /* copy x, y, z, w */
- for( i = 0; i < 4; ++i ) {
- PyObject *item = PySequence_GetItem( pyOb, i );
-
- if (item == NULL)
- return -1;
-
- nurb->bp[index].vec[i] = ( float ) PyFloat_AsDouble( item );
- Py_DECREF( item );
- }
-
- if (size == 5) { /* set tilt, if present */
- PyObject *item = PySequence_GetItem( pyOb, i );
-
- if (item == NULL)
- return -1;
-
- nurb->bp[index].alfa = ( float ) PyFloat_AsDouble( item );
- Py_DECREF( item );
- }
- else { /* if not, set default */
- nurb->bp[index].alfa = 0.0f;
- }
-
- return 0; /* finished correctly */
- }
-}
-
-
-/*
- * this is an internal routine. not callable directly from python
- */
-
-PyObject *CurNurb_pointAtIndex( Nurb * nurb, int index )
-{
- PyObject *pyo;
-
- if( nurb->bp ) { /* we have a nurb curve */
- int i;
-
- /* add Tilt only if curve is 3D */
- if (nurb->flag & CU_3D)
- pyo = PyList_New( 5 );
- else
- pyo = PyList_New( 4 );
-
- for( i = 0; i < 4; i++ ) {
- PyList_SetItem( pyo, i,
- PyFloat_FromDouble( nurb->bp[index].vec[i] ) );
- }
-
- /* add Tilt only if curve is 3D */
- if (nurb->flag & CU_3D)
- PyList_SetItem( pyo, 4, PyFloat_FromDouble( nurb->bp[index].alfa ) );
-
- } else if( nurb->bezt ) { /* we have a bezier */
- /* if an error occurs, we just pass it on */
- pyo = BezTriple_CreatePyObject( &( nurb->bezt[index] ) );
-
- } else /* something is horribly wrong */
- /* neither bp or bezt is set && pntsu != 0 */
- return EXPP_ReturnPyObjError( PyExc_SystemError,
- "inconsistant structure found" );
-
- return pyo;
-}
-
-/*
- dump nurb
-*/
-
-PyObject *CurNurb_dump( BPy_CurNurb * self )
-{
- BPoint *bp = NULL;
- BezTriple *bezt = NULL;
- Nurb *nurb = self->nurb;
- int npoints = 0;
-
- if( !self->nurb )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "no Nurb in this CurNurb");
-
- printf(" type: %d, mat_nr: %d hide: %d flag: %d",
- nurb->type, nurb->mat_nr, nurb->hide, nurb->flag);
- printf("\n pntsu: %d, pntsv: %d, resolu: %d resolv: %d",
- nurb->pntsu, nurb->pntsv, nurb->resolu, nurb->resolv );
- printf("\n orderu: %d orderv: %d", nurb->orderu, nurb->orderv );
- printf("\n flagu: %d flagv: %d",
- nurb->flagu, nurb->flagv );
-
- npoints = nurb->pntsu;
-
- if( nurb->bp ) { /* we have a BPoint */
- int n;
- for( n = 0, bp = nurb->bp;
- n < npoints;
- n++, bp++ )
- {
- /* vec[4] */
- printf( "\ncoords[%d]: ", n);
- {
- int i;
- for( i = 0; i < 4; i++){
- printf("%10.3f ", bp->vec[i] );
- }
- }
-
- /* alfa, s[2] */
- printf("\n alpha: %5.2f", bp->alfa);
- /* f1, hide */
- printf(" f1 %d hide %d", bp->f1, bp->hide );
- printf("\n");
- }
- }
- else { /* we have a BezTriple */
- int n;
- for( n = 0, bezt = nurb->bezt;
- n < npoints;
- n++, bezt++ )
- {
- int i, j;
- printf("\npoint %d: ", n);
- for( i = 0; i < 3; i++ ) {
- printf("\nvec[%i] ",i );
- for( j = 0; j < 3; j++ ) {
- printf(" %5.2f ", bezt->vec[i][j] );
- }
- }
-
-
- }
- printf("\n");
- }
-
- Py_RETURN_NONE;
-}
-
-/*
- recalc nurb
-*/
-
-static PyObject *CurNurb_recalc( BPy_CurNurb * self )
-{
- calchandlesNurb ( self->nurb );
- Py_RETURN_NONE;
-}
-
-PyObject *CurNurb_switchDirection( BPy_CurNurb * self )
-{
- if( !self->nurb )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "no Nurb in this CurNurb");
-
- switchdirectionNurb( self->nurb );
-
- Py_RETURN_NONE;
-}
-
-PyObject *CurNurb_Init( void )
-{
- if( PyType_Ready( &CurNurb_Type ) < 0)
- return NULL;
-
- return Py_InitModule3( "Blender.CurNurb", M_CurNurb_methods,
- M_CurNurb_doc );
-}
-
-/* #####DEPRECATED###### */
-
-static PyObject *CurNurb_oldsetType( BPy_CurNurb * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)CurNurb_setType );
-}
-
-static PyObject *CurNurb_oldsetMatIndex( BPy_CurNurb * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)CurNurb_setMatIndex );
-}
-
-static PyObject *CurNurb_oldsetFlagU( BPy_CurNurb * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)CurNurb_setFlagU );
-}
-
-static PyObject *CurNurb_oldsetFlagV( BPy_CurNurb * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)CurNurb_setFlagV );
-}
diff --git a/source/blender/python/api2_2x/CurNurb.h b/source/blender/python/api2_2x/CurNurb.h
deleted file mode 100644
index f7c50c41bb9..00000000000
--- a/source/blender/python/api2_2x/CurNurb.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * $Id: CurNurb.h 10269 2007-03-15 01:09:14Z campbellbarton $
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Stephen Swaney
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#ifndef EXPP_NURB_H
-#define EXPP_NURB_H
-
-#include <Python.h>
-#include "DNA_curve_types.h"
-
-extern PyTypeObject CurNurb_Type;
-
-#define BPy_CurNurb_Check(v) ((v)->ob_type == &CurNurb_Type) /* for type checking */
-
-/* Python BPy_CurNurb structure definition */
-typedef struct {
- PyObject_HEAD /* required py macro */
- Nurb * nurb; /* pointer to Blender data */
-
- /* iterator stuff */
- /* internal ptrs to point data. do not free */
- BPoint *bp;
- BezTriple *bezt;
- int atEnd; /* iter exhausted flag */
- int nextPoint;
-
-} BPy_CurNurb;
-
-
-/*
- * prototypes
- */
-
-PyObject *CurNurb_Init( void );
-PyObject *CurNurb_CreatePyObject( Nurb * bzt );
-Nurb *CurNurb_FromPyObject( PyObject * pyobj );
-
-PyObject *CurNurb_getPoint( BPy_CurNurb * self, int index );
-PyObject *CurNurb_pointAtIndex( Nurb * nurb, int index );
-
-PyObject *CurNurb_appendPointToNurb( Nurb * nurb, PyObject * args );
-
-#endif /* EXPP_NURB_H */
diff --git a/source/blender/python/api2_2x/Curve.c b/source/blender/python/api2_2x/Curve.c
deleted file mode 100644
index e96e25c25d8..00000000000
--- a/source/blender/python/api2_2x/Curve.c
+++ /dev/null
@@ -1,1696 +0,0 @@
-/*
- * $Id: Curve.c 12752 2007-12-01 23:25:00Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Jacques Guignot, Stephen Swaney
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include "Curve.h" /*This must come first*/
-
-#include "BLI_blenlib.h"
-#include "BKE_main.h"
-#include "BKE_displist.h"
-#include "BKE_global.h"
-#include "BKE_library.h"
-#include "BKE_curve.h"
-#include "BKE_material.h"
-#include "MEM_guardedalloc.h" /* because we wil be mallocing memory */
-#include "CurNurb.h"
-#include "SurfNurb.h"
-#include "Material.h"
-#include "Object.h"
-#include "Key.h"
-#include "gen_utils.h"
-#include "gen_library.h"
-#include "mydevice.h"
-
-
-/*****************************************************************************/
-/* The following string definitions are used for documentation strings. */
-/* In Python these will be written to the console when doing a */
-/* Blender.Curve.__doc__ */
-/*****************************************************************************/
-
-char M_Curve_doc[] = "The Blender Curve module\n\n\
-This module provides access to **Curve Data** in Blender.\n\
-Functions :\n\
- New(opt name) : creates a new curve object with the given name (optional)\n\
- Get(name) : retreives a curve with the given name (mandatory)\n\
- get(name) : same as Get. Kept for compatibility reasons";
-char M_Curve_New_doc[] = "";
-char M_Curve_Get_doc[] = "xxx";
-
-
-
-/*****************************************************************************/
-/* Python API function prototypes for the Curve module. */
-/*****************************************************************************/
-static PyObject *M_Curve_New( PyObject * self, PyObject * args );
-static PyObject *M_Curve_Get( PyObject * self, PyObject * args );
-
-
-/*****************************************************************************/
-/* Python BPy_Curve instance methods declarations: */
-/*****************************************************************************/
-
-static PyObject *Curve_getPathLen( BPy_Curve * self );
-static PyObject *Curve_setPathLen( BPy_Curve * self, PyObject * args );
-static PyObject *Curve_getTotcol( BPy_Curve * self );
-static PyObject *Curve_setTotcol( BPy_Curve * self, PyObject * args );
-#if 0
-PyObject *Curve_getResolu( BPy_Curve * self );
-PyObject *Curve_setResolu( BPy_Curve * self, PyObject * args );
-PyObject *Curve_getResolv( BPy_Curve * self );
-PyObject *Curve_setResolv( BPy_Curve * self, PyObject * args );
-PyObject *Curve_getWidth( BPy_Curve * self );
-PyObject *Curve_setWidth( BPy_Curve * self, PyObject * args );
-PyObject *Curve_getExt1( BPy_Curve * self );
-PyObject *Curve_setExt1( BPy_Curve * self, PyObject * args );
-PyObject *Curve_getExt2( BPy_Curve * self );
-PyObject *Curve_setExt2( BPy_Curve * self, PyObject * args );
-#endif
-static PyObject *Curve_getControlPoint( BPy_Curve * self, PyObject * args );
-static PyObject *Curve_setControlPoint( BPy_Curve * self, PyObject * args );
-static PyObject *Curve_getLoc( BPy_Curve * self );
-static PyObject *Curve_setLoc( BPy_Curve * self, PyObject * args );
-static PyObject *Curve_getRot( BPy_Curve * self );
-static PyObject *Curve_setRot( BPy_Curve * self, PyObject * args );
-static PyObject *Curve_getSize( BPy_Curve * self );
-static PyObject *Curve_setSize( BPy_Curve * self, PyObject * args );
-static PyObject *Curve_getNumCurves( BPy_Curve * self );
-static PyObject *Curve_getKey( BPy_Curve * self );
-static PyObject *Curve_isNurb( BPy_Curve * self, PyObject * args );
-static PyObject *Curve_isCyclic( BPy_Curve * self, PyObject * args);
-static PyObject *Curve_getNumPoints( BPy_Curve * self, PyObject * args );
-
-static PyObject *Curve_appendPoint( BPy_Curve * self, PyObject * args );
-static PyObject *Curve_appendNurb( BPy_Curve * self, PyObject * args );
-
-static PyObject *Curve_getMaterials( BPy_Curve * self );
-
-static PyObject *Curve_getBevOb( BPy_Curve * self );
-static PyObject *Curve_setBevOb( BPy_Curve * self, PyObject * args );
-
-static PyObject *Curve_getTaperOb( BPy_Curve * self );
-static PyObject *Curve_setTaperOb( BPy_Curve * self, PyObject * args );
-static PyObject *Curve_copy( BPy_Curve * self );
-
-static PyObject *Curve_getIter( BPy_Curve * self );
-static PyObject *Curve_iterNext( BPy_Curve * self );
-
-PyObject *Curve_getNurb( BPy_Curve * self, int n );
-static int Curve_setNurb( BPy_Curve * self, int n, PyObject * value );
-static int Curve_length( PyInstanceObject * inst );
-
-
-struct chartrans *text_to_curve( Object * ob, int mode );
-/*****************************************************************************/
-/* Python BPy_Curve methods: */
-/* gives access to */
-/* name, pathlen totcol flag bevresol */
-/* resolu resolv width ext1 ext2 */
-/* controlpoint loc rot size */
-/* numpts */
-/*****************************************************************************/
-
-
-PyObject *Curve_getName( BPy_Curve * self )
-{
- return PyString_FromString( self->curve->id.name + 2 );
-}
-
-static int Curve_newsetName( BPy_Curve * self, PyObject * args )
-{
- char *name;
-
- name = PyString_AsString( args );
- if( !name )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected string argument" );
-
- rename_id( &self->curve->id, name ); /* proper way in Blender */
- Curve_update( self );
-
- return 0;
-}
-
-static PyObject *Curve_getPathLen( BPy_Curve * self )
-{
- return PyInt_FromLong( ( long ) self->curve->pathlen );
-}
-
-
-static int Curve_newsetPathLen( BPy_Curve * self, PyObject * args )
-{
- PyObject *num;
-
- if( !PyNumber_Check( args ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected int argument" );
-
- num = PyNumber_Int( args );
- self->curve->pathlen = (short)PyInt_AS_LONG( num );
- Py_DECREF( num );
-
- return 0;
-}
-
-static PyObject *Curve_getTotcol( BPy_Curve * self )
-{
- return PyInt_FromLong( ( long ) self->curve->totcol );
-}
-
-
-PyObject *Curve_getMode( BPy_Curve * self )
-{
- return PyInt_FromLong( ( long ) self->curve->flag );
-}
-
-
-static int Curve_newsetMode( BPy_Curve * self, PyObject * args )
-{
- PyObject *num;
-
- if( !PyNumber_Check( args ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected int argument" );
-
- num = PyNumber_Int( args );
- self->curve->flag = (short)PyInt_AS_LONG( num );
- Py_DECREF( num );
-
- return 0;
-}
-
-PyObject *Curve_getBevresol( BPy_Curve * self )
-{
- return PyInt_FromLong( ( long ) self->curve->bevresol );
-}
-
-static int Curve_newsetBevresol( BPy_Curve * self, PyObject * args )
-{
- short value;
- PyObject *num;
-
- if( !PyNumber_Check( args ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected int argument" );
-
- num = PyNumber_Int( args );
- value = (short)PyInt_AS_LONG( num );
- Py_DECREF( num );
-
- if( value > 10 || value < 0 )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "acceptable values are between 0 and 10" );
-
- self->curve->bevresol = value;
- return 0;
-}
-
-
-PyObject *Curve_getResolu( BPy_Curve * self )
-{
- return PyInt_FromLong( ( long ) self->curve->resolu );
-}
-
-
-static int Curve_newsetResolu( BPy_Curve * self, PyObject * args )
-{
- short value;
- Nurb *nu;
- PyObject *num;
-
- if( !PyNumber_Check( args ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected int argument" );
-
- num = PyNumber_Int( args );
- value = (short)PyInt_AS_LONG( num );
- Py_DECREF( num );
-
- if( value > 128 || value < 1 )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "acceptable values are between 1 and 128" );
-
- self->curve->resolu = value;
- /* propagate the change through all the curves */
- for( nu = self->curve->nurb.first; nu; nu = nu->next )
- nu->resolu = value;
-
- return 0;
-}
-
-PyObject *Curve_getResolv( BPy_Curve * self )
-{
- return PyInt_FromLong( ( long ) self->curve->resolv );
-}
-
-static int Curve_newsetResolv( BPy_Curve * self, PyObject * args )
-{
- short value;
- PyObject *num;
-
- if( !PyNumber_Check( args ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected int argument" );
-
- num = PyNumber_Int( args );
- value = (short)PyInt_AS_LONG( num );
- Py_DECREF( num );
-
- if(value > 128 || value < 1)
- return EXPP_ReturnIntError( PyExc_ValueError,
- "acceptable values are between 1 and 128" );
- self->curve->resolv = value;
-
- return 0;
-}
-
-PyObject *Curve_getWidth( BPy_Curve * self )
-{
- return PyFloat_FromDouble( ( double ) self->curve->width );
-}
-
-
-static int Curve_newsetWidth( BPy_Curve * self, PyObject * args )
-{
- float value;
- PyObject *num;
-
- if( !PyNumber_Check( args ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected float argument" );
-
- num = PyNumber_Float( args );
- value = (float)PyFloat_AS_DOUBLE( num );
- Py_DECREF( num );
-
- if(value > 2.0f || value < 0.0f)
- return EXPP_ReturnIntError( PyExc_ValueError,
- "acceptable values are between 2.0 and 0.0" );
- self->curve->width = value;
-
- return 0;
-}
-
-
-PyObject *Curve_getExt1( BPy_Curve * self )
-{
- return PyFloat_FromDouble( ( double ) self->curve->ext1 );
-}
-
-
-static int Curve_newsetExt1( BPy_Curve * self, PyObject * args )
-{
- float value;
- PyObject *num;
-
- if( !PyNumber_Check( args ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected float argument" );
-
- num = PyNumber_Float( args );
- value = (float)PyFloat_AS_DOUBLE( num );
- Py_DECREF( num );
-
- if(value > 100.0f || value < 0.0f)
- return EXPP_ReturnIntError( PyExc_ValueError,
- "acceptable values are between 0.0 and 100.0" );
- self->curve->ext1 = value;
-
- return 0;
-}
-
-PyObject *Curve_getExt2( BPy_Curve * self )
-{
- return PyFloat_FromDouble( ( double ) self->curve->ext2 );
-}
-
-
-static int Curve_newsetExt2( BPy_Curve * self, PyObject * args )
-{
- float value;
- PyObject *num;
-
- if( !PyNumber_Check( args ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected float argument" );
-
- num = PyNumber_Float( args );
- value = (float)PyFloat_AS_DOUBLE( num );
- Py_DECREF( num );
-
- if(value > 2.0f || value < 0.0f)
- return EXPP_ReturnIntError( PyExc_ValueError,
- "acceptable values are between 0.0 and 2.0" );
- self->curve->ext2 = value;
-
- return 0;
-}
-
-/*
- * Curve_setControlPoint
- * this function sets an EXISTING control point.
- * it does NOT add a new one.
- */
-
-static PyObject *Curve_setControlPoint( BPy_Curve * self, PyObject * args )
-{
- PyObject *listargs = 0;
- Nurb *ptrnurb = self->curve->nurb.first;
- int numcourbe = 0, numpoint = 0, i, j;
-
- if( !ptrnurb )
- Py_RETURN_NONE;
-
- if( ptrnurb->bp )
- if( !PyArg_ParseTuple
- ( args, "iiO", &numcourbe, &numpoint, &listargs ) )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError,
- "expected int, int, list arguments" ) );
- if( ptrnurb->bezt )
- if( !PyArg_ParseTuple
- ( args, "iiO", &numcourbe, &numpoint, &listargs ) )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError,
- "expected int, int, list arguments" ) );
-
- for( i = 0; i < numcourbe; i++ )
- ptrnurb = ptrnurb->next;
-
- if( ptrnurb->bp )
- for( i = 0; i < 4; i++ )
- ptrnurb->bp[numpoint].vec[i] =
- (float)PyFloat_AsDouble( PyList_GetItem ( listargs, i ) );
-
- if( ptrnurb->bezt )
- for( i = 0; i < 3; i++ )
- for( j = 0; j < 3; j++ )
- ptrnurb->bezt[numpoint].vec[i][j] =
- (float)PyFloat_AsDouble( PyList_GetItem
- ( listargs,
- i * 3 + j ) );
-
- Py_RETURN_NONE;
-}
-
-
-static PyObject *Curve_getControlPoint( BPy_Curve * self, PyObject * args )
-{
- PyObject *liste;
- PyObject *item;
-
- Nurb *ptrnurb;
- int i, j;
- /* input args: requested curve and point number on curve */
- int numcourbe, numpoint;
-
- if( !PyArg_ParseTuple( args, "ii", &numcourbe, &numpoint ) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int int arguments" ) );
- if( ( numcourbe < 0 ) || ( numpoint < 0 ) )
- return ( EXPP_ReturnPyObjError( PyExc_ValueError,
- "arguments must be non-negative" ) );
-
- /* if no nurbs in this curve obj */
- if( !self->curve->nurb.first )
- return PyList_New( 0 );
-
- /* walk the list of nurbs to find requested numcourbe */
- ptrnurb = self->curve->nurb.first;
- for( i = 0; i < numcourbe; i++ ) {
- ptrnurb = ptrnurb->next;
- if( !ptrnurb ) /* if zero, we ran just ran out of curves */
- return ( EXPP_ReturnPyObjError( PyExc_ValueError,
- "curve index out of range" ) );
- }
-
- /* check numpoint param against pntsu */
- if( numpoint >= ptrnurb->pntsu )
- return ( EXPP_ReturnPyObjError( PyExc_ValueError,
- "point index out of range" ) );
-
- liste = PyList_New( 0 );
- if( ptrnurb->bp ) { /* if we are a nurb curve, you get 4 values */
- for( i = 0; i < 4; i++ ) {
- item = PyFloat_FromDouble( ptrnurb->bp[numpoint].vec[i] );
- PyList_Append( liste, item );
- Py_DECREF(item);
- }
- } else if( ptrnurb->bezt ) { /* if we are a bezier, you get 9 values */
- for( i = 0; i < 3; i++ )
- for( j = 0; j < 3; j++ ) {
- item = PyFloat_FromDouble( ptrnurb->bezt[numpoint].vec[i][j] );
- PyList_Append( liste, item );
- Py_DECREF(item);
- }
- }
-
- return liste;
-}
-
-static PyObject *Curve_getLoc( BPy_Curve * self )
-{
- return Py_BuildValue( "[f,f,f]", self->curve->loc[0],
- self->curve->loc[1], self->curve->loc[2] );
-}
-
-static int Curve_newsetLoc( BPy_Curve * self, PyObject * args )
-{
- float loc[3];
- int i;
-
- if( ( !PyList_Check( args ) && !PyTuple_Check( args ) ) ||
- PySequence_Size( args ) != 3 ) {
-TypeError:
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a sequence of three floats" );
- }
-
- for( i = 0; i < 3; i++ ) {
- PyObject *item = PySequence_GetItem( args, i );
- PyObject *num = PyNumber_Float( item );
- Py_DECREF( item );
- if( !num )
- goto TypeError;
- loc[i] = PyFloat_AS_DOUBLE( num );
- Py_DECREF( num );
- }
- memcpy( self->curve->loc, loc, sizeof( loc ) );
-
- return 0;
-}
-
-static PyObject *Curve_getRot( BPy_Curve * self )
-{
- return Py_BuildValue( "[f,f,f]", self->curve->rot[0],
- self->curve->rot[1], self->curve->rot[2] );
-}
-
-static int Curve_newsetRot( BPy_Curve * self, PyObject * args )
-{
- float rot[3];
- int i;
-
- if( ( !PyList_Check( args ) && !PyTuple_Check( args ) ) ||
- PySequence_Size( args ) != 3 ) {
-TypeError:
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a sequence of three floats" );
- }
-
- for( i = 0; i < 3; i++ ) {
- PyObject *item = PySequence_GetItem( args, i );
- PyObject *num = PyNumber_Float( item );
- Py_DECREF( item );
- if( !num )
- goto TypeError;
- rot[i] = PyFloat_AS_DOUBLE( num );
- Py_DECREF( num );
- }
- memcpy( self->curve->rot, rot, sizeof( rot ) );
-
- return 0;
-}
-
-static PyObject *Curve_getSize( BPy_Curve * self )
-{
- return Py_BuildValue( "[f,f,f]", self->curve->size[0],
- self->curve->size[1], self->curve->size[2] );
-}
-
-static int Curve_newsetSize( BPy_Curve * self, PyObject * args )
-{
- float size[3];
- int i;
-
- if( ( !PyList_Check( args ) && !PyTuple_Check( args ) ) ||
- PySequence_Size( args ) != 3 ) {
-TypeError:
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a sequence of three floats" );
- }
-
- for( i = 0; i < 3; i++ ) {
- PyObject *item = PySequence_GetItem( args, i );
- PyObject *num = PyNumber_Float( item );
- Py_DECREF( item );
- if( !num )
- goto TypeError;
- size[i] = PyFloat_AS_DOUBLE( num );
- Py_DECREF( num );
- }
- memcpy( self->curve->size, size, sizeof( size ) );
-
- return 0;
-}
-
-/*
- * Count the number of splines in a Curve Object
- * int getNumCurves()
- */
-
-static PyObject *Curve_getNumCurves( BPy_Curve * self )
-{
- Nurb *ptrnurb;
- PyObject *ret_val;
- int num_curves = 0; /* start with no splines */
-
- /* get curve */
- ptrnurb = self->curve->nurb.first;
- if( ptrnurb ) { /* we have some nurbs in this curve */
- for(;;) {
- ++num_curves;
- ptrnurb = ptrnurb->next;
- if( !ptrnurb ) /* no more curves */
- break;
- }
- }
-
- ret_val = PyInt_FromLong( ( long ) num_curves );
-
- if( ret_val )
- return ret_val;
-
- /* oops! */
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get number of curves" );
-}
-
-/*
- * get the key object linked to this curve
- */
-
-static PyObject *Curve_getKey( BPy_Curve * self )
-{
- PyObject *keyObj;
-
- if (self->curve->key)
- keyObj = Key_CreatePyObject(self->curve->key);
- else keyObj = EXPP_incr_ret(Py_None);
-
- return keyObj;
-}
-
-/*
- * count the number of points in a given spline
- * int getNumPoints( curve_num=0 )
- *
- */
-
-static PyObject *Curve_getNumPoints( BPy_Curve * self, PyObject * args )
-{
- Nurb *ptrnurb;
- PyObject *ret_val;
- int curve_num = 0; /* default spline number */
- int i;
-
- /* parse input arg */
- if( !PyArg_ParseTuple( args, "|i", &curve_num ) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int argument" ) );
-
- /* check arg - must be non-negative */
- if( curve_num < 0 )
- return ( EXPP_ReturnPyObjError( PyExc_ValueError,
- "argument must be non-negative" ) );
-
-
- /* walk the list of curves looking for our curve */
- ptrnurb = self->curve->nurb.first;
- if( !ptrnurb ) { /* no splines in this Curve */
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "no splines in this Curve" ) );
- }
-
- for( i = 0; i < curve_num; i++ ) {
- ptrnurb = ptrnurb->next;
- if( !ptrnurb ) /* if zero, we ran just ran out of curves */
- return ( EXPP_ReturnPyObjError( PyExc_ValueError,
- "curve index out of range" ) );
- }
-
- /* pntsu is the number of points in curve */
- ret_val = PyInt_FromLong( ( long ) ptrnurb->pntsu );
-
- if( ret_val )
- return ret_val;
-
- /* oops! */
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get number of points for curve" );
-}
-
-/*
- * Test whether a given spline of a Curve is a nurb
- * as opposed to a bezier
- * int isNurb( curve_num=0 )
- */
-
-static PyObject *Curve_isNurb( BPy_Curve * self, PyObject * args )
-{
- int curve_num = 0; /* default value */
- int is_nurb;
- Nurb *ptrnurb;
- PyObject *ret_val;
- int i;
-
- /* parse and check input args */
- if( !PyArg_ParseTuple( args, "|i", &curve_num ) ) {
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int argument" ) );
- }
- if( curve_num < 0 ) {
- return ( EXPP_ReturnPyObjError( PyExc_ValueError,
- "curve number must be non-negative" ) );
- }
-
- ptrnurb = self->curve->nurb.first;
-
- if( !ptrnurb ) /* no splines in this curve */
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "no splines in this Curve" ) );
-
- for( i = 0; i < curve_num; i++ ) {
- ptrnurb = ptrnurb->next;
- if( !ptrnurb ) /* if zero, we ran just ran out of curves */
- return ( EXPP_ReturnPyObjError( PyExc_ValueError,
- "curve index out of range" ) );
- }
-
- /* right now, there are only two curve types, nurb and bezier. */
- is_nurb = ptrnurb->bp ? 1 : 0;
-
- ret_val = PyInt_FromLong( ( long ) is_nurb );
- if( ret_val )
- return ret_val;
-
- /* oops */
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get curve type" ) );
-}
-
-/* trying to make a check for closedness (cyclic), following on isNurb (above)
- copy-pasting done by antont@kyperjokki.fi */
-
-static PyObject *Curve_isCyclic( BPy_Curve * self, PyObject * args )
-{
- int curve_num = 0; /* default value */
- /* unused:*/
- /* int is_cyclic;
- * PyObject *ret_val;*/
- Nurb *ptrnurb;
- int i;
-
- /* parse and check input args */
- if( !PyArg_ParseTuple( args, "|i", &curve_num ) ) {
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int argument" ) );
- }
- if( curve_num < 0 ) {
- return ( EXPP_ReturnPyObjError( PyExc_ValueError,
- "curve number must be non-negative" ) );
- }
-
- ptrnurb = self->curve->nurb.first;
-
- if( !ptrnurb ) /* no splines in this curve */
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "no splines in this Curve" ) );
-
- for( i = 0; i < curve_num; i++ ) {
- ptrnurb = ptrnurb->next;
- if( !ptrnurb ) /* if zero, we ran just ran out of curves */
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "curve index out of range" ) );
- }
-
- if( ptrnurb->flagu & CU_CYCLIC ){
- return EXPP_incr_ret_True();
- } else {
- return EXPP_incr_ret_False();
- }
-}
-
-
-/*
- * Curve_appendPoint( numcurve, new_point )
- * append a new point to indicated spline
- */
-
-static PyObject *Curve_appendPoint( BPy_Curve * self, PyObject * args )
-{
- int i;
- int nurb_num; /* index of curve we append to */
- PyObject *coord_args; /* coords for new point */
- Nurb *nurb = self->curve->nurb.first; /* first nurb in Curve */
-
-/* fixme - need to malloc new Nurb */
- if( !nurb )
- return ( EXPP_ReturnPyObjError
- ( PyExc_AttributeError, "no nurbs in this Curve" ) );
-
- if( !PyArg_ParseTuple( args, "iO", &nurb_num, &coord_args ) )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError,
- "expected int, coords as arguments" ) );
-
- /*
- chase down the list of Nurbs looking for our curve.
- */
- for( i = 0; i < nurb_num; i++ ) {
- nurb = nurb->next;
- if( !nurb ) /* we ran off end of list */
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "curve index out of range" );
- }
- return CurNurb_appendPointToNurb( nurb, coord_args );
-}
-
-
-/****
- appendNurb( new_point )
- create a new nurb in the Curve and add the point param to it.
- returns a refernce to the newly created nurb.
-*****/
-
-static PyObject *Curve_appendNurb( BPy_Curve * self, PyObject * value )
-{
- Nurb *new_nurb;
- /* malloc new nurb */
- new_nurb = ( Nurb * ) MEM_callocN( sizeof( Nurb ), "appendNurb" );
- if( !new_nurb )
- return EXPP_ReturnPyObjError
- ( PyExc_MemoryError, "unable to malloc Nurb" );
-
- if( CurNurb_appendPointToNurb( new_nurb, value ) ) {
- new_nurb->resolu = self->curve->resolu;
- new_nurb->resolv = self->curve->resolv;
- new_nurb->hide = 0;
- new_nurb->flag = 1;
-
-
- if( new_nurb->bezt ) { /* do setup for bezt */
- new_nurb->type = CU_BEZIER;
- new_nurb->bezt->h1 = HD_ALIGN;
- new_nurb->bezt->h2 = HD_ALIGN;
- new_nurb->bezt->f1 = SELECT;
- new_nurb->bezt->f2 = SELECT;
- new_nurb->bezt->f3 = SELECT;
- new_nurb->bezt->hide = 0;
- /* calchandlesNurb( new_nurb ); */
- } else { /* set up bp */
- new_nurb->pntsv = 1;
- new_nurb->type = CU_NURBS;
- new_nurb->orderu = 4;
- new_nurb->flagu = 0;
- new_nurb->flagv = 0;
- new_nurb->bp->f1 = 0;
- new_nurb->bp->hide = 0;
- new_nurb->knotsu = 0;
- /*makenots( new_nurb, 1, new_nurb->flagu >> 1); */
- }
- BLI_addtail( &self->curve->nurb, new_nurb);
-
- } else {
- freeNurb( new_nurb );
- return NULL; /* with PyErr already set */
- }
-
- return CurNurb_CreatePyObject( new_nurb );
-}
-
-
-/*
- * Curve_update( )
- * method to update display list for a Curve.
- * used. after messing with control points
- */
-
-PyObject *Curve_update( BPy_Curve * self )
-{
- Nurb *nu = self->curve->nurb.first;
-
- /* recalculate handles for each curve: calchandlesNurb() will make
- * sure curves are bezier first */
- while( nu ) {
- calchandlesNurb ( nu );
- nu = nu->next;
- }
-
- Object_updateDag( (void*) self->curve );
-
- Py_RETURN_NONE;
-}
-
-/*
- * Curve_getMaterials
- *
- */
-
-static PyObject *Curve_getMaterials( BPy_Curve * self )
-{
- return EXPP_PyList_fromMaterialList( self->curve->mat,
- self->curve->totcol, 1 );
-}
-
-static int Curve_setMaterials( BPy_Curve *self, PyObject * value )
-{
- Material **matlist;
- int len;
-
- if( !PySequence_Check( value ) ||
- !EXPP_check_sequence_consistency( value, &Material_Type ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "sequence should only contain materials or None)" );
-
- len = PySequence_Size( value );
- if( len > 16 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "list can't have more than 16 materials" );
-
- /* free old material list (if it exists) and adjust user counts */
- if( self->curve->mat ) {
- Curve *cur = self->curve;
- int i;
- for( i = cur->totcol; i-- > 0; )
- if( cur->mat[i] )
- cur->mat[i]->id.us--;
- MEM_freeN( cur->mat );
- }
-
- /* build the new material list, increment user count, store it */
-
- matlist = EXPP_newMaterialList_fromPyList( value );
- EXPP_incr_mats_us( matlist, len );
- self->curve->mat = matlist;
- self->curve->totcol = (short)len;
-
-/**@ This is another ugly fix due to the weird material handling of blender.
- * it makes sure that object material lists get updated (by their length)
- * according to their data material lists, otherwise blender crashes.
- * It just stupidly runs through all objects...BAD BAD BAD.
- */
-
- test_object_materials( ( ID * ) self->curve );
-
- return 0;
-}
-
-/*****************************************************************************/
-/* Function: Curve_getBevOb */
-/* Description: Get the bevel object assign to the curve. */
-/*****************************************************************************/
-static PyObject *Curve_getBevOb( BPy_Curve * self)
-{
- if( self->curve->bevobj ) {
- return Object_CreatePyObject( self->curve->bevobj );
- }
-
- return EXPP_incr_ret( Py_None );
-}
-
-/*****************************************************************************/
-/* Function: Curve_newsetBevOb */
-/* Description: Assign a bevel object to the curve. */
-/*****************************************************************************/
-static int Curve_newsetBevOb( BPy_Curve * self, PyObject * args )
-{
-
- if (BPy_Object_Check( args ) && ((BPy_Object *)args)->object->data == self->curve )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "Can't bevel an object to itself" );
-
- return GenericLib_assignData(args, (void **) &self->curve->bevobj, 0, 0, ID_OB, OB_CURVE);
-}
-
-/*****************************************************************************/
-/* Function: Curve_getTaperOb */
-/* Description: Get the taper object assign to the curve. */
-/*****************************************************************************/
-
-static PyObject *Curve_getTaperOb( BPy_Curve * self)
-{
- if( self->curve->taperobj )
- return Object_CreatePyObject( self->curve->taperobj );
-
- Py_RETURN_NONE;
-}
-
-/*****************************************************************************/
-/* Function: Curve_newsetTaperOb */
-/* Description: Assign a taper object to the curve. */
-/*****************************************************************************/
-
-static int Curve_newsetTaperOb( BPy_Curve * self, PyObject * args )
-{
- if (BPy_Object_Check( args ) && ((BPy_Object *)args)->object->data == self->curve )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "Can't taper an object to itself" );
-
- return GenericLib_assignData(args, (void **) &self->curve->taperobj, 0, 0, ID_OB, OB_CURVE);
-}
-
-/*****************************************************************************/
-/* Function: Curve_copy */
-/* Description: Return a copy of this curve data. */
-/*****************************************************************************/
-
-PyObject *Curve_copy( BPy_Curve * self )
-{
- BPy_Curve *pycurve; /* for Curve Data object wrapper in Python */
- Curve *blcurve = 0; /* for actual Curve Data we create in Blender */
-
- /* copies the data */
- blcurve = copy_curve( self->curve ); /* first create the Curve Data in Blender */
-
- if( blcurve == NULL ) /* bail out if add_curve() failed */
- return ( EXPP_ReturnPyObjError
- ( PyExc_RuntimeError,
- "couldn't create Curve Data in Blender" ) );
-
- /* return user count to zero because add_curve() inc'd it */
- blcurve->id.us = 0;
-
- /* create python wrapper obj */
- pycurve = ( BPy_Curve * ) PyObject_NEW( BPy_Curve, &Curve_Type );
-
- if( pycurve == NULL )
- return ( EXPP_ReturnPyObjError
- ( PyExc_MemoryError,
- "couldn't create Curve Data object" ) );
-
- pycurve->curve = blcurve; /* link Python curve wrapper to Blender Curve */
- return ( PyObject * ) pycurve;
-}
-
-
-/*
- * Curve_getIter
- *
- * create an iterator for our Curve.
- * this iterator returns the Nurbs for this Curve.
- * the iter_pointer always points to the next available item or null
- */
-
-static PyObject *Curve_getIter( BPy_Curve * self )
-{
- self->iter_pointer = self->curve->nurb.first;
-
- Py_INCREF( self );
- return ( PyObject * ) self;
-
-}
-
-
-/*
- * Curve_iterNext
- * get the next item.
- * iter_pointer always points to the next available element
- * or NULL if at the end of the list.
- */
-
-static PyObject *Curve_iterNext( BPy_Curve * self )
-{
- Nurb *pnurb;
-
- if( self->iter_pointer ) {
- pnurb = self->iter_pointer;
- self->iter_pointer = pnurb->next; /* advance iterator */
- if( (pnurb->type & 7) == CU_BEZIER || pnurb->pntsv <= 1 )
- return CurNurb_CreatePyObject( pnurb ); /* make a bpy_curnurb */
- else
- return SurfNurb_CreatePyObject( pnurb ); /* make a bpy_surfnurb */
- }
-
- /* if iter_pointer was null, we are at end */
- return EXPP_ReturnPyObjError( PyExc_StopIteration,
- "iterator at end" );
-}
-
-/* tp_sequence methods */
-
-/*
- * Curve_length
- * returns the number of curves in a Curve
- * this is a tp_as_sequence method, not a regular instance method.
- */
-
-static int Curve_length( PyInstanceObject * inst )
-{
- if( BPy_Curve_Check( ( PyObject * ) inst ) )
- return ( ( int ) PyInt_AsLong
- ( Curve_getNumCurves( ( BPy_Curve * ) inst ) ) );
-
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "arg is not a BPy_Curve" );
-
-}
-
-/*
- * Curve_getNurb
- * returns the Nth nurb in a Curve.
- * this is one of the tp_as_sequence methods, hence the int N argument.
- * it is called via the [] operator, not as a usual instance method.
- */
-
-PyObject *Curve_getNurb( BPy_Curve * self, int n )
-{
- Nurb *pNurb;
- int i;
-
- /* bail if index < 0 */
- if( n < 0 )
- return ( EXPP_ReturnPyObjError( PyExc_IndexError,
- "index less than 0" ) );
- /* bail if no Nurbs in Curve */
- if( self->curve->nurb.first == 0 )
- return ( EXPP_ReturnPyObjError( PyExc_IndexError,
- "no Nurbs in this Curve" ) );
- /* set pointer to nth Nurb */
- for( pNurb = self->curve->nurb.first, i = 0;
- pNurb != 0 && i < n; pNurb = pNurb->next, ++i )
- /**/;
-
- if( !pNurb ) /* we came to the end of the list */
- return ( EXPP_ReturnPyObjError( PyExc_IndexError,
- "index out of range" ) );
-
- /* until there is a Surface BPyType, distinquish between a curve and a
- * surface based on whether it's a Bezier and the v size */
- if( (pNurb->type & 7) == CU_BEZIER || pNurb->pntsv <= 1 )
- return CurNurb_CreatePyObject( pNurb ); /* make a bpy_curnurb */
- else
- return SurfNurb_CreatePyObject( pNurb ); /* make a bpy_surfnurb */
-
-}
-
-/*
- * Curve_setNurb
- * In this case only remove the item, we could allow adding later.
- */
-static int Curve_setNurb( BPy_Curve * self, int n, PyObject * value )
-{
- Nurb *pNurb;
- int i;
-
- /* bail if index < 0 */
- if( n < 0 )
- return ( EXPP_ReturnIntError( PyExc_IndexError,
- "index less than 0" ) );
- /* bail if no Nurbs in Curve */
- if( self->curve->nurb.first == 0 )
- return ( EXPP_ReturnIntError( PyExc_IndexError,
- "no Nurbs in this Curve" ) );
- /* set pointer to nth Nurb */
- for( pNurb = self->curve->nurb.first, i = 0;
- pNurb != 0 && i < n; pNurb = pNurb->next, ++i )
- /**/;
-
- if( !pNurb ) /* we came to the end of the list */
- return ( EXPP_ReturnIntError( PyExc_IndexError,
- "index out of range" ) );
-
- if (value) {
- return ( EXPP_ReturnIntError( PyExc_RuntimeError,
- "assigning curves is not yet supported" ) );
- } else {
- BLI_remlink(&self->curve->nurb, pNurb);
- freeNurb(pNurb);
- }
- return 0;
-}
-
-/*****************************************************************************/
-/* Function: Curve_compare */
-/* Description: This compares 2 curve python types, == or != only. */
-/*****************************************************************************/
-static int Curve_compare( BPy_Curve * a, BPy_Curve * b )
-{
- return ( a->curve == b->curve ) ? 0 : -1;
-}
-
-/*****************************************************************************/
-/* Function: Curve_repr */
-/* Description: This is a callback function for the BPy_Curve type. It */
-/* builds a meaninful string to represent curve objects. */
-/*****************************************************************************/
-static PyObject *Curve_repr( BPy_Curve * self )
-{ /* used by 'repr' */
-
- return PyString_FromFormat( "[Curve \"%s\"]",
- self->curve->id.name + 2 );
-}
-
-/* attributes for curves */
-
-static PyGetSetDef Curve_getseters[] = {
- GENERIC_LIB_GETSETATTR,
- {"pathlen",
- (getter)Curve_getPathLen, (setter)Curve_newsetPathLen,
- "The path length, used to set the number of frames for an animation (not the physical length)",
- NULL},
- {"totcol",
- (getter)Curve_getTotcol, (setter)NULL,
- "The maximum number of linked materials",
- NULL},
- {"flag",
- (getter)Curve_getMode, (setter)Curve_newsetMode,
- "The flag bitmask",
- NULL},
- {"bevresol",
- (getter)Curve_getBevresol, (setter)Curve_newsetBevresol,
- "The bevel resolution",
- NULL},
- {"resolu",
- (getter)Curve_getResolu, (setter)Curve_newsetResolu,
- "The resolution in U direction",
- NULL},
- {"resolv",
- (getter)Curve_getResolv, (setter)Curve_newsetResolv,
- "The resolution in V direction",
- NULL},
- {"width",
- (getter)Curve_getWidth, (setter)Curve_newsetWidth,
- "The curve width",
- NULL},
- {"ext1",
- (getter)Curve_getExt1, (setter)Curve_newsetExt1,
- "The extent1 value (for bevels)",
- NULL},
- {"ext2",
- (getter)Curve_getExt2, (setter)Curve_newsetExt2,
- "The extent2 value (for bevels)",
- NULL},
- {"loc",
- (getter)Curve_getLoc, (setter)Curve_newsetLoc,
- "The data location (from the center)",
- NULL},
- {"rot",
- (getter)Curve_getRot, (setter)Curve_newsetRot,
- "The data rotation (from the center)",
- NULL},
- {"size",
- (getter)Curve_getSize, (setter)Curve_newsetSize,
- "The data size (from the center)",
- NULL},
- {"bevob",
- (getter)Curve_getBevOb, (setter)Curve_newsetBevOb,
- "The bevel object",
- NULL},
- {"taperob",
- (getter)Curve_getTaperOb, (setter)Curve_newsetTaperOb,
- "The taper object",
- NULL},
- {"key",
- (getter)Curve_getKey, (setter)NULL,
- "The shape key for the curve (if any)",
- NULL},
- {"materials",
- (getter)Curve_getMaterials, (setter)Curve_setMaterials,
- "The materials associated with the curve",
- NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-
-};
-
-/*****************************************************************************/
-/* Function: M_Curve_New */
-/* Python equivalent: Blender.Curve.New */
-/*****************************************************************************/
-static PyObject *M_Curve_New( PyObject * self, PyObject * args )
-{
- char *name = "Curve";
- BPy_Curve *pycurve; /* for Curve Data object wrapper in Python */
- Curve *blcurve = 0; /* for actual Curve Data we create in Blender */
-
- if( !PyArg_ParseTuple( args, "|s", &name ) )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError,
- "expected string argument or no argument" ) );
-
- blcurve = add_curve( name, OB_CURVE ); /* first create the Curve Data in Blender */
-
- if( blcurve == NULL ) /* bail out if add_curve() failed */
- return ( EXPP_ReturnPyObjError
- ( PyExc_RuntimeError,
- "couldn't create Curve Data in Blender" ) );
-
- /* return user count to zero because add_curve() inc'd it */
- blcurve->id.us = 0;
- /* create python wrapper obj */
- pycurve = ( BPy_Curve * ) PyObject_NEW( BPy_Curve, &Curve_Type );
-
- if( pycurve == NULL )
- return ( EXPP_ReturnPyObjError
- ( PyExc_MemoryError,
- "couldn't create Curve Data object" ) );
-
- pycurve->curve = blcurve; /* link Python curve wrapper to Blender Curve */
-
- return ( PyObject * ) pycurve;
-}
-
-/*****************************************************************************/
-/* Function: M_Curve_Get */
-/* Python equivalent: Blender.Curve.Get */
-/*****************************************************************************/
-static PyObject *M_Curve_Get( PyObject * self, PyObject * args )
-{
-
- char *name = NULL;
- Curve *curv_iter;
- BPy_Curve *wanted_curv;
-
- if( !PyArg_ParseTuple( args, "|s", &name ) ) /* expects nothing or a string */
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument" ) );
- if( name ) { /*a name has been given */
- /* Use the name to search for the curve requested */
- wanted_curv = NULL;
- curv_iter = G.main->curve.first;
-
- while( ( curv_iter ) && ( wanted_curv == NULL ) ) {
-
- if( strcmp( name, curv_iter->id.name + 2 ) == 0 ) {
- wanted_curv = ( BPy_Curve * )
- PyObject_NEW( BPy_Curve, &Curve_Type );
- if( wanted_curv )
- wanted_curv->curve = curv_iter;
- }
-
- curv_iter = curv_iter->id.next;
- }
-
- if( wanted_curv == NULL ) { /* Requested curve doesn't exist */
- char error_msg[64];
- PyOS_snprintf( error_msg, sizeof( error_msg ),
- "Curve \"%s\" not found", name );
- return ( EXPP_ReturnPyObjError
- ( PyExc_NameError, error_msg ) );
- }
-
-
- return ( PyObject * ) wanted_curv;
- } /* end of if(name) */
- else {
- /* no name has been given; return a list of all curves by name. */
- PyObject *curvlist;
-
- curv_iter = G.main->curve.first;
- curvlist = PyList_New( 0 );
-
- if( curvlist == NULL )
- return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create PyList" ) );
-
- while( curv_iter ) {
- BPy_Curve *found_cur =
- ( BPy_Curve * ) PyObject_NEW( BPy_Curve,
- &Curve_Type );
- found_cur->curve = curv_iter;
- PyList_Append( curvlist, ( PyObject * ) found_cur );
- Py_DECREF(found_cur);
- curv_iter = curv_iter->id.next;
- }
-
- return ( curvlist );
- } /* end of else */
-}
-
-/*****************************************************************************/
-/* Python method definitions for Blender.Curve module: */
-/*****************************************************************************/
-struct PyMethodDef M_Curve_methods[] = {
- {"New", ( PyCFunction ) M_Curve_New, METH_VARARGS, M_Curve_New_doc},
- {"Get", M_Curve_Get, METH_VARARGS, M_Curve_Get_doc},
- {"get", M_Curve_Get, METH_VARARGS, M_Curve_Get_doc},
- {NULL, NULL, 0, NULL}
-};
-
-
-/*****************************************************************************/
-/* Python BPy_Curve instance methods table: */
-/*****************************************************************************/
-static PyMethodDef BPy_Curve_methods[] = {
- {"getName", ( PyCFunction ) Curve_getName,
- METH_NOARGS, "() - Return Curve Data name"},
- {"setName", ( PyCFunction ) Curve_setName,
- METH_VARARGS, "() - Sets Curve Data name"},
- {"getPathLen", ( PyCFunction ) Curve_getPathLen,
- METH_NOARGS, "() - Return Curve path length"},
- {"setPathLen", ( PyCFunction ) Curve_setPathLen,
- METH_VARARGS, "(int) - Sets Curve path length"},
- {"getTotcol", ( PyCFunction ) Curve_getTotcol,
- METH_NOARGS, "() - Return the number of materials of the curve"},
- {"setTotcol", ( PyCFunction ) Curve_setTotcol,
- METH_VARARGS, "(int) - Sets the number of materials of the curve"},
- {"getFlag", ( PyCFunction ) Curve_getMode,
- METH_NOARGS, "() - Return flag (see the doc for semantic)"},
- {"setFlag", ( PyCFunction ) Curve_setMode,
- METH_VARARGS, "(int) - Sets flag (see the doc for semantic)"},
- {"getBevresol", ( PyCFunction ) Curve_getBevresol,
- METH_NOARGS, "() - Return bevel resolution"},
- {"setBevresol", ( PyCFunction ) Curve_setBevresol,
- METH_VARARGS, "(int) - Sets bevel resolution"},
- {"getResolu", ( PyCFunction ) Curve_getResolu,
- METH_NOARGS, "() - Return U resolution"},
- {"setResolu", ( PyCFunction ) Curve_setResolu,
- METH_VARARGS, "(int) - Sets U resolution"},
- {"getResolv", ( PyCFunction ) Curve_getResolv,
- METH_NOARGS, "() - Return V resolution"},
- {"setResolv", ( PyCFunction ) Curve_setResolv,
- METH_VARARGS, "(int) - Sets V resolution"},
- {"getWidth", ( PyCFunction ) Curve_getWidth,
- METH_NOARGS, "() - Return curve width"},
- {"setWidth", ( PyCFunction ) Curve_setWidth,
- METH_VARARGS, "(int) - Sets curve width"},
- {"getExt1", ( PyCFunction ) Curve_getExt1,
- METH_NOARGS, "() - Returns extent 1 of the bevel"},
- {"setExt1", ( PyCFunction ) Curve_setExt1,
- METH_VARARGS, "(int) - Sets extent 1 of the bevel"},
- {"getExt2", ( PyCFunction ) Curve_getExt2,
- METH_NOARGS, "() - Return extent 2 of the bevel "},
- {"setExt2", ( PyCFunction ) Curve_setExt2,
- METH_VARARGS, "(int) - Sets extent 2 of the bevel "},
- {"getControlPoint", ( PyCFunction ) Curve_getControlPoint,
- METH_VARARGS, "(int numcurve,int numpoint) -\
-Gets a control point.Depending upon the curve type, returne a list of 4 or 9 floats"},
- {"setControlPoint", ( PyCFunction ) Curve_setControlPoint,
- METH_VARARGS, "(int numcurve,int numpoint,float x,float y,float z,\
-float w)(nurbs) or (int numcurve,int numpoint,float x1,...,x9(bezier)\
-Sets a control point "},
- {"getLoc", ( PyCFunction ) Curve_getLoc,
- METH_NOARGS, "() - Gets Location of the curve (a 3-tuple) "},
- {"setLoc", ( PyCFunction ) Curve_setLoc,
- METH_VARARGS, "(3-tuple) - Sets Location "},
- {"getRot", ( PyCFunction ) Curve_getRot,
- METH_NOARGS, "() - Gets curve rotation"},
- {"setRot", ( PyCFunction ) Curve_setRot,
- METH_VARARGS, "(3-tuple) - Sets curve rotation"},
- {"getSize", ( PyCFunction ) Curve_getSize,
- METH_NOARGS, "() - Gets curve size"},
- {"setSize", ( PyCFunction ) Curve_setSize,
- METH_VARARGS, "(3-tuple) - Sets curve size"},
- {"getNumCurves", ( PyCFunction ) Curve_getNumCurves,
- METH_NOARGS, "() - Gets number of curves in Curve"},
- {"getKey", ( PyCFunction ) Curve_getKey,
- METH_NOARGS, "() - Gets curve key"},
- {"isNurb", ( PyCFunction ) Curve_isNurb,
- METH_VARARGS,
- "(nothing or integer) - returns 1 if curve is type Nurb, O otherwise."},
- {"isCyclic", ( PyCFunction ) Curve_isCyclic,
- METH_VARARGS, "( nothing or integer ) - returns true if curve is cyclic (closed), false otherwise."},
- {"getNumPoints", ( PyCFunction ) Curve_getNumPoints,
- METH_VARARGS,
- "(nothing or integer) - returns the number of points of the specified curve"},
- {"appendPoint", ( PyCFunction ) Curve_appendPoint, METH_VARARGS,
- "( int numcurve, list of coordinates) - adds a new point to end of curve"},
- {"appendNurb", ( PyCFunction ) Curve_appendNurb, METH_O,
- "( new_nurb ) - adds a new nurb to the Curve"},
- {"update", ( PyCFunction ) Curve_update, METH_NOARGS,
- "( ) - updates display lists after changes to Curve"},
- {"getMaterials", ( PyCFunction ) Curve_getMaterials, METH_NOARGS,
- "() - returns list of materials assigned to this Curve"},
- {"getBevOb", ( PyCFunction ) Curve_getBevOb, METH_NOARGS,
- "() - returns Bevel Object assigned to this Curve"},
- {"setBevOb", ( PyCFunction ) Curve_setBevOb, METH_VARARGS,
- "() - assign a Bevel Object to this Curve"},
- {"getTaperOb", ( PyCFunction ) Curve_getTaperOb, METH_NOARGS,
- "() - returns Taper Object assigned to this Curve"},
- {"setTaperOb", ( PyCFunction ) Curve_setTaperOb, METH_VARARGS,
- "() - assign a Taper Object to this Curve"},
- {"__copy__", ( PyCFunction ) Curve_copy, METH_NOARGS,
- "() - make a copy of this curve data"},
- {"copy", ( PyCFunction ) Curve_copy, METH_NOARGS,
- "() - make a copy of this curve data"},
- {NULL, NULL, 0, NULL}
-};
-
-
-/*****************************************************************************/
-/* Python Curve_Type callback function prototypes: */
-/*****************************************************************************/
-static int Curve_compare( BPy_Curve * a, BPy_Curve * b );
-static PyObject *Curve_repr( BPy_Curve * msh );
-
-static PySequenceMethods Curve_as_sequence = {
- ( inquiry ) Curve_length, /* sq_length */
- ( binaryfunc ) 0, /* sq_concat */
- ( intargfunc ) 0, /* sq_repeat */
- ( intargfunc ) Curve_getNurb, /* sq_item */
- ( intintargfunc ) 0, /* sq_slice */
- ( intobjargproc ) Curve_setNurb, /* sq_ass_item - only so you can do del curve[i] */
- 0, /* sq_ass_slice */
- ( objobjproc ) 0, /* sq_contains */
- 0,
- 0
-};
-
-/*****************************************************************************/
-/* Python Curve_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject Curve_Type = {
- PyObject_HEAD_INIT( NULL ) /* required macro */
- 0, /* ob_size */
- "Curve", /* tp_name */
- sizeof( BPy_Curve ), /* tp_basicsize */
- 0, /* tp_itemsize */
- /* methods */
- NULL, /* tp_dealloc */
- 0, /* tp_print */
- ( getattrfunc ) NULL, /* tp_getattr */
- ( setattrfunc ) NULL, /* tp_setattr */
- ( cmpfunc ) Curve_compare, /* tp_compare */
- ( reprfunc ) Curve_repr, /* tp_repr */
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- &Curve_as_sequence, /* PySequenceMethods *tp_as_sequence; */
- NULL, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
- 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, /* long tp_flags; */
-
- NULL, /* char *tp_doc; */
- /*** 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, /* richcmpfunc tp_richcompare; */
-
- /*** weak reference enabler ***/
- 0, /* long tp_weaklistoffset; */
-
- /*** Added in release 2.2 ***/
- /* Iterators */
- ( getiterfunc ) Curve_getIter, /* getiterfunc tp_iter; */
- ( iternextfunc ) Curve_iterNext, /* iternextfunc tp_iternext; */
-
- /*** Attribute descriptor and subclassing stuff ***/
- BPy_Curve_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- Curve_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-
-/*****************************************************************************/
-/* Function: Curve_Init */
-/*****************************************************************************/
-PyObject *Curve_Init( void )
-{
- PyObject *submodule;
-
- if( PyType_Ready( &Curve_Type) < 0) /* set exception. -1 is failure */
- return NULL;
-
- submodule =
- Py_InitModule3( "Blender.Curve", M_Curve_methods,
- M_Curve_doc );
- return ( submodule );
-}
-
-
-/*
- * Curve_CreatePyObject
- * constructor to build a py object from blender data
- */
-
-PyObject *Curve_CreatePyObject( struct Curve * curve )
-{
- BPy_Curve *blen_object;
-
- blen_object = ( BPy_Curve * ) PyObject_NEW( BPy_Curve, &Curve_Type );
-
- if( blen_object == NULL ) {
- return ( NULL );
- }
- blen_object->curve = curve;
- return ( ( PyObject * ) blen_object );
-
-}
-
-struct Curve *Curve_FromPyObject( PyObject * py_obj )
-{
- BPy_Curve *blen_obj;
-
- blen_obj = ( BPy_Curve * ) py_obj;
- return ( blen_obj->curve );
-
-}
-
-/* #####DEPRECATED###### */
-
-PyObject *Curve_setName( BPy_Curve * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Curve_newsetName );
-}
-
-static PyObject *Curve_setPathLen( BPy_Curve * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)Curve_newsetPathLen );
-}
-
-static PyObject *Curve_setTotcol( BPy_Curve * self, PyObject * args )
-{
- if( !PyArg_ParseTuple( args, "i", &( self->curve->totcol ) ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int argument" );
- Py_RETURN_NONE;
-}
-
-PyObject *Curve_setMode( BPy_Curve * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)Curve_newsetMode );
-}
-
-PyObject *Curve_setBevresol( BPy_Curve * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)Curve_newsetBevresol);
-}
-
-PyObject *Curve_setResolu( BPy_Curve * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)Curve_newsetResolu );
-}
-
-PyObject *Curve_setResolv( BPy_Curve * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)Curve_newsetResolv );
-}
-
-PyObject *Curve_setWidth( BPy_Curve * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)Curve_newsetWidth );
-}
-
-PyObject *Curve_setExt1( BPy_Curve * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)Curve_newsetExt1 );
-}
-
-PyObject *Curve_setExt2( BPy_Curve * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)Curve_newsetExt2 );
-}
-
-static PyObject *Curve_setLoc( BPy_Curve * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)Curve_newsetLoc );
-}
-
-static PyObject *Curve_setRot( BPy_Curve * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)Curve_newsetRot );
-}
-
-static PyObject *Curve_setSize( BPy_Curve * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)Curve_newsetSize );
-}
-
-PyObject *Curve_setBevOb( BPy_Curve * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)Curve_newsetBevOb );
-}
-
-PyObject *Curve_setTaperOb( BPy_Curve * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)Curve_newsetTaperOb );
-}
-
diff --git a/source/blender/python/api2_2x/Curve.h b/source/blender/python/api2_2x/Curve.h
deleted file mode 100644
index b6c80058b77..00000000000
--- a/source/blender/python/api2_2x/Curve.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * $Id: Curve.h 10269 2007-03-15 01:09:14Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Jacques Guignot, Stephen Swaney
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_CURVE_H
-#define EXPP_CURVE_H
-
-#include <Python.h>
-#include "DNA_curve_types.h"
-
-extern PyTypeObject Curve_Type;
-
-#define BPy_Curve_Check(v) ((v)->ob_type==&Curve_Type)
-
-/* Python BPy_Curve structure definition */
-typedef struct {
- PyObject_HEAD /* required py macro */
- Curve * curve; /* libdata must be second */
- /* pointer for iterator: does not point to owned memory */
- Nurb *iter_pointer;
-} BPy_Curve;
-
-
-/*
- * protoypes
- */
-
-PyObject *Curve_Init( void );
-PyObject *Curve_CreatePyObject( struct Curve * curve );
-struct Curve *Curve_FromPyObject( PyObject * py_obj );
-PyObject *Curve_update( BPy_Curve * self );
-
-PyObject *Curve_getName( BPy_Curve * self );
-PyObject *Curve_setName( BPy_Curve * self, PyObject * args );
-PyObject *Curve_getMode( BPy_Curve * self );
-PyObject *Curve_setMode( BPy_Curve * self, PyObject * args );
-PyObject *Curve_getBevresol( BPy_Curve * self );
-PyObject *Curve_setBevresol( BPy_Curve * self, PyObject * args );
-PyObject *Curve_getResolu( BPy_Curve * self );
-PyObject *Curve_setResolu( BPy_Curve * self, PyObject * args );
-PyObject *Curve_getResolv( BPy_Curve * self );
-PyObject *Curve_setResolv( BPy_Curve * self, PyObject * args );
-PyObject *Curve_getExt1( BPy_Curve * self );
-PyObject *Curve_setExt1( BPy_Curve * self, PyObject * args );
-PyObject *Curve_getExt2( BPy_Curve * self );
-PyObject *Curve_setExt2( BPy_Curve * self, PyObject * args );
-PyObject *Curve_getWidth( BPy_Curve * self );
-PyObject *Curve_setWidth( BPy_Curve * self, PyObject * args );
-
-#endif /* EXPP_CURVE_H */
diff --git a/source/blender/python/api2_2x/Draw.c b/source/blender/python/api2_2x/Draw.c
deleted file mode 100644
index 621c72efc2a..00000000000
--- a/source/blender/python/api2_2x/Draw.c
+++ /dev/null
@@ -1,2197 +0,0 @@
-/*
- * $Id: Draw.c 12893 2007-12-15 18:24:16Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano, Campbell Barton, Ken Hughes
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-/* This file is the Blender.Draw part of opy_draw.c, from the old
- * bpython/intern dir, with minor changes to adapt it to the new Python
- * implementation. Non-trivial original comments are marked with an
- * @ symbol at their beginning. */
-
-#include "Draw.h" /*This must come first*/
-
-#include "BLI_blenlib.h"
-#include "MEM_guardedalloc.h"
-#include "BMF_Api.h"
-#include "DNA_screen_types.h"
-#include "BKE_global.h"
-#include "BKE_image.h"
-#include "BKE_object.h"
-#include "BKE_main.h"
-#include "BKE_utildefines.h"
-#include "BIF_gl.h"
-#include "BIF_mywindow.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_interface.h"
-#include "BIF_toolbox.h"
-#include "BPI_script.h" /* script struct */
-#include "Image.h" /* for accessing Blender.Image objects */
-#include "IMB_imbuf_types.h" /* for the IB_rect define */
-#include "interface.h"
-#include "mydevice.h" /*@ for all the event constants */
-#include "gen_utils.h"
-#include "Window.h"
-#include "../BPY_extern.h"
-
-/* used so we can get G.scene->r.cfra for getting the
-current image frame, some images change frame if they are a sequence */
-#include "DNA_scene_types.h"
-
-/* these delimit the free range for button events */
-#define EXPP_BUTTON_EVENTS_OFFSET 1001
-#define EXPP_BUTTON_EVENTS_MIN 0
-#define EXPP_BUTTON_EVENTS_MAX 15382 /* 16384 - 1 - OFFSET */
-
-#define ButtonObject_Check(v) ((v)->ob_type == &Button_Type)
-
-#define UI_METHOD_ERRORCHECK \
- if (check_button_event(&event) == -1)\
- return EXPP_ReturnPyObjError( PyExc_AttributeError,\
- "button event argument must be in the range [0, 16382]");\
- if (callback && !PyCallable_Check(callback))\
- return EXPP_ReturnPyObjError( PyExc_ValueError,\
- "callback is not a python function");\
-
-/* pointer to main dictionary defined in Blender.c */
-extern PyObject *g_blenderdict;
-
-/*@ hack to flag that window redraw has happened inside slider callback: */
-int EXPP_disable_force_draw = 0;
-
-/* forward declarations for internal functions */
-static void Button_dealloc( PyObject * self );
-static PyObject *Button_getattr( PyObject * self, char *name );
-static PyObject *Button_repr( PyObject * self );
-static PyObject *Button_richcmpr(PyObject *objectA, PyObject *objectB, int comparison_type);
-static int Button_setattr( PyObject * self, char *name, PyObject * v );
-
-static Button *newbutton( void );
-
-/* GUI interface routines */
-
-static void exit_pydraw( SpaceScript * sc, short error );
-static void exec_callback( SpaceScript * sc, PyObject * callback,
- PyObject * args );
-static void spacescript_do_pywin_buttons( SpaceScript * sc,
- unsigned short event );
-
-static PyObject *Method_Exit( PyObject * self );
-static PyObject *Method_Register( PyObject * self, PyObject * args );
-static PyObject *Method_Redraw( PyObject * self, PyObject * args );
-static PyObject *Method_Draw( PyObject * self );
-static PyObject *Method_Create( PyObject * self, PyObject * args );
-static PyObject *Method_UIBlock( PyObject * self, PyObject * args );
-
-static PyObject *Method_Button( PyObject * self, PyObject * args );
-static PyObject *Method_Menu( PyObject * self, PyObject * args );
-static PyObject *Method_Toggle( PyObject * self, PyObject * args );
-static PyObject *Method_Slider( PyObject * self, PyObject * args );
-static PyObject *Method_Scrollbar( PyObject * self, PyObject * args );
-static PyObject *Method_ColorPicker( PyObject * self, PyObject * args );
-static PyObject *Method_Normal( PyObject * self, PyObject * args );
-static PyObject *Method_Number( PyObject * self, PyObject * args );
-static PyObject *Method_String( PyObject * self, PyObject * args );
-static PyObject *Method_GetStringWidth( PyObject * self, PyObject * args );
-static PyObject *Method_Text( PyObject * self, PyObject * args );
-static PyObject *Method_Label( PyObject * self, PyObject * args );
-/* by Campbell: */
-static PyObject *Method_PupMenu( PyObject * self, PyObject * args );
-static PyObject *Method_PupIntInput( PyObject * self, PyObject * args );
-static PyObject *Method_PupFloatInput( PyObject * self, PyObject * args );
-static PyObject *Method_PupStrInput( PyObject * self, PyObject * args );
-static PyObject *Method_BeginAlign( PyObject * self, PyObject * args );
-static PyObject *Method_EndAlign( PyObject * self, PyObject * args );
-/* next by Jonathan Merritt (lancelet): */
-static PyObject *Method_Image( PyObject * self, PyObject * args);
-/* CLEVER NUMBUT */
-static PyObject *Method_PupBlock( PyObject * self, PyObject * args );
-
-static uiBlock *Get_uiBlock( void );
-
-static void py_slider_update( void *butv, void *data2_unused );
-
-/* hack to get 1 block for the UIBlock, only ever 1 at a time */
-static uiBlock *uiblock=NULL;
-
-static char Draw_doc[] = "The Blender.Draw submodule";
-
-static char Method_UIBlock_doc[] = "(drawfunc, x,y) - Popup dialog where buttons can be drawn (expemental)";
-
-static char Method_Register_doc[] =
- "(draw, event, button) - Register callbacks for windowing\n\n\
-(draw) A function to draw the screen, taking no arguments\n\
-(event) A function to handle events, taking 2 arguments (evt, val)\n\
- (evt) The event number\n\
- (val) The value modifier (for key and mouse press/release)\n\
-(button) A function to handle button events, taking 1 argument (evt)\n\
- (evt) The button number\n\n\
-A None object can be passed if a callback is unused.";
-
-
-static char Method_Redraw_doc[] = "([after]) - Queue a redraw event\n\n\
-[after=0] Determines whether the redraw is processed before\n\
-or after other input events.\n\n\
-Redraw events are buffered so that regardless of how many events\n\
-are queued the window only receives one redraw event.";
-
-static char Method_Draw_doc[] = "() - Force an immediate redraw\n\n\
-Forced redraws are not buffered, in other words the window is redrawn\n\
-exactly once for everytime this function is called.";
-
-
-static char Method_Create_doc[] =
- "(value) - Create a default Button object\n\n\
- (value) - The value to store in the button\n\n\
- Valid values are ints, floats, and strings";
-
-static char Method_Button_doc[] =
- "(name, event, x, y, width, height, [tooltip]) - Create a new Button \
-(push) button\n\n\
-(name) A string to display on the button\n\
-(event) The event number to pass to the button event function when activated\n\
-(x, y) The lower left coordinate of the button\n\
-(width, height) The button width and height\n\
-[tooltip=] The button's tooltip\n\n\
-This function can be called as Button() or PushButton().";
-
-static char Method_BeginAlign_doc[] =
- "Buttons after this function will draw aligned (button layout only)";
-
-static char Method_EndAlign_doc[] =
- "Use after BeginAlign() to stop aligning the buttons (button layout only).";
-
-static char Method_Menu_doc[] =
- "(name, event, x, y, width, height, default, [tooltip]) - Create a new Menu \
-button\n\n\
-(name) A string to display on the button\n\
-(event) The event number to pass to the button event function when activated\n\
-(x, y) The lower left coordinate of the button\n\
-(width, height) The button width and height\n\
-(default) The number of the option to be selected by default\n\
-[tooltip=" "] The button's tooltip\n\n\
-The menu options are specified through the name of the\n\
-button. Options are followed by a format code and separated\n\
-by the '|' (pipe) character.\n\
-Valid format codes are\n\
- %t - The option should be used as the title\n\
- %xN - The option should set the integer N in the button value.";
-
-static char Method_Toggle_doc[] =
- "(name, event, x, y, width, height, default, [tooltip]) - Create a new Toggle \
-button\n\n\
-(name) A string to display on the button\n\
-(event) The event number to pass to the button event function when activated\n\
-(x, y) The lower left coordinate of the button\n\
-(width, height) The button width and height\n\
-(default) An integer (0 or 1) specifying the default state\n\
-[tooltip=] The button's tooltip";
-
-
-static char Method_Slider_doc[] =
- "(name, event, x, y, width, height, initial, min, max, [update, tooltip]) - \
-Create a new Slider button\n\n\
-(name) A string to display on the button\n\
-(event) The event number to pass to the button event function when activated\n\
-(x, y) The lower left coordinate of the button\n\
-(width, height) The button width and height\n\
-(initial, min, max) Three values (int or float) specifying the initial \
- and limit values.\n\
-[update=1] A value controlling whether the slider will emit events as it \
-is edited.\n\
- A non-zero value (default) enables the events. A zero value supresses them.\n\
-[tooltip=] The button's tooltip";
-
-
-static char Method_Scrollbar_doc[] =
- "(event, x, y, width, height, initial, min, max, [update, tooltip]) - Create a \
-new Scrollbar\n\n\
-(event) The event number to pass to the button event function when activated\n\
-(x, y) The lower left coordinate of the button\n\
-(width, height) The button width and height\n\
-(initial, min, max) Three values (int or float) specifying the initial and limit values.\n\
-[update=1] A value controlling whether the slider will emit events as it is edited.\n\
- A non-zero value (default) enables the events. A zero value supresses them.\n\
-[tooltip=] The button's tooltip";
-
-static char Method_ColorPicker_doc[] =
- "(event, x, y, width, height, initial, [tooltip]) - Create a new Button \
-Color picker button\n\n\
-(event) The event number to pass to the button event function when the color changes\n\
-(x, y) The lower left coordinate of the button\n\
-(width, height) The button width and height\n\
-(initial) 3-Float tuple of the color (values between 0 and 1)\
-[tooltip=] The button's tooltip";
-
-static char Method_Normal_doc[] =
- "(event, x, y, width, height, initial, [tooltip]) - Create a new Button \
-Normal button (a sphere that you can roll to change the normal)\n\n\
-(event) The event number to pass to the button event function when the color changes\n\
-(x, y) The lower left coordinate of the button\n\
-(width, height) The button width and height - non square will gave odd results\n\
-(initial) 3-Float tuple of the normal vector (values between -1 and 1)\
-[tooltip=] The button's tooltip";
-
-static char Method_Number_doc[] =
- "(name, event, x, y, width, height, initial, min, max, [tooltip]) - Create a \
-new Number button\n\n\
-(name) A string to display on the button\n\
-(event) The event number to pass to the button event function when activated\n\
-(x, y) The lower left coordinate of the button\n\
-(width, height) The button width and height\n\
-(initial, min, max) Three values (int or float) specifying the initial and \
-limit values.\n\
-[tooltip=] The button's tooltip";
-
-static char Method_String_doc[] =
- "(name, event, x, y, width, height, initial, length, [tooltip]) - Create a \
-new String button\n\n\
-(name) A string to display on the button\n\
-(event) The event number to pass to the button event function when activated\n\
-(x, y) The lower left coordinate of the button\n\
-(width, height) The button width and height\n\
-(initial) The string to display initially\n\
-(length) The maximum input length\n\
-[tooltip=] The button's tooltip";
-
-static char Method_GetStringWidth_doc[] =
- "(text, font = 'normal') - Return the width in pixels of the given string\n\
-(font) The font size: 'normal' (default), 'small' or 'tiny'.";
-
-static char Method_Text_doc[] =
- "(text, font = 'normal') - Draw text onscreen\n\n\
-(text) The text to draw\n\
-(font) The font size: 'normal' (default), 'small' or 'tiny'.\n\n\
-This function returns the width of the drawn string.";
-
-static char Method_Label_doc[] =
- "(text, x, y) - Draw a text label onscreen\n\n\
-(text) The text to draw\n\
-(x, y) The lower left coordinate of the lable";
-
-static char Method_PupMenu_doc[] =
- "(string, maxrow = None) - Display a pop-up menu at the screen.\n\
-The contents of the pop-up are specified through the 'string' argument,\n\
-like with Draw.Menu.\n\
-'maxrow' is an optional int to control how many rows the pop-up should have.\n\
-Options are followed by a format code and separated\n\
-by the '|' (pipe) character.\n\
-Valid format codes are\n\
- %t - The option should be used as the title\n\
- %xN - The option should set the integer N in the button value.\n\n\
-Ex: Draw.PupMenu('OK?%t|QUIT BLENDER') # should be familiar ...";
-
-static char Method_PupIntInput_doc[] =
- "(text, default, min, max) - Display an int pop-up input.\n\
-(text) - text string to display on the button;\n\
-(default, min, max) - the default, min and max int values for the button;\n\
-Return the user input value or None on user exit";
-
-static char Method_PupFloatInput_doc[] =
- "(text, default, min, max, clickStep, floatLen) - Display a float pop-up input.\n\
-(text) - text string to display on the button;\n\
-(default, min, max) - the default, min and max float values for the button;\n\
-(clickStep) - float increment/decrement for each click on the button arrows;\n\
-(floatLen) - an integer defining the precision (number of decimal places) of \n\
-the float value show.\n\
-Return the user input value or None on user exit";
-
-static char Method_Image_doc[] =
- "(image, x, y, zoomx = 1.0, zoomy = 1.0, [clipx, clipy, clipw, cliph])) \n\
- - Draw an image.\n\
-(image) - Blender.Image to draw.\n\
-(x, y) - floats specifying the location of the image.\n\
-(zoomx, zoomy) - float zoom factors in horizontal and vertical directions.\n\
-(clipx, clipy, clipw, cliph) - integers specifying a clipping rectangle within the original image.";
-
-static char Method_PupStrInput_doc[] =
- "(text, default, max = 20) - Display a float pop-up input.\n\
-(text) - text string to display on the button;\n\
-(default) - the initial string to display (truncated to 'max' chars);\n\
-(max = 20) - The maximum number of chars the user can input;\n\
-Return the user input value or None on user exit";
-
-static char Method_PupBlock_doc[] =
- "(title, sequence) - Display a pop-up block.\n\
-(title) - The title of the block.\n\
-(sequence) - A sequence defining what the block contains. \
-The order of the list is the order of appearance, from top down.\n\
-Possible format for sequence items:\n\
-[value is an object created with Create]\n\
-\ttext: Defines a label in the block\n\
-\t(text, value, tooltip = ''): Defines a toggle button \n\
-\t(text, value, min, max, tooltip = ''): Defines a num or string button \n\
-\t\t\tdepending on the value.\n\
-\t\tFor string, max is the maximum length of the text and min is unused.\n\
-Return 1 if the pop-up is confirmed, 0 otherwise. \n\
-Warning: On cancel, the value objects are brought back to there previous values, \
-\texcept for string values which will still contain the modified values.\n";
-
-static char Method_Exit_doc[] = "() - Exit the windowing interface";
-
-/*This is needed for button callbacks. Any button that uses a callback gets added to this list.
- On the C side of drawing begin, this list should be cleared.
- Each entry is a tuple of the form (button, callback py object)
-*/
-PyObject *M_Button_List = NULL;
-
-static struct PyMethodDef Draw_methods[] = {
- {"Create", (PyCFunction)Method_Create, METH_VARARGS, Method_Create_doc},
- {"UIBlock", (PyCFunction)Method_UIBlock, METH_VARARGS, Method_UIBlock_doc},
- {"Button", (PyCFunction)Method_Button, METH_VARARGS, Method_Button_doc},
- {"Toggle", (PyCFunction)Method_Toggle, METH_VARARGS, Method_Toggle_doc},
- {"Menu", (PyCFunction)Method_Menu, METH_VARARGS, Method_Menu_doc},
- {"Slider", (PyCFunction)Method_Slider, METH_VARARGS, Method_Slider_doc},
- {"Scrollbar", (PyCFunction)Method_Scrollbar, METH_VARARGS, Method_Scrollbar_doc},
- {"ColorPicker", (PyCFunction)Method_ColorPicker, METH_VARARGS, Method_ColorPicker_doc},
- {"Normal", (PyCFunction)Method_Normal, METH_VARARGS, Method_Normal_doc},
- {"Number", (PyCFunction)Method_Number, METH_VARARGS, Method_Number_doc},
- {"String", (PyCFunction)Method_String, METH_VARARGS, Method_String_doc},
- {"GetStringWidth", (PyCFunction)Method_GetStringWidth, METH_VARARGS, Method_GetStringWidth_doc},
- {"Text", (PyCFunction)Method_Text, METH_VARARGS, Method_Text_doc},
- {"Label", (PyCFunction)Method_Label, METH_VARARGS, Method_Label_doc},
- {"PupMenu", (PyCFunction)Method_PupMenu, METH_VARARGS, Method_PupMenu_doc},
- {"PupIntInput", (PyCFunction)Method_PupIntInput, METH_VARARGS, Method_PupIntInput_doc},
- {"PupFloatInput", (PyCFunction)Method_PupFloatInput, METH_VARARGS, Method_PupFloatInput_doc},
- {"PupStrInput", (PyCFunction)Method_PupStrInput, METH_VARARGS, Method_PupStrInput_doc},
- {"PupBlock", (PyCFunction)Method_PupBlock, METH_VARARGS, Method_PupBlock_doc},
- {"Image", (PyCFunction)Method_Image, METH_VARARGS, Method_Image_doc},
- {"Exit", (PyCFunction)Method_Exit, METH_NOARGS, Method_Exit_doc},
- {"Redraw", (PyCFunction)Method_Redraw, METH_VARARGS, Method_Redraw_doc},
- {"Draw", (PyCFunction)Method_Draw, METH_NOARGS, Method_Draw_doc},
- {"Register", (PyCFunction)Method_Register, METH_VARARGS, Method_Register_doc},
- {"PushButton", (PyCFunction)Method_Button, METH_VARARGS, Method_Button_doc},
- {"BeginAlign", (PyCFunction)Method_BeginAlign, METH_VARARGS, Method_BeginAlign_doc},
- {"EndAlign", (PyCFunction)Method_EndAlign, METH_VARARGS, Method_EndAlign_doc},
- {NULL, NULL, 0, NULL}
-};
-
-PyTypeObject Button_Type = {
- PyObject_HEAD_INIT( NULL ) 0, /*ob_size */
- "Button", /*tp_name */
- sizeof( Button ), /*tp_basicsize */
- 0, /*tp_itemsize */
- ( destructor ) Button_dealloc, /*tp_dealloc */
- ( printfunc ) 0, /*tp_print */
- ( getattrfunc ) Button_getattr, /*tp_getattr */
- ( setattrfunc ) Button_setattr, /*tp_setattr */
- NULL, /*tp_cmp */
- ( reprfunc ) Button_repr, /*tp_repr */
-
- /* Method suites for standard classes */
-
- 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; */
- 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, /* 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 ***/
- (richcmpfunc)Button_richcmpr, /* 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 ***/
- NULL, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- NULL, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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 Button_dealloc( PyObject * self )
-{
- Button *but = ( Button * ) self;
-
- if( but->type == BSTRING_TYPE ) {
- if( but->val.asstr )
- MEM_freeN( but->val.asstr );
- }
-
- PyObject_DEL( self );
-}
-
-static PyObject *Button_getattr( PyObject * self, char *name )
-{
- Button *but = ( Button * ) self;
-
- if( strcmp( name, "val" ) == 0 ) {
- if( but->type == BINT_TYPE )
- return PyInt_FromLong( but->val.asint );
- else if( but->type == BFLOAT_TYPE )
- return PyFloat_FromDouble( but->val.asfloat );
- else if( but->type == BSTRING_TYPE )
- return PyString_FromString( but->val.asstr );
- else if( but->type == BVECTOR_TYPE )
- return Py_BuildValue( "fff", but->val.asvec[0], but->val.asvec[1], but->val.asvec[2] );
- }
-
- PyErr_SetString( PyExc_AttributeError, name );
- return NULL;
-}
-
-static int Button_setattr( PyObject * self, char *name, PyObject * v )
-{
- Button *but = ( Button * ) self;
-
- if( strcmp( name, "val" ) == 0 ) {
- if( but->type == BINT_TYPE && PyNumber_Check(v) ) {
- PyObject *pyVal = PyNumber_Int( v );
- if (pyVal) {
- but->val.asint = (int)PyInt_AS_LONG( pyVal );
- Py_DECREF(pyVal);
- return 0;
- }
- }
- else if( but->type == BFLOAT_TYPE && PyNumber_Check(v) ) {
- PyObject *pyVal = PyNumber_Float( v );
- if (pyVal) {
- but->val.asfloat = (float)PyFloat_AS_DOUBLE( pyVal );
- Py_DECREF(pyVal);
- return 0;
- }
- }
- else if( but->type == BVECTOR_TYPE ) {
- if ( PyArg_ParseTuple( v, "fff", but->val.asvec, but->val.asvec+1, but->val.asvec+2 ) )
- return 0;
- }
- else if( but->type == BSTRING_TYPE && PyString_Check(v) ) {
- char *newstr;
- unsigned int newlen;
-
- PyString_AsStringAndSize( v, &newstr, (int *)&newlen );
-
- if (newlen+1> UI_MAX_DRAW_STR)
- return EXPP_ReturnIntError( PyExc_ValueError, "Error: button string length exceeded max limit (399 chars).");
-
- /* if the length of the new string is the same as */
- /* the old one, just copy, else delete and realloc. */
- if( but->slen == newlen ) {
- BLI_strncpy( but->val.asstr, newstr,
- but->slen + 1 );
-
- return 0;
-
- } else {
- MEM_freeN( but->val.asstr );
- but->slen = newlen;
- but->val.asstr =
- MEM_mallocN( but->slen + 1,
- "button setattr" );
- BLI_strncpy( but->val.asstr, newstr,
- but->slen + 1 );
-
- return 0;
- }
- }
- } else {
- /*
- * Accessing the wrong attribute.
- */
- return EXPP_ReturnIntError( PyExc_AttributeError, name );
- }
-
- /*
- * Correct attribute but value is incompatible with current button value.
- */
- return EXPP_ReturnIntError( PyExc_ValueError, "value incompatible with current button type" );
-}
-
-static PyObject *Button_repr( PyObject * self )
-{
- return PyObject_Repr( Button_getattr( self, "val" ) );
-}
-
-static PyObject *Button_richcmpr(PyObject *objectA, PyObject *objectB, int comparison_type)
-{
- PyObject *ret, *valA=NULL, *valB=NULL;
- if (ButtonObject_Check(objectA))
- objectA = valA = Button_getattr( objectA, "val" );
- if (ButtonObject_Check(objectB))
- objectB = valB = Button_getattr( objectB, "val" );
- ret = PyObject_RichCompare(objectA, objectB, comparison_type);
- Py_XDECREF(valA); /* Button_getattr created with 1 ref, we dont care about them now */
- Py_XDECREF(valB);
- return ret;
-}
-
-
-static Button *newbutton( void )
-{
- Button *but = NULL;
-
- but = ( Button * ) PyObject_NEW( Button, &Button_Type );
- but->tooltip[0] = 0; /*NULL-terminate tooltip string*/
- but->tooltip[255] = 0; /*necassary to insure we always have a NULL-terminated string, as
- according to the docs strncpy doesn't do this for us.*/
- return but;
-}
-
-/* GUI interface routines */
-
-static void exit_pydraw( SpaceScript * sc, short err )
-{
- Script *script = NULL;
-
- if( !sc || !sc->script )
- return;
-
- script = sc->script;
-
- if( err ) {
- PyErr_Print( );
- script->flags = 0; /* mark script struct for deletion */
- error( "Python script error: check console" );
- scrarea_queue_redraw( sc->area );
- }
-
- BPy_Set_DrawButtonsList(sc->but_refs);
- BPy_Free_DrawButtonsList(); /*clear all temp button references*/
- sc->but_refs = NULL;
-
- Py_XDECREF( ( PyObject * ) script->py_draw );
- Py_XDECREF( ( PyObject * ) script->py_event );
- Py_XDECREF( ( PyObject * ) script->py_button );
-
- script->py_draw = script->py_event = script->py_button = NULL;
-}
-
-static void exec_callback( SpaceScript * sc, PyObject * callback,
- PyObject * args )
-{
- PyObject *result = PyObject_CallObject( callback, args );
-
- if( result == NULL && sc->script ) { /* errors in the script */
-
- if( sc->script->lastspace == SPACE_TEXT ) { /*if it can be an ALT+P script */
- Text *text = G.main->text.first;
-
- while( text ) { /* find it and free its compiled code */
-
- if( !strcmp
- ( text->id.name + 2,
- sc->script->id.name + 2 ) ) {
- BPY_free_compiled_text( text );
- break;
- }
-
- text = text->id.next;
- }
- }
- exit_pydraw( sc, 1 );
- }
-
- Py_XDECREF( result );
- Py_DECREF( args );
-}
-
-/* BPY_spacescript_do_pywin_draw, the static spacescript_do_pywin_buttons and
- * BPY_spacescript_do_pywin_event are the three functions responsible for
- * calling the draw, buttons and event callbacks registered with Draw.Register
- * (see Method_Register below). They are called (only the two BPY_ ones)
- * from blender/src/drawscript.c */
-
-void BPY_spacescript_do_pywin_draw( SpaceScript * sc )
-{
- uiBlock *block;
- char butblock[20];
- Script *script = sc->script;
-
- sprintf( butblock, "win %d", curarea->win );
- block = uiNewBlock( &curarea->uiblocks, butblock, UI_EMBOSSX,
- UI_HELV, curarea->win );
-
- if( script->py_draw ) {
- if (sc->but_refs) {
- BPy_Set_DrawButtonsList(sc->but_refs);
- BPy_Free_DrawButtonsList(); /*clear all temp button references*/
- }
- sc->but_refs = PyList_New(0);
- BPy_Set_DrawButtonsList(sc->but_refs);
-
- glPushAttrib( GL_ALL_ATTRIB_BITS );
- exec_callback( sc, script->py_draw, Py_BuildValue( "()" ) );
- glPopAttrib( );
- } else {
- glClearColor( 0.4375, 0.4375, 0.4375, 0.0 );
- glClear( GL_COLOR_BUFFER_BIT );
- }
-
- uiDrawBlock( block );
-
- curarea->win_swap = WIN_BACK_OK;
-}
-
-static void spacescript_do_pywin_buttons( SpaceScript * sc,
- unsigned short event )
-{
- if( sc->script->py_button )
- exec_callback( sc, sc->script->py_button,
- Py_BuildValue( "(i)", event ) );
-}
-
-void BPY_spacescript_do_pywin_event( SpaceScript * sc, unsigned short event,
- short val, char ascii )
-{
- if( event == QKEY && G.qual & ( LR_ALTKEY | LR_CTRLKEY ) ) {
- /* finish script: user pressed ALT+Q or CONTROL+Q */
- Script *script = sc->script;
-
- exit_pydraw( sc, 0 );
-
- script->flags &= ~SCRIPT_GUI; /* we're done with this script */
-
- return;
- }
-
- if (val) {
-
- if (uiDoBlocks( &curarea->uiblocks, event, 1 ) != UI_NOTHING) event = 0;
-
- if (event == UI_BUT_EVENT) {
- /* check that event is in free range for script button events;
- * read the comment before check_button_event() below to understand */
- if (val >= EXPP_BUTTON_EVENTS_OFFSET && val < 0x4000)
- spacescript_do_pywin_buttons(sc, val - EXPP_BUTTON_EVENTS_OFFSET);
- return;
- }
- }
-
- /* We use the "event" main module var, used by scriptlinks, to pass the ascii
- * value to event callbacks (gui/event/button callbacks are not allowed
- * inside scriptlinks, so this is ok) */
- if( sc->script->py_event ) {
- int pass_ascii = 0;
- if (ascii > 31 && ascii != 127) {
- pass_ascii = 1;
- EXPP_dict_set_item_str(g_blenderdict, "event",
- PyInt_FromLong((long)ascii));
- }
- exec_callback( sc, sc->script->py_event,
- Py_BuildValue( "(ii)", event, val ) );
- if (pass_ascii)
- EXPP_dict_set_item_str(g_blenderdict, "event",
- PyString_FromString(""));
- }
-}
-
-static void exec_but_callback(void *pyobj, void *data)
-{
- PyObject *result;
- PyObject *pyvalue = NULL;
- uiBut *but = (uiBut *)data;
- PyObject *arg;
- PyObject *callback = (PyObject *)pyobj;
-
- double value = ui_get_but_val(but);
-
- if (callback==NULL || callback == Py_None)
- return;
-
- /* Button types support
- case MENU:
- case TEX:
- case TOG:
- case NUMSLI:
- case NUM:
- case COL:
- case BUT_NORMAL:
- case BUT */
- switch (but->type) {
- case TEX:
- /*printf("TEX\n");*/
- pyvalue = PyString_FromString( (char *)but->poin );
- break;
- case NUM:
- case NUMSLI:
- case TOG:
- case MENU:
- if (but->pointype==FLO) {
- /*printf("FLO\n");*/
- pyvalue = PyFloat_FromDouble( (float)value );
- } else if (but->pointype==INT) {
- /*printf("INT\n");*/
- pyvalue = PyInt_FromLong( (int)value );
- } else if (but->pointype==SHO) {
- /*printf("SHO\n");*/
- pyvalue = PyInt_FromLong( (short)value );
- }
- break;
- case COL:
- case BUT_NORMAL:
- {
- float vec[3];
- VECCOPY(vec, (float *)but->poin);
- pyvalue = Py_BuildValue("(fff)", vec[0], vec[1], vec[2]);
- break;
- }
- case BUT:
- pyvalue = Py_None;
- Py_INCREF(pyvalue);
- break;
- default:
- pyvalue = Py_None;
- Py_INCREF(pyvalue);
- printf("Error, no button type matched.");
- }
-
- arg = PyTuple_New( 2 );
- if (uiblock==NULL)
- PyTuple_SetItem( arg, 0, PyInt_FromLong(but->retval - EXPP_BUTTON_EVENTS_OFFSET) );
- else
- PyTuple_SetItem( arg, 0, PyInt_FromLong(but->retval) );
-
- PyTuple_SetItem( arg, 1, pyvalue );
-
- result = PyObject_CallObject( callback, arg );
- Py_DECREF(arg);
-
- if (!result) {
- Py_DECREF(pyvalue);
- PyErr_Print( );
- error( "Python script error: check console" );
- }
- Py_XDECREF( result );
-}
-
-/*note that this function populates the drawbutton ref lists.*/
-static void set_pycallback(uiBut *ubut, PyObject *callback, Button *but)
-{
- PyObject *tuple;
- if (!callback || !PyCallable_Check(callback)) {
- if (M_Button_List && but) {
- PyList_Append(M_Button_List, (PyObject*)but);
- }
- return;
- }
-
- if (M_Button_List) {
- if (but) tuple = PyTuple_New(2);
- else tuple = PyTuple_New(1);
-
- /*the tuple API mandates this*/
- Py_XINCREF(callback);
- Py_XINCREF(but); /*this checks for NULL*/
-
- PyTuple_SET_ITEM(tuple, 0, callback);
- if (but) PyTuple_SET_ITEM(tuple, 1, (PyObject*)but);
-
- PyList_Append(M_Button_List, tuple);
- Py_DECREF(tuple); /*we have to do this to aovid double references.*/
-
- uiButSetFunc(ubut, exec_but_callback, callback, ubut);
- }
-}
-
-void BPy_Set_DrawButtonsList(void *list)
-{
- M_Button_List = list;
-}
-
-/*this MUST be called after doing UI stuff.*/
-void BPy_Free_DrawButtonsList(void)
-{
- /*Clear the list.*/
- if (M_Button_List) {
- PyList_SetSlice(M_Button_List, 0, PyList_Size(M_Button_List), NULL);
- Py_DECREF(M_Button_List);
- M_Button_List = NULL;
- }
-}
-
-static PyObject *Method_Exit( PyObject * self )
-{
- SpaceScript *sc;
- Script *script;
-
- /* if users call Draw.Exit when we are already out of the SPACE_SCRIPT, we
- * simply return, for compatibility */
- if( curarea->spacetype == SPACE_SCRIPT )
- sc = curarea->spacedata.first;
- else
- Py_RETURN_NONE;
-
- exit_pydraw( sc, 0 );
-
- script = sc->script;
-
- /* remove our lock to the current namespace */
- script->flags &= ~SCRIPT_GUI;
-
- Py_RETURN_NONE;
-}
-
-/* Method_Register (Draw.Register) registers callbacks for drawing, events
- * and gui button events, so a script can continue executing after the
- * interpreter reached its end and returned control to Blender. Everytime
- * the SPACE_SCRIPT window with this script is redrawn, the registered
- * callbacks are executed. */
-static PyObject *Method_Register( PyObject * self, PyObject * args )
-{
- PyObject *newdrawc = NULL, *neweventc = NULL, *newbuttonc = NULL;
- SpaceScript *sc;
- Script *script;
- int startspace = 0;
-
- if( !PyArg_ParseTuple
- ( args, "O|OO", &newdrawc, &neweventc, &newbuttonc ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected one or three PyObjects" );
-
- if( !PyCallable_Check( newdrawc ) )
- newdrawc = NULL;
- if( !PyCallable_Check( neweventc ) )
- neweventc = NULL;
- if( !PyCallable_Check( newbuttonc ) )
- newbuttonc = NULL;
-
- if( !( newdrawc || neweventc || newbuttonc ) )
- Py_RETURN_NONE;
-
- startspace = curarea->spacetype;
-
- /* first make sure the current area is of type SPACE_SCRIPT */
- if( startspace != SPACE_SCRIPT )
- newspace( curarea, SPACE_SCRIPT );
-
- sc = curarea->spacedata.first;
-
- /* There are two kinds of scripts:
- * a) those that simply run, finish and return control to Blender;
- * b) those that do like 'a)' above but leave callbacks for drawing,
- * events and button events, with this Method_Register (Draw.Register
- * in Python). These callbacks are called by scriptspaces (Scripts windows).
- *
- * We need to flag scripts that leave callbacks so their namespaces are
- * not deleted when they 'finish' execution, because the callbacks will
- * still need the namespace.
- */
-
- /* Let's see if this is a new script */
- script = G.main->script.first;
- while (script) {
- if (script->flags & SCRIPT_RUNNING) break;
- script = script->id.next;
- }
-
- if( !script ) {
- /* not new, it's a left callback calling Register again */
- script = sc->script;
- if( !script ) {
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "Draw.Register can't be used inside script links" );
- }
- }
- else sc->script = script;
-
- /* Now we have the right script and can set a lock so its namespace can't be
- * deleted for as long as we need it */
- script->flags |= SCRIPT_GUI;
-
- /* save the last space so we can go back to it upon finishing */
- if( !script->lastspace )
- script->lastspace = startspace;
-
- /* clean the old callbacks */
- exit_pydraw( sc, 0 );
-
- /* prepare the new ones and insert them */
- Py_XINCREF( newdrawc );
- Py_XINCREF( neweventc );
- Py_XINCREF( newbuttonc );
-
- script->py_draw = newdrawc;
- script->py_event = neweventc;
- script->py_button = newbuttonc;
-
- scrarea_queue_redraw( sc->area );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Method_Redraw( PyObject * self, PyObject * args )
-{
- int after = 0;
-
- if( !PyArg_ParseTuple( args, "|i", &after ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int argument (or nothing)" );
-
- if( after )
- addafterqueue( curarea->win, REDRAW, 1 );
- else
- scrarea_queue_winredraw( curarea );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Method_Draw( PyObject * self )
-{
- /*@ If forced drawing is disable queue a redraw event instead */
- if( EXPP_disable_force_draw ) {
- scrarea_queue_winredraw( curarea );
- Py_RETURN_NONE;
- }
-
- scrarea_do_windraw( curarea );
-
- screen_swapbuffers( );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Method_Create( PyObject * self, PyObject * args )
-{
- Button *but = NULL;
- PyObject *val;
- char *newstr;
-
- but = newbutton();
- /* If this function dosnt sucseed this will need to be deallocated,
- * make sure the type is NOT BSTRING_TYPE before deallocing -1 is ok.
- * so we dont dealloc with an uninitialized value wich would be bad! */
- if ( PyArg_ParseTuple( args, "fff", but->val.asvec, but->val.asvec+1, but->val.asvec+2 ) ) {
- but->type = BVECTOR_TYPE;
-
- } else if ( PyArg_ParseTuple( args, "O!", &PyFloat_Type, &val ) ) {
- but->val.asfloat = (float)PyFloat_AS_DOUBLE(val);
- but->type = BFLOAT_TYPE;
-
- } else if ( PyArg_ParseTuple( args, "O!", &PyInt_Type, &val ) ) {
- but->val.asint = (int)PyInt_AS_LONG(val);
- but->type = BINT_TYPE;
-
- } else if ( PyArg_ParseTuple( args, "s#", &newstr, &but->slen ) ) {
- if (but->slen + 1 > UI_MAX_DRAW_STR) {
- but->type = -1;
- Py_DECREF((PyObject *)but); /* will remove */
- but = NULL;
- PyErr_SetString( PyExc_TypeError, "string is longer then 399 chars");
- } else {
- but->type = BSTRING_TYPE;
- but->val.asstr = MEM_mallocN( but->slen + 1, "button string" );
- BLI_strncpy( but->val.asstr, newstr, but->slen+1 );
- }
-
- } else {
- but->type = -1;
- Py_DECREF((PyObject *)but); /* will remove */
- but = NULL;
- PyErr_SetString( PyExc_TypeError, "expected string, float, int or 3-float tuple argument" );
- }
-
- if (but != NULL) {
- PyErr_Clear();
- }
-
- return (PyObject*) but;
-}
-
-
-static PyObject *Method_UIBlock( PyObject * self, PyObject * args )
-{
- PyObject *val = NULL;
- PyObject *result = NULL;
- ListBase listb= {NULL, NULL};
-
- if ( !PyArg_ParseTuple( args, "O", &val ) || !PyCallable_Check( val ) )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected 1 python function and 2 ints" );
-
- if (uiblock)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "cannot run more then 1 UIBlock at a time" );
-
- BPy_Set_DrawButtonsList(PyList_New(0));
-
- mywinset(G.curscreen->mainwin);
- uiblock= uiNewBlock(&listb, "numbuts", UI_EMBOSS, UI_HELV, G.curscreen->mainwin);
-
- uiBlockSetFlag(uiblock, UI_BLOCK_LOOP|UI_BLOCK_REDRAW);
- result = PyObject_CallObject( val, Py_BuildValue( "()" ) );
-
- if (!result) {
- PyErr_Print( );
- error( "Python script error: check console" );
- } else {
- /* copied from do_clever_numbuts in toolbox.c */
-
- /* Clear all events so tooltips work, this is not ideal and
- only needed because calls from the menu still have some events
- left over when do_clever_numbuts is called.
- Calls from keyshortcuts do not have this problem.*/
- ScrArea *sa;
- BWinEvent temp_bevt;
- for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- if(sa->win) {
- while( bwin_qread( sa->win, &temp_bevt ) ) {}
- }
- if(sa->headwin) {
- while( bwin_qread( sa->headwin, &temp_bevt ) ) {}
- }
- }
- /* Done clearing events */
-
- uiBoundsBlock(uiblock, 5);
- uiDoBlocks(&listb, 0, 1);
- }
- uiFreeBlocks(&listb);
- uiblock = NULL;
- BPy_Free_DrawButtonsList(); /*clear all temp button references*/
-
- Py_XDECREF( result );
- Py_RETURN_NONE;
-}
-
-void Set_uiBlock(uiBlock *block)
-{
- uiblock = block;
-}
-
-static uiBlock *Get_uiBlock( void )
-{
- char butblock[32];
- /* Global, used now for UIBlock */
- if (uiblock) {
- return uiblock;
- }
- /* Local */
- sprintf( butblock, "win %d", curarea->win );
-
- return uiGetBlock( butblock, curarea );
-}
-
-
-/* We restrict the acceptable event numbers to a proper "free" range
- * according to other spaces in Blender.
- * winqread***space() (space events callbacks) use short for events
- * (called 'val' there) and we also translate by EXPP_BUTTON_EVENTS_OFFSET
- * to get rid of unwanted events (check BPY_do_pywin_events above for
- * explanation). This function takes care of that and proper checking: */
-static int check_button_event(int *event) {
- if ((*event < EXPP_BUTTON_EVENTS_MIN) ||
- (*event > EXPP_BUTTON_EVENTS_MAX)) {
- return -1;
- }
- if (uiblock==NULL) /* For UIBlock we need non offset UI elements */
- *event += EXPP_BUTTON_EVENTS_OFFSET;
- return 0;
-}
-
-static PyObject *Method_BeginAlign( PyObject * self, PyObject * args )
-{
- uiBlock *block = Get_uiBlock( );
-
- if (block)
- uiBlockBeginAlign(block);
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Method_EndAlign( PyObject * self, PyObject * args )
-{
- uiBlock *block = Get_uiBlock( );
-
- if (block)
- uiBlockEndAlign(block);
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Method_Button( PyObject * self, PyObject * args )
-{
- uiBlock *block;
- char *name, *tip = NULL;
- int event;
- int x, y, w, h;
- PyObject *callback=NULL;
-
- if( !PyArg_ParseTuple( args, "siiiii|sO", &name, &event,
- &x, &y, &w, &h, &tip, &callback ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a string, five ints and optionally string and callback arguments" );
-
- UI_METHOD_ERRORCHECK;
-
- block = Get_uiBlock( );
- if( block ) {
- uiBut *ubut = uiDefBut( block, BUT, event, name, (short)x, (short)y, (short)w, (short)h, 0, 0, 0, 0, 0, tip );
- set_pycallback(ubut, callback, NULL);
- }
- Py_RETURN_NONE;
-}
-
-static PyObject *Method_Menu( PyObject * self, PyObject * args )
-{
- uiBlock *block;
- char *name, *tip = NULL;
- int event, def;
- int x, y, w, h;
- Button *but;
- PyObject *callback=NULL;
-
- if( !PyArg_ParseTuple( args, "siiiiii|sO", &name, &event,
- &x, &y, &w, &h, &def, &tip, &callback ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a string, six ints and optionally string and callback arguments" );
-
- UI_METHOD_ERRORCHECK;
-
- but = newbutton( );
- but->type = BINT_TYPE;
- but->val.asint = def;
- if (tip) strncpy(but->tooltip, tip, BPY_MAX_TOOLTIP);
-
- block = Get_uiBlock( );
- if( block ) {
- uiBut *ubut = uiDefButI( block, MENU, event, name, (short)x, (short)y, (short)w, (short)h,
- &but->val.asint, 0, 0, 0, 0, but->tooltip );
- set_pycallback(ubut, callback, but);
- }
- return ( PyObject * ) but;
-}
-
-static PyObject *Method_Toggle( PyObject * self, PyObject * args )
-{
- uiBlock *block;
- char *name, *tip = NULL;
- int event;
- int x, y, w, h, def;
- Button *but;
- PyObject *callback=NULL;
-
- if( !PyArg_ParseTuple( args, "siiiiii|sO", &name, &event,
- &x, &y, &w, &h, &def, &tip, &callback ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a string, six ints and optionally string and callback arguments" );
-
- UI_METHOD_ERRORCHECK;
-
- but = newbutton( );
- but->type = BINT_TYPE;
- but->val.asint = def;
- if (tip) strncpy(but->tooltip, tip, BPY_MAX_TOOLTIP);
-
- block = Get_uiBlock( );
- if( block ) {
- uiBut *ubut = uiDefButI( block, TOG, event, name, (short)x, (short)y, (short)w, (short)h,
- &but->val.asint, 0, 0, 0, 0, but->tooltip );
- set_pycallback(ubut, callback, but);
- }
- return ( PyObject * ) but;
-}
-
-/*@DO NOT TOUCH THIS FUNCTION !
- Redrawing a slider inside its own callback routine is actually forbidden
- with the current toolkit architecture (button routines are not reentrant).
- But it works anyway.
- XXX This is condemned to be dinosource in future - it's a hack.
- */
-
-static void py_slider_update( void *butv, void *data2_unused )
-{
- uiBut *but = butv;
- PyObject *ref = Py_BuildValue( "(i)", SPACE_VIEW3D );
- PyObject *ret = NULL;
-
- EXPP_disable_force_draw = 1;
- /*@ Disable forced drawing, otherwise the button object which
- * is still being used might be deleted */
-
- curarea->win_swap = WIN_BACK_OK;
- /* removed global uiFrontBuf (contact ton when this goes wrong here) */
-
- disable_where_script( 1 );
-
- spacescript_do_pywin_buttons( curarea->spacedata.first,
- (unsigned short)uiButGetRetVal( but ) - EXPP_BUTTON_EVENTS_OFFSET );
-
- /* XXX useless right now, investigate better before a bcon 5 */
- ret = M_Window_Redraw( 0, ref );
-
- Py_XDECREF(ref);
- Py_XDECREF(ret);
-
- disable_where_script( 0 );
-
- EXPP_disable_force_draw = 0;
-}
-
-static PyObject *Method_Slider( PyObject * self, PyObject * args )
-{
- uiBlock *block;
- char *name, *tip = NULL;
- int event;
- int x, y, w, h, realtime = 1;
- Button *but;
- PyObject *mino, *maxo, *inio;
- PyObject *callback=NULL;
-
- if( !PyArg_ParseTuple( args, "siiiiiOOO|isO", &name, &event,
- &x, &y, &w, &h, &inio, &mino, &maxo, &realtime,
- &tip, &callback ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a string, five ints, three PyObjects\n\
- and optionally int, string and callback arguments" );
-
- if(realtime && uiblock)
- realtime = 0; /* realtime dosnt work with UIBlock */
-
- UI_METHOD_ERRORCHECK;
-
- but = newbutton( );
-
- if( PyFloat_Check( inio ) ) {
- float ini, min, max;
-
- ini = (float)PyFloat_AsDouble( inio );
- min = (float)PyFloat_AsDouble( mino );
- max = (float)PyFloat_AsDouble( maxo );
-
- but->type = BFLOAT_TYPE;
- but->val.asfloat = ini;
- if (tip) strncpy(but->tooltip, tip, BPY_MAX_TOOLTIP);
-
- block = Get_uiBlock( );
- if( block ) {
- uiBut *ubut;
- ubut = uiDefButF( block, NUMSLI, event, name, (short)x, (short)y, (short)w,
- (short)h, &but->val.asfloat, min, max, 0, 0,
- but->tooltip );
- if( realtime )
- uiButSetFunc( ubut, py_slider_update, ubut, NULL );
- else
- set_pycallback(ubut, callback, but);
- }
- } else {
- int ini, min, max;
-
- ini = PyInt_AsLong( inio );
- min = PyInt_AsLong( mino );
- max = PyInt_AsLong( maxo );
-
- but->type = BINT_TYPE;
- but->val.asint = ini;
- if (tip) strncpy(but->tooltip, tip, BPY_MAX_TOOLTIP);
-
- block = Get_uiBlock( );
- if( block ) {
- uiBut *ubut;
- ubut = uiDefButI( block, NUMSLI, event, name, (short)x, (short)y, (short)w,
- (short)h, &but->val.asint, (float)min, (float)max, 0, 0,
- but->tooltip );
- if( realtime )
- uiButSetFunc( ubut, py_slider_update, ubut, NULL );
- else
- set_pycallback(ubut, callback, but);
- }
- }
- return ( PyObject * ) but;
-}
-
-static PyObject *Method_Scrollbar( PyObject * self, PyObject * args )
-{
- char *tip = NULL;
- uiBlock *block;
- int event;
- int x, y, w, h, realtime = 1;
- Button *but;
- PyObject *mino, *maxo, *inio;
- float ini, min, max;
- uiBut *ubut;
-
- if( !PyArg_ParseTuple( args, "iiiiiOOO|isO", &event, &x, &y, &w, &h,
- &inio, &mino, &maxo, &realtime, &tip ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected five ints, three PyObjects and optionally\n\
-another int and string as arguments" );
-
- if( !PyNumber_Check( inio ) || !PyNumber_Check( inio )
- || !PyNumber_Check( inio ) )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected numbers for initial, min, and max" );
-
- if (check_button_event(&event) == -1)
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "button event argument must be in the range [0, 16382]");
-
- but = newbutton( );
- if (tip) strncpy(but->tooltip, tip, BPY_MAX_TOOLTIP);
-
- if( PyFloat_Check( inio ) )
- but->type = BFLOAT_TYPE;
- else
- but->type = BINT_TYPE;
-
- ini = (float)PyFloat_AsDouble( inio );
- min = (float)PyFloat_AsDouble( mino );
- max = (float)PyFloat_AsDouble( maxo );
-
- block = Get_uiBlock( );
-
- if( block ) {
- if( but->type == BFLOAT_TYPE ) {
- but->val.asfloat = ini;
- ubut = uiDefButF( block, SCROLL, event, "", (short)x, (short)y, (short)w, (short)h,
- &but->val.asfloat, min, max, 0, 0, but->tooltip );
- if( realtime )
- uiButSetFunc( ubut, py_slider_update, ubut, NULL );
- } else {
- but->val.asint = (int)ini;
- ubut = uiDefButI( block, SCROLL, event, "", (short)x, (short)y, (short)w, (short)h,
- &but->val.asint, min, max, 0, 0, but->tooltip );
- if( realtime )
- uiButSetFunc( ubut, py_slider_update, ubut, NULL );
- }
- }
- return ( PyObject * ) but;
-}
-
-static PyObject *Method_ColorPicker( PyObject * self, PyObject * args )
-{
- char USAGE_ERROR[] = "expected a 3-float tuple of values between 0 and 1";
- Button *but;
- PyObject *inio;
- uiBlock *block;
- char *tip = NULL;
- float col[3];
- int event;
- short x, y, w, h;
- PyObject *callback=NULL;
-
- if( !PyArg_ParseTuple( args, "ihhhhO!|sO", &event,
- &x, &y, &w, &h, &PyTuple_Type, &inio, &tip, &callback ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected five ints, one tuple and optionally string and callback arguments" );
-
- UI_METHOD_ERRORCHECK;
-
- if ( !PyArg_ParseTuple( inio, "fff", col, col+1, col+2 ) )
- return EXPP_ReturnPyObjError( PyExc_ValueError, USAGE_ERROR);
-
- if ( col[0] < 0 || col[0] > 1
- || col[1] < 0 || col[1] > 1
- || col[2] < 0 || col[2] > 1 )
- return EXPP_ReturnPyObjError( PyExc_ValueError, USAGE_ERROR);
-
- if ( EXPP_check_sequence_consistency( inio, &PyFloat_Type ) != 1 )
- return EXPP_ReturnPyObjError( PyExc_ValueError, USAGE_ERROR);
-
- but = newbutton();
-
- but->type = BVECTOR_TYPE;
- but->val.asvec[0] = col[0];
- but->val.asvec[1] = col[1];
- but->val.asvec[2] = col[2];
- if (tip) strncpy(but->tooltip, tip, BPY_MAX_TOOLTIP);
-
- block = Get_uiBlock( );
- if( block ) {
- uiBut *ubut;
- ubut = uiDefButF( block, COL, event, "", x, y, w, h, but->val.asvec, 0, 0, 0, 0, but->tooltip);
- set_pycallback(ubut, callback, but);
- }
-
- return ( PyObject * ) but;
-}
-
-
-
-static PyObject *Method_Normal( PyObject * self, PyObject * args )
-{
- char USAGE_ERROR[] = "expected a 3-float tuple of values between -1 and 1";
- Button *but;
- PyObject *inio;
- uiBlock *block;
- char *tip = NULL;
- float nor[3];
- int event;
- short x, y, w, h;
- PyObject *callback=NULL;
-
- if( !PyArg_ParseTuple( args, "ihhhhO!|sO", &event,
- &x, &y, &w, &h, &PyTuple_Type, &inio, &tip, &callback ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected five ints, one tuple and optionally string and callback arguments" );
-
- UI_METHOD_ERRORCHECK;
-
- if ( !PyArg_ParseTuple( inio, "fff", nor, nor+1, nor+2 ) )
- return EXPP_ReturnPyObjError( PyExc_ValueError, USAGE_ERROR);
-
- if ( EXPP_check_sequence_consistency( inio, &PyFloat_Type ) != 1 )
- return EXPP_ReturnPyObjError( PyExc_ValueError, USAGE_ERROR);
-
- but = newbutton();
- if (tip) strncpy(but->tooltip, tip, BPY_MAX_TOOLTIP);
-
- but->type = BVECTOR_TYPE;
- but->val.asvec[0] = nor[0];
- but->val.asvec[1] = nor[1];
- but->val.asvec[2] = nor[2];
-
- block = Get_uiBlock( );
- if( block ) {
- uiBut *ubut;
- ubut = uiDefButF( block, BUT_NORMAL, event, "", x, y, w, h, but->val.asvec, 0.0f, 1.0f, 0, 0, but->tooltip);
- set_pycallback(ubut, callback, but);
- }
-
- return ( PyObject * ) but;
-}
-
-static PyObject *Method_Number( PyObject * self, PyObject * args )
-{
- uiBlock *block;
- char *name, *tip = NULL;
- int event;
- int x, y, w, h;
- Button *but;
- PyObject *mino, *maxo, *inio;
- PyObject *callback=NULL;
- uiBut *ubut= NULL;
-
- if( !PyArg_ParseTuple( args, "siiiiiOOO|sO", &name, &event,
- &x, &y, &w, &h, &inio, &mino, &maxo, &tip, &callback ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a string, five ints, three PyObjects and\n\
- optionally string and callback arguments" );
-
- UI_METHOD_ERRORCHECK;
-
- but = newbutton( );
- if (tip) strncpy(but->tooltip, tip, BPY_MAX_TOOLTIP);
- block = Get_uiBlock( );
-
- if( PyFloat_Check( inio ) ) {
- float ini, min, max, range, precission=0;
-
- ini = (float)PyFloat_AsDouble( inio );
- min = (float)PyFloat_AsDouble( mino );
- max = (float)PyFloat_AsDouble( maxo );
-
- range= (float)fabs(max-min); /* Click step will be a 10th of the range. */
- if (!range) range= 1.0f; /* avoid any odd errors */
-
- /* set the precission to display*/
- if (range>=1000.0f) precission=1.0f;
- else if (range>=100.0f) precission=2.0f;
- else if (range>=10.0f) precission=3.0f;
- else precission=4.0f;
-
- but->type = BFLOAT_TYPE;
- but->val.asfloat = ini;
-
-
- if( block )
- ubut= uiDefButF( block, NUM, event, name, (short)x, (short)y, (short)w, (short)h,
- &but->val.asfloat, min, max, 10*range, precission, but->tooltip );
- } else {
- int ini, min, max;
-
- ini = PyInt_AsLong( inio );
- min = PyInt_AsLong( mino );
- max = PyInt_AsLong( maxo );
-
- but->type = BINT_TYPE;
- but->val.asint = ini;
-
- if( block )
- ubut= uiDefButI( block, NUM, event, name, (short)x, (short)y, (short)w, (short)h,
- &but->val.asint, (float)min, (float)max, 0, 0, but->tooltip );
- }
-
- if (ubut) set_pycallback(ubut, callback, but);
-
- return ( PyObject * ) but;
-}
-
-static PyObject *Method_String( PyObject * self, PyObject * args )
-{
- uiBlock *block;
- char *info_arg = NULL, *tip = NULL, *newstr = NULL;
- char *info_str = NULL, *info_str0 = " ";
- int event;
- int x, y, w, h, len, real_len = 0;
- Button *but;
- PyObject *callback=NULL;
-
- if( !PyArg_ParseTuple( args, "siiiiisi|sO", &info_arg, &event,
- &x, &y, &w, &h, &newstr, &len, &tip, &callback ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a string, five ints, a string, an int and\n\
- optionally string and callback arguments" );
-
- UI_METHOD_ERRORCHECK;
-
- if (len > (UI_MAX_DRAW_STR - 1))
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "The maximum length of a string is 399, your value is too high.");
-
- real_len = strlen(newstr);
- if (real_len > len) real_len = len;
-
- but = newbutton( );
- but->type = BSTRING_TYPE;
- but->slen = len;
- but->val.asstr = MEM_mallocN( len + 1, "pybutton str" );
- if (tip) strncpy(but->tooltip, tip, BPY_MAX_TOOLTIP);
-
- BLI_strncpy( but->val.asstr, newstr, len + 1); /* adds '\0' */
- but->val.asstr[real_len] = '\0';
-
- if (info_arg[0] == '\0') info_str = info_str0;
- else info_str = info_arg;
-
- block = Get_uiBlock( );
- if( block ) {
- uiBut *ubut = uiDefBut( block, TEX, event, info_str, (short)x, (short)y, (short)w, (short)h,
- but->val.asstr, 0, (float)len, 0, 0, but->tooltip );
- set_pycallback(ubut, callback, but);
- }
- return ( PyObject * ) but;
-}
-
-static PyObject *Method_GetStringWidth( PyObject * self, PyObject * args )
-{
- char *text;
- char *font_str = "normal";
- struct BMF_Font *font;
- PyObject *width;
-
- if( !PyArg_ParseTuple( args, "s|s", &text, &font_str ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected one or two string arguments" );
-
- if( !strcmp( font_str, "normal" ) )
- font = ( &G )->font;
- else if( !strcmp( font_str, "large" ) )
- font = BMF_GetFont(BMF_kScreen15);
- else if( !strcmp( font_str, "small" ) )
- font = ( &G )->fonts;
- else if( !strcmp( font_str, "tiny" ) )
- font = ( &G )->fontss;
- else
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "\"font\" must be: 'large', 'normal' (default), 'small' or 'tiny'." );
-
- width = PyInt_FromLong( BMF_GetStringWidth( font, text ) );
-
- if( !width )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create PyInt" );
-
- return width;
-}
-
-static PyObject *Method_Text( PyObject * self, PyObject * args )
-{
- char *text;
- char *font_str = NULL;
- struct BMF_Font *font;
-
- if( !PyArg_ParseTuple( args, "s|s", &text, &font_str ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected one or two string arguments" );
-
- if( !font_str )
- font = ( &G )->font;
- else if( !strcmp( font_str, "large" ) )
- font = BMF_GetFont(BMF_kScreen15);
- else if( !strcmp( font_str, "normal" ) )
- font = ( &G )->font;
- else if( !strcmp( font_str, "small" ) )
- font = ( &G )->fonts;
- else if( !strcmp( font_str, "tiny" ) )
- font = ( &G )->fontss;
- else
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "\"font\" must be: 'normal' (default), 'large', 'small' or 'tiny'." );
-
- BMF_DrawString( font, text );
-
- return PyInt_FromLong( BMF_GetStringWidth( font, text ) );
-}
-
-static PyObject *Method_Label( PyObject * self, PyObject * args )
-{
- uiBlock *block;
- char *text;
- int x, y, w, h;
-
- if( !PyArg_ParseTuple( args, "siiii", &text, &x, &y, &w, &h ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a string and four ints" );
-
- block = Get_uiBlock( );
- uiDefBut(block, LABEL, 0, text, x, y, w, h, 0, 0, 0, 0, 0, "");
-
- Py_RETURN_NONE;
-}
-
-
-static PyObject *Method_PupMenu( PyObject * self, PyObject * args )
-{
- char *text;
- int maxrow = -1;
- PyObject *ret;
-
- if( !PyArg_ParseTuple( args, "s|i", &text, &maxrow ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a string and optionally an int as arguments" );
-
- if( maxrow >= 0 )
- ret = PyInt_FromLong( pupmenu_col( text, maxrow ) );
- else
- ret = PyInt_FromLong( pupmenu( text ) );
-
- if( ret )
- return ret;
-
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create a PyInt" );
-}
-
-static PyObject *Method_PupIntInput( PyObject * self, PyObject * args )
-{
- char *text = NULL;
- int min = 0, max = 1;
- short var = 0;
- PyObject *ret = NULL;
-
- if( !PyArg_ParseTuple( args, "s|hii", &text, &var, &min, &max ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected 1 string and 3 int arguments" );
-
- if( button( &var, (short)min, (short)max, text ) == 0 ) {
- Py_INCREF( Py_None );
- return Py_None;
- }
- ret = PyInt_FromLong( var );
- if( ret )
- return ret;
-
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create a PyInt" );
-}
-
-static PyObject *Method_PupFloatInput( PyObject * self, PyObject * args )
-{
- char *text = NULL;
- float min = 0, max = 1, var = 0, a1 = 10, a2 = 2;
- PyObject *ret = NULL;
-
- if( !PyArg_ParseTuple
- ( args, "s|fffff", &text, &var, &min, &max, &a1, &a2 ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected 1 string and 5 float arguments" );
-
- if( fbutton( &var, min, max, a1, a2, text ) == 0 ) {
- Py_INCREF( Py_None );
- return Py_None;
- }
- ret = PyFloat_FromDouble( var );
- if( ret )
- return ret;
-
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create a PyFloat" );
-}
-
-static PyObject *Method_PupStrInput( PyObject * self, PyObject * args )
-{
- char *text = NULL, *textMsg = NULL;
- char tmp[101];
- char max = 20;
- PyObject *ret = NULL;
-
- if( !PyArg_ParseTuple( args, "ss|b", &textMsg, &text, &max ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected 2 strings and 1 int" );
-
- if( ( max <= 0 ) || ( max > 100 ) )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "max string length value must be in the range [1, 100]." );
-
- /* copying the text string handles both cases:
- * max < strlen(text) (by truncating) and
- * max > strlen(text) (by expanding to strlen(tmp)) */
- BLI_strncpy( tmp, text, max + 1 );
-
- if( sbutton( tmp, 0, max, textMsg ) == 0 ) {
- Py_INCREF( Py_None );
- return Py_None;
- }
-
- ret = PyString_FromString( tmp );
-
- if( ret )
- return ret;
-
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create a PyString" );
-}
-
-static PyObject *Method_PupBlock( PyObject * self, PyObject * args )
-{
- PyObject *pyList, *pyItem;
- float min, max;
- int len, i;
- char *title;
-
- if (!PyArg_ParseTuple( args, "sO", &title, &pyList ) || !PySequence_Check( pyList ))
- return EXPP_ReturnPyObjError( PyExc_TypeError, "expected a string and a sequence" );
-
-
- len = PySequence_Length(pyList);
-
- if (len == 0)
- return EXPP_ReturnPyObjError( PyExc_ValueError, "expected a string and a non-empty sequence." );
-
- if (len > 120) /* LIMIT DEFINED IN toolbox.c */
- return EXPP_ReturnPyObjError( PyExc_ValueError, "sequence cannot have more than 120 elements" );
-
- for ( i=0 ; i<len ; i++ ) {
- PyObject *pyMin = NULL, *pyMax = NULL;
- PyObject *f1, *f2;
- Button *but = NULL;
- int tlen;
- char *text, *tip = NULL;
-
- pyItem = PySequence_GetItem( pyList, i );
- if (!pyItem)
- return NULL;
-
- if (PyString_Check( pyItem )) {
- tlen = -2; /* single string for label, giving it a special len for later */
- }
- else if (PyTuple_Check( pyItem )) {
- /* tuple for other button, get the length for later */
- tlen = PyTuple_Size( pyItem );
- }
- else {
- /* Neither a string or a tuple, error */
- Py_DECREF( pyItem );
- return EXPP_ReturnPyObjError( PyExc_ValueError, "expected a string or a tuple containing 2 to 5 values." );
- }
-
- switch (tlen) {
- case -2: /* LABEL */
- text = PyString_AsString( pyItem );
- add_numbut(i, LABEL, text, 0, 0, NULL, NULL);
- break;
- case 2: /* TOGGLE (no tooltip) */
- case 3: /* TOGGLE */
- if (!PyArg_ParseTuple( pyItem, "sO!|s", &text, &Button_Type, &but, &tip )) {
- Py_DECREF( pyItem );
- return EXPP_ReturnPyObjError( PyExc_ValueError, "expected a tuple containing a string, a Button object and optionally a string for toggles" );
- }
-
- if (but->type != BINT_TYPE) {
- Py_DECREF( pyItem );
- return EXPP_ReturnPyObjError( PyExc_ValueError, "Button object for toggles should hold an integer" );
- }
-
- add_numbut(i, TOG|INT, text, 0, 0, &but->val.asint, tip);
- break;
- case 4: /* TEX and NUM (no tooltip) */
- case 5: /* TEX and NUM */
- if (!PyArg_ParseTuple( pyItem, "sO!OO|s", &text, &Button_Type, &but, &pyMin, &pyMax, &tip )) {
- Py_DECREF( pyItem );
- return EXPP_ReturnPyObjError( PyExc_ValueError, "expected a tuple containing a string, a Button object, two numerical values and optionally a string for Text and Num buttons" );
- }
-
- f1 = PyNumber_Float(pyMin);
- f2 = PyNumber_Float(pyMax);
-
- if (!f1 || !f2) {
- Py_DECREF( pyItem );
- return EXPP_ReturnPyObjError( PyExc_ValueError, "expected a tuple containing a string, a Button object, two numerical values and optionally a string for Text and Num buttons" );
- }
-
- min = (float)PyFloat_AS_DOUBLE(f1);
- max = (float)PyFloat_AS_DOUBLE(f2);
- Py_DECREF( f1 );
- Py_DECREF( f2 );
-
- switch ( but->type ) {
- case BINT_TYPE:
- add_numbut(i, NUM|INT, text, min, max, &but->val.asint, tip);
- break;
- case BFLOAT_TYPE:
- add_numbut(i, NUM|FLO, text, min, max, &but->val.asfloat, tip);
- break;
- case BSTRING_TYPE:
- if (max+1>UI_MAX_DRAW_STR) {
- Py_DECREF( pyItem );
- return EXPP_ReturnPyObjError( PyExc_ValueError, "length of a string buttons must be less then 400" );
- }
- max = (float)floor(max);
-
- if (max > but->slen) {
- int old_len = but->slen;
- char *old_str = but->val.asstr;
- but->slen = (int)max;
- but->val.asstr = MEM_callocN( but->slen + 1, "button pupblock");
- BLI_strncpy( but->val.asstr, old_str, old_len + 1 );
- MEM_freeN(old_str);
- }
-
- add_numbut(i, TEX, text, 0.0f, max, but->val.asstr, tip);
- }
-
- break;
- default:
- Py_DECREF( pyItem );
- return EXPP_ReturnPyObjError( PyExc_ValueError, "expected a string or a tuple containing 2 to 5 values." );
- }
- Py_DECREF( pyItem );
- }
-
- if (do_clever_numbuts(title, len, REDRAW))
- return EXPP_incr_ret_True();
- else
- return EXPP_incr_ret_False();
-}
-
-
-/*****************************************************************************
- * Function: Method_Image *
- * Python equivalent: Blender.Draw.Image *
- * *
- * @author Jonathan Merritt <j.merritt@pgrad.unimelb.edu.au> *
- ****************************************************************************/
-static PyObject *Method_Image( PyObject * self, PyObject * args )
-{
- PyObject *pyObjImage;
- BPy_Image *py_img;
- Image *image;
- ImBuf *ibuf;
- float originX, originY;
- float zoomX = 1.0, zoomY = 1.0;
- int clipX = 0, clipY = 0, clipW = -1, clipH = -1;
- /*GLfloat scissorBox[4];*/
-
- /* parse the arguments passed-in from Python */
- if( !PyArg_ParseTuple( args, "Off|ffiiii", &pyObjImage,
- &originX, &originY, &zoomX, &zoomY,
- &clipX, &clipY, &clipW, &clipH ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a Blender.Image and 2 floats, and " \
- "optionally 2 floats and 4 ints as arguments" );
- /* check that the first PyObject is actually a Blender.Image */
- if( !BPy_Image_Check( pyObjImage ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a Blender.Image and 2 floats, and " \
- "optionally 2 floats and 4 ints as arguments" );
- /* check that the zoom factors are valid */
- if( ( zoomX <= 0.0 ) || ( zoomY <= 0.0 ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "invalid zoom factors - they must be >= 0.0" );
-
- /* fetch a C Image pointer from the passed-in Python object */
- py_img = ( BPy_Image * ) pyObjImage;
- image = py_img->image;
- ibuf = BKE_image_get_ibuf( image, NULL );
-
- if( !ibuf ) /* if failed to load the image */
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't load image data in Blender" );
- if( !ibuf->rect ) /* no float yet */
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "Image has no byte rect" );
-
- /* Update the time tag of the image */
- tag_image_time(image);
-
- /* set up a valid clipping rectangle. if no clip rectangle was
- * given, this results in inclusion of the entire image. otherwise,
- * the clipping is just checked against the bounds of the image.
- * if clipW or clipH are less than zero then they include as much of
- * the image as they can. */
- clipX = EXPP_ClampInt( clipX, 0, ibuf->x );
- clipY = EXPP_ClampInt( clipY, 0, ibuf->y );
- if( ( clipW < 0 ) || ( clipW > ( ibuf->x - clipW ) ) )
- clipW = ibuf->x - clipX;
- if( ( clipH < 0 ) || ( clipH > ( ibuf->y - clipH ) ) )
- clipH = ibuf->y - clipY;
-
- /* -- we are "Go" to Draw! -- */
-
- /* set the raster position.
- *
- * If the raster position is negative, then using glRasterPos2i()
- * directly would cause it to be clipped. Instead, we first establish
- * a valid raster position within the clipping rectangle of the
- * window and then use glBitmap() with a NULL image pointer to offset
- * it to the true position we require. To pick an initial valid
- * raster position within the viewport, we query the clipping rectangle
- * and use its lower-left pixel.
- *
- * This particular technique is documented in the glRasterPos() man
- * page, although I haven't seen it used elsewhere in Blender.
- */
-
- /* update (W): to fix a bug where images wouldn't get drawn if the bottom
- * left corner of the Scripts win were above a given height or to the right
- * of a given width, the code below is being commented out. It should not
- * be needed anyway, because spaces in Blender are projected to lie inside
- * their areas, see src/drawscript.c for example. Note: the
- * glaRasterPosSafe2i function in src/glutil.c does use the commented out
- * technique, but with 0,0 instead of scissorBox. This function can be
- * a little optimized, based on glaDrawPixelsSafe in that same fine, but
- * we're too close to release 2.37 right now. */
- /*
- glGetFloatv( GL_SCISSOR_BOX, scissorBox );
- glRasterPos2i( scissorBox[0], scissorBox[1] );
- glBitmap( 0, 0, 0.0, 0.0,
- originX-scissorBox[0], originY-scissorBox[1], NULL );
- */
-
- /* update (cont.): using these two lines instead:
- * (based on glaRasterPosSafe2i, but Ken Hughes deserves credit
- * for suggesting this exact fix in the bug tracker) */
- glRasterPos2i(0, 0);
- glBitmap( 0, 0, 0.0, 0.0, originX, originY, NULL );
-
- /* set the zoom */
- glPixelZoom( zoomX, zoomY );
-
- /* set the width of the image (ROW_LENGTH), and the offset to the
- * clip origin within the image in x (SKIP_PIXELS) and
- * y (SKIP_ROWS) */
- glPixelStorei( GL_UNPACK_ROW_LENGTH, ibuf->x );
- glPixelStorei( GL_UNPACK_SKIP_PIXELS, clipX );
- glPixelStorei( GL_UNPACK_SKIP_ROWS, clipY );
-
- /* draw the image */
- glDrawPixels( clipW, clipH, GL_RGBA, GL_UNSIGNED_BYTE,
- ibuf->rect );
-
- /* restore the defaults for some parameters (we could also use a
- * glPushClientAttrib() and glPopClientAttrib() pair). */
- glPixelZoom( 1.0, 1.0 );
- glPixelStorei( GL_UNPACK_SKIP_ROWS, 0 );
- glPixelStorei( GL_UNPACK_SKIP_PIXELS, 0 );
- glPixelStorei( GL_UNPACK_ROW_LENGTH, 0 );
-
- Py_INCREF( Py_None );
- return Py_None;
-
-}
-
-PyObject *Draw_Init( void )
-{
- PyObject *submodule, *dict;
-
- if( PyType_Ready( &Button_Type) < 0)
- Py_RETURN_NONE;
-
- submodule = Py_InitModule3( "Blender.Draw", Draw_methods, Draw_doc );
-
- dict = PyModule_GetDict( submodule );
-
-#define EXPP_ADDCONST(x) \
- EXPP_dict_set_item_str(dict, #x, PyInt_FromLong(x))
-
- /* So, for example:
- * EXPP_ADDCONST(LEFTMOUSE) becomes
- * EXPP_dict_set_item_str(dict, "LEFTMOUSE", PyInt_FromLong(LEFTMOUSE))
- */
-
- EXPP_ADDCONST( LEFTMOUSE );
- EXPP_ADDCONST( MIDDLEMOUSE );
- EXPP_ADDCONST( RIGHTMOUSE );
- EXPP_ADDCONST( WHEELUPMOUSE );
- EXPP_ADDCONST( WHEELDOWNMOUSE );
- EXPP_ADDCONST( MOUSEX );
- EXPP_ADDCONST( MOUSEY );
- EXPP_ADDCONST( TIMER0 );
- EXPP_ADDCONST( TIMER1 );
- EXPP_ADDCONST( TIMER2 );
- EXPP_ADDCONST( TIMER3 );
- EXPP_ADDCONST( KEYBD );
- EXPP_ADDCONST( RAWKEYBD );
- EXPP_ADDCONST( REDRAW );
- EXPP_ADDCONST( INPUTCHANGE );
- EXPP_ADDCONST( QFULL );
- EXPP_ADDCONST( WINFREEZE );
- EXPP_ADDCONST( WINTHAW );
- EXPP_ADDCONST( WINCLOSE );
- EXPP_ADDCONST( WINQUIT );
-#ifndef IRISGL
- EXPP_ADDCONST( Q_FIRSTTIME );
-#endif
- EXPP_ADDCONST( AKEY );
- EXPP_ADDCONST( BKEY );
- EXPP_ADDCONST( CKEY );
- EXPP_ADDCONST( DKEY );
- EXPP_ADDCONST( EKEY );
- EXPP_ADDCONST( FKEY );
- EXPP_ADDCONST( GKEY );
- EXPP_ADDCONST( HKEY );
- EXPP_ADDCONST( IKEY );
- EXPP_ADDCONST( JKEY );
- EXPP_ADDCONST( KKEY );
- EXPP_ADDCONST( LKEY );
- EXPP_ADDCONST( MKEY );
- EXPP_ADDCONST( NKEY );
- EXPP_ADDCONST( OKEY );
- EXPP_ADDCONST( PKEY );
- EXPP_ADDCONST( QKEY );
- EXPP_ADDCONST( RKEY );
- EXPP_ADDCONST( SKEY );
- EXPP_ADDCONST( TKEY );
- EXPP_ADDCONST( UKEY );
- EXPP_ADDCONST( VKEY );
- EXPP_ADDCONST( WKEY );
- EXPP_ADDCONST( XKEY );
- EXPP_ADDCONST( YKEY );
- EXPP_ADDCONST( ZKEY );
- EXPP_ADDCONST( ZEROKEY );
- EXPP_ADDCONST( ONEKEY );
- EXPP_ADDCONST( TWOKEY );
- EXPP_ADDCONST( THREEKEY );
- EXPP_ADDCONST( FOURKEY );
- EXPP_ADDCONST( FIVEKEY );
- EXPP_ADDCONST( SIXKEY );
- EXPP_ADDCONST( SEVENKEY );
- EXPP_ADDCONST( EIGHTKEY );
- EXPP_ADDCONST( NINEKEY );
- EXPP_ADDCONST( CAPSLOCKKEY );
- EXPP_ADDCONST( LEFTCTRLKEY );
- EXPP_ADDCONST( LEFTALTKEY );
- EXPP_ADDCONST( RIGHTALTKEY );
- EXPP_ADDCONST( RIGHTCTRLKEY );
- EXPP_ADDCONST( RIGHTSHIFTKEY );
- EXPP_ADDCONST( LEFTSHIFTKEY );
- EXPP_ADDCONST( ESCKEY );
- EXPP_ADDCONST( TABKEY );
- EXPP_ADDCONST( RETKEY );
- EXPP_ADDCONST( SPACEKEY );
- EXPP_ADDCONST( LINEFEEDKEY );
- EXPP_ADDCONST( BACKSPACEKEY );
- EXPP_ADDCONST( DELKEY );
- EXPP_ADDCONST( SEMICOLONKEY );
- EXPP_ADDCONST( PERIODKEY );
- EXPP_ADDCONST( COMMAKEY );
- EXPP_ADDCONST( QUOTEKEY );
- EXPP_ADDCONST( ACCENTGRAVEKEY );
- EXPP_ADDCONST( MINUSKEY );
- EXPP_ADDCONST( SLASHKEY );
- EXPP_ADDCONST( BACKSLASHKEY );
- EXPP_ADDCONST( EQUALKEY );
- EXPP_ADDCONST( LEFTBRACKETKEY );
- EXPP_ADDCONST( RIGHTBRACKETKEY );
- EXPP_ADDCONST( LEFTARROWKEY );
- EXPP_ADDCONST( DOWNARROWKEY );
- EXPP_ADDCONST( RIGHTARROWKEY );
- EXPP_ADDCONST( UPARROWKEY );
- EXPP_ADDCONST( PAD2 );
- EXPP_ADDCONST( PAD4 );
- EXPP_ADDCONST( PAD6 );
- EXPP_ADDCONST( PAD8 );
- EXPP_ADDCONST( PAD1 );
- EXPP_ADDCONST( PAD3 );
- EXPP_ADDCONST( PAD5 );
- EXPP_ADDCONST( PAD7 );
- EXPP_ADDCONST( PAD9 );
- EXPP_ADDCONST( PADPERIOD );
- EXPP_ADDCONST( PADSLASHKEY );
- EXPP_ADDCONST( PADASTERKEY );
- EXPP_ADDCONST( PAD0 );
- EXPP_ADDCONST( PADMINUS );
- EXPP_ADDCONST( PADENTER );
- EXPP_ADDCONST( PADPLUSKEY );
- EXPP_ADDCONST( F1KEY );
- EXPP_ADDCONST( F2KEY );
- EXPP_ADDCONST( F3KEY );
- EXPP_ADDCONST( F4KEY );
- EXPP_ADDCONST( F5KEY );
- EXPP_ADDCONST( F6KEY );
- EXPP_ADDCONST( F7KEY );
- EXPP_ADDCONST( F8KEY );
- EXPP_ADDCONST( F9KEY );
- EXPP_ADDCONST( F10KEY );
- EXPP_ADDCONST( F11KEY );
- EXPP_ADDCONST( F12KEY );
- EXPP_ADDCONST( PAUSEKEY );
- EXPP_ADDCONST( INSERTKEY );
- EXPP_ADDCONST( HOMEKEY );
- EXPP_ADDCONST( PAGEUPKEY );
- EXPP_ADDCONST( PAGEDOWNKEY );
- EXPP_ADDCONST( ENDKEY );
-
- return submodule;
-}
diff --git a/source/blender/python/api2_2x/Draw.h b/source/blender/python/api2_2x/Draw.h
deleted file mode 100644
index a78b19b0ebd..00000000000
--- a/source/blender/python/api2_2x/Draw.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * $Id: Draw.h 11387 2007-07-27 06:14:25Z joeedh $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-/* The code in Draw.[ch] and BGL.[ch] comes from opy_draw.c in the old
- * bpython/intern dir, with minor modifications to suit the current
- * implementation. Important original comments are marked with an @ symbol. */
-
-#ifndef EXPP_DRAW_H_
-#define EXPP_DRAW_H_
-
-#include <Python.h>
-#include "DNA_space_types.h"
-#include "DNA_text_types.h"
-
-void initDraw( void );
-
-/*
- * Button Object stuct
- */
-
-typedef struct _Button {
- PyObject_VAR_HEAD /* required Py Macro */
- int type; /*@ 1 == int, 2 == float, 3 == string */
- unsigned int slen; /*@ length of string (if type == 3) */
- union {
- int asint;
- float asfloat;
- char *asstr;
- float asvec[3];
- } val;
- char tooltip[256];
-} Button;
-
-#define BPY_MAX_TOOLTIP 255
-
-#define BINT_TYPE 1
-#define BFLOAT_TYPE 2
-#define BSTRING_TYPE 3
-#define BVECTOR_TYPE 4
-
-/*
- * these are declared in ../BPY_extern.h
-*/
-
-PyObject *M_Draw_Init( void );
-PyObject *Draw_Init( void );
-
-#endif /* EXPP_DRAW_H */
diff --git a/source/blender/python/api2_2x/EXPP_interface.c b/source/blender/python/api2_2x/EXPP_interface.c
deleted file mode 100644
index 9d49746ff41..00000000000
--- a/source/blender/python/api2_2x/EXPP_interface.c
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * $Id: EXPP_interface.c 7338 2006-04-30 16:22:31Z ianwill $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Michel Selten
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#include <Python.h>
-
-#include "EXPP_interface.h"
-#include "BLI_blenlib.h"
-#include "MEM_guardedalloc.h"
-#include "BLI_linklist.h" /* linked list: LinkNode struct and functions */
-#include "DNA_object_types.h"
-#include "DNA_space_types.h" /* for FILE_MAXDIR, FILE_MAXFILE */
-#include "Blender.h"
-
-extern char bprogname[]; /* argv[0] from creator.c */
-
-/* this makes sure BLI_gethome() returns a path with '.blender' appended
- * Besides, this function now either returns userhome/.blender (if it exists)
- * or blenderInstallDir/.blender/ otherwise (can also be cvs dir).
- * If append_scriptsdir is non NULL, "scripts/" is appended to the dir, to
- * get the path to the scripts folder ("release/scripts/" if cvs dir).
- * Finally, if all else fails BLI_gethome() is returned
- * (or NULL if append_scriptdir != 0).
-*/
-char *bpy_gethome(int append_scriptsdir)
-{
- static char homedir[FILE_MAXDIR];
- static char scriptsdir[FILE_MAXDIR];
- char tmpdir[FILE_MAXDIR];
- char bprogdir[FILE_MAXDIR];
- char *s;
- int i;
-
- if (append_scriptsdir) {
- if (scriptsdir[0] != '\0')
- return scriptsdir;
- }
- else if (homedir[0] != '\0')
- return homedir;
-
- /* BLI_gethome() can return NULL if env vars are not set */
- s = BLI_gethome();
-
- if( !s ) /* bail if no $HOME */
- {
- printf("$HOME is NOT set\n");
- return NULL;
- }
-
- if( strstr( s, ".blender" ) )
- PyOS_snprintf( homedir, FILE_MAXDIR, s );
- else
- BLI_make_file_string( "/", homedir, s, ".blender" );
-
- /* if userhome/.blender/ exists, return it */
- if( BLI_exists( homedir ) ) {
- if (append_scriptsdir) {
- BLI_make_file_string("/", scriptsdir, homedir, "scripts");
- if (BLI_exists (scriptsdir)) return scriptsdir;
- }
- else return homedir;
- }
- else homedir[0] = '\0';
-
- /* if either:
- * no homedir was found or
- * append_scriptsdir = 1 but there's no scripts/ inside homedir,
- * use argv[0] (bprogname) to get .blender/ in
- * Blender's installation dir */
- s = BLI_last_slash( bprogname );
-
- i = s - bprogname + 1;
-
- PyOS_snprintf( bprogdir, i, "%s", bprogname );
-
- /* using tmpdir to preserve homedir (if) found above:
- * the ideal is to have a home dir with scripts dir inside
- * it, but if that isn't available, it's possible to
- * have a 'broken' home dir somewhere and a scripts dir in the
- * cvs sources */
- BLI_make_file_string( "/", tmpdir, bprogdir, ".blender" );
-
- if (BLI_exists(tmpdir)) {
- if (append_scriptsdir) {
- BLI_make_file_string("/", scriptsdir, tmpdir, "scripts");
- if (BLI_exists(scriptsdir)) {
- PyOS_snprintf(homedir, FILE_MAXDIR, "%s", tmpdir);
- return scriptsdir;
- }
- else {
- homedir[0] = '\0';
- scriptsdir[0] = '\0';
- }
- }
- else return homedir;
- }
-
- /* last try for scripts dir: blender in cvs dir, scripts/ inside release/: */
- if (append_scriptsdir) {
- BLI_make_file_string("/", scriptsdir, bprogdir, "release/scripts");
- if (BLI_exists(scriptsdir)) return scriptsdir;
- else scriptsdir[0] = '\0';
- }
-
- return NULL;
-}
-
-/* PyDrivers */
-
-/*
- * Pydrivers are Blender Ipo Drivers defined by Python expressions.
- * We need to tell DAG about objects used in these expressions, so we
- * eval each expression to collect the ob refs. in it.
- */
-
-/* these are checked for example in Object.c: M_Object_Get (Object.Get())
- * to collect the refs. */
-static int pydriver_running = 0;
-
-int bpy_during_pydriver(void)
-{
- return pydriver_running;
-}
-
-void bpy_pydriver_running(int state)
-{
- pydriver_running = state;
-}
-
-/* Obj references are collected in this extern linked list: */
-LinkNode *bpy_pydriver_oblist = NULL;
-
-void bpy_pydriver_freeList(void)
-{
- BLI_linklist_free(bpy_pydriver_oblist, NULL);
- bpy_pydriver_oblist = NULL;
-}
-
-void bpy_pydriver_appendToList(struct Object *ob)
-{
- LinkNode *ln = bpy_pydriver_oblist;
-
- /* check that the expression is not referencing its owner object */
-
-/* XXX COMMENTED OUT TO TEST IF WE REALLY NEED TO IMPOSE THIS RESTRICTION
- if (ln && ln->link) {
- if (ob == (Object *)ln->link) {
- PyErr_SetString(PyExc_AttributeError,
- "Python driver expression can't reference its own object");
- return;
- }
- else
- ln = ln->next;
- }
-*/
- while (ln) { /* is ob already in list? ... */
- if (ob == (Object *)ln->link)
- break;
- ln = ln->next;
- }
-
- if (!ln) /* ... not yet, append it */
- BLI_linklist_append(&bpy_pydriver_oblist, (void *)ob);
-
- return;
-}
-
-/* Get an array from our linked list of objs referenced in the
- * current pydriver. The first node in the list is discarded,
- * since it is the actual pydriver owner, which shouldn't be
- * passed to the depsgraph (no self references). */
-struct Object **bpy_pydriver_obArrayFromList(void)
-{
- Object **obarray = NULL;
-
- if (bpy_pydriver_oblist) {
- int i;
- short len = BLI_linklist_length(bpy_pydriver_oblist);
-
- if (len > 1) {
-
- obarray = (Object **)MEM_mallocN(sizeof(Object*)*len,
- "pydriver array");
-
- if (obarray) {
- LinkNode *ln = bpy_pydriver_oblist;
- ln = ln->next; /* skip first ob, which is the pydriver owner */
-
- for (i = 0; i < len-1; i++) {
- obarray[i] = (Object *)ln->link;
- ln = ln->next;
- }
-
- obarray[len-1] = NULL; /* NULL-terminated array */
- }
- }
- bpy_pydriver_freeList();
- }
-
- return obarray;
-}
-
diff --git a/source/blender/python/api2_2x/Effect.c b/source/blender/python/api2_2x/Effect.c
deleted file mode 100644
index 1dcc2279ee2..00000000000
--- a/source/blender/python/api2_2x/Effect.c
+++ /dev/null
@@ -1,1575 +0,0 @@
-/*
- * $Id: Effect.c 11485 2007-08-05 09:21:29Z aligorith $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Jacques Guignot, Jean-Michel Soler, Ken Hughes
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-#include "Effect.h" /*This must come first */
-
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h" /* for G.scene->r.cfra */
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_effect.h"
-#include "BKE_object.h"
-#include "BKE_deform.h"
-#include "BKE_scene.h" /* for G.scene->r.cfra */
-#include "BKE_ipo.h" /* frame_to_float() */
-#include "BLI_blenlib.h"
-#include "gen_utils.h"
-#include "blendef.h"
-#include "vector.h"
-#include "MTC_matrixops.h"
-
-#define EXPP_EFFECT_STA_MIN -250.0f
-#define EXPP_EFFECT_END_MIN 1.0f
-#define EXPP_EFFECT_LIFETIME_MIN 1.0f
-#define EXPP_EFFECT_NORMFAC_MIN -2.0f
-#define EXPP_EFFECT_NORMFAC_MAX 2.0f
-#define EXPP_EFFECT_OBFAC_MIN -1.0f
-#define EXPP_EFFECT_OBFAC_MAX 1.0f
-#define EXPP_EFFECT_RANDFAC_MIN 0.0f
-#define EXPP_EFFECT_RANDFAC_MAX 2.0f
-#define EXPP_EFFECT_TEXFAC_MIN 0.0f
-#define EXPP_EFFECT_TEXFAC_MAX 2.0f
-#define EXPP_EFFECT_RANDLIFE_MIN 0.0f
-#define EXPP_EFFECT_RANDLIFE_MAX 2.0f
-#define EXPP_EFFECT_NABLA_MIN 0.0001f
-#define EXPP_EFFECT_NABLA_MAX 1.0f
-#define EXPP_EFFECT_VECTSIZE_MIN 0.0f
-#define EXPP_EFFECT_VECTSIZE_MAX 1.0f
-#define EXPP_EFFECT_TOTPART_MIN 1.0f
-#define EXPP_EFFECT_TOTPART_MAX 100000.0f
-#define EXPP_EFFECT_FORCE_MIN -1.0f
-#define EXPP_EFFECT_FORCE_MAX 1.0f
-#define EXPP_EFFECT_MULT_MIN 0.0f
-#define EXPP_EFFECT_MULT_MAX 1.0f
-#define EXPP_EFFECT_LIFE_MIN 1.0f
-#define EXPP_EFFECT_DEFVEC_MIN -1.0f
-#define EXPP_EFFECT_DEFVEC_MAX 1.0f
-#define EXPP_EFFECT_DAMP_MIN 0.0f
-#define EXPP_EFFECT_DAMP_MAX 1.0f
-
-#define EXPP_EFFECT_TOTKEY_MIN 1
-#define EXPP_EFFECT_TOTKEY_MAX 100
-#define EXPP_EFFECT_SEED_MIN 0
-#define EXPP_EFFECT_SEED_MAX 255
-#define EXPP_EFFECT_CHILD_MIN 1
-#define EXPP_EFFECT_CHILD_MAX 600
-#define EXPP_EFFECT_CHILDMAT_MIN 1
-#define EXPP_EFFECT_CHILDMAT_MAX 16
-#define EXPP_EFFECT_JITTER_MIN 0
-#define EXPP_EFFECT_JITTER_MAX 200
-#define EXPP_EFFECT_DISPMAT_MIN 1
-#define EXPP_EFFECT_DISPMAT_MAX 16
-#define EXPP_EFFECT_TIMETEX_MIN 1
-#define EXPP_EFFECT_TIMETEX_MAX 10
-#define EXPP_EFFECT_SPEEDTEX_MIN 1
-#define EXPP_EFFECT_SPEEDTEX_MAX 10
-#define EXPP_EFFECT_TEXMAP_MIN 1
-#define EXPP_EFFECT_TEXMAP_MAX 3
-
-#define EXPP_EFFECT_SPEEDTYPE_INTENSITY 0
-#define EXPP_EFFECT_SPEEDTYPE_RGB 1
-#define EXPP_EFFECT_SPEEDTYPE_GRADIENT 2
-
-#define EXPP_EFFECT_STATICSTEP_MIN 1
-#define EXPP_EFFECT_STATICSTEP_MAX 100
-#define EXPP_EFFECT_DISP_MIN 0
-#define EXPP_EFFECT_DISP_MAX 100
-
-/*****************************************************************************/
-/* Python API function prototypes for the Blender module. */
-/*****************************************************************************/
-static PyObject *M_Effect_New( PyObject * self, PyObject * args );
-static PyObject *M_Effect_Get( PyObject * self, PyObject * args );
-
-/*****************************************************************************/
-/* Python BPy_Effect methods declarations: */
-/*****************************************************************************/
-static PyObject *Effect_getType( BPy_Effect * self );
-static int Effect_setType( void );
-static PyObject *Effect_getStype( BPy_Effect * self );
-static int Effect_setStype( BPy_Effect * self, PyObject * args );
-static PyObject *Effect_getFlag( BPy_Effect * self );
-static int Effect_setFlag( BPy_Effect * self, PyObject * args );
-static PyObject *Effect_getSta( BPy_Effect * self );
-static int Effect_setSta( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_getEnd( BPy_Effect * self );
-static int Effect_setEnd( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_getLifetime( BPy_Effect * self );
-static int Effect_setLifetime( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_getNormfac( BPy_Effect * self );
-static int Effect_setNormfac( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_getObfac( BPy_Effect * self );
-static int Effect_setObfac( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_getRandfac( BPy_Effect * self );
-static int Effect_setRandfac( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_getTexfac( BPy_Effect * self );
-static int Effect_setTexfac( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_getRandlife( BPy_Effect * self );
-static int Effect_setRandlife( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_getNabla( BPy_Effect * self );
-static int Effect_setNabla( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_getVectsize( BPy_Effect * self );
-static int Effect_setVectsize( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_getTotpart( BPy_Effect * self );
-static int Effect_setTotpart( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_getTotkey( BPy_Effect * self );
-static int Effect_setTotkey( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_getSeed( BPy_Effect * self );
-static int Effect_setSeed( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_getForce( BPy_Effect * self );
-static int Effect_setForce( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_getMult( BPy_Effect * self );
-static int Effect_setMult( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_getLife( BPy_Effect * self );
-static int Effect_setLife( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_getChildMat( BPy_Effect * self );
-static int Effect_setChildMat( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_getChild( BPy_Effect * self );
-static int Effect_setChild( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_getDefvec( BPy_Effect * self );
-static int Effect_setDefvec( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_getJitter( BPy_Effect * self );
-static int Effect_setJitter( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_getDispMat( BPy_Effect * self );
-static int Effect_setDispMat( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_getEmissionTex( BPy_Effect * self );
-static int Effect_setEmissionTex( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_getForceTex( BPy_Effect * self );
-static int Effect_setForceTex( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_getDamping( BPy_Effect * self );
-static int Effect_setDamping( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_getSpeedType( BPy_Effect * self );
-static int Effect_setSpeedType( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_getVertGroup( BPy_Effect * self );
-static int Effect_setVertGroup( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_getSpeedVertGroup( BPy_Effect * self );
-static int Effect_setSpeedVertGroup( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_getStaticStep( BPy_Effect * self );
-static int Effect_setStaticStep( BPy_Effect * self , PyObject * a);
-static PyObject *Effect_getDisp( BPy_Effect * self );
-static int Effect_setDisp( BPy_Effect * self , PyObject * a);
-static PyObject *Effect_getParticlesLoc( BPy_Effect * self );
-
-static PyObject *Effect_oldsetType( void );
-static PyObject *Effect_oldsetStype( BPy_Effect * self, PyObject * args );
-static PyObject *Effect_oldsetFlag( BPy_Effect * self, PyObject * args );
-static PyObject *Effect_oldsetSta( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_oldsetEnd( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_oldsetLifetime( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_oldsetNormfac( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_oldsetObfac( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_oldsetRandfac( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_oldsetTexfac( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_oldsetRandlife( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_oldsetNabla( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_oldsetVectsize( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_oldsetTotpart( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_oldsetTotkey( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_oldsetSeed( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_oldsetForce( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_oldsetMult( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_oldsetLife( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_oldsetMat( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_oldsetChild( BPy_Effect * self, PyObject * a );
-static PyObject *Effect_oldsetDefvec( BPy_Effect * self, PyObject * a );
-
-/*****************************************************************************/
-/* Python Effect_Type callback function prototypes: */
-/*****************************************************************************/
-static PyObject *Effect_repr( void );
-
-/*****************************************************************************/
-/* The following string definitions are used for documentation strings. */
-/* In Python these will be written to the console when doing a */
-/* Blender.Particle.__doc__ */
-/*****************************************************************************/
-static char M_Particle_doc[] = "The Blender Effect module\n\n\
-This module provides access to **Object Data** in Blender.\n\
-Functions :\n\
- New(name) : creates a new part object and adds it to the given mesh object \n\
- Get(name) : retreives a particle with the given name (mandatory)\n\
- get(name) : same as Get. Kept for compatibility reasons.\n";
-static char M_Effect_New_doc[] = "New(name) : creates a new part object and adds it to the given mesh object\n";
-static char M_Effect_Get_doc[] = "xxx";
-
-/*****************************************************************************/
-/* Python method structure definition for Blender.Particle module: */
-/*****************************************************************************/
-static struct PyMethodDef M_Particle_methods[] = {
- {"New", ( PyCFunction ) M_Effect_New, METH_VARARGS, M_Effect_New_doc},
- {"Get", M_Effect_Get, METH_VARARGS, M_Effect_Get_doc},
- {"get", M_Effect_Get, METH_VARARGS, M_Effect_Get_doc},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Python BPy_Effect methods table: */
-/*****************************************************************************/
-static PyMethodDef BPy_Effect_methods[] = {
- {"getType", ( PyCFunction ) Effect_getType,
- METH_NOARGS, "() - Return Effect type"},
- {"setType", ( PyCFunction ) Effect_oldsetType,
- METH_VARARGS, "() - Set Effect type"},
- {"getStype", ( PyCFunction ) Effect_getStype,
- METH_NOARGS, "() - Return Effect stype"},
- {"setStype", ( PyCFunction ) Effect_oldsetStype,
- METH_VARARGS, "() - Set Effect stype"},
- {"getFlag", ( PyCFunction ) Effect_getFlag,
- METH_NOARGS, "() - Return Effect flag"},
- {"setFlag", ( PyCFunction ) Effect_oldsetFlag,
- METH_VARARGS, "() - Set Effect flag"},
- {"getStartTime", ( PyCFunction ) Effect_getSta,
- METH_NOARGS, "()-Return particle start time"},
- {"setStartTime", ( PyCFunction ) Effect_oldsetSta, METH_VARARGS,
- "()- Sets particle start time"},
- {"getEndTime", ( PyCFunction ) Effect_getEnd,
- METH_NOARGS, "()-Return particle end time"},
- {"setEndTime", ( PyCFunction ) Effect_oldsetEnd, METH_VARARGS,
- "()- Sets particle end time"},
- {"getLifetime", ( PyCFunction ) Effect_getLifetime,
- METH_NOARGS, "()-Return particle life time"},
- {"setLifetime", ( PyCFunction ) Effect_oldsetLifetime, METH_VARARGS,
- "()- Sets particle life time "},
- {"getNormfac", ( PyCFunction ) Effect_getNormfac,
- METH_NOARGS, "()-Return particle life time"},
- {"setNormfac", ( PyCFunction ) Effect_oldsetNormfac, METH_VARARGS,
- "()- Sets particle life time "},
- {"getObfac", ( PyCFunction ) Effect_getObfac,
- METH_NOARGS, "()-Return particle life time"},
- {"setObfac", ( PyCFunction ) Effect_oldsetObfac, METH_VARARGS,
- "()- Sets particle life time "},
- {"getRandfac", ( PyCFunction ) Effect_getRandfac,
- METH_NOARGS, "()-Return particle life time"},
- {"setRandfac", ( PyCFunction ) Effect_oldsetRandfac, METH_VARARGS,
- "()- Sets particle life time "},
- {"getTexfac", ( PyCFunction ) Effect_getTexfac,
- METH_NOARGS, "()-Return particle life time"},
- {"setTexfac", ( PyCFunction ) Effect_oldsetTexfac, METH_VARARGS,
- "()- Sets particle life time "},
- {"getRandlife", ( PyCFunction ) Effect_getRandlife,
- METH_NOARGS, "()-Return particle life time"},
- {"setRandlife", ( PyCFunction ) Effect_oldsetRandlife, METH_VARARGS,
- "()- Sets particle life time "},
- {"getNabla", ( PyCFunction ) Effect_getNabla,
- METH_NOARGS, "()-Return particle life time"},
- {"setNabla", ( PyCFunction ) Effect_oldsetNabla, METH_VARARGS,
- "()- Sets particle life time "},
- {"getVectsize", ( PyCFunction ) Effect_getVectsize,
- METH_NOARGS, "()-Return particle life time"},
- {"setVectsize", ( PyCFunction ) Effect_oldsetVectsize, METH_VARARGS,
- "()- Sets particle life time "},
- {"getTotpart", ( PyCFunction ) Effect_getTotpart,
- METH_NOARGS, "()-Return particle life time"},
- {"setTotpart", ( PyCFunction ) Effect_oldsetTotpart, METH_VARARGS,
- "()- Sets particle life time "},
- {"getTotkey", ( PyCFunction ) Effect_getTotkey,
- METH_NOARGS, "()-Return the number of key positions."},
- {"setTotkey", ( PyCFunction ) Effect_oldsetTotkey, METH_VARARGS,
- "()-Set the number of key positions. "},
- {"getSeed", ( PyCFunction ) Effect_getSeed,
- METH_NOARGS, "()-Return particle life time"},
- {"setSeed", ( PyCFunction ) Effect_oldsetSeed, METH_VARARGS,
- "()- Sets particle life time "},
- {"getForce", ( PyCFunction ) Effect_getForce,
- METH_NOARGS, "()-Return particle life time"},
- {"setForce", ( PyCFunction ) Effect_oldsetForce, METH_VARARGS,
- "()- Sets particle life time "},
- {"getMult", ( PyCFunction ) Effect_getMult,
- METH_NOARGS, "()-Return particle life time"},
- {"setMult", ( PyCFunction ) Effect_oldsetMult, METH_VARARGS,
- "()- Sets particle life time "},
- {"getLife", ( PyCFunction ) Effect_getLife,
- METH_NOARGS, "()-Return particle life time"},
- {"setLife", ( PyCFunction ) Effect_oldsetLife, METH_VARARGS,
- "()- Sets particle life time "},
- {"getMat", ( PyCFunction ) Effect_getChildMat,
- METH_NOARGS, "()-Return particle life time"},
- {"setMat", ( PyCFunction ) Effect_oldsetMat, METH_VARARGS,
- "()- Sets particle life time "},
- {"getChild", ( PyCFunction ) Effect_getChild,
- METH_NOARGS, "()-Return particle life time"},
- {"setChild", ( PyCFunction ) Effect_oldsetChild, METH_VARARGS,
- "()- Sets particle life time "},
- {"getDefvec", ( PyCFunction ) Effect_getDefvec,
- METH_NOARGS, "()-Return particle life time"},
- {"setDefvec", ( PyCFunction ) Effect_oldsetDefvec, METH_VARARGS,
- "()- Sets particle life time "},
- {"getParticlesLoc", ( PyCFunction ) Effect_getParticlesLoc, METH_NOARGS,
- "()- Sets particle life time "},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Python BPy_Effect attributes get/set structure: */
-/*****************************************************************************/
-static PyGetSetDef BPy_Effect_getseters[] = {
- {"flag",
- (getter)Effect_getFlag, (setter)Effect_setFlag,
- "The particle flag bitfield",
- NULL},
- {"stype",
- (getter)Effect_getStype, (setter)Effect_setStype,
- "The particle stype bitfield",
- NULL},
- {"disp",
- (getter)Effect_getDisp, (setter)Effect_setDisp,
- "The particle display value",
- NULL},
- {"staticStep",
- (getter)Effect_getStaticStep, (setter)Effect_setStaticStep,
- "The particle static step value",
- NULL},
- {"type",
- (getter)Effect_getType, (setter)Effect_setType,
- "The effect's type (deprecated)",
- NULL},
- {"child",
- (getter)Effect_getChild, (setter)Effect_setChild,
- "The number of children of a particle that multiply itself",
- NULL},
- {"childMat",
- (getter)Effect_getChildMat, (setter)Effect_setChildMat,
- "Specify the material used for the particles",
- NULL},
- {"damping",
- (getter)Effect_getDamping, (setter)Effect_setDamping,
- "The damping factor",
- NULL},
- {"defvec",
- (getter)Effect_getDefvec, (setter)Effect_setDefvec,
- "The axes of a force, determined by the texture",
- NULL},
- {"dispMat",
- (getter)Effect_getDispMat, (setter)Effect_setDispMat,
- "The material used for the particles",
- NULL},
- {"emissionTex",
- (getter)Effect_getEmissionTex, (setter)Effect_setEmissionTex,
- "The texture used for texture emission",
- NULL},
- {"end",
- (getter)Effect_getEnd, (setter)Effect_setEnd,
- "The endframe for the effect",
- NULL},
- {"force",
- (getter)Effect_getForce, (setter)Effect_setForce,
- "The axes of a continues force",
- NULL},
- {"forceTex",
- (getter)Effect_getForceTex, (setter)Effect_setForceTex,
- "The texture used for force",
- NULL},
- {"jitter",
- (getter)Effect_getJitter, (setter)Effect_setJitter,
- "Jitter table distribution: maximum particles per face",
- NULL},
- {"life",
- (getter)Effect_getLife, (setter)Effect_setLife,
- "The life span of the next generation of particles",
- NULL},
- {"lifetime",
- (getter)Effect_getLifetime, (setter)Effect_setLifetime,
- "The life span of the particles",
- NULL},
- {"mult",
- (getter)Effect_getMult, (setter)Effect_setMult,
- "The probabilities that a \"dying\" particle spawns a new one",
- NULL},
- {"nabla",
- (getter)Effect_getNabla, (setter)Effect_setNabla,
- "The dimension of the area for gradient calculation",
- NULL},
- {"normfac",
- (getter)Effect_getNormfac, (setter)Effect_setNormfac,
- "Particle's starting speed (from the mesh)",
- NULL},
- {"obfac",
- (getter)Effect_getObfac, (setter)Effect_setObfac,
- "Particle's starting speed (from the object)",
- NULL},
- {"randfac",
- (getter)Effect_getRandfac, (setter)Effect_setRandfac,
- "The random variation for the starting speed",
- NULL},
- {"randlife",
- (getter)Effect_getRandlife, (setter)Effect_setRandlife,
- "The random variation for a particle's life",
- NULL},
- {"seed",
- (getter)Effect_getSeed, (setter)Effect_setSeed,
- "The seed for random variations",
- NULL},
- {"speedType",
- (getter)Effect_getSpeedType, (setter)Effect_setSpeedType,
- "Controls which texture property affects particle speeds",
- NULL},
- {"speedVGroup",
- (getter)Effect_getSpeedVertGroup, (setter)Effect_setSpeedVertGroup,
- "Vertex group for speed control",
- NULL},
- {"sta",
- (getter)Effect_getSta, (setter)Effect_setSta,
- "The startframe for the effect",
- NULL},
- {"texfac",
- (getter)Effect_getTexfac, (setter)Effect_setTexfac,
- "Particle's starting speed (from the texture)",
- NULL},
- {"totpart",
- (getter)Effect_getTotpart, (setter)Effect_setTotpart,
- "The total number of particles",
- NULL},
- {"totkey",
- (getter)Effect_getTotkey, (setter)Effect_setTotkey,
- "The total number of key positions",
- NULL},
- {"vectsize",
- (getter)Effect_getVectsize, (setter)Effect_setVectsize,
- "The speed for particle's rotation direction",
- NULL},
- {"vGroup",
- (getter)Effect_getVertGroup, (setter)Effect_setVertGroup,
- "Vertex group for emitted particles",
- NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-/*****************************************************************************/
-/* Python Effect_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject Effect_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender Effect", /* char *tp_name; */
- sizeof( BPy_Effect ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL, /* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- NULL, /* cmpfunc tp_compare; */
- ( reprfunc ) Effect_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- 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; */
- 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, /* 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, /* 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 ***/
- BPy_Effect_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_Effect_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-/*****************************************************************************/
-/* Python method structure definition for Blender.Effect module: */
-/*****************************************************************************/
-
-struct PyMethodDef M_Effect_methods[] = {
- {"New", ( PyCFunction ) M_Effect_New, METH_VARARGS, NULL},
- {"Get", M_Effect_Get, METH_VARARGS, NULL},
- {"get", M_Effect_Get, METH_VARARGS, NULL},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Function: M_Effect_New */
-/* Python equivalent: Blender.Effect.New */
-/*****************************************************************************/
-PyObject *M_Effect_New( PyObject * self, PyObject * args )
-{
- Effect *bleffect = 0;
- Object *ob;
- char *name = NULL;
-
- if( !PyArg_ParseTuple( args, "s", &name ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument" );
-
- for( ob = G.main->object.first; ob; ob = ob->id.next )
- if( !strcmp( name, ob->id.name + 2 ) )
- break;
-
- if( !ob )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "object does not exist" );
-
- if( ob->type != OB_MESH )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "object is not a mesh" );
-
- bleffect = add_effect( EFF_PARTICLE );
- if( !bleffect )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't create Effect Data in Blender" );
-
- BLI_addtail( &ob->effect, bleffect );
-
- return EffectCreatePyObject( bleffect, ob );
-}
-
-/*****************************************************************************/
-/* Function: M_Effect_Get */
-/* Python equivalent: Blender.Effect.Get */
-/*****************************************************************************/
-PyObject *M_Effect_Get( PyObject * self, PyObject * args )
-{
- /*arguments : string object name
- int : position of effect in the obj's effect list */
- char *name = NULL;
- Object *object_iter;
- Effect *eff;
- int num = -1, i;
-
- if( !PyArg_ParseTuple( args, "|si", &name, &num ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected string int argument" ) );
-
- object_iter = G.main->object.first;
-
- if( !object_iter )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "Scene contains no object" ) );
-
- if( name ) { /* (name, num = -1) - try to find the given object */
-
- while( object_iter ) {
-
- if( !strcmp( name, object_iter->id.name + 2 ) ) {
-
- eff = object_iter->effect.first; /*can be NULL: None will be returned*/
-
- if (num >= 0) { /* return effect in given num position if available */
-
- for( i = 0; i < num; i++ ) {
- if (!eff) break;
- eff = eff->next;
- }
-
- if (eff) {
- return EffectCreatePyObject( eff, object_iter );
- } else { /* didn't find any effect in the given position */
- Py_RETURN_NONE;
- }
- }
-
- else {/*return a list with all effects linked to the given object*/
- /* this was pointed by Stephen Swaney */
- PyObject *effectlist = PyList_New( 0 );
-
- while (eff) {
- PyObject *found_eff = EffectCreatePyObject( eff,
- object_iter );
- PyList_Append( effectlist, found_eff );
- Py_DECREF( found_eff ); /* PyList_Append incref'ed it */
- eff = eff->next;
- }
- return effectlist;
- }
- }
-
- object_iter = object_iter->id.next;
- }
-
- if (!object_iter)
- return EXPP_ReturnPyObjError (PyExc_AttributeError,
- "no such object");
- }
-
- else { /* () - return a list with all effects currently in Blender */
- PyObject *effectlist = PyList_New( 0 );
-
- while( object_iter ) {
- if( object_iter->effect.first != NULL ) {
- eff = object_iter->effect.first;
- while( eff ) {
- PyObject *found_eff = EffectCreatePyObject( eff,
- object_iter );
- PyList_Append( effectlist, found_eff );
- Py_DECREF( found_eff );
- eff = eff->next;
- }
- }
- object_iter = object_iter->id.next;
- }
- return effectlist;
- }
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-/* create the Blender.Effect.Flags constant dict */
-
-static PyObject *Effect_FlagsDict( void )
-{
- PyObject *Flags = PyConstant_New( );
-
- if( Flags ) {
- BPy_constant *c = ( BPy_constant * ) Flags;
-
- PyConstant_Insert( c, "SELECTED",
- PyInt_FromLong( EFF_SELECT ) );
- PyConstant_Insert( c, "BSPLINE",
- PyInt_FromLong( PAF_BSPLINE ) );
- PyConstant_Insert( c, "STATIC",
- PyInt_FromLong( PAF_STATIC ) );
- PyConstant_Insert( c, "FACES",
- PyInt_FromLong( PAF_FACE ) );
- PyConstant_Insert( c, "ANIMATED",
- PyInt_FromLong( PAF_ANIMATED ) );
- PyConstant_Insert( c, "UNBORN",
- PyInt_FromLong( PAF_UNBORN ) );
- PyConstant_Insert( c, "VERTS",
- PyInt_FromLong( PAF_OFACE ) );
- PyConstant_Insert( c, "EMESH",
- PyInt_FromLong( PAF_SHOWE ) );
- PyConstant_Insert( c, "TRUERAND",
- PyInt_FromLong( PAF_TRAND ) );
- PyConstant_Insert( c, "EVENDIST",
- PyInt_FromLong( PAF_EDISTR ) );
- PyConstant_Insert( c, "DIED",
- PyInt_FromLong( PAF_DIED ) );
- }
- return Flags;
-}
-
-static PyObject *Effect_SpeedTypeDict( void )
-{
- PyObject *Type = PyConstant_New( );
-
- if( Type ) {
- BPy_constant *c = ( BPy_constant * ) Type;
-
- PyConstant_Insert( c, "INTENSITY",
- PyInt_FromLong( EXPP_EFFECT_SPEEDTYPE_INTENSITY ) );
- PyConstant_Insert( c, "RGB",
- PyInt_FromLong( EXPP_EFFECT_SPEEDTYPE_RGB ) );
- PyConstant_Insert( c, "GRADIENT",
- PyInt_FromLong( EXPP_EFFECT_SPEEDTYPE_GRADIENT ) );
- }
- return Type;
-}
-
-/*****************************************************************************/
-/* Function: Effect_Init */
-/*****************************************************************************/
-
-PyObject *Effect_Init( void )
-{
- PyObject *submodule, *dict;
- PyObject *particle;
- PyObject *Flags;
- PyObject *Types;
-
- if( PyType_Ready( &Effect_Type ) < 0)
- return NULL;
-
- Flags = Effect_FlagsDict( );
- Types = Effect_SpeedTypeDict( );
-
- submodule = Py_InitModule3( "Blender.Effect", M_Effect_methods, 0 );
- if( Flags )
- PyModule_AddObject( submodule, "Flags", Flags );
- if( Types )
- PyModule_AddObject( submodule, "SpeedTypes", Types );
-
- particle = Py_InitModule3( "Blender.Particle", M_Particle_methods,
- M_Particle_doc );
-
- dict = PyModule_GetDict( submodule );
-
- PyDict_SetItemString( dict, "Particle", particle );
- return ( submodule );
-}
-
-/*****************************************************************************/
-/* Python BPy_Effect methods: */
-/*****************************************************************************/
-
-static PyObject *Effect_getType( BPy_Effect * self )
-{
- return PyInt_FromLong( ( long ) self->effect->type );
-}
-
-/* does nothing since there is only one type of effect */
-
-static int Effect_setType( void )
-{
- return 0;
-}
-
-static int Effect_setStype( BPy_Effect * self, PyObject * args )
-{
- short param;
- if( !PyArg_Parse( args, "h", &param ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected an int as argument" );
- self->effect->stype = param;
- return 0;
-}
-
-static PyObject *Effect_getStype( BPy_Effect * self )
-{
- return PyInt_FromLong( (long)( self->effect->stype ) );
-}
-
-static PyObject *Effect_getFlag( BPy_Effect * self )
-{
- return PyInt_FromLong( (long)( self->effect->flag ^ PAF_OFACE ) );
-}
-
-static int Effect_setFlag( BPy_Effect * self, PyObject * args )
-{
- short param;
- static short bitmask = PAF_BSPLINE | PAF_STATIC | PAF_FACE | PAF_ANIMATED |
- PAF_UNBORN | PAF_OFACE | PAF_SHOWE | PAF_TRAND | PAF_EDISTR | PAF_DIED;
-
- if( !PyArg_Parse( args, "h", &param ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected an int as argument" );
-
- /* we don't allow users to change the select bit at this time */
- param &= ~EFF_SELECT;
-
- if ( ( param & bitmask ) != param )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "invalid bit(s) set in mask" );
-
- /* the sense of "Verts" is inverted (clear is enabled) */
- param ^= PAF_OFACE;
-
- /* leave select bit alone, and add in the others */
- self->effect->flag &= EFF_SELECT;
- self->effect->flag |= param;
- return 0;
-}
-
-static PyObject *Effect_getSta( BPy_Effect * self )
-{
- return PyFloat_FromDouble( self->effect->sta );
-}
-
-static int Effect_setSta( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setFloatClamped( args, &self->effect->sta,
- EXPP_EFFECT_STA_MIN, MAXFRAMEF );
-}
-
-static PyObject *Effect_getEnd( BPy_Effect * self )
-{
- return PyFloat_FromDouble( ((PartEff *) self->effect)->end );
-}
-
-static int Effect_setEnd( BPy_Effect * self, PyObject * args )
-{
- float val;
-
- if( !PyArg_Parse( args, "f", &val ) )
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "expected float argument" );
-
- self->effect->end = EXPP_ClampFloat( val,
- EXPP_EFFECT_END_MIN, MAXFRAMEF );
- return 0;
-}
-
-static PyObject *Effect_getLifetime( BPy_Effect * self )
-{
- return PyFloat_FromDouble( self->effect->lifetime );
-}
-
-static int Effect_setLifetime( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setFloatClamped( args, &self->effect->lifetime,
- EXPP_EFFECT_LIFETIME_MIN, MAXFRAMEF );
-}
-
-static PyObject *Effect_getNormfac( BPy_Effect * self )
-{
- return PyFloat_FromDouble( self->effect->normfac );
-}
-
-static int Effect_setNormfac( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setFloatClamped( args, &self->effect->normfac,
- EXPP_EFFECT_NORMFAC_MIN, EXPP_EFFECT_NORMFAC_MAX );
-}
-
-static PyObject *Effect_getObfac( BPy_Effect * self )
-{
- return PyFloat_FromDouble( self->effect->obfac );
-}
-
-static int Effect_setObfac( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setFloatClamped( args, &self->effect->obfac,
- EXPP_EFFECT_OBFAC_MIN, EXPP_EFFECT_OBFAC_MAX );
-}
-
-static PyObject *Effect_getRandfac( BPy_Effect * self )
-{
- return PyFloat_FromDouble( self->effect->randfac );
-}
-
-static int Effect_setRandfac( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setFloatClamped( args, &self->effect->randfac,
- EXPP_EFFECT_RANDFAC_MIN, EXPP_EFFECT_RANDFAC_MAX );
-}
-
-static PyObject *Effect_getTexfac( BPy_Effect * self )
-{
- return PyFloat_FromDouble( self->effect->texfac );
-}
-
-static int Effect_setTexfac( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setFloatClamped( args, &self->effect->texfac,
- EXPP_EFFECT_TEXFAC_MIN, EXPP_EFFECT_TEXFAC_MAX );
-}
-
-static PyObject *Effect_getRandlife( BPy_Effect * self )
-{
- return PyFloat_FromDouble( self->effect->randlife );
-}
-
-static int Effect_setRandlife( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setFloatClamped( args, &self->effect->randlife,
- EXPP_EFFECT_RANDLIFE_MIN, EXPP_EFFECT_RANDLIFE_MAX );
-}
-
-static PyObject *Effect_getNabla( BPy_Effect * self )
-{
- return PyFloat_FromDouble( self->effect->nabla );
-}
-
-static int Effect_setNabla( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setFloatClamped( args, &self->effect->nabla,
- EXPP_EFFECT_NABLA_MIN, EXPP_EFFECT_NABLA_MAX );
-}
-
-static PyObject *Effect_getVectsize( BPy_Effect * self )
-{
- return PyFloat_FromDouble( self->effect->vectsize );
-}
-
-static int Effect_setVectsize( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setFloatClamped( args, &self->effect->vectsize,
- EXPP_EFFECT_VECTSIZE_MIN, EXPP_EFFECT_VECTSIZE_MAX );
-}
-
-static PyObject *Effect_getTotpart( BPy_Effect * self )
-{
- return PyInt_FromLong( self->effect->totpart );
-}
-
-static int Effect_setTotpart( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setIValueClamped( args, &self->effect->totpart,
- (int)EXPP_EFFECT_TOTPART_MIN, (int)EXPP_EFFECT_TOTPART_MAX, 'i' );
-}
-
-static PyObject *Effect_getTotkey( BPy_Effect * self )
-{
- return PyInt_FromLong( self->effect->totkey );
-}
-
-static int Effect_setTotkey( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setIValueClamped( args, &self->effect->totkey,
- EXPP_EFFECT_TOTKEY_MIN, EXPP_EFFECT_TOTKEY_MAX, 'i' );
-}
-
-static PyObject *Effect_getSeed( BPy_Effect * self )
-{
- return PyInt_FromLong( self->effect->seed );
-}
-
-static int Effect_setSeed( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setIValueClamped( args, &self->effect->seed,
- EXPP_EFFECT_SEED_MIN, EXPP_EFFECT_SEED_MAX, 'i' );
-}
-
-static PyObject *Effect_getForce( BPy_Effect * self )
-{
- return Py_BuildValue( "(f,f,f)", self->effect->force[0],
- self->effect->force[1], self->effect->force[2] );
-}
-
-static int Effect_setForce( BPy_Effect * self, PyObject * args )
-{
- float val[3];
- int i;
-
- if( PyTuple_Check( args ) && PyTuple_Size( args ) == 1 )
- args = PyTuple_GetItem( args, 0 );
-
- if( !PyArg_ParseTuple( args, "fff", &val[0], &val[1], &val[2] ) )
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "expected a tuple of three float arguments" );
- for( i = 0; i < 3; ++i )
- self->effect->force[i] = EXPP_ClampFloat( val[i],
- EXPP_EFFECT_FORCE_MIN, EXPP_EFFECT_FORCE_MAX );
- return 0;
-}
-
-static PyObject *Effect_getMult( BPy_Effect * self )
-{
- return Py_BuildValue( "(f,f,f,f)", self->effect->mult[0],
- self->effect->mult[1], self->effect->mult[2],
- self->effect->mult[3] );
-}
-
-static int Effect_setMult( BPy_Effect * self, PyObject * args )
-{
- float val[4];
- int i;
-
- if( PyTuple_Check( args ) && PyTuple_Size( args ) == 1 )
- args = PyTuple_GetItem( args, 0 );
-
- if( !PyArg_ParseTuple( args, "ffff", &val[0], &val[1], &val[2], &val[3] ) )
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "expected a tuple of four float arguments" );
- for( i = 0; i < 4; ++i )
- self->effect->mult[i] = EXPP_ClampFloat( val[i],
- EXPP_EFFECT_MULT_MIN, EXPP_EFFECT_MULT_MAX );
- return 0;
-}
-
-static PyObject *Effect_getLife( BPy_Effect * self )
-{
- return Py_BuildValue( "(f,f,f,f)", self->effect->life[0],
- self->effect->life[1], self->effect->life[2],
- self->effect->life[3] );
-}
-
-static int Effect_setLife( BPy_Effect * self, PyObject * args )
-{
- float val[4];
- int i;
-
- if( PyTuple_Check( args ) && PyTuple_Size( args ) == 1 )
- args = PyTuple_GetItem( args, 0 );
-
- if( !PyArg_ParseTuple( args, "ffff", &val[0], &val[1], &val[2], &val[3] ) )
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "expected a tuple of four float arguments" );
- for( i = 0; i < 4; ++i )
- self->effect->life[i] = EXPP_ClampFloat( val[i],
- EXPP_EFFECT_LIFE_MIN, MAXFRAMEF );
- return 0;
-}
-
-static PyObject *Effect_getChild( BPy_Effect * self )
-{
- return Py_BuildValue( "(h,h,h,h)", self->effect->child[0],
- self->effect->child[1], self->effect->child[2],
- self->effect->child[3] );
-}
-
-
-static int Effect_setChild( BPy_Effect * self, PyObject * args )
-{
- short val[4];
- int i;
-
- if( PyTuple_Check( args ) && PyTuple_Size( args ) == 1 )
- args = PyTuple_GetItem( args, 0 );
-
- if( !PyArg_ParseTuple( args, "hhhh", &val[0], &val[1], &val[2], &val[3] ) )
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "expected a tuple of four int argument" );
- for( i = 0; i < 4; ++i )
- self->effect->child[i] = (short)EXPP_ClampInt( val[i],
- EXPP_EFFECT_CHILD_MIN, EXPP_EFFECT_CHILD_MAX );
- return 0;
-}
-
-static PyObject *Effect_getChildMat( BPy_Effect * self )
-{
- return Py_BuildValue( "(h,h,h,h)", self->effect->mat[0],
- self->effect->mat[1], self->effect->mat[2],
- self->effect->mat[3] );
-}
-
-static int Effect_setChildMat( BPy_Effect * self, PyObject * args )
-{
- short val[4];
- int i;
-
- if( PyTuple_Check( args ) && PyTuple_Size( args ) == 1 )
- args = PyTuple_GetItem( args, 0 );
-
- if( !PyArg_ParseTuple( args, "hhhh", &val[0], &val[1], &val[2], &val[3] ) )
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "expected a tuple of four int argument" );
- for( i = 0; i < 4; ++i )
- self->effect->mat[i] = (short)EXPP_ClampInt( val[i],
- EXPP_EFFECT_CHILDMAT_MIN, EXPP_EFFECT_CHILDMAT_MAX );
- return 0;
-}
-
-static PyObject *Effect_getDefvec( BPy_Effect * self )
-{
- return Py_BuildValue( "(f,f,f)", self->effect->defvec[0],
- self->effect->defvec[1], self->effect->defvec[2] );
-}
-
-static int Effect_setDefvec( BPy_Effect * self, PyObject * args )
-{
- float val[3];
- int i;
-
- if( PyTuple_Check( args ) && PyTuple_Size( args ) == 1 )
- args = PyTuple_GetItem( args, 0 );
-
- if( !PyArg_ParseTuple( args, "fff", &val[0], &val[1], &val[2] ) )
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "expected a tuple of three float arguments" );
-
- for( i = 0; i < 3; ++i )
- self->effect->defvec[i] = EXPP_ClampFloat( val[i],
- EXPP_EFFECT_DEFVEC_MIN, EXPP_EFFECT_DEFVEC_MAX );
- return 0;
-}
-
-static PyObject *Effect_getJitter( BPy_Effect * self )
-{
- return PyInt_FromLong( ( long )self->effect->userjit );
-}
-
-static int Effect_setJitter( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setIValueClamped( args, &self->effect->userjit,
- EXPP_EFFECT_JITTER_MIN, EXPP_EFFECT_JITTER_MAX, 'h' );
-}
-
-static PyObject *Effect_getDispMat( BPy_Effect * self )
-{
- return PyInt_FromLong( ( long )self->effect->omat );
-}
-
-static int Effect_setDispMat( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setIValueClamped( args, &self->effect->omat,
- EXPP_EFFECT_DISPMAT_MIN, EXPP_EFFECT_DISPMAT_MAX, 'h' );
-}
-
-static PyObject *Effect_getEmissionTex( BPy_Effect * self )
-{
- return PyInt_FromLong( ( long )self->effect->timetex );
-}
-
-static int Effect_setEmissionTex( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setIValueClamped( args, &self->effect->timetex,
- EXPP_EFFECT_TIMETEX_MIN, EXPP_EFFECT_TIMETEX_MAX, 'h' );
-}
-
-static PyObject *Effect_getForceTex( BPy_Effect * self )
-{
- return PyInt_FromLong( ( long )self->effect->speedtex );
-}
-
-static int Effect_setForceTex( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setIValueClamped( args, &self->effect->speedtex,
- EXPP_EFFECT_SPEEDTEX_MIN, EXPP_EFFECT_SPEEDTEX_MAX, 'h' );
-}
-
-static PyObject *Effect_getSpeedType( BPy_Effect * self )
-{
- return PyInt_FromLong( ( long )self->effect->texmap );
-}
-
-static int Effect_setSpeedType( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setIValueRange( args, &self->effect->texmap,
- EXPP_EFFECT_SPEEDTYPE_INTENSITY, EXPP_EFFECT_SPEEDTYPE_GRADIENT,
- 'h' );
-}
-
-static PyObject *Effect_getDamping( BPy_Effect * self )
-{
- return PyFloat_FromDouble( ( double )self->effect->damp );
-}
-
-static int Effect_setDamping( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setFloatClamped( args, &self->effect->damp,
- EXPP_EFFECT_DAMP_MIN, EXPP_EFFECT_DAMP_MAX );
-}
-
-static PyObject *Effect_getVertGroup( BPy_Effect * self )
-{
- return PyString_FromString( self->effect->vgroupname );
-}
-
-
-static int Effect_setVertGroup( BPy_Effect * self, PyObject * value )
-{
- char *name;
- bDeformGroup *dg;
-
- name = PyString_AsString ( value );
- if( !name )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected string argument" );
-
- PyOS_snprintf( self->effect->vgroupname,
- sizeof( self->effect->vgroupname )-1, "%s", name );
-
- dg = get_named_vertexgroup( self->object, self->effect->vgroupname );
- if( dg )
- self->effect->vertgroup = (short)get_defgroup_num( self->object, dg )+1;
- else
- self->effect->vertgroup = 0;
-
- return 0;
-}
-
-static PyObject *Effect_getSpeedVertGroup( BPy_Effect * self )
-{
- return PyString_FromString( self->effect->vgroupname_v );
-}
-
-static int Effect_setSpeedVertGroup( BPy_Effect * self, PyObject * value )
-{
- char *name;
- bDeformGroup *dg;
-
- name = PyString_AsString ( value );
- if( !name )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected string argument" );
-
- PyOS_snprintf( self->effect->vgroupname_v,
- sizeof( self->effect->vgroupname_v )-1, "%s", name );
-
- dg = get_named_vertexgroup( self->object, self->effect->vgroupname_v );
- if( dg )
- self->effect->vertgroup_v = (short)get_defgroup_num( self->object, dg )+1;
- else
- self->effect->vertgroup_v = 0;
-
- return 0;
-}
-
-/*****************************************************************************/
-/* attribute: getDisp */
-/* Description: the current value of the display number button */
-/* Data: self effect */
-/* Return: integer value between 0 and 100 */
-/*****************************************************************************/
-static PyObject *Effect_getDisp( BPy_Effect * self )
-{
- return PyInt_FromLong( ( long )self->effect->disp );
-}
-
-static int Effect_setDisp( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setIValueRange( args, &self->effect->disp,
- EXPP_EFFECT_DISP_MIN, EXPP_EFFECT_DISP_MAX, 'h' );
-}
-
-/*****************************************************************************/
-/* attribute: getStep */
-/* Description: the current value of the Step number button */
-/* Data: self effect */
-/* Return: integer value between 1 and 100 */
-/*****************************************************************************/
-static PyObject *Effect_getStaticStep( BPy_Effect * self )
-{
- return PyInt_FromLong( ( long )self->effect->staticstep );
-}
-
-static int Effect_setStaticStep( BPy_Effect * self , PyObject * args )
-{
- return EXPP_setIValueRange( args, &self->effect->staticstep,
- EXPP_EFFECT_STATICSTEP_MIN, EXPP_EFFECT_STATICSTEP_MAX,
- 'h' );
-}
-
-/*****************************************************************************/
-/* Method: getParticlesLoc */
-/* Python equivalent: effect.getParticlesLoc */
-/* Description: Get the current location of each particle */
-/* and return a list of 3D vectors */
-/* or a list of ists of two 3D vectors */
-/* if effect.vect has any sense */
-/* Data: notihng get the current time from G.scene */
-/* Return: One python list of 3D vector */
-/*****************************************************************************/
-static PyObject *Effect_getParticlesLoc( BPy_Effect * self )
-{
- Object *ob;
- Effect *eff;
- PartEff *paf;
- Particle *pa=0;
- PyObject *list, *strand_list, *pyvec, *pyvec2;
- float p_time, c_time, vec[3], vec1[3], cfra, m_time, s_time;
- int a;
- short disp=100 ;
-
- cfra=frame_to_float( G.scene->r.cfra );
-
- /* as we need to update the particles system we try to retrieve
- the object to which the effect is connected */
- eff =(Effect *) self->effect;
-
- ob= self->object;
- if(!ob)
- return ( EXPP_ReturnPyObjError (PyExc_AttributeError,
- "Effect has no object" ) );
- /*get the particles data */
- paf= (PartEff *)eff;
-
- /* particles->disp reduce the display number of particles */
- /* as we want the complete list ... we backup the disp value and restore later */
- if (paf->disp<100)
- disp= paf->disp; paf->disp=100;
-
-
- build_particle_system(ob);
- pa= paf->keys;
-
- if(!pa)
- return ( EXPP_ReturnPyObjError (PyExc_AttributeError,
- "Particles Location : no Keys" ) );
-
- /* if object is in motion */
- if( ob->ipoflag & OB_OFFS_PARTICLE )
- p_time= ob->sf;
- else
- p_time= 0.0;
-
- list = PyList_New( 0 );
- if( !list )
- return EXPP_ReturnPyObjError( PyExc_MemoryError, "PyList() failed" );
-
- c_time= bsystem_time( ob, cfra, p_time );
-
- for( a=0; a < paf->totpart; a++, pa += paf->totkey ) {
-
- if(paf->flag & PAF_STATIC ) {
- strand_list = PyList_New( 0 );
- m_time= pa->time+pa->lifetime+paf->staticstep-1;
- for(c_time= pa->time; c_time<m_time; c_time+=paf->staticstep) {
- where_is_particle(paf, pa, c_time, vec);
- MTC_Mat4MulVecfl(ob->obmat, vec); /* make worldspace like the others */
- pyvec = newVectorObject(vec, 3, Py_NEW);
- if( PyList_Append( strand_list, pyvec) < 0 ) {
- Py_DECREF( list );
- Py_DECREF( strand_list );
- Py_XDECREF( pyvec );
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "Couldn't append item to PyList" );
- }
- Py_DECREF( pyvec );
-
- }
-
- if( PyList_Append( list, strand_list) < 0 ) {
- Py_DECREF( list );
- Py_DECREF( strand_list );
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "Couldn't append item to PyList" );
- }
- Py_DECREF( strand_list );
- } else {
- if(c_time > pa->time && c_time < pa->time+pa->lifetime ) {
- /* vector particles are a tuple of 2 vectors */
- if( paf->stype==PAF_VECT ) {
- s_time= c_time;
- p_time= c_time+1.0f;
- if(c_time < pa->time) {
- if(paf->flag & PAF_UNBORN)
- p_time= pa->time+1.0f;
- else
- continue;
- }
- if(c_time > pa->time+pa->lifetime) {
- if(paf->flag & PAF_DIED)
- s_time= pa->time+pa->lifetime-1.0f;
- else
- continue;
- }
- where_is_particle(paf, pa, s_time, vec);
- where_is_particle(paf, pa, p_time, vec1);
- pyvec = newVectorObject(vec, 3, Py_NEW);
- pyvec2 = newVectorObject(vec1, 3, Py_NEW);
- if( PyList_Append( list, Py_BuildValue("[OO]", pyvec, pyvec2)) < 0 ) {
- Py_DECREF( list );
- Py_XDECREF( pyvec );
- Py_XDECREF( pyvec2 );
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "Couldn't append item to PyList" );
- }
- Py_DECREF( pyvec );
- Py_DECREF( pyvec2 );
- } else { /* not a vector */
- where_is_particle(paf, pa, c_time, vec);
- pyvec = newVectorObject(vec, 3, Py_NEW);
- if( PyList_Append( list, pyvec) < 0 ) {
- Py_DECREF( list );
- Py_XDECREF( pyvec );
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "Couldn't append item to PyList" );
- }
- Py_DECREF( pyvec );
- }
- }
- }
- }
-
- /* restore the real disp value */
- if (disp<100){
- paf->disp=disp;
- build_particle_system(ob);
- }
-
- return list;
-}
-
-/*****************************************************************************/
-/* Function: Effect_repr */
-/* Description: This is a callback function for the BPy_Effect type. It */
-/* builds a meaninful string to represent effcte objects. */
-/*****************************************************************************/
-
-static PyObject *Effect_repr( void )
-{
- return PyString_FromString( "Particle" );
-}
-
-/*****************************************************************************/
-/* These are needed by Object.c */
-/*****************************************************************************/
-PyObject *EffectCreatePyObject( Effect * effect, Object *ob )
-{
- BPy_Effect *blen_object;
-
- blen_object =
- ( BPy_Effect * ) PyObject_NEW( BPy_Effect, &Effect_Type );
-
- if( blen_object )
- blen_object->effect = (PartEff *)effect;
- blen_object->object = ob;
-
- return ( PyObject * ) blen_object;
-}
-
-int EffectCheckPyObject( PyObject * py_obj )
-{
- return ( py_obj->ob_type == &Effect_Type );
-}
-
-/* #####DEPRECATED###### */
-
-static PyObject *Effect_oldsetChild( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setterWrapperTuple( (void *)self, args,
- (setter)Effect_setChild );
-}
-
-static PyObject *Effect_oldsetDefvec( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setterWrapperTuple( (void *)self, args,
- (setter)Effect_setDefvec );
-}
-
-static PyObject *Effect_oldsetForce( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setterWrapperTuple( (void *)self, args,
- (setter)Effect_setForce );
-}
-
-static PyObject *Effect_oldsetMat( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setterWrapperTuple( (void *)self, args,
- (setter)Effect_setChildMat );
-}
-
-static PyObject *Effect_oldsetEnd( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Effect_setEnd );
-}
-
-static PyObject *Effect_oldsetLife( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setterWrapperTuple( (void *)self, args,
- (setter)Effect_setLife );
-}
-
-static PyObject *Effect_oldsetLifetime( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Effect_setLifetime );
-}
-
-static PyObject *Effect_oldsetMult( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setterWrapperTuple( (void *)self, args,
- (setter)Effect_setMult );
-}
-
-static PyObject *Effect_oldsetNabla( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Effect_setNabla );
-}
-
-static PyObject *Effect_oldsetNormfac( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Effect_setNormfac );
-}
-
-static PyObject *Effect_oldsetObfac( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Effect_setObfac );
-}
-
-static PyObject *Effect_oldsetRandfac( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Effect_setRandfac );
-}
-
-static PyObject *Effect_oldsetRandlife( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Effect_setRandlife );
-}
-
-static PyObject *Effect_oldsetSeed( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Effect_setSeed );
-}
-
-static PyObject *Effect_oldsetSta( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Effect_setSta );
-}
-
-static PyObject *Effect_oldsetTexfac( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Effect_setTexfac );
-}
-
-static PyObject *Effect_oldsetTotkey( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Effect_setTotkey );
-}
-
-static PyObject *Effect_oldsetTotpart( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Effect_setTotpart );
-}
-
-static PyObject *Effect_oldsetVectsize( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Effect_setVectsize );
-}
-
-static PyObject *Effect_oldsetFlag( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Effect_setFlag );
-}
-
-static PyObject *Effect_oldsetStype( BPy_Effect * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Effect_setStype );
-}
-
-static PyObject *Effect_oldsetType( void )
-{
- return EXPP_incr_ret( Py_None );
-}
diff --git a/source/blender/python/api2_2x/Effect.h b/source/blender/python/api2_2x/Effect.h
deleted file mode 100644
index 86996b9f8a6..00000000000
--- a/source/blender/python/api2_2x/Effect.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * $Id: Effect.h 5817 2005-11-17 19:19:05Z khughes $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Jacques Guignot
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_EFFECT_H
-#define EXPP_EFFECT_H
-
-#include <Python.h>
-#include "DNA_effect_types.h"
-#include "DNA_object_types.h"
-
-extern PyTypeObject Effect_Type;
-
-#define BPy_Effect_Check(v) ((v)->ob_type==&Effect_Type)
-
-/* Python BPy_Effect structure definition */
-typedef struct {
- PyObject_HEAD /* required py macro */
- PartEff * effect;
- Object * object;
-} BPy_Effect;
-
-/*****************************************************************************/
-/* Python Effect_Type helpder function prototypes: */
-/*****************************************************************************/
-PyObject *Effect_Init( void );
-int EffectCheckPyObject( PyObject * py_obj );
-PyObject *EffectCreatePyObject( Effect * eff, Object * ob );
-
-#endif /* EXPP_EFFECT_H */
diff --git a/source/blender/python/api2_2x/Font.c b/source/blender/python/api2_2x/Font.c
deleted file mode 100644
index 61edac2841a..00000000000
--- a/source/blender/python/api2_2x/Font.c
+++ /dev/null
@@ -1,403 +0,0 @@
-/*
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Joilnen Leite
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include "Font.h" /*This must come first*/
-
-#include "DNA_packedFile_types.h"
-#include "BKE_packedFile.h"
-#include "BKE_global.h"
-#include "BKE_library.h" /* for rename_id() */
-#include "BLI_blenlib.h"
-#include "gen_utils.h"
-#include "gen_library.h"
-
-#include "BKE_main.h" /* so we can access G.main->vfont.first */
-#include "DNA_space_types.h" /* for FILE_MAXDIR only */
-
-extern PyObject *M_Text3d_LoadFont( PyObject * self, PyObject * args );
-
-/*--------------------Python API function prototypes for the Font module----*/
-static PyObject *M_Font_Load( PyObject * self, PyObject * value );
-static PyObject *M_Font_Get( PyObject * self, PyObject * args );
-
-/*------------------------Python API Doc strings for the Font module--------*/
-char M_Font_doc[] = "The Blender Font module\n\n\
-This module provides control over **Font Data** objects in Blender.\n\n\
-Example::\n\n\
- from Blender import Text3d.Font\n\
- l = Text3d.Font.Load('/usr/share/fonts/verdata.ttf')\n";
-char M_Font_Get_doc[] = "(name) - return an existing font called 'name'\
-when no argument is given it returns a list of blenders fonts.";
-char M_Font_Load_doc[] =
- "(filename) - return font from file filename as Font Object, \
-returns None if not found.\n";
-
-/*----- Python method structure definition for Blender.Text3d.Font module---*/
-struct PyMethodDef M_Font_methods[] = {
- {"Get", ( PyCFunction ) M_Font_Get, METH_VARARGS, M_Font_Get_doc},
- {"Load", ( PyCFunction ) M_Font_Load, METH_O, M_Font_Load_doc},
- {NULL, NULL, 0, NULL}
-};
-
-/*--------------- Python BPy_Font methods declarations:-------------------*/
-static PyObject *Font_pack( BPy_Font * self );
-static PyObject *Font_unpack( BPy_Font * self, PyObject * args );
-
-/*--------------- Python BPy_Font methods table:--------------------------*/
-static PyMethodDef BPy_Font_methods[] = {
- {"pack", ( PyCFunction ) Font_pack, METH_NOARGS,
- "() - pack this Font"},
- {"unpack", ( PyCFunction ) Font_unpack, METH_O,
- "(mode) - unpack this packed font"},
- {NULL, NULL, 0, NULL}
-};
-
-/*--------------- Python TypeFont callback function prototypes----------*/
-static int Font_compare( BPy_Font * a1, BPy_Font * a2 );
-static PyObject *Font_repr( BPy_Font * font );
-
-
-/*--------------- Python Font Module methods------------------------*/
-
-/*--------------- Blender.Text3d.Font.Get()-----------------------*/
-static PyObject *M_Font_Get( PyObject * self, PyObject * args )
-{
- char *name = NULL;
- VFont *vfont_iter;
-
- if( !PyArg_ParseTuple( args, "|s", &name ) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument (or nothing)" ) );
-
- vfont_iter = G.main->vfont.first;
-
- if( name ) { /* (name) - Search font by name */
-
- BPy_Font *wanted_vfont = NULL;
-
- while(vfont_iter) {
- if( strcmp( name, vfont_iter->id.name + 2 ) == 0 ) {
- wanted_vfont =
- ( BPy_Font * )
- Font_CreatePyObject( vfont_iter );
- break;
- }
- vfont_iter = vfont_iter->id.next;
- }
-
- if( wanted_vfont == NULL ) { /* Requested font doesn't exist */
- char error_msg[64];
- PyOS_snprintf( error_msg, sizeof( error_msg ),
- "Font \"%s\" not found", name );
- return ( EXPP_ReturnPyObjError
- ( PyExc_NameError, error_msg ) );
- }
-
- return ( PyObject * ) wanted_vfont;
- }
-
- else { /* () - return a list of all fonts in the scene */
- int index = 0;
- PyObject *vfontlist, *pyobj;
-
- vfontlist = PyList_New( BLI_countlist( &( G.main->vfont ) ) );
-
- if( vfontlist == NULL )
- return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create font list" ) );
-
- while( vfont_iter ) {
- pyobj = Font_CreatePyObject( vfont_iter );
-
- if( !pyobj ) {
- Py_DECREF(vfontlist);
- return ( EXPP_ReturnPyObjError
- ( PyExc_MemoryError,
- "couldn't create Object" ) );
- }
- PyList_SET_ITEM( vfontlist, index, pyobj );
-
- vfont_iter = vfont_iter->id.next;
- index++;
- }
-
- return vfontlist;
- }
-}
-
-
-/*--------------- Blender.Text3d.Font.New()-----------------------*/
-PyObject *M_Font_Load( PyObject * self, PyObject * value )
-{
- char *filename_str = PyString_AsString(value);
- BPy_Font *py_font = NULL; /* for Font Data object wrapper in Python */
-
- if( !value )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected string or empty argument" ) );
-
- /*create python font*/
- if( !S_ISDIR(BLI_exist(filename_str)) ) {
- py_font= (BPy_Font *) M_Text3d_LoadFont (self, value);
- }
- else
- Py_RETURN_NONE;
- return ( PyObject * ) py_font;
-}
-
-/*--------------- Python BPy_Font getsetattr funcs ---------------------*/
-
-
-/*--------------- BPy_Font.filename-------------------------------------*/
-static PyObject *Font_getFilename( BPy_Font * self )
-{
- return PyString_FromString( self->font->name );
-}
-
-static int Font_setFilename( BPy_Font * self, PyObject * value )
-{
- char *name = NULL;
-
- /* max len is FILE_MAXDIR = 160 chars like done in DNA_image_types.h */
-
- name = PyString_AsString ( value );
- if( !name )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected string argument" );
-
- PyOS_snprintf( self->font->name, FILE_MAXDIR * sizeof( char ), "%s",
- name );
-
- return 0;
-}
-
-/*--------------- BPy_Font.pack()---------------------------------*/
-static PyObject *Font_pack( BPy_Font * self )
-{
- if( !self->font->packedfile )
- self->font->packedfile = newPackedFile(self->font->name);
- Py_RETURN_NONE;
-}
-
-/*--------------- BPy_Font.unpack()---------------------------------*/
-static PyObject *Font_unpack( BPy_Font * self, PyObject * value )
-{
- int mode= PyInt_AsLong(value);
- VFont *font= self->font;
-
- if( mode==-1 )
- return ( EXPP_ReturnPyObjError
- ( PyExc_AttributeError,
- "expected int argument from Blender.UnpackModes" ) );
-
- if (font->packedfile)
- if (unpackVFont(font, mode) == RET_ERROR)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "error unpacking font" );
-
- Py_RETURN_NONE;
-}
-
-/*--------------- BPy_Font.packed---------------------------------*/
-static PyObject *Font_getPacked( BPy_Font * self )
-{
- if (G.fileflags & G_AUTOPACK)
- return EXPP_incr_ret_True();
- else
- return EXPP_incr_ret_False();
-}
-
-/*****************************************************************************/
-/* Python attributes get/set structure: */
-/*****************************************************************************/
-static PyGetSetDef BPy_Font_getseters[] = {
- GENERIC_LIB_GETSETATTR,
- {"filename",
- (getter)Font_getFilename, (setter)Font_setFilename,
- "Font filepath",
- NULL},
- {"packed",
- (getter)Font_getPacked, (setter)NULL,
- "Packed status",
- NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-/*****************************************************************************/
-/* Python TypeFont structure definition: */
-/*****************************************************************************/
-PyTypeObject Font_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender Font", /* char *tp_name; */
- sizeof( BPy_Font ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL, /* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- ( cmpfunc ) Font_compare, /* cmpfunc tp_compare; */
- ( reprfunc ) Font_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- NULL, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
- 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, /* 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, /* 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 ***/
- BPy_Font_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_Font_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-
-
-
-
-
-/*--------------- Font Module Init-----------------------------*/
-PyObject *Font_Init( void )
-{
- PyObject *submodule;
-
- if( PyType_Ready( &Font_Type ) < 0 )
- return NULL;
-
- submodule = Py_InitModule3( "Blender.Text3d.Font",
- M_Font_methods, M_Font_doc );
-
- return ( submodule );
-}
-
-/*--------------- Font module internal callbacks-----------------*/
-/*---------------BPy_Font internal callbacks/methods-------------*/
-
-/*--------------- repr---------------------------------------------*/
-static PyObject *Font_repr( BPy_Font * self )
-{
- if( self->font )
- return PyString_FromFormat( "[Font \"%s\"]",
- self->font->id.name+2 );
- else
- return PyString_FromString( "[Font - no data]" );
-}
-
-/*--------------- compare------------------------------------------*/
-static int Font_compare( BPy_Font * a, BPy_Font * b )
-{
- return ( a->font == b->font ) ? 0 : -1;
-}
-
-/*--------------- Font_CreatePyObject---------------------------------*/
-PyObject *Font_CreatePyObject( struct VFont * font )
-{
- BPy_Font *blen_font;
-
- blen_font = ( BPy_Font * ) PyObject_NEW( BPy_Font, &Font_Type );
-
- blen_font->font = font;
-
- return ( ( PyObject * ) blen_font );
-}
-
-/*--------------- Font_FromPyObject---------------------------------*/
-struct VFont *Font_FromPyObject( PyObject * py_obj )
-{
- BPy_Font *blen_obj;
-
- blen_obj = ( BPy_Font * ) py_obj;
- if( !( ( BPy_Font * ) py_obj )->font ) { /*test to see if linked to text3d*/
- //use python vars
- return NULL;
- } else {
- return ( blen_obj->font );
- }
-}
-
-
-
diff --git a/source/blender/python/api2_2x/Geometry.c b/source/blender/python/api2_2x/Geometry.c
deleted file mode 100644
index 909e6e449cb..00000000000
--- a/source/blender/python/api2_2x/Geometry.c
+++ /dev/null
@@ -1,428 +0,0 @@
-/*
- * $Id: Geometry.c 12867 2007-12-13 15:06:02Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Joseph Gilbert, Campbell Barton
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include "Geometry.h"
-
-/* - Not needed for now though other geometry functions will probably need them
-#include "BLI_arithb.h"
-#include "BKE_utildefines.h"
-*/
-
-/* Used for PolyFill */
-#include "BKE_displist.h"
-#include "MEM_guardedalloc.h"
-#include "BLI_blenlib.h"
-
-/* needed for EXPP_ReturnPyObjError and EXPP_check_sequence_consistency */
-#include "gen_utils.h"
-
-#include "BKE_utildefines.h"
-#include "BLI_boxpack2d.h"
-#include "BLI_arithb.h"
-
-#define SWAP_FLOAT(a,b,tmp) tmp=a; a=b; b=tmp
-#define eul 0.000001
-
-/*-- forward declarations -- */
-static PyObject *M_Geometry_PolyFill( PyObject * self, PyObject * polyLineSeq );
-static PyObject *M_Geometry_LineIntersect2D( PyObject * self, PyObject * args );
-static PyObject *M_Geometry_ClosestPointOnLine( PyObject * self, PyObject * args );
-static PyObject *M_Geometry_PointInTriangle2D( PyObject * self, PyObject * args );
-static PyObject *M_Geometry_BoxPack2D( PyObject * self, PyObject * args );
-
-
-/*-------------------------DOC STRINGS ---------------------------*/
-static char M_Geometry_doc[] = "The Blender Geometry module\n\n";
-static char M_Geometry_PolyFill_doc[] = "(veclist_list) - takes a list of polylines (each point a vector) and returns the point indicies for a polyline filled with triangles";
-static char M_Geometry_LineIntersect2D_doc[] = "(lineA_p1, lineA_p2, lineB_p1, lineB_p2) - takes 2 lines (as 4 vectors) and returns a vector for their point of intersection or None";
-static char M_Geometry_ClosestPointOnLine_doc[] = "(pt, line_p1, line_p2) - takes a point and a line and returns a (Vector, Bool) for the point on the line, and the bool so you can know if the point was between the 2 points";
-static char M_Geometry_PointInTriangle2D_doc[] = "(pt, tri_p1, tri_p2, tri_p3) - takes 4 vectors, one is the point and the next 3 define the triabgle, only the x and y are used from the vectors";
-static char M_Geometry_BoxPack2D_doc[] = "";
-/*-----------------------METHOD DEFINITIONS ----------------------*/
-struct PyMethodDef M_Geometry_methods[] = {
- {"PolyFill", ( PyCFunction ) M_Geometry_PolyFill, METH_O, M_Geometry_PolyFill_doc},
- {"LineIntersect2D", ( PyCFunction ) M_Geometry_LineIntersect2D, METH_VARARGS, M_Geometry_LineIntersect2D_doc},
- {"ClosestPointOnLine", ( PyCFunction ) M_Geometry_ClosestPointOnLine, METH_VARARGS, M_Geometry_ClosestPointOnLine_doc},
- {"PointInTriangle2D", ( PyCFunction ) M_Geometry_PointInTriangle2D, METH_VARARGS, M_Geometry_PointInTriangle2D_doc},
- {"BoxPack2D", ( PyCFunction ) M_Geometry_BoxPack2D, METH_O, M_Geometry_BoxPack2D_doc},
- {NULL, NULL, 0, NULL}
-};
-/*----------------------------MODULE INIT-------------------------*/
-PyObject *Geometry_Init(void)
-{
- PyObject *submodule;
-
- submodule = Py_InitModule3("Blender.Geometry",
- M_Geometry_methods, M_Geometry_doc);
- return (submodule);
-}
-
-/*----------------------------------Geometry.PolyFill() -------------------*/
-/* PolyFill function, uses Blenders scanfill to fill multiple poly lines */
-static PyObject *M_Geometry_PolyFill( PyObject * self, PyObject * polyLineSeq )
-{
- PyObject *tri_list; /*return this list of tri's */
- PyObject *polyLine, *polyVec;
- int i, len_polylines, len_polypoints;
-
- /* display listbase */
- ListBase dispbase={NULL, NULL};
- DispList *dl;
- float *fp; /*pointer to the array of malloced dl->verts to set the points from the vectors */
- int index, *dl_face, totpoints=0;
-
-
- dispbase.first= dispbase.last= NULL;
-
-
- if(!PySequence_Check(polyLineSeq)) {
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a sequence of poly lines" );
- }
-
- len_polylines = PySequence_Size( polyLineSeq );
-
- for( i = 0; i < len_polylines; ++i ) {
- polyLine= PySequence_GetItem( polyLineSeq, i );
- if (!PySequence_Check(polyLine)) {
- freedisplist(&dispbase);
- Py_XDECREF(polyLine); /* may be null so use Py_XDECREF*/
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "One or more of the polylines is not a sequence of Mathutils.Vector's" );
- }
-
- len_polypoints= PySequence_Size( polyLine );
- if (len_polypoints>0) { /* dont bother adding edges as polylines */
- if (EXPP_check_sequence_consistency( polyLine, &vector_Type ) != 1) {
- freedisplist(&dispbase);
- Py_DECREF(polyLine);
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "A point in one of the polylines is not a Mathutils.Vector type" );
- }
-
- dl= MEM_callocN(sizeof(DispList), "poly disp");
- BLI_addtail(&dispbase, dl);
- dl->type= DL_INDEX3;
- dl->nr= len_polypoints;
- dl->type= DL_POLY;
- dl->parts= 1; /* no faces, 1 edge loop */
- dl->col= 0; /* no material */
- dl->verts= fp= MEM_callocN( sizeof(float)*3*len_polypoints, "dl verts");
- dl->index= MEM_callocN(sizeof(int)*3*len_polypoints, "dl index");
-
- for( index = 0; index<len_polypoints; ++index, fp+=3) {
- polyVec= PySequence_GetItem( polyLine, index );
-
- fp[0] = ((VectorObject *)polyVec)->vec[0];
- fp[1] = ((VectorObject *)polyVec)->vec[1];
- if( ((VectorObject *)polyVec)->size > 2 )
- fp[2] = ((VectorObject *)polyVec)->vec[2];
- else
- fp[2]= 0.0f; /* if its a 2d vector then set the z to be zero */
-
- totpoints++;
- Py_DECREF(polyVec);
- }
- }
- Py_DECREF(polyLine);
- }
-
- if (totpoints) {
- /* now make the list to return */
- filldisplist(&dispbase, &dispbase);
-
- /* The faces are stored in a new DisplayList
- thats added to the head of the listbase */
- dl= dispbase.first;
-
- tri_list= PyList_New(dl->parts);
- if( !tri_list ) {
- freedisplist(&dispbase);
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "Geometry.PolyFill failed to make a new list" );
- }
-
- index= 0;
- dl_face= dl->index;
- while(index < dl->parts) {
- PyList_SetItem(tri_list, index, Py_BuildValue("iii", dl_face[0], dl_face[1], dl_face[2]) );
- dl_face+= 3;
- index++;
- }
- freedisplist(&dispbase);
- } else {
- /* no points, do this so scripts dont barf */
- tri_list= PyList_New(0);
- }
-
- return tri_list;
-}
-
-
-static PyObject *M_Geometry_LineIntersect2D( PyObject * self, PyObject * args )
-{
- VectorObject *line_a1, *line_a2, *line_b1, *line_b2;
- float a1x, a1y, a2x, a2y, b1x, b1y, b2x, b2y, xi, yi, a1,a2,b1,b2, newvec[2];
- if( !PyArg_ParseTuple ( args, "O!O!O!O!",
- &vector_Type, &line_a1,
- &vector_Type, &line_a2,
- &vector_Type, &line_b1,
- &vector_Type, &line_b2)
- )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError, "expected 4 vector types\n" ) );
-
- a1x= line_a1->vec[0];
- a1y= line_a1->vec[1];
- a2x= line_a2->vec[0];
- a2y= line_a2->vec[1];
-
- b1x= line_b1->vec[0];
- b1y= line_b1->vec[1];
- b2x= line_b2->vec[0];
- b2y= line_b2->vec[1];
-
- if((MIN2(a1x, a2x) > MAX2(b1x, b2x)) ||
- (MAX2(a1x, a2x) < MIN2(b1x, b2x)) ||
- (MIN2(a1y, a2y) > MAX2(b1y, b2y)) ||
- (MAX2(a1y, a2y) < MIN2(b1y, b2y)) ) {
- Py_RETURN_NONE;
- }
- /* Make sure the hoz/vert line comes first. */
- if (fabs(b1x - b2x) < eul || fabs(b1y - b2y) < eul) {
- SWAP_FLOAT(a1x, b1x, xi); /*abuse xi*/
- SWAP_FLOAT(a1y, b1y, xi);
- SWAP_FLOAT(a2x, b2x, xi);
- SWAP_FLOAT(a2y, b2y, xi);
- }
-
- if (fabs(a1x-a2x) < eul) { /* verticle line */
- if (fabs(b1x-b2x) < eul){ /*verticle second line */
- Py_RETURN_NONE; /* 2 verticle lines dont intersect. */
- }
- else if (fabs(b1y-b2y) < eul) {
- /*X of vert, Y of hoz. no calculation needed */
- newvec[0]= a1x;
- newvec[1]= b1y;
- return newVectorObject(newvec, 2, Py_NEW);
- }
-
- yi = (float)(((b1y / fabs(b1x - b2x)) * fabs(b2x - a1x)) + ((b2y / fabs(b1x - b2x)) * fabs(b1x - a1x)));
-
- if (yi > MAX2(a1y, a2y)) {/* New point above seg1's vert line */
- Py_RETURN_NONE;
- } else if (yi < MIN2(a1y, a2y)) { /* New point below seg1's vert line */
- Py_RETURN_NONE;
- }
- newvec[0]= a1x;
- newvec[1]= yi;
- return newVectorObject(newvec, 2, Py_NEW);
- } else if (fabs(a2y-a1y) < eul) { /* hoz line1 */
- if (fabs(b2y-b1y) < eul) { /*hoz line2*/
- Py_RETURN_NONE; /*2 hoz lines dont intersect*/
- }
-
- /* Can skip vert line check for seg 2 since its covered above. */
- xi = (float)(((b1x / fabs(b1y - b2y)) * fabs(b2y - a1y)) + ((b2x / fabs(b1y - b2y)) * fabs(b1y - a1y)));
- if (xi > MAX2(a1x, a2x)) { /* New point right of hoz line1's */
- Py_RETURN_NONE;
- } else if (xi < MIN2(a1x, a2x)) { /*New point left of seg1's hoz line */
- Py_RETURN_NONE;
- }
- newvec[0]= xi;
- newvec[1]= a1y;
- return newVectorObject(newvec, 2, Py_NEW);
- }
-
- b1 = (a2y-a1y)/(a2x-a1x);
- b2 = (b2y-b1y)/(b2x-b1x);
- a1 = a1y-b1*a1x;
- a2 = b1y-b2*b1x;
-
- if (b1 - b2 == 0.0) {
- Py_RETURN_NONE;
- }
-
- xi = - (a1-a2)/(b1-b2);
- yi = a1+b1*xi;
- if ((a1x-xi)*(xi-a2x) >= 0 && (b1x-xi)*(xi-b2x) >= 0 && (a1y-yi)*(yi-a2y) >= 0 && (b1y-yi)*(yi-b2y)>=0) {
- newvec[0]= xi;
- newvec[1]= yi;
- return newVectorObject(newvec, 2, Py_NEW);
- }
- Py_RETURN_NONE;
-}
-
-static PyObject *M_Geometry_ClosestPointOnLine( PyObject * self, PyObject * args )
-{
- VectorObject *pt, *line_1, *line_2;
- float pt_in[3], pt_out[3], l1[3], l2[3];
- float lambda;
- PyObject *ret;
-
- if( !PyArg_ParseTuple ( args, "O!O!O!",
- &vector_Type, &pt,
- &vector_Type, &line_1,
- &vector_Type, &line_2)
- )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError, "expected 3 vector types\n" ) );
-
- /* accept 2d verts */
- if (pt->size==3) { VECCOPY(pt_in, pt->vec);}
- else { pt_in[2]=0.0; VECCOPY2D(pt_in, pt->vec) }
-
- if (line_1->size==3) { VECCOPY(l1, line_1->vec);}
- else { l1[2]=0.0; VECCOPY2D(l1, line_1->vec) }
-
- if (line_2->size==3) { VECCOPY(l2, line_2->vec);}
- else { l2[2]=0.0; VECCOPY2D(l2, line_2->vec) }
-
- /* do the calculation */
- lambda = lambda_cp_line_ex(pt_in, l1, l2, pt_out);
-
- ret = PyTuple_New(2);
- PyTuple_SET_ITEM( ret, 0, newVectorObject(pt_out, 3, Py_NEW) );
- PyTuple_SET_ITEM( ret, 1, PyFloat_FromDouble(lambda) );
- return ret;
-}
-
-#define SIDE_OF_LINE(pa,pb,pp) ((pa[0]-pp[0])*(pb[1]-pp[1]))-((pb[0]-pp[0])*(pa[1]-pp[1]))
-#define POINT_IN_TRI(p0,p1,p2,p3) ((SIDE_OF_LINE(p1,p2,p0)>=0) && (SIDE_OF_LINE(p2,p3,p0)>=0) && (SIDE_OF_LINE(p3,p1,p0)>=0))
-
-static PyObject *M_Geometry_PointInTriangle2D( PyObject * self, PyObject * args )
-{
- VectorObject *pt_vec, *tri_p1, *tri_p2, *tri_p3;
-
- if( !PyArg_ParseTuple ( args, "O!O!O!O!",
- &vector_Type, &pt_vec,
- &vector_Type, &tri_p1,
- &vector_Type, &tri_p2,
- &vector_Type, &tri_p3)
- )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError, "expected 4 vector types\n" ) );
-
- if POINT_IN_TRI(pt_vec->vec, tri_p1->vec, tri_p2->vec, tri_p3->vec)
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
-}
-
-int boxPack_FromPyObject(PyObject * value, boxPack **boxarray )
-{
- int len, i;
- PyObject *list_item, *item_1, *item_2;
- boxPack *box;
-
-
- /* Error checking must alredy be done */
- if( !PyList_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "can only back a list of [x,y,x,w]" );
-
- len = PyList_Size( value );
-
- (*boxarray) = MEM_mallocN( len*sizeof(boxPack), "boxPack box");
-
-
- for( i = 0; i < len; i++ ) {
- list_item = PyList_GET_ITEM( value, i );
- if( !PyList_Check( list_item ) || PyList_Size( list_item ) < 4 ) {
- MEM_freeN(*boxarray);
- return EXPP_ReturnIntError( PyExc_TypeError,
- "can only back a list of [x,y,x,w]" );
- }
-
- box = (*boxarray)+i;
-
- item_1 = PyList_GET_ITEM(list_item, 2);
- item_2 = PyList_GET_ITEM(list_item, 3);
-
- if (!PyNumber_Check(item_1) || !PyNumber_Check(item_2)) {
- MEM_freeN(*boxarray);
- return EXPP_ReturnIntError( PyExc_TypeError,
- "can only back a list of 2d boxes [x,y,x,w]" );
- }
-
- box->w = (float)PyFloat_AsDouble( item_1 );
- box->h = (float)PyFloat_AsDouble( item_2 );
- box->index = i;
- /* verts will be added later */
- }
- return 0;
-}
-
-void boxPack_ToPyObject(PyObject * value, boxPack **boxarray)
-{
- int len, i;
- PyObject *list_item;
- boxPack *box;
-
- len = PyList_Size( value );
-
- for( i = 0; i < len; i++ ) {
- box = (*boxarray)+i;
- list_item = PyList_GET_ITEM( value, box->index );
- PyList_SET_ITEM( list_item, 0, PyFloat_FromDouble( box->x ));
- PyList_SET_ITEM( list_item, 1, PyFloat_FromDouble( box->y ));
- }
- MEM_freeN(*boxarray);
-}
-
-
-static PyObject *M_Geometry_BoxPack2D( PyObject * self, PyObject * boxlist )
-{
- boxPack *boxarray;
- float tot_width, tot_height;
- int len;
- int error;
-
- if(!PyList_Check(boxlist))
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a sequence of boxes [[x,y,w,h], ... ]" );
-
- len = PyList_Size( boxlist );
-
- if (!len)
- return Py_BuildValue( "ff", 0.0, 0.0);
-
- error = boxPack_FromPyObject(boxlist, &boxarray);
- if (error!=0) return NULL;
-
- /* Non Python function */
- boxPack2D(boxarray, len, &tot_width, &tot_height);
-
- boxPack_ToPyObject(boxlist, &boxarray);
-
- return Py_BuildValue( "ff", tot_width, tot_height);
-}
diff --git a/source/blender/python/api2_2x/Geometry.h b/source/blender/python/api2_2x/Geometry.h
deleted file mode 100644
index a9a1c7cf818..00000000000
--- a/source/blender/python/api2_2x/Geometry.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * $Id: Geometry.h 10324 2007-03-21 17:06:02Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Joseph Gilbert
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-/*Include this file for access to vector, quat, matrix, euler, etc...*/
-
-#ifndef EXPP_Geometry_H
-#define EXPP_Geometry_H
-
-#include <Python.h>
-#include "vector.h"
-
-PyObject *Geometry_Init( void );
-
-#endif /* EXPP_Geometry_H */
diff --git a/source/blender/python/api2_2x/Group.c b/source/blender/python/api2_2x/Group.c
deleted file mode 100644
index 26e5edd0733..00000000000
--- a/source/blender/python/api2_2x/Group.c
+++ /dev/null
@@ -1,813 +0,0 @@
-/*
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Campbell Barton
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include "Group.h" /* This must come first */
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_group_types.h"
-#include "DNA_scene_types.h" /* for Base */
-
-#include "BKE_mesh.h"
-#include "BKE_library.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_scene.h"
-#include "BKE_group.h"
-
-#include "BLI_blenlib.h"
-
-#include "blendef.h"
-#include "Object.h"
-#include "gen_utils.h"
-#include "gen_library.h"
-
-/* checks for the group being removed */
-#define GROUP_DEL_CHECK_PY(bpy_group) if (!(bpy_group->group)) return ( EXPP_ReturnPyObjError( PyExc_RuntimeError, "Group has been removed" ) )
-#define GROUP_DEL_CHECK_INT(bpy_group) if (!(bpy_group->group)) return ( EXPP_ReturnIntError( PyExc_RuntimeError, "Group has been removed" ) )
-
-/*****************************************************************************/
-/* Python API function prototypes for the Blender module. */
-/*****************************************************************************/
-static PyObject *M_Group_New( PyObject * self, PyObject * args );
-PyObject *M_Group_Get( PyObject * self, PyObject * args );
-PyObject *M_Group_Unlink( PyObject * self, BPy_Group * pygrp );
-
-/* internal */
-static PyObject *GroupObSeq_CreatePyObject( BPy_Group *self, GroupObject *iter );
-
-/*****************************************************************************/
-/* Python method structure definition for Blender.Object module: */
-/*****************************************************************************/
-struct PyMethodDef M_Group_methods[] = {
- {"New", ( PyCFunction ) M_Group_New, METH_VARARGS,
- "(name) Add a new empty group"},
- {"Get", ( PyCFunction ) M_Group_Get, METH_VARARGS,
-"(name) - return the group with the name 'name',\
-returns None if notfound.\nIf 'name' is not specified, it returns a list of all groups."},
- {"Unlink", ( PyCFunction ) M_Group_Unlink, METH_O,
- "(group) - Unlink (delete) this group from Blender."},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Python BPy_Group methods table: */
-/*****************************************************************************/
-static PyObject *BPy_Group_copy( BPy_Group * self );
-
-static PyMethodDef BPy_Group_methods[] = {
- /* name, method, flags, doc */
- {"__copy__", ( PyCFunction ) BPy_Group_copy, METH_VARARGS,
- "() - Return a copy of the group containing the same objects."},
- {"copy", ( PyCFunction ) BPy_Group_copy, METH_VARARGS,
- "() - Return a copy of the group containing the same objects."},
- {NULL, NULL, 0, NULL}
-};
-
-
-static PyObject *BPy_Group_copy( BPy_Group * self )
-{
- BPy_Group *py_group; /* for Group Data object wrapper in Python */
- struct Group *bl_group;
- GroupObject *group_ob, *group_ob_new; /* Group object, copied and added to the groups */
-
- GROUP_DEL_CHECK_PY(self);
-
- bl_group= add_group( self->group->id.name + 2 );
-
- if( bl_group ) /* now create the wrapper grp in Python */
- py_group = ( BPy_Group * ) Group_CreatePyObject( bl_group );
- else
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't create Group Data in Blender" ) );
-
- bl_group->id.us = 1;
-
- /* Now add the objects to the group */
- group_ob= self->group->gobject.first;
- while(group_ob) {
- /* save time by not using */
- group_ob_new= MEM_callocN(sizeof(GroupObject), "groupobject");
- group_ob_new->ob= group_ob->ob;
- BLI_addtail( &bl_group->gobject, group_ob_new);
- group_ob= group_ob->next;
- }
-
- return ( PyObject * ) py_group;
-
-}
-
-
-/************************************************************************
- *
- * Python BPy_Object attributes
- *
- ************************************************************************/
-static PyObject *Group_getObjects( BPy_Group * self )
-{
- return GroupObSeq_CreatePyObject(self, NULL);
-}
-
-
-static void add_to_group_wraper(Group *group, Object *ob) {
- Base *base;
- add_to_group(group, ob);
-
- if (!(ob->flag & OB_FROMGROUP)) { /* do this to avoid a listbase lookup */
- ob->flag |= OB_FROMGROUP;
-
- base= object_in_scene(ob, G.scene);
- if (base)
- base->flag |= OB_FROMGROUP;
- }
-}
-
-/* only for internal use Blender.Group.Get("MyGroup").objects= []*/
-static int Group_setObjects( BPy_Group * self, PyObject * args )
-{
- int i, list_size;
- Group *group;
- Object *blen_ob;
- group= self->group;
-
- GROUP_DEL_CHECK_INT(self);
-
- if( PyList_Check( args ) ) {
- if( EXPP_check_sequence_consistency( args, &Object_Type ) != 1)
- return ( EXPP_ReturnIntError( PyExc_TypeError,
- "expected a list of objects" ) );
-
- /* remove all from the list and add the new items */
- free_group(group); /* unlink all objects from this group, keep the group */
- list_size= PyList_Size( args );
- for( i = 0; i < list_size; i++ ) {
- blen_ob= ((BPy_Object *)PyList_GET_ITEM( args, i ))->object;
- add_to_group_wraper(group, blen_ob);
- }
- } else if (PyIter_Check(args)) {
- PyObject *iterator = PyObject_GetIter(args);
- PyObject *item;
- if (iterator == NULL) {
- Py_DECREF(iterator);
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a list of objects, This iterator cannot be used." );
- }
- free_group(group); /* unlink all objects from this group, keep the group */
- item = PyIter_Next(iterator);
- while (item) {
- if ( PyObject_TypeCheck(item, &Object_Type) ) {
- blen_ob= ((BPy_Object *)item)->object;
- add_to_group_wraper(group, blen_ob);
- }
- Py_DECREF(item);
- item = PyIter_Next(iterator);
- }
-
- Py_DECREF(iterator);
-
- if (PyErr_Occurred()) {
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "An unknown error occured while adding iterator objects to the group.\nThe group has been modified." );
- }
-
- } else
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a list or sequence of objects" );
- return 0;
-}
-
-
-
-/*****************************************************************************/
-/* PythonTypeObject callback function prototypes */
-/*****************************************************************************/
-static PyObject *Group_repr( BPy_Group * obj );
-static int Group_compare( BPy_Group * a, BPy_Group * b );
-
-/*****************************************************************************/
-/* Python BPy_Group getsetattr funcs: */
-/*****************************************************************************/
-static int Group_setLayers( BPy_Group * self, PyObject * value )
-{
- unsigned int laymask = 0;
-
- GROUP_DEL_CHECK_INT(self);
-
- if( !PyInt_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected an integer (bitmask) as argument" );
-
- laymask = ( unsigned int )PyInt_AS_LONG( value );
-
- if( laymask <= 0 )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "layer value cannot be zero or below" );
-
- self->group->layer= laymask & ((1<<20) - 1);
-
- return 0;
-}
-
-static PyObject *Group_getLayers( BPy_Group * self )
-{
- return PyInt_FromLong( self->group->layer );
-}
-
-
-/*****************************************************************************/
-/* Python attributes get/set structure: */
-/*****************************************************************************/
-static PyGetSetDef BPy_Group_getseters[] = {
- GENERIC_LIB_GETSETATTR,
- {"layers",
- (getter)Group_getLayers, (setter)Group_setLayers,
- "layer mask for this group",
- NULL},
- {"objects",
- (getter)Group_getObjects, (setter)Group_setObjects,
- "objects in this group",
- NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-/*****************************************************************************/
-/* Python TypeGroup structure definition: */
-/*****************************************************************************/
-PyTypeObject Group_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender Group", /* char *tp_name; */
- sizeof( BPy_Group ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL, /* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- ( cmpfunc ) Group_compare, /* cmpfunc tp_compare; */
- ( reprfunc ) Group_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- NULL, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
- 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, /* 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, /* 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 ***/
- BPy_Group_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_Group_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-
-
-
-
-/*****************************************************************************/
-/* Function: M_Group_New */
-/* Python equivalent: Blender.Group.New */
-/*****************************************************************************/
-PyObject *M_Group_New( PyObject * self, PyObject * args )
-{
- char *name = "Group";
- BPy_Group *py_group; /* for Group Data object wrapper in Python */
- struct Group *bl_group;
-
- if( !PyArg_ParseTuple( args, "|s", &name ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "string expected as argument or nothing" );
-
- bl_group= add_group( name );
-
- if( bl_group ) /* now create the wrapper grp in Python */
- py_group = ( BPy_Group * ) Group_CreatePyObject( bl_group );
- else
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't create Group Data in Blender" ) );
-
- bl_group->id.us = 1;
-
- return ( PyObject * ) py_group;
-}
-
-/*****************************************************************************/
-/* Function: M_Group_Get */
-/* Python equivalent: Blender.Group.Get */
-/*****************************************************************************/
-PyObject *M_Group_Get( PyObject * self, PyObject * args )
-{
- char *name = NULL;
- Group *group_iter;
-
- if( !PyArg_ParseTuple( args, "|s", &name ) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument (or nothing)" ) );
-
- group_iter = G.main->group.first;
-
- if( name ) { /* (name) - Search group by name */
-
- BPy_Group *wanted_group = NULL;
-
- while( ( group_iter ) && ( wanted_group == NULL ) ) {
-
- if( strcmp( name, group_iter->id.name + 2 ) == 0 )
- wanted_group =
- ( BPy_Group * )
- Group_CreatePyObject( group_iter );
-
- group_iter = group_iter->id.next;
- }
-
- if( wanted_group == NULL ) { /* Requested group doesn't exist */
- char error_msg[64];
- PyOS_snprintf( error_msg, sizeof( error_msg ),
- "Group \"%s\" not found", name );
- return ( EXPP_ReturnPyObjError
- ( PyExc_NameError, error_msg ) );
- }
-
- return ( PyObject * ) wanted_group;
- }
-
- else { /* () - return a list of all groups in the scene */
- int index = 0;
- PyObject *grouplist, *pyobj;
-
- grouplist = PyList_New( BLI_countlist( &( G.main->group ) ) );
-
- if( grouplist == NULL )
- return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create group list" ) );
-
- while( group_iter ) {
- pyobj = Group_CreatePyObject( group_iter );
-
- if( !pyobj ) {
- Py_DECREF(grouplist);
- return ( EXPP_ReturnPyObjError
- ( PyExc_MemoryError,
- "couldn't create Object" ) );
- }
- PyList_SET_ITEM( grouplist, index, pyobj );
-
- group_iter = group_iter->id.next;
- index++;
- }
-
- return grouplist;
- }
-}
-
-
-/*****************************************************************************/
-/* Function: M_Group_Unlink */
-/* Python equivalent: Blender.Group.Unlink */
-/*****************************************************************************/
-PyObject *M_Group_Unlink( PyObject * self, BPy_Group * pygrp )
-{
- Group *group;
- if( !BPy_Group_Check(pygrp) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a group" ) );
-
- GROUP_DEL_CHECK_PY(pygrp);
-
- group= pygrp->group;
-
- pygrp->group= NULL;
- free_group(group);
- unlink_group(group);
- group->id.us= 0;
- free_libblock( &G.main->group, group );
- Py_RETURN_NONE;
-}
-
-
-/*****************************************************************************/
-/* Function: initObject */
-/*****************************************************************************/
-PyObject *Group_Init( void )
-{
- PyObject *submodule;
- if( PyType_Ready( &Group_Type ) < 0 )
- return NULL;
- if( PyType_Ready( &GroupObSeq_Type ) < 0 )
- return NULL;
-
- submodule = Py_InitModule3( "Blender.Group", M_Group_methods,
- "The Blender Group module\n\n\
-This module provides access to **Group Data** in Blender.\n" );
-
- /*Add SUBMODULES to the module*/
- /*PyDict_SetItemString(dict, "Constraint", Constraint_Init()); //creates a *new* module*/
- return submodule;
-}
-
-
-/*****************************************************************************/
-/* Function: Group_CreatePyObject */
-/* Description: This function will create a new BlenObject from an existing */
-/* Object structure. */
-/*****************************************************************************/
-PyObject *Group_CreatePyObject( struct Group * grp )
-{
- BPy_Group *pygrp;
-
- if( !grp )
- Py_RETURN_NONE;
-
- pygrp =
- ( BPy_Group * ) PyObject_NEW( BPy_Group, &Group_Type );
-
- if( pygrp == NULL ) {
- return ( NULL );
- }
- pygrp->group = grp;
- return ( ( PyObject * ) pygrp );
-}
-
-/*****************************************************************************/
-/* Function: Group_FromPyObject */
-/* Description: This function returns the Blender group from the given */
-/* PyObject. */
-/*****************************************************************************/
-Group *Group_FromPyObject( PyObject * py_grp )
-{
- BPy_Group *blen_grp;
-
- blen_grp = ( BPy_Group * ) py_grp;
- return ( blen_grp->group );
-}
-
-/*****************************************************************************/
-/* Function: Group_compare */
-/* Description: This is a callback function for the BPy_Group type. It */
-/* compares two Group_Type objects. Only the "==" and "!=" */
-/* comparisons are meaninful. Returns 0 for equality and -1 if */
-/* they don't point to the same Blender Object struct. */
-/* In Python it becomes 1 if they are equal, 0 otherwise. */
-/*****************************************************************************/
-static int Group_compare( BPy_Group * a, BPy_Group * b )
-{
- Group *pa = a->group, *pb = b->group;
- return ( pa == pb ) ? 0 : -1;
-}
-
-/*****************************************************************************/
-/* Function: Group_repr */
-/* Description: This is a callback function for the BPy_Group type. It */
-/* builds a meaninful string to represent object objects. */
-/*****************************************************************************/
-static PyObject *Group_repr( BPy_Group * self )
-{
- if (!self->group)
- return PyString_FromString( "[Group - Removed]" );
-
- return PyString_FromFormat( "[Group \"%s\"]",
- self->group->id.name + 2 );
-}
-
-
-/************************************************************************
- *
- * GroupOb sequence
- *
- ************************************************************************/
-/*
- * create a thin GroupOb object
- */
-
-static PyObject *GroupObSeq_CreatePyObject( BPy_Group *self, GroupObject *iter )
-{
- BPy_GroupObSeq *seq = PyObject_NEW( BPy_GroupObSeq, &GroupObSeq_Type);
- seq->bpygroup = self; Py_INCREF(self);
- seq->iter= iter;
- return (PyObject *)seq;
-}
-
-
-static int GroupObSeq_len( BPy_GroupObSeq * self )
-{
- GROUP_DEL_CHECK_INT(self->bpygroup);
- return BLI_countlist( &( self->bpygroup->group->gobject ) );
-}
-
-/*
- * retrive a single GroupOb from somewhere in the GroupObex list
- */
-
-static PyObject *GroupObSeq_item( BPy_GroupObSeq * self, int i )
-{
- Group *group= self->bpygroup->group;
- int index=0;
- PyObject *bpy_obj;
- GroupObject *gob;
-
- GROUP_DEL_CHECK_PY(self->bpygroup);
-
- for (gob= group->gobject.first; gob && i!=index; gob= gob->next, index++) {}
-
- if (!(gob))
- return EXPP_ReturnPyObjError( PyExc_IndexError,
- "array index out of range" );
-
- bpy_obj = Object_CreatePyObject( gob->ob );
-
- if( !bpy_obj )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyObject_New() failed" );
-
- return (PyObject *)bpy_obj;
-
-}
-
-static PySequenceMethods GroupObSeq_as_sequence = {
- ( inquiry ) GroupObSeq_len, /* sq_length */
- ( binaryfunc ) 0, /* sq_concat */
- ( intargfunc ) 0, /* sq_repeat */
- ( intargfunc ) GroupObSeq_item, /* sq_item */
- ( intintargfunc ) 0, /* sq_slice */
- ( intobjargproc ) 0, /* sq_ass_item */
- ( intintobjargproc ) 0, /* sq_ass_slice */
- 0,0,0,
-};
-
-/************************************************************************
- *
- * Python GroupObSeq_Type iterator (iterates over GroupObjects)
- *
- ************************************************************************/
-
-/*
- * Initialize the interator index
- */
-
-static PyObject *GroupObSeq_getIter( BPy_GroupObSeq * self )
-{
- GROUP_DEL_CHECK_PY(self->bpygroup);
-
- if (!self->iter) {
- self->iter = self->bpygroup->group->gobject.first;
- return EXPP_incr_ret ( (PyObject *) self );
- } else {
- return GroupObSeq_CreatePyObject(self->bpygroup, self->bpygroup->group->gobject.first);
- }
-}
-
-/*
- * Return next GroupOb.
- */
-
-static PyObject *GroupObSeq_nextIter( BPy_GroupObSeq * self )
-{
- PyObject *object;
- if( !(self->iter) || !(self->bpygroup->group) ) {
- self->iter = NULL; /* so we can add objects again */
- return EXPP_ReturnPyObjError( PyExc_StopIteration,
- "iterator at end" );
- }
-
- object= Object_CreatePyObject( self->iter->ob );
- self->iter= self->iter->next;
- return object;
-}
-
-
-static PyObject *GroupObSeq_link( BPy_GroupObSeq * self, BPy_Object *value )
-{
- Object *blen_ob;
-
- GROUP_DEL_CHECK_PY(self->bpygroup);
-
- if( !BPy_Object_Check(value) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a python object as an argument" ) );
-
- /*
- if (self->iter != NULL)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "Cannot modify group objects while iterating" );
- */
-
- blen_ob = value->object;
-
- add_to_group_wraper(self->bpygroup->group, blen_ob); /* this checks so as not to add the object into the group twice*/
-
- Py_RETURN_NONE;
-}
-
-static PyObject *GroupObSeq_unlink( BPy_GroupObSeq * self, BPy_Object *value )
-{
- Object *blen_ob;
- Base *base= NULL;
-
- GROUP_DEL_CHECK_PY(self->bpygroup);
-
- if( !BPy_Object_Check(value) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a python object as an argument" ) );
-
- blen_ob = value->object;
-
-
-
- rem_from_group(self->bpygroup->group, blen_ob);
-
- if(find_group(blen_ob)==NULL) {
- blen_ob->flag &= ~OB_FROMGROUP;
-
- base= object_in_scene(blen_ob, G.scene);
- if (base)
- base->flag &= ~OB_FROMGROUP;
- }
- Py_RETURN_NONE;
-}
-
-static struct PyMethodDef BPy_GroupObSeq_methods[] = {
- {"link", (PyCFunction)GroupObSeq_link, METH_O,
- "make the object a part of this group"},
- {"unlink", (PyCFunction)GroupObSeq_unlink, METH_O,
- "unlink an object from this group"},
- {NULL, NULL, 0, NULL}
-};
-
-/************************************************************************
- *
- * Python GroupObSeq_Type standard operations
- *
- ************************************************************************/
-
-static void GroupObSeq_dealloc( BPy_GroupObSeq * self )
-{
- Py_DECREF(self->bpygroup);
- PyObject_DEL( self );
-}
-
-/*****************************************************************************/
-/* Python GroupObSeq_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject GroupObSeq_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender GroupObSeq", /* char *tp_name; */
- sizeof( BPy_GroupObSeq ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- ( destructor ) GroupObSeq_dealloc,/* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- NULL, /* cmpfunc tp_compare; */
- NULL, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- &GroupObSeq_as_sequence, /* 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; */
- 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, /* 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, /* richcmpfunc tp_richcompare; */
-
- /*** weak reference enabler ***/
- 0, /* long tp_weaklistoffset; */
-
- /*** Added in release 2.2 ***/
- /* Iterators */
- ( getiterfunc) GroupObSeq_getIter, /* getiterfunc tp_iter; */
- ( iternextfunc ) GroupObSeq_nextIter, /* iternextfunc tp_iternext; */
-
- /*** Attribute descriptor and subclassing stuff ***/
- BPy_GroupObSeq_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- NULL, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
diff --git a/source/blender/python/api2_2x/Group.h b/source/blender/python/api2_2x/Group.h
deleted file mode 100644
index 68b6ce3eb17..00000000000
--- a/source/blender/python/api2_2x/Group.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * $Id: Group.h 11864 2007-08-28 10:07:08Z sirdude $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Michel Selten
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_GROUP_H
-#define EXPP_GROUP_H
-
-#include <Python.h>
-#include "DNA_group_types.h"
-
-/* The Group PyTypeObject defined in Group.c */
-extern PyTypeObject Group_Type;
-extern PyTypeObject GroupObSeq_Type;
-
-#define BPy_Group_Check(v) ((v)->ob_type == &Group_Type)
-#define BPy_GroupObSeq_Check(v) ((v)->ob_type == &GroupObSeq_Type)
-
-/*****************************************************************************/
-/* Python BPy_Group structure definition. */
-/*****************************************************************************/
-typedef struct {
- PyObject_HEAD
- struct Group *group;
-} BPy_Group;
-
-
-/* Group object sequence, iterate on the groups object listbase*/
-typedef struct {
- PyObject_VAR_HEAD /* required python macro */
- BPy_Group *bpygroup; /* link to the python group so we can know if its been removed */
- GroupObject *iter; /* so we can iterate over the objects */
-} BPy_GroupObSeq;
-
-PyObject *Group_Init( void );
-PyObject *Group_CreatePyObject( struct Group *group );
-Group *Group_FromPyObject( PyObject * py_obj );
-
-#endif /* EXPP_GROUP_H */
diff --git a/source/blender/python/api2_2x/IDProp.c b/source/blender/python/api2_2x/IDProp.c
deleted file mode 100644
index 4f2fa82b21e..00000000000
--- a/source/blender/python/api2_2x/IDProp.c
+++ /dev/null
@@ -1,895 +0,0 @@
-/**
- * $Id: IDProp.c
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * Contributor(s): Joseph Eagar
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include "DNA_ID.h"
-
-#include "BKE_idprop.h"
-
-#include "IDProp.h"
-#include "gen_utils.h"
-
-#include "MEM_guardedalloc.h"
-
-#define BSTR_EQ(a, b) (*(a) == *(b) && !strcmp(a, b))
-
-/*** Function to wrap ID properties ***/
-PyObject *BPy_Wrap_IDProperty(ID *id, IDProperty *prop, IDProperty *parent);
-
-extern PyTypeObject IDArray_Type;
-extern PyTypeObject IDGroup_Iter_Type;
-
-/*********************** ID Property Main Wrapper Stuff ***************/
-
-PyObject *IDGroup_repr( BPy_IDProperty *self )
-{
- return PyString_FromString( "(ID Property)" );
-}
-
-extern PyTypeObject IDGroup_Type;
-
-PyObject *BPy_IDGroup_WrapData( ID *id, IDProperty *prop )
-{
- switch ( prop->type ) {
- case IDP_STRING:
- return PyString_FromString( prop->data.pointer );
- case IDP_INT:
- return PyInt_FromLong( (long)prop->data.val );
- case IDP_FLOAT:
- return PyFloat_FromDouble( (double)(*(float*)(&prop->data.val)) );
- case IDP_GROUP:
- /*blegh*/
- {
- BPy_IDProperty *group = PyObject_New(BPy_IDProperty, &IDGroup_Type);
- if (!group)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyObject_New() failed" );
-
- group->id = id;
- group->prop = prop;
- return (PyObject*) group;
- }
- case IDP_ARRAY:
- {
- BPy_IDProperty *array = PyObject_New(BPy_IDProperty, &IDArray_Type);
- if (!array)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyObject_New() failed" );
-
- array->id = id;
- array->prop = prop;
- return (PyObject*) array;
- }
- }
- Py_RETURN_NONE;
-}
-
-int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject *value)
-{
- switch (prop->type) {
- case IDP_STRING:
- {
- char *st;
- if (!PyString_Check(value))
- return EXPP_ReturnIntError(PyExc_TypeError, "expected a string!");
-
- st = PyString_AsString(value);
- IDP_ResizeArray(prop, strlen(st)+1);
- strcpy(prop->data.pointer, st);
- return 0;
- }
-
- case IDP_INT:
- {
- int ivalue;
- if (!PyNumber_Check(value))
- return EXPP_ReturnIntError(PyExc_TypeError, "expected an int!");
- value = PyNumber_Int(value);
- if (!value)
- return EXPP_ReturnIntError(PyExc_TypeError, "expected an int!");
- ivalue = (int) PyInt_AsLong(value);
- prop->data.val = ivalue;
- Py_XDECREF(value);
- break;
- }
- case IDP_FLOAT:
- {
- float fvalue;
- if (!PyNumber_Check(value))
- return EXPP_ReturnIntError(PyExc_TypeError, "expected a float!");
- value = PyNumber_Float(value);
- if (!value)
- return EXPP_ReturnIntError(PyExc_TypeError, "expected a float!");
- fvalue = (float) PyFloat_AsDouble(value);
- *(float*)&self->prop->data.val = fvalue;
- Py_XDECREF(value);
- break;
- }
-
- default:
- return EXPP_ReturnIntError(PyExc_AttributeError, "attempt to set read-only attribute!");
- }
- return 0;
-}
-
-PyObject *BPy_IDGroup_GetName(BPy_IDProperty *self, void *bleh)
-{
- return PyString_FromString(self->prop->name);
-}
-
-int BPy_IDGroup_SetName(BPy_IDProperty *self, PyObject *value, void *bleh)
-{
- char *st;
- if (!PyString_Check(value))
- return EXPP_ReturnIntError(PyExc_TypeError, "expected a string!");
-
- st = PyString_AsString(value);
- if (strlen(st) >= MAX_IDPROP_NAME)
- return EXPP_ReturnIntError(PyExc_TypeError, "string length cannot exceed 31 characters!");
-
- strcpy(self->prop->name, st);
- return 0;
-}
-
-PyObject *BPy_IDGroup_GetType(BPy_IDProperty *self)
-{
- return PyInt_FromLong((long)self->prop->type);
-}
-
-static PyGetSetDef BPy_IDGroup_getseters[] = {
- {"name",
- (getter)BPy_IDGroup_GetName, (setter)BPy_IDGroup_SetName,
- "The name of this Group.",
- NULL},
- {NULL, NULL, NULL, NULL, NULL}
-};
-
-int BPy_IDGroup_Map_Len(BPy_IDProperty *self)
-{
- if (self->prop->type != IDP_GROUP)
- return EXPP_ReturnIntError( PyExc_TypeError,
- "len() of unsized object");
-
- return self->prop->len;
-}
-
-PyObject *BPy_IDGroup_Map_GetItem(BPy_IDProperty *self, PyObject *item)
-{
- IDProperty *loop;
- char *st;
-
- if (self->prop->type != IDP_GROUP)
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "unsubscriptable object");
-
- if (!PyString_Check(item))
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "only strings are allowed as keys of ID properties");
-
- st = PyString_AsString(item);
- for (loop=self->prop->data.group.first; loop; loop=loop->next) {
- if (BSTR_EQ(loop->name, st)) return BPy_IDGroup_WrapData(self->id, loop);
- }
- return EXPP_ReturnPyObjError( PyExc_KeyError,
- "key not in subgroup dict");
-}
-
-/*returns NULL on success, error string on failure*/
-char *BPy_IDProperty_Map_ValidateAndCreate(char *name, IDProperty *group, PyObject *ob)
-{
- IDProperty *prop = NULL;
- IDPropertyTemplate val = {0};
-
- if (PyFloat_Check(ob)) {
- val.f = (float) PyFloat_AsDouble(ob);
- prop = IDP_New(IDP_FLOAT, val, name);
- } else if (PyInt_Check(ob)) {
- val.i = (int) PyInt_AsLong(ob);
- prop = IDP_New(IDP_INT, val, name);
- } else if (PyString_Check(ob)) {
- val.str = PyString_AsString(ob);
- prop = IDP_New(IDP_STRING, val, name);
- } else if (PySequence_Check(ob)) {
- PyObject *item;
- int i;
-
- /*validate sequence and derive type.
- we assume IDP_INT unless we hit a float
- number; then we assume it's */
- val.array.type = IDP_INT;
- val.array.len = PySequence_Length(ob);
- for (i=0; i<val.array.len; i++) {
- item = PySequence_GetItem(ob, i);
- if (PyFloat_Check(item)) val.array.type = IDP_FLOAT;
- else if (!PyInt_Check(item)) return "only floats and ints are allowed in ID property arrays";
- Py_XDECREF(item);
- }
-
- prop = IDP_New(IDP_ARRAY, val, name);
- for (i=0; i<val.array.len; i++) {
- item = PySequence_GetItem(ob, i);
- if (val.array.type == IDP_INT) {
- item = PyNumber_Int(item);
- ((int*)prop->data.pointer)[i] = (int)PyInt_AsLong(item);
- } else {
- item = PyNumber_Float(item);
- ((float*)prop->data.pointer)[i] = (float)PyFloat_AsDouble(item);
- }
- Py_XDECREF(item);
- }
- } else if (PyMapping_Check(ob)) {
- PyObject *keys, *vals, *key, *pval;
- int i, len;
- /*yay! we get into recursive stuff now!*/
- keys = PyMapping_Keys(ob);
- vals = PyMapping_Values(ob);
-
- /*we allocate the group first; if we hit any invalid data,
- we can delete it easily enough.*/
- prop = IDP_New(IDP_GROUP, val, name);
- len = PyMapping_Length(ob);
- for (i=0; i<len; i++) {
- key = PySequence_GetItem(keys, i);
- pval = PySequence_GetItem(vals, i);
- if (!PyString_Check(key)) {
- IDP_FreeProperty(prop);
- MEM_freeN(prop);
- Py_XDECREF(keys);
- Py_XDECREF(vals);
- Py_XDECREF(key);
- Py_XDECREF(pval);
- return "invalid element in subgroup dict template!";
- }
- if (BPy_IDProperty_Map_ValidateAndCreate(PyString_AsString(key), prop, pval)) {
- IDP_FreeProperty(prop);
- MEM_freeN(prop);
- Py_XDECREF(keys);
- Py_XDECREF(vals);
- Py_XDECREF(key);
- Py_XDECREF(pval);
- return "invalid element in subgroup dict template!";
- }
- Py_XDECREF(key);
- Py_XDECREF(pval);
- }
- Py_XDECREF(keys);
- Py_XDECREF(vals);
- } else return "invalid property value";
-
- IDP_ReplaceInGroup(group, prop);
- return NULL;
-}
-
-int BPy_IDGroup_Map_SetItem(BPy_IDProperty *self, PyObject *key, PyObject *val)
-{
- char *err;
-
- if (self->prop->type != IDP_GROUP)
- return EXPP_ReturnIntError( PyExc_TypeError,
- "unsubscriptable object");
-
- if (!PyString_Check(key))
- return EXPP_ReturnIntError( PyExc_TypeError,
- "only strings are allowed as subgroup keys" );
-
- if (val == NULL) {
- IDProperty *pkey = IDP_GetPropertyFromGroup(self->prop, PyString_AsString(key));
- if (pkey) {
- IDP_RemFromGroup(self->prop, pkey);
- IDP_FreeProperty(pkey);
- MEM_freeN(pkey);
- return 0;
- } else return EXPP_ReturnIntError( PyExc_RuntimeError, "property not found in group" );
- }
-
- err = BPy_IDProperty_Map_ValidateAndCreate(PyString_AsString(key), self->prop, val);
- if (err) return EXPP_ReturnIntError( PyExc_RuntimeError, err );
-
- return 0;
-}
-
-PyObject *BPy_IDGroup_SpawnIterator(BPy_IDProperty *self)
-{
- BPy_IDGroup_Iter *iter = PyObject_New(BPy_IDGroup_Iter, &IDGroup_Iter_Type);
-
- if (!iter)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyObject_New() failed" );
- iter->group = self;
- iter->mode = IDPROP_ITER_KEYS;
- iter->cur = self->prop->data.group.first;
- Py_XINCREF(iter);
- return (PyObject*) iter;
-}
-
-PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop)
-{
- switch (prop->type) {
- case IDP_STRING:
- return PyString_FromString(prop->data.pointer);
- break;
- case IDP_FLOAT:
- return PyFloat_FromDouble(*((float*)&prop->data.val));
- break;
- case IDP_INT:
- return PyInt_FromLong( (long)prop->data.val );
- break;
- case IDP_ARRAY:
- {
- PyObject *seq = PyList_New(prop->len);
- int i;
-
- if (!seq)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyList_New() failed" );
-
- for (i=0; i<prop->len; i++) {
- if (prop->subtype == IDP_FLOAT)
- PyList_SetItem(seq, i,
- PyFloat_FromDouble(((float*)prop->data.pointer)[i]));
-
- else PyList_SetItem(seq, i,
- PyInt_FromLong(((int*)prop->data.pointer)[i]));
- }
- return seq;
- }
- case IDP_GROUP:
- {
- PyObject *dict = PyDict_New(), *wrap;
- IDProperty *loop;
-
- if (!dict)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyDict_New() failed" );
-
- for (loop=prop->data.group.first; loop; loop=loop->next) {
- wrap = BPy_IDGroup_MapDataToPy(loop);
- if (!wrap)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "BPy_IDGroup_MapDataToPy() failed" );
-
- PyDict_SetItemString(dict, loop->name, wrap);
- }
- return dict;
- }
- }
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "eek!! a property exists with a bad type code!!!" );
-}
-
-PyObject *BPy_IDGroup_Pop(BPy_IDProperty *self, PyObject *value)
-{
- IDProperty *loop;
- PyObject *pyform;
- char *name = PyString_AsString(value);
-
- if (!name) {
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "pop expected at least 1 arguments, got 0" );
- }
-
- for (loop=self->prop->data.group.first; loop; loop=loop->next) {
- if (BSTR_EQ(loop->name, name)) {
- pyform = BPy_IDGroup_MapDataToPy(loop);
-
- if (!pyform)
- /*ok something bad happened with the pyobject,
- so don't remove the prop from the group. if pyform is
- NULL, then it already should have raised an exception.*/
- return NULL;
-
- IDP_RemFromGroup(self->prop, loop);
- return pyform;
- }
- }
-
- return EXPP_ReturnPyObjError( PyExc_KeyError,
- "item not in group" );
-}
-
-PyObject *BPy_IDGroup_IterItems(BPy_IDProperty *self)
-{
- BPy_IDGroup_Iter *iter = PyObject_New(BPy_IDGroup_Iter, &IDGroup_Iter_Type);
-
- if (!iter)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyObject_New() failed" );
-
- iter->group = self;
- iter->mode = IDPROP_ITER_ITEMS;
- iter->cur = self->prop->data.group.first;
- Py_XINCREF(iter);
- return (PyObject*) iter;
-}
-
-PyObject *BPy_IDGroup_GetKeys(BPy_IDProperty *self)
-{
- PyObject *seq = PyList_New(self->prop->len);
- IDProperty *loop;
- int i;
-
- if (!seq)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyList_New() failed" );
-
- for (i=0, loop=self->prop->data.group.first; loop; loop=loop->next, i++)
- PyList_SetItem(seq, i, PyString_FromString(loop->name));
-
- return seq;
-}
-
-PyObject *BPy_IDGroup_GetValues(BPy_IDProperty *self)
-{
- PyObject *seq = PyList_New(self->prop->len);
- IDProperty *loop;
- int i;
-
- if (!seq)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyList_New() failed" );
-
- for (i=0, loop=self->prop->data.group.first; loop; loop=loop->next, i++) {
- PyList_SetItem(seq, i, BPy_IDGroup_WrapData(self->id, loop));
- }
-
- return seq;
-}
-
-PyObject *BPy_IDGroup_HasKey(BPy_IDProperty *self, PyObject *value)
-{
- IDProperty *loop;
- char *name = PyString_AsString(value);
-
- if (!name)
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a string");
-
- for (loop=self->prop->data.group.first; loop; loop=loop->next) {
- if (BSTR_EQ(loop->name, name)) Py_RETURN_TRUE;
- }
-
- Py_RETURN_FALSE;
-}
-
-PyObject *BPy_IDGroup_Update(BPy_IDProperty *self, PyObject *vars)
-{
- PyObject *pyob, *pkey, *pval;
- int i=0;
-
- if (PySequence_Size(vars) != 1)
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected an object derived from dict.");
-
- pyob = PyTuple_GET_ITEM(vars, 0);
- if (!PyDict_Check(pyob))
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected an object derived from dict.");
-
- while (PyDict_Next(pyob, &i, &pkey, &pval)) {
- BPy_IDGroup_Map_SetItem(self, pkey, pval);
- if (PyErr_Occurred()) return NULL;
- }
-
- Py_RETURN_NONE;
-}
-
-PyObject *BPy_IDGroup_ConvertToPy(BPy_IDProperty *self)
-{
- return BPy_IDGroup_MapDataToPy(self->prop);
-}
-
-static struct PyMethodDef BPy_IDGroup_methods[] = {
- {"pop", (PyCFunction)BPy_IDGroup_Pop, METH_O,
- "pop an item from the group; raises KeyError if the item doesn't exist."},
- {"iteritems", (PyCFunction)BPy_IDGroup_IterItems, METH_NOARGS,
- "iterate through the items in the dict; behaves like dictionary method iteritems."},
- {"keys", (PyCFunction)BPy_IDGroup_GetKeys, METH_NOARGS,
- "get the keys associated with this group as a list of strings."},
- {"values", (PyCFunction)BPy_IDGroup_GetValues, METH_NOARGS,
- "get the values associated with this group."},
- {"has_key", (PyCFunction)BPy_IDGroup_HasKey, METH_O,
- "returns true if the group contains a key, false if not."},
- {"update", (PyCFunction)BPy_IDGroup_Update, METH_VARARGS,
- "updates the values in the group with the values of another or a dict."},
- {"convert_to_pyobject", (PyCFunction)BPy_IDGroup_ConvertToPy, METH_NOARGS,
- "return a purely python version of the group."},
- {0, NULL, 0, NULL}
-};
-
-PyMappingMethods BPy_IDGroup_Mapping = {
- (inquiry)BPy_IDGroup_Map_Len, /*inquiry mp_length */
- (binaryfunc)BPy_IDGroup_Map_GetItem, /*binaryfunc mp_subscript */
- (objobjargproc)BPy_IDGroup_Map_SetItem, /*objobjargproc mp_ass_subscript */
-};
-
-PyTypeObject IDGroup_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender IDProperty", /* char *tp_name; */
- sizeof( BPy_IDProperty ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL, /* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- NULL, /* cmpfunc tp_compare; */
- ( reprfunc ) IDGroup_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- &BPy_IDGroup_Mapping, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- NULL, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
- 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, /* 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, /* richcmpfunc tp_richcompare; */
-
- /*** weak reference enabler ***/
- 0, /* long tp_weaklistoffset; */
-
- /*** Added in release 2.2 ***/
- /* Iterators */
- (getiterfunc)BPy_IDGroup_SpawnIterator, /* getiterfunc tp_iter; */
- NULL, /* iternextfunc tp_iternext; */
- /*** Attribute descriptor and subclassing stuff ***/
- BPy_IDGroup_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_IDGroup_getseters, /* struct PyGetSetDef *tp_getset; */
-};
-
-/*********** Main external wrapping function *******/
-PyObject *BPy_Wrap_IDProperty(ID *id, IDProperty *prop, IDProperty *parent)
-{
- BPy_IDProperty *wrap = PyObject_New(BPy_IDProperty, &IDGroup_Type);
-
- if (!wrap)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyObject_New() failed" );
-
- wrap->prop = prop;
- wrap->parent = parent;
- wrap->id = id;
- //wrap->destroy = 0;
- return (PyObject*) wrap;
-}
-
-
-/********Array Wrapper********/
-
-PyObject *IDArray_repr(BPy_IDArray *self)
-{
- return PyString_FromString("(ID Array)");
-}
-
-
-PyObject *BPy_IDArray_GetType(BPy_IDArray *self)
-{
- return PyInt_FromLong( (long)self->prop->subtype );
-}
-
-PyObject *BPy_IDArray_GetLen(BPy_IDArray *self)
-{
- return PyInt_FromLong( (long)self->prop->len );
-}
-
-static PyGetSetDef BPy_IDArray_getseters[] = {
- {"len",
- (getter)BPy_IDArray_GetLen, (setter)NULL,
- "The length of the array, can also be gotten with len(array).",
- NULL},
- {"type",
- (getter)BPy_IDArray_GetType, (setter)NULL,
- "The type of the data in the array, is an ant.",
- NULL},
- {NULL, NULL, NULL, NULL, NULL},
-};
-
-int BPy_IDArray_Len(BPy_IDArray *self)
-{
- return self->prop->len;
-}
-
-PyObject *BPy_IDArray_GetItem(BPy_IDArray *self, int index)
-{
- if (index < 0 || index >= self->prop->len)
- return EXPP_ReturnPyObjError( PyExc_IndexError,
- "index out of range!");
-
- switch (self->prop->subtype) {
- case IDP_FLOAT:
- return PyFloat_FromDouble( (double)(((float*)self->prop->data.pointer)[index]));
- break;
- case IDP_INT:
- return PyInt_FromLong( (long)((int*)self->prop->data.pointer)[index] );
- break;
- }
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "invalid/corrupt array type!");
-}
-
-int BPy_IDArray_SetItem(BPy_IDArray *self, int index, PyObject *val)
-{
- int i;
- float f;
-
- if (index < 0 || index >= self->prop->len)
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "index out of range!");
-
- switch (self->prop->subtype) {
- case IDP_FLOAT:
- if (!PyNumber_Check(val)) return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a float");
- val = PyNumber_Float(val);
- if (!val) return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a float");
-
- f = (float) PyFloat_AsDouble(val);
- ((float*)self->prop->data.pointer)[index] = f;
- Py_XDECREF(val);
- break;
- case IDP_INT:
- if (!PyNumber_Check(val)) return EXPP_ReturnIntError( PyExc_TypeError,
- "expected an int");
- val = PyNumber_Int(val);
- if (!val) return EXPP_ReturnIntError( PyExc_TypeError,
- "expected an int");
-
- i = (int) PyInt_AsLong(val);
- ((int*)self->prop->data.pointer)[index] = i;
- Py_XDECREF(val);
- break;
- }
- return 0;
-}
-
-static PySequenceMethods BPy_IDArray_Seq = {
- (inquiry) BPy_IDArray_Len, /* inquiry sq_length */
- 0, /* binaryfunc sq_concat */
- 0, /* intargfunc sq_repeat */
- (intargfunc)BPy_IDArray_GetItem, /* intargfunc sq_item */
- 0, /* intintargfunc sq_slice */
- (intobjargproc)BPy_IDArray_SetItem, /* intobjargproc sq_ass_item */
- 0, /* intintobjargproc sq_ass_slice */
- 0, /* objobjproc sq_contains */
- /* Added in release 2.0 */
- 0, /* binaryfunc sq_inplace_concat */
- 0, /* intargfunc sq_inplace_repeat */
-};
-
-PyTypeObject IDArray_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender IDArray", /* char *tp_name; */
- sizeof( BPy_IDArray ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL, /* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- NULL, /* cmpfunc tp_compare; */
- ( reprfunc ) IDArray_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- &BPy_IDArray_Seq, /* 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; */
- 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, /* 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, /* 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 ***/
- NULL, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_IDArray_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-/*********** ID Property Group iterator ********/
-
-PyObject *IDGroup_Iter_iterself(PyObject *self)
-{
- Py_XINCREF(self);
- return self;
-}
-
-PyObject *IDGroup_Iter_repr(BPy_IDGroup_Iter *self)
-{
- return PyString_FromString("(ID Property Group)");
-}
-
-PyObject *BPy_Group_Iter_Next(BPy_IDGroup_Iter *self)
-{
- IDProperty *cur=NULL;
- PyObject *tmpval;
- PyObject *ret;
-
- if (self->cur) {
- cur = self->cur;
- self->cur = self->cur->next;
- if (self->mode == IDPROP_ITER_ITEMS) {
- tmpval = BPy_IDGroup_WrapData(self->group->id, cur);
- ret = Py_BuildValue("[s, O]", cur->name, tmpval);
- Py_DECREF(tmpval);
- return ret;
- } else {
- return PyString_FromString(cur->name);
- }
- } else {
- return EXPP_ReturnPyObjError( PyExc_StopIteration,
- "iterator at end" );
- }
-}
-
-PyTypeObject IDGroup_Iter_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender IDGroup_Iter", /* char *tp_name; */
- sizeof( BPy_IDGroup_Iter ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL, /* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- NULL, /* cmpfunc tp_compare; */
- ( reprfunc ) IDGroup_Iter_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- 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; */
- 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, /* 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, /* richcmpfunc tp_richcompare; */
-
- /*** weak reference enabler ***/
- 0, /* long tp_weaklistoffset; */
-
- /*** Added in release 2.2 ***/
- /* Iterators */
- IDGroup_Iter_iterself, /* getiterfunc tp_iter; */
- (iternextfunc) BPy_Group_Iter_Next, /* iternextfunc tp_iternext; */
-};
-
-void IDProp_Init_Types(void)
-{
- PyType_Ready( &IDGroup_Type );
- PyType_Ready( &IDGroup_Iter_Type );
- PyType_Ready( &IDArray_Type );
-}
diff --git a/source/blender/python/api2_2x/Image.c b/source/blender/python/api2_2x/Image.c
deleted file mode 100644
index f68cb2d8eeb..00000000000
--- a/source/blender/python/api2_2x/Image.c
+++ /dev/null
@@ -1,1339 +0,0 @@
-/*
- * $Id: Image.c 11241 2007-07-12 11:51:21Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano, Campbell Barton, Joilnen B. Leite,
- * Austin Benesh
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-#include "Image.h" /*This must come first */
-
-#include "BDR_drawmesh.h" /* free_realtime_image */
-#include "BKE_main.h"
-#include "BKE_global.h"
-#include "BKE_library.h"
-#include "BKE_image.h"
-#include "BKE_idprop.h"
-#include "BIF_drawimage.h"
-#include "BLI_blenlib.h"
-#include "DNA_space_types.h" /* FILE_MAXDIR = 160 */
-#include "IMB_imbuf_types.h" /* for the IB_rect define */
-#include "BIF_gl.h"
-#include "gen_utils.h"
-#include "gen_library.h"
-#include "BKE_packedFile.h"
-#include "DNA_packedFile_types.h"
-#include "BKE_icons.h"
-#include "IMB_imbuf.h"
-#include "IDProp.h"
-
-/* used so we can get G.scene->r.cfra for getting the
-current image frame, some images change frame if they are a sequence */
-#include "DNA_scene_types.h"
-
-/*****************************************************************************/
-/* Python BPy_Image defaults: */
-/*****************************************************************************/
-#define EXPP_IMAGE_REP 1
-#define EXPP_IMAGE_REP_MIN 1
-#define EXPP_IMAGE_REP_MAX 16
-
-
-enum img_consts {
- EXPP_IMAGE_ATTR_XREP = 0,
- EXPP_IMAGE_ATTR_YREP,
- EXPP_IMAGE_ATTR_START,
- EXPP_IMAGE_ATTR_END,
- EXPP_IMAGE_ATTR_SPEED,
- EXPP_IMAGE_ATTR_BINDCODE,
- EXPP_IMAGE_ATTR_SOURCE,
-};
-
-/************************/
-/*** The Image Module ***/
-/************************/
-
-/*****************************************************************************/
-/* Python API function prototypes for the Image module. */
-/*****************************************************************************/
-static PyObject *M_Image_New( PyObject * self, PyObject * args );
-static PyObject *M_Image_Get( PyObject * self, PyObject * args );
-static PyObject *M_Image_GetCurrent( PyObject * self );
-static PyObject *M_Image_Load( PyObject * self, PyObject * value );
-
-
-/*****************************************************************************/
-/* Python BPy_Image methods declarations: */
-/*****************************************************************************/
-static PyObject *Image_getFilename( BPy_Image * self );
-static PyObject *Image_getSize( BPy_Image * self );
-static PyObject *Image_getDepth( BPy_Image * self );
-static PyObject *Image_getXRep( BPy_Image * self );
-static PyObject *Image_getYRep( BPy_Image * self );
-static PyObject *Image_getBindCode( BPy_Image * self );
-static PyObject *Image_getStart( BPy_Image * self );
-static PyObject *Image_getEnd( BPy_Image * self );
-static PyObject *Image_getSpeed( BPy_Image * self );
-static int Image_setFilename( BPy_Image * self, PyObject * args );
-static PyObject *Image_oldsetFilename( BPy_Image * self, PyObject * args );
-static PyObject *Image_setXRep( BPy_Image * self, PyObject * value );
-static PyObject *Image_setYRep( BPy_Image * self, PyObject * value );
-static PyObject *Image_setStart( BPy_Image * self, PyObject * args );
-static PyObject *Image_setEnd( BPy_Image * self, PyObject * args );
-static PyObject *Image_setSpeed( BPy_Image * self, PyObject * args );
-static PyObject *Image_reload( BPy_Image * self );
-static PyObject *Image_glLoad( BPy_Image * self );
-static PyObject *Image_glFree( BPy_Image * self );
-static PyObject *Image_getPixelF( BPy_Image * self, PyObject * args );
-static PyObject *Image_getPixelI( BPy_Image * self, PyObject * args );
-static PyObject *Image_setPixelF( BPy_Image * self, PyObject * args );
-static PyObject *Image_setPixelI( BPy_Image * self, PyObject * args );
-static PyObject *Image_getMaxXY( BPy_Image * self );
-static PyObject *Image_getMinXY( BPy_Image * self );
-static PyObject *Image_save( BPy_Image * self );
-static PyObject *Image_unpack( BPy_Image * self, PyObject * value );
-static PyObject *Image_pack( BPy_Image * self );
-static PyObject *Image_makeCurrent( BPy_Image * self );
-
-
-/*****************************************************************************/
-/* Python BPy_Image methods table: */
-/*****************************************************************************/
-static PyMethodDef BPy_Image_methods[] = {
- /* name, method, flags, doc */
- {"getPixelF", ( PyCFunction ) Image_getPixelF, METH_VARARGS,
- "(int, int) - Get pixel color as floats 0.0-1.0 returns [r,g,b,a]"},
- {"getPixelI", ( PyCFunction ) Image_getPixelI, METH_VARARGS,
- "(int, int) - Get pixel color as ints 0-255 returns [r,g,b,a]"},
- {"setPixelF", ( PyCFunction ) Image_setPixelF, METH_VARARGS,
- "(int, int, [f r,f g,f b,f a]) - Set pixel color using floats 0.0-1.0"},
- {"setPixelI", ( PyCFunction ) Image_setPixelI, METH_VARARGS,
- "(int, int, [i r, i g, i b, i a]) - Set pixel color using ints 0-255"},
- {"getMaxXY", ( PyCFunction ) Image_getMaxXY, METH_NOARGS,
- "() - Get maximum x & y coordinates of current image as [x, y]"},
- {"getMinXY", ( PyCFunction ) Image_getMinXY, METH_NOARGS,
- "() - Get minimun x & y coordinates of image as [x, y]"},
- {"getName", ( PyCFunction ) GenericLib_getName, METH_NOARGS,
- "() - Return Image object name"},
- {"getFilename", ( PyCFunction ) Image_getFilename, METH_NOARGS,
- "() - Return Image object filename"},
- {"getSize", ( PyCFunction ) Image_getSize, METH_NOARGS,
- "() - Return Image object [width, height] dimension in pixels"},
- {"getDepth", ( PyCFunction ) Image_getDepth, METH_NOARGS,
- "() - Return Image object pixel depth"},
- {"getXRep", ( PyCFunction ) Image_getXRep, METH_NOARGS,
- "() - Return Image object x repetition value"},
- {"getYRep", ( PyCFunction ) Image_getYRep, METH_NOARGS,
- "() - Return Image object y repetition value"},
- {"getStart", ( PyCFunction ) Image_getStart, METH_NOARGS,
- "() - Return Image object start frame."},
- {"getEnd", ( PyCFunction ) Image_getEnd, METH_NOARGS,
- "() - Return Image object end frame."},
- {"getSpeed", ( PyCFunction ) Image_getSpeed, METH_NOARGS,
- "() - Return Image object speed (fps)."},
- {"getBindCode", ( PyCFunction ) Image_getBindCode, METH_NOARGS,
- "() - Return Image object's bind code value"},
- {"reload", ( PyCFunction ) Image_reload, METH_NOARGS,
- "() - Reload the image from the filesystem"},
- {"glLoad", ( PyCFunction ) Image_glLoad, METH_NOARGS,
- "() - Load the image data in OpenGL texture memory.\n\
- The bindcode (int) is returned."},
- {"glFree", ( PyCFunction ) Image_glFree, METH_NOARGS,
- "() - Free the image data from OpenGL texture memory only,\n\
- see also image.glLoad()."},
- {"setName", ( PyCFunction ) GenericLib_setName_with_method, METH_VARARGS,
- "(str) - Change Image object name"},
- {"setFilename", ( PyCFunction ) Image_oldsetFilename, METH_VARARGS,
- "(str) - Change Image file name"},
- {"setXRep", ( PyCFunction ) Image_setXRep, METH_O,
- "(int) - Change Image object x repetition value"},
- {"setYRep", ( PyCFunction ) Image_setYRep, METH_O,
- "(int) - Change Image object y repetition value"},
- {"setStart", ( PyCFunction ) Image_setStart, METH_VARARGS,
- "(int) - Change Image object animation start value"},
- {"setEnd", ( PyCFunction ) Image_setEnd, METH_VARARGS,
- "(int) - Change Image object animation end value"},
- {"setSpeed", ( PyCFunction ) Image_setSpeed, METH_VARARGS,
- "(int) - Change Image object animation speed (fps)"},
- {"save", ( PyCFunction ) Image_save, METH_NOARGS,
- "() - Write image buffer to file"},
- {"unpack", ( PyCFunction ) Image_unpack, METH_VARARGS,
- "(int) - Unpack image. Uses the values defined in Blender.UnpackModes."},
- {"pack", ( PyCFunction ) Image_pack, METH_NOARGS,
- "() - Pack the image"},
- {"makeCurrent", ( PyCFunction ) Image_makeCurrent, METH_NOARGS,
- "() - Make this the currently displayed image"},
- {NULL, NULL, 0, NULL}
-};
-
-
-/*****************************************************************************/
-/* The following string definitions are used for documentation strings. */
-/* In Python these will be written to the console when doing a */
-/* Blender.Image.__doc__ */
-/*****************************************************************************/
-static char M_Image_doc[] = "The Blender Image module\n\n";
-
-static char M_Image_New_doc[] =
- "() - return a new Image object";
-
-static char M_Image_Get_doc[] =
- "(name) - return the image with the name 'name', \
-returns None if not found.\n If 'name' is not specified, \
-it returns a list of all images in the\ncurrent scene.";
-
-static char M_Image_GetCurrent_doc[] =
- "() - return the current image, from last active the uv/image view, \
-returns None no image is in the view.\n";
-
-static char M_Image_Load_doc[] =
- "(filename) - return image from file filename as Image Object, \
-returns None if not found.\n";
-
-/*****************************************************************************/
-/* Python method structure definition for Blender.Image module: */
-/*****************************************************************************/
-struct PyMethodDef M_Image_methods[] = {
- {"New", M_Image_New, METH_VARARGS, M_Image_New_doc},
- {"Get", M_Image_Get, METH_VARARGS, M_Image_Get_doc},
- {"GetCurrent", ( PyCFunction ) M_Image_GetCurrent, METH_NOARGS, M_Image_GetCurrent_doc},
- {"get", M_Image_Get, METH_VARARGS, M_Image_Get_doc},
- {"Load", M_Image_Load, METH_O, M_Image_Load_doc},
- {NULL, NULL, 0, NULL}
-};
-
-
-/*****************************************************************************/
-/* Function: M_Image_New */
-/* Python equivalent: Blender.Image.New */
-/*****************************************************************************/
-static PyObject *M_Image_New( PyObject * self, PyObject * args)
-{
- int width, height, depth;
- char *name;
- float color[] = {0, 0, 0, 1};
- Image *image;
- if( !PyArg_ParseTuple( args, "siii", &name, &width, &height, &depth ) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected 1 string and 3 ints" ) );
- if (width > 5000 || height > 5000 || width < 1 || height < 1)
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "Image width and height must be between 1 and 5000" ) );
- image = BKE_add_image_size(width, height, name, 0, color);
- if( !image )
- return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create PyObject Image_Type" ) );
-
- /* reset usage count, since BKE_add_image_size() incremented it */
- /* image->id.us--; */
- /* Strange, new images have a user count of one???, otherwise it messes up */
-
- return Image_CreatePyObject( image );
-}
-
-
-
-/*****************************************************************************/
-/* Function: M_Image_Get */
-/* Python equivalent: Blender.Image.Get */
-/* Description: Receives a string and returns the image object */
-/* whose name matches the string. If no argument is */
-/* passed in, a list of all image names in the */
-/* current scene is returned. */
-/*****************************************************************************/
-static PyObject *M_Image_Get( PyObject * self, PyObject * args )
-{
- char *name = NULL;
- Image *img_iter;
-
- if( !PyArg_ParseTuple( args, "|s", &name ) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument (or nothing)" ) );
-
- img_iter = G.main->image.first;
-
- if( name ) { /* (name) - Search image by name */
-
- BPy_Image *wanted_image = NULL;
-
- while( ( img_iter ) && ( wanted_image == NULL ) ) {
- if( strcmp( name, img_iter->id.name + 2 ) == 0 ) {
- wanted_image = ( BPy_Image * )
- PyObject_NEW( BPy_Image, &Image_Type );
- if( wanted_image )
- wanted_image->image = img_iter;
- }
- img_iter = img_iter->id.next;
- }
-
- if( wanted_image == NULL ) { /* Requested image doesn't exist */
- char error_msg[64];
- PyOS_snprintf( error_msg, sizeof( error_msg ),
- "Image \"%s\" not found", name );
- return ( EXPP_ReturnPyObjError
- ( PyExc_NameError, error_msg ) );
- }
-
- return ( PyObject * ) wanted_image;
- }
-
- else { /* () - return a list of all images in the scene */
- int index = 0;
- PyObject *img_list, *pyobj;
-
- img_list = PyList_New( BLI_countlist( &( G.main->image ) ) );
-
- if( img_list == NULL )
- return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create PyList" ) );
-
- while( img_iter ) {
- pyobj = Image_CreatePyObject( img_iter );
-
- PyList_SET_ITEM( img_list, index, pyobj );
-
- img_iter = img_iter->id.next;
- index++;
- }
-
- return ( img_list );
- }
-}
-
-
-
-/*****************************************************************************/
-/* Function: M_Image_GetCurrent*/
-/* Python equivalent: Blender.Image.GetCurrent */
-/* Description: Returns the active current (G.sima) */
-/* This will be the image last under the mouse cursor */
-/* None if there is no Image. */
-/*****************************************************************************/
-static PyObject *M_Image_GetCurrent( PyObject * self )
-{
- if (!G.sima || !G.sima->image) {
- Py_RETURN_NONE;
- }
- what_image( G.sima ); /* make sure image data exists */
- return Image_CreatePyObject( G.sima->image );
-}
-
-
-/*****************************************************************************/
-/* Function: M_Image_Load */
-/* Python equivalent: Blender.Image.Load */
-/* Description: Receives a string and returns the image object */
-/* whose filename matches the string. */
-/*****************************************************************************/
-static PyObject *M_Image_Load( PyObject * self, PyObject * value )
-{
- char *fname = PyString_AsString(value);
- Image *img_ptr;
- BPy_Image *image;
-
- if( !value )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument" ) );
-
- image = ( BPy_Image * ) PyObject_NEW( BPy_Image, &Image_Type );
-
- if( !image )
- return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create PyObject Image_Type" ) );
-
- img_ptr = BKE_add_image_file( fname );
- if( !img_ptr )
- return ( EXPP_ReturnPyObjError( PyExc_IOError,
- "couldn't load image" ) );
-
- /* force a load the image buffers*/
- BKE_image_get_ibuf(img_ptr, NULL);
-
- image->image = img_ptr;
-
- return ( PyObject * ) image;
-}
-
-
-/**
- * getPixelF( x, y )
- * returns float list of pixel colors in rgba order.
- * returned values are floats normalized to 0.0 - 1.0.
- * blender images are all 4x8 bit at the moment apr-2005
- */
-
-static PyObject *Image_getPixelF( BPy_Image * self, PyObject * args )
-{
-
- PyObject *attr;
- ImBuf *ibuf= BKE_image_get_ibuf(self->image, NULL);
- char *pixel; /* image data */
- int index; /* offset into image data */
- int x = 0;
- int y = 0;
- int pixel_size = 4; /* each pixel is 4 x 8-bits packed in unsigned int */
- int i;
-
- if( !PyArg_ParseTuple( args, "ii", &x, &y ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected 2 integers" );
-
- if( !ibuf || !ibuf->rect ) /* loading didn't work */
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't load image data in Blender" );
-
- if( ibuf->type == 1 ) /* bitplane image */
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "unsupported bitplane image format" );
-
- if( x > ( ibuf->x - 1 )
- || y > ( ibuf->y - 1 )
- || x < ibuf->xorig || y < ibuf->yorig )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "x or y is out of range" );
-
- /*
- assumption: from looking at source, skipx is often not set,
- so we calc ourselves
- */
-
- attr = PyList_New(4);
-
- if (!attr)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't allocate memory for color list" );
-
- index = ( x + y * ibuf->x ) * pixel_size;
-
- pixel = ( char * ) ibuf->rect;
- for (i=0; i<4; i++) {
- PyList_SetItem( attr, i, PyFloat_FromDouble( ( ( double ) pixel[index+i] ) / 255.0 ));
- }
- return attr;
-}
-
-
-/**
- * getPixelI( x, y )
- * returns integer list of pixel colors in rgba order.
- * returned values are ints normalized to 0-255.
- * blender images are all 4x8 bit at the moment apr-2005
- */
-
-static PyObject *Image_getPixelI( BPy_Image * self, PyObject * args )
-{
- PyObject *attr = PyList_New(4);
- ImBuf *ibuf= BKE_image_get_ibuf(self->image, NULL);
- char *pixel; /* image data */
- int index; /* offset into image data */
- int x = 0;
- int y = 0;
- int pixel_size = 4; /* each pixel is 4 x 8-bits packed in unsigned int */
- int i;
-
- if (!attr)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't allocate memory for color list" );
-
- if( !PyArg_ParseTuple( args, "ii", &x, &y ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected 2 integers" );
-
- if( !ibuf || !ibuf->rect ) /* didn't work */
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't load image data in Blender" );
-
- if( ibuf->type == 1 ) /* bitplane image */
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "unsupported bitplane image format" );
-
- if( x > ( ibuf->x - 1 )
- || y > ( ibuf->y - 1 )
- || x < ibuf->xorig || y < ibuf->yorig )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "x or y is out of range" );
-
- /*
- assumption: from looking at source, skipx is often not set,
- so we calc ourselves
- */
-
- index = ( x + y * ibuf->x ) * pixel_size;
- pixel = ( char * ) ibuf->rect;
-
- for (i=0; i<4; i++) {
- PyList_SetItem( attr, i, PyInt_FromLong( pixel[index+i] ));
- }
- return attr;
-}
-
-
-/* set pixel as floats */
-
-static PyObject *Image_setPixelF( BPy_Image * self, PyObject * args )
-{
- ImBuf *ibuf= BKE_image_get_ibuf(self->image, NULL);
- char *pixel; /* image data */
- int index; /* offset into image data */
- int x = 0;
- int y = 0;
- int a = 0;
- int pixel_size = 4; /* each pixel is 4 x 8-bits packed in unsigned int */
- float p[4];
-
- if( !PyArg_ParseTuple
- ( args, "ii(ffff)", &x, &y, &p[0], &p[1], &p[2], &p[3] ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected 2 integers and an array of 4 floats" );
-
- if( !ibuf || !ibuf->rect ) /* didn't work */
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't load image data in Blender" );
-
- if( ibuf->type == 1 ) /* bitplane image */
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "unsupported bitplane image format" );
-
- if( x > ( ibuf->x - 1 )
- || y > ( ibuf->y - 1 )
- || x < ibuf->xorig || y < ibuf->yorig )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "x or y is out of ruange" );
-
- for( a = 0; a < 4; a++ ) {
- if( p[a] > 1.0 || p[a] < 0.0 )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "r, g, b, or a is out of range" );
- }
-
-
- /*
- assumption: from looking at source, skipx is often not set,
- so we calc ourselves
- */
-
- index = ( x + y * ibuf->x ) * pixel_size;
-
- pixel = ( char * ) ibuf->rect;
-
- pixel[index] = ( char ) ( p[0] * 255.0 );
- pixel[index + 1] = ( char ) ( p[1] * 255.0 );
- pixel[index + 2] = ( char ) ( p[2] * 255.0 );
- pixel[index + 3] = ( char ) ( p[3] * 255.0 );
-
- ibuf->userflags |= IB_BITMAPDIRTY;
- Py_RETURN_NONE;
-}
-
-
-/* set pixel as ints */
-
-static PyObject *Image_setPixelI( BPy_Image * self, PyObject * args )
-{
- ImBuf *ibuf= BKE_image_get_ibuf(self->image, NULL);
- char *pixel; /* image data */
- int index; /* offset into image data */
- int x = 0;
- int y = 0;
- int a = 0;
- int pixel_size = 4; /* each pixel is 4 x 8-bits packed in unsigned int */
- int p[4];
-
- if( !PyArg_ParseTuple
- ( args, "ii(iiii)", &x, &y, &p[0], &p[1], &p[2], &p[3] ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected 2 integers and an list of 4 ints" );
-
- if( !ibuf || !ibuf->rect ) /* didn't work */
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't load image data in Blender" );
-
- if( ibuf->type == 1 ) /* bitplane image */
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "unsupported bitplane image format" );
-
- if( x > ( ibuf->x - 1 )
- || y > ( ibuf->y - 1 )
- || x < ibuf->xorig || y < ibuf->yorig )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "x or y is out of range" );
-
- for( a = 0; a < 4; a++ ) {
- if( p[a] > 255 || p[a] < 0 )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "r, g, b, or a is out of range" );
- }
-
- /*
- assumption: from looking at source, skipx is often not set,
- so we calc ourselves
- */
-
- index = ( x + y * ibuf->x ) * pixel_size;
-
- pixel = ( char * ) ibuf->rect;
-
- pixel[index] = ( char ) p[0];
- pixel[index + 1] = ( char ) p[1];
- pixel[index + 2] = ( char ) p[2];
- pixel[index + 3] = ( char ) p[3];
-
- ibuf->userflags |= IB_BITMAPDIRTY;
- Py_RETURN_NONE;
-}
-
-
-/* get max extent of image */
-
-static PyObject *Image_getMaxXY( BPy_Image * self )
-{
- ImBuf *ibuf= BKE_image_get_ibuf(self->image, NULL);
-
- if( !ibuf || !ibuf->rect ) /* didn't work */
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't load image data in Blender" );
-
- return Py_BuildValue( "[i,i]", ibuf->x, ibuf->y );
-}
-
-
-/* get min extent of image */
-
-static PyObject *Image_getMinXY( BPy_Image * self )
-{
- ImBuf *ibuf= BKE_image_get_ibuf(self->image, NULL);
-
- if( !ibuf || !ibuf->rect ) /* didn't work */
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't load image data in Blender" );
-
- return Py_BuildValue( "[i,i]", ibuf->xorig, ibuf->yorig );
-}
-
-/* unpack image */
-
-static PyObject *Image_unpack( BPy_Image * self, PyObject * value )
-{
- Image *image = self->image;
- int mode = (int)PyInt_AsLong(value);
-
- /*get the absolute path */
- if( mode==-1 )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected 1 integer from Blender.UnpackModes" );
-
- if (image->packedfile==NULL)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "image not packed" );
-
- if (unpackImage(image, mode) == RET_ERROR)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "error unpacking image" );
- Py_RETURN_NONE;
-}
-
-/* pack image */
-
-static PyObject *Image_pack( BPy_Image * self )
-{
- Image *image = self->image;
- ImBuf *ibuf = BKE_image_get_ibuf(image, NULL);
-
- if( !ibuf || !ibuf->rect ) /* didn't work */
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't load image data in Blender" );
-
- if (image->packedfile ) { /* RePack? */
- if (ibuf->userflags & IB_BITMAPDIRTY)
- BKE_image_memorypack(image);
- } else { /* Pack for the first time */
- if (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))
- BKE_image_memorypack(image);
- else
- image->packedfile = newPackedFile(image->name);
- }
- Py_RETURN_NONE;
-}
-
-
-static PyObject *Image_makeCurrent( BPy_Image * self )
-{
-#if 0 /* add back in when bpy becomes "official" */
- static char warning = 1;
- if( warning ) {
- printf("image.makeCurrent() deprecated!\n\t use 'bpy.images.active = image instead'\n");
- --warning;
- }
-#endif
-
- if (!G.sima)
- Py_RETURN_FALSE;
-
- G.sima->image= self->image;
- Py_RETURN_TRUE;
-}
-
-
-/* save image to file */
-
-static PyObject *Image_save( BPy_Image * self )
-{
- ImBuf *ibuf= BKE_image_get_ibuf(self->image, NULL);
-
- if(!ibuf)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "could not save image (no image buffer)" );
-
- /* If this is a packed file, write using writePackedFile
- * because IMB_saveiff wont save to a file */
- if (self->image->packedfile) {
- if (writePackedFile(self->image->name, self->image->packedfile, 0) != RET_OK) {
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "could not save image (writing image from packedfile failed)" );
- }
- } else if (!IMB_saveiff( ibuf, self->image->name, ibuf->flags))
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "could not save image (writing the image buffer failed)" );
-
- Py_RETURN_NONE; /* normal return, image saved */
-}
-
-static PyObject *M_Image_SourceDict( void )
-{
- PyObject *Dict = PyConstant_New( );
- if( Dict ) {
- BPy_constant *d = ( BPy_constant * ) Dict;
- PyConstant_Insert(d, "STILL", PyInt_FromLong(IMA_SRC_FILE));
- PyConstant_Insert(d, "MOVIE", PyInt_FromLong(IMA_SRC_MOVIE));
- PyConstant_Insert(d, "SEQUENCE", PyInt_FromLong(IMA_SRC_SEQUENCE));
- PyConstant_Insert(d, "GENERATED", PyInt_FromLong(IMA_SRC_GENERATED));
- }
- return Dict;
-}
-
-/*****************************************************************************/
-/* Function: Image_Init */
-/*****************************************************************************/
-PyObject *Image_Init( void )
-{
- PyObject *submodule;
- PyObject *Sources = M_Image_SourceDict( );
-
- if( PyType_Ready( &Image_Type ) < 0 )
- return NULL;
-
- submodule =
- Py_InitModule3( "Blender.Image", M_Image_methods,
- M_Image_doc );
-
- if( Sources )
- PyModule_AddObject( submodule, "Sources", Sources );
-
- return submodule;
-}
-
-/*****************************************************************************/
-/* Python Image_Type callback function prototypes: */
-/*****************************************************************************/
-static int Image_compare( BPy_Image * a, BPy_Image * b );
-static PyObject *Image_repr( BPy_Image * self );
-
-/*****************************************************************************/
-/* Function: Image_CreatePyObject */
-/* Description: This function will create a new BPy_Image from an existing */
-/* Blender image structure. */
-/*****************************************************************************/
-PyObject *Image_CreatePyObject( Image * image )
-{
- BPy_Image *py_img;
- py_img = ( BPy_Image * ) PyObject_NEW( BPy_Image, &Image_Type );
-
- if( !py_img )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create BPy_Image object" );
-
- py_img->image = image;
- return ( PyObject * ) py_img;
-}
-
-/*****************************************************************************/
-/* Function: Image_FromPyObject */
-/* Description: Returns the Blender Image associated with this object */
-/*****************************************************************************/
-Image *Image_FromPyObject( PyObject * pyobj )
-{
- return ( ( BPy_Image * ) pyobj )->image;
-}
-
-static PyObject *Image_getFilename( BPy_Image * self )
-{
- return PyString_FromString( self->image->name );
-}
-
-static PyObject *Image_getSize( BPy_Image * self )
-{
- ImBuf *ibuf= BKE_image_get_ibuf(self->image, NULL);
- PyObject *attr;
-
- if( !ibuf ) /* didn't work */
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't load image data in Blender" );
-
- attr = PyList_New(2);
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Image.size attribute" );
-
- PyList_SetItem( attr, 0, PyInt_FromLong(ibuf->x));
- PyList_SetItem( attr, 1, PyInt_FromLong(ibuf->y));
- return attr;
-}
-
-static PyObject *Image_getDepth( BPy_Image * self )
-{
- ImBuf *ibuf= BKE_image_get_ibuf(self->image, NULL);
-
- if( !ibuf ) /* didn't work */
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't load image data in Blender" );
-
- return PyInt_FromLong( (long)ibuf->depth );
-}
-
-
-static PyObject *Image_getXRep( BPy_Image * self )
-{
- return PyInt_FromLong( self->image->xrep );
-}
-
-static PyObject *Image_getYRep( BPy_Image * self )
-{
- return PyInt_FromLong( self->image->yrep );
-}
-
-static PyObject *Image_getStart( BPy_Image * self )
-{
- return PyInt_FromLong( self->image->twsta );
-}
-
-static PyObject *Image_getEnd( BPy_Image * self )
-{
- return PyInt_FromLong( self->image->twend );
-}
-
-static PyObject *Image_getSpeed( BPy_Image * self )
-{
- return PyInt_FromLong( self->image->animspeed );
-}
-
-static PyObject *Image_getBindCode( BPy_Image * self )
-{
- return PyLong_FromUnsignedLong( self->image->bindcode );
-}
-
-static PyObject *Image_reload( BPy_Image * self )
-{
- Image *image = self->image;
-
- BKE_image_signal(image, NULL, IMA_SIGNAL_RELOAD);
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Image_glFree( BPy_Image * self )
-{
- Image *image = self->image;
-
- free_realtime_image( image );
- /* remove the nocollect flag, image is available for garbage collection again */
- image->flag &= ~IMA_NOCOLLECT;
- Py_RETURN_NONE;
-}
-
-static PyObject *Image_glLoad( BPy_Image * self )
-{
- Image *image = self->image;
- unsigned int *bind = &image->bindcode;
-
- if( *bind == 0 ) {
- ImBuf *ibuf= BKE_image_get_ibuf(self->image, NULL);
-
- if( !ibuf ) /* didn't work */
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't load image data in Blender" );
-
- glGenTextures( 1, ( GLuint * ) bind );
- glBindTexture( GL_TEXTURE_2D, *bind );
-
- gluBuild2DMipmaps( GL_TEXTURE_2D, GL_RGBA, ibuf->x,
- ibuf->y, GL_RGBA, GL_UNSIGNED_BYTE,
- ibuf->rect );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
- GL_LINEAR_MIPMAP_NEAREST );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
- GL_LINEAR );
- glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
-
- glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, ibuf->x,
- ibuf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE,
- ibuf->rect );
-
- /* raise the nocollect flag,
- image is not available for garbage collection
- (python GL might use it directly)
- */
- image->flag |= IMA_NOCOLLECT;
- }
-
- return PyLong_FromUnsignedLong( image->bindcode );
-}
-
-static int Image_setFilename( BPy_Image * self, PyObject * value )
-{
- char *name;
-
- name = PyString_AsString(value);
-
- if( !name )
- return ( EXPP_ReturnIntError( PyExc_TypeError,
- "expected a string argument" ) );
-
- /* max len is FILE_MAXDIR == 160, FILE_MAXFILE == 80 chars like done in DNA_image_types.h */
- if( strlen(name) >= FILE_MAXDIR + FILE_MAXFILE )
- return ( EXPP_ReturnIntError( PyExc_TypeError,
- "string argument is limited to 240 chars at most" ) );
-
- strcpy( self->image->name, name );
- return 0;
-}
-
-static PyObject *Image_oldsetFilename( BPy_Image * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Image_setFilename );
-}
-
-static PyObject *Image_setXRep( BPy_Image * self, PyObject * value )
-{
- short param = (short)PyInt_AsLong(value);
-
- if( param !=-1 && param >= EXPP_IMAGE_REP_MIN && param <= EXPP_IMAGE_REP_MAX)
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int argument in [1,16]" ) );
-
- self->image->xrep = param;
- Py_RETURN_NONE;
-}
-
-static PyObject *Image_setYRep( BPy_Image * self, PyObject * value )
-{
- short param = (short)PyInt_AsLong(value);
-
- if( param !=-1 && param >= EXPP_IMAGE_REP_MIN && param <= EXPP_IMAGE_REP_MAX)
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int argument in [1,16]" ) );
-
- self->image->yrep = param;
- Py_RETURN_NONE;
-}
-
-
-static PyObject *Image_setStart( BPy_Image * self, PyObject * args )
-{
- short value;
-
- if( !PyArg_ParseTuple( args, "h", &value ) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int argument in [0,128]" ) );
-
- if( value >= 0 && value <= 128 )
- self->image->twsta = value;
- else
- return ( EXPP_ReturnPyObjError( PyExc_ValueError,
- "expected int argument in [0,128]" ) );
-
- Py_RETURN_NONE;
-}
-
-
-static PyObject *Image_setEnd( BPy_Image * self, PyObject * args )
-{
- short value;
-
- if( !PyArg_ParseTuple( args, "h", &value ) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int argument in [0,128]" ) );
-
- if( value >= 0 && value <= 128 )
- self->image->twend = value;
- else
- return ( EXPP_ReturnPyObjError( PyExc_ValueError,
- "expected int argument in [0,128]" ) );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Image_setSpeed( BPy_Image * self, PyObject * args )
-{
- short value;
-
- if( !PyArg_ParseTuple( args, "h", &value ) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int argument in [0,128]" ) );
-
- if( value >= 1 && value <= 100 )
- self->image->animspeed = value;
- else
- return ( EXPP_ReturnPyObjError( PyExc_ValueError,
- "expected int argument in [0,128]" ) );
-
- Py_RETURN_NONE;
-}
-
-
-/*****************************************************************************/
-/* Function: Image_compare */
-/* Description: This is a callback function for the BPy_Image type. It */
-/* compares two Image_Type objects. Only the "==" and "!=" */
-/* comparisons are meaninful. Returns 0 for equality and -1 if */
-/* they don't point to the same Blender Image struct. */
-/* In Python it becomes 1 if they are equal, 0 otherwise. */
-/*****************************************************************************/
-static int Image_compare( BPy_Image * a, BPy_Image * b )
-{
- return ( a->image == b->image ) ? 0 : -1;
-}
-
-/*****************************************************************************/
-/* Function: Image_repr */
-/* Description: This is a callback function for the BPy_Image type. It */
-/* builds a meaninful string to represent image objects. */
-/*****************************************************************************/
-static PyObject *Image_repr( BPy_Image * self )
-{
- return PyString_FromFormat( "[Image \"%s\"]",
- self->image->id.name + 2 );
-}
-
-static PyObject *Image_getPacked(BPy_Image *self, void *closure)
-{
- if (self->image->packedfile)
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
-}
-
-static PyObject *Image_hasData(BPy_Image *self, void *closure)
-{
- if (self->image->ibufs.first)
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
-}
-
-static PyObject *Image_getFlag(BPy_Image *self, void *flag)
-{
- if (self->image->flag & (int)flag)
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
-
-}
-
-static PyObject *Image_getFlagTpage(BPy_Image *self, void *flag)
-{
- if (self->image->tpageflag & (int)flag)
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
-
-}
-
-static int Image_setSource( BPy_Image *self, PyObject *args)
-{
- PyObject* integer = PyNumber_Int( args );
- short value;
-
- if( !integer )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected integer argument" );
-
- value = ( short )PyInt_AS_LONG( integer );
- Py_DECREF( integer );
-
- if( value < IMA_SRC_FILE || value > IMA_SRC_GENERATED )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "expected integer argument in range 1-4" );
-
- self->image->source = value;
- return 0;
-}
-
-static int Image_setFlag(BPy_Image *self, PyObject *value, void *flag)
-{
- int param = PyObject_IsTrue( value );
- if( param == -1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected True/False or 0/1" );
-
- if ( param )
- self->image->flag |= (int)flag;
- else
- self->image->flag &= ~(int)flag;
- return 0;
-}
-
-static int Image_setFlagTpage(BPy_Image *self, PyObject *value, void *flag)
-{
- int param = PyObject_IsTrue( value );
- if( param == -1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected True/False or 0/1" );
-
- if ( param )
- self->image->tpageflag |= (int)flag;
- else
- self->image->tpageflag &= ~(int)flag;
- return 0;
-}
-
-/*
- * get integer attributes
- */
-static PyObject *getIntAttr( BPy_Image *self, void *type )
-{
- int param;
- struct Image *image = self->image;
-
- switch( (int)type ) {
- case EXPP_IMAGE_ATTR_XREP:
- param = image->xrep;
- break;
- case EXPP_IMAGE_ATTR_YREP:
- param = image->xrep;
- break;
- case EXPP_IMAGE_ATTR_START:
- param = image->twsta;
- break;
- case EXPP_IMAGE_ATTR_END:
- param = image->twend;
- break;
- case EXPP_IMAGE_ATTR_SPEED:
- param = image->animspeed;
- break;
- case EXPP_IMAGE_ATTR_BINDCODE:
- param = image->bindcode;
- break;
- case EXPP_IMAGE_ATTR_SOURCE:
- param = image->source;
- break;
- default:
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "undefined type in getIntAttr" );
- }
-
- return PyInt_FromLong( param );
-}
-
-
-/*
- * set integer attributes which require clamping
- */
-
-static int setIntAttrClamp( BPy_Image *self, PyObject *value, void *type )
-{
- void *param;
- struct Image *image = self->image;
- int min, max, size;
-
- switch( (int)type ) {
- case EXPP_IMAGE_ATTR_XREP:
- min = EXPP_IMAGE_REP_MIN;
- max = EXPP_IMAGE_REP_MAX;
- size = 'h';
- param = (void *)&image->xrep;
- break;
- case EXPP_IMAGE_ATTR_YREP:
- min = EXPP_IMAGE_REP_MIN;
- max = EXPP_IMAGE_REP_MAX;
- size = 'h';
- param = (void *)&image->yrep;
- break;
- case EXPP_IMAGE_ATTR_START:
- min = 0;
- max = 128;
- size = 'h';
- param = (void *)&image->twsta;
- break;
- case EXPP_IMAGE_ATTR_END:
- min = 0;
- max = 128;
- size = 'h';
- param = (void *)&image->twend;
- break;
- case EXPP_IMAGE_ATTR_SPEED:
- min = 0;
- max = 100;
- size = 'h';
- param = (void *)&image->animspeed;
- break;
- default:
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "undefined type in setIntAttrClamp");
- }
- return EXPP_setIValueClamped( value, param, min, max, size );
-}
-
-/*****************************************************************************/
-/* Python attributes get/set structure: */
-/*****************************************************************************/
-static PyGetSetDef BPy_Image_getseters[] = {
- GENERIC_LIB_GETSETATTR,
- {"filename", (getter)Image_getFilename, (setter)Image_setFilename,
- "image path", NULL},
- /* readonly */
- {"depth", (getter)Image_getDepth, (setter)NULL,
- "image depth", NULL},
- {"size", (getter)Image_getSize, (setter)NULL,
- "image size", NULL},
- {"packed", (getter)Image_getPacked, (setter)NULL,
- "image packed state", NULL },
- {"has_data", (getter)Image_hasData, (setter)NULL,
- "is image data loaded", NULL },
- /* ints */
- {"xrep", (getter)getIntAttr, (setter)setIntAttrClamp,
- "image xrep", (void *)EXPP_IMAGE_ATTR_XREP },
- {"yrep", (getter)getIntAttr, (setter)setIntAttrClamp,
- "image yrep", (void *)EXPP_IMAGE_ATTR_YREP },
- {"start", (getter)getIntAttr, (setter)setIntAttrClamp,
- "image start frame", (void *)EXPP_IMAGE_ATTR_START },
- {"end", (getter)getIntAttr, (setter)setIntAttrClamp,
- "image end frame", (void *)EXPP_IMAGE_ATTR_END },
- {"speed", (getter)getIntAttr, (setter)setIntAttrClamp,
- "image end frame", (void *)EXPP_IMAGE_ATTR_SPEED },
- {"bindcode", (getter)getIntAttr, (setter)NULL,
- "openGL bindcode", (void *)EXPP_IMAGE_ATTR_BINDCODE },
- {"source", (getter)getIntAttr, (setter)Image_setSource,
- "image source type", (void *)EXPP_IMAGE_ATTR_SOURCE },
- /* flags */
- {"fields", (getter)Image_getFlag, (setter)Image_setFlag,
- "image fields toggle", (void *)IMA_FIELDS },
- {"fields_odd", (getter)Image_getFlag, (setter)Image_setFlag,
- "image odd fields toggle", (void *)IMA_STD_FIELD },
- {"antialias", (getter)Image_getFlag, (setter)Image_setFlag,
- "image antialiasing toggle", (void *)IMA_ANTIALI },
- {"reflect", (getter)Image_getFlag, (setter)Image_setFlag,
- "image reflect toggle", (void *)IMA_REFLECT },
- {"clampX", (getter)Image_getFlagTpage, (setter)Image_setFlagTpage,
- "disable tiling on the X axis", (void *)IMA_CLAMP_U },
- {"clampY", (getter)Image_getFlagTpage, (setter)Image_setFlagTpage,
- "disable tiling on the Y axis", (void *)IMA_CLAMP_V },
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-
-/*****************************************************************************/
-/* Python Image_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject Image_Type = {
- PyObject_HEAD_INIT( NULL ) /* required macro. ( no comma needed ) */
- 0, /* ob_size */
- "Blender Image", /* tp_name */
- sizeof( BPy_Image ), /* tp_basicsize */
- 0, /* tp_itemsize */
- /* methods */
- NULL, /* tp_dealloc */
- 0, /* tp_print */
- NULL, /* tp_getattr */
- NULL, /* tp_setattr */
- ( cmpfunc ) Image_compare, /* tp_compare */
- ( reprfunc ) Image_repr, /* tp_repr */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- NULL, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
- 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, /* 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, /* 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 ***/
- BPy_Image_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_Image_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
diff --git a/source/blender/python/api2_2x/Image.h b/source/blender/python/api2_2x/Image.h
deleted file mode 100644
index a2fb22563bb..00000000000
--- a/source/blender/python/api2_2x/Image.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * $Id: Image.h 10269 2007-03-15 01:09:14Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano, Alex Mole
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_IMAGE_H
-#define EXPP_IMAGE_H
-
-#include <Python.h>
-#include "DNA_image_types.h"
-
-
-/*****************************************************************************/
-/* Python BPy_Image structure definition */
-/*****************************************************************************/
-typedef struct {
- PyObject_HEAD
- Image * image; /* libdata must be second */
-
-} BPy_Image;
-
-extern PyTypeObject Image_Type; /* The Image PyType Object */
-
-#define BPy_Image_Check(v) ((v)->ob_type == &Image_Type) /*for type checking */
-
-/*****************************************************************************/
-/* Module Blender.Image - public functions */
-/*****************************************************************************/
-PyObject *Image_Init( void );
-PyObject *Image_CreatePyObject( Image * image );
-Image *Image_FromPyObject( PyObject * pyobj );
-
-#endif /* EXPP_IMAGE_H */
diff --git a/source/blender/python/api2_2x/Ipo.c b/source/blender/python/api2_2x/Ipo.c
deleted file mode 100644
index e150a10259c..00000000000
--- a/source/blender/python/api2_2x/Ipo.c
+++ /dev/null
@@ -1,1842 +0,0 @@
-/*
- * $Id: Ipo.c 12078 2007-09-18 06:41:29Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Jacques Guignot RIP 2005, Nathan Letwory,
- * Stephen Swaney, Ken Hughes
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include "Ipo.h" /*This must come first*/
-
-#include "BKE_main.h"
-#include "BKE_global.h"
-#include "BKE_library.h"
-#include "BKE_object.h"
-#include "BKE_ipo.h"
-#include "BLI_blenlib.h"
-#include "BIF_space.h"
-#include "BSE_editipo.h"
-#include "MEM_guardedalloc.h"
-#include "DNA_key_types.h"
-#include "mydevice.h"
-#include "Ipocurve.h"
-#include "gen_utils.h"
-#include "gen_library.h"
-
-extern int ob_ar[];
-extern int la_ar[];
-extern int ma_ar[];
-extern int ac_ar[];
-extern int cam_ar[];
-extern int co_ar[];
-extern int cu_ar[];
-extern int seq_ar[];
-extern int te_ar[];
-extern int wo_ar[];
-
-PyObject *submodule;
-
-/*****************************************************************************/
-/* Python API function prototypes for the Ipo module. */
-/*****************************************************************************/
-static PyObject *M_Ipo_New( PyObject * self, PyObject * args );
-static PyObject *M_Ipo_Get( PyObject * self, PyObject * args );
-static PyObject *M_Ipo_Recalc( PyObject * self, PyObject * args );
-
-/*****************************************************************************/
-/* The following string definitions are used for documentation strings. */
-/* In Python these will be written to the console when doing a */
-/* Blender.Ipo.__doc__ */
-/*****************************************************************************/
-char M_Ipo_doc[] = "";
-char M_Ipo_New_doc[] = "";
-char M_Ipo_Get_doc[] = "";
-
-/*****************************************************************************/
-/* Python method structure definition for Blender.Ipo module: */
-/*****************************************************************************/
-
-struct PyMethodDef M_Ipo_methods[] = {
- {"New", ( PyCFunction ) M_Ipo_New, METH_VARARGS | METH_KEYWORDS,
- M_Ipo_New_doc},
- {"Get", M_Ipo_Get, METH_VARARGS, M_Ipo_Get_doc},
- {"get", M_Ipo_Get, METH_VARARGS, M_Ipo_Get_doc},
- {"Recalc", M_Ipo_Recalc, METH_O, M_Ipo_Get_doc},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Python BPy_Ipo methods declarations: */
-/*****************************************************************************/
-static PyObject *Ipo_getBlocktype( BPy_Ipo * self );
-static PyObject *Ipo_oldsetBlocktype( BPy_Ipo * self, PyObject * args );
-static int Ipo_setBlocktype( BPy_Ipo * self, PyObject * args );
-static PyObject *Ipo_getRctf( BPy_Ipo * self );
-static PyObject *Ipo_oldsetRctf( BPy_Ipo * self, PyObject * args );
-static int Ipo_setRctf( BPy_Ipo * self, PyObject * args );
-
-static PyObject *Ipo_getCurve( BPy_Ipo * self, PyObject * args );
-static PyObject *Ipo_getCurves( BPy_Ipo * self );
-static PyObject *Ipo_getCurveNames( BPy_Ipo * self );
-static PyObject *Ipo_addCurve( BPy_Ipo * self, PyObject * value );
-static PyObject *Ipo_delCurve( BPy_Ipo * self, PyObject * args );
-static PyObject *Ipo_getNcurves( BPy_Ipo * self );
-static PyObject *Ipo_getNBezPoints( BPy_Ipo * self, PyObject * args );
-static PyObject *Ipo_DeleteBezPoints( BPy_Ipo * self, PyObject * args );
-static PyObject *Ipo_getCurveBP( BPy_Ipo * self, PyObject * args );
-static PyObject *Ipo_getCurvecurval( BPy_Ipo * self, PyObject * args );
-static PyObject *Ipo_EvaluateCurveOn( BPy_Ipo * self, PyObject * args );
-
-static PyObject *Ipo_setCurveBeztriple( BPy_Ipo * self, PyObject * args );
-static PyObject *Ipo_getCurveBeztriple( BPy_Ipo * self, PyObject * args );
-
-static PyObject *Ipo_getChannel( BPy_Ipo * self );
-static PyObject *Ipo_copy( BPy_Ipo * self );
-static int Ipo_setChannel( BPy_Ipo * self, PyObject * args );
-
-static int Ipo_length( BPy_Ipo * inst );
-static PyObject *Ipo_getIpoCurveByName( BPy_Ipo * self, PyObject * key );
-static int Ipo_setIpoCurveByName( BPy_Ipo * self, PyObject * key,
- PyObject * value );
-static int Ipo_contains( BPy_Ipo * self, PyObject * key );
-
-/*****************************************************************************/
-/* Python BPy_Ipo methods table: */
-/*****************************************************************************/
-static PyMethodDef BPy_Ipo_methods[] = {
- /* name, method, flags, doc */
- {"getName", ( PyCFunction ) GenericLib_getName, METH_NOARGS,
- "() - Return Ipo Data name"},
- {"setName", ( PyCFunction ) GenericLib_setName_with_method, METH_VARARGS,
- "(str) - Change Ipo Data name"},
- {"getBlocktype", ( PyCFunction ) Ipo_getBlocktype, METH_NOARGS,
- "() - Return Ipo blocktype"},
- {"setBlocktype", ( PyCFunction ) Ipo_oldsetBlocktype, METH_VARARGS,
- "(str) - Change Ipo blocktype"},
- {"getRctf", ( PyCFunction ) Ipo_getRctf, METH_NOARGS,
- "() - Return Ipo rctf"},
- {"setRctf", ( PyCFunction ) Ipo_oldsetRctf, METH_VARARGS,
- "(flt,flt,flt,flt) - Change Ipo rctf"},
- {"addCurve", ( PyCFunction ) Ipo_addCurve, METH_O,
- "() - Add a curve to Ipo"},
- {"delCurve", ( PyCFunction ) Ipo_delCurve, METH_VARARGS,
- "(str) - Delete curve from Ipo"},
- {"getNcurves", ( PyCFunction ) Ipo_getNcurves, METH_NOARGS,
- "() - Return number of Ipo curves"},
- {"getCurves", ( PyCFunction ) Ipo_getCurves, METH_NOARGS,
- "() - Return list of all defined Ipo curves"},
- {"getCurve", ( PyCFunction ) Ipo_getCurve, METH_VARARGS,
- "(str|int) - Returns specified Ipo curve"},
- {"getNBezPoints", ( PyCFunction ) Ipo_getNBezPoints, METH_VARARGS,
- "(int) - Return number of Bez points on an Ipo curve"},
- {"delBezPoint", ( PyCFunction ) Ipo_DeleteBezPoints, METH_VARARGS,
- "(int) - deprecated: use ipocurve.delBezier()"},
- {"getCurveBP", ( PyCFunction ) Ipo_getCurveBP, METH_VARARGS,
- "() - unsupported"},
- {"EvaluateCurveOn", ( PyCFunction ) Ipo_EvaluateCurveOn, METH_VARARGS,
- "(int,flt) - deprecated: see ipocurve.evaluate()"},
- {"getCurveCurval", ( PyCFunction ) Ipo_getCurvecurval, METH_VARARGS,
- "(int) - deprecated: see ipocurve.evaluate()"},
- {"getCurveBeztriple", ( PyCFunction ) Ipo_getCurveBeztriple, METH_VARARGS,
- "(int,int) - deprecated: see ipocurve.bezierPoints[]"},
- {"setCurveBeztriple", ( PyCFunction ) Ipo_setCurveBeztriple, METH_VARARGS,
- "(int,int,list) - set a BezTriple"},
-
- {"__copy__", ( PyCFunction ) Ipo_copy, METH_NOARGS,
- "() - copy the ipo"},
- {"copy", ( PyCFunction ) Ipo_copy, METH_NOARGS,
- "() - copy the ipo"},
-
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Python BPy_Ipo attributes get/set structure: */
-/*****************************************************************************/
-static PyGetSetDef BPy_Ipo_getseters[] = {
- GENERIC_LIB_GETSETATTR,
- {"curves",
- (getter)Ipo_getCurves, (setter)NULL,
- "Ipo curves",
- NULL},
- {"curveConsts",
- (getter)Ipo_getCurveNames, (setter)NULL,
- "Ipo curve constants (values depend on Ipo type)",
- NULL},
- {"channel",
- (getter)Ipo_getChannel, (setter)Ipo_setChannel,
- "Ipo texture channel (world, lamp, material Ipos only)",
- NULL},
-
- {"blocktype",
- (getter)Ipo_getBlocktype, (setter)NULL,
- "Ipo block type",
- NULL},
- {"rctf",
- (getter)Ipo_getRctf, (setter)Ipo_setRctf,
- "Ipo type",
- NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-/*****************************************************************************/
-/* Python Ipo_Type Mapping Methods table: */
-/*****************************************************************************/
-static PyMappingMethods Ipo_as_mapping = {
- ( inquiry ) Ipo_length, /* mp_length */
- ( binaryfunc ) Ipo_getIpoCurveByName, /* mp_subscript */
- ( objobjargproc ) Ipo_setIpoCurveByName, /* mp_ass_subscript */
-};
-
-static PySequenceMethods Ipo_as_sequence = {
- ( inquiry ) 0, /* sq_length */
- ( binaryfunc ) 0, /* sq_concat */
- ( intargfunc ) 0, /* sq_repeat */
- ( intargfunc ) 0, /* sq_item */
- ( intintargfunc ) 0, /* sq_slice */
- ( intobjargproc ) 0, /* sq_ass_item */
- ( intintobjargproc ) 0, /* sq_ass_slice */
- ( objobjproc ) Ipo_contains, /* sq_contains */
- ( binaryfunc ) 0, /* sq_inplace_concat */
- ( intargfunc ) 0, /* sq_inplace_repeat */
-};
-
-/*****************************************************************************/
-/* Python Ipo_Type callback function prototypes: */
-/*****************************************************************************/
-/*static int IpoPrint (BPy_Ipo *self, FILE *fp, int flags);*/
-static int Ipo_compare( BPy_Ipo * a, BPy_Ipo * b );
-static PyObject *Ipo_repr( BPy_Ipo * self );
-static PyObject *Ipo_getIter( BPy_Ipo * self );
-static PyObject *Ipo_nextIter( BPy_Ipo * self );
-
-/* #define CURVEATTRS */ /* uncomment to enable curves as Ipo attributes */
-
-#ifdef CURVEATTRS
-static PyGetSetDef BPy_Ipocurve_getseter = {
- "noname",
- (getter)NULL, (setter)NULL,
- "Ipo curve name",
- NULL
-};
-
-void generate_curveattrs( PyObject* dict, int blocktype )
-{
- typedef char * (*namefunc)(int, ... );
- namefunc lookup_name;
- int size;
- int *vals = NULL;
- char name[32];
- PyObject*desc;
-
- switch ( blocktype ) {
- case ID_OB:
- lookup_name = (namefunc)getname_ob_ei;
- vals = ob_ar;
- size = OB_TOTIPO;
- break;
- case ID_MA:
- lookup_name = (namefunc)getname_mat_ei;
- vals = ma_ar;
- size = MA_TOTIPO;
- break;
- case ID_CA:
- lookup_name = (namefunc)getname_cam_ei;
- vals = cam_ar;
- size = CAM_TOTIPO;
- break;
- case ID_LA:
- lookup_name = (namefunc)getname_la_ei;
- vals = la_ar;
- size = LA_TOTIPO;
- break;
- case ID_TE:
- lookup_name = (namefunc)getname_tex_ei;
- vals = te_ar;
- size = TE_TOTIPO;
- break;
- case ID_WO:
- lookup_name = (namefunc)getname_world_ei;
- vals = wo_ar;
- size = WO_TOTIPO;
- break;
- case ID_PO:
- lookup_name = (namefunc)getname_ac_ei;
- vals = ac_ar;
- size = AC_TOTIPO;
- break;
- case ID_CO:
- lookup_name = (namefunc)getname_co_ei;
- vals = co_ar;
- size = CO_TOTIPO;
- break;
- case ID_CU:
- lookup_name = (namefunc)getname_cu_ei;
- vals = cu_ar;
- size = CU_TOTIPO;
- break;
- case ID_SEQ:
- lookup_name = (namefunc)getname_seq_ei;
- vals = seq_ar;
- size = SEQ_TOTIPO;
- break;
- }
-
- desc = PyDescr_NewGetSet( &Ipo_Type, &BPy_Ipocurve_getseter );
- while( size-- ) {
- strcpy( name, lookup_name( *vals ) );
- *name = tolower( *name );
- PyDict_SetItemString( dict, name, desc );
- ++vals;
- }
- Py_DECREF( desc );
-}
-
-static short lookup_curve_name( char *, int , int );
-
-static PyObject *getattro( PyObject *self, PyObject *value )
-{
- char *name = PyString_AS_STRING( value );
- Ipo *ipo = ((BPy_Ipo *)self)->ipo;
- int adrcode;
- IpoCurve *icu;
-
- if( !strcmp(name, "__class__") )
- return PyObject_GenericGetAttr( self, value );
-
- if( !strcmp(name, "__dict__") ) /* no effect */
- {
- PyObject *dict;
- dict = PyDict_Copy( self->ob_type->tp_dict );
- generate_curveattrs( dict, ipo->blocktype );
- return dict;
- }
-
- adrcode = lookup_curve_name( name, ipo->blocktype,
- ((BPy_Ipo *)self)->mtex );
-
- if( adrcode != -1 ) {
- for( icu = ipo->curve.first; icu; icu = icu->next )
- if( icu->adrcode == adrcode )
- return IpoCurve_CreatePyObject( icu );
- Py_RETURN_NONE;
- }
-
- return PyObject_GenericGetAttr( self, value );
-}
-#endif
-
-/*****************************************************************************/
-/* Python Ipo_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject Ipo_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender Ipo", /* char *tp_name; */
- sizeof( BPy_Ipo ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL, /* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- ( cmpfunc ) Ipo_compare, /* cmpfunc tp_compare; */
- ( reprfunc ) Ipo_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- &Ipo_as_sequence, /* PySequenceMethods *tp_as_sequence; */
- &Ipo_as_mapping, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
-#ifdef CURVEATTRS
- (getattrofunc)getattro,
-#else
- NULL, /* getattrofunc tp_getattro; */
-#endif
- 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, /* 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, /* richcmpfunc tp_richcompare; */
-
- /*** weak reference enabler ***/
- 0, /* long tp_weaklistoffset; */
-
- /*** Added in release 2.2 ***/
- /* Iterators */
- ( getiterfunc) Ipo_getIter, /* getiterfunc tp_iter; */
- ( iternextfunc ) Ipo_nextIter, /* iternextfunc tp_iternext; */
-
- /*** Attribute descriptor and subclassing stuff ***/
- BPy_Ipo_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_Ipo_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-/*****************************************************************************/
-/* internal utility routines */
-/*****************************************************************************/
-
-/*
- * Search through list of known Ipocurves for a particular name.
- *
- * str: name of curve we are searching for
- * blocktype: type of Ipo
- * channel: texture channel number, for World/Lamp/Material curves
- *
- * returns the adrcode for the named curve if it exists, -1 otherwise
- */
-
-/* this is needed since getname_ob_ei() is different from the rest */
-
-typedef char * (*namefunc)(int, ... );
-
-static short lookup_curve_name( char *str, int blocktype, int channel )
-{
- namefunc lookup_name;
- int *adrcodes = NULL;
- int size = 0;
-
- /* make sure channel type is ignored when it should be */
- if( blocktype != ID_WO && blocktype != ID_LA && blocktype != ID_MA )
- channel = -1;
-
- switch ( blocktype ) {
- case ID_OB:
- lookup_name = (namefunc)getname_ob_ei;
- adrcodes = ob_ar;
- size = OB_TOTIPO;
- break;
- case ID_MA:
- lookup_name = (namefunc)getname_mat_ei;
- adrcodes = ma_ar;
- size = MA_TOTIPO;
- break;
- case ID_CA:
- lookup_name = (namefunc)getname_cam_ei;
- adrcodes = cam_ar;
- size = CAM_TOTIPO;
- break;
- case ID_LA:
- lookup_name = (namefunc)getname_la_ei;
- adrcodes = la_ar;
- size = LA_TOTIPO;
- break;
- case ID_TE:
- lookup_name = (namefunc)getname_tex_ei;
- adrcodes = te_ar;
- size = TE_TOTIPO;
- break;
- case ID_WO:
- lookup_name = (namefunc)getname_world_ei;
- adrcodes = wo_ar;
- size = WO_TOTIPO;
- break;
- case ID_PO:
- lookup_name = (namefunc)getname_ac_ei;
- adrcodes = ac_ar;
- size = AC_TOTIPO;
- break;
- case ID_CO:
- lookup_name = (namefunc)getname_co_ei;
- adrcodes = co_ar;
- size = CO_TOTIPO;
- break;
- case ID_CU:
- lookup_name = (namefunc)getname_cu_ei;
- adrcodes = cu_ar;
- size = CU_TOTIPO;
- break;
- case ID_SEQ:
- lookup_name = (namefunc)getname_seq_ei;
- adrcodes = seq_ar;
- size = SEQ_TOTIPO;
- break;
- case ID_KE: /* shouldn't happen */
- default:
- return -1;
- }
-
- while ( size-- ) {
- char *name = lookup_name ( *adrcodes );
-
- /* if not a texture channel, just return the adrcode */
- if( !strcmp( str, name ) ) {
- if( channel == -1 || *adrcodes < MA_MAP1 )
- return (short)*adrcodes;
-
- /* otherwise adjust adrcode to include current channel */
- else {
- int param = (short)*adrcodes & ~MA_MAP1;
- param |= texchannel_to_adrcode( channel );
- return (short)param;
- }
- }
- ++adrcodes;
- }
- return -1;
-}
-
-static short lookup_curve_key( char *str, Ipo *ipo )
-{
- Key *keyiter;
-
- /* find the ipo in the keylist */
- for( keyiter = G.main->key.first; keyiter; keyiter = keyiter->id.next ) {
- if( keyiter->ipo == ipo ) {
- KeyBlock *block = keyiter->block.first;
-
- /* look for a matching string, get the adrcode */
- for( block = keyiter->block.first; block; block = block->next )
- if( !strcmp( str, block->name ) )
- return block->adrcode;
-
- /* no match; no addr code */
- return -1;
- }
- }
-
- /* error if the ipo isn't in the list */
- return -2;
-}
-
-/*
- * Search through list of known Ipocurves for a particular adrcode.
- *
- * code: adrcode of curve we are searching for
- * blocktype: type of Ipo
- * channel: texture channel number, for World/Lamp/Material curves
- *
- * returns the adrcode for the named curve if it exists, -1 otherwise
- */
-
-static short lookup_curve_adrcode( int code, int blocktype, int channel )
-{
- int *adrcodes = NULL;
- int size = 0;
-
- switch ( blocktype ) {
- case ID_OB:
- adrcodes = ob_ar;
- size = OB_TOTIPO;
- break;
- case ID_MA:
- adrcodes = ma_ar;
- size = MA_TOTIPO;
- break;
- case ID_CA:
- adrcodes = cam_ar;
- size = CAM_TOTIPO;
- break;
- case ID_LA:
- adrcodes = la_ar;
- size = LA_TOTIPO;
- break;
- case ID_TE:
- adrcodes = te_ar;
- size = TE_TOTIPO;
- break;
- case ID_WO:
- adrcodes = wo_ar;
- size = WO_TOTIPO;
- break;
- case ID_PO:
- adrcodes = ac_ar;
- size = AC_TOTIPO;
- break;
- case ID_CO:
- adrcodes = co_ar;
- size = CO_TOTIPO;
- break;
- case ID_CU:
- adrcodes = cu_ar;
- size = CU_TOTIPO;
- break;
- case ID_SEQ:
- adrcodes = seq_ar;
- size = SEQ_TOTIPO;
- break;
- case ID_KE:
- default:
- return -1;
- }
-
- while ( size-- ) {
- if( *adrcodes == code ) {
-
- /* if not a texture channel, just return the adrcode */
- if( channel == -1 || *adrcodes < MA_MAP1 )
- return (short)*adrcodes;
-
- /* otherwise adjust adrcode to include current channel */
- else {
- int param = *adrcodes & ~MA_MAP1;
- param |= texchannel_to_adrcode( channel );
- return (short)param;
- }
- }
- ++adrcodes;
- }
- return -1;
-}
-
-/*
- * Delete an IpoCurve from an Ipo
- */
-
-static void del_ipocurve( Ipo * ipo, IpoCurve * icu ) {
- BLI_remlink( &( ipo->curve ), icu );
- if( icu->bezt )
- MEM_freeN( icu->bezt );
- if( icu->driver )
- MEM_freeN( icu->driver );
- MEM_freeN( icu );
-
- /* have to do this to avoid crashes in the IPO window */
- allspace( REMAKEIPO, 0 );
- EXPP_allqueue( REDRAWIPO, 0 );
-}
-
-/*****************************************************************************/
-/* Python BPy_Ipo functions: */
-/*****************************************************************************/
-
-/*****************************************************************************/
-/* Function: M_Ipo_New */
-/* Python equivalent: Blender.Ipo.New */
-/*****************************************************************************/
-
-static PyObject *M_Ipo_New( PyObject * self_unused, PyObject * args )
-{
- char *name = NULL, *code = NULL;
- int idcode = -1;
- Ipo *blipo;
-
- if( !PyArg_ParseTuple( args, "ss", &code, &name ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected two string arguments" );
-
- if( !strcmp( code, "Object" ) )
- idcode = ID_OB;
- else if( !strcmp( code, "Camera" ) )
- idcode = ID_CA;
- else if( !strcmp( code, "World" ) )
- idcode = ID_WO;
- else if( !strcmp( code, "Material" ) )
- idcode = ID_MA;
- else if( !strcmp( code, "Texture" ) )
- idcode = ID_TE;
- else if( !strcmp( code, "Lamp" ) )
- idcode = ID_LA;
- else if( !strcmp( code, "Action" ) )
- idcode = ID_PO;
- else if( !strcmp( code, "Constraint" ) )
- idcode = ID_CO;
- else if( !strcmp( code, "Sequence" ) )
- idcode = ID_SEQ;
- else if( !strcmp( code, "Curve" ) )
- idcode = ID_CU;
- else if( !strcmp( code, "Key" ) )
- idcode = ID_KE;
- else return EXPP_ReturnPyObjError( PyExc_ValueError,
- "unknown Ipo code" );
-
- blipo = add_ipo( name, idcode );
-
- if( blipo ) {
- /* return user count to zero because add_ipo() inc'd it */
- blipo->id.us = 0;
- /* create python wrapper obj */
- return Ipo_CreatePyObject( blipo );
- } else
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't create Ipo Data in Blender" );
-}
-
-/*****************************************************************************/
-/* Function: M_Ipo_Get */
-/* Python equivalent: Blender.Ipo.Get */
-/* Description: Receives a string and returns the ipo data obj */
-/* whose name matches the string. If no argument is */
-/* passed in, a list of all ipo data names in the */
-/* current scene is returned. */
-/*****************************************************************************/
-static PyObject *M_Ipo_Get( PyObject * self_unused, PyObject * args )
-{
- char *name = NULL;
- Ipo *ipo_iter;
- PyObject *ipolist, *pyobj;
- char error_msg[64];
-
- if( !PyArg_ParseTuple( args, "|s", &name ) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument (or nothing)" ) );
-
- ipo_iter = G.main->ipo.first;
-
- if( name ) { /* (name) - Search ipo by name */
- while( ipo_iter ) {
- if( !strcmp( name, ipo_iter->id.name + 2 ) ) {
- return Ipo_CreatePyObject( ipo_iter );
- }
- ipo_iter = ipo_iter->id.next;
- }
-
- PyOS_snprintf( error_msg, sizeof( error_msg ),
- "Ipo \"%s\" not found", name );
- return EXPP_ReturnPyObjError( PyExc_NameError, error_msg );
- }
-
- else { /* () - return a list with all ipos in the scene */
- int index = 0;
-
- ipolist = PyList_New( BLI_countlist( &( G.main->ipo ) ) );
-
- if( !ipolist )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create PyList" );
-
- while( ipo_iter ) {
- pyobj = Ipo_CreatePyObject( ipo_iter );
-
- if( !pyobj )
- return NULL;
-
- PyList_SET_ITEM( ipolist, index, pyobj );
-
- ipo_iter = ipo_iter->id.next;
- index++;
- }
-
- return ipolist;
- }
-}
-
-/*
- * This should probably be deprecated too? Or else documented in epydocs.
- * Seems very similar to Ipocurve.recalc().
- */
-
-/*****************************************************************************/
-/* Function: M_Ipo_Recalc */
-/* Python equivalent: Blender.Ipo.Recalc */
-/* Description: Receives (presumably) an IpoCurve object and */
-/* updates the curve after changes to control points. */
-/*****************************************************************************/
-static PyObject *M_Ipo_Recalc( PyObject * self_unused, PyObject * value )
-{
- if( !BPy_IpoCurve_Check(value) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected Ipo curve argument" );
-
- testhandles_ipocurve( IpoCurve_FromPyObject( value ) );
-
- Py_RETURN_NONE;
-}
-
-/*****************************************************************************/
-/* Python BPy_Ipo methods: */
-/*****************************************************************************/
-static PyObject *Ipo_getBlocktype( BPy_Ipo * self )
-{
- return PyInt_FromLong( self->ipo->blocktype );
-}
-
-static int Ipo_setBlocktype( BPy_Ipo * self, PyObject * args )
-{
- if( !PyInt_Check( args ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected int argument" );
-
- self->ipo->blocktype = (short)PyInt_AS_LONG( args );
-
- return 0;
-}
-
-static PyObject *Ipo_getRctf( BPy_Ipo * self )
-{
- PyObject *l = PyList_New( 4 );
- PyList_SET_ITEM( l, 0, PyFloat_FromDouble( self->ipo->cur.xmin ) );
- PyList_SET_ITEM( l, 1, PyFloat_FromDouble( self->ipo->cur.xmax ) );
- PyList_SET_ITEM( l, 2, PyFloat_FromDouble( self->ipo->cur.ymin ) );
- PyList_SET_ITEM( l, 3, PyFloat_FromDouble( self->ipo->cur.ymax ) );
- return l;
-}
-
-static int Ipo_setRctf( BPy_Ipo * self, PyObject * args )
-{
- float v[4];
-
- if( !PyArg_ParseTuple( args, "ffff", v, v + 1, v + 2, v + 3 ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a tuple of 4 floats" );
-
- self->ipo->cur.xmin = v[0];
- self->ipo->cur.xmax = v[1];
- self->ipo->cur.ymin = v[2];
- self->ipo->cur.ymax = v[3];
-
- return 0;
-}
-
-/*
- * Get total number of Ipo curves for this Ipo. NOTE: this function
- * returns all curves for Ipos which have texture channels, unlike
- * Ipo_length().
- */
-
-static PyObject *Ipo_getNcurves( BPy_Ipo * self )
-{
- IpoCurve *icu;
- int i = 0;
-
- for( icu = self->ipo->curve.first; icu; icu = icu->next ) {
- i++;
- }
-
- return PyInt_FromLong( (long)i );
-}
-
-/*
- Function: Ipo_addCurve
- Bpy: Blender.Ipo.addCurve( 'curname')
-
- add a new curve to an existing IPO.
- example:
- ipo = Blender.Ipo.New('Object','ObIpo')
- cu = ipo.addCurve('LocX')
-*/
-
-static PyObject *Ipo_addCurve( BPy_Ipo * self, PyObject * value )
-{
- short param; /* numeric curve name constant */
- char *cur_name = PyString_AsString(value); /* input arg: curve name */
- Ipo *ipo = 0;
- IpoCurve *icu = 0;
- Link *link;
-
- if( !cur_name )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError, "expected string argument" ) );
-
-
- /* chase down the ipo list looking for ours */
- link = G.main->ipo.first;
-
- while( link ) {
- ipo = ( Ipo * ) link;
- if( ipo == self->ipo )
- break;
- link = link->next;
- }
-
- if( !link )
- return EXPP_ReturnPyObjError
- ( PyExc_RuntimeError, "Ipo not found" );
-
- /*
- * Check if the input arg curve name is valid depending on the block
- * type, and set param to numeric value. Invalid names will return
- * param = -1.
- */
-
- if( ipo->blocktype != ID_KE ) {
- param = lookup_curve_name( cur_name, ipo->blocktype, self->mtex );
- } else {
- param = lookup_curve_key( cur_name, ipo );
- if( param == -2 )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "unable to find matching key data for Ipo" );
- }
-
- if( param == -1 )
- return EXPP_ReturnPyObjError( PyExc_NameError,
- "curve name is not valid" );
-
- /* see if the curve already exists */
- for( icu = ipo->curve.first; icu; icu = icu->next )
- if( icu->adrcode == param )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "Ipo curve already exists" );
-
- /* create the new ipo curve */
- icu = MEM_callocN( sizeof(IpoCurve), "Python added ipocurve");
- icu->blocktype = ipo->blocktype;
- icu->adrcode = param;
- icu->flag |= IPO_VISIBLE|IPO_AUTO_HORIZ;
- set_icu_vars( icu );
- BLI_addtail( &(ipo->curve), icu);
-
- allspace( REMAKEIPO, 0 );
- EXPP_allqueue( REDRAWIPO, 0 );
-
- /* create a bpy wrapper for the new ipo curve */
- return IpoCurve_CreatePyObject( icu );
-}
-
-/*
- Function: Ipo_delCurve
- Bpy: Blender.Ipo.delCurve(curtype)
-
- delete an existing curve from IPO.
- example:
- ipo = Blender.Ipo.New('Object','ObIpo')
- cu = ipo.delCurve('LocX')
-*/
-
-static PyObject *Ipo_delCurve( BPy_Ipo * self, PyObject * value )
-{
- IpoCurve *icu;
- char *strname = PyString_AsString(value);
-
- if( !strname )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument" );
-
- for( icu = self->ipo->curve.first; icu; icu = icu->next ) {
- if( !strcmp( strname, getIpoCurveName( icu ) ) ) {
- del_ipocurve( self->ipo, icu );
- Py_RETURN_NONE;
- }
- }
-
- return EXPP_ReturnPyObjError( PyExc_ValueError, "IpoCurve not found" );
-}
-/*
- */
-
-static PyObject *Ipo_getCurve( BPy_Ipo * self, PyObject * args )
-{
- IpoCurve *icu = NULL;
- short adrcode;
- PyObject *value = NULL;
-
- if( !PyArg_ParseTuple( args, "|O", &value ) )
- goto typeError;
-
- /* if no name give, get all the Ipocurves */
- if( !value )
- return Ipo_getCurves( self );
-
- /* if arg is a string or int, look up the adrcode */
- if( PyString_Check( value ) ) {
- char *str = PyString_AsString( value );
- for( icu = self->ipo->curve.first; icu; icu = icu->next ) {
- if( !strcmp( str, getIpoCurveName( icu ) ) )
- return IpoCurve_CreatePyObject( icu );
- }
- Py_RETURN_NONE;
- }
- else if( PyInt_Check( value ) ) {
- adrcode = ( short )PyInt_AsLong( value );
- for( icu = self->ipo->curve.first; icu; icu = icu->next ) {
- if( icu->adrcode == adrcode )
- return IpoCurve_CreatePyObject( icu );
- }
- Py_RETURN_NONE;
- }
-
-typeError:
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "expected string or int argument" );
-}
-
-static PyObject *Ipo_getCurves( BPy_Ipo * self )
-{
- PyObject *attr = PyList_New( 0 ), *pyipo;
- IpoCurve *icu;
-
- for( icu = self->ipo->curve.first; icu; icu = icu->next ) {
- pyipo = IpoCurve_CreatePyObject( icu );
- PyList_Append( attr, pyipo );
- Py_DECREF(pyipo);
- }
- return attr;
-}
-
-/*
- * return a list of valid curve name constants for the Ipo
- */
-
-static PyObject *Ipo_getCurveNames( BPy_Ipo * self )
-{
- namefunc lookup_name;
- int size;
- PyObject *dict;
- int *vals = NULL;
- char name[32];
- PyObject *attr = Py_None;
-
- /* determine what type of Ipo we are */
-
- switch ( self->ipo->blocktype ) {
- case ID_OB:
- lookup_name = (namefunc)getname_ob_ei;
- vals = ob_ar;
- size = OB_TOTIPO;
- strcpy( name, "OB_" );
- break;
- case ID_MA:
- lookup_name = (namefunc)getname_mat_ei;
- vals = ma_ar;
- size = MA_TOTIPO;
- strcpy( name, "MA_" );
- break;
- case ID_CA:
- lookup_name = (namefunc)getname_cam_ei;
- vals = cam_ar;
- size = CAM_TOTIPO;
- strcpy( name, "CA_" );
- break;
- case ID_LA:
- lookup_name = (namefunc)getname_la_ei;
- vals = la_ar;
- size = LA_TOTIPO;
- strcpy( name, "LA_" );
- break;
- case ID_TE:
- lookup_name = (namefunc)getname_tex_ei;
- vals = te_ar;
- size = TE_TOTIPO;
- strcpy( name, "TE_" );
- break;
- case ID_WO:
- lookup_name = (namefunc)getname_world_ei;
- vals = wo_ar;
- size = WO_TOTIPO;
- strcpy( name, "WO_" );
- break;
- case ID_PO:
- lookup_name = (namefunc)getname_ac_ei;
- vals = ac_ar;
- size = AC_TOTIPO;
- strcpy( name, "PO_" );
- break;
- case ID_CO:
- lookup_name = (namefunc)getname_co_ei;
- vals = co_ar;
- size = CO_TOTIPO;
- strcpy( name, "CO_" );
- break;
- case ID_CU:
- lookup_name = (namefunc)getname_cu_ei;
- vals = cu_ar;
- size = CU_TOTIPO;
- strcpy( name, "CU_" );
- break;
- case ID_SEQ:
- lookup_name = (namefunc)getname_seq_ei;
- vals = seq_ar;
- size = SEQ_TOTIPO;
- strcpy( name, "SQ_" );
- break;
- case ID_KE:
- {
- Key *key;
-
- /* find the ipo in the keylist */
- for( key = G.main->key.first; key; key = key->id.next ) {
- if( key->ipo == self->ipo ) {
- PyObject *tmpstr;
- KeyBlock *block = key->block.first;
- attr = PyList_New( 0 );
-
- /* add each name to the list */
- for( block = key->block.first; block; block = block->next ) {
- tmpstr = PyString_FromString( block->name );
- PyList_Append( attr, tmpstr);
- Py_DECREF(tmpstr);
- }
- return attr;
- }
- }
-
- /* error if the ipo isn't in the list */
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "unable to find matching key data for Ipo" );
- }
- default:
- Py_DECREF( attr );
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "unknown Ipo type" );
- }
-
- /*
- * go through the list of adrcodes to find names, then add to dictionary
- * with string as key and adrcode as value
- */
-
- dict = PyModule_GetDict( submodule );
- attr = PyConstant_New();
-
- while( size-- ) {
- char *ptr = name+3;
- strcpy( name+3, lookup_name( *vals ) );
- while( *ptr ) {
- *ptr = (char)toupper( *ptr );
- ++ptr;
- }
- PyConstant_Insert( (BPy_constant *)attr, name,
- PyInt_FromLong( *vals ) );
- ++vals;
- }
- return attr;
-}
-
-void generate_curveconsts( PyObject* module )
-{
- namefunc lookup_name = NULL;
- int size = 0;
- int *vals = NULL;
- char name[32];
-
- unsigned int i = 0;
- static short curvelist[] = {
- ID_OB, ID_MA, ID_CA, ID_LA, ID_TE, ID_WO, ID_PO, ID_CO, ID_CU, ID_SEQ
- };
-
- for( i = 0; i < sizeof(curvelist)/sizeof(short); ++i ) {
- switch ( curvelist[i] ) {
- case ID_OB:
- lookup_name = (namefunc)getname_ob_ei;
- vals = ob_ar;
- size = OB_TOTIPO;
- strcpy( name, "OB_" );
- break;
- case ID_MA:
- lookup_name = (namefunc)getname_mat_ei;
- vals = ma_ar;
- size = MA_TOTIPO;
- strcpy( name, "MA_" );
- break;
- case ID_CA:
- lookup_name = (namefunc)getname_cam_ei;
- vals = cam_ar;
- size = CAM_TOTIPO;
- strcpy( name, "CA_" );
- break;
- case ID_LA:
- lookup_name = (namefunc)getname_la_ei;
- vals = la_ar;
- size = LA_TOTIPO;
- strcpy( name, "LA_" );
- break;
- case ID_TE:
- lookup_name = (namefunc)getname_tex_ei;
- vals = te_ar;
- size = TE_TOTIPO;
- strcpy( name, "TE_" );
- break;
- case ID_WO:
- lookup_name = (namefunc)getname_world_ei;
- vals = wo_ar;
- size = WO_TOTIPO;
- strcpy( name, "WO_" );
- break;
- case ID_PO:
- lookup_name = (namefunc)getname_ac_ei;
- vals = ac_ar;
- size = AC_TOTIPO;
- strcpy( name, "PO_" );
- break;
- case ID_CO:
- lookup_name = (namefunc)getname_co_ei;
- vals = co_ar;
- size = CO_TOTIPO;
- strcpy( name, "CO_" );
- break;
- case ID_CU:
- lookup_name = (namefunc)getname_cu_ei;
- vals = cu_ar;
- size = CU_TOTIPO;
- strcpy( name, "CU_" );
- break;
- case ID_SEQ:
- lookup_name = (namefunc)getname_seq_ei;
- vals = seq_ar;
- size = SEQ_TOTIPO;
- strcpy( name, "SQ_" );
- break;
- }
-
- while( size-- ) {
- char *ptr = name+3;
- strcpy( name+3, lookup_name( *vals ) );
- while( *ptr ) {
- *ptr = (char)toupper( *ptr );
- ++ptr;
- }
- PyModule_AddIntConstant( module, name, *vals );
- ++vals;
- }
- }
-}
-
-
-/*
- * get the current texture channel number, if defined
- */
-
-static PyObject *Ipo_getChannel( BPy_Ipo * self )
-{
- if( self->mtex != -1 )
- return PyInt_FromLong( (long)self->mtex );
- Py_RETURN_NONE;
-}
-
-/*
- * set the current texture channel number, if defined
- */
-
-static int Ipo_setChannel( BPy_Ipo * self, PyObject * value )
-{
- if( self->mtex != -1 )
- return EXPP_setIValueRange( value, &self->mtex, 0, 9, 'h' );
- return 0;
-}
-
-/*****************************************************************************/
-/* Function: Ipo_compare */
-/* Description: This compares 2 ipo python types, == or != only. */
-/*****************************************************************************/
-static int Ipo_compare( BPy_Ipo * a, BPy_Ipo * b )
-{
- return ( a->ipo == b->ipo ) ? 0 : -1;
-}
-
-/*****************************************************************************/
-/* Function: Ipo_repr */
-/* Description: This is a callback function for the BPy_Ipo type. It */
-/* builds a meaningful string to represent ipo objects. */
-/*****************************************************************************/
-static PyObject *Ipo_repr( BPy_Ipo * self )
-{
- char *param;
-
- switch ( self->ipo->blocktype ) {
- case ID_OB:
- param = "Object"; break;
- case ID_CA:
- param = "Camera"; break;
- case ID_LA:
- param = "Lamp"; break;
- case ID_TE:
- param = "Texture"; break;
- case ID_WO:
- param = "World"; break;
- case ID_MA:
- param = "Material"; break;
- case ID_PO:
- param = "Action"; break;
- case ID_CO:
- param = "Constriant"; break;
- case ID_CU:
- param = "Curve"; break;
- case ID_SEQ:
- param = "Sequence"; break;
- case ID_KE:
- param = "Key"; break;
- default:
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "unknown Ipo type" );
- }
- return PyString_FromFormat( "[Ipo \"%s\" (%s)]", self->ipo->id.name + 2,
- param );
-}
-
-/* Three Python Ipo_Type helper functions needed by the Object module: */
-
-/*****************************************************************************/
-/* Function: Ipo_CreatePyObject */
-/* Description: This function will create a new BPy_Ipo from an existing */
-/* Blender ipo structure. */
-/*****************************************************************************/
-PyObject *Ipo_CreatePyObject( Ipo * ipo )
-{
- BPy_Ipo *pyipo;
- pyipo = ( BPy_Ipo * ) PyObject_NEW( BPy_Ipo, &Ipo_Type );
- if( !pyipo )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create BPy_Ipo object" );
- pyipo->ipo = ipo;
- pyipo->iter = 0;
- if( pyipo->ipo->blocktype == ID_WO || pyipo->ipo->blocktype == ID_LA ||
- pyipo->ipo->blocktype == ID_MA )
- pyipo->mtex = 0;
- else
- pyipo->mtex = -1;
- return ( PyObject * ) pyipo;
-}
-
-/*****************************************************************************/
-/* Function: Ipo_FromPyObject */
-/* Description: This function returns the Blender ipo from the given */
-/* PyObject. */
-/*****************************************************************************/
-Ipo *Ipo_FromPyObject( PyObject * pyobj )
-{
- return ( ( BPy_Ipo * ) pyobj )->ipo;
-}
-
-/*****************************************************************************/
-/* Function: Ipo_length */
-/* Description: This function counts the number of curves accessible for the */
-/* PyObject. */
-/*****************************************************************************/
-static int Ipo_length( BPy_Ipo * self )
-{
- IpoCurve *icu;
- int len = 0;
-
- for( icu = self->ipo->curve.first; icu; icu = icu->next ) {
- if( self->mtex == -1 || icu->adrcode < MA_MAP1 ||
- icu->adrcode & texchannel_to_adrcode( self->mtex ) )
- ++len;
- }
- return len;
-}
-
-/*
- * "mapping" operator getter: return an IpoCurve it we can find it
- */
-
-static PyObject *Ipo_getIpoCurveByName( BPy_Ipo * self, PyObject * key )
-{
- IpoCurve *icu = NULL;
- int adrcode;
-
- /* if Ipo is not ShapeKey and arg is an int, look up the adrcode */
- if( self->ipo->blocktype != ID_KE && PyNumber_Check( key ) )
- adrcode = lookup_curve_adrcode( PyInt_AsLong( key ),
- self->ipo->blocktype, self->mtex );
- /* if Ipo is ShapeKey and arg is string, look up the adrcode */
- else if( self->ipo->blocktype == ID_KE && PyString_Check( key ) ) {
- adrcode = lookup_curve_key( PyString_AS_STRING( key ), self->ipo );
- if( adrcode == -2 )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "unable to find matching key data for Ipo" );
- }
- else
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int or string key" );
-
- /* if no adrcode found, value error */
- if( adrcode == -1 )
- return EXPP_ReturnPyObjError( PyExc_KeyError, "invalid curve key" );
-
- /* search for a matching adrcode */
- for( icu = self->ipo->curve.first; icu; icu = icu->next )
- if( icu->adrcode == adrcode )
- return IpoCurve_CreatePyObject( icu );
-
- /* no curve found */
- Py_RETURN_NONE;
-}
-
-/*
- * "mapping" operator setter: create or delete an IpoCurve it we can find it
- */
-
-static int Ipo_setIpoCurveByName( BPy_Ipo * self, PyObject * key,
- PyObject * arg )
-{
- IpoCurve *icu;
- Ipo *ipo = self->ipo;
- short adrcode;
-
- /* "del ipo[const]" will send NULL here; give an error */
- if( !arg )
- return EXPP_ReturnIntError( PyExc_NotImplementedError,
- "del operator not supported" );
-
- /* "del ipo[const]" will send NULL here; give an error */
- if( self->ipo->blocktype == ID_KE )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "creation or deletion of Shape Keys not supported" );
-
- /* check for int argument */
- if( !PyNumber_Check( key ) )
- return EXPP_ReturnIntError( PyExc_TypeError, "expected int key" );
-
- /* look up the key, return error if not found */
- adrcode = lookup_curve_adrcode( PyInt_AsLong( key ),
- self->ipo->blocktype, self->mtex );
-
- if( adrcode == -1 )
- return EXPP_ReturnIntError( PyExc_KeyError,
- "invalid curve specified" );
-
- /* if arg is None, delete the curve */
- if( arg == Py_None ) {
- for( icu = self->ipo->curve.first; icu; icu = icu->next ) {
- if( icu->adrcode == adrcode ) {
- del_ipocurve( ipo, icu );
- return 0;
- }
- }
-
- return EXPP_ReturnIntError( PyExc_ValueError, "IpoCurve not found" );
- } else {
-
- /* create the new ipo curve */
- float time, curval;
- PyObject *tmp, *flt=NULL, *val=NULL;
-
- /* error if not a sequence or sequence with other than 2 values */
- if( PySequence_Size( arg ) != 2 )
- goto AttrError;
-
- /* get the time and curval */
- tmp = PySequence_ITEM( arg, 0 );
- flt = PyNumber_Float( tmp );
- Py_DECREF( tmp );
- tmp = PySequence_ITEM( arg, 1 );
- val = PyNumber_Float( tmp );
- Py_DECREF( tmp );
-
- if( !flt || !val )
- goto AttrError;
-
- time = (float)PyFloat_AS_DOUBLE( flt );
- curval = (float)PyFloat_AS_DOUBLE( val );
- Py_DECREF( flt );
- Py_DECREF( val );
-
- /* if curve already exist, delete the original */
- for( icu = ipo->curve.first; icu; icu = icu->next )
- if( icu->adrcode == adrcode ) {
- del_ipocurve( ipo, icu );
- break;
- }
-
- /* create the new curve, then add the key */
- icu = MEM_callocN( sizeof(IpoCurve), "Python added ipocurve");
- icu->blocktype = ipo->blocktype;
- icu->adrcode = adrcode;
- icu->flag |= IPO_VISIBLE|IPO_AUTO_HORIZ;
- set_icu_vars( icu );
- BLI_addtail( &(ipo->curve), icu);
- insert_vert_icu( icu, time, curval, 0);
-
- allspace( REMAKEIPO, 0 );
- EXPP_allqueue( REDRAWIPO, 0 );
-
- return 0;
-
-AttrError:
- Py_XDECREF( val );
- Py_XDECREF( flt );
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "expected sequence of two floats" );
- }
-}
-
-/*
- * sequence __contains__ method (implements "x in ipo")
- */
-
-static int Ipo_contains( BPy_Ipo *self, PyObject *key )
-{
- IpoCurve *icu = NULL;
- int adrcode;
-
- /* take a Ipo curve name: key must be a int */
-
- if( self->ipo->blocktype != ID_KE && PyNumber_Check( key ) ) {
- adrcode = lookup_curve_adrcode( PyInt_AsLong( key ),
- self->ipo->blocktype, self->mtex );
-
- /* if we found an adrcode for the key, search the ipo's curve */
- if( adrcode != -1 ) {
- for( icu = self->ipo->curve.first; icu; icu = icu->next )
- if( icu->adrcode == adrcode )
- return 1;
- }
- } else if( self->ipo->blocktype == ID_KE && PyString_Check( key ) ) {
- adrcode = lookup_curve_key( PyString_AS_STRING( key ), self->ipo );
-
- /* if we found an adrcode for the key, search the ipo's curve */
- if( adrcode >= 0 ) {
- for( icu = self->ipo->curve.first; icu; icu = icu->next )
- if( icu->adrcode == adrcode )
- return 1;
- }
- }
-
- /* no curve found */
- return 0;
-}
-
-/*
- * Initialize the interator index
- */
-
-static PyObject *Ipo_getIter( BPy_Ipo * self )
-{
- /* return a new IPO object if we are looping on the existing one
- This allows nested loops */
- if (self->iter==0) {
- return EXPP_incr_ret ( (PyObject *) self );
- } else {
- return Ipo_CreatePyObject(self->ipo);
- }
-}
-
-/*
- * Get the next Ipo curve
- */
-
-static PyObject *Ipo_nextIter( BPy_Ipo * self )
-{
- int i;
- IpoCurve *icu = self->ipo->curve.first;
-
- ++self->iter;
-
- /*
- * count curves only if
- * (a) Ipo has no texture channels
- * (b) Ipo has texture channels, but curve is not that type
- * (c) Ipo has texture channels, and curve is that type, and it is
- * in the active texture channel
- */
- for( i = 0; icu; icu = icu->next ) {
- if( self->mtex == -1 || icu->adrcode < MA_MAP1 ||
- icu->adrcode & texchannel_to_adrcode( self->mtex ) ) {
- ++i;
-
- /* if indices match, return the curve */
- if( i == self->iter )
- return IpoCurve_CreatePyObject( icu );
- }
- }
-
- self->iter = 0; /* allow iter use again */
- /* ran out of curves */
- return EXPP_ReturnPyObjError( PyExc_StopIteration,
- "iterator at end" );
-}
-
-/*****************************************************************************/
-/* Function: Ipo_Init */
-/*****************************************************************************/
-PyObject *Ipo_Init( void )
-{
- /* PyObject *submodule; */
-
- if( PyType_Ready( &Ipo_Type ) < 0 )
- return NULL;
-
- submodule = Py_InitModule3( "Blender.Ipo", M_Ipo_methods, M_Ipo_doc );
- generate_curveconsts( submodule );
-
- return submodule;
-}
-
-/*
- * The following methods should be deprecated when there are equivalent
- * methods in Ipocurve (if there aren't already).
- */
-
-static PyObject *Ipo_getNBezPoints( BPy_Ipo * self, PyObject * args )
-{
- int num = 0;
- IpoCurve *icu = NULL;
-
- if( !PyArg_ParseTuple( args, "i", &num ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int argument" );
-
- icu = self->ipo->curve.first;
- while( icu && num > 0 ) {
- icu = icu->next;
- --num;
- }
-
- if( num < 0 || !icu )
- return EXPP_ReturnPyObjError( PyExc_IndexError,
- "index out of range" );
-
- return PyInt_FromLong( icu->totvert );
-}
-
-static PyObject *Ipo_DeleteBezPoints( BPy_Ipo * self, PyObject * args )
-{
- int num = 0, i = 0;
- IpoCurve *icu = 0;
- if( !PyArg_ParseTuple( args, "i", &num ) )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError, "expected int argument" ) );
- icu = self->ipo->curve.first;
- if( !icu )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError, "No IPO curve" ) );
- for( i = 0; i < num; i++ ) {
- if( !icu )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError, "Bad curve number" ) );
- icu = icu->next;
-
- }
- icu->totvert--;
- return ( PyInt_FromLong( icu->totvert ) );
-}
-
-/*
- * Ipo_getCurveBP()
- * this method is UNSUPPORTED.
- * Calling this method throws a TypeError Exception.
- *
- * it looks like the original intent was to return the first point
- * of a BPoint Ipo curve. However, BPoint ipos are not currently
- * implemented.
- */
-
-static PyObject *Ipo_getCurveBP( BPy_Ipo * self_unused, PyObject * args_unused )
-{
- return EXPP_ReturnPyObjError( PyExc_NotImplementedError,
- "bpoint ipos are not supported" );
-}
-
-static PyObject *Ipo_getCurveBeztriple( BPy_Ipo * self, PyObject * args )
-{
- struct BezTriple *ptrbt;
- int num = 0, pos, i, j;
- IpoCurve *icu;
- PyObject *l, *pyfloat;
-
- if( !PyArg_ParseTuple( args, "ii", &num, &pos ) )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError, "expected int argument" ) );
- icu = self->ipo->curve.first;
- if( !icu )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError, "No IPO curve" ) );
- for( i = 0; i < num; i++ ) {
- if( !icu )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError, "Bad ipo number" ) );
- icu = icu->next;
- }
- if( pos >= icu->totvert )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "Bad bezt number" );
-
- ptrbt = icu->bezt + pos;
- if( !ptrbt )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "No bez triple" );
-
- l = PyList_New( 0 );
- for( i = 0; i < 3; i++ ) {
- for( j = 0; j < 3; j++ ) {
- pyfloat = PyFloat_FromDouble( ptrbt->vec[i][j] );
- PyList_Append( l, pyfloat );
- Py_DECREF(pyfloat);
- }
- }
- return l;
-}
-
-static PyObject *Ipo_setCurveBeztriple( BPy_Ipo * self, PyObject * args )
-{
- struct BezTriple *ptrbt;
- int num = 0, pos, i;
- IpoCurve *icu;
- PyObject *listargs = 0;
-
- if( !PyArg_ParseTuple( args, "iiO", &num, &pos, &listargs ) )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError,
- "expected int int object argument" ) );
- if( !PyTuple_Check( listargs ) )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError, "3rd arg should be a tuple" ) );
- icu = self->ipo->curve.first;
- if( !icu )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError, "No IPO curve" ) );
- for( i = 0; i < num; i++ ) {
- if( !icu )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError, "Bad ipo number" ) );
- icu = icu->next;
- }
- if( pos >= icu->totvert )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "Bad bezt number" );
-
- ptrbt = icu->bezt + pos;
- if( !ptrbt )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "No bez triple" );
-
- for( i = 0; i < 9; i++ ) {
- PyObject *xx = PyTuple_GetItem( listargs, i );
- ptrbt->vec[i / 3][i % 3] = (float)PyFloat_AsDouble( xx );
- }
-
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-/* Ipo.__copy__ */
-static PyObject *Ipo_copy( BPy_Ipo * self )
-{
- Ipo *ipo = copy_ipo(self->ipo );
- ipo->id.us = 0;
- return Ipo_CreatePyObject(ipo);
-}
-
-static PyObject *Ipo_EvaluateCurveOn( BPy_Ipo * self, PyObject * args )
-{
- int num = 0, i;
- IpoCurve *icu;
- float time = 0;
-
- if( !PyArg_ParseTuple( args, "if", &num, &time ) )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError, "expected int argument" ) );
-
- icu = self->ipo->curve.first;
- if( !icu )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError, "No IPO curve" ) );
-
- for( i = 0; i < num; i++ ) {
- if( !icu )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError, "Bad ipo number" ) );
- icu = icu->next;
-
- }
- return PyFloat_FromDouble( eval_icu( icu, time ) );
-}
-
-static PyObject *Ipo_getCurvecurval( BPy_Ipo * self, PyObject * args )
-{
- int numcurve = 0, i;
- IpoCurve *icu;
- char *stringname = 0, *str1 = 0;
-
- icu = self->ipo->curve.first;
- if( !icu )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError, "No IPO curve" ) );
-
- if( PyNumber_Check( PyTuple_GetItem( args, 0 ) ) ) /* args is an integer */
- {
- if( !PyArg_ParseTuple( args, "i", &numcurve ) )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError,
- "expected int or string argument" ) );
- for( i = 0; i < numcurve; i++ ) {
- if( !icu )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError,
- "Bad ipo number" ) );
- icu = icu->next;
- }
- }
-
- else /* args is a string */
- {
- if( !PyArg_ParseTuple( args, "s", &stringname ) )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError,
- "expected int or string argument" ) );
- while( icu ) {
- str1 = getIpoCurveName( icu );
- if( !strcmp( str1, stringname ) )
- break;
- icu = icu->next;
- }
- }
-
- if( icu )
- return PyFloat_FromDouble( icu->curval );
- Py_RETURN_NONE;
-}
-
-/*
- * The following methods should be deprecated when methods are pruned out.
- */
-
-static PyObject *Ipo_oldsetRctf( BPy_Ipo * self, PyObject * args )
-{
- return EXPP_setterWrapperTuple( (void *)self, args,
- (setter)Ipo_setRctf );
-}
-
-static PyObject *Ipo_oldsetBlocktype( BPy_Ipo * self, PyObject * args )
-{
- return EXPP_setterWrapperTuple( (void *)self, args,
- (setter)Ipo_setBlocktype );
-}
diff --git a/source/blender/python/api2_2x/Ipocurve.c b/source/blender/python/api2_2x/Ipocurve.c
deleted file mode 100644
index cc4cb066fe7..00000000000
--- a/source/blender/python/api2_2x/Ipocurve.c
+++ /dev/null
@@ -1,1080 +0,0 @@
-/*
- * $Id: Ipocurve.c 12078 2007-09-18 06:41:29Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Jacques Guignot, Nathan Letwory, Ken Hughes, Johnny Matthews
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include "Ipocurve.h" /*This must come first*/
-
-#include "Object.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_depsgraph.h"
-#include "BKE_ipo.h"
-#include "BIF_space.h"
-#include "BSE_editipo.h"
-#include "MEM_guardedalloc.h"
-#include "DNA_ipo_types.h"
-#include "DNA_key_types.h"
-#include "BezTriple.h"
-#include "gen_utils.h"
-
-/*****************************************************************************/
-/* The following string definitions are used for documentation strings. */
-/* In Python these will be written to the console when doing a */
-/* Blender.IpoCurve.__doc__ */
-/*****************************************************************************/
-char M_IpoCurve_doc[] = "";
-char M_IpoCurve_New_doc[] = "";
-char M_IpoCurve_Get_doc[] = "";
-
-/*****************************************************************************/
-/* Python method structure definition for Blender.IpoCurve module: */
-/*****************************************************************************/
-
-struct PyMethodDef M_IpoCurve_methods[] = {
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Python C_IpoCurve methods declarations: */
-/*****************************************************************************/
-static PyObject *IpoCurve_getName( C_IpoCurve * self );
-static PyObject *IpoCurve_Recalc( C_IpoCurve * self );
-static PyObject *IpoCurve_append( C_IpoCurve * self, PyObject * value );
-static PyObject *IpoCurve_addBezier( C_IpoCurve * self, PyObject * value );
-static PyObject *IpoCurve_delBezier( C_IpoCurve * self, PyObject * args );
-static PyObject *IpoCurve_setInterpolation( C_IpoCurve * self,
- PyObject * value );
-static PyObject *IpoCurve_getInterpolation( C_IpoCurve * self );
-static PyObject *IpoCurve_newgetInterp( C_IpoCurve * self );
-static int IpoCurve_newsetInterp( C_IpoCurve * self, PyObject * args );
-static PyObject *IpoCurve_setExtrapolation( C_IpoCurve * self,
- PyObject * value );
-static PyObject *IpoCurve_getExtrapolation( C_IpoCurve * self );
-static PyObject *IpoCurve_newgetExtend( C_IpoCurve * self );
-static int IpoCurve_newsetExtend( C_IpoCurve * self, PyObject * args );
-static PyObject *IpoCurve_getPoints( C_IpoCurve * self );
-static PyObject *IpoCurve_evaluate( C_IpoCurve * self, PyObject * args );
-static PyObject *IpoCurve_getDriver( C_IpoCurve * self );
-static int IpoCurve_setDriver( C_IpoCurve * self, PyObject * args );
-static PyObject *IpoCurve_getDriverObject( C_IpoCurve * self);
-static int IpoCurve_setDriverObject( C_IpoCurve * self, PyObject * args );
-static PyObject *IpoCurve_getDriverChannel( C_IpoCurve * self);
-static int IpoCurve_setDriverChannel( C_IpoCurve * self, PyObject * args );
-static PyObject *IpoCurve_getDriverExpression( C_IpoCurve * self);
-static PyObject *IpoCurve_getFlag( C_IpoCurve * self, void *type);
-static int IpoCurve_setFlag( C_IpoCurve * self, PyObject *value, void *type);
-
-static int IpoCurve_setDriverExpression( C_IpoCurve * self, PyObject * args );
-static PyObject *IpoCurve_getCurval( C_IpoCurve * self, PyObject * args );
-static int IpoCurve_setCurval( C_IpoCurve * self, PyObject * key,
- PyObject * value );
-
-/*****************************************************************************/
-/* Python C_IpoCurve methods table: */
-/*****************************************************************************/
-static PyMethodDef C_IpoCurve_methods[] = {
- /* name, method, flags, doc */
- {"getName", ( PyCFunction ) IpoCurve_getName, METH_NOARGS,
- "() - Return IpoCurve name"},
- {"Recalc", ( PyCFunction ) IpoCurve_Recalc, METH_NOARGS,
- "() - deprecated method. use recalc() instead"},
- {"recalc", ( PyCFunction ) IpoCurve_Recalc, METH_NOARGS,
- "() - Recomputes the curve after changes"},
- {"update", ( PyCFunction ) IpoCurve_Recalc, METH_NOARGS,
- "() - deprecated method: use recalc method instead."},
- {"append", ( PyCFunction ) IpoCurve_append, METH_O,
- "(coordlist) - Adds a Bezier point to a curve"},
- {"addBezier", ( PyCFunction ) IpoCurve_addBezier, METH_O,
- "() - deprecated method. use append() instead"},
- {"delBezier", ( PyCFunction ) IpoCurve_delBezier, METH_VARARGS,
- "() - deprecated method. use \"del icu[index]\" instead"},
- {"setInterpolation", ( PyCFunction ) IpoCurve_setInterpolation,
- METH_O, "(str) - Sets the interpolation type of the curve"},
- {"getInterpolation", ( PyCFunction ) IpoCurve_getInterpolation,
- METH_NOARGS, "() - Gets the interpolation type of the curve"},
- {"setExtrapolation", ( PyCFunction ) IpoCurve_setExtrapolation,
- METH_O, "(str) - Sets the extend mode of the curve"},
- {"getExtrapolation", ( PyCFunction ) IpoCurve_getExtrapolation,
- METH_NOARGS, "() - Gets the extend mode of the curve"},
- {"getPoints", ( PyCFunction ) IpoCurve_getPoints, METH_NOARGS,
- "() - Returns list of all bezTriples of the curve"},
- {"evaluate", ( PyCFunction ) IpoCurve_evaluate, METH_VARARGS,
- "(float) - Evaluate curve at given time"},
- {NULL, NULL, 0, NULL}
-};
-
-/*
- * IpoCurve methods
- */
-
-static PyGetSetDef C_IpoCurve_getseters[] = {
- {"name",
- (getter)IpoCurve_getName, (setter)NULL,
- "the IpoCurve name",
- NULL},
- {"bezierPoints",
- (getter)IpoCurve_getPoints, (setter)NULL,
- "list of all bezTriples of the curve",
- NULL},
- {"driver",
- (getter)IpoCurve_getDriver, (setter)IpoCurve_setDriver,
- "The status of the driver 1-object, 2-py expression, 0-off",
- NULL},
- {"driverObject",
- (getter)IpoCurve_getDriverObject, (setter)IpoCurve_setDriverObject,
- "The object used to drive the IpoCurve",
- NULL},
- {"driverChannel",
- (getter)IpoCurve_getDriverChannel, (setter)IpoCurve_setDriverChannel,
- "The channel on the driver object used to drive the IpoCurve",
- NULL},
- {"driverExpression",
- (getter)IpoCurve_getDriverExpression, (setter)IpoCurve_setDriverExpression,
- "The python expression on the driver used to drive the IpoCurve",
- NULL},
- {"interpolation",
- (getter)IpoCurve_newgetInterp, (setter)IpoCurve_newsetInterp,
- "The interpolation mode of the curve",
- NULL},
- {"extend",
- (getter)IpoCurve_newgetExtend, (setter)IpoCurve_newsetExtend,
- "The extend mode of the curve",
- NULL},
-
- {"sel",
- (getter)IpoCurve_getFlag, (setter)IpoCurve_setFlag,
- "the selection state of the curve",
- (void *)IPO_SELECT},
-
- {NULL,NULL,NULL,NULL,NULL}
-};
-
-/*****************************************************************************/
-/* Python IpoCurve_Type Mapping Methods table: */
-/*****************************************************************************/
-
-static PyMappingMethods IpoCurve_as_mapping = {
- ( inquiry ) 0, /* mp_length */
- ( binaryfunc ) IpoCurve_getCurval, /* mp_subscript */
- ( objobjargproc ) IpoCurve_setCurval, /* mp_ass_subscript */
-};
-
-/*****************************************************************************/
-/* Python IpoCurve_Type callback function prototypes: */
-/*****************************************************************************/
-static int IpoCurve_compare( C_IpoCurve * a, C_IpoCurve * b );
-static PyObject *IpoCurve_repr( C_IpoCurve * self );
-
-/*****************************************************************************/
-/* Python IpoCurve_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject IpoCurve_Type = {
- PyObject_HEAD_INIT( NULL ) /* required macro */
- 0, /* ob_size */
- "IpoCurve", /* tp_name */
- sizeof( C_IpoCurve ), /* tp_basicsize */
- 0, /* tp_itemsize */
- /* methods */
- NULL, /* tp_dealloc */
- 0, /* tp_print */
- ( getattrfunc ) NULL, /* tp_getattr */
- ( setattrfunc ) NULL, /* tp_setattr */
- ( cmpfunc ) IpoCurve_compare, /* tp_compare */
- ( reprfunc ) IpoCurve_repr, /* tp_repr */
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- &IpoCurve_as_mapping, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- NULL, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
- 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, /* long tp_flags; */
-
- NULL, /* char *tp_doc; */
- /*** 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, /* 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 ***/
- C_IpoCurve_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- C_IpoCurve_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-/*****************************************************************************/
-/* local utility functions */
-/*****************************************************************************/
-
-/*
- * Keys are handled differently than other Ipos, so go through contortions
- * to find their names.
- */
-
-static char *get_key_curvename( IpoCurve *ipocurve )
-{
- Key *key_iter;
- char *empty = "";
-
- /* search for keys with an Ipo */
-
- for( key_iter = G.main->key.first; key_iter; key_iter=key_iter->id.next) {
- if( key_iter->ipo ) {
- IpoCurve *icu = key_iter->ipo->curve.first;
- /* search curves for a match */
- while( icu ) {
- if( icu == ipocurve ) {
- KeyBlock *block = key_iter->block.first;
- /* search for matching adrcode */
- while( block ) {
- if( block->adrcode == ipocurve->adrcode )
- return block->name;
- block = block->next;
- }
- }
- icu = icu->next;
- }
- }
- }
-
- /* shouldn't get here unless deleted in UI while BPy object alive */
- return empty;
-}
-
-/*
- * internal bpy func to get Ipo Curve Name, used by Ipo.c and
- * KX_BlenderSceneConverter.cpp.
- *
- * We are returning a pointer to string constants so there are
- * no issues with who owns pointers.
- */
-
-char *getIpoCurveName( IpoCurve * icu )
-{
- switch ( icu->blocktype ) {
- case ID_MA:
- return getname_mat_ei( icu->adrcode );
- case ID_WO:
- return getname_world_ei( icu->adrcode );
- case ID_CA:
- return getname_cam_ei( icu->adrcode );
- case ID_OB:
- return getname_ob_ei( icu->adrcode, 1 );
- /* solve: what if EffX/Y/Z are wanted? */
- case ID_TE:
- return getname_tex_ei( icu->adrcode );
- case ID_LA:
- return getname_la_ei( icu->adrcode );
- case ID_PO:
- return getname_ac_ei( icu->adrcode );
- case ID_CU:
- return getname_cu_ei( icu->adrcode );
- case ID_KE:
- /* return "Key"; */
- /* ipo curves have no names... that was only meant for drawing the buttons... (ton) */
- return get_key_curvename( icu );
- case ID_SEQ:
- return getname_seq_ei( icu->adrcode );
- case ID_CO:
- return getname_co_ei( icu->adrcode );
- }
- return NULL;
-}
-
-/*
- * delete a bezTriple from a curve
- */
-
-static void del_beztriple( IpoCurve *icu, int index )
-{
- int npoints = icu->totvert - 1;
- BezTriple * tmp = icu->bezt;
-
- /*
- * if delete empties list, then delete it, otherwise copy the remaining
- * points to a new list
- */
-
- if( !npoints ) {
- icu->bezt = NULL;
- } else {
- icu->bezt =
- MEM_mallocN( sizeof( BezTriple ) * npoints, "bezt" );
- if( index > 0 )
- memmove( icu->bezt, tmp, index * sizeof( BezTriple ) );
- if( index < npoints )
- memmove( icu->bezt + index, tmp + index + 1,
- ( npoints - index ) * sizeof( BezTriple ) );
- }
-
- /* free old list, adjust vertex count */
- MEM_freeN( tmp );
- icu->totvert--;
-
- /* call calchandles_* instead of testhandles_* */
- /* I'm not sure this is a complete solution but since we do not */
- /* deal with curve handles right now, it seems ok */
- calchandles_ipocurve( icu );
-}
-
-/*****************************************************************************/
-/* Python C_IpoCurve methods: */
-/*****************************************************************************/
-
-static PyObject *IpoCurve_setInterpolation( C_IpoCurve * self,
- PyObject * value )
-{
- char *interpolationtype = PyString_AsString(value);
- short id;
-
- if( !interpolationtype )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument" );
-
- if( !strcmp( interpolationtype, "Bezier" ) )
- id = IPO_BEZ;
- else if( !strcmp( interpolationtype, "Constant" ) )
- id = IPO_CONST;
- else if( !strcmp( interpolationtype, "Linear" ) )
- id = IPO_LIN;
- else
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "bad interpolation type" );
-
- self->ipocurve->ipo = id;
- Py_RETURN_NONE;
-}
-
-static PyObject *IpoCurve_getInterpolation( C_IpoCurve * self )
-{
- char *str = 0;
- IpoCurve *icu = self->ipocurve;
-
- switch( icu->ipo ) {
- case IPO_BEZ:
- str = "Bezier";
- break;
- case IPO_CONST:
- str = "Constant";
- break;
- case IPO_LIN:
- str = "Linear";
- break;
- default:
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "unknown interpolation type" );
- }
-
- return PyString_FromString( str );
-}
-
-static PyObject * IpoCurve_setExtrapolation( C_IpoCurve * self,
- PyObject * value )
-{
- char *extrapolationtype = PyString_AsString(value);
- short id;
-
- if( !extrapolationtype )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument" );
-
- if( !strcmp( extrapolationtype, "Constant" ) )
- id = 0;
- else if( !strcmp( extrapolationtype, "Extrapolation" ) )
- id = 1;
- else if( !strcmp( extrapolationtype, "Cyclic" ) )
- id = 2;
- else if( !strcmp( extrapolationtype, "Cyclic_extrapolation" ) )
- id = 3;
- else
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "bad interpolation type" );
-
- self->ipocurve->extrap = id;
- Py_RETURN_NONE;
-}
-
-static PyObject *IpoCurve_getExtrapolation( C_IpoCurve * self )
-{
- char *str;
- IpoCurve *icu = self->ipocurve;
-
- switch( icu->extrap ) {
- case 0:
- str = "Constant";
- break;
- case 1:
- str = "Extrapolation";
- break;
- case 2:
- str = "Cyclic";
- break;
- case 3:
- str = "Cyclic_extrapolation";
- break;
- default:
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "bad extrapolation type" );
- }
-
- return PyString_FromString( str );
-}
-
-/*
- * append a new BezTriple to curve
- */
-
-static PyObject *IpoCurve_append( C_IpoCurve * self, PyObject * value )
-{
- float x, y;
- IpoCurve *icu = self->ipocurve;
-
- /* if args is a already a beztriple, tack onto end of list */
- if( BPy_BezTriple_Check ( value ) ) {
- BPy_BezTriple *bobj = (BPy_BezTriple *)value;
-
- BezTriple *newb = MEM_callocN( (icu->totvert+1)*sizeof(BezTriple),
- "BPyBeztriple" );
- if( icu->bezt ) {
- memcpy( newb, icu->bezt, ( icu->totvert )*sizeof( BezTriple ) );
- MEM_freeN( icu->bezt );
- }
- icu->bezt = newb;
- memcpy( &icu->bezt[icu->totvert], bobj->beztriple,
- sizeof( BezTriple ) );
- icu->totvert++;
- calchandles_ipocurve( icu );
-
- /* otherwise try to get two floats and add to list */
- } else {
- PyObject *xobj, *yobj;
- xobj = PyNumber_Float( PyTuple_GetItem( value, 0 ) );
- yobj = PyNumber_Float( PyTuple_GetItem( value, 1 ) );
-
- if( !xobj || !yobj )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected tuple of floats" );
-
- x = (float)PyFloat_AsDouble( xobj );
- Py_DECREF( xobj );
- y = (float)PyFloat_AsDouble( yobj );
- Py_DECREF( yobj );
- insert_vert_icu( icu, x, y, 0);
- }
-
- Py_RETURN_NONE;
-}
-
-/*
- Function: IpoCurve_delBezier
- Bpy: Blender.Ipocurve.delBezier(0)
-
- Delete an BezTriple from an IPO curve.
- example:
- ipo = Blender.Ipo.Get('ObIpo')
- cu = ipo.getCurve('LocX')
- cu.delBezier(0)
-*/
-
-static PyObject *IpoCurve_delBezier( C_IpoCurve * self, PyObject * args )
-{
- int index;
-
- if( !PyArg_ParseTuple( args, "i", &index ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int argument" );
-
- /* if index is negative, count from end of list */
- if( index < 0 )
- index += self->ipocurve->totvert;
- /* check range of index */
- if( index < 0 || index > self->ipocurve->totvert - 1 )
- return EXPP_ReturnPyObjError( PyExc_IndexError,
- "index outside of list" );
-
- del_beztriple( self->ipocurve, index );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *IpoCurve_Recalc( C_IpoCurve * self )
-{
- IpoCurve *icu = self->ipocurve;
-
- /* testhandles_ipocurve (icu); */
- /* call calchandles_* instead of testhandles_* */
- /* I'm not sure this is a complete solution but since we do not */
- /* deal with curve handles right now, it seems ok */
- calchandles_ipocurve( icu );
- sort_time_ipocurve( icu );
-
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-static PyObject *IpoCurve_getName( C_IpoCurve * self )
-{
- switch ( self->ipocurve->blocktype ) {
- case ID_OB:
- return PyString_FromString( getname_ob_ei( self->ipocurve->adrcode, 1 ) ); /* solve: what if EffX/Y/Z are wanted? */
- case ID_TE:
- return PyString_FromString( getname_tex_ei
- ( self->ipocurve->adrcode ) );
- case ID_LA:
- return PyString_FromString( getname_la_ei
- ( self->ipocurve->adrcode ) );
- case ID_MA:
- return PyString_FromString( getname_mat_ei
- ( self->ipocurve->adrcode ) );
- case ID_CA:
- return PyString_FromString( getname_cam_ei
- ( self->ipocurve->adrcode ) );
- case ID_WO:
- return PyString_FromString( getname_world_ei
- ( self->ipocurve->adrcode ) );
- case ID_PO:
- return PyString_FromString( getname_ac_ei
- ( self->ipocurve->adrcode ) );
- case ID_CU:
- return PyString_FromString( getname_cu_ei
- ( self->ipocurve->adrcode ) );
- case ID_KE:
- return PyString_FromString( get_key_curvename( self->ipocurve ) );
- case ID_SEQ:
- return PyString_FromString( getname_seq_ei
- ( self->ipocurve->adrcode ) );
- case ID_CO:
- return PyString_FromString( getname_co_ei
- ( self->ipocurve->adrcode ) );
- default:
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "This function doesn't support this ipocurve type yet" );
- }
-}
-
-static PyObject *IpoCurve_getPoints( C_IpoCurve * self )
-{
- BezTriple *bezt;
- PyObject *po;
- int i;
- PyObject *list = PyList_New( self->ipocurve->totvert );
-
- if( !list )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "PyList_New() failed" );
-
- for( bezt = self->ipocurve->bezt, i = 0;
- i < self->ipocurve->totvert; i++, bezt++ ) {
- po = BezTriple_CreatePyObject( bezt );
- if( !po ) {
- Py_DECREF( list );
- return NULL; /* This is okay since the error is alredy set */
- }
- PyList_SET_ITEM( list, i, po );
- }
- return list;
-}
-
-/*****************************************************************************/
-/* Function: IpoCurve_compare */
-/* Description: This compares 2 python types, == or != only. */
-/*****************************************************************************/
-static int IpoCurve_compare( C_IpoCurve * a, C_IpoCurve * b )
-{
- return ( a->ipocurve == b->ipocurve ) ? 0 : -1;
-}
-
-/*****************************************************************************/
-/* Function: IpoCurve_repr */
-/* Description: This is a callback function for the C_IpoCurve type. It */
-/* builds a meaningful string to represent ipocurve objects. */
-/*****************************************************************************/
-static PyObject *IpoCurve_repr( C_IpoCurve * self )
-{
- return PyString_FromFormat( "[IpoCurve \"%s\"]",
- getIpoCurveName( self->ipocurve ) );
-}
-
-/* Three Python IpoCurve_Type helper functions needed by the Object module: */
-
-/*****************************************************************************/
-/* Function: IpoCurve_CreatePyObject */
-/* Description: This function will create a new C_IpoCurve from an existing */
-/* Blender ipo structure. */
-/*****************************************************************************/
-PyObject *IpoCurve_CreatePyObject( IpoCurve * icu )
-{
- C_IpoCurve *pyipo;
-
- pyipo = ( C_IpoCurve * ) PyObject_NEW( C_IpoCurve, &IpoCurve_Type );
-
- if( !pyipo )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create C_IpoCurve object" );
-
- pyipo->ipocurve = icu;
-
- return ( PyObject * ) pyipo;
-}
-
-/*****************************************************************************/
-/* Function: IpoCurve_FromPyObject */
-/* Description: This function returns the Blender ipo from the given */
-/* PyObject. */
-/*****************************************************************************/
-IpoCurve *IpoCurve_FromPyObject( PyObject * pyobj )
-{
- return ( ( C_IpoCurve * ) pyobj )->ipocurve;
-}
-
-/*
- * get the value of an Ipocurve at a particular time
- */
-
-static PyObject *IpoCurve_getCurval( C_IpoCurve * self, PyObject * args )
-{
- float time;
- PyObject *pyfloat = PyNumber_Float( args );
-
- if( !pyfloat )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected float argument" );
- time = ( float )PyFloat_AS_DOUBLE( pyfloat );
- Py_DECREF( pyfloat );
-
- return PyFloat_FromDouble( ( double ) eval_icu( self->ipocurve, time ) );
-}
-
-/*
- * set the value of an Ipocurve at a particular time
- */
-
-static int IpoCurve_setCurval( C_IpoCurve * self, PyObject * key,
- PyObject * value )
-{
- float time, curval;
- PyObject *pyfloat;
-
- /* make sure time, curval are both floats */
-
- pyfloat = PyNumber_Float( key );
- if( !pyfloat )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected float key" );
- time = ( float )PyFloat_AS_DOUBLE( pyfloat );
- Py_DECREF( pyfloat );
-
- pyfloat = PyNumber_Float( value );
- if( !pyfloat )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected float argument" );
- curval = ( float )PyFloat_AS_DOUBLE( pyfloat );
- Py_DECREF( pyfloat );
-
- /* insert a key at the specified time */
-
- insert_vert_icu( self->ipocurve, time, curval, 0);
- allspace(REMAKEIPO, 0);
- return 0;
-}
-
-/***************************************************************************/
-/* Function: IpoCurve_evaluate( time ) */
-/* Description: Evaluates IPO curve at the given time. */
-/***************************************************************************/
-
-static PyObject *IpoCurve_evaluate( C_IpoCurve * self, PyObject * args )
-{
- float time = 0;
- double eval = 0;
-
- /* expecting float */
- if( !PyArg_ParseTuple( args, "f", &time ) )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError, "expected float argument" ) );
-
- eval = ( double ) eval_icu( self->ipocurve, time );
-
- return PyFloat_FromDouble( eval );
-
-}
-
-static PyObject *IpoCurve_getDriver( C_IpoCurve * self )
-{
- if( !self->ipocurve->driver )
- return PyInt_FromLong( 0 );
- else {
- if (self->ipocurve->driver->type == IPO_DRIVER_TYPE_NORMAL)
- return PyInt_FromLong( 1 );
- if (self->ipocurve->driver->type == IPO_DRIVER_TYPE_PYTHON)
- return PyInt_FromLong( 2 );
- }
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "unknown driver type, internal error" );
-
-}
-
-/*
- sets the driver to
- 0: disabled
- 1: enabled (object)
- 2: enabled (python expression)
-*/
-static int IpoCurve_setDriver( C_IpoCurve * self, PyObject * args )
-{
- IpoCurve *ipo = self->ipocurve;
- int type;
- if( !PyInt_Check( args ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected int argument 0 or 1 " );
-
- type = PyInt_AS_LONG( args );
-
- if (type < 0 || type > 2)
- return EXPP_ReturnIntError( PyExc_ValueError,
- "expected int argument 0, 1 or 2" );
-
- if (type==0) { /* disable driver */
- if( ipo->driver ) {
- MEM_freeN( ipo->driver );
- ipo->driver = NULL;
- }
- } else {
- if( !ipo->driver ) { /*add driver if its not there */
- ipo->driver = MEM_callocN( sizeof(IpoDriver), "ipo driver" );
- ipo->driver->blocktype = ID_OB;
- ipo->driver->adrcode = OB_LOC_X;
- }
-
- if (type==1 && ipo->driver->type != IPO_DRIVER_TYPE_NORMAL) {
- ipo->driver->type = IPO_DRIVER_TYPE_NORMAL;
- ipo->driver->ob = NULL;
- ipo->driver->flag &= ~IPO_DRIVER_FLAG_INVALID;
-
- } else if (type==2 && ipo->driver->type != IPO_DRIVER_TYPE_PYTHON) {
- ipo->driver->type = IPO_DRIVER_TYPE_PYTHON;
- /* we should probably set ipo->driver->ob, but theres no way to do it properly */
- ipo->driver->ob = NULL;
- }
- }
-
- return 0;
-}
-
-static PyObject *IpoCurve_getDriverObject( C_IpoCurve * self )
-{
- IpoCurve *ipo = self->ipocurve;
-
- if( ipo->driver )
- return Object_CreatePyObject( ipo->driver->ob );
-
- Py_RETURN_NONE;
-}
-
-static int IpoCurve_setDriverObject( C_IpoCurve * self, PyObject * arg )
-{
- IpoCurve *ipo = self->ipocurve;
-
- if( !ipo->driver )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "This IpoCurve does not have an active driver" );
-
- if(!BPy_Object_Check(arg) )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "expected an object argument" );
- ipo->driver->ob = ((BPy_Object *)arg)->object;
-
- DAG_scene_sort(G.scene);
-
- return 0;
-}
-
-static PyObject *IpoCurve_getDriverChannel( C_IpoCurve * self )
-{
- if( !self->ipocurve->driver )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This IpoCurve does not have an active driver" );
-
- return PyInt_FromLong( self->ipocurve->driver->adrcode );
-}
-
-static int IpoCurve_setDriverChannel( C_IpoCurve * self, PyObject * args )
-{
- IpoCurve *ipo = self->ipocurve;
- short param;
-
- if( !ipo->driver )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "This IpoCurve does not have an active driver" );
-
- if( !PyInt_Check( args ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected int argument" );
-
- param = (short)PyInt_AS_LONG ( args );
- if( ( param >= OB_LOC_X && param <= OB_LOC_Z )
- || ( param >= OB_ROT_X && param <= OB_ROT_Z )
- || ( param >= OB_SIZE_X && param <= OB_SIZE_Z ) ) {
- ipo->driver->adrcode = (short)PyInt_AS_LONG ( args );
- return 0;
- }
-
- return EXPP_ReturnIntError( PyExc_ValueError, "invalid int argument" );
-}
-
-static PyObject *IpoCurve_getDriverExpression( C_IpoCurve * self )
-{
- IpoCurve *ipo = self->ipocurve;
-
- if( ipo->driver && ipo->driver->type == IPO_DRIVER_TYPE_PYTHON )
- return PyString_FromString( ipo->driver->name );
-
- Py_RETURN_NONE;
-}
-
-static int IpoCurve_setDriverExpression( C_IpoCurve * self, PyObject * arg )
-{
- IpoCurve *ipo = self->ipocurve;
- char *exp; /* python expression */
-
- if( !ipo->driver )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "This IpoCurve does not have an active driver" );
-
- if (ipo->driver->type != IPO_DRIVER_TYPE_PYTHON)
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "This IpoCurve is not a python expression set the driver attribute to 2" );
-
- if(!PyString_Check(arg) )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "expected a string argument" );
-
- exp = PyString_AsString(arg);
- if (strlen(exp)>127)
- return EXPP_ReturnIntError( PyExc_ValueError,
- "string is too long, use 127 characters or less" );
-
- strcpy(ipo->driver->name, exp);
- return 0;
-}
-
-static PyObject *M_IpoCurve_ExtendDict( void )
-{
- PyObject *EM = PyConstant_New( );
-
- if( EM ) {
- BPy_constant *d = ( BPy_constant * ) EM;
-
- PyConstant_Insert( d, "CONST", PyInt_FromLong( IPO_HORIZ ) );
- PyConstant_Insert( d, "EXTRAP", PyInt_FromLong( IPO_DIR ) );
- PyConstant_Insert( d, "CYCLIC", PyInt_FromLong( IPO_CYCL ) );
- PyConstant_Insert( d, "CYCLIC_EXTRAP", PyInt_FromLong( IPO_CYCLX ) );
- }
- return EM;
-}
-
-static PyObject *M_IpoCurve_InterpDict( void )
-{
- PyObject *IM = PyConstant_New( );
-
- if( IM ) {
- BPy_constant *d = ( BPy_constant * ) IM;
-
- PyConstant_Insert( d, "CONST", PyInt_FromLong( IPO_CONST ) );
- PyConstant_Insert( d, "LINEAR", PyInt_FromLong( IPO_LIN ) );
- PyConstant_Insert( d, "BEZIER", PyInt_FromLong( IPO_BEZ ) );
- }
- return IM;
-}
-
-/*****************************************************************************/
-/* Function: IpoCurve_Init */
-/*****************************************************************************/
-PyObject *IpoCurve_Init( void )
-{
- PyObject *submodule;
- PyObject *ExtendTypes = M_IpoCurve_ExtendDict( );
- PyObject *InterpTypes = M_IpoCurve_InterpDict( );
-
- if( PyType_Ready( &IpoCurve_Type ) < 0)
- return NULL;
-
- submodule =
- Py_InitModule3( "Blender.IpoCurve", M_IpoCurve_methods,
- M_IpoCurve_doc );
-
- PyModule_AddIntConstant( submodule, "LOC_X", OB_LOC_X );
- PyModule_AddIntConstant( submodule, "LOC_Y", OB_LOC_Y );
- PyModule_AddIntConstant( submodule, "LOC_Z", OB_LOC_Z );
- PyModule_AddIntConstant( submodule, "ROT_X", OB_ROT_X );
- PyModule_AddIntConstant( submodule, "ROT_Y", OB_ROT_Y );
- PyModule_AddIntConstant( submodule, "ROT_Z", OB_ROT_Z );
- PyModule_AddIntConstant( submodule, "SIZE_X", OB_SIZE_X );
- PyModule_AddIntConstant( submodule, "SIZE_Y", OB_SIZE_Y );
- PyModule_AddIntConstant( submodule, "SIZE_Z", OB_SIZE_Z );
-
- if( ExtendTypes )
- PyModule_AddObject( submodule, "ExtendTypes", ExtendTypes );
- if( InterpTypes )
- PyModule_AddObject( submodule, "InterpTypes", InterpTypes );
-
- return submodule;
-}
-
-/*
- */
-
-static PyObject *IpoCurve_newgetInterp( C_IpoCurve * self )
-{
- return PyInt_FromLong( self->ipocurve->ipo );
-}
-
-static int IpoCurve_newsetInterp( C_IpoCurve * self, PyObject * value )
-{
- return EXPP_setIValueRange( value, &self->ipocurve->ipo,
- IPO_CONST, IPO_BEZ, 'h' );
-}
-
-static PyObject *IpoCurve_newgetExtend( C_IpoCurve * self )
-{
- return PyInt_FromLong( self->ipocurve->extrap );
-}
-
-static int IpoCurve_newsetExtend( C_IpoCurve * self, PyObject * value )
-{
- return EXPP_setIValueRange( value, &self->ipocurve->extrap,
- IPO_HORIZ, IPO_CYCLX, 'h' );
-}
-
-static PyObject *IpoCurve_getFlag( C_IpoCurve * self, void *type )
-{
- if (self->ipocurve->flag & (int)type)
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
-}
-
-static int IpoCurve_setFlag( C_IpoCurve * self, PyObject *value, void *type )
-{
- int param = PyObject_IsTrue( value );
- if( param == -1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected True/False or 0/1" );
-
- if (param)
- self->ipocurve->flag |= (int)type;
- else
- self->ipocurve->flag &= ~(int)type;
-
- return 0;
-}
-
-
-/* #####DEPRECATED###### */
-
-static PyObject *IpoCurve_addBezier( C_IpoCurve * self, PyObject * value )
-{
- float x, y;
- int npoints;
- IpoCurve *icu;
- BezTriple *bzt, *tmp;
- static char name[10] = "mlml";
- if( !PyArg_ParseTuple( value, "ff", &x, &y ) )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError, "expected a tuple of 2 floats" ) );
-
- icu = self->ipocurve;
- npoints = icu->totvert;
- tmp = icu->bezt;
- icu->bezt = MEM_mallocN( sizeof( BezTriple ) * ( npoints + 1 ), name );
- if( tmp ) {
- memmove( icu->bezt, tmp, sizeof( BezTriple ) * npoints );
- MEM_freeN( tmp );
- }
- memmove( icu->bezt + npoints, icu->bezt, sizeof( BezTriple ) );
- icu->totvert++;
- bzt = icu->bezt + npoints;
- bzt->vec[0][0] = x - 1;
- bzt->vec[1][0] = x;
- bzt->vec[2][0] = x + 1;
- bzt->vec[0][1] = y - 1;
- bzt->vec[1][1] = y;
- bzt->vec[2][1] = y + 1;
- /* set handle type to Auto */
- bzt->h1 = HD_AUTO;
- bzt->h2 = HD_AUTO;
-
- Py_RETURN_NONE;
-}
diff --git a/source/blender/python/api2_2x/Ipocurve.h b/source/blender/python/api2_2x/Ipocurve.h
deleted file mode 100644
index 6c4216fa4bd..00000000000
--- a/source/blender/python/api2_2x/Ipocurve.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * $Id: Ipocurve.h 10943 2007-06-16 12:24:41Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Jacques Guignot
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_IPOCURVE_H
-#define EXPP_IPOCURVE_H
-
-#include <Python.h>
-#include "DNA_curve_types.h" /* declaration of IpoCurve */
-
-/*****************************************************************************/
-/* Python C_IpoCurve structure definition: */
-/*****************************************************************************/
-typedef struct {
- PyObject_HEAD /* required macro */
- IpoCurve * ipocurve;
- char wrapped;
-} C_IpoCurve;
-
-extern PyTypeObject IpoCurve_Type;
-
-#define BPy_IpoCurve_Check(v) ((v)->ob_type == &IpoCurve_Type) /* for type checking */
-
-PyObject *IpoCurve_Init( void );
-PyObject *IpoCurve_CreatePyObject( IpoCurve * ipo );
-IpoCurve *IpoCurve_FromPyObject( PyObject * pyobj );
-char *getIpoCurveName( IpoCurve * icu );
-
-
-#endif /* EXPP_IPOCURVE_H */
diff --git a/source/blender/python/api2_2x/Key.c b/source/blender/python/api2_2x/Key.c
deleted file mode 100644
index b223a382818..00000000000
--- a/source/blender/python/api2_2x/Key.c
+++ /dev/null
@@ -1,681 +0,0 @@
-/*
- * $Id: Key.c 12867 2007-12-13 15:06:02Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Pontus Lidman, Johnny Matthews, Ken Hughes,
- * Michael Reimpell
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include "Key.h" /*This must come first*/
-#include "vector.h"
-
-#include "DNA_scene_types.h"
-
-#include <BLI_blenlib.h>
-#include <BKE_global.h>
-#include <BKE_main.h>
-#include <BKE_curve.h>
-#include <BKE_library.h>
-#include <BKE_utildefines.h>
-#include "BIF_space.h"
-
-#include "Ipocurve.h"
-#include "NMesh.h" /* we create NMesh.NMVert objects */
-#include "Ipo.h"
-#include "BezTriple.h"
-
-#include "BSE_editipo.h"
-#include "mydevice.h"
-#include "BKE_depsgraph.h"
-#include "blendef.h"
-#include "constant.h"
-#include "gen_utils.h"
-#include "gen_library.h"
-
-#define KEY_TYPE_MESH 0
-#define KEY_TYPE_CURVE 1
-#define KEY_TYPE_LATTICE 2
-
-static int Key_compare( BPy_Key * a, BPy_Key * b );
-static PyObject *Key_repr( BPy_Key * self );
-static void Key_dealloc( BPy_Key * self );
-
-static PyObject *Key_getBlocks( BPy_Key * self );
-static PyObject *Key_getType( BPy_Key * self );
-static PyObject *Key_getRelative( BPy_Key * self );
-static PyObject *Key_getIpo( BPy_Key * self );
-static int Key_setIpo( BPy_Key * self, PyObject * args );
-static PyObject *Key_getValue( BPy_Key * self );
-static int Key_setRelative( BPy_Key * self, PyObject * value );
-
-static struct PyMethodDef Key_methods[] = {
- { "getBlocks", (PyCFunction) Key_getBlocks, METH_NOARGS, "Get key blocks" },
- { "getIpo", (PyCFunction) Key_getIpo, METH_NOARGS, "Get key Ipo" },
- { 0, 0, 0, 0 }
-};
-
-static PyGetSetDef BPy_Key_getsetters[] = {
- {"type",(getter)Key_getType, (setter)NULL,
- "Key Type",NULL},
- {"value",(getter)Key_getValue, (setter)NULL,
- "Key value",NULL},
- {"ipo",(getter)Key_getIpo, (setter)Key_setIpo,
- "Ipo linked to key",NULL},
- {"blocks",(getter)Key_getBlocks, (setter)NULL,
- "Blocks linked to the key",NULL},
- {"relative",(getter)Key_getRelative, (setter)Key_setRelative,
- "Non-zero is key is relative",NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-static PyObject *KeyBlock_getData( PyObject * self );
-static PyObject *KeyBlock_getCurval( BPy_KeyBlock * self );
-static PyObject *KeyBlock_getName( BPy_KeyBlock * self );
-static PyObject *KeyBlock_getPos( BPy_KeyBlock * self );
-static PyObject *KeyBlock_getSlidermin( BPy_KeyBlock * self );
-static PyObject *KeyBlock_getSlidermax( BPy_KeyBlock * self );
-static PyObject *KeyBlock_getVgroup( BPy_KeyBlock * self );
-
-static int KeyBlock_setName( BPy_KeyBlock *, PyObject * args );
-static int KeyBlock_setVgroup( BPy_KeyBlock *, PyObject * args );
-static int KeyBlock_setSlidermin( BPy_KeyBlock *, PyObject * args );
-static int KeyBlock_setSlidermax( BPy_KeyBlock *, PyObject * args );
-
-static void KeyBlock_dealloc( BPy_KeyBlock * self );
-static int KeyBlock_compare( BPy_KeyBlock * a, BPy_KeyBlock * b );
-static PyObject *KeyBlock_repr( BPy_KeyBlock * self );
-
-static struct PyMethodDef KeyBlock_methods[] = {
- { "getData", (PyCFunction) KeyBlock_getData, METH_NOARGS,
- "Get keyblock data" },
- { 0, 0, 0, 0 }
-};
-
-static PyGetSetDef BPy_KeyBlock_getsetters[] = {
- {"curval",(getter)KeyBlock_getCurval, (setter)NULL,
- "Current value of the corresponding IpoCurve",NULL},
- {"name",(getter)KeyBlock_getName, (setter)KeyBlock_setName,
- "Keyblock Name",NULL},
- {"pos",(getter)KeyBlock_getPos, (setter)NULL,
- "Keyblock Pos",NULL},
- {"slidermin",(getter)KeyBlock_getSlidermin, (setter)KeyBlock_setSlidermin,
- "Keyblock Slider Minimum",NULL},
- {"slidermax",(getter)KeyBlock_getSlidermax, (setter)KeyBlock_setSlidermax,
- "Keyblock Slider Maximum",NULL},
- {"vgroup",(getter)KeyBlock_getVgroup, (setter)KeyBlock_setVgroup,
- "Keyblock VGroup",NULL},
- {"data",(getter)KeyBlock_getData, (setter)NULL,
- "Keyblock VGroup",NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-PyTypeObject Key_Type = {
- PyObject_HEAD_INIT( NULL ) 0, /*ob_size */
- "Blender Key", /*tp_name */
- sizeof( BPy_Key ), /*tp_basicsize */
- 0, /*tp_itemsize */
- /* methods */
- ( destructor ) Key_dealloc,/* destructor tp_dealloc; */
- ( printfunc ) 0, /*tp_print */
- ( getattrfunc ) 0, /*tp_getattr */
- ( setattrfunc ) 0, /*tp_setattr */
- ( cmpfunc) Key_compare, /*tp_compare*/
- ( reprfunc ) Key_repr, /* tp_repr */
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- NULL, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
- 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, /* 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, /* 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 ***/
- Key_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_Key_getsetters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-PyTypeObject KeyBlock_Type = {
- PyObject_HEAD_INIT( NULL ) 0, /*ob_size */
- "Blender KeyBlock", /*tp_name */
- sizeof( BPy_KeyBlock ), /*tp_basicsize */
- 0, /*tp_itemsize */
- /* methods */
- ( destructor ) KeyBlock_dealloc,/* destructor tp_dealloc; */
- ( printfunc ) 0, /*tp_print */
- ( getattrfunc ) 0, /*tp_getattr */
- ( setattrfunc ) 0, /*tp_setattr */
- ( cmpfunc) KeyBlock_compare, /*tp_compare*/
- ( reprfunc ) KeyBlock_repr, /* tp_repr */
- /* Method suites for standard classes */
-
- 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; */
- 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, /* 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, /* 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 ***/
- KeyBlock_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_KeyBlock_getsetters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-PyObject *Key_CreatePyObject( Key * blenkey )
-{
- BPy_Key *bpykey = PyObject_NEW( BPy_Key, &Key_Type );
- /* blenkey may be NULL so be careful */
- bpykey->key = blenkey;
- return ( PyObject * ) bpykey;
-}
-
-static void Key_dealloc( BPy_Key * self )
-{
- PyObject_DEL( self );
-}
-
-static int Key_compare( BPy_Key * a, BPy_Key * b )
-{
- return ( a->key == b->key ) ? 0 : -1;
-}
-
-static PyObject *Key_repr( BPy_Key * self )
-{
- return PyString_FromFormat( "[Key \"%s\"]", self->key->id.name + 2 );
-}
-
-static PyObject *Key_getIpo( BPy_Key * self )
-{
- if (self->key->ipo)
- return Ipo_CreatePyObject( self->key->ipo );
- Py_RETURN_NONE;
-}
-
-static int Key_setIpo( BPy_Key * self, PyObject * value )
-{
- return GenericLib_assignData(value, (void **) &self->key->ipo, 0, 1, ID_IP, ID_KE);
-}
-
-static PyObject *Key_getRelative( BPy_Key * self )
-{
- if( self->key->type == KEY_RELATIVE )
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
-}
-
-static int Key_setRelative( BPy_Key * self, PyObject * value )
-{
- int param = PyObject_IsTrue( value );
- if( param == -1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected True/False or 0/1" );
-
- if( param )
- self->key->type = KEY_RELATIVE;
- else
- self->key->type = KEY_NORMAL;
- allqueue(REDRAWIPO, 0);
- allspace(REMAKEIPO, 0);
-
- return 0;
-}
-
-static PyObject *Key_getType( BPy_Key * self )
-{
- int idcode;
- int type = -1;
-
- idcode = GS( self->key->from->name );
-
- switch( idcode ) {
- case ID_ME:
- type = KEY_TYPE_MESH;
- break;
- case ID_CU:
- type = KEY_TYPE_CURVE;
- break;
- case ID_LT:
- type = KEY_TYPE_LATTICE;
- break;
- }
-
- return PyInt_FromLong( type );
-}
-
-static PyObject *Key_getBlocks( BPy_Key * self )
-{
- Key *key = self->key;
- KeyBlock *kb;
- int i=0;
- PyObject *l = PyList_New( BLI_countlist( &(key->block)) );
-
- for (kb = key->block.first; kb; kb = kb->next, i++)
- PyList_SET_ITEM( l, i, KeyBlock_CreatePyObject( kb, key ) );
-
- return l;
-}
-
-static PyObject *Key_getValue( BPy_Key * self )
-{
- BPy_Key *k = ( BPy_Key * ) self;
-
- return PyFloat_FromDouble( k->key->curval );
-}
-
-/* ------------ Key Block Functions -------------- */
-PyObject *KeyBlock_CreatePyObject( KeyBlock * keyblock, Key *parentKey )
-{
- BPy_KeyBlock *bpykb = PyObject_NEW( BPy_KeyBlock, &KeyBlock_Type );
- bpykb->key = parentKey;
- bpykb->keyblock = keyblock; /* keyblock maye be NULL, thats ok */
- return ( PyObject * ) bpykb;
-}
-
-static PyObject *KeyBlock_getCurval( BPy_KeyBlock * self ) {
- return PyFloat_FromDouble( self->keyblock->curval );
-}
-
-static PyObject *KeyBlock_getName( BPy_KeyBlock * self ) {
- return PyString_FromString(self->keyblock->name);
-}
-
-static PyObject *KeyBlock_getPos( BPy_KeyBlock * self ){
- return PyFloat_FromDouble( self->keyblock->pos );
-}
-
-static PyObject *KeyBlock_getSlidermin( BPy_KeyBlock * self ){
- return PyFloat_FromDouble( self->keyblock->slidermin );
-}
-
-static PyObject *KeyBlock_getSlidermax( BPy_KeyBlock * self ){
- return PyFloat_FromDouble( self->keyblock->slidermax );
-}
-
-static PyObject *KeyBlock_getVgroup( BPy_KeyBlock * self ){
- return PyString_FromString(self->keyblock->vgroup);
-}
-
-static int KeyBlock_setName( BPy_KeyBlock * self, PyObject * args ){
- char* text = NULL;
-
- text = PyString_AsString ( args );
- if( !text )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected string argument" );
- strncpy( self->keyblock->name, text , 32);
-
- return 0;
-}
-
-static int KeyBlock_setVgroup( BPy_KeyBlock * self, PyObject * args ){
- char* text = NULL;
-
- text = PyString_AsString ( args );
- if( !text )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected string argument" );
- strncpy( self->keyblock->vgroup, text , 32);
-
- return 0;
-}
-static int KeyBlock_setSlidermin( BPy_KeyBlock * self, PyObject * args ){
- return EXPP_setFloatClamped ( args, &self->keyblock->slidermin,
- -10.0f,
- 10.0f );
-}
-static int KeyBlock_setSlidermax( BPy_KeyBlock * self, PyObject * args ){
- return EXPP_setFloatClamped ( args, &self->keyblock->slidermax,
- -10.0f,
- 10.0f );
-}
-
-static void KeyBlock_dealloc( BPy_KeyBlock * self )
-{
- PyObject_DEL( self );
-}
-
-static int KeyBlock_compare( BPy_KeyBlock * a, BPy_KeyBlock * b )
-{
- return ( a->keyblock == b->keyblock ) ? 0 : -1;
-}
-
-static PyObject *KeyBlock_repr( BPy_KeyBlock * self )
-{
- return PyString_FromFormat( "[KeyBlock \"%s\"]", self->keyblock->name );
-}
-
-
-static Curve *find_curve( Key *key )
-{
- Curve *cu;
-
- if( !key )
- return NULL;
-
- for( cu = G.main->curve.first; cu; cu = cu->id.next ) {
- if( cu->key == key )
- break;
- }
- return cu;
-}
-
-static PyObject *KeyBlock_getData( PyObject * self )
-{
- /* If this is a mesh key, data is an array of MVert coords.
- If lattice, data is an array of BPoint coords
- If curve, data is an array of BezTriple or BPoint */
-
- char *datap;
- int datasize;
- int idcode;
- int i;
- Curve *cu;
- Nurb* nu;
- PyObject *l;
- BPy_KeyBlock *kb = ( BPy_KeyBlock * ) self;
- Key *key = kb->key;
-
- if( !kb->keyblock->data ) {
- Py_RETURN_NONE;
- }
-
- l = PyList_New( kb->keyblock->totelem );
- if( !l )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "PyList_New() failed" );
-
- idcode = GS( key->from->name );
-
- switch(idcode) {
- case ID_ME:
-
- for (i=0, datap = kb->keyblock->data; i<kb->keyblock->totelem; i++) {
- PyObject *vec = newVectorObject((float*)datap, 3, Py_WRAP);
-
- if (!vec) return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "could not allocate memory for Blender.Mathutils.Vector wrapper!" );
-
- PyList_SetItem(l, i, vec);
- datap += kb->key->elemsize;
- }
- break;
-
- case ID_CU:
- cu = find_curve ( key );
- if( !cu )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "key is no linked to any curve!" );
- datasize = count_curveverts(&cu->nurb);
- nu = cu->nurb.first;
- if( nu->bezt ) {
- datasize /= 3;
- Py_DECREF (l);
- l = PyList_New( datasize );
- for( i = 0, datap = kb->keyblock->data; i < datasize;
- i++, datap += sizeof(float)*3*4) {
- PyObject *tuple = PyTuple_New(4), *vec;
- float *vecs = (float*)datap;
-
- if (!tuple) return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "PyTuple_New() failed!" );
-
- vec = newVectorObject(vecs, 3, Py_WRAP);
- if (!vec) return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "Could not allocate memory for Blender.Mathutils.Vector wrapper!" );
-
- PyTuple_SET_ITEM( tuple, 0, vec);
-
- vecs += 3;
- vec = newVectorObject(vecs, 3, Py_WRAP);
- if (!vec) return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "Could not allocate memory for Blender.Mathutils.Vector wrapper!" );
-
- PyTuple_SET_ITEM( tuple, 1, vec);
-
- vecs += 3;
- vec = newVectorObject(vecs, 3, Py_WRAP);
- if (!vec) return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "Could not allocate memory for Blender.Mathutils.Vector wrapper!" );
-
- PyTuple_SET_ITEM( tuple, 2, vec);
-
- /*tilts*/
- vecs += 3;
- vec = newVectorObject(vecs, 3, Py_WRAP);
- if (!vec) return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "Could not allocate memory for Blender.Mathutils.Vector wrapper!" );
-
- PyTuple_SET_ITEM( tuple, 3, vec);
-
- PyList_SetItem( l, i, tuple );
- }
- } else {
- for( i = 0, datap = kb->keyblock->data; i < datasize;
- i++, datap += kb->key->elemsize ) {
- PyObject *vec = newVectorObject((float*)datap, 4, Py_WRAP);
- if (!vec) return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "could not allocate memory for Blender.Mathutils.Vector wrapper!" );
-
- PyList_SetItem( l, i, vec );
- }
- }
- break;
-
- case ID_LT:
- for( i = 0, datap = kb->keyblock->data; i < kb->keyblock->totelem;
- i++, datap += kb->key->elemsize ) {
- PyObject *vec = newVectorObject((float*)datap, 3, Py_WRAP);
- if (!vec) return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "Could not allocate memory for Blender.Mathutils.Vector wrapper!" );
-
- PyList_SetItem( l, i, vec );
- }
- break;
- }
-
- return l;
-}
-
-static PyObject *M_Key_Get( PyObject * self, PyObject * args )
-{
- char *name = NULL;
- Key *key_iter;
- char error_msg[64];
- int i;
-
- if( !PyArg_ParseTuple( args, "|s", &name ) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument (or nothing)" ) );
-
- if ( name ) {
- for (key_iter = G.main->key.first; key_iter;
- key_iter=key_iter->id.next) {
- if (strcmp ( key_iter->id.name + 2, name ) == 0 ) {
- return Key_CreatePyObject( key_iter );
- }
- }
-
- PyOS_snprintf( error_msg, sizeof( error_msg ),
- "Key \"%s\" not found", name );
- return EXPP_ReturnPyObjError ( PyExc_NameError, error_msg );
-
- } else {
-
- PyObject *keylist;
-
- keylist = PyList_New( BLI_countlist( &( G.main->key ) ) );
-
- for ( i=0, key_iter = G.main->key.first; key_iter;
- key_iter=key_iter->id.next, i++ ) {
- PyList_SetItem(keylist, i, Key_CreatePyObject(key_iter));
- }
- return keylist;
- }
-}
-
-struct PyMethodDef M_Key_methods[] = {
- {"Get", M_Key_Get, METH_VARARGS, "Get a key or all key names"},
- {NULL, NULL, 0, NULL}
-};
-
-static PyObject *M_Key_TypesDict( void )
-{
- PyObject *T = PyConstant_New( );
-
- if( T ) {
- BPy_constant *d = ( BPy_constant * ) T;
-
- PyConstant_Insert( d, "MESH", PyInt_FromLong( KEY_TYPE_MESH ) );
- PyConstant_Insert( d, "CURVE", PyInt_FromLong( KEY_TYPE_CURVE ) );
- PyConstant_Insert( d, "LATTICE", PyInt_FromLong( KEY_TYPE_LATTICE ) );
- }
-
- return T;
-}
-
-PyObject *Key_Init( void )
-{
- PyObject *submodule;
- PyObject *Types = NULL;
-
- if( PyType_Ready( &Key_Type ) < 0 || PyType_Ready( &KeyBlock_Type ) < 0 )
- return NULL;
-
- submodule =
- Py_InitModule3( "Blender.Key", M_Key_methods, "Key module" );
-
- Types = M_Key_TypesDict( );
- if( Types )
- PyModule_AddObject( submodule, "Types", Types );
-
- return submodule;
-}
-
diff --git a/source/blender/python/api2_2x/Key.h b/source/blender/python/api2_2x/Key.h
deleted file mode 100644
index 35e92fc5fea..00000000000
--- a/source/blender/python/api2_2x/Key.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * $Id: Key.h 10783 2007-05-26 12:58:46Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Pontus Lidman
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#ifndef EXPP_KEY_H
-#define EXPP_KEY_H
-
-#include "Python.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <DNA_key_types.h>
-#include <DNA_curve_types.h>
-
-extern PyTypeObject Key_Type;
-extern PyTypeObject KeyBlock_Type;
-
-typedef struct {
- PyObject_HEAD /* required python macro */
- Key * key; /* libdata must be second */
- /* Object *object;*/ /* for vertex grouping info, since it's stored on the object */
- /*PyObject *keyBlock;*/
- /*PyObject *ipo;*/
-} BPy_Key;
-
-typedef struct {
- PyObject_HEAD /* required python macro */
- Key *key;
- KeyBlock * keyblock;
- /* Object *object;*/ /* for vertex grouping info, since it's stored on the object */
-} BPy_KeyBlock;
-
-PyObject *Key_CreatePyObject( Key * k );
-PyObject *KeyBlock_CreatePyObject( KeyBlock * k, Key *parentKey );
-
-PyObject *Key_Init( void );
-
-#endif /* EXPP_KEY_H */
diff --git a/source/blender/python/api2_2x/Lamp.c b/source/blender/python/api2_2x/Lamp.c
deleted file mode 100644
index 8112d1372c6..00000000000
--- a/source/blender/python/api2_2x/Lamp.c
+++ /dev/null
@@ -1,1570 +0,0 @@
-/*
- * $Id: Lamp.c 12810 2007-12-06 20:15:03Z khughes $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano, Nathan Letwory, Stephen Swaney,
- * Ken Hughes
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#include "Lamp.h" /*This must come first*/
-
-#include "BKE_main.h"
-#include "BKE_global.h"
-#include "BKE_object.h"
-#include "BKE_library.h"
-#include "BLI_blenlib.h"
-#include "BIF_space.h"
-#include "BSE_editipo.h"
-#include "mydevice.h"
-#include "Ipo.h"
-#include "constant.h"
-#include "gen_utils.h"
-#include "gen_library.h"
-
-/*****************************************************************************/
-/* Python BPy_Lamp defaults: */
-/*****************************************************************************/
-
-/* Lamp types */
-
-/* NOTE:
- these are the same values as LA_* from DNA_lamp_types.h
- is there some reason we are not simply using those #defines?
- s. swaney 8-oct-2004
-*/
-
-#define EXPP_LAMP_TYPE_LAMP 0
-#define EXPP_LAMP_TYPE_SUN 1
-#define EXPP_LAMP_TYPE_SPOT 2
-#define EXPP_LAMP_TYPE_HEMI 3
-#define EXPP_LAMP_TYPE_AREA 4
-#define EXPP_LAMP_TYPE_YF_PHOTON 5
-/*
- define a constant to keep magic numbers out of the code
- this value should be equal to the last EXPP_LAMP_TYPE_*
-*/
-#define EXPP_LAMP_TYPE_MAX 5
-
-/* Lamp mode flags */
-
-#define EXPP_LAMP_MODE_SHADOWS 1
-#define EXPP_LAMP_MODE_HALO 2
-#define EXPP_LAMP_MODE_LAYER 4
-#define EXPP_LAMP_MODE_QUAD 8
-#define EXPP_LAMP_MODE_NEGATIVE 16
-#define EXPP_LAMP_MODE_ONLYSHADOW 32
-#define EXPP_LAMP_MODE_SPHERE 64
-#define EXPP_LAMP_MODE_SQUARE 128
-#define EXPP_LAMP_MODE_TEXTURE 256
-#define EXPP_LAMP_MODE_OSATEX 512
-#define EXPP_LAMP_MODE_DEEPSHADOW 1024
-#define EXPP_LAMP_MODE_NODIFFUSE 2048
-#define EXPP_LAMP_MODE_NOSPECULAR 4096
-#define EXPP_LAMP_MODE_SHAD_RAY 8192
-/* Lamp MIN, MAX values */
-
-#define EXPP_LAMP_SAMPLES_MIN 1
-#define EXPP_LAMP_SAMPLES_MAX 16
-#define EXPP_LAMP_BUFFERSIZE_MIN 512
-#define EXPP_LAMP_BUFFERSIZE_MAX 5120
-#define EXPP_LAMP_ENERGY_MIN 0.0
-#define EXPP_LAMP_ENERGY_MAX 10.0
-#define EXPP_LAMP_DIST_MIN 0.1f
-#define EXPP_LAMP_DIST_MAX 5000.0
-#define EXPP_LAMP_SPOTSIZE_MIN 1.0
-#define EXPP_LAMP_SPOTSIZE_MAX 180.0
-#define EXPP_LAMP_SPOTBLEND_MIN 0.00
-#define EXPP_LAMP_SPOTBLEND_MAX 1.00
-#define EXPP_LAMP_CLIPSTART_MIN 0.1f
-#define EXPP_LAMP_CLIPSTART_MAX 1000.0
-#define EXPP_LAMP_CLIPEND_MIN 1.0
-#define EXPP_LAMP_CLIPEND_MAX 5000.0
-#define EXPP_LAMP_BIAS_MIN 0.01f
-#define EXPP_LAMP_BIAS_MAX 5.00
-#define EXPP_LAMP_SOFTNESS_MIN 1.0
-#define EXPP_LAMP_SOFTNESS_MAX 100.0
-#define EXPP_LAMP_HALOINT_MIN 0.0
-#define EXPP_LAMP_HALOINT_MAX 5.0
-#define EXPP_LAMP_HALOSTEP_MIN 0
-#define EXPP_LAMP_HALOSTEP_MAX 12
-#define EXPP_LAMP_QUAD1_MIN 0.0
-#define EXPP_LAMP_QUAD1_MAX 1.0
-#define EXPP_LAMP_QUAD2_MIN 0.0
-#define EXPP_LAMP_QUAD2_MAX 1.0
-#define EXPP_LAMP_COL_MIN 0.0
-#define EXPP_LAMP_COL_MAX 1.0
-
-/* Raytracing settings */
-#define EXPP_LAMP_RAYSAMPLES_MIN 1
-#define EXPP_LAMP_RAYSAMPLES_MAX 16
-#define EXPP_LAMP_AREASIZE_MIN 0.01f
-#define EXPP_LAMP_AREASIZE_MAX 100.0f
-
-/* Lamp_setComponent() keys for which color to get/set */
-#define EXPP_LAMP_COMP_R 0x00
-#define EXPP_LAMP_COMP_G 0x01
-#define EXPP_LAMP_COMP_B 0x02
-
-#define IPOKEY_RGB 0
-#define IPOKEY_ENERGY 1
-#define IPOKEY_SPOTSIZE 2
-#define IPOKEY_OFFSET 3
-#define IPOKEY_SIZE 4
-
-/*****************************************************************************/
-/* Python API function prototypes for the Lamp module. */
-/*****************************************************************************/
-static PyObject *M_Lamp_New( PyObject * self, PyObject * args,
- PyObject * keywords );
-static PyObject *M_Lamp_Get( PyObject * self, PyObject * args );
-
-/*****************************************************************************/
-/* The following string definitions are used for documentation strings. */
-/* In Python these will be written to the console when doing a */
-/* Blender.Lamp.__doc__ */
-/*****************************************************************************/
-static char M_Lamp_doc[] = "The Blender Lamp module\n\n\
-This module provides control over **Lamp Data** objects in Blender.\n\n\
-Example::\n\n\
- from Blender import Lamp\n\
- l = Lamp.New('Spot') # create new 'Spot' lamp data\n\
- l.setMode('square', 'shadow') # set these two lamp mode flags\n\
- ob = Object.New('Lamp') # create new lamp object\n\
- ob.link(l) # link lamp obj with lamp data\n";
-
-static char M_Lamp_New_doc[] = "Lamp.New (type = 'Lamp', name = 'LampData'):\n\
- Return a new Lamp Data object with the given type and name.";
-
-static char M_Lamp_Get_doc[] = "Lamp.Get (name = None):\n\
- Return the Lamp Data with the given name, None if not found, or\n\
- Return a list with all Lamp Data objects in the current scene,\n\
- if no argument was given.";
-
-/*****************************************************************************/
-/* Python method structure definition for Blender.Lamp module: */
-/*****************************************************************************/
-struct PyMethodDef M_Lamp_methods[] = {
- {"New", ( PyCFunction ) M_Lamp_New, METH_VARARGS | METH_KEYWORDS,
- M_Lamp_New_doc},
- {"Get", M_Lamp_Get, METH_VARARGS, M_Lamp_Get_doc},
- {"get", M_Lamp_Get, METH_VARARGS, M_Lamp_Get_doc},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Python BPy_Lamp methods declarations: */
-/*****************************************************************************/
-static PyObject *Lamp_getType( BPy_Lamp * self );
-static PyObject *Lamp_getTypesConst( void );
-static PyObject *Lamp_getMode( BPy_Lamp * self );
-static PyObject *Lamp_getModesConst( void );
-static PyObject *Lamp_getSamples( BPy_Lamp * self );
-static PyObject *Lamp_getRaySamplesX( BPy_Lamp * self );
-static PyObject *Lamp_getRaySamplesY( BPy_Lamp * self );
-static PyObject *Lamp_getAreaSizeX( BPy_Lamp * self );
-static PyObject *Lamp_getAreaSizeY( BPy_Lamp * self );
-static PyObject *Lamp_getBufferSize( BPy_Lamp * self );
-static PyObject *Lamp_getHaloStep( BPy_Lamp * self );
-static PyObject *Lamp_getEnergy( BPy_Lamp * self );
-static PyObject *Lamp_getDist( BPy_Lamp * self );
-static PyObject *Lamp_getSpotSize( BPy_Lamp * self );
-static PyObject *Lamp_getSpotBlend( BPy_Lamp * self );
-static PyObject *Lamp_getClipStart( BPy_Lamp * self );
-static PyObject *Lamp_getClipEnd( BPy_Lamp * self );
-static PyObject *Lamp_getBias( BPy_Lamp * self );
-static PyObject *Lamp_getSoftness( BPy_Lamp * self );
-static PyObject *Lamp_getHaloInt( BPy_Lamp * self );
-static PyObject *Lamp_getQuad1( BPy_Lamp * self );
-static PyObject *Lamp_getQuad2( BPy_Lamp * self );
-static PyObject *Lamp_getCol( BPy_Lamp * self );
-static PyObject *Lamp_getIpo( BPy_Lamp * self );
-static PyObject *Lamp_getComponent( BPy_Lamp * self, void * closure );
-static PyObject *Lamp_clearIpo( BPy_Lamp * self );
-static PyObject *Lamp_insertIpoKey( BPy_Lamp * self, PyObject * args );
-static PyObject *Lamp_oldsetIpo( BPy_Lamp * self, PyObject * args );
-static PyObject *Lamp_oldsetType( BPy_Lamp * self, PyObject * value );
-static PyObject *Lamp_oldsetMode( BPy_Lamp * self, PyObject * args );
-static PyObject *Lamp_oldsetSamples( BPy_Lamp * self, PyObject * args );
-static PyObject *Lamp_oldsetRaySamplesX( BPy_Lamp * self, PyObject * args );
-static PyObject *Lamp_oldsetRaySamplesY( BPy_Lamp * self, PyObject * args );
-static PyObject *Lamp_oldsetAreaSizeX( BPy_Lamp * self, PyObject * args );
-static PyObject *Lamp_oldsetAreaSizeY( BPy_Lamp * self, PyObject * args );
-static PyObject *Lamp_oldsetBufferSize( BPy_Lamp * self, PyObject * args );
-static PyObject *Lamp_oldsetHaloStep( BPy_Lamp * self, PyObject * args );
-static PyObject *Lamp_oldsetEnergy( BPy_Lamp * self, PyObject * args );
-static PyObject *Lamp_oldsetDist( BPy_Lamp * self, PyObject * args );
-static PyObject *Lamp_oldsetSpotSize( BPy_Lamp * self, PyObject * args );
-static PyObject *Lamp_oldsetSpotBlend( BPy_Lamp * self, PyObject * args );
-static PyObject *Lamp_oldsetClipStart( BPy_Lamp * self, PyObject * args );
-static PyObject *Lamp_oldsetClipEnd( BPy_Lamp * self, PyObject * args );
-static PyObject *Lamp_oldsetBias( BPy_Lamp * self, PyObject * args );
-static PyObject *Lamp_oldsetSoftness( BPy_Lamp * self, PyObject * args );
-static PyObject *Lamp_oldsetHaloInt( BPy_Lamp * self, PyObject * args );
-static PyObject *Lamp_oldsetQuad1( BPy_Lamp * self, PyObject * args );
-static PyObject *Lamp_oldsetQuad2( BPy_Lamp * self, PyObject * args );
-static PyObject *Lamp_oldsetCol( BPy_Lamp * self, PyObject * args );
-static PyObject *Lamp_copy( BPy_Lamp * self );
-static int Lamp_setIpo( BPy_Lamp * self, PyObject * args );
-static int Lamp_setType( BPy_Lamp * self, PyObject * args );
-static int Lamp_setMode( BPy_Lamp * self, PyObject * args );
-static int Lamp_setSamples( BPy_Lamp * self, PyObject * args );
-static int Lamp_setRaySamplesX( BPy_Lamp * self, PyObject * args );
-static int Lamp_setRaySamplesY( BPy_Lamp * self, PyObject * args );
-static int Lamp_setAreaSizeX( BPy_Lamp * self, PyObject * args );
-static int Lamp_setAreaSizeY( BPy_Lamp * self, PyObject * args );
-static int Lamp_setBufferSize( BPy_Lamp * self, PyObject * args );
-static int Lamp_setHaloStep( BPy_Lamp * self, PyObject * args );
-static int Lamp_setEnergy( BPy_Lamp * self, PyObject * args );
-static int Lamp_setDist( BPy_Lamp * self, PyObject * args );
-static int Lamp_setSpotSize( BPy_Lamp * self, PyObject * args );
-static int Lamp_setSpotBlend( BPy_Lamp * self, PyObject * args );
-static int Lamp_setClipStart( BPy_Lamp * self, PyObject * args );
-static int Lamp_setClipEnd( BPy_Lamp * self, PyObject * args );
-static int Lamp_setBias( BPy_Lamp * self, PyObject * args );
-static int Lamp_setSoftness( BPy_Lamp * self, PyObject * args );
-static int Lamp_setHaloInt( BPy_Lamp * self, PyObject * args );
-static int Lamp_setQuad1( BPy_Lamp * self, PyObject * args );
-static int Lamp_setQuad2( BPy_Lamp * self, PyObject * args );
-static int Lamp_setCol( BPy_Lamp * self, PyObject * args );
-static PyObject *Lamp_getScriptLinks( BPy_Lamp * self, PyObject * value );
-static PyObject *Lamp_addScriptLink( BPy_Lamp * self, PyObject * args );
-static PyObject *Lamp_clearScriptLinks( BPy_Lamp * self, PyObject * args );
-static int Lamp_setComponent( BPy_Lamp * self, PyObject * value, void * closure );
-
-/*****************************************************************************/
-/* Python BPy_Lamp methods table: */
-/*****************************************************************************/
-static PyMethodDef BPy_Lamp_methods[] = {
- /* name, method, flags, doc */
-
- {"getType", ( PyCFunction ) Lamp_getType, METH_NOARGS,
- "() - return Lamp type - 'Lamp':0, 'Sun':1, 'Spot':2, 'Hemi':3, 'Area':4, 'Photon':5"},
- {"getMode", ( PyCFunction ) Lamp_getMode, METH_NOARGS,
- "() - return Lamp mode flags (or'ed value)"},
- {"getSamples", ( PyCFunction ) Lamp_getSamples, METH_NOARGS,
- "() - return Lamp samples value"},
- {"getRaySamplesX", ( PyCFunction ) Lamp_getRaySamplesX, METH_NOARGS,
- "() - return Lamp raytracing samples on the X axis"},
- {"getRaySamplesY", ( PyCFunction ) Lamp_getRaySamplesY, METH_NOARGS,
- "() - return Lamp raytracing samples on the Y axis"},
- {"getAreaSizeX", ( PyCFunction ) Lamp_getAreaSizeX, METH_NOARGS,
- "() - return Lamp area size on the X axis"},
- {"getAreaSizeY", ( PyCFunction ) Lamp_getAreaSizeY, METH_NOARGS,
- "() - return Lamp area size on the Y axis"},
- {"getBufferSize", ( PyCFunction ) Lamp_getBufferSize, METH_NOARGS,
- "() - return Lamp buffer size value"},
- {"getHaloStep", ( PyCFunction ) Lamp_getHaloStep, METH_NOARGS,
- "() - return Lamp halo step value"},
- {"getEnergy", ( PyCFunction ) Lamp_getEnergy, METH_NOARGS,
- "() - return Lamp energy value"},
- {"getDist", ( PyCFunction ) Lamp_getDist, METH_NOARGS,
- "() - return Lamp clipping distance value"},
- {"getSpotSize", ( PyCFunction ) Lamp_getSpotSize, METH_NOARGS,
- "() - return Lamp spot size value"},
- {"getSpotBlend", ( PyCFunction ) Lamp_getSpotBlend, METH_NOARGS,
- "() - return Lamp spot blend value"},
- {"getClipStart", ( PyCFunction ) Lamp_getClipStart, METH_NOARGS,
- "() - return Lamp clip start value"},
- {"getClipEnd", ( PyCFunction ) Lamp_getClipEnd, METH_NOARGS,
- "() - return Lamp clip end value"},
- {"getBias", ( PyCFunction ) Lamp_getBias, METH_NOARGS,
- "() - return Lamp bias value"},
- {"getSoftness", ( PyCFunction ) Lamp_getSoftness, METH_NOARGS,
- "() - return Lamp softness value"},
- {"getHaloInt", ( PyCFunction ) Lamp_getHaloInt, METH_NOARGS,
- "() - return Lamp halo intensity value"},
- {"getQuad1", ( PyCFunction ) Lamp_getQuad1, METH_NOARGS,
- "() - return light intensity value #1 for a Quad Lamp"},
- {"getQuad2", ( PyCFunction ) Lamp_getQuad2, METH_NOARGS,
- "() - return light intensity value #2 for a Quad Lamp"},
- {"getCol", ( PyCFunction ) Lamp_getCol, METH_NOARGS,
- "() - return light rgb color triplet"},
- {"setName", ( PyCFunction ) GenericLib_setName_with_method, METH_VARARGS,
- "(str) - rename Lamp"},
- {"setType", ( PyCFunction ) Lamp_oldsetType, METH_O,
- "(str) - change Lamp type, which can be 'Lamp', 'Sun', 'Spot', 'Hemi', 'Area', 'Photon'"},
- {"setMode", ( PyCFunction ) Lamp_oldsetMode, METH_VARARGS,
- "([up to eight str's]) - Set Lamp mode flag(s)"},
- {"setSamples", ( PyCFunction ) Lamp_oldsetSamples, METH_VARARGS,
- "(int) - change Lamp samples value"},
- {"setRaySamplesX", ( PyCFunction ) Lamp_oldsetRaySamplesX, METH_VARARGS,
- "(int) - change Lamp ray X samples value in [1,16]"},
- {"setRaySamplesY", ( PyCFunction ) Lamp_oldsetRaySamplesY, METH_VARARGS,
- "(int) - change Lamp ray Y samples value in [1,16]"},
- {"setAreaSizeX", ( PyCFunction ) Lamp_oldsetAreaSizeX, METH_VARARGS,
- "(float) - change Lamp ray X size for area lamps, value in [0.01, 100.0]"},
- {"setAreaSizeY", ( PyCFunction ) Lamp_oldsetAreaSizeY, METH_VARARGS,
- "(float) - change Lamp ray Y size for area lamps, value in [0.01, 100.0]"},
- {"setBufferSize", ( PyCFunction ) Lamp_oldsetBufferSize, METH_VARARGS,
- "(int) - change Lamp buffer size value"},
- {"setHaloStep", ( PyCFunction ) Lamp_oldsetHaloStep, METH_VARARGS,
- "(int) - change Lamp halo step value"},
- {"setEnergy", ( PyCFunction ) Lamp_oldsetEnergy, METH_VARARGS,
- "(float) - change Lamp energy value"},
- {"setDist", ( PyCFunction ) Lamp_oldsetDist, METH_VARARGS,
- "(float) - change Lamp clipping distance value"},
- {"setSpotSize", ( PyCFunction ) Lamp_oldsetSpotSize, METH_VARARGS,
- "(float) - change Lamp spot size value"},
- {"setSpotBlend", ( PyCFunction ) Lamp_oldsetSpotBlend, METH_VARARGS,
- "(float) - change Lamp spot blend value"},
- {"setClipStart", ( PyCFunction ) Lamp_oldsetClipStart, METH_VARARGS,
- "(float) - change Lamp clip start value"},
- {"setClipEnd", ( PyCFunction ) Lamp_oldsetClipEnd, METH_VARARGS,
- "(float) - change Lamp clip end value"},
- {"setBias", ( PyCFunction ) Lamp_oldsetBias, METH_VARARGS,
- "(float) - change Lamp draw size value"},
- {"setSoftness", ( PyCFunction ) Lamp_oldsetSoftness, METH_VARARGS,
- "(float) - change Lamp softness value"},
- {"setHaloInt", ( PyCFunction ) Lamp_oldsetHaloInt, METH_VARARGS,
- "(float) - change Lamp halo intensity value"},
- {"setQuad1", ( PyCFunction ) Lamp_oldsetQuad1, METH_VARARGS,
- "(float) - change light intensity value #1 for a Quad Lamp"},
- {"setQuad2", ( PyCFunction ) Lamp_oldsetQuad2, METH_VARARGS,
- "(float) - change light intensity value #2 for a Quad Lamp"},
- {"setCol", ( PyCFunction ) Lamp_oldsetCol, METH_VARARGS,
- "(f,f,f) or ([f,f,f]) - change light's rgb color triplet"},
- {"getScriptLinks", ( PyCFunction ) Lamp_getScriptLinks, METH_O,
- "(eventname) - Get a list of this lamp's scriptlinks (Text names) "
- "of the given type\n"
- "(eventname) - string: FrameChanged, Redraw or Render."},
- {"addScriptLink", ( PyCFunction ) Lamp_addScriptLink, METH_VARARGS,
- "(text, evt) - Add a new lamp scriptlink.\n"
- "(text) - string: an existing Blender Text name;\n"
- "(evt) string: FrameChanged, Redraw or Render."},
- {"clearScriptLinks", ( PyCFunction ) Lamp_clearScriptLinks,
- METH_VARARGS,
- "() - Delete all scriptlinks from this lamp.\n"
- "([s1<,s2,s3...>]) - Delete specified scriptlinks from this lamp."},
- {"getIpo", ( PyCFunction ) Lamp_getIpo, METH_NOARGS,
- "() - get IPO for this lamp"},
- {"clearIpo", ( PyCFunction ) Lamp_clearIpo, METH_NOARGS,
- "() - unlink the IPO for this lamp"},
- {"setIpo", ( PyCFunction ) Lamp_oldsetIpo, METH_VARARGS,
- "( lamp-ipo ) - link an IPO to this lamp"},
- {"insertIpoKey", ( PyCFunction ) Lamp_insertIpoKey, METH_VARARGS,
- "( Lamp IPO type ) - Inserts a key into IPO"},
- {"__copy__", ( PyCFunction ) Lamp_copy, METH_NOARGS,
- "() - Makes a copy of this lamp."},
- {"copy", ( PyCFunction ) Lamp_copy, METH_NOARGS,
- "() - Makes a copy of this lamp."},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Python attributes get/set structure: */
-/*****************************************************************************/
-static PyGetSetDef BPy_Lamp_getseters[] = {
- GENERIC_LIB_GETSETATTR,
- {"bias",
- (getter)Lamp_getBias, (setter)Lamp_setBias,
- "Lamp shadow map sampling bias",
- NULL},
- {"bufferSize",
- (getter)Lamp_getBufferSize, (setter)Lamp_setBufferSize,
- "Lamp shadow buffer size",
- NULL},
- {"clipEnd",
- (getter)Lamp_getClipEnd, (setter)Lamp_setClipEnd,
- "Lamp shadow map clip end",
- NULL},
- {"clipStart",
- (getter)Lamp_getClipStart, (setter)Lamp_setClipStart,
- "Lamp shadow map clip start",
- NULL},
- {"col",
- (getter)Lamp_getCol, (setter)Lamp_setCol,
- "Lamp RGB color triplet",
- NULL},
- {"dist",
- (getter)Lamp_getDist, (setter)Lamp_setDist,
- "Lamp clipping distance",
- NULL},
- {"energy",
- (getter)Lamp_getEnergy, (setter)Lamp_setEnergy,
- "Lamp light intensity",
- NULL},
- {"haloInt",
- (getter)Lamp_getHaloInt, (setter)Lamp_setHaloInt,
- "Lamp spotlight halo intensity",
- NULL},
- {"haloStep",
- (getter)Lamp_getHaloStep, (setter)Lamp_setHaloStep,
- "Lamp volumetric halo sampling frequency",
- NULL},
- {"ipo",
- (getter)Lamp_getIpo, (setter)Lamp_setIpo,
- "Lamp Ipo",
- NULL},
- {"mode",
- (getter)Lamp_getMode, (setter)Lamp_setMode,
- "Lamp mode bitmask",
- NULL},
- {"quad1",
- (getter)Lamp_getQuad1, (setter)Lamp_setQuad1,
- "Quad lamp linear distance attenuation",
- NULL},
- {"quad2",
- (getter)Lamp_getQuad2, (setter)Lamp_setQuad2,
- "Quad lamp quadratic distance attenuation",
- NULL},
- {"samples",
- (getter)Lamp_getSamples, (setter)Lamp_setSamples,
- "Lamp shadow map samples",
- NULL},
- {"raySamplesX",
- (getter)Lamp_getRaySamplesX, (setter)Lamp_setRaySamplesX,
- "Lamp raytracing samples on the X axis",
- NULL},
- {"raySamplesY",
- (getter)Lamp_getRaySamplesY, (setter)Lamp_setRaySamplesY,
- "Lamp raytracing samples on the Y axis",
- NULL},
- {"areaSizeX",
- (getter)Lamp_getAreaSizeX, (setter)Lamp_setAreaSizeX,
- "Lamp X size for an arealamp",
- NULL},
- {"areaSizeY",
- (getter)Lamp_getAreaSizeY, (setter)Lamp_setAreaSizeY,
- "Lamp Y size for an arealamp",
- NULL},
- {"softness",
- (getter)Lamp_getSoftness, (setter)Lamp_setSoftness,
- "Lamp shadow sample area size",
- NULL},
- {"spotBlend",
- (getter)Lamp_getSpotBlend, (setter)Lamp_setSpotBlend,
- "Lamp spotlight edge softness",
- NULL},
- {"spotSize",
- (getter)Lamp_getSpotSize, (setter)Lamp_setSpotSize,
- "Lamp spotlight beam angle (in degrees)",
- NULL},
- {"type",
- (getter)Lamp_getType, (setter)Lamp_setType,
- "Lamp type",
- NULL},
- {"R",
- (getter)Lamp_getComponent, (setter)Lamp_setComponent,
- "Lamp color red component",
- (void *)EXPP_LAMP_COMP_R},
- {"r",
- (getter)Lamp_getComponent, (setter)Lamp_setComponent,
- "Lamp color red component",
- (void *)EXPP_LAMP_COMP_R},
- {"G",
- (getter)Lamp_getComponent, (setter)Lamp_setComponent,
- "Lamp color green component",
- (void *)EXPP_LAMP_COMP_G},
- {"g",
- (getter)Lamp_getComponent, (setter)Lamp_setComponent,
- "Lamp color green component",
- (void *)EXPP_LAMP_COMP_G},
- {"B",
- (getter)Lamp_getComponent, (setter)Lamp_setComponent,
- "Lamp color blue component",
- (void *)EXPP_LAMP_COMP_B},
- {"b",
- (getter)Lamp_getComponent, (setter)Lamp_setComponent,
- "Lamp color blue component",
- (void *)EXPP_LAMP_COMP_B},
- {"Modes",
- (getter)Lamp_getModesConst, (setter)NULL,
- "Dictionary of values for 'mode' attribute",
- NULL},
- {"Types",
- (getter)Lamp_getTypesConst, (setter)NULL,
- "Dictionary of values for 'type' attribute",
- NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-/*****************************************************************************/
-/* Python TypeLamp callback function prototypes: */
-/*****************************************************************************/
-static void Lamp_dealloc( BPy_Lamp * lamp );
-static int Lamp_compare( BPy_Lamp * a, BPy_Lamp * b );
-static PyObject *Lamp_repr( BPy_Lamp * lamp );
-
-/*****************************************************************************/
-/* Python TypeLamp structure definition: */
-/*****************************************************************************/
-PyTypeObject Lamp_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender Lamp", /* char *tp_name; */
- sizeof( BPy_Lamp ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- ( destructor ) Lamp_dealloc,/* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- ( cmpfunc ) Lamp_compare, /* cmpfunc tp_compare; */
- ( reprfunc ) Lamp_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- NULL, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
- 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, /* 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, /* 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 ***/
- BPy_Lamp_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_Lamp_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-/*****************************************************************************/
-/* Function: M_Lamp_New */
-/* Python equivalent: Blender.Lamp.New */
-/*****************************************************************************/
-static PyObject *M_Lamp_New( PyObject * self, PyObject * args,
- PyObject * keywords )
-{
- char *type_str = "Lamp";
- char *name_str = "Lamp";
- static char *kwlist[] = { "type_str", "name_str", NULL };
- BPy_Lamp *py_lamp; /* for Lamp Data object wrapper in Python */
- Lamp *bl_lamp; /* for actual Lamp Data we create in Blender */
-
- if( !PyArg_ParseTupleAndKeywords( args, keywords, "|ss", kwlist,
- &type_str, &name_str ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected string(s) or empty argument" ) );
-
- bl_lamp = add_lamp( name_str ); /* first create in Blender */
-
- if( bl_lamp ) /* now create the wrapper obj in Python */
- py_lamp = ( BPy_Lamp * ) Lamp_CreatePyObject( bl_lamp );
- else
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't create Lamp Data in Blender" ) );
-
- /* let's return user count to zero, because ... */
- bl_lamp->id.us = 0; /* ... add_lamp() incref'ed it */
-
- if( py_lamp == NULL )
- return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create Lamp Data object" ) );
-
- if( strcmp( type_str, "Lamp" ) == 0 )
- bl_lamp->type = ( short ) EXPP_LAMP_TYPE_LAMP;
- else if( strcmp( type_str, "Sun" ) == 0 )
- bl_lamp->type = ( short ) EXPP_LAMP_TYPE_SUN;
- else if( strcmp( type_str, "Spot" ) == 0 )
- bl_lamp->type = ( short ) EXPP_LAMP_TYPE_SPOT;
- else if( strcmp( type_str, "Hemi" ) == 0 )
- bl_lamp->type = ( short ) EXPP_LAMP_TYPE_HEMI;
- else if( strcmp( type_str, "Area" ) == 0 )
- bl_lamp->type = ( short ) EXPP_LAMP_TYPE_AREA;
- else if( strcmp( type_str, "Photon" ) == 0 )
- bl_lamp->type = ( short ) EXPP_LAMP_TYPE_YF_PHOTON;
- else
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "unknown lamp type" ) );
-
- return ( PyObject * ) py_lamp;
-}
-
-/*****************************************************************************/
-/* Function: M_Lamp_Get */
-/* Python equivalent: Blender.Lamp.Get */
-/* Description: Receives a string and returns the lamp data obj */
-/* whose name matches the string. If no argument is */
-/* passed in, a list of all lamp data names in the */
-/* current scene is returned. */
-/*****************************************************************************/
-static PyObject *M_Lamp_Get( PyObject * self, PyObject * args )
-{
- char *name = NULL;
- Lamp *lamp_iter;
-
- if( !PyArg_ParseTuple( args, "|s", &name ) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument (or nothing)" ) );
-
- lamp_iter = G.main->lamp.first;
-
- if( name ) { /* (name) - Search lamp by name */
-
- BPy_Lamp *wanted_lamp = NULL;
-
- while( ( lamp_iter ) && ( wanted_lamp == NULL ) ) {
-
- if( strcmp( name, lamp_iter->id.name + 2 ) == 0 )
- wanted_lamp =
- ( BPy_Lamp * )
- Lamp_CreatePyObject( lamp_iter );
-
- lamp_iter = lamp_iter->id.next;
- }
-
- if( wanted_lamp == NULL ) { /* Requested lamp doesn't exist */
- char error_msg[64];
- PyOS_snprintf( error_msg, sizeof( error_msg ),
- "Lamp \"%s\" not found", name );
- return ( EXPP_ReturnPyObjError
- ( PyExc_NameError, error_msg ) );
- }
-
- return ( PyObject * ) wanted_lamp;
- }
-
- else { /* () - return a list of all lamps in the scene */
- int index = 0;
- PyObject *lamplist, *pyobj;
-
- lamplist = PyList_New( BLI_countlist( &( G.main->lamp ) ) );
-
- if( lamplist == NULL )
- return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create PyList" ) );
-
- while( lamp_iter ) {
- pyobj = Lamp_CreatePyObject( lamp_iter );
-
- if( !pyobj ) {
- Py_DECREF(lamplist);
- return ( EXPP_ReturnPyObjError
- ( PyExc_MemoryError,
- "couldn't create PyLamp" ) );
- }
-
- PyList_SET_ITEM( lamplist, index, pyobj );
-
- lamp_iter = lamp_iter->id.next;
- index++;
- }
-
- return lamplist;
- }
-}
-
-static PyObject *Lamp_TypesDict( void )
-{ /* create the Blender.Lamp.Types constant dict */
- PyObject *Types = PyConstant_New( );
-
- if( Types ) {
- BPy_constant *c = ( BPy_constant * ) Types;
-
- PyConstant_Insert( c, "Lamp",
- PyInt_FromLong( EXPP_LAMP_TYPE_LAMP ) );
- PyConstant_Insert( c, "Sun",
- PyInt_FromLong( EXPP_LAMP_TYPE_SUN ) );
- PyConstant_Insert( c, "Spot",
- PyInt_FromLong( EXPP_LAMP_TYPE_SPOT ) );
- PyConstant_Insert( c, "Hemi",
- PyInt_FromLong( EXPP_LAMP_TYPE_HEMI ) );
- PyConstant_Insert( c, "Area",
- PyInt_FromLong( EXPP_LAMP_TYPE_AREA ) );
- PyConstant_Insert( c, "Photon",
- PyInt_FromLong( EXPP_LAMP_TYPE_YF_PHOTON ) );
- }
-
- return Types;
-}
-
-static PyObject *Lamp_ModesDict( void )
-{ /* create the Blender.Lamp.Modes constant dict */
- PyObject *Modes = PyConstant_New( );
-
- if( Modes ) {
- BPy_constant *c = ( BPy_constant * ) Modes;
-
- PyConstant_Insert( c, "Shadows",
- PyInt_FromLong( EXPP_LAMP_MODE_SHADOWS ) );
- PyConstant_Insert( c, "Halo",
- PyInt_FromLong( EXPP_LAMP_MODE_HALO ) );
- PyConstant_Insert( c, "Layer",
- PyInt_FromLong( EXPP_LAMP_MODE_LAYER ) );
- PyConstant_Insert( c, "Quad",
- PyInt_FromLong( EXPP_LAMP_MODE_QUAD ) );
- PyConstant_Insert( c, "Negative",
- PyInt_FromLong( EXPP_LAMP_MODE_NEGATIVE ) );
- PyConstant_Insert( c, "Sphere",
- PyInt_FromLong( EXPP_LAMP_MODE_SPHERE ) );
- PyConstant_Insert( c, "Square",
- PyInt_FromLong( EXPP_LAMP_MODE_SQUARE ) );
- PyConstant_Insert( c, "OnlyShadow",
- PyInt_FromLong( EXPP_LAMP_MODE_ONLYSHADOW ) );
- PyConstant_Insert( c, "NoDiffuse",
- PyInt_FromLong( EXPP_LAMP_MODE_NODIFFUSE ) );
- PyConstant_Insert( c, "NoSpecular",
- PyInt_FromLong( EXPP_LAMP_MODE_NOSPECULAR ) );
- PyConstant_Insert( c, "RayShadow",
- PyInt_FromLong( EXPP_LAMP_MODE_SHAD_RAY ) );
- }
-
- return Modes;
-}
-
-/*****************************************************************************/
-/* Function: Lamp_Init */
-/*****************************************************************************/
-/* Needed by the Blender module, to register the Blender.Lamp submodule */
-PyObject *Lamp_Init( void )
-{
- PyObject *submodule, *Types, *Modes;
-
- if( PyType_Ready( &Lamp_Type ) < 0)
- return NULL;
-
- Types = Lamp_TypesDict( );
- Modes = Lamp_ModesDict( );
-
- submodule =
- Py_InitModule3( "Blender.Lamp", M_Lamp_methods, M_Lamp_doc );
-
- if( Types )
- PyModule_AddObject( submodule, "Types", Types );
- if( Modes )
- PyModule_AddObject( submodule, "Modes", Modes );
-
- PyModule_AddIntConstant( submodule, "RGB", IPOKEY_RGB );
- PyModule_AddIntConstant( submodule, "ENERGY", IPOKEY_ENERGY );
- PyModule_AddIntConstant( submodule, "SPOTSIZE", IPOKEY_SPOTSIZE );
- PyModule_AddIntConstant( submodule, "OFFSET", IPOKEY_OFFSET );
- PyModule_AddIntConstant( submodule, "SIZE", IPOKEY_SIZE );
-
- return submodule;
-}
-
-/* Three Python Lamp_Type helper functions needed by the Object module: */
-
-/*****************************************************************************/
-/* Function: Lamp_CreatePyObject */
-/* Description: This function will create a new BPy_Lamp from an existing */
-/* Blender lamp structure. */
-/*****************************************************************************/
-PyObject *Lamp_CreatePyObject( Lamp * lamp )
-{
- BPy_Lamp *pylamp;
- float *rgb[3];
-
- pylamp = ( BPy_Lamp * ) PyObject_NEW( BPy_Lamp, &Lamp_Type );
-
- if( !pylamp )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create BPy_Lamp object" );
-
- pylamp->lamp = lamp;
-
- rgb[0] = &lamp->r;
- rgb[1] = &lamp->g;
- rgb[2] = &lamp->b;
-
- pylamp->color = ( BPy_rgbTuple * ) rgbTuple_New( rgb );
- Py_INCREF(pylamp->color);
-
- return ( PyObject * ) pylamp;
-}
-
-/*****************************************************************************/
-/* Function: Lamp_FromPyObject */
-/* Description: This function returns the Blender lamp from the given */
-/* PyObject. */
-/*****************************************************************************/
-Lamp *Lamp_FromPyObject( PyObject * pyobj )
-{
- return ( ( BPy_Lamp * ) pyobj )->lamp;
-}
-
-/*****************************************************************************/
-/* Python BPy_Lamp methods: */
-/*****************************************************************************/
-
-/* Lamp.__copy__ */
-static PyObject *Lamp_copy( BPy_Lamp * self )
-{
- Lamp *lamp = copy_lamp(self->lamp );
- lamp->id.us = 0;
- return Lamp_CreatePyObject(lamp);
-}
-
-static PyObject *Lamp_getType( BPy_Lamp * self )
-{
- return PyInt_FromLong( self->lamp->type );
-}
-
-static PyObject *Lamp_getMode( BPy_Lamp * self )
-{
- return PyInt_FromLong( self->lamp->mode );
-}
-
-static PyObject *Lamp_getSamples( BPy_Lamp * self )
-{
- return PyInt_FromLong( self->lamp->samp );
-}
-
-static PyObject *Lamp_getRaySamplesX( BPy_Lamp * self )
-{
- return PyInt_FromLong( self->lamp->ray_samp );
-}
-
-static PyObject *Lamp_getRaySamplesY( BPy_Lamp * self )
-{
- return PyInt_FromLong( self->lamp->ray_sampy );
-}
-
-static PyObject *Lamp_getAreaSizeX( BPy_Lamp * self )
-{
- return PyFloat_FromDouble( self->lamp->area_size );
-}
-
-static PyObject *Lamp_getAreaSizeY( BPy_Lamp * self )
-{
- return PyFloat_FromDouble( self->lamp->area_sizey );
-}
-
-static PyObject *Lamp_getBufferSize( BPy_Lamp * self )
-{
- return PyInt_FromLong( self->lamp->bufsize );
-}
-
-static PyObject *Lamp_getHaloStep( BPy_Lamp * self )
-{
- return PyInt_FromLong( self->lamp->shadhalostep );
-}
-
-static PyObject *Lamp_getEnergy( BPy_Lamp * self )
-{
- return PyFloat_FromDouble( self->lamp->energy );
-}
-
-static PyObject *Lamp_getDist( BPy_Lamp * self )
-{
- return PyFloat_FromDouble( self->lamp->dist );
-}
-
-static PyObject *Lamp_getSpotSize( BPy_Lamp * self )
-{
- return PyFloat_FromDouble( self->lamp->spotsize );
-}
-
-static PyObject *Lamp_getSpotBlend( BPy_Lamp * self )
-{
- return PyFloat_FromDouble( self->lamp->spotblend );
-}
-
-static PyObject *Lamp_getClipStart( BPy_Lamp * self )
-{
- return PyFloat_FromDouble( self->lamp->clipsta );
-}
-
-static PyObject *Lamp_getClipEnd( BPy_Lamp * self )
-{
- return PyFloat_FromDouble( self->lamp->clipend );
-}
-
-static PyObject *Lamp_getBias( BPy_Lamp * self )
-{
- return PyFloat_FromDouble( self->lamp->bias );
-}
-
-static PyObject *Lamp_getSoftness( BPy_Lamp * self )
-{
- return PyFloat_FromDouble( self->lamp->soft );
-}
-
-static PyObject *Lamp_getHaloInt( BPy_Lamp * self )
-{
- return PyFloat_FromDouble( self->lamp->haint );
-}
-
-static PyObject *Lamp_getQuad1( BPy_Lamp * self )
-{ /* should we complain if Lamp is not of type Quad? */
- return PyFloat_FromDouble( self->lamp->att1 );
-}
-
-static PyObject *Lamp_getQuad2( BPy_Lamp * self )
-{ /* should we complain if Lamp is not of type Quad? */
- return PyFloat_FromDouble( self->lamp->att2 );
-}
-
-static PyObject *Lamp_getCol( BPy_Lamp * self )
-{
- return rgbTuple_getCol( self->color );
-}
-
-static int Lamp_setType( BPy_Lamp * self, PyObject * value )
-{
- return EXPP_setIValueRange ( value, &self->lamp->type,
- 0, EXPP_LAMP_TYPE_MAX, 'h' );
-}
-
-static int Lamp_setMode( BPy_Lamp * self, PyObject * value )
-{
- short param;
- static short bitmask = EXPP_LAMP_MODE_SHADOWS
- | EXPP_LAMP_MODE_HALO
- | EXPP_LAMP_MODE_LAYER
- | EXPP_LAMP_MODE_QUAD
- | EXPP_LAMP_MODE_NEGATIVE
- | EXPP_LAMP_MODE_ONLYSHADOW
- | EXPP_LAMP_MODE_SPHERE
- | EXPP_LAMP_MODE_SQUARE
- | EXPP_LAMP_MODE_NODIFFUSE
- | EXPP_LAMP_MODE_NOSPECULAR
- | EXPP_LAMP_MODE_SHAD_RAY;
-
- if( !PyInt_Check ( value ) ) {
- char errstr[128];
- sprintf ( errstr , "expected int bitmask of 0x%04x", bitmask );
- return EXPP_ReturnIntError( PyExc_TypeError, errstr );
- }
- param = (short)PyInt_AS_LONG ( value );
-
- if ( ( param & bitmask ) != param )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "invalid bit(s) set in mask" );
-
- self->lamp->mode = param;
-
- return 0;
-}
-
-static int Lamp_setSamples( BPy_Lamp * self, PyObject * value )
-{
- return EXPP_setIValueClamped ( value, &self->lamp->samp,
- EXPP_LAMP_SAMPLES_MIN,
- EXPP_LAMP_SAMPLES_MAX, 'h' );
-}
-
-
-static int Lamp_setRaySamplesX( BPy_Lamp * self, PyObject * value )
-{
- return EXPP_setIValueClamped ( value, &self->lamp->ray_samp,
- EXPP_LAMP_RAYSAMPLES_MIN,
- EXPP_LAMP_RAYSAMPLES_MAX, 'h' );
-}
-
-static int Lamp_setRaySamplesY( BPy_Lamp * self, PyObject * value )
-{
- return EXPP_setIValueClamped ( value, &self->lamp->ray_sampy,
- EXPP_LAMP_RAYSAMPLES_MIN,
- EXPP_LAMP_RAYSAMPLES_MAX, 'h' );
-}
-
-static int Lamp_setAreaSizeX( BPy_Lamp * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->lamp->area_size,
- EXPP_LAMP_AREASIZE_MIN,
- EXPP_LAMP_AREASIZE_MAX );
-}
-
-static int Lamp_setAreaSizeY( BPy_Lamp * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->lamp->area_sizey,
- EXPP_LAMP_AREASIZE_MIN,
- EXPP_LAMP_AREASIZE_MAX );
-}
-
-static int Lamp_setBufferSize( BPy_Lamp * self, PyObject * value )
-{
- return EXPP_setIValueClamped ( value, &self->lamp->bufsize,
- EXPP_LAMP_BUFFERSIZE_MIN,
- EXPP_LAMP_BUFFERSIZE_MAX, 'h' );
-}
-
-static int Lamp_setHaloStep( BPy_Lamp * self, PyObject * value )
-{
- return EXPP_setIValueClamped ( value, &self->lamp->shadhalostep,
- EXPP_LAMP_HALOSTEP_MIN,
- EXPP_LAMP_HALOSTEP_MAX, 'h' );
-}
-
-static int Lamp_setEnergy( BPy_Lamp * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->lamp->energy,
- EXPP_LAMP_ENERGY_MIN,
- EXPP_LAMP_ENERGY_MAX );
-}
-
-static int Lamp_setDist( BPy_Lamp * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->lamp->dist,
- EXPP_LAMP_DIST_MIN,
- EXPP_LAMP_DIST_MAX );
-}
-
-static int Lamp_setSpotSize( BPy_Lamp * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->lamp->spotsize,
- EXPP_LAMP_SPOTSIZE_MIN,
- EXPP_LAMP_SPOTSIZE_MAX );
-}
-
-static int Lamp_setSpotBlend( BPy_Lamp * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->lamp->spotblend,
- EXPP_LAMP_SPOTBLEND_MIN,
- EXPP_LAMP_SPOTBLEND_MAX );
-}
-
-static int Lamp_setClipStart( BPy_Lamp * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->lamp->clipsta,
- EXPP_LAMP_CLIPSTART_MIN,
- EXPP_LAMP_CLIPSTART_MAX );
-}
-
-static int Lamp_setClipEnd( BPy_Lamp * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->lamp->clipend,
- EXPP_LAMP_CLIPEND_MIN,
- EXPP_LAMP_CLIPEND_MAX );
-}
-
-static int Lamp_setBias( BPy_Lamp * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->lamp->bias,
- EXPP_LAMP_BIAS_MIN,
- EXPP_LAMP_BIAS_MAX );
-}
-
-static int Lamp_setSoftness( BPy_Lamp * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->lamp->soft,
- EXPP_LAMP_SOFTNESS_MIN,
- EXPP_LAMP_SOFTNESS_MAX );
-}
-
-static int Lamp_setHaloInt( BPy_Lamp * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->lamp->haint,
- EXPP_LAMP_HALOINT_MIN,
- EXPP_LAMP_HALOINT_MAX );
-}
-
-static int Lamp_setQuad1( BPy_Lamp * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->lamp->att1,
- EXPP_LAMP_QUAD1_MIN,
- EXPP_LAMP_QUAD1_MAX );
-}
-
-static int Lamp_setQuad2( BPy_Lamp * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->lamp->att2,
- EXPP_LAMP_QUAD2_MIN,
- EXPP_LAMP_QUAD2_MAX );
-}
-
-static PyObject *Lamp_getComponent( BPy_Lamp * self, void * closure )
-{
- switch ( (int)closure ) {
- case EXPP_LAMP_COMP_R:
- return PyFloat_FromDouble( self->lamp->r );
- case EXPP_LAMP_COMP_G:
- return PyFloat_FromDouble( self->lamp->g );
- case EXPP_LAMP_COMP_B:
- return PyFloat_FromDouble( self->lamp->b );
- default:
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "unknown color component specified" );
- }
-}
-
-static int Lamp_setComponent( BPy_Lamp * self, PyObject * value,
- void * closure )
-{
- float color;
-
- if( !PyNumber_Check ( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected float argument in [0.0,1.0]" );
-
- color = (float)PyFloat_AsDouble( value );
- color = EXPP_ClampFloat( color, EXPP_LAMP_COL_MIN, EXPP_LAMP_COL_MAX );
-
- switch ( (int)closure ) {
- case EXPP_LAMP_COMP_R:
- self->lamp->r = color;
- return 0;
- case EXPP_LAMP_COMP_G:
- self->lamp->g = color;
- return 0;
- case EXPP_LAMP_COMP_B:
- self->lamp->b = color;
- return 0;
- }
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "unknown color component specified" );
-}
-
-static int Lamp_setCol( BPy_Lamp * self, PyObject * args )
-{
- return rgbTuple_setCol( self->color, args );
-}
-
-/* lamp.addScriptLink */
-static PyObject *Lamp_addScriptLink( BPy_Lamp * self, PyObject * args )
-{
- Lamp *lamp = self->lamp;
- ScriptLink *slink = NULL;
-
- slink = &( lamp )->scriptlink;
-
- return EXPP_addScriptLink( slink, args, 0 );
-}
-
-/* lamp.clearScriptLinks */
-static PyObject *Lamp_clearScriptLinks( BPy_Lamp * self, PyObject * args )
-{
- Lamp *lamp = self->lamp;
- ScriptLink *slink = NULL;
-
- slink = &( lamp )->scriptlink;
-
- return EXPP_clearScriptLinks( slink, args );
-}
-
-/* mat.getScriptLinks */
-static PyObject *Lamp_getScriptLinks( BPy_Lamp * self, PyObject * value )
-{
- Lamp *lamp = self->lamp;
- ScriptLink *slink = NULL;
- PyObject *ret = NULL;
-
- slink = &( lamp )->scriptlink;
-
- ret = EXPP_getScriptLinks( slink, value, 0 );
-
- if( ret )
- return ret;
- else
- return NULL;
-}
-
-/*****************************************************************************/
-/* Function: Lamp_dealloc */
-/* Description: This is a callback function for the BPy_Lamp type. It is */
-/* the destructor function. */
-/*****************************************************************************/
-static void Lamp_dealloc( BPy_Lamp * self )
-{
- Py_DECREF( self->color );
- PyObject_DEL( self );
-}
-
-/*****************************************************************************/
-/* Function: Lamp_compare */
-/* Description: This is a callback function for the BPy_Lamp type. It */
-/* compares two Lamp_Type objects. Only the "==" and "!=" */
-/* comparisons are meaningful. Returns 0 for equality and -1 */
-/* if they don't point to the same Blender Lamp struct. */
-/* In Python it becomes 1 if they are equal, 0 otherwise. */
-/*****************************************************************************/
-static int Lamp_compare( BPy_Lamp * a, BPy_Lamp * b )
-{
- return ( a->lamp == b->lamp ) ? 0 : -1;
-}
-
-/*****************************************************************************/
-/* Function: Lamp_repr */
-/* Description: This is a callback function for the BPy_Lamp type. It */
-/* builds a meaninful string to represent lamp objects. */
-/*****************************************************************************/
-static PyObject *Lamp_repr( BPy_Lamp * self )
-{
- return PyString_FromFormat( "[Lamp \"%s\"]", self->lamp->id.name + 2 );
-}
-
-static PyObject *Lamp_getIpo( BPy_Lamp * self )
-{
- struct Ipo *ipo = self->lamp->ipo;
-
- if( !ipo )
- Py_RETURN_NONE;
-
- return Ipo_CreatePyObject( ipo );
-}
-
-/*
- * this should accept a Py_None argument and just delete the Ipo link
- * (as Lamp_clearIpo() does)
- */
-
-static int Lamp_setIpo( BPy_Lamp * self, PyObject * value )
-{
- return GenericLib_assignData(value, (void **) &self->lamp->ipo, 0, 1, ID_IP, ID_LA);
-}
-
-/*
- * Lamp_insertIpoKey()
- * inserts Lamp IPO key for RGB,ENERGY,SPOTSIZE,OFFSET,SIZE
- */
-
-static PyObject *Lamp_insertIpoKey( BPy_Lamp * self, PyObject * args )
-{
- int key = 0, map;
-
- if( !PyArg_ParseTuple( args, "i", &( key ) ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected int argument" ) );
-
- map = texchannel_to_adrcode(self->lamp->texact);
-
- if (key == IPOKEY_RGB ) {
- insertkey((ID *)self->lamp, ID_LA, NULL, NULL, LA_COL_R, 0);
- insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_COL_G, 0);
- insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_COL_B, 0);
- }
- if (key == IPOKEY_ENERGY ) {
- insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_ENERGY, 0);
- }
- if (key == IPOKEY_SPOTSIZE ) {
- insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_SPOTSI, 0);
- }
- if (key == IPOKEY_OFFSET ) {
- insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_OFS_X, 0);
- insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_OFS_Y, 0);
- insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_OFS_Z, 0);
- }
- if (key == IPOKEY_SIZE ) {
- insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_SIZE_X, 0);
- insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_SIZE_Y, 0);
- insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_SIZE_Z, 0);
- }
-
- allspace(REMAKEIPO, 0);
- EXPP_allqueue(REDRAWIPO, 0);
- EXPP_allqueue(REDRAWVIEW3D, 0);
- EXPP_allqueue(REDRAWACTION, 0);
- EXPP_allqueue(REDRAWNLA, 0);
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Lamp_getModesConst( void )
-{
- return Py_BuildValue
- ( "{s:h,s:h,s:h,s:h,s:h,s:h,s:h,s:h,s:h,s:h,s:h}",
- "Shadows", EXPP_LAMP_MODE_SHADOWS, "Halo",
- EXPP_LAMP_MODE_HALO, "Layer", EXPP_LAMP_MODE_LAYER,
- "Quad", EXPP_LAMP_MODE_QUAD, "Negative",
- EXPP_LAMP_MODE_NEGATIVE, "OnlyShadow",
- EXPP_LAMP_MODE_ONLYSHADOW, "Sphere",
- EXPP_LAMP_MODE_SPHERE, "Square",
- EXPP_LAMP_MODE_SQUARE, "NoDiffuse",
- EXPP_LAMP_MODE_NODIFFUSE, "NoSpecular",
- EXPP_LAMP_MODE_NOSPECULAR, "RayShadow",
- EXPP_LAMP_MODE_SHAD_RAY);
-}
-
-static PyObject *Lamp_getTypesConst( void )
-{
- return Py_BuildValue( "{s:h,s:h,s:h,s:h,s:h,s:h}",
- "Lamp", EXPP_LAMP_TYPE_LAMP,
- "Sun", EXPP_LAMP_TYPE_SUN,
- "Spot", EXPP_LAMP_TYPE_SPOT,
- "Hemi", EXPP_LAMP_TYPE_HEMI,
- "Area", EXPP_LAMP_TYPE_AREA,
- "Photon", EXPP_LAMP_TYPE_YF_PHOTON );
-}
-
-/* #####DEPRECATED###### */
-
-static PyObject *Lamp_oldsetSamples( BPy_Lamp * self, PyObject * args )
-{
- return EXPP_setterWrapper ( (void *)self, args, (setter)Lamp_setSamples );
-}
-
-static PyObject *Lamp_oldsetRaySamplesX( BPy_Lamp * self, PyObject * args )
-{
- return EXPP_setterWrapper ( (void *)self, args, (setter)Lamp_setRaySamplesX );
-}
-
-static PyObject *Lamp_oldsetRaySamplesY( BPy_Lamp * self, PyObject * args )
-{
- return EXPP_setterWrapper ( (void *)self, args, (setter)Lamp_setRaySamplesY );
-}
-
-static PyObject *Lamp_oldsetAreaSizeX( BPy_Lamp * self, PyObject * args )
-{
- return EXPP_setterWrapper ( (void *)self, args, (setter)Lamp_setAreaSizeX );
-}
-
-static PyObject *Lamp_oldsetAreaSizeY( BPy_Lamp * self, PyObject * args )
-{
- return EXPP_setterWrapper ( (void *)self, args, (setter)Lamp_setAreaSizeY );
-}
-
-static PyObject *Lamp_oldsetBufferSize( BPy_Lamp * self, PyObject * args )
-{
- return EXPP_setterWrapper ( (void *)self, args, (setter)Lamp_setBufferSize );
-}
-
-static PyObject *Lamp_oldsetHaloStep( BPy_Lamp * self, PyObject * args )
-{
- return EXPP_setterWrapper ( (void *)self, args, (setter)Lamp_setHaloStep );
-}
-
-static PyObject *Lamp_oldsetEnergy( BPy_Lamp * self, PyObject * args )
-{
- return EXPP_setterWrapper ( (void *)self, args, (setter)Lamp_setEnergy );
-}
-
-static PyObject *Lamp_oldsetDist( BPy_Lamp * self, PyObject * args )
-{
- return EXPP_setterWrapper ( (void *)self, args, (setter)Lamp_setDist );
-}
-
-static PyObject *Lamp_oldsetSpotSize( BPy_Lamp * self, PyObject * args )
-{
- return EXPP_setterWrapper ( (void *)self, args, (setter)Lamp_setSpotSize );
-}
-
-static PyObject *Lamp_oldsetSpotBlend( BPy_Lamp * self, PyObject * args )
-{
- return EXPP_setterWrapper ( (void *)self, args, (setter)Lamp_setSpotBlend );
-}
-
-static PyObject *Lamp_oldsetClipStart( BPy_Lamp * self, PyObject * args )
-{
- return EXPP_setterWrapper ( (void *)self, args, (setter)Lamp_setClipStart );
-}
-
-static PyObject *Lamp_oldsetClipEnd( BPy_Lamp * self, PyObject * args )
-{
- return EXPP_setterWrapper ( (void *)self, args, (setter)Lamp_setClipEnd );
-}
-
-static PyObject *Lamp_oldsetBias( BPy_Lamp * self, PyObject * args )
-{
- return EXPP_setterWrapper ( (void *)self, args, (setter)Lamp_setBias );
-}
-
-static PyObject *Lamp_oldsetSoftness( BPy_Lamp * self, PyObject * args )
-{
- return EXPP_setterWrapper ( (void *)self, args, (setter)Lamp_setSoftness );
-}
-
-static PyObject *Lamp_oldsetHaloInt( BPy_Lamp * self, PyObject * args )
-{
- return EXPP_setterWrapper ( (void *)self, args, (setter)Lamp_setHaloInt );
-}
-
-static PyObject *Lamp_oldsetQuad1( BPy_Lamp * self, PyObject * args )
-{
- return EXPP_setterWrapper ( (void *)self, args, (setter)Lamp_setQuad1 );
-}
-
-static PyObject *Lamp_oldsetQuad2( BPy_Lamp * self, PyObject * args )
-{
- return EXPP_setterWrapper ( (void *)self, args, (setter)Lamp_setQuad2 );
-}
-
-static PyObject *Lamp_oldsetIpo( BPy_Lamp * self, PyObject * args )
-{
- return EXPP_setterWrapper ( (void *)self, args, (setter)Lamp_setIpo );
-}
-
-static PyObject *Lamp_oldsetCol( BPy_Lamp * self, PyObject * args )
-{
- return EXPP_setterWrapper ( (void *)self, args, (setter)Lamp_setCol );
-}
-
-/*
- * the "not-well-behaved" methods which require more processing than
- * just the simple wrapper
- */
-
-/*
- * clearIpo() returns True/False depending on whether lamp has an Ipo
- */
-
-static PyObject *Lamp_clearIpo( BPy_Lamp * self )
-{
- /* if Ipo defined, delete it and return true */
-
- if( self->lamp->ipo ) {
- PyObject *value = Py_BuildValue( "(O)", Py_None );
- EXPP_setterWrapper ( (void *)self, value, (setter)Lamp_setIpo );
- Py_DECREF ( value );
- return EXPP_incr_ret_True();
- }
- return EXPP_incr_ret_False(); /* no ipo found */
-}
-
-/*
- * setType() accepts a string while mode setter takes an integer
- */
-
-static PyObject *Lamp_oldsetType( BPy_Lamp * self, PyObject * value )
-{
- char *type = PyString_AsString(value);
- PyObject *arg, *error;
-
- /* parse string argument */
-
- if( !value )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument" ) );
-
- /* check for valid arguments, set type accordingly */
-
- if( !strcmp( type, "Lamp" ) )
- self->lamp->type = ( short ) EXPP_LAMP_TYPE_LAMP;
- else if( !strcmp( type, "Sun" ) )
- self->lamp->type = ( short ) EXPP_LAMP_TYPE_SUN;
- else if( !strcmp( type, "Spot" ) )
- self->lamp->type = ( short ) EXPP_LAMP_TYPE_SPOT;
- else if( !strcmp( type, "Hemi" ) )
- self->lamp->type = ( short ) EXPP_LAMP_TYPE_HEMI;
- else if( !strcmp( type, "Area" ) )
- self->lamp->type = ( short ) EXPP_LAMP_TYPE_AREA;
- else if( !strcmp( type, "Photon" ) )
- self->lamp->type = ( short ) EXPP_LAMP_TYPE_YF_PHOTON;
- else
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "unknown lamp type" );
-
- /* build tuple, call wrapper */
-
- arg = Py_BuildValue( "(i)", type );
- error = EXPP_setterWrapper ( (void *)self, arg, (setter)Lamp_setType );
- Py_DECREF ( arg );
- return error;
-}
-
-/*
- * setMode() accepts up to ten strings while mode setter takes an integer
- */
-
-static PyObject *Lamp_oldsetMode( BPy_Lamp * self, PyObject * args )
-{
- short i, flag = 0;
- PyObject *error, *value;
- char *name;
-
- /* check that we're passed a tuple of no more than 10 args*/
-
- if ( !PyTuple_Check( args ) || PyTuple_Size( args ) > 10 )
- return EXPP_ReturnPyObjError ( PyExc_AttributeError,
- "expected up to 10 string arguments" );
-
- /* check each argument for type, find its value */
-
- for ( i = (short)PyTuple_Size( args ); i-- ; ) {
- name = PyString_AsString ( PyTuple_GET_ITEM( args, i ) );
- if( !name )
- return EXPP_ReturnPyObjError ( PyExc_AttributeError,
- "expected string argument" );
-
- if( !strcmp( name, "Shadows" ) )
- flag |= ( short ) EXPP_LAMP_MODE_SHADOWS;
- else if( !strcmp( name, "Halo" ) )
- flag |= ( short ) EXPP_LAMP_MODE_HALO;
- else if( !strcmp( name, "Layer" ) )
- flag |= ( short ) EXPP_LAMP_MODE_LAYER;
- else if( !strcmp( name, "Quad" ) )
- flag |= ( short ) EXPP_LAMP_MODE_QUAD;
- else if( !strcmp( name, "Negative" ) )
- flag |= ( short ) EXPP_LAMP_MODE_NEGATIVE;
- else if( !strcmp( name, "OnlyShadow" ) )
- flag |= ( short ) EXPP_LAMP_MODE_ONLYSHADOW;
- else if( !strcmp( name, "Sphere" ) )
- flag |= ( short ) EXPP_LAMP_MODE_SPHERE;
- else if( !strcmp( name, "Square" ) )
- flag |= ( short ) EXPP_LAMP_MODE_SQUARE;
- else if( !strcmp( name, "NoDiffuse" ) )
- flag |= ( short ) EXPP_LAMP_MODE_NODIFFUSE;
- else if( !strcmp( name, "NoSpecular" ) )
- flag |= ( short ) EXPP_LAMP_MODE_NOSPECULAR;
- else if( !strcmp( name, "RayShadow" ) )
- flag |= ( short ) EXPP_LAMP_MODE_SHAD_RAY;
- else
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "unknown lamp flag argument" );
- }
-
- /* build tuple, call wrapper */
-
- value = Py_BuildValue( "(i)", flag );
- error = EXPP_setterWrapper ( (void *)self, value, (setter)Lamp_setMode );
- Py_DECREF ( value );
- return error;
-}
-
diff --git a/source/blender/python/api2_2x/Lattice.c b/source/blender/python/api2_2x/Lattice.c
deleted file mode 100644
index 6a9f3891e52..00000000000
--- a/source/blender/python/api2_2x/Lattice.c
+++ /dev/null
@@ -1,813 +0,0 @@
-/*
- * $Id: Lattice.c 11130 2007-06-30 00:18:10Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Joseph Gilbert
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include "Lattice.h" /*This must come first*/
-
-#include "BKE_utildefines.h"
-#include "BKE_main.h"
-#include "BKE_global.h"
-#include "BKE_library.h"
-#include "BKE_lattice.h"
-#include "BLI_blenlib.h"
-#include "DNA_object_types.h"
-#include "DNA_key_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_scene_types.h"
-#include "BIF_editkey.h"
-#include "BIF_editdeform.h"
-#include "BIF_space.h"
-#include "blendef.h"
-#include "gen_utils.h"
-#include "gen_library.h"
-
-#include "Key.h"
-
-/*****************************************************************************/
-/* Python API function prototypes for the Lattice module. */
-/*****************************************************************************/
-static PyObject *M_Lattice_New( PyObject * self, PyObject * args );
-static PyObject *M_Lattice_Get( PyObject * self, PyObject * args );
-
-/*****************************************************************************/
-/* Lattice Module strings */
-/* The following string definitions are used for documentation strings. */
-/* In Python these will be written to the console when doing a */
-/* Blender.Lattice.__doc__ */
-/*****************************************************************************/
-static char M_Lattice_doc[] = "The Blender Lattice module\n\n";
-
-static char M_Lattice_New_doc[] = "() - return a new Lattice object";
-
-static char M_Lattice_Get_doc[] = "() - get a Lattice from blender";
-
-/*****************************************************************************/
-/* Python method structure definition for Blender.Lattice module: */
-/*****************************************************************************/
-struct PyMethodDef M_Lattice_methods[] = {
- {"New", ( PyCFunction ) M_Lattice_New, METH_VARARGS,
- M_Lattice_New_doc},
- {"Get", ( PyCFunction ) M_Lattice_Get, METH_VARARGS,
- M_Lattice_Get_doc},
- {NULL, NULL, 0, NULL}
-};
-
-
-/*****************************************************************************/
-/* Lattice Strings */
-/* The following string definitions are used for documentation strings. */
-/* In Python these will be written to the console when doing a */
-/* Blender.Lattice.__doc__ */
-/*****************************************************************************/
-static char Lattice_getName_doc[] = "() - Return Lattice Object name";
-
-static char Lattice_setName_doc[] = "(str) - Change Lattice Object name";
-
-static char Lattice_setPartitions_doc[] =
- "(str) - Set the number of Partitions in x,y,z";
-
-static char Lattice_getPartitions_doc[] =
- "(str) - Get the number of Partitions in x,y,z";
-
-static char Lattice_getKey_doc[] =
- "() - Get the Key object attached to this Lattice";
-
-static char Lattice_setKeyTypes_doc[] =
- "(str) - Set the key types for x,y,z dimensions";
-
-static char Lattice_getKeyTypes_doc[] =
- "(str) - Get the key types for x,y,z dimensions";
-
-static char Lattice_setMode_doc[] = "(str) - Make an outside or grid lattice";
-
-static char Lattice_getMode_doc[] = "(str) - Get lattice mode type";
-
-static char Lattice_setPoint_doc[] =
- "(str) - Set the coordinates of a point on the lattice";
-
-static char Lattice_getPoint_doc[] =
- "(str) - Get the coordinates of a point on the lattice";
-
-static char Lattice_insertKey_doc[] =
- "(str) - Set a new key for the lattice at specified frame";
-
-static char Lattice_copy_doc[] =
- "() - Return a copy of the lattice.";
-
-//***************************************************************************
-// Function: Lattice_CreatePyObject
-//***************************************************************************
-PyObject *Lattice_CreatePyObject( Lattice * lt )
-{
- BPy_Lattice *pyLat;
-
- pyLat = ( BPy_Lattice * ) PyObject_NEW( BPy_Lattice, &Lattice_Type );
-
- if( !pyLat )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create BPy_Lattice PyObject" );
-
- pyLat->lattice = lt;
-
- return ( PyObject * ) pyLat;
-}
-
-//***************************************************************************
-// Function: Lattice_FromPyObject
-//***************************************************************************
-
-Lattice *Lattice_FromPyObject( PyObject * pyobj )
-{
- return ( ( BPy_Lattice * ) pyobj )->lattice;
-}
-
-//***************************************************************************
-// Function: M_Lattice_New
-// Python equivalent: Blender.Lattice.New
-//***************************************************************************
-static PyObject *M_Lattice_New( PyObject * self, PyObject * args )
-{
- char *name = NULL;
- Lattice *bl_Lattice; // blender Lattice object
- PyObject *py_Lattice; // python wrapper
-
- if( !PyArg_ParseTuple( args, "|s", &name ) )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected string and int arguments (or nothing)" );
-
- bl_Lattice = add_lattice( "Lattice" );
-
- if( bl_Lattice ) {
- bl_Lattice->id.us = 0;
- py_Lattice = Lattice_CreatePyObject( bl_Lattice );
- } else
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't create Lattice Object in Blender" );
- if( !py_Lattice )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create Lattice Object wrapper" );
-
- if( name )
- rename_id( &bl_Lattice->id, name );
-
- return py_Lattice;
-}
-
-//***************************************************************************
-// Function: M_Lattice_Get
-// Python equivalent: Blender.Lattice.Get
-//***************************************************************************
-static PyObject *M_Lattice_Get( PyObject * self, PyObject * args )
-{
- char *name = NULL;
- Lattice *lat_iter;
-
- if( !PyArg_ParseTuple( args, "|s", &name ) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument (or nothing)" ) );
-
- lat_iter = G.main->latt.first;
-
- if( name ) { /* (name) - Search Lattice by name */
-
- PyObject *wanted_lat = NULL;
-
- while( ( lat_iter ) && ( wanted_lat == NULL ) ) {
- if( strcmp( name, lat_iter->id.name + 2 ) == 0 ) {
- wanted_lat =
- Lattice_CreatePyObject( lat_iter );
- }
-
- lat_iter = lat_iter->id.next;
- }
-
- if( wanted_lat == NULL ) { /* Requested Lattice doesn't exist */
- char error_msg[64];
- PyOS_snprintf( error_msg, sizeof( error_msg ),
- "Lattice \"%s\" not found", name );
- return ( EXPP_ReturnPyObjError
- ( PyExc_NameError, error_msg ) );
- }
-
- return wanted_lat;
- }
-
- else { /* () - return a list of all Lattices in the scene */
- int index = 0;
- PyObject *latlist, *pyobj;
-
- latlist = PyList_New( BLI_countlist( &( G.main->latt ) ) );
-
- if( latlist == NULL )
- return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create PyList" ) );
-
- while( lat_iter ) {
- pyobj = Lattice_CreatePyObject( lat_iter );
-
- if( !pyobj ) {
- Py_DECREF(latlist);
- return ( EXPP_ReturnPyObjError
- ( PyExc_MemoryError,
- "couldn't create PyString" ) );
- }
- PyList_SET_ITEM( latlist, index, pyobj );
-
- lat_iter = lat_iter->id.next;
- index++;
- }
-
- return ( latlist );
- }
-}
-
-//***************************************************************************
-// Function: Lattice_Init
-//***************************************************************************
-PyObject *Lattice_Init( void )
-{
- PyObject *mod;
- PyObject *dict;
-
- if( PyType_Ready( &Lattice_Type ) < 0 )
- return NULL;
-
- mod = Py_InitModule3( "Blender.Lattice", M_Lattice_methods,
- M_Lattice_doc );
-
- dict = PyModule_GetDict( mod );
-
- //Module dictionary
-#define EXPP_ADDCONST(x) EXPP_dict_set_item_str(dict, #x, PyInt_FromLong(LT_##x))
- EXPP_ADDCONST( GRID );
- EXPP_ADDCONST( OUTSIDE );
-
-#undef EXPP_ADDCONST
-#define EXPP_ADDCONST(x) EXPP_dict_set_item_str(dict, #x, PyInt_FromLong(KEY_##x))
- EXPP_ADDCONST( LINEAR );
- EXPP_ADDCONST( CARDINAL );
- EXPP_ADDCONST( BSPLINE );
-
- return ( mod );
-}
-
-static PyObject *Lattice_setPartitions( BPy_Lattice * self, PyObject * args )
-{
- int x = 0;
- int y = 0;
- int z = 0;
- Lattice *bl_Lattice;
-
- if( !PyArg_ParseTuple( args, "iii", &x, &y, &z ) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int,int,int argument" ) );
-
- bl_Lattice = self->lattice;
-
- if( x < 2 || y < 2 || z < 2 )
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "partition values must be 2 or greater" ) );
-
- resizelattice(bl_Lattice, x, y, z, NULL);
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Lattice_getPartitions( BPy_Lattice * self )
-{
- Lattice *bl_Lattice;
- bl_Lattice = self->lattice;
-
- return Py_BuildValue( "[i,i,i]", ( int ) bl_Lattice->pntsu,
- ( int ) bl_Lattice->pntsv,
- ( int ) bl_Lattice->pntsw );
-}
-
-static PyObject *Lattice_getKey( BPy_Lattice * self )
-{
- Key *key = self->lattice->key;
-
- if (key)
- return Key_CreatePyObject(key);
- else
- Py_RETURN_NONE;
-}
-
-static PyObject *Lattice_getKeyTypes( BPy_Lattice * self )
-{
- Lattice *bl_Lattice;
- char *linear = "linear";
- char *cardinal = "cardinal";
- char *bspline = "bspline";
- char *s_x = NULL, *s_y = NULL, *s_z = NULL;
-
- bl_Lattice = self->lattice;
-
- if( ( bl_Lattice->typeu ) == KEY_LINEAR )
- s_x = linear;
- else if( ( bl_Lattice->typeu ) == KEY_CARDINAL )
- s_x = cardinal;
- else if( ( bl_Lattice->typeu ) == KEY_BSPLINE )
- s_x = bspline;
- else
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "bad key type..." );
-
- if( ( bl_Lattice->typev ) == KEY_LINEAR )
- s_y = linear;
- else if( ( bl_Lattice->typev ) == KEY_CARDINAL )
- s_y = cardinal;
- else if( ( bl_Lattice->typev ) == KEY_BSPLINE )
- s_y = bspline;
- else
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "bad key type..." );
-
- if( ( bl_Lattice->typew ) == KEY_LINEAR )
- s_z = linear;
- else if( ( bl_Lattice->typew ) == KEY_CARDINAL )
- s_z = cardinal;
- else if( ( bl_Lattice->typew ) == KEY_BSPLINE )
- s_z = bspline;
- else
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "bad key type..." );
-
- /* we made sure no s_[xyz] is NULL */
- return Py_BuildValue( "[s,s,s]", s_x, s_y, s_z );
-}
-
-static PyObject *Lattice_setKeyTypes( BPy_Lattice * self, PyObject * args )
-{
- int x;
- int y;
- int z;
- Lattice *bl_Lattice;
-
- if( !PyArg_ParseTuple( args, "iii", &x, &y, &z ) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int,int,int argument" ) );
-
- bl_Lattice = self->lattice;
-
- if( x == KEY_LINEAR )
- bl_Lattice->typeu = KEY_LINEAR;
- else if( x == KEY_CARDINAL )
- bl_Lattice->typeu = KEY_CARDINAL;
- else if( x == KEY_BSPLINE )
- bl_Lattice->typeu = KEY_BSPLINE;
- else
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "type must be LINEAR, CARDINAL OR BSPLINE" );
-
- if( y == KEY_LINEAR )
- bl_Lattice->typev = KEY_LINEAR;
- else if( y == KEY_CARDINAL )
- bl_Lattice->typev = KEY_CARDINAL;
- else if( y == KEY_BSPLINE )
- bl_Lattice->typev = KEY_BSPLINE;
- else
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "type must be LINEAR, CARDINAL OR BSPLINE" );
-
- if( z == KEY_LINEAR )
- bl_Lattice->typew = KEY_LINEAR;
- else if( z == KEY_CARDINAL )
- bl_Lattice->typew = KEY_CARDINAL;
- else if( z == KEY_BSPLINE )
- bl_Lattice->typew = KEY_BSPLINE;
- else
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "type must be LINEAR, CARDINAL OR BSPLINE" );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Lattice_setMode( BPy_Lattice * self, PyObject * args )
-{
- short type;
- Lattice *bl_Lattice;
- bl_Lattice = self->lattice;
-
- if( !PyArg_ParseTuple( args, "h", &type ) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int argument" ) );
-
- if( type == LT_GRID )
- bl_Lattice->flag = LT_GRID;
- else if( type == LT_OUTSIDE ) {
- bl_Lattice->flag = LT_OUTSIDE + LT_GRID;
- outside_lattice( bl_Lattice );
- } else
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "type must be either GRID or OUTSIDE" );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Lattice_getMode(BPy_Lattice * self)
-{
- if( self->lattice->flag == 1 )
- return PyString_FromString( "Grid" );
- else if( self->lattice->flag == 3 )
- return PyString_FromString( "Outside" );
- Py_RETURN_NONE;
-}
-
-static PyObject *Lattice_setPoint( BPy_Lattice * self, PyObject * args )
-{
- BPoint *bp, *bpoint;
- short size;
- Lattice *bl_Lattice;
- int index, x;
- float tempInt;
- PyObject *listObject;
-
- if( !PyArg_ParseTuple
- ( args, "iO!", &index, &PyList_Type, &listObject ) )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError, "expected int & list argument" ) );
-
- if( !PyList_Check( listObject ) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "2nd parameter should be a python list" ) );
-
- if( !( PyList_Size( listObject ) == 3 ) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "Please pass 3 parameters in the list [x,y,z]" ) );
-
- //init
- bp = 0;
- bl_Lattice = self->lattice;
-
- //get bpoints
- bp = bl_Lattice->def;
-
- if( bp == 0 )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "no lattice points!" ) );
-
- //calculate size of lattice
- size = bl_Lattice->pntsu * bl_Lattice->pntsv * bl_Lattice->pntsw;
-
- if( index < 0 || index > size )
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "index outside of lattice size!" ) );
-
- //get the bpoint
- while( index ) {
- index--;
- bp++;
- }
- bpoint = bp;
-
- for( x = 0; x < PyList_Size( listObject ); x++ ) {
- if( !
- ( PyArg_Parse
- ( ( PyList_GetItem( listObject, x ) ), "f",
- &tempInt ) ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "python list integer not parseable" );
- bpoint->vec[x] = tempInt;
- }
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Lattice_getPoint( BPy_Lattice * self, PyObject * args )
-{
- BPoint *bp, *bpoint;
- short size;
- Lattice *bl_Lattice;
- int index;
-
- if( !PyArg_ParseTuple( args, "i", &index ) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int argument" ) );
-
- //init
- bp = 0;
- bl_Lattice = self->lattice;
-
- //get bpoints
- bp = bl_Lattice->def;
-
- if( bp == 0 )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "no lattice points!" ) );
-
- //calculate size of lattice
- size = bl_Lattice->pntsu * bl_Lattice->pntsv * bl_Lattice->pntsw;
-
- if( index < 0 || index > size )
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "index outside of lattice size!" ) );
-
- //get the bpoint
- while( index ) {
- index--;
- bp++;
- }
- bpoint = bp;
-
- if( bpoint == 0 )
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "bpoint does not exist" ) );
-
- return Py_BuildValue( "[f,f,f]", bp->vec[0], bp->vec[1], bp->vec[2] );
-}
-
-static PyObject *Lattice_insertKey( BPy_Lattice * self, PyObject * args )
-{
- Lattice *lt;
- int frame = -1, oldfra = -1;
-
- if( !PyArg_ParseTuple( args, "i", &frame ) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int argument" ) );
-
- lt = self->lattice;
-
- //set the current frame
- if( frame > 0 ) {
- frame = EXPP_ClampInt( frame, 1, MAXFRAME );
- oldfra = G.scene->r.cfra;
- G.scene->r.cfra = (int)frame;
- }
-// else just use current frame, then
-// return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
-// "frame value has to be greater than 0"));
-
- //insert a keybock for the lattice (1=relative)
- insert_lattkey( lt , 1);
- allspace(REMAKEIPO, 0);
-
- if( frame > 0 )
- G.scene->r.cfra = (int)oldfra;
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Lattice_copy( BPy_Lattice * self )
-{
- Lattice *bl_Lattice; // blender Lattice object
- PyObject *py_Lattice; // python wrapper
-
- bl_Lattice = copy_lattice( self->lattice );
- bl_Lattice->id.us = 0;
-
- if( bl_Lattice )
- py_Lattice = Lattice_CreatePyObject( bl_Lattice );
- else
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't create Lattice Object in Blender" );
- if( !py_Lattice )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create Lattice Object wrapper" );
-
- return py_Lattice;
-}
-
-static int Lattice_compare( BPy_Lattice * a, BPy_Lattice * b )
-{
- return ( a->lattice == b->lattice ) ? 0 : -1;
-}
-
-
-//***************************************************************************
-// Function: Lattice_repr
-// Description: This is a callback function for the BPy_Lattice type. It
-// builds a meaninful string to represent Lattice objects.
-//***************************************************************************
-static PyObject *Lattice_repr( BPy_Lattice * self )
-{
- if( self->lattice )
- return PyString_FromFormat( "[Lattice \"%s\"]",
- self->lattice->id.name + 2 );
- else
- return PyString_FromString( "[Lattice <deleted>]" );
-}
-
-/*****************************************************************************/
-/* Python BPy_Lattice methods table: */
-/*****************************************************************************/
-static PyMethodDef BPy_Lattice_methods[] = {
- /* name, method, flags, doc */
- {"getName", ( PyCFunction ) GenericLib_getName, METH_NOARGS,
- Lattice_getName_doc},
- {"setName", ( PyCFunction ) GenericLib_setName_with_method, METH_VARARGS,
- Lattice_setName_doc},
- {"setPartitions", ( PyCFunction ) Lattice_setPartitions, METH_VARARGS,
- Lattice_setPartitions_doc},
- {"getPartitions", ( PyCFunction ) Lattice_getPartitions, METH_NOARGS,
- Lattice_getPartitions_doc},
- {"getKey", ( PyCFunction ) Lattice_getKey, METH_NOARGS,
- Lattice_getKey_doc},
- {"setKeyTypes", ( PyCFunction ) Lattice_setKeyTypes, METH_VARARGS,
- Lattice_setKeyTypes_doc},
- {"getKeyTypes", ( PyCFunction ) Lattice_getKeyTypes, METH_NOARGS,
- Lattice_getKeyTypes_doc},
- {"setMode", ( PyCFunction ) Lattice_setMode, METH_VARARGS,
- Lattice_setMode_doc},
- {"getMode", ( PyCFunction ) Lattice_getMode, METH_NOARGS,
- Lattice_getMode_doc},
- {"setPoint", ( PyCFunction ) Lattice_setPoint, METH_VARARGS,
- Lattice_setPoint_doc},
- {"getPoint", ( PyCFunction ) Lattice_getPoint, METH_VARARGS,
- Lattice_getPoint_doc},
- {"insertKey", ( PyCFunction ) Lattice_insertKey, METH_VARARGS,
- Lattice_insertKey_doc},
- {"__copy__", ( PyCFunction ) Lattice_copy, METH_NOARGS,
- Lattice_copy_doc},
- {"copy", ( PyCFunction ) Lattice_copy, METH_NOARGS,
- Lattice_copy_doc},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Python attributes get/set functions: */
-/*****************************************************************************/
-static PyObject *Lattice_getWidth(BPy_Lattice * self)
-{
- return PyInt_FromLong( self->lattice->pntsu );
-}
-static PyObject *Lattice_getHeight(BPy_Lattice * self)
-{
- return PyInt_FromLong( self->lattice->pntsv );
-}
-static PyObject *Lattice_getDepth(BPy_Lattice * self)
-{
- return PyInt_FromLong( self->lattice->pntsw );
-}
-static PyObject *Lattice_getLatSize(BPy_Lattice * self)
-{
- return PyInt_FromLong(
- self->lattice->pntsu * self->lattice->pntsv * self->lattice->pntsw );
-}
-
-
-static PyObject *Lattice_getAxisType(BPy_Lattice * self, void * type)
-{
- char interp_type = 0;
- switch ( (int)type ) {
- case 0:
- interp_type = self->lattice->typeu;
- break;
- case 1:
- interp_type = self->lattice->typev;
- break;
- case 2:
- interp_type = self->lattice->typew;
- break;
- }
-
- switch (interp_type) {
- case 0:
- return PyString_FromString( "Linear" );
- case 1:
- return PyString_FromString( "Cardinal" );
- case 2:
- return PyString_FromString( "Bspline" );
- }
- Py_RETURN_NONE;
-}
-
-/*****************************************************************************/
-/* Python attributes get/set structure: */
-/*****************************************************************************/
-static PyGetSetDef BPy_Lattice_getseters[] = {
- GENERIC_LIB_GETSETATTR,
- {"width", (getter)Lattice_getWidth, (setter)NULL,
- "lattice U subdivision ", NULL},
- {"height", (getter)Lattice_getHeight, (setter)NULL,
- "lattice V subdivision", NULL},
- {"depth", (getter)Lattice_getDepth, (setter)NULL,
- "lattice W subdivision", NULL},
- {"latSize", (getter)Lattice_getLatSize, (setter)NULL,
- "lattice W subdivision", NULL},
-
- {"widthType", (getter)Lattice_getAxisType, NULL,
- "lattice U interpolation type", (void *)0},
- {"heightType", (getter)Lattice_getAxisType, NULL,
- "lattice V interpolation type", (void *)1},
- {"depthType", (getter)Lattice_getAxisType, NULL,
- "lattice W interpolation type", (void *)2},
-
- {"key", (getter)Lattice_getKey, NULL,
- "lattice key", NULL},
- {"mode", (getter)Lattice_getMode, NULL,
- "lattice key", NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-/*****************************************************************************/
-/* Python Lattice_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject Lattice_Type = {
- PyObject_HEAD_INIT( NULL )
- 0, /* ob_size */
- "Blender Lattice", /* tp_name */
- sizeof( BPy_Lattice ), /* tp_basicsize */
- 0, /* tp_itemsize */
- /* methods */
- NULL, /* tp_dealloc */
- 0, /* tp_print */
- NULL, /* tp_getattr */
- NULL, /* tp_setattr */
- ( cmpfunc ) Lattice_compare, /* tp_compare */
- ( reprfunc ) Lattice_repr, /* tp_repr */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- NULL, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
- 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, /* 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, /* 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 ***/
- BPy_Lattice_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_Lattice_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
diff --git a/source/blender/python/api2_2x/Lattice.h b/source/blender/python/api2_2x/Lattice.h
deleted file mode 100644
index dd141f1b8dd..00000000000
--- a/source/blender/python/api2_2x/Lattice.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * $Id: Lattice.h 10269 2007-03-15 01:09:14Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Joseph Gilbert
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_Lattice_H
-#define EXPP_Lattice_H
-
-#include <Python.h>
-#include "DNA_lattice_types.h"
-
-/* The Group PyTypeObject defined in Lattice.c */
-extern PyTypeObject Lattice_Type;
-
-#define BPy_Lattice_Check(v) ((v)->ob_type == &Lattice_Type)
-
-/*****************************************************************************/
-/* Python BPy_Lattice structure definition: */
-/*****************************************************************************/
-typedef struct {
- PyObject_HEAD
- Lattice * lattice; /* libdata must be second */
-} BPy_Lattice;
-
-/*
- * prototypes
- */
-
-PyObject *Lattice_Init( void );
-PyObject *Lattice_CreatePyObject( Lattice * lt );
-Lattice *Lattice_FromPyObject( PyObject * pyobj );
-
-#endif /* EXPP_LATTICE_H */
diff --git a/source/blender/python/api2_2x/Library.c b/source/blender/python/api2_2x/Library.c
deleted file mode 100644
index 412daf24bd2..00000000000
--- a/source/blender/python/api2_2x/Library.c
+++ /dev/null
@@ -1,1192 +0,0 @@
-/**
- * $Id: Library.c 10943 2007-06-16 12:24:41Z campbellbarton $
- *
- * Blender.Library BPython module implementation.
- * This submodule has functions to append data from .blend files.
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano, Campbell Barton, Ken Hughes
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-/************************************************************/
-/* Original library module code */
-/************************************************************/
-
-#include <Python.h>
-
-#include "DNA_curve_types.h"
-#include "DNA_object_types.h"
-#include "DNA_space_types.h" /* for line linked */
-#include "BKE_library.h" /* for all_local */
-#include "BKE_font.h" /* for text_to_curve */
-#include "BKE_utildefines.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BLI_blenlib.h"
-#include "BLO_readfile.h"
-#include "BLI_linklist.h"
-#include "MEM_guardedalloc.h"
-#include "gen_utils.h"
-
-/**
- * Global variables.
- */
-static BlendHandle *bpy_openlib = NULL; /* ptr to the open .blend file */
-static char *bpy_openlibname = NULL; /* its pathname */
-static int bpy_relative= 0;
-
-/**
- * Function prototypes for the Library submodule.
- */
-static PyObject *M_Library_Open( PyObject * self, PyObject * args );
-static PyObject *M_Library_Close( PyObject * self );
-static PyObject *M_Library_GetName( PyObject * self );
-static PyObject *M_Library_Update( PyObject * self );
-static PyObject *M_Library_Datablocks( PyObject * self, PyObject * value );
-static PyObject *oldM_Library_Load( PyObject * self, PyObject * args );
-static PyObject *M_Library_LinkableGroups( PyObject * self );
-static PyObject *M_Library_LinkedLibs( PyObject * self );
-
-PyObject *Library_Init( void );
-void EXPP_Library_Close( void );
-
-/**
- * Module doc strings.
- */
-static char M_Library_doc[] = "The Blender.Library submodule:\n\n\
-This module gives access to .blend files, using them as libraries of\n\
-data that can be loaded into the current scene in Blender.";
-
-static char Library_Open_doc[] =
- "(filename) - Open the given .blend file for access to its objects.\n\
-If another library file is still open, it's closed automatically.";
-
-static char Library_Close_doc[] =
- "() - Close the currently open library file, if any.";
-
-static char Library_GetName_doc[] =
- "() - Get the filename of the currently open library file, if any.";
-
-static char Library_Datablocks_doc[] =
- "(datablock) - List all datablocks of the given type in the currently\n\
-open library file.\n\
-(datablock) - datablock name as a string: Object, Mesh, etc.";
-
-static char Library_Load_doc[] =
- "(name, datablock [,update = 1]) - Append object 'name' of type 'datablock'\n\
-from the open library file to the current scene.\n\
-(name) - (str) the name of the object.\n\
-(datablock) - (str) the datablock of the object.\n\
-(update = 1) - (int) if non-zero, all display lists are recalculated and the\n\
-links are updated. This is slow, set it to zero if you have more than one\n\
-object to load, then call Library.Update() after loading them all.";
-
-static char Library_Update_doc[] =
- "() - Update the current scene, linking all loaded library objects and\n\
-remaking all display lists. This is slow, call it only once after loading\n\
-all objects (load each of them with update = 0:\n\
-Library.Load(name, datablock, 0), or the update will be automatic, repeated\n\
-for each loaded object.";
-
-static char Library_LinkableGroups_doc[] =
- "() - Get all linkable groups from the open .blend library file.";
-
-static char Library_LinkedLibs_doc[] =
- "() - Get all libs used in the the open .blend file.";
-
-/**
- * Python method structure definition for Blender.Library submodule.
- */
-struct PyMethodDef oldM_Library_methods[] = {
- {"Open", M_Library_Open, METH_O, Library_Open_doc},
- {"Close", ( PyCFunction ) M_Library_Close, METH_NOARGS,
- Library_Close_doc},
- {"GetName", ( PyCFunction ) M_Library_GetName, METH_NOARGS,
- Library_GetName_doc},
- {"Update", ( PyCFunction ) M_Library_Update, METH_NOARGS,
- Library_Update_doc},
- {"Datablocks", M_Library_Datablocks, METH_O,
- Library_Datablocks_doc},
- {"Load", oldM_Library_Load, METH_VARARGS, Library_Load_doc},
- {"LinkableGroups", ( PyCFunction ) M_Library_LinkableGroups,
- METH_NOARGS, Library_LinkableGroups_doc},
- {"LinkedLibs", ( PyCFunction ) M_Library_LinkedLibs,
- METH_NOARGS, Library_LinkedLibs_doc},
- {NULL, NULL, 0, NULL}
-};
-
-/* Submodule Python functions: */
-
-/**
- * Open a new .blend file.
- * Only one can be open at a time, so this function also closes
- * the previously opened file, if any.
- */
-static PyObject *M_Library_Open( PyObject * self, PyObject * value )
-{
- char *fname = PyString_AsString(value);
- char filename[FILE_MAXDIR+FILE_MAXFILE];
- char fname1[FILE_MAXDIR+FILE_MAXFILE];
-
- int len = 0;
-
- bpy_relative= 0; /* assume non relative each time we load */
-
- if( !fname ) {
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a .blend filename" );
- }
-
- if( bpy_openlib ) {
- M_Library_Close( self );
- Py_DECREF( Py_None ); /* incref'ed by above function */
- }
-
- /* copy the name to make it absolute so BLO_blendhandle_from_file doesn't complain */
- BLI_strncpy(fname1, fname, sizeof(fname1));
- BLI_convertstringcode(fname1, G.sce, 0); /* make absolute */
-
- /* G.sce = last file loaded, save for UI and restore after opening file */
- BLI_strncpy(filename, G.sce, sizeof(filename));
- bpy_openlib = BLO_blendhandle_from_file( fname1 );
- BLI_strncpy(G.sce, filename, sizeof(filename));
-
- if( !bpy_openlib )
- return EXPP_ReturnPyObjError( PyExc_IOError, "file not found" );
-
- /* "//someblend.blend" enables relative paths */
- if (sizeof(fname) > 2 && fname[0] == '/' && fname[1] == '/')
- bpy_relative= 1; /* global that makes the library relative on loading */
-
- len = strlen( fname1 ) + 1; /* +1 for terminating '\0' */
-
- bpy_openlibname = MEM_mallocN( len, "bpy_openlibname" );
-
- if( bpy_openlibname )
- PyOS_snprintf( bpy_openlibname, len, "%s", fname1 );
-
- Py_RETURN_TRUE;
-}
-
-/**
- * Close the current .blend file, if any.
- */
-static PyObject *M_Library_Close( PyObject * self )
-{
- if( bpy_openlib ) {
- BLO_blendhandle_close( bpy_openlib );
- bpy_openlib = NULL;
- }
-
- if( bpy_openlibname ) {
- MEM_freeN( bpy_openlibname );
- bpy_openlibname = NULL;
- }
-
- Py_RETURN_NONE;
-}
-
-/**
- * helper function for 'atexit' clean-ups, used by BPY_end_python,
- * declared in EXPP_interface.h.
- */
-void EXPP_Library_Close( void )
-{
- if( bpy_openlib ) {
- BLO_blendhandle_close( bpy_openlib );
- bpy_openlib = NULL;
- }
-
- if( bpy_openlibname ) {
- MEM_freeN( bpy_openlibname );
- bpy_openlibname = NULL;
- }
-}
-
-/**
- * Get the filename of the currently open library file, if any.
- */
-static PyObject *M_Library_GetName( PyObject * self )
-{
- if( bpy_openlib && bpy_openlibname )
- return Py_BuildValue( "s", bpy_openlibname );
-
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-/**
- * Return a list with all items of a given datablock type
- * (like 'Object', 'Mesh', etc.) in the open library file.
- */
-static PyObject *M_Library_Datablocks( PyObject * self, PyObject * value )
-{
- char *name = PyString_AsString(value);
- int blocktype = 0;
- LinkNode *l = NULL, *names = NULL;
- PyObject *list = NULL;
-
- if( !bpy_openlib ) {
- return EXPP_ReturnPyObjError( PyExc_IOError,
- "no library file: open one first with Blender.Lib_Open(filename)" );
- }
-
- if( !name ) {
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a string (datablock type) as argument." );
- }
-
- blocktype = ( int ) BLO_idcode_from_name( name );
-
- if( !blocktype ) {
- return EXPP_ReturnPyObjError( PyExc_NameError,
- "no such Blender datablock type" );
- }
-
- names = BLO_blendhandle_get_datablock_names( bpy_openlib, blocktype );
-
- if( names ) {
- int counter = 0;
- list = PyList_New( BLI_linklist_length( names ) );
- for( l = names; l; l = l->next ) {
- PyList_SET_ITEM( list, counter,
- PyString_FromString( ( char * ) l->link ) );
- counter++;
- }
- BLI_linklist_free( names, free ); /* free linklist *and* each node's data */
- return list;
- }
-
- Py_RETURN_NONE;
-}
-
-/**
- * Return a list with the names of all linkable groups in the
- * open library file.
- */
-static PyObject *M_Library_LinkableGroups( PyObject * self )
-{
- LinkNode *l = NULL, *names = NULL;
- PyObject *list = NULL;
-
- if( !bpy_openlib ) {
- return EXPP_ReturnPyObjError( PyExc_IOError,
- "no library file: open one first with Blender.Lib_Open(filename)" );
- }
-
- names = BLO_blendhandle_get_linkable_groups( bpy_openlib );
- list = PyList_New( BLI_linklist_length( names ) );
-
- if( names ) {
- int counter = 0;
-
- for( l = names; l; l = l->next ) {
- PyList_SET_ITEM( list, counter, PyString_FromString( ( char * ) l->link ) );
- counter++;
- }
- BLI_linklist_free( names, free ); /* free linklist *and* each node's data */
- return list;
- }
- return list;
-}
-
-/**
- * Return a list with the names of all externally linked libs used in the current Blend file
- */
-static PyObject *M_Library_LinkedLibs( PyObject * self )
-{
- int counter = 0;
- Library *li;
- PyObject *list;
-
- list = PyList_New( BLI_countlist( &( G.main->library ) ) );
- for (li= G.main->library.first; li; li= li->id.next) {
- PyList_SET_ITEM( list, counter, PyString_FromString( li->name ));
- counter++;
- }
- return list;
-}
-
-/**
- * Load (append) a given datablock of a given datablock type
- * to the current scene.
- */
-static PyObject *oldM_Library_Load( PyObject * self, PyObject * args )
-{
- char *name = NULL;
- char *base = NULL;
- int update = 1;
- int blocktype = 0;
- int linked = 0;
-
- if( !bpy_openlib ) {
- return EXPP_ReturnPyObjError( PyExc_IOError,
- "no library file: you need to open one, first." );
- }
-
- if( !PyArg_ParseTuple( args, "ss|ii", &name, &base, &update, &linked ) ) {
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected two strings as arguments." );
- }
-
- blocktype = ( int ) BLO_idcode_from_name( base );
-
- if( !blocktype )
- return EXPP_ReturnPyObjError( PyExc_NameError,
- "no such Blender datablock type" );
-
- if (linked)
- BLO_script_library_append( bpy_openlib, bpy_openlibname, name, blocktype, FILE_LINK, G.scene);
- else
- BLO_script_library_append( bpy_openlib, bpy_openlibname, name, blocktype, 0, G.scene);
-
- if( update ) {
- M_Library_Update( self );
- Py_DECREF( Py_None ); /* incref'ed by above function */
- }
-
- if( bpy_relative ) {
- /* and now find the latest append lib file */
- Library *lib = G.main->library.first;
- while( lib ) {
- if( strcmp( bpy_openlibname, lib->name ) == 0 ) {
-
- /* use the full path, this could have been read by other library even */
- BLI_strncpy(lib->name, lib->filename, sizeof(lib->name));
-
- /* uses current .blend file as reference */
- BLI_makestringcode(G.sce, lib->name);
- break;
- }
- lib = lib->id.next;
- }
-
- }
-
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-/**
- * Update all links and remake displists.
- */
-static PyObject *M_Library_Update( PyObject * self )
-{ /* code adapted from do_library_append in src/filesel.c: */
- Library *lib = NULL;
-
- /* Displist code that was here is obsolete... depending on what
- * this function is supposed to do (it should technically be unnecessary)
- * can be replaced with depgraph calls - zr
- */
-
- if( bpy_openlibname ) {
- strcpy( G.lib, bpy_openlibname );
-
- /* and now find the latest append lib file */
- lib = G.main->library.first;
- while( lib ) {
- if( strcmp( bpy_openlibname, lib->name ) == 0 )
- break;
- lib = lib->id.next;
- }
- all_local( lib, 0 );
- }
-
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-/**
- * Initialize the Blender.Library submodule.
- * Called by Blender_Init in Blender.c .
- * @return the registered submodule.
- */
-PyObject *oldLibrary_Init( void )
-{
- PyObject *submod;
-
- submod = Py_InitModule3( "Blender.Library", oldM_Library_methods,
- M_Library_doc );
-
- return submod;
-}
-
-/************************************************************/
-/* New library (LibData) module code */
-/************************************************************/
-
-#include "Library.h"
-
-/* if this module supercedes the old library module, include these instead */
-#if 0
-#include "BLI_blenlib.h"
-#include "MEM_guardedalloc.h"
-
-#include "DNA_curve_types.h"
-#include "DNA_object_types.h"
-#include "DNA_space_types.h" /* for line linked */
-#include "BKE_library.h" /* for all_local */
-#include "BKE_utildefines.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BLO_readfile.h"
-#include "BLI_linklist.h"
-
-#include "Object.h"
-#include "gen_utils.h"
-#endif
-
-#include "gen_library.h"
-
-/* Helper function */
-
-/*
- * Try to open a library, set Python exceptions as necessary if not
- * successful. On success, return a valid handle; othewise return NULL.
- */
-
-static BlendHandle *open_library( char *filename, char *longFilename )
-{
- char globalFilename[FILE_MAX];
- BlendHandle *openlib = NULL;
-
- /* get complete file name if necessary */
- BLI_strncpy( longFilename, filename, FILE_MAX );
- BLI_convertstringcode( longFilename, G.sce, 0 );
-
- /* throw exceptions for wrong file type, cyclic reference */
- if( !BLO_has_bfile_extension(longFilename) ) {
- PyErr_SetString( PyExc_ValueError, "file not a library" );
- return NULL;
- }
- if( BLI_streq(G.main->name, longFilename) ) {
- PyErr_SetString( PyExc_ValueError,
- "cannot use current file as library" );
- return NULL;
- }
-
- /* G.sce = last file loaded, save for UI and restore after opening file */
- BLI_strncpy(globalFilename, G.sce, sizeof(globalFilename));
- openlib = BLO_blendhandle_from_file( longFilename );
- BLI_strncpy(G.sce, globalFilename, sizeof(globalFilename));
-
- /* if failed, set that exception code too */
- if( !openlib )
- PyErr_SetString( PyExc_IOError, "library not found" );
-
- return openlib;
-}
-
-/*
- * Create a specific type of LibraryData object. These are used for
- * .append() and .link() access, for iterators, and (for Blender Objects)
- * for defining "pseudo objects" for scene linking.
- */
-
-static PyObject *CreatePyObject_LibData( int idtype, int kind,
- void *name, void *iter, char *filename )
-{
- BPy_LibraryData *seq = PyObject_NEW( BPy_LibraryData, &LibraryData_Type);
- seq->iter = iter; /* the name list (for iterators) */
- seq->type = idtype; /* the Blender ID type */
- seq->kind = kind; /* used by Blender Objects */
- seq->name = name; /* object name, iterator name list, or NULL */
- /* save the library name */
- BLI_strncpy( seq->filename, filename, strlen(filename)+1 );
- return (PyObject *)seq;
-}
-
-/*
- * Link/append data to the current .blend file, or create a pseudo object
- * which can be linked/appended to a scene.
- */
-
-static PyObject *lib_link_or_append( BPy_LibraryData *self, PyObject * value,
- int mode )
-{
- char *name = PyString_AsString(value);
-
- /* get the name of the data used wants to append */
- if( !name )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a string" );
-
- /*
- * For everything except objects, just add to Blender's DB. For objects,
- * create an APPEND or LINK "pseudo object" for the Scene module.
- */
- if( self->type != ID_OB )
- return LibraryData_importLibData( self, name, 0, NULL );
- else {
- /*
- * If this is already a pseudo object, throw an exception: re-linking
- * or re-appending is not allowed
- */
- if( self->kind != OTHER )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "object has already been marked for append or link" );
-
- /* otherwise, create a pseudo object ready for appending or linking */
-
- return CreatePyObject_LibData( ID_OB, mode,
- BLI_strdupn( name, strlen( name ) ), NULL, self->filename );
- }
-}
-
-/*
- * Perform the actual link or append operation. This procedure is also
- * called externally from the Scene module using a "pseudo Object" so we
- * can be sure objects get linked to a scene.
- */
-
-PyObject *LibraryData_importLibData( BPy_LibraryData *self, char *name,
- int mode, Scene *scene )
-{
- char longFilename[FILE_MAX];
- BlendHandle *openlib;
- Library *lib;
- LinkNode *names, *ptr;
- ID *id;
- ListBase *lb;
- char newName[32];
-
- /* try to open the library */
- openlib = open_library( self->filename, longFilename );
- if( !openlib )
- return NULL;
-
- /* find all datablocks for the specified type */
- names = BLO_blendhandle_get_datablock_names ( openlib, self->type );
-
- /* now check for a match to the user-specified name */
- for( ptr = names; ptr; ptr = ptr->next )
- if( strcmp( ptr->link, name ) == 0 ) break;
- BLI_linklist_free( names, free );
-
- /* if no match, throw exception */
- if( !ptr ) {
- BLO_blendhandle_close( openlib );
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "library does not contain specified item" );
- }
-
- /*
- * Figure out what the datablock will be named after it's imported. If
- * it's a link, nothing to do. If it's an append, find what it might
- * be renamed to.
- */
-
- if( mode != FILE_LINK ) {
- flag_all_listbases_ids(LIB_APPEND_TAG, 1);
-
- /* see what new block will be called */
- strncpy( newName, name, strlen(name)+1 );
- check_for_dupid( wich_libbase(G.main, self->type), NULL, newName );
- }
-
- /* import from the libary */
- BLO_script_library_append( openlib, longFilename, name, self->type, mode,
- scene );
-
- /*
- * locate the library. If this is an append, make the data local. If it
- * is link, we need the library for later
- */
- for( lib = G.main->library.first; lib; lib = lib->id.next )
- if( strcmp( longFilename, lib->name ) == 0 ) {
- if( mode != FILE_LINK ) {
- all_local( lib, 1 );
- /* important we unset, otherwise these object wont
- * link into other scenes from this blend file */
- flag_all_listbases_ids(LIB_APPEND_TAG, 0);
- }
- break;
- }
-
- /* done with library; close it */
- BLO_blendhandle_close( openlib );
-
- /* this should not happen, but just in case */
- if( !lib )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "could not library" );
-
- /* find the base for this type */
- lb = wich_libbase( G.main, self->type );
-
- /*
- * Check for linked data matching the name first. Even if we are trying
- * to append, if the data has already been linked we need to return it
- * (it won't be appended from the library).
- */
- for( id = lb->first; id; id = id->next ) {
- if( id->lib == lib && id->name[2]==name[0] &&
- strcmp(id->name+2, name)==0 )
- return GetPyObjectFromID( id );
- }
-
- /*
- * If we didn't find it, and we're appending, then try searching for the
- * new datablock, possibly under a new name.
- */
- if( mode != FILE_LINK )
- for( id = lb->first; id; id = id->next ) {
- if( id->lib == NULL && id->name[2]==newName[0] &&
- strcmp(id->name+2, newName)==0 )
- return GetPyObjectFromID( id );
- }
-
- /* if we get here, something's really wrong */
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "could not find data after reading from library" );
-}
-
-/************************************************************
- * Python LibraryData_Type getseters
- ************************************************************/
-
-/* .append(): make a local copy of the library's data (except for objects) */
-
-static PyObject *LibraryData_getAppend( BPy_LibraryData *self, PyObject * value)
-{
- return lib_link_or_append( self, value, OBJECT_IS_APPEND );
-}
-
-/* .link(): make a link to the library's data (except for objects) */
-
-static PyObject *LibraryData_getLink( BPy_LibraryData *self, PyObject * value)
-{
- return lib_link_or_append( self, value, OBJECT_IS_LINK );
-}
-
-/************************************************************************
- * Python LibraryData_Type iterator
- ************************************************************************/
-
-/* Create and initialize the interator indices */
-
-static PyObject *LibraryData_getIter( BPy_LibraryData * self )
-{
- char longFilename[FILE_MAX];
- BlendHandle *openlib;
- LinkNode *names;
-
- /* try to open library */
- openlib = open_library( self->filename, longFilename );
-
- /* if failed, return exception */
- if( !openlib )
- return NULL;
-
- /* find all datablocks for the specified type */
- names = BLO_blendhandle_get_datablock_names ( openlib, self->type );
-
- /* close library*/
- BLO_blendhandle_close( openlib );
-
- /* build an iterator object for the name list */
- return CreatePyObject_LibData( self->type, OTHER, names,
- names, self->filename );
-}
-
-/* Return next name. */
-
-static PyObject *LibraryData_nextIter( BPy_LibraryData * self )
-{
- LinkNode *ptr = (LinkNode *)self->iter;
- PyObject *ob;
-
- /* if at the end of list, clean up */
- if( !ptr ) {
- /* If name list is still allocated, free storage. This check is
- * necessary since iter.next() can technically be called repeatedly */
- if( self->name ) {
- BLI_linklist_free( (LinkNode *)self->name, free );
- self->name = NULL;
- }
- return EXPP_ReturnPyObjError( PyExc_StopIteration,
- "iterator at end" );
- }
-
- /* otherwise, return the next name in the list */
- ob = PyString_FromString( ptr->link );
- ptr = ptr->next;
- self->iter = ptr;
- return ob;
-}
-
-/************************************************************************
- * Python LibraryData_type methods structure
- ************************************************************************/
-
-static struct PyMethodDef BPy_LibraryData_methods[] = {
- {"append", (PyCFunction)LibraryData_getAppend, METH_O,
- "(str) - create new data from library"},
- {"link", (PyCFunction)LibraryData_getLink, METH_O,
- "(str) - link data from library"},
- {NULL, NULL, 0, NULL}
-};
-
-/* Deallocate object and its data */
-
-static void LibraryData_dealloc( BPy_LibraryData * self )
-{
- if( self->name )
- MEM_freeN( self->name );
-
- PyObject_DEL( self );
-}
-
-/* Display representation of what Library Data is wrapping */
-
-static PyObject *LibraryData_repr( BPy_LibraryData * self )
-{
- char *linkstate = "";
- char *str;
-
- switch (self->type) {
- case ID_OB:
- /* objects can be lib data or pseudo objects */
- switch( self->kind ) {
- case OBJECT_IS_APPEND :
- linkstate = ", appended";
- break;
- case OBJECT_IS_LINK :
- linkstate = ", linked";
- break;
- default:
- break;
- }
- str = "Object";
- break;
- case ID_SCE:
- str = "Scene";
- break;
- case ID_ME:
- str = "Mesh";
- break;
- case ID_CU:
- str = "Curve";
- break;
- case ID_MB:
- str = "Metaball";
- break;
- case ID_MA:
- str = "Material";
- break;
- case ID_TE:
- str = "Texture";
- break;
- case ID_IM:
- str = "Image";
- break;
- case ID_LT:
- str = "Lattice";
- break;
- case ID_LA:
- str = "Lamp";
- break;
- case ID_CA:
- str = "Camera";
- break;
- case ID_IP:
- str = "Ipo";
- break;
- case ID_WO:
- str = "World";
- break;
- case ID_VF:
- str = "Font";
- break;
- case ID_TXT:
- str = "Text";
- break;
- case ID_SO:
- str = "Sound";
- break;
- case ID_GR:
- str = "Group";
- break;
- case ID_AR:
- str = "Armature";
- break;
- case ID_AC:
- str = "Action";
- break;
- default:
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "unsupported ID type" );
- }
-
- return PyString_FromFormat( "[Library Data (%s%s)]", str, linkstate );
-}
-
-PyTypeObject LibraryData_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender LibData", /* char *tp_name; */
- sizeof( BPy_LibraryData ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- ( destructor ) LibraryData_dealloc,/* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- ( cmpfunc ) NULL, /* cmpfunc tp_compare; */
- ( reprfunc ) LibraryData_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- 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; */
- 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, /* 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, /* richcmpfunc tp_richcompare; */
-
- /*** weak reference enabler ***/
- 0, /* long tp_weaklistoffset; */
-
- /*** Added in release 2.2 ***/
- /* Iterators */
- (getiterfunc)LibraryData_getIter, /* getiterfunc tp_iter; */
- (iternextfunc)LibraryData_nextIter, /* iternextfunc tp_iternext; */
-
- /*** Attribute descriptor and subclassing stuff ***/
- BPy_LibraryData_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- NULL, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-/*
- * Create a LibraryData object for a specific type of Blender Group (ID_OB,
- * ID_MA, etc). These can then be used to link or append the data.
- */
-
-static PyObject *LibraryData_CreatePyObject( BPy_Library *self, void *mode )
-{
- return CreatePyObject_LibData( (int)mode, OTHER, NULL, NULL,
- self->filename );
-}
-
-/************************************************************
- * Python Library_Type getseters
- ************************************************************/
-
-/*
- * Return the library's filename.
- */
-
-static PyObject *Library_getFilename( BPy_Library * self )
-{
- return PyString_FromString( self->filename );
-}
-
-/*
- * Set/change the library's filename.
- */
-
-static int Library_setFilename( BPy_Library * self, PyObject * args )
-{
- char *filename = PyString_AsString( args );
- if( !filename )
- return EXPP_ReturnIntError( PyExc_TypeError, "expected a string" );
-
- BLI_strncpy( self->filename, filename, sizeof(self->filename) );
- return 0;
-}
-
-/************************************************************************
- * Python Library_type attributes get/set structure
- ************************************************************************/
-
-static PyGetSetDef Library_getseters[] = {
- {"filename",
- (getter)Library_getFilename, (setter)Library_setFilename,
- "library filename",
- NULL},
- {"objects",
- (getter)LibraryData_CreatePyObject, (setter)NULL,
- "objects from the library",
- (void *)ID_OB},
- {"scenes",
- (getter)LibraryData_CreatePyObject, (setter)NULL,
- "scenes from the library",
- (void *)ID_SCE},
- {"meshes",
- (getter)LibraryData_CreatePyObject, (setter)NULL,
- "meshes from the library",
- (void *)ID_ME},
- {"curves",
- (getter)LibraryData_CreatePyObject, (setter)NULL,
- "curves from the library",
- (void *)ID_CU},
- {"metaballs",
- (getter)LibraryData_CreatePyObject, (setter)NULL,
- "metaballs from the library",
- (void *)ID_MB},
- {"lattices",
- (getter)LibraryData_CreatePyObject, (setter)NULL,
- "lattices from the library",
- (void *)ID_LT},
- {"lamps",
- (getter)LibraryData_CreatePyObject, (setter)NULL,
- "lamps from the library",
- (void *)ID_LA},
- {"cameras",
- (getter)LibraryData_CreatePyObject, (setter)NULL,
- "cameras from the library",
- (void *)ID_CA},
- {"materials",
- (getter)LibraryData_CreatePyObject, (setter)NULL,
- "objects from the library",
- (void *)ID_MA},
- {"textures",
- (getter)LibraryData_CreatePyObject, (setter)NULL,
- "textures from the library",
- (void *)ID_TE},
- {"images",
- (getter)LibraryData_CreatePyObject, (setter)NULL,
- "images from the library",
- (void *)ID_IM},
- {"ipos",
- (getter)LibraryData_CreatePyObject, (setter)NULL,
- "ipos from the library",
- (void *)ID_IP},
- {"worlds",
- (getter)LibraryData_CreatePyObject, (setter)NULL,
- "worlds from the library",
- (void *)ID_WO},
- {"fonts",
- (getter)LibraryData_CreatePyObject, (setter)NULL,
- "fonts from the library",
- (void *)ID_VF},
- {"texts",
- (getter)LibraryData_CreatePyObject, (setter)NULL,
- "texts from the library",
- (void *)ID_TXT},
- {"groups",
- (getter)LibraryData_CreatePyObject, (setter)NULL,
- "groups from the library",
- (void *)ID_GR},
- {"sounds",
- (getter)LibraryData_CreatePyObject, (setter)NULL,
- "sounds from the library",
- (void *)ID_SO},
- {"actions",
- (getter)LibraryData_CreatePyObject, (setter)NULL,
- "actions from the library",
- (void *)ID_AC},
- {"armatures",
- (getter)LibraryData_CreatePyObject, (setter)NULL,
- "armatures from the library",
- (void *)ID_AR},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-/*
- * Define a new library and create a library object. We don't actually test
- * if the library is valid here since we have to do it when the file is
- * actually accessed later.
- */
-
-static PyObject *M_Library_Load(PyObject *self, PyObject * value)
-{
- char *filename = PyString_AsString(value);
- BPy_Library *lib;
-
- if( !filename )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a string" );
-
- /* try to create a new object */
- lib = (BPy_Library *)PyObject_NEW( BPy_Library, &Library_Type );
- if( !lib )
- return NULL;
-
- /* assign the library filename for future use, then return */
- BLI_strncpy( lib->filename, filename, sizeof(lib->filename) );
-
- return (PyObject *)lib;
-}
-
-static struct PyMethodDef M_Library_methods[] = {
- {"load", (PyCFunction)M_Library_Load, METH_O,
- "(string) - declare a .blend file for use as a library"},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Python Library_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject Library_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender Library", /* char *tp_name; */
- sizeof( BPy_Library ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL, /* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- ( cmpfunc ) NULL, /* cmpfunc tp_compare; */
- ( reprfunc ) NULL, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- 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; */
- 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, /* 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, /* 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 ***/
- NULL, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- Library_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-/*
- * Library module initialization
- */
-
-static char M_newLibrary_doc[] = "The Blender.lib submodule";
-
-PyObject *Library_Init( void )
-{
- PyObject *submodule;
-
- if( PyType_Ready( &Library_Type ) < 0 )
- return NULL;
- if( PyType_Ready( &LibraryData_Type ) < 0 )
- return NULL;
-
- submodule = Py_InitModule3( "Blender.lib", M_Library_methods,
- M_newLibrary_doc );
- return submodule;
-}
diff --git a/source/blender/python/api2_2x/Library.h b/source/blender/python/api2_2x/Library.h
deleted file mode 100644
index 1ddc138ea57..00000000000
--- a/source/blender/python/api2_2x/Library.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * $Id: Library.h 10323 2007-03-21 14:25:31Z stiv $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Ken Hughes
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_LIBRARY_H
-#define EXPP_LIBRARY_H
-
-#include <Python.h>
-#include "DNA_scene_types.h"
-#include "BLI_linklist.h"
-
-#include "blendef.h"
-
-/*****************************************************************************/
-/* Python BPy_Library structure definition: */
-/*****************************************************************************/
-typedef struct {
- PyObject_HEAD
- char filename[FILE_MAXDIR + FILE_MAXFILE];
-} BPy_Library;
-
-typedef struct {
- PyObject_HEAD
- LinkNode *iter;
- int type;
- char filename[FILE_MAXDIR + FILE_MAXFILE];
- char *name;
- enum {
- OBJECT_IS_LINK,
- OBJECT_IS_APPEND,
- OTHER
- } kind;
-} BPy_LibraryData;
-
-extern PyTypeObject Library_Type;
-extern PyTypeObject LibraryData_Type;
-
-#define BPy_LibraryData_Check(v) ((v)->ob_type == &LibraryData_Type)
-#define BPy_Library_Check(v) ((v)->ob_type == &Library_Type)
-
-/*****************************************************************************/
-/* Module Blender.Library - public functions */
-/*****************************************************************************/
-PyObject *Library_Init( void );
-PyObject *oldLibrary_Init( void );
-
-PyObject *LibraryData_importLibData( BPy_LibraryData *self, char *name,
- int mode, Scene *scene );
-
-#endif /* EXPP_LIBRARY_H */
diff --git a/source/blender/python/api2_2x/MTex.c b/source/blender/python/api2_2x/MTex.c
deleted file mode 100644
index 61d809411a1..00000000000
--- a/source/blender/python/api2_2x/MTex.c
+++ /dev/null
@@ -1,827 +0,0 @@
-/*
- * $Id: MTex.c 10279 2007-03-16 11:38:02Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Alex Mole, Yehoshua Sapir
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-#include "MTex.h" /*This must come first*/
-
-#include "BKE_utildefines.h"
-#include "BLI_blenlib.h"
-#include "Texture.h"
-#include "Object.h"
-#include "gen_utils.h"
-#include "gen_library.h"
-
-#include <DNA_material_types.h>
-
-/*****************************************************************************/
-/* Python BPy_MTex methods declarations: */
-/*****************************************************************************/
-static PyObject *MTex_setTexMethod( BPy_MTex * self, PyObject * args );
-
-/*****************************************************************************/
-/* Python method structure definition for Blender.Texture.MTex module: */
-/*****************************************************************************/
-struct PyMethodDef M_MTex_methods[] = {
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Python BPy_MTex methods table: */
-/*****************************************************************************/
-static PyMethodDef BPy_MTex_methods[] = {
- /* name, method, flags, doc */
- {"setTex", ( PyCFunction ) MTex_setTexMethod, METH_VARARGS,
- "(i) - Set MTex Texture"},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Python MTex_Type callback function prototypes: */
-/*****************************************************************************/
-static int MTex_compare( BPy_MTex * a, BPy_MTex * b );
-static PyObject *MTex_repr( BPy_MTex * self );
-
-#define MTEXGET(x) \
- static PyObject *MTex_get##x( BPy_MTex *self, void *closure );
-#define MTEXSET(x) \
- static int MTex_set##x( BPy_MTex *self, PyObject *value, void *closure);
-#define MTEXGETSET(x) \
- MTEXGET(x) \
- MTEXSET(x)
-
-MTEXGETSET(Tex)
-MTEXGETSET(TexCo)
-MTEXGETSET(Object)
-MTEXGETSET(UVLayer)
-MTEXGETSET(MapTo)
-MTEXGETSET(Col)
-MTEXGETSET(DVar)
-MTEXGETSET(BlendMode)
-MTEXGETSET(ColFac)
-MTEXGETSET(NorFac)
-MTEXGETSET(VarFac)
-MTEXGETSET(DispFac)
-MTEXGETSET(WarpFac)
-MTEXGETSET(Ofs)
-MTEXGETSET(Size)
-MTEXGETSET(Mapping)
-MTEXGETSET(Flag)
-MTEXGETSET(ProjX)
-MTEXGETSET(ProjY)
-MTEXGETSET(ProjZ)
-MTEXGETSET(MapToFlag)
-
-/*****************************************************************************/
-/* Python get/set methods table */
-/*****************************************************************************/
-
-static PyGetSetDef MTex_getseters[] = {
- { "tex", (getter) MTex_getTex, (setter) MTex_setTex,
- "Texture whose mapping this MTex describes", NULL },
- { "texco", (getter) MTex_getTexCo, (setter) MTex_setTexCo,
- "Texture coordinate space (UV, Global, etc.)", NULL },
- { "object", (getter) MTex_getObject, (setter) MTex_setObject,
- "Object whose space to use when texco is Object", NULL },
- { "uvlayer", (getter) MTex_getUVLayer, (setter) MTex_setUVLayer,
- "Name of the UV layer to use", NULL },
- { "mapto", (getter) MTex_getMapTo, (setter) MTex_setMapTo,
- "What values the texture affects", NULL },
- { "col", (getter) MTex_getCol, (setter) MTex_setCol,
- "Color that the texture blends with", NULL },
- { "dvar", (getter) MTex_getDVar, (setter) MTex_setDVar,
- "Value that the texture blends with when not blending colors", NULL },
- { "blendmode", (getter) MTex_getBlendMode, (setter) MTex_setBlendMode,
- "Texture blending mode", NULL },
- { "colfac", (getter) MTex_getColFac, (setter) MTex_setColFac,
- "Factor by which texture affects color", NULL },
- { "norfac", (getter) MTex_getNorFac, (setter) MTex_setNorFac,
- "Factor by which texture affects normal", NULL },
- { "varfac", (getter) MTex_getVarFac, (setter) MTex_setVarFac,
- "Factor by which texture affects most variables", NULL },
- { "dispfac", (getter) MTex_getDispFac, (setter) MTex_setDispFac,
- "Factor by which texture affects displacement", NULL },
- { "warpfac", (getter) MTex_getWarpFac, (setter) MTex_setWarpFac,
- "Factor by which texture affects warp", NULL },
- { "ofs", (getter) MTex_getOfs, (setter) MTex_setOfs,
- "Offset to adjust texture space", NULL },
- { "size", (getter) MTex_getSize, (setter) MTex_setSize,
- "Size to scale texture space", NULL },
- { "mapping", (getter) MTex_getMapping, (setter) MTex_setMapping,
- "Mapping of texture coordinates (flat, cube, etc.)", NULL },
- { "stencil", (getter) MTex_getFlag, (setter) MTex_setFlag,
- "Stencil mode", (void*) MTEX_STENCIL },
- { "neg", (getter) MTex_getFlag, (setter) MTex_setFlag,
- "Negate texture values mode", (void*) MTEX_NEGATIVE },
- { "noRGB", (getter) MTex_getFlag, (setter) MTex_setFlag,
- "Convert texture RGB values to intensity values",
- (void*) MTEX_RGBTOINT },
- { "correctNor", (getter) MTex_getFlag, (setter) MTex_setFlag,
- "Correct normal mapping for Texture space and Object space",
- (void*) MTEX_VIEWSPACE },
- { "xproj", (getter) MTex_getProjX, (setter) MTex_setProjX,
- "Projection of X axis to Texture space", NULL },
- { "yproj", (getter) MTex_getProjY, (setter) MTex_setProjY,
- "Projection of Y axis to Texture space", NULL },
- { "zproj", (getter) MTex_getProjZ, (setter) MTex_setProjZ,
- "Projection of Z axis to Texture space", NULL },
- { "mtCol", (getter) MTex_getMapToFlag, (setter) MTex_setMapToFlag,
- "How texture maps to color", (void*) MAP_COL },
- { "mtNor", (getter) MTex_getMapToFlag, (setter) MTex_setMapToFlag,
- "How texture maps to normals", (void*) MAP_NORM },
- { "mtCsp", (getter) MTex_getMapToFlag, (setter) MTex_setMapToFlag,
- "How texture maps to specularity color", (void*) MAP_COLSPEC },
- { "mtCmir", (getter) MTex_getMapToFlag, (setter) MTex_setMapToFlag,
- "How texture maps to mirror color", (void*) MAP_COLMIR },
- { "mtRef", (getter) MTex_getMapToFlag, (setter) MTex_setMapToFlag,
- "How texture maps to reflectivity", (void*) MAP_REF },
- { "mtSpec", (getter) MTex_getMapToFlag, (setter) MTex_setMapToFlag,
- "How texture maps to specularity", (void*) MAP_SPEC },
- { "mtEmit", (getter) MTex_getMapToFlag, (setter) MTex_setMapToFlag,
- "How texture maps to emit value", (void*) MAP_EMIT },
- { "mtAlpha", (getter) MTex_getMapToFlag, (setter) MTex_setMapToFlag,
- "How texture maps to alpha value", (void*) MAP_ALPHA },
- { "mtHard", (getter) MTex_getMapToFlag, (setter) MTex_setMapToFlag,
- "How texture maps to hardness", (void*) MAP_HAR },
- { "mtRayMir", (getter) MTex_getMapToFlag, (setter) MTex_setMapToFlag,
- "How texture maps to RayMir value", (void*) MAP_RAYMIRR },
- { "mtTranslu", (getter) MTex_getMapToFlag, (setter) MTex_setMapToFlag,
- "How texture maps to translucency", (void*) MAP_TRANSLU },
- { "mtAmb", (getter) MTex_getMapToFlag, (setter) MTex_setMapToFlag,
- "How texture maps to ambient value", (void*) MAP_AMB },
- { "mtDisp", (getter) MTex_getMapToFlag, (setter) MTex_setMapToFlag,
- "How texture maps to displacement", (void*) MAP_DISPLACE },
- { "mtWarp", (getter) MTex_getMapToFlag, (setter) MTex_setMapToFlag,
- "How texture maps to warp", (void*) MAP_WARP },
- { NULL, NULL, NULL, NULL, NULL }
-};
-
-
-
-/*****************************************************************************/
-/* Python MTex_Type structure definition: */
-/*****************************************************************************/
-
-PyTypeObject MTex_Type = {
- PyObject_HEAD_INIT( NULL )
- 0, /* ob_size */
- "Blender MTex", /* tp_name */
- sizeof( BPy_MTex ), /* tp_basicsize */
- 0, /* tp_itemsize */
- /* methods */
- NULL, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- ( cmpfunc ) MTex_compare, /* tp_compare */
- ( reprfunc ) MTex_repr, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_as_hash */
- 0, 0, 0, 0, 0,
- /*** Flags to define presence of optional/expanded features ***/
- Py_TPFLAGS_DEFAULT, /* long tp_flags; */
- 0, /* tp_doc */
- 0, 0, 0, 0, 0, 0,
- BPy_MTex_methods, /* tp_methods */
- 0, /* tp_members */
- MTex_getseters, /* struct PyGetSetDef *tp_getset; */
- 0, /* struct _typeobject *tp_base; */
- 0, /* PyObject *tp_dict; */
- 0, /* descrgetfunc tp_descr_get; */
- 0, /* descrsetfunc tp_descr_set; */
- 0, /* long tp_dictoffset; */
- 0, /* initproc tp_init; */
- 0, /* allocfunc tp_alloc; */
- 0, /* newfunc tp_new; */
- /* Low-level free-memory routine */
- 0, /* freefunc tp_free; */
- /* For PyObject_IS_GC */
- 0, /* inquiry tp_is_gc; */
- 0, /* PyObject *tp_bases; */
- /* method resolution order */
- 0, /* PyObject *tp_mro; */
- 0, /* PyObject *tp_cache; */
- 0, /* PyObject *tp_subclasses; */
- 0, /* PyObject *tp_weaklist; */
- 0
-};
-
-
-PyObject *MTex_Init( void )
-{
- PyObject *submodule;
-/* PyObject *dict; */
-
- /* call PyType_Ready() to init dictionaries & such */
- if( PyType_Ready( &MTex_Type) < 0)
- Py_RETURN_NONE;
-
- submodule = Py_InitModule( "Blender.Texture.MTex", M_MTex_methods );
-
- return submodule;
-}
-
-PyObject *MTex_CreatePyObject( MTex * mtex )
-{
- BPy_MTex *pymtex;
-
- pymtex = ( BPy_MTex * ) PyObject_NEW( BPy_MTex, &MTex_Type );
- if( !pymtex )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create BPy_MTex PyObject" );
-
- pymtex->mtex = mtex;
- return ( PyObject * ) pymtex;
-}
-
-MTex *MTex_FromPyObject( PyObject * pyobj )
-{
- return ( ( BPy_MTex * ) pyobj )->mtex;
-}
-
-/*****************************************************************************/
-/* Python BPy_MTex methods: */
-/*****************************************************************************/
-
-static PyObject *MTex_setTexMethod( BPy_MTex * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)MTex_setTex );
-}
-
-static int MTex_compare( BPy_MTex * a, BPy_MTex * b )
-{
- return ( a->mtex == b->mtex ) ? 0 : -1;
-}
-
-static PyObject *MTex_repr( BPy_MTex * self )
-{
- return PyString_FromFormat( "[MTex]" );
-}
-
-
-/*****************************************************************************/
-/* Python BPy_MTex get and set functions: */
-/*****************************************************************************/
-
-static PyObject *MTex_getTex( BPy_MTex *self, void *closure )
-{
- if( self->mtex->tex )
- return Texture_CreatePyObject( self->mtex->tex );
- else
- Py_RETURN_NONE;
-}
-
-static int MTex_setTex( BPy_MTex *self, PyObject *value, void *closure)
-{
- return GenericLib_assignData(value, (void **) &self->mtex->tex, 0, 1, ID_TE, 0);
-}
-
-static PyObject *MTex_getTexCo( BPy_MTex *self, void *closure )
-{
- return PyInt_FromLong( self->mtex->texco );
-}
-
-static int MTex_setTexCo( BPy_MTex *self, PyObject *value, void *closure)
-{
- int texco;
-
- if( !PyInt_Check( value ) ) {
- return EXPP_ReturnIntError( PyExc_TypeError,
- "Value must be a member of Texture.TexCo dictionary" );
- }
-
- texco = PyInt_AsLong( value ) ;
-
- if (texco != TEXCO_ORCO && texco != TEXCO_REFL && texco != TEXCO_NORM &&
- texco != TEXCO_GLOB && texco != TEXCO_UV && texco != TEXCO_OBJECT &&
- texco != TEXCO_STRESS && texco != TEXCO_TANGENT && texco != TEXCO_WINDOW &&
- texco != TEXCO_VIEW && texco != TEXCO_STICKY )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "Value must be a member of Texture.TexCo dictionary" );
-
- self->mtex->texco = (short)texco;
-
- return 0;
-}
-
-static PyObject *MTex_getObject( BPy_MTex *self, void *closure )
-{
- if( self->mtex->object )
- return Object_CreatePyObject( self->mtex->object );
- else
- Py_RETURN_NONE;
-}
-
-static int MTex_setObject( BPy_MTex *self, PyObject *value, void *closure)
-{
- return GenericLib_assignData(value, (void **) &self->mtex->object, 0, 1, ID_OB, 0);
-}
-
-static PyObject *MTex_getUVLayer( BPy_MTex *self, void *closure )
-{
- return PyString_FromString(self->mtex->uvname);
-}
-
-static int MTex_setUVLayer( BPy_MTex *self, PyObject *value, void *closure)
-{
- if ( !PyString_Check(value) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected string value" );
- BLI_strncpy(self->mtex->uvname, PyString_AsString(value), 31);
- return 0;
-}
-
-static PyObject *MTex_getMapTo( BPy_MTex *self, void *closure )
-{
- return PyInt_FromLong( self->mtex->mapto );
-}
-
-static int MTex_setMapTo( BPy_MTex *self, PyObject *value, void *closure)
-{
- int mapto;
-
- if( !PyInt_Check( value ) ) {
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected an int" );
- }
-
- mapto = PyInt_AsLong( value );
-
- /* This method is deprecated anyway. */
- if ( mapto < 0 || mapto > 16383 ) {
- return EXPP_ReturnIntError( PyExc_ValueError,
- "Value must be a sum of values from Texture.MapTo dictionary" );
- }
-
- self->mtex->mapto = (short)mapto;
-
- return 0;
-}
-
-static PyObject *MTex_getCol( BPy_MTex *self, void *closure )
-{
- return Py_BuildValue( "(f,f,f)", self->mtex->r, self->mtex->g,
- self->mtex->b );
-}
-
-static int MTex_setCol( BPy_MTex *self, PyObject *value, void *closure)
-{
- float rgb[3];
- int i;
-
- if( !PyArg_ParseTuple( value, "fff",
- &rgb[0], &rgb[1], &rgb[2] ) )
-
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected tuple of 3 floats" );
-
- for( i = 0; i < 3; ++i )
- if( rgb[i] < 0 || rgb[i] > 1 )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "values must be in range [0,1]" );
-
- self->mtex->r = rgb[0];
- self->mtex->g = rgb[1];
- self->mtex->b = rgb[2];
-
- return 0;
-}
-
-static PyObject *MTex_getDVar( BPy_MTex *self, void *closure )
-{
- return PyFloat_FromDouble(self->mtex->def_var);
-}
-
-static int MTex_setDVar( BPy_MTex *self, PyObject *value, void *closure)
-{
- float f;
-
- if ( !PyFloat_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a float" );
-
- f = (float)PyFloat_AsDouble(value);
-
- if (f < 0 || f > 1)
- return EXPP_ReturnIntError( PyExc_ValueError,
- "values must be in range [0,1]" );
-
- self->mtex->def_var = f;
-
- return 0;
-}
-
-static PyObject *MTex_getBlendMode( BPy_MTex *self, void *closure )
-{
- return PyInt_FromLong(self->mtex->blendtype);
-}
-
-static int MTex_setBlendMode( BPy_MTex *self, PyObject *value, void *closure)
-{
- int n;
-
- if ( !PyInt_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "Value must be member of Texture.BlendModes dictionary" );
-
- n = PyInt_AsLong(value);
-
-/* if (n != MTEX_BLEND && n != MTEX_MUL && n != MTEX_ADD &&
- n != MTEX_SUB && n != MTEX_DIV && n != MTEX_DARK &&
- n != MTEX_DIFF && n != MTEX_LIGHT && n != MTEX_SCREEN)*/
- if (n < 0 || n > 8)
- {
- return EXPP_ReturnIntError( PyExc_ValueError,
- "Value must be member of Texture.BlendModes dictionary" );
- }
-
- self->mtex->blendtype = (short)n;
-
- return 0;
-}
-
-static PyObject *MTex_getColFac( BPy_MTex *self, void *closure )
-{
- return PyFloat_FromDouble(self->mtex->colfac);
-}
-
-static int MTex_setColFac( BPy_MTex *self, PyObject *value, void *closure)
-{
- float f;
-
- if ( !PyFloat_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a float" );
-
- f = (float)PyFloat_AsDouble(value);
-
- if (f < 0 || f > 1)
- return EXPP_ReturnIntError( PyExc_ValueError,
- "values must be in range [0,1]" );
-
- self->mtex->colfac = f;
-
- return 0;
-}
-
-static PyObject *MTex_getNorFac( BPy_MTex *self, void *closure )
-{
- return PyFloat_FromDouble(self->mtex->norfac);
-}
-
-static int MTex_setNorFac( BPy_MTex *self, PyObject *value, void *closure)
-{
- float f;
-
- if ( !PyFloat_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a float" );
-
- f = (float)PyFloat_AsDouble(value);
-
- if (f < 0 || f > 25)
- return EXPP_ReturnIntError( PyExc_ValueError,
- "values must be in range [0,25]" );
-
- self->mtex->norfac = f;
-
- return 0;
-}
-
-static PyObject *MTex_getVarFac( BPy_MTex *self, void *closure )
-{
- return PyFloat_FromDouble(self->mtex->varfac);
-}
-
-static int MTex_setVarFac( BPy_MTex *self, PyObject *value, void *closure)
-{
- float f;
-
- if ( !PyFloat_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a float" );
-
- f = (float)PyFloat_AsDouble(value);
-
- if (f < 0 || f > 1)
- return EXPP_ReturnIntError( PyExc_ValueError,
- "values must be in range [0,1]" );
-
- self->mtex->varfac = f;
-
- return 0;
-}
-
-static PyObject *MTex_getDispFac( BPy_MTex *self, void *closure )
-{
- return PyFloat_FromDouble(self->mtex->dispfac);
-}
-
-static int MTex_setDispFac( BPy_MTex *self, PyObject *value, void *closure)
-{
- float f;
-
- if ( !PyFloat_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a float" );
-
- f = (float)PyFloat_AsDouble(value);
-
- if (f < 0 || f > 1)
- return EXPP_ReturnIntError( PyExc_ValueError,
- "values must be in range [0,1]" );
-
- self->mtex->dispfac = f;
-
- return 0;
-}
-
-static PyObject *MTex_getWarpFac( BPy_MTex *self, void *closure )
-{
- return PyFloat_FromDouble(self->mtex->warpfac);
-}
-
-static int MTex_setWarpFac( BPy_MTex *self, PyObject *value, void *closure)
-{
- float f;
-
- if ( !PyFloat_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a float" );
-
- f = (float)PyFloat_AsDouble(value);
-
- if (f < 0 || f > 1)
- return EXPP_ReturnIntError( PyExc_ValueError,
- "values must be in range [0,1]" );
-
- self->mtex->warpfac = f;
-
- return 0;
-}
-
-static PyObject *MTex_getOfs( BPy_MTex *self, void *closure )
-{
- return Py_BuildValue( "(f,f,f)", self->mtex->ofs[0], self->mtex->ofs[1],
- self->mtex->ofs[2] );
-}
-
-static int MTex_setOfs( BPy_MTex *self, PyObject *value, void *closure)
-{
- float f[3];
- int i;
-
- if( !PyArg_ParseTuple( value, "fff", &f[0], &f[1], &f[2] ) )
-
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected tuple of 3 floats" );
-
- for( i = 0; i < 3; ++i )
- if( f[i] < -10 || f[i] > 10 )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "values must be in range [-10,10]" );
-
- self->mtex->ofs[0] = f[0];
- self->mtex->ofs[1] = f[1];
- self->mtex->ofs[2] = f[2];
-
- return 0;
-}
-
-static PyObject *MTex_getSize( BPy_MTex *self, void *closure )
-{
- return Py_BuildValue( "(f,f,f)", self->mtex->size[0], self->mtex->size[1],
- self->mtex->size[2] );
-}
-
-static int MTex_setSize( BPy_MTex *self, PyObject *value, void *closure)
-{
- float f[3];
- int i;
-
- if( !PyArg_ParseTuple( value, "fff", &f[0], &f[1], &f[2] ) )
-
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected tuple of 3 floats" );
-
- for( i = 0; i < 3; ++i )
- if( f[i] < -100 || f[i] > 100 )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "values must be in range [-100,100]" );
-
- self->mtex->size[0] = f[0];
- self->mtex->size[1] = f[1];
- self->mtex->size[2] = f[2];
-
- return 0;
-}
-
-static PyObject *MTex_getMapping( BPy_MTex *self, void *closure )
-{
- return PyInt_FromLong( self->mtex->mapping );
-}
-
-static int MTex_setMapping( BPy_MTex *self, PyObject *value, void *closure)
-{
- int n;
-
- if ( !PyInt_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "Value must be member of Texture.Mappings dictionary" );
-
- n = PyInt_AsLong(value);
-
-/* if (n != MTEX_FLAT && n != MTEX_TUBE && n != MTEX_CUBE &&
- n != MTEX_SPHERE) */
- if (n < 0 || n > 3)
- {
- return EXPP_ReturnIntError( PyExc_ValueError,
- "Value must be member of Texture.Mappings dictionary" );
- }
-
- self->mtex->mapping = (char)n;
-
- return 0;
-}
-
-static PyObject *MTex_getFlag( BPy_MTex *self, void *closure )
-{
- return PyBool_FromLong( self->mtex->texflag & ((int) closure) );
-}
-
-static int MTex_setFlag( BPy_MTex *self, PyObject *value, void *closure)
-{
- if ( !PyBool_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a bool");
-
- if ( value == Py_True )
- self->mtex->texflag |= (int)closure;
- else
- self->mtex->texflag &= ~((int) closure);
-
- return 0;
-}
-
-static PyObject *MTex_getProjX( BPy_MTex *self, void *closure )
-{
- return PyInt_FromLong( self->mtex->projx );
-}
-
-static int MTex_setProjX( BPy_MTex *self, PyObject *value, void *closure)
-{
- int proj;
-
- if( !PyInt_Check( value ) ) {
- return EXPP_ReturnIntError( PyExc_TypeError,
- "Value must be a member of Texture.Proj dictionary" );
- }
-
- proj = PyInt_AsLong( value ) ;
-
- /* valid values are from PROJ_N to PROJ_Z = 0 to 3 */
- if (proj < 0 || proj > 3)
- return EXPP_ReturnIntError( PyExc_ValueError,
- "Value must be a member of Texture.Proj dictionary" );
-
- self->mtex->projx = (char)proj;
-
- return 0;
-}
-
-static PyObject *MTex_getProjY( BPy_MTex *self, void *closure )
-{
- return PyInt_FromLong( self->mtex->projy );
-}
-
-static int MTex_setProjY( BPy_MTex *self, PyObject *value, void *closure )
-{
- int proj;
-
- if( !PyInt_Check( value ) ) {
- return EXPP_ReturnIntError( PyExc_TypeError,
- "Value must be a member of Texture.Proj dictionary" );
- }
-
- proj = PyInt_AsLong( value ) ;
-
- /* valid values are from PROJ_N to PROJ_Z = 0 to 3 */
- if (proj < 0 || proj > 3)
- return EXPP_ReturnIntError( PyExc_ValueError,
- "Value must be a member of Texture.Proj dictionary" );
-
- self->mtex->projy = (char)proj;
-
- return 0;
-}
-
-static PyObject *MTex_getProjZ( BPy_MTex *self, void *closure )
-{
- return PyInt_FromLong( self->mtex->projz );
-}
-
-static int MTex_setProjZ( BPy_MTex *self, PyObject *value, void *closure)
-{
- int proj;
-
- if( !PyInt_Check( value ) ) {
- return EXPP_ReturnIntError( PyExc_TypeError,
- "Value must be a member of Texture.Proj dictionary" );
- }
-
- proj = PyInt_AsLong( value ) ;
-
- /* valid values are from PROJ_N to PROJ_Z = 0 to 3 */
- if (proj < 0 || proj > 3)
- return EXPP_ReturnIntError( PyExc_ValueError,
- "Value must be a member of Texture.Proj dictionary" );
-
- self->mtex->projz = (char)proj;
-
- return 0;
-}
-
-static PyObject *MTex_getMapToFlag( BPy_MTex *self, void *closure )
-{
- int flag = (int) closure;
-
- if ( self->mtex->mapto & flag )
- {
- return PyInt_FromLong( ( self->mtex->maptoneg & flag ) ? -1 : 1 );
- } else {
- return PyInt_FromLong( 0 );
- }
-}
-
-static int MTex_setMapToFlag( BPy_MTex *self, PyObject *value, void *closure)
-{
- int flag = (int) closure;
- int intVal;
-
- if ( !PyInt_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected an int");
-
- intVal = PyInt_AsLong( value );
-
- if (flag == MAP_COL || flag == MAP_COLSPEC || flag == MAP_COLMIR ||
- flag == MAP_WARP) {
- if (intVal < 0 || intVal > 1) {
- return EXPP_ReturnIntError( PyExc_ValueError,
- "value for that mapping must be 0 or 1" );
- }
- } else {
- if (intVal < -1 || intVal > 1) {
- return EXPP_ReturnIntError( PyExc_ValueError,
- "value for that mapping must be -1, 0 or 1" );
- }
- }
-
- switch (intVal)
- {
- case 0:
- self->mtex->mapto &= ~flag;
- self->mtex->maptoneg &= ~flag;
- break;
-
- case 1:
- self->mtex->mapto |= flag;
- self->mtex->maptoneg &= ~flag;
- break;
-
- case -1:
- self->mtex->mapto |= flag;
- self->mtex->maptoneg |= flag;
- break;
- }
-
- return 0;
-}
diff --git a/source/blender/python/api2_2x/MTex.h b/source/blender/python/api2_2x/MTex.h
deleted file mode 100644
index 36cfa1c477a..00000000000
--- a/source/blender/python/api2_2x/MTex.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * $Id: MTex.h 10269 2007-03-15 01:09:14Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Alex Mole
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_MTEX_H
-#define EXPP_MTEX_H
-
-#include <Python.h>
-#include "DNA_texture_types.h"
-
-
-/*****************************************************************************/
-/* Python BPy_MTex structure definition */
-/*****************************************************************************/
-
-typedef struct {
- PyObject_HEAD
- MTex * mtex;
-} BPy_MTex;
-
-extern PyTypeObject MTex_Type;
-
-#define BPy_MTex_Check(v) ((v)->ob_type == &MTex_Type)
-
-
-/*****************************************************************************/
-/* Module Blender.Texture.MTex - public functions */
-/*****************************************************************************/
-
-PyObject *MTex_Init( void );
-PyObject *MTex_CreatePyObject( struct MTex *obj );
-MTex *MTex_FromPyObject( PyObject * py_obj );
-
-
-#endif /* EXPP_MTEX_H */
diff --git a/source/blender/python/api2_2x/Material.c b/source/blender/python/api2_2x/Material.c
deleted file mode 100644
index 8ec1a8fab06..00000000000
--- a/source/blender/python/api2_2x/Material.c
+++ /dev/null
@@ -1,3048 +0,0 @@
-/*
- * $Id: Material.c 12078 2007-09-18 06:41:29Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano, Michel Selten, Alex Mole,
- * Alexander Szakaly, Campbell Barton, Ken Hughes
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#include "Material.h" /*This must come first*/
-
-#include "DNA_space_types.h"
-#include "DNA_material_types.h"
-#include "BKE_main.h"
-#include "BKE_global.h"
-#include "BKE_library.h"
-#include "BKE_material.h"
-#include "BKE_texture.h"
-#include "BKE_idprop.h"
-#include "BKE_utildefines.h" /* for CLAMP */
-#include "MEM_guardedalloc.h"
-#include "BLI_blenlib.h"
-#include "BSE_editipo.h"
-#include "BIF_space.h"
-#include "mydevice.h"
-#include "constant.h"
-#include "MTex.h"
-#include "Texture.h"
-#include "Ipo.h"
-#include "Group.h"
-#include "gen_utils.h"
-#include "gen_library.h"
-#include "IDProp.h"
-
-/*****************************************************************************/
-/* Python BPy_Material defaults: */
-/*****************************************************************************/
-/* Material MIN, MAX values */
-#define EXPP_MAT_ADD_MIN 0.0f
-#define EXPP_MAT_ADD_MAX 1.0f
-#define EXPP_MAT_ALPHA_MIN 0.0f
-#define EXPP_MAT_ALPHA_MAX 1.0f
-#define EXPP_MAT_AMB_MIN 0.0f
-#define EXPP_MAT_AMB_MAX 1.0f
-#define EXPP_MAT_COL_MIN 0.0f /* min/max for all ... */
-#define EXPP_MAT_COL_MAX 1.0f /* ... color triplets */
-#define EXPP_MAT_EMIT_MIN 0.0f
-#define EXPP_MAT_EMIT_MAX 1.0f
-#define EXPP_MAT_REF_MIN 0.0f
-#define EXPP_MAT_REF_MAX 1.0f
-#define EXPP_MAT_SPEC_MIN 0.0f
-#define EXPP_MAT_SPEC_MAX 2.0f
-#define EXPP_MAT_SPECTRA_MIN 0.0f
-#define EXPP_MAT_SPECTRA_MAX 1.0f
-
-/* Shader specific settings */
-
-#define EXPP_MAT_ROUGHNESS_MIN 0.0f
-#define EXPP_MAT_ROUGHNESS_MAX 3.140f
-#define EXPP_MAT_SPECSIZE_MIN 0.0f
-#define EXPP_MAT_SPECSIZE_MAX 1.530f
-#define EXPP_MAT_DIFFUSESIZE_MIN 0.0f
-#define EXPP_MAT_DIFFUSESIZE_MAX 3.140f
-#define EXPP_MAT_SPECSMOOTH_MIN 0.0f
-#define EXPP_MAT_SPECSMOOTH_MAX 1.0f
-#define EXPP_MAT_DIFFUSESMOOTH_MIN 0.0f
-#define EXPP_MAT_DIFFUSESMOOTH_MAX 1.0f
-#define EXPP_MAT_DIFFUSE_DARKNESS_MIN 0.0f
-#define EXPP_MAT_DIFFUSE_DARKNESS_MAX 2.0f
-#define EXPP_MAT_REFRACINDEX_MIN 1.0f
-#define EXPP_MAT_REFRACINDEX_MAX 10.0f
-#define EXPP_MAT_RMS_MIN 0.0f
-#define EXPP_MAT_RMS_MAX 0.4f
-/* End shader settings */
-
-#define EXPP_MAT_ZOFFS_MIN 0.0
-#define EXPP_MAT_ZOFFS_MAX 10.0
-#define EXPP_MAT_HALOSIZE_MIN 0.0
-#define EXPP_MAT_HALOSIZE_MAX 100.0
-#define EXPP_MAT_FLARESIZE_MIN 0.1f
-#define EXPP_MAT_FLARESIZE_MAX 25.0
-#define EXPP_MAT_FLAREBOOST_MIN 0.1f
-#define EXPP_MAT_FLAREBOOST_MAX 10.0
-#define EXPP_MAT_SUBSIZE_MIN 0.1f
-#define EXPP_MAT_SUBSIZE_MAX 25.0
-
-#define EXPP_MAT_HARD_MIN 1
-#define EXPP_MAT_HARD_MAX 255 /* 127 with MODE HALO ON */
-#define EXPP_MAT_HALOSEED_MIN 0
-#define EXPP_MAT_HALOSEED_MAX 255
-#define EXPP_MAT_NFLARES_MIN 1
-#define EXPP_MAT_NFLARES_MAX 32
-#define EXPP_MAT_FLARESEED_MIN 0
-#define EXPP_MAT_FLARESEED_MAX 255
-#define EXPP_MAT_NSTARS_MIN 3
-#define EXPP_MAT_NSTARS_MAX 50
-#define EXPP_MAT_NLINES_MIN 0
-#define EXPP_MAT_NLINES_MAX 250
-#define EXPP_MAT_NRINGS_MIN 0
-#define EXPP_MAT_NRINGS_MAX 24
-
-#define EXPP_MAT_RAYMIRR_MIN 0.0
-#define EXPP_MAT_RAYMIRR_MAX 1.0
-#define EXPP_MAT_MIRRDEPTH_MIN 0
-#define EXPP_MAT_MIRRDEPTH_MAX 10
-#define EXPP_MAT_FRESNELMIRR_MIN 0.0
-#define EXPP_MAT_FRESNELMIRR_MAX 5.0
-#define EXPP_MAT_FRESNELMIRRFAC_MIN 1.0
-#define EXPP_MAT_FRESNELMIRRFAC_MAX 5.0
-#define EXPP_MAT_FILTER_MIN 0.0
-#define EXPP_MAT_FILTER_MAX 1.0
-#define EXPP_MAT_TRANSLUCENCY_MIN 0.0
-#define EXPP_MAT_TRANSLUCENCY_MAX 1.0
-#define EXPP_MAT_ZOFFS_MIN 0.0
-#define EXPP_MAT_ZOFFS_MAX 10.0
-#define EXPP_MAT_IOR_MIN 1.0
-#define EXPP_MAT_IOR_MAX 3.0
-#define EXPP_MAT_TRANSDEPTH_MIN 0
-#define EXPP_MAT_TRANSDEPTH_MAX 10
-#define EXPP_MAT_FRESNELTRANS_MIN 0.0
-#define EXPP_MAT_FRESNELTRANS_MAX 5.0
-#define EXPP_MAT_FRESNELTRANSFAC_MIN 1.0
-#define EXPP_MAT_FRESNELTRANSFAC_MAX 5.0
-#define EXPP_MAT_SPECTRANS_MIN 0.0
-#define EXPP_MAT_SPECTRANS_MAX 1.0
-#define EXPP_MAT_MIRRTRANSADD_MIN 0.0
-#define EXPP_MAT_MIRRTRANSADD_MAX 1.0
-
-/* closure values for getColorComponent()/setColorComponent() */
-
-#define EXPP_MAT_COMP_R 0
-#define EXPP_MAT_COMP_G 1
-#define EXPP_MAT_COMP_B 2
-#define EXPP_MAT_COMP_SPECR 3
-#define EXPP_MAT_COMP_SPECG 4
-#define EXPP_MAT_COMP_SPECB 5
-#define EXPP_MAT_COMP_MIRR 6
-#define EXPP_MAT_COMP_MIRG 7
-#define EXPP_MAT_COMP_MIRB 8
-#define EXPP_MAT_COMP_SSSR 9
-#define EXPP_MAT_COMP_SSSG 10
-#define EXPP_MAT_COMP_SSSB 11
-
-
-#define IPOKEY_RGB 0
-#define IPOKEY_ALPHA 1
-#define IPOKEY_HALOSIZE 2
-#define IPOKEY_MODE 3
-#define IPOKEY_ALLCOLOR 10
-#define IPOKEY_ALLMIRROR 14
-#define IPOKEY_OFS 12
-#define IPOKEY_SIZE 13
-#define IPOKEY_ALLMAPPING 11
-
-/* SSS Settings */
-#define EXPP_MAT_SSS_SCALE_MIN 0.001
-#define EXPP_MAT_SSS_SCALE_MAX 1000.0
-#define EXPP_MAT_SSS_RADIUS_MIN 0.0
-#define EXPP_MAT_SSS_RADIUS_MAX 10000.0
-#define EXPP_MAT_SSS_IOR_MIN 0.1
-#define EXPP_MAT_SSS_IOR_MAX 2.0
-#define EXPP_MAT_SSS_ERROR_MIN 0.0
-#define EXPP_MAT_SSS_ERROR_MAX 1.0
-#define EXPP_MAT_SSS_FRONT_MIN 0.0
-#define EXPP_MAT_SSS_FRONT_MAX 2.0
-#define EXPP_MAT_SSS_BACK_MIN 0.0
-#define EXPP_MAT_SSS_BACK_MAX 10.0
-
-
-/*****************************************************************************/
-/* Python API function prototypes for the Material module. */
-/*****************************************************************************/
-static PyObject *M_Material_New( PyObject * self, PyObject * args,
- PyObject * keywords );
-static PyObject *M_Material_Get( PyObject * self, PyObject * args );
-
-/*****************************************************************************/
-/* The following string definitions are used for documentation strings. In */
-/* Python these will be written to the console when doing a */
-/* Blender.Material.__doc__ */
-/*****************************************************************************/
-static char M_Material_doc[] = "The Blender Material module";
-
-static char M_Material_New_doc[] =
- "(name) - return a new material called 'name'\n\
-() - return a new material called 'Mat'";
-
-static char M_Material_Get_doc[] =
- "(name) - return the material called 'name', None if not found.\n\
-() - return a list of all materials in the current scene.";
-
-/*****************************************************************************/
-/* Python method structure definition for Blender.Material module: */
-/*****************************************************************************/
-struct PyMethodDef M_Material_methods[] = {
- {"New", ( PyCFunction ) M_Material_New, METH_VARARGS | METH_KEYWORDS,
- M_Material_New_doc},
- {"Get", M_Material_Get, METH_VARARGS, M_Material_Get_doc},
- {"get", M_Material_Get, METH_VARARGS, M_Material_Get_doc},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Function: M_Material_New */
-/* Python equivalent: Blender.Material.New */
-/*****************************************************************************/
-static PyObject *M_Material_New( PyObject * self, PyObject * args,
- PyObject * keywords )
-{
- char *name = "Mat";
- static char *kwlist[] = { "name", NULL };
- BPy_Material *pymat; /* for Material Data object wrapper in Python */
- Material *blmat; /* for actual Material Data we create in Blender */
- char buf[21];
-
- if( !PyArg_ParseTupleAndKeywords
- ( args, keywords, "|s", kwlist, &name ) )
- return ( EXPP_ReturnPyObjError
- ( PyExc_AttributeError,
- "expected string or nothing as argument" ) );
-
- if( strcmp( name, "Mat" ) != 0 ) /* use gave us a name ? */
- PyOS_snprintf( buf, sizeof( buf ), "%s", name );
-
- blmat = add_material( name ); /* first create the Material Data in Blender */
-
- if( blmat ) /* now create the wrapper obj in Python */
- pymat = ( BPy_Material * ) Material_CreatePyObject( blmat );
- else
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't create Material Data in Blender" ) );
-
- blmat->id.us = 0; /* was incref'ed by add_material() above */
-
- if( pymat == NULL )
- return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create Material Data object" ) );
-
- return ( PyObject * ) pymat;
-}
-
-/*****************************************************************************/
-/* Function: M_Material_Get */
-/* Python equivalent: Blender.Material.Get */
-/* Description: Receives a string and returns the material whose */
-/* name matches the string. If no argument is */
-/* passed in, a list with all materials in the */
-/* current scene is returned. */
-/*****************************************************************************/
-static PyObject *M_Material_Get( PyObject * self, PyObject * args )
-{
- char *name = NULL;
- Material *mat_iter;
-
- if( !PyArg_ParseTuple( args, "|s", &name ) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument (or nothing)" ) );
-
- if( name ) { /* (name) - Search material by name */
-
- mat_iter = ( Material * ) GetIdFromList( &( G.main->mat ), name );
-
- if( mat_iter == NULL ) { /* Requested material doesn't exist */
- char error_msg[64];
- PyOS_snprintf( error_msg, sizeof( error_msg ),
- "Material \"%s\" not found", name );
- return EXPP_ReturnPyObjError( PyExc_NameError,
- error_msg );
- }
-
- return Material_CreatePyObject( mat_iter );
- }
-
- else { /* () - return a list with all materials in the scene */
- int index = 0;
- PyObject *matlist, *pyobj;
-
- matlist = PyList_New( BLI_countlist( &( G.main->mat ) ) );
-
- if( !matlist )
- return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create PyList" ) );
-
- mat_iter = G.main->mat.first;
- while( mat_iter ) {
- pyobj = Material_CreatePyObject( mat_iter );
-
- if( !pyobj ) {
- Py_DECREF(matlist);
- return ( EXPP_ReturnPyObjError
- ( PyExc_MemoryError,
- "couldn't create PyObject" ) );
- }
- PyList_SET_ITEM( matlist, index, pyobj );
-
- mat_iter = mat_iter->id.next;
- index++;
- }
-
- return matlist;
- }
-}
-
-static PyObject *Material_ModesDict( void )
-{
- PyObject *Modes = PyConstant_New( );
-
- if( Modes ) {
- BPy_constant *c = ( BPy_constant * ) Modes;
-
- PyConstant_Insert(c, "TRACEABLE", PyInt_FromLong(MA_TRACEBLE));
- PyConstant_Insert(c, "SHADOW", PyInt_FromLong(MA_SHADOW));
- PyConstant_Insert(c, "SHADOWBUF", PyInt_FromLong(MA_SHADBUF));
- PyConstant_Insert(c, "TANGENTSTR", PyInt_FromLong(MA_TANGENT_STR));
- PyConstant_Insert(c, "FULLOSA", PyInt_FromLong(MA_FULL_OSA));
- PyConstant_Insert(c, "RAYBIAS", PyInt_FromLong(MA_RAYBIAS));
- PyConstant_Insert(c, "TRANSPSHADOW", PyInt_FromLong(MA_SHADOW_TRA));
- PyConstant_Insert(c, "RAMPCOL", PyInt_FromLong(MA_RAMP_COL));
- PyConstant_Insert(c, "RAMPSPEC", PyInt_FromLong(MA_RAMP_SPEC));
- PyConstant_Insert(c, "SHADELESS", PyInt_FromLong(MA_SHLESS));
- PyConstant_Insert(c, "WIRE", PyInt_FromLong(MA_WIRE));
- PyConstant_Insert(c, "VCOL_LIGHT", PyInt_FromLong(MA_VERTEXCOL));
- PyConstant_Insert(c, "HALO", PyInt_FromLong(MA_HALO));
- PyConstant_Insert(c, "ZTRANSP", PyInt_FromLong(MA_ZTRA));
- PyConstant_Insert(c, "VCOL_PAINT", PyInt_FromLong(MA_VERTEXCOLP));
- PyConstant_Insert(c, "ZINVERT", PyInt_FromLong(MA_ZINV));
- PyConstant_Insert(c, "HALORINGS", PyInt_FromLong(MA_HALO_RINGS));
- PyConstant_Insert(c, "ENV", PyInt_FromLong(MA_ENV));
- PyConstant_Insert(c, "HALOLINES", PyInt_FromLong(MA_HALO_LINES));
- PyConstant_Insert(c, "ONLYSHADOW", PyInt_FromLong(MA_ONLYSHADOW));
- PyConstant_Insert(c, "HALOXALPHA", PyInt_FromLong(MA_HALO_XALPHA));
- PyConstant_Insert(c, "HALOSTAR", PyInt_FromLong(MA_STAR));
- PyConstant_Insert(c, "TEXFACE", PyInt_FromLong(MA_FACETEXTURE));
- PyConstant_Insert(c, "HALOTEX", PyInt_FromLong(MA_HALOTEX));
- PyConstant_Insert(c, "HALOPUNO", PyInt_FromLong(MA_HALOPUNO));
- PyConstant_Insert(c, "NOMIST", PyInt_FromLong(MA_NOMIST));
- PyConstant_Insert(c, "HALOSHADE", PyInt_FromLong(MA_HALO_SHADE));
- PyConstant_Insert(c, "HALOFLARE", PyInt_FromLong(MA_HALO_FLARE));
- PyConstant_Insert(c, "RADIO", PyInt_FromLong(MA_RADIO));
- PyConstant_Insert(c, "RAYMIRROR", PyInt_FromLong(MA_RAYMIRROR));
- PyConstant_Insert(c, "ZTRA", PyInt_FromLong(MA_ZTRA));
- PyConstant_Insert(c, "RAYTRANSP", PyInt_FromLong(MA_RAYTRANSP));
- PyConstant_Insert(c, "TANGENT_V", PyInt_FromLong(MA_TANGENT_V));
- PyConstant_Insert(c, "NMAP_TS", PyInt_FromLong(MA_NORMAP_TANG));
- PyConstant_Insert(c, "GROUP_EXCLUSIVE", PyInt_FromLong(MA_GROUP_NOLAY));
- }
-
- return Modes;
-}
-
-
-static PyObject *Material_ShadersDict( void )
-{
- PyObject *Shaders = PyConstant_New( );
-
- if( Shaders ) {
- BPy_constant *c = ( BPy_constant * ) Shaders;
-
- PyConstant_Insert(c, "DIFFUSE_LAMBERT", PyInt_FromLong(MA_DIFF_LAMBERT));
- PyConstant_Insert(c, "DIFFUSE_ORENNAYAR", PyInt_FromLong(MA_DIFF_ORENNAYAR));
- PyConstant_Insert(c, "DIFFUSE_TOON", PyInt_FromLong(MA_DIFF_TOON));
- PyConstant_Insert(c, "DIFFUSE_MINNAERT", PyInt_FromLong(MA_DIFF_MINNAERT));
- PyConstant_Insert(c, "SPEC_COOKTORR", PyInt_FromLong(MA_SPEC_COOKTORR));
- PyConstant_Insert(c, "SPEC_PHONG", PyInt_FromLong(MA_SPEC_PHONG));
- PyConstant_Insert(c, "SPEC_BLINN", PyInt_FromLong(MA_SPEC_BLINN));
- PyConstant_Insert(c, "SPEC_TOON", PyInt_FromLong(MA_SPEC_TOON));
- PyConstant_Insert(c, "SPEC_WARDISO", PyInt_FromLong(MA_SPEC_WARDISO));
-
- }
-
- return Shaders;
-}
-
-
-/*****************************************************************************/
-/* Function: Material_Init */
-/*****************************************************************************/
-PyObject *Material_Init( void )
-{
- PyObject *submodule, *Modes, *Shaders;
-
- if( PyType_Ready( &Material_Type ) < 0)
- return NULL;
-
- Modes = Material_ModesDict( );
- Shaders = Material_ShadersDict( );
-
- submodule = Py_InitModule3( "Blender.Material",
- M_Material_methods, M_Material_doc );
-
- if( Modes )
- PyModule_AddObject( submodule, "Modes", Modes );
- if( Shaders )
- PyModule_AddObject( submodule, "Shaders", Shaders );
-
- PyModule_AddIntConstant( submodule, "RGB", IPOKEY_RGB );
- PyModule_AddIntConstant( submodule, "ALPHA", IPOKEY_ALPHA );
- PyModule_AddIntConstant( submodule, "HALOSIZE", IPOKEY_HALOSIZE );
- PyModule_AddIntConstant( submodule, "MODE", IPOKEY_MODE );
- PyModule_AddIntConstant( submodule, "ALLCOLOR", IPOKEY_ALLCOLOR );
- PyModule_AddIntConstant( submodule, "ALLMIRROR", IPOKEY_ALLMIRROR );
- PyModule_AddIntConstant( submodule, "OFS", IPOKEY_OFS );
- PyModule_AddIntConstant( submodule, "SIZE", IPOKEY_SIZE );
- PyModule_AddIntConstant( submodule, "ALLMAPPING", IPOKEY_ALLMAPPING );
-
- return ( submodule );
-}
-
-/***************************/
-/*** The Material PyType ***/
-/***************************/
-
-static PyObject *Matr_oldsetAdd( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetAlpha( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetAmb( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetEmit( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetFilter( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetFlareBoost( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetFlareSeed( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetFlareSize( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetFresnelMirr( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetFresnelMirrFac( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetFresnelTrans( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetFresnelTransFac( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetHaloSeed( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetHaloSize( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetHardness( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetIOR( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetNFlares( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetNLines( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetNRings( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetNStars( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetRayMirr( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetMirrDepth( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetRef( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetSpec( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetSpecTransp( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetSubSize( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetTransDepth( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetZOffset( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetMode( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetIpo( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetRGBCol( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetSpecCol( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetSpecShader( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetMirCol( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetDiffuseShader( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetRoughness( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetSpecSize( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetDiffuseSize( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetSpecSmooth( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetDiffuseSmooth( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetDiffuseDarkness( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetRefracIndex( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetRms( BPy_Material * self, PyObject * args );
-static PyObject *Matr_oldsetTranslucency( BPy_Material * self, PyObject * args );
-
-static int Material_setIpo( BPy_Material * self, PyObject * value );
-
-static int Material_setMode( BPy_Material * self, PyObject * value );
-static int Material_setRGBCol( BPy_Material * self, PyObject * value );
-static int Material_setSpecCol( BPy_Material * self, PyObject * value );
-static int Material_setMirCol( BPy_Material * self, PyObject * value );
-static int Material_setSssCol( BPy_Material * self, PyObject * value );
-static int Material_setColorComponent( BPy_Material * self, PyObject * value,
- void * closure );
-static int Material_setAmb( BPy_Material * self, PyObject * value );
-static int Material_setEmit( BPy_Material * self, PyObject * value );
-static int Material_setSpecTransp( BPy_Material * self, PyObject * value );
-static int Material_setAlpha( BPy_Material * self, PyObject * value );
-static int Material_setShadAlpha( BPy_Material * self, PyObject * value );
-static int Material_setRef( BPy_Material * self, PyObject * value );
-static int Material_setSpec( BPy_Material * self, PyObject * value );
-static int Material_setZOffset( BPy_Material * self, PyObject * value );
-static int Material_setLightGroup( BPy_Material * self, PyObject * value );
-static int Material_setAdd( BPy_Material * self, PyObject * value );
-static int Material_setHaloSize( BPy_Material * self, PyObject * value );
-static int Material_setFlareSize( BPy_Material * self, PyObject * value );
-static int Material_setFlareBoost( BPy_Material * self, PyObject * value );
-static int Material_setSubSize( BPy_Material * self, PyObject * value );
-static int Material_setHaloSeed( BPy_Material * self, PyObject * value );
-static int Material_setFlareSeed( BPy_Material * self, PyObject * value );
-static int Material_setHardness( BPy_Material * self, PyObject * value );
-static int Material_setNFlares( BPy_Material * self, PyObject * value );
-static int Material_setNStars( BPy_Material * self, PyObject * value );
-static int Material_setNLines( BPy_Material * self, PyObject * value );
-static int Material_setNRings( BPy_Material * self, PyObject * value );
-static int Material_setRayMirr( BPy_Material * self, PyObject * value );
-static int Material_setMirrDepth( BPy_Material * self, PyObject * value );
-static int Material_setFresnelMirr( BPy_Material * self, PyObject * value );
-static int Material_setFresnelMirrFac( BPy_Material * self, PyObject * value );
-static int Material_setIOR( BPy_Material * self, PyObject * value );
-static int Material_setTransDepth( BPy_Material * self, PyObject * value );
-static int Material_setFresnelTrans( BPy_Material * self, PyObject * value );
-static int Material_setFresnelTransFac( BPy_Material * self, PyObject * value );
-static int Material_setRigidBodyFriction( BPy_Material * self, PyObject * value );
-static int Material_setRigidBodyRestitution( BPy_Material * self, PyObject * value );
-
-static int Material_setSpecShader( BPy_Material * self, PyObject * value );
-static int Material_setDiffuseShader( BPy_Material * self, PyObject * value );
-static int Material_setRoughness( BPy_Material * self, PyObject * value );
-static int Material_setSpecSize( BPy_Material * self, PyObject * value );
-static int Material_setDiffuseSize( BPy_Material * self, PyObject * value );
-static int Material_setSpecSmooth( BPy_Material * self, PyObject * value );
-static int Material_setDiffuseSmooth( BPy_Material * self, PyObject * value );
-static int Material_setDiffuseDarkness( BPy_Material * self, PyObject * value );
-static int Material_setRefracIndex( BPy_Material * self, PyObject * value );
-static int Material_setRms( BPy_Material * self, PyObject * value );
-static int Material_setFilter( BPy_Material * self, PyObject * value );
-static int Material_setTranslucency( BPy_Material * self, PyObject * value );
-
-static int Material_setSssEnable( BPy_Material * self, PyObject * value );
-static int Material_setSssScale( BPy_Material * self, PyObject * value );
-static int Material_setSssRadius( BPy_Material * self, PyObject * value, void * type );
-static int Material_setSssIOR( BPy_Material * self, PyObject * value );
-static int Material_setSssError( BPy_Material * self, PyObject * value );
-static int Material_setSssColorBlend( BPy_Material * self, PyObject * value );
-static int Material_setSssTexScatter( BPy_Material * self, PyObject * value );
-static int Material_setSssFront( BPy_Material * self, PyObject * value );
-static int Material_setSssBack( BPy_Material * self, PyObject * value );
-static int Material_setSssBack( BPy_Material * self, PyObject * value );
-
-static PyObject *Material_getColorComponent( BPy_Material * self,
- void * closure );
-
-/*static int Material_setSeptex( BPy_Material * self, PyObject * value );
- static PyObject *Material_getSeptex( BPy_Material * self );*/
-
-/*****************************************************************************/
-/* Python BPy_Material methods declarations: */
-/*****************************************************************************/
-static PyObject *Material_getIpo( BPy_Material * self );
-static PyObject *Material_getMode( BPy_Material * self );
-static PyObject *Material_getRGBCol( BPy_Material * self );
-/*static PyObject *Material_getAmbCol(BPy_Material *self);*/
-static PyObject *Material_getSpecCol( BPy_Material * self );
-static PyObject *Material_getMirCol( BPy_Material * self );
-static PyObject *Material_getSssCol( BPy_Material * self );
-static PyObject *Material_getAmb( BPy_Material * self );
-static PyObject *Material_getEmit( BPy_Material * self );
-static PyObject *Material_getAlpha( BPy_Material * self );
-static PyObject *Material_getShadAlpha( BPy_Material * self );
-static PyObject *Material_getRef( BPy_Material * self );
-static PyObject *Material_getSpec( BPy_Material * self );
-static PyObject *Material_getSpecTransp( BPy_Material * self );
-static PyObject *Material_getAdd( BPy_Material * self );
-static PyObject *Material_getZOffset( BPy_Material * self );
-static PyObject *Material_getLightGroup( BPy_Material * self );
-static PyObject *Material_getHaloSize( BPy_Material * self );
-static PyObject *Material_getHaloSeed( BPy_Material * self );
-static PyObject *Material_getFlareSize( BPy_Material * self );
-static PyObject *Material_getFlareSeed( BPy_Material * self );
-static PyObject *Material_getFlareBoost( BPy_Material * self );
-static PyObject *Material_getSubSize( BPy_Material * self );
-static PyObject *Material_getHardness( BPy_Material * self );
-static PyObject *Material_getNFlares( BPy_Material * self );
-static PyObject *Material_getNStars( BPy_Material * self );
-static PyObject *Material_getNLines( BPy_Material * self );
-static PyObject *Material_getNRings( BPy_Material * self );
-/* Shader settings */
-static PyObject *Material_getSpecShader( BPy_Material * self );
-static PyObject *Material_getDiffuseShader( BPy_Material * self );
-static PyObject *Material_getRoughness( BPy_Material * self );
-static PyObject *Material_getSpecSize( BPy_Material * self );
-static PyObject *Material_getDiffuseSize( BPy_Material * self );
-static PyObject *Material_getSpecSmooth( BPy_Material * self );
-static PyObject *Material_getDiffuseSmooth( BPy_Material * self );
-static PyObject *Material_getDiffuseDarkness( BPy_Material * self );
-static PyObject *Material_getRefracIndex( BPy_Material * self );
-static PyObject *Material_getRms( BPy_Material * self );
-
-static PyObject *Material_getRayMirr( BPy_Material * self );
-static PyObject *Material_getMirrDepth( BPy_Material * self );
-static PyObject *Material_getFresnelMirr( BPy_Material * self );
-static PyObject *Material_getFresnelMirrFac( BPy_Material * self );
-static PyObject *Material_getIOR( BPy_Material * self );
-static PyObject *Material_getTransDepth( BPy_Material * self );
-static PyObject *Material_getFresnelTrans( BPy_Material * self );
-static PyObject *Material_getFresnelTransFac( BPy_Material * self );
-static PyObject *Material_getRigidBodyFriction( BPy_Material * self );
-static PyObject *Material_getRigidBodyRestitution( BPy_Material * self );
-
-static PyObject *Material_getSssEnable( BPy_Material * self );
-static PyObject *Material_getSssScale( BPy_Material * self );
-static PyObject *Material_getSssRadius( BPy_Material * self, void * type );
-static PyObject *Material_getSssIOR( BPy_Material * self );
-static PyObject *Material_getSssError( BPy_Material * self );
-static PyObject *Material_getSssColorBlend( BPy_Material * self );
-static PyObject *Material_getSssTexScatter( BPy_Material * self );
-static PyObject *Material_getSssFront( BPy_Material * self );
-static PyObject *Material_getSssBack( BPy_Material * self );
-static PyObject *Material_getSssBack( BPy_Material * self );
-
-static PyObject *Material_getFilter( BPy_Material * self );
-static PyObject *Material_getTranslucency( BPy_Material * self );
-static PyObject *Material_getTextures( BPy_Material * self );
-static PyObject *Material_clearIpo( BPy_Material * self );
-
-static PyObject *Material_setTexture( BPy_Material * self, PyObject * args );
-static PyObject *Material_clearTexture( BPy_Material * self, PyObject * value );
-
-static PyObject *Material_getScriptLinks(BPy_Material *self, PyObject * value );
-static PyObject *Material_addScriptLink(BPy_Material * self, PyObject * args );
-static PyObject *Material_clearScriptLinks(BPy_Material *self, PyObject *args);
-
-static PyObject *Material_insertIpoKey( BPy_Material * self, PyObject * args );
-static PyObject *Material_getColorband( BPy_Material * self, void * type);
-int Material_setColorband( BPy_Material * self, PyObject * value, void * type);
-static PyObject *Material_copy( BPy_Material * self );
-
-
-/*****************************************************************************/
-/* Python BPy_Material methods table: */
-/*****************************************************************************/
-static PyMethodDef BPy_Material_methods[] = {
- /* name, method, flags, doc */
- {"getName", ( PyCFunction ) GenericLib_getName, METH_NOARGS,
- "() - Return Material's name"},
- {"getIpo", ( PyCFunction ) Material_getIpo, METH_NOARGS,
- "() - Return Material's ipo or None if not found"},
- {"getMode", ( PyCFunction ) Material_getMode, METH_NOARGS,
- "() - Return Material's mode flags"},
- {"getRGBCol", ( PyCFunction ) Material_getRGBCol, METH_NOARGS,
- "() - Return Material's rgb color triplet"},
-/* {"getAmbCol", (PyCFunction)Material_getAmbCol, METH_NOARGS,
- "() - Return Material's ambient color"},*/
- {"getSpecCol", ( PyCFunction ) Material_getSpecCol, METH_NOARGS,
- "() - Return Material's specular color"},
- {"getMirCol", ( PyCFunction ) Material_getMirCol, METH_NOARGS,
- "() - Return Material's mirror color"},
- {"getAmb", ( PyCFunction ) Material_getAmb, METH_NOARGS,
- "() - Return Material's ambient color blend factor"},
- {"getEmit", ( PyCFunction ) Material_getEmit, METH_NOARGS,
- "() - Return Material's emitting light intensity"},
- {"getAlpha", ( PyCFunction ) Material_getAlpha, METH_NOARGS,
- "() - Return Material's alpha (transparency) value"},
- {"getRef", ( PyCFunction ) Material_getRef, METH_NOARGS,
- "() - Return Material's reflectivity"},
- {"getSpec", ( PyCFunction ) Material_getSpec, METH_NOARGS,
- "() - Return Material's specularity"},
- /* Shader specific settings */
- {"getSpecShader", ( PyCFunction ) Material_getSpecShader, METH_NOARGS,
- "() - Returns Material's specular shader" },
- {"getDiffuseShader", ( PyCFunction ) Material_getDiffuseShader, METH_NOARGS,
- "() - Returns Material's diffuse shader" },
- {"getRoughness", ( PyCFunction ) Material_getRoughness, METH_NOARGS,
- "() - Returns Material's Roughness (applies to the \"Oren Nayar\" Diffuse Shader only)" },
- {"getSpecSize", ( PyCFunction ) Material_getSpecSize, METH_NOARGS,
- "() - Returns Material's size of specular area (applies to the \"Toon\" Specular Shader only)" },
- {"getDiffuseSize", ( PyCFunction ) Material_getDiffuseSize, METH_NOARGS,
- "() - Returns Material's size of diffuse area (applies to the \"Toon\" Diffuse Shader only)" },
- {"getSpecSmooth", ( PyCFunction ) Material_getSpecSmooth, METH_NOARGS,
- "() - Returns Material's smoothing of specular area (applies to the \"Toon\" Diffuse Shader only)" },
- {"getDiffuseSmooth", ( PyCFunction ) Material_getDiffuseSmooth, METH_NOARGS,
- "() - Returns Material's smoothing of diffuse area (applies to the \"Toon\" Diffuse Shader only)" },
- {"getDiffuseDarkness", ( PyCFunction ) Material_getDiffuseDarkness, METH_NOARGS,
- "() - Returns Material's diffuse darkness (applies to the \"Minnaert\" Diffuse Shader only)" },
- {"getRefracIndex", ( PyCFunction ) Material_getRefracIndex, METH_NOARGS,
- "() - Returns Material's Index of Refraction (applies to the \"Blinn\" Specular Shader only)" },
- {"getRms", ( PyCFunction ) Material_getRms, METH_NOARGS,
- "() - Returns Material's standard deviation of surface slope (applies to the \"WardIso\" Specular Shader only)" },
- /* End shader settings */
- {"getSpecTransp", ( PyCFunction ) Material_getSpecTransp, METH_NOARGS,
- "() - Return Material's specular transparency"},
- {"getAdd", ( PyCFunction ) Material_getAdd, METH_NOARGS,
- "() - Return Material's glow factor"},
- {"getZOffset", ( PyCFunction ) Material_getZOffset, METH_NOARGS,
- "() - Return Material's artificial offset for faces"},
- {"getHaloSize", ( PyCFunction ) Material_getHaloSize, METH_NOARGS,
- "() - Return Material's halo size"},
- {"getHaloSeed", ( PyCFunction ) Material_getHaloSeed, METH_NOARGS,
- "() - Return Material's seed for random ring dimension and line "
- "location in halos"},
- {"getFlareSize", ( PyCFunction ) Material_getFlareSize, METH_NOARGS,
- "() - Return Material's (flare size)/(halo size) factor"},
- {"getFlareSeed", ( PyCFunction ) Material_getFlareSeed, METH_NOARGS,
- "() - Return Material's flare offset in the seed table"},
- {"getFlareBoost", ( PyCFunction ) Material_getFlareBoost, METH_NOARGS,
- "() - Return Material's flare boost"},
- {"getSubSize", ( PyCFunction ) Material_getSubSize, METH_NOARGS,
- "() - Return Material's dimension of subflare, dots and circles"},
- {"getHardness", ( PyCFunction ) Material_getHardness, METH_NOARGS,
- "() - Return Material's specular hardness"},
- {"getNFlares", ( PyCFunction ) Material_getNFlares, METH_NOARGS,
- "() - Return Material's number of flares in halo"},
- {"getNStars", ( PyCFunction ) Material_getNStars, METH_NOARGS,
- "() - Return Material's number of points in the halo stars"},
- {"getNLines", ( PyCFunction ) Material_getNLines, METH_NOARGS,
- "() - Return Material's number of lines in halo"},
- {"getNRings", ( PyCFunction ) Material_getNRings, METH_NOARGS,
- "() - Return Material's number of rings in halo"},
- {"getRayMirr", ( PyCFunction ) Material_getRayMirr, METH_NOARGS,
- "() - Return mount mirror"},
- {"getMirrDepth", ( PyCFunction ) Material_getMirrDepth, METH_NOARGS,
- "() - Return amount mirror depth"},
- {"getFresnelMirr", ( PyCFunction ) Material_getFresnelMirr, METH_NOARGS,
- "() - Return fresnel power for refractions"},
- {"getFresnelMirrFac", ( PyCFunction ) Material_getFresnelMirrFac, METH_NOARGS,
- "() - Return fresnel power for refractions factor"},
- {"getFilter", ( PyCFunction ) Material_getFilter, METH_NOARGS,
- "() - Return the amount of filtering when transparent raytrace is enabled"},
- {"getTranslucency", ( PyCFunction ) Material_getTranslucency, METH_NOARGS,
- "() - Return the Translucency, the amount of diffuse shading of the back side"},
- {"getIOR", ( PyCFunction ) Material_getIOR, METH_NOARGS,
- "() - Return IOR"},
- {"getTransDepth", ( PyCFunction ) Material_getTransDepth, METH_NOARGS,
- "() - Return amount inter-refractions"},
- {"getFresnelTrans", ( PyCFunction ) Material_getFresnelTrans, METH_NOARGS,
- "() - Return fresnel power for refractions"},
- {"getFresnelTransFac", ( PyCFunction ) Material_getFresnelTransFac, METH_NOARGS,
- "() - Return fresnel power for refractions factor"},
-
- {"getTextures", ( PyCFunction ) Material_getTextures, METH_NOARGS,
- "() - Return Material's texture list as a tuple"},
- {"setName", ( PyCFunction ) GenericLib_setName_with_method, METH_VARARGS,
- "(s) - Change Material's name"},
- {"setIpo", ( PyCFunction ) Matr_oldsetIpo, METH_VARARGS,
- "(Blender Ipo) - Change Material's Ipo"},
- {"clearIpo", ( PyCFunction ) Material_clearIpo, METH_NOARGS,
- "(Blender Ipo) - Unlink Ipo from this Material"},
- {"insertIpoKey", ( PyCFunction ) Material_insertIpoKey, METH_VARARGS,
- "(Material Ipo Constant) - Insert IPO Key at current frame"},
- {"setMode", ( PyCFunction ) Matr_oldsetMode, METH_VARARGS,
- "([s[,s]]) - Set Material's mode flag(s)"},
- {"setRGBCol", ( PyCFunction ) Matr_oldsetRGBCol, METH_VARARGS,
- "(f,f,f or [f,f,f]) - Set Material's rgb color triplet"},
-/* {"setAmbCol", (PyCFunction)Matr_oldsetAmbCol, METH_VARARGS,
- "(f,f,f or [f,f,f]) - Set Material's ambient color"},*/
- {"setSpecCol", ( PyCFunction ) Matr_oldsetSpecCol, METH_VARARGS,
- "(f,f,f or [f,f,f]) - Set Material's specular color"},
-
- /* Shader spesific settings */
- {"setSpecShader", ( PyCFunction ) Matr_oldsetSpecShader, METH_VARARGS,
- "(i) - Set the Material's specular shader" },
- {"setDiffuseShader", ( PyCFunction ) Matr_oldsetDiffuseShader, METH_VARARGS,
- "(i) - Set the Material's diffuse shader" },
- {"setRoughness", ( PyCFunction ) Matr_oldsetRoughness, METH_VARARGS,
- "(f) - Set the Material's Roughness (applies to the \"Oren Nayar\" Diffuse Shader only)" },
- {"setSpecSize", ( PyCFunction ) Matr_oldsetSpecSize, METH_VARARGS,
- "(f) - Set the Material's size of specular area (applies to the \"Toon\" Specular Shader only)" },
- {"setDiffuseSize", ( PyCFunction ) Matr_oldsetDiffuseSize, METH_VARARGS,
- "(f) - Set the Material's size of diffuse area (applies to the \"Toon\" Diffuse Shader only)" },
- {"setSpecSmooth", ( PyCFunction ) Matr_oldsetSpecSmooth, METH_VARARGS,
- "(f) - Set the Material's smoothing of specular area (applies to the \"Toon\" Specular Shader only)" },
- {"setDiffuseSmooth", ( PyCFunction ) Matr_oldsetDiffuseSmooth, METH_VARARGS,
- "(f) - Set the Material's smoothing of diffuse area (applies to the \"Toon\" Diffuse Shader only)" },
- {"setDiffuseDarkness", ( PyCFunction ) Matr_oldsetDiffuseDarkness, METH_VARARGS,
- "(f) - Set the Material's diffuse darkness (applies to the \"Minnaert\" Diffuse Shader only)" },
- {"setRefracIndex", ( PyCFunction ) Matr_oldsetRefracIndex, METH_VARARGS,
- "(f) - Set the Material's Index of Refraction (applies to the \"Blinn\" Specular Shader only)" },
- {"setRms", ( PyCFunction ) Matr_oldsetRms, METH_VARARGS,
- "(f) - Set the Material's standard deviation of surface slope (applies to the \"WardIso\" Specular Shader only)" },
- /* End shader settings */
-
- {"setMirCol", ( PyCFunction ) Matr_oldsetMirCol, METH_VARARGS,
- "(f,f,f or [f,f,f]) - Set Material's mirror color"},
- {"setAmb", ( PyCFunction ) Matr_oldsetAmb, METH_VARARGS,
- "(f) - Set how much the Material's color is affected"
- " by \nthe global ambient colors - [0.0, 1.0]"},
- {"setEmit", ( PyCFunction ) Matr_oldsetEmit, METH_VARARGS,
- "(f) - Set Material's emitting light intensity - [0.0, 1.0]"},
- {"setAlpha", ( PyCFunction ) Matr_oldsetAlpha, METH_VARARGS,
- "(f) - Set Material's alpha (transparency) - [0.0, 1.0]"},
- {"setRef", ( PyCFunction ) Matr_oldsetRef, METH_VARARGS,
- "(f) - Set Material's reflectivity - [0.0, 1.0]"},
- {"setSpec", ( PyCFunction ) Matr_oldsetSpec, METH_VARARGS,
- "(f) - Set Material's specularity - [0.0, 2.0]"},
- {"setSpecTransp", ( PyCFunction ) Matr_oldsetSpecTransp, METH_VARARGS,
- "(f) - Set Material's specular transparency - [0.0, 1.0]"},
- {"setAdd", ( PyCFunction ) Matr_oldsetAdd, METH_VARARGS,
- "(f) - Set Material's glow factor - [0.0, 1.0]"},
- {"setZOffset", ( PyCFunction ) Matr_oldsetZOffset, METH_VARARGS,
- "(f) - Set Material's artificial offset - [0.0, 10.0]"},
- {"setHaloSize", ( PyCFunction ) Matr_oldsetHaloSize, METH_VARARGS,
- "(f) - Set Material's halo size - [0.0, 100.0]"},
- {"setHaloSeed", ( PyCFunction ) Matr_oldsetHaloSeed, METH_VARARGS,
- "(i) - Set Material's halo seed - [0, 255]"},
- {"setFlareSize", ( PyCFunction ) Matr_oldsetFlareSize, METH_VARARGS,
- "(f) - Set Material's factor: (flare size)/(halo size) - [0.1, 25.0]"},
- {"setFlareSeed", ( PyCFunction ) Matr_oldsetFlareSeed, METH_VARARGS,
- "(i) - Set Material's flare seed - [0, 255]"},
- {"setFlareBoost", ( PyCFunction ) Matr_oldsetFlareBoost, METH_VARARGS,
- "(f) - Set Material's flare boost - [0.1, 10.0]"},
- {"setSubSize", ( PyCFunction ) Matr_oldsetSubSize, METH_VARARGS,
- "(f) - Set Material's dimension of subflare,"
- " dots and circles - [0.1, 25.0]"},
- {"setHardness", ( PyCFunction ) Matr_oldsetHardness, METH_VARARGS,
- "(i) - Set Material's hardness - [1, 255 (127 if halo mode is ON)]"},
- {"setNFlares", ( PyCFunction ) Matr_oldsetNFlares, METH_VARARGS,
- "(i) - Set Material's number of flares in halo - [1, 32]"},
- {"setNStars", ( PyCFunction ) Matr_oldsetNStars, METH_VARARGS,
- "(i) - Set Material's number of stars in halo - [3, 50]"},
- {"setNLines", ( PyCFunction ) Matr_oldsetNLines, METH_VARARGS,
- "(i) - Set Material's number of lines in halo - [0, 250]"},
- {"setNRings", ( PyCFunction ) Matr_oldsetNRings, METH_VARARGS,
- "(i) - Set Material's number of rings in halo - [0, 24]"},
- {"setRayMirr", ( PyCFunction ) Matr_oldsetRayMirr, METH_VARARGS,
- "(f) - Set amount mirror - [0.0, 1.0]"},
- {"setMirrDepth", ( PyCFunction ) Matr_oldsetMirrDepth, METH_VARARGS,
- "(i) - Set amount inter-reflections - [0, 10]"},
- {"setFresnelMirr", ( PyCFunction ) Matr_oldsetFresnelMirr, METH_VARARGS,
- "(f) - Set fresnel power for mirror - [0.0, 5.0]"},
- {"setFresnelMirrFac", ( PyCFunction ) Matr_oldsetFresnelMirrFac, METH_VARARGS,
- "(f) - Set blend fac for mirror fresnel - [1.0, 5.0]"},
- {"setFilter", ( PyCFunction ) Matr_oldsetFilter, METH_VARARGS,
- "(f) - Set the amount of filtering when transparent raytrace is enabled"},
- {"setTranslucency", ( PyCFunction ) Matr_oldsetTranslucency, METH_VARARGS,
- "(f) - Set the Translucency, the amount of diffuse shading of the back side"},
- {"setIOR", ( PyCFunction ) Matr_oldsetIOR, METH_VARARGS,
- "(f) - Set IOR - [1.0, 3.0]"},
- {"setTransDepth", ( PyCFunction ) Matr_oldsetTransDepth, METH_VARARGS,
- "(i) - Set amount inter-refractions - [0, 10]"},
- {"setFresnelTrans", ( PyCFunction ) Matr_oldsetFresnelTrans, METH_VARARGS,
- "(f) - Set fresnel power for refractions - [0.0, 5.0]"},
- {"setFresnelTransFac", ( PyCFunction ) Matr_oldsetFresnelTransFac, METH_VARARGS,
- "(f) - Set fresnel power for refractions factor- [0.0, 5.0]"},
- {"setTexture", ( PyCFunction ) Material_setTexture, METH_VARARGS,
- "(n,tex,texco=0,mapto=0) - Set numbered texture to tex"},
- {"clearTexture", ( PyCFunction ) Material_clearTexture, METH_O,
- "(n) - Remove texture from numbered slot"},
- {"getScriptLinks", ( PyCFunction ) Material_getScriptLinks, METH_O,
- "(eventname) - Get a list of this material's scriptlinks (Text names) "
- "of the given type\n"
- "(eventname) - string: FrameChanged, Redraw or Render."},
- {"addScriptLink", ( PyCFunction ) Material_addScriptLink, METH_VARARGS,
- "(text, evt) - Add a new material scriptlink.\n"
- "(text) - string: an existing Blender Text name;\n"
- "(evt) string: FrameChanged, Redraw or Render."},
- {"clearScriptLinks", ( PyCFunction ) Material_clearScriptLinks, METH_VARARGS,
- "() - Delete all scriptlinks from this material.\n"
- "([s1<,s2,s3...>]) - Delete specified scriptlinks from this material."},
- {"__copy__", ( PyCFunction ) Material_copy, METH_NOARGS,
- "() - Return a copy of the material."},
- {"copy", ( PyCFunction ) Material_copy, METH_NOARGS,
- "() - Return a copy of the material."},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Python attributes get/set structure: */
-/*****************************************************************************/
-
-static PyGetSetDef BPy_Material_getseters[] = {
- GENERIC_LIB_GETSETATTR,
- {"add",
- (getter)Material_getAdd, (setter)Material_setAdd,
- "Strength of the add effect",
- NULL},
- {"alpha",
- (getter)Material_getAlpha, (setter)Material_setAlpha,
- "Alpha setting ",
- NULL},
- {"shadAlpha",
- (getter)Material_getShadAlpha, (setter)Material_setShadAlpha,
- "Shadow Alpha setting",
- NULL},
- {"amb",
- (getter)Material_getAmb, (setter)Material_setAmb,
- "Amount of global ambient color material receives",
- NULL},
- {"diffuseDarkness",
- (getter)Material_getDiffuseDarkness, (setter)Material_setDiffuseDarkness,
- "Material's diffuse darkness (\"Minnaert\" diffuse shader only)",
- NULL},
- {"diffuseShader",
- (getter)Material_getDiffuseShader, (setter)Material_setDiffuseShader,
- "Diffuse shader type",
- NULL},
- {"diffuseSize",
- (getter)Material_getDiffuseSize, (setter)Material_setDiffuseSize,
- "Material's diffuse area size (\"Toon\" diffuse shader only)",
- NULL},
- {"diffuseSmooth",
- (getter)Material_getDiffuseSmooth, (setter)Material_setDiffuseSmooth,
- "Material's diffuse area smoothing (\"Toon\" diffuse shader only)",
- NULL},
- {"emit",
- (getter)Material_getEmit, (setter)Material_setEmit,
- "Amount of light the material emits",
- NULL},
- {"filter",
- (getter)Material_getFilter, (setter)Material_setFilter,
- "Amount of filtering when transparent raytrace is enabled",
- NULL},
- {"flareBoost",
- (getter)Material_getFlareBoost, (setter)Material_setFlareBoost,
- "Flare's extra strength",
- NULL},
- {"flareSeed",
- (getter)Material_getFlareSeed, (setter)Material_setFlareSeed,
- "Offset in the flare seed table",
- NULL},
- {"flareSize",
- (getter)Material_getFlareSize, (setter)Material_setFlareSize,
- "Ratio of flare size to halo size",
- NULL},
- {"fresnelDepth",
- (getter)Material_getFresnelMirr, (setter)Material_setFresnelMirr,
- "Power of Fresnel for mirror reflection",
- NULL},
- {"fresnelDepthFac",
- (getter)Material_getFresnelMirrFac, (setter)Material_setFresnelMirrFac,
- "Blending factor for Fresnel mirror",
- NULL},
- {"fresnelTrans",
- (getter)Material_getFresnelTrans, (setter)Material_setFresnelTrans,
- "Power of Fresnel for transparency",
- NULL},
- {"fresnelTransFac",
- (getter)Material_getFresnelTransFac, (setter)Material_setFresnelTransFac,
- "Blending factor for Fresnel transparency",
- NULL},
- {"rbFriction",
- (getter)Material_getRigidBodyFriction, (setter)Material_setRigidBodyFriction,
- "Rigid Body Friction coefficient",
- NULL},
- {"rbRestitution",
- (getter)Material_getRigidBodyRestitution, (setter)Material_setRigidBodyRestitution,
- "Rigid Body Restitution coefficient",
- NULL},
-
- {"haloSeed",
- (getter)Material_getHaloSeed, (setter)Material_setHaloSeed,
- "Randomizes halo ring dimension and line location",
- NULL},
- {"haloSize",
- (getter)Material_getHaloSize, (setter)Material_setHaloSize,
- "Dimension of the halo",
- NULL},
- {"hard",
- (getter)Material_getHardness, (setter)Material_setHardness,
- "Specularity hardness",
- NULL},
- {"IOR",
- (getter)Material_getIOR, (setter)Material_setIOR,
- "Angular index of refraction for raytrace",
- NULL},
- {"ipo",
- (getter)Material_getIpo, (setter)Material_setIpo,
- "Material Ipo data",
- NULL},
- {"mirCol",
- (getter)Material_getMirCol, (setter)Material_setMirCol,
- "Mirror RGB color triplet",
- NULL},
- {"mirR",
- (getter)Material_getColorComponent, (setter)Material_setColorComponent,
- "Mirror color red component",
- (void *) EXPP_MAT_COMP_MIRR },
- {"mirG",
- (getter)Material_getColorComponent, (setter)Material_setColorComponent,
- "Mirror color green component",
- (void *) EXPP_MAT_COMP_MIRG },
- {"mirB",
- (getter)Material_getColorComponent, (setter)Material_setColorComponent,
- "Mirror color blue component",
- (void *) EXPP_MAT_COMP_MIRB },
- {"sssCol",
- (getter)Material_getSssCol, (setter)Material_setSssCol,
- "Sss RGB color triplet",
- NULL},
- {"sssR",
- (getter)Material_getColorComponent, (setter)Material_setColorComponent,
- "SSS color red component",
- (void *) EXPP_MAT_COMP_SSSR },
- {"sssG",
- (getter)Material_getColorComponent, (setter)Material_setColorComponent,
- "SSS color green component",
- (void *) EXPP_MAT_COMP_SSSG },
- {"sssB",
- (getter)Material_getColorComponent, (setter)Material_setColorComponent,
- "SSS color blue component",
- (void *) EXPP_MAT_COMP_SSSB },
- {"mode",
- (getter)Material_getMode, (setter)Material_setMode,
- "Material mode bitmask",
- NULL},
- {"nFlares",
- (getter)Material_getNFlares, (setter)Material_setNFlares,
- "Number of subflares with halo",
- NULL},
- {"nLines",
- (getter)Material_getNLines, (setter)Material_setNLines,
- "Number of star-shaped lines with halo",
- NULL},
- {"nRings",
- (getter)Material_getNRings, (setter)Material_setNRings,
- "Number of rings with halo",
- NULL},
- {"nStars",
- (getter)Material_getNStars, (setter)Material_setNStars,
- "Number of star points with halo",
- NULL},
- {"rayMirr",
- (getter)Material_getRayMirr, (setter)Material_setRayMirr,
- "Mirror reflection amount for raytrace",
- NULL},
- {"rayMirrDepth",
- (getter)Material_getMirrDepth, (setter)Material_setMirrDepth,
- "Amount of raytrace inter-reflections",
- NULL},
- {"ref",
- (getter)Material_getRef, (setter)Material_setRef,
- "Amount of reflections (for shader)",
- NULL},
- {"refracIndex",
- (getter)Material_getRefracIndex, (setter)Material_setRefracIndex,
- "Material's Index of Refraction (applies to the \"Blinn\" Specular Shader only",
- NULL},
- {"rgbCol",
- (getter)Material_getRGBCol, (setter)Material_setRGBCol,
- "Diffuse RGB color triplet",
- NULL},
- {"rms",
- (getter)Material_getRms, (setter)Material_setRms,
- "Material's surface slope standard deviation (\"WardIso\" specular shader only)",
- NULL},
- {"roughness",
- (getter)Material_getRoughness, (setter)Material_setRoughness,
- "Material's roughness (\"Oren Nayar\" diffuse shader only)",
- NULL},
- {"spec",
- (getter)Material_getSpec, (setter)Material_setSpec,
- "Degree of specularity",
- NULL},
- {"specCol",
- (getter)Material_getSpecCol, (setter)Material_setSpecCol,
- "Specular RGB color triplet",
- NULL},
- {"specR",
- (getter)Material_getColorComponent, (setter)Material_setColorComponent,
- "Specular color red component",
- (void *) EXPP_MAT_COMP_SPECR },
- {"specG",
- (getter)Material_getColorComponent, (setter)Material_setColorComponent,
- "Specular color green component",
- (void *) EXPP_MAT_COMP_SPECG },
- {"specB",
- (getter)Material_getColorComponent, (setter)Material_setColorComponent,
- "Specular color blue component",
- (void *) EXPP_MAT_COMP_SPECB },
- {"specTransp",
- (getter)Material_getSpecTransp, (setter)Material_setSpecTransp,
- "Makes specular areas opaque on transparent materials",
- NULL},
- {"specShader",
- (getter)Material_getSpecShader, (setter)Material_setSpecShader,
- "Specular shader type",
- NULL},
- {"specSize",
- (getter)Material_getSpecSize, (setter)Material_setSpecSize,
- "Material's specular area size (\"Toon\" specular shader only)",
- NULL},
- {"specSmooth",
- (getter)Material_getSpecSmooth, (setter)Material_setSpecSmooth,
- "Sets the smoothness of specular toon area",
- NULL},
- {"subSize",
- (getter)Material_getSubSize, (setter)Material_setSubSize,
- "Dimension of subflares, dots and circles",
- NULL},
- {"transDepth",
- (getter)Material_getTransDepth, (setter)Material_setTransDepth,
- "Amount of refractions for raytrace",
- NULL},
- {"translucency",
- (getter)Material_getTranslucency, (setter)Material_setTranslucency,
- "Amount of diffuse shading of the back side",
- NULL},
- {"zOffset",
- (getter)Material_getZOffset, (setter)Material_setZOffset,
- "Artificial offset in the Z buffer (for Ztransp option)",
- NULL},
- {"lightGroup",
- (getter)Material_getLightGroup, (setter)Material_setLightGroup,
- "Set the light group for this material",
- NULL},
- {"R",
- (getter)Material_getColorComponent, (setter)Material_setColorComponent,
- "Diffuse color red component",
- (void *) EXPP_MAT_COMP_R },
- {"G",
- (getter)Material_getColorComponent, (setter)Material_setColorComponent,
- "Diffuse color green component",
- (void *) EXPP_MAT_COMP_G },
- {"B",
- (getter)Material_getColorComponent, (setter)Material_setColorComponent,
- "Diffuse color blue component",
- (void *) EXPP_MAT_COMP_B },
- {"colorbandDiffuse",
- (getter)Material_getColorband, (setter)Material_setColorband,
- "The diffuse colorband for this material",
- (void *) 0},
- {"colorbandSpecular",
- (getter)Material_getColorband, (setter)Material_setColorband,
- "The specular colorband for this material",
- (void *) 1},
-
- /* SSS settings */
- {"enableSSS",
- (getter)Material_getSssEnable, (setter)Material_setSssEnable,
- "if true, SSS will be rendered for this material",
- NULL},
- {"sssScale",
- (getter)Material_getSssScale, (setter)Material_setSssScale,
- "object scale for sss",
- NULL},
- {"sssRadiusRed",
- (getter)Material_getSssRadius, (setter)Material_setSssRadius,
- "Mean red scattering path length",
- (void *) 0},
- {"sssRadiusGreen",
- (getter)Material_getSssRadius, (setter)Material_setSssRadius,
- "Mean red scattering path length",
- (void *) 1},
- {"sssRadiusBlue",
- (getter)Material_getSssRadius, (setter)Material_setSssRadius,
- "Mean red scattering path length",
- (void *) 0},
- {"sssIOR",
- (getter)Material_getSssIOR, (setter)Material_setSssIOR,
- "index of refraction",
- NULL},
- {"sssError",
- (getter)Material_getSssError, (setter)Material_setSssError,
- "Error",
- NULL},
- {"sssColorBlend",
- (getter)Material_getSssColorBlend, (setter)Material_setSssColorBlend,
- "Blend factor for SSS Colors",
- NULL},
- {"sssTextureScatter",
- (getter)Material_getSssTexScatter, (setter)Material_setSssTexScatter,
- "Texture scattering factor",
- NULL},
- {"sssFont",
- (getter)Material_getSssFront, (setter)Material_setSssFront,
- "Front scattering weight",
- NULL},
- {"sssBack",
- (getter)Material_getSssBack, (setter)Material_setSssBack,
- "Back scattering weight",
- NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-/*****************************************************************************/
-/* Python Material_Type callback function prototypes: */
-/*****************************************************************************/
-static void Material_dealloc( BPy_Material * self );
-static int Material_compare( BPy_Material * a, BPy_Material * b);
-static PyObject *Material_repr( BPy_Material * self );
-
-/*****************************************************************************/
-/* Python Material_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject Material_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender Material", /* char *tp_name; */
- sizeof( BPy_Material ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- ( destructor ) Material_dealloc,/* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- ( cmpfunc ) Material_compare,/* cmpfunc tp_compare; */
- ( reprfunc ) Material_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- NULL, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
- 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, /* 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, /* 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 ***/
- BPy_Material_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_Material_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-/*****************************************************************************/
-/* Function: Material_dealloc */
-/* Description: This is a callback function for the BPy_Material type. It is */
-/* the destructor function. */
-/*****************************************************************************/
-static void Material_dealloc( BPy_Material * self )
-{
- Py_DECREF( self->col );
- Py_DECREF( self->amb );
- Py_DECREF( self->spec );
- Py_DECREF( self->mir );
- Py_DECREF( self->sss );
- PyObject_DEL( self );
-}
-
-/*****************************************************************************/
-/* Function: Material_CreatePyObject */
-/* Description: Create a new BPy_Material from an existing */
-/* Blender material structure. */
-/*****************************************************************************/
-PyObject *Material_CreatePyObject( struct Material *mat )
-{
- BPy_Material *pymat;
- float *col[3], *amb[3], *spec[3], *mir[3], *sss[3];
-
- pymat = ( BPy_Material * ) PyObject_NEW( BPy_Material,
- &Material_Type );
-
- if( !pymat )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create BPy_Material object" );
-
- pymat->material = mat;
-
- col[0] = &mat->r;
- col[1] = &mat->g;
- col[2] = &mat->b;
-
- amb[0] = &mat->ambr;
- amb[1] = &mat->ambg;
- amb[2] = &mat->ambb;
-
- spec[0] = &mat->specr;
- spec[1] = &mat->specg;
- spec[2] = &mat->specb;
-
- mir[0] = &mat->mirr;
- mir[1] = &mat->mirg;
- mir[2] = &mat->mirb;
-
- sss[0] = &mat->sss_col[0];
- sss[1] = &mat->sss_col[1];
- sss[2] = &mat->sss_col[2];
-
- pymat->col = ( BPy_rgbTuple * ) rgbTuple_New( col );
- pymat->amb = ( BPy_rgbTuple * ) rgbTuple_New( amb );
- pymat->spec = ( BPy_rgbTuple * ) rgbTuple_New( spec );
- pymat->mir = ( BPy_rgbTuple * ) rgbTuple_New( mir );
- pymat->sss = ( BPy_rgbTuple * ) rgbTuple_New( sss );
-
- return ( PyObject * ) pymat;
-}
-
-/*****************************************************************************/
-/* Function: Material_FromPyObject */
-/* Description: This function returns the Blender material from the given */
-/* PyObject. */
-/*****************************************************************************/
-Material *Material_FromPyObject( PyObject * pyobj )
-{
- return ( ( BPy_Material * ) pyobj )->material;
-}
-
-static PyObject *Material_getIpo( BPy_Material * self )
-{
- Ipo *ipo = self->material->ipo;
-
- if( !ipo )
- Py_RETURN_NONE;
-
- return Ipo_CreatePyObject( ipo );
-}
-
-static PyObject *Material_getMode( BPy_Material * self )
-{
- return PyInt_FromLong( ( long ) self->material->mode );
-}
-
-static PyObject *Material_getRGBCol( BPy_Material * self )
-{
- return rgbTuple_getCol( self->col );
-}
-
-/*
-static PyObject *Material_getAmbCol(BPy_Material *self)
-{
- return rgbTuple_getCol(self->amb);
-}
-*/
-static PyObject *Material_getSpecCol( BPy_Material * self )
-{
- return rgbTuple_getCol( self->spec );
-}
-
-static PyObject *Material_getMirCol( BPy_Material * self )
-{
- return rgbTuple_getCol( self->mir );
-}
-
-static PyObject *Material_getSssCol( BPy_Material * self )
-{
- return rgbTuple_getCol( self->sss );
-}
-
-static PyObject *Material_getSpecShader( BPy_Material * self )
-{
- return PyInt_FromLong( ( long ) self->material->spec_shader );
-}
-
-static PyObject *Material_getDiffuseShader( BPy_Material * self )
-{
- return PyInt_FromLong( ( long ) self->material->diff_shader );
-}
-
-static PyObject *Material_getRoughness( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->roughness );
-}
-
-static PyObject *Material_getSpecSize( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->param[2] );
-}
-
-static PyObject *Material_getDiffuseSize( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->param[0] );
-}
-
-static PyObject *Material_getSpecSmooth( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->param[3] );
-}
-
-static PyObject *Material_getDiffuseSmooth( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->param[1] );
-}
-
-static PyObject *Material_getDiffuseDarkness( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->darkness );
-}
-
-static PyObject *Material_getRefracIndex( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->refrac );
-}
-
-static PyObject *Material_getRms( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->rms );
-}
-
-static PyObject *Material_getAmb( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->amb );
-}
-
-static PyObject *Material_getEmit( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->emit );
-}
-
-static PyObject *Material_getAlpha( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->alpha );
-}
-
-static PyObject *Material_getShadAlpha( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->shad_alpha );
-}
-
-static PyObject *Material_getRef( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->ref );
-}
-
-static PyObject *Material_getSpec( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->spec );
-}
-
-static PyObject *Material_getSpecTransp( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->spectra );
-}
-
-static PyObject *Material_getAdd( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->add );
-}
-
-static PyObject *Material_getZOffset( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->zoffs );
-}
-
-static PyObject *Material_getLightGroup( BPy_Material * self )
-{
- return Group_CreatePyObject( self->material->group );
-}
-
-static PyObject *Material_getHaloSize( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->hasize );
-}
-
-static PyObject *Material_getFlareSize( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->flaresize );
-}
-
-static PyObject *Material_getFlareBoost( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->flareboost );
-}
-
-static PyObject *Material_getSubSize( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->subsize );
-}
-
-static PyObject *Material_getHaloSeed( BPy_Material * self )
-{
- return PyInt_FromLong( ( long ) self->material->seed1 );
-}
-
-static PyObject *Material_getFlareSeed( BPy_Material * self )
-{
- return PyInt_FromLong( ( long ) self->material->seed2 );
-}
-
-static PyObject *Material_getHardness( BPy_Material * self )
-{
- return PyInt_FromLong( ( long ) self->material->har );
-}
-
-static PyObject *Material_getNFlares( BPy_Material * self )
-{
- return PyInt_FromLong( ( long ) self->material->flarec );
-}
-
-static PyObject *Material_getNStars( BPy_Material * self )
-{
- return PyInt_FromLong( ( long ) self->material->starc );
-}
-
-static PyObject *Material_getNLines( BPy_Material * self )
-{
- return PyInt_FromLong( ( long ) self->material->linec );
-}
-
-static PyObject *Material_getNRings( BPy_Material * self )
-{
- return PyInt_FromLong( ( long ) self->material->ringc );
-}
-
-static PyObject *Material_getRayMirr( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->ray_mirror );
-}
-
-static PyObject *Material_getMirrDepth( BPy_Material * self )
-{
- return PyInt_FromLong( ( long ) self->material->ray_depth );
-}
-
-static PyObject *Material_getFresnelMirr( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->fresnel_mir );
-}
-
-static PyObject *Material_getFresnelMirrFac( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->fresnel_mir_i );
-}
-
-static PyObject *Material_getFilter( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->filter );
-}
-
-static PyObject *Material_getTranslucency( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->translucency );
-}
-
-static PyObject *Material_getIOR( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->ang );
-}
-
-static PyObject *Material_getTransDepth( BPy_Material * self )
-{
- return PyInt_FromLong( ( long ) self->material->ray_depth_tra );
-}
-
-static PyObject *Material_getFresnelTrans( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->fresnel_tra );
-}
-
-static PyObject *Material_getFresnelTransFac( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->fresnel_tra_i );
-}
-
-static PyObject* Material_getRigidBodyFriction( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->friction );
-}
-
-static PyObject* Material_getRigidBodyRestitution( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->reflect );
-}
-
-/* SSS */
-static PyObject* Material_getSssEnable( BPy_Material * self )
-{
- return EXPP_getBitfield( &self->material->sss_flag, MA_DIFF_SSS, 'h' );
-}
-
-static PyObject* Material_getSssScale( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->sss_scale );
-}
-
-static PyObject* Material_getSssRadius( BPy_Material * self, void * type )
-{
- return PyFloat_FromDouble( ( double ) (self->material->sss_radius[(int)type]) );
-}
-
-static PyObject* Material_getSssIOR( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->sss_ior);
-}
-
-static PyObject* Material_getSssError( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->sss_error);
-}
-
-static PyObject* Material_getSssColorBlend( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->sss_colfac);
-}
-
-static PyObject* Material_getSssTexScatter( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->sss_texfac);
-}
-
-static PyObject* Material_getSssFront( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->sss_front);
-}
-
-static PyObject* Material_getSssBack( BPy_Material * self )
-{
- return PyFloat_FromDouble( ( double ) self->material->sss_back);
-}
-
-static PyObject *Material_getTextures( BPy_Material * self )
-{
- int i;
- struct MTex *mtex;
- PyObject *t[MAX_MTEX];
- PyObject *tuple;
-
- /* build a texture list */
- for( i = 0; i < MAX_MTEX; ++i ) {
- mtex = self->material->mtex[i];
-
- if( mtex ) {
- t[i] = MTex_CreatePyObject( mtex );
- } else {
- Py_INCREF( Py_None );
- t[i] = Py_None;
- }
- }
-
- /* turn the array into a tuple */
- tuple = Py_BuildValue( "NNNNNNNNNN", t[0], t[1], t[2], t[3],
- t[4], t[5], t[6], t[7], t[8], t[9] );
- if( !tuple )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "Material_getTextures: couldn't create PyTuple" );
-
- return tuple;
-}
-
-/*
- * this should accept a Py_None argument and just delete the Ipo link
- * (as Lamp_clearIpo() does)
- */
-
-static int Material_setIpo( BPy_Material * self, PyObject * value )
-{
- return GenericLib_assignData(value, (void **) &self->material->ipo, 0, 1, ID_IP, ID_MA);
-}
-
-
-/*
- * Material_insertIpoKey( key )
- * inserts Material IPO key at current frame
- */
-
-static PyObject *Material_insertIpoKey( BPy_Material * self, PyObject * args )
-{
- int key = 0, map;
-
- if( !PyArg_ParseTuple( args, "i", &( key ) ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected int argument" ) );
-
- map = texchannel_to_adrcode(self->material->texact);
-
- if(key==IPOKEY_RGB || key==IPOKEY_ALLCOLOR) {
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_R, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_G, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_B, 0);
- }
- if(key==IPOKEY_ALPHA || key==IPOKEY_ALLCOLOR) {
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_ALPHA, 0);
- }
- if(key==IPOKEY_HALOSIZE || key==IPOKEY_ALLCOLOR) {
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_HASIZE, 0);
- }
- if(key==IPOKEY_MODE || key==IPOKEY_ALLCOLOR) {
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_MODE, 0);
- }
- if(key==IPOKEY_ALLCOLOR) {
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_R, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_G, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_B, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_REF, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_EMIT, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_AMB, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_HARD, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_MODE, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_TRANSLU, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_ADD, 0);
- }
- if(key==IPOKEY_ALLMIRROR) {
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_RAYM, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESMIR, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESMIRI, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESTRA, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESTRAI, 0);
- }
- if(key==IPOKEY_OFS || key==IPOKEY_ALLMAPPING) {
- insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_X, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_Y, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_Z, 0);
- }
- if(key==IPOKEY_SIZE || key==IPOKEY_ALLMAPPING) {
- insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_X, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_Y, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_Z, 0);
- }
- if(key==IPOKEY_ALLMAPPING) {
- insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_R, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_G, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_B, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_DVAR, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_COLF, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_NORF, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_VARF, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_DISP, 0);
- }
-
- allspace(REMAKEIPO, 0);
- EXPP_allqueue(REDRAWIPO, 0);
- EXPP_allqueue(REDRAWVIEW3D, 0);
- EXPP_allqueue(REDRAWACTION, 0);
- EXPP_allqueue(REDRAWNLA, 0);
-
- Py_RETURN_NONE;
-}
-
-static int Material_setMode( BPy_Material * self, PyObject * value )
-{
- int param;
-
- if( !PyInt_Check( value ) ) {
- char errstr[128];
- sprintf ( errstr , "expected int bitmask of 0x%08x", MA_MODE_MASK );
- return EXPP_ReturnIntError( PyExc_TypeError, errstr );
- }
- param = PyInt_AS_LONG ( value );
-
- if ( ( param & MA_MODE_MASK ) != param )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "invalid bit(s) set in mask" );
-
- self->material->mode &= ( MA_RAMP_COL | MA_RAMP_SPEC );
- self->material->mode |= param & ~( MA_RAMP_COL | MA_RAMP_SPEC );
-
- return 0;
-}
-
-static int Material_setRGBCol( BPy_Material * self, PyObject * value )
-{
- return rgbTuple_setCol( self->col, value );
-}
-
-/*
-static PyObject *Material_setAmbCol (BPy_Material *self, PyObject * value )
-{
- return rgbTuple_setCol(self->amb, value);
-}
-*/
-
-static int Material_setSpecCol( BPy_Material * self, PyObject * value )
-{
- return rgbTuple_setCol( self->spec, value );
-}
-
-static int Material_setMirCol( BPy_Material * self, PyObject * value )
-{
- return rgbTuple_setCol( self->mir, value );
-}
-
-static int Material_setSssCol( BPy_Material * self, PyObject * value )
-{
- return rgbTuple_setCol( self->sss, value );
-}
-
-static int Material_setColorComponent( BPy_Material * self, PyObject * value,
- void * closure )
-{
- float param;
-
- if( !PyNumber_Check ( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected float argument in [0.0,1.0]" );
-
- param = (float)PyFloat_AsDouble( value );
- param = EXPP_ClampFloat( param, EXPP_MAT_COL_MIN, EXPP_MAT_COL_MAX );
-
- switch ( (int)closure ) {
- case EXPP_MAT_COMP_R:
- self->material->r = param;
- return 0;
- case EXPP_MAT_COMP_G:
- self->material->g = param;
- return 0;
- case EXPP_MAT_COMP_B:
- self->material->b = param;
- return 0;
- case EXPP_MAT_COMP_SPECR:
- self->material->specr = param;
- return 0;
- case EXPP_MAT_COMP_SPECG:
- self->material->specg = param;
- return 0;
- case EXPP_MAT_COMP_SPECB:
- self->material->specb = param;
- return 0;
- case EXPP_MAT_COMP_MIRR:
- self->material->mirr = param;
- return 0;
- case EXPP_MAT_COMP_MIRG:
- self->material->mirg = param;
- return 0;
- case EXPP_MAT_COMP_MIRB:
- self->material->mirb = param;
- return 0;
- case EXPP_MAT_COMP_SSSR:
- self->material->sss_col[0] = param;
- return 0;
- case EXPP_MAT_COMP_SSSG:
- self->material->sss_col[1] = param;
- return 0;
- case EXPP_MAT_COMP_SSSB:
- self->material->sss_col[2] = param;
- return 0;
- }
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "unknown color component specified" );
-}
-
-/*#define setFloatWrapper(val, min, max) {return EXPP_setFloatClamped ( value, &self->material->#val, #min, #max}*/
-
-static int Material_setAmb( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->amb,
- EXPP_MAT_AMB_MIN,
- EXPP_MAT_AMB_MAX );
-}
-
-static int Material_setEmit( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->emit,
- EXPP_MAT_EMIT_MIN,
- EXPP_MAT_EMIT_MAX );
-}
-
-static int Material_setSpecTransp( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->spectra,
- EXPP_MAT_SPECTRA_MIN,
- EXPP_MAT_SPECTRA_MAX );
-}
-
-static int Material_setAlpha( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->alpha,
- EXPP_MAT_ALPHA_MIN,
- EXPP_MAT_ALPHA_MAX );
-}
-
-static int Material_setShadAlpha( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->shad_alpha,
- EXPP_MAT_ALPHA_MIN,
- EXPP_MAT_ALPHA_MAX );
-}
-
-static int Material_setRef( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->ref,
- EXPP_MAT_REF_MIN,
- EXPP_MAT_REF_MAX );
-}
-
-static int Material_setSpec( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->spec,
- EXPP_MAT_SPEC_MIN,
- EXPP_MAT_SPEC_MAX );
-}
-
-static int Material_setZOffset( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->zoffs,
- EXPP_MAT_ZOFFS_MIN,
- EXPP_MAT_ZOFFS_MAX );
-}
-
-static int Material_setLightGroup( BPy_Material * self, PyObject * value )
-{
- return GenericLib_assignData(value, (void **) &self->material->group, NULL, 1, ID_GR, 0);
-}
-
-static int Material_setAdd( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->add,
- EXPP_MAT_ADD_MIN,
- EXPP_MAT_ADD_MAX );
-}
-
-static int Material_setHaloSize( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->hasize,
- EXPP_MAT_HALOSIZE_MIN,
- EXPP_MAT_HALOSIZE_MAX );
-}
-
-static int Material_setFlareSize( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->flaresize,
- EXPP_MAT_FLARESIZE_MIN,
- EXPP_MAT_FLARESIZE_MAX );
-}
-
-static int Material_setFlareBoost( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->flareboost,
- EXPP_MAT_FLAREBOOST_MIN,
- EXPP_MAT_FLAREBOOST_MAX );
-}
-
-static int Material_setSubSize( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->subsize,
- EXPP_MAT_SUBSIZE_MIN,
- EXPP_MAT_SUBSIZE_MAX );
-}
-
-static int Material_setHaloSeed( BPy_Material * self, PyObject * value )
-{
- return EXPP_setIValueClamped ( value, &self->material->seed1,
- EXPP_MAT_HALOSEED_MIN,
- EXPP_MAT_HALOSEED_MAX, 'b' );
-}
-
-static int Material_setFlareSeed( BPy_Material * self, PyObject * value )
-{
- return EXPP_setIValueClamped ( value, &self->material->seed2,
- EXPP_MAT_FLARESEED_MIN,
- EXPP_MAT_FLARESEED_MAX, 'b' );
-}
-
-static int Material_setHardness( BPy_Material * self, PyObject * value )
-{
- return EXPP_setIValueClamped ( value, &self->material->har,
- EXPP_MAT_HARD_MIN,
- EXPP_MAT_HARD_MAX, 'h' );
-}
-
-static int Material_setNFlares( BPy_Material * self, PyObject * value )
-{
- return EXPP_setIValueClamped ( value, &self->material->flarec,
- EXPP_MAT_NFLARES_MIN,
- EXPP_MAT_NFLARES_MAX, 'h' );
-}
-
-static int Material_setNStars( BPy_Material * self, PyObject * value )
-{
- return EXPP_setIValueClamped ( value, &self->material->starc,
- EXPP_MAT_NSTARS_MIN,
- EXPP_MAT_NSTARS_MAX, 'h' );
-}
-
-static int Material_setNLines( BPy_Material * self, PyObject * value )
-{
- return EXPP_setIValueClamped ( value, &self->material->linec,
- EXPP_MAT_NLINES_MIN,
- EXPP_MAT_NLINES_MAX, 'h' );
-}
-
-static int Material_setNRings( BPy_Material * self, PyObject * value )
-{
- return EXPP_setIValueClamped ( value, &self->material->ringc,
- EXPP_MAT_NRINGS_MIN,
- EXPP_MAT_NRINGS_MAX, 'h' );
-}
-
-static int Material_setRayMirr( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->ray_mirror,
- EXPP_MAT_RAYMIRR_MIN,
- EXPP_MAT_RAYMIRR_MAX );
-}
-
-static int Material_setMirrDepth( BPy_Material * self, PyObject * value )
-{
- return EXPP_setIValueClamped ( value, &self->material->ray_depth,
- EXPP_MAT_MIRRDEPTH_MIN,
- EXPP_MAT_MIRRDEPTH_MAX, 'h' );
-}
-
-static int Material_setFresnelMirr( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->fresnel_mir,
- EXPP_MAT_FRESNELMIRR_MIN,
- EXPP_MAT_FRESNELMIRR_MAX );
-}
-
-static int Material_setFresnelMirrFac( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->fresnel_mir_i,
- EXPP_MAT_FRESNELMIRRFAC_MIN,
- EXPP_MAT_FRESNELMIRRFAC_MAX );
-}
-
-static int Material_setIOR( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->ang,
- EXPP_MAT_IOR_MIN,
- EXPP_MAT_IOR_MAX );
-}
-
-static int Material_setTransDepth( BPy_Material * self, PyObject * value )
-{
- return EXPP_setIValueClamped ( value, &self->material->ray_depth_tra,
- EXPP_MAT_TRANSDEPTH_MIN,
- EXPP_MAT_TRANSDEPTH_MAX, 'h' );
-}
-
-static int Material_setFresnelTrans( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->fresnel_tra,
- EXPP_MAT_FRESNELTRANS_MIN,
- EXPP_MAT_FRESNELTRANS_MAX );
-}
-
-static int Material_setFresnelTransFac( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->fresnel_tra_i,
- EXPP_MAT_FRESNELTRANSFAC_MIN,
- EXPP_MAT_FRESNELTRANSFAC_MAX );
-}
-
-static int Material_setRigidBodyFriction( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->friction,
- 0.f,
- 100.f );
-}
-
-static int Material_setRigidBodyRestitution( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->reflect,
- 0.f,
- 1.f );
-}
-
-
-
-
-static int Material_setSpecShader( BPy_Material * self, PyObject * value )
-{
- return EXPP_setIValueRange( value, &self->material->spec_shader,
- MA_SPEC_COOKTORR,
- MA_SPEC_WARDISO, 'h' );
-}
-
-static int Material_setDiffuseShader( BPy_Material * self, PyObject * value )
-{
- return EXPP_setIValueRange( value, &self->material->diff_shader,
- MA_DIFF_LAMBERT,
- MA_DIFF_MINNAERT, 'h' );
-}
-
-static int Material_setRoughness( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->roughness,
- EXPP_MAT_ROUGHNESS_MIN,
- EXPP_MAT_ROUGHNESS_MAX );
-}
-
-static int Material_setSpecSize( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->param[2],
- EXPP_MAT_SPECSIZE_MIN,
- EXPP_MAT_SPECSIZE_MAX );
-}
-
-static int Material_setDiffuseSize( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->param[0],
- EXPP_MAT_DIFFUSESIZE_MIN,
- EXPP_MAT_DIFFUSESIZE_MAX );
-}
-
-static int Material_setSpecSmooth( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->param[3],
- EXPP_MAT_SPECSMOOTH_MIN,
- EXPP_MAT_SPECSMOOTH_MAX );
-}
-
-static int Material_setDiffuseSmooth( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->param[1],
- EXPP_MAT_DIFFUSESMOOTH_MIN,
- EXPP_MAT_DIFFUSESMOOTH_MAX );
-}
-
-static int Material_setDiffuseDarkness( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->darkness,
- EXPP_MAT_DIFFUSE_DARKNESS_MIN,
- EXPP_MAT_DIFFUSE_DARKNESS_MAX );
-}
-
-static int Material_setRefracIndex( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->refrac,
- EXPP_MAT_REFRACINDEX_MIN,
- EXPP_MAT_REFRACINDEX_MAX );
-}
-
-static int Material_setRms( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->rms,
- EXPP_MAT_RMS_MIN,
- EXPP_MAT_RMS_MAX );
-}
-
-static int Material_setFilter( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->filter,
- EXPP_MAT_FILTER_MIN,
- EXPP_MAT_FILTER_MAX );
-}
-
-static int Material_setTranslucency( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->translucency,
- EXPP_MAT_TRANSLUCENCY_MIN,
- EXPP_MAT_TRANSLUCENCY_MAX );
-}
-
-/* SSS */
-static int Material_setSssEnable( BPy_Material * self, PyObject * value )
-{
- return EXPP_setBitfield( value, &self->material->sss_flag, MA_DIFF_SSS, 'h' );
-}
-
-static int Material_setSssScale( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->sss_scale,
- EXPP_MAT_SSS_SCALE_MIN,
- EXPP_MAT_SSS_SCALE_MAX);
-}
-
-static int Material_setSssRadius( BPy_Material * self, PyObject * value, void *type )
-{
- return EXPP_setFloatClamped ( value, &self->material->sss_radius[(int)type],
- EXPP_MAT_SSS_RADIUS_MIN,
- EXPP_MAT_SSS_RADIUS_MAX);
-}
-
-static int Material_setSssIOR( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->sss_ior,
- EXPP_MAT_SSS_IOR_MIN,
- EXPP_MAT_SSS_IOR_MAX);
-}
-
-static int Material_setSssError( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->sss_error,
- EXPP_MAT_SSS_IOR_MIN,
- EXPP_MAT_SSS_IOR_MAX);
-}
-
-static int Material_setSssColorBlend( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->sss_colfac,
- 0.0,
- 1.0);
-}
-
-static int Material_setSssTexScatter( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->sss_texfac,
- 0.0,
- 1.0);
-}
-
-static int Material_setSssFront( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->sss_front,
- EXPP_MAT_SSS_FRONT_MIN,
- EXPP_MAT_SSS_FRONT_MAX);
-}
-
-static int Material_setSssBack( BPy_Material * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->material->sss_back,
- EXPP_MAT_SSS_BACK_MIN,
- EXPP_MAT_SSS_BACK_MAX);
-}
-
-
-
-
-static PyObject *Material_setTexture( BPy_Material * self, PyObject * args )
-{
- int texnum;
- PyObject *pytex;
- Tex *bltex;
- int texco = TEXCO_ORCO, mapto = MAP_COL;
-
- if( !PyArg_ParseTuple( args, "iO!|ii", &texnum, &Texture_Type, &pytex,
- &texco, &mapto ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int in [0,9] and Texture" );
- if( ( texnum < 0 ) || ( texnum >= MAX_MTEX ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int in [0,9] and Texture" );
-
- bltex = Texture_FromPyObject( pytex );
-
- if( !self->material->mtex[texnum] ) {
- /* there isn't an mtex for this slot so we need to make one */
- self->material->mtex[texnum] = add_mtex( );
- } else {
- /* we already had a texture here so deal with the old one first */
- self->material->mtex[texnum]->tex->id.us--;
- }
-
- self->material->mtex[texnum]->tex = bltex;
- id_us_plus( &bltex->id );
- self->material->mtex[texnum]->texco = (short)texco;
- self->material->mtex[texnum]->mapto = (short)mapto;
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Material_clearTexture( BPy_Material * self, PyObject * value )
-{
- int texnum = (int)PyInt_AsLong(value);
- struct MTex *mtex;
- /* non ints will be -1 */
- if( ( texnum < 0 ) || ( texnum >= MAX_MTEX ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int in [0,9]" );
-
- mtex = self->material->mtex[texnum];
- if( mtex ) {
- if( mtex->tex )
- mtex->tex->id.us--;
- MEM_freeN( mtex );
- self->material->mtex[texnum] = NULL;
- }
-
- Py_RETURN_NONE;
-}
-
-/* mat.addScriptLink */
-static PyObject *Material_addScriptLink( BPy_Material * self, PyObject * args )
-{
- Material *mat = self->material;
- ScriptLink *slink = NULL;
-
- slink = &( mat )->scriptlink;
-
- return EXPP_addScriptLink( slink, args, 0 );
-}
-
-/* mat.clearScriptLinks */
-static PyObject *Material_clearScriptLinks(BPy_Material *self, PyObject *args )
-{
- Material *mat = self->material;
- ScriptLink *slink = NULL;
-
- slink = &( mat )->scriptlink;
-
- return EXPP_clearScriptLinks( slink, args );
-}
-
-/* mat.getScriptLinks */
-static PyObject *Material_getScriptLinks( BPy_Material * self,
- PyObject * value )
-{
- Material *mat = self->material;
- ScriptLink *slink = NULL;
- PyObject *ret = NULL;
-
- slink = &( mat )->scriptlink;
-
- /* can't this just return? EXP_getScriptLinks() returns a PyObject*
- * or NULL anyway */
-
- ret = EXPP_getScriptLinks( slink, value, 0 );
-
- if( ret )
- return ret;
- else
- return NULL;
-}
-
-/* mat.__copy__ */
-static PyObject *Material_copy( BPy_Material * self )
-{
- BPy_Material *pymat; /* for Material Data object wrapper in Python */
- Material *blmat; /* for actual Material Data we create in Blender */
-
- blmat = copy_material( self->material ); /* first copy the Material Data in Blender */
-
- if( blmat ) /* now create the wrapper obj in Python */
- pymat = ( BPy_Material * ) Material_CreatePyObject( blmat );
- else
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't create Material Data in Blender" ) );
-
- blmat->id.us = 0; /* was incref'ed by add_material() above */
-
- if( pymat == NULL )
- return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create Material Data object" ) );
-
- return ( PyObject * ) pymat;
-}
-
-/* mat_a==mat_b or mat_a!=mat_b*/
-static int Material_compare( BPy_Material * a, BPy_Material * b )
-{
- return ( a->material == b->material) ? 0 : -1;
-}
-
-/*****************************************************************************/
-/* Function: Material_repr */
-/* Description: This is a callback function for the BPy_Material type. It */
-/* builds a meaninful string to represent material objects. */
-/*****************************************************************************/
-static PyObject *Material_repr( BPy_Material * self )
-{
- return PyString_FromFormat( "[Material \"%s\"]",
- self->material->id.name + 2 );
-}
-
-/*****************************************************************************/
-/* These functions are used here and in in Texture.c */
-/*****************************************************************************/
-PyObject *EXPP_PyList_fromColorband( ColorBand *coba )
-{
- short i;
- PyObject *cbls;
- PyObject *colls;
-
- if (!coba)
- return PyList_New( 0 );
-
- cbls = PyList_New( coba->tot );
-
- for (i=0; i < coba->tot; i++) {
- colls = PyList_New( 5 );
- PyList_SET_ITEM( colls, 0, PyFloat_FromDouble(coba->data[i].r) );
- PyList_SET_ITEM( colls, 1, PyFloat_FromDouble(coba->data[i].g) );
- PyList_SET_ITEM( colls, 2, PyFloat_FromDouble(coba->data[i].b) );
- PyList_SET_ITEM( colls, 3, PyFloat_FromDouble(coba->data[i].a) );
- PyList_SET_ITEM( colls, 4, PyFloat_FromDouble(coba->data[i].pos) );
- PyList_SET_ITEM(cbls, i, colls);
- }
- return cbls;
-}
-
-/* make sure you coba is not none before calling this */
-int EXPP_Colorband_fromPyList( ColorBand **coba, PyObject * value )
-{
- short totcol, i;
- PyObject *colseq;
- PyObject *pyflt;
- float f;
-
- if ( !PySequence_Check( value ) )
- return ( EXPP_ReturnIntError( PyExc_TypeError,
- "Colorband must be a sequence" ) );
-
- totcol = PySequence_Size(value);
- if ( totcol > 31)
- return ( EXPP_ReturnIntError( PyExc_ValueError,
- "Colorband must be between 1 and 31 in length" ) );
-
- if (totcol==0) {
- MEM_freeN(*coba);
- *coba = NULL;
- return 0;
- }
-
- if (!*coba)
- *coba = MEM_callocN( sizeof(ColorBand), "colorband");
-
- for (i=0; i<totcol; i++) {
- colseq = PySequence_GetItem( value, i );
- if ( !PySequence_Check( colseq ) || PySequence_Size( colseq ) != 5) {
- Py_DECREF ( colseq );
- return ( EXPP_ReturnIntError( PyExc_ValueError,
- "Colorband colors must be sequences of 5 floats" ) );
- }
- for (i=0; i<5; i++) {
- pyflt = PySequence_GetItem( colseq, i );
- if (!PyNumber_Check(pyflt)) {
- return ( EXPP_ReturnIntError( PyExc_ValueError,
- "Colorband colors must be sequences of 5 floats" ) );
- Py_DECREF ( pyflt );
- Py_DECREF ( colseq );
- }
- Py_DECREF ( pyflt );
- }
- Py_DECREF ( colseq );
- }
-
- /* ok, continue - should check for 5 floats, will ignore non floats for now */
- (*coba)->tot = totcol;
- for (i=0; i<totcol; i++) {
- colseq = PySequence_GetItem( value, i );
-
- pyflt = PySequence_GetItem( colseq, 0 );
- f = (float)PyFloat_AsDouble( pyflt );
- CLAMP(f, 0.0, 1.0);
- (*coba)->data[i].r = f;
- Py_DECREF ( pyflt );
-
- pyflt = PySequence_GetItem( colseq, 1 );
- f = (float)PyFloat_AsDouble( pyflt );
- CLAMP(f, 0.0, 1.0);
- (*coba)->data[i].g = f;
- Py_DECREF ( pyflt );
-
- pyflt = PySequence_GetItem( colseq, 2 );
- f = (float)PyFloat_AsDouble( pyflt );
- CLAMP(f, 0.0, 1.0);
- (*coba)->data[i].b = f;
- Py_DECREF ( pyflt );
-
- pyflt = PySequence_GetItem( colseq, 3 );
- f = (float)PyFloat_AsDouble( pyflt );
- CLAMP(f, 0.0, 1.0);
- (*coba)->data[i].a = f;
- Py_DECREF ( pyflt );
-
- pyflt = PySequence_GetItem( colseq, 4 );
- f = (float)PyFloat_AsDouble( pyflt );
- CLAMP(f, 0.0, 1.0);
- (*coba)->data[i].pos = f;
- Py_DECREF ( pyflt );
-
- Py_DECREF ( colseq );
- }
- return 0;
-}
-
-
-/*****************************************************************************/
-/* These functions are used in NMesh.c and Object.c */
-/*****************************************************************************/
-PyObject *EXPP_PyList_fromMaterialList( Material ** matlist, int len, int all )
-{
- PyObject *list;
- int i;
-
- list = PyList_New( 0 );
- if( !matlist )
- return list;
-
- for( i = 0; i < len; i++ ) {
- Material *mat = matlist[i];
- PyObject *ob;
-
- if( mat ) {
- ob = Material_CreatePyObject( mat );
- PyList_Append( list, ob );
- Py_DECREF( ob ); /* because Append increfs */
- } else if( all ) { /* return NULL mats (empty slots) as Py_None */
- PyList_Append( list, Py_None );
- }
- }
-
- return list;
-}
-
-Material **EXPP_newMaterialList_fromPyList( PyObject * list )
-{
- int i, len;
- BPy_Material *pymat = 0;
- Material *mat;
- Material **matlist;
-
- len = PySequence_Length( list );
- if( len > 16 )
- len = 16;
- else if( len <= 0 )
- return NULL;
-
- matlist = EXPP_newMaterialList( len );
-
- for( i = 0; i < len; i++ ) {
-
- pymat = ( BPy_Material * ) PySequence_GetItem( list, i );
-
- if( BPy_Material_Check( ( PyObject * ) pymat ) ) {
- mat = pymat->material;
- matlist[i] = mat;
- } else if( ( PyObject * ) pymat == Py_None ) {
- matlist[i] = NULL;
- } else { /* error; illegal type in material list */
- Py_DECREF( pymat );
- MEM_freeN( matlist );
- return NULL;
- }
-
- Py_DECREF( pymat );
- }
-
- return matlist;
-}
-
-Material **EXPP_newMaterialList( int len )
-{
- Material **matlist =
- ( Material ** ) MEM_mallocN( len * sizeof( Material * ),
- "MaterialList" );
-
- return matlist;
-}
-
-int EXPP_releaseMaterialList( Material ** matlist, int len )
-{
- int i;
- Material *mat;
-
- if( ( len < 0 ) || ( len > MAXMAT ) ) {
- printf( "illegal matindex!\n" );
- return 0;
- }
-
- for( i = 0; i < len; i++ ) {
- mat = matlist[i];
- if( mat ) {
- if( ( ( ID * ) mat )->us > 0 )
- ( ( ID * ) mat )->us--;
- else
- printf( "FATAL: material usage=0: %s",
- ( ( ID * ) mat )->name );
- }
- }
- MEM_freeN( matlist );
-
- return 1;
-}
-
-/** expands pointer array of length 'oldsize' to length 'newsize'.
- * A pointer to the (void *) array must be passed as first argument
- * The array pointer content can be NULL, in this case a new array of length
- * 'newsize' is created.
- */
-
-static int expandPtrArray( void **p, int oldsize, int newsize )
-{
- void *newarray;
-
- if( newsize < oldsize ) {
- return 0;
- }
- newarray = MEM_callocN( sizeof( void * ) * newsize, "PtrArray" );
- if( *p ) {
- memcpy( newarray, *p, sizeof( void * ) * oldsize );
- MEM_freeN( *p );
- }
- *p = newarray;
- return 1;
-}
-
-int EXPP_synchronizeMaterialLists( Object * object )
-{
- Material ***p_dataMaterials = give_matarar( object );
- short *nmaterials = give_totcolp( object );
- int result = 0;
-
- if( object->totcol > *nmaterials ) {
- /* More object mats than data mats */
- result = expandPtrArray( ( void * ) p_dataMaterials,
- *nmaterials, object->totcol );
- *nmaterials = object->totcol;
- } else {
- if( object->totcol < *nmaterials ) {
- /* More data mats than object mats */
- result = expandPtrArray( ( void * ) &object->mat,
- object->totcol, *nmaterials );
- object->totcol = (char)*nmaterials;
- }
- } /* else no synchronization needed, they are of equal length */
-
- return result; /* 1 if changed, 0 otherwise */
-}
-
-void EXPP_incr_mats_us( Material ** matlist, int len )
-{
- int i;
- Material *mat;
-
- if( len <= 0 )
- return;
-
- for( i = 0; i < len; i++ ) {
- mat = matlist[i];
- if( mat )
- mat->id.us++;
- }
-
- return;
-}
-
-static PyObject *Material_getColorComponent( BPy_Material * self,
- void * closure )
-{
- switch ( (int)closure ) {
- case EXPP_MAT_COMP_R:
- return PyFloat_FromDouble( ( double ) self->material->r );
- case EXPP_MAT_COMP_G:
- return PyFloat_FromDouble( ( double ) self->material->g );
- case EXPP_MAT_COMP_B:
- return PyFloat_FromDouble( ( double ) self->material->b );
- case EXPP_MAT_COMP_SPECR:
- return PyFloat_FromDouble( ( double ) self->material->specr );
- case EXPP_MAT_COMP_SPECG:
- return PyFloat_FromDouble( ( double ) self->material->specg );
- case EXPP_MAT_COMP_SPECB:
- return PyFloat_FromDouble( ( double ) self->material->specb );
- case EXPP_MAT_COMP_MIRR:
- return PyFloat_FromDouble( ( double ) self->material->mirr );
- case EXPP_MAT_COMP_MIRG:
- return PyFloat_FromDouble( ( double ) self->material->mirg );
- case EXPP_MAT_COMP_MIRB:
- return PyFloat_FromDouble( ( double ) self->material->mirb );
- case EXPP_MAT_COMP_SSSR:
- return PyFloat_FromDouble( ( double ) self->material->sss_col[0] );
- case EXPP_MAT_COMP_SSSG:
- return PyFloat_FromDouble( ( double ) self->material->sss_col[1] );
- case EXPP_MAT_COMP_SSSB:
- return PyFloat_FromDouble( ( double ) self->material->sss_col[2] );
- default:
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "unknown color component specified" );
- }
-}
-
-static PyObject *Material_getColorband( BPy_Material * self, void * type)
-{
- switch( (long)type ) {
- case 0: /* these are backwards, but that how it works */
- return EXPP_PyList_fromColorband( self->material->ramp_col );
- case 1:
- return EXPP_PyList_fromColorband( self->material->ramp_spec );
- }
- Py_RETURN_NONE;
-}
-
-int Material_setColorband( BPy_Material * self, PyObject * value, void * type)
-{
- switch( (long)type ) {
- case 0: /* these are backwards, but that how it works */
- return EXPP_Colorband_fromPyList( &self->material->ramp_col, value );
- case 1:
- return EXPP_Colorband_fromPyList( &self->material->ramp_spec, value );
- }
- return 0;
-}
-
-/* #####DEPRECATED###### */
-
-static PyObject *Matr_oldsetAdd( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setAdd );
-}
-
-static PyObject *Matr_oldsetAlpha( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setAlpha );
-}
-
-static PyObject *Matr_oldsetAmb( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setAmb );
-}
-
-static PyObject *Matr_oldsetDiffuseDarkness( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setDiffuseDarkness );
-}
-
-static PyObject *Matr_oldsetDiffuseShader( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setDiffuseShader );
-}
-
-static PyObject *Matr_oldsetDiffuseSize( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setDiffuseSize );
-}
-
-static PyObject *Matr_oldsetDiffuseSmooth( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setDiffuseSmooth );
-}
-
-static PyObject *Matr_oldsetEmit( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setEmit );
-}
-
-static PyObject *Matr_oldsetFilter( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setFilter );
-}
-
-static PyObject *Matr_oldsetFlareBoost( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setFlareBoost );
-}
-
-static PyObject *Matr_oldsetFlareSeed( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setFlareSeed );
-}
-
-static PyObject *Matr_oldsetFlareSize( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setFlareSize );
-}
-
-static PyObject *Matr_oldsetFresnelMirr( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setFresnelMirr );
-}
-
-static PyObject *Matr_oldsetFresnelMirrFac( BPy_Material * self,
- PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setFresnelMirrFac );
-}
-
-static PyObject *Matr_oldsetFresnelTrans( BPy_Material * self,
- PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setFresnelTrans );
-}
-
-static PyObject *Matr_oldsetFresnelTransFac( BPy_Material * self,
- PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setFresnelTransFac );
-}
-
-static PyObject *Matr_oldsetHaloSeed( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setHaloSeed );
-}
-
-static PyObject *Matr_oldsetHaloSize( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setHaloSize );
-}
-
-static PyObject *Matr_oldsetHardness( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setHardness );
-}
-
-static PyObject *Matr_oldsetIOR( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setIOR );
-}
-
-static PyObject *Matr_oldsetNFlares( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setNFlares );
-}
-
-static PyObject *Matr_oldsetNLines( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setNLines );
-}
-
-static PyObject *Matr_oldsetNRings( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setNRings );
-}
-
-static PyObject *Matr_oldsetNStars( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setNStars );
-}
-
-static PyObject *Matr_oldsetRayMirr( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setRayMirr );
-}
-
-static PyObject *Matr_oldsetRoughness( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setRoughness );
-}
-
-static PyObject *Matr_oldsetMirrDepth( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setMirrDepth );
-}
-
-static PyObject *Matr_oldsetRef( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setRef );
-}
-
-static PyObject *Matr_oldsetRefracIndex( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setRefracIndex );
-}
-
-static PyObject *Matr_oldsetRms( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setRms );
-}
-
-static PyObject *Matr_oldsetSpec( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setSpec );
-}
-
-static PyObject *Matr_oldsetSpecShader( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setSpecShader );
-}
-
-static PyObject *Matr_oldsetSpecSize( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setSpecSize );
-}
-
-static PyObject *Matr_oldsetSpecSmooth( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setSpecSmooth );
-}
-
-static PyObject *Matr_oldsetSpecTransp( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setSpecTransp );
-}
-
-static PyObject *Matr_oldsetSubSize( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setSubSize );
-}
-
-static PyObject *Matr_oldsetTranslucency( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setTranslucency );
-}
-
-static PyObject *Matr_oldsetTransDepth( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setTransDepth );
-}
-
-static PyObject *Matr_oldsetZOffset( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setZOffset );
-}
-
-static PyObject *Matr_oldsetRGBCol( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapperTuple( (void *)self, args,
- (setter)Material_setRGBCol );
-}
-
-static PyObject *Matr_oldsetSpecCol( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapperTuple( (void *)self, args,
- (setter)Material_setSpecCol );
-}
-
-static PyObject *Matr_oldsetMirCol( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapperTuple( (void *)self, args,
- (setter)Material_setMirCol );
-}
-
-
-/* Possible modes are traceable, shadow, shadeless, wire, vcolLight,
- * vcolPaint, halo, ztransp, zinvert, haloRings, env, haloLines,
- * onlyShadow, xalpha, star, faceTexture, haloTex, haloPuno, noMist,
- * haloShaded, haloFlare */
-
-static PyObject *Matr_oldsetMode( BPy_Material * self, PyObject * args )
-{
- unsigned int i, flag = 0, ok = 0;
- PyObject *value, *error;
- char *m[28] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL
- };
-
- /*
- * check for a single integer argument; do a quick check for now
- * that the value is not larger than double the highest flag bit
- */
-
- if ( (PySequence_Size( args ) == 1)
- && PyInt_Check ( PyTuple_GET_ITEM ( args , 0 ) )
- && PyArg_ParseTuple( args, "i", &flag )
- && (flag & MA_MODE_MASK ) == flag ) {
- ok = 1;
-
- /*
- * check for either an empty argument list, or up to 28 strings
- */
-
- } else if( PyArg_ParseTuple( args, "|ssssssssssssssssssssssssssss",
- &m[0], &m[1], &m[2], &m[3], &m[4], &m[5], &m[6],
- &m[7], &m[8], &m[9], &m[10], &m[11], &m[12],
- &m[13], &m[14], &m[15], &m[16], &m[17], &m[18],
- &m[19], &m[20], &m[21], &m[22], &m[23], &m[24],
- &m[25], &m[26], &m[27] ) ) {
- for( i = 0; i < 28; i++ ) {
- if( m[i] == NULL )
- break;
- if( strcmp( m[i], "Traceable" ) == 0 )
- flag |= MA_TRACEBLE;
- else if( strcmp( m[i], "Shadow" ) == 0 )
- flag |= MA_SHADOW;
- else if( strcmp( m[i], "Shadeless" ) == 0 )
- flag |= MA_SHLESS;
- else if( strcmp( m[i], "Wire" ) == 0 )
- flag |= MA_WIRE;
- else if( strcmp( m[i], "VColLight" ) == 0 )
- flag |= MA_VERTEXCOL;
- else if( strcmp( m[i], "VColPaint" ) == 0 )
- flag |= MA_VERTEXCOLP;
- else if( strcmp( m[i], "Halo" ) == 0 )
- flag |= MA_HALO;
- else if( strcmp( m[i], "ZTransp" ) == 0 )
- flag |= MA_ZTRA;
- else if( strcmp( m[i], "ZInvert" ) == 0 )
- flag |= MA_ZINV;
- else if( strcmp( m[i], "HaloRings" ) == 0 )
- flag |= MA_HALO_RINGS;
- else if( strcmp( m[i], "HaloLines" ) == 0 )
- flag |= MA_HALO_LINES;
- else if( strcmp( m[i], "OnlyShadow" ) == 0 )
- flag |= MA_ONLYSHADOW;
- else if( strcmp( m[i], "HaloXAlpha" ) == 0 )
- flag |= MA_HALO_XALPHA;
- else if( strcmp( m[i], "HaloStar" ) == 0 )
- flag |= MA_STAR;
- else if( strcmp( m[i], "TexFace" ) == 0 )
- flag |= MA_FACETEXTURE;
- else if( strcmp( m[i], "HaloTex" ) == 0 )
- flag |= MA_HALOTEX;
- else if( strcmp( m[i], "HaloPuno" ) == 0 )
- flag |= MA_HALOPUNO;
- else if( strcmp( m[i], "NoMist" ) == 0 )
- flag |= MA_NOMIST;
- else if( strcmp( m[i], "HaloShaded" ) == 0 )
- flag |= MA_HALO_SHADE;
- else if( strcmp( m[i], "HaloFlare" ) == 0 )
- flag |= MA_HALO_FLARE;
- else if( strcmp( m[i], "Radio" ) == 0 )
- flag |= MA_RADIO;
- /* ** Mirror ** */
- else if( strcmp( m[i], "RayMirr" ) == 0 )
- flag |= MA_RAYMIRROR;
- else if( strcmp( m[i], "ZTransp" ) == 0 )
- flag |= MA_ZTRA;
- else if( strcmp( m[i], "RayTransp" ) == 0 )
- flag |= MA_RAYTRANSP;
- else if( strcmp( m[i], "OnlyShadow" ) == 0 )
- flag |= MA_ONLYSHADOW;
- else if( strcmp( m[i], "NoMist" ) == 0 )
- flag |= MA_NOMIST;
- else if( strcmp( m[i], "Env" ) == 0 )
- flag |= MA_ENV;
- else
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "unknown Material mode argument" ) );
- }
- ok = 1;
- }
-
- /* if neither input method worked, then throw an exception */
-
- if ( ok == 0 )
- return ( EXPP_ReturnPyObjError
- ( PyExc_AttributeError,
- "expected nothing, an integer or up to 22 string argument(s)" ) );
- /* build tuple, call wrapper */
-
- value = Py_BuildValue("(i)", flag);
- error = EXPP_setterWrapper( (void *)self, value, (setter)Material_setMode );
- Py_DECREF ( value );
- return error;
-}
-
-static PyObject *Matr_oldsetIpo( BPy_Material * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Material_setIpo );
-}
-
-/*
- * clearIpo() returns True/False depending on whether material has an Ipo
- */
-
-static PyObject *Material_clearIpo( BPy_Material * self )
-{
- /* if Ipo defined, delete it and return true */
-
- if( self->material->ipo ) {
- PyObject *value = Py_BuildValue( "(O)", Py_None );
- EXPP_setterWrapper( (void *)self, value, (setter)Material_setIpo );
- Py_DECREF ( value );
- return EXPP_incr_ret_True();
- }
- return EXPP_incr_ret_False(); /* no ipo found */
-}
-
diff --git a/source/blender/python/api2_2x/Material.h b/source/blender/python/api2_2x/Material.h
deleted file mode 100644
index 18fc87ee803..00000000000
--- a/source/blender/python/api2_2x/Material.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * $Id: Material.h 10649 2007-05-04 03:23:40Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_MATERIAL_H
-#define EXPP_MATERIAL_H
-
-#include <Python.h>
-#include "DNA_object_types.h"
-#include "DNA_material_types.h"
-#include "DNA_texture_types.h" /* colorband */
-#include "rgbTuple.h"
-
-/*****************************************************************************/
-/* Python BPy_Material structure definition: */
-/*****************************************************************************/
-typedef struct {
- PyObject_HEAD
- Material * material; /* libdata must be second */
- BPy_rgbTuple *col, *amb, *spec, *mir, *sss;
-} BPy_Material;
-
-extern PyTypeObject Material_Type; /* The Material PyType Object */
-
-#define BPy_Material_Check(v) \
- ((v)->ob_type == &Material_Type) /* for type checking */
-
-/*****************************************************************************/
-/* Module Blender.Material - public functions */
-/*****************************************************************************/
-PyObject *M_Material_Init( void );
-
-PyObject *Material_Init( void );
-PyObject *Material_CreatePyObject( Material * mat );
-Material *Material_FromPyObject( PyObject * pyobj );
-
-/* colorband tp_getseters */
-PyObject *EXPP_PyList_fromColorband( ColorBand *coba );
-int EXPP_Colorband_fromPyList( ColorBand **coba, PyObject * value );
-
-/* Some functions needed by NMesh, Curve and friends */
-PyObject *EXPP_PyList_fromMaterialList( Material ** matlist, int len,
- int all );
-Material **EXPP_newMaterialList_fromPyList( PyObject * list );
-Material **EXPP_newMaterialList( int len );
-void EXPP_incr_mats_us( Material ** matlist, int len );
-int EXPP_synchronizeMaterialLists( Object * object );
-int EXPP_releaseMaterialList( Material ** matlist, int len );
-
-#endif /* EXPP_MATERIAL_H */
diff --git a/source/blender/python/api2_2x/Mathutils.c b/source/blender/python/api2_2x/Mathutils.c
deleted file mode 100644
index cf79b3071f7..00000000000
--- a/source/blender/python/api2_2x/Mathutils.c
+++ /dev/null
@@ -1,1804 +0,0 @@
-/*
- * $Id: Mathutils.c 11502 2007-08-06 14:27:08Z khughes $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Joseph Gilbert, Campbell Barton
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include "Mathutils.h"
-
-#include "BLI_arithb.h"
-#include "PIL_time.h"
-#include "BLI_rand.h"
-#include "BKE_utildefines.h"
-
-#include "gen_utils.h"
-
-//-------------------------DOC STRINGS ---------------------------
-static char M_Mathutils_doc[] = "The Blender Mathutils module\n\n";
-static char M_Mathutils_Vector_doc[] = "() - create a new vector object from a list of floats";
-static char M_Mathutils_Matrix_doc[] = "() - create a new matrix object from a list of floats";
-static char M_Mathutils_Quaternion_doc[] = "() - create a quaternion from a list or an axis of rotation and an angle";
-static char M_Mathutils_Euler_doc[] = "() - create and return a new euler object";
-static char M_Mathutils_Rand_doc[] = "() - return a random number";
-static char M_Mathutils_CrossVecs_doc[] = "() - returns a vector perpedicular to the 2 vectors crossed";
-static char M_Mathutils_CopyVec_doc[] = "() - create a copy of vector";
-static char M_Mathutils_DotVecs_doc[] = "() - return the dot product of two vectors";
-static char M_Mathutils_AngleBetweenVecs_doc[] = "() - returns the angle between two vectors in degrees";
-static char M_Mathutils_MidpointVecs_doc[] = "() - return the vector to the midpoint between two vectors";
-static char M_Mathutils_MatMultVec_doc[] = "() - multiplies a matrix by a column vector";
-static char M_Mathutils_VecMultMat_doc[] = "() - multiplies a row vector by a matrix";
-static char M_Mathutils_ProjectVecs_doc[] = "() - returns the projection vector from the projection of vecA onto vecB";
-static char M_Mathutils_RotationMatrix_doc[] = "() - construct a rotation matrix from an angle and axis of rotation";
-static char M_Mathutils_ScaleMatrix_doc[] = "() - construct a scaling matrix from a scaling factor";
-static char M_Mathutils_OrthoProjectionMatrix_doc[] = "() - construct a orthographic projection matrix from a selected plane";
-static char M_Mathutils_ShearMatrix_doc[] = "() - construct a shearing matrix from a plane of shear and a shear factor";
-static char M_Mathutils_CopyMat_doc[] = "() - create a copy of a matrix";
-static char M_Mathutils_TranslationMatrix_doc[] = "(vec) - create a translation matrix from a vector";
-static char M_Mathutils_CopyQuat_doc[] = "() - copy quatB to quatA";
-static char M_Mathutils_CopyEuler_doc[] = "() - copy eulB to eultA";
-static char M_Mathutils_CrossQuats_doc[] = "() - return the mutliplication of two quaternions";
-static char M_Mathutils_DotQuats_doc[] = "() - return the dot product of two quaternions";
-static char M_Mathutils_Slerp_doc[] = "() - returns the interpolation between two quaternions";
-static char M_Mathutils_DifferenceQuats_doc[] = "() - return the angular displacment difference between two quats";
-static char M_Mathutils_RotateEuler_doc[] = "() - rotate euler by an axis and angle";
-static char M_Mathutils_Intersect_doc[] = "(v1, v2, v3, ray, orig, clip=1) - returns the intersection between a ray and a triangle, if possible, returns None otherwise";
-static char M_Mathutils_TriangleArea_doc[] = "(v1, v2, v3) - returns the area size of the 2D or 3D triangle defined";
-static char M_Mathutils_TriangleNormal_doc[] = "(v1, v2, v3) - returns the normal of the 3D triangle defined";
-static char M_Mathutils_QuadNormal_doc[] = "(v1, v2, v3, v4) - returns the normal of the 3D quad defined";
-static char M_Mathutils_LineIntersect_doc[] = "(v1, v2, v3, v4) - returns a tuple with the points on each line respectively closest to the other";
-static char M_Mathutils_Point_doc[] = "Creates a 2d or 3d point object";
-//-----------------------METHOD DEFINITIONS ----------------------
-struct PyMethodDef M_Mathutils_methods[] = {
- {"Rand", (PyCFunction) M_Mathutils_Rand, METH_VARARGS, M_Mathutils_Rand_doc},
- {"Vector", (PyCFunction) M_Mathutils_Vector, METH_VARARGS, M_Mathutils_Vector_doc},
- {"CrossVecs", (PyCFunction) M_Mathutils_CrossVecs, METH_VARARGS, M_Mathutils_CrossVecs_doc},
- {"DotVecs", (PyCFunction) M_Mathutils_DotVecs, METH_VARARGS, M_Mathutils_DotVecs_doc},
- {"AngleBetweenVecs", (PyCFunction) M_Mathutils_AngleBetweenVecs, METH_VARARGS, M_Mathutils_AngleBetweenVecs_doc},
- {"MidpointVecs", (PyCFunction) M_Mathutils_MidpointVecs, METH_VARARGS, M_Mathutils_MidpointVecs_doc},
- {"VecMultMat", (PyCFunction) M_Mathutils_VecMultMat, METH_VARARGS, M_Mathutils_VecMultMat_doc},
- {"ProjectVecs", (PyCFunction) M_Mathutils_ProjectVecs, METH_VARARGS, M_Mathutils_ProjectVecs_doc},
- {"CopyVec", (PyCFunction) M_Mathutils_CopyVec, METH_VARARGS, M_Mathutils_CopyVec_doc},
- {"Matrix", (PyCFunction) M_Mathutils_Matrix, METH_VARARGS, M_Mathutils_Matrix_doc},
- {"RotationMatrix", (PyCFunction) M_Mathutils_RotationMatrix, METH_VARARGS, M_Mathutils_RotationMatrix_doc},
- {"ScaleMatrix", (PyCFunction) M_Mathutils_ScaleMatrix, METH_VARARGS, M_Mathutils_ScaleMatrix_doc},
- {"ShearMatrix", (PyCFunction) M_Mathutils_ShearMatrix, METH_VARARGS, M_Mathutils_ShearMatrix_doc},
- {"TranslationMatrix", (PyCFunction) M_Mathutils_TranslationMatrix, METH_O, M_Mathutils_TranslationMatrix_doc},
- {"CopyMat", (PyCFunction) M_Mathutils_CopyMat, METH_VARARGS, M_Mathutils_CopyMat_doc},
- {"OrthoProjectionMatrix", (PyCFunction) M_Mathutils_OrthoProjectionMatrix, METH_VARARGS, M_Mathutils_OrthoProjectionMatrix_doc},
- {"MatMultVec", (PyCFunction) M_Mathutils_MatMultVec, METH_VARARGS, M_Mathutils_MatMultVec_doc},
- {"Quaternion", (PyCFunction) M_Mathutils_Quaternion, METH_VARARGS, M_Mathutils_Quaternion_doc},
- {"CopyQuat", (PyCFunction) M_Mathutils_CopyQuat, METH_VARARGS, M_Mathutils_CopyQuat_doc},
- {"CrossQuats", (PyCFunction) M_Mathutils_CrossQuats, METH_VARARGS, M_Mathutils_CrossQuats_doc},
- {"DotQuats", (PyCFunction) M_Mathutils_DotQuats, METH_VARARGS, M_Mathutils_DotQuats_doc},
- {"DifferenceQuats", (PyCFunction) M_Mathutils_DifferenceQuats, METH_VARARGS,M_Mathutils_DifferenceQuats_doc},
- {"Slerp", (PyCFunction) M_Mathutils_Slerp, METH_VARARGS, M_Mathutils_Slerp_doc},
- {"Euler", (PyCFunction) M_Mathutils_Euler, METH_VARARGS, M_Mathutils_Euler_doc},
- {"CopyEuler", (PyCFunction) M_Mathutils_CopyEuler, METH_VARARGS, M_Mathutils_CopyEuler_doc},
- {"RotateEuler", (PyCFunction) M_Mathutils_RotateEuler, METH_VARARGS, M_Mathutils_RotateEuler_doc},
- {"Intersect", ( PyCFunction ) M_Mathutils_Intersect, METH_VARARGS, M_Mathutils_Intersect_doc},
- {"TriangleArea", ( PyCFunction ) M_Mathutils_TriangleArea, METH_VARARGS, M_Mathutils_TriangleArea_doc},
- {"TriangleNormal", ( PyCFunction ) M_Mathutils_TriangleNormal, METH_VARARGS, M_Mathutils_TriangleNormal_doc},
- {"QuadNormal", ( PyCFunction ) M_Mathutils_QuadNormal, METH_VARARGS, M_Mathutils_QuadNormal_doc},
- {"LineIntersect", ( PyCFunction ) M_Mathutils_LineIntersect, METH_VARARGS, M_Mathutils_LineIntersect_doc},
- {"Point", (PyCFunction) M_Mathutils_Point, METH_VARARGS, M_Mathutils_Point_doc},
- {NULL, NULL, 0, NULL}
-};
-//----------------------------MODULE INIT-------------------------
-PyObject *Mathutils_Init(void)
-{
- PyObject *submodule;
-
- //seed the generator for the rand function
- BLI_srand((unsigned int) (PIL_check_seconds_timer() *
- 0x7FFFFFFF));
-
- /* needed for getseters */
- if( PyType_Ready( &vector_Type ) < 0 )
- return NULL;
- if( PyType_Ready( &matrix_Type ) < 0 )
- return NULL;
- if( PyType_Ready( &euler_Type ) < 0 )
- return NULL;
- if( PyType_Ready( &quaternion_Type ) < 0 )
- return NULL;
-
- submodule = Py_InitModule3("Blender.Mathutils",
- M_Mathutils_methods, M_Mathutils_doc);
- return (submodule);
-}
-//-----------------------------METHODS----------------------------
-//----------------column_vector_multiplication (internal)---------
-//COLUMN VECTOR Multiplication (Matrix X Vector)
-// [1][2][3] [a]
-// [4][5][6] * [b]
-// [7][8][9] [c]
-//vector/matrix multiplication IS NOT COMMUTATIVE!!!!
-PyObject *column_vector_multiplication(MatrixObject * mat, VectorObject* vec)
-{
- float vecNew[4], vecCopy[4];
- double dot = 0.0f;
- int x, y, z = 0;
-
- if(mat->rowSize != vec->size){
- if(mat->rowSize == 4 && vec->size != 3){
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "matrix * vector: matrix row size and vector size must be the same");
- }else{
- vecCopy[3] = 1.0f;
- }
- }
-
- for(x = 0; x < vec->size; x++){
- vecCopy[x] = vec->vec[x];
- }
-
- 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;
- dot = 0.0f;
- }
- return newVectorObject(vecNew, vec->size, Py_NEW);
-}
-//This is a helper for point/matrix translation
-
-PyObject *column_point_multiplication(MatrixObject * mat, PointObject* pt)
-{
- float ptNew[4], ptCopy[4];
- double dot = 0.0f;
- int x, y, z = 0;
-
- if(mat->rowSize != pt->size){
- if(mat->rowSize == 4 && pt->size != 3){
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "matrix * point: matrix row size and point size must be the same\n");
- }else{
- ptCopy[3] = 0.0f;
- }
- }
-
- for(x = 0; x < pt->size; x++){
- ptCopy[x] = pt->coord[x];
- }
-
- for(x = 0; x < mat->rowSize; x++) {
- for(y = 0; y < mat->colSize; y++) {
- dot += mat->matrix[x][y] * ptCopy[y];
- }
- ptNew[z++] = (float)dot;
- dot = 0.0f;
- }
- return newPointObject(ptNew, pt->size, Py_NEW);
-}
-//-----------------row_vector_multiplication (internal)-----------
-//ROW VECTOR Multiplication - Vector X Matrix
-//[x][y][z] * [1][2][3]
-// [4][5][6]
-// [7][8][9]
-//vector/matrix multiplication IS NOT COMMUTATIVE!!!!
-PyObject *row_vector_multiplication(VectorObject* vec, MatrixObject * mat)
-{
- float vecNew[4], vecCopy[4];
- double dot = 0.0f;
- int x, y, z = 0, vec_size = vec->size;
-
- if(mat->colSize != vec_size){
- if(mat->rowSize == 4 && vec_size != 3){
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "vector * matrix: matrix column size and the vector size must be the same");
- }else{
- vecCopy[3] = 1.0f;
- }
- }
-
- for(x = 0; x < vec_size; x++){
- vecCopy[x] = vec->vec[x];
- }
-
- //muliplication
- for(x = 0; x < mat->colSize; x++) {
- for(y = 0; y < mat->rowSize; y++) {
- dot += mat->matrix[y][x] * vecCopy[y];
- }
- vecNew[z++] = (float)dot;
- dot = 0.0f;
- }
- return newVectorObject(vecNew, vec_size, Py_NEW);
-}
-//This is a helper for the point class
-PyObject *row_point_multiplication(PointObject* pt, MatrixObject * mat)
-{
- float ptNew[4], ptCopy[4];
- double dot = 0.0f;
- int x, y, z = 0, size;
-
- if(mat->colSize != pt->size){
- if(mat->rowSize == 4 && pt->size != 3){
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "point * matrix: matrix column size and the point size must be the same\n");
- }else{
- ptCopy[3] = 0.0f;
- }
- }
- size = pt->size;
- for(x = 0; x < pt->size; x++){
- ptCopy[x] = pt->coord[x];
- }
-
- //muliplication
- for(x = 0; x < mat->colSize; x++) {
- for(y = 0; y < mat->rowSize; y++) {
- dot += mat->matrix[y][x] * ptCopy[y];
- }
- ptNew[z++] = (float)dot;
- dot = 0.0f;
- }
- return newPointObject(ptNew, size, Py_NEW);
-}
-//-----------------quat_rotation (internal)-----------
-//This function multiplies a vector/point * quat or vice versa
-//to rotate the point/vector by the quaternion
-//arguments should all be 3D
-PyObject *quat_rotation(PyObject *arg1, PyObject *arg2)
-{
- float rot[3];
- QuaternionObject *quat = NULL;
- VectorObject *vec = NULL;
- PointObject *pt = NULL;
-
- if(QuaternionObject_Check(arg1)){
- quat = (QuaternionObject*)arg1;
- if(VectorObject_Check(arg2)){
- vec = (VectorObject*)arg2;
- rot[0] = quat->quat[0]*quat->quat[0]*vec->vec[0] + 2*quat->quat[2]*quat->quat[0]*vec->vec[2] -
- 2*quat->quat[3]*quat->quat[0]*vec->vec[1] + quat->quat[1]*quat->quat[1]*vec->vec[0] +
- 2*quat->quat[2]*quat->quat[1]*vec->vec[1] + 2*quat->quat[3]*quat->quat[1]*vec->vec[2] -
- quat->quat[3]*quat->quat[3]*vec->vec[0] - quat->quat[2]*quat->quat[2]*vec->vec[0];
- rot[1] = 2*quat->quat[1]*quat->quat[2]*vec->vec[0] + quat->quat[2]*quat->quat[2]*vec->vec[1] +
- 2*quat->quat[3]*quat->quat[2]*vec->vec[2] + 2*quat->quat[0]*quat->quat[3]*vec->vec[0] -
- quat->quat[3]*quat->quat[3]*vec->vec[1] + quat->quat[0]*quat->quat[0]*vec->vec[1] -
- 2*quat->quat[1]*quat->quat[0]*vec->vec[2] - quat->quat[1]*quat->quat[1]*vec->vec[1];
- rot[2] = 2*quat->quat[1]*quat->quat[3]*vec->vec[0] + 2*quat->quat[2]*quat->quat[3]*vec->vec[1] +
- quat->quat[3]*quat->quat[3]*vec->vec[2] - 2*quat->quat[0]*quat->quat[2]*vec->vec[0] -
- quat->quat[2]*quat->quat[2]*vec->vec[2] + 2*quat->quat[0]*quat->quat[1]*vec->vec[1] -
- quat->quat[1]*quat->quat[1]*vec->vec[2] + quat->quat[0]*quat->quat[0]*vec->vec[2];
- return newVectorObject(rot, 3, Py_NEW);
- }else if(PointObject_Check(arg2)){
- pt = (PointObject*)arg2;
- rot[0] = quat->quat[0]*quat->quat[0]*pt->coord[0] + 2*quat->quat[2]*quat->quat[0]*pt->coord[2] -
- 2*quat->quat[3]*quat->quat[0]*pt->coord[1] + quat->quat[1]*quat->quat[1]*pt->coord[0] +
- 2*quat->quat[2]*quat->quat[1]*pt->coord[1] + 2*quat->quat[3]*quat->quat[1]*pt->coord[2] -
- quat->quat[3]*quat->quat[3]*pt->coord[0] - quat->quat[2]*quat->quat[2]*pt->coord[0];
- rot[1] = 2*quat->quat[1]*quat->quat[2]*pt->coord[0] + quat->quat[2]*quat->quat[2]*pt->coord[1] +
- 2*quat->quat[3]*quat->quat[2]*pt->coord[2] + 2*quat->quat[0]*quat->quat[3]*pt->coord[0] -
- quat->quat[3]*quat->quat[3]*pt->coord[1] + quat->quat[0]*quat->quat[0]*pt->coord[1] -
- 2*quat->quat[1]*quat->quat[0]*pt->coord[2] - quat->quat[1]*quat->quat[1]*pt->coord[1];
- rot[2] = 2*quat->quat[1]*quat->quat[3]*pt->coord[0] + 2*quat->quat[2]*quat->quat[3]*pt->coord[1] +
- quat->quat[3]*quat->quat[3]*pt->coord[2] - 2*quat->quat[0]*quat->quat[2]*pt->coord[0] -
- quat->quat[2]*quat->quat[2]*pt->coord[2] + 2*quat->quat[0]*quat->quat[1]*pt->coord[1] -
- quat->quat[1]*quat->quat[1]*pt->coord[2] + quat->quat[0]*quat->quat[0]*pt->coord[2];
- return newPointObject(rot, 3, Py_NEW);
- }
- }else if(VectorObject_Check(arg1)){
- vec = (VectorObject*)arg1;
- if(QuaternionObject_Check(arg2)){
- quat = (QuaternionObject*)arg2;
- rot[0] = quat->quat[0]*quat->quat[0]*vec->vec[0] + 2*quat->quat[2]*quat->quat[0]*vec->vec[2] -
- 2*quat->quat[3]*quat->quat[0]*vec->vec[1] + quat->quat[1]*quat->quat[1]*vec->vec[0] +
- 2*quat->quat[2]*quat->quat[1]*vec->vec[1] + 2*quat->quat[3]*quat->quat[1]*vec->vec[2] -
- quat->quat[3]*quat->quat[3]*vec->vec[0] - quat->quat[2]*quat->quat[2]*vec->vec[0];
- rot[1] = 2*quat->quat[1]*quat->quat[2]*vec->vec[0] + quat->quat[2]*quat->quat[2]*vec->vec[1] +
- 2*quat->quat[3]*quat->quat[2]*vec->vec[2] + 2*quat->quat[0]*quat->quat[3]*vec->vec[0] -
- quat->quat[3]*quat->quat[3]*vec->vec[1] + quat->quat[0]*quat->quat[0]*vec->vec[1] -
- 2*quat->quat[1]*quat->quat[0]*vec->vec[2] - quat->quat[1]*quat->quat[1]*vec->vec[1];
- rot[2] = 2*quat->quat[1]*quat->quat[3]*vec->vec[0] + 2*quat->quat[2]*quat->quat[3]*vec->vec[1] +
- quat->quat[3]*quat->quat[3]*vec->vec[2] - 2*quat->quat[0]*quat->quat[2]*vec->vec[0] -
- quat->quat[2]*quat->quat[2]*vec->vec[2] + 2*quat->quat[0]*quat->quat[1]*vec->vec[1] -
- quat->quat[1]*quat->quat[1]*vec->vec[2] + quat->quat[0]*quat->quat[0]*vec->vec[2];
- return newVectorObject(rot, 3, Py_NEW);
- }
- }else if(PointObject_Check(arg1)){
- pt = (PointObject*)arg1;
- if(QuaternionObject_Check(arg2)){
- quat = (QuaternionObject*)arg2;
- rot[0] = quat->quat[0]*quat->quat[0]*pt->coord[0] + 2*quat->quat[2]*quat->quat[0]*pt->coord[2] -
- 2*quat->quat[3]*quat->quat[0]*pt->coord[1] + quat->quat[1]*quat->quat[1]*pt->coord[0] +
- 2*quat->quat[2]*quat->quat[1]*pt->coord[1] + 2*quat->quat[3]*quat->quat[1]*pt->coord[2] -
- quat->quat[3]*quat->quat[3]*pt->coord[0] - quat->quat[2]*quat->quat[2]*pt->coord[0];
- rot[1] = 2*quat->quat[1]*quat->quat[2]*pt->coord[0] + quat->quat[2]*quat->quat[2]*pt->coord[1] +
- 2*quat->quat[3]*quat->quat[2]*pt->coord[2] + 2*quat->quat[0]*quat->quat[3]*pt->coord[0] -
- quat->quat[3]*quat->quat[3]*pt->coord[1] + quat->quat[0]*quat->quat[0]*pt->coord[1] -
- 2*quat->quat[1]*quat->quat[0]*pt->coord[2] - quat->quat[1]*quat->quat[1]*pt->coord[1];
- rot[2] = 2*quat->quat[1]*quat->quat[3]*pt->coord[0] + 2*quat->quat[2]*quat->quat[3]*pt->coord[1] +
- quat->quat[3]*quat->quat[3]*pt->coord[2] - 2*quat->quat[0]*quat->quat[2]*pt->coord[0] -
- quat->quat[2]*quat->quat[2]*pt->coord[2] + 2*quat->quat[0]*quat->quat[1]*pt->coord[1] -
- quat->quat[1]*quat->quat[1]*pt->coord[2] + quat->quat[0]*quat->quat[0]*pt->coord[2];
- return newPointObject(rot, 3, Py_NEW);
- }
- }
-
- return (EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "quat_rotation(internal): internal problem rotating vector/point\n"));
-}
-
-//----------------------------------Mathutils.Rand() --------------------
-//returns a random number between a high and low value
-PyObject *M_Mathutils_Rand(PyObject * self, PyObject * args)
-{
- float high, low, range;
- double rand;
- //initializers
- high = 1.0;
- low = 0.0;
-
- if(!PyArg_ParseTuple(args, "|ff", &low, &high))
- return (EXPP_ReturnPyObjError(PyExc_TypeError,
- "Mathutils.Rand(): expected nothing or optional (float, float)\n"));
-
- if((high < low) || (high < 0 && low > 0))
- return (EXPP_ReturnPyObjError(PyExc_ValueError,
- "Mathutils.Rand(): high value should be larger than low value\n"));
-
- //get the random number 0 - 1
- rand = BLI_drand();
-
- //set it to range
- range = high - low;
- rand = rand * range;
- rand = rand + low;
-
- return PyFloat_FromDouble(rand);
-}
-//----------------------------------VECTOR FUNCTIONS---------------------
-//----------------------------------Mathutils.Vector() ------------------
-// Supports 2D, 3D, and 4D vector objects both int and float values
-// accepted. Mixed float and int values accepted. Ints are parsed to float
-PyObject *M_Mathutils_Vector(PyObject * self, PyObject * args)
-{
- PyObject *listObject = NULL;
- int size, i;
- float vec[4];
- PyObject *v, *f;
-
- size = PySequence_Length(args);
- if (size == 1) {
- listObject = PySequence_GetItem(args, 0);
- if (PySequence_Check(listObject)) {
- size = PySequence_Length(listObject);
- } else { // Single argument was not a sequence
- Py_XDECREF(listObject);
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Mathutils.Vector(): 2-4 floats or ints expected (optionally in a sequence)\n");
- }
- } else if (size == 0) {
- //returns a new empty 3d vector
- return newVectorObject(NULL, 3, Py_NEW);
- } else {
- listObject = EXPP_incr_ret(args);
- }
-
- if (size<2 || size>4) { // Invalid vector size
- Py_XDECREF(listObject);
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Mathutils.Vector(): 2-4 floats or ints expected (optionally in a sequence)\n");
- }
-
- for (i=0; i<size; i++) {
- v=PySequence_GetItem(listObject, i);
- if (v==NULL) { // Failed to read sequence
- Py_XDECREF(listObject);
- return EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "Mathutils.Vector(): 2-4 floats or ints expected (optionally in a sequence)\n");
- }
-
- f=PyNumber_Float(v);
- if(f==NULL) { // parsed item not a number
- Py_DECREF(v);
- Py_XDECREF(listObject);
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Mathutils.Vector(): 2-4 floats or ints expected (optionally in a sequence)\n");
- }
-
- vec[i]=(float)PyFloat_AS_DOUBLE(f);
- EXPP_decr2(f,v);
- }
- Py_DECREF(listObject);
- return newVectorObject(vec, size, Py_NEW);
-}
-//----------------------------------Mathutils.CrossVecs() ---------------
-//finds perpendicular vector - only 3D is supported
-PyObject *M_Mathutils_CrossVecs(PyObject * self, PyObject * args)
-{
- PyObject *vecCross = NULL;
- VectorObject *vec1 = NULL, *vec2 = NULL;
-
- if(!PyArg_ParseTuple(args, "O!O!", &vector_Type, &vec1, &vector_Type, &vec2))
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Mathutils.CrossVecs(): expects (2) 3D vector objects\n");
- if(vec1->size != 3 || vec2->size != 3)
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Mathutils.CrossVecs(): expects (2) 3D vector objects\n");
-
- vecCross = newVectorObject(NULL, 3, Py_NEW);
- Crossf(((VectorObject*)vecCross)->vec, vec1->vec, vec2->vec);
- return vecCross;
-}
-//----------------------------------Mathutils.DotVec() -------------------
-//calculates the dot product of two vectors
-PyObject *M_Mathutils_DotVecs(PyObject * self, PyObject * args)
-{
- VectorObject *vec1 = NULL, *vec2 = NULL;
- double dot = 0.0f;
- int x;
-
- if(!PyArg_ParseTuple(args, "O!O!", &vector_Type, &vec1, &vector_Type, &vec2))
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Mathutils.DotVecs(): expects (2) vector objects of the same size\n");
- if(vec1->size != vec2->size)
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Mathutils.DotVecs(): expects (2) vector objects of the same size\n");
-
- for(x = 0; x < vec1->size; x++) {
- dot += vec1->vec[x] * vec2->vec[x];
- }
- return PyFloat_FromDouble(dot);
-}
-//----------------------------------Mathutils.AngleBetweenVecs() ---------
-//calculates the angle between 2 vectors
-PyObject *M_Mathutils_AngleBetweenVecs(PyObject * self, PyObject * args)
-{
- VectorObject *vec1 = NULL, *vec2 = NULL;
- double dot = 0.0f, angleRads, test_v1 = 0.0f, test_v2 = 0.0f;
- int x, size;
-
- if(!PyArg_ParseTuple(args, "O!O!", &vector_Type, &vec1, &vector_Type, &vec2))
- goto AttributeError1; //not vectors
- if(vec1->size != vec2->size)
- goto AttributeError1; //bad sizes
-
- //since size is the same....
- size = vec1->size;
-
- for(x = 0; x < size; x++) {
- test_v1 += vec1->vec[x] * vec1->vec[x];
- test_v2 += vec2->vec[x] * vec2->vec[x];
- }
- if (!test_v1 || !test_v2){
- goto AttributeError2; //zero-length vector
- }
-
- //dot product
- for(x = 0; x < size; x++) {
- dot += vec1->vec[x] * vec2->vec[x];
- }
- dot /= (sqrt(test_v1) * sqrt(test_v2));
-
- if (dot < -1.0f || dot > 1.0f) {
- CLAMP(dot,-1.0f,1.0f);
- }
- angleRads = (double)acos(dot);
-
- return PyFloat_FromDouble(angleRads * (180/ Py_PI));
-
-AttributeError1:
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Mathutils.AngleBetweenVecs(): expects (2) VECTOR objects of the same size\n");
-
-AttributeError2:
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Mathutils.AngleBetweenVecs(): zero length vectors are not acceptable arguments\n");
-}
-//----------------------------------Mathutils.MidpointVecs() -------------
-//calculates the midpoint between 2 vectors
-PyObject *M_Mathutils_MidpointVecs(PyObject * self, PyObject * args)
-{
- VectorObject *vec1 = NULL, *vec2 = NULL;
- float vec[4];
- int x;
-
- if(!PyArg_ParseTuple(args, "O!O!", &vector_Type, &vec1, &vector_Type, &vec2))
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Mathutils.MidpointVecs(): expects (2) vector objects of the same size\n");
- if(vec1->size != vec2->size)
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Mathutils.MidpointVecs(): expects (2) vector objects of the same size\n");
-
- for(x = 0; x < vec1->size; x++) {
- vec[x] = 0.5f * (vec1->vec[x] + vec2->vec[x]);
- }
- return newVectorObject(vec, vec1->size, Py_NEW);
-}
-//----------------------------------Mathutils.ProjectVecs() -------------
-//projects vector 1 onto vector 2
-PyObject *M_Mathutils_ProjectVecs(PyObject * self, PyObject * args)
-{
- VectorObject *vec1 = NULL, *vec2 = NULL;
- float vec[4];
- double dot = 0.0f, dot2 = 0.0f;
- int x, size;
-
- if(!PyArg_ParseTuple(args, "O!O!", &vector_Type, &vec1, &vector_Type, &vec2))
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Mathutils.ProjectVecs(): expects (2) vector objects of the same size\n");
- if(vec1->size != vec2->size)
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Mathutils.ProjectVecs(): expects (2) vector objects of the same size\n");
-
- //since they are the same size...
- size = vec1->size;
-
- //get dot products
- for(x = 0; x < size; x++) {
- dot += vec1->vec[x] * vec2->vec[x];
- dot2 += vec2->vec[x] * vec2->vec[x];
- }
- //projection
- dot /= dot2;
- for(x = 0; x < size; x++) {
- vec[x] = (float)(dot * vec2->vec[x]);
- }
- return newVectorObject(vec, size, Py_NEW);
-}
-//----------------------------------MATRIX FUNCTIONS--------------------
-//----------------------------------Mathutils.Matrix() -----------------
-//mat is a 1D array of floats - row[0][0],row[0][1], row[1][0], etc.
-//create a new matrix type
-PyObject *M_Mathutils_Matrix(PyObject * self, PyObject * args)
-{
- PyObject *listObject = NULL;
- PyObject *argObject, *m, *s, *f;
- MatrixObject *mat;
- int argSize, seqSize = 0, i, j;
- float matrix[16] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
-
- argSize = PySequence_Length(args);
- if(argSize > 4){ //bad arg nums
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Mathutils.Matrix(): expects 0-4 numeric sequences of the same size\n");
- } else if (argSize == 0) { //return empty 4D matrix
- return (PyObject *) newMatrixObject(NULL, 4, 4, Py_NEW);
- }else if (argSize == 1){
- //copy constructor for matrix objects
- argObject = PySequence_GetItem(args, 0);
- if(MatrixObject_Check(argObject)){
- mat = (MatrixObject*)argObject;
-
- argSize = mat->rowSize; //rows
- seqSize = mat->colSize; //col
- for(i = 0; i < (seqSize * argSize); i++){
- matrix[i] = mat->contigPtr[i];
- }
- }
- Py_DECREF(argObject);
- }else{ //2-4 arguments (all seqs? all same size?)
- for(i =0; i < argSize; i++){
- argObject = PySequence_GetItem(args, i);
- if (PySequence_Check(argObject)) { //seq?
- if(seqSize){ //0 at first
- if(PySequence_Length(argObject) != seqSize){ //seq size not same
- Py_DECREF(argObject);
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Mathutils.Matrix(): expects 0-4 numeric sequences of the same size\n");
- }
- }
- seqSize = PySequence_Length(argObject);
- }else{ //arg not a sequence
- Py_XDECREF(argObject);
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Mathutils.Matrix(): expects 0-4 numeric sequences of the same size\n");
- }
- Py_DECREF(argObject);
- }
- //all is well... let's continue parsing
- listObject = args;
- for (i = 0; i < argSize; i++){
- m = PySequence_GetItem(listObject, i);
- if (m == NULL) { // Failed to read sequence
- return EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "Mathutils.Matrix(): failed to parse arguments...\n");
- }
-
- for (j = 0; j < seqSize; j++) {
- s = PySequence_GetItem(m, j);
- if (s == NULL) { // Failed to read sequence
- Py_DECREF(m);
- return EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "Mathutils.Matrix(): failed to parse arguments...\n");
- }
-
- f = PyNumber_Float(s);
- if(f == NULL) { // parsed item is not a number
- EXPP_decr2(m,s);
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Mathutils.Matrix(): expects 0-4 numeric sequences of the same size\n");
- }
-
- matrix[(seqSize*i)+j]=(float)PyFloat_AS_DOUBLE(f);
- EXPP_decr2(f,s);
- }
- Py_DECREF(m);
- }
- }
- return newMatrixObject(matrix, argSize, seqSize, Py_NEW);
-}
-//----------------------------------Mathutils.RotationMatrix() ----------
-//mat is a 1D array of floats - row[0][0],row[0][1], row[1][0], etc.
-//creates a rotation matrix
-PyObject *M_Mathutils_RotationMatrix(PyObject * self, PyObject * args)
-{
- VectorObject *vec = NULL;
- char *axis = NULL;
- int matSize;
- float angle = 0.0f, norm = 0.0f, cosAngle = 0.0f, sinAngle = 0.0f;
- float mat[16] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
-
- if(!PyArg_ParseTuple
- (args, "fi|sO!", &angle, &matSize, &axis, &vector_Type, &vec)) {
- return EXPP_ReturnPyObjError (PyExc_TypeError,
- "Mathutils.RotationMatrix(): expected float int and optional string and vector\n");
- }
-
- /* Clamp to -360:360 */
- while (angle<-360.0f)
- angle+=360.0;
- while (angle>360.0f)
- angle-=360.0;
-
- if(matSize != 2 && matSize != 3 && matSize != 4)
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Mathutils.RotationMatrix(): can only return a 2x2 3x3 or 4x4 matrix\n");
- if(matSize == 2 && (axis != NULL || vec != NULL))
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Mathutils.RotationMatrix(): cannot create a 2x2 rotation matrix around arbitrary axis\n");
- if((matSize == 3 || matSize == 4) && axis == NULL)
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Mathutils.RotationMatrix(): please choose an axis of rotation for 3d and 4d matrices\n");
- if(axis) {
- if(((strcmp(axis, "r") == 0) ||
- (strcmp(axis, "R") == 0)) && vec == NULL)
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Mathutils.RotationMatrix(): please define the arbitrary axis of rotation\n");
- }
- if(vec) {
- if(vec->size != 3)
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Mathutils.RotationMatrix(): the arbitrary axis must be a 3D vector\n");
- }
- //convert to radians
- angle = angle * (float) (Py_PI / 180);
- if(axis == NULL && matSize == 2) {
- //2D rotation matrix
- mat[0] = (float) cos (angle);
- mat[1] = (float) sin (angle);
- mat[2] = -((float) sin(angle));
- mat[3] = (float) cos(angle);
- } else if((strcmp(axis, "x") == 0) || (strcmp(axis, "X") == 0)) {
- //rotation around X
- mat[0] = 1.0f;
- mat[4] = (float) cos(angle);
- mat[5] = (float) sin(angle);
- mat[7] = -((float) sin(angle));
- mat[8] = (float) cos(angle);
- } else if((strcmp(axis, "y") == 0) || (strcmp(axis, "Y") == 0)) {
- //rotation around Y
- mat[0] = (float) cos(angle);
- mat[2] = -((float) sin(angle));
- mat[4] = 1.0f;
- mat[6] = (float) sin(angle);
- mat[8] = (float) cos(angle);
- } else if((strcmp(axis, "z") == 0) || (strcmp(axis, "Z") == 0)) {
- //rotation around Z
- mat[0] = (float) cos(angle);
- mat[1] = (float) sin(angle);
- mat[3] = -((float) sin(angle));
- mat[4] = (float) cos(angle);
- mat[8] = 1.0f;
- } else if((strcmp(axis, "r") == 0) || (strcmp(axis, "R") == 0)) {
- //arbitrary rotation
- //normalize arbitrary axis
- norm = (float) sqrt(vec->vec[0] * vec->vec[0] +
- vec->vec[1] * vec->vec[1] +
- vec->vec[2] * vec->vec[2]);
- vec->vec[0] /= norm;
- vec->vec[1] /= norm;
- vec->vec[2] /= norm;
-
- //create matrix
- cosAngle = (float) cos(angle);
- sinAngle = (float) sin(angle);
- mat[0] = ((vec->vec[0] * vec->vec[0]) * (1 - cosAngle)) +
- cosAngle;
- mat[1] = ((vec->vec[0] * vec->vec[1]) * (1 - cosAngle)) +
- (vec->vec[2] * sinAngle);
- mat[2] = ((vec->vec[0] * vec->vec[2]) * (1 - cosAngle)) -
- (vec->vec[1] * sinAngle);
- mat[3] = ((vec->vec[0] * vec->vec[1]) * (1 - cosAngle)) -
- (vec->vec[2] * sinAngle);
- mat[4] = ((vec->vec[1] * vec->vec[1]) * (1 - cosAngle)) +
- cosAngle;
- mat[5] = ((vec->vec[1] * vec->vec[2]) * (1 - cosAngle)) +
- (vec->vec[0] * sinAngle);
- mat[6] = ((vec->vec[0] * vec->vec[2]) * (1 - cosAngle)) +
- (vec->vec[1] * sinAngle);
- mat[7] = ((vec->vec[1] * vec->vec[2]) * (1 - cosAngle)) -
- (vec->vec[0] * sinAngle);
- mat[8] = ((vec->vec[2] * vec->vec[2]) * (1 - cosAngle)) +
- cosAngle;
- } else {
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Mathutils.RotationMatrix(): unrecognizable axis of rotation type - expected x,y,z or r\n");
- }
- if(matSize == 4) {
- //resize matrix
- mat[10] = mat[8];
- mat[9] = mat[7];
- mat[8] = mat[6];
- mat[7] = 0.0f;
- mat[6] = mat[5];
- mat[5] = mat[4];
- mat[4] = mat[3];
- mat[3] = 0.0f;
- }
- //pass to matrix creation
- return newMatrixObject(mat, matSize, matSize, Py_NEW);
-}
-//----------------------------------Mathutils.TranslationMatrix() -------
-//creates a translation matrix
-PyObject *M_Mathutils_TranslationMatrix(PyObject * self, VectorObject * vec)
-{
- float mat[16] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
-
- if(!VectorObject_Check(vec)) {
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Mathutils.TranslationMatrix(): expected vector\n");
- }
- if(vec->size != 3 && vec->size != 4) {
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Mathutils.TranslationMatrix(): vector must be 3D or 4D\n");
- }
- //create a identity matrix and add translation
- Mat4One((float(*)[4]) mat);
- mat[12] = vec->vec[0];
- mat[13] = vec->vec[1];
- mat[14] = vec->vec[2];
-
- return newMatrixObject(mat, 4, 4, Py_NEW);
-}
-//----------------------------------Mathutils.ScaleMatrix() -------------
-//mat is a 1D array of floats - row[0][0],row[0][1], row[1][0], etc.
-//creates a scaling matrix
-PyObject *M_Mathutils_ScaleMatrix(PyObject * self, PyObject * args)
-{
- VectorObject *vec = NULL;
- float norm = 0.0f, factor;
- int matSize, x;
- float mat[16] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
-
- if(!PyArg_ParseTuple
- (args, "fi|O!", &factor, &matSize, &vector_Type, &vec)) {
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Mathutils.ScaleMatrix(): expected float int and optional vector\n");
- }
- if(matSize != 2 && matSize != 3 && matSize != 4)
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Mathutils.ScaleMatrix(): can only return a 2x2 3x3 or 4x4 matrix\n");
- if(vec) {
- if(vec->size > 2 && matSize == 2)
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Mathutils.ScaleMatrix(): please use 2D vectors when scaling in 2D\n");
- }
- if(vec == NULL) { //scaling along axis
- if(matSize == 2) {
- mat[0] = factor;
- mat[3] = factor;
- } else {
- mat[0] = factor;
- mat[4] = factor;
- mat[8] = factor;
- }
- } else { //scaling in arbitrary direction
- //normalize arbitrary axis
- for(x = 0; x < vec->size; x++) {
- norm += vec->vec[x] * vec->vec[x];
- }
- norm = (float) sqrt(norm);
- for(x = 0; x < vec->size; x++) {
- vec->vec[x] /= norm;
- }
- if(matSize == 2) {
- mat[0] = 1 +((factor - 1) *(vec->vec[0] * vec->vec[0]));
- mat[1] =((factor - 1) *(vec->vec[0] * vec->vec[1]));
- mat[2] =((factor - 1) *(vec->vec[0] * vec->vec[1]));
- mat[3] = 1 + ((factor - 1) *(vec->vec[1] * vec->vec[1]));
- } else {
- mat[0] = 1 + ((factor - 1) *(vec->vec[0] * vec->vec[0]));
- mat[1] =((factor - 1) *(vec->vec[0] * vec->vec[1]));
- mat[2] =((factor - 1) *(vec->vec[0] * vec->vec[2]));
- mat[3] =((factor - 1) *(vec->vec[0] * vec->vec[1]));
- mat[4] = 1 + ((factor - 1) *(vec->vec[1] * vec->vec[1]));
- mat[5] =((factor - 1) *(vec->vec[1] * vec->vec[2]));
- mat[6] =((factor - 1) *(vec->vec[0] * vec->vec[2]));
- mat[7] =((factor - 1) *(vec->vec[1] * vec->vec[2]));
- mat[8] = 1 + ((factor - 1) *(vec->vec[2] * vec->vec[2]));
- }
- }
- if(matSize == 4) {
- //resize matrix
- mat[10] = mat[8];
- mat[9] = mat[7];
- mat[8] = mat[6];
- mat[7] = 0.0f;
- mat[6] = mat[5];
- mat[5] = mat[4];
- mat[4] = mat[3];
- mat[3] = 0.0f;
- }
- //pass to matrix creation
- return newMatrixObject(mat, matSize, matSize, Py_NEW);
-}
-//----------------------------------Mathutils.OrthoProjectionMatrix() ---
-//mat is a 1D array of floats - row[0][0],row[0][1], row[1][0], etc.
-//creates an ortho projection matrix
-PyObject *M_Mathutils_OrthoProjectionMatrix(PyObject * self, PyObject * args)
-{
- VectorObject *vec = NULL;
- char *plane;
- int matSize, x;
- float norm = 0.0f;
- float mat[16] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
-
- if(!PyArg_ParseTuple
- (args, "si|O!", &plane, &matSize, &vector_Type, &vec)) {
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Mathutils.OrthoProjectionMatrix(): expected string and int and optional vector\n");
- }
- if(matSize != 2 && matSize != 3 && matSize != 4)
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Mathutils.OrthoProjectionMatrix(): can only return a 2x2 3x3 or 4x4 matrix\n");
- if(vec) {
- if(vec->size > 2 && matSize == 2)
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Mathutils.OrthoProjectionMatrix(): please use 2D vectors when scaling in 2D\n");
- }
- if(vec == NULL) { //ortho projection onto cardinal plane
- if(((strcmp(plane, "x") == 0)
- || (strcmp(plane, "X") == 0)) && matSize == 2) {
- mat[0] = 1.0f;
- } else if(((strcmp(plane, "y") == 0)
- || (strcmp(plane, "Y") == 0))
- && matSize == 2) {
- mat[3] = 1.0f;
- } else if(((strcmp(plane, "xy") == 0)
- || (strcmp(plane, "XY") == 0))
- && matSize > 2) {
- mat[0] = 1.0f;
- mat[4] = 1.0f;
- } else if(((strcmp(plane, "xz") == 0)
- || (strcmp(plane, "XZ") == 0))
- && matSize > 2) {
- mat[0] = 1.0f;
- mat[8] = 1.0f;
- } else if(((strcmp(plane, "yz") == 0)
- || (strcmp(plane, "YZ") == 0))
- && matSize > 2) {
- mat[4] = 1.0f;
- mat[8] = 1.0f;
- } else {
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Mathutils.OrthoProjectionMatrix(): unknown plane - expected: x, y, xy, xz, yz\n");
- }
- } else { //arbitrary plane
- //normalize arbitrary axis
- for(x = 0; x < vec->size; x++) {
- norm += vec->vec[x] * vec->vec[x];
- }
- norm = (float) sqrt(norm);
- for(x = 0; x < vec->size; x++) {
- vec->vec[x] /= norm;
- }
- if(((strcmp(plane, "r") == 0)
- || (strcmp(plane, "R") == 0)) && matSize == 2) {
- mat[0] = 1 - (vec->vec[0] * vec->vec[0]);
- mat[1] = -(vec->vec[0] * vec->vec[1]);
- mat[2] = -(vec->vec[0] * vec->vec[1]);
- mat[3] = 1 - (vec->vec[1] * vec->vec[1]);
- } else if(((strcmp(plane, "r") == 0)
- || (strcmp(plane, "R") == 0))
- && matSize > 2) {
- mat[0] = 1 - (vec->vec[0] * vec->vec[0]);
- mat[1] = -(vec->vec[0] * vec->vec[1]);
- mat[2] = -(vec->vec[0] * vec->vec[2]);
- mat[3] = -(vec->vec[0] * vec->vec[1]);
- mat[4] = 1 - (vec->vec[1] * vec->vec[1]);
- mat[5] = -(vec->vec[1] * vec->vec[2]);
- mat[6] = -(vec->vec[0] * vec->vec[2]);
- mat[7] = -(vec->vec[1] * vec->vec[2]);
- mat[8] = 1 - (vec->vec[2] * vec->vec[2]);
- } else {
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Mathutils.OrthoProjectionMatrix(): unknown plane - expected: 'r' expected for axis designation\n");
- }
- }
- if(matSize == 4) {
- //resize matrix
- mat[10] = mat[8];
- mat[9] = mat[7];
- mat[8] = mat[6];
- mat[7] = 0.0f;
- mat[6] = mat[5];
- mat[5] = mat[4];
- mat[4] = mat[3];
- mat[3] = 0.0f;
- }
- //pass to matrix creation
- return newMatrixObject(mat, matSize, matSize, Py_NEW);
-}
-//----------------------------------Mathutils.ShearMatrix() -------------
-//creates a shear matrix
-PyObject *M_Mathutils_ShearMatrix(PyObject * self, PyObject * args)
-{
- int matSize;
- char *plane;
- float factor;
- float mat[16] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
-
- if(!PyArg_ParseTuple(args, "sfi", &plane, &factor, &matSize)) {
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Mathutils.ShearMatrix(): expected string float and int\n");
- }
- if(matSize != 2 && matSize != 3 && matSize != 4)
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Mathutils.ShearMatrix(): can only return a 2x2 3x3 or 4x4 matrix\n");
-
- if(((strcmp(plane, "x") == 0) || (strcmp(plane, "X") == 0))
- && matSize == 2) {
- mat[0] = 1.0f;
- mat[2] = factor;
- mat[3] = 1.0f;
- } else if(((strcmp(plane, "y") == 0)
- || (strcmp(plane, "Y") == 0)) && matSize == 2) {
- mat[0] = 1.0f;
- mat[1] = factor;
- mat[3] = 1.0f;
- } else if(((strcmp(plane, "xy") == 0)
- || (strcmp(plane, "XY") == 0)) && matSize > 2) {
- mat[0] = 1.0f;
- mat[4] = 1.0f;
- mat[6] = factor;
- mat[7] = factor;
- } else if(((strcmp(plane, "xz") == 0)
- || (strcmp(plane, "XZ") == 0)) && matSize > 2) {
- mat[0] = 1.0f;
- mat[3] = factor;
- mat[4] = 1.0f;
- mat[5] = factor;
- mat[8] = 1.0f;
- } else if(((strcmp(plane, "yz") == 0)
- || (strcmp(plane, "YZ") == 0)) && matSize > 2) {
- mat[0] = 1.0f;
- mat[1] = factor;
- mat[2] = factor;
- mat[4] = 1.0f;
- mat[8] = 1.0f;
- } else {
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Mathutils.ShearMatrix(): expected: x, y, xy, xz, yz or wrong matrix size for shearing plane\n");
- }
- if(matSize == 4) {
- //resize matrix
- mat[10] = mat[8];
- mat[9] = mat[7];
- mat[8] = mat[6];
- mat[7] = 0.0f;
- mat[6] = mat[5];
- mat[5] = mat[4];
- mat[4] = mat[3];
- mat[3] = 0.0f;
- }
- //pass to matrix creation
- return newMatrixObject(mat, matSize, matSize, Py_NEW);
-}
-//----------------------------------QUATERNION FUNCTIONS-----------------
-//----------------------------------Mathutils.Quaternion() --------------
-PyObject *M_Mathutils_Quaternion(PyObject * self, PyObject * args)
-{
- PyObject *listObject = NULL, *n, *q, *f;
- int size, i;
- float quat[4];
- double norm = 0.0f, angle = 0.0f;
-
- size = PySequence_Length(args);
- if (size == 1 || size == 2) { //seq?
- listObject = PySequence_GetItem(args, 0);
- if (PySequence_Check(listObject)) {
- size = PySequence_Length(listObject);
- if ((size == 4 && PySequence_Length(args) !=1) ||
- (size == 3 && PySequence_Length(args) !=2) || (size >4 || size < 3)) {
- // invalid args/size
- Py_DECREF(listObject);
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Mathutils.Quaternion(): 4d numeric sequence expected or 3d vector and number\n");
- }
- if(size == 3){ //get angle in axis/angle
- n = PyNumber_Float(PySequence_GetItem(args, 1));
- if(n == NULL) { // parsed item not a number or getItem fail
- Py_DECREF(listObject);
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Mathutils.Quaternion(): 4d numeric sequence expected or 3d vector and number\n");
- }
- angle = PyFloat_AS_DOUBLE(n);
- Py_DECREF(n);
- }
- }else{
- listObject = PySequence_GetItem(args, 1);
- if (size>1 && PySequence_Check(listObject)) {
- size = PySequence_Length(listObject);
- if (size != 3) {
- // invalid args/size
- Py_DECREF(listObject);
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Mathutils.Quaternion(): 4d numeric sequence expected or 3d vector and number\n");
- }
- n = PyNumber_Float(PySequence_GetItem(args, 0));
- if(n == NULL) { // parsed item not a number or getItem fail
- Py_DECREF(listObject);
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Mathutils.Quaternion(): 4d numeric sequence expected or 3d vector and number\n");
- }
- angle = PyFloat_AS_DOUBLE(n);
- Py_DECREF(n);
- } else { // argument was not a sequence
- Py_XDECREF(listObject);
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Mathutils.Quaternion(): 4d numeric sequence expected or 3d vector and number\n");
- }
- }
- } else if (size == 0) { //returns a new empty quat
- return newQuaternionObject(NULL, Py_NEW);
- } else {
- listObject = EXPP_incr_ret(args);
- }
-
- if (size == 3) { // invalid quat size
- if(PySequence_Length(args) != 2){
- Py_DECREF(listObject);
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Mathutils.Quaternion(): 4d numeric sequence expected or 3d vector and number\n");
- }
- }else{
- if(size != 4){
- Py_DECREF(listObject);
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Mathutils.Quaternion(): 4d numeric sequence expected or 3d vector and number\n");
- }
- }
-
- for (i=0; i<size; i++) { //parse
- q = PySequence_GetItem(listObject, i);
- if (q == NULL) { // Failed to read sequence
- Py_DECREF(listObject);
- return EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "Mathutils.Quaternion(): 4d numeric sequence expected or 3d vector and number\n");
- }
-
- f = PyNumber_Float(q);
- if(f == NULL) { // parsed item not a number
- EXPP_decr2(q, listObject);
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Mathutils.Quaternion(): 4d numeric sequence expected or 3d vector and number\n");
- }
-
- quat[i] = (float)PyFloat_AS_DOUBLE(f);
- EXPP_decr2(f, q);
- }
- if(size == 3){ //calculate the quat based on axis/angle
- norm = sqrt(quat[0] * quat[0] + quat[1] * quat[1] + quat[2] * quat[2]);
- quat[0] /= (float)norm;
- quat[1] /= (float)norm;
- quat[2] /= (float)norm;
-
- angle = angle * (Py_PI / 180);
- quat[3] =(float) (sin(angle/ 2.0f)) * quat[2];
- quat[2] =(float) (sin(angle/ 2.0f)) * quat[1];
- quat[1] =(float) (sin(angle/ 2.0f)) * quat[0];
- quat[0] =(float) (cos(angle/ 2.0f));
- }
-
- Py_DECREF(listObject);
- return newQuaternionObject(quat, Py_NEW);
-}
-//----------------------------------Mathutils.CrossQuats() ----------------
-//quaternion multiplication - associate not commutative
-PyObject *M_Mathutils_CrossQuats(PyObject * self, PyObject * args)
-{
- QuaternionObject *quatU = NULL, *quatV = NULL;
- float quat[4];
-
- if(!PyArg_ParseTuple(args, "O!O!", &quaternion_Type, &quatU,
- &quaternion_Type, &quatV))
- return EXPP_ReturnPyObjError(PyExc_TypeError,"Mathutils.CrossQuats(): expected Quaternion types");
- QuatMul(quat, quatU->quat, quatV->quat);
-
- return newQuaternionObject(quat, Py_NEW);
-}
-//----------------------------------Mathutils.DotQuats() ----------------
-//returns the dot product of 2 quaternions
-PyObject *M_Mathutils_DotQuats(PyObject * self, PyObject * args)
-{
- QuaternionObject *quatU = NULL, *quatV = NULL;
- double dot = 0.0f;
- int x;
-
- if(!PyArg_ParseTuple(args, "O!O!", &quaternion_Type, &quatU,
- &quaternion_Type, &quatV))
- return EXPP_ReturnPyObjError(PyExc_TypeError, "Mathutils.DotQuats(): expected Quaternion types");
-
- for(x = 0; x < 4; x++) {
- dot += quatU->quat[x] * quatV->quat[x];
- }
- return PyFloat_FromDouble(dot);
-}
-//----------------------------------Mathutils.DifferenceQuats() ---------
-//returns the difference between 2 quaternions
-PyObject *M_Mathutils_DifferenceQuats(PyObject * self, PyObject * args)
-{
- QuaternionObject *quatU = NULL, *quatV = NULL;
- float quat[4], tempQuat[4];
- double dot = 0.0f;
- int x;
-
- if(!PyArg_ParseTuple(args, "O!O!", &quaternion_Type,
- &quatU, &quaternion_Type, &quatV))
- return EXPP_ReturnPyObjError(PyExc_TypeError, "Mathutils.DifferenceQuats(): expected Quaternion types");
-
- tempQuat[0] = quatU->quat[0];
- tempQuat[1] = -quatU->quat[1];
- tempQuat[2] = -quatU->quat[2];
- tempQuat[3] = -quatU->quat[3];
-
- dot = sqrt(tempQuat[0] * tempQuat[0] + tempQuat[1] * tempQuat[1] +
- tempQuat[2] * tempQuat[2] + tempQuat[3] * tempQuat[3]);
-
- for(x = 0; x < 4; x++) {
- tempQuat[x] /= (float)(dot * dot);
- }
- QuatMul(quat, tempQuat, quatV->quat);
- return newQuaternionObject(quat, Py_NEW);
-}
-//----------------------------------Mathutils.Slerp() ------------------
-//attemps to interpolate 2 quaternions and return the result
-PyObject *M_Mathutils_Slerp(PyObject * self, PyObject * args)
-{
- QuaternionObject *quatU = NULL, *quatV = NULL;
- float quat[4], quat_u[4], quat_v[4], param;
- double x, y, dot, sinT, angle, IsinT;
- int z;
-
- if(!PyArg_ParseTuple(args, "O!O!f", &quaternion_Type,
- &quatU, &quaternion_Type, &quatV, &param))
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Mathutils.Slerp(): expected Quaternion types and float");
-
- if(param > 1.0f || param < 0.0f)
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Mathutils.Slerp(): interpolation factor must be between 0.0 and 1.0");
-
- //copy quats
- for(z = 0; z < 4; z++){
- quat_u[z] = quatU->quat[z];
- quat_v[z] = quatV->quat[z];
- }
-
- //dot product
- dot = quat_u[0] * quat_v[0] + quat_u[1] * quat_v[1] +
- quat_u[2] * quat_v[2] + quat_u[3] * quat_v[3];
-
- //if negative negate a quat (shortest arc)
- if(dot < 0.0f) {
- quat_v[0] = -quat_v[0];
- quat_v[1] = -quat_v[1];
- quat_v[2] = -quat_v[2];
- quat_v[3] = -quat_v[3];
- dot = -dot;
- }
- if(dot > .99999f) { //very close
- x = 1.0f - param;
- y = param;
- } else {
- //calculate sin of angle
- sinT = sqrt(1.0f - (dot * dot));
- //calculate angle
- angle = atan2(sinT, dot);
- //caluculate inverse of sin(theta)
- IsinT = 1.0f / sinT;
- x = sin((1.0f - param) * angle) * IsinT;
- y = sin(param * angle) * IsinT;
- }
- //interpolate
- quat[0] = (float)(quat_u[0] * x + quat_v[0] * y);
- quat[1] = (float)(quat_u[1] * x + quat_v[1] * y);
- quat[2] = (float)(quat_u[2] * x + quat_v[2] * y);
- quat[3] = (float)(quat_u[3] * x + quat_v[3] * y);
-
- return newQuaternionObject(quat, Py_NEW);
-}
-//----------------------------------EULER FUNCTIONS----------------------
-//----------------------------------Mathutils.Euler() -------------------
-//makes a new euler for you to play with
-PyObject *M_Mathutils_Euler(PyObject * self, PyObject * args)
-{
-
- PyObject *listObject = NULL;
- int size, i;
- float eul[3];
- PyObject *e, *f;
-
- size = PySequence_Length(args);
- if (size == 1) {
- listObject = PySequence_GetItem(args, 0);
- if (PySequence_Check(listObject)) {
- size = PySequence_Length(listObject);
- } else { // Single argument was not a sequence
- Py_DECREF(listObject);
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Mathutils.Euler(): 3d numeric sequence expected\n");
- }
- } else if (size == 0) {
- //returns a new empty 3d euler
- return newEulerObject(NULL, Py_NEW);
- } else {
- listObject = EXPP_incr_ret(args);
- }
-
- if (size != 3) { // Invalid euler size
- Py_DECREF(listObject);
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Mathutils.Euler(): 3d numeric sequence expected\n");
- }
-
- for (i=0; i<size; i++) {
- e = PySequence_GetItem(listObject, i);
- if (e == NULL) { // Failed to read sequence
- Py_DECREF(listObject);
- return EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "Mathutils.Euler(): 3d numeric sequence expected\n");
- }
-
- f = PyNumber_Float(e);
- if(f == NULL) { // parsed item not a number
- EXPP_decr2(e, listObject);
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Mathutils.Euler(): 3d numeric sequence expected\n");
- }
-
- eul[i]=(float)PyFloat_AS_DOUBLE(f);
- EXPP_decr2(f,e);
- }
- Py_DECREF(listObject);
- return newEulerObject(eul, Py_NEW);
-}
-//----------------------------------POINT FUNCTIONS---------------------
-//----------------------------------Mathutils.Point() ------------------
-PyObject *M_Mathutils_Point(PyObject * self, PyObject * args)
-{
- PyObject *listObject = NULL;
- int size, i;
- float point[3];
- PyObject *v, *f;
-
- size = PySequence_Length(args);
- if (size == 1) {
- listObject = PySequence_GetItem(args, 0);
- if (PySequence_Check(listObject)) {
- size = PySequence_Length(listObject);
- } else { // Single argument was not a sequence
- Py_XDECREF(listObject);
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Mathutils.Point(): 2-3 floats or ints expected (optionally in a sequence)\n");
- }
- } else if (size == 0) {
- //returns a new empty 3d point
- return newPointObject(NULL, 3, Py_NEW);
- } else {
- listObject = EXPP_incr_ret(args);
- }
-
- if (size<2 || size>3) { // Invalid vector size
- Py_XDECREF(listObject);
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Mathutils.Point(): 2-3 floats or ints expected (optionally in a sequence)\n");
- }
-
- for (i=0; i<size; i++) {
- v=PySequence_GetItem(listObject, i);
- if (v==NULL) { // Failed to read sequence
- Py_XDECREF(listObject);
- return EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "Mathutils.Point(): 2-3 floats or ints expected (optionally in a sequence)\n");
- }
-
- f=PyNumber_Float(v);
- if(f==NULL) { // parsed item not a number
- Py_DECREF(v);
- Py_XDECREF(listObject);
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Mathutils.Point(): 2-3 floats or ints expected (optionally in a sequence)\n");
- }
-
- point[i]=(float)PyFloat_AS_DOUBLE(f);
- EXPP_decr2(f,v);
- }
- Py_DECREF(listObject);
- return newPointObject(point, size, Py_NEW);
-}
-//---------------------------------INTERSECTION FUNCTIONS--------------------
-//----------------------------------Mathutils.Intersect() -------------------
-PyObject *M_Mathutils_Intersect( PyObject * self, PyObject * args )
-{
- VectorObject *ray, *ray_off, *vec1, *vec2, *vec3;
- float dir[3], orig[3], v1[3], v2[3], v3[3], e1[3], e2[3], pvec[3], tvec[3], qvec[3];
- float det, inv_det, u, v, t;
- int clip = 1;
-
- if( !PyArg_ParseTuple
- ( args, "O!O!O!O!O!|i", &vector_Type, &vec1, &vector_Type, &vec2
- , &vector_Type, &vec3, &vector_Type, &ray, &vector_Type, &ray_off , &clip) )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError, "expected 5 vector types\n" ) );
- if( vec1->size != 3 || vec2->size != 3 || vec3->size != 3 ||
- ray->size != 3 || ray_off->size != 3)
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "only 3D vectors for all parameters\n" ) );
-
- VECCOPY(v1, vec1->vec);
- VECCOPY(v2, vec2->vec);
- VECCOPY(v3, vec3->vec);
-
- VECCOPY(dir, ray->vec);
- Normalize(dir);
-
- VECCOPY(orig, ray_off->vec);
-
- /* find vectors for two edges sharing v1 */
- VecSubf(e1, v2, v1);
- VecSubf(e2, v3, v1);
-
- /* begin calculating determinant - also used to calculated U parameter */
- Crossf(pvec, dir, e2);
-
- /* if determinant is near zero, ray lies in plane of triangle */
- det = Inpf(e1, pvec);
-
- if (det > -0.000001 && det < 0.000001) {
- return EXPP_incr_ret( Py_None );
- }
-
- inv_det = 1.0f / det;
-
- /* calculate distance from v1 to ray origin */
- VecSubf(tvec, orig, v1);
-
- /* calculate U parameter and test bounds */
- u = Inpf(tvec, pvec) * inv_det;
- if (clip && (u < 0.0f || u > 1.0f)) {
- return EXPP_incr_ret( Py_None );
- }
-
- /* prepare to test the V parameter */
- Crossf(qvec, tvec, e1);
-
- /* calculate V parameter and test bounds */
- v = Inpf(dir, qvec) * inv_det;
-
- if (clip && (v < 0.0f || u + v > 1.0f)) {
- return EXPP_incr_ret( Py_None );
- }
-
- /* calculate t, ray intersects triangle */
- t = Inpf(e2, qvec) * inv_det;
-
- VecMulf(dir, t);
- VecAddf(pvec, orig, dir);
-
- return newVectorObject(pvec, 3, Py_NEW);
-}
-//----------------------------------Mathutils.LineIntersect() -------------------
-/* Line-Line intersection using algorithm from mathworld.wolfram.com */
-PyObject *M_Mathutils_LineIntersect( PyObject * self, PyObject * args )
-{
- PyObject * tuple;
- VectorObject *vec1, *vec2, *vec3, *vec4;
- float v1[3], v2[3], v3[3], v4[3], i1[3], i2[3];
-
- if( !PyArg_ParseTuple
- ( args, "O!O!O!O!", &vector_Type, &vec1, &vector_Type, &vec2
- , &vector_Type, &vec3, &vector_Type, &vec4 ) )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError, "expected 4 vector types\n" ) );
- if( vec1->size != vec2->size || vec1->size != vec3->size || vec1->size != vec2->size)
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "vectors must be of the same size\n" ) );
-
- if( vec1->size == 3 || vec1->size == 2) {
- float a[3], b[3], c[3], ab[3], cb[3], dir1[3], dir2[3];
- float d;
- if (vec1->size == 3) {
- VECCOPY(v1, vec1->vec);
- VECCOPY(v2, vec2->vec);
- VECCOPY(v3, vec3->vec);
- VECCOPY(v4, vec4->vec);
- }
- else {
- v1[0] = vec1->vec[0];
- v1[1] = vec1->vec[1];
- v1[2] = 0.0f;
-
- v2[0] = vec2->vec[0];
- v2[1] = vec2->vec[1];
- v2[2] = 0.0f;
-
- v3[0] = vec3->vec[0];
- v3[1] = vec3->vec[1];
- v3[2] = 0.0f;
-
- v4[0] = vec4->vec[0];
- v4[1] = vec4->vec[1];
- v4[2] = 0.0f;
- }
-
- VecSubf(c, v3, v1);
- VecSubf(a, v2, v1);
- VecSubf(b, v4, v3);
-
- VECCOPY(dir1, a);
- Normalize(dir1);
- VECCOPY(dir2, b);
- Normalize(dir2);
- d = Inpf(dir1, dir2);
- if (d == 1.0f || d == -1.0f) {
- /* colinear */
- return EXPP_incr_ret( Py_None );
- }
-
- Crossf(ab, a, b);
- d = Inpf(c, ab);
-
- /* test if the two lines are coplanar */
- if (d > -0.000001f && d < 0.000001f) {
- Crossf(cb, c, b);
-
- VecMulf(a, Inpf(cb, ab) / Inpf(ab, ab));
- VecAddf(i1, v1, a);
- VECCOPY(i2, i1);
- }
- /* if not */
- else {
- float n[3], t[3];
- VecSubf(t, v1, v3);
-
- /* offset between both plane where the lines lies */
- Crossf(n, a, b);
- Projf(t, t, n);
-
- /* for the first line, offset the second line until it is coplanar */
- VecAddf(v3, v3, t);
- VecAddf(v4, v4, t);
-
- VecSubf(c, v3, v1);
- VecSubf(a, v2, v1);
- VecSubf(b, v4, v3);
-
- Crossf(ab, a, b);
- Crossf(cb, c, b);
-
- VecMulf(a, Inpf(cb, ab) / Inpf(ab, ab));
- VecAddf(i1, v1, a);
-
- /* for the second line, just substract the offset from the first intersection point */
- VecSubf(i2, i1, t);
- }
-
- tuple = PyTuple_New( 2 );
- PyTuple_SetItem( tuple, 0, newVectorObject(i1, vec1->size, Py_NEW) );
- PyTuple_SetItem( tuple, 1, newVectorObject(i2, vec1->size, Py_NEW) );
- return tuple;
- }
- else {
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "2D/3D vectors only\n" ) );
- }
-}
-
-
-
-//---------------------------------NORMALS FUNCTIONS--------------------
-//----------------------------------Mathutils.QuadNormal() -------------------
-PyObject *M_Mathutils_QuadNormal( PyObject * self, PyObject * args )
-{
- VectorObject *vec1;
- VectorObject *vec2;
- VectorObject *vec3;
- VectorObject *vec4;
- float v1[3], v2[3], v3[3], v4[3], e1[3], e2[3], n1[3], n2[3];
-
- if( !PyArg_ParseTuple
- ( args, "O!O!O!O!", &vector_Type, &vec1, &vector_Type, &vec2
- , &vector_Type, &vec3, &vector_Type, &vec4 ) )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError, "expected 4 vector types\n" ) );
- if( vec1->size != vec2->size || vec1->size != vec3->size || vec1->size != vec4->size)
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "vectors must be of the same size\n" ) );
- if( vec1->size != 3 )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "only 3D vectors\n" ) );
-
- VECCOPY(v1, vec1->vec);
- VECCOPY(v2, vec2->vec);
- VECCOPY(v3, vec3->vec);
- VECCOPY(v4, vec4->vec);
-
- /* find vectors for two edges sharing v2 */
- VecSubf(e1, v1, v2);
- VecSubf(e2, v3, v2);
-
- Crossf(n1, e2, e1);
- Normalize(n1);
-
- /* find vectors for two edges sharing v4 */
- VecSubf(e1, v3, v4);
- VecSubf(e2, v1, v4);
-
- Crossf(n2, e2, e1);
- Normalize(n2);
-
- /* adding and averaging the normals of both triangles */
- VecAddf(n1, n2, n1);
- Normalize(n1);
-
- return newVectorObject(n1, 3, Py_NEW);
-}
-
-//----------------------------Mathutils.TriangleNormal() -------------------
-PyObject *M_Mathutils_TriangleNormal( PyObject * self, PyObject * args )
-{
- VectorObject *vec1, *vec2, *vec3;
- float v1[3], v2[3], v3[3], e1[3], e2[3], n[3];
-
- if( !PyArg_ParseTuple
- ( args, "O!O!O!", &vector_Type, &vec1, &vector_Type, &vec2
- , &vector_Type, &vec3 ) )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError, "expected 3 vector types\n" ) );
- if( vec1->size != vec2->size || vec1->size != vec3->size )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "vectors must be of the same size\n" ) );
- if( vec1->size != 3 )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "only 3D vectors\n" ) );
-
- VECCOPY(v1, vec1->vec);
- VECCOPY(v2, vec2->vec);
- VECCOPY(v3, vec3->vec);
-
- /* find vectors for two edges sharing v2 */
- VecSubf(e1, v1, v2);
- VecSubf(e2, v3, v2);
-
- Crossf(n, e2, e1);
- Normalize(n);
-
- return newVectorObject(n, 3, Py_NEW);
-}
-
-//--------------------------------- AREA FUNCTIONS--------------------
-//----------------------------------Mathutils.TriangleArea() -------------------
-PyObject *M_Mathutils_TriangleArea( PyObject * self, PyObject * args )
-{
- VectorObject *vec1, *vec2, *vec3;
- float v1[3], v2[3], v3[3];
-
- if( !PyArg_ParseTuple
- ( args, "O!O!O!", &vector_Type, &vec1, &vector_Type, &vec2
- , &vector_Type, &vec3 ) )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError, "expected 3 vector types\n" ) );
- if( vec1->size != vec2->size || vec1->size != vec3->size )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "vectors must be of the same size\n" ) );
-
- if (vec1->size == 3) {
- VECCOPY(v1, vec1->vec);
- VECCOPY(v2, vec2->vec);
- VECCOPY(v3, vec3->vec);
-
- return PyFloat_FromDouble( AreaT3Dfl(v1, v2, v3) );
- }
- else if (vec1->size == 2) {
- v1[0] = vec1->vec[0];
- v1[1] = vec1->vec[1];
-
- v2[0] = vec2->vec[0];
- v2[1] = vec2->vec[1];
-
- v3[0] = vec3->vec[0];
- v3[1] = vec3->vec[1];
-
- return PyFloat_FromDouble( AreaF2Dfl(v1, v2, v3) );
- }
- else {
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "only 2D,3D vectors are supported\n" ) );
- }
-}
-//#############################DEPRECATED################################
-//#######################################################################
-//----------------------------------Mathutils.CopyMat() -----------------
-//copies a matrix into a new matrix
-PyObject *M_Mathutils_CopyMat(PyObject * self, PyObject * args)
-{
- PyObject *matrix = NULL;
- static char warning = 1;
-
- if( warning ) {
- printf("Mathutils.CopyMat(): deprecated :use Mathutils.Matrix() to copy matrices\n");
- --warning;
- }
-
- matrix = M_Mathutils_Matrix(self, args);
- if(matrix == NULL)
- return NULL; //error string already set if we get here
- else
- return matrix;
-}
-//----------------------------------Mathutils.CopyVec() -----------------
-//makes a new vector that is a copy of the input
-PyObject *M_Mathutils_CopyVec(PyObject * self, PyObject * args)
-{
- PyObject *vec = NULL;
- static char warning = 1;
-
- if( warning ) {
- printf("Mathutils.CopyVec(): Deprecated: use Mathutils.Vector() to copy vectors\n");
- --warning;
- }
-
- vec = M_Mathutils_Vector(self, args);
- if(vec == NULL)
- return NULL; //error string already set if we get here
- else
- return vec;
-}
-//----------------------------------Mathutils.CopyQuat() --------------
-//Copies a quaternion to a new quat
-PyObject *M_Mathutils_CopyQuat(PyObject * self, PyObject * args)
-{
- PyObject *quat = NULL;
- static char warning = 1;
-
- if( warning ) {
- printf("Mathutils.CopyQuat(): Deprecated: use Mathutils.Quaternion() to copy vectors\n");
- --warning;
- }
-
- quat = M_Mathutils_Quaternion(self, args);
- if(quat == NULL)
- return NULL; //error string already set if we get here
- else
- return quat;
-}
-//----------------------------------Mathutils.CopyEuler() ---------------
-//copies a euler to a new euler
-PyObject *M_Mathutils_CopyEuler(PyObject * self, PyObject * args)
-{
- PyObject *eul = NULL;
- static char warning = 1;
-
- if( warning ) {
- printf("Mathutils.CopyEuler(): deprecated:use Mathutils.Euler() to copy vectors\n");
- --warning;
- }
-
- eul = M_Mathutils_Euler(self, args);
- if(eul == NULL)
- return NULL; //error string already set if we get here
- else
- return eul;
-}
-//----------------------------------Mathutils.RotateEuler() ------------
-//rotates a euler a certain amount and returns the result
-//should return a unique euler rotation (i.e. no 720 degree pitches :)
-PyObject *M_Mathutils_RotateEuler(PyObject * self, PyObject * args)
-{
- EulerObject *Eul = NULL;
- float angle;
- char *axis;
- static char warning = 1;
-
- if( warning ) {
- printf("Mathutils.RotateEuler(): Deprecated:use Euler.rotate() to rotate a euler\n");
- --warning;
- }
-
- if(!PyArg_ParseTuple(args, "O!fs", &euler_Type, &Eul, &angle, &axis))
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Mathutils.RotateEuler(): expected euler type & float & string");
-
- Euler_Rotate(Eul, Py_BuildValue("fs", angle, axis));
- Py_RETURN_NONE;
-}
-//----------------------------------Mathutils.MatMultVec() --------------
-//COLUMN VECTOR Multiplication (Matrix X Vector)
-PyObject *M_Mathutils_MatMultVec(PyObject * self, PyObject * args)
-{
- MatrixObject *mat = NULL;
- VectorObject *vec = NULL;
- static char warning = 1;
-
- if( warning ) {
- printf("Mathutils.MatMultVec(): Deprecated: use matrix * vec to perform column vector multiplication\n");
- --warning;
- }
-
- //get pyObjects
- if(!PyArg_ParseTuple(args, "O!O!", &matrix_Type, &mat, &vector_Type, &vec))
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Mathutils.MatMultVec(): MatMultVec() expects a matrix and a vector object - in that order\n");
-
- return column_vector_multiplication(mat, vec);
-}
-//----------------------------------Mathutils.VecMultMat() ---------------
-//ROW VECTOR Multiplication - Vector X Matrix
-PyObject *M_Mathutils_VecMultMat(PyObject * self, PyObject * args)
-{
- MatrixObject *mat = NULL;
- VectorObject *vec = NULL;
- static char warning = 1;
-
- if( warning ) {
- printf("Mathutils.VecMultMat(): Deprecated: use vec * matrix to perform row vector multiplication\n");
- --warning;
- }
-
- //get pyObjects
- if(!PyArg_ParseTuple(args, "O!O!", &vector_Type, &vec, &matrix_Type, &mat))
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Mathutils.VecMultMat(): VecMultMat() expects a vector and matrix object - in that order\n");
-
- return row_vector_multiplication(vec, mat);
-}
-//#######################################################################
-//#############################DEPRECATED################################
diff --git a/source/blender/python/api2_2x/Mathutils.h b/source/blender/python/api2_2x/Mathutils.h
deleted file mode 100644
index 56d96d8f281..00000000000
--- a/source/blender/python/api2_2x/Mathutils.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * $Id: Mathutils.h 10943 2007-06-16 12:24:41Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Joseph Gilbert
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-//Include this file for access to vector, quat, matrix, euler, etc...
-
-#ifndef EXPP_Mathutils_H
-#define EXPP_Mathutils_H
-
-#include <Python.h>
-#include "vector.h"
-#include "matrix.h"
-#include "quat.h"
-#include "euler.h"
-#include "point.h"
-
-PyObject *Mathutils_Init( void );
-PyObject *row_vector_multiplication(VectorObject* vec, MatrixObject * mat);
-PyObject *column_vector_multiplication(MatrixObject * mat, VectorObject* vec);
-PyObject *row_point_multiplication(PointObject* pt, MatrixObject * mat);
-PyObject *column_point_multiplication(MatrixObject * mat, PointObject* pt);
-PyObject *quat_rotation(PyObject *arg1, PyObject *arg2);
-
-PyObject *M_Mathutils_Rand(PyObject * self, PyObject * args);
-PyObject *M_Mathutils_Vector(PyObject * self, PyObject * args);
-PyObject *M_Mathutils_CrossVecs(PyObject * self, PyObject * args);
-PyObject *M_Mathutils_DotVecs(PyObject * self, PyObject * args);
-PyObject *M_Mathutils_AngleBetweenVecs(PyObject * self, PyObject * args);
-PyObject *M_Mathutils_MidpointVecs(PyObject * self, PyObject * args);
-PyObject *M_Mathutils_ProjectVecs(PyObject * self, PyObject * args);
-PyObject *M_Mathutils_Matrix(PyObject * self, PyObject * args);
-PyObject *M_Mathutils_RotationMatrix(PyObject * self, PyObject * args);
-PyObject *M_Mathutils_TranslationMatrix(PyObject * self, VectorObject * value);
-PyObject *M_Mathutils_ScaleMatrix(PyObject * self, PyObject * args);
-PyObject *M_Mathutils_OrthoProjectionMatrix(PyObject * self, PyObject * args);
-PyObject *M_Mathutils_ShearMatrix(PyObject * self, PyObject * args);
-PyObject *M_Mathutils_Quaternion(PyObject * self, PyObject * args);
-PyObject *M_Mathutils_CrossQuats(PyObject * self, PyObject * args);
-PyObject *M_Mathutils_DotQuats(PyObject * self, PyObject * args);
-PyObject *M_Mathutils_DifferenceQuats(PyObject * self, PyObject * args);
-PyObject *M_Mathutils_Slerp(PyObject * self, PyObject * args);
-PyObject *M_Mathutils_Euler(PyObject * self, PyObject * args);
-PyObject *M_Mathutils_Intersect( PyObject * self, PyObject * args );
-PyObject *M_Mathutils_TriangleArea( PyObject * self, PyObject * args );
-PyObject *M_Mathutils_TriangleNormal( PyObject * self, PyObject * args );
-PyObject *M_Mathutils_QuadNormal( PyObject * self, PyObject * args );
-PyObject *M_Mathutils_LineIntersect( PyObject * self, PyObject * args );
-PyObject *M_Mathutils_Point(PyObject * self, PyObject * args);
-//DEPRECATED
-PyObject *M_Mathutils_CopyMat(PyObject * self, PyObject * args);
-PyObject *M_Mathutils_CopyVec(PyObject * self, PyObject * args);
-PyObject *M_Mathutils_CopyQuat(PyObject * self, PyObject * args);
-PyObject *M_Mathutils_CopyEuler(PyObject * self, PyObject * args);
-PyObject *M_Mathutils_RotateEuler(PyObject * self, PyObject * args);
-PyObject *M_Mathutils_MatMultVec(PyObject * self, PyObject * args);
-PyObject *M_Mathutils_VecMultMat(PyObject * self, PyObject * args);
-
-#endif /* EXPP_Mathutils_H */
diff --git a/source/blender/python/api2_2x/Mesh.c b/source/blender/python/api2_2x/Mesh.c
deleted file mode 100644
index 4424fd08ffd..00000000000
--- a/source/blender/python/api2_2x/Mesh.c
+++ /dev/null
@@ -1,8677 +0,0 @@
-/*
- * $Id: Mesh.c 12892 2007-12-15 17:41:13Z joeedh $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender, partially based on NMesh.c API.
- *
- * Contributor(s): Ken Hughes
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include "Mesh.h" /*This must come first*/
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_key_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_oops_types.h"
-#include "DNA_space_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_meta_types.h"
-#include "DNA_modifier_types.h"
-
-#include "BDR_editface.h" /* make_tfaces */
-#include "BDR_vpaint.h"
-#include "BDR_editobject.h"
-
-#include "BIF_editdeform.h"
-#include "BIF_editkey.h" /* insert_meshkey */
-#include "BIF_space.h" /* REMAKEIPO - insert_meshkey */
-#include "BIF_editview.h"
-#include "BIF_editmesh.h"
-#include "BIF_meshtools.h"
-
-#include "BKE_customdata.h"
-#include "BKE_deform.h"
-#include "BKE_displist.h"
-#include "BKE_mesh.h"
-#include "BKE_material.h"
-#include "BKE_main.h"
-#include "BKE_global.h"
-#include "BKE_library.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_object.h"
-#include "BKE_mball.h"
-#include "BKE_utildefines.h"
-#include "BKE_depsgraph.h"
-#include "BSE_edit.h" /* for countall(); */
-#include "BKE_curve.h" /* for copy_curve(); */
-#include "BKE_modifier.h" /* for modifier_new(), modifier_copyData(); */
-#include "BKE_idprop.h"
-
-#include "BLI_arithb.h"
-#include "BLI_blenlib.h"
-
-#include "blendef.h"
-#include "mydevice.h"
-#include "butspace.h" /* for mesh tools */
-#include "Object.h"
-#include "Key.h"
-#include "Image.h"
-#include "Material.h"
-#include "Mathutils.h"
-#include "IDProp.h"
-#include "meshPrimitive.h"
-#include "constant.h"
-#include "gen_utils.h"
-#include "gen_library.h"
-#include "multires.h"
-
-/* EXPP Mesh defines */
-
-#define MESH_SMOOTHRESH 30
-#define MESH_SMOOTHRESH_MIN 1
-#define MESH_SMOOTHRESH_MAX 80
-#define MESH_SUBDIV 1
-#define MESH_SUBDIV_MIN 0
-#define MESH_SUBDIV_MAX 6
-
-#define MESH_HASFACEUV 0
-#define MESH_HASMCOL 1
-#define MESH_HASVERTUV 2
-#define MESH_HASMULTIRES 3
-
-#define MESH_MULTIRES_LEVEL 0
-#define MESH_MULTIRES_EDGE 1
-#define MESH_MULTIRES_PIN 2
-#define MESH_MULTIRES_RENDER 3
-
-#define MESH_TOOL_TOSPHERE 0
-#define MESH_TOOL_VERTEXSMOOTH 1
-#define MESH_TOOL_FLIPNORM 2
-#define MESH_TOOL_SUBDIV 3
-#define MESH_TOOL_REMDOUB 4
-#define MESH_TOOL_FILL 5
-#define MESH_TOOL_RECALCNORM 6
-#define MESH_TOOL_TRI2QUAD 7
-#define MESH_TOOL_QUAD2TRI 8
-
-static PyObject *MVertSeq_CreatePyObject( Mesh * mesh );
-static PyObject *MFaceSeq_CreatePyObject( Mesh * mesh );
-static PyObject *MEdgeSeq_CreatePyObject( Mesh * mesh );
-static PyObject *MFace_CreatePyObject( Mesh * mesh, int i );
-static PyObject *MEdge_CreatePyObject( Mesh * mesh, int i );
-
-#define MFACE_VERT_BADRANGE_CHECK(me, face) ((int)face->v1 >= me->totvert || (int)face->v2 >= me->totvert || (int)face->v3 >= me->totvert || (int)face->v4 >= me->totvert)
-#define MEDGE_VERT_BADRANGE_CHECK(me, edge) ((int)edge->v1 >= me->totvert || (int)edge->v2 >= me->totvert)
-
-/************************************************************************
- *
- * internal utilities
- *
- ************************************************************************/
-
-/*
- * internal structures used for sorting edges and faces
- */
-
-typedef struct SrchEdges {
- unsigned int v[2]; /* indices for verts */
- unsigned char swap; /* non-zero if verts swapped */
- unsigned int index; /* index in original param list of this edge */
- /* (will be used by findEdges) */
-} SrchEdges;
-
-typedef struct SrchFaces {
- unsigned int v[4]; /* indices for verts */
- unsigned int index; /* index in original param list of this edge */
- unsigned char order; /* order of original verts, bitpacked */
-} SrchFaces;
-
-typedef struct FaceEdges {
- unsigned int v[2]; /* search key (vert indices) */
- unsigned int index; /* location in edge list */
- unsigned char sel; /* selection state */
-} FaceEdges;
-
-/*
- * compare edges by vertex indices
- */
-
-int medge_comp( const void *va, const void *vb )
-{
- const unsigned int *a = ((SrchEdges *)va)->v;
- const unsigned int *b = ((SrchEdges *)vb)->v;
-
- /* compare first index for differences */
-
- if (a[0] < b[0]) return -1;
- else if (a[0] > b[0]) return 1;
-
- /* if first indices equal, compare second index for differences */
-
- else if (a[1] < b[1]) return -1;
- else return (a[1] > b[1]);
-}
-
-/*
- * compare edges by insert list indices
- */
-
-int medge_index_comp( const void *va, const void *vb )
-{
- const SrchEdges *a = (SrchEdges *)va;
- const SrchEdges *b = (SrchEdges *)vb;
-
- /* compare list indices for differences */
-
- if (a->index < b->index) return -1;
- else return (a->index > b->index);
-}
-
-
-/*
- * compare faces by vertex indices
- */
-
-int mface_comp( const void *va, const void *vb )
-{
- const SrchFaces *a = va;
- const SrchFaces *b = vb;
- int i;
-
- /* compare indices, first to last, for differences */
- for( i = 0; i < 4; ++i ) {
- if( a->v[i] < b->v[i] )
- return -1;
- if( a->v[i] > b->v[i] )
- return 1;
- }
-
- /*
- * don't think this needs be done; if order is different then either
- * (a) the face is good, just reversed or has a different starting
- * vertex, or (b) face is bad (for 4 verts) and there's a "twist"
- */
-
-#if 0
- /* if all the same verts, compare their order */
- if( a->order < b->order )
- return -1;
- if( a->order > b->order )
- return 1;
-#endif
-
- return 0;
-}
-
-/*
- * compare faces by insert list indices
- */
-
-int mface_index_comp( const void *va, const void *vb )
-{
- const SrchFaces *a = va;
- const SrchFaces *b = vb;
-
- /* compare indices, first to last, for differences */
- if( a->index < b->index )
- return -1;
- if( a->index > b->index )
- return 1;
- return 0;
-}
-
-/*
- * compare edges by vertex indices
- */
-
-int faceedge_comp( const void *va, const void *vb )
-{
- const unsigned int *a = ((FaceEdges *)va)->v;
- const unsigned int *b = ((FaceEdges *)vb)->v;
-
- /* compare first index for differences */
-
- if (a[0] < b[0]) return -1;
- else if (a[0] > b[0]) return 1;
-
- /* if first indices equal, compare second index for differences */
-
- else if (a[1] < b[1]) return -1;
- else return (a[1] > b[1]);
-}
-
-/*
- * update the DAG for all objects linked to this mesh
- */
-
-static void mesh_update( Mesh * mesh )
-{
- Object_updateDag( (void *) mesh );
-}
-
-/*
- * delete vertices from mesh, then delete edges/keys/faces which used those
- * vertices
- *
- * Deletion is done by "smart compaction"; groups of verts/edges/faces which
- * remain in the list are copied to new list instead of one at a time. Since
- * Blender has no realloc we would have to copy things anyway, so there's no
- * point trying to fill empty entries with data from the end of the lists.
- *
- * vert_table is a lookup table for mapping old verts to new verts (after the
- * vextex list has deleted vertices removed). Each entry contains the
- * vertex's new index.
- */
-
-static void delete_verts( Mesh *mesh, unsigned int *vert_table, int to_delete )
-{
- /*
- * (1) allocate vertex table (initialize contents to 0)
- * (2) mark each vertex being deleted in vertex table (= UINT_MAX)
- * (3) update remaining table entries with "new" vertex index (after
- * compaction)
- * (4) allocate new vertex list
- * (5) do "smart copy" of vertices from old to new
- * * each moved vertex is entered into vertex table: if vertex i is
- * moving to index j in new list
- * vert_table[i] = j;
- * (6) if keys, do "smart copy" of keys
- * (7) process edge list
- * update vert index
- * delete edges which delete verts
- * (7) allocate new edge list
- * (8) do "smart copy" of edges
- * (9) allocate new face list
- * (10) do "smart copy" of face
- */
-
- unsigned int *tmpvert;
- CustomData vdata;
- int i, count, state, dstindex, totvert;
-
- totvert = mesh->totvert - to_delete;
- CustomData_copy( &mesh->vdata, &vdata, CD_MASK_MESH, CD_CALLOC, totvert );
-
- /*
- * do "smart compaction" of the table; find and copy groups of vertices
- * which are not being deleted
- */
-
- dstindex = 0;
- tmpvert = vert_table;
- count = 0;
- state = 1;
- for( i = 0; i < mesh->totvert; ++i, ++tmpvert ) {
- switch( state ) {
- case 0: /* skipping verts */
- if( *tmpvert == UINT_MAX ) {
- ++count;
- } else {
- count = 1;
- state = 1;
- }
- break;
- case 1: /* gathering verts */
- if( *tmpvert != UINT_MAX ) {
- ++count;
- } else {
- if( count ) {
- CustomData_copy_data( &mesh->vdata, &vdata, i-count,
- dstindex, count );
- dstindex += count;
- }
- count = 1;
- state = 0;
- }
- }
- }
-
- /* if we were gathering verts at the end of the loop, copy those */
- if( state && count )
- CustomData_copy_data( &mesh->vdata, &vdata, i-count, dstindex, count );
-
- /* delete old vertex list, install the new one, update vertex count */
- CustomData_free( &mesh->vdata, mesh->totvert );
- mesh->vdata = vdata;
- mesh->totvert = totvert;
- mesh_update_customdata_pointers( mesh );
-}
-
-static void delete_edges( Mesh *mesh, unsigned int *vert_table, int to_delete )
-{
- int i;
- MEdge *tmpedge;
-
- /* if not given, then mark and count edges to be deleted */
- if( !to_delete ) {
- tmpedge = mesh->medge;
- for( i = mesh->totedge; i-- ; ++tmpedge )
- if( vert_table[tmpedge->v1] == UINT_MAX ||
- vert_table[tmpedge->v2] == UINT_MAX ) {
- tmpedge->v1 = UINT_MAX;
- ++to_delete;
- }
- }
-
- /* if there are edges to delete, handle it */
- if( to_delete ) {
- CustomData edata;
- int count, state, dstindex, totedge;
-
- /* allocate new edge list and populate */
- totedge = mesh->totedge - to_delete;
- CustomData_copy( &mesh->edata, &edata, CD_MASK_MESH, CD_CALLOC, totedge);
-
- /*
- * do "smart compaction" of the edges; find and copy groups of edges
- * which are not being deleted
- */
-
- dstindex = 0;
- tmpedge = mesh->medge;
- count = 0;
- state = 1;
- for( i = 0; i < mesh->totedge; ++i, ++tmpedge ) {
- switch( state ) {
- case 0: /* skipping edges */
- if( tmpedge->v1 == UINT_MAX ) {
- ++count;
- } else {
- count = 1;
- state = 1;
- }
- break;
- case 1: /* gathering edges */
- if( tmpedge->v1 != UINT_MAX ) {
- ++count;
- } else {
- if( count ) {
- CustomData_copy_data( &mesh->edata, &edata, i-count,
- dstindex, count );
- dstindex += count;
- }
- count = 1;
- state = 0;
- }
- }
- /* if edge is good, update vertex indices */
- }
-
- /* copy any pending good edges */
- if( state && count )
- CustomData_copy_data( &mesh->edata, &edata, i-count, dstindex,
- count );
-
- /* delete old edge list, install the new one, update vertex count */
- CustomData_free( &mesh->edata, mesh->totedge );
- mesh->edata = edata;
- mesh->totedge = totedge;
- mesh_update_customdata_pointers( mesh );
- }
-
- /* if vertices were deleted, update edge's vertices */
- if( vert_table ) {
- tmpedge = mesh->medge;
- for( i = mesh->totedge; i--; ++tmpedge ) {
- tmpedge->v1 = vert_table[tmpedge->v1];
- tmpedge->v2 = vert_table[tmpedge->v2];
- }
- }
-}
-
-/*
-* Since all faces must have 3 or 4 verts, we can't have v3 or v4 be zero.
-* If that happens during the deletion, we have to shuffle the vertices
-* around; otherwise it can cause an Eeekadoodle or worse. If there are
-* texture faces as well, they have to be shuffled as well.
-*
-* (code borrowed from test_index_face() in mesh.c, but since we know the
-* faces already have correct number of vertices, this is a little faster)
-*/
-
-static void eeek_fix( MFace *mface, int len4 )
-{
- /* if 4 verts, then neither v3 nor v4 can be zero */
- if( len4 ) {
- if( !mface->v3 || !mface->v4 ) {
- SWAP( int, mface->v1, mface->v3 );
- SWAP( int, mface->v2, mface->v4 );
- }
- } else if( !mface->v3 ) {
- /* if 2 verts, then just v3 cannot be zero (v4 MUST be zero) */
- SWAP( int, mface->v1, mface->v2 );
- SWAP( int, mface->v2, mface->v3 );
- }
-}
-
-static void delete_faces( Mesh *mesh, unsigned int *vert_table, int to_delete )
-{
- int i;
- MFace *tmpface;
-
- /* if there are faces to delete, handle it */
- if( to_delete ) {
- CustomData fdata;
- int count, state, dstindex, totface;
-
- totface = mesh->totface - to_delete;
- CustomData_copy( &mesh->fdata, &fdata, CD_MASK_MESH, CD_CALLOC, totface );
-
- /*
- * do "smart compaction" of the faces; find and copy groups of faces
- * which are not being deleted
- */
-
- dstindex = 0;
- tmpface = mesh->mface;
-
- count = 0;
- state = 1;
- for( i = 0; i < mesh->totface; ++i ) {
- switch( state ) {
- case 0: /* skipping faces */
- if( tmpface->v1 == UINT_MAX ) {
- ++count;
- } else {
- count = 1;
- state = 1;
- }
- break;
- case 1: /* gathering faces */
- if( tmpface->v1 != UINT_MAX ) {
- ++count;
- } else {
- if( count ) {
- CustomData_copy_data( &mesh->fdata, &fdata, i-count,
- dstindex, count );
- dstindex += count;
- }
- count = 1;
- state = 0;
- }
- }
- ++tmpface;
- }
-
- /* if we were gathering faces at the end of the loop, copy those */
- if ( state && count )
- CustomData_copy_data( &mesh->fdata, &fdata, i-count, dstindex,
- count );
-
- /* delete old face list, install the new one, update face count */
-
- CustomData_free( &mesh->fdata, mesh->totface );
- mesh->fdata = fdata;
- mesh->totface = totface;
- mesh_update_customdata_pointers( mesh );
- }
-
- /* if vertices were deleted, update face's vertices */
- if( vert_table ) {
- tmpface = mesh->mface;
-
- for( i = 0; i<mesh->totface; ++i, ++tmpface ) {
- int len4 = tmpface->v4;
- tmpface->v1 = vert_table[tmpface->v1];
- tmpface->v2 = vert_table[tmpface->v2];
- tmpface->v3 = vert_table[tmpface->v3];
- if(len4)
- tmpface->v4 = vert_table[tmpface->v4];
- else
- tmpface->v4 = 0;
-
- test_index_face( tmpface, &mesh->fdata, i, len4? 4: 3);
- }
- }
-}
-
-/*
- * fill up vertex lookup table with old-to-new mappings
- *
- * returns the number of vertices marked for deletion
- */
-
-static unsigned int make_vertex_table( unsigned int *vert_table, int count )
-{
- int i;
- unsigned int *tmpvert = vert_table;
- unsigned int to_delete = 0;
- unsigned int new_index = 0;
-
- /* fill the lookup table with old->new index mappings */
- for( i = count; i; --i, ++tmpvert ) {
- if( *tmpvert == UINT_MAX ) {
- ++to_delete;
- } else {
- *tmpvert = new_index;
- ++new_index;
- }
- }
- return to_delete;
-}
-
-
-/************************************************************************
- *
- * Color attributes
- *
- ************************************************************************/
-
-/*
- * get a color attribute
- */
-
-static PyObject *MCol_getAttr( BPy_MCol * self, void *type )
-{
- unsigned char param;
-
- switch( (long)type ) {
- case 'R': /* these are backwards, but that how it works */
- param = self->color->b;
- break;
- case 'G':
- param = self->color->g;
- break;
- case 'B': /* these are backwards, but that how it works */
- param = self->color->r;
- break;
- case 'A':
- param = self->color->a;
- break;
- default:
- {
- char errstr[1024];
- sprintf( errstr, "undefined type '%d' in MCol_getAttr",
- (int)((long)type & 0xff));
- return EXPP_ReturnPyObjError( PyExc_RuntimeError, errstr );
- }
- }
-
- return PyInt_FromLong( param );
-}
-
-/*
- * set a color attribute
- */
-
-static int MCol_setAttr( BPy_MCol * self, PyObject * value, void * type )
-{
- unsigned char *param;
-
- switch( (long)type ) {
- case 'R': /* these are backwards, but that how it works */
- param = (unsigned char *)&self->color->b;
- break;
- case 'G':
- param = (unsigned char *)&self->color->g;
- break;
- case 'B': /* these are backwards, but that how it works */
- param = (unsigned char *)&self->color->r;
- break;
- case 'A':
- param = (unsigned char *)&self->color->a;
- break;
- default:
- {
- char errstr[1024];
- sprintf( errstr, "undefined type '%d' in MCol_setAttr",
- (int)((long)type & 0xff));
- return EXPP_ReturnIntError( PyExc_RuntimeError, errstr );
- }
- }
-
- return EXPP_setIValueClamped( value, param, 0, 255, 'b' );
-}
-
-/************************************************************************
- *
- * Python MCol_Type attributes get/set structure
- *
- ************************************************************************/
-
-static PyGetSetDef BPy_MCol_getseters[] = {
- {"r",
- (getter)MCol_getAttr, (setter)MCol_setAttr,
- "red component",
- (void *)'R'},
- {"g",
- (getter)MCol_getAttr, (setter)MCol_setAttr,
- "green component",
- (void *)'G'},
- {"b",
- (getter)MCol_getAttr, (setter)MCol_setAttr,
- "blue component",
- (void *)'B'},
- {"a",
- (getter)MCol_getAttr, (setter)MCol_setAttr,
- "alpha component",
- (void *)'A'},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-
-/*----------------------------object[]---------------------------
- sequence accessor (get)*/
-static PyObject *MCol_item(BPy_MCol * self, int i)
-{
- unsigned char param;
- switch (i) {
- case 0:
- param = self->color->b;
- break;
- case 1:
- param = self->color->g;
- break;
- case 2:
- param = self->color->r;
- break;
- case 3:
- param = self->color->a;
- break;
- default:
- return EXPP_ReturnPyObjError(PyExc_IndexError,
- "vector[index] = x: assignment index out of range\n");
- }
-
- return PyInt_FromLong( param );
-}
-
-/*----------------------------object[]-------------------------
- sequence accessor (set)*/
-static int MCol_ass_item(BPy_MCol * self, int i, PyObject * value)
-{
- unsigned char *param;
-
- switch (i) {
- case 0:
- param = (unsigned char *)&self->color->b; /* reversed? why */
- break;
- case 1:
- param = (unsigned char *)&self->color->g;
- break;
- case 2:
- param = (unsigned char *)&self->color->r; /* reversed? why */
- break;
- case 3:
- param = (unsigned char *)&self->color->a;
- break;
- default:
- {
- return EXPP_ReturnIntError( PyExc_RuntimeError, "Index out of range" );
- }
- }
- return EXPP_setIValueClamped( value, param, 0, 255, 'b' );
-}
-
-/************************************************************************
- *
- * Python MCol_Type methods
- *
- ************************************************************************/
-
-static PyObject *MCol_repr( BPy_MCol * self )
-{
- return PyString_FromFormat( "[MCol %d %d %d %d]",
- (int)self->color->b, (int)self->color->g,
- (int)self->color->r, (int)self->color->a );
-}
-
-/*-----------------PROTCOL DECLARATIONS--------------------------*/
-static PySequenceMethods MCol_SeqMethods = {
- (inquiry) NULL, /* sq_length */
- (binaryfunc) NULL, /* sq_concat */
- (intargfunc) NULL, /* sq_repeat */
- (intargfunc) MCol_item, /* sq_item */
- (intintargfunc) NULL, /* sq_slice */
- (intobjargproc) MCol_ass_item, /* sq_ass_item */
- (intintobjargproc) NULL, /* sq_ass_slice */
-};
-
-/************************************************************************
- *
- * Python MCol_Type structure definition
- *
- ************************************************************************/
-
-PyTypeObject MCol_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender MCol", /* char *tp_name; */
- sizeof( BPy_MCol ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL, /* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- NULL, /* cmpfunc tp_compare; */
- ( reprfunc ) MCol_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- &MCol_SeqMethods, /* 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; */
- 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, /* 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, /* 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 ***/
- NULL, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_MCol_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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 PyObject *MCol_CreatePyObject( MCol * color )
-{
- BPy_MCol *obj = PyObject_NEW( BPy_MCol, &MCol_Type );
-
- if( !obj )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyObject_New() failed" );
-
- obj->color = color;
- return (PyObject *)obj;
-}
-
-/************************************************************************
- *
- * BPy_MVert attributes
- *
- ************************************************************************/
-
-static MVert * MVert_get_pointer( BPy_MVert * self )
-{
- if( BPy_MVert_Check( self ) ) {
- if( self->index >= ((Mesh *)self->data)->totvert )
- return (MVert *)EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "MVert is no longer valid" );
- return &((Mesh *)self->data)->mvert[self->index];
- }
- else
- return (MVert *)self->data;
-}
-
-/*
- * get a vertex's coordinate
- */
-
-static PyObject *MVert_getCoord( BPy_MVert * self )
-{
- MVert *v;
-
- v = MVert_get_pointer( self );
- if( !v )
- return NULL;
-
- return newVectorObject( v->co, 3, Py_WRAP );
-}
-
-/*
- * set a vertex's coordinate
- */
-
-static int MVert_setCoord( BPy_MVert * self, VectorObject * value )
-{
- int i;
- MVert *v;
-
- v = MVert_get_pointer( self );
- if( !v )
- return -1;
-
- if( !VectorObject_Check( value ) || value->size != 3 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected vector argument of size 3" );
-
- for( i=0; i<3 ; ++i)
- v->co[i] = value->vec[i];
-
- return 0;
-}
-
-/*
- * get a vertex's index
- */
-
-static PyObject *MVert_getIndex( BPy_MVert * self )
-{
- if( self->index >= ((Mesh *)self->data)->totvert )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "MVert is no longer valid" );
-
- return PyInt_FromLong( self->index );
-}
-
-
-/*
- * get a verts's hidden state
- */
-
-static PyObject *MVert_getMFlagBits( BPy_MVert * self, void * type )
-{
- MVert *v;
-
- v = MVert_get_pointer( self );
- if (!v)
- return NULL; /* error is set */
-
- return EXPP_getBitfield( &v->flag, (int)((long)type & 0xff), 'b' );
-}
-
-
-/*
- * set a verts's hidden state
- */
-
-static int MVert_setMFlagBits( BPy_MVert * self, PyObject * value,
- void * type )
-{
- MVert *v;
-
- v = MVert_get_pointer( self );
-
- if (!v)
- return -1; /* error is set */
-
- return EXPP_setBitfield( value, &v->flag,
- (int)((long)type & 0xff), 'b' );
-}
-
-
-/*
- * get a vertex's normal
- */
-
-static PyObject *MVert_getNormal( BPy_MVert * self )
-{
- float no[3];
- int i;
- MVert *v;
-
- v = MVert_get_pointer( self );
- if( !v )
- return NULL; /* error set */
-
- for( i = 0; i < 3; ++i )
- no[i] = (float)(v->no[i] / 32767.0);
- return newVectorObject( no, 3, Py_NEW );
-}
-
-/*
- * set a vertex's normal
- */
-
-static int MVert_setNormal( BPy_MVert * self, VectorObject * value )
-{
- int i;
- MVert *v;
- float normal[3];
-
- v = MVert_get_pointer( self );
- if( !v )
- return -1; /* error set */
-
- if( !VectorObject_Check( value ) || value->size != 3 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected vector argument of size 3" );
-
-
- for( i=0; i<3 ; ++i)
- normal[i] = value->vec[i];
-
- Normalize(normal);
-
- for( i=0; i<3 ; ++i)
- v->no[i] = (short)(normal[i]*32767.0);
-
- return 0;
-}
-
-
-/*
- * get a vertex's select status
- */
-
-static PyObject *MVert_getSel( BPy_MVert *self )
-{
- MVert *v;
-
- v = MVert_get_pointer( self );
- if( !v )
- return NULL; /* error is set */
-
- return EXPP_getBitfield( &v->flag, SELECT, 'b' );
-}
-
-/*
- * set a vertex's select status
- */
-
-static int MVert_setSel( BPy_MVert *self, PyObject *value )
-{
- MVert *v = MVert_get_pointer( self );
- Mesh *me = (Mesh *)self->data;
- if (!v)
- return -1; /* error is set */
-
- /*
- * if vertex exists and setting status is OK, delete select storage
- * of the edges and faces as well
- */
-
- if( v && !EXPP_setBitfield( value, &v->flag, SELECT, 'b' ) ) {
- if( me && me->mselect ) {
- MEM_freeN( me->mselect );
- me->mselect = NULL;
- }
- return 0;
- }
- return -1;
-}
-
-/*
- * get a vertex's UV coordinates
- */
-
-static PyObject *MVert_getUVco( BPy_MVert *self )
-{
- Mesh *me = (Mesh *)self->data;
-
- if( !me->msticky )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "mesh has no 'sticky' coordinates" );
-
- if( self->index >= ((Mesh *)self->data)->totvert )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "MVert is no longer valid" );
-
- return newVectorObject( me->msticky[self->index].co, 2, Py_WRAP );
-}
-
-/*
- * set a vertex's UV coordinates
- */
-
-static int MVert_setUVco( BPy_MVert *self, PyObject *value )
-{
- float uvco[3] = {0.0, 0.0};
- Mesh *me = (Mesh *)self->data;
- struct MSticky *v;
- int i;
-
- /*
- * at least for now, don't allow creation of sticky coordinates if they
- * don't already exist
- */
-
- if( !me->msticky )
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "mesh has no 'sticky' coordinates" );
-
- if( self->index >= ((Mesh *)self->data)->totvert )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "MVert is no longer valid" );
-
- if( VectorObject_Check( value ) ) {
- VectorObject *vect = (VectorObject *)value;
- if( vect->size != 2 )
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "expected 2D vector" );
- for( i = 0; i < vect->size; ++i )
- uvco[i] = vect->vec[i];
- } else if( !PyArg_ParseTuple( value, "ff",
- &uvco[0], &uvco[1] ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected 2D vector" );
-
- v = &me->msticky[self->index];
-
- for( i = 0; i < 2; ++i )
- v->co[i] = uvco[i];
-
- return 0;
-}
-
-/************************************************************************
- *
- * Python MVert_Type attributes get/set structure
- *
- ************************************************************************/
-
-static PyGetSetDef BPy_MVert_getseters[] = {
- {"co",
- (getter)MVert_getCoord, (setter)MVert_setCoord,
- "vertex's coordinate",
- NULL},
- {"index",
- (getter)MVert_getIndex, (setter)NULL,
- "vertex's index",
- NULL},
- {"no",
- (getter)MVert_getNormal, (setter)MVert_setNormal,
- "vertex's normal",
- NULL},
- {"sel",
- (getter)MVert_getSel, (setter)MVert_setSel,
- "vertex's select status",
- NULL},
- {"hide",
- (getter)MVert_getMFlagBits, (setter)MVert_setMFlagBits,
- "vert hidden in edit mode",
- (void *)ME_HIDE},
- {"uvco",
- (getter)MVert_getUVco, (setter)MVert_setUVco,
- "vertex's UV coordinates",
- NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-static PyGetSetDef BPy_PVert_getseters[] = {
- {"co",
- (getter)MVert_getCoord, (setter)MVert_setCoord,
- "vertex's coordinate",
- NULL},
- {"no",
- (getter)MVert_getNormal, (setter)MVert_setNormal,
- "vertex's normal",
- NULL},
- {"sel",
- (getter)MVert_getSel, (setter)MVert_setSel,
- "vertex's select status",
- NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-/************************************************************************
- *
- * Python MVert_Type standard operations
- *
- ************************************************************************/
-
-static void MVert_dealloc( BPy_MVert * self )
-{
- if( BPy_PVert_Check( self ) ) /* free memory of thick objects */
- MEM_freeN ( self->data );
-
- PyObject_DEL( self );
-}
-
-static int MVert_compare( BPy_MVert * a, BPy_MVert * b )
-{
- return( a->data == b->data && a->index == b->index ) ? 0 : -1;
-}
-
-static PyObject *MVert_repr( BPy_MVert * self )
-{
- char format[512];
- char index[24];
- MVert *v;
-
- v = MVert_get_pointer( self );
- if( !v )
- return NULL;
-
- if( BPy_MVert_Check( self ) )
- sprintf( index, "%d", self->index );
- else
- BLI_strncpy( index, "(None)", 24 );
-
- sprintf( format, "[MVert (%f %f %f) (%f %f %f) %s]",
- v->co[0], v->co[1], v->co[2], (float)(v->no[0] / 32767.0),
- (float)(v->no[1] / 32767.0), (float)(v->no[2] / 32767.0),
- index );
-
- return PyString_FromString( format );
-}
-
-static long MVert_hash( BPy_MVert *self )
-{
- return (long)self->index;
-}
-
-static PyObject *Mesh_addPropLayer_internal(Mesh *mesh, CustomData *data, int tot, PyObject *args)
-{
- char *name=NULL;
- int type = -1;
-
- if( !PyArg_ParseTuple( args, "si", &name, &type) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a string and an int" );
- if (strlen(name)>31)
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "error, maximum name length is 31");
- if((type != CD_PROP_FLT) && (type != CD_PROP_INT) && (type != CD_PROP_STR))
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "error, unknown layer type");
- if (name)
- CustomData_add_layer_named(data, type, CD_DEFAULT, NULL,tot,name);
-
- mesh_update_customdata_pointers(mesh);
- Py_RETURN_NONE;
-}
-
-static PyObject *Mesh_removePropLayer_internal(Mesh *mesh, CustomData *data, int tot,PyObject *value)
-{
- CustomDataLayer *layer;
- char *name=PyString_AsString(value);
- int i;
-
- if( !name )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument" );
-
- if (strlen(name)>31)
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "error, maximum name length is 31" );
-
- i = CustomData_get_named_layer_index(data, CD_PROP_FLT, name);
- if(i == -1) i = CustomData_get_named_layer_index(data, CD_PROP_INT, name);
- if(i == -1) i = CustomData_get_named_layer_index(data, CD_PROP_STR, name);
- if (i==-1)
- return EXPP_ReturnPyObjError(PyExc_ValueError,
- "No matching layers to remove" );
- layer = &data->layers[i];
- CustomData_free_layer(data, layer->type, tot, i);
- mesh_update_customdata_pointers(mesh);
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Mesh_renamePropLayer_internal(Mesh *mesh, CustomData *data, PyObject *args)
-{
- CustomDataLayer *layer;
- int i;
- char *name_from, *name_to;
-
- if( !PyArg_ParseTuple( args, "ss", &name_from, &name_to ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected 2 strings" );
-
- if (strlen(name_from)>31 || strlen(name_to)>31)
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "error, maximum name length is 31" );
-
- i = CustomData_get_named_layer_index(data, CD_PROP_FLT, name_from);
- if(i == -1) i = CustomData_get_named_layer_index(data, CD_PROP_INT, name_from);
- if(i == -1) i = CustomData_get_named_layer_index(data, CD_PROP_STR, name_from);
- if(i == -1)
- return EXPP_ReturnPyObjError(PyExc_ValueError,
- "No matching layers to rename" );
-
- layer = &data->layers[i];
-
- strcpy(layer->name, name_to); /* we alredy know the string sizes are under 32 */
- CustomData_set_layer_unique_name(data, i);
- Py_RETURN_NONE;
-}
-
-static PyObject *Mesh_propList_internal(CustomData *data)
-{
- CustomDataLayer *layer;
- PyObject *list = PyList_New( 0 ), *item;
- int i;
- for(i=0; i<data->totlayer; i++) {
- layer = &data->layers[i];
- if( (layer->type == CD_PROP_FLT) || (layer->type == CD_PROP_INT) || (layer->type == CD_PROP_STR)) {
- item = PyString_FromString(layer->name);
- PyList_Append( list, item );
- Py_DECREF(item);
- }
- }
- return list;
-}
-
-static PyObject *Mesh_getProperty_internal(CustomData *data, int eindex, PyObject *value)
-{
- CustomDataLayer *layer;
- char *name=PyString_AsString(value);
- int i;
- MFloatProperty *pf;
- MIntProperty *pi;
- MStringProperty *ps;
-
- if(!name)
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected an string argument" );
-
- if (strlen(name)>31)
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "error, maximum name length is 31" );
-
- i = CustomData_get_named_layer_index(data, CD_PROP_FLT, name);
- if(i == -1) i = CustomData_get_named_layer_index(data, CD_PROP_INT, name);
- if(i == -1) i = CustomData_get_named_layer_index(data, CD_PROP_STR, name);
- if(i == -1)
- return EXPP_ReturnPyObjError(PyExc_ValueError,
- "No matching layers" );
-
- layer = &data->layers[i];
-
- if(layer->type == CD_PROP_FLT){
- pf = layer->data;
- return PyFloat_FromDouble(pf[eindex].f);
- }
- else if(layer->type == CD_PROP_INT){
- pi = layer->data;
- return PyInt_FromLong(pi[eindex].i);
-
- }
- else if(layer->type == CD_PROP_STR){
- ps = layer->data;
- return PyString_FromString(ps[eindex].s);
- }
- Py_RETURN_NONE;
-}
-
-static PyObject *Mesh_setProperty_internal(CustomData *data, int eindex, PyObject *args)
-{
- CustomDataLayer *layer;
- int i = 0, index, type = -1;
- float f = 0.0f;
- char *s=NULL, *name=NULL;
- MFloatProperty *pf;
- MIntProperty *pi;
- MStringProperty *ps;
- PyObject *val;
-
- if(PyArg_ParseTuple(args, "sO", &name, &val)){
- if (strlen(name)>31)
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "error, maximum name length is 31" );
-
- if(PyInt_Check(val)){
- type = CD_PROP_INT;
- i = (int)PyInt_AS_LONG(val);
- }
- else if(PyFloat_Check(val)){
- type = CD_PROP_FLT;
- f = (float)PyFloat_AsDouble(val);
- }
- else if(PyString_Check(val)){
- type = CD_PROP_STR;
- s = PyString_AsString(val);
- }
- else
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected an name plus either float/int/string" );
-
- }
-
- index = CustomData_get_named_layer_index(data, type, name);
- if(index == -1)
- return EXPP_ReturnPyObjError(PyExc_ValueError,
- "No matching layers or type mismatch" );
-
- layer = &data->layers[index];
-
- if(type==CD_PROP_STR){
- if (strlen(s)>255){
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "error, maximum string length is 255");
- }
- else{
- ps = layer->data;
- strcpy(ps[eindex].s,s);
- }
- }
- else if(type==CD_PROP_FLT){
- pf = layer->data;
- pf[eindex].f = f;
- }
- else{
- pi = layer->data;
- pi[eindex].i = i;
- }
- Py_RETURN_NONE;
-}
-
-static PyObject *MVert_getProp( BPy_MVert *self, PyObject *args)
-{
- if( BPy_MVert_Check( self ) ){
- Mesh *me = (Mesh *)self->data;
- if(self->index >= me->totvert)
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "error, MVert is no longer valid part of mesh!");
- else
- return Mesh_getProperty_internal(&(me->vdata), self->index, args);
- }
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "error, Vertex not part of a mesh!");
-}
-
-static PyObject *MVert_setProp( BPy_MVert *self, PyObject *args)
-{
- if( BPy_MVert_Check( self ) ){
- Mesh *me = (Mesh *)self->data;
- if(self->index >= me->totvert)
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "error, MVert is no longer valid part of mesh!");
- else
- return Mesh_setProperty_internal(&(me->vdata), self->index, args);
- }
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "error, Vertex not part of a mesh!");
-}
-
-static struct PyMethodDef BPy_MVert_methods[] = {
- {"getProperty", (PyCFunction)MVert_getProp, METH_O,
- "get property indicated by name"},
- {"setProperty", (PyCFunction)MVert_setProp, METH_VARARGS,
- "set property indicated by name"},
- {NULL, NULL, 0, NULL}
-};
-
-
-/************************************************************************
- *
- * Python MVert_Type structure definition
- *
- ************************************************************************/
-
-PyTypeObject MVert_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender MVert", /* char *tp_name; */
- sizeof( BPy_MVert ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- ( destructor ) MVert_dealloc,/* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- ( cmpfunc ) MVert_compare, /* cmpfunc tp_compare; */
- ( reprfunc ) MVert_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- NULL, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- ( hashfunc ) MVert_hash, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
- 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, /* 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, /* 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 ***/
- BPy_MVert_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_MVert_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-/************************************************************************
- *
- * Python PVert_Type standard operations
- *
- ************************************************************************/
-
-static int PVert_compare( BPy_MVert * a, BPy_MVert * b )
-{
- return( a->data == b->data ) ? 0 : -1;
-}
-
-/************************************************************************
- *
- * Python PVert_Type structure definition
- *
- ************************************************************************/
-
-PyTypeObject PVert_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender PVert", /* char *tp_name; */
- sizeof( BPy_MVert ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- ( destructor ) MVert_dealloc,/* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- ( cmpfunc ) PVert_compare, /* cmpfunc tp_compare; */
- ( reprfunc ) MVert_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- NULL, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- ( hashfunc ) MVert_hash, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
- 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, /* 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, /* 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 ***/
- NULL, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_PVert_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-/*
- * create 'thin' or 'thick' MVert objects
- *
- * there are two types of objects; thin (wrappers for mesh vertex) and thick
- * (not contains in mesh). Thin objects are MVert_Type and thick are
- * PVert_Type. For thin objects, data is a pointer to a Mesh and index
- * is the vertex's index in mesh->mvert. For thick objects, data is a
- * pointer to an MVert; index is unused.
- */
-
-/*
- * create a thin MVert object
- */
-
-static PyObject *MVert_CreatePyObject( Mesh *mesh, int i )
-{
- BPy_MVert *obj = (BPy_MVert *)PyObject_NEW( BPy_MVert, &MVert_Type );
-
- if( !obj )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyObject_New() failed" );
-
- obj->index = i;
- obj->data = mesh;
- return (PyObject *)obj;
-}
-
-/*
- * create a thick MVert object
- */
-
-static PyObject *PVert_CreatePyObject( MVert *vert )
-{
- MVert *newvert;
- BPy_MVert *obj = (BPy_MVert *)PyObject_NEW( BPy_MVert, &PVert_Type );
-
- if( !obj )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyObject_New() failed" );
-
- newvert = (MVert *)MEM_callocN( sizeof( MVert ), "MVert" );
- if( !newvert )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "MEM_callocN() failed" );
-
- memcpy( newvert, vert, sizeof( MVert ) );
- obj->data = newvert;
- return (PyObject *)obj;
-}
-
-/************************************************************************
- *
- * Vertex sequence
- *
- ************************************************************************/
-
-static int MVertSeq_len( BPy_MVertSeq * self )
-{
- return self->mesh->totvert;
-}
-
-/*
- * retrive a single MVert from somewhere in the vertex list
- */
-
-static PyObject *MVertSeq_item( BPy_MVertSeq * self, int i )
-{
- if( i < 0 || i >= self->mesh->totvert )
- return EXPP_ReturnPyObjError( PyExc_IndexError,
- "array index out of range" );
-
- return MVert_CreatePyObject( self->mesh, i );
-}
-
-/*
- * retrieve a slice of the vertex list (as a Python list)
- *
- * Python is nice enough to handle negative indices for us: if the user
- * specifies -1, Python will pass us len()-1. So we can just check for
- * indices in the range 0:len()-1. Of course, we should never actually
- * return the high index, but up to one less.
- */
-
-static PyObject *MVertSeq_slice( BPy_MVertSeq *self, int low, int high )
-{
- PyObject *list;
- int i;
-
- /*
- * Python list slice operator returns empty list when asked for a slice
- * outside the list, or if indices are reversed (low > high). Clamp
- * our input to do the same.
- */
-
- if( low < 0 ) low = 0;
- if( high > self->mesh->totvert ) high = self->mesh->totvert;
- if( low > high ) low = high;
-
- list = PyList_New( high-low );
- if( !list )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyList_New() failed" );
-
- /*
- * return Py_NEW copies of requested vertices
- */
-
- for( i = low; i < high; ++i )
- PyList_SET_ITEM( list, i-low,
- PVert_CreatePyObject( (void *)&self->mesh->mvert[i] ) );
- return list;
-}
-
-/*
- * assign a single MVert to somewhere in the vertex list
- */
-
-static int MVertSeq_assign_item( BPy_MVertSeq * self, int i,
- BPy_MVert *v )
-{
- MVert *dst = &self->mesh->mvert[i];
- MVert *src;
-
- if( !v )
- return EXPP_ReturnIntError( PyExc_IndexError,
- "del() not supported" );
-
- if( i < 0 || i >= self->mesh->totvert )
- return EXPP_ReturnIntError( PyExc_IndexError,
- "array index out of range" );
-
- if( BPy_MVert_Check( v ) )
- src = &((Mesh *)v->data)->mvert[v->index];
- else
- src = (MVert *)v->data;
-
- memcpy( dst, src, sizeof(MVert) );
- /* mesh_update( self->mesh );*/
- return 0;
-}
-
-static int MVertSeq_assign_slice( BPy_MVertSeq *self, int low, int high,
- PyObject *args )
-{
- int len, i;
-
- if( !PyList_Check( args ) )
- return EXPP_ReturnIntError( PyExc_IndexError,
- "can only assign lists of MVerts" );
-
- len = PyList_Size( args );
-
- /*
- * Python list slice assign operator allows for changing the size of the
- * destination list, by replacement and appending....
- *
- * >>> l=[1,2,3,4]
- * >>> m=[11,12,13,14]
- * >>> l[5:7]=m
- * >>> print l
- * [1, 2, 3, 4, 11, 12, 13, 14]
- * >>> l=[1,2,3,4]
- * >>> l[2:3]=m
- * >>> print l
- * [1, 2, 11, 12, 13, 14, 4]
- *
- * We don't want the size of the list to change (at least not at time
- * point in development) so we are a little more strict:
- * - low and high indices must be in range [0:len()]
- * - high-low == PyList_Size(v)
- */
-
- if( low < 0 || high > self->mesh->totvert || low > high )
- return EXPP_ReturnIntError( PyExc_IndexError,
- "invalid slice range" );
-
- if( high-low != len )
- return EXPP_ReturnIntError( PyExc_IndexError,
- "slice range and input list sizes must be equal" );
-
- for( i = low; i < high; ++i )
- {
- BPy_MVert *v = (BPy_MVert *)PyList_GET_ITEM( args, i-low );
- MVert *dst = &self->mesh->mvert[i];
- MVert *src;
-
- if( BPy_MVert_Check( v ) )
- src = &((Mesh *)v->data)->mvert[v->index];
- else
- src = (MVert *)v->data;
-
- memcpy( dst, src, sizeof(MVert) );
- }
- /* mesh_update( self->mesh );*/
- return 0;
-}
-
-static PySequenceMethods MVertSeq_as_sequence = {
- ( inquiry ) MVertSeq_len, /* sq_length */
- ( binaryfunc ) 0, /* sq_concat */
- ( intargfunc ) 0, /* sq_repeat */
- ( intargfunc ) MVertSeq_item, /* sq_item */
- ( intintargfunc ) MVertSeq_slice, /* sq_slice */
- ( intobjargproc ) MVertSeq_assign_item, /* sq_ass_item */
- ( intintobjargproc ) MVertSeq_assign_slice, /* sq_ass_slice */
- 0,0,0,
-};
-
-/************************************************************************
- *
- * Python MVertSeq_Type iterator (iterates over vertices)
- *
- ************************************************************************/
-
-/*
- * Initialize the interator index
- */
-
-static PyObject *MVertSeq_getIter( BPy_MVertSeq * self )
-{
- if (self->iter==-1) { /* iteration for this pyobject is not yet used, just return self */
- self->iter = 0;
- return EXPP_incr_ret ( (PyObject *) self );
- } else {
- /* were alredy using this as an iterator, make a copy to loop on */
- BPy_MVertSeq *seq = (BPy_MVertSeq *)MVertSeq_CreatePyObject(self->mesh);
- seq->iter = 0;
- return (PyObject *)seq;
- }
-}
-
-/*
- * Return next MVert.
- */
-
-static PyObject *MVertSeq_nextIter( BPy_MVertSeq * self )
-{
- if( self->iter == self->mesh->totvert ) {
- self->iter= -1; /* allow it to be used as an iterator again without creating a new BPy_MVertSeq */
- return EXPP_ReturnPyObjError( PyExc_StopIteration,
- "iterator at end" );
- }
-
- return MVert_CreatePyObject( self->mesh, self->iter++ );
-}
-
-/************************************************************************
- *
- * Python MVertSeq_Type methods
- *
- ************************************************************************/
-
-static PyObject *MVertSeq_extend( BPy_MVertSeq * self, PyObject *args )
-{
- int len, newlen;
- int i,j;
- PyObject *tmp;
- MVert *newvert, *tmpvert;
- Mesh *mesh = self->mesh;
- CustomData vdata;
- /* make sure we get a sequence of tuples of something */
-
- switch( PySequence_Size( args ) ) {
- case 1: /* better be a list or a tuple */
- tmp = PyTuple_GET_ITEM( args, 0 );
- if( !VectorObject_Check ( tmp ) ) {
- if( !PySequence_Check ( tmp ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a sequence of sequence triplets" );
- else if( !PySequence_Size ( tmp ) ) {
- Py_RETURN_NONE;
- }
- args = tmp;
- }
- Py_INCREF( args ); /* so we can safely DECREF later */
- break;
- case 3:
- tmp = PyTuple_GET_ITEM( args, 0 );
- /* if first item is not a number, it's wrong */
- if( !PyNumber_Check( tmp ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a sequence of sequence triplets" );
-
- /* otherwise, put into a new tuple */
- args = Py_BuildValue( "((OOO))", tmp,
- PyTuple_GET_ITEM( args, 1 ), PyTuple_GET_ITEM( args, 2 ) );
- if( !args )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "Py_BuildValue() failed" );
- break;
-
- default: /* anything else is definitely wrong */
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a sequence of sequence triplets" );
- }
-
- /* if no verts given, return quietly */
- len = PySequence_Size( args );
- if( len == 0 ) {
- Py_DECREF ( args );
- Py_RETURN_NONE;
- }
-
- /* create custom vertex data arrays and copy existing vertices into it */
-
- newlen = mesh->totvert + len;
- CustomData_copy( &mesh->vdata, &vdata, CD_MASK_MESH, CD_DEFAULT, newlen );
- CustomData_copy_data( &mesh->vdata, &vdata, 0, 0, mesh->totvert );
-
- if ( !CustomData_has_layer( &vdata, CD_MVERT ) )
- CustomData_add_layer( &vdata, CD_MVERT, CD_CALLOC, NULL, newlen );
-
- newvert = CustomData_get_layer( &vdata, CD_MVERT );
-
- /* scan the input list and insert the new vertices */
-
- tmpvert = &newvert[mesh->totvert];
- for( i = 0; i < len; ++i ) {
- float co[3];
- tmp = PySequence_GetItem( args, i );
- if( VectorObject_Check( tmp ) ) {
- if( ((VectorObject *)tmp)->size != 3 ) {
- CustomData_free( &vdata, newlen );
- Py_DECREF ( tmp );
- Py_DECREF ( args );
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "expected vector of size 3" );
- }
- for( j = 0; j < 3; ++j )
- co[j] = ((VectorObject *)tmp)->vec[j];
- } else if( PySequence_Check( tmp ) ) {
- int ok=1;
- PyObject *flt;
- if( PySequence_Size( tmp ) != 3 )
- ok = 0;
- else
- for( j = 0; ok && j < 3; ++j ) {
- flt = PySequence_ITEM( tmp, j );
- if( !PyNumber_Check ( flt ) )
- ok = 0;
- else
- co[j] = (float)PyFloat_AsDouble( flt );
- Py_DECREF( flt );
- }
-
- if( !ok ) {
- CustomData_free( &vdata, newlen );
- Py_DECREF ( args );
- Py_DECREF ( tmp );
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "expected sequence triplet of floats" );
- }
- } else {
- CustomData_free( &vdata, newlen );
- Py_DECREF ( args );
- Py_DECREF ( tmp );
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "expected sequence triplet of floats" );
- }
-
- Py_DECREF ( tmp );
-
- /* add the coordinate to the new list */
- memcpy( tmpvert->co, co, sizeof(co) );
-
- tmpvert->flag |= SELECT;
- /* TODO: anything else which needs to be done when we add a vert? */
- /* probably not: NMesh's newvert() doesn't */
- ++tmpvert;
- }
-
- CustomData_free( &mesh->vdata, mesh->totvert );
- mesh->vdata = vdata;
- mesh_update_customdata_pointers( mesh );
-
- /*
- * if there are keys, have to fix those lists up
- */
-
- if( mesh->key ) {
- KeyBlock *currkey = mesh->key->block.first;
- float *fp, *newkey;
-
- while( currkey ) {
-
- /* create key list, copy existing data if any */
- newkey = MEM_callocN(mesh->key->elemsize*newlen, "keydata");
- if( currkey->data ) {
- memcpy( newkey, currkey->data,
- mesh->totvert*mesh->key->elemsize );
- MEM_freeN( currkey->data );
- currkey->data = newkey;
- }
-
- /* add data for new vertices */
- fp = (float *)((char *)currkey->data +
- (mesh->key->elemsize*mesh->totvert));
- tmpvert = mesh->mvert + mesh->totvert;
- for( i = newlen - mesh->totvert; i > 0; --i ) {
- VECCOPY(fp, tmpvert->co);
- fp += 3;
- tmpvert++;
- }
- currkey->totelem = newlen;
- currkey = currkey->next;
- }
- }
-
- /* set final vertex list size */
- mesh->totvert = newlen;
-
- mesh_update( mesh );
-
- Py_DECREF ( args );
- Py_RETURN_NONE;
-}
-
-static PyObject *MVertSeq_delete( BPy_MVertSeq * self, PyObject *args )
-{
- unsigned int *vert_table;
- int vert_delete, face_count;
- int i;
- Mesh *mesh = self->mesh;
- MFace *tmpface;
-
- /*
- * if input tuple contains a single sequence, use it as input instead;
- * otherwise use the sequence as-is and check later that it contains
- * one or more integers or MVerts
- */
- if( PySequence_Size( args ) == 1 ) {
- PyObject *tmp = PyTuple_GET_ITEM( args, 0 );
- if( PySequence_Check( tmp ) )
- args = tmp;
- }
-
- /* if sequence is empty, do nothing */
- if( PySequence_Size( args ) == 0 ) {
- Py_RETURN_NONE;
- }
-
- /* allocate vertex lookup table */
- vert_table = (unsigned int *)MEM_callocN(
- mesh->totvert*sizeof( unsigned int ), "vert_table" );
-
- /* get the indices of vertices to be removed */
- for( i = PySequence_Size( args ); i--; ) {
- PyObject *tmp = PySequence_GetItem( args, i );
- int index;
- if( BPy_MVert_Check( tmp ) ) {
- if( (void *)self->mesh != ((BPy_MVert*)tmp)->data ) {
- MEM_freeN( vert_table );
- Py_DECREF( tmp );
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "MVert belongs to a different mesh" );
- }
- index = ((BPy_MVert*)tmp)->index;
- } else if( PyInt_Check( tmp ) ) {
- index = PyInt_AsLong ( tmp );
- } else {
- MEM_freeN( vert_table );
- Py_DECREF( tmp );
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a sequence of ints or MVerts" );
- }
- Py_DECREF( tmp );
- if( index < 0 || index >= mesh->totvert ) {
- MEM_freeN( vert_table );
- return EXPP_ReturnPyObjError( PyExc_IndexError,
- "array index out of range" );
- }
- vert_table[index] = UINT_MAX;
- }
-
- /* delete things, then clean up and return */
-
- vert_delete = make_vertex_table( vert_table, mesh->totvert );
- if( vert_delete )
- delete_verts( mesh, vert_table, vert_delete );
-
- /* calculate edges to delete, fix vertex indices */
- delete_edges( mesh, vert_table, 0 );
-
- /*
- * find number of faces which contain any of the deleted vertices,
- * and mark them, then delete them
- */
- tmpface = mesh->mface;
- face_count=0;
- for( i = mesh->totface; i--; ++tmpface ) {
- if( vert_table[tmpface->v1] == UINT_MAX ||
- vert_table[tmpface->v2] == UINT_MAX ||
- vert_table[tmpface->v3] == UINT_MAX ||
- ( tmpface->v4 && vert_table[tmpface->v4] == UINT_MAX ) ) {
- tmpface->v1 = UINT_MAX;
- ++face_count;
- }
- }
- delete_faces( mesh, vert_table, face_count );
-
- /* clean up and exit */
- MEM_freeN( vert_table );
- mesh_update ( mesh );
- Py_RETURN_NONE;
-}
-
-static PyObject *MVertSeq_selected( BPy_MVertSeq * self )
-{
- int i, count;
- Mesh *mesh = self->mesh;
- MVert *tmpvert;
- PyObject *list;
-
- /* first count selected edges (quicker than appending to PyList?) */
- count = 0;
- tmpvert = mesh->mvert;
- for( i = 0; i < mesh->totvert; ++i, ++tmpvert )
- if( tmpvert->flag & SELECT )
- ++count;
-
- list = PyList_New( count );
- if( !list )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyList_New() failed" );
-
- /* next, insert selected edges into list */
- count = 0;
- tmpvert = mesh->mvert;
- for( i = 0; i < mesh->totvert; ++i, ++tmpvert ) {
- if( tmpvert->flag & SELECT ) {
- PyObject *tmp = PyInt_FromLong( i );
- if( !tmp ) {
- Py_DECREF( list );
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyInt_FromLong() failed" );
- }
- PyList_SET_ITEM( list, count, tmp );
- ++count;
- }
- }
- return list;
-}
-static PyObject *MVertSeq_add_layertype(BPy_MVertSeq *self, PyObject *args)
-{
- Mesh *me = (Mesh*)self->mesh;
- return Mesh_addPropLayer_internal(me, &(me->vdata), me->totvert, args);
-}
-static PyObject *MVertSeq_del_layertype(BPy_MVertSeq *self, PyObject *value)
-{
- Mesh *me = (Mesh*)self->mesh;
- return Mesh_removePropLayer_internal(me, &(me->vdata), me->totvert, value);
-}
-static PyObject *MVertSeq_rename_layertype(BPy_MVertSeq *self, PyObject *args)
-{
- Mesh *me = (Mesh*)self->mesh;
- return Mesh_renamePropLayer_internal(me,&(me->vdata),args);
-}
-static PyObject *MVertSeq_PropertyList(BPy_MVertSeq *self)
-{
- Mesh *me = (Mesh*)self->mesh;
- return Mesh_propList_internal(&(me->vdata));
-}
-static PyObject *M_Mesh_PropertiesTypeDict(void)
-{
- PyObject *Types = PyConstant_New( );
- if(Types) {
- BPy_constant *d = (BPy_constant *) Types;
- PyConstant_Insert(d, "FLOAT", PyInt_FromLong(CD_PROP_FLT));
- PyConstant_Insert(d, "INT" , PyInt_FromLong(CD_PROP_INT));
- PyConstant_Insert(d, "STRING", PyInt_FromLong(CD_PROP_STR));
- }
- return Types;
-}
-
-static struct PyMethodDef BPy_MVertSeq_methods[] = {
- {"extend", (PyCFunction)MVertSeq_extend, METH_VARARGS,
- "add vertices to mesh"},
- {"delete", (PyCFunction)MVertSeq_delete, METH_VARARGS,
- "delete vertices from mesh"},
- {"selected", (PyCFunction)MVertSeq_selected, METH_NOARGS,
- "returns a list containing indices of selected vertices"},
- {"addPropertyLayer",(PyCFunction)MVertSeq_add_layertype, METH_VARARGS,
- "add a new property layer"},
- {"removePropertyLayer",(PyCFunction)MVertSeq_del_layertype, METH_O,
- "removes a property layer"},
- {"renamePropertyLayer",(PyCFunction)MVertSeq_rename_layertype, METH_VARARGS,
- "renames an existing property layer"},
- {NULL, NULL, 0, NULL}
-};
-
-static PyGetSetDef BPy_MVertSeq_getseters[] = {
- {"properties",
- (getter)MVertSeq_PropertyList, (setter)NULL,
- "vertex property layers, read only",
- NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-
-
-/************************************************************************
- *
- * Python MVertSeq_Type standard operations
- *
- ************************************************************************/
-
-/*****************************************************************************/
-/* Python MVertSeq_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject MVertSeq_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender MVertSeq", /* char *tp_name; */
- sizeof( BPy_MVertSeq ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL, /* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- NULL, /* cmpfunc tp_compare; */
- NULL, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- &MVertSeq_as_sequence, /* 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; */
- 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, /* 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, /* richcmpfunc tp_richcompare; */
-
- /*** weak reference enabler ***/
- 0, /* long tp_weaklistoffset; */
-
- /*** Added in release 2.2 ***/
- /* Iterators */
- ( getiterfunc) MVertSeq_getIter, /* getiterfunc tp_iter; */
- ( iternextfunc ) MVertSeq_nextIter, /* iternextfunc tp_iternext; */
-
- /*** Attribute descriptor and subclassing stuff ***/
- BPy_MVertSeq_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_MVertSeq_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-/************************************************************************
- *
- * Edge attributes
- *
- ************************************************************************/
-
-static MEdge * MEdge_get_pointer( BPy_MEdge * self )
-{
- if( self->index >= self->mesh->totedge )
- return (MEdge *)EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "MEdge is no longer valid" );
- return &self->mesh->medge[self->index];
-}
-
-/*
- * get an edge's crease value
- */
-
-static PyObject *MEdge_getCrease( BPy_MEdge * self )
-{
- MEdge *edge = MEdge_get_pointer( self );
-
- if( !edge )
- return NULL;
-
- return PyInt_FromLong( edge->crease );
-}
-
-/*
- * set an edge's crease value
- */
-
-static int MEdge_setCrease( BPy_MEdge * self, PyObject * value )
-{
- MEdge *edge = MEdge_get_pointer( self );
-
- if( !edge )
- return -1;
-
- return EXPP_setIValueClamped( value, &edge->crease, 0, 255, 'b' );
-}
-
-/*
- * get an edge's flag
- */
-
-static PyObject *MEdge_getFlag( BPy_MEdge * self )
-{
- MEdge *edge = MEdge_get_pointer( self );
-
- if( !edge )
- return NULL;
-
- return PyInt_FromLong( edge->flag );
-}
-
-/*
- * set an edge's flag
- */
-
-static int MEdge_setFlag( BPy_MEdge * self, PyObject * value )
-{
- short param;
- static short bitmask = SELECT
- | ME_EDGEDRAW
- | ME_SEAM
- | ME_FGON
- | ME_HIDE
- | ME_EDGERENDER
- | ME_LOOSEEDGE
- | ME_SEAM_LAST
- | ME_SHARP;
- MEdge *edge = MEdge_get_pointer( self );
-
- if( !edge )
- return -1;
-
- if( !PyInt_Check ( value ) ) {
- char errstr[128];
- sprintf ( errstr , "expected int bitmask of 0x%04x", bitmask );
- return EXPP_ReturnIntError( PyExc_TypeError, errstr );
- }
- param = (short)PyInt_AS_LONG ( value );
-
- if ( ( param & bitmask ) != param )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "invalid bit(s) set in mask" );
-
- edge->flag = param;
-
- return 0;
-}
-
-/*
- * get an edge's first vertex
- */
-
-static PyObject *MEdge_getV1( BPy_MEdge * self )
-{
- MEdge *edge = MEdge_get_pointer( self );
-
- if( !edge )
- return NULL;
-
- return MVert_CreatePyObject( self->mesh, edge->v1 );
-}
-
-/*
- * set an edge's first vertex
- */
-
-static int MEdge_setV1( BPy_MEdge * self, BPy_MVert * value )
-{
- MEdge *edge = MEdge_get_pointer( self );
-
- if( !edge )
- return -1;
- if( !BPy_MVert_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError, "expected an MVert" );
-
- edge->v1 = value->index;
- return 0;
-}
-
-/*
- * get an edge's second vertex
- */
-
-static PyObject *MEdge_getV2( BPy_MEdge * self )
-{
- MEdge *edge = MEdge_get_pointer( self );
-
- if( !edge )
- return NULL; /* error is set */
- /* if v2 is out of range, the python mvert will complain, no need to check here */
- return MVert_CreatePyObject( self->mesh, edge->v2 );
-}
-
-/*
- * set an edge's second vertex
- */
-
-static int MEdge_setV2( BPy_MEdge * self, BPy_MVert * value )
-{
- MEdge *edge = MEdge_get_pointer( self );
-
- if( !edge )
- return -1; /* error is set */
- if( !BPy_MVert_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError, "expected an MVert" );
-
- if ( edge->v1 == value->index )
- return EXPP_ReturnIntError( PyExc_ValueError, "an edge cant use the same vertex for each end" );
-
- edge->v2 = value->index;
- return 0;
-}
-
-/*
- * get an edge's index
- */
-
-static PyObject *MEdge_getIndex( BPy_MEdge * self )
-{
- if( !MEdge_get_pointer( self ) )
- return NULL; /* error is set */
-
- return PyInt_FromLong( self->index );
-}
-
-/*
- * get an edge's flag
- */
-
-static PyObject *MEdge_getMFlagBits( BPy_MEdge * self, void * type )
-{
- MEdge *edge = MEdge_get_pointer( self );
-
- if( !edge )
- return NULL; /* error is set */
-
- return EXPP_getBitfield( &edge->flag, (int)((long)type & 0xff), 'b' );
-}
-
-/*
- * get an edge's length
- */
-
-static PyObject *MEdge_getLength( BPy_MEdge * self )
-{
- MEdge *edge = MEdge_get_pointer( self );
- double dot = 0.0f;
- float tmpf;
- int i;
- float *v1, *v2;
-
- if (!edge)
- return NULL; /* error is set */
-
- if MEDGE_VERT_BADRANGE_CHECK(self->mesh, edge)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError, "This edge uses removed vert(s)" );
-
- /* get the 2 edges vert locations */
- v1= (&((Mesh *)self->mesh)->mvert[edge->v1])->co;
- v2= (&((Mesh *)self->mesh)->mvert[edge->v2])->co;
-
- if( !edge )
- return NULL;
-
- for( i = 0; i < 3; i++ ) {
- tmpf = v1[i] - v2[i];
- dot += tmpf*tmpf;
- }
- return PyFloat_FromDouble( sqrt( dot ) );
-}
-
-/*
- * get an key for using in a dictionary or set key
- */
-
-static PyObject *MEdge_getKey( BPy_MEdge * self )
-{
- PyObject *attr;
- MEdge *edge = MEdge_get_pointer( self );
- if (!edge)
- return NULL; /* error is set */
-
- attr = PyTuple_New( 2 );
- if (edge->v1 > edge->v2) {
- PyTuple_SET_ITEM( attr, 0, PyInt_FromLong(edge->v2) );
- PyTuple_SET_ITEM( attr, 1, PyInt_FromLong(edge->v1) );
- } else {
- PyTuple_SET_ITEM( attr, 0, PyInt_FromLong(edge->v1) );
- PyTuple_SET_ITEM( attr, 1, PyInt_FromLong(edge->v2) );
- }
- return attr;
-}
-
-/*
- * set an edge's select state
- */
-
-static int MEdge_setSel( BPy_MEdge * self,PyObject * value,
- void * type_unused )
-{
- MEdge *edge = MEdge_get_pointer( self );
- int param = PyObject_IsTrue( value );
- Mesh *me = self->mesh;
-
- if( !edge )
- return -1;
-
- if MEDGE_VERT_BADRANGE_CHECK(me, edge)
- return EXPP_ReturnIntError( PyExc_RuntimeError, "This edge uses removed vert(s)" );
-
- if( param == -1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected True/False or 0/1" );
-
- if( param ) {
- edge->flag |= SELECT;
- me->mvert[edge->v1].flag |= SELECT;
- me->mvert[edge->v2].flag |= SELECT;
- }
- else {
- edge->flag &= ~SELECT;
- me->mvert[edge->v1].flag &= ~SELECT;
- me->mvert[edge->v2].flag &= ~SELECT;
- }
-
- if( self->mesh->mselect ) {
- MEM_freeN( self->mesh->mselect );
- self->mesh->mselect = NULL;
- }
-
- return 0;
-}
-
-/************************************************************************
- *
- * Python MEdge_Type attributes get/set structure
- *
- ************************************************************************/
-
-static PyGetSetDef BPy_MEdge_getseters[] = {
- {"crease",
- (getter)MEdge_getCrease, (setter)MEdge_setCrease,
- "edge's crease value",
- NULL},
- {"flag",
- (getter)MEdge_getFlag, (setter)MEdge_setFlag,
- "edge's flags",
- NULL},
- {"v1",
- (getter)MEdge_getV1, (setter)MEdge_setV1,
- "edge's first vertex",
- NULL},
- {"v2",
- (getter)MEdge_getV2, (setter)MEdge_setV2,
- "edge's second vertex",
- NULL},
- {"index",
- (getter)MEdge_getIndex, (setter)NULL,
- "edge's index",
- NULL},
- {"sel",
- (getter)MEdge_getMFlagBits, (setter)MEdge_setSel,
- "edge selected in edit mode",
- (void *)SELECT},
- {"length",
- (getter)MEdge_getLength, (setter)NULL,
- "edge's length, read only",
- NULL},
- {"key",
- (getter)MEdge_getKey, (setter)NULL,
- "edge's key for using with sets or dictionaries, read only",
- NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-/************************************************************************
- *
- * Python MEdge_Type iterator (iterates over vertices)
- *
- ************************************************************************/
-
-/*
- * Initialize the interator index
- */
-
-static PyObject *MEdge_getIter( BPy_MEdge * self )
-{
- if (self->iter==-1) { /* not alredy used to iterator on, just use self */
- self->iter = 0;
- return EXPP_incr_ret ( (PyObject *) self );
- } else { /* alredy being iterated on, return a copy */
- BPy_MEdge *seq = (BPy_MEdge *)MEdge_CreatePyObject(self->mesh, self->index);
- seq->iter = 0;
- return (PyObject *)seq;
- }
-}
-
-/*
- * Return next MVert. Throw an exception after the second vertex.
- */
-
-static PyObject *MEdge_nextIter( BPy_MEdge * self )
-{
- if( self->iter == 2 ) {
- self->iter = -1;
- return EXPP_ReturnPyObjError( PyExc_StopIteration,
- "iterator at end" );
- }
-
- self->iter++;
- if( self->iter == 1 )
- return MEdge_getV1( self );
- else
- return MEdge_getV2( self );
-}
-
-/************************************************************************
- *
- * Python MEdge_Type standard operations
- *
- ************************************************************************/
-
-static int MEdge_compare( BPy_MEdge * a, BPy_MEdge * b )
-{
- return( a->mesh == b->mesh && a->index == b->index ) ? 0 : -1;
-}
-
-static PyObject *MEdge_repr( BPy_MEdge * self )
-{
- struct MEdge *edge = MEdge_get_pointer( self );
-
- if( !edge )
- return NULL;
-
- return PyString_FromFormat( "[MEdge (%d %d) %d %d]",
- (int)edge->v1, (int)edge->v2, (int)edge->crease,
- (int)self->index );
-}
-
-static long MEdge_hash( BPy_MEdge *self )
-{
- return (long)self->index;
-}
-static PyObject *MEdge_getProp( BPy_MEdge *self, PyObject *args)
-{
- Mesh *me = (Mesh *)self->mesh;
- return Mesh_getProperty_internal(&(me->edata), self->index, args);
-}
-
-static PyObject *MEdge_setProp( BPy_MEdge *self, PyObject *args)
-{
- Mesh *me = (Mesh *)self->mesh;
- return Mesh_setProperty_internal(&(me->edata), self->index, args);
-}
-
-static struct PyMethodDef BPy_MEdge_methods[] = {
- {"getProperty", (PyCFunction)MEdge_getProp, METH_O,
- "get property indicated by name"},
- {"setProperty", (PyCFunction)MEdge_setProp, METH_VARARGS,
- "set property indicated by name"},
- {NULL, NULL, 0, NULL}
-};
-/************************************************************************
- *
- * Python MEdge_Type structure definition
- *
- ************************************************************************/
-
-PyTypeObject MEdge_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender MEdge", /* char *tp_name; */
- sizeof( BPy_MEdge ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL, /* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- ( cmpfunc ) MEdge_compare, /* cmpfunc tp_compare; */
- ( reprfunc ) MEdge_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- NULL, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- ( hashfunc ) MEdge_hash, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
- 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, /* 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, /* richcmpfunc tp_richcompare; */
-
- /*** weak reference enabler ***/
- 0, /* long tp_weaklistoffset; */
-
- /*** Added in release 2.2 ***/
- /* Iterators */
- ( getiterfunc) MEdge_getIter, /* getiterfunc tp_iter; */
- ( iternextfunc ) MEdge_nextIter, /* iternextfunc tp_iternext; */
-
- /*** Attribute descriptor and subclassing stuff ***/
- BPy_MEdge_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_MEdge_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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 PyObject *MEdge_CreatePyObject( Mesh * mesh, int i )
-{
- BPy_MEdge *obj = PyObject_NEW( BPy_MEdge, &MEdge_Type );
-
- if( !obj )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyObject_New() failed" );
-
- obj->mesh = mesh;
- obj->index = i;
- obj->iter = -1;
- return (PyObject *)obj;
-}
-
-/************************************************************************
- *
- * Edge sequence
- *
- ************************************************************************/
-
-static int MEdgeSeq_len( BPy_MEdgeSeq * self )
-{
- return self->mesh->totedge;
-}
-
-static PyObject *MEdgeSeq_item( BPy_MEdgeSeq * self, int i )
-{
- if( i < 0 || i >= self->mesh->totedge )
- return EXPP_ReturnPyObjError( PyExc_IndexError,
- "array index out of range" );
-
- return MEdge_CreatePyObject( self->mesh, i );
-}
-
-
-static PySequenceMethods MEdgeSeq_as_sequence = {
- ( inquiry ) MEdgeSeq_len, /* sq_length */
- ( binaryfunc ) 0, /* sq_concat */
- ( intargfunc ) 0, /* sq_repeat */
- ( intargfunc ) MEdgeSeq_item, /* sq_item */
- ( intintargfunc ) 0, /* sq_slice */
- ( intobjargproc ) 0, /* sq_ass_item */
- ( intintobjargproc ) 0, /* sq_ass_slice */
- 0,0,0,
-};
-
-/************************************************************************
- *
- * Python MEdgeSeq_Type iterator (iterates over edges)
- *
- ************************************************************************/
-
-/*
- * Initialize the interator index
- */
-
-static PyObject *MEdgeSeq_getIter( BPy_MEdgeSeq * self )
-{
- if (self->iter==-1) { /* iteration for this pyobject is not yet used, just return self */
- self->iter = 0;
- return EXPP_incr_ret ( (PyObject *) self );
- } else {
- BPy_MEdgeSeq *seq = (BPy_MEdgeSeq *)MEdgeSeq_CreatePyObject(self->mesh);
- seq->iter = 0;
- return (PyObject *)seq;
- }
-}
-
-/*
- * Return next MEdge.
- */
-
-static PyObject *MEdgeSeq_nextIter( BPy_MEdgeSeq * self )
-{
- if( self->iter == self->mesh->totedge ) {
- self->iter= -1;
- return EXPP_ReturnPyObjError( PyExc_StopIteration,
- "iterator at end" );
- }
-
- return MEdge_CreatePyObject( self->mesh, self->iter++ );
-}
-
-/************************************************************************
- *
- * Python MEdgeSeq_Type methods
- *
- ************************************************************************/
-
-/*
- * Create edges from tuples of vertices. Duplicate new edges, or
- * edges which already exist,
- */
-
-static PyObject *MEdgeSeq_extend( BPy_MEdgeSeq * self, PyObject *args )
-{
- int len, nverts;
- int i, j, ok;
- int new_edge_count, good_edges;
- SrchEdges *oldpair, *newpair, *tmppair, *tmppair2;
- PyObject *tmp;
- BPy_MVert *e[4];
- MEdge *tmpedge;
- Mesh *mesh = self->mesh;
-
- /* make sure we get a tuple of sequences of something */
- switch( PySequence_Size( args ) ) {
- case 1:
- /* if a sequence... */
- tmp = PyTuple_GET_ITEM( args, 0 );
- if( PySequence_Check( tmp ) ) {
- PyObject *tmp2;
-
- /* ignore empty sequences */
- if( !PySequence_Size( tmp ) ) {
- Py_RETURN_NONE;
- }
-
- /* if another sequence, use it */
- tmp2 = PySequence_ITEM( tmp, 0 );
- if( PySequence_Check( tmp2 ) )
- args = tmp;
- Py_INCREF( args );
- Py_DECREF( tmp2 );
- } else
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a sequence of sequence pairs" );
- break;
- case 2:
- case 3:
- case 4: /* two to four args may be individual verts */
- tmp = PyTuple_GET_ITEM( args, 0 );
- /*
- * if first item isn't a sequence, then assume it's a bunch of MVerts
- * and wrap inside a tuple
- */
- if( !PySequence_Check( tmp ) ) {
- args = Py_BuildValue( "(O)", args );
- if( !args )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "Py_BuildValue() failed" );
- /*
- * otherwise, assume it already a bunch of sequences so use as-is
- */
- } else {
- Py_INCREF( args ); /* so we can safely DECREF later */
- }
- break;
- default: /* anything else is definitely wrong */
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a sequence of sequence pairs" );
- }
-
- /* make sure there is something to add */
- len = PySequence_Size( args );
- if( len == 0 ) {
- Py_DECREF ( args );
- Py_RETURN_NONE;
- }
-
- /* verify the param list and get a total count of number of edges */
- new_edge_count = 0;
- for( i = 0; i < len; ++i ) {
- tmp = PySequence_GetItem( args, i );
-
- /* not a tuple of MVerts... error */
- if( !PySequence_Check( tmp ) ) {
- Py_DECREF( tmp );
- Py_DECREF( args );
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "expected sequence of MVert sequences" );
- }
-
- /* not the right number of MVerts... error */
- nverts = PySequence_Size( tmp );
- if( nverts < 2 || nverts > 4 ) {
- Py_DECREF( tmp );
- Py_DECREF( args );
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "expected 2 to 4 MVerts per sequence" );
- }
-
- if( EXPP_check_sequence_consistency( tmp, &MVert_Type ) == 1 ) {
-
- /* get MVerts, check they're from this mesh */
- ok = 1;
- for( j = 0; ok && j < nverts; ++j ) {
- e[0] = (BPy_MVert *)PySequence_GetItem( tmp, j );
- if( (void *)e[0]->data != (void *)self->mesh )
- ok = 0;
- Py_DECREF( e[0] );
- }
- Py_DECREF( tmp );
-
- /* not MVerts from another mesh ... error */
- if( !ok ) {
- Py_DECREF( args );
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "vertices are from a different mesh" );
- }
- } else {
- ok = 0;
- for( j = 0; ok == 0 && j < nverts; ++j ) {
- PyObject *item = PySequence_ITEM( tmp, j );
- if( !PyInt_Check( item ) )
- ok = 1;
- else {
- int index = PyInt_AsLong ( item );
- if( index < 0 || index >= self->mesh->totvert )
- ok = 2;
- }
- Py_DECREF( item );
- }
- Py_DECREF( tmp );
-
- /* not ints or outside of vertex list ... error */
- if( ok ) {
- Py_DECREF( args );
- if( ok == 1 )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected an integer index" );
- else
- return EXPP_ReturnPyObjError( PyExc_KeyError,
- "index out of range" );
- }
- }
-
- if( nverts == 2 )
- ++new_edge_count; /* if only two vert, then add only edge */
- else
- new_edge_count += nverts; /* otherwise, one edge per vert */
- }
-
- /* OK, commit to allocating the search structures */
- newpair = (SrchEdges *)MEM_callocN( sizeof(SrchEdges)*new_edge_count,
- "MEdgePairs" );
-
- /* scan the input list and build the new edge pair list */
- len = PySequence_Size( args );
- tmppair = newpair;
- new_edge_count = 0;
- for( i = 0; i < len; ++i ) {
- int edge_count;
- int eedges[4];
- tmp = PySequence_GetItem( args, i );
- nverts = PySequence_Size( tmp );
-
- /* get new references for the vertices */
- for(j = 0; j < nverts; ++j ) {
- PyObject *item = PySequence_ITEM( tmp, j );
- if( BPy_MVert_Check( item ) ) {
- eedges[j] = ((BPy_MVert *)item)->index;
- } else {
- eedges[j] = PyInt_AsLong ( item );
- }
- Py_DECREF( item );
- }
- Py_DECREF( tmp );
-
- if( nverts == 2 )
- edge_count = 1; /* again, two verts give just one edge */
- else
- edge_count = nverts;
-
- /* now add the edges to the search list */
- for( j = 0; j < edge_count; ++j ) {
- int k = j+1;
- if( k == nverts ) /* final edge */
- k = 0;
-
- /* sort verts into search list, skip if two are the same */
- if( eedges[j] != eedges[k] ) {
- if( eedges[j] < eedges[k] ) {
- tmppair->v[0] = eedges[j];
- tmppair->v[1] = eedges[k];
- tmppair->swap = 0;
- } else {
- tmppair->v[0] = eedges[k];
- tmppair->v[1] = eedges[j];
- tmppair->swap = 1;
- }
- tmppair->index = new_edge_count;
- ++new_edge_count;
- tmppair++;
- }
- }
-
- }
-
- /* sort the new edge pairs */
- qsort( newpair, new_edge_count, sizeof(SrchEdges), medge_comp );
-
- /*
- * find duplicates in the new list and mark. if it's a duplicate,
- * then mark by setting second vert index to 0 (a real edge won't have
- * second vert index of 0 since verts are sorted)
- */
-
- good_edges = new_edge_count; /* all edges are good at this point */
-
- tmppair = newpair; /* "last good edge" */
- tmppair2 = &tmppair[1]; /* "current candidate edge" */
- for( i = 0; i < new_edge_count; ++i ) {
- if( tmppair->v[0] != tmppair2->v[0] ||
- tmppair->v[1] != tmppair2->v[1] )
- tmppair = tmppair2; /* last != current, so current == last */
- else {
- tmppair2->v[1] = 0; /* last == current, so mark as duplicate */
- --good_edges; /* one less good edge */
- }
- tmppair2++;
- }
-
- /* if mesh has edges, see if any of the new edges are already in it */
- if( mesh->totedge ) {
- oldpair = (SrchEdges *)MEM_callocN( sizeof(SrchEdges)*mesh->totedge,
- "MEdgePairs" );
-
- /*
- * build a search list of new edges (don't need to update "swap"
- * field, since we're not creating edges here)
- */
- tmppair = oldpair;
- tmpedge = mesh->medge;
- for( i = 0; i < mesh->totedge; ++i ) {
- if( tmpedge->v1 < tmpedge->v2 ) {
- tmppair->v[0] = tmpedge->v1;
- tmppair->v[1] = tmpedge->v2;
- } else {
- tmppair->v[0] = tmpedge->v2;
- tmppair->v[1] = tmpedge->v1;
- }
- ++tmpedge;
- ++tmppair;
- }
-
- /* sort the old edge pairs */
- qsort( oldpair, mesh->totedge, sizeof(SrchEdges), medge_comp );
-
- /* eliminate new edges already in the mesh */
- tmppair = newpair;
- for( i = new_edge_count; i-- ; ) {
- if( tmppair->v[1] ) {
- if( bsearch( tmppair, oldpair, mesh->totedge,
- sizeof(SrchEdges), medge_comp ) ) {
- tmppair->v[1] = 0; /* mark as duplicate */
- --good_edges;
- }
- }
- tmppair++;
- }
- MEM_freeN( oldpair );
- }
-
- /* if any new edges are left, add to list */
- if( good_edges ) {
- CustomData edata;
- int totedge = mesh->totedge+good_edges;
-
- /* create custom edge data arrays and copy existing edges into it */
- CustomData_copy( &mesh->edata, &edata, CD_MASK_MESH, CD_DEFAULT, totedge );
- CustomData_copy_data( &mesh->edata, &edata, 0, 0, mesh->totedge );
-
- if ( !CustomData_has_layer( &edata, CD_MEDGE ) )
- CustomData_add_layer( &edata, CD_MEDGE, CD_CALLOC, NULL, totedge );
-
- /* replace old with new data */
- CustomData_free( &mesh->edata, mesh->totedge );
- mesh->edata = edata;
- mesh_update_customdata_pointers( mesh );
-
- /* resort edges into original order */
- qsort( newpair, new_edge_count, sizeof(SrchEdges), medge_index_comp );
-
- /* point to the first edge we're going to add */
- tmpedge = &mesh->medge[mesh->totedge];
- tmppair = newpair;
-
- /* as we find a good edge, add it */
- while( good_edges ) {
- if( tmppair->v[1] ) { /* not marked as duplicate ! */
- if( !tmppair->swap ) {
- tmpedge->v1 = tmppair->v[0];
- tmpedge->v2 = tmppair->v[1];
- } else {
- tmpedge->v1 = tmppair->v[1];
- tmpedge->v2 = tmppair->v[0];
- }
- tmpedge->flag = ME_EDGEDRAW | ME_EDGERENDER | SELECT;
- mesh->totedge++;
- --good_edges;
- ++tmpedge;
- }
- tmppair++;
- }
- }
-
- /* clean up and leave */
- mesh_update( mesh );
- MEM_freeN( newpair );
- Py_DECREF ( args );
- Py_RETURN_NONE;
-}
-
-static PyObject *MEdgeSeq_delete( BPy_MEdgeSeq * self, PyObject *args )
-{
- Mesh *mesh = self->mesh;
- MEdge *srcedge;
- MFace *srcface;
- unsigned int *vert_table, *del_table, *edge_table;
- int i, len;
- int face_count, edge_count, vert_count;
-
- /*
- * if input tuple contains a single sequence, use it as input instead;
- * otherwise use the sequence as-is and check later that it contains
- * one or more integers or MVerts
- */
- if( PySequence_Size( args ) == 1 ) {
- PyObject *tmp = PyTuple_GET_ITEM( args, 0 );
- if( PySequence_Check( tmp ) )
- args = tmp;
- }
-
- /* if sequence is empty, do nothing */
- len = PySequence_Size( args );
- if( len == 0 ) {
- Py_RETURN_NONE;
- }
-
- edge_table = (unsigned int *)MEM_callocN( len*sizeof( unsigned int ),
- "edge_table" );
-
- /* get the indices of edges to be removed */
- for( i = len; i--; ) {
- PyObject *tmp = PySequence_GetItem( args, i );
- if( BPy_MEdge_Check( tmp ) )
- edge_table[i] = ((BPy_MEdge *)tmp)->index;
- else if( PyInt_Check( tmp ) )
- edge_table[i] = PyInt_AsLong ( tmp );
- else {
- MEM_freeN( edge_table );
- Py_DECREF( tmp );
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a sequence of ints or MEdges" );
- }
- Py_DECREF( tmp );
-
- /* if index out-of-range, throw exception */
- if( edge_table[i] >= (unsigned int)mesh->totedge ) {
- MEM_freeN( edge_table );
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "array index out of range" );
- }
- }
-
- /*
- * build two tables: first table marks vertices which belong to an edge
- * which is being deleted
- */
- del_table = (unsigned int *)MEM_callocN(
- mesh->totvert*sizeof( unsigned int ), "vert_table" );
-
- /*
- * Borrow a trick from editmesh code: for each edge to be deleted, mark
- * its vertices as well. Then go through face list and look for two
- * consecutive marked vertices.
- */
-
- /* mark each edge that's to be deleted */
- srcedge = mesh->medge;
- for( i = len; i--; ) {
- unsigned int idx = edge_table[i];
- del_table[srcedge[idx].v1] = UINT_MAX;
- del_table[srcedge[idx].v2] = UINT_MAX;
- srcedge[idx].v1 = UINT_MAX;
- }
-
- /*
- * second table is used for vertices which become orphaned (belong to no
- * edges) and need to be deleted; it's also the normal lookup table for
- * old->new vertex indices
- */
-
- vert_table = (unsigned int *)MEM_mallocN(
- mesh->totvert*sizeof( unsigned int ), "vert_table" );
-
- /* assume all edges will be deleted (fills with UINT_MAX) */
- memset( vert_table, UCHAR_MAX, mesh->totvert*sizeof( unsigned int ) );
-
- /* unmark vertices of each "good" edge; count each "bad" edge */
- edge_count = 0;
- for( i = mesh->totedge; i--; ++srcedge )
- if( srcedge->v1 != UINT_MAX )
- vert_table[srcedge->v1] = vert_table[srcedge->v2] = 0;
- else
- ++edge_count;
-
- /*
- * find faces which no longer have all edges
- */
-
- face_count = 0;
- srcface = mesh->mface;
- for( i = 0; i < mesh->totface; ++i, ++srcface ) {
- int len = srcface->v4 ? 4 : 3;
- unsigned int id[4];
- int del;
-
- id[0] = del_table[srcface->v1];
- id[1] = del_table[srcface->v2];
- id[2] = del_table[srcface->v3];
- id[3] = del_table[srcface->v4];
-
- del = ( id[0] == UINT_MAX && id[1] == UINT_MAX ) ||
- ( id[1] == UINT_MAX && id[2] == UINT_MAX );
- if( !del ) {
- if( len == 3 )
- del = ( id[2] == UINT_MAX && id[0] == UINT_MAX );
- else
- del = ( id[2] == UINT_MAX && id[3] == UINT_MAX ) ||
- ( id[3] == UINT_MAX && id[0] == UINT_MAX );
- }
- if( del ) {
- srcface->v1 = UINT_MAX;
- ++face_count;
- }
- }
-
- /* fix the vertex lookup table, if any verts to delete, do so now */
- vert_count = make_vertex_table( vert_table, mesh->totvert );
- if( vert_count )
- delete_verts( mesh, vert_table, vert_count );
-
- /* delete faces which have a deleted edge */
- delete_faces( mesh, vert_table, face_count );
-
- /* now delete the edges themselves */
- delete_edges( mesh, vert_table, edge_count );
-
- /* clean up and return */
- MEM_freeN( del_table );
- MEM_freeN( vert_table );
- MEM_freeN( edge_table );
- mesh_update ( mesh );
- Py_RETURN_NONE;
-}
-
-static PyObject *MEdgeSeq_collapse( BPy_MEdgeSeq * self, PyObject *args )
-{
- MEdge *srcedge;
- unsigned int *edge_table;
- float (*vert_list)[3];
- int i, len;
- Base *base, *basact;
- Mesh *mesh = self->mesh;
- Object *object = NULL;
- PyObject *tmp;
-
- /*
- * when using removedoublesflag(), we need to switch to editmode, so
- * nobody else can be using it
- */
-
- if( G.obedit )
- return EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "can't use collapse() while in edit mode" );
-
- /* make sure we get a tuple of sequences of something */
- switch( PySequence_Size( args ) ) {
- case 1:
- /* if a sequence... */
- tmp = PyTuple_GET_ITEM( args, 0 );
- if( PySequence_Check( tmp ) ) {
- PyObject *tmp2;
-
- /* ignore empty sequences */
- if( !PySequence_Size( tmp ) ) {
- Py_RETURN_NONE;
- }
-
- /* if another sequence, use it */
- tmp2 = PySequence_ITEM( tmp, 0 );
- if( PySequence_Check( tmp2 ) )
- args = tmp;
- Py_INCREF( args );
- Py_DECREF( tmp2 );
- } else
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a sequence of sequence pairs" );
- break;
- case 2: /* two args may be individual edges/verts */
- tmp = PyTuple_GET_ITEM( args, 0 );
- /*
- * if first item isn't a sequence, then assume it's a bunch of MVerts
- * and wrap inside a tuple
- */
- if( !PySequence_Check( tmp ) ) {
- args = Py_BuildValue( "(O)", args );
- if( !args )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "Py_BuildValue() failed" );
- /*
- * otherwise, assume it already a bunch of sequences so use as-is
- */
- } else {
- Py_INCREF( args ); /* so we can safely DECREF later */
- }
- break;
- default: /* anything else is definitely wrong */
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a sequence of sequence pairs" );
- }
-
- /* if sequence is empty, do nothing */
- len = PySequence_Size( args );
- if( len == 0 ) {
- Py_RETURN_NONE;
- }
-
- /* allocate table of edge indices and new vertex values */
-
- edge_table = (unsigned int *)MEM_callocN( len*sizeof( unsigned int ),
- "edge_table" );
- vert_list = (float (*)[3])MEM_callocN( 3*len*sizeof( float ),
- "vert_list" );
-
- /* get the indices of edges to be collapsed and new vert locations */
- for( i = len; i--; ) {
- PyObject *tmp1;
- PyObject *tmp2;
-
- tmp = PySequence_GetItem( args, i );
-
- /* if item isn't sequence of size 2, error */
- if( !PySequence_Check( tmp ) || PySequence_Size( tmp ) != 2 ) {
- MEM_freeN( edge_table );
- MEM_freeN( vert_list );
- Py_DECREF( tmp );
- Py_DECREF( args );
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a sequence of (MEdges, vector)" );
- }
-
- /* if items aren't a MEdge/int and vector, error */
- tmp1 = PySequence_GetItem( tmp, 0 );
- tmp2 = PySequence_GetItem( tmp, 1 );
- Py_DECREF( tmp );
- if( !(BPy_MEdge_Check( tmp1 ) || PyInt_Check( tmp1 )) ||
- !VectorObject_Check ( tmp2 ) ) {
- MEM_freeN( edge_table );
- MEM_freeN( vert_list );
- Py_DECREF( tmp1 );
- Py_DECREF( tmp2 );
- Py_DECREF( args );
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a sequence of (MEdges, vector)" );
- }
-
- /* store edge index, new vertex location */
- if( PyInt_Check( tmp1 ) )
- edge_table[i] = PyInt_AsLong ( tmp1 );
- else
- edge_table[i] = ((BPy_MEdge *)tmp1)->index;
- memcpy( vert_list[i], ((VectorObject *)tmp2)->vec,
- 3*sizeof( float ) );
- Py_DECREF( tmp1 );
- Py_DECREF( tmp2 );
-
- /* if index out-of-range, throw exception */
- if( edge_table[i] >= (unsigned int)mesh->totedge ) {
- MEM_freeN( edge_table );
- MEM_freeN( vert_list );
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "edge index out of range" );
- }
- }
-
- /*
- * simple algorithm:
- * (1) deselect all verts
- * (2) for each edge
- * (2a) replace both verts with the new vert
- * (2b) select both verts
- * (3) call removedoublesflag()
- */
-
- /* (1) deselect all verts */
- for( i = mesh->totvert; i--; )
- mesh->mvert[i].flag &= ~SELECT;
-
- /* (2) replace edge's verts and select them */
- for( i = len; i--; ) {
- srcedge = &mesh->medge[edge_table[i]];
- memcpy( &mesh->mvert[srcedge->v1].co, vert_list[i], 3*sizeof( float ) );
- memcpy( &mesh->mvert[srcedge->v2].co, vert_list[i], 3*sizeof( float ) );
- mesh->mvert[srcedge->v1].flag |= SELECT;
- mesh->mvert[srcedge->v2].flag |= SELECT;
- }
-
- /* (3) call removedoublesflag() */
- for( base = FIRSTBASE; base; base = base->next ) {
- if( base->object->type == OB_MESH &&
- base->object->data == self->mesh ) {
- object = base->object;
- break;
- }
- }
-
- basact = BASACT;
- BASACT = base;
-
- removedoublesflag( 1, 0, 0.0 );
- /* make mesh's object active, enter mesh edit mode */
- G.obedit = object;
-
- /* exit edit mode, free edit mesh */
- load_editMesh();
- free_editMesh(G.editMesh);
-
- BASACT = basact;
-
- /* clean up and exit */
- Py_DECREF( args );
- MEM_freeN( vert_list );
- MEM_freeN( edge_table );
- mesh_update ( mesh );
- Py_RETURN_NONE;
-}
-
-
-static PyObject *MEdgeSeq_selected( BPy_MEdgeSeq * self )
-{
- int i, count;
- Mesh *mesh = self->mesh;
- MEdge *tmpedge;
- PyObject *list;
-
- /* first count selected edges (quicker than appending to PyList?) */
- count = 0;
- tmpedge = mesh->medge;
- for( i = 0; i < mesh->totedge; ++i, ++tmpedge )
- if( (mesh->mvert[tmpedge->v1].flag & SELECT) &&
- (mesh->mvert[tmpedge->v2].flag & SELECT) )
- ++count;
-
- list = PyList_New( count );
- if( !list )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyList_New() failed" );
-
- /* next, insert selected edges into list */
- count = 0;
- tmpedge = mesh->medge;
- for( i = 0; i < mesh->totedge; ++i, ++tmpedge ) {
- if( (mesh->mvert[tmpedge->v1].flag & SELECT) &&
- (mesh->mvert[tmpedge->v2].flag & SELECT) ) {
- PyObject *tmp = PyInt_FromLong( i );
- if( !tmp ) {
- Py_DECREF( list );
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyInt_FromLong() failed" );
- }
- PyList_SET_ITEM( list, count, tmp );
- ++count;
- }
- }
- return list;
-}
-
-static PyObject *MEdgeSeq_add_layertype(BPy_MEdgeSeq *self, PyObject *args)
-{
- Mesh *me = (Mesh*)self->mesh;
- return Mesh_addPropLayer_internal(me, &(me->edata), me->totedge, args);
-}
-static PyObject *MEdgeSeq_del_layertype(BPy_MEdgeSeq *self, PyObject *value)
-{
- Mesh *me = (Mesh*)self->mesh;
- return Mesh_removePropLayer_internal(me, &(me->edata), me->totedge, value);
-}
-static PyObject *MEdgeSeq_rename_layertype(BPy_MEdgeSeq *self, PyObject *args)
-{
- Mesh *me = (Mesh*)self->mesh;
- return Mesh_renamePropLayer_internal(me,&(me->edata),args);
-}
-static PyObject *MEdgeSeq_PropertyList(BPy_MEdgeSeq *self)
-{
- Mesh *me = (Mesh*)self->mesh;
- return Mesh_propList_internal(&(me->edata));
-}
-
-
-static struct PyMethodDef BPy_MEdgeSeq_methods[] = {
- {"extend", (PyCFunction)MEdgeSeq_extend, METH_VARARGS,
- "add edges to mesh"},
- {"delete", (PyCFunction)MEdgeSeq_delete, METH_VARARGS,
- "delete edges from mesh"},
- {"selected", (PyCFunction)MEdgeSeq_selected, METH_NOARGS,
- "returns a list containing indices of selected edges"},
- {"collapse", (PyCFunction)MEdgeSeq_collapse, METH_VARARGS,
- "collapse one or more edges to a vertex"},
- {"addPropertyLayer",(PyCFunction)MEdgeSeq_add_layertype, METH_VARARGS,
- "add a new property layer"},
- {"removePropertyLayer",(PyCFunction)MEdgeSeq_del_layertype, METH_O,
- "removes a property layer"},
- {"renamePropertyLayer",(PyCFunction)MEdgeSeq_rename_layertype, METH_VARARGS,
- "renames an existing property layer"},
-
- {NULL, NULL, 0, NULL}
-};
-static PyGetSetDef BPy_MEdgeSeq_getseters[] = {
- {"properties",
- (getter)MEdgeSeq_PropertyList, (setter)NULL,
- "edge property layers, read only",
- NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-
-/************************************************************************
- *
- * Python MEdgeSeq_Type standard operators
- *
- ************************************************************************/
-
-/*****************************************************************************/
-/* Python MEdgeSeq_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject MEdgeSeq_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender MEdgeSeq", /* char *tp_name; */
- sizeof( BPy_MEdgeSeq ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL, /* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- NULL, /* cmpfunc tp_compare; */
- NULL, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- &MEdgeSeq_as_sequence, /* 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; */
- 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, /* 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, /* richcmpfunc tp_richcompare; */
-
- /*** weak reference enabler ***/
- 0, /* long tp_weaklistoffset; */
-
- /*** Added in release 2.2 ***/
- /* Iterators */
- ( getiterfunc) MEdgeSeq_getIter, /* getiterfunc tp_iter; */
- ( iternextfunc ) MEdgeSeq_nextIter, /* iternextfunc tp_iternext; */
-
- /*** Attribute descriptor and subclassing stuff ***/
- BPy_MEdgeSeq_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_MEdgeSeq_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-/************************************************************************
- *
- * Face attributes
- *
- ************************************************************************/
-
-static MFace * MFace_get_pointer( BPy_MFace * self )
-{
- if( self->index >= self->mesh->totface )
- return (MFace *)EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "MFace is no longer valid" );
- return &self->mesh->mface[self->index];
-}
-
-/*
- * get a face's vertices
- */
-
-static PyObject *MFace_getVerts( BPy_MFace * self )
-{
- PyObject *attr;
- MFace *face = MFace_get_pointer( self );
-
- if( !face )
- return NULL;
-
- attr = PyTuple_New( face->v4 ? 4 : 3 );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyTuple_New() failed" );
-
- PyTuple_SetItem( attr, 0, MVert_CreatePyObject( self->mesh, face->v1 ) );
- PyTuple_SetItem( attr, 1, MVert_CreatePyObject( self->mesh, face->v2 ) );
- PyTuple_SetItem( attr, 2, MVert_CreatePyObject( self->mesh, face->v3 ) );
- if( face->v4 )
- PyTuple_SetItem( attr, 3, MVert_CreatePyObject( self->mesh,
- face->v4 ) );
-
- return attr;
-}
-
-/*
- * set a face's vertices
- */
-
-static int MFace_setVerts( BPy_MFace * self, PyObject * args )
-{
- BPy_MVert *v1, *v2, *v3, *v4 = NULL;
- MFace *face = MFace_get_pointer( self );
-
- if( !face )
- return -1;
-
- if( !PyArg_ParseTuple ( args, "O!O!O!|O!", &MVert_Type, &v1,
- &MVert_Type, &v2, &MVert_Type, &v3, &MVert_Type, &v4 ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected tuple of 3 or 4 MVerts" );
-
- if( v1->index == v2->index ||
- v1->index == v3->index ||
- v2->index == v3->index )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "cannot assign 2 or move verts that are the same" );
-
- if(v4 && ( v1->index == v4->index ||
- v2->index == v4->index ||
- v3->index == v4->index ))
- return EXPP_ReturnIntError( PyExc_ValueError,
- "cannot assign 2 or move verts that are the same" );
-
- if( v1->index >= self->mesh->totvert ||
- v2->index >= self->mesh->totvert ||
- v3->index >= self->mesh->totvert ||
- (v4 &&( v4->index >= self->mesh->totvert)))
- return EXPP_ReturnIntError( PyExc_ValueError,
- "cannot assign verts that have been removed" );
-
- face->v1 = v1->index;
- face->v2 = v2->index;
- face->v3 = v3->index;
- if( v4 )
- face->v4 = v4->index;
- return 0;
-}
-
-/*
- * get face's material index
- */
-
-static PyObject *MFace_getMat( BPy_MFace * self )
-{
- MFace *face = MFace_get_pointer( self );
-
- if( !face )
- return NULL;
-
- return PyInt_FromLong( face->mat_nr );
-}
-
-/*
- * set face's material index
- */
-
-static int MFace_setMat( BPy_MFace * self, PyObject * value )
-{
- MFace *face = MFace_get_pointer( self );
-
- if( !face )
- return -1; /* error is set */
-
- return EXPP_setIValueRange( value, &face->mat_nr, 0, 15, 'b' );
-}
-
-/*
- * get a face's index
- */
-
-static PyObject *MFace_getIndex( BPy_MFace * self )
-{
- MFace *face = MFace_get_pointer( self );
-
- if( !face )
- return NULL; /* error is set */
-
- return PyInt_FromLong( self->index );
-}
-
-/*
- * get face's normal index
- */
-
-static PyObject *MFace_getNormal( BPy_MFace * self )
-{
- float *vert[4];
- float no[3];
- MFace *face = MFace_get_pointer( self );
-
- Mesh *me = self->mesh;
-
- if( !face )
- return NULL; /* error is set */
-
- if MFACE_VERT_BADRANGE_CHECK(me, face)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "one or more MFace vertices are no longer valid" );
-
- vert[0] = me->mvert[face->v1].co;
- vert[1] = me->mvert[face->v2].co;
- vert[2] = me->mvert[face->v3].co;
- if( face->v4 ) {
- vert[3] = me->mvert[face->v4].co;
- CalcNormFloat4( vert[0], vert[1], vert[2], vert[3], no );
- } else
- CalcNormFloat( vert[0], vert[1], vert[2], no );
-
- return newVectorObject( no, 3, Py_NEW );
-}
-
-/*
- * get face's center location
- */
-
-static PyObject *MFace_getCent( BPy_MFace * self )
-{
- float *vert[4];
- float cent[3]= {0,0,0};
- int i=3, j, k;
- Mesh *me = self->mesh;
- MFace *face = MFace_get_pointer( self );
-
- if( !face )
- return NULL; /* error is set */
-
-
- if MFACE_VERT_BADRANGE_CHECK(me, face)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "one or more MFace vertices are no longer valid" );
-
- vert[0] = me->mvert[face->v1].co;
- vert[1] = me->mvert[face->v2].co;
- vert[2] = me->mvert[face->v3].co;
- if( face->v4 ) {
- vert[3] = me->mvert[face->v4].co;
- i=4;
- }
-
- for (j=0;j<i;j++) {
- for (k=0;k<3;k++) {
- cent[k]+=vert[j][k];
- }
- }
-
- for (j=0;j<3;j++) {
- cent[j]=cent[j]/i;
- }
- return newVectorObject( cent, 3, Py_NEW );
-}
-
-/*
- * get face's area
- */
-static PyObject *MFace_getArea( BPy_MFace * self )
-{
- float *v1,*v2,*v3,*v4;
- MFace *face = MFace_get_pointer( self );
- Mesh *me = self->mesh;
-
- if( !face )
- return NULL; /* error is set */
-
- if MFACE_VERT_BADRANGE_CHECK(me, face)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "one or more MFace vertices are no longer valid" );
-
- v1 = me->mvert[face->v1].co;
- v2 = me->mvert[face->v2].co;
- v3 = me->mvert[face->v3].co;
-
- if( face->v4 ) {
- v4 = me->mvert[face->v4].co;
- return PyFloat_FromDouble( AreaQ3Dfl(v1, v2, v3, v4));
- } else
- return PyFloat_FromDouble( AreaT3Dfl(v1, v2, v3));
-}
-
-/*
- * get one of a face's mface flag bits
- */
-
-static PyObject *MFace_getMFlagBits( BPy_MFace * self, void * type )
-{
- MFace *face = MFace_get_pointer( self );
-
- if( !face )
- return NULL; /* error is set */
-
- return EXPP_getBitfield( &face->flag, (int)((long)type & 0xff), 'b' );
-}
-
-/*
- * set one of a face's mface flag bits
- */
-
-static int MFace_setMFlagBits( BPy_MFace * self, PyObject * value,
- void * type )
-{
- MFace *face = MFace_get_pointer( self );
-
- if( !face )
- return -1; /* error is set */
-
- return EXPP_setBitfield( value, &face->flag,
- (int)((long)type & 0xff), 'b' );
-}
-
-static int MFace_setSelect( BPy_MFace * self, PyObject * value,
- void * type_unused )
-{
- MFace *face = MFace_get_pointer( self );
- int param = PyObject_IsTrue( value );
- Mesh *me;
-
- if( !face )
- return -1; /* error is set */
-
- if( param == -1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected True/False or 0/1" );
-
- me = self->mesh;
- if( param ) {
- face->flag |= ME_FACE_SEL;
- me->mvert[face->v1].flag |= SELECT;
- me->mvert[face->v2].flag |= SELECT;
- me->mvert[face->v3].flag |= SELECT;
- if( face->v4 )
- me->mvert[face->v4].flag |= SELECT;
- }
- else {
- face->flag &= ~ME_FACE_SEL;
- me->mvert[face->v1].flag &= ~SELECT;
- me->mvert[face->v2].flag &= ~SELECT;
- me->mvert[face->v3].flag &= ~SELECT;
- if( face->v4 )
- me->mvert[face->v4].flag &= ~SELECT;
- }
-
- if( self->mesh->mselect ) {
- MEM_freeN( self->mesh->mselect );
- self->mesh->mselect = NULL;
- }
-
- return 0;
-}
-
-/*
- * get face's texture image
- */
-
-static PyObject *MFace_getImage( BPy_MFace *self )
-{
- MTFace *face;
- if( !self->mesh->mtface )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "face has no texture values" );
-
- if( !MFace_get_pointer( self ) )
- return NULL;
-
- face = &self->mesh->mtface[self->index];
-
- if( face->tpage )
- return Image_CreatePyObject( face->tpage );
- else
- Py_RETURN_NONE;
-}
-
-/*
- * change or clear face's texture image
- */
-
-static int MFace_setImage( BPy_MFace *self, PyObject *value )
-{
- MTFace *face;
-
- if( !MFace_get_pointer( self ) )
- return -1;
-
- if( value && value != Py_None && !BPy_Image_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected image object or None" );
-
- if( !self->mesh->mtface )
-#if 0
- return EXPP_ReturnIntError( PyExc_ValueError,
- "face has no texture values" );
-#else
- make_tfaces( self->mesh );
-#endif
-
- face = &self->mesh->mtface[self->index];
-
- if( value == NULL || value == Py_None )
- face->tpage = NULL; /* should memory be freed? */
- else {
- face->tpage = ( ( BPy_Image * ) value )->image;
- face->mode |= TF_TEX;
- }
-
- return 0;
-}
-
-#define MFACE_FLAG_BITMASK ( TF_SELECT | TF_SEL1 | \
- TF_SEL2 | TF_SEL3 | TF_SEL4 | TF_HIDE )
-
-/*
-* get face's texture flag
-*/
-
-static PyObject *MFace_getFlag( BPy_MFace *self )
-{
- int flag;
- if( !self->mesh->mtface )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "face has no texture values" );
-
- if( !MFace_get_pointer( self ) )
- return NULL;
-
- flag = self->mesh->mtface[self->index].flag & MFACE_FLAG_BITMASK;
-
- /* so old scripts still work */
- if (self->index == self->mesh->act_face)
- flag |= TF_ACTIVE;
-
- return PyInt_FromLong( (long)( flag ) );
-}
-
-/*
- * set face's texture flag
- */
-
-static int MFace_setFlag( BPy_MFace *self, PyObject *value )
-{
- int param;
-
- if( !self->mesh->mtface )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "face has no texture values" );
-
- if( !MFace_get_pointer( self ) )
- return -1;
-
- if( !PyInt_Check ( value ) ) {
- char errstr[128];
- sprintf ( errstr , "expected int bitmask of 0x%04x", MFACE_FLAG_BITMASK );
- return EXPP_ReturnIntError( PyExc_TypeError, errstr );
- }
- param = PyInt_AS_LONG ( value );
-
- /* only one face can be active, so don't allow that here */
- if( param & TF_ACTIVE )
- param &= ~TF_ACTIVE;
-
- if( ( param & MFACE_FLAG_BITMASK ) != param )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "invalid bit(s) set in mask" );
-
- /* merge active setting with other new params */
- param |= (self->mesh->mtface[self->index].flag);
- self->mesh->mtface[self->index].flag = (char)param;
-
- return 0;
-}
-
-/*
- * get face's texture mode
- */
-
-static PyObject *MFace_getMode( BPy_MFace *self )
-{
- if( !self->mesh->mtface )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "face has no texture values" );
-
- if( !MFace_get_pointer( self ) )
- return NULL;
-
- return PyInt_FromLong( self->mesh->mtface[self->index].mode );
-}
-
-/*
- * set face's texture mode
- */
-
-static int MFace_setMode( BPy_MFace *self, PyObject *value )
-{
- int param;
- static short bitmask = TF_DYNAMIC
- | TF_TEX
- | TF_SHAREDVERT
- | TF_LIGHT
- | TF_SHAREDCOL
- | TF_TILES
- | TF_BILLBOARD
- | TF_TWOSIDE
- | TF_INVISIBLE
- | TF_OBCOL
- | TF_BILLBOARD2
- | TF_SHADOW
- | TF_BMFONT;
-
- if( !self->mesh->mtface )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "face has no texture values" );
-
- if( !MFace_get_pointer( self ) )
- return -1;
-
- if( !PyInt_Check ( value ) ) {
- char errstr[128];
- sprintf ( errstr , "expected int bitmask of 0x%04x", bitmask );
- return EXPP_ReturnIntError( PyExc_TypeError, errstr );
- }
- param = PyInt_AS_LONG ( value );
-
- if( param == 0xffff ) /* if param is ALL, set everything but HALO */
- param = bitmask ^ TF_BILLBOARD;
- else if( ( param & bitmask ) != param )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "invalid bit(s) set in mask" );
-
- /* Blender UI doesn't allow these on at the same time */
-
- if( ( param & (TF_BILLBOARD | TF_BILLBOARD2) ) ==
- (TF_BILLBOARD | TF_BILLBOARD2) )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "HALO and BILLBOARD cannot be enabled simultaneously" );
-
- self->mesh->mtface[self->index].mode = (short)param;
-
- return 0;
-}
-
-/*
- * get face's texture transparency setting
- */
-
-static PyObject *MFace_getTransp( BPy_MFace *self )
-{
- if( !self->mesh->mtface )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "face has no texture values" );
-
- if( !MFace_get_pointer( self ) )
- return NULL;
-
- return PyInt_FromLong( self->mesh->mtface[self->index].transp );
-}
-
-/*
- * set face's texture transparency setting
- */
-
-static int MFace_setTransp( BPy_MFace *self, PyObject *value )
-{
- if( !self->mesh->mtface )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "face has no texture values" );
-
- if( !MFace_get_pointer( self ) )
- return -1;
-
- return EXPP_setIValueRange( value,
- &self->mesh->mtface[self->index].transp, TF_SOLID, TF_SUB, 'b' );
-}
-
-/*
- * get a face's texture UV coord values
- */
-
-static PyObject *MFace_getUV( BPy_MFace * self )
-{
- MTFace *face;
- PyObject *attr;
- int length, i;
-
- if( !self->mesh->mtface )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "face has no texture values" );
-
- if( !MFace_get_pointer( self ) )
- return NULL;
-
- face = &self->mesh->mtface[self->index];
- length = self->mesh->mface[self->index].v4 ? 4 : 3;
- attr = PyTuple_New( length );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyTuple_New() failed" );
-
- for( i=0; i<length; ++i ) {
- PyObject *vector = newVectorObject( face->uv[i], 2, Py_WRAP );
- if( !vector )
- return NULL;
- PyTuple_SetItem( attr, i, vector );
- }
-
- return attr;
-}
-
-/*
- * set a face's texture UV coord values
- */
-
-static int MFace_setUV( BPy_MFace * self, PyObject * value )
-{
- MTFace *face;
- int length, i;
-
- if( !MFace_get_pointer( self ) )
- return -1;
-
- if( !PySequence_Check( value ) ||
- EXPP_check_sequence_consistency( value, &vector_Type ) != 1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected sequence of vectors" );
-
- length = self->mesh->mface[self->index].v4 ? 4 : 3;
- if( length != PySequence_Size( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "size of vertex and UV sequences differ" );
-
- if( !self->mesh->mtface )
-#if 0
- return EXPP_ReturnIntError( PyExc_ValueError,
- "face has no texture values" );
-#else
- make_tfaces( self->mesh );
-#endif
-
- face = &self->mesh->mtface[self->index];
- for( i=0; i<length; ++i ) {
- VectorObject *vector = (VectorObject *)PySequence_ITEM( value, i );
- face->uv[i][0] = vector->vec[0];
- face->uv[i][1] = vector->vec[1];
- Py_DECREF( vector );
- }
- return 0;
-}
-
-/*
- * get a face's texture UV coord select state
- */
-
-static PyObject *MFace_getUVSel( BPy_MFace * self )
-{
- MTFace *face;
- PyObject *attr;
- int length, i, mask;
-
- if( !self->mesh->mtface )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "face has no texture values" );
-
- if( !MFace_get_pointer( self ) )
- return NULL;
-
- face = &self->mesh->mtface[self->index];
- length = self->mesh->mface[self->index].v4 ? 4 : 3;
- attr = PyTuple_New( length );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyTuple_New() failed" );
-
- /* get coord select state, one bit at a time */
- mask = TF_SEL1;
- for( i=0; i<length; ++i, mask <<= 1 ) {
- PyObject *value = PyInt_FromLong( face->flag & mask ? 1 : 0 );
- if( !value ) {
- Py_DECREF( attr );
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyInt_FromLong() failed" );
- }
- PyTuple_SetItem( attr, i, value );
- }
-
- return attr;
-}
-
-/*
- * set a face's texture UV coord select state
- */
-
-static int MFace_setUVSel( BPy_MFace * self, PyObject * value )
-{
- MTFace *face;
- int length, i, mask;
-
- if( !MFace_get_pointer( self ) )
- return -1;
-
- if( !PySequence_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a tuple of integers" );
-
- length = self->mesh->mface[self->index].v4 ? 4 : 3;
- if( length != PySequence_Size( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "size of vertex and UV lists differ" );
-
- if( !self->mesh->mtface )
-#if 0
- return EXPP_ReturnIntError( PyExc_ValueError,
- "face has no texture values" );
-#else
- make_tfaces( self->mesh );
-#endif
-
- /* set coord select state, one bit at a time */
- face = &self->mesh->mtface[self->index];
- mask = TF_SEL1;
- for( i=0; i<length; ++i, mask <<= 1 ) {
- PyObject *tmp = PySequence_GetItem( value, i ); /* adds a reference, remove below */
- if( !PyInt_Check( tmp ) ) {
- Py_DECREF(tmp);
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a tuple of integers" );
- }
- if( PyInt_AsLong( tmp ) )
- face->flag |= mask;
- else
- face->flag &= ~mask;
- Py_DECREF(tmp);
- }
- return 0;
-}
-
-/*
- * get a face's vertex colors. note that if mesh->mtfaces is defined, then
- * it takes precedent over mesh->mcol
- */
-
-static PyObject *MFace_getCol( BPy_MFace * self )
-{
- PyObject *attr;
- int length, i;
- MCol * mcol;
-
- /* if there's no mesh color vectors or texture faces, nothing to do */
-
- if( !self->mesh->mcol )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "face has no vertex colors" );
-
- if( !MFace_get_pointer( self ) )
- return NULL;
-
- mcol = &self->mesh->mcol[self->index*4];
-
- length = self->mesh->mface[self->index].v4 ? 4 : 3;
- attr = PyTuple_New( length );
-
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyTuple_New() failed" );
-
- for( i=0; i<length; ++i ) {
- PyObject *color = MCol_CreatePyObject( &mcol[i] );
- if( !color )
- return NULL;
- PyTuple_SetItem( attr, i, color );
- }
-
- return attr;
-}
-
-/*
- * set a face's vertex colors
- */
-
-static int MFace_setCol( BPy_MFace * self, PyObject *value )
-{
- int length, i;
- MCol * mcol;
-
- /* if there's no mesh color vectors or texture faces, nothing to do */
-
- if( !self->mesh->mcol )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "face has no vertex colors" );
-
- if( !MFace_get_pointer( self ) )
- return -1;
-
- mcol = &self->mesh->mcol[self->index*4];
-
- length = self->mesh->mface[self->index].v4 ? 4 : 3;
-
- if( !PyList_Check( value ) && !PyTuple_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a sequence of MCols" );
-
- if( EXPP_check_sequence_consistency( value, &MCol_Type ) != 1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a sequence of MCols" );
-
- if( PySequence_Size( value ) != length )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "incorrect number of colors for this face" );
-
- for( i=0; i<length; ++i ) {
- BPy_MCol *obj = (BPy_MCol *)PySequence_ITEM( value, i );
- mcol[i].r = obj->color->r;
- mcol[i].g = obj->color->g;
- mcol[i].b = obj->color->b;
- mcol[i].a = obj->color->a;
- Py_DECREF( obj );
- }
- return 0;
-}
-
-
-/*
- * get edge keys for using in a dictionary or set key
- */
-
-static PyObject *MFace_getEdgeKeys( BPy_MFace * self )
-{
- MFace *face = MFace_get_pointer( self );
- PyObject *attr, *edpair;
-
- if (!face)
- return NULL; /* error set */
-
- if (face->v4) {
- attr = PyTuple_New( 4 );
- edpair = PyTuple_New( 2 );
- if (face->v1 > face->v2) {
- PyTuple_SET_ITEM( edpair, 0, PyInt_FromLong(face->v2) );
- PyTuple_SET_ITEM( edpair, 1, PyInt_FromLong(face->v1) );
- } else {
- PyTuple_SET_ITEM( edpair, 0, PyInt_FromLong(face->v1) );
- PyTuple_SET_ITEM( edpair, 1, PyInt_FromLong(face->v2) );
- }
- PyTuple_SET_ITEM( attr, 0, edpair );
-
- edpair = PyTuple_New( 2 );
- if (face->v2 > face->v3) {
- PyTuple_SET_ITEM( edpair, 0, PyInt_FromLong(face->v3) );
- PyTuple_SET_ITEM( edpair, 1, PyInt_FromLong(face->v2) );
- } else {
- PyTuple_SET_ITEM( edpair, 0, PyInt_FromLong(face->v2) );
- PyTuple_SET_ITEM( edpair, 1, PyInt_FromLong(face->v3) );
- }
- PyTuple_SET_ITEM( attr, 1, edpair );
-
- edpair = PyTuple_New( 2 );
- if (face->v3 > face->v4) {
- PyTuple_SET_ITEM( edpair, 0, PyInt_FromLong(face->v4) );
- PyTuple_SET_ITEM( edpair, 1, PyInt_FromLong(face->v3) );
- } else {
- PyTuple_SET_ITEM( edpair, 0, PyInt_FromLong(face->v3) );
- PyTuple_SET_ITEM( edpair, 1, PyInt_FromLong(face->v4) );
- }
- PyTuple_SET_ITEM( attr, 2, edpair );
-
- edpair = PyTuple_New( 2 );
- if (face->v4 > face->v1) {
- PyTuple_SET_ITEM( edpair, 0, PyInt_FromLong(face->v1) );
- PyTuple_SET_ITEM( edpair, 1, PyInt_FromLong(face->v4) );
- } else {
- PyTuple_SET_ITEM( edpair, 0, PyInt_FromLong(face->v4) );
- PyTuple_SET_ITEM( edpair, 1, PyInt_FromLong(face->v1) );
- }
- PyTuple_SET_ITEM( attr, 3, edpair );
-
- } else {
-
- attr = PyTuple_New( 3 );
- edpair = PyTuple_New( 2 );
- if (face->v1 > face->v2) {
- PyTuple_SET_ITEM( edpair, 0, PyInt_FromLong(face->v2) );
- PyTuple_SET_ITEM( edpair, 1, PyInt_FromLong(face->v1) );
- } else {
- PyTuple_SET_ITEM( edpair, 0, PyInt_FromLong(face->v1) );
- PyTuple_SET_ITEM( edpair, 1, PyInt_FromLong(face->v2) );
- }
- PyTuple_SET_ITEM( attr, 0, edpair );
-
- edpair = PyTuple_New( 2 );
- if (face->v2 > face->v3) {
- PyTuple_SET_ITEM( edpair, 0, PyInt_FromLong(face->v3) );
- PyTuple_SET_ITEM( edpair, 1, PyInt_FromLong(face->v2) );
- } else {
- PyTuple_SET_ITEM( edpair, 0, PyInt_FromLong(face->v2) );
- PyTuple_SET_ITEM( edpair, 1, PyInt_FromLong(face->v3) );
- }
- PyTuple_SET_ITEM( attr, 1, edpair );
-
- edpair = PyTuple_New( 2 );
- if (face->v3 > face->v1) {
- PyTuple_SET_ITEM( edpair, 0, PyInt_FromLong(face->v1) );
- PyTuple_SET_ITEM( edpair, 1, PyInt_FromLong(face->v3) );
- } else {
- PyTuple_SET_ITEM( edpair, 0, PyInt_FromLong(face->v3) );
- PyTuple_SET_ITEM( edpair, 1, PyInt_FromLong(face->v1) );
- }
- PyTuple_SET_ITEM( attr, 2, edpair );
- }
-
- return attr;
-}
-
-
-/************************************************************************
- *
- * Python MFace_Type attributes get/set structure
- *
- ************************************************************************/
-
-static PyGetSetDef BPy_MFace_getseters[] = {
- {"verts",
- (getter)MFace_getVerts, (setter)MFace_setVerts,
- "face's vertices",
- NULL},
- {"v",
- (getter)MFace_getVerts, (setter)MFace_setVerts,
- "deprecated: see 'verts'",
- NULL},
- {"mat",
- (getter)MFace_getMat, (setter)MFace_setMat,
- "face's material index",
- NULL},
- {"index",
- (getter)MFace_getIndex, (setter)NULL,
- "face's index",
- NULL},
- {"no",
- (getter)MFace_getNormal, (setter)NULL,
- "face's normal",
- NULL},
- {"cent",
- (getter)MFace_getCent, (setter)NULL,
- "face's center",
- NULL},
- {"area",
- (getter)MFace_getArea, (setter)NULL,
- "face's 3D area",
- NULL},
-
- {"hide",
- (getter)MFace_getMFlagBits, (setter)MFace_setMFlagBits,
- "face hidden in edit mode",
- (void *)ME_HIDE},
- {"sel",
- (getter)MFace_getMFlagBits, (setter)MFace_setSelect,
- "face selected in edit mode",
- (void *)ME_FACE_SEL},
- {"smooth",
- (getter)MFace_getMFlagBits, (setter)MFace_setMFlagBits,
- "face smooth enabled",
- (void *)ME_SMOOTH},
-
- /* attributes for texture faces (mostly, I think) */
-
- {"col",
- (getter)MFace_getCol, (setter)MFace_setCol,
- "face's vertex colors",
- NULL},
- {"flag",
- (getter)MFace_getFlag, (setter)MFace_setFlag,
- "flags associated with texture faces",
- NULL},
- {"image",
- (getter)MFace_getImage, (setter)MFace_setImage,
- "image associated with texture faces",
- NULL},
- {"mode",
- (getter)MFace_getMode, (setter)MFace_setMode,
- "modes associated with texture faces",
- NULL},
- {"transp",
- (getter)MFace_getTransp, (setter)MFace_setTransp,
- "transparency of texture faces",
- NULL},
- {"uv",
- (getter)MFace_getUV, (setter)MFace_setUV,
- "face's UV coordinates",
- NULL},
- {"uvSel",
- (getter)MFace_getUVSel, (setter)MFace_setUVSel,
- "face's UV coordinates select status",
- NULL},
- {"edge_keys",
- (getter)MFace_getEdgeKeys, (setter)NULL,
- "for each edge this face uses return an ordered tuple edge pair that can be used as a key in a dictionary or set",
- NULL},
-
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-/************************************************************************
- *
- * Python MFace_Type iterator (iterates over vertices)
- *
- ************************************************************************/
-
-/*
- * Initialize the interator index
- */
-
-static PyObject *MFace_getIter( BPy_MFace * self )
-{
- if (self->iter==-1) {
- self->iter = 0;
- return EXPP_incr_ret ( (PyObject *) self );
- } else {
- BPy_MFace *seq= (BPy_MFace *)MFace_CreatePyObject(self->mesh, self->index);
- seq->iter = 0;
- return (PyObject *) seq;
- }
-}
-
-/*
- * Return next MVert. Throw an exception after the final vertex.
- */
-
-static PyObject *MFace_nextIter( BPy_MFace * self )
-{
- struct MFace *face = &self->mesh->mface[self->index];
- int len = self->mesh->mface[self->index].v4 ? 4 : 3;
-
- if( self->iter == len ) {
- self->iter = -1;
- return EXPP_ReturnPyObjError( PyExc_StopIteration,
- "iterator at end" );
- }
-
- ++self->iter;
- switch ( self->iter ) {
- case 1:
- return MVert_CreatePyObject( self->mesh, face->v1 );
- case 2:
- return MVert_CreatePyObject( self->mesh, face->v2 );
- case 3:
- return MVert_CreatePyObject( self->mesh, face->v3 );
- default :
- return MVert_CreatePyObject( self->mesh, face->v4 );
- }
-}
-
-/************************************************************************
- *
- * Python MFace_Type methods
- *
- ************************************************************************/
-
-/************************************************************************
- *
- * Python MFace_Type standard operations
- *
- ************************************************************************/
-static int MFace_compare( BPy_MFace * a, BPy_MFace * b )
-{
- return( a->mesh == b->mesh && a->index == b->index ) ? 0 : -1;
-}
-
-static PyObject *MFace_repr( BPy_MFace* self )
-{
- MFace *face = MFace_get_pointer( self );
-
- if( !face )
- return NULL;
-
- if( face->v4 )
- return PyString_FromFormat( "[MFace (%d %d %d %d) %d]",
- (int)face->v1, (int)face->v2,
- (int)face->v3, (int)face->v4, (int)self->index );
- else
- return PyString_FromFormat( "[MFace (%d %d %d) %d]",
- (int)face->v1, (int)face->v2,
- (int)face->v3, (int)self->index );
-}
-
-static long MFace_hash( BPy_MFace *self )
-{
- return (long)self->index;
-}
-
-static int MFace_len( BPy_MFace * self )
-{
- if( self->index >= self->mesh->totface )
- return 0;
- return self->mesh->mface[self->index].v4 ? 4 : 3;
-}
-
-static PySequenceMethods MFace_as_sequence = {
- ( inquiry ) MFace_len, /* sq_length */
- ( binaryfunc ) 0, /* sq_concat */
- ( intargfunc ) 0, /* sq_repeat */
- ( intargfunc ) 0, /* sq_item */
- ( intintargfunc ) 0, /* sq_slice */
- ( intobjargproc ) 0, /* sq_ass_item */
- ( intintobjargproc ) 0, /* sq_ass_slice */
- 0,0,0,
-};
-
-static PyObject *MFace_getProp( BPy_MFace *self, PyObject *args)
-{
- Mesh *me = (Mesh *)self->mesh;
- MFace *face = MFace_get_pointer( self );
- if( !face )
- return NULL;
- mesh_update_customdata_pointers(me); //!
- return Mesh_getProperty_internal(&(me->fdata), self->index, args);
-}
-
-static PyObject *MFace_setProp( BPy_MFace *self, PyObject *args)
-{
- Mesh *me = (Mesh *)self->mesh;
- PyObject *obj;
- MFace *face = MFace_get_pointer( self );
- if( !face )
- return NULL; /* error set */
-
- obj = Mesh_setProperty_internal(&(me->fdata), self->index, args);
- mesh_update_customdata_pointers(me); //!
- return obj;
-}
-
-static struct PyMethodDef BPy_MFace_methods[] = {
- {"getProperty", (PyCFunction)MFace_getProp, METH_O,
- "get property indicated by name"},
- {"setProperty", (PyCFunction)MFace_setProp, METH_VARARGS,
- "set property indicated by name"},
- {NULL, NULL, 0, NULL}
-};
-/************************************************************************
- *
- * Python MFace_Type structure definition
- *
- ************************************************************************/
-
-PyTypeObject MFace_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender MFace", /* char *tp_name; */
- sizeof( BPy_MFace ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL, /* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- ( cmpfunc ) MFace_compare, /* cmpfunc tp_compare; */
- ( reprfunc ) MFace_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- &MFace_as_sequence, /* PySequenceMethods *tp_as_sequence; */
- NULL, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- ( hashfunc ) MFace_hash, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
- 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, /* 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, /* richcmpfunc tp_richcompare; */
-
- /*** weak reference enabler ***/
- 0, /* long tp_weaklistoffset; */
-
- /*** Added in release 2.2 ***/
- /* Iterators */
- ( getiterfunc ) MFace_getIter, /* getiterfunc tp_iter; */
- ( iternextfunc ) MFace_nextIter, /* iternextfunc tp_iternext; */
-
- /*** Attribute descriptor and subclassing stuff ***/
- BPy_MFace_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_MFace_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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 PyObject *MFace_CreatePyObject( Mesh * mesh, int i )
-{
- BPy_MFace *obj = PyObject_NEW( BPy_MFace, &MFace_Type );
-
- if( !obj )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyObject_New() failed" );
-
- obj->mesh = mesh;
- obj->index = i;
- obj->iter= -1;
- return (PyObject *)obj;
-}
-
-/************************************************************************
- *
- * Face sequence
- *
- ************************************************************************/
-
-static int MFaceSeq_len( BPy_MFaceSeq * self )
-{
- return self->mesh->totface;
-}
-
-static PyObject *MFaceSeq_item( BPy_MFaceSeq * self, int i )
-{
- if( i < 0 || i >= self->mesh->totface )
- return EXPP_ReturnPyObjError( PyExc_IndexError,
- "array index out of range" );
-
- return MFace_CreatePyObject( self->mesh, i );
-}
-
-static PySequenceMethods MFaceSeq_as_sequence = {
- ( inquiry ) MFaceSeq_len, /* sq_length */
- ( binaryfunc ) 0, /* sq_concat */
- ( intargfunc ) 0, /* sq_repeat */
- ( intargfunc ) MFaceSeq_item, /* sq_item */
- ( intintargfunc ) 0, /* sq_slice */
- ( intobjargproc ) 0, /* sq_ass_item */
- ( intintobjargproc ) 0, /* sq_ass_slice */
- 0,0,0,
-};
-
-/************************************************************************
- *
- * Python MFaceSeq_Type iterator (iterates over faces)
- *
- ************************************************************************/
-
-/*
- * Initialize the interator index
- */
-
-static PyObject *MFaceSeq_getIter( BPy_MFaceSeq * self )
-{
- if (self->iter==-1) {
- self->iter = 0;
- return EXPP_incr_ret ( (PyObject *) self );
- } else {
- BPy_MFaceSeq *seq = (BPy_MFaceSeq *)MFaceSeq_CreatePyObject(self->mesh);
- seq->iter = 0;
- return (PyObject *)seq;
- }
-}
-
-/*
- * Return next MFace.
- */
-
-static PyObject *MFaceSeq_nextIter( BPy_MFaceSeq * self )
-{
- if( self->iter == self->mesh->totface ) {
- self->iter= -1; /* not being used in a seq */
- return EXPP_ReturnPyObjError( PyExc_StopIteration,
- "iterator at end" );
- }
- return MFace_CreatePyObject( self->mesh, self->iter++ );
-}
-
-/************************************************************************
- *
- * Python MFaceSeq_Type methods
- *
- ************************************************************************/
-
-static PyObject *MFaceSeq_extend( BPy_MEdgeSeq * self, PyObject *args,
- PyObject *keywds )
-{
- /*
- * (a) check input for valid edge objects, faces which consist of
- * only three or four edges
- * (b) check input to be sure edges form a closed face (each edge
- * contains verts in two other different edges?)
- *
- * (1) build list of new faces; remove duplicates
- * * use existing "v4=0 rule" for 3-vert faces
- * (2) build list of existing faces for searching
- * (3) from new face list, remove existing faces:
- */
-
- int len, nverts;
- int i, j, k, new_face_count;
- int good_faces;
- SrchFaces *oldpair, *newpair, *tmppair, *tmppair2;
- PyObject *tmp;
- MFace *tmpface;
- Mesh *mesh = self->mesh;
- int ignore_dups = 0;
- PyObject *return_list = NULL;
- char flag = ME_FACE_SEL;
-
- /* before we try to add faces, add edges; if it fails; exit */
-
- tmp = MEdgeSeq_extend( self, args );
- if( !tmp )
- return NULL;
- Py_DECREF( tmp );
-
- /* process any keyword arguments */
- if( keywds ) {
- PyObject *res = PyDict_GetItemString( keywds, "ignoreDups" );
- if( res ) {
- ignore_dups = PyObject_IsTrue( res );
- if (ignore_dups==-1) {
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "keyword argument \"ignoreDups\" expected True/False or 0/1" );
- }
- }
- res = PyDict_GetItemString( keywds, "indexList" );
- if (res) {
- switch( PyObject_IsTrue( res ) ) {
- case 0:
- break;
- case -1:
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "keyword argument \"indexList\" expected True/False or 0/1" );
- default:
- return_list = PyList_New( 0 );
- }
- }
-
- res = PyDict_GetItemString( keywds, "smooth" );
- if (res) {
- switch( PyObject_IsTrue( res ) ) {
- case 0:
- break;
- case -1:
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "keyword argument \"smooth\" expected True/False or 0/1" );
- default:
- flag |= ME_SMOOTH;
-
- }
- }
- }
-
- /* make sure we get a tuple of sequences of something */
-
- switch( PySequence_Size( args ) ) {
- case 1: /* better be a sequence or a tuple */
- /* if a sequence... */
- tmp = PyTuple_GET_ITEM( args, 0 );
- if( PySequence_Check( tmp ) ) {
- PyObject *tmp2;
-
- /* ignore empty sequences */
- if( !PySequence_Size( tmp ) ) {
- Py_RETURN_NONE;
- }
-
- /* if another sequence, use it */
- tmp2 = PySequence_ITEM( tmp, 0 );
- if( PySequence_Check( tmp2 ) )
- args = tmp;
- Py_INCREF( args );
- Py_DECREF( tmp2 );
- } else
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a sequence of sequence pairs" );
- break;
- case 2:
- case 3:
- case 4: /* two to four args may be individual verts */
- tmp = PyTuple_GET_ITEM( args, 0 );
- /*
- * if first item isn't a sequence, then assume it's a bunch of MVerts
- * and wrap inside a tuple
- */
- if( !PySequence_Check( tmp ) ) {
- args = Py_BuildValue( "(O)", args );
- if( !args )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "Py_BuildValue() failed" );
- /*
- * otherwise, assume it already a bunch of sequences so use as-is
- */
- } else {
- Py_INCREF( args ); /* so we can safely DECREF later */
- }
- break;
- default: /* anything else is definitely wrong */
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a sequence of sequence pairs" );
- }
-
- /* if nothing to add, just exit */
- len = PySequence_Size( args );
- if( len == 0 ) {
- Py_DECREF( args );
- Py_RETURN_NONE;
- }
-
- /*
- * Since we call MEdgeSeq_extend first, we already know the input list
- * is valid. Here we just need to count the total number of faces.
- */
-
- new_face_count = 0;
- for( i = 0; i < len; ++i ) {
- tmp = PySequence_ITEM( args, i );
- nverts = PySequence_Size( tmp );
- if( return_list || nverts != 2 )
- ++new_face_count; /* new faces must have 3 or 4 verts */
- Py_DECREF( tmp );
- }
-
- /* OK, commit to allocating the search structures */
- newpair = (SrchFaces *)MEM_callocN( sizeof(SrchFaces)*new_face_count,
- "MFacePairs" );
-
- /* scan the input list and build the new face pair list */
- len = PySequence_Size( args );
- tmppair = newpair;
-
- for( i = 0; i < len; ++i ) {
- MFace tmpface;
- unsigned int vert[4]={0,0,0,0};
- unsigned char order[4]={0,1,2,3};
- tmp = PySequence_GetItem( args, i );
- nverts = PySequence_Size( tmp );
-
- if( nverts == 2 ) { /* again, ignore 2-vert tuples */
- if( return_list ) /* if returning indices, mark as deleted */
- tmppair->v[1] = 0;
- Py_DECREF( tmp );
- continue;
- }
-
- /*
- * get the face's vertices' indexes
- */
-
- for( j = 0; j < nverts; ++j ) {
- PyObject *item = PySequence_ITEM( tmp, j );
- if( BPy_MVert_Check( item ) )
- vert[j] = ((BPy_MVert *)item)->index;
- else
- vert[j] = PyInt_AsLong( item );
- Py_DECREF( item );
- }
- Py_DECREF( tmp );
- tmpface.v1 = vert[0];
- tmpface.v2 = vert[1];
- tmpface.v3 = vert[2];
- tmpface.v4 = vert[3];
-
- /*
- * go through some contortions to guarantee the third and fourth
- * vertices are not index 0
- */
- eeek_fix( &tmpface, nverts == 4 );
- vert[0] = tmpface.v1;
- vert[1] = tmpface.v2;
- vert[2] = tmpface.v3;
- if( nverts == 3 )
- vert[3] = tmppair->v[3] = 0;
- else
- vert[3] = tmpface.v4;
-
- /*
- * sort the verts before placing in pair list. the order of
- * vertices in the face is very important, so keep track of
- * the original order
- */
-
- for( j = nverts-1; j >= 0; --j ) {
- for( k = 0; k < j; ++k ) {
- if( vert[k] > vert[k+1] ) {
- SWAP( int, vert[k], vert[k+1] );
- SWAP( char, order[k], order[k+1] );
- } else if( vert[k] == vert[k+1] ) {
- break;
- }
- }
- if( k < j )
- break;
- tmppair->v[j] = vert[j];
- }
- if( j >= 0 ) { /* a duplicate vertex found */
- if( return_list ) { /* if returning index list */
- tmppair->v[1] = 0; /* mark as deleted */
- } else {
- --new_face_count; /* otherwise skip */
- continue;
- }
- }
- tmppair->index = i;
-
- /* pack order into a byte */
- tmppair->order = order[0]|(order[1]<<2)|(order[2]<<4)|(order[3]<<6);
- ++tmppair;
- }
-
- /*
- * find duplicates in the new list and mark. if it's a duplicate,
- * then mark by setting second vert index to 0 (a real edge won't have
- * second vert index of 0 since verts are sorted)
- */
-
- good_faces = new_face_count; /* assume all faces good to start */
-
- tmppair = newpair; /* "last good edge" */
- tmppair2 = &tmppair[1]; /* "current candidate edge" */
- if( !ignore_dups ) {
-
- /* sort the new face pairs */
- qsort( newpair, new_face_count, sizeof(SrchFaces), mface_comp );
-
- for( i = 0; i < new_face_count; ++i ) {
- if( mface_comp( tmppair, tmppair2 ) )
- tmppair = tmppair2; /* last != current, so current == last */
- else {
- tmppair2->v[1] = 0; /* last == current, so mark as duplicate */
- --good_faces; /* one less good face */
- }
- tmppair2++;
- }
- }
-
- /* if mesh has faces, see if any of the new faces are already in it */
- if( mesh->totface && !ignore_dups ) {
- oldpair = (SrchFaces *)MEM_callocN( sizeof(SrchFaces)*mesh->totface,
- "MFacePairs" );
-
- tmppair = oldpair;
- tmpface = mesh->mface;
- for( i = 0; i < mesh->totface; ++i ) {
- unsigned char order[4]={0,1,2,3};
- int verts[4];
- verts[0]=tmpface->v1;
- verts[1]=tmpface->v2;
- verts[2]=tmpface->v3;
- verts[3]=tmpface->v4;
-
- len = ( tmpface->v4 ) ? 3 : 2;
- tmppair->v[3] = 0; /* for triangular faces */
-
- /* sort the verts before placing in pair list here too */
- for( j = len; j >= 0; --j ) {
- for( k = 0; k < j; ++k )
- if( verts[k] > verts[k+1] ) {
- SWAP( int, verts[k], verts[k+1] );
- SWAP( unsigned char, order[k], order[k+1] );
- }
- tmppair->v[j] = verts[j];
- }
-
- /* pack order into a byte */
- tmppair->order = order[0]|(order[1]<<2)|(order[2]<<4)|(order[3]<<6);
- ++tmppair;
- ++tmpface;
- }
-
- /* sort the old face pairs */
- qsort( oldpair, mesh->totface, sizeof(SrchFaces), mface_comp );
-
- /* eliminate new faces already in the mesh */
- tmppair = newpair;
- for( i = good_faces; i ; ) {
- if( tmppair->v[1] ) {
- if( bsearch( tmppair, oldpair, mesh->totface,
- sizeof(SrchFaces), mface_comp ) ) {
- tmppair->v[1] = 0; /* mark as duplicate */
- --good_faces;
- }
- --i;
- }
- tmppair++;
- }
- MEM_freeN( oldpair );
- }
-
- /* if any new faces are left, add to list */
- if( good_faces || return_list ) {
- int totface = mesh->totface+good_faces; /* new face count */
- CustomData fdata;
-
- CustomData_copy( &mesh->fdata, &fdata, CD_MASK_MESH, CD_DEFAULT, totface );
- CustomData_copy_data( &mesh->fdata, &fdata, 0, 0, mesh->totface );
-
- if ( !CustomData_has_layer( &fdata, CD_MFACE ) )
- CustomData_add_layer( &fdata, CD_MFACE, CD_CALLOC, NULL, totface );
-
- CustomData_free( &mesh->fdata, mesh->totface );
- mesh->fdata = fdata;
- mesh_update_customdata_pointers( mesh );
-
- /* sort the faces back into their original input list order */
- if( !ignore_dups )
- qsort( newpair, new_face_count, sizeof(SrchFaces),
- mface_index_comp );
-
-
- /* point to the first face we're going to add */
- tmpface = &mesh->mface[mesh->totface];
- tmppair = newpair;
-
- if( return_list )
- good_faces = new_face_count; /* assume all faces good to start */
-
- /* as we find a good face, add it */
- while ( good_faces ) {
- if( tmppair->v[1] ) {
- int i;
- unsigned int index[4];
- unsigned char order = tmppair->order;
-
- /* unpack the order of the vertices */
- for( i = 0; i < 4; ++i ) {
- index[(order & 0x03)] = i;
- order >>= 2;
- }
-
- /* now place vertices in the proper order */
- tmpface->v1 = tmppair->v[index[0]];
- tmpface->v2 = tmppair->v[index[1]];
- tmpface->v3 = tmppair->v[index[2]];
- tmpface->v4 = tmppair->v[index[3]];
-
- tmpface->flag = flag;
-
- if( return_list ) {
- tmp = PyInt_FromLong( mesh->totface );
- PyList_Append( return_list, tmp );
- Py_DECREF(tmp);
- }
- mesh->totface++;
- ++tmpface;
- --good_faces;
- } else if( return_list ) {
- PyList_Append( return_list, Py_None );
- --good_faces;
- }
- tmppair++;
- }
- }
-
- /* clean up and leave */
- mesh_update( mesh );
- Py_DECREF ( args );
- MEM_freeN( newpair );
-
- if( return_list )
- return return_list;
- else
- Py_RETURN_NONE;
-}
-
-struct fourEdges
-{
- FaceEdges *v[4];
-};
-
-static PyObject *MFaceSeq_delete( BPy_MFaceSeq * self, PyObject *args )
-{
- unsigned int *face_table;
- int i, len;
- Mesh *mesh = self->mesh;
- MFace *tmpface;
- int face_count;
- int edge_also = 0;
-
- /* check for valid inputs */
-
- if( PySequence_Size( args ) != 2 ||
- !PyArg_ParseTuple( args, "iO", &edge_also, &args ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected and int and a sequence of ints or MFaces" );
-
- if( !PyList_Check( args ) && !PyTuple_Check( args ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected and int and a sequence of ints or MFaces" );
-
- /* see how many args we need to parse */
- len = PySequence_Size( args );
- if( len < 1 )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "sequence must contain at least one int or MFace" );
-
- face_table = MEM_callocN( len*sizeof( unsigned int ),
- "face_table" );
-
- /* get the indices of faces to be removed */
- for( i = len; i--; ) {
- PyObject *tmp = PySequence_GetItem( args, i );
- if( BPy_MFace_Check( tmp ) )
- face_table[i] = ((BPy_MFace *)tmp)->index;
- else if( PyInt_Check( tmp ) )
- face_table[i] = PyInt_AsLong( tmp );
- else {
- MEM_freeN( face_table );
- Py_DECREF( tmp );
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a sequence of ints or MFaces" );
- }
- Py_DECREF( tmp );
-
- /* if index out-of-range, throw exception */
- if( face_table[i] >= (unsigned int)mesh->totface ) {
- MEM_freeN( face_table );
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "array index out of range" );
- }
- }
-
- if( edge_also ) {
- /*
- * long version
- *
- * (1) build sorted table of all edges
- * (2) construct face->edge lookup table for all faces
- * face->e1 = mesh->medge[i]
- * (3) (delete sorted table)
- * (4) mark all edges as live
- * (5) mark all edges for deleted faces as dead
- * (6) mark all edges for remaining faces as live
- * (7) delete all dead edges
- * (8) (delete face lookup table)
- *
- */
-
- FaceEdges *edge_table, *tmp_et;
- MEdge *tmpedge;
- FaceEdges **face_edges;
- FaceEdges **tmp_fe;
- struct fourEdges *fface;
- int edge_count;
-
- edge_table = MEM_mallocN( mesh->totedge*sizeof( FaceEdges ),
- "edge_table" );
-
- tmpedge = mesh->medge;
- tmp_et = edge_table;
-
- for( i = 0; i < mesh->totedge; ++i ) {
- if( tmpedge->v1 < tmpedge->v2 ) {
- tmp_et->v[0] = tmpedge->v1;
- tmp_et->v[1] = tmpedge->v2;
- } else {
- tmp_et->v[0] = tmpedge->v2;
- tmp_et->v[1] = tmpedge->v1;
- }
- tmp_et->index = i;
- tmp_et->sel = 1; /* select each edge */
- ++tmpedge;
- ++tmp_et;
- }
-
- /* sort the edge pairs */
- qsort( edge_table, mesh->totedge, sizeof(FaceEdges), faceedge_comp );
-
- /* build face translation table, lookup edges */
- face_edges = MEM_callocN( 4*sizeof(FaceEdges*)*mesh->totface,
- "face_edges" );
-
- tmp_fe = face_edges;
- tmpface = mesh->mface;
- for( i = mesh->totface; i--; ++tmpface ) {
- FaceEdges *ptrs[4];
- unsigned int verts[4];
- int j,k;
- FaceEdges target;
- int len=tmpface->v4 ? 4 : 3;
-
- ptrs[3] = NULL;
- verts[0] = tmpface->v1;
- verts[1] = tmpface->v2;
- verts[2] = tmpface->v3;
- if( len == 4 )
- verts[3] = tmpface->v4;
- for( j = 0; j < len; ++j ) {
- k = (j+1) % len;
- if( verts[j] < verts[k] ) {
- target.v[0] = verts[j];
- target.v[1] = verts[k];
- } else {
- target.v[0] = verts[k];
- target.v[1] = verts[j];
- }
- ptrs[j] = bsearch( &target, edge_table, mesh->totedge,
- sizeof(FaceEdges), faceedge_comp );
- }
- for( j = 0; j < 4; ++j, ++tmp_fe )
- *tmp_fe = ptrs[j];
- }
-
- /* for each face, deselect each edge */
- tmpface = mesh->mface;
- face_count = 0;
- for( i = len; i--; ) {
- if( tmpface[face_table[i]].v1 != UINT_MAX ) {
- fface = (void *)face_edges;
- fface += face_table[i];
- fface->v[0]->sel = 0;
- fface->v[1]->sel = 0;
- fface->v[2]->sel = 0;
- if( fface->v[3] )
- fface->v[3]->sel = 0;
- tmpface[face_table[i]].v1 = UINT_MAX;
- ++face_count;
- }
- }
-
- /* for each remaining face, select all edges */
- tmpface = mesh->mface;
- fface = (struct fourEdges *)face_edges;
- for( i = mesh->totface; i--; ++tmpface, ++fface ) {
- if( tmpface->v1 != UINT_MAX ) {
- fface->v[0]->sel = 1;
- fface->v[1]->sel = 1;
- fface->v[2]->sel = 1;
- if( fface->v[3] )
- fface->v[3]->sel = 1;
- }
- }
- /* now mark the selected edges for deletion */
-
- edge_count = 0;
- for( i = 0; i < mesh->totedge; ++i ) {
- if( !edge_table[i].sel ) {
- mesh->medge[edge_table[i].index].v1 = UINT_MAX;
- ++edge_count;
- }
- }
-
- if( edge_count )
- delete_edges( mesh, NULL, edge_count );
-
- MEM_freeN( face_edges );
- MEM_freeN( edge_table );
- } else {
- /* mark faces to delete */
- tmpface = mesh->mface;
- face_count = 0;
- for( i = len; i--; )
- if( tmpface[face_table[i]].v1 != UINT_MAX ) {
- tmpface[face_table[i]].v1 = UINT_MAX;
- ++face_count;
- }
- }
-
- /* delete faces which have a deleted edge */
- delete_faces( mesh, NULL, face_count );
-
- /* clean up and return */
- MEM_freeN( face_table );
- mesh_update ( mesh );
- Py_RETURN_NONE;
-}
-
-/* copied from meshtools.c - should make generic? */
-static void permutate(void *list, int num, int size, int *index)
-{
- void *buf;
- int len;
- int i;
-
- len = num * size;
-
- buf = MEM_mallocN(len, "permutate");
- memcpy(buf, list, len);
-
- for (i = 0; i < num; i++) {
- memcpy((char *)list + (i * size), (char *)buf + (index[i] * size), size);
- }
- MEM_freeN(buf);
-}
-
-/* this wrapps list sorting then applies back to the mesh */
-static PyObject *MFaceSeq_sort( BPy_MEdgeSeq * self, PyObject *args,
- PyObject *keywds )
-{
- PyObject *ret, *sort_func, *newargs;
-
- Mesh *mesh = self->mesh;
- PyObject *sorting_list;
- CustomDataLayer *layer;
- int i, *index;
-
- /* get a list for internal use */
- sorting_list = PySequence_List( (PyObject *)self );
- if( !sorting_list )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyList_New() failed" );
-
- /* create index list */
- index = (int *) MEM_mallocN(sizeof(int) * mesh->totface, "sort faces");
- if (!index)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "faces.sort(...) failed to allocate memory" );
-
- newargs = EXPP_PyTuple_New_Prepend(args, sorting_list);
- sort_func = PyObject_GetAttrString( ((PyObject *)&PyList_Type), "sort");
-
- ret = PyObject_Call(sort_func, newargs, keywds);
-
- Py_DECREF(newargs);
- Py_DECREF(sort_func);
-
- if (ret) {
- /* copy the faces indicies to index */
- for (i = 0; i < mesh->totface; i++)
- index[i] = ((BPy_MFace *)PyList_GET_ITEM(sorting_list, i))->index;
-
- for(i = 0; i < mesh->fdata.totlayer; i++) {
- layer = &mesh->fdata.layers[i];
- permutate(layer->data, mesh->totface, CustomData_sizeof(layer->type), index);
- }
- }
- Py_DECREF(sorting_list);
- MEM_freeN(index);
- return ret;
-}
-
-static PyObject *MFaceSeq_selected( BPy_MFaceSeq * self )
-{
- int i, count;
- Mesh *mesh = self->mesh;
- MFace *tmpface;
- PyObject *list;
-
- /* first count selected faces (quicker than appending to PyList?) */
- count = 0;
- tmpface = mesh->mface;
- for( i = 0; i < mesh->totface; ++i, ++tmpface )
- if( tmpface->flag & ME_FACE_SEL )
- ++count;
-
- list = PyList_New( count );
- if( !list )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyList_New() failed" );
-
- /* next, insert selected faces into list */
- count = 0;
- tmpface = mesh->mface;
- for( i = 0; i < mesh->totface; ++i, ++tmpface ) {
- if( tmpface->flag & ME_FACE_SEL ) {
- PyObject *tmp = PyInt_FromLong( i );
- if( !tmp ) {
- Py_DECREF( list );
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyInt_FromLong() failed" );
- }
- PyList_SET_ITEM( list, count, tmp );
- ++count;
- }
- }
- return list;
-}
-
-static PyObject *MFaceSeq_add_layertype(BPy_MFaceSeq *self, PyObject *args)
-{
- Mesh *me = (Mesh*)self->mesh;
- return Mesh_addPropLayer_internal(me, &(me->fdata), me->totface, args);
-}
-static PyObject *MFaceSeq_del_layertype(BPy_MFaceSeq *self, PyObject *value)
-{
- Mesh *me = (Mesh*)self->mesh;
- return Mesh_removePropLayer_internal(me, &(me->fdata), me->totface, value);
-}
-static PyObject *MFaceSeq_rename_layertype(BPy_MFaceSeq *self, PyObject *args)
-{
- Mesh *me = (Mesh*)self->mesh;
- return Mesh_renamePropLayer_internal(me,&(me->fdata),args);
-}
-static PyObject *MFaceSeq_PropertyList(BPy_MFaceSeq *self)
-{
- Mesh *me = (Mesh*)self->mesh;
- return Mesh_propList_internal(&(me->fdata));
-}
-
-static struct PyMethodDef BPy_MFaceSeq_methods[] = {
- {"extend", (PyCFunction)MFaceSeq_extend, METH_VARARGS|METH_KEYWORDS,
- "add faces to mesh"},
- {"delete", (PyCFunction)MFaceSeq_delete, METH_VARARGS,
- "delete faces from mesh"},
- {"sort", (PyCFunction)MFaceSeq_sort, METH_VARARGS|METH_KEYWORDS,
- "sort the faces using list sorts syntax"},
- {"selected", (PyCFunction)MFaceSeq_selected, METH_NOARGS,
- "returns a list containing indices of selected faces"},
- {"addPropertyLayer",(PyCFunction)MFaceSeq_add_layertype, METH_VARARGS,
- "add a new property layer"},
- {"removePropertyLayer",(PyCFunction)MFaceSeq_del_layertype, METH_O,
- "removes a property layer"},
- {"renamePropertyLayer",(PyCFunction)MFaceSeq_rename_layertype, METH_VARARGS,
- "renames an existing property layer"},
- {NULL, NULL, 0, NULL}
-};
-static PyGetSetDef BPy_MFaceSeq_getseters[] = {
- {"properties",
- (getter)MFaceSeq_PropertyList, (setter)NULL,
- "vertex property layers, read only",
- NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-
-/************************************************************************
- *
- * Python MFaceSeq_Type standard operations
- *
- ************************************************************************/
-
-/*****************************************************************************/
-/* Python MFaceSeq_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject MFaceSeq_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender MFaceSeq", /* char *tp_name; */
- sizeof( BPy_MFaceSeq ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL, /* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- NULL, /* cmpfunc tp_compare; */
- NULL, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- &MFaceSeq_as_sequence, /* 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; */
- 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, /* 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, /* richcmpfunc tp_richcompare; */
-
- /*** weak reference enabler ***/
- 0, /* long tp_weaklistoffset; */
-
- /*** Added in release 2.2 ***/
- /* Iterators */
- ( getiterfunc )MFaceSeq_getIter, /* getiterfunc tp_iter; */
- ( iternextfunc )MFaceSeq_nextIter, /* iternextfunc tp_iternext; */
-
- /*** Attribute descriptor and subclassing stuff ***/
- BPy_MFaceSeq_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_MFaceSeq_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-/************************************************************************
- *
- * Python BPy_Mesh methods
- *
- ************************************************************************/
-
-static PyObject *Mesh_calcNormals( BPy_Mesh * self )
-{
- Mesh *mesh = self->mesh;
-
- mesh_calc_normals( mesh->mvert, mesh->totvert, mesh->mface,
- mesh->totface, NULL );
- Py_RETURN_NONE;
-}
-
-static PyObject *Mesh_vertexShade( BPy_Mesh * self )
-{
- Base *base = FIRSTBASE;
-
- if( G.obedit )
- return EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "can't shade vertices while in edit mode" );
-
- while( base ) {
- if( base->object->type == OB_MESH &&
- base->object->data == self->mesh ) {
- base->flag |= SELECT;
- set_active_base( base );
- make_vertexcol(1);
- countall();
- Py_RETURN_NONE;
- }
- base = base->next;
- }
- return EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "object not found in baselist!" );
-}
-
-/*
- * force display list update
- */
-
-static PyObject *Mesh_Update( BPy_Mesh * self, PyObject *args, PyObject *kwd )
-{
-
- char *blockname= NULL;
- static char *kwlist[] = {"key", NULL};
-
- if( !PyArg_ParseTupleAndKeywords(args, kwd, "|s", kwlist, &blockname) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "Expected nothing or the name of a shapeKey");
-
- if (blockname) {
- Mesh *me = self->mesh;
- MVert *mv = me->mvert;
- Key *key= me->key;
- KeyBlock *kb;
- float (*co)[3];
- int i;
-
- if (!key)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "Cannot update the key for this mesh, it has no shape keys");
-
- for (kb = key->block.first; kb; kb=kb->next)
- if (strcmp(blockname, kb->name)==0)
- break;
-
- if (!kb)
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "This requested key to update does not exist");
-
- for(i=0, co= kb->data; i<me->totvert; i++, mv++, co++)
- VECCOPY(*co, mv->co);
- } else {
- /* Normal operation */
- mesh_update( self->mesh );
- }
- Py_RETURN_NONE;
-}
-
-/*
- * search for a single edge in mesh's edge list
- */
-
-static PyObject *Mesh_findEdge( BPy_Mesh * self, PyObject *args )
-{
- int i;
- unsigned int v1, v2;
- PyObject *tmp;
- MEdge *edge = self->mesh->medge;
-
- if( EXPP_check_sequence_consistency( args, &MVert_Type ) == 1 &&
- PySequence_Size( args ) == 2 ) {
- tmp = PyTuple_GET_ITEM( args, 0 );
- v1 = ((BPy_MVert *)tmp)->index;
- tmp = PyTuple_GET_ITEM( args, 1 );
- v2 = ((BPy_MVert *)tmp)->index;
- } else if( PyArg_ParseTuple( args, "ii", &v1, &v2 ) ) {
- if( (int)v1 >= self->mesh->totvert || (int)v2 >= self->mesh->totvert )
- return EXPP_ReturnPyObjError( PyExc_IndexError,
- "index out of range" );
- } else
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "expected tuple of two ints or MVerts" );
-
- for( i = 0; i < self->mesh->totedge; ++i ) {
- if( ( edge->v1 == v1 && edge->v2 == v2 )
- || ( edge->v1 == v2 && edge->v2 == v1 ) ) {
- tmp = PyInt_FromLong( i );
- if( tmp )
- return tmp;
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyInt_FromLong() failed" );
- }
- ++edge;
- }
- Py_RETURN_NONE;
-}
-
-/*
- * search for a group of edges in mesh's edge list
- */
-
-static PyObject *Mesh_findEdges( PyObject * self, PyObject *args )
-{
- int len;
- int i;
- SrchEdges *oldpair, *tmppair, target, *result;
- PyObject *list, *tmp;
- BPy_MVert *v1, *v2;
- unsigned int index1, index2;
- MEdge *tmpedge;
- Mesh *mesh = ((BPy_Mesh *)self)->mesh;
-
- /* if no edges, nothing to do */
-
- if( !mesh->totedge )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "mesh has no edges" );
-
- /* make sure we get a sequence of tuples of something */
-
- tmp = PyTuple_GET_ITEM( args, 0 );
- switch( PySequence_Size ( args ) ) {
- case 1: /* better be a list or a tuple */
- if( !PySequence_Check ( tmp ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a sequence of tuple int or MVert pairs" );
- args = tmp;
- Py_INCREF( args ); /* so we can safely DECREF later */
- break;
- case 2: /* take any two args and put into a tuple */
- if( PyTuple_Check( tmp ) )
- Py_INCREF( args ); /* if first arg is a tuple, assume both are */
- else {
- args = Py_BuildValue( "((OO))", tmp, PyTuple_GET_ITEM( args, 1 ) );
- if( !args )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "Py_BuildValue() failed" );
- }
- break;
- default: /* anything else is definitely wrong */
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a sequence of tuple pairs" );
- }
-
- len = PySequence_Size( args );
- if( len == 0 ) {
- Py_DECREF( args );
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "expected at least one tuple" );
- }
-
- /* if a single edge, handle the simpler way */
- if( len == 1 ) {
- PyObject *result;
- tmp = PySequence_GetItem( args, 0 );
- result = Mesh_findEdge( (BPy_Mesh *)self, tmp );
- Py_DECREF( tmp );
- Py_DECREF( args );
- return result;
- }
-
- /* build a list of all edges so we can search */
- oldpair = (SrchEdges *)MEM_callocN( sizeof(SrchEdges)*mesh->totedge,
- "MEdgePairs" );
-
- tmppair = oldpair;
- tmpedge = mesh->medge;
- for( i = 0; i < mesh->totedge; ++i ) {
- if( tmpedge->v1 < tmpedge->v2 ) {
- tmppair->v[0] = tmpedge->v1;
- tmppair->v[1] = tmpedge->v2;
- } else {
- tmppair->v[0] = tmpedge->v2;
- tmppair->v[1] = tmpedge->v1;
- }
- tmppair->index = i;
- ++tmpedge;
- ++tmppair;
- }
-
- /* sort the old edge pairs */
- qsort( oldpair, mesh->totedge, sizeof(SrchEdges), medge_comp );
-
- list = PyList_New( len );
- if( !len )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyList_New() failed" );
-
- /* scan the input list, find vert pairs, then search the edge list */
-
- for( i = 0; i < len; ++i ) {
- tmp = PySequence_GetItem( args, i );
- if( !PyTuple_Check( tmp ) || PyTuple_Size( tmp ) != 2 ) {
- MEM_freeN( oldpair );
- Py_DECREF( tmp );
- Py_DECREF( args );
- Py_DECREF( list );
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "expected tuple pair" );
- }
-
- /* get objects, check that they are both MVerts of this mesh */
- v1 = (BPy_MVert *)PyTuple_GET_ITEM( tmp, 0 );
- v2 = (BPy_MVert *)PyTuple_GET_ITEM( tmp, 1 );
- Py_DECREF ( tmp );
- if( BPy_MVert_Check( v1 ) && BPy_MVert_Check( v2 ) ) {
- if( v1->data != (void *)mesh || v2->data != (void *)mesh ) {
- MEM_freeN( oldpair );
- Py_DECREF( args );
- Py_DECREF( list );
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "one or both MVerts do not belong to this mesh" );
- }
- index1 = v1->index;
- index2 = v2->index;
- } else if( PyInt_Check( v1 ) && PyInt_Check( v2 ) ) {
- index1 = PyInt_AsLong( (PyObject *)v1 );
- index2 = PyInt_AsLong( (PyObject *)v2 );
- if( (int)index1 >= mesh->totvert
- || (int)index2 >= mesh->totvert ) {
- MEM_freeN( oldpair );
- Py_DECREF( args );
- Py_DECREF( list );
- return EXPP_ReturnPyObjError( PyExc_IndexError,
- "index out of range" );
- }
- } else {
- MEM_freeN( oldpair );
- Py_DECREF( args );
- Py_DECREF( list );
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "expected tuple to contain MVerts" );
- }
-
- /* sort verts into order */
- if( index1 < index2 ) {
- target.v[0] = index1;
- target.v[1] = index2;
- } else {
- target.v[0] = index2;
- target.v[1] = index1;
- }
-
- /* search edge list for a match; result is index or None */
- result = bsearch( &target, oldpair, mesh->totedge,
- sizeof(SrchEdges), medge_comp );
- if( result )
- tmp = PyInt_FromLong( result->index );
- else
- tmp = EXPP_incr_ret( Py_None );
- if( !tmp ) {
- MEM_freeN( oldpair );
- Py_DECREF( args );
- Py_DECREF( list );
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyInt_FromLong() failed" );
- }
- PyList_SET_ITEM( list, i, tmp );
- }
-
- MEM_freeN( oldpair );
- Py_DECREF ( args );
- return list;
-}
-
-/*
- * replace mesh data with mesh data from another object
- */
-
-
-static PyObject *Mesh_getFromObject( BPy_Mesh * self, PyObject * args )
-{
- Object *ob = NULL;
- PyObject *object_arg;
- ID tmpid;
- Mesh *tmpmesh;
- Curve *tmpcu = NULL;
- DerivedMesh *dm;
- Object *tmpobj = NULL;
- int cage = 0, render = 0, i;
-
- if( !PyArg_ParseTuple( args, "O|ii", &object_arg, &cage, &render ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected object or string and optional integer arguments" );
-
- if ( PyString_Check( object_arg ) ) {
- char *name;
- name = PyString_AsString ( object_arg );
- ob = ( Object * ) GetIdFromList( &( G.main->object ), name );
- if( !ob )
- return EXPP_ReturnPyObjError( PyExc_AttributeError, name );
- } else if ( BPy_Object_Check(object_arg) ) {
- ob = (( BPy_Object * ) object_arg)->object;
- } else {
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected object or string and optional integer arguments" );
- }
-
- if( cage != 0 && cage != 1 )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "cage value must be 0 or 1" );
-
-
-
- /* perform the mesh extraction based on type */
- switch (ob->type) {
- case OB_FONT:
- case OB_CURVE:
- case OB_SURF:
- /* copies object and modifiers (but not the data) */
- tmpobj= copy_object( ob );
- tmpcu = (Curve *)tmpobj->data;
- tmpcu->id.us--;
-
- /* if getting the original caged mesh, delete object modifiers */
- if( cage )
- object_free_modifiers(tmpobj);
-
- /* copies the data */
- tmpobj->data = copy_curve( (Curve *) ob->data );
-
-#if 0
- /* copy_curve() sets disp.first null, so currently not need */
- {
- Curve *cu;
- cu = (Curve *)tmpobj->data;
- if( cu->disp.first )
- MEM_freeN( cu->disp.first );
- cu->disp.first = NULL;
- }
-
-#endif
-
- /* get updated display list, and convert to a mesh */
- makeDispListCurveTypes( tmpobj, 0 );
- nurbs_to_mesh( tmpobj );
-
- /* nurbs_to_mesh changes the type tp a mesh, check it worked */
- if (tmpobj->type != OB_MESH) {
- free_libblock_us( &G.main->object, tmpobj );
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "cant convert curve to mesh. Does the curve have any segments?" );
- }
- tmpmesh = tmpobj->data;
- free_libblock_us( &G.main->object, tmpobj );
- break;
- case OB_MBALL:
- /* metaballs don't have modifiers, so just convert to mesh */
- ob = find_basis_mball( ob );
- tmpmesh = add_mesh("Mesh");
- mball_to_mesh( &ob->disp, tmpmesh );
-
- break;
- case OB_MESH:
- /* copies object and modifiers (but not the data) */
- if (cage) {
- /* copies the data */
- tmpmesh = copy_mesh( ob->data );
- /* if not getting the original caged mesh, get final derived mesh */
- } else {
- /* Make a dummy mesh, saves copying */
-
- /* Write the display mesh into the dummy mesh */
- if (render)
- dm = mesh_create_derived_render( ob, CD_MASK_MESH );
- else
- dm = mesh_create_derived_view( ob, CD_MASK_MESH );
-
- tmpmesh = add_mesh( "Mesh" );
- DM_to_mesh( dm, tmpmesh );
- dm->release( dm );
- }
-
- break;
- default:
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "Object does not have geometry data" );
- }
-
- /* free mesh data in the original */
- free_mesh( self->mesh );
- /* save a copy of our ID, dup the temporary mesh, restore the ID */
- tmpid = self->mesh->id;
- memcpy( self->mesh, tmpmesh, sizeof( Mesh ) );
- self->mesh->id = tmpid;
-
- /* if mesh has keys, make sure they point back to this mesh */
- if( self->mesh->key )
- self->mesh->key->from = (ID *)self->mesh;
-
-
-
- /* Copy materials to new object */
- switch (ob->type) {
- case OB_SURF:
- self->mesh->totcol = tmpcu->totcol;
-
- /* free old material list (if it exists) and adjust user counts */
- if( tmpcu->mat ) {
- for( i = tmpcu->totcol; i-- > 0; ) {
-
- /* are we an object material or data based? */
- if (ob->colbits & 1<<i) {
- self->mesh->mat[i] = ob->mat[i];
- ob->mat[i]->id.us++;
- tmpmesh->mat[i]->id.us--;
- } else {
- self->mesh->mat[i] = tmpcu->mat[i];
- if (self->mesh->mat[i]) {
- tmpmesh->mat[i]->id.us++;
- }
- }
- }
- }
- break;
-
-#if 0
- /* Crashes when assigning the new material, not sure why */
- case OB_MBALL:
- tmpmb = (MetaBall *)ob->data;
- self->mesh->totcol = tmpmb->totcol;
-
- /* free old material list (if it exists) and adjust user counts */
- if( tmpmb->mat ) {
- for( i = tmpmb->totcol; i-- > 0; ) {
- self->mesh->mat[i] = tmpmb->mat[i]; /* CRASH HERE ??? */
- if (self->mesh->mat[i]) {
- tmpmb->mat[i]->id.us++;
- }
- }
- }
- break;
-#endif
-
- case OB_MESH:
- if (!cage) {
- Mesh *origmesh= ob->data;
- self->mesh->flag= origmesh->flag;
- self->mesh->mat = MEM_dupallocN(origmesh->mat);
- self->mesh->totcol = origmesh->totcol;
- self->mesh->smoothresh= origmesh->smoothresh;
- if( origmesh->mat ) {
- for( i = origmesh->totcol; i-- > 0; ) {
- /* are we an object material or data based? */
- if (ob->colbits & 1<<i) {
- self->mesh->mat[i] = ob->mat[i];
-
- if (ob->mat[i])
- ob->mat[i]->id.us++;
- if (origmesh->mat[i])
- origmesh->mat[i]->id.us--;
- } else {
- self->mesh->mat[i] = origmesh->mat[i];
-
- if (origmesh->mat[i])
- origmesh->mat[i]->id.us++;
- }
- }
- }
- }
- break;
- } /* end copy materials */
-
-
-
- /* remove the temporary mesh */
- BLI_remlink( &G.main->mesh, tmpmesh );
- MEM_freeN( tmpmesh );
-
- /* make sure materials get updated in objects */
- test_object_materials( ( ID * ) self->mesh );
-
- mesh_update( self->mesh );
- Py_RETURN_NONE;
-}
-
-/*
- * apply a transform to the mesh's vertices
- *
- * WARNING: unlike NMesh, this method ALWAYS changes the original mesh
- */
-
-static PyObject *Mesh_transform( BPy_Mesh *self, PyObject *args, PyObject *kwd )
-{
- Mesh *mesh = self->mesh;
- MVert *mvert;
- /*PyObject *pymat = NULL;*/
- MatrixObject *bpymat=NULL;
- int i, recalc_normals = 0, selected_only = 0;
-
- static char *kwlist[] = {"matrix", "recalc_normals", "selected_only", NULL};
-
- if( !PyArg_ParseTupleAndKeywords(args, kwd, "|O!ii", kwlist,
- &matrix_Type, &bpymat, &recalc_normals, &selected_only) ) {
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "matrix must be a 4x4 transformation matrix\n"
- "for example as returned by object.matrixWorld\n"
- "and optionaly keyword bools, recalc_normals and selected_only\n");
- }
-
- if (!bpymat)
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "the first argument must be a matrix or\n"
- "matrix passed as a keyword argument\n");
-
-
- /*bpymat = ( MatrixObject * ) pymat;*/
-
- if( bpymat->colSize != 4 || bpymat->rowSize != 4 )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "matrix must be a 4x4 transformation matrix\n"
- "for example as returned by object.getMatrix()" );
-
- /* loop through all the verts and transform by the supplied matrix */
- mvert = mesh->mvert;
- if (selected_only) {
- for( i = 0; i < mesh->totvert; i++, mvert++ ) {
- if (mvert->flag & SELECT) {
- Mat4MulVecfl( (float(*)[4])*bpymat->matrix, mvert->co );
- }
- }
- } else {
- for( i = 0; i < mesh->totvert; i++, mvert++ ) {
- Mat4MulVecfl( (float(*)[4])*bpymat->matrix, mvert->co );
- }
- }
-
- if( recalc_normals ) {
- /* loop through all the verts and transform normals by the inverse
- * of the transpose of the supplied matrix */
- float invmat[4][4], vec[3], nx, ny, nz;
-
- /*
- * we only need to invert a 3x3 submatrix, because the 4th component of
- * affine vectors is 0, but Mat4Invert reports non invertible matrices
- */
-
- if (!Mat4Invert((float(*)[4])*invmat, (float(*)[4])*bpymat->matrix))
- return EXPP_ReturnPyObjError (PyExc_AttributeError,
- "given matrix is not invertible");
-
- /*
- * since normal is stored as shorts, convert to float
- */
-
- mvert = mesh->mvert;
- for( i = 0; i < mesh->totvert; i++, mvert++ ) {
- nx= vec[0] = (float)(mvert->no[0] / 32767.0);
- ny= vec[1] = (float)(mvert->no[1] / 32767.0);
- nz= vec[2] = (float)(mvert->no[2] / 32767.0);
- vec[0] = nx*invmat[0][0] + ny*invmat[0][1] + nz*invmat[0][2];
- vec[1] = nx*invmat[1][0] + ny*invmat[1][1] + nz*invmat[1][2];
- vec[2] = nx*invmat[2][0] + ny*invmat[2][1] + nz*invmat[2][2];
- Normalize( vec );
- mvert->no[0] = (short)(vec[0] * 32767.0);
- mvert->no[1] = (short)(vec[1] * 32767.0);
- mvert->no[2] = (short)(vec[2] * 32767.0);
- }
- }
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Mesh_addVertGroup( PyObject * self, PyObject * value )
-{
- char *groupStr = PyString_AsString(value);
- struct Object *object;
-
- if( !groupStr )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument" );
-
- object = ( ( BPy_Mesh * ) self )->object;
-
- if( object == NULL )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "mesh not linked to an object" );
-
- /* add_defgroup_name clamps the name to 32, make sure that dosnt change */
- add_defgroup_name( object, groupStr );
-
- EXPP_allqueue( REDRAWBUTSALL, 1 );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Mesh_removeVertGroup( PyObject * self, PyObject * value )
-{
- char *groupStr = PyString_AsString(value);
- struct Object *object;
- int nIndex;
- bDeformGroup *pGroup;
-
- if( G.obedit )
- return EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "can't use removeVertGroup() while in edit mode" );
-
- if( !groupStr )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument" );
-
- if( ( ( BPy_Mesh * ) self )->object == NULL )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "mesh must be linked to an object first..." );
-
- object = ( ( BPy_Mesh * ) self )->object;
-
- pGroup = get_named_vertexgroup( object, groupStr );
- if( pGroup == NULL )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "group does not exist!" );
-
- nIndex = get_defgroup_num( object, pGroup );
- if( nIndex == -1 )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "no deform groups assigned to mesh" );
- nIndex++;
- object->actdef = (unsigned short)nIndex;
-
- del_defgroup_in_object_mode( object );
-
- EXPP_allqueue( REDRAWBUTSALL, 1 );
-
- Py_RETURN_NONE;
-}
-
-extern void add_vert_defnr( Object * ob, int def_nr, int vertnum, float weight,
- int assignmode );
-extern void remove_vert_def_nr (Object *ob, int def_nr, int vertnum);
-
-static PyObject *Mesh_assignVertsToGroup( BPy_Mesh * self, PyObject * args )
-{
- char *groupStr;
- int nIndex;
- bDeformGroup *pGroup;
- PyObject *listObject;
- int tempInt;
- int x;
- int assignmode = WEIGHT_REPLACE;
- float weight = 1.0;
- Object *object = self->object;
- Mesh *mesh = self->mesh;
-
- if( !object )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "mesh must be linked to an object first" );
-
- if( ((Mesh *)object->data) != mesh )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "object no longer linked to this mesh" );
-
- if( !PyArg_ParseTuple ( args, "sO!fi", &groupStr, &PyList_Type,
- &listObject, &weight, &assignmode) ) {
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string, list, float, string arguments" );
- }
-
- pGroup = get_named_vertexgroup( object, groupStr );
- if( pGroup == NULL )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "group does not exist!" );
-
- nIndex = get_defgroup_num( object, pGroup );
- if( nIndex == -1 )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "no deform groups assigned to mesh" );
-
-
- if( assignmode != WEIGHT_REPLACE && assignmode != WEIGHT_ADD &&
- assignmode != WEIGHT_SUBTRACT )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "bad assignment mode" );
-
- /* makes a set of dVerts corresponding to the mVerts */
- if( !mesh->dvert )
- create_dverts( &mesh->id );
-
- /* loop list adding verts to group */
- for( x = 0; x < PyList_Size( listObject ); x++ ) {
- if( !PyArg_Parse ( PyList_GetItem( listObject, x ), "i", &tempInt ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "python list integer not parseable" );
-
- if( tempInt < 0 || tempInt >= mesh->totvert )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "bad vertex index in list" );
-
- add_vert_defnr( object, nIndex, tempInt, weight, assignmode );
- }
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Mesh_removeVertsFromGroup( BPy_Mesh * self, PyObject * args )
-{
- /* not passing a list will remove all verts from group */
-
- char *groupStr;
- int nIndex;
- Object *object;
- Mesh *mesh;
- bDeformGroup *pGroup;
- PyObject *listObject = NULL;
- int tempInt;
- int i;
-
- object = self->object;
- mesh = self->mesh;
- if( !object )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "mesh must be linked to an object first" );
-
- if( ((Mesh *)object->data) != mesh )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "object no longer linked to this mesh" );
-
- if( !PyArg_ParseTuple
- ( args, "s|O!", &groupStr, &PyList_Type, &listObject ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string and optional list argument" );
-
- if( !mesh->dvert )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "this mesh contains no deform vertices" );
-
- pGroup = get_named_vertexgroup( object, groupStr );
- if( pGroup == NULL )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "group does not exist!" );
-
- nIndex = get_defgroup_num( object, pGroup );
- if( nIndex == -1 )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "no deform groups assigned to mesh" );
-
- /* get out of edit mode */
-
- if( G.obedit ) {
- load_editMesh();
- free_editMesh(G.editMesh);
- G.obedit = NULL;
- }
-
- if( !listObject ) /* no list given */
- for( i = 0; i < mesh->totvert; i++ )
- remove_vert_def_nr( object, nIndex, i );
- else /* loop list removing verts to group */
- for( i = 0; i < PyList_Size( listObject ); i++ ) {
- if( !PyArg_Parse( PyList_GetItem( listObject, i ), "i", &tempInt ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "python list integer not parseable" );
-
- if( tempInt < 0 || tempInt >= mesh->totvert )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "bad vertex index in list" );
-
- remove_vert_def_nr( object, nIndex, tempInt );
- }
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Mesh_getVertsFromGroup( BPy_Mesh* self, PyObject * args )
-{
- /*
- * not passing a list will return all verts from group
- * passing indecies not part of the group will not return data in pyList
- * can be used as a index/group check for a vertex
- */
-
- char *groupStr;
- int nIndex;
- bDeformGroup *pGroup;
- MDeformVert *dvert;
- int i, k, count;
- PyObject *vertexList;
- Object *object;
- Mesh *mesh;
-
- int num = 0;
- int weightRet = 0;
- PyObject *listObject = NULL;
-
- object = self->object;
- mesh = self->mesh;
- if( !object )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "mesh must be linked to an object first" );
-
- if( ((Mesh *)object->data) != mesh )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "object no longer linked to this mesh" );
-
- if( !PyArg_ParseTuple( args, "s|iO!", &groupStr, &weightRet,
- &PyList_Type, &listObject ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string and optional int and list arguments" );
-
- if( weightRet < 0 || weightRet > 1 )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "return weights flag must be 0 or 1" );
-
- if( !mesh->dvert )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "this mesh contains no deform vertices" );
-
- pGroup = get_named_vertexgroup( object, groupStr );
- if( !pGroup )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "group does not exist!" );
-
- nIndex = get_defgroup_num( object, pGroup );
- if( nIndex == -1 )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "no deform groups assigned to mesh" );
-
- count = 0;
-
- if( !listObject ) { /* do entire group */
- vertexList = PyList_New( mesh->totvert );
- if( !vertexList )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "getVertsFromGroup: can't create pylist!" );
-
- dvert = mesh->dvert;
- for( num = 0; num < mesh->totvert; num++, ++dvert ) {
- for( i = 0; i < dvert->totweight; i++ ) {
- if( dvert->dw[i].def_nr == nIndex ) {
- PyObject *attr;
- if( weightRet )
- attr = Py_BuildValue( "(i,f)", num,
- dvert->dw[i].weight );
- else
- attr = PyInt_FromLong ( num );
- PyList_SetItem( vertexList, count, attr );
- count++;
- }
- }
- }
-
- if (count < mesh->totvert)
- PyList_SetSlice(vertexList, count, mesh->totvert, NULL);
-
- } else { /* do individual vertices */
- int listObjectLen = PyList_Size( listObject );
-
- vertexList = PyList_New( listObjectLen );
- for( i = 0; i < listObjectLen; i++ ) {
- PyObject *attr = NULL;
-
- num = PyInt_AsLong( PyList_GetItem( listObject, i ) );
- if (num == -1) {/* -1 is an error AND an invalid range, we dont care which */
- Py_DECREF(vertexList);
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "python list integer not parseable" );
- }
-
- if( num < 0 || num >= mesh->totvert ) {
- Py_DECREF(vertexList);
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "bad vertex index in list" );
- }
- dvert = mesh->dvert + num;
- for( k = 0; k < dvert->totweight; k++ ) {
- if( dvert->dw[k].def_nr == nIndex ) {
- if( weightRet )
- attr = Py_BuildValue( "(i,f)", num,
- dvert->dw[k].weight );
- else
- attr = PyInt_FromLong ( num );
- PyList_SetItem( vertexList, count, attr );
- count++;
- }
- }
- }
- if (count < listObjectLen)
- PyList_SetSlice(vertexList, count, listObjectLen, NULL);
- }
-
- return vertexList;
-}
-
-static PyObject *Mesh_renameVertGroup( BPy_Mesh * self, PyObject * args )
-{
- char *oldGr = NULL;
- char *newGr = NULL;
- bDeformGroup *defGroup;
- Object *object;
- Mesh *mesh;
-
- object = self->object;
- mesh = self->mesh;
- if( !object )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "mesh must be linked to an object first" );
-
- if( ((Mesh *)object->data) != mesh )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "object no longer linked to this mesh" );
-
- if( !PyArg_ParseTuple( args, "ss", &oldGr, &newGr ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected two string arguments" );
-
- defGroup = get_named_vertexgroup( object, oldGr );
- if( !defGroup )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't find the vertex group" );
-
- PyOS_snprintf( defGroup->name, 32, newGr );
- unique_vertexgroup_name( defGroup, object );
-
- Py_RETURN_NONE;
-}
-
-
-
-
-static PyObject *Mesh_getVertGroupNames( BPy_Mesh * self )
-{
- bDeformGroup *defGroup;
- PyObject *list;
- Object *obj = self->object;
- Mesh *mesh = self->mesh;
- int count;
-
- if( !obj )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "mesh must be linked to an object first" );
-
- if( ((Mesh *)obj->data) != mesh )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "object no longer linked to this mesh" );
-
- if( !obj )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This mesh must be linked to an object" );
-
- count = 0;
- for( defGroup = obj->defbase.first; defGroup; defGroup = defGroup->next )
- ++count;
-
- list = PyList_New( count );
- count = 0;
- for( defGroup = obj->defbase.first; defGroup; defGroup = defGroup->next )
- PyList_SET_ITEM( list, count++,
- PyString_FromString( defGroup->name ) );
-
- return list;
-}
-
-static PyObject *Mesh_getVertexInfluences( BPy_Mesh * self, PyObject * args )
-{
- int index;
- PyObject *influence_list = NULL;
- Object *object = self->object;
- Mesh *me = self->mesh;
-
- /* Get a reference to the mesh object wrapped in here. */
- if( !object )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This mesh must be linked to an object" );
-
- /* Parse the parameters: only on integer (vertex index) */
- if( !PyArg_ParseTuple( args, "i", &index ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int argument (index of the vertex)" );
-
- /* check for valid index */
- if( index < 0 || index >= me->totvert )
- return EXPP_ReturnPyObjError( PyExc_IndexError,
- "vertex index out of range" );
-
- influence_list = PyList_New( 0 );
-
- /* Proceed only if we have vertex deformation information */
- if( me->dvert ) {
- int i;
- MDeformWeight *sweight = NULL;
-
- /* Number of bones influencing the vertex */
- int totinfluences = me->dvert[index].totweight;
-
- /* Get the reference of the first weight structure */
- sweight = me->dvert[index].dw;
-
- /* Build the list only with weights and names of the influent bones */
- for( i = 0; i < totinfluences; i++, sweight++ ) {
- bDeformGroup *defgroup = BLI_findlink( &object->defbase,
- sweight->def_nr );
- if( defgroup )
- PyList_Append( influence_list, Py_BuildValue( "[sf]",
- defgroup->name, sweight->weight ) );
- }
- }
-
- return influence_list;
-}
-
-static PyObject *Mesh_removeAllKeys( BPy_Mesh * self )
-{
- Mesh *mesh = self->mesh;
-
- if( !mesh || !mesh->key )
- Py_RETURN_FALSE;
-
- mesh->key->id.us--;
- mesh->key = NULL;
-
- Py_RETURN_TRUE;
-}
-
-
-static PyObject *Mesh_insertKey( BPy_Mesh * self, PyObject * args )
-{
- Mesh *mesh = self->mesh;
- int fra = -1, oldfra = -1;
- char *type = NULL;
- short typenum;
-
- if (mesh->mr)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "Shape Keys cannot be added to meshes with multires" );
-
- if( !PyArg_ParseTuple( args, "|is", &fra, &type ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected nothing or an int and optionally a string as arguments" );
-
- if( !type || !strcmp( type, "relative" ) )
- typenum = 1;
- else if( !strcmp( type, "absolute" ) )
- typenum = 2;
- else
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "if given, type should be 'relative' or 'absolute'" );
-
- if( fra > 0 ) {
- fra = EXPP_ClampInt( fra, 1, MAXFRAME );
- oldfra = G.scene->r.cfra;
- G.scene->r.cfra = fra;
- }
-
- insert_meshkey( mesh, typenum );
- allspace(REMAKEIPO, 0);
-
- if( fra > 0 )
- G.scene->r.cfra = oldfra;
-
- Py_RETURN_NONE;
-}
-
-
-
-
-/* Custom Data Layers */
-
-static PyObject * Mesh_addCustomLayer_internal(Mesh *me, PyObject * args, int type)
-{
- char *name = NULL;
- CustomData *data = &me->fdata;
- if( !PyArg_ParseTuple( args, "|s", &name ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a string or nothing" );
-
- if (strlen(name)>31)
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "error, maximum name length is 31" );
-
- if (name)
- CustomData_add_layer_named(data, type, CD_DEFAULT,
- NULL, me->totface, name);
- else
- CustomData_add_layer(data, type, CD_DEFAULT,
- NULL, me->totface);
- mesh_update_customdata_pointers(me);
- Py_RETURN_NONE;
-}
-
-static PyObject *Mesh_addUVLayer( BPy_Mesh * self, PyObject * args )
-{
- return Mesh_addCustomLayer_internal(self->mesh, args, CD_MTFACE);
-}
-
-static PyObject *Mesh_addColorLayer( BPy_Mesh * self, PyObject * args )
-{
- return Mesh_addCustomLayer_internal(self->mesh, args, CD_MCOL);
-}
-
-static PyObject *Mesh_removeLayer_internal( BPy_Mesh * self, PyObject * value, int type )
-{
- Mesh *me = self->mesh;
- CustomData *data = &me->fdata;
- char *name = PyString_AsString(value);
- int i;
-
- if( !name )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument" );
-
- if (strlen(name)>31)
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "error, maximum name length is 31" );
-
- i = CustomData_get_named_layer_index(data, type, name);
-
- if (i==-1)
- return EXPP_ReturnPyObjError(PyExc_ValueError,
- "No matching layers to remove" );
-
- CustomData_free_layer(data, type, me->totface, i);
- mesh_update_customdata_pointers(me);
-
- /* No more Color or UV layers left ?
- switch modes if this is the active object */
- if (!CustomData_has_layer(data, type)) {
- if (me == get_mesh(OBACT)) {
- if(type == CD_MCOL && (G.f & G_VERTEXPAINT))
- G.f &= ~G_VERTEXPAINT; /* get out of vertexpaint mode */
- if(type == CD_MTFACE && (G.f & G_FACESELECT))
- G.f |= ~G_FACESELECT; /* get out of faceselect mode */
- }
- }
-
- Py_RETURN_NONE;
-}
-
-
-static PyObject *Mesh_removeUVLayer( BPy_Mesh * self, PyObject * value )
-{
- return Mesh_removeLayer_internal(self, value, CD_MTFACE);
-}
-
-static PyObject *Mesh_removeColorLayer( BPy_Mesh * self, PyObject * value )
-{
- return Mesh_removeLayer_internal(self, value, CD_MCOL);
-}
-
-
-static PyObject *Mesh_renameLayer_internal( BPy_Mesh * self, PyObject * args, int type )
-{
- CustomData *data;
- CustomDataLayer *layer;
- Mesh *mesh = self->mesh;
- int i;
- char *name_from, *name_to;
-
- data = &mesh->fdata;
-
- if( !PyArg_ParseTuple( args, "ss", &name_from, &name_to ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected 2 strings" );
-
- if (strlen(name_from)>31 || strlen(name_to)>31)
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "error, maximum name length is 31" );
-
- i = CustomData_get_named_layer_index(data, type, name_from);
-
- if (i==-1)
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "layer name was not found" );
-
- layer = &data->layers[i];
- strcpy(layer->name, name_to); /* we alredy know the string sizes are under 32 */
- CustomData_set_layer_unique_name(data, i);
- Py_RETURN_NONE;
-}
-
-static PyObject *Mesh_renameUVLayer( BPy_Mesh * self, PyObject * args )
-{
- return Mesh_renameLayer_internal( self, args, CD_MTFACE );
-}
-
-static PyObject *Mesh_renameColorLayer( BPy_Mesh * self, PyObject * args )
-{
- return Mesh_renameLayer_internal( self, args, CD_MCOL );
-}
-
-
-static PyObject *Mesh_getLayerNames_internal( BPy_Mesh * self, int type )
-{
- CustomData *data;
- CustomDataLayer *layer;
- PyObject *str, *list = PyList_New( 0 );
- Mesh *mesh = self->mesh;
- int i;
- data = &mesh->fdata;
-
- /* see if there is a duplicate */
- for(i=0; i<data->totlayer; i++) {
- layer = &data->layers[i];
- if(layer->type == type) {
- str = PyString_FromString(layer->name);
- PyList_Append( list, str );
- Py_DECREF(str);
- }
- }
- return list;
-}
-
-static PyObject *Mesh_getUVLayerNames( BPy_Mesh * self )
-{
- return Mesh_getLayerNames_internal(self, CD_MTFACE);
-}
-
-static PyObject *Mesh_getColorLayerNames( BPy_Mesh * self )
-{
- return Mesh_getLayerNames_internal(self, CD_MCOL);
-}
-/* used by activeUVLayer and activeColorLayer attrs */
-static PyObject *Mesh_getActiveLayer( BPy_Mesh * self, void *type )
-{
- CustomData *data = &self->mesh->fdata;
- int layer_type = (int)type;
- int i;
- if (layer_type < 0) { /* hack, if negative, its the renderlayer.*/
- layer_type = -layer_type;
- i = CustomData_get_render_layer_index(data, layer_type);
- } else {
- i = CustomData_get_active_layer_index(data, layer_type);
- }
- if (i == -1) /* so -1 is for no active layer 0+ for an active layer */
- Py_RETURN_NONE;
- else {
- return PyString_FromString( data->layers[i].name);
- }
-}
-
-static int Mesh_setActiveLayer( BPy_Mesh * self, PyObject * value, void *type )
-{
- CustomData *data = &self->mesh->fdata;
- char *name;
- int i,ok,n,layer_type = (int)type, render=0;
-
- if( !PyString_Check( value ) )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "expected a string argument" );
-
- if (layer_type<0) {
- layer_type = -layer_type;
- render = 1;
- }
-
- name = PyString_AsString( value );
- ok = 0;
- n = 0;
- for(i=0; i < data->totlayer; ++i) {
- if(data->layers[i].type == layer_type) {
- if (strcmp(data->layers[i].name, name)==0) {
- ok = 1;
- break;
- }
- n++;
- }
- }
-
- if (!ok)
- return EXPP_ReturnIntError( PyExc_ValueError,
- "layer name does not exist" );
- if (render) {
- CustomData_set_layer_render(data, layer_type, n);
- } else {
- CustomData_set_layer_active(data, layer_type, n);
- mesh_update_customdata_pointers(self->mesh);
- }
- return 0;
-}
-
-
-/* multires */
-static PyObject *Mesh_getMultiresLevelCount( BPy_Mesh * self )
-{
- int i;
- if (!self->mesh->mr)
- i=0;
- else
- i= self->mesh->mr->level_count;
-
- return PyInt_FromLong(i);
-}
-
-
-static PyObject *Mesh_getMultires( BPy_Mesh * self, void *type )
-{
- int i=0;
- if (self->mesh->mr) {
- switch ((int)type) {
- case MESH_MULTIRES_LEVEL:
- i = self->mesh->mr->newlvl;
- break;
- case MESH_MULTIRES_EDGE:
- i = self->mesh->mr->edgelvl;
- break;
- case MESH_MULTIRES_PIN:
- i = self->mesh->mr->pinlvl;
- break;
- case MESH_MULTIRES_RENDER:
- i = self->mesh->mr->renderlvl;
- break;
- }
- }
-
- return PyInt_FromLong(i);
-}
-
-static int Mesh_setMultires( BPy_Mesh * self, PyObject *value, void *type )
-{
- int i;
- if( !PyInt_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected integer argument" );
-
- if (!self->object)
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "This mesh must be linked to an object" );
-
- if (!self->mesh->mr)
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "the mesh has no multires data" );
-
- if (!self->mesh->mr->level_count)
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "multires data has no levels added" );
-
- i = PyInt_AsLong(value);
-
- if (i<1||i>self->mesh->mr->level_count)
- return EXPP_ReturnIntError( PyExc_TypeError,
- "value out of range" );
-
- switch ((int)type) {
- case MESH_MULTIRES_LEVEL:
- self->mesh->mr->newlvl = i;
- multires_set_level(self->object, self->mesh, 0);
- break;
- case MESH_MULTIRES_EDGE:
- self->mesh->mr->edgelvl = i;
- multires_edge_level_update(self->object, self->mesh);
- break;
- case MESH_MULTIRES_PIN:
- self->mesh->mr->pinlvl = i;
- break;
- case MESH_MULTIRES_RENDER:
- self->mesh->mr->renderlvl = i;
- break;
- }
-
- return 0;
-}
-
-/* end multires */
-
-
-static PyObject *Mesh_Tools( BPy_Mesh * self, int type, void **args )
-{
- Base *base;
- int result;
- Object *object = NULL;
- PyObject *attr = NULL;
-
- /* if already in edit mode, exit */
-
- if( G.obedit )
- return EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "can't use mesh tools while in edit mode" );
-
- for( base = FIRSTBASE; base; base = base->next ) {
- if( base->object->type == OB_MESH &&
- base->object->data == self->mesh ) {
- object = base->object;
- break;
- }
- }
- if( !object )
- return EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "can't find an object for the mesh" );
-
- if( object->type != OB_MESH )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "Object specified is not a mesh." );
-
- /* make mesh's object active, enter mesh edit mode */
- G.obedit = object;
- make_editMesh();
-
- /* apply operation, then exit edit mode */
- switch( type ) {
- case MESH_TOOL_TOSPHERE:
- vertices_to_sphere();
- break;
- case MESH_TOOL_VERTEXSMOOTH:
- vertexsmooth();
- break;
- case MESH_TOOL_FLIPNORM:
- /* would be simple to rewrite this to not use edit mesh */
- /* see flipface() */
- flip_editnormals();
- break;
- case MESH_TOOL_SUBDIV:
- esubdivideflag( 1, 0.0, *((int *)args[0]), 1, 0 );
- break;
- case MESH_TOOL_REMDOUB:
- result = removedoublesflag( 1, 0, *((float *)args[0]) );
-
- attr = PyInt_FromLong( result );
- if( !attr )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyInt_FromLong() failed" );
- break;
- case MESH_TOOL_FILL:
- fill_mesh();
- break;
- case MESH_TOOL_RECALCNORM:
- righthandfaces( *((int *)args[0]) );
- break;
- case MESH_TOOL_TRI2QUAD:
- join_triangles();
- break;
- case MESH_TOOL_QUAD2TRI:
- convert_to_triface( *((int *)args[0]) );
- break;
- }
-
- /* exit edit mode, free edit mesh */
- load_editMesh();
- free_editMesh(G.editMesh);
-
- if(G.f & G_FACESELECT)
- EXPP_allqueue( REDRAWIMAGE, 0 );
- if(G.f & G_WEIGHTPAINT)
- mesh_octree_table(G.obedit, NULL, 'e');
- G.obedit = NULL;
-
- DAG_object_flush_update(G.scene, object, OB_RECALC_DATA);
-
- if( attr )
- return attr;
-
- Py_RETURN_NONE;
-}
-
-/*
- * "Subdivide" function
- */
-
-static PyObject *Mesh_subdivide( BPy_Mesh * self, PyObject * args )
-{
- int beauty = 0;
- void *params = &beauty;
-
- if( !PyArg_ParseTuple( args, "|i", &beauty ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected nothing or an int argument" );
-
- return Mesh_Tools( self, MESH_TOOL_SUBDIV, &params );
-}
-
-/*
- * "Smooth" function
- */
-
-static PyObject *Mesh_smooth( BPy_Mesh * self )
-{
- return Mesh_Tools( self, MESH_TOOL_VERTEXSMOOTH, NULL );
-}
-
-/*
- * "Remove doubles" function
- */
-
-static PyObject *Mesh_removeDoubles( BPy_Mesh * self, PyObject *args )
-{
- float limit;
- void *params = &limit;
-
- if( !PyArg_ParseTuple( args, "f", &limit ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected float argument" );
-
- limit = EXPP_ClampFloat( limit, 0.0f, 1.0f );
-
- return Mesh_Tools( self, MESH_TOOL_REMDOUB, &params );
-}
-
-/*
- * "recalc normals" function
- */
-
-static PyObject *Mesh_recalcNormals( BPy_Mesh * self, PyObject *args )
-{
- int direction = 0;
- void *params = &direction;
-
- if( !PyArg_ParseTuple( args, "|i", &direction ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected nothing or an int in range [0,1]" );
-
- if( direction < 0 || direction > 1 )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "expected int in range [0,1]" );
-
- /* righthandfaces(1) = outward, righthandfaces(2) = inward */
- ++direction;
-
- return Mesh_Tools( self, MESH_TOOL_RECALCNORM, &params );
-}
-
-/*
- * "Quads to Triangles" function
- */
-
-static PyObject *Mesh_quad2tri( BPy_Mesh * self, PyObject *args )
-{
- int kind = 0;
- void *params = &kind;
-
- if( !PyArg_ParseTuple( args, "|i", &kind ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected nothing or an int in range [0,1]" );
-
- if( kind < 0 || kind > 1 )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "expected int in range [0,1]" );
-
- return Mesh_Tools( self, MESH_TOOL_QUAD2TRI, &params );
-}
-
-/*
- * "Triangles to Quads" function
- */
-
-static PyObject *Mesh_tri2quad( BPy_Mesh * self )
-{
- return Mesh_Tools( self, MESH_TOOL_TRI2QUAD, NULL );
-}
-
-/*
- * "Flip normals" function
- */
-
-static PyObject *Mesh_flipNormals( BPy_Mesh * self )
-{
- return Mesh_Tools( self, MESH_TOOL_FLIPNORM, NULL );
-}
-
-/*
- * "To sphere" function
- */
-
-static PyObject *Mesh_toSphere( BPy_Mesh * self )
-{
- return Mesh_Tools( self, MESH_TOOL_TOSPHERE, NULL );
-}
-
-/*
- * "Fill" (scan fill) function
- */
-
-static PyObject *Mesh_fill( BPy_Mesh * self )
-{
- return Mesh_Tools( self, MESH_TOOL_FILL, NULL );
-}
-
-
-/*
- * "pointInside" function
- */
-/* Warning - this is ordered - need to test both orders to be sure */
-#define SIDE_OF_LINE(pa,pb,pp) ((pa[0]-pp[0])*(pb[1]-pp[1]))-((pb[0]-pp[0])*(pa[1]-pp[1]))
-#define POINT_IN_TRI(p0,p1,p2,p3) ((SIDE_OF_LINE(p1,p2,p0)>=0) && (SIDE_OF_LINE(p2,p3,p0)>=0) && (SIDE_OF_LINE(p3,p1,p0)>=0))
-static short pointInside_internal(float *vec, float *v1, float *v2, float *v3 )
-{
- float z,w1,w2,w3,wtot;
-
-
- if (vec[2] > MAX3(v1[2], v2[2], v3[2]))
- return 0;
-
- /* need to test both orders */
- if (!POINT_IN_TRI(vec, v1,v2,v3) && !POINT_IN_TRI(vec, v3,v2,v1))
- return 0;
-
- w1= AreaF2Dfl(vec, v2, v3);
- w2= AreaF2Dfl(v1, vec, v3);
- w3= AreaF2Dfl(v1, v2, vec);
- wtot = w1+w2+w3;
- w1/=wtot; w2/=wtot; w3/=wtot;
- z =((v1[2] * w1) +
- (v2[2] * w2) +
- (v3[2] * w3));
-
- /* only return true if the face is above vec*/
- if (vec[2] < z )
- return 1;
-
- return 0;
-}
-
-static PyObject *Mesh_pointInside( BPy_Mesh * self, PyObject * args, PyObject *kwd )
-{
- Mesh *mesh = self->mesh;
- MFace *mf = mesh->mface;
- MVert *mvert = mesh->mvert;
- int i;
- int isect_count=0;
- int selected_only = 0;
- VectorObject *vec;
- static char *kwlist[] = {"point", "selected_only", NULL};
-
- if( !PyArg_ParseTupleAndKeywords(args, kwd, "|O!i", kwlist,
- &vector_Type, &vec, &selected_only) ) {
- return EXPP_ReturnPyObjError( PyExc_TypeError, "expected a vector and an optional bool argument");
- }
-
- if(vec->size < 3)
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Mesh.pointInside(vec) expects a 3D vector object\n");
-
- for( i = 0; i < mesh->totface; mf++, i++ ) {
- if (!selected_only || mf->flag & ME_FACE_SEL) {
- if (pointInside_internal(vec->vec, mvert[mf->v1].co, mvert[mf->v2].co, mvert[mf->v3].co)) {
- isect_count++;
- } else if (mf->v4 && pointInside_internal(vec->vec,mvert[mf->v1].co, mvert[mf->v3].co, mvert[mf->v4].co)) {
-
- isect_count++;
- }
- }
- }
-
- if (isect_count % 2)
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
-}
-
-
-/*
- * "__copy__" return a copy of the mesh
- */
-
-static PyObject *Mesh_copy( BPy_Mesh * self )
-{
- BPy_Mesh *obj;
-
- obj = (BPy_Mesh *)PyObject_NEW( BPy_Mesh, &Mesh_Type );
-
- if( !obj )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyObject_New() failed" );
-
- obj->mesh = copy_mesh( self->mesh );
- obj->mesh->id.us= 0;
- obj->object = NULL;
- obj->new = 1;
- return (PyObject *)obj;
-}
-
-
-static struct PyMethodDef BPy_Mesh_methods[] = {
- {"calcNormals", (PyCFunction)Mesh_calcNormals, METH_NOARGS,
- "all recalculate vertex normals"},
- {"vertexShade", (PyCFunction)Mesh_vertexShade, METH_VARARGS,
- "color vertices based on the current lighting setup"},
- {"findEdges", (PyCFunction)Mesh_findEdges, METH_VARARGS,
- "find indices of an multiple edges in the mesh"},
- {"getFromObject", (PyCFunction)Mesh_getFromObject, METH_VARARGS,
- "Get a mesh by name"},
- {"update", (PyCFunction)Mesh_Update, METH_VARARGS | METH_KEYWORDS,
- "Update display lists after changes to mesh"},
- {"transform", (PyCFunction)Mesh_transform, METH_VARARGS | METH_KEYWORDS,
- "Applies a transformation matrix to mesh's vertices"},
- {"addVertGroup", (PyCFunction)Mesh_addVertGroup, METH_O,
- "Assign vertex group name to the object linked to the mesh"},
- {"removeVertGroup", (PyCFunction)Mesh_removeVertGroup, METH_O,
- "Delete vertex group name from the object linked to the mesh"},
- {"assignVertsToGroup", (PyCFunction)Mesh_assignVertsToGroup, METH_VARARGS,
- "Assigns vertices to a vertex group"},
- {"removeVertsFromGroup", (PyCFunction)Mesh_removeVertsFromGroup, METH_VARARGS,
- "Removes vertices from a vertex group"},
- {"getVertsFromGroup", (PyCFunction)Mesh_getVertsFromGroup, METH_VARARGS,
- "Get index and optional weight for vertices in vertex group"},
- {"renameVertGroup", (PyCFunction)Mesh_renameVertGroup, METH_VARARGS,
- "Rename an existing vertex group"},
- {"getVertGroupNames", (PyCFunction)Mesh_getVertGroupNames, METH_NOARGS,
- "Get names of vertex groups"},
- {"getVertexInfluences", (PyCFunction)Mesh_getVertexInfluences, METH_VARARGS,
- "Get list of the influences of bones for a given mesh vertex"},
- /* Shape Keys */
- {"removeAllKeys", (PyCFunction)Mesh_removeAllKeys, METH_NOARGS,
- "Remove all the shape keys from a mesh"},
- {"insertKey", (PyCFunction)Mesh_insertKey, METH_VARARGS,
- "(frame = None, type = 'relative') - inserts a Mesh key at the given frame"},
- /* Mesh tools */
- {"smooth", (PyCFunction)Mesh_smooth, METH_NOARGS,
- "Flattens angle of selected faces (experimental)"},
- {"flipNormals", (PyCFunction)Mesh_flipNormals, METH_NOARGS,
- "Toggles the direction of selected face's normals (experimental)"},
- {"toSphere", (PyCFunction)Mesh_toSphere, METH_NOARGS,
- "Moves selected vertices outward in a spherical shape (experimental)"},
- {"fill", (PyCFunction)Mesh_fill, METH_NOARGS,
- "Scan fill a closed edge loop (experimental)"},
- {"triangleToQuad", (PyCFunction)Mesh_tri2quad, METH_VARARGS,
- "Convert selected triangles to quads (experimental)"},
- {"quadToTriangle", (PyCFunction)Mesh_quad2tri, METH_VARARGS,
- "Convert selected quads to triangles (experimental)"},
- {"subdivide", (PyCFunction)Mesh_subdivide, METH_VARARGS,
- "Subdivide selected edges in a mesh (experimental)"},
- {"remDoubles", (PyCFunction)Mesh_removeDoubles, METH_VARARGS,
- "Removes duplicates from selected vertices (experimental)"},
- {"recalcNormals", (PyCFunction)Mesh_recalcNormals, METH_VARARGS,
- "Recalculates inside or outside normals (experimental)"},
- {"pointInside", (PyCFunction)Mesh_pointInside, METH_VARARGS|METH_KEYWORDS,
- "Recalculates inside or outside normals (experimental)"},
-
- /* mesh custom data layers */
- {"addUVLayer", (PyCFunction)Mesh_addUVLayer, METH_VARARGS,
- "adds a UV layer to this mesh"},
- {"addColorLayer", (PyCFunction)Mesh_addColorLayer, METH_VARARGS,
- "adds a color layer to this mesh "},
- {"removeUVLayer", (PyCFunction)Mesh_removeUVLayer, METH_O,
- "removes a UV layer to this mesh"},
- {"removeColorLayer", (PyCFunction)Mesh_removeColorLayer, METH_O,
- "removes a color layer to this mesh"},
- {"getUVLayerNames", (PyCFunction)Mesh_getUVLayerNames, METH_NOARGS,
- "Get names of UV layers"},
- {"getColorLayerNames", (PyCFunction)Mesh_getColorLayerNames, METH_NOARGS,
- "Get names of Color layers"},
- {"renameUVLayer", (PyCFunction)Mesh_renameUVLayer, METH_VARARGS,
- "Rename a UV Layer"},
- {"renameColorLayer", (PyCFunction)Mesh_renameColorLayer, METH_VARARGS,
- "Rename a Color Layer"},
-
- /* python standard class functions */
- {"__copy__", (PyCFunction)Mesh_copy, METH_NOARGS,
- "Return a copy of the mesh"},
- {"copy", (PyCFunction)Mesh_copy, METH_NOARGS,
- "Return a copy of the mesh"},
- {NULL, NULL, 0, NULL}
-};
-
-/************************************************************************
- *
- * Python BPy_Mesh attributes
- *
- ************************************************************************/
-
-static PyObject *MVertSeq_CreatePyObject( Mesh * mesh )
-{
-
- BPy_MVertSeq *obj = PyObject_NEW( BPy_MVertSeq, &MVertSeq_Type);
- obj->mesh = mesh;
-
- /*
- an iter of -1 means this seq has not been used as an iterator yet
- once it is, then any other calls on getIter will return a new copy of BPy_MVertSeq
- This means you can loop do nested loops with the same iterator without worrying about
- the iter variable being used twice and messing up the loops.
- */
- obj->iter = -1;
- return (PyObject *)obj;
-}
-
-static PyObject *Mesh_getVerts( BPy_Mesh * self )
-{
- return MVertSeq_CreatePyObject(self->mesh);
-}
-
-static int Mesh_setVerts( BPy_Mesh * self, PyObject * args )
-{
- MVert *dst;
- MVert *src;
- int i;
-
- /* special case if None: delete the mesh */
- if( args == NULL || args == Py_None ) {
- Mesh *me = self->mesh;
- free_mesh( me );
- me->mvert = NULL; me->medge = NULL; me->mface = NULL;
- me->mtface = NULL; me->dvert = NULL; me->mcol = NULL;
- me->msticky = NULL; me->mat = NULL; me->bb = NULL; me->mselect = NULL;
- me->totvert = me->totedge = me->totface = me->totcol = 0;
- mesh_update( me );
- return 0;
- }
-
- if( PyList_Check( args ) ) {
- if( EXPP_check_sequence_consistency( args, &MVert_Type ) != 1 &&
- EXPP_check_sequence_consistency( args, &PVert_Type ) != 1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a list of MVerts" );
-
- if( PyList_Size( args ) != self->mesh->totvert )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "list must have the same number of vertices as the mesh" );
-
- dst = self->mesh->mvert;
- for( i = 0; i < PyList_Size( args ); ++i ) {
- BPy_MVert *v = (BPy_MVert *)PyList_GET_ITEM( args, i );
-
- if( BPy_MVert_Check( v ) )
- src = &((Mesh *)v->data)->mvert[v->index];
- else
- src = (MVert *)v->data;
-
- memcpy( dst, src, sizeof(MVert) );
- ++dst;
- }
- } else if( args->ob_type == &MVertSeq_Type ) {
- Mesh *mesh = ( (BPy_MVertSeq *) args)->mesh;
-
- if( mesh->totvert != self->mesh->totvert )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "vertex sequences must have the same number of vertices" );
-
- memcpy( self->mesh->mvert, mesh->mvert, mesh->totvert*sizeof(MVert) );
- } else
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a list or sequence of MVerts" );
- return 0;
-}
-
-static PyObject *MEdgeSeq_CreatePyObject( Mesh *mesh )
-{
- BPy_MEdgeSeq *obj = PyObject_NEW( BPy_MEdgeSeq, &MEdgeSeq_Type);
- obj->mesh = mesh;
- obj->iter = -1; /* iterator not yet used */
- return (PyObject *)obj;
-}
-
-static PyObject *Mesh_getEdges( BPy_Mesh * self )
-{
- return MEdgeSeq_CreatePyObject(self->mesh);
-}
-
-static PyObject *MFaceSeq_CreatePyObject( Mesh * mesh )
-{
- BPy_MFaceSeq *obj= PyObject_NEW( BPy_MFaceSeq, &MFaceSeq_Type);
- obj->mesh = mesh;
- obj->iter = -1; /* iterator not yet used */
- return (PyObject *)obj;
-}
-
-static PyObject *Mesh_getFaces( BPy_Mesh * self )
-{
- return MFaceSeq_CreatePyObject( self->mesh );
-}
-
-static PyObject *Mesh_getMaterials( BPy_Mesh *self )
-{
- return EXPP_PyList_fromMaterialList( self->mesh->mat,
- self->mesh->totcol, 1 );
-}
-
-static int Mesh_setMaterials( BPy_Mesh *self, PyObject * value )
-{
- Material **matlist;
- int len;
-
- if( !PySequence_Check( value ) ||
- !EXPP_check_sequence_consistency( value, &Material_Type ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "list should only contain materials or None)" );
-
- len = PyList_Size( value );
- if( len > 16 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "list can't have more than 16 materials" );
-
- /* free old material list (if it exists) and adjust user counts */
- if( self->mesh->mat ) {
- Mesh *me = self->mesh;
- int i;
- for( i = me->totcol; i-- > 0; )
- if( me->mat[i] )
- me->mat[i]->id.us--;
- MEM_freeN( me->mat );
- }
-
- /* build the new material list, increment user count, store it */
-
- matlist = EXPP_newMaterialList_fromPyList( value );
- EXPP_incr_mats_us( matlist, len );
- self->mesh->mat = matlist;
- self->mesh->totcol = (short)len;
-
-/**@ This is another ugly fix due to the weird material handling of blender.
- * it makes sure that object material lists get updated (by their length)
- * according to their data material lists, otherwise blender crashes.
- * It just stupidly runs through all objects...BAD BAD BAD.
- */
-
- test_object_materials( ( ID * ) self->mesh );
-
- return 0;
-}
-
-static PyObject *Mesh_getMaxSmoothAngle( BPy_Mesh * self )
-{
- return PyInt_FromLong( self->mesh->smoothresh );
-}
-
-static int Mesh_setMaxSmoothAngle( BPy_Mesh *self, PyObject *value )
-{
- return EXPP_setIValueClamped( value, &self->mesh->smoothresh,
- MESH_SMOOTHRESH_MIN,
- MESH_SMOOTHRESH_MAX, 'h' );
-}
-
-static PyObject *Mesh_getSubDivLevels( BPy_Mesh * self )
-{
- return Py_BuildValue( "(h,h)",
- self->mesh->subdiv, self->mesh->subdivr );
-}
-
-static int Mesh_setSubDivLevels( BPy_Mesh *self, PyObject *value )
-{
- int subdiv[2];
- int i;
- PyObject *tmp;
-
- if( !PyTuple_Check( value ) || PyTuple_Size( value ) != 2 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected (int, int) as argument" );
-
- for( i = 0; i < 2; i++ ) {
- tmp = PyTuple_GET_ITEM( value, i );
- if( !PyInt_Check( tmp ) )
- return EXPP_ReturnIntError ( PyExc_TypeError,
- "expected a list [int, int] as argument" );
- subdiv[i] = EXPP_ClampInt( PyInt_AsLong( tmp ),
- MESH_SUBDIV_MIN,
- MESH_SUBDIV_MAX );
- }
-
- self->mesh->subdiv = (short)subdiv[0];
- self->mesh->subdivr = (short)subdiv[1];
- return 0;
-}
-
-static PyObject *Mesh_getFlag( BPy_Mesh * self, void *type )
-{
- switch( (long)type ) {
- case MESH_HASFACEUV:
- return self->mesh->mtface ? EXPP_incr_ret_True() :
- EXPP_incr_ret_False();
- case MESH_HASMCOL:
- return self->mesh->mcol ? EXPP_incr_ret_True() :
- EXPP_incr_ret_False();
- case MESH_HASVERTUV:
- return self->mesh->msticky ? EXPP_incr_ret_True() :
- EXPP_incr_ret_False();
- case MESH_HASMULTIRES:
- return self->mesh->mr ? EXPP_incr_ret_True() :
- EXPP_incr_ret_False();
- default:
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute" );
- }
-}
-
-static int Mesh_setFlag( BPy_Mesh * self, PyObject *value, void *type )
-{
- int param;
- Mesh *mesh = self->mesh;
-
- param = PyObject_IsTrue( value );
-
- if( param == -1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected True/False or 0/1" );
-
- /* sticky is independent of faceUV and vertUV */
-
- switch( (long)type ) {
- case MESH_HASFACEUV:
- if( !param ) {
- if( mesh->mtface ) {
- CustomData_free_layers( &mesh->fdata, CD_MTFACE, mesh->totface );
- mesh->mtface = NULL;
- }
- } else if( !mesh->mtface ) {
- if( !mesh->totface )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "mesh has no faces" );
- make_tfaces( mesh );
- }
- return 0;
- case MESH_HASMCOL:
- if( !param ) {
- if( mesh->mcol ) {
- CustomData_free_layers( &mesh->fdata, CD_MCOL, mesh->totface );
- mesh->mcol = NULL;
- }
- } else if( !mesh->mcol ) {
- /* TODO: mesh_create_shadedColors */
- mesh->mcol = CustomData_add_layer( &mesh->fdata, CD_MCOL,
- CD_DEFAULT, NULL, mesh->totface );
- }
- return 0;
- case MESH_HASVERTUV:
- if( !param ) {
- if( mesh->msticky ) {
- CustomData_free_layer_active( &mesh->vdata, CD_MSTICKY, mesh->totvert );
- mesh->msticky = NULL;
- }
- } else {
- if( !mesh->msticky ) {
- mesh->msticky = CustomData_add_layer( &mesh->vdata, CD_MSTICKY,
- CD_CALLOC, NULL, mesh->totvert );
- memset( mesh->msticky, 255, mesh->totvert*sizeof( MSticky ) );
- /* TODO: rework RE_make_sticky() so we can calculate */
- }
- }
- return 0;
- case MESH_HASMULTIRES:
- if (!self->object)
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "This mesh must be linked to an object" );
-
- if( !param ) {
- if ( mesh->mr ) {
- multires_delete(self->object, mesh);
- }
- } else {
- if ( !mesh->mr ) {
- if (mesh->key)
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "Cannot enable multires for a mesh with shape keys" );
- multires_make(self->object, mesh);
- }
- }
- return 0;
- default:
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "couldn't get attribute" );
- }
-}
-
-static PyObject *Mesh_getMode( BPy_Mesh * self )
-{
- return PyInt_FromLong( self->mesh->flag );
-}
-
-static int Mesh_setMode( BPy_Mesh *self, PyObject *value )
-{
- short param;
- static short bitmask = ME_ISDONE | ME_NOPUNOFLIP | ME_TWOSIDED |
- ME_UVEFFECT | ME_VCOLEFFECT | ME_AUTOSMOOTH | ME_SMESH |
- ME_SUBSURF | ME_OPT_EDGES;
-
- if( !PyInt_Check ( value ) ) {
- char errstr[128];
- sprintf ( errstr , "expected int bitmask of 0x%04x", bitmask );
- return EXPP_ReturnIntError( PyExc_TypeError, errstr );
- }
- param = (short)PyInt_AS_LONG ( value );
-
- if( ( param & bitmask ) != param )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "invalid bit(s) set in mask" );
-
- self->mesh->flag = param;
-
- return 0;
-}
-
-static PyObject *Mesh_getKey( BPy_Mesh * self )
-{
- if( self->mesh->key )
- return Key_CreatePyObject(self->mesh->key);
- else
- Py_RETURN_NONE;
-}
-
-
-static PyObject *Mesh_getActiveFace( BPy_Mesh * self )
-{
- /* not needed but keep incase exceptions make use of it */
- if( !self->mesh->mtface )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "face has no texture values" );
-
- if (self->mesh->act_face != -1 && self->mesh->act_face <= self->mesh->totface)
- return PyInt_FromLong( self->mesh->act_face );
-
- Py_RETURN_NONE;
-}
-
-static int Mesh_setActiveFace( BPy_Mesh * self, PyObject * value )
-{
- int param;
-
- /* if no texture faces, error */
-
- if( !self->mesh->mtface )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "face has no texture values" );
-
- /* if param isn't an int, error */
-
- if( !PyInt_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected an int argument" );
-
- /* check for a valid index */
-
- param = PyInt_AsLong( value );
- if( param < 0 || param > self->mesh->totface )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "face index out of range" );
-
- self->mesh->act_face = param;
- return 0;
-}
-
-static PyObject *Mesh_getActiveGroup( BPy_Mesh * self )
-{
- bDeformGroup *defGroup;
- Object *object = self->object;
-
- if( !object )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This mesh must be linked to an object" );
-
- if( object->actdef ) {
- defGroup = BLI_findlink( &object->defbase, object->actdef-1 );
- return PyString_FromString( defGroup->name );
- }
-
- Py_RETURN_NONE;
-}
-
-static int Mesh_setActiveGroup( BPy_Mesh * self, PyObject * arg )
-{
- char *name;
- int tmp;
- Object *object = self->object;
-
- if( !object )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "This mesh must be linked to an object" );
-
- if( !PyString_Check( arg ) )
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "expected a string argument" );
-
- name = PyString_AsString( arg );
- tmp = object->actdef;
- vertexgroup_select_by_name( object, name );
- if( !object->actdef ) {
- object->actdef = tmp;
- return EXPP_ReturnIntError( PyExc_ValueError,
- "vertex group not found" );
- }
-
- return 0;
-}
-
-static PyObject *Mesh_getTexMesh( BPy_Mesh * self )
-{
- Mesh *texme= self->mesh->texcomesh;
-
- if (texme)
- return Mesh_CreatePyObject( texme, NULL );
- else
- Py_RETURN_NONE;
-}
-
-static int Mesh_setTexMesh( BPy_Mesh * self, PyObject * value )
-{
- int ret = GenericLib_assignData(value, (void **) &self->mesh->texcomesh, 0, 1, ID_ME, 0);
-
- if (ret==0 && value!=Py_None) /*This must be a mesh type*/
- (( BPy_Mesh * ) value)->new= 0;
-
- return ret;
-}
-
-static int Mesh_setSel( BPy_Mesh * self, PyObject * value )
-{
- int i, param = PyObject_IsTrue( value );
- Mesh *me = self->mesh;
- MVert *mvert = me->mvert;
- MEdge *medge = me->medge;
- MFace *mface = me->mface;
-
- if( param == -1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected True/False or 0/1" );
-
- if( param ) {
- for( i = 0; i < me->totvert; ++mvert, ++i )
- mvert->flag |= SELECT;
- for( i = 0; i < me->totedge; ++medge, ++i )
- medge->flag |= SELECT;
- for( i = 0; i < me->totface; ++mface, ++i )
- mface->flag |= ME_FACE_SEL;
- } else {
- for( i = 0; i < me->totvert; ++mvert, ++i )
- mvert->flag &= ~SELECT;
- for( i = 0; i < me->totedge; ++medge, ++i )
- medge->flag &= ~SELECT;
- for( i = 0; i < me->totface; ++mface, ++i )
- mface->flag &= ~ME_FACE_SEL;
- }
-
- return 0;
-}
-
-static int Mesh_setHide( BPy_Mesh * self, PyObject * value )
-{
- int i, param = PyObject_IsTrue( value );
- Mesh *me = self->mesh;
- MVert *mvert = me->mvert;
- MEdge *medge = me->medge;
- MFace *mface = me->mface;
-
- if( param == -1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected True/False or 0/1" );
-
- if( param ) {
- for( i = 0; i < me->totvert; ++mvert, ++i )
- mvert->flag |= ME_HIDE;
- for( i = 0; i < me->totedge; ++medge, ++i )
- medge->flag |= ME_HIDE;
- for( i = 0; i < me->totface; ++mface, ++i )
- mface->flag |= ME_HIDE;
- } else {
- for( i = 0; i < me->totvert; ++mvert, ++i )
- mvert->flag &= ~ME_HIDE;
- for( i = 0; i < me->totedge; ++medge, ++i )
- medge->flag &= ~ME_HIDE;
- for( i = 0; i < me->totface; ++mface, ++i )
- mface->flag &= ~ME_HIDE;
- }
-
- return 0;
-}
-
-/************************************************************************
- *
- * Python Mesh_Type standard operations
- *
- ************************************************************************/
-
-static void Mesh_dealloc( BPy_Mesh * self )
-{
- Mesh *mesh = self->mesh;
-
- /* if the mesh is new and has no users, delete it */
- if( self->new && !mesh->id.us )
- free_libblock( &G.main->mesh, mesh );
-
- PyObject_DEL( self );
-}
-
-static int Mesh_compare( BPy_Mesh * a, BPy_Mesh * b )
-{
- return ( a->mesh == b->mesh ) ? 0 : -1;
-}
-
-static PyObject *Mesh_repr( BPy_Mesh * self )
-{
- return PyString_FromFormat( "[Mesh \"%s\"]",
- self->mesh->id.name + 2 );
-}
-
-/*****************************************************************************/
-/* Python Mesh_Type attributes get/set structure: */
-/*****************************************************************************/
-static PyGetSetDef BPy_Mesh_getseters[] = {
- GENERIC_LIB_GETSETATTR,
- {"verts",
- (getter)Mesh_getVerts, (setter)Mesh_setVerts,
- "The mesh's vertices (MVert)",
- NULL},
- {"edges",
- (getter)Mesh_getEdges, (setter)NULL,
- "The mesh's edge data (MEdge)",
- NULL},
- {"faces",
- (getter)Mesh_getFaces, (setter)NULL,
- "The mesh's face data (MFace)",
- NULL},
- {"materials",
- (getter)Mesh_getMaterials, (setter)Mesh_setMaterials,
- "List of the mesh's materials",
- NULL},
- {"degr",
- (getter)Mesh_getMaxSmoothAngle, (setter)Mesh_setMaxSmoothAngle,
- "The max angle for auto smoothing",
- NULL},
- {"maxSmoothAngle",
- (getter)Mesh_getMaxSmoothAngle, (setter)Mesh_setMaxSmoothAngle,
- "deprecated: see 'degr'",
- NULL},
- {"subDivLevels",
- (getter)Mesh_getSubDivLevels, (setter)Mesh_setSubDivLevels,
- "The display and rendering subdivision levels",
- NULL},
- {"mode",
- (getter)Mesh_getMode, (setter)Mesh_setMode,
- "The mesh's mode bitfield",
- NULL},
- {"key",
- (getter)Mesh_getKey, (setter)NULL,
- "The mesh's key",
- NULL},
- {"faceUV",
- (getter)Mesh_getFlag, (setter)Mesh_setFlag,
- "UV-mapped textured faces enabled",
- (void *)MESH_HASFACEUV},
- {"vertexColors",
- (getter)Mesh_getFlag, (setter)Mesh_setFlag,
- "Vertex colors for the mesh enabled",
- (void *)MESH_HASMCOL},
- {"vertexUV",
- (getter)Mesh_getFlag, (setter)Mesh_setFlag,
- "'Sticky' flag for per vertex UV coordinates enabled",
- (void *)MESH_HASVERTUV},
- {"multires",
- (getter)Mesh_getFlag, (setter)Mesh_setFlag,
- "'Sticky' flag for per vertex UV coordinates enabled",
- (void *)MESH_HASMULTIRES},
- {"activeFace",
- (getter)Mesh_getActiveFace, (setter)Mesh_setActiveFace,
- "Index of the mesh's active texture face (in UV editor)",
- NULL},
- {"activeGroup",
- (getter)Mesh_getActiveGroup, (setter)Mesh_setActiveGroup,
- "Active group for the mesh",
- NULL},
-
- /* uv layers */
- {"activeColorLayer",
- (getter)Mesh_getActiveLayer, (setter)Mesh_setActiveLayer,
- "Name of the active UV layer",
- (void *)CD_MCOL},
- {"activeUVLayer",
- (getter)Mesh_getActiveLayer, (setter)Mesh_setActiveLayer,
- "Name of the active vertex color layer",
- (void *)CD_MTFACE},
- /* hack flip CD_MCOL so it uses the render setting */
- {"renderColorLayer",
- (getter)Mesh_getActiveLayer, (setter)Mesh_setActiveLayer,
- "Name of the render UV layer",
- (void *)-CD_MCOL},
- {"renderUVLayer",
- (getter)Mesh_getActiveLayer, (setter)Mesh_setActiveLayer,
- "Name of the render vertex color layer",
- (void *)-CD_MTFACE},
-
-
-
- /* Multires */
- {"multiresLevelCount",
- (getter)Mesh_getMultiresLevelCount, (setter)NULL,
- "The total number of multires levels",
- NULL},
- {"multiresDrawLevel",
- (getter)Mesh_getMultires, (setter)Mesh_setMultires,
- "The current multires display level",
- (void *)MESH_MULTIRES_LEVEL},
- {"multiresEdgeLevel",
- (getter)Mesh_getMultires, (setter)Mesh_setMultires,
- "The current multires edge level",
- (void *)MESH_MULTIRES_EDGE},
- {"multiresPinLevel",
- (getter)Mesh_getMultires, (setter)Mesh_setMultires,
- "The current multires pin level",
- (void *)MESH_MULTIRES_PIN},
- {"multiresRenderLevel",
- (getter)Mesh_getMultires, (setter)Mesh_setMultires,
- "The current multires render level",
- (void *)MESH_MULTIRES_RENDER},
-
- {"texMesh",
- (getter)Mesh_getTexMesh, (setter)Mesh_setTexMesh,
- "The meshes tex mesh proxy texture coord mesh",
- NULL},
- {"sel",
- (getter)NULL, (setter)Mesh_setSel,
- "Select/deselect all verts, edges, faces in the mesh",
- NULL},
- {"hide",
- (getter)NULL, (setter)Mesh_setHide,
- "Hide/unhide all verts, edges, faces in the mesh",
- NULL},
-
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-/*****************************************************************************/
-/* Python Mesh_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject Mesh_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender Mesh", /* char *tp_name; */
- sizeof( BPy_Mesh ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- ( destructor ) Mesh_dealloc,/* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- ( cmpfunc ) Mesh_compare, /* cmpfunc tp_compare; */
- ( reprfunc ) Mesh_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- NULL, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
- 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, /* 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, /* 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 ***/
- BPy_Mesh_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_Mesh_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-/*
- * get one or all mesh data objects
- */
-
-static PyObject *M_Mesh_Get( PyObject * self_unused, PyObject * args )
-{
- char *name = NULL;
- Mesh *mesh = NULL;
- BPy_Mesh* obj;
-
- if( !PyArg_ParseTuple( args, "|s", &name ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected zero or one string arguments" );
-
- if( name ) {
- mesh = ( Mesh * ) GetIdFromList( &( G.main->mesh ), name );
-
- if( !mesh ) {
- char error_msg[64];
- PyOS_snprintf( error_msg, sizeof( error_msg ),
- "Mesh \"%s\" not found", name );
- return ( EXPP_ReturnPyObjError
- ( PyExc_NameError, error_msg ) );
- }
- return Mesh_CreatePyObject( mesh, NULL );
- } else { /* () - return a list with all meshes in the scene */
- PyObject *meshlist;
- Link *link;
- int index = 0;
-
- meshlist = PyList_New( BLI_countlist( &( G.main->mesh ) ) );
-
- if( !meshlist )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create PyList" );
-
- link = G.main->mesh.first;
- index = 0;
- while( link ) {
- obj = ( BPy_Mesh * ) Mesh_CreatePyObject( ( Mesh * )link, NULL );
- PyList_SetItem( meshlist, index, ( PyObject * ) obj );
- index++;
- link = link->next;
- }
- return meshlist;
- }
-}
-
-/*
- * create a new mesh data object
- */
-
-static PyObject *M_Mesh_New( PyObject * self_unused, PyObject * args )
-{
- char *name = "Mesh";
- Mesh *mesh;
- BPy_Mesh *obj;
-
- if( !PyArg_ParseTuple( args, "|s", &name ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected nothing or a string as argument" );
-
- obj = (BPy_Mesh *)PyObject_NEW( BPy_Mesh, &Mesh_Type );
-
- if( !obj )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyObject_New() failed" );
-
- mesh = add_mesh(name); /* doesn't return NULL now, but might someday */
-
- if( !mesh ) {
- Py_DECREF ( obj );
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "FATAL: could not create mesh object" );
- }
-
- /* Bound box set to null needed because a new mesh is initialized
- with a bounding box of -1 -1 -1 -1 -1 -1
- if its not set to null the bounding box is not re-calculated
- when ob.getBoundBox() is called.*/
- MEM_freeN(mesh->bb);
- mesh->bb= NULL;
-
- mesh->id.us = 0;
-
- obj->mesh = mesh;
- obj->object = NULL;
- obj->new = 1;
- return (PyObject *)obj;
-}
-
-/*
- * creates a new MVert for users to manipulate
- */
-
-static PyObject *M_Mesh_MVert( PyObject * self_unused, PyObject * args )
-{
- int i;
- MVert vert;
-
- /* initialize the new vert's data */
- memset( &vert, 0, sizeof( MVert ) );
-
- /*
- * accept either a 3D vector or tuple of three floats
- */
-
- if( PyTuple_Size ( args ) == 1 ) {
- PyObject *tmp = PyTuple_GET_ITEM( args, 0 );
- if( !VectorObject_Check( tmp ) || ((VectorObject *)tmp)->size != 3 )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "expected three floats or vector of size 3" );
- for( i = 0; i < 3; ++i )
- vert.co[i] = ((VectorObject *)tmp)->vec[i];
- } else if( !PyArg_ParseTuple ( args, "fff",
- &vert.co[0], &vert.co[1], &vert.co[2] ) )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "expected three floats or vector of size 3" );
-
- /* make a new MVert from the data */
- return PVert_CreatePyObject( &vert );
-}
-
-static PyObject *M_Mesh_Modes( PyObject * self_unused, PyObject * args )
-{
- int modes = 0;
-
- if( !G.scene ) {
- Py_RETURN_NONE;
- }
-
- if( !PyArg_ParseTuple( args, "|i", &modes ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected optional int as argument" );
-
- if( modes > ( SCE_SELECT_VERTEX | SCE_SELECT_EDGE | SCE_SELECT_FACE ) )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "value out of range" );
-
- if( modes > 0 )
- G.scene->selectmode = (short)modes;
-
- return PyInt_FromLong( G.scene->selectmode );
-}
-
-static struct PyMethodDef M_Mesh_methods[] = {
- {"New", (PyCFunction)M_Mesh_New, METH_VARARGS,
- "Create a new mesh"},
- {"Get", (PyCFunction)M_Mesh_Get, METH_VARARGS,
- "Get a mesh by name"},
- {"MVert", (PyCFunction)M_Mesh_MVert, METH_VARARGS,
- "Create a new MVert"},
- {"Mode", (PyCFunction)M_Mesh_Modes, METH_VARARGS,
- "Get/set edit selection mode(s)"},
- {NULL, NULL, 0, NULL},
-};
-
-static PyObject *M_Mesh_ModesDict( void )
-{
- PyObject *Modes = PyConstant_New( );
-
- if( Modes ) {
- BPy_constant *d = ( BPy_constant * ) Modes;
-
- PyConstant_Insert( d, "NOVNORMALSFLIP",
- PyInt_FromLong( ME_NOPUNOFLIP ) );
- PyConstant_Insert( d, "TWOSIDED", PyInt_FromLong( ME_TWOSIDED ) );
- PyConstant_Insert( d, "AUTOSMOOTH",
- PyInt_FromLong( ME_AUTOSMOOTH ) );
- }
-
- return Modes;
-}
-
-/* Set constants for face drawing mode -- see drawmesh.c */
-
-static PyObject *M_Mesh_FaceModesDict( void )
-{
- PyObject *FM = PyConstant_New( );
-
- if( FM ) {
- BPy_constant *d = ( BPy_constant * ) FM;
-
- PyConstant_Insert( d, "BILLBOARD",
- PyInt_FromLong( TF_BILLBOARD2 ) );
- PyConstant_Insert( d, "ALL", PyInt_FromLong( 0xffff ) );
- PyConstant_Insert( d, "HALO", PyInt_FromLong( TF_BILLBOARD ) );
- PyConstant_Insert( d, "DYNAMIC", PyInt_FromLong( TF_DYNAMIC ) );
- PyConstant_Insert( d, "INVISIBLE", PyInt_FromLong( TF_INVISIBLE ) );
- PyConstant_Insert( d, "LIGHT", PyInt_FromLong( TF_LIGHT ) );
- PyConstant_Insert( d, "OBCOL", PyInt_FromLong( TF_OBCOL ) );
- PyConstant_Insert( d, "SHADOW", PyInt_FromLong( TF_SHADOW ) );
- PyConstant_Insert( d, "TEXT", PyInt_FromLong( TF_BMFONT ) );
- PyConstant_Insert( d, "SHAREDVERT", PyInt_FromLong( TF_SHAREDVERT ) );
- PyConstant_Insert( d, "SHAREDCOL", PyInt_FromLong( TF_SHAREDCOL ) );
- PyConstant_Insert( d, "TEX", PyInt_FromLong( TF_TEX ) );
- PyConstant_Insert( d, "TILES", PyInt_FromLong( TF_TILES ) );
- PyConstant_Insert( d, "TWOSIDE", PyInt_FromLong( TF_TWOSIDE ) );
- }
-
- return FM;
-}
-
-static PyObject *M_Mesh_FaceFlagsDict( void )
-{
- PyObject *FF = PyConstant_New( );
-
- if( FF ) {
- BPy_constant *d = ( BPy_constant * ) FF;
-
- PyConstant_Insert( d, "SELECT", PyInt_FromLong( TF_SELECT ) );
- PyConstant_Insert( d, "HIDE", PyInt_FromLong( TF_HIDE ) );
- PyConstant_Insert( d, "ACTIVE", PyInt_FromLong( TF_ACTIVE ) ); /* deprecated */
- }
-
- return FF;
-}
-
-static PyObject *M_Mesh_FaceTranspModesDict( void )
-{
- PyObject *FTM = PyConstant_New( );
-
- if( FTM ) {
- BPy_constant *d = ( BPy_constant * ) FTM;
-
- PyConstant_Insert( d, "SOLID", PyInt_FromLong( TF_SOLID ) );
- PyConstant_Insert( d, "ADD", PyInt_FromLong( TF_ADD ) );
- PyConstant_Insert( d, "ALPHA", PyInt_FromLong( TF_ALPHA ) );
- PyConstant_Insert( d, "SUB", PyInt_FromLong( TF_SUB ) );
- }
-
- return FTM;
-}
-
-static PyObject *M_Mesh_EdgeFlagsDict( void )
-{
- PyObject *EF = PyConstant_New( );
-
- if( EF ) {
- BPy_constant *d = ( BPy_constant * ) EF;
-
- PyConstant_Insert(d, "SELECT", PyInt_FromLong( SELECT ) );
- PyConstant_Insert(d, "EDGEDRAW", PyInt_FromLong( ME_EDGEDRAW ) );
- PyConstant_Insert(d, "EDGERENDER", PyInt_FromLong( ME_EDGERENDER ) );
- PyConstant_Insert(d, "SEAM", PyInt_FromLong( ME_SEAM ) );
- PyConstant_Insert(d, "FGON", PyInt_FromLong( ME_FGON ) );
- PyConstant_Insert(d, "LOOSE", PyInt_FromLong( ME_LOOSEEDGE ) );
- PyConstant_Insert(d, "SHARP", PyInt_FromLong( ME_SHARP ) );
- }
-
- return EF;
-}
-
-static PyObject *M_Mesh_VertAssignDict( void )
-{
- PyObject *Vert = PyConstant_New( );
- if( Vert ) {
- BPy_constant *d = ( BPy_constant * ) Vert;
- PyConstant_Insert(d, "ADD", PyInt_FromLong(WEIGHT_ADD));
- PyConstant_Insert(d, "REPLACE", PyInt_FromLong(WEIGHT_REPLACE));
- PyConstant_Insert(d, "SUBTRACT", PyInt_FromLong(WEIGHT_SUBTRACT));
- }
- return Vert;
-}
-
-
-static PyObject *M_Mesh_SelectModeDict( void )
-{
- PyObject *Mode = PyConstant_New( );
- if( Mode ) {
- BPy_constant *d = ( BPy_constant * ) Mode;
- PyConstant_Insert(d, "VERTEX", PyInt_FromLong(SCE_SELECT_VERTEX));
- PyConstant_Insert(d, "EDGE", PyInt_FromLong(SCE_SELECT_EDGE));
- PyConstant_Insert(d, "FACE", PyInt_FromLong(SCE_SELECT_FACE));
- }
- return Mode;
-}
-
-static char M_Mesh_doc[] = "The Blender.Mesh submodule";
-
-PyObject *Mesh_Init( void )
-{
- PyObject *submodule;
-
- PyObject *Modes = M_Mesh_ModesDict( );
- PyObject *FaceFlags = M_Mesh_FaceFlagsDict( );
- PyObject *FaceModes = M_Mesh_FaceModesDict( );
- PyObject *FaceTranspModes = M_Mesh_FaceTranspModesDict( );
- PyObject *EdgeFlags = M_Mesh_EdgeFlagsDict( );
- PyObject *AssignModes = M_Mesh_VertAssignDict( );
- PyObject *SelectModes = M_Mesh_SelectModeDict( );
- PyObject *PropertyTypes = M_Mesh_PropertiesTypeDict( );
-
- if( PyType_Ready( &MCol_Type ) < 0 )
- return NULL;
- if( PyType_Ready( &MVert_Type ) < 0 )
- return NULL;
- if( PyType_Ready( &PVert_Type ) < 0 )
- return NULL;
- if( PyType_Ready( &MVertSeq_Type ) < 0 )
- return NULL;
- if( PyType_Ready( &MEdge_Type ) < 0 )
- return NULL;
- if( PyType_Ready( &MEdgeSeq_Type ) < 0 )
- return NULL;
- if( PyType_Ready( &MFace_Type ) < 0 )
- return NULL;
- if( PyType_Ready( &MFaceSeq_Type ) < 0 )
- return NULL;
- if( PyType_Ready( &Mesh_Type ) < 0 )
- return NULL;
-
- submodule =
- Py_InitModule3( "Blender.Mesh", M_Mesh_methods, M_Mesh_doc );
- PyDict_SetItemString( PyModule_GetDict( submodule ),
- "Primitives", MeshPrimitives_Init( ) );
-
- if( Modes )
- PyModule_AddObject( submodule, "Modes", Modes );
- if( FaceFlags )
- PyModule_AddObject( submodule, "FaceFlags", FaceFlags );
- if( FaceModes )
- PyModule_AddObject( submodule, "FaceModes", FaceModes );
- if( FaceTranspModes )
- PyModule_AddObject( submodule, "FaceTranspModes",
- FaceTranspModes );
- if( EdgeFlags )
- PyModule_AddObject( submodule, "EdgeFlags", EdgeFlags );
- if( AssignModes )
- PyModule_AddObject( submodule, "AssignModes", AssignModes );
- if( SelectModes )
- PyModule_AddObject( submodule, "SelectModes", SelectModes );
- if( PropertyTypes )
- PyModule_AddObject( submodule, "PropertyTypes", PropertyTypes );
-
-
-
- return submodule;
-}
-
-/* These are needed by Object.c */
-
-PyObject *Mesh_CreatePyObject( Mesh * me, Object *obj )
-{
- BPy_Mesh *nmesh = PyObject_NEW( BPy_Mesh, &Mesh_Type );
-
- if( !nmesh )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create BPy_Mesh object" );
-
- nmesh->mesh = me;
- nmesh->object = obj;
- nmesh->new = 0;
- G.totmesh++;
-
- return ( PyObject * ) nmesh;
-}
-
-
-Mesh *Mesh_FromPyObject( PyObject * pyobj, Object *obj )
-{
- BPy_Mesh *blen_obj;
-
- blen_obj = ( BPy_Mesh * ) pyobj;
- if (obj)
- blen_obj->object = obj;
-
- return blen_obj->mesh;
-
-}
diff --git a/source/blender/python/api2_2x/Mesh.h b/source/blender/python/api2_2x/Mesh.h
deleted file mode 100644
index d73c5c5925e..00000000000
--- a/source/blender/python/api2_2x/Mesh.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * $Id: Mesh.h 10269 2007-03-15 01:09:14Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Ken Hughes
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-/* Most of this file comes from opy_nmesh.[ch] in the old bpython dir */
-
-#ifndef EXPP_MESH_H
-#define EXPP_MESH_H
-
-#include <Python.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "DNA_object_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "Material.h"
-#include "Image.h"
-
-/* EXPP PyType Objects */
-extern PyTypeObject Mesh_Type;
-extern PyTypeObject MVert_Type;
-extern PyTypeObject PVert_Type;
-extern PyTypeObject MVertSeq_Type;
-extern PyTypeObject MEdge_Type;
-extern PyTypeObject MFace_Type;
-extern PyTypeObject MCol_Type;
-
-struct BPy_Object;
-
-/* Type checking for EXPP PyTypes */
-#define BPy_Mesh_Check(v) ((v)->ob_type == &Mesh_Type)
-#define BPy_MFace_Check(v) ((v)->ob_type == &MFace_Type)
-#define BPy_MEdge_Check(v) ((v)->ob_type == &MEdge_Type)
-#define BPy_MVert_Check(v) ((v)->ob_type == &MVert_Type)
-#define BPy_PVert_Check(v) ((v)->ob_type == &PVert_Type)
-#define BPy_MCol_Check(v) ((v)->ob_type == &MCol_Type)
-
-/* Typedefs for the new types */
-
-typedef struct {
- PyObject_HEAD /* required python macro */
- MCol *color;
-} BPy_MCol; /* a Mesh color: [r,g,b,a] */
-
-typedef struct {
- PyObject_VAR_HEAD /* required python macro */
- void * data; /* points to a Mesh or an MVert */
- int index;
-} BPy_MVert; /* a Mesh vertex */
-
-typedef struct {
- PyObject_VAR_HEAD /* required python macro */
- Mesh * mesh;
- int iter;
-} BPy_MVertSeq; /* a Mesh vertex sequence */
-
-typedef struct {
- PyObject_VAR_HEAD /* required python macro */
- Mesh *mesh; /* points to a Mesh */
- int index;
- short iter; /* char because it can only ever be between -1 and 2 */
-} BPy_MEdge; /* a Mesh edge */
-
-typedef struct {
- PyObject_VAR_HEAD /* required python macro */
- Mesh * mesh;
- int iter;
-} BPy_MEdgeSeq; /* a Mesh edge sequence */
-
-typedef struct {
- PyObject_VAR_HEAD /* required python macro */
- Mesh * mesh;
- int index;
- short iter; /* char because it can only ever be between -1 and 4 */
-} BPy_MFace; /* a Mesh face */
-
-typedef struct {
- PyObject_VAR_HEAD /* required python macro */
- Mesh * mesh;
- int iter;
-} BPy_MFaceSeq; /* a Mesh face sequence */
-
-typedef struct {
- PyObject_HEAD /* required python macro */
- Mesh *mesh;
- Object *object;
- char new; /* was mesh created or already existed? */
-} BPy_Mesh;
-
-/* PROTOS */
-
-PyObject *Mesh_Init( void );
-PyObject *Mesh_CreatePyObject( Mesh * me, Object *obj );
-Mesh *Mesh_FromPyObject( PyObject * pyobj, Object *obj );
-
-#endif /* EXPP_MESH_H */
diff --git a/source/blender/python/api2_2x/Metaball.c b/source/blender/python/api2_2x/Metaball.c
deleted file mode 100644
index 72152bd1a9a..00000000000
--- a/source/blender/python/api2_2x/Metaball.c
+++ /dev/null
@@ -1,1189 +0,0 @@
-/*
- * $Id: Metaball.c 11136 2007-07-01 05:41:23Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Jacques Guignot
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include "Metaball.h" /*This must come first*/
-
-#include "BKE_main.h"
-#include "BKE_global.h"
-#include "BKE_mball.h"
-#include "BKE_library.h"
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h" /* for quat normal */
-#include "DNA_object_types.h"
-#include "Mathutils.h"
-#include "Material.h"
-#include "gen_utils.h"
-#include "gen_library.h"
-
-/* for dealing with materials */
-#include "MEM_guardedalloc.h"
-#include "BKE_material.h"
-
-/* checks for the metaelement being removed */
-#define METAELEM_DEL_CHECK_PY(bpy_meta_elem) if (!(bpy_meta_elem->metaelem)) return ( EXPP_ReturnPyObjError( PyExc_RuntimeError, "Metaball has been removed" ) );
-#define METAELEM_DEL_CHECK_INT(bpy_meta_elem) if (!(bpy_meta_elem->metaelem)) return ( EXPP_ReturnIntError( PyExc_RuntimeError, "Metaball has been removed" ) );
-
-/*****************************************************************************/
-/* Python API function prototypes for the Metaball module. */
-/*****************************************************************************/
-static PyObject *M_Metaball_New( PyObject * self, PyObject * args );
-static PyObject *M_Metaball_Get( PyObject * self, PyObject * args );
-
-/*****************************************************************************/
-/* The following string definitions are used for documentation strings. */
-/* In Python these will be written to the console when doing a */
-/* Blender.Metaball.__doc__ */
-/*****************************************************************************/
-static char M_Metaball_doc[] =
- "The Blender Metaball module\n\n\nMetaballs are primitive shapes\
- such as balls, pipes, boxes and planes,\
- that can join each other to create smooth,\
- organic volumes\n. The shapes themseves are called\
- 'Metaelements' and can be accessed from the Metaball module.";
-
-static char M_Metaball_New_doc[] = "Creates new metaball object data";
-
-static char M_Metaball_Get_doc[] = "Retreives an existing metaball object data";
-
-/*****************************************************************************/
-/* Python method structure definition for Blender.Metaball module: */
-/*****************************************************************************/
-struct PyMethodDef M_Metaball_methods[] = {
- {"New", M_Metaball_New, METH_VARARGS, M_Metaball_New_doc},
- {"Get", M_Metaball_Get, METH_VARARGS, M_Metaball_Get_doc},
- {NULL, NULL, 0, NULL}
-};
-
-static PyObject *M_MetaElem_TypesDict( void )
-{
- PyObject *Types = PyConstant_New( );
-
- if( Types ) {
- BPy_constant *d = ( BPy_constant * ) Types;
-
- PyConstant_Insert( d, "BALL", PyInt_FromLong( MB_BALL ) );
- /* PyConstant_Insert( d, "TUBEX", PyInt_FromLong( MB_TUBEX ) ); - DEPRICATED */
- /* PyConstant_Insert( d, "TUBEY", PyInt_FromLong( MB_TUBEY ) ); - DEPRICATED */
- /* PyConstant_Insert( d, "TUBEZ", PyInt_FromLong( MB_TUBEZ ) ); - DEPRICATED */
- PyConstant_Insert( d, "TUBE", PyInt_FromLong( MB_TUBE ) );
- PyConstant_Insert( d, "PLANE", PyInt_FromLong( MB_PLANE ) );
- PyConstant_Insert( d, "ELIPSOID",PyInt_FromLong( MB_ELIPSOID ) );
- PyConstant_Insert( d, "CUBE", PyInt_FromLong( MB_CUBE ) );
- }
-
- return Types;
-}
-
-static PyObject *M_MetaElem_UpdateDict( void )
-{
- PyObject *Update = PyConstant_New( );
-
- if( Update ) {
- BPy_constant *d = ( BPy_constant * ) Update;
- PyConstant_Insert( d, "ALWAYS", PyInt_FromLong( MB_UPDATE_ALWAYS ) );
- PyConstant_Insert( d, "HALFRES",PyInt_FromLong( MB_UPDATE_HALFRES ) );
- PyConstant_Insert( d, "FAST", PyInt_FromLong( MB_UPDATE_FAST ) );
- PyConstant_Insert( d, "NEVER", PyInt_FromLong( MB_UPDATE_NEVER ) );
- }
-
- return Update;
-}
-
-/*****************************************************************************/
-/* Python BPy_Metaball methods declarations: */
-/*****************************************************************************/
-static PyObject *Metaball_getElements( BPy_Metaball * self );
-static PyObject *Metaball_getMaterials( BPy_Metaball * self );
-static int Metaball_setMaterials( BPy_Metaball * self, PyObject * value );
-static PyObject *Metaball_getWiresize( BPy_Metaball * self );
-static int Metaball_setWiresize( BPy_Metaball * self, PyObject * value );
-static PyObject *Metaball_getRendersize( BPy_Metaball * self );
-static int Metaball_setRendersize( BPy_Metaball * self, PyObject * value);
-static PyObject *Metaball_getThresh( BPy_Metaball * self );
-static int Metaball_setThresh( BPy_Metaball * self, PyObject * args );
-static PyObject *Metaball_getUpdate( BPy_Metaball * self );
-static int Metaball_setUpdate( BPy_Metaball * self, PyObject * args );
-static PyObject *Metaball_copy( BPy_Metaball * self );
-
-/*****************************************************************************/
-/* Python BPy_Metaball methods table: */
-/*****************************************************************************/
-static PyMethodDef BPy_Metaball_methods[] = {
- /* name, method, flags, doc */
- {"__copy__", ( PyCFunction ) Metaball_copy,
- METH_NOARGS, "() - Return a copy of this metaball"},
- {"copy", ( PyCFunction ) Metaball_copy,
- METH_NOARGS, "() - Return a copy of this metaball"},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Python BPy_Metaelem methods table: */
-/*****************************************************************************/
-static PyMethodDef BPy_Metaelem_methods[] = {
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Python Metaball_Type callback function prototypes: */
-/*****************************************************************************/
-static PyObject *Metaball_repr( BPy_Metaball * self );
-static int Metaball_compare( BPy_Metaball * a, BPy_Metaball * b );
-
-/*****************************************************************************/
-/* Python Metaelem_Type callback function prototypes: */
-/*****************************************************************************/
-static void Metaelem_dealloc( BPy_Metaelem * self );
-static PyObject *Metaelem_repr( BPy_Metaelem * self );
-static int Metaelem_compare( BPy_Metaelem * a, BPy_Metaelem * b );
-
-static PyObject *Metaelem_getType( BPy_Metaelem *self );
-static int Metaelem_setType( BPy_Metaelem * self, PyObject * args );
-static PyObject *Metaelem_getCoord( BPy_Metaelem * self );
-static int Metaelem_setCoord( BPy_Metaelem * self, VectorObject * value );
-static PyObject *Metaelem_getDims( BPy_Metaelem * self );
-static int Metaelem_setDims( BPy_Metaelem * self, VectorObject * value );
-static PyObject *Metaelem_getQuat( BPy_Metaelem * self );
-static int Metaelem_setQuat( BPy_Metaelem * self, QuaternionObject * value );
-static PyObject *Metaelem_getStiffness( BPy_Metaelem * self );
-static int Metaelem_setStiffness( BPy_Metaelem * self, PyObject * value );
-static PyObject *Metaelem_getRadius( BPy_Metaelem * self );
-static int Metaelem_setRadius( BPy_Metaelem * self, PyObject * value );
-
-static PyObject *Metaelem_getMFlagBits( BPy_Metaelem * self, void * type );
-static int Metaelem_setMFlagBits( BPy_Metaelem * self, PyObject * value, void * type );
-
-/*****************************************************************************/
-/* Python attributes get/set structure: */
-/*****************************************************************************/
-static PyGetSetDef BPy_Metaball_getseters[] = {
- GENERIC_LIB_GETSETATTR,
- {"materials",
- (getter)Metaball_getMaterials, (setter)Metaball_setMaterials,
- "Number of metaball users",
- NULL},
- {"elements",
- (getter)Metaball_getElements, (setter)NULL,
- "Elements in this metaball",
- NULL},
- {"wiresize",
- (getter)Metaball_getWiresize, (setter)Metaball_setWiresize,
- "The density to draw the metaball in the 3D view",
- NULL},
- {"rendersize",
- (getter)Metaball_getRendersize, (setter)Metaball_setRendersize,
- "The density to render wire",
- NULL},
- {"thresh",
- (getter)Metaball_getThresh, (setter)Metaball_setThresh,
- "The density to render wire",
- NULL},
- {"update",
- (getter)Metaball_getUpdate, (setter)Metaball_setUpdate,
- "The setting for updating this metaball data",
- NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-
-/*****************************************************************************/
-/* Python TypeMetaball structure definition: */
-/*****************************************************************************/
-PyTypeObject Metaball_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender Metaball", /* char *tp_name; */
- sizeof( BPy_Metaball ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL, /* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- ( cmpfunc ) Metaball_compare, /* cmpfunc tp_compare; */
- ( reprfunc ) Metaball_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- NULL, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
- 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, /* 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, /* 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 ***/
- BPy_Metaball_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_Metaball_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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 PyGetSetDef BPy_Metaelem_getseters[] = {
- {"type",
- (getter)Metaelem_getType, (setter)Metaelem_setType,
- "Metaelem Type",
- NULL},
- {"co",
- (getter)Metaelem_getCoord, (setter)Metaelem_setCoord,
- "Metaelem Location",
- NULL},
- {"quat",
- (getter)Metaelem_getQuat, (setter)Metaelem_setQuat,
- "Metaelem Rotation Quat",
- NULL},
- {"dims",
- (getter)Metaelem_getDims, (setter)Metaelem_setDims,
- "Metaelem Dimensions",
- NULL},
- {"stiffness",
- (getter)Metaelem_getStiffness, (setter)Metaelem_setStiffness,
- "MetaElem stiffness",
- NULL},
- {"radius",
- (getter)Metaelem_getRadius, (setter)Metaelem_setRadius,
- "The radius of the MetaElem",
- NULL},
- {"negative",
- (getter)Metaelem_getMFlagBits, (setter)Metaelem_setMFlagBits,
- "The density to render wire",
- (void *)MB_NEGATIVE},
- {"hide",
- (getter)Metaelem_getMFlagBits, (setter)Metaelem_setMFlagBits,
- "The density to render wire",
- (void *)MB_HIDE},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-
-/*****************************************************************************/
-/* Python TypeMetaelem structure definition: */
-/*****************************************************************************/
-PyTypeObject Metaelem_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender Metaelem", /* char *tp_name; */
- sizeof( BPy_Metaelem ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- ( destructor ) Metaelem_dealloc,/* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- ( cmpfunc ) Metaelem_compare, /* cmpfunc tp_compare; */
- ( reprfunc ) Metaelem_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- 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; */
- 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, /* 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, /* 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 ***/
- BPy_Metaelem_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_Metaelem_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-
-/*****************************************************************************/
-/* Function: M_Metaball_New */
-/* Python equivalent: Blender.Metaball.New */
-/*****************************************************************************/
-static PyObject *M_Metaball_New( PyObject * self, PyObject * args )
-{
- char *name = 0;
- BPy_Metaball *pymball; /* for Data object wrapper in Python */
- MetaBall *blmball; /* for actual Data we create in Blender */
-
- if( !PyArg_ParseTuple( args, "|s", &name ) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "Metaball.New() - expected string argument (or nothing)" ) );
-
- /* first create the MetaBall Data in Blender */
- if (name)
- blmball = add_mball( name );
- else
- blmball = add_mball( "Meta" );
-
- if( blmball ) {
- /* return user count to zero since add_mball() incref'ed it */
- blmball->id.us = 0;
- /* now create the wrapper obj in Python */
- pymball =
- ( BPy_Metaball * ) PyObject_NEW( BPy_Metaball,
- &Metaball_Type );
- } else
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "Metaball.New() - couldn't create data in Blender" ) );
-
- if( pymball == NULL )
- return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create MetaBall Data object" ) );
-
- pymball->metaball = blmball;
- /*link Python mballer wrapper to Blender MetaBall */
-
- return ( PyObject * ) pymball;
-}
-
-
-/*****************************************************************************/
-/* Function: M_Metaball_Get */
-/* Python equivalent: Blender.Metaball.Get */
-/* Description: Receives a string and returns the metaball data obj */
-/* whose name matches the string. If no argument is */
-/* passed in, a list of all metaball data names in the */
-/* current scene is returned. */
-/*****************************************************************************/
-static PyObject *M_Metaball_Get( PyObject * self, PyObject * args )
-{
- char *name = NULL;
- MetaBall *mball_iter = NULL;
-
- if( !PyArg_ParseTuple( args, "|s", &name ) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "Metaball.Get() - expected string argument (or nothing)" ) );
-
- if( name ) { /* (name) - Search mball by name */
- mball_iter = ( MetaBall * ) GetIdFromList( &( G.main->mball ), name );
-
- if (!mball_iter) {
- char error_msg[128];
- PyOS_snprintf( error_msg, sizeof( error_msg ),
- "Metaball.Get(\"%s\") - not found", name );
- return ( EXPP_ReturnPyObjError
- ( PyExc_NameError, error_msg ) );
- }
- return Metaball_CreatePyObject(mball_iter);
-
- } else { /* () - return a list of all mballs in the scene */
-
- PyObject *mballlist = PyList_New( BLI_countlist( &( G.main->mball ) ) );
- int index=0;
-
- if( mballlist == NULL )
- return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
- "MetaBall.Get() - couldn't create PyList" ) );
-
- mball_iter = G.main->mball.first;
- while( mball_iter ) {
- PyList_SetItem( mballlist, index, Metaball_CreatePyObject(mball_iter) );
- index++;
- mball_iter = mball_iter->id.next;
- }
- return mballlist;
- }
-
-}
-
-
-/*****************************************************************************/
-/* Function: initObject */
-/*****************************************************************************/
-PyObject *Metaball_Init( void )
-{
- PyObject *submodule;
- PyObject *Types= M_MetaElem_TypesDict( );
- PyObject *Update= M_MetaElem_UpdateDict( );
-
- if( PyType_Ready( &Metaball_Type ) < 0 )
- return NULL;
- if( PyType_Ready( &Metaelem_Type ) < 0 )
- return NULL;
- if( PyType_Ready( &MetaElemSeq_Type ) < 0 )
- return NULL;
-
- submodule = Py_InitModule3( "Blender.Metaball", M_Metaball_methods, M_Metaball_doc);
-
- if( Types )
- PyModule_AddObject( submodule, "Types", Types );
- PyModule_AddObject( submodule, "Update", Update );
-
- /*Add SUBMODULES to the module*/
- /*PyDict_SetItemString(dict, "Constraint", Constraint_Init()); */ /*creates a *new* module*/
- return submodule;
-}
-
-MetaBall *Metaball_FromPyObject( PyObject * pyobj )
-{
- return ( ( BPy_Metaball * ) pyobj )->metaball;
-}
-
-static PyObject *Metaball_getMaterials( BPy_Metaball *self )
-{
- return EXPP_PyList_fromMaterialList( self->metaball->mat,
- self->metaball->totcol, 1 );
-}
-static int Metaball_setMaterials( BPy_Metaball *self, PyObject * value )
-{
- Material **matlist;
- int len;
-
- if( !PySequence_Check( value ) ||
- !EXPP_check_sequence_consistency( value, &Material_Type ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "metaball.materials - list should only contain materials or None)" );
-
- len = PyList_Size( value );
- if( len > 16 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "metaball.materials - list can't have more than 16 materials" );
-
- /* free old material list (if it exists) and adjust user counts */
- if( self->metaball->mat ) {
- MetaBall *mb = self->metaball;
- int i;
- for( i = mb->totcol; i-- > 0; )
- if( mb->mat[i] )
- mb->mat[i]->id.us--;
- MEM_freeN( mb->mat );
- }
-
- /* build the new material list, increment user count, store it */
-
- matlist = EXPP_newMaterialList_fromPyList( value );
- EXPP_incr_mats_us( matlist, len );
- self->metaball->mat = matlist;
- self->metaball->totcol = (short)len;
-
-/**@ This is another ugly fix due to the weird material handling of blender.
- * it makes sure that object material lists get updated (by their length)
- * according to their data material lists, otherwise blender crashes.
- * It just stupidly runs through all objects...BAD BAD BAD.
- */
-
- test_object_materials( ( ID * ) self->metaball );
-
- return 0;
-}
-
-static PyObject *Metaball_getWiresize( BPy_Metaball * self )
-{
- return PyFloat_FromDouble( self->metaball->wiresize );
-}
-
-static int Metaball_setWiresize( BPy_Metaball * self, PyObject * value )
-{
- float param;
- if( !PyNumber_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "metaball.wiresize - expected float argument" );
-
- param = (float)PyFloat_AsDouble( value );
-
- self->metaball->wiresize = EXPP_ClampFloat(param, 0.05f, 1.0);
- return 0;
-
-}
-static PyObject *Metaball_getRendersize( BPy_Metaball * self )
-{
- return PyFloat_FromDouble( self->metaball->rendersize );
-}
-
-static int Metaball_setRendersize( BPy_Metaball * self, PyObject * value )
-{
-
- float param;
- if( !PyNumber_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "metaball.rendersize - expected float argument" );
-
- param = (float)PyFloat_AsDouble( value );
-
- self->metaball->rendersize = EXPP_ClampFloat(param, 0.05f, 1.0);
- return 0;
-}
-
-static PyObject *Metaball_getThresh( BPy_Metaball * self )
-{
- return PyFloat_FromDouble( self->metaball->thresh );
-}
-
-static int Metaball_setThresh( BPy_Metaball * self, PyObject * value )
-{
-
- float param;
- if( !PyNumber_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "metaball.thresh - expected float argument" );
-
- param = (float)PyFloat_AsDouble( value );
-
- self->metaball->thresh = EXPP_ClampFloat(param, 0.0, 5.0);
- return 0;
-}
-
-static PyObject *Metaball_getUpdate( BPy_Metaball * self )
-{
- return PyInt_FromLong( (long)self->metaball->flag );
-}
-
-static int Metaball_setUpdate( BPy_Metaball * self, PyObject * value )
-{
-
- int param;
- if( !PyInt_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "metaball.update - expected an int argument" );
-
- param = (int)PyInt_AS_LONG( value );
-
- self->metaball->flag = EXPP_ClampInt( param, 0, 3 );
- return 0;
-}
-
-static PyObject *Metaball_copy( BPy_Metaball * self )
-{
- BPy_Metaball *pymball; /* for Data object wrapper in Python */
- MetaBall *blmball; /* for actual Data we create in Blender */
-
- blmball = copy_mball( self->metaball ); /* first create the MetaBall Data in Blender */
-
- if( blmball ) {
- /* return user count to zero since add_mball() incref'ed it */
- blmball->id.us = 0;
- /* now create the wrapper obj in Python */
- pymball =
- ( BPy_Metaball * ) PyObject_NEW( BPy_Metaball,
- &Metaball_Type );
- } else
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "metaball.__copy__() - couldn't create data in Blender" ) );
-
- if( pymball == NULL )
- return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
- "metaball.__copy__() - couldn't create data in Blender" ) );
-
- pymball->metaball = blmball;
-
- return ( PyObject * ) pymball;
-}
-
-
-/* These are needed by Object.c */
-PyObject *Metaball_CreatePyObject( MetaBall * mball)
-{
- BPy_Metaball *py_mball= PyObject_NEW( BPy_Metaball, &Metaball_Type );
-
- if( !py_mball )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create BPy_Metaball object" );
-
- py_mball->metaball= mball;
-
- return ( PyObject * ) py_mball;
-}
-
-
-static PyObject *MetaElemSeq_CreatePyObject(BPy_Metaball *self, MetaElem *iter)
-{
- BPy_MetaElemSeq *seq = PyObject_NEW( BPy_MetaElemSeq, &MetaElemSeq_Type);
- seq->bpymetaball = self; Py_INCREF(self);
- seq->iter= iter;
- return (PyObject *)seq;
-}
-
-/*
- * Element, get an instance of the iterator.
- */
-static PyObject *Metaball_getElements( BPy_Metaball * self )
-{
- return MetaElemSeq_CreatePyObject(self, NULL);
-}
-
-/*
- * Metaelem dealloc - free from memory
- */
-/* This is a callback function for the BPy_Metaelem type. It is */
-static void Metaelem_dealloc( BPy_Metaelem * self )
-{
- self->metaelem= NULL; /* so any references to the same bpyobject will raise an error */
- PyObject_DEL( self );
-}
-
-/*
- * elem.type - int to set the shape of the element
- */
-static PyObject *Metaelem_getType( BPy_Metaelem *self )
-{
- METAELEM_DEL_CHECK_PY(self);
-
- return PyInt_FromLong( self->metaelem->type );
-}
-static int Metaelem_setType( BPy_Metaelem * self, PyObject * value )
-{
- int type;
- if( !PyInt_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "metaelem.type - expected an integer (bitmask) as argument" );
-
- METAELEM_DEL_CHECK_INT(self);
-
- type = PyInt_AS_LONG( value );
-
- if( (type < 0) || ( type > ( MB_BALL | MB_TUBEX | MB_TUBEY | MB_TUBEZ | MB_TUBE | MB_PLANE | MB_ELIPSOID | MB_CUBE ) ))
- return EXPP_ReturnIntError( PyExc_ValueError,
- "metaelem.type - value out of range" );
-
- self->metaelem->type= type;
- return 0;
-}
-
-/*
- * elem.co - non wrapped vector representing location
- */
-static PyObject *Metaelem_getCoord( BPy_Metaelem * self )
-{
- float co[3];
-
- METAELEM_DEL_CHECK_PY(self);
-
- co[0]= self->metaelem->x;
- co[1]= self->metaelem->y;
- co[2]= self->metaelem->z;
-
- return newVectorObject( co, 3, Py_NEW );
-}
-static int Metaelem_setCoord( BPy_Metaelem * self, VectorObject * value )
-{
-
- if( !VectorObject_Check( value ) || value->size != 3 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "metaelem.co - expected vector argument of size 3" );
-
- METAELEM_DEL_CHECK_INT(self);
-
- self->metaelem->x= value->vec[0];
- self->metaelem->y= value->vec[1];
- self->metaelem->z= value->vec[2];
- return 0;
-}
-
-/*
- * elem.dims - non wrapped vector representing the xyz dimensions
- * only effects some element types
- */
-static PyObject *Metaelem_getDims( BPy_Metaelem * self )
-{
- float co[3];
- METAELEM_DEL_CHECK_PY(self);
-
- co[0]= self->metaelem->expx;
- co[1]= self->metaelem->expy;
- co[2]= self->metaelem->expz;
- return newVectorObject( co, 3, Py_NEW );
-}
-static int Metaelem_setDims( BPy_Metaelem * self, VectorObject * value )
-{
- if( !VectorObject_Check( value ) || value->size != 3 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "metaelem.dims - expected vector argument of size 3" );
-
- METAELEM_DEL_CHECK_INT(self);
-
- self->metaelem->expx= EXPP_ClampFloat(value->vec[0], 0.0, 20.0);
- self->metaelem->expy= EXPP_ClampFloat(value->vec[1], 0.0, 20.0);
- self->metaelem->expz= EXPP_ClampFloat(value->vec[2], 0.0, 20.0);
- return 0;
-}
-
-/*
- * elem.quat - non wrapped quat representing the rotation
- * only effects some element types - a rotated ball has no effect for eg.
- */
-static PyObject *Metaelem_getQuat( BPy_Metaelem * self )
-{
- METAELEM_DEL_CHECK_PY(self);
- return newQuaternionObject(self->metaelem->quat, Py_NEW);
-}
-static int Metaelem_setQuat( BPy_Metaelem * self, QuaternionObject * value )
-{
- int i;
- if( !QuaternionObject_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "metaelem.quat - expected quat argument" );
-
- METAELEM_DEL_CHECK_INT(self);
-
- for (i = 0; i < 4; i++)
- self->metaelem->quat[i]= value->quat[i];
-
- /* need to normalize or metaball drawing can go into an infinate loop */
- NormalQuat(self->metaelem->quat);
-
- return 0;
-}
-
-/*
- * elem.hide and elem.sel - get/set true false
- */
-static PyObject *Metaelem_getMFlagBits( BPy_Metaelem * self, void * type )
-{
- METAELEM_DEL_CHECK_PY(self);
- return EXPP_getBitfield( &(self->metaelem->flag), (int)((long)type ), 'h' );
-}
-static int Metaelem_setMFlagBits( BPy_Metaelem * self, PyObject * value,
- void * type )
-{
- METAELEM_DEL_CHECK_INT(self);
- return EXPP_setBitfield( value, &(self->metaelem->flag),
- (int)((long)type), 'h' );
-}
-
-/*
- * elem.stiffness - floating point, the volume of this element.
- */
-static PyObject *Metaelem_getStiffness( BPy_Metaelem *self )
-{
- METAELEM_DEL_CHECK_PY(self);
- return PyFloat_FromDouble( self->metaelem->s );
-}
-static int Metaelem_setStiffness( BPy_Metaelem *self, PyObject *value)
-{
- if( !PyNumber_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "metaelem.stiffness - expected float argument" );
-
- self->metaelem->s = EXPP_ClampFloat((float)PyFloat_AsDouble( value ), 0.0, 10.0);
- return 0;
-}
-
-/*
- * elem.radius- floating point, the size if the element
- */
-static PyObject *Metaelem_getRadius( BPy_Metaelem *self )
-{
- METAELEM_DEL_CHECK_PY(self);
- return PyFloat_FromDouble( self->metaelem->rad );
-}
-static int Metaelem_setRadius( BPy_Metaelem *self, PyObject *value)
-{
- if( !PyNumber_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "metaelem.radius - expected float argument" );
-
- self->metaelem->rad = /* is 5000 too small? */
- EXPP_ClampFloat((float)PyFloat_AsDouble( value ), 0.0, 5000.0);
-
- return 0;
-}
-
-
-/*
- * callback functions for comparison.
- * It compares two Metaball_Type objects. Only the "==" and "!="
- * comparisons are meaninful. Returns 0 for equality and -1 if
- * they don't point to the same Blender struct.
- * In Python it becomes 1 if they are equal, 0 otherwise.
- */
-static int Metaball_compare( BPy_Metaball * a, BPy_Metaball * b )
-{
- MetaBall *pa = a->metaball, *pb = b->metaball;
- return ( pa == pb ) ? 0 : -1;
-}
-
-static int MetaElemSeq_compare( BPy_MetaElemSeq * a, BPy_MetaElemSeq * b )
-{
- MetaBall *pa = a->bpymetaball->metaball, *pb = b->bpymetaball->metaball;
- return ( pa == pb ) ? 0 : -1;
-}
-
-static int Metaelem_compare( BPy_Metaelem * a, BPy_Metaelem * b )
-{
- MetaElem *pa = a->metaelem, *pb = b->metaelem;
- return ( pa == pb ) ? 0 : -1;
-}
-
-/*
- * repr function
- * callback functions building meaninful string to representations
- */
-static PyObject *Metaball_repr( BPy_Metaball * self )
-{
- return PyString_FromFormat( "[Metaball \"%s\"]",
- self->metaball->id.name + 2 );
-}
-
-static PyObject *Metaelem_repr( BPy_Metaelem * self )
-{
- return PyString_FromString( "Metaelem" );
-}
-
-static PyObject *MetaElemSeq_repr( BPy_MetaElemSeq * self )
-{
- return PyString_FromFormat( "[Metaball Iterator \"%s\"]",
- self->bpymetaball->metaball->id.name + 2 );
-}
-
-
-
-/*
- * MeteElem Seq sequence
- */
-
-static PyObject *MetaElem_CreatePyObject( MetaElem *metaelem )
-{
- BPy_Metaelem *elem= PyObject_NEW( BPy_Metaelem, &Metaelem_Type);
- elem->metaelem = metaelem; Py_INCREF(elem);
- return (PyObject *)elem;
-}
-
-static int MetaElemSeq_len( BPy_MetaElemSeq * self )
-{
- return BLI_countlist( &( self->bpymetaball->metaball->elems ) );
-}
-
-
-static PySequenceMethods MetaElemSeq_as_sequence = {
- ( inquiry ) MetaElemSeq_len, /* sq_length */
- ( binaryfunc ) 0, /* sq_concat */
- ( intargfunc ) 0, /* sq_repeat */
- ( intargfunc ) 0, /* sq_item */
- ( intintargfunc ) 0, /* sq_slice */
- ( intobjargproc ) 0, /* sq_ass_item */
- ( intintobjargproc ) 0, /* sq_ass_slice */
- 0,0,0,
-};
-
-/************************************************************************
- *
- * Python MetaElemSeq_Type iterator (iterates over Metaballs)
- *
- ************************************************************************/
-
-/*
- * Initialize the interator
- */
-
-static PyObject *MetaElemSeq_getIter( BPy_MetaElemSeq * self )
-{
- if (!self->iter) { /* not alredy looping on this data, */
- self->iter = self->bpymetaball->metaball->elems.first;
- return EXPP_incr_ret ( (PyObject *) self );
- } else
- return MetaElemSeq_CreatePyObject(self->bpymetaball, self->bpymetaball->metaball->elems.first);
-}
-
-/*
- * Return next MetaElem.
- */
-
-static PyObject *MetaElemSeq_nextIter( BPy_MetaElemSeq * self )
-{
- PyObject *object;
- if( !(self->iter) || !(self->bpymetaball->metaball) ) {
- self->iter= NULL;
- return EXPP_ReturnPyObjError( PyExc_StopIteration,
- "iterator at end" );
- }
-
- object= MetaElem_CreatePyObject( self->iter );
- self->iter= self->iter->next;
- return object;
-}
-
-/*
- * Adds and returns a new metaelement,
- * no args are taken so the returned metaball must be modified after adding.
- * Accessed as mball.elements.add() where mball is a python metaball data type.
- */
-static PyObject *MetaElemSeq_add( BPy_MetaElemSeq * self )
-{
- MetaElem *ml;
-
- ml = MEM_callocN( sizeof( MetaElem ), "metaelem" );
- BLI_addhead( &( self->bpymetaball->metaball->elems ), ml );
- ml->x = 0;
- ml->y = 0;
- ml->z = 0;
- ml->quat[0]= 1.0;
- ml->quat[1]= 0.0;
- ml->quat[2]= 0.0;
- ml->quat[3]= 0.0;
- ml->rad = 2;
- ml->s = 2.0;
- ml->flag = SELECT;
- ml->type = 0;
- ml->expx = 1;
- ml->expy = 1;
- ml->expz = 1;
- ml->type = MB_BALL;
-
- return MetaElem_CreatePyObject(ml);
-}
-
-
-/*
- * removes a metaelement if it is a part of the metaball,
- * no args are taken so the returned metaball must be modified after adding.
- * Accessed as mball.elements.add() where mball is a python metaball data type.
- */
-static PyObject *MetaElemSeq_remove( BPy_MetaElemSeq * self, BPy_Metaelem *elem )
-{
- MetaElem *ml_iter, *ml_py;
-
- if( !BPy_Metaelem_Check(elem) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "elements.remove(metaelem) - expected a Metaball element" );
-
- METAELEM_DEL_CHECK_PY(elem);
-
- ml_py= elem->metaelem;
-
- for (ml_iter= self->bpymetaball->metaball->elems.first; ml_iter; ml_iter= ml_iter->next) {
- if (ml_py == ml_iter) {
- elem->metaelem= NULL;
- BLI_freelinkN( &(self->bpymetaball->metaball->elems), ml_py);
- Py_RETURN_NONE;
- }
- }
-
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "elements.remove(elem): elem not in meta elements" );
-
-}
-
-static struct PyMethodDef BPy_MetaElemSeq_methods[] = {
- {"add", (PyCFunction)MetaElemSeq_add, METH_NOARGS,
- "add metaelem to metaball data"},
- {"remove", (PyCFunction)MetaElemSeq_remove, METH_O,
- "remove element from metaball data"},
- {NULL, NULL, 0, NULL}
-};
-
-/************************************************************************
- *
- * Python MetaElemSeq_Type standard operations
- *
- ************************************************************************/
-
-static void MetaElemSeq_dealloc( BPy_MetaElemSeq * self )
-{
- Py_DECREF(self->bpymetaball);
- PyObject_DEL( self );
-}
-
-/*****************************************************************************/
-/* Python MetaElemSeq_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject MetaElemSeq_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender MetaElemSeq", /* char *tp_name; */
- sizeof( BPy_MetaElemSeq ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- ( destructor ) MetaElemSeq_dealloc,/* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- ( cmpfunc ) MetaElemSeq_compare, /* cmpfunc tp_compare; */
- ( reprfunc ) MetaElemSeq_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- &MetaElemSeq_as_sequence, /* 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; */
- 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, /* 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, /* richcmpfunc tp_richcompare; */
-
- /*** weak reference enabler ***/
- 0, /* long tp_weaklistoffset; */
-
- /*** Added in release 2.2 ***/
- /* Iterators */
- ( getiterfunc) MetaElemSeq_getIter, /* getiterfunc tp_iter; */
- ( iternextfunc ) MetaElemSeq_nextIter, /* iternextfunc tp_iternext; */
-
- /*** Attribute descriptor and subclassing stuff ***/
- BPy_MetaElemSeq_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- NULL, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
diff --git a/source/blender/python/api2_2x/Metaball.h b/source/blender/python/api2_2x/Metaball.h
deleted file mode 100644
index 6be35dbd3fb..00000000000
--- a/source/blender/python/api2_2x/Metaball.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * $Id: Metaball.h 10269 2007-03-15 01:09:14Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Jacques Guignot
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#ifndef EXPP_METABALL_H
-#define EXPP_METABALL_H
-
-#include <Python.h>
-#include "DNA_meta_types.h"
-
-
-extern PyTypeObject Metaball_Type;
-
-#define BPy_Metaball_Check(v) ((v)->ob_type==&Metaball_Type)
-
-
-/* Python BPy_Metaball structure definition */
-typedef struct {
- PyObject_HEAD /* required py macro */
- MetaBall * metaball; /* libdata must be second */
-} BPy_Metaball;
-
-
-extern PyTypeObject Metaelem_Type;
-
-#define BPy_Metaelem_Check(v) ((v)->ob_type==&Metaelem_Type)
-
-/* Python BPy_Metaelem structure definition */
-typedef struct {
- PyObject_HEAD /* required py macro */
- MetaElem * metaelem;
-} BPy_Metaelem;
-
-extern PyTypeObject MetaElemSeq_Type;
-
-#define BPy_MetaElemSeq_Check(v) ((v)->ob_type==&MetaElemSeq_Type)
-
-/* Python BPy_MetaElemSeq structure definition */
-typedef struct {
- PyObject_HEAD /* required py macro */
- BPy_Metaball *bpymetaball; /* link to the python group so we can know if its been removed */
- MetaElem * iter; /* so we can iterate over the objects */
-} BPy_MetaElemSeq;
-
-/*
- * prototypes
- */
-
-PyObject *Metaball_Init( void );
-PyObject *Metaball_CreatePyObject( MetaBall * mball );
-MetaBall *Metaball_FromPyObject( PyObject * py_obj );
-
-#endif /* EXPP_METABALL_H */
diff --git a/source/blender/python/api2_2x/Modifier.c b/source/blender/python/api2_2x/Modifier.c
deleted file mode 100644
index 57f09332c03..00000000000
--- a/source/blender/python/api2_2x/Modifier.c
+++ /dev/null
@@ -1,1693 +0,0 @@
-/*
- * $Id: Modifier.c 12840 2007-12-11 01:58:22Z khughes $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Ken Hughes, Campbell Barton
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-/* TODO, accessing a modifier sequence of a deleted object will crash blender at the moment, not sure how to fix this. */
-
-
-#include "Modifier.h" /*This must come first*/
-
-#include "DNA_object_types.h"
-#include "DNA_effect_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_vec_types.h"
-
-#include "BKE_main.h"
-#include "BKE_global.h"
-#include "BKE_modifier.h"
-#include "BKE_library.h"
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "MEM_guardedalloc.h"
-#include "butspace.h"
-#include "blendef.h"
-#include "mydevice.h"
-
-#include "Object.h"
-#include "Texture.h"
-#include "Mathutils.h"
-#include "gen_utils.h"
-#include "gen_library.h"
-
-/* checks for the scene being removed */
-#define MODIFIER_DEL_CHECK_PY(bpy_modifier) if (!(bpy_modifier->md)) return ( EXPP_ReturnPyObjError( PyExc_RuntimeError, "Modifier has been removed" ) )
-#define MODIFIER_DEL_CHECK_INT(bpy_modifier) if (!(bpy_modifier->md)) return ( EXPP_ReturnIntError( PyExc_RuntimeError, "Modifier has been removed" ) )
-
-enum mod_constants {
- /*Apply to all modifiers*/
- EXPP_MOD_RENDER = 0,
- EXPP_MOD_REALTIME,
- EXPP_MOD_EDITMODE,
- EXPP_MOD_ONCAGE,
-
- /*GENERIC*/
- EXPP_MOD_OBJECT, /*ARMATURE, LATTICE, CURVE, BOOLEAN, ARRAY*/
- EXPP_MOD_VERTGROUP, /*ARMATURE, LATTICE, CURVE, SMOOTH, CAST*/
- EXPP_MOD_LIMIT, /*ARRAY, MIRROR*/
- EXPP_MOD_FLAG, /*MIRROR, WAVE*/
- EXPP_MOD_COUNT, /*DECIMATOR, ARRAY*/
- EXPP_MOD_LENGTH, /*BUILD, ARRAY*/
- EXPP_MOD_FACTOR, /*SMOOTH, CAST*/
- EXPP_MOD_ENABLE_X, /*SMOOTH, CAST*/
- EXPP_MOD_ENABLE_Y, /*SMOOTH, CAST*/
- EXPP_MOD_ENABLE_Z, /*SMOOTH, CAST*/
- EXPP_MOD_TYPES, /*SUBSURF, CAST*/
-
- /*SUBSURF SPECIFIC*/
- EXPP_MOD_LEVELS,
- EXPP_MOD_RENDLEVELS,
- EXPP_MOD_OPTIMAL,
- EXPP_MOD_UV,
-
- /*ARMATURE SPECIFIC*/
- EXPP_MOD_ENVELOPES,
-
- /*ARRAY SPECIFIC*/
- EXPP_MOD_OBJECT_OFFSET,
- EXPP_MOD_OBJECT_CURVE,
- EXPP_MOD_OFFSET_VEC,
- EXPP_MOD_SCALE_VEC,
- EXPP_MOD_MERGE_DIST,
-
- /*BUILD SPECIFIC*/
- EXPP_MOD_START,
- EXPP_MOD_SEED,
- EXPP_MOD_RANDOMIZE,
-
- /*MIRROR SPECIFIC*/
- EXPP_MOD_AXIS_X,
- EXPP_MOD_AXIS_Y,
- EXPP_MOD_AXIS_Z,
-
- /*DECIMATE SPECIFIC*/
- EXPP_MOD_RATIO,
-
- /*WAVE SPECIFIC*/
- EXPP_MOD_STARTX,
- EXPP_MOD_STARTY,
- EXPP_MOD_HEIGHT,
- EXPP_MOD_WIDTH,
- EXPP_MOD_NARROW,
- EXPP_MOD_SPEED,
- EXPP_MOD_DAMP,
- EXPP_MOD_LIFETIME,
- EXPP_MOD_TIMEOFFS,
-
- /*BOOLEAN SPECIFIC*/
- EXPP_MOD_OPERATION,
-
- /*EDGE SPLIT SPECIFIC */
- EXPP_MOD_EDGESPLIT_ANGLE,
- EXPP_MOD_EDGESPLIT_FROM_ANGLE,
- EXPP_MOD_EDGESPLIT_FROM_SHARP,
-
- /* DISPLACE */
- EXPP_MOD_UVLAYER,
- EXPP_MOD_MID_LEVEL,
- EXPP_MOD_STRENGTH,
- EXPP_MOD_TEXTURE,
- EXPP_MOD_MAPPING,
- EXPP_MOD_DIRECTION,
-
- /* SMOOTH */
- EXPP_MOD_REPEAT,
-
- /* CAST */
- EXPP_MOD_RADIUS,
- EXPP_MOD_SIZE,
- EXPP_MOD_USE_OB_TRANSFORM,
- EXPP_MOD_SIZE_FROM_RADIUS
-
- /* yet to be implemented */
- /* EXPP_MOD_HOOK_,*/
- /* , */
-};
-
-/*****************************************************************************/
-/* Python BPy_Modifier methods declarations: */
-/*****************************************************************************/
-static PyObject *Modifier_getName( BPy_Modifier * self );
-static int Modifier_setName( BPy_Modifier * self, PyObject *arg );
-static PyObject *Modifier_getType( BPy_Modifier * self );
-static PyObject *Modifier_reset( BPy_Modifier * self );
-
-static PyObject *Modifier_getData( BPy_Modifier * self, PyObject * key );
-static int Modifier_setData( BPy_Modifier * self, PyObject * key,
- PyObject * value );
-
-/*****************************************************************************/
-/* Python BPy_Modifier methods table: */
-/*****************************************************************************/
-static PyMethodDef BPy_Modifier_methods[] = {
- /* name, method, flags, doc */
- {"reset", (PyCFunction)Modifier_reset, METH_NOARGS,
- "resets a hook modifier location"},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Python BPy_Modifier attributes get/set structure: */
-/*****************************************************************************/
-static PyGetSetDef BPy_Modifier_getseters[] = {
- {"name",
- (getter)Modifier_getName, (setter)Modifier_setName,
- "Modifier name", NULL},
- {"type",
- (getter)Modifier_getType, (setter)NULL,
- "Modifier type (read only)", NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-/*****************************************************************************/
-/* Python Modifier_Type Mapping Methods table: */
-/*****************************************************************************/
-static PyMappingMethods Modifier_as_mapping = {
- NULL, /* mp_length */
- ( binaryfunc ) Modifier_getData, /* mp_subscript */
- ( objobjargproc ) Modifier_setData, /* mp_ass_subscript */
-};
-
-/*****************************************************************************/
-/* Python Modifier_Type callback function prototypes: */
-/*****************************************************************************/
-static PyObject *Modifier_repr( BPy_Modifier * self );
-
-/*****************************************************************************/
-/* Python Modifier_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject Modifier_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender Modifier", /* char *tp_name; */
- sizeof( BPy_Modifier ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL, /* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- NULL, /* cmpfunc tp_compare; */
- ( reprfunc ) Modifier_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- &Modifier_as_mapping, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- NULL, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
- 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, /* 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, /* 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 ***/
- BPy_Modifier_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_Modifier_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-/*****************************************************************************/
-/* Python BPy_Modifier methods: */
-/*****************************************************************************/
-
-/*
- * return the name of this modifier
- */
-
-static PyObject *Modifier_getName( BPy_Modifier * self )
-{
- MODIFIER_DEL_CHECK_PY(self);
- return PyString_FromString( self->md->name );
-}
-
-/*
- * set the name of this modifier
- */
-
-static int Modifier_setName( BPy_Modifier * self, PyObject * attr )
-{
- char *name = PyString_AsString( attr );
- if( !name )
- return EXPP_ReturnIntError( PyExc_TypeError, "expected string arg" );
-
- MODIFIER_DEL_CHECK_INT(self);
-
- BLI_strncpy( self->md->name, name, sizeof( self->md->name ) );
-
- return 0;
-}
-
-/*
- * return the type of this modifier
- */
-
-static PyObject *Modifier_getType( BPy_Modifier * self )
-{
- MODIFIER_DEL_CHECK_PY(self);
-
- return PyInt_FromLong( self->md->type );
-}
-
-static PyObject *subsurf_getter( BPy_Modifier * self, int type )
-{
- SubsurfModifierData *md = ( SubsurfModifierData *)(self->md);
-
- switch( type ) {
- case EXPP_MOD_TYPES:
- return PyInt_FromLong( ( long )md->subdivType );
- case EXPP_MOD_LEVELS:
- return PyInt_FromLong( ( long )md->levels );
- case EXPP_MOD_RENDLEVELS:
- return PyInt_FromLong( ( long )md->renderLevels );
- case EXPP_MOD_OPTIMAL:
- return PyBool_FromLong( ( long )
- ( md->flags & eSubsurfModifierFlag_ControlEdges ) ) ;
- case EXPP_MOD_UV:
- return PyBool_FromLong( ( long )
- ( md->flags & eSubsurfModifierFlag_SubsurfUv ) ) ;
- default:
- return EXPP_ReturnPyObjError( PyExc_KeyError,
- "key not found" );
- }
-}
-
-static int subsurf_setter( BPy_Modifier * self, int type,
- PyObject *value )
-{
- SubsurfModifierData *md = (SubsurfModifierData *)(self->md);
-
- switch( type ) {
- case EXPP_MOD_TYPES:
- return EXPP_setIValueRange( value, &md->subdivType, 0, 1, 'h' );
- case EXPP_MOD_LEVELS:
- return EXPP_setIValueClamped( value, &md->levels, 1, 6, 'h' );
- case EXPP_MOD_RENDLEVELS:
- return EXPP_setIValueClamped( value, &md->renderLevels, 1, 6, 'h' );
- case EXPP_MOD_OPTIMAL:
- return EXPP_setBitfield( value, &md->flags,
- eSubsurfModifierFlag_ControlEdges, 'h' );
- case EXPP_MOD_UV:
- return EXPP_setBitfield( value, &md->flags,
- eSubsurfModifierFlag_SubsurfUv, 'h' );
- default:
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
- }
-}
-
-static PyObject *armature_getter( BPy_Modifier * self, int type )
-{
- ArmatureModifierData *md = (ArmatureModifierData *)(self->md);
-
- switch( type ) {
- case EXPP_MOD_OBJECT:
- return Object_CreatePyObject( md->object );
- case EXPP_MOD_VERTGROUP:
- return PyBool_FromLong( ( long )( md->deformflag & 1 ) ) ;
- case EXPP_MOD_ENVELOPES:
- return PyBool_FromLong( ( long )( md->deformflag & 2 ) ) ;
- default:
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
- }
-}
-
-static int armature_setter( BPy_Modifier *self, int type, PyObject *value )
-{
- ArmatureModifierData *md = (ArmatureModifierData *)(self->md);
-
- switch( type ) {
- case EXPP_MOD_OBJECT:
- return GenericLib_assignData(value, (void **) &md->object, 0, 0, ID_OB, OB_ARMATURE);
- case EXPP_MOD_VERTGROUP:
- return EXPP_setBitfield( value, &md->deformflag, 1, 'h' );
- case EXPP_MOD_ENVELOPES:
- return EXPP_setBitfield( value, &md->deformflag, 2, 'h' );
- default:
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
- }
-}
-
-static PyObject *lattice_getter( BPy_Modifier * self, int type )
-{
- LatticeModifierData *md = (LatticeModifierData *)(self->md);
-
- switch( type ) {
- case EXPP_MOD_OBJECT:
- return Object_CreatePyObject( md->object );
- case EXPP_MOD_VERTGROUP:
- return PyString_FromString( md->name ) ;
- default:
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
- }
-}
-
-static int lattice_setter( BPy_Modifier *self, int type, PyObject *value )
-{
- LatticeModifierData *md = (LatticeModifierData *)(self->md);
-
- switch( type ) {
- case EXPP_MOD_OBJECT:
- return GenericLib_assignData(value, (void **) &md->object, (void **) &self->object, 0, ID_OB, OB_LATTICE);
- case EXPP_MOD_VERTGROUP: {
- char *name = PyString_AsString( value );
- if( !name )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected string arg" );
- BLI_strncpy( md->name, name, sizeof( md->name ) );
- break;
- }
- default:
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
- }
- return 0;
-}
-
-static PyObject *curve_getter( BPy_Modifier * self, int type )
-{
- CurveModifierData *md = (CurveModifierData *)(self->md);
-
- switch( type ) {
- case EXPP_MOD_OBJECT:
- return Object_CreatePyObject( md->object );
- case EXPP_MOD_VERTGROUP:
- return PyString_FromString( md->name ) ;
- default:
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
- }
-}
-
-static int curve_setter( BPy_Modifier *self, int type, PyObject *value )
-{
- CurveModifierData *md = (CurveModifierData *)(self->md);
-
- switch( type ) {
- case EXPP_MOD_OBJECT:
- return GenericLib_assignData(value, (void **) &md->object, (void **) &self->object, 0, ID_OB, OB_CURVE);
- case EXPP_MOD_VERTGROUP: {
- char *name = PyString_AsString( value );
- if( !name )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected string arg" );
- BLI_strncpy( md->name, name, sizeof( md->name ) );
- break;
- }
- default:
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
- }
- return 0;
-}
-
-static PyObject *build_getter( BPy_Modifier * self, int type )
-{
- BuildModifierData *md = (BuildModifierData *)(self->md);
-
- switch( type ) {
- case EXPP_MOD_START:
- return PyFloat_FromDouble( ( float )md->start );
- case EXPP_MOD_LENGTH:
- return PyFloat_FromDouble( ( float )md->length );
- case EXPP_MOD_SEED:
- return PyInt_FromLong( ( long )md->seed );
- case EXPP_MOD_RANDOMIZE:
- return PyBool_FromLong( ( long )md->randomize ) ;
- default:
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
- }
-}
-
-static int build_setter( BPy_Modifier *self, int type, PyObject *value )
-{
- BuildModifierData *md = (BuildModifierData *)(self->md);
-
- switch( type ) {
- case EXPP_MOD_START:
- return EXPP_setFloatClamped( value, &md->start, 1.0, MAXFRAMEF );
- case EXPP_MOD_LENGTH:
- return EXPP_setFloatClamped( value, &md->length, 1.0, MAXFRAMEF );
- case EXPP_MOD_SEED:
- return EXPP_setIValueClamped( value, &md->seed, 1, MAXFRAME, 'i' );
- case EXPP_MOD_RANDOMIZE:
- return EXPP_setBitfield( value, &md->randomize, 1, 'i' );
- default:
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
- }
-}
-
-static PyObject *mirror_getter( BPy_Modifier * self, int type )
-{
- MirrorModifierData *md = (MirrorModifierData *)(self->md);
-
- switch( type ) {
- case EXPP_MOD_LIMIT:
- return PyFloat_FromDouble( (double)md->tolerance );
- case EXPP_MOD_FLAG:
- return PyBool_FromLong( (long)( md->flag & MOD_MIR_CLIPPING ) ) ;
- case EXPP_MOD_AXIS_X:
- return PyBool_FromLong( ( long )
- ( md->flag & MOD_MIR_AXIS_X ) ) ;
- case EXPP_MOD_AXIS_Y:
- return PyBool_FromLong( ( long )
- ( md->flag & MOD_MIR_AXIS_Y ) ) ;
- case EXPP_MOD_AXIS_Z:
- return PyBool_FromLong( ( long )
- ( md->flag & MOD_MIR_AXIS_Z ) ) ;
- default:
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
- }
-}
-
-static int mirror_setter( BPy_Modifier *self, int type, PyObject *value )
-{
- MirrorModifierData *md = (MirrorModifierData *)(self->md);
-
- switch( type ) {
- case EXPP_MOD_LIMIT:
- return EXPP_setFloatClamped( value, &md->tolerance, 0.0, 1.0 );
- case EXPP_MOD_FLAG:
- return EXPP_setBitfield( value, &md->flag, MOD_MIR_CLIPPING, 'i' );
- case EXPP_MOD_AXIS_X:
- return EXPP_setBitfield( value, &md->flag, MOD_MIR_AXIS_X, 'h' );
- case EXPP_MOD_AXIS_Y:
- return EXPP_setBitfield( value, &md->flag, MOD_MIR_AXIS_Y, 'h' );
- case EXPP_MOD_AXIS_Z:
- return EXPP_setBitfield( value, &md->flag, MOD_MIR_AXIS_Z, 'h' );
- default:
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
- }
-}
-
-static PyObject *decimate_getter( BPy_Modifier * self, int type )
-{
- DecimateModifierData *md = (DecimateModifierData *)(self->md);
-
- if( type == EXPP_MOD_RATIO )
- return PyFloat_FromDouble( (double)md->percent );
- else if( type == EXPP_MOD_COUNT )
- return PyInt_FromLong( (long)md->faceCount );
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
-}
-
-static int decimate_setter( BPy_Modifier *self, int type, PyObject *value )
-{
- DecimateModifierData *md = (DecimateModifierData *)(self->md);
-
- if( type == EXPP_MOD_RATIO )
- return EXPP_setFloatClamped( value, &md->percent, 0.0, 1.0 );
- else if( type == EXPP_MOD_COUNT )
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "value is read-only" );
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
-}
-
-static PyObject *smooth_getter( BPy_Modifier * self, int type )
-{
- SmoothModifierData *md = (SmoothModifierData *)(self->md);
-
- switch( type ) {
- case EXPP_MOD_FACTOR:
- return PyFloat_FromDouble( (double)md->fac );
- case EXPP_MOD_REPEAT:
- return PyInt_FromLong( (long)md->repeat );
- case EXPP_MOD_VERTGROUP:
- return PyString_FromString( md->defgrp_name ) ;
- case EXPP_MOD_ENABLE_X:
- return EXPP_getBitfield( &md->flag, MOD_SMOOTH_X, 'h' );
- case EXPP_MOD_ENABLE_Y:
- return EXPP_getBitfield( &md->flag, MOD_SMOOTH_Y, 'h' );
- case EXPP_MOD_ENABLE_Z:
- return EXPP_getBitfield( &md->flag, MOD_SMOOTH_Z, 'h' );
- default:
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
- }
-}
-
-static int smooth_setter( BPy_Modifier *self, int type, PyObject *value )
-{
- SmoothModifierData *md = (SmoothModifierData *)(self->md);
-
- switch( type ) {
- case EXPP_MOD_FACTOR:
- return EXPP_setFloatClamped( value, &md->fac, -10.0, 10.0 );
- case EXPP_MOD_REPEAT:
- return EXPP_setIValueRange( value, &md->repeat, 0, 30, 'h' );
- case EXPP_MOD_VERTGROUP: {
- char *name = PyString_AsString( value );
- if( !name ) return EXPP_ReturnIntError( PyExc_TypeError, "expected string arg" );
- BLI_strncpy( md->defgrp_name, name, sizeof( md->defgrp_name ) );
- return 0;
- }
- case EXPP_MOD_ENABLE_X:
- return EXPP_setBitfield( value, &md->flag, MOD_SMOOTH_X, 'h' );
- case EXPP_MOD_ENABLE_Y:
- return EXPP_setBitfield( value, &md->flag, MOD_SMOOTH_Y, 'h' );
- case EXPP_MOD_ENABLE_Z:
- return EXPP_setBitfield( value, &md->flag, MOD_SMOOTH_Z, 'h' );
- default:
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
- }
-}
-
-static PyObject *cast_getter( BPy_Modifier * self, int type )
-{
- CastModifierData *md = (CastModifierData *)(self->md);
-
- switch( type ) {
- case EXPP_MOD_TYPES:
- return PyInt_FromLong( (long)md->type );
- case EXPP_MOD_FACTOR:
- return PyFloat_FromDouble( (double)md->fac );
- case EXPP_MOD_RADIUS:
- return PyFloat_FromDouble( (double)md->radius );
- case EXPP_MOD_SIZE:
- return PyFloat_FromDouble( (double)md->size );
- case EXPP_MOD_OBJECT:
- return Object_CreatePyObject( md->object );
- case EXPP_MOD_VERTGROUP:
- return PyString_FromString( md->defgrp_name ) ;
- case EXPP_MOD_ENABLE_X:
- return EXPP_getBitfield( &md->flag, MOD_CAST_X, 'h' );
- case EXPP_MOD_ENABLE_Y:
- return EXPP_getBitfield( &md->flag, MOD_CAST_Y, 'h' );
- case EXPP_MOD_ENABLE_Z:
- return EXPP_getBitfield( &md->flag, MOD_CAST_Z, 'h' );
- case EXPP_MOD_USE_OB_TRANSFORM:
- return EXPP_getBitfield( &md->flag, MOD_CAST_USE_OB_TRANSFORM, 'h' );
- case EXPP_MOD_SIZE_FROM_RADIUS:
- return EXPP_getBitfield( &md->flag, MOD_CAST_SIZE_FROM_RADIUS, 'h' );
- default:
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
- }
-}
-
-static int cast_setter( BPy_Modifier *self, int type, PyObject *value )
-{
- CastModifierData *md = (CastModifierData *)(self->md);
-
- switch( type ) {
- case EXPP_MOD_TYPES:
- return EXPP_setIValueRange( value, &md->type, 0, MOD_CAST_TYPE_CUBOID, 'h' );
- case EXPP_MOD_FACTOR:
- return EXPP_setFloatClamped( value, &md->fac, -10.0, 10.0 );
- case EXPP_MOD_RADIUS:
- return EXPP_setFloatClamped( value, &md->radius, 0.0, 100.0 );
- case EXPP_MOD_SIZE:
- return EXPP_setFloatClamped( value, &md->size, 0.0, 100.0 );
- case EXPP_MOD_OBJECT: {
- Object *ob_new=NULL;
- if (value == Py_None) {
- md->object = NULL;
- } else if (BPy_Object_Check( value )) {
- ob_new = ((( BPy_Object * )value)->object);
- md->object = ob_new;
- } else {
- return EXPP_ReturnIntError( PyExc_TypeError,
- "Expected an Object or None value" );
- }
- return 0;
- }
- case EXPP_MOD_VERTGROUP: {
- char *name = PyString_AsString( value );
- if( !name ) return EXPP_ReturnIntError( PyExc_TypeError, "expected string arg" );
- BLI_strncpy( md->defgrp_name, name, sizeof( md->defgrp_name ) );
- return 0;
- }
- case EXPP_MOD_ENABLE_X:
- return EXPP_setBitfield( value, &md->flag, MOD_CAST_X, 'h' );
- case EXPP_MOD_ENABLE_Y:
- return EXPP_setBitfield( value, &md->flag, MOD_CAST_Y, 'h' );
- case EXPP_MOD_ENABLE_Z:
- return EXPP_setBitfield( value, &md->flag, MOD_CAST_Z, 'h' );
- case EXPP_MOD_USE_OB_TRANSFORM:
- return EXPP_setBitfield( value, &md->flag, MOD_CAST_USE_OB_TRANSFORM, 'h' );
- case EXPP_MOD_SIZE_FROM_RADIUS:
- return EXPP_setBitfield( value, &md->flag, MOD_CAST_SIZE_FROM_RADIUS, 'h' );
- default:
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
- }
-}
-
-static PyObject *wave_getter( BPy_Modifier * self, int type )
-{
- WaveModifierData *md = (WaveModifierData *)(self->md);
-
- switch( type ) {
- case EXPP_MOD_STARTX:
- return PyFloat_FromDouble( (double)md->startx );
- case EXPP_MOD_STARTY:
- return PyFloat_FromDouble( (double)md->starty );
- case EXPP_MOD_HEIGHT:
- return PyFloat_FromDouble( (double)md->height );
- case EXPP_MOD_WIDTH:
- return PyFloat_FromDouble( (double)md->width );
- case EXPP_MOD_NARROW:
- return PyFloat_FromDouble( (double)md->narrow );
- case EXPP_MOD_SPEED:
- return PyFloat_FromDouble( (double)md->speed );
- case EXPP_MOD_DAMP:
- return PyFloat_FromDouble( (double)md->damp );
- case EXPP_MOD_LIFETIME:
- return PyFloat_FromDouble( (double)md->lifetime );
- case EXPP_MOD_TIMEOFFS:
- return PyFloat_FromDouble( (double)md->timeoffs );
- case EXPP_MOD_FLAG:
- return PyInt_FromLong( (long)md->flag );
- default:
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
- }
-}
-
-static int wave_setter( BPy_Modifier *self, int type, PyObject *value )
-{
- WaveModifierData *md = (WaveModifierData *)(self->md);
-
- switch( type ) {
- case EXPP_MOD_STARTX:
- return EXPP_setFloatClamped( value, &md->startx, -100.0, 100.0 );
- case EXPP_MOD_STARTY:
- return EXPP_setFloatClamped( value, &md->starty, -100.0, 100.0 );
- case EXPP_MOD_HEIGHT:
- return EXPP_setFloatClamped( value, &md->height, -2.0, 2.0 );
- case EXPP_MOD_WIDTH:
- return EXPP_setFloatClamped( value, &md->width, 0.0, 5.0 );
- case EXPP_MOD_NARROW:
- return EXPP_setFloatClamped( value, &md->width, 0.0, 5.0 );
- case EXPP_MOD_SPEED:
- return EXPP_setFloatClamped( value, &md->speed, -2.0, 2.0 );
- case EXPP_MOD_DAMP:
- return EXPP_setFloatClamped( value, &md->damp, -MAXFRAMEF, MAXFRAMEF );
- case EXPP_MOD_LIFETIME:
- return EXPP_setFloatClamped( value, &md->lifetime, -MAXFRAMEF, MAXFRAMEF );
- case EXPP_MOD_TIMEOFFS:
- return EXPP_setFloatClamped( value, &md->timeoffs, -MAXFRAMEF, MAXFRAMEF );
- case EXPP_MOD_FLAG:
- return EXPP_setIValueRange( value, &md->flag, 0,
- MOD_WAVE_X | MOD_WAVE_Y | MOD_WAVE_CYCL, 'h' );
- default:
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
- }
-}
-
-static PyObject *array_getter( BPy_Modifier * self, int type )
-{
- ArrayModifierData *md = (ArrayModifierData *)(self->md);
-
- if( type == EXPP_MOD_OBJECT_OFFSET )
- return Object_CreatePyObject( md->offset_ob );
- else if( type == EXPP_MOD_OBJECT_CURVE )
- return Object_CreatePyObject( md->curve_ob );
- else if( type == EXPP_MOD_COUNT )
- return PyInt_FromLong( (long)md->count );
- else if( type == EXPP_MOD_LENGTH )
- return PyFloat_FromDouble( md->length );
- else if( type == EXPP_MOD_MERGE_DIST )
- return PyFloat_FromDouble( md->merge_dist );
- else if( type == EXPP_MOD_OFFSET_VEC)
- return newVectorObject( md->offset, 3, Py_NEW );
- else if( type == EXPP_MOD_SCALE_VEC)
- return newVectorObject( md->scale, 3, Py_NEW );
-
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
-}
-
-static int array_setter( BPy_Modifier *self, int type, PyObject *value )
-{
- ArrayModifierData *md = (ArrayModifierData *)(self->md);
- switch( type ) {
- case EXPP_MOD_OBJECT_OFFSET:
- return GenericLib_assignData(value, (void **) &md->offset_ob, (void **) &self->object, 0, ID_OB, 0);
- case EXPP_MOD_OBJECT_CURVE:
- return GenericLib_assignData(value, (void **) &md->curve_ob, 0, 0, ID_OB, OB_CURVE);
- case EXPP_MOD_COUNT:
- return EXPP_setIValueClamped( value, &md->count, 1, 1000, 'i' );
- case EXPP_MOD_LENGTH:
- return EXPP_setFloatClamped( value, &md->length, 0.0, 1000.0 );
- case EXPP_MOD_MERGE_DIST:
- return EXPP_setFloatClamped( value, &md->merge_dist, 0.0, 1000.0 );
- case EXPP_MOD_OFFSET_VEC:
- return EXPP_setVec3Clamped( value, md->offset, -10000.0, 10000.0 );
- case EXPP_MOD_SCALE_VEC:
- return EXPP_setVec3Clamped( value, md->scale, -10000.0, 10000.0 );
- default:
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
- }
-}
-
-static PyObject *boolean_getter( BPy_Modifier * self, int type )
-{
- BooleanModifierData *md = (BooleanModifierData *)(self->md);
-
- if( type == EXPP_MOD_OBJECT )
- return Object_CreatePyObject( md->object );
- else if( type == EXPP_MOD_OPERATION )
- return PyInt_FromLong( ( long )md->operation ) ;
-
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
-}
-
-static int boolean_setter( BPy_Modifier *self, int type, PyObject *value )
-{
- BooleanModifierData *md = (BooleanModifierData *)(self->md);
-
- if( type == EXPP_MOD_OBJECT )
- return GenericLib_assignData(value, (void **) &md->object, (void **) &self->object, 0, ID_OB, OB_MESH);
- else if( type == EXPP_MOD_OPERATION )
- return EXPP_setIValueRange( value, &md->operation,
- eBooleanModifierOp_Intersect, eBooleanModifierOp_Difference,
- 'h' );
-
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
-}
-
-
-static PyObject *edgesplit_getter( BPy_Modifier * self, int type )
-{
- EdgeSplitModifierData *md = (EdgeSplitModifierData *)(self->md);
-
- switch( type ) {
- case EXPP_MOD_EDGESPLIT_ANGLE:
- return PyFloat_FromDouble( (double)md->split_angle );
- case EXPP_MOD_EDGESPLIT_FROM_ANGLE:
- return PyBool_FromLong( ( long )
- ( md->flags & MOD_EDGESPLIT_FROMANGLE ) ) ;
- case EXPP_MOD_EDGESPLIT_FROM_SHARP:
- return PyBool_FromLong( ( long )
- ( md->flags & MOD_EDGESPLIT_FROMFLAG ) ) ;
-
- default:
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
- }
-}
-
-static int edgesplit_setter( BPy_Modifier *self, int type, PyObject *value )
-{
- EdgeSplitModifierData *md = (EdgeSplitModifierData *)(self->md);
-
- switch( type ) {
- case EXPP_MOD_EDGESPLIT_ANGLE:
- return EXPP_setFloatClamped( value, &md->split_angle, 0.0, 180.0 );
- case EXPP_MOD_EDGESPLIT_FROM_ANGLE:
- return EXPP_setBitfield( value, &md->flags,
- MOD_EDGESPLIT_FROMANGLE, 'h' );
- case EXPP_MOD_EDGESPLIT_FROM_SHARP:
- return EXPP_setBitfield( value, &md->flags,
- MOD_EDGESPLIT_FROMFLAG, 'h' );
-
- default:
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
- }
-}
-
-static PyObject *displace_getter( BPy_Modifier * self, int type )
-{
- DisplaceModifierData *md = (DisplaceModifierData *)(self->md);
-
- switch( type ) {
- case EXPP_MOD_TEXTURE:
- if (md->texture) Texture_CreatePyObject( md->texture );
- else Py_RETURN_NONE;
- case EXPP_MOD_STRENGTH:
- return PyFloat_FromDouble( (double)md->strength );
- case EXPP_MOD_DIRECTION:
- PyInt_FromLong( md->direction );
- case EXPP_MOD_VERTGROUP:
- return PyString_FromString( md->defgrp_name ) ;
- case EXPP_MOD_MID_LEVEL:
- return PyFloat_FromDouble( (double)md->midlevel );
- case EXPP_MOD_MAPPING:
- PyInt_FromLong( md->texmapping );
- case EXPP_MOD_OBJECT:
- return Object_CreatePyObject( md->map_object );
- case EXPP_MOD_UVLAYER:
- return PyString_FromString( md->uvlayer_name );
- default:
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
- }
-}
-
-static int displace_setter( BPy_Modifier *self, int type, PyObject *value )
-{
- DisplaceModifierData *md = (DisplaceModifierData *)(self->md);
-
- switch( type ) {
- case EXPP_MOD_TEXTURE:
- return GenericLib_assignData(value, (void **) &md->texture, 0, 1, ID_TE, 0);
- case EXPP_MOD_STRENGTH:
- return EXPP_setFloatClamped( value, &md->strength, -1000.0, 1000.0 );
-
- case EXPP_MOD_DIRECTION:
- return EXPP_setIValueClamped( value, &md->direction,
- MOD_DISP_DIR_X, MOD_DISP_DIR_RGB_XYZ, 'i' );
-
- case EXPP_MOD_VERTGROUP: {
- char *name = PyString_AsString( value );
- if( !name ) return EXPP_ReturnIntError( PyExc_TypeError, "expected string arg" );
- BLI_strncpy( md->defgrp_name, name, sizeof( md->defgrp_name ) );
- return 0;
- }
- case EXPP_MOD_MID_LEVEL:
- return EXPP_setFloatClamped( value, &md->midlevel, 0.0, 1.0 );
-
- case EXPP_MOD_MAPPING:
- return EXPP_setIValueClamped( value, &md->texmapping,
- MOD_DISP_MAP_LOCAL, MOD_DISP_MAP_UV, 'i' );
-
- case EXPP_MOD_OBJECT: {
- Object *ob_new=NULL;
- if (value == Py_None) {
- md->map_object = NULL;
- } else if (BPy_Object_Check( value )) {
- ob_new = ((( BPy_Object * )value)->object);
- md->map_object = ob_new;
- } else {
- return EXPP_ReturnIntError( PyExc_TypeError,
- "Expected an Object or None value" );
- }
- return 0;
- }
-
- case EXPP_MOD_UVLAYER: {
- char *name = PyString_AsString( value );
- if( !name ) return EXPP_ReturnIntError( PyExc_TypeError, "expected string arg" );
- BLI_strncpy( md->uvlayer_name, name, sizeof( md->uvlayer_name ) );
- return 0;
- }
- default:
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
- }
-}
-
-
-/* static PyObject *uvproject_getter( BPy_Modifier * self, int type )
-{
- DisplaceModifierData *md = (DisplaceModifierData *)(self->md);
-
- switch( type ) {
- case EXPP_MOD_MID_LEVEL:
- return PyFloat_FromDouble( (double)md->midlevel );
- default:
- return EXPP_ReturnPyObjError( PyExc_KeyError, "key not found" );
- }
-}
-
-static int uvproject_setter( BPy_Modifier *self, int type, PyObject *value )
-{
- DisplaceModifierData *md = (DisplaceModifierData *)(self->md);
-
- switch( type ) {
- case EXPP_MOD_TEXTURE:
- return 0;
- default:
- return EXPP_ReturnIntError( PyExc_KeyError, "key not found" );
- }
-} */
-
-
-/*
- * get data from a modifier
- */
-
-static PyObject *Modifier_getData( BPy_Modifier * self, PyObject * key )
-{
- int setting;
-
- if( !PyInt_Check( key ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected an int arg as stored in Blender.Modifier.Settings" );
-
- MODIFIER_DEL_CHECK_PY(self);
-
- setting = PyInt_AsLong( key );
- switch( setting ) {
- case EXPP_MOD_RENDER:
- return EXPP_getBitfield( &self->md->mode, eModifierMode_Render, 'h' );
- case EXPP_MOD_REALTIME:
- return EXPP_getBitfield( &self->md->mode, eModifierMode_Realtime, 'h' );
- case EXPP_MOD_EDITMODE:
- return EXPP_getBitfield( &self->md->mode, eModifierMode_Editmode, 'h' );
- case EXPP_MOD_ONCAGE:
- return EXPP_getBitfield( &self->md->mode, eModifierMode_OnCage, 'h' );
- default:
- switch( self->md->type ) {
- case eModifierType_Subsurf:
- return subsurf_getter( self, setting );
- case eModifierType_Armature:
- return armature_getter( self, setting );
- case eModifierType_Lattice:
- return lattice_getter( self, setting );
- case eModifierType_Curve:
- return curve_getter( self, setting );
- case eModifierType_Build:
- return build_getter( self, setting );
- case eModifierType_Mirror:
- return mirror_getter( self, setting );
- case eModifierType_Decimate:
- return decimate_getter( self, setting );
- case eModifierType_Smooth:
- return smooth_getter( self, setting );
- case eModifierType_Cast:
- return cast_getter( self, setting );
- case eModifierType_Wave:
- return wave_getter( self, setting );
- case eModifierType_Boolean:
- return boolean_getter( self, setting );
- case eModifierType_Array:
- return array_getter( self, setting );
- case eModifierType_EdgeSplit:
- return edgesplit_getter( self, setting );
- case eModifierType_Displace:
- return displace_getter( self, setting );
- /*case eModifierType_UVProject:
- return uvproject_getter( self, setting );*/
- case eModifierType_Hook:
- case eModifierType_Softbody:
- case eModifierType_None:
- Py_RETURN_NONE;
- }
- }
- return EXPP_ReturnPyObjError( PyExc_KeyError,
- "unknown key or modifier type" );
-}
-
-static int Modifier_setData( BPy_Modifier * self, PyObject * key,
- PyObject * arg )
-{
- int key_int;
-
- if( !PyNumber_Check( key ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected an int arg as stored in Blender.Modifier.Settings" );
-
- MODIFIER_DEL_CHECK_INT(self);
-
- key_int = PyInt_AsLong( key );
-
- /* Chach for standard modifier settings */
- switch( key_int ) {
- case EXPP_MOD_RENDER:
- return EXPP_setBitfield( arg, &self->md->mode,
- eModifierMode_Render, 'h' );
- case EXPP_MOD_REALTIME:
- return EXPP_setBitfield( arg, &self->md->mode,
- eModifierMode_Realtime, 'h' );
- case EXPP_MOD_EDITMODE:
- return EXPP_setBitfield( arg, &self->md->mode,
- eModifierMode_Editmode, 'h' );
- case EXPP_MOD_ONCAGE:
- return EXPP_setBitfield( arg, &self->md->mode,
- eModifierMode_OnCage, 'h' );
- }
-
- switch( self->md->type ) {
- case eModifierType_Subsurf:
- return subsurf_setter( self, key_int, arg );
- case eModifierType_Armature:
- return armature_setter( self, key_int, arg );
- case eModifierType_Lattice:
- return lattice_setter( self, key_int, arg );
- case eModifierType_Curve:
- return curve_setter( self, key_int, arg );
- case eModifierType_Build:
- return build_setter( self, key_int, arg );
- case eModifierType_Mirror:
- return mirror_setter( self, key_int, arg );
- case eModifierType_Array:
- return array_setter( self, key_int, arg );
- case eModifierType_Decimate:
- return decimate_setter( self, key_int, arg );
- case eModifierType_Smooth:
- return smooth_setter( self, key_int, arg );
- case eModifierType_Cast:
- return cast_setter( self, key_int, arg );
- case eModifierType_Wave:
- return wave_setter( self, key_int, arg );
- case eModifierType_Boolean:
- return boolean_setter( self, key_int, arg );
- case eModifierType_EdgeSplit:
- return edgesplit_setter( self, key_int, arg );
- case eModifierType_Displace:
- return displace_setter( self, key_int, arg );
- /*case eModifierType_UVProject:
- return uvproject_setter( self, key_int, arg );*/
- case eModifierType_Hook:
- case eModifierType_Softbody:
- case eModifierType_None:
- return 0;
- }
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "unsupported modifier setting" );
-}
-
-
-static PyObject *Modifier_reset( BPy_Modifier * self )
-{
- Object *ob = self->object;
- ModifierData *md = self->md;
- HookModifierData *hmd = (HookModifierData*) md;
-
- MODIFIER_DEL_CHECK_PY(self);
-
- if (md->type != eModifierType_Hook)
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "can only reset hooks" );
-
- if (hmd->object) {
- Mat4Invert(hmd->object->imat, hmd->object->obmat);
- Mat4MulSerie(hmd->parentinv, hmd->object->imat, ob->obmat, NULL, NULL, NULL, NULL, NULL, NULL);
- }
- Py_RETURN_NONE;
-}
-
-/*****************************************************************************/
-/* Function: Modifier_repr */
-/* Description: This is a callback function for the BPy_Modifier type. It */
-/* builds a meaningful string to represent modifier objects. */
-/*****************************************************************************/
-static PyObject *Modifier_repr( BPy_Modifier * self )
-{
- ModifierTypeInfo *mti;
- if (self->md==NULL)
- return PyString_FromString( "[Modifier - Removed");
-
- mti= modifierType_getInfo(self->md->type);
- return PyString_FromFormat( "[Modifier \"%s\", Type \"%s\"]", self->md->name, mti->name );
-}
-
-/* Three Python Modifier_Type helper functions needed by the Object module: */
-
-/*****************************************************************************/
-/* Function: Modifier_CreatePyObject */
-/* Description: This function will create a new BPy_Modifier from an */
-/* existing Blender modifier structure. */
-/*****************************************************************************/
-PyObject *Modifier_CreatePyObject( Object *ob, ModifierData * md )
-{
- BPy_Modifier *pymod;
- pymod = ( BPy_Modifier * ) PyObject_NEW( BPy_Modifier, &Modifier_Type );
- if( !pymod )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create BPy_Modifier object" );
- pymod->md = md;
- pymod->object = ob;
- return ( PyObject * ) pymod;
-}
-
-/*****************************************************************************/
-/* Function: Modifier_FromPyObject */
-/* Description: This function returns the Blender modifier from the given */
-/* PyObject. */
-/*****************************************************************************/
-ModifierData *Modifier_FromPyObject( PyObject * pyobj )
-{
- return ( ( BPy_Modifier * ) pyobj )->md;
-}
-
-/*****************************************************************************/
-/* Modifier Sequence wrapper */
-/*****************************************************************************/
-
-/*
- * Initialize the interator
- */
-
-static PyObject *ModSeq_getIter( BPy_ModSeq * self )
-{
- if (!self->iter) {
- self->iter = (ModifierData *)self->object->modifiers.first;
- return EXPP_incr_ret ( (PyObject *) self );
- } else {
- return ModSeq_CreatePyObject(self->object, (ModifierData *)self->object->modifiers.first);
- }
-}
-
-/*
- * Get the next Modifier
- */
-
-static PyObject *ModSeq_nextIter( BPy_ModSeq * self )
-{
- ModifierData *iter = self->iter;
- if( iter ) {
- self->iter = iter->next;
- return Modifier_CreatePyObject( self->object, iter );
- }
-
- self->iter= NULL; /* mark as not iterating */
- return EXPP_ReturnPyObjError( PyExc_StopIteration,
- "iterator at end" );
-}
-
-/* return the number of modifiers */
-
-static int ModSeq_length( BPy_ModSeq * self )
-{
- return BLI_countlist( &self->object->modifiers );
-}
-
-/* return a modifier */
-
-static PyObject *ModSeq_item( BPy_ModSeq * self, int i )
-{
- ModifierData *md = NULL;
-
- /* if index is negative, start counting from the end of the list */
- if( i < 0 )
- i += ModSeq_length( self );
-
- /* skip through the list until we get the modifier or end of list */
-
- for( md = self->object->modifiers.first; i && md; --i ) md = md->next;
-
- if( md )
- return Modifier_CreatePyObject( self->object, md );
- else
- return EXPP_ReturnPyObjError( PyExc_IndexError,
- "array index out of range" );
-}
-
-/*****************************************************************************/
-/* Python BPy_ModSeq sequence table: */
-/*****************************************************************************/
-static PySequenceMethods ModSeq_as_sequence = {
- ( inquiry ) ModSeq_length, /* sq_length */
- ( binaryfunc ) 0, /* sq_concat */
- ( intargfunc ) 0, /* sq_repeat */
- ( intargfunc ) ModSeq_item, /* sq_item */
- ( intintargfunc ) 0, /* sq_slice */
- ( intobjargproc ) 0, /* sq_ass_item */
- ( intintobjargproc ) 0, /* sq_ass_slice */
- ( objobjproc ) 0, /* sq_contains */
- ( binaryfunc ) 0, /* sq_inplace_concat */
- ( intargfunc ) 0, /* sq_inplace_repeat */
-};
-
-/*
- * helper function to check for a valid modifier argument
- */
-
-static ModifierData *locate_modifier( BPy_ModSeq *self, BPy_Modifier * value )
-{
- ModifierData *md;
-
- /* check that argument is a modifier */
- if( !BPy_Modifier_Check(value) )
- return (ModifierData *)EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected an modifier as an argument" );
-
- /* check whether modifier has been removed */
- if( !value->md )
- return (ModifierData *)EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This modifier has been removed!" );
-
- /* find the modifier in the object's list */
- for( md = self->object->modifiers.first; md; md = md->next )
- if( md == value->md )
- return md;
-
- /* return exception if we can't find the modifier */
- return (ModifierData *)EXPP_ReturnPyObjError( PyExc_AttributeError,
- "This modifier is not in the object's stack" );
-}
-
-/* create a new modifier at the end of the list */
-
-static PyObject *ModSeq_append( BPy_ModSeq *self, PyObject *value )
-{
- int type = PyInt_AsLong(value);
-
- /* type 0 is eModifierType_None, should we be able to add one of these? */
- if( type <= 0 || type >= NUM_MODIFIER_TYPES )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "Not an int or argument out of range, expected an int from Blender.Modifier.Type" );
-
- BLI_addtail( &self->object->modifiers, modifier_new( type ) );
- return Modifier_CreatePyObject( self->object, self->object->modifiers.last );
-}
-
-/* remove an existing modifier */
-
-static PyObject *ModSeq_remove( BPy_ModSeq *self, BPy_Modifier *value )
-{
- ModifierData *md = locate_modifier( self, value );
-
- /* if we can't locate the modifier, return (exception already set) */
- if( !md )
- return (PyObject *)NULL;
-
- /* do the actual removal */
- BLI_remlink( &self->object->modifiers, md );
- modifier_free( md );
-
- /* erase the link to the modifier */
- value->md = NULL;
-
- Py_RETURN_NONE;
-}
-
-/* move the modifier up in the stack */
-
-static PyObject *ModSeq_moveUp( BPy_ModSeq * self, BPy_Modifier * value )
-{
- ModifierData *md = locate_modifier( self, value );
-
- /* if we can't locate the modifier, return (exception already set) */
- if( !md )
- return (PyObject *)NULL;
-
- if( mod_moveUp( self->object, md ) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "cannot move above a modifier requiring original data" );
-
- Py_RETURN_NONE;
-}
-
-/* move the modifier down in the stack */
-
-static PyObject *ModSeq_moveDown( BPy_ModSeq * self, BPy_Modifier *value )
-{
- ModifierData *md = locate_modifier( self, value );
-
- /* if we can't locate the modifier, return (exception already set) */
- if( !md )
- return (PyObject *)NULL;
-
- if( mod_moveDown( self->object, md ) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "cannot move beyond a non-deforming modifier" );
-
- Py_RETURN_NONE;
-}
-
-/*****************************************************************************/
-/* Python BPy_ModSeq methods table: */
-/*****************************************************************************/
-static PyMethodDef BPy_ModSeq_methods[] = {
- /* name, method, flags, doc */
- {"append", ( PyCFunction ) ModSeq_append, METH_O,
- "(type) - add a new modifier, where type is the type of modifier"},
- {"remove", ( PyCFunction ) ModSeq_remove, METH_O,
- "(modifier) - remove an existing modifier, where modifier is a modifier from this object."},
- {"moveUp", ( PyCFunction ) ModSeq_moveUp, METH_O,
- "(modifier) - Move a modifier up in stack"},
- {"moveDown", ( PyCFunction ) ModSeq_moveDown, METH_O,
- "(modifier) - Move a modifier down in stack"},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Python ModSeq_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject ModSeq_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender.Modifiers", /* char *tp_name; */
- sizeof( BPy_ModSeq ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL, /* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- NULL, /* cmpfunc tp_compare; */
- ( reprfunc ) NULL, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- &ModSeq_as_sequence, /* 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; */
- 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, /* 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, /* richcmpfunc tp_richcompare; */
-
- /*** weak reference enabler ***/
- 0, /* long tp_weaklistoffset; */
-
- /*** Added in release 2.2 ***/
- /* Iterators */
- ( getiterfunc )ModSeq_getIter, /* getiterfunc tp_iter; */
- ( iternextfunc )ModSeq_nextIter, /* iternextfunc tp_iternext; */
-
- /*** Attribute descriptor and subclassing stuff ***/
- BPy_ModSeq_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- NULL, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-/*****************************************************************************/
-/* Function: ModSeq_CreatePyObject */
-/* Description: This function will create a new BPy_ModSeq from an */
-/* existing ListBase structure. */
-/*****************************************************************************/
-PyObject *ModSeq_CreatePyObject( Object *ob, ModifierData *iter )
-{
- BPy_ModSeq *pymod;
- pymod = ( BPy_ModSeq * ) PyObject_NEW( BPy_ModSeq, &ModSeq_Type );
- if( !pymod )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create BPy_ModSeq object" );
- pymod->object = ob;
- pymod->iter = iter;
- return ( PyObject * ) pymod;
-}
-
-static PyObject *M_Modifier_TypeDict( void )
-{
- PyObject *S = PyConstant_New( );
-
- if( S ) {
- BPy_constant *d = ( BPy_constant * ) S;
-
- PyConstant_Insert( d, "SUBSURF",
- PyInt_FromLong( eModifierType_Subsurf ) );
- PyConstant_Insert( d, "ARMATURE",
- PyInt_FromLong( eModifierType_Armature ) );
- PyConstant_Insert( d, "LATTICE",
- PyInt_FromLong( eModifierType_Lattice ) );
- PyConstant_Insert( d, "CURVE",
- PyInt_FromLong( eModifierType_Curve ) );
- PyConstant_Insert( d, "BUILD",
- PyInt_FromLong( eModifierType_Build ) );
- PyConstant_Insert( d, "MIRROR",
- PyInt_FromLong( eModifierType_Mirror ) );
- PyConstant_Insert( d, "DECIMATE",
- PyInt_FromLong( eModifierType_Decimate ) );
- PyConstant_Insert( d, "WAVE",
- PyInt_FromLong( eModifierType_Wave ) );
- PyConstant_Insert( d, "BOOLEAN",
- PyInt_FromLong( eModifierType_Boolean ) );
- PyConstant_Insert( d, "ARRAY",
- PyInt_FromLong( eModifierType_Array ) );
- PyConstant_Insert( d, "EDGESPLIT",
- PyInt_FromLong( eModifierType_EdgeSplit ) );
- PyConstant_Insert( d, "SMOOTH",
- PyInt_FromLong( eModifierType_Smooth ) );
- PyConstant_Insert( d, "CAST",
- PyInt_FromLong( eModifierType_Cast ) );
- PyConstant_Insert( d, "DISPLACE",
- PyInt_FromLong( eModifierType_Displace ) );
- }
- return S;
-}
-
-
-static PyObject *M_Modifier_SettingsDict( void )
-{
- PyObject *S = PyConstant_New( );
-
- if( S ) {
- BPy_constant *d = ( BPy_constant * ) S;
-
-/*
-# The lines below are a python script that uses the enum variables to create
-# the lines below
-# START PYSCRIPT
-st='''
- EXPP_MOD_RENDER = 0,
- EXPP_MOD_REALTIME,
- EXPP_MOD_EDITMODE,
- etc.. copy from above
-'''
-
-base= '''
- PyConstant_Insert( d, "%s",
- PyInt_FromLong( EXPP_MOD_%s ) );
-'''
-for var in st.replace(',','').split('\n'):
-
- var= var.split()
- if not var: continue
- var= var[0]
- if (not var) or var.startswith('/'): continue
-
- var='_'.join(var.split('_')[2:])
- print base % (var, var),
-# END PYSCRIPT
-*/
-
- /*Auto generated from the above script*/
- PyConstant_Insert( d, "RENDER",
- PyInt_FromLong( EXPP_MOD_RENDER ) );
- PyConstant_Insert( d, "REALTIME",
- PyInt_FromLong( EXPP_MOD_REALTIME ) );
- PyConstant_Insert( d, "EDITMODE",
- PyInt_FromLong( EXPP_MOD_EDITMODE ) );
- PyConstant_Insert( d, "ONCAGE",
- PyInt_FromLong( EXPP_MOD_ONCAGE ) );
- PyConstant_Insert( d, "OBJECT",
- PyInt_FromLong( EXPP_MOD_OBJECT ) );
- PyConstant_Insert( d, "VERTGROUP",
- PyInt_FromLong( EXPP_MOD_VERTGROUP ) );
- PyConstant_Insert( d, "LIMIT",
- PyInt_FromLong( EXPP_MOD_LIMIT ) );
- PyConstant_Insert( d, "FLAG",
- PyInt_FromLong( EXPP_MOD_FLAG ) );
- PyConstant_Insert( d, "COUNT",
- PyInt_FromLong( EXPP_MOD_COUNT ) );
- PyConstant_Insert( d, "LENGTH",
- PyInt_FromLong( EXPP_MOD_LENGTH ) );
- PyConstant_Insert( d, "FACTOR",
- PyInt_FromLong( EXPP_MOD_FACTOR ) );
- PyConstant_Insert( d, "ENABLE_X",
- PyInt_FromLong( EXPP_MOD_ENABLE_X ) );
- PyConstant_Insert( d, "ENABLE_Y",
- PyInt_FromLong( EXPP_MOD_ENABLE_Y ) );
- PyConstant_Insert( d, "ENABLE_Z",
- PyInt_FromLong( EXPP_MOD_ENABLE_Z ) );
- PyConstant_Insert( d, "TYPES",
- PyInt_FromLong( EXPP_MOD_TYPES ) );
- PyConstant_Insert( d, "LEVELS",
- PyInt_FromLong( EXPP_MOD_LEVELS ) );
- PyConstant_Insert( d, "RENDLEVELS",
- PyInt_FromLong( EXPP_MOD_RENDLEVELS ) );
- PyConstant_Insert( d, "OPTIMAL",
- PyInt_FromLong( EXPP_MOD_OPTIMAL ) );
- PyConstant_Insert( d, "UV",
- PyInt_FromLong( EXPP_MOD_UV ) );
- PyConstant_Insert( d, "ENVELOPES",
- PyInt_FromLong( EXPP_MOD_ENVELOPES ) );
- PyConstant_Insert( d, "OBJECT_OFFSET",
- PyInt_FromLong( EXPP_MOD_OBJECT_OFFSET ) );
- PyConstant_Insert( d, "OBJECT_CURVE",
- PyInt_FromLong( EXPP_MOD_OBJECT_CURVE ) );
- PyConstant_Insert( d, "OFFSET_VEC",
- PyInt_FromLong( EXPP_MOD_OFFSET_VEC ) );
- PyConstant_Insert( d, "SCALE_VEC",
- PyInt_FromLong( EXPP_MOD_SCALE_VEC ) );
- PyConstant_Insert( d, "MERGE_DIST",
- PyInt_FromLong( EXPP_MOD_MERGE_DIST ) );
- PyConstant_Insert( d, "START",
- PyInt_FromLong( EXPP_MOD_START ) );
- PyConstant_Insert( d, "SEED",
- PyInt_FromLong( EXPP_MOD_SEED ) );
- PyConstant_Insert( d, "RANDOMIZE",
- PyInt_FromLong( EXPP_MOD_RANDOMIZE ) );
- PyConstant_Insert( d, "AXIS_X",
- PyInt_FromLong( EXPP_MOD_AXIS_X ) );
- PyConstant_Insert( d, "AXIS_Y",
- PyInt_FromLong( EXPP_MOD_AXIS_Y ) );
- PyConstant_Insert( d, "AXIS_Z",
- PyInt_FromLong( EXPP_MOD_AXIS_Z ) );
- PyConstant_Insert( d, "RATIO",
- PyInt_FromLong( EXPP_MOD_RATIO ) );
- PyConstant_Insert( d, "STARTX",
- PyInt_FromLong( EXPP_MOD_STARTX ) );
- PyConstant_Insert( d, "STARTY",
- PyInt_FromLong( EXPP_MOD_STARTY ) );
- PyConstant_Insert( d, "HEIGHT",
- PyInt_FromLong( EXPP_MOD_HEIGHT ) );
- PyConstant_Insert( d, "WIDTH",
- PyInt_FromLong( EXPP_MOD_WIDTH ) );
- PyConstant_Insert( d, "NARROW",
- PyInt_FromLong( EXPP_MOD_NARROW ) );
- PyConstant_Insert( d, "SPEED",
- PyInt_FromLong( EXPP_MOD_SPEED ) );
- PyConstant_Insert( d, "DAMP",
- PyInt_FromLong( EXPP_MOD_DAMP ) );
- PyConstant_Insert( d, "LIFETIME",
- PyInt_FromLong( EXPP_MOD_LIFETIME ) );
- PyConstant_Insert( d, "TIMEOFFS",
- PyInt_FromLong( EXPP_MOD_TIMEOFFS ) );
- PyConstant_Insert( d, "OPERATION",
- PyInt_FromLong( EXPP_MOD_OPERATION ) );
- PyConstant_Insert( d, "EDGESPLIT_ANGLE",
- PyInt_FromLong( EXPP_MOD_EDGESPLIT_ANGLE ) );
- PyConstant_Insert( d, "EDGESPLIT_FROM_ANGLE",
- PyInt_FromLong( EXPP_MOD_EDGESPLIT_FROM_ANGLE ) );
- PyConstant_Insert( d, "EDGESPLIT_FROM_SHARP",
- PyInt_FromLong( EXPP_MOD_EDGESPLIT_FROM_SHARP ) );
- PyConstant_Insert( d, "UVLAYER",
- PyInt_FromLong( EXPP_MOD_UVLAYER ) );
- PyConstant_Insert( d, "MID_LEVEL",
- PyInt_FromLong( EXPP_MOD_MID_LEVEL ) );
- PyConstant_Insert( d, "STRENGTH",
- PyInt_FromLong( EXPP_MOD_STRENGTH ) );
- PyConstant_Insert( d, "TEXTURE",
- PyInt_FromLong( EXPP_MOD_TEXTURE ) );
- PyConstant_Insert( d, "MAPPING",
- PyInt_FromLong( EXPP_MOD_MAPPING ) );
- PyConstant_Insert( d, "DIRECTION",
- PyInt_FromLong( EXPP_MOD_DIRECTION ) );
- PyConstant_Insert( d, "REPEAT",
- PyInt_FromLong( EXPP_MOD_REPEAT ) );
- PyConstant_Insert( d, "RADIUS",
- PyInt_FromLong( EXPP_MOD_RADIUS ) );
- PyConstant_Insert( d, "SIZE",
- PyInt_FromLong( EXPP_MOD_SIZE ) );
- PyConstant_Insert( d, "USE_OB_TRANSFORM",
- PyInt_FromLong( EXPP_MOD_USE_OB_TRANSFORM ) );
- PyConstant_Insert( d, "SIZE_FROM_RADIUS",
- PyInt_FromLong( EXPP_MOD_SIZE_FROM_RADIUS ) );
- /*End Auto generated code*/
- }
- return S;
-}
-
-/*****************************************************************************/
-/* Function: Modifier_Init */
-/*****************************************************************************/
-PyObject *Modifier_Init( void )
-{
- PyObject *submodule;
- PyObject *TypeDict = M_Modifier_TypeDict( );
- PyObject *SettingsDict = M_Modifier_SettingsDict( );
-
- if( PyType_Ready( &ModSeq_Type ) < 0 ||
- PyType_Ready( &Modifier_Type ) < 0 )
- return NULL;
-
- submodule = Py_InitModule3( "Blender.Modifier", NULL,
- "Modifer module for accessing and creating object modifier data" );
-
- if( TypeDict ) {
- PyModule_AddObject( submodule, "Type", TypeDict ); /* deprecated */
- /* since PyModule_AddObject() steals a reference, we need to
- incref TypeDict to use it again */
- Py_INCREF( TypeDict);
- PyModule_AddObject( submodule, "Types", TypeDict );
- }
-
- if( SettingsDict )
- PyModule_AddObject( submodule, "Settings", SettingsDict );
-
- return submodule;
-}
diff --git a/source/blender/python/api2_2x/Modifier.h b/source/blender/python/api2_2x/Modifier.h
deleted file mode 100644
index 12afc591c2c..00000000000
--- a/source/blender/python/api2_2x/Modifier.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * $Id: Modifier.h 10269 2007-03-15 01:09:14Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Ken Hughes
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_MODIFIER_H
-#define EXPP_MODIFIER_H
-
-#include <Python.h>
-#include "DNA_object_types.h"
-#include "DNA_modifier_types.h"
-#include "DNA_listBase.h"
-
-/*****************************************************************************/
-/* Python BPy_Modifier and BPy_ModSeq structure definition: */
-/*****************************************************************************/
-typedef struct {
- PyObject_HEAD /* required macro */
- Object *object;
- ModifierData *iter;
-} BPy_ModSeq;
-
-typedef struct {
- PyObject_HEAD /* required macro */
- Object *object;
- /* if md this is null, the modifier has been removed and we need to raise
- an error when its data is accessed */
- ModifierData *md;
-} BPy_Modifier;
-
-extern PyTypeObject ModSeq_Type;
-extern PyTypeObject Modifier_Type;
-#define BPy_ModSeq_Check(v) ((v)->ob_type == &ModSeq_Type)
-#define BPy_Modifier_Check(v) ((v)->ob_type == &Modifier_Type)
-
-/*
- * prototypes
- */
-
-PyObject *Modifier_Init( void );
-PyObject *ModSeq_CreatePyObject( Object *obj, ModifierData *iter );
-PyObject *Modifier_CreatePyObject( Object *obj, ModifierData *md );
-ModifierData *Modifier_FromPyObject( PyObject * py_obj );
-
-#endif /* EXPP_MODIFIER_H */
diff --git a/source/blender/python/api2_2x/NLA.c b/source/blender/python/api2_2x/NLA.c
deleted file mode 100644
index a0bdaa83d07..00000000000
--- a/source/blender/python/api2_2x/NLA.c
+++ /dev/null
@@ -1,1590 +0,0 @@
-/*
- * $Id: NLA.c 11907 2007-08-31 18:21:12Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Joseph Gilbert
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#include "NLA.h" /*This must come first*/
-
-#include "DNA_curve_types.h"
-#include "DNA_scene_types.h"
-#include "BKE_action.h"
-#include "BKE_nla.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_library.h"
-#include "BLI_blenlib.h"
-#include "Object.h"
-#include "Ipo.h"
-#include "gen_utils.h"
-#include "gen_library.h"
-#include "blendef.h"
-#include "MEM_guardedalloc.h"
-
-#define ACTSTRIP_STRIDEAXIS_X 0
-#define ACTSTRIP_STRIDEAXIS_Y 1
-#define ACTSTRIP_STRIDEAXIS_Z 2
-
-/*****************************************************************************/
-/* Python API function prototypes for the NLA module. */
-/*****************************************************************************/
-static PyObject *M_NLA_NewAction( PyObject * self, PyObject * args );
-static PyObject *M_NLA_CopyAction( PyObject * self, PyObject * args );
-static PyObject *M_NLA_GetActions( PyObject * self );
-
-/*****************************************************************************/
-/* The following string definitions are used for documentation strings. */
-/* In Python these will be written to the console when doing a */
-/* Blender.Armature.NLA.__doc__ */
-/*****************************************************************************/
-char M_NLA_doc[] =
- "The Blender NLA module -This module provides control over Armature keyframing in Blender.";
-char M_NLA_NewAction_doc[] =
- "(name) - Create new action for linking to an object.";
-char M_NLA_CopyAction_doc[] = "(name) - Copy action and return copy.";
-char M_NLA_GetActions_doc[] = "(name) - Returns a dictionary of actions.";
-
-/*****************************************************************************/
-/* Python method structure definition for Blender.Armature.NLA module: */
-/*****************************************************************************/
-struct PyMethodDef M_NLA_methods[] = {
- {"NewAction", ( PyCFunction ) M_NLA_NewAction, METH_VARARGS,
- M_NLA_NewAction_doc},
- {"CopyAction", ( PyCFunction ) M_NLA_CopyAction, METH_VARARGS,
- M_NLA_CopyAction_doc},
- {"GetActions", ( PyCFunction ) M_NLA_GetActions, METH_NOARGS,
- M_NLA_GetActions_doc},
- {NULL, NULL, 0, NULL}
-};
-/*****************************************************************************/
-/* Python BPy_Action methods declarations: */
-/*****************************************************************************/
-static PyObject *Action_setActive( BPy_Action * self, PyObject * args );
-static PyObject *Action_getFrameNumbers(BPy_Action *self);
-static PyObject *Action_getChannelIpo( BPy_Action * self, PyObject * value );
-static PyObject *Action_getChannelNames( BPy_Action * self );
-static PyObject *Action_renameChannel( BPy_Action * self, PyObject * args );
-static PyObject *Action_verifyChannel( BPy_Action * self, PyObject * value );
-static PyObject *Action_removeChannel( BPy_Action * self, PyObject * value );
-static PyObject *Action_getAllChannelIpos( BPy_Action * self );
-
-/*****************************************************************************/
-/* Python BPy_Action methods table: */
-/*****************************************************************************/
-static PyMethodDef BPy_Action_methods[] = {
- /* name, method, flags, doc */
- {"getName", ( PyCFunction ) GenericLib_getName, METH_NOARGS,
- "() - return Action name"},
- {"setName", ( PyCFunction ) GenericLib_setName_with_method, METH_VARARGS,
- "(str) - rename Action"},
- {"setActive", ( PyCFunction ) Action_setActive, METH_VARARGS,
- "(str) -set this action as the active action for an object"},
- {"getFrameNumbers", (PyCFunction) Action_getFrameNumbers, METH_NOARGS,
- "() - get the frame numbers at which keys have been inserted"},
- {"getChannelIpo", ( PyCFunction ) Action_getChannelIpo, METH_O,
- "(str) -get the Ipo from a named action channel in this action"},
- {"getChannelNames", ( PyCFunction ) Action_getChannelNames, METH_NOARGS,
- "() -get the channel names for this action"},
- {"renameChannel", ( PyCFunction ) Action_renameChannel, METH_VARARGS,
- "(from, to) -rename the channel from string to string"},
- {"verifyChannel", ( PyCFunction ) Action_verifyChannel, METH_O,
- "(str) -verify the channel in this action"},
- {"removeChannel", ( PyCFunction ) Action_removeChannel, METH_O,
- "(str) -remove the channel from the action"},
- {"getAllChannelIpos", ( PyCFunction ) Action_getAllChannelIpos,
- METH_NOARGS,
- "() - Return a dict of (name:ipo)-keys containing each channel in the object's action"},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Python TypeAction callback function prototypes: */
-/*****************************************************************************/
-static int Action_compare( BPy_Action * a, BPy_Action * b );
-static PyObject *Action_repr( BPy_Action * bone );
-
-/*-------------------------------------------------------------------------*/
-static PyObject *M_NLA_NewAction( PyObject * self_unused, PyObject * args )
-{
- char *name_str = "DefaultAction";
- BPy_Action *py_action = NULL; /* for Action Data object wrapper in Python */
- bAction *bl_action = NULL; /* for actual Action Data we create in Blender */
-
- if( !PyArg_ParseTuple( args, "|s", &name_str ) ) {
- EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected string or nothing" );
- return NULL;
- }
- /* Create new action globally */
- bl_action = alloc_libblock( &G.main->action, ID_AC, name_str );
- bl_action->id.flag |= LIB_FAKEUSER; /* no need to assign a user because alloc_libblock alredy assigns one */
-
-
- /* now create the wrapper obj in Python */
- if( bl_action )
- py_action =
- ( BPy_Action * ) PyObject_NEW( BPy_Action,
- &Action_Type );
- else {
- EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't create Action Data in Blender" );
- return NULL;
- }
-
- if( py_action == NULL ) {
- EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create Action Data object" );
- return NULL;
- }
-
- py_action->action = bl_action; /* link Python action wrapper with Blender Action */
-
- Py_INCREF( py_action );
- return ( PyObject * ) py_action;
-}
-
-static PyObject *M_NLA_CopyAction( PyObject * self_unused, PyObject * args )
-{
- BPy_Action *py_action = NULL;
- bAction *copyAction = NULL;
-
- if( !PyArg_ParseTuple( args, "O!", &Action_Type, &py_action ) ) {
- EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected python action type" );
- return NULL;
- }
- copyAction = copy_action( py_action->action );
- return Action_CreatePyObject( copyAction );
-}
-
-static PyObject *M_NLA_GetActions( PyObject * self_unused )
-{
- PyObject *dict = PyDict_New( );
- bAction *action = NULL;
-
- for( action = G.main->action.first; action; action = action->id.next ) {
- PyObject *py_action = Action_CreatePyObject( action );
- if( py_action ) {
- /* Insert dict entry using the bone name as key */
- if( PyDict_SetItemString
- ( dict, action->id.name + 2, py_action ) != 0 ) {
- Py_DECREF( py_action );
- Py_DECREF( dict );
-
- return EXPP_ReturnPyObjError
- ( PyExc_RuntimeError,
- "NLA_GetActions: couldn't set dict item" );
- }
- Py_DECREF( py_action );
- } else {
- Py_DECREF( dict );
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "NLA_GetActions: could not create Action object" ) );
- }
- }
- return dict;
-}
-
-static PyObject *Action_getFrameNumbers(BPy_Action *self)
-{
- bActionChannel *achan = NULL;
- IpoCurve *icu = NULL;
- BezTriple *bezt = NULL;
- int verts;
- PyObject *py_list = NULL;
-
- py_list = PyList_New(0);
- for(achan = self->action->chanbase.first; achan; achan = achan->next){
- if (achan->ipo) {
- for (icu = achan->ipo->curve.first; icu; icu = icu->next){
- bezt= icu->bezt;
- if(bezt) {
- verts = icu->totvert;
- while(verts--) {
- PyObject *value;
- value = PyInt_FromLong((int)bezt->vec[1][0]);
- if ( PySequence_Contains(py_list, value) == 0){
- PyList_Append(py_list, value);
- }
- Py_DECREF(value);
- bezt++;
- }
- }
- }
- }
- }
- PyList_Sort(py_list);
- return EXPP_incr_ret(py_list);
-}
-
-static PyObject *Action_setActive( BPy_Action * self, PyObject * args )
-{
- BPy_Object *object;
-
- if( !self->action )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get attribute from a NULL action" );
-
- if( !PyArg_ParseTuple( args, "O!", &Object_Type, &object ) )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected python object argument" );
-
- if( object->object->type != OB_ARMATURE )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "object not of type armature" );
-
- /* if object is already attached to an action, decrement user count */
- if( object->object->action )
- --object->object->action->id.us;
-
- /* set the active action to object */
- object->object->action = self->action;
- ++object->object->action->id.us;
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Action_getChannelIpo( BPy_Action * self, PyObject * value )
-{
- char *chanName = PyString_AsString(value);
- bActionChannel *chan;
-
- if( !chanName )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "string expected" );
-
- chan = get_action_channel( self->action, chanName );
- if( !chan )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "no channel with that name" );
-
- if( !chan->ipo ) {
- Py_RETURN_NONE;
- }
-
- return Ipo_CreatePyObject( chan->ipo );
-}
-
-static PyObject *Action_getChannelNames( BPy_Action * self )
-{
- PyObject *list = PyList_New( BLI_countlist(&(self->action->chanbase)) );
- bActionChannel *chan = NULL;
- int index=0;
- for( chan = self->action->chanbase.first; chan; chan = chan->next ) {
- PyList_SetItem( list, index, PyString_FromString(chan->name) );
- index++;
- }
- return list;
-}
-
-static PyObject *Action_renameChannel( BPy_Action * self, PyObject * args )
-{
- char *chanFrom, *chanTo;
- bActionChannel *chan;
-
- if( !PyArg_ParseTuple( args, "ss", &chanFrom, &chanTo ) )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "2 strings expected" );
-
- chan = get_action_channel( self->action, chanFrom );
- if( !chan )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "no channel with that name" );
- if (strlen(chanTo) > 31)
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "new name greater then 31 characters long" );
-
- if (get_action_channel( self->action, chanTo ))
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "channel target name alredy exists" );
-
- strcpy(chan->name, chanTo);
-
- Py_RETURN_NONE;
-}
-
-/*----------------------------------------------------------------------*/
-static PyObject *Action_verifyChannel( BPy_Action * self, PyObject * value )
-{
- char *chanName = PyString_AsString(value);
- bActionChannel *chan;
-
- if( !self->action )
- ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't create channel for a NULL action" ) );
-
- if( !chanName )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected string argument" ) );
-
- chan = verify_action_channel(self->action, chanName);
-
- Py_RETURN_NONE;
-}
-
-
-static PyObject *Action_removeChannel( BPy_Action * self, PyObject * value )
-{
- char *chanName = PyString_AsString(value);
- bActionChannel *chan;
-
- if( !chanName )
- return (EXPP_ReturnPyObjError( PyExc_AttributeError,
- "string expected" ));
-
-
- chan = get_action_channel( self->action, chanName );
- if( chan == NULL ) {
- EXPP_ReturnPyObjError( PyExc_AttributeError,
- "no channel with that name..." );
- return NULL;
- }
- /*release ipo*/
- if( chan->ipo )
- chan->ipo->id.us--;
-
- /*remove channel*/
- BLI_freelinkN( &self->action->chanbase, chan );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Action_getAllChannelIpos( BPy_Action * self )
-{
- PyObject *dict = PyDict_New( );
- bActionChannel *chan = NULL;
-
- for( chan = self->action->chanbase.first; chan; chan = chan->next ) {
- PyObject *ipo_attr;
- if( chan->ipo )
- ipo_attr = Ipo_CreatePyObject( chan->ipo );
- else {
- ipo_attr = Py_None;
- Py_INCREF( ipo_attr );
- }
- if( ipo_attr ) {
- /* Insert dict entry using the bone name as key*/
- if( PyDict_SetItemString( dict, chan->name, ipo_attr )
- != 0 ) {
- Py_DECREF( ipo_attr );
- Py_DECREF( dict );
-
- return EXPP_ReturnPyObjError
- ( PyExc_RuntimeError,
- "Action_getAllChannelIpos: couldn't set dict item" );
- }
- Py_DECREF( ipo_attr );
- } else {
- Py_DECREF( dict );
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "Action_getAllChannelIpos: could not create Ipo object" ) );
- }
- }
- return dict;
-}
-
-/*----------------------------------------------------------------------*/
-static int Action_compare( BPy_Action * a, BPy_Action * b )
-{
- return ( a->action == b->action ) ? 0 : -1;
-}
-
-/*----------------------------------------------------------------------*/
-static PyObject *Action_repr( BPy_Action * self )
-{
- if( self->action )
- return PyString_FromFormat( "[Action \"%s\"]",
- self->action->id.name + 2 );
- else
- return PyString_FromString( "NULL" );
-}
-
-/*----------------------------------------------------------------------*/
-PyObject *Action_CreatePyObject( struct bAction * act )
-{
- BPy_Action *blen_action;
-
- if(!act) Py_RETURN_NONE;
-
- blen_action =
- ( BPy_Action * ) PyObject_NEW( BPy_Action, &Action_Type );
-
- if( !blen_action) {
- return ( EXPP_ReturnPyObjError
- ( PyExc_RuntimeError, "failure to create object!" ) );
- }
- blen_action->action = act;
- return ( ( PyObject * ) blen_action );
-}
-
-/*----------------------------------------------------------------------*/
-struct bAction *Action_FromPyObject( PyObject * py_obj )
-{
- BPy_Action *blen_obj;
-
- blen_obj = ( BPy_Action * ) py_obj;
- return ( blen_obj->action );
-}
-
-/*****************************************************************************/
-/* Python attributes get/set structure: */
-/*****************************************************************************/
-static PyGetSetDef BPy_Action_getseters[] = {
- GENERIC_LIB_GETSETATTR,
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-/*****************************************************************************/
-/* Python TypeAction structure definition: */
-/*****************************************************************************/
-PyTypeObject Action_Type = {
- PyObject_HEAD_INIT( NULL )
- 0, /* ob_size */
- "Blender Action", /* tp_name */
- sizeof( BPy_Action ), /* tp_basicsize */
- 0, /* tp_itemsize */
- /* methods */
- NULL, /* tp_dealloc */
- NULL, /* tp_print */
- NULL, /* tp_getattr */
- NULL, /* tp_setattr */
- ( cmpfunc ) Action_compare, /* tp_compare */
- ( reprfunc ) Action_repr, /* tp_repr */
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- NULL, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
- 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, /* 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, /* 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 ***/
- BPy_Action_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_Action_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-
-
-/*****************************************************************************/
-/* ActionStrip wrapper */
-/*****************************************************************************/
-
-/*****************************************************************************/
-/* Python BPy_ActionStrip attributes: */
-/*****************************************************************************/
-
-/*
- * return the action for the action strip
- */
-
-static PyObject *ActionStrip_getAction( BPy_ActionStrip * self )
-{
- if( !self->strip )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This strip has been removed!" );
-
- return Action_CreatePyObject( self->strip->act );
-}
-
-/*
- * return the start frame of the action strip
- */
-
-static PyObject *ActionStrip_getStripStart( BPy_ActionStrip * self )
-{
- if( !self->strip )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This strip has been removed!" );
-
- return PyFloat_FromDouble( self->strip->start );
-}
-
-/*
- * set the start frame of the action strip
- */
-
-static int ActionStrip_setStripStart( BPy_ActionStrip * self, PyObject * value )
-{
- int retval;
-
- if( !self->strip )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "This strip has been removed!" );
-
- retval = EXPP_setFloatClamped( value, &self->strip->start,
- -1000.0, self->strip->end-1 );
- if( !retval ) {
- float max = self->strip->end - self->strip->start;
- if( self->strip->blendin > max )
- self->strip->blendin = max;
- if( self->strip->blendout > max )
- self->strip->blendout = max;
- }
- return retval;
-}
-
-/*
- * return the ending frame of the action strip
- */
-
-static PyObject *ActionStrip_getStripEnd( BPy_ActionStrip * self )
-{
- if( !self->strip )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This strip has been removed!" );
-
- return PyFloat_FromDouble( self->strip->end );
-}
-
-/*
- * set the ending frame of the action strip
- */
-
-static int ActionStrip_setStripEnd( BPy_ActionStrip * self, PyObject * value )
-{
- int retval;
-
- if( !self->strip )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "This strip has been removed!" );
-
- retval = EXPP_setFloatClamped( value, &self->strip->end,
- self->strip->start+1, MAXFRAMEF );
- if( !retval ) {
- float max = self->strip->end - self->strip->start;
- if( self->strip->blendin > max )
- self->strip->blendin = max;
- if( self->strip->blendout > max )
- self->strip->blendout = max;
- }
- return retval;
-}
-
-/*
- * return the start frame of the action
- */
-
-static PyObject *ActionStrip_getActionStart( BPy_ActionStrip * self )
-{
- if( !self->strip )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This strip has been removed!" );
-
- return PyFloat_FromDouble( self->strip->actstart );
-}
-
-/*
- * set the start frame of the action
- */
-
-static int ActionStrip_setActionStart( BPy_ActionStrip * self, PyObject * value )
-{
- if( !self->strip )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "This strip has been removed!" );
-
- return EXPP_setFloatClamped( value, &self->strip->actstart,
- -1000.0, self->strip->actend-1 );
-}
-
-/*
- * return the ending frame of the action
- */
-
-static PyObject *ActionStrip_getActionEnd( BPy_ActionStrip * self )
-{
- if( !self->strip )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This strip has been removed!" );
-
- return PyFloat_FromDouble( self->strip->actend );
-}
-
-/*
- * set the ending frame of the action
- */
-
-static int ActionStrip_setActionEnd( BPy_ActionStrip * self, PyObject * value )
-{
- if( !self->strip )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "This strip has been removed!" );
-
- return EXPP_setFloatClamped( value, &self->strip->actend,
- self->strip->actstart+1, MAXFRAMEF );
-}
-
-/*
- * return the repeat value of the action strip
- */
-
-static PyObject *ActionStrip_getRepeat( BPy_ActionStrip * self )
-{
- if( !self->strip )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This strip has been removed!" );
-
- return PyFloat_FromDouble( self->strip->repeat );
-}
-
-/*
- * set the repeat value of the action strip
- */
-
-static int ActionStrip_setRepeat( BPy_ActionStrip * self, PyObject * value )
-{
- if( !self->strip )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "This strip has been removed!" );
-
- return EXPP_setFloatClamped( value, &self->strip->repeat,
- 0.001f, 1000.0f );
-}
-
-/*
- * return the blend in of the action strip
- */
-
-static PyObject *ActionStrip_getBlendIn( BPy_ActionStrip * self )
-{
- if( !self->strip )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This strip has been removed!" );
-
- return PyFloat_FromDouble( self->strip->blendin );
-}
-
-/*
- * set the blend in value of the action strip
- */
-
-static int ActionStrip_setBlendIn( BPy_ActionStrip * self, PyObject * value )
-{
- if( !self->strip )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "This strip has been removed!" );
-
- return EXPP_setFloatClamped( value, &self->strip->blendin,
- 0.0, self->strip->end - self->strip->start );
-}
-
-/*
- * return the blend out of the action strip
- */
-
-static PyObject *ActionStrip_getBlendOut( BPy_ActionStrip * self )
-{
- if( !self->strip )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This strip has been removed!" );
-
- return PyFloat_FromDouble( self->strip->blendout );
-}
-
-/*
- * set the blend out value of the action strip
- */
-
-static int ActionStrip_setBlendOut( BPy_ActionStrip * self, PyObject * value )
-{
- if( !self->strip )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "This strip has been removed!" );
-
- return EXPP_setFloatClamped( value, &self->strip->blendout,
- 0.0, self->strip->end - self->strip->start );
-}
-
-/*
- * return the blend mode of the action strip
- */
-
-static PyObject *ActionStrip_getBlendMode( BPy_ActionStrip * self )
-{
- if( !self->strip )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This strip has been removed!" );
-
- return PyInt_FromLong( (long)self->strip->mode ) ;
-}
-
-/*
- * set the blend mode value of the action strip
- */
-
-static int ActionStrip_setBlendMode( BPy_ActionStrip * self, PyObject * value )
-{
- if( !self->strip )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "This strip has been removed!" );
-
- return EXPP_setIValueRange( value, &self->strip->mode,
- 0, ACTSTRIPMODE_ADD, 'h' );
-}
-
-/*
- * return the flag settings of the action strip
- */
-
-#define ACTIONSTRIP_MASK (ACTSTRIP_SELECT | ACTSTRIP_USESTRIDE \
- | ACTSTRIP_HOLDLASTFRAME | ACTSTRIP_ACTIVE | ACTSTRIP_LOCK_ACTION)
-
-static PyObject *ActionStrip_getFlag( BPy_ActionStrip * self )
-{
- if( !self->strip )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This strip has been removed!" );
-
- return PyInt_FromLong( (long)( self->strip->flag & ACTIONSTRIP_MASK ) ) ;
-}
-
-/*
- * set the flag settings out value of the action strip
- */
-
-static int ActionStrip_setFlag( BPy_ActionStrip * self, PyObject * arg )
-{
- PyObject *num = PyNumber_Int( arg );
- int value;
-
- if( !self->strip )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "This strip has been removed!" );
- if( !num )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected int argument" );
- value = PyInt_AS_LONG( num );
- Py_DECREF( num );
-
- if( ( value & ACTIONSTRIP_MASK ) != value ) {
- char errstr[128];
- sprintf ( errstr , "expected int bitmask of 0x%04x", ACTIONSTRIP_MASK );
- return EXPP_ReturnIntError( PyExc_TypeError, errstr );
- }
-
- self->strip->flag = (short)value;
- return 0;
-}
-
-/*
- * return the stride axis of the action strip
- */
-
-static PyObject *ActionStrip_getStrideAxis( BPy_ActionStrip * self )
-{
- if( !self->strip )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This strip has been removed!" );
-
- return PyInt_FromLong( (long)self->strip->stride_axis ) ;
-}
-
-/*
- * set the stride axis of the action strip
- */
-
-static int ActionStrip_setStrideAxis( BPy_ActionStrip * self, PyObject * value )
-{
- if( !self->strip )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "This strip has been removed!" );
-
- return EXPP_setIValueRange( value, &self->strip->stride_axis,
- ACTSTRIP_STRIDEAXIS_X, ACTSTRIP_STRIDEAXIS_Z, 'h' );
-}
-
-/*
- * return the stride length of the action strip
- */
-
-static PyObject *ActionStrip_getStrideLength( BPy_ActionStrip * self )
-{
- if( !self->strip )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This strip has been removed!" );
-
- return PyFloat_FromDouble( (double)self->strip->stridelen ) ;
-}
-
-/*
- * set the stride length of the action strip
- */
-
-static int ActionStrip_setStrideLength( BPy_ActionStrip * self, PyObject * value )
-{
- if( !self->strip )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "This strip has been removed!" );
-
- return EXPP_setFloatClamped( value, &self->strip->stridelen,
- 0.0001f, 1000.0 );
-}
-
-/*
- * return the stride bone name
- */
-
-static PyObject *ActionStrip_getStrideBone( BPy_ActionStrip * self )
-{
- if( !self->strip )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This strip has been removed!" );
-
- return PyString_FromString( self->strip->stridechannel );
-}
-
-static PyObject *ActionStrip_getGroupTarget( BPy_ActionStrip * self )
-{
- if( !self->strip )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This strip has been removed!" );
-
- if (self->strip->object) {
- return Object_CreatePyObject( self->strip->object );
- } else {
- Py_RETURN_NONE;
- }
-}
-
-/*
- * set the stride bone name
- */
-
-static int ActionStrip_setStrideBone( BPy_ActionStrip * self, PyObject * attr )
-{
- char *name = PyString_AsString( attr );
- if( !name )
- return EXPP_ReturnIntError( PyExc_TypeError, "expected string arg" );
-
- if( !self->strip )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "This strip has been removed!" );
-
- BLI_strncpy( self->strip->stridechannel, name, 32 );
-
- return 0;
-}
-
-static int ActionStrip_setGroupTarget( BPy_ActionStrip * self, PyObject * args )
-{
- if( !self->strip )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "This strip has been removed!" );
-
- if( (PyObject *)args == Py_None )
- self->strip->object = NULL;
- else if( BPy_Object_Check( args ) )
- self->strip->object = ((BPy_Object *)args)->object;
- else
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected an object or None" );
- return 0;
-}
-
-/*****************************************************************************/
-/* Python BPy_Constraint attributes get/set structure: */
-/*****************************************************************************/
-static PyGetSetDef BPy_ActionStrip_getseters[] = {
- {"action",
- (getter)ActionStrip_getAction, (setter)NULL,
- "Action associated with the strip", NULL},
- {"stripStart",
- (getter)ActionStrip_getStripStart, (setter)ActionStrip_setStripStart,
- "Starting frame of the strip", NULL},
- {"stripEnd",
- (getter)ActionStrip_getStripEnd, (setter)ActionStrip_setStripEnd,
- "Ending frame of the strip", NULL},
- {"actionStart",
- (getter)ActionStrip_getActionStart, (setter)ActionStrip_setActionStart,
- "Starting frame of the action", NULL},
- {"actionEnd",
- (getter)ActionStrip_getActionEnd, (setter)ActionStrip_setActionEnd,
- "Ending frame of the action", NULL},
- {"repeat",
- (getter)ActionStrip_getRepeat, (setter)ActionStrip_setRepeat,
- "The number of times to repeat the action range", NULL},
- {"blendIn",
- (getter)ActionStrip_getBlendIn, (setter)ActionStrip_setBlendIn,
- "Number of frames of motion blending", NULL},
- {"blendOut",
- (getter)ActionStrip_getBlendOut, (setter)ActionStrip_setBlendOut,
- "Number of frames of ease-out", NULL},
- {"mode",
- (getter)ActionStrip_getBlendMode, (setter)ActionStrip_setBlendMode,
- "Setting of blending mode", NULL},
- {"flag",
- (getter)ActionStrip_getFlag, (setter)ActionStrip_setFlag,
- "Setting of blending flags", NULL},
- {"strideAxis",
- (getter)ActionStrip_getStrideAxis, (setter)ActionStrip_setStrideAxis,
- "Dominant axis for stride bone", NULL},
- {"strideLength",
- (getter)ActionStrip_getStrideLength, (setter)ActionStrip_setStrideLength,
- "Distance covered by one complete cycle of the action", NULL},
- {"strideBone",
- (getter)ActionStrip_getStrideBone, (setter)ActionStrip_setStrideBone,
- "Name of Bone used for stride", NULL},
- {"groupTarget",
- (getter)ActionStrip_getGroupTarget, (setter)ActionStrip_setGroupTarget,
- "Name of target armature within group", NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-/*****************************************************************************/
-/* Python BPy_ActionStrip methods: */
-/*****************************************************************************/
-
-/*
- * restore the values of ActionStart and ActionEnd to their defaults
- */
-
-static PyObject *ActionStrip_resetLimits( BPy_ActionStrip *self )
-{
- bActionStrip *strip = self->strip;
-
- if( !strip )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This strip has been removed!" );
-
- calc_action_range( strip->act, &strip->actstart, &strip->actend, 1 );
-
- Py_RETURN_NONE;
-}
-
-/*
- * reset the strip size
- */
-
-static PyObject *ActionStrip_resetStripSize( BPy_ActionStrip *self )
-{
- float mapping;
- bActionStrip *strip = self->strip;
-
- if( !strip )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This strip has been removed!" );
-
- mapping = (strip->actend - strip->actstart) / (strip->end - strip->start);
- strip->end = strip->start + mapping*(strip->end - strip->start);
-
- Py_RETURN_NONE;
-}
-
-/*
- * snap to start and end to nearest frames
- */
-
-static PyObject *ActionStrip_snapToFrame( BPy_ActionStrip *self )
-{
- bActionStrip *strip = self->strip;
-
- if( !strip )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This strip has been removed!" );
-
- strip->start= (float)floor(strip->start+0.5);
- strip->end= (float)floor(strip->end+0.5);
-
- Py_RETURN_NONE;
-}
-
-/*****************************************************************************/
-/* Python BPy_ActionStrip methods table: */
-/*****************************************************************************/
-static PyMethodDef BPy_ActionStrip_methods[] = {
- /* name, method, flags, doc */
- {"resetActionLimits", ( PyCFunction ) ActionStrip_resetLimits, METH_NOARGS,
- "Restores the values of ActionStart and ActionEnd to their defaults"},
- {"resetStripSize", ( PyCFunction ) ActionStrip_resetStripSize, METH_NOARGS,
- "Resets the Action Strip size to its creation values"},
- {"snapToFrame", ( PyCFunction ) ActionStrip_snapToFrame, METH_NOARGS,
- "Snaps the ends of the action strip to the nearest whole numbered frame"},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Python ActionStrip_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject ActionStrip_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender.ActionStrip", /* char *tp_name; */
- sizeof( BPy_ActionStrip ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL, /* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- NULL, /* cmpfunc tp_compare; */
- ( reprfunc ) NULL, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- 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; */
- 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, /* 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, /* 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 ***/
- BPy_ActionStrip_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_ActionStrip_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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 PyObject *M_ActionStrip_FlagsDict( void )
-{
- PyObject *S = PyConstant_New( );
-
- if( S ) {
- BPy_constant *d = ( BPy_constant * ) S;
- PyConstant_Insert( d, "SELECT",
- PyInt_FromLong( ACTSTRIP_SELECT ) );
- PyConstant_Insert( d, "STRIDE_PATH",
- PyInt_FromLong( ACTSTRIP_USESTRIDE ) );
- PyConstant_Insert( d, "HOLD",
- PyInt_FromLong( ACTSTRIP_HOLDLASTFRAME ) );
- PyConstant_Insert( d, "ACTIVE",
- PyInt_FromLong( ACTSTRIP_ACTIVE ) );
- PyConstant_Insert( d, "LOCK_ACTION",
- PyInt_FromLong( ACTSTRIP_LOCK_ACTION ) );
- }
- return S;
-}
-
-static PyObject *M_ActionStrip_AxisDict( void )
-{
- PyObject *S = PyConstant_New( );
-
- if( S ) {
- BPy_constant *d = ( BPy_constant * ) S;
- PyConstant_Insert( d, "STRIDEAXIS_X",
- PyInt_FromLong( ACTSTRIP_STRIDEAXIS_X ) );
- PyConstant_Insert( d, "STRIDEAXIS_Y",
- PyInt_FromLong( ACTSTRIP_STRIDEAXIS_Y ) );
- PyConstant_Insert( d, "STRIDEAXIS_Z",
- PyInt_FromLong( ACTSTRIP_STRIDEAXIS_Z ) );
- }
- return S;
-}
-
-static PyObject *M_ActionStrip_ModeDict( void )
-{
- PyObject *S = PyConstant_New( );
-
- if( S ) {
- BPy_constant *d = ( BPy_constant * ) S;
- PyConstant_Insert( d, "MODE_ADD",
- PyInt_FromLong( ACTSTRIPMODE_ADD ) );
- }
- return S;
-}
-
-PyObject *ActionStrip_CreatePyObject( struct bActionStrip *strip )
-{
- BPy_ActionStrip *pyobj;
- pyobj = ( BPy_ActionStrip * ) PyObject_NEW( BPy_ActionStrip,
- &ActionStrip_Type );
- if( !pyobj )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create BPy_ActionStrip object" );
- pyobj->strip = strip;
- return ( PyObject * ) pyobj;
-}
-
-/*****************************************************************************/
-/* ActionStrip Sequence wrapper */
-/*****************************************************************************/
-
-/*
- * Initialize the iterator
- */
-
-static PyObject *ActionStrips_getIter( BPy_ActionStrips * self )
-{
- self->iter = (bActionStrip *)self->ob->nlastrips.first;
- return EXPP_incr_ret ( (PyObject *) self );
-}
-
-/*
- * Get the next action strip
- */
-
-static PyObject *ActionStrips_nextIter( BPy_ActionStrips * self )
-{
- bActionStrip *strip = self->iter;
- if( strip ) {
- self->iter = strip->next;
- return ActionStrip_CreatePyObject( strip );
- }
-
- return EXPP_ReturnPyObjError( PyExc_StopIteration,
- "iterator at end" );
-}
-
-/* return the number of action strips */
-
-static int ActionStrips_length( BPy_ActionStrips * self )
-{
- return BLI_countlist( &self->ob->nlastrips );
-}
-
-/* return an action strip */
-
-static PyObject *ActionStrips_item( BPy_ActionStrips * self, int i )
-{
- bActionStrip *strip = NULL;
-
- /* if index is negative, start counting from the end of the list */
- if( i < 0 )
- i += ActionStrips_length( self );
-
- /* skip through the list until we get the strip or end of list */
-
- strip = self->ob->nlastrips.first;
-
- while( i && strip ) {
- --i;
- strip = strip->next;
- }
-
- if( strip )
- return ActionStrip_CreatePyObject( strip );
- else
- return EXPP_ReturnPyObjError( PyExc_IndexError,
- "array index out of range" );
-}
-
-/*****************************************************************************/
-/* Python BPy_ActionStrips sequence table: */
-/*****************************************************************************/
-static PySequenceMethods ActionStrips_as_sequence = {
- ( inquiry ) ActionStrips_length, /* sq_length */
- ( binaryfunc ) 0, /* sq_concat */
- ( intargfunc ) 0, /* sq_repeat */
- ( intargfunc ) ActionStrips_item, /* sq_item */
- ( intintargfunc ) 0, /* sq_slice */
- ( intobjargproc ) 0, /* sq_ass_item */
- ( intintobjargproc ) 0, /* sq_ass_slice */
- ( objobjproc ) 0, /* sq_contains */
- ( binaryfunc ) 0, /* sq_inplace_concat */
- ( intargfunc ) 0, /* sq_inplace_repeat */
-};
-
-
-/*****************************************************************************/
-/* Python BPy_ActionStrip methods: */
-/*****************************************************************************/
-
-/*
- * helper function to check for a valid action strip argument
- */
-
-static bActionStrip *locate_strip( BPy_ActionStrips *self,
- PyObject *args, BPy_ActionStrip **stripobj )
-{
- bActionStrip *strip = NULL;
- BPy_ActionStrip *pyobj;
-
- /* check that argument is a constraint */
- if( !PyArg_ParseTuple( args, "O!", &ActionStrip_Type, &pyobj ) ) {
- EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected an action strip as an argument" );
- return NULL;
- }
-
- if( !pyobj->strip ) {
- EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This strip has been removed!" );
- return NULL;
- }
-
- /* if caller needs the object, return it */
- if( stripobj )
- *stripobj = pyobj;
-
- /* find the action strip in the NLA */
- for( strip = self->ob->nlastrips.first; strip; strip = strip->next )
- if( strip == pyobj->strip )
- return strip;
-
- /* return exception if we can't find the strip */
- EXPP_ReturnPyObjError( PyExc_AttributeError,
- "action strip does not belong to this object" );
- return NULL;
-}
-
-/*
- * remove an action strip from the NLA
- */
-
-static PyObject *ActionStrips_remove( BPy_ActionStrips *self, PyObject * args )
-{
- BPy_ActionStrip *pyobj;
- bActionStrip *strip = locate_strip( self, args, &pyobj );
-
- /* return exception if we can't find the strip */
- if( !strip )
- return (PyObject *)NULL;
-
- /* do the actual removal */
- free_actionstrip(strip);
- BLI_remlink(&self->ob->nlastrips, strip);
- MEM_freeN(strip);
-
- pyobj->strip = NULL;
- Py_RETURN_NONE;
-}
-
-/*
- * move an action strip up in the strip list
- */
-
-static PyObject *ActionStrips_moveUp( BPy_ActionStrips *self, PyObject * args )
-{
- bActionStrip *strip = locate_strip( self, args, NULL );
-
- /* return exception if we can't find the strip */
- if( !strip )
- return (PyObject *)NULL;
-
- /* if strip is not already the first, move it up */
- if( strip != self->ob->nlastrips.first ) {
- BLI_remlink(&self->ob->nlastrips, strip);
- BLI_insertlink(&self->ob->nlastrips, strip->prev->prev, strip);
- }
-
- Py_RETURN_NONE;
-}
-
-/*
- * move an action strip down in the strip list
- */
-
-static PyObject *ActionStrips_moveDown( BPy_ActionStrips *self, PyObject * args )
-{
- bActionStrip *strip = locate_strip( self, args, NULL );
-
- /* return exception if we can't find the strip */
- if( !strip )
- return (PyObject *)NULL;
-
- /* if strip is not already the last, move it down */
- if( strip != self->ob->nlastrips.last ) {
- BLI_remlink(&self->ob->nlastrips, strip);
- BLI_insertlink(&self->ob->nlastrips, strip->next, strip);
- }
-
- Py_RETURN_NONE;
-}
-
-static PyObject *ActionStrips_append( BPy_ActionStrips *self, PyObject * args )
-{
- BPy_Action *pyobj;
- Object *ob;
- bActionStrip *strip;
- bAction *act;
-
- /* check that argument is an action */
- if( !PyArg_ParseTuple( args, "O!", &Action_Type, &pyobj ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected an action as an argument" );
-
- ob = self->ob;
- act = pyobj->action;
-
- /* Initialize the new action block */
- strip = MEM_callocN( sizeof(bActionStrip), "bActionStrip" );
-
- strip->act = act;
- calc_action_range( strip->act, &strip->actstart, &strip->actend, 1 );
- strip->start = (float)G.scene->r.cfra;
- strip->end = strip->start + ( strip->actend - strip->actstart );
- /* simple prevention of zero strips */
- if( strip->start > strip->end-2 )
- strip->end = strip->start+100;
-
- strip->flag = ACTSTRIP_LOCK_ACTION;
- find_stridechannel(ob, strip);
-
- strip->repeat = 1.0;
- act->id.us++;
-
- BLI_addtail(&ob->nlastrips, strip);
-
- Py_RETURN_NONE;
-}
-
-/*****************************************************************************/
-/* Python BPy_ActionStrips methods table: */
-/*****************************************************************************/
-static PyMethodDef BPy_ActionStrips_methods[] = {
- /* name, method, flags, doc */
- {"append", ( PyCFunction ) ActionStrips_append, METH_VARARGS,
- "(action) - append a new actionstrip using existing action"},
- {"remove", ( PyCFunction ) ActionStrips_remove, METH_VARARGS,
- "(strip) - remove an existing strip from this actionstrips"},
- {"moveUp", ( PyCFunction ) ActionStrips_moveUp, METH_VARARGS,
- "(strip) - move an existing strip up in the actionstrips"},
- {"moveDown", ( PyCFunction ) ActionStrips_moveDown, METH_VARARGS,
- "(strip) - move an existing strip down in the actionstrips"},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Python ActionStrips_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject ActionStrips_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender.ActionStrips", /* char *tp_name; */
- sizeof( BPy_ActionStrips ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL, /* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- NULL, /* cmpfunc tp_compare; */
- ( reprfunc ) NULL, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- &ActionStrips_as_sequence, /* 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; */
- 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, /* 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, /* richcmpfunc tp_richcompare; */
-
- /*** weak reference enabler ***/
- 0, /* long tp_weaklistoffset; */
-
- /*** Added in release 2.2 ***/
- /* Iterators */
- ( getiterfunc )ActionStrips_getIter, /* getiterfunc tp_iter; */
- ( iternextfunc )ActionStrips_nextIter, /* iternextfunc tp_iternext; */
-
- /*** Attribute descriptor and subclassing stuff ***/
- BPy_ActionStrips_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- NULL, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-PyObject *ActionStrips_CreatePyObject( Object *ob )
-{
- BPy_ActionStrips *pyseq;
- pyseq = ( BPy_ActionStrips * ) PyObject_NEW( BPy_ActionStrips,
- &ActionStrips_Type );
- if( !pyseq )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create BPy_ActionStrips object" );
- pyseq->ob = ob;
- return ( PyObject * ) pyseq;
-}
-
-/*****************************************************************************/
-/* Function: NLA_Init */
-/*****************************************************************************/
-PyObject *NLA_Init( void )
-{
- PyObject *FlagsDict = M_ActionStrip_FlagsDict( );
- PyObject *AxisDict = M_ActionStrip_AxisDict( );
- PyObject *ModeDict = M_ActionStrip_ModeDict( );
- PyObject *submodule;
-
- if( PyType_Ready( &Action_Type ) < 0
- || PyType_Ready( &ActionStrip_Type ) < 0
- || PyType_Ready( &ActionStrips_Type ) < 0 )
- return NULL;
-
- submodule = Py_InitModule3( "Blender.Armature.NLA",
- M_NLA_methods, M_NLA_doc );
-
- if( FlagsDict )
- PyModule_AddObject( submodule, "Flags", FlagsDict );
- if( AxisDict )
- PyModule_AddObject( submodule, "StrideAxes", AxisDict );
- if( ModeDict )
- PyModule_AddObject( submodule, "Modes", ModeDict );
-
- return submodule;
-}
diff --git a/source/blender/python/api2_2x/NLA.h b/source/blender/python/api2_2x/NLA.h
deleted file mode 100644
index 50bfa32b7e7..00000000000
--- a/source/blender/python/api2_2x/NLA.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * $Id: NLA.h 10269 2007-03-15 01:09:14Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Joseph Gilbert, Ken Hughes
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_NLA_H
-#define EXPP_NLA_H
-
-#include <Python.h>
-#include "DNA_action_types.h"
-#include "DNA_nla_types.h"
-
-struct Object;
-
-/** NLA module initialization function. */
-PyObject *NLA_Init( void );
-
-extern PyTypeObject Action_Type;
-extern PyTypeObject ActionStrip_Type;
-extern PyTypeObject ActionStrips_Type;
-
-/** Python BPy_NLA structure definition. */
-typedef struct {
- PyObject_HEAD
- bAction * action; /* libdata must be second */
-} BPy_Action;
-
-typedef struct {
- PyObject_HEAD
- bActionStrip * strip;
-} BPy_ActionStrip;
-
-typedef struct {
- PyObject_HEAD
- struct Object * ob;
- struct bActionStrip *iter;
-} BPy_ActionStrips;
-
-/* Type checking for EXPP PyTypes */
-#define BPy_Action_Check(v) ((v)->ob_type == &Action_Type)
-#define BPy_ActionStrip_Check(v) ((v)->ob_type == &ActionStrip_Type)
-#define BPy_ActionStrips_Check(v) ((v)->ob_type == &ActionStrips_Type)
-
-PyObject *Action_CreatePyObject( struct bAction *action );
-bAction *Action_FromPyObject( PyObject * py_obj );
-
-PyObject *ActionStrip_CreatePyObject( struct bActionStrip *strip );
-PyObject *ActionStrips_CreatePyObject( struct Object *ob );
-
-#endif
diff --git a/source/blender/python/api2_2x/NMesh.c b/source/blender/python/api2_2x/NMesh.c
deleted file mode 100644
index 6570613e94a..00000000000
--- a/source/blender/python/api2_2x/NMesh.c
+++ /dev/null
@@ -1,4164 +0,0 @@
-/*
- * $Id: NMesh.c 12108 2007-09-22 17:54:13Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender, but it borrows all the old NMesh code.
- *
- * Contributor(s): Willian P. Germano, Jordi Rovira i Bonet, Joseph Gilbert,
- * Bala Gi, Alexander Szakaly, Stephane Soppera, Campbell Barton, Ken Hughes,
- * Daniel Dunbar.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include "NMesh.h" /*This must come first*/
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_key_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_space_types.h"
-#include "DNA_curve_types.h"
-
-#include "BDR_editface.h" /* make_tfaces */
-#include "BDR_vpaint.h"
-#include "BDR_editobject.h"
-
-#include "BIF_editdeform.h"
-#include "BIF_editkey.h" /* insert_meshkey */
-#include "BIF_editview.h"
-#include "BIF_space.h"
-
-#include "BKE_customdata.h"
-#include "BKE_deform.h"
-#include "BKE_mesh.h"
-#include "BKE_material.h"
-#include "BKE_main.h"
-#include "BKE_global.h"
-#include "BKE_library.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_displist.h"
-#include "BKE_object.h"
-#include "BKE_mball.h"
-#include "BKE_utildefines.h"
-#include "BKE_depsgraph.h"
-#include "BKE_idprop.h"
-
-#include "BLI_arithb.h"
-#include "BLI_blenlib.h"
-
-#include "blendef.h"
-#include "mydevice.h"
-#include "Object.h"
-#include "Key.h"
-#include "Mathutils.h"
-#include "IDProp.h"
-#include "constant.h"
-#include "gen_utils.h"
-#include "gen_library.h"
-
-extern void countall(void);
-
-/* EXPP Mesh defines */
-
-#define NMESH_FRAME_MAX 30000
-#define NMESH_SMOOTHRESH 30
-#define NMESH_SMOOTHRESH_MIN 1
-#define NMESH_SMOOTHRESH_MAX 80
-#define NMESH_SUBDIV 1
-#define NMESH_SUBDIV_MIN 0
-#define NMESH_SUBDIV_MAX 6
-
-/* Globals */
-static PyObject *g_nmeshmodule = NULL;
-
-static int unlink_existingMeshData( Mesh * mesh );
-static int convert_NMeshToMesh( Mesh *mesh, BPy_NMesh *nmesh );
-static void check_dverts(Mesh *me, int old_totverts);
-static PyObject *NMesh_printDebug( PyObject * self );
-static PyObject *NMesh_addEdge( PyObject * self, PyObject * args );
-static PyObject *NMesh_findEdge( PyObject * self, PyObject * args );
-static PyObject *NMesh_removeEdge( PyObject * self, PyObject * args );
-static PyObject *NMesh_addFace( PyObject * self, PyObject * args );
-static PyObject *NMesh_removeFace( PyObject * self, PyObject * args );
-static PyObject *NMesh_addVertGroup( PyObject * self, PyObject * args );
-static PyObject *NMesh_removeVertGroup( PyObject * self, PyObject * args );
-static PyObject *NMesh_assignVertsToGroup( PyObject * self, PyObject * args );
-static PyObject *NMesh_removeVertsFromGroup( PyObject * self,PyObject * args );
-static PyObject *NMesh_getVertsFromGroup( PyObject * self, PyObject * args );
-static PyObject *NMesh_renameVertGroup( PyObject * self, PyObject * args );
-static PyObject *NMesh_getVertGroupNames( PyObject * self );
-static PyObject *NMesh_transform (PyObject *self, PyObject *args);
-
-static char NMesh_printDebug_doc[] =
- "print debug info about the mesh.";
-
-static char NMesh_getKey_doc[] =
- "get the Key object linked to this mesh";
-
-static char NMesh_addEdge_doc[] =
- "create an edge between two vertices.\n\
-If an edge already exists between those vertices, it is returned.\n\
-(In Blender, only zero or one edge can link two vertices.)\n\
-Created edge is automatically added to edges list.";
-
-static char NMesh_findEdge_doc[] =
- "find an edge between two vertices.";
-
-static char NMesh_removeEdge_doc[] =
- "remove an edge between two vertices.\n\
-All faces using this edge are removed from faces list.";
-
-static char NMesh_addFace_doc[] =
- "add a face to face list and add to edge list (if edge data exists) necessary edges.";
-
-static char NMesh_removeFace_doc[] =
- "remove a face for face list and remove edges no more used by any other face (if \
-edge data exists).";
-
-static char NMesh_addVertGroup_doc[] =
- "add a named and empty vertex(deform) Group to a mesh that has been linked\n\
-to an object. ";
-
-static char NMesh_removeVertGroup_doc[] =
- "remove a named vertex(deform) Group from a mesh that has been linked\n\
-to an object. Will remove all verts assigned to group.";
-
-static char NMesh_assignVertsToGroup_doc[] =
- "Adds an array (a python list) of vertex points (by index) to a named\n\
-vertex group. The list will have an associated wieght assigned to them.\n\
-The weight represents the amount of influence this group has over these\n\
-vertex points. Weights should be in the range of 0.0 - 1.0.\n\
-The assignmode can be either 'add', 'subtract', or 'replace'. If this vertex\n\
-is not assigned to the group 'add' creates a new association with the weight\n\
-specified, otherwise the weight given is added to the current weight of the\n\
-vertex.\n\
-'subtract' will attempt to subtract the weight passed from a vertex already\n\
-associated with a group, else it does nothing. 'replace' attempts to replace\n\
-the weight with the new weight value for an already associated vertex/group,\n\
-else it does nothing. The mesh must have all it's vertex points set before\n\
-attempting to assign any vertex points to a vertex group.";
-
-static char NMesh_removeVertsFromGroup_doc[] =
- "Remove an array (a python list) of vertex points from a named group in a\n\
-mesh that has been linked to an object. If no list is given this will remove\n\
-all vertex point associations with the group passed";
-
-static char NMesh_getVertsFromGroup_doc[] =
- "By passing a python list of vertex indices and a named group, this will\n\
-return a python list representing the indeces that are a part of this vertex.\n\
-group. If no association was found for the index passed nothing will be\n\
-return for the index. An optional flag will also return the weights as well";
-
-static char NMesh_renameVertGroup_doc[] = "Renames a vertex group";
-
-static char NMesh_getVertGroupNames_doc[] =
- "Returns a list of all the vertex group names";
-
-static char M_NMesh_doc[] = "The Blender.NMesh submodule";
-
-static char M_NMesh_Col_doc[] = "([r, g, b, a]) - Get a new mesh color\n\n\
-[r=255, g=255, b=255, a=255] Specify the color components";
-
-static char M_NMesh_Face_doc[] =
- "(vertexlist = None) - Get a new face, and pass optional vertex list";
-
-static char NMFace_append_doc[] =
- "(vert) - appends Vertex 'vert' to face vertex list";
-
-static char M_NMesh_Vert_doc[] = "([x, y, z]) - Get a new vertex\n\n\
-[x, y, z] Specify new coordinates";
-
-static char NMesh_getMaterials_doc[] =
- "(i = -1) - Get this mesh's list of materials.\n\
-(i = -1) - int: determines the list's contents:\n\
--1: return the current list, possibly modified by the script (default);\n\
- 0: get a fresh list from the Blender mesh -- modifications not included,\n\
- unless the script called mesh.update() first;\n\
- 1: like 0, but does not ignore empty slots, returns them as 'None'.";
-
-static char NMesh_setMaterials_doc[] =
- "(matlist) - Set this mesh's list of materials. This method makes sure\n\
-the passed matlist is valid (can only include up to 16 materials and None's).";
-
-static char NMesh_addMaterial_doc[] =
- "(material) - add a new Blender Material 'material' to this Mesh's materials\n\
-list.";
-
-static char NMesh_insertKey_doc[] =
- "(frame = None, type = 'relative') - inserts a Mesh key at the given frame\n\
-if called without arguments, it inserts the key at the current Scene frame.\n\
-(type) - 'relative' or 'absolute'. Only relevant on the first call to this\n\
-function for each nmesh.";
-
-static char NMesh_removeAllKeys_doc[] =
- "() - removes all keys from this mesh\n\
-returns True if successful or False if this NMesh wasn't linked to a real\n\
-Blender Mesh yet or the Mesh had no keys";
-
-static char NMesh_getSelectedFaces_doc[] =
- "(flag = None) - returns list of selected Faces\n\
-If flag = 1, return indices instead";
-
-static char NMesh_getActiveFace_doc[] =
- "returns the index of the active face ";
-
-static char NMesh_hasVertexUV_doc[] =
- "(flag = None) - returns 1 if Mesh has per vertex UVs ('Sticky')\n\
-The optional argument sets the Sticky flag";
-
-static char NMesh_hasFaceUV_doc[] =
- "(flag = None) - returns 1 if Mesh has textured faces\n\
-The optional argument sets the textured faces flag";
-
-static char NMesh_hasVertexColours_doc[] =
- "(flag = None) - returns 1 if Mesh has vertex colors.\n\
-The optional argument sets the vertex color flag";
-
-static char NMesh_getVertexInfluences_doc[] =
- "Return a list of the influences of bones in the vertex \n\
-specified by index. The list contains pairs with the \n\
-bone name and the weight.";
-
-static char NMesh_update_doc[] =
-"(recalc_normals = 0, store_edges = 0, vertex_shade = 0) - Updates the Mesh.\n\
-Optional arguments: if given and nonzero:\n\
-'recalc_normals': normal vectors are recalculated;\n\
-'store_edges': edges data is stored.\n\
-'vertex_shade': vertex colors are added based on the current lamp setup.";
-
-static char NMesh_getMode_doc[] =
- "() - get the mode flags of this nmesh as an or'ed int value.";
-
-static char NMesh_setMode_doc[] =
- "(int or none to 5 strings) - set the mode flags of this nmesh.\n\
-() - unset all flags.";
-
-static char NMesh_getMaxSmoothAngle_doc[] =
- "() - get the max smooth angle for mesh auto smoothing.";
-
-static char NMesh_setMaxSmoothAngle_doc[] =
- "(int) - set the max smooth angle for mesh auto smoothing in the range\n\
-[1,80] in degrees.";
-
-static char NMesh_getSubDivLevels_doc[] =
- "() - get the subdivision levels for display and rendering: [display, render]";
-
-static char NMesh_setSubDivLevels_doc[] =
- "([int, int]) - set the subdivision levels for [display, render] -- they are\n\
-clamped to the range [0,6].";
-
-static char M_NMesh_New_doc[] =
- "() - returns a new, empty NMesh mesh object\n";
-
-static char M_NMesh_GetRaw_doc[] = "([name]) - Get a raw mesh from Blender\n\n\
-[name] Name of the mesh to be returned\n\n\
-If name is not specified a new empty mesh is\n\
-returned, otherwise Blender returns an existing\n\
-mesh.";
-
-static char M_NMesh_GetNames_doc[] = "\
-() - Get a list with the names of all available meshes in Blender\n\n\
-Any of these names can be passed to NMesh.GetRaw() for the actual mesh data.";
-
-static char M_NMesh_GetRawFromObject_doc[] =
- "(name) - Get the raw mesh used by a Blender object\n\n\
-(name) Name of the object to get the mesh from\n\n\
-This returns the mesh as used by the object, which\n\
-means it contains all deformations and modifications.";
-
-static char M_NMesh_PutRaw_doc[] =
- "(mesh, name = None, recalc_normals = 1, store_edges = 0]) -\n\
-Return a raw mesh to Blender\n\n\
-(mesh) The NMesh object to store\n\
-[name] The mesh to replace\n\
-[recalc_normals = 1] Flag to control vertex normal recalculation\n\
-[store_edges=0] Store edges data in the blender mesh\n\
-If the name of a mesh to replace is not given a new\n\
-object is created and returned.";
-
-static char NMesh_transform_doc[] =
-"(matrix, recalc_normals = 0) - Transform the mesh by the supplied 4x4 matrix\n\
-if recalc_normals is True, vertex normals are transformed along with \n\
-vertex coordinatess.\n";
-
-
-void mesh_update( Mesh * mesh, Object * ob )
-{
- if (ob) {
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- }
- else {
- ob = G.main->object.first;
- while (ob) {
- if (ob->data == mesh) {
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- break;
- }
- ob = ob->id.next;
- }
- }
-}
-
-/*
- * before trying to convert NMesh data back to mesh, verify that the
- * lists contain the right type of data
- */
-
-static int check_NMeshLists( BPy_NMesh *nmesh )
-{
- int i;
-
- if( !PySequence_Check( nmesh->verts ) )
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "nmesh verts are not a sequence" );
- if( !PySequence_Check( nmesh->edges ) )
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "nmesh edges are not a sequence" );
- if( !PySequence_Check( nmesh->faces ) )
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "nmesh faces are not a sequence" );
- if( !PySequence_Check( nmesh->materials ) )
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "nmesh materials are not a sequence" );
-
- if( EXPP_check_sequence_consistency( nmesh->verts, &NMVert_Type ) != 1 )
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "nmesh vertices must be NMVerts" );
- if( EXPP_check_sequence_consistency( nmesh->edges, &NMEdge_Type ) != 1 )
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "nmesh edges must be NMEdges" );
- if( EXPP_check_sequence_consistency( nmesh->faces, &NMFace_Type ) != 1 )
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "nmesh faces must be NMFaces" );
- for( i = 0 ; i < PySequence_Length(nmesh->faces); ++i ) {
- int j, err=0;
- PyObject *col, *v, *uv;
- BPy_NMFace *face=(BPy_NMFace *)PySequence_GetItem(nmesh->faces, i);
-
- col = face->col;
- uv = face->uv;
- v = face->v;
- Py_DECREF( face );
- if( EXPP_check_sequence_consistency( face->col, &NMCol_Type ) != 1 ) {
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "nmesh face col must be NMCols" );
- }
- if( EXPP_check_sequence_consistency( face->v, &NMVert_Type ) != 1 )
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "nmesh face v must be NMVerts" );
-
- for( j = 0 ; !err && j < PySequence_Length( face->uv ); ++j ) {
- PyObject *uv = PySequence_GetItem( face->uv, j);
- if( PySequence_Check(uv) && PySequence_Length(uv) == 2 ) {
- PyObject *p1 = PySequence_GetItem(uv, 0);
- PyObject *p2 = PySequence_GetItem(uv, 1);
- if( !PyNumber_Check(p1) || !PyNumber_Check(p2) )
- err = 1;
- Py_DECREF( p1 );
- Py_DECREF( p2 );
- }
- else {
- err = 1;
- }
-
- Py_DECREF( uv );
- }
- if( err )
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "nmesh face uv must contain sequence of 2 floats" );
- }
- return 0;
-}
-
-
-/*****************************/
-/* Mesh Color Object */
-/*****************************/
-
-static void NMCol_dealloc( PyObject * self )
-{
- PyObject_DEL( self );
-}
-
-static BPy_NMCol *newcol( char r, char g, char b, char a )
-{
- BPy_NMCol *mc = ( BPy_NMCol * ) PyObject_NEW( BPy_NMCol, &NMCol_Type );
-
- mc->r = r;
- mc->g = g;
- mc->b = b;
- mc->a = a;
-
- return mc;
-}
-
-static PyObject *M_NMesh_Col( PyObject * self, PyObject * args )
-{
- char r = 255, g = 255, b = 255, a = 255;
-
- if( PyArg_ParseTuple( args, "|bbbb", &r, &g, &b, &a ) )
- return ( PyObject * ) newcol( r, g, b, a );
-
- return NULL;
-}
-
-static PyObject *NMCol_getattr( PyObject * self, char *name )
-{
- BPy_NMCol *mc = ( BPy_NMCol * ) self;
-
- if( strcmp( name, "r" ) == 0 )
- return Py_BuildValue( "i", mc->r );
- else if( strcmp( name, "g" ) == 0 )
- return Py_BuildValue( "i", mc->g );
- else if( strcmp( name, "b" ) == 0 )
- return Py_BuildValue( "i", mc->b );
- else if( strcmp( name, "a" ) == 0 )
- return Py_BuildValue( "i", mc->a );
- else if( strcmp( name, "__members__" ) == 0 )
- return Py_BuildValue( "[s,s,s,s]", "r", "g", "b", "a" );
-
- return EXPP_ReturnPyObjError( PyExc_AttributeError, name );
-}
-
-static int NMCol_setattr( PyObject * self, char *name, PyObject * v )
-{
- BPy_NMCol *mc = ( BPy_NMCol * ) self;
- char ival;
-
- if( !PyArg_Parse( v, "b", &ival ) )
- return -1;
-
- ival = ( char ) EXPP_ClampInt( ival, 0, 255 );
-
- if( strcmp( name, "r" ) == 0 )
- mc->r = (unsigned char)ival;
- else if( strcmp( name, "g" ) == 0 )
- mc->g = (unsigned char)ival;
- else if( strcmp( name, "b" ) == 0 )
- mc->b = (unsigned char)ival;
- else if( strcmp( name, "a" ) == 0 )
- mc->a = (unsigned char)ival;
- else
- return -1;
-
- return 0;
-}
-
-static PyObject *NMCol_repr( BPy_NMCol * self )
-{
- static char s[256];
- sprintf( s, "[NMCol - <%d, %d, %d, %d>]", self->r, self->g, self->b,
- self->a );
- return Py_BuildValue( "s", s );
-}
-
-PyTypeObject NMCol_Type = {
- PyObject_HEAD_INIT( NULL ) 0, /* ob_size */
- "Blender NMCol", /* tp_name */
- sizeof( BPy_NMCol ), /* tp_basicsize */
- 0, /* tp_itemsize */
- /* methods */
- ( destructor ) NMCol_dealloc, /* tp_dealloc */
- ( printfunc ) 0, /* tp_print */
- ( getattrfunc ) NMCol_getattr, /* tp_getattr */
- ( setattrfunc ) NMCol_setattr, /* tp_setattr */
- 0, /* tp_compare */
- ( reprfunc ) NMCol_repr, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 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, /* up to tp_del to avoid a warning */
-};
-
-/*****************************/
-/* NMesh Python Object */
-/*****************************/
-static void NMFace_dealloc( PyObject * self )
-{
- BPy_NMFace *mf = ( BPy_NMFace * ) self;
-
- Py_DECREF( mf->v );
- Py_DECREF( mf->uv );
- Py_DECREF( mf->col );
-
- PyObject_DEL( self );
-}
-
-static PyObject *new_NMFace( PyObject * vertexlist )
-{
- BPy_NMFace *mf = PyObject_NEW( BPy_NMFace, &NMFace_Type );
- PyObject *vlcopy;
-
- if( vertexlist ) { /* create a copy of the given vertex list */
- PyObject *item;
- int i, len = PyList_Size( vertexlist );
-
- vlcopy = PyList_New( len );
-
- if( !vlcopy ) {
- Py_DECREF(mf);
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create PyList" );
- }
- for( i = 0; i < len; i++ ) {
- item = PySequence_GetItem( vertexlist, i ); /* PySequence increfs */
-
- if( item )
- PyList_SET_ITEM( vlcopy, i, item );
- else {
- Py_DECREF(mf);
- Py_DECREF(vlcopy);
- return EXPP_ReturnPyObjError
- ( PyExc_RuntimeError,
- "couldn't get vertex from a PyList" );
- }
- }
- } else /* create an empty vertex list */
- vlcopy = PyList_New( 0 );
-
- mf->v = vlcopy;
- mf->uv = PyList_New( 0 );
- mf->image = NULL;
- mf->mode = TF_DYNAMIC + TF_TEX;
- mf->flag = TF_SELECT;
- mf->transp = TF_SOLID;
- mf->col = PyList_New( 0 );
-
- mf->mf_flag = 0;
- mf->mat_nr = 0;
- mf->orig_index = -1;
-
- return ( PyObject * ) mf;
-}
-
-static PyObject *M_NMesh_Face( PyObject * self, PyObject * args )
-{
- PyObject *vertlist = NULL;
-
- if( !PyArg_ParseTuple( args, "|O!", &PyList_Type, &vertlist ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a list of vertices or nothing as argument" );
-
-/* if (!vertlist) vertlist = PyList_New(0); */
-
- return new_NMFace( vertlist );
-}
-
-static PyObject *NMFace_append( PyObject * self, PyObject * args )
-{
- PyObject *vert;
- BPy_NMFace *f = ( BPy_NMFace * ) self;
-
- if( !PyArg_ParseTuple( args, "O!", &NMVert_Type, &vert ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected an NMVert object" );
-
- PyList_Append( f->v, vert );
-
- Py_RETURN_NONE;
-}
-
-#undef MethodDef
-#define MethodDef(func) {#func, NMFace_##func, METH_VARARGS, NMFace_##func##_doc}
-
-static struct PyMethodDef NMFace_methods[] = {
- MethodDef( append ),
- {NULL, NULL, 0, NULL}
-};
-
-static PyObject *NMFace_getattr( PyObject * self, char *name )
-{
- BPy_NMFace *mf = ( BPy_NMFace * ) self;
-
- if( strcmp( name, "v" ) == 0 )
- return Py_BuildValue( "O", mf->v );
- else if( strcmp( name, "col" ) == 0 )
- return Py_BuildValue( "O", mf->col );
- else if( strcmp( name, "mat" ) == 0 ) // emulation XXX
- return Py_BuildValue( "i", mf->mat_nr );
- else if( strcmp( name, "materialIndex" ) == 0 )
- return Py_BuildValue( "i", mf->mat_nr );
- else if( strcmp( name, "smooth" ) == 0 )
- return Py_BuildValue( "i", (mf->mf_flag & ME_SMOOTH) ? 1:0 );
- else if( strcmp( name, "sel" ) == 0 )
- return Py_BuildValue( "i", (mf->mf_flag & ME_FACE_SEL) ? 1:0 );
- else if( strcmp( name, "hide" ) == 0 )
- return Py_BuildValue( "i", (mf->mf_flag & ME_HIDE) ? 1:0 );
-
- else if( strcmp( name, "image" ) == 0 ) {
- if( mf->image )
- return Image_CreatePyObject( mf->image );
- else
- Py_RETURN_NONE;
- }
-
- else if( strcmp( name, "mode" ) == 0 )
- return Py_BuildValue( "i", mf->mode );
- else if( strcmp( name, "flag" ) == 0 )
- return Py_BuildValue( "i", mf->flag );
- else if( strcmp( name, "transp" ) == 0 )
- return Py_BuildValue( "i", mf->transp );
- else if( strcmp( name, "uv" ) == 0 )
- return Py_BuildValue( "O", mf->uv );
-
- else if( ( strcmp( name, "normal" ) == 0 )
- || ( strcmp( name, "no" ) == 0 ) ) {
-
- if( EXPP_check_sequence_consistency( mf->v, &NMVert_Type ) ==
- 1 ) {
-
- float fNormal[3] = { 0.0, 0.0, 0.0 };
- float *vco[4] = { NULL, NULL, NULL, NULL };
- int nSize = PyList_Size( mf->v );
- int loop;
-
- if( nSize != 3 && nSize != 4 )
- return EXPP_ReturnPyObjError
- ( PyExc_AttributeError,
- "face must contain either 3 or 4 verts" );
-
- for( loop = 0; loop < nSize; loop++ ) {
- BPy_NMVert *v =
- ( BPy_NMVert * ) PyList_GetItem( mf->v,
- loop );
- vco[loop] = ( float * ) v->co;
- }
-
- if( nSize == 4 )
- CalcNormFloat4( vco[0], vco[1], vco[2], vco[3],
- fNormal );
- else
- CalcNormFloat( vco[0], vco[1], vco[2],
- fNormal );
-
- return Py_BuildValue( "[f,f,f]", fNormal[0],
- fNormal[1], fNormal[2] );
- } else // EXPP_check_sequence_consistency failed
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "this face does not contain a series of NMVerts" );
- }
-
- else if( strcmp( name, "__members__" ) == 0 )
- return Py_BuildValue( "[s,s,s,s,s,s,s,s,s,s,s,s,s]",
- "v", "col", "mat", "materialIndex",
- "smooth", "image", "mode", "flag",
- "transp", "uv", "normal", "sel", "hide");
- return Py_FindMethod( NMFace_methods, ( PyObject * ) self, name );
-}
-
-static int NMFace_setattr( PyObject * self, char *name, PyObject * v )
-{
- BPy_NMFace *mf = ( BPy_NMFace * ) self;
- short ival;
- char cval;
-
- if( strcmp( name, "v" ) == 0 ) {
-
- if( PySequence_Check( v ) ) {
- Py_DECREF( mf->v );
- mf->v = EXPP_incr_ret( v );
-
- return 0;
- }
- } else if( strcmp( name, "col" ) == 0 ) {
-
- if( PySequence_Check( v ) ) {
- Py_DECREF( mf->col );
- mf->col = EXPP_incr_ret( v );
-
- return 0;
- }
- } else if( !strcmp( name, "mat" ) || !strcmp( name, "materialIndex" ) ) {
- PyArg_Parse( v, "b", &cval );
- mf->mat_nr = cval;
-
- return 0;
- } else if( strcmp( name, "smooth" ) == 0 ) {
- PyArg_Parse( v, "h", &ival );
- if (ival) mf->mf_flag |= ME_SMOOTH;
- else mf->mf_flag &= ~ME_SMOOTH;
-
- return 0;
- } else if( strcmp( name, "sel" ) == 0 ) {
- PyArg_Parse( v, "h", &ival );
- if (ival) mf->mf_flag |= ME_FACE_SEL;
- else mf->mf_flag &= ~ME_FACE_SEL;
-
- return 0;
- } else if( strcmp( name, "hide" ) == 0 ) {
- PyArg_Parse( v, "h", &ival );
- if (ival) mf->mf_flag |= ME_HIDE;
- else mf->mf_flag &= ~ME_HIDE;
-
- return 0;
-
- } else if( strcmp( name, "uv" ) == 0 ) {
-
- if( PySequence_Check( v ) ) {
- Py_DECREF( mf->uv );
- mf->uv = EXPP_incr_ret( v );
-
- return 0;
- }
- } else if( strcmp( name, "flag" ) == 0 ) {
- PyArg_Parse( v, "h", &ival );
- mf->flag = ival;
-
- return 0;
- } else if( strcmp( name, "mode" ) == 0 ) {
- PyArg_Parse( v, "h", &ival );
- mf->mode = ival;
-
- return 0;
- } else if( strcmp( name, "transp" ) == 0 ) {
- PyArg_Parse( v, "b", &cval );
- mf->transp = cval;
-
- return 0;
- } else if( strcmp( name, "image" ) == 0 ) {
- PyObject *pyimg;
- if( !PyArg_Parse( v, "O!", &Image_Type, &pyimg ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected image object" );
-
- if( pyimg == Py_None ) {
- mf->image = NULL;
-
- return 0;
- }
-
- mf->image = ( ( BPy_Image * ) pyimg )->image;
-
- return 0;
- }
-
- return EXPP_ReturnIntError( PyExc_AttributeError, name );
-}
-
-static PyObject *NMFace_repr( PyObject * self )
-{
- return PyString_FromString( "[NMFace]" );
-}
-
-static int NMFace_len( BPy_NMFace * self )
-{
- return PySequence_Length( self->v );
-}
-
-static PyObject *NMFace_item( BPy_NMFace * self, int i )
-{
- return PySequence_GetItem( self->v, i ); // new ref
-}
-
-static PyObject *NMFace_slice( BPy_NMFace * self, int begin, int end )
-{
- return PyList_GetSlice( self->v, begin, end ); // new ref
-}
-
-static PySequenceMethods NMFace_SeqMethods = {
- ( inquiry ) NMFace_len, /* sq_length */
- ( binaryfunc ) 0, /* sq_concat */
- ( intargfunc ) 0, /* sq_repeat */
- ( intargfunc ) NMFace_item, /* sq_item */
- ( intintargfunc ) NMFace_slice, /* sq_slice */
- ( intobjargproc ) 0, /* sq_ass_item */
- ( intintobjargproc ) 0, /* sq_ass_slice */
- 0,0,0,
-};
-
-PyTypeObject NMFace_Type = {
- PyObject_HEAD_INIT( NULL ) 0, /*ob_size */
- "Blender NMFace", /*tp_name */
- sizeof( BPy_NMFace ), /*tp_basicsize */
- 0, /*tp_itemsize */
- /* methods */
- ( destructor ) NMFace_dealloc, /*tp_dealloc */
- ( printfunc ) 0, /*tp_print */
- ( getattrfunc ) NMFace_getattr, /*tp_getattr */
- ( setattrfunc ) NMFace_setattr, /*tp_setattr */
- 0, /*tp_compare */
- ( reprfunc ) NMFace_repr, /*tp_repr */
- 0, /*tp_as_number */
- &NMFace_SeqMethods, /*tp_as_sequence */
- 0, /*tp_as_mapping */
- 0, /*tp_hash */
- 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, /* up to tp_del to avoid a warning */
-};
-
-static BPy_NMVert *newvert( float *co )
-{
- BPy_NMVert *mv = PyObject_NEW( BPy_NMVert, &NMVert_Type );
-
- mv->co[0] = co[0];
- mv->co[1] = co[1];
- mv->co[2] = co[2];
-
- mv->no[0] = mv->no[1] = mv->no[2] = 0.0;
- mv->uvco[0] = mv->uvco[1] = mv->uvco[2] = 0.0;
- mv->flag = 0;
-
- return mv;
-}
-
-static PyObject *M_NMesh_Vert( PyObject * self, PyObject * args )
-{
- float co[3] = { 0.0, 0.0, 0.0 };
-
- if( !PyArg_ParseTuple( args, "|fff", &co[0], &co[1], &co[2] ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected three floats (or nothing) as arguments" );
-
- return ( PyObject * ) newvert( co );
-}
-
-static void NMVert_dealloc( PyObject * self )
-{
- PyObject_DEL( self );
-}
-
-static PyObject *NMVert_getattr( PyObject * self, char *name )
-{
- BPy_NMVert *mv = ( BPy_NMVert * ) self;
-
- if( !strcmp( name, "co" ) || !strcmp( name, "loc" ) )
- return newVectorObject(mv->co,3,Py_WRAP);
-
- else if( strcmp( name, "no" ) == 0 )
- return newVectorObject(mv->no,3,Py_WRAP);
- else if( strcmp( name, "uvco" ) == 0 )
- return newVectorObject(mv->uvco,3,Py_WRAP);
- else if( strcmp( name, "index" ) == 0 )
- return PyInt_FromLong( mv->index );
- else if( strcmp( name, "sel" ) == 0 )
- return PyInt_FromLong( mv->flag & 1 );
- else if( strcmp( name, "__members__" ) == 0 )
- return Py_BuildValue( "[s,s,s,s,s]", "co", "no", "uvco",
- "index", "sel" );
-
- return EXPP_ReturnPyObjError( PyExc_AttributeError, name );
-}
-
-static int NMVert_setattr( PyObject * self, char *name, PyObject * v )
-{
- BPy_NMVert *mv = ( BPy_NMVert * ) self;
- int i;
-
- if( strcmp( name, "index" ) == 0 ) {
- PyArg_Parse( v, "i", &i );
- mv->index = i;
- return 0;
- } else if( strcmp( name, "sel" ) == 0 ) {
- PyArg_Parse( v, "i", &i );
- mv->flag = i ? 1 : 0;
- return 0;
- } else if( strcmp( name, "uvco" ) == 0 ) {
-
- if( !PyArg_ParseTuple( v, "ff|f",
- &( mv->uvco[0] ), &( mv->uvco[1] ),
- &( mv->uvco[2] ) ) )
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "Vector tuple or triple expected" );
-
- return 0;
- }
-
- return EXPP_ReturnIntError( PyExc_AttributeError, name );
-}
-
-static int NMVert_len( BPy_NMVert * self )
-{
- return 3;
-}
-
-static PyObject *NMVert_item( BPy_NMVert * self, int i )
-{
- if( i < 0 || i >= 3 )
- return EXPP_ReturnPyObjError( PyExc_IndexError,
- "array index out of range" );
-
- return Py_BuildValue( "f", self->co[i] );
-}
-
-static PyObject *NMVert_slice( BPy_NMVert * self, int begin, int end )
-{
- PyObject *list;
- int count;
-
- if( begin < 0 )
- begin = 0;
- if( end > 3 )
- end = 3;
- if( begin > end )
- begin = end;
-
- list = PyList_New( end - begin );
-
- for( count = begin; count < end; count++ )
- PyList_SetItem( list, count - begin,
- PyFloat_FromDouble( self->co[count] ) );
-
- return list;
-}
-
-static int NMVert_ass_item( BPy_NMVert * self, int i, PyObject * ob )
-{
- if( i < 0 || i >= 3 )
- return EXPP_ReturnIntError( PyExc_IndexError,
- "array assignment index out of range" );
-
- if( !PyNumber_Check( ob ) )
- return EXPP_ReturnIntError( PyExc_IndexError,
- "NMVert member must be a number" );
-
- self->co[i] = (float)PyFloat_AsDouble( ob );
-
- return 0;
-}
-
-static int NMVert_ass_slice( BPy_NMVert * self, int begin, int end,
- PyObject * seq )
-{
- int count;
-
- if( begin < 0 )
- begin = 0;
- if( end > 3 )
- end = 3;
- if( begin > end )
- begin = end;
-
- if( !PySequence_Check( seq ) )
- EXPP_ReturnIntError( PyExc_TypeError,
- "illegal argument type for built-in operation" );
-
- if( PySequence_Length( seq ) != ( end - begin ) )
- EXPP_ReturnIntError( PyExc_TypeError,
- "size mismatch in slice assignment" );
-
- for( count = begin; count < end; count++ ) {
- PyObject *ob = PySequence_GetItem( seq, count );
-
- if( !PyArg_Parse( ob, "f", &self->co[count] ) ) {
- Py_DECREF( ob );
- return -1;
- }
-
- Py_DECREF( ob );
- }
-
- return 0;
-}
-
-static PySequenceMethods NMVert_SeqMethods = {
- ( inquiry ) NMVert_len, /* sq_length */
- ( binaryfunc ) 0, /* sq_concat */
- ( intargfunc ) 0, /* sq_repeat */
- ( intargfunc ) NMVert_item, /* sq_item */
- ( intintargfunc ) NMVert_slice, /* sq_slice */
- ( intobjargproc ) NMVert_ass_item, /* sq_ass_item */
- ( intintobjargproc ) NMVert_ass_slice, /* sq_ass_slice */
- 0,0,0,
-};
-
-PyTypeObject NMVert_Type = {
- PyObject_HEAD_INIT( NULL )
- 0, /*ob_size */
- "Blender NMVert", /*tp_name */
- sizeof( BPy_NMVert ), /*tp_basicsize */
- 0, /*tp_itemsize */
- /* methods */
- ( destructor ) NMVert_dealloc, /*tp_dealloc */
- ( printfunc ) 0, /*tp_print */
- ( getattrfunc ) NMVert_getattr, /*tp_getattr */
- ( setattrfunc ) NMVert_setattr, /*tp_setattr */
- 0, /*tp_compare */
- ( reprfunc ) 0, /*tp_repr */
- 0, /*tp_as_number */
- &NMVert_SeqMethods, /*tp_as_sequence */
- 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, /* tp_del */
-};
-
-
-/*****************************
- * NMEdge
- *****************************/
-
-static BPy_NMEdge *new_NMEdge( BPy_NMVert * v1, BPy_NMVert * v2, char crease, short flag)
-{
- BPy_NMEdge *edge=NULL;
-
- if (!v1 || !v2) return NULL;
- if (!BPy_NMVert_Check(v1) || !BPy_NMVert_Check(v2)) return NULL;
-
- edge = PyObject_NEW( BPy_NMEdge, &NMEdge_Type );
-
- edge->v1=EXPP_incr_ret((PyObject*)v1);
- edge->v2=EXPP_incr_ret((PyObject*)v2);
- edge->flag=flag;
- edge->crease=crease;
-
- return edge;
-}
-
-static void NMEdge_dealloc( PyObject * self )
-{
- BPy_NMEdge *edge=(BPy_NMEdge *)self;
-
- Py_DECREF(edge->v1);
- Py_DECREF(edge->v2);
-
- PyObject_DEL(self);
-}
-
-static PyObject *NMEdge_getattr( PyObject * self, char *name )
-{
- BPy_NMEdge *edge=(BPy_NMEdge *)self;
-
- if ( strcmp( name, "v1" ) == 0 )
- return EXPP_incr_ret( edge->v1 );
- else if ( strcmp( name, "v2" ) == 0 )
- return EXPP_incr_ret( edge->v2 );
- else if ( strcmp( name, "flag" ) == 0 )
- return PyInt_FromLong( edge->flag );
- else if ( strcmp( name, "crease" ) == 0 )
- return PyInt_FromLong( edge->crease );
- else if( strcmp( name, "__members__" ) == 0 )
- return Py_BuildValue( "[s,s,s,s]",
- "v1", "v2", "flag", "crease" );
-
- return EXPP_ReturnPyObjError( PyExc_AttributeError, name );
-}
-
-static int NMEdge_setattr( PyObject * self, char *name, PyObject * v )
-{
- BPy_NMEdge *edge=(BPy_NMEdge *)self;
-
- if ( strcmp( name, "flag" ) == 0 )
- {
- short flag=0;
- if( !PyInt_Check( v ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected int argument" );
-
- flag = ( short ) PyInt_AsLong( v );
-
- edge->flag = flag;
-
- return 0;
- }
- else if ( strcmp( name, "crease" ) == 0 )
- {
- char crease=0;
- if( !PyInt_Check( v ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected int argument" );
-
- crease = ( char ) PyInt_AsLong( v );
-
- edge->crease = crease;
-
- return 0;
- }
-
- return EXPP_ReturnIntError( PyExc_AttributeError, name );
-}
-
-PyTypeObject NMEdge_Type = {
- PyObject_HEAD_INIT( NULL )
- 0, /*ob_size */
- "Blender NMEdge", /*tp_name */
- sizeof( BPy_NMEdge ), /*tp_basicsize */
- 0, /*tp_itemsize */
- /* methods */
- ( destructor ) NMEdge_dealloc, /*tp_dealloc */
- ( printfunc ) 0, /*tp_print */
- ( getattrfunc ) NMEdge_getattr, /*tp_getattr */
- ( setattrfunc ) NMEdge_setattr, /*tp_setattr */
- 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,
-};
-
-static void NMesh_dealloc( PyObject * self )
-{
- BPy_NMesh *me = ( BPy_NMesh * ) self;
-
- CustomData_free( &me->fdata, me->totfdata );
-
- Py_DECREF( me->name );
- Py_DECREF( me->verts );
- Py_DECREF( me->faces );
- Py_DECREF( me->materials );
- Py_DECREF( me->edges );
-
- PyObject_DEL( self );
-}
-
-static PyObject *NMesh_getMaterials( PyObject * self, PyObject * args )
-{
- BPy_NMesh *nm = ( BPy_NMesh * ) self;
- PyObject *list = NULL;
- Mesh *me = nm->mesh;
- int all = -1;
-
- if( !PyArg_ParseTuple( args, "|i", &all ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected nothing or an int (bool) as argument" );
-
- if( all >= 0 ) {
- if (!me)
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "meshes obtained with GetRawFromObject don't support this option");
-
- list = EXPP_PyList_fromMaterialList( me->mat, me->totcol,
- all );
- Py_DECREF( nm->materials ); /* update nmesh.materials attribute */
- nm->materials = EXPP_incr_ret( list );
- } else
- list = EXPP_incr_ret( nm->materials );
-
- return list;
-}
-
-static PyObject *NMesh_setMaterials( PyObject * self, PyObject * args )
-{
- BPy_NMesh *me = ( BPy_NMesh * ) self;
- PyObject *pymats = NULL;
-
- if( !PyArg_ParseTuple( args, "O!", &PyList_Type, &pymats ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a list of materials (None's also accepted) as argument" );
-
- if( !EXPP_check_sequence_consistency( pymats, &Material_Type ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "list should only contain materials (None's also accepted)" );
-
- if( PyList_Size( pymats ) > 16 )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "list can't have more than 16 materials" );
-
- Py_DECREF( me->materials );
- me->materials = EXPP_incr_ret( pymats );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *NMesh_addMaterial( PyObject * self, PyObject * args )
-{
- BPy_NMesh *me = ( BPy_NMesh * ) self;
- BPy_Material *pymat;
- Material *mat;
- PyObject *iter;
- int i, len = 0;
-
- if( !PyArg_ParseTuple( args, "O!", &Material_Type, &pymat ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected Blender Material PyObject" );
-
- mat = pymat->material;
- len = PyList_Size( me->materials );
-
- if( len >= 16 )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "object data material lists can't have more than 16 materials" );
-
- for( i = 0; i < len; i++ ) {
- iter = PyList_GetItem( me->materials, i );
- if( mat == Material_FromPyObject( iter ) )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "material already in the list" );
- }
-
- PyList_Append( me->materials, ( PyObject * ) pymat );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *NMesh_getKey( BPy_NMesh * self )
-{
- PyObject *keyobj;
-
- if( self->mesh->key )
- keyobj = Key_CreatePyObject(self->mesh->key);
- else
- keyobj = EXPP_incr_ret(Py_None);
-
- return keyobj;
-}
-
-static PyObject *NMesh_removeAllKeys( PyObject * self, PyObject * args )
-{
- BPy_NMesh *nm = ( BPy_NMesh * ) self;
- Mesh *me = nm->mesh;
-
- if( !PyArg_ParseTuple( args, "" ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "this function expects no arguments" );
-
- if( !me || !me->key )
- return EXPP_incr_ret_False();
-
- me->key->id.us--;
- me->key = 0;
-
- return EXPP_incr_ret_True();
-}
-
-static PyObject *NMesh_insertKey( PyObject * self, PyObject * args )
-{
- int fra = -1, oldfra = -1;
- char *type = NULL;
- short typenum;
- BPy_NMesh *nm = ( BPy_NMesh * ) self;
- Mesh *mesh = nm->mesh;
-
- if( !PyArg_ParseTuple( args, "|is", &fra, &type ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected nothing or an int and optionally a string as arguments" );
-
- if( !type || !strcmp( type, "relative" ) )
- typenum = 1;
- else if( !strcmp( type, "absolute" ) )
- typenum = 2;
- else
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "if given, type should be 'relative' or 'absolute'" );
-
- if( fra > 0 ) {
- fra = EXPP_ClampInt( fra, 1, NMESH_FRAME_MAX );
- oldfra = G.scene->r.cfra;
- G.scene->r.cfra = (int)fra;
- }
-
- if( !mesh )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "update this NMesh first with its .update() method" );
-
- insert_meshkey( mesh, typenum );
- allspace(REMAKEIPO, 0);
-
- if( fra > 0 )
- G.scene->r.cfra = (int)oldfra;
-
- Py_RETURN_NONE;
-}
-
-static PyObject *NMesh_getSelectedFaces( PyObject * self, PyObject * args )
-{
- BPy_NMesh *nm = ( BPy_NMesh * ) self;
- Mesh *me = nm->mesh;
- int i, totfaces, flag = 0;
- PyObject *l, *pyval;
-
- if( !PyArg_ParseTuple( args, "|i", &flag ) )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "expected int argument (or nothing)" );
-
- l = PyList_New( 0 );
- if( me == NULL || me->mface == NULL)
- return l;
-
- /* make sure not to write more faces then we have */
- totfaces= MIN2(me->totface, PySequence_Length(nm->faces));
-
- if( flag ) {
- for( i = 0; i < totfaces; i++ ) {
- if( me->mface[i].flag & ME_FACE_SEL ) {
- pyval = PyInt_FromLong( i );
- PyList_Append( l, pyval );
- Py_DECREF(pyval);
- }
- }
- } else {
- for( i = 0; i < totfaces; i++ ) {
- if( me->mface[i].flag & ME_FACE_SEL )
- PyList_Append( l, PyList_GetItem( nm->faces, i ) );
- }
- }
- return l;
-}
-
-static PyObject *NMesh_getActiveFace( PyObject * self )
-{
- if( ( ( BPy_NMesh * ) self )->sel_face < 0 )
- Py_RETURN_NONE;
-
- return Py_BuildValue( "i", ( ( BPy_NMesh * ) self )->sel_face );
-}
-
-static PyObject *NMesh_hasVertexUV( PyObject * self, PyObject * args )
-{
- BPy_NMesh *me = ( BPy_NMesh * ) self;
- int flag = -1;
-
- if( !PyArg_ParseTuple( args, "|i", &flag ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int argument (or nothing)" );
-
- switch ( flag ) {
- case 0:
- me->flags &= ~NMESH_HASVERTUV;
- break;
- case 1:
- me->flags |= NMESH_HASVERTUV;
- break;
- default:
- break;
- }
-
- if( me->flags & NMESH_HASVERTUV )
- return EXPP_incr_ret_True();
- else
- return EXPP_incr_ret_False();
-}
-
-static PyObject *NMesh_hasFaceUV( PyObject * self, PyObject * args )
-{
- BPy_NMesh *me = ( BPy_NMesh * ) self;
- int flag = -1;
-
- if( !PyArg_ParseTuple( args, "|i", &flag ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int argument (or nothing)" );
-
- switch ( flag ) {
- case 0:
- me->flags &= ~NMESH_HASFACEUV;
- break;
- case 1:
- me->flags |= NMESH_HASFACEUV;
- break;
- default:
- break;
- }
-
- if( me->flags & NMESH_HASFACEUV )
- return EXPP_incr_ret_True();
- else
- return EXPP_incr_ret_False();
-}
-
-static PyObject *NMesh_hasVertexColours( PyObject * self, PyObject * args )
-{
- BPy_NMesh *me = ( BPy_NMesh * ) self;
- int flag = -1;
-
- if( !PyArg_ParseTuple( args, "|i", &flag ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int argument (or nothing)" );
-
- switch ( flag ) {
- case 0:
- me->flags &= ~NMESH_HASMCOL;
- break;
- case 1:
- me->flags |= NMESH_HASMCOL;
- break;
- default:
- break;
- }
-
- if( me->flags & NMESH_HASMCOL )
- return EXPP_incr_ret_True();
- else
- return EXPP_incr_ret_False();
-}
-
-static PyObject *NMesh_update( PyObject *self, PyObject *a, PyObject *kwd )
-{
- BPy_NMesh *nmesh = ( BPy_NMesh * ) self;
- Mesh *mesh = nmesh->mesh;
- int recalc_normals = 0, store_edges = 0, vertex_shade = 0;
- static char *kwlist[] = {"recalc_normals", "store_edges",
- "vertex_shade", NULL};
- int needs_redraw = 1;
- int old_totvert = 0;
-
- if (!PyArg_ParseTupleAndKeywords(a, kwd, "|iii", kwlist, &recalc_normals,
- &store_edges, &vertex_shade ) )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected nothing or one to three bool(s) (0 or 1) as argument" );
-
- if( check_NMeshLists( nmesh ) )
- return NULL;
-
- if( mesh ) {
- old_totvert = mesh->totvert;
- unlink_existingMeshData( mesh );
- if( !convert_NMeshToMesh( mesh, nmesh ) )
- return NULL;
- if (mesh->dvert) check_dverts(mesh, old_totvert);
- } else {
- mesh = Mesh_fromNMesh( nmesh );
- /* if mesh is NULL, there was an error */
- if( !mesh )
- return NULL;
- nmesh->mesh = mesh;
- }
-
- if( recalc_normals )
- mesh_calc_normals(mesh->mvert, mesh->totvert, mesh->mface, mesh->totface, NULL);
-
- mesh_update( mesh, nmesh->object );
-
- nmesh_updateMaterials( nmesh );
-
- if( nmesh->name && nmesh->name != Py_None )
- new_id( &( G.main->mesh ), &mesh->id,
- PyString_AsString( nmesh->name ) );
-
- if (vertex_shade) {
- Base *base = FIRSTBASE;
-
- if (!nmesh->object)
- return EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "link this mesh to an object first with ob.link(mesh)" );
-
- if (G.obedit)
- return EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "can't shade vertices while in edit mode" );
-
- while (base) {
- if (base->object == nmesh->object) {
- base->flag |= SELECT;
- nmesh->object->flag = (short)base->flag;
- set_active_base (base);
- needs_redraw = 0; /* already done in make_vertexcol */
- break;
- }
- base = base->next;
- }
-
- /* recalculate the derived mesh before trying to use it */
- makeDerivedMesh(nmesh->object, CD_MASK_BAREMESH);
- make_vertexcol(1);
-
- countall();
- }
-
- if( !during_script( ) && needs_redraw)
- EXPP_allqueue( REDRAWVIEW3D, 0 );
-
- return PyInt_FromLong( 1 );
-}
-
-/** Implementation of the python method getVertexInfluence for an NMesh object.
- * This method returns a list of pairs (string,float) with bone names and
- * influences that this vertex receives.
- * @author Jordi Rovira i Bonet
- */
-
-static PyObject *NMesh_getVertexInfluences( PyObject * self, PyObject * args )
-{
- int index;
- PyObject *influence_list = NULL;
- Object *object = ( ( BPy_NMesh * ) self )->object;
- Mesh *me = ( ( BPy_NMesh * ) self )->mesh;
-
- /* Get a reference to the mesh object wrapped in here. */
- if( !me )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "unlinked nmesh: call its .update() method first" );
-
- if( !object )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This mesh must be linked to an object" );
-
- /* Parse the parameters: only on integer (vertex index) */
- if( !PyArg_ParseTuple( args, "i", &index ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int argument (index of the vertex)" );
-
- /* check for valid index */
- if( index < 0 || index >= me->totvert )
- return EXPP_ReturnPyObjError( PyExc_IndexError,
- "vertex index out of range" );
-
- influence_list = PyList_New( 0 );
-
- /* Proceed only if we have vertex deformation information */
- if( me->dvert ) {
- int i;
- MDeformWeight *sweight = NULL;
-
- /* Number of bones influencing the vertex */
- int totinfluences = me->dvert[index].totweight;
-
- /* Get the reference of the first weight structure */
- sweight = me->dvert[index].dw;
-
- /* Build the list only with weights and names of the influent bones */
- for( i = 0; i < totinfluences; i++, sweight++ ) {
- bDeformGroup *defgroup = (bDeformGroup *) BLI_findlink( &object->defbase,
- sweight->def_nr );
- if( defgroup )
- PyList_Append( influence_list, Py_BuildValue( "[sf]",
- defgroup->name, sweight->weight ) );
- }
- }
-
- return influence_list;
-}
-
-Mesh *Mesh_fromNMesh( BPy_NMesh * nmesh )
-{
- Mesh *mesh = NULL;
-
- mesh = add_mesh( "Mesh" );
-
- if( !mesh ) {
- PyErr_SetString( PyExc_RuntimeError,
- "FATAL: could not create mesh object" );
- return NULL;
- }
-
- mesh->id.us = 0; /* no user yet */
- G.totmesh++;
-
- if( !convert_NMeshToMesh( mesh, nmesh ) )
- return NULL;
-
- return mesh;
-}
-
-static PyObject *NMesh_getMaxSmoothAngle( BPy_NMesh * self )
-{
- return PyInt_FromLong( self->smoothresh );
-}
-
-static PyObject *NMesh_setMaxSmoothAngle( PyObject * self, PyObject * args )
-{
- short value = 0;
- BPy_NMesh *nmesh = ( BPy_NMesh * ) self;
-
- if( !PyArg_ParseTuple( args, "h", &value ) )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected an int in [1, 80] as argument" );
-
- nmesh->smoothresh =
- ( short ) EXPP_ClampInt( value, NMESH_SMOOTHRESH_MIN,
- NMESH_SMOOTHRESH_MAX );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *NMesh_getSubDivLevels( BPy_NMesh * self )
-{
- return Py_BuildValue( "[h,h]", self->subdiv[0], self->subdiv[1] );
-}
-
-static PyObject *NMesh_setSubDivLevels( PyObject * self, PyObject * args )
-{
- short display = 0, render = 0;
- BPy_NMesh *nmesh = ( BPy_NMesh * ) self;
-
- if( !PyArg_ParseTuple( args, "(hh)", &display, &render ) )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected a sequence [int, int] as argument" );
-
- nmesh->subdiv[0] =
- ( short ) EXPP_ClampInt( display, NMESH_SUBDIV_MIN,
- NMESH_SUBDIV_MAX );
-
- nmesh->subdiv[1] =
- ( short ) EXPP_ClampInt( render, NMESH_SUBDIV_MIN,
- NMESH_SUBDIV_MAX );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *NMesh_getMode( BPy_NMesh * self )
-{
- return PyInt_FromLong( self->mode );
-}
-
-static PyObject *NMesh_setMode( PyObject * self, PyObject * args )
-{
- BPy_NMesh *nmesh = ( BPy_NMesh * ) self;
- PyObject *arg1 = NULL;
- char *m[5] = { NULL, NULL, NULL, NULL, NULL };
- short i, mode = 0;
-
- if( !PyArg_ParseTuple ( args, "|Ossss", &arg1, &m[1], &m[2], &m[3], &m[4] ) )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected an int or from none to 5 strings as argument(s)" );
-
- if (arg1) {
- if (PyInt_Check(arg1)) {
- mode = (short)PyInt_AsLong(arg1);
- }
- else if (PyString_Check(arg1)) {
- m[0] = PyString_AsString(arg1);
- for( i = 0; i < 5; i++ ) {
- if( !m[i] ) break;
- else if( strcmp( m[i], "NoVNormalsFlip" ) == 0 )
- mode |= ME_NOPUNOFLIP;
- else if( strcmp( m[i], "TwoSided" ) == 0 )
- mode |= ME_TWOSIDED;
- else if( strcmp( m[i], "AutoSmooth" ) == 0 )
- mode |= ME_AUTOSMOOTH;
- else if( m[i][0] == '\0' )
- mode = 0;
- else
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "unknown NMesh mode" );
- }
- }
- else return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected an int or from none to 5 strings as argument(s)" );
- }
-
- nmesh->mode = mode;
-
- Py_RETURN_NONE;
-}
-
-/* METH_VARARGS: function(PyObject *self, PyObject *args) */
-#undef MethodDef
-#define MethodDef(func) {#func, NMesh_##func, METH_VARARGS, NMesh_##func##_doc}
-
-static struct PyMethodDef NMesh_methods[] = {
- MethodDef( addEdge ),
- MethodDef( findEdge ),
- MethodDef( removeEdge ),
- MethodDef( addFace ),
- MethodDef( removeFace ),
- MethodDef( addVertGroup ),
- MethodDef( removeVertGroup ),
- MethodDef( assignVertsToGroup ),
- MethodDef( removeVertsFromGroup ),
- MethodDef( getVertsFromGroup ),
- MethodDef( renameVertGroup ),
- MethodDef( hasVertexColours ),
- MethodDef( hasFaceUV ),
- MethodDef( hasVertexUV ),
- MethodDef( getSelectedFaces ),
- MethodDef( getVertexInfluences ),
- MethodDef( getMaterials ),
- MethodDef( setMaterials ),
- MethodDef( addMaterial ),
- MethodDef( insertKey ),
- MethodDef( removeAllKeys ),
- MethodDef( setMode ),
- MethodDef( setMaxSmoothAngle ),
- MethodDef( setSubDivLevels ),
- MethodDef( transform ),
-
-/* METH_NOARGS: function(PyObject *self) */
-#undef MethodDef
-#define MethodDef(func) {#func, (PyCFunction)NMesh_##func, METH_NOARGS,\
- NMesh_##func##_doc}
-
- MethodDef( printDebug ),
- MethodDef( getVertGroupNames ),
- MethodDef( getActiveFace ),
- MethodDef( getKey ),
- MethodDef( getMode ),
- MethodDef( getMaxSmoothAngle ),
- MethodDef( getSubDivLevels ),
-
-/* METH_VARARGS | METH_KEYWORDS:
- * function(PyObject *self, PyObject *args, PyObject *keywords) */
-#undef MethodDef
-#define MethodDef(func) {#func, (PyCFunction)NMesh_##func,\
- METH_VARARGS | METH_KEYWORDS, NMesh_##func##_doc}
-
- MethodDef( update ),
- {NULL, NULL, 0, NULL}
-};
-
-static PyObject *NMesh_getattr( PyObject * self, char *name )
-{
- BPy_NMesh *me = ( BPy_NMesh * ) self;
-
- if( strcmp( name, "name" ) == 0 )
- return EXPP_incr_ret( me->name );
-
- else if ( strcmp( name, "properties" ) == 0 )
- return BPy_Wrap_IDProperty( (ID*)me->mesh, IDP_GetProperties((ID*)me->mesh, 1), NULL );
-
- else if( strcmp( name, "mode" ) == 0 )
- return PyInt_FromLong( me->mode );
-
- else if( strcmp( name, "block_type" ) == 0 ) /* for compatibility */
- return PyString_FromString( "NMesh" );
-
- else if( strcmp( name, "materials" ) == 0 )
- return EXPP_incr_ret( me->materials );
-
- else if( strcmp( name, "verts" ) == 0 )
- return EXPP_incr_ret( me->verts );
-
- else if( strcmp( name, "maxSmoothAngle" ) == 0 )
- return PyInt_FromLong( me->smoothresh );
-
- else if( strcmp( name, "subDivLevels" ) == 0 )
- return Py_BuildValue( "[h,h]", me->subdiv[0], me->subdiv[1] );
-
- else if( strcmp( name, "users" ) == 0 ) {
- if( me->mesh ) {
- return PyInt_FromLong( me->mesh->id.us );
- } else { /* it's a free mesh: */
- return Py_BuildValue( "i", 0 );
- }
- }
- else if (strcmp( name, "key") == 0)
- return NMesh_getKey((BPy_NMesh*)self);
-
- else if( strcmp( name, "faces" ) == 0 )
- return EXPP_incr_ret( me->faces );
-
- else if( strcmp( name, "edges" ) == 0 )
- {
- return EXPP_incr_ret( me->edges );
- }
- else if( strcmp( name, "__members__" ) == 0 )
- return Py_BuildValue( "[s,s,s,s,s,s,s,s,s,s,s]",
- "name", "materials", "verts", "users",
- "faces", "maxSmoothAngle",
- "subdivLevels", "edges", "key" );
-
- return Py_FindMethod( NMesh_methods, ( PyObject * ) self, name );
-}
-
-static int NMesh_setattr( PyObject * self, char *name, PyObject * v )
-{
- BPy_NMesh *me = ( BPy_NMesh * ) self;
-
- if( !strcmp( name, "name" ) ) {
-
- if( !PyString_Check( v ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected string argument" );
-
- Py_DECREF( me->name );
- me->name = EXPP_incr_ret( v );
- }
-
- else if( !strcmp( name, "mode" ) ) {
- short mode;
-
- if( !PyInt_Check( v ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected int argument" );
-
- mode = ( short ) PyInt_AsLong( v );
- if( mode >= 0 )
- me->mode = mode;
- else
- return EXPP_ReturnIntError( PyExc_ValueError,
- "expected positive int argument" );
- }
-
- else if( !strcmp( name, "verts" ) || !strcmp( name, "faces" ) ||
- !strcmp( name, "materials" ) ) {
-
- if( PySequence_Check( v ) ) {
-
- if( strcmp( name, "materials" ) == 0 ) {
- Py_DECREF( me->materials );
- me->materials = EXPP_incr_ret( v );
- } else if( strcmp( name, "verts" ) == 0 ) {
- Py_DECREF( me->verts );
- me->verts = EXPP_incr_ret( v );
- } else {
- Py_DECREF( me->faces );
- me->faces = EXPP_incr_ret( v );
- }
- }
-
- else
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a list" );
- }
-
- else if( !strcmp( name, "maxSmoothAngle" ) ) {
- short smoothresh = 0;
-
- if( !PyInt_Check( v ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected int argument" );
-
- smoothresh = ( short ) PyInt_AsLong( v );
-
- me->smoothresh =
- (short)EXPP_ClampInt( smoothresh, NMESH_SMOOTHRESH_MIN,
- NMESH_SMOOTHRESH_MAX );
- }
-
- else if( !strcmp( name, "subDivLevels" ) ) {
- int subdiv[2] = { 0, 0 };
- int i;
- PyObject *tmp;
-
- if( !PySequence_Check( v ) || ( PySequence_Length( v ) != 2 ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a list [int, int] as argument" );
-
- for( i = 0; i < 2; i++ ) {
- tmp = PySequence_GetItem( v, i );
- if( tmp ) {
- if( !PyInt_Check( tmp ) ) {
- Py_DECREF( tmp );
- return EXPP_ReturnIntError
- ( PyExc_TypeError,
- "expected a list [int, int] as argument" );
- }
-
- subdiv[i] = PyInt_AsLong( tmp );
- me->subdiv[i] =
- ( short ) EXPP_ClampInt( subdiv[i],
- NMESH_SUBDIV_MIN,
- NMESH_SUBDIV_MAX );
- Py_DECREF( tmp );
- } else
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "couldn't retrieve subdiv values from list" );
- }
- }
- else if( strcmp( name, "edges" ) == 0 )
- {
- if (PySequence_Check(v))
- {
- Py_DECREF(me->edges);
- me->edges = EXPP_incr_ret( v );
- }
- }
- else
- return EXPP_ReturnIntError( PyExc_AttributeError, name );
-
- return 0;
-}
-
-PyTypeObject NMesh_Type = {
- PyObject_HEAD_INIT( NULL ) 0, /*ob_size */
- "Blender NMesh", /*tp_name */
- sizeof( BPy_NMesh ), /*tp_basicsize */
- 0, /*tp_itemsize */
- /* methods */
- ( destructor ) NMesh_dealloc, /*tp_dealloc */
- ( printfunc ) 0, /*tp_print */
- ( getattrfunc ) NMesh_getattr, /*tp_getattr */
- ( setattrfunc ) NMesh_setattr, /*tp_setattr */
- 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,
-};
-
-static BPy_NMFace *nmface_from_data( BPy_NMesh * mesh, int vidxs[4],
- char mat_nr, char flag, MTFace * tface, MCol * col, int orig_index )
-{
- BPy_NMFace *newf = PyObject_NEW( BPy_NMFace, &NMFace_Type );
- int i, len;
-
- if( vidxs[3] )
- len = 4;
- else
- len = 3;
-
- newf->v = PyList_New( len );
-
- for( i = 0; i < len; i++ )
- PyList_SetItem( newf->v, i,
- EXPP_incr_ret( PyList_GetItem
- ( mesh->verts, vidxs[i] ) ) );
-
- if( tface ) {
- newf->uv = PyList_New( len ); // per-face UV coordinates
-
- for( i = 0; i < len; i++ ) {
- PyList_SetItem( newf->uv, i,
- Py_BuildValue( "(ff)", tface->uv[i][0],
- tface->uv[i][1] ) );
- }
-
- if( tface->tpage ) /* pointer to image per face: */
- newf->image = ( Image * ) tface->tpage;
- else
- newf->image = NULL;
-
- newf->mode = tface->mode; /* draw mode */
- newf->flag = tface->flag; /* select flag */
- newf->transp = tface->transp; /* transparency flag */
- } else {
- newf->mode = TF_DYNAMIC; /* just to initialize it to something meaninful, */
- /* since without tfaces there are no tface->mode's, obviously. */
- newf->image = NULL;
- newf->uv = PyList_New( 0 );
- }
-
- newf->mat_nr = mat_nr;
- newf->mf_flag = flag; /* MFace flag */
- newf->orig_index = orig_index;
-
- if( col ) {
- newf->col = PyList_New( 4 );
- for( i = 0; i < 4; i++, col++ ) {
- PyList_SetItem( newf->col, i,
- ( PyObject * ) newcol( col->b, col->g,
- col->r,
- col->a ) );
- }
- } else
- newf->col = PyList_New( 0 );
-
- return newf;
-}
-
-static BPy_NMEdge *nmedge_from_index( BPy_NMesh * mesh, int v0idx, int v1idx)
-{
- BPy_NMVert *v1=(BPy_NMVert *)PyList_GetItem( mesh->verts, v0idx);
- BPy_NMVert *v2=(BPy_NMVert *)PyList_GetItem( mesh->verts, v1idx);
- return new_NMEdge(v1, v2, (char)0.0, 0);
-}
-
-static BPy_NMEdge *nmedge_from_data( BPy_NMesh * mesh, MEdge *edge )
-{
- BPy_NMVert *v1=(BPy_NMVert *)PyList_GetItem( mesh->verts, edge->v1 );
- BPy_NMVert *v2=(BPy_NMVert *)PyList_GetItem( mesh->verts, edge->v2 );
- return new_NMEdge(v1, v2, edge->crease, edge->flag);
-}
-
-static BPy_NMVert *nmvert_from_data( MVert * vert, MSticky * st, float *co,
- int idx, char flag )
-{
- BPy_NMVert *mv = PyObject_NEW( BPy_NMVert, &NMVert_Type );
-
- mv->co[0] = co[0];
- mv->co[1] = co[1];
- mv->co[2] = co[2];
-
- mv->no[0] = (float)(vert->no[0] / 32767.0);
- mv->no[1] = (float)(vert->no[1] / 32767.0);
- mv->no[2] = (float)(vert->no[2] / 32767.0);
-
- if( st ) {
- mv->uvco[0] = st->co[0];
- mv->uvco[1] = st->co[1];
- mv->uvco[2] = 0.0;
-
- } else
- mv->uvco[0] = mv->uvco[1] = mv->uvco[2] = 0.0;
-
- mv->index = idx;
- mv->flag = flag & 1;
-
- return mv;
-}
-
-static int get_active_faceindex( Mesh * me )
-{
- if( me == NULL )
- return -1;
-
- if (me->act_face != -1 && me->act_face < me->totface)
- return me->act_face;
- return -1;
-}
-
-static BPy_NMVert *nmvert_from_float(float *co, float *no, int idx) {
- BPy_NMVert *mv;
-
- mv = PyObject_NEW( BPy_NMVert, &NMVert_Type );
-
- mv->index = idx;
-
- mv->co[0] = co[0];
- mv->co[1] = co[1];
- mv->co[2] = co[2];
-
- mv->no[0] = no[0];
- mv->no[1] = no[1];
- mv->no[2] = no[2];
-
- mv->uvco[0] = mv->uvco[1] = mv->uvco[2] = 0.0;
-
- mv->flag = 0;
-
- return mv;
-}
-
-static BPy_NMFace *nmface_from_index( BPy_NMesh * mesh, int vidxs[4], char mat_nr )
-{
- BPy_NMFace *newf = PyObject_NEW( BPy_NMFace, &NMFace_Type );
- int i, len;
-
- if( vidxs[3] )
- len = 4;
- else if( vidxs[2] )
- len = 3;
- else
- len = 2;
-
- newf->v = PyList_New( len );
-
- for( i = 0; i < len; i++ )
- PyList_SetItem( newf->v, i,
- EXPP_incr_ret( PyList_GetItem
- ( mesh->verts, vidxs[i] ) ) );
-
- newf->mode = TF_DYNAMIC; /* just to initialize it to something meaninful, */
- /* since without tfaces there are no tface->mode's, obviously. */
- newf->image = NULL;
- newf->uv = PyList_New( 0 );
-
- newf->mat_nr = mat_nr;
- newf->mf_flag = 0;
- newf->orig_index = -1;
-
- newf->col = PyList_New( 0 );
-
- return newf;
-}
-
-/* RATHER EVIL FUNCTION BORROWED FROM fix_faceindices IN editmesh.c */
-static void correctFaceIndex(int vidx[4])
-{
- if (vidx[3]) {
- if (vidx[1] == 0) {
- vidx[1] = vidx[2];
- vidx[2] = vidx[3];
- vidx[3] = vidx[0];
- vidx[0] = 0;
- }
- if (vidx[2] == 0) {
- int t = vidx[1];
- vidx[2] = vidx[0];
- vidx[1] = vidx[3];
- vidx[3] = t;
- vidx[0] = 0;
- }
- if (vidx[3] == 0) {
- vidx[3] = vidx[2];
- vidx[2] = vidx[1];
- vidx[1] = vidx[0];
- vidx[0] = 0;
- }
- }
- else if (vidx[1] == 0) {
- vidx[1] = vidx[2];
- vidx[2] = vidx[0];
- vidx[0] = 0;
- }
- else if (vidx[2] == 0) {
- vidx[2] = vidx[1];
- vidx[1] = vidx[0];
- vidx[0] = 0;
- }
-}
-
-/*
- CREATES A NMESH FROM DISPLIST DATA. INSPIRED BY THE FUNCTIONS CALLED WHEN
- CONVERTING OBJECTS TO MESH.
- */
-static PyObject *new_NMesh_displist(ListBase *lb, Object *ob)
-{
- BPy_NMesh *me;
- DispList *dl;
- float *data, *ndata;
- float normal[3] = {1, 0, 0};
- int vidx[4];
- int parts, p1, p2, p3, p4, a, b, one_normal=0, ioffset=0;
- int *index;
-
- /* Note: This routine does not create new edges for the faces
- * it adds... should be fixed for consistency.
- */
-
- if (ob->type == OB_CURVE || ob->type == OB_FONT)
- one_normal = 1;
-
- me = PyObject_NEW( BPy_NMesh, &NMesh_Type );
- me->name = EXPP_incr_ret( Py_None );
- me->flags = 0;
- me->mode = ME_TWOSIDED; /* default for new meshes */
- me->subdiv[0] = NMESH_SUBDIV;
- me->subdiv[1] = NMESH_SUBDIV;
- me->smoothresh = NMESH_SMOOTHRESH;
- me->edges = PyList_New( 0 );
-
- me->object = ob;
- me->materials = EXPP_PyList_fromMaterialList( ob->mat, ob->totcol, 0 );
-
- me->verts = PyList_New( 0 );
- me->faces = PyList_New( 0 );
-
- memset(&me->fdata, 0, sizeof(me->fdata));
- me->totfdata = 0;
-
- dl= lb->first;
- while(dl) {
- parts= dl->parts;
- index= dl->index;
- data= dl->verts;
- ndata= dl->nors;
-
- switch(dl->type) {
- case DL_SEGM:
- for(a=0; a<dl->parts*dl->nr; a++, data+=3) {
- PyList_Append(me->verts, ( PyObject * ) nmvert_from_float(data, normal, a));
- }
-
- vidx[2] = vidx[3] = 0;
-
- for(a=0; a<dl->parts; a++) {
- for(b=1; b<dl->nr; b++) {
- int v0 = ioffset + a * dl->nr + b-1;
- int v1 = ioffset + a * dl->nr + b;
- PyList_Append(me->edges, ( PyObject * ) nmedge_from_index(me, v0, v1));
- }
- }
- ioffset += dl->parts * dl->nr;
- break;
- case DL_POLY:
- for(a=0; a<dl->parts*dl->nr; a++, data+=3) {
- PyList_Append(me->verts, ( PyObject * ) nmvert_from_float(data, normal, a));
- }
-
- vidx[2] = vidx[3] = 0;
-
- for(a=0; a<dl->parts; a++) {
- for(b=0; b<dl->nr; b++) {
- int v1, v0 = ioffset + a * dl->nr + b;
- if(b==dl->nr-1) v1 = ioffset + a * dl->nr;
- else v1= ioffset + a * dl->nr + b+1;
- PyList_Append(me->edges, ( PyObject * ) nmedge_from_index(me, v0, v1));
- }
- }
- ioffset += dl->parts * dl->nr;
- break;
- case DL_SURF:
- for(a=0; a<dl->parts*dl->nr; a++, data+=3, ndata+=3) {
- PyList_Append(me->verts, ( PyObject * ) nmvert_from_float(data, ndata, a));
- }
-
- for(a=0; a<dl->parts; a++) {
-
- DL_SURFINDEX(dl->flag & DL_CYCL_U, dl->flag & DL_CYCL_V, dl->nr, dl->parts);
-
-
- for(; b<dl->nr; b++) {
- vidx[0] = p2 + ioffset;
- vidx[1] = p1 + ioffset;
- vidx[2] = p3 + ioffset;
- vidx[3] = p4 + ioffset;
- correctFaceIndex(vidx);
-
- PyList_Append(me->faces, ( PyObject * ) nmface_from_index(me, vidx, (char)dl->col));
-
- p2 = p1;
- p4 = p3;
- p1++;
- p3++;
- }
- }
- ioffset += dl->parts * dl->nr;
- break;
-
- case DL_INDEX3:
- if (one_normal)
- for(a=0; a<dl->nr; a++, data+=3)
- PyList_Append(me->verts, ( PyObject * ) nmvert_from_float(data, ndata, a));
- else
- for(a=0; a<dl->nr; a++, data+=3, ndata+=3)
- PyList_Append(me->verts, ( PyObject * ) nmvert_from_float(data, ndata, a));
-
- while(parts--) {
- vidx[0] = index[0] + ioffset;
- vidx[1] = index[1] + ioffset;
- vidx[2] = index[2] + ioffset;
- vidx[3] = 0;
- correctFaceIndex(vidx);
-
- PyList_Append(me->faces, ( PyObject * ) nmface_from_index(me, vidx, (char)dl->col));
- index+= 3;
- }
- ioffset += dl->nr;
-
- break;
-
- case DL_INDEX4:
- for(a=0; a<dl->nr; a++, data+=3, ndata+=3) {
- PyList_Append(me->verts, ( PyObject * ) nmvert_from_float(data, ndata, a));
- }
-
- while(parts--) {
- vidx[0] = index[0] + ioffset;
- vidx[1] = index[1] + ioffset;
- vidx[2] = index[2] + ioffset;
- vidx[3] = index[3] + ioffset;
- correctFaceIndex(vidx);
-
- PyList_Append(me->faces, ( PyObject * ) nmface_from_index(me, vidx, (char)dl->col));
- index+= 4;
- }
- ioffset += dl->nr;
- break;
- }
- dl= dl->next;
- }
-
- return ( PyObject * ) me;
-}
-
-static PyObject *new_NMesh_internal( Mesh * oldmesh,
- DerivedMesh *dm )
-{
- BPy_NMesh *me = PyObject_NEW( BPy_NMesh, &NMesh_Type );
- me->flags = 0;
- me->mode = ME_TWOSIDED; /* default for new meshes */
- me->subdiv[0] = NMESH_SUBDIV;
- me->subdiv[1] = NMESH_SUBDIV;
- me->smoothresh = NMESH_SMOOTHRESH;
-
- me->object = NULL; /* not linked to any object yet */
-
- if( !oldmesh ) {
- me->name = EXPP_incr_ret( Py_None );
- me->materials = PyList_New( 0 );
- me->verts = PyList_New( 0 );
- me->edges = PyList_New( 0 );
- me->faces = PyList_New( 0 );
- me->mesh = 0;
- memset(&me->fdata, 0, sizeof(me->fdata));
- me->totfdata = 0;
- } else {
- MVert *mverts;
- MSticky *msticky;
- MFace *mfaces;
- MTFace *tfaces;
- MCol *mcols;
- MEdge *medges;
- CustomData *fdata;
- int i, totvert, totface, totedge;
-
- me->name = PyString_FromString( oldmesh->id.name + 2 );
- me->mesh = oldmesh;
- me->mode = oldmesh->flag; /* yes, we save the mesh flags in nmesh->mode */
- me->subdiv[0] = oldmesh->subdiv;
- me->subdiv[1] = oldmesh->subdivr;
- me->smoothresh = oldmesh->smoothresh;
-
- me->sel_face = get_active_faceindex( oldmesh );
-
- if( dm ) {
- msticky = NULL;
- mverts = dm->getVertArray(dm);
- mfaces = dm->getFaceArray(dm);
- tfaces = dm->getFaceDataArray(dm, CD_MTFACE);
- mcols = dm->getFaceDataArray(dm, CD_MCOL);
- medges = dm->getEdgeArray(dm);
- fdata = &dm->faceData;
-
- totvert = dm->getNumVerts(dm);
- totedge = dm->getNumEdges(dm);
- totface = dm->getNumFaces(dm);;
- } else {
- msticky = oldmesh->msticky;
- mverts = oldmesh->mvert;
- mfaces = oldmesh->mface;
- tfaces = oldmesh->mtface;
- mcols = oldmesh->mcol;
- medges = oldmesh->medge;
- fdata = &oldmesh->fdata;
-
- totvert = oldmesh->totvert;
- totface = oldmesh->totface;
- totedge = oldmesh->totedge;
- }
-
- /* copy non active mcol and mtface layers, these can't be edited
- but will be preserved */
- CustomData_copy( fdata, &me->fdata, CD_MASK_MCOL|CD_MASK_MTFACE,
- CD_DUPLICATE, totface );
- me->totfdata = totface;
-
- if( msticky )
- me->flags |= NMESH_HASVERTUV;
- if( tfaces )
- me->flags |= NMESH_HASFACEUV;
- if( mcols )
- me->flags |= NMESH_HASMCOL;
-
- me->verts = PyList_New( totvert );
-
- for( i = 0; i < totvert; i++ ) {
- MVert *oldmv = &mverts[i];
- MSticky *oldst = msticky ? &msticky[i] : NULL;
-
- PyList_SetItem( me->verts, i,
- ( PyObject * ) nmvert_from_data( oldmv,
- oldst,
- oldmv->co,
- i,
- oldmv->flag ) );
- }
-
- me->faces = PyList_New( totface );
- for( i = 0; i < totface; i++ ) {
- MTFace *oldtf = tfaces ? &tfaces[i] : NULL;
- MCol *oldmc = mcols ? &mcols[i * 4] : NULL;
- MFace *oldmf = &mfaces[i];
- int vidxs[4];
- vidxs[0] = oldmf->v1;
- vidxs[1] = oldmf->v2;
- vidxs[2] = oldmf->v3;
- vidxs[3] = oldmf->v4;
-
- PyList_SetItem( me->faces, i,
- ( PyObject * ) nmface_from_data( me,
- vidxs,
- oldmf->
- mat_nr,
- oldmf->
- flag,
- oldtf,
- oldmc,
- i) );
- }
-
- me->edges = PyList_New( totedge );
- for( i = 0; i < totedge; i++ )
- {
- MEdge *edge = &medges[i];
- PyList_SetItem( me->edges, i, (PyObject*)nmedge_from_data ( me, edge ) );
- }
-
- me->materials = EXPP_PyList_fromMaterialList( oldmesh->mat, oldmesh->totcol, 0 );
- }
-
- return ( PyObject * ) me;
-}
-
-PyObject *new_NMesh( Mesh * oldmesh )
-{
- return new_NMesh_internal( oldmesh, NULL );
-}
-
-static PyObject *M_NMesh_New( PyObject * self, PyObject * args )
-{
- char *name = NULL;
- PyObject *ret = NULL;
-
- if( !PyArg_ParseTuple( args, "|s", &name ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected nothing or a string as argument" );
-
- ret = new_NMesh( NULL );
-
- if( ret && name ) {
- BPy_NMesh *nmesh = ( BPy_NMesh * ) ret;
- Py_DECREF( nmesh->name );
- nmesh->name = PyString_FromString( name );
- }
-
- return ret;
-}
-
-static PyObject *M_NMesh_GetRaw( PyObject * self, PyObject * args )
-{
- char *name = NULL;
- Mesh *oldmesh = NULL;
-
- if( !PyArg_ParseTuple( args, "|s", &name ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument (or nothing)" );
-
- if( name ) {
- oldmesh = ( Mesh * ) GetIdFromList( &( G.main->mesh ), name );
-
- if( !oldmesh )
- return EXPP_incr_ret( Py_None );
- }
-
- return new_NMesh( oldmesh );
-}
-
-static PyObject *M_NMesh_GetNames(PyObject *self)
-{
- PyObject *names = PyList_New(0), *tmpstr;
- Mesh *me = G.main->mesh.first;
-
- while (me) {
- tmpstr = PyString_FromString(me->id.name+2);
- PyList_Append(names, tmpstr);
- Py_DECREF(tmpstr);
- me = me->id.next;
- }
-
- return names;
-}
-
-/* Note: NMesh.GetRawFromObject gets the display list mesh from Blender:
- * the vertices are already transformed / deformed. */
-static PyObject *M_NMesh_GetRawFromObject( PyObject * self, PyObject * args )
-{
- Object *ob;
- PyObject *nmesh;
- ListBase *lb=0;
- DispList *dl;
- char *name;
-
- if( !PyArg_ParseTuple( args, "s", &name ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument" );
-
- ob = ( Object * ) GetIdFromList( &( G.main->object ), name );
-
- if( !ob )
- return EXPP_ReturnPyObjError( PyExc_AttributeError, name );
-
-
- switch (ob->type) {
- case OB_MBALL:
- if( is_basis_mball(ob)) {
- lb= &ob->disp;
- if(lb->first==0) makeDispListMBall(ob);
- nmesh = new_NMesh_displist(lb, ob);
- }
- else {
- return EXPP_ReturnPyObjError( PyExc_AttributeError, "Object does not have geometry data" );
- }
- break;
- case OB_FONT:
- case OB_CURVE:
- {
- Curve *cu= ob->data;
-
- lb= &cu->disp;
- if(lb->first==0) makeDispListCurveTypes(ob, 0);
-
- dl= lb->first;
- if(dl==0)
- return EXPP_ReturnPyObjError( PyExc_AttributeError, "Object does not have geometry data" );
-
- if(dl->nors==0) addnormalsDispList(ob, lb);
-
- nmesh = new_NMesh_displist(lb, ob);
- }
- break;
- case OB_SURF:
-
- lb= &((Curve *)ob->data)->disp;
- if(lb->first==0) makeDispListCurveTypes(ob, 0);
-
- dl= lb->first;
- if(dl==0)
- return EXPP_ReturnPyObjError( PyExc_AttributeError, "Object does not have geometry data" );
-
- if(dl->nors==0) addnormalsDispList(ob, lb);
- nmesh = new_NMesh_displist(lb, ob);
-
- break;
- case OB_MESH:
- {
- CustomDataMask dataMask = CD_MASK_BAREMESH | CD_MASK_MTFACE
- | CD_MASK_MCOL;
- DerivedMesh *dm = mesh_create_derived_render( ob, dataMask );
- nmesh = new_NMesh_internal( ob->data, dm );
- dm->release(dm);
- }
- break;
- default:
- return EXPP_ReturnPyObjError( PyExc_AttributeError, "Object does not have geometry data" );
- }
-
-/* @hack: to mark that (deformed) mesh is readonly, so the update function
- * will not try to write it. */
-
- ( ( BPy_NMesh * ) nmesh )->mesh = 0;
-
- return nmesh;
-}
-
-static void mvert_from_data( MVert * mv, MSticky * st, BPy_NMVert * from )
-{
- mv->co[0] = from->co[0];
- mv->co[1] = from->co[1];
- mv->co[2] = from->co[2];
-
- mv->no[0] = (short)(from->no[0] * 32767.0);
- mv->no[1] = (short)(from->no[1] * 32767.0);
- mv->no[2] = (short)(from->no[2] * 32767.0);
-
- mv->flag = ( from->flag & 1 );
- mv->mat_nr = 0;
-
- if( st ) {
- st->co[0] = from->uvco[0];
- st->co[1] = from->uvco[1];
- }
-}
-
-static int assignFaceUV( MTFace * tf, BPy_NMFace * nmface )
-{
- PyObject *fuv, *tmp;
- int i;
- int len;
-
- fuv = nmface->uv;
- /* if no UV info, allows things to proceed as normal */
- if( PySequence_Length( fuv ) == 0 ) {
- tf->uv[0][0] = 0.0f; tf->uv[0][1] = 1.0f;
- tf->uv[1][0] = 0.0f; tf->uv[1][1] = 0.0f;
- tf->uv[2][0] = 1.0f; tf->uv[2][1] = 0.0f;
- tf->uv[3][1] = 1.0f; tf->uv[3][1] = 1.0f;
- return 1;
- }
-
- /* if there are too many uv coordinates, only take the first 4 */
- len = PySequence_Length( fuv );
- if( len > 4 )
- len = 4;
-
- /* fuv = [(u_1, v_1), ... (u_n, v_n)] */
- for( i = 0; i < len; i++ ) {
- tmp = PyList_GetItem( fuv, i ); /* stolen reference ! */
- if( !PyArg_ParseTuple
- ( tmp, "ff", &( tf->uv[i][0] ), &( tf->uv[i][1] ) ) ) {
- PyErr_SetString ( PyExc_TypeError,
- "expected tuple of two floats for uv" );
- return 0;
- }
- }
- if( nmface->image ) { /* image assigned ? */
- tf->tpage = ( void * ) nmface->image;
- } else
- tf->tpage = 0;
-
- tf->mode = nmface->mode; /* copy mode */
- tf->flag = (char)nmface->flag; /* copy flag */
- tf->transp = nmface->transp; /* copy transp flag */
-
- return 1;
-}
-
-static int mface_from_data( MFace * mf, CustomData *fdata, int findex,
- BPy_NMFace * from )
-{
- BPy_NMVert *nmv;
- MTFace *tf = CustomData_get(fdata, findex, CD_MTFACE);
- MCol *col = CustomData_get(fdata, findex, CD_MCOL);
-
- int numverts = PyList_Size( from->v );
- if( numverts != 3 && numverts != 4 ) { /* face can only have three or four verts */
- PyErr_SetString ( PyExc_RuntimeError,
- "faces must have at 3 or 4 vertices" );
- return 0;
- }
-
- nmv = ( BPy_NMVert * ) PyList_GetItem( from->v, 0 );
- if( BPy_NMVert_Check( nmv ) && nmv->index != -1 )
- mf->v1 = nmv->index;
- else
- mf->v1 = 0;
-
- nmv = ( BPy_NMVert * ) PyList_GetItem( from->v, 1 );
- if( BPy_NMVert_Check( nmv ) && nmv->index != -1 )
- mf->v2 = nmv->index;
- else
- mf->v2 = 0;
-
- nmv = ( BPy_NMVert * ) PyList_GetItem( from->v, 2 );
- if( BPy_NMVert_Check( nmv ) && nmv->index != -1 )
- mf->v3 = nmv->index;
- else
- mf->v3 = 0;
-
- if( numverts == 4 ) {
- nmv = ( BPy_NMVert * ) PyList_GetItem( from->v, 3 );
- if( BPy_NMVert_Check( nmv ) && nmv->index != -1 )
- mf->v4 = nmv->index;
- else
- mf->v4 = 0;
- }
-
- if( tf )
- if( !assignFaceUV( tf, from ) )
- return 0;
-
- mf->mat_nr = from->mat_nr;
- mf->flag = from->mf_flag;
-
- if( col ) {
- int i, len = PySequence_Length( from->col );
-
- if( len > 4 )
- len = 4;
-
- for( i = 0; i < len; i++, col++ ) {
- BPy_NMCol *mc =
- ( BPy_NMCol * ) PySequence_GetItem( from->col,
- i );
- if( !BPy_NMCol_Check( mc ) ) {
- Py_DECREF( mc );
- continue;
- }
-
- col->b = mc->r;
- col->g = mc->g;
- col->r = mc->b;
- col->a = mc->a;
-
- Py_DECREF( mc );
- }
- }
-
- test_index_face(mf, fdata, findex, numverts);
-
- return 1;
-}
-
-/* check for a valid UV sequence */
-static int check_validFaceUV( BPy_NMesh * nmesh )
-{
- PyObject *faces;
- BPy_NMFace *nmface;
- int i, n;
-
- faces = nmesh->faces;
- for( i = 0; i < PySequence_Length( faces ); i++ ) {
- nmface = ( BPy_NMFace * ) PyList_GetItem( faces, i );
- n = PySequence_Length( nmface->uv );
- if( n != PySequence_Length( nmface->v ) ) {
- if( n > 0 )
- printf( "Warning: different length of vertex and UV coordinate " "list in face!\n" );
- return 0;
- }
- }
- return 1;
-}
-
-/* this is a copy of unlink_mesh in mesh.c, because ... */
-static void EXPP_unlink_mesh( Mesh * me )
-{
- int a;
-
- if( me == 0 )
- return;
-
- for( a = 0; a < me->totcol; a++ ) {
- if( me->mat[a] )
- me->mat[a]->id.us--;
- me->mat[a] = 0;
- }
-
-/* ... here we want to preserve mesh keys */
-/* if users want to get rid of them, they can use mesh.removeAllKeys() */
-/*
- if(me->key) me->key->id.us--;
- me->key= 0;
-*/
- if( me->texcomesh )
- me->texcomesh = 0;
-
- me->totcol = 0;
-}
-
-static int unlink_existingMeshData( Mesh * mesh )
-{
- MDeformVert *dvert= NULL;
-
- EXPP_unlink_mesh( mesh );
-
- if(mesh->dvert) {
- /* we don't want to remove dvert here, check_dverts still needs it */
- dvert= mesh->dvert;
- CustomData_set_layer( &mesh->vdata, CD_MDEFORMVERT, NULL );
- }
-
- CustomData_free( &mesh->vdata, mesh->totvert );
- CustomData_free( &mesh->edata, mesh->totedge );
- CustomData_free( &mesh->fdata, mesh->totface );
- mesh_update_customdata_pointers( mesh );
-
- if(dvert)
- mesh->dvert= CustomData_add_layer( &mesh->vdata, CD_MDEFORMVERT,
- CD_ASSIGN, dvert, mesh->totvert );
-
- mesh->totedge = 0;
-
- if( mesh->mat ) {
- MEM_freeN( mesh->mat );
- mesh->mat = NULL;
- }
-
- return 1;
-}
-
-Material **nmesh_updateMaterials( BPy_NMesh * nmesh )
-{
- Material **matlist;
- Mesh *mesh = nmesh->mesh;
- int len = PyList_Size( nmesh->materials );
-
- if( !mesh ) {
- printf( "FATAL INTERNAL ERROR: illegal call to updateMaterials()\n" );
- return 0;
- }
-
- if( len > 0 ) {
- matlist = EXPP_newMaterialList_fromPyList( nmesh->materials );
- EXPP_incr_mats_us( matlist, len );
-
- if( mesh->mat )
- MEM_freeN( mesh->mat );
-
- mesh->mat = matlist;
-
- } else {
- matlist = 0;
- }
- mesh->totcol = (short)len;
-
-/**@ This is another ugly fix due to the weird material handling of blender.
- * it makes sure that object material lists get updated (by their length)
- * according to their data material lists, otherwise blender crashes.
- * It just stupidly runs through all objects...BAD BAD BAD.
- */
- test_object_materials( ( ID * ) mesh );
-
- return matlist;
-}
-
-PyObject *NMesh_assignMaterials_toObject( BPy_NMesh * nmesh, Object * ob )
-{
- BPy_Material *pymat;
- Material *ma;
- int i;
- short old_matmask;
- Mesh *mesh = nmesh->mesh;
- int nmats; /* number of mats == len(nmesh->materials) */
-
- old_matmask = ob->colbits; /*@ HACK: save previous colbits */
- ob->colbits = 0; /* make assign_material work on mesh linked material */
-
- nmats = PyList_Size( nmesh->materials );
-
- if( nmats > 0 && !mesh->mat ) {
- ob->totcol = (char)nmats;
- mesh->totcol = (short)nmats;
- mesh->mat =
- MEM_callocN( sizeof( void * ) * nmats, "bpy_memats" );
-
- if( ob->mat )
- MEM_freeN( ob->mat );
- ob->mat =
- MEM_callocN( sizeof( void * ) * nmats, "bpy_obmats" );
- }
-
- for( i = 0; i < nmats; i++ ) {
- pymat = ( BPy_Material * ) PySequence_GetItem( nmesh->
- materials, i );
-
- if( BPy_Material_Check( ( PyObject * ) pymat ) ) {
- ma = pymat->material;
- assign_material( ob, ma, i + 1 ); /*@ XXX don't use this function anymore */
- } else {
- Py_DECREF( pymat );
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected Material type in attribute list 'materials'!" );
- }
-
- Py_DECREF( pymat );
- }
-
- ob->colbits = old_matmask; /*@ HACK */
-
- ob->actcol = 1;
- Py_RETURN_NONE;
-}
-
-static void fill_medge_from_nmesh(Mesh * mesh, BPy_NMesh * nmesh)
-{
- int i,j;
- MEdge *faces_edges=NULL;
- int tot_faces_edges=0;
- int tot_valid_faces_edges=0;
- int nmeshtotedges=PyList_Size(nmesh->edges);
- int tot_valid_nmedges=0;
- BPy_NMEdge **valid_nmedges=NULL;
-
- valid_nmedges=MEM_callocN(nmeshtotedges*sizeof(BPy_NMEdge *), "make BPy_NMEdge");
-
- /* First compute the list of edges that exists because faces exists */
- make_edges(mesh, 0); /* 0 = draw all edges */
-
- faces_edges=mesh->medge;
- tot_faces_edges=mesh->totedge;
- tot_valid_faces_edges=tot_faces_edges;
-
- mesh->medge= CustomData_set_layer(&mesh->edata, CD_MEDGE, NULL);
- CustomData_free_layer_active(&mesh->edata, CD_MEDGE, mesh->totedge);
- mesh->totedge = 0;
-
- /* Flag each edge in faces_edges that is already in nmesh->edges list.
- * Flaging an edge means MEdge v1=v2=0.
- * Each time an edge is flagged, tot_valid_faces_edges is decremented.
- *
- * Also store in valid_nmedges pointers to each valid NMEdge in nmesh->edges.
- * An invalid NMEdge is an edge that has a vertex that is not in the vertices
- * list. Ie its index is -1.
- * Each time an valid NMEdge is flagged, tot_valid_nmedges is incremented.
- */
- for( i = 0; i < nmeshtotedges; ++i )
- {
- int v1idx,v2idx;
- BPy_NMEdge *edge=( BPy_NMEdge *) PyList_GetItem(nmesh->edges, i);
- BPy_NMVert *v=(BPy_NMVert *)edge->v1;
- v1idx=v->index;
- v=(BPy_NMVert *)edge->v2;
- v2idx=v->index;
- if (-1 == v1idx || -1 == v2idx) continue;
- valid_nmedges[tot_valid_nmedges]=edge;
- ++tot_valid_nmedges;
- for( j = 0; j < tot_faces_edges; j++ )
- {
- MEdge *me=faces_edges+j;
- if ( ((int)me->v1==v1idx && (int)me->v2==v2idx) ||
- ((int)me->v1==v2idx && (int)me->v2==v1idx) )
- {
- me->v1=0; me->v2=0;
- --tot_valid_faces_edges;
- }
- }
- }
-
- /* tot_valid_faces_edges < 0 causes a sigsegv crash, so we
- * clamp to prevent it
- * (this is related to faces (correctly) requiring at least 3 verts now,
- * which can break old scripts -- maybe we should also warn about the
- * 'broken' mesh the user created, but for now, until we investigate
- * better, this should do) */
- if (tot_valid_faces_edges < 0) tot_valid_faces_edges = 0;
-
- /* Now we have the total count of valid edges */
- mesh->totedge=tot_valid_nmedges+tot_valid_faces_edges;
- mesh->medge= CustomData_add_layer( &mesh->edata, CD_MEDGE, CD_CALLOC, NULL,
- mesh->totedge );
-
- for ( i = 0; i < tot_valid_nmedges; ++i )
- {
- BPy_NMEdge *edge=valid_nmedges[i];
- MEdge *medge=mesh->medge+i;
- int v1=((BPy_NMVert *)edge->v1)->index;
- int v2=((BPy_NMVert *)edge->v2)->index;
- medge->v1=v1;
- medge->v2=v2;
- medge->flag=edge->flag;
- medge->crease=edge->crease;
- }
- for ( i = 0, j = tot_valid_nmedges; i < tot_faces_edges; ++i )
- {
- MEdge *edge=faces_edges+i;
- if (edge->v1!=0 || edge->v2!=0) // valid edge
- {
- MEdge *medge=mesh->medge+j;
- medge->v1=edge->v1;
- medge->v2=edge->v2;
- medge->flag=ME_EDGEDRAW|ME_EDGERENDER;
- medge->crease=0;
- ++j;
- }
- }
-
- MEM_freeN( valid_nmedges );
- MEM_freeN( faces_edges );
-}
-
-/* this should ensure meshes don't end up with wrongly sized
- * me->dvert arrays, which can cause hangs; it's not ideal,
- * it's better to wrap dverts in NMesh, but it should do for now
- * since there are also methods in NMesh to edit dverts in the actual
- * mesh in Blender and anyway this is memory friendly */
-static void check_dverts(Mesh *me, int old_totvert)
-{
- int totvert = me->totvert;
-
- /* if vert count didn't change or there are no dverts, all is fine */
- if ((totvert == old_totvert) || (!me->dvert)) return;
- /* if all verts have been deleted, free old dverts */
- else if (totvert == 0) {
- CustomData_free_layer_active( &me->vdata, CD_MDEFORMVERT, old_totvert );
- me->dvert= NULL;
- }
- else {
- /* verts added or removed, make new me->dvert */
- MDeformVert *mdv = MEM_callocN( sizeof(MDeformVert)*totvert, "mdv" );
- copy_dverts( mdv, me->dvert, MIN2( old_totvert, totvert ) );
- free_dverts( me->dvert, old_totvert );
- me->dvert= CustomData_set_layer( &me->vdata, CD_MDEFORMVERT, mdv );
- }
-}
-
-static void check_mtface_mcols( BPy_NMesh *nmesh, Mesh *mesh )
-{
- int i;
-
- /* copy non-active mcol and mtface layers based on original index */
- CustomData_merge( &nmesh->fdata, &mesh->fdata, CD_MASK_MCOL|CD_MASK_MTFACE,
- CD_DEFAULT, mesh->totface );
-
- for( i = 0; i < mesh->totface; i++ ) {
- BPy_NMFace *mf =
- ( BPy_NMFace * ) PySequence_GetItem( nmesh->faces, i );
-
- if ( mf->orig_index != -1 )
- CustomData_copy_data( &nmesh->fdata, &mesh->fdata, mf->orig_index,
- i, 1 );
-
- Py_DECREF( mf );
- }
-
- /* add new layers if needed */
- if( ( nmesh->flags & NMESH_HASMCOL ) &&
- !CustomData_has_layer( &mesh->fdata, CD_MCOL ) ) {
- mesh->mcol = CustomData_add_layer( &mesh->fdata, CD_MCOL,
- CD_DEFAULT, NULL, mesh->totface );
- }
-
- if( ( nmesh->flags & NMESH_HASFACEUV ) || check_validFaceUV( nmesh ) ) {
- if ( !CustomData_has_layer( &mesh->fdata, CD_MTFACE) )
- make_tfaces( mesh );
- nmesh->flags |= NMESH_HASFACEUV;
- }
- else
- CustomData_free_layers( &mesh->fdata, CD_MTFACE, mesh->totface );
-
- /* active uvs and colors from NMFace will be written in mface_from_data */
-}
-
-static int convert_NMeshToMesh( Mesh * mesh, BPy_NMesh * nmesh)
-{
- MFace *newmf;
- MVert *newmv;
- MSticky *newst;
- int nmeshtotedges;
- int i, j, ok;
-
- /* Minor note: we used 'mode' because 'flag' was already used internally
- * by nmesh */
- mesh->flag = nmesh->mode;
- mesh->smoothresh = nmesh->smoothresh;
- mesh->subdiv = nmesh->subdiv[0];
- mesh->subdivr = nmesh->subdiv[1];
-
- /*@ material assignment moved to PutRaw */
- mesh->totvert = PySequence_Length( nmesh->verts );
- if( mesh->totvert ) {
- if( nmesh->flags & NMESH_HASVERTUV )
- mesh->msticky = CustomData_add_layer( &mesh->vdata, CD_MSTICKY,
- CD_CALLOC, NULL, mesh->totvert );
-
- mesh->mvert = CustomData_add_layer( &mesh->vdata, CD_MVERT, CD_CALLOC,
- NULL, mesh->totvert );
- }
-
- if( mesh->totvert )
- mesh->totface = PySequence_Length( nmesh->faces );
- else
- mesh->totface = 0;
-
- if( mesh->totface ) {
- check_mtface_mcols( nmesh, mesh );
-
- mesh->mface = CustomData_add_layer( &mesh->fdata, CD_MFACE, CD_CALLOC,
- NULL, mesh->totface );
- }
-
- mesh_update_customdata_pointers( mesh );
-
- /*@ This stuff here is to tag all the vertices referenced
- * by faces, then untag the vertices which are actually
- * in the vert list. Any vertices untagged will be ignored
- * by the mface_from_data function. It comes from my
- * screwed up decision to not make faces only store the
- * index. - Zr
- */
- for( i = 0; i < mesh->totface; i++ ) {
- BPy_NMFace *mf =
- ( BPy_NMFace * ) PySequence_GetItem( nmesh->faces, i );
-
- j = PySequence_Length( mf->v );
- while( j-- ) {
- BPy_NMVert *mv =
- ( BPy_NMVert * ) PySequence_GetItem( mf->v,
- j );
- if( BPy_NMVert_Check( mv ) )
- mv->index = -1;
- Py_DECREF( mv );
- }
-
- Py_DECREF( mf );
- }
- /* do the same for edges if there is edge data */
- nmeshtotedges=PyList_Size(nmesh->edges);
- for( i = 0; i < nmeshtotedges; ++i )
- {
- BPy_NMEdge *edge=( BPy_NMEdge *) PyList_GetItem(nmesh->edges, i);
- BPy_NMVert *v=(BPy_NMVert *)edge->v1;
- v->index=-1;
- v=(BPy_NMVert *)edge->v2;
- v->index=-1;
- }
-
- for( i = 0; i < mesh->totvert; i++ ) {
- BPy_NMVert *mv =
- ( BPy_NMVert * ) PySequence_GetItem( nmesh->verts, i );
- mv->index = i;
- Py_DECREF( mv );
- }
-
- newmv = mesh->mvert;
- newst = mesh->msticky;
- for( i = 0; i < mesh->totvert; i++ ) {
- PyObject *mv = PySequence_GetItem( nmesh->verts, i );
- mvert_from_data( newmv, newst, ( BPy_NMVert * ) mv );
- Py_DECREF( mv );
-
- newmv++;
- if( newst )
- newst++;
- }
-
- newmf = mesh->mface;
- for( i = 0; i < mesh->totface; i++ ) {
- PyObject *mf = PySequence_GetItem( nmesh->faces, i );
- ok = mface_from_data( newmf, &mesh->fdata, i, ( BPy_NMFace * ) mf );
- Py_DECREF( mf );
- if( !ok )
- return 0;
- newmf++;
- }
-
- /* Always do this to ensure no loose edges in faces */
- fill_medge_from_nmesh(mesh, nmesh);
-
- return 1;
-}
-
-static PyObject *M_NMesh_PutRaw( PyObject * self, PyObject * args )
-{
- char *name = NULL;
- Mesh *mesh = NULL;
- Object *ob = NULL;
- BPy_NMesh *nmesh;
- int recalc_normals = 1;
- int store_edges = 0;
- int old_totvert = 0;
-
- if( !PyArg_ParseTuple( args, "O!|sii",
- &NMesh_Type, &nmesh, &name, &recalc_normals, &store_edges ) )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected an NMesh object and optionally also a string and two ints" );
-
- if( check_NMeshLists( nmesh ) )
- return NULL;
-
- if( name )
- mesh = ( Mesh * ) GetIdFromList( &( G.main->mesh ), name );
-
- if( !mesh || mesh->id.us == 0 ) {
- ob = add_object( OB_MESH );
- if( !ob ) {
- PyErr_SetString( PyExc_RuntimeError,
- "Fatal: could not create mesh object" );
- return 0;
- }
-
- if( !mesh )
- mesh = ( Mesh * ) ob->data;
- else
- set_mesh( ob, mesh ); // also does id.us++
-
- nmesh->object = ob; // linking so vgrouping methods know which obj to work on
- }
-
- if( name )
- new_id( &( G.main->mesh ), &mesh->id, name );
- else if( nmesh->name && nmesh->name != Py_None )
- new_id( &( G.main->mesh ), &mesh->id,
- PyString_AsString( nmesh->name ) );
-
- old_totvert = mesh->totvert;
-
- unlink_existingMeshData( mesh );
- if( !convert_NMeshToMesh( mesh, nmesh ) )
- return NULL;
- nmesh->mesh = mesh;
-
- if (mesh->dvert) check_dverts(mesh, old_totvert);
-
- if( recalc_normals )
- mesh_calc_normals(mesh->mvert, mesh->totvert, mesh->mface, mesh->totface, NULL);
-
- mesh_update( mesh, nmesh->object );
-
- if( !during_script( ) )
- EXPP_allqueue( REDRAWVIEW3D, 0 );
-
- if (ob && G.obedit) { /* prevents a crash when a new object is created */
- exit_editmode(EM_FREEDATA);
- enter_editmode(0);
- }
-
- // @OK...this requires some explanation:
- // Materials can be assigned two ways:
- // a) to the object data (in this case, the mesh)
- // b) to the Object
- //
- // Case a) is wanted, if Mesh data should be shared among objects,
- // as well as its materials (up to 16)
- // Case b) is wanted, when Mesh data should be shared, but not the
- // materials. For example, you want several checker boards sharing their
- // mesh data, but having different colors. So you would assign material
- // index 0 to all even, index 1 to all odd faces and bind the materials
- // to the Object instead (MaterialButtons: [OB] "link materials to object")
- //
- // This feature implies that pointers to materials can be stored in
- // an object or a mesh. The number of total materials MUST be
- // synchronized (ob->totcol <-> mesh->totcol). We avoid the dangerous
- // direct access by calling blenderkernel/material.c:assign_material().
-
- // The flags setting the material binding is found in ob->colbits, where
- // each bit indicates the binding PER MATERIAL
-
- if( ob ) { // we created a new object
- NMesh_assignMaterials_toObject( nmesh, ob );
- EXPP_synchronizeMaterialLists( ob );
- return Object_CreatePyObject( ob );
- } else {
- mesh->mat =
- EXPP_newMaterialList_fromPyList( nmesh->materials );
- EXPP_incr_mats_us( mesh->mat,
- PyList_Size( nmesh->materials ) );
- Py_RETURN_NONE;
- }
-
-}
-
-#undef MethodDef
-#define MethodDef(func) \
- {#func, M_NMesh_##func, METH_VARARGS, M_NMesh_##func##_doc}
-
-static struct PyMethodDef M_NMesh_methods[] = {
- MethodDef( Col ),
- MethodDef( Vert ),
- MethodDef( Face ),
- MethodDef( New ),
- MethodDef( GetRaw ),
- MethodDef( GetRawFromObject ),
- MethodDef( PutRaw ),
- {"GetNames", (PyCFunction)M_NMesh_GetNames, METH_NOARGS,
- M_NMesh_GetNames_doc},
- {NULL, NULL, 0, NULL}
-};
-
-static PyObject *M_NMesh_Modes( void )
-{
- PyObject *Modes = PyConstant_New( );
-
- if( Modes ) {
- BPy_constant *d = ( BPy_constant * ) Modes;
-
- PyConstant_Insert( d, "NOVNORMALSFLIP",
- PyInt_FromLong
- ( ME_NOPUNOFLIP ) );
- PyConstant_Insert( d, "TWOSIDED",
- PyInt_FromLong( ME_TWOSIDED ) );
- PyConstant_Insert( d, "AUTOSMOOTH",
- PyInt_FromLong
- ( ME_AUTOSMOOTH ) );
- }
-
- return Modes;
-}
-
-#undef EXPP_ADDCONST
-#define EXPP_ADDCONST(dict, name) \
- PyConstant_Insert(dict, #name, PyInt_FromLong(TF_##name))
-/* Set constants for face drawing mode -- see drawmesh.c */
-
-static PyObject *M_NMesh_FaceModesDict( void )
-{
- PyObject *FM = PyConstant_New( );
-
- if( FM ) {
- BPy_constant *d = ( BPy_constant * ) FM;
-
- PyConstant_Insert( d, "BILLBOARD",
- PyInt_FromLong( TF_BILLBOARD2 ) );
- PyConstant_Insert( d, "ALL", PyInt_FromLong( 0x7fff ) );
- PyConstant_Insert( d, "HALO", PyInt_FromLong( TF_BILLBOARD ) );
- PyConstant_Insert( d, "DYNAMIC", PyInt_FromLong( TF_DYNAMIC ) );
- PyConstant_Insert( d, "INVISIBLE", PyInt_FromLong( TF_INVISIBLE ) );
- PyConstant_Insert( d, "LIGHT", PyInt_FromLong( TF_LIGHT ) );
- PyConstant_Insert( d, "OBCOL", PyInt_FromLong( TF_OBCOL ) );
- PyConstant_Insert( d, "SHADOW", PyInt_FromLong( TF_SHADOW ) );
- PyConstant_Insert( d, "TEXT", PyInt_FromLong( TF_BMFONT ) );
- PyConstant_Insert( d, "SHAREDVERT", PyInt_FromLong( TF_SHAREDVERT ) );
- PyConstant_Insert( d, "SHAREDCOL", PyInt_FromLong( TF_SHAREDCOL ) );
- PyConstant_Insert( d, "TEX", PyInt_FromLong( TF_TEX ) );
- PyConstant_Insert( d, "TILES", PyInt_FromLong( TF_TILES ) );
- PyConstant_Insert( d, "TWOSIDE", PyInt_FromLong( TF_TWOSIDE ) );
- }
-
- return FM;
-}
-
-static PyObject *M_NMesh_FaceFlagsDict( void )
-{
- PyObject *FF = PyConstant_New( );
-
- if( FF ) {
- BPy_constant *d = ( BPy_constant * ) FF;
-
- EXPP_ADDCONST( d, SELECT );
- EXPP_ADDCONST( d, HIDE );
- EXPP_ADDCONST( d, ACTIVE );
- }
-
- return FF;
-}
-
-static PyObject *M_NMesh_FaceTranspModesDict( void )
-{
- PyObject *FTM = PyConstant_New( );
-
- if( FTM ) {
- BPy_constant *d = ( BPy_constant * ) FTM;
-
- EXPP_ADDCONST( d, SOLID );
- EXPP_ADDCONST( d, ADD );
- EXPP_ADDCONST( d, ALPHA );
- EXPP_ADDCONST( d, SUB );
- }
-
- return FTM;
-}
-
-static PyObject *M_NMesh_EdgeFlagsDict( void )
-{
- PyObject *EF = PyConstant_New( );
-
- if( EF ) {
- BPy_constant *d = ( BPy_constant * ) EF;
-
- PyConstant_Insert(d, "SELECT", PyInt_FromLong(1));
- PyConstant_Insert(d, "EDGEDRAW", PyInt_FromLong(ME_EDGEDRAW));
- PyConstant_Insert(d, "EDGERENDER", PyInt_FromLong(ME_EDGERENDER));
- PyConstant_Insert(d, "SEAM", PyInt_FromLong(ME_SEAM));
- PyConstant_Insert(d, "FGON", PyInt_FromLong(ME_FGON));
- }
-
- return EF;
-}
-
-PyObject *NMesh_Init( void )
-{
- PyObject *submodule;
-
- PyObject *Modes = M_NMesh_Modes( );
- PyObject *FaceFlags = M_NMesh_FaceFlagsDict( );
- PyObject *FaceModes = M_NMesh_FaceModesDict( );
- PyObject *FaceTranspModes = M_NMesh_FaceTranspModesDict( );
- PyObject *EdgeFlags = M_NMesh_EdgeFlagsDict( );
-
- NMCol_Type.ob_type = &PyType_Type;
- NMFace_Type.ob_type = &PyType_Type;
- NMVert_Type.ob_type = &PyType_Type;
- NMesh_Type.ob_type = &PyType_Type;
-
- submodule =
- Py_InitModule3( "Blender.NMesh", M_NMesh_methods,
- M_NMesh_doc );
-
- if( Modes )
- PyModule_AddObject( submodule, "Modes", Modes );
- if( FaceFlags )
- PyModule_AddObject( submodule, "FaceFlags", FaceFlags );
- if( FaceModes )
- PyModule_AddObject( submodule, "FaceModes", FaceModes );
- if( FaceTranspModes )
- PyModule_AddObject( submodule, "FaceTranspModes",
- FaceTranspModes );
- if( EdgeFlags )
- PyModule_AddObject( submodule, "EdgeFlags", EdgeFlags );
-
- g_nmeshmodule = submodule;
- return submodule;
-}
-
-/* These are needed by Object.c */
-
-PyObject *NMesh_CreatePyObject( Mesh * me, Object * ob )
-{
- BPy_NMesh *nmesh = ( BPy_NMesh * ) new_NMesh( me );
-
- if( nmesh )
- nmesh->object = ob; /* linking nmesh and object for vgrouping methods */
-
- return ( PyObject * ) nmesh;
-}
-
-int NMesh_CheckPyObject( PyObject * pyobj )
-{
- return ( pyobj->ob_type == &NMesh_Type );
-}
-
-Mesh *NMesh_FromPyObject( PyObject * pyobj, Object * ob )
-{
- if( pyobj->ob_type == &NMesh_Type ) {
- Mesh *mesh;
- BPy_NMesh *nmesh = ( BPy_NMesh * ) pyobj;
-
- if( nmesh->mesh ) {
- mesh = nmesh->mesh;
- } else {
- mesh = Mesh_fromNMesh( nmesh );
- if( !mesh ) /* NULL means an PyError */
- return NULL;
-
- nmesh->mesh = mesh;
-
- nmesh->object = ob; /* linking for vgrouping methods */
- if( nmesh->name && nmesh->name != Py_None )
- new_id( &( G.main->mesh ), &mesh->id,
- PyString_AsString( nmesh->name ) );
- mesh_update( mesh, nmesh->object );
- nmesh_updateMaterials( nmesh );
- }
- return mesh;
- }
-
- PyErr_SetString( PyExc_AttributeError,
- "link argument type is not supported " );
- return NULL;
-}
-
-#define POINTER_CROSS_EQ(a1, a2, b1, b2) (((a1)==(b1) && (a2)==(b2)) || ((a1)==(b2) && (a2)==(b1)))
-
-static PyObject *findEdge( BPy_NMesh *nmesh, BPy_NMVert *v1, BPy_NMVert *v2, int create)
-{
- int i;
-
- for ( i = 0; i < PyList_Size(nmesh->edges); ++i )
- {
- BPy_NMEdge *edge=(BPy_NMEdge*)PyList_GetItem( nmesh->edges, i );
- if (!BPy_NMEdge_Check(edge)) continue;
- if ( POINTER_CROSS_EQ((BPy_NMVert*)edge->v1, (BPy_NMVert*)edge->v2, v1, v2) )
- {
- return EXPP_incr_ret((PyObject*)edge);
- }
- }
-
- /* if this line is reached, edge has not been found */
- if (create)
- {
- PyObject *newEdge=(PyObject *)new_NMEdge(v1, v2, 0, ME_EDGEDRAW|ME_EDGERENDER);
- PyList_Append(nmesh->edges, newEdge);
- return newEdge;
- }
- else
- Py_RETURN_NONE;
-}
-
-static void removeEdge( BPy_NMesh *nmesh, BPy_NMVert *v1, BPy_NMVert *v2, int ununsedOnly)
-{
- int i,j;
- BPy_NMEdge *edge=NULL;
- int edgeUsedByFace=0;
- int totedge=PyList_Size(nmesh->edges);
-
- /* find the edge in the edge list */
- for ( i = 0; i < totedge; ++i )
- {
- edge=(BPy_NMEdge*)PyList_GetItem( nmesh->edges, i );
- if (!BPy_NMEdge_Check(edge)) continue;
- if ( POINTER_CROSS_EQ((BPy_NMVert*)edge->v1, (BPy_NMVert*)edge->v2, v1, v2) )
- {
- break;
- }
- }
-
- if (i==totedge || !edge) // edge not found
- return;
-
- for ( j = PyList_Size(nmesh->faces)-1; j >= 0 ; --j )
- {
- BPy_NMFace *face=(BPy_NMFace *)PyList_GetItem(nmesh->faces, j);
- int k, del_face=0;
- int totv;
- if (!BPy_NMFace_Check(face)) continue;
- totv=PyList_Size(face->v);
- if (totv<2) continue;
- for ( k = 0; k < totv && !del_face; ++k )
- {
- BPy_NMVert *fe_v1=(BPy_NMVert *)PyList_GetItem(face->v, k ? k-1 : totv-1);
- BPy_NMVert *fe_v2=(BPy_NMVert *)PyList_GetItem(face->v, k);
- if ( POINTER_CROSS_EQ(v1, v2, fe_v1, fe_v2) )
- {
- edgeUsedByFace=1;
- del_face=1;
- }
- }
- if (del_face && !ununsedOnly)
- {
- PySequence_DelItem(nmesh->faces, j);
- }
- }
-
- if (!ununsedOnly || (ununsedOnly && !edgeUsedByFace) )
- PySequence_DelItem(nmesh->edges, PySequence_Index(nmesh->edges, (PyObject*)edge));
-}
-
-
-static PyObject *NMesh_addEdge( PyObject * self, PyObject * args )
-{
- BPy_NMesh *bmesh=(BPy_NMesh *)self;
- BPy_NMVert *v1=NULL, *v2=NULL;
-
- if (!PyArg_ParseTuple
- ( args, "O!O!", &NMVert_Type, &v1, &NMVert_Type, &v2 ) ) {
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected NMVert, NMVert" );
- }
-
- if (v1==v2)
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "vertices must be different" );
-
- return findEdge(bmesh, v1, v2, 1);
-}
-
-static PyObject *NMesh_findEdge( PyObject * self, PyObject * args )
-{
- BPy_NMesh *bmesh=(BPy_NMesh *)self;
- BPy_NMVert *v1=NULL, *v2=NULL;
-
- if (!PyArg_ParseTuple
- ( args, "O!O!", &NMVert_Type, &v1, &NMVert_Type, &v2 ) ) {
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected NMVert, NMVert" );
- }
-
- if (v1==v2)
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "vertices must be different" );
-
- return findEdge(bmesh, v1, v2, 0);
-}
-
-static PyObject *NMesh_removeEdge( PyObject * self, PyObject * args )
-{
- BPy_NMesh *bmesh=(BPy_NMesh *)self;
- BPy_NMVert *v1=NULL, *v2=NULL;
-
- if (!PyArg_ParseTuple
- ( args, "O!O!", &NMVert_Type, &v1, &NMVert_Type, &v2 ) ) {
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected NMVert, NMVert" );
- }
-
- if (v1==v2)
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "vertices must be different" );
- removeEdge(bmesh, v1, v2, 0);
-
- Py_RETURN_NONE;
-}
-
-
-static PyObject *NMesh_addFace( PyObject * self, PyObject * args )
-{
- BPy_NMesh *nmesh=(BPy_NMesh *)self;
-
- BPy_NMFace *face;
- int totv=0;
-
- if (!PyArg_ParseTuple
- ( args, "O!", &NMFace_Type, &face ) ) {
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected NMFace argument" );
- }
-
- totv=PyList_Size(face->v);
-
- /*
- * Before edges data exists, having faces with two vertices was
- * the only way of storing edges not attached to any face.
- */
- if (totv!=2)
- PyList_Append(nmesh->faces, (PyObject*)face);
-
- if (totv>=2)
- {
- /* when totv==2, there is only one edge, when totv==3 there is three edges
- * and when totv==4 there is four edges.
- * that's why in the following line totv==2 is a special case */
- PyObject *edges = PyList_New((totv==2) ? 1 : totv);
- if (totv==2)
- {
- BPy_NMVert *fe_v1=(BPy_NMVert *)PyList_GetItem(face->v, 0);
- BPy_NMVert *fe_v2=(BPy_NMVert *)PyList_GetItem(face->v, 1);
- BPy_NMEdge *edge=(BPy_NMEdge *)findEdge(nmesh, fe_v1, fe_v2, 1);
- PyList_SetItem(edges, 0, (PyObject*)edge); // PyList_SetItem steals the reference
- }
- else
- {
- int k;
- for ( k = 0; k < totv; ++k )
- {
- BPy_NMVert *fe_v1=(BPy_NMVert *)PyList_GetItem(face->v, k ? k-1 : totv-1);
- BPy_NMVert *fe_v2=(BPy_NMVert *)PyList_GetItem(face->v, k);
- BPy_NMEdge *edge=(BPy_NMEdge *)findEdge(nmesh, fe_v1, fe_v2, 1);
- PyList_SetItem(edges, k, (PyObject*)edge); // PyList_SetItem steals the reference
- }
- }
- return edges;
- }
-
- Py_RETURN_NONE;
-}
-
-static PyObject *NMesh_removeFace( PyObject * self, PyObject * args )
-{
- BPy_NMesh *nmesh=(BPy_NMesh *)self;
-
- BPy_NMFace *face;
- int totv=0;
-
- if (!PyArg_ParseTuple
- ( args, "O!", &NMFace_Type, &face ) ) {
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected NMFace argument" );
- }
-
- totv=PyList_Size(face->v);
-
- {
- int index=PySequence_Index(nmesh->faces, (PyObject*)face);
- if (index>=0)
- PySequence_DelItem(nmesh->faces, index);
- }
-
- if (totv>=2)
- {
- /* when totv==2, there is only one edge, when totv==3 there is three edges
- * and when totv==4 there is four edges.
- * that's why in the following line totv==2 is a special case */
- if (totv==2)
- {
- BPy_NMVert *fe_v1=(BPy_NMVert *)PyList_GetItem(face->v, 0);
- BPy_NMVert *fe_v2=(BPy_NMVert *)PyList_GetItem(face->v, 1);
- removeEdge(nmesh, fe_v1, fe_v2, 1);
- }
- else
- {
- int k;
- for ( k = 0; k < totv; ++k )
- {
- BPy_NMVert *fe_v1=(BPy_NMVert *)PyList_GetItem(face->v, k ? k-1 : totv-1);
- BPy_NMVert *fe_v2=(BPy_NMVert *)PyList_GetItem(face->v, k);
- removeEdge(nmesh, fe_v1, fe_v2, 1);
- }
- }
- }
-
- Py_RETURN_NONE;
-}
-
-static PyObject *NMesh_printDebug( PyObject * self )
-{
- BPy_NMesh *bmesh=(BPy_NMesh *)self;
-
- Mesh *mesh=bmesh->mesh;
-
- printf("**Vertices\n");
- {
- int i;
- for (i=0; i<mesh->totvert; ++i)
- {
- MVert *v=mesh->mvert+i;
- double x=v->co[0];
- double y=v->co[1];
- double z=v->co[2];
- printf(" %2d : %.3f %.3f %.3f\n", i, x, y, z);
- }
- }
-
- printf("**Edges\n");
- {
- int i;
- for (i=0; i<mesh->totedge; ++i)
- {
- MEdge *e=mesh->medge+i;
- int v1 = e->v1;
- int v2 = e->v2;
- int flag = e->flag;
- printf(" %2d : %2d %2d flag=%d\n", i, v1, v2, flag);
- }
- }
-
- printf("**Faces\n");
- {
- int i;
- for (i=0; i<mesh->totface; ++i)
- {
- MFace *e=((MFace*)(mesh->mface))+i;
- int v1 = e->v1;
- int v2 = e->v2;
- int v3 = e->v3;
- int v4 = e->v4;
- printf(" %2d : %2d %2d %2d %2d\n", i, v1, v2, v3, v4);
- }
- }
-
- Py_RETURN_NONE;
-}
-
-static PyObject *NMesh_addVertGroup( PyObject * self, PyObject * args )
-{
- char *groupStr;
- struct Object *object;
- PyObject *tempStr;
-
- if( !PyArg_ParseTuple( args, "s", &groupStr ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument" );
-
- if( ( ( BPy_NMesh * ) self )->object == NULL )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "mesh must be linked to an object first..." );
-
- object = ( ( BPy_NMesh * ) self )->object;
-
- //get clamped name
- tempStr = PyString_FromStringAndSize( groupStr, 32 );
- groupStr = PyString_AsString( tempStr );
-
- add_defgroup_name( object, groupStr );
-
- EXPP_allqueue( REDRAWBUTSALL, 1 );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *NMesh_removeVertGroup( PyObject * self, PyObject * args )
-{
- char *groupStr;
- struct Object *object;
- int nIndex;
- bDeformGroup *pGroup;
-
- if( !PyArg_ParseTuple( args, "s", &groupStr ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument" );
-
- if( ( ( BPy_NMesh * ) self )->object == NULL )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "mesh must be linked to an object first..." );
-
- object = ( ( BPy_NMesh * ) self )->object;
-
- pGroup = get_named_vertexgroup( object, groupStr );
- if( pGroup == NULL )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "group does not exist!" );
-
- nIndex = get_defgroup_num( object, pGroup );
- if( nIndex == -1 )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "no deform groups assigned to mesh" );
- nIndex++;
- object->actdef = (unsigned short)nIndex;
-
- del_defgroup( object );
-
- EXPP_allqueue( REDRAWBUTSALL, 1 );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *NMesh_assignVertsToGroup( PyObject * self, PyObject * args )
-{
- //listObject is an integer list of vertex indices to add to group
- //groupStr = group name
- //weight is a float defining the weight this group has on this vertex
- //assignmode = "replace", "add", "subtract"
- // replace weight - add addition weight to vertex for this group
- // - remove group influence from this vertex
- //the function will not like it if your in editmode...
-
- char *groupStr;
- char *assignmodeStr = NULL;
- int nIndex;
- int assignmode;
- float weight = 1.0;
- struct Object *object;
- bDeformGroup *pGroup;
- PyObject *listObject;
- int tempInt;
- int x;
-
- if( ( ( BPy_NMesh * ) self )->object == NULL )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "mesh must be linked to an object first..." );
-
- if( !PyArg_ParseTuple
- ( args, "sO!fs", &groupStr, &PyList_Type, &listObject, &weight,
- &assignmodeStr ) ) {
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string, list, float, string arguments" );
- }
-
- object = ( ( BPy_NMesh * ) self )->object;
-
- if( object->data == NULL )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "object contains no data..." );
-
- pGroup = get_named_vertexgroup( object, groupStr );
- if( pGroup == NULL )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "group does not exist!" );
-
- nIndex = get_defgroup_num( object, pGroup );
- if( nIndex == -1 )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "no deform groups assigned to mesh" );
-
- if( assignmodeStr == NULL )
- assignmode = 1; /* default */
- else if( STREQ( assignmodeStr, "replace" ) )
- assignmode = 1;
- else if( STREQ( assignmodeStr, "add" ) )
- assignmode = 2;
- else if( STREQ( assignmodeStr, "subtract" ) )
- assignmode = 3;
- else
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "bad assignment mode" );
-
- //makes a set of dVerts corresponding to the mVerts
- if( !( ( Mesh * ) object->data )->dvert ) {
- create_dverts( object->data );
- }
- //loop list adding verts to group
- for( x = 0; x < PyList_Size( listObject ); x++ ) {
- if( !
- ( PyArg_Parse
- ( ( PyList_GetItem( listObject, x ) ), "i",
- &tempInt ) ) ) {
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "python list integer not parseable" );
- }
-
- if( tempInt < 0
- || tempInt >= ( ( Mesh * ) object->data )->totvert ) {
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "bad vertex index in list" );
- }
-
- add_vert_defnr( object, nIndex, tempInt, weight, assignmode );
- }
-
- Py_RETURN_NONE;
-}
-
-static PyObject *NMesh_removeVertsFromGroup( PyObject * self, PyObject * args )
-{
- //not passing a list will remove all verts from group
-
- char *groupStr;
- int nIndex;
- struct Object *object;
- bDeformGroup *pGroup;
- PyObject *listObject;
- int tempInt;
- int x, argc;
-
- /* argc is the number of parameters passed in: 1 (no list given) or 2: */
- argc = PyObject_Length( args );
-
- if( !PyArg_ParseTuple
- ( args, "s|O!", &groupStr, &PyList_Type, &listObject ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string and optional list argument" );
-
- if( ( ( BPy_NMesh * ) self )->object == NULL )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "mesh must be linked to an object first..." );
-
- object = ( ( BPy_NMesh * ) self )->object;
-
- if( object->data == NULL )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "object contains no data..." );
-
- if( ( !( ( Mesh * ) object->data )->dvert ) )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "this mesh contains no deform vertices...'" );
-
- pGroup = get_named_vertexgroup( object, groupStr );
- if( pGroup == NULL )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "group does not exist!" );
-
- nIndex = get_defgroup_num( object, pGroup );
- if( nIndex == -1 )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "no deform groups assigned to mesh" );
-
- if( argc == 1 ) { /* no list given */
- //enter editmode
- if( ( G.obedit == 0 ) ) {
- //set current object
- BASACT->object = object;
- G.obedit = BASACT->object;
- }
- //set current vertex group
- nIndex++;
- object->actdef = (unsigned short)nIndex;
-
- //clear all dVerts in active group
- remove_verts_defgroup( 1 );
-
- //exit editmode
- G.obedit = 0;
- } else {
- if( G.obedit != 0 ) //remove_vert_def_nr doesn't like it if your in editmode
- G.obedit = 0;
-
- //loop list adding verts to group
- for( x = 0; x < PyList_Size( listObject ); x++ ) {
- if( !
- ( PyArg_Parse
- ( ( PyList_GetItem( listObject, x ) ), "i",
- &tempInt ) ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "python list integer not parseable" );
-
- if( tempInt < 0
- || tempInt >=
- ( ( Mesh * ) object->data )->totvert )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "bad vertex index in list" );
-
- remove_vert_def_nr( object, nIndex, tempInt );
- }
- }
-
- Py_RETURN_NONE;
-}
-
-static PyObject *NMesh_getVertsFromGroup( PyObject * self, PyObject * args )
-{
- //not passing a list will return all verts from group
- //passing indecies not part of the group will not return data in pyList
- //can be used as a index/group check for a vertex
-
- char *groupStr;
- int nIndex;
- int weightRet;
- struct Object *object;
- bDeformGroup *pGroup;
- MVert *mvert;
- MDeformVert *dvert;
- float weight;
- int i, k, l1, l2, count;
- int num = 0;
- PyObject *tempVertexList = NULL;
- PyObject *vertexList;
- PyObject *listObject;
- int tempInt;
- int x;
-
- listObject = Py_None; //can't use NULL macro because compiler thinks
- //it's a 0 and we need to check 0 index vertex pos
- l1 = FALSE;
- l2 = FALSE;
- weightRet = 0;
-
- if( !PyArg_ParseTuple( args, "s|iO!", &groupStr, &weightRet,
- &PyList_Type, &listObject ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string and optional int and list arguments" );
-
- if( weightRet < 0 || weightRet > 1 )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "return weights flag must be 0 or 1..." );
-
- if( ( ( BPy_NMesh * ) self )->object == NULL )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "mesh must be linked to an object first..." );
-
- object = ( ( BPy_NMesh * ) self )->object;
-
- if( object->data == NULL )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "object contains no data..." );
-
- if( ( !( ( Mesh * ) object->data )->dvert ) )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "this mesh contains no deform vertices...'" );
-
- pGroup = get_named_vertexgroup( object, groupStr );
- if( pGroup == NULL )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "group does not exist!" );
-
- nIndex = get_defgroup_num( object, pGroup );
- if( nIndex == -1 )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "no deform groups assigned to mesh" );
-
- //temporary list
- tempVertexList = PyList_New( ( ( Mesh * ) object->data )->totvert );
- if( tempVertexList == NULL )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "getVertsFromGroup: can't create pylist!" );
-
- count = 0;
-
- if( listObject == Py_None ) //do entire group
- {
- for( k = 0; k < ( ( Mesh * ) object->data )->totvert; k++ ) {
- dvert = ( ( Mesh * ) object->data )->dvert + k;
-
- for( i = 0; i < dvert->totweight; i++ ) {
- if( dvert->dw[i].def_nr == nIndex ) {
- mvert = ( ( Mesh * ) object->data )->
- mvert + k;
- weight = dvert->dw[i].weight;
- //printf("index =%3d weight:%10f\n", k, weight);
-
- if( weightRet == 1 )
- PyList_SetItem( tempVertexList,
- count,
- Py_BuildValue
- ( "(i,f)", k,
- weight ) );
- else if( weightRet == 0 )
- PyList_SetItem( tempVertexList,
- count,
- Py_BuildValue
- ( "i", k ) );
-
- count++;
- }
- }
- }
- } else //do single vertex
- {
- //loop list adding verts to group
- for( x = 0; x < PyList_Size( listObject ); x++ ) {
- if( !
- ( PyArg_Parse
- ( ( PyList_GetItem( listObject, x ) ), "i",
- &tempInt ) ) ) {
- Py_DECREF(tempVertexList);
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "python list integer not parseable" );
- }
- if( tempInt < 0
- || tempInt >=
- ( ( Mesh * ) object->data )->totvert ) {
- Py_DECREF(tempVertexList);
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "bad vertex index in list" );
- }
- num = tempInt;
- dvert = ( ( Mesh * ) object->data )->dvert + num;
- for( i = 0; i < dvert->totweight; i++ ) {
- l1 = TRUE;
- if( dvert->dw[i].def_nr == nIndex ) {
- l2 = TRUE;
- mvert = ( ( Mesh * ) object->data )->
- mvert + num;
-
- weight = dvert->dw[i].weight;
- //printf("index =%3d weight:%10f\n", num, weight);
-
- if( weightRet == 1 ) {
- PyList_SetItem( tempVertexList,
- count,
- Py_BuildValue
- ( "(i,f)", num,
- weight ) );
- } else if( weightRet == 0 )
- PyList_SetItem( tempVertexList,
- count,
- Py_BuildValue
- ( "i", num ) );
-
- count++;
- }
- if( l2 == FALSE )
- printf( "vertex at index %d is not part of passed group...\n", tempInt );
- }
- if( l1 == FALSE )
- printf( "vertex at index %d is not assigned to a vertex group...\n", tempInt );
-
- l1 = l2 = FALSE; //reset flags
- }
- }
- //only return what we need
- vertexList = PyList_GetSlice( tempVertexList, 0, count );
-
- Py_DECREF( tempVertexList );
-
- return ( vertexList );
-}
-
-static PyObject *NMesh_renameVertGroup( PyObject * self, PyObject * args )
-{
- char *oldGr = NULL;
- char *newGr = NULL;
- bDeformGroup *defGroup = NULL;
- /*PyObject *tempStr; */
-
-
- if( !( ( BPy_NMesh * ) self )->object )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This mesh must be linked to an object" );
-
- if( !PyArg_ParseTuple( args, "ss", &oldGr, &newGr ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "Expected string & string argument" );
-
- defGroup =
- get_named_vertexgroup( ( ( BPy_NMesh * ) self )->object,
- oldGr );
- if( defGroup == NULL )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "Couldn't find the expected vertex group" );
-
- PyOS_snprintf( defGroup->name, 32, newGr );
- unique_vertexgroup_name( defGroup, ( ( BPy_NMesh * ) self )->object );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *NMesh_getVertGroupNames( PyObject * self )
-{
- bDeformGroup *defGroup;
- PyObject *list, *tmpstr;
-
- if( !( ( BPy_NMesh * ) self )->object )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This mesh must be linked to an object" );
-
- list = PyList_New( 0 );
- for( defGroup = ( ( ( BPy_NMesh * ) self )->object )->defbase.first;
- defGroup; defGroup = defGroup->next ) {
-
- tmpstr = PyString_FromString( defGroup->name );
- if( PyList_Append( list, tmpstr) < 0 ) {
- Py_XDECREF(list);
- Py_XDECREF(tmpstr);
- return EXPP_ReturnPyObjError( PyExc_RuntimeError, "Couldn't add item to list" );
- }
- Py_XDECREF(tmpstr);
- }
-
- return list;
-}
-
-static PyObject *NMesh_transform (PyObject *self, PyObject *args)
-{
- BPy_NMesh *nmesh = ( BPy_NMesh * ) self;
- BPy_NMVert *mv;
- PyObject *ob1 = NULL;
- MatrixObject *mat;
- float vx, vy, vz;
- int i, recalc_normals = 0;
-
- if( !PyArg_ParseTuple( args, "O!|i", &matrix_Type, &ob1, &recalc_normals ) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected matrix and optionally an int as arguments" ) );
-
- mat = ( MatrixObject * ) ob1;
-
- if( mat->colSize != 4 || mat->rowSize != 4 )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "matrix must be a 4x4 transformation matrix\n"
- "for example as returned by object.getMatrix()" ) );
-
- /* loop through all the verts and transform locations by the supplied
- * matrix */
- for( i = 0; i < PySequence_Length(nmesh->verts); i++ ) {
- mv = ( BPy_NMVert * ) PySequence_GetItem( nmesh->verts, i );
- vx = mv->co[0];
- vy = mv->co[1];
- vz = mv->co[2];
-
- /* Mat4MulVecfl(mat->matrix, mv->co); */
- mv->co[0] = vx*mat->matrix[0][0] + vy*mat->matrix[1][0] +
- vz*mat->matrix[2][0] + mat->matrix[3][0];
- mv->co[1] = vx*mat->matrix[0][1] + vy*mat->matrix[1][1] +
- vz*mat->matrix[2][1] + mat->matrix[3][1];
- mv->co[2] = vx*mat->matrix[0][2] + vy*mat->matrix[1][2] +
- vz*mat->matrix[2][2] + mat->matrix[3][2];
-
- Py_DECREF(mv);
- }
-
- if ( recalc_normals ) {
- /* loop through all the verts and transform normals by the inverse
- * of the transpose of the supplied matrix */
- float invmat[4][4];
-
- /* we only need to invert a 3x3 submatrix, because the 4th component of
- * affine vectors is 0, but Mat4Invert reports non invertible matrices */
- if (!Mat4Invert((float(*)[4])*invmat, (float(*)[4])*mat->matrix))
- return EXPP_ReturnPyObjError (PyExc_AttributeError,
- "given matrix is not invertible");
-
- for( i = 0; i < PySequence_Length(nmesh->verts); i++ ) {
- mv = ( BPy_NMVert * ) PySequence_GetItem( nmesh->verts, i );
- vx = mv->no[0];
- vy = mv->no[1];
- vz = mv->no[2];
- mv->no[0] = vx*invmat[0][0] + vy*invmat[0][1] + vz*invmat[0][2];
- mv->no[1] = vx*invmat[1][0] + vy*invmat[1][1] + vz*invmat[1][2];
- mv->no[2] = vx*invmat[2][0] + vy*invmat[2][1] + vz*invmat[2][2];
- Normalize(mv->no);
- Py_DECREF(mv);
- }
- }
-
- /* should we alternatively return a list of changed verts (and preserve
- * the original ones) ? */
- Py_RETURN_NONE;
-}
diff --git a/source/blender/python/api2_2x/NMesh.h b/source/blender/python/api2_2x/NMesh.h
deleted file mode 100644
index 3a3b6e10088..00000000000
--- a/source/blender/python/api2_2x/NMesh.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * $Id: NMesh.h 10269 2007-03-15 01:09:14Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano, Jordi Rovira i Bonnet, Joseph Gilbert.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-/* Most of this file comes from opy_nmesh.[ch] in the old bpython dir */
-
-#ifndef EXPP_NMESH_H
-#define EXPP_NMESH_H
-
-#include <Python.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "DNA_customdata_types.h"
-#include "DNA_object_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "Material.h"
-#include "Image.h"
-
-/* EXPP PyType Objects */
-extern PyTypeObject NMesh_Type;
-extern PyTypeObject NMFace_Type;
-extern PyTypeObject NMVert_Type;
-extern PyTypeObject NMCol_Type;
-extern PyTypeObject NMEdge_Type;
-
-
-struct BPy_Object;
-
-/* These are from blender/src/editdeform.c, should be declared elsewhere,
- * maybe in BIF_editdeform.h, after proper testing of vgrouping methods XXX */
-
-extern void add_vert_defnr( Object * ob, int def_nr, int vertnum, float weight,
- int assignmode );
-extern void remove_vert_def_nr( Object * ob, int def_nr, int vertnum );
-
-
-
-/* Type checking for EXPP PyTypes */
-#define BPy_NMesh_Check(v) ((v)->ob_type == &NMesh_Type)
-#define BPy_NMFace_Check(v) ((v)->ob_type == &NMFace_Type)
-#define BPy_NMVert_Check(v) ((v)->ob_type == &NMVert_Type)
-#define BPy_NMCol_Check(v) ((v)->ob_type == &NMCol_Type)
-#define BPy_NMEdge_Check(v) ((v)->ob_type == &NMEdge_Type)
-
-/* Typedefs for the new types */
-
-typedef struct {
- PyObject_HEAD /* required python macro */
- unsigned char r, g, b, a;
-
-} BPy_NMCol; /* an NMesh color: [r,g,b,a] */
-
-typedef struct {
- PyObject_VAR_HEAD /* required python macro */
- float co[3];
- float no[3];
- float uvco[3];
- int index;
- char flag; /* see MVert flag in DNA_meshdata_types */
-
-} BPy_NMVert; /* an NMesh vertex */
-
-typedef struct {
- PyObject_HEAD /* required python macro */
- PyObject * v;
- PyObject *uv;
- PyObject *col;
- short mode;
- short flag; /* tface->flag */
- unsigned char transp;
- Image *image;
- char mat_nr, mf_flag /* was char smooth */;
- int orig_index;
-
-} BPy_NMFace; /* an NMesh face */
-
-typedef struct {
- PyObject_HEAD /* required python macro */
- PyObject *v1;
- PyObject *v2;
- char crease;
- short flag;
-} BPy_NMEdge; /* an NMesh edge */
-
-typedef struct {
- PyObject_HEAD /* required python macro */
- Mesh * mesh; /* libdata must be second */
- Object *object; /* for vertex grouping info, since it's stored on the object */
- PyObject *name;
- PyObject *materials;
- PyObject *verts;
- PyObject *faces;
- PyObject *edges;
- int sel_face; /*@ XXX remove */
- short smoothresh; /* max AutoSmooth angle */
- short subdiv[2]; /* SubDiv Levels: display and rendering */
- short mode; /* see the EXPP_NMESH_* defines in the beginning of this file */
- char flags;
-
-#define NMESH_HASMCOL (1<<0)
-#define NMESH_HASVERTUV (1<<1)
-#define NMESH_HASFACEUV (1<<2)
-
- /* stores original data that is not accesible through NMesh, but that we
- still want to preserve, indexed by orig_index in NMFace */
- CustomData fdata;
- int totfdata;
-
-} BPy_NMesh;
-
-/* PROTOS */
-
-PyObject *NMesh_Init( void );
-PyObject *NMesh_CreatePyObject( Mesh * me, Object * ob );
-Mesh *NMesh_FromPyObject( PyObject * pyobj, Object * ob );
-
-void mesh_update( Mesh * mesh , Object * ob );
-PyObject *new_NMesh( Mesh * oldmesh );
-Mesh *Mesh_fromNMesh( BPy_NMesh * nmesh );
-PyObject *NMesh_assignMaterials_toObject( BPy_NMesh * nmesh, Object * ob );
-Material **nmesh_updateMaterials( BPy_NMesh * nmesh );
-Material **newMaterialList_fromPyList( PyObject * list );
-
-
-#endif /* EXPP_NMESH_H */
diff --git a/source/blender/python/api2_2x/Node.c b/source/blender/python/api2_2x/Node.c
deleted file mode 100644
index 2871eda9432..00000000000
--- a/source/blender/python/api2_2x/Node.c
+++ /dev/null
@@ -1,1213 +0,0 @@
-/*
- * $Id: Node.c 10454 2007-04-04 11:27:43Z jesterking $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2006, Blender Foundation
- * All rights reserved.
- *
- * Original code is this file
- *
- * Contributor(s): Nathan Letwory
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifdef USE_PYNODES /* note: won't work without patch */
-#include "Node.h"
-
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_node.h"
-
-#include "DNA_material_types.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-#include "gen_utils.h"
-
-static PyObject *Node_repr( BPy_Node * self );
-static int Node_compare(BPy_Node *a, BPy_Node *b);
-static PyObject *ShadeInput_repr( BPy_ShadeInput * self );
-static int ShadeInput_compare(BPy_ShadeInput *a, BPy_ShadeInput *b);
-
-/**
- * Take the descriptions from dict and create sockets for those in socks
- * socks is a socketstack from a bNodeTypeInfo
- */
-static int dict_socks_to_typeinfo(PyObject *dict, bNodeSocketType **socks, int len, int stage) {
- int a = 0, pos = 0;
- PyObject *key = NULL, *value = NULL;
- bNodeSocketType *newsocks = NULL;
-
- if(stage!=SH_NODE_DYNAMIC_READY && stage!=SH_NODE_DYNAMIC_ADDEXIST) {
- newsocks = MEM_callocN(sizeof(bNodeSocketType)*(len+1), "bNodeSocketType");
-
- if (dict) {
- if(PyDict_Check(dict)) {
- while(PyDict_Next(dict, &pos, &key, &value)) {
- if(PyTuple_Check(value) && PyTuple_Size(value)==7) {
- newsocks[a].name = BLI_strdup(PyString_AsString(key));
- newsocks[a].type = (int)(PyInt_AsLong(PyTuple_GetItem(value, 0)));
- newsocks[a].val1 = (float)(PyFloat_AsDouble(PyTuple_GetItem(value, 1)));
- newsocks[a].val2 = (float)(PyFloat_AsDouble(PyTuple_GetItem(value, 2)));
- newsocks[a].val3 = (float)(PyFloat_AsDouble(PyTuple_GetItem(value, 3)));
- newsocks[a].val4 = (float)(PyFloat_AsDouble(PyTuple_GetItem(value, 4)));
- newsocks[a].min = (float)(PyFloat_AsDouble(PyTuple_GetItem(value, 5)));
- newsocks[a].max = (float)(PyFloat_AsDouble(PyTuple_GetItem(value, 6)));
- a++;
- }
- }
- } else {
- return(EXPP_ReturnIntError( PyExc_AttributeError, "INPUT must be a dict"));
- }
- }
- newsocks[a].type = -1;
- if(*socks) {
- int b = 0;
- while((*socks)[b].type!=-1) {
- MEM_freeN((*socks)[b].name);
- (*socks)[b].name = NULL;
- b++;
- }
- MEM_freeN(*socks);
- }
- *socks = newsocks;
- }
- return 0;
-}
-
-/* Get number of complying entries in a dict.
- *
- */
-static int num_dict_sockets(PyObject *dict) {
- int a = 0, pos = 0;
- PyObject *key = NULL, *value = NULL;
- while(PyDict_Next(dict, &pos, &key, &value)) {
- if(PyTuple_Check(value) && PyTuple_Size(value)==7)
- a++;
- }
- return a;
-}
-
-static int Map_socketdef(PyObject *self, PyObject *args, void *closure)
-{
- int newincnt = 0, newoutcnt = 0;
- bNode *node = NULL;
- BPy_DefinitionMap *defs= NULL;
-
- Py_INCREF(args);
- Py_INCREF(self);
-
- defs= (BPy_DefinitionMap *)self;
- node= defs->node;
-
- if(!node) {
- fprintf(stderr,"! no bNode in BPy_Node (Map_socketdef)\n");
- return 0;
- }
-
- if(node->custom1==SH_NODE_DYNAMIC_READY && node->custom1==SH_NODE_DYNAMIC_ADDEXIST)
- return 0;
-
- switch((int)closure) {
- case 'I':
- if (args) {
- if(PyDict_Check(args)) {
- newincnt = num_dict_sockets(args);
- dict_socks_to_typeinfo(args, &(node->typeinfo->inputs), newincnt, node->custom1);
- } else {
- Py_DECREF(self);
- Py_DECREF(args);
- return(EXPP_ReturnIntError( PyExc_AttributeError, "INPUT must be a dict"));
- }
- }
- break;
- case 'O':
- if (args) {
- if(PyDict_Check(args)) {
- newoutcnt = num_dict_sockets(args);
- dict_socks_to_typeinfo(args, &(node->typeinfo->outputs), newoutcnt, node->custom1);
- } else {
- Py_DECREF(self);
- Py_DECREF(args);
- return(EXPP_ReturnIntError( PyExc_AttributeError, "OUTPUT must be a dict"));
- }
- }
- break;
- default:
- fprintf(stderr, "Hrm, why we got no dict? Todo: figure out proper complaint to scripter\n");
- break;
- }
- Py_DECREF(self);
- Py_DECREF(args);
- return 0;
-}
-
-static PyGetSetDef InputDefMap_getseters[] = {
- {"definitions", (getter)NULL, (setter)Map_socketdef,
- "Set the inputs definition (dictionary)",
- (void *)'I'},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-PyTypeObject InputDefMap_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender.Node.InputDefinitions", /* char *tp_name; */
- sizeof( BPy_DefinitionMap ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL,/* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- NULL, /* cmpfunc tp_compare; */
- NULL, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- 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; */
- NULL, /* getattrofunc tp_getattro; */
- NULL, /* setattrofunc tp_setattro; */
-
- /* Functions to access object as input/input buffer */
- NULL, /* PyBufferProcs *tp_as_buffer; */
-
- /*** Flags to define presence of optional/expanded features ***/
- Py_TPFLAGS_DEFAULT, /* 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, /* richcmpfunc tp_richcompare; */
-
- /*** weak reference enabler ***/
- 0, /* long tp_weaklistoffset; */
-
- /*** Added in release 2.2 ***/
- /* Iterators */
- 0, //( getiterfunc) MVertSeq_getIter, /* getiterfunc tp_iter; */
- 0, //( iternextfunc ) MVertSeq_nextIter, /* iternextfunc tp_iternext; */
-
- /*** Attribute descriptor and subclassing stuff ***/
- 0, //BPy_MVertSeq_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- InputDefMap_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-BPy_DefinitionMap *Node_CreateInputDefMap(bNode *node) {
- BPy_DefinitionMap *map = PyObject_NEW(BPy_DefinitionMap, &InputDefMap_Type);
- map->node = node;
- return map;
-}
-
-/***************************************/
-
-static PyGetSetDef OutputDefMap_getseters[] = {
- {"definitions", (getter)NULL, (setter)Map_socketdef,
- "Set the outputs definition (dictionary)",
- (void *)'O'},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-PyTypeObject OutputDefMap_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender.Node.OutputDefinitions", /* char *tp_name; */
- sizeof( BPy_DefinitionMap ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL,/* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- NULL, /* cmpfunc tp_compare; */
- NULL, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- 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; */
- 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, /* 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, /* richcmpfunc tp_richcompare; */
-
- /*** weak reference enabler ***/
- 0, /* long tp_weaklistoffset; */
-
- /*** Added in release 2.2 ***/
- /* Iterators */
- 0, //( getiterfunc) MVertSeq_getIter, /* getiterfunc tp_iter; */
- 0, //( iternextfunc ) MVertSeq_nextIter, /* iternextfunc tp_iternext; */
-
- /*** Attribute descriptor and subclassing stuff ***/
- 0, //BPy_MVertSeq_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- OutputDefMap_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-BPy_DefinitionMap *Node_CreateOutputDefMap(bNode *node) {
- BPy_DefinitionMap *map = PyObject_NEW(BPy_DefinitionMap, &OutputDefMap_Type);
- map->node = node;
- return map;
-}
-
-/***************************************/
-
-static int sockinmap_len ( BPy_SockMap * self) {
- int a = 0;
- if(self->typeinfo) {
- while(self->typeinfo->inputs[a].type!=-1)
- a++;
- }
- return a;
-}
-
-static int sockinmap_has_key( BPy_SockMap *self, PyObject *key) {
- int a = 0;
- char *strkey = PyString_AsString(key);
-
- if(self->typeinfo){
- while(self->typeinfo->inputs[a].type!=-1) {
- if(BLI_strcaseeq(self->typeinfo->inputs[a].name, strkey)) {
- return a;
- }
- a++;
- }
- }
- return -1;
-}
-
-PyObject *sockinmap_subscript(BPy_SockMap *self, PyObject *idx) {
- int a, _idx;
- a = sockinmap_len(self);
-
- if (PyString_Check(idx)) {
- _idx = sockinmap_has_key( self, idx);
- }
- else if(PyInt_Check(idx)) {
- PyErr_SetString(PyExc_ValueError, "int index not implemented");
- Py_RETURN_NONE;
- }
- else if (PySlice_Check(idx)) {
- PyErr_SetString(PyExc_ValueError, "slices not implemented");
- Py_RETURN_NONE;
- } else {
- PyErr_SetString(PyExc_IndexError, "Index must be string");
- Py_RETURN_NONE;
- }
-
-
- switch(self->typeinfo->inputs[_idx].type) {
- case SOCK_VALUE:
- return Py_BuildValue("f", self->stack[_idx]->vec[0]);
- break;
- case SOCK_VECTOR:
- return Py_BuildValue("(fff)", self->stack[_idx]->vec[0], self->stack[_idx]->vec[1], self->stack[_idx]->vec[2]);
- break;
- case SOCK_RGBA:
- return Py_BuildValue("(ffff)", self->stack[_idx]->vec[0], self->stack[_idx]->vec[1], self->stack[_idx]->vec[2], self->stack[_idx]->vec[3]);
- break;
- default:
- break;
- }
- Py_RETURN_NONE;
-}
-
-/* read only */
-static PyMappingMethods sockinmap_as_mapping = {
- ( inquiry ) sockinmap_len, /* mp_length */
- ( binaryfunc ) sockinmap_subscript, /* mp_subscript */
- ( objobjargproc ) 0 /* mp_ass_subscript */
-};
-
-PyTypeObject SockInMap_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender.Node.InputSockets", /* char *tp_name; */
- sizeof( BPy_SockMap ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL,/* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- NULL, /* cmpfunc tp_compare; */
- NULL, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- &sockinmap_as_mapping, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- NULL, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
- 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, /* 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, /* richcmpfunc tp_richcompare; */
-
- /*** weak reference enabler ***/
- 0, /* long tp_weaklistoffset; */
-
- /*** Added in release 2.2 ***/
- /* Iterators */
- 0, //( getiterfunc) MVertSeq_getIter, /* getiterfunc tp_iter; */
- 0, //( iternextfunc ) MVertSeq_nextIter, /* iternextfunc tp_iternext; */
-
- /*** Attribute descriptor and subclassing stuff ***/
- 0, //BPy_MVertSeq_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- NULL, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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 int sockoutmap_len ( BPy_SockMap * self) {
- int a = 0;
- if(self->typeinfo) {
- while(self->typeinfo->outputs[a].type!=-1)
- a++;
- }
- return a;
-}
-
-static int sockoutmap_has_key( BPy_SockMap *self, PyObject *key) {
- int a = 0;
- char *strkey = PyString_AsString(key);
-
- if(self->typeinfo){
- while(self->typeinfo->outputs[a].type!=-1) {
- if(BLI_strcaseeq(self->typeinfo->outputs[a].name, strkey)) {
- return a;
- }
- a++;
- }
- }
- return -1;
-}
-
-static int sockoutmap_assign_subscript(BPy_SockMap *self, PyObject *idx, PyObject *value) {
- int a, _idx;
- a = sockoutmap_len(self);
- if(PyInt_Check(idx)) {
- _idx = (int)PyInt_AsLong(idx);
- }
- else if (PyString_Check(idx)) {
- _idx = sockoutmap_has_key( self, idx);
- }
- else if (PySlice_Check(idx)) {
- PyErr_SetString(PyExc_ValueError, "slices not implemented, yet");
- return -1;
- } else {
- PyErr_SetString(PyExc_IndexError, "Index must be int or string");
- return -1;
- }
- if(_idx > -1) {
- switch(self->typeinfo->outputs[_idx].type) {
- case SOCK_VALUE:
- if(PyTuple_Size(value)==1)
- self->stack[_idx]->vec[0] = (float)PyFloat_AsDouble(PyTuple_GetItem(value, 0));
- return 0;
- break;
- case SOCK_VECTOR:
- if(PyTuple_Size(value)==3) {
- self->stack[_idx]->vec[0] = (float)PyFloat_AsDouble(PyTuple_GetItem(value, 0));
- self->stack[_idx]->vec[1] = (float)PyFloat_AsDouble(PyTuple_GetItem(value, 1));
- self->stack[_idx]->vec[2] = (float)PyFloat_AsDouble(PyTuple_GetItem(value, 2));
- }
- return 0;
- break;
- case SOCK_RGBA:
- if(PyTuple_Size(value)==4) {
- self->stack[_idx]->vec[0] = (float)PyFloat_AsDouble(PyTuple_GetItem(value, 0));
- self->stack[_idx]->vec[1] = (float)PyFloat_AsDouble(PyTuple_GetItem(value, 1));
- self->stack[_idx]->vec[2] = (float)PyFloat_AsDouble(PyTuple_GetItem(value, 2));
- self->stack[_idx]->vec[3] = (float)PyFloat_AsDouble(PyTuple_GetItem(value, 3));
- }
- return 0;
- break;
- default:
- break;
- }
- }
- return 0;
-}
-
-/* write only */
-static PyMappingMethods sockoutmap_as_mapping = {
- ( inquiry ) sockoutmap_len, /* mp_length */
- ( binaryfunc ) 0, /* mp_subscript */
- ( objobjargproc ) sockoutmap_assign_subscript /* mp_ass_subscript */
-};
-
-PyTypeObject SockOutMap_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender.Node.OutputSockets", /* char *tp_name; */
- sizeof( BPy_SockMap ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL,/* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- NULL, /* cmpfunc tp_compare; */
- NULL, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- &sockoutmap_as_mapping, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- NULL, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
- 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, /* 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, /* richcmpfunc tp_richcompare; */
-
- /*** weak reference enabler ***/
- 0, /* long tp_weaklistoffset; */
-
- /*** Added in release 2.2 ***/
- /* Iterators */
- 0, //( getiterfunc) MVertSeq_getIter, /* getiterfunc tp_iter; */
- 0, //( iternextfunc ) MVertSeq_nextIter, /* iternextfunc tp_iternext; */
-
- /*** Attribute descriptor and subclassing stuff ***/
- 0, //BPy_MVertSeq_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- NULL, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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 BPy_SockMap *Node_CreateInputMap(bNode *node, bNodeStack **stack) {
- BPy_SockMap *map= PyObject_NEW(BPy_SockMap, &SockInMap_Type);
- map->typeinfo= node->typeinfo;
- map->stack= stack;
- return map;
-}
-
-static PyObject *Node_GetInputMap(BPy_Node *self) {
- BPy_SockMap *inmap= Node_CreateInputMap(self->node, self->in);
- return (PyObject *)(inmap);
-}
-
-#define SURFACEVIEWVECTOR 0
-#define VIEWNORMAL 1
-#define SURFACENORMAL 2
-#define GLOBALTEXTURE 3
-#define TEXTURE 4
-#define PIXEL 5
-#define COLOR 6
-#define SPECULAR 7
-#define MIRROR 8
-#define AMBIENT 9
-#define AMBIENTFACTOR 10
-#define EMITFACTOR 11
-#define DISPLACE 12
-#define STRAND 13
-#define STRESS 14
-#define TANGENT 15
-#define SURFACE_D 30
-#define TEXTURE_D 31
-#define GLOBALTEXTURE_D 32
-#define REFLECTION_D 33
-#define NORMAL_D 34
-#define STICKY_D 35
-#define REFRACT_D 36
-#define STRAND_D 37
-
-static PyObject *ShadeInput_getAttribute(BPy_ShadeInput *self, void *type) {
- PyObject *obj= NULL;
- if(self->shi) {
- switch((int)type) {
- case SURFACEVIEWVECTOR:
- obj= Py_BuildValue("(fff)", self->shi->view[0], self->shi->view[1], self->shi->view[2]);
- break;
- case VIEWNORMAL:
- obj= Py_BuildValue("(fff)", self->shi->vn[0], self->shi->vn[1], self->shi->vn[2]);
- break;
- case SURFACENORMAL:
- obj= Py_BuildValue("(fff)", self->shi->facenor[0], self->shi->facenor[1], self->shi->facenor[2]);
- break;
- case GLOBALTEXTURE:
- obj= Py_BuildValue("(fff)", self->shi->gl[0], self->shi->gl[1], self->shi->gl[2]);
- break;
- case TEXTURE:
- obj= Py_BuildValue("(fff)", self->shi->lo[0], self->shi->lo[1], self->shi->lo[2]);
- break;
- case PIXEL:
- obj= Py_BuildValue("(ii)", self->shi->xs, self->shi->ys);
- break;
- case COLOR:
- obj= Py_BuildValue("(fff)", self->shi->r, self->shi->g, self->shi->b);
- break;
- case SPECULAR:
- obj= Py_BuildValue("(fff)", self->shi->specr, self->shi->specg, self->shi->specb);
- break;
- case MIRROR:
- obj= Py_BuildValue("(fff)", self->shi->mirr, self->shi->mirg, self->shi->mirb);
- break;
- case AMBIENT:
- obj= Py_BuildValue("(fff)", self->shi->ambr, self->shi->ambg, self->shi->ambb);
- break;
- case AMBIENTFACTOR:
- obj= PyFloat_FromDouble((double)(self->shi->amb));
- break;
- case EMITFACTOR:
- obj= PyFloat_FromDouble((double)(self->shi->emit));
- break;
- case DISPLACE:
- obj= Py_BuildValue("(fff)", self->shi->displace[0], self->shi->displace[1], self->shi->displace[2]);
- break;
- case STRAND:
- obj= PyFloat_FromDouble((double)(self->shi->strand));
- break;
- case STRESS:
- obj= PyFloat_FromDouble((double)(self->shi->stress));
- break;
- case TANGENT:
- obj= Py_BuildValue("(fff)", self->shi->tang[0], self->shi->tang[1], self->shi->tang[2]);
- break;
- case SURFACE_D:
- obj= Py_BuildValue("(fff)(fff)", self->shi->dxco[0], self->shi->dxco[1], self->shi->dxco[2], self->shi->dyco[0], self->shi->dyco[1], self->shi->dyco[2]);
- break;
- case TEXTURE_D:
- obj= Py_BuildValue("(fff)(fff)", self->shi->dxlo[0], self->shi->dxlo[1], self->shi->dxlo[2], self->shi->dylo[0], self->shi->dylo[1], self->shi->dylo[2]);
- break;
- case GLOBALTEXTURE_D:
- obj= Py_BuildValue("(fff)(fff)", self->shi->dxgl[0], self->shi->dxgl[1], self->shi->dxgl[2], self->shi->dygl[0], self->shi->dygl[1], self->shi->dygl[2]);
- break;
- case REFLECTION_D:
- obj= Py_BuildValue("(fff)(fff)", self->shi->dxref[0], self->shi->dxref[1], self->shi->dxref[2], self->shi->dyref[0], self->shi->dyref[1], self->shi->dyref[2]);
- break;
- case NORMAL_D:
- obj= Py_BuildValue("(fff)(fff)", self->shi->dxno[0], self->shi->dxno[1], self->shi->dxno[2], self->shi->dyno[0], self->shi->dyno[1], self->shi->dyno[2]);
- break;
- case STICKY_D:
- obj= Py_BuildValue("(fff)(fff)", self->shi->dxsticky[0], self->shi->dxsticky[1], self->shi->dxsticky[2], self->shi->dysticky[0], self->shi->dysticky[1], self->shi->dysticky[2]);
- break;
- case REFRACT_D:
- obj= Py_BuildValue("(fff)(fff)", self->shi->dxrefract[0], self->shi->dxrefract[1], self->shi->dxrefract[2], self->shi->dyrefract[0], self->shi->dyrefract[1], self->shi->dyrefract[2]);
- break;
- case STRAND_D:
- obj= Py_BuildValue("(ff)", self->shi->dxstrand, self->shi->dystrand);
- break;
- default:
- break;
- }
- }
-
- if(!obj) {
- Py_RETURN_NONE;
- }
- return obj;
-}
-
-static BPy_SockMap *Node_CreateOutputMap(bNode *node, bNodeStack **stack) {
- BPy_SockMap *map = PyObject_NEW(BPy_SockMap, &SockOutMap_Type);
- map->typeinfo= node->typeinfo;
- map->stack= stack;
- return map;
-}
-
-static PyObject *Node_GetOutputMap(BPy_Node *self) {
- BPy_SockMap *outmap= Node_CreateOutputMap(self->node, self->out);
- return (PyObject *)outmap;
-}
-
-static PyObject *Node_GetShi(BPy_Node *self) {
- BPy_ShadeInput *shi= ShadeInput_CreatePyObject(self->shi);
- return (PyObject *)shi;
-
-}
-
-static PyObject *node_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
- PyObject *self;
- assert(type!=NULL && type->tp_alloc!=NULL);
- self= type->tp_alloc(type, 1);
- return self;
-}
-
-static int node_init(BPy_Node *self, PyObject *args, PyObject *kwds)
-{
- return 0;
-}
-
-static PyGetSetDef BPy_Node_getseters[] = {
- {"ins",
- (getter)Node_GetInputMap, (setter)NULL,
- "Get the ShadeInput mapping (dictionary)",
- NULL},
- {"outs",
- (getter)Node_GetOutputMap, (setter)NULL,
- "Get the ShadeInput mapping (dictionary)",
- NULL},
- {"shi",
- (getter)Node_GetShi, (setter)NULL,
- "Get the ShadeInput (ShadeInput)",
- NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-static PyGetSetDef BPy_ShadeInput_getseters[] = {
- {"texture",
- (getter)ShadeInput_getAttribute, (setter)NULL,
- "Get the current texture coordinate (tuple)",
- (void*)TEXTURE},
- {"texture_global",
- (getter)ShadeInput_getAttribute, (setter)NULL,
- "Get the current global texture coordinate (tuple)",
- (void*)GLOBALTEXTURE},
- {"surface_normal",
- (getter)ShadeInput_getAttribute, (setter)NULL,
- "Get the current surface normal (tuple)",
- (void*)SURFACENORMAL},
- {"view_normal",
- (getter)ShadeInput_getAttribute, (setter)NULL,
- "Get the current view normal (tuple)",
- (void*)VIEWNORMAL},
- {"surface_view_vec",
- (getter)ShadeInput_getAttribute, (setter)NULL,
- "Get the vector pointing to the viewpoint from the point being shaded (tuple)",
- (void*)SURFACEVIEWVECTOR},
- {"pixel",
- (getter)ShadeInput_getAttribute, (setter)NULL,
- "Get the x,y-coordinate for the pixel rendered (tuple)",
- (void*)PIXEL},
- {"color",
- (getter)ShadeInput_getAttribute, (setter)NULL,
- "Get the color for the point being shaded (tuple)",
- (void*)COLOR},
- {"specular",
- (getter)ShadeInput_getAttribute, (setter)NULL,
- "Get the specular color for the point being shaded (tuple)",
- (void*)SPECULAR},
- {"mirror",
- (getter)ShadeInput_getAttribute, (setter)NULL,
- "Get the mirror color for the point being shaded (tuple)",
- (void*)MIRROR},
- {"ambient",
- (getter)ShadeInput_getAttribute, (setter)NULL,
- "Get the ambient color for the point being shaded (tuple)",
- (void*)AMBIENT},
- {"ambient_factor",
- (getter)ShadeInput_getAttribute, (setter)NULL,
- "Get the ambient factor for the point being shaded (float)",
- (void*)AMBIENTFACTOR},
- {"emit_factor",
- (getter)ShadeInput_getAttribute, (setter)NULL,
- "Get the emit factor for the point being shaded (float)",
- (void*)EMITFACTOR},
- {"displace",
- (getter)ShadeInput_getAttribute, (setter)NULL,
- "Get the displace vector for the point being shaded (tuple)",
- (void*)DISPLACE},
- {"strand",
- (getter)ShadeInput_getAttribute, (setter)NULL,
- "Get the strand factor(float)",
- (void*)STRAND},
- {"stress",
- (getter)ShadeInput_getAttribute, (setter)NULL,
- "Get the stress factor(float)",
- (void*)STRESS},
- {"tangent",
- (getter)ShadeInput_getAttribute, (setter)NULL,
- "Get the tangent vector (tuple)",
- (void*)TANGENT},
- {"surface_d",
- (getter)ShadeInput_getAttribute, (setter)NULL,
- "Get the surface d (tuple of tuples)",
- (void*)SURFACE_D},
- {"texture_d",
- (getter)ShadeInput_getAttribute, (setter)NULL,
- "Get the texture d (tuple of tuples)",
- (void*)TEXTURE_D},
- {"texture_global_d",
- (getter)ShadeInput_getAttribute, (setter)NULL,
- "Get the global texture d (tuple of tuples)",
- (void*)GLOBALTEXTURE_D},
- {"reflection_d",
- (getter)ShadeInput_getAttribute, (setter)NULL,
- "Get the reflection d (tuple of tuples)",
- (void*)REFLECTION_D},
- {"normal_d",
- (getter)ShadeInput_getAttribute, (setter)NULL,
- "Get the normal d (tuple of tuples)",
- (void*)NORMAL_D},
- {"sticky_d",
- (getter)ShadeInput_getAttribute, (setter)NULL,
- "Get the sticky d (tuple of tuples)",
- (void*)STICKY_D},
- {"refract_d",
- (getter)ShadeInput_getAttribute, (setter)NULL,
- "Get the refract d (tuple of tuples)",
- (void*)REFRACT_D},
- {"strand_d",
- (getter)ShadeInput_getAttribute, (setter)NULL,
- "Get the strand d (tuple)",
- (void*)REFRACT_D},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-PyTypeObject Node_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender.Node.node", /* char *tp_name; */
- sizeof( BPy_Node ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL,/* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL /*( getattrfunc ) PyObject_GenericGetAttr*/, /* getattrfunc tp_getattr; */
- NULL /*( setattrfunc ) PyObject_GenericSetAttr*/, /* setattrfunc tp_setattr; */
- ( cmpfunc ) Node_compare, /* cmpfunc tp_compare; */
- ( reprfunc ) Node_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- 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; */
- 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, /* 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 ***/
- NULL, /*BPy_Node_methods,*/ /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_Node_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* struct _typeobject *tp_base; */
- NULL, /* PyObject *tp_dict; */
- NULL, /* descrgetfunc tp_descr_get; */
- NULL, /* descrsetfunc tp_descr_set; */
- 0, /* long tp_dictoffset; */
- (initproc)node_init, /* initproc tp_init; */
- /*PyType_GenericAlloc*/NULL, /* allocfunc tp_alloc; */
- node_new, /* 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
-};
-
-PyTypeObject ShadeInput_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender.Node.ShadeInput", /* char *tp_name; */
- sizeof( BPy_ShadeInput ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL,/* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- ( cmpfunc ) ShadeInput_compare, /* cmpfunc tp_compare; */
- ( reprfunc ) ShadeInput_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- 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; */
- 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, /* 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, /* 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 ***/
- NULL, /*BPy_Node_methods,*/ /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_ShadeInput_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-
-/* Initialise Node module */
-PyObject *Node_Init(void)
-{
- PyObject *submodule;
-
- if( PyType_Ready( &Node_Type ) < 0 )
- return NULL;
- if( PyType_Ready( &ShadeInput_Type ) < 0 )
- return NULL;
- if( PyType_Ready( &OutputDefMap_Type ) < 0 )
- return NULL;
- if( PyType_Ready( &InputDefMap_Type ) < 0 )
- return NULL;
- if( PyType_Ready( &SockInMap_Type ) < 0 )
- return NULL;
- if( PyType_Ready( &SockOutMap_Type ) < 0 )
- return NULL;
- submodule = Py_InitModule3( "Blender.Node", NULL, "");
-
- PyModule_AddIntConstant(submodule, "VALUE", SOCK_VALUE);
- PyModule_AddIntConstant(submodule, "RGBA", SOCK_RGBA);
- PyModule_AddIntConstant(submodule, "VECTOR", SOCK_VECTOR);
-
- Py_INCREF(&Node_Type);
- PyModule_AddObject(submodule, "node", (PyObject *)&Node_Type);
-
- return submodule;
-
-}
-
-static int Node_compare(BPy_Node *a, BPy_Node *b)
-{
- bNode *pa = a->node, *pb = b->node;
- return (pa==pb) ? 0 : -1;
-}
-
-static PyObject *Node_repr(BPy_Node *self)
-{
- return PyString_FromFormat( "[Node \"%s\"]",
- self->node ? self->node->id->name+2 : "empty node");
-}
-
-BPy_Node *Node_CreatePyObject(bNode *node)
-{
- BPy_Node *pynode;
-
- pynode = (BPy_Node *)PyObject_NEW(BPy_Node, &Node_Type);
- if(!pynode) {
- fprintf(stderr,"Couldn't create BPy_Node object\n");
- return (BPy_Node *)(EXPP_ReturnPyObjError(PyExc_MemoryError, "couldn't create BPy_Node object"));
- }
-
- pynode->node= node;
-
- return pynode;
-}
-
-void InitNode(BPy_Node *self, bNode *node) {
- self->node= node;
-}
-
-bNode *Node_FromPyObject(PyObject *pyobj)
-{
- return ((BPy_Node *)pyobj)->node;
-}
-
-void Node_SetStack(BPy_Node *self, bNodeStack **stack, int type)
-{
- if(type==NODE_INPUTSTACK) {
- self->in= stack;
- } else if(type==NODE_OUTPUTSTACK) {
- self->out= stack;
- }
-}
-
-void Node_SetShi(BPy_Node *self, ShadeInput *shi)
-{
- self->shi= shi;
-}
-
-/*********************/
-
-static int ShadeInput_compare(BPy_ShadeInput *a, BPy_ShadeInput *b)
-{
- ShadeInput *pa = a->shi, *pb = b->shi;
- return (pa==pb) ? 0 : -1;
-}
-
-static PyObject *ShadeInput_repr(BPy_ShadeInput *self)
-{
- return PyString_FromFormat( "[ShadeInput @ \"%p\"]", self);
-}
-
-BPy_ShadeInput *ShadeInput_CreatePyObject(ShadeInput *shi)
-{
- BPy_ShadeInput *pyshi;
-
- pyshi = (BPy_ShadeInput *)PyObject_NEW(BPy_ShadeInput, &ShadeInput_Type);
- if(!pyshi) {
- fprintf(stderr,"Couldn't create BPy_ShadeInput object\n");
- return (BPy_ShadeInput *)(EXPP_ReturnPyObjError(PyExc_MemoryError, "couldn't create BPy_ShadeInput object"));
- }
-
- pyshi->shi = shi;
-
- return pyshi;
-}
-#endif
-
diff --git a/source/blender/python/api2_2x/Node.h b/source/blender/python/api2_2x/Node.h
deleted file mode 100644
index 434d0aa684a..00000000000
--- a/source/blender/python/api2_2x/Node.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * $Id: Node.h 10449 2007-04-03 11:24:11Z jesterking $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2006, Blender Foundation
- * All rights reserved.
- *
- * Original code is this file
- *
- * Contributor(s): Nathan Letwory
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifdef USE_PYNODES /* note: won't work without patch */
-#ifndef __NODE_H__
-#define __NODE_H__
-
-#include <Python.h>
-#include "DNA_node_types.h"
-#include "BKE_node.h"
-
-#include "RE_shader_ext.h" /* <- ShadeInput Shaderesult TexResult */
-
-extern PyTypeObject Node_Type;
-extern PyTypeObject ShadeInput_Type;
-
-#define BPy_Node_Check(v) \
- ((v)->ob_type == &Node_Type)
-
-#define BPy_ShadeInput_Check(v) \
- ((v)->ob_type == &ShadeInput_Type)
-
-typedef struct BPy_ShadeInput {
- PyObject_HEAD
- ShadeInput *shi;
-} BPy_ShadeInput;
-
-typedef struct {
- PyObject_VAR_HEAD
- bNodeType *typeinfo;
- bNodeStack **stack;
-} BPy_SockMap;
-
-typedef struct {
- PyObject_HEAD
- bNode *node;
-} BPy_DefinitionMap;
-
-typedef struct BPy_Node {
- PyObject_HEAD
- bNode *node;
- bNodeStack **in;
- bNodeStack **out;
- ShadeInput *shi;
-} BPy_Node;
-
-extern PyObject *Node_Init(void);
-extern void InitNode(BPy_Node *self, bNode *node);
-extern BPy_Node *Node_CreatePyObject(bNode *node);
-extern BPy_DefinitionMap *Node_CreateOutputDefMap(bNode *node);
-extern BPy_DefinitionMap *Node_CreateInputDefMap(bNode *node);
-extern void Node_SetStack(BPy_Node *self, bNodeStack **stack, int type);
-extern void Node_SetShi(BPy_Node *self, ShadeInput *shi);
-extern BPy_ShadeInput *ShadeInput_CreatePyObject(ShadeInput *shi);
-extern void Node_dealloc(BPy_Node *self);
-extern void ShadeInput_dealloc(BPy_ShadeInput *self);
-
-#define NODE_INPUTSTACK 0
-#define NODE_OUTPUTSTACK 1
-
-#endif /* __NODE_H__*/
-#endif /* USE_PYNODES */
diff --git a/source/blender/python/api2_2x/Noise.c b/source/blender/python/api2_2x/Noise.c
deleted file mode 100644
index dcee6f45d2a..00000000000
--- a/source/blender/python/api2_2x/Noise.c
+++ /dev/null
@@ -1,713 +0,0 @@
-/**
- * $Id: Noise.c 12056 2007-09-17 06:11:06Z aligorith $
- *
- * Blender.Noise BPython module implementation.
- * This submodule has functions to generate noise of various types.
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): eeshlo
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-/************************/
-/* Blender Noise Module */
-/************************/
-
-#include <Python.h>
-
-#include "BLI_blenlib.h"
-#include "DNA_texture_types.h"
-#include "constant.h"
-
-/*-----------------------------------------*/
-/* 'mersenne twister' random number generator */
-
-/*
- A C-program for MT19937, with initialization improved 2002/2/10.
- Coded by Takuji Nishimura and Makoto Matsumoto.
- This is a faster version by taking Shawn Cokus's optimization,
- Matthe Bellew's simplification, Isaku Wada's real version.
-
- Before using, initialize the state by using init_genrand(seed)
- or init_by_array(init_key, key_length).
-
- Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- 3. The names of its contributors may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
- Any feedback is very welcome.
- http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
- email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)
-*/
-
-/* Period parameters */
-#define N 624
-#define M 397
-#define MATRIX_A 0x9908b0dfUL /* constant vector a */
-#define UMASK 0x80000000UL /* most significant w-r bits */
-#define LMASK 0x7fffffffUL /* least significant r bits */
-#define MIXBITS(u,v) ( ((u) & UMASK) | ((v) & LMASK) )
-#define TWIST(u,v) ((MIXBITS(u,v) >> 1) ^ ((v)&1UL ? MATRIX_A : 0UL))
-
-static unsigned long state[N]; /* the array for the state vector */
-static int left = 1;
-static int initf = 0;
-static unsigned long *next;
-
-PyObject *Noise_Init(void);
-
-/* initializes state[N] with a seed */
-static void init_genrand( unsigned long s )
-{
- int j;
- state[0] = s & 0xffffffffUL;
- for( j = 1; j < N; j++ ) {
- state[j] =
- ( 1812433253UL *
- ( state[j - 1] ^ ( state[j - 1] >> 30 ) ) + j );
- /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */
- /* In the previous versions, MSBs of the seed affect */
- /* only MSBs of the array state[]. */
- /* 2002/01/09 modified by Makoto Matsumoto */
- state[j] &= 0xffffffffUL; /* for >32 bit machines */
- }
- left = 1;
- initf = 1;
-}
-
-static void next_state( void )
-{
- unsigned long *p = state;
- int j;
-
- /* if init_genrand() has not been called, */
- /* a default initial seed is used */
- if( initf == 0 )
- init_genrand( 5489UL );
-
- left = N;
- next = state;
-
- for( j = N - M + 1; --j; p++ )
- *p = p[M] ^ TWIST( p[0], p[1] );
-
- for( j = M; --j; p++ )
- *p = p[M - N] ^ TWIST( p[0], p[1] );
-
- *p = p[M - N] ^ TWIST( p[0], state[0] );
-}
-
-/*------------------------------------------------------------*/
-
-static void setRndSeed( int seed )
-{
- if( seed == 0 )
- init_genrand( time( NULL ) );
- else
- init_genrand( seed );
-}
-
-/* float number in range [0, 1) using the mersenne twister rng */
-static float frand( )
-{
- unsigned long y;
-
- if( --left == 0 )
- next_state( );
- y = *next++;
-
- /* Tempering */
- y ^= ( y >> 11 );
- y ^= ( y << 7 ) & 0x9d2c5680UL;
- y ^= ( y << 15 ) & 0xefc60000UL;
- y ^= ( y >> 18 );
-
- return ( float ) y / 4294967296.f;
-}
-
-/*------------------------------------------------------------*/
-
-/* returns random unit vector */
-static void randuvec( float v[3] )
-{
- float r;
- v[2] = 2.f * frand( ) - 1.f;
- if( ( r = 1.f - v[2] * v[2] ) > 0.f ) {
- float a = (float)(6.283185307f * frand( ));
- r = (float)sqrt( r );
- v[0] = (float)(r * cos( a ));
- v[1] = (float)(r * sin( a ));
- } else
- v[2] = 1.f;
-}
-
-static PyObject *Noise_random( PyObject * self )
-{
- return Py_BuildValue( "f", frand( ) );
-}
-
-static PyObject *Noise_randuvec( PyObject * self )
-{
- float v[3] = {0.0f, 0.0f, 0.0f};
- randuvec( v );
- return Py_BuildValue( "[fff]", v[0], v[1], v[2] );
-}
-
-/*---------------------------------------------------------------------*/
-
-/* Random seed init. Only used for MT random() & randuvec() */
-
-static PyObject *Noise_setRandomSeed( PyObject * self, PyObject * args )
-{
- int s;
- if( !PyArg_ParseTuple( args, "i", &s ) )
- return NULL;
- setRndSeed( s );
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-/*-------------------------------------------------------------------------*/
-
-/* General noise */
-
-static PyObject *Noise_noise( PyObject * self, PyObject * args )
-{
- float x, y, z;
- int nb = 1;
- if( !PyArg_ParseTuple( args, "(fff)|i", &x, &y, &z, &nb ) )
- return NULL;
-
- return PyFloat_FromDouble(
- (double)(2.0 * BLI_gNoise( 1.0, x, y, z, 0, nb ) - 1.0) );
-}
-
-/*-------------------------------------------------------------------------*/
-
-/* General Vector noise */
-
-static void vNoise( float x, float y, float z, int nb, float v[3] )
-{
- /* Simply evaluate noise at 3 different positions */
- v[0] = (float)(2.0 * BLI_gNoise( 1.f, x + 9.321f, y - 1.531f, z - 7.951f, 0,
- nb ) - 1.0);
- v[1] = (float)(2.0 * BLI_gNoise( 1.f, x, y, z, 0, nb ) - 1.0);
- v[2] = (float)(2.0 * BLI_gNoise( 1.f, x + 6.327f, y + 0.1671f, z - 2.672f, 0,
- nb ) - 1.0);
-}
-
-static PyObject *Noise_vNoise( PyObject * self, PyObject * args )
-{
- float x, y, z, v[3];
- int nb = 1;
- if( !PyArg_ParseTuple( args, "(fff)|i", &x, &y, &z, &nb ) )
- return NULL;
- vNoise( x, y, z, nb, v );
- return Py_BuildValue( "[fff]", v[0], v[1], v[2] );
-}
-
-/*---------------------------------------------------------------------------*/
-
-/* General turbulence */
-
-static float turb( float x, float y, float z, int oct, int hard, int nb,
- float ampscale, float freqscale )
-{
- float amp, out, t;
- int i;
- amp = 1.f;
- out = (float)(2.0 * BLI_gNoise( 1.f, x, y, z, 0, nb ) - 1.0);
- if( hard )
- out = (float)fabs( out );
- for( i = 1; i < oct; i++ ) {
- amp *= ampscale;
- x *= freqscale;
- y *= freqscale;
- z *= freqscale;
- t = (float)(amp * ( 2.0 * BLI_gNoise( 1.f, x, y, z, 0, nb ) - 1.0 ));
- if( hard )
- t = (float)fabs( t );
- out += t;
- }
- return out;
-}
-
-static PyObject *Noise_turbulence( PyObject * self, PyObject * args )
-{
- float x, y, z;
- int oct, hd, nb = 1;
- float as = 0.5, fs = 2.0;
- if( !PyArg_ParseTuple
- ( args, "(fff)ii|iff", &x, &y, &z, &oct, &hd, &nb, &as, &fs ) )
- return NULL;
- return PyFloat_FromDouble( (double)turb( x, y, z, oct, hd, nb, as, fs ) );
-}
-
-/*--------------------------------------------------------------------------*/
-
-/* Turbulence Vector */
-
-static void vTurb( float x, float y, float z, int oct, int hard, int nb,
- float ampscale, float freqscale, float v[3] )
-{
- float amp, t[3];
- int i;
- amp = 1.f;
- vNoise( x, y, z, nb, v );
- if( hard ) {
- v[0] = (float)fabs( v[0] );
- v[1] = (float)fabs( v[1] );
- v[2] = (float)fabs( v[2] );
- }
- for( i = 1; i < oct; i++ ) {
- amp *= ampscale;
- x *= freqscale;
- y *= freqscale;
- z *= freqscale;
- vNoise( x, y, z, nb, t );
- if( hard ) {
- t[0] = (float)fabs( t[0] );
- t[1] = (float)fabs( t[1] );
- t[2] = (float)fabs( t[2] );
- }
- v[0] += amp * t[0];
- v[1] += amp * t[1];
- v[2] += amp * t[2];
- }
-}
-
-static PyObject *Noise_vTurbulence( PyObject * self, PyObject * args )
-{
- float x, y, z, v[3];
- int oct, hd, nb = 1;
- float as = 0.5, fs = 2.0;
- if( !PyArg_ParseTuple
- ( args, "(fff)ii|iff", &x, &y, &z, &oct, &hd, &nb, &as, &fs ) )
- return NULL;
- vTurb( x, y, z, oct, hd, nb, as, fs, v );
- return Py_BuildValue( "[fff]", v[0], v[1], v[2] );
-}
-
-/*---------------------------------------------------------------------*/
-
-/* F. Kenton Musgrave's fractal functions */
-
-static PyObject *Noise_fBm( PyObject * self, PyObject * args )
-{
- float x, y, z, H, lac, oct;
- int nb = 1;
- if( !PyArg_ParseTuple
- ( args, "(fff)fff|i", &x, &y, &z, &H, &lac, &oct, &nb ) )
- return NULL;
- return PyFloat_FromDouble( (double)mg_fBm( x, y, z, H, lac, oct, nb ) );
-}
-
-/*------------------------------------------------------------------------*/
-
-static PyObject *Noise_multiFractal( PyObject * self, PyObject * args )
-{
- float x, y, z, H, lac, oct;
- int nb = 1;
- if( !PyArg_ParseTuple
- ( args, "(fff)fff|i", &x, &y, &z, &H, &lac, &oct, &nb ) )
- return NULL;
- return PyFloat_FromDouble( (double)mg_MultiFractal( x, y, z, H, lac, oct, nb ) );
-}
-
-/*------------------------------------------------------------------------*/
-
-static PyObject *Noise_vlNoise( PyObject * self, PyObject * args )
-{
- float x, y, z, d;
- int nt1 = 1, nt2 = 1;
- if( !PyArg_ParseTuple
- ( args, "(fff)f|ii", &x, &y, &z, &d, &nt1, &nt2 ) )
- return NULL;
- return PyFloat_FromDouble( (double)mg_VLNoise( x, y, z, d, nt1, nt2 ) );
-}
-
-/*-------------------------------------------------------------------------*/
-
-static PyObject *Noise_heteroTerrain( PyObject * self, PyObject * args )
-{
- float x, y, z, H, lac, oct, ofs;
- int nb = 1;
- if( !PyArg_ParseTuple
- ( args, "(fff)ffff|i", &x, &y, &z, &H, &lac, &oct, &ofs, &nb ) )
- return NULL;
-
- return PyFloat_FromDouble(
- (double)mg_HeteroTerrain( x, y, z, H, lac, oct, ofs, nb ) );
-}
-
-/*-------------------------------------------------------------------------*/
-
-static PyObject *Noise_hybridMFractal( PyObject * self, PyObject * args )
-{
- float x, y, z, H, lac, oct, ofs, gn;
- int nb = 1;
- if( !PyArg_ParseTuple
- ( args, "(fff)fffff|i", &x, &y, &z, &H, &lac, &oct, &ofs, &gn,
- &nb ) )
- return NULL;
-
- return PyFloat_FromDouble(
- (double)mg_HybridMultiFractal( x, y, z, H, lac, oct, ofs, gn, nb) );
-}
-
-/*------------------------------------------------------------------------*/
-
-static PyObject *Noise_ridgedMFractal( PyObject * self, PyObject * args )
-{
- float x, y, z, H, lac, oct, ofs, gn;
- int nb = 1;
- if( !PyArg_ParseTuple
- ( args, "(fff)fffff|i", &x, &y, &z, &H, &lac, &oct, &ofs, &gn,
- &nb ) )
- return NULL;
- return PyFloat_FromDouble(
- (double)mg_RidgedMultiFractal( x, y, z, H, lac, oct, ofs, gn, nb) );
-}
-
-/*-------------------------------------------------------------------------*/
-
-static PyObject *Noise_voronoi( PyObject * self, PyObject * args )
-{
- float x, y, z, da[4], pa[12];
- int dtype = 0;
- float me = 2.5; /* default minkovsky exponent */
- if( !PyArg_ParseTuple( args, "(fff)|if", &x, &y, &z, &dtype, &me ) )
- return NULL;
- voronoi( x, y, z, da, pa, me, dtype );
- return Py_BuildValue( "[[ffff][[fff][fff][fff][fff]]]",
- da[0], da[1], da[2], da[3],
- pa[0], pa[1], pa[2],
- pa[3], pa[4], pa[5],
- pa[6], pa[7], pa[8], pa[9], pa[10], pa[11] );
-}
-
-/*-------------------------------------------------------------------------*/
-
-static PyObject *Noise_cellNoise( PyObject * self, PyObject * args )
-{
- float x, y, z;
- if( !PyArg_ParseTuple( args, "(fff)", &x, &y, &z ) )
- return NULL;
- return Py_BuildValue( "f", cellNoise( x, y, z ) );
-}
-
-/*--------------------------------------------------------------------------*/
-
-static PyObject *Noise_cellNoiseV( PyObject * self, PyObject * args )
-{
- float x, y, z, ca[3];
- if( !PyArg_ParseTuple( args, "(fff)", &x, &y, &z ) )
- return NULL;
- cellNoiseV( x, y, z, ca );
- return Py_BuildValue( "[fff]", ca[0], ca[1], ca[2] );
-}
-
-/*--------------------------------------------------------------------------*/
-/* For all other Blender modules, this stuff seems to be put in a header file.
- This doesn't seem really appropriate to me, so I just put it here, feel free to change it.
- In the original module I actually kept the docs stings with the functions themselves,
- but I grouped them here so that it can easily be moved to a header if anyone thinks that is necessary. */
-
-static char random__doc__[] = "() No arguments.\n\n\
-Returns a random floating point number in the range [0, 1)";
-
-static char randuvec__doc__[] =
- "() No arguments.\n\nReturns a random unit vector (3-float list).";
-
-static char setRandomSeed__doc__[] = "(seed value)\n\n\
-Initializes random number generator.\n\
-if seed is zero, the current time will be used instead.";
-
-static char noise__doc__[] = "((x,y,z) tuple, [noisetype])\n\n\
-Returns general noise of the optional specified type.\n\
-Optional argument noisetype determines the type of noise, STDPERLIN by default, see NoiseTypes.";
-
-static char vNoise__doc__[] = "((x,y,z) tuple, [noisetype])\n\n\
-Returns noise vector (3-float list) of the optional specified type.\
-Optional argument noisetype determines the type of noise, STDPERLIN by default, see NoiseTypes.";
-
-static char turbulence__doc__[] =
- "((x,y,z) tuple, octaves, hard, [noisebasis], [ampscale], [freqscale])\n\n\
-Returns general turbulence value using the optional specified noisebasis function.\n\
-octaves (integer) is the number of noise values added.\n\
-hard (bool), when false (0) returns 'soft' noise, when true (1) returns 'hard' noise (returned value always positive).\n\
-Optional arguments:\n\
-noisebasis determines the type of noise used for the turbulence, STDPERLIN by default, see NoiseTypes.\n\
-ampscale sets the amplitude scale value of the noise frequencies added, 0.5 by default.\n\
-freqscale sets the frequency scale factor, 2.0 by default.";
-
-static char vTurbulence__doc__[] =
- "((x,y,z) tuple, octaves, hard, [noisebasis], [ampscale], [freqscale])\n\n\
-Returns general turbulence vector (3-float list) using the optional specified noisebasis function.\n\
-octaves (integer) is the number of noise values added.\n\
-hard (bool), when false (0) returns 'soft' noise, when true (1) returns 'hard' noise (returned vector always positive).\n\
-Optional arguments:\n\
-noisebasis determines the type of noise used for the turbulence, STDPERLIN by default, see NoiseTypes.\n\
-ampscale sets the amplitude scale value of the noise frequencies added, 0.5 by default.\n\
-freqscale sets the frequency scale factor, 2.0 by default.";
-
-static char fBm__doc__[] =
- "((x,y,z) tuple, H, lacunarity, octaves, [noisebasis])\n\n\
-Returns Fractal Brownian Motion noise value(fBm).\n\
-H is the fractal increment parameter.\n\
-lacunarity is the gap between successive frequencies.\n\
-octaves is the number of frequencies in the fBm.\n\
-Optional argument noisebasis determines the type of noise used for the turbulence, STDPERLIN by default, see NoiseTypes.";
-
-static char multiFractal__doc__[] =
- "((x,y,z) tuple, H, lacunarity, octaves, [noisebasis])\n\n\
-Returns Multifractal noise value.\n\
-H determines the highest fractal dimension.\n\
-lacunarity is gap between successive frequencies.\n\
-octaves is the number of frequencies in the fBm.\n\
-Optional argument noisebasis determines the type of noise used for the turbulence, STDPERLIN by default, see NoiseTypes.";
-
-static char vlNoise__doc__[] =
- "((x,y,z) tuple, distortion, [noisetype1], [noisetype2])\n\n\
-Returns Variable Lacunarity Noise value, a distorted variety of noise.\n\
-distortion sets the amount of distortion.\n\
-Optional arguments noisetype1 and noisetype2 set the noisetype to distort and the noisetype used for the distortion respectively.\n\
-See NoiseTypes, both are STDPERLIN by default.";
-
-static char heteroTerrain__doc__[] =
- "((x,y,z) tuple, H, lacunarity, octaves, offset, [noisebasis])\n\n\
-returns Heterogeneous Terrain value\n\
-H determines the fractal dimension of the roughest areas.\n\
-lacunarity is the gap between successive frequencies.\n\
-octaves is the number of frequencies in the fBm.\n\
-offset raises the terrain from 'sea level'.\n\
-Optional argument noisebasis determines the type of noise used for the turbulence, STDPERLIN by default, see NoiseTypes.";
-
-static char hybridMFractal__doc__[] =
- "((x,y,z) tuple, H, lacunarity, octaves, offset, gain, [noisebasis])\n\n\
-returns Hybrid Multifractal value.\n\
-H determines the fractal dimension of the roughest areas.\n\
-lacunarity is the gap between successive frequencies.\n\
-octaves is the number of frequencies in the fBm.\n\
-offset raises the terrain from 'sea level'.\n\
-gain scales the values.\n\
-Optional argument noisebasis determines the type of noise used for the turbulence, STDPERLIN by default, see NoiseTypes.";
-
-static char ridgedMFractal__doc__[] =
- "((x,y,z) tuple, H, lacunarity, octaves, offset, gain [noisebasis])\n\n\
-returns Ridged Multifractal value.\n\
-H determines the fractal dimension of the roughest areas.\n\
-lacunarity is the gap between successive frequencies.\n\
-octaves is the number of frequencies in the fBm.\n\
-offset raises the terrain from 'sea level'.\n\
-gain scales the values.\n\
-Optional argument noisebasis determines the type of noise used for the turbulence, STDPERLIN by default, see NoiseTypes.";
-
-static char voronoi__doc__[] =
- "((x,y,z) tuple, distance_metric, [exponent])\n\n\
-returns a list, containing a list of distances in order of closest feature,\n\
-and a list containing the positions of the four closest features\n\
-Optional arguments:\n\
-distance_metric: see DistanceMetrics, default is DISTANCE\n\
-exponent is only used with MINKOVSKY, default is 2.5.";
-
-static char cellNoise__doc__[] = "((x,y,z) tuple)\n\n\
-returns cellnoise float value.";
-
-static char cellNoiseV__doc__[] = "((x,y,z) tuple)\n\n\
-returns cellnoise vector/point/color (3-float list).";
-
-static char Noise__doc__[] = "Blender Noise and Turbulence Module\n\n\
-This module can be used to generate noise of various types.\n\
-This can be used for terrain generation, to create textures,\n\
-make animations more 'animated', object deformation, etc.\n\
-As an example, this code segment when scriptlinked to a framechanged event,\n\
-will make the camera sway randomly about, by changing parameters this can\n\
-look like anything from an earthquake to a very nervous or maybe even drunk cameraman...\n\
-(the camera needs an ipo with at least one Loc & Rot key for this to work!):\n\
-\n\
-\tfrom Blender import Get, Scene, Noise\n\
-\n\
-\t####################################################\n\
-\t# This controls jitter speed\n\
-\tsl = 0.025\n\
-\t# This controls the amount of position jitter\n\
-\tsp = 0.1\n\
-\t# This controls the amount of rotation jitter\n\
-\tsr = 0.25\n\
-\t####################################################\n\
-\n\
-\ttime = Get('curtime')\n\
-\tob = Scene.GetCurrent().getCurrentCamera()\n\
-\tps = (sl*time, sl*time, sl*time)\n\
-\t# To add jitter only when the camera moves, use this next line instead\n\
-\t#ps = (sl*ob.LocX, sl*ob.LocY, sl*ob.LocZ)\n\
-\trv = Noise.vTurbulence(ps, 3, 0, Noise.NoiseTypes.NEWPERLIN)\n\
-\tob.dloc = (sp*rv[0], sp*rv[1], sp*rv[2])\n\
-\tob.drot = (sr*rv[0], sr*rv[1], sr*rv[2])\n\
-\n";
-
-/* Just in case, declarations for a header file */
-/*
-static PyObject *Noise_random(PyObject *self);
-static PyObject *Noise_randuvec(PyObject *self);
-static PyObject *Noise_setRandomSeed(PyObject *self, PyObject *args);
-static PyObject *Noise_noise(PyObject *self, PyObject *args);
-static PyObject *Noise_vNoise(PyObject *self, PyObject *args);
-static PyObject *Noise_turbulence(PyObject *self, PyObject *args);
-static PyObject *Noise_vTurbulence(PyObject *self, PyObject *args);
-static PyObject *Noise_fBm(PyObject *self, PyObject *args);
-static PyObject *Noise_multiFractal(PyObject *self, PyObject *args);
-static PyObject *Noise_vlNoise(PyObject *self, PyObject *args);
-static PyObject *Noise_heteroTerrain(PyObject *self, PyObject *args);
-static PyObject *Noise_hybridMFractal(PyObject *self, PyObject *args);
-static PyObject *Noise_ridgedMFractal(PyObject *self, PyObject *args);
-static PyObject *Noise_voronoi(PyObject *self, PyObject *args);
-static PyObject *Noise_cellNoise(PyObject *self, PyObject *args);
-static PyObject *Noise_cellNoiseV(PyObject *self, PyObject *args);
-*/
-
-static PyMethodDef NoiseMethods[] = {
- {"setRandomSeed", ( PyCFunction ) Noise_setRandomSeed, METH_VARARGS,
- setRandomSeed__doc__},
- {"random", ( PyCFunction ) Noise_random, METH_NOARGS, random__doc__},
- {"randuvec", ( PyCFunction ) Noise_randuvec, METH_NOARGS,
- randuvec__doc__},
- {"noise", ( PyCFunction ) Noise_noise, METH_VARARGS, noise__doc__},
- {"vNoise", ( PyCFunction ) Noise_vNoise, METH_VARARGS, vNoise__doc__},
- {"turbulence", ( PyCFunction ) Noise_turbulence, METH_VARARGS,
- turbulence__doc__},
- {"vTurbulence", ( PyCFunction ) Noise_vTurbulence, METH_VARARGS,
- vTurbulence__doc__},
- {"fBm", ( PyCFunction ) Noise_fBm, METH_VARARGS, fBm__doc__},
- {"multiFractal", ( PyCFunction ) Noise_multiFractal, METH_VARARGS,
- multiFractal__doc__},
- {"vlNoise", ( PyCFunction ) Noise_vlNoise, METH_VARARGS,
- vlNoise__doc__},
- {"heteroTerrain", ( PyCFunction ) Noise_heteroTerrain, METH_VARARGS,
- heteroTerrain__doc__},
- {"hybridMFractal", ( PyCFunction ) Noise_hybridMFractal, METH_VARARGS,
- hybridMFractal__doc__},
- {"ridgedMFractal", ( PyCFunction ) Noise_ridgedMFractal, METH_VARARGS,
- ridgedMFractal__doc__},
- {"voronoi", ( PyCFunction ) Noise_voronoi, METH_VARARGS,
- voronoi__doc__},
- {"cellNoise", ( PyCFunction ) Noise_cellNoise, METH_VARARGS,
- cellNoise__doc__},
- {"cellNoiseV", ( PyCFunction ) Noise_cellNoiseV, METH_VARARGS,
- cellNoiseV__doc__},
- {NULL, NULL, 0, NULL}
-};
-
-/*----------------------------------------------------------------------*/
-
-PyObject *Noise_Init(void)
-{
- PyObject *NoiseTypes, *DistanceMetrics,
- *md =
- Py_InitModule3( "Blender.Noise", NoiseMethods, Noise__doc__ );
-
- /* use current time as seed for random number generator by default */
- setRndSeed( 0 );
-
- /* Constant noisetype dictionary */
- NoiseTypes = PyConstant_New( );
- if( NoiseTypes ) {
- BPy_constant *nt = ( BPy_constant * ) NoiseTypes;
- PyConstant_Insert( nt, "BLENDER",
- PyInt_FromLong( TEX_BLENDER ) );
- PyConstant_Insert( nt, "STDPERLIN",
- PyInt_FromLong( TEX_STDPERLIN ) );
- PyConstant_Insert( nt, "NEWPERLIN",
- PyInt_FromLong( TEX_NEWPERLIN ) );
- PyConstant_Insert( nt, "VORONOI_F1",
- PyInt_FromLong( TEX_VORONOI_F1 ) );
- PyConstant_Insert( nt, "VORONOI_F2",
- PyInt_FromLong( TEX_VORONOI_F2 ) );
- PyConstant_Insert( nt, "VORONOI_F3",
- PyInt_FromLong( TEX_VORONOI_F3 ) );
- PyConstant_Insert( nt, "VORONOI_F4",
- PyInt_FromLong( TEX_VORONOI_F4 ) );
- PyConstant_Insert( nt, "VORONOI_F2F1",
- PyInt_FromLong( TEX_VORONOI_F2F1 ) );
- PyConstant_Insert( nt, "VORONOI_CRACKLE",
- PyInt_FromLong( TEX_VORONOI_CRACKLE ) );
- PyConstant_Insert( nt, "CELLNOISE",
- PyInt_FromLong( TEX_CELLNOISE ) );
- PyModule_AddObject( md, "NoiseTypes", NoiseTypes );
- }
-
- /* Constant distance metric dictionary for voronoi */
- DistanceMetrics = PyConstant_New( );
- if( DistanceMetrics ) {
- BPy_constant *dm = ( BPy_constant * ) DistanceMetrics;
- PyConstant_Insert( dm, "DISTANCE",
- PyInt_FromLong( TEX_DISTANCE ) );
- PyConstant_Insert( dm, "DISTANCE_SQUARED",
- PyInt_FromLong( TEX_DISTANCE_SQUARED ) );
- PyConstant_Insert( dm, "MANHATTAN",
- PyInt_FromLong( TEX_MANHATTAN ) );
- PyConstant_Insert( dm, "CHEBYCHEV",
- PyInt_FromLong( TEX_CHEBYCHEV ) );
- PyConstant_Insert( dm, "MINKOVSKY_HALF",
- PyInt_FromLong( TEX_MINKOVSKY_HALF ) );
- PyConstant_Insert( dm, "MINKOVSKY_FOUR",
- PyInt_FromLong( TEX_MINKOVSKY_FOUR ) );
- PyConstant_Insert( dm, "MINKOVSKY",
- PyInt_FromLong( TEX_MINKOVSKY ) );
- PyModule_AddObject( md, "DistanceMetrics", DistanceMetrics );
- }
-
- return md;
-}
diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c
deleted file mode 100644
index 83c8ed7df3d..00000000000
--- a/source/blender/python/api2_2x/Object.c
+++ /dev/null
@@ -1,5964 +0,0 @@
-/*
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- *
- * The Object module provides generic access to Objects of various types via
- * the Python interface.
- *
- *
- * Contributor(s): Michel Selten, Willian Germano, Jacques Guignot,
- * Joseph Gilbert, Stephen Swaney, Bala Gi, Campbell Barton, Johnny Matthews,
- * Ken Hughes, Alex Mole, Jean-Michel Soler
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-struct SpaceIpo;
-struct rctf;
-
-#include "Object.h" /*This must come first */
-
-#include "DNA_object_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_object_force.h"
-#include "DNA_userdef_types.h"
-#include "DNA_key_types.h" /* for pinShape and activeShape */
-
-#include "BKE_action.h"
-#include "BKE_anim.h" /* used for dupli-objects */
-#include "BKE_depsgraph.h"
-#include "BKE_effect.h"
-#include "BKE_font.h"
-#include "BKE_property.h"
-#include "BKE_mball.h"
-#include "BKE_softbody.h"
-#include "BKE_utildefines.h"
-#include "BKE_armature.h"
-#include "BKE_lattice.h"
-#include "BKE_mesh.h"
-#include "BKE_library.h"
-#include "BKE_object.h"
-#include "BKE_curve.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_scene.h"
-#include "BKE_nla.h"
-#include "BKE_material.h"
-#include "BKE_modifier.h"
-#include "BKE_idprop.h"
-#include "BKE_object.h"
-#include "BKE_key.h" /* for setting the activeShape */
-#include "BKE_displist.h"
-
-#include "BSE_editipo.h"
-#include "BSE_edit.h"
-
-#include "BIF_space.h"
-#include "BIF_editview.h"
-#include "BIF_drawscene.h"
-#include "BIF_meshtools.h"
-#include "BIF_editarmature.h"
-#include "BIF_editaction.h"
-#include "BIF_editnla.h"
-
-#include "BLI_arithb.h"
-#include "BLI_blenlib.h"
-
-#include "BDR_editobject.h"
-#include "BDR_editcurve.h"
-#include "BDR_drawobject.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "mydevice.h"
-#include "blendef.h"
-#include "Scene.h"
-#include "Mathutils.h"
-#include "Mesh.h"
-#include "NMesh.h"
-#include "Curve.h"
-#include "Ipo.h"
-#include "Armature.h"
-#include "Pose.h"
-#include "Camera.h"
-#include "Lamp.h"
-#include "Lattice.h"
-#include "Text.h"
-#include "Text3d.h"
-#include "Metaball.h"
-#include "Draw.h"
-#include "NLA.h"
-#include "logic.h"
-#include "Effect.h"
-#include "Group.h"
-#include "Modifier.h"
-#include "Constraint.h"
-#include "gen_utils.h"
-#include "gen_library.h"
-#include "EXPP_interface.h"
-#include "BIF_editkey.h"
-#include "IDProp.h"
-
-/* Defines for insertIpoKey */
-
-#define IPOKEY_LOC 0
-#define IPOKEY_ROT 1
-#define IPOKEY_SIZE 2
-#define IPOKEY_LOCROT 3
-#define IPOKEY_LOCROTSIZE 4
-#define IPOKEY_PI_STRENGTH 5
-#define IPOKEY_PI_FALLOFF 6
-#define IPOKEY_PI_MAXDIST 7 /*Not Ready Yet*/
-#define IPOKEY_PI_SURFACEDAMP 8
-#define IPOKEY_PI_RANDOMDAMP 9
-#define IPOKEY_PI_PERM 10
-#define IPOKEY_LAYER 19
-
-#define PFIELD_FORCE 1
-#define PFIELD_VORTEX 2
-#define PFIELD_MAGNET 3
-#define PFIELD_WIND 4
-
-enum obj_consts {
- EXPP_OBJ_ATTR_LOC_X = 0,
- EXPP_OBJ_ATTR_LOC_Y,
- EXPP_OBJ_ATTR_LOC_Z,
- EXPP_OBJ_ATTR_DLOC_X,
- EXPP_OBJ_ATTR_DLOC_Y,
- EXPP_OBJ_ATTR_DLOC_Z,
- EXPP_OBJ_ATTR_ROT_X,
- EXPP_OBJ_ATTR_ROT_Y,
- EXPP_OBJ_ATTR_ROT_Z,
- EXPP_OBJ_ATTR_DROT_X,
- EXPP_OBJ_ATTR_DROT_Y,
- EXPP_OBJ_ATTR_DROT_Z,
- EXPP_OBJ_ATTR_SIZE_X,
- EXPP_OBJ_ATTR_SIZE_Y,
- EXPP_OBJ_ATTR_SIZE_Z,
- EXPP_OBJ_ATTR_DSIZE_X,
- EXPP_OBJ_ATTR_DSIZE_Y,
- EXPP_OBJ_ATTR_DSIZE_Z,
- EXPP_OBJ_ATTR_LOC,
- EXPP_OBJ_ATTR_DLOC,
- EXPP_OBJ_ATTR_DROT,
- EXPP_OBJ_ATTR_SIZE,
- EXPP_OBJ_ATTR_DSIZE,
- EXPP_OBJ_ATTR_LAYERMASK,
- EXPP_OBJ_ATTR_COLBITS,
- EXPP_OBJ_ATTR_DRAWMODE,
- EXPP_OBJ_ATTR_DRAWTYPE,
- EXPP_OBJ_ATTR_DUPON,
- EXPP_OBJ_ATTR_DUPOFF,
- EXPP_OBJ_ATTR_DUPSTA,
- EXPP_OBJ_ATTR_DUPEND,
- EXPP_OBJ_ATTR_DUPFACESCALEFAC,
- EXPP_OBJ_ATTR_TIMEOFFSET,
- EXPP_OBJ_ATTR_DRAWSIZE,
- EXPP_OBJ_ATTR_PARENT_TYPE,
- EXPP_OBJ_ATTR_PASSINDEX,
- EXPP_OBJ_ATTR_ACT_MATERIAL,
- EXPP_OBJ_ATTR_ACT_SHAPE,
-
- EXPP_OBJ_ATTR_PI_SURFACEDAMP, /* these need to stay together */
- EXPP_OBJ_ATTR_PI_RANDOMDAMP, /* and in order */
- EXPP_OBJ_ATTR_PI_PERM,
- EXPP_OBJ_ATTR_PI_STRENGTH,
- EXPP_OBJ_ATTR_PI_FALLOFF,
- EXPP_OBJ_ATTR_PI_MAXDIST,
- EXPP_OBJ_ATTR_PI_SBDAMP,
- EXPP_OBJ_ATTR_PI_SBIFACETHICK,
- EXPP_OBJ_ATTR_PI_SBOFACETHICK,
-
- EXPP_OBJ_ATTR_SB_NODEMASS, /* these need to stay together */
- EXPP_OBJ_ATTR_SB_GRAV, /* and in order */
- EXPP_OBJ_ATTR_SB_MEDIAFRICT,
- EXPP_OBJ_ATTR_SB_RKLIMIT,
- EXPP_OBJ_ATTR_SB_PHYSICSSPEED,
- EXPP_OBJ_ATTR_SB_GOALSPRING,
- EXPP_OBJ_ATTR_SB_GOALFRICT,
- EXPP_OBJ_ATTR_SB_MINGOAL,
- EXPP_OBJ_ATTR_SB_MAXGOAL,
- EXPP_OBJ_ATTR_SB_DEFGOAL,
- EXPP_OBJ_ATTR_SB_INSPRING,
- EXPP_OBJ_ATTR_SB_INFRICT,
-
-};
-
-#define EXPP_OBJECT_DRAWSIZEMIN 0.01f
-#define EXPP_OBJECT_DRAWSIZEMAX 10.0f
-
-/* clamping and range values for particle interaction settings */
-#define EXPP_OBJECT_PIDAMP_MIN 0.0f
-#define EXPP_OBJECT_PIDAMP_MAX 1.0f
-#define EXPP_OBJECT_PIRDAMP_MIN 0.0f
-#define EXPP_OBJECT_PIRDAMP_MAX 1.0f
-#define EXPP_OBJECT_PIPERM_MIN 0.0f
-#define EXPP_OBJECT_PIPERM_MAX 1.0f
-#define EXPP_OBJECT_PISTRENGTH_MIN 0.0f
-#define EXPP_OBJECT_PISTRENGTH_MAX 1000.0f
-#define EXPP_OBJECT_PIPOWER_MIN 0.0f
-#define EXPP_OBJECT_PIPOWER_MAX 10.0f
-#define EXPP_OBJECT_PIMAXDIST_MIN 0.0f
-#define EXPP_OBJECT_PIMAXDIST_MAX 1000.0f
-#define EXPP_OBJECT_PISBDAMP_MIN 0.0f
-#define EXPP_OBJECT_PISBDAMP_MAX 1.0f
-#define EXPP_OBJECT_PISBIFTMIN 0.001f
-#define EXPP_OBJECT_PISBIFTMAX 1.0f
-#define EXPP_OBJECT_PISBOFTMIN 0.001f
-#define EXPP_OBJECT_PISBOFTMAX 1.0f
-
-/* clamping and range values for softbody settings */
-#define EXPP_OBJECT_SBMASS_MIN 0.0f
-#define EXPP_OBJECT_SBMASS_MAX 50.0f
-#define EXPP_OBJECT_SBGRAVITY_MIN 0.0f
-#define EXPP_OBJECT_SBGRAVITY_MAX 10.0f
-#define EXPP_OBJECT_SBFRICTION_MIN 0.0f
-#define EXPP_OBJECT_SBFRICTION_MAX 10.0f
-#define EXPP_OBJECT_SBSPEED_MIN 0.01f
-#define EXPP_OBJECT_SBSPEED_MAX 100.0f
-#define EXPP_OBJECT_SBERRORLIMIT_MIN 0.01f
-#define EXPP_OBJECT_SBERRORLIMIT_MAX 1.0f
-#define EXPP_OBJECT_SBGOALSPRING_MIN 0.0f
-#define EXPP_OBJECT_SBGOALSPRING_MAX 0.999f
-#define EXPP_OBJECT_SBGOALFRICT_MIN 0.0f
-#define EXPP_OBJECT_SBGOALFRICT_MAX 10.0f
-#define EXPP_OBJECT_SBMINGOAL_MIN 0.0f
-#define EXPP_OBJECT_SBMINGOAL_MAX 1.0f
-#define EXPP_OBJECT_SBMAXGOAL_MIN 0.0f
-#define EXPP_OBJECT_SBMAXGOAL_MAX 1.0f
-#define EXPP_OBJECT_SBINSPRING_MIN 0.0f
-#define EXPP_OBJECT_SBINSPRING_MAX 0.999f
-#define EXPP_OBJECT_SBINFRICT_MIN 0.0f
-#define EXPP_OBJECT_SBINFRICT_MAX 10.0f
-#define EXPP_OBJECT_SBDEFGOAL_MIN 0.0f
-#define EXPP_OBJECT_SBDEFGOAL_MAX 1.0f
-#define EXPP_OBJECT_SBNODEMASSMIN 0.001f
-#define EXPP_OBJECT_SBNODEMASSMAX 50.0f
-#define EXPP_OBJECT_SBGRAVMIN 0.0f
-#define EXPP_OBJECT_SBGRAVMAX 10.0f
-#define EXPP_OBJECT_SBMEDIAFRICTMIN 0.0f
-#define EXPP_OBJECT_SBMEDIAFRICTMAX 10.0f
-#define EXPP_OBJECT_SBRKLIMITMIN 0.01f
-#define EXPP_OBJECT_SBRKLIMITMAX 1.0f
-#define EXPP_OBJECT_SBPHYSICSSPEEDMIN 0.01f
-#define EXPP_OBJECT_SBPHYSICSSPEEDMAX 100.0f
-#define EXPP_OBJECT_SBGOALSPRINGMIN 0.0f
-#define EXPP_OBJECT_SBGOALSPRINGMAX 0.999f
-#define EXPP_OBJECT_SBGOALFRICTMIN 0.0f
-#define EXPP_OBJECT_SBGOALFRICTMAX 10.0f
-#define EXPP_OBJECT_SBMINGOALMIN 0.0f
-#define EXPP_OBJECT_SBMINGOALMAX 1.0f
-#define EXPP_OBJECT_SBMAXGOALMIN 0.0f
-#define EXPP_OBJECT_SBMAXGOALMAX 1.0f
-#define EXPP_OBJECT_SBDEFGOALMIN 0.0f
-#define EXPP_OBJECT_SBDEFGOALMAX 1.0f
-#define EXPP_OBJECT_SBINSPRINGMIN 0.0f
-#define EXPP_OBJECT_SBINSPRINGMAX 0.999f
-#define EXPP_OBJECT_SBINFRICTMIN 0.0f
-#define EXPP_OBJECT_SBINFRICTMAX 10.0f
-#define EXPP_OBJECT_DUPFACESCALEFACMIN 0.001f
-#define EXPP_OBJECT_DUPFACESCALEFACMAX 10000.0f
-
-/*****************************************************************************/
-/* Python API function prototypes for the Blender module. */
-/*****************************************************************************/
-static PyObject *M_Object_New( PyObject * self, PyObject * args );
-PyObject *M_Object_Get( PyObject * self, PyObject * args );
-static PyObject *M_Object_GetSelected( PyObject * self );
-static PyObject *M_Object_Duplicate( PyObject * self, PyObject * args, PyObject *kwd);
-
-/* HELPER FUNCTION FOR PARENTING */
-static PyObject *internal_makeParent(Object *parent, PyObject *py_child, int partype, int noninverse, int fast, int v1, int v2, int v3, char *bonename);
-
-/*****************************************************************************/
-/* The following string definitions are used for documentation strings. */
-/* In Python these will be written to the console when doing a */
-/* Blender.Object.__doc__ */
-/*****************************************************************************/
-char M_Object_doc[] = "The Blender Object module\n\n\
-This module provides access to **Object Data** in Blender.\n";
-
-char M_Object_New_doc[] =
- "(type) - Add a new object of type 'type' in the current scene";
-
-char M_Object_Get_doc[] =
- "(name) - return the object with the name 'name', returns None if not\
- found.\n\
- If 'name' is not specified, it returns a list of all objects in the\n\
- current scene.";
-
-char M_Object_GetSelected_doc[] =
- "() - Returns a list of selected Objects in the active layer(s)\n\
-The active object is the first in the list, if visible";
-
-char M_Object_Duplicate_doc[] =
- "(linked) - Duplicate all selected, visible objects in the current scene";
-
-
-/*****************************************************************************/
-/* Python method structure definition for Blender.Object module: */
-/*****************************************************************************/
-struct PyMethodDef M_Object_methods[] = {
- {"New", ( PyCFunction ) M_Object_New, METH_VARARGS,
- M_Object_New_doc},
- {"Get", ( PyCFunction ) M_Object_Get, METH_VARARGS,
- M_Object_Get_doc},
- {"GetSelected", ( PyCFunction ) M_Object_GetSelected, METH_NOARGS,
- M_Object_GetSelected_doc},
- {"Duplicate", ( PyCFunction ) M_Object_Duplicate, METH_VARARGS | METH_KEYWORDS,
- M_Object_Duplicate_doc},
- {NULL, NULL, 0, NULL}
-};
-
-
-/*****************************************************************************/
-/* Python BPy_Object methods declarations: */
-/*****************************************************************************/
-static int setupSB(Object* ob); /*Make sure Softbody Pointer is initialized */
-static int setupPI(Object* ob);
-
-static PyObject *Object_buildParts( BPy_Object * self );
-static PyObject *Object_clearIpo( BPy_Object * self );
-static PyObject *Object_clrParent( BPy_Object * self, PyObject * args );
-static PyObject *Object_clearTrack( BPy_Object * self, PyObject * args );
-static PyObject *Object_getData(BPy_Object *self, PyObject *args, PyObject *kwd);
-static PyObject *Object_getDeltaLocation( BPy_Object * self );
-static PyObject *Object_getDrawMode( BPy_Object * self );
-static PyObject *Object_getDrawType( BPy_Object * self );
-static PyObject *Object_GetEuler( BPy_Object * self, PyObject * args );
-static PyObject *Object_getInverseMatrix( BPy_Object * self );
-static PyObject *Object_getIpo( BPy_Object * self );
-static PyObject *Object_getLocation( BPy_Object * self, PyObject * args );
-static PyObject *Object_getMaterials( BPy_Object * self, PyObject * args );
-static PyObject *Object_getMatrix( BPy_Object * self, PyObject * args );
-static PyObject *Object_getParent( BPy_Object * self );
-static PyObject *Object_getParentBoneName( BPy_Object * self );
-static int Object_setParentBoneName( BPy_Object * self, PyObject * value );
-static PyObject *Object_getSize( BPy_Object * self, PyObject * args );
-static PyObject *Object_getTimeOffset( BPy_Object * self );
-static PyObject *Object_getTracked( BPy_Object * self );
-static PyObject *Object_getType( BPy_Object * self );
-static PyObject *Object_getBoundBox( BPy_Object * self );
-static PyObject *Object_getAction( BPy_Object * self );
-static PyObject *Object_getPose( BPy_Object * self );
-static PyObject *Object_evaluatePose( BPy_Object * self, PyObject *args );
-static PyObject *Object_getSelected( BPy_Object * self );
-static PyObject *Object_makeDisplayList( BPy_Object * self );
-static PyObject *Object_link( BPy_Object * self, PyObject * args );
-static PyObject *Object_makeParent( BPy_Object * self, PyObject * args );
-static PyObject *Object_join( BPy_Object * self, PyObject * args );
-static PyObject *Object_makeParentDeform( BPy_Object * self, PyObject * args );
-static PyObject *Object_makeParentVertex( BPy_Object * self, PyObject * args );
-static PyObject *Object_makeParentBone( BPy_Object * self, PyObject * args );
-static PyObject *Object_materialUsage( void );
-static PyObject *Object_getDupliObjects ( BPy_Object * self);
-static PyObject *Object_getEffects( BPy_Object * self );
-static PyObject *Object_setDeltaLocation( BPy_Object * self, PyObject * args );
-static PyObject *Object_SetDrawMode( BPy_Object * self, PyObject * args );
-static PyObject *Object_SetDrawType( BPy_Object * self, PyObject * args );
-static PyObject *Object_SetEuler( BPy_Object * self, PyObject * args );
-static PyObject *Object_SetMatrix( BPy_Object * self, PyObject * args );
-static PyObject *Object_SetIpo( BPy_Object * self, PyObject * args );
-static PyObject *Object_insertIpoKey( BPy_Object * self, PyObject * args );
-static PyObject *Object_insertPoseKey( BPy_Object * self, PyObject * args );
-static PyObject *Object_insertCurrentPoseKey( BPy_Object * self, PyObject * args );
-static PyObject *Object_setConstraintInfluenceForBone( BPy_Object * self, PyObject * args );
-static PyObject *Object_setLocation( BPy_Object * self, PyObject * args );
-static PyObject *Object_setMaterials( BPy_Object * self, PyObject * args );
-static PyObject *Object_setSize( BPy_Object * self, PyObject * args );
-static PyObject *Object_setTimeOffset( BPy_Object * self, PyObject * args );
-static PyObject *Object_makeTrack( BPy_Object * self, PyObject * args );
-static PyObject *Object_shareFrom( BPy_Object * self, PyObject * args );
-static PyObject *Object_Select( BPy_Object * self, PyObject * args );
-static PyObject *Object_getAllProperties( BPy_Object * self );
-static PyObject *Object_addProperty( BPy_Object * self, PyObject * args );
-static PyObject *Object_removeProperty( BPy_Object * self, PyObject * args );
-static PyObject *Object_getProperty( BPy_Object * self, PyObject * args );
-static PyObject *Object_removeAllProperties( BPy_Object * self );
-static PyObject *Object_copyAllPropertiesTo( BPy_Object * self,
- PyObject * args );
-static PyObject *Object_getScriptLinks( BPy_Object * self, PyObject * value );
-static PyObject *Object_addScriptLink( BPy_Object * self, PyObject * args );
-static PyObject *Object_clearScriptLinks( BPy_Object * self, PyObject *args );
-static PyObject *Object_getPIStrength( BPy_Object * self );
-static PyObject *Object_setPIStrength( BPy_Object * self, PyObject * args );
-static PyObject *Object_getPIFalloff( BPy_Object * self );
-static PyObject *Object_setPIFalloff( BPy_Object * self, PyObject * args );
-static PyObject *Object_getPIMaxDist( BPy_Object * self );
-static PyObject *Object_setPIMaxDist( BPy_Object * self, PyObject * args );
-static PyObject *Object_getPIUseMaxDist( BPy_Object * self );
-static PyObject *Object_SetPIUseMaxDist( BPy_Object * self, PyObject * args );
-static PyObject *Object_getPIType( BPy_Object * self );
-static PyObject *Object_SetPIType( BPy_Object * self, PyObject * args );
-static PyObject *Object_getPIPerm( BPy_Object * self );
-static PyObject *Object_SetPIPerm( BPy_Object * self, PyObject * args );
-static PyObject *Object_getPIRandomDamp( BPy_Object * self );
-static PyObject *Object_setPIRandomDamp( BPy_Object * self, PyObject * args );
-static PyObject *Object_getPISurfaceDamp( BPy_Object * self );
-static PyObject *Object_SetPISurfaceDamp( BPy_Object * self, PyObject * args );
-static PyObject *Object_getPIDeflection( BPy_Object * self );
-static PyObject *Object_SetPIDeflection( BPy_Object * self, PyObject * args );
-
-static int Object_setRBMass( BPy_Object * self, PyObject * args );
-static int Object_setRBFlags( BPy_Object * self, PyObject * args );
-static int Object_setRBShapeBoundType( BPy_Object * self, PyObject * args );
-
-static PyObject *Object_getSBMass( BPy_Object * self );
-static PyObject *Object_setSBMass( BPy_Object * self, PyObject * args );
-static PyObject *Object_getSBGravity( BPy_Object * self );
-static PyObject *Object_setSBGravity( BPy_Object * self, PyObject * args );
-static PyObject *Object_getSBFriction( BPy_Object * self );
-static PyObject *Object_setSBFriction( BPy_Object * self, PyObject * args );
-static PyObject *Object_getSBErrorLimit( BPy_Object * self );
-static PyObject *Object_setSBErrorLimit( BPy_Object * self, PyObject * args );
-static PyObject *Object_getSBGoalSpring( BPy_Object * self );
-static PyObject *Object_setSBGoalSpring( BPy_Object * self, PyObject * args );
-static PyObject *Object_getSBGoalFriction( BPy_Object * self );
-static PyObject *Object_setSBGoalFriction( BPy_Object * self, PyObject * args );
-static PyObject *Object_getSBMinGoal( BPy_Object * self );
-static PyObject *Object_setSBMinGoal( BPy_Object * self, PyObject * args );
-static PyObject *Object_getSBMaxGoal( BPy_Object * self );
-static PyObject *Object_setSBMaxGoal( BPy_Object * self, PyObject * args );
-static PyObject *Object_getSBInnerSpring( BPy_Object * self );
-static PyObject *Object_setSBInnerSpring( BPy_Object * self, PyObject * args );
-static PyObject *Object_getSBInnerSpringFriction( BPy_Object * self );
-static PyObject *Object_setSBInnerSpringFriction( BPy_Object * self, PyObject * args );
-
-static PyObject *Object_isSB( BPy_Object * self );
-static PyObject *Object_getSBDefaultGoal( BPy_Object * self );
-static PyObject *Object_setSBDefaultGoal( BPy_Object * self, PyObject * args );
-static PyObject *Object_getSBUseGoal( BPy_Object * self );
-static PyObject *Object_SetSBUseGoal( BPy_Object * self, PyObject * args );
-static PyObject *Object_getSBUseEdges( BPy_Object * self );
-static PyObject *Object_SetSBUseEdges( BPy_Object * self, PyObject * args );
-static PyObject *Object_getSBStiffQuads( BPy_Object * self );
-static PyObject *Object_SetSBStiffQuads( BPy_Object * self, PyObject * args );
-static PyObject *Object_insertShapeKey(BPy_Object * self);
-static PyObject *Object_copyNLA( BPy_Object * self, PyObject * args );
-static PyObject *Object_convertActionToStrip( BPy_Object * self );
-static PyObject *Object_copy(BPy_Object * self); /* __copy__ */
-
-/*****************************************************************************/
-/* Python BPy_Object methods table: */
-/*****************************************************************************/
-static PyMethodDef BPy_Object_methods[] = {
- /* name, method, flags, doc */
- {"buildParts", ( PyCFunction ) Object_buildParts, METH_NOARGS,
- "Recalcs particle system (if any) "},
- {"getIpo", ( PyCFunction ) Object_getIpo, METH_NOARGS,
- "Returns the ipo of this object (if any) "},
- {"clrParent", ( PyCFunction ) Object_clrParent, METH_VARARGS,
- "Clears parent object. Optionally specify:\n\
-mode\n\tnonzero: Keep object transform\nfast\n\t>0: Don't update scene \
-hierarchy (faster)"},
- {"clearTrack", ( PyCFunction ) Object_clearTrack, METH_VARARGS,
- "Make this object not track another anymore. Optionally specify:\n\
-mode\n\t2: Keep object transform\nfast\n\t>0: Don't update scene \
-hierarchy (faster)"},
- {"getData", ( PyCFunction ) Object_getData, METH_VARARGS | METH_KEYWORDS,
- "(name_only = 0, mesh = 0) - Returns the datablock object containing the object's \
-data, e.g. Mesh.\n\
-If 'name_only' is nonzero or True, only the name of the datablock is returned"},
- {"getDeltaLocation", ( PyCFunction ) Object_getDeltaLocation,
- METH_NOARGS,
- "Returns the object's delta location (x, y, z)"},
- {"getDrawMode", ( PyCFunction ) Object_getDrawMode, METH_NOARGS,
- "Returns the object draw modes"},
- {"getDrawType", ( PyCFunction ) Object_getDrawType, METH_NOARGS,
- "Returns the object draw type"},
- {"getAction", ( PyCFunction ) Object_getAction, METH_NOARGS,
- "Returns the active action for this object"},
- {"evaluatePose", ( PyCFunction ) Object_evaluatePose, METH_VARARGS,
- "(framenum) - Updates the pose to a certain frame number when the Object is\
- bound to an Action"},
- {"getPose", ( PyCFunction ) Object_getPose, METH_NOARGS,
- "() - returns the pose from an object if it exists, else None"},
- {"isSelected", ( PyCFunction ) Object_getSelected, METH_NOARGS,
- "Return a 1 or 0 depending on whether the object is selected"},
- {"getEuler", ( PyCFunction ) Object_GetEuler, METH_VARARGS,
- "(space = 'localspace' / 'worldspace') - Returns the object's rotation as Euler rotation vector\n\
-(rotX, rotY, rotZ)"},
- {"getInverseMatrix", ( PyCFunction ) Object_getInverseMatrix,
- METH_NOARGS,
- "Returns the object's inverse matrix"},
- {"getLocation", ( PyCFunction ) Object_getLocation, METH_VARARGS,
- "(space = 'localspace' / 'worldspace') - Returns the object's location (x, y, z)\n\
-"},
- {"getMaterials", ( PyCFunction ) Object_getMaterials, METH_VARARGS,
- "(i = 0) - Returns list of materials assigned to the object.\n\
-if i is nonzero, empty slots are not ignored: they are returned as None's."},
- {"getMatrix", ( PyCFunction ) Object_getMatrix, METH_VARARGS,
- "(str = 'worldspace') - Returns the object matrix.\n\
-(str = 'worldspace') - the desired matrix: worldspace (default), localspace\n\
-or old_worldspace.\n\
-\n\
-'old_worldspace' was the only behavior before Blender 2.34. With it the\n\
-matrix is not updated for changes made by the script itself\n\
-(like obj.LocX = 10) until a redraw happens, either called by the script or\n\
-automatic when the script finishes."},
- {"getName", ( PyCFunction ) GenericLib_getName, METH_NOARGS,
- "Returns the name of the object"},
- {"getParent", ( PyCFunction ) Object_getParent, METH_NOARGS,
- "Returns the object's parent object"},
- {"getParentBoneName", ( PyCFunction ) Object_getParentBoneName, METH_NOARGS,
- "Returns None, or the 'sub-name' of the parent (eg. Bone name)"},
- {"getSize", ( PyCFunction ) Object_getSize, METH_VARARGS,
- "(space = 'localspace' / 'worldspace') - Returns the object's size (x, y, z)"},
- {"getTimeOffset", ( PyCFunction ) Object_getTimeOffset, METH_NOARGS,
- "Returns the object's time offset"},
- {"getTracked", ( PyCFunction ) Object_getTracked, METH_NOARGS,
- "Returns the object's tracked object"},
- {"getType", ( PyCFunction ) Object_getType, METH_NOARGS,
- "Returns type of string of Object"},
-/* Particle Interaction */
-
- {"getPIStrength", ( PyCFunction ) Object_getPIStrength, METH_NOARGS,
- "Returns Particle Interaction Strength"},
- {"setPIStrength", ( PyCFunction ) Object_setPIStrength, METH_VARARGS,
- "Sets Particle Interaction Strength"},
- {"getPIFalloff", ( PyCFunction ) Object_getPIFalloff, METH_NOARGS,
- "Returns Particle Interaction Falloff"},
- {"setPIFalloff", ( PyCFunction ) Object_setPIFalloff, METH_VARARGS,
- "Sets Particle Interaction Falloff"},
- {"getPIMaxDist", ( PyCFunction ) Object_getPIMaxDist, METH_NOARGS,
- "Returns Particle Interaction Max Distance"},
- {"setPIMaxDist", ( PyCFunction ) Object_setPIMaxDist, METH_VARARGS,
- "Sets Particle Interaction Max Distance"},
- {"getPIUseMaxDist", ( PyCFunction ) Object_getPIUseMaxDist, METH_NOARGS,
- "Returns bool for Use Max Distace in Particle Interaction "},
- {"setPIUseMaxDist", ( PyCFunction ) Object_SetPIUseMaxDist, METH_VARARGS,
- "Sets if Max Distance should be used in Particle Interaction"},
- {"getPIType", ( PyCFunction ) Object_getPIType, METH_NOARGS,
- "Returns Particle Interaction Type"},
- {"setPIType", ( PyCFunction ) Object_SetPIType, METH_VARARGS,
- "sets Particle Interaction Type"},
- {"getPIPerm", ( PyCFunction ) Object_getPIPerm, METH_NOARGS,
- "Returns Particle Interaction Permiability"},
- {"setPIPerm", ( PyCFunction ) Object_SetPIPerm, METH_VARARGS,
- "Sets Particle Interaction Permiability"},
- {"getPISurfaceDamp", ( PyCFunction ) Object_getPISurfaceDamp, METH_NOARGS,
- "Returns Particle Interaction Surface Damping"},
- {"setPISurfaceDamp", ( PyCFunction ) Object_SetPISurfaceDamp, METH_VARARGS,
- "Sets Particle Interaction Surface Damping"},
- {"getPIRandomDamp", ( PyCFunction ) Object_getPIRandomDamp, METH_NOARGS,
- "Returns Particle Interaction Random Damping"},
- {"setPIRandomDamp", ( PyCFunction ) Object_setPIRandomDamp, METH_VARARGS,
- "Sets Particle Interaction Random Damping"},
- {"getPIDeflection", ( PyCFunction ) Object_getPIDeflection, METH_NOARGS,
- "Returns Particle Interaction Deflection"},
- {"setPIDeflection", ( PyCFunction ) Object_SetPIDeflection, METH_VARARGS,
- "Sets Particle Interaction Deflection"},
-
-/* Softbody */
-
- {"isSB", ( PyCFunction ) Object_isSB, METH_NOARGS,
- "True if object is a soft body"},
- {"getSBMass", ( PyCFunction ) Object_getSBMass, METH_NOARGS,
- "Returns SB Mass"},
- {"setSBMass", ( PyCFunction ) Object_setSBMass, METH_VARARGS,
- "Sets SB Mass"},
- {"getSBGravity", ( PyCFunction ) Object_getSBGravity, METH_NOARGS,
- "Returns SB Gravity"},
- {"setSBGravity", ( PyCFunction ) Object_setSBGravity, METH_VARARGS,
- "Sets SB Gravity"},
- {"getSBFriction", ( PyCFunction ) Object_getSBFriction, METH_NOARGS,
- "Returns SB Friction"},
- {"setSBFriction", ( PyCFunction ) Object_setSBFriction, METH_VARARGS,
- "Sets SB Friction"},
- {"getSBErrorLimit", ( PyCFunction ) Object_getSBErrorLimit, METH_NOARGS,
- "Returns SB ErrorLimit"},
- {"setSBErrorLimit", ( PyCFunction ) Object_setSBErrorLimit, METH_VARARGS,
- "Sets SB ErrorLimit"},
- {"getSBGoalSpring", ( PyCFunction ) Object_getSBGoalSpring, METH_NOARGS,
- "Returns SB GoalSpring"},
- {"setSBGoalSpring", ( PyCFunction ) Object_setSBGoalSpring, METH_VARARGS,
- "Sets SB GoalSpring"},
- {"getSBGoalFriction", ( PyCFunction ) Object_getSBGoalFriction, METH_NOARGS,
- "Returns SB GoalFriction"},
- {"setSBGoalFriction", ( PyCFunction ) Object_setSBGoalFriction, METH_VARARGS,
- "Sets SB GoalFriction"},
- {"getSBMinGoal", ( PyCFunction ) Object_getSBMinGoal, METH_NOARGS,
- "Returns SB MinGoal"},
- {"setSBMinGoal", ( PyCFunction ) Object_setSBMinGoal, METH_VARARGS,
- "Sets SB MinGoal "},
- {"getSBMaxGoal", ( PyCFunction ) Object_getSBMaxGoal, METH_NOARGS,
- "Returns SB MaxGoal"},
- {"setSBMaxGoal", ( PyCFunction ) Object_setSBMaxGoal, METH_VARARGS,
- "Sets SB MaxGoal"},
- {"getSBInnerSpring", ( PyCFunction ) Object_getSBInnerSpring, METH_NOARGS,
- "Returns SB InnerSpring"},
- {"setSBInnerSpring", ( PyCFunction ) Object_setSBInnerSpring, METH_VARARGS,
- "Sets SB InnerSpring"},
- {"getSBInnerSpringFriction", ( PyCFunction ) Object_getSBInnerSpringFriction, METH_NOARGS,
- "Returns SB InnerSpringFriction"},
- {"setSBInnerSpringFriction", ( PyCFunction ) Object_setSBInnerSpringFriction, METH_VARARGS,
- "Sets SB InnerSpringFriction"},
- {"getSBDefaultGoal", ( PyCFunction ) Object_getSBDefaultGoal, METH_NOARGS,
- "Returns SB DefaultGoal"},
- {"setSBDefaultGoal", ( PyCFunction ) Object_setSBDefaultGoal, METH_VARARGS,
- "Sets SB DefaultGoal"},
- {"getSBUseGoal", ( PyCFunction ) Object_getSBUseGoal, METH_NOARGS,
- "Returns SB UseGoal"},
- {"setSBUseGoal", ( PyCFunction ) Object_SetSBUseGoal, METH_VARARGS,
- "Sets SB UseGoal"},
- {"getSBUseEdges", ( PyCFunction ) Object_getSBUseEdges, METH_NOARGS,
- "Returns SB UseEdges"},
- {"setSBUseEdges", ( PyCFunction ) Object_SetSBUseEdges, METH_VARARGS,
- "Sets SB UseEdges"},
- {"getSBStiffQuads", ( PyCFunction ) Object_getSBStiffQuads, METH_NOARGS,
- "Returns SB StiffQuads"},
- {"setSBStiffQuads", ( PyCFunction ) Object_SetSBStiffQuads, METH_VARARGS,
- "Sets SB StiffQuads"},
- {"getBoundBox", ( PyCFunction ) Object_getBoundBox, METH_NOARGS,
- "Returns the object's bounding box"},
- {"makeDisplayList", ( PyCFunction ) Object_makeDisplayList, METH_NOARGS,
- "Update this object's Display List. Some changes like turning\n\
-'SubSurf' on for a mesh need this method (followed by a Redraw) to\n\
-show the changes on the 3d window."},
- {"link", ( PyCFunction ) Object_link, METH_VARARGS,
- "Links Object with data provided in the argument. The data must\n\
-match the Object's type, so you cannot link a Lamp to a Mesh type object."},
- {"makeParent", ( PyCFunction ) Object_makeParent, METH_VARARGS,
- "Makes the object the parent of the objects provided in the\n\
-argument which must be a list of valid Objects. Optional extra arguments:\n\
-mode:\n\t0: make parent with inverse\n\t1: without inverse\n\
-fast:\n\t0: update scene hierarchy automatically\n\t\
-don't update scene hierarchy (faster). In this case, you must\n\t\
-explicitly update the Scene hierarchy."},
- {"join", ( PyCFunction ) Object_join, METH_VARARGS,
- "(object_list) - Joins the objects in object list of the same type, into this object."},
- {"makeParentDeform", ( PyCFunction ) Object_makeParentDeform, METH_VARARGS,
- "Makes the object the deformation parent of the objects provided in the \n\
-argument which must be a list of valid Objects. Optional extra arguments:\n\
-mode:\n\t0: make parent with inverse\n\t1: without inverse\n\
-fast:\n\t0: update scene hierarchy automatically\n\t\
-don't update scene hierarchy (faster). In this case, you must\n\t\
-explicitly update the Scene hierarchy."},
- {"makeParentVertex", ( PyCFunction ) Object_makeParentVertex, METH_VARARGS,
- "Makes the object the vertex parent of the objects provided in the \n\
-argument which must be a list of valid Objects. \n\
-The second argument is a tuple of 1 or 3 positive integers which corresponds \
-to the index of the vertex you are parenting to.\n\
-Optional extra arguments:\n\
-mode:\n\t0: make parent with inverse\n\t1: without inverse\n\
-fast:\n\t0: update scene hierarchy automatically\n\t\
-don't update scene hierarchy (faster). In this case, you must\n\t\
-explicitly update the Scene hierarchy."},
- {"makeParentBone", ( PyCFunction ) Object_makeParentBone, METH_VARARGS,
- "Makes this armature objects bone, the parent of the objects provided in the \n\
-argument which must be a list of valid Objects. Optional extra arguments:\n\
-mode:\n\t0: make parent with inverse\n\t1: without inverse\n\
-fast:\n\t0: update scene hierarchy automatically\n\t\
-don't update scene hierarchy (faster). In this case, you must\n\t\
-explicitely update the Scene hierarchy."},
-
- {"materialUsage", ( PyCFunction ) Object_materialUsage, METH_NOARGS,
- "Determines the way the material is used and returns status.\n\
-Possible arguments (provide as strings):\n\
-\tData: Materials assigned to the object's data are shown. (default)\n\
-\tObject: Materials assigned to the object are shown."},
- {"setDeltaLocation", ( PyCFunction ) Object_setDeltaLocation,
- METH_VARARGS,
- "Sets the object's delta location which must be a vector triple."},
- {"setDrawMode", ( PyCFunction ) Object_SetDrawMode, METH_VARARGS,
- "Sets the object's drawing mode. The argument can be a sum of:\n\
-2: axis\n4: texspace\n8: drawname\n16: drawimage\n32: drawwire\n64: drawxray\n128: drawtransp"},
- {"setDrawType", ( PyCFunction ) Object_SetDrawType, METH_VARARGS,
- "Sets the object's drawing type. The argument must be one of:\n\
-1: Bounding box\n2: Wire\n3: Solid\n4: Shaded\n5: Textured"},
- {"setEuler", ( PyCFunction ) Object_SetEuler, METH_VARARGS,
- "Set the object's rotation according to the specified Euler\n\
-angles. The argument must be a vector triple"},
- {"setMatrix", ( PyCFunction ) Object_SetMatrix, METH_VARARGS,
- "Set and apply a new local matrix for the object"},
- {"setLocation", ( PyCFunction ) Object_setLocation, METH_VARARGS,
- "Set the object's location. The first argument must be a vector\n\
-triple."},
- {"setMaterials", ( PyCFunction ) Object_setMaterials, METH_VARARGS,
- "Sets materials. The argument must be a list of valid material\n\
-objects."},
- {"setName", ( PyCFunction ) GenericLib_setName_with_method, METH_VARARGS,
- "Sets the name of the object"},
- {"setSize", ( PyCFunction ) Object_setSize, METH_VARARGS,
- "Set the object's size. The first argument must be a vector\n\
-triple."},
- {"setTimeOffset", ( PyCFunction ) Object_setTimeOffset, METH_VARARGS,
- "Set the object's time offset."},
- {"makeTrack", ( PyCFunction ) Object_makeTrack, METH_VARARGS,
- "(trackedobj, fast = 0) - Make this object track another.\n\
- (trackedobj) - the object that will be tracked.\n\
- (fast = 0) - if 0: update the scene hierarchy automatically. If you\n\
- set 'fast' to a nonzero value, don't forget to update the scene yourself\n\
- (see scene.update())."},
- {"shareFrom", ( PyCFunction ) Object_shareFrom, METH_VARARGS,
- "Link data of self with object specified in the argument. This\n\
-works only if self and the object specified are of the same type."},
- {"select", ( PyCFunction ) Object_Select, METH_VARARGS,
- "( 1 or 0 ) - Set the selected state of the object.\n\
- 1 is selected, 0 not selected "},
- {"setIpo", ( PyCFunction ) Object_SetIpo, METH_VARARGS,
- "(Blender Ipo) - Sets the object's ipo"},
- {"clearIpo", ( PyCFunction ) Object_clearIpo, METH_NOARGS,
- "() - Unlink ipo from this object"},
-
- {"insertIpoKey", ( PyCFunction ) Object_insertIpoKey, METH_VARARGS,
- "( Object IPO type ) - Inserts a key into IPO"},
- {"insertPoseKey", ( PyCFunction ) Object_insertPoseKey, METH_VARARGS,
- "( Object Pose type ) - Inserts a key into Action"},
- {"insertCurrentPoseKey", ( PyCFunction ) Object_insertCurrentPoseKey, METH_VARARGS,
- "( Object Pose type ) - Inserts a key into Action based on current pose"},
- {"setConstraintInfluenceForBone", ( PyCFunction ) Object_setConstraintInfluenceForBone, METH_VARARGS,
- "( ) - sets a constraint influence for a certain bone in this (armature)object."},
- {"copyNLA", ( PyCFunction ) Object_copyNLA, METH_VARARGS,
- "( ) - copies all NLA strips from another object to this object."},
- {"convertActionToStrip", ( PyCFunction ) Object_convertActionToStrip, METH_NOARGS,
- "( ) - copies all NLA strips from another object to this object."},
- {"getAllProperties", ( PyCFunction ) Object_getAllProperties, METH_NOARGS,
- "() - Get all the properties from this object"},
- {"addProperty", ( PyCFunction ) Object_addProperty, METH_VARARGS,
- "() - Add a property to this object"},
- {"removeProperty", ( PyCFunction ) Object_removeProperty, METH_VARARGS,
- "() - Remove a property from this object"},
- {"getProperty", ( PyCFunction ) Object_getProperty, METH_VARARGS,
- "() - Get a property from this object by name"},
- {"removeAllProperties", ( PyCFunction ) Object_removeAllProperties,
- METH_NOARGS,
- "() - removeAll a properties from this object"},
- {"copyAllPropertiesTo", ( PyCFunction ) Object_copyAllPropertiesTo,
- METH_VARARGS,
- "() - copy all properties from this object to another object"},
- {"getScriptLinks", ( PyCFunction ) Object_getScriptLinks, METH_O,
- "(eventname) - Get a list of this object's scriptlinks (Text names) "
- "of the given type\n"
- "(eventname) - string: FrameChanged, Redraw or Render."},
- {"addScriptLink", ( PyCFunction ) Object_addScriptLink, METH_VARARGS,
- "(text, evt) - Add a new object scriptlink.\n"
- "(text) - string: an existing Blender Text name;\n"
- "(evt) string: FrameChanged, Redraw or Render."},
- {"clearScriptLinks", ( PyCFunction ) Object_clearScriptLinks,
- METH_VARARGS,
- "() - Delete all scriptlinks from this object.\n"
- "([s1<,s2,s3...>]) - Delete specified scriptlinks from this object."},
- {"insertShapeKey", ( PyCFunction ) Object_insertShapeKey, METH_NOARGS,
- "() - Insert a Shape Key in the current object"},
- {"__copy__", ( PyCFunction ) Object_copy, METH_NOARGS,
- "() - Return a copy of this object."},
- {"copy", ( PyCFunction ) Object_copy, METH_NOARGS,
- "() - Return a copy of this object."},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* PythonTypeObject callback function prototypes */
-/*****************************************************************************/
-static void Object_dealloc( BPy_Object * obj );
-static PyObject *Object_repr( BPy_Object * obj );
-static int Object_compare( BPy_Object * a, BPy_Object * b );
-
-/*****************************************************************************/
-/* Function: M_Object_New */
-/* Python equivalent: Blender.Object.New */
-/*****************************************************************************/
-
-/*
- * Note: if this method is called without later linking object data to it,
- * errors can be caused elsewhere in Blender. Future versions of the API
- * will designate obdata as a parameter to this method to prevent this, and
- * eventually this method will be deprecated.
- *
- * When we can guarantee that objects will always have valid obdata,
- * unlink_object() should be edited to remove checks for NULL pointers and
- * debugging messages.
- */
-
-PyObject *M_Object_New( PyObject * self_unused, PyObject * args )
-{
- struct Object *object;
- int type;
- char *str_type;
- char *name = NULL;
- PyObject *py_object;
- BPy_Object *blen_object;
-
- if( !PyArg_ParseTuple( args, "s|s", &str_type, &name ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "string expected as argument" );
-
- if( strcmp( str_type, "Armature" ) == 0 )
- type = OB_ARMATURE;
- else if( strcmp( str_type, "Camera" ) == 0 )
- type = OB_CAMERA;
- else if( strcmp( str_type, "Curve" ) == 0 )
- type = OB_CURVE;
- else if (strcmp (str_type, "Text") == 0)
- type = OB_FONT;
- else if( strcmp( str_type, "Lamp" ) == 0 )
- type = OB_LAMP;
- else if( strcmp( str_type, "Lattice" ) == 0 )
- type = OB_LATTICE;
- else if( strcmp( str_type, "Mball" ) == 0 )
- type = OB_MBALL;
- else if( strcmp( str_type, "Mesh" ) == 0 )
- type = OB_MESH;
- else if( strcmp( str_type, "Surf" ) == 0 )
- type = OB_SURF;
-/* else if (strcmp (str_type, "Wave") == 0) type = OB_WAVE; */
- else if( strcmp( str_type, "Empty" ) == 0 )
- type = OB_EMPTY;
- else
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "Unknown type specified" );
-
- /* Create a new object. */
- if( name == NULL ) {
- /* No name is specified, set the name to the type of the object. */
- name = str_type;
- }
- object = add_only_object(type, name);
-
- object->flag = 0;
- object->lay = 1; /* Layer, by default visible*/
- object->data = NULL;
-
- /* user count is incremented in Object_CreatePyObject */
- object->id.us = 0;
-
- /* Create a Python object from it. */
- py_object = Object_CreatePyObject( object );
- blen_object = (BPy_Object *)py_object;
-
- /* store the real object type in the PyObject, treat this as an Empty
- * until it has some obdata */
- blen_object->realtype = object->type;
- object->type = OB_EMPTY;
-
- return py_object;
-}
-
-/*****************************************************************************/
-/* Function: M_Object_Get */
-/* Python equivalent: Blender.Object.Get */
-/*****************************************************************************/
-PyObject *M_Object_Get( PyObject * self_unused, PyObject * args )
-{
- struct Object *object;
- PyObject *blen_object;
- char *name = NULL;
-
- PyArg_ParseTuple( args, "|s", &name );
-
- if( name != NULL ) {
- object = ( Object * ) GetIdFromList( &( G.main->object ), name );
-
- /* No object exists with the name specified in the argument name. */
- if( !object ){
- char buffer[128];
- PyOS_snprintf( buffer, sizeof(buffer),
- "object \"%s\" not found", name);
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- buffer );
- }
-
- /* objects used in pydriver expressions need this */
- if (bpy_during_pydriver())
- bpy_pydriver_appendToList(object);
-
- return Object_CreatePyObject( object );
- } else {
- /* No argument has been given. Return a list of all objects. */
- PyObject *obj_list;
- Link *link;
- int index;
-
- /* do not allow Get() (w/o arguments) inside pydriver, otherwise
- * we'd have to update all objects in the DAG */
- if (bpy_during_pydriver())
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "Object.Get requires an argument when used in pydrivers" );
-
- obj_list = PyList_New( BLI_countlist( &( G.main->object ) ) );
-
- if( !obj_list )
- return EXPP_ReturnPyObjError( PyExc_SystemError,
- "List creation failed." );
-
- link = G.main->object.first;
- index = 0;
- while( link ) {
- object = ( Object * ) link;
- blen_object = Object_CreatePyObject( object );
- if( !blen_object ) {
- Py_DECREF( obj_list );
- Py_RETURN_NONE;
- }
- PyList_SetItem( obj_list, index, blen_object );
- index++;
- link = link->next;
- }
- return obj_list;
- }
-}
-
-/*****************************************************************************/
-/* Function: M_Object_GetSelected */
-/* Python equivalent: Blender.Object.GetSelected */
-/*****************************************************************************/
-static PyObject *M_Object_GetSelected( PyObject * self_unused )
-{
- PyObject *blen_object;
- PyObject *list;
- Base *base_iter;
-
- list = PyList_New( 0 );
-
- if( G.vd == NULL ) {
- /* No 3d view has been initialized yet, simply return an empty list */
- return list;
- }
-
- if( ( G.scene->basact ) &&
- ( ( G.scene->basact->flag & SELECT ) &&
- ( G.scene->basact->lay & G.vd->lay ) ) ) {
-
- /* Active object is first in the list. */
- blen_object = Object_CreatePyObject( G.scene->basact->object );
- if( !blen_object ) {
- Py_DECREF( list );
- Py_RETURN_NONE;
- }
- PyList_Append( list, blen_object );
- Py_DECREF( blen_object );
- }
-
- base_iter = G.scene->base.first;
- while( base_iter ) {
- if( ( ( base_iter->flag & SELECT ) &&
- ( base_iter->lay & G.vd->lay ) ) &&
- ( base_iter != G.scene->basact ) ) {
-
- blen_object = Object_CreatePyObject( base_iter->object );
- if( blen_object ) {
- PyList_Append( list, blen_object );
- Py_DECREF( blen_object );
- }
- }
- base_iter = base_iter->next;
- }
- return list;
-}
-
-
-/*****************************************************************************/
-/* Function: M_Object_Duplicate */
-/* Python equivalent: Blender.Object.Duplicate */
-/*****************************************************************************/
-static PyObject *M_Object_Duplicate( PyObject * self_unused,
- PyObject * args, PyObject *kwd )
-{
- int dupflag= 0; /* this a flag, passed to adduplicate() and used instead of U.dupflag sp python can set what is duplicated */
-
- /* the following variables are bools, if set true they will modify the dupflag to pass to adduplicate() */
- int mesh_dupe = 0;
- int surface_dupe = 0;
- int curve_dupe = 0;
- int text_dupe = 0;
- int metaball_dupe = 0;
- int armature_dupe = 0;
- int lamp_dupe = 0;
- int material_dupe = 0;
- int texture_dupe = 0;
- int ipo_dupe = 0;
-
- static char *kwlist[] = {"mesh", "surface", "curve",
- "text", "metaball", "armature", "lamp", "material", "texture", "ipo", NULL};
-
- /* duplicating in background causes segfaults */
- if( G.background == 1 )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "cannot duplicate objects in background mode" );
-
-
- if (!PyArg_ParseTupleAndKeywords(args, kwd, "|iiiiiiiiii", kwlist,
- &mesh_dupe, &surface_dupe, &curve_dupe, &text_dupe, &metaball_dupe,
- &armature_dupe, &lamp_dupe, &material_dupe, &texture_dupe, &ipo_dupe))
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected nothing or bool keywords 'mesh', 'surface', 'curve', 'text', 'metaball', 'armature', 'lamp' 'material', 'texture' and 'ipo' as arguments" );
-
- /* USER_DUP_ACT for actions is not supported in the UI so dont support it here */
- if (mesh_dupe) dupflag |= USER_DUP_MESH;
- if (surface_dupe) dupflag |= USER_DUP_SURF;
- if (curve_dupe) dupflag |= USER_DUP_CURVE;
- if (text_dupe) dupflag |= USER_DUP_FONT;
- if (metaball_dupe) dupflag |= USER_DUP_MBALL;
- if (armature_dupe) dupflag |= USER_DUP_ARM;
- if (lamp_dupe) dupflag |= USER_DUP_LAMP;
- if (material_dupe) dupflag |= USER_DUP_MAT;
- if (texture_dupe) dupflag |= USER_DUP_TEX;
- if (ipo_dupe) dupflag |= USER_DUP_IPO;
- adduplicate(2, dupflag); /* 2 is a mode with no transform and no redraw, Duplicate the current selection, context sensitive */
- Py_RETURN_NONE;
-}
-
-
-/*****************************************************************************/
-/* Python BPy_Object methods: */
-/*****************************************************************************/
-
-static PyObject *Object_buildParts( BPy_Object * self )
-{
- build_particle_system( self->object );
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_clearIpo( BPy_Object * self )
-{
- Object *ob = self->object;
- Ipo *ipo = ( Ipo * ) ob->ipo;
-
- if( ipo ) {
- ID *id = &ipo->id;
- if( id->us > 0 )
- id->us--;
- ob->ipo = NULL;
-
- Py_RETURN_TRUE;
- }
-
- Py_RETURN_FALSE; /* no ipo found */
-}
-
-static PyObject *Object_clrParent( BPy_Object * self, PyObject * args )
-{
- int mode = 0;
- int fast = 0;
-
- if( !PyArg_ParseTuple( args, "|ii", &mode, &fast ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected one or two optional integers as arguments" );
-
- /* Remove the link only, the object is still in the scene. */
- self->object->parent = NULL;
-
- if( mode == 2 ) {
- /* Keep transform */
- apply_obmat( self->object );
- }
-
- if( !fast )
- DAG_scene_sort( G.scene );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_clearTrack( BPy_Object * self, PyObject * args )
-{
- int mode = 0;
- int fast = 0;
-
- if( !PyArg_ParseTuple( args, "|ii", &mode, &fast ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected one or two optional integers as arguments" );
-
- /* Remove the link only, the object is still in the scene. */
- self->object->track = NULL;
-
- if( mode ) {
- /* Keep transform */
- apply_obmat( self->object );
- }
-
- if( !fast )
- DAG_scene_sort( G.scene );
-
- Py_RETURN_NONE;
-}
-
-/* adds object data to a Blender object, if object->data = NULL */
-int EXPP_add_obdata( struct Object *object )
-{
- if( object->data != NULL )
- return -1;
-
- switch ( object->type ) {
- case OB_ARMATURE:
- /* TODO: Do we need to add something to G? (see the OB_LAMP case) */
- object->data = add_armature( "Armature" );
- break;
- case OB_CAMERA:
- /* TODO: Do we need to add something to G? (see the OB_LAMP case) */
- object->data = add_camera( "Camera" );
- break;
- case OB_CURVE:
- object->data = add_curve( "Curve", OB_CURVE );
- G.totcurve++;
- break;
- case OB_LAMP:
- object->data = add_lamp( "Lamp" );
- G.totlamp++;
- break;
- case OB_MESH:
- object->data = add_mesh( "Mesh" );
- G.totmesh++;
- break;
- case OB_LATTICE:
- object->data = ( void * ) add_lattice( "Lattice" );
- object->dt = OB_WIRE;
- break;
- case OB_MBALL:
- object->data = add_mball( "Meta" );
- break;
-
- /* TODO the following types will be supported later,
- be sure to update Scene_link when new types are supported
- case OB_SURF:
- object->data = add_curve(OB_SURF);
- G.totcurve++;
- break;
- case OB_FONT:
- object->data = add_curve(OB_FONT);
- break;
- case OB_WAVE:
- object->data = add_wave();
- break;
- */
- default:
- break;
- }
-
- if( !object->data )
- return -1;
-
- return 0;
-}
-
-static PyObject *Object_getDeltaLocation( BPy_Object * self )
-{
- return Py_BuildValue( "fff", self->object->dloc[0],
- self->object->dloc[1], self->object->dloc[2] );
-}
-
-static PyObject *Object_getAction( BPy_Object * self )
-{
- if( self->object->action )
- return Action_CreatePyObject( self->object->action );
- Py_RETURN_NONE;
-}
-
-static int Object_setAction( BPy_Object * self, PyObject * value )
-{
- return GenericLib_assignData(value, (void **) &self->object->action, 0, 1, ID_AC, 0);
-}
-
-static PyObject *Object_evaluatePose(BPy_Object *self, PyObject *args)
-{
- int frame = 1;
- if( !PyArg_ParseTuple( args, "i", &frame ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int argument" );
-
- frame = EXPP_ClampInt(frame, MINFRAME, MAXFRAME);
- G.scene->r.cfra = frame;
- do_all_pose_actions(self->object);
- where_is_pose (self->object);
-
- Py_RETURN_NONE;
-}
-
-static PyObject * Object_getPose(BPy_Object *self)
-{
- /*if there is no pose will return PyNone*/
- return PyPose_FromPose(self->object->pose, self->object->id.name+2);
-}
-
-static PyObject *Object_getSelected( BPy_Object * self )
-{
- Base *base;
-
- base = FIRSTBASE;
- while( base ) {
- if( base->object == self->object ) {
- if( base->flag & SELECT ) {
- Py_RETURN_TRUE;
- } else {
- Py_RETURN_FALSE;
- }
- }
- base = base->next;
- }
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "could not find object's selection state" );
-}
-
-static int Object_setSelect( BPy_Object * self, PyObject * value )
-{
- Base *base;
- int param = PyObject_IsTrue( value );
-
- if( param == -1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected True/False or 0/1" );
-
- base = FIRSTBASE;
- while( base ) {
- if( base->object == self->object ) {
- if( param ) {
- base->flag |= SELECT;
- self->object->flag = (short)base->flag;
- set_active_base( base );
- } else {
- base->flag &= ~SELECT;
- self->object->flag = (short)base->flag;
- }
- break;
- }
- base = base->next;
- }
- if (base) { /* was the object selected? */
- countall( );
- }
- return 0;
-}
-
-static PyObject *Object_GetEuler( BPy_Object * self, PyObject * args )
-{
- char *space = "localspace"; /* default to local */
- float eul[3];
-
- if( !PyArg_ParseTuple( args, "|s", &space ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a string or nothing" );
-
- if( BLI_streq( space, "worldspace" ) ) { /* Worldspace matrix */
- float mat3[3][3];
- disable_where_script( 1 );
- where_is_object( self->object );
- Mat3CpyMat4(mat3, self->object->obmat);
- Mat3ToEul(mat3, eul);
- disable_where_script( 0 );
- } else if( BLI_streq( space, "localspace" ) ) { /* Localspace matrix */
- eul[0] = self->object->rot[0];
- eul[1] = self->object->rot[1];
- eul[2] = self->object->rot[2];
- } else {
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "expected either nothing, 'localspace' (default) or 'worldspace'" );
- }
-
- return ( PyObject * ) newEulerObject( eul, Py_NEW );
-}
-
-static PyObject *Object_getInverseMatrix( BPy_Object * self )
-{
- MatrixObject *inverse =
- ( MatrixObject * ) newMatrixObject( NULL, 4, 4, Py_NEW );
- Mat4Invert( (float ( * )[4])*inverse->matrix, self->object->obmat );
-
- return ( ( PyObject * ) inverse );
-}
-
-static PyObject *Object_getIpo( BPy_Object * self )
-{
- struct Ipo *ipo = self->object->ipo;
-
- if( ipo )
- return Ipo_CreatePyObject( ipo );
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_getLocation( BPy_Object * self, PyObject * args )
-{
- char *space = "localspace"; /* default to local */
- PyObject *attr;
- if( !PyArg_ParseTuple( args, "|s", &space ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a string or nothing" );
-
- if( BLI_streq( space, "worldspace" ) ) { /* Worldspace matrix */
- disable_where_script( 1 );
- where_is_object( self->object );
-
- attr = Py_BuildValue( "fff",
- self->object->obmat[3][0],
- self->object->obmat[3][1],
- self->object->obmat[3][2] );
-
- disable_where_script( 0 );
- } else if( BLI_streq( space, "localspace" ) ) { /* Localspace matrix */
- attr = Py_BuildValue( "fff",
- self->object->loc[0],
- self->object->loc[1],
- self->object->loc[2] );
- } else {
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "expected either nothing, 'localspace' (default) or 'worldspace'" );
- }
-
- return attr;
-}
-
-static PyObject *Object_getMaterials( BPy_Object * self, PyObject * args )
-{
- int all = 0;
-
- if( !PyArg_ParseTuple( args, "|i", &all ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected an int or nothing" );
-
- return EXPP_PyList_fromMaterialList( self->object->mat,
- self->object->totcol, all );
-}
-
-static PyObject *Object_getParent( BPy_Object * self )
-{
- return Object_CreatePyObject( self->object->parent );
-}
-
-static PyObject *Object_getParentBoneName( BPy_Object * self )
-{
- if( self->object->parent && self->object->parent->type==OB_ARMATURE && self->object->parsubstr[0] != '\0' )
- return PyString_FromString( self->object->parsubstr );
- Py_RETURN_NONE;
-}
-
-static int Object_setParentBoneName( BPy_Object * self, PyObject *value )
-{
- char *bonename;
-
- if (!PyString_Check(value))
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected an int or nothing" );
-
- if (
- self->object->parent &&
- self->object->parent->type == OB_ARMATURE &&
- self->object->partype == PARBONE
- ) {/* its all good */} else
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "can only set the parent bone name for objects that already have a bone parent" );
-
- bonename = PyString_AsString(value);
-
- if (!get_named_bone(self->object->parent->data, bonename))
- return EXPP_ReturnIntError( PyExc_ValueError,
- "cannot parent to this bone: invalid bone name" );
-
- strcpy(self->object->parsubstr, bonename);
- DAG_scene_sort( G.scene );
- return 0;
-}
-
-static PyObject *Object_getSize( BPy_Object * self, PyObject * args )
-{
- char *space = "localspace"; /* default to local */
- PyObject *attr;
- if( !PyArg_ParseTuple( args, "|s", &space ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a string or nothing" );
-
- if( BLI_streq( space, "worldspace" ) ) { /* Worldspace matrix */
- float rot[3];
- float mat[3][3], imat[3][3], tmat[3][3];
- disable_where_script( 1 );
- where_is_object( self->object );
-
- Mat3CpyMat4(mat, self->object->obmat);
-
- /* functionality copied from editobject.c apply_obmat */
- Mat3ToEul(mat, rot);
- EulToMat3(rot, tmat);
- Mat3Inv(imat, tmat);
- Mat3MulMat3(tmat, imat, mat);
-
- attr = Py_BuildValue( "fff",
- tmat[0][0],
- tmat[1][1],
- tmat[2][2] );
- disable_where_script( 0 );
- } else if( BLI_streq( space, "localspace" ) ) { /* Localspace matrix */
- attr = Py_BuildValue( "fff",
- self->object->size[0],
- self->object->size[1],
- self->object->size[2] );
- } else {
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "expected either nothing, 'localspace' (default) or 'worldspace'" );
- }
- return attr;
-}
-
-static PyObject *Object_getTimeOffset( BPy_Object * self )
-{
- return PyFloat_FromDouble ( (double) self->object->sf );
-}
-
-static PyObject *Object_getTracked( BPy_Object * self )
-{
- return Object_CreatePyObject( self->object->track );
-}
-
-static PyObject *Object_getType( BPy_Object * self )
-{
- char *str;
- int type = self->object->type;
-
- /* if object not yet linked to data, return the stored type */
- if( self->realtype != OB_EMPTY )
- type = self->realtype;
-
- switch ( type ) {
- case OB_ARMATURE:
- str = "Armature";
- break;
- case OB_CAMERA:
- str = "Camera";
- break;
- case OB_CURVE:
- str = "Curve";
- break;
- case OB_EMPTY:
- str = "Empty";
- break;
- case OB_FONT:
- str = "Text";
- break;
- case OB_LAMP:
- str = "Lamp";
- break;
- case OB_LATTICE:
- str = "Lattice";
- break;
- case OB_MBALL:
- str = "MBall";
- break;
- case OB_MESH:
- str = "Mesh";
- break;
- case OB_SURF:
- str = "Surf";
- break;
- case OB_WAVE:
- str = "Wave";
- break;
- default:
- str = "unknown";
- break;
- }
-
- return PyString_FromString( str );
-}
-
-static PyObject *Object_getBoundBox( BPy_Object * self )
-{
- int i;
- float *vec = NULL;
- PyObject *vector, *bbox;
-
- if( !self->object->data )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "This object isn't linked to any object data (mesh, curve, etc) yet" );
-
- if( !self->object->bb ) { /* if no ob bbox, we look in obdata */
- Mesh *me;
- Curve *curve;
- switch ( self->object->type ) {
- case OB_MESH:
- me = self->object->data;
- vec = (float*) mesh_get_bb(self->object)->vec;
- break;
- case OB_CURVE:
- case OB_FONT:
- case OB_SURF:
- curve = self->object->data;
- if( !curve->bb )
- tex_space_curve( curve );
- vec = ( float * ) curve->bb->vec;
- break;
- default:
- Py_RETURN_NONE;
- }
-
- { /* transform our obdata bbox by the obmat.
- the obmat is 4x4 homogeneous coords matrix.
- each bbox coord is xyz, so we make it homogenous
- by padding it with w=1.0 and doing the matrix mult.
- afterwards we divide by w to get back to xyz.
- */
- /* printmatrix4( "obmat", self->object->obmat); */
-
- float tmpvec[4]; /* tmp vector for homogenous coords math */
- int i;
- float *from;
-
- bbox = PyList_New( 8 );
- if( !bbox )
- return EXPP_ReturnPyObjError
- ( PyExc_MemoryError,
- "couldn't create pylist" );
- for( i = 0, from = vec; i < 8; i++, from += 3 ) {
- memcpy( tmpvec, from, 3 * sizeof( float ) );
- tmpvec[3] = 1.0f; /* set w coord */
- Mat4MulVec4fl( self->object->obmat, tmpvec );
- /* divide x,y,z by w */
- tmpvec[0] /= tmpvec[3];
- tmpvec[1] /= tmpvec[3];
- tmpvec[2] /= tmpvec[3];
-
-#if 0
- { /* debug print stuff */
- int i;
-
- printf( "\nobj bbox transformed\n" );
- for( i = 0; i < 4; ++i )
- printf( "%f ", tmpvec[i] );
-
- printf( "\n" );
- }
-#endif
-
- /* because our bounding box is calculated and
- does not have its own memory,
- we must create vectors that allocate space */
-
- vector = newVectorObject( NULL, 3, Py_NEW);
- memcpy( ( ( VectorObject * ) vector )->vec,
- tmpvec, 3 * sizeof( float ) );
- PyList_SET_ITEM( bbox, i, vector );
- }
- }
- } else { /* the ob bbox exists */
- vec = ( float * ) self->object->bb->vec;
-
- if( !vec )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't retrieve bounding box data" );
-
- bbox = PyList_New( 8 );
-
- if( !bbox )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create pylist" );
-
- /* create vectors referencing object bounding box coords */
- for( i = 0; i < 8; i++ ) {
- vector = newVectorObject( vec, 3, Py_WRAP );
- PyList_SET_ITEM( bbox, i, vector );
- vec += 3;
- }
- }
-
- return bbox;
-}
-
-static PyObject *Object_makeDisplayList( BPy_Object * self )
-{
- Object *ob = self->object;
-
- if( ob->type == OB_FONT ) {
- Curve *cu = ob->data;
- freedisplist( &cu->disp );
- text_to_curve( ob, 0 );
- }
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_link( BPy_Object * self, PyObject * args )
-{
- PyObject *py_data;
- ID *id;
- ID *oldid;
- int obj_id;
- void *data = NULL;
- int ok;
-
- if( !PyArg_ParseTuple( args, "O", &py_data ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected an object as argument" );
-
- if( BPy_Armature_Check( py_data ) )
- data = ( void * ) PyArmature_AsArmature((BPy_Armature*)py_data);
- else if( BPy_Camera_Check( py_data ) )
- data = ( void * ) Camera_FromPyObject( py_data );
- else if( BPy_Lamp_Check( py_data ) )
- data = ( void * ) Lamp_FromPyObject( py_data );
- else if( BPy_Curve_Check( py_data ) )
- data = ( void * ) Curve_FromPyObject( py_data );
- else if( BPy_NMesh_Check( py_data ) ) {
- data = ( void * ) NMesh_FromPyObject( py_data, self->object );
- if( !data ) /* NULL means there is already an error */
- return NULL;
- } else if( BPy_Mesh_Check( py_data ) )
- data = ( void * ) Mesh_FromPyObject( py_data, self->object );
- else if( BPy_Lattice_Check( py_data ) )
- data = ( void * ) Lattice_FromPyObject( py_data );
- else if( BPy_Metaball_Check( py_data ) )
- data = ( void * ) Metaball_FromPyObject( py_data );
- else if( BPy_Text3d_Check( py_data ) )
- data = ( void * ) Text3d_FromPyObject( py_data );
-
- /* have we set data to something good? */
- if( !data )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "link argument type is not supported " );
-
- oldid = ( ID * ) self->object->data;
- id = ( ID * ) data;
- obj_id = MAKE_ID2( id->name[0], id->name[1] );
-
- /* if the object object has not been linked to real data before, we
- * can now let it assume its real type */
- if( self->realtype != OB_EMPTY ) {
- self->object->type = self->realtype;
- self->realtype = OB_EMPTY;
- }
-
- ok = 1;
- switch ( obj_id ) {
- case ID_AR:
- if( self->object->type != OB_ARMATURE ) {
- ok = 0;
- }
- break;
- case ID_CA:
- if( self->object->type != OB_CAMERA ) {
- ok = 0;
- }
- break;
- case ID_LA:
- if( self->object->type != OB_LAMP ) {
- ok = 0;
- }
- break;
- case ID_ME:
- if( self->object->type != OB_MESH ) {
- ok = 0;
- }
- break;
- case ID_CU:
- if( self->object->type != OB_CURVE && self->object->type != OB_FONT ) {
- ok = 0;
- }
- break;
- case ID_LT:
- if( self->object->type != OB_LATTICE ) {
- ok = 0;
- }
- break;
- case ID_MB:
- if( self->object->type != OB_MBALL ) {
- ok = 0;
- }
- break;
- default:
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "Linking this object type is not supported" );
- }
-
- if( !ok )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "The 'link' object is incompatible with the base object" );
- self->object->data = data;
-
- /* creates the curve for the text object */
- if (self->object->type == OB_FONT)
- text_to_curve(self->object, 0);
-
- id_us_plus( id );
- if( oldid ) {
- if( oldid->us > 0 ) {
- oldid->us--;
- } else {
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "old object reference count below 0" );
- }
- }
-
- /* make sure data and object materials are consistent */
- test_object_materials( id );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_makeParentVertex( BPy_Object * self, PyObject * args )
-{
- PyObject *list;
- PyObject *vlist;
- PyObject *py_child;
- PyObject *ret_val;
- Object *parent;
- int noninverse = 0;
- int fast = 0;
- int partype;
- int v1, v2=0, v3=0;
- int i;
-
- /* Check if the arguments passed to makeParent are valid. */
- if( !PyArg_ParseTuple( args, "OO|ii", &list, &vlist, &noninverse, &fast ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a list of objects, a tuple of integers and one or two integers as arguments" );
-
- if( !PySequence_Check( list ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a list of objects" );
-
- if (!PyTuple_Check( vlist ))
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a tuple of integers" );
-
- switch( PyTuple_Size( vlist ) ) {
- case 1:
- if( !PyArg_ParseTuple( vlist, "i", &v1 ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a tuple of 1 or 3 integers" );
-
- if ( v1 < 0 )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "indices must be strictly positive" );
-
- partype = PARVERT1;
- break;
- case 3:
- if( !PyArg_ParseTuple( vlist, "iii", &v1, &v2, &v3 ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a tuple of 1 or 3 integers" );
-
- if ( v1 < 0 || v2 < 0 || v3 < 0)
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "indices must be strictly positive" );
- partype = PARVERT3;
- break;
- default:
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a tuple of 1 or 3 integers" );
- }
-
- parent = ( Object * ) self->object;
-
- if (!ELEM3(parent->type, OB_MESH, OB_CURVE, OB_SURF))
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "Parent Vertex only applies to curve, mesh or surface objects" );
-
- if (parent->id.us == 0)
- return EXPP_ReturnPyObjError (PyExc_RuntimeError,
- "object must be linked to a scene before it can become a parent");
-
- /* Check if the PyObject passed in list is a Blender object. */
- for( i = 0; i < PySequence_Length( list ); i++ ) {
- py_child = PySequence_GetItem( list, i );
-
- ret_val = internal_makeParent(parent, py_child, partype, noninverse, fast, v1, v2, v3, NULL);
- Py_DECREF (py_child);
-
- if (ret_val)
- Py_DECREF(ret_val);
- else {
- if (!fast) /* need to sort when interrupting in the middle of the list */
- DAG_scene_sort( G.scene );
- return NULL; /* error has been set already */
- }
- }
-
- if (!fast) /* otherwise, only sort at the end */
- DAG_scene_sort( G.scene );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_makeParentDeform( BPy_Object * self, PyObject * args )
-{
- PyObject *list;
- PyObject *py_child;
- PyObject *ret_val;
- Object *parent;
- int noninverse = 0;
- int fast = 0;
- int i;
-
- /* Check if the arguments passed to makeParent are valid. */
- if( !PyArg_ParseTuple( args, "O|ii", &list, &noninverse, &fast ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a list of objects and one or two integers as arguments" );
-
- if( !PySequence_Check( list ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a list of objects" );
-
- parent = ( Object * ) self->object;
-
- if (parent->type != OB_CURVE && parent->type != OB_ARMATURE)
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "Parent Deform only applies to curve or armature objects" );
-
- if (parent->id.us == 0)
- return EXPP_ReturnPyObjError (PyExc_RuntimeError,
- "object must be linked to a scene before it can become a parent");
-
- /* Check if the PyObject passed in list is a Blender object. */
- for( i = 0; i < PySequence_Length( list ); i++ ) {
- py_child = PySequence_GetItem( list, i );
-
- ret_val = internal_makeParent(parent, py_child, PARSKEL, noninverse, fast, 0, 0, 0, NULL);
- Py_DECREF (py_child);
-
- if (ret_val)
- Py_DECREF(ret_val);
- else {
- if (!fast) /* need to sort when interupting in the middle of the list */
- DAG_scene_sort( G.scene );
- return NULL; /* error has been set already */
- }
- }
-
- if (!fast) /* otherwise, only sort at the end */
- DAG_scene_sort( G.scene );
-
- Py_RETURN_NONE;
-}
-
-
-static PyObject *Object_makeParentBone( BPy_Object * self, PyObject * args )
-{
- char *bonename;
- PyObject *list;
- PyObject *py_child;
- PyObject *ret_val;
- Object *parent;
- int noninverse = 0;
- int fast = 0;
- int i;
-
- /* Check if the arguments passed to makeParent are valid. */
- if( !PyArg_ParseTuple( args, "Os|ii", &list, &bonename, &noninverse, &fast ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a list of objects, bonename and optionally two integers as arguments" );
-
- parent = ( Object * ) self->object;
-
- if (parent->type != OB_ARMATURE)
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "Parent Bone only applies to armature objects" );
-
- if (parent->id.us == 0)
- return EXPP_ReturnPyObjError (PyExc_RuntimeError,
- "object must be linked to a scene before it can become a parent");
-
- if (!parent->data)
- return EXPP_ReturnPyObjError (PyExc_RuntimeError,
- "object must be linked to armature data");
-
- if (!get_named_bone(parent->data, bonename))
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "Parent Bone Name is not in the armature" );
-
- /* Check if the PyObject passed in list is a Blender object. */
- for( i = 0; i < PySequence_Length( list ); i++ ) {
- py_child = PySequence_GetItem( list, i );
-
- ret_val = internal_makeParent(parent, py_child, PARBONE, noninverse, fast, 0, 0, 0, bonename);
- Py_DECREF (py_child);
-
- if (ret_val)
- Py_DECREF(ret_val);
- else {
- if (!fast) /* need to sort when interupting in the middle of the list */
- DAG_scene_sort( G.scene );
- return NULL; /* error has been set already */
- }
- }
-
- if (!fast) /* otherwise, only sort at the end */
- DAG_scene_sort( G.scene );
-
- Py_RETURN_NONE;
-}
-
-
-static PyObject *Object_makeParent( BPy_Object * self, PyObject * args )
-{
- PyObject *list;
- PyObject *py_child;
- PyObject *ret_val;
- Object *parent;
- int noninverse = 0;
- int fast = 0;
- int i;
-
- /* Check if the arguments passed to makeParent are valid. */
- if( !PyArg_ParseTuple( args, "O|ii", &list, &noninverse, &fast ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a list of objects and one or two integers as arguments" );
-
- if( !PySequence_Check( list ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a list of objects" );
-
- parent = ( Object * ) self->object;
-
- if (parent->id.us == 0)
- return EXPP_ReturnPyObjError (PyExc_RuntimeError,
- "object must be linked to a scene before it can become a parent");
-
- /* Check if the PyObject passed in list is a Blender object. */
- for( i = 0; i < PySequence_Length( list ); i++ ) {
- py_child = PySequence_GetItem( list, i );
-
- ret_val = internal_makeParent(parent, py_child, PAROBJECT, noninverse, fast, 0, 0, 0, NULL);
- Py_DECREF (py_child);
-
- if (ret_val)
- Py_DECREF(ret_val);
- else {
- if (!fast) /* need to sort when interupting in the middle of the list */
- DAG_scene_sort( G.scene );
- return NULL; /* error has been set already */
- }
- }
-
- if (!fast) /* otherwise, only sort at the end */
- DAG_scene_sort( G.scene );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_join( BPy_Object * self, PyObject * args )
-{
- PyObject *list;
- PyObject *py_child;
- Object *parent;
- Object *child;
- Scene *temp_scene;
- Scene *orig_scene;
- Base *temp_base;
- short type;
- int i, ok=0, ret_value=0, list_length=0;
-
- /* joining in background causes segfaults */
- if( G.background == 1 )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "cannot join objects in background mode" );
-
- /* Check if the arguments passed to makeParent are valid. */
- if( !PyArg_ParseTuple( args, "O", &list ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a list of objects" );
-
- if( !PySequence_Check( list ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a list of objects" );
-
- list_length = PySequence_Length( list ); /* if there are no objects to join then exit silently */
-
- if( !list_length ) {
- Py_RETURN_NONE;
- }
-
- parent = ( Object * ) self->object;
- type = parent->type;
-
- /* Only these object types are sypported */
- if( type!=OB_MESH && type!=OB_CURVE && type!=OB_SURF && type!=OB_ARMATURE )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "Base object is not a type Blender can join" );
-
- if( !object_in_scene( parent, G.scene ) )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "object must be in the current scene" );
-
- /* exit editmode so join can be done */
- if( G.obedit )
- exit_editmode( EM_FREEDATA );
-
- temp_scene = add_scene( "Scene" ); /* make the new scene */
- temp_scene->lay= 1; /* first layer on */
-
- /* TODO: use EXPP_check_sequence_consistency here */
-
- /* Check if the PyObject passed in list is a Blender object. */
- for( i = 0; i < list_length; i++ ) {
- py_child = PySequence_GetItem( list, i );
- if( !BPy_Object_Check( py_child ) ) {
- /* Cleanup */
- free_libblock( &G.main->scene, temp_scene );
- Py_DECREF( py_child );
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a list of objects, one or more of the list items is not a Blender Object." );
- } else {
- /* List item is an object, is it the same type? */
- child = ( Object * ) Object_FromPyObject( py_child );
- Py_DECREF( py_child );
- if( parent->type == child->type ) {
- if( !object_in_scene( child, G.scene ) ) {
- free_libblock( &G.main->scene, temp_scene );
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "object must be in the current scene" );
- }
-
- ok =1;
- /* Add a new base, then link the base to the temp_scene */
- temp_base = MEM_callocN( sizeof( Base ), "pynewbase" );
- /* we know these types are the same, link to the temp scene
- * for joining */
- temp_base->object = child; /* link object to the new base */
- temp_base->flag |= SELECT;
- temp_base->lay = 1; /*1 layer on */
-
- BLI_addhead( &temp_scene->base, temp_base ); /* finally, link new base to scene */
- child->id.us += 1; /*Would usually increase user count but in this case it's ok not to */
-
- /*DAG_object_flush_update(temp_scene, temp_base->object, OB_RECALC_DATA);*/
- }
- }
- }
-
- orig_scene = G.scene; /* backup our scene */
-
- /* Add the main object into the temp_scene */
- temp_base = MEM_callocN( sizeof( Base ), "pynewbase" );
- temp_base->object = parent; /* link object to the new base */
- temp_base->flag |= SELECT;
- temp_base->lay = 1; /*1 layer on */
- BLI_addhead( &temp_scene->base, temp_base ); /* finally, link new base to scene */
- parent->id.us += 1;
-
- /* all objects in the scene, set it active and the active object */
- set_scene( temp_scene );
- set_active_base( temp_base );
-
- /* Do the joining now we know everythings OK. */
- if(type == OB_MESH)
- ret_value = join_mesh();
- else if(type == OB_CURVE)
- ret_value = join_curve(OB_CURVE);
- else if(type == OB_SURF)
- ret_value = join_curve(OB_SURF);
- else if(type == OB_ARMATURE)
- ret_value = join_armature();
-
- /* May use this for correcting object user counts later on */
- /*
- if (!ret_value) {
- temp_base = temp_scene->base.first;
- while( base ) {
- object = base->object;
- object->id.us +=1
- base = base->next;
- }
- }*/
-
- /* remove old scene */
- set_scene( orig_scene );
- free_libblock( &G.main->scene, temp_scene );
-
- /* no objects were of the correct type, return None */
- if (!ok) {
- Py_RETURN_NONE;
- }
-
- /* If the join failed then raise an error */
- if (!ret_value)
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
-"Blender failed to join the objects, this is not a script error.\n\
-Please add exception handling to your script with a RuntimeError exception\n\
-letting the user know that their data could not be joined." ) );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *internal_makeParent(Object *parent, PyObject *py_child,
- int partype, /* parenting type */
- int noninverse, int fast, /* parenting arguments */
- int v1, int v2, int v3, /* for vertex parent */
- char *bonename) /* for bone parents - assume the name is already checked to be a valid bone name*/
-{
- Object *child = NULL;
-
- if( BPy_Object_Check( py_child ) )
- child = ( Object * ) Object_FromPyObject( py_child );
-
- if( child == NULL )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "Object Type expected" );
-
- if( test_parent_loop( parent, child ) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "parenting loop detected - parenting failed" );
-
- if (partype == PARSKEL && child->type != OB_MESH)
- child->partype = PAROBJECT;
- else
- child->partype = (short)partype;
-
- if (partype == PARVERT3) {
- child->par1 = v1;
- child->par2 = v2;
- child->par3 = v3;
- }
- else if (partype == PARVERT1) {
- child->par1 = v1;
- } else if (partype == PARBONE) {
- strcpy( child->parsubstr, bonename );
- }
-
-
-
- child->parent = parent;
- /* py_obj_child = (BPy_Object *) py_child; */
- if( noninverse == 1 ) {
- Mat4One(child->parentinv);
- /* Parent inverse = unity */
- child->loc[0] = 0.0;
- child->loc[1] = 0.0;
- child->loc[2] = 0.0;
- } else {
- what_does_parent( child );
- Mat4Invert( child->parentinv, workob.obmat );
- clear_workob();
- }
-
- if( !fast )
- child->recalc |= OB_RECALC_OB;
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_materialUsage( void )
-{
- return EXPP_ReturnPyObjError( PyExc_NotImplementedError,
- "materialUsage: not yet implemented" );
-}
-
-static PyObject *Object_setDeltaLocation( BPy_Object * self, PyObject * args )
-{
- float dloc1;
- float dloc2;
- float dloc3;
- int status;
-
- if( PyObject_Length( args ) == 3 )
- status = PyArg_ParseTuple( args, "fff", &dloc1, &dloc2,
- &dloc3 );
- else
- status = PyArg_ParseTuple( args, "(fff)", &dloc1, &dloc2,
- &dloc3 );
-
- if( !status )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected sequence argument of 3 floats" );
-
- self->object->dloc[0] = dloc1;
- self->object->dloc[1] = dloc2;
- self->object->dloc[2] = dloc3;
-
- /* since we have messed with object, we need to flag for DAG recalc */
- self->object->recalc |= OB_RECALC_OB;
-
- Py_RETURN_NONE;
-}
-
-#define DTX_MASK ( OB_AXIS | OB_TEXSPACE | OB_DRAWNAME | \
- OB_DRAWIMAGE | OB_DRAWWIRE | OB_DRAWXRAY | OB_DRAWTRANSP )
-
-static PyObject *Object_getDrawMode( BPy_Object * self )
-{
- return PyInt_FromLong( (long)(self->object->dtx & DTX_MASK) );
-}
-
-static int Object_setDrawMode( BPy_Object * self, PyObject * args )
-{
- PyObject* integer = PyNumber_Int( args );
- int value;
-
- if( !integer )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected integer argument" );
-
- value = ( int )PyInt_AS_LONG( integer );
- Py_DECREF( integer );
- if( value & ~DTX_MASK )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "undefined bit(s) set in bitfield" );
-
- self->object->dtx = value;
- self->object->recalc |= OB_RECALC_OB;
-
- return 0;
-}
-
-static PyObject *Object_getDrawType( BPy_Object * self )
-{
- return PyInt_FromLong( (long)self->object->dt );
-}
-
-static int Object_setDrawType( BPy_Object * self, PyObject * value )
-{
- /* since we mess with object, we need to flag for DAG recalc */
- self->object->recalc |= OB_RECALC_OB;
-
- return EXPP_setIValueRange( value, &self->object->dt,
- OB_BOUNDBOX, OB_TEXTURE, 'b' );
-}
-
-static int Object_setEuler( BPy_Object * self, PyObject * args )
-{
- float rot1, rot2, rot3;
- int status = 0; /* failure */
-
- if( PyTuple_Check( args ) && PyTuple_Size( args ) == 1 )
- args = PyTuple_GET_ITEM( args, 0 );
-
- if( EulerObject_Check( args ) ) {
- rot1 = ( ( EulerObject * ) args )->eul[0];
- rot2 = ( ( EulerObject * ) args )->eul[1];
- rot3 = ( ( EulerObject * ) args )->eul[2];
- status = 1;
- } else if( PySequence_Check( args ) && PySequence_Size( args ) == 3 ) {
- if( PyList_Check( args ) )
- args = PySequence_Tuple( args );
- else
- Py_INCREF( args );
- status = PyArg_ParseTuple( args, "fff", &rot1, &rot2, &rot3 );
- Py_DECREF( args );
- }
-
- if( !status )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected euler or sequence of 3 floats" );
-
- self->object->rot[0] = rot1;
- self->object->rot[1] = rot2;
- self->object->rot[2] = rot3;
-
- /* since we have messed with object, we need to flag for DAG recalc */
- self->object->recalc |= OB_RECALC_OB;
-
- return 0;
-}
-
-static int Object_setMatrix( BPy_Object * self, MatrixObject * mat )
-#if 0
-{
- int x, y;
-
- if( !MatrixObject_Check( mat ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected matrix object as argument" );
-
- if( mat->rowSize == 4 && mat->colSize == 4 ) {
- for( x = 0; x < 4; x++ ) {
- for( y = 0; y < 4; y++ ) {
- self->object->obmat[x][y] = mat->matrix[x][y];
- }
- }
- } else if( mat->rowSize == 3 && mat->colSize == 3 ) {
- for( x = 0; x < 3; x++ ) {
- for( y = 0; y < 3; y++ ) {
- self->object->obmat[x][y] = mat->matrix[x][y];
- }
- }
- /* if a 3x3 matrix, clear the fourth row/column */
- for( x = 0; x < 3; x++ )
- self->object->obmat[x][3] = self->object->obmat[3][x] = 0.0;
- self->object->obmat[3][3] = 1.0;
- } else
- return EXPP_ReturnIntError( PyExc_ValueError,
- "expected 3x3 or 4x4 matrix" );
-
- apply_obmat( self->object );
-
- /* since we have messed with object, we need to flag for DAG recalc */
- self->object->recalc |= OB_RECALC_OB;
-
- return 0;
-}
-#endif
-{
- int x, y;
- float matrix[4][4]; /* for the result */
- float invmat[4][4]; /* for the result */
-
- if( !MatrixObject_Check( mat ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected matrix object as argument" );
-
- if( mat->rowSize == 4 && mat->colSize == 4 ) {
- for( x = 0; x < 4; x++ ) {
- for( y = 0; y < 4; y++ ) {
- matrix[x][y] = mat->matrix[x][y];
- }
- }
- } else if( mat->rowSize == 3 && mat->colSize == 3 ) {
- for( x = 0; x < 3; x++ ) {
- for( y = 0; y < 3; y++ ) {
- matrix[x][y] = mat->matrix[x][y];
- }
- }
- /* if a 3x3 matrix, clear the fourth row/column */
- for( x = 0; x < 3; x++ )
- matrix[x][3] = matrix[3][x] = 0.0;
- matrix[3][3] = 1.0;
- } else
- return EXPP_ReturnIntError( PyExc_ValueError,
- "expected 3x3 or 4x4 matrix" );
-
- /* localspace matrix is truly relative to the parent, but parameters
- * stored in object are relative to parentinv matrix. Undo the parent
- * inverse part before updating obmat and calling apply_obmat() */
- if( self->object->parent ) {
- Mat4Invert( invmat, self->object->parentinv );
- Mat4MulMat4( self->object->obmat, matrix, invmat );
- } else
- Mat4CpyMat4( self->object->obmat, matrix );
-
- apply_obmat( self->object );
-
- /* since we have messed with object, we need to flag for DAG recalc */
- self->object->recalc |= OB_RECALC_OB;
-
- return 0;
-}
-
-
-/*
- * Object_insertIpoKey()
- * inserts Object IPO key for LOC, ROT, SIZE, LOCROT, LOCROTSIZE, or LAYER
- * Note it also inserts actions!
- */
-
-static PyObject *Object_insertIpoKey( BPy_Object * self, PyObject * args )
-{
- Object *ob= self->object;
- int key = 0;
- char *actname= NULL;
-
- if( !PyArg_ParseTuple( args, "i", &key ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int argument" );
-
- if(ob->ipoflag & OB_ACTION_OB)
- actname= "Object";
-
- if (key == IPOKEY_LOC || key == IPOKEY_LOCROT || key == IPOKEY_LOCROTSIZE){
- insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_X, 0);
- insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_Y, 0);
- insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_Z, 0);
- }
- if (key == IPOKEY_ROT || key == IPOKEY_LOCROT || key == IPOKEY_LOCROTSIZE){
- insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_X, 0);
- insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_Y, 0);
- insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_Z, 0);
- }
- if (key == IPOKEY_SIZE || key == IPOKEY_LOCROTSIZE ){
- insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_X, 0);
- insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_Y, 0);
- insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_Z, 0);
- }
- if (key == IPOKEY_LAYER ){
- insertkey((ID *)ob, ID_OB, actname, NULL,OB_LAY, 0);
- }
-
- if (key == IPOKEY_PI_STRENGTH ){
- insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_FSTR, 0);
- } else if (key == IPOKEY_PI_FALLOFF ){
- insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_FFALL, 0);
- } else if (key == IPOKEY_PI_SURFACEDAMP ){
- insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_SDAMP, 0);
- } else if (key == IPOKEY_PI_RANDOMDAMP ){
- insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_RDAMP, 0);
- } else if (key == IPOKEY_PI_PERM ){
- insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_PERM, 0);
- }
-
- allspace(REMAKEIPO, 0);
- EXPP_allqueue(REDRAWIPO, 0);
- EXPP_allqueue(REDRAWVIEW3D, 0);
- EXPP_allqueue(REDRAWACTION, 0);
- EXPP_allqueue(REDRAWNLA, 0);
-
- Py_RETURN_NONE;
-}
-
-/*
- * Object_insertPoseKey()
- * inserts a Action Pose key from a given pose (sourceaction, frame) to the
- * active action to a given framenum
- */
-
-static PyObject *Object_insertPoseKey( BPy_Object * self, PyObject * args )
-{
- Object *ob= self->object;
- BPy_Action *sourceact;
- char *chanName;
- int actframe;
-
-
- /* for doing the time trick, similar to editaction bake_action_with_client() */
- int oldframe;
- int curframe;
-
- if( !PyArg_ParseTuple( args, "O!sii", &Action_Type, &sourceact,
- &chanName, &actframe, &curframe ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expects an action to copy poses from, a string for chan/bone name, an int argument for frame to extract from the action and finally another int for the frame where to put the new key in the active object.action" );
-
- extract_pose_from_action(ob->pose, sourceact->action, (float)actframe);
-
- oldframe = G.scene->r.cfra;
- G.scene->r.cfra = curframe;
-
- /* XXX: must check chanName actually exists, otherwise segfaults! */
- //achan = get_action_channel(sourceact->action, chanName);
-
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_X, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Y, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Z, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_X, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Y, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Z, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_W, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_X, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Y, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Z, 0);
-
- G.scene->r.cfra = oldframe;
-
- allspace(REMAKEIPO, 0);
- EXPP_allqueue(REDRAWIPO, 0);
- EXPP_allqueue(REDRAWVIEW3D, 0);
- EXPP_allqueue(REDRAWACTION, 0);
- EXPP_allqueue(REDRAWNLA, 0);
-
- /* restore, but now with the new action in place */
- /*extract_pose_from_action(ob->pose, ob->action, G.scene->r.cfra);
- where_is_pose(ob);*/
-
- EXPP_allqueue(REDRAWACTION, 1);
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_insertCurrentPoseKey( BPy_Object * self, PyObject * args )
-{
- Object *ob= self->object;
- char *chanName;
-
- /* for doing the time trick, similar to editaction bake_action_with_client() */
- int oldframe;
- int curframe;
-
- if( !PyArg_ParseTuple( args, "si", &chanName, &curframe ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected chan/bone name, and a time (int) argument" );
-
- oldframe = G.scene->r.cfra;
- G.scene->r.cfra = curframe;
-
- /* XXX: must check chanName actually exists, otherwise segfaults! */
-
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_X, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Y, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Z, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_X, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Y, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Z, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_W, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_X, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Y, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Z, 0);
-
- G.scene->r.cfra = oldframe;
-
- allspace(REMAKEIPO, 0);
- EXPP_allqueue(REDRAWIPO, 0);
- EXPP_allqueue(REDRAWVIEW3D, 0);
- EXPP_allqueue(REDRAWACTION, 0);
- EXPP_allqueue(REDRAWNLA, 0);
-
- /* restore */
- extract_pose_from_action(ob->pose, ob->action, (float)G.scene->r.cfra);
- where_is_pose(ob);
-
- EXPP_allqueue(REDRAWACTION, 1);
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_setConstraintInfluenceForBone( BPy_Object * self,
- PyObject * args )
-{
- char *boneName, *constName;
- float influence;
- IpoCurve *icu;
-
- if( !PyArg_ParseTuple( args, "ssf", &boneName, &constName, &influence ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expects bonename, constraintname, influenceval" );
-
- icu = verify_ipocurve((ID *)self->object, ID_CO, boneName, constName, NULL,
- CO_ENFORCE);
-
- if (!icu)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "cannot get a curve from this IPO, may be using libdata" );
-
- insert_vert_icu(icu, (float)CFRA, influence, 0);
- self->object->recalc |= OB_RECALC_OB;
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_copyNLA( BPy_Object * self, PyObject * args ) {
- BPy_Object *bpy_fromob;
-
- if( !PyArg_ParseTuple( args, "O", &bpy_fromob ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "requires a Blender Object to copy NLA strips from." );
- copy_nlastrips(&self->object->nlastrips, &bpy_fromob->object->nlastrips);
- self->object->recalc |= OB_RECALC_OB;
-
- Py_RETURN_NONE;
-}
-
-/*Now that BPY has a Strip type, return the created strip.*/
-static PyObject *Object_convertActionToStrip( BPy_Object * self )
-{
- bActionStrip *strip = convert_action_to_strip( self->object );
- return ActionStrip_CreatePyObject( strip );
-}
-
-static PyObject *Object_setLocation( BPy_Object * self, PyObject * args )
-{
- float loc1;
- float loc2;
- float loc3;
- int status;
-
- if( PyObject_Length( args ) == 3 )
- status = PyArg_ParseTuple( args, "fff", &loc1, &loc2, &loc3 );
- else
- status = PyArg_ParseTuple( args, "(fff)", &loc1, &loc2,
- &loc3 );
-
- if( !status )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected list argument of 3 floats" );
-
- self->object->loc[0] = loc1;
- self->object->loc[1] = loc2;
- self->object->loc[2] = loc3;
-
- /* since we have messed with object, we need to flag for DAG recalc */
- self->object->recalc |= OB_RECALC_OB;
- DAG_object_flush_update(G.scene, self->object, OB_RECALC_DATA);
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_setMaterials( BPy_Object * self, PyObject * args )
-{
- PyObject *list;
- int len;
- int i;
- Material **matlist = NULL;
-
- if (!self->object->data)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "object must be linked to object data (e.g. to a mesh) first" );
-
- if( !PyArg_ParseTuple( args, "O!", &PyList_Type, &list ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a list (of materials or None) as argument" );
-
- len = PyList_Size(list);
-
- /* Object_getMaterials can return '[]' (zero-length list), so that must
- * also be accepted by this method for
- * ob2.setMaterials(ob1.getMaterials()) to always work.
- * In other words, list can be '[]' and so len can be zero. */
- if (len > 0) {
- if( len > MAXMAT )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "list must have from 1 up to 16 materials" );
-
- matlist = EXPP_newMaterialList_fromPyList( list );
- if( !matlist )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "material list must be a list of valid materials!" );
- }
-
- if( self->object->mat )
- EXPP_releaseMaterialList( self->object->mat, self->object->totcol );
-
- /* Increase the user count on all materials */
- for( i = 0; i < len; i++ ) {
- if( matlist[i] )
- id_us_plus( ( ID * ) matlist[i] );
- }
- self->object->mat = matlist;
- self->object->totcol = (char)len;
- self->object->actcol = (char)len;
-
- switch ( self->object->type ) {
- case OB_CURVE: /* fall through */
- case OB_FONT: /* fall through */
- case OB_MESH: /* fall through */
- case OB_MBALL: /* fall through */
- case OB_SURF:
- EXPP_synchronizeMaterialLists( self->object );
- break;
- default:
- break;
- }
-
- /* since we have messed with object, we need to flag for DAG recalc */
- self->object->recalc |= OB_RECALC_OB;
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_setSize( BPy_Object * self, PyObject * args )
-{
- float sizex;
- float sizey;
- float sizez;
- int status;
-
- if( PyObject_Length( args ) == 3 )
- status = PyArg_ParseTuple( args, "fff", &sizex, &sizey,
- &sizez );
- else
- status = PyArg_ParseTuple( args, "(fff)", &sizex, &sizey,
- &sizez );
-
- if( !status )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected list argument of 3 floats" );
-
- self->object->size[0] = sizex;
- self->object->size[1] = sizey;
- self->object->size[2] = sizez;
-
- /* since we have messed with object, we need to flag for DAG recalc */
- self->object->recalc |= OB_RECALC_OB;
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_makeTrack( BPy_Object * self, PyObject * args )
-{
- BPy_Object *tracked = NULL;
- Object *ob = self->object;
- int fast = 0;
-
- if( !PyArg_ParseTuple( args, "O!|i", &Object_Type, &tracked, &fast ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected an object and optionally also an int as arguments." );
-
- ob->track = tracked->object;
-
- if( !fast )
- DAG_scene_sort( G.scene );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_shareFrom( BPy_Object * self, PyObject * args )
-{
- BPy_Object *object;
- ID *id;
- ID *oldid;
-
- if( !PyArg_ParseTuple( args, "O!", &Object_Type, &object ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected an object argument" );
-
- if( !object->object->data )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "Object argument has no data linked yet or is an empty" );
-
- if( self->object->type != object->object->type &&
- self->realtype != object->object->type)
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "objects are not of same data type" );
-
- switch ( object->object->type ) {
- case OB_MESH:
- case OB_LAMP:
- case OB_CAMERA: /* we can probably add the other types, too */
- case OB_ARMATURE:
- case OB_CURVE:
- case OB_SURF:
- case OB_LATTICE:
-
- /* if this object had no data, we need to enable the realtype */
- if (self->object->type == OB_EMPTY) {
- self->object->type= self->realtype;
- self->realtype = OB_EMPTY;
- }
-
- oldid = ( ID * ) self->object->data;
- id = ( ID * ) object->object->data;
- self->object->data = object->object->data;
-
- if( self->object->type == OB_MESH && id ) {
- self->object->totcol = 0;
- EXPP_synchronizeMaterialLists( self->object );
- }
-
- id_us_plus( id );
- if( oldid ) {
- if( oldid->us > 0 ) {
- oldid->us--;
- } else {
- return EXPP_ReturnPyObjError ( PyExc_RuntimeError,
- "old object reference count below 0" );
- }
- }
-
- Py_RETURN_NONE;
- default:
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "object type not supported" );
- }
-}
-
-static PyObject *Object_getAllProperties( BPy_Object * self )
-{
- PyObject *prop_list, *pyval;
- bProperty *prop = NULL;
-
- prop_list = PyList_New( 0 );
-
- prop = self->object->prop.first;
- while( prop ) {
- pyval = Property_CreatePyObject( prop );
- PyList_Append( prop_list, pyval );
- Py_DECREF(pyval);
- prop = prop->next;
- }
- return prop_list;
-}
-
-static PyObject *Object_getProperty( BPy_Object * self, PyObject * args )
-{
- char *prop_name = NULL;
- bProperty *prop = NULL;
-
- if( !PyArg_ParseTuple( args, "s", &prop_name ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a string" );
-
- prop = get_property( self->object, prop_name );
- if( prop )
- return Property_CreatePyObject( prop );
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't find the property" );
-}
-
-static PyObject *Object_addProperty( BPy_Object * self, PyObject * args )
-{
- bProperty *prop = NULL;
- char *prop_name = NULL;
- PyObject *prop_data = Py_None;
- char *prop_type = NULL;
- short type = -1;
- BPy_Property *py_prop = NULL;
- int argslen = PyObject_Length( args );
-
- if( argslen == 3 || argslen == 2 ) {
- if( !PyArg_ParseTuple( args, "sO|s", &prop_name, &prop_data,
- &prop_type ) ) {
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expecting string, data, and optional string" );
- }
- } else if( argslen == 1 ) {
- if( !PyArg_ParseTuple( args, "O!", &property_Type, &py_prop ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expecting a Property" );
-
- if( py_prop->property != NULL )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "Property is already added to an object" );
- } else {
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected 1,2 or 3 arguments" );
- }
-
- /*parse property type*/
- if( !py_prop ) {
- if( prop_type ) {
- if( BLI_streq( prop_type, "BOOL" ) )
- type = PROP_BOOL;
- else if( BLI_streq( prop_type, "INT" ) )
- type = PROP_INT;
- else if( BLI_streq( prop_type, "FLOAT" ) )
- type = PROP_FLOAT;
- else if( BLI_streq( prop_type, "TIME" ) )
- type = PROP_TIME;
- else if( BLI_streq( prop_type, "STRING" ) )
- type = PROP_STRING;
- else
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "BOOL, INT, FLOAT, TIME or STRING expected" );
- } else {
- /*use the default*/
- if( PyInt_Check( prop_data ) )
- type = PROP_INT;
- else if( PyFloat_Check( prop_data ) )
- type = PROP_FLOAT;
- else if( PyString_Check( prop_data ) )
- type = PROP_STRING;
- }
- } else {
- type = py_prop->type;
- }
-
- /*initialize a new bProperty of the specified type*/
- prop = new_property( type );
-
- /*parse data*/
- if( !py_prop ) {
- BLI_strncpy( prop->name, prop_name, 32 );
- if( PyInt_Check( prop_data ) ) {
- *( ( int * ) &prop->data ) =
- ( int ) PyInt_AsLong( prop_data );
- } else if( PyFloat_Check( prop_data ) ) {
- *( ( float * ) &prop->data ) =
- ( float ) PyFloat_AsDouble( prop_data );
- } else if( PyString_Check( prop_data ) ) {
- BLI_strncpy( prop->poin,
- PyString_AsString( prop_data ),
- MAX_PROPSTRING );
- }
- } else {
- py_prop->property = prop;
-
- /* this should never be able to happen is we just assigned a valid
- * proper to py_prop->property */
-
- if( !updateProperyData( py_prop ) ) {
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "Could not update property data" );
- }
- }
-
- /*add to property listbase for the object*/
- BLI_addtail( &self->object->prop, prop );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_removeProperty( BPy_Object * self, PyObject * args )
-{
- char *prop_name = NULL;
- BPy_Property *py_prop = NULL;
- bProperty *prop = NULL;
-
- /* we accept either a property stringname or actual object */
- if( PyTuple_Size( args ) == 1 ) {
- PyObject *prop = PyTuple_GET_ITEM( args, 0 );
- if( BPy_Property_Check( prop ) )
- py_prop = (BPy_Property *)prop;
- else
- prop_name = PyString_AsString( prop );
- }
- if( !py_prop && !prop_name )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a Property or a string" );
-
- /*remove the link, free the data, and update the py struct*/
- if( py_prop ) {
- BLI_remlink( &self->object->prop, py_prop->property );
- if( updatePyProperty( py_prop ) ) {
- free_property( py_prop->property );
- py_prop->property = NULL;
- }
- } else {
- prop = get_property( self->object, prop_name );
- if( prop ) {
- BLI_remlink( &self->object->prop, prop );
- free_property( prop );
- }
- }
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_removeAllProperties( BPy_Object * self )
-{
- free_properties( &self->object->prop );
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_copyAllPropertiesTo( BPy_Object * self,
- PyObject * args )
-{
- PyObject *dest;
- bProperty *prop = NULL;
- bProperty *propn = NULL;
-
- if( !PyArg_ParseTuple( args, "O!", &Object_Type, &dest ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected an Object" );
-
- /*make a copy of all its properties*/
- prop = self->object->prop.first;
- while( prop ) {
- propn = copy_property( prop );
- BLI_addtail( &( ( BPy_Object * ) dest )->object->prop, propn );
- prop = prop->next;
- }
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_addScriptLink( BPy_Object * self, PyObject * args )
-{
- Object *obj = self->object;
- ScriptLink *slink = &obj->scriptlink;
- return EXPP_addScriptLink( slink, args, 0 );
-}
-
-static PyObject *Object_clearScriptLinks( BPy_Object * self, PyObject * args )
-{
- Object *obj = self->object;
- ScriptLink *slink = &obj->scriptlink;
- return EXPP_clearScriptLinks( slink, args );
-}
-
-static PyObject *Object_getScriptLinks( BPy_Object * self, PyObject * value )
-{
- Object *obj = self->object;
- ScriptLink *slink = &obj->scriptlink;
- return EXPP_getScriptLinks( slink, value, 0 );
-}
-
-static PyObject *Object_getNLAflagBits ( BPy_Object * self )
-{
- if (self->object->nlaflag & OB_NLA_OVERRIDE)
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
-}
-
-static int Object_setNLAflagBits ( BPy_Object * self, PyObject * value )
-{
- int param;
-
- param = PyObject_IsTrue( value );
- if( param == -1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected True/False or 0/1" );
-
- if (param)
- self->object->nlaflag |= OB_NLA_OVERRIDE;
- else
- self->object->nlaflag &= ~OB_NLA_OVERRIDE;
-
- self->object->recalc |= OB_RECALC_OB;
-
- return 0;
-}
-
-static PyObject *Object_getDupliObjects( BPy_Object * self )
-{
- Object *ob= self->object;
-
- if(ob->transflag & OB_DUPLI) {
- /* before make duplis, update particle for current frame */
- if(ob->transflag & OB_DUPLIVERTS) {
- PartEff *paf= give_parteff(ob);
- if(paf) {
- if(paf->flag & PAF_ANIMATED) build_particle_system(ob);
- }
- }
- if(ob->type!=OB_MBALL) {
- PyObject *list;
- DupliObject *dupob;
- int index;
- ListBase *duplilist = object_duplilist(G.scene, ob);
-
- list = PyList_New( BLI_countlist(duplilist) );
- if( !list )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyList_New() failed" );
-
- for(dupob= duplilist->first, index=0; dupob; dupob= dupob->next, index++) {
- PyObject *pair;
- pair = PyTuple_New( 2 );
-
- PyTuple_SET_ITEM( pair, 0, Object_CreatePyObject(dupob->ob) );
- PyTuple_SET_ITEM( pair, 1, newMatrixObject((float*)dupob->mat,4,4,Py_NEW) );
- PyList_SET_ITEM( list, index, pair);
- }
- free_object_duplilist(duplilist);
- return list;
- }
- }
- return PyList_New( 0 );
-}
-
-static PyObject *Object_getDupliGroup( BPy_Object * self )
-{
- Object *ob= self->object;
-
- if( ob->dup_group )
- return Group_CreatePyObject( ob->dup_group );
-
- Py_RETURN_NONE;
-}
-
-static int Object_setDupliGroup( BPy_Object * self, PyObject * value )
-{
- return GenericLib_assignData(value, (void **) &self->object->dup_group, 0, 1, ID_GR, 0);
-}
-
-static PyObject *Object_getEffects( BPy_Object * self )
-{
- PyObject *effect_list, *pyval;
- Effect *eff;
-
- effect_list = PyList_New( 0 );
- if( !effect_list )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "PyList_New() failed" );
-
- eff = self->object->effect.first;
-
- while( eff ) {
- pyval = EffectCreatePyObject( eff, self->object );
- PyList_Append( effect_list, pyval );
- Py_DECREF(pyval);
- eff = eff->next;
- }
- return effect_list;
-}
-
-static PyObject *Object_getActionStrips( BPy_Object * self )
-{
- return ActionStrips_CreatePyObject( self->object );
-}
-
-static PyObject *Object_getConstraints( BPy_Object * self )
-{
- return ObConstraintSeq_CreatePyObject( self->object );
-}
-
-static PyObject *Object_getModifiers( BPy_Object * self )
-{
- return ModSeq_CreatePyObject( self->object, NULL );
-}
-
-static int Object_setModifiers( BPy_Object * self, PyObject * value )
-{
- BPy_ModSeq *pymodseq;
- ModifierData *md;
-
- if (!BPy_ModSeq_Check(value))
- return EXPP_ReturnIntError( PyExc_TypeError,
- "can only assign another objects modifiers" );
-
- pymodseq = ( BPy_ModSeq * ) value;
-
- if (self->object->type != pymodseq->object->type)
- return EXPP_ReturnIntError( PyExc_TypeError,
- "can only assign modifiers between objects of the same type" );
-
- if (self->object == pymodseq->object)
- return 0;
-
- object_free_modifiers(self->object);
- for (md=pymodseq->object->modifiers.first; md; md=md->next) {
- if (md->type!=eModifierType_Hook) {
- ModifierData *nmd = modifier_new(md->type);
- modifier_copyData(md, nmd);
- BLI_addtail(&self->object->modifiers, nmd);
- }
- }
-
- DAG_object_flush_update(G.scene, self->object, OB_RECALC_DATA);
- return 0;
-}
-
-static PyObject *Object_insertShapeKey(BPy_Object * self)
-{
- insert_shapekey(self->object);
- Py_RETURN_NONE;
-}
-
-/* __copy__() */
-static PyObject *Object_copy(BPy_Object * self)
-{
- /* copy_object never returns NULL */
- struct Object *object= copy_object( self->object );
- object->id.us= 0; /*is 1 by default, not sure why */
-
- /* Create a Python object from it. */
- return Object_CreatePyObject( object );
-}
-
-/*****************************************************************************/
-/* Function: Object_CreatePyObject */
-/* Description: This function will create a new BlenObject from an existing */
-/* Object structure. */
-/*****************************************************************************/
-PyObject *Object_CreatePyObject( struct Object * obj )
-{
- BPy_Object *blen_object;
-
- if( !obj ) Py_RETURN_NONE;
-
- blen_object =
- ( BPy_Object * ) PyObject_NEW( BPy_Object, &Object_Type );
-
- if( blen_object == NULL ) {
- return ( NULL );
- }
- blen_object->object = obj;
- blen_object->realtype = OB_EMPTY;
- obj->id.us++;
- return ( ( PyObject * ) blen_object );
-}
-
-/*****************************************************************************/
-/* Function: Object_FromPyObject */
-/* Description: This function returns the Blender object from the given */
-/* PyObject. */
-/*****************************************************************************/
-struct Object *Object_FromPyObject( PyObject * py_obj )
-{
- BPy_Object *blen_obj;
-
- blen_obj = ( BPy_Object * ) py_obj;
- return ( blen_obj->object );
-}
-
-/*****************************************************************************/
-/* Function: Object_dealloc */
-/* Description: This is a callback function for the BlenObject type. It is */
-/* the destructor function. */
-/*****************************************************************************/
-static void Object_dealloc( BPy_Object * self )
-{
- if( self->realtype != OB_EMPTY )
- free_libblock_us( &G.main->object, self->object );
- else
- self->object->id.us--;
-
-#if 0 /* this will adjust the ID and if zero delete the object */
- free_libblock_us( &G.main->object, self->object );
-#endif
- PyObject_DEL( self );
-}
-
-/*****************************************************************************/
-/* Function: Object_compare */
-/* Description: This is a callback function for the BPy_Object type. It */
-/* compares two Object_Type objects. Only the "==" and "!=" */
-/* comparisons are meaninful. Returns 0 for equality and -1 if */
-/* they don't point to the same Blender Object struct. */
-/* In Python it becomes 1 if they are equal, 0 otherwise. */
-/*****************************************************************************/
-static int Object_compare( BPy_Object * a, BPy_Object * b )
-{
- return ( a->object == b->object ) ? 0 : -1;
-}
-
-/*****************************************************************************/
-/* Function: Object_repr */
-/* Description: This is a callback function for the BPy_Object type. It */
-/* builds a meaninful string to represent object objects. */
-/*****************************************************************************/
-static PyObject *Object_repr( BPy_Object * self )
-{
- return PyString_FromFormat( "[Object \"%s\"]",
- self->object->id.name + 2 );
-}
-
-/* Particle Deflection functions */
-
-static PyObject *Object_getPIDeflection( BPy_Object * self )
-{
- if( !self->object->pd && !setupPI(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "particle deflection could not be accessed" );
-
- return PyBool_FromLong( ( long ) self->object->pd->deflect );
-}
-
-static int Object_setPIDeflection( BPy_Object * self, PyObject * value )
-{
- int param;
-
- if( !self->object->pd && !setupPI(self->object) )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "particle deflection could not be accessed" );
-
- param = PyObject_IsTrue( value );
- if( param == -1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected true/false argument" );
-
- self->object->pd->deflect = (short)param;
- self->object->recalc |= OB_RECALC_OB;
-
- return 0;
-}
-
-static PyObject *Object_getPIType( BPy_Object * self )
-{
- if( !self->object->pd && !setupPI(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "particle deflection could not be accessed" );
-
- return PyInt_FromLong( ( long )self->object->pd->forcefield );
-}
-
-static int Object_setPIType( BPy_Object * self, PyObject * value )
-{
- int status;
- int oldforcefield;
-
- if( !self->object->pd && !setupPI(self->object) )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "particle deflection could not be accessed" );
-
- oldforcefield = self->object->pd->forcefield;
- status = EXPP_setIValueRange( value, &self->object->pd->forcefield,
- PFIELD_FORCE, PFIELD_GUIDE, 'h' );
-
- /*
- * if value was set successfully but is PFIELD_MAGNET, restore the old
- * value and throw exception
- */
- if( !status ) {
- if ( self->object->pd->forcefield == PFIELD_MAGNET ) {
- self->object->pd->forcefield = oldforcefield;
- return EXPP_ReturnIntError( PyExc_ValueError,
- "PFIELD_MAGNET not supported" );
- }
- self->object->recalc |= OB_RECALC_OB;
- }
- return status;
-}
-
-static PyObject *Object_getPIUseMaxDist( BPy_Object * self )
-{
- if( !self->object->pd && !setupPI(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "particle deflection could not be accessed" );
-
- return PyBool_FromLong( ( long )self->object->pd->flag );
-}
-
-static int Object_setPIUseMaxDist( BPy_Object * self, PyObject * value )
-{
- int param;
-
- if( !self->object->pd && !setupPI(self->object) )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "particle deflection could not be accessed" );
-
- param = PyObject_IsTrue( value );
- if( param == -1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected true/false argument" );
-
- self->object->pd->flag = (short)param;
- self->object->recalc |= OB_RECALC_OB;
-
- return 0;
-}
-
-/* RIGIDBODY FUNCTIONS */
-
-static PyObject *Object_getRBMass( BPy_Object * self )
-{
- return PyFloat_FromDouble( (double)self->object->mass );
-}
-
-static int Object_setRBMass( BPy_Object * self, PyObject * args )
-{
- float value;
- PyObject* flt = PyNumber_Float( args );
-
- if( !flt )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected float argument" );
- value = (float)PyFloat_AS_DOUBLE( flt );
- Py_DECREF( flt );
-
- if( value < 0.0f )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "acceptable values are non-negative, 0.0 or more" );
-
- self->object->mass = value;
- self->object->recalc |= OB_RECALC_OB;
-
- return 0;
-}
-
-/* this is too low level, possible to add helper methods */
-
-#define GAMEFLAG_MASK ( OB_DYNAMIC | OB_CHILD | OB_ACTOR | OB_DO_FH | \
- OB_ROT_FH | OB_ANISOTROPIC_FRICTION | OB_GHOST | OB_RIGID_BODY | \
- OB_BOUNDS | OB_COLLISION_RESPONSE | OB_SECTOR | OB_PROP | \
- OB_MAINACTOR )
-
-static PyObject *Object_getRBFlags( BPy_Object * self )
-{
- return PyInt_FromLong( (long)( self->object->gameflag & GAMEFLAG_MASK ) );
-}
-
-static int Object_setRBFlags( BPy_Object * self, PyObject * args )
-{
- PyObject* integer = PyNumber_Int( args );
- int value;
-
- if( !integer )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected integer argument" );
-
- value = ( int )PyInt_AS_LONG( integer );
- Py_DECREF( integer );
- if( value & ~GAMEFLAG_MASK )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "undefined bit(s) set in bitfield" );
-
- self->object->gameflag = value;
- self->object->recalc |= OB_RECALC_OB;
-
- return 0;
-}
-
-static PyObject *Object_getRBShapeBoundType( BPy_Object * self )
-{
- return PyInt_FromLong( (long)self->object->boundtype );
-}
-
-static int Object_setRBShapeBoundType( BPy_Object * self, PyObject * args )
-{
- self->object->recalc |= OB_RECALC_OB;
- return EXPP_setIValueRange( args, &self->object->boundtype,
- 0, OB_BOUND_DYN_MESH, 'h' );
-}
-
-/* SOFTBODY FUNCTIONS */
-
-PyObject *Object_isSB(BPy_Object *self)
-{
- if( self->object->soft )
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
-}
-
-static PyObject *Object_getSBUseGoal( BPy_Object * self )
-{
- if( !self->object->soft && !setupSB(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "softbody could not be accessed" );
-
- if( self->object->softflag & OB_SB_GOAL )
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
-}
-
-static int Object_setSBUseGoal( BPy_Object * self, PyObject * value )
-{
- int setting = PyObject_IsTrue( value );
-
- if( !self->object->soft && !setupSB(self->object) )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "softbody could not be accessed" );
-
- if( setting == -1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected true/false argument" );
-
- if( setting )
- self->object->softflag |= OB_SB_GOAL;
- else
- self->object->softflag &= ~OB_SB_GOAL;
-
- self->object->recalc |= OB_RECALC_OB;
- return 0;
-}
-
-static PyObject *Object_getSBUseEdges( BPy_Object * self )
-{
- if( !self->object->soft && !setupSB(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "softbody could not be accessed" );
-
- if( self->object->softflag & OB_SB_EDGES )
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
-}
-
-static int Object_setSBUseEdges( BPy_Object * self, PyObject * value )
-{
- int setting = PyObject_IsTrue( value );
-
- if( !self->object->soft && !setupSB(self->object) )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "softbody could not be accessed" );
-
- if( setting == -1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected true/false argument" );
-
- if( setting )
- self->object->softflag |= OB_SB_EDGES;
- else
- self->object->softflag &= ~OB_SB_EDGES;
-
- self->object->recalc |= OB_RECALC_OB;
- return 0;
-}
-
-static PyObject *Object_getSBStiffQuads( BPy_Object * self )
-{
- if( !self->object->soft && !setupSB(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "softbody could not be accessed" );
-
- if( self->object->softflag & OB_SB_QUADS )
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
-}
-
-static int Object_setSBStiffQuads( BPy_Object * self, PyObject * value )
-{
- int setting = PyObject_IsTrue( value );
-
- if( !self->object->soft && !setupSB(self->object) )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "softbody could not be accessed" );
-
- if( setting == -1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected true/false argument" );
-
- if( setting )
- self->object->softflag |= OB_SB_QUADS;
- else
- self->object->softflag &= ~OB_SB_QUADS;
-
- self->object->recalc |= OB_RECALC_OB;
- return 0;
-}
-
-static int setupSB( Object* ob )
-{
- ob->soft= sbNew();
- ob->softflag |= OB_SB_GOAL|OB_SB_EDGES;
-
- if( !ob->soft )
- return 0;
- /* all this is initialized in sbNew() */
-#if 0
- ob->soft->mediafrict = 0.5f;
- ob->soft->nodemass = 1.0f;
- ob->soft->grav = 0.0f;
- ob->soft->rklimit = 0.1f;
-
- ob->soft->goalspring = 0.5f;
- ob->soft->goalfrict = 0.0f;
- ob->soft->mingoal = 0.0f;
- ob->soft->maxgoal = 1.0f;
- ob->soft->defgoal = 0.7f;
-
- ob->soft->inspring = 0.5f;
- ob->soft->infrict = 0.5f;
-#endif
- return 1;
-}
-
-static int setupPI( Object* ob )
-{
- if( ob->pd==NULL ) {
- ob->pd= MEM_callocN(sizeof(PartDeflect), "PartDeflect");
- /* and if needed, init here */
- }
-
- if( !ob->pd )
- return 0;
-
- ob->pd->deflect =0;
- ob->pd->forcefield =0;
- ob->pd->flag =0;
- ob->pd->pdef_damp =0;
- ob->pd->pdef_rdamp =0;
- ob->pd->pdef_perm =0;
- ob->pd->f_strength =0;
- ob->pd->f_power =0;
- ob->pd->maxdist =0;
- return 1;
-}
-
-/*
- * scan list of Objects looking for matching obdata.
- * if found, set OB_RECALC_DATA flag.
- * call this from a bpy type update() method.
- */
-
-void Object_updateDag( void *data )
-{
- Object *ob;
-
- if( !data )
- return;
-
- for( ob = G.main->object.first; ob; ob= ob->id.next ){
- if( ob->data == data ) {
- ob->recalc |= OB_RECALC_DATA;
- }
- }
-}
-
-/*
- * utilities routines for handling generic getters and setters
- */
-
-/*
- * get integer attributes
- */
-
-static PyObject *getIntAttr( BPy_Object *self, void *type )
-{
- int param;
- struct Object *object = self->object;
-
- switch( (int)type ) {
- case EXPP_OBJ_ATTR_LAYERMASK:
- param = object->lay;
- break;
- case EXPP_OBJ_ATTR_COLBITS:
- param = object->colbits;
- if( param < 0 ) param += 65536;
- break;
- case EXPP_OBJ_ATTR_DRAWMODE:
- param = object->dtx;
- break;
- case EXPP_OBJ_ATTR_DRAWTYPE:
- param = object->dt;
- break;
- case EXPP_OBJ_ATTR_PARENT_TYPE:
- param = object->partype;
- break;
- case EXPP_OBJ_ATTR_DUPON:
- param = object->dupon;
- break;
- case EXPP_OBJ_ATTR_DUPOFF:
- param = object->dupoff;
- break;
- case EXPP_OBJ_ATTR_DUPSTA:
- param = object->dupsta;
- break;
- case EXPP_OBJ_ATTR_DUPEND:
- param = object->dupend;
- break;
- case EXPP_OBJ_ATTR_PASSINDEX:
- param = object->index;
- break;
- case EXPP_OBJ_ATTR_ACT_MATERIAL:
- param = object->actcol;
- break;
- case EXPP_OBJ_ATTR_ACT_SHAPE:
- param = object->shapenr;
- break;
- default:
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "undefined type in getIntAttr" );
- }
-
- return PyInt_FromLong( param );
-}
-
-/*
- * set integer attributes which require clamping
- */
-
-static int setIntAttrClamp( BPy_Object *self, PyObject *value, void *type )
-{
- void *param;
- struct Object *object = self->object;
- int min, max, size;
-
- switch( (int)type ) {
- case EXPP_OBJ_ATTR_DUPON:
- min = 1;
- max = 1500;
- size = 'H'; /* in case max is later made > 32767 */
- param = (void *)&object->dupon;
- break;
- case EXPP_OBJ_ATTR_DUPOFF:
- min = 0;
- max = 1500;
- size = 'H'; /* in case max is later made > 32767 */
- param = (void *)&object->dupoff;
- break;
- case EXPP_OBJ_ATTR_DUPSTA:
- min = 1;
- max = 32767;
- size = 'H'; /* in case max is later made > 32767 */
- param = (void *)&object->dupsta;
- break;
- case EXPP_OBJ_ATTR_DUPEND:
- min = 1;
- max = 32767;
- size = 'H'; /* in case max is later made > 32767 */
- param = (void *)&object->dupend;
- break;
- case EXPP_OBJ_ATTR_PASSINDEX:
- min = 0;
- max = 1000;
- size = 'H'; /* in case max is later made > 32767 */
- param = (void *)&object->index;
- break;
- case EXPP_OBJ_ATTR_ACT_MATERIAL:
- min = 1;
- max = object->totcol;
- size = 'b'; /* in case max is later made > 128 */
- param = (void *)&object->actcol;
- break;
- case EXPP_OBJ_ATTR_ACT_SHAPE:
- {
- Key *key= ob_get_key(object);
- KeyBlock *kb;
- min = 1;
- max = 0;
- if (key) {
- max= 1;
- for (kb = key->block.first; kb; kb=kb->next, max++);
- }
- size = 'h'; /* in case max is later made > 128 */
- param = (void *)&object->shapenr;
- break;
- }
- default:
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "undefined type in setIntAttrClamp");
- }
-
- self->object->recalc |= OB_RECALC_OB;
- return EXPP_setIValueClamped( value, param, min, max, size );
-}
-
-/*
- * set integer attributes which require range checking
- */
-
-static int setIntAttrRange( BPy_Object *self, PyObject *value, void *type )
-{
- void *param;
- struct Object *object = self->object;
- int min, max, size;
-
- if( !PyInt_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected integer argument" );
-
- /* these parameters require clamping */
-
- switch( (int)type ) {
- case EXPP_OBJ_ATTR_COLBITS:
- min = 0;
- max = 0xffff;
- size = 'H';
- param = (void *)&object->colbits;
- break;
- default:
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "undefined type in setIntAttrRange" );
- }
-
- self->object->recalc |= OB_RECALC_OB;
- return EXPP_setIValueRange( value, param, min, max, size );
-}
-
-/*
- * get floating point attributes
- */
-
-static PyObject *getFloatAttr( BPy_Object *self, void *type )
-{
- float param;
- struct Object *object = self->object;
-
- if( (int)type >= EXPP_OBJ_ATTR_PI_SURFACEDAMP &&
- (int)type <= EXPP_OBJ_ATTR_PI_SBOFACETHICK ) {
- if( !self->object->pd && !setupPI(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "particle deflection could not be accessed" );
- }
- else if( (int)type >= EXPP_OBJ_ATTR_SB_NODEMASS &&
- (int)type <= EXPP_OBJ_ATTR_SB_INFRICT ) {
- if( !self->object->soft && !setupSB(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "softbody could not be accessed" );
- }
-
- switch( (int)type ) {
- case EXPP_OBJ_ATTR_LOC_X:
- param = object->loc[0];
- break;
- case EXPP_OBJ_ATTR_LOC_Y:
- param = object->loc[1];
- break;
- case EXPP_OBJ_ATTR_LOC_Z:
- param = object->loc[2];
- break;
- case EXPP_OBJ_ATTR_DLOC_X:
- param = object->dloc[0];
- break;
- case EXPP_OBJ_ATTR_DLOC_Y:
- param = object->dloc[1];
- break;
- case EXPP_OBJ_ATTR_DLOC_Z:
- param = object->dloc[2];
- break;
- case EXPP_OBJ_ATTR_ROT_X:
- param = object->rot[0];
- break;
- case EXPP_OBJ_ATTR_ROT_Y:
- param = object->rot[1];
- break;
- case EXPP_OBJ_ATTR_ROT_Z:
- param = object->rot[2];
- break;
- case EXPP_OBJ_ATTR_DROT_X:
- param = object->drot[0];
- break;
- case EXPP_OBJ_ATTR_DROT_Y:
- param = object->drot[1];
- break;
- case EXPP_OBJ_ATTR_DROT_Z:
- param = object->drot[2];
- break;
- case EXPP_OBJ_ATTR_SIZE_X:
- param = object->size[0];
- break;
- case EXPP_OBJ_ATTR_SIZE_Y:
- param = object->size[1];
- break;
- case EXPP_OBJ_ATTR_SIZE_Z:
- param = object->size[2];
- break;
- case EXPP_OBJ_ATTR_DSIZE_X:
- param = object->dsize[0];
- break;
- case EXPP_OBJ_ATTR_DSIZE_Y:
- param = object->dsize[1];
- break;
- case EXPP_OBJ_ATTR_DSIZE_Z:
- param = object->dsize[2];
- break;
- case EXPP_OBJ_ATTR_TIMEOFFSET:
- param = object->sf;
- break;
- case EXPP_OBJ_ATTR_DRAWSIZE:
- param = object->empty_drawsize;
- break;
- case EXPP_OBJ_ATTR_PI_SURFACEDAMP:
- param = object->pd->pdef_perm;
- break;
- case EXPP_OBJ_ATTR_PI_RANDOMDAMP:
- param = object->pd->pdef_rdamp;
- break;
- case EXPP_OBJ_ATTR_PI_PERM:
- param = object->pd->pdef_perm;
- break;
- case EXPP_OBJ_ATTR_PI_STRENGTH:
- param = object->pd->f_strength;
- break;
- case EXPP_OBJ_ATTR_PI_FALLOFF:
- param = object->pd->f_power;
- break;
- case EXPP_OBJ_ATTR_PI_MAXDIST:
- param = object->pd->maxdist;
- break;
- case EXPP_OBJ_ATTR_PI_SBDAMP:
- param = object->pd->pdef_sbdamp;
- break;
- case EXPP_OBJ_ATTR_PI_SBIFACETHICK:
- param = object->pd->pdef_sbift;
- break;
- case EXPP_OBJ_ATTR_PI_SBOFACETHICK:
- param = object->pd->pdef_sboft;
- break;
- case EXPP_OBJ_ATTR_SB_NODEMASS:
- param = self->object->soft->nodemass;
- break;
- case EXPP_OBJ_ATTR_SB_GRAV:
- param = self->object->soft->grav;
- break;
- case EXPP_OBJ_ATTR_SB_MEDIAFRICT:
- param = self->object->soft->mediafrict;
- break;
- case EXPP_OBJ_ATTR_SB_RKLIMIT:
- param = object->soft->rklimit;
- break;
- case EXPP_OBJ_ATTR_SB_PHYSICSSPEED:
- param = object->soft->physics_speed;
- break;
- case EXPP_OBJ_ATTR_SB_GOALSPRING:
- param = object->soft->goalspring;
- break;
- case EXPP_OBJ_ATTR_SB_GOALFRICT:
- param = object->soft->goalfrict;
- break;
- case EXPP_OBJ_ATTR_SB_MINGOAL:
- param = object->soft->mingoal;
- break;
- case EXPP_OBJ_ATTR_SB_MAXGOAL:
- param = object->soft->maxgoal;
- break;
- case EXPP_OBJ_ATTR_SB_DEFGOAL:
- param = object->soft->defgoal;
- break;
- case EXPP_OBJ_ATTR_SB_INSPRING:
- param = object->soft->inspring;
- break;
- case EXPP_OBJ_ATTR_SB_INFRICT:
- param = object->soft->infrict;
- break;
- case EXPP_OBJ_ATTR_DUPFACESCALEFAC:
- param = object->dupfacesca;
- break;
- default:
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "undefined type in getFloatAttr" );
- }
-
- return PyFloat_FromDouble( param );
-}
-
-/*
- * set floating point attributes which require clamping
- */
-
-static int setFloatAttrClamp( BPy_Object *self, PyObject *value, void *type )
-{
- float *param;
- struct Object *object = self->object;
- float min, max;
-
- if( (int)type >= EXPP_OBJ_ATTR_PI_SURFACEDAMP &&
- (int)type <= EXPP_OBJ_ATTR_PI_SBOFACETHICK ) {
- if( !self->object->pd && !setupPI(self->object) )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "particle deflection could not be accessed" );
- }
- else if( (int)type >= EXPP_OBJ_ATTR_SB_NODEMASS &&
- (int)type <= EXPP_OBJ_ATTR_SB_INFRICT ) {
- if( !self->object->soft && !setupSB(self->object) )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "softbody could not be accessed" );
- }
-
- switch( (int)type ) {
- case EXPP_OBJ_ATTR_DRAWSIZE:
- min = EXPP_OBJECT_DRAWSIZEMIN;
- max = EXPP_OBJECT_DRAWSIZEMAX;
- param = &object->empty_drawsize;
- break;
- case EXPP_OBJ_ATTR_TIMEOFFSET:
- min = -MAXFRAMEF;
- max = MAXFRAMEF;
- param = &object->sf;
- break;
- case EXPP_OBJ_ATTR_PI_SURFACEDAMP:
- min = EXPP_OBJECT_PIDAMP_MIN;
- max = EXPP_OBJECT_PIDAMP_MAX;
- param = &object->pd->pdef_perm;
- break;
- case EXPP_OBJ_ATTR_PI_RANDOMDAMP:
- min = EXPP_OBJECT_PIRDAMP_MIN;
- max = EXPP_OBJECT_PIRDAMP_MAX;
- param = &object->pd->pdef_rdamp;
- break;
- case EXPP_OBJ_ATTR_PI_PERM:
- min = EXPP_OBJECT_PIPERM_MIN;
- max = EXPP_OBJECT_PIPERM_MAX;
- param = &object->pd->pdef_perm;
- break;
- case EXPP_OBJ_ATTR_PI_STRENGTH:
- min = EXPP_OBJECT_PISTRENGTH_MIN;
- max = EXPP_OBJECT_PISTRENGTH_MAX;
- param = &object->pd->f_strength;
- break;
- case EXPP_OBJ_ATTR_PI_FALLOFF:
- min = EXPP_OBJECT_PIPOWER_MIN;
- max = EXPP_OBJECT_PIPOWER_MAX;
- param = &object->pd->f_power;
- break;
- case EXPP_OBJ_ATTR_PI_MAXDIST:
- min = EXPP_OBJECT_PIMAXDIST_MIN;
- max = EXPP_OBJECT_PIMAXDIST_MAX;
- param = &object->pd->maxdist;
- break;
- case EXPP_OBJ_ATTR_PI_SBDAMP:
- min = EXPP_OBJECT_PISBDAMP_MIN;
- max = EXPP_OBJECT_PISBDAMP_MAX;
- param = &object->pd->pdef_sbdamp;
- break;
- case EXPP_OBJ_ATTR_PI_SBIFACETHICK:
- min = EXPP_OBJECT_PISBIFTMIN;
- max = EXPP_OBJECT_PISBIFTMAX;
- param = &object->pd->pdef_sbift;
- break;
- case EXPP_OBJ_ATTR_PI_SBOFACETHICK:
- min = EXPP_OBJECT_PISBOFTMIN;
- max = EXPP_OBJECT_PISBOFTMAX;
- param = &object->pd->pdef_sboft;
- break;
- case EXPP_OBJ_ATTR_SB_NODEMASS:
- min = EXPP_OBJECT_SBNODEMASSMIN;
- max = EXPP_OBJECT_SBNODEMASSMAX;
- param = &self->object->soft->nodemass;
- break;
- case EXPP_OBJ_ATTR_SB_GRAV:
- min = EXPP_OBJECT_SBGRAVMIN;
- max = EXPP_OBJECT_SBGRAVMAX;
- param = &self->object->soft->grav;
- break;
- case EXPP_OBJ_ATTR_SB_MEDIAFRICT:
- min = EXPP_OBJECT_SBMEDIAFRICTMIN;
- max = EXPP_OBJECT_SBMEDIAFRICTMAX;
- param = &self->object->soft->mediafrict;
- break;
- case EXPP_OBJ_ATTR_SB_RKLIMIT:
- min = EXPP_OBJECT_SBRKLIMITMIN;
- max = EXPP_OBJECT_SBRKLIMITMAX;
- param = &self->object->soft->rklimit;
- break;
- case EXPP_OBJ_ATTR_SB_PHYSICSSPEED:
- min = EXPP_OBJECT_SBPHYSICSSPEEDMIN;
- max = EXPP_OBJECT_SBPHYSICSSPEEDMAX;
- param = &self->object->soft->physics_speed;
- break;
- case EXPP_OBJ_ATTR_SB_GOALSPRING:
- min = EXPP_OBJECT_SBGOALSPRINGMIN;
- max = EXPP_OBJECT_SBGOALSPRINGMAX;
- param = &self->object->soft->goalspring;
- break;
- case EXPP_OBJ_ATTR_SB_GOALFRICT:
- min = EXPP_OBJECT_SBGOALFRICTMIN;
- max = EXPP_OBJECT_SBGOALFRICTMAX;
- param = &self->object->soft->goalfrict;
- break;
- case EXPP_OBJ_ATTR_SB_MINGOAL:
- min = EXPP_OBJECT_SBMINGOALMIN;
- max = EXPP_OBJECT_SBMINGOALMAX;
- param = &self->object->soft->mingoal;
- break;
- case EXPP_OBJ_ATTR_SB_MAXGOAL:
- min = EXPP_OBJECT_SBMAXGOALMIN;
- max = EXPP_OBJECT_SBMAXGOALMAX;
- param = &self->object->soft->maxgoal;
- break;
- case EXPP_OBJ_ATTR_SB_DEFGOAL:
- min = EXPP_OBJECT_SBDEFGOALMIN;
- max = EXPP_OBJECT_SBDEFGOALMAX;
- param = &self->object->soft->defgoal;
- break;
- case EXPP_OBJ_ATTR_SB_INSPRING:
- min = EXPP_OBJECT_SBINSPRINGMIN;
- max = EXPP_OBJECT_SBINSPRINGMAX;
- param = &self->object->soft->inspring;
- break;
- case EXPP_OBJ_ATTR_SB_INFRICT:
- min = EXPP_OBJECT_SBINFRICTMIN;
- max = EXPP_OBJECT_SBINFRICTMAX;
- param = &self->object->soft->infrict;
- break;
- case EXPP_OBJ_ATTR_DUPFACESCALEFAC:
- min = EXPP_OBJECT_DUPFACESCALEFACMIN;
- max = EXPP_OBJECT_DUPFACESCALEFACMAX;
- param = &self->object->dupfacesca;
- break;
-
- default:
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "undefined type in setFloatAttrClamp" );
- }
-
- self->object->recalc |= OB_RECALC_OB;
- return EXPP_setFloatClamped( value, param, min, max );
-}
-
-/*
- * set floating point attributes
- */
-
-static int setFloatAttr( BPy_Object *self, PyObject *value, void *type )
-{
- float param;
- struct Object *object = self->object;
-
- if( !PyNumber_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected float argument" );
-
- param = (float)PyFloat_AsDouble( value );
-
- switch( (int)type ) {
- case EXPP_OBJ_ATTR_LOC_X:
- object->loc[0] = param;
- break;
- case EXPP_OBJ_ATTR_LOC_Y:
- object->loc[1] = param;
- break;
- case EXPP_OBJ_ATTR_LOC_Z:
- object->loc[2] = param;
- break;
- case EXPP_OBJ_ATTR_DLOC_X:
- object->dloc[0] = param;
- break;
- case EXPP_OBJ_ATTR_DLOC_Y:
- object->dloc[1] = param;
- break;
- case EXPP_OBJ_ATTR_DLOC_Z:
- object->dloc[2] = param;
- break;
- case EXPP_OBJ_ATTR_ROT_X:
- object->rot[0] = param;
- break;
- case EXPP_OBJ_ATTR_ROT_Y:
- object->rot[1] = param;
- break;
- case EXPP_OBJ_ATTR_ROT_Z:
- object->rot[2] = param;
- break;
- case EXPP_OBJ_ATTR_DROT_X:
- object->drot[0] = param;
- break;
- case EXPP_OBJ_ATTR_DROT_Y:
- object->drot[1] = param;
- break;
- case EXPP_OBJ_ATTR_DROT_Z:
- object->drot[2] = param;
- break;
- case EXPP_OBJ_ATTR_SIZE_X:
- object->size[0] = param;
- break;
- case EXPP_OBJ_ATTR_SIZE_Y:
- object->size[1] = param;
- break;
- case EXPP_OBJ_ATTR_SIZE_Z:
- object->size[2] = param;
- break;
- case EXPP_OBJ_ATTR_DSIZE_X:
- object->dsize[0] = param;
- break;
- case EXPP_OBJ_ATTR_DSIZE_Y:
- object->dsize[1] = param;
- break;
- case EXPP_OBJ_ATTR_DSIZE_Z:
- object->dsize[2] = param;
- break;
- default:
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "undefined type in setFloatAttr " );
- }
- self->object->recalc |= OB_RECALC_OB;
- return 0;
-}
-
-/*
- * get 3-tuple floating point attributes
- */
-
-static PyObject *getFloat3Attr( BPy_Object *self, void *type )
-{
- float *param;
- struct Object *object = self->object;
-
- switch( (int)type ) {
- case EXPP_OBJ_ATTR_LOC:
- param = object->loc;
- break;
- case EXPP_OBJ_ATTR_DLOC:
- param = object->dloc;
- break;
- case EXPP_OBJ_ATTR_DROT:
- param = object->drot;
- break;
- case EXPP_OBJ_ATTR_SIZE:
- param = object->size;
- break;
- case EXPP_OBJ_ATTR_DSIZE:
- param = object->dsize;
- break;
- default:
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "undefined type in getFloat3Attr" );
- }
-
- return Py_BuildValue( "(fff)", param[0], param[1], param[2] );
-}
-
-/*
- * set 3-tuple floating point attributes
- */
-
-static int setFloat3Attr( BPy_Object *self, PyObject *value, void *type )
-{
- int i;
- float *dst, param[3];
- struct Object *object = self->object;
-
- value = PySequence_Tuple( value );
-
- if( !value || !PyArg_ParseTuple( value, "fff", &param[0], &param[1], &param[2] ) ) {
- Py_XDECREF( value );
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a list or tuple of 3 floats" );
- }
-
- Py_DECREF( value );
- switch( (int)type ) {
- case EXPP_OBJ_ATTR_LOC:
- dst = object->loc;
- break;
- case EXPP_OBJ_ATTR_DLOC:
- dst = object->dloc;
- break;
- case EXPP_OBJ_ATTR_DROT:
- dst = object->drot;
- break;
- case EXPP_OBJ_ATTR_SIZE:
- dst = object->size;
- break;
- case EXPP_OBJ_ATTR_DSIZE:
- dst = object->dsize;
- break;
- default:
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "undefined type in setFloat3Attr" );
- }
-
- for( i = 0; i < 3; ++i )
- dst[i] = param[i];
-
- self->object->recalc |= OB_RECALC_OB;
- return 0;
-}
-
-/*****************************************************************************/
-/* BPy_Object methods and attribute handlers */
-/*****************************************************************************/
-
-static PyObject *Object_getShapeFlag( BPy_Object *self, void *type )
-{
- if (self->object->shapeflag & (int)type)
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
-}
-
-static int Object_setShapeFlag( BPy_Object *self, PyObject *value,
- void *type )
-{
- if (PyObject_IsTrue(value) )
- self->object->shapeflag |= (int)type;
- else
- self->object->shapeflag &= ~(int)type;
-
- self->object->recalc |= OB_RECALC_OB;
- return 0;
-}
-
-static PyObject *Object_getRestricted( BPy_Object *self, void *type )
-{
- if (self->object->restrictflag & (int)type)
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
-}
-
-static int Object_setRestricted( BPy_Object *self, PyObject *value,
- void *type )
-{
- int param = PyObject_IsTrue( value );
- if( param == -1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected True/False or 0/1" );
-
- if ( param )
- self->object->restrictflag |= (int)type;
- else
- self->object->restrictflag &= ~(int)type;
-
- return 0;
-}
-
-static PyObject *Object_getDrawModeBits( BPy_Object *self, void *type )
-{
- return EXPP_getBitfield( (void *)&self->object->dtx, (int)type, 'b' );
-}
-
-static int Object_setDrawModeBits( BPy_Object *self, PyObject *value,
- void *type )
-{
- self->object->recalc |= OB_RECALC_OB;
- return EXPP_setBitfield( value, (void *)&self->object->dtx,
- (int)type, 'b' );
-}
-
-static PyObject *Object_getTransflagBits( BPy_Object *self, void *type )
-{
- return EXPP_getBitfield( (void *)&self->object->transflag,
- (int)type, 'h' );
-}
-
-static int Object_setTransflagBits( BPy_Object *self, PyObject *value,
- void *type )
-{
- self->object->recalc |= OB_RECALC_OB;
- return EXPP_setBitfield( value, (void *)&self->object->transflag,
- (int)type, 'h' );
-}
-
-static PyObject *Object_getLayers( BPy_Object * self )
-{
- int layers, bit;
- PyObject *laylist = PyList_New( 0 );
-
- if( !laylist )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "PyList_New() failed" );
-
- layers = self->object->lay & 0xfffff; /* get layer bitmask */
-
- /*
- * starting with the first layer, and until there are no more layers,
- * find which layers are visible
- */
-
- for( bit = 1; layers; ++bit ) {
- if( layers & 1 ) { /* if layer is visible, add to list */
- PyObject *item = PyInt_FromLong( bit );
- PyList_Append( laylist, item );
- Py_DECREF( item );
- }
- layers >>= 1; /* go to the next layer */
- }
- return laylist;
-}
-
-/*
- * usage note: caller of this func needs to do a Blender.Redraw(-1)
- * to update and redraw the interface
- */
-
-static int Object_setLayers( BPy_Object * self, PyObject *value )
-{
- int layers = 0, val, i, len_list, local;
- Base *base;
-
- if( !PyList_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a list of integers in the range [1, 20]" );
-
- len_list = PyList_Size( value );
-
- /* build a bitmask, check for values outside of range */
-
- for( i = 0; i < len_list; i++ ) {
- PyObject* integer = PyNumber_Int( PyList_GetItem( value, i ) );
- val = PyInt_AsLong( integer );
- Py_XDECREF( integer );
- if( !integer )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "list must contain only integer numbers" );
- if( val < 1 || val > 20 )
- return EXPP_ReturnIntError ( PyExc_ValueError,
- "layer values must be in the range [1, 20]" );
- layers |= 1 << ( val - 1 );
- }
-
- /* do this, to ensure layers are set for objects not in current scene */
- self->object->lay= layers;
-
- /* update any bases pointing to our object */
- base = FIRSTBASE; /* first base in current scene */
- while( base ) {
- if( base->object == self->object ) {
- base->lay &= 0xFFF00000;
- local = base->lay;
- base->lay = local | layers;
- self->object->lay = base->lay;
- break;
- }
- base = base->next;
- }
-
- /* these to calls here are overkill! (ton) */
- if (base) { /* The object was found? */
- countall();
- DAG_scene_sort( G.scene );
- }
- return 0;
-}
-
-static int Object_setLayersMask( BPy_Object *self, PyObject *value )
-{
- int layers = 0, local;
- Base *base;
-
- if( !PyInt_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected an integer (bitmask) as argument" );
-
- layers = PyInt_AS_LONG( value );
-
- /* make sure some bits are set, and only those bits are set */
-
- if( !( layers & 0xFFFFF ) || ( layers & 0xFFF00000 ) )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "bitmask must have between 1 and 20 bits set" );
-
- /* update any bases pointing to our object */
-
- base = FIRSTBASE; /* first base in current scene */
- while( base ) {
- if( base->object == self->object ) {
- base->lay &= 0xFFF00000;
- local = base->lay;
- base->lay = local | layers;
- self->object->lay = base->lay;
- break;
- }
- base = base->next;
- }
- if (base) { /* The object was found? */
- countall();
- DAG_scene_sort( G.scene );
- }
- return 0;
-}
-
-/*
- * this should accept a Py_None argument and just delete the Ipo link
- * (as Object_clearIpo() does)
- */
-
-static int Object_setIpo( BPy_Object * self, PyObject * value )
-{
- return GenericLib_assignData(value, (void **) &self->object->ipo, 0, 1, ID_IP, ID_OB);
-}
-
-static int Object_setTracked( BPy_Object * self, PyObject * value )
-{
- int ret;
- ret = GenericLib_assignData(value, (void **) &self->object->track, 0, 0, ID_OB, 0);
- if (ret==0) {
- self->object->recalc |= OB_RECALC_OB;
- DAG_scene_sort( G.scene );
- }
- return ret;
-}
-
-/* Localspace matrix */
-
-static PyObject *Object_getMatrixLocal( BPy_Object * self )
-{
- if( self->object->parent ) {
- float matrix[4][4]; /* for the result */
- float invmat[4][4]; /* for inverse of parent's matrix */
-
- Mat4Invert(invmat, self->object->parent->obmat );
- Mat4MulMat4(matrix, self->object->obmat, invmat);
- return newMatrixObject((float*)matrix,4,4,Py_NEW);
- } else { /* no parent, so return world space matrix */
- disable_where_script( 1 );
- where_is_object( self->object );
- disable_where_script( 0 );
- return newMatrixObject((float*)self->object->obmat,4,4,Py_WRAP);
- }
-}
-
-/* Worldspace matrix */
-
-static PyObject *Object_getMatrixWorld( BPy_Object * self )
-{
- disable_where_script( 1 );
- where_is_object( self->object );
- disable_where_script( 0 );
- return newMatrixObject((float*)self->object->obmat,4,4,Py_WRAP);
-}
-
-/* Parent Inverse matrix */
-
-static PyObject *Object_getMatrixParentInverse( BPy_Object * self )
-{
- return newMatrixObject((float*)self->object->parentinv,4,4,Py_WRAP);
-}
-
-/*
- * Old behavior, prior to Blender 2.34, where eventual changes made by the
- * script itself were not taken into account until a redraw happened, either
- * called by the script or upon its exit.
- */
-
-static PyObject *Object_getMatrixOldWorld( BPy_Object * self )
-{
- return newMatrixObject((float*)self->object->obmat,4,4,Py_WRAP);
-}
-
-/*
- * get one of three different matrix representations
- */
-
-static PyObject *Object_getMatrix( BPy_Object * self, PyObject * args )
-{
- char *space = "worldspace"; /* default to world */
- char *errstr = "expected nothing, 'worldspace' (default), 'localspace' or 'old_worldspace'";
-
- if( !PyArg_ParseTuple( args, "|s", &space ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError, errstr );
-
- if( BLI_streq( space, "worldspace" ) )
- return Object_getMatrixWorld( self );
- else if( BLI_streq( space, "localspace" ) )
- return Object_getMatrixLocal( self );
- else if( BLI_streq( space, "old_worldspace" ) )
- return Object_getMatrixOldWorld( self );
- else
- return EXPP_ReturnPyObjError( PyExc_ValueError, errstr );
-}
-
-static PyObject *get_obj_data( BPy_Object *self, int mesh )
-{
- Object *object = self->object;
- PyObject *data_object = NULL;
-
- switch ( object->type ) {
- case OB_ARMATURE:
- data_object = Armature_CreatePyObject( object->data );
- break;
- case OB_CAMERA:
- data_object = Camera_CreatePyObject( object->data );
- break;
- case OB_CURVE:
- case OB_SURF:
- data_object = Curve_CreatePyObject( object->data );
- break;
- case ID_IM:
- data_object = Image_CreatePyObject( object->data );
- break;
- case ID_IP:
- data_object = Ipo_CreatePyObject( object->data );
- break;
- case OB_LAMP:
- data_object = Lamp_CreatePyObject( object->data );
- break;
- case OB_LATTICE:
- data_object = Lattice_CreatePyObject( object->data );
- break;
- case ID_MA:
- break;
- case OB_MESH:
- if( !mesh ) /* get as NMesh (default) */
- data_object = NMesh_CreatePyObject( object->data, object );
- else /* else get as Mesh */
- data_object = Mesh_CreatePyObject( object->data, object );
- break;
- case OB_MBALL:
- data_object = Metaball_CreatePyObject( object->data );
- break;
- case ID_OB:
- data_object = Object_CreatePyObject( object->data );
- break;
- case ID_SCE:
- break;
- case OB_FONT:
- data_object = Text3d_CreatePyObject( object->data );
- break;
- case ID_WO:
- break;
- default:
- break;
- }
-
- if( data_object )
- return data_object;
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_getData( BPy_Object *self, PyObject *args,
- PyObject *kwd )
-{
- Object *object = self->object;
- int name_only = 0;
- int mesh = 0; /* default mesh type = NMesh */
- static char *kwlist[] = {"name_only", "mesh", NULL};
-
- if( !PyArg_ParseTupleAndKeywords(args, kwd, "|ii", kwlist,
- &name_only, &mesh) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected nothing or bool keywords 'name_only' or 'mesh' as argument" );
-
- /* if there's no obdata, try to create it */
- if( object->data == NULL ) {
- int tmptype = object->type; /* save current type */
-
- /* if we have no data and are faking an empty, set the type */
- if( self->realtype != OB_EMPTY )
- object->type = self->realtype;
-
- if( EXPP_add_obdata( object ) != 0 ) { /* couldn't create obdata */
- object->type = tmptype; /* restore previous type */
- Py_RETURN_NONE;
- }
-
- /* if we set data successfully, clear the fake type */
- self->realtype = OB_EMPTY;
- }
-
- /* user wants only the name of the data object */
- if( name_only ) {
- ID *id = object->data;
- return PyString_FromString( id->name+2 );
- }
-
- return get_obj_data( self, mesh );
-}
-
-static PyObject *Object_getEuler( BPy_Object * self )
-{
- return ( PyObject * ) newEulerObject( self->object->rot, Py_WRAP );
-}
-
-#define PROTFLAGS_MASK ( OB_LOCK_LOCX | OB_LOCK_LOCY | OB_LOCK_LOCZ | \
- OB_LOCK_ROTX | OB_LOCK_ROTY | OB_LOCK_ROTZ | \
- OB_LOCK_SCALEX | OB_LOCK_SCALEY | OB_LOCK_SCALEZ )
-
-static PyObject *Object_getProtectFlags( BPy_Object * self )
-{
- return PyInt_FromLong( (long)(self->object->protectflag & PROTFLAGS_MASK) );
-}
-
-static int Object_setProtectFlags( BPy_Object * self, PyObject * args )
-{
- PyObject* integer = PyNumber_Int( args );
- short value;
-
- if( !integer )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected integer argument" );
-
- value = ( short )PyInt_AS_LONG( integer );
- Py_DECREF( integer );
- if( value & ~PROTFLAGS_MASK )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "undefined bit(s) set in bitfield" );
-
- self->object->protectflag = value;
- self->object->recalc |= OB_RECALC_OB;
- return 0;
-}
-
-static PyObject *Object_getRBRadius( BPy_Object * self )
-{
- return PyFloat_FromDouble( (double) self->object->inertia );
-}
-
-static int Object_setRBRadius( BPy_Object * self, PyObject * args )
-{
- float value;
- PyObject* flt = PyNumber_Float( args );
-
- if( !flt )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected float argument" );
- value = (float)PyFloat_AS_DOUBLE( flt );
- Py_DECREF( flt );
-
- if( value < 0.0f )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "acceptable values are non-negative, 0.0 or more" );
-
- self->object->inertia = value;
- self->object->recalc |= OB_RECALC_OB;
-
- return 0;
-}
-
-static PyObject *Object_getRBHalfExtents( BPy_Object * self )
-{
- float center[3], extents[3];
-
- get_local_bounds( self->object, center, extents );
- return Py_BuildValue( "[fff]", extents[0], extents[1], extents[2] );
-}
-
-static PyGetSetDef BPy_Object_getseters[] = {
- GENERIC_LIB_GETSETATTR,
- {"LocX",
- (getter)getFloatAttr, (setter)setFloatAttr,
- "The X location coordinate of the object",
- (void *)EXPP_OBJ_ATTR_LOC_X},
- {"LocY",
- (getter)getFloatAttr, (setter)setFloatAttr,
- "The Y location coordinate of the object",
- (void *)EXPP_OBJ_ATTR_LOC_Y},
- {"LocZ",
- (getter)getFloatAttr, (setter)setFloatAttr,
- "The Z location coordinate of the object",
- (void *)EXPP_OBJ_ATTR_LOC_Z},
- {"dLocX",
- (getter)getFloatAttr, (setter)setFloatAttr,
- "The delta X location coordinate of the object",
- (void *)EXPP_OBJ_ATTR_DLOC_X},
- {"dLocY",
- (getter)getFloatAttr, (setter)setFloatAttr,
- "The delta Y location coordinate of the object",
- (void *)EXPP_OBJ_ATTR_DLOC_Y},
- {"dLocZ",
- (getter)getFloatAttr, (setter)setFloatAttr,
- "The delta Z location coordinate of the object",
- (void *)EXPP_OBJ_ATTR_DLOC_Z},
- {"RotX",
- (getter)getFloatAttr, (setter)setFloatAttr,
- "The X rotation angle (in radians) of the object",
- (void *)EXPP_OBJ_ATTR_ROT_X},
- {"RotY",
- (getter)getFloatAttr, (setter)setFloatAttr,
- "The Y rotation angle (in radians) of the object",
- (void *)EXPP_OBJ_ATTR_ROT_Y},
- {"RotZ",
- (getter)getFloatAttr, (setter)setFloatAttr,
- "The Z rotation angle (in radians) of the object",
- (void *)EXPP_OBJ_ATTR_ROT_Z},
- {"dRotX",
- (getter)getFloatAttr, (setter)setFloatAttr,
- "The delta X rotation angle (in radians) of the object",
- (void *)EXPP_OBJ_ATTR_DROT_X},
- {"dRotY",
- (getter)getFloatAttr, (setter)setFloatAttr,
- "The delta Y rotation angle (in radians) of the object",
- (void *)EXPP_OBJ_ATTR_DROT_Y},
- {"dRotZ",
- (getter)getFloatAttr, (setter)setFloatAttr,
- "The delta Z rotation angle (in radians) of the object",
- (void *)EXPP_OBJ_ATTR_DROT_Z},
- {"SizeX",
- (getter)getFloatAttr, (setter)setFloatAttr,
- "The X size of the object",
- (void *)EXPP_OBJ_ATTR_SIZE_X},
- {"SizeY",
- (getter)getFloatAttr, (setter)setFloatAttr,
- "The Y size of the object",
- (void *)EXPP_OBJ_ATTR_SIZE_Y},
- {"SizeZ",
- (getter)getFloatAttr, (setter)setFloatAttr,
- "The Z size of the object",
- (void *)EXPP_OBJ_ATTR_SIZE_Z},
- {"dSizeX",
- (getter)getFloatAttr, (setter)setFloatAttr,
- "The delta X size of the object",
- (void *)EXPP_OBJ_ATTR_DSIZE_X},
- {"dSizeY",
- (getter)getFloatAttr, (setter)setFloatAttr,
- "The delta Y size of the object",
- (void *)EXPP_OBJ_ATTR_DSIZE_Y},
- {"dSizeZ",
- (getter)getFloatAttr, (setter)setFloatAttr,
- "The delta Z size of the object",
- (void *)EXPP_OBJ_ATTR_DSIZE_Z},
-
- {"loc",
- (getter)getFloat3Attr, (setter)setFloat3Attr,
- "The (X,Y,Z) location coordinates of the object",
- (void *)EXPP_OBJ_ATTR_LOC},
- {"dloc",
- (getter)getFloat3Attr, (setter)setFloat3Attr,
- "The delta (X,Y,Z) location coordinates of the object",
- (void *)EXPP_OBJ_ATTR_DLOC},
- {"rot",
- (getter)Object_getEuler, (setter)Object_setEuler,
- "The (X,Y,Z) rotation angles (in degrees) of the object",
- NULL},
- {"drot",
- (getter)getFloat3Attr, (setter)setFloat3Attr,
- "The delta (X,Y,Z) rotation angles (in radians) of the object",
- (void *)EXPP_OBJ_ATTR_DROT},
- {"size",
- (getter)getFloat3Attr, (setter)setFloat3Attr,
- "The (X,Y,Z) size of the object",
- (void *)EXPP_OBJ_ATTR_SIZE},
- {"dsize",
- (getter)getFloat3Attr, (setter)setFloat3Attr,
- "The delta (X,Y,Z) size of the object",
- (void *)EXPP_OBJ_ATTR_DSIZE},
- {"Layer",
- (getter)getIntAttr, (setter)Object_setLayersMask,
- "The object layers (bitfield)",
- (void *)EXPP_OBJ_ATTR_LAYERMASK},
- {"Layers",
- (getter)getIntAttr, (setter)Object_setLayersMask,
- "The object layers (bitfield)",
- (void *)EXPP_OBJ_ATTR_LAYERMASK},
- {"layers",
- (getter)Object_getLayers, (setter)Object_setLayers,
- "The object layers (list of ints)",
- NULL},
- {"ipo",
- (getter)Object_getIpo, (setter)Object_setIpo,
- "Object's Ipo data",
- NULL},
- {"colbits",
- (getter)getIntAttr, (setter)setIntAttrRange,
- "The Material usage bitfield",
- (void *)EXPP_OBJ_ATTR_COLBITS},
- {"drawMode",
- (getter)getIntAttr, (setter)Object_setDrawMode,
- "The object's drawing mode bitfield",
- (void *)EXPP_OBJ_ATTR_DRAWMODE},
- {"drawType",
- (getter)getIntAttr, (setter)Object_setDrawType,
- "The object's drawing type",
- (void *)EXPP_OBJ_ATTR_DRAWTYPE},
- {"parentType",
- (getter)getIntAttr, (setter)NULL,
- "The object's parent type",
- (void *)EXPP_OBJ_ATTR_PARENT_TYPE},
- {"DupOn",
- (getter)getIntAttr, (setter)setIntAttrClamp,
- "DupOn setting (for DupliFrames)",
- (void *)EXPP_OBJ_ATTR_DUPON},
- {"DupOff",
- (getter)getIntAttr, (setter)setIntAttrClamp,
- "DupOff setting (for DupliFrames)",
- (void *)EXPP_OBJ_ATTR_DUPOFF},
- {"DupSta",
- (getter)getIntAttr, (setter)setIntAttrClamp,
- "Starting frame (for DupliFrames)",
- (void *)EXPP_OBJ_ATTR_DUPSTA},
- {"DupEnd",
- (getter)getIntAttr, (setter)setIntAttrClamp,
- "Ending frame (for DupliFrames)",
- (void *)EXPP_OBJ_ATTR_DUPEND},
- {"passIndex",
- (getter)getIntAttr, (setter)setIntAttrClamp,
- "Index for object masks in the compositor",
- (void *)EXPP_OBJ_ATTR_PASSINDEX},
- {"activeMaterial",
- (getter)getIntAttr, (setter)setIntAttrClamp,
- "Index for the active material (displayed in the material panel)",
- (void *)EXPP_OBJ_ATTR_ACT_MATERIAL},
- {"mat",
- (getter)Object_getMatrixWorld, (setter)NULL,
- "worldspace matrix: absolute, takes vertex parents, tracking and Ipos into account",
- NULL},
- {"matrix",
- (getter)Object_getMatrixWorld, (setter)NULL,
- "worldspace matrix: absolute, takes vertex parents, tracking and Ipos into account",
- NULL},
- {"matrixWorld",
- (getter)Object_getMatrixWorld, (setter)NULL,
- "worldspace matrix: absolute, takes vertex parents, tracking and Ipos into account",
- NULL},
- {"matrixLocal",
- (getter)Object_getMatrixLocal, (setter)Object_setMatrix,
- "localspace matrix: relative to the object's parent",
- NULL},
- {"matrixParentInverse",
- (getter)Object_getMatrixParentInverse, (setter)NULL,
- "parents inverse matrix: parents localspace inverted matrix",
- NULL},
- {"matrixOldWorld",
- (getter)Object_getMatrixOldWorld, (setter)NULL,
- "old-type worldspace matrix (prior to Blender 2.34)",
- NULL},
- {"data",
- (getter)get_obj_data, (setter)NULL,
- "The Datablock object linked to this object",
- NULL},
- {"sel",
- (getter)Object_getSelected, (setter)Object_setSelect,
- "The object's selection state",
- NULL},
- {"parent",
- (getter)Object_getParent, (setter)NULL,
- "The object's parent object (if parented)",
- NULL},
- {"parentbonename",
- (getter)Object_getParentBoneName, (setter)Object_setParentBoneName,
- "The object's parent object's sub name",
- NULL},
- {"track",
- (getter)Object_getTracked, (setter)Object_setTracked,
- "The object's tracked object",
- NULL},
- {"timeOffset",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "The time offset of the object's animation",
- (void *)EXPP_OBJ_ATTR_TIMEOFFSET},
- {"type",
- (getter)Object_getType, (setter)NULL,
- "The object's type",
- NULL},
- {"boundingBox",
- (getter)Object_getBoundBox, (setter)NULL,
- "The bounding box of this object",
- NULL},
- {"action",
- (getter)Object_getAction, (setter)Object_setAction,
- "The action associated with this object (if defined)",
- NULL},
- {"game_properties",
- (getter)Object_getAllProperties, (setter)NULL,
- "The object's properties",
- NULL},
-
- {"piFalloff",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "The particle interaction falloff power",
- (void *)EXPP_OBJ_ATTR_PI_FALLOFF},
- {"piMaxDist",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "Max distance for the particle interaction field to work",
- (void *)EXPP_OBJ_ATTR_PI_MAXDIST},
- {"piPermeability",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "Probability that a particle will pass through the mesh",
- (void *)EXPP_OBJ_ATTR_PI_PERM},
- {"piRandomDamp",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "Random variation of particle interaction damping",
- (void *)EXPP_OBJ_ATTR_PI_RANDOMDAMP},
- {"piStrength",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "Particle interaction force field strength",
- (void *)EXPP_OBJ_ATTR_PI_STRENGTH},
- {"piSurfaceDamp",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "Amount of damping during particle collision",
- (void *)EXPP_OBJ_ATTR_PI_SURFACEDAMP},
- {"piSoftbodyDamp",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "Damping factor for softbody deflection",
- (void *)EXPP_OBJ_ATTR_PI_SBDAMP},
- {"piSoftbodyIThick",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "Inner face thickness for softbody deflection",
- (void *)EXPP_OBJ_ATTR_PI_SBIFACETHICK},
- {"piSoftbodyOThick",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "Outer face thickness for softbody deflection",
- (void *)EXPP_OBJ_ATTR_PI_SBOFACETHICK},
-
- {"piDeflection",
- (getter)Object_getPIDeflection, (setter)Object_setPIDeflection,
- "Deflects particles based on collision",
- NULL},
- {"piType",
- (getter)Object_getPIType, (setter)Object_setPIType,
- "Type of particle interaction (force field, wind, etc)",
- NULL},
- {"piUseMaxDist",
- (getter)Object_getPIUseMaxDist, (setter)Object_setPIUseMaxDist,
- "Use a maximum distance for the field to work",
- NULL},
-
- {"sbMass",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "Softbody point mass (heavier is slower)",
- (void *)EXPP_OBJ_ATTR_SB_NODEMASS},
- {"sbGrav",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "Apply gravitation to softbody point movement",
- (void *)EXPP_OBJ_ATTR_SB_GRAV},
- {"sbFriction",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "General media friction for softbody point movements",
- (void *)EXPP_OBJ_ATTR_SB_MEDIAFRICT},
- {"sbSpeed",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "Tweak timing for physics to control softbody frequency and speed",
- (void *)EXPP_OBJ_ATTR_SB_MEDIAFRICT},
- {"sbErrorLimit",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "Softbody Runge-Kutta ODE solver error limit (low values give more precision)",
- (void *)EXPP_OBJ_ATTR_SB_RKLIMIT},
- {"sbGoalSpring",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "Softbody goal (vertex target position) spring stiffness",
- (void *)EXPP_OBJ_ATTR_SB_GOALSPRING},
- {"sbGoalFriction",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "Softbody goal (vertex target position) friction",
- (void *)EXPP_OBJ_ATTR_SB_GOALFRICT},
- {"sbMinGoal",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "Softbody goal minimum (vertex group weights scaled to match this range)",
- (void *)EXPP_OBJ_ATTR_SB_MINGOAL},
- {"sbMaxGoal",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "Softbody goal maximum (vertex group weights scaled to match this range)",
- (void *)EXPP_OBJ_ATTR_SB_MAXGOAL},
- {"sbDefaultGoal",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "Default softbody goal value, when no vertex group used",
- (void *)EXPP_OBJ_ATTR_SB_DEFGOAL},
- {"sbInnerSpring",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "Softbody edge spring stiffness",
- (void *)EXPP_OBJ_ATTR_SB_INSPRING},
- {"sbInnerSpringFrict",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "Softbody edge spring friction",
- (void *)EXPP_OBJ_ATTR_SB_INFRICT},
- {"isSoftBody",
- (getter)Object_isSB, (setter)NULL,
- "True if object is a soft body",
- NULL},
- {"sbUseGoal",
- (getter)Object_getSBUseGoal, (setter)Object_setSBUseGoal,
- "Softbody forces for vertices to stick to animated position enabled",
- NULL},
- {"sbUseEdges",
- (getter)Object_getSBUseEdges, (setter)Object_setSBUseEdges,
- "Softbody use edges as springs enabled",
- NULL},
- {"sbStiffQuads",
- (getter)Object_getSBStiffQuads, (setter)Object_setSBStiffQuads,
- "Softbody adds diagonal springs on 4-gons enabled",
- NULL},
-
- {"axis",
- (getter)Object_getDrawModeBits, (setter)Object_setDrawModeBits,
- "Display of active object's center and axis enabled",
- (void *)OB_AXIS},
- {"texSpace",
- (getter)Object_getDrawModeBits, (setter)Object_setDrawModeBits,
- "Display of active object's texture space enabled",
- (void *)OB_TEXSPACE},
- {"nameMode",
- (getter)Object_getDrawModeBits, (setter)Object_setDrawModeBits,
- "Display of active object's name enabled",
- (void *)OB_DRAWNAME},
- {"wireMode",
- (getter)Object_getDrawModeBits, (setter)Object_setDrawModeBits,
- "Add the active object's wireframe over solid drawing enabled",
- (void *)OB_DRAWWIRE},
- {"xRay",
- (getter)Object_getDrawModeBits, (setter)Object_setDrawModeBits,
- "Draw the active object in front of others enabled",
- (void *)OB_DRAWXRAY},
- {"transp",
- (getter)Object_getDrawModeBits, (setter)Object_setDrawModeBits,
- "Transparent materials for the active object (mesh only) enabled",
- (void *)OB_DRAWTRANSP},
-
- {"enableNLAOverride",
- (getter)Object_getNLAflagBits, (setter)Object_setNLAflagBits,
- "Toggles Action-NLA based animation",
- (void *)OB_NLA_OVERRIDE},
-
- {"enableDupVerts",
- (getter)Object_getTransflagBits, (setter)Object_setTransflagBits,
- "Duplicate child objects on all vertices",
- (void *)OB_DUPLIVERTS},
- {"enableDupFaces",
- (getter)Object_getTransflagBits, (setter)Object_setTransflagBits,
- "Duplicate child objects on all faces",
- (void *)OB_DUPLIFACES},
- {"enableDupFacesScale",
- (getter)Object_getTransflagBits, (setter)Object_setTransflagBits,
- "Use face scale to scale all dupliFaces",
- (void *)OB_DUPLIFACES_SCALE},
- {"dupFacesScaleFac",
- (getter)getFloatAttr, (setter)setFloatAttr,
- "Use face scale to scale all dupliFaces",
- (void *)EXPP_OBJ_ATTR_DUPFACESCALEFAC},
- {"enableDupFrames",
- (getter)Object_getTransflagBits, (setter)Object_setTransflagBits,
- "Make copy of object for every frame",
- (void *)OB_DUPLIFRAMES},
- {"enableDupGroup",
- (getter)Object_getTransflagBits, (setter)Object_setTransflagBits,
- "Enable group instancing",
- (void *)OB_DUPLIGROUP},
- {"enableDupRot",
- (getter)Object_getTransflagBits, (setter)Object_setTransflagBits,
- "Rotate dupli according to vertex normal",
- (void *)OB_DUPLIROT},
- {"enableDupNoSpeed",
- (getter)Object_getTransflagBits, (setter)Object_setTransflagBits,
- "Set dupliframes to still, regardless of frame",
- (void *)OB_DUPLINOSPEED},
- {"DupObjects",
- (getter)Object_getDupliObjects, (setter)NULL,
- "Get a list of tuple pairs (object, matrix), for getting dupli objects",
- NULL},
- {"DupGroup",
- (getter)Object_getDupliGroup, (setter)Object_setDupliGroup,
- "Get a list of tuples for object duplicated by dupliframe",
- NULL},
-
- {"effects",
- (getter)Object_getEffects, (setter)NULL,
- "The list of particle effects associated with the object",
- NULL},
- {"actionStrips",
- (getter)Object_getActionStrips, (setter)NULL,
- "The action strips associated with the object",
- NULL},
- {"constraints",
- (getter)Object_getConstraints, (setter)NULL,
- "The constraints associated with the object",
- NULL},
- {"modifiers",
- (getter)Object_getModifiers, (setter)Object_setModifiers,
- "The modifiers associated with the object",
- NULL},
- {"protectFlags",
- (getter)Object_getProtectFlags, (setter)Object_setProtectFlags,
- "The \"transform locking\" bitfield for the object",
- NULL},
- {"drawSize",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "The size to display the Empty",
- (void *)EXPP_OBJ_ATTR_DRAWSIZE},
-
- {"rbFlags",
- (getter)Object_getRBFlags, (setter)Object_setRBFlags,
- "Rigid body flags",
- NULL},
- {"rbMass",
- (getter)Object_getRBMass, (setter)Object_setRBMass,
- "Rigid body object mass",
- NULL},
- {"rbRadius",
- (getter)Object_getRBRadius, (setter)Object_setRBRadius,
- "Rigid body bounding sphere size",
- NULL},
- {"rbShapeBoundType",
- (getter)Object_getRBShapeBoundType, (setter)Object_setRBShapeBoundType,
- "Rigid body physics bounds object type",
- NULL},
- {"rbHalfExtents",
- (getter)Object_getRBHalfExtents, (setter)NULL,
- "Rigid body physics bounds object type",
- NULL},
-
- {"restrictDisplay",
- (getter)Object_getRestricted, (setter)Object_setRestricted,
- "Toggle object restrictions",
- (void *)OB_RESTRICT_VIEW},
- {"restrictSelect",
- (getter)Object_getRestricted, (setter)Object_setRestricted,
- "Toggle object restrictions",
- (void *)OB_RESTRICT_SELECT},
- {"restrictRender",
- (getter)Object_getRestricted, (setter)Object_setRestricted,
- "Toggle object restrictions",
- (void *)OB_RESTRICT_RENDER},
-
- {"pinShape",
- (getter)Object_getShapeFlag, (setter)Object_setShapeFlag,
- "Set the state for pinning this object",
- (void *)OB_SHAPE_LOCK},
- {"activeShape",
- (getter)getIntAttr, (setter)setIntAttrClamp,
- "set the index for the active shape key",
- (void *)EXPP_OBJ_ATTR_ACT_SHAPE},
-
-
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-/*****************************************************************************/
-/* Python Object_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject Object_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender Object", /* char *tp_name; */
- sizeof( BPy_Object ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- ( destructor ) Object_dealloc,/* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- ( cmpfunc ) Object_compare, /* cmpfunc tp_compare; */
- ( reprfunc ) Object_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- NULL, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
- 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, /* 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, /* 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 ***/
- BPy_Object_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_Object_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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 PyObject *M_Object_DrawModesDict( void )
-{
- PyObject *M = PyConstant_New( );
-
- if( M ) {
- BPy_constant *d = ( BPy_constant * ) M;
- PyConstant_Insert( d, "AXIS", PyInt_FromLong( OB_AXIS ) );
- PyConstant_Insert( d, "TEXSPACE", PyInt_FromLong( OB_TEXSPACE ) );
- PyConstant_Insert( d, "NAME", PyInt_FromLong( OB_DRAWNAME ) );
- PyConstant_Insert( d, "WIRE", PyInt_FromLong( OB_DRAWWIRE ) );
- PyConstant_Insert( d, "XRAY", PyInt_FromLong( OB_DRAWXRAY ) );
- PyConstant_Insert( d, "TRANSP", PyInt_FromLong( OB_DRAWTRANSP ) );
- }
- return M;
-}
-
-static PyObject *M_Object_DrawTypesDict( void )
-{
- PyObject *M = PyConstant_New( );
-
- if( M ) {
- BPy_constant *d = ( BPy_constant * ) M;
- PyConstant_Insert( d, "BOUNDBOX", PyInt_FromLong( OB_BOUNDBOX ) );
- PyConstant_Insert( d, "WIRE", PyInt_FromLong( OB_WIRE ) );
- PyConstant_Insert( d, "SOLID", PyInt_FromLong( OB_SOLID ) );
- PyConstant_Insert( d, "SHADED", PyInt_FromLong( OB_SHADED ) );
- }
- return M;
-}
-
-static PyObject *M_Object_ParentTypesDict( void )
-{
- PyObject *M = PyConstant_New( );
-
- if( M ) {
- BPy_constant *d = ( BPy_constant * ) M;
- PyConstant_Insert( d, "OBJECT", PyInt_FromLong( PAROBJECT ) );
- PyConstant_Insert( d, "CURVE", PyInt_FromLong( PARCURVE ) );
-
- /* 2.43 was released as LATTICE as PARKEY, my bad,
- lattice uses PARSKEL also - Campbell */
- PyConstant_Insert( d, "LATTICE", PyInt_FromLong( PARSKEL ) );
-
- PyConstant_Insert( d, "ARMATURE", PyInt_FromLong( PARSKEL ) );
- PyConstant_Insert( d, "VERT1", PyInt_FromLong( PARVERT1 ) );
- PyConstant_Insert( d, "VERT3", PyInt_FromLong( PARVERT3 ) );
- PyConstant_Insert( d, "BONE", PyInt_FromLong( PARBONE ) );
- }
- return M;
-}
-
-static PyObject *M_Object_PITypesDict( void )
-{
- PyObject *M = PyConstant_New( );
-
- if( M ) {
- BPy_constant *d = ( BPy_constant * ) M;
- PyConstant_Insert( d, "NONE", PyInt_FromLong( 0 ) );
- PyConstant_Insert( d, "FORCE", PyInt_FromLong( PFIELD_FORCE ) );
- PyConstant_Insert( d, "VORTEX", PyInt_FromLong( PFIELD_VORTEX ) );
- PyConstant_Insert( d, "WIND", PyInt_FromLong( PFIELD_WIND ) );
- PyConstant_Insert( d, "GUIDE", PyInt_FromLong( PFIELD_GUIDE ) );
- }
- return M;
-}
-
-static PyObject *M_Object_ProtectDict( void )
-{
- PyObject *M = PyConstant_New( );
-
- if( M ) {
- BPy_constant *d = ( BPy_constant * ) M;
- PyConstant_Insert( d, "LOCX", PyInt_FromLong( OB_LOCK_LOCX ) );
- PyConstant_Insert( d, "LOCY", PyInt_FromLong( OB_LOCK_LOCY ) );
- PyConstant_Insert( d, "LOCZ", PyInt_FromLong( OB_LOCK_LOCZ ) );
- PyConstant_Insert( d, "LOC", PyInt_FromLong( OB_LOCK_LOC ) );
- PyConstant_Insert( d, "ROTX", PyInt_FromLong( OB_LOCK_ROTX ) );
- PyConstant_Insert( d, "ROTY", PyInt_FromLong( OB_LOCK_ROTY ) );
- PyConstant_Insert( d, "ROTZ", PyInt_FromLong( OB_LOCK_ROTZ ) );
- PyConstant_Insert( d, "ROT",
- PyInt_FromLong( OB_LOCK_ROTX|OB_LOCK_ROTY|OB_LOCK_ROTZ ) );
- PyConstant_Insert( d, "SCALEX", PyInt_FromLong( OB_LOCK_SCALEX ) );
- PyConstant_Insert( d, "SCALEY", PyInt_FromLong( OB_LOCK_SCALEY ) );
- PyConstant_Insert( d, "SCALEZ", PyInt_FromLong( OB_LOCK_SCALEZ ) );
- PyConstant_Insert( d, "SCALE",
- PyInt_FromLong( OB_LOCK_SCALEX|OB_LOCK_SCALEY|OB_LOCK_SCALEZ ) );
- }
- return M;
-}
-
-static PyObject *M_Object_RBFlagsDict( void )
-{
- PyObject *M = PyConstant_New( );
-
- if( M ) {
- BPy_constant *d = ( BPy_constant * ) M;
- PyConstant_Insert( d, "DYNAMIC", PyInt_FromLong( OB_DYNAMIC ) );
- PyConstant_Insert( d, "CHILD", PyInt_FromLong( OB_CHILD ) );
- PyConstant_Insert( d, "ACTOR", PyInt_FromLong( OB_ACTOR ) );
- PyConstant_Insert( d, "USEFH", PyInt_FromLong( OB_DO_FH ) );
- PyConstant_Insert( d, "ROTFH", PyInt_FromLong( OB_ROT_FH ) );
- PyConstant_Insert( d, "ANISOTROPIC",
- PyInt_FromLong( OB_ANISOTROPIC_FRICTION ) );
- PyConstant_Insert( d, "GHOST", PyInt_FromLong( OB_GHOST ) );
- PyConstant_Insert( d, "RIGIDBODY", PyInt_FromLong( OB_RIGID_BODY ) );
- PyConstant_Insert( d, "BOUNDS", PyInt_FromLong( OB_BOUNDS ) );
- PyConstant_Insert( d, "COLLISION_RESPONSE",
- PyInt_FromLong( OB_COLLISION_RESPONSE ) );
- PyConstant_Insert( d, "SECTOR", PyInt_FromLong( OB_SECTOR ) );
- PyConstant_Insert( d, "PROP", PyInt_FromLong( OB_PROP ) );
- PyConstant_Insert( d, "MAINACTOR", PyInt_FromLong( OB_MAINACTOR ) );
- }
- return M;
-}
-
-static PyObject *M_Object_RBShapeBoundDict( void )
-{
- PyObject *M = PyConstant_New( );
-
- if( M ) {
- BPy_constant *d = ( BPy_constant * ) M;
- PyConstant_Insert( d, "BOX", PyInt_FromLong( OB_BOUND_BOX ) );
- PyConstant_Insert( d, "SPHERE", PyInt_FromLong( OB_BOUND_SPHERE ) );
- PyConstant_Insert( d, "CYLINDER", PyInt_FromLong( OB_BOUND_CYLINDER ) );
- PyConstant_Insert( d, "CONE", PyInt_FromLong( OB_BOUND_CONE ) );
- PyConstant_Insert( d, "POLYHEDERON", PyInt_FromLong( OB_BOUND_POLYH ) );
- }
- return M;
-}
-
-static PyObject *M_Object_IpoKeyTypesDict( void )
-{
- PyObject *M = PyConstant_New( );
-
- if( M ) {
- BPy_constant *d = ( BPy_constant * ) M;
- PyConstant_Insert( d, "LOC", PyInt_FromLong( IPOKEY_LOC ) );
- PyConstant_Insert( d, "ROT", PyInt_FromLong( IPOKEY_ROT ) );
- PyConstant_Insert( d, "SIZE", PyInt_FromLong( IPOKEY_SIZE ) );
- PyConstant_Insert( d, "LOCROT", PyInt_FromLong( IPOKEY_LOCROT ) );
- PyConstant_Insert( d, "LOCROTSIZE", PyInt_FromLong( IPOKEY_LOCROTSIZE ) );
- PyConstant_Insert( d, "LAYER", PyInt_FromLong( IPOKEY_LAYER ) );
-
- PyConstant_Insert( d, "PI_STRENGTH", PyInt_FromLong( IPOKEY_PI_STRENGTH ) );
- PyConstant_Insert( d, "PI_FALLOFF", PyInt_FromLong( IPOKEY_PI_FALLOFF ) );
- PyConstant_Insert( d, "PI_SURFACEDAMP", PyInt_FromLong( IPOKEY_PI_SURFACEDAMP ) );
- PyConstant_Insert( d, "PI_RANDOMDAMP", PyInt_FromLong( IPOKEY_PI_RANDOMDAMP ) );
- PyConstant_Insert( d, "PI_PERM", PyInt_FromLong( IPOKEY_PI_PERM ) );
- }
- return M;
-}
-
-/*****************************************************************************/
-/* Function: initObject */
-/*****************************************************************************/
-PyObject *Object_Init( void )
-{
- PyObject *module, *dict;
- PyObject *DrawModesDict = M_Object_DrawModesDict( );
- PyObject *DrawTypesDict = M_Object_DrawTypesDict( );
- PyObject *ParentTypesDict = M_Object_ParentTypesDict( );
- PyObject *ProtectDict = M_Object_ProtectDict( );
- PyObject *PITypesDict = M_Object_PITypesDict( );
- PyObject *RBFlagsDict = M_Object_RBFlagsDict( );
- PyObject *RBShapesDict = M_Object_RBShapeBoundDict( );
- PyObject *IpoKeyTypesDict = M_Object_IpoKeyTypesDict( );
-
- PyType_Ready( &Object_Type ) ;
-
- module = Py_InitModule3( "Blender.Object", M_Object_methods,
- M_Object_doc );
-
-
- /* We Should Remove these!!!! */
- PyModule_AddIntConstant( module, "LOC", IPOKEY_LOC );
- PyModule_AddIntConstant( module, "ROT", IPOKEY_ROT );
- PyModule_AddIntConstant( module, "SIZE", IPOKEY_SIZE );
- PyModule_AddIntConstant( module, "LOCROT", IPOKEY_LOCROT );
- PyModule_AddIntConstant( module, "LOCROTSIZE", IPOKEY_LOCROTSIZE );
- PyModule_AddIntConstant( module, "LAYER", IPOKEY_LAYER );
-
- PyModule_AddIntConstant( module, "PI_STRENGTH", IPOKEY_PI_STRENGTH );
- PyModule_AddIntConstant( module, "PI_FALLOFF", IPOKEY_PI_FALLOFF );
- PyModule_AddIntConstant( module, "PI_SURFACEDAMP", IPOKEY_PI_SURFACEDAMP );
- PyModule_AddIntConstant( module, "PI_RANDOMDAMP", IPOKEY_PI_RANDOMDAMP );
- PyModule_AddIntConstant( module, "PI_PERM", IPOKEY_PI_PERM );
-
- PyModule_AddIntConstant( module, "NONE",0 );
- PyModule_AddIntConstant( module, "FORCE",PFIELD_FORCE );
- PyModule_AddIntConstant( module, "VORTEX",PFIELD_VORTEX );
- PyModule_AddIntConstant( module, "MAGNET",PFIELD_MAGNET );
- PyModule_AddIntConstant( module, "WIND",PFIELD_WIND );
- /* Only keeping above so as not to break compat */
-
-
- if( DrawModesDict )
- PyModule_AddObject( module, "DrawModes", DrawModesDict );
- if( DrawTypesDict )
- PyModule_AddObject( module, "DrawTypes", DrawTypesDict );
- if( ParentTypesDict )
- PyModule_AddObject( module, "ParentTypes", ParentTypesDict );
- if( PITypesDict )
- PyModule_AddObject( module, "PITypes", PITypesDict );
- if( ProtectDict )
- PyModule_AddObject( module, "ProtectFlags", ProtectDict );
- if( RBFlagsDict )
- PyModule_AddObject( module, "RBFlags", RBFlagsDict );
- if( RBShapesDict )
- PyModule_AddObject( module, "RBShapes", RBShapesDict );
- if( IpoKeyTypesDict )
- PyModule_AddObject( module, "IpoKeyTypes", IpoKeyTypesDict );
-
- /*Add SUBMODULES to the module*/
- dict = PyModule_GetDict( module ); /*borrowed*/
- PyDict_SetItemString(dict, "Pose", Pose_Init()); /*creates a *new* module*/
- /*PyDict_SetItemString(dict, "Constraint", Constraint_Init()); */ /*creates a *new* module*/
-
- return ( module );
-}
-
-/* #####DEPRECATED###### */
-
-static PyObject *Object_SetIpo( BPy_Object * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Object_setIpo );
-}
-
-static PyObject *Object_Select( BPy_Object * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Object_setSelect );
-}
-
-static PyObject *Object_SetDrawMode( BPy_Object * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)Object_setDrawMode );
-}
-
-static PyObject *Object_SetDrawType( BPy_Object * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)Object_setDrawType );
-}
-
-static PyObject *Object_SetMatrix( BPy_Object * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)Object_setMatrix );
-}
-
-static PyObject *Object_SetEuler( BPy_Object * self, PyObject * args )
-{
- return EXPP_setterWrapperTuple( (void *)self, args,
- (setter)Object_setEuler );
-}
-
-static PyObject *Object_setTimeOffset( BPy_Object * self, PyObject * args )
-{
- float newTimeOffset;
-
- if( !PyArg_ParseTuple( args, "f", &newTimeOffset ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a float as argument" );
-
- self->object->sf = newTimeOffset;
- self->object->recalc |= OB_RECALC_OB;
-
- Py_RETURN_NONE;
-}
-
-
-/*************************************************************************/
-/* particle defection methods */
-/*************************************************************************/
-
-static PyObject *Object_SetPIDeflection( BPy_Object * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)Object_setPIDeflection );
-}
-
-static PyObject *Object_SetPIType( BPy_Object * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)Object_setPIType );
-}
-
-static PyObject *Object_SetPIUseMaxDist( BPy_Object * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)Object_setPIUseMaxDist );
-}
-
-static PyObject *Object_getPISurfaceDamp( BPy_Object * self )
-{
- if( !self->object->pd && !setupPI(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "particle deflection could not be accessed" );
-
- return PyFloat_FromDouble( ( double ) self->object->pd->pdef_damp );
-}
-
-static PyObject *Object_SetPISurfaceDamp( BPy_Object * self, PyObject * args )
-{
- float value;
-
- if( !self->object->pd && !setupPI(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "particle deflection could not be accessed" );
-
- if( !PyArg_ParseTuple( args, "f", &value ) )
- return NULL;
-
- self->object->pd->pdef_damp = EXPP_ClampFloat( value,
- EXPP_OBJECT_PIDAMP_MIN, EXPP_OBJECT_PIDAMP_MAX );
- self->object->recalc |= OB_RECALC_OB;
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_getPIPerm( BPy_Object * self )
-{
- if( !self->object->pd && !setupPI(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "particle deflection could not be accessed" );
- return PyFloat_FromDouble ( (double) self->object->pd->pdef_perm );
-}
-
-static PyObject *Object_SetPIPerm( BPy_Object * self, PyObject * args )
-{
- float value;
-
- if( !self->object->pd && !setupPI(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "particle deflection could not be accessed" );
-
- if( !PyArg_ParseTuple( args, "f", &value ) )
- return NULL;
-
- self->object->pd->pdef_perm = EXPP_ClampFloat( value,
- EXPP_OBJECT_PIPERM_MIN, EXPP_OBJECT_PIPERM_MAX );
- self->object->recalc |= OB_RECALC_OB;
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_getPIStrength( BPy_Object * self )
-{
- if( !self->object->pd && !setupPI(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "particle deflection could not be accessed" );
-
- return PyFloat_FromDouble( ( double ) self->object->pd->f_strength );
-}
-
-static PyObject *Object_setPIStrength( BPy_Object * self, PyObject * args )
-{
- float value;
-
- if( !self->object->pd && !setupPI(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "particle deflection could not be accessed" );
-
- if( !PyArg_ParseTuple( args, "f", &value ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected float argument" );
-
- self->object->pd->f_strength = EXPP_ClampFloat( value,
- EXPP_OBJECT_PISTRENGTH_MIN, EXPP_OBJECT_PISTRENGTH_MAX );
- self->object->recalc |= OB_RECALC_OB;
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_getPIFalloff( BPy_Object * self )
-{
- if( !self->object->pd && !setupPI(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "particle deflection could not be accessed" );
-
- return PyFloat_FromDouble( ( double ) self->object->pd->f_power );
-}
-
-static PyObject *Object_setPIFalloff( BPy_Object * self, PyObject * args )
-{
- float value;
-
- if( !PyArg_ParseTuple( args, "f", &value ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected float argument" );
-
- self->object->pd->f_power = EXPP_ClampFloat( value,
- EXPP_OBJECT_PIPOWER_MIN, EXPP_OBJECT_PIPOWER_MAX );
- self->object->recalc |= OB_RECALC_OB;
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_getPIMaxDist( BPy_Object * self )
-{
- if( !self->object->pd && !setupPI(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "particle deflection could not be accessed" );
-
- return PyFloat_FromDouble( ( double ) self->object->pd->maxdist );
-}
-
-static PyObject *Object_setPIMaxDist( BPy_Object * self, PyObject * args )
-{
- float value;
-
- if( !self->object->pd && !setupPI(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "particle deflection could not be accessed" );
-
- if( !PyArg_ParseTuple( args, "f", &value ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected float argument" );
-
- self->object->pd->maxdist = EXPP_ClampFloat( value,
- EXPP_OBJECT_PIMAXDIST_MIN, EXPP_OBJECT_PIMAXDIST_MAX );
- self->object->recalc |= OB_RECALC_OB;
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_getPIRandomDamp( BPy_Object * self )
-{
- if( !self->object->pd && !setupPI(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "particle deflection could not be accessed" );
-
- return PyFloat_FromDouble( ( double ) self->object->pd->pdef_rdamp );
-}
-
-static PyObject *Object_setPIRandomDamp( BPy_Object * self, PyObject * args )
-{
- float value;
-
- if( !self->object->pd && !setupPI(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "particle deflection could not be accessed" );
-
- if( !PyArg_ParseTuple( args, "f", &value ) )
- return NULL;
-
- self->object->pd->pdef_rdamp = EXPP_ClampFloat( value,
- EXPP_OBJECT_PIRDAMP_MIN, EXPP_OBJECT_PIRDAMP_MAX );
- self->object->recalc |= OB_RECALC_OB;
- Py_RETURN_NONE;
-}
-
-/*************************************************************************/
-/* softbody methods */
-/*************************************************************************/
-
-static PyObject *Object_getSBMass( BPy_Object * self )
-{
- if( !self->object->soft && !setupSB(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "softbody could not be accessed" );
-
- return PyFloat_FromDouble( ( double ) self->object->soft->nodemass );
-}
-
-static PyObject *Object_setSBMass( BPy_Object * self, PyObject * args )
-{
- float value;
-
- if( !self->object->soft && !setupSB(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "softbody could not be accessed" );
-
- if( !PyArg_ParseTuple( args, "f", &value ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected float argument" );
-
- self->object->soft->nodemass = EXPP_ClampFloat( value,
- EXPP_OBJECT_SBNODEMASSMIN, EXPP_OBJECT_SBNODEMASSMAX );
- self->object->recalc |= OB_RECALC_OB;
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_getSBGravity( BPy_Object * self )
-{
- if( !self->object->soft && !setupSB(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "softbody could not be accessed" );
-
- return PyFloat_FromDouble( ( double ) self->object->soft->grav );
-}
-
-static PyObject *Object_setSBGravity( BPy_Object * self, PyObject * args )
-{
- float value;
-
- if( !self->object->soft && !setupSB(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "softbody could not be accessed" );
-
- if( !PyArg_ParseTuple( args, "f", &value ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected float argument" );
-
- self->object->soft->grav = EXPP_ClampFloat( value,
- EXPP_OBJECT_SBGRAVMIN, EXPP_OBJECT_SBGRAVMAX );
- self->object->recalc |= OB_RECALC_OB;
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_getSBFriction( BPy_Object * self )
-{
- if( !self->object->soft && !setupSB(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "softbody could not be accessed" );
-
- return PyFloat_FromDouble( ( double ) self->object->soft->mediafrict );
-}
-
-static PyObject *Object_setSBFriction( BPy_Object * self, PyObject * args )
-{
- float value;
-
- if( !self->object->soft && !setupSB(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "softbody could not be accessed" );
-
- if( !PyArg_ParseTuple( args, "f", &value ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected float argument" );
-
- self->object->soft->mediafrict = EXPP_ClampFloat( value,
- EXPP_OBJECT_SBMEDIAFRICTMIN, EXPP_OBJECT_SBMEDIAFRICTMAX );
- self->object->recalc |= OB_RECALC_OB;
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_getSBErrorLimit( BPy_Object * self )
-{
- if( !self->object->soft && !setupSB(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "softbody could not be accessed" );
-
- return PyFloat_FromDouble( ( double ) self->object->soft->rklimit );
-}
-
-static PyObject *Object_setSBErrorLimit( BPy_Object * self, PyObject * args )
-{
- float value;
-
- if( !self->object->soft && !setupSB(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "softbody could not be accessed" );
-
- if( !PyArg_ParseTuple( args, "f", &value ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected float argument" );
-
- self->object->soft->rklimit = EXPP_ClampFloat( value,
- EXPP_OBJECT_SBRKLIMITMIN, EXPP_OBJECT_SBRKLIMITMAX );
- self->object->recalc |= OB_RECALC_OB;
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_getSBGoalSpring( BPy_Object * self )
-{
- if( !self->object->soft && !setupSB(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "softbody could not be accessed" );
-
- return PyFloat_FromDouble( ( double ) self->object->soft->goalspring );
-}
-
-static PyObject *Object_setSBGoalSpring( BPy_Object * self, PyObject * args )
-{
- float value;
-
- if( !self->object->soft && !setupSB(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "softbody could not be accessed" );
-
- if( !PyArg_ParseTuple( args, "f", &value ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected float argument" );
-
- self->object->soft->goalspring = EXPP_ClampFloat( value,
- EXPP_OBJECT_SBGOALSPRINGMIN, EXPP_OBJECT_SBGOALSPRINGMAX );
- self->object->recalc |= OB_RECALC_OB;
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_getSBGoalFriction( BPy_Object * self )
-{
- if( !self->object->soft && !setupSB(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "softbody could not be accessed" );
-
- return PyFloat_FromDouble( ( double ) self->object->soft->goalfrict );
-}
-
-static PyObject *Object_setSBGoalFriction( BPy_Object * self, PyObject * args )
-{
- float value;
-
- if( !self->object->soft && !setupSB(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "softbody could not be accessed" );
-
- if( !PyArg_ParseTuple( args, "f", &value ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected float argument" );
-
- self->object->soft->goalfrict = EXPP_ClampFloat( value,
- EXPP_OBJECT_SBGOALFRICTMIN, EXPP_OBJECT_SBGOALFRICTMAX );
- self->object->recalc |= OB_RECALC_OB;
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_getSBMinGoal( BPy_Object * self )
-{
- if( !self->object->soft && !setupSB(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "softbody could not be accessed" );
-
- return PyFloat_FromDouble( ( double ) self->object->soft->mingoal );
-}
-
-static PyObject *Object_setSBMinGoal( BPy_Object * self, PyObject * args )
-{
- float value;
-
- if( !self->object->soft && !setupSB(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "softbody could not be accessed" );
-
- if( !PyArg_ParseTuple( args, "f", &value ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected float argument" );
-
- self->object->soft->mingoal = EXPP_ClampFloat( value,
- EXPP_OBJECT_SBMINGOALMIN, EXPP_OBJECT_SBMINGOALMAX );
- self->object->recalc |= OB_RECALC_OB;
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_getSBMaxGoal( BPy_Object * self )
-{
- if( !self->object->soft && !setupSB(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "softbody could not be accessed" );
-
- return PyFloat_FromDouble( ( double ) self->object->soft->maxgoal );
-}
-
-static PyObject *Object_setSBMaxGoal( BPy_Object * self, PyObject * args )
-{
- float value;
-
- if( !self->object->soft && !setupSB(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "softbody could not be accessed" );
-
- if( !PyArg_ParseTuple( args, "f", &value ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected float argument" );
-
- self->object->soft->maxgoal = EXPP_ClampFloat( value,
- EXPP_OBJECT_SBMAXGOALMIN, EXPP_OBJECT_SBMAXGOALMAX );
- self->object->recalc |= OB_RECALC_OB;
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_getSBDefaultGoal( BPy_Object * self )
-{
- if( !self->object->soft && !setupSB(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "softbody could not be accessed" );
-
- return PyFloat_FromDouble( ( double ) self->object->soft->defgoal );
-}
-
-static PyObject *Object_setSBDefaultGoal( BPy_Object * self, PyObject * args )
-{
- float value;
-
- if( !self->object->soft && !setupSB(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "softbody could not be accessed" );
-
- if( !PyArg_ParseTuple( args, "f", &value ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected float argument" );
-
- self->object->soft->defgoal = EXPP_ClampFloat( value,
- EXPP_OBJECT_SBDEFGOALMIN, EXPP_OBJECT_SBDEFGOALMAX );
- self->object->recalc |= OB_RECALC_OB;
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_getSBInnerSpring( BPy_Object * self )
-{
- if( !self->object->soft && !setupSB(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "softbody could not be accessed" );
-
- return PyFloat_FromDouble( ( double ) self->object->soft->inspring );
-}
-
-static PyObject *Object_setSBInnerSpring( BPy_Object * self, PyObject * args )
-{
- float value;
-
- if( !self->object->soft && !setupSB(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "softbody could not be accessed" );
-
- if( !PyArg_ParseTuple( args, "f", &value ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected float argument" );
-
- self->object->soft->inspring = EXPP_ClampFloat( value,
- EXPP_OBJECT_SBINSPRINGMIN, EXPP_OBJECT_SBINSPRINGMAX );
- self->object->recalc |= OB_RECALC_OB;
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_getSBInnerSpringFriction( BPy_Object * self )
-{
- if( !self->object->soft && !setupSB(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "softbody could not be accessed" );
-
- return PyFloat_FromDouble( ( double ) self->object->soft->infrict );
-}
-
-static PyObject *Object_setSBInnerSpringFriction( BPy_Object * self,
- PyObject * args )
-{
- float value;
-
- if( !self->object->soft && !setupSB(self->object) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "softbody could not be accessed" );
-
- if( !PyArg_ParseTuple( args, "f", &value ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected float argument" );
-
- self->object->soft->infrict = EXPP_ClampFloat( value,
- EXPP_OBJECT_SBINFRICTMIN, EXPP_OBJECT_SBINFRICTMAX );
- self->object->recalc |= OB_RECALC_OB;
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_SetSBUseGoal( BPy_Object * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)Object_setSBUseGoal );
-}
-
-static PyObject *Object_SetSBUseEdges( BPy_Object * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)Object_setSBUseEdges );
-}
-
-static PyObject *Object_SetSBStiffQuads( BPy_Object * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)Object_setSBStiffQuads );
-}
diff --git a/source/blender/python/api2_2x/Object.h b/source/blender/python/api2_2x/Object.h
deleted file mode 100644
index 7891f99da09..00000000000
--- a/source/blender/python/api2_2x/Object.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * $Id: Object.h 10269 2007-03-15 01:09:14Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Michel Selten
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_OBJECT_H
-#define EXPP_OBJECT_H
-
-#include <Python.h>
-#include "DNA_object_types.h"
-
-/* The Object PyType Object defined in Object.c */
-extern PyTypeObject Object_Type;
-
-#define BPy_Object_Check(v) \
- ((v)->ob_type == &Object_Type) /* for type checking */
-
-/*****************************************************************************/
-/* Python BPy_Object structure definition. */
-/*****************************************************************************/
-typedef struct {
- PyObject_HEAD
- struct Object *object; /* libdata must be second */
- short realtype;
-} BPy_Object;
-
-PyObject *Object_Init( void );
-PyObject *Object_CreatePyObject( struct Object *obj );
-Object *Object_FromPyObject( PyObject * py_obj );
-
-void Object_updateDag( void *data );
-
-int EXPP_add_obdata( struct Object *object );
-
-#endif /* EXPP_OBJECT_H */
diff --git a/source/blender/python/api2_2x/Particle.c b/source/blender/python/api2_2x/Particle.c
deleted file mode 100644
index 84c0c727792..00000000000
--- a/source/blender/python/api2_2x/Particle.c
+++ /dev/null
@@ -1,1040 +0,0 @@
-/*
- * $Id: Particle.c 10279 2007-03-16 11:38:02Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Jacques Guignot, Jean-Michel Soler
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include "Particle.h" /*This must come first */
-
-#include "DNA_object_types.h"
-#include "BKE_effect.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_object.h"
-#include "BLI_blenlib.h"
-#include "gen_utils.h"
-
-/*****************************************************************************/
-/* Python API function prototypes for the Particle module. */
-/*****************************************************************************/
-PyObject *M_Particle_New( PyObject * self, PyObject * args );
-PyObject *M_Particle_Get( PyObject * self, PyObject * args );
-
-/*****************************************************************************/
-/* Python BPy_Particle methods declarations: */
-/*****************************************************************************/
-PyObject *Effect_getType( BPy_Effect * self );
-PyObject *Effect_setType( BPy_Effect * self, PyObject * args );
-PyObject *Effect_getFlag( BPy_Effect * self );
-PyObject *Effect_setFlag( BPy_Effect * self, PyObject * args );
-PyObject *Particle_getSta( BPy_Particle * self );
-PyObject *Particle_setSta( BPy_Particle * self, PyObject * a );
-PyObject *Particle_getEnd( BPy_Particle * self );
-PyObject *Particle_setEnd( BPy_Particle * self, PyObject * a );
-PyObject *Particle_getLifetime( BPy_Particle * self );
-PyObject *Particle_setLifetime( BPy_Particle * self, PyObject * a );
-PyObject *Particle_getNormfac( BPy_Particle * self );
-PyObject *Particle_setNormfac( BPy_Particle * self, PyObject * a );
-PyObject *Particle_getObfac( BPy_Particle * self );
-PyObject *Particle_setObfac( BPy_Particle * self, PyObject * a );
-PyObject *Particle_getRandfac( BPy_Particle * self );
-PyObject *Particle_setRandfac( BPy_Particle * self, PyObject * a );
-PyObject *Particle_getTexfac( BPy_Particle * self );
-PyObject *Particle_setTexfac( BPy_Particle * self, PyObject * a );
-PyObject *Particle_getRandlife( BPy_Particle * self );
-PyObject *Particle_setRandlife( BPy_Particle * self, PyObject * a );
-PyObject *Particle_getNabla( BPy_Particle * self );
-PyObject *Particle_setNabla( BPy_Particle * self, PyObject * a );
-PyObject *Particle_getVectsize( BPy_Particle * self );
-PyObject *Particle_setVectsize( BPy_Particle * self, PyObject * a );
-PyObject *Particle_getTotpart( BPy_Particle * self );
-PyObject *Particle_setTotpart( BPy_Particle * self, PyObject * a );
-PyObject *Particle_getTotkey( BPy_Particle * self );
-PyObject *Particle_setTotkey( BPy_Particle * self, PyObject * a );
-PyObject *Particle_getSeed( BPy_Particle * self );
-PyObject *Particle_setSeed( BPy_Particle * self, PyObject * a );
-PyObject *Particle_getForce( BPy_Particle * self );
-PyObject *Particle_setForce( BPy_Particle * self, PyObject * a );
-PyObject *Particle_getMult( BPy_Particle * self );
-PyObject *Particle_setMult( BPy_Particle * self, PyObject * a );
-PyObject *Particle_getLife( BPy_Particle * self );
-PyObject *Particle_setLife( BPy_Particle * self, PyObject * a );
-PyObject *Particle_getMat( BPy_Particle * self );
-PyObject *Particle_setMat( BPy_Particle * self, PyObject * a );
-PyObject *Particle_getChild( BPy_Particle * self );
-PyObject *Particle_setChild( BPy_Particle * self, PyObject * a );
-PyObject *Particle_getDefvec( BPy_Particle * self );
-PyObject *Particle_setDefvec( BPy_Particle * self, PyObject * a );
-
-/*****************************************************************************/
-/* Python Particle_Type callback function prototypes: */
-/*****************************************************************************/
-void ParticleDeAlloc( BPy_Particle * msh );
-//int ParticlePrint (BPy_Particle *msh, FILE *fp, int flags);
-int ParticleSetAttr( BPy_Particle * msh, char *name, PyObject * v );
-PyObject *ParticleGetAttr( BPy_Particle * msh, char *name );
-PyObject *ParticleRepr( void );
-PyObject *ParticleCreatePyObject( struct Effect *particle );
-int ParticleCheckPyObject( PyObject * py_obj );
-struct Particle *ParticleFromPyObject( PyObject * py_obj );
-
-
-/*****************************************************************************/
-/* Python BPy_Particle methods table: */
-/*****************************************************************************/
-static PyMethodDef BPy_Particle_methods[] = {
- {"getType", ( PyCFunction ) Effect_getType,
- METH_NOARGS, "() - Return Effect type"},
- {"setType", ( PyCFunction ) Effect_setType,
- METH_VARARGS, "() - Set Effect type"},
- {"getFlag", ( PyCFunction ) Effect_getFlag,
- METH_NOARGS, "() - Return Effect flag"},
- {"setFlag", ( PyCFunction ) Effect_setFlag,
- METH_VARARGS, "() - Set Effect flag"},
- {"getStartTime", ( PyCFunction ) Particle_getSta,
- METH_NOARGS, "()-Return particle start time"},
- {"setStartTime", ( PyCFunction ) Particle_setSta, METH_VARARGS,
- "()- Sets particle start time"},
- {"getEndTime", ( PyCFunction ) Particle_getEnd,
- METH_NOARGS, "()-Return particle end time"},
- {"setEndTime", ( PyCFunction ) Particle_setEnd, METH_VARARGS,
- "()- Sets particle end time"},
- {"getLifetime", ( PyCFunction ) Particle_getLifetime,
- METH_NOARGS, "()-Return particle life time"},
- {"setLifetime", ( PyCFunction ) Particle_setLifetime, METH_VARARGS,
- "()- Sets particle life time "},
- {"getNormfac", ( PyCFunction ) Particle_getNormfac,
- METH_NOARGS, "()-Return particle life time"},
- {"setNormfac", ( PyCFunction ) Particle_setNormfac, METH_VARARGS,
- "()- Sets particle life time "},
- {"getObfac", ( PyCFunction ) Particle_getObfac,
- METH_NOARGS, "()-Return particle life time"},
- {"setObfac", ( PyCFunction ) Particle_setObfac, METH_VARARGS,
- "()- Sets particle life time "},
- {"getRandfac", ( PyCFunction ) Particle_getRandfac,
- METH_NOARGS, "()-Return particle life time"},
- {"setRandfac", ( PyCFunction ) Particle_setRandfac, METH_VARARGS,
- "()- Sets particle life time "},
- {"getTexfac", ( PyCFunction ) Particle_getTexfac,
- METH_NOARGS, "()-Return particle life time"},
- {"setTexfac", ( PyCFunction ) Particle_setTexfac, METH_VARARGS,
- "()- Sets particle life time "},
- {"getRandlife", ( PyCFunction ) Particle_getRandlife,
- METH_NOARGS, "()-Return particle life time"},
- {"setRandlife", ( PyCFunction ) Particle_setRandlife, METH_VARARGS,
- "()- Sets particle life time "},
- {"getNabla", ( PyCFunction ) Particle_getNabla,
- METH_NOARGS, "()-Return particle life time"},
- {"setNabla", ( PyCFunction ) Particle_setNabla, METH_VARARGS,
- "()- Sets particle life time "},
- {"getVectsize", ( PyCFunction ) Particle_getVectsize,
- METH_NOARGS, "()-Return particle life time"},
- {"setVectsize", ( PyCFunction ) Particle_setVectsize, METH_VARARGS,
- "()- Sets particle life time "},
- {"getTotpart", ( PyCFunction ) Particle_getTotpart,
- METH_NOARGS, "()-Return particle life time"},
- {"setTotpart", ( PyCFunction ) Particle_setTotpart, METH_VARARGS,
- "()- Sets particle life time "},
- {"getTotkey", ( PyCFunction ) Particle_getTotkey,
- METH_NOARGS, "()-Return particle life time"},
- {"setTotkey", ( PyCFunction ) Particle_setTotkey, METH_VARARGS,
- "()- Sets particle life time "},
- {"getSeed", ( PyCFunction ) Particle_getSeed,
- METH_NOARGS, "()-Return particle life time"},
- {"setSeed", ( PyCFunction ) Particle_setSeed, METH_VARARGS,
- "()- Sets particle life time "},
- {"getForce", ( PyCFunction ) Particle_getForce,
- METH_NOARGS, "()-Return particle life time"},
- {"setForce", ( PyCFunction ) Particle_setForce, METH_VARARGS,
- "()- Sets particle life time "},
- {"getMult", ( PyCFunction ) Particle_getMult,
- METH_NOARGS, "()-Return particle life time"},
- {"setMult", ( PyCFunction ) Particle_setMult, METH_VARARGS,
- "()- Sets particle life time "},
- {"getLife", ( PyCFunction ) Particle_getLife,
- METH_NOARGS, "()-Return particle life time"},
- {"setLife", ( PyCFunction ) Particle_setLife, METH_VARARGS,
- "()- Sets particle life time "},
- {"getMat", ( PyCFunction ) Particle_getMat,
- METH_NOARGS, "()-Return particle life time"},
- {"setMat", ( PyCFunction ) Particle_setMat, METH_VARARGS,
- "()- Sets particle life time "},
- {"getChild", ( PyCFunction ) Particle_getChild,
- METH_NOARGS, "()-Return particle life time"},
- {"setChild", ( PyCFunction ) Particle_setChild, METH_VARARGS,
- "()- Sets particle life time "},
- {"getDefvec", ( PyCFunction ) Particle_getDefvec,
- METH_NOARGS, "()-Return particle life time"},
- {"setDefvec", ( PyCFunction ) Particle_setDefvec, METH_VARARGS,
- "()- Sets particle life time "},
-
-
- {NULL, NULL, 0, NULL}
-};
-
-/**************** prototypes ********************/
-PyObject *Particle_Init( void );
-
-
-/*****************************************************************************/
-/* Python Particle_Type structure definition: */
-/*****************************************************************************/
-
-PyTypeObject Particle_Type = {
- PyObject_HEAD_INIT( NULL )
- 0,
- "Particle",
- sizeof( BPy_Particle ),
- 0,
-
- ( destructor ) ParticleDeAlloc,
- 0,
- ( getattrfunc ) ParticleGetAttr,
- ( setattrfunc ) ParticleSetAttr,
- 0,
- ( reprfunc ) ParticleRepr,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0, 0,
- 0,
- 0, 0, 0, 0, 0, 0,
- BPy_Particle_methods,
- 0,
-};
-/*****************************************************************************/
-/* The following string definitions are used for documentation strings. */
-/* In Python these will be written to the console when doing a */
-/* Blender.Particle.__doc__ */
-/*****************************************************************************/
-char M_Particle_doc[] = "The Blender Particle module\n\n\
-This module provides access to **Object Data** in Blender.\n\
-Functions :\n\
- New(object mesh's name) : creates a new part object and adds it to the given mesh object \n\
- Get(name) : retreives a particle with the given name (mandatory)\n\
- get(name) : same as Get. Kept for compatibility reasons.\n";
-char M_Particle_New_doc[] = "New(name) : creates a new part object and adds it to the given mesh object\n";
-char M_Particle_Get_doc[] = "xxx";
-
-
-/*****************************************************************************/
-/* Python method structure definition for Blender.Particle module: */
-/*****************************************************************************/
-struct PyMethodDef M_Particle_methods[] = {
- {"New", ( PyCFunction ) M_Particle_New, METH_VARARGS, M_Particle_New_doc},
- {"Get", M_Particle_Get, METH_VARARGS, M_Particle_Get_doc},
- {"get", M_Particle_Get, METH_VARARGS, M_Particle_Get_doc},
- {NULL, NULL, 0, NULL}
-};
-
-
-/*****************************************************************************/
-/* Function: M_Particle_New */
-/* Python equivalent: Blender.Effect.Particle.New */
-/* Description : Create a particle effect and add a link */
-/* to the given mesh-type Object */
-/* Data : String mesh object name */
-/* Return : pyobject particle */
-/*****************************************************************************/
-PyObject *M_Particle_New( PyObject * self, PyObject * args )
-{
- BPy_Effect *pyeffect;
- Effect *bleffect = 0;
- Object *ob;
- char *name = NULL;
-
- if( !PyArg_ParseTuple( args, "s", &name ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument" );
-
- for( ob = G.main->object.first; ob; ob = ob->id.next )
- if( !strcmp( name, ob->id.name + 2 ) )
- break;
-
- if( !ob )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "object does not exist" );
-
- if( ob->type != OB_MESH )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "object is not a mesh" );
-
- pyeffect = ( BPy_Effect * ) PyObject_NEW( BPy_Effect, &Effect_Type );
- if( !pyeffect )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create Effect Data object" );
-
- bleffect = add_effect( EFF_PARTICLE );
- if( !bleffect ) {
- Py_DECREF( pyeffect );
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't create Effect Data in Blender" );
- }
-
- pyeffect->effect = (PartEff *)bleffect;
- BLI_addtail( &ob->effect, bleffect );
-
- return ( PyObject * ) pyeffect;
-}
-
-/*****************************************************************************/
-/* Function: M_Particle_Get */
-/* Python equivalent: Blender.Effect.Particle.Get */
-/*****************************************************************************/
-PyObject *M_Particle_Get( PyObject * self, PyObject * args )
-{
- /*arguments : string object name
- int : position of effect in the obj's effect list */
- char *name = 0;
- Object *object_iter;
- Effect *eff;
- BPy_Particle *wanted_eff;
- int num, i;
-
- if( !PyArg_ParseTuple( args, "si", &name, &num ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected string int argument" ) );
-
- object_iter = G.main->object.first;
- if( !object_iter )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "Scene contains no object" );
-
- while( object_iter ) {
- if( strcmp( name, object_iter->id.name + 2 ) ) {
- object_iter = object_iter->id.next;
- continue;
- }
-
- if( object_iter->effect.first != NULL ) {
- eff = object_iter->effect.first;
- for( i = 0; i < num; i++ ) {
- if( eff->type != EFF_PARTICLE )
- continue;
- eff = eff->next;
- if( !eff )
- return ( EXPP_ReturnPyObjError
- ( PyExc_AttributeError,
- "Object" ) );
- }
- wanted_eff =
- ( BPy_Particle * ) PyObject_NEW( BPy_Particle,
- &Particle_Type );
- wanted_eff->particle = eff;
- return ( PyObject * ) wanted_eff;
- }
- object_iter = object_iter->id.next;
- }
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-/*****************************************************************************/
-/* Function: Particle_Init */
-/*****************************************************************************/
-PyObject *Particle_Init( void )
-{
- PyObject *submodule;
-
- if( PyType_Ready( &Particle_Type) < 0)
- return NULL;
-
- submodule =
- Py_InitModule3( "Blender.Particle", M_Particle_methods, M_Particle_doc );
- return ( submodule );
-}
-
-/*****************************************************************************/
-/* Python BPy_Particle methods: */
-/*****************************************************************************/
-
-PyObject *Particle_getSta( BPy_Particle * self )
-{
-
- PartEff *ptr = ( PartEff * ) self->particle;
- return PyFloat_FromDouble( ptr->sta );
-}
-
-
-
-PyObject *Particle_setSta( BPy_Particle * self, PyObject * args )
-{
- PartEff *ptr = ( PartEff * ) self->particle;
- float val = 0;
- if( !PyArg_ParseTuple( args, "f", &val ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected float argument" ) );
- ptr->sta = val;
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-PyObject *Particle_getEnd( BPy_Particle * self )
-{
-
- PartEff *ptr = ( PartEff * ) self->particle;
- return PyFloat_FromDouble( ptr->end );
-}
-
-
-
-PyObject *Particle_setEnd( BPy_Particle * self, PyObject * args )
-{
- float val = 0;
- PartEff *ptr = ( PartEff * ) self->particle;
- if( !PyArg_ParseTuple( args, "f", &val ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected float argument" ) );
- ptr->end = val;
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-PyObject *Particle_getLifetime( BPy_Particle * self )
-{
-
- PartEff *ptr = ( PartEff * ) self->particle;
- return PyFloat_FromDouble( ptr->lifetime );
-}
-
-
-
-PyObject *Particle_setLifetime( BPy_Particle * self, PyObject * args )
-{
- PartEff *ptr = ( PartEff * ) self->particle;
- float val = 0;
- if( !PyArg_ParseTuple( args, "f", &val ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected float argument" ) );
- ptr->lifetime = val;
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-
-PyObject *Particle_getNormfac( BPy_Particle * self )
-{
-
- PartEff *ptr = ( PartEff * ) self->particle;
- return PyFloat_FromDouble( ptr->normfac );
-}
-
-
-
-PyObject *Particle_setNormfac( BPy_Particle * self, PyObject * args )
-{
- PartEff *ptr = ( PartEff * ) self->particle;
- float val = 0;
- if( !PyArg_ParseTuple( args, "f", &val ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected float argument" ) );
- ptr->normfac = val;
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-
-
-PyObject *Particle_getObfac( BPy_Particle * self )
-{
-
- PartEff *ptr = ( PartEff * ) self->particle;
- return PyFloat_FromDouble( ptr->obfac );
-}
-
-
-
-PyObject *Particle_setObfac( BPy_Particle * self, PyObject * args )
-{
- float val = 0;
- PartEff *ptr = ( PartEff * ) self->particle;
- if( !PyArg_ParseTuple( args, "f", &val ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected float argument" ) );
- ptr->obfac = val;
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-
-
-PyObject *Particle_getRandfac( BPy_Particle * self )
-{
-
- PartEff *ptr = ( PartEff * ) self->particle;
- return PyFloat_FromDouble( ptr->randfac );
-}
-
-
-
-PyObject *Particle_setRandfac( BPy_Particle * self, PyObject * args )
-{
- float val = 0;
- PartEff *ptr = ( PartEff * ) self->particle;
- if( !PyArg_ParseTuple( args, "f", &val ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected float argument" ) );
- ptr->randfac = val;
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-
-
-PyObject *Particle_getTexfac( BPy_Particle * self )
-{
-
- PartEff *ptr = ( PartEff * ) self->particle;
- return PyFloat_FromDouble( ptr->texfac );
-}
-
-
-
-PyObject *Particle_setTexfac( BPy_Particle * self, PyObject * args )
-{
- PartEff *ptr = ( PartEff * ) self->particle;
- float val = 0;
- if( !PyArg_ParseTuple( args, "f", &val ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected float argument" ) );
- ptr->texfac = val;
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-
-
-PyObject *Particle_getRandlife( BPy_Particle * self )
-{
-
- PartEff *ptr = ( PartEff * ) self->particle;
- return PyFloat_FromDouble( ptr->randlife );
-}
-
-
-
-PyObject *Particle_setRandlife( BPy_Particle * self, PyObject * args )
-{
- PartEff *ptr = ( PartEff * ) self->particle;
- float val = 0;
- if( !PyArg_ParseTuple( args, "f", &val ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected float argument" ) );
- ptr->randlife = val;
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-
-
-PyObject *Particle_getNabla( BPy_Particle * self )
-{
-
- PartEff *ptr = ( PartEff * ) self->particle;
- return PyFloat_FromDouble( ptr->nabla );
-}
-
-
-
-PyObject *Particle_setNabla( BPy_Particle * self, PyObject * args )
-{
- PartEff *ptr = ( PartEff * ) self->particle;
- float val = 0;
- if( !PyArg_ParseTuple( args, "f", &val ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected float argument" ) );
- ptr->nabla = val;
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-
-
-PyObject *Particle_getVectsize( BPy_Particle * self )
-{
-
- PartEff *ptr = ( PartEff * ) self->particle;
- return PyFloat_FromDouble( ptr->vectsize );
-}
-
-
-
-PyObject *Particle_setVectsize( BPy_Particle * self, PyObject * args )
-{
- PartEff *ptr = ( PartEff * ) self->particle;
- float val = 0;
- if( !PyArg_ParseTuple( args, "f", &val ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected float argument" ) );
- ptr->vectsize = val;
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-
-PyObject *Particle_getTotpart( BPy_Particle * self )
-{
-
- PartEff *ptr = ( PartEff * ) self->particle;
- return PyInt_FromLong( ptr->totpart );
-}
-
-
-
-PyObject *Particle_setTotpart( BPy_Particle * self, PyObject * args )
-{
- int val = 0;
- PartEff *ptr = ( PartEff * ) self->particle;
- if( !PyArg_ParseTuple( args, "i", &val ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected int argument" ) );
- ptr->totpart = val;
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-
-PyObject *Particle_getTotkey( BPy_Particle * self )
-{
-
- PartEff *ptr = ( PartEff * ) self->particle;
- return PyInt_FromLong( ptr->totkey );
-}
-
-
-
-PyObject *Particle_setTotkey( BPy_Particle * self, PyObject * args )
-{
- PartEff *ptr = ( PartEff * ) self->particle;
- int val = 0;
- if( !PyArg_ParseTuple( args, "i", &val ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected int argument" ) );
- ptr->totkey = val;
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-
-
-PyObject *Particle_getSeed( BPy_Particle * self )
-{
-
- PartEff *ptr = ( PartEff * ) self->particle;
- return PyInt_FromLong( ptr->seed );
-}
-
-
-
-PyObject *Particle_setSeed( BPy_Particle * self, PyObject * args )
-{
- PartEff *ptr = ( PartEff * ) self->particle;
- int val = 0;
- if( !PyArg_ParseTuple( args, "i", &val ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected int argument" ) );
- ptr->seed = val;
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-PyObject *Particle_getForce( BPy_Particle * self )
-{
-
- PartEff *ptr = ( PartEff * ) self->particle;
- return Py_BuildValue( "(f,f,f)", ptr->force[0], ptr->force[1],
- ptr->force[2] );
-}
-
-
-PyObject *Particle_setForce( BPy_Particle * self, PyObject * args )
-{
- PartEff *ptr = ( PartEff * ) self->particle;
- float val[3];
- if( PyTuple_Size( args ) == 1 )
- args = PyTuple_GetItem( args, 0 );
- val[0] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 0 ) );
- val[1] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 1 ) );
- val[2] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 2 ) );
- /*
- if (!PyArg_ParseTuple(args, "fff", val,val+1,val+2 ))
- return(EXPP_ReturnPyObjError(PyExc_AttributeError,\
- "expected three float arguments"));
- */
- ptr->force[0] = val[0];
- ptr->force[1] = val[1];
- ptr->force[2] = val[2];
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-PyObject *Particle_getMult( BPy_Particle * self )
-{
-
- PartEff *ptr = ( PartEff * ) self->particle;
- return Py_BuildValue( "(f,f,f,f)",
- ptr->mult[0], ptr->mult[1], ptr->mult[2],
- ptr->mult[3] );
-}
-
-
-PyObject *Particle_setMult( BPy_Particle * self, PyObject * args )
-{
- PartEff *ptr = ( PartEff * ) self->particle;
- float val[4];
- if( PyTuple_Size( args ) == 1 )
- args = PyTuple_GetItem( args, 0 );
- val[0] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 0 ) );
- val[1] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 1 ) );
- val[2] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 2 ) );
- val[3] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 3 ) );
- ptr->mult[0] = val[0];
- ptr->mult[1] = val[1];
- ptr->mult[2] = val[2];
- ptr->mult[3] = val[3];
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-
-
-
-PyObject *Particle_getLife( BPy_Particle * self )
-{
-
- PartEff *ptr = ( PartEff * ) self->particle;
- return Py_BuildValue( "(f,f,f,f)",
- ptr->life[0], ptr->life[1], ptr->life[2],
- ptr->life[3] );
-}
-
-
-PyObject *Particle_setLife( BPy_Particle * self, PyObject * args )
-{
- PartEff *ptr = ( PartEff * ) self->particle;
- float val[4];
- if( PyTuple_Size( args ) == 1 )
- args = PyTuple_GetItem( args, 0 );
- val[0] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 0 ) );
- val[1] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 1 ) );
- val[2] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 2 ) );
- val[3] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 3 ) );
- ptr->life[0] = val[0];
- ptr->life[1] = val[1];
- ptr->life[2] = val[2];
- ptr->life[3] = val[3];
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-
-
-PyObject *Particle_getChild( BPy_Particle * self )
-{
-
- PartEff *ptr = ( PartEff * ) self->particle;
- return Py_BuildValue( "(f,f,f,f)",
- ptr->child[0], ptr->child[1], ptr->child[2],
- ptr->child[3] );
-}
-
-
-PyObject *Particle_setChild( BPy_Particle * self, PyObject * args )
-{
- PartEff *ptr = ( PartEff * ) self->particle;
- float val[4];
- if( PyTuple_Size( args ) == 1 )
- args = PyTuple_GetItem( args, 0 );
- val[0] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 0 ) );
- val[1] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 1 ) );
- val[2] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 2 ) );
- val[3] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 3 ) );
- ptr->child[0] = (short)val[0];
- ptr->child[1] = (short)val[1];
- ptr->child[2] = (short)val[2];
- ptr->child[3] = (short)val[3];
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-
-
-PyObject *Particle_getMat( BPy_Particle * self )
-{
-
- PartEff *ptr = ( PartEff * ) self->particle;
- return Py_BuildValue( "(f,f,f,f)",
- ptr->mat[0], ptr->mat[1], ptr->mat[2],
- ptr->mat[3] );
-}
-
-
-PyObject *Particle_setMat( BPy_Particle * self, PyObject * args )
-{
- PartEff *ptr = ( PartEff * ) self->particle;
- float val[4];
- if( PyTuple_Size( args ) == 1 )
- args = PyTuple_GetItem( args, 0 );
- val[0] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 0 ) );
- val[1] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 1 ) );
- val[2] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 2 ) );
- val[3] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 3 ) );
- ptr->mat[0] = (short)val[0];
- ptr->mat[1] = (short)val[1];
- ptr->mat[2] = (short)val[2];
- ptr->mat[3] = (short)val[3];
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-
-PyObject *Particle_getDefvec( BPy_Particle * self )
-{
-
- PartEff *ptr = ( PartEff * ) self->particle;
- return Py_BuildValue( "(f,f,f)",
- ptr->defvec[0], ptr->defvec[1], ptr->defvec[2] );
-}
-
-
-PyObject *Particle_setDefvec( BPy_Particle * self, PyObject * args )
-{
- PartEff *ptr = ( PartEff * ) self->particle;
- float val[3];
- if( PyTuple_Size( args ) == 1 )
- args = PyTuple_GetItem( args, 0 );
- val[0] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 0 ) );
- val[1] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 1 ) );
- val[2] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 2 ) );
- ptr->defvec[0] = val[0];
- ptr->defvec[1] = val[1];
- ptr->defvec[2] = val[2];
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-
-/*****************************************************************************/
-/* Function: ParticleDeAlloc */
-/* Description: This is a callback function for the BPy_Particle type. It is */
-/* the destructor function. */
-/*****************************************************************************/
-void ParticleDeAlloc( BPy_Particle * self )
-{
- PartEff *ptr = ( PartEff * ) self;
- PyObject_DEL( ptr );
-}
-
-/*****************************************************************************/
-/* Function: ParticleGetAttr */
-/* Description: This is a callback function for the BPy_Particle type. It is */
-/* the function that accesses BPy_Particle "member variables" */
-/* and methods. */
-/*****************************************************************************/
-
-
-PyObject *ParticleGetAttr( BPy_Particle * self, char *name )
-{
-
- if( strcmp( name, "seed" ) == 0 )
- return Particle_getSeed( self );
- else if( strcmp( name, "nabla" ) == 0 )
- return Particle_getNabla( self );
- else if( strcmp( name, "sta" ) == 0 )
- return Particle_getSta( self );
- else if( strcmp( name, "end" ) == 0 )
- return Particle_getEnd( self );
- else if( strcmp( name, "lifetime" ) == 0 )
- return Particle_getLifetime( self );
- else if( strcmp( name, "normfac" ) == 0 )
- return Particle_getNormfac( self );
- else if( strcmp( name, "obfac" ) == 0 )
- return Particle_getObfac( self );
- else if( strcmp( name, "randfac" ) == 0 )
- return Particle_getRandfac( self );
- else if( strcmp( name, "texfac" ) == 0 )
- return Particle_getTexfac( self );
- else if( strcmp( name, "randlife" ) == 0 )
- return Particle_getRandlife( self );
- else if( strcmp( name, "vectsize" ) == 0 )
- return Particle_getVectsize( self );
- else if( strcmp( name, "totpart" ) == 0 )
- return Particle_getTotpart( self );
- else if( strcmp( name, "force" ) == 0 )
- return Particle_getForce( self );
- else if( strcmp( name, "mult" ) == 0 )
- return Particle_getMult( self );
- else if( strcmp( name, "life" ) == 0 )
- return Particle_getLife( self );
- else if( strcmp( name, "child" ) == 0 )
- return Particle_getChild( self );
- else if( strcmp( name, "mat" ) == 0 )
- return Particle_getMat( self );
- else if( strcmp( name, "defvec" ) == 0 )
- return Particle_getDefvec( self );
-
-
- return Py_FindMethod( BPy_Particle_methods, ( PyObject * ) self,
- name );
-}
-
-/*****************************************************************************/
-/* Function: ParticleSetAttr */
-/* Description: This is a callback function for the BPy_Particle type. */
-/* It is the function that sets Particle Data attributes */
-/* (member vars) */
-/*****************************************************************************/
-int ParticleSetAttr( BPy_Particle * self, char *name, PyObject * value )
-{
-
- PyObject *valtuple;
- PyObject *error = NULL;
-
- valtuple = Py_BuildValue( "(N)", value );
-
- if( !valtuple )
- return EXPP_ReturnIntError( PyExc_MemoryError,
- "ParticleSetAttr: couldn't create PyTuple" );
-
- if( strcmp( name, "seed" ) == 0 )
- error = Particle_setSeed( self, valtuple );
- else if( strcmp( name, "nabla" ) == 0 )
- error = Particle_setNabla( self, valtuple );
- else if( strcmp( name, "sta" ) == 0 )
- error = Particle_setSta( self, valtuple );
- else if( strcmp( name, "end" ) == 0 )
- error = Particle_setEnd( self, valtuple );
- else if( strcmp( name, "lifetime" ) == 0 )
- error = Particle_setLifetime( self, valtuple );
- else if( strcmp( name, "normfac" ) == 0 )
- error = Particle_setNormfac( self, valtuple );
- else if( strcmp( name, "obfac" ) == 0 )
- error = Particle_setObfac( self, valtuple );
- else if( strcmp( name, "randfac" ) == 0 )
- error = Particle_setRandfac( self, valtuple );
- else if( strcmp( name, "texfac" ) == 0 )
- error = Particle_setTexfac( self, valtuple );
- else if( strcmp( name, "randlife" ) == 0 )
- error = Particle_setRandlife( self, valtuple );
- else if( strcmp( name, "nabla" ) == 0 )
- error = Particle_setNabla( self, valtuple );
- else if( strcmp( name, "vectsize" ) == 0 )
- error = Particle_setVectsize( self, valtuple );
- else if( strcmp( name, "totpart" ) == 0 )
- error = Particle_setTotpart( self, valtuple );
- else if( strcmp( name, "seed" ) == 0 )
- error = Particle_setSeed( self, valtuple );
- else if( strcmp( name, "force" ) == 0 )
- error = Particle_setForce( self, valtuple );
- else if( strcmp( name, "mult" ) == 0 )
- error = Particle_setMult( self, valtuple );
- else if( strcmp( name, "life" ) == 0 )
- error = Particle_setLife( self, valtuple );
- else if( strcmp( name, "child" ) == 0 )
- error = Particle_setChild( self, valtuple );
- else if( strcmp( name, "mat" ) == 0 )
- error = Particle_setMat( self, valtuple );
- else if( strcmp( name, "defvec" ) == 0 )
- error = Particle_setDefvec( self, valtuple );
-
- else {
- Py_DECREF( valtuple );
-
- if( ( strcmp( name, "Types" ) == 0 ) ||
- ( strcmp( name, "Modes" ) == 0 ) )
- return ( EXPP_ReturnIntError( PyExc_AttributeError,
- "constant dictionary -- cannot be changed" ) );
-
- else
- return ( EXPP_ReturnIntError( PyExc_KeyError,
- "attribute not found" ) );
- }
-
- Py_DECREF(valtuple);
- if( error != Py_None )
- return -1;
-
- Py_DECREF( Py_None );
- return 0;
-}
-
-/*****************************************************************************/
-/* Function: ParticlePrint */
-/* Description: This is a callback function for the BPy_Particle type. It */
-/* particles a meaninful string to 'print' particle objects. */
-/*****************************************************************************/
-/*
-int ParticlePrint(BPy_Particle *self, FILE *fp, int flags)
-{
- printf("Hi, I'm a particle!");
- return 0;
-}
-*/
-/*****************************************************************************/
-/* Function: ParticleRepr */
-/* Description: This is a callback function for the BPy_Particle type. It */
-/* particles a meaninful string to represent particle objects. */
-/*****************************************************************************/
-PyObject *ParticleRepr( void )
-{
- return PyString_FromString( "Particle" );
-}
-
-PyObject *ParticleCreatePyObject( struct Effect * particle )
-{
- BPy_Particle *blen_object;
-
-
- blen_object =
- ( BPy_Particle * ) PyObject_NEW( BPy_Particle,
- &Particle_Type );
-
- if( blen_object == NULL ) {
- return ( NULL );
- }
- blen_object->particle = particle;
- return ( ( PyObject * ) blen_object );
-
-}
-
-int ParticleCheckPyObject( PyObject * py_obj )
-{
- return ( py_obj->ob_type == &Particle_Type );
-}
-
-
-struct Particle *ParticleFromPyObject( PyObject * py_obj )
-{
- BPy_Particle *blen_obj;
-
- blen_obj = ( BPy_Particle * ) py_obj;
- return ( ( struct Particle * ) blen_obj->particle );
-
-}
diff --git a/source/blender/python/api2_2x/Particle.h b/source/blender/python/api2_2x/Particle.h
deleted file mode 100644
index 73b5363dac6..00000000000
--- a/source/blender/python/api2_2x/Particle.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * $Id: Particle.h 5702 2005-11-04 20:34:38Z khughes $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Jacques Guignot
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#ifndef EXPP_PARTICLE_H
-#define EXPP_PARTICLE_H
-
-#include <Python.h>
-#include "DNA_effect_types.h"
-
-extern PyTypeObject Particle_Type;
-
-#define BPy_Particle_Check(v) ((v)->ob_type==&Particle_Type)
-
-/* Python BPy_Particle structure definition */
-typedef struct {
- PyObject_HEAD /* required py macro */
- Effect * particle;
-} BPy_Particle;
-
-#include "Effect.h"
-
-/*****************************************************************************/
-/* Python Particle_Type callback function prototypes: */
-/*****************************************************************************/
-#if 0
-void ParticleDeAlloc( BPy_Particle * msh );
-//int ParticlePrint (BPy_Particle *msh, FILE *fp, int flags);
-int ParticleSetAttr( BPy_Particle * msh, char *name, PyObject * v );
-PyObject *ParticleGetAttr( BPy_Particle * msh, char *name );
-PyObject *ParticleRepr( void );
-PyObject *ParticleCreatePyObject( struct Effect *particle );
-int ParticleCheckPyObject( PyObject * py_obj );
-struct Particle *ParticleFromPyObject( PyObject * py_obj );
-#endif
-
-
-
-#endif /* EXPP_PARTICLE_H */
diff --git a/source/blender/python/api2_2x/Pose.c b/source/blender/python/api2_2x/Pose.c
deleted file mode 100644
index 01fbe591a74..00000000000
--- a/source/blender/python/api2_2x/Pose.c
+++ /dev/null
@@ -1,1395 +0,0 @@
-/*
- * $Id:
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * Contributor(s): Joseph Gilbert
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#include "Pose.h"
-
-
-#include "mydevice.h"
-#include "BKE_armature.h"
-#include "BKE_main.h"
-#include "BKE_global.h"
-#include "BKE_action.h"
-#include "BKE_utildefines.h"
-#include "BIF_editaction.h"
-#include "BIF_space.h"
-#include "BIF_poseobject.h"
-#include "BKE_depsgraph.h"
-#include "DNA_object_types.h"
-#include "DNA_ipo_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_space_types.h" //1 - this order
-#include "BSE_editipo.h" //2
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "Mathutils.h"
-#include "Object.h"
-#include "Constraint.h"
-#include "NLA.h"
-#include "gen_utils.h"
-#include "gen_library.h"
-
-#include "DNA_armature_types.h" /*used for pose bone select*/
-
-#include "MEM_guardedalloc.h"
-
-extern void chan_calc_mat(bPoseChannel *chan);
-
-//------------------------ERROR CODES---------------------------------
-//This is here just to make me happy and to have more consistant error strings :)
-static const char sPoseError[] = "Pose - Error: ";
-//static const char sPoseBadArgs[] = "Pose - Bad Arguments: ";
-static const char sPoseBoneError[] = "PoseBone - Error: ";
-//static const char sPoseBoneBadArgs[] = "PoseBone - Bad Arguments: ";
-static const char sPoseBonesDictError[] = "PoseBone - Error: ";
-//static const char sPoseBonesDictBadArgs[] = "PoseBone - Bad Arguments: ";
-
-//################## PoseBonesDict_Type (internal) ########################
-/*This is an internal psuedo-dictionary type that allows for manipulation
-* of posechannels inside of a pose structure. It is a subobject of pose.
-* i.e. Pose.bones['key']*/
-//################################################################
-
-//------------------METHOD IMPLEMENTATIONS-----------------------------
-//------------------------Pose.bones.items()
-//Returns a list of key:value pairs like dict.items()
-static PyObject* PoseBonesDict_items(BPy_PoseBonesDict *self)
-{
- return PyDict_Items(self->bonesMap);
-}
-//------------------------Pose.bones.keys()
-//Returns a list of keys like dict.keys()
-static PyObject* PoseBonesDict_keys(BPy_PoseBonesDict *self)
-{
- return PyDict_Keys(self->bonesMap);
-}
-//------------------------Armature.bones.values()
-//Returns a list of values like dict.values()
-static PyObject* PoseBonesDict_values(BPy_PoseBonesDict *self)
-{
- return PyDict_Values(self->bonesMap);
-}
-//------------------ATTRIBUTE IMPLEMENTATION---------------------------
-//------------------TYPE_OBECT IMPLEMENTATION-----------------------
-//------------------------tp_doc
-//The __doc__ string for this object
-static char BPy_PoseBonesDict_doc[] = "This is an internal subobject of pose\
-designed to act as a Py_PoseBone dictionary.";
-
-//------------------------tp_methods
-//This contains a list of all methods the object contains
-static PyMethodDef BPy_PoseBonesDict_methods[] = {
- {"items", (PyCFunction) PoseBonesDict_items, METH_NOARGS,
- "() - Returns the key:value pairs from the dictionary"},
- {"keys", (PyCFunction) PoseBonesDict_keys, METH_NOARGS,
- "() - Returns the keys the dictionary"},
- {"values", (PyCFunction) PoseBonesDict_values, METH_NOARGS,
- "() - Returns the values from the dictionary"},
- {NULL, NULL, 0, NULL}
-};
-//-----------------(internal)
-static int PoseBoneMapping_Init(PyObject *dictionary, ListBase *posechannels){
- bPoseChannel *pchan = NULL;
- PyObject *py_posechannel = NULL;
-
- for (pchan = posechannels->first; pchan; pchan = pchan->next){
- py_posechannel = PyPoseBone_FromPosechannel(pchan);
- if (!py_posechannel)
- return -1;
-
- if(PyDict_SetItemString(dictionary,
- pchan->name, py_posechannel) == -1){
- return -1;
- }
- Py_DECREF(py_posechannel);
- }
- return 0;
-}
-
-//----------------- BonesDict_InitBones
-static int PoseBonesDict_InitBones(BPy_PoseBonesDict *self)
-{
- PyDict_Clear(self->bonesMap);
- if (PoseBoneMapping_Init(self->bonesMap, self->bones) == -1)
- return 0;
- return 1;
-}
-
-//------------------------tp_repr
-//This is the string representation of the object
-static PyObject *PoseBonesDict_repr(BPy_PoseBonesDict *self)
-{
- char buffer[128], *str;
- PyObject *key, *value;
- int pos = 0;
-
- /* probably a bit of overkill but better then crashing */
- str = MEM_mallocN( 64 + ( PyDict_Size( self->bonesMap ) * 128), "PoseBonesDict_repr" );
- str[0] = '\0';
-
- sprintf(buffer, "[Pose Bone Dict: {");
- strcat(str,buffer);
- while (PyDict_Next(self->bonesMap, &pos, &key, &value)) {
- sprintf(buffer, "%s : %s, ", PyString_AsString(key),
- PyString_AsString(value->ob_type->tp_repr(value)));
- strcat(str,buffer);
- }
- sprintf(buffer, "}]\n");
- strcat(str,buffer);
-
- MEM_freeN( str );
-
- return PyString_FromString(str);
-}
-
-//------------------------tp_dealloc
-//This tells how to 'tear-down' our object when ref count hits 0
-static void PoseBonesDict_dealloc(BPy_PoseBonesDict * self)
-{
- Py_DECREF(self->bonesMap);
- PoseBonesDict_Type.tp_free(self);
- return;
-}
-//------------------------mp_length
-//This gets the size of the dictionary
-static int PoseBonesDict_len(BPy_PoseBonesDict *self)
-{
- return BLI_countlist(self->bones);
-}
-//-----------------------mp_subscript
-//This defines getting a bone from the dictionary - x = Bones['key']
-static PyObject *PoseBonesDict_GetItem(BPy_PoseBonesDict *self, PyObject* key)
-{
- PyObject *value = NULL;
-
- value = PyDict_GetItem(self->bonesMap, key);
- if(value == NULL)
- Py_RETURN_NONE;
-
- return EXPP_incr_ret(value);
-}
-//------------------TYPE_OBECT DEFINITION--------------------------
-//Mapping Protocol
-static PyMappingMethods PoseBonesDict_MapMethods = {
- (inquiry) PoseBonesDict_len, //mp_length
- (binaryfunc)PoseBonesDict_GetItem, //mp_subscript
- 0, //mp_ass_subscript
-};
-//PoseBonesDict TypeObject
-PyTypeObject PoseBonesDict_Type = {
- PyObject_HEAD_INIT(NULL) //tp_head
- 0, //tp_internal
- "PoseBonesDict", //tp_name
- sizeof(BPy_PoseBonesDict), //tp_basicsize
- 0, //tp_itemsize
- (destructor)PoseBonesDict_dealloc, //tp_dealloc
- 0, //tp_print
- 0, //tp_getattr
- 0, //tp_setattr
- 0, //tp_compare
- (reprfunc) PoseBonesDict_repr, //tp_repr
- 0, //tp_as_number
- 0, //tp_as_sequence
- &PoseBonesDict_MapMethods, //tp_as_mapping
- 0, //tp_hash
- 0, //tp_call
- 0, //tp_str
- 0, //tp_getattro
- 0, //tp_setattro
- 0, //tp_as_buffer
- Py_TPFLAGS_DEFAULT, //tp_flags
- BPy_PoseBonesDict_doc, //tp_doc
- 0, //tp_traverse
- 0, //tp_clear
- 0, //tp_richcompare
- 0, //tp_weaklistoffset
- 0, //tp_iter
- 0, //tp_iternext
- BPy_PoseBonesDict_methods, //tp_methods
- 0, //tp_members
- 0, //tp_getset
- 0, //tp_base
- 0, //tp_dict
- 0, //tp_descr_get
- 0, //tp_descr_set
- 0, //tp_dictoffset
- 0, //tp_init
- 0, //tp_alloc
- 0, //tp_new
- 0, //tp_free
- 0, //tp_is_gc
- 0, //tp_bases
- 0, //tp_mro
- 0, //tp_cache
- 0, //tp_subclasses
- 0, //tp_weaklist
- 0 //tp_del
-};
-//-----------------------PyPoseBonesDict_FromPyPose
-static PyObject *PyPoseBonesDict_FromPyPose(BPy_Pose *py_pose)
-{
- BPy_PoseBonesDict *py_posebonesdict = NULL;
-
- //create py object
- py_posebonesdict = (BPy_PoseBonesDict *)PoseBonesDict_Type.tp_alloc(&PoseBonesDict_Type, 0);
- if (!py_posebonesdict)
- goto RuntimeError;
-
- //create internal dictionaries
- py_posebonesdict->bonesMap = PyDict_New();
- if (!py_posebonesdict->bonesMap)
- goto RuntimeError;
-
- //set listbase pointer
- py_posebonesdict->bones = &py_pose->pose->chanbase;
-
- //now that everything is setup - init the mappings
- if (!PoseBonesDict_InitBones(py_posebonesdict))
- goto RuntimeError;
-
- return (PyObject*)py_posebonesdict;
-
-RuntimeError:
- return EXPP_objError(PyExc_RuntimeError, "%s%s",
- sPoseBonesDictError, "Failed to create class");
-}
-
-//################## Pose_Type ##########################
-/*This type is a wrapper for a pose*/
-//####################################################
-//------------------METHOD IMPLEMENTATIONS------------------------------
-static PyObject *Pose_update(BPy_Pose *self)
-{
- Object *daddy = NULL;
-
- self->pose->flag |= POSE_RECALC;
-
- for (daddy = G.main->object.first; daddy; daddy = daddy->id.next){
- if (daddy->pose == self->pose){
- break;
- }
- }
-
- if(daddy)
- where_is_pose(daddy);
-
- Py_RETURN_NONE;
-}
-//------------------------tp_methods
-//This contains a list of all methods the object contains
-static PyMethodDef BPy_Pose_methods[] = {
- {"update", (PyCFunction) Pose_update, METH_NOARGS,
- "() - Rebuilds the pose with new values"},
- {NULL, NULL, 0, NULL}
-};
-//------------------ATTRIBUTE IMPLEMENTATIONS---------------------------
-//------------------------Pose.bones (getter)
-//Gets the bones attribute
-static PyObject *Pose_getBoneDict(BPy_Pose *self, void *closure)
-{
- return EXPP_incr_ret((PyObject*)self->Bones);
-}
-//------------------------Pose.bones (setter)
-//Sets the bones attribute
-static int Pose_setBoneDict(BPy_Pose *self, PyObject *value, void *closure)
-{
- goto AttributeError;
-
-AttributeError:
- return EXPP_intError(PyExc_AttributeError, "%s%s",
- sPoseError, "You are not allowed to change the .bones attribute");
-}
-//------------------TYPE_OBECT IMPLEMENTATION---------------------------
-//------------------------tp_getset
-//This contains methods for attributes that require checking
-static PyGetSetDef BPy_Pose_getset[] = {
- {"bones", (getter)Pose_getBoneDict, (setter)Pose_setBoneDict,
- "The pose's Bone dictionary", NULL},
- {NULL, NULL, NULL, NULL, NULL}
-};
-//------------------------tp_dealloc
-//This tells how to 'tear-down' our object when ref count hits 0
-static void Pose_dealloc(BPy_Pose *self)
-{
- Py_DECREF(self->Bones);
- Pose_Type.tp_free(self);
- return;
-}
-//------------------------tp_cmp
-//This compares 2 pose types
-static int Pose_compare(BPy_Pose *a, BPy_Pose *b )
-{
- return ( a->pose== b->pose ) ? 0 : -1;
-}
-//------------------------tp_repr
-//This is the string representation of the object
-static PyObject *Pose_repr(BPy_Pose *self)
-{
- return PyString_FromFormat( "[Pose \"%s\"]", self->name);
-}
-//------------------------tp_doc
-//The __doc__ string for this object
-static char BPy_Pose_doc[] = "This object wraps a Blender Pose object.";
-
-//------------------TYPE_OBECT DEFINITION--------------------------
-PyTypeObject Pose_Type = {
- PyObject_HEAD_INIT(NULL) //tp_head
- 0, //tp_internal
- "Pose", //tp_name
- sizeof(BPy_Pose), //tp_basicsize
- 0, //tp_itemsize
- (destructor)Pose_dealloc, //tp_dealloc
- 0, //tp_print
- 0, //tp_getattr
- 0, //tp_setattr
- (cmpfunc)Pose_compare, //tp_compare
- (reprfunc)Pose_repr, //tp_repr
- 0, //tp_as_number
- 0, //tp_as_sequence
- 0, //tp_as_mapping
- 0, //tp_hash
- 0, //tp_call
- 0, //tp_str
- 0, //tp_getattro
- 0, //tp_setattro
- 0, //tp_as_buffer
- Py_TPFLAGS_DEFAULT, //tp_flags
- BPy_Pose_doc, //tp_doc
- 0, //tp_traverse
- 0, //tp_clear
- 0, //tp_richcompare
- 0, //tp_weaklistoffset
- 0, //tp_iter
- 0, //tp_iternext
- BPy_Pose_methods, //tp_methods
- 0, //tp_members
- BPy_Pose_getset, //tp_getset
- 0, //tp_base
- 0, //tp_dict
- 0, //tp_descr_get
- 0, //tp_descr_set
- 0, //tp_dictoffset
- 0, //tp_init
- 0, //tp_alloc
- 0, //tp_new
- 0, //tp_free
- 0, //tp_is_gc
- 0, //tp_bases
- 0, //tp_mro
- 0, //tp_cache
- 0, //tp_subclasses
- 0, //tp_weaklist
- 0 //tp_del
-};
-//################## PoseBone_Type #####################
-/*This type is a wrapper for a posechannel*/
-//####################################################
-//------------------METHOD IMPLEMENTATIONS------------------------------
-//------------------------------PoseBone.insertKey()
-static PyObject *PoseBone_insertKey(BPy_PoseBone *self, PyObject *args)
-{
- PyObject *parent_object = NULL;
- PyObject *constants = NULL, *item = NULL;
- int frame = 1, oldframe, length, x, numeric_value = 0, oldflag, no_ipo_update = 0;
- bPoseChannel *pchan = NULL;
-
-
- if (!PyArg_ParseTuple(args, "O!i|Oi", &Object_Type, &parent_object, &frame, &constants, &no_ipo_update ))
- goto AttributeError;
-
- /* incase we ever have a value other then 1 for fast */
- if (no_ipo_update)
- no_ipo_update = 1;
-
- //verify that this pchannel is part of the object->pose
- for (pchan = ((BPy_Object*)parent_object)->object->pose->chanbase.first;
- pchan; pchan = pchan->next){
- if (pchan == self->posechannel)
- break;
- }
- if (!pchan)
- goto AttributeError2;
-
- //verify that there is an action bound to this object
- if (!((BPy_Object*)parent_object)->object->action){
- goto AttributeError5;
- }
-
- oldflag = self->posechannel->flag;
- self->posechannel->flag = 0;
- //set the flags for this posechannel
- if (constants){
- if(PySequence_Check(constants)){
- length = PySequence_Length(constants);
- for (x = 0; x < length; x++){
- item = PySequence_GetItem(constants, x);
- if (item == EXPP_GetModuleConstant("Blender.Object.Pose", "ROT")){
- numeric_value |= POSE_ROT;
- }else if (item == EXPP_GetModuleConstant("Blender.Object.Pose", "LOC")){
- numeric_value |= POSE_LOC;
- }else if (item == EXPP_GetModuleConstant("Blender.Object.Pose", "SIZE")){
- numeric_value |= POSE_SIZE;
- }else{
- Py_DECREF(item);
- self->posechannel->flag = (short)oldflag;
- goto AttributeError4;
- }
- Py_DECREF(item);
- }
- self->posechannel->flag = (short)numeric_value;
- }else if (BPy_Constant_Check(constants)){
- if (constants == EXPP_GetModuleConstant("Blender.Object.Pose", "ROT")){
- numeric_value |= POSE_ROT;
- }else if (constants == EXPP_GetModuleConstant("Blender.Object.Pose", "LOC")){
- numeric_value |= POSE_LOC;
- }else if (constants == EXPP_GetModuleConstant("Blender.Object.Pose", "SIZE")){
- numeric_value |= POSE_SIZE;
- }else{
- self->posechannel->flag = (short)oldflag;
- goto AttributeError4;
- }
- self->posechannel->flag = (short)numeric_value;
- }else{
- goto AttributeError3;
- }
- }else{ //nothing passed so set them all
- self->posechannel->flag |= POSE_ROT;
- self->posechannel->flag |= POSE_LOC;
- self->posechannel->flag |= POSE_SIZE;
- }
-
- //set the frame we want insertion on
- oldframe = G.scene->r.cfra;
- G.scene->r.cfra = frame;
-
- //add the action channel if it's not there
- verify_action_channel(((BPy_Object*)parent_object)->object->action,
- self->posechannel->name);
-
- //insert the pose keys
- if (self->posechannel->flag & POSE_ROT){
- insertkey(&((BPy_Object*)parent_object)->object->id,
- ID_PO, self->posechannel->name, NULL, AC_QUAT_X, no_ipo_update);
- insertkey(&((BPy_Object*)parent_object)->object->id,
- ID_PO, self->posechannel->name, NULL, AC_QUAT_Y, no_ipo_update);
- insertkey(&((BPy_Object*)parent_object)->object->id,
- ID_PO, self->posechannel->name, NULL, AC_QUAT_Z, no_ipo_update);
- insertkey(&((BPy_Object*)parent_object)->object->id,
- ID_PO, self->posechannel->name, NULL, AC_QUAT_W, no_ipo_update);
- }
- if (self->posechannel->flag & POSE_LOC){
- insertkey(&((BPy_Object*)parent_object)->object->id,
- ID_PO, self->posechannel->name, NULL, AC_LOC_X, no_ipo_update);
- insertkey(&((BPy_Object*)parent_object)->object->id,
- ID_PO, self->posechannel->name, NULL, AC_LOC_Y, no_ipo_update);
- insertkey(&((BPy_Object*)parent_object)->object->id,
- ID_PO, self->posechannel->name, NULL, AC_LOC_Z, no_ipo_update);
- }
- if (self->posechannel->flag & POSE_SIZE){
- insertkey(&((BPy_Object*)parent_object)->object->id,
- ID_PO, self->posechannel->name, NULL, AC_SIZE_X, no_ipo_update);
- insertkey(&((BPy_Object*)parent_object)->object->id,
- ID_PO, self->posechannel->name, NULL, AC_SIZE_Y, no_ipo_update);
- insertkey(&((BPy_Object*)parent_object)->object->id,
- ID_PO, self->posechannel->name, NULL, AC_SIZE_Z, no_ipo_update);
- }
-
- //flip the frame back
- G.scene->r.cfra = oldframe;
-
- //update the IPOs
- if (no_ipo_update==0)
- remake_action_ipos (((BPy_Object*)parent_object)->object->action);
-
- Py_RETURN_NONE;
-
-AttributeError:
- return EXPP_objError(PyExc_AttributeError, "%s%s%s",
- sPoseBoneError, ".insertKey: ", "expects an Object, int, (optional) constants");
-AttributeError2:
- return EXPP_objError(PyExc_AttributeError, "%s%s%s",
- sPoseBoneError, ".insertKey: ", "wrong object detected. \
- Use the object this pose came from");
-AttributeError3:
- return EXPP_objError(PyExc_AttributeError, "%s%s%s",
- sPoseBoneError, ".insertKey: ", "Expects a constant or list of constants");
-AttributeError4:
- return EXPP_objError(PyExc_AttributeError, "%s%s%s",
- sPoseBoneError, ".insertKey: ", "Please use a constant defined in the Pose module");
-AttributeError5:
- return EXPP_objError(PyExc_AttributeError, "%s%s%s",
- sPoseBoneError, ".insertKey: ", "You must set up and link an Action to this object first");
-}
-//------------------------tp_methods
-//This contains a list of all methods the object contains
-static PyMethodDef BPy_PoseBone_methods[] = {
- {"insertKey", (PyCFunction) PoseBone_insertKey, METH_VARARGS,
- "() - insert a key for this pose into an action"},
- {NULL, NULL, 0, NULL}
-};
-//------------------ATTRIBUTE IMPLEMENTATIONS---------------------------
-//------------------------PoseBone.name (getter)
-//Gets the name attribute
-static PyObject *PoseBone_getName(BPy_PoseBone *self, void *closure)
-{
- return PyString_FromString(self->posechannel->name);
-}
-//------------------------PoseBone.name (setter)
-//Sets the name attribute
-static int PoseBone_setName(BPy_PoseBone *self, PyObject *value, void *closure)
-{
- char *name = "";
-
- if (!PyArg_Parse(value, "s", &name))
- goto AttributeError;
-
- BLI_strncpy(self->posechannel->name, name, 32);
- return 0;
-
-AttributeError:
- return EXPP_intError(PyExc_AttributeError, "%s%s%s",
- sPoseBoneError, ".name: ", "expects a string");
-}
-//------------------------PoseBone.loc (getter)
-//Gets the loc attribute
-static PyObject *PoseBone_getLoc(BPy_PoseBone *self, void *closure)
-{
- return newVectorObject(self->posechannel->loc, 3, Py_WRAP);
-}
-//------------------------PoseBone.loc (setter)
-//Sets the loc attribute
-static int PoseBone_setLoc(BPy_PoseBone *self, PyObject *value, void *closure)
-{
- VectorObject *vec = NULL;
- int x;
-
- if (!PyArg_Parse(value, "O!", &vector_Type, &vec))
- goto AttributeError;
- if (vec->size != 3)
- goto AttributeError;
-
- for (x = 0; x < 3; x++){
- self->posechannel->loc[x] = vec->vec[x];
- }
- return 0;
-
-AttributeError:
- return EXPP_intError(PyExc_AttributeError, "%s%s%s",
- sPoseBoneError, ".loc: ", "expects a 3d vector object");
-}
-//------------------------PoseBone.size (getter)
-//Gets the size attribute
-static PyObject *PoseBone_getSize(BPy_PoseBone *self, void *closure)
-{
- return newVectorObject(self->posechannel->size, 3, Py_WRAP);
-}
-//------------------------PoseBone.size (setter)
-//Sets the size attribute
-static int PoseBone_setSize(BPy_PoseBone *self, PyObject *value, void *closure)
-{
- VectorObject *vec = NULL;
- int x;
-
- if (!PyArg_Parse(value, "O!", &vector_Type, &vec))
- goto AttributeError;
- if (vec->size != 3)
- goto AttributeError;
-
- for (x = 0; x < 3; x++){
- self->posechannel->size[x] = vec->vec[x];
- }
- return 0;
-
-AttributeError:
- return EXPP_intError(PyExc_AttributeError, "%s%s%s",
- sPoseBoneError, ".size: ", "expects a 3d vector object");
-}
-//------------------------PoseBone.quat (getter)
-//Gets the quat attribute
-static PyObject *PoseBone_getQuat(BPy_PoseBone *self, void *closure)
-{
- return newQuaternionObject(self->posechannel->quat, Py_WRAP);
-}
-//------------------------PoseBone.quat (setter)
-//Sets the quat attribute
-static int PoseBone_setQuat(BPy_PoseBone *self, PyObject *value, void *closure)
-{
- QuaternionObject *quat = NULL;
- int x;
-
- if (!PyArg_Parse(value, "O!", &quaternion_Type, &quat))
- goto AttributeError;
-
- for (x = 0; x < 4; x++){
- self->posechannel->quat[x] = quat->quat[x];
- }
- return 0;
-
-AttributeError:
- return EXPP_intError(PyExc_AttributeError, "%s%s%s",
- sPoseBoneError, ".quat: ", "expects a quaternion object");
-}
-//------------------------PoseBone.localMatrix (getter)
-//Gets the chan_mat
-static PyObject *PoseBone_getLocalMatrix(BPy_PoseBone *self, void *closure)
-{
- return newMatrixObject((float*)self->posechannel->chan_mat, 4, 4, Py_WRAP);
-}
-//------------------------PoseBone.localMatrix (setter)
-//Sets the chan_mat
-static int PoseBone_setLocalMatrix(BPy_PoseBone *self, PyObject *value, void *closure)
-{
- MatrixObject *matrix = NULL;
- float size[3], quat[4], loc[3];
- float mat3[3][3], mat4[4][4];
- int matsize = 0;
-
- if (!PyArg_Parse(value, "O!", &matrix_Type, &matrix))
- goto AttributeError;
-
- if (matrix->rowSize == 3 && matrix->colSize == 3){
- matsize = 3;
- Mat3CpyMat3(mat3, (float(*)[3])*matrix->matrix);
- }else if (matrix->rowSize == 4 && matrix->colSize == 4){
- matsize = 4;
- Mat4CpyMat4(mat4, (float(*)[4])*matrix->matrix);
- }
-
- if (matsize != 3 && matsize != 4){
- goto AttributeError;
- }
-
- //get size and rotation
- if (matsize == 3){
- Mat3ToSize(mat3, size);
- Mat3Ortho(mat3);
- Mat3ToQuat(mat3, quat);
- }else if (matsize == 4){
- Mat4ToSize(mat4, size);
- Mat4Ortho(mat4);
- Mat4ToQuat(mat4, quat);
- }
-
- //get loc
- if (matsize == 4) {
- VECCOPY(loc, matrix->matrix[3]);
- }
- else {
- loc[0]= loc[1]= loc[2]= 0.0f;
- }
-
- //copy new attributes
- VECCOPY(self->posechannel->size, size);
- QUATCOPY(self->posechannel->quat, quat);
- if (matsize == 4){
- VECCOPY(self->posechannel->loc, loc);
- }
-
- //rebuild matrix
- chan_calc_mat(self->posechannel);
- return 0;
-
-AttributeError:
- return EXPP_intError(PyExc_AttributeError, "%s%s%s",
- sPoseBoneError, ".localMatrix: ", "expects a 3x3 or 4x4 matrix object");
-}
-//------------------------PoseBone.poseMatrix (getter)
-//Gets the pose_mat
-static PyObject *PoseBone_getPoseMatrix(BPy_PoseBone *self, void *closure)
-{
- return newMatrixObject((float*)self->posechannel->pose_mat, 4, 4, Py_WRAP);
-}
-//------------------------PoseBone.poseMatrix (setter)
-//Sets the pose_mat
-static int PoseBone_setPoseMatrix(BPy_PoseBone *self, MatrixObject *value, void *closure)
-{
- float delta_mat[4][4], quat[4]; /* rotation */
- float size[4]; /* size only */
-
- if( !MatrixObject_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected matrix object as argument" );
-
- if( value->colSize != 4 || value->rowSize != 4 )
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "matrix must be a 4x4 transformation matrix\n"
- "for example as returned by object.matrixWorld" );
-
- /* get bone-space cursor matrix and extract location */
- armature_mat_pose_to_bone(self->posechannel, (float (*)[4]) *value->matrix, delta_mat);
-
- /* Visual Location */
- VECCOPY(self->posechannel->loc, delta_mat[3]);
-
- /* Visual Size */
- Mat4ToSize(delta_mat, size);
- VECCOPY(self->posechannel->size, size);
-
- /* Visual Rotation */
- Mat4ToQuat(delta_mat, quat);
- QUATCOPY(self->posechannel->quat, quat);
-
- return 0;
-}
-//------------------------PoseBone.constraints (getter)
-//Gets the constraints sequence
-static PyObject *PoseBone_getConstraints(BPy_PoseBone *self, void *closure)
-{
- return PoseConstraintSeq_CreatePyObject( self->posechannel );
-}
-//------------------------PoseBone.limitmin (getter)
-//Gets the pose bone limitmin value
-static PyObject *PoseBone_getLimitMin(BPy_PoseBone *self, void *closure)
-{
- float mylimitmin[3];
- Object *obj = NULL;
-
- obj = Object_FromPoseChannel(self->posechannel);
- if (obj==NULL){
- return EXPP_ReturnPyObjError(PyExc_AttributeError, "Bone data is not found");
- }
- mylimitmin[0]=0.0f;
- mylimitmin[1]=0.0f;
- mylimitmin[2]=0.0f;
- if(pose_channel_in_IK_chain(obj, self->posechannel)){
- if ((self->posechannel->ikflag & BONE_IK_NO_XDOF)==0) {
- if ((self->posechannel->ikflag & BONE_IK_XLIMIT)) {
- mylimitmin[0] = self->posechannel->limitmin[0];
- }
- }
- if ((self->posechannel->ikflag & BONE_IK_NO_YDOF)==0) {
- if ((self->posechannel->ikflag & BONE_IK_YLIMIT)) {
- mylimitmin[1] = self->posechannel->limitmin[1];
- }
- }
- if ((self->posechannel->ikflag & BONE_IK_NO_ZDOF)==0) {
- if ((self->posechannel->ikflag & BONE_IK_ZLIMIT)) {
- mylimitmin[2] = self->posechannel->limitmin[2];
- }
- }
- }
- return newVectorObject(mylimitmin, 3, Py_NEW);
-}
-//------------------------PoseBone.limitmin (setter)
-//Sets the pose bone limitmin value
-static int PoseBone_setLimitMin(BPy_PoseBone *self, PyObject *value, void *closure)
-{
- float newlimitmin[3];
- int x;
- Object *obj = NULL;
- if(!PySequence_Check(value)){
- return EXPP_ReturnIntError(PyExc_AttributeError, "Argument is not a sequence");
- }
- if (PySequence_Size(value) !=3){
- return EXPP_ReturnIntError(PyExc_AttributeError, "Argument size must be 3");
- }
- newlimitmin[0]=0.0f;
- newlimitmin[1]=0.0f;
- newlimitmin[2]=0.0f;
- for (x = 0; x<3;x++){
- PyObject *item;
- item = PySequence_GetItem(value, x); //new reference
- if (PyFloat_Check(item)){
- newlimitmin[x] = (float)PyFloat_AsDouble(item);
- }else if (PyInt_Check(item)){
- newlimitmin[x] = (float)PyInt_AsLong(item);
- }
- Py_DECREF(item);
- }
- obj = Object_FromPoseChannel(self->posechannel);
- if (obj==NULL){
- return EXPP_ReturnIntError(PyExc_AttributeError, "Bone data is not found");
- }
- if(!pose_channel_in_IK_chain(obj, self->posechannel)){
- return EXPP_ReturnIntError(PyExc_AttributeError, "Bone is not part of an IK chain");
- }
- if ((self->posechannel->ikflag & BONE_IK_NO_XDOF)==0) {
- if ((self->posechannel->ikflag & BONE_IK_XLIMIT)) {
- self->posechannel->limitmin[0] = EXPP_ClampFloat(newlimitmin[0], -180.0f, 0.0f);
- }
- }
- if ((self->posechannel->ikflag & BONE_IK_NO_YDOF)==0) {
- if ((self->posechannel->ikflag & BONE_IK_YLIMIT)) {
- self->posechannel->limitmin[1] = EXPP_ClampFloat(newlimitmin[1], -180.0f, 0.0f);
- }
- }
- if ((self->posechannel->ikflag & BONE_IK_NO_ZDOF)==0) {
- if ((self->posechannel->ikflag & BONE_IK_ZLIMIT)) {
- self->posechannel->limitmin[2] = EXPP_ClampFloat(newlimitmin[2], -180.0f, 0.0f);
- }
- }
- DAG_object_flush_update(G.scene, obj, OB_RECALC_DATA);
- return 0;
-}
-
-//------------------------PoseBone.limitmax (getter)
-//Gets the pose bone limitmax value
-static PyObject *PoseBone_getLimitMax(BPy_PoseBone *self, void *closure)
-{
- float mylimitmax[3];
- Object *obj = NULL;
-
- obj = Object_FromPoseChannel(self->posechannel);
- if (obj==NULL){
- return EXPP_ReturnPyObjError(PyExc_AttributeError, "Bone data is not found");
- }
- mylimitmax[0]=0.0f;
- mylimitmax[1]=0.0f;
- mylimitmax[2]=0.0f;
- if(pose_channel_in_IK_chain(obj, self->posechannel)){
- if ((self->posechannel->ikflag & BONE_IK_NO_XDOF)==0) {
- if ((self->posechannel->ikflag & BONE_IK_XLIMIT)) {
- mylimitmax[0] = self->posechannel->limitmax[0];
- }
- }
- if ((self->posechannel->ikflag & BONE_IK_NO_YDOF)==0) {
- if ((self->posechannel->ikflag & BONE_IK_YLIMIT)) {
- mylimitmax[1] = self->posechannel->limitmax[1];
- }
- }
- if ((self->posechannel->ikflag & BONE_IK_NO_ZDOF)==0) {
- if ((self->posechannel->ikflag & BONE_IK_ZLIMIT)) {
- mylimitmax[2] = self->posechannel->limitmax[2];
- }
- }
- }
- return newVectorObject(mylimitmax, 3, Py_NEW);
-}
-//------------------------PoseBone.limitmax (setter)
-//Sets the pose bone limitmax value
-static int PoseBone_setLimitMax(BPy_PoseBone *self, PyObject *value, void *closure)
-{
- float newlimitmax[3];
- int x;
- Object *obj = NULL;
- if(!PySequence_Check(value)){
- return EXPP_ReturnIntError(PyExc_AttributeError, "Argument is not a sequence");
- }
- if (PySequence_Size(value) !=3){
- return EXPP_ReturnIntError(PyExc_AttributeError, "Argument size must be 3");
- }
- newlimitmax[0]=0.0f;
- newlimitmax[1]=0.0f;
- newlimitmax[2]=0.0f;
- for (x = 0; x<3;x++){
- PyObject *item;
- item = PySequence_GetItem(value, x); //new reference
- if (PyFloat_Check(item)){
- newlimitmax[x] = (float)PyFloat_AsDouble(item);
- }else if (PyInt_Check(item)){
- newlimitmax[x] = (float)PyInt_AsLong(item);
- }
- Py_DECREF(item);
- }
- obj = Object_FromPoseChannel(self->posechannel);
- if (obj==NULL){
- return EXPP_ReturnIntError(PyExc_AttributeError, "Bone data is not found");
- }
- if(!pose_channel_in_IK_chain(obj, self->posechannel)){
- return EXPP_ReturnIntError(PyExc_AttributeError, "Bone is not part of an IK chain");
- }
- if ((self->posechannel->ikflag & BONE_IK_NO_XDOF)==0) {
- if ((self->posechannel->ikflag & BONE_IK_XLIMIT)) {
- self->posechannel->limitmax[0] = EXPP_ClampFloat(newlimitmax[0], 0.0f, 180.0f);
- }
- }
- if ((self->posechannel->ikflag & BONE_IK_NO_YDOF)==0) {
- if ((self->posechannel->ikflag & BONE_IK_YLIMIT)) {
- self->posechannel->limitmax[1] = EXPP_ClampFloat(newlimitmax[1], 0.0f, 180.0f);
- }
- }
- if ((self->posechannel->ikflag & BONE_IK_NO_ZDOF)==0) {
- if ((self->posechannel->ikflag & BONE_IK_ZLIMIT)) {
- self->posechannel->limitmax[2] = EXPP_ClampFloat(newlimitmax[2], 0.0f, 180.0f);
- }
- }
- DAG_object_flush_update(G.scene, obj, OB_RECALC_DATA);
- return 0;
-}
-//------------------------PoseBone.head (getter)
-//Gets the pose head position
-static PyObject *PoseBone_getHead(BPy_PoseBone *self, void *closure)
-{
- return newVectorObject(self->posechannel->pose_head, 3, Py_NEW);
-}
-//------------------------PoseBone.head (setter)
-//Sets the pose head position
-static int PoseBone_setHead(BPy_PoseBone *self, PyObject *value, void *closure)
-{
- return EXPP_intError(PyExc_AttributeError, "%s%s%s",
- sPoseBoneError, ".head: ", "not able to set this property");
-}
-//------------------------PoseBone.tail (getter)
-//Gets the pose tail position
-static PyObject *PoseBone_getTail(BPy_PoseBone *self, void *closure)
-{
- return newVectorObject(self->posechannel->pose_tail, 3, Py_NEW);
-}
-//------------------------PoseBone.tail (setter)
-//Sets the pose tail position
-static int PoseBone_setTail(BPy_PoseBone *self, PyObject *value, void *closure)
-{
- return EXPP_intError(PyExc_AttributeError, "%s%s%s",
- sPoseBoneError, ".tail: ", "not able to set this property");
-}
-//------------------------PoseBone.sel (getter)
-//Gets the pose bones selection
-static PyObject *PoseBone_getSelect(BPy_PoseBone *self, void *closure)
-{
- if (self->posechannel->bone->flag & BONE_SELECTED)
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
-}
-//------------------------PoseBone.sel (setter)
-//Sets the pose bones selection
-static int PoseBone_setSelect(BPy_PoseBone *self, PyObject *value, void *closure)
-{
- int param = PyObject_IsTrue( value );
- if( param == -1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected True/False or 0/1" );
-
- if ( param )
- self->posechannel->bone->flag |= BONE_SELECTED;
- else
- self->posechannel->bone->flag &= ~(BONE_SELECTED | BONE_ACTIVE);
- return 0;
-}
-
-
-//------------------------PoseBone.parent (getter)
-//Gets the bones parent if any
-static PyObject *PoseBone_getParent(BPy_PoseBone *self, void *closure)
-{
- if (self->posechannel->parent)
- return PyPoseBone_FromPosechannel(self->posechannel->parent);
- else
- Py_RETURN_NONE;
-}
-
-//------------------------PoseBone.displayObject (getter)
-//Gets the pose bones object used for display
-static PyObject *PoseBone_getDisplayObject(BPy_PoseBone *self, void *closure)
-{
- if (self->posechannel->custom)
- return Object_CreatePyObject(self->posechannel->custom);
- else
- Py_RETURN_NONE;
-}
-
-//------------------------PoseBone.displayObject (setter)
-//Sets the pose bones object used for display
-static int PoseBone_setDisplayObject(BPy_PoseBone *self, PyObject *value, void *closure)
-{
- return GenericLib_assignData(value, (void **) &self->posechannel->custom, 0, 0, ID_OB, 0);
-}
-
-//------------------------PoseBone.hasIK (getter)
-//Returns True/False if the bone has IK's
-static PyObject *PoseBone_hasIK(BPy_PoseBone *self, void *closure)
-{
- Object *obj = NULL;
-
- obj = Object_FromPoseChannel(self->posechannel);
- if (obj==NULL)
- Py_RETURN_FALSE;
-
- if( pose_channel_in_IK_chain(obj, self->posechannel) )
- Py_RETURN_TRUE;
-
- Py_RETURN_FALSE;
-}
-
-//------------------------PoseBone.stretch (getter)
-//Gets the pose bones IK Stretch value
-static PyObject *PoseBone_getStretch(BPy_PoseBone *self, void *closure)
-{
- return PyFloat_FromDouble( self->posechannel->ikstretch );
-}
-
-//------------------------PoseBone.stretch (setter)
-//Sets the pose bones IK Stretch value
-static int PoseBone_setStretch(BPy_PoseBone *self, PyObject *value, void *closure)
-{
- float ikstretch;
-
- if( !PyNumber_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected float argument" );
-
- ikstretch = (float)PyFloat_AsDouble(value);
- if (ikstretch<0) ikstretch = 0.0;
- if (ikstretch>1) ikstretch = 1.0;
- self->posechannel->ikstretch = ikstretch;
- return 0;
-}
-
-//------------------------PoseBone.stiffX/Y/Z (getter)
-//Gets the pose bones IK stiffness
-static PyObject *PoseBone_getStiff(BPy_PoseBone *self, void *axis)
-{
- return PyFloat_FromDouble( self->posechannel->stiffness[(int)axis] );
-}
-
-//------------------------PoseBone.stiffX/Y/Z (setter)
-//Sets the pose bones IK stiffness
-static int PoseBone_setStiff(BPy_PoseBone *self, PyObject *value, void *axis)
-{
- float stiff;
-
- if( !PyNumber_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected float argument" );
-
- stiff = (float)PyFloat_AsDouble(value);
- if (stiff<0) stiff = 0;
- if (stiff>0.990) stiff = 0.990f;
- self->posechannel->stiffness[(int)axis] = stiff;
- return 0;
-}
-
-//------------------------PoseBone.* (getter)
-//Gets the pose bones flag
-/*
-static PyObject *PoseBone_getFlag(BPy_PoseBone *self, void *flag)
-{
- if (self->posechannel->flag & (int)flag)
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
-
-}
-*/
-
-//------------------------PoseBone.* (setter)
-//Gets the pose bones flag
-/*
-static int PoseBone_setFlag(BPy_PoseBone *self, PyObject *value, void *flag)
-{
- if ( PyObject_IsTrue(value) )
- self->posechannel->flag |= (int)flag;
- else
- self->posechannel->flag &= ~(int)flag;
- return 0;
-}
-*/
-
-//------------------------PoseBone.* (getter)
-//Gets the pose bones ikflag
-static PyObject *PoseBone_getIKFlag(BPy_PoseBone *self, void *flag)
-{
- if (self->posechannel->ikflag & (int)flag)
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
-
-}
-
-//------------------------PoseBone.* (setter)
-//Sets the pose bones ikflag
-static int PoseBone_setIKFlag(BPy_PoseBone *self, PyObject *value, void *flag)
-{
- int param = PyObject_IsTrue( value );
- if( param == -1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected True/False or 0/1" );
-
- if ( param )
- self->posechannel->ikflag |= (int)flag;
- else
- self->posechannel->ikflag &= ~(int)flag;
- return 0;
-}
-
-//------------------------Bone.layerMask (get)
-static PyObject *PoseBone_getLayerMask(BPy_PoseBone *self)
-{
- /* do this extra stuff because the short's bits can be negative values */
- unsigned short laymask = 0;
- laymask |= self->posechannel->bone->layer;
- return PyInt_FromLong((int)laymask);
-}
-//------------------------Bone.layerMask (set)
-static int PoseBone_setLayerMask(BPy_PoseBone *self, PyObject *value)
-{
- int laymask;
- if (!PyInt_Check(value)) {
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "expected an integer (bitmask) as argument" );
- }
-
- laymask = PyInt_AsLong(value);
-
- if (laymask <= 0 || laymask > (1<<16) - 1)
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "bitmask must have from 1 up to 16 bits set");
-
- self->posechannel->bone->layer = 0;
- self->posechannel->bone->layer |= laymask;
-
- return 0;
-}
-
-//------------------TYPE_OBECT IMPLEMENTATION---------------------------
-//------------------------tp_getset
-//This contains methods for attributes that require checking
-static PyGetSetDef BPy_PoseBone_getset[] = {
- {"name", (getter)PoseBone_getName, (setter)PoseBone_setName,
- "The pose bone's name", NULL},
- {"loc", (getter)PoseBone_getLoc, (setter)PoseBone_setLoc,
- "The pose bone's change in location as a vector", NULL},
- {"size", (getter)PoseBone_getSize, (setter)PoseBone_setSize,
- "The pose bone's change in size as a vector", NULL},
- {"quat", (getter)PoseBone_getQuat, (setter)PoseBone_setQuat,
- "The pose bone's change in rotation as a quat", NULL},
- {"localMatrix", (getter)PoseBone_getLocalMatrix, (setter)PoseBone_setLocalMatrix,
- "The pose bone's change matrix built from the quat, loc, and size", NULL},
- {"poseMatrix", (getter)PoseBone_getPoseMatrix, (setter)PoseBone_setPoseMatrix,
- "The pose bone's matrix", NULL},
- {"head", (getter)PoseBone_getHead, (setter)PoseBone_setHead,
- "The pose bone's head positon", NULL},
- {"tail", (getter)PoseBone_getTail, (setter)PoseBone_setTail,
- "The pose bone's tail positon", NULL},
- {"sel", (getter)PoseBone_getSelect, (setter)PoseBone_setSelect,
- "The pose selection state", NULL},
- {"limitMin", (getter)PoseBone_getLimitMin, (setter)PoseBone_setLimitMin,
- "The pose bone dof min", NULL},
- {"limitMax", (getter)PoseBone_getLimitMax, (setter)PoseBone_setLimitMax,
- "The pose bone dof max", NULL},
- {"constraints", (getter)PoseBone_getConstraints, (setter)NULL,
- "The list of contraints that pertain to this pose bone", NULL},
- {"parent", (getter)PoseBone_getParent, (setter)NULL,
- "The bones parent (read only for posebones)", NULL},
- {"displayObject", (getter)PoseBone_getDisplayObject, (setter)PoseBone_setDisplayObject,
- "The poseMode object to draw in place of this bone", NULL},
-
- {"hasIK", (getter)PoseBone_hasIK, (setter)NULL,
- "True if the pose bone has IK (readonly)", NULL },
-
- {"stretch", (getter)PoseBone_getStretch, (setter)PoseBone_setStretch,
- "Stretch the bone to the IK Target", NULL },
-
- {"stiffX", (getter)PoseBone_getStiff, (setter)PoseBone_setStiff,
- "bones stiffness on the X axis", (void *)0 },
- {"stiffY", (getter)PoseBone_getStiff, (setter)PoseBone_setStiff,
- "bones stiffness on the Y axis", (void *)1 },
- {"stiffZ", (getter)PoseBone_getStiff, (setter)PoseBone_setStiff,
- "bones stiffness on the Z axis", (void *)2 },
-
- {"limitX", (getter)PoseBone_getIKFlag, (setter)PoseBone_setIKFlag,
- "limit rotation over X axis when part of an IK", (void *)BONE_IK_XLIMIT },
- {"limitY", (getter)PoseBone_getIKFlag, (setter)PoseBone_setIKFlag,
- "limit rotation over Y axis when part of an IK", (void *)BONE_IK_YLIMIT },
- {"limitZ", (getter)PoseBone_getIKFlag, (setter)PoseBone_setIKFlag,
- "limit rotation over Z axis when part of an IK", (void *)BONE_IK_ZLIMIT },
-
- {"lockXRot", (getter)PoseBone_getIKFlag, (setter)PoseBone_setIKFlag,
- "disable X DoF when part of an IK", (void *)BONE_IK_NO_XDOF },
- {"lockYRot", (getter)PoseBone_getIKFlag, (setter)PoseBone_setIKFlag,
- "disable Y DoF when part of an IK", (void *)BONE_IK_NO_YDOF },
- {"lockZRot", (getter)PoseBone_getIKFlag, (setter)PoseBone_setIKFlag,
- "disable Z DoF when part of an IK", (void *)BONE_IK_NO_ZDOF },
- {"layerMask", (getter)PoseBone_getLayerMask, (setter)PoseBone_setLayerMask,
- "Layer bitmask", NULL },
- {NULL, NULL, NULL, NULL, NULL}
-};
-//------------------------tp_dealloc
-//This tells how to 'tear-down' our object when ref count hits 0
-static void PoseBone_dealloc(BPy_PoseBone *self)
-{
- PoseBone_Type.tp_free(self);
- return;
-}
-//------------------------tp_repr
-//This is the string representation of the object
-static PyObject *PoseBone_repr(BPy_PoseBone *self)
-{
- return PyString_FromFormat( "[PoseBone \"%s\"]", self->posechannel->name);
-}
-//------------------------tp_doc
-//The __doc__ string for this object
-static char BPy_PoseBone_doc[] = "This object wraps a Blender PoseBone object.";
-
-//------------------TYPE_OBECT DEFINITION--------------------------
-PyTypeObject PoseBone_Type = {
- PyObject_HEAD_INIT(NULL) //tp_head
- 0, //tp_internal
- "PoseBone", //tp_name
- sizeof(BPy_PoseBone), //tp_basicsize
- 0, //tp_itemsize
- (destructor)PoseBone_dealloc, //tp_dealloc
- 0, //tp_print
- 0, //tp_getattr
- 0, //tp_setattr
- 0, //tp_compare
- (reprfunc)PoseBone_repr, //tp_repr
- 0, //tp_as_number
- 0, //tp_as_sequence
- 0, //tp_as_mapping
- 0, //tp_hash
- 0, //tp_call
- 0, //tp_str
- 0, //tp_getattro
- 0, //tp_setattro
- 0, //tp_as_buffer
- Py_TPFLAGS_DEFAULT, //tp_flags
- BPy_PoseBone_doc, //tp_doc
- 0, //tp_traverse
- 0, //tp_clear
- 0, //tp_richcompare
- 0, //tp_weaklistoffset
- 0, //tp_iter
- 0, //tp_iternext
- BPy_PoseBone_methods, //tp_methods
- 0, //tp_members
- BPy_PoseBone_getset, //tp_getset
- 0, //tp_base
- 0, //tp_dict
- 0, //tp_descr_get
- 0, //tp_descr_set
- 0, //tp_dictoffset
- 0, //tp_init
- 0, //tp_alloc
- 0, //tp_new
- 0, //tp_free
- 0, //tp_is_gc
- 0, //tp_bases
- 0, //tp_mro
- 0, //tp_cache
- 0, //tp_subclasses
- 0, //tp_weaklist
- 0 //tp_del
-};
-//-------------------MODULE METHODS IMPLEMENTATION------------------------
-//-------------------MODULE METHODS DEFINITION-----------------------------
-struct PyMethodDef M_Pose_methods[] = {
- {NULL, NULL, 0, NULL}
-};
-//-------------------MODULE INITIALIZATION--------------------------------
-PyObject *Pose_Init(void)
-{
- PyObject *module;
-
- //Initializes TypeObject.ob_type
- if (PyType_Ready(&Pose_Type) < 0 || PyType_Ready(&PoseBone_Type) < 0 ||
- PyType_Ready(&PoseBonesDict_Type) < 0) {
- Py_RETURN_NONE;
- }
-
- //Register the module
- module = Py_InitModule3("Blender.Object.Pose", M_Pose_methods,
- "The Blender Pose module");
-
- //Add TYPEOBJECTS to the module
- PyModule_AddObject(module, "Pose",
- EXPP_incr_ret((PyObject *)&Pose_Type)); //*steals*
- PyModule_AddObject(module, "PoseBone",
- EXPP_incr_ret((PyObject *)&PoseBone_Type)); //*steals*
-
- //Add CONSTANTS to the module
- PyModule_AddObject(module, "ROT",
- PyConstant_NewInt("ROT", POSE_ROT));
- PyModule_AddObject(module, "LOC",
- PyConstant_NewInt("LOC", POSE_LOC));
- PyModule_AddObject(module, "SIZE",
- PyConstant_NewInt("SIZE", POSE_SIZE));
-
- return module;
-}
-//------------------VISIBLE PROTOTYPE IMPLEMENTATION-----------------------
-//------------------------------PyPose_FromPose (internal)
-//Returns a PyPose from a bPose - return PyNone if bPose is NULL
-PyObject *PyPose_FromPose(bPose *pose, char *name)
-{
- BPy_Pose *py_pose = NULL;
-
- if (pose){
- py_pose = (BPy_Pose*)Pose_Type.tp_alloc(&Pose_Type, 0);
- if (!py_pose)
- goto RuntimeError;
-
- py_pose->pose = pose;
- BLI_strncpy(py_pose->name, name, 24);
-
- //create armature.bones
- py_pose->Bones = (BPy_PoseBonesDict*)PyPoseBonesDict_FromPyPose(py_pose);
- if (!py_pose->Bones)
- goto RuntimeError;
-
- return (PyObject*)py_pose;
- }else{
- Py_RETURN_NONE;
- }
-
-RuntimeError:
- return EXPP_objError(PyExc_RuntimeError, "%s%s%s",
- sPoseError, "PyPose_FromPose: ", "Internal Error Ocurred");
-}
-//------------------------------PyPoseBone_FromPosechannel (internal)
-//Returns a PyPoseBone from a bPoseChannel - return PyNone if bPoseChannel is NULL
-PyObject *PyPoseBone_FromPosechannel(bPoseChannel *pchan)
-{
- BPy_PoseBone *py_posechannel = NULL;
-
- if (pchan){
- py_posechannel = (BPy_PoseBone*)PoseBone_Type.tp_alloc(&PoseBone_Type, 0);
- if (!py_posechannel)
- goto RuntimeError;
- py_posechannel->posechannel = pchan;
- return (PyObject*)py_posechannel;
- }else{
- Py_RETURN_NONE;
- }
-
-RuntimeError:
- return EXPP_objError(PyExc_RuntimeError, "%s%s%s",
- sPoseBoneError, "PyPoseBone_FromPosechannel: ", "Internal Error Ocurred");
-}
-//------------------------------Object_FromPoseChannel (internal)
-//An ugly method for determining where the pchan chame from
-Object *Object_FromPoseChannel(bPoseChannel *curr_pchan)
-{
- int success = 0;
- Object *obj = NULL;
- bPoseChannel *pchan = NULL;
- for(obj = G.main->object.first; obj; obj = obj->id.next){
- if (obj->pose){
- for (pchan = obj->pose->chanbase.first; pchan; pchan = pchan->next){
- if (curr_pchan == pchan){
- success = 1;
- break;
- }
- }
- if (success)
- break;
- }
- }
- return obj;
-}
diff --git a/source/blender/python/api2_2x/Pose.h b/source/blender/python/api2_2x/Pose.h
deleted file mode 100644
index 17a9f871ee3..00000000000
--- a/source/blender/python/api2_2x/Pose.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * $Id:
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * Contributor(s): Joseph Gilbert
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_POSE_H
-#define EXPP_POSE_H
-
-#include <Python.h>
-#include "DNA_action_types.h"
-#include "DNA_object_types.h"
-
-//-------------------TYPE CHECKS---------------------------------
-#define BPy_Pose_Check(v) ((v)->ob_type == &Pose_Type)
-#define BPy_PoseBone_Check(v) ((v)->ob_type == &PoseBone_Type)
-#define BPy_PoseBonesDict_Check(v) ((v)->ob_type == &PoseBonesDict_Type)
-//-------------------TYPEOBJECT----------------------------------
-extern PyTypeObject Pose_Type;
-extern PyTypeObject PoseBone_Type;
-extern PyTypeObject PoseBonesDict_Type;
-//-------------------STRUCT DEFINITION----------------------------
-typedef struct {
- PyObject_HEAD
- PyObject *bonesMap;
- ListBase *bones;
-} BPy_PoseBonesDict;
-
-typedef struct {
- PyObject_HEAD
- bPose *pose;
- char name[24]; //because poses have not names :(
- BPy_PoseBonesDict *Bones;
-} BPy_Pose;
-
-typedef struct {
- PyObject_HEAD
- bPoseChannel *posechannel;
-
-} BPy_PoseBone;
-
-//-------------------VISIBLE PROTOTYPES-------------------------
-PyObject *Pose_Init(void);
-PyObject *PyPose_FromPose(bPose *pose, char *name);
-PyObject *PyPoseBone_FromPosechannel(bPoseChannel *pchan);
-Object *Object_FromPoseChannel(bPoseChannel *curr_pchan);
-#endif
diff --git a/source/blender/python/api2_2x/Registry.c b/source/blender/python/api2_2x/Registry.c
deleted file mode 100644
index 4eb4fd93294..00000000000
--- a/source/blender/python/api2_2x/Registry.c
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * $Id: Registry.c 4803 2005-07-18 03:50:37Z ascotan $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#include "Registry.h" /*This must come first */
-
-#include "BKE_global.h"
-#include "gen_utils.h"
-
-
-/* the Registry dictionary */
-PyObject *bpy_registryDict = NULL;
-
-/*****************************************************************************/
-/* Python API function prototypes for the Registry module. */
-/*****************************************************************************/
-static PyObject *M_Registry_Keys( PyObject * self );
-static PyObject *M_Registry_GetKey( PyObject * self, PyObject * args );
-static PyObject *M_Registry_SetKey( PyObject * self, PyObject * args );
-static PyObject *M_Registry_RemoveKey( PyObject * self, PyObject * args );
-
-/*****************************************************************************/
-/* The following string definitions are used for documentation strings. */
-/* In Python these will be written to the console when doing a */
-/* Blender.Registry.__doc__ */
-/*****************************************************************************/
-char M_Registry_doc[] =
- "The Blender Registry module (persistent data cache)\n\n\
- Use this module to store configuration data that a script can reload\n\
- when it is executed again.\n";
-
-char M_Registry_Keys_doc[] =
- "() - Get all keys in the Registry dictionary.\n\n\
- Each key references another dict with saved data from a specific script.\n";
-
-char M_Registry_GetKey_doc[] =
- "(name, disk = False) - Get an entry (a dict) from the Registry dictionary\n\
- (name) - a string that references a specific script;\n\
- (disk = False) - search on the user (if available) or default scripts config\n\
-data dir.\n";
-
-char M_Registry_SetKey_doc[] =
- "(key, dict, disk = False) - Store an entry in the Registry dictionary.\n\
- If an entry with the same 'key' already exists, it is substituted.\n\
- (key) - the string to use as a key for the dict being saved.\n\
- (dict) - a dictionary with the data to be stored.\n\
- (disk = False) - also write data as a config file inside the user (if\n\
-available) or default scripts config data dir.\n";
-
-char M_Registry_RemoveKey_doc[] =
- "(key, disk = False) - Remove the dict with key 'key' from the Registry.\n\
- (key) - the name of the key to delete;\n\
- (disk = False) - if True the respective config file is also deleted.\n";
-
-/*****************************************************************************/
-/* Python method structure definition for Blender.Registry module: */
-/*****************************************************************************/
-struct PyMethodDef M_Registry_methods[] = {
- {"Keys", ( PyCFunction ) M_Registry_Keys, METH_VARARGS,
- M_Registry_Keys_doc},
- {"GetKey", M_Registry_GetKey, METH_VARARGS, M_Registry_GetKey_doc},
- {"SetKey", M_Registry_SetKey, METH_VARARGS, M_Registry_SetKey_doc},
- {"RemoveKey", M_Registry_RemoveKey, METH_VARARGS,
- M_Registry_RemoveKey_doc},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Function: M_Registry_Keys */
-/* Python equivalent: Blender.Registry.Keys */
-/*****************************************************************************/
-PyObject *M_Registry_Keys( PyObject * self )
-{
- PyObject *pydict = NULL;
-
- if( !bpy_registryDict )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "No Registry dictionary found!" );
-
- pydict = PyDict_Keys( bpy_registryDict );
-
- if( !pydict )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "Registry_Keys: couldn't get keys" );
-
- return pydict;
-}
-
-/*****************************************************************************/
-/* Function: M_Registry_GetKey */
-/* Python equivalent: Blender.Registry.GetKey */
-/*****************************************************************************/
-static PyObject *M_Registry_GetKey( PyObject * self, PyObject * args )
-{
- PyObject *pyentry = NULL;
- PyObject *pydict = NULL;
- int disk = 0;
-
- if( !bpy_registryDict )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "No Registry dictionary found!" );
-
- if( !PyArg_ParseTuple( args, "O!|i", &PyString_Type, &pyentry, &disk ) )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected a string and optionally a bool" );
-
- pydict = PyDict_GetItem( bpy_registryDict, pyentry ); /* borrowed ... */
-
- if (!pydict) {
- if (disk > 0) {
- /* try to get data from disk */
- char buf[256];
- PyOS_snprintf(buf, sizeof(buf),
- "import Blender, BPyRegistry; BPyRegistry.LoadConfigData('%s')",
- PyString_AsString(pyentry));
- if (!PyRun_SimpleString(buf))
- pydict = PyDict_GetItem(bpy_registryDict, pyentry);
- else PyErr_Clear();
- }
-
- if (!pydict) /* no need to return a KeyError, since without doubt */
- pydict = Py_None; /* Py_None means no key (all valid keys are dicts) */
- }
-
- return EXPP_incr_ret (pydict); /* ... so we incref it */
-}
-
-/*****************************************************************************/
-/* Function: M_Registry_SetKey */
-/* Python equivalent: Blender.Registry.SetKey */
-/*****************************************************************************/
-static PyObject *M_Registry_SetKey( PyObject * self, PyObject * args )
-{
- PyObject *pystr = NULL;
- PyObject *pydict = NULL;
- int disk = 0;
-
- if( !bpy_registryDict )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "No Registry dictionary found!" );
-
- if( !PyArg_ParseTuple( args, "O!O!|i",
- &PyString_Type, &pystr, &PyDict_Type,
- &pydict, &disk ) )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected a string and a dictionary" );
-
- if( PyDict_SetItem( bpy_registryDict, pystr, pydict ) ) /* 0 on success */
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "Registry_SetKey: couldn't update the Registry dict" );
-
- if (disk) {
- /* try to save data to disk */
- char buf[256];
- PyOS_snprintf(buf, sizeof(buf),
- "import Blender, BPyRegistry; BPyRegistry.SaveConfigData('%s')",
- PyString_AsString(pystr));
- if (PyRun_SimpleString(buf) != 0) {
- PyErr_Clear();
- if (G.f & G_DEBUG)
- fprintf(stderr, "\nCan't save script configuration data!\n");
- }
- }
-
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-/*****************************************************************************/
-/* Function: M_Registry_RemoveKey */
-/* Python equivalent: Blender.Registry.RemoveKey */
-/*****************************************************************************/
-static PyObject *M_Registry_RemoveKey( PyObject * self, PyObject * args )
-{
- PyObject *pystr = NULL;
- int disk = 0;
-
- if( !bpy_registryDict )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "No Registry dictionary found!" );
-
- if( !PyArg_ParseTuple( args, "O!|i", &PyString_Type, &pystr, &disk ) )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected a string and optionally a bool" );
-
- if( PyDict_DelItem( bpy_registryDict, pystr ) ) /* returns 0 on success */
- return EXPP_ReturnPyObjError( PyExc_KeyError,
- "no such key in the Registry" );
- else if (disk) {
- /* try to delete from disk too */
- char buf[256];
- PyOS_snprintf(buf, sizeof(buf),
- "import Blender, BPyRegistry; BPyRegistry.RemoveConfigData('%s')",
- PyString_AsString(pystr));
- if (PyRun_SimpleString(buf) != 0) {
- PyErr_Clear();
- if (G.f & G_DEBUG)
- fprintf(stderr, "\nCan't remove script configuration data file!\n");
- }
- }
-
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-/*****************************************************************************/
-/* Function: Registry_Init */
-/*****************************************************************************/
-PyObject *Registry_Init( void )
-{
- PyObject *submodule;
-
- submodule = Py_InitModule3( "Blender.Registry", M_Registry_methods,
- M_Registry_doc );
-
- return submodule;
-}
diff --git a/source/blender/python/api2_2x/Registry.h b/source/blender/python/api2_2x/Registry.h
deleted file mode 100644
index 58cfe65dfd0..00000000000
--- a/source/blender/python/api2_2x/Registry.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * $Id: Registry.h 3209 2004-10-07 19:25:40Z stiv $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-/* This submodule was introduced as a way to preserve configured data in
- * scripts. A very simple idea: the script writer saves this data in a dict
- * and registers this dict in the "Registry" dict. This way we can discard
- * the global interpreter dictionary after a script is executed, since the
- * data meant to be kept was copied to the Registry elsewhere. The current
- * implementation is naive: scripts can deliberately mess with data saved by
- * other scripts. This is so new script versions can delete older entries, if
- * they need to. XXX Or should we block this? */
-
-#ifndef EXPP_REGISTRY_H
-#define EXPP_REGISTRY_H
-
-#include <Python.h>
-
-extern PyObject *bpy_registryDict;
-PyObject *Registry_Init( void );
-
-#endif /* EXPP_REGISTRY_H */
diff --git a/source/blender/python/api2_2x/Scene.c b/source/blender/python/api2_2x/Scene.c
deleted file mode 100644
index 397cee0ad5e..00000000000
--- a/source/blender/python/api2_2x/Scene.c
+++ /dev/null
@@ -1,1868 +0,0 @@
-/*
- *
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano, Jacques Guignot, Joseph Gilbert,
- * Campbell Barton, Ken Hughes
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-struct View3D;
-
-#include "Scene.h" /*This must come first */
-
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "MEM_guardedalloc.h" /* for MEM_callocN */
-#include "DNA_space_types.h" /* SPACE_VIEW3D, SPACE_SEQ */
-#include "DNA_screen_types.h"
-#include "DNA_userdef_types.h" /* U.userdefs */
-#include "DNA_object_types.h" /* SceneObSeq_new */
-#include "BKE_depsgraph.h"
-#include "BKE_library.h"
-#include "BKE_object.h"
-#include "BKE_scene.h"
-#include "BKE_font.h"
-#include "BKE_idprop.h"
-#include "BLI_blenlib.h" /* only for SceneObSeq_new */
-#include "BSE_drawview.h" /* for play_anim */
-#include "BSE_headerbuttons.h" /* for copy_scene */
-#include "BSE_sequence.h" /* to clear_scene_in_allseqs */
-#include "BSE_node.h" /* to clear_scene_in_nodes */
-#include "BIF_drawscene.h" /* for set_scene */
-#include "BIF_space.h" /* for copy_view3d_lock() */
-#include "BIF_screen.h" /* curarea */
-#include "BDR_editobject.h" /* free_and_unlink_base() */
-#include "mydevice.h" /* for #define REDRAW */
-#include "DNA_view3d_types.h"
-
-/* python types */
-#include "Object.h"
-#include "Camera.h"
-/* only for SceneObSeq_new */
-#include "BKE_material.h"
-#include "BLI_arithb.h"
-#include "Armature.h"
-#include "Lamp.h"
-#include "Curve.h"
-#include "NMesh.h"
-#include "Mesh.h"
-#include "World.h"
-#include "Lattice.h"
-#include "Metaball.h"
-#include "IDProp.h"
-#include "Text3d.h"
-#include "Library.h"
-
-#include "gen_utils.h"
-#include "gen_library.h"
-#include "sceneRender.h"
-#include "sceneRadio.h"
-#include "sceneTimeLine.h"
-#include "sceneSequence.h"
-
-
-#include "BKE_utildefines.h" /* vec copy */
-#include "vector.h"
-
-PyObject *M_Object_Get( PyObject * self, PyObject * args ); /* from Object.c */
-
-/* checks for the scene being removed */
-#define SCENE_DEL_CHECK_PY(bpy_scene) if (!(bpy_scene->scene)) return ( EXPP_ReturnPyObjError( PyExc_RuntimeError, "Scene has been removed" ) )
-#define SCENE_DEL_CHECK_INT(bpy_scene) if (!(bpy_scene->scene)) return ( EXPP_ReturnIntError( PyExc_RuntimeError, "Scene has been removed" ) )
-
-
-enum obj_consts {
- EXPP_OBSEQ_NORMAL = 0,
- EXPP_OBSEQ_SELECTED,
- EXPP_OBSEQ_CONTEXT
-};
-
-
-/*-----------------------Python API function prototypes for the Scene module--*/
-static PyObject *M_Scene_New( PyObject * self, PyObject * args,
- PyObject * keywords );
-static PyObject *M_Scene_Get( PyObject * self, PyObject * args );
-static PyObject *M_Scene_GetCurrent( PyObject * self );
-static PyObject *M_Scene_getCurrent_deprecated( PyObject * self );
-static PyObject *M_Scene_Unlink( PyObject * self, PyObject * arg );
-/*-----------------------Scene module doc strings-----------------------------*/
-static char M_Scene_doc[] = "The Blender.Scene submodule";
-static char M_Scene_New_doc[] =
- "(name = 'Scene') - Create a new Scene called 'name' in Blender.";
-static char M_Scene_Get_doc[] =
- "(name = None) - Return the scene called 'name'. If 'name' is None, return a list with all Scenes.";
-static char M_Scene_GetCurrent_doc[] =
- "() - Return the currently active Scene in Blender.";
-static char M_Scene_Unlink_doc[] =
- "(scene) - Unlink (delete) scene 'Scene' from Blender. (scene) is of type Blender scene.";
-/*----------------------Scene module method def----------------------------*/
-struct PyMethodDef M_Scene_methods[] = {
- {"New", ( PyCFunction ) M_Scene_New, METH_VARARGS | METH_KEYWORDS,
- M_Scene_New_doc},
- {"Get", M_Scene_Get, METH_VARARGS, M_Scene_Get_doc},
- {"get", M_Scene_Get, METH_VARARGS, M_Scene_Get_doc},
- {"GetCurrent", ( PyCFunction ) M_Scene_GetCurrent,
- METH_NOARGS, M_Scene_GetCurrent_doc},
- {"getCurrent", ( PyCFunction ) M_Scene_getCurrent_deprecated,
- METH_NOARGS, M_Scene_GetCurrent_doc},
- {"Unlink", M_Scene_Unlink, METH_VARARGS, M_Scene_Unlink_doc},
- {"unlink", M_Scene_Unlink, METH_VARARGS, M_Scene_Unlink_doc},
- {NULL, NULL, 0, NULL}
-};
-/*-----------------------BPy_Scene method declarations--------------------*/
-static PyObject *Scene_getLayerList( BPy_Scene * self );
-static PyObject *Scene_oldsetLayers( BPy_Scene * self, PyObject * arg );
-static PyObject *Scene_copy( BPy_Scene * self, PyObject * arg );
-static PyObject *Scene_makeCurrent( BPy_Scene * self );
-static PyObject *Scene_update( BPy_Scene * self, PyObject * args );
-static PyObject *Scene_link( BPy_Scene * self, PyObject * args );
-static PyObject *Scene_unlink( BPy_Scene * self, PyObject * args );
-static PyObject *Scene_getChildren( BPy_Scene * self );
-static PyObject *Scene_getActiveObject(BPy_Scene *self);
-static PyObject *Scene_getCurrentCamera( BPy_Scene * self );
-static PyObject *Scene_setCurrentCamera( BPy_Scene * self, PyObject * args );
-static PyObject *Scene_getRenderingContext( BPy_Scene * self );
-static PyObject *Scene_getRadiosityContext( BPy_Scene * self );
-static PyObject *Scene_getScriptLinks( BPy_Scene * self, PyObject * value );
-static PyObject *Scene_getSequence( BPy_Scene * self );
-static PyObject *Scene_addScriptLink( BPy_Scene * self, PyObject * args );
-static PyObject *Scene_clearScriptLinks( BPy_Scene * self, PyObject * args );
-static PyObject *Scene_play( BPy_Scene * self, PyObject * args );
-static PyObject *Scene_getTimeLine( BPy_Scene * self );
-
-
-/*internal*/
-static int Scene_compare( BPy_Scene * a, BPy_Scene * b );
-static PyObject *Scene_repr( BPy_Scene * self );
-
-/*object seq*/
-static PyObject *SceneObSeq_CreatePyObject( BPy_Scene *self, Base *iter, int mode);
-
-/*-----------------------BPy_Scene method def------------------------------*/
-static PyMethodDef BPy_Scene_methods[] = {
- /* name, method, flags, doc */
- {"getName", ( PyCFunction ) GenericLib_getName, METH_NOARGS,
- "() - Return Scene name"},
- {"setName", ( PyCFunction ) GenericLib_setName_with_method, METH_VARARGS,
- "(str) - Change Scene name"},
- {"getLayers", ( PyCFunction ) Scene_getLayerList, METH_NOARGS,
- "() - Return a list of layers int indices which are set in this scene "},
- {"setLayers", ( PyCFunction ) Scene_oldsetLayers, METH_VARARGS,
- "(layers) - Change layers which are set in this scene\n"
- "(layers) - list of integers in the range [1, 20]."},
- {"copy", ( PyCFunction ) Scene_copy, METH_VARARGS,
- "(duplicate_objects = 1) - Return a copy of this scene\n"
- "The optional argument duplicate_objects defines how the scene\n"
- "children are duplicated:\n\t0: Link Objects\n\t1: Link Object Data"
- "\n\t2: Full copy\n"},
- {"makeCurrent", ( PyCFunction ) Scene_makeCurrent, METH_NOARGS,
- "() - Make self the current scene"},
- {"update", ( PyCFunction ) Scene_update, METH_VARARGS,
- "(full = 0) - Update scene self.\n"
- "full = 0: sort the base list of objects."
- "full = 1: full update -- also regroups, does ipos, keys"},
- {"link", ( PyCFunction ) Scene_link, METH_VARARGS,
- "(obj) - Link Object obj to this scene"},
- {"unlink", ( PyCFunction ) Scene_unlink, METH_VARARGS,
- "(obj) - Unlink Object obj from this scene"},
- {"getChildren", ( PyCFunction ) Scene_getChildren, METH_NOARGS,
- "() - Return list of all objects linked to this scene"},
- {"getActiveObject", (PyCFunction)Scene_getActiveObject, METH_NOARGS,
- "() - Return this scene's active object"},
- {"getCurrentCamera", ( PyCFunction ) Scene_getCurrentCamera,
- METH_NOARGS,
- "() - Return current active Camera"},
- {"getScriptLinks", ( PyCFunction ) Scene_getScriptLinks, METH_O,
- "(eventname) - Get a list of this scene's scriptlinks (Text names) "
- "of the given type\n"
- "(eventname) - string: FrameChanged, OnLoad, OnSave, Redraw or Render."},
- {"addScriptLink", ( PyCFunction ) Scene_addScriptLink, METH_VARARGS,
- "(text, evt) - Add a new scene scriptlink.\n"
- "(text) - string: an existing Blender Text name;\n"
- "(evt) string: FrameChanged, OnLoad, OnSave, Redraw or Render."},
- {"clearScriptLinks", ( PyCFunction ) Scene_clearScriptLinks,
- METH_VARARGS,
- "() - Delete all scriptlinks from this scene.\n"
- "([s1<,s2,s3...>]) - Delete specified scriptlinks from this scene."},
- {"setCurrentCamera", ( PyCFunction ) Scene_setCurrentCamera,
- METH_VARARGS,
- "() - Set the currently active Camera"},
- {"getRenderingContext", ( PyCFunction ) Scene_getRenderingContext,
- METH_NOARGS,
- "() - Get the rendering context for the scene and return it as a BPy_RenderData"},
- {"getRadiosityContext", ( PyCFunction ) Scene_getRadiosityContext,
- METH_NOARGS,
- "() - Get the radiosity context for this scene."},
- {"play", ( PyCFunction ) Scene_play, METH_VARARGS,
- "(mode = 0, win = VIEW3D) - Play realtime animation in Blender"
- " (not rendered).\n"
- "(mode) - int:\n"
- "\t0 - keep playing in biggest given 'win';\n"
- "\t1 - keep playing in all 'win', VIEW3D and SEQ windows;\n"
- "\t2 - play once in biggest given 'win';\n"
- "\t3 - play once in all 'win', VIEW3D and SEQ windows.\n"
- "(win) - int: see Blender.Window.Types. Only these are meaningful here:"
- "VIEW3D, SEQ, IPO, ACTION, NLA, SOUND. But others are also accepted, "
- "since they can be used just as an interruptible timer. If 'win' is not"
- "available or invalid, VIEW3D is tried, then any bigger window."
- "Returns 0 for normal exit or 1 when canceled by user input."},
- {"getTimeLine", ( PyCFunction ) Scene_getTimeLine, METH_NOARGS,
- "() - Get time line of this Scene"},
- {NULL, NULL, 0, NULL}
-};
-
-
-/*****************************************************************************/
-/* Python BPy_Scene getsetattr funcs: */
-/*****************************************************************************/
-static PyObject *Scene_getLayerMask( BPy_Scene * self )
-{
- SCENE_DEL_CHECK_PY(self);
- return PyInt_FromLong( self->scene->lay & ((1<<20)-1) );
-}
-
-static int Scene_setLayerMask( BPy_Scene * self, PyObject * value )
-{
- int laymask = 0;
-
- SCENE_DEL_CHECK_INT(self);
-
- if (!PyInt_Check(value)) {
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "expected an integer (bitmask) as argument" );
- }
-
- laymask = PyInt_AsLong(value);
-
- if (laymask <= 0 || laymask > (1<<20) - 1) /* binary: 1111 1111 1111 1111 1111 */
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "bitmask must have from 1 up to 20 bits set");
-
- self->scene->lay = laymask;
- /* if this is the current scene then apply the scene layers value
- * to the view layers value: */
- if (G.vd && (self->scene == G.scene)) {
- int val, bit = 0;
- G.vd->lay = laymask;
-
- while( bit < 20 ) {
- val = 1 << bit;
- if( laymask & val ) {
- G.vd->layact = val;
- break;
- }
- bit++;
- }
- }
-
- return 0;
-}
-
-static PyObject *Scene_getLayerList( BPy_Scene * self )
-{
- PyObject *laylist, *item;
- int layers, bit = 0, val = 0;
-
- SCENE_DEL_CHECK_PY(self);
-
- laylist = PyList_New( 0 );
-
- if( !laylist )
- return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create pylist!" ) );
-
- layers = self->scene->lay;
-
- while( bit < 20 ) {
- val = 1 << bit;
- if( layers & val ) {
- item = Py_BuildValue( "i", bit + 1 );
- PyList_Append( laylist, item );
- Py_DECREF( item );
- }
- bit++;
- }
- return laylist;
-}
-
-static int Scene_setLayerList( BPy_Scene * self, PyObject * value )
-{
- PyObject *item = NULL;
- int layers = 0, val, i, len_list;
-
- SCENE_DEL_CHECK_INT(self);
-
- if( !PySequence_Check( value ) )
- return ( EXPP_ReturnIntError( PyExc_TypeError,
- "expected a list of integers in the range [1, 20]" ) );
-
- len_list = PySequence_Size(value);
-
- if (len_list == 0)
- return ( EXPP_ReturnIntError( PyExc_AttributeError,
- "list can't be empty, at least one layer must be set" ) );
-
- for( i = 0; i < len_list; i++ ) {
- item = PySequence_GetItem( value, i );
-
- if( !PyInt_Check( item ) ) {
- Py_DECREF( item );
- return EXPP_ReturnIntError
- ( PyExc_AttributeError,
- "list must contain only integer numbers" );
- }
-
- val = ( int ) PyInt_AsLong( item );
- if( val < 1 || val > 20 )
- return EXPP_ReturnIntError
- ( PyExc_AttributeError,
- "layer values must be in the range [1, 20]" );
-
- layers |= 1 << ( val - 1 );
- }
- self->scene->lay = layers;
-
- if (G.vd && (self->scene == G.scene)) {
- int bit = 0;
- G.vd->lay = layers;
-
- while( bit < 20 ) {
- val = 1 << bit;
- if( layers & val ) {
- G.vd->layact = val;
- break;
- }
- bit++;
- }
- }
-
- return 0;
-}
-
-static PyObject *Scene_getWorld( BPy_Scene * self )
-{
- SCENE_DEL_CHECK_PY(self);
-
- if (!self->scene->world)
- Py_RETURN_NONE;
- return World_CreatePyObject(self->scene->world);
-}
-
-static int Scene_setWorld( BPy_Scene * self, PyObject * value )
-{
- SCENE_DEL_CHECK_INT(self);
- return GenericLib_assignData(value, (void **) &self->scene->world, NULL, 1, ID_WO, 0);
-}
-
-/* accessed from scn.objects */
-static PyObject *Scene_getObjects( BPy_Scene *self)
-{
- SCENE_DEL_CHECK_PY(self);
- return SceneObSeq_CreatePyObject(self, NULL, 0);
-}
-
-static PyObject *Scene_getCursor( BPy_Scene * self )
-{
- SCENE_DEL_CHECK_PY(self);
- return newVectorObject( self->scene->cursor, 3, Py_WRAP );
-}
-
-static int Scene_setCursor( BPy_Scene * self, PyObject * value )
-{
- VectorObject *bpy_vec;
- SCENE_DEL_CHECK_INT(self);
- if (!VectorObject_Check(value))
- return ( EXPP_ReturnIntError( PyExc_TypeError,
- "expected a vector" ) );
-
- bpy_vec = (VectorObject *)value;
-
- if (bpy_vec->size != 3)
- return ( EXPP_ReturnIntError( PyExc_ValueError,
- "can only assign a 3D vector" ) );
-
- VECCOPY(self->scene->cursor, bpy_vec->vec);
- return 0;
-}
-
-/*****************************************************************************/
-/* Python attributes get/set structure: */
-/*****************************************************************************/
-static PyGetSetDef BPy_Scene_getseters[] = {
- GENERIC_LIB_GETSETATTR,
- {"Layers",
- (getter)Scene_getLayerMask, (setter)Scene_setLayerMask,
- "Scene layer bitmask",
- NULL},
- {"layers",
- (getter)Scene_getLayerList, (setter)Scene_setLayerList,
- "Scene layer list",
- NULL},
- {"world",
- (getter)Scene_getWorld, (setter)Scene_setWorld,
- "Scene layer bitmask",
- NULL},
- {"cursor",
- (getter)Scene_getCursor, (setter)Scene_setCursor,
- "Scene layer bitmask",
- NULL},
- {"timeline",
- (getter)Scene_getTimeLine, (setter)NULL,
- "Scenes timeline (read only)",
- NULL},
- {"render",
- (getter)Scene_getRenderingContext, (setter)NULL,
- "Scenes rendering context (read only)",
- NULL},
- {"radiosity",
- (getter)Scene_getRadiosityContext, (setter)NULL,
- "Scenes radiosity context (read only)",
- NULL},
- {"sequence",
- (getter)Scene_getSequence, (setter)NULL,
- "Scene sequencer data (read only)",
- NULL},
-
- {"objects",
- (getter)Scene_getObjects, (setter)NULL,
- "Scene object iterator",
- NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-
-
-/*-----------------------BPy_Scene method def------------------------------*/
-PyTypeObject Scene_Type = {
- PyObject_HEAD_INIT( NULL )
- 0, /* ob_size */
- "Scene", /* tp_name */
- sizeof( BPy_Scene ), /* tp_basicsize */
- 0, /* tp_itemsize */
- /* methods */
- NULL, /* tp_dealloc */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- ( cmpfunc ) Scene_compare, /* tp_compare */
- ( reprfunc ) Scene_repr, /* tp_repr */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- NULL, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
- 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, /* 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, /* 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 ***/
- BPy_Scene_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_Scene_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-/*-----------------------Scene module Init())-----------------------------*/
-PyObject *Scene_Init( void )
-{
-
- PyObject *submodule;
- PyObject *dict;
-
- if( PyType_Ready( &Scene_Type ) < 0 )
- return NULL;
- if( PyType_Ready( &SceneObSeq_Type ) < 0 )
- return NULL;
-
- submodule = Py_InitModule3( "Blender.Scene", M_Scene_methods, M_Scene_doc );
-
- dict = PyModule_GetDict( submodule );
- PyDict_SetItemString( dict, "Render", Render_Init( ) );
- PyDict_SetItemString( dict, "Radio", Radio_Init( ) );
- PyDict_SetItemString( dict, "Sequence", Sequence_Init( ) );
-
- return submodule;
-}
-
-/*-----------------------compare----------------------------------------*/
-static int Scene_compare( BPy_Scene * a, BPy_Scene * b )
-{
- return ( a->scene == b->scene ) ? 0 : -1;
-}
-
-/*----------------------repr--------------------------------------------*/
-static PyObject *Scene_repr( BPy_Scene * self )
-{
- if( !(self->scene) )
- return PyString_FromString( "[Scene - Removed]");
- else
- return PyString_FromFormat( "[Scene \"%s\"]",
- self->scene->id.name + 2 );
-}
-
-/*-----------------------CreatePyObject---------------------------------*/
-PyObject *Scene_CreatePyObject( Scene * scene )
-{
- BPy_Scene *pyscene;
-
- pyscene = ( BPy_Scene * ) PyObject_NEW( BPy_Scene, &Scene_Type );
-
- if( !pyscene )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create BPy_Scene object" );
-
- pyscene->scene = scene;
-
- return ( PyObject * ) pyscene;
-}
-
-/*-----------------------FromPyObject-----------------------------------*/
-Scene *Scene_FromPyObject( PyObject * pyobj )
-{
- return ( ( BPy_Scene * ) pyobj )->scene;
-}
-
-/*-----------------------Scene module function defintions---------------*/
-/*-----------------------Scene.New()------------------------------------*/
-static PyObject *M_Scene_New( PyObject * self, PyObject * args,
- PyObject * kword )
-{
- char *name = "Scene";
- char *kw[] = { "name", NULL };
- PyObject *pyscene; /* for the Scene object wrapper in Python */
- Scene *blscene; /* for the actual Scene we create in Blender */
-
- if( !PyArg_ParseTupleAndKeywords( args, kword, "|s", kw, &name ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected a string or an empty argument list" ) );
-
- blscene = add_scene( name ); /* first create the Scene in Blender */
-
- if( blscene ) {
- /* normally, for most objects, we set the user count to zero here.
- * Scene is different than most objs since it is the container
- * for all the others. Since add_scene() has already set
- * the user count to one, we leave it alone.
- */
-
- /* now create the wrapper obj in Python */
- pyscene = Scene_CreatePyObject( blscene );
- } else
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't create Scene obj in Blender" ) );
-
- if( pyscene == NULL )
- return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create Scene PyObject" ) );
-
- return pyscene;
-}
-
-/*-----------------------Scene.Get()------------------------------------*/
-static PyObject *M_Scene_Get( PyObject * self, PyObject * args )
-{
- char *name = NULL;
- Scene *scene_iter;
-
- if( !PyArg_ParseTuple( args, "|s", &name ) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument (or nothing)" ) );
-
- scene_iter = G.main->scene.first;
-
- if( name ) { /* (name) - Search scene by name */
-
- PyObject *wanted_scene = NULL;
-
- while( ( scene_iter ) && ( wanted_scene == NULL ) ) {
-
- if( strcmp( name, scene_iter->id.name + 2 ) == 0 )
- wanted_scene =
- Scene_CreatePyObject( scene_iter );
-
- scene_iter = scene_iter->id.next;
- }
-
- if( wanted_scene == NULL ) { /* Requested scene doesn't exist */
- char error_msg[64];
- PyOS_snprintf( error_msg, sizeof( error_msg ),
- "Scene \"%s\" not found", name );
- return ( EXPP_ReturnPyObjError
- ( PyExc_NameError, error_msg ) );
- }
-
- return wanted_scene;
- }
-
- else { /* () - return a list with wrappers for all scenes in Blender */
- int index = 0;
- PyObject *sce_pylist, *pyobj;
-
- sce_pylist = PyList_New( BLI_countlist( &( G.main->scene ) ) );
-
- if( sce_pylist == NULL )
- return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create PyList" ) );
-
- while( scene_iter ) {
- pyobj = Scene_CreatePyObject( scene_iter );
-
- if( !pyobj ) {
- Py_DECREF(sce_pylist);
- return ( EXPP_ReturnPyObjError
- ( PyExc_MemoryError,
- "couldn't create PyString" ) );
- }
- PyList_SET_ITEM( sce_pylist, index, pyobj );
-
- scene_iter = scene_iter->id.next;
- index++;
- }
-
- return sce_pylist;
- }
-}
-
-/*-----------------------Scene.GetCurrent()------------------------------*/
-static PyObject *M_Scene_GetCurrent( PyObject * self )
-{
- return Scene_CreatePyObject( ( Scene * ) G.scene );
-}
-
-static PyObject *M_Scene_getCurrent_deprecated( PyObject * self )
-{
- static char warning = 1;
- if( warning ) {
- printf("Blender.Scene.getCurrent() is deprecated,\n\tuse Blender.Scene.GetCurrent() instead.\n");
- --warning;
- }
-
- return Scene_CreatePyObject( ( Scene * ) G.scene );
-}
-
-
-/*-----------------------Scene.Unlink()----------------------------------*/
-static PyObject *M_Scene_Unlink( PyObject * self, PyObject * args )
-{
- PyObject *pyobj;
- BPy_Scene *pyscn;
- Scene *scene, *sce;
- bScreen *sc;
-
- if( !PyArg_ParseTuple( args, "O!", &Scene_Type, &pyobj ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected Scene PyType object" );
-
- pyscn = (BPy_Scene *)pyobj;
- scene = pyscn->scene;
-
- SCENE_DEL_CHECK_PY(pyscn);
-
- if( scene == G.scene )
- return EXPP_ReturnPyObjError( PyExc_SystemError,
- "current Scene cannot be removed!" );
-
- /* Copied from header_info.c */
-
- /* check all sets */
- for (sce= G.main->scene.first; sce; sce= sce->id.next) {
- if(sce->set == scene) sce->set= 0;
- }
-
- /* check all sequences */
- clear_scene_in_allseqs(scene);
-
- /* check render layer nodes in other scenes */
- clear_scene_in_nodes(scene);
-
- for (sc= G.main->screen.first; sc; sc= sc->id.next ) {
- if(sc->scene == scene) sc->scene= G.scene;
- }
-
- free_libblock( &G.main->scene, scene );
-
- pyscn->scene= NULL;
- Py_RETURN_NONE;
-}
-
-/* DEPRECATE ME !!! */
-/*-----------------------BPy_Scene function defintions-------------------*/
-
-/*-----------------------Scene.setLayers()---------------------------------*/
-static PyObject *Scene_oldsetLayers( BPy_Scene * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Scene_setLayerList );
-}
-/* END DEPRECATE CODE */
-
-
-/*-----------------------Scene.copy()------------------------------------*/
-static PyObject *Scene_copy( BPy_Scene * self, PyObject * args )
-{
- short dup_objs = 1;
- Scene *scene = self->scene;
-
- SCENE_DEL_CHECK_PY(self);
-
- if( !PyArg_ParseTuple( args, "|h", &dup_objs ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int in [0,2] or nothing as argument" );
-
- return Scene_CreatePyObject( copy_scene( scene, dup_objs ) );
-}
-
-/*-----------------------Scene.makeCurrent()-----------------------------*/
-static PyObject *Scene_makeCurrent( BPy_Scene * self )
-{
- Scene *scene = self->scene;
-#if 0 /* add back in when bpy becomes "official" */
- static char warning = 1;
- if( warning ) {
- printf("scene.makeCurrent() deprecated!\n\tuse bpy.scenes.active = scene instead\n");
- --warning;
- }
-#endif
-
- SCENE_DEL_CHECK_PY(self);
-
- if( scene && scene != G.scene) {
- set_scene( scene );
- scene_update_for_newframe(scene, scene->lay);
- }
-
- Py_RETURN_NONE;
-}
-
-/*-----------------------Scene.update()----------------------------------*/
-static PyObject *Scene_update( BPy_Scene * self, PyObject * args )
-{
- Scene *scene = self->scene;
- int full = 0;
-
- SCENE_DEL_CHECK_PY(self);
- if( !PyArg_ParseTuple( args, "|i", &full ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected nothing or int (0 or 1) argument" );
-
-/* Under certain circunstances, DAG_scene_sort *here* can crash Blender.
- * A "RuntimeError: max recursion limit" happens when a scriptlink
- * on frame change has scene.update(1).
- * Investigate better how to avoid this. */
- if( !full )
- DAG_scene_sort( scene );
-
- else if( full == 1 ) {
- int enablescripts = G.f & G_DOSCRIPTLINKS;
-
- /*Disable scriptlinks to prevent firing off newframe scriptlink
- events.*/
- G.f &= ~G_DOSCRIPTLINKS;
- set_scene_bg( scene );
- scene_update_for_newframe( scene, scene->lay );
-
- /*re-enabled scriptlinks if necassary.*/
- if (enablescripts) G.f |= G_DOSCRIPTLINKS;
- } else
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "in method scene.update(full), full should be:\n"
- "0: to only sort scene elements (old behavior); or\n"
- "1: for a full update (regroups, does ipos, keys, etc.)" );
-
- Py_RETURN_NONE;
-}
-
-/*-----------------------Scene.link()------------------------------------*/
-static PyObject *Scene_link( BPy_Scene * self, PyObject * args )
-{
- Scene *scene = self->scene;
- BPy_Object *bpy_obj;
- Object *object = NULL;
- static char warning = 1;
-
- if( warning ) {
- printf("scene.link(ob) deprecated!\n\tuse scene.objects.link(ob) instead\n");
- --warning;
- }
-
- SCENE_DEL_CHECK_PY(self);
-
- if( !PyArg_ParseTuple( args, "O!", &Object_Type, &bpy_obj ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected Object argument" );
-
-
- /*return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "Could not create data on demand for this object type!" );*/
-
- object = bpy_obj->object;
-
- /* Object.c's EXPP_add_obdata does not support these objects */
- if (!object->data && (object->type == OB_SURF || object->type == OB_FONT || object->type == OB_WAVE )) {
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "Object has no data and new data cant be automaticaly created for Surf, Text or Wave type objects!" );
- } else {
- /* Ok, all is fine, let's try to link it */
- Base *base;
-
- /* We need to link the object to a 'Base', then link this base
- * to the scene. See DNA_scene_types.h ... */
-
- /* First, check if the object isn't already in the scene */
- base = object_in_scene( object, scene );
- /* if base is not NULL ... */
- if( base ) /* ... the object is already in one of the Scene Bases */
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "object already in scene!" );
-
- /* not linked, go get mem for a new base object */
-
- base = MEM_callocN( sizeof( Base ), "pynewbase" );
-
- if( !base )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't allocate new Base for object" );
-
- /* if the object has not yet been linked to object data, then
- * set the real type before we try creating data */
-
- if( bpy_obj->realtype != OB_EMPTY ) {
- object->type = bpy_obj->realtype;
- bpy_obj->realtype = OB_EMPTY;
- }
-
- /* check if this object has obdata, case not, try to create it */
-
- if( !object->data && ( object->type != OB_EMPTY ) )
- EXPP_add_obdata( object ); /* returns -1 on error, defined in Object.c */
-
- base->object = object; /* link object to the new base */
- base->lay = object->lay;
- base->flag = object->flag;
-
- object->id.us += 1; /* incref the object user count in Blender */
-
- BLI_addhead( &scene->base, base ); /* finally, link new base to scene */
- }
-
- Py_RETURN_NONE;
-}
-
-/*-----------------------Scene.unlink()----------------------------------*/
-static PyObject *Scene_unlink( BPy_Scene * self, PyObject * args )
-{
- BPy_Object *bpy_obj = NULL;
- Scene *scene = self->scene;
- Base *base;
- static char warning = 1;
-
- if( warning ) {
- printf("scene.unlink(ob) deprecated!\n\tuse scene.objects.unlink(ob) instead\n");
- --warning;
- }
-
- SCENE_DEL_CHECK_PY(self);
-
- if( !PyArg_ParseTuple( args, "O!", &Object_Type, &bpy_obj ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected Object as argument" );
-
- /* is the object really in the scene? */
- base = object_in_scene( bpy_obj->object, scene );
-
- if( base ) { /* if it is, remove it */
- if (scene->basact==base)
- scene->basact= NULL; /* in case the object was selected */
-
- free_and_unlink_base_from_scene( scene, base );
- Py_RETURN_TRUE;
- }
- else
- Py_RETURN_FALSE;
-}
-
-/*-----------------------Scene.getChildren()-----------------------------*/
-static PyObject *Scene_getChildren( BPy_Scene * self )
-{
- Scene *scene = self->scene;
- PyObject *pylist;
- PyObject *bpy_obj;
- Object *object;
- Base *base;
- static char warning = 1;
-
- if( warning ) {
- printf("scene.getChildren() deprecated!\n\tuse scene.objects instead\n");
- --warning;
- }
-
- SCENE_DEL_CHECK_PY(self);
-
- pylist = PyList_New( 0 );
-
- base = scene->base.first;
-
- while( base ) {
- object = base->object;
-
- bpy_obj = Object_CreatePyObject( object );
-
- if( !bpy_obj ) {
- Py_DECREF(pylist);
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't create new object wrapper" );
- }
- PyList_Append( pylist, bpy_obj );
- Py_DECREF( bpy_obj ); /* PyList_Append incref'ed it */
-
- base = base->next;
- }
-
- return pylist;
-}
-
-/*-----------------------Scene.getActiveObject()------------------------*/
-static PyObject *Scene_getActiveObject(BPy_Scene *self)
-{
- Scene *scene = self->scene;
- PyObject *pyob;
- Object *ob;
- static char warning = 1;
-
- if( warning ) {
- printf("scene.getActiveObject() deprecated!\n\tuse scene.objects.active instead\n");
- --warning;
- }
-
- SCENE_DEL_CHECK_PY(self);
-
- ob = ((scene->basact) ? (scene->basact->object) : 0);
-
- if (ob) {
- pyob = Object_CreatePyObject( ob );
-
- if (!pyob)
- return EXPP_ReturnPyObjError(PyExc_MemoryError,
- "couldn't create new object wrapper!");
-
- return pyob;
- }
-
- Py_RETURN_NONE; /* no active object */
-}
-
-/*-----------------------Scene.getCurrentCamera()------------------------*/
-static PyObject *Scene_getCurrentCamera( BPy_Scene * self )
-{
- static char warning = 1;
-
- if( warning ) {
- printf("scene.getCurrentCamera() deprecated!\n\tuse scene.objects.camera instead\n");
- --warning;
- }
-
- SCENE_DEL_CHECK_PY(self);
- /* None is ok */
- return Object_CreatePyObject( self->scene->camera );
-}
-
-/*-----------------------Scene.setCurrentCamera()------------------------*/
-static PyObject *Scene_setCurrentCamera( BPy_Scene * self, PyObject * args )
-{
- Object *object;
- BPy_Object *cam_obj;
- Scene *scene = self->scene;
- static char warning = 1;
-
- if( warning ) {
- printf("scene.setCurrentCamera(ob) deprecated!\n\tSet scene.objects.camera = ob instead\n");
- --warning;
- }
-
- SCENE_DEL_CHECK_PY(self);
-
- if( !PyArg_ParseTuple( args, "O!", &Object_Type, &cam_obj ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected Camera Object as argument" );
-
- object = cam_obj->object;
- if( object->type != OB_CAMERA )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "expected Camera Object as argument" );
-
- scene->camera = object; /* set the current Camera */
-
- /* if this is the current scene, update its window now */
- if( !G.background && scene == G.scene ) /* Traced a crash to redrawing while in background mode -Campbell */
- copy_view3d_lock( REDRAW );
-
-/* XXX copy_view3d_lock(REDRAW) prints "bad call to addqueue: 0 (18, 1)".
- * The same happens in bpython. */
-
- Py_RETURN_NONE;
-}
-
-/*-----------------------Scene.getRenderingContext()---------------------*/
-static PyObject *Scene_getRenderingContext( BPy_Scene * self )
-{
- SCENE_DEL_CHECK_PY(self);
- return RenderData_CreatePyObject( self->scene );
-}
-
-static PyObject *Scene_getRadiosityContext( BPy_Scene * self )
-{
- SCENE_DEL_CHECK_PY(self);
- return Radio_CreatePyObject( self->scene );
-}
-
-static PyObject *Scene_getSequence( BPy_Scene * self )
-{
- SCENE_DEL_CHECK_PY(self);
- if (self->scene->ed) /* we should create this if its not there :/ */
- return SceneSeq_CreatePyObject( self->scene, NULL );
- else
- Py_RETURN_NONE;
-}
-
-/* scene.addScriptLink */
-static PyObject *Scene_addScriptLink( BPy_Scene * self, PyObject * args )
-{
- Scene *scene = self->scene;
- ScriptLink *slink = NULL;
-
- SCENE_DEL_CHECK_PY(self);
-
- slink = &( scene )->scriptlink;
-
- return EXPP_addScriptLink( slink, args, 1 );
-}
-
-/* scene.clearScriptLinks */
-static PyObject *Scene_clearScriptLinks( BPy_Scene * self, PyObject * args )
-{
- Scene *scene = self->scene;
- ScriptLink *slink = NULL;
-
- SCENE_DEL_CHECK_PY(self);
-
- slink = &( scene )->scriptlink;
-
- return EXPP_clearScriptLinks( slink, args );
-}
-
-/* scene.getScriptLinks */
-static PyObject *Scene_getScriptLinks( BPy_Scene * self, PyObject * value )
-{
- Scene *scene = self->scene;
- ScriptLink *slink = NULL;
- PyObject *ret = NULL;
-
- SCENE_DEL_CHECK_PY(self);
-
- slink = &( scene )->scriptlink;
-
- ret = EXPP_getScriptLinks( slink, value, 1 );
-
- if( ret )
- return ret;
- else
- return NULL;
-}
-
-static PyObject *Scene_play( BPy_Scene * self, PyObject * args )
-{
- int mode = 0, win = SPACE_VIEW3D;
- PyObject *ret = NULL;
- ScrArea *sa = NULL, *oldsa = curarea;
-
- SCENE_DEL_CHECK_PY(self);
-
- if( !PyArg_ParseTuple( args, "|ii", &mode, &win ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected nothing, or or two ints as arguments." );
-
- if( mode < 0 || mode > 3 )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "mode should be in range [0, 3]." );
-
- switch ( win ) {
- case SPACE_VIEW3D:
- case SPACE_SEQ:
- case SPACE_IPO:
- case SPACE_ACTION:
- case SPACE_NLA:
- case SPACE_SOUND:
- case SPACE_BUTS: /* from here they don't 'play', but ... */
- case SPACE_TEXT: /* ... might be used as a timer. */
- case SPACE_SCRIPT:
- case SPACE_OOPS:
- case SPACE_IMAGE:
- case SPACE_IMASEL:
- case SPACE_INFO:
- case SPACE_FILE:
- break;
- default:
- win = SPACE_VIEW3D;
- }
-
- /* we have to move to a proper win */
- sa = find_biggest_area_of_type( win );
- if( !sa && win != SPACE_VIEW3D )
- sa = find_biggest_area_of_type( SPACE_VIEW3D );
-
- if( !sa )
- sa = find_biggest_area( );
-
- if( sa )
- areawinset( sa->win );
-
- /* play_anim returns 0 for normal exit or 1 if user canceled it */
- ret = PyInt_FromLong( (long)play_anim( mode ) );
-
- if( sa )
- areawinset( oldsa->win );
-
- return ret;
-}
-
-static PyObject *Scene_getTimeLine( BPy_Scene *self )
-{
- BPy_TimeLine *tm;
-
- SCENE_DEL_CHECK_PY(self);
-
- tm= (BPy_TimeLine *) PyObject_NEW (BPy_TimeLine, &TimeLine_Type);
- if (!tm)
- return EXPP_ReturnPyObjError (PyExc_MemoryError,
- "couldn't create BPy_TimeLine object");
- tm->marker_list= &(self->scene->markers);
- tm->sfra= (int) self->scene->r.sfra;
- tm->efra= (int) self->scene->r.efra;
-
- return (PyObject *)tm;
-}
-
-/************************************************************************
- *
- * Object Sequence
- *
- ************************************************************************/
-/*
- * create a thin wrapper for the scenes objects
- */
-
-/* accessed from scn.objects.selected or scn.objects.context */
-static PyObject *SceneObSeq_getObjects( BPy_SceneObSeq *self, void *mode)
-{
- SCENE_DEL_CHECK_PY(self->bpyscene);
- return SceneObSeq_CreatePyObject(self->bpyscene, NULL, (int)((long)mode));
-}
-
-int SceneObSeq_setObjects( BPy_SceneObSeq *self, PyObject *value, void *_mode_)
-{
- /*
- ONLY SUPPORTS scn.objects.selected and scn.objects.context
- cannot assign to scn.objects yet!!!
- */
- PyObject *item;
- Scene *scene= self->bpyscene->scene;
- Object *blen_ob;
- Base *base;
- int size, mode = (int)_mode_;
-
- SCENE_DEL_CHECK_INT(self->bpyscene);
-
- /* scn.objects.selected = scn.objects - shortcut to select all */
- if (BPy_SceneObSeq_Check(value)) {
- BPy_SceneObSeq *bpy_sceneseq = (BPy_SceneObSeq *)value;
- if (self->bpyscene->scene != bpy_sceneseq->bpyscene->scene)
- return EXPP_ReturnIntError( PyExc_ValueError,
- "Cannot assign a SceneObSeq type from another scene" );
- if (bpy_sceneseq->mode != EXPP_OBSEQ_NORMAL)
- return EXPP_ReturnIntError( PyExc_ValueError,
- "Can only assign scn.objects to scn.objects.context or scn.objects.selected" );
-
- for (base= scene->base.first; base; base= base->next) {
- base->flag |= SELECT;
- base->object->flag |= SELECT;
-
- if (mode==EXPP_OBSEQ_CONTEXT && G.vd) {
- base->object->lay= base->lay= G.vd->lay;
- }
- }
- return 0;
- }
-
- if (!PySequence_Check(value))
- return EXPP_ReturnIntError( PyExc_ValueError,
- "Error, must assign a sequence of objects to scn.objects.selected" );
-
- /* for context and selected, just deselect, dont remove */
- for (base= scene->base.first; base; base= base->next) {
- base->flag &= ~SELECT;
- base->object->flag &= ~SELECT;
- }
-
- size = PySequence_Length(value);
- while (size) {
- size--;
- item = PySequence_GetItem(value, size);
- if ( PyObject_TypeCheck(item, &Object_Type) ) {
- blen_ob= ((BPy_Object *)item)->object;
- base = object_in_scene( blen_ob, scene );
- if (base) {
- blen_ob->flag |= SELECT;
- base->flag |= SELECT;
- if (mode==EXPP_OBSEQ_CONTEXT && G.vd) {
- blen_ob->restrictflag &= ~OB_RESTRICT_VIEW;
- blen_ob->lay= base->lay= G.vd->lay;
- }
- }
- }
- Py_DECREF(item);
- }
- return 0;
-}
-
-
-static PyObject *SceneObSeq_CreatePyObject( BPy_Scene *self, Base *iter, int mode )
-{
- BPy_SceneObSeq *seq = PyObject_NEW( BPy_SceneObSeq, &SceneObSeq_Type);
- seq->bpyscene = self; Py_INCREF(self);
- seq->iter = iter;
- seq->mode = mode;
- return (PyObject *)seq;
-}
-
-static int SceneObSeq_len( BPy_SceneObSeq * self )
-{
- Scene *scene= self->bpyscene->scene;
- SCENE_DEL_CHECK_INT(self->bpyscene);
-
- if (self->mode == EXPP_OBSEQ_NORMAL)
- return BLI_countlist( &( scene->base ) );
- else if (self->mode == EXPP_OBSEQ_SELECTED) {
- int len=0;
- Base *base;
- for (base= scene->base.first; base; base= base->next) {
- if (base->flag & SELECT) {
- len++;
- }
- }
- return len;
- } else if (self->mode == EXPP_OBSEQ_CONTEXT) {
- int len=0;
- Base *base;
-
- if( G.vd == NULL ) /* No 3d view has been initialized yet, simply return an empty list */
- return 0;
-
- for (base= scene->base.first; base; base= base->next) {
- if TESTBASE(base) {
- len++;
- }
- }
- return len;
- }
- /*should never run this */
- return 0;
-}
-
-/*
- * retrive a single Object from somewhere in the Object list
- */
-
-static PyObject *SceneObSeq_item( BPy_SceneObSeq * self, int i )
-{
- int index=0;
- Base *base= NULL;
- Scene *scene= self->bpyscene->scene;
-
- SCENE_DEL_CHECK_PY(self->bpyscene);
-
- /* objects */
- if (self->mode==EXPP_OBSEQ_NORMAL)
- for (base= scene->base.first; base && i!=index; base= base->next, index++) {}
- /* selected */
- else if (self->mode==EXPP_OBSEQ_SELECTED) {
- for (base= scene->base.first; base && i!=index; base= base->next)
- if (base->flag & SELECT)
- index++;
- }
- /* context */
- else if (self->mode==EXPP_OBSEQ_CONTEXT) {
- if (G.vd)
- for (base= scene->base.first; base && i!=index; base= base->next)
- if TESTBASE(base)
- index++;
- }
-
- if (!(base))
- return EXPP_ReturnPyObjError( PyExc_IndexError,
- "array index out of range" );
-
- return Object_CreatePyObject( base->object );
-}
-
-static PySequenceMethods SceneObSeq_as_sequence = {
- ( inquiry ) SceneObSeq_len, /* sq_length */
- ( binaryfunc ) 0, /* sq_concat */
- ( intargfunc ) 0, /* sq_repeat */
- ( intargfunc ) SceneObSeq_item, /* sq_item */
- ( intintargfunc ) 0, /* sq_slice */
- ( intobjargproc ) 0, /* sq_ass_item */
- ( intintobjargproc ) 0, /* sq_ass_slice */
- 0,0,0,
-};
-
-
-/************************************************************************
- *
- * Python SceneObSeq_Type iterator (iterates over GroupObjects)
- *
- ************************************************************************/
-
-/*
- * Initialize the interator index
- */
-
-static PyObject *SceneObSeq_getIter( BPy_SceneObSeq * self )
-{
- /* we need to get the first base, but for selected context we may need to advance
- to the first selected or first conext base */
- Base *base= self->bpyscene->scene->base.first;
-
- SCENE_DEL_CHECK_PY(self->bpyscene);
-
- if (self->mode==EXPP_OBSEQ_SELECTED)
- while (base && !(base->flag & SELECT))
- base= base->next;
- else if (self->mode==EXPP_OBSEQ_CONTEXT) {
- if (!G.vd)
- base= NULL; /* will never iterate if we have no */
- else
- while (base && !TESTBASE(base))
- base= base->next;
- }
- /* create a new iterator if were alredy using this one */
- if (self->iter==NULL) {
- self->iter = base;
- return EXPP_incr_ret ( (PyObject *) self );
- } else {
- return SceneObSeq_CreatePyObject(self->bpyscene, base, self->mode);
- }
-}
-
-/*
- * Return next SceneOb.
- */
-
-static PyObject *SceneObSeq_nextIter( BPy_SceneObSeq * self )
-{
- PyObject *object;
- Base *base;
- if( !(self->iter) || !(self->bpyscene->scene) ) {
- self->iter= NULL;
- return EXPP_ReturnPyObjError( PyExc_StopIteration,
- "iterator at end" );
- }
-
- object= Object_CreatePyObject( self->iter->object );
- base= self->iter->next;
-
- if (self->mode==EXPP_OBSEQ_SELECTED)
- while (base && !(base->flag & SELECT))
- base= base->next;
- else if (self->mode==EXPP_OBSEQ_CONTEXT) {
- if (!G.vd)
- base= NULL; /* will never iterate if we have no */
- else
- while (base && !TESTBASE(base))
- base= base->next;
- }
- self->iter= base;
- return object;
-}
-
-
-static PyObject *SceneObSeq_link( BPy_SceneObSeq * self, PyObject *pyobj )
-{
- SCENE_DEL_CHECK_PY(self->bpyscene);
-
- /* this shold eventually replace Scene_link */
- if (self->mode != EXPP_OBSEQ_NORMAL)
- return (EXPP_ReturnPyObjError( PyExc_TypeError,
- "Cannot link to objects.selection or objects.context!" ));
-
- /*
- if (self->iter != NULL)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "Cannot modify scene objects while iterating" );
- */
-
- if( PyTuple_Size(pyobj) == 1 ) {
- BPy_LibraryData *seq = ( BPy_LibraryData * )PyTuple_GET_ITEM( pyobj, 0 );
- if( BPy_LibraryData_Check( seq ) )
- return LibraryData_importLibData( seq, seq->name,
- ( seq->kind == OBJECT_IS_LINK ? FILE_LINK : 0 ),
- self->bpyscene->scene );
- }
- return Scene_link(self->bpyscene, pyobj);
-}
-
-/* This is buggy with new object data not already linked to an object, for now use the above code */
-static PyObject *SceneObSeq_new( BPy_SceneObSeq * self, PyObject *args )
-{
-
- void *data = NULL;
- char *name = NULL;
- char *desc = NULL;
- short type = OB_EMPTY;
- struct Object *object;
- Base *base;
- PyObject *py_data;
- Scene *scene= self->bpyscene->scene;
-
- SCENE_DEL_CHECK_PY(self->bpyscene);
-
- if (self->mode != EXPP_OBSEQ_NORMAL)
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "Cannot add new to objects.selection or objects.context!" );
-
- if( !PyArg_ParseTuple( args, "O|s", &py_data, &name ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "scene.objects.new(obdata) - expected obdata to be\n\ta python obdata type or the string 'Empty'" );
-
- if( BPy_Armature_Check( py_data ) ) {
- data = ( void * ) Armature_FromPyObject( py_data );
- type = OB_ARMATURE;
- } else if( BPy_Camera_Check( py_data ) ) {
- data = ( void * ) Camera_FromPyObject( py_data );
- type = OB_CAMERA;
- } else if( BPy_Lamp_Check( py_data ) ) {
- data = ( void * ) Lamp_FromPyObject( py_data );
- type = OB_LAMP;
- } else if( BPy_Curve_Check( py_data ) ) {
- data = ( void * ) Curve_FromPyObject( py_data );
- type = OB_CURVE;
- } else if( BPy_NMesh_Check( py_data ) ) {
- data = ( void * ) NMesh_FromPyObject( py_data, NULL );
- type = OB_MESH;
- if( !data ) /* NULL means there is already an error */
- return NULL;
- } else if( BPy_Mesh_Check( py_data ) ) {
- data = ( void * ) Mesh_FromPyObject( py_data, NULL );
- type = OB_MESH;
- } else if( BPy_Lattice_Check( py_data ) ) {
- data = ( void * ) Lattice_FromPyObject( py_data );
- type = OB_LATTICE;
- } else if( BPy_Metaball_Check( py_data ) ) {
- data = ( void * ) Metaball_FromPyObject( py_data );
- type = OB_MBALL;
- } else if( BPy_Text3d_Check( py_data ) ) {
- data = ( void * ) Text3d_FromPyObject( py_data );
- type = OB_FONT;
- } else if( ( desc = PyString_AsString( (PyObject *)py_data ) ) != NULL ) {
- if( !strcmp( desc, "Empty" ) ) {
- type = OB_EMPTY;
- data = NULL;
- } else
- goto typeError;
- } else {
-typeError:
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected an object and optionally a string as arguments" );
- }
-
- if (!name) {
- if (type == OB_EMPTY)
- name = "Empty";
- else
- name = ((ID *)data)->name + 2;
- }
-
- object = add_only_object(type, name);
-
- if( data ) {
- object->data = data;
- id_us_plus((ID *)data);
- }
-
- object->flag = SELECT;
-
- /* creates the curve for the text object */
- if (type == OB_FONT)
- text_to_curve(object, 0);
-
- /* link to scene */
- base = MEM_callocN( sizeof( Base ), "pynewbase" );
-
- if( !base )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't allocate new Base for object" );
-
- base->object = object; /* link object to the new base */
-
- if (scene == G.scene && G.vd) {
- if (G.vd->localview) {
- object->lay= G.vd->layact + G.vd->lay;
- } else {
- object->lay= G.vd->layact;
- }
- } else {
- base->lay= object->lay = scene->lay & ((1<<20)-1); /* Layer, by default visible*/
- }
-
- base->lay= object->lay;
-
- base->flag = SELECT;
- object->id.us = 1; /* we will exist once in this scene */
-
- BLI_addhead( &(scene->base), base ); /* finally, link new base to scene */
-
- /* make sure data and object materials are consistent */
- test_object_materials( (ID *)object->data );
-
- /* so we can deal with vertex groups */
- if (type == OB_MESH)
- ((BPy_Mesh *)py_data)->object = object;
-
- return Object_CreatePyObject( object );
-
-}
-
-static PyObject *SceneObSeq_unlink( BPy_SceneObSeq * self, PyObject *args )
-{
- PyObject *pyobj;
- Object *blen_ob;
- Scene *scene;
- Base *base= NULL;
-
- SCENE_DEL_CHECK_PY(self->bpyscene);
-
- if (self->mode != EXPP_OBSEQ_NORMAL)
- return (EXPP_ReturnPyObjError( PyExc_TypeError,
- "Cannot add new to objects.selection or objects.context!" ));
-
- if( !PyArg_ParseTuple( args, "O!", &Object_Type, &pyobj ) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a python object as an argument" ) );
-
- blen_ob = ( ( BPy_Object * ) pyobj )->object;
-
- scene = self->bpyscene->scene;
-
- /* is the object really in the scene? */
- base = object_in_scene( blen_ob, scene);
- if( base ) { /* if it is, remove it */
- if (scene->basact==base)
- scene->basact= NULL; /* in case the object was selected */
- free_and_unlink_base_from_scene(scene, base);
- Py_RETURN_TRUE;
- }
- Py_RETURN_FALSE;
-}
-
-PyObject *SceneObSeq_getActive(BPy_SceneObSeq *self)
-{
- Base *base;
- SCENE_DEL_CHECK_PY(self->bpyscene);
-
- if (self->mode!=EXPP_OBSEQ_NORMAL)
- return (EXPP_ReturnPyObjError( PyExc_TypeError,
- "cannot get active from objects.selected or objects.context" ));
-
- base= self->bpyscene->scene->basact;
- if (!base)
- Py_RETURN_NONE;
-
- return Object_CreatePyObject( base->object );
-}
-
-static int SceneObSeq_setActive(BPy_SceneObSeq *self, PyObject *value)
-{
- Base *base;
-
- SCENE_DEL_CHECK_INT(self->bpyscene);
-
- if (self->mode!=EXPP_OBSEQ_NORMAL)
- return (EXPP_ReturnIntError( PyExc_TypeError,
- "cannot set active from objects.selected or objects.context" ));
-
- if (value==Py_None) {
- self->bpyscene->scene->basact= NULL;
- return 0;
- }
-
- if (!BPy_Object_Check(value))
- return (EXPP_ReturnIntError( PyExc_ValueError,
- "Object or None types can only be assigned to active!" ));
-
- base = object_in_scene( ((BPy_Object *)value)->object, self->bpyscene->scene );
-
- if (!base)
- return (EXPP_ReturnIntError( PyExc_ValueError,
- "cannot assign an active object outside the scene." ));
-
- self->bpyscene->scene->basact= base;
- return 0;
-}
-
-PyObject *SceneObSeq_getCamera(BPy_SceneObSeq *self)
-{
- SCENE_DEL_CHECK_PY(self->bpyscene);
-
- if (self->mode!=EXPP_OBSEQ_NORMAL)
- return (EXPP_ReturnPyObjError( PyExc_TypeError,
- "cannot get camera from objects.selected or objects.context" ));
-
- return Object_CreatePyObject( self->bpyscene->scene->camera );
-}
-
-static int SceneObSeq_setCamera(BPy_SceneObSeq *self, PyObject *value)
-{
- int ret;
-
- SCENE_DEL_CHECK_INT(self->bpyscene);
- if (self->mode!=EXPP_OBSEQ_NORMAL)
- return EXPP_ReturnIntError( PyExc_TypeError,
- "cannot set camera from objects.selected or objects.context" );
-
- ret = GenericLib_assignData(value, (void **) &self->bpyscene->scene->camera, 0, 0, ID_OB, 0);
-
- /* if this is the current scene, update its window now */
- if( ret == 0 && !G.background && self->bpyscene->scene == G.scene ) /* Traced a crash to redrawing while in background mode -Campbell */
- copy_view3d_lock( REDRAW );
-
-/* XXX copy_view3d_lock(REDRAW) prints "bad call to addqueue: 0 (18, 1)".
- * The same happens in bpython. */
-
- return ret;
-}
-
-
-static struct PyMethodDef BPy_SceneObSeq_methods[] = {
- {"link", (PyCFunction)SceneObSeq_link, METH_VARARGS,
- "link object to this scene"},
- {"new", (PyCFunction)SceneObSeq_new, METH_VARARGS,
- "Create a new object in this scene from the obdata given and return a new object"},
- {"unlink", (PyCFunction)SceneObSeq_unlink, METH_VARARGS,
- "unlinks the object from the scene"},
- {NULL, NULL, 0, NULL}
-};
-
-/************************************************************************
- *
- * Python SceneObSeq_Type standard operations
- *
- ************************************************************************/
-
-static void SceneObSeq_dealloc( BPy_SceneObSeq * self )
-{
- Py_DECREF(self->bpyscene);
- PyObject_DEL( self );
-}
-
-static int SceneObSeq_compare( BPy_SceneObSeq * a, BPy_SceneObSeq * b )
-{
- return ( a->bpyscene->scene == b->bpyscene->scene && a->mode == b->mode) ? 0 : -1;
-}
-
-/*
- * repr function
- * callback functions building meaninful string to representations
- */
-static PyObject *SceneObSeq_repr( BPy_SceneObSeq * self )
-{
- if( !(self->bpyscene->scene) )
- return PyString_FromFormat( "[Scene ObjectSeq Removed]" );
- else if (self->mode==EXPP_OBSEQ_SELECTED)
- return PyString_FromFormat( "[Scene ObjectSeq Selected \"%s\"]",
- self->bpyscene->scene->id.name + 2 );
- else if (self->mode==EXPP_OBSEQ_CONTEXT)
- return PyString_FromFormat( "[Scene ObjectSeq Context \"%s\"]",
- self->bpyscene->scene->id.name + 2 );
-
- /*self->mode==0*/
- return PyString_FromFormat( "[Scene ObjectSeq \"%s\"]",
- self->bpyscene->scene->id.name + 2 );
-}
-
-static PyGetSetDef SceneObSeq_getseters[] = {
- {"selected",
- (getter)SceneObSeq_getObjects, (setter)SceneObSeq_setObjects,
- "sequence of selected objects",
- (void *)EXPP_OBSEQ_SELECTED},
- {"context",
- (getter)SceneObSeq_getObjects, (setter)SceneObSeq_setObjects,
- "sequence of user context objects",
- (void *)EXPP_OBSEQ_CONTEXT},
- {"active",
- (getter)SceneObSeq_getActive, (setter)SceneObSeq_setActive,
- "active object",
- NULL},
- {"camera",
- (getter)SceneObSeq_getCamera, (setter)SceneObSeq_setCamera,
- "camera object",
- NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-/*****************************************************************************/
-/* Python SceneObSeq_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject SceneObSeq_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender SceneObSeq", /* char *tp_name; */
- sizeof( BPy_SceneObSeq ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- ( destructor ) SceneObSeq_dealloc,/* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- ( cmpfunc ) SceneObSeq_compare, /* cmpfunc tp_compare; */
- ( reprfunc ) SceneObSeq_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- &SceneObSeq_as_sequence, /* 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; */
- 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, /* 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, /* richcmpfunc tp_richcompare; */
-
- /*** weak reference enabler ***/
- 0, /* long tp_weaklistoffset; */
-
- /*** Added in release 2.2 ***/
- /* Iterators */
- ( getiterfunc) SceneObSeq_getIter, /* getiterfunc tp_iter; */
- ( iternextfunc ) SceneObSeq_nextIter, /* iternextfunc tp_iternext; */
-
- /*** Attribute descriptor and subclassing stuff ***/
- BPy_SceneObSeq_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- SceneObSeq_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
diff --git a/source/blender/python/api2_2x/Scene.h b/source/blender/python/api2_2x/Scene.h
deleted file mode 100644
index eefa72562b5..00000000000
--- a/source/blender/python/api2_2x/Scene.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * $Id: Scene.h 10269 2007-03-15 01:09:14Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_SCENE_H
-#define EXPP_SCENE_H
-
-#include <Python.h>
-#include "DNA_scene_types.h"
-
-/* The Scene PyType Object defined in Scene.c */
-extern PyTypeObject Scene_Type;
-extern PyTypeObject SceneObSeq_Type;
-
-#define BPy_Scene_Check(v) \
- ((v)->ob_type == &Scene_Type)
-#define BPy_SceneObSeq_Check(v) \
- ((v)->ob_type == &SceneObSeq_Type)
-
-/*---------------------------Python BPy_Scene structure definition----------*/
-typedef struct {
- PyObject_HEAD
- Scene * scene; /* libdata must be second */
-} BPy_Scene;
-/*---------------------------Python BPy_Scene visible prototypes-----------*/
-/* Python Scene_Type helper functions needed by Blender (the Init function) and Object modules. */
-
-
-/* Scene object sequence, iterate on the scene object listbase*/
-typedef struct {
- PyObject_VAR_HEAD /* required python macro */
- BPy_Scene *bpyscene; /* link to the python scene so we can know if its been removed */
- Base *iter; /* so we can iterate over the objects */
- int mode; /*0:all objects, 1:selected objects, 2:user context*/
-} BPy_SceneObSeq;
-
-
-PyObject *Scene_Init( void );
-PyObject *Scene_CreatePyObject( Scene * scene );
-/*Scene *Scene_FromPyObject( PyObject * pyobj );*/ /* not used yet */
-
-#endif /* EXPP_SCENE_H */
diff --git a/source/blender/python/api2_2x/Sound.c b/source/blender/python/api2_2x/Sound.c
deleted file mode 100644
index 25f557eb0c1..00000000000
--- a/source/blender/python/api2_2x/Sound.c
+++ /dev/null
@@ -1,607 +0,0 @@
-/*
- * $Id: Sound.c 11123 2007-06-29 08:59:26Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Chris Keith
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#include "Sound.h" /*This must come first*/
-
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BLI_blenlib.h"
-#include "BKE_sound.h"
-#include "BKE_library.h"
-#include "BIF_editsound.h"
-#include "BKE_packedFile.h"
-#include "mydevice.h" /* redraw defines */
-#include "gen_utils.h"
-#include "gen_library.h"
-#include "DNA_space_types.h" /* for FILE_MAXDIR only */
-
-/*****************************************************************************/
-/* Python BPy_Sound defaults: */
-/*****************************************************************************/
-
-#define EXPP_SND_volume_MIN 0.0
-#define EXPP_SND_volume_MAX 1.0
-#define EXPP_SND_pitch_MIN -12.0
-#define EXPP_SND_pitch_MAX 12.0
-#define EXPP_SND_attenuation_MIN 0.0
-#define EXPP_SND_attenuation_MAX 5.0
-
-/*****************************************************************************/
-/* Python API function prototypes for the Sound module. */
-/*****************************************************************************/
-static PyObject *M_Sound_Get( PyObject * self, PyObject * args );
-static PyObject *M_Sound_Load( PyObject * self, PyObject * value );
-
-/************************************************************************/
-/* The following string definitions are used for documentation strings. */
-/* In Python these will be written to the console when doing a */
-/* Blender.Sound.__doc__ */
-/************************************************************************/
-static char M_Sound_doc[] = "The Blender Sound module\n\n";
-
-static char M_Sound_Get_doc[] =
- "(name) - return the sound with the name 'name', \
-returns None if not found.\n If 'name' is not specified, \
-it returns a list of all sounds in the\ncurrent scene.";
-
-static char M_Sound_Load_doc[] =
- "(filename) - return sound from file filename as a Sound Object,\n\
-returns None if not found.";
-
-/*****************************************************************************/
-/* Python method structure definition for Blender.Sound module: */
-/*****************************************************************************/
-struct PyMethodDef M_Sound_methods[] = {
- {"Get", M_Sound_Get, METH_VARARGS, M_Sound_Get_doc},
- {"Load", M_Sound_Load, METH_O, M_Sound_Load_doc},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Python Sound_Type callback function prototypes: */
-/*****************************************************************************/
-static int Sound_compare( BPy_Sound * a, BPy_Sound * b );
-static PyObject *Sound_repr( BPy_Sound * self );
-
-#define SOUND_FLOAT_METHODS(funcname, varname) \
-static PyObject *Sound_get ## funcname(BPy_Sound *self) { \
- return PyFloat_FromDouble(self->sound->varname); \
-} \
-static PyObject *Sound_set ## funcname(BPy_Sound *self, PyObject *args) { \
- float f = 0; \
- if (!PyArg_ParseTuple(args, "f", &f)) \
- return (EXPP_ReturnPyObjError (PyExc_TypeError, \
- "expected float argument")); \
- self->sound->varname = EXPP_ClampFloat(f, \
- EXPP_SND_##varname##_MIN, EXPP_SND_##varname##_MAX); \
- Py_RETURN_NONE; \
-}
-
-#define SOUND_FLOAT_METHOD_FUNCS(varname) \
-{"get"#varname, (PyCFunction)Sound_get ## varname, METH_NOARGS, \
-"() - Return Sound object "#varname}, \
-{"set"#varname, (PyCFunction)Sound_set ## varname, METH_VARARGS, \
-"(float) - Change Sound object "#varname},
-
-
-/*****************************************************************************/
-/* Python BPy_Sound methods declarations: */
-/*****************************************************************************/
-static PyObject *Sound_getName( BPy_Sound * self );
-static PyObject *Sound_getFilename( BPy_Sound * self );
-static PyObject *Sound_setName( BPy_Sound * self, PyObject * args );
-static int Sound_setFilename( BPy_Sound * self, PyObject * args );
-static PyObject *Sound_oldsetFilename( BPy_Sound * self, PyObject * args );
-static PyObject *Sound_setCurrent( BPy_Sound * self );
-static PyObject *Sound_play( BPy_Sound * self );
-static PyObject *Sound_unpack( BPy_Sound * self, PyObject * args);
-static PyObject *Sound_pack( BPy_Sound * self );
-/*static PyObject *Sound_reload ( BPy_Sound * self );*/
-SOUND_FLOAT_METHODS( Volume, volume )
-SOUND_FLOAT_METHODS( Attenuation, attenuation )
-SOUND_FLOAT_METHODS( Pitch, pitch )
-/* these can't be set via interface, removed for now */
-/*
-SOUND_FLOAT_METHODS( Panning, panning )
-SOUND_FLOAT_METHODS( MinGain, min_gain )
-SOUND_FLOAT_METHODS( MaxGain, max_gain )
-SOUND_FLOAT_METHODS( Distance, distance )
-*/
-
-/*****************************************************************************/
-/* Python BPy_Sound methods table: */
-/*****************************************************************************/
-static PyMethodDef BPy_Sound_methods[] = {
- /* name, method, flags, doc */
- {"getName", ( PyCFunction ) Sound_getName, METH_NOARGS,
- "() - Return Sound object name"},
- {"getFilename", ( PyCFunction ) Sound_getFilename, METH_NOARGS,
- "() - Return Sound object filename"},
- {"setName", ( PyCFunction ) Sound_setName, METH_VARARGS,
- "(name) - Set Sound object name"},
- {"setFilename", ( PyCFunction ) Sound_oldsetFilename, METH_VARARGS,
- "(filename) - Set Sound object filename"},
- {"setCurrent", ( PyCFunction ) Sound_setCurrent, METH_NOARGS,
- "() - make this the active sound in the sound buttons win (also redraws)"},
- {"play", ( PyCFunction ) Sound_play, METH_NOARGS,
- "() - play this sound"},
- {"unpack", ( PyCFunction ) Sound_unpack, METH_VARARGS,
- "(int) - Unpack sound. Uses one of the values defined in Blender.UnpackModes."},
- {"pack", ( PyCFunction ) Sound_pack, METH_NOARGS,
- "() Pack the sound"},
-/*
- {"reload", ( PyCFunction ) Sound_setCurrent, METH_NOARGS,
- "() - reload this Sound object's sample.\n\
- This is only useful if the original sound file has changed."},
-*/
- SOUND_FLOAT_METHOD_FUNCS( Volume )
- SOUND_FLOAT_METHOD_FUNCS( Attenuation )
- SOUND_FLOAT_METHOD_FUNCS( Pitch )
- /*
- SOUND_FLOAT_METHOD_FUNCS( Panning )
- SOUND_FLOAT_METHOD_FUNCS( MinGain )
- SOUND_FLOAT_METHOD_FUNCS( MaxGain )
- SOUND_FLOAT_METHOD_FUNCS( Distance )
- */
- {NULL, NULL, 0, NULL}
-};
-
-/* NOTE: these were copied and modified from image.h. To Be Done TBD:
- * macro-ize them, or C++ templates eventually?
- */
-/****************************************************************************/
-/* Function: M_Sound_Get */
-/* Python equivalent: Blender.Sound.Get */
-/* Description: Receives a string and returns the Sound object */
-/* whose name matches the string. If no argument is */
-/* passed in, a list of all Sound names in the */
-/* current scene is returned. */
-/****************************************************************************/
-static PyObject *M_Sound_Get( PyObject * self, PyObject * args )
-{
- char *name = NULL;
- bSound *snd_iter;
-
- if( !PyArg_ParseTuple( args, "|s", &name ) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument (or nothing)" ) );
-
- snd_iter = G.main->sound.first;
-
- if( name ) { /* (name) - Search Sound by name */
-
- BPy_Sound *wanted_Sound = NULL;
-
- while( ( snd_iter ) && ( wanted_Sound == NULL ) ) {
- if( strcmp( name, snd_iter->id.name + 2 ) == 0 ) {
- wanted_Sound =
- ( BPy_Sound * )
- PyObject_NEW( BPy_Sound, &Sound_Type );
- if( wanted_Sound ) {
- wanted_Sound->sound = snd_iter;
- break;
- }
- }
- snd_iter = snd_iter->id.next;
- }
-
- if( wanted_Sound == NULL ) { /* Requested Sound doesn't exist */
- char error_msg[64];
- PyOS_snprintf( error_msg, sizeof( error_msg ),
- "Sound \"%s\" not found", name );
- return ( EXPP_ReturnPyObjError
- ( PyExc_NameError, error_msg ) );
- }
-
- return ( PyObject * ) wanted_Sound;
- }
-
- else { /* () - return a list of all Sounds in the scene */
- int index = 0;
- PyObject *snd_list, *pyobj;
-
- snd_list = PyList_New( BLI_countlist( &( G.main->sound ) ) );
-
- if( snd_list == NULL )
- return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create PyList" ) );
-
- while( snd_iter ) {
- pyobj = Sound_CreatePyObject( snd_iter );
-
- if( !pyobj ) {
- Py_DECREF(snd_list);
- return ( EXPP_ReturnPyObjError
- ( PyExc_MemoryError,
- "couldn't create PyObject" ) );
- }
- PyList_SET_ITEM( snd_list, index, pyobj );
-
- snd_iter = snd_iter->id.next;
- index++;
- }
-
- return ( snd_list );
- }
-}
-
-/*****************************************************************************/
-/* Function: M_Sound_Load */
-/* Python equivalent: Blender.Sound.Load */
-/* Description: Receives a string and returns the Sound object */
-/* whose filename matches the string. */
-/*****************************************************************************/
-static PyObject *M_Sound_Load( PyObject * self, PyObject * value )
-{
- char *fname = PyString_AsString(value);
- bSound *snd_ptr;
- BPy_Sound *snd;
-
- if( !fname )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument" ) );
-
- snd = ( BPy_Sound * ) PyObject_NEW( BPy_Sound, &Sound_Type );
-
- if( !snd )
- return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create PyObject Sound_Type" ) );
-
- snd_ptr = sound_new_sound( fname );
-
- if( snd_ptr ) {
- if( G.ssound ) {
- G.ssound->sound = snd_ptr;
- }
- }
-
- if( !snd_ptr )
- return ( EXPP_ReturnPyObjError( PyExc_IOError,
- "not a valid sound sample" ) );
-
- snd->sound = snd_ptr;
-
- return ( PyObject * ) snd;
-}
-
-/*****************************************************************************/
-/* Function: Sound_Init */
-/*****************************************************************************/
-PyObject *Sound_Init( void )
-{
- PyObject *submodule;
-
- if( PyType_Ready( &Sound_Type ) < 0 )
- return NULL;
-
- submodule =
- Py_InitModule3( "Blender.Sound", M_Sound_methods,
- M_Sound_doc );
-
- return ( submodule );
-}
-
-/************************/
-/*** The Sound PyType ***/
-/************************/
-
-
-/*****************************************************************************/
-/* Function: Sound_CreatePyObject */
-/* Description: This function will create a new BPy_Sound from an existing */
-/* Blender Sound structure. */
-/*****************************************************************************/
-PyObject *Sound_CreatePyObject( bSound * snd )
-{
- BPy_Sound *py_snd;
-
- py_snd = ( BPy_Sound * ) PyObject_NEW( BPy_Sound, &Sound_Type );
-
- if( !py_snd )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create BPy_Sound object" );
-
- py_snd->sound = snd;
-
- return ( PyObject * ) py_snd;
-}
-
-/*****************************************************************************/
-/* Function: Sound_FromPyObject */
-/* Description: Returns the Blender Sound associated with this object */
-/*****************************************************************************/
-bSound *Sound_FromPyObject( PyObject * pyobj )
-{
- return ( ( BPy_Sound * ) pyobj )->sound;
-}
-
-/*****************************************************************************/
-/* Python BPy_Sound methods: */
-/*****************************************************************************/
-static PyObject *Sound_getName( BPy_Sound * self )
-{
- return PyString_FromString( self->sound->id.name + 2 );
-}
-
-static PyObject *Sound_getFilename( BPy_Sound * self )
-{
- return PyString_FromString( self->sound->name );
-}
-
-static PyObject *Sound_getPacked( BPy_Sound * self )
-{
- if (!sound_sample_is_null(self->sound)) {
- bSample *sample = sound_find_sample(self->sound);
- if (sample->packedfile)
- Py_RETURN_TRUE;
- }
- Py_RETURN_FALSE;
-}
-
-static PyObject *Sound_setName( BPy_Sound * self, PyObject * args )
-{
- char *name;
-
- if( !PyArg_ParseTuple( args, "s", &name ) ) {
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected a String as argument" ) );
- }
-
- rename_id( &self->sound->id, name );
-
- Py_RETURN_NONE;
-}
-
-static int Sound_setFilename( BPy_Sound * self, PyObject * value )
-{
- char *name;
-
- /* max len is FILE_MAXDIR = 160 chars like in DNA_image_types.h */
- name = PyString_AsString(value);
- if (!name || strlen(name) > FILE_MAXDIR)
- return ( EXPP_ReturnIntError( PyExc_ValueError,
- "string argument is limited to 160 chars at most" ) );
-
- strcpy( self->sound->name, name );
- return 0;
-}
-
-static PyObject *Sound_oldsetFilename( BPy_Sound * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)Sound_setFilename );
-}
-
-
-static PyObject *Sound_play( BPy_Sound * self )
-{
- sound_play_sound( self->sound );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Sound_setCurrent( BPy_Sound * self )
-{
- bSound *snd_ptr = self->sound;
-
- if( snd_ptr ) {
- if( G.ssound ) {
- G.ssound->sound = snd_ptr;
- }
- }
-
- EXPP_allqueue( REDRAWSOUND, 0 );
- EXPP_allqueue( REDRAWBUTSLOGIC, 0 );
-
- Py_RETURN_NONE;
-}
-
-/* unpack sound */
-
-static PyObject *Sound_unpack( BPy_Sound * self, PyObject * args )
-{
- bSound *sound = self->sound;
- int mode;
- if( !PyArg_ParseTuple( args, "i", &mode ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected an integer from Blender.UnpackModes" );
-
- if (!sound_sample_is_null(sound)) {
- bSample *sample = sound_find_sample(sound);
- if (sample->packedfile) {
- if (unpackSample(sample, mode) == RET_ERROR)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "error unpacking sound");
- }
- } else {
- return EXPP_ReturnPyObjError( PyExc_RuntimeError, "sound has no samples" );
- }
- Py_RETURN_NONE;
-}
-
-/* pack sound */
-
-static PyObject *Sound_pack( BPy_Sound * self )
-{
- bSound *sound = self->sound;
- if (!sound_sample_is_null(sound))
- {
- bSample *sample = sound_find_sample(sound);
- if (sample->packedfile )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "sound alredy packed" );
- sound_set_packedfile(sample, newPackedFile(sample->name));
- }
- else
- {
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "sound has no samples" );
- }
- Py_RETURN_NONE;
-}
-
-/*
-static PyObject *Sound_reload( BPy_Sound * self)
-{
- sound_free_sample();
-
- if (sound->snd_sound) {
- SND_RemoveSound(ghSoundScene, sound->snd_sound);
- sound->snd_sound = NULL;
- }
-
- Py_RETURN_NONE;
-}
-*/
-
-
-
-/*****************************************************************************/
-/* Function: Sound_compare */
-/* Description: This is a callback function for the BPy_Sound type. It */
-/* compares two Sound_Type objects. Only the "==" and "!=" */
-/* comparisons are meaninful. Returns 0 for equality and -1 if */
-/* they don't point to the same Blender Sound struct. */
-/* In Python it becomes 1 if they are equal, 0 otherwise. */
-/*****************************************************************************/
-static int Sound_compare( BPy_Sound * a, BPy_Sound * b )
-{
- return ( a->sound == b->sound ) ? 0 : -1;
-}
-
-/*****************************************************************************/
-/* Function: Sound_repr */
-/* Description: This is a callback function for the BPy_Sound type. It */
-/* builds a meaninful string to represent Sound objects. */
-/*****************************************************************************/
-static PyObject *Sound_repr( BPy_Sound * self )
-{
- return PyString_FromFormat( "[Sound \"%s\"]",
- self->sound->id.name + 2 );
-}
-
-/*****************************************************************************/
-/* Python attributes get/set structure: */
-/*****************************************************************************/
-static PyGetSetDef BPy_Sound_getseters[] = {
- GENERIC_LIB_GETSETATTR,
- {"filename", (getter)Sound_getFilename, (setter)Sound_setFilename,
- "text filename", NULL},
- {"packed", (getter)Sound_getPacked, (setter)NULL,
- "text filename", NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-
-
-/*****************************************************************************/
-/* Python Sound_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject Sound_Type = {
- PyObject_HEAD_INIT( NULL )
- 0, /* ob_size */
- "Blender Sound", /* tp_name */
- sizeof( BPy_Sound ), /* tp_basicsize */
- 0, /* tp_itemsize */
- /* methods */
- NULL, /* tp_dealloc */
- 0, /* tp_print */
- NULL, /* tp_getattr */
- NULL, /* tp_setattr */
- ( cmpfunc ) Sound_compare, /* tp_compare */
- ( reprfunc ) Sound_repr, /* tp_repr */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- NULL, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
- 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, /* 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, /* 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 ***/
- BPy_Sound_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_Sound_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-
diff --git a/source/blender/python/api2_2x/Sound.h b/source/blender/python/api2_2x/Sound.h
deleted file mode 100644
index 06e9a95bdc5..00000000000
--- a/source/blender/python/api2_2x/Sound.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * $Id: Sound.h 10269 2007-03-15 01:09:14Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Chris Keith
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_SOUND_H
-#define EXPP_SOUND_H
-
-#include <Python.h>
-#include "DNA_sound_types.h"
-
-#define BPy_Sound_Check(v) ((v)->ob_type == &Sound_Type)
-extern PyTypeObject Sound_Type;
-
-/*****************************************************************************/
-/* Python BPy_Sound structure definition */
-/*****************************************************************************/
-typedef struct {
- PyObject_HEAD
- bSound * sound;
-} BPy_Sound;
-
-/*****************************************************************************/
-/* Module Blender.Sound - public functions */
-/*****************************************************************************/
-PyObject *Sound_Init( void );
-PyObject *Sound_CreatePyObject( bSound * sound );
-bSound *Sound_FromPyObject( PyObject * pyobj );
-
-#endif /* EXPP_SOUND_H */
diff --git a/source/blender/python/api2_2x/SurfNurb.c b/source/blender/python/api2_2x/SurfNurb.c
deleted file mode 100644
index 1d2e74a26a8..00000000000
--- a/source/blender/python/api2_2x/SurfNurb.c
+++ /dev/null
@@ -1,857 +0,0 @@
-/*
- * $Id: SurfNurb.c 11400 2007-07-28 09:26:53Z campbellbarton $
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Stephen Swaney
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include "SurfNurb.h" /*This must come first */
-
-#include "BKE_curve.h"
-#include "BDR_editcurve.h" /* for convertspline */
-#include "MEM_guardedalloc.h"
-#include "gen_utils.h"
-#include "gen_library.h"
-#include "BezTriple.h"
-
-/*
- * forward declarations go here
- */
-
-static int SurfNurb_setPoint( BPy_SurfNurb * self, int index, PyObject * ob );
-static int SurfNurb_length( PyInstanceObject * inst );
-static PyObject *SurfNurb_getIter( BPy_SurfNurb * self );
-static PyObject *SurfNurb_iterNext( BPy_SurfNurb * self );
-PyObject *SurfNurb_append( BPy_SurfNurb * self, PyObject * args );
-
-char M_SurfNurb_doc[] = "SurfNurb";
-
-/*
- table of module methods
- these are the equivalent of class or static methods.
- you do not need an object instance to call one.
-*/
-
-static PyMethodDef M_SurfNurb_methods[] = {
-/* name, method, flags, doc_string */
-/* {"Get", (PyCFunction) M_SurfNurb_method, METH_NOARGS, " () - doc string"}, */
-/* {"method", (PyCFunction) M_SurfNurb_method, METH_NOARGS, " () - doc string"}, */
-
- {NULL, NULL, 0, NULL}
-};
-
-/*
- * method table
- * table of instance methods
- * these methods are invoked on an instance of the type.
-*/
-
-static PyMethodDef BPy_SurfNurb_methods[] = {
-# if 0
- {"append", ( PyCFunction ) SurfNurb_append, METH_VARARGS,
- "( point ) - add a new point. arg is BezTriple or list of x,y,z,w floats"},
-#endif
- {NULL, NULL, 0, NULL}
-};
-
-/*
- * SurfNurb_appendPointToNurb
- * this is a non-bpy utility func to add a point to a given nurb.
- * notice the first arg is Nurb*.
- */
-
-#if 0
-static PyObject *SurfNurb_appendPointToNurb( Nurb * nurb, PyObject * args )
-{
-
- int i;
- int size;
- PyObject *pyOb;
- int npoints = nurb->pntsu;
-
- /*
- do we have a list of four floats or a BezTriple?
- */
- if( !PyArg_ParseTuple( args, "O", &pyOb ))
- return EXPP_ReturnPyObjError
- ( PyExc_RuntimeError,
- "Internal error parsing arguments" );
-
-
-
- /* if curve is empty, adjust type depending on input type */
- if (nurb->bezt==NULL && nurb->bp==NULL) {
- if (BPy_BezTriple_Check( pyOb ))
- nurb->type |= CU_BEZIER;
- else if (PySequence_Check( pyOb ))
- nurb->type |= CU_NURBS;
- else
- return( EXPP_ReturnPyObjError( PyExc_TypeError,
- "Expected a BezTriple or a Sequence of 4 (or 5) floats" ) );
- }
-
-
-
- if ((nurb->type & 7)==CU_BEZIER) {
- BezTriple *tmp;
-
- if( !BPy_BezTriple_Check( pyOb ) )
- return( EXPP_ReturnPyObjError( PyExc_TypeError,
- "Expected a BezTriple\n" ) );
-
-/* printf("\ndbg: got a BezTriple\n"); */
- tmp = nurb->bezt; /* save old points */
- nurb->bezt =
- ( BezTriple * ) MEM_mallocN( sizeof( BezTriple ) *
- ( npoints + 1 ),
- "SurfNurb_append2" );
-
- if( !nurb->bezt )
- return ( EXPP_ReturnPyObjError
- ( PyExc_MemoryError, "allocation failed" ) );
-
- /* copy old points to new */
- if( tmp ) {
- memmove( nurb->bezt, tmp, sizeof( BezTriple ) * npoints );
- MEM_freeN( tmp );
- }
-
- nurb->pntsu++;
- /* add new point to end of list */
- memcpy( nurb->bezt + npoints,
- BezTriple_FromPyObject( pyOb ), sizeof( BezTriple ) );
-
- }
- else if( PySequence_Check( pyOb ) ) {
- size = PySequence_Size( pyOb );
-/* printf("\ndbg: got a sequence of size %d\n", size ); */
- if( size == 4 || size == 5 ) {
- BPoint *tmp;
-
- tmp = nurb->bp; /* save old pts */
-
- nurb->bp =
- ( BPoint * ) MEM_mallocN( sizeof( BPoint ) *
- ( npoints + 1 ),
- "SurfNurb_append1" );
- if( !nurb->bp )
- return ( EXPP_ReturnPyObjError
- ( PyExc_MemoryError,
- "allocation failed" ) );
-
- memmove( nurb->bp, tmp, sizeof( BPoint ) * npoints );
- if( tmp )
- MEM_freeN( tmp );
-
- ++nurb->pntsu;
- /* initialize new BPoint from old */
- memcpy( nurb->bp + npoints, nurb->bp,
- sizeof( BPoint ) );
-
- for( i = 0; i < 4; ++i ) {
- PyObject *item = PySequence_GetItem( pyOb, i );
-
- if (item == NULL)
- return NULL;
-
-
- nurb->bp[npoints].vec[i] = ( float ) PyFloat_AsDouble( item );
- Py_DECREF( item );
- }
-
- if (size == 5) {
- PyObject *item = PySequence_GetItem( pyOb, i );
-
- if (item == NULL)
- return NULL;
-
- nurb->bp[npoints].alfa = ( float ) PyFloat_AsDouble( item );
- Py_DECREF( item );
- }
- else {
- nurb->bp[npoints].alfa = 0.0f;
- }
-
- makeknots( nurb, 1, nurb->flagu >> 1 );
-
- } else {
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a sequence of 4 or 5 floats" );
- }
-
- } else {
- /* bail with error */
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a sequence of 4 or 5 floats" );
-
- }
-
- return ( EXPP_incr_ret( Py_None ) );
-}
-
-/*
- * SurfNurb_append( point )
- * append a new point to a nurb curve.
- * arg is BezTriple or list of xyzw floats
- */
-
-PyObject *SurfNurb_append( BPy_SurfNurb * self, PyObject * args )
-{
- Nurb *nurb = self->nurb;
-
- return SurfNurb_appendPointToNurb( nurb, args );
-}
-#endif
-
-#if 0
-/*
- * SurfNurb_getMatIndex
- *
- * returns index into material list
- */
-
-static PyObject *SurfNurb_getMatIndex( BPy_SurfNurb * self )
-{
- return PyInt_FromLong( ( long ) self->nurb->mat_nr );
-}
-
-/*
- * SurfNurb_setMatIndex
- *
- * set index into material list
- */
-
-static int SurfNurb_setMatIndex( BPy_SurfNurb * self, PyObject * args )
-{
- args = PyNumber_Int( args );
-
- if( !args )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected integer argument" );
-
- /* fixme: some range checking would be nice! */
- /* can't do range checking without knowing the "parent" curve! */
- self->nurb->mat_nr = ( short )PyInt_AS_LONG( args );
- Py_DECREF( args );
-
- return 0;
-}
-#endif
-
-/*
- * SurfNurb_getPointsU
- *
- * returns number of control points in U direction
- */
-
-static PyObject *SurfNurb_getPointsU( BPy_SurfNurb * self )
-{
- return PyInt_FromLong( ( long ) self->nurb->pntsu );
-}
-
-/*
- * SurfNurb_getPointsV
- *
- * returns number of control points in V direction
- */
-
-static PyObject *SurfNurb_getPointsV( BPy_SurfNurb * self )
-{
- return PyInt_FromLong( ( long ) self->nurb->pntsv );
-}
-
-/*
- * SurfNurb_getFlagU
- *
- * returns curve's flagu
- */
-
-static PyObject *SurfNurb_getFlagU( BPy_SurfNurb * self )
-{
- return PyInt_FromLong( ( long ) (self->nurb->flagu >> 1) );
-}
-
-/*
- * SurfNurb_setFlagU
- *
- * set curve's flagu and recalculate the knots
- *
- * Possible values: 0 - uniform, 2 - endpoints, 4 - bezier
- * bit 0 controls CU_CYCLIC
- */
-
-static int SurfNurb_setFlagU( BPy_SurfNurb * self, PyObject * args )
-{
- int flagu;
-
- args = PyNumber_Int( args );
- if( !args )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected integer argument" );
-
- flagu = ( int )PyInt_AS_LONG( args );
- Py_DECREF( args );
-
- if( flagu < 0 || flagu > 2 )
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "expected integer argument in range [0,2]" );
-
- flagu = (flagu << 1) | (self->nurb->flagu & CU_CYCLIC);
- if( self->nurb->flagu != flagu ) {
- self->nurb->flagu = (short)flagu;
- makeknots( self->nurb, 1, self->nurb->flagu >> 1 );
- }
-
- return 0;
-}
-
-/*
- * SurfNurb_getFlagV
- *
- * returns curve's flagu
- */
-
-static PyObject *SurfNurb_getFlagV( BPy_SurfNurb * self )
-{
- return PyInt_FromLong( ( long ) (self->nurb->flagv >> 1) );
-}
-
-/*
- * SurfNurb_setFlagV
- *
- * set curve's flagu and recalculate the knots
- *
- * Possible values: 0 - uniform, 1 - endpoints, 2 - bezier
- */
-
-static int SurfNurb_setFlagV( BPy_SurfNurb * self, PyObject * args )
-{
- int flagv;
-
- args = PyNumber_Int( args );
- if( !args )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected integer argument" );
-
- flagv = ( int )PyInt_AS_LONG( args );
- Py_DECREF( args );
-
- if( flagv < 0 || flagv > 2 )
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "expected integer argument in range [0,2]" );
-
- flagv = (flagv << 1) | (self->nurb->flagv & CU_CYCLIC);
- if( self->nurb->flagv != flagv ) {
- self->nurb->flagv = (short)flagv;
- makeknots( self->nurb, 2, self->nurb->flagv >> 1 );
- }
-
- return 0;
-}
-
-/*
- * SurfNurb_getOrder
- *
- * returns curve's order
- */
-
-static PyObject *SurfNurb_getOrderU( BPy_SurfNurb * self )
-{
- return PyInt_FromLong( ( long ) self->nurb->orderu );
-}
-
-static int SurfNurb_setOrderU( BPy_SurfNurb * self, PyObject * args )
-{
- int order;
-
- args = PyNumber_Int( args );
- if( !args )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected integer argument" );
-
- order = ( int )PyInt_AS_LONG( args );
- Py_DECREF( args );
-
- if( order < 2 ) order = 2;
- else if( order > 6 ) order = 6;
-
- if( self->nurb->pntsu < order )
- order = self->nurb->pntsu;
-
- self->nurb->orderu = (short)order;
- makeknots( self->nurb, 1, self->nurb->flagu >> 1 );
-
- return 0;
-}
-
-static PyObject *SurfNurb_getOrderV( BPy_SurfNurb * self )
-{
- return PyInt_FromLong( ( long ) self->nurb->orderv );
-}
-
-static int SurfNurb_setOrderV( BPy_SurfNurb * self, PyObject * args )
-{
- int order;
-
- args = PyNumber_Int( args );
- if( !args )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected integer argument" );
-
- order = ( int )PyInt_AS_LONG( args );
- Py_DECREF( args );
-
- if( order < 2 ) order = 2;
- else if( order > 6 ) order = 6;
-
- if( self->nurb->pntsv < order )
- order = self->nurb->pntsv;
-
- self->nurb->orderv = (short)order;
- makeknots( self->nurb, 2, self->nurb->flagv >> 1 );
- return 0;
-}
-
-/*
- * SurfNurb_getCyclic()
- * test whether surface is cyclic (closed) or not (open)
- */
-
-static PyObject *SurfNurb_getCyclicU( BPy_SurfNurb * self )
-{
- if( self->nurb->flagu & CU_CYCLIC )
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
-}
-
-static PyObject *SurfNurb_getCyclicV( BPy_SurfNurb * self )
-{
- if( self->nurb->flagv & CU_CYCLIC )
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
-}
-
-static int SurfNurb_setCyclicU( BPy_SurfNurb * self, PyObject * value )
-{
- int param = PyObject_IsTrue( value );
- if( param == -1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected True/False or 0/1" );
-
- if( param )
- self->nurb->flagu |= CU_CYCLIC;
- else
- self->nurb->flagu &= ~CU_CYCLIC;
- makeknots( self->nurb, 1, self->nurb->flagu >> 1 );
- return 0;
-}
-
-static int SurfNurb_setCyclicV( BPy_SurfNurb * self, PyObject * value )
-{
- int param = PyObject_IsTrue( value );
- if( param == -1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected True/False or 0/1" );
-
- if( param )
- self->nurb->flagv |= CU_CYCLIC;
- else
- self->nurb->flagv &= ~CU_CYCLIC;
- makeknots( self->nurb, 2, self->nurb->flagu >> 1 );
- return 0;
-}
-
-
-/*
- * SurfNurb_getIter
- *
- * create an iterator for our SurfNurb.
- * this iterator returns the points for this SurfNurb.
- */
-
-static PyObject *SurfNurb_getIter( BPy_SurfNurb * self )
-{
- self->bp = self->nurb->bp;
- self->bezt = self->nurb->bezt;
- self->nextPoint = 0;
-
- Py_INCREF( self );
- return ( PyObject * ) self;
-}
-
-static PyObject *SurfNurb_iterNext( BPy_SurfNurb * self )
-{
- Nurb *pnurb = self->nurb;
- int npoints = pnurb->pntsu * pnurb->pntsv;
-
- if( self->bp && self->nextPoint < npoints )
- return SurfNurb_pointAtIndex( self->nurb, self->nextPoint++ );
- else
- return EXPP_ReturnPyObjError( PyExc_StopIteration,
- "iterator at end" );
-}
-
-/*
- * SurfNurb_length
- * returns the number of points in a Nurb
- * this is a tp_as_sequence method, not a regular instance method.
- */
-
-static int SurfNurb_length( PyInstanceObject * inst )
-{
- Nurb *nurb;
-
- if( BPy_SurfNurb_Check( ( PyObject * ) inst ) ) {
- nurb = ( ( BPy_SurfNurb * ) inst )->nurb;
- return (int)(nurb->pntsu * nurb->pntsu);
- }
-
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "arg is not a BPy_SurfNurb" );
-}
-
-
-/*
- * SurfNurb_getPoint
- * returns the Nth point in a Nurb
- * this is one of the tp_as_sequence methods, hence the int N argument.
- * it is called via the [] operator, not as a usual instance method.
- */
-
-PyObject *SurfNurb_getPoint( BPy_SurfNurb * self, int index )
-{
- Nurb *myNurb;
-
- int npoints;
-
- /* for convenince */
- myNurb = self->nurb;
- npoints = myNurb->pntsu * myNurb->pntsv;
-
- /* bail if no Nurbs in Curve */
- if( npoints == 0 )
- return ( EXPP_ReturnPyObjError( PyExc_IndexError,
- "no points in this SurfNurb" ) );
-
- /* check index limits */
- if( index >= npoints || index < 0 )
- return ( EXPP_ReturnPyObjError( PyExc_IndexError,
- "index out of range" ) );
-
- return SurfNurb_pointAtIndex( myNurb, index );
-}
-
-/*
- * SurfNurb_setPoint
- * modifies the Nth point in a Nurb
- * this is one of the tp_as_sequence methods, hence the int N argument.
- * it is called via the [] = operator, not as a usual instance method.
- */
-static int SurfNurb_setPoint( BPy_SurfNurb * self, int index, PyObject * pyOb )
-{
- Nurb *nurb = self->nurb;
- int size;
-
- /* check index limits */
- if( index < 0 || index >= nurb->pntsu * nurb->pntsv )
- return EXPP_ReturnIntError( PyExc_IndexError,
- "array assignment index out of range\n" );
-
- /* branch by curve type */
-#if 0
- if ((nurb->type & 7)==CU_BEZIER) { /* BEZIER */
- /* check parameter type */
- if( !BPy_BezTriple_Check( pyOb ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a BezTriple\n" );
-
- /* copy bezier in array */
- memcpy( nurb->bezt + index,
- BezTriple_FromPyObject( pyOb ), sizeof( BezTriple ) );
-
- return 0; /* finished correctly */
- }
- else
-#endif
- { /* NURBS or POLY */
- int i;
-
- /* check parameter type */
- if (!PySequence_Check( pyOb ))
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a list of 4 (or optionaly 5 if the curve is 3D) floats\n" );
-
- size = PySequence_Size( pyOb );
-
- /* check sequence size */
- if( size != 4 && size != 5 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a list of 4 (or optionaly 5 if the curve is 3D) floats\n" );
-
- /* copy x, y, z, w */
- for( i = 0; i < 4; ++i ) {
- PyObject *item = PySequence_GetItem( pyOb, i );
-
- if (item == NULL)
- return -1;
-
- nurb->bp[index].vec[i] = ( float ) PyFloat_AsDouble( item );
- Py_DECREF( item );
- }
-
- if (size == 5) { /* set tilt, if present */
- PyObject *item = PySequence_GetItem( pyOb, i );
-
- if (item == NULL)
- return -1;
-
- nurb->bp[index].alfa = ( float ) PyFloat_AsDouble( item );
- Py_DECREF( item );
- }
- else { /* if not, set default */
- nurb->bp[index].alfa = 0.0f;
- }
-
- return 0; /* finished correctly */
- }
-}
-
-
-/*
- * this is an internal routine. not callable directly from python
- */
-
-PyObject *SurfNurb_pointAtIndex( Nurb * nurb, int index )
-{
- PyObject *pyo;
-
- if( nurb->bp ) { /* we have a nurb curve */
- int i;
-
- /* add Tilt only if curve is 3D */
- if (nurb->flag & CU_3D)
- pyo = PyList_New( 5 );
- else
- pyo = PyList_New( 4 );
-
- for( i = 0; i < 4; i++ ) {
- PyList_SetItem( pyo, i,
- PyFloat_FromDouble( nurb->bp[index].
- vec[i] ) );
- }
-
- /* add Tilt only if curve is 3D */
- if (nurb->flag & CU_3D)
- PyList_SetItem( pyo, 4, PyFloat_FromDouble( nurb->bp[index].alfa ) );
- return pyo;
-
- } else /* something is horribly wrong */
- return EXPP_ReturnPyObjError( PyExc_SystemError,
- "non-NURB surface found" );
-}
-
-/*
- * methods for SurfNurb as sequence
- */
-
-static PySequenceMethods SurfNurb_as_sequence = {
- ( inquiry ) SurfNurb_length, /* sq_length */
- ( binaryfunc ) 0, /* sq_concat */
- ( intargfunc ) 0, /* sq_repeat */
- ( intargfunc ) SurfNurb_getPoint, /* sq_item */
- ( intintargfunc ) 0, /* sq_slice */
- ( intobjargproc ) SurfNurb_setPoint, /* sq_ass_item */
- 0, /* sq_ass_slice */
- ( objobjproc ) 0, /* sq_contains */
- 0,
- 0
-};
-
-static PyGetSetDef BPy_SurfNurb_getseters[] = {
-#if 0
- {"matIndex",
- (getter)SurfNurb_getMatIndex, (setter)SurfNurb_setMatIndex,
- "material index", NULL},
-#endif
- {"pointsU",
- (getter)SurfNurb_getPointsU, (setter)NULL,
- "number of control points in U direction", NULL},
- {"pointsV",
- (getter)SurfNurb_getPointsV, (setter)NULL,
- "number of control points in V direction", NULL},
- {"flagU",
- (getter)SurfNurb_getFlagU, (setter)SurfNurb_setFlagU,
- "knot flag for U direction", NULL},
- {"flagV",
- (getter)SurfNurb_getFlagV, (setter)SurfNurb_setFlagV,
- "knot flag for V direction", NULL},
- {"cyclicU",
- (getter)SurfNurb_getCyclicU, (setter)SurfNurb_setCyclicU,
- "cyclic setting for U direction", NULL},
- {"cyclicV",
- (getter)SurfNurb_getCyclicV, (setter)SurfNurb_setCyclicV,
- "cyclic setting for V direction", NULL},
- {"orderU",
- (getter)SurfNurb_getOrderU, (setter)SurfNurb_setOrderU,
- "order setting for U direction", NULL},
- {"orderV",
- (getter)SurfNurb_getOrderV, (setter)SurfNurb_setOrderV,
- "order setting for V direction", NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-/*
- * compare
- * in this case, we consider two SurfNurbs equal, if they point to the same
- * blender data.
-*/
-static int SurfNurb_compare( BPy_SurfNurb * a, BPy_SurfNurb * b )
-{
- return ( a->nurb == b->nurb ) ? 0 : -1;
-}
-
-/*
- * SurfNurb_repr
- */
-static PyObject *SurfNurb_repr( BPy_SurfNurb * self )
-{
- return PyString_FromFormat( "[SurfNurb \"%d\"]", self->nurb->type );
-}
-
-/*****************************************************************************/
-/* Python SurfNurb_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject SurfNurb_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "SurfNurb", /* char *tp_name; */
- sizeof( BPy_SurfNurb ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL, /* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- ( cmpfunc ) SurfNurb_compare, /* cmpfunc tp_compare; */
- ( reprfunc ) SurfNurb_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- &SurfNurb_as_sequence, /* 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; */
- 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, /* 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, /* richcmpfunc tp_richcompare; */
-
- /*** weak reference enabler ***/
- 0, /* long tp_weaklistoffset; */
-
- /*** Added in release 2.2 ***/
- /* Iterators */
- ( getiterfunc ) SurfNurb_getIter, /* getiterfunc tp_iter; */
- ( iternextfunc ) SurfNurb_iterNext, /* iternextfunc tp_iternext; */
-
- /*** Attribute descriptor and subclassing stuff ***/
- BPy_SurfNurb_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_SurfNurb_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-/*
- factory method to create a BPy_SurfNurb from a Blender Nurb
-*/
-
-PyObject *SurfNurb_CreatePyObject( Nurb * blen_nurb )
-{
- BPy_SurfNurb *pyNurb;
-
- pyNurb = ( BPy_SurfNurb * ) PyObject_NEW( BPy_SurfNurb, &SurfNurb_Type );
-
- if( !pyNurb )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "could not create BPy_SurfNurb PyObject" );
-
- pyNurb->nurb = blen_nurb;
- return ( PyObject * ) pyNurb;
-}
-
-
-PyObject *SurfNurb_Init( void )
-{
- PyType_Ready( &SurfNurb_Type );
- return Py_InitModule3( "Blender.SurfNurb", M_SurfNurb_methods,
- M_SurfNurb_doc );
-}
-
diff --git a/source/blender/python/api2_2x/SurfNurb.h b/source/blender/python/api2_2x/SurfNurb.h
deleted file mode 100644
index 30d9a48012e..00000000000
--- a/source/blender/python/api2_2x/SurfNurb.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * $Id: SurfNurb.h 10269 2007-03-15 01:09:14Z campbellbarton $
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Stephen Swaney
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#ifndef EXPP_SURFNURB_H
-#define EXPP_SURFNURB_H
-
-#include <Python.h>
-#include "DNA_curve_types.h"
-
-extern PyTypeObject SurfNurb_Type;
-
-#define BPy_SurfNurb_Check(v) ((v)->ob_type == &SurfNurb_Type) /* for type checking */
-
-/* Python BPy_SurfNurb structure definition */
-typedef struct {
- PyObject_HEAD
- Nurb * nurb;
-
- /* iterator stuff */
- /* internal ptrs to point data. do not free */
- BPoint *bp;
- BezTriple *bezt;
- int atEnd; /* iter exhausted flag */
- int nextPoint;
-
-} BPy_SurfNurb;
-
-
-/*
- * prototypes
- */
-
-PyObject *SurfNurb_Init( void );
-PyObject *SurfNurb_CreatePyObject( Nurb * bzt );
-Nurb *SurfNurb_FromPyObject( PyObject * pyobj );
-
-PyObject *SurfNurb_getPoint( BPy_SurfNurb * self, int index );
-PyObject *SurfNurb_pointAtIndex( Nurb * nurb, int index );
-
-#endif /* EXPP_SURFNURB_H */
diff --git a/source/blender/python/api2_2x/Sys.c b/source/blender/python/api2_2x/Sys.c
deleted file mode 100644
index e936eb56b59..00000000000
--- a/source/blender/python/api2_2x/Sys.c
+++ /dev/null
@@ -1,400 +0,0 @@
-/*
- * $Id: Sys.c 10945 2007-06-16 13:17:41Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano, Campbell Barton
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#include "Sys.h" /*This must come first*/
-
-#include "BKE_utildefines.h"
-#include "BKE_global.h"
-#include "BLI_blenlib.h"
-#include "DNA_scene_types.h" /* G.scene-"r.cfra */
-#include "PIL_time.h"
-#include "gen_utils.h"
-
-#ifdef WIN32
-#define DIRSEP '\\'
-#define DIRSEP_STR "\\"
-#else
-#define DIRSEP '/'
-#define DIRSEP_STR "/"
-#endif
-
-
-/*****************************************************************************/
-/* Python API function prototypes for the sys module. */
-/*****************************************************************************/
-static PyObject *M_sys_basename( PyObject * self, PyObject * value );
-static PyObject *M_sys_dirname( PyObject * self, PyObject * value );
-static PyObject *M_sys_join( PyObject * self, PyObject * args );
-static PyObject *M_sys_splitext( PyObject * self, PyObject * value );
-static PyObject *M_sys_makename( PyObject * self, PyObject * args,
- PyObject * kw );
-static PyObject *M_sys_exists( PyObject * self, PyObject * value );
-static PyObject *M_sys_time( PyObject * self );
-static PyObject *M_sys_sleep( PyObject * self, PyObject * args );
-static PyObject *M_sys_expandpath( PyObject *self, PyObject *value);
-
-/*****************************************************************************/
-/* The following string definitions are used for documentation strings. */
-/* In Python these will be written to the console when doing a */
-/* Blender.sys.__doc__ */
-/*****************************************************************************/
-static char M_sys_doc[] = "The Blender.sys submodule\n\
-\n\
-This is a minimal system module to supply simple functionality available\n\
-in the default Python module os.";
-
-static char M_sys_basename_doc[] =
- "(path) - Split 'path' in dir and filename.\n\
-Return the filename.";
-
-static char M_sys_dirname_doc[] =
- "(path) - Split 'path' in dir and filename.\n\
-Return the dir.";
-
-static char M_sys_join_doc[] =
- "(dir, file) - Join dir and file to form a full filename.\n\
-Return the filename.";
-
-static char M_sys_splitext_doc[] =
- "(path) - Split 'path' in root and extension:\n\
-/this/that/file.ext -> ('/this/that/file','.ext').\n\
-Return the pair (root, extension).";
-
-static char M_sys_makename_doc[] =
- "(path = Blender.Get('filename'), ext = \"\", strip = 0) -\n\
-Strip dir and extension from path, leaving only a name, then append 'ext'\n\
-to it (if given) and return the resulting string.\n\n\
-(path) - string: a pathname -- Blender.Get('filename') if 'path' isn't given;\n\
-(ext = \"\") - string: the extension to append.\n\
-(strip = 0) - int: strip dirname from 'path' if given and non-zero.\n\
-Ex: makename('/path/to/file/myfile.foo','-01.abc') returns 'myfile-01.abc'\n\
-Ex: makename(ext='.txt') returns 'untitled.txt' if Blender.Get('filename')\n\
-returns a path to the file 'untitled.blend'";
-
-static char M_sys_time_doc[] =
- "() - Return a float representing time elapsed in seconds.\n\
-Each successive call is garanteed to return values greater than or\n\
-equal to the previous call.";
-
-static char M_sys_sleep_doc[] =
- "(milliseconds = 10) - Sleep for the specified time.\n\
-(milliseconds = 10) - the amount of time in milliseconds to sleep.\n\
-This function can be necessary in tight 'get event' loops.";
-
-static char M_sys_exists_doc[] =
- "(path) - Check if the given pathname exists.\n\
-The return value is as follows:\n\
-\t 0: path doesn't exist;\n\
-\t 1: path is an existing filename;\n\
-\t 2: path is an existing dirname;\n\
-\t-1: path exists but is neither a regular file nor a dir.";
-
-static char M_sys_expandpath_doc[] =
-"(path) - Expand this Blender internal path to a proper file system path.\n\
-(path) - the string path to convert.\n\n\
-Note: internally Blender paths can contain two special character sequences:\n\
-- '//' (at start) for base path directory (the current .blend's dir path);\n\
-- '#' (at ending) for current frame number.\n\n\
-This function expands these to their actual content, returning a valid path.\n\
-If the special chars are not found in the given path, it is simply returned.";
-
-/*****************************************************************************/
-/* Python method structure definition for Blender.sys module: */
-/*****************************************************************************/
-struct PyMethodDef M_sys_methods[] = {
- {"basename", M_sys_basename, METH_O, M_sys_basename_doc},
- {"dirname", M_sys_dirname, METH_O, M_sys_dirname_doc},
- {"join", M_sys_join, METH_VARARGS, M_sys_join_doc},
- {"splitext", M_sys_splitext, METH_O, M_sys_splitext_doc},
- {"makename", ( PyCFunction ) M_sys_makename,
- METH_VARARGS | METH_KEYWORDS,
- M_sys_makename_doc},
- {"exists", M_sys_exists, METH_O, M_sys_exists_doc},
- {"sleep", M_sys_sleep, METH_VARARGS, M_sys_sleep_doc},
- {"time", ( PyCFunction ) M_sys_time, METH_NOARGS, M_sys_time_doc},
- {"expandpath", M_sys_expandpath, METH_O, M_sys_expandpath_doc},
- {NULL, NULL, 0, NULL}
-};
-
-/* Module Functions */
-
-static PyObject *g_sysmodule = NULL; /* pointer to Blender.sys module */
-
-PyObject *sys_Init( void )
-{
- PyObject *submodule, *dict;
-
- submodule = Py_InitModule3( "Blender.sys", M_sys_methods, M_sys_doc );
-
- g_sysmodule = submodule;
-
- dict = PyModule_GetDict( submodule );
-
- EXPP_dict_set_item_str( dict, "dirsep", PyString_FromString(DIRSEP_STR) );
- EXPP_dict_set_item_str( dict, "sep", PyString_FromString(DIRSEP_STR) );
-
- return submodule;
-}
-
-static PyObject *M_sys_basename( PyObject * self, PyObject * value )
-{
- char *name = PyString_AsString(value);
- char *p, basename[FILE_MAXDIR + FILE_MAXFILE];
- int n, len;
-
- if( !name )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument" );
-
- len = strlen( name );
-
-#ifdef WIN32
- p = MAX2(strrchr( name, '/' ), strrchr( name, '\\' ));
-#else
- p = strrchr( name, DIRSEP );
-#endif
-
- if( p ) {
- n = name + len - p - 1; /* - 1 because we don't want the sep */
-
- if( n > FILE_MAXDIR + FILE_MAXFILE )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "path too long" );
-
- BLI_strncpy( basename, p + 1, n + 1 );
- return PyString_FromString( basename );
- }
-
- return PyString_FromString( name );
-}
-
-static PyObject *M_sys_dirname( PyObject * self, PyObject * value )
-{
- char *name = PyString_AsString(value);
- char *p, dirname[FILE_MAXDIR + FILE_MAXFILE];
- int n;
-
- if( !name )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument" );
-
-#ifdef WIN32
- p = MAX2(strrchr( name, '/' ), strrchr( name, '\\' ));
-#else
- p = strrchr( name, DIRSEP );
-#endif
-
- if( p ) {
- n = p - name;
-
- if( n > FILE_MAXDIR + FILE_MAXFILE )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "path too long" );
-
- BLI_strncpy( dirname, name, n + 1 );
- return PyString_FromString( dirname );
- }
-
- return PyString_FromString( "." );
-}
-
-static PyObject *M_sys_join( PyObject * self, PyObject * args )
-{
- char *name = NULL, *path = NULL;
- char filename[FILE_MAXDIR + FILE_MAXFILE];
- int pathlen = 0, namelen = 0;
-
- if( !PyArg_ParseTuple( args, "ss", &path, &name ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument" );
-
- pathlen = strlen( path ) + 1;
- namelen = strlen( name ) + 1; /* + 1 to account for '\0' for BLI_strncpy */
-
- if( pathlen + namelen > FILE_MAXDIR + FILE_MAXFILE - 1 )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "filename is too long." );
-
- BLI_strncpy( filename, path, pathlen );
-
- if( filename[pathlen - 2] != DIRSEP ) {
- filename[pathlen - 1] = DIRSEP;
- pathlen += 1;
- }
-
- BLI_strncpy( filename + pathlen - 1, name, namelen );
-
- return PyString_FromString( filename );
-}
-
-static PyObject *M_sys_splitext( PyObject * self, PyObject * value )
-{
- char *name = PyString_AsString(value);
- char *dot, *p, path[FILE_MAXDIR + FILE_MAXFILE], ext[FILE_MAXDIR + FILE_MAXFILE];
- int n, len;
-
- if( !name )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument" );
-
- len = strlen( name );
- dot = strrchr( name, '.' );
-
- if( !dot )
- return Py_BuildValue( "ss", name, "" );
-
- p = strrchr( name, DIRSEP );
-
- if( p ) {
- if( p > dot )
- return Py_BuildValue( "ss", name, "" );
- }
-
- n = name + len - dot;
-
- /* loong extensions are supported -- foolish, but Python's os.path.splitext
- * supports them, so ... */
-
- if( n >= FILE_MAXDIR + FILE_MAXFILE || ( len - n ) >= FILE_MAXDIR + FILE_MAXFILE )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError, "path too long" );
-
- BLI_strncpy( ext, dot, n + 1 );
- BLI_strncpy( path, name, dot - name + 1 );
-
- return Py_BuildValue( "ss", path, ext );
-}
-
-static PyObject *M_sys_makename( PyObject * self, PyObject * args,
- PyObject * kw )
-{
- char *path = G.sce, *ext = NULL;
- int strip = 0;
- static char *kwlist[] = { "path", "ext", "strip", NULL };
- char *dot = NULL, *p = NULL, basename[FILE_MAXDIR + FILE_MAXFILE];
- int n, len, lenext = 0;
-
- if( !PyArg_ParseTupleAndKeywords( args, kw, "|ssi", kwlist,
- &path, &ext, &strip ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected one or two strings and an int (or nothing) as arguments" );
-
- len = strlen( path ) + 1; /* + 1 to consider ending '\0' */
- if( ext )
- lenext = strlen( ext ) + 1;
-
- if( ( len + lenext ) > FILE_MAXDIR + FILE_MAXFILE )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "path too long" );
-
- p = strrchr( path, DIRSEP );
-
- if( p && strip ) {
- n = path + len - p;
- BLI_strncpy( basename, p + 1, n ); /* + 1 to skip the sep */
- } else
- BLI_strncpy( basename, path, len );
-
- dot = strrchr( basename, '.' );
-
- /* now the extension: always remove the one in basename */
- if( dot || ext ) {
- if( !ext )
- basename[dot - basename] = '\0';
- else { /* if user gave an ext, append it */
-
- if( dot )
- n = dot - basename;
- else
- n = strlen( basename );
-
- BLI_strncpy( basename + n, ext, lenext );
- }
- }
-
- return PyString_FromString( basename );
-}
-
-static PyObject *M_sys_time( PyObject * self )
-{
- return PyFloat_FromDouble( PIL_check_seconds_timer( ) );
-}
-
-static PyObject *M_sys_sleep( PyObject * self, PyObject * args )
-{
- int millisecs = 10;
-
- if( !PyArg_ParseTuple( args, "|i", &millisecs ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int argument" );
-
- PIL_sleep_ms( millisecs );
-
- return EXPP_incr_ret( Py_None );
-}
-
-static PyObject *M_sys_exists( PyObject * self, PyObject * value )
-{
- char *fname = PyString_AsString(value);
-
- int mode = 0, i = -1;
-
- if( !fname )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string (pathname) argument" );
-
- mode = BLI_exist(fname);
-
- if( mode == 0 )
- i = 0;
- else if( S_ISREG( mode ) )
- i = 1;
- else if( S_ISDIR( mode ) )
- i = 2;
- /* i stays as -1 if path exists but is neither a regular file nor a dir */
-
- return PyInt_FromLong(i);
-}
-
-static PyObject *M_sys_expandpath( PyObject * self, PyObject * value )
-{
- char *path = PyString_AsString(value);
- char expanded[FILE_MAXDIR + FILE_MAXFILE];
-
- if (!path)
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument" );
-
- BLI_strncpy(expanded, path, FILE_MAXDIR + FILE_MAXFILE);
- BLI_convertstringcode(expanded, G.sce, G.scene->r.cfra);
-
- return PyString_FromString(expanded);
-}
diff --git a/source/blender/python/api2_2x/Text.c b/source/blender/python/api2_2x/Text.c
deleted file mode 100644
index 29c404f7266..00000000000
--- a/source/blender/python/api2_2x/Text.c
+++ /dev/null
@@ -1,576 +0,0 @@
-/*
- * $Id: Text.c 11123 2007-06-29 08:59:26Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#include "Text.h" /*This must come first*/
-
-#include "BKE_library.h"
-#include "BKE_sca.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BIF_drawtext.h"
-#include "BKE_text.h"
-#include "BLI_blenlib.h"
-#include "DNA_space_types.h"
-#include "gen_utils.h"
-#include "gen_library.h"
-#include "../BPY_extern.h"
-
-#define EXPP_TEXT_MODE_FOLLOW TXT_FOLLOW
-
-/*****************************************************************************/
-/* Python API function prototypes for the Text module. */
-/*****************************************************************************/
-static PyObject *M_Text_New( PyObject * self, PyObject * args);
-static PyObject *M_Text_Get( PyObject * self, PyObject * args );
-static PyObject *M_Text_Load( PyObject * self, PyObject * value );
-static PyObject *M_Text_unlink( PyObject * self, PyObject * args );
-
-/*****************************************************************************/
-/* The following string definitions are used for documentation strings. */
-/* In Python these will be written to the console when doing a */
-/* Blender.Text.__doc__ */
-/*****************************************************************************/
-static char M_Text_doc[] = "The Blender Text module\n\n";
-
-static char M_Text_New_doc[] = "() - return a new Text object";
-
-static char M_Text_Get_doc[] = "(name) - return the Text with name 'name', \
-returns None if not found.\n If 'name' is not specified, \
-it returns a list of all Texts in the\ncurrent scene.";
-
-static char M_Text_Load_doc[] =
- "(filename) - return text from file filename as a Text Object, \
-returns None if not found.\n";
-
-static char M_Text_unlink_doc[] =
- "(text) - remove Text object 'text' from Blender";
-
-/*****************************************************************************/
-/* Python method structure definition for Blender.Text module: */
-/*****************************************************************************/
-struct PyMethodDef M_Text_methods[] = {
- {"New", M_Text_New, METH_VARARGS, M_Text_New_doc},
- {"Get", M_Text_Get, METH_VARARGS, M_Text_Get_doc},
- {"get", M_Text_Get, METH_VARARGS, M_Text_Get_doc},
- {"Load", M_Text_Load, METH_O, M_Text_Load_doc},
- {"unlink", M_Text_unlink, METH_VARARGS, M_Text_unlink_doc},
- {NULL, NULL, 0, NULL}
-};
-
-
-/*****************************************************************************/
-/* Python BPy_Text methods declarations: */
-/*****************************************************************************/
-static PyObject *Text_getFilename( BPy_Text * self );
-static PyObject *Text_getNLines( BPy_Text * self );
-static PyObject *Text_clear( BPy_Text * self );
-static PyObject *Text_write( BPy_Text * self, PyObject * value );
-static PyObject *Text_set( BPy_Text * self, PyObject * args );
-static PyObject *Text_asLines( BPy_Text * self );
-
-/*****************************************************************************/
-/* Python BPy_Text methods table: */
-/*****************************************************************************/
-static PyMethodDef BPy_Text_methods[] = {
- /* name, method, flags, doc */
- {"getName", ( PyCFunction ) GenericLib_getName, METH_NOARGS,
- "() - Return Text Object name"},
- {"getFilename", ( PyCFunction ) Text_getFilename, METH_VARARGS,
- "() - Return Text Object filename"},
- {"getNLines", ( PyCFunction ) Text_getNLines, METH_VARARGS,
- "() - Return number of lines in text buffer"},
- {"setName", ( PyCFunction ) GenericLib_setName_with_method, METH_VARARGS,
- "(str) - Change Text Object name"},
- {"clear", ( PyCFunction ) Text_clear, METH_NOARGS,
- "() - Clear Text buffer"},
- {"write", ( PyCFunction ) Text_write, METH_O,
- "(line) - Append string 'str' to Text buffer"},
- {"set", ( PyCFunction ) Text_set, METH_VARARGS,
- "(name, val) - Set attribute 'name' to value 'val'"},
- {"asLines", ( PyCFunction ) Text_asLines, METH_NOARGS,
- "() - Return text buffer as a list of lines"},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Python Text_Type callback function prototypes: */
-/*****************************************************************************/
-static int Text_compare( BPy_Text * a, BPy_Text * b );
-static PyObject *Text_repr( BPy_Text * self );
-
-/*****************************************************************************/
-/* Function: M_Text_New */
-/* Python equivalent: Blender.Text.New */
-/*****************************************************************************/
-static PyObject *M_Text_New( PyObject * self, PyObject * args)
-{
- char *name = "Text";
- int follow = 0;
- Text *bl_text; /* blender text object */
- PyObject *py_text; /* python wrapper */
-
- if( !PyArg_ParseTuple( args, "|si", &name, &follow ) )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected string and int arguments (or nothing)" );
-
- bl_text = add_empty_text( name );
-
- if( bl_text ) {
- /* do not set user count because Text is already linked */
-
- /* create python wrapper obj */
- py_text = Text_CreatePyObject( bl_text );
- } else
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't create Text Object in Blender" );
- if( !py_text )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create Text Object wrapper" );
-
- if( follow )
- bl_text->flags |= EXPP_TEXT_MODE_FOLLOW;
-
- return py_text;
-}
-
-/*****************************************************************************/
-/* Function: M_Text_Get */
-/* Python equivalent: Blender.Text.Get */
-/* Description: Receives a string and returns the text object */
-/* whose name matches the string. If no argument is */
-/* passed in, a list of all text names in the current */
-/* scene is returned. */
-/*****************************************************************************/
-static PyObject *M_Text_Get( PyObject * self, PyObject * args )
-{
- char *name = NULL;
- Text *txt_iter;
-
- if( !PyArg_ParseTuple( args, "|s", &name ) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument (or nothing)" ) );
-
- txt_iter = G.main->text.first;
-
- if( name ) { /* (name) - Search text by name */
-
- PyObject *wanted_txt = NULL;
-
- while( ( txt_iter ) && ( wanted_txt == NULL ) ) {
-
- if( strcmp( name, txt_iter->id.name + 2 ) == 0 ) {
- wanted_txt = Text_CreatePyObject( txt_iter );
- }
-
- txt_iter = txt_iter->id.next;
- }
-
- if( wanted_txt == NULL ) { /* Requested text doesn't exist */
- char error_msg[64];
- PyOS_snprintf( error_msg, sizeof( error_msg ),
- "Text \"%s\" not found", name );
- return ( EXPP_ReturnPyObjError
- ( PyExc_NameError, error_msg ) );
- }
-
- return wanted_txt;
- }
-
- else { /* () - return a list of all texts in the scene */
- int index = 0;
- PyObject *txtlist, *pyobj;
-
- txtlist = PyList_New( BLI_countlist( &( G.main->text ) ) );
-
- if( txtlist == NULL )
- return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create PyList" ) );
-
- while( txt_iter ) {
- pyobj = Text_CreatePyObject( txt_iter );
-
- if( !pyobj ) {
- Py_DECREF(txtlist);
- return ( EXPP_ReturnPyObjError
- ( PyExc_MemoryError,
- "couldn't create PyString" ) );
- }
- PyList_SET_ITEM( txtlist, index, pyobj );
-
- txt_iter = txt_iter->id.next;
- index++;
- }
-
- return ( txtlist );
- }
-}
-
-/*****************************************************************************/
-/* Function: M_Text_Load */
-/* Python equivalent: Blender.Text.Load */
-/* Description: Receives a filename and returns the text object */
-/* created from the corresponding file. */
-/*****************************************************************************/
-static PyObject *M_Text_Load( PyObject * self, PyObject * value )
-{
- char *fname = PyString_AsString(value);
- char fpath[FILE_MAXDIR + FILE_MAXFILE];
- Text *txt_ptr = NULL;
- unsigned int maxlen = FILE_MAXDIR + FILE_MAXFILE;
-
- if( !fname )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument" ) );
-
- if (strlen(fname) > (maxlen - 1))
- return EXPP_ReturnPyObjError (PyExc_AttributeError,
- "text filename too long");
- else if (!BLI_exists(fname))
- return EXPP_ReturnPyObjError (PyExc_AttributeError,
- "text file not found");
-
- BLI_strncpy(fpath, fname, maxlen);
-
- txt_ptr = add_text( fpath );
- if( !txt_ptr )
- return EXPP_ReturnPyObjError( PyExc_IOError,
- "couldn't load text" );
-
- return Text_CreatePyObject(txt_ptr);
-}
-
-/*****************************************************************************/
-/* Function: M_Text_unlink */
-/* Python equivalent: Blender.Text.unlink */
-/* Description: Removes the given Text object from Blender */
-/*****************************************************************************/
-static PyObject *M_Text_unlink( PyObject * self, PyObject * args )
-{
- BPy_Text *textobj;
- Text *text;
-
- if( !PyArg_ParseTuple( args, "O!", &Text_Type, &textobj ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a Text object as argument" );
-
- text = ( ( BPy_Text * ) textobj )->text;
-
- if( !text )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "this text was already unlinked!" );
-
- BPY_clear_bad_scriptlinks( text );
- free_text_controllers( text );
- unlink_text( text );
-
- free_libblock( &G.main->text, text );
-
- ( ( BPy_Text * ) textobj )->text = NULL;
-
- Py_RETURN_NONE;
-}
-
-/*****************************************************************************/
-/* Function: Text_Init */
-/*****************************************************************************/
-PyObject *Text_Init( void )
-{
- PyObject *submodule;
-
- if( PyType_Ready( &Text_Type ) < 0 )
- return NULL;
-
- submodule =
- Py_InitModule3( "Blender.Text", M_Text_methods, M_Text_doc );
-
- return ( submodule );
-}
-
-/*****************************************************************************/
-/* Function: Text_CreatePyObject */
-/*****************************************************************************/
-PyObject *Text_CreatePyObject( Text * txt )
-{
- BPy_Text *pytxt;
-
- pytxt = ( BPy_Text * ) PyObject_NEW( BPy_Text, &Text_Type );
-
- if( !pytxt )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create BPy_Text PyObject" );
-
- pytxt->text = txt;
-
- return ( PyObject * ) pytxt;
-}
-
-/*****************************************************************************/
-/* Python BPy_Text methods: */
-/*****************************************************************************/
-static PyObject *Text_getFilename( BPy_Text * self )
-{
- if( self->text->name )
- return PyString_FromString( self->text->name );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Text_getNLines( BPy_Text * self )
-{ /* text->nlines isn't updated in Blender (?) */
- int nlines = 0;
- TextLine *line;
-
- line = self->text->lines.first;
-
- while( line ) { /* so we have to count them ourselves */
- line = line->next;
- nlines++;
- }
-
- self->text->nlines = nlines; /* and update Blender, too (should we?) */
-
- return PyInt_FromLong( nlines );
-}
-
-static PyObject *Text_clear( BPy_Text * self)
-{
- int oldstate;
-
- if( !self->text )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This object isn't linked to a Blender Text Object" );
-
- oldstate = txt_get_undostate( );
- txt_set_undostate( 1 );
- txt_sel_all( self->text );
- txt_cut_sel( self->text );
- txt_set_undostate( oldstate );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Text_set( BPy_Text * self, PyObject * args )
-{
- int ival;
- char *attr;
-
- if( !PyArg_ParseTuple( args, "si", &attr, &ival ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a string and an int as arguments" );
-
- if( strcmp( "follow_cursor", attr ) == 0 ) {
- if( ival )
- self->text->flags |= EXPP_TEXT_MODE_FOLLOW;
- else
- self->text->flags &= EXPP_TEXT_MODE_FOLLOW;
- }
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Text_write( BPy_Text * self, PyObject * value )
-{
- char *str = PyString_AsString(value);
- int oldstate;
-
- if( !self->text )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This object isn't linked to a Blender Text Object" );
-
- if( !str )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument" );
-
- oldstate = txt_get_undostate( );
- txt_insert_buf( self->text, str );
- txt_move_eof( self->text, 0 );
- txt_set_undostate( oldstate );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Text_asLines( BPy_Text * self )
-{
- TextLine *line;
- PyObject *list, *tmpstr;
-
- if( !self->text )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This object isn't linked to a Blender Text Object" );
-
- line = self->text->lines.first;
- list = PyList_New( 0 );
-
- if( !list )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create PyList" );
-
- while( line ) {
- tmpstr = PyString_FromString( line->line );
- PyList_Append( list, tmpstr );
- Py_DECREF(tmpstr);
- line = line->next;
- }
-
- return list;
-}
-
-/*****************************************************************************/
-/* Function: Text_compare */
-/* Description: This is a callback function for the BPy_Text type. It */
-/* compares two Text_Type objects. Only the "==" and "!=" */
-/* comparisons are meaninful. Returns 0 for equality and -1 if */
-/* they don't point to the same Blender Text struct. */
-/* In Python it becomes 1 if they are equal, 0 otherwise. */
-/*****************************************************************************/
-static int Text_compare( BPy_Text * a, BPy_Text * b )
-{
- return ( a->text == b->text ) ? 0 : -1;
-}
-
-/*****************************************************************************/
-/* Function: Text_repr */
-/* Description: This is a callback function for the BPy_Text type. It */
-/* builds a meaninful string to represent text objects. */
-/*****************************************************************************/
-static PyObject *Text_repr( BPy_Text * self )
-{
- if( self->text )
- return PyString_FromFormat( "[Text \"%s\"]",
- self->text->id.name + 2 );
- else
- return PyString_FromString( "[Text <deleted>]" );
-}
-
-/*****************************************************************************/
-/* Python attributes get/set functions: */
-/*****************************************************************************/
-static PyObject *Text_getMode(BPy_Text * self)
-{
- return PyInt_FromLong( self->text->flags );
-}
-
-/*****************************************************************************/
-/* Python attributes get/set structure: */
-/*****************************************************************************/
-static PyGetSetDef BPy_Text_getseters[] = {
- GENERIC_LIB_GETSETATTR,
- {"filename", (getter)Text_getFilename, (setter)NULL,
- "text filename", NULL},
- {"mode", (getter)Text_getMode, (setter)NULL,
- "text mode flag", NULL},
- {"nlines", (getter)Text_getNLines, (setter)NULL,
- "number of lines", NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-/*****************************************************************************/
-/* Python Text_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject Text_Type = {
- PyObject_HEAD_INIT( NULL )
- 0, /* ob_size */
- "Blender Text", /* tp_name */
- sizeof( BPy_Text ), /* tp_basicsize */
- 0, /* tp_itemsize */
- /* methods */
- NULL, /* tp_dealloc */
- NULL, /* tp_print */
- NULL, /* tp_getattr */
- NULL, /* tp_setattr */
- ( cmpfunc ) Text_compare, /* tp_compare */
- ( reprfunc ) Text_repr, /* tp_repr */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- NULL, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
- 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, /* 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, /* 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 ***/
- BPy_Text_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_Text_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
diff --git a/source/blender/python/api2_2x/Text3d.c b/source/blender/python/api2_2x/Text3d.c
deleted file mode 100644
index 6194b232401..00000000000
--- a/source/blender/python/api2_2x/Text3d.c
+++ /dev/null
@@ -1,1206 +0,0 @@
-/*
- * $Id: Text3d.c 11099 2007-06-28 13:46:42Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Joilnen Leite
- * Johnny Matthews
- * Campbell BArton
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include "Text3d.h" /*This must come first*/
-
-#include "DNA_object_types.h"
-#include "MEM_guardedalloc.h"
-#include "BKE_curve.h"
-#include "BKE_library.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BIF_editfont.h" /* do_textedit() */
-#include "Curve.h"
-#include "constant.h"
-#include "Font.h"
-#include "gen_utils.h"
-#include "gen_library.h"
-
-
-enum t3d_consts {
- EXPP_T3D_ATTR_FRAME_WIDTH = 0,
- EXPP_T3D_ATTR_FRAME_HEIGHT,
- EXPP_T3D_ATTR_FRAME_X,
- EXPP_T3D_ATTR_FRAME_Y
-};
-
-
-/*no prototypes declared in header files - external linkage outside of python*/
-extern VFont *get_builtin_font(void);
-extern void freedisplist(struct ListBase *lb);
-extern VFont *give_vfontpointer(int);
-extern VFont *exist_vfont(char *str);
-extern VFont *load_vfont(char *name);
-extern int BLI_exist(char *name);
-
-/*****************************************************************************/
-/* Python API function prototypes for the Text3D module. */
-/*****************************************************************************/
-static PyObject *M_Text3d_New( PyObject * self, PyObject * args );
-static PyObject *M_Text3d_Get( PyObject * self, PyObject * args );
-PyObject *M_Text3d_LoadFont (PyObject * self, PyObject * args );
-
-/*****************************************************************************
- * Python callback function prototypes for the Text3D module.
- *****************************************************************************/
-static PyObject *return_ModuleConstant( char *constant_name);
-static PyObject *generate_ModuleIntConstant(char *name, int value);
-
-/*****************************************************************************/
-/* Python method structure definition for Blender.Text3d module: */
-/*****************************************************************************/
-struct PyMethodDef M_Text3d_methods[] = {
- {"New", ( PyCFunction ) M_Text3d_New, METH_VARARGS, NULL},
- {"Get", ( PyCFunction ) M_Text3d_Get, METH_VARARGS, NULL},
- {"LoadFont", ( PyCFunction ) M_Text3d_LoadFont, METH_O, NULL},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Python Text3d_Type callback function prototypes: */
-/*****************************************************************************/
-/* int Text3dPrint (BPy_Text3d *msh, FILE *fp, int flags); */
-
-
-static PyObject *Text3d_repr( BPy_Text3d * self );
-static int Text3d_compare( BPy_Text3d * a, BPy_Text3d * b );
-
-/*****************************************************************************/
-/* Python BPy_Text3d methods declarations: */
-/*****************************************************************************/
-/*PyObject *Text3d_getType(BPy_Text3d *self);*/
-static PyObject *Text3d_getName( BPy_Text3d * self );
-static PyObject *Text3d_setName( BPy_Text3d * self, PyObject * args );
-static PyObject *Text3d_setText( BPy_Text3d * self, PyObject * value );
-static PyObject *Text3d_getText( BPy_Text3d * self );
-static PyObject *Text3d_getDrawMode( BPy_Text3d * self );
-static PyObject *Text3d_setDrawMode( BPy_Text3d * self, PyObject * args );
-static PyObject *Text3d_getUVorco( BPy_Text3d * self );
-static PyObject *Text3d_setUVorco( BPy_Text3d * self, PyObject * args );
-static PyObject *Text3d_getBevelAmount( BPy_Text3d * self );
-static PyObject *Text3d_setBevelAmount( BPy_Text3d * self, PyObject * args );
-static PyObject *Text3d_getDefaultResolution( BPy_Text3d * self );
-static PyObject *Text3d_setDefaultResolution( BPy_Text3d * self, PyObject * args );
-static PyObject *Text3d_getWidth( BPy_Text3d * self );
-static PyObject *Text3d_setWidth( BPy_Text3d * self, PyObject * args );
-static PyObject *Text3d_getExtrudeDepth( BPy_Text3d * self );
-static PyObject *Text3d_setExtrudeDepth( BPy_Text3d * self, PyObject * args );
-static PyObject *Text3d_getExtrudeBevelDepth( BPy_Text3d * self );
-static PyObject *Text3d_setExtrudeBevelDepth( BPy_Text3d * self, PyObject * args );
-static PyObject *Text3d_getShear( BPy_Text3d * self );
-static PyObject *Text3d_setShear( BPy_Text3d * self, PyObject * args );
-static PyObject *Text3d_getSize( BPy_Text3d * self );
-static PyObject *Text3d_setSize( BPy_Text3d * self, PyObject * args );
-static PyObject *Text3d_getLineSeparation( BPy_Text3d * self );
-static PyObject *Text3d_setLineSeparation( BPy_Text3d * self, PyObject * args );
-static PyObject *Text3d_getSpacing( BPy_Text3d * self );
-static PyObject *Text3d_setSpacing( BPy_Text3d * self, PyObject * args );
-static PyObject *Text3d_getXoffset( BPy_Text3d * self );
-static PyObject *Text3d_setXoffset( BPy_Text3d * self, PyObject * args );
-static PyObject *Text3d_getYoffset( BPy_Text3d * self );
-static PyObject *Text3d_setYoffset( BPy_Text3d * self, PyObject * args );
-static PyObject *Text3d_getAlignment( BPy_Text3d * self );
-static PyObject *Text3d_setAlignment( BPy_Text3d * self, PyObject * args );
-static PyObject *Text3d_getFont( BPy_Text3d * self );
-static PyObject *Text3d_setFont( BPy_Text3d * self, PyObject * args );
-static PyObject *Text3d_addFrame( BPy_Text3d * self );
-static PyObject *Text3d_removeFrame( BPy_Text3d * self, PyObject * args );
-
-/*****************************************************************************/
-/* Python BPy_Text3d methods table: */
-/*****************************************************************************/
-char M_Text3D_doc[] = "The Blender Text3D module\n\n\
- This module provides control over Text Curve objects in Blender.\n";
-
-static PyMethodDef BPy_Text3d_methods[] = {
- {"getName", ( PyCFunction ) Text3d_getName,
- METH_NOARGS, "() - Return Text3d Data name"},
- {"setName", ( PyCFunction ) Text3d_setName,
- METH_VARARGS, "() - Sets Text3d Data name"},
- {"setText", ( PyCFunction ) Text3d_setText,
- METH_O, "() - Sets Text3d Data"},
- {"getText", ( PyCFunction ) Text3d_getText,
- METH_NOARGS, "() - Gets Text3d Data"},
- {"getDrawMode", ( PyCFunction ) Text3d_getDrawMode,
- METH_NOARGS, "() - Return the font drawing mode"},
- {"setDrawMode", ( PyCFunction ) Text3d_setDrawMode,
- METH_VARARGS, "(int) - Set the font drawing mode"},
- {"getUVorco", ( PyCFunction ) Text3d_getUVorco,
- METH_NOARGS, "() - Return wether UV coords are used for Texture mapping"},
- {"setUVorco", ( PyCFunction ) Text3d_setUVorco,
- METH_VARARGS, "() - Set the font to use UV coords for Texture mapping"},
- {"getBevelAmount", ( PyCFunction ) Text3d_getBevelAmount,
- METH_NOARGS, "() - Return bevel resolution"},
- {"setBevelAmount", ( PyCFunction ) Text3d_setBevelAmount,
- METH_VARARGS, "() - Sets bevel resolution"},
- {"getDefaultResolution", ( PyCFunction ) Text3d_getDefaultResolution,
- METH_NOARGS, "() - Return Default text resolution"},
- {"setDefaultResolution", ( PyCFunction ) Text3d_setDefaultResolution,
- METH_VARARGS, "() - Sets Default text Resolution"},
- {"getWidth", ( PyCFunction ) Text3d_getWidth,
- METH_NOARGS, "() - Return curve width"},
- {"setWidth", ( PyCFunction ) Text3d_setWidth,
- METH_VARARGS, "(int) - Sets curve width"},
- {"getExtrudeDepth", ( PyCFunction ) Text3d_getExtrudeDepth,
- METH_NOARGS, "() - Gets Text3d ExtrudeDepth"},
- {"setExtrudeDepth", ( PyCFunction ) Text3d_setExtrudeDepth,
- METH_VARARGS, "() - Sets Text3d ExtrudeDepth"},
- {"getExtrudeBevelDepth", ( PyCFunction ) Text3d_getExtrudeBevelDepth,
- METH_NOARGS, "() - Gets Text3d ExtrudeBevelDepth"},
- {"setExtrudeBevelDepth", ( PyCFunction ) Text3d_setExtrudeBevelDepth,
- METH_VARARGS, "() - Sets Text3d ExtrudeBevelDepth"},
- {"getShear", ( PyCFunction ) Text3d_getShear,
- METH_NOARGS, "() - Gets Text3d Shear Data"},
- {"setShear", ( PyCFunction ) Text3d_setShear,
- METH_VARARGS, "() - Sets Text3d Shear Data"},
- {"getSize", ( PyCFunction ) Text3d_getSize,
- METH_NOARGS, "() - Gets Text3d Size Data"},
- {"setSize", ( PyCFunction ) Text3d_setSize,
- METH_VARARGS, "() - Sets Text3d Size Data"},
- {"getLineSeparation", ( PyCFunction ) Text3d_getLineSeparation,
- METH_NOARGS, "() - Gets Text3d LineSeparation Data"},
- {"setLineSeparation", ( PyCFunction ) Text3d_setLineSeparation,
- METH_VARARGS, "() - Sets Text3d LineSeparation Data"},
- {"getSpacing", ( PyCFunction ) Text3d_getSpacing,
- METH_NOARGS, "() - Gets Text3d letter spacing"},
- {"setSpacing", ( PyCFunction ) Text3d_setSpacing,
- METH_VARARGS, "() - Sets Text3d letter spacing"},
- {"getXoffset", ( PyCFunction ) Text3d_getXoffset,
- METH_NOARGS, "() - Gets Text3d Xoffset Data"},
- {"setXoffset", ( PyCFunction ) Text3d_setXoffset,
- METH_VARARGS, "() - Sets Text3d Xoffset Data"},
- {"getYoffset", ( PyCFunction ) Text3d_getYoffset,
- METH_NOARGS, "() - Gets Text3d Yoffset Data"},
- {"setYoffset", ( PyCFunction ) Text3d_setYoffset,
- METH_VARARGS, "() - Sets Text3d Yoffset Data"},
- {"getAlignment", ( PyCFunction ) Text3d_getAlignment,
- METH_NOARGS, "() - Gets Text3d Alignment Data"},
- {"setAlignment", ( PyCFunction ) Text3d_setAlignment,
- METH_VARARGS, "() - Sets Text3d Alignment Data"},
- {"getFont", ( PyCFunction ) Text3d_getFont,
- METH_NOARGS, "() - Gets font list for Text3d"},
- {"setFont", ( PyCFunction ) Text3d_setFont,
- METH_VARARGS, "() - Sets font for Text3d"},
- {"addFrame", ( PyCFunction ) Text3d_addFrame,
- METH_NOARGS, "() - adds a new text frame"},
- {"removeFrame", ( PyCFunction ) Text3d_removeFrame,
- METH_VARARGS, "(index) - remove this frame"},
- {NULL, NULL, 0, NULL}
-};
-
-
-static PyObject *Text3d_getTotalFrames( BPy_Text3d * self )
-{
- return PyInt_FromLong( (long)(self->curve->totbox ) );
-}
-
-static PyObject *Text3d_getActiveFrame( BPy_Text3d * self )
-{
- return PyInt_FromLong( (long)(self->curve->actbox-1) );
-}
-
-static int Text3d_setActiveFrame( BPy_Text3d * self, PyObject * value )
-{
- struct Curve *curve= self->curve;
- PyObject* frame_int = PyNumber_Int( value );
- int index;
-
-
- if( !frame_int )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected integer argument" );
-
- index = ( int )PyInt_AS_LONG( frame_int );
- index ++;
- if (index < 1 || index > curve->totbox)
- return EXPP_ReturnIntError( PyExc_IndexError,
- "index out of range" );
-
- curve->actbox = index;
-
- return 0;
-}
-
-
-static PyObject *getFloatAttr( BPy_Text3d *self, void *type )
-{
- float param;
- struct Curve *curve= self->curve;
-
- switch( (int)type ) {
- case EXPP_T3D_ATTR_FRAME_WIDTH:
- param = curve->tb[curve->actbox-1].w;
- break;
- case EXPP_T3D_ATTR_FRAME_HEIGHT:
- param = curve->tb[curve->actbox-1].h;
- break;
- case EXPP_T3D_ATTR_FRAME_X:
- param = curve->tb[curve->actbox-1].x;
- break;
- case EXPP_T3D_ATTR_FRAME_Y:
- param = curve->tb[curve->actbox-1].y;
- break;
-
- default:
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "undefined type in getFloatAttr" );
- }
- return PyFloat_FromDouble( param );
-}
-
-static int setFloatAttrClamp( BPy_Text3d *self, PyObject *value, void *type )
-{
- float *param;
- struct Curve *curve= self->curve;
- float min, max;
-
- switch( (int)type ) {
- case EXPP_T3D_ATTR_FRAME_WIDTH:
- min = 0.0;
- max = 50.0;
- param = &(curve->tb[curve->actbox-1].w);
- break;
- case EXPP_T3D_ATTR_FRAME_HEIGHT:
- min = 0.0;
- max = 50.0;
- param = &(curve->tb[curve->actbox-1].h);
- break;
- case EXPP_T3D_ATTR_FRAME_X:
- min = 0.0;
- max = 50.0;
- param = &(curve->tb[curve->actbox-1].x);
- break;
- case EXPP_T3D_ATTR_FRAME_Y:
- min = 0.0;
- max = 50.0;
- param = &(curve->tb[curve->actbox-1].y);
- break;
-
- default:
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "undefined type in setFloatAttrClamp" );
- }
-
- return EXPP_setFloatClamped( value, param, min, max );
-}
-
-/*****************************************************************************/
-/* Python attributes get/set structure: */
-/*****************************************************************************/
-static PyGetSetDef BPy_Text3d_getseters[] = {
- GENERIC_LIB_GETSETATTR, /* didnt have any attributes, at least lets have the standard ID attrs */
- {"activeFrame",
- (getter)Text3d_getActiveFrame, (setter)Text3d_setActiveFrame,
- "the index of the active text frame",
- NULL},
- {"totalFrames",
- (getter)Text3d_getTotalFrames, (setter)NULL,
- "the total number of text frames",
- NULL},
-
- {"frameWidth",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "the width of the active text frame",
- (void *)EXPP_T3D_ATTR_FRAME_WIDTH},
- {"frameHeight",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "the height of the active text frame",
- (void *)EXPP_T3D_ATTR_FRAME_HEIGHT},
- {"frameX",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "the X position of the active text frame",
- (void *)EXPP_T3D_ATTR_FRAME_X},
- {"frameY",
- (getter)getFloatAttr, (setter)setFloatAttrClamp,
- "the Y position of the active text frame",
- (void *)EXPP_T3D_ATTR_FRAME_Y},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-/*****************************************************************************/
-/* Python Text3d_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject Text3d_Type = {
- PyObject_HEAD_INIT( NULL )
- 0, /* ob_size */
- "Text3d", /* tp_name */
- sizeof( BPy_Text3d ), /* tp_basicsize */
- 0, /* tp_itemsize */
- /* methods */
- NULL, /* tp_dealloc */
- NULL, /* tp_print */
- NULL, /* tp_getattr */
- NULL, /* tp_setattr */
- ( cmpfunc ) Text3d_compare, /* tp_compare */
- ( reprfunc ) Text3d_repr, /* tp_repr */
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- NULL, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
- 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, /* 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, /* 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 ***/
- BPy_Text3d_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_Text3d_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-
-/*
- * Text3d_update( )
- * method to update display list for a Curve.
- */
-static PyObject *Text3d_update( BPy_Text3d * self )
-{
- freedisplist( &self->curve->disp );
- Py_RETURN_NONE;
-}
-
-/*****************************************************************************/
-/* Function: M_Text3d_New */
-/* Python equivalent: Blender.Text3d.New */
-/*****************************************************************************/
-
-PyObject *M_Text3d_New( PyObject * self, PyObject * args )
-{
- char *name = NULL;
- BPy_Text3d *pytext3d; /* for Curve Data object wrapper in Python */
- Text3d *bltext3d = 0; /* for actual Curve Data we create in Blender */
-
- if( !PyArg_ParseTuple( args, "|s", &name ) )
- return ( EXPP_ReturnPyObjError
- ( PyExc_AttributeError,
- "expected string argument or no argument" ) );
-
- bltext3d = add_curve( "Text", OB_FONT ); /* first create the Curve Data in Blender */
- bltext3d->vfont= get_builtin_font();
- bltext3d->vfont->id.us++;
- bltext3d->str= MEM_mallocN(12, "str");
- strcpy(bltext3d->str, "Text");
- bltext3d->pos= 4;
-
- bltext3d->strinfo= MEM_callocN(12*sizeof(CharInfo), "strinfo");
- bltext3d->totbox= bltext3d->actbox= 1;
- bltext3d->tb= MEM_callocN(MAXTEXTBOX*sizeof(TextBox), "textbox");
- bltext3d->tb[0].w = bltext3d->tb[0].h = 0.0;
-
- if( bltext3d == NULL ) /* bail out if add_curve() failed */
- return ( EXPP_ReturnPyObjError
- ( PyExc_RuntimeError,
- "couldn't create Curve Data in Blender" ) );
-
- /* return user count to zero because add_curve() inc'd it */
- bltext3d->id.us = 0;
- /* create python wrapper obj */
- pytext3d = ( BPy_Text3d * ) PyObject_NEW( BPy_Text3d, &Text3d_Type );
-
- if( pytext3d == NULL )
- return ( EXPP_ReturnPyObjError
- ( PyExc_MemoryError,
- "couldn't create Curve Data object" ) );
-
- pytext3d->curve = bltext3d; /* link Python curve wrapper to Blender Curve */
- if( name )
- rename_id( &bltext3d->id, name );
-
- Text3d_update ( pytext3d );
- return ( PyObject * ) pytext3d;
-}
-
-PyObject *M_Text3d_Get( PyObject * self, PyObject * args )
-{
- char *name = NULL;
- Text3d *curv_iter;
- BPy_Text3d *wanted_curv;
-
- if( !PyArg_ParseTuple( args, "|s", &name ) ) /* expects nothing or a string */
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected string argument" ) );
- if( name ) { /*a name has been given */
- /* Use the name to search for the curve requested */
- wanted_curv = NULL;
- curv_iter = G.main->curve.first;
-
- while( ( curv_iter ) && ( wanted_curv == NULL ) ) {
-
- if( strcmp( name, curv_iter->id.name + 2 ) == 0 ) {
- wanted_curv = ( BPy_Text3d * )
- PyObject_NEW( BPy_Text3d, &Text3d_Type );
- if( wanted_curv )
- wanted_curv->curve = curv_iter;
- }
-
- curv_iter = curv_iter->id.next;
- }
-
- if( wanted_curv == NULL ) { /* Requested curve doesn't exist */
- char error_msg[64];
- PyOS_snprintf( error_msg, sizeof( error_msg ),
- "Curve \"%s\" not found", name );
- return ( EXPP_ReturnPyObjError
- ( PyExc_NameError, error_msg ) );
- }
-
- return ( PyObject * ) wanted_curv;
- } /* end of if(name) */
- else {
- /* no name has been given; return a list of all curves by name. */
- PyObject *curvlist;
-
- curv_iter = G.main->curve.first;
- curvlist = PyList_New( 0 );
-
- if( curvlist == NULL )
- return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create PyList" ) );
-
- while( curv_iter && curv_iter->vfont ) {
- BPy_Text3d *found_text3d =
- ( BPy_Text3d * ) PyObject_NEW( BPy_Text3d,
- &Text3d_Type );
- found_text3d->curve = curv_iter;
- PyList_Append( curvlist, ( PyObject * ) found_text3d );
- Py_DECREF(found_text3d);
- curv_iter = curv_iter->id.next;
- }
- return ( curvlist );
- }
-}
-
-static PyObject *generate_ModuleIntConstant(char *name, int value)
-{
- PyObject *constant = PyConstant_New();
-
- PyConstant_Insert((BPy_constant*)constant,
- "value", PyInt_FromLong(value));
- PyConstant_Insert((BPy_constant*)constant,
- "name", PyString_FromString(name));
-
- Py_INCREF(constant);
- return constant;
-}
-
-PyObject *Text3d_Init( void )
-{
- //module
- PyObject *submodule, *dict;
-
- //add module...
- if( PyType_Ready( &Text3d_Type ) < 0 )
- return NULL;
-
- submodule = Py_InitModule3( "Blender.Text3d", M_Text3d_methods,
- M_Text3D_doc);
-
- //add constants to module...
- PyModule_AddObject( submodule, "LEFT",
- generate_ModuleIntConstant("Text3d.LEFT", CU_LEFT));
- PyModule_AddObject( submodule, "MIDDLE",
- generate_ModuleIntConstant("Text3d.MIDDLE", CU_MIDDLE));
- PyModule_AddObject( submodule, "RIGHT",
- generate_ModuleIntConstant("Text3d.RIGHT", CU_RIGHT));
- PyModule_AddObject( submodule, "FLUSH",
- generate_ModuleIntConstant("Text3d.FLUSH", CU_FLUSH));
- PyModule_AddObject( submodule, "JUSTIFY",
- generate_ModuleIntConstant("Text3d.JUSTIFY", CU_JUSTIFY));
- PyModule_AddObject( submodule, "DRAW3D",
- generate_ModuleIntConstant("Text3d.DRAW3D", CU_3D));
- PyModule_AddObject( submodule, "DRAWFRONT",
- generate_ModuleIntConstant("Text3d.DRAWFRONT", CU_FRONT));
- PyModule_AddObject( submodule, "DRAWBACK",
- generate_ModuleIntConstant("Text3d.DRAWBACK", CU_BACK));
- PyModule_AddObject( submodule, "UVORCO",
- generate_ModuleIntConstant("Text3d.UVORCO", CU_UV_ORCO));
- dict = PyModule_GetDict( submodule );
- PyDict_SetItemString( dict, "Font", Font_Init( ) );
- return ( submodule );
-}
-
-/****************************************************************************
- * Function: Text3d_repr
- * Description: Callback function for the BPy_Text3d type to It
- * build a meaninful string to represent Text3d objects.
- *
- ***************************************************************************/
-
-static PyObject *Text3d_repr( BPy_Text3d * self )
-{
- /* skip over CU in idname. CUTEXT */
- return PyString_FromFormat( "[Text3d \"%s\"]",
- self->curve->id.name + 2 );
-}
-
-/****************************************************************************
- * Function: Text3d_compare
- * Description: Callback function for the BPy_Text3d type to Compare 2 types
- *
- ***************************************************************************/
-
-/* mat_a==mat_b or mat_a!=mat_b*/
-static int Text3d_compare( BPy_Text3d * a, BPy_Text3d * b )
-{
- return ( a->curve == b->curve) ? 0 : -1;
-}
-
-struct Text3d *Text3d_FromPyObject( PyObject * py_obj )
-{
- BPy_Text3d *blen_obj;
-
- blen_obj = ( BPy_Text3d * ) py_obj;
- return ((struct Text3d*) blen_obj->curve );
-}
-
-static PyObject *return_ModuleConstant( char *constant_name){
-
- PyObject *module = NULL, *dict = NULL, *constant = NULL;;
-
- module = PyImport_AddModule("Blender.Text3d");
- if(!module){ //null = error returning module
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "error encountered with returning module constant..." ) );
- }
- dict = PyModule_GetDict(module); //never fails
-
- constant = PyDict_GetItemString(dict, constant_name);
- if(!constant){ //null = key not found
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "error encountered with returning module constant..." ) );
- }
-
- return EXPP_incr_ret( constant );
-}
-
-static PyObject *Text3d_getName( BPy_Text3d * self )
-{
- return Curve_getName( (BPy_Curve*)self );
-}
-
-static PyObject *Text3d_setName( BPy_Text3d * self, PyObject * args )
-{
- return Curve_setName( (BPy_Curve*)self,args );
-}
-
-static PyObject *Text3d_setText( BPy_Text3d * self, PyObject * value )
-{
- char *text = PyString_AsString(value);
-
- if( !text )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected string argument" );
-
- /*
- * If the text is currently being edited, then we have to put the
- * text into the edit buffer.
- */
-
- if( G.obedit && G.obedit->data == self->curve ) {
- short qual = G.qual;
- G.qual = 0; /* save key qualifier, then clear it */
- self->curve->pos = self->curve->len = 0;
- while ( *text )
- do_textedit( 0, 0, *text++ );
- G.qual = qual;
- } else {
- short len = (short)strlen(text);
- MEM_freeN( self->curve->str );
- self->curve->str = MEM_callocN( len+sizeof(wchar_t), "str" );
- strcpy( self->curve->str, text );
- self->curve->pos = len;
- self->curve->len = len;
-
- if( self->curve->strinfo )
- MEM_freeN( self->curve->strinfo );
- /* don't know why this is +4, just duplicating load_editText() */
- self->curve->strinfo = MEM_callocN( (len+4) *sizeof(CharInfo),
- "strinfo");
- }
- Py_RETURN_NONE;
-}
-
-static PyObject *Text3d_getText( BPy_Text3d * self )
-{
- if( self->curve->str )
- return PyString_FromString( self->curve->str );
-
- Py_RETURN_NONE;
-}
-
-static PyObject* Text3d_getDrawMode(BPy_Text3d* self)
-{
- PyObject *tuple = NULL;
- int size = 0, pos = 0;
-
- //get the tuple size
- if(self->curve->flag & CU_3D)
- size++;
- if (self->curve->flag & CU_FRONT)
- size++;
- if (self->curve->flag & CU_BACK)
- size++;
-
- //generate tuple
- tuple = PyTuple_New(size);
-
- //load tuple
- if(self->curve->flag & CU_3D){
- PyTuple_SET_ITEM( tuple, pos, return_ModuleConstant("DRAW3D"));
- pos++;
- }
- if (self->curve->flag & CU_FRONT){
- PyTuple_SET_ITEM( tuple, pos, return_ModuleConstant("DRAWFRONT"));
- pos++;
- }
- if (self->curve->flag & CU_BACK){
- PyTuple_SET_ITEM( tuple, pos, return_ModuleConstant("DRAWBACK"));
- pos++;
- }
-
- return tuple;
-}
-
-static PyObject* Text3d_setDrawMode(BPy_Text3d* self,PyObject* args)
-{
- PyObject *listObject = NULL;
- int size, i;
- short temp;
-
- size = PySequence_Length(args);
- if ( size == 1 ) {
- listObject = PySequence_GetItem(args, 0);
- if ( PySequence_Check(listObject) ) {
- size = PySequence_Length(listObject);
- }else{ //not a sequence but maybe a single constant
- Py_INCREF(args);
- listObject = args;
- }
- } else { //a list of objects (non-sequence)
- Py_INCREF(args);
- listObject = args;
- }
- if ( size > 3 || size < 1 ) {
- //bad number of arguments
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "too many parameters - expects 1 - 3 constants" ) );
- }
- //clear bits
- temp = self->curve->flag; //in case of failure
- if(self->curve->flag & CU_3D)
- self->curve->flag &= ~CU_3D;
- if(self->curve->flag & CU_FRONT)
- self->curve->flag &= ~CU_FRONT;
- if(self->curve->flag & CU_BACK)
- self->curve->flag &= ~CU_BACK;
-
- //parse and set bits
- for (i = 0; i < size; i++) {
- PyObject *v;
- int value;
-
- v = PySequence_GetItem(listObject, i);
- if (v == NULL) { //unable to return item - null = failure
- Py_DECREF(listObject);
- self->curve->flag = temp;
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "unable to parse list" ) );
- }
- if( !BPy_Constant_Check(v)){
- Py_DECREF(listObject);
- Py_DECREF(v);
- self->curve->flag = temp;
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "bad argument types - expects module constants" ) );
- }
- value = PyInt_AS_LONG(PyDict_GetItemString(
- ((BPy_constant*)v)->dict, "value"));
- self->curve->flag |= (short)value;
- Py_DECREF(v);
- }
- Py_DECREF(listObject);
- Py_RETURN_NONE;
-}
-
-static PyObject* Text3d_getUVorco(BPy_Text3d* self)
-{
- if(self->curve->flag & CU_UV_ORCO)
- return EXPP_incr_ret_True();
- else
- return EXPP_incr_ret_False();
-}
-
-static PyObject* Text3d_setUVorco(BPy_Text3d* self,PyObject* args)
-{
- int flag;
-
- if( !PyArg_ParseTuple( args, "i", &flag ) )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected TRUE or FALSE (1 or 0)" );
-
- if( flag < 0 || flag > 1 )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected TRUE or FALSE (1 or 0)" );
-
- if( flag )
- self->curve->flag |= CU_UV_ORCO;
- else
- self->curve->flag &= ~CU_UV_ORCO;
-
- Py_RETURN_NONE;
-}
-
-static PyObject* Text3d_getBevelAmount(BPy_Text3d* self)
-{
- return Curve_getBevresol((BPy_Curve*)self);
-}
-
-static PyObject* Text3d_setBevelAmount(BPy_Text3d* self,PyObject* args)
-{
- return Curve_setBevresol((BPy_Curve*)self,args);
-}
-
-static PyObject *Text3d_getDefaultResolution( BPy_Text3d * self )
-{
- return Curve_getResolu( (BPy_Curve*)self );
-}
-
-static PyObject *Text3d_setDefaultResolution( BPy_Text3d * self, PyObject * args )
-{
- return Curve_setResolu( (BPy_Curve*)self,args );
-}
-
-static PyObject *Text3d_getWidth( BPy_Text3d * self )
-{
- return Curve_getWidth( (BPy_Curve*)self );
-}
-
-static PyObject *Text3d_setWidth( BPy_Text3d * self, PyObject * args )
-{
- return Curve_setWidth( (BPy_Curve*)self,args );
-}
-
-static PyObject *Text3d_getExtrudeDepth( BPy_Text3d * self )
-{
- return Curve_getExt1( (BPy_Curve*)self );
-}
-
-static PyObject *Text3d_setExtrudeDepth( BPy_Text3d * self, PyObject * args )
-{
- return Curve_setExt1( (BPy_Curve*)self,args );
-}
-
-static PyObject *Text3d_getExtrudeBevelDepth( BPy_Text3d * self )
-{
- return Curve_getExt2( (BPy_Curve*)self );
-}
-
-static PyObject *Text3d_setExtrudeBevelDepth( BPy_Text3d * self, PyObject * args )
-{
- return Curve_setExt2( (BPy_Curve*)self,args );
-}
-
-static PyObject *Text3d_getShear( BPy_Text3d * self )
-{
- PyObject *attr = PyFloat_FromDouble( (double) self->curve->shear );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Curve.shear attribute" ) );
-}
-
-static PyObject *Text3d_setShear( BPy_Text3d * self, PyObject * args )
-{
- float value;
-
- if( !PyArg_ParseTuple( args, "f", &value ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected float argument" ) );
-
- if(value > 1.0f || value < -1.0f)
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "acceptable values are between 1.0 and -1.0" ) );
- self->curve->shear = value;
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Text3d_getSize( BPy_Text3d * self )
-{
- PyObject *attr = PyFloat_FromDouble( (double) self->curve->fsize );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Curve.fsize attribute" ) );
-}
-
-static PyObject *Text3d_setSize( BPy_Text3d * self, PyObject * args )
-{
- float value;
-
- if( !PyArg_ParseTuple( args, "f", &value ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected float argument" ) );
-
- if(value > 10.0f || value < 0.1f)
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "acceptable values are between 10.0 and 0.1" ) );
- self->curve->fsize = value;
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Text3d_getLineSeparation( BPy_Text3d * self )
-{
- PyObject *attr = PyFloat_FromDouble( (double) self->curve->linedist );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Curve.linedist attribute" ) );
-}
-
-static PyObject *Text3d_setLineSeparation( BPy_Text3d * self, PyObject * args )
-{
- float value;
-
- if( !PyArg_ParseTuple( args, "f", &value ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected float argument" ) );
-
- if(value > 10.0f || value < 0.0f)
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "acceptable values are between 10.0 and 0.0" ) );
- self->curve->linedist = value;
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Text3d_getSpacing( BPy_Text3d * self )
-{
- PyObject *attr = PyFloat_FromDouble( (double) self->curve->spacing );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Curve.spacing attribute" ) );
-}
-
-static PyObject *Text3d_setSpacing( BPy_Text3d * self, PyObject * args )
-{
- float value;
-
- if( !PyArg_ParseTuple( args, "f", &value ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected float argument" ) );
-
- if(value > 10.0f || value < 0.0f)
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "acceptable values are between 10.0 and 0.0" ) );
- self->curve->spacing = value;
-
- Py_RETURN_NONE;
-}
-static PyObject *Text3d_getXoffset( BPy_Text3d * self )
-{
- PyObject *attr = PyFloat_FromDouble( (double) self->curve->xof );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Curve.xof attribute" ) );
-}
-
-static PyObject *Text3d_setXoffset( BPy_Text3d * self, PyObject * args )
-{
- float value;
-
- if( !PyArg_ParseTuple( args, "f", &value ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected float argument" ) );
-
- if(value > 50.0f || value < -50.0f)
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "acceptable values are between 50.0 and -50.0" ) );
- self->curve->xof = value;
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Text3d_getYoffset( BPy_Text3d * self )
-{
- PyObject *attr = PyFloat_FromDouble( (double) self->curve->yof );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Curve.yof attribute" ) );
-}
-
-static PyObject *Text3d_setYoffset( BPy_Text3d * self, PyObject * args )
-{
- float value;
-
- if( !PyArg_ParseTuple( args, "f", &value ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected float argument" ) );
-
- if(value > 50.0f || value < -50.0f)
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "acceptable values are between 50.0 and -50.0" ) );
- self->curve->yof = value;
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Text3d_getAlignment( BPy_Text3d * self )
-{
- if(self->curve->spacemode == CU_LEFT){
- return return_ModuleConstant("LEFT");
- }else if (self->curve->spacemode == CU_MIDDLE){
- return return_ModuleConstant("MIDDLE");
- }else if (self->curve->spacemode == CU_RIGHT){
- return return_ModuleConstant("RIGHT");
- }else if (self->curve->spacemode == CU_FLUSH){
- return return_ModuleConstant("FLUSH");
- }else if (self->curve->spacemode == CU_JUSTIFY){
- return return_ModuleConstant("JUSTIFY");
- }
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Curve.spacemode attribute" ) );
-}
-
-static PyObject *Text3d_setAlignment( BPy_Text3d * self, PyObject * args )
-{
- BPy_constant *constant;
- int value;
-
- if( !PyArg_ParseTuple( args, "O!", &constant_Type, &constant ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected module constant" ) );
-
- value = PyInt_AS_LONG(PyDict_GetItemString(constant->dict, "value"));
- self->curve->spacemode = (short)value;
-
- Py_RETURN_NONE;
-}
-
-
-/*****************************************************************************
- * Function: Text3d_CreatePyObject
- * Description: This function will create a new BPy_Text3d from an existing
- * Blender structure.
- *****************************************************************************/
-
-PyObject *Text3d_CreatePyObject( Text3d * text3d )
-{
- BPy_Text3d *pytext3d;
-
- pytext3d = ( BPy_Text3d * ) PyObject_NEW( BPy_Text3d, &Text3d_Type );
-
- if( !pytext3d )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create BPy_Text3d object" );
-
- pytext3d->curve = text3d;
-
- return ( PyObject * ) pytext3d;
-}
-
-static PyObject *Text3d_getFont( BPy_Text3d * self )
-{
- if (self->curve)
- return Font_CreatePyObject (self->curve->vfont);
- else
- Py_RETURN_NONE;
-}
-
-static PyObject *Text3d_setFont( BPy_Text3d * self, PyObject * args )
-{
- BPy_Font *pyobj= NULL;
- VFont *vf; //, *vfont;
- if( !PyArg_ParseTuple( args, "|O!",&Font_Type, &pyobj) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a string" );
- if( !pyobj ) {
- // pyobj= M_Text3d_LoadFont (self, Py_BuildValue("(s)", "<builtin>"));
- self->curve->vfont= get_builtin_font ();
- Py_RETURN_NONE;
- }
- vf= exist_vfont(pyobj->font->name);
- if (vf) {
- id_us_plus((ID *)vf);
- self->curve->vfont->id.us--;
- self->curve->vfont= vf;
- }
- else {
- vf= load_vfont (pyobj->font->name);
- if (vf) {
- id_us_plus((ID *)vf);
- self->curve->vfont->id.us--;
- self->curve->vfont= vf;
- }
- }
- Py_RETURN_NONE;
-}
-
-static PyObject *Text3d_addFrame( BPy_Text3d * self )
-{
- Curve *cu = self->curve;
-
- if (cu->totbox >= 256)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "limited to 256 frames" );
-
- cu->totbox++;
- cu->tb[cu->totbox-1]= cu->tb[cu->totbox-2];
- Py_RETURN_NONE;
-}
-
-static PyObject *Text3d_removeFrame( BPy_Text3d * self, PyObject * args )
-{
- Curve *cu = self->curve;
- int index, i;
-
- if (cu->totbox == 1)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "cannot remove the last frame" );
-
- index = cu->totbox-1;
-
- if( !PyArg_ParseTuple( args, "|i", &index ) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "expected an int" );
-
- if (index < 0 || index >= cu->totbox )
- return EXPP_ReturnPyObjError( PyExc_IndexError,
- "index out of range" );
-
- for (i = index; i < cu->totbox; i++) cu->tb[i]= cu->tb[i+1];
- cu->totbox--;
- cu->actbox--;
- Py_RETURN_NONE;
-}
-
-
-PyObject *M_Text3d_LoadFont( PyObject * self, PyObject * value )
-{
- char *fontfile= PyString_AsString(value);
- FILE *file= NULL;
- VFont *vf= NULL;
-
- if( !fontfile )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a string" );
- vf= exist_vfont(fontfile);
- if( vf )
- return Font_CreatePyObject( vf );
- /* No use for that -- lukep
- else
- vf= NULL;
- */
- file= fopen( fontfile, "r");
-
- if( file || !strcmp (fontfile, "<builtin>") ) {
- load_vfont( fontfile );
- if(file) fclose( file );
- vf = exist_vfont( fontfile );
- if(vf)
- return Font_CreatePyObject( vf );
- Py_RETURN_NONE;
- }
-
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "string isn't filename or fontpath" );
-}
-
diff --git a/source/blender/python/api2_2x/Text3d.h b/source/blender/python/api2_2x/Text3d.h
deleted file mode 100644
index ddab385ca66..00000000000
--- a/source/blender/python/api2_2x/Text3d.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * $Id: Text3d.h 10269 2007-03-15 01:09:14Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Joilnen Leite
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_TEXT3D_H
-#define EXPP_TEXT3D_H
-
-#include <Python.h>
-#include "DNA_curve_types.h"
-
-extern PyTypeObject Text3d_Type;
-
-#define BPy_Text3d_Check(v) ((v)->ob_type==&Text3d_Type)
-typedef Curve Text3d;
-
-/*prototypes*/
-PyObject *Text3d_Init( void );
-struct Text3d *Text3d_FromPyObject( PyObject * py_obj );
-PyObject *Text3d_CreatePyObject( Text3d* text3d );
-
-/* Python BPy_Text3d structure definition */
-typedef struct {
- PyObject_HEAD /* required py macro */
- Text3d * curve;
-} BPy_Text3d;
-
-#endif /* EXPP_TEXT3D_H */
-
diff --git a/source/blender/python/api2_2x/Texture.c b/source/blender/python/api2_2x/Texture.c
deleted file mode 100644
index 66ed88df8d0..00000000000
--- a/source/blender/python/api2_2x/Texture.c
+++ /dev/null
@@ -1,2516 +0,0 @@
-/*
- * $Id: Texture.c 12535 2007-11-09 10:29:19Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Alex Mole, Nathan Letwory, Joilnen B. Leite, Ken Hughes
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-#include "Texture.h" /*This must come first*/
-
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_idprop.h"
-#include "BKE_library.h"
-#include "BKE_texture.h"
-#include "BKE_utildefines.h"
-
-#include "BLI_blenlib.h"
-
-#include "DNA_object_types.h"
-#include "DNA_material_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_texture_types.h"
-
-#include "MTex.h"
-#include "Image.h"
-#include "Ipo.h"
-#include "IDProp.h"
-#include "constant.h"
-#include "blendef.h"
-#include "gen_utils.h"
-#include "gen_library.h"
-
-#include "vector.h" /* for Texture_evaluate(vec) */
-#include "Material.h" /* for EXPP_Colorband_fromPyList and EXPP_PyList_fromColorband */
-#include "RE_shader_ext.h"
-
-/*****************************************************************************/
-/* Blender.Texture constants */
-/*****************************************************************************/
-#define EXPP_TEX_TYPE_NONE 0
-
-#define EXPP_TEX_TYPE_MIN EXPP_TEX_TYPE_NONE
-#define EXPP_TEX_TYPE_MAX TEX_DISTNOISE
-
-#define EXPP_TEX_ANIMFRAME_MIN 0
-#define EXPP_TEX_ANIMFRAME_MAX ((int)MAXFRAMEF)
-#define EXPP_TEX_ANIMLEN_MIN 0
-#define EXPP_TEX_ANIMLEN_MAX ((int)(MAXFRAMEF)/2)
-#define EXPP_TEX_ANIMMONSTART_MIN 0
-#define EXPP_TEX_ANIMMONSTART_MAX ((int)MAXFRAMEF)
-#define EXPP_TEX_ANIMMONDUR_MIN 0
-#define EXPP_TEX_ANIMMONDUR_MAX 250
-#define EXPP_TEX_ANIMOFFSET_MIN -((int)MAXFRAMEF)
-#define EXPP_TEX_ANIMOFFSET_MAX ((int)MAXFRAMEF)
-#define EXPP_TEX_ANIMSTART_MIN 1
-#define EXPP_TEX_ANIMSTART_MAX ((int)MAXFRAMEF)
-#define EXPP_TEX_FIEIMA_MIN 1
-#define EXPP_TEX_FIEIMA_MAX 200
-#define EXPP_TEX_NOISEDEPTH_MIN 0
-#define EXPP_TEX_NOISEDEPTH_MAX 6
-/* max depth is different for magic type textures */
-#define EXPP_TEX_NOISEDEPTH_MAX_MAGIC 10
-#define EXPP_TEX_REPEAT_MIN 1
-#define EXPP_TEX_REPEAT_MAX 512
-
-#define EXPP_TEX_FILTERSIZE_MIN 0.1f
-#define EXPP_TEX_FILTERSIZE_MAX 25.0f
-#define EXPP_TEX_NOISESIZE_MIN 0.0001f
-#define EXPP_TEX_NOISESIZE_MAX 2.0f
-#define EXPP_TEX_BRIGHTNESS_MIN 0.0f
-#define EXPP_TEX_BRIGHTNESS_MAX 2.0f
-#define EXPP_TEX_CONTRAST_MIN 0.01f
-#define EXPP_TEX_CONTRAST_MAX 5.0f
-#define EXPP_TEX_CROP_MIN -10.0f
-#define EXPP_TEX_CROP_MAX 10.0f
-#define EXPP_TEX_RGBCOL_MIN 0.0f
-#define EXPP_TEX_RGBCOL_MAX 2.0f
-#define EXPP_TEX_TURBULENCE_MIN 0.0f
-#define EXPP_TEX_TURBULENCE_MAX 200.0f
-#define EXPP_TEX_MH_G_MIN 0.0001f
-#define EXPP_TEX_MH_G_MAX 2.0f
-#define EXPP_TEX_LACUNARITY_MIN 0.0f
-#define EXPP_TEX_LACUNARITY_MAX 6.0f
-#define EXPP_TEX_OCTS_MIN 0.0f
-#define EXPP_TEX_OCTS_MAX 8.0f
-#define EXPP_TEX_ISCALE_MIN 0.0f
-#define EXPP_TEX_ISCALE_MAX 10.0f
-#define EXPP_TEX_EXP_MIN 0.010f
-#define EXPP_TEX_EXP_MAX 10.0f
-#define EXPP_TEX_WEIGHT1_MIN -2.0f
-#define EXPP_TEX_WEIGHT1_MAX 2.0f
-#define EXPP_TEX_WEIGHT2_MIN -2.0f
-#define EXPP_TEX_WEIGHT2_MAX 2.0f
-#define EXPP_TEX_WEIGHT3_MIN -2.0f
-#define EXPP_TEX_WEIGHT3_MAX 2.0f
-#define EXPP_TEX_WEIGHT4_MIN -2.0f
-#define EXPP_TEX_WEIGHT4_MAX 2.0f
-#define EXPP_TEX_DISTAMNT_MIN 0.0f
-#define EXPP_TEX_DISTAMNT_MAX 10.0f
-
-/* i can't find these defined anywhere- they're just taken from looking at */
-/* the button creation code in source/blender/src/buttons_shading.c */
-/* cloud stype */
-#define EXPP_TEX_STYPE_CLD_DEFAULT 0
-#define EXPP_TEX_STYPE_CLD_COLOR 1
-/* wood stype */
-#define EXPP_TEX_STYPE_WOD_BANDS 0
-#define EXPP_TEX_STYPE_WOD_RINGS 1
-#define EXPP_TEX_STYPE_WOD_BANDNOISE 2
-#define EXPP_TEX_STYPE_WOD_RINGNOISE 3
-/* magic stype */
-#define EXPP_TEX_STYPE_MAG_DEFAULT 0
-/* marble stype */
-#define EXPP_TEX_STYPE_MBL_SOFT 0
-#define EXPP_TEX_STYPE_MBL_SHARP 1
-#define EXPP_TEX_STYPE_MBL_SHARPER 2
-/* blend stype */
-#define EXPP_TEX_STYPE_BLN_LIN 0
-#define EXPP_TEX_STYPE_BLN_QUAD 1
-#define EXPP_TEX_STYPE_BLN_EASE 2
-#define EXPP_TEX_STYPE_BLN_DIAG 3
-#define EXPP_TEX_STYPE_BLN_SPHERE 4
-#define EXPP_TEX_STYPE_BLN_HALO 5
-/* stucci stype */
-#define EXPP_TEX_STYPE_STC_PLASTIC 0
-#define EXPP_TEX_STYPE_STC_WALLIN 1
-#define EXPP_TEX_STYPE_STC_WALLOUT 2
-/* noise stype */
-#define EXPP_TEX_STYPE_NSE_DEFAULT 0
-/* image stype */
-#define EXPP_TEX_STYPE_IMG_DEFAULT 0
-/* plug-in stype */
-#define EXPP_TEX_STYPE_PLG_DEFAULT 0
-/* envmap stype */
-#define EXPP_TEX_STYPE_ENV_STATIC 0
-#define EXPP_TEX_STYPE_ENV_ANIM 1
-#define EXPP_TEX_STYPE_ENV_LOAD 2
-/* musgrave stype */
-#define EXPP_TEX_STYPE_MUS_MFRACTAL 0
-#define EXPP_TEX_STYPE_MUS_RIDGEDMF 1
-#define EXPP_TEX_STYPE_MUS_HYBRIDMF 2
-#define EXPP_TEX_STYPE_MUS_FBM 3
-#define EXPP_TEX_STYPE_MUS_HTERRAIN 4
-/* voronoi stype */
-#define EXPP_TEX_STYPE_VN_INT 0
-#define EXPP_TEX_STYPE_VN_COL1 1
-#define EXPP_TEX_STYPE_VN_COL2 2
-#define EXPP_TEX_STYPE_VN_COL3 3
-
-#define EXPP_TEX_EXTEND_MIN TEX_EXTEND
-#define EXPP_TEX_EXTEND_MAX TEX_CHECKER
-
-#define EXPP_TEX_NOISE_SINE 0
-#define EXPP_TEX_NOISE_SAW 1
-#define EXPP_TEX_NOISE_TRI 2
-#define EXPP_TEX_NOISEBASIS2 0xffff
-
-/****************************************************************************/
-/* Texture String->Int maps */
-/****************************************************************************/
-
-static const EXPP_map_pair tex_type_map[] = {
- {"None", EXPP_TEX_TYPE_NONE},
- {"Clouds", TEX_CLOUDS},
- {"Wood", TEX_WOOD},
- {"Marble", TEX_MARBLE},
- {"Magic", TEX_MAGIC},
- {"Blend", TEX_BLEND},
- {"Stucci", TEX_STUCCI},
- {"Noise", TEX_NOISE},
- {"Image", TEX_IMAGE},
- {"Plugin", TEX_PLUGIN},
- {"EnvMap", TEX_ENVMAP},
- {"Musgrave", TEX_MUSGRAVE},
- {"Voronoi", TEX_VORONOI},
- {"DistortedNoise", TEX_DISTNOISE},
- {NULL, 0}
-};
-
-static const EXPP_map_pair tex_flag_map[] = {
-/* NOTE "CheckerOdd" and "CheckerEven" are new */
- {"ColorBand", TEX_COLORBAND },
- {"FlipBlend", TEX_FLIPBLEND},
- {"NegAlpha", TEX_NEGALPHA},
- {"CheckerOdd",TEX_CHECKER_ODD},
- {"CheckerEven",TEX_CHECKER_EVEN},
- {"PreviewAlpha",TEX_PRV_ALPHA},
- {"RepeatXMirror",TEX_REPEAT_XMIR},
- {"RepeatYMirror",TEX_REPEAT_YMIR},
- {NULL, 0}
-};
-
-/* NOTE: flags moved to image... */
-static const EXPP_map_pair tex_imageflag_map[] = {
- {"InterPol", TEX_INTERPOL},
- {"UseAlpha", TEX_USEALPHA},
- {"MipMap", TEX_MIPMAP},
- {"Rot90", TEX_IMAROT},
- {"CalcAlpha", TEX_CALCALPHA},
- {"NormalMap", TEX_NORMALMAP},
- {NULL, 0}
-};
-
-static const EXPP_map_pair tex_extend_map[] = {
- {"Extend", TEX_EXTEND},
- {"Clip", TEX_CLIP},
- {"ClipCube", TEX_CLIPCUBE},
- {"Repeat", TEX_REPEAT},
-/* NOTE "Checker" is new */
- {"Checker", TEX_CHECKER},
- {NULL, 0}
-};
-
-/* array of maps for stype */
-static const EXPP_map_pair tex_stype_default_map[] = {
- {"Default", 0},
- {NULL, 0}
-};
-static const EXPP_map_pair tex_stype_clouds_map[] = {
- {"Default", 0},
- {"CloudDefault", EXPP_TEX_STYPE_CLD_DEFAULT},
- {"CloudColor", EXPP_TEX_STYPE_CLD_COLOR},
- {NULL, 0}
-};
-static const EXPP_map_pair tex_stype_wood_map[] = {
- {"Default", 0},
- {"WoodBands", EXPP_TEX_STYPE_WOD_BANDS},
- {"WoodRings", EXPP_TEX_STYPE_WOD_RINGS},
- {"WoodBandNoise", EXPP_TEX_STYPE_WOD_BANDNOISE},
- {"WoodRingNoise", EXPP_TEX_STYPE_WOD_RINGNOISE},
- {NULL, 0}
-};
-static const EXPP_map_pair tex_stype_marble_map[] = {
- {"Default", 0},
- {"MarbleSoft", EXPP_TEX_STYPE_MBL_SOFT},
- {"MarbleSharp", EXPP_TEX_STYPE_MBL_SHARP},
- {"MarbleSharper", EXPP_TEX_STYPE_MBL_SHARPER},
- {NULL, 0}
-};
-static const EXPP_map_pair tex_stype_blend_map[] = {
- {"Default", 0},
- {"BlendLin", EXPP_TEX_STYPE_BLN_LIN},
- {"BlendQuad", EXPP_TEX_STYPE_BLN_QUAD},
- {"BlendEase", EXPP_TEX_STYPE_BLN_EASE},
- {"BlendDiag", EXPP_TEX_STYPE_BLN_DIAG},
- {"BlendSphere", EXPP_TEX_STYPE_BLN_SPHERE},
- {"BlendHalo", EXPP_TEX_STYPE_BLN_HALO},
- {NULL, 0}
-};
-static const EXPP_map_pair tex_stype_stucci_map[] = {
- {"Default", 0},
- {"StucciPlastic", EXPP_TEX_STYPE_STC_PLASTIC},
- {"StucciWallIn", EXPP_TEX_STYPE_STC_WALLIN},
- {"StucciWallOut", EXPP_TEX_STYPE_STC_WALLOUT},
- {NULL, 0}
-};
-static const EXPP_map_pair tex_stype_envmap_map[] = {
- {"Default", 0},
- {"EnvmapStatic", EXPP_TEX_STYPE_ENV_STATIC},
- {"EnvmapAnim", EXPP_TEX_STYPE_ENV_ANIM},
- {"EnvmapLoad", EXPP_TEX_STYPE_ENV_LOAD},
- {NULL, 0}
-};
-
-static const EXPP_map_pair tex_stype_musg_map[] = {
- {"Default", 0},
- {"MultiFractal", EXPP_TEX_STYPE_MUS_MFRACTAL},
- {"HeteroTerrain", EXPP_TEX_STYPE_MUS_HTERRAIN},
- {"RidgedMultiFractal", EXPP_TEX_STYPE_MUS_RIDGEDMF},
- {"HybridMultiFractal", EXPP_TEX_STYPE_MUS_HYBRIDMF},
- {"fBM", EXPP_TEX_STYPE_MUS_FBM},
- {NULL, 0}
-};
-
-static const EXPP_map_pair tex_stype_distortednoise_map[] = {
- {"Default", 0},
- {"BlenderOriginal", TEX_BLENDER},
- {"OriginalPerlin", TEX_STDPERLIN},
- {"ImprovedPerlin", TEX_NEWPERLIN},
- {"VoronoiF1", TEX_VORONOI_F1},
- {"VoronoiF2", TEX_VORONOI_F2},
- {"VoronoiF3", TEX_VORONOI_F3},
- {"VoronoiF4", TEX_VORONOI_F4},
- {"VoronoiF2-F1", TEX_VORONOI_F2F1},
- {"VoronoiCrackle", TEX_VORONOI_CRACKLE},
- {"CellNoise", TEX_CELLNOISE},
- {NULL, 0}
-};
-
-static const EXPP_map_pair tex_stype_voronoi_map[] = {
- {"Default", 0},
- {"Int", EXPP_TEX_STYPE_VN_INT},
- {"Col1", EXPP_TEX_STYPE_VN_COL1},
- {"Col2", EXPP_TEX_STYPE_VN_COL2},
- {"Col3", EXPP_TEX_STYPE_VN_COL3},
- {NULL, 0}
-};
-
-static const EXPP_map_pair tex_distance_voronoi_map[] = {
- {"Default", 0},
- {"Distance", TEX_DISTANCE},
- {"DistanceSquared", TEX_DISTANCE_SQUARED},
- {"Manhattan", TEX_MANHATTAN},
- {"Chebychev", TEX_CHEBYCHEV},
- {"MinkovskyHalf", TEX_MINKOVSKY_HALF},
- {"MinkovskyFour", TEX_MINKOVSKY_FOUR},
- {"Minkovsky", TEX_MINKOVSKY},
- {NULL, 0}
-};
-
-static const EXPP_map_pair *tex_stype_map[] = {
- tex_stype_default_map, /* none */
- tex_stype_clouds_map,
- tex_stype_wood_map,
- tex_stype_marble_map,
- tex_stype_default_map, /* magic */
- tex_stype_blend_map,
- tex_stype_stucci_map,
- tex_stype_default_map, /* noise */
- tex_stype_default_map, /* image */
- tex_stype_default_map, /* plugin */
- tex_stype_envmap_map,
- tex_stype_musg_map, /* musgrave */
- tex_stype_voronoi_map, /* voronoi */
- tex_stype_distortednoise_map, /* distorted noise */
- tex_distance_voronoi_map
-};
-
-/*****************************************************************************/
-/* Python API function prototypes for the Texture module. */
-/*****************************************************************************/
-static PyObject *M_Texture_New( PyObject * self, PyObject * args,
- PyObject * keywords );
-static PyObject *M_Texture_Get( PyObject * self, PyObject * args );
-
-/*****************************************************************************/
-/* The following string definitions are used for documentation strings. */
-/* In Python these will be written to the console when doing a */
-/* Blender.Texture.__doc__ */
-/*****************************************************************************/
-static char M_Texture_doc[] = "The Blender Texture module\n\
-\n\
-This module provides access to **Texture** objects in Blender\n";
-
-static char M_Texture_New_doc[] = "Texture.New (name = 'Tex'):\n\
- Return a new Texture object with the given type and name.";
-
-static char M_Texture_Get_doc[] = "Texture.Get (name = None):\n\
- Return the texture with the given 'name', None if not found, or\n\
- Return a list with all texture objects in the current scene,\n\
- if no argument was given.";
-
-/*****************************************************************************/
-/* Python method structure definition for Blender.Texture module: */
-/*****************************************************************************/
-struct PyMethodDef M_Texture_methods[] = {
- {"New", ( PyCFunction ) M_Texture_New, METH_VARARGS | METH_KEYWORDS,
- M_Texture_New_doc},
- {"Get", M_Texture_Get, METH_VARARGS, M_Texture_Get_doc},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Python BPy_Texture methods declarations: */
-/*****************************************************************************/
-#define GETFUNC(name) static PyObject *Texture_##name(BPy_Texture *self)
-#define OLDSETFUNC(name) static PyObject *Texture_old##name(BPy_Texture *self, \
- PyObject *args)
-#define SETFUNC(name) static int Texture_##name(BPy_Texture *self, \
- PyObject *value)
-#if 0
-GETFUNC( getExtend );
-GETFUNC( getImage );
-GETFUNC( getType );
-GETFUNC( getSType );
-GETFUNC( clearIpo );
-GETFUNC( getAnimMontage );
-GETFUNC( getAnimLength );
-SETFUNC( setAnimLength );
-SETFUNC( setAnimMontage );
-#endif
-
-GETFUNC( oldgetSType );
-GETFUNC( oldgetType );
-
-GETFUNC( clearIpo );
-GETFUNC( getAnimFrames );
-GETFUNC( getAnimOffset );
-GETFUNC( getAnimStart );
-GETFUNC( getBrightness );
-GETFUNC( getContrast );
-GETFUNC( getCrop );
-GETFUNC( getDistAmnt );
-GETFUNC( getDistMetric );
-GETFUNC( getExp );
-GETFUNC( getExtend );
-GETFUNC( getIntExtend );
-GETFUNC( getFieldsPerImage );
-GETFUNC( getFilterSize );
-GETFUNC( getFlags );
-GETFUNC( getHFracDim );
-GETFUNC( getImage );
-GETFUNC( getIpo );
-GETFUNC( getIScale );
-GETFUNC( getLacunarity );
-GETFUNC( getNoiseBasis );
-GETFUNC( getNoiseDepth );
-GETFUNC( getNoiseSize );
-GETFUNC( getNoiseType );
-GETFUNC( getOcts );
-GETFUNC( getRepeat );
-GETFUNC( getRGBCol );
-GETFUNC( getSType );
-GETFUNC( getTurbulence );
-GETFUNC( getType );
-GETFUNC( getWeight1 );
-GETFUNC( getWeight2 );
-GETFUNC( getWeight3 );
-GETFUNC( getWeight4 );
-#if 0
-/* not defined */
-GETFUNC( getUsers );
-#endif
-
-OLDSETFUNC( setDistMetric );
-OLDSETFUNC( setDistNoise ); /* special case used for ".noisebasis = ... */
-OLDSETFUNC( setExtend );
-OLDSETFUNC( setFlags );
-OLDSETFUNC( setImage );
-OLDSETFUNC( setImageFlags );
-OLDSETFUNC( setIpo );
-OLDSETFUNC( setNoiseBasis );
-OLDSETFUNC( setSType );
-OLDSETFUNC( setType );
-
-SETFUNC( setAnimFrames );
-SETFUNC( setAnimOffset );
-SETFUNC( setAnimStart );
-SETFUNC( setBrightness );
-SETFUNC( setContrast );
-SETFUNC( setCrop );
-SETFUNC( setDistAmnt );
-SETFUNC( setDistMetric );
-SETFUNC( setExp );
-SETFUNC( setIntExtend );
-SETFUNC( setFieldsPerImage );
-SETFUNC( setFilterSize );
-SETFUNC( setFlags );
-SETFUNC( setHFracDim );
-SETFUNC( setImage );
-SETFUNC( setIpo );
-SETFUNC( setIScale );
-SETFUNC( setLacunarity );
-SETFUNC( setNoiseBasis );
-SETFUNC( setNoiseDepth );
-SETFUNC( setNoiseSize );
-SETFUNC( setNoiseType );
-SETFUNC( setOcts );
-SETFUNC( setRepeat );
-SETFUNC( setRGBCol );
-SETFUNC( setSType );
-SETFUNC( setTurbulence );
-SETFUNC( setType );
-SETFUNC( setWeight1 );
-SETFUNC( setWeight2 );
-SETFUNC( setWeight3 );
-SETFUNC( setWeight4 );
-
-static PyObject *Texture_getImageFlags( BPy_Texture *self, void *type );
-static PyObject *Texture_getIUserFlags( BPy_Texture *self, void *type );
-static PyObject *Texture_getIUserCyclic( BPy_Texture *self );
-static PyObject *Texture_getNoiseBasis2( BPy_Texture *self, void *type );
-static int Texture_setImageFlags( BPy_Texture *self, PyObject *args,
- void *type );
-static int Texture_setIUserFlags( BPy_Texture *self, PyObject *args,
- void *type );
-static int Texture_setIUserCyclic( BPy_Texture *self, PyObject *args );
-static int Texture_setNoiseBasis2( BPy_Texture *self, PyObject *args,
- void *type );
-
-static PyObject *Texture_getColorband( BPy_Texture * self);
-int Texture_setColorband( BPy_Texture * self, PyObject * value);
-static PyObject *Texture_evaluate( BPy_Texture *self, PyObject *value );
-static PyObject *Texture_copy( BPy_Texture *self );
-
-/*****************************************************************************/
-/* Python BPy_Texture methods table: */
-/*****************************************************************************/
-static PyMethodDef BPy_Texture_methods[] = {
- /* name, method, flags, doc */
- {"getExtend", ( PyCFunction ) Texture_getExtend, METH_NOARGS,
- "() - Return Texture extend mode"},
- {"getImage", ( PyCFunction ) Texture_getImage, METH_NOARGS,
- "() - Return Texture Image"},
- {"getName", ( PyCFunction ) GenericLib_getName, METH_NOARGS,
- "() - Return Texture name"},
- {"getSType", ( PyCFunction ) Texture_oldgetSType, METH_NOARGS,
- "() - Return Texture stype as string"},
- {"getType", ( PyCFunction ) Texture_oldgetType, METH_NOARGS,
- "() - Return Texture type as string"},
- {"getIpo", ( PyCFunction ) Texture_getIpo, METH_NOARGS,
- "() - Return Texture Ipo"},
- {"setIpo", ( PyCFunction ) Texture_oldsetIpo, METH_VARARGS,
- "(Blender Ipo) - Set Texture Ipo"},
- {"clearIpo", ( PyCFunction ) Texture_clearIpo, METH_NOARGS,
- "() - Unlink Ipo from this Texture."},
- {"setExtend", ( PyCFunction ) Texture_oldsetExtend, METH_VARARGS,
- "(s) - Set Texture extend mode"},
- {"setFlags", ( PyCFunction ) Texture_oldsetFlags, METH_VARARGS,
- "(f1,f2,f3,f4,f5) - Set Texture flags"},
- {"setImage", ( PyCFunction ) Texture_oldsetImage, METH_VARARGS,
- "(Blender Image) - Set Texture Image"},
- {"setImageFlags", ( PyCFunction ) Texture_oldsetImageFlags, METH_VARARGS,
- "(s,s,s,s,...) - Set Texture image flags"},
- {"setName", ( PyCFunction ) GenericLib_setName_with_method, METH_VARARGS,
- "(s) - Set Texture name"},
- {"setSType", ( PyCFunction ) Texture_oldsetSType, METH_VARARGS,
- "(s) - Set Texture stype"},
- {"setType", ( PyCFunction ) Texture_oldsetType, METH_VARARGS,
- "(s) - Set Texture type"},
- {"setNoiseBasis", ( PyCFunction ) Texture_oldsetNoiseBasis, METH_VARARGS,
- "(s) - Set Noise basis"},
- {"setDistNoise", ( PyCFunction ) Texture_oldsetDistNoise, METH_VARARGS,
- "(s) - Set Dist Noise"},
- {"setDistMetric", ( PyCFunction ) Texture_oldsetDistMetric, METH_VARARGS,
- "(s) - Set Dist Metric"},
- {"evaluate", ( PyCFunction ) Texture_evaluate, METH_O,
- "(vector) - evaluate the texture at this position"},
- {"__copy__", ( PyCFunction ) Texture_copy, METH_NOARGS,
- "() - return a copy of the the texture"},
- {"copy", ( PyCFunction ) Texture_copy, METH_NOARGS,
- "() - return a copy of the the texture"},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Python Texture_Type attributes get/set structure: */
-/*****************************************************************************/
-static PyGetSetDef BPy_Texture_getseters[] = {
- GENERIC_LIB_GETSETATTR,
- {"animFrames",
- (getter)Texture_getAnimFrames, (setter)Texture_setAnimFrames,
- "Number of frames of a movie to use",
- NULL},
-#if 0
- {"animLength",
- (getter)Texture_getAnimLength, (setter)Texture_setAnimLength,
- "Number of frames of a movie to use (0 for all)",
- NULL},
- {"animMontage",
- (getter)Texture_getAnimMontage, (setter)Texture_setAnimMontage,
- "Montage mode, start frames and durations",
- NULL},
-#endif
- {"animOffset",
- (getter)Texture_getAnimOffset, (setter)Texture_setAnimOffset,
- "Offsets the number of the first movie frame to use",
- NULL},
- {"animStart",
- (getter)Texture_getAnimStart, (setter)Texture_setAnimStart,
- "Starting frame of the movie to use",
- NULL},
- {"brightness",
- (getter)Texture_getBrightness, (setter)Texture_setBrightness,
- "Changes the brightness of a texture's color",
- NULL},
- {"contrast",
- (getter)Texture_getContrast, (setter)Texture_setContrast,
- "Changes the contrast of a texture's color",
- NULL},
- {"crop",
- (getter)Texture_getCrop, (setter)Texture_setCrop,
- "Sets the cropping extents (for image textures)",
- NULL},
- {"distAmnt",
- (getter)Texture_getDistAmnt, (setter)Texture_setDistAmnt,
- "Amount of distortion (for distorted noise textures)",
- NULL},
- {"distMetric",
- (getter)Texture_getDistMetric, (setter)Texture_setDistMetric,
- "The distance metric (for Voronoi textures)",
- NULL},
- {"exp",
- (getter)Texture_getExp, (setter)Texture_setExp,
- "Minkovsky exponent (for Minkovsky Voronoi textures)",
- NULL},
- {"extend",
- (getter)Texture_getIntExtend, (setter)Texture_setIntExtend,
- "Texture's 'Extend' mode (for image textures)",
- NULL},
- {"fieldsPerImage",
- (getter)Texture_getFieldsPerImage, (setter)Texture_setFieldsPerImage,
- "Number of fields per rendered frame",
- NULL},
- {"filterSize",
- (getter)Texture_getFilterSize, (setter)Texture_setFilterSize,
- "The filter size (for image and envmap textures)",
- NULL},
- {"flags",
- (getter)Texture_getFlags, (setter)Texture_setFlags,
- "Texture's 'Flag' bits",
- NULL},
- {"hFracDim",
- (getter)Texture_getHFracDim, (setter)Texture_setHFracDim,
- "Highest fractional dimension (for Musgrave textures)",
- NULL},
- {"imageFlags",
- (getter)Texture_getImageFlags, (setter)Texture_setImageFlags,
- "Texture's 'ImageFlags' bits",
- NULL},
- {"image",
- (getter)Texture_getImage, (setter)Texture_setImage,
- "Texture's image object",
- NULL},
- {"ipo",
- (getter)Texture_getIpo, (setter)Texture_setIpo,
- "Texture Ipo data",
- NULL},
- {"iScale",
- (getter)Texture_getIScale, (setter)Texture_setIScale,
- "Intensity output scale (for Musgrave and Voronoi textures)",
- NULL},
- {"lacunarity",
- (getter)Texture_getLacunarity, (setter)Texture_setLacunarity,
- "Gap between succesive frequencies (for Musgrave textures)",
- NULL},
- {"noiseBasis",
- (getter)Texture_getNoiseBasis, (setter)Texture_setNoiseBasis,
- "Noise basis type (wood, stucci, marble, clouds, Musgrave, distorted noise)",
- NULL},
- {"noiseBasis2",
- (getter)Texture_getNoiseBasis2, (setter)Texture_setNoiseBasis2,
- "Additional noise basis type (wood, marble, distorted noise)",
- (void *)EXPP_TEX_NOISEBASIS2},
- {"noiseDepth",
- (getter)Texture_getNoiseDepth, (setter)Texture_setNoiseDepth,
- "Noise depth (magic, marble, clouds)",
- NULL},
- {"noiseSize",
- (getter)Texture_getNoiseSize, (setter)Texture_setNoiseSize,
- "Noise size (wood, stucci, marble, clouds, Musgrave, distorted noise, Voronoi)",
- NULL},
-/* NOTE for API rewrite: should use dict constants instead of strings */
- {"noiseType",
- (getter)Texture_getNoiseType, (setter)Texture_setNoiseType,
- "Noise type (for wood, stucci, marble, clouds textures)",
- NULL},
- {"octs",
- (getter)Texture_getOcts, (setter)Texture_setOcts,
- "Number of frequencies (for Musgrave textures)",
- NULL},
- {"repeat",
- (getter)Texture_getRepeat, (setter)Texture_setRepeat,
- "Repetition multiplier (for image textures)",
- NULL},
- {"rgbCol",
- (getter)Texture_getRGBCol, (setter)Texture_setRGBCol,
- "RGB color tuple",
- NULL},
- {"stype",
- (getter)Texture_getSType, (setter)Texture_setSType,
- "Texture's 'SType' mode",
- NULL},
- {"turbulence",
- (getter)Texture_getTurbulence, (setter)Texture_setTurbulence,
- "Turbulence (for magic, wood, stucci, marble textures)",
- NULL},
- {"type",
- (getter)Texture_getType, (setter)Texture_setType,
- "Texture's 'Type' mode",
- NULL},
- {"weight1",
- (getter)Texture_getWeight1, (setter)Texture_setWeight1,
- "Weight 1 (for Voronoi textures)",
- NULL},
- {"weight2",
- (getter)Texture_getWeight2, (setter)Texture_setWeight2,
- "Weight 2 (for Voronoi textures)",
- NULL},
- {"weight3",
- (getter)Texture_getWeight3, (setter)Texture_setWeight3,
- "Weight 3 (for Voronoi textures)",
- NULL},
- {"weight4",
- (getter)Texture_getWeight4, (setter)Texture_setWeight4,
- "Weight 4 (for Voronoi textures)",
- NULL},
- {"sine",
- (getter)Texture_getNoiseBasis2, (setter)Texture_setNoiseBasis2,
- "Produce bands using sine wave (marble, wood textures)",
- (void *)EXPP_TEX_NOISE_SINE},
- {"saw",
- (getter)Texture_getNoiseBasis2, (setter)Texture_setNoiseBasis2,
- "Produce bands using saw wave (marble, wood textures)",
- (void *)EXPP_TEX_NOISE_SAW},
- {"tri",
- (getter)Texture_getNoiseBasis2, (setter)Texture_setNoiseBasis2,
- "Produce bands using triangle wave (marble, wood textures)",
- (void *)EXPP_TEX_NOISE_TRI},
- {"interpol",
- (getter)Texture_getImageFlags, (setter)Texture_setImageFlags,
- "Interpolate image's pixels to fit texture mapping enabled ('ImageFlags')",
- (void *)TEX_INTERPOL},
- {"useAlpha",
- (getter)Texture_getImageFlags, (setter)Texture_setImageFlags,
- "Use of image's alpha channel enabled ('ImageFlags')",
- (void *)TEX_USEALPHA},
- {"calcAlpha",
- (getter)Texture_getImageFlags, (setter)Texture_setImageFlags,
- "Calculation of image's alpha channel enabled ('ImageFlags')",
- (void *)TEX_CALCALPHA},
- {"mipmap",
- (getter)Texture_getImageFlags, (setter)Texture_setImageFlags,
- "Mipmaps enabled ('ImageFlags')",
- (void *)TEX_MIPMAP},
- {"rot90",
- (getter)Texture_getImageFlags, (setter)Texture_setImageFlags,
- "X/Y flip for rendering enabled ('ImageFlags')",
- (void *)TEX_IMAROT},
- {"autoRefresh",
- (getter)Texture_getIUserFlags, (setter)Texture_setIUserFlags,
- "Refresh image on frame changes enabled",
- (void *)IMA_ANIM_ALWAYS},
- {"cyclic",
- (getter)Texture_getIUserCyclic, (setter)Texture_setIUserCyclic,
- "Cycling of animated frames enabled",
- NULL},
-#if 0
- /* disabled, moved to image */
- {"fields",
- (getter)Texture_getImageFlags, (setter)Texture_setImageFlags,
- "Use of image's fields enabled ('ImageFlags')",
- (void *)TEX_FIELDS},
- {"movie",
- (getter)Texture_getImageFlags, (setter)Texture_setImageFlags,
- "Movie frames as images enabled ('ImageFlags')",
- (void *)TEX_ANIM5},
- {"anti",
- (getter)Texture_getImageFlags, (setter)Texture_setImageFlags,
- "Image anti-aliasing enabled ('ImageFlags')",
- (void *)TEX_ANTIALI},
- {"stField",
- (getter)Texture_getImageFlags, (setter)Texture_setImageFlags,
- "Standard field deinterlacing enabled ('ImageFlags')",
- (void *)TEX_STD_FIELD},
-#endif
- {"normalMap",
- (getter)Texture_getImageFlags, (setter)Texture_setImageFlags,
- "Use of image RGB values for normal mapping enabled ('ImageFlags')",
- (void *)TEX_NORMALMAP},
- {"colorband",
- (getter)Texture_getColorband, (setter)Texture_setColorband,
- "The colorband for this texture",
- NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-/*****************************************************************************/
-/* Python Texture_Type callback function prototypes: */
-/*****************************************************************************/
-static int Texture_compare( BPy_Texture * a, BPy_Texture * b );
-static PyObject *Texture_repr( BPy_Texture * self );
-
-/*****************************************************************************/
-/* Python Texture_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject Texture_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender Texture", /* char *tp_name; */
- sizeof( BPy_Texture ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL, /* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- ( cmpfunc ) Texture_compare, /* cmpfunc tp_compare; */
- ( reprfunc ) Texture_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- NULL, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
- 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, /* 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, /* 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 ***/
- BPy_Texture_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_Texture_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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 PyObject *M_Texture_New( PyObject * self, PyObject * args,
- PyObject * kwords )
-{
- char *name_str = "Tex";
- static char *kwlist[] = { "name_str", NULL };
- PyObject *pytex; /* for Texture object wrapper in Python */
- Tex *bltex; /* for actual Tex we create in Blender */
-
- /* Parse the arguments passed in by the Python interpreter */
- if( !PyArg_ParseTupleAndKeywords
- ( args, kwords, "|s", kwlist, &name_str ) )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected zero, one or two strings as arguments" );
-
- bltex = add_texture( name_str ); /* first create the texture in Blender */
-
- if( bltex ) /* now create the wrapper obj in Python */
- pytex = Texture_CreatePyObject( bltex );
- else
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't create Texture in Blender" );
-
- /* let's return user count to zero, because add_texture() incref'd it */
- bltex->id.us = 0;
-
- if( pytex == NULL )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create Tex PyObject" );
-
- return pytex;
-}
-
-static PyObject *M_Texture_Get( PyObject * self, PyObject * args )
-{
- char *name = NULL;
- Tex *tex_iter;
-
- if( !PyArg_ParseTuple( args, "|s", &name ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument (or nothing)" );
-
- tex_iter = G.main->tex.first;
-
- if( name ) { /* (name) - Search for texture by name */
-
- PyObject *wanted_tex = NULL;
-
- while( tex_iter ) {
- if( STREQ( name, tex_iter->id.name + 2 ) ) {
- wanted_tex =
- Texture_CreatePyObject( tex_iter );
- break;
- }
-
- tex_iter = tex_iter->id.next;
- }
-
- if( !wanted_tex ) { /* Requested texture doesn't exist */
- char error_msg[64];
- PyOS_snprintf( error_msg, sizeof( error_msg ),
- "Texture \"%s\" not found", name );
- return EXPP_ReturnPyObjError( PyExc_NameError,
- error_msg );
- }
-
- return wanted_tex;
- }
-
- else { /* () - return a list of wrappers for all textures in the scene */
- int index = 0;
- PyObject *tex_pylist, *pyobj;
-
- tex_pylist = PyList_New( BLI_countlist( &( G.main->tex ) ) );
- if( !tex_pylist )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create PyList" );
-
- while( tex_iter ) {
- pyobj = Texture_CreatePyObject( tex_iter );
- if( !pyobj ) {
- Py_DECREF(tex_pylist);
- return EXPP_ReturnPyObjError
- ( PyExc_MemoryError,
- "couldn't create Texture PyObject" );
- }
- PyList_SET_ITEM( tex_pylist, index, pyobj );
-
- tex_iter = tex_iter->id.next;
- index++;
- }
-
- return tex_pylist;
- }
-}
-
-static int Texture_compare( BPy_Texture * a, BPy_Texture * b )
-{
- return ( a->texture == b->texture ) ? 0 : -1;
-}
-
-static PyObject *Texture_repr( BPy_Texture * self )
-{
- return PyString_FromFormat( "[Texture \"%s\"]",
- self->texture->id.name + 2 );
-}
-
-static PyObject *M_Texture_TypesDict( void )
-{
- PyObject *Types = PyConstant_New( );
- if( Types ) {
- BPy_constant *d = ( BPy_constant * ) Types;
- PyConstant_Insert(d, "NONE", PyInt_FromLong(EXPP_TEX_TYPE_NONE));
- PyConstant_Insert(d, "CLOUDS", PyInt_FromLong(TEX_CLOUDS));
- PyConstant_Insert(d, "WOOD", PyInt_FromLong(TEX_WOOD));
- PyConstant_Insert(d, "MARBLE", PyInt_FromLong(TEX_MARBLE));
- PyConstant_Insert(d, "MAGIC", PyInt_FromLong(TEX_MAGIC));
- PyConstant_Insert(d, "BLEND", PyInt_FromLong(TEX_BLEND));
- PyConstant_Insert(d, "STUCCI", PyInt_FromLong(TEX_STUCCI));
- PyConstant_Insert(d, "NOISE", PyInt_FromLong(TEX_NOISE));
- PyConstant_Insert(d, "IMAGE", PyInt_FromLong(TEX_IMAGE));
- PyConstant_Insert(d, "PLUGIN", PyInt_FromLong(TEX_PLUGIN));
- PyConstant_Insert(d, "ENVMAP", PyInt_FromLong(TEX_ENVMAP));
- PyConstant_Insert(d, "MUSGRAVE", PyInt_FromLong(TEX_MUSGRAVE));
- PyConstant_Insert(d, "VORONOI", PyInt_FromLong(TEX_VORONOI));
- PyConstant_Insert(d, "DISTNOISE", PyInt_FromLong(TEX_DISTNOISE));
- }
- return Types;
-}
-
-static PyObject *M_Texture_STypesDict( void )
-{
- PyObject *STypes = PyConstant_New( );
- if( STypes ) {
- BPy_constant *d = ( BPy_constant * ) STypes;
-
- PyConstant_Insert(d, "CLD_DEFAULT",
- PyInt_FromLong(EXPP_TEX_STYPE_CLD_DEFAULT));
- PyConstant_Insert(d, "CLD_COLOR",
- PyInt_FromLong(EXPP_TEX_STYPE_CLD_COLOR));
- PyConstant_Insert(d, "WOD_BANDS",
- PyInt_FromLong(EXPP_TEX_STYPE_WOD_BANDS));
- PyConstant_Insert(d, "WOD_RINGS",
- PyInt_FromLong(EXPP_TEX_STYPE_WOD_RINGS));
- PyConstant_Insert(d, "WOD_BANDNOISE",
- PyInt_FromLong(EXPP_TEX_STYPE_WOD_BANDNOISE));
- PyConstant_Insert(d, "WOD_RINGNOISE",
- PyInt_FromLong(EXPP_TEX_STYPE_WOD_RINGNOISE));
- PyConstant_Insert(d, "MAG_DEFAULT",
- PyInt_FromLong(EXPP_TEX_STYPE_MAG_DEFAULT));
- PyConstant_Insert(d, "MBL_SOFT",
- PyInt_FromLong(EXPP_TEX_STYPE_MBL_SOFT));
- PyConstant_Insert(d, "MBL_SHARP",
- PyInt_FromLong(EXPP_TEX_STYPE_MBL_SHARP));
- PyConstant_Insert(d, "MBL_SHARPER",
- PyInt_FromLong(EXPP_TEX_STYPE_MBL_SHARPER));
- PyConstant_Insert(d, "BLN_LIN",
- PyInt_FromLong(EXPP_TEX_STYPE_BLN_LIN));
- PyConstant_Insert(d, "BLN_QUAD",
- PyInt_FromLong(EXPP_TEX_STYPE_BLN_QUAD));
- PyConstant_Insert(d, "BLN_EASE",
- PyInt_FromLong(EXPP_TEX_STYPE_BLN_EASE));
- PyConstant_Insert(d, "BLN_DIAG",
- PyInt_FromLong(EXPP_TEX_STYPE_BLN_DIAG));
- PyConstant_Insert(d, "BLN_SPHERE",
- PyInt_FromLong(EXPP_TEX_STYPE_BLN_SPHERE));
- PyConstant_Insert(d, "BLN_HALO",
- PyInt_FromLong(EXPP_TEX_STYPE_BLN_HALO));
- PyConstant_Insert(d, "STC_PLASTIC",
- PyInt_FromLong(EXPP_TEX_STYPE_STC_PLASTIC));
- PyConstant_Insert(d, "STC_WALLIN",
- PyInt_FromLong(EXPP_TEX_STYPE_STC_WALLIN));
- PyConstant_Insert(d, "STC_WALLOUT",
- PyInt_FromLong(EXPP_TEX_STYPE_STC_WALLOUT));
- PyConstant_Insert(d, "NSE_DEFAULT",
- PyInt_FromLong(EXPP_TEX_STYPE_NSE_DEFAULT));
- PyConstant_Insert(d, "IMG_DEFAULT",
- PyInt_FromLong(EXPP_TEX_STYPE_IMG_DEFAULT));
- PyConstant_Insert(d, "PLG_DEFAULT",
- PyInt_FromLong(EXPP_TEX_STYPE_PLG_DEFAULT));
- PyConstant_Insert(d, "ENV_STATIC",
- PyInt_FromLong(EXPP_TEX_STYPE_ENV_STATIC));
- PyConstant_Insert(d, "ENV_ANIM",
- PyInt_FromLong(EXPP_TEX_STYPE_ENV_ANIM));
- PyConstant_Insert(d, "ENV_LOAD",
- PyInt_FromLong(EXPP_TEX_STYPE_ENV_LOAD));
- PyConstant_Insert(d, "MUS_MFRACTAL",
- PyInt_FromLong(EXPP_TEX_STYPE_MUS_MFRACTAL));
- PyConstant_Insert(d, "MUS_RIDGEDMF",
- PyInt_FromLong(EXPP_TEX_STYPE_MUS_RIDGEDMF));
- PyConstant_Insert(d, "MUS_HYBRIDMF",
- PyInt_FromLong(EXPP_TEX_STYPE_MUS_HYBRIDMF));
- PyConstant_Insert(d, "MUS_FBM",
- PyInt_FromLong(EXPP_TEX_STYPE_MUS_FBM));
- PyConstant_Insert(d, "MUS_HTERRAIN",
- PyInt_FromLong(EXPP_TEX_STYPE_MUS_HTERRAIN));
- PyConstant_Insert(d, "DN_BLENDER",
- PyInt_FromLong(TEX_BLENDER));
- PyConstant_Insert(d, "DN_PERLIN",
- PyInt_FromLong(TEX_STDPERLIN));
- PyConstant_Insert(d, "DN_IMPROVEDPERLIN",
- PyInt_FromLong(TEX_NEWPERLIN));
- PyConstant_Insert(d, "DN_VORONOIF1",
- PyInt_FromLong(TEX_VORONOI_F1));
- PyConstant_Insert(d, "DN_VORONOIF2",
- PyInt_FromLong(TEX_VORONOI_F2));
- PyConstant_Insert(d, "DN_VORONOIF3",
- PyInt_FromLong(TEX_VORONOI_F3));
- PyConstant_Insert(d, "DN_VORONOIF4",
- PyInt_FromLong(TEX_VORONOI_F4));
- PyConstant_Insert(d, "DN_VORONOIF2F1",
- PyInt_FromLong(TEX_VORONOI_F2F1));
- PyConstant_Insert(d, "DN_VORONOICRACKLE",
- PyInt_FromLong(TEX_VORONOI_CRACKLE));
- PyConstant_Insert(d, "DN_CELLNOISE",
- PyInt_FromLong(TEX_CELLNOISE));
- PyConstant_Insert(d, "VN_INT",
- PyInt_FromLong(EXPP_TEX_STYPE_VN_INT));
- PyConstant_Insert(d, "VN_COL1",
- PyInt_FromLong(EXPP_TEX_STYPE_VN_COL1));
- PyConstant_Insert(d, "VN_COL2",
- PyInt_FromLong(EXPP_TEX_STYPE_VN_COL2));
- PyConstant_Insert(d, "VN_COL3",
- PyInt_FromLong(EXPP_TEX_STYPE_VN_COL3));
- PyConstant_Insert(d, "VN_TEX_DISTANCE",
- PyInt_FromLong(TEX_DISTANCE));
- PyConstant_Insert(d, "VN_TEX_DISTANCE_SQUARED",
- PyInt_FromLong(TEX_DISTANCE_SQUARED));
- PyConstant_Insert(d, "VN_TEX_MANHATTAN",
- PyInt_FromLong(TEX_MANHATTAN));
- PyConstant_Insert(d, "VN_TEX_CHEBYCHEV",
- PyInt_FromLong(TEX_CHEBYCHEV));
- PyConstant_Insert(d, "VN_TEX_MINKOVSKY_HALF",
- PyInt_FromLong(TEX_MINKOVSKY_HALF));
- PyConstant_Insert(d, "VN_TEX_MINKOVSKY_FOUR",
- PyInt_FromLong(TEX_MINKOVSKY_FOUR));
- PyConstant_Insert(d, "VN_TEX_MINKOVSKY",
- PyInt_FromLong(TEX_MINKOVSKY));
-
- }
- return STypes;
-}
-
-static PyObject *M_Texture_TexCoDict( void )
-{
- PyObject *TexCo = PyConstant_New( );
- if( TexCo ) {
- BPy_constant *d = ( BPy_constant * ) TexCo;
- PyConstant_Insert(d, "ORCO", PyInt_FromLong(TEXCO_ORCO));
- PyConstant_Insert(d, "REFL", PyInt_FromLong(TEXCO_REFL));
- PyConstant_Insert(d, "NOR", PyInt_FromLong(TEXCO_NORM));
- PyConstant_Insert(d, "GLOB", PyInt_FromLong(TEXCO_GLOB));
- PyConstant_Insert(d, "UV", PyInt_FromLong(TEXCO_UV));
- PyConstant_Insert(d, "OBJECT", PyInt_FromLong(TEXCO_OBJECT));
- PyConstant_Insert(d, "WIN", PyInt_FromLong(TEXCO_WINDOW));
- PyConstant_Insert(d, "VIEW", PyInt_FromLong(TEXCO_VIEW));
- PyConstant_Insert(d, "STICK", PyInt_FromLong(TEXCO_STICKY));
- PyConstant_Insert(d, "STRESS", PyInt_FromLong(TEXCO_STRESS));
- PyConstant_Insert(d, "TANGENT", PyInt_FromLong(TEXCO_TANGENT));
- }
- return TexCo;
-}
-
-static PyObject *M_Texture_MapToDict( void )
-{
- PyObject *MapTo = PyConstant_New( );
- if( MapTo ) {
- BPy_constant *d = ( BPy_constant * ) MapTo;
- PyConstant_Insert(d, "COL", PyInt_FromLong(MAP_COL));
- PyConstant_Insert(d, "NOR", PyInt_FromLong(MAP_NORM));
- PyConstant_Insert(d, "CSP", PyInt_FromLong(MAP_COLSPEC));
- PyConstant_Insert(d, "CMIR", PyInt_FromLong(MAP_COLMIR));
- PyConstant_Insert(d, "REF", PyInt_FromLong(MAP_REF));
- PyConstant_Insert(d, "SPEC", PyInt_FromLong(MAP_SPEC));
- PyConstant_Insert(d, "HARD", PyInt_FromLong(MAP_HAR));
- PyConstant_Insert(d, "ALPHA", PyInt_FromLong(MAP_ALPHA));
- PyConstant_Insert(d, "EMIT", PyInt_FromLong(MAP_EMIT));
- PyConstant_Insert(d, "RAYMIR", PyInt_FromLong(MAP_RAYMIRR));
- PyConstant_Insert(d, "AMB", PyInt_FromLong(MAP_AMB));
- PyConstant_Insert(d, "TRANSLU", PyInt_FromLong(MAP_TRANSLU));
- PyConstant_Insert(d, "DISP", PyInt_FromLong(MAP_DISPLACE));
- PyConstant_Insert(d, "WARP", PyInt_FromLong(MAP_WARP));
- }
- return MapTo;
-}
-
-static PyObject *M_Texture_FlagsDict( void )
-{
- PyObject *Flags = PyConstant_New( );
- if( Flags ) {
- BPy_constant *d = ( BPy_constant * ) Flags;
- PyConstant_Insert(d, "COLORBAND", PyInt_FromLong(TEX_COLORBAND));
- PyConstant_Insert(d, "FLIPBLEND", PyInt_FromLong(TEX_FLIPBLEND));
- PyConstant_Insert(d, "NEGALPHA", PyInt_FromLong(TEX_NEGALPHA));
- PyConstant_Insert(d, "CHECKER_ODD", PyInt_FromLong(TEX_CHECKER_ODD));
- PyConstant_Insert(d, "CHECKER_EVEN", PyInt_FromLong(TEX_CHECKER_EVEN));
- PyConstant_Insert(d, "PREVIEW_ALPHA", PyInt_FromLong(TEX_PRV_ALPHA));
- PyConstant_Insert(d, "REPEAT_XMIR", PyInt_FromLong(TEX_REPEAT_XMIR));
- PyConstant_Insert(d, "REPEAT_YMIR", PyInt_FromLong(TEX_REPEAT_YMIR));
- }
- return Flags;
-}
-
-static PyObject *M_Texture_ExtendModesDict( void )
-{
- PyObject *ExtendModes = PyConstant_New( );
- if( ExtendModes ) {
- BPy_constant *d = ( BPy_constant * ) ExtendModes;
- PyConstant_Insert(d, "EXTEND", PyInt_FromLong(TEX_EXTEND));
- PyConstant_Insert(d, "CLIP", PyInt_FromLong(TEX_CLIP));
- PyConstant_Insert(d, "CLIPCUBE", PyInt_FromLong(TEX_CLIPCUBE));
- PyConstant_Insert(d, "REPEAT", PyInt_FromLong(TEX_REPEAT));
- }
- return ExtendModes;
-}
-
-static PyObject *M_Texture_ImageFlagsDict( void )
-{
- PyObject *ImageFlags = PyConstant_New( );
- if( ImageFlags ) {
- BPy_constant *d = ( BPy_constant * ) ImageFlags;
- PyConstant_Insert(d, "INTERPOL", PyInt_FromLong(TEX_INTERPOL));
- PyConstant_Insert(d, "USEALPHA", PyInt_FromLong(TEX_USEALPHA));
- PyConstant_Insert(d, "MIPMAP", PyInt_FromLong(TEX_MIPMAP));
- PyConstant_Insert(d, "ROT90", PyInt_FromLong(TEX_IMAROT));
- PyConstant_Insert(d, "CALCALPHA", PyInt_FromLong(TEX_CALCALPHA));
- PyConstant_Insert(d, "NORMALMAP", PyInt_FromLong(TEX_NORMALMAP));
- }
- return ImageFlags;
-}
-
-static PyObject *M_Texture_NoiseDict( void )
-{
- PyObject *Noise = PyConstant_New( );
- if( Noise ) {
- BPy_constant *d = ( BPy_constant * ) Noise;
- PyConstant_Insert(d, "SINE", PyInt_FromLong(EXPP_TEX_NOISE_SINE));
- PyConstant_Insert(d, "SAW", PyInt_FromLong(EXPP_TEX_NOISE_SAW));
- PyConstant_Insert(d, "TRI", PyInt_FromLong(EXPP_TEX_NOISE_TRI));
- PyConstant_Insert(d, "BLENDER", PyInt_FromLong(TEX_BLENDER));
- PyConstant_Insert(d, "PERLIN", PyInt_FromLong(TEX_STDPERLIN));
- PyConstant_Insert(d, "IMPROVEDPERLIN", PyInt_FromLong(TEX_NEWPERLIN));
- PyConstant_Insert(d, "VORONOIF1", PyInt_FromLong(TEX_VORONOI_F1));
- PyConstant_Insert(d, "VORONOIF2", PyInt_FromLong(TEX_VORONOI_F2));
- PyConstant_Insert(d, "VORONOIF3", PyInt_FromLong(TEX_VORONOI_F3));
- PyConstant_Insert(d, "VORONOIF4", PyInt_FromLong(TEX_VORONOI_F4));
- PyConstant_Insert(d, "VORONOIF2F1", PyInt_FromLong(TEX_VORONOI_F2F1));
- PyConstant_Insert(d, "VORONOICRACKLE",
- PyInt_FromLong(TEX_VORONOI_CRACKLE));
- PyConstant_Insert(d, "CELLNOISE", PyInt_FromLong(TEX_CELLNOISE));
- }
- return Noise;
-}
-
-static PyObject *M_Texture_BlendModesDict( void )
-{
- PyObject *BlendModes = PyConstant_New( );
- if( BlendModes ) {
- BPy_constant *d = ( BPy_constant * ) BlendModes;
- PyConstant_Insert(d, "MIX", PyInt_FromLong(MTEX_BLEND));
- PyConstant_Insert(d, "MULTIPLY", PyInt_FromLong(MTEX_MUL));
- PyConstant_Insert(d, "ADD", PyInt_FromLong(MTEX_ADD));
- PyConstant_Insert(d, "SUBTRACT", PyInt_FromLong(MTEX_SUB));
- PyConstant_Insert(d, "DIVIDE", PyInt_FromLong(MTEX_DIV));
- PyConstant_Insert(d, "DARKEN", PyInt_FromLong(MTEX_DARK));
- PyConstant_Insert(d, "DIFFERENCE", PyInt_FromLong(MTEX_DIFF));
- PyConstant_Insert(d, "LIGHTEN", PyInt_FromLong(MTEX_LIGHT));
- PyConstant_Insert(d, "SCREEN", PyInt_FromLong(MTEX_SCREEN));
- }
- return BlendModes;
-}
-
-static PyObject *M_Texture_MappingsDict( void )
-{
- PyObject *Mappings = PyConstant_New( );
- if( Mappings ) {
- BPy_constant *d = ( BPy_constant * ) Mappings;
- PyConstant_Insert(d, "FLAT", PyInt_FromLong(MTEX_FLAT));
- PyConstant_Insert(d, "CUBE", PyInt_FromLong(MTEX_CUBE));
- PyConstant_Insert(d, "TUBE", PyInt_FromLong(MTEX_TUBE));
- PyConstant_Insert(d, "SPHERE", PyInt_FromLong(MTEX_SPHERE));
- }
- return Mappings;
-}
-
-static PyObject *M_Texture_ProjDict( void )
-{
- PyObject *Proj = PyConstant_New( );
- if( Proj ) {
- BPy_constant *d = ( BPy_constant * ) Proj;
- PyConstant_Insert(d, "NONE", PyInt_FromLong(PROJ_N));
- PyConstant_Insert(d, "X", PyInt_FromLong(PROJ_X));
- PyConstant_Insert(d, "Y", PyInt_FromLong(PROJ_Y));
- PyConstant_Insert(d, "Z", PyInt_FromLong(PROJ_Z));
- }
- return Proj;
-}
-
-PyObject *Texture_Init( void )
-{
- PyObject *submodule;
- PyObject *dict;
-
- /* constants */
- PyObject *Types = M_Texture_TypesDict( );
- PyObject *STypes = M_Texture_STypesDict( );
- PyObject *TexCo = M_Texture_TexCoDict( );
- PyObject *MapTo = M_Texture_MapToDict( );
- PyObject *Flags = M_Texture_FlagsDict( );
- PyObject *ExtendModes = M_Texture_ExtendModesDict( );
- PyObject *ImageFlags = M_Texture_ImageFlagsDict( );
- PyObject *Noise = M_Texture_NoiseDict( );
- PyObject *BlendModes = M_Texture_BlendModesDict( );
- PyObject *Mappings = M_Texture_MappingsDict( );
- PyObject *Proj = M_Texture_ProjDict( );
-
- if( PyType_Ready( &Texture_Type ) < 0)
- return NULL;
-
- submodule = Py_InitModule3( "Blender.Texture",
- M_Texture_methods, M_Texture_doc );
-
- if( Types )
- PyModule_AddObject( submodule, "Types", Types );
- if( STypes )
- PyModule_AddObject( submodule, "STypes", STypes );
- if( TexCo )
- PyModule_AddObject( submodule, "TexCo", TexCo );
- if( MapTo )
- PyModule_AddObject( submodule, "MapTo", MapTo );
- if( Flags )
- PyModule_AddObject( submodule, "Flags", Flags );
- if( ExtendModes )
- PyModule_AddObject( submodule, "ExtendModes", ExtendModes );
- if( ImageFlags )
- PyModule_AddObject( submodule, "ImageFlags", ImageFlags );
- if( Noise )
- PyModule_AddObject( submodule, "Noise", Noise );
- if ( BlendModes )
- PyModule_AddObject( submodule, "BlendModes", BlendModes );
- if ( Mappings )
- PyModule_AddObject( submodule, "Mappings", Mappings );
- if ( Proj )
- PyModule_AddObject( submodule, "Proj", Proj );
-
- /* Add the MTex submodule to this module */
- dict = PyModule_GetDict( submodule );
- PyDict_SetItemString( dict, "MTex", MTex_Init( ) );
-
- return submodule;
-}
-
-PyObject *Texture_CreatePyObject( Tex * tex )
-{
- BPy_Texture *pytex;
-
- pytex = ( BPy_Texture * ) PyObject_NEW( BPy_Texture, &Texture_Type );
- if( !pytex )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create BPy_Texture PyObject" );
-
- pytex->texture = tex;
- return ( PyObject * ) pytex;
-}
-
-Tex *Texture_FromPyObject( PyObject * pyobj )
-{
- return ( ( BPy_Texture * ) pyobj )->texture;
-}
-
-/*****************************************************************************/
-/* Python BPy_Texture methods: */
-/*****************************************************************************/
-
-static PyObject *Texture_getExtend( BPy_Texture * self )
-{
- const char *extend = NULL;
-
- if( EXPP_map_getStrVal
- ( tex_extend_map, self->texture->extend, &extend ) )
- return PyString_FromString( extend );
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "invalid internal extend mode" );
-}
-
-static PyObject *Texture_getImage( BPy_Texture * self )
-{
- /* we need this to be an IMAGE texture, and we must have an image */
- if( ( self->texture->type == TEX_IMAGE ||
- self->texture->type == TEX_ENVMAP )
- && self->texture->ima )
- return Image_CreatePyObject( self->texture->ima );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Texture_oldgetSType( BPy_Texture * self )
-{
- const char *stype = NULL;
- int n_stype;
-
- if( self->texture->type == TEX_VORONOI )
- n_stype = self->texture->vn_coltype;
-#if 0
- else if( self->texture->type == TEX_MUSGRAVE )
- n_stype = self->texture->noisebasis;
-#endif
- else if( self->texture->type == TEX_ENVMAP )
- n_stype = self->texture->env->stype;
- else
- n_stype = self->texture->stype;
-
- if( EXPP_map_getStrVal( tex_stype_map[self->texture->type],
- n_stype, &stype ) )
- return PyString_FromString( stype );
-
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "invalid texture stype internally" );
-}
-
-static PyObject *Texture_oldgetType( BPy_Texture * self )
-{
- const char *type = NULL;
-
- if( EXPP_map_getStrVal( tex_type_map, self->texture->type, &type ) )
- return PyString_FromString( type );
-
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "invalid texture type internally" );
-}
-
-static int Texture_setAnimFrames( BPy_Texture * self, PyObject * value )
-{
- return EXPP_setIValueClamped ( value, &self->texture->iuser.frames,
- EXPP_TEX_ANIMFRAME_MIN,
- EXPP_TEX_ANIMFRAME_MAX, 'h' );
-}
-
-static int Texture_setIUserCyclic( BPy_Texture * self, PyObject * value )
-{
- int param = PyObject_IsTrue( value );
- if( param == -1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected True/False or 0/1" );
-
- if( param )
- self->texture->iuser.cycl = 1;
- else
- self->texture->iuser.cycl = 0;
- return 0;
-}
-
-#if 0
-/* this was stupid to begin with! (ton) */
-static int Texture_setAnimLength( BPy_Texture * self, PyObject * value )
-{
- return EXPP_setIValueClamped ( value, &self->texture->len,
- EXPP_TEX_ANIMLEN_MIN,
- EXPP_TEX_ANIMLEN_MAX, 'h' );
-}
-
-/* this is too simple to keep supporting? disabled for time being (ton) */
-static int Texture_setAnimMontage( BPy_Texture * self, PyObject * value )
-{
- int fradur[4][2];
- int i;
-
- if( !PyArg_ParseTuple( value, "(ii)(ii)(ii)(ii)",
- &fradur[0][0], &fradur[0][1],
- &fradur[1][0], &fradur[1][1],
- &fradur[2][0], &fradur[2][1],
- &fradur[3][0], &fradur[3][1] ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a tuple of tuples" );
-
- for( i = 0; i < 4; ++i ) {
- self->texture->fradur[i][0] =
- (short)EXPP_ClampInt ( fradur[i][0], EXPP_TEX_ANIMMONSTART_MIN,
- EXPP_TEX_ANIMMONSTART_MAX );
- self->texture->fradur[i][1] =
- (short)EXPP_ClampInt ( fradur[i][1], EXPP_TEX_ANIMMONDUR_MIN,
- EXPP_TEX_ANIMMONDUR_MAX );
- }
-
- return 0;
-}
-#endif
-
-static int Texture_setAnimOffset( BPy_Texture * self, PyObject * value )
-{
- return EXPP_setIValueClamped ( value, &self->texture->iuser.offset,
- EXPP_TEX_ANIMOFFSET_MIN,
- EXPP_TEX_ANIMOFFSET_MAX, 'h' );
-}
-
-static int Texture_setAnimStart( BPy_Texture * self, PyObject * value )
-{
- return EXPP_setIValueClamped ( value, &self->texture->iuser.sfra,
- EXPP_TEX_ANIMSTART_MIN,
- EXPP_TEX_ANIMSTART_MAX, 'h' );
-}
-
-static int Texture_setBrightness( BPy_Texture * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->texture->bright,
- EXPP_TEX_BRIGHTNESS_MIN,
- EXPP_TEX_BRIGHTNESS_MAX );
-}
-
-static int Texture_setContrast( BPy_Texture * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->texture->contrast,
- EXPP_TEX_CONTRAST_MIN,
- EXPP_TEX_CONTRAST_MAX );
-}
-
-static int Texture_setCrop( BPy_Texture * self, PyObject * value )
-{
- float crop[4];
-
- if( !PyArg_ParseTuple( value, "ffff",
- &crop[0], &crop[1], &crop[2], &crop[3] ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected tuple of 4 floats" );
-
- self->texture->cropxmin = EXPP_ClampFloat( crop[0], EXPP_TEX_CROP_MIN,
- EXPP_TEX_CROP_MAX );
- self->texture->cropymin = EXPP_ClampFloat( crop[1], EXPP_TEX_CROP_MIN,
- EXPP_TEX_CROP_MAX );
- self->texture->cropxmax = EXPP_ClampFloat( crop[2], EXPP_TEX_CROP_MIN,
- EXPP_TEX_CROP_MAX );
- self->texture->cropymax = EXPP_ClampFloat( crop[3], EXPP_TEX_CROP_MIN,
- EXPP_TEX_CROP_MAX );
-
- return 0;
-}
-
-static int Texture_setIntExtend( BPy_Texture * self, PyObject * value )
-{
- return EXPP_setIValueRange ( value, &self->texture->extend,
- EXPP_TEX_EXTEND_MIN,
- EXPP_TEX_EXTEND_MAX, 'h' );
-}
-
-static int Texture_setFieldsPerImage( BPy_Texture * self,
- PyObject * value )
-{
- return EXPP_setIValueClamped ( value, &self->texture->iuser.fie_ima,
- EXPP_TEX_FIEIMA_MIN,
- EXPP_TEX_FIEIMA_MAX, 'h' );
-
-}
-
-static int Texture_setFilterSize( BPy_Texture * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->texture->filtersize,
- EXPP_TEX_FILTERSIZE_MIN,
- EXPP_TEX_FILTERSIZE_MAX );
-}
-
-static int Texture_setFlags( BPy_Texture * self, PyObject * value )
-{
- int param;
-
- if( !PyInt_Check( value ) ) {
- char errstr[128];
- sprintf ( errstr , "expected int bitmask of 0x%08x", TEX_FLAG_MASK );
- return EXPP_ReturnIntError( PyExc_TypeError, errstr );
- }
- param = PyInt_AS_LONG ( value );
-
- if ( ( param & TEX_FLAG_MASK ) != param )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "invalid bit(s) set in mask" );
-
- self->texture->flag = (short)param;
-
-#if 0
- /* if Colorband enabled, make sure we allocate memory for it */
-
- if ( ( param & TEX_COLORBAND ) && !self->texture->coba )
- self->texture->coba = add_colorband();
-#endif
-
- return 0;
-}
-
-static int Texture_setImage( BPy_Texture * self, PyObject * value )
-{
- Image *blimg = NULL;
-
- if( !BPy_Image_Check (value) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected an Image" );
- blimg = Image_FromPyObject( value );
-
- if( self->texture->ima ) {
- self->texture->ima->id.us--;
- }
-
- self->texture->ima = blimg;
- id_us_plus( &blimg->id );
-
- return 0;
-}
-
-static int Texture_setImageFlags( BPy_Texture * self, PyObject * value,
- void *type )
-{
- short param;
-
- /*
- * if type is non-zero, then attribute is "mipmap", "calcAlpha", etc.,
- * so set/clear the bit in the bitfield based on the type
- */
-
- if( (int)type ) {
- int err;
- param = self->texture->imaflag;
- err = EXPP_setBitfield( value, &param, (int)type, 'h' );
- if( err )
- return err;
-
- /*
- * if type is zero, then attribute is "imageFlags", so check
- * value for a valid bitmap range.
- */
-
- } else {
- int bitmask = TEX_INTERPOL
- | TEX_USEALPHA
- | TEX_MIPMAP
- | TEX_IMAROT
- | TEX_CALCALPHA
- | TEX_NORMALMAP;
-
- if( !PyInt_Check( value ) ) {
- char errstr[128];
- sprintf ( errstr , "expected int bitmask of 0x%08x", bitmask );
- return EXPP_ReturnIntError( PyExc_TypeError, errstr );
- }
-
- param = (short)PyInt_AS_LONG( value );
- if( ( param & bitmask ) != param )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "invalid bit(s) set in mask" );
- }
-
- /* everything is OK; save the new flag setting */
-
- self->texture->imaflag = param;
- return 0;
-}
-
-static int Texture_setIUserFlags( BPy_Texture * self, PyObject * value,
- void *flag )
-{
- int param = PyObject_IsTrue( value );
- if( param == -1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected True/False or 0/1" );
-
- if( param )
- self->texture->iuser.flag |= (int)flag;
- else
- self->texture->iuser.flag &= ~(int)flag;
- return 0;
-}
-
-static int Texture_setNoiseDepth( BPy_Texture * self, PyObject * value )
-{
- short max = EXPP_TEX_NOISEDEPTH_MAX;
-
- /* for whatever reason, magic texture has a different max value */
-
- if( self->texture->type == TEX_MAGIC )
- max = EXPP_TEX_NOISEDEPTH_MAX_MAGIC;
-
- return EXPP_setIValueClamped ( value, &self->texture->noisedepth,
- EXPP_TEX_NOISEDEPTH_MIN, max, 'h' );
-}
-
-static int Texture_setNoiseSize( BPy_Texture * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->texture->noisesize,
- EXPP_TEX_NOISESIZE_MIN,
- EXPP_TEX_NOISESIZE_MAX );
-}
-
-static int Texture_setNoiseType( BPy_Texture * self, PyObject * value )
-{
- char *param;
-
- if( !PyString_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected string argument" );
- param = PyString_AS_STRING( value );
-
- if( STREQ( param, "soft" ) )
- self->texture->noisetype = TEX_NOISESOFT;
- else if( STREQ( param, "hard" ) )
- self->texture->noisetype = TEX_NOISEPERL;
- else
- return EXPP_ReturnIntError( PyExc_ValueError,
- "noise type must be 'soft' or 'hard'" );
-
- return 0;
-}
-
-static int Texture_setNoiseBasis( BPy_Texture * self, PyObject * value )
-{
- int param;
-
- if( !PyInt_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected int (see 'Noise' constant dictionary)" );
-
- param = PyInt_AS_LONG ( value );
-
- if ( param < TEX_BLENDER
- || ( param > TEX_VORONOI_CRACKLE
- && param != TEX_CELLNOISE ) )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "invalid noise type" );
-
- self->texture->noisebasis = (short)param;
- return 0;
-}
-
-static int Texture_setNoiseBasis2( BPy_Texture * self, PyObject * value,
- void *type )
-{
- /*
- * if type is EXPP_TEX_NOISEBASIS2, then this is the "noiseBasis2"
- * attribute, so check the range and set the whole value
- */
-
- if( (int)type == EXPP_TEX_NOISEBASIS2 ) {
- int param;
- if( !PyInt_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected int (see 'Noise' constant dictionary)" );
-
- param = PyInt_AS_LONG ( value );
-
- if ( param < TEX_BLENDER
- || ( param > TEX_VORONOI_CRACKLE
- && param != TEX_CELLNOISE ) )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "invalid noise type" );
-
- self->texture->noisebasis2 = (short)param;
-
- /*
- * for other type values, the attribute is "sine", "saw" or "tri",
- * so set the noise basis to the supplied type if value is 1
- */
-
- } else {
- if( !PyInt_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected int value of 1" );
-
- if( PyInt_AS_LONG ( value ) != 1 )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "expected int value of 1" );
-
- self->texture->noisebasis2 = (short)(int)type;
- }
- return 0;
-}
-
-static int Texture_setRepeat( BPy_Texture * self, PyObject * args )
-{
- int repeat[2];
-
- if( !PyArg_ParseTuple( args, "ii", &repeat[0], &repeat[1] ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected tuple of 2 ints" );
-
- self->texture->xrepeat = (short)EXPP_ClampInt( repeat[0], EXPP_TEX_REPEAT_MIN,
- EXPP_TEX_REPEAT_MAX );
- self->texture->yrepeat = (short)EXPP_ClampInt( repeat[1], EXPP_TEX_REPEAT_MIN,
- EXPP_TEX_REPEAT_MAX );
-
- return 0;
-}
-
-static int Texture_setRGBCol( BPy_Texture * self, PyObject * args )
-{
- float rgb[3];
-
- if( !PyArg_ParseTuple( args, "fff", &rgb[0], &rgb[1], &rgb[2] ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected tuple of 3 floats" );
-
- self->texture->rfac = EXPP_ClampFloat( rgb[0], EXPP_TEX_RGBCOL_MIN,
- EXPP_TEX_RGBCOL_MAX );
- self->texture->gfac = EXPP_ClampFloat( rgb[1], EXPP_TEX_RGBCOL_MIN,
- EXPP_TEX_RGBCOL_MAX );
- self->texture->bfac = EXPP_ClampFloat( rgb[2], EXPP_TEX_RGBCOL_MIN,
- EXPP_TEX_RGBCOL_MAX );
-
- return 0;
-}
-
-static int Texture_setSType( BPy_Texture * self, PyObject * value )
-{
- short param;
- const char *dummy = NULL;
-
- if( !PyInt_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected int argument" );
-
- param = (short)PyInt_AS_LONG ( value );
-
- /* use the stype map to find out if this is a valid stype for this type *
- * note that this will allow CLD_COLOR when type is ENVMAP. there's not *
- * much that we can do about this though. */
- if( !EXPP_map_getStrVal
- ( tex_stype_map[self->texture->type], param, &dummy ) )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "invalid stype (for this type)" );
-
- if( self->texture->type == TEX_VORONOI )
- self->texture->vn_coltype = param;
-#if 0
- else if( self->texture->type == TEX_MUSGRAVE )
- self->texture->noisebasis = param;
-#endif
- else if( self->texture->type == TEX_ENVMAP )
- self->texture->env->stype = param;
- else
- self->texture->stype = param;
-
- return 0;
-}
-
-static int Texture_setTurbulence( BPy_Texture * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->texture->turbul,
- EXPP_TEX_TURBULENCE_MIN,
- EXPP_TEX_TURBULENCE_MAX );
-}
-
-static int Texture_setHFracDim( BPy_Texture * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->texture->mg_H,
- EXPP_TEX_MH_G_MIN,
- EXPP_TEX_MH_G_MAX );
-}
-
-static int Texture_setLacunarity( BPy_Texture * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->texture->mg_lacunarity,
- EXPP_TEX_LACUNARITY_MIN,
- EXPP_TEX_LACUNARITY_MAX );
-}
-
-static int Texture_setOcts( BPy_Texture * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->texture->mg_octaves,
- EXPP_TEX_OCTS_MIN,
- EXPP_TEX_OCTS_MAX );
-}
-
-static int Texture_setIScale( BPy_Texture * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->texture->ns_outscale,
- EXPP_TEX_ISCALE_MIN,
- EXPP_TEX_ISCALE_MAX );
-}
-
-static int Texture_setType( BPy_Texture * self, PyObject * value )
-{
- int err = EXPP_setIValueRange ( value, &self->texture->type,
- EXPP_TEX_TYPE_MIN,
- EXPP_TEX_TYPE_MAX, 'h' );
-
- /*
- * if we set the texture OK, and it's a environment map, and
- * there is no environment map yet, allocate one (code borrowed
- * from texture_panel_envmap() in source/blender/src/buttons_shading.c)
- */
-
- if( !err && self->texture->type == TEX_ENVMAP
- && !self->texture->env ) {
- self->texture->env = BKE_add_envmap();
- self->texture->env->object= OBACT;
- }
- return err;
-}
-
-static int Texture_setDistMetric( BPy_Texture * self, PyObject * value )
-{
-#if 0
- char *dist = NULL;
-
- if( !PyArg_ParseTuple( value, "s", &dist ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument" );
-
- /* can we really trust texture->type? */
- if( self->texture->type == TEX_VORONOI &&
- !EXPP_map_getShortVal( tex_stype_map[self->texture->type + 2],
- dist, &self->texture->vn_distm ) )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "invalid dist metric type" );
-
- Py_RETURN_NONE;
-#else
- return EXPP_setIValueRange ( value, &self->texture->vn_distm,
- TEX_DISTANCE,
- TEX_MINKOVSKY, 'h' );
-#endif
-}
-
-static int Texture_setExp( BPy_Texture * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->texture->vn_mexp,
- EXPP_TEX_EXP_MIN,
- EXPP_TEX_EXP_MAX );
-}
-
-static int Texture_setWeight1( BPy_Texture * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->texture->vn_w1,
- EXPP_TEX_WEIGHT1_MIN,
- EXPP_TEX_WEIGHT1_MAX );
-}
-
-static int Texture_setWeight2( BPy_Texture * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->texture->vn_w2,
- EXPP_TEX_WEIGHT2_MIN,
- EXPP_TEX_WEIGHT2_MAX );
-}
-
-static int Texture_setWeight3( BPy_Texture * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->texture->vn_w3,
- EXPP_TEX_WEIGHT3_MIN,
- EXPP_TEX_WEIGHT3_MAX );
-}
-
-static int Texture_setWeight4( BPy_Texture * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->texture->vn_w4,
- EXPP_TEX_WEIGHT4_MIN,
- EXPP_TEX_WEIGHT4_MAX );
-}
-
-static int Texture_setDistAmnt( BPy_Texture * self, PyObject * value )
-{
- return EXPP_setFloatClamped ( value, &self->texture->dist_amount,
- EXPP_TEX_DISTAMNT_MIN,
- EXPP_TEX_DISTAMNT_MAX );
-}
-
-static PyObject *Texture_getIpo( BPy_Texture * self )
-{
- struct Ipo *ipo = self->texture->ipo;
-
- if( !ipo )
- Py_RETURN_NONE;
-
- return Ipo_CreatePyObject( ipo );
-}
-
-/*
- * this should accept a Py_None argument and just delete the Ipo link
- * (as Texture_clearIpo() does)
- */
-
-static int Texture_setIpo( BPy_Texture * self, PyObject * value )
-{
- Ipo *ipo = NULL;
- Ipo *oldipo = self->texture->ipo;
- ID *id;
-
- /* if parameter is not None, check for valid Ipo */
-
- if ( value != Py_None ) {
- if ( !BPy_Ipo_Check( value ) )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "expected an Ipo object" );
-
- ipo = Ipo_FromPyObject( value );
-
- if( !ipo )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "null ipo!" );
-
- if( ipo->blocktype != ID_TE )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "Ipo is not a texture data Ipo" );
- }
-
- /* if already linked to Ipo, delete link */
-
- if ( oldipo ) {
- id = &oldipo->id;
- if( id->us > 0 )
- id->us--;
- }
-
- /* assign new Ipo and increment user count, or set to NULL if deleting */
-
- self->texture->ipo = ipo;
- if ( ipo ) {
- id = &ipo->id;
- id_us_plus(id);
- }
-
- return 0;
-}
-
-static PyObject *Texture_getAnimFrames( BPy_Texture *self )
-{
- return PyInt_FromLong( self->texture->iuser.frames );
-}
-
-static PyObject *Texture_getIUserCyclic( BPy_Texture *self )
-{
- if( self->texture->iuser.cycl )
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
-}
-
-#if 0
-/* disabled. this option was too stupid! (ton) */
-static PyObject *Texture_getAnimLength( BPy_Texture *self )
-{
- return PyInt_FromLong( self->texture->len );
-}
-
-static PyObject *Texture_getAnimMontage( BPy_Texture *self )
-{
- return Py_BuildValue( "((i,i),(i,i),(i,i),(i,i))",
- self->texture->fradur[0][0],
- self->texture->fradur[0][1],
- self->texture->fradur[1][0],
- self->texture->fradur[1][1],
- self->texture->fradur[2][0],
- self->texture->fradur[2][1],
- self->texture->fradur[3][0],
- self->texture->fradur[3][1] );
-}
-#endif
-
-static PyObject *Texture_getAnimOffset( BPy_Texture *self )
-{
- return PyInt_FromLong( self->texture->iuser.offset );
-}
-
-static PyObject *Texture_getAnimStart( BPy_Texture *self )
-{
- return PyInt_FromLong( self->texture->iuser.sfra );
-}
-
-static PyObject *Texture_getBrightness( BPy_Texture *self )
-{
- return PyFloat_FromDouble ( self->texture->bright );
-}
-
-static PyObject *Texture_getContrast( BPy_Texture *self )
-{
- return PyFloat_FromDouble( self->texture->contrast );
-}
-
-static PyObject *Texture_getCrop( BPy_Texture *self )
-{
- return Py_BuildValue( "(f,f,f,f)",
- self->texture->cropxmin,
- self->texture->cropymin,
- self->texture->cropxmax,
- self->texture->cropymax );
-}
-
-static PyObject *Texture_getDistAmnt( BPy_Texture *self )
-{
- return PyFloat_FromDouble( self->texture->dist_amount );
-}
-
-static PyObject *Texture_getDistMetric( BPy_Texture *self )
-{
- return PyInt_FromLong( self->texture->vn_distm );
-}
-
-static PyObject *Texture_getExp( BPy_Texture *self )
-{
- return PyFloat_FromDouble( self->texture->vn_mexp );
-}
-
-static PyObject *Texture_getIntExtend( BPy_Texture * self )
-{
- return PyInt_FromLong( self->texture->extend );
-}
-
-static PyObject *Texture_getFieldsPerImage( BPy_Texture *self )
-{
- return PyInt_FromLong( self->texture->iuser.fie_ima );
-}
-
-static PyObject *Texture_getFilterSize( BPy_Texture *self )
-{
- return PyFloat_FromDouble( self->texture->filtersize );
-}
-
-static PyObject *Texture_getFlags( BPy_Texture *self )
-{
- return PyInt_FromLong( self->texture->flag );
-}
-
-static PyObject *Texture_getHFracDim( BPy_Texture *self )
-{
- return PyInt_FromLong( (long)self->texture->mg_H );
-}
-
-static PyObject *Texture_getImageFlags( BPy_Texture *self, void *type )
-{
- /* type == 0 means attribute "imageFlags"
- * other types means attribute "mipmap", "calcAlpha", etc
- */
-
- if( (int)type )
- return EXPP_getBitfield( &self->texture->imaflag, (int)type, 'h' );
- else
- return PyInt_FromLong( self->texture->imaflag );
-}
-
-static PyObject *Texture_getIUserFlags( BPy_Texture *self, void *flag )
-{
- if( self->texture->iuser.flag & (int)flag )
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
-}
-
-static PyObject *Texture_getIScale( BPy_Texture *self )
-{
- return PyFloat_FromDouble( self->texture->ns_outscale );
-}
-
-static PyObject *Texture_getLacunarity( BPy_Texture *self )
-{
- return PyFloat_FromDouble( self->texture->mg_lacunarity );
-}
-
-static PyObject *Texture_getNoiseBasis( BPy_Texture *self )
-{
- return PyInt_FromLong( self->texture->noisebasis );
-}
-
-static PyObject *Texture_getNoiseBasis2( BPy_Texture *self, void *type )
-{
- /* type == EXPP_TEX_NOISEBASIS2 means attribute "noiseBasis2"
- * other types means attribute "sine", "saw", or "tri" attribute
- */
-
- if( (int)type == EXPP_TEX_NOISEBASIS2 )
- return PyInt_FromLong( self->texture->noisebasis2 );
- else
- return PyInt_FromLong( ( self->texture->noisebasis2 == (int)type ) ? 1 : 0 );
-}
-
-static PyObject *Texture_getNoiseDepth( BPy_Texture *self )
-{
- return PyInt_FromLong( self->texture->noisedepth );
-}
-
-static PyObject *Texture_getNoiseSize( BPy_Texture *self )
-{
- return PyFloat_FromDouble( self->texture->noisesize );
-}
-
-static PyObject *Texture_getNoiseType( BPy_Texture *self )
-{
- if ( self->texture->noisetype == TEX_NOISESOFT )
- return PyString_FromString( "soft" );
- else
- return PyString_FromString( "hard" );
-}
-
-static PyObject *Texture_getOcts( BPy_Texture *self )
-{
- return PyFloat_FromDouble( self->texture->mg_octaves );
-}
-
-static PyObject *Texture_getRepeat( BPy_Texture *self )
-{
- return Py_BuildValue( "(i,i)", self->texture->xrepeat,
- self->texture->yrepeat );
-}
-
-static PyObject *Texture_getRGBCol( BPy_Texture *self )
-{
- return Py_BuildValue( "(f,f,f)", self->texture->rfac,
- self->texture->gfac, self->texture->bfac );
-}
-
-static PyObject *Texture_getSType( BPy_Texture *self )
-{
- if( self->texture->type == TEX_VORONOI )
- return PyInt_FromLong( self->texture->vn_coltype );
-#if 0
- if( self->texture->type == TEX_MUSGRAVE )
- return PyInt_FromLong( self->texture->noisebasis );
-#endif
- if( self->texture->type == TEX_ENVMAP )
- return PyInt_FromLong( self->texture->env->stype );
-
- return PyInt_FromLong( self->texture->stype );
-}
-
-static PyObject *Texture_getTurbulence( BPy_Texture *self )
-{
- return PyFloat_FromDouble( self->texture->turbul );
-}
-
-static PyObject *Texture_getType( BPy_Texture *self )
-{
- return PyInt_FromLong( self->texture->type );
-}
-
-static PyObject *Texture_getWeight1( BPy_Texture *self )
-{
- return PyFloat_FromDouble( self->texture->vn_w1 );
-}
-
-static PyObject *Texture_getWeight2( BPy_Texture *self )
-{
- return PyFloat_FromDouble( self->texture->vn_w2 );
-}
-
-static PyObject *Texture_getWeight3( BPy_Texture *self )
-{
- return PyFloat_FromDouble( self->texture->vn_w3 );
-}
-
-static PyObject *Texture_getWeight4( BPy_Texture *self )
-{
- return PyFloat_FromDouble( self->texture->vn_w4 );
-}
-
-/* #####DEPRECATED###### */
-
-static PyObject *Texture_oldsetImage( BPy_Texture * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)Texture_setImage );
-}
-
-static PyObject *Texture_oldsetIpo( BPy_Texture * self, PyObject * args )
-{
- return EXPP_setterWrapper ( (void *)self, args, (setter)Texture_setIpo );
-}
-
-/*
- * clearIpo() returns True/False depending on whether material has an Ipo
- */
-
-static PyObject *Texture_clearIpo( BPy_Texture * self )
-{
- /* if Ipo defined, delete it and return true */
-
- if( self->texture->ipo ) {
- PyObject *value = Py_BuildValue( "(O)", Py_None );
- EXPP_setterWrapper( (void *)self, value, (setter)Texture_setIpo );
- Py_DECREF( value );
- return EXPP_incr_ret_True();
- }
- return EXPP_incr_ret_False(); /* no ipo found */
-}
-
-/*
- * these older setter methods take strings as parameters; check the list of
- * strings to figure out which bits to set, then call new attribute setters
- * using the wrapper.
- */
-
-static PyObject *Texture_oldsetFlags( BPy_Texture * self, PyObject * args )
-{
- unsigned int i, flag = 0;
- PyObject *value, *error;
-
- /* check that we're passed a tuple */
-
- if ( !PyTuple_Check( args ) )
- return EXPP_ReturnPyObjError ( PyExc_AttributeError,
- "expected a tuple of string arguments" );
-
- /* check each argument for type, find its value */
-
- for ( i = PyTuple_Size( args ); i-- ; ) {
- short thisflag;
- char * name = PyString_AsString( PyTuple_GET_ITEM( args, i ) );
- if( !name )
- return EXPP_ReturnPyObjError ( PyExc_AttributeError,
- "expected string argument" );
-
- if( !EXPP_map_getShortVal( tex_flag_map, name, &thisflag ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "unknown Texture flag argument" ) );
-
- flag |= thisflag;
- }
-
- /* build tuple, call wrapper */
-
- value = Py_BuildValue( "(i)", flag );
- error = EXPP_setterWrapper( (void *)self, value, (setter)Texture_setFlags );
- Py_DECREF ( value );
- return error;
-}
-
-/*
- * Texture_oldsetType() and Texture_oldsetExtend()
- *
- * These older setter methods convert a string into an integer setting, so
- * doesn't make sense to try wrapping them.
- */
-
-static PyObject *Texture_oldsetType( BPy_Texture * self, PyObject * args )
-{
- char *type = NULL;
-
- if( !PyArg_ParseTuple( args, "s", &type ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument" );
-
- if( !EXPP_map_getShortVal( tex_type_map, type, &self->texture->type ) )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "invalid texture type" );
-
- /*
- * if we set the texture OK, and it's a environment map, and
- * there is no environment map yet, allocate one (code borrowed
- * from texture_panel_envmap() in source/blender/src/buttons_shading.c)
- */
-
- if( self->texture->type == TEX_ENVMAP
- && !self->texture->env ) {
- self->texture->env = BKE_add_envmap();
- self->texture->env->object= OBACT;
- }
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Texture_oldsetExtend( BPy_Texture * self, PyObject * args )
-{
- char *extend = NULL;
- if( !PyArg_ParseTuple( args, "s", &extend ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument" );
-
- if( !EXPP_map_getShortVal
- ( tex_extend_map, extend, &self->texture->extend ) )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "invalid extend mode" );
-
- Py_RETURN_NONE;
-}
-
-/*
- * Texture_oldsetNoiseBasis(), Texture_oldsetDistNoise()
- * Texture_oldsetSType(), Texture_oldsetDistMetric(),
- * Texture_oldsetImageFlags()
- *
- * these old setter methods behave differently from the attribute
- * setters, so they are left unchanged.
- */
-
-static PyObject *Texture_oldsetNoiseBasis( BPy_Texture * self, PyObject * args )
-{
-/* NOTE: leave as-is: don't use setterWrapper */
- char *nbasis;
-
- if( !PyArg_ParseTuple( args, "s", &nbasis ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument" );
- if( self->texture->type == TEX_MUSGRAVE &&
- EXPP_map_getShortVal( tex_stype_map[TEX_DISTNOISE],
- nbasis, &self->texture->noisebasis ) );
- else if( self->texture->type == TEX_DISTNOISE &&
- !EXPP_map_getShortVal( tex_stype_map[TEX_DISTNOISE],
- nbasis, &self->texture->noisebasis2 ) )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "invalid noise basis" );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Texture_oldsetDistNoise( BPy_Texture * self, PyObject * args )
-{
-/* NOTE: leave as-is: don't use setterWrapper */
- char *nbasis;
-
- if( !PyArg_ParseTuple( args, "s", &nbasis ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument" );
- if( self->texture->type == TEX_DISTNOISE &&
- !EXPP_map_getShortVal( tex_stype_map[TEX_DISTNOISE],
- nbasis, &self->texture->noisebasis ) )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "invalid noise basis" );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Texture_oldsetSType( BPy_Texture * self, PyObject * args )
-{
- char *stype = NULL;
- if( !PyArg_ParseTuple( args, "s", &stype ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument" );
-
- /* can we really trust texture->type? */
- if( ( self->texture->type == TEX_VORONOI &&
- EXPP_map_getShortVal( tex_stype_map[self->texture->type],
- stype, &self->texture->vn_coltype ) ) );
-#if 0
- else if( ( self->texture->type == TEX_MUSGRAVE &&
- EXPP_map_getShortVal( tex_stype_map
- [TEX_DISTNOISE], stype,
- &self->texture->noisebasis ) ) );
-#endif
- else if( ( self->texture->type == TEX_ENVMAP &&
- EXPP_map_getShortVal( tex_stype_map[self->texture->type],
- stype, &self->texture->env->stype ) ) );
- else if( !EXPP_map_getShortVal
- ( tex_stype_map[self->texture->type], stype,
- &self->texture->stype ) )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "invalid texture stype" );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Texture_oldsetDistMetric( BPy_Texture * self, PyObject * args )
-{
-/* NOTE: leave as-is: don't use setterWrapper */
- char *dist = NULL;
-
- if( !PyArg_ParseTuple( args, "s", &dist ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument" );
- /* can we really trust texture->type? */
- if( self->texture->type == TEX_VORONOI &&
- !EXPP_map_getShortVal( tex_stype_map[self->texture->type + 2],
- dist, &self->texture->vn_distm ) )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "invalid dist metric type" );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Texture_oldsetImageFlags( BPy_Texture * self, PyObject * args )
-{
- unsigned int i, flag = 0;
-
- /* check that we're passed a tuple of no more than 3 args*/
-
- if( !PyTuple_Check( args ) )
- return EXPP_ReturnPyObjError ( PyExc_AttributeError,
- "expected tuple of string arguments" );
-
- /* check each argument for type, find its value */
-
- for( i = PyTuple_Size( args ); i-- ; ) {
- short thisflag;
- char * name = PyString_AsString( PyTuple_GET_ITEM( args, i ) );
- if( !name )
- return EXPP_ReturnPyObjError ( PyExc_AttributeError,
- "expected string argument" );
-
- if( !EXPP_map_getShortVal( tex_imageflag_map, name, &thisflag ) )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "unknown Texture image flag name" );
-
- flag |= thisflag;
- }
-
- self->texture->imaflag = (short)flag;
-
- Py_RETURN_NONE;
-}
-
-static PyObject *Texture_getColorband( BPy_Texture * self)
-{
- return EXPP_PyList_fromColorband( self->texture->coba );
-}
-
-int Texture_setColorband( BPy_Texture * self, PyObject * value)
-{
- return EXPP_Colorband_fromPyList( &self->texture->coba, value );
-}
-
-static PyObject *Texture_evaluate( BPy_Texture * self, PyObject * value )
-{
- TexResult texres= {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
- float vec[4];
- /* int rgbnor; dont use now */
-
- if (VectorObject_Check(value)) {
- if(((VectorObject *)value)->size < 3)
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "expects a 3D vector object or a tuple of 3 numbers");
-
- /* rgbnor = .. we don't need this now */
- multitex_ext(self->texture, ((VectorObject *)value)->vec, NULL, NULL, 1, &texres);
- } else {
- float vec_in[3];
- if (!PyTuple_Check(value) || PyTuple_Size(value) < 3)
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "expects a 3D vector object or a tuple of 3 numbers");
-
- vec_in[0] = PyFloat_AsDouble(PyTuple_GET_ITEM(value, 0));
- vec_in[1] = PyFloat_AsDouble(PyTuple_GET_ITEM(value, 1));
- vec_in[2] = PyFloat_AsDouble(PyTuple_GET_ITEM(value, 2));
- if (PyErr_Occurred())
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "expects a 3D vector object or a tuple of 3 numbers");
-
- multitex_ext(self->texture, vec_in, NULL, NULL, 1, &texres);
- }
- vec[0] = texres.tr;
- vec[1] = texres.tg;
- vec[2] = texres.tb;
- vec[3] = texres.tin;
-
- return newVectorObject(vec, 4, Py_NEW);
-}
-
-static PyObject *Texture_copy( BPy_Texture * self )
-{
- Tex *tex = copy_texture(self->texture );
- tex->id.us = 0;
- return Texture_CreatePyObject(tex);
-}
diff --git a/source/blender/python/api2_2x/Texture.h b/source/blender/python/api2_2x/Texture.h
deleted file mode 100644
index a00fe6faf94..00000000000
--- a/source/blender/python/api2_2x/Texture.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * $Id: Texture.h 10269 2007-03-15 01:09:14Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Alex Mole
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-/* based on Image.h */
-
-#ifndef EXPP_TEXTURE_H
-#define EXPP_TEXTURE_H
-
-#include <Python.h>
-#include "DNA_texture_types.h"
-
-/*****************************************************************************/
-/* Python BPy_Texture structure definition */
-/*****************************************************************************/
-
-typedef struct {
- PyObject_HEAD
- Tex * texture; /* libdata must be second */
-} BPy_Texture;
-
-extern PyTypeObject Texture_Type;
-
-#define BPy_Texture_Check(v) ((v)->ob_type == &Texture_Type)
-
-
-/*****************************************************************************/
-/* Module Blender.Texture - public functions */
-/*****************************************************************************/
-
-PyObject *Texture_Init( void );
-PyObject *Texture_CreatePyObject( struct Tex *tex );
-Tex *Texture_FromPyObject( PyObject * pyobj );
-
-
-#endif /* EXPP_TEXTURE_H */
diff --git a/source/blender/python/api2_2x/Types.c b/source/blender/python/api2_2x/Types.c
deleted file mode 100644
index 425584f84ac..00000000000
--- a/source/blender/python/api2_2x/Types.c
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * $Id: Types.c 11713 2007-08-19 19:06:42Z campbellbarton $
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano, Alex Mole, Joseph Gilbert
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#include "Types.h"
-#include "IDProp.h"
-/*
- stuff pasted from the old Types.h
- is only need here now
-*/
-
-extern PyTypeObject IDGroup_Type, IDArray_Type;
-extern PyTypeObject Action_Type, Armature_Type;
-extern PyTypeObject Pose_Type;
-extern PyTypeObject BezTriple_Type, Bone_Type, Button_Type;
-extern PyTypeObject Camera_Type;
-extern PyTypeObject CurNurb_Type, SurfNurb_Type;
-extern PyTypeObject Curve_Type;
-extern PyTypeObject Effect_Type, Font_Type;
-extern PyTypeObject Image_Type, Ipo_Type, IpoCurve_Type;
-extern PyTypeObject Lamp_Type, Lattice_Type;
-extern PyTypeObject Material_Type, Metaball_Type, MTex_Type;
-extern PyTypeObject NMFace_Type, NMEdge_Type, NMVert_Type, NMCol_Type,
- NMesh_Type;
-extern PyTypeObject MFace_Type, MVert_Type, PVert_Type, MEdge_Type, MCol_Type,
- Mesh_Type;
-
-extern PyTypeObject Object_Type;
-extern PyTypeObject Group_Type;
-extern PyTypeObject Particle_Type;
-extern PyTypeObject Scene_Type, RenderData_Type;
-extern PyTypeObject Text_Type, Text3d_Type, Texture_Type;
-extern PyTypeObject World_Type;
-extern PyTypeObject property_Type;
-extern PyTypeObject buffer_Type, constant_Type, euler_Type;
-extern PyTypeObject matrix_Type, quaternion_Type, rgbTuple_Type, vector_Type;
-extern PyTypeObject point_Type;
-extern PyTypeObject Modifier_Type, ModSeq_Type;
-extern PyTypeObject EditBone_Type;
-extern PyTypeObject ThemeSpace_Type;
-extern PyTypeObject ThemeUI_Type;
-extern PyTypeObject TimeLine_Type;
-
-char M_Types_doc[] = "The Blender Types module\n\n\
-This module is a dictionary of all Blender Python types";
-
-struct PyMethodDef Null_methods[] = { {NULL, NULL, 0, NULL} };
-
-
-
-/* The internal types (lowercase first letter, like constant_Type) are only
- * set when some object initializes them. But unless we do it early, we get
- * some easy and unpredictable (varies with platform, even distro) ways to
- * crash Blender. Some modules also need this early up, so let's generalize
- * and init all our pytypes here.
- */
-
-void types_InitAll( void )
-{
- Action_Type.ob_type = &PyType_Type;
- Pose_Type.ob_type = &PyType_Type;
- Armature_Type.ob_type = &PyType_Type;
- BezTriple_Type.ob_type = &PyType_Type;
- Bone_Type.ob_type = &PyType_Type;
- Button_Type.ob_type = &PyType_Type;
- Camera_Type.ob_type = &PyType_Type;
- CurNurb_Type.ob_type = &PyType_Type;
- Curve_Type.ob_type = &PyType_Type;
- Effect_Type.ob_type = &PyType_Type;
- Image_Type.ob_type = &PyType_Type;
- Ipo_Type.ob_type = &PyType_Type;
- IpoCurve_Type.ob_type = &PyType_Type;
- Lamp_Type.ob_type = &PyType_Type;
- Lattice_Type.ob_type = &PyType_Type;
- Material_Type.ob_type = &PyType_Type;
- Metaball_Type.ob_type = &PyType_Type;
- MTex_Type.ob_type = &PyType_Type;
- NMCol_Type.ob_type = &PyType_Type;
- NMFace_Type.ob_type = &PyType_Type;
- NMEdge_Type.ob_type = &PyType_Type;
- NMVert_Type.ob_type = &PyType_Type;
- NMesh_Type.ob_type = &PyType_Type;
- MFace_Type.ob_type = &PyType_Type;
- MVert_Type.ob_type = &PyType_Type;
- PVert_Type.ob_type = &PyType_Type;
- MEdge_Type.ob_type = &PyType_Type;
- MCol_Type.ob_type = &PyType_Type;
- Mesh_Type.ob_type = &PyType_Type;
- Object_Type.ob_type = &PyType_Type;
- Group_Type.ob_type = &PyType_Type;
- RenderData_Type.ob_type = &PyType_Type;
- Scene_Type.ob_type = &PyType_Type;
- SurfNurb_Type.ob_type = &PyType_Type;
- Text_Type.ob_type = &PyType_Type;
- Text3d_Type.ob_type = &PyType_Type;
- Texture_Type.ob_type = &PyType_Type;
- //TimeLine_Type.ob_type = &PyType_Type;
- World_Type.ob_type = &PyType_Type;
- buffer_Type.ob_type = &PyType_Type;
- constant_Type.ob_type = &PyType_Type;
- euler_Type.ob_type = &PyType_Type;
- matrix_Type.ob_type = &PyType_Type;
- quaternion_Type.ob_type = &PyType_Type;
- PyType_Ready( &rgbTuple_Type );
- vector_Type.ob_type = &PyType_Type;
- property_Type.ob_type = &PyType_Type;
- point_Type.ob_type = &PyType_Type;
- PyType_Ready( &Modifier_Type );
- PyType_Ready( &ModSeq_Type );
- PyType_Ready( &EditBone_Type );
- PyType_Ready( &ThemeSpace_Type );
- PyType_Ready( &ThemeUI_Type );
- IDProp_Init_Types();
-}
-
-/*****************************************************************************/
-/* Function: Types_Init */
-/*****************************************************************************/
-PyObject *Types_Init( void )
-{
- PyObject *submodule, *dict;
-
- submodule =
- Py_InitModule3( "Blender.Types", Null_methods, M_Types_doc );
-
- dict = PyModule_GetDict( submodule );
-
- /* The Blender Object Type */
-
- PyDict_SetItemString( dict, "ObjectType",
- ( PyObject * ) &Object_Type );
-
- /* Blender Object Data Types */
-
- PyDict_SetItemString( dict, "GroupType",
- ( PyObject * ) &Group_Type );
-
- PyDict_SetItemString( dict, "SceneType", ( PyObject * ) &Scene_Type );
- PyDict_SetItemString( dict, "RenderDataType",
- ( PyObject * ) &RenderData_Type );
-
- PyDict_SetItemString( dict, "NMeshType", ( PyObject * ) &NMesh_Type );
- PyDict_SetItemString( dict, "NMFaceType",
- ( PyObject * ) &NMFace_Type );
- PyDict_SetItemString( dict, "NMVertType",
- ( PyObject * ) &NMVert_Type );
- PyDict_SetItemString( dict, "NMEdgeType",
- ( PyObject * ) &NMEdge_Type );
- PyDict_SetItemString( dict, "NMColType", ( PyObject * ) &NMCol_Type );
-
- PyDict_SetItemString( dict, "MeshType", ( PyObject * ) &Mesh_Type );
- PyDict_SetItemString( dict, "MFaceType",
- ( PyObject * ) &MFace_Type );
- PyDict_SetItemString( dict, "MEdgeType",
- ( PyObject * ) &MEdge_Type );
- PyDict_SetItemString( dict, "MVertType",
- ( PyObject * ) &MVert_Type );
- PyDict_SetItemString( dict, "PVertType",
- ( PyObject * ) &PVert_Type );
- PyDict_SetItemString( dict, "MColType", ( PyObject * ) &MCol_Type );
-
- PyDict_SetItemString( dict, "ArmatureType",
- ( PyObject * ) &Armature_Type );
- PyDict_SetItemString( dict, "BoneType", ( PyObject * ) &Bone_Type );
-
- PyDict_SetItemString( dict, "CurNurb_Type",
- ( PyObject * ) &CurNurb_Type );
- PyDict_SetItemString( dict, "SurfNurb_Type",
- ( PyObject * ) &SurfNurb_Type );
- PyDict_SetItemString( dict, "CurveType", ( PyObject * ) &Curve_Type );
-
- PyDict_SetItemString( dict, "IpoType", ( PyObject * ) &Ipo_Type );
- PyDict_SetItemString( dict, "MetaballType",
- ( PyObject * ) &Metaball_Type );
-
- PyDict_SetItemString( dict, "CameraType",
- ( PyObject * ) &Camera_Type );
- PyDict_SetItemString( dict, "ImageType", ( PyObject * ) &Image_Type );
- PyDict_SetItemString( dict, "LampType", ( PyObject * ) &Lamp_Type );
- PyDict_SetItemString( dict, "TextType", ( PyObject * ) &Text_Type );
- PyDict_SetItemString( dict, "Text3dType", ( PyObject * ) &Text3d_Type );
- PyDict_SetItemString( dict, "MaterialType",
- ( PyObject * ) &Material_Type );
-
- PyDict_SetItemString( dict, "ButtonType",
- ( PyObject * ) &Button_Type );
-
- PyDict_SetItemString( dict, "LatticeType",
- ( PyObject * ) &Lattice_Type );
-
- PyDict_SetItemString( dict, "TextureType",
- ( PyObject * ) &Texture_Type );
- PyDict_SetItemString( dict, "MTexType", ( PyObject * ) &MTex_Type );
-
- /* External helper Types available to the main ones above */
-
- PyDict_SetItemString( dict, "vectorType",
- ( PyObject * ) &vector_Type );
- PyDict_SetItemString( dict, "bufferType",
- ( PyObject * ) &buffer_Type );
- PyDict_SetItemString( dict, "constantType",
- ( PyObject * ) &constant_Type );
- PyDict_SetItemString( dict, "rgbTupleType",
- ( PyObject * ) &rgbTuple_Type );
- PyDict_SetItemString( dict, "matrix_Type",
- ( PyObject * ) &matrix_Type );
- PyDict_SetItemString( dict, "eulerType", ( PyObject * ) &euler_Type );
- PyDict_SetItemString( dict, "quaternionType",
- ( PyObject * ) &quaternion_Type );
- PyDict_SetItemString( dict, "BezTripleType",
- ( PyObject * ) &BezTriple_Type );
- PyDict_SetItemString( dict, "ActionType",
- ( PyObject * ) &Action_Type );
- PyDict_SetItemString( dict, "PoseType",
- ( PyObject * ) &Pose_Type );
- PyDict_SetItemString( dict, "propertyType",
- ( PyObject * ) &property_Type );
- PyDict_SetItemString( dict, "pointType",
- ( PyObject * ) &point_Type );
- PyDict_SetItemString( dict, "ModifierType",
- ( PyObject * ) &Modifier_Type );
- PyDict_SetItemString( dict, "ModSeqType",
- ( PyObject * ) &ModSeq_Type );
- PyDict_SetItemString( dict, "EditBoneType",
- ( PyObject * ) &EditBone_Type);
- PyDict_SetItemString( dict, "ThemeSpaceType",
- ( PyObject * ) &ThemeSpace_Type);
- PyDict_SetItemString( dict, "ThemeUI_Type",
- ( PyObject * ) &ThemeUI_Type);
- PyDict_SetItemString( dict, "IDGroupType",
- ( PyObject * ) &IDGroup_Type);
- PyDict_SetItemString( dict, "IDArrayType",
- ( PyObject * ) &IDArray_Type);
- return submodule;
-}
diff --git a/source/blender/python/api2_2x/Window.c b/source/blender/python/api2_2x/Window.c
deleted file mode 100644
index 73edcb2df9c..00000000000
--- a/source/blender/python/api2_2x/Window.c
+++ /dev/null
@@ -1,1594 +0,0 @@
-/*
- * $Id: Window.c 12813 2007-12-07 09:51:02Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano, Tom Musgrove, Michael Reimpell,
- * Yann Vernier, Ken Hughes
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#include <Python.h>
-
-#include "BDR_editobject.h" /* enter / leave editmode */
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_object.h" /* for during_script() and during_scriptlink() */
-#include "BKE_scene.h" /* scene_find_camera() */
-#include "BPI_script.h"
-#include "BIF_mywindow.h"
-#include "BIF_imasel.h"
-#include "BSE_headerbuttons.h"
-#include "BSE_filesel.h"
-#include "BIF_editmesh.h" /* for undo_push_mesh() */
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_drawtext.h"
-#include "BIF_poseobject.h"
-#include "DNA_view3d_types.h"
-#include "DNA_space_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_text_types.h"
-#include "DNA_object_types.h"
-#include "mydevice.h"
-#include "blendef.h" /* OBACT */
-#include "windowTheme.h"
-#include "Mathutils.h"
-#include "constant.h"
-#include "gen_utils.h"
-#include "Armature.h"
-
-/* Pivot Types
--0 for Bounding Box Center; \n\
--1 for 3D Cursor\n\
--2 for Individual Centers\n\
--3 for Median Point\n\
--4 for Active Object"; */
-
-#define PIVOT_BOUNDBOX 0
-#define PIVOT_CURSOR 1
-#define PIVOT_INDIVIDUAL 2
-#define PIVOT_MEDIAN 3
-#define PIVOT_ACTIVE 4
-
-/* See Draw.c */
-extern int EXPP_disable_force_draw;
-extern void setcameratoview3d(void);
-
-/*****************************************************************************/
-/* Python API function prototypes for the Window module. */
-/*****************************************************************************/
-PyObject *M_Window_Redraw( PyObject * self, PyObject * args );
-static PyObject *M_Window_RedrawAll( PyObject * self, PyObject * args );
-static PyObject *M_Window_QRedrawAll( PyObject * self, PyObject * args );
-static PyObject *M_Window_DrawProgressBar( PyObject * self, PyObject * args );
-static PyObject *M_Window_GetCursorPos( PyObject * self );
-static PyObject *M_Window_SetCursorPos( PyObject * self, PyObject * args );
-static PyObject *M_Window_WaitCursor( PyObject * self, PyObject * args );
-static PyObject *M_Window_GetViewVector( PyObject * self );
-static PyObject *M_Window_GetActiveLayer( PyObject * self );
-static PyObject *M_Window_SetActiveLayer( PyObject * self, PyObject * args );
-static PyObject *M_Window_GetViewQuat( PyObject * self );
-static PyObject *M_Window_SetViewQuat( PyObject * self, PyObject * args );
-static PyObject *M_Window_GetViewOffset( PyObject * self );
-static PyObject *M_Window_SetViewOffset( PyObject * self, PyObject * args );
-static PyObject *M_Window_GetViewMatrix( PyObject * self );
-static PyObject *M_Window_GetPerspMatrix( PyObject * self );
-static PyObject *M_Window_FileSelector( PyObject * self, PyObject * args );
-static PyObject *M_Window_ImageSelector( PyObject * self, PyObject * args );
-static PyObject *M_Window_EditMode( PyObject * self, PyObject * args );
-static PyObject *M_Window_PoseMode( PyObject * self, PyObject * args );
-static PyObject *M_Window_ViewLayers( PyObject * self, PyObject * args );
-static PyObject *M_Window_CameraView( PyObject * self, PyObject * args );
-static PyObject *M_Window_QTest( PyObject * self );
-static PyObject *M_Window_QRead( PyObject * self );
-static PyObject *M_Window_QAdd( PyObject * self, PyObject * args );
-static PyObject *M_Window_QHandle( PyObject * self, PyObject * args );
-static PyObject *M_Window_GetMouseCoords( PyObject * self );
-static PyObject *M_Window_SetMouseCoords( PyObject * self, PyObject * args );
-static PyObject *M_Window_GetMouseButtons( PyObject * self );
-static PyObject *M_Window_GetKeyQualifiers( PyObject * self );
-static PyObject *M_Window_SetKeyQualifiers( PyObject * self, PyObject * args );
-static PyObject *M_Window_GetAreaSize( PyObject * self );
-static PyObject *M_Window_GetAreaID( PyObject * self );
-static PyObject *M_Window_GetScreenSize( PyObject * self );
-static PyObject *M_Window_GetScreens( PyObject * self );
-static PyObject *M_Window_SetScreen( PyObject * self, PyObject * value );
-static PyObject *M_Window_GetScreenInfo( PyObject * self, PyObject * args,
- PyObject * kwords );
-static PyObject *M_Window_GetPivot( PyObject * self );
-static PyObject *M_Window_SetPivot( PyObject * self, PyObject * value );
-
-PyObject *Window_Init( void );
-
-
-/*****************************************************************************/
-/* The following string definitions are used for documentation strings. */
-/* In Python these will be written to the console when doing a */
-/* Blender.Window.__doc__ */
-/*****************************************************************************/
-static char M_Window_doc[] = "The Blender Window module\n\n";
-
-static char M_Window_Redraw_doc[] =
- "() - Force a redraw of a specific Window Type (see Window.Types)";
-
-static char M_Window_RedrawAll_doc[] = "() - Redraw all windows";
-
-static char M_Window_QRedrawAll_doc[] =
- "() - Redraw all windows by queue event";
-
-static char M_Window_FileSelector_doc[] =
- "(callback [, title, filename]) - Open a file selector window.\n\
-The selected file name is used as argument to a function callback f(name)\n\
-that you must provide. 'title' is optional and defaults to 'SELECT FILE'.\n\
-'filename' is optional and defaults to Blender.Get('filename').\n\n\
-Example:\n\n\
-import Blender\n\n\
-def my_function(filename):\n\
- print 'The selected file was: ', filename\n\n\
-Blender.Window.FileSelector(my_function, 'SAVE FILE')\n";
-
-static char M_Window_ImageSelector_doc[] =
- "(callback [, title, filename]) - Open an image selector window.\n\
-The selected file name is used as argument to a function callback f(name)\n\
-that you must provide. 'title' is optional and defaults to 'SELECT IMAGE'.\n\
-'filename' is optional and defaults to Blender.Get('filename').\n\n\
-Example:\n\n\
-import Blender\n\n\
-def my_function(filename):\n\
- print 'The selected image file was: ', filename\n\n\
-Blender.Window.ImageSelector(my_function, 'LOAD IMAGE')\n";
-
-static char M_Window_DrawProgressBar_doc[] =
- "(done, text) - Draw a progress bar.\n\
-'done' is a float value <= 1.0, 'text' contains info about what is\n\
-currently being done.";
-
-static char M_Window_GetCursorPos_doc[] =
- "() - Get the current 3d cursor position as a list of three floats.";
-
-static char M_Window_SetCursorPos_doc[] =
- "([f,f,f]) - Set the current 3d cursor position from a list of three floats.";
-
-static char M_Window_WaitCursor_doc[] =
- "(bool) - Set cursor to wait mode (nonzero bool) or normal mode (0).";
-
-static char M_Window_GetViewVector_doc[] =
- "() - Get the current 3d view vector as a list of three floats [x,y,z].";
-
-static char M_Window_GetActiveLayer_doc[] =
- "() - Get the current 3d views active layer where new objects are created.";
-
-static char M_Window_SetActiveLayer_doc[] =
- "(int) - Set the current 3d views active layer where new objects are created.";
-
-static char M_Window_GetViewMatrix_doc[] =
- "() - Get the current 3d view matrix.";
-
-static char M_Window_GetPerspMatrix_doc[] =
- "() - Get the current 3d Persp matrix.";
-
-static char M_Window_EditMode_doc[] =
- "() - Get the current status -- 0: not in edit mode; 1: in edit mode.\n\
-(status) - if 1: enter edit mode; if 0: leave edit mode.\n\
-Returns the current status. This function is mostly useful to leave\n\
-edit mode before applying changes to a mesh (otherwise the changes will\n\
-be lost) and then returning to it upon leaving.";
-static char M_Window_PoseMode_doc[] =
- "() - Get the current status -- 0: not in pose mode; 1: in edit mode";
-
-static char M_Window_ViewLayers_doc[] =
- "(layers = [], winid = None) - Get/set active layers in all 3d View windows.\n\
-() - Make no changes, only return currently visible layers.\n\
-(layers = []) - a list of integers, each in the range [1, 20].\n\
-(layers = [], winid = int) - layers as above, winid is an optional.\n\
-arg that makes the function only set layers for that view.\n\
-This function returns the currently visible layers as a list of ints.";
-
-static char M_Window_GetViewQuat_doc[] =
- "() - Get the current VIEW3D view quaternion values.";
-
-static char M_Window_SetViewQuat_doc[] =
- "(quat) - Set the current VIEW3D view quaternion values.\n\
-(quat) - [f,f,f,f] or f,f,f,f: the new float values.";
-
-static char M_Window_GetViewOffset_doc[] =
- "() - Get the current VIEW3D view offset values.";
-
-static char M_Window_SetViewOffset_doc[] =
- "(ofs) - Set the current VIEW3D view offset values.\n\
-(ofs) - [f,f,f] or f,f,f: the new float values.";
-
-static char M_Window_CameraView_doc[] =
- "(camtov3d = 0) - Set the current VIEW3D view to the active camera's view.\n\
-(camtov3d = 0) - bool: if nonzero it's the camera that gets positioned at the\n\
-current view, instead of the view being changed to that of the camera.\n\n\
-If no camera is the active object, the active camera for the current scene\n\
-is used.";
-
-static char M_Window_QTest_doc[] =
- "() - Check if there are pending events in the event queue.";
-
-static char M_Window_QRead_doc[] =
- "() - Get the next pending event from the event queue.\n\
-This function returns a list [event, val], where:\n\
-event - int: the key or mouse event (see Blender.Draw module);\n\
-val - int: if 1 it's a key or mouse button press, if 0 a release. For\n\
- mouse movement events 'val' returns the new coordinates in x or y.";
-
-static char M_Window_QAdd_doc[] =
- "(win, evt, val, after = 0) - Add an event to some window's event queue.\n\
-(win) - int: the win id, see Blender.Window.GetScreenInfo();\n\
-(evt) - int: the event number, see events in Blender.Draw;\n\
-(val) - bool: 1 for a key press, 0 for a release;\n\
-(after) - bool: if 1 the event is put after the current queue and added later.";
-
-static char M_Window_QHandle_doc[] =
- "(win) - Process all events for the given window (area) now.\n\
-(win) - int: the window id, see Blender.Window.GetScreenInfo().\n\n\
-See Blender.Window.QAdd() for how to send events to a particular window.";
-
-static char M_Window_GetMouseCoords_doc[] =
- "() - Get mouse pointer's current screen coordinates.";
-
-static char M_Window_SetMouseCoords_doc[] =
- "(x, y) - Set mouse pointer's current screen coordinates.\n\
-(x,y) - ints ([x, y] also accepted): the new x, y coordinates.";
-
-static char M_Window_GetMouseButtons_doc[] =
- "() - Get the current mouse button state (see Blender.Window.MButs dict).";
-
-static char M_Window_GetKeyQualifiers_doc[] =
- "() - Get the current qualifier keys state.\n\
-An int is returned: or'ed combination of values in Blender.Window.Qual's dict.";
-
-static char M_Window_SetKeyQualifiers_doc[] =
- "(qual) - Fake qualifier keys state.\n\
-(qual) - int: an or'ed combination of the values in Blender.Window.Qual dict.\n\
-Note: remember to reset to 0 after handling the related event (see QAdd()).";
-
-static char M_Window_GetAreaID_doc[] =
- "() - Get the current window's (area) ID.";
-
-static char M_Window_GetAreaSize_doc[] =
- "() - Get the current window's (area) size as [width, height].";
-
-static char M_Window_GetScreenSize_doc[] =
- "() - Get the screen's size as [width, height].";
-
-static char M_Window_GetScreens_doc[] =
- "() - Get a list with the names of all available screens.";
-
-static char M_Window_SetScreen_doc[] =
- "(name) - Set current screen to the one with the given 'name'.";
-
-static char M_Window_GetScreenInfo_doc[] =
- "(type = -1, rect = 'win', screen = None)\n\
-- Get info about the the areas in the current screen setup.\n\
-(type = -1) - int: the space type (Blender.Window.Types) to restrict the\n\
- results to, all if -1;\n\
-(rect = 'win') - str: the rectangle of interest. This defines if the corner\n\
- coordinates returned will refer to:\n\
- - the whole area: 'total';\n\
- - only the header: 'header';\n\
- - only the window content (default): 'win'.\n\
-(screen = None) - str: the screen name, current if not given.\n\n\
-A list of dictionaries (one for each area) is returned.\n\
-Each dictionary has keys:\n\
-'vertices': [xmin, ymin, xmax, ymax] area corners;\n\
-'win': window type, see Blender.Window.Types dict;\n\
-'id': area's id.";
-
-static char M_Window_SetPivot_doc[] =
- "(Pivot) - Set Pivot Mode for 3D Viewport:\n\
-Options are: \n\
--PivotTypes.BOUNDBOX for Bounding Box Center; \n\
--PivotTypes.CURSOR for 3D Cursor\n\
--PivotTypes.INDIVIDUAL for Individual Centers\n\
--PivotTypes.MEDIAN for Median Point\n\
--PivotTypes.ACTIVE for Active Object";
-
-static char M_Window_GetPivot_doc[] =
- "Return the pivot for the active 3d window";
-
-/*****************************************************************************/
-/* Python method structure definition for Blender.Window module: */
-/*****************************************************************************/
-struct PyMethodDef M_Window_methods[] = {
- {"Redraw", M_Window_Redraw, METH_VARARGS, M_Window_Redraw_doc},
- {"RedrawAll", M_Window_RedrawAll, METH_VARARGS,
- M_Window_RedrawAll_doc},
- {"QRedrawAll", M_Window_QRedrawAll, METH_VARARGS,
- M_Window_QRedrawAll_doc},
- {"FileSelector", M_Window_FileSelector, METH_VARARGS,
- M_Window_FileSelector_doc},
- {"ImageSelector", ( PyCFunction ) M_Window_ImageSelector, METH_VARARGS,
- M_Window_ImageSelector_doc},
- {"DrawProgressBar", M_Window_DrawProgressBar, METH_VARARGS,
- M_Window_DrawProgressBar_doc},
- {"drawProgressBar", M_Window_DrawProgressBar, METH_VARARGS,
- M_Window_DrawProgressBar_doc},
- {"GetCursorPos", ( PyCFunction ) M_Window_GetCursorPos, METH_NOARGS,
- M_Window_GetCursorPos_doc},
- {"SetCursorPos", M_Window_SetCursorPos, METH_VARARGS,
- M_Window_SetCursorPos_doc},
- {"WaitCursor", M_Window_WaitCursor, METH_VARARGS,
- M_Window_WaitCursor_doc},
- {"GetViewVector", ( PyCFunction ) M_Window_GetViewVector, METH_NOARGS,
- M_Window_GetViewVector_doc},
- {"GetActiveLayer", ( PyCFunction ) M_Window_GetActiveLayer, METH_NOARGS,
- M_Window_GetActiveLayer_doc},
- {"SetActiveLayer", ( PyCFunction ) M_Window_SetActiveLayer, METH_VARARGS,
- M_Window_SetActiveLayer_doc},
- {"GetViewQuat", ( PyCFunction ) M_Window_GetViewQuat, METH_NOARGS,
- M_Window_GetViewQuat_doc},
- {"SetViewQuat", ( PyCFunction ) M_Window_SetViewQuat, METH_VARARGS,
- M_Window_SetViewQuat_doc},
- {"GetViewOffset", ( PyCFunction ) M_Window_GetViewOffset, METH_NOARGS,
- M_Window_GetViewOffset_doc},
- {"SetViewOffset", ( PyCFunction ) M_Window_SetViewOffset, METH_VARARGS,
- M_Window_SetViewOffset_doc},
- {"GetViewMatrix", ( PyCFunction ) M_Window_GetViewMatrix, METH_NOARGS,
- M_Window_GetViewMatrix_doc},
- {"GetPerspMatrix", ( PyCFunction ) M_Window_GetPerspMatrix, METH_NOARGS,
- M_Window_GetPerspMatrix_doc},
- {"EditMode", ( PyCFunction ) M_Window_EditMode, METH_VARARGS,
- M_Window_EditMode_doc},
- {"PoseMode", ( PyCFunction ) M_Window_PoseMode, METH_VARARGS,
- M_Window_PoseMode_doc},
- {"ViewLayers", ( PyCFunction ) M_Window_ViewLayers, METH_VARARGS,
- M_Window_ViewLayers_doc},
- /* typo, deprecate someday: */
- {"ViewLayer", ( PyCFunction ) M_Window_ViewLayers, METH_VARARGS,
- M_Window_ViewLayers_doc},
- {"CameraView", ( PyCFunction ) M_Window_CameraView, METH_VARARGS,
- M_Window_CameraView_doc},
- {"QTest", ( PyCFunction ) M_Window_QTest, METH_NOARGS,
- M_Window_QTest_doc},
- {"QRead", ( PyCFunction ) M_Window_QRead, METH_NOARGS,
- M_Window_QRead_doc},
- {"QAdd", ( PyCFunction ) M_Window_QAdd, METH_VARARGS,
- M_Window_QAdd_doc},
- {"QHandle", ( PyCFunction ) M_Window_QHandle, METH_VARARGS,
- M_Window_QHandle_doc},
- {"GetMouseCoords", ( PyCFunction ) M_Window_GetMouseCoords,
- METH_NOARGS,
- M_Window_GetMouseCoords_doc},
- {"SetMouseCoords", ( PyCFunction ) M_Window_SetMouseCoords,
- METH_VARARGS,
- M_Window_SetMouseCoords_doc},
- {"GetMouseButtons", ( PyCFunction ) M_Window_GetMouseButtons,
- METH_NOARGS,
- M_Window_GetMouseButtons_doc},
- {"GetKeyQualifiers", ( PyCFunction ) M_Window_GetKeyQualifiers,
- METH_NOARGS,
- M_Window_GetKeyQualifiers_doc},
- {"SetKeyQualifiers", ( PyCFunction ) M_Window_SetKeyQualifiers,
- METH_VARARGS,
- M_Window_SetKeyQualifiers_doc},
- {"GetAreaSize", ( PyCFunction ) M_Window_GetAreaSize, METH_NOARGS,
- M_Window_GetAreaSize_doc},
- {"GetAreaID", ( PyCFunction ) M_Window_GetAreaID, METH_NOARGS,
- M_Window_GetAreaID_doc},
- {"GetScreenSize", ( PyCFunction ) M_Window_GetScreenSize, METH_NOARGS,
- M_Window_GetScreenSize_doc},
- {"GetScreens", ( PyCFunction ) M_Window_GetScreens, METH_NOARGS,
- M_Window_GetScreens_doc},
- {"SetScreen", ( PyCFunction ) M_Window_SetScreen, METH_O,
- M_Window_SetScreen_doc},
- {"GetScreenInfo", ( PyCFunction ) M_Window_GetScreenInfo,
- METH_VARARGS | METH_KEYWORDS, M_Window_GetScreenInfo_doc},
- {"GetPivot", ( PyCFunction ) M_Window_GetPivot, METH_NOARGS,
- M_Window_GetPivot_doc},
- {"SetPivot", ( PyCFunction ) M_Window_SetPivot, METH_O,
- M_Window_SetPivot_doc},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Function: M_Window_Redraw */
-/* Python equivalent: Blender.Window.Redraw */
-/*****************************************************************************/
-/* not static so py_slider_update in Draw.[ch] can use it */
-PyObject *M_Window_Redraw( PyObject * self, PyObject * args )
-{
- ScrArea *tempsa, *sa;
- int wintype = SPACE_VIEW3D;
- short redraw_all = 0;
-
- if( !PyArg_ParseTuple( args, "|i", &wintype ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected int argument (or nothing)" ) );
-
- if( wintype < 0 )
- redraw_all = 1;
-
- if( !during_script( ) && !G.background ) {
- tempsa = curarea;
- sa = G.curscreen->areabase.first;
-
- while( sa ) {
-
- if( sa->spacetype == wintype || redraw_all ) {
- if (sa->spacetype == SPACE_SCRIPT && EXPP_disable_force_draw) {
- scrarea_queue_redraw(sa);
- }
- else {
- /* do not call fancy hacks here like pop_space_text(st); (ton) */
- scrarea_do_windraw( sa );
- if( sa->headwin ) scrarea_do_headdraw( sa );
- }
- }
- sa = sa->next;
- }
-
- if( curarea != tempsa )
- areawinset( tempsa->win );
-
- if( curarea ) { /* is null if Blender is in bg mode */
- if( curarea->headwin )
- scrarea_do_headdraw( curarea );
- screen_swapbuffers( );
- }
- }
-
- Py_RETURN_NONE;
-}
-
-/*****************************************************************************/
-/* Function: M_Window_RedrawAll */
-/* Python equivalent: Blender.Window.RedrawAll */
-/*****************************************************************************/
-static PyObject *M_Window_RedrawAll( PyObject * self, PyObject * args )
-{
- PyObject *arg = Py_BuildValue( "(i)", -1 );
- PyObject *ret = M_Window_Redraw( self, arg );
- Py_DECREF(arg);
- return ret;
-}
-
-/*****************************************************************************/
-/* Function: M_Window_QRedrawAll */
-/* Python equivalent: Blender.Window.QRedrawAll */
-/*****************************************************************************/
-static PyObject *M_Window_QRedrawAll( PyObject * self, PyObject * args )
-{
- EXPP_allqueue( REDRAWALL, 0 );
- Py_RETURN_NONE;
-}
-
-/*****************************************************************************/
-/* Function: M_Window_FileSelector */
-/* Python equivalent: Blender.Window.FileSelector */
-/*****************************************************************************/
-
-/* This is the callback to "activate_fileselect" below. It receives the
- * selected filename and (using it as argument) calls the Python callback
- * provided by the script writer and stored in EXPP_FS_PyCallback. */
-
-static void getSelectedFile( char *name )
-{
- PyObject *pycallback;
- PyObject *result;
- Script *script;
-
- /* let's find the script that owns this callback */
- script = G.main->script.first;
- while (script) {
- if (script->flags & SCRIPT_RUNNING) break;
- script = script->id.next;
- }
-
- if (!script) {
- if (curarea->spacetype == SPACE_SCRIPT) {
- SpaceScript *sc = curarea->spacedata.first;
- script = sc->script;
- }
- }
-
- pycallback = script->py_browsercallback;
-
- if (pycallback) {
- result = PyObject_CallFunction( pycallback, "s", name );
-
- if (!result) {
- if (G.f & G_DEBUG)
- fprintf(stderr, "BPy error: Callback call failed!\n");
- }
- else Py_DECREF(result);
-
- if (script->py_browsercallback == pycallback)
- script->py_browsercallback = NULL;
- /* else another call to selector was made inside pycallback */
-
- Py_DECREF(pycallback);
- }
-
- return;
-}
-
-static PyObject *M_Window_FileSelector( PyObject * self, PyObject * args )
-{
- char *title = "SELECT FILE";
- char *filename = G.sce;
- SpaceScript *sc;
- Script *script = NULL;
- PyObject *pycallback = NULL;
- int startspace = 0;
-
- if (during_scriptlink())
- return EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "script links can't call the file selector");
-
- if (G.background)
- return EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "the file selector is not available in background mode");
-
- if((!PyArg_ParseTuple( args, "O|ss", &pycallback, &title, &filename))
- || (!PyCallable_Check(pycallback)))
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "\nexpected a callback function (and optionally one or two strings) "
- "as argument(s)" );
-
- Py_INCREF(pycallback);
-
-/* trick: we move to a spacescript because then the fileselector will properly
- * unset our SCRIPT_FILESEL flag when the user chooses a file or cancels the
- * selection. This is necessary because when a user cancels, the
- * getSelectedFile function above doesn't get called and so couldn't unset the
- * flag. */
- startspace = curarea->spacetype;
- if( startspace != SPACE_SCRIPT )
- newspace( curarea, SPACE_SCRIPT );
-
- sc = curarea->spacedata.first;
-
- /* let's find the script that called us */
- script = G.main->script.first;
- while (script) {
- if (script->flags & SCRIPT_RUNNING) break;
- script = script->id.next;
- }
-
- if( !script ) {
- /* if not running, then we were already on a SpaceScript space, executing
- * a registered callback -- aka: this script has a gui */
- script = sc->script; /* this is the right script */
- } else { /* still running, use the trick */
- script->lastspace = startspace;
- sc->script = script;
- }
-
- script->flags |= SCRIPT_FILESEL;
-
- /* clear any previous callback (nested calls to selector) */
- if (script->py_browsercallback) {
- Py_DECREF((PyObject *)script->py_browsercallback);
- }
- script->py_browsercallback = pycallback;
-
- activate_fileselect( FILE_BLENDER, title, filename, getSelectedFile );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *M_Window_ImageSelector( PyObject * self, PyObject * args )
-{
- char *title = "SELECT IMAGE";
- char *filename = G.sce;
- SpaceScript *sc;
- Script *script = NULL;
- PyObject *pycallback = NULL;
- int startspace = 0;
-
- if (during_scriptlink())
- return EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "script links can't call the image selector");
-
- if (G.background)
- return EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "the image selector is not available in background mode");
-
- if( !PyArg_ParseTuple( args, "O|ss", &pycallback, &title, &filename )
- || (!PyCallable_Check(pycallback)))
- return EXPP_ReturnPyObjError ( PyExc_AttributeError,
- "\nexpected a callback function (and optionally one or two strings) "
- "as argument(s)" );
-
- Py_INCREF(pycallback);
-
-/* trick: we move to a spacescript because then the fileselector will properly
- * unset our SCRIPT_FILESEL flag when the user chooses a file or cancels the
- * selection. This is necessary because when a user cancels, the
- * getSelectedFile function above doesn't get called and so couldn't unset the
- * flag. */
- startspace = curarea->spacetype;
- if( startspace != SPACE_SCRIPT )
- newspace( curarea, SPACE_SCRIPT );
-
- sc = curarea->spacedata.first;
-
- /* let's find the script that called us */
- script = G.main->script.first;
- while (script) {
- if (script->flags & SCRIPT_RUNNING) break;
- script = script->id.next;
- }
-
- if( !script ) {
- /* if not running, then we were already on a SpaceScript space, executing
- * a registered callback -- aka: this script has a gui */
- script = sc->script; /* this is the right script */
- } else { /* still running, use the trick */
- script->lastspace = startspace;
- sc->script = script;
- }
-
- script->flags |= SCRIPT_FILESEL; /* same flag as filesel */
- /* clear any previous callback (nested calls to selector) */
- if (script->py_browsercallback) {
- Py_DECREF((PyObject *)script->py_browsercallback);
- }
- script->py_browsercallback = pycallback;
-
- activate_imageselect( FILE_BLENDER, title, filename, getSelectedFile );
-
- Py_RETURN_NONE;
-}
-
-/*****************************************************************************/
-/* Function: M_Window_DrawProgressBar */
-/* Python equivalent: Blender.Window.DrawProgressBar */
-/*****************************************************************************/
-static PyObject *M_Window_DrawProgressBar( PyObject * self, PyObject * args )
-{
- float done;
- char *info = NULL;
- int retval = 0;
- ScrArea *sa = curarea;
-
- if (G.background)
- return EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "the progress bar is not available in background mode");
-
- if( !PyArg_ParseTuple( args, "fs", &done, &info ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected a float and a string as arguments" ) );
-
- retval = progress_bar( done, info );
-
- areawinset(sa->win);
-
- return Py_BuildValue( "i", retval );
-}
-
-/*****************************************************************************/
-/* Function: M_Window_GetCursorPos */
-/* Python equivalent: Blender.Window.GetCursorPos */
-/*****************************************************************************/
-static PyObject *M_Window_GetCursorPos( PyObject * self )
-{
- float *cursor = NULL;
- PyObject *pylist;
-
- if( G.vd && G.vd->localview )
- cursor = G.vd->cursor;
- else
- cursor = G.scene->cursor;
-
- pylist = Py_BuildValue( "[fff]", cursor[0], cursor[1], cursor[2] );
-
- if( !pylist )
- return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
- "GetCursorPos: couldn't create pylist" ) );
-
- return pylist;
-}
-
-/*****************************************************************************/
-/* Function: M_Window_SetCursorPos */
-/* Python equivalent: Blender.Window.SetCursorPos */
-/*****************************************************************************/
-static PyObject *M_Window_SetCursorPos( PyObject * self, PyObject * args )
-{
- int ok = 0;
- float val[3];
-
- if( PyObject_Length( args ) == 3 )
- ok = PyArg_ParseTuple( args, "fff", &val[0], &val[1],
- &val[2] );
- else
- ok = PyArg_ParseTuple( args, "(fff)", &val[0], &val[1],
- &val[2] );
-
- if( !ok )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected [f,f,f] or f,f,f as arguments" );
-
- if( G.vd && G.vd->localview ) {
- G.vd->cursor[0] = val[0];
- G.vd->cursor[1] = val[1];
- G.vd->cursor[2] = val[2];
- } else {
- G.scene->cursor[0] = val[0];
- G.scene->cursor[1] = val[1];
- G.scene->cursor[2] = val[2];
- }
-
- Py_RETURN_NONE;
-}
-
-static PyObject *M_Window_WaitCursor( PyObject * self, PyObject * args )
-{
- int bool;
-
- if( !PyArg_ParseTuple( args, "i", &bool ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected bool (0 or 1) or nothing as argument" );
-
- waitcursor( bool ); /* nonzero bool sets, zero unsets */
-
- Py_RETURN_NONE;
-}
-
-/*****************************************************************************/
-/* Function: M_Window_GetViewVector */
-/* Python equivalent: Blender.Window.GetViewVector */
-/*****************************************************************************/
-static PyObject *M_Window_GetViewVector( PyObject * self )
-{
- float *vec = NULL;
-
- if( !G.vd )
- Py_RETURN_NONE;
-
- vec = G.vd->viewinv[2];
-
- return Py_BuildValue( "[fff]", vec[0], vec[1], vec[2] );
-}
-
-/*****************************************************************************/
-/* Function: M_Window_GetActiveLayer */
-/* Python equivalent: Blender.Window.GetActiveLayer */
-/*****************************************************************************/
-static PyObject *M_Window_GetActiveLayer( PyObject * self )
-{
- if (!G.vd) {
- return PyInt_FromLong(0);
- } else {
- return PyInt_FromLong( G.vd->layact );
- }
-}
-
-static PyObject *M_Window_SetActiveLayer( PyObject * self, PyObject * args )
-{
- int layer, bit=1;
- if( !PyArg_ParseTuple( args, "i", &layer ) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected an int" ) );
-
- if (!G.vd)
- Py_RETURN_FALSE;
-
- bit= 0;
- while(bit<32) {
- if(layer & (1<<bit)) {
- G.vd->layact= 1<<bit;
- G.vd->lay |= G.vd->layact;
-
- if (G.vd->scenelock) {
- G.scene->lay |= G.vd->layact;
- }
- bit = -1; /* no error */
- break;
- }
- bit++;
- }
-
- if (bit != -1)
- return ( EXPP_ReturnPyObjError( PyExc_ValueError,
- "The flag could not be used for the active layer" ) );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *M_Window_GetViewQuat( PyObject * self )
-{
- float *vec = NULL;
-
- if( !G.vd )
- Py_RETURN_NONE;
-
- vec = G.vd->viewquat;
-
- return Py_BuildValue( "[ffff]", vec[0], vec[1], vec[2], vec[3] );
-}
-
-static PyObject *M_Window_SetViewQuat( PyObject * self, PyObject * args )
-{
- int ok = 0;
- float val[4];
-
- if( !G.vd )
- Py_RETURN_NONE;
-
- if( PyObject_Length( args ) == 4 )
- ok = PyArg_ParseTuple( args, "ffff", &val[0], &val[1], &val[2],
- &val[3] );
- else
- ok = PyArg_ParseTuple( args, "(ffff)", &val[0], &val[1],
- &val[2], &val[3] );
-
- if( !ok )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected [f,f,f,f] or f,f,f,f as arguments" );
-
- G.vd->viewquat[0] = val[0];
- G.vd->viewquat[1] = val[1];
- G.vd->viewquat[2] = val[2];
- G.vd->viewquat[3] = val[3];
-
- Py_RETURN_NONE;
-}
-
-static PyObject *M_Window_GetViewOffset( PyObject * self )
-{
- if( !G.vd )
- Py_RETURN_NONE;
- return Py_BuildValue( "[fff]", G.vd->ofs[0], G.vd->ofs[1], G.vd->ofs[2] );
-}
-
-static PyObject *M_Window_SetViewOffset( PyObject * self, PyObject * args )
-{
- int ok = 0;
- float val[3];
-
- if( !G.vd )
- Py_RETURN_NONE;
-
- if( PyObject_Length( args ) == 3 )
- ok = PyArg_ParseTuple( args, "fff", &val[0], &val[1],
- &val[2] );
- else
- ok = PyArg_ParseTuple( args, "(fff)", &val[0], &val[1],
- &val[2] );
-
- if( !ok )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected [f,f,f] or f,f,f as arguments" );
-
- G.vd->ofs[0] = val[0];
- G.vd->ofs[1] = val[1];
- G.vd->ofs[2] = val[2];
-
- Py_RETURN_NONE;
-}
-
-
-/*****************************************************************************/
-/* Function: M_Window_GetViewMatrix */
-/* Python equivalent: Blender.Window.GetViewMatrix */
-/*****************************************************************************/
-static PyObject *M_Window_GetViewMatrix( PyObject * self )
-{
- if( !G.vd )
- Py_RETURN_NONE;
-
- return newMatrixObject( ( float * ) G.vd->viewmat, 4, 4, Py_WRAP );
-}
-
-/*****************************************************************************/
-/* Function: M_Window_GetPerspMatrix */
-/* Python equivalent: Blender.Window.GetPerspMatrix */
-/*****************************************************************************/
-static PyObject *M_Window_GetPerspMatrix( PyObject * self )
-{
- if( !G.vd )
- Py_RETURN_NONE;
-
- return newMatrixObject( ( float * ) G.vd->persmat, 4, 4, Py_WRAP );
-}
-
-
-/* update_armature_weakrefs()
- * helper function used in M_Window_EditMode.
- * rebuilds list of Armature weakrefs in __main__
- */
-
-static int update_armature_weakrefs()
-{
- /* stuff for armature weak refs */
- char *list_name = ARM_WEAKREF_LIST_NAME;
- PyObject *maindict = NULL, *armlist = NULL;
- PyObject *pyarmature = NULL;
- int x;
-
- maindict= PyModule_GetDict(PyImport_AddModule( "__main__"));
- armlist = PyDict_GetItemString(maindict, list_name);
- if( !armlist){
- printf("Oops - update_armature_weakrefs()\n");
- return 0;
- }
-
- for (x = 0; x < PySequence_Size(armlist); x++){
- pyarmature = PyWeakref_GetObject(PySequence_GetItem( armlist, x));
- if (pyarmature != Py_None)
- Armature_RebuildEditbones(pyarmature);
- }
- return 1;
-}
-
-
-static PyObject *M_Window_EditMode( PyObject * self, PyObject * args )
-{
- short status = -1;
- char *undo_str = "From script";
- int undo_str_len = 11;
- int do_undo = 1;
-
- if( !PyArg_ParseTuple( args,
- "|hs#i", &status, &undo_str, &undo_str_len, &do_undo ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected optional int (bool), string and int (bool) as arguments" );
-
- if( status >= 0 ) {
- if( status ) {
- if( !G.obedit ){
-
- //update armatures
- if(! update_armature_weakrefs()){
- return EXPP_ReturnPyObjError(
- PyExc_RuntimeError,
- "internal error - update_armature_weakrefs");
- }
-
- //enter editmode
- enter_editmode(0);
- }
- } else if( G.obedit ) {
- if( undo_str_len > 63 )
- undo_str[63] = '\0'; /* 64 is max */
- BIF_undo_push( undo_str ); /* This checks user undo settings */
- exit_editmode( EM_FREEDATA );
-
- //update armatures
- if(! update_armature_weakrefs()){
- return EXPP_ReturnPyObjError(
- PyExc_RuntimeError,
- "internal error - update_armature_weakrefs");
- }
-
- }
- }
-
- return Py_BuildValue( "h", G.obedit ? 1 : 0 );
-}
-
-static PyObject *M_Window_PoseMode( PyObject * self, PyObject * args )
-{
- short status = -1;
- short is_posemode = 0;
- Base *base;
-
- if( !PyArg_ParseTuple( args, "|h", &status ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected optional int (bool) as argument" );
-
- if( status >= 0 ) {
- if( status ) {
- enter_posemode();
- } else if( G.obedit ) {
- exit_posemode();
- }
- }
-
- base= BASACT;
- if (base && base->object->flag & OB_POSEMODE) {
- is_posemode = 1;
- }
-
- return Py_BuildValue( "h", is_posemode );
-}
-
-static PyObject *M_Window_ViewLayers( PyObject * self, PyObject * args )
-{
- PyObject *item = NULL;
- PyObject *list = NULL, *resl = NULL;
- int val, i, bit = 0, layer = 0, len_list;
- short winid = -1;
-
- if( !G.scene ) {
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "can't get pointer to global scene" );
- }
-
- /* Pase Args, Nothing, One list, Or a list and an int */
- if (PyTuple_GET_SIZE(args)!=0) {
- if( !PyArg_ParseTuple ( args, "O!|h", &PyList_Type, &list, &winid) ) {
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "nothing or a list and optionaly a window ID argument" );
- }
- }
-
- if( list ) {
- len_list = PyList_Size(list);
-
- if (len_list == 0)
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "list can't be empty, at list one layer must be set" );
-
- for( i = 0; i < len_list; i++ ) {
- item = PyList_GetItem( list, i );
- if( !PyInt_Check( item ) )
- return EXPP_ReturnPyObjError
- ( PyExc_AttributeError,
- "list must contain only integer numbers" );
-
- val = ( int ) PyInt_AsLong( item );
- if( val < 1 || val > 20 )
- return EXPP_ReturnPyObjError
- ( PyExc_AttributeError,
- "layer values must be in the range [1, 20]" );
-
- layer |= 1 << ( val - 1 );
- }
-
- if (winid==-1) {
- /* set scene and viewport */
- G.scene->lay = layer;
- if (G.vd) {
- G.vd->lay = layer;
-
- while( bit < 20 ) {
- val = 1 << bit;
- if( layer & val ) {
- G.vd->layact = val;
- break;
- }
- bit++;
- }
- }
- } else {
- /* only set the windows layer */
- ScrArea *sa;
- SpaceLink *sl;
- View3D *vd;
-
- if (G.curscreen) { /* can never be too careful */
- for (sa=G.curscreen->areabase.first; sa; sa= sa->next) {
- if (winid == sa->win) {
-
- for (sl= sa->spacedata.first; sl; sl= sl->next)
- if(sl->spacetype==SPACE_VIEW3D)
- break;
-
- if (!sl)
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "The window matching the winid has no 3d viewport" );
-
- vd= (View3D *) sl;
- vd->lay = layer;
-
- for(bit= 0; bit < 20; bit++) {
- val = 1 << bit;
- if( layer & val ) {
- vd->layact = val;
- break;
- }
- }
-
- winid = -1; /* so we know its done */
- break;
- }
- }
- if (winid!=-1)
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "The winid argument did not match any window" );
- }
- }
- }
-
- resl = PyList_New( 0 );
- if( !resl )
- return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create pylist!" ) );
-
- layer = G.scene->lay;
-
- bit = 0;
- while( bit < 20 ) {
- val = 1 << bit;
- if( layer & val ) {
- item = Py_BuildValue( "i", bit + 1 );
- PyList_Append( resl, item );
- Py_DECREF( item );
- }
- bit++;
- }
-
- return resl;
-}
-
-static PyObject *M_Window_CameraView( PyObject * self, PyObject * args )
-{
- short camtov3d = 0;
-
- if( !PyArg_ParseTuple( args, "|i", &camtov3d ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected an int (from Window.Views) as argument" );
-
- if( !G.vd )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "this function can only be used after a 3d View has been initialized" );
-
- if( !G.vd->camera ) {
- if( BASACT && OBACT->type == OB_CAMERA )
- G.vd->camera = OBACT;
- else
- G.vd->camera = scene_find_camera( G.scene );
- handle_view3d_lock( );
- }
-
- G.vd->persp = 2;
- G.vd->view = 0;
-
- if( camtov3d )
- setcameratoview3d( );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *M_Window_QTest( PyObject * self )
-{
- return Py_BuildValue( "h", qtest( ) );
-}
-
-static PyObject *M_Window_QRead( PyObject * self )
-{
- short val = 0;
- unsigned short event;
-
- if (G.background)
- return EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "QRead is not available in background mode");
-
- event = extern_qread( &val );
-
- return Py_BuildValue( "ii", event, val );
-}
-
-static PyObject *M_Window_QAdd( PyObject * self, PyObject * args )
-{
- short win;
- short evt; /* unsigned, we check below */
- short val;
- short after = 0;
-
- if (G.background)
- return EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "QAdd is not available in background mode");
-
- if( !PyArg_ParseTuple( args, "hhh|h", &win, &evt, &val, &after ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected three or four ints as arguments" );
-
- if( evt < 0 ) /* evt is unsigned short */
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "event value must be a positive int, check events in Blender.Draw" );
-
- if( after )
- addafterqueue( win, evt, val );
- else
- addqueue( win, evt, val );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *M_Window_QHandle( PyObject * self, PyObject * args )
-{
- short win;
- ScrArea *sa;
- ScrArea *oldsa = NULL;
-
- if (G.background)
- return EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "QHandle is not available in background mode");
-
- if (!G.curscreen)
- return EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "No screens available");
-
- if( !PyArg_ParseTuple( args, "h", &win ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected an int as argument" );
-
- for (sa= G.curscreen->areabase.first; sa; sa= sa->next)
- if( sa->win == win )
- break;
-
- if( sa ) {
- BWinEvent evt;
- short do_redraw = 0, do_change = 0;
-
- if( sa != curarea || sa->win != mywinget( ) ) {
- oldsa = curarea;
- areawinset( sa->win );
- set_g_activearea( sa );
- }
- while( bwin_qread( sa->win, &evt ) ) {
- if( evt.event == REDRAW ) {
- do_redraw = 1;
- } else if( evt.event == CHANGED ) {
- sa->win_swap = 0;
- do_change = 1;
- do_redraw = 1;
- } else {
- scrarea_do_winhandle( sa, &evt );
- }
- }
- }
-
- if( oldsa ) {
- areawinset( oldsa->win );
- set_g_activearea( oldsa );
- }
-
- Py_RETURN_NONE;
-}
-
-static PyObject *M_Window_GetMouseCoords( PyObject * self )
-{
- short mval[2];
-
- getmouse( mval );
-
- return Py_BuildValue( "hh", mval[0], mval[1] );
-}
-
-static PyObject *M_Window_SetMouseCoords( PyObject * self, PyObject * args )
-{
- int ok, x, y;
-
- if( !G.curscreen )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "no current screen to retrieve info from!" );
-
- x = G.curscreen->sizex / 2;
- y = G.curscreen->sizey / 2;
-
- if( PyObject_Length( args ) == 2 )
- ok = PyArg_ParseTuple( args, "hh", &x, &y );
- else
- ok = PyArg_ParseTuple( args, "|(hh)", &x, &y );
-
- if( !ok )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected [i, i] or i,i as arguments (or nothing)." );
-
- warp_pointer( x, y );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *M_Window_GetMouseButtons( PyObject * self )
-{
- short mbut = get_mbut( );
-
- return Py_BuildValue( "h", mbut );
-}
-
-static PyObject *M_Window_GetKeyQualifiers( PyObject * self )
-{
- short qual = get_qual( );
-
- return Py_BuildValue( "h", qual );
-}
-
-static PyObject *M_Window_SetKeyQualifiers( PyObject * self, PyObject * args )
-{
- short qual = 0;
-
- if( !PyArg_ParseTuple( args, "|h", &qual ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected nothing or an int (or'ed flags) as argument" );
-
- if( qual < 0 )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "value must be a positive int, check Blender.Window.Qual" );
-
- G.qual = qual;
-
- return Py_BuildValue( "h", qual );
-}
-
-static PyObject *M_Window_GetAreaSize( PyObject * self )
-{
- ScrArea *sa = curarea;
-
- if( !sa )
- Py_RETURN_NONE;
-
- return Py_BuildValue( "hh", sa->winx, sa->winy );
-}
-
-static PyObject *M_Window_GetAreaID( PyObject * self )
-{
- ScrArea *sa = curarea;
-
- if( !sa )
- Py_RETURN_NONE;
-
- return Py_BuildValue( "h", sa->win );
-}
-
-static PyObject *M_Window_GetScreenSize( PyObject * self )
-{
- bScreen *scr = G.curscreen;
-
- if( !scr )
- Py_RETURN_NONE;
-
- return Py_BuildValue( "hh", scr->sizex, scr->sizey );
-}
-
-
-static PyObject *M_Window_SetScreen( PyObject * self, PyObject * value )
-{
- bScreen *scr = G.main->screen.first;
- char *name = PyString_AsString(value);
-
- if( !name )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string as argument" );
-
- while( scr ) {
- if( !strcmp( scr->id.name + 2, name ) ) {
- setscreen( scr );
- break;
- }
- scr = scr->id.next;
- }
-
- if( !scr )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "no such screen, check Window.GetScreens() for valid names" );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *M_Window_GetScreens( PyObject * self )
-{
- bScreen *scr = G.main->screen.first;
- PyObject *list = PyList_New( 0 );
- PyObject *str = NULL;
-
- if( !list )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create py list!" );
-
- while( scr ) {
- str = PyString_FromString( scr->id.name + 2 );
-
- if( !str ) {
- Py_DECREF( list );
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create py string!" );
- }
-
- PyList_Append( list, str ); /* incref's str */
- Py_DECREF( str );
-
- scr = scr->id.next;
- }
-
- return list;
-}
-
-static PyObject *M_Window_GetScreenInfo( PyObject * self, PyObject * args,
- PyObject * kwords )
-{
- ScrArea *sa = G.curscreen->areabase.first;
- bScreen *scr = G.main->screen.first;
- PyObject *item, *list;
- rcti *rct;
- int type = -1;
- char *rect = "win";
- char *screen = "";
- static char *kwlist[] = { "type", "rect", "screen", NULL };
- int rctype = 0;
-
- if( !PyArg_ParseTupleAndKeywords( args, kwords, "|iss", kwlist, &type,
- &rect, &screen ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected nothing or an int and two strings as arguments" );
-
- if( !strcmp( rect, "win" ) )
- rctype = 0;
- else if( !strcmp( rect, "total" ) )
- rctype = 1;
- else if( !strcmp( rect, "header" ) )
- rctype = 2;
- else
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "requested invalid type for area rectangle coordinates." );
-
- list = PyList_New( 0 );
-
- if( screen && screen[0] != '\0' ) {
- while( scr ) {
- if( !strcmp( scr->id.name + 2, screen ) ) {
- sa = scr->areabase.first;
- break;
- }
- scr = scr->id.next;
- }
- }
-
- if( !scr ) {
- Py_DECREF( list );
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "no such screen, see existing ones with Window.GetScreens." );
- }
-
- while( sa ) {
- if( type != -1 && sa->spacetype != type ) {
- sa = sa->next;
- continue;
- }
-
- switch ( rctype ) {
- case 0:
- rct = &sa->winrct;
- break;
- case 1:
- rct = &sa->totrct;
- break;
- case 2:
- default:
- rct = &sa->headrct;
- }
-
- item = Py_BuildValue( "{s:[h,h,h,h],s:h,s:h}",
- "vertices", rct->xmin, rct->ymin,
- rct->xmax, rct->ymax, "type",
- ( short ) sa->spacetype, "id",
- ( short ) sa->win );
- PyList_Append( list, item );
- Py_DECREF( item );
-
- sa = sa->next;
- }
-
- return list;
-}
-
-static PyObject *M_Window_GetPivot( PyObject * self )
-{
- if (G.vd) {
- return PyInt_FromLong( G.vd->around );
- }
- Py_RETURN_NONE;
-}
-
-static PyObject *M_Window_SetPivot( PyObject * self, PyObject * value)
-
-{
- short pivot;
- if (G.vd) {
- pivot = (short)PyInt_AsLong( value );
-
- if ( pivot > 4 || pivot < 0 )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "Expected a constant from Window.PivotTypes" );
-
- G.vd->around = pivot;
- }
- Py_RETURN_NONE;
-}
-
-
-/*****************************************************************************/
-/* Function: Window_Init */
-/*****************************************************************************/
-PyObject *Window_Init( void )
-{
- PyObject *submodule, *Types, *Qual, *MButs, *PivotTypes, *dict;
-
- submodule =
- Py_InitModule3( "Blender.Window", M_Window_methods,
- M_Window_doc );
-
- dict = PyModule_GetDict( submodule );
- if( dict )
- PyDict_SetItemString( dict, "Theme", Theme_Init( ) );
-
- Types = PyConstant_New( );
- Qual = PyConstant_New( );
- MButs = PyConstant_New( );
- PivotTypes = PyConstant_New( );
-
- if( Types ) {
- BPy_constant *d = ( BPy_constant * ) Types;
-
- PyConstant_Insert( d, "VIEW3D", PyInt_FromLong( SPACE_VIEW3D ) );
- PyConstant_Insert( d, "IPO", PyInt_FromLong( SPACE_IPO ) );
- PyConstant_Insert( d, "OOPS", PyInt_FromLong( SPACE_OOPS ) );
- PyConstant_Insert( d, "BUTS", PyInt_FromLong( SPACE_BUTS ) );
- PyConstant_Insert( d, "FILE", PyInt_FromLong( SPACE_FILE ) );
- PyConstant_Insert( d, "IMAGE", PyInt_FromLong( SPACE_IMAGE ) );
- PyConstant_Insert( d, "INFO", PyInt_FromLong( SPACE_INFO ) );
- PyConstant_Insert( d, "SEQ", PyInt_FromLong( SPACE_SEQ ) );
- PyConstant_Insert( d, "IMASEL", PyInt_FromLong( SPACE_IMASEL ) );
- PyConstant_Insert( d, "SOUND", PyInt_FromLong( SPACE_SOUND ) );
- PyConstant_Insert( d, "ACTION", PyInt_FromLong( SPACE_ACTION ) );
- PyConstant_Insert( d, "TEXT", PyInt_FromLong( SPACE_TEXT ) );
- PyConstant_Insert( d, "NLA", PyInt_FromLong( SPACE_NLA ) );
- PyConstant_Insert( d, "SCRIPT", PyInt_FromLong( SPACE_SCRIPT ) );
- PyConstant_Insert( d, "TIME", PyInt_FromLong( SPACE_TIME ) );
- PyConstant_Insert( d, "NODE", PyInt_FromLong( SPACE_NODE ) );
-
- PyModule_AddObject( submodule, "Types", Types );
- }
-
- if( Qual ) {
- BPy_constant *d = ( BPy_constant * ) Qual;
-
- PyConstant_Insert( d, "LALT", PyInt_FromLong( L_ALTKEY ) );
- PyConstant_Insert( d, "RALT", PyInt_FromLong( R_ALTKEY ) );
- PyConstant_Insert( d, "ALT", PyInt_FromLong( LR_ALTKEY ) );
- PyConstant_Insert( d, "LCTRL", PyInt_FromLong( L_CTRLKEY ) );
- PyConstant_Insert( d, "RCTRL", PyInt_FromLong( R_CTRLKEY ) );
- PyConstant_Insert( d, "CTRL", PyInt_FromLong( LR_CTRLKEY ) );
- PyConstant_Insert( d, "LSHIFT", PyInt_FromLong( L_SHIFTKEY ) );
- PyConstant_Insert( d, "RSHIFT", PyInt_FromLong( R_SHIFTKEY ) );
- PyConstant_Insert( d, "SHIFT", PyInt_FromLong( LR_SHIFTKEY ) );
-
- PyModule_AddObject( submodule, "Qual", Qual );
- }
-
- if( MButs ) {
- BPy_constant *d = ( BPy_constant * ) MButs;
-
- PyConstant_Insert( d, "L", PyInt_FromLong( L_MOUSE ) );
- PyConstant_Insert( d, "M", PyInt_FromLong( M_MOUSE ) );
- PyConstant_Insert( d, "R", PyInt_FromLong( R_MOUSE ) );
-
- PyModule_AddObject( submodule, "MButs", MButs );
- }
-
- if( PivotTypes ) {
- BPy_constant *d = ( BPy_constant * ) PivotTypes;
-
- PyConstant_Insert(d, "BOUNDBOX", PyInt_FromLong( PIVOT_BOUNDBOX ) );
- PyConstant_Insert(d, "CURSOR", PyInt_FromLong( PIVOT_CURSOR ) );
- PyConstant_Insert(d, "MEDIAN", PyInt_FromLong( PIVOT_MEDIAN ) );
- PyConstant_Insert(d, "ACTIVE", PyInt_FromLong( PIVOT_ACTIVE ) );
- PyConstant_Insert(d, "INDIVIDUAL", PyInt_FromLong( PIVOT_INDIVIDUAL ) );
-
- PyModule_AddObject( submodule, "PivotTypes", PivotTypes );
- }
- return submodule;
-}
diff --git a/source/blender/python/api2_2x/World.c b/source/blender/python/api2_2x/World.c
deleted file mode 100644
index a6fac327360..00000000000
--- a/source/blender/python/api2_2x/World.c
+++ /dev/null
@@ -1,1034 +0,0 @@
-/*
- * $Id: World.c 12078 2007-09-18 06:41:29Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Jacques Guignot, Johnny Matthews
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-/**
- * \file World.c
- * \ingroup scripts
- * \brief Blender.World Module and World Data PyObject implementation.
- *
- * Note: Parameters between "<" and ">" are optional. But if one of them is
- * given, all preceding ones must be given, too. Of course, this only relates
- * to the Python functions and methods described here and only inside Python
- * code. [ This will go to another file later, probably the main exppython
- * doc file]. XXX Better: put optional args with their default value:
- * (self, name = "MyName")
- */
-
-#include "World.h" /*This must come first*/
-
-#include "DNA_scene_types.h" /* for G.scene */
-#include "BKE_global.h"
-#include "BKE_world.h"
-#include "BKE_main.h"
-#include "BKE_library.h"
-#include "BLI_blenlib.h"
-#include "BSE_editipo.h"
-#include "BIF_space.h"
-#include "mydevice.h"
-#include "Ipo.h"
-#include "gen_utils.h"
-#include "gen_library.h"
-
-#define IPOKEY_ZENITH 0
-#define IPOKEY_HORIZON 1
-#define IPOKEY_MIST 2
-#define IPOKEY_STARS 3
-#define IPOKEY_OFFSET 4
-#define IPOKEY_SIZE 5
-/*****************************************************************************/
-/* Python BPy_World methods declarations: */
-/*****************************************************************************/
-static PyObject *World_getRange( BPy_World * self );
-static PyObject *World_setRange( BPy_World * self, PyObject * args );
-static PyObject *World_getIpo( BPy_World * self );
-static PyObject *World_oldsetIpo( BPy_World * self, PyObject * args );
-static int World_setIpo( BPy_World * self, PyObject * args );
-static PyObject *World_clearIpo( BPy_World * self );
-static PyObject *World_insertIpoKey( BPy_World * self, PyObject * args );
-static PyObject *World_getMode( BPy_World * self );
-static PyObject *World_oldsetMode( BPy_World * self, PyObject * args );
-static int World_setMode( BPy_World * self, PyObject * args );
-static PyObject *World_getSkytype( BPy_World * self );
-static PyObject *World_oldsetSkytype( BPy_World * self, PyObject * args );
-static int World_setSkytype( BPy_World * self, PyObject * args );
-static PyObject *World_getMistype( BPy_World * self );
-static PyObject *World_oldsetMistype( BPy_World * self, PyObject * args );
-static int World_setMistype( BPy_World * self, PyObject * args );
-static PyObject *World_getHor( BPy_World * self );
-static PyObject *World_oldsetHor( BPy_World * self, PyObject * args );
-static int World_setHor( BPy_World * self, PyObject * args );
-static PyObject *World_getZen( BPy_World * self );
-static PyObject *World_oldsetZen( BPy_World * self, PyObject * args );
-static int World_setZen( BPy_World * self, PyObject * args );
-static PyObject *World_getAmb( BPy_World * self );
-static PyObject *World_oldsetAmb( BPy_World * self, PyObject * args );
-static int World_setAmb( BPy_World * self, PyObject * args );
-static PyObject *World_getStar( BPy_World * self );
-static PyObject *World_oldsetStar( BPy_World * self, PyObject * args );
-static int World_setStar( BPy_World * self, PyObject * args );
-static PyObject *World_getMist( BPy_World * self );
-static PyObject *World_oldsetMist( BPy_World * self, PyObject * args );
-static int World_setMist( BPy_World * self, PyObject * args );
-static PyObject *World_getScriptLinks( BPy_World * self, PyObject * value );
-static PyObject *World_addScriptLink( BPy_World * self, PyObject * args );
-static PyObject *World_clearScriptLinks( BPy_World * self, PyObject * args );
-static PyObject *World_setCurrent( BPy_World * self );
-static PyObject *World_copy( BPy_World * self );
-
-
-/*****************************************************************************/
-/* Python API function prototypes for the World module. */
-/*****************************************************************************/
-static PyObject *M_World_New( PyObject * self, PyObject * args,
- PyObject * keywords );
-static PyObject *M_World_Get( PyObject * self, PyObject * args );
-static PyObject *M_World_GetCurrent( PyObject * self );
-
-
-/*****************************************************************************/
-/* Python World_Type callback function prototypes: */
-/*****************************************************************************/
-//static int World_Print (BPy_World *self, FILE *fp, int flags);
-static int World_Compare( BPy_World * a, BPy_World * b );
-static PyObject *World_Repr( BPy_World * self );
-
-
-
-/*****************************************************************************/
-/* The following string definitions are used for documentation strings. */
-/* In Python these will be written to the console when doing a */
-/* Blender.World.__doc__ */
-/*****************************************************************************/
-static char M_World_doc[] = "The Blender World module\n\n\
-This module provides access to **World Data** objects in Blender\n\n";
-
-static char M_World_New_doc[] = "() - return a new World object";
-
-static char M_World_Get_doc[] =
- "(name) - return the world with the name 'name', \
-returns None if not found.\n If 'name' is not specified, \
-it returns a list of all worlds in the\ncurrent scene.";
-static char M_World_GetCurrent_doc[] = "() - returns the current world, or \
-None if the Scene has no world";
-
-
-
-/*****************************************************************************/
-/* Python method structure definition for Blender.World module: */
-/*****************************************************************************/
-struct PyMethodDef M_World_methods[] = {
- {"New", ( PyCFunction ) M_World_New, METH_VARARGS | METH_KEYWORDS,
- M_World_New_doc},
- {"Get", M_World_Get, METH_VARARGS, M_World_Get_doc},
- {"GetActive", ( PyCFunction ) M_World_GetCurrent, METH_NOARGS,
- M_World_GetCurrent_doc},
- {"GetCurrent", ( PyCFunction ) M_World_GetCurrent, METH_NOARGS,
- M_World_GetCurrent_doc},
- {"get", M_World_Get, METH_VARARGS, M_World_Get_doc},
- {NULL, NULL, 0, NULL}
-};
-
-
-
-/*****************************************************************************/
-/* Python BPy_World methods table: */
-/*****************************************************************************/
-static PyMethodDef BPy_World_methods[] = {
- {"getRange", ( PyCFunction ) World_getRange, METH_NOARGS,
- "() - Return World Range"},
- {"setRange", ( PyCFunction ) World_setRange, METH_VARARGS,
- "() - Change this World's range"},
- {"getIpo", ( PyCFunction ) World_getIpo, METH_NOARGS,
- "() - Return World Ipo"},
- {"setIpo", ( PyCFunction ) World_oldsetIpo, METH_VARARGS,
- "() - Change this World's ipo"},
- {"clearIpo", ( PyCFunction ) World_clearIpo, METH_VARARGS,
- "() - Unlink Ipo from this World"},
- {"getName", ( PyCFunction ) GenericLib_getName, METH_NOARGS,
- "() - Return World Data name"},
- {"setName", ( PyCFunction ) GenericLib_setName_with_method, METH_VARARGS,
- "() - Set World Data name"},
- {"getMode", ( PyCFunction ) World_getMode, METH_NOARGS,
- "() - Return World Data mode"},
- {"setMode", ( PyCFunction ) World_oldsetMode, METH_VARARGS,
- "(i) - Set World Data mode"},
- {"getSkytype", ( PyCFunction ) World_getSkytype, METH_NOARGS,
- "() - Return World Data skytype"},
- {"setSkytype", ( PyCFunction ) World_oldsetSkytype, METH_VARARGS,
- "() - Return World Data skytype"},
- {"getMistype", ( PyCFunction ) World_getMistype, METH_NOARGS,
- "() - Return World Data mistype"},
- {"setMistype", ( PyCFunction ) World_oldsetMistype, METH_VARARGS,
- "() - Return World Data mistype"},
- {"getHor", ( PyCFunction ) World_getHor, METH_NOARGS,
- "() - Return World Data hor"},
- {"setHor", ( PyCFunction ) World_oldsetHor, METH_VARARGS,
- "() - Return World Data hor"},
- {"getZen", ( PyCFunction ) World_getZen, METH_NOARGS,
- "() - Return World Data zen"},
- {"setZen", ( PyCFunction ) World_oldsetZen, METH_VARARGS,
- "() - Return World Data zen"},
- {"getAmb", ( PyCFunction ) World_getAmb, METH_NOARGS,
- "() - Return World Data amb"},
- {"setAmb", ( PyCFunction ) World_oldsetAmb, METH_VARARGS,
- "() - Return World Data amb"},
- {"getStar", ( PyCFunction ) World_getStar, METH_NOARGS,
- "() - Return World Data star"},
- {"setStar", ( PyCFunction ) World_oldsetStar, METH_VARARGS,
- "() - Return World Data star"},
- {"getMist", ( PyCFunction ) World_getMist, METH_NOARGS,
- "() - Return World Data mist"},
- {"setMist", ( PyCFunction ) World_oldsetMist, METH_VARARGS,
- "() - Return World Data mist"},
- {"getScriptLinks", ( PyCFunction ) World_getScriptLinks, METH_O,
- "(eventname) - Get a list of this world's scriptlinks (Text names) "
- "of the given type\n"
- "(eventname) - string: FrameChanged, Redraw or Render."},
- {"addScriptLink", ( PyCFunction ) World_addScriptLink, METH_VARARGS,
- "(text, evt) - Add a new world scriptlink.\n"
- "(text) - string: an existing Blender Text name;\n"
- "(evt) string: FrameChanged, Redraw or Render."},
- {"clearScriptLinks", ( PyCFunction ) World_clearScriptLinks,
- METH_VARARGS,
- "() - Delete all scriptlinks from this world.\n"
- "([s1<,s2,s3...>]) - Delete specified scriptlinks from this world."},
- {"setCurrent", ( PyCFunction ) World_setCurrent, METH_NOARGS,
- "() - Makes this world the active world for the current scene."},
- {"makeActive", ( PyCFunction ) World_setCurrent, METH_NOARGS,
- "please use setCurrent instead, this alias will be removed."},
- {"insertIpoKey", ( PyCFunction ) World_insertIpoKey, METH_VARARGS,
- "( World IPO type ) - Inserts a key into the IPO"},
- {"__copy__", ( PyCFunction ) World_copy, METH_NOARGS,
- "() - Makes a copy of this world."},
- {"copy", ( PyCFunction ) World_copy, METH_NOARGS,
- "() - Makes a copy of this world."},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Python attributes get/set structure: */
-/*****************************************************************************/
-static PyGetSetDef BPy_World_getseters[] = {
- GENERIC_LIB_GETSETATTR,
- {"skytype", (getter)World_getSkytype, (setter)World_setSkytype,
- "sky settings as a list", NULL},
- {"mode", (getter)World_getMode, (setter)World_setMode,
- "world mode", NULL},
- {"mistype", (getter)World_getMistype, (setter)World_setMistype,
- "world mist type", NULL},
- {"hor", (getter)World_getHor, (setter)World_setHor,
- "world horizon color", NULL},
- {"amb", (getter)World_getAmb, (setter)World_setAmb,
- "world ambient color", NULL},
- {"mist", (getter)World_getMist, (setter)World_setMist,
- "world mist settings", NULL},
- {"ipo", (getter)World_getIpo, (setter)World_setIpo,
- "world ipo", NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-/*****************************************************************************/
-/* Python World_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject World_Type = {
- PyObject_HEAD_INIT( NULL )
- 0, /* ob_size */
- "World", /* tp_name */
- sizeof( BPy_World ), /* tp_basicsize */
- 0, /* tp_itemsize */
- /* methods */
- NULL, /* tp_dealloc */
- 0, /* tp_print */
- NULL, /* tp_getattr */
- NULL, /* tp_setattr */
- ( cmpfunc ) World_Compare, /* tp_compare */
- ( reprfunc ) World_Repr, /* tp_repr */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- NULL, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
- 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, /* 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, /* 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 ***/
- BPy_World_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_World_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-/**
- * \defgroup World_Module Blender.World module functions
- *
- */
-
-/*@{*/
-
-/**
- * \brief Python module function: Blender.World.New()
- *
- * This is the .New() function of the Blender.World submodule. It creates
- * new World Data in Blender and returns its Python wrapper object. The
- * name parameter is mandatory.
- * \param <name> - string: The World Data name.
- * \return A new World PyObject.
- */
-
-static PyObject *M_World_New( PyObject * self, PyObject * args,
- PyObject * kwords )
-{
- char *name = NULL;
- BPy_World *pyworld;
- World *blworld;
-
- if( !PyArg_ParseTuple( args, "s", &name ) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int argument" ) );
-
-
- blworld = add_world( name );
-
- if( blworld ) {
- /* return user count to zero because add_world() inc'd it */
- blworld->id.us = 0;
- /* create python wrapper obj */
- pyworld =
- ( BPy_World * ) PyObject_NEW( BPy_World, &World_Type );
- } else
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't create World Data in Blender" ) );
-
- if( pyworld == NULL )
- return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create World Data object" ) );
-
- pyworld->world = blworld;
-
- return ( PyObject * ) pyworld;
-}
-
-/**
- * \brief Python module function: Blender.World.Get()
- *
- * This is the .Get() function of the Blender.World submodule. It searches
- * the list of current World Data objects and returns a Python wrapper for
- * the one with the name provided by the user. If called with no arguments,
- * it returns a list of all current World Data object names in Blender.
- * \param <name> - string: The name of an existing Blender World Data object.
- * \return () - A list with the names of all current World Data objects;\n
- * \return (name) - A Python wrapper for the World Data called 'name'
- * in Blender.
- */
-
-static PyObject *M_World_Get( PyObject * self, PyObject * args )
-{
-
- char *name = NULL;
- World *world_iter;
- PyObject *worldlist;
- char error_msg[64];
-
- if( !PyArg_ParseTuple( args, "|s", &name ) )
- return ( EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument (or nothing)" ) );
-
- if( name ) { /* (name) - Search world by name */
- world_iter = ( World * ) GetIdFromList( &( G.main->world ), name );
-
- if( world_iter == NULL ) { /* Requested world doesn't exist */
- PyOS_snprintf( error_msg, sizeof( error_msg ),
- "World \"%s\" not found", name );
- return ( EXPP_ReturnPyObjError
- ( PyExc_NameError, error_msg ) );
- }
-
- return ( PyObject * ) World_CreatePyObject(world_iter);
- }
-
- else { /* return a list of all worlds in the scene */
- world_iter = G.main->world.first;
- worldlist = PyList_New( 0 );
- if( worldlist == NULL )
- return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create PyList" ) );
-
- while( world_iter ) {
- BPy_World *found_world =
- ( BPy_World * ) PyObject_NEW( BPy_World,
- &World_Type );
- found_world->world = world_iter;
- PyList_Append( worldlist, ( PyObject * ) found_world );
- Py_DECREF(found_world);
-
- world_iter = world_iter->id.next;
- }
- return ( worldlist );
- }
-
-}
-
-static PyObject *M_World_GetCurrent( PyObject * self )
-{
- BPy_World *w = NULL;
-#if 0 /* add back in when bpy becomes "official" */
- static char warning = 1;
- if( warning ) {
- printf("Blender.World.GetCurrent() deprecated!\n\tuse bpy.scenes.world instead\n");
- --warning;
- }
-#endif
-
- if( !G.scene->world )
- Py_RETURN_NONE;
-
- w = ( BPy_World * ) PyObject_NEW( BPy_World, &World_Type );
- w->world = G.scene->world;
- return ( PyObject * ) w;
-}
-
-/*@}*/
-
-/**
- * \brief Initializes the Blender.World submodule
- *
- * This function is used by Blender_Init() in Blender.c to register the
- * Blender.World submodule in the main Blender module.
- * \return PyObject*: The initialized submodule.
- */
-
-PyObject *World_Init( void )
-{
- PyObject *submodule;
-
- if( PyType_Ready( &World_Type ) < 0 )
- return NULL;
-
- submodule = Py_InitModule3( "Blender.World",
- M_World_methods, M_World_doc );
-
- PyModule_AddIntConstant( submodule, "ZENITH", IPOKEY_ZENITH );
- PyModule_AddIntConstant( submodule, "HORIZON", IPOKEY_HORIZON );
- PyModule_AddIntConstant( submodule, "MIST", IPOKEY_MIST );
- PyModule_AddIntConstant( submodule, "STARS", IPOKEY_STARS );
- PyModule_AddIntConstant( submodule, "OFFSET", IPOKEY_OFFSET );
- PyModule_AddIntConstant( submodule, "SIZE", IPOKEY_SIZE );
-
- return ( submodule );
-}
-
-/*****************************************************************************/
-/* Python BPy_World methods: */
-/*****************************************************************************/
-static PyObject *World_getRange( BPy_World * self )
-{
- return PyFloat_FromDouble( self->world->range );
-}
-
-static PyObject *World_setRange( BPy_World * self, PyObject * args )
-{
- float range = 0.f;
- if( !PyArg_ParseTuple( args, "f", &range ) )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError, "expected a float argument" ) );
- self->world->range = range;
- Py_RETURN_NONE;
-}
-
-
-static PyObject *World_getIpo( BPy_World * self )
-{
- struct Ipo *ipo = self->world->ipo;
-
- if( !ipo )
- Py_RETURN_NONE;
-
- return Ipo_CreatePyObject( ipo );
-}
-
-static int World_setIpo( BPy_World * self, PyObject * value )
-{
- return GenericLib_assignData(value, (void **) &self->world->ipo, 0, 1, ID_IP, ID_WO);
-}
-
-static PyObject *World_oldsetIpo( BPy_World * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)World_setIpo );
-}
-
-static PyObject *World_clearIpo( BPy_World * self )
-{
- World *world = self->world;
- Ipo *ipo = ( Ipo * ) world->ipo;
-
- if( ipo ) {
- ID *id = &ipo->id;
- if( id->us > 0 )
- id->us--;
- world->ipo = NULL;
-
- return EXPP_incr_ret_True();
- }
-
- return EXPP_incr_ret_False(); /* no ipo found */
-}
-
-/**
- * \brief World PyMethod getSkytype
- *
- * \return int : The World Data skytype.
- */
-
-static PyObject *World_getSkytype( BPy_World * self )
-{
- return PyInt_FromLong( ( long ) self->world->skytype );
-}
-
-
-/**
- * \brief World PyMethod setSkytype
- *
- * \return int : The World Data skytype.
- */
-
-static int World_setSkytype( BPy_World * self, PyObject * value )
-{
- if( !PyInt_Check(value) )
- return ( EXPP_ReturnIntError( PyExc_TypeError,
- "expected int argument" ) );
- self->world->skytype = (short)PyInt_AsLong(value);
- return 0;
-}
-
-static PyObject *World_oldsetSkytype( BPy_World * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)World_setSkytype );
-}
-
-
-/**
- * \brief World PyMethod getMode
- *
- * \return int : The World Data mode.
- */
-
-static PyObject *World_getMode( BPy_World * self )
-{
- return PyInt_FromLong( ( long ) self->world->mode );
-}
-
-
-/**
- * \brief World PyMethod setMode
- *
- * \return int : The World Data mode.
- */
-
-static int World_setMode( BPy_World * self, PyObject * value )
-{
- if( !PyInt_Check(value) )
- return ( EXPP_ReturnIntError( PyExc_TypeError,
- "expected int argument" ) );
- self->world->mode = (short)PyInt_AsLong(value);
- return 0;
-}
-
-static PyObject *World_oldsetMode( BPy_World * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)World_setMode );
-}
-
-
-
-/**
- * \brief World PyMethod getMistype
- *
- * \return int : The World Data mistype.
- */
-
-static PyObject *World_getMistype( BPy_World * self )
-{
- return PyInt_FromLong( ( long ) self->world->mistype );
-}
-
-
-/**
- * \brief World PyMethod setMistype
- *
- * \return int : The World Data mistype.
- */
-
-static int World_setMistype( BPy_World * self, PyObject * value )
-{
- if( !PyInt_Check(value) )
- return ( EXPP_ReturnIntError( PyExc_TypeError,
- "expected int argument" ) );
- self->world->mistype = (short)PyInt_AsLong(value);
- return 0;
-}
-
-static PyObject *World_oldsetMistype( BPy_World * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)World_setMistype );
-}
-
-
-
-static PyObject *World_getHor( BPy_World * self )
-{
- PyObject *attr = PyList_New( 3 );
- if( !attr )
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't create list" ) );
- PyList_SET_ITEM( attr, 0, PyFloat_FromDouble( self->world->horr ) );
- PyList_SET_ITEM( attr, 1, PyFloat_FromDouble( self->world->horg ) );
- PyList_SET_ITEM( attr, 2, PyFloat_FromDouble( self->world->horb ) );
- return attr;
-}
-
-
-static int World_setHor( BPy_World * self, PyObject * value )
-{
- if( !PyList_Check( value ) )
- return ( EXPP_ReturnIntError( PyExc_TypeError,
- "expected list argument" ) );
- if( PyList_Size( value ) != 3 )
- return ( EXPP_ReturnIntError
- ( PyExc_TypeError, "list size must be 3" ) );
- self->world->horr = (float)PyFloat_AsDouble( PyList_GetItem( value, 0 ) );
- self->world->horg = (float)PyFloat_AsDouble( PyList_GetItem( value, 1 ) );
- self->world->horb = (float)PyFloat_AsDouble( PyList_GetItem( value, 2 ) );
- return 0;
-}
-
-static PyObject *World_oldsetHor( BPy_World * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)World_setHor );
-}
-
-static PyObject *World_getZen( BPy_World * self )
-{
- PyObject *attr = PyList_New( 3 );
- if( !attr )
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't create list" ) );
- PyList_SET_ITEM( attr, 0, PyFloat_FromDouble( self->world->zenr ) );
- PyList_SET_ITEM( attr, 1, PyFloat_FromDouble( self->world->zeng ) );
- PyList_SET_ITEM( attr, 2, PyFloat_FromDouble( self->world->zenb ) );
- return attr;
-}
-
-
-static int World_setZen( BPy_World * self, PyObject * value )
-{
- if( !PyList_Check( value ) )
- return ( EXPP_ReturnIntError( PyExc_TypeError,
- "expected list argument" ) );
- if( PyList_Size( value ) != 3 )
- return ( EXPP_ReturnIntError
- ( PyExc_TypeError, "list size must be 3" ) );
- self->world->zenr = (float)PyFloat_AsDouble( PyList_GetItem( value, 0 ) );
- self->world->zeng = (float)PyFloat_AsDouble( PyList_GetItem( value, 1 ) );
- self->world->zenb = (float)PyFloat_AsDouble( PyList_GetItem( value, 2 ) );
- return 0;
-}
-
-static PyObject *World_oldsetZen( BPy_World * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)World_setZen );
-}
-
-
-static PyObject *World_getAmb( BPy_World * self )
-{
- PyObject *attr = PyList_New( 3 );
- if( !attr )
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't create list" ) );
- PyList_SET_ITEM( attr, 0, PyFloat_FromDouble( self->world->ambr ) );
- PyList_SET_ITEM( attr, 1, PyFloat_FromDouble( self->world->ambg ) );
- PyList_SET_ITEM( attr, 2, PyFloat_FromDouble( self->world->ambb ) );
- return attr;
-}
-
-
-static int World_setAmb( BPy_World * self, PyObject * value )
-{
- if( !PyList_Check( value ) )
- return ( EXPP_ReturnIntError( PyExc_TypeError,
- "expected list argument" ) );
- if( PyList_Size( value ) != 3 )
- return ( EXPP_ReturnIntError
- ( PyExc_TypeError, "wrong list size" ) );
- self->world->ambr = (float)PyFloat_AsDouble( PyList_GetItem( value, 0 ) );
- self->world->ambg = (float)PyFloat_AsDouble( PyList_GetItem( value, 1 ) );
- self->world->ambb = (float)PyFloat_AsDouble( PyList_GetItem( value, 2 ) );
- return 0;
-}
-
-static PyObject *World_oldsetAmb( BPy_World * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)World_setAmb );
-}
-
-static PyObject *World_getStar( BPy_World * self )
-{
- PyObject *attr = PyList_New( 7 );
- if( !attr )
- return ( EXPP_ReturnPyObjError
- ( PyExc_RuntimeError, "couldn't create list" ) );
- PyList_SET_ITEM( attr, 0, PyFloat_FromDouble( self->world->starr ) );
- PyList_SET_ITEM( attr, 1, PyFloat_FromDouble( self->world->starg ) );
- PyList_SET_ITEM( attr, 2, PyFloat_FromDouble( self->world->starb ) );
- PyList_SET_ITEM( attr, 3, PyFloat_FromDouble( self->world->starsize ) );
- PyList_SET_ITEM( attr, 4, PyFloat_FromDouble( self->world->starmindist ) );
- PyList_SET_ITEM( attr, 5, PyFloat_FromDouble( self->world->stardist ) );
- PyList_SET_ITEM( attr, 6, PyFloat_FromDouble( self->world->starcolnoise ) );
- return attr;
-}
-
-
-static int World_setStar( BPy_World * self, PyObject * value )
-{
- if( !PyList_Check( value ) )
- return ( EXPP_ReturnIntError
- ( PyExc_TypeError, "expected list argument" ) );
- if( PyList_Size( value ) != 7 )
- return ( EXPP_ReturnIntError
- ( PyExc_TypeError, "wrong list size" ) );
- self->world->starr = (float)PyFloat_AsDouble( PyList_GetItem( value, 0 ) );
- self->world->starg = (float)PyFloat_AsDouble( PyList_GetItem( value, 1 ) );
- self->world->starb = (float)PyFloat_AsDouble( PyList_GetItem( value, 2 ) );
- self->world->starsize =
- (float)PyFloat_AsDouble( PyList_GetItem( value, 3 ) );
- self->world->starmindist =
- (float)PyFloat_AsDouble( PyList_GetItem( value, 4 ) );
- self->world->stardist =
- (float)PyFloat_AsDouble( PyList_GetItem( value, 5 ) );
- self->world->starcolnoise =
- (float)PyFloat_AsDouble( PyList_GetItem( value, 6 ) );
- return 0;
-}
-
-static PyObject *World_oldsetStar( BPy_World * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)World_setStar );
-}
-
-
-static PyObject *World_getMist( BPy_World * self )
-{
- PyObject *attr = PyList_New( 4 );
- if( !attr )
- return ( EXPP_ReturnPyObjError
- ( PyExc_RuntimeError, "couldn't create list" ) );
- PyList_SET_ITEM( attr, 0, PyFloat_FromDouble( self->world->misi ) );
- PyList_SET_ITEM( attr, 1, PyFloat_FromDouble( self->world->miststa ) );
- PyList_SET_ITEM( attr, 2, PyFloat_FromDouble( self->world->mistdist ) );
- PyList_SET_ITEM( attr, 3, PyFloat_FromDouble( self->world->misthi ) );
- return attr;
-}
-
-static int World_setMist( BPy_World * self, PyObject * value )
-{
- if( !PyList_Check( value ) )
- return ( EXPP_ReturnIntError
- ( PyExc_TypeError, "expected list argument" ) );
- if( PyList_Size( value ) != 4 )
- return ( EXPP_ReturnIntError
- ( PyExc_TypeError, "wrong list size" ) );
- self->world->misi = (float)PyFloat_AsDouble( PyList_GetItem( value, 0 ) );
- self->world->miststa =
- (float)PyFloat_AsDouble( PyList_GetItem( value, 1 ) );
- self->world->mistdist =
- (float)PyFloat_AsDouble( PyList_GetItem( value, 2 ) );
- self->world->misthi =
- (float)PyFloat_AsDouble( PyList_GetItem( value, 3 ) );
- return 0;
-}
-
-static PyObject *World_oldsetMist( BPy_World * self, PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)World_setMist );
-}
-
-
-/* world.addScriptLink */
-static PyObject *World_addScriptLink( BPy_World * self, PyObject * args )
-{
- World *world = self->world;
- ScriptLink *slink = NULL;
-
- slink = &( world )->scriptlink;
-
- return EXPP_addScriptLink( slink, args, 0 );
-}
-
-/* world.clearScriptLinks */
-static PyObject *World_clearScriptLinks( BPy_World * self, PyObject * args )
-{
- World *world = self->world;
- ScriptLink *slink = NULL;
-
- slink = &( world )->scriptlink;
-
- return EXPP_clearScriptLinks( slink, args );
-}
-
-/* world.getScriptLinks */
-static PyObject *World_getScriptLinks( BPy_World * self, PyObject * value )
-{
- World *world = self->world;
- ScriptLink *slink = NULL;
- PyObject *ret = NULL;
-
- slink = &( world )->scriptlink;
-
- ret = EXPP_getScriptLinks( slink, value, 0 );
-
- if( ret )
- return ret;
- else
- return NULL;
-}
-
-
-/* world.setCurrent */
-static PyObject *World_setCurrent( BPy_World * self )
-{
- World *world = self->world;
-#if 0 /* add back in when bpy becomes "official" */
- static char warning = 1;
- if( warning ) {
- printf("world.setCurrent() deprecated!\n\tuse bpy.scenes.world=world instead\n");
- --warning;
- }
-#endif
-
- /* If there is a world then it now has one less user */
- if( G.scene->world )
- G.scene->world->id.us--;
- world->id.us++;
- G.scene->world = world;
- Py_RETURN_NONE;
-}
-
-/* world.__copy__ */
-static PyObject *World_copy( BPy_World * self )
-{
- World *world = copy_world(self->world );
- world->id.us = 0;
- return World_CreatePyObject(world);
-}
-
-/**
- * \brief The World PyType compare function
- *
- * This function compares two given World PyObjects, returning 0 for equality
- * and -1 otherwise. In Python it becomes 1 if they are equal and 0 case not.
- * The comparison is done with their pointers to Blender World Data objects,
- * so any two wrappers pointing to the same Blender World Data will be
- * considered the same World PyObject. Currently, only the "==" and "!="
- * comparisons are meaninful -- the "<", "<=", ">" or ">=" are not.
- */
-
-static int World_Compare( BPy_World * a, BPy_World * b )
-{
- return ( a->world == b->world ) ? 0 : -1;
-}
-
-/**
- * \brief The World PyType print callback
- *
- * This function is called when the user tries to print a PyObject of type
- * World. It builds a string with the name of the wrapped Blender World.
- */
-
-/*
-static int World_Print(BPy_World *self, FILE *fp, int flags)
-{
- fprintf(fp, "[World \"%s\"]", self->world->id.name+2);
- return 0;
-}
-*/
-
-/**
- * \brief The World PyType repr callback
- *
- * This function is called when the statement "repr(myworld)" is executed in
- * Python. Repr gives a string representation of a PyObject.
- */
-
-static PyObject *World_Repr( BPy_World * self )
-{
- return PyString_FromFormat( "[World \"%s\"]",
- self->world->id.name + 2 );
-}
-
-/*@}*/
-/*
-static int World_compare (BPy_World *a, BPy_World *b)
-{
- World *pa = a->world, *pb = b->world;
- return (pa == pb) ? 0:-1;
-}
-*/
-PyObject *World_CreatePyObject( struct World * world )
-{
- BPy_World *blen_object;
-
- blen_object = ( BPy_World * ) PyObject_NEW( BPy_World, &World_Type );
-
- if( blen_object == NULL ) {
- return ( NULL );
- }
- blen_object->world = world;
- return ( ( PyObject * ) blen_object );
-}
-
-World *World_FromPyObject( PyObject * py_obj )
-{
- BPy_World *blen_obj;
-
- blen_obj = ( BPy_World * ) py_obj;
- return ( blen_obj->world );
-
-}
-
-/*
- * World_insertIpoKey()
- * inserts World IPO key for ZENITH,HORIZON,MIST,STARS,OFFSET,SIZE
- */
-
-static PyObject *World_insertIpoKey( BPy_World * self, PyObject * args )
-{
- int key = 0, map;
-
- if( !PyArg_ParseTuple( args, "i", &( key ) ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected int argument" ) );
-
- map = texchannel_to_adrcode(self->world->texact);
-
- if(key == IPOKEY_ZENITH) {
- insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_ZEN_R, 0);
- insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_ZEN_G, 0);
- insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_ZEN_B, 0);
- }
- if(key == IPOKEY_HORIZON) {
- insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_HOR_R, 0);
- insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_HOR_G, 0);
- insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_HOR_B, 0);
- }
- if(key == IPOKEY_MIST) {
- insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISI, 0);
- insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISTDI, 0);
- insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISTSTA, 0);
- insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISTHI, 0);
- }
- if(key == IPOKEY_STARS) {
- insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STAR_R, 0);
- insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STAR_G, 0);
- insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STAR_B, 0);
- insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STARDIST, 0);
- insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STARSIZE, 0);
- }
- if(key == IPOKEY_OFFSET) {
- insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_OFS_X, 0);
- insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_OFS_Y, 0);
- insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_OFS_Z, 0);
- }
- if(key == IPOKEY_SIZE) {
- insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_SIZE_X, 0);
- insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_SIZE_Y, 0);
- insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_SIZE_Z, 0);
- }
-
- allspace(REMAKEIPO, 0);
- EXPP_allqueue(REDRAWIPO, 0);
- EXPP_allqueue(REDRAWVIEW3D, 0);
- EXPP_allqueue(REDRAWACTION, 0);
- EXPP_allqueue(REDRAWNLA, 0);
-
- Py_RETURN_NONE;
-}
diff --git a/source/blender/python/api2_2x/World.h b/source/blender/python/api2_2x/World.h
deleted file mode 100644
index 71c407bff19..00000000000
--- a/source/blender/python/api2_2x/World.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * $Id: World.h 10269 2007-03-15 01:09:14Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Jacques Guignot
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_WORLD_H
-#define EXPP_WORLD_H
-
-#include <Python.h>
-#include "DNA_world_types.h"
-
-#define BPy_World_Check(v) ((v)->ob_type==&World_Type)
-
-/* Python BPy_World structure definition */
-typedef struct {
- PyObject_HEAD /* required py macro */
- World * world; /* Libdata must be second */
-} BPy_World;
-
-extern PyTypeObject World_Type;
-
-/*****************************************************************************/
-/* Python World_Type helper functions needed by Blender (the Init function) */
-/* and Object modules. */
-/*****************************************************************************/
-
-PyObject *World_Init( void );
-PyObject *World_CreatePyObject( World * world );
-World *World_FromPyObject( PyObject * pyobj );
-
-#endif /* EXPP_WORLD_H */
diff --git a/source/blender/python/api2_2x/bpy.c b/source/blender/python/api2_2x/bpy.c
deleted file mode 100644
index 6ddbcfe4096..00000000000
--- a/source/blender/python/api2_2x/bpy.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * $Id: bpy.c 10550 2007-04-18 22:53:20Z campbellbarton $
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Michel Selten, Willian P. Germano, Joseph Gilbert,
- * Campbell Barton
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-/* for open, close in Blender_Load */
-
-#include "BLI_blenlib.h"
-#include "BKE_global.h"
-#include "BKE_utildefines.h"
-#include "BKE_scene.h"
-#include "BKE_main.h"
-
-#include "DNA_scene_types.h"
-
-#include "Types.h"
-#include "Library.h"
-
-#include "bpy.h"
-#include "bpy_data.h"
-#include "bpy_config.h"
-
-/*****************************************************************************/
-/* Global variables */
-/*****************************************************************************/
-PyObject *g_bpydict;
-
-/*****************************************************************************/
-/* Function: initBlender */
-/*****************************************************************************/
-
-void m_bpy_init(void)
-{
- PyObject *module;
- PyObject *dict;
-
- /* G.scene should only aver be NULL if blender is executed in
- background mode, not loading a blend file and executing a python script eg.
- blender -P somescript.py -b
- The if below solves the segfaults that happen when python runs and
- G.scene is NULL */
- if(G.background && G.main->scene.first==NULL) {
- Scene *sce= add_scene("1");
- /*set_scene(sce);*/ /* causes a crash */
- G.scene= sce;
- }
-
- module = Py_InitModule3("bpy", NULL, "The main bpy module");
-
- types_InitAll(); /* set all our pytypes to &PyType_Type */
-
- dict = PyModule_GetDict(module);
- g_bpydict = dict;
-
- PyModule_AddObject( module, "config", Config_CreatePyObject() );
- PyDict_SetItemString( dict, "data", Data_Init());
- PyDict_SetItemString( dict, "libraries", Library_Init( ) );
-
-}
diff --git a/source/blender/python/api2_2x/bpy.h b/source/blender/python/api2_2x/bpy.h
deleted file mode 100644
index 855da49bd2b..00000000000
--- a/source/blender/python/api2_2x/bpy.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * $Id: bpy.h 10546 2007-04-18 14:40:01Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Michel Selten, Willian P. Germano
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_BPYMOD_H
-#define EXPP_BPYMOD_H
-
-#include <Python.h>
-
-extern PyObject *g_bpydict;
-void m_bpy_init( void );
-
-#endif /* EXPP_BPYMOD_H */
diff --git a/source/blender/python/api2_2x/bpy_config.c b/source/blender/python/api2_2x/bpy_config.c
deleted file mode 100644
index ce8ce0bc39c..00000000000
--- a/source/blender/python/api2_2x/bpy_config.c
+++ /dev/null
@@ -1,414 +0,0 @@
-/*
- * $Id: bpy_config.c 11123 2007-06-29 08:59:26Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Campbell Barton
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-/* python types */
-#include "DNA_userdef_types.h"
-#include "../api2_2x/gen_utils.h"
-#include "bpy_config.h"
-
-enum conf_consts {
- /*string*/
- EXPP_CONF_ATTR_PATH_YF_EXPORT = 0,
- EXPP_CONF_ATTR_PATH_FONT,
- EXPP_CONF_ATTR_PATH_RENDER,
- EXPP_CONF_ATTR_PATH_TEXTURE,
- EXPP_CONF_ATTR_PATH_PYTHON,
- EXPP_CONF_ATTR_PATH_TEX_PLUGIN,
- EXPP_CONF_ATTR_PATH_SOUND,
- EXPP_CONF_ATTR_PATH_SEQ_PLUGIN,
- EXPP_CONF_ATTR_PATH_TEMP,
-
- /*int*/
- EXPP_CONF_ATTR_UNDOSTEPS,
- EXPP_CONF_ATTR_TEX_TIMEOUT,
- EXPP_CONF_ATTR_TEX_COLLECT_RATE,
- EXPP_CONF_ATTR_MEM_CACHE_LIMIT,
- EXPP_CONF_ATTR_FONT_SIZE
-};
-
-PyObject *Config_CreatePyObject( )
-{
- BPy_Config *conf = PyObject_NEW( BPy_Config, &Config_Type);
- return (PyObject *)conf;
-}
-
-/*
- * repr function
- * callback functions building meaninful string to representations
- */
-static PyObject *Config_repr( BPy_Config * self )
-{
- return PyString_FromFormat( "[Blender Configuration Data]");
-}
-
-
-/*-----------------------Config module Init())-----------------------------*/
-/* see Main.c */
-/*
-static struct PyMethodDef BPy_Config_methods[] = {
- {"new", (PyCFunction)MainSeq_new, METH_VARARGS,
- "(name) - Create a new object in this scene from the obdata given and return a new object"},
- {"load", (PyCFunction)MainSeq_load, METH_VARARGS,
- "(filename) - loads the given filename for image, font and sound types"},
- {"unlink", (PyCFunction)MainSeq_unlink, METH_VARARGS,
- "unlinks the object from the scene"},
- {NULL, NULL, 0, NULL}
-};*/
-
-/*
- * get integer attributes
- */
-static PyObject *getStrAttr( BPy_Config *self, void *type )
-{
- char *param = NULL;
-
- switch( (int)type ) {
- case EXPP_CONF_ATTR_PATH_YF_EXPORT:
- param = U.yfexportdir;
- break;
- case EXPP_CONF_ATTR_PATH_FONT:
- param = U.fontdir;
- break;
- case EXPP_CONF_ATTR_PATH_RENDER:
- param = U.renderdir;
- break;
- case EXPP_CONF_ATTR_PATH_TEXTURE:
- param = U.textudir;
- break;
- case EXPP_CONF_ATTR_PATH_PYTHON:
- param = U.pythondir;
- break;
- case EXPP_CONF_ATTR_PATH_TEX_PLUGIN:
- param = U.plugtexdir;
- break;
- case EXPP_CONF_ATTR_PATH_SOUND:
- param = U.sounddir;
- break;
- case EXPP_CONF_ATTR_PATH_SEQ_PLUGIN:
- param = U.plugseqdir;
- break;
- case EXPP_CONF_ATTR_PATH_TEMP:
- param = U.tempdir;
- break;
-
- default:
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "undefined type in getStrAttr" );
- }
-
- return PyString_FromString( param );
-}
-
-/*
- * set integer attributes which require clamping
- */
-
-static int setStrAttr( BPy_Config *self, PyObject *value, void *type )
-{
- char *param;
- int len=160;
- char *str = PyString_AsString(value);
-
- if (!str)
- return EXPP_ReturnIntError( PyExc_TypeError,
- "error, must assign a python string for setStrAttr");
-
- switch( (int)type ) {
- case EXPP_CONF_ATTR_PATH_YF_EXPORT:
- param = U.yfexportdir;
- break;
- case EXPP_CONF_ATTR_PATH_FONT:
- param = U.fontdir;
- break;
- case EXPP_CONF_ATTR_PATH_RENDER:
- param = U.renderdir;
- break;
- case EXPP_CONF_ATTR_PATH_TEXTURE:
- param = U.textudir;
- break;
- case EXPP_CONF_ATTR_PATH_PYTHON:
- param = U.pythondir;
- break;
- case EXPP_CONF_ATTR_PATH_TEX_PLUGIN:
- param = U.plugtexdir;
- break;
- case EXPP_CONF_ATTR_PATH_SOUND:
- param = U.sounddir;
- break;
- case EXPP_CONF_ATTR_PATH_SEQ_PLUGIN:
- param = U.plugseqdir;
- break;
- case EXPP_CONF_ATTR_PATH_TEMP:
- param = U.tempdir;
- break;
-
- default:
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "undefined type in setStrAttr");
- }
-
- strncpy(param, str, len);
- return 0;
-}
-
-
-/*
- * get integer attributes
- */
-
-static PyObject *getIntAttr( BPy_Config *self, void *type )
-{
- int param;
-
- switch( (int)type ) {
- case EXPP_CONF_ATTR_UNDOSTEPS:
- param = (int)U.undosteps;
- break;
- case EXPP_CONF_ATTR_TEX_TIMEOUT:
- param = U.textimeout;
- break;
- case EXPP_CONF_ATTR_TEX_COLLECT_RATE:
- param = U.texcollectrate;
- break;
- case EXPP_CONF_ATTR_MEM_CACHE_LIMIT:
- param = U.memcachelimit;
- break;
- case EXPP_CONF_ATTR_FONT_SIZE:
- param = U.fontsize;
- break;
-
- default:
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "undefined type in getIntAttr" );
- }
-
- return PyInt_FromLong( param );
-}
-
-/*
- * set integer attributes which require clamping
- */
-
-static int setIntAttrClamp( BPy_Config *self, PyObject *value, void *type )
-{
- void *param;
- int min, max, size;
-
- switch( (int)type ) {
- case EXPP_CONF_ATTR_UNDOSTEPS:
- min = 0;
- max = 64;
- size = 'h';
- param = (void *)&U.undosteps;
- break;
- case EXPP_CONF_ATTR_TEX_TIMEOUT:
- min = 1;
- max = 3600;
- size = 'i';
- param = (void *)&U.textimeout;
- break;
- case EXPP_CONF_ATTR_TEX_COLLECT_RATE:
- min = 1;
- max = 3600;
- size = 'i';
- param = (void *)&U.texcollectrate;
- break;
- case EXPP_CONF_ATTR_MEM_CACHE_LIMIT:
- min = 1;
- max = 1024;
- size = 'i';
- param = (void *)&U.memcachelimit;
- break;
- case EXPP_CONF_ATTR_FONT_SIZE:
- min = 8;
- max = 16;
- size = 'i';
- param = (void *)&U.fontsize;
- break;
-
- default:
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "undefined type in setIntAttrClamp");
- }
- return EXPP_setIValueClamped( value, param, min, max, size );
-}
-
-static PyGetSetDef Config_getseters[] = {
-
- /* ints & shorts */
- {"undoSteps",
- (getter)getIntAttr, (setter)setIntAttrClamp,
- "undo steps",
- (void *)EXPP_CONF_ATTR_UNDOSTEPS},
- {"textureTimeout",
- (getter)getIntAttr, (setter)setIntAttrClamp,
- "time for textures to stay in openGL memory",
- (void *)EXPP_CONF_ATTR_TEX_TIMEOUT},
- {"textureCollectRate",
- (getter)getIntAttr, (setter)setIntAttrClamp,
- "intervel for textures to be tagged as used",
- (void *)EXPP_CONF_ATTR_TEX_COLLECT_RATE},
- {"sequenceMemCacheLimit",
- (getter)getIntAttr, (setter)setIntAttrClamp,
- "maximum memory for the sequencer to use as cache",
- (void *)EXPP_CONF_ATTR_MEM_CACHE_LIMIT},
- {"fontSize",
- (getter)getIntAttr, (setter)setIntAttrClamp,
- "user interface font size",
- (void *)EXPP_CONF_ATTR_FONT_SIZE},
-
- /* Paths */
- {"yfExportDir",
- (getter)getStrAttr, (setter)setStrAttr,
- "yafray export path",
- (void *)EXPP_CONF_ATTR_PATH_YF_EXPORT},
- {"fontDir",
- (getter)getStrAttr, (setter)setStrAttr,
- "default font path",
- (void *)EXPP_CONF_ATTR_PATH_FONT},
- {"renderDir",
- (getter)getStrAttr, (setter)setStrAttr,
- "default render path",
- (void *)EXPP_CONF_ATTR_PATH_RENDER},
- {"textureDir",
- (getter)getStrAttr, (setter)setStrAttr,
- "default texture path",
- (void *)EXPP_CONF_ATTR_PATH_TEXTURE},
- {"userScriptsDir",
- (getter)getStrAttr, (setter)setStrAttr,
- "user scripts path",
- (void *)EXPP_CONF_ATTR_PATH_PYTHON},
- {"texturePluginsDir",
- (getter)getStrAttr, (setter)setStrAttr,
- "default texture plugins path",
- (void *)EXPP_CONF_ATTR_PATH_TEX_PLUGIN},
- {"soundDir",
- (getter)getStrAttr, (setter)setStrAttr,
- "default sound path",
- (void *)EXPP_CONF_ATTR_PATH_SOUND},
- {"sequencePluginsDir",
- (getter)getStrAttr, (setter)setStrAttr,
- "sequencer plugins path",
- (void *)EXPP_CONF_ATTR_PATH_SEQ_PLUGIN},
- {"tempDir",
- (getter)getStrAttr, (setter)setStrAttr,
- "temporary file path",
- (void *)EXPP_CONF_ATTR_PATH_TEMP},
-
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-
-/*
- * Python Config_Type structure definition
- */
-PyTypeObject Config_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender Config", /* char *tp_name; */
- sizeof( BPy_Config ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL, /* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- NULL, /* cmpfunc tp_compare; */
- (reprfunc)Config_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- 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; */
- 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, /* 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, /* 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 ***/
- NULL, /*BPy_Config_methods*/ /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- Config_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
diff --git a/source/blender/python/api2_2x/bpy_data.c b/source/blender/python/api2_2x/bpy_data.c
deleted file mode 100644
index fd5fe27fbaf..00000000000
--- a/source/blender/python/api2_2x/bpy_data.c
+++ /dev/null
@@ -1,817 +0,0 @@
-/*
- * $Id: bpy_data.c 12056 2007-09-17 06:11:06Z aligorith $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Campbell Barton
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#include "bpy_data.h"
-
-#include "MEM_guardedalloc.h" /* for MEM_callocN */
-#include "DNA_space_types.h" /* SPACE_VIEW3D, SPACE_SEQ */
-#include "DNA_scene_types.h"
-#include "DNA_object_types.h" /* LibBlockSeq_new */
-#include "DNA_texture_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_ipo_types.h"
-#include "DNA_group_types.h"
-#include "DNA_world_types.h"
-#include "DNA_vfont_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_sound_types.h"
-#include "DNA_text_types.h"
-#include "DNA_action_types.h"
-#include "DNA_meta_types.h"
-
-/* Use the add_* from BKE_* */
-#include "BKE_global.h"
-#include "BKE_utildefines.h" /* clamp */
-#include "BKE_armature.h"
-#include "BKE_ipo.h"
-#include "BKE_image.h"
-#include "BKE_main.h"
-#include "BKE_library.h"
-#include "BKE_lattice.h"
-#include "BKE_object.h"
-#include "BKE_scene.h"
-#include "BKE_sca.h" /*free_text_controllers*/
-#include "BKE_font.h"
-#include "BKE_mball.h"
-#include "BKE_mesh.h"
-#include "BKE_curve.h"
-#include "BKE_material.h"
-#include "BKE_group.h"
-#include "BKE_text.h"
-#include "BKE_texture.h"
-#include "BKE_world.h"
-
-#include "BLI_blenlib.h" /* BLI_countlist */
-#include "BIF_drawscene.h" /* for set_scene */
-#include "BIF_screen.h" /* curarea */
-#include "BIF_drawimage.h" /* what image */
-#include "BIF_drawtext.h" /* unlink_text */
-#include "BIF_editsound.h" /* sound_new_sound */
-#include "BIF_editaction.h" /* add_empty_action */
-
-/* python types */
-#include "../BPY_extern.h" /* clearing scriptlinks */
-
-#include "gen_utils.h"
-#include "gen_library.h" /* generic ID functions */
-
-#include "Object.h"
-#include "Camera.h"
-#include "Armature.h"
-#include "Lamp.h"
-#include "Curve.h"
-#include "NMesh.h"
-#include "Mesh.h"
-#include "Lattice.h"
-#include "Metaball.h"
-#include "Text.h"
-#include "Text3d.h"
-#include "Font.h"
-#include "Group.h"
-#include "World.h"
-#include "Texture.h"
-#include "Ipo.h"
-#include "Text.h"
-#include "Sound.h"
-#include "NLA.h"
-#include "Scene.h"
-#include "Library.h"
-
-#include "bpy_config.h" /* config pydata */
-
-/* used only for texts.active */
-#include "BIF_screen.h"
-#include "DNA_space_types.h"
-#include "DNA_screen_types.h"
-
-extern VFont *get_builtin_font(void);
-
-static PyObject *LibBlockSeq_CreatePyObject( Link *iter, int type )
-{
- BPy_LibBlockSeq *seq = PyObject_NEW( BPy_LibBlockSeq, &LibBlockSeq_Type);
- seq->iter = iter;
- seq->type = type;
- return (PyObject *)seq;
-}
-
-
-static int LibBlockSeq_len( BPy_LibBlockSeq * self )
-{
- ListBase *lb = wich_libbase(G.main, self->type);
- return BLI_countlist( lb );
-}
-
-static PyObject * LibBlockSeq_subscript(BPy_LibBlockSeq * self, PyObject *key)
-{
- char *name;
- char *lib= NULL;
- char use_lib = 0;
- ID *id;
-
- id = (ID *)wich_libbase(G.main, self->type)->first;
-
- if ( PyString_Check(key) ) {
- name = PyString_AsString ( key );
- } else if (PyTuple_Check(key) && (PyTuple_Size(key) == 2) ) {
- PyObject *pydata;
- use_lib = 1;
-
- /* Get the first arg */
- pydata = PyTuple_GET_ITEM(key, 0);
- if (!PyString_Check(pydata)) {
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "the data name must be a string" );
- }
-
- name = PyString_AsString ( pydata );
-
- /* Get the second arg */
- pydata = PyTuple_GET_ITEM(key, 1);
- if (pydata == Py_None) {
- lib = NULL; /* data must be local */
- } else if (PyString_Check(pydata)) {
- lib = PyString_AsString ( pydata );
- if (!strcmp( "", lib)) {
- lib = NULL; /* and empty string also means data must be local */
- }
- } else {
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "the lib name must be a string or None" );
- }
- } else {
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected the a name string or a tuple (lib, name)" );
- }
-
- for (; id; id = id->next) {
- if(!strcmp( name, id->name+2 )) {
- if (
- (!use_lib) || /* any data, local or external lib data */
- (use_lib && !lib && !id->lib) || /* only local */
- (lib && use_lib && id->lib && (!strcmp( id->lib->name, lib))) /* only external lib */
- )
- {
- return GetPyObjectFromID(id);
- }
- }
- }
- return ( EXPP_ReturnPyObjError
- ( PyExc_KeyError, "Requested data does not exist") );
-}
-
-static PyMappingMethods LibBlockSeq_as_mapping = {
- ( inquiry ) LibBlockSeq_len, /* mp_length */
- ( binaryfunc ) LibBlockSeq_subscript, /* mp_subscript */
- ( objobjargproc ) 0, /* mp_ass_subscript */
-};
-
-
-/************************************************************************
- *
- * Python LibBlockSeq_Type iterator (iterates over GroupObjects)
- *
- ************************************************************************/
-
-/*
- * Initialize the interator index
- */
-
-static PyObject *LibBlockSeq_getIter( BPy_LibBlockSeq * self )
-{
- /* we need to get the first base, but for selected context we may need to advance
- to the first selected or first conext base */
-
- ListBase *lb;
- Link *link;
- lb = wich_libbase(G.main, self->type);
-
- link = lb->first;
-
- /* create a new iterator if were alredy using this one */
- if (self->iter==NULL) {
- self->iter = link;
- return EXPP_incr_ret ( (PyObject *) self );
- } else {
- return LibBlockSeq_CreatePyObject(link, self->type);
- }
-}
-
-/*
- * Return next LibBlockSeq iter.
- */
-
-static PyObject *LibBlockSeq_nextIter( BPy_LibBlockSeq * self )
-{
- PyObject *object;
- Link *link;
- if( !(self->iter) ) {
- self->iter= NULL;
- return EXPP_ReturnPyObjError( PyExc_StopIteration,
- "iterator at end" );
- }
-
- object = GetPyObjectFromID((ID *)self->iter);
-
- link= self->iter->next;
- self->iter= link;
- return object;
-}
-
-PyObject *LibBlockSeq_getActive(BPy_LibBlockSeq *self)
-{
- switch (self->type) {
- case ID_SCE:
- if ( !G.scene ) {
- Py_RETURN_NONE;
- } else {
- return Scene_CreatePyObject( ( Scene * ) G.scene );
- }
-
- break;
- case ID_IM:
- if (!G.sima || !G.sima->image) {
- Py_RETURN_NONE;
- } else {
- what_image( G.sima ); /* make sure image data exists */
- return Image_CreatePyObject( G.sima->image );
- }
- break;
- case ID_TXT: {
- SpaceText *st= curarea->spacedata.first;
-
- if (st->spacetype!=SPACE_TEXT || st->text==NULL) {
- Py_RETURN_NONE;
- } else {
- return Text_CreatePyObject( st->text );
- }
- }
- }
-
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "Only Scene and Image types have the active attribute" );
-}
-
-static int LibBlockSeq_setActive(BPy_LibBlockSeq *self, PyObject *value)
-{
- switch (self->type) {
- case ID_SCE:
- if (!BPy_Scene_Check(value)) {
- return EXPP_ReturnIntError(PyExc_TypeError,
- "Must be a scene" );
- } else {
- BPy_Scene *bpydata;
- Scene *data;
-
- bpydata = (BPy_Scene *)value;
- data= bpydata->scene;
-
- if (!data)
- return EXPP_ReturnIntError(PyExc_RuntimeError,
- "This Scene has been removed" );
-
- if (data != G.scene) {
- set_scene( data );
- scene_update_for_newframe(data, data->lay);
- }
- }
- return 0;
-
- case ID_IM:
- if (!BPy_Image_Check(value)) {
- return EXPP_ReturnIntError(PyExc_TypeError,
- "Must be a scene" );
- } else {
- BPy_Image *bpydata;
- Image *data;
-
- if (!G.sima)
- return 0;
-
- bpydata = (BPy_Image *)value;
- data= bpydata->image;
-
- if (!data)
- return EXPP_ReturnIntError(PyExc_RuntimeError,
- "This Scene has been removed" );
-
- if (data != G.sima->image)
- G.sima->image= data;
- }
- return 0;
-
- case ID_TXT:
- if (!BPy_Text_Check(value)) {
- return EXPP_ReturnIntError(PyExc_TypeError,
- "Must be a text" );
- } else {
- SpaceText *st= curarea->spacedata.first;
- Text *data = ((BPy_Text *)value)->text;
-
- if( !data )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "This object isn't linked to a Blender Text Object" );
- if(st->spacetype!=SPACE_TEXT)
- return 0;
- st->text = data;
- }
- return 0;
- }
-
- return EXPP_ReturnIntError( PyExc_TypeError,
- "Only Scene and Image types have the active attribute" );
-}
-
-static int LibBlockSeq_setTag(BPy_LibBlockSeq *self, PyObject *value)
-{
- ID *id;
- int param = PyObject_IsTrue( value );
-
- if( param == -1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected True/False or 0/1" );
-
- id = (ID *)wich_libbase(G.main, self->type)->first;
-
- if (param) {
- for (; id; id = id->next) {
- id->flag |= LIB_DOIT;
- }
- } else {
- for (; id; id = id->next) {
- id->flag &= ~LIB_DOIT;
- }
- }
-
- return 0;
-}
-
-
-/* New Data, internal functions */
-Mesh *add_mesh__internal(char *name)
-{
- Mesh *mesh = add_mesh(name); /* doesn't return NULL now, but might someday */
-
- /* Bound box set to null needed because a new mesh is initialized
- with a bounding box of -1 -1 -1 -1 -1 -1
- if its not set to null the bounding box is not re-calculated
- when ob.getBoundBox() is called.*/
- MEM_freeN(mesh->bb);
- mesh->bb= NULL;
- return mesh;
-}
-
-/* used for new and load */
-PyObject *LibBlockSeq_new(BPy_LibBlockSeq *self, PyObject * args, PyObject *kwd)
-{
- ID *id = NULL;
- char *name=NULL, *filename=NULL, *data_type=NULL;
- int img_width=256, img_height=256;
- float color[] = {0, 0, 0, 1};
- short data_code = 0;
- int user_count = 0;
-
- /* Load from file */
- if ( ( self->type==ID_IM || self->type==ID_VF ||
- self->type==ID_SO || self->type==ID_TXT) &&
- ( PyTuple_Size( args ) < 3 ))
- {
- static char *kwlist[] = {"name", "filename", NULL};
-
- if(PyArg_ParseTupleAndKeywords(args, kwd, "|ss", kwlist, &name, &filename) && filename ) {
- PyObject *ret= NULL;
-
- if (strlen(filename) > FILE_MAXDIR + FILE_MAXFILE - 1)
- return ( EXPP_ReturnPyObjError( PyExc_IOError,
- "filename too long" ) );
-
- if (self->type == ID_IM) {
- Image *img = BKE_add_image_file( filename );
- if (!img)
- return ( EXPP_ReturnPyObjError( PyExc_IOError,
- "couldn't load image" ) );
- ret = Image_CreatePyObject( img );
-
- } else if (self->type == ID_VF) {
- VFont *vf = load_vfont (filename);
- if (!vf)
- return EXPP_ReturnPyObjError( PyExc_IOError,
- "couldn't load font" );
- ret = Font_CreatePyObject(vf);
-
- } else if (self->type == ID_SO) {
- bSound *snd = sound_new_sound( filename );
- if (!snd)
- return EXPP_ReturnPyObjError( PyExc_IOError,
- "couldn't load sound" );
- ret = Sound_CreatePyObject(snd);
-
- } else if (self->type == ID_TXT) {
- Text *txt = NULL;
- txt = add_text( filename );
- if( !txt )
- return EXPP_ReturnPyObjError( PyExc_IOError,
- "couldn't load text" );
- ret = Text_CreatePyObject(txt);
- }
-
- if (!ret)
- return EXPP_ReturnPyObjError( PyExc_IOError,
- "couldn't create pyobject on load, unknown error" );
- if (name) {
- ID *id = ((BPy_GenericLib *)ret)->id;
- rename_id( id, name );
- }
- return ret;
- }
- }
-
- /* New Data */
- if (self->type == ID_IM) {
- /* Image, accepts width and height*/
- if( !PyArg_ParseTuple( args, "|sii", &name, &img_width, &img_height ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "one string and two ints expected as arguments" );
- CLAMP(img_width, 4, 5000);
- CLAMP(img_height, 4, 5000);
-
- } else if (self->type == ID_CU) {
- /* Curve, needs name and type strings */
- if( !PyArg_ParseTuple( args, "ss", &name, &data_type ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "two strings expected as arguments" );
-
- if( !strcmp( data_type, "Curve" ) ) data_code = OB_CURVE;
- else if( !strcmp( data_type, "Text3d" ) ) data_code = OB_FONT;/*
- else if( !strcmp( data_type, "Surf" ) ) data_code = OB_SURF;*/
- else return EXPP_ReturnPyObjError( PyExc_TypeError,
- "Second argument for Curve type incorrect\t\nmust be a string in (Curve or Text - Surf is not supported yet)" );
-
- } else if (self->type == ID_IP) {
- /* IPO, needs name and type strings */
- if( !PyArg_ParseTuple( args, "ss", &name, &data_type ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "two strings expected as arguments" );
-
- if( !strcmp( data_type, "Object" ) ) data_code = ID_OB;
- else if( !strcmp( data_type, "Camera" ) ) data_code = ID_CA;
- else if( !strcmp( data_type, "World" ) ) data_code = ID_WO;
- else if( !strcmp( data_type, "Material" ) ) data_code = ID_MA;
- else if( !strcmp( data_type, "Texture" ) ) data_code = ID_TE;
- else if( !strcmp( data_type, "Lamp" ) ) data_code = ID_LA;
- else if( !strcmp( data_type, "Action" ) ) data_code = ID_PO;
- else if( !strcmp( data_type, "Constraint" ) ) data_code = ID_CO;
- else if( !strcmp( data_type, "Sequence" ) ) data_code = ID_SEQ;
- else if( !strcmp( data_type, "Curve" ) ) data_code = ID_CU;
- else if( !strcmp( data_type, "Key" ) ) data_code = ID_KE;
- else return EXPP_ReturnPyObjError( PyExc_TypeError,
- "Second argument for IPO type incorrect\t\nmust be a string in (Object, Camera, World, Material, Texture, Lamp, Action, Sequence, Curve, Key)" );
-
- } else {
- /* Other types only need the name */
- if( !PyArg_ParseTuple( args, "|s", &name ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "new(name) - name must be a string argument" );
- }
-
- switch (self->type) {
- case ID_SCE:
- id = (ID *)add_scene( name?name:"Scene" );
- user_count = 1;
- break;
- case ID_OB:
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "Add objects through the scenes objects iterator" );
- case ID_ME:
- id = (ID *)add_mesh__internal( name?name:"Mesh" );
- break;
- case ID_CU:
- id = (ID *)add_curve( name?name:"Curve", data_code );
- if (data_code==OB_FONT) {
- Text3d *text3d = (Text3d *)id;
- text3d->vfont= get_builtin_font();
- text3d->vfont->id.us++;
- text3d->str= MEM_mallocN(sizeof(wchar_t), "str");
- text3d->str[0] = '\0';
- text3d->totbox= text3d->actbox= 1;
- text3d->tb= MEM_callocN(MAXTEXTBOX*sizeof(TextBox), "textbox");
- text3d->tb[0].w = text3d->tb[0].h = 0.0;
-
- } /*else { CURVE - Dont need to do anything } */
- break;
- case ID_MB:
- id = (ID *)add_mball( name?name:"MBall" );
- break;
- case ID_MA:
- id = (ID *)add_material( name?name:"Material" );
- break;
- case ID_TE:
- id = (ID *)add_texture( name?name:"Texture" );
- break;
- case ID_IM:
- {
- id = (ID *)BKE_add_image_size(img_width, img_height, name?name:"Image", 0, color);
- if( !id )
- return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create PyObject Image_Type" ) );
- /* new images have zero user count */
- break;
- }
- case ID_LT:
- id = (ID *)add_lattice( name?name:"Lattice" );
- break;
- case ID_LA:
- id = (ID *)add_lamp( name?name:"Lamp" );
- break;
- case ID_CA:
- id = (ID *)add_camera( name?name:"Camera" );
- break;
- case ID_IP:
- id = (ID *)add_ipo( name?name:"Ipo", data_code );
- break;
- case ID_WO:
- id = (ID *)add_world( name?name:"World" );
- break;
- case ID_VF:
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "Cannot create new fonts, use the load() function to load from a file" );
- case ID_TXT:
- id = (ID *)add_empty_text( name?name:"Text" );
- user_count = 1;
- break;
- case ID_SO:
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "Cannot create new sounds, use the load() function to load from a file" );
- case ID_GR:
- id = (ID *)add_group( name?name:"Group" );
- user_count = 1;
- break;
- case ID_AR:
- id = (ID *)add_armature( name?name:"Armature" );
- break;
- case ID_AC:
- id = (ID *)add_empty_action( name?name:"Action" );
- user_count = 1;
- break;
- }
-
- if (!id)
- Py_RETURN_NONE;
-
- /* set some types user count to 1, otherwise zero */
- id->us = user_count;
-
- return GetPyObjectFromID(id);
-}
-
-
-PyObject *LibBlockSeq_unlink(BPy_LibBlockSeq *self, PyObject * value)
-{
- switch (self->type) {
- case ID_SCE:
- if( !BPy_Scene_Check(value) ) {
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected Scene object" );
- } else {
- Scene *data = ((BPy_Scene *)value)->scene;
-
- if (!data)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This Scene has been removed" );
-
- /* Run the removal code */
- free_libblock( &G.main->scene, data );
- ((BPy_Scene *)value)->scene = NULL;
- Py_RETURN_NONE;
- }
- case ID_GR:
- if( !BPy_Group_Check(value) ) {
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected Group object" );
- } else {
- Group *data = ((BPy_Group *)value)->group;
-
- if (!data)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This Group has been removed alredy" );
-
- /* Run the removal code */
- free_group(data);
- unlink_group(data);
- data->id.us= 0;
- free_libblock( &G.main->group, data );
- ((BPy_Group *)value)->group = NULL;
-
- Py_RETURN_NONE;
- }
-
- case ID_TXT:
- if( !BPy_Text_Check(value) ) {
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected Text object" );
- } else {
- Text *data = ((BPy_Text *)value)->text;
-
- if (!data)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This Group has been removed alredy" );
-
- /* Run the removal code */
- BPY_clear_bad_scriptlinks( data );
- free_text_controllers( data );
- unlink_text( data );
- free_libblock( &G.main->text, data );
- ((BPy_Text *)value)->text = NULL;
-
- Py_RETURN_NONE;
- }
- }
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "Only types Scene, Group and Text can unlink" );
-}
-
-static int LibBlockSeq_compare( BPy_LibBlockSeq * a, BPy_LibBlockSeq * b )
-{
- return ( a->type == b->type) ? 0 : -1;
-}
-
-/*
- * repr function
- * callback functions building meaninful string to representations
- */
-static PyObject *LibBlockSeq_repr( BPy_LibBlockSeq * self )
-{
- return PyString_FromFormat( "[LibBlockSeq Iterator]");
-}
-
-static PyGetSetDef LibBlockSeq_getseters[] = {
- {"active",
- (getter)LibBlockSeq_getActive, (setter)LibBlockSeq_setActive,
- "active object",
- NULL},
- {"tag",
- (getter)NULL, (setter)LibBlockSeq_setTag,
- "tag all data in True or False (write only)",
- NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-static struct PyMethodDef BPy_LibBlockSeq_methods[] = {
- {"new", (PyCFunction)LibBlockSeq_new, METH_VARARGS | METH_KEYWORDS,
- "(name) - Create a new object in this scene from the obdata given and return a new object"},
- {"unlink", (PyCFunction)LibBlockSeq_unlink, METH_O,
- "unlinks the object from the scene"},
- {NULL, NULL, 0, NULL}
-};
-
-/*****************************************************************************/
-/* Python LibBlockSeq_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject LibBlockSeq_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender LibBlockSeq", /* char *tp_name; */
- sizeof( BPy_LibBlockSeq ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL, /* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- ( cmpfunc ) LibBlockSeq_compare, /* cmpfunc tp_compare; */
- ( reprfunc ) LibBlockSeq_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- &LibBlockSeq_as_mapping, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- NULL, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
- 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, /* 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, /* richcmpfunc tp_richcompare; */
-
- /*** weak reference enabler ***/
- 0, /* long tp_weaklistoffset; */
-
- /*** Added in release 2.2 ***/
- /* Iterators */
- ( getiterfunc) LibBlockSeq_getIter, /* getiterfunc tp_iter; */
- ( iternextfunc ) LibBlockSeq_nextIter, /* iternextfunc tp_iternext; */
-
- /*** Attribute descriptor and subclassing stuff ***/
- BPy_LibBlockSeq_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- LibBlockSeq_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-
-/*-----------------------------BPy module Init())-----------------------------*/
-
-PyObject * Data_Init( void )
-{
- PyObject *module;
- PyObject *dict;
-
-
- PyType_Ready( &LibBlockSeq_Type );
- PyType_Ready( &Config_Type );
-
- /*submodule = Py_InitModule3( "Blender.Main", NULL, M_Main_doc );*/
- module = Py_InitModule3( "bpy.data", NULL, "The bpy.data submodule" );
- dict = PyModule_GetDict( module );
-
- /* Python Data Types */
- PyModule_AddObject( module, "scenes", LibBlockSeq_CreatePyObject(NULL, ID_SCE) );
- PyModule_AddObject( module, "objects", LibBlockSeq_CreatePyObject(NULL, ID_OB) );
- PyModule_AddObject( module, "meshes", LibBlockSeq_CreatePyObject(NULL, ID_ME) );
- PyModule_AddObject( module, "curves", LibBlockSeq_CreatePyObject(NULL, ID_CU) );
- PyModule_AddObject( module, "metaballs",LibBlockSeq_CreatePyObject(NULL, ID_MB) );
- PyModule_AddObject( module, "materials",LibBlockSeq_CreatePyObject(NULL, ID_MA) );
- PyModule_AddObject( module, "textures", LibBlockSeq_CreatePyObject(NULL, ID_TE) );
- PyModule_AddObject( module, "images", LibBlockSeq_CreatePyObject(NULL, ID_IM) );
- PyModule_AddObject( module, "lattices", LibBlockSeq_CreatePyObject(NULL, ID_LT) );
- PyModule_AddObject( module, "lamps", LibBlockSeq_CreatePyObject(NULL, ID_LA) );
- PyModule_AddObject( module, "cameras", LibBlockSeq_CreatePyObject(NULL, ID_CA) );
- PyModule_AddObject( module, "ipos", LibBlockSeq_CreatePyObject(NULL, ID_IP) );
- PyModule_AddObject( module, "worlds", LibBlockSeq_CreatePyObject(NULL, ID_WO) );
- PyModule_AddObject( module, "fonts", LibBlockSeq_CreatePyObject(NULL, ID_VF) );
- PyModule_AddObject( module, "texts", LibBlockSeq_CreatePyObject(NULL, ID_TXT) );
- PyModule_AddObject( module, "sounds", LibBlockSeq_CreatePyObject(NULL, ID_SO) );
- PyModule_AddObject( module, "groups", LibBlockSeq_CreatePyObject(NULL, ID_GR) );
- PyModule_AddObject( module, "armatures",LibBlockSeq_CreatePyObject(NULL, ID_AR) );
- PyModule_AddObject( module, "actions", LibBlockSeq_CreatePyObject(NULL, ID_AC) );
- return module;
-}
diff --git a/source/blender/python/api2_2x/bpy_data.h b/source/blender/python/api2_2x/bpy_data.h
deleted file mode 100644
index 45600df6471..00000000000
--- a/source/blender/python/api2_2x/bpy_data.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Campbell Barton
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_BPYDATA_H
-#define EXPP_BPYDATA_H
-
-#include <Python.h>
-#include "DNA_listBase.h"
-
-/* The Main PyType Object defined in Main.c */
-extern PyTypeObject LibBlockSeq_Type;
-
-#define BPy_LibBlockSeq_Check(v) \
- ((v)->ob_type == &LibBlockSeq_Type)
-
-/* Main sequence, iterate on the libdatas listbase*/
-typedef struct {
- PyObject_VAR_HEAD /* required python macro */
- Link *iter; /* so we can iterate over the listbase */
-
- short type; /* store the ID type such as ID_ME */
-} BPy_LibBlockSeq;
-
-
-PyObject * Data_Init( void );
-
-#endif /* EXPP_BPYDATA_H */
diff --git a/source/blender/python/api2_2x/bpy_types.h b/source/blender/python/api2_2x/bpy_types.h
deleted file mode 100644
index fcada098d1e..00000000000
--- a/source/blender/python/api2_2x/bpy_types.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * $Id: bpy_types.h 4803 2005-07-18 03:50:37Z ascotan $
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_bpy_types_h
-#define EXPP_bpy_types_h
-
-
-/*****************************************************************************/
-/* Camera Data */
-/*****************************************************************************/
-
-
-/*****************************************************************************/
-/* Lamp Data */
-/*****************************************************************************/
-
-/*****************************************************************************/
-/* Ipo Data */
-/*****************************************************************************/
-
-
-
-/*****************************************************************************/
-/* Metaball Data */
-/*****************************************************************************/
-
-
-/*****************************************************************************/
-/* Metaelem Data */
-/*****************************************************************************/
-
-
-/*****************************************************************************/
-/* Effect Data */
-/*****************************************************************************/
-
-/*****************************************************************************/
-/* Wave Data */
-/*****************************************************************************/
-
-
-/*****************************************************************************/
-/* Build Data */
-/*****************************************************************************/
-
-
-/*****************************************************************************/
-/* Particle Data */
-/*****************************************************************************/
-
-/*****************************************************************************/
-/* Curve Data */
-/*****************************************************************************/
-
-/**********
- CurNurb data
-***********/
-
-
-/*****************************************************************************/
-/* World Data */
-/*****************************************************************************/
-
-
-#endif /* EXPP_bpy_types_h */
diff --git a/source/blender/python/api2_2x/charRGBA.c b/source/blender/python/api2_2x/charRGBA.c
deleted file mode 100644
index 087ddecc1c5..00000000000
--- a/source/blender/python/api2_2x/charRGBA.c
+++ /dev/null
@@ -1,475 +0,0 @@
-/*
- * $Id: charRGBA.c 10782 2007-05-26 04:39:31Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#include "charRGBA.h" /*This must come first */
-#include "gen_utils.h"
-
-/* This file is heavily based on the old bpython Constant object code in
- Blender */
-
-/*****************************************************************************/
-/* Python charRGBA_Type callback function prototypes: */
-/*****************************************************************************/
-static PyObject *charRGBA_repr( BPy_charRGBA * self );
-
-static int charRGBALength( BPy_charRGBA * self );
-
-static PyObject *charRGBASubscript( BPy_charRGBA * self, PyObject * key );
-static int charRGBAAssSubscript( BPy_charRGBA * self, PyObject * who,
- PyObject * cares );
-
-static PyObject *charRGBAItem( BPy_charRGBA * self, int i );
-static int charRGBAAssItem( BPy_charRGBA * self, int i, PyObject * ob );
-static PyObject *charRGBASlice( BPy_charRGBA * self, int begin, int end );
-static int charRGBAAssSlice( BPy_charRGBA * self, int begin, int end,
- PyObject * seq );
-static PyObject *charRGBA_getColor( BPy_charRGBA * self, void * type);
-static int charRGBA_setColor( BPy_charRGBA * self, PyObject * value, void * type);
-
-/*****************************************************************************/
-/* Python charRGBA_Type Mapping Methods table: */
-/*****************************************************************************/
-static PyMappingMethods charRGBAAsMapping = {
- ( inquiry ) charRGBALength, /* mp_length */
- ( binaryfunc ) charRGBASubscript, /* mp_subscript */
- ( objobjargproc ) charRGBAAssSubscript, /* mp_ass_subscript */
-};
-
-/*****************************************************************************/
-/* Python charRGBA_Type Sequence Methods table: */
-/*****************************************************************************/
-static PySequenceMethods charRGBAAsSequence = {
- ( inquiry ) charRGBALength, /* sq_length */
- ( binaryfunc ) 0, /* sq_concat */
- ( intargfunc ) 0, /* sq_repeat */
- ( intargfunc ) charRGBAItem, /* sq_item */
- ( intintargfunc ) charRGBASlice, /* sq_slice */
- ( intobjargproc ) charRGBAAssItem, /* sq_ass_item */
- ( intintobjargproc ) charRGBAAssSlice, /* sq_ass_slice */
-};
-
-static PyGetSetDef charRGBA_getseters[] = {
- {"R",
- (getter)charRGBA_getColor, (setter)charRGBA_setColor,
- "the red component",
- (void *) 0},
- {"r",
- (getter)charRGBA_getColor, (setter)charRGBA_setColor,
- "the red component",
- (void *) 0},
- {"G",
- (getter)charRGBA_getColor, (setter)charRGBA_setColor,
- "the green component",
- (void *) 1},
- {"g",
- (getter)charRGBA_getColor, (setter)charRGBA_setColor,
- "the green component",
- (void *) 1},
- {"B",
- (getter)charRGBA_getColor, (setter)charRGBA_setColor,
- "the blue component",
- (void *) 2},
- {"b",
- (getter)charRGBA_getColor, (setter)charRGBA_setColor,
- "the blue component",
- (void *) 2},
- {"A",
- (getter)charRGBA_getColor, (setter)charRGBA_setColor,
- "the alpha component",
- (void *) 3},
- {"a",
- (getter)charRGBA_getColor, (setter)charRGBA_setColor,
- "the alpha component",
- (void *) 3},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-/*****************************************************************************/
-/* Python charRGBA_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject charRGBA_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "charRGBA", /* tp_name */
- sizeof( BPy_charRGBA ), /* tp_basicsize */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL, /* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- NULL, /* cmpfunc tp_compare; */
- ( reprfunc ) charRGBA_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- &charRGBAAsSequence, /* PySequenceMethods *tp_as_sequence; */
- &charRGBAAsMapping, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- NULL, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
- 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, /* 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, /* 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 ***/
- NULL, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- charRGBA_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-/*****************************************************************************/
-/* Function: charRGBA_New */
-/*****************************************************************************/
-PyObject *charRGBA_New( char *rgba )
-{
- BPy_charRGBA *charRGBA = NULL;
-
- /*
- * When called the first time, charRGBA_Type.tp_dealloc will be NULL.
- * If that's the case, initialize the PyTypeObject. If the
- * initialization succeeds, then create a new object.
- */
-
- if( charRGBA_Type.tp_dealloc || PyType_Ready( &charRGBA_Type ) >= 0 ) {
- charRGBA = ( BPy_charRGBA * ) PyObject_NEW( BPy_charRGBA,
- &charRGBA_Type );
- }
-
- if( charRGBA == NULL )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create charRGBA object" );
-
- /* rgba is a pointer to the first item of a char[4] array */
- charRGBA->rgba[0] = &rgba[0];
- charRGBA->rgba[1] = &rgba[1];
- charRGBA->rgba[2] = &rgba[2];
- charRGBA->rgba[3] = &rgba[3];
-
- return ( PyObject * ) charRGBA;
-}
-
-/*****************************************************************************/
-/* Functions: charRGBA_getCol and charRGBA_setCol */
-/* Description: These functions get/set rgba color triplet values. The */
-/* get function returns a tuple, the set one accepts three */
-/* chars (separated or in a tuple) as arguments. */
-/*****************************************************************************/
-PyObject *charRGBA_getCol( BPy_charRGBA * self )
-{
- PyObject *list = PyList_New( 4 );
-
- if( !list )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create PyList" );
-
- PyList_SET_ITEM( list, 0, PyInt_FromLong( *(self->rgba[0])) );
- PyList_SET_ITEM( list, 1, PyInt_FromLong( *(self->rgba[1])) );
- PyList_SET_ITEM( list, 2, PyInt_FromLong( *(self->rgba[2])) );
- PyList_SET_ITEM( list, 3, PyInt_FromLong( *(self->rgba[3])) );
- return list;
-}
-
-PyObject *charRGBA_setCol( BPy_charRGBA * self, PyObject * args )
-{
- int ok;
- char r = 0, g = 0, b = 0, a = 0;
-
- if( PyObject_Length( args ) == 4 )
- ok = PyArg_ParseTuple( args, "bbbb", &r, &g, &b, &a );
-
- else
- ok = PyArg_ParseTuple( args, "|(bbbb)", &r, &g, &b, &a );
-
- if( !ok )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected 1-byte ints [b,b,b,b] or b,b,b,b as arguments (or nothing)" );
-
- *( self->rgba[0] ) = (char)EXPP_ClampInt( r, 0, 255 );
- *( self->rgba[1] ) = (char)EXPP_ClampInt( g, 0, 255 );
- *( self->rgba[2] ) = (char)EXPP_ClampInt( b, 0, 255 );
- *( self->rgba[3] ) = (char)EXPP_ClampInt( a, 0, 255 );
-
- return EXPP_incr_ret( Py_None );
-}
-
-/* return color value for one of the components */
-
-static PyObject *charRGBA_getColor( BPy_charRGBA * self, void * type)
-{
- int index = ((long)type) & 3;
- return PyInt_FromLong ( *self->rgba[index] );
-}
-
-/* sets the color value of one of the components */
-
-static int charRGBA_setColor( BPy_charRGBA * self, PyObject * value,
- void * type)
-{
- int index = ((long)type) & 3;
- PyObject *num = PyNumber_Int( value );
-
- /* argument must be a number */
- if( !num )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected char argument" );
-
- /* clamp valut to 0..255 then assign */
- *self->rgba[index] = (char)EXPP_ClampInt( (int)PyInt_AS_LONG(value),
- 0, 255 );
- Py_DECREF( num );
- return 0;
-}
-
-/*****************************************************************************/
-/* Section: charRGBA as Mapping */
-/* These functions provide code to access charRGBA objects as */
-/* mappings. */
-/*****************************************************************************/
-static int charRGBALength( BPy_charRGBA * self )
-{
- return 4;
-}
-
-static PyObject *charRGBASubscript( BPy_charRGBA * self, PyObject * key )
-{
- char *name = NULL;
- int i;
-
- if( PyNumber_Check( key ) )
- return charRGBAItem( self, ( int ) PyInt_AsLong( key ) );
-
- if( !PyArg_ParseTuple( key, "s", &name ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int or string argument" );
-
- if( !strcmp( name, "R" ) || !strcmp( name, "r" ) )
- i = 0;
- else if( !strcmp( name, "G" ) || !strcmp( name, "g" ) )
- i = 1;
- else if( !strcmp( name, "B" ) || !strcmp( name, "b" ) )
- i = 2;
- else if( !strcmp( name, "A" ) || !strcmp( name, "a" ) )
- i = 3;
- else
- return EXPP_ReturnPyObjError( PyExc_AttributeError, name );
-
- return PyInt_FromLong( (long)(*self->rgba[i]) );
-}
-
-static int charRGBAAssSubscript( BPy_charRGBA * self, PyObject * key,
- PyObject * v )
-{
- char *name = NULL;
- int i;
-
- if( !PyNumber_Check( v ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "value to assign must be a number" );
-
- if( PyNumber_Check( key ) )
- return charRGBAAssItem( self, ( int ) PyInt_AsLong( key ), v );
-
- if( !PyArg_Parse( key, "s", &name ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected int or string argument" );
-
- if( !strcmp( name, "R" ) || !strcmp( name, "r" ) )
- i = 0;
- else if( !strcmp( name, "G" ) || !strcmp( name, "g" ) )
- i = 1;
- else if( !strcmp( name, "B" ) || !strcmp( name, "b" ) )
- i = 2;
- else if( !strcmp( name, "A" ) || !strcmp( name, "a" ) )
- i = 3;
- else
- return EXPP_ReturnIntError( PyExc_AttributeError, name );
-
- *( self->rgba[i] ) = (char)EXPP_ClampInt( PyInt_AsLong( v ), 0, 255 );
-
- return 0;
-}
-
-/*****************************************************************************/
-/* Section: charRGBA as Sequence */
-/* These functions provide code to access charRGBA objects as */
-/* sequences. */
-/*****************************************************************************/
-static PyObject *charRGBAItem( BPy_charRGBA * self, int i )
-{
- if( i < 0 || i >= 4 )
- return EXPP_ReturnPyObjError( PyExc_IndexError,
- "array index out of range" );
-
- return PyInt_FromLong( *(self->rgba[i]) );
-}
-
-static PyObject *charRGBASlice( BPy_charRGBA * self, int begin, int end )
-{
- PyObject *list;
- int count;
-
- if( begin < 0 )
- begin = 0;
- if( end > 4 )
- end = 4;
- if( begin > end )
- begin = end;
-
- list = PyList_New( end - begin );
-
- for( count = begin; count < end; count++ )
- PyList_SetItem( list, count - begin,
- PyInt_FromLong( *( self->rgba[count] ) ) );
-
- return list;
-}
-
-static int charRGBAAssItem( BPy_charRGBA * self, int i, PyObject * ob )
-{
- if( i < 0 || i >= 4 )
- return EXPP_ReturnIntError( PyExc_IndexError,
- "array assignment index out of range" );
-
- if( !PyNumber_Check( ob ) )
- return EXPP_ReturnIntError( PyExc_IndexError,
- "color component must be a number" );
-
- *( self->rgba[i] ) = (char)EXPP_ClampInt( PyInt_AsLong( ob ), 0, 255 );
-
- return 0;
-}
-
-static int charRGBAAssSlice( BPy_charRGBA * self, int begin, int end,
- PyObject * seq )
-{
- int count;
-
- if( begin < 0 )
- begin = 0;
- if( end > 4 )
- end = 4;
- if( begin > end )
- begin = end;
-
- if( !PySequence_Check( seq ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "illegal argument type for built-in operation" );
-
- if( PySequence_Length( seq ) != ( end - begin ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "size mismatch in slice assignment" );
-
- for( count = begin; count < end; count++ ) {
- char value;
- PyObject *ob = PySequence_GetItem( seq, count );
-
- if( !PyArg_Parse( ob, "b", &value ) ) {
- Py_DECREF( ob );
- return -1;
- }
-
- *( self->rgba[count] ) = (char)EXPP_ClampInt( value, 0, 255 );
-
- Py_DECREF( ob );
- }
-
- return 0;
-}
-
-/*****************************************************************************/
-/* Function: charRGBA_repr */
-/* Description: This is a callback function for the BPy_charRGBA type. It */
-/* builds a meaninful string to represent charRGBA objects. */
-/*****************************************************************************/
-static PyObject *charRGBA_repr( BPy_charRGBA * self )
-{
- char r, g, b, a;
-
- r = *( self->rgba[0] );
- g = *( self->rgba[1] );
- b = *( self->rgba[2] );
- a = *( self->rgba[3] );
-
- return PyString_FromFormat( "[%d, %d, %d, %d]", r, g, b, a );
-}
diff --git a/source/blender/python/api2_2x/charRGBA.h b/source/blender/python/api2_2x/charRGBA.h
deleted file mode 100644
index 9cc3dc739d1..00000000000
--- a/source/blender/python/api2_2x/charRGBA.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * $Id: charRGBA.h 10280 2007-03-16 14:44:31Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_charRGBA_H
-#define EXPP_charRGBA_H
-
-#include <Python.h>
-
-/* Objects of <type 'charRGBA'> are used inside other Blender Python
- * objects, so this header file must contain only 'public' declarations */
-/* there's also rgbTuple, for rgb floats and a color obj in NMesh, messy! */
-
-/* Python BPy_charRGBA structure definition: */
-
-typedef struct {
- PyObject_HEAD
- char *rgba[4]; /* array of four pointers to chars */
-
-} BPy_charRGBA;
-
-extern PyTypeObject charRGBA_Type;
-
-/*****************************************************************************/
-/* Python API function prototypes for the charRGBA helper module. */
-/*****************************************************************************/
-PyObject *charRGBA_New( char *rgba );
-PyObject *charRGBA_getCol( BPy_charRGBA * self );
-PyObject *charRGBA_setCol( BPy_charRGBA * self, PyObject * args );
-
-#endif /* EXPP_charRGBA_H */
diff --git a/source/blender/python/api2_2x/constant.c b/source/blender/python/api2_2x/constant.c
deleted file mode 100644
index 1034fbd616c..00000000000
--- a/source/blender/python/api2_2x/constant.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * $Id: constant.c 10778 2007-05-25 16:43:25Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano, Joseph Gilbert
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#include "constant.h" /*This must come first */
-
-#include "gen_utils.h"
-#include "BLI_blenlib.h"
-
-PyTypeObject constant_Type;
-
-//------------------METHOD IMPLEMENTATIONS-----------------------------
-//------------------------constant.items()
-//Returns a list of key:value pairs like dict.items()
-PyObject* constant_items(BPy_constant *self)
-{
- return PyDict_Items(self->dict);
-}
-//------------------------constant.keys()
-//Returns a list of keys like dict.keys()
-PyObject* constant_keys(BPy_constant *self)
-{
- return PyDict_Keys(self->dict);
-}
-//------------------------constant.values()
-//Returns a list of values like dict.values()
-PyObject* constant_values(BPy_constant *self)
-{
- return PyDict_Values(self->dict);
-}
-//------------------ATTRIBUTE IMPLEMENTATION---------------------------
-//------------------TYPE_OBECT IMPLEMENTATION--------------------------
-//-----------------------(internal)
-//Creates a new constant object
-static PyObject *new_const(void)
-{
- BPy_constant *constant;
-
- constant = (BPy_constant *) PyObject_NEW(BPy_constant, &constant_Type);
- if(constant == NULL){
- return (EXPP_ReturnPyObjError(PyExc_MemoryError,
- "couldn't create constant object"));
- }
- if((constant->dict = PyDict_New()) == NULL){
- return (EXPP_ReturnPyObjError(PyExc_MemoryError,
- "couldn't create constant object's dictionary"));
- }
-
- return (PyObject *)constant;
-}
-//------------------------tp_doc
-//The __doc__ string for this object
-static char BPy_constant_doc[] = "This is an internal subobject of armature\
-designed to act as a Py_Bone dictionary.";
-
-//------------------------tp_methods
-//This contains a list of all methods the object contains
-static PyMethodDef BPy_constant_methods[] = {
- {"items", (PyCFunction) constant_items, METH_NOARGS,
- "() - Returns the key:value pairs from the dictionary"},
- {"keys", (PyCFunction) constant_keys, METH_NOARGS,
- "() - Returns the keys the dictionary"},
- {"values", (PyCFunction) constant_values, METH_NOARGS,
- "() - Returns the values from the dictionary"},
- {NULL, NULL, 0, NULL}
-};
-//------------------------mp_length
-static int constantLength(BPy_constant *self)
-{
- return 0;
-}
-//------------------------mp_subscript
-static PyObject *constantSubscript(BPy_constant *self, PyObject *key)
-{
- if(self->dict) {
- PyObject *v = PyDict_GetItem(self->dict, key);
- if(v) {
- return EXPP_incr_ret(v);
- }
- return EXPP_ReturnPyObjError( PyExc_KeyError,
- "key not found" );
- }
- return NULL;
-}
-//------------------------mp_ass_subscript
-static int constantAssSubscript(BPy_constant *self, PyObject *who, PyObject *cares)
-{
- return 0; /* no user assignments allowed */
-}
-//------------------------tp_getattro
-static PyObject *constant_getAttro(BPy_constant * self, PyObject *value)
-{
- if(self->dict) {
- PyObject *v;
- char *name = PyString_AS_STRING( value );
-
- if(!strcmp(name, "__members__"))
- return PyDict_Keys(self->dict);
-
-#if 0
- if(!strcmp(name, "__methods__") || !strcmp(name, "__dict__")) {
- return PyObject_GenericGetAttr( (PyObject *)self, value );
- }
-#endif
-
- v = PyDict_GetItemString(self->dict, name);
- if(v) {
- return EXPP_incr_ret(v); /* was a borrowed ref */
- }
- return PyObject_GenericGetAttr( (PyObject *)self, value );
- }
- return (EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "constant object lacks a dictionary"));
-}
-//------------------------tp_repr
-static PyObject *constant_repr(BPy_constant * self)
-{
- char str[4096];
- PyObject *key, *value, *tempstr;
- int pos = 0;
-
- BLI_strncpy(str,"[Constant: ",4096);
- tempstr = PyString_FromString("name");
- value = PyDict_GetItem( self->dict, tempstr );
- Py_DECREF(tempstr);
- if(value) {
- strcat(str, PyString_AsString(value));
- } else {
- short sep = 0;
- strcat(str,"{");
- while (PyDict_Next(self->dict, &pos, &key, &value)) {
- if( sep )
- strcat (str, ", ");
- else
- sep = 1;
- strcat (str, PyString_AsString(key));
- }
- strcat(str,"}");
- }
- strcat(str, "]");
- return PyString_FromString(str);
-}
-//------------------------tp_dealloc
-static void constant_dealloc(BPy_constant * self)
-{
- Py_DECREF(self->dict);
- PyObject_DEL(self);
-}
-
-//------------------TYPE_OBECT DEFINITION------------------------------
-static PyMappingMethods constantAsMapping = {
- (inquiry) constantLength, // mp_length
- (binaryfunc) constantSubscript, // mp_subscript
- (objobjargproc) constantAssSubscript, // mp_ass_subscript
-};
-
-PyTypeObject constant_Type = {
- PyObject_HEAD_INIT(NULL) //tp_head
- 0, //tp_internal
- "Constant", //tp_name
- sizeof(BPy_constant), //tp_basicsize
- 0, //tp_itemsize
- (destructor)constant_dealloc, //tp_dealloc
- 0, //tp_print
- 0, //tp_getattr
- 0, //tp_setattr
- 0, //tp_compare
- (reprfunc) constant_repr, //tp_repr
- 0, //tp_as_number
- 0, //tp_as_sequence
- &constantAsMapping, //tp_as_mapping
- 0, //tp_hash
- 0, //tp_call
- 0, //tp_str
- (getattrofunc)constant_getAttro, //tp_getattro
- 0, //tp_setattro
- 0, //tp_as_buffer
- Py_TPFLAGS_DEFAULT, //tp_flags
- BPy_constant_doc, //tp_doc
- 0, //tp_traverse
- 0, //tp_clear
- 0, //tp_richcompare
- 0, //tp_weaklistoffset
- 0, //tp_iter
- 0, //tp_iternext
- BPy_constant_methods, //tp_methods
- 0, //tp_members
- 0, //tp_getset
- 0, //tp_base
- 0, //tp_dict
- 0, //tp_descr_get
- 0, //tp_descr_set
- 0, //tp_dictoffset
- 0, //tp_init
- 0, //tp_alloc
- 0, //tp_new
- 0, //tp_free
- 0, //tp_is_gc
- 0, //tp_bases
- 0, //tp_mro
- 0, //tp_cache
- 0, //tp_subclasses
- 0, //tp_weaklist
- 0 //tp_del
-};
-//------------------VISIBLE PROTOTYPE IMPLEMENTATION-------------------
-//Creates a default empty constant
-PyObject *PyConstant_New(void)
-{
- return new_const();
-}
-//Inserts a key:value pair into the constant and then returns 0/1
-int PyConstant_Insert(BPy_constant *self, char *name, PyObject *value)
-{
- PyType_Ready( &constant_Type );
- return EXPP_dict_set_item_str(self->dict, name, value);
-}
-//This is a helper function for generating constants......
-PyObject *PyConstant_NewInt(char *name, int value)
-{
- PyObject *constant = PyConstant_New();
-
- if (constant)
- {
- PyConstant_Insert((BPy_constant*)constant, "name", PyString_FromString(name));
- PyConstant_Insert((BPy_constant*)constant, "value", PyInt_FromLong(value));
- }
- return constant;
-}
-//This is a helper function for generating constants......
-PyObject *PyConstant_NewString(char *name, char *value)
-{
- PyObject *constant = PyConstant_New();
-
- if (constant)
- {
- PyConstant_Insert((BPy_constant*)constant, "name", PyString_FromString(name));
- PyConstant_Insert((BPy_constant*)constant, "value", PyString_FromString(value));
- }
- return constant;
-}
diff --git a/source/blender/python/api2_2x/constant.h b/source/blender/python/api2_2x/constant.h
deleted file mode 100644
index 1e325cef012..00000000000
--- a/source/blender/python/api2_2x/constant.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * $Id: constant.h 7089 2006-03-18 15:23:02Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano, Joseph Gilbert
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_constant_H
-#define EXPP_constant_H
-
-#include <Python.h>
-
-/*-------------------TYPE CHECKS-------------------------------*/
-#define BPy_Constant_Check(v) ((v)->ob_type==&constant_Type)
-/*-------------------TYPEOBJECT--------------------------------*/
-extern PyTypeObject constant_Type;
-/*-------------------STRUCT DEFINITION-------------------------*/
-typedef struct {
- PyObject_HEAD
- PyObject * dict;
-} BPy_constant;
-/*-------------------VISIBLE PROTOTYPES-----------------------*/
-PyObject *PyConstant_New(void);
-int PyConstant_Insert(BPy_constant *self, char *name, PyObject *value);
-PyObject *PyConstant_NewInt(char *name, int value);
-PyObject *PyConstant_NewString(char *name, char *value);
-
-#endif /* EXPP_constant_H */
diff --git a/source/blender/python/api2_2x/doc/API_intro.py b/source/blender/python/api2_2x/doc/API_intro.py
deleted file mode 100644
index a630c47229e..00000000000
--- a/source/blender/python/api2_2x/doc/API_intro.py
+++ /dev/null
@@ -1,247 +0,0 @@
-# This is not a real module, it's simply an introductory text.
-
-"""
-The Blender Python API Reference
-================================
-
- An asterisk (*) means the module has been updated.
-
- for a full list of changes since 2.42 see U{http://mediawiki.blender.org/index.php/Release_Notes/Notes243/Python_API}
-
- Top Module:
- -----------
-
- - L{Blender}
- - L{bpy<Bpy>} (experimental)
-
- Submodules:
- -----------
- - L{Armature} (*)
- - L{NLA}
- - L{Action<NLA.Action>}
- - L{BezTriple} (*)
- - L{BGL}
- - L{Camera} (*)
- - L{Curve} (*)
- - L{Draw} (*)
- - L{Effect}
- - L{Geometry} (*)
- - L{Group} (*)
- - L{Image} (*)
- - L{Ipo} (*)
- - L{IpoCurve} (*)
- - L{Key} (*)
- - L{Lamp}
- - L{Lattice} (*)
- - L{Library} (*)
- - L{Material} (*)
- - L{Mathutils} (*)
- - L{Mesh} (*)
- - L{MeshPrimitives} (*)
- - L{Metaball} (*)
- - L{NMesh} (deprecated)
- - L{Noise}
- - L{Object} (*)
- - L{Modifier} (*)
- - L{Pose} (*)
- - L{Constraint} (*)
- - L{ActionStrips<NLA>} (*)
- - L{Registry}
- - L{Scene} (*)
- - L{Radio}
- - L{Render} (*)
- - L{Sound} (*)
- - L{Text}
- - L{Text3d}
- - L{Font}
- - L{Texture} (*)
- - L{TimeLine}
- - L{Types}
- - L{Window}
- - L{Theme} (*)
- - L{World}
- - L{sys<Sys>}
-
- Additional information:
- -----------------------
-
- - L{Special features<API_related>}:
- - scripts: registering in menus, documenting, configuring (new);
- - command line examples (new);
- - script links (*), space handler script links, Group module (new).
-
-Introduction:
-=============
-
- This reference documents the Blender Python API, a growing collection of
- Python modules (libraries) that give access to part of the program's internal
- data and functions.
-
- Through scripting Blender can be extended in real-time via
- U{Python <www.python.org>}, an impressive high level, multi-paradigm, open
- source language. Newcomers are recommended to start with the tutorial that
- comes with it.
-
- This opens many interesting possibilities, ranging from automating repetitive
- tasks to adding new functionality to the program: procedural models,
- importers and exporters, even complex applications and so on. Blender itself
- comes with some scripts, but many others can be found in the Scripts & Plugins
- sections and forum posts at the Blender-related sites listed below.
-
-Scripting and Blender:
-======================
-
-These are the basic ways to execute scripts in Blender:
-
- 1. They can be loaded or typed as text files in the Text Editor window, then
- executed with ALT+P.
- 2. Via command line: C{blender -P <scriptname>} will start Blender and execute
- the given script. <scriptname> can be a filename in the user's file system or
- the name of a text saved in a .blend Blender file:
- 'blender myfile.blend -P textname'.
- 3. Via command line in I{background mode}: use the '-b' flag (the order is
- important): C{blender -b <blendfile> -P <scriptname>}. <blendfile> can be any
- .blend file, including the default .B.blend that is in Blender's home directory
- L{Blender.Get}('homedir'). In this mode no window will be opened and the
- program will leave as soon as the script finishes execution.
- 4. Properly registered scripts can be selected directly from the program's
- menus.
- 5. Scriptlinks: these are also loaded or typed in the Text Editor window and
- can be linked to objects, materials or scenes using the Scriptlink buttons
- tab. Script links get executed automatically when their events (ONLOAD,
- REDRAW, FRAMECHANGED) are triggered. Normal scripts can create (L{Text}) and
- link other scripts to objects and events, see L{Object.Object.addScriptLink},
- for example.
- 6. A script can call another script (that will run in its own context, with
- its own global dictionary) with the L{Blender.Run} module function.
-
-
-Interaction with users:
------------------------
-
- Scripts can:
- - simply run and exit;
- - pop messages, menus and small number and text input boxes;
- - draw graphical user interfaces (GUIs) with OpenGL calls and native
- program buttons, which stay there accepting user input like any other
- Blender window until the user closes them;
- - attach themselves to a space's event or drawing code (aka space handlers,
- L{check here<API_related>});
- - make changes to the 3D View (set visible layer(s), view point, etc);
- - grab the main input event queue and process (or pass to Blender) selected
- keyboard, mouse, redraw events -- not considered good practice, but still
- available for private use;
- - tell Blender to execute other scripts (see L{Blender.Run}());
- - use external Python libraries, if available.
-
- You can read the documentation for the L{Window}, L{Draw} and L{BGL} modules
- for more information and also check the Python site for external modules that
- might be useful to you. Note though that any imported module will become a
- requirement of your script, since Blender itself does not bundle external
- modules.
-
-Command line mode:
-------------------
-
- Python was embedded in Blender, so to access BPython modules you need to
- run scripts from the program itself: you can't import the Blender module
- into an external Python interpreter.
-
- On the other hand, for many tasks it's possible to control Blender via
- some automated process using scripts. Interested readers should learn about
- features like "OnLoad" script links, the "-b <blendfile>" (background mode)
- and "-P <script>" (run script) command line options and API calls like
- L{Blender.Save}, L{Blender.Load}, L{Blender.Quit} and the L{Library} and
- L{Render} modules.
-
- Note that command line scripts are run before Blender initializes its windows
- (and in '-b' mode no window will be initialized), so many functions that get
- or set window related attributes (like most in L{Window}) don't work here. If
- you need those, use an ONLOAD script link (see L{Scene.Scene.addScriptLink})
- instead -- it's also possible to use a command line script to write or set an
- ONLOAD script link. Check the L{Blender.mode} module var to know if Blender
- is being executed in "background" or "interactive" mode.
-
- L{Click here for command line and background mode examples<API_related>}.
-
-
-Demo mode:
-----------
-
- Blender has a demo mode, where once started it can work without user
- intervention, "showing itself off". Demos can render stills and animations,
- play rendered or real-time animations, calculate radiosity simulations and
- do many other nifty things. If you want to turn a .blend file into a demo,
- write a script to run the show and link it as a scene "OnLoad" scriptlink.
- The demo will then be played automatically whenever this .blend file is
- opened, B{unless Blender was started with the "-y" parameter}.
-
-The Game Engine API:
---------------------
-
- Blender has a game engine for users to create and play 3d games. This
- engine lets programmers add scripts to improve game AI, control, etc, making
- more complex interaction and tricks possible. The game engine API is
- separate from the Blender Python API this document references and you can
- find its own ref doc in the doc section of the main sites below.
-
-Blender Data Structures:
-------------------------
-
- Programs manipulate data structures. Blender python scripts are no exception.
- Blender uses an Object Oriented architecture. The BPython interface tries to
- present Blender objects and their attributes in the same way you see them
- through the User Interface (the GUI). One key to BPython programming is
- understanding the information presented in Blender's OOPS window where Blender
- objects and their relationships are displayed.
-
- Each Blender graphic element (Mesh, Lamp, Curve, etc.) is composed from two
- parts: an Object and ObData. The Object holds information about the position,
- rotation and size of the element. This is information that all elements have
- in common. The ObData holds information specific to that particular type of
- element.
-
- Each Object has a link to its associated ObData. A single ObData may be
- shared by many Objects. A graphic element also has a link to a list of
- Materials. By default, this list is associated with the ObData.
-
- All Blender objects have a unique name. However, the name is qualified by the
- type of the object. This means you can have a Lamp Object called Lamp.001
- (OB:Lamp.001) and a Lamp ObData called Lamp.001 (LA:Lamp.001).
-
- For a more in-depth look at Blender internals, and some understanding of why
- Blender works the way it does, see the U{Blender Architecture document
- <http://www.blender3d.org/cms/Blender_Architecture.336.0.html>}.
-
-
-A note to newbie script writers:
---------------------------------
-
- Interpreted languages are known to be much slower than compiled code, but for
- many applications the difference is negligible or acceptable. Also, with
- profiling (or even simple direct timing with L{Blender.sys.time<Sys.time>}) to
- identify slow areas and well thought optimizations, the speed can be
- I{considerably} improved in many cases. Try some of the best BPython scripts
- to get an idea of what can be done, you may be surprised.
-
-@author: The Blender Python Team
-@requires: Blender 2.43 or newer.
-@version: 2.43
-@see: U{www.blender3d.org<http://www.blender3d.org>}: main site
-@see: U{www.blender.org<http://www.blender.org>}: documentation and forum
-@see: U{blenderartists.org<http://blenderartists.org>}: user forum
-@see: U{projects.blender.org<http://projects.blender.org>}
-@see: U{blender architecture<http://www.blender3d.org/cms/Blender_Architecture.336.0.html>}: blender architecture document
-@see: U{www.python.org<http://www.python.org>}
-@see: U{www.python.org/doc<http://www.python.org/doc>}
-@see: U{Blending into Python<en.wikibooks.org/wiki/Blender_3D:_Blending_Into_Python>}: User contributed documentation, featuring a blender/python cookbook with many examples.
-
-@note: the official version of this reference guide is only updated for each
- new Blender release. But you can build the current CVS
- version yourself: install epydoc, grab all files in the
- source/blender/python/api2_2x/doc/ folder of Blender's CVS and use the
- epy_docgen.sh script also found there to generate the html docs.
- Naturally you will also need a recent Blender binary to try the new
- features. If you prefer not to compile it yourself, there is a testing
- builds forum at U{blender.org<http://www.blender.org>}.
-"""
diff --git a/source/blender/python/api2_2x/doc/API_related.py b/source/blender/python/api2_2x/doc/API_related.py
deleted file mode 100644
index 87b29e7f524..00000000000
--- a/source/blender/python/api2_2x/doc/API_related.py
+++ /dev/null
@@ -1,564 +0,0 @@
-# This is not a real module, it's simply an introductory text.
-
-"""
-Blender Python related features
-===============================
-
- L{Back to Main Page<API_intro>}
-
-
-Introduction:
-=============
-
- This page describes special features available to BPython scripts:
-
- - Command line mode is accessible with the '-P' and '-b' Blender options.
- - Registration allows scripts to become available from some pre-defined menus
- in Blender, like Import, Export, Wizards and so on.
- - Script links are Blender Texts (scripts) executed when a particular event
- (redraws, .blend file loading, saving, frame changed, etc.) occurs. Now
- there are also "Space Handlers" to draw onto or get events from a given
- space (only 3D View now) in some window.
- - Proper documentation data is used by the 'Scripts Help Browser' script to
- show help information for any registered script. Your own GUI can use
- this facility with the L{Blender.ShowHelp} function.
- - Configuration is for data in your script that can be tweaked according to
- user taste or needs. Like documentation, this is another helper
- functionality -- you don't need to provide a GUI yourself to edit config
- data.
-
-
- Command line usage:
- ===================
-
- Specifying scripts:
- -------------------
-
- The '-P' option followed either by:
- - a script filename (full pathname if not in the same folder where you run
- the command);
- - the name of a Text in a .blend file (that must also be specified)
- will open Blender and immediately run the given script.
-
- Example::
-
- # open Blender and execute the given script:
- blender -P script.py
-
- Passing parameters:
- -------------------
-
- To pass parameters to the script you can:
- - write them to a file before running Blender, then make your script parse that file;
- - set environment variables and access them with the 'os' module:
-
- Examples with parameters being passed to the script via command line::
-
- # execute a command like:
-
- myvar=value blender -P script.py
-
- # and in script.py access myvar with os.getenv
- # (os.environ and os.setenv are also useful):
-
- # script.py:
- import os
- val = os.getenv('myvar')
-
- # To pass multiple parameters, simply write them in sequence,
- # separated by spaces:
-
- myvar1=value1 myvar2=value2 mystr="some string data" blender -P script.py
-
- Background mode:
- ----------------
-
- In '-b' mode no windows will be opened: the program will run as a command
- line tool able to render stills and animations and execute any working Python
- script with complete access to loaded .blend's file contents. Once the task
- is completed, the program will exit.
-
- Background mode examples::
-
- # Open Blender in background mode with file 'myfile.blend'
- # and run the script 'script.py':
-
- blender -b myfile.blend -P script.py
-
- # Note: a .blend file is always required. 'script.py' can be a file
- # in the file system or a Blender Text stored in 'myfile.blend'.
-
- # Let's assume 'script.py' has code to render the current frame;
- # this line will set the [s]tart and [e]nd (and so the current) frame to
- # frame 44 and call the script:
-
- blender -b myfile.blend -s 44 -e 44 -P script.py
-
- # Using now a script written to render animations, we set different
- # start and end frames and then execute this line:
-
- blender -b myfile.blend -s 1 -e 10 -P script.py
-
- # Note: we can also set frames and define if we want a single image or
- # an animation in the script body itself, naturally.
-
- The rendered pictures will be written to the default render folder, that can
- also be set via BPython (take a look at L{Render.RenderData}). Their
- names will be the equivalent frame number followed by the extension of the
- chosen image type: 0001.png, for example. To rename them to something else,
- coders can use the C{rename} function in the standard 'os' Python module.
-
- Reminder: if you just need to render, it's not necessary to have a script.
- Blender can create stills and animations with its own command line arguments.
- Example:
- - a single image at frame 44: blender -b myfile.blend -f 44
- - an animation from frame 1 to 10: blender -b myfile.blend -s 1 -e 10 -a
-
-
- Script links:
- =============
-
- Object script links:
- --------------------
-
- Users can link Blender Text scripts and objects to have the script
- code executed when specific events occur to the objects. For example, if a
- Camera has an script link set to "FrameChanged", the script will be executed
- whenever the current frame is changed. Links can either be manually added by
- users on the Buttons window -> Scripts tab or created by another script (see,
- for example, L{Object.addScriptLink<Object.Object.addScriptLink>}).
-
- These are the types which can be linked to scripts:
- - Camera Data;
- - Lamp Data;
- - Materials;
- - Objects;
- - Scenes;
- - Worlds.
-
- And these are the available event choices:
- - Redraw;
- - FrameChanged;
- - Render;
- - OnLoad (*);
- - OnSave (*).
-
- (*) only available for scenes
-
- There are three L{Blender} module variables that script link authors should
- be aware of:
- - B{bylink}: True if the script is running as a script link;
- - B{link}: the object the running script was linked to (None if this is
- not a script link);
- - B{event}: the event type, if the running script is being executed as a
- script link.
-
- Example::
- #script link
- import Blender
- if Blender.bylink: # we're running as a script link
- print "Event: %s for %s" % (Blender.event, Blender.link)
-
- B{Important note about "Render" events}:
-
- Each "Render" script link is executed twice: before rendering and after, for
- reverting changes and for possible clean up actions. Before rendering,
- 'Blender.event' will be "Render" and after rendering it will be "PostRender".
-
- Example::
- # render script link
- import Blender
- event = Blender.event
- if event == "Render":
- # prepare for rendering
- create_my_very_detailed_mesh_data()
- elif event == "PostRender":
- # done rendering, clean up
- delete_my_very_detailed_mesh_data()
-
- As suggested by the example above, this is especially useful for script links
- that need to generate data only useful while rendering, or in case they need
- to switch between two mesh data objects, one meant for realtime display and
- the other, more detailed, for renders.
-
- Space Handler script links:
- ---------------------------
-
- This is a new kind of script linked to spaces in a given window. Right now
- only the 3D View has the necessary hooks, but the plan is to add access to
- other types, too. Just to clarify naming conventions: in Blender, a screen
- is partitioned in windows (also called areas) and each window can show any
- space. Spaces are: 3D View, Text Editor, Scripts, Buttons, User Preferences,
- Oops, etc.
-
- Space handlers are texts in the Text Editor, like other script links, but they
- need to have a special header to be recognized -- B{I{the first line in the
- text file}} must inform:
- 1. that they are space handlers;
- 2. the space they belong to;
- 3. whether they are EVENT or DRAW handlers.
-
- Example header for a 3D View EVENT handler::
-
- # SPACEHANDLER.VIEW3D.EVENT
-
- Example header for a 3D View DRAW handler::
-
- # SPACEHANDLER.VIEW3D.DRAW
-
- Available space handlers can be toggled "on" or "off" in the space header's
- B{View->Space Handler Scripts} submenu, by the user.
-
- EVENT space handler scripts are called by that space's event handling callback
- in Blender. The script receives the event B{before} it is further processed
- by the program. An EVENT handler script should check Blender.event (compare
- it against L{Draw} events) and either:
- - process it (the script must set Blender.event to None then);
- - ignore it.
-
- Setting C{Blender.event = None} tells Blender not to go on processing itself
- the event, because it was grabbed by the script.
-
- Example::
-
- # SPACEHANDLER.VIEW3D.EVENT
-
- import Blender
- from Blender import Draw
- evt = Blender.event
- return_it = False
-
- if evt == Draw.LEFTMOUSE:
- print "Swallowing the left mouse button press"
- elif evt == Draw.AKEY:
- print "Swallowing an 'a' character"
- else:
- print "Let the 3D View itself process this event:", evt
- return_it = True
-
- # if Blender should not process itself the passed event:
- if not return_it: Blender.event = None
-
- DRAW space handlers are called by that space's drawing callback in Blender.
- The script is called B{after} the space has been drawn.
-
- Two of the L{Blender} module variables related to script links assume
- different roles for space handlers:
- - B{bylink} is the same: True if the script is running as a script link;
- - B{link}: integer from the L{Blender}.SpaceHandlers constant dictionary,
- tells what space this handler belongs to and the handler's type
- (EVENT, DRAW);
- - B{event}:
- - EVENT handlers: an input event (check keys and mouse events in L{Draw})
- to be processed or ignored.
- - DRAW handlers: 0 always.
-
- B{Guidelines (important)}:
- - EVENT handlers can access and change Blender objects just like any other
- script, but they should not draw to the screen, B{use a DRAW handler to do
- that}. Specifically: L{Draw.Image} and the L{BGL} drawing functions
- should not be used inside an EVENT handler.
- - DRAW handlers should leave the space in the same state it was before they
- were executed. OpenGL attributes and the modelview and projection matrices
- are automatically saved (pushed) before a DRAW handler runs and restored
- (popped) after it finishes, no need to worry about that. Draw handlers
- should not grab events;
- - If script handlers need to pass information to each other (for example an
- EVENT handler passing info to a DRAW handler), use the L{Registry} module.
- - in short: use the event handler to deal with events and the draw handler to
- draw and your script will be following the recommended practices for
- Blender code.
-
- Registering scripts:
- ====================
-
- To be registered a script needs two things:
- - to be either in the default scripts directory or in the user defined scripts
- path (see User Preferences window -> File Paths tab -> Python path);
- - to have a proper header.
-
- Try 'blender -d' to know where your default directory for scripts is, it will
- inform either the directory or the file with that info already parsed, which is
- in the same directory of the scripts folder.
-
- The header should be like this one (all double and single apostrophes below
- are required)::
- #!BPY
-
- # \"\"\"
- # Name: 'Script Name'
- # Blender: 233
- # Group: 'Export'
- # Submenu: 'All' all
- # Submenu: 'Selected' sel
- # Submenu: 'Configure (gui)' gui
- # Tooltip: 'Export to some format.'
- # \"\"\"
-
- where:
- - B{Name} is the string that will appear in the menu;
- - B{Blender} is the minimum program version required to run the script;
- - B{Group} defines where the script will be put, see all groups in the
- Scripts Window's header, menu "Scripts";
- - B{Submenu} adds optional submenus for further control;
- - B{Tooltip} is the (short) tooltip string for the menu entry.
-
- note:
- - all double and single apostrophes above are required;
- - you can "comment out" the header above, by starting lines with
- '#', like we did. This is not required (except for the first line, #!BPY,
- of course), but this way the header won't conflict with Python tools that
- you can use to generate documentation for your script code. Just
- remember to keep this header above any other line with triple
- double-quotes (\"\"\") in your script.
-
- Submenu lines are not required, use them if you want to provide extra
- options. To see which submenu the user chose, check the "__script__"
- dictionary in your code: __script__['arg'] has the defined keyword (the word
- after the submenu string name: all, sel or gui in the example above) of the
- chosen submenu. For example, if the user clicked on submenu 'Selected' above,
- __script__['arg'] will be "sel".
-
- If your script requires extra data or configuration files, there is a special
- folder where they can be saved: see 'datadir' in L{Blender.Get}.
-
-
- Documenting scripts:
- ====================
-
- The "Scripts Help Browser" script in the Help menu can parse special variables
- from registered scripts and display help information for users. For that,
- authors only need to add proper information to their scripts, after the
- registration header.
-
- The expected variables:
-
- - __bpydoc__ (or __doc__) (type: string):
- - The main help text. Write a first short paragraph explaining what the
- script does, then add the rest of the help text, leaving a blank line
- between each new paragraph. To force line breaks you can use <br> tags.
-
- - __author__ (type: string or list of strings):
- - Author name(s).
-
- - __version__ (type: string):
- - Script version. A good recommendation is using a version number followed
- by the date in the format YYYY/MM/DD: "1.0 2005/12/31".
-
- - __url__ (type: string or list of strings):
- - Internet links that are shown as buttons in the help screen. Clicking
- them opens the user's default browser at the specified location. The
- expected format for each url entry is e.g.
- "Author's site, http://www.somewhere.com". The first part, before the
- comma (','), is used as the button's tooltip. There are two preset
- options: "blender" and "elysiun", which link to the Python forums at
- blender.org and elysiun.com, respectively.
-
- - __email__ (optional, type: string or list of strings):
- - Equivalent to __url__, but opens the user's default email client. You
- can write the email as someone:somewhere*com and the help script will
- substitute accordingly: someone@somewhere.com. This is only a minor help
- to hide emails from spammers, since your script may be available at some
- site. "scripts" is the available preset, with the email address of the
- mailing list devoted to scripting in Blender, bf-scripts-dev@blender.org.
- You should only use this one if you are subscribed to the list:
- http://projects.blender.org/mailman/listinfo/bf-scripts-dev for more
- information.
-
- Example::
- __author__ = 'Mr. Author'
- __version__ = '1.0 2005/01/01'
- __url__ = ["Author's site, http://somewhere.com",
- "Support forum, http://somewhere.com/forum/", "blender", "elysiun"]
- __email__ = ["Mr. Author, mrauthor:somewhere*com", "scripts"]
- __bpydoc__ = \"\"\"\\
- This script does this and that.
-
- Explaining better, this script helps you create ...
-
- You can write as many paragraphs as needed.
-
- Shortcuts:<br>
- Esc or Q: quit.<br>
- etc.
-
- Supported:<br>
- Meshes, metaballs.
-
- Known issues:<br>
- This is just an example, there's no actual script.
-
- Notes:<br>
- You can check scripts bundled with Blender to see more examples of how to
- add documentation to your own works.
- \"\"\"
-
- B{Note}: your own GUI or menu code can display documentation by calling the
- help browser with the L{Blender.ShowHelp} function.
-
- Configuring scripts:
- ====================
-
- The L{Blender.Registry<Registry>} module provides a simplified way to keep
- scripts configuration options in memory and also saved in config files.
- And with the "Scripts Config Editor" script in the System menu users can later
- view and edit the options easily.
-
- Let's first clarify what we mean by config options: they are simple data
- (bools, ints, floats, strings) used by programs to conform to user
- preferences. The buttons in Blender's User Preferences window are a good
- example.
-
- For example, a particular exporter might include:
- - SEPARATE_MATS = False: a bool variable (True / False) to determine if it
- should write materials to a separate file;
- - VERSION = 2: an int to define an specific version of the export format;
- - TEX_DIR = "/path/to/textures": a default texture dir to prepend to all
- exported texture filenames instead of their actual paths.
-
- The script needs to provide users a GUI to configure these options -- or else
- directly editing the source code would be the only way to change them. And to
- store changes made to the GUI so they can be reloaded any time the script is
- executed, programmers have to write and load their own config files (ideally at
- L{Blender.Get}('udatadir') or, if not available, L{Blender.Get}('datadir')).
-
- This section describes BPython facilities (based on the L{Registry} module and
- the config editor) that can take care of this in a simplified (and much
- recommended) way.
-
- Here's how it works::
-
- # sample_exporter.py
- import Blender
- from Blender import Registry
-
- # First define all config variables with their default values:
- SEPARATE_MATERIALS = True
- VERSION = True
- TEX_DIR = ''
- EXPORT_DIR = ''
-
- # Then define a function to update the Registry:
- def registry_update():
- # populate a dict with current config values:
- d = {
- 'SEPARATE_MATERIALS': SEPARATE_MATERIALS,
- 'VERSION': VERSION,
- 'TEX_DIR': TEX_DIR,
- 'EXPORT_DIR': EXPORT_DIR
- }
- # store the key (optional 3rd arg tells if
- # the data should also be written to a file):
- Registry.SetKey('sample_exporter', d, True)
-
- # (A good convention is to use the script name as Registry key)
-
- # Now we check if our key is available in the Registry or file system:
- regdict = Registry.GetKey('sample_exporter', True)
-
- # If this key already exists, update config variables with its values:
- if regdict:
- try:
- SEPARATE_MATERIALS = regdict['SEPARATE_MATERIALS']
- VERSION = regdict['VERSION']
- TEX_DIR = regdict['TEX_DIR']
- EXPORT_DIR = regdict['EXPORT_DIR']
-
- # if data was corrupted (or a new version of the script changed
- # (expanded, removed, renamed) the config vars and users may have
- # the old config file around):
- except: update_registry() # rewrite it
-
- else: # if the key doesn't exist yet, use our function to create it:
- update_registry()
-
- # ...
-
- Hint: nicer code than the simplistic example above can be written by keeping
- config var names in a list of strings and using the exec function.
-
- B{Note}: if your script's GUI lets users change config vars, call the
- registry_update() function in the button events callback to save the changes.
- On the other hand, you don't need to handle configuration
- in your own gui, it can be left for the 'Scripts Config Editor',
- which should have access to your script's config key as soon as the
- above code is executed once (as soon as SetKey is executed).
-
- B{Note} (limits for config vars): strings longer than 300 characters are
- clamped and the number of items in dictionaries, sequences and the config key
- itself is limited to 60.
-
-
- Scripts Configuration Editor:
- -----------------------------
-
- This script should be available from the System menu in the Scripts window.
- It provides a GUI to view and edit saved configuration data, both from the
- Registry dictionary in memory and the scripts config data dir. This is
- useful for all scripts with config vars, but especially for those without GUIs,
- like most importers and exporters, since this editor will provide one for them.
-
- The example above already gives a good idea of how the information can be
- prepared to be accessible from this editor, but there is more worth knowing:
-
- 1. String vars that end with '_dir' or '_file' (can be upper case, too) are
- recognized as input boxes for dirs or files and a 'browse' button is added to
- their right side, to call the file selector.
-
- 2. Both key names and configuration variables names starting with an
- underscore ('_') are ignored by the editor. Programmers can use this feature
- for any key or config var that is not meant to be configured by this editor.
-
- 3. The following information refers to extra config variables that may be
- added specifically to aid the configuration editor script. To clarify, in the
- example code above these variables (the string 'script' and the dictionaries
- 'tooltips' and 'limits') would appear along with SEPARATE_MATERIALS, VERSION,
- TEX_DIR and EXPORT_DIR, wherever they are written.
-
- Minor note: these names are case insensitive: tooltips, TOOLTIPS, etc. are all
- recognized.
-
- 3.1 The config editor will try to display a 'help' button for a key, to show
- documentation for the script that owns it. To find this "owner script", it
- will first look for a config variable called 'script', a string containing
- the name of the owner Python file (with or without '.py' extension)::
-
- script = 'sample_exporter.py'
-
- If there is no such variable, the editor will check if the file formed by the
- key name and the '.py' extension exists. If both alternatives fail, no help
- button will be displayed.
-
- 3.2 You can define tooltips for the buttons that the editor creates for your
- config data (string input, toggle, number sliders). Simply create a dict
- called 'tooltips', where config var names are keys and their tooltips,
- values::
-
- tooltips = {
- 'EXPORT_DIR': 'default folder where exported files should be saved',
- 'VERBOSE': 'print info and warning messages to the console',
- 'SEPARATE_MATERIALS': 'write materials to their own file'
- }
-
- 3.3 Int and float button sliders need min and max limits. This can be passed
- to the editor via a dict called 'limits' (ivar1, ivar2 and fvar are meant as
- extra config vars that might have been in the example code above)::
-
- limits = {'ivar1': [-10, 10], 'ivar2': [0, 100], 'fvar1': [-12.3, 15.4]}
-
- 4. The Config Editor itself maintains a Registry key called "General", with
- general options relevant to many scripts, like "verbose" to tell if the user
- wants messages printed to the console and "confirm overwrite", to know if
- a script should ask for confirmation before overwriting files (all exporters
- are recommended to access the General key and check this var -- L{sys.exists
- <Sys.exists>} tells if files or folders already exist).
-
- Hint: for actual examples, try the ac3d importer and exporter (it's enough to
- call them from the menus then cancel with ESC), as those have been updated to
- use this config system. After calling them their config data will be available
- in the Config Editor. We also recommend adding a section about config vars
- in your script's help info, as done in the ac3d ones.
-
- L{Back to Main Page<API_intro>}
- ===============================
-"""
diff --git a/source/blender/python/api2_2x/doc/Armature.py b/source/blender/python/api2_2x/doc/Armature.py
deleted file mode 100644
index 0dbaf28d6f8..00000000000
--- a/source/blender/python/api2_2x/doc/Armature.py
+++ /dev/null
@@ -1,368 +0,0 @@
-# Blender.Armature module and the Armature PyType object
-
-"""
-The Blender.Armature submodule.
-
-Armature
-========
-
-This module provides access to B{Armature} objects in Blender. These are
-"skeletons", used to deform and animate other objects -- meshes, for
-example.
-
-Example::
- import Blender
- from Blender import Armature
- from Blender.Mathutils import *
- #
- arms = Armature.Get()
- for arm in arms.values():
- arm.drawType = Armature.STICK #set the draw type
- arm.makeEditable() #enter editmode
-
- #generating new editbone
- eb = Armature.Editbone()
- eb.roll = 10
- eb.parent = arm.bones['Bone.003']
- eb.head = Vector(1,1,1)
- eb.tail = Vector(0,0,1)
- eb.options = [Armature.HINGE, Armature.CONNECTED]
-
- #add the bone
- arm.bones['myNewBone'] = eb
-
- #delete an old bone
- del arm.bones['Bone.002']
-
- arm.update() #save changes
-
- for bone in arm.bones.values():
- #print bone.matrix['ARMATURESPACE']
- print bone.parent, bone.name
- print bone.children, bone.name
- print bone.options, bone.name
-
-
-Example::
- # Adds empties for every bone in the selected armature, an example of getting worldspace locations for bones.
- from Blender import *
- def test_arm():
- scn= Scene.GetCurrent()
- arm_ob= scn.objects.active
-
- if not arm_ob or arm_ob.type != 'Armature':
- Draw.PupMenu('not an armature object')
- return
-
- # Deselect all
- for ob in scn.objects:
- if ob != arm_ob:
- ob.sel= 0
-
- arm_mat= arm_ob.matrixWorld
-
- arm_data= arm_ob.getData()
-
- bones= arm_data.bones.values()
- for bone in bones:
- bone_mat= bone.matrix['ARMATURESPACE']
- bone_mat_world= bone_mat*arm_mat
-
- ob_empty= scn.objects.new('Empty')
- ob_empty.setMatrix(bone_mat_world)
-
- test_arm()
-
-@var CONNECTED: Connect this bone to parent
-@type CONNECTED: Constant
-@var HINGE: Don't inherit rotation or scale from parent
-@type HINGE: Constant
-@var NO_DEFORM: If bone will not deform geometry
-@type NO_DEFORM: Constant
-@var MULTIPLY: Multiply bone with vertex group
-@type MULTIPLY: Constant
-@var HIDDEN_EDIT: Bone is hidden in editmode
-@type HIDDEN_EDIT: Constant
-@var ROOT_SELECTED: Root of the Bone is selected
-@type ROOT_SELECTED: Constant
-@var BONE_SELECTED: Bone is selected
-@type BONE_SELECTED: Constant
-@var TIP_SELECTED: Tip of the Bone is selected
-@type TIP_SELECTED: Constant
-@var OCTAHEDRON: Bones drawn as octahedrons
-@type OCTAHEDRON: Constant
-@var STICK: Bones drawn as a line
-@type STICK: Constant
-@var BBONE: Bones draw as a segmented B-spline
-@type BBONE: Constant
-@var ENVELOPE: Bones draw as a stick with envelope influence
-@type ENVELOPE: Constant
-"""
-
-def Get (name = None):
- """
- Get the Armature object(s) from Blender.
- @type name: string, nothing, or list of strings
- @param name: The string name of an armature.
- @rtype: Blender Armature or a list of Blender Armatures
- @return: It depends on the I{name} parameter:
- - (name): The Armature object with the given I{name};
- - (name, name, ...): A list of Armature objects
- - (): A list with all Armature objects in the current scene.
- @warning: In versions 2.42 and earlier, a string argument for an armature
- that doesn't exist will return None. Later versions raise a Value error.
- """
-
-def New (name = None):
- """
- Return a new armature.
- @type name: string or nothing
- @param name: The string name of the new armature.
- @rtype: Blender Armature.
- @return: A new armature.
- """
-
-class Armature:
- """
- The Armature object
- ===================
- This object gives access to Armature-specific data in Blender.
- @ivar bones: A Dictionary of Bones (BonesDict) that make up this armature.
- @type bones: BonesDict Object
- @ivar vertexGroups: Whether vertex groups define deformation
- @type vertexGroups: Bool
- @ivar envelopes: Whether bone envelopes define deformation
- @type envelopes: Bool
- @ivar restPosition: Show rest position (no posing possible)
- @type restPosition: Bool
- @ivar delayDeform: Don't deform children when manipulating bones
- @type delayDeform: Bool
- @ivar drawAxes: Draw bone axes
- @type drawAxes: Bool
- @ivar drawNames: Draw bone names
- @type drawNames: Bool
- @ivar ghost: Draw ghosts around frame for current Action
- @type ghost: Bool
- @ivar ghostStep: Number of frames between ghosts
- @type ghostStep: Int
- @ivar drawType: The drawing type that is used to display the armature
- Acceptable values are:
- - Armature.OCTAHEDRON: bones drawn as octahedrons
- - Armature.STICK: bones drawn as sticks
- - Armature.BBONE: bones drawn as b-bones
- - Armature.ENVELOPE: bones drawn as sticks with envelopes
- @type drawType: Constant Object
- @ivar mirrorEdit: X-axis mirrored editing
- @type mirrorEdit: Bool
- @ivar autoIK: Adds temporary IK chains while grabbing bones
- @type autoIK: Bool
- @ivar layerMask: Layer bitmask
- Example::
- # set armature to layers 14 and 16
- armature.layerMask = (1<<13) + (1<<15)
- @type layerMask: Int
- """
-
- def __init__(name = 'myArmature'):
- """
- Initializer for the Armature TypeObject.
- Example::
- myNewArmature = Blender.Armature.Armature('AR_1')
- @param name: The name for the new armature
- @type name: string
- @return: New Armature Object
- @rtype: Armature Object
- """
-
- def makeEditable():
- """
- Put the armature into EditMode for editing purposes. (Enters Editmode)
- @warning: Using Window.Editmode() to switch the editmode manually will cause problems and possibly even crash Blender.
- @warning: This is only needed for operations such as adding and removing bones.
- @warning: Do access pose data until you have called update() or settings will be lost.
- @warning: The armature should not be in manual editmode
- prior to calling this method. The armature must be parented
- to an object prior to editing.
- @rtype: None
- """
-
- def update():
- """
- Save all changes and update the armature. (Leaves Editmode)
- @note: Must have called makeEditable() first.
- @rtype: None
- """
-
-import id_generics
-Armature.__doc__ += id_generics.attributes
-
-class BonesDict:
- """
- The BonesDict object
- ====================
- This object gives gives dictionary like access to the bones in an armature.
- It is internal to blender but is called as 'Armature.bones'
-
- Removing a bone:
- Example::
- del myArmature.bones['bone_name']
- Adding a bone:
- Example::
- myEditBone = Armature.Editbone()
- myArmature.bones['bone_name'] = myEditBone
- """
-
- def items():
- """
- Return the key, value pairs in this dictionary
- @rtype: string, BPy_bone
- @return: All strings, and py_bones in the armature (in that order)
- """
-
- def keys():
- """
- Return the keys in this dictionary
- @rtype: string
- @return: All strings representing the bone names
- """
-
- def values():
- """
- Return the values in this dictionary
- @rtype: BPy_bone
- @return: All BPy_bones in this dictionary
- """
-
-class Bone:
- """
- The Bone object
- ===============
- This object gives access to Bone-specific data in Blender. This object
- cannot be instantiated but is returned by BonesDict when the armature is not in editmode.
- @ivar name: The name of this Bone.
- @type name: String
- @ivar roll: This Bone's roll value.
- Keys are:
- - 'ARMATURESPACE' - this roll in relation to the armature
- - 'BONESPACE' - the roll in relation to itself
- @type roll: Dictionary
- @ivar head: This Bone's "head" ending position when in rest state.
- Keys are:
- - 'ARMATURESPACE' - this head position in relation to the armature
- - 'BONESPACE' - the head position in relation to itself.
- @type head: Dictionary
- @ivar tail: This Bone's "tail" ending position when in rest state.
- Keys are:
- - 'ARMATURESPACE' - this tail position in relation to the armature
- - 'BONESPACE' - the tail position in relation to itself
- @type tail: Dictionary
- @ivar matrix: This Bone's matrix. This cannot be set.
- Keys are:
- - 'ARMATURESPACE' - this matrix of the bone in relation to the armature
- - 'BONESPACE' - the matrix of the bone in relation to itself
- @type matrix: Matrix Object
- @ivar parent: The parent Bone.
- @type parent: Bone Object
- @ivar children: The children directly attached to this bone.
- @type children: List of Bone Objects
- @ivar weight: The bone's weight.
- @type weight: Float
- @ivar options: Various bone options which can be:
- - Armature.CONNECTED: IK to parent
- - Armature.HINGE: No parent rotation or scaling
- - Armature.NO_DEFORM: The bone does not deform geometry
- - Armature.MULTIPLY: Multiply vgroups by envelope
- - Armature.HIDDEN_EDIT: Hide bones in editmode
- - Armature.ROOT_SELECTED: Selection of root ball of bone
- - Armature.BONE_SELECTED: Selection of bone
- - Armature.TIP_SELECTED: Selection of tip ball of bone
- @type options: List of Constants
- @ivar subdivision: The number of bone subdivisions.
- @type subdivision: Int
- @ivar deformDist: The deform distance of the bone
- @type deformDist: Float
- @ivar length: The length of the bone. This cannot be set.
- @type length: Float
- @ivar headRadius: The radius of this bones head (used for envalope bones)
- @type headRadius: Float
- @ivar tailRadius: The radius of this bones head (used for envalope bones)
- @type tailRadius: Float
- @ivar layerMask: Layer bitmask
- Example::
- # set bone to layers 14 and 16
- bone.layerMask = (1<<13) + (1<<15)
- @type layerMask: Int
- """
-
- def hasParent():
- """
- Whether or not this bone has a parent
- @rtype: Bool
- """
-
- def hasChildren():
- """
- Whether or not this bone has children
- @rtype: Bool
- """
-
- def getAllChildren():
- """
- Gets all the children under this bone including the children's children.
- @rtype: List of Bone object
- @return: all bones under this one
- """
-
-class Editbone:
- """
- The Editbone Object
- ===================
- This object is a wrapper for editbone data and is used only in the manipulation
- of the armature in editmode.
- @ivar name: The name of this Bone.
- @type name: String
- @ivar roll: This Bone's roll value (armaturespace).
- @type roll: Float
- @ivar head: This Bone's "head" ending position when in rest state (armaturespace).
- @type head: Vector Object
- @ivar tail: This Bone's "tail" ending position when in rest state (armaturespace).
- @type tail: Vector Object
- @ivar matrix: This Bone's matrix. (armaturespace)
- @type matrix: Matrix Object
- @ivar parent: The parent Bone.
- @type parent: Editbone Object
- @ivar weight: The bone's weight.
- @type weight: Float
- @ivar options: Various bone options which can be:
- - Armature.CONNECTED: IK to parent
- - Armature.HINGE: No parent rotation or scaling
- - Armature.NO_DEFORM: The bone does not deform geometry
- - Armature.MULTIPLY: Multiply vgroups by envelope
- - Armature.HIDDEN_EDIT: Hide bones in editmode
- - Armature.ROOT_SELECTED: Selection of root ball of bone
- - Armature.BONE_SELECTED: Selection of bone
- - Armature.TIP_SELECTED: Selection of tip ball of bone
- @type options: List of Constants
- @ivar subdivision: The number of bone subdivisions.
- @type subdivision: Int
- @ivar deformDist: The deform distance of the bone
- @type deformDist: Float
- @ivar length: The length of the bone. This cannot be set.
- @type length: Float
- @ivar headRadius: The radius of this bones head (used for envalope bones)
- @type headRadius: Float
- @ivar tailRadius: The radius of this bones head (used for envalope bones)
- @type tailRadius: Float
- """
-
- def hasParent():
- """
- Whether or not this bone has a parent
- @rtype: Bool
- """
-
- def clearParent():
- """
- Set the parent to None
- @rtype: None
- """
diff --git a/source/blender/python/api2_2x/doc/BGL.py b/source/blender/python/api2_2x/doc/BGL.py
deleted file mode 100644
index 661042f341b..00000000000
--- a/source/blender/python/api2_2x/doc/BGL.py
+++ /dev/null
@@ -1,1778 +0,0 @@
-# Blender.BGL module (OpenGL wrapper)
-
-"""
-The Blender.BGL submodule (the OpenGL wrapper).
-
-B{New}: some GLU functions: L{gluLookAt}, etc.
-
-The Blender.BGL submodule
-=========================
-
-This module wraps OpenGL constants and functions, making them available from
-within Blender Python.
-
-The complete list can be retrieved from the module itself, by listing its
-contents: dir(Blender.BGL). A simple search on the net can point to more
-than enough material to teach OpenGL programming, from books to many
-collections of tutorials.
-
-The "red book": "I{OpenGL Programming Guide: The Official Guide to Learning
-OpenGL}" and the online NeHe tutorials are two of the best resources.
-
-Example::
- import Blender
- from Blender.BGL import *
- from Blender import Draw
- R = G = B = 0
- A = 1
- title = "Testing BGL + Draw"
- instructions = "Use mouse buttons or wheel to change the background color."
- quitting = " Press ESC or q to quit."
- len1 = Draw.GetStringWidth(title)
- len2 = Draw.GetStringWidth(instructions + quitting)
- #
- def show_win():
- glClearColor(R,G,B,A) # define color used to clear buffers
- glClear(GL_COLOR_BUFFER_BIT) # use it to clear the color buffer
- glColor3f(0.35,0.18,0.92) # define default color
- glBegin(GL_POLYGON) # begin a vertex data list
- glVertex2i(165, 158)
- glVertex2i(252, 55)
- glVertex2i(104, 128)
- glEnd()
- glColor3f(0.4,0.4,0.4) # change default color
- glRecti(40, 96, 60+len1, 113)
- glColor3f(1,1,1)
- glRasterPos2i(50,100) # move cursor to x = 50, y = 100
- Draw.Text(title) # draw this text there
- glRasterPos2i(350,40) # move cursor again
- Draw.Text(instructions + quitting) # draw another msg
- glBegin(GL_LINE_LOOP) # begin a vertex-data list
- glVertex2i(46,92)
- glVertex2i(120,92)
- glVertex2i(120,115)
- glVertex2i(46,115)
- glEnd() # close this list
- #
- def ev(evt, val): # event callback for Draw.Register()
- global R,G,B,A # ... it handles input events
- if evt == Draw.ESCKEY or evt == Draw.QKEY:
- Draw.Exit() # this quits the script
- elif not val: return
- elif evt == Draw.LEFTMOUSE: R = 1 - R
- elif evt == Draw.MIDDLEMOUSE: G = 1 - G
- elif evt == Draw.RIGHTMOUSE: B = 1 - B
- elif evt == Draw.WHEELUPMOUSE:
- R += 0.1
- if R > 1: R = 1
- elif evt == Draw.WHEELDOWNMOUSE:
- R -= 0.1
- if R < 0: R = 0
- else:
- return # don't redraw if nothing changed
- Draw.Redraw(1) # make changes visible.
- #
- Draw.Register(show_win, ev, None) # start the main loop
-
-@note: you can use the L{Image} module and L{Image.Image} BPy object to load
- and set textures. See L{Image.Image.glLoad} and L{Image.Image.glFree},
- for example.
-@see: U{www.opengl.org}
-@see: U{nehe.gamedev.net}
-"""
-
-def glAccum(op, value):
- """
- Operate on the accumulation buffer
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/accum.html}
-
- @type op: Enumerated constant
- @param op: The accumulation buffer operation.
- @type value: float
- @param value: a value used in the accumulation buffer operation.
- """
-
-def glAlphaFunc(func, ref):
- """
- Specify the alpha test function
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/alphafunc.html}
-
- @type func: Enumerated constant
- @param func: Specifies the alpha comparison function.
- @type ref: float
- @param ref: The reference value that incoming alpha values are compared to.
- Clamped between 0 and 1.
- """
-
-def glAreTexturesResident(n, textures, residences):
- """
- Determine if textures are loaded in texture memory
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/aretexturesresident.html}
-
- @type n: int
- @param n: Specifies the number of textures to be queried.
- @type textures: Buffer object I{type GL_INT}
- @param textures: Specifies an array containing the names of the textures to be queried
- @type residences: Buffer object I{type GL_INT}(boolean)
- @param residences: An array in which the texture residence status in returned.The residence status of a
- texture named by an element of textures is returned in the corresponding element of residences.
- """
-
-def glBegin(mode):
- """
- Delimit the vertices of a primitive or a group of like primatives
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/begin.html}
-
- @type mode: Enumerated constant
- @param mode: Specifies the primitive that will be create from vertices between glBegin and
- glEnd.
- """
-
-def glBindTexture(target, texture):
- """
- Bind a named texture to a texturing target
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/bindtexture.html}
-
- @type target: Enumerated constant
- @param target: Specifies the target to which the texture is bound.
- @type texture: unsigned int
- @param texture: Specifies the name of a texture.
- """
-
-def glBitmap(width, height, xorig, yorig, xmove, ymove, bitmap):
- """
- Draw a bitmap
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/bitmap.html}
-
- @type width, height: int
- @param width, height: Specify the pixel width and height of the bitmap image.
- @type xorig,yorig: float
- @param xorig,yorig: Specify the location of the origin in the bitmap image. The origin is measured
- from the lower left corner of the bitmap, with right and up being the positive axes.
- @type xmove,ymove: float
- @param xmove,ymove: Specify the x and y offsets to be added to the current raster position after
- the bitmap is drawn.
- @type bitmap: Buffer object I{type GL_BYTE}
- @param bitmap: Specifies the address of the bitmap image.
- """
-
-def glBlendFunc(sfactor, dfactor):
- """
- Specify pixel arithmetic
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/blendfunc.html}
-
- @type sfactor: Enumerated constant
- @param sfactor: Specifies how the red, green, blue, and alpha source blending factors are
- computed.
- @type dfactor: Enumerated constant
- @param dfactor: Specifies how the red, green, blue, and alpha destination blending factors are
- computed.
- """
-
-def glCallList(list):
- """
- Execute a display list
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/calllist.html}
-
- @type list: unsigned int
- @param list: Specifies the integer name of the display list to be executed.
- """
-
-def glCallLists(n, type, lists):
- """
- Execute a list of display lists
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/calllists.html}
-
- @type n: int
- @param n: Specifies the number of display lists to be executed.
- @type type: Enumerated constant
- @param type: Specifies the type of values in lists.
- @type lists: Buffer object
- @param lists: Specifies the address of an array of name offsets in the display list.
- The pointer type is void because the offsets can be bytes, shorts, ints, or floats,
- depending on the value of type.
- """
-
-def glClear(mask):
- """
- Clear buffers to preset values
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clear.html}
-
- @type mask: Enumerated constant(s)
- @param mask: Bitwise OR of masks that indicate the buffers to be cleared.
- """
-
-def glClearAccum(red, green, blue, alpha):
- """
- Specify clear values for the accumulation buffer
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearaccum.html}
-
- @type red,green,blue,alpha: float
- @param red,green,blue,alpha: Specify the red, green, blue, and alpha values used when the
- accumulation buffer is cleared. The initial values are all 0.
- """
-
-def glClearColor(red, green, blue, alpha):
- """
- Specify clear values for the color buffers
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearcolor.html}
-
- @type red,green,blue,alpha: float
- @param red,green,blue,alpha: Specify the red, green, blue, and alpha values used when the
- color buffers are cleared. The initial values are all 0.
- """
-
-def glClearDepth(depth):
- """
- Specify the clear value for the depth buffer
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/cleardepth.html}
-
- @type depth: int
- @param depth: Specifies the depth value used when the depth buffer is cleared.
- The initial value is 1.
- """
-
-def glClearIndex(c):
- """
- Specify the clear value for the color index buffers
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearindex.html}
-
- @type c: float
- @param c: Specifies the index used when the color index buffers are cleared.
- The initial value is 0.
- """
-
-def glClearStencil(s):
- """
- Specify the clear value for the stencil buffer
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearstencil.html}
-
- @type s: int
- @param s: Specifies the index used when the stencil buffer is cleared. The initial value is 0.
- """
-
-def glClipPlane (plane, equation):
- """
- Specify a plane against which all geometry is clipped
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clipplane.html}
-
- @type plane: Enumerated constant
- @param plane: Specifies which clipping plane is being positioned.
- @type equation: Buffer object I{type GL_FLOAT}(double)
- @param equation: Specifies the address of an array of four double- precision floating-point
- values. These values are interpreted as a plane equation.
- """
-
-def glColor (red, green, blue, alpha):
- """
- B{glColor3b, glColor3d, glColor3f, glColor3i, glColor3s, glColor3ub, glColor3ui, glColor3us,
- glColor4b, glColor4d, glColor4f, glColor4i, glColor4s, glColor4ub, glColor4ui, glColor4us,
- glColor3bv, glColor3dv, glColor3fv, glColor3iv, glColor3sv, glColor3ubv, glColor3uiv,
- glColor3usv, glColor4bv, glColor4dv, glColor4fv, glColor4iv, glColor4sv, glColor4ubv,
- glColor4uiv, glColor4usv}
-
- Set a new color.
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/color.html}
-
- @type red,green,blue,alpha: Depends on function prototype.
- @param red,green,blue: Specify new red, green, and blue values for the current color.
- @param alpha: Specifies a new alpha value for the current color. Included only in the
- four-argument glColor4 commands. (With '4' colors only)
- """
-
-def glColorMask(red, green, blue, alpha):
- """
- Enable and disable writing of frame buffer color components
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/colormask.html}
-
- @type red,green,blue,alpha: int (boolean)
- @param red,green,blue,alpha: Specify whether red, green, blue, and alpha can or cannot be
- written into the frame buffer. The initial values are all GL_TRUE, indicating that the
- color components can be written.
- """
-
-def glColorMaterial(face, mode):
- """
- Cause a material color to track the current color
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/colormaterial.html}
-
- @type face: Enumerated constant
- @param face: Specifies whether front, back, or both front and back material parameters should
- track the current color.
- @type mode: Enumerated constant
- @param mode: Specifies which of several material parameters track the current color.
- """
-
-def glCopyPixels(x, y, width, height, type):
- """
- Copy pixels in the frame buffer
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/copypixels.html}
-
- @type x,y: int
- @param x,y: Specify the window coordinates of the lower left corner of the rectangular
- region of pixels to be copied.
- @type width, height: int
- @param width,height: Specify the dimensions of the rectangular region of pixels to be copied.
- Both must be non-negative.
- @type type: Enumerated constant
- @param type: Specifies whether color values, depth values, or stencil values are to be copied.
- """
-
-def glCullFace(mode):
- """
- Specify whether front- or back-facing facets can be culled
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/cullface.html}
-
- @type mode: Enumerated constant
- @param mode: Specifies whether front- or back-facing facets are candidates for culling.
- """
-
-def glDeleteLists(list, range):
- """
- Delete a contiguous group of display lists
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/deletelists.html}
-
- @type list: unsigned int
- @param list: Specifies the integer name of the first display list to delete
- @type range: int
- @param range: Specifies the number of display lists to delete
- """
-
-def glDeleteTextures(n, textures):
- """
- Delete named textures
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/deletetextures.html}
-
- @type n: int
- @param n: Specifies the number of textures to be deleted
- @type textures: Buffer I{GL_INT}
- @param textures: Specifies an array of textures to be deleted
- """
-
-def glDepthFunc(func):
- """
- Specify the value used for depth buffer comparisons
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/depthfunc.html}
-
- @type func: Enumerated constant
- @param func: Specifies the depth comparison function.
- """
-
-def glDepthMask(flag):
- """
- Enable or disable writing into the depth buffer
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/depthmask.html}
-
- @type flag: int (boolean)
- @param flag: Specifies whether the depth buffer is enabled for writing. If flag is GL_FALSE,
- depth buffer writing is disabled. Otherwise, it is enabled. Initially, depth buffer
- writing is enabled.
- """
-
-def glDepthRange(zNear, zFar):
- """
- Specify mapping of depth values from normalized device coordinates to window coordinates
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/depthrange.html}
-
- @type zNear: int
- @param zNear: Specifies the mapping of the near clipping plane to window coordinates.
- The initial value is 0.
- @type zFar: int
- @param zFar: Specifies the mapping of the far clipping plane to window coordinates.
- The initial value is 1.
- """
-
-def glDisable(cap):
- """
- Disable server-side GL capabilities
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/enable.html}
-
- @type cap: Enumerated constant
- @param cap: Specifies a symbolic constant indicating a GL capability.
- """
-
-def glDrawBuffer(mode):
- """
- Specify which color buffers are to be drawn into
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/drawbuffer.html}
-
- @type mode: Enumerated constant
- @param mode: Specifies up to four color buffers to be drawn into.
- """
-
-def glDrawPixels(width, height, format, type, pixels):
- """
- Write a block of pixels to the frame buffer
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/drawpixels.html}
-
- @type width, height: int
- @param width, height: Specify the dimensions of the pixel rectangle to be
- written into the frame buffer.
- @type format: Enumerated constant
- @param format: Specifies the format of the pixel data.
- @type type: Enumerated constant
- @param type: Specifies the data type for pixels.
- @type pixels: Buffer object
- @param pixels: Specifies a pointer to the pixel data.
- """
-
-def glEdgeFlag (flag):
- """
- B{glEdgeFlag, glEdgeFlagv}
-
- Flag edges as either boundary or non-boundary
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/edgeflag.html}
-
- @type flag: Depends of function prototype
- @param flag: Specifies the current edge flag value.The initial value is GL_TRUE.
- """
-
-def glEnable(cap):
- """
- Enable server-side GL capabilities
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/enable.html}
-
- @type cap: Enumerated constant
- @param cap: Specifies a symbolic constant indicating a GL capability.
- """
-
-def glEnd():
- """
- Delimit the vertices of a primitive or group of like primitives
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/begin.html}
- """
-
-def glEndList():
- """
- Create or replace a display list
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/newlist.html}
- """
-
-def glEvalCoord (u,v):
- """
- B{glEvalCoord1d, glEvalCoord1f, glEvalCoord2d, glEvalCoord2f, glEvalCoord1dv, glEvalCoord1fv,
- glEvalCoord2dv, glEvalCoord2fv}
-
- Evaluate enabled one- and two-dimensional maps
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/evalcoord.html}
-
- @type u: Depends on function prototype.
- @param u: Specifies a value that is the domain coordinate u to the basis function defined
- in a previous glMap1 or glMap2 command. If the function prototype ends in 'v' then
- u specifies a pointer to an array containing either one or two domain coordinates. The first
- coordinate is u. The second coordinate is v, which is present only in glEvalCoord2 versions.
- @type v: Depends on function prototype. (only with '2' prototypes)
- @param v: Specifies a value that is the domain coordinate v to the basis function defined
- in a previous glMap2 command. This argument is not present in a glEvalCoord1 command.
- """
-
-def glEvalMesh (mode, i1, i2):
- """
- B{glEvalMesh1 or glEvalMesh2}
-
- Compute a one- or two-dimensional grid of points or lines
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/evalmesh.html}
-
- @type mode: Enumerated constant
- @param mode: In glEvalMesh1, specifies whether to compute a one-dimensional
- mesh of points or lines.
- @type i1, i2: int
- @param i1, i2: Specify the first and last integer values for the grid domain variable i.
- """
-
-def glEvalPoint (i, j):
- """
- B{glEvalPoint1 and glEvalPoint2}
-
- Generate and evaluate a single point in a mesh
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/evalpoint.html}
-
- @type i: int
- @param i: Specifies the integer value for grid domain variable i.
- @type j: int (only with '2' prototypes)
- @param j: Specifies the integer value for grid domain variable j (glEvalPoint2 only).
- """
-
-def glFeedbackBuffer (size, type, buffer):
- """
- Controls feedback mode
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/feedbackbuffer.html}
-
- @type size: int
- @param size:Specifies the maximum number of values that can be written into buffer.
- @type type: Enumerated constant
- @param type:Specifies a symbolic constant that describes the information that
- will be returned for each vertex.
- @type buffer: Buffer object I{GL_FLOAT}
- @param buffer: Returns the feedback data.
- """
-
-def glFinish():
- """
- Block until all GL execution is complete
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/finish.html}
- """
-
-def glFlush():
- """
- Force Execution of GL commands in finite time
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/flush.html}
- """
-
-def glFog (pname, param):
- """
- B{glFogf, glFogi, glFogfv, glFogiv}
-
- Specify fog parameters
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/fog.html}
-
- @type pname: Enumerated constant
- @param pname: Specifies a single-valued fog parameter. If the function prototype
- ends in 'v' specifies a fog parameter.
- @type param: Depends on function prototype.
- @param param: Specifies the value or values to be assigned to pname. GL_FOG_COLOR
- requires an array of four values. All other parameters accept an array containing
- only a single value.
- """
-
-def glFrontFace(mode):
- """
- Define front- and back-facing polygons
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/frontface.html}
-
- @type mode: Enumerated constant
- @param mode: Specifies the orientation of front-facing polygons.
- """
-
-def glFrustum(left, right, bottom, top, zNear, zFar):
- """
- Multiply the current matrix by a perspective matrix
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/frustum.html}
-
- @type left, right: double (float)
- @param left, right: Specify the coordinates for the left and right vertical
- clipping planes.
- @type top, bottom: double (float)
- @param top, bottom: Specify the coordinates for the bottom and top horizontal
- clipping planes.
- @type zNear, zFar: double (float)
- @param zNear, zFar: Specify the distances to the near and far depth clipping planes.
- Both distances must be positive.
- """
-
-def glGenLists(range):
- """
- Generate a contiguous set of empty display lists
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/genlists.html}
-
- @type range: int
- @param range: Specifies the number of contiguous empty display lists to be generated.
- """
-
-def glGenTextures(n, textures):
- """
- Generate texture names
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gentextures.html}
-
- @type n: int
- @param n: Specifies the number of textures name to be generated.
- @type textures: Buffer object I{type GL_INT}
- @param textures: Specifies an array in which the generated textures names are stored.
- """
-
-def glGet (pname, param):
- """
- B{glGetBooleanv, glGetfloatv, glGetFloatv, glGetIntegerv}
-
- Return the value or values of a selected parameter
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/get.html}
-
- @type pname: Enumerated constant
- @param pname: Specifies the parameter value to be returned.
- @type param: Depends on function prototype.
- @param param: Returns the value or values of the specified parameter.
- """
-
-def glGetClipPlane(plane, equation):
- """
- Return the coefficients of the specified clipping plane
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getclipplane.html}
-
- @type plane: Enumerated constant
- @param plane: Specifies a clipping plane. The number of clipping planes depends on the
- implementation, but at least six clipping planes are supported. They are identified by
- symbolic names of the form GL_CLIP_PLANEi where 0 < i < GL_MAX_CLIP_PLANES.
- @type equation: Buffer object I{type GL_FLOAT}
- @param equation: Returns four float (double)-precision values that are the coefficients of the
- plane equation of plane in eye coordinates. The initial value is (0, 0, 0, 0).
- """
-
-def glGetError():
- """
- Return error information
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/geterror.html}
- """
-
-def glGetLight (light, pname, params):
- """
- B{glGetLightfv and glGetLightiv}
-
- Return light source parameter values
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getlight.html}
-
- @type light: Enumerated constant
- @param light: Specifies a light source. The number of possible lights depends on the
- implementation, but at least eight lights are supported. They are identified by symbolic
- names of the form GL_LIGHTi where 0 < i < GL_MAX_LIGHTS.
- @type pname: Enumerated constant
- @param pname: Specifies a light source parameter for light.
- @type params: Buffer object. Depends on function prototype.
- @param params: Returns the requested data.
- """
-
-def glGetMap (target, query, v):
- """
- B{glGetMapdv, glGetMapfv, glGetMapiv}
-
- Return evaluator parameters
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getmap.html}
-
- @type target: Enumerated constant
- @param target: Specifies the symbolic name of a map.
- @type query: Enumerated constant
- @param query: Specifies which parameter to return.
- @type v: Buffer object. Depends on function prototype.
- @param v: Returns the requested data.
- """
-
-def glGetMaterial (face, pname, params):
- """
- B{glGetMaterialfv, glGetMaterialiv}
-
- Return material parameters
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getmaterial.html}
-
- @type face: Enumerated constant
- @param face: Specifies which of the two materials is being queried.
- representing the front and back materials, respectively.
- @type pname: Enumerated constant
- @param pname: Specifies the material parameter to return.
- @type params: Buffer object. Depends on function prototype.
- @param params: Returns the requested data.
- """
-
-def glGetPixelMap (map, values):
- """
- B{glGetPixelMapfv, glGetPixelMapuiv, glGetPixelMapusv}
-
- Return the specified pixel map
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getpixelmap.html}
-
- @type map: Enumerated constant
- @param map: Specifies the name of the pixel map to return.
- @type values: Buffer object. Depends on function prototype.
- @param values: Returns the pixel map contents.
- """
-
-def glGetPolygonStipple(mask):
- """
- Return the polygon stipple pattern
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getpolygonstipple.html}
-
- @type mask: Buffer object I{type GL_BYTE}
- @param mask: Returns the stipple pattern. The initial value is all 1's.
- """
-
-def glGetString(name):
- """
- Return a string describing the current GL connection
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getstring.html}
-
- @type name: Enumerated constant
- @param name: Specifies a symbolic constant.
-
- """
-
-def glGetTexEnv (target, pname, params):
- """
- B{glGetTexEnvfv, glGetTexEnviv}
-
- Return texture environment parameters
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gettexenv.html}
-
- @type target: Enumerated constant
- @param target: Specifies a texture environment. Must be GL_TEXTURE_ENV.
- @type pname: Enumerated constant
- @param pname: Specifies the symbolic name of a texture environment parameter.
- @type params: Buffer object. Depends on function prototype.
- @param params: Returns the requested data.
- """
-
-def glGetTexGen (coord, pname, params):
- """
- B{glGetTexGendv, glGetTexGenfv, glGetTexGeniv}
-
- Return texture coordinate generation parameters
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gettexgen.html}
-
- @type coord: Enumerated constant
- @param coord: Specifies a texture coordinate.
- @type pname: Enumerated constant
- @param pname: Specifies the symbolic name of the value(s) to be returned.
- @type params: Buffer object. Depends on function prototype.
- @param params: Returns the requested data.
- """
-
-def glGetTexImage(target, level, format, type, pixels):
- """
- Return a texture image
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getteximage.html}
-
- @type target: Enumerated constant
- @param target: Specifies which texture is to be obtained.
- @type level: int
- @param level: Specifies the level-of-detail number of the desired image.
- Level 0 is the base image level. Level n is the nth mipmap reduction image.
- @type format: Enumerated constant
- @param format: Specifies a pixel format for the returned data.
- @type type: Enumerated constant
- @param type: Specifies a pixel type for the returned data.
- @type pixels: Buffer object.
- @param pixels: Returns the texture image. Should be a pointer to an array of the
- type specified by type
- """
-
-def glGetTexLevelParameter (target, level, pname, params):
- """
- B{glGetTexLevelParameterfv, glGetTexLevelParameteriv}
-
- return texture parameter values for a specific level of detail
- @see: U{opengl.org/developers/documentation/man_pages/hardcopy/GL/html/gl/gettexlevelparameter.html}
-
- @type target: Enumerated constant
- @param target: Specifies the symbolic name of the target texture.
- @type level: int
- @param level: Specifies the level-of-detail number of the desired image.
- Level 0 is the base image level. Level n is the nth mipmap reduction image.
- @type pname: Enumerated constant
- @param pname: Specifies the symbolic name of a texture parameter.
- @type params: Buffer object. Depends on function prototype.
- @param params: Returns the requested data.
- """
-
-def glGetTexParameter (target, pname, params):
- """
- B{glGetTexParameterfv, glGetTexParameteriv}
-
- Return texture parameter values
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gettexparameter.html}
-
- @type target: Enumerated constant
- @param target: Specifies the symbolic name of the target texture.
- @type pname: Enumerated constant
- @param pname: Specifies the symbolic name the target texture.
- @type params: Buffer object. Depends on function prototype.
- @param params: Returns the texture parameters.
- """
-
-def glHint(target, mode):
- """
- Specify implementation-specific hints
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/hint.html}
-
- @type target: Enumerated constant
- @param target: Specifies a symbolic constant indicating the behavior to be
- controlled.
- @type mode: Enumerated constant
- @param mode: Specifies a symbolic constant indicating the desired behavior.
- """
-
-def glIndex (c):
- """
- B{glIndexd, glIndexf, glIndexi, glIndexs, glIndexdv, glIndexfv, glIndexiv, glIndexsv}
-
- Set the current color index
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/index_.html}
-
- @type c: Buffer object. Depends on function prototype.
- @param c: Specifies a pointer to a one element array that contains the new value for
- the current color index.
- """
-
-def glInitNames():
- """
- Initialize the name stack
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/initnames.html}
- """
-
-def glIsEnabled(cap):
- """
- Test whether a capability is enabled
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/isenabled.html}
-
- @type cap: Enumerated constant
- @param cap: Specifies a constant representing a GL capability.
- """
-
-def glIsList(list):
- """
- Determine if a name corresponds to a display-list
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/islist.html}
-
- @type list: unsigned int
- @param list: Specifies a potential display-list name.
- """
-
-def glIsTexture(texture):
- """
- Determine if a name corresponds to a texture
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/istexture.html}
-
- @type texture: unsigned int
- @param texture: Specifies a value that may be the name of a texture.
- """
-
-def glLight (light, pname, param):
- """
- B{glLightf,glLighti, glLightfv, glLightiv}
-
- Set the light source parameters
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/light.html}
-
- @type light: Enumerated constant
- @param light: Specifies a light. The number of lights depends on the implementation,
- but at least eight lights are supported. They are identified by symbolic names of the
- form GL_LIGHTi where 0 < i < GL_MAX_LIGHTS.
- @type pname: Enumerated constant
- @param pname: Specifies a single-valued light source parameter for light.
- @type param: Depends on function prototype.
- @param param: Specifies the value that parameter pname of light source light will be set to.
- If function prototype ends in 'v' specifies a pointer to the value or values that
- parameter pname of light source light will be set to.
- """
-
-def glLightModel (pname, param):
- """
- B{glLightModelf, glLightModeli, glLightModelfv, glLightModeliv}
-
- Set the lighting model parameters
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/lightmodel.html}
-
- @type pname: Enumerated constant
- @param pname: Specifies a single-value light model parameter.
- @type param: Depends on function prototype.
- @param param: Specifies the value that param will be set to. If function prototype ends in 'v'
- specifies a pointer to the value or values that param will be set to.
- """
-
-def glLineStipple(factor, pattern):
- """
- Specify the line stipple pattern
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/linestipple.html}
-
- @type factor: int
- @param factor: Specifies a multiplier for each bit in the line stipple pattern.
- If factor is 3, for example, each bit in the pattern is used three times before
- the next bit in the pattern is used. factor is clamped to the range [1, 256] and
- defaults to 1.
- @type pattern: unsigned short int
- @param pattern: Specifies a 16-bit integer whose bit pattern determines which fragments
- of a line will be drawn when the line is rasterized. Bit zero is used first; the default
- pattern is all 1's.
- """
-
-def glLineWidth(width):
- """
- Specify the width of rasterized lines.
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/linewidth.html}
-
- @type width: float
- @param width: Specifies the width of rasterized lines. The initial value is 1.
- """
-
-def glListBase(base):
- """
- Set the display-list base for glCallLists
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/listbase.html}
-
- @type base: unsigned int
- @param base: Specifies an integer offset that will be added to glCallLists
- offsets to generate display-list names. The initial value is 0.
- """
-
-def glLoadIdentity():
- """
- Replace the current matrix with the identity matrix
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/loadidentity.html}
- """
-
-def glLoadMatrix (m):
- """
- B{glLoadMatrixd, glLoadMatixf}
-
- Replace the current matrix with the specified matrix
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/loadmatrix.html}
-
- @type m: Buffer object. Depends on function prototype.
- @param m: Specifies a pointer to 16 consecutive values, which are used as the elements
- of a 4x4 column-major matrix.
- """
-
-def glLoadName(name):
- """
- Load a name onto the name stack.
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/loadname.html}
-
- @type name: unsigned int
- @param name: Specifies a name that will replace the top value on the name stack.
- """
-
-def glLogicOp(opcode):
- """
- Specify a logical pixel operation for color index rendering
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/logicop.html}
-
- @type opcode: Enumerated constant
- @param opcode: Specifies a symbolic constant that selects a logical operation.
- """
-
-def glMap1 (target, u1, u2, stride, order, points):
- """
- B{glMap1d, glMap1f}
-
- Define a one-dimensional evaluator
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/map1.html}
-
- @type target: Enumerated constant
- @param target: Specifies the kind of values that are generated by the evaluator.
- @type u1, u2: Depends on function prototype.
- @param u1,u2: Specify a linear mapping of u, as presented to glEvalCoord1, to ^, t
- he variable that is evaluated by the equations specified by this command.
- @type stride: int
- @param stride: Specifies the number of floats or float (double)s between the beginning
- of one control point and the beginning of the next one in the data structure
- referenced in points. This allows control points to be embedded in arbitrary data
- structures. The only constraint is that the values for a particular control point must
- occupy contiguous memory locations.
- @type order: int
- @param order: Specifies the number of control points. Must be positive.
- @type points: Buffer object. Depends on function prototype.
- @param points: Specifies a pointer to the array of control points.
- """
-
-def glMap2 (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points):
- """
- B{glMap2d, glMap2f}
-
- Define a two-dimensional evaluator
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/map2.html}
-
- @type target: Enumerated constant
- @param target: Specifies the kind of values that are generated by the evaluator.
- @type u1, u2: Depends on function prototype.
- @param u1,u2: Specify a linear mapping of u, as presented to glEvalCoord2, to ^, t
- he variable that is evaluated by the equations specified by this command. Initially
- u1 is 0 and u2 is 1.
- @type ustride: int
- @param ustride: Specifies the number of floats or float (double)s between the beginning
- of control point R and the beginning of control point R ij, where i and j are the u
- and v control point indices, respectively. This allows control points to be embedded
- in arbitrary data structures. The only constraint is that the values for a particular
- control point must occupy contiguous memory locations. The initial value of ustride is 0.
- @type uorder: int
- @param uorder: Specifies the dimension of the control point array in the u axis.
- Must be positive. The initial value is 1.
- @type v1, v2: Depends on function prototype.
- @param v1, v2: Specify a linear mapping of v, as presented to glEvalCoord2, to ^,
- one of the two variables that are evaluated by the equations specified by this command.
- Initially, v1 is 0 and v2 is 1.
- @type vstride: int
- @param vstride: Specifies the number of floats or float (double)s between the beginning of control
- point R and the beginning of control point R ij, where i and j are the u and v control
- point(indices, respectively. This allows control points to be embedded in arbitrary data
- structures. The only constraint is that the values for a particular control point must
- occupy contiguous memory locations. The initial value of vstride is 0.
- @type vorder: int
- @param vorder: Specifies the dimension of the control point array in the v axis.
- Must be positive. The initial value is 1.
- @type points: Buffer object. Depends on function prototype.
- @param points: Specifies a pointer to the array of control points.
- """
-
-def glMapGrid (un, u1,u2 ,vn, v1, v2):
- """
- B{glMapGrid1d, glMapGrid1f, glMapGrid2d, glMapGrid2f}
-
- Define a one- or two-dimensional mesh
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/mapgrid.html}
-
- @type un: int
- @param un: Specifies the number of partitions in the grid range interval
- [u1, u2]. Must be positive.
- @type u1, u2: Depends on function prototype.
- @param u1, u2: Specify the mappings for integer grid domain values i=0 and i=un.
- @type vn: int
- @param vn: Specifies the number of partitions in the grid range interval [v1, v2]
- (glMapGrid2 only).
- @type v1, v2: Depends on function prototype.
- @param v1, v2: Specify the mappings for integer grid domain values j=0 and j=vn
- (glMapGrid2 only).
- """
-
-def glMaterial (face, pname, params):
- """
- Specify material parameters for the lighting model.
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/material.html}
-
- @type face: Enumerated constant
- @param face: Specifies which face or faces are being updated. Must be one of:
- @type pname: Enumerated constant
- @param pname: Specifies the single-valued material parameter of the face
- or faces that is being updated. Must be GL_SHININESS.
- @type params: int
- @param params: Specifies the value that parameter GL_SHININESS will be set to.
- If function prototype ends in 'v' specifies a pointer to the value or values that
- pname will be set to.
- """
-
-def glMatrixMode(mode):
- """
- Specify which matrix is the current matrix.
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/matrixmode.html}
-
- @type mode: Enumerated constant
- @param mode: Specifies which matrix stack is the target for subsequent matrix operations.
- """
-
-def glMultMatrix (m):
- """
- B{glMultMatrixd, glMultMatrixf}
-
- Multiply the current matrix with the specified matrix
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/multmatrix.html}
-
- @type m: Buffer object. Depends on function prototype.
- @param m: Points to 16 consecutive values that are used as the elements of a 4x4 column
- major matrix.
- """
-
-def glNewList(list, mode):
- """
- Create or replace a display list
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/newlist.html}
-
- @type list: unsigned int
- @param list: Specifies the display list name
- @type mode: Enumerated constant
- @param mode: Specifies the compilation mode.
- """
-
-def glNormal3 (nx, ny, nz, v):
- """
- B{Normal3b, Normal3bv, Normal3d, Normal3dv, Normal3f, Normal3fv, Normal3i, Normal3iv,
- Normal3s, Normal3sv}
-
- Set the current normal vector
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/normal.html}
-
- @type nx, ny, nz: Depends on function prototype. (non - 'v' prototypes only)
- @param nx, ny, nz: Specify the x, y, and z coordinates of the new current normal.
- The initial value of the current normal is the unit vector, (0, 0, 1).
- @type v: Buffer object. Depends on function prototype. ('v' prototypes)
- @param v: Specifies a pointer to an array of three elements: the x,y, and z coordinates
- of the new current normal.
- """
-
-def glOrtho(left, right, bottom, top, zNear, zFar):
- """
- Multiply the current matrix with an orthographic matrix
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/ortho.html}
-
- @type left, right: double (float)
- @param left, right: Specify the coordinates for the left and
- right vertical clipping planes.
- @type bottom, top: double (float)
- @param bottom, top: Specify the coordinates for the bottom and top
- horizontal clipping planes.
- @type zNear, zFar: double (float)
- @param zNear, zFar: Specify the distances to the nearer and farther
- depth clipping planes. These values are negative if the plane is to be behind the viewer.
- """
-
-def glPassThrough(token):
- """
- Place a marker in the feedback buffer
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/passthrough.html}
-
- @type token: float
- @param token: Specifies a marker value to be placed in the feedback
- buffer following a GL_PASS_THROUGH_TOKEN.
- """
-
-def glPixelMap (map, mapsize, values):
- """
- B{glPixelMapfv, glPixelMapuiv, glPixelMapusv}
-
- Set up pixel transfer maps
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixelmap.html}
-
- @type map: Enumerated constant
- @param map: Specifies a symbolic map name.
- @type mapsize: int
- @param mapsize: Specifies the size of the map being defined.
- @type values: Buffer object. Depends on function prototype.
- @param values: Specifies an array of mapsize values.
- """
-
-def glPixelStore (pname, param):
- """
- B{glPixelStoref, glPixelStorei}
-
- Set pixel storage modes
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixelstore.html}
-
- @type pname: Enumerated constant
- @param pname: Specifies the symbolic name of the parameter to be set.
- Six values affect the packing of pixel data into memory.
- Six more affect the unpacking of pixel data from memory.
- @type param: Depends on function prototype.
- @param param: Specifies the value that pname is set to.
- """
-
-def glPixelTransfer (pname, param):
- """
- B{glPixelTransferf, glPixelTransferi}
-
- Set pixel transfer modes
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixeltransfer.html}
-
- @type pname: Enumerated constant
- @param pname: Specifies the symbolic name of the pixel transfer parameter to be set.
- @type param: Depends on function prototype.
- @param param: Specifies the value that pname is set to.
- """
-
-def glPixelZoom(xfactor, yfactor):
- """
- Specify the pixel zoom factors
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixelzoom.html}
-
- @type xfactor, yfactor: float
- @param xfactor, yfactor: Specify the x and y zoom factors for pixel write operations.
- """
-
-def glPointSize(size):
- """
- Specify the diameter of rasterized points
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pointsize.html}
-
- @type size: float
- @param size: Specifies the diameter of rasterized points. The initial value is 1.
- """
-
-def glPolygonMode(face, mode):
- """
- Select a polygon rasterization mode
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/polygonmode.html}
-
- @type face: Enumerated constant
- @param face: Specifies the polygons that mode applies to.
- Must be GL_FRONT for front-facing polygons, GL_BACK for back- facing polygons,
- or GL_FRONT_AND_BACK for front- and back-facing polygons.
- @type mode: Enumerated constant
- @param mode: Specifies how polygons will be rasterized.
- The initial value is GL_FILL for both front- and back- facing polygons.
- """
-
-def glPolygonOffset(factor, units):
- """
- Set the scale and units used to calculate depth values
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/polygonoffset.html}
-
- @type factor: float
- @param factor: Specifies a scale factor that is used to create a variable depth
- offset for each polygon. The initial value is 0.
- @type units: float
- @param units: Is multiplied by an implementation-specific value to create a constant
- depth offset. The initial value is 0.
- """
-
-def glPolygonStipple(mask):
- """
- Set the polygon stippling pattern
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/polygonstipple.html}
-
- @type mask: Buffer object I{type GL_BYTE}
- @param mask: Specifies a pointer to a 32x32 stipple pattern that will be unpacked
- from memory in the same way that glDrawPixels unpacks pixels.
- """
-
-def glPopAttrib():
- """
- Pop the server attribute stack
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushattrib.html}
- """
-
-def glPopClientAttrib():
- """
- Pop the client attribute stack
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushclientattrib.html}
- """
-
-def glPopMatrix():
- """
- Pop the current matrix stack
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushmatrix.html}
- """
-
-def glPopName():
- """
- Pop the name stack
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushname.html}
- """
-
-def glPrioritizeTextures(n, textures, priorities):
- """
- Set texture residence priority
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/prioritizetextures.html}
-
- @type n: int
- @param n:Specifies the number of textures to be prioritized.
- @type textures: Buffer I{type GL_INT}
- @param textures: Specifies an array containing the names of the textures to be prioritized.
- @type priorities: Buffer I{type GL_FLOAT}
- @param priorities: Specifies an array containing the texture priorities. A priority given
- in an element of priorities applies to the texture named by the corresponding element of textures.
- """
-
-def glPushAttrib(mask):
- """
- Push the server attribute stack
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushattrib.html}
-
- @type mask: Enumerated constant(s)
- @param mask: Specifies a mask that indicates which attributes to save.
- """
-
-def glPushClientAttrib(mask):
- """
- Push the client attribute stack
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushclientattrib.html}
-
- @type mask: Enumerated constant(s)
- @param mask: Specifies a mask that indicates which attributes to save.
- """
-
-def glPushMatrix():
- """
- Push the current matrix stack
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushmatrix.html}
- """
-
-def glPushName(name):
- """
- Push the name stack
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushname.html}
-
- @type name: unsigned int
- @param name: Specifies a name that will be pushed onto the name stack.
- """
-
-def glRasterPos (x,y,z,w):
- """
- B{glRasterPos2d, glRasterPos2f, glRasterPos2i, glRasterPos2s, glRasterPos3d,
- glRasterPos3f, glRasterPos3i, glRasterPos3s, glRasterPos4d, glRasterPos4f,
- glRasterPos4i, glRasterPos4s, glRasterPos2dv, glRasterPos2fv, glRasterPos2iv,
- glRasterPos2sv, glRasterPos3dv, glRasterPos3fv, glRasterPos3iv, glRasterPos3sv,
- glRasterPos4dv, glRasterPos4fv, glRasterPos4iv, glRasterPos4sv}
-
- Specify the raster position for pixel operations
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rasterpos.html}
-
- @type x, y, z, w: Depends on function prototype. (z and w for '3' and '4' prototypes only)
- @param x,y,z,w: Specify the x,y,z, and w object coordinates (if present) for the
- raster position. If function prototype ends in 'v' specifies a pointer to an array of two,
- three, or four elements, specifying x, y, z, and w coordinates, respectively.
- @note:
- If you are drawing to the 3d view with a Scriptlink of a space handler
- the zoom level of the panels will scale the glRasterPos by the view matrix.
- so a X of 10 will not always offset 10 pixels as you would expect.
-
- To work around this get the scale value of the view matrix and use it to scale your pixel values.
-
- Workaround::
-
- import Blender
- from Blender.BGL import *
- xval, yval= 100, 40
- # Get the scale of the view matrix
- viewMatrix = Buffer(GL_FLOAT, 16)
- glGetFloatv(GL_MODELVIEW_MATRIX, viewMatrix)
- f = 1/viewMatrix[0]
- glRasterPos2f(xval*f, yval*f) # Instead of the usual glRasterPos2i(xval, yval)
- """
-
-def glReadBuffer(mode):
- """
- Select a color buffer source for pixels.
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/readbuffer.html}
-
- @type mode: Enumerated constant
- @param mode: Specifies a color buffer.
- """
-
-def glReadPixels(x, y, width, height, format, type, pixels):
- """
- Read a block of pixels from the frame buffer
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/readpixels.html}
-
- @type x,y: int
- @param x,y:Specify the window coordinates of the first pixel that is read
- from the frame buffer. This location is the lower left corner of a rectangular
- block of pixels.
- @type width, height: int
- @param width, height: Specify the dimensions of the pixel rectangle. width and
- height of one correspond to a single pixel.
- @type format: Enumerated constant
- @param format: Specifies the format of the pixel data.
- @type type: Enumerated constant
- @param type: Specifies the data type of the pixel data.
- @type pixels: Buffer object
- @param pixels: Returns the pixel data.
- """
-
-def glRect (x1,y1,x2,y2,v1,v2):
- """
- B{glRectd, glRectf, glRecti, glRects, glRectdv, glRectfv, glRectiv, glRectsv}
-
- Draw a rectangle
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rect.html}
-
- @type x1, y1: Depends on function prototype. (for non 'v' prototypes only)
- @param x1, y1: Specify one vertex of a rectangle
- @type x2, y2: Depends on function prototype. (for non 'v' prototypes only)
- @param x2, y2: Specify the opposite vertex of the rectangle
- @type v1, v2: Depends on function prototype. (for 'v' prototypes only)
- @param v1, v2: Specifies a pointer to one vertex of a rectangle and the pointer
- to the opposite vertex of the rectangle
- """
-
-def glRenderMode(mode):
- """
- Set rasterization mode
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rendermode.html}
-
- @type mode: Enumerated constant
- @param mode: Specifies the rasterization mode.
- """
-
-def glRotate (angle, x, y, z):
- """
- B{glRotated, glRotatef}
-
- Multiply the current matrix by a rotation matrix
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rotate.html}
-
- @type angle: Depends on function prototype.
- @param angle: Specifies the angle of rotation in degrees.
- @type x,y,z: Depends on function prototype.
- @param x,y,z: Specify the x,y, and z coordinates of a vector respectively.
- """
-
-def glScale (x,y,z):
- """
- B{glScaled, glScalef}
-
- Multiply the current matrix by a general scaling matrix
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/scale.html}
-
- @type x,y,z: Depends on function prototype.
- @param x,y,z: Specify scale factors along the x,y, and z axes, respectively.
- """
-
-def glScissor(x,y,width,height):
- """
- Define the scissor box
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/scissor.html}
-
- @type x,y: int
- @param x,y: Specify the lower left corner of the scissor box. Initially (0, 0).
- @type width, height: int
- @param width height: Specify the width and height of the scissor box. When a
- GL context is first attached to a window, width and height are set to the
- dimensions of that window.
- """
-
-def glSelectBuffer(size, buffer):
- """
- Establish a buffer for selection mode values
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/selectbuffer.html}
-
- @type size: int
- @param size: Specifies the size of buffer
- @type buffer: Buffer I{type GL_INT}
- @param buffer: Returns the selection data
- """
-
-def glShadeModel(mode):
- """
- Select flat or smooth shading
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/shademodel.html}
-
- @type mode: Enumerated constant
- @param mode: Specifies a symbolic value representing a shading technique.
- """
-
-def glStencilFuc(func, ref, mask):
- """
- Set function and reference value for stencil testing
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/stencilfunc.html}
-
- @type func: Enumerated constant
- @param func:Specifies the test function.
- @type ref: int
- @param ref:Specifies the reference value for the stencil test. ref is clamped to
- the range [0,2n-1], where n is the number of bitplanes in the stencil buffer.
- The initial value is 0.
- @type mask: unsigned int
- @param mask:Specifies a mask that is ANDed with both the reference value and
- the stored stencil value when the test is done. The initial value is all 1's.
- """
-
-def glStencilMask(mask):
- """
- Control the writing of individual bits in the stencil planes
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/stencilmask.html}
-
- @type mask: unsigned int
- @param mask: Specifies a bit mask to enable and disable writing of individual bits
- in the stencil planes. Initially, the mask is all 1's.
- """
-
-def glStencilOp(fail, zfail, zpass):
- """
- Set stencil test actions
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/stencilop.html}
-
- @type fail: Enumerated constant
- @param fail: Specifies the action to take when the stencil test fails.
- The initial value is GL_KEEP.
- @type zfail: Enumerated constant
- @param zfail: Specifies the stencil action when the stencil test passes, but the
- depth test fails. zfail accepts the same symbolic constants as fail.
- The initial value is GL_KEEP.
- @type zpass: Enumerated constant
- @param zpass: Specifies the stencil action when both the stencil test and the
- depth test pass, or when the stencil test passes and either there is no depth
- buffer or depth testing is not enabled. zpass accepts the same symbolic constants
- as fail. The initial value is GL_KEEP.
- """
-
-def glTexCoord (s,t,r,q,v):
- """
- B{glTexCoord1d, glTexCoord1f, glTexCoord1i, glTexCoord1s, glTexCoord2d, glTexCoord2f,
- glTexCoord2i, glTexCoord2s, glTexCoord3d, glTexCoord3f, glTexCoord3i, glTexCoord3s,
- glTexCoord4d, glTexCoord4f, glTexCoord4i, glTexCoord4s, glTexCoord1dv, glTexCoord1fv,
- glTexCoord1iv, glTexCoord1sv, glTexCoord2dv, glTexCoord2fv, glTexCoord2iv,
- glTexCoord2sv, glTexCoord3dv, glTexCoord3fv, glTexCoord3iv, glTexCoord3sv,
- glTexCoord4dv, glTexCoord4fv, glTexCoord4iv, glTexCoord4sv}
-
- Set the current texture coordinates
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texcoord.html}
-
- @type s,t,r,q: Depends on function prototype. (r and q for '3' and '4' prototypes only)
- @param s,t,r,q: Specify s, t, r, and q texture coordinates. Not all parameters are
- present in all forms of the command.
- @type v: Buffer object. Depends on function prototype. (for 'v' prototypes only)
- @param v: Specifies a pointer to an array of one, two, three, or four elements,
- which in turn specify the s, t, r, and q texture coordinates.
- """
-
-def glTexEnv (target, pname, param):
- """
- B{glTextEnvf, glTextEnvi, glTextEnvfv, glTextEnviv}
-
- Set texture environment parameters
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texenv.html}
-
- @type target: Enumerated constant
- @param target: Specifies a texture environment. Must be GL_TEXTURE_ENV.
- @type pname: Enumerated constant
- @param pname: Specifies the symbolic name of a single-valued texture environment
- parameter. Must be GL_TEXTURE_ENV_MODE.
- @type param: Depends on function prototype.
- @param param: Specifies a single symbolic constant. If function prototype ends in 'v'
- specifies a pointer to a parameter array that contains either a single symbolic
- constant or an RGBA color
- """
-
-def glTexGen (coord, pname, param):
- """
- B{glTexGend, glTexGenf, glTexGeni, glTexGendv, glTexGenfv, glTexGeniv}
-
- Control the generation of texture coordinates
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texgen.html}
-
- @type coord: Enumerated constant
- @param coord: Specifies a texture coordinate.
- @type pname: Enumerated constant
- @param pname: Specifies the symbolic name of the texture- coordinate generation function.
- @type param: Depends on function prototype.
- @param param: Specifies a single-valued texture generation parameter.
- If function prototype ends in 'v' specifies a pointer to an array of texture
- generation parameters. If pname is GL_TEXTURE_GEN_MODE, then the array must
- contain a single symbolic constant. Otherwise, params holds the coefficients
- for the texture-coordinate generation function specified by pname.
- """
-
-def glTexImage1D(target, level, internalformat, width, border, format, type, pixels):
- """
- Specify a one-dimensional texture image
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/teximage1d.html}
-
- @type target: Enumerated constant
- @param target: Specifies the target texture.
- @type level: int
- @param level: Specifies the level-of-detail number. Level 0 is the base image level.
- Level n is the nth mipmap reduction image.
- @type internalformat: int
- @param internalformat: Specifies the number of color components in the texture.
- @type width: int
- @param width: Specifies the width of the texture image. Must be 2n+2(border) for
- some integer n. All implementations support texture images that are at least 64
- texels wide. The height of the 1D texture image is 1.
- @type border: int
- @param border: Specifies the width of the border. Must be either 0 or 1.
- @type format: Enumerated constant
- @param format: Specifies the format of the pixel data.
- @type type: Enumerated constant
- @param type: Specifies the data type of the pixel data.
- @type pixels: Buffer object.
- @param pixels: Specifies a pointer to the image data in memory.
- """
-
-def glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels):
- """
- Specify a two-dimensional texture image
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/teximage2d.html}
-
- @type target: Enumerated constant
- @param target: Specifies the target texture.
- @type level: int
- @param level: Specifies the level-of-detail number. Level 0 is the base image level.
- Level n is the nth mipmap reduction image.
- @type internalformat: int
- @param internalformat: Specifies the number of color components in the texture.
- @type width: int
- @param width: Specifies the width of the texture image. Must be 2n+2(border) for
- some integer n. All implementations support texture images that are at least 64
- texels wide.
- @type height: int
- @param height: Specifies the height of the texture image. Must be 2m+2(border) for
- some integer m. All implementations support texture images that are at least 64
- texels high.
- @type border: int
- @param border: Specifies the width of the border. Must be either 0 or 1.
- @type format: Enumerated constant
- @param format: Specifies the format of the pixel data.
- @type type: Enumerated constant
- @param type: Specifies the data type of the pixel data.
- @type pixels: Buffer object.
- @param pixels: Specifies a pointer to the image data in memory.
- """
-
-def glTexParameter (target, pname, param):
- """
- B{glTexParameterf, glTexParameteri, glTexParameterfv, glTexParameteriv}
-
- Set texture parameters
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texparameter.html}
-
- @type target: Enumerated constant
- @param target: Specifies the target texture.
- @type pname: Enumerated constant
- @param pname: Specifies the symbolic name of a single-valued texture parameter.
- @type param: Depends on function prototype.
- @param param: Specifies the value of pname. If function prototype ends in 'v' specifies
- a pointer to an array where the value or values of pname are stored.
- """
-
-def glTranslate (x, y, z):
- """
- B{glTranslatef, glTranslated}
-
- Multiply the current matrix by a translation matrix
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/translate.html}
-
- @type x,y,z: Depends on function prototype.
- @param x,y,z: Specify the x, y, and z coordinates of a translation vector.
- """
-
-def glVertex (x,y,z,w,v):
- """
- B{glVertex2d, glVertex2f, glVertex2i, glVertex2s, glVertex3d, glVertex3f, glVertex3i,
- glVertex3s, glVertex4d, glVertex4f, glVertex4i, glVertex4s, glVertex2dv, glVertex2fv,
- glVertex2iv, glVertex2sv, glVertex3dv, glVertex3fv, glVertex3iv, glVertex3sv, glVertex4dv,
- glVertex4fv, glVertex4iv, glVertex4sv}
-
- Specify a vertex
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/vertex.html}
-
- @type x,y,z,w: Depends on function prototype (z and w for '3' and '4' prototypes only)
- @param x,y,z,w: Specify x, y, z, and w coordinates of a vertex. Not all parameters
- are present in all forms of the command.
- @type v: Buffer object. Depends of function prototype (for 'v' prototypes only)
- @param v: Specifies a pointer to an array of two, three, or four elements. The
- elements of a two-element array are x and y; of a three-element array, x, y, and z;
- and of a four-element array, x, y, z, and w.
- """
-
-def glViewport(x,y,width,height):
- """
- Set the viewport
- @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/viewport.html}
-
- @type x,y: int
- @param x,y: Specify the lower left corner of the viewport rectangle,
- in pixels. The initial value is (0,0).
- @type width,height: int
- @param width,height: Specify the width and height of the viewport. When a GL context
- is first attached to a window, width and height are set to the dimensions of that window.
- """
-
-def gluPerspective(fovY, aspect, zNear, zFar):
- """
- Set up a perspective projection matrix.
- @see: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5577288}
-
- @type fovY: double
- @param fovY: Specifies the field of view angle, in degrees, in the y direction.
- @type aspect: double
- @param aspect: Specifies the aspect ratio that determines the field of view in the x direction.
- The aspect ratio is the ratio of x (width) to y (height).
- @type zNear: double
- @param zNear: Specifies the distance from the viewer to the near clipping plane (always positive).
- @type zFar: double
- @param zFar: Specifies the distance from the viewer to the far clipping plane (always positive).
- """
-
-def gluLookAt(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz):
- """
- Define a viewing transformation
- @see: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5573042}
-
- @type eyex, eyey, eyez: double
- @param eyex, eyey, eyez: Specifies the position of the eye point.
- @type centerx, centery, centerz: double
- @param centerx, centery, centerz: Specifies the position of the reference point.
- @type upx, upy, upz: double
- @param upx, upy, upz: Specifies the direction of the up vector.
- """
-
-def gluOrtho2D(left, right, bottom, top):
- """
- Define a 2-D orthographic projection matrix
- @see: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5578074}
-
- @type left, right: double
- @param left, right: Specify the coordinates for the left and right vertical clipping planes.
- @type bottom, top: double
- @param bottom, top: Specify the coordinates for the bottom and top horizontal clipping planes.
- """
-
-def gluPickMatrix(x, y, width, height, viewport):
- """
- Define a picking region
- @see: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5578074}
-
- @type x, y: double
- @param x, y: Specify the center of a picking region in window coordinates.
- @type width, height: double
- @param width, height: Specify the width and height, respectively, of the picking region in window coordinates.
- @type viewport: Buffer object. [int]
- @param viewport: Specifies the current viewport.
- """
-
-def gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, winx, winy, winz):
- """
- Map object coordinates to window coordinates.
- @see: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5578074}
-
- @type objx, objy, objz: double
- @param objx, objy, objz: Specify the object coordinates.
- @type modelMatrix: Buffer object. [double]
- @param modelMatrix: Specifies the current modelview matrix (as from a glGetDoublev call).
- @type projMatrix: Buffer object. [double]
- @param projMatrix: Specifies the current projection matrix (as from a glGetDoublev call).
- @type viewport: Buffer object. [int]
- @param viewport: Specifies the current viewport (as from a glGetIntegerv call).
- @type winx, winy, winz: Buffer object. [double]
- @param winx, winy, winz: Return the computed window coordinates.
- """
-
-def gluUnProject(winx, winy, winz, modelMatrix, projMatrix, viewport, objx, objy, objz):
- """
- Map object coordinates to window
- coordinates.
- @see: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5582204}
-
- @type winx, winy, winz: double
- @param winx, winy, winz: Specify the window coordinates to be mapped.
- @type modelMatrix: Buffer object. [double]
- @param modelMatrix: Specifies the current modelview matrix (as from a glGetDoublev call).
- @type projMatrix: Buffer object. [double]
- @param projMatrix: Specifies the current projection matrix (as from a glGetDoublev call).
- @type viewport: Buffer object. [int]
- @param viewport: Specifies the current viewport (as from a glGetIntegerv call).
- @type objx, objy, objz: Buffer object. [double]
- @param objx, objy, objz: Return the computed object coordinates.
- """
-
-class Buffer:
- """
- The Buffer object is simply a block of memory that is delineated and initialized by the
- user. Many OpenGL functions return data to a C-style pointer, however, because this
- is not possible in python the Buffer object can be used to this end. Wherever pointer
- notation is used in the OpenGL functions the Buffer object can be used in it's BGL
- wrapper. In some instances the Buffer object will need to be initialized with the template
- parameter, while in other instances the user will want to create just a blank buffer
- which will be zeroed by default.
-
- Example with Buffer::
- import Blender
- from Blender import BGL
- myByteBuffer = BGL.Buffer(BGL.GL_BYTE, [32,32])
- BGL.glGetPolygonStipple(myByteBuffer)
- print myByteBuffer.dimensions
- print myByteBuffer.list
- sliceBuffer = myByteBuffer[0:16]
- print sliceBuffer
-
- @ivar list: The contents of the Buffer.
- @ivar dimensions: The size of the Buffer.
- """
-
- def __init__(type, dimensions, template = None):
- """
- This will create a new Buffer object for use with other BGL OpenGL commands.
- Only the type of argument to store in the buffer and the dimensions of the buffer
- are necessary. Buffers are zeroed by default unless a template is supplied, in
- which case the buffer is initialized to the template.
-
- @type type: int
- @param type: The format to store data in. The type should be one of
- GL_BYTE, GL_SHORT, GL_INT, or GL_FLOAT.
- @type dimensions: An int or sequence object specifying the dimensions of the buffer.
- @param dimensions: If the dimensions are specified as an int a linear array will
- be created for the buffer. If a sequence is passed for the dimensions, the buffer
- becomes n-Dimensional, where n is equal to the number of parameters passed in the
- sequence. Example: [256,2] is a two- dimensional buffer while [256,256,4] creates
- a three- dimensional buffer. You can think of each additional dimension as a sub-item
- of the dimension to the left. i.e. [10,2] is a 10 element array each with 2 sub-items.
- [(0,0), (0,1), (1,0), (1,1), (2,0), ...] etc.
- @type template: A python sequence object (optional)
- @param template: A sequence of matching dimensions which will be used to initialize
- the Buffer. If a template is not passed in all fields will be initialized to 0.
- @rtype: Buffer object
- @return: The newly created buffer as a PyObject.
- """
diff --git a/source/blender/python/api2_2x/doc/BezTriple.py b/source/blender/python/api2_2x/doc/BezTriple.py
deleted file mode 100644
index eb12dd0051e..00000000000
--- a/source/blender/python/api2_2x/doc/BezTriple.py
+++ /dev/null
@@ -1,96 +0,0 @@
-# Blender.BezTriple module and the BezTriple PyType object
-
-"""
-The Blender.BezTriple submodule
-
-B{New}:
- - new attributes L{handleTypes<BezTriple.handleTypes>},
- L{selects<BezTriple.selects>} and L{weight<BezTriple.weight>}
-
-This module provides access to the BezTriple Data in Blender. It is used by
-CurNurb and IpoCurve objects.
-
-@type HandleTypes: readonly dictionary
-@var HandleTypes: The available BezTriple handle types.
- - FREE - handle has no constraints
- - AUTO - completely constrain handle based on knot position
- - VECT - constraint handle to line between current and neighboring knot
- - ALIGN - constrain handle to lie in a straight line with knot's other
- handle
- - AUTOANIM - constrain IPO handles to be horizontal on extremes
-"""
-
-def New (coords):
- """
- Create a new BezTriple object.
-
- @type coords: sequence of three or nine floats
- @param coords: the coordinate values for the new control point. If three
- floats are given, then the handle values are automatically generated.
- @rtype: BezTriple
- @return: a new BezTriple object
- """
-
-class BezTriple:
- """
- The BezTriple object
- ====================
- This object gives access to generic data from all BezTriple objects in
- Blender.
- @ivar pt : the [x,y] coordinates for knot point of this BezTriple. After
- changing coordinates of a Ipo curve, it is advisable to call
- L{IpoCurve.recalc()<IpoCurve.IpoCurve.recalc>} to update the curve.
- @type pt: list of two floats
- @ivar vec : a list of the 3 points [ handle, knot, handle ] that comprise a
- BezTriple, with each point composed of a list [x,y,z] of floats. The list
- looks like [ [H1x, H1y, H1z], [Px, Py, Pz], [H2x, H2y, H2z] ].
- Example::
- # where bt is of type BezTriple
- # and h1, p, and h2 are lists of 3 floats
- h1, p, h2 = bt.vec
- @type vec: list of points
- @ivar tilt: the tilt/alpha value for the point
- @type tilt: float
- @ivar radius: the radius of this point (used for tapering bevels)
- @type radius: float
- @ivar hide: the visibility status of the knot. B{Note}: true/nonzero means
- I{not} hidden. B{Note}: primarily intended for curves; not a good idea to
- hide IPO control points.
- @type hide: int
- @ivar handleTypes: the types of the point's two handles. See
- L{HandleTypes} for a complete description.
- @type handleTypes list of two ints
- @ivar selects: the select status for [handle, knot, handle]. True/nonzero
- if the point is selected.
- @type selects: list of three ints
- @ivar weight: the weight assigned to the control point. Useful for
- softbodies and possibly others.
- @type weight: float
- """
-
- def getPoints():
- """
- Returns the x,y coordinates of the Bezier knot point (B{deprecated}).
- See the L{BezTriple.pt} attribute.
- @rtype: list of floats
- @return: list of the x and y coordinates of the Bezier point.
- """
-
- def setPoints(newval):
- """
- Sets the x,y coordinates of the Bezier knot point (B{deprecated}).
- See the L{BezTriple.pt} attribute.
- @type newval: tuple of 2 floats
- @param newval: the x and y coordinates of the new Bezier point.
- @rtype: None
- @return: None
- """
-
- def getTriple():
- """
- Returns the x,y,z coordinates for each of the three points that make up
- a BezierTriple (B{deprecated}). See the L{BezTriple.vec} attribute.
- @rtype: list consisting of 3 lists of 3 floats
- @return: handle1, knot, handle2
- """
-
diff --git a/source/blender/python/api2_2x/doc/Blender.py b/source/blender/python/api2_2x/doc/Blender.py
deleted file mode 100644
index 088a02c547c..00000000000
--- a/source/blender/python/api2_2x/doc/Blender.py
+++ /dev/null
@@ -1,240 +0,0 @@
-# The Blender Module
-
-# The module files in this folder are used to create the API documentation.
-# Doc system used: epydoc - http://epydoc.sf.net
-# pseudo command line (check the epy_docgen.sh file):
-# epydoc -o BPY_API_23x --url "http://www.blender.org" -t Blender.py \
-# -n "Blender" --no-private --no-frames Blender.py \
-# Types.py Scene.py Object.py [ ... etc]
-
-"""
-The main Blender module.
-
-B{New}: L{Run}, L{UpdateMenus}, new options to L{Get}, L{ShowHelp},
-L{SpaceHandlers} dictionary.
-L{UnpackModes} dictionary.
-
-Blender
-=======
-
-@type bylink: bool
-@var bylink: True if the current script is being executed as a script link.
-@type link: Blender Object or None; integer (space handlers)
-@var link: for normal script links, 'link' points to the linked Object (can be
- a scene, object (mesh, camera, lamp), material or
- world). For space handler script links, 'link' is an integer from the
- Blender.L{SpaceHandlers} dictionary. For script not running as script
- links, 'link' is None.
-@type event: string or int
-@var event: this has three possible uses: script link type or events callback
- ascii value:
- - for normal script links it is a string representing the link type
- (OnLoad, FrameChanged, Redraw, etc.).
- - for EVENT space handler script links it is the passed event.
- - for normal L{GUI<Draw.Register>} scripts I{during the events callback},
- it holds the ascii value of the current event, if it is a valid one.
- Users interested in this should also check the builtin 'ord' and 'chr'
- Python functions.
-@type mode: string
-@var mode: Blender's current mode:
- - 'interactive': normal mode, with an open window answering to user input;
- - 'background': Blender was started as 'C{blender -b <blender file>}' and
- will exit as soon as it finishes rendering or executing a script
- (ex: 'C{blender -b <blender file> -P <script>}'). Try 'C{blender -h}'
- for more detailed informations.
-@type UnpackModes: constant dictionary
-@var UnpackModes: dictionary with available unpack modes.
- - USE_LOCAL - use files in current directory (create when necessary)
- - WRITE_LOCAL - write files in current directory (overwrite when necessary)
- - USE_ORIGINAL - use files in original location (create when necessary)
- - WRITE_ORIGINAL - write files in original location (overwrite when necessary)
-@type SpaceHandlers: constant dictionary
-@var SpaceHandlers: dictionary with space handler types.
- - VIEW3D_EVENT;
- - VIEW3D_DRAW.
-"""
-
-def Set (request, data):
- """
- Update settings in Blender.
- @type request: string
- @param request: The setting to change:
- - 'curframe': the current animation frame
- - 'compressfile' : compress file writing a blend file (Use a boolean value True/False).
- - 'uscriptsdir': user scripts dir
- - 'yfexportdir': yafray temp xml storage dir
- - 'fontsdir': font dir
- - 'texturesdir': textures dir
- - 'seqpluginsdir': sequencer plugin dir
- - 'renderdir': default render output dir
- - 'soundsdir': sound dir
- - 'tempdir': temp file storage dir
- @type data: int or string
- @param data: The new value.
- """
-
-def Get (request):
- """
- Retrieve settings from Blender.
- @type request: string
- @param request: The setting data to be returned:
- - 'curframe': the current animation frame.
- - 'curtime' : the current animation time.
- - 'compressfile' : compress setting from the file menu, return 0 for false or 1 for true.
- - 'staframe': the start frame of the animation.
- - 'endframe': the end frame of the animation.
- - 'rt': the value of the 'rt' button for general debugging
- - 'filename': the name of the last file read or written.
- - 'homedir': Blender's home directory.
- - 'datadir' : the path to the dir where scripts should store and
- retrieve their data files, including saved configuration (can
- be None, if not found).
- - 'udatadir': the path to the user defined data dir. This may not be
- available (is None if not found), but users that define uscriptsdir
- have a place for their own scripts and script data that won't be
- erased when a new version of Blender is installed. For this reason
- we recommend scripts check this dir first and use it, if available.
- - 'scriptsdir': the path to the main dir where scripts are stored.
- - 'uscriptsdir': the path to the user defined dir for scripts. (*)
- - 'icondir': the path to blenders icon theme files.
- - 'yfexportdir': the path to the user defined dir for yafray export. (*)
- - 'fontsdir': the path to the user defined dir for fonts. (*)
- - 'texturesdir': the path to the user defined dir for textures. (*)
- - 'texpluginsdir': the path to the user defined dir for texture plugins. (*)
- - 'seqpluginsdir': the path to the user defined dir for sequence plugins. (*)
- - 'renderdir': the path to the user defined dir for render output. (*)
- - 'soundsdir': the path to the user defined dir for sound files. (*)
- - 'tempdir': the path to the user defined dir for storage of Blender
- temporary files. (*)
- - 'version' : the Blender version number.
- @note: (*) these can be set in Blender at the User Preferences window -> File
- Paths tab.
- @warn: this function returns None for requested dir paths that have not been
- set or do not exist in the user's file system.
- @return: The requested data or None if not found.
- """
-
-def Redraw ():
- """
- Redraw all 3D windows.
- """
-
-def Load (filename = None):
- """
- Load a Blender .blend file or any of the other supported file formats.
-
- Supported formats:
- - Blender's .blend;
- - DXF;
- - Open Inventor 1.0 ASCII;
- - Radiogour;
- - STL;
- - Videoscape;
- - VRML 1.0 asc.
-
- @type filename: string
- @param filename: the pathname to the desired file. If 'filename'
- isn't given or if it contains the substring '.B.blend', the default
- .B.blend file is loaded.
-
- @warn: loading a new .blend file removes the current data in Blender. For
- safety, this function saves the current data as an auto-save file in
- the temporary dir used by Blender before loading a new Blender file.
- @warn: after a call to Load(blendfile), current data in Blender is lost,
- including the Python dictionaries. Any posterior references in the
- script to previously defined data will generate a NameError. So it's
- better to put Blender.Load as the last executed command in the script,
- when this function is used to open .blend files.
- @warn: if in edit mode, this function leaves it, since Blender itself
- requires that.
- @note: for all types except .blend files, this function only works in
- interactive mode, not in background, following what Blender itself does.
- """
-
-def Save (filename, overwrite = 0):
- """
- Save a Blender .blend file with the current program data or export to
- one of the builtin file formats.
-
- Supported formats:
- - Blender (.blend);
- - DXF (.dxf);
- - STL (.stl);
- - Videoscape (.obj);
- - VRML 1.0 (.wrl).
-
- @type filename: string
- @param filename: the filename for the file to be written. It must have one
- of the supported extensions or an error will be returned.
- @type overwrite: int (bool)
- @param overwrite: if non-zero, file 'filename' will be overwritten if it
- already exists (can be checked with L{Blender.sys.exists<Sys.exists>}.
- By default existing files are not overwritten (an error is returned).
-
- @note: The substring ".B.blend" is not accepted inside 'filename'.
- @note: DXF, STL and Videoscape export only B{selected} meshes.
- """
-
-def Run (script):
- """
- Execute the given script.
- @type script: string
- @param script: the name of an available Blender Text (use L{Text.Get}() to
- get a complete list) or the full pathname to a Python script file in the
- system.
- @note: the script is executed in its own context -- with its own global
- dictionary -- as if it had been executed from the Text Editor or chosen
- from a menu.
- """
-
-def ShowHelp (script):
- """
- Show help for the given script. This is a time-saver ("code-saver") for
- scripts that need to feature a 'help' button in their GUIs or a 'help'
- submenu option. With proper documentation strings, calling this function is
- enough to present a screen with help information plus link and email buttons.
- @type script: string
- @param script: the filename of a registered Python script.
- @note: this function uses L{Run} and the "Scripts Help Browser" script. This
- means that it expects proper doc strings in the script to be able to show
- help for it (otherwise it offers to load the script source code as text).
- The necessary information about doc strings is L{given here<API_related>}.
- @note: 'script' doesn't need to be a full path name: "filename.py" is enough.
- Note, though, that this function only works for properly registered
- scripts (those that appear in menus).
- """
-
-def UpdateMenus ():
- """
- Update the menus that list registered scripts. This will scan the default
- and user defined (if available) folder(s) for scripts that have registration
- data and will make them accessible via menus.
- @note: only scripts that save other new scripts in the default or user
- defined folders need to call this function.
- """
-def UnpackAll (mode):
- """
- Unpack all files with specified mode.
- @param mode: The Mode for unpacking. Must be one of the modes in
- Blender.UnpackModes dictionary.
- @type mode: int
- """
-def PackAll ():
- """
- Pack all files.
- """
-
-def CountPackedFiles():
- """
- Returns the number of packed files.
- """
-
-def Quit ():
- """
- Exit from Blender immediately.
- @warn: the use of this function should obviously be avoided, it is available
- because there are some cases where it can be useful, like in automated
- tests. For safety, a "quit.blend" file is saved (normal Blender behavior
- upon exiting) when this function is called, so the data in Blender isn't
- lost.
- """
diff --git a/source/blender/python/api2_2x/doc/Blender_API.css b/source/blender/python/api2_2x/doc/Blender_API.css
deleted file mode 100644
index 22c00536282..00000000000
--- a/source/blender/python/api2_2x/doc/Blender_API.css
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Generated by CaScadeS, a stylesheet editor for Mozilla Composer */
-
- font { font-family: sans-serif ! important;
- }
-
- p { color: rgb(0, 0, 0);
- font-family: sans-serif;
- }
-
- pre { color: rgb(0, 0, 0);
- font-family: monospace;
- }
-
- a { font-family: sans-serif;
- color: rgb(0, 135, 0);
- font-weight: bold;
- }
-
- a:visited { font-family: sans-serif;
- color: rgb(102, 102, 102);
- }
-
- a:hover { font-family: sans-serif;
- color: rgb(184, 73, 0);
- }
-
- h1 { font-family: sans-serif;
- color: rgb(255, 102, 0);
- }
-
- h2 { font-family: sans-serif;
- color: rgb(255, 102, 0);
- }
-
- h3 { font-family: sans-serif;
- color: rgb(255, 102, 0);
- }
-
- table { color: rgb(0, 0, 0);
- opacity: 1;
- border-bottom-color: rgb(0, 102, 0);
- background-color: rgb(217, 216, 239);
- }
-
diff --git a/source/blender/python/api2_2x/doc/Bpy.py b/source/blender/python/api2_2x/doc/Bpy.py
deleted file mode 100644
index e5eb751cf04..00000000000
--- a/source/blender/python/api2_2x/doc/Bpy.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# bpy module and the bpy PyType object
-
-"""
-The bpy module.
-
-bpy
-===
-
- ATTENTION: This module is EXPERIMENTAL.
- Features documented here are subject to change.
-
- The bpy module is intended as a replacement for the Blender module.
- It will eventually provide the same features and functionality.
-
- This module uses a different model for the way data is accessed, added and removed. The various types such as groups, meshes, etc., are unchanged.
-
- At the moment it provides an alternative way to access data from python.
-
- Submodules:
- -----------
- - L{data<Bpy_data>}
- - L{libraries<LibData.Libraries>}
- - L{config<Bpy_config>}
-"""
-
diff --git a/source/blender/python/api2_2x/doc/Bpy_config.py b/source/blender/python/api2_2x/doc/Bpy_config.py
deleted file mode 100644
index ec3eb261c03..00000000000
--- a/source/blender/python/api2_2x/doc/Bpy_config.py
+++ /dev/null
@@ -1,38 +0,0 @@
-# bpy module and the bpy PyType object
-
-"""
-bpy.config
-==========
-
-This module gives you direct access to blenders preferences.
-
-@var undoSteps: number of undo steps to store.
-@type undoSteps: int
-@var textureTimeout: free textures from openGL memory if unused after this time.
-@type textureTimeout: int
-@var textureCollectRate: tag textures as being used at this interval of time.
-@type textureCollectRate: int
-@var sequenceMemCacheLimit: how much memory to use for a sequencer cache.
-@type sequenceMemCacheLimit: int
-@var fontSize: display size for fonts in the user interface.
-@type fontSize: int
-@var yfExportDir: yafray export path.
-@type yfExportDir: string
-@var fontDir: default font path.
-@type fontDir: string
-@var renderDir: default render path.
-@type renderDir: string
-@var textureDir: default texture path.
-@type textureDir: string
-@var userScriptsDir: path for user scripts.
-@type userScriptsDir: string
-@var texturePluginsDir: default texture plugin path.
-@type texturePluginsDir: string
-@var soundDir: default sound path.
-@type soundDir: string
-@var sequencePluginsDir: default sequencer plugin path.
-@type sequencePluginsDir: string
-@var tempDir: path where temp files are saved.
-@type tempDir: string
-"""
-
diff --git a/source/blender/python/api2_2x/doc/Bpy_data.py b/source/blender/python/api2_2x/doc/Bpy_data.py
deleted file mode 100644
index e228db688d7..00000000000
--- a/source/blender/python/api2_2x/doc/Bpy_data.py
+++ /dev/null
@@ -1,281 +0,0 @@
-# bpy module and the bpy PyType object
-
-"""
-The bpy module.
-
-bpy.data (Generic Data Access)
-==============================
-
-Example::
-
- # apply the active image to the active mesh
- # this script has no error checking to keep it small and readable.
-
- sce= bpy.data.scenes.active
- ob_act = sce.objects.active # assuming we have an active, might be None
- me = ob_act.getData(mesh=1) # assuming a mesh type, could be any
- img = bpy.data.images.active # assuming we have an active image
-
- for f in me.faces:
- f.image = img
-
- Window.RedrawAll()
-
-Example::
-
- # make a new object from an existing mesh
- # and make it active
- scn= bpy.data.scenes.active
- me = bpy.data.meshes['mymesh']
- ob = sce.objects.new(me) # new object from the mesh
- sce.objects.active = ob
-
-Example::
- # print the names of any non local objects
- sce= bpy.data.scenes.active
- for ob in sce.objects:
- if ob.lib:
- print 'external object:', ob.name, ob.lib
-
-Example::
- # add an empty object at each vertex of the active mesh
- scn= bpy.data.scenes.active
- ob_act = sce.objects.active
- matrix = ob_act.matrixWorld
- me = ob_act.getData(mesh=1)
-
- for v in me.verts:
- ob = sce.objects.new('Empty')
- ob.loc = v.co * matrix # transform the vertex location by the objects matrix.
-
-
-Example::
- # load all the wave sound files in a directory
- import os
- sound_dir = '/home/me/soundfiles/'
- sounds_new = []
- for fname in os.listdir(sound_dir):
- if fname.lower().endswith('.wav'):
- try:
- snd = bpy.data.sounds.new(filename = sound_dir + fname)
- except:
- snd = None
-
- if snd:
- sounds_new.append(snd)
-
- # Print the sounds
- for snd in sounds_new:
- print snd
-
-Example::
- # apply a new image to each selected mesh object as a texface.
- width, height= 512, 512
- scn= bpy.data.scenes.active
-
- for ob in sce.objects.context:
- if not ob.lib and ob.type == 'Mesh': # object isn't from a library and is a mesh
- me = ob.getData(mesh=1)
- me.faceUV = True # add UV coords and textures if we don't have them.
-
- # Make an image named after the mesh
- img = bpy.data.images.new(me.name, width, height)
-
- for f in me.faces:
- f.image = img
-
- Window.RedrawAll()
-
-
-
-@var scenes: sequence for L{scene<Scene.Scene>} data
-@type scenes: L{libBlockSeq}
-@var objects: sequence for L{object<Object.Object>} data
-@type objects: L{libBlockSeq}
-@var meshes: sequence for L{mesh<Mesh.Mesh>} data
-@type meshes: L{libBlockSeq}
-@var curves: sequence for L{curve<Curve.Curve>} data, used to store Curve, Surface and Text3d data.
-@type curves: L{libBlockSeq}
-@var metaballs: sequence for L{metaball<Metaball.Metaball>} data
-@type metaballs: L{libBlockSeq}
-@var materials: sequence for L{material<Material.Material>} data
-@type materials: L{libBlockSeq}
-@var textures: sequence for L{texture<Texture.Texture>} data
-@type textures: L{libBlockSeq}
-@var images: sequence for L{image<Image.Image>} data
-@type images: L{libBlockSeq}
-@var lattices: sequence for L{lattice<Lattice.Lattice>} data
-@type lattices: L{libBlockSeq}
-@var lamps: sequence for L{lamp<Lamp.Lamp>} data
-@type lamps: L{libBlockSeq}
-@var cameras: sequence for L{camera<Camera.Camera>} data
-@type cameras: L{libBlockSeq}
-@var ipos: sequence for L{ipo<Ipo.Ipo>} data
-@type ipos: L{libBlockSeq}
-@var worlds: sequence for L{world<World.World>} data
-@type worlds: L{libBlockSeq}
-@var fonts: sequence for L{font<Font.Font>} data
-@type fonts: L{libBlockSeq}
-@var texts: sequence for L{text<Text.Text>} data
-@type texts: L{libBlockSeq}
-@var sounds: sequence for L{sound<Sound.Sound>} data
-@type sounds: L{libBlockSeq}
-@var groups: sequence for L{group<Group.Group>} data
-@type groups: L{libBlockSeq}
-@var armatures: sequence for L{armature<Armature.Armature>} data
-@type armatures: L{libBlockSeq}
-@var actions: sequence for L{action<NLA.Action>} data
-@type actions: L{libBlockSeq}
-"""
-
-
-class libBlockSeq:
- """
- Generic Data Access
- ===================
- This provides a unified way to access and manipulate data types in Blender
- (scene, object, mesh, curve, metaball, material, texture, image, lattice,
- lamp, camera, ipo, world, font, text, sound, groups, armatures, actions).
-
- Get Item
- ========
- To get a datablock by name you can use dictionary-like syntax.
-
- >>> ob = bpy.data.objects['myobject']
-
- Note that this can only be used for getting.
-
- >>> bpy.data.objects['myobject'] = data # will raise an error
-
- B{Library distinctions}
-
- Blender doesn't allow naming collisions within its own data, but it's
- possible to run into naming collisions when you have data linked from an external blend file.
-
- You can specify where the data is from by using a (name, library) pair as the key.
-
- >>> group = bpy.data.groups['mygroup', '//mylib.blend'] # only return data linked from mylib
-
- If you want to get a group from the local data only you can use None
-
- >>> group = bpy.data.groups['mygroup', None] # always returns local data
-
- Sequence
- ========
- These generic datablocks are sequence datatypes. They are not lists. They support the dictionary and iterator protocols. This implies the following
-
- - A B{for} statement allows you to loop through data using the iterator protocol without wasting resources on creating a large list.
-
- >>> for me in bpy.data.meshes:
- ... print me.name
-
- - You can also use len() to see how many datablocks exist.
-
- >>> print len(bpy.data.scenes)
-
- - Because the sequences are not lists and the [] operator is used to get items by name, you cannot use indexing to retrieve an item.
-
- >>> ob = bpy.data.objects[-1] # will raise an error
-
- - If you want to access the entire sequence as a list simply use the list() constructor.
-
- >>> ipo_list = list(bpy.data.ipos)
-
- @type tag: Bool
- @ivar tag: A fast way to set the tag value of every member of the sequence to True or False
-
- For example
-
- >>> bpy.data.meshes.tag = True
-
- Is the same as...
-
- >>> for me in bpy.data.meshes: me.tag = True
-
- @type active: Datablock or None
- @ivar active: The active member of the datatype
-
- Applies to:
- - L{images}
- - L{scenes}
- - L{texts}
- This can also be used to set the active data.
-
- >>> bpy.data.images.active = bpy.data.images.new(filename = '/home/me/someimage.jpg')
-
- """
-
- def new(name):
- """
- fixme: need description for parameters.
- This function returns a new datablock containing no data or loaded from a file.
-
- Most datatypes accept a name for their argument except for L{sounds}, L{fonts}, L{ipos} and L{curves} that need an additional argument.
-
- The name argument is optional if not given a default name will be assigned.
-
- The name given may be modified by blender to make it unique.
-
- Loading From File
- =================
- For L{images}, L{texts}, L{sounds}, L{fonts} types you can use the filename keyword to make a new datablock from a file.
-
- New L{sounds}, L{fonts} can only be made with the a filename given.
-
- The filename can a keyword or the second argument, use the keyword only for the datablocks new name to be set by the filename.
-
- >>> sound = bpy.data.sounds.new('newsound', '~/mysound.wav') # uses the first string given for the name.
-
- >>> sound = bpy.data.sounds.new(filename = '~/mysound.wav') # will use the filename to make the name.
-
- Images
- ======
- Images optionally accept extra 2 arguments for width and height, values between 4 and 5000 if no args are given they will be 256.
-
- >>> img = bpy.data.images.new(name, 512, 512)
-
- Curves
- ======
- Curves need 2 arguments: bpy.data.curves.new(name, type) type must be one of the following...
- - 'Curve'
- - 'Text3d'
-
- >>> text3d = bpy.data.curves.new('MyCurve', 'Text3d')
-
- Ipos
- ====
- Ipos need 2 arguments: bpy.data.ipos.new(name, type) type must be one of the following...
- - 'Camera'
- - 'World'
- - 'Material'
- - 'Texture'
- - 'Lamp'
- - 'Action'
- - 'Constraint'
- - 'Sequence'
- - 'Curve'
- - 'Key'
- Objects cannot be created from bpy.data.objects;
- objects must be created from the scene. Here are some examples.
-
- >>> ob = bpy.data.scenes.active.objects.new('Empty')
-
- >>> scn = bpy.data.scenes.active
- ... ob = sce.objects.new(bpy.data.meshes.new('mymesh'))
-
- @rtype: datablock
- """
-
- def unlink(datablock):
- """
- This function removes a datablock.
- applies to:
- - L{scenes}
- - L{groups}
- - L{texts}
- Other types will raise an error.
- @rtype: None
- """
-
-
- \ No newline at end of file
diff --git a/source/blender/python/api2_2x/doc/Camera.py b/source/blender/python/api2_2x/doc/Camera.py
deleted file mode 100644
index c4e664efa66..00000000000
--- a/source/blender/python/api2_2x/doc/Camera.py
+++ /dev/null
@@ -1,257 +0,0 @@
-# Blender.Camera module and the Camera PyType object
-
-"""
-The Blender.Camera submodule.
-
-B{New}: L{Camera.clearScriptLinks} accepts a parameter now.
-
-Camera Data
-===========
-
-This module provides access to B{Camera Data} objects in Blender.
-
-Example::
-
- from Blender import Camera, Object, Scene
- cam = Camera.New('ortho') # create new ortho camera data
- cam.scale = 6.0 # set scale value for ortho view
- scn = Scene.GetCurrent() # get current scene
- ob = scn.objects.new(cam) # add a new camera object from the data
- scn.setCurrentCamera(ob) # make this camera the active
-"""
-
-def New (type = 'persp', name = 'CamData'):
- """
- Create a new Camera Data object.
- @type type: string
- @param type: The Camera type: 'persp' or 'ortho'.
- @type name: string
- @param name: The Camera Data name.
- @rtype: Blender Camera
- @return: The created Camera Data object.
- """
-
-def Get (name = None):
- """
- Get the Camera Data object(s) from Blender.
- @type name: string
- @param name: The name of the Camera Data.
- @rtype: Blender Camera or a list of Blender Cameras
- @return: It depends on the I{name} parameter:
- - (name): The Camera Data object with the given I{name};
- - (): A list with all Camera Data objects in the current scene.
- """
-
-class Camera:
- """
- The Camera Data object
- ======================
- This object gives access to Camera-specific data in Blender.
- @ivar type: The Camera type: 'persp' or 'ortho'
- @ivar mode: The mode flags: B{ORed value}: 'showLimits':1, 'showMist':2.
- @ivar lens: The lens value in [1.0, 250.0], only relevant to *persp* cameras.
- @ivar angle: The lens value in degrees [7.323871, 172.847331], only relevant to *persp* cameras.
- @ivar scale: The scale value in [0.01, 1000.00], only relevant to *ortho* cameras.
- @ivar clipStart: The clip start value in [0.0, 100.0].
- @ivar clipEnd: The clip end value in [1.0, 5000.0].
- @ivar dofDist: The dofDist value in [0.0, 5000.0].
- @ivar shiftX: The horizontal offset of the camera [-2.0, 2.0].
- @ivar shiftY: The vertical offset of the camera [-2.0, 2.0].
- @ivar alpha: The PassePart alpha [0.0, 1.0].
- @ivar drawSize: The display size for the camera an the 3d view [0.1, 10.0].
- @type ipo: Blender Ipo
- @ivar ipo: The "camera data" ipo linked to this camera data object.
- Set to None to clear the ipo.
-
- @ivar drawLimits: Toggle the option to show limits in the 3d view.
- @ivar drawName: Toggle the option to show the camera name in the 3d view.
- @ivar drawMist: Toggle the option to show mist in the 3d view.
- @ivar drawTileSafe: Toggle the option to show tile safe in the 3d view.
- @ivar drawPassepartout: Toggle the option to show pass part out in the 3d view.
-
- @warning: Most member variables assume values in some [Min, Max] interval.
- When trying to set them, the given parameter will be clamped to lie in
- that range: if val < Min, then val = Min, if val > Max, then val = Max.
- """
-
- def getName():
- """
- Get the name of this Camera Data object. (B{deprecated}) See the L{name} attribute.
- @rtype: string
- """
-
- def setName(name):
- """
- Set the name of this Camera Data object. (B{deprecated}) See the L{name} attribute.
- @type name: string
- @param name: The new name.
- """
-
- def getIpo():
- """
- Get the Ipo associated with this camera data object, if any. (B{deprecated})
- @rtype: Ipo
- @return: the wrapped ipo or None. (B{deprecated}) See the L{ipo} attribute.
- """
-
- def setIpo(ipo):
- """
- Link an ipo to this camera data object. (B{deprecated}) See the L{ipo} attribute.
- @type ipo: Blender Ipo
- @param ipo: a "camera data" ipo.
- """
-
- def clearIpo():
- """
- Unlink the ipo from this camera data object. (B{deprecated}) See the L{ipo} attribute.
- @return: True if there was an ipo linked or False otherwise.
- """
-
- def getType():
- """
- Get this Camera's type. (B{deprecated}) See the L{type} attribute.
- @rtype: int
- @return: 0 for 'persp' or 1 for 'ortho'.
- """
-
- def setType(type):
- """
- Set this Camera's type. (B{deprecated}) See the L{type} attribute.
- @type type: string
- @param type: The Camera type: 'persp' or 'ortho'.
- """
-
- def getMode():
- """
- Get this Camera's mode flags. (B{deprecated}) See the L{mode} attribute.
- @rtype: int
- @return: B{OR'ed value}: 'showLimits' is 1, 'showMist' is 2, or
- respectively, 01 and 10 in binary.
- """
-
- def setMode(mode1 = None, mode2 = None):
- """
- Set this Camera's mode flags. Mode strings given are turned 'on'. (B{deprecated}) See the L{mode} attribute.
- Those not provided are turned 'off', so cam.setMode() -- without
- arguments -- turns off all mode flags for Camera cam.
- @type mode1: string
- @type mode2: string
- @param mode1: A mode flag: 'showLimits' or 'showMist'.
- @param mode2: A mode flag: 'showLimits' or 'showMist'.
- """
-
- def getLens():
- """
- Get the lens value. (B{deprecated}) See the L{lens} attribute.
- @rtype: float
- @warn: lens is only relevant for perspective (L{getType}) cameras.
- """
-
- def setLens(lens):
- """
- Set the lens value. (B{deprecated}) See the L{lens} attribute.
- @type lens: float
- @param lens: The new lens value.
- @warn: lens is only relevant for perspective (L{type}) cameras.
- """
-
- def getScale():
- """
- Get the scale value. (B{deprecated}) See the L{scale} attribute.
- @rtype: float
- @warn: scale is only relevant for ortho (L{type}) cameras.
- """
-
- def setScale(scale):
- """
- Set the scale value. (B{deprecated}) See the L{scale} attribute.
- @type scale: float
- @param scale: The new scale value in [0.01, 1000.00].
- @warn: scale is only relevant for ortho (L{getType}) cameras.
- """
-
- def getClipStart():
- """
- Get the clip start value. (B{deprecated}) See the L{clipStart} attribute.
- @rtype: float
- """
-
- def setClipStart(clipstart):
- """
- Set the clip start value. (B{deprecated}) See the L{clipStart} attribute.
- @type clipstart: float
- @param clipstart: The new lens value.
- """
-
- def getClipEnd():
- """
- Get the clip end value. (B{deprecated}) See the L{clipEnd} attribute.
- @rtype: float
- """
-
- def setClipEnd(clipend):
- """
- Set the clip end value. (B{deprecated}) See the L{clipEnd} attribute.
- @type clipend: float
- @param clipend: The new clip end value.
- """
-
- def getDrawSize():
- """
- Get the draw size value. (B{deprecated}) See the L{drawSize} attribute.
- @rtype: float
- """
-
- def setDrawSize(drawsize):
- """
- Set the draw size value. (B{deprecated}) See the L{drawSize} attribute.
- @type drawsize: float
- @param drawsize: The new draw size value.
- """
-
- def getScriptLinks (event):
- """
- Get a list with this Camera's script links of type 'event'.
- @type event: string
- @param event: "FrameChanged", "Redraw" or "Render".
- @rtype: list
- @return: a list with Blender L{Text} names (the script links of the given
- 'event' type) or None if there are no script links at all.
- """
-
- def clearScriptLinks (links = None):
- """
- Delete script links from this Camera. If no list is specified, all
- script links are deleted.
- @type links: list of strings
- @param links: None (default) or a list of Blender L{Text} names.
- """
-
- def addScriptLink (text, event):
- """
- Add a new script link to this Camera.
- @type text: string
- @param text: the name of an existing Blender L{Text}.
- @type event: string
- @param event: "FrameChanged", "Redraw" or "Render".
- """
-
- def insertIpoKey(keytype):
- """
- Inserts keytype values in camera ipo at curframe. Uses module constants.
- @type keytype: Integer
- @param keytype:
- -LENS
- -CLIPPING
- @return: py_none
- """
-
- def __copy__ ():
- """
- Make a copy of this camera
- @rtype: Camera
- @return: a copy of this camera
- """
-
-import id_generics
-Camera.__doc__ += id_generics.attributes
diff --git a/source/blender/python/api2_2x/doc/Constraint.py b/source/blender/python/api2_2x/doc/Constraint.py
deleted file mode 100644
index 4c1981c5238..00000000000
--- a/source/blender/python/api2_2x/doc/Constraint.py
+++ /dev/null
@@ -1,248 +0,0 @@
-# Blender.Constraint module and the Constraint PyType object
-
-"""
-The Blender.Constraint submodule
-
-B{New}:
- - provides access to Blender's constraint stack
-
-This module provides access to the Constraint Data in Blender.
-
-Examples::
- from Blender import *
-
- ob = Object.Get('Cube')
- if len(ob.constraints) > 0:
- const = ob.constraints[0]
- if const.type == Constraint.Type.FLOOR:
- offs = const[Constraint.Settings.OFFSET]
-
-Or to print all the constraints attached to each bone in a pose::
- from Blender import *
-
- ob = Object.Get('Armature')
- pose = ob.getPose()
- for bonename in pose.bones.keys():
- bone = pose.bones[bonename]
- for const in bone.constraints:
- print bone.name,'=>',const
-
-@type Type: readonly dictionary
-@var Type: Constant Constraint dict used by L{Constraints.append()} and
- for comparison with L{Constraint.type}. Values are
- TRACKTO, IKSOLVER, FOLLOWPATH, COPYROT, COPYLOC, COPYSIZE, ACTION,
- LOCKTRACK, STRETCHTO, FLOOR, LIMITLOC, LIMITROT, LIMITSIZE, CLAMPTO,
- PYTHON, CHILDOF, TRANSFORM, NULL
-
-@type Settings: readonly dictionary
-@var Settings: Constant dict used for changing constraint settings.
- - Used for all constraints
- - TARGET (Object) (Note: not used by Limit Location (LIMITLOC),
- Limit Rotation (LIMITROT), Limit Scale (LIMITSIZE))
- - BONE (string): name of Bone sub-target (for armature targets) (Note: not
- used by Stretch To (STRETCHTO), Limit Location (LIMITLOC), Limit Rotation
- (LIMITROT), Limit Scale (LIMITSIZE), Follow Path (FOLLOWPATH), Clamp To (CLAMPTO))
- - Used by some constraints:
- - OWNERSPACE (int): for TRACKTO, COPYLOC, COPYROT, COPYSIZE, LIMITLOC, LIMITROT, LIMITSIZE, PYTHON, TRANSFORM
- If the owner is an object, values are SPACE_WORLD, SPACE_LOCAL
- If the owner is a bone, values are SPACE_WORLD, SPACE_POSE, SPACE_PARLOCAL, SPACE_LOCAL
- - TARGETSPACE (int): for TRACKTO, COPYLOC, COPYROT, COPYSIZE, PYTHON, TRANSFORM, ACTION
- If the owner is an object, values are SPACE_WORLD, SPACE_LOCAL
- If the owner is a bone, values are SPACE_WORLD, SPACE_POSE, SPACE_PARLOCAL, SPACE_LOCAL
- - Used by IK Solver (IKSOLVER) constraint:
- - TOLERANCE (float): clamped to [0.0001:1.0]
- - ITERATIONS (int): clamped to [1,10000]
- - CHAINLEN (int): clamped to [0,255]
- - POSWEIGHT (float): clamped to [0.01,1.0]
- - ROTWEIGHT (float): clamped to [0.01,1.0]
- - ROTATE (bool)
- - USETIP (bool)
- - Used by Action (ACTION) constraint:
- - ACTION (Action Object)
- - START (int): clamped to [1,maxframe]
- - END (int): clamped to [1,maxframe]
- - MIN (float): clamped to [-1000.0,1000.0] for Location, [-180.0,180.0] for Rotation, [0.0001,1000.0] for Scaling
- - MAX (float): clamped to [-1000.0,1000.0] for Location, [-180.0,180.0] for Rotation, [0.0001,1000.0] for Scaling
- - KEYON (int): values are XLOC, YLOC, ZLOC, XROT, YROT, ZROT, XSIZE, YSIZE, ZSIZE
- - Used by Track To (TRACKTO) constraint:
- - TRACK (int): values are TRACKX, TRACKY, TRACKZ, TRACKNEGX,
- TRACKNEGY, TRACKNEGZ
- - UP (int): values are UPX, UPY, UPZ
- - Used by Stretch To (STRETCHTO) constraint:
- - RESTLENGTH (float): clamped to [0.0:100.0]
- - VOLVARIATION (float): clamped to [0.0:100.0]
- - VOLUMEMODE (int): values are VOLUMEXZ, VOLUMEX, VOLUMEZ,
- VOLUMENONE
- - PLANE (int): values are PLANEX, PLANEZ
- - Used by Follow Path (FOLLOWPATH) constraint:
- - FOLLOW (bool)
- - OFFSET (float): clamped to [-maxframe:maxframe]
- - FORWARD (int): values are TRACKX, TRACKY, TRACKZ, TRACKNEGX,
- TRACKNEGY, TRACKNEGZ
- - UP (int): values are UPX, UPY, UPZ
- - Used by Lock Track (FOLLOWPATH) constraint:
- - TRACK (int): values are TRACKX, TRACKY, TRACKZ, TRACKNEGX,
- TRACKNEGY, TRACKNEGZ
- - LOCK (int): values are LOCKX, LOCKY, LOCKZ
- - Used by Clamp To (CLAMPTO) constraint:
- - CLAMP (int): values are CLAMPAUTO, CLAMPX, CLAMPY, CLAMPZ
- - CLAMPCYCLIC (bool)
- - Used by Floor (FLOOR) constraint:
- - MINMAX (int): values are MINX, MINY, MINZ, MAXX, MAXY, MAXZ
- - OFFSET (float): clamped to [-100.0,100.0]
- - STICKY (bool)
- - Used by Copy Location (COPYLOC) and Copy Rotation (COPYROT)
- - COPY (bitfield): any combination of COPYX, COPYY and COPYZ with possible addition of COPYXINVERT, COPYYINVERT and COPYZINVERT to invert that particular input (if on).
- - Used by Copy Size (COPYSIZE) constraint:
- - COPY (bitfield): any combination of COPYX, COPYY and COPYZ
- - Used by Limit Location (LIMITLOC) constraint:
- - LIMIT (bitfield): any combination of LIMIT_XMIN, LIMIT_XMAX,
- LIMIT_YMIN, LIMIT_YMAX, LIMIT_ZMIN, LIMIT_ZMAX
- - XMIN (float): clamped to [-1000.0,1000.0]
- - XMAX (float): clamped to [-1000.0,1000.0]
- - YMIN (float): clamped to [-1000.0,1000.0]
- - YMAX (float): clamped to [-1000.0,1000.0]
- - ZMIN (float): clamped to [-1000.0,1000.0]
- - ZMAX (float): clamped to [-1000.0,1000.0]
- - Used by Limit Rotation (LIMITROT) constraint:
- - LIMIT (bitfield): any combination of LIMIT_XROT, LIMIT_YROT,
- LIMIT_ZROT
- - XMIN (float): clamped to [-360.0,360.0]
- - XMAX (float): clamped to [-360.0,360.0]
- - YMIN (float): clamped to [-360.0,360.0]
- - YMAX (float): clamped to [-360.0,360.0]
- - ZMIN (float): clamped to [-360.0,360.0]
- - ZMAX (float): clamped to [-360.0,360.0]
- - Used by Limit Scale (LIMITSIZE) constraint:
- - LIMIT (bitfield): any combination of LIMIT_XMIN, LIMIT_XMAX,
- LIMIT_YMIN, LIMIT_YMAX, LIMIT_ZMIN, LIMIT_ZMAX
- - XMIN (float): clamped to [0.0001,1000.0]
- - XMAX (float): clamped to [0.0001,1000.0]
- - YMIN (float): clamped to [0.0001,1000.0]
- - YMAX (float): clamped to [0.0001,1000.0]
- - ZMIN (float): clamped to [0.0001,1000.0]
- - ZMAX (float): clamped to [0.0001,1000.0]
- - Used by Python Script (PYTHON) constraint:
- - SCRIPT (Text): script to use
- - PROPERTIES (IDProperties): ID-Properties of constraint
- - Used by Child Of (CHILDOF) constraint:
- - COPY (bitfield): any combination of PARLOCX, PARLOCY, PARLOCZ,
- PARROTX, PARROTY, PARROTZ, PARSIZEX, PARSIZEY, PARSIZEZ.
- - Used by Transformation (TRANSFORM) constraint:
- - FROM (int): values are LOC, ROT, SCALE
- - TO (int): values are LOC, ROT, SCALE
- - MAPX, MAPY, MAPZ (int): values are LOC, ROT, SCALE
- - EXTRAPOLATE (bool)
- - FROM_MINX, FROM_MINY, FROM_MINZ, FROM_MAXX,
- FROM_MAXY, FROM_MAXZ (float):
- If FROM==LOC, then is clamped to [-1000.0, 1000.0]
- If FROM==ROT, then is clamped to [-360.0, 360.0]
- If FROM==SCALE, then is clamped to [0.0001, 1000.0]
- - TO_MINX, TO_MINY, TO_MINZ, TO_MAXX, TO_MAXY, TO_MAXZ (float):
- If TO==LOC, then is clamped to [-1000.0, 1000.0]
- If TO==ROT, then is clamped to [-360.0, 360.0]
- If TO==SCALE, then is clamped to [0.0001, 1000.0]
-
-"""
-
-class Constraints:
- """
- The Constraints object
- ======================
- This object provides access to sequence of
- L{constraints<Constraint.Constraint>} for a particular object.
- They can be accessed from L{Object.constraints<Object.Object.constraints>}.
- or L{PoseBone.constraints<Pose.PoseBone.constraints>}.
- """
-
- def __getitem__(index):
- """
- This operator returns one of the constraints in the stack.
- @type index: int
- @return: an Constraint object
- @rtype: Constraint
- @raise KeyError: index was out of range
- """
-
- def __len__():
- """
- Returns the number of constraints in the constraint stack.
- @return: number of Constraints
- @rtype: int
- """
-
- def append(type):
- """
- Appends a new constraint to the end of the constraint stack.
- @param type: a constant specifying the type of constraint to create. as from L{Type}
- @type type: int constant
- @rtype: Constraint
- @return: the new Constraint
- """
-
- def remove(con):
- """
- Remove a constraint from this objects constraint sequence.
- @param con: a constraint from this sequence to remove.
- @type con: Constraint
- @note: Accessing attributes of the constraint after it is removed will
- throw an exception.
- """
-
- def moveUp(con):
- """
- Moves the constraint up in the object's constraint stack.
- @param con: a constraint from this sequence to remove.
- @type con: Constraint
- @rtype: None
- """
-
- def moveDown(con):
- """
- Moves the constraint down in the object's constraint stack.
- @param con: a constraint from this sequence to remove.
- @type con: Constraint
- @rtype: None
- """
-
-class Constraint:
- """
- The Constraint object
- =====================
- This object provides access to a constraint for a particular object
- accessed from L{Constraints}.
- @ivar name: The name of this constraint. 29 chars max.
- @type name: string
- @ivar type: The type of this constraint. Read-only. The returned value
- matches the types in L{Type}.
- @type type: int
- @ivar influence: The influence value of the constraint. Valid values
- are in the range [0.0,1.0].
- @type influence: float
- """
-
- def __getitem__(key):
- """
- This operator returns one of the constraint's data attributes.
- @param key: value from constraint's L{Constraint.Settings} constant
- @type key: int constant
- @return: the requested data
- @rtype: varies
- @raise KeyError: the key does not exist for the constraint
- """
-
- def __setitem__(key):
- """
- This operator changes one of the constraint's data attributes.
- @param key: value from constraint's L{Constraint.Settings} constant
- @type key: int constant
- @raise KeyError: the key does not exist for the constraint
- """
-
- def insertKey(frame):
- """
- Adds an influence keyframe for the constraint Ipo.
- @rtype: None
- @param frame: the frame number at which to insert the key.
- @type frame: float
- """
diff --git a/source/blender/python/api2_2x/doc/Curve.py b/source/blender/python/api2_2x/doc/Curve.py
deleted file mode 100644
index c3760bc2c1d..00000000000
--- a/source/blender/python/api2_2x/doc/Curve.py
+++ /dev/null
@@ -1,723 +0,0 @@
-# Blender.Curve module and the Curve PyType object
-
-"""
-The Blender.Curve submodule.
-
-Curve Data
-==========
-
-This module provides access to B{Curve Data} objects in Blender.
-
-A Blender Curve Data consists of multiple L{CurNurb}(s). Try converting a Text object to a Curve to see an example of this. Each curve is of
-type Bezier or Nurb. The underlying L{CurNurb}(s) can be accessed with
-the [] operator. Operator [] returns an object of type L{CurNurb}. Removing a L{CurNurb} can be done this way too. del curve[0] removes the first curve.
-
-Note that L{CurNurb} can be used to acces a curve of any type (Poly, Bezier or Nurb)
-
-The Curve module also supports the Python iterator interface. This means you
-can access the L{CurNurb}(s) in a Curve and the control points in a L{CurNurb} using a
-Python B{for} statement.
-
-
-Add a Curve to a Scene Example::
- from Blender import Curve, Object, Scene
- cu = Curve.New() # create new curve data
- scn = Scene.GetCurrent() # get current scene
- ob = scn.objects.new(cu) # make a new curve from the curve data
-
-Iterator Example::
- from Blender import Curve, Object, Scene
- scn = Scene.GetCurrent() # get current scene
- ob = scn.objects.active
- curvedata = ob.data
- for curnurb in curvedata:
- print type( curnurb ), curnurb
- for point in curnurb:
- print type( point ), point
-
-Creating a Curve from a list of Vec triples Examples::
- from Blender import *
- def bezList2Curve(bezier_vecs):
- '''
- Take a list or vector triples and converts them into a bezier curve object
- '''
-
- def bezFromVecs(vecs):
- '''
- Bezier triple from 3 vecs, shortcut functon
- '''
- bt= BezTriple.New(\
- vecs[0].x, vecs[0].y, vecs[0].z,\
- vecs[1].x, vecs[1].y, vecs[1].z,\
- vecs[2].x, vecs[2].y, vecs[2].z)
-
- bt.handleTypes= (BezTriple.HandleTypes.FREE, BezTriple.HandleTypes.FREE)
-
- return bt
-
- # Create the curve data with one point
- cu= Curve.New()
- cu.appendNurb(bezFromVecs(bezier_vecs[0])) # We must add with a point to start with
- cu_nurb= cu[0] # Get the first curve just added in the CurveData
-
-
- i= 1 # skip first vec triple because it was used to init the curve
- while i<len(bezier_vecs):
- bt_vec_triple= bezier_vecs[i]
- bt= bezFromVecs(bt_vec_triple)
- cu_nurb.append(bt)
- i+=1
-
- # Add the Curve into the scene
- scn= Scene.GetCurrent()
- ob = scn.objects.new(cu)
- return ob
-"""
-
-def New ( name):
- """
- Create a new Curve Data object.
- @type name: string
- @param name: The Curve Data name.
- @rtype: Blender Curve
- @return: The created Curve Data object.
- """
-
-def Get (name = None):
- """
- Get the Curve Data object(s) from Blender.
- @type name: string
- @param name: The name of the Curve Data.
- @rtype: Blender Curve or a list of Blender Curves
- @return: It depends on the 'name' parameter:
- - (name): The Curve Data object with the given name;
- - (): A list with all Curve Data objects in the current scene.
- """
-
-class Curve:
- """
- The Curve Data object
- =====================
- This object gives access to Curve and Surface data linked from Blender Objects.
-
- @ivar name: The Curve Data name.
- @type name: string
- @ivar pathlen: The Curve Data path length, used to set the number of frames for an animation (not the physical length).
- @type pathlen: int
- @ivar totcol: The Curve Data maximal number of linked materials. Read-only.
- @type totcol: int
- @ivar flag: The Curve Data flag value; see L{getFlag()} for the semantics.
- @ivar bevresol: The Curve Data bevel resolution. [0 - 32]
- @type bevresol: int
- @ivar resolu: The Curve Data U-resolution (used for curve and surface resolution) [0 - 1024].
- @type resolu: int
- @ivar resolv: The Curve Data V-resolution (used for surface resolution) [0 - 1024].
- @type resolv: int
- @ivar width: The Curve Data width [0 - 2].
- @type width: float
- @ivar ext1: The Curve Data extent1 Called "Extrude" in the user interface (for bevels only).
- @type ext1: float
- @ivar ext2: The Curve Data extent2 - Called "Bevel Depth" in the user interface (for bevels only).
- @type ext2: float
- @ivar loc: The Curve Data location(from the center).
- @type loc: list of 3 floats
- @ivar rot: The Curve Data rotation(from the center).
- @type rot: list of 3 floats
- @ivar size: The Curve Data size(from the center).
- @type size: list of 3 floats
- @ivar bevob: The Curve Bevel Object
- @type bevob: Blender L{Object<Object.Object>} or None
- @ivar taperob: The Curve Taper Object
- @type taperob: Blender L{Object<Object.Object>} or None
- @ivar key: The Key object associated with this Curve, if any.
- @type key: Blender L{Key<Key.Key>}
- @ivar materials: The curves's materials. Each curve can reference up to
- 16 materials. Empty slots in the curve's list are represented by B{None}.
- B{Note}: L{Object.colbits<Object.Object.colbits>} needs to be set correctly
- for each object in order for these materials to be used instead of
- the object's materials.
- B{Note}: The list that's returned is I{not} linked to the original curve.
- curve.materials.append(material) won't do anything.
- Use curve.materials += [material] instead.
- @type materials: list of L{Material}s
- """
-
- def getName():
- """
- Get the name of this Curve Data object.
- @rtype: string
- """
-
- def setName(name):
- """
- Set the name of this Curve Data object.
- @rtype: None
- @type name: string
- @param name: The new name.
- """
-
- def getPathLen():
- """
- Get this Curve's path frame length, used for an animated path.
- @rtype: int
- @return: the path length.
- """
-
- def setPathLen(len):
- """
- Set this Curve's path length.
- @rtype: None
- @type len: int
- @param len: the new curve's length.
- """
-
- def getTotcol():
- """
- Get the number of materials linked to the Curve.
- @rtype: int
- @return: number of materials linked.
- """
-
- def setTotcol(totcol):
- """
- Set the number of materials linked to the Curve. B{Note}: this method
- will probably be deprecated in the future.
- @rtype: None
- @type totcol: int
- @param totcol: number of materials linked.
- @warn: It is not advisable to use this method unless you know what you
- are doing; it's possible to
- corrupt a .blend file if you don't know what you're doing. If you want
- to change the number of materials, use the L{materials} attribute.
- """
-
- def getFlag():
- """
- Get the Curve flag value.
- This item is a bitfield whose value is a combination of the following parameters.
- - Bit 0 : "3D" is set
- - Bit 1 : "Front" is set
- - Bit 2 : "Back" is set
- - Bit 3 : "CurvePath" is set.
- - Bit 4 : "CurveFollow" is set.
-
- @rtype: integer bitfield
- """
-
- def setFlag(val):
- """
- Set the Curve flag value. The flag corresponds to the Blender settings for 3D, Front, Back, CurvePath and CurveFollow. This parameter is a bitfield.
- @rtype: None
- @type val: integer bitfield
- @param val : The Curve's flag bits. See L{getFlag} for the meaning of the individual bits.
- """
-
- def getBevresol():
- """
- Get the Curve's bevel resolution value.
- @rtype: float
- """
-
- def setBevresol(bevelresol):
- """
- Set the Curve's bevel resolution value.
- @rtype: None
- @type bevelresol: float
- @param bevelresol: The new Curve's bevel resolution value.
- """
-
- def getResolu():
- """
- Get the Curve's U-resolution value.
- @rtype: float
- """
-
- def setResolu(resolu):
- """
- Set the Curve's U-resolution value. [0 - 1024]
- This is used for surfaces and curves.
- @rtype: None
- @type resolu: float
- @param resolu: The new Curve's U-resolution value.
- """
-
- def getResolv():
- """
- Get the Curve's V-resolution value.
- @rtype: float
- """
-
- def setResolv(resolv):
- """
- Set the Curve's V-resolution value. [0 - 1024].
- This is used for surfaces only.
- @rtype: None
- @type resolv: float
- @param resolv: The new Curve's V-resolution value.
- """
-
- def getWidth():
- """
- Get the Curve's width value.
- @rtype: float
- """
-
- def setWidth(width):
- """
- Set the Curve's width value.
- @rtype: None
- @type width: float
- @param width: The new Curve's width value.
- """
-
- def getExt1():
- """
- Get the Curve's ext1 value.
- @rtype: float
- """
-
- def setExt1(ext1):
- """
- Set the Curve's ext1 value.
- @rtype: None
- @type ext1: float
- @param ext1: The new Curve's ext1 value.
- """
-
- def getExt2():
- """
- Get the Curve's ext2 value.
- @rtype: float
- """
-
- def setExt2(ext2):
- """
- Set the Curve's ext2 value.
- @rtype: None
- @type ext2: float
- @param ext2: The new Curve's ext2 value.
- """
-
- def getControlPoint(numcurve,numpoint):
- """
- Get the curve's control point value (B{deprecated}). The numpoint arg
- is an index into the list of points and starts with 0. B{Note}: new
- scripts should use the [] operator on Curves and CurNurbs. Example::
- curve = Blender.Curve.Get('Curve')
- p0 = curve[0][0] # get first point from first nurb
- # -- OR --
- nurb = curve[0] # get first nurb
- p0 = nurb[0] # get nurb's first point
-
- @type numcurve: int
- @type numpoint: int
- @rtype: list of floats
- @return: depends upon the curve's type.
- - type Bezier : a list of nine floats. Values are x, y, z for handle-1, vertex and handle-2
- - type Nurb : a list of 4 floats. Values are x, y, z, w.
-
- """
-
- def setControlPoint( numcurve, numpoint, controlpoint):
- """
- Set the Curve's controlpoint value. The numpoint arg is an index into the list of points and starts with 0.
- @rtype: None
- @type numcurve: int
- @type numpoint: int
- @type controlpoint: list
- @param numcurve: index for spline in Curve, starting from 0
- @param numpoint: index for point in spline, starting from 0
- @param controlpoint: The new controlpoint value.
- See L{getControlPoint} for the length of the list.
- """
-
- def appendPoint( numcurve, new_control_point ):
- """
- Add a new control point to the indicated curve (B{deprecated}).
- New scripts should use L{CurNurb.append()}.
- @rtype: None
- @type numcurve: int
- @type new_control_point: list of floats or BezTriple
- @param numcurve: index for spline in Curve, starting from 0
- @param new_control_point: depends on curve's type.
- - type Bezier: a BezTriple
- - type Nurb: a list of four or five floats for the xyzw values
- @raise AttributeError: throws exception if numcurve is out of range.
- """
-
- def appendNurb( new_point ):
- """
- add a new curve to this Curve. The new point is added to the new curve. Blender does not support a curve with zero points. The new curve is added to the end of the list of curves in the Curve.
- @rtype: CurNurb
- @return: the newly added spline
- @type new_point: BezTriple or list of xyzw coordinates for a Nurb curve.
- @param new_point: see L{CurNurb.append} for description of parameter.
- """
-
- def getLoc():
- """
- Get the curve's location value.
- @rtype: a list of 3 floats.
- """
-
- def setLoc(location):
- """
- Set the curve's location value.
- @rtype: None
- @type location: list[3]
- @param location: The new Curve's location values.
- """
-
- def getRot():
- """
- Get the curve's rotation value.
- @rtype: a list of 3 floats.
- """
-
- def setRot(rotation):
- """
- Set the Curve's rotation value.
- @rtype: None
- @type rotation: list[3]
- @param rotation: The new Curve's rotation values.
- """
-
- def getSize():
- """
- Get the curve's size value.
- @rtype: a list of 3 floats.
- """
-
- def setSize(size):
- """
- Set the curve size value.
- @rtype: None
- @type size: list[3]
- @param size: The new Curve's size values.
- """
-
- def getMaterials():
- """
- Returns a list of materials assigned to the Curve.
- @rtype: list of Material Objects
- @return: list of Material Objects assigned to the Curve.
- """
-
- def getBevOb():
- """
- Returns the Bevel Object (BevOb) assigned to the Curve.
- @rtype: Blender Object or None
- @return: Bevel Object (BevOb) assigned to the Curve.
- """
-
- def setBevOb( object ):
- """
- Assign a Bevel Object (BevOb) to the Curve. Passing None as the object parameter removes the bevel.
- @rtype: None
- @return: None
- @type object: Curve type Blender Object
- @param object: Blender Object to assign as Bevel Object (BevOb)
- @raise TypeError: throws exception if the parameter is not a Curve type Blender Object or None
- """
-
- def getTaperOb():
- """
- Returns the Taper Object (TaperOb) assigned to the Curve.
- @rtype: Blender Object or None
- @return: Taper Object (TaperOb) assigned to the Curve.
- """
-
- def setTaperOb( object ):
- """
- Assign a Taper Object (TaperOb) to the Curve. Passing None as the object parameter removes the taper.
- @rtype: None
- @return: None
- @type object: Curve type Blender Object
- @param object: Blender Object to assign as Taper Object (TaperOb)
- @raise TypeError: throws exception if the parameter is not a Curve type Blender Object or None
- """
-
- def update():
- """
- Updates display list for a Curve.
- Used after making changes to control points.
- You B{must} use this if you want to see your changes!
- @rtype: None
- @return: None
- """
-
- def isNurb( curve_num ):
- """
- Tells type of a CurNurb (B{deprecated}).
- New scripts should use L{CurNurb.isNurb()}.
-
- @rtype: integer
- @return: Zero if curve is type Bezier, one if curve is of type Nurb.
- @type curve_num: integer
- @param curve_num: zero-based index into list of curves in this Curve.
- @raise AttributeError: throws exception if curve_num is out of range.
- """
-
- def isCyclic( curve_num ):
- """
- Tells whether or not a CurNurb is cyclic (closed) (B{deprecated}).
- New scripts should use L{CurNurb.isCyclic()}.
-
- @rtype: boolean
- @return: True if is cyclic, False if not
- @type curve_num: integer
- @param curve_num: zero-based index into list of curves in this Curve
- @raise AttributeError: throws exception if curve_num is out of range.
- """
-
- def switchDirection( ):
- """
- Reverse the direction of a curve.
- @return: None
-
- I{B{Example:}}
- # This example switches the direction of all curves on the active object.
- from Blender import *
- scn = Scene.GetCurrent()
- ob = scn.objects.active # must be a curve
- data = ob.data
- for cu in data: cu.switchDirection()
- """
-
- def getNumCurves():
- """
- Get the number of curves in this Curve Data object.
- @rtype: integer
- """
-
- def getNumPoints( curve_num ):
- """
- Get the number of control points in the curve (B{deprecated}).
- New scripts should use the len operator (I{len(curve)}).
- @type curve_num: integer
- @param curve_num: zero-based index into list of curves in this Curve
- @rtype: integer
- """
-
- def getKey():
- """
- Return the L{Key<Key.Key>} object containing the keyframes for this
- curve, if any.
- @rtype: L{Key<Key.Key>} object or None
- """
-
- def recalc():
- """
- Recalculate control point handles after a curve has been changed.
- @rtype: None
- """
-
- def __copy__ ():
- """
- Make a copy of this curve
- @rtype: Curve
- @return: a copy of this curve
- """
-
-class CurNurb:
- """
- The CurNurb Object
- ==================
- This object provides access to the control points of the curves that make up a Blender Curve ObData.
-
- The CurNurb supports the python iterator protocol which means you can use a python for statement to access the points in a curve.
-
- The CurNurb also supports the sequence protocol which means you can access the control points of a CurNurb using the [] operator.
-
- Note that CurNurb is used for accesing poly, bezier and nurbs type curves.
-
- @ivar flagU: The CurNurb knot flag U. See L{setFlagU} for description.
- @type flagU: int
- @ivar flagV: The CurNurb knot flag V. See L{setFlagU} for description.
- @type flagV: int
- @ivar type: The type of the curve (Poly: 0, Bezier: 1, NURBS: 4)
- @type type: int
- @ivar knotsU: The knot vector in the U direction. The tuple will be empty
- if the curve isn't a NURB or doesn't have knots in this direction.
- @type knotsU: tuple of floats
- @ivar knotsV: The knot vector in the V direction. The tuple will be empty
- if the curve isn't a NURB or doesn't have knots in this direction.
- @type knotsV: tuple of floats
- @ivar smooth: Set the smoothing for this curve (applies to cuve objects that have a bevel)
- @type smooth: bool
- """
-
- def __setitem__( n, point ):
- """
- Replace the Nth point in the curve. The type of the argument must match the type of the curve. List of 4 floats (optional 5th float is the tilt value in radians) for Nurbs or BezTriple for Bezier.
- @rtype: None
- @return: None
- @type n: integer
- @param n: the index of the element to replace
- @type point: BezTriple or list of 4 floats (optional 5th float is the tilt value in radians)
- @param point: the point that will replace the one in the curve. The point can be either a BezTriple type or a list of 4 floats in x,y,z,w (optionally tilt in radians as 5th value) format for a Nurb curve.
- """
-
- def __getitem__( n ):
- """
- Get the Nth element in the curve. For Bezier curves, that element is a BezTriple. For the rest (Poly and Nurbs), it is a list of 5 floats: x, y, z, weight, tilt (in radians). NOTE 1: This element is independent on the curve, modifying it will not affect the curve. NOTE 2: Each successive call returns a new object.
- @rtype: BezTriple (Bezier Curve) or List of 5 floats [x, y, z, w, t] for Poly or Nurbs
- @return: The Nth element in the curve
- @type n: integer
- @param n: the index of the element to return
- """
-
- def append( new_point ):
- """
- Appends a new point to a curve. This method appends points to both Bezier and Nurb curves. The type of the argument must match the type of the curve. List of 4 floats (optional 5th float is the tilt value in radians) for Nurbs or BezTriple for Bezier.
- @rtype: None
- @return: None
- @type new_point: BezTriple or list of 4 floats (optional 5th float is the tilt value in radians)
- @param new_point: the new point to be appended to the curve. The new point can be either a BezTriple type or a list of 4 floats in x,y,z,w (optionally tilt in radians as 5th value) format for a Nurb curve.
- """
-
- def setMatIndex( index ):
- """
- Sets the Material index for this CurNurb.
- @rtype: None
- @return: None
- @type index: integer
- @param index: the new value for the Material number of this CurNurb. No range checking is done.
- """
-
- def getMatIndex():
- """
- Returns the Material index for this CurNurb.
- @rtype: integer
- @return: integer
- """
-
- def isNurb():
- """
- Boolean method used to determine whether a CurNurb is of type Bezier or of type Nurb.
- @rtype: boolean
- @return: True or False
- """
-
- def isCyclic():
- """
- Boolean method checks whether a CurNurb is cyclic (a closed curve) or not.
- @rtype: boolean
- @return: True or False
- """
-
- def getFlagU():
- """
- Get the CurNurb knot flag U.
- @rtype: integer
- @return: See L{setFlagU} for description of return value.
- """
-
- def setFlagU( flag ):
- """
- Set the entire CurNurb knot flag U (knots are recalculated automatically).
- The flag can be one of six values:
- - 0 or 1: uniform knots
- - 2 or 3: endpoints knots
- - 4 or 5: bezier knots
- Bit 0 controls whether or not the curve is cyclic (1 = cyclic).
- @type flag: integer
- @param flag: CurNurb knot flag
- @rtype: None
- @return: None
- """
-
- def getFlagV():
- """
- Get the CurNurb knot flag V.
- @rtype: integer
- @return: See L{setFlagU} for description of return value.
- """
-
- def setFlagV( value ):
- """
- Set the CurNurb knot flag V (knots are recalculated automatically).
- @type value: integer
- @param value: See L{setFlagU} for description of return.
- @rtype: None
- @return: None
- """
-
- def getType():
- """
- Get the type of the curve.
- @rtype: integer
- @return: 0 - Poly, 1 - Bezier, 4 - NURBS
- """
-
- def setType( value ):
- """
- Set the type of the curve and converts the curve to its new type if needed
- @type value: integer
- @param value: CurNurb type flag (0 - Poly, 1 - Bezier, 4 - NURBS)
- @rtype: None
- @return: None
- """
-
-class SurfNurb:
- """
- The SurfNurb Object
- ===================
- This object provides access to the control points of the surfaces that make
- up a Blender Curve.
-
- The SurfNurb supports the Python iterator and sequence protocols which
- means you can use a python B{for} statement or [] operator to access the
- points in a surface. Points are accessed linearly; for a N-by-M UV surface,
- the first N control points correspond to V=0, then second N to V=1, and so
- on.
-
- @ivar flagU: The knot flag U. Changing the knot type automatically
- recalculates the knots. The flag can be one of three values:
- - 0 : uniform knots
- - 1 : endpoints knots
- - 2 : bezier knots
- @type flagU: int
- @ivar flagV: The knot flag V. See L{flagU} for description.
- @type flagV: int
- @ivar pointsU: The number of control points in the U direction (read only).
- @type pointsU: int
- @ivar pointsV: The number of control points in the V direction (read only).
- @type pointsV: int
- @ivar cyclicU: The cyclic setting for the U direction (True = cyclic).
- @type cyclicU: boolean
- @ivar cyclicV: The cyclic setting for the V direction (True = cyclic).
- @type cyclicV: boolean
- @ivar orderU: The order setting for the U direction. Values are clamped
- to the range [2:6] and not greater than the U dimension.
- @type orderU: int
- @ivar orderV: The order setting for the V direction. Values are clamped
- to the range [2:6] and not greater than the V dimension.
- @type orderV: int
- """
-
- def __setitem__( n, point ):
- """
- Set the Nth control point in the surface.
- @rtype: None
- @return: None
- @type n: integer
- @param n: the index of the point to replace
- @type point: list of 4 floats (optional 5th float is the tilt value
- in radians)
- @param point: the point that will replace the one in the curve. The
- point is list of 4 floats in x,y,z,w (optionally tilt in radians as
- 5th value) format.
- """
-
- def __getitem__( n ):
- """
- Get the Nth control point in the surface.
- @rtype: List of 5 floats [x, y, z, w, t] for Poly or Nurbs
- @return: The Nth point in the curve
- @type n: integer
- @param n: the index of the point to return
- @note: This returned value is independent on the curve; modifying it will not affect the curve.
- @note: Each successive call returns a new object.
- """
-
diff --git a/source/blender/python/api2_2x/doc/Curvedoc.txt b/source/blender/python/api2_2x/doc/Curvedoc.txt
deleted file mode 100644
index cb435ff4048..00000000000
--- a/source/blender/python/api2_2x/doc/Curvedoc.txt
+++ /dev/null
@@ -1,105 +0,0 @@
-CURVE Module documentation
-
-
-
-
-INTRODUCTION
-
-The Curve module gives access to the curves objects. Curves are used for many things in blender : creation of graphical objects, duplication of meshes, displacement of meshes, in IPOs for instance.
-Blender has three main types of curves :
- nurbs curves, each control point has three coordinates.
- bezier curves, each control point has nine coordinates.
- text curves, which represent graphical text objects.
-
-
-
-
-
-
-functions of the module :
-
-Get(Name:string) : returns the Curve whose name is Name.
-
-get : same as Get
-
-New(Name:string (optional)) : Creates a new Curve Object.
-If the parameter Name is given, it will be the name of the Curve Object,
-else the name will be choosen by blender.
-
-
-Curve Object member functions :
-
-getName() : Retreives the Curve Object name.
-
-setName(Name : string) : Sets the Curve Object name.
-
-getPathLen() : Retrieves the Curve Object path length.
-
-setPathLen(len:int) : Sets the Curve Object path length.
-
-getTotcol() : Retreives the parameter totcol of the Curve.
-
-setTotcol(val:int) : Sets the parameter totcol
-/*I do not know what means this parameter...*/
-
-getFlag()Retrieves the mode of the Curve Object
-
-setFlag(val:int) :Sets the mode of the Curve.
-
-The mode of the curve is a combination of parameters.
-Bits 0,1,2 : "Back", "Front" and "3D".
-Bit 3 : "CurvePath" is set.
-Bit 4 : "CurveFollow" is set.
-
-getBevresol() : Retreives the bevel resolution of the curve.
-
-setBevresol(val:float) : Sets the bevel resolution of the curve.
-
-getResolu() : Retreives the U-resolution of the curve.
-
-setResolu(val:int) : sets the U-resolution of the curve.
-
-getResolv() : Retreives the V-resolution of the curve.
-
-setResolv(val:int) : sets the V-resolution of the curve.
-
-getWidth() : Retreives the bevel width of the curve.
-
-setWidth(val:float) : Sets the bevel width.
-
-getExt1() : Retreives the bevel height1 of the curve.
-
-setExt1(val:float) : Sets the bevel height1 of the curve.
-
-getExt2() : Retreives the bevel height2 of the curve.
-
-setExt2(val:float) : Sets the bevel height2 of the curve.
-
-getControlPoint(i:int) : Retreives the i-th control point.
-Depending upon the curve type, returne a list of 4(nurbs) or 9(bez) floats.
-
-setControlPoint(i:int, x1:float,...x4:float)
-setControlPoint(i:int, x1:float,...x9:float) : Sets the i-th control point value.
-
-getLoc() : Retreives the Curve location(from the center)
-
-setLoc(x:float,y:float,z:float) : Sets the Curve location
-
-getRot() : Retreives the Curve rotation(from the center)
-
-setRot(x:float,y:float,z:float) : Sets the Curve rotation.
-
-getSize() : Retreives the Curve size.
-
-setSize(x:float,y:float,z:float) : Sets the Curve size.
-
-Direct acces to the parameters values : You cann read and write the parameter XXX with the following syntax :
-val = obj.XXX
-or obj.XXX = val.
-The possible parameters names are :"name","pathlen","resolu","resolv","width","ext1", and "ext2"
-
-
-
-
-
-Submodules : No submodule.
diff --git a/source/blender/python/api2_2x/doc/Draw.py b/source/blender/python/api2_2x/doc/Draw.py
deleted file mode 100644
index 9b6f29b6b51..00000000000
--- a/source/blender/python/api2_2x/doc/Draw.py
+++ /dev/null
@@ -1,880 +0,0 @@
-# Blender.Draw module and the Button PyType object
-
-"""
-The Blender.Draw submodule.
-
-Draw
-====
-
-B{New}:
- - access to ASCII values in L{events<Register>} callbacks;
- - 'large' fonts for L{Text} and L{GetStringWidth}.
- - Pop-up blocks with L{PupBlock}
- - Color Picker button with L{ColorPicker}
-
-This module provides access to a B{windowing interface} in Blender. Its widgets
-include many kinds of buttons: push, toggle, menu, number, string, slider,
-scrollbar, plus support for text drawing. It also includes keyboard keys and
-mouse button code values in its dictionary, see a list after this example.
-
-Example::
- import Blender
- from Blender import Draw, BGL
-
- mystring = ""
- mymsg = ""
- toggle = 0
-
- def event(evt, val): # the function to handle input events
- global mystring, mymsg
-
- if not val: # val = 0: it's a key/mbutton release
- if evt in [Draw.LEFTMOUSE, Draw.MIDDLEMOUSE, Draw.RIGHTMOUSE]:
- mymsg = "You released a mouse button."
- Draw.Redraw(1)
- return
-
- if evt == Draw.ESCKEY:
- Draw.Exit() # exit when user presses ESC
- return
-
- elif Draw.AKEY <= evt <= Draw.ZKEY: mystring += chr(evt)
- elif evt == Draw.SPACEKEY: mystring += ' '
- elif evt == Draw.BACKSPACEKEY and len(mystring):
- mystring = mystring[:-1]
- else: return # no need to redraw if nothing changed
-
- Draw.Redraw(1)
-
- def button_event(evt): # the function to handle Draw Button events
- global mymsg, toggle
- if evt == 1:
- mymsg = "You pressed the toggle button."
- toggle = 1 - toggle
- Draw.Redraw(1)
-
- def gui(): # the function to draw the screen
- global mystring, mymsg, toggle
- if len(mystring) > 90: mystring = ""
- BGL.glClearColor(0,0,1,1)
- BGL.glClear(BGL.GL_COLOR_BUFFER_BIT)
- BGL.glColor3f(1,1,1)
- Draw.Toggle("Toggle", 1, 10, 10, 55, 20, toggle,"A toggle button")
- BGL.glRasterPos2i(72, 16)
- if toggle: toggle_state = "down"
- else: toggle_state = "up"
- Draw.Text("The toggle button is %s." % toggle_state, "small")
- BGL.glRasterPos2i(10, 230)
- Draw.Text("Type letters from a to z, ESC to leave.")
- BGL.glRasterPos2i(20, 200)
- Draw.Text(mystring)
- BGL.glColor3f(1,0.4,0.3)
- BGL.glRasterPos2i(340, 70)
- Draw.Text(mymsg, "tiny")
-
- Draw.Register(gui, event, button_event) # registering the 3 callbacks
-
-All available events:
- - ACCENTGRAVEKEY
- - AKEY
- - BACKSLASHKEY
- - BACKSPACEKEY
- - BKEY
- - CAPSLOCKKEY
- - CKEY
- - COMMAKEY
- - DELKEY
- - DKEY
- - DOWNARROWKEY
- - EIGHTKEY
- - EKEY
- - ENDKEY
- - EQUALKEY
- - ESCKEY
- - F10KEY
- - F11KEY
- - F12KEY
- - F1KEY
- - F2KEY
- - F3KEY
- - F4KEY
- - F5KEY
- - F6KEY
- - F7KEY
- - F8KEY
- - F9KEY
- - FIVEKEY
- - FKEY
- - FOURKEY
- - GKEY
- - HKEY
- - HOMEKEY
- - IKEY
- - INPUTCHANGE
- - INSERTKEY
- - JKEY
- - KEYBD
- - KKEY
- - LEFTALTKEY
- - LEFTARROWKEY
- - LEFTBRACKETKEY
- - LEFTCTRLKEY
- - LEFTMOUSE
- - LEFTSHIFTKEY
- - LINEFEEDKEY
- - LKEY
- - MIDDLEMOUSE
- - MINUSKEY
- - MKEY
- - MOUSEX
- - MOUSEY
- - NINEKEY
- - NKEY
- - OKEY
- - ONEKEY
- - PAD0
- - PAD1
- - PAD2
- - PAD3
- - PAD4
- - PAD5
- - PAD6
- - PAD7
- - PAD8
- - PAD9
- - PADASTERKEY
- - PADENTER
- - PADMINUS
- - PADPERIOD
- - PADPLUSKEY
- - PADSLASHKEY
- - PAGEDOWNKEY
- - PAGEUPKEY
- - PAUSEKEY
- - PERIODKEY
- - PKEY
- - QFULL
- - QKEY
- - QUOTEKEY
- - Q_FIRSTTIME
- - RAWKEYBD
- - REDRAW
- - RETKEY
- - RIGHTALTKEY
- - RIGHTARROWKEY
- - RIGHTBRACKETKEY
- - RIGHTCTRLKEY
- - RIGHTMOUSE
- - RIGHTSHIFTKEY
- - RKEY
- - SEMICOLONKEY
- - SEVENKEY
- - SIXKEY
- - SKEY
- - SLASHKEY
- - SPACEKEY
- - TABKEY
- - THREEKEY
- - TIMER0
- - TIMER1
- - TIMER2
- - TIMER3
- - TKEY
- - TWOKEY
- - UKEY
- - UPARROWKEY
- - VKEY
- - WHEELDOWNMOUSE
- - WHEELUPMOUSE
- - WINCLOSE
- - WINFREEZE
- - WINQUIT
- - WINTHAW
- - WKEY
- - XKEY
- - YKEY
- - ZEROKEY
- - ZKEY
-
-@note: function Button has an alias: L{PushButton}.
-
-@warn: B{very important}: if using your script causes "Error totblock"
-messages when Blender exits (meaning that memory has been leaked), this may
-have been caused by an ignored return value from one of the button types. To
-avoid this, assign created buttons return values to B{global} variables,
-instead of ignoring them. Examples::
-
- # avoid this, it can cause memory leaks:
- Draw.Toggle(...)
- Draw.Number(...)
- Draw.String(...)
- # this is correct -- assuming the variables are globals:
- my_toggle_button = Draw.Toggle(...)
- my_int_button = Draw.Number(...)
- my_str_button = Draw.String(...)
-
-
-@warn: Inside the windowing loop (after Draw.Register() has been executed and
-before Draw.Exit() is called), don't use the redraw functions from other
-modules (Blender and Window). The Draw submodule has its own Draw.Redraw() and
-Draw.Draw() functions that can be used inside the windowing loop.
-"""
-
-def Exit():
- """
- Exit the windowing interface.
- """
-
-def BeginAlign():
- """
- Buttons after this function will draw aligned (button layout only).
- """
-
-def EndAlign():
- """
- Use after BeginAlign() to stop aligning the buttons (button layout only).
- """
-
-def UIBlock(draw):
- """
- This function creates a popup area where buttons, labels, sliders etc can be drawn.
-
- @type draw: function
- @param draw: A function to draw to the popup area, taking no arguments: draw().
-
- @note: The size of the popup will expand to fit the bounds of the buttons created in the draw function.
- @note: Be sure to use the mouse coordinates to position the buttons under the mouse,
- so the popup dosn't exit as soon as it opens.
- The coordinates for buttons start 0,0 at the bottom left hand side of the screen.
- @note: Within this popup, Redraw events and the registered button callback will not work.
- For buttons to run events, use per button callbacks.
- @note: OpenGL drawing functions wont work within this popup, for text use L{Label} rather then L{Text}
- @warning: L{Menu} will not work properly within a UIBlock, this is a limitation with blenders user interface internals.
- """
-
-def Register(draw = None, event = None, button = None):
- """
- Register callbacks for windowing.
- @type draw: function
- @type event: function
- @type button: function
- @param draw: A function to draw the screen, taking no arguments: draw().
- @param event: A function to handle keyboard and mouse input events, taking
- two arguments: f(evt, val), where:
- - 'evt' (int) is the event number;
- - 'val' (int) is the value modifier. If val = 0, the event refers to a
- key or mouse button being released. Otherwise it's a key/button press.
- @param button: A function to handle Draw Button events, taking one argument:
- f(evt), where:
- - 'evt' is the button number (see the I{event} parameter in L{Button}).
- @note: note that in the example at the beginning of this page Draw.Register
- is called only once. It's not necessary to re-register the callbacks,
- they will stay until Draw.Exit is called. It's enough to redraw the
- screen, when a relevant event is caught.
- @note: only during the B{event} callback: the L{Blender}.ascii variable holds
- the ASCII integer value (if it exists and is valid) of the current event.
- """
-
-def Redraw(after = 0):
- """
- Queue a redraw event. Redraw events are buffered so that, regardless of how
- many events are queued, the window only receives one redraw event.
- @type after: int
- @param after: If non-zero, the redraw is processed before other input events.
- """
-
-def Draw():
- """
- Force an immediate redraw. Forced redraws are not buffered. In other words,
- the window is redrawn once every time this function is called.
- """
-
-def Create(value):
- """
- Create a default Button object.
- @type value: int, float, string or 3 floats
- @param value: The value to store in the button.
- @rtype: Blender Button
- @return: The Button created.
- @note: String values must have less then 400 characters.
- """
-
-def PushButton(name, event, x, y, width, height, tooltip = None, callback = None):
- """
- Create a new (push) Button object.
- @type name: string
- @param name: The string to display on the button.
- @type event: int
- @param event: The event number to pass to the button event function when
- activated.
- @type x: int
- @type y: int
- @param x: The lower left x (horizontal) coordinate of the button.
- @param y: The lower left y (vertical) coordinate of the button.
- @type width: int
- @type height: int
- @param width: The button width.
- @param height: The button height.
- @type tooltip: string
- @param tooltip: The button's tooltip (the string that appears when the mouse
- is kept over the button).
- @type callback: function
- @param callback: an optional argument so this button can have its own
- callback function. the function will run whenever this button is pressed.
- This function must accept 2 arguments (event, val).
- @note: This function used to be called only "Button". We added an
- alternative alias to avoid a name clash with the L{Button} class/type that
- caused trouble in this documentation's generation. The old name shouldn't
- be deprecated, use Button or PushButton (better) at your choice.
- """
-
-def PupMenu(name, maxrow = None):
- """
- Create a pop-up menu.
-
- The menu options are specified through the 'name' parameter, like with
- L{Menu}: options are followed by a format code and separated by the '|'
- character. Valid format codes are:
- - %t - The option should be used as the title of the pop-up;
- - %l - insert a separating line (only works if 'maxrow' isn't given);
- - %xB{N} - Chosen this option, PupMenu should return the integer B{N}.
-
- Example::
- name = "OK?%t|QUIT BLENDER" # if no %xN int is set, indices start from 1
- result = Draw.PupMenu(name)
- if result:
- Draw.PupMenu("Really?%t|Yes|No")
-
- @type name: string
- @param name: The format string to define the contents of the button.
- @type maxrow: int
- @param maxrow: The maximum number of rows for each column in the pop-up.
- @rtype: int
- @return: the chosen entry number or -1 if none was chosen.
- """
-
-def PupIntInput(text, default, min, max):
- """
- Create an integer number input pop-up.
-
- This allows python to use Blender's integer number pop-up input.
-
- Example::
- default = 50
- min = 0
- max = 100
-
- msg = "Set this value between 0 and 100"
- result = Draw.PupIntInput(msg, default, min, max)
- if result != None:
- print result
- else:
- print 'no user input'
-
- @type text: string
- @param text: The text that is displayed in the pop-up.
- @type default: int
- @param default: The value that the pop-up is set to initially.
- @type min: int
- @param min: The lowest value the pop-up will allow.
- @type max: int
- @param max: The highest value the pop-up will allow.
- @rtype: int
- @return: the number chosen or None if none was chosen.
- """
-
-def PupFloatInput(text, default, min, max, clickStep, floatLen):
- """
- Create a floating point number input pop-up.
-
- This allows python to use Blender's floating point pop-up input.
-
- Example::
- default = 50
- min = 0.0
- max = 10.0
- clickStep = 100
- floatLen = 3
-
- msg = "Set this value between 0 and 100"
- result = Draw.PupFloatInput(msg, default, min, max, clickStep, floatLen)
- if result != None:
- print result
- else:
- print 'no user input'
-
- @type text: string
- @param text: The text that is displayed in the pop-up.
- @type default: float
- @param default: The value that the pop-up is set to initially.
- @type min: float
- @param min: The lowest value the pop-up will allow.
- @type max: float
- @param max: The highest value the pop-up will allow.
- @type clickStep: int
- @param clickStep: How much is incremented per user click, 100 will increment 1.0, 10 will increment 0.1 etc.
- @type floatLen: int
- @param floatLen: The number of decimal places to display, between 2 and 4.
- @rtype: float
- @return: the number chosen or None if none was chosen.
- """
-
-def PupStrInput(text, default, max = 20):
- """
- Create a string input pop-up.
-
- This allows python to use Blender's string pop-up input.
-
- Example::
- Blender.Draw.PupStrInput("Name:", "untitled", 25)
-
- @type text: string
- @param text: The text that is displayed in the pop-up.
- @type default: string
- @param default: The value that the pop-up is set to initially. If it's longer
- then 'max', it's truncated.
- @type max: int
- @param max: The most characters the pop-up input will allow. If not given
- it defaults to 20 chars. It should be in the range [1, 100].
- @rtype: string
- @return: The text entered by the user or None if none was chosen.
- """
-
-def PupBlock(title, sequence):
- """
- Display a pop-up block.
-
- Possible formats for the items in the sequence parameter.
- (Value are objects created with L{Create})
- - string: Defines a label
- - (string, Value, string): Defines a toggle button. The first string is the text on the button, the optional second string is the tooltip.
- - (string, Value, min, max, string): Defines a numeric or string button, depending on the content of Value. The first string is the text on the button, the optional second string is the tooltip. I{For string, max is the maximum length of the string and min is unused.}
-
- Example::
- import Blender
-
- text = Blender.Draw.Create("short text")
- f = Blender.Draw.Create(1.0)
- i = Blender.Draw.Create(2)
- tog = Blender.Draw.Create(0)
-
- block = []
-
- block.append(("Name: ", text, 0, 30, "this is some tool tip"))
- block.append("Some Label")
- block.append(("Value: ", f, 0.0, 100.0))
- block.append(("Value: ", i, 0, 100))
- block.append(("Option", tog, "another tooltip"))
-
- retval = Blender.Draw.PupBlock("PupBlock test", block)
-
- print "PupBlock returned", retval
-
- print "text\\t", text
- print "float\\t", f
- print "int\\t", i
- print "toggle\\t", tog
-
- @warning: On cancel, the Value objects are brought back to there initial values except for string values which will still contain the modified values.
- @type title: string
- @param title: The title of the block.
- @param sequence: A sequence defining what the block contains.
- The order of the list is the order of appearance, from top down.
- @rtype: int
- @return: 1 if the pop-up is confirmed, 0 otherwise
- """
-
-def Menu(name, event, x, y, width, height, default, tooltip = None, callback = None):
- """
- Create a new Menu Button object.
-
- The menu options are specified through the 'name' of the button. Options are
- I{followed} by a format code and separated by the '|' (pipe) character. Valid
- format codes are:
- - %t - The option should be used as the title;
- - %l - Insert a separating line;
- - %xB{N} - The option should set the integer B{N} in the button value.
-
- Example::
- name = "The Title %t|First Entry %x1|Second Entry %x2|Third Entry %x3"
- menu = Draw.Menu(name, 2, 60, 120, 200, 40, 3, "Just a test menu.")
- # note that, since default = 3, the "Third Entry"
- # will appear as the default choice in the Menu.
-
- @type name: string
- @param name: The format string to define the contents of the button.
- @type event: int
- @param event: The event number to pass to the button event function when
- activated.
- @type x: int
- @type y: int
- @param x: The lower left x (horizontal) coordinate of the button.
- @param y: The lower left y (vertical) coordinate of the button.
- @type width: int
- @type height: int
- @param width: The button width.
- @param height: The button height.
- @type default: int
- @param default: The number of the option to be selected by default.
- @type tooltip: string
- @param tooltip: The button's tooltip (the string that appears when the mouse
- is kept over the button).
- @type callback: function
- @param callback: an optional argument so this button can have its own
- callback function. the function will run whenever this button is pressed.
- This function must accept 2 arguments (event, val).
- @rtype: Blender Button
- @return: The Button created.
- """
-
-def Toggle(name, event, x, y, width, height, default, tooltip = None, callback = None):
- """
- Create a new Toggle Button object.
- @type name: string
- @param name: The string to display on the button.
- @type event: int
- @param event: The event number to pass to the button event function when
- activated.
- @type x: int
- @type y: int
- @param x: The lower left x (horizontal) coordinate of the button.
- @param y: The lower left y (vertical) coordinate of the button.
- @type width: int
- @type height: int
- @param width: The button width.
- @param height: The button height.
- @type default: int
- @param default: The value specifying the default state:
- (0 for "up", 1 for "down").
- @type tooltip: string
- @param tooltip: The button's tooltip (the string that appears when the mouse
- is kept over the button).
- @type callback: function
- @param callback: an optional argument so this button can have its own
- callback function. the function will run whenever this button is pressed.
- This function must accept 2 arguments (event, val).
- @rtype: Blender Button
- @return: The Button created.
- """
-
-def Slider(name, event, x, y, width, height, initial, min, max, realtime = 1,
- tooltip = None, callback = None):
- """
- Create a new Slider Button object.
- @type name: string
- @param name: The string to display on the button.
- @type event: int
- @param event: The event number to pass to the button event function when
- activated.
- @type x: int
- @type y: int
- @param x: The lower left x (horizontal) coordinate of the button.
- @param y: The lower left y (vertical) coordinate of the button.
- @type width: int
- @type height: int
- @param width: The button width.
- @param height: The button height.
- @type initial: int or float
- @type min: int or float
- @type max: int or float
- @param initial: The initial value.
- @param min: The minimum value.
- @param max: The maximum value.
- @type realtime: int
- @param realtime: If non-zero (the default), the slider will emit events as
- it is edited.
- @type tooltip: string
- @param tooltip: The button's tooltip (the string that appears when the mouse
- is kept over the button).
-
- @type callback: function
- @param callback: an optional argument so this button can have its own
- callback function. the function will run whenever this button is pressed.
- This function must accept 2 arguments (event, val).
- @rtype: Blender Button
- @return: The Button created.
- @note: slider callbacks will not work if the realtime setting is enabled.
- """
-
-#def Scrollbar(event, x, y, width, height, initial, min, max, realtime = 1,
-# tooltip = None):
-# """
-# Create a new Scrollbar Button object.
-# @type event: int
-# @param event: The event number to pass to the button event function when
-# activated.
-# @type x: int
-# @type y: int
-# @param x: The lower left x (horizontal) coordinate of the button.
-# @param y: The lower left y (vertical) coordinate of the button.
-# @type width: int
-# @type height: int
-# @param width: The button width.
-# @param height: The button height.
-# @type initial: int or float
-# @type min: int or float
-# @type max: int or float
-# @param initial: The initial value.
-# @param min: The minimum value.
-# @param max: The maximum value.
-# @type realtime: int
-# @param realtime: If non-zero (the default), the slider will emit events as
-# it is edited.
-# @type tooltip: string
-# @param tooltip: The button's tooltip (the string that appears when the mouse
-# is kept over the button).
-# @rtype: Blender Button
-# @return: The Button created.
-# """
-
-def ColorPicker(event, x, y, width, height, initial, tooltip = None, callback = None):
- """
- Create a new Color Picker Button object.
- @type event: int
- @param event: The event number to pass to the button event function when
- activated.
- @type x: int
- @type y: int
- @param x: The lower left x (horizontal) coordinate of the button.
- @param y: The lower left y (vertical) coordinate of the button.
- @type width: int
- @type height: int
- @param width: The button width.
- @param height: The button height.
- @type initial: 3-float tuple
- @param initial: The initial color value. All values must be between 0 and 1
- @type tooltip: string
- @param tooltip: The button's tooltip (the string that appears when the mouse
- is kept over the button).
- @type callback: function
- @param callback: an optional argument so this button can have its own
- callback function. the function will run whenever this button is pressed.
- This function must accept 2 arguments (event, val).
- @rtype: Blender Button
- @return: The Button created.
- @note: The color picker will not work if the Register's event function is None.
- @note: Using the same button variable with more then 1 button at a time will corrupt memory.
- """
-
-def Normal(event, x, y, width, height, initial, tooltip = None, callback = None):
- """
- Create a new Normal button, this allows you to set a 3d vector by rotating a sphere.
- @type event: int
- @param event: The event number to pass to the button event function when
- activated.
- @type x: int
- @type y: int
- @param x: The lower left x (horizontal) coordinate of the button.
- @param y: The lower left y (vertical) coordinate of the button.
- @type width: int
- @type height: int
- @param width: The button width - non square normal buttons .
- @param height: The button height.
- @type initial: 3-float tuple
- @param initial: The initial vector value.
- @type tooltip: string
- @param tooltip: The button's tooltip (the string that appears when the mouse
- is kept over the button).
- @type callback: function
- @param callback: an optional argument so this button can have its own
- callback function. the function will run whenever this button is pressed.
- This function must accept 2 arguments (event, val).
- @rtype: Blender Button
- @return: The Button created.
- @note: The normal button will not work if the Register's event function is None.
- @note: Using the same button variable with more then 1 button at a time will corrupt memory.
- """
-
-def Number(name, event, x, y, width, height, initial, min, max, tooltip = None, callback = None):
- """
- Create a new Number Button object.
- @type name: string
- @param name: The string to display on the button.
- @type event: int
- @param event: The event number to pass to the button event function when
- activated.
- @type x: int
- @type y: int
- @param x: The lower left x (horizontal) coordinate of the button.
- @param y: The lower left y (vertical) coordinate of the button.
- @type width: int
- @type height: int
- @param width: The button width.
- @param height: The button height.
- @type initial: int or float
- @type min: int or float
- @type max: int or float
- @param initial: The initial value.
- @param min: The minimum value.
- @param max: The maximum value.
- @type tooltip: string
- @param tooltip: The button's tooltip (the string that appears when the mouse
- is kept over the button).
- @type callback: function
- @param callback: an optional argument so this button can have its own
- callback function. the function will run whenever this button is pressed.
- This function must accept 2 arguments (event, val).
- @rtype: Blender Button
- @return: The Button created.
-
- I{B{Example:}}
-
- This example draws a single floating point value::
- from Blender import Draw
- b= Draw.Create(0.0) # Data for floating point button
- def bevent(evt):
- print 'My Button event:', evt
- def gui():
- global b
- b= Draw.Number('value: ', 1000, 0,0, 200, 20, b.val, 0,10, 'some text tip')
-
- Draw.Register(gui, None, bevent) # we are not going to worry about keyboard and mouse events
- """
-
-
-def String(name, event, x, y, width, height, initial, length, tooltip = None, callback = None):
- """
- Create a new String Button object.
- @type name: string
- @param name: The string to display on the button.
- @type event: int
- @param event: The event number to pass to the button event function when
- activated.
- @type x: int
- @type y: int
- @param x: The lower left x (horizontal) coordinate of the button.
- @param y: The lower left y (vertical) coordinate of the button.
- @type width: int
- @type height: int
- @param width: The button width.
- @param height: The button height.
- @type initial: string
- @param initial: The string to display initially.
- @type length: int
- @param length: The maximum input length.
- @type tooltip: string
- @param tooltip: The button's tooltip (the string that appears when the mouse
- is kept over the button).
- @type callback: function
- @param callback: an optional argument so this button can have its own
- callback function. the function will run whenever this button is pressed.
- This function must accept 2 arguments (event, val).
- @rtype: Blender Button
- @return: The Button created.
- """
-
-def GetStringWidth(string, fontsize = 'normal'):
- """
- Get the width in pixels of a string.
- @type string: string
- @param string: A string.
- @type fontsize: string
- @param fontsize: The size of the font: 'large', 'normal', 'small' or 'tiny'.
- @rtype: int
- @return: The width of I{string} with the chosen I{fontsize}.
- """
-
-def Text(string, fontsize = 'normal'):
- """
- Draw a string on the screen.
-
- Text location is set using the OpenGL raster location functions L{BGL.glRasterPos} before the text is drawn.
- This sets the text location from the lower left corner of the current window.
-
- Text color is set using the OpenGL color functions L{BGL.glColor} before the text is drawn.
-
- @type string: string
- @param string: The text string to draw.
- @type fontsize: string
- @param fontsize: The size of the font: 'large', 'normal', 'small' or 'tiny'.
- @rtype: int
- @return: The width of I{string} drawn with the chosen I{fontsize}.
- @note: For drawing text in the 3d view see the workaround in L{BGL.glRasterPos}
- """
-
-def Label(string, x, y, w, h):
- """
- Draw a text lable on the screen.
-
- @type string: string
- @param string: The text string to draw.
- @rtype: None
- @return: None
- """
-
-def Image(image, x, y, zoomx=1.0, zoomy=1.0, clipx=0, clipy=0, clipw=-1, cliph=-1):
- """
- Draw an image on the screen.
-
- The image is drawn at the location specified by the coordinates (x,y). A
- pair of optional zoom factors (in horizontal and vertical directions) can
- be applied to the image as it is drawn, and an additional clipping rectangle
- can be applied to extract a particular sub-region of the image to draw.
-
- Note that the clipping rectangle is given in image space coordinates. In
- image space, the origin is located at the bottom left, with x coordinates
- increasing to the right and y coordinates increasing upwards. No matter
- where the clipping rectangle is placed in image space, the lower-left pixel
- drawn on the screen is always placed at the coordinates (x,y). The
- clipping rectangle is itself clipped to the dimensions of the image. If
- either the width or the height of the clipping rectangle are negative then
- the corresponding dimension (width or height) is set to include as much of
- the image as possible.
-
- For drawing images with alpha blending with the background you will need to enable blending as shown in the example.
-
- Example::
- import Blender
- from Blender import BGL, Image, Draw
-
- myimage = Image.Load('myimage.png')
-
- def gui():
- BGL.glEnable( BGL.GL_BLEND ) # Only needed for alpha blending images with background.
- BGL.glBlendFunc(BGL.GL_SRC_ALPHA, BGL.GL_ONE_MINUS_SRC_ALPHA)
-
- Draw.Image(myimage, 50, 50)
-
- BGL.glDisable( BGL.GL_BLEND )
- def event(evt, val):
- if evt == Draw.ESCKEY:
- Draw.Exit()
-
- Draw.Register(gui, event, None)
-
- @type image: Blender.Image
- @param image: The image to draw.
- @type x: int
- @param x: The lower left x (horizontal) position of the origin of the image.
- @type y: int
- @param y: The lower left y (vertical) position of the origin of the image.
- @type zoomx: float
- @param zoomx: The x (horizontal) zoom factor to use when drawing the image.
- @type zoomy: float
- @param zoomy: The y (vertical) zoom factor to use when drawing the image.
- @type clipx: int
- @param clipx: The lower left x (horizontal) origin of the clipping rectangle
- within the image. A value of 0 indicates the left of the
- image.
- @type clipy: int
- @param clipy: The lower left y (vertical) origin of the clipping rectangle
- within the image. A value of 0 indicates the bottom of the
- image.
- @type clipw: int
- @param clipw: The width of the clipping rectangle within the image. If this
- value is negative then the clipping rectangle includes as much
- of the image as possible in the x (horizontal) direction.
- @type cliph: int
- @param cliph: The height of the clipping rectangle within the image. If this
- value is negative then the clipping rectangle includes as much
- of the image as possible in the y (vertical) direction.
- """
-
-class Button:
- """
- The Button object
- =================
- This object represents a button in Blender's GUI.
- @type val: int or float, string or 3-float tuple (depends on button type).
- @ivar val: The button's value.
- """
diff --git a/source/blender/python/api2_2x/doc/Effect.py b/source/blender/python/api2_2x/doc/Effect.py
deleted file mode 100644
index 70f4287ae36..00000000000
--- a/source/blender/python/api2_2x/doc/Effect.py
+++ /dev/null
@@ -1,590 +0,0 @@
-# Blender.Effect module and the Effect PyType effect
-
-"""
-The Blender.Effect submodule
-
-B{new}: now L{Get}('objname') (without specifying second parameter: 'position') returns a list of all effects linked to object "objname".
-
-Effect
-======
-
-INTRODUCTION
-
-The Effect module allows you to access all the data of particle effects.
-An effect can modify a mesh object using particles, where vertex of
-the mesh emits particles, which can themselves emit new particles.
-
-In the Blender internals, the effect object is just a placeholder for
-the particle effect. Prior to v2.39 build and wave effects were also
-supported by Blender, and the Python API supported all three types of
-effects. They were removed in v2.39 when the build and wave modifiers
-were implemented.
-
-
-Example::
- import Blender
- listffects = Blender.Effect.Get()
- print listeffects
- eff = listeffects[0]
- #we suppose the first effect is a build effect
- print eff.getLen()
- eff.setLen(500)
-
-@type Flags: read-only dictionary
-@var Flags: The particle effect flags. Values can be ORed.
- - SELECTED: The particle effect is selected in the UI. (Read-only)
- - BSPLINE: Use a B-spline formula for particle interpolation
- - STATIC: Make static particles
- - ANIMATED: Recalculate static particles for each rendered frame
- - VERTS: Emit particles from vertices
- - FACES: Emit particles from faces
- - EVENDIST: Use even distribution based on face area (requires FACES)
- - TRUERAND: Use true random distribution based on face area (requires FACES)
- - UNBORN: Make particles appear before they are emitted
- - DIED: Make particles appear after they have died
- - EMESH: Render emitter mesh
-
-@type SpeedTypes: read-only dictionary
-@var SpeedTypes: The available settings for selecting particle speed vectors.
-Only one setting is active at a time.
- - INTENSITY: Use texture intensity
- - RGB: Use RGB values
- - GRADIENT: Use texture gradient
-"""
-
-def New (name):
- """
- Creates a new particle effect and attaches to an object.
- @type name: string
- @param name: The name of object to associate with the effect. Only mesh
- objects are supported.
- @rtype: Blender Effect
- @return: the new effect
- """
-
-def Get (name = None, position = None):
- """
- Get an Effect from Blender.
- @type name: string
- @param name: The name of object linked to the effect.
- @type position: int
- @param position: The position of the effect in the list of effects linked to the object.
- @rtype: Blender Effect or a list of Blender Effects
- @return: It depends on the 'objname, position' parameters:
- - (): A list with all Effects in the current scene;
- - (name): A list with all Effects linked to the given object;
- - (name, position): The Effect linked to the given object at the given position
- """
-
-class Effect:
- """
- The Effect object
- =================
- This object gives access to particle effect data in Blender.
-
- @ivar child: The number of children a particle may have.
- Values are clamped to the range [1,600].
- @type child: tuple of 4 ints
- @ivar childMat: The materials used by the 4 generation particles.
- Values are clamped to the range [1,16].
- @type childMat: tuple of 4 ints
- @ivar damping: The particle damping factor. This controls the rate at
- which particles decelerate.
- Values are clamped to the range [0.0,1.0].
- @type damping: float
- @ivar defvec: The x, y and z axis of the force defined by the texture.
- Values are clamped to the range [-1.0,1.0].
- @type defvec: tuple of 3 floats
- @ivar disp: The percentage of particles displayed.
- Value is clamped to the range [0,100].
- @type disp: int
- @ivar dispMat: The material used for the particles.
- Value is clamped to the range [1,16].
- @type dispMat: int
- @ivar emissionTex: The texture used for texture emission.
- Value is clamped to the range [1,10].
- @type emissionTex: int
- @ivar end: The end time of the effect.
- Value is clamped to the range [1.0,30000.0].
- @type end: float
- @ivar flag: The flag bitfield. See L{Flags} for values.
- @type flag: int
- @ivar force: The constant force applied to the parts.
- Values are clamped to the range [-1.0,1.0].
- @type force: tuple of 3 floats
- @ivar forceTex: The texture used for force.
- Value is clamped to the range [1,10].
- @type forceTex: int
- @ivar jitter: Jitter table distribution: maximum particles per face.
- Values are clamped to the range [0,200].
- @type jitter: int
- @ivar life: The lifetime of of the next generation of particles.
- Values are clamped to the range [1.0,30000.0].
- @type life: tuple of 4 floats
- @ivar lifetime: The lifetime of the effect.
- Value is clamped to the range [1.0,30000.0].
- @type lifetime: float
- @ivar mult: The probabilities of a particle having a child.
- Values are clamped to the range [0.0,1.0].
- @type mult: tuple of 4 floats
- @ivar nabla: The nabla value.
- Value is clamped to the range [0.0001,1.0].
- @type nabla: float
- @ivar normfac: The normal strength of the particles relative to mesh.
- Value is clamped to the range [-2.0,2.0].
- @type normfac: float
- @ivar obfac: The strength of the particles relative to objects.
- Value is clamped to the range [-1.0,1.0].
- @type obfac: float
- @ivar randfac: The initial random speed of the particles.
- Value is clamped to the range [0.0,2.0].
- @type randfac: float
- @ivar randlife: The variability of the life of the particles.
- Value is clamped to the range [0.0,2.0].
- @type randlife: float
- @ivar seed: The seed of the random number generator.
- Value is clamped to the range [0,255].
- @type seed: int
- @ivar speedType: Controls which texture property affects particle speeds.
- See L{SpeedTypes} for values and their meanings.
- @type speedType: int
- @ivar speedVGroup: The name of the vertex group used for speed control.
- @type speedVGroup: str
- @ivar sta: The start time of the effect.
- Value is clamped to the range [-250.0,30000.0].
- @type sta: float
- @ivar staticStep: percentage of skipped particles in static display.
- Value is clamped to the range [1,100].
- @type staticStep: int
- @ivar stype: The bitfield for vector.
- @type stype: int
- @ivar texfac: The initial speed of the particles caused by the texture.
- Value is clamped to the range [0.0,2.0].
- @type texfac: float
- @ivar totpart: The total number of particles.
- Value is clamped to the range [1,100000].
- @type totpart: int
- @ivar totkey: The total number of key positions.
- Value is clamped to the range [1,100].
- @type totkey: int
- @ivar type: The type of the effect. Deprecated.
- @type type: int
- @ivar vectsize: The size of vectors associated to the particles (if any).
- Value is clamped to the range [0.0,1.0].
- @type vectsize: float
- @ivar vGroup: The name of the vertex group used for emitted particles.
- @type vGroup: str
- """
-
- def getType():
- """
- Retrieves the type of an effect object.
- Deprecated, since only particle effects are supported.
- @rtype: int
- @return: the type of an effect object : should always return 1
- (particle effect)
- """
-
- def setType(name):
- """
- Deprecated, since only particle effects are supported.
- @type name: int
- @param name : the new type.
- @rtype: None
- @return: None
- """
-
- def getFlag():
- """
- Retrieves the flag of an effect object. The flag is a bit-mask.
- @rtype: int
- @return: The flag of the effect is a combination of parameters. See
- L{Flags} for values.
-
- """
-
- def setFlag(newflag):
- """
- Sets the flag of an effect object. See L{Flags} for values.
- @type newflag: int
- @param newflag: the new flag.
- @rtype: None
- @return: None
- """
-
- def getStartTime():
- """
- Retrieves the starting time of a particle effect object
- @rtype: float
- @return: the starting time of the effect.
- """
-
- def setSta(newstart):
- """
- Sets the starting time of an particle effect object
- @type newstart: float
- @param newstart: the new starting time.
- @rtype: None
- @return: None
- """
-
- def getEndTime():
- """
- Retrieves the end time of a particle effect object
- @rtype: float
- @return: the end time of the effect.
- """
-
- def setEnd(newendrt):
- """
- Sets the end time of an particle effect object
- @type newendrt: float
- @param newendrt: the new end time.
- @rtype: None
- @return: None
- """
-
- def getLifetime():
- """
- Retrieves the lifetime of a particle effect object
- @rtype: float
- @return: the lifetime of the effect.
- """
-
-
- def setLifetime(newlifetime):
- """
- Sets the lifetime of a particle effect object
- @type newlifetime: float
- @param newlifetime: the new lifetime.
- @rtype: None
- @return: None
- """
-
- def getNormfac():
- """
- Retrieves the normal strength of the particles (relatively to mesh).
- @rtype: float
- @return: normal strength of the particles (relatively to mesh).
- """
-
- def setNormfac(newnormfac):
- """
- Sets the normal strength of the particles (relatively to mesh).
- @type newnormfac: float
- @param newnormfac: the normal strength of the particles (relatively to mesh).
- @rtype: None
- @return: None
- """
-
- def getObfac():
- """
- Retrieves the initial strength of the particles relatively to objects.
- @rtype: float
- @return: initial strength of the particles (relatively to mesh).
- """
-
- def setObfac(newobfac):
- """
- Sets the initial strength of the particles relatively to objects.
- @type newobfac: float
- @param newobfac: the initial strength of the particles relatively to objects.
- @rtype: None
- @return: None
- """
-
- def getRandfac():
- """
- Retrieves the random strength applied to the particles.
- @rtype: float
- @return: random strength applied to the particles.
- """
-
- def setRandfac(newrandfac):
- """
- Sets the random strength applied to the particles.
- @type newrandfac: float
- @param newrandfac: the random strength applied to the particles.
- @rtype: None
- @return: None
- """
-
- def getStype():
- """
- Retrieves the vect state of an effect object.
- @rtype: int
- @return: the Stype (Vect) of an effect object : 0 , Vect is not enabled, 1, Vect is enabled
- (particle effect)
- """
-
- def setStype(int):
- """
- @type int : int
- @param int : state of the Stype : 0 not enabled, 1 enabled.
- @rtype: None
- @return: None
- """
-
- def getTexfac():
- """
- Retrieves the strength applied to the particles from the texture of the object.
- @rtype: float
- @return: strength applied to the particles from the texture of the object.
- """
-
- def setTexfac(newtexfac):
- """
- Sets the strength applied to the particles from the texture of the object.
- @type newtexfac: float
- @param newtexfac: the strength applied to the particles from the texture of the object.
- @rtype: None
- @return: None
- """
-
- def getRandlife():
- """
- Retrieves the variability of the life of the particles.
- @rtype: float
- @return: variability of the life of the particles.
- """
-
- def setRandlife(newrandlife):
- """
- Sets the variability of the life of the particles.
- @type newrandlife: float
- @param newrandlife: the variability of the life of the particles.
- @rtype: None
- @return: None
- """
-
- def getNabla():
- """
- Retrieves the sensibility of the particles to the variations of the texture.
- @rtype: float
- @return: sensibility of the particles to the variations of the texture.
- """
-
-
- def setNabla(newnabla):
- """
- Sets the sensibility of the particles to the variations of the texture.
- @type newnabla: float
- @param newnabla: the sensibility of the particles to the variations of the texture.
- @rtype: None
- @return: None
- """
-
- def getVectsize():
- """
- Retrieves the size of the vector which is associated to the particles.
- @rtype: float
- @return: size of the vector which is associated to the particles.
- """
-
-
- def setVectsize(newvectsize):
- """
- Sets the size of the vector which is associated to the particles.
- @type newvectsize: float
- @param newvectsize: the size of the vector which is associated to the particles.
- @rtype: None
- @return: None
- """
-
- def getTotpart():
- """
- Retrieves the total number of particles.
- @rtype: int
- @return: the total number of particles.
- """
-
-
- def setTotpart(newtotpart):
- """
- Sets the the total number of particles.
- @type newtotpart: int
- @param newtotpart: the the total number of particles.
- @rtype: None
- @return: None
- """
-
- def getTotkey():
- """
- Retrieves the number of keys associated to the particles (kind of degree of freedom)
- @rtype: int
- @return: number of keys associated to the particles.
- """
-
- def setTotkey(newtotkey):
- """
- Sets the number of keys associated to the particles.
- @type newtotkey: int
- @param newtotkey: number of keys associated to the particles.
- @rtype: None
- @return: None
- """
-
- def getSeed():
- """
- Retrieves the random number generator seed.
- @rtype: int
- @return: current seed value.
- """
-
- def setSeed(newseed):
- """
- Sets the random number generator seed.
- @type newseed: int
- @param newseed: new seed value.
- @rtype: None
- @return: None
- """
-
- def getForce():
- """
- Retrieves the force applied to the particles.
- @rtype: tuple of three floats
- @return: force applied to the particles.
- """
-
- def setForce(newforce):
- """
- Sets the force applied to the particles.
- @type newforce: tuple of 3 floats
- @param newforce: force applied to the particles.
- @rtype: None
- @return: None
- """
-
- def getMult():
- """
- Retrieves the probabilities of a particle having a child.
- @rtype: tuple of 4 floats
- @return: probabilities of a particle having a child.
- """
-
- def setMult(newmult):
- """
- Sets the probabilities of a particle having a child.
- @type newmult: tuple of 4 floats
- @param newmult: probabilities of a particle having a child.
- @rtype: None
- @return: None
- """
-
- def getLife():
- """
- Retrieves the average life of the particles (4 generations)
- @rtype: tuple of 4 floats
- @return: average life of the particles (4 generations)
- """
-
- def setLife(newlife):
- """
- Sets the average life of the particles (4 generations).
- @type newlife: tuple of 4 floats
- @param newlife: average life of the particles (4 generations).
- @rtype: None
- @return: None
- """
-
- def getChild():
- """
- Retrieves the average number of children of the particles (4 generations).
- @rtype: tuple of 4 ints
- @return: average number of children of the particles (4 generations).
- """
-
- def setChild(newchild):
- """
- Sets the average number of children of the particles (4 generations).
- @type newchild: tuple of 4 ints
- @param newchild: average number of children of the particles (4 generations).
- @rtype: None
- @return: None
- """
-
- def getMat():
- """
- Retrieves the indexes of the materials associated to the particles (4 generations).
- @rtype: tuple of 4 ints
- @return: indexes of the materials associated to the particles (4 generations).
- """
-
- def setMat(newmat):
- """
- Sets the indexes of the materials associated to the particles (4 generations).
- @type newmat: tuple of 4 ints
- @param newmat: the indexes of the materials associated to the particles (4 generations).
- @rtype: None
- @return: None
- """
-
- def getDefvec():
- """
- Retrieves the x, y and z components of the force defined by the texture.
- @rtype: tuple of 3 floats
- @return: x, y and z components of the force defined by the texture.
- """
-
- def setDefvec(newdefvec):
- """
- Sets the x, y and z components of the force defined by the texture.
- @type newdefvec: tuple of 3 floats
- @param newdefvec: the x, y and z components of the force defined by the
- texture.
- @rtype: None
- @return: None
- """
-
- def getParticlesLoc():
- """
- Gets the location of each particle at the current time in worldspace.
- @rtype: A list of vector or a list of vector lists.
- @return: The coordinates of each particle at the current time.
- If the "Vect" option is enabled a list Vector pairs will be returned with a start and end point for each particle.
- When static particles are enabled, a list of lists will be returned, each item a strand of particles.
-
- Example::
-
- import Blender
- from Blender import Effect, Object
- scn= Blender.Scene.GetCurrent()
- ob= scn.getActiveObject()
- effect= ob.effects[0]
- particles= effect.getParticlesLoc()
-
- # Check that particles are points only (not static and not vectors)
- if not effect.getFlag() & Effect.Flags.STATIC or not effect.getStype():
- for pt in particles:
- ob_empty= scn.objects.new('Empty')
- ob_empty.setLocation(pt)
-
- else: # Particles will be a list
- for pt in particles:
- for pt_item in pt:
- ob_empty= scn.objects.new('Empty')
- ob_empty.setLocation(pt_item)
-
- Example::
- # Converts particles into a mesh with edges for strands
- from Blender import Scene, Mathutils, Effect, Mesh, Object
- scn= Scene.GetCurrent()
- ob= scn.getActiveObject()
- me= Mesh.New()
-
- effects= Effect.Get()
- for eff in effects:
- for p in eff.getParticlesLoc():
- # p is either a vector or a list of vectors. me.verts.extend() will deal with either
- print p
- me.verts.extend(p)
-
- if type(p)==list: # Are we a strand or a pair, then add edges.
- if len(p)>1:
- edges= [(i, i+1) for i in range(len(me.verts)-len(p), len(me.verts)-1)]
- me.edges.extend( edges )
-
- print len(me.verts)
- ob= scn.objects.new(me)
- """
diff --git a/source/blender/python/api2_2x/doc/Effectdoc.txt b/source/blender/python/api2_2x/doc/Effectdoc.txt
deleted file mode 100644
index 76cff428ed6..00000000000
--- a/source/blender/python/api2_2x/doc/Effectdoc.txt
+++ /dev/null
@@ -1,257 +0,0 @@
-EFFECT Module documentation
-
-
-INTRODUCTION
-The module effect allows you to access all the data of an effect.
-An effect can modify an object (typically a mesh) in three different ways.
- a) the build effect : makes the mesh appear progressively.
- b) the wave effect : waves appear on the mesh (which should be fine-grained)
- c) the particle effect : every vertex of the mesh emits particles,
-which can themselves emit new particles. This effect is the most parameterizable.
-
-In the blender internals, the effect object is just a placeholder for the "real"
- effect, which can be a wave, particle or build effect. The python API follows
-this structure : the Effect module grants access to (the few) data which
- are shared between all effects. It has three submodules : Wave, Build, Particle
-, which grant r/w access to the real parameters of these effects.
-
-
-
-
-functions of the module :
-
-Get(Name:string,pos:int) : returns the pos-th Effect associated
- to the object whose name is Name.
-
-get : same as Get
-
-New(Type:string ) : Creates and returns a new Effect Object.
-The parameter Type can take the values "particle", "wave" or "build"
-
-
-
-Effect object member functions :
-
-getType() : Retrieves the type of the Effect Object.
-
-setType(val:int) : Sets the type of the Effect Object.
-The possible values of the type are :
- 0 : effect build.
- 1 : effect particle.
- 2 : effect wave.
-
-
-getFlag()Retrieves the flag of the Effect Object
-
-setFlag(val:int) :Sets the flag
-
-The flag of the effect is a combination of parameters, whose semantics depend upon the effect type.
-All types :
-Bit 0 : set to 1 if the effect is selected in the effects window.
-Wave effect :
-Bits 1,2,3 : set to 1 if the button "X", "Y" or "Cycl" is clicked.
-Particle effect :
-Bits 1,2,3 : set to 1 if the button "Bspline", "Static" or "Face" is clicked.
-
-
-
-
-
-
-Submodules : Wave, Build, Particle.
-
-
-
-
-Wave module
-
-
-
-functions of the module :
-
-Get(Name:string,pos:int) : returns the pos-th wave Effect associated to the object whose name is Name.
-
-get : same as Get
-
-New( ) : Creates and returns a new Wave Object.
-
-
-Wave object member functions :
-
-getStartx() : returns the startx parameter of the wave object.
-
-setStartx(val:int) : sets the startx parameter of the wave object.
-
-getStarty() : returns the starty parameter of the wave object.
-
-setStarty(val:int) : sets the starty parameter of the wave object.
-
-getHeight() : returns the height parameter of the wave object.
-
-setHeight(val:int) : sets the height parameter of the wave object.
-
-getWidth() : returns the width parameter of the wave object.
-
-setWidth(val:int) : sets the width parameter of the wave object.
-
-getNarrow() : returns the narrow parameter of the wave object.
-
-setNarrow(val:int) : sets the narrow parameter of the wave object.
-
-getSpeed() : returns the speed parameter of the wave object.
-
-setSpeed(val:int) : sets the speed parameter of the wave object.
-
-getMinfac() : returns the minfac parameter of the wave object.
-
-setMinfac(val:int) : sets the minfac parameter of the wave object.
-
-getDamp() : returns the damp parameter of the wave object.
-
-setDamp(val:int) : sets the damp parameter of the wave object.
-
-getTimeoffs() : returns the timeoffs parameter of the wave object.
-
-setTimeoffs(val:int) : sets the time offset parameter of the wave object.
-
-getLifetime() : returns the lifetime parameter of the wave object.
-
-setLifetime(val:int) : sets the lifetime parameter of the wave object.
-
-
-
-The Object.attr syntax
-
-Wave attributes can be read/written with the object.attr syntax.
-Example :
-
-w = Blender.Wave.Get("Obname",3) #retrieves the 4th effect associated to the object named Obname
-a = w.speed # a is now the value corresponding to the speed of the effect
-w.speed = 42 # the speed of the effect is now equal to 42
-
-The parameter can take these values : "lifetime","timeoffs","damp","minfac","speed","narrow","width","height","startx","starty"
-
-
-
-
-Build module
-
-
-
-functions of the module :
-
-Get(Name:string,pos:int) : returns the pos-th build Effect associated to the object whose name is Name.
-
-get(Name:string,pos:int) : same as Get
-
-New( ) : Creates and returns a new Build Object.
-
-
-Build object member functions :
-
-getLen() : returns the length of the effect (in frames).
-
-setLen(val:float) : sets the length of the effect (in frames).
-
-getSfra() : returns the starting frame of the effect.
-
-setSfra(val:float) : sets the starting frame of the effect.
-
-
-The Object.attribute syntax
-
-The attribute can take these values : "sfra","len".
-
-
-Particle module
-
-
-
-functions of the module :
-
-Get(Name:string,pos:int) : returns the pos-th particle Effect associated to the object whose name is Name.
-
-get(Name:string,pos:int) : same as Get
-
-New( ) : Creates and returns a new Effect Object.
-
-
-Particle object member functions :
-
-getStartTime() : returns the start time of the particle effect (in frames).
-
-setStartTime(val:float) : sets the start time of the particle effect (in frames).
-
-getEndTime() : returns the end time of the particle effect (in frames).
-
-setEndTime(val:float) : sets the end time of the particle effect (in frames).
-
-getLifeTime() : returns the life time of the particles.
-
-setLifeTime(val:float) : sets the life time of the particles.
-
-getNormfac() : returns the normal strength of the particles (relatively to mesh).
-
-setNormfac(val:float) : sets the normal strength of the particles(relatively to mesh).
-
-getObfac() : returns the initial of the particles relatively to objects.
-
-setObfac(val:float) : sets the initial of the particles relatively to objects.
-
-getRandfac() : returns the initial random speed of the particles.
-
-setRandfac(val:float) : sets the initial random speed of the particles.
-
-getTexfac() : returns the initial speed of the particles caused by the texture.
-
-setTexfac(val:float) : sets the initial speed of the particles caused by the texture.
-
-getRandlife() : returns the variability of the life of the particles.
-
-setRandlife(val:float) : sets the variability of the life of the particles.
-
-getNabla() : returns the dimension of the area for gradient computation.
-
-setNabla(val:float) : sets the dimension of the area for gradient computation.
-
-getTotpart() : returns the total number of particles.
-
-setTotpart(val:int) : sets the total number of particles.
-
-getTotkey() : returns the number of key positions.
-
-setTotkey(val:int) : sets the number of key positions.
-
-getSeed() : returns the seed of the RNG.
-
-setSeed(val:int) : sets the seed of the RNG.
-
-getSeed() : returns the x,y,z components of the constant force applied to the particles.
-
-setSeed(valx:float,valy:float,valz:float) : sets the x,y,z components of the constant force applied to the particles.
-
-getMult() : returns the 4 probabilities of a particle having a child.
-
-setMult(val1:float,val2:float,val3:float,val4:float) : sets the 4 probabilities of a particle having a child.
-
-getLife() : returns the lifespan of the 4 generation particles.
-
-setLife(val1:float,val2:float,val3:float,val4:float) : sets the lifespan of the 4 generation particles.
-
-getMat() : returns the material used by the 4 generation particles.
-
-setMat(val1:float,val2:float,val3:float,val4:float) : sets the material used by the 4 generation particles.
-
-getChild() : returns the number of children a particle may have.
-
-setChild(val1:float,val2:float,val3:float,val4:float) : sets the number of children a particle may have.
-
-getDefvec() : returns the x, y and z axis of the force defined by the texture.
-
-setDefvec(val1:float,val2:float,val3:float) : sets the x, y and z axis of the force defined by the texture.
-
-
-
-The Object.attribute syntax
-
-The attribute can take these values : "seed","nabla","sta","end","lifetime","normfac","obfac","randfac","texfac","randlife","vectsize","totpart","force","mult","life","child","mat","defvec". \ No newline at end of file
diff --git a/source/blender/python/api2_2x/doc/Font.py b/source/blender/python/api2_2x/doc/Font.py
deleted file mode 100644
index c0ad66d0462..00000000000
--- a/source/blender/python/api2_2x/doc/Font.py
+++ /dev/null
@@ -1,69 +0,0 @@
-# Blender.Text3d.Font module and the Font PyType object
-
-"""
-The Blender.Text3d.Font subsubmodule.
-
-Text3d.Font Objects
-===================
-
-This module provides access to B{Font} objects in Blender.
-
-Example::
- import Blender
- from Blender import Text3d
-
- # Load a font
- myfont= Text3d.Font.Load('/usr/share/fonts/ttf/verdana.ttf')
-
- #
- for font in Text3d.Font.Get():
- print font.name, font.filename, font.packed
-"""
-
-def Load (filename):
- """
- Create a new Text3d.Font object.
- @type filename: string
- @param filename: file of the font
- @rtype: Blender Text3d.Font
- @return: The created Text3d.Font Data object.
- """
-
-def Get (name = None):
- """
- Get the Text3d.Font object(s) from Blender.
- @type name: string
- @param name: The name of the Text3d object.
- @rtype: Blender Text3d or a list of Blender Text3ds
- @return: It depends on the 'name' parameter:
- - (name): The Text3d object with the given name;
- - (): A list with all Font objects in the current .blend file.
- """
-class Font:
- """
- The Text3d.Font object
- ======================
- This object gives access Blender's B{Font} objects
- @ivar filename: The filename (path) of the file loaded into this Font.
- @type filename: string
- @ivar packed: Boolean, True when the sample is packed (readonly).
- @type packed: string
- """
-
- def pack():
- """
- Packs the sound into the current blend file.
- @note: An error will be raised if the sound is already packed or the filename path does not exist.
- @returns: nothing
- @rtype: none
- """
-
- def unpack(mode):
- """
- Unpacks the sound to the samples filename.
- @param mode: One of the values in Blender.UnpackModes dict.
- @note: An error will be raised if the sound is not packed or the filename path does not exist.
- @returns: nothing
- @rtype: none
- @type mode: int
- """
diff --git a/source/blender/python/api2_2x/doc/Geometry.py b/source/blender/python/api2_2x/doc/Geometry.py
deleted file mode 100644
index f882f4b3b57..00000000000
--- a/source/blender/python/api2_2x/doc/Geometry.py
+++ /dev/null
@@ -1,97 +0,0 @@
-# Blender.Geometry module and its subtypes
-
-"""
-The Blender.Geometry submodule.
-
-Geometry
-========
-
-This new module provides access to a geometry function.
-"""
-
-def PolyFill(polylines):
- """
- Takes a list of polylines and calculates triangles that would fill in the polylines.
- Multiple lines can be used to make holes inside a polyline, or fill in 2 seperate lines at once.
- @type polylines: List of lists containing vectors, each representing a closed polyline.
- @rtype: list
- @return: a list if tuples each a tuple of 3 ints representing a triangle indexing the points given.
- @note: 2D Vectors will have an assumed Z axis of zero, 4D Vectors W axis is ignored.
- @note: The order of points in a polyline effect the direction returned triangles face, reverse the order of a polyline to flip the normal of returned faces.
-
- I{B{Example:}}
-
- The example below creates 2 polylines and fills them in with faces, then makes a mesh in the current scene::
- import Blender
- Vector= Blender.Mathutils.Vector
-
- # Outline of 5 points
- polyline1= [Vector(-2.0, 1.0, 1.0), Vector(-1.0, 2.0, 1.0), Vector(1.0, 2.0, 1.0), Vector(1.0, -1.0, 1.0), Vector(-1.0, -1.0, 1.0)]
- polyline2= [Vector(-1, 1, 1.0), Vector(0, 1, 1.0), Vector(0, 0, 1.0), Vector(-1.0, 0.0, 1.0)]
- fill= Blender.Geometry.PolyFill([polyline1, polyline2])
-
- # Make a new mesh and add the truangles into it
- me= Blender.Mesh.New()
- me.verts.extend(polyline1)
- me.verts.extend(polyline2)
- me.faces.extend(fill) # Add the faces, they reference the verts in polyline 1 and 2
-
- scn = Blender.Scene.GetCurrent()
- ob = scn.objects.new(me)
- Blender.Redraw()
- """
-
-def LineIntersect2D(vec1, vec2, vec3, vec4):
- """
- Takes 2 lines vec1, vec2 for the 2 points of the first line and vec2, vec3 for the 2 points of the second line.
- @rtype: Vector
- @return: a 2D Vector for the intersection or None where there is no intersection.
- """
-
-def ClosestPointOnLine(pt, vec1, vec2):
- """
- Takes 2 lines vec1, vec2 for the 2 points of the first line and vec2, vec3 for the 2 points of the second line.
- @rtype: tuple
- @return: a tuple containing a vector and a float, the vector is the closest point on the line, the float is the position on the line, between 0 and 1 the point is on the line.
- """
-
-def PointInTriangle2D(pt, tri_pt1, tri_pt2, tri_pt3):
- """
- Takes 4 vectors (one for the test point and 3 for the triangle)
- This is a 2d function so only X and Y are used, Z and W will be ignored.
- @rtype: bool
- @return: True or False depending on the points intersection.
- """
-
-def BoxPack2D(boxlist):
- """
- Takes a list of 2D boxes and packs them into a square.
- Each box in boxlist must be a list of at least 4 items - [x,y,w,h], after running this script,
- the X and Y values in each box will be moved to packed, non overlapping locations.
-
- Example::
-
- # Make 500 random boxes, pack them and make a mesh from it
- from Blender import Geometry, Scene, Mesh
- import random
- boxes = []
- for i in xrange(500):
- boxes.append( [0,0, random.random()+0.1, random.random()+0.1] )
- boxsize = Geometry.BoxPack2D(boxes)
- print 'BoxSize', boxsize
- me = Mesh.New()
- for x in boxes:
- me.verts.extend([(x[0],x[1], 0), (x[0],x[1]+x[3], 0), (x[0]+x[2],x[1]+x[3], 0), (x[0]+x[2],x[1], 0) ])
- v1= me.verts[-1]
- v2= me.verts[-2]
- v3= me.verts[-3]
- v4= me.verts[-4]
- me.faces.extend([(v1,v2,v3,v4)])
- scn = Scene.GetCurrent()
- scn.objects.new(me)
-
- @note: Each boxlist item can be longer then 4, the extra items are ignored and stay untouched.
- @rtype: tuple
- @return: a tuple pair - (width, height) of all the packed boxes.
- """
- \ No newline at end of file
diff --git a/source/blender/python/api2_2x/doc/Group.py b/source/blender/python/api2_2x/doc/Group.py
deleted file mode 100644
index aca7c56b4a5..00000000000
--- a/source/blender/python/api2_2x/doc/Group.py
+++ /dev/null
@@ -1,127 +0,0 @@
-# Blender.Group module and the Group PyType object
-
-"""
-The Blender.Group submodule.
-
-Group
-=====
-
-This module provides access to B{Group} data in Blender.
-
-Example::
-
- # Make Dupli's Real, as a python script.
-
- from Blender import *
-
- scn= Scene.GetCurrent()
- for ob in scn.objects:
- print 'Object Group Settings'
- print ob.name, ob.type
- print 'enableDupVerts:', ob.enableDupVerts
- print 'enableDupFrames:', ob.enableDupFrames
- print 'enableDupGroup:', ob.enableDupGroup
- print 'DupGroup:', ob.DupGroup
- dupe_obs= ob.DupObjects
- print 'num dup obs:', len(dupe_obs)
-
- for dup_ob, dup_matrix in dupe_obs:
- print '\tDupOb', dup_ob.name
- scn.objects.new(dup_ob.data)
- new_ob.setMatrix(dup_matrix)
- new_ob.sel= 1 # select all real instances.
-
- ob.sel=0 # Desel the original object
-
- Window.RedrawAll()
-
-Example::
-
- # Make a new group with the selected objects, and add an instance of this group.
-
- from Blender import *
-
- scn= Scene.GetCurrent()
-
- # New Group
- grp= Group.New('mygroup')
- grp.objects= scn.objects
-
- # Instance the group at an empty using dupligroups
- ob= scn.objects.new(None)
- ob.enableDupGroup= True
- ob.DupGroup= grp
- Window.RedrawAll()
-
-
-Example::
-
- # Remove all non mesh objects from a group.
-
- from Blender import *
-
- scn= Scene.GetCurrent()
-
- # New Group
- grp= Group.Get('mygroup')
- for ob in list(grp.objects): # Convert to a list before looping because we are removing items
- if ob.type != 'Mesh':
- grp.objects.unlink(ob)
-"""
-
-def New (name = None):
- """
- Make a new empty group, name optional, default is "Group"
- @type name: string
- @param name: The name of the new group.
- @rtype: Blender Group
- @return: A Empty Blender Group object
- """
-
-def Get (name = None):
- """
- Get the Group object(s) from Blender.
- @type name: string
- @param name: The name of the Group object.
- @rtype: Blender Group or a list of Blender Groups
- @return: It depends on the I{name} parameter:
- - (name): The Group object called I{name}, Exception if it is not found.
- - (): A list with all Group objects in the current blend file.
- """
-
-def Unlink (group):
- """
- Unlink (delete) this group from Blender.
- @Note: No objects will be removed, just the group that references them.
- @type group: group
- @param group: A group to remove from this blend file, does not remove objects that this group uses.
- """
-
-
-class Group:
- """
- The Group object
- ================
- This object gives access to Groups in Blender.
- @ivar layers: Layer bitmask for this group.
- @type layers: int
- @ivar objects: Objects that this group uses.
- This is a sequence with-list like access so use list(grp.objects) if you need to use a list (where grp is a group).
- The groups objects can be set by assigning a list or iterator of objects to the groups objects.
- objects.link() and objects.unlink() also work with the the objects iterator just like with lists.
-
- B{Note}: append() and remove() have been deprecated and replaced by link() and unlink(),
- after Blender 2.43 append() and remove() will not be available.
- @type objects: custom object sequence
- """
-
- def __copy__ ():
- """
- Make a copy of this group
- @rtype: Group
- @return: a copy of this group
- """
-
-import id_generics
-Group.__doc__ += id_generics.attributes
-
diff --git a/source/blender/python/api2_2x/doc/IDProp.py b/source/blender/python/api2_2x/doc/IDProp.py
deleted file mode 100644
index 0a0df335fa3..00000000000
--- a/source/blender/python/api2_2x/doc/IDProp.py
+++ /dev/null
@@ -1,130 +0,0 @@
-class IDGroup:
- """
- The IDGroup Type
- ================
- This type supports both iteration and the []
- operator to get child ID properties.
-
- You can also add new properties using the [] operator.
- For example::
-
- group['a float!'] = 0.0
- group['an int!'] = 0
- group['a string!'] = "hi!"
- group['an array!'] = [0, 0, 1.0, 0]
-
- group['a subgroup!] = {"float": 0.0, "an int": 1.0, "an array": [1, 2],
- "another subgroup": {"a": 0.0, "str": "bleh"}}
-
- Note that for arrays, the array type defaults to int unless a float is found
- while scanning the template list; if any floats are found, then the whole
- array is float.
-
- You can also delete properties with the del operator. For example:
-
- del group['property']
-
- To get the type of a property, use the type() operator, for example::
-
- if type(group['bleh']) == str: pass
-
- To tell if the property is a group or array type, import the Blender.Types module and test
- against IDGroupType and IDArrayType, like so::
-
- from Blender.Types import IDGroupType, IDArrayType.
-
- if type(group['bleghr']) == IDGroupType:
- (do something)
-
- @ivar name: The name of the property
- @type name: string
- """
-
- def pop(item):
- """
- Pop an item from the group property.
- @type item: string
- @param item: The item name.
- @rtype: can be dict, list, int, float or string.
- @return: The removed property.
- """
-
- def update(updatedict):
- """
- Updates items in the dict, similar to normal python
- dictionary method .update().
- @type updatedict: dict
- @param updatedict: A dict of simple types to derive updated/new IDProperties from.
- @rtype: None
- @return: None
- """
-
- def keys():
- """
- Returns a list of the keys in this property group.
- @rtype: list of strings.
- @return: a list of the keys in this property group.
- """
-
- def values():
- """
- Returns a list of the values in this property group.
-
- Note that unless a value is itself a property group or an array, you
- cannot change it by changing the values in this list, you must change them
- in the parent property group.
-
- For example,
-
- group['some_property'] = new_value
-
- . . .is correct, while,
-
- values = group.values()
- values[0] = new_value
-
- . . .is wrong.
-
- @rtype: list of strings.
- @return: a list of the values in this property group.
- """
-
- def iteritems():
- """
- Implements the python dictionary iteritmes method.
-
- For example::
-
- for k, v in group.iteritems():
- print "Property name: " + k
- print "Property value: " + str(v)
-
- @rtype: an iterator that spits out items of the form [key, value]
- @return: an iterator.
- """
-
- def convert_to_pyobject():
- """
- Converts the entire property group to a purely python form.
-
- @rtype: dict
- @return: A python dictionary representing the property group
- """
-
-class IDArray:
- """
- The IDArray Type
- ================
-
- @ivar type: returns the type of the array, can be either IDP_Int or IDP_Float
- """
-
- def __getitem__(index):
- pass
-
- def __setitem__(index, value):
- pass
-
- def __len__():
- pass
- \ No newline at end of file
diff --git a/source/blender/python/api2_2x/doc/Image.py b/source/blender/python/api2_2x/doc/Image.py
deleted file mode 100644
index 6d613b3c8fe..00000000000
--- a/source/blender/python/api2_2x/doc/Image.py
+++ /dev/null
@@ -1,374 +0,0 @@
-# Blender.Image module and the Image PyType object
-
-"""
-The Blender.Image submodule.
-
-Image
-=====
-
-B{New}: L{Image.clampX}, L{Image.clampY}.
-
-This module provides access to B{Image} objects in Blender.
-
-Example::
- import Blender
- from Blender import Image
- #
- image = Image.Load("/path/to/my/image.png") # load an image file
- print "Image from", image.getFilename(),
- print "loaded to obj", image.getName())
- image.setXRep(4) # set x tiling factor
- image.setYRep(2) # set y tiling factor
- print "All Images available now:", Image.Get()
-
-@type Sources: readonly dictionary
-@var Sources: The available Image Source.
- - STILL: Single image file
- - MOVIE: Movie file
- - SEQUENCE: Multiple image files, as sequence
- - GENERATED: Generated image
-"""
-
-def Load (filename):
- """
- Load the image called 'filename' into an Image object.
- @type filename: string
- @param filename: The full path to the image file.
- @rtype: Blender Image
- @return: A Blender Image object with the data from I{filename}.
- """
-
-def New (name, width, height, depth):
- """
- Create a new Image object.
- @type name: string
- @param name: The name of the new Image object.
- @type width: int
- @param width: The width of the new Image object, between 1 and 5000.
- @type height: int
- @param height: The height of the new Image object, between 1 and 5000.
- @type depth: int
- @param depth: The colour depth of the new Image object. (8:Grey, 24:RGB, 32:RGBA). (Not implimented yet, all new images will be 24bit)
- @rtype: Blender Image
- @return: A new Blender Image object.
- """
-
-def Get (name = None):
- """
- Get the Image object(s) from Blender.
- @type name: string
- @param name: The name of the Image object.
- @rtype: Blender Image or a list of Blender Images
- @return: It depends on the I{name} parameter:
- - (name): The Image object called I{name}, None if not found;
- - (): A list with all Image objects in the current scene.
- """
-
-def GetCurrent ():
- """
- Get the currently displayed Image from Blenders UV/Image window.
- When multiple images are displayed, the last active UV/Image windows image is used.
- @rtype: Blender Image
- @return: The Current Blender Image, If there is no current image it returns None.
- """
-
-from IDProp import IDGroup, IDArray
-class Image:
- """
- The Image object
- ================
- This object gives access to Images in Blender.
- @ivar filename: The filename (path) to the image file loaded into this Image
- object.
- @type filename: string
- @ivar size: The [width, height] dimensions of the image (in pixels).
- @type size: list
- @ivar depth: The pixel depth of the image. [8, 16, 18, 24, 32]
- @type depth: int
- @ivar xrep: Texture tiling: the number of repetitions in the x (horizontal)
- axis. [1, 16].
- @ivar yrep: Texture tiling: the number of repetitions in the y (vertical)
- axis [1, 16].
- @type xrep: int
- @type yrep: int
- @ivar start: Texture's animation start frame [0, 128].
- @type start: int
- @ivar end: Texture's animation end frame [0, 128].
- @type end: int
- @ivar speed: Texture's animation speed [1, 100].
- @type speed: int
- @ivar packed: True when the Texture is packed (readonly).
- @type packed: boolean
- @ivar has_data: True when the image has pixel data (readonly).
- @type has_data: boolean
- @ivar fields: enable or disable the fields option for this image.
- @type fields: boolean
- @ivar fields_odd: enable or disable the odd fields option for this image.
- @type fields_odd: boolean
- @ivar antialias: enable or disable the antialias option for this image.
- @type antialias: boolean
- @ivar bindcode: Texture's bind code (readonly).
- @type bindcode: int
- @ivar source: Image source type. See L{the Sources dictionary<Sources>} .
- @type source: int
- @ivar clampX: When true the image will not tile horizontally.
- @type clampX: bool
- @ivar clampY: When true the image will not tile vertically.
- @type clampY: bool
- """
-
- def getName():
- """
- Get the name of this Image object.
- @rtype: string
- """
-
- def getFilename():
- """
- Get the filename of the image file loaded into this Image object.
- @rtype: string
- """
-
- def getSize():
- """
- Get the [width, height] dimensions (in pixels) of this image.
- @rtype: list of 2 ints
- """
-
- def getDepth():
- """
- Get the pixel depth of this image.
- @rtype: int
- """
-
- def getPixelF(x, y):
- """
- Get the the colors of the current pixel in the form [r,g,b,a].
- Returned values are floats normalized to 0.0 - 1.0.
- Pixel coordinates are in the range from 0 to N-1. See L{getMaxXY}
- @returns: [ r, g, b, a]
- @rtype: list of 4 floats
- @type x: int
- @type y: int
- @param x: the x coordinate of pixel.
- @param y: the y coordinate of pixel.
- """
- def getPixelI(x, y):
- """
- Get the the colors of the current pixel in the form [r,g,b,a].
- Returned values are ints normalized to 0 - 255.
- Pixel coordinates are in the range from 0 to N-1. See L{getMaxXY}
- @returns: [ r, g, b, a]
- @rtype: list of 4 ints
- @type x: int
- @type y: int
- @param x: the x coordinate of pixel.
- @param y: the y coordinate of pixel.
- """
-
- def getMaxXY():
- """
- Get the x & y size for the image. Image coordinates range from 0 to size-1.
- @returns: [x, y]
- @rtype: list of 2 ints
- """
-
- def getMinXY():
- """
- Get the x & y origin for the image. Image coordinates range from 0 to size-1.
- @returns: [x, y]
- @rtype: list of 2 ints
- """
-
- def getXRep():
- """
- Get the number of repetitions in the x (horizontal) axis for this Image.
- This is for texture tiling.
- @rtype: int
- """
-
- def getYRep():
- """
- Get the number of repetitions in the y (vertical) axis for this Image.
- This is for texture tiling.
- @rtype: int
- """
-
- def getBindCode():
- """
- Get the Image's bindcode. This is for texture loading using BGL calls.
- See, for example, L{BGL.glBindTexture} and L{glLoad}.
- @rtype: int
- """
-
- def getStart():
- """
- Get the Image's start frame. Used for animated textures.
- @rtype: int
- """
-
- def getEnd():
- """
- Get the Image's end frame. Used for animated textures.
- @rtype: int
- """
-
- def getSpeed():
- """
- Get the Image's speed (fps). Used for animated textures.
- @rtype: int
- """
-
- def reload():
- """
- Reloads this image from the filesystem. If used within a loop you need to
- redraw the Window to see the change in the image, e.g. with
- Window.RedrawAll().
- @warn: if the image file is corrupt or still being written, it will be
- replaced by a blank image in Blender, but no error will be returned.
- @returns: None
- """
-
- def glLoad():
- """
- Load this image's data into OpenGL texture memory, if it is not already
- loaded (image.bindcode is 0 if it is not loaded yet).
- @note: Usually you don't need to call this method. It is only necessary
- if you want to draw textured objects in the Scripts window and the
- image's bind code is zero at that moment, otherwise Blender itself can
- take care of binding / unbinding textures. Calling this method for an
- image with nonzero bind code simply returns the image's bind code value
- (see L{getBindCode}).
- @rtype: int
- @returns: the texture's bind code.
- """
-
- def glFree():
- """
- Delete this image's data from OpenGL texture memory, only (the image itself
- is not removed from Blender's memory). Internally, glDeleteTextures (see
- L{BGL.glDeleteTextures}) is used, but this method also updates Blender's
- Image object so that its bind code is set to 0. See also L{Image.glLoad},
- L{Image.getBindCode}.
- """
-
- def setName(name):
- """
- Set the name of this Image object.
- @type name: string
- @param name: The new name.
- """
-
- def setFilename(name):
- """
- Change the filename of this Image object.
- @type name: string
- @param name: The new full filename.
- @warn: use this with caution and note that the filename is truncated if
- larger than 160 characters.
- """
-
- def setXRep(xrep):
- """
- Texture tiling: set the number of x repetitions for this Image.
- @type xrep: int
- @param xrep: The new value in [1, 16].
- """
-
- def setYRep(yrep):
- """
- Texture tiling: set the number of y repetitions for this Image.
- @type yrep: int
- @param yrep: The new value in [1, 16].
- """
-
- def setStart(start):
- """
- Get the Image's start frame. Used for animated textures.
- @type start: int
- @param start: The new value in [0, 128].
- """
-
- def setEnd(end):
- """
- Set the Image's end frame. Used for animated textures.
- @type end: int
- @param end: The new value in [0, 128].
- """
-
- def setSpeed(speed):
- """
- Set the Image's speed (fps). Used for animated textures.
- @type speed: int
- @param speed: The new value in [1, 100].
- """
-
- def setPixelF(x, y, (r, g, b,a )):
- """
- Set the the colors of the current pixel in the form [r,g,b,a].
- Color values must be floats in the range 0.0 - 1.0.
- Pixel coordinates are in the range from 0 to N-1. See L{getMaxXY}
- @type x: int
- @type y: int
- @type r: float
- @type g: float
- @type b: float
- @type a: float
- @returns: nothing
- @rtype: none
- """
-
- def setPixelI(x, y, (r, g, b, a)):
- """
- Set the the colors of the current pixel in the form [r,g,b,a].
- Color values must be ints in the range 0 - 255.
- Pixel coordinates are in the range from 0 to N-1. See L{getMaxXY}
- @type x: int
- @type y: int
- @type r: int
- @type g: int
- @type b: int
- @type a: int
- @returns: nothing
- @rtype: none
- """
-
- def save():
- """
- Saves the current image to L{filename}
- @note: Saving to a directory that doent exist will raise an error.
- @note: Saving a packed image will make a unique (numbered) name if the file alredy exists. Remove the file first to be sure it will not be renamed.
- @returns: None
- """
-
- def pack():
- """
- Packs the image into the current blend file.
-
- Since 2.44 new images without valid filenames can be packed.
-
- If the image is alredy packed, it will be repacked.
-
- @returns: nothing
- @rtype: none
- """
-
- def unpack(mode):
- """
- Unpacks the image to the images filename.
- @param mode: One of the values in L{Blender.UnpackModes}.
- @note: An error will be raised if the image is not packed or the filename path does not exist.
- @returns: nothing
- @rtype: none
- @type mode: int
- """
- def makeCurrent():
- """
- Set the currently displayed Image from Blenders UV/Image window.
- When multiple images are displayed, the last active UV/Image windows image is used.
- @warn: Deprecated, set bpy.data.images.active = image instead.
- @rtype: bool
- @return: True if the current image could be set, if no window was available, return False.
- """
-import id_generics
-Image.__doc__ += id_generics.attributes
diff --git a/source/blender/python/api2_2x/doc/Ipo.py b/source/blender/python/api2_2x/doc/Ipo.py
deleted file mode 100644
index b8c472b371a..00000000000
--- a/source/blender/python/api2_2x/doc/Ipo.py
+++ /dev/null
@@ -1,437 +0,0 @@
-# Blender.Ipo module and the Ipo PyType object
-
-"""
-The Blender.Ipo submodule
-
-B{New}:
- - Ipo updates to both the program and Bpython access.
- - access to Blender's new Ipo driver capabilities.
- - Ipo now supports the mapping operator [] to access IpoCurves
-
-This module provides access to the Ipo Data in Blender. An Ipo is composed of
-several IpoCurves, and an IpoCurve is composed of several BezTriples.
-
-Example::
- from Blender import Ipo
-
- ipo = Ipo.Get('ObIpo') # retrieves an Ipo object
- ipo.name = 'ipo1' # change the Ipo's name
- icu = ipo[Ipo.OB_LOCX] # request X Location Ipo curve
- if icu != None and len(icu.bezierPoints) > 0: # if curve exists and has BezTriple points
- val = icu[2.5] # get the curve's value at time 2.5
- ipo[Ipo.OB_LOCX] = None # delete the Ipo curve
-
-Each type of Ipo has different types Ipocurves. With the exception of Shape
-Key Ipos, constants are used to specify all Ipocurves. There are two ways
-to tell which Ipo curves go with which Ipo type:
- - all constants start with a two-character identifier for their Ipo type;
- for example, "OB_LOCX" is the LocX curve for an Object Ipo
- - each Ipo now has a read-only attribute L{Ipo.curveConsts}, which returns
- the valid Ipo curve types for that specific Ipo
-
-The valid IpoCurve constants are:
- 1. Material Ipo: MA_R, MA_G, MA_B, MA_SPECR, MA_SPECG, MA_SPECB,
- MA_MIRR, MA_MIRG, MA_MIRB, MA_REF, MA_ALPHA, MA_EMIT, MA_AMB,
- MA_SPEC, MA_HARD, MA_SPTRA, MA_IOR, MA_MODE, MA_HASIZE, MA_TRANSLU,
- MA_RAYMIR, MA_FRESMIR, MA_FRESMIRI, MA_FRESTRA, MA_FRESTRAI,
- MA_TRAGLOW, MA_OFSX, MA_OFSY, MA_OFSZ, MA_SIZEX, MA_SIZEY, MA_SIZEZ,
- MA_TEXR, MA_TEXG, MA_TEXB, MA_DEFVAR, MA_COL, MA_NOR, MA_VAR, MA_DISP
- 2. Lamp Ipo: LA_ENERG, LA_R, LA_G, LA_B, LA_DIST, LA_SPOSI, LA_SPOBL,
- LA_QUAD1, LA_QUAD2, LA_HAINT, LA_OFSX, LA_OFSY, LA_OFSZ, LA_SIZEX,
- LA_SIZEY, LA_SIZEZ, LA_TEXR, LA_TEXG, LA_TEXB, LA_DEFVAR, LA_COL
- 3. World Ipo: WO_HORR, WO_HORG, WO_HORB, WO_ZENR, WO_ZENG, WO_ZENB,
- WO_EXPOS, WO_MISI, WO_MISDI, WO_MISSTA, WO_MISHI, WO_STARR,
- WO_STARB, WO_STARG, WO_STARDI, WO_STARSI, WO_OFSX, WO_OFSY,
- WO_OFSZ, WO_SIZEX, WO_SIZEY, WO_SIZEZ, WO_TEXR, WO_TEXG,
- WO_TEXB, WO_DEFVAR, WO_COL, WO_NOR, WO_VAR
- 4. Camera Ipo: CA_LENS, CA_CLSTA, CA_CLEND, CA_APERT, CA_FDIST
- 5. Object Ipo: OB_LOCX, OB_LOCY, OB_LOCZ, OB_DLOCX, OB_DLOCY, OB_DLOCZ,
- OB_ROTX, OB_ROTY, OB_ROTZ, OB_DROTX, OB_DROTY, OB_DROTZ,
- OB_SIZEX, OB_SIZEY, OB_SIZEZ, OB_DSIZEX, OB_DSIZEY, OB_DSIZEZ,
- OB_LAYER, OB_TIME, OB_COLR, OB_COLG, OB_COLB, OB_COLA,
- OB_FSTRENG, OB_FFALL, OB_RDAMP, OB_DAMPING, OB_PERM
- 6. Curve Ipo: CU_SPEED
- 7. Constraint Ipo: CO_INF
- 8. Texture Ipo: TE_NSIZE, TE_NDEPTH, TE_NTYPE, TE_TURB, TE_VNW1, TE_VNW2,
- TE_VNW3, TE_VNW4, TE_MINKMEXP, TE_DISTM, TE_COLT, TE_ISCALE,
- TE_DISTA, TE_MGTYPE, TE_MGH, TE_LACU, TE_OCT, TE_MGOFF,
- TE_MGGAIN, TE_NBASE1, TE_NBASE2, TE_COLR, TE_COLG, TE_COLB,
- TE_BRIGHT, TE_CONTRAS
- 9. Pose/Action Ipo: PO_LOCX, PO_LOCY, PO_LOCZ, PO_SIZEX, PO_SIZEY,
- PO_SIZEZ, PO_QUATW, PO_QUATX, PO_QUATY, PO_QUATZ
- 10. Sequence Ipo: SQ_FAC
-
-Shape Key Ipos are handled differently from other Ipos. The user can rename
-the curves, so string are used to access them instead of constants. The
-L{Ipo.curveConsts} attribute for Shape Key Ipos returns a list of all defined
-key names.
-"""
-
-def New (type, name):
- """
- Creates a new Ipo.
- @type type: string
- @type name: string
- @param type: The Ipo's blocktype. Depends on the object the Ipo will be
- linked to. Currently supported types are Object, Camera, World,
- Material, Texture, Lamp, Action, Constraint, Sequence, Curve, Key.
- @param name: The name for this Ipo.
- @rtype: Blender Ipo
- @return: The created Ipo.
- """
-
-def Get (name = None):
- """
- Get the Ipo from Blender.
- @type name: string
- @param name: The name of the requested Ipo, or nothing.
- @rtype: Blender Ipo or a list of Blender Ipos
- @return: It depends on the 'name' parameter:
- - (name): The Ipo with the given name;
- - (): A list with all Ipos in the current scene.
- """
-
-class Ipo:
- """
- The Ipo object
- ==============
- This object gives access to Ipo data from all objects in Blender.
- @Note: Blender Materials, Lamps and Worlds have I{texture channels} which
- allow the user to assign textures to them. The Blender Ipo Window allows
- the user to access the IpoCurves for these channels by specifying a number
- between 0 and 9 (the number appears next to the Ipo type in the window
- header). Prior to Version 2.42, the BPy API did not allow users to access
- these texture channels in a predictable manner. A new attribute named
- L{channel} was added to the API in Version 2.42 to correct this problem.
-
- The current channel setting has an effect on the operators B{[]}, B{len()}
- and others. For example, suppose a Material has three IpoCurves
- (R, G, and B), and two texture channels (numbered 0 and 1), and furthermore
- channel 0 has one Ipocurve (Col). The IpoCurve Col can only be
- "seen" through the API when B{ipo.channel} is 0. Setting B{ipo.channel} to
- 1 will cause this curve to be ignored by B{len(ipo)}::
-
- from Blender import Ipo
-
- ipo = Ipo.Get('MatIpo')
- for channel in xrange(2):
- ipo.channel = channel
- print 'channel is',channel
- print ' len is',len(ipo)
- names = dict([(x[1],x[0]) for x in ipo.curveConsts.items()])
- for curve in [Ipo.MA_R,Ipo.MA_COL]:
- print ' ',names[curve],'is',curve in ipo
-
- will output::
- channel is 0
- len is 4
- MA_R is True
- MA_COL is True
- channel is 1
- len is 3
- MA_R is True
- MA_COL is False
-
- @ivar curves: Ipo curves currently defined for the Ipo.
- @type curves: list of Ipocurves.
- @ivar curveConsts: The valid Ipo curves for this Ipo. These can be used
- by the [] mapping operator. The value
- depends on the Ipo curve type. If the Ipo is any type other than a Key or
- Shape Ipo, this attribute returns a set of constants that can be
- used to specify a particular curve. For Key or Shape Ipos, the attribute
- returns a list of all defined keys by name.
- @type curveConsts: constant or list of strings. Read-only.
- @ivar channel: the current texture channel for Blender object which support
- textures (materials, lamps and worlds). Returns None if the Ipo does
- not support texture channels. Value must be in the range [0,9].
- @type channel: int or None
- """
-
- def __contains__():
- """
- The "in" operator for Ipos. It returns B{True} if the specified
- IpoCurve exists for the Ipo. This operator B{should not} be used to
- test for whether a curve constant is valid for a particular Ipo type.
- Many constants for different Ipo types have the same value, and it is
- the constant's value used internally.
- No exceptions are raised if the argument is not a valid curve constant or
- or string, nor does the operator return B{True} when the curve
- constant is valid but does not currently exist. As such, it should only be
- used to test for specific curves when the Ipo type is known::
- ipo = Object.Get('Cube').ipo # get Object-type Ipo
- if ipo:
- print Ipo.OB_LOCX in ipo # prints "True" if 'LocX' curve exists
- print Ipo.MA_R in ipo # also prints "True" since MA_R and OB_LOCX are have the same value
- print 'hiccup' in ipo # always prints "False" since argument is not a constant
-
- @return: see above.
- @rtype: Boolean
- """
-
- def __getitem__():
- """
- This operator is similar to the Python dictionary mapping operator [],
- except that the user cannot assign arbitrary keys. Each Ipo type has
- a pre-defined set of IpoCurves which may or may not exist at a given time. This operator
- will either return an IpoCurve object if the specified curve exists,
- return None if the curve does not exists, or throws a KeyError exception
- if the curve is not valid for this Ipo type.
- @return: an IpoCurve object if it exists
- @rtype: IpoCurve or None
- @raise KeyError: an undefined IpoCurve was specified for the Ipo
- """
-
- def __iter__():
- """
- Iterator for Ipos. It returns all the defined IpoCurve objects associated
- with the Ipo. For example::
- from Blender import Ipo
-
- ipo = Ipo.Get()
- if len(ipo) > 0:
- ipo = ipo[0]
- print 'ipo name is',ipo.name
- for icu in ipo:
- print ' curve name is',icu.name
- might result in::
- ipo name is ObIpo
- curve name is LocX
- curve name is LocY
- curve name is LocZ
-
- @return: an IpoCurve object
- @rtype: IpoCurve
- """
-
- def __len__():
- """
- Returns the number of curves defined for the Ipo.
- @return: number of defined IpoCurves
- @rtype: int
- """
-
- def getName():
- """
- Gets the name of the Ipo (B{deprecated}). See the L{name} attribute.
- @rtype: string
- @return: the name of the Ipo.
- """
-
- def setName(newname):
- """
- Sets the name of the Ipo (B{deprecated}). See the L{name} attribute.
- @type newname: string
- @rtype: None
- @return: None
- """
-
- def getCurves():
- """
- Gets all the IpoCurves of the Ipo (B{deprecated}). Use the
- L{iterator operator []<__iter__>} instead.
- @rtype: list of IpoCurves
- @return: A list (possibly empty) containing all the IpoCurves associated
- to the Ipo object.
- """
-
- def getCurve(curve):
- """
- Return the specified IpoCurve (B{deprecated}). Use the L{mapping
- operator B{[]}<__getitem__>} instead.
- If the curve does not exist in the Ipo,
- None is returned. I{curve} can be either a string or an integer,
- denoting either the name of the Ipo curve or its internal adrcode.
- The possible Ipo curve names are:
-
- 1. Camera Ipo: Lens, ClSta, ClEnd, Apert, FDist.
- 2. Material Ipo: R, G, B, SpecR, SpecG, SpecB, MirR, MirG, MirB, Ref,
- Alpha, Emit, Amb, Spec, Hard, SpTra, Ior, Mode, HaSize, Translu,
- RayMir, FresMir, FresMirI, FresTra, FresTraI, TraGlow, OfsX, OfsY,
- OfsZ, SizeX, SizeY, SizeZ, texR, texG, texB, DefVar, Col, Nor, Var,
- Disp.
- 3. Object Ipo: LocX, LocY, LocZ, dLocX, dLocY, dLocZ, RotX, RotY, RotZ,
- dRotX, dRotY, dRotZ, SizeX, SizeY, SizeZ, dSizeX, dSizeY, dSizeZ,
- Layer, Time, ColR, ColG, ColB, ColA, FStreng, FFall, Damping,
- RDamp, Perm.
- 4. Lamp Ipo: Energ, R, G, B, Dist, SpoSi, SpoBl, Quad1, Quad2, HaInt.
- 5. World Ipo: HorR, HorG, HorB, ZenR, ZenG, ZenB, Expos, Misi, MisDi,
- MisSta, MisHi, StaR, StaG, StaB, StarDi, StarSi, OfsX, OfsY, OfsZ,
- SizeX, SizeY, SizeZ, TexR, TexG, TexB, DefVar, Col, Nor, Var.
- 5. World Ipo: HorR, HorG, HorB, ZenR, ZenG, ZenB, Expos, Misi, MisDi,
- MisSta, MisHi, StarR, StarB, StarG, StarDi, StarSi, OfsX, OfsY, OfsZ,i
- SizeX, SizeY, SizeZ, texR, texG, texB, DefVar, Col, Nor, Var.
- 6. Texture Ipo: NSize, NDepth, NType, Turb, Vnw1, Vnw2, Vnw3, Vnw4,
- MinkMExp, DistM, ColT, iScale, DistA, MgType, MgH, Lacu, Oct,
- MgOff, MgGain, NBase1, NBase2.
- 7. Curve Ipo: Speed.
- 8. Action Ipo: LocX, LocY, LocZ, SizeX, SizeY, SizeZ, QuatX, QuatY,
- QuatZ, QuatW.
- 9. Sequence Ipo: Fac.
- 10. Constraint Ipo: Inf.
-
- The adrcode for the Ipo curve can also be given; this is useful for
- accessing curves for Shape Key Ipos. The adrcodes for Shape Key Ipo are
- numbered consecutively starting at 0.
- @type curve : string or int
- @rtype: IpoCurve object
- @return: the corresponding IpoCurve, or None.
- @raise ValueError: I{curve} is not a valid name or adrcode for this Ipo
- type.
- """
-
- def addCurve(curvename):
- """
- Add a new curve to the Ipo object. The possible values for I{curvename} are:
- 1. Camera Ipo: Lens, ClSta, ClEnd, Apert, FDist.
- 2. Material Ipo: R, G, B, SpecR, SpecG, SpecB, MirR, MirG, MirB, Ref,
- Alpha, Emit, Amb, Spec, Hard, SpTra, Ior, Mode, HaSize, Translu,
- RayMir, FresMir, FresMirI, FresTra, FresTraI, TraGlow, OfsX, OfsY,
- OfsZ, SizeX, SizeY, SizeZ, texR, texG, texB, DefVar, Col, Nor, Var,
- Disp.
- 3. Object Ipo: LocX, LocY, LocZ, dLocX, dLocY, dLocZ, RotX, RotY, RotZ,
- dRotX, dRotY, dRotZ, SizeX, SizeY, SizeZ, dSizeX, dSizeY, dSizeZ,
- Layer, Time, ColR, ColG, ColB, ColA, FStreng, FFall, Damping,
- RDamp, Perm.
- 4. Lamp Ipo: Energ, R, G, B, Dist, SpoSi, SpoBl, Quad1, Quad2, HaInt.
- 5. World Ipo: HorR, HorG, HorB, ZenR, ZenG, ZenB, Expos, Misi, MisDi,
- MisSta, MisHi, StaR, StaG, StaB, StarDi, StarSi, OfsX, OfsY, OfsZ,
- SizeX, SizeY, SizeZ, TexR, TexG, TexB, DefVar, Col, Nor, Var.
- 5. World Ipo: HorR, HorG, HorB, ZenR, ZenG, ZenB, Expos, Misi, MisDi,
- MisSta, MisHi, StarR, StarB, StarG, StarDi, StarSi, OfsX, OfsY, OfsZ,i
- SizeX, SizeY, SizeZ, texR, texG, texB, DefVar, Col, Nor, Var.
- 6. Texture Ipo: NSize, NDepth, NType, Turb, Vnw1, Vnw2, Vnw3, Vnw4,
- MinkMExp, DistM, ColT, iScale, DistA, MgType, MgH, Lacu, Oct,
- MgOff, MgGain, NBase1, NBase2.
- 7. Curve Ipo: Speed.
- 8. Action Ipo: LocX, LocY, LocZ, SizeX, SizeY, SizeZ, QuatX, QuatY,
- QuatZ, QuatW.
- 9. Sequence Ipo: Fac.
- 10. Constraint Ipo: Inf.
-
- For Key IPOs, the name must be an existing KeyBlock name. Use
- L{curveConsts} to determine the set of valid names.
-
- @type curvename : string
- @rtype: IpoCurve object
- @return: the corresponding IpoCurve, or None.
- @raise ValueError: I{curvename} is not valid or already exists
- """
-
- def delCurve(curvename):
- """
- Delete an existing curve from the Ipo object (B{deprecated}).
- Use the L{mapping operator B{[]}<__getitem__>} instead::
- from Blender import Ipo
-
- ipo = Ipo.Get('ObIpo')
- ipo[Ipo.LOCX] = None
-
- @type curvename : string
- @rtype: None
- @return: None.
- """
-
- def getBlocktype():
- """
- Gets the blocktype of the Ipo.
- @rtype: int
- @return: the blocktype of the Ipo.
- """
-
- def setBlocktype(newblocktype):
- """
- Sets the blocktype of the Ipo.
- @type newblocktype: int
- @rtype: None
- @return: None
- @warn: 'newblocktype' should not be changed unless you really know what
- you are doing ...
- """
-
- def getRctf():
- """
- Gets the rctf of the Ipo.
- Kind of bounding box...
- @rtype: list of floats
- @return: the rctf of the Ipo.
- """
-
- def setRctf(newrctf):
- """
- Sets the rctf of the Ipo.
- @type newrctf: four floats.
- @rtype: None
- @return: None
- @warn: rctf should not be changed unless you really know what you are
- doing ...
- """
-
- def getNcurves():
- """
- Gets the number of curves of the Ipo (B{deprecated}). Use
- L{len(ipo)<__len__>} instead.
- @rtype: int
- @return: the number of curve of the Ipo.
- """
-
- def getCurveBP(curvepos):
- """
- This method is unsupported. BPoint Ipo curves are not implemented.
- Calling this method throws a NotImplementedError exception.
- @raise NotImplementedError: this method B{always} raises an exception
- """
-
- def getBeztriple(curvepos,pointpos):
- """
- Gets a beztriple of the Ipo (B{deprecated}). B{Note}:
- Use L{IpoCurve.bezierPoints<IpoCurve.IpoCurve.bezierPoints>} instead.
- @type curvepos: int
- @param curvepos: the position of the curve in the Ipo.
- @type pointpos: int
- @param pointpos: the position of the point in the curve.
- @rtype: list of 9 floats
- @return: the beztriple of the Ipo, or an error is raised.
- """
-
- def setBeztriple(curvepos,pointpos,newbeztriple):
- """
- Sets the beztriple of the Ipo (B{deprecated}). B{Note}: use
- L{IpoCurve.bezierPoints<IpoCurve.IpoCurve.bezierPoints>} to get a
- BezTriple point, then use the
- L{BezTriple} API to set the point's attributes.
- @type curvepos: int
- @param curvepos: the position of the curve in the Ipo.
- @type pointpos: int
- @param pointpos: the position of the point in the curve.
- @type newbeztriple: list of 9 floats
- @param newbeztriple: the new value for the point
- @rtype: None
- @return: None
- """
-
- def getCurveCurval(curvepos):
- """
- Gets the current value of a curve of the Ipo (B{deprecated}). B{Note}:
- new scripts should use L{IpoCurve.evaluate()<IpoCurve.IpoCurve.evaluate>}.
- @type curvepos: int or string
- @param curvepos: the position of the curve in the Ipo or the name of the
- curve
- @rtype: float
- @return: the current value of the selected curve of the Ipo.
- """
-
- def EvaluateCurveOn(curvepos,time):
- """
- Gets the value at a specific time of a curve of the Ipo (B{deprecated}).
- B{Note}: new scripts should use
- L{IpoCurve.evaluate()<IpoCurve.IpoCurve.evaluate>}.
- @type curvepos: int
- @param curvepos: the position of the curve in the Ipo.
- @type time: float
- @param time: the desired time.
- @rtype: float
- @return: the current value of the selected curve of the Ipo at the given
- time.
- """
-import id_generics
-Ipo.__doc__ += id_generics.attributes
diff --git a/source/blender/python/api2_2x/doc/IpoCurve.py b/source/blender/python/api2_2x/doc/IpoCurve.py
deleted file mode 100644
index 873888cffb4..00000000000
--- a/source/blender/python/api2_2x/doc/IpoCurve.py
+++ /dev/null
@@ -1,226 +0,0 @@
-# Blender.IpoCurve module and the IpoCurve PyType object
-
-"""
-The Blender.IpoCurve submodule
-
-B{New}:
- - IpoCurves supports the operator [], which accesses the value of
- curves at a given time.
-
-This module provides access to the IpoCurve data in Blender. An Ipo is
-composed of several IpoCurves, and an IpoCurve are composed of several
-BezTriples.
-
-Example::
- import Blender
- ipo = Blender.Ipo.Get('ObIpo') # retrieves an Ipo object
- ipo.name = 'ipo1' # change the Ipo's name
- icu = ipo[Blender.Ipo.OB_LOCX] # request X Location Ipo curve object
- if icu != None and len(icu.bezierPoints) > 0: # if curve exists and has BezTriple points
- val = icu[2.5] # get the curve's value at time 2.5
-
-@type ExtendTypes: readonly dictionary
-@var ExtendTypes: The available IpoCurve extend types.
- - CONST - curve is constant beyond first and last knots
- - EXTRAP - curve maintains same slope beyond first and last knots
- - CYCLIC - curve values repeat beyond first and last knots
- - CYCLIC_EXTRAP - curve values repeat beyond first and last knots,
- but while retaining continuity
-
-@type InterpTypes: readonly dictionary
-@var InterpTypes: The available IpoCurve interpolation types.
- - CONST - curve remains constant from current BezTriple knot
- - LINEAR - curve is linearly interpolated between adjacent knots
- - BEZIER - curve is interpolated by a Bezier curve between adjacent knots
-"""
-
-class IpoCurve:
- """
- The IpoCurve object
- ===================
- This object gives access to generic data from all Ipo curves objects
- in Blender.
-
- Important Notes for Rotation Ipo Curves:\n
- For the rotation Ipo curves, the y values for points are in units of 10
- degrees. For example, 45.0 degrees is stored as 4.50 degrees. These are the
- same numbers you see in the Transform Properties pop-up menu ( NKey ) in
- the IPO Curve Editor window. Positive rotations are in a counter-clockwise
- direction, following the standard convention.
-
- @ivar driver: Status of the driver. 1= on, 0= object, 2= python expression.
- @type driver: int
- @ivar driverObject: Object used to drive the Ipo curve.
- @type driverObject: Blender Object or None
- @ivar driverExpression: Python expression used to drive the Ipo curve. [0 - 127 chars]
- @type driverExpression: string
- @ivar sel: The selection state of this curve.
- @type sel: bool
- @ivar driverChannel: Object channel used to drive the Ipo curve.
- Use module constants: IpoCurve.LOC_X, IpoCurve.LOC_Y, IpoCurve.LOC_Z,
- IpoCurve.ROT_X, IpoCurve.ROT_Y, IpoCurve.ROT_Z, IpoCurve.SIZE_X,
- IpoCurve.SIZE_Y, IpoCurve.SIZE_Z
- @type driverChannel: int
- @ivar name: The IpoCurve data name.
- @type name: string
- @ivar bezierPoints: The list of the curve's bezier points.
- @type bezierPoints: list of BezTriples.
- @ivar interpolation: The curve's interpolation mode. See L{InterpTypes} for
- values.
- @type interpolation: int
- @ivar extend: The curve's extend mode. See L{ExtendTypes} for values.
-
- B{Note}: Cyclic Ipo curves never reach the end value. If the first and
- last bezier points do not have the same y coordinate, the value of the
- curve when it "cycles" is that of the first point. If a user wants to
- get the value of the final curve point, read the final point from the
- curve::
-
- ipo = Blender.Object.Get('Cube').ipo
- icu = ipo['LocX']
- endtime,endvalue = icu.bezierPoints[-1].pt
- @type extend: int
- """
-
- def __getitem__ (time):
- """
- Returns the value of the curve at a particular time.
- @type time: float
- @param time: time (Vertex X) on the curve
- @rtype: float
- @return: value (Vertex Y) corresponding to the given time
- """
-
- def __setitem__ (time):
- """
- Sets the value (Vertex Y) of the curve at a particular time.
- @type time: float
- @param time: time (Vertex X) on the curve
- """
-
- def setExtrapolation(extendmode):
- """
- Sets the extend mode of the curve (B{deprecated}). B{Note}: new scripts
- should use the L{extend} attribute instead.
- @type extendmode: string
- @param extendmode: the extend mode of the curve.
- Can be Constant, Extrapolation, Cyclic or Cyclic_extrapolation.
- @rtype: None
- @return: None
- """
-
- def getExtrapolation():
- """
- Gets the extend mode of the curve (B{deprecated}). B{Note}: new scripts
- should use the L{extend} attribute instead.
- @rtype: string
- @return: the extend mode of the curve. Can be Constant, Extrapolation, Cyclic or Cyclic_extrapolation.
- """
-
- def setInterpolation(interpolationtype):
- """
- Sets the interpolation type of the curve (B{deprecated}). B{Note}:
- new scripts should use the L{interpolation} attribute instead.
- @type interpolationtype: string
- @param interpolationtype: the interpolation type of the curve. Can be Constant, Bezier, or Linear.
- @rtype: None
- @return: None
- """
-
- def getInterpolation():
- """
- Gets the interpolation type of the curve (B{deprecated}). B{Note}:
- new scripts should use the L{interpolation} attribute instead.
- @rtype: string
- @return: the interpolation type of the curve. Can be Constant, Bezier, or Linear.
- """
-
- def append(point):
- """
- Adds a Bezier point to a IpoCurve.
- @type point: BezTriple or tuple of 2 floats
- @param point: Can either be a BezTriple, or the x and y coordinates of
- the Bezier knot point.
- @rtype: None
- @return: None
- """
-
- def addBezier(coordlist):
- """
- Adds a Bezier point to a curve B{deprecated}). B{Note}: new scripts
- should use L{append} instead.
- @type coordlist: tuple of (at least) 2 floats
- @param coordlist: the x and y coordinates of the new Bezier point.
- @rtype: None
- @return: None
- """
-
- def delBezier(index):
- """
- Deletes a Bezier point from a curve.
- @type index: integer
- @param index: the index of the Bezier point. Negative values index from the end of the list.
- @rtype: None
- @return: None
- """
-
- def recalc():
- """
- Recomputes the curve after changes to control points.
- @rtype: None
- @return: None
- """
-
- def getName():
- """
- Returns the name of the Ipo curve (B{deprecated}). B{Note}:
- new scripts should use the L{name} attribute instead.
- The name can be:
- 1. Camera Ipo: Lens, ClSta, ClEnd, Apert, FDist.
- 2. Material Ipo: R, G, B, SpecR, SpecG, SpecB, MirR, MirG, MirB, Ref,
- Alpha, Emit, Amb, Spec, Hard, SpTra, Ior, Mode, HaSize, Translu,
- RayMir, FresMir, FresMirI, FresTra, FresTraI, TraGlow, OfsX, OfsY,
- OfsZ, SizeX, SizeY, SizeZ, texR, texG, texB, DefVar, Col, Nor, Var,
- Disp.
- 3. Object Ipo: LocX, LocY, LocZ, dLocX, dLocY, dLocZ, RotX, RotY, RotZ,
- dRotX, dRotY, dRotZ, SizeX, SizeY, SizeZ, dSizeX, dSizeY, dSizeZ,
- Layer, Time, ColR, ColG, ColB, ColA, FStreng, FFall, Damping,
- RDamp, Perm.
- 4. Lamp Ipo: Energ, R, G, B, Dist, SpoSi, SpoBl, Quad1, Quad2, HaInt.
- 5. World Ipo: HorR, HorG, HorB, ZenR, ZenG, ZenB, Expos, Misi, MisDi,
- MisSta, MisHi, StaR, StaG, StaB, StarDi, StarSi, OfsX, OfsY, OfsZ,
- SizeX, SizeY, SizeZ, TexR, TexG, TexB, DefVar, Col, Nor, Var.
- 5. World Ipo: HorR, HorG, HorB, ZenR, ZenG, ZenB, Expos, Misi, MisDi,
- MisSta, MisHi, StarR, StarB, StarG, StarDi, StarSi, OfsX, OfsY, OfsZ,i
- SizeX, SizeY, SizeZ, texR, texG, texB, DefVar, Col, Nor, Var.
- 6. Texture Ipo: NSize, NDepth, NType, Turb, Vnw1, Vnw2, Vnw3, Vnw4,
- MinkMExp, DistM, ColT, iScale, DistA, MgType, MgH, Lacu, Oct,
- MgOff, MgGain, NBase1, NBase2.
- 7. Curve Ipo: Speed.
- 8. Action Ipo: LocX, LocY, LocZ, SizeX, SizeY, SizeZ, QuatX, QuatY,
- QuatZ, QuatW.
- 9. Sequence Ipo: Fac.
- 10. Constraint Ipo: Inf.
-
- @rtype: string
- @return: the name of the Ipo curve.
- """
-
- def getPoints():
- """
- Returns all the points of the IpoCurve (B{deprecated}).
- B{Note}: new scripts should use the L{bezierPoints} attribute instead.
- @rtype: list of BezTriples
- @return: the points of the Ipo curve.
- """
-
- def evaluate( time ):
- """
- Compute the value of the Ipo curve at a particular time (B{deprecated}).
- B{Note}: new scripts should use L{icu[time]<__getitem__>} instead.
- @type time: float
- @param time: value along the X axis
- @rtype: float
- @return: the Y value of the curve at the given time
- """
-
diff --git a/source/blender/python/api2_2x/doc/Ipodoc.txt b/source/blender/python/api2_2x/doc/Ipodoc.txt
deleted file mode 100644
index 81d51595fa9..00000000000
--- a/source/blender/python/api2_2x/doc/Ipodoc.txt
+++ /dev/null
@@ -1,66 +0,0 @@
-IPO Module documentation
-
-
-INTRODUCTION
-The module ipo allows you to access all the data of an ipo.
-The most important part(s) of an ipo is its ipocurve(s). The ipocurve has a set of bezier points (defined by 9 coordinates). The ipo module grants the user read/write access to these points.
-
-
-
-
-functions of the module :
-
-Get(Name:string) : returns the Ipo associated whose name is Name.
-
-get : same as Get
-
-New(Name:string , idcode:int ) : Creates and returns a new Ipo Object.
-The parameters are mandatory. If the name is already used, blender will change it to name.XXX (XXX is an integer)
-
-
-
-Ipo object member functions :
-
-getName() : Retrieves the name of the Ipo Object.
-
-setName(newname:string) : Sets the name of the Ipo Object.
-
-getBlocktype() : Retrieves the blocktype of the Ipo Object.
-
-setBlocktype(newblocktype:string) : Sets the blocktype of the Ipo Object.
-
-getShowkey() : Retrieves the showkey of the Ipo Object.
-
-setShowkey(val:int) : Sets the showkey of the Ipo Object.
-
-getPad() : Retrieves the pad of the Ipo Object.
-
-setPad(val:int) : Sets the pad of the Ipo Object.
-
-getRctf() : Retrieves the rctf of the Ipo Object.
-
-setRctf(val:int) : Sets the rctf of the Ipo Object.
-
-I do not fully understand the meaning of these parameters.
-
-
-
-getNcurves() : returns the number of ipocurves the ipo object contains.
-
-getBP() : returns the basepoint of the ipo object (generally NULL)
-
-getCurveCurval(numcurve:int) : returns the current value of the ipo curve number numcurve.
-
-getCurveBeztriple(numcurve:int,numpoint:int) : returns a list of 9 floats, which are the coordinates of the control point number numpoint of the ipocurve number numcurve.
-
-
-
-setCurveBeztriple(numcurve:int,numpoint:int,newvalues : list of 9 floats) : sets the coordinates of the control point number numpoint of the ipocurve number numcurve to newvalues. (the z coordinate should be 0, but blender does not complain if non null values are passed)
-
-
-
-Example :
-import Blender
-
-d = Blender.Ipo.Get('ObIpo') # hope there is an ipo named "ObIpo"...Else create it before.
-
diff --git a/source/blender/python/api2_2x/doc/Key.py b/source/blender/python/api2_2x/doc/Key.py
deleted file mode 100644
index 53f289d2e8b..00000000000
--- a/source/blender/python/api2_2x/doc/Key.py
+++ /dev/null
@@ -1,124 +0,0 @@
-# Blender.Key module and the Key and KeyBlock PyType objects
-
-"""
-The Blender.Key submodule.
-
-This module provides access to B{Key} objects in Blender.
-
-@type Types: readonly dictionary
-@var Types: The type of a key owner, indicating the type of data in the
-data blocks.
- - MESH - the key is a Mesh key; data blocks contain
- L{NMVert<NMesh.NMVert>} vertices.
- - CURVE - the key is a Curve key; data blocks contains either
- L{BezTriples<BezTriple.BezTriple>} or points (represented by a list of
- 3 floating point numbers).
- - LATTICE - the key is a Lattice key; data blocks contain
- BPoints, each point represented by a list of 3 floating point numbers.
-"""
-
-def Get(name = None):
- """
- Get the named Key object from Blender. If the name is omitted, it
- will retrieve a list of all keys in Blender.
- @type name: string
- @param name: the name of the requested key
- @return: If name was given, return that Key object (or None if not
- found). If a name was not given, return a list of every Key object
- in Blender.
- """
-
-class Key:
- """
- The Key object
- ==============
- An object with keyframes (L{Lattice}, L{NMesh} or
- L{Curve}) will contain a Key object representing the
- keyframe data.
-
- @ivar ipo: Key Ipo. Contains the Ipo if one is assigned to the
- object, B{None} otherwise. Setting to B{None} clears the current Ipo.
- @type ipo: Blender Ipo
- @ivar value: The value of the key. Read-only.
- @type value: float
- @ivar type: An integer from the L{Types} dictionary
- representing the Key type. Read-only.
- @type type: int
- @ivar blocks: A list of KeyBlocks for the key. Read-only.
- @type blocks: Blender KeyBlock.
- @ivar relative: Indicates whether the key is relative(=True) or normal.
- @type relative: bool
- """
-
- def getIpo():
- """
- Get the L{Ipo} object associated with this key.
- """
- def getBlocks():
- """
- Get a list of L{KeyBlock}s, containing the keyframes defined for
- this Key.
- """
-
-class KeyBlock:
- """
- The KeyBlock object
- ===================
- Each Key object has a list of KeyBlocks attached, each KeyBlock
- representing a keyframe.
-
- @ivar curval: Current value of the corresponding IpoCurve. Read-only.
- @type curval: float
- @ivar name: The name of the Keyblock. Truncated to 32 characters.
- @type name: string
- @ivar pos: The position of the keyframe.
- @type pos: float
- @ivar slidermin: The minimum value for the action slider.
- Value is clamped to the range [-10.0,10.0].
- @type slidermin: float
- @ivar slidermax: The maximum value for the action slider.
- Value is clamped to the range [-10.0,10.0].
- @type slidermax: float
- @ivar vgroup: The assigned VGroup for the Key Block.
- @type vgroup: string
- @ivar data: The data of the KeyBlock (see L{getData}). This
- attribute is read-only.
- @type data: varies
- """
-
- def getData():
- """
- Get the data of a KeyBlock, as a list of data items. Each item
- will have a different data format depending on the type of this
- Key.
-
- Note that prior to 2.45 the behaviour of this function
- was different (and very wrong). Old scripts might need to be
- updated.
-
- - Mesh keys have a list of L{Vectors<Mathutils.Vector>} objects in the data
- block.
- - Lattice keys have a list of L{Vectors<Mathutils.Vector>} objects in the data
- block.
- - Curve keys return either a list of tuples, eacn containing
- four L{Vectors<Mathutils.Vector>} (if the curve is a Bezier curve),
- or otherwise just a list of L{Vectors<Mathutils.Vector>}.
-
- For bezier keys, the first three vectors in the tuple are the Bezier
- triple vectors, while the fourth vector's first element is the curve tilt
- (the other two elements are reserved and are currently unused).
-
- For non-Bezier keys, the first three elements of the returned vector is
- the curve handle point, while the fourth element is the tilt.
-
-
- A word on relative shape keys; relative shape keys are not actually
- stored as offsets to the base shape key (like you'd expect). Instead,
- each shape key stores an entire model (actually the state of the mesh
- vertices after exiting editmode with any given key active).
-
- The additive offset for a shape key is calculated (when needed) by
- comparing the shape key with its base key, which is always the very
- first in the keyblock list.
- """
-
diff --git a/source/blender/python/api2_2x/doc/Lamp.py b/source/blender/python/api2_2x/doc/Lamp.py
deleted file mode 100644
index b65fe253530..00000000000
--- a/source/blender/python/api2_2x/doc/Lamp.py
+++ /dev/null
@@ -1,521 +0,0 @@
-# Blender.Lamp module and the Lamp PyType object
-
-"""
-The Blender.Lamp submodule.
-
-B{New}: L{Lamp.clearScriptLinks} accepts a parameter now.
-
-Lamp Data
-=========
-
-This module provides control over B{Lamp Data} objects in Blender.
-
-Example::
-
- from Blender import Lamp, Scene
- l = Lamp.New('Spot') # create new 'Spot' lamp data
- l.setMode('Square', 'Shadow') # set these two lamp mode flags
- scn = Scene.GetCurrent()
- ob = scn.objects.new(l)
-
-@type Types: read-only dictionary
-@var Types: The lamp types.
- - 'Lamp': 0
- - 'Sun' : 1
- - 'Spot': 2
- - 'Hemi': 3
- - 'Area': 4
- - 'Photon': 5
-@type Modes: read-only dictionary
-@var Modes: The lamp modes. Modes may be ORed together.
- - 'Shadows'
- - 'Halo'
- - 'Layer'
- - 'Quad'
- - 'Negative'
- - 'OnlyShadow'
- - 'Sphere'
- - 'Square'
- - 'NoDiffuse'
- - 'NoSpecular'
- - 'RayShadow'
-
- Example::
- from Blender import Lamp, Object
- # Change the mode of selected lamp objects.
- for ob in Object.GetSelected(): # Loop through the current selection
- if ob.getType() == "Lamp": # if this is a lamp.
- lamp = ob.getData() # get the lamp data.
- if lamp.type == Lamp.Types["Spot"]: # Lamp type is not a flag
- lamp.mode &= ~Lamp.Modes["RayShadow"] # Disable RayShadow.
- lamp.mode |= Lamp.Modes["Shadows"] # Enable Shadowbuffer shadows
-"""
-
-def New (type = 'Lamp', name = 'LampData'):
- """
- Create a new Lamp Data object.
- @type type: string
- @param type: The Lamp type: 'Lamp', 'Sun', 'Spot', 'Hemi', 'Area', or 'Photon'.
- @type name: string
- @param name: The Lamp Data name.
- @rtype: Blender Lamp
- @return: The created Lamp Data object.
- """
-
-def Get (name = None):
- """
- Get the Lamp Data object(s) from Blender.
- @type name: string
- @param name: The name of the Lamp Data.
- @rtype: Blender Lamp or a list of Blender Lamps
- @return: It depends on the I{name} parameter:
- - (name): The Lamp Data object with the given I{name};
- - (): A list with all Lamp Data objects in the current scene.
- """
-
-class Lamp:
- """
- The Lamp Data object
- ====================
- This object gives access to Lamp-specific data in Blender.
-
- @ivar B: Lamp color blue component.
- Value is clamped to the range [0.0,1.0].
- @type B: float
- @ivar G: Lamp color green component.
- Value is clamped to the range [0.0,1.0].
- @type G: float
- @ivar R: Lamp color red component.
- Value is clamped to the range [0.0,1.0].
- @type R: float
- @ivar bias: Lamp shadow map sampling bias.
- Value is clamped to the range [0.01,5.0].
- @type bias: float
- @ivar bufferSize: Lamp shadow buffer size.
- Value is clamped to the range [512,5120].
- @type bufferSize: int
- @ivar clipEnd: Lamp shadow map clip end.
- Value is clamped to the range [1.0,5000.0].
- @type clipEnd: float
- @ivar clipStart: Lamp shadow map clip start.
- Value is clamped to the range [0.1,1000.0].
- @type clipStart: float
- @ivar col: Lamp RGB color triplet.
- Components are clamped to the range [0.0,1.0].
- @type col: RGB tuple
- @ivar dist: Lamp clipping distance.
- Value is clamped to the range [0.1,5000.0].
- @type dist: float
- @ivar energy: Lamp light intensity.
- Value is clamped to the range [0.0,10.0].
- @type energy: float
- @ivar haloInt: Lamp spotlight halo intensity.
- Value is clamped to the range [0.0,5.0].
- @type haloInt: float
- @ivar haloStep: Lamp volumetric halo sampling frequency.
- Value is clamped to the range [0,12].
- @type haloStep: int
- @ivar ipo: Lamp Ipo.
- Contains the Ipo if one is assigned to the object, B{None} otherwise. Setting to B{None} clears the current Ipo..
- @type ipo: Blender Ipo
- @ivar mode: Lamp mode bitfield. See L{Modes} for values.
- @type mode: int
- @ivar quad1: Quad lamp linear distance attenuation.
- Value is clamped to the range [0.0,1.0].
- @type quad1: float
- @ivar quad2: Quad lamp quadratic distance attenuation.
- Value is clamped to the range [0.0,1.0].
- @type quad2: float
- @ivar samples: Lamp shadow map samples.
- Value is clamped to the range [1,16].
- @type samples: int
- @ivar raySamplesX: Lamp raytracing X samples (X is used for the Y axis with square area lamps).
- Value is clamped to the range [1,16].
- @type raySamplesX: int
- @ivar raySamplesY: Lamp raytracing Y samples (Y is only used for rectangle area lamps).
- Value is clamped to the range [1,16].
- @type raySamplesY: int
- @ivar areaSizeX: Lamp X size (X is used for the Y axis with square area lamps)
- Value is clamped to the range [0.01,100.0].
- @type areaSizeX: float
- @ivar areaSizeY: Lamp Y size (Y is only used for rectangle area lamps).
- Value is clamped to the range [0.01,100.0].
- @type areaSizeY: float
- @ivar softness: Lamp shadow sample area size.
- Value is clamped to the range [1.0,100.0].
- @type softness: float
- @ivar spotBlend: Lamp spotlight edge softness.
- Value is clamped to the range [0.0,1.0].
- @type spotBlend: float
- @ivar spotSize: Lamp spotlight beam angle (in degrees).
- Value is clamped to the range [1.0,180.0].
- @type spotSize: float
- @ivar type: Lamp type. See L{Types} for values.
- @type type: int
-
- @warning: Most member variables assume values in some [Min, Max] interval.
- When trying to set them, the given parameter will be clamped to lie in
- that range: if val < Min, then val = Min, if val > Max, then val = Max.
- """
-
- def getName():
- """
- Get the name of this Lamp Data object.
- @rtype: string
- """
-
- def setName(name):
- """
- Set the name of this Lamp Data object.
- @type name: string
- @param name: The new name.
- """
-
- def getType():
- """
- Get this Lamp's type.
- @rtype: int
- """
-
- def setType(type):
- """
- Set this Lamp's type.
- @type type: string
- @param type: The Lamp type: 'Lamp', 'Sun', 'Spot', 'Hemi', 'Area', or 'Photon'
- """
-
- def getMode():
- """
- Get this Lamp's mode flags.
- @rtype: int
- @return: B{OR'ed value}. Use the Modes dictionary to check which flags
- are 'on'.
-
- Example::
- flags = mylamp.getMode()
- if flags & mylamp.Modes['Shadows']:
- print "This lamp produces shadows"
- else:
- print "The 'Shadows' flag is off"
- """
-
- def setMode(m = None, m2 = None, m3 = None, m4 = None,
- m5 = None, m6 = None, m7 = None, m8 = None):
- """
- Set this Lamp's mode flags. Mode strings given are turned 'on'.
- Those not provided are turned 'off', so lamp.setMode() -- without
- arguments -- turns off all mode flags for Lamp lamp.
- @type m: string
- @param m: A mode flag. From 1 to 8 can be set at the same time.
- """
-
- def getSamples():
- """
- Get this lamp's samples value.
- @rtype: int
- """
-
- def setSamples(samples):
- """
- Set the samples value.
- @type samples: int
- @param samples: The new samples value.
- """
-
- def getRaySamplesX():
- """
- Get this lamp's raytracing sample value on the X axis.
- This value is only used for area lamps.
- @rtype: int
- """
-
- def setRaySamplesX():
- """
- Set the lamp's raytracing sample value on the X axis, between 1 and 16.
- This value is only used for area lamps.
- @rtype: int
- """
-
- def getRaySamplesY():
- """
- Get this lamp's raytracing sample value on the Y axis.
- This value is only used for rectangle area lamps.
- @rtype: int
- """
-
- def setRaySamplesY():
- """
- Set the lamp's raytracing sample value on the Y axis, between 1 and 16.
- This value is only used for rectangle area lamps.
- @rtype: int
- """
-
- def getAreaSizeX():
- """
- Get this lamp's size on the X axis.
- This value is only used for area lamps.
- @rtype: int
- """
-
- def setAreaSizeX():
- """
- Set this lamp's size on the X axis.
- This value is only used for area lamps.
- @rtype: int
- """
-
- def getAreaSizeY():
- """
- Get this lamp's size on the Y axis.
- This value is only used for rectangle area lamps.
- @rtype: int
- """
-
- def setAreaSizeY():
- """
- Set this lamp's size on the Y axis.
- This value is only used for rectangle area lamps.
- @rtype: int
- """
-
- def getBufferSize():
- """
- Get this lamp's buffer size.
- @rtype: int
- """
-
- def setBufferSize(bufsize):
- """
- Set the buffer size value.
- @type bufsize: int
- @param bufsize: The new buffer size value.
- """
-
- def getHaloStep():
- """
- Get this lamp's halo step value.
- @rtype: int
- """
-
- def setHaloStep(hastep):
- """
- Set the halo step value.
- @type hastep: int
- @param hastep: The new halo step value.
- """
-
- def getEnergy():
- """
- Get this lamp's energy intensity value.
- @rtype: float
- """
-
- def setEnergy(energy):
- """
- Set the energy intensity value.
- @type energy: float
- @param energy: The new energy value.
- """
-
- def getDist():
- """
- Get this lamp's distance value.
- @rtype: float
- """
-
- def setDist(distance):
- """
- Set the distance value.
- @type distance: float
- @param distance: The new distance value.
- """
-
- def getSpotSize():
- """
- Get this lamp's spot size value.
- @rtype: float
- """
-
- def setSpotSize(spotsize):
- """
- Set the spot size value.
- @type spotsize: float
- @param spotsize: The new spot size value.
- """
-
- def getSpotBlend():
- """
- Get this lamp's spot blend value.
- @rtype: float
- """
-
- def setSpotBlend(spotblend):
- """
- Set the spot blend value.
- @type spotblend: float
- @param spotblend: The new spot blend value.
- """
-
- def getClipStart():
- """
- Get this lamp's clip start value.
- @rtype: float
- """
-
- def setClipStart(clipstart):
- """
- Set the clip start value.
- @type clipstart: float
- @param clipstart: The new clip start value.
- """
-
- def getClipEnd():
- """
- Get this lamp's clip end value.
- @rtype: float
- """
-
- def setClipEnd(clipend):
- """
- Set the clip end value.
- @type clipend: float
- @param clipend: The new clip end value.
- """
-
- def getBias():
- """
- Get this lamp's bias value.
- @rtype: float
- """
-
- def setBias(bias):
- """
- Set the bias value.
- @type bias: float
- @param bias: The new bias value.
- """
-
- def getSoftness():
- """
- Get this lamp's softness value.
- @rtype: float
- """
-
- def setSoftness(softness):
- """
- Set the softness value.
- @type softness: float
- @param softness: The new softness value.
- """
-
- def getHaloInt():
- """
- Get this lamp's halo intensity value.
- @rtype: float
- """
-
- def setHaloInt(haloint):
- """
- Set the halo intensity value.
- @type haloint: float
- @param haloint: The new halo intensity value.
- """
-
- def getQuad1():
- """
- Get this lamp's quad 1 value.
- @rtype: float
- @warning: this only applies to Lamps with the 'Quad' flag on.
- """
-
- def setQuad1(quad1):
- """
- Set the quad 1 value.
- @type quad1: float
- @warning: this only applies to Lamps with the 'Quad' flag on.
- """
-
- def getQuad2():
- """
- Get this lamp's quad 2 value.
- @rtype: float
- @warning: this only applies to Lamps with the 'Quad' flag on.
- """
-
- def setQuad2(quad2):
- """
- Set the quad 2 value.
- @type quad2: float
- @param quad2: The new quad 2 value.
- @warning: this only applies to Lamps with the 'Quad' flag on.
- """
-
- def getScriptLinks (event):
- """
- Get a list with this Lamp's script links of type 'event'.
- @type event: string
- @param event: "FrameChanged", "Redraw" or "Render".
- @rtype: list
- @return: a list with Blender L{Text} names (the script links of the given
- 'event' type) or None if there are no script links at all.
- """
-
- def clearScriptLinks (links = None):
- """
- Delete script links from this Lamp. If no list is specified, all
- script links are deleted.
- @type links: list of strings
- @param links: None (default) or a list of Blender L{Text} names.
- """
-
- def addScriptLink (text, event):
- """
- Add a new script link to this Lamp.
- @type text: string
- @param text: the name of an existing Blender L{Text}.
- @type event: string
- @param event: "FrameChanged", "Redraw" or "Render".
- """
-
- def getIpo():
- """
- Get the Ipo associated with this Lamp object, if any.
- @rtype: Ipo
- @return: the wrapped ipo or None.
- """
-
- def setIpo(ipo):
- """
- Link an ipo to this Lamp object.
- @type ipo: Blender Ipo
- @param ipo: a "lamp data" ipo.
- """
-
- def clearIpo():
- """
- Unlink the ipo from this Lamp object.
- @return: True if there was an ipo linked or False otherwise.
- """
-
- def insertIpoKey(keytype):
- """
- Inserts keytype values in lamp ipo at curframe. Uses module constants.
- @type keytype: Integer
- @param keytype:
- -RGB
- -ENERGY
- -SPOTSIZE
- -OFFSET
- -SIZE
- @return: None
- """
-
- def __copy__ ():
- """
- Make a copy of this lamp
- @rtype: Lamp
- @return: a copy of this lamp
- """
-
-import id_generics
-Lamp.__doc__ += id_generics.attributes
diff --git a/source/blender/python/api2_2x/doc/Lattice.py b/source/blender/python/api2_2x/doc/Lattice.py
deleted file mode 100644
index 8666254ec0d..00000000000
--- a/source/blender/python/api2_2x/doc/Lattice.py
+++ /dev/null
@@ -1,209 +0,0 @@
-# Blender.Lattice module and the Lattice PyType object
-
-"""
-The Blender.Lattice submodule.
-
-Lattice Object
-==============
-
-This module provides access to B{Lattice} object in Blender.
-
-Example::
- import Blender
- from Blender import Lattice, Object, Scene, Modifier
-
- # Make new lattice data
- lattice_data = Lattice.New()
- lattice_data.setPartitions(5,5,5)
- lattice_data.setKeyTypes(Lattice.LINEAR, Lattice.CARDINAL, Lattice.BSPLINE)
- lattice_data.setMode(Lattice.OUTSIDE)
-
- for y in range(125):
- vec = lattice_data.getPoint(y)
- co1 = vec[0] + vec[0] / 5
- co2 = vec[1] - vec[2] * 0.3
- co3 = vec[2] * 3
- lattice_data.setPoint(y,[co1,co2,co3])
-
- # Create a new object from the lattice in the current scene
- scn = Scene.GetCurrent()
- ob_lattice = scn.objects.new(lattice_data)
-
- # Get an object to deform with this lattice
- mySphere = Object.Get('Sphere')
-
- # Apply lattice modifier
- mod= mySphere.modifiers.append(Modifier.Type.LATTICE)
- mod[Modifier.Settings.OBJECT] = ob_lattice
- mySphere.makeDisplayList()
-
- Blender.Redraw()
-"""
-
-def New (name = None):
- """
- Create a new Lattice object.
- Passing a name to this function will name the Lattice
- datablock, otherwise the Lattice data will be given a
- default name.
- @type name: string
- @param name: The Lattice name.
- @rtype: Blender Lattice
- @return: The created Lattice Data object.
- """
-
-def Get (name = None):
- """
- Get the Lattice object(s) from Blender.
- @type name: string
- @param name: The name of the Lattice object.
- @rtype: Blender Lattice or a list of Blender Lattices
- @return: It depends on the 'name' parameter:
- - (name): The Lattice object with the given name;
- - (): A list with all Lattice objects in the current scene.
- """
-
-class Lattice:
- """
- The Lattice object
- ==================
- This object gives access to Lattices in Blender.
- @ivar width: The number of x dimension partitions.
- @ivar height: The number of y dimension partitions.
- @ivar depth: The number of z dimension partitions.
- @ivar widthType: The x dimension key type.
- @ivar heightType: The y dimension key type.
- @ivar depthType: The z dimension key type.
- @ivar mode: The current mode of the Lattice.
- @ivar latSize: The number of points in this Lattice (width*height*depth).
- @cvar key: The L{Key.Key} object associated with this Lattice or None.
- """
-
- def getName():
- """
- Get the name of this Lattice datablock.
- @rtype: string
- @return: The name of the Lattice datablock.
- """
-
- def setName(name):
- """
- Set the name of this Lattice datablock.
- @type name: string
- @param name: The new name.
- """
-
- def getPartitions():
- """
- Gets the number of 'walls' or partitions that the Lattice has
- in the x, y, and z dimensions.
- @rtype: list of ints
- @return: A list corresponding to the number of partitions: [x,y,z]
- """
-
- def setPartitions(x,y,z):
- """
- Set the number of 'walls' or partitions that the
- Lattice will be created with in the x, y, and z dimensions.
- @type x: int
- @param x: The number of partitions in the x dimension of the Lattice.
- @type y: int
- @param y: The number of partitions in the y dimension of the Lattice.
- @type z: int
- @param z: The number of partitions in the z dimension of the Lattice.
- """
-
- def getKeyTypes():
- """
- Returns the deformation key types for the x, y, and z dimensions of the
- Lattice.
- @rtype: list of strings
- @return: A list corresponding to the key types will be returned: [x,y,z]
- """
-
- def setKeyTypes(xType,yType,zType):
- """
- Sets the deformation key types for the x, y, and z dimensions of the
- Lattice.
- There are three key types possible:
- - Lattice.CARDINAL
- - Lattice.LINEAR
- - Lattice.BSPLINE
- @type xType: enum constant
- @param xType: the deformation key type for the x dimension of the Lattice
- @type yType: enum constant
- @param yType: the deformation key type for the y dimension of the Lattice
- @type zType: enum constant
- @param zType: the deformation key type for the z dimension of the Lattice
- """
-
- def getMode():
- """
- Returns the current Lattice mode
- @rtype: string
- @return: A string representing the current Lattice mode
- """
-
- def setMode(modeType):
- """
- Sets the current Lattice mode
- There are two Lattice modes possible:
- - Lattice.GRID
- - Lattice.OUTSIDE
- @type modeType: enum constant
- @param modeType: the Lattice mode
- """
-
- def getPoint(index):
- """
- Returns the coordinates of a point in the Lattice by index.
- @type index: int
- @param index: The index of the point on the Lattice you want returned
- @rtype: list of floats
- @return: The x,y,z coordiates of the Lattice point : [x,y,z]
- """
-
- def setPoint(index, position):
- """
- Sets the coordinates of a point in the Lattice by index.
- @type index: int
- @param index: The index of the point on the Lattice you want set
- @type position: list of floats
- @param position: The x,y,z coordinates that you want the point to be: [x,y,z]
- """
-
- def getKey():
- """
- Returns the L{Key.Key} object associated with this Lattice.
- @rtype: L{Key.Key}
- @return: A key object representing the keyframes of the lattice or None.
- """
-
- def insertKey(frame):
- """
- Inserts the current state of the Lattice as a new absolute keyframe
-
- B{Example}::
- for z in range(5):
- for y in range(125):
- vec = myLat.getPoint(y)
- co1 = vec[0] + vec[2]
- co2 = vec[1] - vec[2]
- co3 = vec[2] + vec[1]
- myLat.setPoint(y,[co1,co2,co3])
- w = (z + 1) * 10
- myLat.insertKey(w)
-
- @type frame: int
- @param frame: the frame at which the Lattice will be set as a keyframe
- """
-
- def __copy__ ():
- """
- Make a copy of this lattice
- @rtype: Lattice
- @return: a copy of this lattice
- """
-
-import id_generics
-Lattice.__doc__ += id_generics.attributes
diff --git a/source/blender/python/api2_2x/doc/LibData.py b/source/blender/python/api2_2x/doc/LibData.py
deleted file mode 100644
index 7884ea50659..00000000000
--- a/source/blender/python/api2_2x/doc/LibData.py
+++ /dev/null
@@ -1,137 +0,0 @@
-# bpy.lib submodule
-
-"""
-The bpy.libraries submodule.
-
-Libraries
-=========
-
-This module provides access to objects stored in .blend files. With it scripts
-can append from Blender files to the current scene, like the File->Append
-menu entry in Blender does. It allows programmers to use .blend files as
-data files for their scripts.
-
-@warn: This module is new and being considered as a replacement for the
-L{original Library<Library>} module. Users should stay tuned to see
-which module is supported in the end.
-
-Example::
- import bpy
-
- scn= bpy.scenes.active # get current scene
- lib = bpy.libraries.load('//file.blend') # open file.blend
- ob = scn.objects.link(lib.objects.append('Cube')) # append Cube object from library to current scene
- mat = lib.objects.link('Material') # get a link to a material
- me = ob.getData(mesh=1) # get mesh data
- me.materials[0] = mat # assign linked material to mesh
-"""
-
-def load(filename):
- """
- Select an existing .blend file for use as a library. Unlike the
- Library module, multiple libraries can be defined at the same time.
-
- @type filename: string
- @param filename: The filename of a Blender file. Filenames starting with "//" will be loaded relative to the blend file's location.
- @rtype: Library
- @return: return a L{Library} object.
- """
-
-class Libraries:
- """
- The Library object
- ==================
- This class provides a unified way to access and manipulate library types
- in Blender.
- It provides access to scenes, objects, meshes, curves, metaballs,
- materials, textures, images, lattices, lamps, cameras, ipos, worlds,
- fonts, texts, sounds, groups, armatures, and actions.
- @ivar filename: The path to the library
- @type filename: string
- @ivar scenes: library L{scene<Scene.Scene>} data
- @type scenes: L{LibData}
- @ivar objects: library L{object<Object.Object>} data
- @type objects: L{LibData}
- @ivar meshes: library L{mesh<Mesh.Mesh>} data
- @type meshes: L{LibData}
- @ivar curves: library L{curve<Curve.Curve>} data
- @type curves: L{LibData}
- @ivar metaballs: library L{metaball<Metaball.Metaball>} data
- @type metaballs: L{LibData}
- @ivar materials: library L{material<Material.Material>} data
- @type materials: L{LibData}
- @ivar textures: library L{texture<Texture.Texture>} data
- @type textures: L{LibData}
- @ivar images: library L{image<Image.Image>} data
- @type images: L{LibData}
- @ivar lattices: library L{lattice<Lattice.Lattice>} data
- @type lattices: L{LibData}
- @ivar lamps: library L{lamp<Lamp.Lamp>} data
- @type lamps: L{LibData}
- @ivar cameras: library L{camera<Camera.Camera>} data
- @type cameras: L{LibData}
- @ivar ipos: library L{ipo<Ipo.Ipo>} data
- @type ipos: L{LibData}
- @ivar worlds: library L{world<World.World>} data
- @type worlds: L{LibData}
- @ivar fonts: library L{font<Font.Font>} data
- @type fonts: L{LibData}
- @ivar texts: library L{text<Text.Text>} data
- @type texts: L{LibData}
- @ivar sounds: library L{sound<Sound.Sound>} data
- @type sounds: L{LibData}
- @ivar groups: library L{group<Group.Group>} data
- @type groups: L{LibData}
- @ivar armatures: library L{armature<Armature.Armature>} data
- @type armatures: L{LibData}
- @ivar actions: library L{action<NLA.Action>} data
- @type actions: L{LibData}
- """
-
-class LibData:
- """
- Generic Library Data Access
- ===========================
- This class provides access to a specific type of library data.
- """
-
- def append(name):
- """
- Append a new datablock from a library. The new copy
- is added to the current .blend file.
-
- B{Note}: Blender Objects cannot be appended or linked without linking
- them to a scene. For this reason, lib.objects.append() returns a
- special "wrapper object" which must be passed to Scene.objects.link()
- or bpy.scenes.active.link() in order to actually create the object.
- So the following code will not create a new object::
- import bpy
-
- scn= bpy.scenes.active # get current scene
- lib = bpy.libraries.load('//file.blend') # open file.blend
- pseudoOb = lib.objects.append('Cube')) # get an object wrapper
- But this code will::
- import bpy
-
- scn= bpy.scenes.active # get current scene
- lib = bpy.libraries.load('//file.blend') # open file.blend
- pseudoOb = lib.objects.append('Cube')) # get an object wrapper
- ob = scn.objects.link(pseudoOb) # link to scene
- @rtype: Blender data
- @return: return a Blender datablock or object
- @raise IOError: library cannot be read
- @raise ValueError: library does not contain B{name}
- """
-
- def link(name):
- """
- Link a new datablock from a library. The linked data is not copied
- into the local .blend file.
-
- See L{append} for notes on special handling of Blender Objects.
- @rtype: Blender data
- @return: return a Blender datablock or object
- @raise IOError: library cannot be read
- @raise ValueError: library does not contain B{name}
- """
-
diff --git a/source/blender/python/api2_2x/doc/Library.py b/source/blender/python/api2_2x/doc/Library.py
deleted file mode 100644
index c99739d939b..00000000000
--- a/source/blender/python/api2_2x/doc/Library.py
+++ /dev/null
@@ -1,114 +0,0 @@
-# Blender.Library submodule
-
-"""
-The Blender.Library submodule.
-
-Library
-=======
-
-This module provides access to objects stored in .blend files. With it scripts
-can append from Blender files to the current scene, like the File->Append
-menu entry in Blender does. It allows programmers to use .blend files as
-data files for their scripts.
-
-@warn: This module is being considered for deprecation. Users should
-consider using the L{new Library<LibData>} module and stay tuned to see
-which module is supported in the end.
-
-Example::
- import Blender
- from Blender import Library
-
- def f(name):
- open_library(name)
-
- def open_library(name):
- Library.Open(name)
- groups = Library.LinkableGroups()
-
- for db in groups:
- print "DATABLOCK %s:" % db
- for obname in Library.Datablocks(db):
- print obname
-
- if 'Object' in groups:
- for obname in Library.Datablocks('Object'):
- Library.Load(obname, 'Object', 0) # note the 0...
- Library.Update()
-
- Library.Close()
- b.Redraw()
-
- b.Window.FileSelector(f, "Choose Library", "*.blend")
-
-"""
-
-def Open (filename):
- """
- Open an existing .blend file. If there was already one open file, it is
- closed first.
- @type filename: string
- @param filename: The filename of a Blender file. Filenames starting with "//" will be loaded relative to the blend file's location.
- @rtype: bool
- @return: 1 if successful. An IOError exception is thrown if the file cannot be opened.
- """
-
-def Close ():
- """
- Close the currently open library file, if any.
- """
-
-def getName ():
- """
- Get the filename of the currently open library file.
- @rtype: string
- @return: The open library filename.
- """
-
-def LinkableGroups ():
- """
- Get all the linkable group names from the currently open library file. These
- are the available groups for linking with the current scene. Ex: 'Object',
- 'Mesh', 'Material', 'Text', etc.
- @rtype: list of strings
- @return: the list of linkable groups.
- """
-
-def Datablocks (group):
- """
- Get all datablock objects of the given 'group' available in the currently
- open library file.
- @type group: string
- @param group: datablock group, see L{LinkableGroups}.
- """
-
-def Load (datablock, group, update = 1, linked = 0):
- """
- Load the given datablock object from the current library file
- @type datablock: string
- @type group: string
- @type update: bool
- @type linked: bool
- @param datablock: an available object name, as returned by L{Datablocks}.
- @param group: an available group name, as returned by L{LinkableGroups}.
- @param update: defines if Blender should be updated after loading this
- object. This means linking all objects and remaking all display lists,
- so it is potentially very slow.
- @param linked: Will keep objects linked to their source blend file, the update option or later updating will unlink the data from the original blend and make it local.
-
- @warn: If you plan to load more than one object in sequence, it is
- B{definitely recommended} to set 'update' to 0 in all calls to this
- function and after them call L{Update}.
- """
-
-def Update ():
- """
- Update all links and display lists in Blender. This function should be
- called after a series of L{Load}(datablock, group, B{0}) calls to make
- everything behave nicely.
- @warn: to use this function, remember to set the third L{Load} parameter to
- zero or each loading will automatically update Blender, which will slow
- down your script and make you look like a lousy programmer.
- Enough warnings :)?
- """
-
diff --git a/source/blender/python/api2_2x/doc/Material.py b/source/blender/python/api2_2x/doc/Material.py
deleted file mode 100644
index 40207dd92c0..00000000000
--- a/source/blender/python/api2_2x/doc/Material.py
+++ /dev/null
@@ -1,1061 +0,0 @@
-# Blender.Material module and the Material PyObject
-
-"""
-The Blender.Material submodule.
-
-B{New}: access to shader data.
-
-Material
-========
-
-This module provides access to B{Material} objects in Blender.
-
-Example::
- import Blender
- from Blender import Material
- mat = Material.New('newMat') # create a new Material called 'newMat'
- print mat.rgbCol # print its rgb color triplet sequence
- mat.rgbCol = [0.8, 0.2, 0.2] # change its color
- mat.setAlpha(0.2) # mat.alpha = 0.2 -- almost transparent
- mat.emit = 0.7 # equivalent to mat.setEmit(0.8)
- mat.mode |= Material.Modes.ZTRANSP # turn on Z-Buffer transparency
- mat.setName('RedBansheeSkin') # change its name
- mat.setAdd(0.8) # make it glow
- mat.setMode('Halo') # turn 'Halo' "on" and all others "off"
-
-@type Modes: readonly dictionary
-@var Modes: The available Material Modes.
-
- B{Note}: Some Modes are only available when the 'Halo' mode is I{off} and
- others only when it is I{on}. But these two subsets of modes share the same
- numerical values in their Blender C #defines. So, for example, if 'Halo' is
- on, then 'NoMist' is actually interpreted as 'HaloShaded'. We marked all
- such possibilities in the Modes dict below: each halo-related mode that
- uses an already taken value is preceded by "+" and appear below the normal
- mode which also uses that value.
-
- - TRACEABLE - Make Material visible for shadow lamps.
- - SHADOW - Enable Material for shadows.
- - SHADOWBUF - Enable Material to cast shadows with shadow buffers.
- - SHADELESS - Make Material insensitive to light or shadow.
- - WIRE - Render only the edges of faces.
- - VCOL_LIGHT - Add vertex colors as extra light.
- - VCOL_PAINT - Replace basic colors with vertex colors.
- - HALO - Render as a halo.
- - ZTRANSP - Z-buffer transparent faces.
- - ZINVERT - Render with inverted Z-buffer.
- - + HALORINGS - Render rings over the basic halo.
- - ENV - Do not render Material.
- - + HALOLINES - Render star shaped lines over the basic halo.
- - ONLYSHADOW - Let alpha be determined on the degree of shadow.
- - + HALOXALPHA - Use extreme alpha.
- - TEXFACE - UV-Editor assigned texture gives color and texture info for faces.
- - + HALOSTAR - Render halo as a star.
- - NOMIST - Set the Material insensitive to mist.
- - + HALOSHADED - Let halo receive light.
- - HALOTEX - Give halo a texture.
- - HALOPUNO - Use the vertex normal to specify the dimension of the halo.
- - HALOFLARE - Render halo as a lens flare.
- - RAYMIRROR - Enables raytracing for mirror reflection rendering.
- - RAYTRANSP - Enables raytracing for transparency rendering.
- - RAYBIAS - Prevent ray traced shadow errors with Phong interpolated normals.
- - RAMPCOL - Status of colorband ramp for Material's diffuse color. This is a read-only bit.
- - RAMPSPEC - Status of colorband ramp for Material's specular color. This is a read-only bit.
- - TANGENTSTR - Uses direction of strands as normal for tangent-shading.
- - TRANSPSHADOW - Lets Material receive transparent shadows based on material color and alpha.
- - FULLOSA - Force rendering of all OSA samples.
- - TANGENT_V - Use the tangent vector in V direction for shading
- - NMAP_TS - Tangent space normal mapping.
- - GROUP_EXCLUSIVE - Light from this group even if the lights are on a hidden Layer.
-
-@type Shaders: readonly dictionary
-@var Shaders: The available Material Shaders.
- - DIFFUSE_LAMBERT - Make Material use the lambert diffuse shader.
- - DIFFUSE_ORENNAYAR - Make Material use the Oren-Nayer diffuse shader.
- - DIFFUSE_TOON - Make Material use the toon diffuse shader.
- - DIFFUSE_MINNAERT - Make Material use the minnaert diffuse shader.
- - SPEC_COOKTORR - Make Material use the Cook-Torr specular shader.
- - SPEC_PHONG - Make Material use the Phong specular shader.
- - SPEC_BLINN - Make Material use the Blinn specular shader.
- - SPEC_TOON - Make Material use the toon specular shader.
- - SPEC_WARDISO - Make Material use the Ward-iso specular shader.
-"""
-
-def New (name = 'Mat'):
- """
- Create a new Material object.
- @type name: string
- @param name: The Material name.
- @rtype: Blender Material
- @return: The created Material object.
- """
-
-def Get (name = None):
- """
- Get the Material object(s) from Blender.
- @type name: string
- @param name: The name of the Material.
- @rtype: Blender Material or a list of Blender Materials
- @return: It depends on the 'name' parameter:
- - (name): The Material object with the given name;
- - (): A list with all Material objects in the current scene.
- """
-
-class Material:
- """
- The Material object
- ===================
- This object gives access to Materials in Blender.
- @ivar B: Diffuse color (L{rgbCol}) blue component.
- Value is clamped to the range [0.0,1.0].
- @type B: float
- @ivar G: Diffuse color (L{rgbCol}) green component.
- Value is clamped to the range [0.0,1.0].
- @type G: float
- @ivar IOR: Angular index of refraction for raytrace.
- Value is clamped to the range [1.0,3.0].
- @type IOR: float
- @ivar R: Diffuse color (L{rgbCol}) red component.
- Value is clamped to the range [0.0,1.0].
- @type R: float
- @ivar add: Strength of the add effect.
- Value is clamped to the range [0.0,1.0].
- @type add: float
- @ivar alpha: Alpha (translucency) component of the material.
- Value is clamped to the range [0.0,1.0].
- @type alpha: float
- @ivar shadAlpha: Shadow Alpha for irregular shadow buffer.
- Value is clamped to the range [0.0,1.0].
- @type shadAlpha: float
- @ivar amb: Amount of global ambient color material receives.
- Value is clamped to the range [0.0,1.0].
- @type amb: float
- @ivar diffuseDarkness: Material's diffuse darkness ("Minnaert" diffuse shader only).
- Value is clamped to the range [0.0,2.0].
- @type diffuseDarkness: float
- @ivar diffuseShader: Diffuse shader type (see L{Shaders}).
- Value must be in the range [0,3].
- @type diffuseShader: int
- @ivar diffuseSize: Material's diffuse area size ("Toon" diffuse shader only).
- Value is clamped to the range [0.0,3.14].
- @type diffuseSize: float
- @ivar diffuseSmooth: Material's diffuse area smoothing ("Toon" diffuse shader only).
- Value is clamped to the range [0.0,1.0].
- @type diffuseSmooth: float
- @ivar emit: Amount of light the material emits.
- Value is clamped to the range [0.0,1.0].
- @type emit: float
- @ivar filter: Amount of filtering when transparent raytrace is enabled.
- Value is clamped to the range [0.0,1.0].
- @type filter: float
- @ivar flareBoost: Flare's extra strength.
- Value is clamped to the range [0.1,1.0].
- @type flareBoost: float
- @ivar flareSeed: Offset in the flare seed table.
- Value is clamped to the range [1,255].
- @type flareSeed: int
- @ivar flareSize: Ratio of flare size to halo size.
- Value is clamped to the range [0.1,25.0].
- @type flareSize: float
- @ivar fresnelDepth: Power of Fresnel for mirror reflection.
- Value is clamped to the range [0.0,5.0].
- @type fresnelDepth: float
- @ivar fresnelDepthFac: Blending factor for Fresnel mirror.
- Value is clamped to the range [1.0,5.0].
- @type fresnelDepthFac: float
- @ivar fresnelTrans: Power of Fresnel for transparency.
- Value is clamped to the range [0.0,5.0].
- @type fresnelTrans: float
- @ivar fresnelTransFac: Blending factor for Fresnel transparency.
- Value is clamped to the range [1.0,5.0].
- @type fresnelTransFac: float
- @ivar rbFriction: Rigid Body Friction coefficient.
- Value is clamped to the range [0.0,100.0].
- @type rbFriction: float
- @ivar rbRestitution: Rigid Body Friction restitution.
- Value is clamped to the range [0.0,1.0].
- @type rbRestitution: float
- @ivar haloSeed: Randomizes halo ring dimension and line location.
- Value is clamped to the range [1,255].
- @type haloSeed: int
- @ivar haloSize: Dimension of the halo.
- Value is clamped to the range [0.0,100.0].
- @type haloSize: float
- @ivar hard: Hardness of the specularity.
- Value is clamped to the range [1,255].
- @type hard: int
- @ivar ipo: Material Ipo data.
- Contains the Ipo if one is assigned to the object, None otherwise. Setting to None clears the current Ipo.
- @type ipo: Blender Ipo
-
- @ivar mirCol: Mirror RGB color triplet.
- Components are clamped to the range [0.0,1.0].
- @type mirCol: list of 3 floats
- @ivar mirB: Mirror color (L{mirCol}) blue component.
- Value is clamped to the range [0.0,1.0].
- @type mirB: float
- @ivar mirG: Mirror color (L{mirCol}) green component.
- Value is clamped to the range [0.0,1.0].
- @type mirG: float
- @ivar mirR: Mirror color (L{mirCol}) red component.
- Value is clamped to the range [0.0,1.0].
- @type mirR: float
-
- @ivar sssCol: SubSsurface scattering RGB color triplet.
- Components are clamped to the range [0.0,1.0].
- @type sssCol: list of 3 floats
- @ivar sssB: SubSsurface scattering color (L{sssCol}) blue component.
- Value is clamped to the range [0.0,1.0].
- @type sssB: float
- @ivar sssG: SubSsurface scattering color (L{sssCol}) green component.
- Value is clamped to the range [0.0,1.0].
- @type sssG: float
- @ivar sssR: SubSsurface scattering color (L{sssCol}) red component.
- Value is clamped to the range [0.0,1.0].
- @type sssR: float
-
- @ivar mode: Mode mode bitfield. See L{the Modes dictionary<Modes>} keys and descriptions.
- @type mode: int
- @ivar nFlares: Number of subflares with halo.
- Value is clamped to the range [1,32].
- @type nFlares: int
- @ivar nLines: Number of star-shaped lines with halo.
- Value is clamped to the range [0,250].
- @type nLines: int
- @ivar nRings: Number of rings with halo.
- Value is clamped to the range [0,24].
- @type nRings: int
- @ivar nStars: Number of star points with halo.
- Value is clamped to the range [3,50].
- @type nStars: int
- @ivar oopsLoc: Material OOPs location. Returns None if material not found in list.
- @type oopsLoc: list of 2 floats
- @ivar oopsSel: Material OOPs selection flag.
- Value must be in the range [0,1].
- @type oopsSel: int
- @ivar rayMirr: Mirror reflection amount for raytrace.
- Value is clamped to the range [0.0,1.0].
- @type rayMirr: float
- @ivar rayMirrDepth: Amount of raytrace inter-reflections.
- Value is clamped to the range [0,10].
- @type rayMirrDepth: int
- @ivar ref: Amount of reflections (for shader).
- Value is clamped to the range [0.0,1.0].
- @type ref: float
- @ivar refracIndex: Material's Index of Refraction (applies to the "Blinn" Specular Shader only.
- Value is clamped to the range [1.0,10.0].
- @type refracIndex: float
- @ivar rgbCol: Diffuse RGB color triplet.
- Components are clamped to the range [0.0,1.0].
- @type rgbCol: list of 3 floats
- @ivar rms: Material's surface slope standard deviation ("WardIso" specular shader only).
- Value is clamped to the range [0.0,0.4].
- @type rms: float
- @ivar roughness: Material's roughness ("Oren Nayar" diffuse shader only).
- Value is clamped to the range [0.0,3.14].
- @type roughness: float
- @ivar spec: Degree of specularity.
- Value is clamped to the range [0.0,2.0].
- @type spec: float
- @ivar specB: Specular color (L{specCol}) blue component.
- Value is clamped to the range [0.0,1.0].
- @type specB: float
- @ivar specCol: Specular RGB color triplet.
- Components are clamped to the range [0.0,1.0].
- @type specCol: list of 3 floats
- @ivar specG: Specular color (L{specCol}) green component.
- Value is clamped to the range [0.0,1.0].
- @type specG: float
- @ivar specR: Specular color (L{specCol}) red component.
- Value is clamped to the range [0.0,1.0].
- @type specR: float
- @ivar specShader: Specular shader type. See L{Shaders}.
- Value must be in the range [0,4].
- @type specShader: int
- @ivar specSize: Material's specular area size ("Toon" specular shader only).
- Value is clamped to the range [0.0,1.53].
- @type specSize: float
- @ivar specSmooth: Sets the smoothness of specular toon area.
- Value is clamped to the range [0.0,1.0].
- @type specSmooth: float
- @ivar specTransp: Makes specular areas opaque on transparent materials.
- Value is clamped to the range [0.0,1.0].
- @type specTransp: float
- @ivar subSize: Dimension of subflares, dots and circles.
- Value is clamped to the range [0.1,25.0].
- @type subSize: float
- @ivar transDepth: calculated maximal. Amount of refractions for raytrace.
- Value is clamped to the range [0,10].
- @type transDepth: int
- @ivar translucency: Amount of diffuse shading of the back side.
- Value is clamped to the range [0.0,1.0].
- @type translucency: float
- @ivar zOffset: Artificial offset in the Z buffer (for Ztransp option).
- Value is clamped to the range [0.0,10.0].
- @type zOffset: float
- @ivar lightGroup: Limits lights that affect this material to a group.
- @type lightGroup: Group or None
- @ivar uvlayer: The uv layer name to use, when UV mapping is enabled.
- @type uvlayer: string
- @ivar colorband: Material colorband, a list of colors,
- each color a list of 5 floats [0 - 1], [r,g,b,a,pos].
- The colorband can have between 1 and 31 colors.
- @type colorband: list
-
- @ivar colorbandDiffuse: Material colorband, a list of colors,
- each color a list of 5 floats [0 - 1], [r,g,b,a,pos].
- The colorband can have between 1 and 31 colors.
- @type colorbandDiffuse: list
- @ivar colorbandSpecular: Material colorband, a list of colors,
- each color a list of 5 floats [0 - 1], [r,g,b,a,pos].
- The colorband can have between 1 and 31 colors.
- @type colorbandSpecular: list
-
- @ivar enableSSS: If True, subsurface scattering will be rendered on this material.
- @type enableSSS: bool
- @ivar sssScale: If True, subsurface scattering will be rendered on this material.
- Value is clamped to the range [0.1,1000.0].
- @type sssScale: bool
- @ivar sssRadiusRed: Mean red scattering path length.
- Value is clamped to the range [0.0,10000.0].
- @type sssRadiusRed: float
- @ivar sssRadiusGreen: Mean green scattering path length.
- Value is clamped to the range [0.0,10000.0].
- @type sssRadiusGreen: float
- @ivar sssRadiusBlue: Mean blue scattering path length.
- Value is clamped to the range [0.0,10000.0].
- @type sssRadiusBlue: float
- @ivar sssIOR: Refraction index.
- Value is clamped to the range [0.1,2.0].
- @type sssIOR: float
- @ivar sssError: Error allowance for the calculation (a low value is slower).
- Value is clamped to the range [0.0,10.0].
- @type sssError: float
- @ivar sssColorBlend: Blend factor for SSS colors.
- Value is clamped to the range [0.0,1.0].
- @type sssColorBlend: float
- @ivar sssTextureScatter: Texture scattering factor.
- Value is clamped to the range [0.0,1.0].
- @type sssTextureScatter: float
- @ivar sssFront: Front scattering weight.
- Value is clamped to the range [0.0,2.0].
- @type sssFront: float
- @ivar sssBack: Back scattering weight
- Value is clamped to the range [0.0,10.0].
- @type sssBack: float
-
- @warning: Most member variables assume values in some [Min, Max] interval.
- When trying to set them, the given parameter will be clamped to lie in
- that range: if val < Min, then val = Min, if val > Max, then val = Max.
-
- """
-
- def getName():
- """
- Get the name of this Material object.
- @rtype: string
- """
-
- def setName(name):
- """
- Set the name of this Material object.
- @type name: string
- @param name: The new name.
- """
-
- def getIpo():
- """
- Get the Ipo associated with this material, if any.
- @rtype: Ipo
- @return: the wrapped ipo or None.
- """
-
- def setIpo(ipo):
- """
- Link an ipo to this material.
- @type ipo: Blender Ipo
- @param ipo: a material type ipo.
- """
-
- def clearIpo():
- """
- Unlink the ipo from this material.
- @return: True if there was an ipo linked or False otherwise.
- """
-
- def insertIpoKey(keytype):
- """
- Inserts keytype values in material ipo at curframe. Uses module constants.
- @type keytype: Integer
- @param keytype:
- -RGB
- -ALPHA
- -HALOSIZE
- -MODE
- -ALLCOLOR
- -ALLMIRROR
- -OFS
- -SIZE
- -ALLMAPPING
- @return: py_none
- """
-
- def getMode():
- """
- Get this Material's mode flags.
- @rtype: int
- @return: B{OR'ed value}. Use the Modes dictionary to check which flags
- are 'on'.
-
- Example::
- import Blender
- from Blender import Material
- flags = mymat.getMode()
- if flags & Material.Modes['HALO']:
- print "This material is rendered as a halo"
- else:
- print "Not a halo"
- """
-
- def setMode(param, stringN=None):
- """
- Set this Material's mode flags. Up to 22 mode strings can be given
- and specify the modes which are turned 'on'. Those not provided are
- turned 'off', so mat.setMode() -- without arguments -- turns off all
- mode flags for Material mat. Valid mode strings are "Traceable",
- "Shadow", "Shadeless", "Wire", "VColLight", "VColPaint", "Halo",
- "ZTransp", "ZInvert", "HaloRings", "HaloLines", "OnlyShadow",
- "HaloXAlpha", "HaloStar", "TexFace", "HaloTex", "HaloPuno", "NoMist",
- "HaloShaded", "HaloFlare", "Radio", "RayMirr", "ZTransp", "RayTransp",
- "Env"
-
- An integer can also be given, which directly sets the mode flag. The
- Modes dictionary keys can (and should) be added or ORed to specify
- which modes to turn 'on'. The value returned from getMode() can
- also be modified and input to this method.
-
- @type param: string, None or int
- @param param: A mode value (int) or flag (string). Can also be None.
- @type stringN: string
- @param stringN: A mode flag. Up to 22 flags can be set at the same time.
- """
-
- def getRGBCol():
- """
- Get the rgb color triplet sequence.
- @rtype: list of 3 floats
- @return: [r, g, b]
- """
-
- def setRGBCol(rgb = None):
- """
- Set the rgb color triplet sequence. If B{rgb} is None, set the color to black.
- @type rgb: three floats or a list of three floats
- @param rgb: The rgb color values in [0.0, 1.0] as:
- - a list of three floats: setRGBCol ([r, g, b]) B{or}
- - three floats as separate parameters: setRGBCol (r,g,b).
- """
-
- def getSpecCol():
- """
- Get the specular color triplet sequence.
- @rtype: list of 3 floats
- @return: [specR, specG, specB]
- """
-
- def setSpecCol(rgb = None):
- """
- Set the specular color triplet sequence. If B{rgb} is None, set the color to black.
- @type rgb: three floats or a list of three floats
- @param rgb: The rgb color values in [0.0, 1.0] as:
- - a list of three floats: setSpecCol ([r, g, b]) B{or}
- - three floats as separate parameters: setSpecCol (r,g,b).
- """
-
- def getMirCol():
- """
- Get the mirror color triplet sequence.
- @rtype: list of 3 floats
- @return: [mirR, mirG, mirb]
- """
-
- def setMirCol(rgb = None):
- """
- Set the mirror color triplet sequence. If B{rgb} is None, set the color to black.
- @type rgb: three floats or a list of three floats
- @param rgb: The rgb color values in [0.0, 1.0] as:
- - a list of three floats: setMirCol ([r, g, b]) B{or}
- - three floats as separate parameters: setMirCol (r,g,b).
- """
-
- def getAlpha():
- """
- Get the alpha (transparency) value.
- @rtype: float
- """
-
- def setAlpha(alpha):
- """
- Set the alpha (transparency) value.
- @type alpha: float
- @param alpha: The new value in [0.0, 1.0].
- """
-
- def getAmb():
- """
- Get the ambient color blend factor.
- @rtype: float
- """
-
- def setAmb(amb):
- """
- Set the ambient color blend factor.
- @type amb: float
- @param amb: The new value in [0.0, 1.0].
- """
-
- def getEmit():
- """
- Get the emitting light intensity.
- @rtype: float
- """
-
- def setEmit(emit):
- """
- Set the emitting light intensity.
- @type emit: float
- @param emit: The new value in [0.0, 1.0].
- """
-
- def getRef():
- """
- Get the reflectivity value.
- @rtype: float
- """
-
- def setRef(ref):
- """
- Set the reflectivity value.
- @type ref: float
- @param ref: The new value in [0.0, 1.0].
- """
-
- def getSpec():
- """
- Get the specularity value.
- @rtype: float
- """
-
- def setSpec(spec):
- """
- Set the specularity value.
- @type spec: float
- @param spec: The new value in [0.0, 2.0].
- """
-
- def getSpecTransp():
- """
- Get the specular transparency.
- @rtype: float
- """
-
- def setSpecTransp(spectransp):
- """
- Set the specular transparency.
- @type spectransp: float
- @param spectransp: The new value in [0.0, 1.0].
- """
-
- def setSpecShader(specShader):
- """
- Set the material's specular shader from one of the shaders in Material.Shaders dict.
- @type specShader: int
- @param specShader: The new value in [0, 4].
- """
-
- def getSpecShader(specShader):
- """
- Get the material's specular shader from one of the shaders in Material.Shaders dict.
- @rtype: int
- """
-
- def setDiffuseShader(diffuseShader):
- """
- Set the material's diffuse shader from one of the shaders in Material.Shaders dict.
- @type diffuseShader: int
- @param diffuseShader: The new value in [0, 3].
- """
-
- def getDiffuseShader():
- """
- Get the material's diffuse shader from one of the shaders in Material.Shaders dict.
- @rtype: int
- """
-
- def setRoughness(roughness):
- """
- Set the material's roughness (applies to the \"Oren Nayar\" Diffuse Shader only)
- @type roughness: float
- @param roughness: The new value in [0.0, 3.14].
- """
-
- def getRoughness():
- """
- Get the material's roughness (applies to the \"Oren Nayar\" Diffuse Shader only)
- @rtype: float
- """
-
- def setSpecSize(specSize):
- """
- Set the material's size of specular area (applies to the \"Toon\" Specular Shader only)
- @type specSize: float
- @param specSize: The new value in [0.0, 1.53].
- """
-
- def getSpecSize():
- """
- Get the material's size of specular area (applies to the \"Toon\" Specular Shader only)
- @rtype specSize: float
- """
-
- def setSpecSize(diffuseSize):
- """
- Set the material's size of diffuse area (applies to the \"Toon\" Diffuse Shader only)
- @type diffuseSize: float
- @param diffuseSize: The new value in [0.0, 3.14].
- """
-
- def getSpecSize():
- """
- Get the material's size of diffuse area (applies to the \"Toon\" Diffuse Shader only)
- @rtype: float
- """
-
- def setSpecSmooth(specSmooth):
- """
- Set the material's smoothing of specular area (applies to the \"Toon\" Specular Shader only)
- @type specSmooth: float
- @param specSmooth: The new value in [0.0, 1.0].
- """
-
- def getSpecSmooth():
- """
- Get the material's smoothing of specular area (applies to the \"Toon\" Specular Shader only)
- @rtype: float
- """
-
- def setDiffuseSmooth(diffuseSmooth):
- """
- Set the material's smoothing of diffuse area (applies to the \"Toon\" Diffuse Shader only)
- @type diffuseSmooth: float
- @param diffuseSmooth: The new value in [0.0, 1.0].
- """
-
- def getDiffuseSmooth():
- """
- Get the material's smoothing of diffuse area (applies to the \"Toon\" Diffuse Shader only)
- @rtype: float
- """
-
- def setDiffuseDarkness(diffuseDarkness):
- """
- Set the material's diffuse darkness (applies to the \"Minnaert\" Diffuse Shader only)
- @type diffuseDarkness: float
- @param diffuseDarkness: The new value in [0.0, 2.0].
- """
-
- def getDiffuseDarkness():
- """
- Get the material's diffuse darkness (applies to the \"Minnaert\" Diffuse Shader only)
- @rtype: float
- """
-
- def setRefracIndex(refracIndex):
- """
- Set the material's Index of Refraction (applies to the \"Blinn\" Specular Shader only)
- @type refracIndex: float
- @param refracIndex: The new value in [1.0, 10.0].
- """
-
- def getRefracIndex():
- """
- Get the material's Index of Refraction (applies to the \"Blinn\" Specular Shader only)
- @rtype: float
- """
-
- def setRms(rms):
- """
- Set the material's standard deviation of surface slope (applies to the \"WardIso\" Specular Shader only)
- @type rms: float
- @param rms: The new value in [0.0, 0.4].
- """
-
- def getRms():
- """
- Get the material's standard deviation of surface slope (applies to the \"WardIso\" Specular Shader only)
- @rtype: float
- """
-
- def setFilter(filter):
- """
- Set the material's amount of filtering when transparent raytrace is enabled
- @type filter: float
- @param filter: The new value in [0.0, 1.0].
- """
-
- def getFilter():
- """
- Get the material's amount of filtering when transparent raytrace is enabled
- @rtype: float
- """
-
- def setTranslucency(translucency):
- """
- Set the material's amount of diffuse shading of the back side
- @type translucency: float
- @param translucency: The new value in [0.0, 1.0].
- """
-
- def getTranslucency():
- """
- Get the material's amount of diffuse shading of the back side
- @rtype: float
- """
-
- def getAdd():
- """
- Get the glow factor.
- @rtype: float
- """
-
- def setAdd(add):
- """
- Set the glow factor.
- @type add: float
- @param add: The new value in [0.0, 1.0].
- """
-
- def getZOffset():
- """
- Get the artificial offset for faces with this Material.
- @rtype: float
- """
-
- def setZOffset(zoffset):
- """
- Set the artificial offset for faces with this Material.
- @type zoffset: float
- @param zoffset: The new value in [0.0, 10.0].
- """
-
- def getHaloSize():
- """
- Get the halo size.
- @rtype: float
- """
-
- def setHaloSize(halosize):
- """
- Set the halo size.
- @type halosize: float
- @param halosize: The new value in [0.0, 100.0].
- """
-
- def getHaloSeed():
- """
- Get the seed for random ring dimension and line location in halos.
- @rtype: int
- """
-
- def setHaloSeed(haloseed):
- """
- Set the seed for random ring dimension and line location in halos.
- @type haloseed: int
- @param haloseed: The new value in [0, 255].
- """
-
- def getFlareSize():
- """
- Get the ratio: flareSize / haloSize.
- @rtype: float
- """
-
- def setFlareSize(flaresize):
- """
- Set the ratio: flareSize / haloSize.
- @type flaresize: float
- @param flaresize: The new value in [0.1, 25.0].
- """
-
- def getFlareSeed():
- """
- Get flare's offset in the seed table.
- @rtype: int
- """
-
- def setFlareSeed(flareseed):
- """
- Set flare's offset in the seed table.
- @type flareseed: int
- @param flareseed: The new value in [0, 255].
- """
-
- def getFlareBoost():
- """
- Get the flare's extra strength.
- @rtype: float
- """
-
- def setFlareBoost(flareboost):
- """
- Set the flare's extra strength.
- @type flareboost: float
- @param flareboost: The new value in [0.1, 10.0].
- """
-
- def getSubSize():
- """
- Get the dimension of subflare, dots and circles.
- @rtype: float
- """
-
- def setSubSize(subsize):
- """
- Set the dimension of subflare, dots and circles.
- @type subsize: float
- @param subsize: The new value in [0.1, 25.0].
- """
-
- def getHardness():
- """
- Get the hardness of the specularity.
- @rtype: int
- """
-
- def setHardness(hardness):
- """
- Set the hardness of the specularity.
- @type hardness: int
- @param hardness: The new value in [1, 511].
- """
-
- def getNFlares():
- """
- Get the number of halo subflares.
- @rtype: int
- """
-
- def setNFlares(nflares):
- """
- Set the number of halo subflares.
- @type nflares: int
- @param nflares: The new value in [1, 32].
- """
-
- def getNStars():
- """
- Get the number of points in the halo stars.
- @rtype: int
- """
-
- def setNStars(nstars):
- """
- Set the number of points in the halo stars.
- @type nstars: int
- @param nstars: The new value in [3, 50].
- """
-
- def getNLines():
- """
- Get the number of star shaped lines on each halo.
- @rtype: int
- """
-
- def setNLines(nlines):
- """
- Set the number of star shaped lines on each halo.
- @type nlines: int
- @param nlines: The new value in [0, 250].
- """
-
- def getNRings():
- """
- Get the number of rings on each halo.
- @rtype: int
- """
-
- def setNRings(nrings):
- """
- Set the number of rings on each halo.
- @type nrings: int
- @param nrings: The new value in [0, 24].
- """
-
- def getRayMirr():
- """
- Get amount mirror reflection for raytrace.
- @rtype: float
- """
-
- def setRayMirr(nrmirr):
- """
- Set amount mirror reflection for raytrace.
- @type nrmirr: float
- @param nrmirr: The new value in [0.0, 1.0].
- """
-
- def getRayMirrDepth():
- """
- Get amount of inter-reflections calculated maximal.
- @rtype: int
- """
-
- def setRayMirrDepth(nrmirr):
- """
- Set amount mirror reflection for raytrace.
- @type nrmirr: int
- @param nrmirr: The new value in [0.0, 1.0].
- """
-
- def getFresnelMirr():
- """
- Get power of Fresnel for mirror reflection.
- @rtype: float
- """
-
- def setFresnelMirr(nrmirr):
- """
- Set power of Fresnel for mirror reflection.
- @type nrmirr: float
- @param nrmirr: The new value in [0.0, 1.0].
- """
-
- def getFresnelMirrFac():
- """
- Get the number of Ray Mirror.
- @rtype: float
- """
-
- def setFresnelMirrFac(nrmirr):
- """
- Set the number of ray mirror
- @type nrmirr: float
- @param nrmirr: The new value in [0.0, 1.0].
- """
-
- def getIOR():
- """
- Get the angular index of refraction for raytrace.
- @rtype: float
- """
-
- def setIOR(nrmirr):
- """
- Set the angular index of refraction for raytrace.
- @type nrmirr: float
- @param nrmirr: The new value in [0.0, 1.0].
- """
-
- def getTransDepth():
- """
- Get amount of refractions calculated maximal.
- @rtype: int
- """
-
- def setTransDepth(nrmirr):
- """
- Set amount of refractions calculated maximal.
- @type nrmirr: int
- @param nrmirr: The new value in [0.0, 1.0].
- """
-
- def getFresnelTrans():
- """
- Get power of Fresnel for transparency.
- @rtype: float
- """
-
- def setFresnelTrans(nrmirr):
- """
- Set power of Fresnel for transparency.
- @type nrmirr: float
- @param nrmirr: The new value in [0.0, 1.0].
- """
-
- def getFresnelTransFac():
- """
- Get blending factor for Fresnel.
- @rtype: float
- """
-
- def setFresnelTransFac(nrmirr):
- """
- Set blending factor for Fresnel.
- @type nrmirr: float
- @param nrmirr: The new value in [0.0, 1.0].
- """
-
- def setTexture(index, texture, texco, mapto):
- """
- Assign a Blender Texture object to slot number 'number'.
- @type index: int
- @param index: material's texture index in [0, 9].
- @type texture: Blender Texture
- @param texture: a Blender Texture object.
- @type texco: int
- @param texco: optional ORed bitflag -- defaults to TexCo.ORCO. See TexCo var in L{Texture}.
- @type mapto: int
- @param mapto: optional ORed bitflag -- defaults to MapTo.COL. See MapTo var in L{Texture}.
- """
-
- def clearTexture(index):
- """
- Clear the ith (given by 'index') texture channel of this material.
- @type index: int
- @param index: material's texture channel index in [0, 9].
- """
-
- def getTextures ():
- """
- Get this Material's Texture list.
- @rtype: list of MTex
- @return: a list of Blender MTex objects. None is returned for each empty
- texture slot.
- """
-
- def getScriptLinks (event):
- """
- Get a list with this Material's script links of type 'event'.
- @type event: string
- @param event: "FrameChanged" or "Redraw".
- @rtype: list
- @return: a list with Blender L{Text} names (the script links of the given
- 'event' type) or None if there are no script links at all.
- """
-
- def clearScriptLinks (links = None):
- """
- Delete script links from this Material. If no list is specified, all
- script links are deleted.
- @type links: list of strings
- @param links: None (default) or a list of Blender L{Text} names.
- """
-
- def addScriptLink (text, event):
- """
- Add a new script link to this Material.
- @type text: string
- @param text: the name of an existing Blender L{Text}.
- @type event: string
- @param event: "FrameChanged" or "Redraw".
- """
-
- def __copy__ ():
- """
- Make a copy of this material
- @rtype: Material
- @return: a copy of this material
- """
-
-import id_generics
-Material.__doc__ += id_generics.attributes
diff --git a/source/blender/python/api2_2x/doc/Mathutils.py b/source/blender/python/api2_2x/doc/Mathutils.py
deleted file mode 100644
index 7546bb5b6d5..00000000000
--- a/source/blender/python/api2_2x/doc/Mathutils.py
+++ /dev/null
@@ -1,864 +0,0 @@
-# Blender.Mathutils module and its subtypes
-
-"""
-The Blender.Mathutils submodule.
-
-Mathutils
-=========
-
-This module provides access to matrices, eulers, quaternions and vectors.
-
-Example::
- import Blender
- from Blender import Mathutils
- from Blender.Mathutils import *
-
- vec = Vector([1,2,3])
- mat = RotationMatrix(90, 4, 'x')
- matT = TranslationMatrix(vec)
-
- matTotal = mat * matT
- matTotal.invert()
-
- mat3 = matTotal.rotationPart
- quat1 = mat.toQuat()
- quat2 = mat3.toQuat()
-
- angle = DifferenceQuats(quat1, quat2)
- print angle
-"""
-
-def Rand (high = 1, low = 0):
- """
- Return a random number within a range.
- High and low represent the range from which the random
- number must return its result.
- @type high: float
- @param high: The upper range.
- @type low: float
- @param low: The lower range.
- """
-
-def Intersect(vec1, vec2, vec3, ray, orig, clip=1):
- """
- Return the intersection between a ray and a triangle, if possible, return None otherwise.
- @type vec1: Vector object.
- @param vec1: A 3d vector, one corner of the triangle.
- @type vec2: Vector object.
- @param vec2: A 3d vector, one corner of the triangle.
- @type vec3: Vector object.
- @param vec3: A 3d vector, one corner of the triangle.
- @type ray: Vector object.
- @param ray: A 3d vector, the orientation of the ray. the length of the ray is not used, only the direction.
- @type orig: Vector object.
- @param orig: A 3d vector, the origin of the ray.
- @type clip: integer
- @param clip: if 0, don't restrict the intersection to the area of the triangle, use the infinite plane defined by the triangle.
- @rtype: Vector object
- @return: The intersection between a ray and a triangle, if possible, None otherwise.
- """
-
-def TriangleArea(vec1, vec2, vec3):
- """
- Return the area size of the 2D or 3D triangle defined.
- @type vec1: Vector object.
- @param vec1: A 2d or 3d vector, one corner of the triangle.
- @type vec2: Vector object.
- @param vec2: A 2d or 3d vector, one corner of the triangle.
- @type vec3: Vector object.
- @param vec3: A 2d or 3d vector, one corner of the triangle.
- @rtype: float
- @return: The area size of the 2D or 3D triangle defined.
- """
-
-def TriangleNormal(vec1, vec2, vec3):
- """
- Return the normal of the 3D triangle defined.
- @type vec1: Vector object.
- @param vec1: A 3d vector, one corner of the triangle.
- @type vec2: Vector object.
- @param vec2: A 3d vector, one corner of the triangle.
- @type vec3: Vector object.
- @param vec3: A 3d vector, one corner of the triangle.
- @rtype: float
- @return: The normal of the 3D triangle defined.
- """
-
-def QuadNormal(vec1, vec2, vec3, vec4):
- """
- Return the normal of the 3D quad defined.
- @type vec1: Vector object.
- @param vec1: A 3d vector, the first vertex of the quad.
- @type vec2: Vector object.
- @param vec2: A 3d vector, the second vertex of the quad.
- @type vec3: Vector object.
- @param vec3: A 3d vector, the third vertex of the quad.
- @type vec4: Vector object.
- @param vec4: A 3d vector, the fourth vertex of the quad.
- @rtype: float
- @return: The normal of the 3D quad defined.
- """
-
-def LineIntersect(vec1, vec2, vec3, vec4):
- """
- Return a tuple with the points on each line respectively closest to the other
- (when both lines intersect, both vector hold the same value).
- The lines are evaluated as infinite lines in space, the values returned may not be between the 2 points given for each line.
- @type vec1: Vector object.
- @param vec1: A 3d vector, one point on the first line.
- @type vec2: Vector object.
- @param vec2: A 3d vector, another point on the first line.
- @type vec3: Vector object.
- @param vec3: A 3d vector, one point on the second line.
- @type vec4: Vector object.
- @param vec4: A 3d vector, another point on the second line.
- @rtype: (Vector object, Vector object)
- @return: A tuple with the points on each line respectively closest to the other.
- """
-
-def CopyVec(vector):
- """
- Create a copy of the Vector object.
- @attention: B{DEPRECATED} use vector.copy() instead.
- @type vector: Vector object.
- @param vector: A 2d,3d or 4d vector to be copied.
- @rtype: Vector object.
- @return: A new vector object which is a copy of the one passed in.
- """
-
-def CrossVecs(vec1, vec2):
- """
- Return the cross product of two vectors.
- @type vec1: Vector object.
- @param vec1: A 3d vector.
- @type vec2: Vector object.
- @param vec2: A 3d vector.
- @rtype: Vector object.
- @return: A new vector representing the cross product of
- the two vectors.
- """
-
-def DotVecs(vec1, vec2):
- """
- Return the dot product of two vectors.
- @type vec1: Vector object.
- @param vec1: A 2d,3d or 4d vector.
- @type vec2: Vector object.
- @param vec2: A 2d,3d or 4d vector.
- @rtype: float
- @return: Return the scalar product of vector muliplication.
- """
-
-def AngleBetweenVecs(vec1, vec2):
- """
- Return the angle between two vectors. Zero length vectors raise an error.
- @type vec1: Vector object.
- @param vec1: A 2d or 3d vector.
- @type vec2: Vector object.
- @param vec2: A 2d or 3d vector.
- @rtype: float
- @return: The angle between the vectors in degrees.
- @raise AttributeError: When there is a zero-length vector as an argument.
- """
-
-def MidpointVecs(vec1, vec2):
- """
- Return a vector to the midpoint between two vectors.
- @type vec1: Vector object.
- @param vec1: A 2d,3d or 4d vector.
- @type vec2: Vector object.
- @param vec2: A 2d,3d or 4d vector.
- @rtype: Vector object
- @return: The vector to the midpoint.
- """
-
-def VecMultMat(vec, mat):
- """
- Multiply a vector and matrix (pre-multiply)
- Vector size and matrix column size must equal.
- @type vec: Vector object.
- @param vec: A 2d,3d or 4d vector.
- @type mat: Matrix object.
- @param mat: A 2d,3d or 4d matrix.
- @rtype: Vector object
- @return: The row vector that results from the muliplication.
- @attention: B{DEPRECATED} You should now multiply vector * matrix direcly
- Example::
- result = myVector * myMatrix
- """
-
-def ProjectVecs(vec1, vec2):
- """
- Return the projection of vec1 onto vec2.
- @type vec1: Vector object.
- @param vec1: A 2d,3d or 4d vector.
- @type vec2: Vector object.
- @param vec2: A 2d,3d or 4d vector.
- @rtype: Vector object
- @return: The parallel projection vector.
- """
-
-def RotationMatrix(angle, matSize, axisFlag, axis):
- """
- Create a matrix representing a rotation.
- @type angle: float
- @param angle: The angle of rotation desired.
- @type matSize: int
- @param matSize: The size of the rotation matrix to construct.
- Can be 2d, 3d, or 4d.
- @type axisFlag: string (optional)
- @param axisFlag: Possible values:
- - "x - x-axis rotation"
- - "y - y-axis rotation"
- - "z - z-axis rotation"
- - "r - arbitrary rotation around vector"
- @type axis: Vector object. (optional)
- @param axis: The arbitrary axis of rotation used with "R"
- @rtype: Matrix object.
- @return: A new rotation matrix.
- """
-
-def TranslationMatrix(vector):
- """
- Create a matrix representing a translation
- @type vector: Vector object
- @param vector: The translation vector
- @rtype: Matrix object.
- @return: An identity matrix with a translation.
- """
-
-def ScaleMatrix(factor, matSize, axis):
- """
- Create a matrix representing a scaling.
- @type factor: float
- @param factor: The factor of scaling to apply.
- @type matSize: int
- @param matSize: The size of the scale matrix to construct.
- Can be 2d, 3d, or 4d.
- @type axis: Vector object. (optional)
- @param axis: Direction to influence scale.
- @rtype: Matrix object.
- @return: A new scale matrix.
- """
-
-def OrthoProjectionMatrix(plane, matSize, axis):
- """
- Create a matrix to represent an orthographic projection
- @type plane: string
- @param plane: Can be any of the following:
- - "x - x projection (2D)"
- - "y - y projection (2D)"
- - "xy - xy projection"
- - "xz - xz projection"
- - "yz - yz projection"
- - "r - arbitrary projection plane"
- @type matSize: int
- @param matSize: The size of the projection matrix to construct.
- Can be 2d, 3d, or 4d.
- @type axis: Vector object. (optional)
- @param axis: Arbitrary perpendicular plane vector.
- @rtype: Matrix object.
- @return: A new projeciton matrix.
- """
-
-def ShearMatrix(plane, factor, matSize):
- """
- Create a matrix to represent an orthographic projection
- @type plane: string
- @param plane: Can be any of the following:
- - "x - x shear (2D)"
- - "y - y shear (2D)"
- - "xy - xy shear"
- - "xz - xz shear"
- - "yz - yz shear"
- @type factor: float
- @param factor: The factor of shear to apply.
- @type matSize: int
- @param matSize: The size of the projection matrix to construct.
- Can be 2d, 3d, or 4d.
- @rtype: Matrix object.
- @return: A new shear matrix.
- """
-
-def CopyMat(matrix):
- """
- Create a copy of the Matrix object.
- @type matrix: Matrix object.
- @param matrix: A 2d,3d or 4d matrix to be copied.
- @rtype: Matrix object.
- @return: A new matrix object which is a copy of the one passed in.
- @attention: B{DEPRECATED} Use the matrix copy funtion to make a copy.
- Example::
- newMat = myMat.copy()
- """
-
-def MatMultVec(mat, vec):
- """
- Multiply a matrix and a vector (post-multiply)
- Vector size and matrix row size must equal.
- @type vec: Vector object.
- @param vec: A 2d,3d or 4d vector.
- @type mat: Matrix object.
- @param mat: A 2d,3d or 4d matrix.
- @rtype: Vector object
- @return: The column vector that results from the muliplication.
- @attention: B{DEPRECATED} You should use direct muliplication on the arguments
- Example::
- result = myMatrix * myVector
- """
-
-def CopyQuat(quaternion):
- """
- Create a copy of the Quaternion object.
- @type quaternion: Quaternion object.
- @param quaternion: Quaternion to be copied.
- @rtype: Quaternion object.
- @return: A new quaternion object which is a copy of the one passed in.
- @attention: B{DEPRECATED} You should use the Quaterion() constructor directly
- to create copies of quaternions
- Example::
- newQuat = Quaternion(myQuat)
- """
-
-def CrossQuats(quat1, quat2):
- """
- Return the cross product of two quaternions.
- @type quat1: Quaternion object.
- @param quat1: Quaternion.
- @type quat2: Quaternion object.
- @param quat2: Quaternion.
- @rtype: Quaternion object.
- @return: A new quaternion representing the cross product of
- the two quaternions.
- """
-
-def DotQuats(quat1, quat2):
- """
- Return the dot product of two quaternions.
- @type quat1: Quaternion object.
- @param quat1: Quaternion.
- @type quat2: Quaternion object.
- @param quat2: Quaternion.
- @rtype: float
- @return: Return the scalar product of quaternion muliplication.
- """
-
-def DifferenceQuats(quat1, quat2):
- """
- Returns a quaternion represting the rotational difference.
- @type quat1: Quaternion object.
- @param quat1: Quaternion.
- @type quat2: Quaternion object.
- @param quat2: Quaternion.
- @rtype: Quaternion object
- @return: Return a quaternion which which represents the rotational
- difference between the two quat rotations.
- """
-
-def Slerp(quat1, quat2, factor):
- """
- Returns the interpolation of two quaternions.
- @type quat1: Quaternion object.
- @param quat1: Quaternion.
- @type quat2: Quaternion object.
- @param quat2: Quaternion.
- @type factor: float
- @param factor: The interpolation value
- @rtype: Quaternion object
- @return: The interpolated rotation.
- """
-
-def CopyEuler(euler):
- """
- Create a new euler object.
- @type euler: Euler object
- @param euler: The euler to copy
- @rtype: Euler object
- @return: A copy of the euler object passed in.
- @attention: B{DEPRECATED} You should use the Euler constructor directly
- to make copies of Euler objects
- Example::
- newEuler = Euler(myEuler)
- """
-
-def RotateEuler(euler, angle, axis):
- """
- Roatate a euler by an amount in degrees around an axis.
- @type euler: Euler object
- @param euler: Euler to rotate.
- @type angle: float
- @param angle: The amount of rotation in degrees
- @type axis: string
- @param axis: axis to rotate around:
- - "x"
- - "y"
- - "z"
- """
-
-class Vector:
- """
- The Vector object
- =================
- This object gives access to Vectors in Blender.
- @ivar x: The x value.
- @ivar y: The y value.
- @ivar z: The z value (if any).
- @ivar w: The w value (if any).
- @ivar length: The magnitude of the vector.
- @ivar magnitude: This is a synonym for length.
- @ivar wrapped: Whether or not this item is wrapped data
- @note: Comparison operators can be done on Vector classes:
- - >, >=, <, <= test the vector magnitude
- - ==, != test vector values e.g. 1,2,3 != 1,2,4 even if they are the same length
- @note: Math can be performed on Vector classes
- - vec + vec
- - vec - vec
- - vec * float/int
- - vec * matrix
- - vec * vec
- - vec * quat
- - -vec
- @note: You can access a vector object like a sequence
- - x = vector[0]
- @attention: Vector data can be wrapped or non-wrapped. When a object is wrapped it
- means that the object will give you direct access to the data inside of blender. Modification
- of this object will directly change the data inside of blender. To copy a wrapped object
- you need to use the object's constructor. If you copy and object by assignment you will not get
- a second copy but a second reference to the same data. Only certain functions will return
- wrapped data. This will be indicated in the method description.
- Example::
- wrappedObject = Object.getAttribute() #this is wrapped data
- print wrappedObject.wrapped #prints 'True'
- copyOfObject = Object(wrappedObject) #creates a copy of the object
- secondPointer = wrappedObject #creates a second pointer to the same data
- print wrappedObject.attribute #prints '5'
- secondPointer.attribute = 10
- print wrappedObject.attribute #prints '10'
- print copyOfObject.attribute #prints '5'
- """
-
- def __init__(list = None):
- """
- Create a new 2d, 3d, or 4d Vector object from a list of floating point numbers.
- @note: that python uses higher precission floating point numbers, so values assigned to a vector may have some rounding error.
-
-
- Example::
- v = Vector(1,0,0)
- v = Vector(myVec)
- v = Vector(list)
- @type list: PyList of float or int
- @param list: The list of values for the Vector object. Can be a sequence or raw numbers.
- Must be 2, 3, or 4 values. The list is mapped to the parameters as [x,y,z,w].
- @rtype: Vector object.
- @return: It depends wheter a parameter was passed:
- - (list): Vector object initialized with the given values;
- - (): An empty 3 dimensional vector.
- """
-
- def copy():
- """
- Returns a copy of this vector
- @return: a copy of itself
- """
-
- def zero():
- """
- Set all values to zero.
- @return: an instance of itself
- """
-
- def normalize():
- """
- Normalize the vector, making the length of the vector always 1.0
- @note: Normalize works for vectors of all sizes, however 4D Vectors w axis is left untouched.
- @note: Normalizing a vector where all values are zero results in all axis having a nan value (not a number).
- @return: an instance of itself
- """
-
- def negate():
- """
- Set all values to their negative.
- @return: an instance of its self
- """
-
- def resize2D():
- """
- Resize the vector to 2d.
- @return: an instance of itself
- """
-
- def resize3D():
- """
- Resize the vector to 3d. New axis will be 0.0.
- @return: an instance of itself
- """
-
- def resize4D():
- """
- Resize the vector to 4d. New axis will be 0.0.
- The last component will be 1.0, to make multiplying 3d vectors by 4x4 matrices easier.
- @return: an instance of itself
- """
-
- def toTrackQuat(track, up):
- """
- Return a quaternion rotation from the vector and the track and up axis.
- @type track: String.
- @param track: Possible values:
- - "x - x-axis up"
- - "y - y-axis up"
- - "z - z-axis up"
- - "-x - negative x-axis up"
- - "-y - negative y-axis up"
- - "-z - negative z-axis up"
- @type up: String.
- @param up: Possible values:
- - "x - x-axis up"
- - "y - y-axis up"
- - "z - z-axis up"
- @rtype: Quaternion
- @return: Return a quaternion rotation from the vector and the track and up axis.
- """
-
-class Euler:
- """
- The Euler object
- ================
- This object gives access to Eulers in Blender.
- @ivar x: The heading value in degrees.
- @ivar y: The pitch value in degrees.
- @ivar z: The roll value in degrees.
- @ivar wrapped: Whether or not this object is wrapping data directly
- @note: You can access a euler object like a sequence
- - x = euler[0]
- @note: Comparison operators can be done:
- - ==, != test numeric values within epsilon
- @attention: Euler data can be wrapped or non-wrapped. When a object is wrapped it
- means that the object will give you direct access to the data inside of blender. Modification
- of this object will directly change the data inside of blender. To copy a wrapped object
- you need to use the object's constructor. If you copy and object by assignment you will not get
- a second copy but a second reference to the same data. Only certain functions will return
- wrapped data. This will be indicated in the method description.
- Example::
- wrappedObject = Object.getAttribute() #this is wrapped data
- print wrappedObject.wrapped #prints 'True'
- copyOfObject = Object(wrappedObject) #creates a copy of the object
- secondPointer = wrappedObject #creates a second pointer to the same data
- print wrappedObject.attribute #prints '5'
- secondPointer.attribute = 10
- print wrappedObject.attribute #prints '10'
- print copyOfObject.attribute #prints '5'
- """
-
- def __init__(list = None):
- """
- Create a new euler object.
-
- Example::
- euler = Euler(45,0,0)
- euler = Euler(myEuler)
- euler = Euler(sequence)
- @type list: PyList of float/int
- @param list: 3d list to initialize euler
- @rtype: Euler object
- @return: Euler representing heading, pitch, bank.
- @note: Values are in degrees.
- """
-
- def zero():
- """
- Set all values to zero.
- @return: an instance of itself
- """
-
- def copy():
- """
- @return: a copy of this euler.
- """
-
- def unique():
- """
- Calculate a unique rotation for this euler. Avoids gimble lock.
- @return: an instance of itself
- """
-
- def toMatrix():
- """
- Return a matrix representation of the euler.
- @rtype: Matrix object
- @return: A roation matrix representation of the euler.
- """
-
- def toQuat():
- """
- Return a quaternion representation of the euler.
- @rtype: Quaternion object
- @return: Quaternion representation of the euler.
- """
-
-class Quaternion:
- """
- The Quaternion object
- =====================
- This object gives access to Quaternions in Blender.
- @ivar w: The w value.
- @ivar x: The x value.
- @ivar y: The y value.
- @ivar z: The z value.
- @ivar wrapped: Wether or not this object wraps data directly
- @ivar magnitude: The magnitude of the quaternion.
- @ivar axis: Vector representing the axis of rotation.
- @ivar angle: A scalar representing the amount of rotation
- in degrees.
- @note: Comparison operators can be done:
- - ==, != test numeric values within epsilon
- @note: Math can be performed on Quaternion classes
- - quat + quat
- - quat - quat
- - quat * float/int
- - quat * vec
- - quat * quat
- @note: You can access a quaternion object like a sequence
- - x = quat[0]
- @attention: Quaternion data can be wrapped or non-wrapped. When a object is wrapped it
- means that the object will give you direct access to the data inside of blender. Modification
- of this object will directly change the data inside of blender. To copy a wrapped object
- you need to use the object's constructor. If you copy and object by assignment you will not get
- a second copy but a second reference to the same data. Only certain functions will return
- wrapped data. This will be indicated in the method description.
- Example::
- wrappedObject = Object.getAttribute() #this is wrapped data
- print wrappedObject.wrapped #prints 'True'
- copyOfObject = Object(wrappedObject) #creates a copy of the object
- secondPointer = wrappedObject #creates a second pointer to the same data
- print wrappedObject.attribute #prints '5'
- secondPointer.attribute = 10
- print wrappedObject.attribute #prints '10'
- print copyOfObject.attribute #prints '5'
- """
-
- def __init__(list, angle = None):
- """
- Create a new quaternion object from initialized values.
-
- Example::
- quat = Quaternion(1,2,3,4)
- quat = Quaternion(axis, angle)
- quat = Quaternion()
- quat = Quaternion(180, list)
-
- @type list: PyList of int/float
- @param list: A 3d or 4d list to initialize quaternion.
- 4d if intializing [w,x,y,z], 3d if used as an axis of rotation.
- @type angle: float (optional)
- @param angle: An arbitrary rotation amount around 'list'.
- List is used as an axis of rotation in this case.
- @rtype: New quaternion object.
- @return: It depends wheter a parameter was passed:
- - (list/angle): Quaternion object initialized with the given values;
- - (): An identity 4 dimensional quaternion.
- """
-
- def identity():
- """
- Set the quaternion to the identity quaternion.
- @return: an instance of itself
- """
-
- def copy():
- """
- make a copy of the quaternion.
- @return: a copy of itself
- """
-
- def negate():
- """
- Set the quaternion to its negative.
- @return: an instance of itself
- """
-
- def conjugate():
- """
- Set the quaternion to its conjugate.
- @return: an instance of itself
- """
-
- def inverse():
- """
- Set the quaternion to its inverse
- @return: an instance of itself
- """
-
- def normalize():
- """
- Normalize the quaternion.
- @return: an instance of itself
- """
-
- def toEuler():
- """
- Return Euler representation of the quaternion.
- @rtype: Euler object
- @return: Euler representation of the quaternion.
- """
-
- def toMatrix():
- """
- Return a matrix representation of the quaternion.
- @rtype: Matrix object
- @return: A rotation matrix representation of the quaternion.
- """
-
-class Matrix:
- """
- The Matrix Object
- =================
- This object gives access to Matrices in Blender.
- @ivar rowSize: The row size of the matrix.
- @ivar colSize: The column size of the matrix.
- @ivar wrapped: Whether or not this object wrapps internal data
- @note: Math can be performed on Matrix classes
- - mat + mat
- - mat - mat
- - mat * float/int
- - mat * vec
- - mat * mat
- @note: Comparison operators can be done:
- - ==, != test numeric values within epsilon
- @note: You can access a quaternion object like a 2d sequence
- - x = matrix[0][1]
- - vector = matrix[2]
- @attention: Quaternion data can be wrapped or non-wrapped. When a object is wrapped it
- means that the object will give you direct access to the data inside of blender. Modification
- of this object will directly change the data inside of blender. To copy a wrapped object
- you need to use the object's constructor. If you copy and object by assignment you will not get
- a second copy but a second reference to the same data. Only certain functions will return
- wrapped data. This will be indicated in the method description.
- Example::
- wrappedObject = Object.getAttribute() #this is wrapped data
- print wrappedObject.wrapped #prints 'True'
- copyOfObject = Object(wrappedObject) #creates a copy of the object
- secondPointer = wrappedObject #creates a second pointer to the same data
- print wrappedObject.attribute #prints '5'
- secondPointer.attribute = 10
- print wrappedObject.attribute #prints '10'
- print copyOfObject.attribute #prints '5'
- """
-
- def __init__(list1 = None, list2 = None, list3 = None, list4 = None):
- """
- Create a new matrix object from initialized values.
-
- Example::
- matrix = Matrix([1,1,1],[0,1,0],[1,0,0])
- matrix = Matrix(mat)
- matrix = Matrix(seq1, seq2, vector)
-
- @type list1: PyList of int/float
- @param list1: A 2d,3d or 4d list.
- @type list2: PyList of int/float
- @param list2: A 2d,3d or 4d list.
- @type list3: PyList of int/float
- @param list3: A 2d,3d or 4d list.
- @type list4: PyList of int/float
- @param list4: A 2d,3d or 4d list.
- @rtype: New matrix object.
- @return: It depends wheter a parameter was passed:
- - (list1, etc.): Matrix object initialized with the given values;
- - (): An empty 3 dimensional matrix.
- """
-
- def zero():
- """
- Set all matrix values to 0.
- @return: an instance of itself
- """
-
-
- def copy():
- """
- Returns a copy of this matrix
- @return: a copy of itself
- """
-
- def identity():
- """
- Set the matrix to the identity matrix.
- An object with zero location and rotation, a scale of 1, will have an identity matrix.
-
- See U{http://en.wikipedia.org/wiki/Identity_matrix}
- @return: an instance of itself
- """
-
- def transpose():
- """
- Set the matrix to its transpose.
-
- See U{http://en.wikipedia.org/wiki/Transpose}
- @return: None
- """
-
- def determinant():
- """
- Return the determinant of a matrix.
-
- See U{http://en.wikipedia.org/wiki/Determinant}
- @rtype: float
- @return: Return a the determinant of a matrix.
- """
-
- def invert():
- """
- Set the matrix to its inverse.
-
- See U{http://en.wikipedia.org/wiki/Inverse_matrix}
- @return: an instance of itself.
- @raise ValueError: When matrix is singular.
- """
-
- def rotationPart():
- """
- Return the 3d submatrix corresponding to the linear term of the
- embedded affine transformation in 3d. This matrix represents rotation
- and scale. Note that the (4,4) element of a matrix can be used for uniform
- scaling, too.
- @rtype: Matrix object.
- @return: Return the 3d matrix for rotation and scale.
- """
-
- def translationPart():
- """
- Return a the translation part of a 4 row matrix.
- @rtype: Vector object.
- @return: Return a the translation of a matrix.
- """
-
- def scalePart():
- """
- Return a the scale part of a 3x3 or 4x4 matrix.
- @note: This method does not return negative a scale on any axis because it is not possible to obtain this data from the matrix alone.
- @rtype: Vector object.
- @return: Return a the scale of a matrix.
- """
-
- def resize4x4():
- """
- Resize the matrix to by 4x4
- @return: an instance of itself.
- """
-
- def toEuler():
- """
- Return an Euler representation of the rotation matrix (3x3 or 4x4 matrix only).
- @rtype: Euler object
- @return: Euler representation of the rotation matrix.
- """
-
- def toQuat():
- """
- Return a quaternion representation of the rotation matrix
- @rtype: Quaternion object
- @return: Quaternion representation of the rotation matrix
- """
-
diff --git a/source/blender/python/api2_2x/doc/Mesh.py b/source/blender/python/api2_2x/doc/Mesh.py
deleted file mode 100644
index 7e7514e8b3a..00000000000
--- a/source/blender/python/api2_2x/doc/Mesh.py
+++ /dev/null
@@ -1,1215 +0,0 @@
-# Blender.Mesh module and the Mesh PyType object
-
-"""
-The Blender.Mesh submodule.
-
-B{New}:
-
-Mesh Data
-=========
-
-This module provides access to B{Mesh Data} objects in Blender. It differs
-from the NMesh module by allowing direct access to the actual Blender data,
-so that changes are done immediately without need to update or put the data
-back into the original mesh. The result is faster operations with less memory
-usage. The example below creates a simple pyramid, and sets some of the
-face's attributes (the vertex color):
-
-Example::
- from Blender import *
- import bpy
-
- editmode = Window.EditMode() # are we in edit mode? If so ...
- if editmode: Window.EditMode(0) # leave edit mode before getting the mesh
-
- # define vertices and faces for a pyramid
- coords=[ [-1,-1,-1], [1,-1,-1], [1,1,-1], [-1,1,-1], [0,0,1] ]
- faces= [ [3,2,1,0], [0,1,4], [1,2,4], [2,3,4], [3,0,4] ]
-
- me = bpy.data.meshes.new('myMesh') # create a new mesh
-
- me.verts.extend(coords) # add vertices to mesh
- me.faces.extend(faces) # add faces to the mesh (also adds edges)
-
- me.vertexColors = 1 # enable vertex colors
- me.faces[1].col[0].r = 255 # make each vertex a different color
- me.faces[1].col[1].g = 255
- me.faces[1].col[2].b = 255
-
- scn = bpy.data.scenes.active # link object to current scene
- ob = scn.objects.new(me, 'myObj')
-
- if editmode: Window.EditMode(1) # optional, just being nice
-
-Vertices, edges and faces are added to a mesh using the .extend() methods.
-For best speed and efficiency, gather all vertices, edges or faces into a
-list and call .extend() once as in the above example. Similarly, deleting
-from the mesh is done with the .delete() methods and are most efficient when
-done once.
-
-@type Modes: readonly dictionary
-@type FaceFlags: readonly dictionary
-@type FaceModes: readonly dictionary
-@type FaceTranspModes: readonly dictionary
-@var Modes: The available mesh modes.
- - NOVNORMALSFLIP - no flipping of vertex normals during render.
- - TWOSIDED - double sided mesh.
- - AUTOSMOOTH - turn auto smoothing of faces "on".
- - note: SUBSURF and OPTIMAL have been removed, use Modifiers to apply subsurf.
-@var FaceFlags: The available *texture face* (uv face select mode) selection
- flags. Note: these refer to TexFace faces, available if mesh.faceUV
- returns true.
- - SELECT - selected (deprecated in versions after 2.43, use face.sel).
- - HIDE - hidden (deprecated in versions after 2.43, use face.hide).
- - ACTIVE - the active face, read only - Use L{mesh.activeFace<Mesh.Mesh.activeFace>} to set.
-@var FaceModes: The available *texture face* modes. Note: these are only
- meaningful if mesh.faceUV returns true, since in Blender this info is
- stored at the TexFace (TexFace button in Edit Mesh buttons) structure.
- - ALL - set all modes at once.
- - BILLBOARD - always orient after camera.
- - HALO - halo face, always point to camera.
- - DYNAMIC - respond to collisions.
- - INVISIBLE - invisible face.
- - LIGHT - dynamic lighting.
- - OBCOL - use object color instead of vertex colors.
- - SHADOW - shadow type.
- - SHAREDVERT - apparently unused in Blender.
- - SHAREDCOL - shared vertex colors (per vertex).
- - TEX - has texture image.
- - TILES - uses tiled image.
- - TWOSIDE - two-sided face.
-@var FaceTranspModes: The available face transparency modes. Note: these are
- enumerated values (enums), they can't be combined (ANDed, ORed, etc) like a bit vector.
- - SOLID - draw solid.
- - ADD - add to background (halo).
- - ALPHA - draw with transparency.
- - SUB - subtract from background.
-@var EdgeFlags: The available edge flags.
- - SELECT - selected (B{deprecated}). Use edge.sel attribute instead.
- - EDGEDRAW - edge is drawn out of edition mode.
- - EDGERENDER - edge is drawn out of edition mode.
- - SEAM - edge is a seam for UV unwrapping
- - FGON - edge is part of a F-Gon.
- - LOOSE - Edge is not a part of a face (only set on leaving editmode)
- - SHARP - Edge will be rendered sharp when used with the "Edge Split" modifier.
-@type AssignModes: readonly dictionary.
-@var AssignModes: The available vertex group assignment modes, used by
- L{mesh.assignVertsToGroup()<Mesh.Mesh.assignVertsToGroup>}.
- - ADD: if the vertex in the list is not assigned to the group
- already, this creates a new association between this vertex and the
- group with the weight specified, otherwise the weight given is added to
- the current weight of an existing association between the vertex and
- group.
- - SUBTRACT: will attempt to subtract the weight passed from a vertex
- already associated with a group, else it does nothing.\n
- - REPLACE: attempts to replace a weight with the new weight value
- for an already associated vertex/group, else it does nothing.
-@type SelectModes: readonly dictionary.
-@var SelectModes: The available edit select modes.
- - VERTEX: vertex select mode.
- - EDGE: edge select mode.
- - FACE: face select mode.
-"""
-
-AssignModes = {'REPLACE':1}
-
-def Get(name=None):
- """
- Get the mesh data object called I{name} from Blender.
- @type name: string
- @param name: The name of the mesh data object.
- @rtype: Mesh
- @return: If a name is given, it returns either the requested mesh or None.
- If no parameter is given, it returns all the meshes in the current scene.
- """
-
-def New(name='Mesh'):
- """
- Create a new mesh data object called I{name}.
- @type name: string
- @param name: The name of the mesh data object.
- @rtype: Mesh
- @return: a new Blender mesh.
- @note: if the mesh is not linked to an object, its datablock will be deleted
- when the object is deallocated.
- """
-
-def Mode(mode=0):
- """
- Get and/or set the selection modes for mesh editing. These are the modes
- visible in the 3D window when a mesh is in Edit Mode.
- @type mode: int
- @param mode: The desired selection mode. See L{SelectModes} for values.
- Modes can be combined. If omitted, the selection mode is not changed.
- @rtype: int
- @return: the current selection mode.
- @note: The selection mode is an attribute of the current scene. If the
- scene is changed, the selection mode may not be the same.
- """
-
-def Unlink(name):
- """
- Delete an unused mesh from Blender's database. The mesh must not have
- any users (i.e., it must not be linked to any object).
- @type name: string
- @param name: The name of the mesh data object.
- @rtype: None
- @note: This function may be a temporary solution; it may be replaced
- in the future by a more general unlink function for many datablock types.
- Hopefully this will be decided prior to the 2.42 release of Blender.
- """
-
-class MCol:
- """
- The MCol object
- ===============
- This object is four ints representing an RGBA color.
- @ivar r: The Red component in [0, 255].
- @type r: int
- @ivar g: The Green component in [0, 255].
- @type g: int
- @ivar b: The Blue component in [0, 255].
- @type b: int
- @ivar a: The Alpha (transparency) component in [0, 255].
- @type a: int
- """
-
-class MVert:
- """
- The MVert object
- ================
- This object holds mesh vertex data.
- @ivar co: The vertex coordinates (x, y, z).
- @type co: vector (WRAPPED DATA)
- @ivar no: The vertex's unit normal vector (x, y, z).
- B{Note}: if vertex coordinates are changed, it may be necessary to use
- L{Mesh.calcNormals()} to update the vertex normals.
- B{Note}: Vertex normals can be set, but are not wrapped so modifying a normal
- vector will not effect the verts normal. The result is only visible
- when faces have the smooth option enabled.
- Example::
- # This won't work.
- for v in me.verts:
- v.no.x= 0
- v.no.y= 0
- v.no.z= 1
- # This will work
- no= Blender.Mathutils.Vector(0,0,1)
- for v in me.verts:
- v.no= no
- @type no: vector
- @ivar uvco: The vertex texture "sticky" coordinates (x, y),
- B{Note}: These are not seen in the UV editor and they are not a part of UV a UVLayer. Use face UV's for that.
- if present. Available for MVerts only.
- Use L{Mesh.vertexUV} to test for presence before trying to access;
- otherwise an exception will may be thrown.
- (Sticky coordinates can be set when the object is in the Edit mode;
- from the Editing Panel (F9), look under the "Mesh" properties for the
- "Sticky" button).
- @type uvco: vector (WRAPPED DATA)
- @ivar index: The vertex's index within the mesh (MVerts only). Read-only.
- @type index: int
- @ivar sel: The vertex's selection state (selected=1).
- B{Note}: a Mesh will return the selection state of the mesh when EditMode
- was last exited. A Python script operating in EditMode must exit EditMode
- before getting the current selection state of the mesh.
- @type sel: int
- @ivar hide: The face's B{edit mode} visibility state (hidden=1).
- @type hide: int
- @warn: There are two kinds of UV texture coordinates in Blender: per vertex
- ("sticky") and per face vertex (UV in L{MFace}). In the first, there's
- only one UV pair of coordinates for each vertex in the mesh. In the
- second, for each face it belongs to, a vertex can have different UV
- coordinates. This makes the per face option more flexible, since two
- adjacent faces won't have to be mapped to a continuous region in an image:
- each face can be independently mapped to any part of its texture.
- """
-
- def __init__(coord):
- """
- Create a new PVert object.
-
- @note: PVert-type objects are designed to be used for creating and
- modifying a mesh's vertex list, but since they do not "wrap" any Blender
- data there are some differences. The B{index} and B{uvco} attributes
- are not defined for PVerts, and the B{no} attribute contains valid
- data only if the PVert was created from an MVert (using a slice
- operation on the mesh's vertex list.) PVerts also cannot be used as an
- argument to any method which expects data wrapping a Blender mesh, such
- as L{MVertSeq.delete()}.
-
- Example::
- v = Blender.Mesh.MVert(1,0,0)
- v = Blender.Mesh.MVert(Blender.Mathutils.Vector([1,0,0]))
-
- m = Blender.Mesh.Get('Mesh')
- vlist = m.verts[:] # slice operation also returns PVerts
-
- @type coord: three floats or a Vector object
- @param coord: the coordinate values for the new vertex
- @rtype: PVert
- @return: a new PVert object
-
- """
-
-class MVertSeq:
- """
- The MVertSeq object
- ===================
- This object provides sequence and iterator access to the mesh's vertices.
- Access and assignment of single items and slices are also supported.
- When a single item in the vertex list is accessed, the operator[] returns
- a MVert object which "wraps" the actual vertex in the mesh; changing any
- of the vertex's attributes will immediately change the data in the mesh.
- When a slice of the vertex list is accessed, however, the operator[]
- returns a list of PVert objects which are copies of the mesh's vertex
- data. Changes to these objects have no effect on the mesh; they must be
- assigned back to the mesh's vertex list.
-
- Slice assignments cannot change the vertex list size. The size of the
- list being assigned must be the same as the specified slice; otherwise an
- exception is thrown.
-
- Example::
- import Blender
- from Blender import Mesh
-
- me = Mesh.Get("Plane") # get the mesh data called "Plane"
- vert = me.verts[0] # vert accesses actual mesh data
- vert.co[0] += 2 # change the vertex's X location
- pvert = me.verts[-2:] # pvert is COPY of mesh's last two verts
- pvert[0].co[0] += 2 # change the vertex's X location
- pvert[1].co[0] += 2 # change the vertex's X location
- me.verts[-1] = pvert[1] # put change to second vertex into mesh
-
- @note: The mesh can be "cleared" by assigning B{None} to the mesh's vertex
- list. This does not delete the Blender mesh object, it only deletes all
- the memory allocated to the mesh. The result is equivalent to calling
- Mesh.New(). The intent is to allow users writing exporters to free memory
- after it is used in a quick and simple way.
-
- Example::
- import Blender
- from Blender import Mesh
-
- me = Mesh.Get("Plane") # get the mesh data called "Plane"
- me.verts = None # delete all the mesh's attributes
-
- """
-
- def extend(coords):
- """
- Append zero or more vertices to the mesh. Unlike L{MEdgeSeq.extend()} and
- L{MFaceSeq.extend()} no attempt is made to check for duplicate vertices in
- the parameter list, or for vertices already in the mesh.
- @note: Since Blender 2.44 all new verts are selected.
-
- Example::
- import Blender
- from Blender import Mesh
- from Blender.Mathutils import Vector
-
- me = Mesh.Get("Plane") # get the mesh data called "Plane"
- me.verts.extend(1,1,1) # add one vertex
- l=[(.1,.1,.1),Vector([2,2,.5])]
- me.verts.extend(l) # add multiple vertices
-
- @type coords: sequences(s) of floats or vectors
- @param coords: coords can be
- - a sequence of three floats,
- - a 3D vector, or
- - a sequence (list or tuple) of either of the above.
- """
-
- def delete(verts):
- """
- Deletes one or more vertices from the mesh. Any edge or face which
- uses the specified vertices are also deleted.
-
- @type verts: multiple ints or MVerts
- @param verts: can be
- - a single MVert belonging to the mesh (B{note:} will not work with
- PVerts)
- - a single integer, specifying an index into the mesh's vertex list
- - a sequence (list or tuple) containing two or more of either of
- the above.
- """
-
- def selected():
- """
- Get selected vertices.
- @return: a list of the indices for all vertices selected in edit mode.
- @rtype: list of ints
- """
-
-class MEdge:
- """
- The MEdge object
- ================
- This object holds mesh edge data.
- @ivar v1: The first vertex of the edge.
- @type v1: MVert
- @ivar v2: The second vertex of the edge.
- @type v2: MVert
- @ivar length: The length of the edge, same as (ed.v1.co-ed.v2.co).length where "ed" is an MEdge.
- @type length: float
- @ivar crease: The crease value of the edge. It is in the range [0,255].
- @type crease: int
- @ivar flag: The bitfield describing edge properties. See L{EdgeFlags}.
- Example::
- # This script counts fgon and non fgon edges
- from Blender import Scene, Mesh
- scn= Scene.GetCurrent() # Current scene, important to be scene aware
- ob= scn.objects.active # last selected object
- me= ob.getData(mesh=1) # thin wrapper doesn't copy mesh data like nmesh
-
- total_fgon_eds= total_nor_eds= 0
-
- # Look through the edges and find any fgon edges, then print the findings to the console
- for ed in me.edges: # all meshes have edge data now
- if ed.flag & Mesh.EdgeFlags.FGON:
- total_fgon_eds+=1
- else:
- total_nor_eds+=1
-
- print 'Blender has', total_fgon_eds, 'fgon edges and', total_nor_eds, 'non fgon edges'
- @type flag: int
- @ivar index: The edge's index within the mesh. Read-only.
- @type index: int
- @ivar sel: The edge's B{edit mode} selection state (selected=1). B{Note}:
- changing the select state of an edge changes the select state of the edge's
- vertices.
- @type sel: int
- @ivar key: The edge's vert indices in an ordered tuple, which can be used
- as a dictionary key. Read-only.
- This is the same as (min(ed.v1.index, ed.v2.index), max(ed.v1.index, ed.v2.index))
- @type key: tuple
- """
-
- def __iter__():
- """
- Iterator for MEdge. It iterates over the MVerts of the edge, returning
- v1 then v2.
- @return: one of the edge's vertices
- @rtype: MVert
- """
-
-class MEdgeSeq:
- """
- The MEdgeSeq object
- ===================
- This object provides sequence and iterator access to the mesh's edges.
- """
-
- def extend(vertseq):
- """
- Add zero or more edges to the mesh. Edges which already exist in the
- mesh or with both vertices the same are ignored. If three or four verts
- are specified in any sequence, an edge is also created between the first
- and last vertices (this is useful when adding faces).
- @note: Since Blender 2.44 all new edges are selected.
-
- Example::
- import Blender
- from Blender import Mesh
-
- me = Mesh.Get("Plane") # get the mesh data called "Plane"
- v = me.verts # get vertices
- if len(v) >= 6: # if there are enough vertices...
- me.edges.extend(v[0],v[1]) # add a single edge
- l=[(v[1],v[2],v[3]),[0,2,4,5]]
- me.edges.extend(l) # add multiple edges
-
- @type vertseq: sequence(s) of ints or MVerts
- @param vertseq: either two to four ints or MVerts, or sequence
- (list or tuple) of sequences each containing two to four ints or MVerts.
- """
-
- def delete(edges):
- """
- Deletes one or more edges from the mesh. In addition, also delete:
- - any faces which uses the specified edge(s)
- - any "orphan" vertices (belonging only to specified edge(s))
-
- @type edges: multiple ints or MEdges
- @param edges: can be
- - a single MEdge belonging to the mesh
- - a single integer, specifying an index into the mesh's edge list
- - a sequence (list or tuple) containing two or more of either of
- the above.
- """
-
- def selected():
- """
- Get selected edges.
- Selected edges are those for which both vertices are selected.
- @return: a list of the indices for all edges selected in edit mode.
- @rtype: list of ints
- """
-
-class MFace:
- """
- The MFace object
- ================
- This object holds mesh face data.
-
- Example::
- import Blender
- from Blender import Mesh, Window
-
- in_emode = Window.EditMode()
- if in_emode: Window.EditMode(0)
-
- me = Mesh.Get("Mesh")
- faces = me.faces
-
- ## Example for editmode faces selection:
- selected_faces = []
- for f in faces:
- if f.sel:
- selected_faces.append(f)
- # ... unselect selected and select all the others:
- for f in faces:
- f.sel = not f.sel # 1 becomes 0, 0 becomes 1
-
- ## Example for UV textured faces selection:
- selected_faces = []
- SEL = Mesh.FaceFlags['SELECT']
- # get selected faces:
- for f in faces:
- if f.flag & SEL:
- selected_faces.append(f)
- # ... unselect selected and select all the others:
- for f in faces:
- if f.flag & SEL:
- f.flag &= ~SEL # unselect these
- else:
- f.flag |= SEL # and select these
-
- if in_emode: Window.EditMode(1)
- Blender.Redraw()
-
- @ivar verts: The face's vertices. Each face has 3 or 4 vertices.
- @type verts: list of MVerts
- @ivar v: Same as L{verts}. This attribute is only for compatibility with
- NMesh scripts and will probably be deprecated in the future.
- @ivar sel: The face's B{edit mode} selection state (selected=1).
- This is not the same as the selection state of the textured faces
- (see L{flag}). B{Note}: changing the select state of a face changes
- the select state of the face's vertices.
- @type sel: int
- @ivar hide: The face's B{edit mode} visibility state (hidden=1).
- This is not the same as the visibility state of
- the textured faces (see L{flag}).
- @type hide: int
- @ivar smooth: If set, the vertex normals are averaged to make this
- face look smooth. (This is the same as choosing "Set Smooth" in the
- Editing Panel (F9) under "Link and Material" properties).
- @type smooth: int
- @ivar col: The face's vertex colors, if defined. Each vertex has its own
- color.
- Will throw an exception if L{Mesh.vertexColors} is False.
-
- Example::
- # This example uses vertex normals to apply normal colors to each face.
- import bpy
- from Blender import Window
- scn= bpy.scenes.active # Current scene, important to be scene aware
- ob= scn.objects.active # last selected object
- me= ob.getData(mesh=1) # thin wrapper doesn't copy mesh data like nmesh
- me.vertexColors= True # Enable face, vertex colors
- for f in me.faces:
- for i, v in enumerate(f):
- no= v.no
- col= f.col[i]
- col.r= int((no.x+1)*128)
- col.g= int((no.y+1)*128)
- col.b= int((no.z+1)*128)
- Window.RedrawAll()
- @type col: tuple of MCols
- @ivar mat: The face's index into the mesh's materials
- list. It is in the range [0,15].
- @type mat: int
- @ivar image: The Image used as a texture for this face.
- Setting this attribute will create UV faces if they do not exist.
- Getting this attribute throw an exception if the mesh does not have
- UV faces; use L{Mesh.faceUV} to test.
- Assigning an image will automatically set the TEX attribute of the
- L{mode} bitfield. Use "del f.image" or "f.image = None" to clear the
- image assigned to the face.
- @type image: Image
- @ivar mode: The texture mode bitfield (see L{FaceModes}).
- Will throw an exception if the mesh does not have UV faces; use
- L{Mesh.faceUV} to test.
- @type mode: int
- @ivar index: The face's index within the mesh. Read-only.
- @type index: int
-
- @ivar flag: The face's B{texture mode} flags; indicates the selection,
- active , and visibility states of a textured face (see
- L{FaceFlags} for values).
- This is not the same as the selection or visibility states of
- the faces in edit mode (see L{sel} and L{hide}).
- To set the active face, use
- the L{Mesh.activeFace} attribute instead.
- Will throw an exception if the mesh does not have UV faces; use
- L{Mesh.faceUV} to test.
-
- @ivar transp: Transparency mode. It is one of the values in
- L{FaceTranspModes}).
- Will throw an exception if the mesh does not have UV faces; use
- L{Mesh.faceUV} to test.
- @type transp: int
-
- @ivar uv: The face's UV coordinates. Each vertex has its own UV coordinate.
- Setting this attribute will create UV faces if they do not exist.
- Getting this attribute throw an exception if the mesh does not have
- UV faces; use L{Mesh.faceUV} to test.
- @type uv: tuple of vectors (WRAPPED DATA)
- @ivar uvSel: The face's UV coordinates selection state; a 1 indicates the
- vertex is selected. Each vertex has its own UV coordinate select state
- (this is not the same as the vertex's edit mode selection state).
- Setting this attribute will create UV faces if they do not exist.
- Getting this attribute throw an exception if the mesh does not have
- UV faces; use L{Mesh.faceUV} to test.
- @type uvSel: tuple of ints
- @ivar no: The face's normal vector (x, y, z). Read-only.
- @type no: vector
- @ivar cent: The center of the face. Read-only.
- @type cent: vector
- @ivar area: The area of the face. Read-only.
- @type area: float
- @ivar edge_keys: A tuple, each item a key that can reference an edge by its
- ordered indices. Read-only. This is useful for building connectivity data.
- Example::
- from Blender import Mesh
- me = Mesh.Get('Cube')
- # a dictionary where the edge is the key, and a list of faces that use it are the value
- edge_faces = dict([(ed.key, []) for ed in me.edges])
-
- # Add the faces to the dict
- for f in me.faces:
- for key in f.edge_keys:
- edge_faces[key].append(f) # add this face to the edge as a user
-
- # Print the edges and the number of face users
- for key, face_users in edge_faces.iteritems():
- print 'Edge:', key, 'uses:', len(face_users),'faces'
-
- @type edge_keys: tuple
- @note: there are regular faces and textured faces in Blender, both currently
- with their own selection and visibility states, due to a mix of old and new
- code. To (un)select or (un)hide regular faces (visible in EditMode), use
- L{MFace.sel} and L{MFace.hide} attributes. For textured faces (UV Face
- Select and Paint modes in Blender) use the L{MFace.flag} attribute.
- Check the example above and note L{Window.EditMode}.
- @note: Assigning UV textures to mesh faces in Blender works like this:
- 1. Select your mesh.
- 2. Enter face select mode (press f) and select at least some face(s).
- 3. In the UV/Image Editor window, load / select an image.
- 4. Play in both windows (better split the screen to see both at the same
- time) until the UV coordinates are where you want them. Hint: in the
- 3D window, the 'u' key opens a menu of default UV choices and the 'r'
- key lets you rotate the UV coords.
- 5. Leave face select mode (press f).
- """
-
- def __iter__():
- """
- Iterator for MVert. It iterates over the MVerts of the face, returning
- v1, v2, v3 (and optionally v4);
- @return: one of the face's vertices
- @rtype: MVert
- """
-
- def __len__():
- """
- len for MVert. It returns the number of vertices in the face.
- @rtype: int
- """
-
-class MFaceSeq:
- """
- The MFaceSeq object
- ===================
- This object provides sequence and iterator access to the mesh's faces.
- """
-
- def extend(vertseq,ignoreDups=True,indexList=True):
- """
- Add zero or more faces and edges to the mesh. Faces which already exist
- in the mesh, or faces which contain the same vertex multiple times are
- ignored. Sequences of two vertices are accepted, but no face will be
- created.
- @note: Since Blender 2.44 all new faces are selected.
-
- Example::
- import Blender
- from Blender import Mesh
-
- me = Mesh.Get("Plane") # get the mesh data called "Plane"
- v = me.verts # get vertices
- if len(v) >= 6: # if there are enough vertices...
- me.faces.extend(v[1],v[2],v[3]) # add a single edge
- l=[(v[0],v[1]),[0,2,4,5]]
- me.faces.extend(l) # add another face
-
- @type vertseq: sequence(s) of MVerts
- @param vertseq: either two to four ints or MVerts, or sequence (list or
- tuple) of sequences each containing two to four ints or MVerts.
- @type ignoreDups: boolean
- @param ignoreDups: keyword parameter (default is False). If supplied and
- True, do not check the input list or mesh for duplicate faces. This can
- speed up scripts but can prossibly produce undesirable effects. Only
- use if you know what you're doing.
- @type indexList: boolean
- @param indexList: keyword parameter (default is False). If supplied and
- True, the method will return a list representing the new index for each
- face in the input list. If faces are removed as duplicates, None is
- inserted in place of the index.
- @warning: Faces using the first vertex at the 3rd or 4th location in the
- face's vertex list will have their order rotated so that the zero index
- on in the first or second location in the face. When creating face data
- with UVs or vertex colors, you may need to work around this, either by
- checking for zero indices yourself or by adding a dummy first vertex to
- the mesh that can be removed when your script has finished.
- """
-
- def delete(deledges, faces):
- """
- Deletes one or more faces (and optionally the edges associated with
- the face(s)) from the mesh.
-
- @type deledges: int
- @param deledges: controls whether just the faces (deledges=0)
- or the faces and edges (deledges=1) are deleted. These correspond to the
- "Only Faces" and "Edges & Faces" options in the Edit Mode pop-up menu
- @type faces: multiple ints or MFaces
- @param faces: a sequence (list or tuple) containing one or more of:
- - an MEdge belonging to the mesh
- - a integer, specifying an index into the mesh's face list
- """
-
- def sort():
- """
- Sorts the faces using exactly the same syntax as pythons own list sorting function.
-
- Example::
- import Blender
- from Blender import Mesh
- me = Mesh.Get('mymesh')
-
- me.faces.sort(key=lambda f: f.area)
-
- me.faces.sort(key=lambda f: f.cent)
-
- @note: Internally faces only refer to their index, so after sorting, faces you alredy have will not have their index changed to match the new sorted order.
- """
-
- def selected():
- """
- Get selected faces.
- @return: a list of the indices for all faces selected in edit mode.
- @rtype: list of ints
- """
-
-from IDProp import IDGroup, IDArray
-class Mesh:
- """
- The Mesh Data object
- ====================
- This object gives access to mesh data in Blender.
-
- @note: the verts, edges and faces attributes are implemented as sequences.
- The operator[] and len() are defined for these sequences. You cannot
- assign to an item in the sequence, but you can assign to most of the
- attributes of individual items.
- @ivar edges: The mesh's edges.
- @type edges: sequence of MEdges
- @ivar faces: The mesh's faces.
- @type faces: sequence of MFaces
- @ivar verts: The mesh's vertices.
- @type verts: sequence of MVerts
-
- @ivar materials: The mesh's materials. Each mesh can reference up to
- 16 materials. Empty slots in the mesh's list are represented by B{None}.
- B{Note}: L{Object.colbits<Object.Object.colbits>} needs to be set correctly
- for each object in order for these materials to be used instead of
- the object's materials.
- B{Note}: Making the material list shorter does not change the face's material indices.
- Take care when using the face's material indices to reference a material in this list.
- B{Note}: The list that's returned is I{not} linked to the original mesh.
- mesh.materials.append(material) won't do anything.
- Use mesh.materials += [material] instead.
- @type materials: list of L{Material}s
- @ivar degr: The max angle for auto smoothing in [1,80].
- @type degr: int
- @ivar maxSmoothAngle: Same as L{degr}. This attribute is only for
- compatibility with NMesh scripts and will probably be deprecated in
- the future.
- @ivar mode: The mesh's mode bitfield. See L{Modes}.
- @type mode: int
- @ivar sel: Sets selection status for all vertices, edges and faces in the
- mesh (write only).
- @type sel: boolean
- @ivar hide: Sets hidden status for all vertices, edges and faces in the
- mesh (write only).
- @type hide: boolean
- @ivar subDivLevels: The [display, rendering] subdivision levels in [1, 6].
- @type subDivLevels: list of 2 ints
- @ivar faceUV: The mesh contains UV-mapped textured faces.
- @type faceUV: bool
- @ivar vertexColors: The mesh contains vertex colors. Set True to add vertex colors.
- @type vertexColors: bool
- @ivar vertexUV: The mesh contains "sticky" per-vertex UV coordinates.
- @type vertexUV: bool
- @ivar activeFace: Index of the mesh's active face in UV Face Select and
- Paint modes. Only one face can be active at a time. Note that this is
- independent of the selected faces in Face Select and Edit modes.
- Will throw an exception if the mesh does not have UV faces; use
- L{faceUV} to test.
- @type activeFace: int
- @ivar activeGroup: The mesh's active vertex group. The mesh must be
- linked to an object (read the comment in L{addVertGroup} for more info).
- @type activeGroup: string or None
- @ivar texMesh: The mesh's texMesh setting, used so coordinates from another
- mesh can be used for rendering textures.
- @type texMesh: Mesh or None
- @ivar key: The L{Key<Key.Key>} object containing the keyframes for this mesh, if any.
- @type key: Key or None
- @ivar activeUVLayer: The mesh's active UV/Image layer. None if there is no UV/Image layers.
-
- B{Note}: After setting this value, call L{update} so the result can be seen the the 3d view.
- @type activeUVLayer: string
- @ivar activeColorLayer: The mesh's active Vertex Color layer. None if there is no UV/Image layers.
-
- B{Note}: After setting this value, call L{update} so the result can be seen the the 3d view.
- @type activeColorLayer: string
-
- @ivar renderUVLayer: The mesh's rendered UV/Image layer. None if there is no UV/Image layers.
- @type renderUVLayer: string
- @ivar renderColorLayer: The mesh's rendered Vertex Color layer. None if there is no UV/Image layers.
- @type renderColorLayer: string
-
- @ivar multires: The mesh has multires data, set True to add multires data.
- Will throw an exception if the mesh has shape keys; use L{key} to test.
- @type multires: bool
- @ivar multiresLevelCount: The mesh has multires data. (read only)
- @type multiresLevelCount: int
- @ivar multiresDrawLevel: The multires level to display in the 3dview in [1 - multiresLevelCount].
- @type multiresDrawLevel: int
- @ivar multiresEdgeLevel: The multires level edge display in the 3dview [1 - multiresLevelCount].
- @type multiresEdgeLevel: int
- @ivar multiresPinLevel: The multires pin level, used for applying modifiers [1 - multiresLevelCount].
- @type multiresPinLevel: int
- @ivar multiresRenderLevel: The multires level to render [1 - multiresLevelCount].
- @type multiresRenderLevel: int
-
-
- """
-
- def getFromObject(object, cage=0, render=0):
- """
- Replace the mesh's existing data with the raw mesh data from a Blender
- Object. This method supports all the geometry based objects (mesh, text,
- curve, surface, and meta). If the object has modifiers, they will be
- applied before to the object before extracting the vertex data unless
- the B{cage} parameter is 1.
- @note: The mesh coordinates are in I{local space}, not the world space of
- its object. For world space vertex coordinates, each vertex location must
- be multiplied by the object's 4x4 transform matrix (see L{transform}).
- @note: The objects materials will not be copied into the existing mesh,
- however the face material indices will match the material list of the original data.
- @type object: blender object or string
- @param object: The Blender object or its name, which contains the geometry data.
- @type cage: int
- @param cage: determines whether the original vertices or derived vertices
- @type render: int
- @param render: determines whether the render setting for modifiers will be used or not.
- (for objects with modifiers) are used. The default is derived vertices.
- """
-
- def calcNormals():
- """
- Recalculates the vertex normals using face data.
- """
-
- def pointInside(point, selected_only=False):
- """
- @type point: vector
- @param point: Test if this point is inside the mesh
- @type selected_only: bool
- @param selected_only: if True or 1, only the selected faces are taken into account.
- Returns true if vector is inside the mesh.
- @note: Only returns a valid result for mesh data that has no holes.
- @note: Bubbles in the mesh work as expect.
- """
-
- def transform(matrix, recalc_normals = False, selected_only=False):
- """
- Transforms the mesh by the specified 4x4 matrix (such as returned by
- L{Object.Object.getMatrix}). The matrix should be invertible.
- Ideal usage for this is exporting to an external file where
- global vertex locations are required for each object.
- Sometimes external renderers or file formats do not use vertex normals.
- In this case, you can skip transforming the vertex normals by leaving
- the optional parameter recalc_normals as False or 0 (the default value).
-
- Example::
- # This script outputs deformed meshes worldspace vertex locations
- # for a selected object without changing the object
- import Blender
- from Blender import Mesh, Object
-
- ob = Object.GetSelected()[0] # Get the first selected object
- me = Mesh.New() # Create a new mesh
- me.getFromObject(ob.name) # Get the object's mesh data
- verts = me.verts[:] # Save a copy of the vertices
- me.transform(ob.matrix) # Convert verts to world space
- for v in me.verts:
- print 'worldspace vert', v.co
- me.verts = verts # Restore the original verts
-
- @type matrix: Py_Matrix
- @param matrix: 4x4 Matrix which can contain location, scale and rotation.
- @type recalc_normals: int
- @param recalc_normals: if True or 1, also transform vertex normals.
- @type selected_only: bool
- @param selected_only: if True or 1, only the selected verts will be transformed.
- @warn: unlike L{NMesh.transform()<NMesh.NMesh.transform>}, this method
- I{will immediately modify the mesh data} when it is used. If you
- transform the mesh using the object's matrix to get the vertices'
- world positions, the result will be a "double transform". To avoid
- this you either need to set the object's matrix to the identity
- matrix, perform the inverse transform after outputting the transformed
- vertices, or make a copy of the vertices prior to using this method
- and restore them after outputting the transformed vertices (as shown
- in the example).
- """
-
- def vertexShade(object):
- """
- Colors vertices based on the current lighting setup, like when there
- are no vertex colors and no textured faces and a user enters Vertex Paint
- Mode in Blender (only lamps in visible layers account). An exception is
- thrown if called while in EditMode.
- @type object: Object
- @param object: The Blender Object linked to the mesh.
- """
-
- def update(key=None):
- """
- Update display lists after changes to mesh. B{Note}: with changes taking
- place for using a directed acyclic graph (DAG) for scene and object
- updating, this method may be only temporary and may be removed in future
- releases.
- @type key: string
- @param key: Use this optional argument to write the current vertex
- locations to the a shape key. the name must match an existing shape key for this mesh
- See L{Mesh.Mesh.key} and L{Key.Key.blocks} to get a list of the named shape keys, setting the active keys is
- done from the object with L{Object.Object.pinShape}, L{Object.Object.activeShape}.
-
-
-
- @warn: Since Blender 2.42 this function has changed; now it won't recalculate
- vertex normals (seen when faces are smooth). See L{Mesh.calcNormals()}.
- """
-
- def findEdges(edges):
- """
- Quickly search for the location of an edges.
- @type edges: sequence(s) of ints or MVerts
- @param edges: can be tuples of MVerts or integer indexes (B{note:} will
- not work with PVerts) or a sequence (list or tuple) containing two or
- more sequences.
- @rtype: int, None or list
- @return: if an edge is found, its index is returned; otherwise None is
- returned. If a sequence of edges is passed, a list is returned.
- """
-
- def addVertGroup(group):
- """
- Add a named and empty vertex (deform) group to the object this mesh is
- linked to. The mesh must first be linked to an object (with object.link()
- or object.getData() ) so the method knows which object to update.
- This is because vertex groups in Blender are stored in I{the object} --
- not in the mesh, which may be linked to more than one object.
- @type group: string
- @param group: the name for the new group.
- """
-
- def removeVertGroup(group):
- """
- Remove a named vertex (deform) group from the object linked to this mesh.
- All vertices assigned to the group will be removed (just from the group,
- not deleted from the mesh), if any. If this mesh was newly created, it
- must first be linked to an object (read the comment in L{addVertGroup} for
- more info).
- @type group: string
- @param group: the name of a vertex group.
- """
-
- def assignVertsToGroup(group, vertList, weight, assignmode = AssignModes['REPLACE']):
- """
- Adds an array (a Python list) of vertex points to a named vertex group
- associated with a mesh. The vertex list is a list of vertex indices from
- the mesh. You should assign vertex points to groups only when the mesh has
- all its vertex points added to it and is already linked to an object.
-
- I{B{Example:}}
- The example here adds a new set of vertex indices to a sphere primitive::
- import Blender
- sphere = Blender.Object.Get('Sphere')
- replace = Blender.Mesh.AssignModes.REPLACE
- mesh = sphere.getData(mesh=True)
- mesh.addVertGroup('firstGroup')
- vertList = []
- for x in range(300):
- if x % 3 == 0:
- vertList.append(x)
- mesh.assignVertsToGroup('firstGroup', vertList, 0.5, replace)
-
- @type group: string
- @param group: the name of the group.
- @type vertList: list of ints
- @param vertList: a list of vertex indices.
- @type weight: float
- @param weight: the deform weight for (which means: the amount of influence
- the group has over) the given vertices. It should be in the range
- [0.0, 1.0]. If weight <= 0, the given vertices are removed from the
- group. If weight > 1, it is clamped.
- @type assignmode: module constant
- @param assignmode: Three choices: REPLACE, ADD or SUBTRACT.
- See L{AssignModes} for a complete description.
- """
-
- def removeVertsFromGroup(group, vertList = None):
- """
- Remove a list of vertices from the given group. If this mesh was newly
- created, it must first be linked to an object (check L{addVertGroup}).
- @type group: string
- @param group: the name of a vertex group
- @type vertList: list of ints
- @param vertList: a list of vertex indices to be removed from I{group}.
- If None, all vertices are removed -- the group is emptied.
- """
-
- def getVertsFromGroup(group, weightsFlag = 0, vertList = None):
- """
- Return a list of vertex indices associated with the passed group. This
- method can be used to test whether a vertex index is part of a group and
- if so, what its weight is.
-
- I{B{Example:}}
- Append this to the example from L{assignVertsToGroup}::
- # ...
- print "Vertex indices from group %s :" % groupName
- print mesh.getVertsFromGroup('firstGroup')
- print "Again, with weights:"
- print mesh.getVertsFromGroup('firstGroup',1)
- print "Again, with weights and restricted to the given indices:"
- print mesh.getVertsFromGroup('firstGroup',1,[1,2,3,4,5,6])
-
- @type group: string
- @param group: the group name.
- @type weightsFlag: bool
- @param weightsFlag: if 1, each item in the list returned contains a
- tuple pair (index, weight), the weight is a float between 0.0 and 1.0.
- @type vertList: list of ints
- @param vertList: if given, only those vertex points that are both in the
- list and group passed in are returned.
- """
-
- def renameVertGroup(groupName, newName):
- """
- Renames a vertex group.
- @type groupName: string
- @param groupName: the vertex group name to be renamed.
- @type newName: string
- @param newName: the name to replace the old name.
- """
-
- def getVertGroupNames():
- """
- Return a list of all vertex group names.
- @rtype: list of strings
- @return: returns a list of strings representing all vertex group
- associated with the mesh's object
- """
-
- def getUVLayerNames():
- """
- Return a list of all UV layer names
- @rtype: list of strings
- @return: returns a list of strings representing all UV layers
- associated with the mesh's object
- """
-
- def getColorLayerNames():
- """
- Return a list of all color layer names
- @rtype: list of strings
- @return: returns a list of strings representing all color layers
- associated with the mesh's object
- """
-
- def getVertexInfluences(index):
- """
- Get the bone influences for a specific vertex.
- @type index: int
- @param index: The index of a vertex.
- @rtype: list of lists
- @return: List of pairs [name, weight], where name is the bone name (string)
- and weight is a float value.
- """
-
- def removeAllKeys():
- """
- Remove all mesh keys stored in this mesh.
- @rtype: bool
- @return: True if successful or False if the Mesh has no keys.
- """
-
- def insertKey(frame = None, type = 'relative'):
- """
- Insert a mesh key at the given frame.
- @type frame: int
- @type type: string
- @param frame: The Scene frame where the mesh key should be inserted. If
- None or the arg is not given, the current frame is used.
- @param type: The mesh key type: 'relative' or 'absolute'. This is only
- relevant on meshes with no keys.
- @warn: This and L{removeAllKeys} were included in this release only to
- make accessing vertex keys possible, but may not be a proper solution
- and may be substituted by something better later. For example, it
- seems that 'frame' should be kept in the range [1, 100]
- (the curves can be manually tweaked in the Ipo Curve Editor window in
- Blender itself later).
- @warn: Will throw an error if the mesh has multires. use L{multires} to check.
- """
-
- def addUVLayer(name):
- """
- Adds a new UV/Image layer to this mesh, it will always be the last layer but not made active.
- @type name: string
- @param name: The name of the new UV layer, 31 characters max.
- """
-
- def addColorLayer(name):
- """
- Adds a new Vertex Color layer to this mesh, it will always be the last layer but not made active.
- @type name: string
- @param name: The name of the new Color layer, 31 characters max.
- """
-
- def removeUVLayer(name):
- """
- Removes the active UV/Image layer.
- @type name: string
- @param name: The name of the UV layer to remove.
- """
-
- def removeColorLayer(name):
- """
- Removes the active Vertex Color layer.
- @type name: string
- @param name: The name of the Color layer to remove.
- """
-
- def renameUVLayer(name, newname):
- """
- Renames the UV layer called name to newname.
- @type name: string
- @param name: The UV layer to rename.
- @type newname: string
- @param newname: The new name of the UV layer, will be made unique.
- """
-
- def renameColorLayer(name, newname):
- """
- Renames the color layer called name to newname.
- @type name: string
- @param name: The Color layer to rename.
- @type newname: string
- @param newname: The new name of the Color layer, will be made unique.
- """
-
- def smooth():
- """
- Flattens angle of selected faces. Experimental mesh tool.
- An exception is thrown if called while in EditMode.
- """
-
- def flipNormals():
- """
- Toggles the direction of selected face's normals. Experimental mesh tool.
- An exception is thrown if called while in EditMode.
- """
-
- def toSphere():
- """
- Moves selected vertices outward in a spherical shape. Experimental mesh
- tool.
- An exception is thrown if called while in EditMode.
- """
-
- def fill():
- """
- Scan fill a closed selected edge loop. Experimental mesh tool.
- An exception is thrown if called while in EditMode.
- """
-
- def triangleToQuad():
- """
- Convert selected triangles to quads. Experimental mesh tool.
- An exception is thrown if called while in EditMode.
- """
-
- def quadToTriangle(mode=0):
- """
- Convert selected quads to triangles. Experimental mesh tool.
- An exception is thrown if called while in EditMode.
- @type mode: int
- @param mode: specifies whether a to add the new edge between the
- closest (=0) or farthest(=1) vertices.
- """
-
- def subdivide(beauty=0):
- """
- Subdivide selected edges in a mesh. Experimental mesh tool.
- An exception is thrown if called while in EditMode.
- @type beauty: int
- @param beauty: specifies whether a "beauty" subdivide should be
- enabled (disabled is default). Value must be in the range [0,1].
- """
-
- def remDoubles(limit):
- """
- Removes duplicates from selected vertices. Experimental mesh tool.
- An exception is thrown if called while in EditMode.
- @type limit: float
- @param limit: specifies the maximum distance considered for vertices
- to be "doubles". Value is clamped to the range [0.0,1.0].
- @rtype: int
- @return: the number of vertices deleted
- """
-
- def recalcNormals(direction=0):
- """
- Recalculates inside or outside normals for selected faces. Experimental
- mesh tool.
- An exception is thrown if called while in EditMode.
- @type direction: int
- @param direction: specifies outward (0) or inward (1) normals. Outward
- is the default. Value must be in the range [0,1].
- """
-
- def __copy__ ():
- """
- Make a copy of this mesh
- @rtype: Mesh
- @return: a copy of this mesh
- """
-
-import id_generics
-Mesh.__doc__ += id_generics.attributes
diff --git a/source/blender/python/api2_2x/doc/MeshPrimitives.py b/source/blender/python/api2_2x/doc/MeshPrimitives.py
deleted file mode 100644
index 4fb53ab4536..00000000000
--- a/source/blender/python/api2_2x/doc/MeshPrimitives.py
+++ /dev/null
@@ -1,157 +0,0 @@
-# Blender.Mesh.Primitives module
-
-"""
-The Blender.Mesh.Primitives submodule.
-
-B{New}:
-
-Mesh Primitive Data
-===================
-
-This submodule provides access Blender's mesh primitives. Each module
-function returns a BPy_Mesh object which wraps the mesh data. This data can
-then be manipulated using the L{Mesh} API.
-
-Example::
-
- from Blender import *
-
- me = Mesh.Primitives.Cube(2.0) # create a new cube of size 2
- sc = Scene.GetCurrent() # get current scene
- sc.objects.new(me,'Mesh') # add a new mesh-type object to the scene
- Window.RedrawAll() # update windows
-"""
-
-def Plane(size=2.0):
- """
- Construct a filled planar mesh with 4 vertices. The default size
- creates a 2 by 2 Blender unit plane, identical to the Blender UI.
- @type size: float
- @param size: optional size of the plane.
- @rtype: L{BPy_Mesh<Mesh>}
- @return: returns a mesh object.
- """
-
-def Cube(size=2.0):
- """
- Construct a cube mesh. The default size creates a cube with each face
- 2 by 2 Blender units, identical to the Blender UI.
- @type size: float
- @param size: optional size of the cube.
- @rtype: L{BPy_Mesh<Mesh>}
- @return: returns a mesh object.
- """
-
-def Circle(verts=32,diameter=2.0):
- """
- Construct a circle mesh. The defaults create a circle with a
- diameter of 2 Blender units, identical to the Blender UI.
- @type verts: int
- @param verts: optional number of vertices for the circle.
- Value must be in the range [3,100].
- @type diameter: float
- @param diameter: optional diameter of the circle.
- @rtype: L{BPy_Mesh<Mesh>}
- @return: returns a mesh object.
- """
-
-def Cylinder(verts=32, diameter=2.0, length=2.0):
- """
- Construct a cylindrical mesh (ends filled). The defaults create a
- cylinder with a diameter of 2 Blender units and length 2 units,
- identical to the Blender UI.
- @type verts: int
- @param verts: optional number of vertices in the cylinder's perimeter.
- Value must be in the range [3,100].
- @type diameter: float
- @param diameter: optional diameter of the cylinder.
- @type length: float
- @param length: optional length of the cylinder.
- @rtype: L{BPy_Mesh<Mesh>}
- @return: returns a mesh object.
- """
-
-def Tube(verts=32, diameter=2.0, length=2.0):
- """
- Construct a cylindrical mesh (ends not filled). The defaults create a
- cylinder with a diameter of 2 Blender units and length 2 units, identical
- to the Blender UI.
- @type verts: int
- @param verts: optional number of vertices in the tube's perimeter.
- Value must be in the range [3,100].
- @type diameter: float
- @param diameter: optional diameter of the tube.
- @type length: float
- @param length: optional length of the tube.
- @rtype: L{BPy_Mesh<Mesh>}
- @return: returns a mesh object.
- """
-
-def Cone(verts=32, diameter=2.0, length=2.0):
- """
- Construct a conic mesh (ends filled). The defaulte create a cone with a
- base diameter of 2 Blender units and length 2 units, identical to
- the Blender UI.
- @type verts: int
- @param verts: optional number of vertices in the cone's perimeter.
- Value must be in the range [3,100].
- @type diameter: float
- @param diameter: optional diameter of the cone.
- @type length: float
- @param length: optional length of the cone.
- @rtype: L{BPy_Mesh<Mesh>}
- @return: returns a mesh object.
- """
-
-def Grid(xres=32, yres=32, size=2.0):
- """
- Construct a grid mesh. The defaults create a 32 by 32 mesh of size 2
- Blender units, identical to the Blender UI.
- @type xres: int
- @param xres: optional grid size in the x direction.
- Value must be in the range [2,100].
- @type yres: int
- @param yres: optional grid size in the y direction.
- Value must be in the range [2,100].
- @type size: float
- @param size: optional size of the grid.
- @rtype: L{BPy_Mesh<Mesh>}
- @return: returns a mesh object.
- """
-
-def UVsphere(segments=32, rings=32, diameter=2.0):
- """
- Construct a UV sphere mesh. The defaults create a 32 by 32 sphere with
- a diameter of 2 Blender units, identical to the Blender UI.
- @type segments: int
- @param segments: optional number of longitudinal divisions.
- Value must be in the range [3,100].
- @type rings: int
- @param rings: optional number of latitudinal divisions.
- Value must be in the range [3,100].
- @type diameter: float
- @param diameter: optional diameter of the sphere.
- @rtype: L{BPy_Mesh<Mesh>}
- @return: returns a mesh object.
- """
-
-def Icosphere(subdivisions=2, diameter=2.0):
- """
- Construct a Icosphere mesh. The defaults create sphere with 2 subdivisions
- and diameter of 2 Blender units, identical to the Blender UI.
- @type subdivisions: int
- @param subdivisions: optional number of subdivisions.
- Value must be in the range [2,5].
- @type diameter: float
- @param diameter: optional diameter of the sphere.
- @rtype: L{BPy_Mesh<Mesh>}
- @return: returns a mesh object.
- """
-
-def Monkey():
- """
- Construct a Suzanne mesh.
- @rtype: L{BPy_Mesh<Mesh>}
- @return: returns a mesh object.
- """
-
diff --git a/source/blender/python/api2_2x/doc/Metaball.py b/source/blender/python/api2_2x/doc/Metaball.py
deleted file mode 100644
index 69bcbedafae..00000000000
--- a/source/blender/python/api2_2x/doc/Metaball.py
+++ /dev/null
@@ -1,246 +0,0 @@
-# Blender.Metaball module and the Metaball PyType metaball
-
-"""
-The Blender.Metaball submodule
-
-This module provides access to B{Metaball} data in Blender and the elements they contain.
-
-
-Example::
- import Blender
- mb = Blender.Metaball.New()
- for i in xrange(20):
- element= mb.elements.add()
- element.co = Blender.Mathutils.Vector(i, 0, 0)
- sce = Blender.Scene.GetCurrent()
- sce.objects.new(mb)
-
-
-
-Example::
- # Converts the active armature into metaballs
- from Blender import *
- def main():
-
- scn= Scene.GetCurrent()
- ob_arm= scn.objects.active
- if not ob_arm or ob_arm.type!='Armature':
- Draw.PupMenu('No Armature Selected')
- return
- arm= ob_arm.data
-
- res= Draw.PupFloatInput('res:', 0.2, 0.05, 2.0)
- if not res:
- return
-
- # Make a metaball
- mb= Metaball.New()
- mb.wiresize= res
-
- # Link to the Scene
- ob_mb = scn.objects.new(ob_mb)
- ob_arm.sel= 0
- ob_mb.setMatrix(ob_arm.matrixWorld)
-
-
- meta_type= 0 # all elemts are ball type
- meta_stiffness= 2.0 # Volume
-
- for bone in arm.bones.values():
- print bone
-
- # Find out how many metaballs to add based on bone length, 4 min
- length= bone.length
- if length < res:
- mballs= 4
- else:
- mballs= int(length/res)
- if mballs < 4:
- mballs = 4
-
- print 'metaball count', mballs
-
- # get the bone properties
- head_rad= bone.headRadius
- tail_rad= bone.tailRadius
-
- head_loc= bone.head['ARMATURESPACE']
- tail_loc= bone.tail['ARMATURESPACE']
-
-
- for i in range(mballs):
- f= float(i)
-
- w1= f/mballs # weighting of this position on the bone for rad and loc
- w2= 1-w1
-
- loc= head_loc*w1 + tail_loc*w2
- rad= (head_rad*w1 + tail_rad*w2) * 1.3
-
- # Add the metaball
- ml= mb.elements.add()
- ml.co= loc
- ml.radius= rad
- ml.stiffness= meta_stiffness
-
-
- Window.RedrawAll()
-
- main()
-
-@type Types: readonly dictionary
-@var Types: MeteElement types.
- - BALL
- - TUBE
- - PLANE
- - ELIPSOID
- - CUBE
-
-@type Update: readonly dictionary
-@var Update: MeteElement types.
- - ALWAYS
- - HALFRES
- - FAST
- - NEVER
-
-"""
-
-
-def New (name):
- """
- Creates a new Metaball.
- @type name: string
- @param name: The name of the metaball. If this parameter is not given (or not valid) blender will assign a name to the metaball.
- @rtype: Blender Metaball
- @return: The created Metaball.
- """
-
-def Get (name):
- """
- Get the Metaball from Blender.
- @type name: string
- @param name: The name of the requested Metaball.
- @rtype: Blender Metaball or a list of Blender Metaballs
- @return: It depends on the 'name' parameter:
- - (name): The Metaball with the given name;
- - (): A list with all Metaballs in the current scene.
- """
-
-class Metaball:
- """
- The Metaball object
- ===================
- This metaball gives access to generic data from all metaballs in Blender.
- @ivar elements: Element iterator of MetaElemSeq type.
- @type elements: MetaElemSeq
- @ivar wiresize: display resolution.
- Value clamped between 0.05 and 1.0.
-
- A lower value results in more polygons.
- @type wiresize: float
- @ivar rendersize: render resolution.
- Value clamped between 0.05 and 1.0.
-
- A lower value results in more polygons.
- @type rendersize: float
- @ivar thresh: Threshold setting for this metaball.
- Value clamped between 0.0 and 5.0.
- @type thresh: float
- @ivar materials: List of up to 16 Materials or None types
- Only the first material of the mother-ball used at the moment.
- @type materials: list
- @ivar update: The update method to use for this metaball.
- @type update: int
- """
-
- def __copy__():
- """
- Return a copy of this metaball object data.
- @rtype: Metaball
- @return: Metaball
- """
-
-import id_generics
-Metaball.__doc__ += id_generics.attributes
-
-
-class MetaElemSeq:
- """
- The MetaElemSeq object
- ======================
- This object provides sequence and iterator access to the metaballs elements.
- The elements accessed within this iterator "wraps" the actual metaball elements; changing any
- of the elements's attributes will immediately change the data in the metaball.
-
- This iterator is most like pythons 'set' type.
- """
-
- def add():
- """
- Append a new element to the metaball.
- no arguments are taken, instead a new metaelement is
- added to the metaball data and returned.
- This new element can then be modified.
-
- @return: a new meta element.
- @rtype: Metaelement
- """
-
- def remove(element):
- """
- remove an element from the metaball data.
-
- if the element is not a part of the metaball data, an error will be raised.
-
- @return: None
- @rtype: None
- """
-
- def __iter__():
- """
- Iterate over elements in this metaball.
-
- @return: One of the metaelem in this metaball.
- @rtype: Metaelem
- """
-
- def __len__():
- """
- Iterate over elements in this metaball.
-
- @return: The number of elements in this metaball
- @rtype: int
- """
-
-class Metaelem:
- """
- The Metaelem object
- ===================
- This gives direct access to meta element data within a metaball.
- @ivar type: The type of the metaball.
- Values must be from L{Types}
-
- Example::
- from Blender import Metaball
- mb= Metaball.Get('mb')
- for el in mb.elements:
- el.type= Metaball.Types.CUBE
- @type type: int
- @ivar co: The location of this element.
- @type co: Vector
- @ivar dims: Element dimensions.
- Values clamped between 0 and 20 on all axies.
- @type dims: Vector
- @ivar quat: Element rotation.
- @type quat: Quaternion
- @ivar stiffness: Element stiffness.
- Value clamped between 0 and 10.
- @type stiffness: float
- @ivar radius: Element radius.
- Value clamped between 0 and 5000.
- @type radius: float
- @ivar negative: Element negative volume status.
- @type negative: bool
- @ivar hide: Element hidden status.
- @type hide: bool
- """
diff --git a/source/blender/python/api2_2x/doc/Metaballdoc.txt b/source/blender/python/api2_2x/doc/Metaballdoc.txt
deleted file mode 100644
index 2c64a43571e..00000000000
--- a/source/blender/python/api2_2x/doc/Metaballdoc.txt
+++ /dev/null
@@ -1,58 +0,0 @@
-METABALL Module documentation
-
-
-INTRODUCTION
-The metaball module effect allows you to access all the data of an metaball.
-A metaball consists of several (maybe only one) metaelems, which are spheres, interacting with each other, thus creating soft organic volumes.
-
-
-
-functions of the module :
-New(name) : creates ans returns a metaball object.
-Get(opt : name) : if the parameter name is given, returns the metaball object whose name has been passed, or Py_None, if no such metaball exists in the current scene. If no parameter is given, returns a list of all the metaballs in the current scene.
-get : alias for Get
-
-Metaball object member functions :
-
-getName()Return Metaball name
-setName(string newname) - Sets Metaball name
-getWiresize() - Return Metaball wire size
-setWiresize(float val) - Sets Metaball wire size
-getRendersize() - Return Metaball render size
-setRendersize(float newval- Sets Metaball render size
-getThresh()- Return Metaball threshold
-setThresh(float newval)- Sets Metaball threshold
-getBbox,- Return Metaball bounding box(a list of eight lists of three elements)
-getNMetaElems() Returns the number of Metaelems (basic spheres)
-getMetatype(int num_metaelem): returns the type of the metaelem number num_metaelem.
-0 : ball
-1 : tubex
-2 : tubey
-3 : tubez
-setMetatype(int num_metaelem,int newtype) : sets the type of the metaelem number num_metaelem.
-getMetadata(field_name,int num_metaelem) gets Metaball MetaData. Explained later.
-setMetadata(field_name,int num_metaelem,newval) sets Metaball MetaData. Explained later.
-getMetalay(int num_metaelem)
-getMetax(int num_metaelem) : gets the x coordinate of the metaelement
-setMetax(int num_metaelem,float newval) : sets the x coordinate of the metaelement
-getMetay(int num_metaelem) : gets the y coordinate of the metaelement
-setMetay(int num_metaelem,float newval) : sets the y coordinate of the metaelement
-getMetaz(int num_metaelem) : gets the z coordinate of the metaelement
-setMetaz(int num_metaelem,float newval) : sets the z coordinate of the metaelement
-getMetas(int num_metaelem) : gets the s coordinate of the metaelement
-setMetas(int num_metaelem,float newval) : sets the s coordinate of the metaelement
-getMetalen(int num_metaelem) : gets the length of the metaelement. Important for tubes.
-setMetalen(int num_metaelem,float newval) : sets the length of the metaelement. Important for tubes.
-getloc, - Gets Metaball loc values
-setloc, (f f f) - Sets Metaball loc values
-getrot, () - Gets Metaball rot values
-setrot,, (f f f) - Sets Metaball rot values
-getsize,() - Gets Metaball size values
-setsize,(f f f) - Sets Metaball size values
-
-
-
-
-The Object.attribute syntax
-
-The attribute can take these values : seed,nabla,sta,end,lifetime,normfac,obfac,randfac,texfac,randlife,vectsize,totpart,force,mult,life,child,mat,defvec. \ No newline at end of file
diff --git a/source/blender/python/api2_2x/doc/Modifier.py b/source/blender/python/api2_2x/doc/Modifier.py
deleted file mode 100644
index 1d7d2e121c9..00000000000
--- a/source/blender/python/api2_2x/doc/Modifier.py
+++ /dev/null
@@ -1,226 +0,0 @@
-# Blender.Modifier module and the Modifier PyType object
-
-"""
-The Blender.Modifier submodule
-
-B{New}:
- - Supports the new Cast and Smooth modifiers.
-
-This module provides access to the Modifier Data in Blender.
-
-Example::
- from Blender import *
-
- ob = Object.Get('Cube') # retrieve an object
- mods = ob.modifiers # get the object's modifiers
- for mod in mods:
- print mod,mod.name # print each modifier and its name
- mod = mods.append(Modifier.Types.SUBSURF) # add a new subsurf modifier
- mod[Modifier.Settings.LEVELS] = 3 # set subsurf subdivision levels to 3
-
-
-Example::
- # Apply a lattice to an object and get the deformed object
- # Uses an object called 'Cube' and a lattice called 'Lattice'
-
- from Blender import *
- ob_mesh= Object.Get('Cube')
- ob_lattice= Object.Get('Lattice')
-
- myMeshMod = ob_mesh.modifiers
- mod = myMeshMod.append(Modifier.Types.LATTICE)
- mod[Modifier.Settings.OBJECT] = ob_lattice
-
- ob_mesh.makeDisplayList() # Needed to apply the modifier
-
- Window.RedrawAll() # View the change
-
- deformed_mesh= Mesh.New()
- deformed_mesh.getFromObject(ob_mesh.name)
-
-
- # Print the deformed locations
- for v in deformed_mesh.verts:
- print v.co
-
-
-
-@type Types: readonly dictionary
-@var Types: Constant Modifier dict used for L{ModSeq.append} to a
- modifier sequence and comparing with L{Modifier.type}:
- - ARMATURE - type value for Armature modifiers
- - ARRAY - type value for Array modifiers
- - BOOLEAN - type value for Boolean modifiers
- - BUILD - type value for Build modifiers
- - CURVE - type value for Curve modifiers
- - MIRROR - type value for Mirror modifiers
- - DECIMATE - type value for Decimate modifiers
- - LATTICE - type value for Lattice modifiers
- - SUBSURF - type value for Subsurf modifiers
- - WAVE - type value for Wave modifiers
- - EDGESPLIT - type value for Edge Split modifiers
- - DISPLACE - type value for Displace modifiers
- - SMOOTH - type value for Smooth modifiers
- - CAST - type value for Cast modifiers
-
-@type Settings: readonly dictionary
-@var Settings: Constant Modifier dict used for changing modifier settings.
- - RENDER - Used for all modifiers (bool) If true, the modifier is enabled for rendering.
- - REALTIME - Used for all modifiers (bool) If true, the modifier is enabled for interactive display.
- - EDITMODE - Used for all modifiers (bool) If both REALTIME and EDITMODE are true, the modifier is enabled for interactive display while the object is in edit mode.
- - ONCAGE - Used for all modifiers (bool) If true, the modifier is enabled for the editing cage during edit mode.
-
- - OBJECT - Used for Armature, Lattice, Curve, Boolean and Array (Object)
- - VERTGROUP - Used for Armature, Lattice, Curve, Smooth and Cast (String)
- - LIMIT - Array and Mirror (float [0.0 - 1.0])
- - FLAG - Mirror and Wave (int)
- - COUNT - Decimator Polycount (readonly) and Array (int)
- - LENGTH - Build [1.0-300000.0] and Array [0.0 - 10000.0] (float)
- - FACTOR - Smooth [-10.0, 10.0] and Cast [-10.0, 10.0] (float)
- - ENABLE_X = Smooth and Cast (bool, default: True)
- - ENABLE_Y = Smooth and Cast (bool, default: True)
- - ENABLE_Z = Smooth and Cast (bool, default: True)
- - TYPES - Subsurf and Cast. For Subsurf it determines the subdivision algorithm - (int): 0 = Catmull-Clark; 1 = simple subdivision. For Cast it determines the shape to deform to = (int): 0 = Sphere; 1 = Cylinder; 2 = Cuboid
-
- - LEVELS - Used for Subsurf only (int [0 - 6]). The number of subdivision levels used for interactive display.
- - RENDLEVELS - Used for Subsurf only (int [0 - 6]). The number of subdivision levels used for rendering.
- - OPTIMAL - Used for Subsurf only (bool). Enables Optimal Draw.
- - UV - Used for Subsurf only (bool). Enables Subsurf UV.
-
- - OBJECT_OFFSET - Used for Array only (Object)
- - OBJECT_CURVE - Used for Array only (Curve Object)
- - OFFSET_VEC - Used for Array only (3d Vector)
- - SCALE_VEC - Used for Array only (3d Vector)
- - MERGE_DIST - Used for Array only (float)
-
- - ENVELOPES - Used for Armature only (bool)
-
- - START - Used for Build only (int)
- - SEED - Used for Build only (int)
- - RANDOMIZE - Used for Build only (bool)
-
- - AXIS_X - Used for Mirror only (bool)
- - AXIS_Y - Used for Mirror only (bool)
- - AXIS_Z - Used for Mirror only (bool)
-
- - RATIO - Used for Decimate only (float [0.0 - 1.0])
-
- - STARTX - Used for Wave only (float [-100.0 - 100.0])
- - STARTY - Used for Wave only (float [-100.0 - 100.0])
- - HEIGHT - Used for Wave only (float [-2.0 - 2.0])
- - WIDTH - Used for Wave only (float [0.0 - 5.0])
- - NARROW - Used for Wave only (float [0.0 - 10.0])
- - SPEED - Used for Wave only (float [-2.0 - 2.0])
- - DAMP - Used for Wave only (float [-MAXFRAME - MAXFRAME])
- - LIFETIME - Used for Wave only (float [-MAXFRAME - MAXFRAME])
- - TIMEOFFS - Used for Wave only (float [-MAXFRAME - MAXFRAME])
-
- - OPERATION - Used for boolean only (int 0,1,2 : Intersect, Union, Difference)
-
- - EDGESPLIT_ANGLE - Used for edge split only (float 0.0 - 180)
- - EDGESPLIT_FROM_ANGLE - Used for edge split only, should the modifier use the edge angle (bool)
- - EDGESPLIT_FROM_SHARP - Used for edge split only, should the modifier use the edge sharp flag (bool)
-
- - UVLAYER - Used for Displace only
- - MID_LEVEL - Used for Displace only (float [0.0, 1.0], default: 0.5)
- - STRENGTH - Used for Displace only (float [-1000.0, 1000.0, default: 1.0)
- - TEXTURE - Used for Displace only (string)
- - MAPPING - Used for Displace only
- - DIRECTION - Used for Displace only
-
- - REPEAT - Used for Smooth only (int [0, 30], default: 1)
-
- - RADIUS - Used for Cast only (float [0.0, 100.0], default: 0.0)
- - SIZE - Used for Cast only (float [0.0, 100.0], default: 0.0)
- - SIZE_FROM_RADIUS - Used for Cast only (bool, default: True)
- - USE_OB_TRANSFORM - Used for Cast only (bool, default: False)
-"""
-
-class ModSeq:
- """
- The ModSeq object
- =================
- This object provides access to list of L{modifiers<Modifier.Modifier>} for a particular object.
- Only accessed from L{Object.Object.modifiers}.
- """
-
- def __getitem__(index):
- """
- This operator returns one of the object's modifiers.
- @type index: int
- @return: an Modifier object
- @rtype: Modifier
- @raise KeyError: index was out of range
- """
-
- def __len__():
- """
- Returns the number of modifiers in the object's modifier stack.
- @return: number of Modifiers
- @rtype: int
- """
-
- def append(type):
- """
- Appends a new modifier to the end of the object's modifier stack.
- @type type: a constant specifying the type of modifier to create. as from L{Types}
- @rtype: Modifier
- @return: the new Modifier
- """
-
- def remove(modifier):
- """
- Remove a modifier from this objects modifier sequence.
- @type modifier: a modifier from this sequence to remove.
- @note: Accessing attributes of the modifier after removing will raise an error.
- """
-
- def moveUp(modifier):
- """
- Moves the modifier up in the object's modifier stack.
- @type modifier: a modifier from this sequence to remove.
- @rtype: None
- @raise RuntimeError: request to move above another modifier requiring
- original data
- @note: Accessing attributes of the modifier after removing will raise an error.
- """
-
- def moveDown(modifier):
- """
- Moves the modifier down in the object's modifier stack.
- @type modifier: a modifier from this sequence to remove.
- @rtype: None
- @raise RuntimeError: request to move modifier beyond a non-deforming
- modifier
- @note: Accessing attributes of the modifier after removing will raise an error.
- """
-
-class Modifier:
- """
- The Modifier object
- ===================
- This object provides access to a modifier for a particular object accessed
- from L{ModSeq}.
- @ivar name: The name of this modifier. 31 chars max.
- @type name: string
- @ivar type: The type of this modifier. Read-only. The returned value
- matches the types in L{Types}.
- @type type: int
- """
-
- def __getitem__(key):
- """
- This operator returns one of the modifier's data attributes.
- @type key: value from modifier's L{Modifier.Settings} constant
- @return: the requested data
- @rtype: varies
- @raise KeyError: the key does not exist for the modifier
- """
-
- def __setitem__(key):
- """
- This operator modifiers one of the modifier's data attributes.
- @type key: value from modifier's L{Modifier.Settings} constant
- @raise KeyError: the key does not exist for the modifier
- """
-
diff --git a/source/blender/python/api2_2x/doc/NLA.py b/source/blender/python/api2_2x/doc/NLA.py
deleted file mode 100644
index adfcf77d965..00000000000
--- a/source/blender/python/api2_2x/doc/NLA.py
+++ /dev/null
@@ -1,245 +0,0 @@
-# Blender.Armature.NLA module and the Action PyType object
-
-"""
-The Blender.Armature.NLA submodule.
-
-NLA
-===
-
-This module provides access to B{Action} objects in Blender. Actions are a
-series of keyframes/Ipo curves that define the movement of a bone.
-Actions are linked to objects of type armature.
-
-@type Flags: readonly dictionary
-@var Flags: Constant dict used by the L{ActionStrip.flag} attribute.
-It is a bitmask and settings are ORed together.
- - SELECT: action strip is selected in NLA window
- - STRIDE_PATH: play action based on path position and stride.
- - HOLD: continue displaying the last frame past the end of the strip
- - ACTIVE: action strip is active in NLA window
- - LOCK_ACTION: action start/end are automatically mapped to strip duration
-
-@type StrideAxes: readonly dictionary
-@var StrideAxes: Constant dict used by the L{ActionStrip.strideAxis} attribute.
-Values are STRIDEAXIS_X, STRIDEAXIS_Y, and STRIDEAXIS_Z.
-
-@type Modes: readonly dictionary
-@var Modes: Constant dict used by the L{ActionStrip.mode} attribute.
-Currently the only value is MODE_ADD.
-"""
-
-def NewAction (name = 'DefaultAction'):
- """
- Create a new Action object.
- @type name: string
- @param name: The Action name.
- @rtype: PyAction
- """
-
-def CopyAction (action):
- """
- Copy an action and it's keyframes
- @type action: PyAction
- @param action: The action to be copied.
- @rtype: PyAction
- @return: A copied action
- """
-
-def GetActions ():
- """
- Get all actions and return them as a Key : Value Dictionary.
- @rtype: Dictionary of PyActions
- @return: All the actions in blender
- """
-
-class Action:
- """
- The Action object
- =================
- This object gives access to Action-specific data in Blender.
- """
-
- def getName():
- """
- Get the name of this Action.
- @rtype: string
- """
-
- def setName(name):
- """
- Set the name of this Action.
- @type name: string
- @param name: The new name
- """
-
- def setActive(object):
- """
- Set this action as the current action for an object.
- @type object: PyObject
- @param object: The object whose action is to be set
- """
-
- def getChannelIpo(channel):
- """
- Get the Ipo for the named channel in this action
- @type channel: string
- @param channel: The name of a channel in this action
- @rtype: PyIpo or None
- @return: the Ipo for the channel
- """
-
- def getFrameNumbers():
- """
- Gets the frame numbers at which a key was inserted into this action
- @rtype: PyList
- @return: a list of ints
- """
-
- def removeChannel(channel):
- """
- Remove a named channel from this action
- @type channel: string
- @param channel: The name of a channel in this action to be removed
- """
-
- def getAllChannelIpos():
- """
- Get the all the Ipos for this action
- @rtype: Dictionary [channel : PyIpo or None]
- @return: the Ipos for all the channels in the action
- """
-
- def getChannelNames():
- """
- Returns a list of channel names
- @rtype: list
- @return: the channel names that match bone and constraint names.
- """
-
- def renameChannel(nameFrom, nameTo):
- """
- rename an existing channel to a new name.
-
- if the nameFrom channel dosnt exist or the nameTo exists, an error will be raised.
- @return: None
- """
-
-import id_generics
-Action.__doc__ += id_generics.attributes
-
-
-class ActionStrips:
- """
- The ActionStrips object
- =======================
- This object gives access to sequence of L{ActionStrip} objects for
- a particular Object.
- """
-
- def __getitem__(index):
- """
- This operator returns one of the action strips in the stack.
- @type index: int
- @return: an action strip object
- @rtype: ActionStrip
- @raise KeyError: index was out of range
- """
-
- def __len__():
- """
- Returns the number of action strips for the object.
- @return: number of action strips
- @rtype: int
- """
-
- def append(action):
- """
- Appends a new action to the end of the action strip sequence.
- @type action: L{Action<NLA.Action>}
- @param action: the action to use in the action strip
- @rtype: ActionStrip
- @return: the new action strip
- """
-
- def remove(actionstrip):
- """
- Remove an action strip from this object's actionstrip sequence.
- @type actionstrip: an action strip from this sequence to remove.
- @note: Accessing attributes of the action strip after it is removed will
- throw an exception.
- """
-
- def moveDown(actionstrip):
- """
- Move the action strip down in the object's actionstrip sequence.
- @type actionstrip: an action strip from this sequence.
- """
-
- def moveUp(actionstrip):
- """
- Move the action strip up in the object's actionstrip sequence.
- @type actionstrip: an action strip from this sequence.
- """
-
-class ActionStrip:
- """
- The ActionStrip object
- ======================
- This object gives access to a particular action strip.
- @ivar action: Action associated with the strip.
- @type action: BPy Action object
- @ivar stripStart: Starting frame of the strip.
- @type stripStart: float
- @ivar stripEnd: Ending frame of the strip.
- @type stripEnd: float
- @ivar actionStart: Starting frame of the action.
- @type actionStart: float
- @ivar actionEnd: Ending frame of the action.
- @type actionEnd: float
- @ivar repeat: The number of times to repeat the action range.
- @type repeat: float
- @ivar mode: Controls the ActionStrip mode. See L{Modes} for
- valid values.
- @type mode: int
- @ivar flag: Controls various ActionStrip attributes. Values can be ORed.
- See L{Flags} for valid values.
- @type flag: int
- @ivar strideAxis: Dominant axis for stride bone. See L{StrideAxes} for
- valid values.
- @type strideAxis: int
- @ivar strideLength: Distance covered by one complete cycle of the action
- specified in the Action Range.
- @type strideLength: float
- @ivar strideBone: Name of Bone used for stride
- @type strideBone: string
- @ivar groupTarget: Armature object within DupliGroup for local animation
- @type groupTarget: object
- @ivar blendIn: Number of frames of motion blending.
- @type blendIn: float
- @ivar blendOut: Number of frames of ease-out.
- @type blendOut: float
- """
-
- def resetActionLimits():
- """
- Activates the functionality found in NLA Strip menu under "Reset Action
- Start/End". This method restores the values of ActionStart and
- ActionEnd to their defaults, usually the first and last frames within
- an action that contain keys.
- @rtype: None
- """
-
- def resetStripSize():
- """
- Activates the functionality found in NLA Strip menu under "Reset Strip
- Size". This method resets the action strip size to its creation values.
- @rtype: None
- """
-
- def snapToFrame():
- """
- Activates the functionality found in NLA Strip menu under "Snap to Frame".
- This function snaps the ends of the action strip to the nearest whole
- numbered frame.
- @rtype: None
- """
diff --git a/source/blender/python/api2_2x/doc/NMesh.py b/source/blender/python/api2_2x/doc/NMesh.py
deleted file mode 100644
index e6d779aebb8..00000000000
--- a/source/blender/python/api2_2x/doc/NMesh.py
+++ /dev/null
@@ -1,823 +0,0 @@
-# Blender.NMesh module and the NMesh PyType object
-
-"""
-The Blender.NMesh submodule.
-
-B{Deprecated}:
-This module is now maintained but not actively developed.
-
-Access to data such as properties, library, UVLayers and ColorLayers is not available
-further more, a mesh modified with NMesh will destroy inactive UV and Color layers
-so writing tools that use NMesh is discouraged.
-
-Use L{Mesh} instead.
-
-Mesh Data
-=========
-
-This module provides access to B{Mesh Data} objects in Blender.
-
-Example::
-
- import Blender
- from Blender import NMesh, Material, Window
-
- editmode = Window.EditMode() # are we in edit mode? If so ...
- if editmode: Window.EditMode(0) # leave edit mode before getting the mesh
-
- me = NMesh.GetRaw("Plane") # get the mesh data called "Plane"
-
- if not me.materials: # if there are no materials ...
- newmat = Material.New() # create one ...
- me.materials.append(newmat) # and append it to the mesh's list of mats
-
- print me.materials # print the list of materials
- mat = me.materials[0] # grab the first material in the list
- mat.R = 1.0 # redefine its red component
- for v in me.verts: # loop the list of vertices
- v.co[0] *= 2.5 # multiply the coordinates
- v.co[1] *= 5.0
- v.co[2] *= 2.5
- me.update() # update the real mesh in Blender
-
- if editmode: Window.EditMode(1) # optional, just being nice
-
-@type Modes: readonly dictionary
-@type FaceFlags: readonly dictionary
-@type FaceModes: readonly dictionary
-@type FaceTranspModes: readonly dictionary
-@var Modes: The available mesh modes.
- - NOVNORMALSFLIP - no flipping of vertex normals during render.
- - TWOSIDED - double sided mesh.
- - AUTOSMOOTH - turn auto smoothing of faces "on".
-@var FaceFlags: The available *texture face* (uv face select mode) selection
- flags. Note: these refer to TexFace faces, available if nmesh.hasFaceUV()
- returns true.
- - SELECT - selected (deprecated after 2.43 release, use face.sel).
- - HIDE - hidden (deprecated after 2.43 release, use face.sel).
- - ACTIVE - the active face.
-@var FaceModes: The available *texture face* modes. Note: these are only
- meaningful if nmesh.hasFaceUV() returns true, since in Blender this info is
- stored at the TexFace (TexFace button in Edit Mesh buttons) structure.
- - ALL - set all modes at once.
- - BILLBOARD - always orient after camera.
- - HALO - halo face, always point to camera.
- - DYNAMIC - respond to collisions.
- - INVISIBLE - invisible face.
- - LIGHT - dynamic lighting.
- - OBCOL - use object color instead of vertex colors.
- - SHADOW - shadow type.
- - SHAREDVERT - apparently unused in Blender.
- - SHAREDCOL - shared vertex colors (per vertex).
- - TEX - has texture image.
- - TILES - uses tiled image.
- - TWOSIDE - two-sided face.
-@var FaceTranspModes: The available face transparency modes. Note: these are
- enumerated values (enums), they can't be combined (ANDed, ORed, etc) like a bit vector.
- - SOLID - draw solid.
- - ADD - add to background (halo).
- - ALPHA - draw with transparency.
- - SUB - subtract from background.
-@var EdgeFlags: The available edge flags.
- - SELECT - selected.
- - EDGEDRAW - edge is drawn out of edition mode.
- - SEAM - edge is a seam for UV unwrapping
- - FGON - edge is part of a F-Gon.
-"""
-
-def Col(col = [255, 255, 255, 255]):
- """
- Get a new mesh rgba color.
- @type col: list
- @param col: A list [red, green, blue, alpha] of integer values in [0, 255].
- @rtype: NMCol
- @return: A new NMCol (mesh rgba color) object.
- """
-
-def Vert(x = 0, y = 0, z = 0):
- """
- Get a new vertex object.
- @type x: float
- @type y: float
- @type z: float
- @param x: The x coordinate of the vertex.
- @param y: The y coordinate of the vertex.
- @param z: The z coordinate of the vertex.
- @rtype: NMVert
- @return: A new NMVert object.
- """
-
-def Face(vertexList = None):
- """
- Get a new face object.
- @type vertexList: list
- @param vertexList: A list of B{up to 4} NMVerts (mesh vertex
- objects).
- @rtype: NMFace
- @return: A new NMFace object.
- """
-
-def New(name = 'Mesh'):
- """
- Create a new mesh object.
- @type name: string
- @param name: An optional name for the created mesh.
- rtype: NMesh
- @return: A new (B{empty}) NMesh object.
- """
-
-def GetRaw(name = None):
- """
- Get the mesh data object called I{name} from Blender.
- @type name: string
- @param name: The name of the mesh data object.
- @rtype: NMesh
- @return: It depends on the 'name' parameter:
- - (name) - The NMesh wrapper of the mesh called I{name},
- None if not found.
- - () - A new (empty) NMesh object.
- """
-
-def GetNames():
- """
- Get a list with the names of all available meshes in Blender.
- @rtype: list of strings
- @return: a list of mesh names.
- @note: to get actual mesh data, pass a mesh name to L{GetRaw}.
- """
-
-def GetRawFromObject(name):
- """
- Get the raw mesh data object from the Object in Blender called I{name}.\n
- Note: The mesh coordinates are in local space, not the world space of its Object.\n
- For world space vertex coordinates, each vertex location must be multiplied by the object's 4x4 matrix.
- This function support all the geometry based objects: Mesh, Text, Surface, Curve, Meta.
- @type name: string
- @param name: The name of an Object.
- @rtype: NMesh
- @return: The NMesh wrapper of the mesh data from the Object called I{name}.
- @note: For "subsurfed" meshes, it's the B{display} level of subdivision that
- matters, the rendering one is only processed at the rendering pre-stage
- and is not available for scripts. This is not a problem at all, since
- you can get and set the subdivision levels via scripting, too (see
- L{NMesh.NMesh.getSubDivLevels}, L{NMesh.NMesh.setSubDivLevels}).
- @note: Meshes extracted from curve based objects (Font/2D filled curves)
- contain both the filled surfaces and the outlines of the shapes.
- @warn: This function gets I{deformed} mesh data, already modified for
- displaying (think "display list"). It also doesn't let you overwrite the
- original mesh in Blender, so if you try to update it, a new mesh will
- be created.
- @warn: For Meta Object's, this function will only return a NMesh with some geometry
- when called on the base element (the one with the shortest name).
- """
-
-def PutRaw(nmesh, name = None, recalc_normals = 1, store_edges = 0):
- """
- Put a BPython NMesh object as a mesh data object in Blender.
- @note: if there is already a mesh with the given 'name', its contents are
- freed and the new data is put in it. Also, if this mesh is not linked to any
- object, a new object for it is created. Reminder: in Blender an object is
- composed of the base object and linked object data (mesh, metaball, camera,
- etc. etc).
- @type nmesh: NMesh
- @type name: string
- @type recalc_normals: int
- @type store_edges: int
- @param name: The name of the mesh data object in Blender which will receive
- this nmesh data. It can be an existing mesh data object or a new one.
- @param recalc_normals: If non-zero, the vertex normals for the mesh will
- be recalculated.
- @param store_edges: deprecated, edges are always stored now.
- @rtype: None or Object
- @return: It depends on the 'name' parameter:
- - I{name} refers to an existing mesh data obj already linked to an
- object: return None.
- - I{name} refers to a new mesh data obj or an unlinked (no users) one:
- return the created Blender Object wrapper.
- """
-
-class NMCol:
- """
- The NMCol object
- ================
- This object is a list of ints: [r, g, b, a] representing an
- rgba color.
- @ivar r: The Red component in [0, 255].
- @ivar g: The Green component in [0, 255].
- @ivar b: The Blue component in [0, 255].
- @ivar a: The Alpha (transparency) component in [0, 255].
- """
-
-class NMVert:
- """
- The NMVert object
- =================
- This object holds mesh vertex data.
- @type co: 3D Vector object. (WRAPPED DATA)
- @ivar co: The vertex coordinates (x, y, z).
- @type no: 3D Vector object. (unit length) (WRAPPED DATA)
- @ivar no: The vertex normal vector (x, y, z).
- @type uvco: 3D Vector object. (WRAPPED DATA)
- @ivar uvco: The vertex texture "sticky" coordinates. The Z value of the Vector is ignored.
- @type index: int
- @ivar index: The vertex index, if owned by a mesh.
- @type sel: int
- @ivar sel: The selection state (selected:1, unselected:0) of this vertex.\n
- Note: An NMesh will return the selection state of the mesh when EditMod was last exited. A python script operating in EditMode must exit edit mode, before getting the current selection state of the mesh.
- @warn: There are two kinds of uv texture coordinates in Blender: per vertex
- ("sticky") and per face vertex (uv in L{NMFace}). In the first, there's
- only one uv pair of coordinates for each vertex in the mesh. In the
- second, for each face it belongs to, a vertex can have different uv
- coordinates. This makes the per face option more flexible, since two
- adjacent faces won't have to be mapped to a continuous region in an image:
- each face can be independently mapped to any part of its texture.
- """
-
-class NMEdge:
- """
- The NMEdge object
- =================
- This object holds mesh edge data.
- @type v1: NMVert
- @ivar v1: The first vertex of the edge.
- @type v2: NMVert
- @ivar v2: The second vertex of the edge.
- @type crease: int
- @ivar crease: The crease value of the edge. It is in the range [0,255].
- @type flag: int
- @ivar flag: The bitmask describing edge properties. See L{NMesh.EdgeFlags<EdgeFlags>}.
- """
-
-class NMFace:
- """
- The NMFace object
- =================
- This object holds mesh face data.
-
- Example::
- import Blender
- from Blender import NMesh, Window
-
- in_emode = Window.EditMode()
- if in_emode: Window.EditMode(0)
-
- me = NMesh.GetRaw("Mesh")
- faces = me.faces
-
- ## Example for editmode faces selection:
- selected_faces = []
- for f in faces:
- if f.sel:
- selected_faces.append(f)
- # ... unselect selected and select all the others:
- for f in faces:
- f.sel = 1 - f.sel # 1 becomes 0, 0 becomes 1
-
- ## Example for uv textured faces selection:
- selected_faces = []
- SEL = NMesh.FaceFlags['SELECT']
- # get selected faces:
- for f in faces:
- if f.flag & SEL:
- selected_faces.append(f)
- # ... unselect selected and select all the others:
- for f in faces:
- if f.flag & SEL:
- f.flag &=~SEL # unselect these
- else: f.flag |= SEL # and select these
-
- me.update()
- if in_emode: Window.EditMode(1)
- Blender.Redraw()
-
- @type v: list
- @ivar v: The list of face vertices (B{up to 4}).
- @type sel: bool
- @ivar sel: The selection state (1: selected, 0: unselected) of this NMesh's
- faces *in edit mode*. This is not the same as the selection state of
- the textured faces (see L{flag}).
- @type hide: bool
- @ivar hide: The visibility state (1: hidden, 0: visible) of this NMesh's
- faces *in edit mode*. This is not the same as the visibility state of
- the textured faces (see L{flag}).
- @ivar col: The list of vertex colors.
- @ivar mat: Same as I{materialIndex} below.
- @ivar materialIndex: The index of this face's material in its NMesh materials
- list.
- @ivar smooth: If non-zero, the vertex normals are averaged to make this
- face look smooth.
- @ivar image: The Image used as a texture for this face.
- @ivar mode: The display mode (see L{Mesh.FaceModes<FaceModes>})
- @ivar flag: Bit vector specifying selection / visibility flags for uv
- textured faces (visible in Face Select mode, see
- L{NMesh.FaceFlags<FaceFlags>}).
- @ivar transp: Transparency mode bit vector
- (see L{NMesh.FaceTranspModes<FaceTranspModes>}).
- @ivar uv: List of per-face UV coordinates: [(u0, v0), (u1, v1), ...].
- @ivar normal: (or just B{no}) The normal vector for this face: [x,y,z].
- @note: there are normal faces and textured faces in Blender, both currently
- with their own selection and visibility states, due to a mix of old and new
- code. To (un)select or (un)hide normal faces (visible in editmode), use
- L{sel} and L{hide} variables. For textured faces (Face Select
- mode in Blender) use the old L{flag} bitflag. Also check the
- example above and note L{Window.EditMode}.
- @note: Assigning uv textures to mesh faces in Blender works like this:
- 1. Select your mesh.
- 2. Enter face select mode (press f) and select at least some face(s).
- 3. In the UV/Image Editor window, load / select an image.
- 4. Play in both windows (better split the screen to see both at the same
- time) until the uv coordinates are where you want them. Hint: in the
- 3d window, the 'u' key opens a menu of default uv choices and the 'r'
- key lets you rotate the uv coordinates.
- 5. Leave face select mode (press f).
- """
-
- def append(vertex):
- """
- Append a vertex to this face's vertex list.
- @type vertex: NMVert
- @param vertex: An NMVert object.
- """
-
-from IDProp import IDGroup, IDArray
-class NMesh:
- """
- The NMesh Data object
- =====================
- This object gives access to mesh data in Blender. We refer to mesh as the
- object in Blender and NMesh as its Python counterpart.
- @ivar properties: Returns an L{IDGroup<IDProp.IDGroup>} reference to this
- object's ID Properties.
- @type properties: L{IDGroup<IDProp.IDGroup>}
- @ivar name: The NMesh name. It's common to use this field to store extra
- data about the mesh (to be exported to another program, for example).
- @ivar materials: The list of materials used by this NMesh. See
- L{getMaterials} for important details.
- @ivar verts: The list of NMesh vertices (NMVerts).
- @ivar users: The number of Objects using (linked to) this mesh.
- @ivar faces: The list of NMesh faces (NMFaces).
- @ivar edges: A list of L{NMEdge} edges.
- @ivar mode: The mode flags for this mesh. See L{setMode}.
- @ivar subDivLevels: The [display, rendering] subdivision levels in [1, 6].
- @ivar maxSmoothAngle: The max angle for auto smoothing. See L{setMode}.
- @cvar key: The L{Key.Key} object attached to this mesh, if any.
- """
-
- def addEdge(v1, v2):
- """
- Create an edge between two vertices.
- If an edge already exists between those vertices, it is returned.
- Created edge is automatically added to edges list.
- You can only call this method if mesh has edge data.
- @note: In Blender only zero or one edge can link two vertices.
- @type v1: NMVert
- @param v1: the first vertex of the edge.
- @type v2: NMVert
- @param v2: the second vertex of the edge.
- @rtype: NMEdge
- @return: The created or already existing edge.
- """
-
- def findEdge(v1, v2):
- """
- Try to find an edge between two vertices.
- If no edge exists between v1 and v2, None is returned.
- You can only call this method if mesh has edge data.
- @type v1: NMVert
- @param v1: the first vertex of the edge.
- @type v2: NMVert
- @param v2: the second vertex of the edge.
- @rtype: NMEdge
- @return: The found edge. None if no edge was found.
- """
-
- def removeEdge(v1, v2):
- """
- Remove an edge between two vertices.
- All faces using this edge are removed from faces list.
- You can only call this method if mesh has edge data.
- @type v1: NMVert
- @param v1: the first vertex of the edge.
- @type v2: NMVert
- @param v2: the second vertex of the edge.
- """
-
- def addFace(face):
- """
- Add a face to face list and add to edge list (if edge data exists) necessary edges.
- @type face: NMFace
- @param face: the face to add to the mesh.
- @rtype: list of NMEdge
- @return: If mesh has edge data, return the list of face edges.
- """
-
- def removeFace(face):
- """
- Remove a face for face list and remove edges no more used by any other face (if edge data exists).
- @type face: NMFace
- @param face: the face to add to the mesh.
- """
-
- def addMaterial(material):
- """
- Add a new material to this NMesh's list of materials. This method is the
- slower but safer way to add materials, since it checks if the argument
- given is really a material, imposes a limit of 16 materials and only adds
- the material if it wasn't already in the list.
- @type material: Blender Material
- @param material: A Blender Material.
- """
-
- def getMaterials(what = -1):
- """
- Get this NMesh's list of materials.
- @type what: int
- @param what: determines the list's contents:
- - -1: return the current NMesh's list;
- - 0: retrieve a fresh list from the Blender mesh -- eventual
- modifications made by the script not included, unless
- L{update} is called before this method;
- - 1: like 0, but empty slots are not ignored, they are returned as
- None's.
- @note: what >= 0 also updates nmesh.materials attribute.
- @rtype: list of materials
- @return: the requested list of materials.
- @note: if a user goes to the material buttons window and removes some
- mesh's link to a material, that material slot becomes empty.
- Previously such materials were ignored.
- @note: L{Object.colbits<Object.Object.colbits>} needs to be set correctly
- for each object in order for these materials to be used instead of
- the object's materials.
- """
-
- def setMaterials(matlist):
- """
- Set this NMesh's list of materials. This method checks the consistency of
- the passed list: must only have materials or None's and can't contain more
- than 16 entries.
- @type matlist: list of materials
- @param matlist: a list with materials, None's also accepted (they become
- empty material slots in Blender.
- @note: L{Object.colbits<Object.Object.colbits>} needs to be set correctly
- for each object in order for these materials to be used instead of
- the object's materials.
- """
-
- def hasVertexColours(flag = None):
- """
- Get (and optionally set) if this NMesh has vertex colors.
- @type flag: int
- @param flag: If given and non-zero, the "vertex color" flag for this NMesh
- is turned I{on}.
- @rtype: bool
- @return: The current value of the "vertex color" flag.
- @warn: If a mesh has both vertex colors and textured faces, this function
- will return False. This is due to the way Blender deals internally with
- the vertex colors array (if there are textured faces, it is copied to
- the textured face structure and the original array is freed/deleted).
- If you want to know if a mesh has both textured faces and vertex
- colors, set *in Blender* the "VCol Paint" flag for each material that
- covers an area that was also vertex painted and then check in your
- Python script if that material flag is set. Of course also tell others
- who use your script to do the same. The "VCol Paint" material mode flag
- is the way to tell Blender itself to render with vertex colors, too, so
- it's a natural solution.
- """
-
- def hasFaceUV(flag = None):
- """
- Get (and optionally set) if this NMesh has UV-mapped textured faces.
- @type flag: int
- @param flag: If given and non-zero, the "textured faces" flag for this
- NMesh is turned I{on}.
- @rtype: bool
- @return: The current value of the "textured faces" flag.
- """
-
- def hasVertexUV(flag = None):
- """
- Get (and optionally set) the "sticky" flag that controls if a mesh has
- per vertex UV coordinates.
- @type flag: int
- @param flag: If given and non-zero, the "sticky" flag for this NMesh is
- turned I{on}.
- @rtype: bool
- @return: The current value of the "sticky" flag.
- """
-
- def getActiveFace():
- """
- Get the index of the active face.
- @rtype: int
- @return: The index of the active face.
- """
-
- def getSelectedFaces(flag = None):
- """
- Get list of selected faces.
- @type flag: int
- @param flag: If given and non-zero, the list will have indices instead of
- the NMFace objects themselves.
- @rtype: list
- @return: It depends on the I{flag} parameter:
- - if None or zero: List of NMFace objects.
- - if non-zero: List of indices to NMFace objects.
- @warn: this method exists to speed up retrieving of selected faces from
- the actual mesh in Blender. So, if you make changes to the nmesh, you
- need to L{update} it before using this method.
- """
-
- def getVertexInfluences(index):
- """
- Get influences of bones in a specific vertex.
- @type index: int
- @param index: The index of a vertex.
- @rtype: list of lists
- @return: List of pairs (name, weight), where name is the bone name (string)
- and its weight is a float value.
- """
-
- def getKey():
- """
- Get the Key object representing the Vertex Keys (absolute or
- relative) assigned to this mesh.
- @rtype: L{Key.Key} object or None
- """
-
- def insertKey(frame = None, type = 'relative'):
- """
- Insert a mesh key at the given frame. Remember to L{update} the nmesh
- before doing this, or changes in the vertices won't be updated in the
- Blender mesh.
- @type frame: int
- @type type: string
- @param frame: The Scene frame where the mesh key should be inserted. If
- None, the current frame is used.
- @param type: The mesh key type: 'relative' or 'absolute'. This is only
- relevant on the first call to insertKey for each nmesh (and after all
- keys were removed with L{removeAllKeys}, of course).
- @warn: This and L{removeAllKeys} were included in this release only to
- make accessing vertex keys possible, but may not be a proper solution
- and may be substituted by something better later. For example, it
- seems that 'frame' should be kept in the range [1, 100]
- (the curves can be manually tweaked in the Ipo Curve Editor window in
- Blender itself later).
- """
-
- def removeAllKeys():
- """
- Remove all mesh keys stored in this mesh.
- @rtype: bool
- @return: True if successful or False if this NMesh wasn't linked to a real
- Blender Mesh yet (or was, but the Mesh had no keys).
- @warn: Currently the mesh keys from meshes that are grabbed with
- NMesh.GetRaw() or .GetRawFromObject() are preserved, so if you want to
- clear them or don't want them at all, remember to call this method. Of
- course NMeshes created with NMesh.New() don't have mesh keys until you
- add them.
- """
-
- def update(recalc_normals = 0, store_edges = 0, vertex_shade = 0):
- """
- Update the mesh in Blender. The changes made are put back to the mesh in
- Blender, if available, or put in a newly created mesh if this NMesh wasn't
- already linked to one.
- @type recalc_normals: int (bool)
- @param recalc_normals: if nonzero the vertex normals are recalculated.
- @type store_edges: int (bool)
- @param store_edges: deprecated, edges are always stored now.
- @type vertex_shade: int (bool)
- @param vertex_shade: if nonzero vertices are colored based on the
- current lighting setup, like when there are no vertex colors and no
- textured faces and a user enters Vertex Paint Mode in Blender (only
- lamps in visible layers account). To use this functionality, be out of
- edit mode or else an error will be returned.
- @warn: edit mesh and normal mesh are two different structures in Blender,
- synchronized upon leaving or entering edit mode. Always remember to
- leave edit mode (L{Window.EditMode}) before calling this update
- method, or your changes will be lost. Even better: for the same reason
- programmers should leave EditMode B{before} getting a mesh, or changes
- made to the editmesh in Blender may not be visible to your script
- (check the example at the top of NMesh module doc).
- @warn: unlike the L{PutRaw} function, this method doesn't check validity of
- vertex, face and material lists, because it is meant to be as fast as
- possible (and already performs many tasks). So programmers should make
- sure they only feed proper data to the nmesh -- a good general
- recommendation, of course. It's also trivial to write code to check
- all data before updating, for example by comparing each item's type
- with the actual L{Types}, if you need to.
- @note: this method also redraws the 3d view and -- if 'vertex_shade' is
- nonzero -- the edit buttons window.
- @note: if your mesh disappears after it's updated, try
- L{Object.Object.makeDisplayList}. 'Subsurf' meshes (see L{getMode},
- L{setMode}) need their display lists updated, too.
- """
-
- def transform(matrix, recalc_normals = False):
- """
- Transforms the mesh by the specified 4x4 matrix, as returned by
- L{Object.Object.getMatrix}, though this will work with any invertible 4x4
- matrix type. Ideal usage for this is exporting to an external file where
- global vertex locations are required for each object.
- Sometimes external renderers or file formats do not use vertex normals.
- In this case, you can skip transforming the vertex normals by leaving
- the optional parameter recalc_normals as False or 0 ( the default value ).
-
- Example::
- # This script outputs deformed meshes worldspace vertex locations
- # for a selected object
- import Blender
- from Blender import NMesh, Object
-
- ob = Object.GetSelected()[0] # Get the first selected object
- me = NMesh.GetRawFromObject(ob.name) # Get the objects deformed mesh data
- me.transform(ob.matrix)
-
- for v in me.verts:
- print 'worldspace vert', v.co
-
- @type matrix: Py_Matrix
- @param matrix: 4x4 Matrix which can contain location, scale and rotation.
- @type recalc_normals: int (bool)
- @param recalc_normals: if True or 1, transform normals as well as vertex coordinates.
- @warn: if you call this method and later L{update} the mesh, the new
- vertex positions will be passed back to Blender, but the object
- matrix of each object linked to this mesh won't be automatically
- updated. You need to set the object transformations (rotation,
- translation and scaling) to identities, then, or the mesh data will
- be changed ("transformed twice").
- """
-
- def getMode():
- """
- Get this mesh's mode flags.
- @rtype: int
- @return: ORed value. See L{Modes}.
- """
-
- def setMode(m=None, m1=None, m2=None):
- """
- Set the mode flags for this mesh. Given mode strings turn the mode "on".
- Modes not passed in are turned "off", so setMode() (without arguments)
- unsets all mode flags.
- @type m: string or int (bitflag)
- @param m: mode string or int. An int (see L{Modes}) or from none to 3
- strings can be given:
- - "NoVNormalsFlip"
- - "TwoSided"
- - "AutoSmooth"
- """
-
- def addVertGroup(group):
- """
- Add a named and empty vertex (deform) group to the object this nmesh is
- linked to. If this nmesh was newly created or accessed with GetRaw, it must
- first be linked to an object (with object.link or NMesh.PutRaw) so the
- method knows which object to update.\n
- This is because vertex groups in Blender are stored in I{the object} --
- not in the mesh, which may be linked to more than one object. For this
- reason, it's better to use "mesh = object.getData()" than
- "mesh = NMesh.GetRaw(meshName)" to access an existing mesh.
- @type group: string
- @param group: the name for the new group.
- """
-
- def removeVertGroup(group):
- """
- Remove a named vertex (deform) group from the object linked to this nmesh.
- All vertices assigned to the group will be removed (just from the group,
- not deleted from the mesh), if any. If this nmesh was newly created, it
- must first be linked to an object (read the comment in L{addVertGroup} for
- more info).
- @type group: string
- @param group: the name of a vertex group.
- """
-
- def assignVertsToGroup(group, vertList, weight, assignmode = 'replace'):
- """
- Adds an array (a python list) of vertex points to a named vertex group
- associated with a mesh. The vertex list is a list of vertex indices from
- the mesh. You should assign vertex points to groups only when the mesh has
- all its vertex points added to it and is already linked to an object.
-
- I{B{Example:}}
- The example here adds a new set of vertex indices to a sphere primitive::
- import Blender
- sphere = Blender.Object.Get('Sphere')
- mesh = sphere.getData()
- mesh.addVertGroup('firstGroup')
- vertList = []
- for x in range(300):
- if x % 3 == 0:
- vertList.append(x)
- mesh.assignVertsToGroup('firstGroup', vertList, 0.5, 'add')
-
- @type group: string
- @param group: the name of the group.
- @type vertList: list of ints
- @param vertList: a list of vertex indices.
- @type weight: float
- @param weight: the deform weight for (which means: the amount of influence
- the group has over) the given vertices. It should be in the range
- [0.0, 1.0]. If weight <= 0, the given vertices are removed from the
- group. If weight > 1, it is clamped.
- @type assignmode: string
- @param assignmode: Three choices:
- - 'add'
- - 'subtract'
- - 'replace'\n
-
- 'B{add}': if the vertex in the list is not assigned to the group
- already, this creates a new association between this vertex and the
- group with the weight specified, otherwise the weight given is added to
- the current weight of an existing association between the vertex and
- group.\n
- 'B{subtract}' will attempt to subtract the weight passed from a vertex
- already associated with a group, else it does nothing.\n
- 'B{replace}' attempts to replace a weight with the new weight value
- for an already associated vertex/group, else it does nothing.
- """
-
- def removeVertsFromGroup(group, vertList = None):
- """
- Remove a list of vertices from the given group. If this nmesh was newly
- created, it must first be linked to an object (check L{addVertGroup}).
- @type group: string
- @param group: the name of a vertex group
- @type vertList: list of ints
- @param vertList: a list of vertex indices to be removed from the given
- 'group'. If None, all vertices are removed -- the group is emptied.
- """
-
- def getVertsFromGroup(group, weightsFlag = 0, vertList = None):
- """
- Return a list of vertex indices associated with the passed group. This
- method can be used to test whether a vertex index is part of a group and
- if so, what its weight is.
-
- I{B{Example:}}
- Append this to the example from L{assignVertsToGroup}::
- # ...
- print "Vertex indices from group %s :" % groupName
- print mesh.getVertsFromGroup('firstGroup')
- print "Again, with weights:"
- print mesh.getVertsFromGroup('firstGroup',1)
- print "Again, with weights and restricted to the given indices:"
- print mesh.getVertsFromGroup('firstGroup',1,[1,2,3,4,5,6])
-
- @type group: string
- @param group: the group name.
- @type weightsFlag: bool
- @param weightsFlag: if 1, the weight is returned along with the index.
- @type vertList: list of ints
- @param vertList: if given, only those vertex points that are both in the
- list and group passed in are returned.
- """
-
- def renameVertGroup(groupName, newName):
- """
- Renames a vertex group.
- @type groupName: string
- @param groupName: the vertex group name to be renamed.
- @type newName: string
- @param newName: the name to replace the old name.
- """
-
- def getVertGroupNames():
- """
- Return a list of all vertex group names.
- @rtype: list of strings
- @return: returns a list of strings representing all vertex group
- associated with the mesh's object
- """
-
- def getMaxSmoothAngle():
- """
- Get the max angle for auto smoothing.
- Note: This will only affect smoothing generated at render time.
- Smoothing can also be set per face which is visible in Blenders 3D View.
- @return: The value in degrees.
- """
-
- def setMaxSmoothAngle(angle):
- """
- Set the max angle for auto smoothing.
- @type angle: int
- @param angle: The new value in degrees -- it's clamped to [1, 80].
- """
-
- def getSubDivLevels():
- """
- Get the mesh subdivision levels for realtime display and rendering.
- @return: list of ints: [display, render].
- """
-
- def setSubDivLevels(subdiv):
- """
- Set the mesh subdivision levels for realtime display and rendering.
- @type subdiv: list of 2 ints
- @param subdiv: new subdiv levels: [display, render]. Both are clamped to
- lie in the range [1, 6].
- """
-
-
diff --git a/source/blender/python/api2_2x/doc/Noise.py b/source/blender/python/api2_2x/doc/Noise.py
deleted file mode 100644
index 5a246031fd0..00000000000
--- a/source/blender/python/api2_2x/doc/Noise.py
+++ /dev/null
@@ -1,300 +0,0 @@
-# Blender.Noise submodule
-
-"""
-The Blender.Noise submodule.
-
-Noise and Turbulence
-====================
-
-This module can be used to generate noise of various types. This can be used
-for terrain generation, to create textures, make animations more 'animated',
-object deformation, etc. As an example, this code segment when scriptlinked
-to a framechanged event, will make the camera sway randomly about, by changing
-parameters this can look like anything from an earthquake to a very nervous or
-maybe even drunk cameraman... (the camera needs an ipo with at least one Loc &
-Rot key for this to work!):
-
-Example::
- from Blender import Get, Scene, Noise
- ####################################################
- # This controls jitter speed
- sl = 0.025
- # This controls the amount of position jitter
- sp = 0.1
- # This controls the amount of rotation jitter
- sr = 0.25
- ####################################################
-
- time = Get('curtime')
- ob = Scene.GetCurrent().getCurrentCamera()
- ps = (sl*time, sl*time, sl*time)
- # To add jitter only when the camera moves, use this next line instead
- #ps = (sl*ob.LocX, sl*ob.LocY, sl*ob.LocZ)
- rv = Noise.vTurbulence(ps, 3, 0, Noise.NoiseTypes.NEWPERLIN)
- ob.dloc = (sp*rv[0], sp*rv[1], sp*rv[2])
- ob.drot = (sr*rv[0], sr*rv[1], sr*rv[2])
-
-@type NoiseTypes: readonly dictionary
-@var NoiseTypes: The available noise types.
- - BLENDER
- - STDPERLIN
- - NEWPERLIN
- - VORONOI_F1
- - VORONOI_F2
- - VORONOI_F3
- - VORONOI_F4
- - VORONOI_F2F1
- - VORONOI_CRACKLE
- - CELLNOISE
-
-@type DistanceMetrics: readonly dictionary
-@var DistanceMetrics: The available distance metrics values for Voronoi.
- - DISTANCE
- - DISTANCE_SQUARED
- - MANHATTAN
- - CHEBYCHEV
- - MINKOVSKY_HALF
- - MINKOVSKY_FOUR
- - MINKOVISKY
-"""
-
-NoiseTypes = {'BLENDER':0, 'STDPERLIN':1}
-
-DistanceMetrics = {'DISTANCE':0}
-
-def random ():
- """
- Returns a random floating point number."
- @rtype: float
- @return: a random number in [0, 1).
- """
-
-def randuvec ():
- """
- Returns a random unit vector.
- @rtype: 3-float list
- @return: a list of three floats.
- """
-
-def setRandomSeed (seed):
- """
- Initializes the random number generator.
- @type seed: int
- @param seed: the seed for the random number generator. If seed = 0, the
- current time will be used as seed, instead.
- """
-
-def noise (xyz, type = NoiseTypes['STDPERLIN']):
- """
- Returns general noise of the optional specified type.
- @type xyz: tuple of 3 floats
- @param xyz: (x,y,z) float values.
- @type type: int
- @param type: the type of noise to return. See L{NoiseTypes}.
- @rtype: float
- @return: the generated noise value.
- """
-
-def vNoise (xyz, type = NoiseTypes['STDPERLIN']):
- """
- Returns noise vector of the optional specified type.
- @type xyz: tuple of 3 floats
- @param xyz: (x,y,z) float values.
- @type type: int
- @param type: the type of noise to return. See L{NoiseTypes}.
- @rtype: 3-float list
- @return: the generated noise vector.
- """
-
-def turbulence (xyz, octaves, hard, basis = NoiseTypes['STDPERLIN'],
- ampscale = 0.5, freqscale = 2.0):
- """
- Returns general turbulence value using the optional specified noise 'basis'
- function.
- @type xyz: 3-float tuple
- @param xyz: (x,y,z) float values.
- @type octaves: int
- @param octaves: number of noise values added.
- @type hard: bool
- @param hard: noise hardness: 0 - soft noise; 1 - hard noise. (Returned value
- is always positive.)
- @type basis: int
- @param basis: type of noise used for turbulence, see L{NoiseTypes}.
- @type ampscale: float
- @param ampscale: amplitude scale value of the noise frequencies added.
- @type freqscale: float
- @param freqscale: frequency scale factor.
- @rtype: float
- @return: the generated turbulence value.
- """
-
-def vTurbulence (xyz, octaves, hard, basis = NoiseTypes['STDPERLIN'],
- ampscale = 0.5, freqscale = 2.0):
- """
- Returns general turbulence vector using the optional specified noise basis
-function.
- @type xyz: 3-float tuple
- @param xyz: (x,y,z) float values.
- @type octaves: int
- @param octaves: number of noise values added.
- @type hard: bool
- @param hard: noise hardness: 0 - soft noise; 1 - hard noise. (Returned
- vector is always positive.)
- @type basis: int
- @param basis: type of noise used for turbulence, see L{NoiseTypes}.
- @type ampscale: float
- @param ampscale: amplitude scale value of the noise frequencies added.
- @type freqscale: float
- @param freqscale: frequency scale factor.
- @rtype: 3-float list
- @return: the generated turbulence vector.
- """
-
-def fBm (xyz, H, lacunarity, octaves, basis = NoiseTypes['STDPERLIN']):
- """
- Returns Fractal Brownian Motion noise value (fBm).
- @type xyz: 3-float tuple
- @param xyz: (x,y,z) float values.
- @type H: float
- @param H: the fractal increment parameter.
- @type lacunarity: float
- @param lacunarity: the gap between successive frequencies.
- @type octaves: float
- @param octaves: the number of frequencies in the fBm.
- @type basis: int
- @param basis: type of noise used for the turbulence, see L{NoiseTypes}.
- @rtype: float
- @return: the generated noise value.
- """
-
-def multiFractal (xyz, H, lacunarity, octaves, basis = NoiseTypes['STDPERLIN']):
- """
- Returns Multifractal noise value.
- @type xyz: 3-float tuple
- @param xyz: (x,y,z) float values.
- @type H: float
- @param H: the highest fractal dimension.
- @type lacunarity: float
- @param lacunarity: the gap between successive frequencies.
- @type octaves: float
- @param octaves: the number of frequencies in the fBm.
- @type basis: int
- @param basis: type of noise used for the turbulence, see L{NoiseTypes}.
- @rtype: float
- @return: the generated noise value.
- """
-
-def vlNoise (xyz, distortion, type1 = NoiseTypes['STDPERLIN'],
- type2 = NoiseTypes['STDPERLIN']):
- """
- Returns Variable Lacunarity Noise value, a distorted variety of noise.
- @type xyz: 3-float tuple
- @param xyz: (x,y,z) float values.
- @type distortion: float
- @param distortion: the amount of distortion.
- @type type1: int
- @type type2: int
- @param type1: sets the noise type to distort.
- @param type2: sets the noise type used for the distortion.
- @rtype: float
- @return: the generated noise value.
- """
-
-def heteroTerrain (xyz, H, lacunarity, octaves, offset,
- basis = NoiseTypes['STDPERLIN']):
- """
- Returns Heterogeneous Terrain value.
- @type xyz: 3-float tuple
- @param xyz: (x,y,z) float values.
- @type H: float
- @param H: fractal dimension of the roughest areas.
- @type lacunarity: float
- @param lacunarity: gap between successive frequencies.
- @type octaves: float
- @param octaves: number of frequencies in the fBm.
- @type offset: float
- @param offset: it raises the terrain from 'sea level'.
- @type basis: int
- @param basis: noise basis determines the type of noise used for the
- turbulence, see L{NoiseTypes}.
- @rtype: float
- @return: the generated value.
- """
-
-def hybridMFractal (xyz, H, lacunarity, octaves, offset, gain,
- basis = NoiseTypes['STDPERLIN']):
- """
- Returns Hybrid Multifractal value.
- @type xyz: 3-float tuple
- @param xyz: (x,y,z) float values.
- @type H: float
- @param H: fractal dimension of the roughest areas.
- @type lacunarity: float
- @param lacunarity: gap between successive frequencies.
- @type octaves: float
- @param octaves: number of frequencies in the fBm.
- @type offset: float
- @param offset: it raises the terrain from 'sea level'.
- @type gain: float
- @param gain: scale factor.
- @type basis: int
- @param basis: noise basis determines the type of noise used for the
- turbulence, see L{NoiseTypes}.
- @rtype: float
- @return: the generated value.
- """
-
-def ridgedMFractal (xyz, H, lacunarity, octaves, offset, gain,
- basis = NoiseTypes['STDPERLIN']):
- """
- Returns Ridged Multifractal value.
- @type xyz: 3-float tuple
- @param xyz: (x,y,z) float values.
- @type H: float
- @param H: fractal dimension of the roughest areas.
- @type lacunarity: float
- @param lacunarity: gap between successive frequencies.
- @type octaves: float
- @param octaves: number of frequencies in the fBm.
- @type offset: float
- @param offset: it raises the terrain from 'sea level'.
- @type gain: float
- @param gain: scale factor.
- @type basis: int
- @param basis: noise basis determines the type of noise used for the
- turbulence, see L{NoiseTypes}.
- @rtype: float
- @return: the generated value.
- """
-
-def voronoi(xyz, distance_metric = DistanceMetrics['DISTANCE'], exponent = 2.5):
- """
- Returns Voronoi diagrams-related data.
- @type xyz: 3-float tuple
- @param xyz: (x,y,z) float values.
- @type distance_metric: int
- @param distance_metric: see L{DistanceMetrics}
- @type exponent: float
- @param exponent: only used with MINKOVSKY, default is 2.5.
- @rtype: list
- @return: a list containing a list of distances in order of closest feature,
- and a list containing the positions of the four closest features.
- """
-
-def cellNoise (xyz):
- """
- Returns cellnoise.
- @type xyz: 3-float tuple
- @param xyz: (x,y,z) float values.
- @rtype: float
- @return: the generated value.
- """
-
-def cellNoiseV (xyz):
- """
- Returns cellnoise vector/point/color.
- @type xyz: 3-float tuple
- @param xyz: (x,y,z) float values.
- @rtype: 3-float list
- @return: the generated vector.
- """
diff --git a/source/blender/python/api2_2x/doc/Object.py b/source/blender/python/api2_2x/doc/Object.py
deleted file mode 100644
index 4228f6de1a8..00000000000
--- a/source/blender/python/api2_2x/doc/Object.py
+++ /dev/null
@@ -1,1757 +0,0 @@
-# Blender.Object module and the Object PyType object
-
-"""
-The Blender.Object submodule
-
-B{New}:
- - Addition of attributes for particle deflection, softbodies, and
- rigidbodies.
- - Objects now increment the Blender user count when they are created and
- decremented it when they are destroyed. This means Python scripts can
- keep the object "alive" if it is deleted in the Blender GUI.
- - L{Object.getData} now accepts two optional bool keyword argument to
- define (1) if the user wants the data object or just its name
- and (2) if a mesh object should use NMesh or Mesh.
- - L{Object.clearScriptLinks} accepts a parameter now.
- - Object attributes: renamed Layer to L{Layers<Object.Object.Layers>} and
- added the easier L{layers<Object.Object.layers>}. The old form "Layer"
- will continue to work.
-
-
-Object
-======
-
-This module provides access to the B{Objects} in Blender.
-
-Example::
-
- import Blender
- scn = Blender.Scene.GetCurrent() # get the current scene
- cam = Blender.Camera.New('ortho') # make ortho camera data object
- ob = scn.objects.new(cam) # make a new object in this scene using the camera data
- ob.setLocation (0.0, -5.0, 1.0) # position the object in the scene
-
- Blender.Redraw() # redraw the scene to show the updates.
-
-@type DrawModes: readonly dictionary
-@var DrawModes: Constant dict used for with L{Object.drawMode} bitfield
- attribute. Values can be ORed together. Individual bits can also
- be set/cleared with boolean attributes.
- - AXIS: Enable display of active object's center and axis.
- - TEXSPACE: Enable display of active object's texture space.
- - NAME: Enable display of active object's name.
- - WIRE: Enable the active object's wireframe over solid drawing.
- - XRAY: Enable drawing the active object in front of others.
- - TRANSP: Enable transparent materials for the active object (mesh only).
-
-@type DrawTypes: readonly dictionary
-@var DrawTypes: Constant dict used for with L{Object.drawType} attribute.
- Only one type can be selected at a time.
- - BOUNDBOX: Only draw object with bounding box
- - WIRE: Draw object in wireframe
- - SOLID: Draw object in solid
- - SHADED: Draw object with shaded or textured
-
-@type ParentTypes: readonly dictionary
-@var ParentTypes: Constant dict used for with L{Object.parentType} attribute.
- - OBJECT: Object parent type.
- - CURVE: Curve deform parent type.
- - LATTICE: Lattice deform parent type. Note: This is the same as ARMATURE, 2.43 was released with LATTICE as an invalid value.
- - ARMATURE: Armature deform parent type.
- - VERT1: 1 mesh vert parent type.
- - VERT3: 1 mesh verts parent type.
- - BONE: Armature bone parent type.
-
-
-@type ProtectFlags: readonly dictionary
-@var ProtectFlags: Constant dict used for with L{Object.protectFlags} attribute.
- Values can be ORed together.
- - LOCX, LOCY, LOCZ: lock x, y or z location individually
- - ROTX, ROTY, ROTZ: lock x, y or z rotation individually
- - SCALEX, SCALEY, SCALEZ: lock x, y or z scale individually
- - LOC, ROT, SCALE: lock all 3 attributes for location, rotation or scale
-
-@type PITypes: readonly dictionary
-@var PITypes: Constant dict used for with L{Object.piType} attribute.
- Only one type can be selected at a time.
- - NONE: No force influence on particles
- - FORCE: Object center attracts or repels particles ("Spherical")
- - VORTEX: Particles swirl around Z-axis of the object
- - WIND: Constant force applied in direction of object Z axis
- - GUIDE: Use a Curve Path to guide particles
-
-@type RBFlags: readonly dictionary
-@var RBFlags: Constant dict used for with L{Object.rbFlags} attribute.
- Values can be ORed together.
- - SECTOR: All game elements should be in the Sector boundbox
- - PROP: An Object fixed within a sector
- - BOUNDS: Specify a bounds object for physics
- - ACTOR: Enables objects that are evaluated by the engine
- - DYNAMIC: Enables motion defined by laws of physics (requires ACTOR)
- - GHOST: Enable objects that don't restitute collisions (requires ACTOR)
- - MAINACTOR: Enables MainActor (requires ACTOR)
- - RIGIDBODY: Enable rolling physics (requires ACTOR, DYNAMIC)
- - COLLISION_RESPONSE: Disable auto (de)activation (requires ACTOR, DYNAMIC)
- - USEFH: Use Fh settings in Materials (requires ACTOR, DYNAMIC)
- - ROTFH: Use face normal to rotate Object (requires ACTOR, DYNAMIC)
- - ANISOTROPIC: Enable anisotropic friction (requires ACTOR, DYNAMIC)
- - CHILD: reserved
-
-@type IpoKeyTypes: readonly dictionary
-@var IpoKeyTypes: Constant dict used for with L{Object.insertIpoKey} attribute.
- Values can be ORed together.
- - LOC
- - ROT
- - SIZE
- - LOCROT
- - LOCROTSIZE
- - LAYER
- - PI_STRENGTH
- - PI_FALLOFF
- - PI_SURFACEDAMP
- - PI_RANDOMDAMP
- - PI_PERM
-
-@type RBShapes: readonly dictionary
-@var RBShapes: Constant dict used for with L{Object.rbShapeBoundType}
- attribute. Only one type can be selected at a time. Values are
- BOX, SPHERE, CYLINDER, CONE, and POLYHEDERON
-
-"""
-
-def New (type, name='type'):
- """
- Creates a new Object. Deprecated; instead use Scene.objects.new().
- @type type: string
- @param type: The Object type: 'Armature', 'Camera', 'Curve', 'Lamp', 'Lattice',
- 'Mball', 'Mesh', 'Surf' or 'Empty'.
- @type name: string
- @param name: The name of the object. By default, the name will be the same
- as the object type.
- If the name is already in use, this new object will have a number at the end of the name.
- @return: The created Object.
-
- I{B{Example:}}
-
- The example below creates a new Lamp object and puts it at the default
- location (0, 0, 0) in the current scene::
- import Blender
-
- object = Blender.Object.New('Lamp')
- lamp = Blender.Lamp.New('Spot')
- object.link(lamp)
- sce = Blender.Scene.GetCurrent()
- sce.link(object)
-
- Blender.Redraw()
- @Note: if an object is created but is not linked to object data, and the
- object is not linked to a scene, it will be deleted when the Python
- object is deallocated. This is because Blender does not allow objects
- to exist without object data unless they are Empty objects. Scene.link()
- will automatically create object data for an object if it has none.
- """
-
-def Get (name = None):
- """
- Get the Object from Blender.
- @type name: string
- @param name: The name of the requested Object.
- @return: It depends on the 'name' parameter:
- - (name): The Object with the given name;
- - (): A list with all Objects in the current scene.
-
- I{B{Example 1:}}
-
- The example below works on the default scene. The script returns the plane object and prints the location of the plane::
- import Blender
-
- object = Blender.Object.Get ('plane')
- print object.getLocation()
-
- I{B{Example 2:}}
-
- The example below works on the default scene. The script returns all objects
- in the scene and prints the list of object names::
- import Blender
-
- objects = Blender.Object.Get ()
- print objects
- @note: Get will return objects from all scenes.
- Most user tools should only operate on objects from the current scene - Blender.Scene.GetCurrent().getChildren()
- """
-
-def GetSelected ():
- """
- Get the user selection. If no objects are selected, an empty list will be returned.
-
- @return: A list of all selected Objects in the current scene.
-
- I{B{Example:}}
-
- The example below works on the default scene. Select one or more objects and
- the script will print the selected objects::
- import Blender
-
- objects = Blender.Object.GetSelected()
- print objects
- @note: The active object will always be the first object in the list (if selected).
- @note: The user selection is made up of selected objects from Blender's current scene only.
- @note: The user selection is limited to objects on visible layers;
- if the user's last active 3d view is in localview then the selection will be limited to the objects in that localview.
- """
-
-
-def Duplicate (mesh=0, surface=0, curve=0, text=0, metaball=0, armature=0, lamp=0, material=0, texture=0, ipo=0):
- """
- Duplicate selected objects on visible layers from Blenders current scene,
- de-selecting the currently visible, selected objects and making a copy where all new objects are selected.
- By default no data linked to the object is duplicated; use the keyword arguments to change this.
- L{Object.GetSelected()<GetSelected>} will return the list of objects resulting from duplication.
-
- B{Note}: This command will raise an error if used from the command line (background mode) because it uses the 3D view context.
-
- @type mesh: bool
- @param mesh: When non-zero, mesh object data will be duplicated with the objects.
- @type surface: bool
- @param surface: When non-zero, surface object data will be duplicated with the objects.
- @type curve: bool
- @param curve: When non-zero, curve object data will be duplicated with the objects.
- @type text: bool
- @param text: When non-zero, text object data will be duplicated with the objects.
- @type metaball: bool
- @param metaball: When non-zero, metaball object data will be duplicated with the objects.
- @type armature: bool
- @param armature: When non-zero, armature object data will be duplicated with the objects.
- @type lamp: bool
- @param lamp: When non-zero, lamp object data will be duplicated with the objects.
- @type material: bool
- @param material: When non-zero, materials used by the object or its object data will be duplicated with the objects.
- @type texture: bool
- @param texture: When non-zero, texture data used by the object's materials will be duplicated with the objects.
- @type ipo: bool
- @param ipo: When non-zero, Ipo data linked to the object will be duplicated with the objects.
-
- I{B{Example:}}
-
- The example below creates duplicates the active object 10 times
- and moves each object 1.0 on the X axis::
- import Blender
-
- scn = Scene.GetCurrent()
- ob_act = scn.objects.active
-
- # Unselect all
- scn.objects.selected = []
- ob_act.sel = 1
-
- for x in xrange(10):
- Blender.Object.Duplicate() # Duplicate linked
- ob_act = scn.objects.active
- ob_act.LocX += 1
- Blender.Redraw()
- """
-
-from IDProp import IDGroup, IDArray
-class Object:
- """
- The Object object
- =================
- This object gives access to generic data from all objects in Blender.
-
- B{Note}:
- When dealing with properties and functions such as LocX/RotY/getLocation(), getSize() and getEuler(),
- keep in mind that these transformation properties are relative to the object's parent (if any).
-
- To get these values in worldspace (taking into account vertex parents, constraints, etc.)
- pass the argument 'worldspace' to these functions.
-
- @ivar restrictDisplay: Don't display this object in the 3D view: disabled by default, use the outliner to toggle.
- @type restrictDisplay: bool
- @ivar restrictSelect: Don't select this object in the 3D view: disabled by default, use the outliner to toggle.
- @type restrictSelect: bool
- @ivar restrictRender: Don't render this object: disabled by default, use the outliner to toggle.
- @type restrictRender: bool
- @ivar LocX: The X location coordinate of the object.
- @type LocX: float
- @ivar LocY: The Y location coordinate of the object.
- @type LocY: float
- @ivar LocZ: The Z location coordinate of the object.
- @type LocZ: float
- @ivar loc: The (X,Y,Z) location coordinates of the object.
- @type loc: tuple of 3 floats
- @ivar dLocX: The delta X location coordinate of the object.
- This variable applies to IPO Objects only.
- @type dLocX: float
- @ivar dLocY: The delta Y location coordinate of the object.
- This variable applies to IPO Objects only.
- @type dLocY: float
- @ivar dLocZ: The delta Z location coordinate of the object.
- This variable applies to IPO Objects only.
- @type dLocZ: float
- @ivar dloc: The delta (X,Y,Z) location coordinates of the object (vector).
- This variable applies to IPO Objects only.
- @type dloc: tuple of 3 floats
- @ivar RotX: The X rotation angle (in radians) of the object.
- @type RotX: float
- @ivar RotY: The Y rotation angle (in radians) of the object.
- @type RotY: float
- @ivar RotZ: The Z rotation angle (in radians) of the object.
- @type RotZ: float
- @ivar rot: The (X,Y,Z) rotation angles (in radians) of the object.
- @type rot: euler (Py_WRAPPED)
- @ivar dRotX: The delta X rotation angle (in radians) of the object.
- This variable applies to IPO Objects only.
- @type dRotX: float
- @ivar dRotY: The delta Y rotation angle (in radians) of the object.
- This variable applies to IPO Objects only.
- @type dRotY: float
- @ivar dRotZ: The delta Z rotation angle (in radians) of the object.
- This variable applies to IPO Objects only.
- @type dRotZ: float
- @ivar drot: The delta (X,Y,Z) rotation angles (in radians) of the object.
- This variable applies to IPO Objects only.
- @type drot: tuple of 3 floats
- @ivar SizeX: The X size of the object.
- @type SizeX: float
- @ivar SizeY: The Y size of the object.
- @type SizeY: float
- @ivar SizeZ: The Z size of the object.
- @type SizeZ: float
- @ivar size: The (X,Y,Z) size of the object.
- @type size: tuple of 3 floats
- @ivar dSizeX: The delta X size of the object.
- @type dSizeX: float
- @ivar dSizeY: The delta Y size of the object.
- @type dSizeY: float
- @ivar dSizeZ: The delta Z size of the object.
- @type dSizeZ: float
- @ivar dsize: The delta (X,Y,Z) size of the object.
- @type dsize: tuple of 3 floats
- @ivar Layers: The object layers (also check the newer attribute
- L{layers<layers>}). This value is a bitmask with at
- least one position set for the 20 possible layers starting from the low
- order bit. The easiest way to deal with these values in in hexadecimal
- notation.
- Example::
- ob.Layer = 0x04 # sets layer 3 ( bit pattern 0100 )
- After setting the Layer value, call Blender.Redraw( -1 ) to update
- the interface.
- @type Layers: integer (bitmask)
- @type layers: list of integers
- @ivar layers: The layers this object is visible in (also check the older
- attribute L{Layers<Layers>}). This returns a list of
- integers in the range [1, 20], each number representing the respective
- layer. Setting is done by passing a list of ints or an empty list for
- no layers.
- Example::
- ob.layers = [] # object won't be visible
- ob.layers = [1, 4] # object visible only in layers 1 and 4
- ls = o.layers
- ls.append([10])
- o.layers = ls
- print ob.layers # will print: [1, 4, 10]
- B{Note}: changes will only be visible after the screen (at least
- the 3d View and Buttons windows) is redrawn.
- @ivar parent: The parent object of the object (if defined). Read-only.
- @type parent: Object or None
- @ivar data: The Datablock object linked to this object. Read-only.
- @type data: varies
- @ivar ipo: Contains the Ipo if one is assigned to the object, B{None}
- otherwise. Setting to B{None} clears the current Ipo.
- @type ipo: Ipo
- @ivar mat: The matrix of the object in world space (absolute, takes vertex parents, tracking
- and Ipos into account). Read-only.
- @type mat: Matrix
- @ivar matrix: Same as L{mat}. Read-only.
- @type matrix: Matrix
- @ivar matrixLocal: The matrix of the object relative to its parent; if there is no parent,
- returns the world matrix (L{matrixWorld<Object.Object.matrixWorld>}).
- @type matrixLocal: Matrix
- @ivar matrixParentInverse: The inverse if the parents local matrix, set when the objects parent is set (wrapped).
- @type matrixParentInverse: Matrix
- @ivar matrixOldWorld: Old-type worldspace matrix (prior to Blender 2.34).
- Read-only.
- @type matrixOldWorld: Matrix
- @ivar matrixWorld: Same as L{mat}. Read-only.
- @type matrixWorld: Matrix
- @ivar colbits: The Material usage mask. A set bit #n means: the Material
- #n in the Object's material list is used. Otherwise, the Material #n
- of the Objects Data material list is displayed.
- Example::
- object.colbits = (1<<0) + (1<<5) # use mesh materials 0 (1<<0) and 5 (1<<5)
- # use object materials for all others
- @ivar sel: The selection state of the object in the current scene.
- True is selected, False is unselected. Setting makes the object active.
- @type sel: boolean
- @ivar effects: The list of particle effects associated with the object.
- Read-only.
- @type effects: list of Effect objects
- @ivar parentbonename: The string name of the parent bone (if defined).
- This can be set to another bone in the armature if the object already has a bone parent.
- @type parentbonename: string or None
- @ivar protectFlags: The "transform locking" bitfield flags for the object.
- See L{ProtectFlags} const dict for values.
- @type protectFlags: int
- @ivar DupGroup: The DupliGroup Animation Property. Assign a group to
- DupGroup to make this object an instance of that group.
- This does not enable or disable the DupliGroup option, for that use
- L{enableDupGroup}.
- The attribute returns None when this object does not have a dupliGroup,
- and setting the attrbute to None deletes the object from the group.
- @type DupGroup: Group or None
- @ivar DupObjects: The Dupli object instances. Read-only.
- Returns of list of tuples for object duplicated
- by dupliframe, dupliverts dupligroups and other animation properties.
- The first tuple item is the original object that is duplicated,
- the second is the 4x4 worldspace dupli-matrix.
- Example::
- import Blender
- from Blender import Object, Scene, Mathutils
-
- ob= Object.Get('Cube')
- dupe_obs= ob.DupObjects
- scn= Scene.GetCurrent()
- for dupe_ob, dupe_matrix in dupe_obs:
- print dupe_ob.name
- empty_ob = scn.objects.new('Empty')
- empty_ob.setMatrix(dupe_matrix)
- Blender.Redraw()
- @type DupObjects: list of tuples containing (object, matrix)
- @ivar enableNLAOverride: Whether the object uses NLA or active Action for animation.
- @type enableNLAOverride: boolean
- @ivar enableDupVerts: The DupliVerts status of the object.
- Does not indicate that this object has any dupliVerts,
- (as returned by L{DupObjects}) just that dupliVerts are enabled.
- @type enableDupVerts: boolean
- @ivar enableDupFaces: The DupliFaces status of the object.
- Does not indicate that this object has any dupliFaces,
- (as returned by L{DupObjects}) just that dupliFaces are enabled.
- @type enableDupFaces: boolean
- @ivar enableDupFacesScale: The DupliFacesScale status of the object.
- @type enableDupFacesScale: boolean
- @ivar dupFacesScaleFac: Scale factor for dupliface instance, 1.0 by default.
- @type dupFacesScaleFac: float
- @ivar enableDupFrames: The DupliFrames status of the object.
- Does not indicate that this object has any dupliFrames,
- (as returned by L{DupObjects}) just that dupliFrames are enabled.
- @type enableDupFrames: boolean
- @ivar enableDupGroup: The DupliGroup status of the object.
- Set True to make this object an instance of the object's L{DupGroup},
- and set L{DupGroup} to a group for this to take effect,
- Use L{DupObjects} to get the object data from this instance.
- @type enableDupGroup: boolean
- @ivar enableDupRot: The DupliRot status of the object.
- Use with L{enableDupVerts} to rotate each instance
- by the vertex normal.
- @type enableDupRot: boolean
- @ivar enableDupNoSpeed: The DupliNoSpeed status of the object.
- Use with L{enableDupFrames} to ignore dupliFrame speed.
- @type enableDupNoSpeed: boolean
- @ivar DupSta: The DupliFrame starting frame. Use with L{enableDupFrames}.
- Value clamped to [1,32767].
- @type DupSta: int
- @ivar DupEnd: The DupliFrame end frame. Use with L{enableDupFrames}.
- Value clamped to [1,32767].
- @type DupEnd: int
- @ivar DupOn: The DupliFrames in succession between DupOff frames.
- Value is clamped to [1,1500].
- Use with L{enableDupFrames} and L{DupOff} > 0.
- @type DupOn: int
- @ivar DupOff: The DupliFrame removal of every Nth frame for this object.
- Use with L{enableDupFrames}. Value is clamped to [0,1500].
- @type DupOff: int
- @ivar passIndex: Index # for the IndexOB render pass.
- Value is clamped to [0,1000].
- @type passIndex: int
- @ivar activeMaterial: The active material index for this object.
-
- The active index is used to select the material to edit in the material buttons,
- new data created will also use the active material.
-
- Value is clamped to [1,len(ob.materials)]. - [0,0] when there is no materials applied to the object.
- @type activeMaterial: int
- @ivar activeShape: The active shape key index for this object.
-
- The active index is used to select the material to edit in the material buttons,
- new data created will also use the active material.
-
- Value is clamped to [1,len(ob.data.key.blocks)]. - [0,0] when there are no keys.
-
- @type activeShape: int
-
- @ivar pinShape: If True, only the activeShape will be displayed.
- @type pinShape: bool
- @ivar drawSize: The size to display the Empty.
- Value clamped to [0.01,10.0].
- @type drawSize: float
- @ivar modifiers: The modifiers associated with the object.
- Example::
- # copy the active objects modifiers to all other visible selected objects
- from Blender import *
- scn = Scene.GetCurrent()
- ob_act = scn.objects.active
- for ob in scn.objects.context:
- # Cannot copy modifiers to an object of a different type
- if ob.type == ob_act.type:
- ob.modifiers = ob_act.modifiers
- @type modifiers: L{Modifier Sequence<Modifier.ModSeq>}
- @ivar constraints: a L{sequence<Constraint.Constraints>} of
- L{constraints<Constraint.Constraint>} for the object. Read-only.
- @type constraints: Constraint Sequence
- @ivar actionStrips: a L{sequence<NLA.ActionStrips>} of
- L{action strips<NLA.ActionStrip>} for the object. Read-only.
- @type actionStrips: BPy_ActionStrips
- @ivar action: The action associated with this object (if defined).
- @type action: L{Action<NLA.Action>} or None
- @ivar oopsLoc: Object's (X,Y) OOPs location. Returns None if object
- is not found in list.
- @type oopsLoc: tuple of 2 floats
- @ivar oopsSel: Object OOPs selection flag.
- @type oopsSel: boolean
- @ivar game_properties: The object's properties. Read-only.
- @type game_properties: list of Properties.
- @ivar timeOffset: The time offset of the object's animation.
- Value clamped to [-300000.0,300000.0].
- @type timeOffset: float
- @ivar track: The object's tracked object. B{None} is returned if no
- object is tracked. Also, assigning B{None} clear the tracked object.
- @type track: Object or None
- @ivar type: The object's type. Read-only.
- @type type: string
- @ivar boundingBox: The bounding box of this object. Read-only.
- @type boundingBox: list of 8 3D vectors
- @ivar drawType: The object's drawing type.
- See L{DrawTypes} constant dict for values.
- @type drawType: int
- @ivar parentType: The object's parent type. Read-only.
- See L{ParentTypes} constant dict for values.
- @type parentType: int
- @ivar axis: Enable display of active object's center and axis.
- Also see B{AXIS} bit in L{drawMode} attribute.
- @type axis: boolean
- @ivar texSpace: Enable display of active object's texture space.
- Also see B{TEXSPACE} bit in L{drawMode} attribute.
- @type texSpace: boolean
- @ivar nameMode: Enable display of active object's name.
- Also see B{NAME} bit in L{drawMode} attribute.
- @type nameMode: boolean
- @ivar wireMode: Enable the active object's wireframe over solid drawing.
- Also see B{WIRE} bit in L{drawMode} attribute.
- @type wireMode: boolean
- @ivar xRay: Enable drawing the active object in front of others.
- Also see B{XRAY} bit in L{drawMode} attribute.
- @type xRay: boolean
- @ivar transp: Enable transparent materials for the active object
- (mesh only). Also see B{TRANSP} bit in L{drawMode} attribute.
- @type transp: boolean
- @ivar drawMode: The object's drawing mode bitfield.
- See L{DrawModes} constant dict for values.
- @type drawMode: int
-
- @ivar piType: Type of particle interaction.
- See L{PITypes} constant dict for values.
- @type piType: int
- @ivar piFalloff: The particle interaction falloff power.
- Value clamped to [0.0,10.0].
- @type piFalloff: float
- @ivar piMaxDist: Max distance for the particle interaction field to work.
- Value clamped to [0.0,1000.0].
- @type piMaxDist: float
- @ivar piPermeability: Probability that a particle will pass through the
- mesh. Value clamped to [0.0,1.0].
- @type piPermeability: float
- @ivar piRandomDamp: Random variation of particle interaction damping.
- Value clamped to [0.0,1.0].
- @type piRandomDamp: float
- @ivar piSoftbodyDamp: Damping factor for softbody deflection.
- Value clamped to [0.0,1.0].
- @type piSoftbodyDamp: float
- @ivar piSoftbodyIThick: Inner face thickness for softbody deflection.
- Value clamped to [0.001,1.0].
- @type piSoftbodyIThick: float
- @ivar piSoftbodyOThick: Outer face thickness for softbody deflection.
- Value clamped to [0.001,1.0].
- @type piSoftbodyOThick: float
- @ivar piStrength: Particle interaction force field strength.
- Value clamped to [0.0,1000.0].
- @type piStrength: float
- @ivar piSurfaceDamp: Amount of damping during particle collision.
- Value clamped to [0.0,1.0].
- @type piSurfaceDamp: float
- @ivar piUseMaxDist: Use a maximum distance for the field to work.
- @type piUseMaxDist: boolean
-
- @ivar isSoftBody: True if object is a soft body. Read-only.
- @type isSoftBody: boolean
- @ivar SBDefaultGoal: Default softbody goal value, when no vertex group used.
- Value clamped to [0.0,1.0].
- @type SBDefaultGoal: float
- @ivar SBErrorLimit: Softbody Runge-Kutta ODE solver error limit (low values give more precision).
- Value clamped to [0.01,1.0].
- @type SBErrorLimit: float
- @ivar SBFriction: General media friction for softbody point movements.
- Value clamped to [0.0,10.0].
- @type SBFriction: float
- @ivar SBGoalFriction: Softbody goal (vertex target position) friction.
- Value clamped to [0.0,10.0].
- @type SBGoalFriction: float
- @ivar SBGoalSpring: Softbody goal (vertex target position) spring stiffness.
- Value clamped to [0.0,0.999].
- @type SBGoalSpring: float
- @ivar SBGrav: Apply gravitation to softbody point movement.
- Value clamped to [0.0,10.0].
- @type SBGrav: float
- @ivar SBInnerSpring: Softbody edge spring stiffness.
- Value clamped to [0.0,0.999].
- @type SBInnerSpring: float
- @ivar SBInnerSpringFrict: Softbody edge spring friction.
- Value clamped to [0.0,10.0].
- @type SBInnerSpringFrict: float
- @ivar SBMass: Softbody point mass (heavier is slower).
- Value clamped to [0.001,50.0].
- @type SBMass: float
- @ivar SBMaxGoal: Softbody goal maximum (vertex group weights scaled to
- match this range). Value clamped to [0.0,1.0].
- @type SBMaxGoal: float
- @ivar SBMinGoal: Softbody goal minimum (vertex group weights scaled to
- match this range). Value clamped to [0.0,1.0].
- @type SBMinGoal: float
- @ivar SBSpeed: Tweak timing for physics to control softbody frequency and
- speed. Value clamped to [0.0,10.0].
- @type SBSpeed: float
- @ivar SBStiffQuads: Softbody adds diagonal springs on 4-gons enabled.
- @type SBStiffQuads: boolean
- @ivar SBUseEdges: Softbody use edges as springs enabled.
- @type SBUseEdges: boolean
- @ivar SBUseGoal: Softbody forces for vertices to stick to animated position enabled.
- @type SBUseGoal: boolean
-
- @ivar rbFlags: Rigid body bitfield. See L{RBFlags} for valid values.
- @type rbFlags: int
- @ivar rbMass: Rigid body mass. Must be a positive value.
- @type rbMass: float
- @ivar rbRadius: Rigid body bounding sphere size. Must be a positive
- value.
- @type rbRadius: float
- @ivar rbShapeBoundType: Rigid body shape bound type. See L{RBShapes}
- const dict for values.
- @type rbShapeBoundType: int
- """
-
- def buildParts():
- """
- Recomputes the particle system. This method only applies to an Object of
- the type Effect.
- """
-
- def insertShapeKey():
- """
- Insert a Shape Key in the current object. It applies to Objects of
- the type Mesh, Lattice, or Curve.
- """
-
- def getPose():
- """
- Gets the current Pose of the object.
- @rtype: Pose object
- @return: the current pose object
- """
-
- def evaluatePose(framenumber):
- """
- Evaluates the Pose based on its currently bound action at a certain frame.
- @type framenumber: Int
- @param framenumber: The frame number to evaluate to.
- """
-
- def clearIpo():
- """
- Unlinks the ipo from this object.
- @return: True if there was an ipo linked or False otherwise.
- """
-
- def clrParent(mode = 0, fast = 0):
- """
- Clears parent object.
- @type mode: Integer
- @type fast: Integer
- @param mode: A mode flag. If mode flag is 2, then the object transform will
- be kept. Any other value, or no value at all will update the object
- transform.
- @param fast: If the value is 0, the scene hierarchy will not be updated. Any
- other value, or no value at all will update the scene hierarchy.
- """
-
- def getData(name_only=False, mesh=False):
- """
- Returns the Datablock object (Mesh, Lamp, Camera, etc.) linked to this
- Object. If the keyword parameter B{name_only} is True, only the Datablock
- name is returned as a string. It the object is of type Mesh, then the
- B{mesh} keyword can also be used; the data return is a Mesh object if
- True, otherwise it is an NMesh object (the default).
- The B{mesh} keyword is ignored for non-mesh objects.
- @type name_only: bool
- @param name_only: This is a keyword parameter. If True (or nonzero),
- only the name of the data object is returned.
- @type mesh: bool
- @param mesh: This is a keyword parameter. If True (or nonzero),
- a Mesh data object is returned.
- @rtype: specific Object type or string
- @return: Depends on the type of Datablock linked to the Object. If
- B{name_only} is True, it returns a string.
- @note: Mesh is faster than NMesh because Mesh is a thin wrapper.
- @note: This function is different from L{NMesh.GetRaw} and L{Mesh.Get}
- because it keeps a link to the original mesh, which is needed if you are
- dealing with Mesh weight groups.
- @note: Make sure the object you are getting the data from isn't in
- EditMode before calling this function; otherwise you'll get the data
- before entering EditMode. See L{Window.EditMode}.
- """
-
- def getParentBoneName():
- """
- Returns None, or the 'sub-name' of the parent (eg. Bone name)
- @return: string
- """
-
- def getDeltaLocation():
- """
- Returns the object's delta location in a list (x, y, z)
- @rtype: A vector triple
- @return: (x, y, z)
- """
-
- def getDrawMode():
- """
- Returns the object draw mode.
- @rtype: Integer
- @return: a sum of the following:
- - 2 - axis
- - 4 - texspace
- - 8 - drawname
- - 16 - drawimage
- - 32 - drawwire
- - 64 - xray
- """
-
- def getDrawType():
- """
- Returns the object draw type
- @rtype: Integer
- @return: One of the following:
- - 1 - Bounding box
- - 2 - Wire
- - 3 - Solid
- - 4 - Shaded
- - 5 - Textured
- """
-
- def getEuler(space):
- """
- @type space: string
- @param space: The desired space for the size:
- - localspace: (default) relative to the object's parent;
- - worldspace: absolute, taking vertex parents, tracking and
- Ipo's into account;
- Returns the object's localspace rotation as Euler rotation vector (rotX, rotY, rotZ). Angles are in radians.
- @rtype: Py_Euler
- @return: A python Euler. Data is wrapped when euler is present.
- """
-
- def getInverseMatrix():
- """
- Returns the object's inverse matrix.
- @rtype: Py_Matrix
- @return: A python matrix 4x4
- """
-
- def getIpo():
- """
- Returns the Ipo associated to this object or None if there's no linked ipo.
- @rtype: Ipo
- @return: the wrapped ipo or None.
- """
- def isSelected():
- """
- Returns the objects selection state in the current scene as a boolean value True or False.
- @rtype: Boolean
- @return: Selection state as True or False
- """
-
- def getLocation(space):
- """
- @type space: string
- @param space: The desired space for the location:
- - localspace: (default) relative to the object's parent;
- - worldspace: absolute, taking vertex parents, tracking and
- Ipo's into account;
- Returns the object's location (x, y, z).
- @return: (x, y, z)
-
- I{B{Example:}}
-
- The example below works on the default scene. It retrieves all objects in
- the scene and prints the name and location of each object::
- import Blender
-
- sce = Blender.Scene.GetCurrent()
-
- for ob in sce.objects:
- print obj.name
- print obj.loc
- @note: the worldspace location is the same as ob.matrixWorld[3][0:3]
- """
-
- def getAction():
- """
- Returns an action if one is associated with this object (only useful for armature types).
- @rtype: Py_Action
- @return: a python action.
- """
-
- def getMaterials(what = 0):
- """
- Returns a list of materials assigned to the object.
- @type what: int
- @param what: if nonzero, empty slots will be returned as None's instead
- of being ignored (default way). See L{NMesh.NMesh.getMaterials}.
- @rtype: list of Material Objects
- @return: list of Material Objects assigned to the object.
- """
-
- def getMatrix(space = 'worldspace'):
- """
- Returns the object matrix.
- @type space: string
- @param space: The desired matrix:
- - worldspace (default): absolute, taking vertex parents, tracking and
- Ipo's into account;
- - localspace: relative to the object's parent (returns worldspace
- matrix if the object doesn't have a parent);
- - old_worldspace: old behavior, prior to Blender 2.34, where eventual
- changes made by the script itself were not taken into account until
- a redraw happened, either called by the script or upon its exit.
- Returns the object matrix.
- @rtype: Py_Matrix (WRAPPED DATA)
- @return: a python 4x4 matrix object. Data is wrapped for 'worldspace'
- """
-
- def getName():
- """
- Returns the name of the object
- @return: The name of the object
-
- I{B{Example:}}
-
- The example below works on the default scene. It retrieves all objects in
- the scene and prints the name of each object::
- import Blender
-
- sce= Blender.Scene.GetCurrent()
-
- for ob in sce.objects:
- print ob.getName()
- """
-
- def getParent():
- """
- Returns the object's parent object.
- @rtype: Object
- @return: The parent object of the object. If not available, None will be
- returned.
- """
-
- def getSize(space):
- """
- @type space: string
- @param space: The desired space for the size:
- - localspace: (default) relative to the object's parent;
- - worldspace: absolute, taking vertex parents, tracking and
- Ipo's into account;
- Returns the object's size.
- @return: (SizeX, SizeY, SizeZ)
- @note: the worldspace size will not return negative (flipped) scale values.
- """
-
- def getParentBoneName():
- """
- Returns the object's parent object's sub name, or None.
- For objects parented to bones, this is the name of the bone.
- @rtype: String
- @return: The parent object sub-name of the object.
- If not available, None will be returned.
- """
-
- def getTimeOffset():
- """
- Returns the time offset of the object's animation.
- @return: TimeOffset
- """
-
- def getTracked():
- """
- Returns the object's tracked object.
- @rtype: Object
- @return: The tracked object of the object. If not available, None will be
- returned.
- """
-
- def getType():
- """
- Returns the type of the object in 'Armature', 'Camera', 'Curve', 'Lamp', 'Lattice',
- 'Mball', 'Mesh', 'Surf', 'Empty', 'Wave' (deprecated) or 'unknown' in exceptional cases.
-
- I{B{Example:}}
-
- The example below works on the default scene. It retrieves all objects in
- the scene and updates the location and rotation of the camera. When run,
- the camera will rotate 180 degrees and moved to the opposite side of the X
- axis. Note that the number 'pi' in the example is an approximation of the
- true number 'pi'. A better, less error-prone value of pi is math.pi from the python math module.::
- import Blender
-
- sce = Blender.Scene.GetCurrent()
-
- for obj in sce.objects:
- if obj.type == 'Camera':
- obj.LocY = -obj.LocY
- obj.RotZ = 3.141592 - obj.RotZ
-
- Blender.Redraw()
-
- @return: The type of object.
- @rtype: String
- """
-
- def insertIpoKey(keytype):
- """
- Inserts keytype values in object ipo at curframe.
- @type keytype: int
- @param keytype: A constant from L{IpoKeyTypes<Object.IpoKeyTypes>}
- @return: None
- """
-
- def link(datablock):
- """
- Links Object with ObData datablock provided in the argument. The data must match the
- Object's type, so you cannot link a Lamp to a Mesh type object.
- @type datablock: Blender ObData datablock
- @param datablock: A Blender datablock matching the objects type.
- """
-
- def makeParent(objects, noninverse = 0, fast = 0):
- """
- Makes the object the parent of the objects provided in the argument which
- must be a list of valid Objects.
- @type objects: Sequence of Blender Object
- @param objects: The children of the parent
- @type noninverse: Integer
- @param noninverse:
- 0 - make parent with inverse
- 1 - make parent without inverse
- @type fast: Integer
- @param fast:
- 0 - update scene hierarchy automatically
- 1 - don't update scene hierarchy (faster). In this case, you must
- explicitely update the Scene hierarchy.
- @warn: objects must first be linked to a scene before they can become
- parents of other objects. Calling this makeParent method for an
- unlinked object will result in an error.
- """
-
- def join(objects):
- """
- Uses the object as a base for all of the objects in the provided list to join into.
-
- @type objects: Sequence of Blender Object
- @param objects: A list of objects matching the object's type.
- @note: Objects in the list will not be removed from the scene.
- To avoid overlapping data you may want to remove them manually after joining.
- @note: Join modifies the base object's data in place so that
- other objects are joined into it. No new object or data is created.
- @note: Join will only work for object types Mesh, Armature, Curve and Surface;
- an excption will be raised if the object is not of these types.
- @note: Objects in the list will be ignored if they to not match the base object.
- @note: The base object must be in the current scene to be joined.
- @note: This function will not work in background mode (no user interface).
- @note: An error in the function input will raise a TypeError or AttributeError,
- otherwise an error in the data input will raise a RuntimeError.
- For situations where you don't have tight control on the data that is being joined,
- you should handle the RuntimeError error, letting the user know the data can't be joined.
- """
-
- def makeParentDeform(objects, noninverse = 0, fast = 0):
- """
- Makes the object the deformation parent of the objects provided in the argument
- which must be a list of valid Objects.
- The parent object must be a Curve or Armature.
- @type objects: Sequence of Blender Object
- @param objects: The children of the parent
- @type noninverse: Integer
- @param noninverse:
- 0 - make parent with inverse
- 1 - make parent without inverse
- @type fast: Integer
- @param fast:
- 0 - update scene hierarchy automatically
- 1 - don't update scene hierarchy (faster). In this case, you must
- explicitely update the Scene hierarchy.
- @warn: objects must first be linked to a scene before they can become
- parents of other objects. Calling this makeParent method for an
- unlinked object will result in an error.
- @warn: child objects must be of mesh type to deform correctly. Other object
- types will fall back to normal parenting silently.
- """
-
- def makeParentVertex(objects, indices, noninverse = 0, fast = 0):
- """
- Makes the object the vertex parent of the objects provided in the argument
- which must be a list of valid Objects.
- The parent object must be a Mesh, Curve or Surface.
- @type objects: Sequence of Blender Object
- @param objects: The children of the parent
- @type indices: Tuple of Integers
- @param indices: The indices of the vertices you want to parent to (1 or 3 values)
- @type noninverse: Integer
- @param noninverse:
- 0 - make parent with inverse
- 1 - make parent without inverse
- @type fast: Integer
- @param fast:
- 0 - update scene hierarchy automatically
- 1 - don't update scene hierarchy (faster). In this case, you must
- explicitely update the Scene hierarchy.
- @warn: objects must first be linked to a scene before they can become
- parents of other objects. Calling this makeParent method for an
- unlinked object will result in an error.
- """
- def makeParentBone(objects, bonename, noninverse = 0, fast = 0):
- """
- Makes one of the object's bones the parent of the objects provided in the argument
- which must be a list of valid objects. The parent object must be an Armature.
- @type objects: Sequence of Blender Object
- @param objects: The children of the parent
- @type bonename: string
- @param bonename: a valid bone name from the armature
- @type noninverse: integer
- @param noninverse:
- 0 - make parent with inverse
- 1 - make parent without inverse
- @type fast: integer
- @param fast:
- 0 - update scene hierarchy automatically
- 1 - don't update scene hierarchy (faster). In this case, you must
- explicitly update the Scene hierarchy.
- @warn: Objects must first be linked to a scene before they can become
- parents of other objects. Calling this method for an
- unlinked object will result in an exception.
- """
-
- def setDeltaLocation(delta_location):
- """
- Sets the object's delta location which must be a vector triple.
- @type delta_location: A vector triple
- @param delta_location: A vector triple (x, y, z) specifying the new
- location.
- """
-
- def setDrawMode(drawmode):
- """
- Sets the object's drawing mode. The drawing mode can be a mix of modes. To
- enable these, add up the values.
- @type drawmode: Integer
- @param drawmode: A sum of the following:
- - 2 - axis
- - 4 - texspace
- - 8 - drawname
- - 16 - drawimage
- - 32 - drawwire
- - 64 - xray
- """
-
- def setDrawType(drawtype):
- """
- Sets the object's drawing type.
- @type drawtype: Integer
- @param drawtype: One of the following:
- - 1 - Bounding box
- - 2 - Wire
- - 3 - Solid
- - 4 - Shaded
- - 5 - Textured
- """
-
- def setEuler(euler):
- """
- Sets the object's localspace rotation according to the specified Euler angles.
- @type euler: Py_Euler or a list of floats
- @param euler: a python Euler or x,y,z rotations as floats
- """
-
- def setIpo(ipo):
- """
- Links an ipo to this object.
- @type ipo: Blender Ipo
- @param ipo: an object type ipo.
- """
-
- def setLocation(x, y, z):
- """
- Sets the object's location relative to the parent object (if any).
- @type x: float
- @param x: The X coordinate of the new location.
- @type y: float
- @param y: The Y coordinate of the new location.
- @type z: float
- @param z: The Z coordinate of the new location.
- """
-
- def setMaterials(materials):
- """
- Sets the materials. The argument must be a list 16 items or less. Each
- list element is either a Material or None. Also see L{colbits}.
- @type materials: Materials list
- @param materials: A list of Blender material objects.
- @note: Materials are assigned to the object's data by default. Unless
- you know the material is applied to the object or are changing the
- object's L{colbits}, you need to look at the object data's materials.
- """
-
- def setMatrix(matrix):
- """
- Sets the object's matrix and updates its transformation. If the object
- has a parent, the matrix transform is relative to the parent.
- @type matrix: Py_Matrix 3x3 or 4x4
- @param matrix: a 3x3 or 4x4 Python matrix. If a 3x3 matrix is given,
- it is extended to a 4x4 matrix.
- @Note: This method is "bad": when called it changes the location,
- rotation and size attributes of the object (since Blender uses these
- values to calculate the object's transformation matrix). Ton is
- not happy having a method which "pretends" to do a matrix operation.
- In the future, this method may be replaced with other methods which
- make it easier for the user to determine the correct loc/rot/size values
- for necessary for the object.
- """
-
- def setName(name):
- """
- Sets the name of the object. A string longer than 20 characters will be shortened.
- @type name: String
- @param name: The new name for the object.
- """
-
- def setSize(x, y, z):
- """
- Sets the object's size, relative to the parent object (if any), clamped
- @type x: float
- @param x: The X size multiplier.
- @type y: float
- @param y: The Y size multiplier.
- @type z: float
- @param z: The Z size multiplier.
- """
-
- def setTimeOffset(timeOffset):
- """
- Sets the time offset of the object's animation.
- @type timeOffset: float
- @param timeOffset: The new time offset for the object's animation.
- """
-
- def shareFrom(object):
- """
- Link data of a specified argument with this object. This works only
- if both objects are of the same type.
- @type object: Blender Object
- @param object: A Blender Object of the same type.
- @note: This function is faster than using L{getData()} and setData()
- because it skips making a Python object from the object's data.
- """
-
- def select(boolean):
- """
- Sets the object's selection state in the current scene.
- setting the selection will make this object the active object of this scene.
- @type boolean: Integer
- @param boolean:
- - 0 - unselected
- - 1 - selected
- """
-
- def getBoundBox():
- """
- Returns the worldspace bounding box of this object. This works for meshes (out of
- edit mode) and curves.
- @rtype: list of 8 (x,y,z) float coordinate vectors (WRAPPED DATA)
- @return: The coordinates of the 8 corners of the bounding box. Data is wrapped when
- bounding box is present.
- """
-
- def makeDisplayList():
- """
- Updates this object's display list. Blender uses display lists to store
- already transformed data (like a mesh with its vertices already modified
- by coordinate transformations and armature deformation). If the object
- isn't modified, there's no need to recalculate this data. This method is
- here for the *few cases* where a script may need it, like when toggling
- the "SubSurf" mode for a mesh:
-
- Example::
- import Blender
-
- scn = Blender.Scene.GetCurrent()
- object = scn.objects.active
- object.modifiers.append(Blender.Modifier.Type.SUBSURF)
- object.makeDisplayList()
- Blender.Window.RedrawAll()
-
- If you try this example without the line to update the display list, the
- object will disappear from the screen until you press "SubSurf".
- @warn: If after running your script objects disappear from the screen or
- are not displayed correctly, try this method function. But if the script
- works properly without it, there's no reason to use it.
- """
-
- def getScriptLinks (event):
- """
- Get a list with this Object's script links of type 'event'.
- @type event: string
- @param event: "FrameChanged", "Redraw" or "Render".
- @rtype: list
- @return: a list with Blender L{Text} names (the script links of the given
- 'event' type) or None if there are no script links at all.
- """
-
- def clearScriptLinks (links = None):
- """
- Delete script links from this Object. If no list is specified, all
- script links are deleted.
- @type links: list of strings
- @param links: None (default) or a list of Blender L{Text} names.
- """
-
- def addScriptLink (text, event):
- """
- Add a new script link to this Object.
- @type text: string
- @param text: the name of an existing Blender L{Text}.
- @type event: string
- @param event: "FrameChanged", "Redraw" or "Render".
- """
-
- def makeTrack (tracked, fast = 0):
- """
- Make this Object track another.
- @type tracked: Blender Object
- @param tracked: the object to be tracked.
- @type fast: int (bool)
- @param fast: if zero, the scene hierarchy is updated automatically. If
- you set 'fast' to a nonzero value, don't forget to update the scene
- yourself (see L{Scene.Scene.update}).
- @note: you also need to clear the rotation (L{setEuler}) of this object
- if it was not (0,0,0) already.
- """
-
- def clearTrack (mode = 0, fast = 0):
- """
- Make this Object not track another anymore.
- @type mode: int (bool)
- @param mode: if nonzero the matrix transformation used for tracking is kept.
- @type fast: int (bool)
- @param fast: if zero, the scene hierarchy is updated automatically. If
- you set 'fast' to a nonzero value, don't forget to update the scene
- yourself (see L{Scene.Scene.update}).
- """
-
- def getAllProperties ():
- """
- Return a list of all game properties from this object.
- @rtype: PyList
- @return: List of Property objects.
- """
-
- def getProperty (name):
- """
- Return a game property from this object matching the name argument.
- @type name: string
- @param name: the name of the property to get.
- @rtype: Property object
- @return: The first property that matches name.
- """
-
- def addProperty (name_or_property, data, type):
- """
- Add or create a game property for an object. If called with only a
- property object, the property is assigned to the object. If called
- with a property name string and data object, a new property is
- created and added to the object.
- @type name_or_property: string or Property object
- @param name_or_property: the property name, or a property object.
- @type data: string, int or float
- @param data: Only valid when I{name_or_property} is a string.
- Value depends on what is passed in:
- - string: string type property
- - int: integer type property
- - float: float type property
- @type type: string (optional)
- @param type: Only valid when I{name_or_property} is a string.
- Can be the following:
- - 'BOOL'
- - 'INT'
- - 'FLOAT'
- - 'TIME'
- - 'STRING'
- @warn: If a type is not declared string data will
- become string type, int data will become int type
- and float data will become float type. Override type
- to declare bool type, and time type.
- @warn: A property object can be added only once to an object;
- you must remove the property from an object to add it elsewhere.
- """
-
- def removeProperty (property):
- """
- Remove a game property from an object.
- @type property: Property object or string
- @param property: Property object or property name to be removed.
- """
-
- def removeAllProperties():
- """
- Removes all game properties from an object.
- """
-
- def copyAllPropertiesTo (object):
- """
- Copies all game properties from one object to another.
- @type object: Object object
- @param object: Object that will receive the properties.
- """
-
- def getPIStregth():
- """
- Get the Object's Particle Interaction Strength.
- @rtype: float
- """
-
- def setPIStrength(strength):
- """
- Set the Object's Particle Interaction Strength.
- Values between -1000.0 to 1000.0
- @rtype: None
- @type strength: float
- @param strength: the Object's Particle Interaction New Strength.
- """
-
- def getPIFalloff():
- """
- Get the Object's Particle Interaction falloff.
- @rtype: float
- """
-
- def setPIFalloff(falloff):
- """
- Set the Object's Particle Interaction falloff.
- Values between 0 to 10.0
- @rtype: None
- @type falloff: float
- @param falloff: the Object's Particle Interaction New falloff.
- """
-
- def getPIMaxDist():
- """
- Get the Object's Particle Interaction MaxDist.
- @rtype: float
- """
-
- def setPIMaxDist(MaxDist):
- """
- Set the Object's Particle Interaction MaxDist.
- Values between 0 to 1000.0
- @rtype: None
- @type MaxDist: float
- @param MaxDist: the Object's Particle Interaction New MaxDist.
- """
-
- def getPIType():
- """
- Get the Object's Particle Interaction Type.
- @rtype: int
- """
-
- def setPIType(type):
- """
- Set the Object's Particle Interaction type.
- Use Module Constants
- - NONE
- - WIND
- - FORCE
- - VORTEX
- - MAGNET
- @rtype: None
- @type type: int
- @param type: the Object's Particle Interaction Type.
- """
-
- def getPIUseMaxDist():
- """
- Get the Object's Particle Interaction if using MaxDist.
- @rtype: int
- """
-
- def setPIUseMaxDist(status):
- """
- Set the Object's Particle Interaction MaxDist.
- 0 = Off, 1 = on
- @rtype: None
- @type status: int
- @param status: the new status
- """
-
- def getPIDeflection():
- """
- Get the Object's Particle Interaction Deflection Setting.
- @rtype: int
- """
-
- def setPIDeflection(status):
- """
- Set the Object's Particle Interaction Deflection Setting.
- 0 = Off, 1 = on
- @rtype: None
- @type status: int
- @param status: the new status
- """
-
- def getPIPermf():
- """
- Get the Object's Particle Interaction Permeability.
- @rtype: float
- """
-
- def setPIPerm(perm):
- """
- Set the Object's Particle Interaction Permeability.
- Values between 0 to 10.0
- @rtype: None
- @type perm: float
- @param perm: the Object's Particle Interaction New Permeability.
- """
-
- def getPIRandomDamp():
- """
- Get the Object's Particle Interaction RandomDamp.
- @rtype: float
- """
-
- def setPIRandomDamp(damp):
- """
- Set the Object's Particle Interaction RandomDamp.
- Values between 0 to 10.0
- @rtype: None
- @type damp: float
- @param damp: the Object's Particle Interaction New RandomDamp.
- """
-
- def getPISurfaceDamp():
- """
- Get the Object's Particle Interaction SurfaceDamp.
- @rtype: float
- """
-
- def setPISurfaceDamp(damp):
- """
- Set the Object's Particle Interaction SurfaceDamp.
- Values between 0 to 10.0
- @rtype: None
- @type damp: float
- @param damp: the Object's Particle Interaction New SurfaceDamp.
- """
-
- def getSBMass():
- """
- Get the Object's SoftBody Mass.
- @rtype: float
- """
-
- def setSBMass(mass):
- """
- Set the Object's SoftBody Mass.
- Values between 0 to 50.0
- @rtype: None
- @type mass: float
- @param mass: the Object's SoftBody New mass.
- """
-
- def getSBGravity():
- """
- Get the Object's SoftBody Gravity.
- @rtype: float
- """
-
- def setSBGravity(grav):
- """
- Set the Object's SoftBody Gravity.
- Values between 0 to 10.0
- @rtype: None
- @type grav: float
- @param grav: the Object's SoftBody New Gravity.
- """
-
- def getSBFriction():
- """
- Get the Object's SoftBody Friction.
- @rtype: float
- """
-
- def setSBFriction(frict):
- """
- Set the Object's SoftBody Friction.
- Values between 0 to 10.0
- @rtype: None
- @type frict: float
- @param frict: the Object's SoftBody New Friction.
- """
-
- def getSBErrorLimit():
- """
- Get the Object's SoftBody ErrorLimit.
- @rtype: float
- """
-
- def setSBErrorLimit(err):
- """
- Set the Object's SoftBody ErrorLimit.
- Values between 0 to 1.0
- @rtype: None
- @type err: float
- @param err: the Object's SoftBody New ErrorLimit.
- """
-
- def getSBGoalSpring():
- """
- Get the Object's SoftBody GoalSpring.
- @rtype: float
- """
-
- def setSBGoalSpring(gs):
- """
- Set the Object's SoftBody GoalSpring.
- Values between 0 to 0.999
- @rtype: None
- @type gs: float
- @param gs: the Object's SoftBody New GoalSpring.
- """
-
- def getSBGoalFriction():
- """
- Get the Object's SoftBody GoalFriction.
- @rtype: float
- """
-
- def setSBGoalFriction(gf):
- """
- Set the Object's SoftBody GoalFriction.
- Values between 0 to 10.0
- @rtype: None
- @type gf: float
- @param gf: the Object's SoftBody New GoalFriction.
- """
-
- def getSBMinGoal():
- """
- Get the Object's SoftBody MinGoal.
- @rtype: float
- """
-
- def setSBMinGoal(mg):
- """
- Set the Object's SoftBody MinGoal.
- Values between 0 to 1.0
- @rtype: None
- @type mg: float
- @param mg: the Object's SoftBody New MinGoal.
- """
-
- def getSBMaxGoal():
- """
- Get the Object's SoftBody MaxGoal.
- @rtype: float
- """
-
- def setSBMaxGoal(mg):
- """
- Set the Object's SoftBody MaxGoal.
- Values between 0 to 1.0
- @rtype: None
- @type mg: float
- @param mg: the Object's SoftBody New MaxGoal.
- """
-
- def getSBInnerSpring():
- """
- Get the Object's SoftBody InnerSpring.
- @rtype: float
- """
-
- def setSBInnerSpring(sprr):
- """
- Set the Object's SoftBody InnerSpring.
- Values between 0 to 0.999
- @rtype: None
- @type sprr: float
- @param sprr: the Object's SoftBody New InnerSpring.
- """
-
- def getSBInnerSpringFriction():
- """
- Get the Object's SoftBody InnerSpringFriction.
- @rtype: float
- """
-
- def setSBInnerSpringFriction(sprf):
- """
- Set the Object's SoftBody InnerSpringFriction.
- Values between 0 to 10.0
- @rtype: None
- @type sprf: float
- @param sprf: the Object's SoftBody New InnerSpringFriction.
- """
-
- def getSBDefaultGoal():
- """
- Get the Object's SoftBody DefaultGoal.
- @rtype: float
- """
-
- def setSBDefaultGoal(goal):
- """
- Set the Object's SoftBody DefaultGoal.
- Values between 0 to 1.0
- @rtype: None
- @type goal: float
- @param goal: the Object's SoftBody New DefaultGoal.
- """
-
- def isSB():
- """
- Returns the Object's SoftBody enabled state.
- @rtype: boolean
- """
-
- def getSBPostDef():
- """
- get SoftBodies PostDef option
- @rtype: int
- """
-
- def setSBPostDef(switch):
- """
- Enable / Disable SoftBodies PostDef option
- 1: on
- 0: off
- @rtype: None
- @type switch: int
- @param switch: the Object's SoftBody New PostDef Value.
- """
-
- def getSBUseGoal():
- """
- get SoftBodies UseGoal option
- @rtype: int
- """
-
- def setSBUseGoal(switch):
- """
- Enable / Disable SoftBodies UseGoal option
- 1: on
- 0: off
- @rtype: None
- @type switch: int
- @param switch: the Object's SoftBody New UseGoal Value.
- """
- def getSBUseEdges():
- """
- get SoftBodies UseEdges option
- @rtype: int
- """
-
- def setSBUseEdges(switch):
- """
- Enable / Disable SoftBodies UseEdges option
- 1: on
- 0: off
- @rtype: None
- @type switch: int
- @param switch: the Object's SoftBody New UseEdges Value.
- """
-
- def getSBStiffQuads():
- """
- get SoftBodies StiffQuads option
- @rtype: int
- """
-
- def setSBStiffQuads(switch):
- """
- Enable / Disable SoftBodies StiffQuads option
- 1: on
- 0: off
- @rtype: None
- @type switch: int
- @param switch: the Object's SoftBody New StiffQuads Value.
- """
-
-
-class Property:
- """
- The Property object
- ===================
- This property gives access to object property data in Blender, used by the game engine.
- @ivar name: The property name.
- @ivar data: Data for this property. Depends on property type.
- @ivar type: The property type.
- @warn: Comparisons between properties will only be true when
- both the name and data pairs are the same.
- """
-
- def getName ():
- """
- Get the name of this property.
- @rtype: string
- @return: The property name.
- """
-
- def setName (name):
- """
- Set the name of this property.
- @type name: string
- @param name: The new name of the property
- """
-
- def getData():
- """
- Get the data for this property.
- @rtype: string, int, or float
- """
-
- def setData(data):
- """
- Set the data for this property.
- @type data: string, int, or float
- @param data: The data to set for this property.
- @warn: See object.setProperty(). Changing data
- which is of a different type then the property is
- set to (i.e. setting an int value to a float type'
- property) will change the type of the property
- automatically.
- """
-
- def getType ():
- """
- Get the type for this property.
- @rtype: string
- """
-
-import id_generics
-Object.__doc__ += id_generics.attributes
diff --git a/source/blender/python/api2_2x/doc/Pose.py b/source/blender/python/api2_2x/doc/Pose.py
deleted file mode 100644
index ad1b44da5e2..00000000000
--- a/source/blender/python/api2_2x/doc/Pose.py
+++ /dev/null
@@ -1,245 +0,0 @@
-# Blender.Object.Pose module
-
-"""
-The Blender.Object.Pose submodule.
-
-Pose
-====
-
-This module provides access to B{Pose} objects in Blender. This Pose is the
-current object-level (as opposed to armature-data level) transformation.
-
-Example::
- import Blender
- from Blender import *
-
-
- scn= Scene.GetCurrent()
-
- # New Armature
- arm_data= Armature.New('myArmature')
- print arm_data
- arm_ob = scn.objects.new(arm_data)
- arm_data.makeEditable()
-
-
- # Add 4 bones
- ebones = [Armature.Editbone(), Armature.Editbone(), Armature.Editbone(), Armature.Editbone()]
-
- # Name the editbones
- ebones[0].name = 'Bone.001'
- ebones[1].name = 'Bone.002'
- ebones[2].name = 'Bone.003'
- ebones[3].name = 'Bone.004'
-
- # Assign the editbones to the armature
- for eb in ebones:
- arm_data.bones[eb.name]= eb
-
- # Set the locations of the bones
- ebones[0].head= Mathutils.Vector(0,0,0)
- ebones[0].tail= Mathutils.Vector(0,0,1)
- ebones[1].head= Mathutils.Vector(0,0,1)
- ebones[1].tail= Mathutils.Vector(0,0,2)
- ebones[2].head= Mathutils.Vector(0,0,2)
- ebones[2].tail= Mathutils.Vector(0,0,3)
- ebones[3].head= Mathutils.Vector(0,0,3)
- ebones[3].tail= Mathutils.Vector(0,0,4)
-
- ebones[1].parent= ebones[0]
- ebones[2].parent= ebones[1]
- ebones[3].parent= ebones[2]
-
- arm_data.update()
- # Done with editing the armature
-
-
- # Assign the pose animation
- pose = arm_ob.getPose()
-
- act = arm_ob.getAction()
- if not act: # Add a pose action if we dont have one
- act = Armature.NLA.NewAction()
- act.setActive(arm_ob)
-
- xbones=arm_ob.data.bones.values()
- pbones = pose.bones.values()
- print xbones
- print pbones
-
-
- frame = 1
- for pbone in pbones: # set bones to no rotation
- pbone.quat[:] = 1.000,0.000,0.000,0.0000
- pbone.insertKey(arm_ob, frame, Object.Pose.ROT)
-
- # Set a different rotation at frame 25
- pbones[0].quat[:] = 1.000,0.1000,0.2000,0.20000
- pbones[1].quat[:] = 1.000,0.6000,0.5000,0.40000
- pbones[2].quat[:] = 1.000,0.1000,0.3000,0.40000
- pbones[3].quat[:] = 1.000,-0.2000,-0.3000,0.30000
-
- frame = 25
- for i in xrange(4):
- pbones[i].insertKey(arm_ob, frame, Object.Pose.ROT)
-
- pbones[0].quat[:] = 1.000,0.000,0.000,0.0000
- pbones[1].quat[:] = 1.000,0.000,0.000,0.0000
- pbones[2].quat[:] = 1.000,0.000,0.000,0.0000
- pbones[3].quat[:] = 1.000,0.000,0.000,0.0000
-
-
- frame = 50
- for pbone in pbones: # set bones to no rotation
- pbone.quat[:] = 1.000,0.000,0.000,0.0000
- pbone.insertKey(arm_ob, frame, Object.Pose.ROT)
-
-
-
-@var ROT:
-@type ROT: Constant
-@var LOC:
-@type LOC: Constant
-@var SIZE:
-@type SIZE: Constant
-"""
-
-class Pose:
- """
- The Pose object
- ===============
- This object gives access to Pose-specific data in Blender.
- @ivar bones: A Dictionary of PosePoseBones (PoseDict) that make up this Pose.
- @type bones: PoseDict Object
- """
-
- def update():
- """
- Save all changes and update the Pose.
- @rtype: None
- """
-
-class PoseBonesDict:
- """
- The PoseBonesDict object
- ========================
- This object gives dictionary like access to the PoseBones in a Pose.
- It is internal to blender but is called as 'Pose.bones'
- """
-
- def items():
- """
- Return the key, value pairs in this dictionary
- @rtype: string, PosePoseBone
- @return: All strings, and PosePoseBones in the Pose (in that order)
- """
-
- def keys():
- """
- Return the keys in this dictionary
- @rtype: string
- @return: All strings representing the PosePoseBone names
- """
-
- def values():
- """
- Return the values in this dictionary
- @rtype: BPy_PoseBone
- @return: All PosePoseBones in this dictionary
- """
-
-class PoseBone:
- """
- The PoseBone object
- ===================
- This object gives access to PoseBone-specific data in Blender.
- @ivar name: The name of this PoseBone.
- @type name: String
- @ivar loc: The change in location for this PoseBone. this is the equivilent of bone.getLoc() in the old 2.3x python api.
- @type loc: Vector object
- @ivar size: The change in size for this PoseBone (no change is 1,1,1)
- @type size: Vector object
- @ivar quat: The change in rotation for this PoseBone.
- @type quat: Quaternion object
- @ivar head: The final head location for this PoseBone. (not settable)
- @type head: Vector object
- @ivar tail: The final tail location for this PoseBone. (not settable)
- @type tail: Vector object
- @ivar sel: The selection state of this bone
- @type sel: Boolean
- @ivar parent: The parent of this posebone (not settable)
- @type parent: posebone or None
- @ivar displayObject: The object to display in place of the bone. (custom bones)
- @type displayObject: Object or None
- @ivar localMatrix: The matrix combination of rot/size/loc.
- @type localMatrix: Matrix object
- @ivar poseMatrix: The total transformation of this PoseBone including constraints.
-
- This matrix is in armature space, for the current worldspace location of this pose bone, multiply
- it with its objects worldspace matrix.
-
- eg. pose_bone.poseMatrix * object.matrixWorld
-
- Setting the poseMatrix only sets the loc/size/rot, before constraints are applied (similar to actions).
- After setting pose matrix, run pose.update() to re-evaluate the pose and see the changes in the 3d view.
-
- @type poseMatrix: Matrix object
- @type constraints: BPy_ConstraintSeq
- @ivar constraints: a sequence of constraints for the object
- @type limitmin: 3-item sequence
- @ivar limitmin: The x,y,z minimum limits on rotation when part of an IK
- @type limitmax: 3-item sequence
- @ivar limitmax: The x,y,z maximum limits on rotation when part of an IK
-
- @type hasIK: bool
- @ivar hasIK: True if this pose bone is a part of an IK (readonly), when False, other IK related values have no affect.
-
- @type stretch: float
- @ivar stretch: The amount to stretch to the ik target when part of an IK [0.0 - 1.0]
-
- @type stiffX: float
- @ivar stiffX: The x stiffness when part of an IK [0.0 - 0.990]
- @type stiffY: float
- @ivar stiffY: The x stiffness when part of an IK [0.0 - 0.990]
- @type stiffZ: float
- @ivar stiffZ: The x stiffness when part of an IK [0.0 - 0.990]
-
- @type limitX: bool
- @ivar limitX: Limit rotation over X axis when part of an IK.
- @type limitY: bool
- @ivar limitY: Limit rotation over Y axis when part of an IK.
- @type limitZ: bool
- @ivar limitZ: Limit rotation over Z axis when part of an IK.
-
- @type lockXRot: bool
- @ivar lockXRot: Disable X DoF when part of an IK.
- @type lockYRot: bool
- @ivar lockYRot: Disable Y DoF when part of an IK.
- @type lockZRot: bool
- @ivar lockZRot: Disable Z DoF when part of an IK.
- @ivar layerMask: Layer bitmask
- Example::
- # set bone to layers 14 and 16
- bone.layerMask = (1<<13) + (1<<15)
- @type layerMask: Int
- """
-
- def insertKey(parentObject, frameNumber, type = "[Pose.LOC, Pose.ROT, Pose.SIZE]", fast = False):
- """
- Insert a pose key for this PoseBone at a frame.
- @type parentObject: Object object
- @param parentObject: The object the pose came from.
- @type frameNumber: integer
- @param frameNumber: The frame number to insert the pose key on.
- @type type: Constant object
- @param type: Optional argumentm.
- Can be any combination of 3 Module constants:
- - Pose.LOC
- - Pose.ROT (This adds keyframes to the quat ipo, since quaternions are used for pose bone rotation)
- - Pose.SIZE
- If this argument is omitted all keys will be added.
- @type fast: Bool
- @param fast: If enabled, the IPOs will not be recalculated, speeds up adding many keyframes at once.
- @rtype: None
- """
-
diff --git a/source/blender/python/api2_2x/doc/Radio.py b/source/blender/python/api2_2x/doc/Radio.py
deleted file mode 100644
index f336ea56765..00000000000
--- a/source/blender/python/api2_2x/doc/Radio.py
+++ /dev/null
@@ -1,351 +0,0 @@
-# Blender.Scene.Radio module and the Radiosity PyType object
-
-"""
-The Blender.Scene.Radio submodule.
-
-Radio
-=====
-
-This module gives access to B{Scene Radiosity Contexts} in Blender.
-
-Example::
- import Blender
- from Blender import Scene
-
- # Only the current scene has a radiosity context.
- # Naturally, any scene can be made the current one
- # with scene.makeCurrent()
-
- scn = Scene.GetCurrent()
-
- # this is the only way to access the radiosity object:
-
- radio = scn.getRadiosityContext()
-
- radio.setDrawType('Gouraud')
- radio.setMode('ShowLimits', 'Z')
-
- radio.collectMeshes() # prepare patches
- radio.go() # calculate radiosity
- Blender.Redraw(-1)
-
-
-@type Modes: readonly dictionary
-@var Modes:
- - ShowLimits
- - Z
-
-@type DrawTypes: readonly dictionary
-@var DrawTypes:
- - Wire
- - Solid
- - Gouraud
-"""
-
-class Radio:
- """
- The Radiosity object
- ====================
- This object wraps the current Scene's radiosity context in Blender.
- """
-
- def go():
- """
- Start the radiosity simulation. It is necessary to call L{collectMeshes}
- first.
- """
-
- def collectMeshes():
- """
- Convert B{selected} visible meshes to patches for radiosity calculation.
- @note: L{Object.Object.select} can be used to (un)select objects via
- bpython.
- """
-
- def freeData():
- """
- Release all memory used by radiosity.
- """
-
- def addMesh():
- """
- Add the new mesh created by the radiosity simulation (see L{go}) to
- Blender. The radiosity results are stored in this mesh's vertex colors.
- @note: see L{replaceMeshes} for a destructive alternative.
- """
-
- def replaceMeshes():
- """
- Replace the original input meshes with the B{one} calculated by the
- radiosity simulation. The radiosity results are stored in this mesh's
- vertex colors.
- @note: see L{addMesh} for a non-destructive alternative.
- """
-
- def limitSubdivide():
- """
- Subdivide patches (optional, it may improve results).
- """
-
- def filterFaces():
- """
- Force an extra smoothing. This method can be called only after the
- simulation has been calculated (L{go}).
- """
-
- def filterElems():
- """
- Filter elements to remove aliasing artifacts. This method can be called
- only after the simulation has been calculated (L{go}).
- """
-
- def subdividePatches():
- """
- Pre-subdivision: detect high-energy patches and subdivide them
- (optional, it may improve results).
- """
-
- def subdivideElems():
- """
- Pre-subdivision: detect high-energy elements (nodes) and subdivide them
- (optional, it may improve results).
- """
-
- def removeDoubles():
- """
- Join elements (nodes) which differ less than the defined element limit.
- This method can be called only after the simulation has been calculated
- (L{go}).
- """
-
- def getHemiRes():
- """
- Get hemicube size.
- @rtype: int
- @return: the current hemicube size.
- """
-
- def setHemiRes(ival):
- """
- Set hemicube size. The range is [100, 1000].
- @type ival: int
- @param ival: the new size.
- """
-
- def getMaxIter():
- """
- Get maximum number of radiosity rounds.
- @rtype: int
- @return: the current maxiter value.
- """
-
- def setMaxIter(ival):
- """
- Set maximum number of radiosity rounds. The range is [0, 10000].
- @type ival: int
- @param ival: the maxiter new value.
- """
-
- def getSubShPatch():
- """
- Get maximum number of times the environment is tested to detect patches.
- @rtype: int
- @return: the current value.
- """
-
- def setSubShPatch(ival):
- """
- Set the maximum number of times the environment is tested to detect
- patches. The range is [0, 10].
- @type ival: int
- @param ival: the new value.
- """
-
- def getSubShElem():
- """
- Get the number of times the environment is tested to detect elements.
- @rtype: int
- @return: the current value.
- """
-
- def setSubShElem(ival):
- """
- Set number of times the environment is tested to detect elements. The
- range is [0, 10].
- @type ival: int
- @param ival: the new value.
- """
-
- def getElemLimit():
- """
- Get the range for removing doubles.
- @rtype: int
- @return: the current value.
- """
-
- def setElemLimit(ival):
- """
- Set the range for removing doubles. The range is [0, 50].
- @type ival: int
- @param ival: the new value.
- """
-
- def getMaxSubdivSh():
- """
- Get the maximum number of initial shoot patches evaluated.
- @rtype: int
- @return: the current value.
- """
-
- def setMaxSubdivSh(ival):
- """
- Set the maximum number of initial shoot patches evaluated. The range is
- [1, 250].
- @type ival: int
- @param ival: the new value.
- """
-
- def getPatchMax():
- """
- Get the maximum size of a patch.
- @rtype: int
- @return: the current value.
- """
-
- def setPatchMax(ival):
- """
- Set the maximum size of a patch. The range is [10, 1000].
- @type ival: int
- @param ival: the new value.
- """
-
- def getPatchMin():
- """
- Get the minimum size of a patch.
- @rtype: int
- @return: the current value.
- """
-
- def setPatchMin(ival):
- """
- Set the minimum size of a patch. The range is [10, 1000].
- @type ival: int
- @param ival: the new value.
- """
-
- def getElemMax():
- """
- Get the maximum size of an element.
- @rtype: int
- @return: the current value.
- """
-
- def setElemMax(ival):
- """
- Set the maximum size of an element. The range is [1, 100].
- @type ival: int
- @param ival: the new value.
- """
-
- def getElemMin():
- """
- Get the minimum size of an element. The range is [1, 100].
- @rtype: int
- @return: the current value.
- """
-
- def setElemMin(ival):
- """
- Set the minimum size of an element. The range is [1, 100].
- @type ival: int
- @param ival: the new value.
- """
-
- def getMaxElems():
- """
- Get the maximum number of elements.
- @rtype: int
- @return: the current value.
- """
-
- def setMaxElems(ival):
- """
- Set the maximum number of elements. The range is [1, 250000].
- @type ival: int
- @param ival: the new value.
- """
-
- def getConvergence():
- """
- Get lower thresholdo of unshot energy.
- @rtype: float
- @return: the current value.
- """
-
- def setConvergence(fval):
- """
- Set lower threshold of unshot energy. The range is [0.0, 1.0].
- @type fval: float
- @param fval: the new value.
- """
-
- def getMult():
- """
- Get the energy value multiplier.
- @rtype: float
- @return: the current value.
- """
-
- def setMult (fval):
- """
- Set the energy value multiplier. The range is [0.001, 250.0].
- @type fval: float
- @param fval: the new value.
- """
-
- def getGamma():
- """
- Get change in the contrast of energy values.
- @rtype: float
- @return: the current value.
- """
-
- def setGamma (fval):
- """
- Set change in the contrast of energy values. The range is [0.2, 10.0].
- @type fval: float
- @param fval: the new value.
- """
-
- def getDrawType():
- """
- Get the draw type: Wire, Solid or Gouraud as an int value, see L{DrawTypes}.
- @rtype: int
- @return: the current draw type.
- """
-
- def setDrawType (dt):
- """
- Set the draw type.
- @type dt: string or int
- @param dt: either 'Wire', 'Solid' or 'Gouraud' or the equivalent entry in
- the L{DrawTypes} dictionary.
- """
-
- def getMode():
- """
- Get mode as an int (or'ed bitflags), see L{Modes} dictionary.
- @rtype: int
- @return: the current value.
- """
-
- def setMode (mode1 = None, mode2 = None):
- """
- Set mode flags as strings: 'ShowLimits' and 'Z'. To set one give it as
- only argument. Strings not passed in are unset, so setMode() unsets
- both.
- @type mode1: string
- @param mode1: optional mode string.
- @type mode2: string
- @param mode2: optional mode string.
- """
diff --git a/source/blender/python/api2_2x/doc/Registry.py b/source/blender/python/api2_2x/doc/Registry.py
deleted file mode 100644
index 02ac30e71ac..00000000000
--- a/source/blender/python/api2_2x/doc/Registry.py
+++ /dev/null
@@ -1,122 +0,0 @@
-# Blender.Registry module
-
-"""
-The Blender.Registry submodule.
-
-B{New}: L{GetKey} and L{SetKey} have been updated to save and load scripts
-*configuration data* to files.
-
-Registry
-========
-
-This module provides a way to create, retrieve and edit B{persistent data} in
-Blender.
-
-When a script is executed it has its own private global dictionary,
-which is deleted when the script exits. This is done to avoid problems with
-name clashes and garbage collecting. But because of this, the data created by
-a script isn't kept after it leaves: the data is not persistent. The Registry
-module was created to give programmers a way around this limitation.
-
-Possible uses:
- - saving arbitrary data from a script that itself or another one will need
- to access later.
- - saving configuration data for a script: users can view and edit this data
- using the "Scripts Configuration Editor" script.
- - saving the current state of a script's GUI (its button values) to restore it
- when the script is executed again.
-
-Example::
-
- import Blender
- from Blender import Registry
-
- # this function updates the Registry when we need to:
- def update_Registry():
- d = {}
- d['myvar1'] = myvar1
- d['myvar2'] = myvar2
- d['mystr'] = mystr
- # cache = True: data is also saved to a file
- Blender.Registry.SetKey('MyScript', d, True)
-
- # first declare global variables that should go to the Registry:
- myvar1 = 0
- myvar2 = 3.2
- mystr = "hello"
-
- # then check if they are already there (saved on a
- # previous execution of this script):
- rdict = Registry.GetKey('MyScript', True) # True to check on disk also
- if rdict: # if found, get the values saved there
- try:
- myvar1 = rdict['myvar1']
- myvar2 = rdict['myvar2']
- mystr = rdict['mystr']
- except: update_Registry() # if data isn't valid rewrite it
-
- # ...
- # here goes the main part of the script ...
- # ...
-
- # if at some point the data is changed, we update the Registry:
- update_Registry()
-
-@note: In Python terms, the Registry holds a dictionary of dictionaries.
- Technically any Python or BPython object can be stored: there are no
- restrictions, but ...
-
-@note: We have a few recommendations:
-
- Data saved to the Registry is kept in memory, so if you decide to store large
- amounts your script users should be clearly informed about it --
- always keep in mind that you have no idea about their resources and the
- applications they are running at a given time (unless you are the only
- user), so let them decide.
-
- There are restrictions to the data that gets automatically saved to disk by
- L{SetKey}(keyname, dict, True): this feature is only meant for simple data
- (bools, ints, floats, strings and dictionaries or sequences of these types).
-
- For more demanding needs, it's of course trivial to save data to another
- file or to a L{Blender Text<Text>}.
-"""
-
-def Keys ():
- """
- Get all keys currently in the Registry's dictionary.
- """
-
-def GetKey (key, cached = False):
- """
- Get key 'key' from the Registry.
- @type key: string
- @param key: a key from the Registry dictionary.
- @type cached: bool
- @param cached: if True and the requested key isn't already loaded in the
- Registry, it will also be searched on the user or default scripts config
- data dir (config subdir in L{Blender.Get}('datadir')).
- @return: the dictionary called 'key'.
- """
-
-def SetKey (key, dict, cache = False):
- """
- Store a new entry in the Registry.
- @type key: string
- @param key: the name of the new entry, tipically your script's name.
- @type dict: dictionary
- @param dict: a dict with all data you want to save in the Registry.
- @type cache: bool
- @param cache: if True the given key data will also be saved as a file
- in the config subdir of the scripts user or default data dir (see
- L{Blender.Get}).
- @warn: as stated in the notes above, there are restrictions to what can
- be automatically stored in config files.
- """
-
-def RemoveKey (key):
- """
- Remove the dictionary with key 'key' from the Registry.
- @type key: string
- @param key: the name of an existing Registry key.
- """
diff --git a/source/blender/python/api2_2x/doc/Render.py b/source/blender/python/api2_2x/doc/Render.py
deleted file mode 100644
index d75e07de8e3..00000000000
--- a/source/blender/python/api2_2x/doc/Render.py
+++ /dev/null
@@ -1,1192 +0,0 @@
-# Blender.Scene.Render module and the RenderData PyType object
-
-"""
-The Blender.Scene.Render submodule.
-
-Scene.Render
-============
-
-This module provides access to B{Scene Rendering Contexts} in Blender.
-
-Example::
- import Blender
- from Blender import *
- from Blender.Scene import Render
-
- scn = Scene.GetCurrent()
- context = scn.getRenderingContext()
-
- Render.EnableDispWin()
- context.extensions = True
- context.renderPath = "//myRenderdir/"
- context.sizePreset(Render.PC)
- context.imageType = Render.AVIRAW
- context.sFrame = 2
- context.eFrame = 10
- context.renderAnim()
-
- context.imageType = Render.TARGA
- context.fps = 15
- context.sFrame = 15
- context.eFrame = 22
- context.renderAnim()
-
- Render.CloseRenderWindow()
- print context.fps
- print context.cFrame
-
-@type Modes: readonly dictionary
-@var Modes: Constant dict used for with L{RenderData.mode} bitfield attribute.
-Values can be ORed together. Individual bits can also be set/cleared with
-boolean attributes.
- - OSA: Oversampling (anti-aliasing) enabled
- - SHADOW: Shadow calculation enabled
- - GAMMA: Gamma correction enabled
- - ENVMAP: Environment map rendering enabled
- - TOONSHADING: Toon edge shading enabled
- - FIELDRENDER: Field rendering enabled
- - FIELDTIME: Time difference in field calculations I{disabled}
- - RADIOSITY: Radiosity rendering enabled
- - BORDER_RENDER: Small cut-out rendering enabled
- - PANORAMA: Panorama rendering enabled
- - CROP: Crop image during border renders
- - ODDFIELD: Odd field first rendering enabled
- - MBLUR: Motion blur enabled
- - UNIFIED: Unified Renderer enabled
- - RAYTRACING: Ray tracing enabled
- - THREADS: Render in two threads enabled (Deprecated, use L{RenderData.threads})
-
-@type SceModes: readonly dictionary
-@var SceModes: Constant dict used for with L{RenderData.sceneMode} bitfield attribute.
-Values can be ORed together. Individual bits can also be set/cleared with
-boolean attributes.
- - SEQUENCER: Enables sequencer output rendering.
- - EXTENSION: Adds extensions to the output when rendering animations.
- - SAVE_BUFFERS: Save render tiles to disk to save memory.
- - FREE_IMAGES: Free images used by textures after each render.
-
-@type FramingModes: readonly dictionary
-@var FramingModes: Constant dict used for with L{RenderData.gameFrame}
-attribute. One of the following modes can be active:
- - BARS: Show the entire viewport in the display window, using bar
- horizontally or vertically.
- - EXTEND: Show the entire viewport in the display window, viewing more
- horizontally or vertically
- - SCALE: Stretch or squeeze the viewport to fill the display window.
-
-@var INTERNAL: The internal rendering engine. Use with setRenderer()
-@var YAFRAY: Yafray rendering engine. Use with setRenderer()
-
-@var AVIRAW: Output format. Use with renderdata.imageType / setImageType()
-@var AVIJPEG: Output format. Use with renderdata.imageType / setImageType()
-@var AVICODEC: Output format. Use with renderdata.imageType / setImageType()
-@var QUICKTIME: Output format. Use with renderdata.imageType / setImageType()
-@var TARGA: Output format. Use with renderdata.imageType / setImageType()
-@var RAWTGA: Output format. Use with renderdata.imageType / setImageType()
-@var HDR: Output format. Use with renderdata.imageType / setImageType()
-@var PNG: Output format. Use with renderdata.imageType / setImageType()
-@var BMP: Output format. Use with renderdata.imageType / setImageType()
-@var JPEG: Output format. Use with renderdata.imageType / setImageType()
-@var HAMX: Output format. Use with renderdata.imageType / setImageType()
-@var IRIS: Output format. Use with renderdata.imageType / setImageType()
-@var IRISZ: Output format. Use with renderdata.imageType / setImageType()
-@var FTYPE: Output format. Use with renderdata.imageType / setImageType()
-@var OPENEXR: Output format. Use with renderdata.imageType / setImageType()
-@var TIFF: Output format. Use with renderdata.imageType / setImageType()
-@var FFMPEG: Output format. Use with renderdata.imageType / setImageType()
-@var CINEON: Output format. Use with renderdata.imageType / setImageType()
-@var DPX: Output format. Use with renderdata.imageType / setImageType()
-
-@var PAL: Output format. Use with renderdata.sizePreset()
-@var NTSC: Output format. Use with renderdata.sizePreset()
-@var DEFAULT: Output format. Use with renderdata.sizePreset()
-@var PREVIEW: Output format. Use with renderdata.sizePreset()
-@var PC: Output format. Use with renderdata.sizePreset()
-@var PAL169: Output format. Use with renderdata.sizePreset()
-@var B_PR_FULL: Output format. Use with renderdata.sizePreset()
-
-@var NONE: Yafray GI Quality / Method. Use with renderdata.setYafrayGIQuality()
-@var LOW: Yafray GI Quality. Use with renderdata.setYafrayGIQuality()
-@var MEDIUM: Yafray GI Quality. Use with renderdata.setYafrayGIQuality()
-@var HIGH: Yafray GI Quality. Use with renderdata.setYafrayGIQuality()
-@var HIGHER: Yafray GI Quality. Use with renderdata.setYafrayGIQuality()
-@var BEST: Yafray GI Quality. Use with renderdata.setYafrayGIQuality()
-@var USEAOSETTINGS: Yafray GI Quality. Use with renderdata.setYafrayGIQuality()
-@var SKYDOME: Yafray GI Method. Use with renderdata.setYafrayGIMethod()
-@var GIFULL: Yafray GI Method. Use with renderdata.setYafrayGIMethod()
-"""
-
-def CloseRenderWindow():
- """
- Closes the rendering window.
- """
-
-def EnableDispView():
- """
- Render in the 3d View area. B{Note} this method is deprecated;
- use the l{displayMode} attribute instead.
- """
-
-def EnableDispWin():
- """
- Render in Render window.
- B{Note} this method is deprecated; use the l{displayMode} attribute instead.
- """
-
-def SetRenderWinPos(locationList):
- """
- Set the position of the Render window on the screen.
- Possible values are:
- - S = south
- - N = north
- - W = west
- - E = east
- - C = center
- - ne = northeast
- - nw = northwest
- - se = southeast
- - sw = southwest
- @type locationList: PyList of strings
- @param locationList: a list of strings that together define
- the location of the Render window on the screen.
- """
-
-def EnableEdgeShift():
- """
- Globally with the unified renderer enabled the outlines of the render
- are shifted a bit.
- """
-
-def EnableEdgeAll():
- """
- Globally consider transparent faces for edge-rendering with the unified renderer.
- """
-
-class RenderData:
- """
- The RenderData object
- =====================
- This object gives access to Scene rendering contexts in Blender.
- @ivar unified: Unified Renderer enabled.
- Also see B{UNIFIED} in L{Modes} constant dict.
- @type unified: boolean
- @ivar renderwinSize: Size of the rendering window. Valid values are 25, 50,
- 75, or 100.
- @type renderwinSize: int
- @ivar xParts: Number of horizontal parts for image render.
- Values are clamped to the range [2,512].
- @type xParts: int
- @ivar fieldRendering: Field rendering enabled.
- Also see B{FIELDRENDER} in L{Modes} constant dict.
- @type fieldRendering: boolean
- @ivar gammaCorrection: Gamma correction enabled.
- Also see B{GAMMA} in L{Modes} constant dict.
- @type gammaCorrection: boolean
- @ivar eFrame: Ending frame for rendering.
- Values are clamped to the range [1,MAXFRAME].
- @type eFrame: int
- @ivar radiosityRender: Radiosity rendering enabled.
- @type radiosityRender: boolean
- @ivar sizeX: Image width (in pixels).
- Values are clamped to the range [4,10000].
- @type sizeX: int
- @ivar shadow: Shadow calculation enabled.
- Also see B{SHADOW} in L{Modes} constant dict.
- @type shadow: boolean
- @ivar aspectX: Horizontal aspect ratio.
- Values are clamped to the range [1,200].
- @type aspectX: int
- @ivar mode: Mode bitfield. See L{Modes} constant dict for values.
- @type mode: bitfield
- @ivar fieldTimeDisable: Time difference in field calculations I{disabled}.
- @type fieldTimeDisable: int
- @ivar cFrame: The current frame for rendering.
- Values are clamped to the range [1,MAXFRAME].
- @type cFrame: int
- @ivar crop: Crop image during border renders.
- Also see B{CROP} in L{Modes} constant dict.
- @type crop: boolean
- @ivar sFrame: Starting frame for rendering.
- Values are clamped to the range [1,MAXFRAME].
- @type sFrame: int
- @ivar backbuf: Backbuffer image enabled.
- @type backbuf: boolean
- @ivar OSALevel: Oversampling (anti-aliasing) level. Valid values are
- 5, 8, 11, or 16.
- @type OSALevel: int
- @ivar displayMode: Render output in separate window or 3D view.
- Valid values are 0 (display in image editor view), 1 (display in render
- window), or 2 (display full screen).
- @type displayMode: int
- @ivar threads: Number of threads to render, clamed [1-8]
- @type threads: int
- @ivar backbufPath: Path to a background image (setting loads image).
- @type backbufPath: string
- @ivar toonShading: Toon edge shading enabled.
- Also see B{TOONSHADING} in L{Modes} constant dict.
- @type toonShading: boolean
- @ivar sceneMode: Scene mode bitfield. See L{SceModes} constant dict for
- values.
- @type sceneMode: bitfield
- @ivar gameFrameColor: RGB color triplet for bars.
- Values are clamped in the range [0.0,1.0].
- @type gameFrameColor: list of RGB 3 floats
- @ivar sizeY: Image height (in pixels).
- Values are clamped to the range [4,10000].
- @type sizeY: int
- @ivar renderer: Rendering engine choice.
- Valid values are 0 (internal) or 1 (Yafray).
- @type renderer: int
-
- @ivar sequencer: Enables sequencer output rendering.
- Also see B{SEQUENCER} in L{SceModes} constant dict.
- @type sequencer: boolean
- @ivar extensions: Add extensions to output (when rendering animations).
- Also see B{EXTENSION} in L{SceModes} constant dict.
- @type extensions: boolean
- @ivar compositor: 'Do Compositor' enabled.
- @type compositor: boolean
- @ivar freeImages: 'Do Compositor' enabled.
- @type freeImages: boolean
- @ivar singleLayer: Only render the active layer.
- @type singleLayer: boolean
- @ivar saveBuffers: Save render buffers to disk while rendering, saves memory.
- @type saveBuffers: boolean
- @ivar compositeFree: Free nodes that are not used while composite.
- @type compositeFree: boolean
-
- @ivar panorama: Panorama rendering enabled.
- Also see B{PANORAMA} in L{Modes} constant dict.
- @type panorama: boolean
- @ivar rayTracing: Ray tracing enabled.
- Also see B{RAYTRACING} in L{Modes} constant dict.
- @type rayTracing: boolean
- @ivar renderPath: The path to output the rendered images.
- @type renderPath: string
- @ivar gameFrame: Game framing type. See L{FramingModes} constant dict.
- @type gameFrame: int
- @ivar aspectY: Vertical aspect ratio.
- Values are clamped to the range [1,200].
- @type aspectY: int
- @ivar imageType: File format for saving images. See the module's constants
- for values.
- @type imageType: int
- @ivar ftypePath: The path to Ftype file.
- @type ftypePath: string
- @ivar border: The border for border rendering. The format is
- [xmin,ymin,xmax,ymax]. Values are clamped to [0.0,1.0].
- @type border: list of 4 floats.
- @ivar edgeColor: RGB color triplet for edges in Toon shading (unified
- renderer).
- Values are clamped in the range [0.0,1.0].
- @type edgeColor: list of 3 RGB floats
- @ivar yParts: Number of vertical parts for image render.
- Values are clamped to the range [2,512].
- @type yParts: int
- @ivar imagePlanes: Image depth in bits. Valid values are 8, 24, or 32.
- @type imagePlanes: int
- @ivar borderRender: Small cut-out rendering enabled.
- Also see B{BORDER_RENDER} in L{Modes} constant dict.
- @type borderRender: boolean
- @ivar oversampling: Oversampling (anti-aliasing) enabled.
- Also see B{OSA} in L{Modes} constant dict.
- @type oversampling: boolean
- @ivar fps: Frames per second.
- Values are clamped to the range [1,120].
- @ivar fpsBase: Frames per second base: used to generate fractional frames
- per second values. For example, setting fps to 30 and fps_base to 1.001
- will approximate the NTSC frame rate of 29.97 fps.
- Values are clamped to the range [1,120].
- @type fpsBase: float
- @ivar timeCode: Get the current frame in HH:MM:SS:FF format. Read-only.
- @type timeCode: string
- @ivar environmentMap: Environment map rendering enabled.
- Also see B{ENVMAP} in L{Modes} constant dict.
- @type environmentMap: boolean
- @ivar motionBlur: Motion blur enabled.
- Also see B{MBLUR} in L{Modes} constant dict.
- @type motionBlur: boolean
- @ivar oddFieldFirst: Odd field first rendering enabled.
- Also see B{ODDFIELD} in L{Modes} constant dict.
- @type oddFieldFirst: boolean
- @ivar alphaMode: Setting for sky/background. Valid values are 0 (fill
- background with sky), 1 (multiply alpha in advance), or 2 (alpha and color
- values remain unchanged).
- @type alphaMode: int
- @ivar gaussFilter: Gauss filter size.
- Values are clamped to the range [0.5,1.5].
- @type gaussFilter: float
- @ivar mblurFactor: Motion blur factor.
- Values are clamped to the range [0.01,5.0].
- @type mblurFactor: float
- @ivar mapOld: Number of frames the Map Old will last
- Values are clamped to the range [1,900].
- @type mapOld: int
- @ivar mapNew: New mapping value (in frames).
- Values are clamped to the range [1,900].
- @type mapNew: int
- @ivar set: The scene linked as a set to this scene. Values are an existing
- scene or None (setting to None clears the set). The scene argument cannot
- cause a circular link.
- @type set: BPy_Scene or None
- @ivar yafrayGIMethod: Global Illumination method.
- Valid values are NONE (0), SKYDOME (1) or FULL (2).
- @type yafrayGIMethod: int {NONE (0), SKYDOME (1), GIFULL (2)}
- @ivar yafrayGIQuality: Global Illumination quality.
- @type yafrayGIQuality: int {NONE (0), LOW (1), MEDIUM (2), HIGH (3), HIGHER (4), BEST (5), USEAOSETTINGS (6)}
- @ivar yafrayExportToXML: If true export to an xml file and call yafray instead of plugin.
- @type yafrayExportToXML: boolean
- @ivar yafrayAutoAntiAliasing: Automatic anti-aliasing enabled/disabled.
- @type yafrayAutoAntiAliasing: boolean
- @ivar yafrayClampRGB: Clamp RGB enabled/disabled.
- @type yafrayClampRGB: boolean
- @ivar yafrayAntiAliasingPasses: Number of anti-aliasing passes (0 is no Anti-Aliasing).
- @type yafrayAntiAliasingPasses: int [0, 64]
- @ivar yafrayAntiAliasingSamples: Number of samples per pass.
- @type yafrayAntiAliasingSamples: int [0, 2048]
- @ivar yafrayAntiAliasingPixelSize: Anti-aliasing pixel filter size.
- @type yafrayAntiAliasingPixelSize: float [1.0, 2.0]
- @ivar yafrayAntiAliasingThreshold: Anti-aliasing threshold.
- @type yafrayAntiAliasingThreshold: float [0.05, 1.0]
- @ivar yafrayNumberOfProcessors: Number of processors to use.
- @type yafrayNumberOfProcessors: int [1, 8]
- @ivar yafrayGICache: Cache occlusion/irradiance samples (faster).
- @type yafrayGICache: boolean
- @ivar yafrayGICacheBumpNormals: Enable/disable bumpnormals for cache.
- @type yafrayGICacheBumpNormals: boolean
- @ivar yafrayGICacheShadowQuality: Shadow quality, keep it under 0.95 :-).
- @type yafrayGICacheShadowQuality: float [0.01, 1.0]
- @ivar yafrayGICachePixelsPerSample: Maximum number of pixels without samples, the lower the better and slower.
- @type yafrayGICachePixelsPerSample: int [1, 50]
- @ivar yafrayGICacheRefinement: Threshold to refine shadows EXPERIMENTAL. 1 = no refinement.
- @type yafrayGICacheRefinement: float [0.001, 1.0]
- @ivar yafrayGIPhotons: Enable/disable use of global photons to help in GI.
- @type yafrayGIPhotons: boolean
- @ivar yafrayGITunePhotons: If true the photonmap is shown directly in the render for tuning.
- @type yafrayGITunePhotons: boolean
- """
-
- def currentFrame(frame = None):
- """
- Get/set the current frame.
- @type frame: int (optional)
- @param frame: must be between 1 - 30000
- @rtype: int (if prototype is empty)
- @return: Current frame for the scene.
- """
-
- def render():
- """
- Render the scene.
- """
-
- def renderAnim():
- """
- Render a series of frames to an output directory.
- """
-
- def saveRenderedImage(filename, zbuffer=0):
- """
- Saves the image rendered using RenderData.render() to the filename and path
- given in the variable 'filename'.
-
- Make sure the filename you provide makes a valid path when added to the "render path"
- (setRenderPath/getRenderPath) to make up the absolute path.
- If you want to render to a new absolute path just set the renderpath to an
- empty string and use the absolute path as the filename.
- @param filename: The path+filename for the rendered image.
- @type zbuffer: int
- @param zbuffer: Whether or not to render the zbuffer along with the image.
- @type filename: string
- @since: 2.40
- @requires: You must have an image currently rendered before calling this method
- """
-
- def play():
- """
- play animation of rendered images/avi (searches Pics: field).
- """
-
- def getTimeCode():
- """
- Get the current frame as a string in HH:MM:SS:FF format
- @rtype: string
- @return: current frame as a string in HH:MM:SS:FF format
- """
-
- def setRenderPath(path):
- """
- Set the path to where the renderer will write to.
- @type path: string
- @param path: A directory for that the renderer searches for
- both playback and output from the renderAnim function.
- """
-
- def getRenderPath():
- """
- Get the path to where the renderer will write to.
- @rtype: string
- @return: Returns the directory that is used to playback and store rendered
- sequences.
- """
-
- def setBackbufPath(path):
- """
- Set the path to a background image and load it.
- @type path: string
- @param path: The path to a background image for loading.
- """
-
- def getBackbufPath():
- """
- Get the path to the background image.
- @rtype: string
- @return: The path to a background image.
- """
-
- def enableBackbuf(toggle):
- """
- Enable/disable the backbuf image.
- @type toggle: int
- @param toggle: pass 1 for on / 0 for off
- """
-
- def setFtypePath(path):
- """
- Set the path to Ftype file.
- @type path: string
- @param path: Path to Ftype Image type.
- """
-
- def getFtypePath():
- """
- Get the path to the Ftype file
- @rtype: string
- @return: Path to FtypeImage type.
- """
-
- def enableExtensions(toggle):
- """
- Enable/disable windows extensions for output files.
- @type toggle: int
- @param toggle: pass 1 for on / 0 for off
- """
-
- def enableSequencer(toggle):
- """
- Enable/disable Do Sequence.
- @type toggle: int
- @param toggle: pass 1 for on / 0 for off
- """
-
- def enableRenderDaemon(toggle):
- """
- Enable/disable Scene daemon.
- @type toggle: int
- @param toggle: pass 1 for on / 0 for off
- """
-
- def enableToonShading(toggle):
- """
- Enable/disable Edge rendering.
- @type toggle: int
- @param toggle: pass 1 for on / 0 for off
- """
-
- def edgeIntensity(intensity = None):
- """
- Get/set edge intensity for toon shading.
- @type intensity: int (optional)
- @param intensity: must be between 0 - 255
- @rtype: int (if prototype is empty)
- @return: Current edge intensity for the scene.
- """
-
- def setEdgeColor(red, green, blue):
- """
- Set the edge color for toon shading.
- @type red: float
- @param red: must be between 0 - 1.0
- @type green: float
- @param green: must be between 0 - 1.0
- @type blue: float
- @param blue: must be between 0 - 1.0
- """
-
- def getEdgeColor():
- """
- Get the edge color for toon shading.
- @rtype: string
- @return: A string representing the edge color.
- """
-
- def edgeAntiShift(intensity = None):
- """
- With the unified renderer, reduce intensity on boundaries.
- @type intensity: int (optional)
- @param intensity: must be between 0 - 255
- @rtype: int (if prototype is empty)
- @return: Current edge antishift for the scene.
- """
-
- def enableOversampling(toggle):
- """
- Enable/disable oversampling (anti-aliasing).
- @type toggle: int
- @param toggle: pass 1 for on / 0 for off
- """
-
- def setOversamplingLevel(level):
- """
- Set the level of over-sampling (anti-aliasing).
- @type level: int
- @param level: can be either 5, 8, 11, or 16
- """
-
- def enableMotionBlur(toggle):
- """
- Enable/disable MBlur.
- @type toggle: int
- @param toggle: pass 1 for on / 0 for off
- """
-
- def motionBlurLevel(level = None):
- """
- Get/set the length of shutter time for motion blur.
- @type level: float (optional)
- @param level: must be between 0.01 - 5.0
- @rtype: float (if prototype is empty)
- @return: Current MBlur for the scene.
- """
-
- def partsX(parts = None):
- """
- Get/set the number of parts to divide the render in the X direction.
- @type parts: int (optional)
- @param parts: must be between 1 - 64
- @rtype: int (if prototype is empty)
- @return: Current number of parts in the X for the scene.
- """
-
- def partsY(parts = None):
- """
- Get/set the number of parts to divide the render in the Y direction.
- @type parts: int (optional)
- @param parts: must be between 1 - 64
- @rtype: int (if prototype is empty)
- @return: Current number of parts in the Y for the scene.
- """
-
- def enableSky():
- """
- Enable render background with sky.
- """
-
- def enablePremultiply():
- """
- Enable premultiply alpha.
- """
-
- def enableKey():
- """
- Enable alpha and color values remain unchanged.
- """
-
- def enableShadow(toggle):
- """
- Enable/disable shadow calculation.
- @type toggle: int
- @param toggle: pass 1 for on / 0 for off
- """
-
- def enableEnvironmentMap(toggle):
- """
- Enable/disable environment map rendering.
- @type toggle: int
- @param toggle: pass 1 for on / 0 for off
- """
-
- def enableRayTracing(toggle):
- """
- Enable/disable ray tracing.
- @type toggle: int
- @param toggle: pass 1 for on / 0 for off
- """
-
- def enableRadiosityRender(toggle):
- """
- Enable/disable radiosity rendering.
- @type toggle: int
- @param toggle: pass 1 for on / 0 for off
- """
-
- def enablePanorama(toggle):
- """
- Enable/disable panorama rendering (output width is multiplied by Xparts).
- @type toggle: int
- @param toggle: pass 1 for on / 0 for off
- """
-
- def setRenderWinSize(size):
- """
- Set the size of the render window.
- @type size: int
- @param size: can be 25, 50, 75 or 100 (percent).
- """
-
- def getRenderWinSize():
- """
- Get the size of the render window.
- @rtype: int
- @return: window size; can be 25, 50, 75 or 100 (percent).
- """
-
- def enableFieldRendering(toggle):
- """
- Enable/disable field rendering
- @type toggle: int
- @param toggle: pass 1 for on / 0 for off
- """
-
- def enableOddFieldFirst(toggle):
- """
- Enable/disable Odd field first rendering (Default: Even field).
- @type toggle: int
- @param toggle: pass 1 for on / 0 for off
- """
-
- def enableFieldTimeDisable(toggle):
- """
- Enable/disable time difference in field calculations.
- @type toggle: int
- @param toggle: pass 1 for on / 0 for off
- """
-
- def enableGaussFilter(toggle):
- """
- Enable/disable Gauss sampling filter for anti-aliasing.
- @type toggle: int
- @param toggle: pass 1 for on / 0 for off
- """
-
- def enableBorderRender(toggle):
- """
- Enable/disable small cut-out rendering.
- @type toggle: int
- @param toggle: pass 1 for on / 0 for off
- """
-
- def setBorder(left,bottom,right,top):
- """
- Set a border for rendering from cameras in the scene.
- The left,bottom coordinates and right,top coordinates
- define the size of the border. (0,0,1,1) will set the border
- to the whole camera. (0,0) lower left and (1,1) upper right.
- @type left: float
- @param left: float between 0 and 1
- @type right: float
- @param right: float between 0 and 1
- @type bottom: float
- @param bottom: float between 0 and 1
- @type top: float
- @param top: float between 0 and 1
- """
-
- def enableGammaCorrection(toggle):
- """
- Enable/disable gamma correction.
- @type toggle: int
- @param toggle: pass 1 for on / 0 for off
- """
-
- def gaussFilterSize(size = None):
- """
- Get/sets the Gauss filter size.
- @type size: float (optional)
- @param size: must be between 0.5 - 1.5
- @rtype: float (if prototype is empty)
- @return: Current gauss filter size for the scene.
- """
-
- def startFrame(frame = None):
- """
- Get/set the starting frame for sequence rendering.
- @type frame: int (optional)
- @param frame: must be between 1 - 18000
- @rtype: int (if prototype is empty)
- @return: Current starting frame for the scene.
- """
-
- def endFrame(frame = None):
- """
- Get/set the ending frame for sequence rendering.
- @type frame: int (optional)
- @param frame: must be between 1 - 18000
- @rtype: int (if prototype is empty)
- @return: Current ending frame for the scene.
- """
-
- def imageSizeX(size = None):
- """
- Get/set the image width in pixels.
- @type size: int (optional)
- @param size: must be between 4 - 10000
- @rtype: int (if prototype is empty)
- @return: Current image width for the scene.
- """
-
- def imageSizeY(size = None):
- """
- Get/set the image height in pixels.
- @type size: int (optional)
- @param size: must be between 4 - 10000
- @rtype: int (if prototype is empty)
- @return: Current image height for the scene.
- """
-
- def aspectRatioX(ratio = None):
- """
- Get/set the horizontal aspect ratio.
- @type ratio: int (optional)
- @param ratio: must be between 1 - 200
- @rtype: int (if prototype is empty)
- @return: Current horizontal aspect ratio for the scene.
- """
-
- def aspectRatioY(ratio = None):
- """
- Get/set the vertical aspect ratio.
- @type ratio: int (optional)
- @param ratio: must be between 1 - 200
- @rtype: int (if prototype is empty)
- @return: Current vertical aspect ratio for the scene.
- """
-
- def setRenderer(type):
- """
- Get/set which renderer to render the output.
- @type type: enum constant
- @param type: must be one of 2 constants:
- - INTERN: Blender's internal renderer
- - YAFRAY: Yafray renderer
- """
-
- def enableCropping(toggle):
- """
- Enable/disable exclusion of border rendering from total image.
- @type toggle: int
- @param toggle: pass 1 for on / 0 for off
- """
-
- def setImageType(type):
- """
- Set the type of image to output from the render.
- @type type: enum constant
- @param type: must be one of 13 constants:
- - AVIRAW: Uncompressed AVI files. AVI is a commonly used format on Windows platforms
- - AVIJPEG: AVI movie w/ JPEG images
- - AVICODEC: AVI using win32 codec
- - QUICKTIME: Quicktime movie (if enabled)
- - TARGA: Targa files
- - RAWTGA: Raw Targa files
- - PNG: Png files
- - BMP: Bitmap files
- - JPEG90: JPEG files
- - HAMX: Hamx files
- - IRIS: Iris files
- - IRIZ: Iris + z-buffer files
- - FTYPE: Ftype file
- """
-
- def quality(qual = None):
- """
- Get/set quality get/setting for JPEG images, AVI JPEG and SGI movies.
- @type qual: int (optional)
- @param qual: must be between 10 - 100
- @rtype: int (if prototype is empty)
- @return: Current image quality for the scene.
- """
-
- def framesPerSec(qual = None):
- """
- Get/set frames per second.
- @type qual: int (optional)
- @param qual: must be between 1 - 120
- @rtype: int (if prototype is empty)
- @return: Current frames per second for the scene.
- """
-
- def enableGrayscale():
- """
- Images are saved with black and white (grayscale) data.
- """
-
- def enableRGBColor():
- """
- Images are saved with RGB (color) data.
- """
-
- def enableRGBAColor():
- """
- Images are saved with RGB and Alpha data (if supported).
- """
-
- def sizePreset(type):
- """
- Set the renderer to one of a few presets.
- @type type: enum constant
- @param type: must be one of 8 constants:
- - PAL: The European video standard: 720 x 576 pixels, 54 x 51 aspect.
- - FULL: For large screens: 1280 x 1024 pixels.
- - PREVIEW: For preview rendering: 320 x 256 pixels.
- - PAL169: Wide-screen PAL.
- - DEFAULT: Like "PAL", but here the render settings are also set.
- - PANO: Panorama render.
- - NTSC: For TV playback.
- - PC: For standard PC graphics: 640 x 480 pixels.
- """
-
- def enableUnifiedRenderer(toggle):
- """
- Use the unified renderer.
- @type toggle: int
- @param toggle: pass 1 for on / 0 for off
- """
-
- def setYafrayGIQuality(type):
- """
- Set yafray global Illumination quality.
- @type type: enum constant
- @param type: must be one of 6 constants:
- - NONE
- - LOW
- - MEDIUM
- - HIGH
- - HIGHER
- - BEST
- - USEAOSETTINGS
- """
-
- def getYafrayGIQuality():
- """
- Get yafray global Illumination quality.
- @rtype: enum constant
- @return: one of 6 constants:
- - NONE
- - LOW
- - MEDIUM
- - HIGH
- - HIGHER
- - BEST
- - USEAOSETTINGS
- """
-
- def setYafrayGIMethod(type):
- """
- Set yafray global Illumination method.
- @type type: enum constant
- @param type: must be one of 3 constants:
- - NONE: Do not use GI illumination
- - SKYDOME: Use Skydome method
- - GIFULL: Use Full method
- """
-
- def getYafrayGIMethod():
- # (dietrich) 2007/06/01
- """
- Get yafray global Illumination method.
- @rtype: enum constant -
- @return: Current yafray global illumination method:
- - NONE: Do not use GI illumination
- - SKYDOME: Use Skydome method
- - GIFULL: Use Full method
- """
-
- def yafrayGIPower(power = None):
- """
- Get/set GI lighting intensity scale.
- YafrayMethod must be either SKYDOME or GIFULL.
- @type power: float (optional)
- @param power: must be between 0.01 - 100.0
- @rtype: float (if prototype is empty)
- @return: Current yafray global illumination intensity for the scene.
- """
-
- def yafrayGIIndirPower(power = None):
- """
- Get/set GI indirect lighting intensity scale.
- @type power: float (optional)
- @param power: must be between 0.01 - 100.0
- @rtype: float (if prototype is empty)
- @return: Current yafray indirect illumination intensity for the scene.
- """
-
- def yafrayGIDepth(depth = None):
- """
- Get/set number of bounces of the indirect light.
- YafrayMethod must be GIFULL.
- @type depth: int (optional)
- @param depth: must be between 1 - 8
- @rtype: int (if prototype is empty)
- @return: Current yafray global illumination light bounces for the scene.
- """
-
- def yafrayGICDepth(depth = None):
- """
- Get/set number of bounces inside objects (for caustics).
- YafrayMethod must be GIFULL.
- @type depth: int (optional)
- @param depth: must be between 1 - 8
- @rtype: int (if prototype is empty)
- @return: Current yafray global illumination inside light bounces for the scene.
- """
-
- def enableYafrayGICache(toggle):
- """
- Enable/disable cache irradiance samples (faster).
- YafrayMethod must be GIFULL.
- @type toggle: int
- @param toggle: pass 1 for on / 0 for off
- """
-
- def enableYafrayGIPhotons(toggle):
- """
- Enable/disable use of global photons to help in GI.
- YafrayMethod must be GIFULL.
- @type toggle: int
- @param toggle: pass 1 for on / 0 for off
- """
-
- def yafrayGIPhotonCount(count = None):
- """
- Get/set number of photons to shoot.
- YafrayMethod must be GIFULL and Photons enabled.
- @type count: int (optional)
- @param count: must be between 0 - 10000000
- @rtype: int (if prototype is empty)
- @return: Current number of photons to shoot for the scene.
- """
-
-
- def yafrayGIPhotonRadius(radius = None):
- """
- Get/set radius to search for photons to mix (blur).
- YafrayMethod must be GIFULL and Photons enabled.
- @type radius: float (optional)
- @param radius: must be between 0.00001 - 100.0
- @rtype: float (if prototype is empty)
- @return: Current photon search radius for the scene.
- """
-
-
- def yafrayGIPhotonMixCount(count = None):
- """
- Get/set number of photons to keep inside radius.
- YafrayMethod must be GIFULL and Photons enabled.
- @type count: int (optional)
- @param count: must be between 0 - 1000
- @rtype: int (if prototype is empty)
- @return: Current number of photons to keep inside radius for the scene.
- """
-
- def enableYafrayGITunePhotons(toggle):
- """
- Enable/disable show the photon map directly in the render for tuning.
- YafrayMethod must be GIFULL and Photons enabled.
- @type toggle: int
- @param toggle: pass 1 for on / 0 for off
- """
-
- def yafrayGIShadowQuality(qual = None):
- """
- Get/set the shadow quality, keep it under 0.95.
- YafrayMethod must be GIFULL and Cache enabled.
- @type qual: float (optional)
- @param qual: must be between 0.01 - 1.0
- @rtype: float (if prototype is empty)
- @return: Current shadow quality for the scene.
- """
-
- def yafrayGIPixelsPerSample(pixels = None):
- """
- Get/set maximum number of pixels without samples, the lower the better and slower.
- YafrayMethod must be GIFULL and Cache enabled.
- @type pixels: int (optional)
- @param pixels: must be between 1 - 50
- @rtype: int (if prototype is empty)
- @return: Current number of pixels without samples for the scene.
- """
-
- def enableYafrayGIGradient(toggle):
- """
- Enable/disable try to smooth lighting using a gradient.
- YafrayMethod must be GIFULL and Cache enabled.
- @type toggle: int
- @param toggle: pass 1 for on / 0 for off
- """
-
- def yafrayGIRefinement(refine = None):
- """
- Get/set threshold to refine shadows EXPERIMENTAL. 1 = no refinement.
- YafrayMethod must be GIFULL and Cache enabled.
- @type refine: float (optional)
- @param refine: must be between 0.001 - 1.0
- @rtype: float (if prototype is empty)
- @return: Current threshold to refine shadows for the scene.
- """
-
- def yafrayRayBias(bias = None):
- """
- Get/set shadow ray bias to avoid self shadowing.
- @type bias: float (optional)
- @param bias: must be between 0 - 10.0
- @rtype: float (if prototype is empty)
- @return: Current ray bias for the scene.
- """
-
- def yafrayRayDepth(depth = None):
- """
- Get/set maximum render ray depth from the camera.
- @type depth: int (optional)
- @param depth: must be between 1 - 80
- @rtype: int (if prototype is empty)
- @return: Current ray depth for the scene.
- """
-
- def yafrayGamma(gamma = None):
- """
- Get/set gamma correction, 1 is off.
- @type gamma: float (optional)
- @param gamma: must be between 0.001 - 5.0
- @rtype: float (if prototype is empty)
- @return: Current gamma correction for the scene.
- """
-
- def yafrayExposure(expose = None):
- """
- Get/set exposure adjustment, 0 is off.
- @type expose: float (optional)
- @param expose: must be between 0 - 10.0
- @rtype: float (if prototype is empty)
- @return: Current exposure adjustment for the scene.
- """
-
- def yafrayProcessorCount(count = None):
- """
- Get/set number of processors to use.
- @type count: int (optional)
- @param count: must be between 1 - 8
- @rtype: int (if prototype is empty)
- @return: Current number of processors for the scene.
- """
-
- def enableGameFrameStretch():
- """
- Enable stretch or squeeze the viewport to fill the display window.
- """
-
- def enableGameFrameExpose():
- """
- Enable show the entire viewport in the display window, viewing more
- horizontally or vertically.
- """
-
- def enableGameFrameBars():
- """
- Enable show the entire viewport in the display window, using bar
- horizontally or vertically.
- """
-
- def setGameFrameColor(red, green, blue):
- """
- Set the red, green, blue component of the bars.
- @type red: float
- @param red: must be between 0 - 1.0
- @type green: float
- @param green: must be between 0 - 1.0
- @type blue: float
- @param blue: must be between 0 - 1.0
- """
-
- def getGameFrameColor():
- """
- Set the red, green, blue component of the bars.
- @rtype: string
- @return: A string representing the color component of the bars.
- """
-
- def gammaLevel(level = None):
- """
- Get/set the gamma value for blending oversampled images (1.0 = no correction).
- Unified renderer must be enabled.
- @type level: float (optional)
- @param level: must be between 0.2 - 5.0
- @rtype: float (if prototype is empty)
- @return: Current gamma value for the scene.
- """
-
- def postProcessAdd(add = None):
- """
- Get/set post processing add.
- Unified renderer must be enabled.
- @type add: float (optional)
- @param add: must be between -1.0 - 1.0
- @rtype: float (if prototype is empty)
- @return: Current processing add value for the scene.
- """
-
- def postProcessMultiply(mult = None):
- """
- Get/set post processing multiply.
- Unified renderer must be enabled.
- @type mult: float (optional)
- @param mult: must be between 0.01 - 4.0
- @rtype: float (if prototype is empty)
- @return: Current processing multiply value for the scene.
- """
-
- def postProcessGamma(gamma = None):
- """
- Get/set post processing gamma.
- Unified renderer must be enabled.
- @type gamma: float (optional)
- @param gamma: must be between 0.2 - 2.0
- @rtype: float (if prototype is empty)
- @return: Current processing gamma value for the scene.
- """
-
- def SGIMaxsize(size = None):
- """
- Get/set maximum size per frame to save in an SGI movie.
- SGI must be defined on your machine.
- @type size: int (optional)
- @param size: must be between 0 - 500
- @rtype: int (if prototype is empty)
- @return: Current SGI maximum size per frame for the scene.
- """
-
- def enableSGICosmo(toggle):
- """
- Enable/disable attempt to save SGI movies using Cosmo hardware
- SGI must be defined on your machine.
- @type toggle: int
- @param toggle: pass 1 for on / 0 for off
- """
-
- def oldMapValue(value = None):
- """
- Get/set specify old map value in frames.
- @type value: int (optional)
- @param value: must be between 1 - 900
- @rtype: int (if prototype is empty)
- @return: Current old map value for the scene.
- """
-
- def newMapValue(value = None):
- """
- Get/set specify new map value in frames.
- @type value: int (optional)
- @param value: must be between 1 - 900
- @rtype: int (if prototype is empty)
- @return: Current new map value for the scene.
- """
diff --git a/source/blender/python/api2_2x/doc/Scene.py b/source/blender/python/api2_2x/doc/Scene.py
deleted file mode 100644
index 77e33e143f5..00000000000
--- a/source/blender/python/api2_2x/doc/Scene.py
+++ /dev/null
@@ -1,392 +0,0 @@
-# Blender.Scene module and the Scene PyType object
-
-"""
-The Blender.Scene submodule.
-
-B{New}:
- - L{Scene.clearScriptLinks<Scene.Scene.clearScriptLinks>} accepts a parameter now.
- - acess methods L{Scene.getLayers<Scene.Scene.getLayers>}, L{Scene.setLayers<Scene.Scene.setLayers>} via lists to complement the layers and
- Layers Scene attributes which use bitmasks.
-
-Scene
-=====
-
-This module provides access to B{Scenes} in Blender.
-
-Example::
- import Blender
- from Blender import Scene, Object, Camera
- #
- camdata = Camera.New('persp') # create new camera data
- camdata.name = 'newCam'
- camdata.lens = 16.0
- scene = Scene.New('NewScene') # create a new scene
- scene.objects.new(camdata,'Camera') # add a new object to the scene with newly-created data
- scene.makeCurrent() # make this the current scene
-
-@warn: B{scene.objects.new} is the preferred way to add new objects to a scene.
- The older way is to create an object with B{Object.New()}, link the
- data to the new object, then link the object to the scene. This way is
- not recommended since a forgotten step or run-time error in the script can
- cause bad things to be done to Blender's database.
-
- If you use this older method, it's recommended to always perform the
- operations in this order. This is because if
- there is no object data linked to an object B{ob}, B{scene.link(ob)} will
- automatically create the missing data. This is OK on its own, but I{if
- after that} object B{ob} is linked to obdata, the automatically created one
- will be discarded -- as expected -- but will stay in Blender's memory
- space until the program is exited, since Blender doesn't really get rid of
- most kinds of data. So first linking ObData to object, then object to
- scene is a tiny tiny bit faster than the other way around and also saves
- some realtime memory (if many objects are created from scripts, the
- savings become important).
-"""
-
-def New (name = 'Scene'):
- """
- Create a new Scene in Blender.
- @type name: string
- @param name: The Scene name.
- @rtype: Blender Scene
- @return: The created Scene.
- """
-
-def Get (name = None):
- """
- Get the Scene(s) from Blender.
- @type name: string
- @param name: The name of a Scene.
- @rtype: Blender Scene or a list of Blender Scenes
- @return: It depends on the I{name} parameter:
- - (name): The Scene with the given I{name};
- - (): A list with all Scenes currently in Blender.
- """
-
-def GetCurrent():
- """
- Get the currently active Scene in Blender.
- @rtype: Blender Scene
- @return: The currently active Scene.
- """
-
-def Unlink(scene):
- """
- Unlink (delete) a Scene from Blender.
- @type scene: Blender Scene
- @param scene: The Scene to be unlinked.
- """
-
-from IDProp import IDGroup, IDArray
-class Scene:
- """
- The Scene object
- ================
- This object gives access to Scene data in Blender.
- @type Layers: integer (bitmask)
- @ivar Layers: The Scene layers (check also the easier to use
- L{layers}). This value is a bitmask with at least
- one position set for the 20 possible layers starting from the low order
- bit. The easiest way to deal with these values in in hexadecimal
- notation.
- Example::
- scene.Layers = 0x04 # sets layer 3 ( bit pattern 0100 )
- scene.Layers |= 0x01
- print scene.Layers # will print: 5 ( meaning bit pattern 0101)
- After setting the Layers value, the interface (at least the 3d View and
- the Buttons window) needs to be redrawn to show the changes.
- @type layers: list of integers
- @ivar layers: The Scene layers (check also L{Layers}).
- This attribute accepts and returns a list of integer values in the
- range [1, 20].
- Example::
- scene.layers = [3] # set layer 3
- scene.layers = scene.layers.append(1)
- print scene.layers # will print: [1, 3]
- @type objects: sequence of objects
- @ivar objects: The scene's objects. The sequence supports the methods .link(ob), .unlink(ob), and .new(obdata), and can be iterated over.
- @type cursor: Vector (wrapped)
- @ivar cursor: the 3d cursor location for this scene.
- @type camera: Camera or None
- @ivar camera: The active camera for this scene (can be set)
- @type world: World or None
- @ivar world: The world that this scene uses (if any)
- @type timeline: Timeline
- @ivar timeline: The L{timeline<TimeLine.TimeLine>} for this scene, named markers are stored here. (read only)
- @type render: RenderData
- @ivar render: The scenes L{render<Render.RenderData>} settings. (read only)
- @type radiosity: RenderData
- @ivar radiosity: The scenes L{radiosity<Radio>} settings. (read only)
- """
-
- def getName():
- """
- Get the name of this Scene.
- @rtype: string
- """
-
- def setName(name):
- """
- Set the name of this Scene.
- @type name: string
- @param name: The new name.
- """
-
- def getLayers():
- """
- Get the layers set for this Scene.
- @rtype: list of integers
- @return: a list where each number means the layer with that number is set.
- """
-
- def setLayers(layers):
- """
- Set the visible layers for this scene.
- @type layers: list of integers
- @param layers: a list of integers in the range [1, 20], where each available
- index makes the layer with that number visible.
- @note: if this Scene is the current one, the 3D View layers are also
- updated, but the screen needs to be redrawn (at least 3D Views and
- Buttons windows) for the changes to be seen.
- """
-
- def copy(duplicate_objects = 1):
- """
- Make a copy of this Scene.
- @type duplicate_objects: int
- @param duplicate_objects: Defines how the Scene children are duplicated:
- - 0: Link Objects;
- - 1: Link Object Data;
- - 2: Full copy.
- @rtype: Scene
- @return: The copied Blender Scene.
- """
-
- def makeCurrent():
- """
- Make this Scene the currently active one in Blender.
- """
-
- def update(full = 0):
- """
- Update this Scene in Blender.
- @type full: int
- @param full: A bool to control the level of updating:
- - 0: sort the base list of objects.
- - 1: sort and also regroup, do ipos, keys, script links, etc.
- @warn: When in doubt, try with I{full = 0} first, since it is faster.
- The "full" update is a recent addition to this method.
- """
-
- def getRenderingContext():
- """
- Get the rendering context for this scene, see L{Render}.
- @rtype: RenderData
- @return: the render data object for this scene.
- """
-
- def getRadiosityContext():
- """
- Get the radiosity context for this scene, see L{Radio}.
- @rtype: Blender Radiosity
- @return: the radiosity object for this scene.
- @note: only the current scene can return a radiosity context.
- """
-
- def getChildren():
- """
- Get all objects linked to this Scene. (B{deprecated}). B{Note}: new scripts
- should use the L{objects} attribute instead. In cases where a list is
- required use list(scn.objects).
- @rtype: list of Blender Objects
- @return: A list with all Blender Objects linked to this Scene.
- @note: L{Object.Get} will return all objects currently in Blender, which
- means all objects from all available scenes. In most cases (exporter
- scripts, for example), it's probably better to use this
- scene.GetChildren instead, since it will only access objects from this
- particular scene.
- @warn: Depricated! use scene.objects instead.
- """
-
- def getActiveObject():
- """
- Get this scene's active object.
- @note: the active object, if selected, can also be retrieved with
- L{Object.GetSelected} -- it is the first item in the returned
- list. But even when no object is selected in Blender, there can be
- an active one (if the user enters editmode, for example, this is the
- object that should become available for edition). So what makes this
- scene method different from C{Object.GetSelected()[0]} is that it can
- return the active object even when no objects are selected.
- @rtype: Blender Object or None
- @return: the active object or None if not available.
- @warn: Depricated! use scene.objects.active instead.
- """
-
- def getCurrentCamera():
- """
- Get the currently active Camera for this Scene.
- @note: The active camera can be any object type, not just a camera object.
- @rtype: Blender Object
- @return: The currently active Camera object.
- """
-
- def setCurrentCamera(camera):
- """
- Set the currently active Camera in this Scene.
- @type camera: Blender Camera
- @param camera: The new active Camera.
- """
-
- def link(object):
- """
- Link an Object to this Scene.
- @type object: Blender Object
- @param object: A Blender Object.
- """
-
- def unlink(object):
- """
- Unlink an Object from this Scene.
- @type object: Blender Object
- @param object: A Blender Object.
- @rtype: boolean
- @return: true if object was found in the scene.
- """
-
- def getScriptLinks (event):
- """
- Get a list with this Scene's script links of type 'event'.
- @type event: string
- @param event: "FrameChanged", "OnLoad", "OnSave", "Redraw" or "Render".
- @rtype: list
- @return: a list with Blender L{Text} names (the script links of the given
- 'event' type) or None if there are no script links at all.
- """
-
- def clearScriptLinks (links = None):
- """
- Delete script links from this Scene. If no list is specified, all
- script links are deleted.
- @type links: list of strings
- @param links: None (default) or a list of Blender L{Text} names.
- """
-
- def addScriptLink (text, event):
- """
- Add a new script link to this Scene.
-
- Using OpenGL functions within a scene ScriptLink will draw graphics over the 3D view.
- There is an issue with the zoom of the floating panels also scaling graphics drawn by your scriptlink.
- This makes matching OpenGL graphics to mouse location impossible.
- Make sure that you use floating point for operations that you would usually use int functions for: glRasterPos2f rather then glRasterPos2i.
-
- The following example shows how you can use the OpenGL model view matrix to obtain the scale value.
-
- Example::
- from Blender import BGL
- view_matrix = BGL.Buffer(BGL.GL_FLOAT, 16)
- BGL.glGetFloatv(BGL.GL_MODELVIEW_MATRIX, view_matrix)
- gl_scale = 1/viewMatrix[0]
-
- # Now that we have the scale we can draw to the correct scale.
- BGL.glRect2f(10*gl_scale, 10*gl_scale, 110*gl_scale, 110*gl_scale)
-
-
- @type text: string
- @param text: the name of an existing Blender L{Text}.
- @type event: string
- @param event: "FrameChanged", "OnLoad", "OnSave", "Redraw" or "Render".
- """
-
- def play (mode = 0, win = '<VIEW3D>'):
- """
- Play a realtime animation. This is the "Play Back Animation" function in
- Blender, different from playing a sequence of rendered images (for that
- check L{Render.RenderData.play}).
- @type mode: int
- @param mode: controls playing:
- - 0: keep playing in the biggest 'win' window;
- - 1: keep playing in all 'win', VIEW3D and SEQ windows;
- - 2: play once in the biggest VIEW3D;
- - 3: play once in all 'win', VIEW3D and SEQ windows.
- @type win: int
- @param win: window type, see L{Window.Types}. Only some of them are
- meaningful here: VIEW3D, SEQ, IPO, ACTION, NLA, SOUND. But the others
- are also accepted, since this function can be used simply as an
- interruptible timer. If 'win' is not visible or invalid, VIEW3D is
- tried, then any bigger visible window.
- @rtype: bool
- @return: 0 on normal exit or 1 when play back is canceled by user input.
- """
-
-import id_generics
-Scene.__doc__ += id_generics.attributes
-
-
-class SceneObjects:
- """
- The SceneObjects (Scene ObjectSeq) object
- =========================================
- This object gives access to the Objects in a Scene in Blender.
-
- Example::
- from Blender import Scene
- scn = Scene.GetCurrent()
-
- scn.objects.selected = [] # select none
- scn.objects.selected = scn.objects # select all
- scn.objects.context = scn.objects # select all and move into the scenes display layer
-
- # get a list of mesh objects
- obs = [ob for ob in scn.objects if ob.type == 'Mesh']
-
- # Select only these mesh objects
- scn.objects.selected = obs
-
- # print all object names
- for ob in scn.objects: print ob.name
-
- # make a list of objects that you can add and remove to
- # will not affect the current scene
- scene_obs = list(scn.objects)
-
- @ivar selected: an iterator over all the selected objects in a scene.
- @type selected: sequence of L{Object}
- @ivar context: an iterator over all the visible selected objects in a scene.
- @type context: sequence of L{Object}
- @ivar active: the active object in the scene.
- @type active: L{Object}
- @ivar camera: the active camera in the scene.
- @type camera: L{Object}
- """
-
- def new(data):
- """
- Adds a new object to the scene. Data is either object data such as a
- L{Mesh} or L{Curve}, or the string "Empty" for an Empty object. The
- type of the object is determined by the type of the data.
- @type data: string or object data
- @param data: the object data for the new object
- @return: the new object.
- @rtype: L{Object}
- """
-
- def link(object):
- """
- Adds an existing object to the scene. If the object is already linked
- to the scene, no action is taken and no exception is raised.
- @type object: L{Object}
- @param object: the object
- @rtype: None
- """
-
- def unlink(object):
- """
- Removes an object from the scene. If the object is not linked
- to the scene, no action is taken and no exception is raised.
- @type object: L{Object}
- @param object: the object
- @rtype: None
- """
-
diff --git a/source/blender/python/api2_2x/doc/Sound.py b/source/blender/python/api2_2x/doc/Sound.py
deleted file mode 100644
index bc3a929ec15..00000000000
--- a/source/blender/python/api2_2x/doc/Sound.py
+++ /dev/null
@@ -1,147 +0,0 @@
-# Blender.Sound module and the Sound PyType object
-
-"""
-The Blender.Sound submodule.
-
-Sound
-=====
-
-This module provides access to B{Sound} objects in Blender.
-
-Example::
- import Blender
- from Blender import Sound
- #
- sound = Sound.Load("/path/to/my/sound.wav") # load a sound file
- print "Sound from", sound.filename,
- print "loaded to obj", sound.name
- print "All Sounds available now:", Sound.Get()
-
-No way to get the actual audio data is provided by this library,
-but it is included in the Python standard library (module audioop).
-Note that using that module requires a full/normal Python installation.
-"""
-
-def Load (filename):
- """
- Load the sound called 'filename' into a Sound object.
- @type filename: string
- @param filename: The full path to the sound file.
- @rtype: Blender Sound
- @return: A Blender Sound object with the data from I{filename}.
- """
-
-def Get (name = None):
- """
- Get the Sound object(s) from Blender.
- @type name: string
- @param name: The name of the Sound object.
- @rtype: Blender Sound or a list of Blender Sounds
- @return: It depends on the I{name} parameter:
- - (name): The Sound object called I{name}, None if not found;
- - (): A list with all Sound objects in the current scene.
- """
-
-
-class Sound:
- """
- The Sound object
- ================
- This object gives access to Sounds in Blender.
- @ivar filename: The filename (path) to the sound file loaded into this Sound
- @ivar packed: Boolean, True when the sample is packed (readonly).
- """
-
- def getName():
- """
- Get the name of this Sound object.
- @rtype: string
- """
-
- def getFilename():
- """
- Get the filename of the sound file loaded into this Sound object.
- @rtype: string
- """
-
- def setName():
- """
- Set the name of this Sound object.
- @rtype: None
- """
-
- def setFilename():
- """
- Set the filename of the sound file loaded into this Sound object.
- @rtype: None
- """
-
- def setCurrent():
- """
- Make this the active sound in the sound buttons window (also redraws).
- """
-
- def play():
- """
- Play this sound.
- """
-
- def getVolume():
- """
- Get this sound's volume.
- rtype: float
- """
-
- def setVolume(f):
- """
- Set this sound's volume.
- @type f: float
- @param f: the new volume value in the range [0.0, 1.0].
- """
-
- def getAttenuation():
- """
- Get this sound's attenuation value.
- rtype: float
- """
-
- def setAttenuation(f):
- """
- Set this sound's attenuation.
- @type f: float
- @param f: the new attenuation value in the range [0.0, 5.0].
- """
-
- def getPitch():
- """
- Get this sound's pitch value.
- rtype: float
- """
-
- def setPitch(f):
- """
- Set this sound's pitch.
- @type f: float
- @param f: the new pitch value in the range [-12.0, 12.0].
- """
-
- def pack():
- """
- Packs the sound into the current blend file.
- @note: An error will be raised if the sound is already packed or the filename path does not exist.
- @returns: nothing
- @rtype: none
- """
-
- def unpack(mode):
- """
- Unpacks the sound to the samples filename.
- @param mode: One of the values in Blender.Unpackmodes dict.
- @note: An error will be raised if the sound is not packed or the filename path does not exist.
- @returns: nothing
- @rtype: none
- @type mode: int
- """
-
-import id_generics
-Sound.__doc__ += id_generics.attributes
diff --git a/source/blender/python/api2_2x/doc/Sys.py b/source/blender/python/api2_2x/doc/Sys.py
deleted file mode 100644
index f1efeeb2344..00000000000
--- a/source/blender/python/api2_2x/doc/Sys.py
+++ /dev/null
@@ -1,167 +0,0 @@
-# Blender.sys module
-
-"""
-The Blender.sys submodule.
-
-sys
-===
-
-B{New}: L{expandpath}.
-
-This module provides a minimal set of helper functions and data. Its purpose
-is to avoid the need for the standard Python module 'os', in special 'os.path',
-though it is only meant for the simplest cases.
-
-Example::
-
- import Blender
-
- filename = ""
- def f(name): # file selector callback
- global filename
- filename = name
-
- Blender.Window.FileSelector(f)
-
- if filename:
- print 'basename:', Blender.sys.basename(filename)
- print 'dirname:', Blender.sys.dirname(filename)
- print 'splitext:', Blender.sys.splitext(filename)
-
- # what would basename(splitext(filename)[0]) print?
-
-@type sep: char
-@var sep: the platform-specific dir separator for this Blender: '/'
- everywhere, except on Win systems, that use '\\'.
-@type dirsep: char
-@var dirsep: same as L{sep}.
-@type progname: string
-@var progname: the Blender executable (argv[0]).
-
-@attention: The module is called sys, not Sys.
-"""
-
-def basename (path):
- """
- Get the base name (filename stripped from dir info) of 'path'.
- @type path: string
- @param path: a path name
- @rtype: string
- @return: the base name
- """
-
-def dirname (path):
- """
- Get the dir name (dir path stripped from filename) of 'path'.
- @type path: string
- @param path: a path name
- @rtype: string
- @return: the dir name
- """
-
-def join (dir, file):
- """
- Join the given dir and file paths, using the proper separator for each
- platform.
- @type dir: string
- @type file: string
- @param dir: the dir name, like returned from L{dirname}.
- @param file: the bare filename, like returned from L{basename}.
- @rtype: string
- @return: the resulting filename.
- @warn: this simple function isn't intended to be a complete replacement for
- the standard os.path.join() one, which handles more general cases.
- """
-
-def splitext (path):
- """
- Split 'path' into (root, ext), where 'ext' is a file extension including the full stop.
-
- Example::
-
- import Blender
- file, ext= Blender.sys.splitext('/tmp/foobar.blend')
- print file, ext
- # ('/tmp/foobar', '.blend')
-
- @type path: string
- @param path: a path name
- @rtype: tuple of two strings
- @return: (root, ext)
- @note: This function will raise an error if the path is longer then 80 characters.
- """
-
-def makename (path = "Blender.Get('filename')", ext = "", strip = 0):
- """
- Remove extension from 'path', append extension 'ext' (if given)
- to the result and return it. If 'strip' is non-zero, also remove
- dirname from path.
-
- Example::
- import Blender
- from Blender.sys import *
- print makename('/path/to/myfile.txt','.abc', 1) # returns 'myfile.abc'
-
- print makename('/path/to/myfile.obj', '-01.obj') # '/path/to/myfile-01.obj'
-
- print makename('/path/to/myfile.txt', strip = 1) # 'myfile'
-
- # note that:
- print makename(ext = '.txt')
- # is equivalent to:
- print sys.splitext(Blender.Get('filename'))[0]) + '.txt'
-
- @type path: string
- @param path: a path name or Blender.Get('filename'), if not given.
- @type ext: string
- @param ext: an extension to append. For flexibility, a dot ('.') is
- not automatically included.
- @rtype: string
- @return: the resulting string
- """
-
-def exists(path):
- """
- Tell if the given pathname (file or dir) exists.
- @rtype: int
- @return:
- - 0: path does not exist;
- - 1: path is an existing filename;
- - 2: path is an existing dirname;
- - -1: path exists but is neither a regular file nor a dir.
- """
-
-def time ():
- """
- Get the current time in seconds since a fixed value. Successive calls to
- this function are guaranteed to return values greater than the previous call.
- @rtype: float
- @return: the elapsed time in seconds.
- """
-
-def sleep (millisecs = 10):
- """
- Sleep for the specified amount of time.
- @type millisecs: int
- @param millisecs: the amount of time in milliseconds to sleep. The default
- is 10 which is 0.1 seconds.
- """
-
-def expandpath (path):
- """
- Expand the given Blender 'path' into an absolute and valid path.
- Internally, Blender recognizes two special character sequences in paths:
- - '//' (used at the beginning): means base path -- the current .blend file's
- dir;
- - '#' (used at the end): means current frame number.
- The expanded string can be passed to generic python functions that don't
- understand Blender's internal relative paths.
- @note: this function is also useful for obtaining the name of the image
- that will be saved when rendered.
- @note: if the passed string doesn't contain the special characters it is
- returned unchanged.
- @type path: string
- @param path: a path name.
- @rtype: string
- @return: the expanded (if necessary) path.
- """
diff --git a/source/blender/python/api2_2x/doc/Text.py b/source/blender/python/api2_2x/doc/Text.py
deleted file mode 100644
index 98ecb664b71..00000000000
--- a/source/blender/python/api2_2x/doc/Text.py
+++ /dev/null
@@ -1,129 +0,0 @@
-# Blender.Text module and the Text PyType object
-
-"""
-The Blender.Text submodule.
-
-Text Objects
-============
-
-This module provides access to B{Text} objects in Blender.
-
-Example::
- import Blender
- from Blender import Text
- #
- txt = Text.New("MyText") # create a new Text object
- print Text.Get() # current list of Texts in Blender
- txt.write("Appending some ") # appending text
- txt.write("text to my\\n") # '\\n' inserts new-line markers
- txt.write("text buffer.")
- print txt.asLines() # retrieving the buffer as a list of lines
- Text.unlink(txt) # removing a Text object
-"""
-
-def New (name = None, follow_cursor = 0):
- """
- Create a new Text object.
- @type name: string
- @param name: The Text name.
- @type follow_cursor: int
- @param follow_cursor: The text follow flag: if 1, the text display always
- follows the cursor.
- @rtype: Blender Text
- @return: The created Text Data object.
- """
-
-def Get (name = None):
- """
- Get the Text object(s) from Blender.
- @type name: string
- @param name: The name of the Text object.
- @rtype: Blender Text or a list of Blender Texts
- @return: It depends on the 'name' parameter:
- - (name): The Text object with the given name;
- - (): A list with all Text objects in the current scene.
- """
-
-def Load (filename):
- """
- Load a file into a Blender Text object.
- @type filename: string
- @param filename: The name of the file to load.
- @rtype: Blender Text
- @return: A Text object with the contents of the loaded file.
- """
-
-def unlink(textobj):
- """
- Unlink (remove) the given Text object from Blender.
- @type textobj: Blender Text
- @param textobj: The Text object to be deleted.
- """
-
-class Text:
- """
- The Text object
- ===============
- This object gives access to Texts in Blender.
- @ivar filename: The filename of the file loaded into this Text.
- @ivar mode: The follow_mode flag: if 1 it is 'on'; if 0, 'off'.
- @ivar nlines: The number of lines in this Text.
- """
-
- def getName():
- """
- Get the name of this Text object.
- @rtype: string
- """
-
- def setName(name):
- """
- Set the name of this Text object.
- @type name: string
- @param name: The new name.
- """
-
- def getFilename():
- """
- Get the filename of the file loaded into this Text object.
- @rtype: string
- """
-
- def getNLines():
- """
- Get the number of lines in this Text buffer.
- @rtype: int
- """
-
- def clear():
- """
- Clear this Text object: its buffer becomes empty.
- """
-
- def set(attribute, value):
- """
- Set this Text's attributes.
- @type attribute: string
- @param attribute: The attribute to change:
- currently, 'follow_cursor' is the only one available. It can be
- turned 'on' with value = 1 and 'off' with value = 0.
- @type value: int
- @param value: The new attribute value.
- """
-
- def write(data):
- """
- Append a string to this Text buffer.
- @type data: string
- @param data: The string to append to the text buffer.
- """
-
- def asLines():
- """
- Retrieve the contents of this Text buffer as a list of strings.
- @rtype: list of strings
- @return: A list of strings, one for each line in the buffer
- """
-
-import id_generics
-Text.__doc__ += id_generics.attributes \ No newline at end of file
diff --git a/source/blender/python/api2_2x/doc/Text3d.py b/source/blender/python/api2_2x/doc/Text3d.py
deleted file mode 100644
index a7d8c585078..00000000000
--- a/source/blender/python/api2_2x/doc/Text3d.py
+++ /dev/null
@@ -1,302 +0,0 @@
-# Blender.Text3d module and the Text3d PyType object
-
-"""
-The Blender.Text3d submodule.
-
-Text3d Objects
-==============
-
-This module provides access to B{Font} objects in Blender.
-
-Example::
- import Blender
- from Blender import Curve, Object, Scene, Text3d
- txt = Text3d.New("MyText") # create a new Text3d object called MyText
- scn = Scene.GetCurrent() # get current scene
- ob = scn.objects.new(txt) # create an object from the obdata in the current scene
- ob.makeDisplayList() # rebuild the display list for this object
- Window.RedrawAll()
-"""
-
-def New (name = None):
- """
- Create a new Text3d object.
- @type name: string
- @param name: The name for the new object..
- @rtype: Blender Text3d
- @return: The created Text3d Data object.
- """
-
-def Get (name = None):
- """
- Get the Text3d object(s) from Blender.
- @type name: string
- @param name: The name of the Text3d object.
- @rtype: Blender Text3d or a list of Blender Text3d's
- @return: It depends on the 'name' parameter:
- - (name): The Text3d object with the given name;
- - (): A list with all Text3d objects in the current scene.
- """
-class Text3d:
- """
- The Text3d object
- =================
- This object gives access Blender's B{Font} objects
- @ivar frameWidth: The width of the active frame [0.0 - 50.0]
- @ivar frameHeight: The height of the active frame [0.0 - 50.0]
- @ivar frameX: The X position of the active frame [0.0 - 50.0]
- @ivar frameY: The Y position of the active frame [0.0 - 50.0]
-
- @ivar totalFrames: The total number of text frames (read only)
- @ivar activeFrame: The active frame for this text data.
- """
-
- def getName():
- """
- Get the name of this Text3d object.
- @rtype: string
- """
-
- def setName( name ):
- """
- Set the name of this Text3d object.
- @type name: string
- @param name: The new name.
- @returns: None
- """
-
- def getText():
- """
- Get text string for this object
- @rtype: string
- """
-
- def setText( name ):
- """
- Set the text string in this Text3d object
- @type name: string
- @param name: The new text string for this object.
- @returns: None
- """
-
- def getDrawMode():
- """
- Get the drawing mode (3d, front, and/or back)
- Gets the text3d's drawing modes. Uses module constants
- - DRAW3D : "3D" is set
- - DRAWFRONT : "Front" is set
- - DRAWBACK : "Back" is set
- @rtype: tuple of module constants
- """
-
- def setDrawMode(val):
- """
- Set the text3d's drawing mode. Uses module constants
- - DRAW3D
- - DRAWFRONT
- - DRAWBACK
- @rtype: None
- @type val: single module constant or tuple of module constants
- @param val : The Text3d's modes. See L{getDrawMode} for the meaning of
- the constants.
- """
-
- def getUVordco():
- """
- Return whether UV coords are used for Texture mapping
- """
-
- def setUVordco(val):
- """
- Set the font to use UV coords for Texture mapping
- """
-
- def getBevelAmount():
- """
- Get the Text3d's bevel resolution value.
- @rtype: float
- """
-
- def setBevelAmount(bevelresol):
- """
- Set the Text3d's bevel resolution value.
- @rtype: None
- @type bevelresol: float
- @param bevelresol: The new Curve's bevel resolution value.
- """
-
- def getDefaultResolution():
- """
- Return Default text resolution.
- @rtype: float
- """
-
- def setDefaultResolution(resolu):
- """
- Sets Default text Resolution.
- @rtype: None
- @type resolu: float
- @param resolu: The new Curve's U-resolution value.
- """
-
- def getWidth():
- """
- Get the Text3d's width value.
- @rtype: float
- """
-
- def setWidth(width):
- """
- Set the Text3d's width value.
- @rtype: None
- @type width: float
- @param width: The new text3d's width value.
- """
-
- def getExtrudeDepth():
- """
- Get the text3d's ext1 value.
- @rtype: float
- """
-
- def setExtrudeDepth(ext1):
- """
- Set the text3d's ext1 value.
- @rtype: None
- @type ext1: float
- @param ext1: The new text3d's ext1 value.
- """
-
- def getExtrudeBevelDepth():
- """
- Get the text3d's ext2 value.
- @rtype: float
- """
-
- def setExtrudeBevelDepth(ext2):
- """
- Set the text3d's ext2 value.
- @rtype: None
- @type ext2: float
- @param ext2: The new text3d's ext2 value.
- """
-
- def getShear():
- """
- Get the text3d's shear value.
- @rtype: float
- """
-
- def setShear(shear):
- """
- Set the text3d's shear value.
- @rtype: None
- @type shear: float
- @param shear: The new text3d's shear value.
- """
-
- def getSize():
- """
- Get the text3d's size value.
- @rtype: float
- """
-
- def setSize(size):
- """
- Set the text3d's size value.
- @rtype: None
- @type size: float
- @param size: The new text3d's size value.
- """
-
- def getLineSeparation():
- """
- Get the text3d's ext2 value.
- @rtype: float
- """
-
- def setLineSeparation(sep):
- """
- Set the text3d's ext2 value.
- @rtype: None
- @type sep: float
- @param sep: The new text3d's separation value.
- """
-
- def getSpacing():
- """
- Get the text3d's spacing value.
- @rtype: float
- """
-
- def setSpacing(spacing):
- """
- Set the text3d's spacing value.
- @rtype: None
- @type spacing: float
- @param spacing: The new text3d's spacing value.
- """
-
- def getXoffset():
- """
- Get the text3d's Xoffset value.
- @rtype: float
- """
-
- def setXoffset(xof):
- """
- Set the text3d's Xoffset value.
- @rtype: None
- @type xof: float
- @param xof: The new text3d's Xoffset value.
- """
-
- def getYoffset():
- """
- Get the text3d's Yoffset value.
- @rtype: float
- """
-
- def setYoffset(yof):
- """
- Set the text3d's Yoffset value.
- @rtype: None
- @type yof: float
- @param yof: The new text3d's Yoffset value.
- """
-
- def getAlignment():
- """
- Get the text3d's alignment value. Uses module constants
- - LEFT
- - RIGHT
- - MIDDLE
- - FLUSH
- @rtype: module constant
- """
-
- def setAlignment(align):
- """
- Set the text3d's Alignment value. Uses module constants
- - LEFT
- - RIGHT
- - MIDDLE
- - FLUSH
- @rtype: None
- @type align: module constant
- @param align: The new text3d's Alignment value.
- """
-
- def addFrame():
- """
- Adds a text frame. maximum number of frames is 255.
- @rtype: None
- """
-
- def removeFrame(index):
- """
- Removed the frame at this index
- @rtype: None
- """
-import id_generics
-Text3d.__doc__ += id_generics.attributes
diff --git a/source/blender/python/api2_2x/doc/Texture.py b/source/blender/python/api2_2x/doc/Texture.py
deleted file mode 100644
index dfba93c9978..00000000000
--- a/source/blender/python/api2_2x/doc/Texture.py
+++ /dev/null
@@ -1,557 +0,0 @@
-#
-# Blender.Texture module and the Texture PyType object
-#
-# Written by Alex Mole
-#
-
-"""
-The Blender.Texture submodule.
-
-B{New}:
- - many new attributes in L{MTex} submodule
- - new dictionaries (L{Texture.BlendModes}, L{Texture.Mappings}, L{Texture.Proj}) to use for the values of some of the new L{MTex} attributes.
-
-Texture
-=======
-
-This module provides access to B{Texture} objects in Blender.
-
-Example::
-
- from Blender import Texture,Image,Material
-
- footex = Texture.Get('foo') # get texture named 'foo'
- footex.setType('Image') # make foo be an image texture
- img = Image.Load('test.png') # load an image
- footex.image = img # link the image to the texture
-
- mat = Material.Get('bar') # get a material
- mtextures = mat.getTextures() # get a list of the MTex objects
- for mtex in mtextures:
- if mtex.tex.type == Texture.Types.IMAGE:
- print mtex.tex.image.filename # print the filenames of all the
- # images in textures linked to "bar"
-
- mat.setTexture(0, footex) # set the material's first texture
- # to be our texture
-
-
-@type Types: readonly dictionary
-@var Types: The available texture types:
- - NONE - No texture
- - CLOUDS - Clouds texture
- - WOOD - Wood texture
- - MARBLE - Marble texture
- - MAGIC - Magic texture
- - BLEND - Blend texture
- - STUCCI - Stucci texture
- - NOISE - Noise texture
- - IMAGE - Image texture
- - PLUGIN - Plugin texture
- - ENVMAP - EnvMap texture
- - MUSGRAVE - Musgrave procedural texture
- - VORONOI - Voronoi procedural texture
- - DISTNOISE - Distorted noise texture
-
-@type Flags: readonly dictionary
-@var Flags: The available Texture flags:
- - FLIPBLEND - Flips the blend texture's X and Y directions
- - NEGALPHA - Reverse the alpha value
- - CHECKER_ODD - Fill the "odd" checkerboard tiles
- - CHECKER_EVEN - Fill the "even" checkerboard tiles
- - COLORBAND - Enable colorband for this texture
- - PREVIEW_ALPHA - Show alpha in preview
- - REPEAT_XMIR - Mirrors X direction repeat
- - REPEAT_YMIR - Mirrors Y direction repeat
-
-@type ImageFlags: readonly dictionary
-@var ImageFlags: The available image flags for Texture.imageFlags:
- - INTERPOL - Interpolate pixels of the image
- - USEALPHA - Use the alpha layer
- - MIPMAP - Enable mipmapping [cannot be used with FIELDS]
- - FIELDS - Work with field images [cannot be used with MIPMAP]
- - ROT90 - Rotate the image 90 degrees when rendering
- - CALCALPHA - Calculate an alpha from the RGB
- - STFIELD - Denotes this is a standard field
- - MOVIE - Use a movie for an image
- - CYCLIC - Repeat animation image
- - ANTI - Use anti-aliasing
- - NORMALMAP - Use image RGB values for normal mapping
-
-@type ExtendModes: readonly dictionary
-@var ExtendModes: Extend, clip, repeat or checker modes for image textures
- - EXTEND - Extends the colour of the edge
- - CLIP - Return alpha 0.0 outside image
- - CLIPCUBE - Return alpha 0.0 around cube-shaped area around image
- - REPEAT - Repeat image vertically and horizontally
- - CHECKER - Repeat image in checkerboard pattern
-
-@type Noise: readonly dictionary
-@var Noise: Noise types and bases. SINE, SAW and TRI are only used for
- marble and wood textures, while the remainder are used for all textures
- which has a noise basis function (for these textures, the constant should
- be used with the second noise basis setting).
- - SINE - Produce bands using sine wave (marble, wood textures)
- - SAW - Produce bands using saw wave (marble, wood textures)
- - TRI - Produce bands using triangle wave (marble, wood textures)
- - BLENDER - Original Blender algorithm
- - PERLIN - Ken Perlin's original (1985) algorithm
- - IMPROVEDPERLIN - Ken Perlin's newer (2002) algorithm
- - VORONOIF1 - none
- - VORONOIF2 - none
- - VORONOIF3 - none
- - VORONOIF4 - none
- - VORONOIF2F1 - none
- - VORONOICRACKLE - none
- - CELLNOISE - Steven Worley's cellular basis algorithm (1996)
-
-@type BlendModes: readonly dictionary
-@var BlendModes: The available texture blending modes:
- - MIX - mix texture with value
- - MULTIPLY - multiply texture with value
- - ADD - add texture to value
- - SUBTRACT - subtract texture from value
- - DIVIDE - divide value by texture
- - DARKEN - replace value with texture if texture is darker
- - DIFFERENCE - difference of texture from value
- - LIGHTEN - replace value with texture if texture is lighter
- - SCREEN - 'screen' mode
-
-@type Mappings: readonly dictionary
-@var Mappings: The available 2D texture coordinate mappings for images:
- - FLAT - flat projection
- - CUBE - cube projection
- - TUBE - cylindrical projection
- - SPHERE - spherical projection
-
-@type Proj: readonly dictionary
-@var Proj: The available projections per axis:
- - NONE - axis isn't used
- - X - axis is used as final x axis
- - Y - axis is used as final y axis
- - Z - axis is used as final z axis
-
-@type STypes: readonly dictionary
-@var STypes: Texture-type specific data. Depending on the value of
- Texture.type, certain groups will make sense. For instance, when a texture
- is of type CLOUD, the CLD_xxx stypes can be used. Note that the first
- value in each group is the default.
- 1. Clouds type
- - CLD_DEFAULT - Monochromatic noise
- - CLD_COLOR - RGB noise
- 2. Wood type
- - WOD_BANDS - Use standard wood texture
- - WOD_RINGS - Use wood rings
- - WOD_BANDNOISE - Add noise to standard wood
- - WOD_RINGNOISE - Add noise to rings
- 3. Magic type
- - MAG_DEFAULT - Magic has no STypes
- 4. Marble type
- - MBL_SOFT - Use soft marble
- - MBL_SHARP - Use more clearly defined marble
- - MBL_SHARPER - Use very clearly dfefined marble
- 5. Blend type
- - BLN_LIN - Use a linear progression
- - BLN_QUAD - Use a quadratic progression
- - BLN_EASE - Uses a more complicated blend function
- - BLN_DIAG - Use a diagonal progression
- - BLN_SPHERE - Use a progression with the shape of a sphere
- - BLN_HALO - Use a quadratic progression with the shape of a sphere
- 6. Stucci type
- - STC_PLASTIC - Standard stucci
- - STC_WALLIN - Creates dimples
- - STC_WALLOUT - Creates ridges
- 7. Noise type
- - NSE_DEFAULT - Noise has no STypes
- 8. Image type
- - IMG_DEFAULT - Image has no STypes
- 9. Plugin type
- - PLG_DEFAULT - Plugin has no STypes
- 10. Envmap type
- - ENV_STATIC - Calculate map only once
- - ENV_ANIM - Calculate map each rendering
- - ENV_LOAD - Load map from disk
- 11. Musgrave type
- - MUS_MFRACTAL - Hetero Multifractal
- - MUS_RIDGEDMF - Ridged Multifractal
- - MUS_HYBRIDMF - Hybrid Multifractal
- - MUS_FBM - Fractal Brownian Motion
- - MUS_HTERRAIN - Hetero Terrain
- 12. Voronoi type
- - VN_INT - Only calculate intensity
- - VN_COL1 - Color cells by position
- - VN_COL2 - Same as Col1 plus outline based on F2-F1
- - VN_COL3 - Same as Col2 multiplied by intensity
- 13. Distorted noise type
- - DN_BLENDER - Original Blender algorithm
- - DN_PERLIN - Ken Perlin's original (1985) algorithm
- - DN_IMPROVEDPERLIN - Ken Perlin's newer (2002) algorithm
- - DN_VORONOIF1 - none
- - DN_VORONOIF2 - none
- - DN_VORONOIF3 - none
- - DN_VORONOIF4 - none
- - DN_VORONOIF2F1 - none
- - DN_VORONOICRACKLE - none
- - DN_CELLNOISE - Steven Worley's cellular basis algorithm (1996)
-
-@var TexCo: Flags for MTex.texco.
- - ORCO - Use the original coordinates of the mesh
- - REFL - Use reflection vector as texture coordinates
- - NOR - Use normal vector as texture coordinates
- - GLOB - Use global coordinates for the texture coordinates
- - UV - Use UV coordinates for texture coordinates
- - OBJECT - Use linked object's coordinates for texture coordinates
- - WIN - Use screen coordinates as texture coordinates
- - VIEW - Pass camera view vector on to the texture (World texture only!)
- - STICK - Use mesh sticky coordinates for the texture coordinates
- - STRESS - Use mesh stress coordinates for the texture coordinates
- - TANGENT - Use mesh tangent coordinates for the texture coordinates
-@type TexCo: readonly dictionary
-
-@var MapTo: Flags for MTex.mapto.
- - COL - Make the texture affect the basic colour of the material
- - NOR - Make the texture affect the rendered normal
- - CSP - Make the texture affect the specularity colour
- - CMIR - Make the texture affect the mirror colour
- - REF - Make the texture affect the diffuse reflectivity value
- - SPEC - Make the texture affect the specularity value
- - HARD - Make the texture affect the hardness value
- - ALPHA - Make the texture affect the alpha value
- - EMIT - Make the texture affect the emit value
- - RAYMIR - Make the texture affect the mirror reflectivity value
- - DISP - Make the texture displace the mesh
- - TRANSLU - Make the texture affect the translucency value
- - AMB - Make the texture affect the ambient value
- - WARP - Make the texture affect texture coordinates for the following textures
-@type MapTo: readonly dictionary
-
-"""
-
-def New (name = 'Tex'):
- """
- Create a new Texture object.
- @type name: string
- @param name: The Texture name.
- @rtype: Blender Texture
- @return: The created Texture object.
- """
-
-def Get (name = None):
- """
- Get the Texture object(s) from Blender.
- @type name: string
- @param name: The name of the Texture.
- @rtype: Blender Texture or a list of Blender Textures
- @return: It depends on the I{name} parameter:
- - (name): The Texture object with the given I{name};
- - (): A list with all Texture objects in the current scene.
- """
-
-from IDProp import IDGroup, IDArray
-class Texture:
- """
- The Texture object
- ==================
- This object gives access to Texture-specific data in Blender.
-
- Note that many of the attributes of this object are only relevant for
- specific texture types.
-
- @ivar animFrames: Number of frames of a movie to use.
- Value is clamped to the range [0,300000].
- @type animFrames: int
- @ivar animOffset: Offsets the number of the first movie frame to use.
- Value is clamped to the range [-300000,300000].
- @type animOffset: int
- @ivar animStart: Starting frame of the movie to use.
- Value is clamped to the range [1,300000].
- @type animStart: int
- @ivar anti: Image anti-aliasing enabled. Also see L{ImageFlags}.
- @type anti: int
- @ivar brightness: Changes the brightness of a texture's color.
- Value is clamped to the range [0.0,2.0].
- @type brightness: float
- @ivar calcAlpha: Calculation of image's alpha channel enabled. Also see L{ImageFlags}.
- @type calcAlpha: int
- @ivar contrast: Changes the contrast of a texture's color.
- Value is clamped to the range [0.01,5.0].
- @type contrast: float
- @ivar crop: Sets the cropping extents (for image textures).
- @type crop: tuple of 4 ints
- @ivar cyclic: Looping of animated frames enabled. Also see L{ImageFlags}.
- @type cyclic: boolean
- @ivar distAmnt: Amount of distortion (for distorted noise textures).
- Value is clamped to the range [0.0,10.0].
- @type distAmnt: float
- @ivar distMetric: The distance metric (for Voronoi textures).
- @type distMetric: int
- @ivar exp: Minkovsky exponent (for Minkovsky Voronoi textures).
- Value is clamped to the range [0.01,10.0].
- @type exp: float
- @ivar extend: Texture's 'Extend' mode (for image textures). See L{ExtendModes}.
- @type extend: int
- @ivar fields: Use of image's fields enabled. Also see L{ImageFlags}.
- @type fields: int
- @ivar fieldsPerImage: Number of fields per rendered frame.
- Value is clamped to the range [1,200].
- @type fieldsPerImage: int
- @ivar filterSize: The filter size (for image and envmap textures).
- Value is clamped to the range [0.1,25.0].
- @type filterSize: float
- @ivar flags: Texture's 'Flag' bitfield. See L{Flags}.
- bitmask.
- @type flags: int
- @ivar hFracDim: Highest fractional dimension (for Musgrave textures).
- Value is clamped to the range [0.0001,2.0].
- @type hFracDim: float
- @ivar iScale: Intensity output scale (for Musgrave and Voronoi textures).
- Value is clamped to the range [0.0,10.0].
- @type iScale: float
- @ivar image: Texture's image object.
- @type image: Blender Image (or None)
- @ivar imageFlags: Texture's 'ImageFlags' bits.
- @type imageFlags: int
- @ivar interpol: Interpolate image's pixels to fit texture mapping enabled. Also see L{ImageFlags}.
- @type interpol: int
- @ivar ipo: Texture Ipo data.
- Contains the Ipo if one is assigned to the object, B{None} otherwise. Setting to B{None} clears the current Ipo..
- @type ipo: Blender Ipo
- @ivar lacunarity: Gap between succesive frequencies (for Musgrave textures).
- Value is clamped to the range [0.0,6.0].
- @type lacunarity: float
- @ivar mipmap: Mipmaps enabled. Also see L{ImageFlags}.
- @type mipmap: int
- @ivar movie: Movie frames as images enabled. Also see L{ImageFlags}.
- @type movie: int
- @ivar noiseBasis: Noise basis type (wood, stucci, marble, clouds,
- Musgrave, distorted). See L{Noise} dictionary.
- @type noiseBasis: int
- @ivar noiseBasis2: Additional noise basis type (wood, marble, distorted
- noise). See L{Noise} dictionary.
- @type noiseBasis2: int
- @ivar noiseDepth: Noise depth (magic, marble, clouds).
- Value is clamped to the range [0,6].
- @type noiseDepth: int
- @ivar noiseSize: Noise size (wood, stucci, marble, clouds, Musgrave,
- distorted noise).
- Value is clamped to the range [0.0001,2.0].
- @type noiseSize: float
- @ivar noiseType: Noise type (for wood, stucci, marble, clouds textures). Valid values are 'hard' or 'soft'.
- @type noiseType: string
- @ivar normalMap: Use of image RGB values for normal mapping enabled.
- Also see L{ImageFlags}.
- @type normalMap: int
- @ivar octs: Number of frequencies (for Musgrave textures).
- Value is clamped to the range [0.0,8.0].
- @type octs: float
- @ivar repeat: Repetition multiplier (for image textures).
- @type repeat: tuple of 2 ints
- @ivar rgbCol: RGB color tuple.
- @type rgbCol: tuple of 3 floats
- @ivar rot90: X/Y flip for rendering enabled. Also see L{ImageFlags}.
- @type rot90: int
- @ivar saw: Produce bands using saw wave (marble, wood textures). Also see L{Noise}.
- @type saw: int
- @ivar sine: Produce bands using sine wave (marble, wood textures). Also see L{Noise}.
- @type sine: int
- @ivar stField: Standard field deinterlacing enabled. Also see L{ImageFlags}.
- @type stField: int
- @ivar stype: Texture's 'SType' mode. See L{STypes}.
- @type stype: int
- @ivar tri: Produce bands using triangle wave (marble, wood textures). Also see L{Noise}.
- @type tri: int
- @ivar turbulence: Turbulence (for magic, wood, stucci, marble textures).
- Value is clamped to the range [0.0,200.0].
- @type turbulence: float
- @ivar type: Texture's 'Type' mode. See L{Types}.
- Value must be in the range [0,13].
- @type type: int
- @ivar useAlpha: Use of image's alpha channel enabled. Also see L{ImageFlags}.
- @type useAlpha: int
- @ivar weight1: Weight 1 (for Voronoi textures).
- Value is clamped to the range [-2.0,2.0].
- @type weight1: float
- @ivar weight2: Weight 2 (for Voronoi textures).
- Value is clamped to the range [-2.0,2.0].
- @type weight2: float
- @ivar weight3: Weight 3 (for Voronoi textures).
- Value is clamped to the range [-2.0,2.0].
- @type weight3: float
- @ivar weight4: Weight 4 (for Voronoi textures).
- Value is clamped to the range [-2.0,2.0].
- @type weight4: float
- @ivar colorband: Texture colorband, a list of colors,
- each color a list of 5 floats [0 - 1], [r,g,b,a,pos].
- The colorband can have between 1 and 31 colors.
- @type colorband: list
- @ivar autoRefresh: Refresh image on frame changes enabled.
- @type autoRefresh: boolean
- """
-
- def getExtend():
- """
- Get the extend mode of the texture. See L{setExtend}.
- @rtype: string.
- """
-
- def getImage():
- """
- Get the Image associated with this texture (or None).
- @rtype: Blender Image
- """
-
- def getName():
- """
- Get the name of this Texture object.
- @rtype: string
- """
-
- def getType():
- """
- Get this Texture's type. See L{setType}.
- @rtype: string
- """
-
- def setExtend(extendmode):
- """
- Set the extend mode of this texture (only used for IMAGE textures)
- @param extendmode: The new extend mode. One of:
- 'Extend', 'Clip', 'ClipCube' and 'Repeat'
- @type extendmode: string
- """
-
- def setFlags(f1=None, f2=None, f3=None, f4=None):
- """
- Set this object's flags.
- @param f1,f2,f3,f4: Flags to be set (omitted flags are cleared). Can be any of
- 'FlipBlendXY', 'NegAlpha', 'CheckerOdd', and 'CheckerEven'
- @type f1,f2,f3,f4: string
- """
-
- def setImage(image):
- """
- Set the Image of this texture.
- @param image: The new Image.
- @type image: Blender Image
- @warning: This sets the texture's type to 'Image' if it is not already.
- """
-
- def setImageFlags(f1=None, f2=None, f3=None, etc=None):
- """
- Set the Image flags (only makes sense for IMAGE textures). Omitted
- flags are cleared.
- @param f1, f2, f3, etc: Flag to set. See L{ImageFlags} for their meanings. Can be
- any of: 'InterPol', 'UseAlpha', 'MipMap', 'Fields', 'Rot90',
- 'CalcAlpha', 'Cyclic', 'Movie', 'StField', 'Anti' and 'NormalMap'
- @type f1, f2, f3, etc: string
- """
-
- def setName(name):
- """
- Set the name of this Texture object.
- @param name: The new name.
- @type name: string
- """
-
- def setSType(stype):
- """
- Set the SType.
- @param stype: The new stype. This can be any of the values listed in
- L{STypes} or 'Default' which sets the stype to the default value.
- @type stype: string
-
- @note: the set of valid parameters is dependent on the current
- texture type. Be sure to always set the texture type B{before}
- setting the texture's stype; otherwise an exception might occur.
- """
-
- def setType(type):
- """
- Set this Texture's type.
- @param type: The new type. Possible options are:
- 'None', 'Clouds', 'Wood', 'Marble', 'Magic', 'Blend', 'Stucci',
- 'Noise', 'Image', 'Plugin', 'EnvMap', 'Musgrave', 'Voronoi'
- and 'DistNoise'
- @type type: string
- """
- def evaluate(coord):
- """
- Evaluates the texture at this location and returns the result.
-
- The return value is a 4D vector where (x,y,z,w) are (red, green, blue, intensity)
- For greyscale textures, often intensity only will be used.
- @type coord: vector or tuple of 3 numbers
- """
-
-import id_generics
-Texture.__doc__ += id_generics.attributes
-
-class MTex:
- """
- The MTex Object
- ===============
-
- This object links a material to a texture. It allows the same texture to be
- used in several different ways.
-
- @ivar tex: The Texture this is linked to.
- @type tex: Blender Texture
- @ivar texco: Texture coordinates ("Map input"). See L{TexCo}
- @ivar mapto: "Map to" field of texture. OR'd values of L{MapTo}
- @ivar object: Object whose space to use when texco is Object
- @type object: Blender Object
- @ivar col: Color that the texture blends with
- @ivar dvar: Value that the texture blends with when not blending colors
- @ivar blendmode: Texture blending mode. L{BlendModes}
- @ivar colfac: Factor by which texture affects color
- @ivar norfac: Factor by which texture affects normal
- @ivar varfac: Factor by which texture affects most variables
- @ivar dispfac: Factor by which texture affects displacement
- @ivar warpfac: Factor by which texture affects warp
- @ivar ofs: Offset to adjust texture space
- @ivar size: Size to scale texture space
- @ivar mapping: Mapping of texture coordinates (flat, cube, etc.). L{Mappings}
- @ivar stencil: Stencil mode
- @ivar neg: Negate texture values mode
- @ivar noRGB: Convert texture RGB values to intensity values
- @ivar correctNor: Correct normal mapping for Texture space and Object space
- @ivar xproj: Projection of X axis to Texture space. L{Proj}
- @ivar yproj: Projection of Y axis to Texture space. L{Proj}
- @ivar zproj: Projection of Z axis to Texture space. L{Proj}
- @ivar mtCol: How texture maps to color
- @ivar mtNor: How texture maps to normals
- @ivar mtCsp: How texture maps to specularity color
- @ivar mtCmir: How texture maps to mirror color
- @ivar mtRef: How texture maps to reflectivity
- @ivar mtSpec: How texture maps to specularity
- @ivar mtEmit: How texture maps to emit value
- @ivar mtAlpha: How texture maps to alpha value
- @ivar mtHard: How texture maps to hardness
- @ivar mtRayMir: How texture maps to RayMir value
- @ivar mtTranslu: How texture maps to translucency
- @ivar mtAmb: How texture maps to ambient value
- @ivar mtDisp: How texture maps to displacement
- @ivar mtWarp: How texture maps to warp
- @ivar uvlayer: The name of the UV Layer this texture is mapped to (when left blank uses render layer)
- @type uvlayer: string
- """
-
- def getIpo():
- """
- Get the Ipo associated with this texture object, if any.
- @rtype: Ipo
- @return: the wrapped ipo or None.
- """
-
- def setIpo(ipo):
- """
- Link an ipo to this texture object.
- @type ipo: Blender Ipo
- @param ipo: a "texture data" ipo.
- """
-
- def clearIpo():
- """
- Unlink the ipo from this texture object.
- @return: True if there was an ipo linked or False otherwise.
- """
diff --git a/source/blender/python/api2_2x/doc/Theme.py b/source/blender/python/api2_2x/doc/Theme.py
deleted file mode 100644
index 90d0f8395a3..00000000000
--- a/source/blender/python/api2_2x/doc/Theme.py
+++ /dev/null
@@ -1,211 +0,0 @@
-# Blender.Window.Theme submodule and the Theme PyType object
-
-"""
-The Blender.Window.Theme submodule.
-
-Theme
-=====
-
-This module provides access to B{Theme} objects in Blender.
-
-Example::
- # this is a simplified version of the save_theme.py script
- # shipped with Blender:
- import Blender
- from Blender.Window import Theme, FileSelector
-
- theme = Theme.Get()[0] # get current theme
-
- def write_theme(filename):
- "Write the current theme as a BPython script"
-
- f = file(filename, "w")
-
- f.write("import Blender")
- f.write("from Blender.Window import Theme")
- f.write("theme = Theme.New('%s')" % theme.name)
-
- for tsp in theme.get(): # write each theme space
- command = "\\n%s = theme.get('%s')" % (tsp, tsp)
- f.write(command + "\\n")
- exec(command)
- exec("vars = dir(%s)" % tsp)
- vars.remove('theme')
-
- for var in vars: # write each variable from each theme space
- v = "%s.%s" % (tsp, var)
- exec("value = %s" % v)
- f.write("%s = %s\\n" % (v, value))
-
- f.write('\\nBlender.Redraw(-1)') # redraw to update the screen
- f.close()
-
- FileSelector(write_theme, "Save Current Theme", default_fname)
-"""
-
-def New (name = "New Theme", theme = '<default>'):
- """
- Create a new Theme object.
- @type name: string
- @param name: The name of the new theme.
- @type theme: Blender Theme
- @param theme: a base theme to copy all data from. It defaults to the current
- one.
- @rtype: Blender Theme
- @return: A new Blender Theme object.
- """
-
-def Get (name = None):
- """
- Get the Theme object(s) from Blender.
- @type name: string
- @param name: The name of the Theme object.
- @rtype: Blender Theme or a list of Blender Themes
- @return: It depends on the I{name} parameter:
- - (name): The Theme object called I{name}, None if not found;
- - (): A list with all Theme objects currently in Blender.
- """
-
-
-class Theme:
- """
- The Theme object
- ================
- This object gives access to Themes in Blender. Each Theme object is
- composed of one UI (Use Interface) theme and many Space themes
- (3d view, Text Editor, Buttons window, etc).
- @ivar name: The name of this Theme object.
- """
-
- def getName():
- """
- Get the name of this Theme object.
- @rtype: string
- @return: the name of this Theme object.
- """
-
- def setName(s):
- """
- Rename this theme.
- @type s: string
- @param s: the new name.
- """
-
- def get(t = None):
- """
- Get a space or the ui (sub)theme from this Theme.
- @type t: string, int or None
- @param t: the wanted sub-theme as either:
- - int: -1 for UI or the types in L{Window.Types<Window.Types>} for the others;
- - string: use get() to know them (they are case insensitive);
- - nothing: as written above, get() returns a list of names.
- @rtype: Blender ThemeSpace or ThemeUI or list of sub-theme types as strings.
- @return: It depends on the given parameter:
- - (): a list with all available types, as strings;
- - (type): the chosen sub-theme.
- """
-
-class ThemeUI:
- """
- The User Interface sub-theme
- ============================
- This can be accessed with theme.get(t), where t can be 'ui' or -1.
- The available variables follow the internal (C coded) ThemeUI struct in
- Blender. Most of them represent rgba (red, green, blue, alpha) colors,
- with each component in the range [0, 255]. There is more than one way to
- access them.
-
- Examples::
- print outline.R
- outline.r = 180 # it's case insensitive
- outline[0] = 94 # 0 for red, 1 for green, ...
- outline = [200, 200, 200, 255] # setting all components at once
- @type theme: string
- @ivar theme: the parent Theme for this object.
- @ivar outline: theme rgba var.
- @ivar neutral: theme rgba var.
- @ivar action: theme rgba var.
- @ivar setting: theme rgba var.
- @ivar setting1: theme rgba var.
- @ivar setting2: theme rgba var.
- @ivar num: theme rgba var.
- @ivar textfield: theme rgba var.
- @ivar textfield_hi: theme rgba var.
- @ivar popup: theme rgba var.
- @ivar text: theme rgba var.
- @ivar text_hi: theme rgba var.
- @ivar menu_back: theme rgba var.
- @ivar menu_item: theme rgba var.
- @ivar menu_hilite: theme rgba var.
- @ivar menu_text: theme rgba var.
- @ivar menu_text_hi: theme rgba var.
- @type drawType: int
- @ivar drawType: the draw type (minimal, rounded, etc) in the range [1, 4].
- @type iconTheme: string
- @ivar iconTheme: the filename (without path) for the icon theme PNG in .blender/icons/
- """
-
-class ThemeSpace:
- """
- The Space sub-themes
- ====================
- There is a sub-theme for each space in Blender (except for the Scripts
- window, but it will be added soon). Please read the information about
- L{Theme.ThemeUI}, since it is also relevant here. In Blender,
- all theme spaces share the same C structure. For this reason, all of
- them here share the same variables, event though some spaces only use
- a few of them. This lower-level access is acceptable because generally
- users will prefer to use the interface to change single theme options
- and only use scripting to save or restore themes. But anyway, checking
- the Themes tab in the User Preferences space in Blender and using the
- bundled "Save current theme" script (or its simplified version written
- on the top of this page) can help you finding out any specific info you
- may need.
- @type theme: string
- @ivar theme: the parent Theme for this object.
- @ivar back: theme rgba var.
- @ivar text: theme rgba var.
- @ivar text_hi: theme rgba var.
- @ivar header: theme rgba var.
- @ivar panel: theme rgba var.
- @ivar shade1: theme rgba var.
- @ivar shade2: theme rgba var.
- @ivar hilite: theme rgba var.
- @ivar grid: theme rgba var.
- @ivar wire: theme rgba var.
- @ivar select: theme rgba var.
- @ivar active: theme rgba var.
- @ivar transform: theme rgba var.
- @ivar vertex: theme rgba var.
- @ivar vertex_select: theme rgba var.
- @ivar edge: theme rgba var.
- @ivar edge_select: theme rgba var.
- @ivar edge_seam: theme rgba var.
- @ivar edge_facesel: theme rgba var.
- @ivar face: theme rgba var.
- @ivar face_select: theme rgba var.
- @ivar face_dot: theme rgba var.
- @ivar normal: theme rgba var.
- @ivar bone_solid: theme rgba var.
- @ivar bon_pose: theme rgba var.
- @ivar strip: theme rgba var.
- @ivar strip_select: theme rgba var.
- @ivar syntaxl: theme rgba var.
- @ivar syntaxn: theme rgba var.
- @ivar syntaxb: theme rgba var.
- @ivar syntaxv: theme rgba var.
- @ivar syntaxc: theme rgba var.
- @ivar movie: theme rgba var.
- @ivar image: theme rgba var.
- @ivar scene: theme rgba var.
- @ivar audio: theme rgba var.
- @ivar effect: theme rgba var.
- @ivar plugin: theme rgba var.
- @ivar transition: theme rgba var.
- @ivar meta: theme rgba var.
- @type vertex_size: int
- @ivar vertex_size: size of the vertices dots on screen in the range [1, 10].
- @type facedot_size: int
- @ivar facedot_size: size of the face dots on screen in the range [1, 10].
- """
-
diff --git a/source/blender/python/api2_2x/doc/TimeLine.py b/source/blender/python/api2_2x/doc/TimeLine.py
deleted file mode 100644
index 0f456189767..00000000000
--- a/source/blender/python/api2_2x/doc/TimeLine.py
+++ /dev/null
@@ -1,80 +0,0 @@
-# Blender.Scene.TimeLine module
-
-"""
-The Blender.Scene.TimeLine submodule.
-
-TimeLine
-========
-
-This module gives access to B{Scene TimeLine Contexts} in Blender.
-
-Example::
- import Blender
- from Blender import Scene
-
- # Only the current scene has a radiosity context.
- # Naturally, any scene can be made the current one
- # with scene.makeCurrent()
-
- scn = Scene.GetCurrent()
-
- # this is the only way to access the radiosity object:
-
- time_line = scn.getTimeLine ()
- time_line.add (50)
- time_line.add (100)
- time_line.setName (50, 'first')
- time_line.setName (100, 'second')
-
- Blender.Redraw(-1)
-"""
-
-class TimeLine:
- """
- The TimeLine object
- ===================
- This object wraps the current Scene's time line context in Blender.
- """
-
- def add(ival):
- """
- add new marker to time line
- @type ival: int
- @param ival: the frame number.
- """
-
- def delete(ival):
- """
- delete frame.
- @type ival: int
- @param ival: the frame number.
- """
-
- def setName(ival, sval):
- """
- set name of frame.
- @type ival: int
- @type sval: string
- @param ival: the frame number.
- @param sval: the frame name.
- """
-
- def getName(ival):
- """
- Get name of frame.
- @type ival: int
- @param ival: the frame number.
- @rtype: string
- @return: the frame name.
- """
-
- def getMarked(ival):
- """
- Get name of frame.
- @type ival: int
- @param ival: the frame number.
- @rtype: int|string
- @return: the list of frame number or name.
-
- """
-
diff --git a/source/blender/python/api2_2x/doc/Types.py b/source/blender/python/api2_2x/doc/Types.py
deleted file mode 100644
index a08226e46ee..00000000000
--- a/source/blender/python/api2_2x/doc/Types.py
+++ /dev/null
@@ -1,70 +0,0 @@
-# The Blender.Types submodule
-
-"""
-The Blender.Types submodule
-===========================
-
-This module is a dictionary of Blender Python types, for type checking.
-
-Example::
- import Blender
- from Blender import Types, Object, NMesh, Camera, Lamp
- #
- objs = Object.Get() # a list of all objects in the current scene
- for o in objs:
- print
- print o, type(o)
- data = o.getData()
- print type(data)
- if type(data) == Types.NMeshType:
- if len(data.verts):
- print "its vertices are obviously of type:", type(data.verts[0])
- print "and its faces:", Types.NMFaceType
- elif type(data) == Types.CameraType:
- print "It's a Camera."
- elif type(data) == Types.LampType:
- print "Let there be light!"
-
-@var ObjectType: Blender Object. The base object, linked to its specific data
- at its .data member variable.
-@var GroupType: Blender Group. A Group that references a list of objects that are a part of this group.
-@var NMeshType: Blender NMesh. The mesh structure.
-@var NMFaceType: Blender NMFace. A mesh face, with one (a point), two (an edge),
- three (a triangular face) or four (a quad face) vertices.
-@var NMVertType: Blender NMVert. A mesh vertex.
-@var NMColType: Blender NMCol. A mesh rgba color.
-@var MeshType: Blender Mesh. The mesh structure.
-@var MFaceType: Blender MFace. A mesh face, with
- three (a triangular face) or four (a quad face) vertices.
-@var MEdgeType: Blender MEdge. A mesh edge, with two vertices
-@var MVertType: Blender MVert. A mesh vertex which wraps a Blender mesh vertex
- (typically an object returned from the mesh.verts sequence).
-@var PVertType: Blender MVert. A mesh vertex which does not wrap a Blender
- mesh vertex (returned from L{Blender.Mesh.MVert()<Mesh.MVert.__init__>}).
-@var MColType: Blender MCol. A mesh rgba color.
-@var ArmatureType: Blender Armature. The "skeleton", for animating and deforming
-objects.
-@var BoneType: Blender Bone. Bones are, obviously, the "pieces" of an Armature.
-@var CurveType: Blender Curve.
-@var IpoType: Blender Ipo.
-@var MetaballType: Blender Metaball.
-@var CameraType: Blender Camera.
-@var ImageType: Blender Image.
-@var LampType: Blender Lamp.
-@var TextType: Blender Text.
-@var Text3dType: Blender Text3d.
-@var MaterialType: Blender Material.
-@var SceneType: A Blender Scene. Container of all other objects.
-@var ButtonType: Blender Button. One of the Draw widgets.
-@var vectorType: Blender vector. Used in NMesh, Mesh and elsewhere.
-@var matrix_Type: Blender matrix.
-@var quaternionType: Blender quaternion. Used in armatures.
-@var eulerType: Blender euler.
-@var bufferType: Blender buffer. A contiguous piece of storage, used in BGL.
-@var constantType: Blender constant. A constant dictionary.
-@var rgbTupleType: Blender rgbTuple. A (red, green, blue) triplet.
-@var TextureType: Blender Texture.
-@var MTexType: Blender MTex. Links materials to a texture.
-@var IDGroupType: Blender IDProperty Group type.
-@var IDArrayType: Blender IDProperty Array type.
-"""
diff --git a/source/blender/python/api2_2x/doc/Window.py b/source/blender/python/api2_2x/doc/Window.py
deleted file mode 100644
index 7fceeb757de..00000000000
--- a/source/blender/python/api2_2x/doc/Window.py
+++ /dev/null
@@ -1,538 +0,0 @@
-# Blender.Window module and the Window PyType object
-
-"""
-The Blender.Window submodule.
-
-B{New}: renamed ViewLayer to L{ViewLayers} (actually added an alias, so both
-forms will work).
-
-Window
-======
-
-This module provides access to B{Window} functions in Blender.
-
-Example:
---------
-
-FileSelector::
-
- import Blender
- from Blender import Window
- #
- def my_callback(filename): # callback for the FileSelector
- print "You chose the file:", filename # do something with the chosen file
- #
- Window.FileSelector (my_callback, "Choose one!")
-
-Example:
---------
-
-DrawProgressBar::
-
- import Blender
- from Blender.Window import DrawProgressBar
- #
- # substitute the bogus_*() function calls for your own, of course.
- #
- DrawProgressBar (0.0, "Importing data ...")
- bogus_importData()
- DrawProgressBar (0.3, "Building something")
- bogus_build()
- DrawProgressBar (0.8, "Updating Blender")
- bogus_update()
- DrawProgressBar (1.0, "Finished")
- #
- # another example:
- #
- number = 1
- while number < 20:
- file = filename + "00%d" % number
- DrawProgressBar (number / 20.0, "Loading texture: %s" % file)
- Blender.Image.Load(file)
- number += 1
-
- DrawProgressBar (1.0, "Finished loading")
-
-
-@type Types: readonly dictionary
-@var Types: The available Window Types.
- - ACTION
- - BUTS
- - FILE
- - IMAGE
- - IMASEL
- - INFO
- - IPO
- - NLA
- - OOPS
- - SCRIPT
- - SEQ
- - SOUND
- - TEXT
- - VIEW3D
-
-@type Qual: readonly dictionary
-@var Qual: Qualifier keys (shift, control, alt) bitmasks.
- - LALT: left ALT key
- - RALT: right ALT key
- - ALT: any ALT key, ...
- - LCTRL
- - RCTRL
- - CTRL
- - LSHIFT
- - RSHIFT
- - SHIFT
-
-@type MButs: readonly dictionary
-@var MButs: Mouse buttons.
- - L: left mouse button
- - M: middle mouse button
- - R: right mouse button
-
-@warn: The event system in Blender needs a rewrite, though we don't know when that will happen. Until then, event related functions here (L{QAdd}, L{QRead},
-L{QHandle}, etc.) can be used, but they are actually experimental and can be
-substituted for a better method when the rewrite happens. In other words, use
-them at your own risk, because though they should work well and allow many
-interesting and powerful possibilities, they can be deprecated in some future
-version of Blender / Blender Python.
-"""
-
-def Redraw (spacetype = '<Types.VIEW3D>'):
- """
- Force a redraw of a specific space type.
- @type spacetype: int
- @param spacetype: the space type, see L{Types}. By default the 3d Views are
- redrawn. If spacetype < 0, all currently visible spaces are redrawn.
- """
-
-def RedrawAll ():
- """
- Redraw all windows.
- """
-
-def QRedrawAll ():
- """
- Redraw all windows by queue event.
- """
-
-def FileSelector (callback, title = 'SELECT FILE', filename = '<default>'):
- """
- Open the file selector window in Blender. After the user selects a filename,
- it is passed as parameter to the function callback given to FileSelector().
- Example::
- import Blender
- #
- def my_function(filename):
- print 'The selected file was:', filename
- #
- Blender.Window.FileSelector (my_function, 'SAVE FILE')
- @type callback: function that accepts a string: f(str)
- @param callback: The function that must be provided to FileSelector() and
- will receive the selected filename as parameter.
- @type title: string
- @param title: The string that appears in the button to confirm the selection
- and return from the file selection window.
- @type filename: string
- @param filename: A filename. This defaults to Blender.Get('filename').
- @warn: script links are not allowed to call the File / Image Selectors. This
- is because script links global dictionaries are removed when they finish
- execution and the File Selector needs the passed callback to stay around.
- An alternative is calling the File Selector from another script (see
- L{Blender.Run}).
- """
-
-def ImageSelector (callback, title = 'SELECT IMAGE', filename = '<default>'):
- """
- Open the image selector window in Blender. After the user selects a filename,
- it is passed as parameter to the function callback given to ImageSelector().
- Example::
- import Blender
- #
- def my_function(imagename):
- print 'The selected image was:', imagename
- #
- Blender.Window.ImageSelector (my_function, 'LOAD IMAGE')
- @type callback: function that accepts a string: f(str)
- @param callback: The function that must be provided to ImageSelector() and
- will receive the selected filename as parameter.
- @type title: string
- @param title: The string that appears in the button to confirm the selection
- and return from the image selection window.
- @type filename: string
- @param filename: A filename. This defaults to L{Blender.Get}('filename').
- @warn: script links are not allowed to call the File / Image Selectors. This
- is because script links global dictionaries are removed when they finish
- execution and the File Selector needs the passed callback to stay around.
- An alternative is calling the File Selector from another script (see
- L{Blender.Run}).
- """
-
-def DrawProgressBar (done, text):
- """
- Draw a progress bar in the upper right corner of the screen. To cancel it
- prematurely, users can press the "Esc" key. Start it with done = 0 and end
- it with done = 1.
- @type done: float
- @param done: A float in [0.0, 1.0] that tells the advance in the progress
- bar.
- @type text: string
- @param text: Info about what is currently being done "behind the scenes".
- """
-
-def GetCursorPos ():
- """
- Get the current 3d cursor position.
- @rtype: list of three floats
- @return: the current position: [x, y, z].
- """
-
-def GetActiveLayer ():
- """
- Get the bitmask for the active layer.
- @note: if there is no 3d view it will return zero.
- @rtype: int
- @return: layer bitmask
- """
-
-def SetActiveLayer(layermask):
- """
- Set the bitmask for the active layer.
- @type layermask: int
- @param layermask: An integer bitmask, to use humanly readable values do (1<<0) for the first layer, (1<<19) for the last layer.
- """
-
-def SetCursorPos (coords):
- """
- Change the 3d cursor position.
- @type coords: 3 floats or a list of 3 floats
- @param coords: The new x, y, z coordinates.
- @note: if visible, the 3d View must be redrawn to display the change. This
- can be done with L{Redraw}.
- """
-
-def GetPivot ():
- """
- Get the pivot for the active 3D view.
- @rtype: int
- @return: constant - Window.PivotTypes
- """
-
-def SetPivot (pivot):
- """
- Set the pivot on the active 3D view.
- @type pivot: int
- @param pivot: constant - Window.PivotTypes
- """
-
-def WaitCursor (bool):
- """
- Set cursor to wait or back to normal mode.
-
- Example::
- Blender.Window.WaitCursor(1)
- Blender.sys.sleep(2000) # do something that takes some time
- Blender.Window.WaitCursor(0) # back
-
- @type bool: int (bool)
- @param bool: if nonzero the cursor is set to wait mode, otherwise to normal
- mode.
- @note: when the script finishes execution, the cursor is set to normal by
- Blender itself.
- """
-
-def GetViewVector ():
- """
- Get the current 3d view vector.
- @rtype: list of three floats
- @return: the current vector: [x, y, z].
- """
-
-def GetViewMatrix ():
- """
- Get the current 3d view matrix.
- @rtype: 4x4 float matrix (WRAPPED DATA)
- @return: the current matrix.
- """
-
-def GetPerspMatrix ():
- """
- Get the current 3d perspective matrix.
- @rtype: 4x4 float matrix (WRAPPED DATA)
- @return: the current matrix.
- """
-
-def EditMode(enable = -1, undo_msg = 'From script', undo = 1):
- """
- Get and optionally set the current edit mode status: in or out.
-
- Example::
- in_editmode = Window.EditMode()
- # MUST leave edit mode before changing an active mesh:
- if in_editmode: Window.EditMode(0)
- # ...
- # make changes to the mesh
- # ...
- # be nice to the user and return things to how they were:
- if in_editmode: Window.EditMode(1)
- @type enable: int
- @param enable: get/set current status:
- - -1: just return current status (default);
- - 0: leave edit mode;
- - 1: enter edit mode.
-
- It's not an error to try to change to a state that is already the
- current one, the function simply ignores the request.
- @type undo_msg: string
- @param undo_msg: only needed when exiting edit mode (EditMode(0)). This
- string is used as the undo message in the Mesh->Undo History submenu in
- the 3d view header. Max length is 63, strings longer than that get
- clamped.
- @param undo: don't save Undo information (only needed when exiting edit
- mode).
- @type undo: int
- @rtype: int (bool)
- @return: 0 if Blender is not in edit mode right now, 1 otherwise.
- @warn: this is an important function. NMesh operates on normal Blender
- meshes, not edit mode ones. If a script changes an active mesh while in
- edit mode, when the user leaves the mode the changes will be lost,
- because the normal mesh will be rebuilt based on its unchanged edit mesh.
- """
-
-def PoseMode(enable = -1):
- """
- Get and optionally set the current pose mode status: in or out.
- @type enable: int
- @param enable: get/set current status:
- - -1: just return current status (default);
- - 0: leave edit mode;
- - 1: enter edit mode.
-
- @return: 0 if Blender is not in edit mode right now, 1 otherwise.
- @warn: This uses the active armature objects posemode status, enabling pose
- mode for non armature objects will always fail.
- """
-
-def ViewLayers (layers = [], winid = None):
- """
- Get and optionally set the currently visible layers in all 3d Views.
- @type layers: list of ints
- @param layers: a list with indexes of the layers that will be visible. Each
- index must be in the range [1, 20]. If not given or equal to [], the
- function simply returns the visible ones without changing anything.
- @type winid: window id from as redurned by GetScreenInfo
- @param winid: An optional argument to set the layer of a window
- rather then setting the scene layers. For this to display in the 3d view
- the layer lock must be disabled (unlocked).
- @rtype: list of ints
- @return: the currently visible layers.
- """
-
-def GetViewQuat ():
- """
- Get the current VIEW3D view quaternion values.
- @rtype: list of floats
- @return: the quaternion as a list of four float values.
- """
-
-def SetViewQuat (quat):
- """
- Set the current VIEW3D view quaternion.
- @type quat: floats or list of floats
- @param quat: four floats or a list of four floats.
- """
-
-def GetViewOffset ():
- """
- Get the current VIEW3D offset values.
- @rtype: list of floats
- @return: a list with three floats: [x,y,z].
- @note: The 3 values returned are flipped in comparison object locations.
- """
-
-def SetViewOffset (ofs):
- """
- Set the current VIEW3D offset values.
- @type ofs: 3 floats or list of 3 floats
- @param ofs: the new view offset values.
- @note: The value you give flipped in comparison object locations.
- """
-
-def CameraView (camtov3d = 0):
- """
- Set the current VIEW3D view to the active camera's view. If there's no
- active object or it is not of type 'Camera', the active camera for the
- current scene is used instead.
- @type camtov3d: int (bool)
- @param camtov3d: if nonzero it's the camera that gets positioned at the
- current view, instead of the view being changed to that of the camera.
- """
-
-def QTest ():
- """
- Check if there are pending events in the event queue.
- @rtype: int
- @return: 0 if there are no pending events, non-zero otherwise.
- """
-
-def QRead ():
- """
- Get the next pending event from the event queue.
-
- Example::
- # let's catch all events and move the 3D Cursor when user presses
- # the left mouse button.
- from Blender import Draw, Window
-
- v3d = Window.GetScreenInfo(Window.Types.VIEW3D)
- id = v3d[0]['id'] # get the (first) VIEW3D's id
-
- done = 0
-
- while not done: # enter a 'get event' loop
- evt, val = Window.QRead() # catch next event
- if evt in [Draw.MOUSEX, Draw.MOUSEY]:
- continue # speeds things up, ignores mouse movement
- elif evt in [Draw.ESCKEY, Draw.QKEY]: done = 1 # end loop
- elif evt == Draw.SPACEKEY:
- Draw.PupMenu("Hey!|What did you expect?")
- elif evt == Draw.Redraw: # catch redraw events to handle them
- Window.RedrawAll() # redraw all areas
- elif evt == Draw.LEFTMOUSE: # left button pressed
- Window.QAdd(id, evt, 1) # add the caught mouse event to our v3d
- # actually we should check if the event happened inside that area,
- # using Window.GetMouseCoords() and v3d[0]['vertices'] values.
- Window.QHandle(id) # process the event
- # do something fancy like putting some object where the
- # user positioned the 3d cursor, then:
- Window.Redraw() # show the change in the VIEW3D areas.
-
- @rtype: list
- @return: [event, val], where:
- - event: int - the key or mouse event (see L{Draw});
- - val: int - 1 for a key press, 0 for a release, new x or y coordinates
- for mouse movement events.
- """
-
-def QAdd (win, event, val, after = 0):
- """
- Add an event to some window's (actually called areas in Blender) event queue.
- @type win: int
- @param win: the window id, see L{GetScreenInfo}.
- @type event: positive int
- @param event: the event to add, see events in L{Draw}.
- @type val: int
- @param val: 1 for a key press, 0 for a release.
- @type after: int (bool)
- @param after: if nonzero the event is put after the current queue and added
- later.
- """
-
-def QHandle (winId):
- """
- Process immediately all pending events for the given window (area).
- @type winId: int
- @param winId: the window id, see L{GetScreenInfo}.
- @note: see L{QAdd} for how to send events to a particular window.
- """
-
-def GetMouseCoords ():
- """
- Get mouse's current screen coordinates.
- @rtype: list with two ints
- @return: a [x, y] list with the coordinates.
- """
-
-def SetMouseCoords (coords):
- """
- Set mouse's current screen coordinates.
- @type coords: (list of) two ints
- @param coords: can be passed as x, y or [x, y] and are clamped to stay inside
- the screen. If not given they default to the coordinates of the middle
- of the screen.
- """
-
-def GetMouseButtons ():
- """
- Get the current mouse button state (see / compare against L{MButs}).
- @rtype: int
- @return: an OR'ed flag with the currently pressed buttons.
- """
-
-def GetKeyQualifiers ():
- """
- Get the current qualifier keys state (see / compare against L{Qual}).
- @rtype: int
- @return: an OR'ed combination of values in L{Qual}.
- """
-
-def SetKeyQualifiers (qual):
- """
- Fake qualifier keys state. This is useful because some key events require
- one or more qualifiers to be active (see L{QAdd}).
- @type qual: int
- @param qual: an OR'ed combination of values in L{Qual}.
- @rtype: int
- @return: the current state, that should be equal to 'qual'.
- @warn: remember to reset the qual keys to 0 once they are not necessary
- anymore.
- """
-
-def GetAreaID ():
- """
- Get the current area's ID.
- """
-
-def GetAreaSize ():
- """
- Get the current area's size.
- @rtype: list with two ints
- @return: a [width, height] list.
- @note: the returned values are 1 pixel bigger than what L{GetScreenInfo}
- returns for the 'vertices' of the same area.
- """
-
-def GetScreenSize ():
- """
- Get Blender's screen size.
- @rtype: list with two ints
- @return: a [width, height] list.
- """
-
-def GetScreens ():
- """
- Get the names of all available screens.
- @rtype: list of strings
- @return: a list of names that can be passed to L{SetScreen}.
- """
-
-def SetScreen (name):
- """
- Set as current screen the one with the given name.
- @type name: string
- @param name: the name of an existing screen. Use L{GetScreens} to get
- a list with all screen names.
- """
-
-def GetScreenInfo (type = -1, rect = 'win', screen = ''):
- """
- Get info about the current screen setup.
- @type type: int
- @param type: the space type (see L{Types}) to restrict the
- results to. If -1 (the default), info is reported about all available
- areas.
- @type rect: string
- @param rect: the rectangle of interest. This defines if the corner
- coordinates returned will refer to:
- - the whole area: 'total'
- - only the header: 'header'
- - only the window content part (default): 'win'
- @type screen: string
- @param screen: the name of an available screen. The current one is used by
- default.
- @rtype: list of dictionaries
- @return: a list of dictionaries, one for each area in the screen. Each
- dictionary has these keys (all values are ints):
- - 'vertices': [xmin, ymin, xmax, ymax] area corners;
- - 'win': window type, see L{Types};
- - 'id': this area's id.
- """
diff --git a/source/blender/python/api2_2x/doc/World.py b/source/blender/python/api2_2x/doc/World.py
deleted file mode 100644
index d9e9bae750d..00000000000
--- a/source/blender/python/api2_2x/doc/World.py
+++ /dev/null
@@ -1,351 +0,0 @@
-# Blender.World module and the World PyType
-
-"""
-The Blender.World submodule
-
-B{New}: L{World.clearScriptLinks} accepts a parameter now.
-
-World
-=====
-
-The module world allows you to access all the data of a Blender World.
-
-Example::
- import Blender
- w = Blender.Get('World') #assume there exists a world named "world"
- print w.getName()
- w.hor = [1,1,.2]
- print w.getHor()
-
-Example::
- import Blender
- from Blender import *
-
- AllWorlds = Blender.World.Get() # returns a list of created world objects
- AvailWorlds = len(AllWorlds) # returns the number of available world objects
- PropWorld = dir(AllWorlds[0]) # returns the properties of the class world
- NameWorld = AllWorlds[0].getName() # get name of the first world object
-
- MiType = AllWorlds[0].getMistype() # get kind of mist from the first world object
- MiParam = AllWorlds[0].getMist() # get the parameters intensity, start, end and height of the mist
-
- HorColor = AllWorlds[0].getHor() # horizon color of the first world object
- HorColorR = HorColor[0] # get the red channel (RGB) of the horizon color
-
- ZenColor = AllWorlds[0].getZen() # zenith color of the first world object
- ZenColorB = ZenColor[2] # get the blue channel (RGB) of the Zenith color
-
- blending = AllWorlds[0].getSkytype() # get the blending modes (real, blend, paper) of the first world object
-"""
-
-def New (name):
- """
- Creates a new World.
- @type name: string
- @param name: World's name (optional).
- @rtype: Blender World
- @return: The created World. If the "name" parameter has not been provided, it will be automatically be set by blender.
- """
-
-def Get (name):
- """
- Get an World from Blender.
- @type name: string
- @param name: The name of the world to retrieve.
- @rtype: Blender World or a list of Blender Worlds
- @return:
- - (name): The World corresponding to the name
- - (): A list with all Worlds in the current scene.
- """
-
-
-def GetCurrent ():
- """
- Get the active world of the scene.
- @rtype: Blender World or None
- """
-
-class World:
- """
- The World object
- ================
- This object gives access to generic data from all worlds in Blender.
- Its attributes depend upon its type.
-
- @ivar skytype: type of the sky. Bit 0 : Blend; Bit 1 : Real; Bit 2 : paper.
- @ivar mode:
- @ivar mistype: type of mist : O : quadratic; 1 : linear; 2 : square
- @ivar hor: the horizon color of a world object.
- @ivar zen: the zenith color of a world object.
- @ivar amb: the ambient color of a world object.
- @ivar star: the star parameters of a world object. See getStar for the semantics of these parameters.
- @ivar mist: the mist parameters of a world object. See getMist for the semantics of these parameters.
- @type ipo: Blender Ipo
- @ivar ipo: The world type ipo linked to this world object.
- """
-
- def getRange():
- """
- Retrieves the range parameter of a world object.
- @rtype: float
- @return: the range
- """
-
- def setRange(range):
- """
- Sets the range parameter of a world object.
- @type range: float
- @param range: the new range parameter
- @rtype: None
- @return: None
- """
-
- def getName():
- """
- Retrieves the name of a world object
- @rtype: string
- @return: the name of the world object.
- """
-
- def setName(name):
- """
- Sets the name of a world object.
- @type name: string
- @param name : the new name.
- @rtype: None
- @return: None
- """
-
- def getIpo():
- """
- Get the Ipo associated with this world object, if any.
- @rtype: Ipo
- @return: the wrapped ipo or None.
- """
-
- def setIpo(ipo):
- """
- Link an ipo to this world object.
- @type ipo: Blender Ipo
- @param ipo: a "camera data" ipo.
- """
-
- def clearIpo():
- """
- Unlink the ipo from this world object.
- @return: True if there was an ipo linked or False otherwise.
- """
-
- def getSkytype():
- """
- Retrieves the skytype of a world object.
- The skytype is a combination of 3 bits : Bit 0 : Blend; Bit 1 : Real; Bit 2 : paper.
- @rtype: int
- @return: the skytype of the world object.
- """
-
- def setSkytype(skytype):
- """
- Sets the skytype of a world object.
- See getSkytype for the semantics of the parameter.
- @type skytype: int
- @param skytype : the new skytype.
- @rtype: None
- @return: None
- """
-
- def getMode():
- """
- Retrieves the mode of a world object.
- The mode is a combination of 5 bits:
- - Bit 0 : mist simulation
- - Bit 1 : starfield simulation
- - Bit 2,3 : reserved
- - Bit 4 : ambient occlusion
- @rtype: int
- @return: the mode of the world object.
- """
-
- def setMode(mode):
- """
- Sets the mode of a world object.
- See getMode for the semantics of the parameter.
- @type mode: int
- @param mode : the new mode.
- @rtype: None
- @return: None
- """
-
- def getMistype():
- """
- Retrieves the mist type of a world object.
- The mist type is an integer 0 : quadratic; 1 : linear; 2 : square.
- @rtype: int
- @return: the mistype of the world object.
- """
-
- def setMistype(mistype):
- """
- Sets the mist type of a world object.
- See getMistype for the semantics of the parameter.
- @type mistype: int
- @param mistype : the new mist type.
- @rtype: None
- @return: None
- """
-
- def getHor():
- """
- Retrieves the horizon color of a world object.
- This color is a list of 3 floats.
- @rtype: list of three floats
- @return: the horizon color of the world object.
- """
-
- def setHor(hor):
- """
- Sets the horizon color of a world object.
- @type hor: list of three floats
- @param hor : the new hor.
- @rtype: None
- @return: None
- """
-
- def getZen():
- """
- Retrieves the zenith color of a world object.
- This color is a list of 3 floats.
- @rtype: list of three floats
- @return: the zenith color of the world object.
- """
-
- def setZen(zen):
- """
- Sets the zenith color of a world object.
- @type zen: list of three floats
- @param zen : the new zenith color.
- @rtype: None
- @return: None
- """
-
- def getAmb():
- """
- Retrieves the ambient color of a world object.
- This color is a list of 3 floats.
- @rtype: list of three floats
- @return: the ambient color of the world object.
- """
-
- def setAmb(amb):
- """
- Sets the ambient color of a world object.
- @type amb: list of three floats
- @param amb : the new ambient color.
- @rtype: None
- @return: None
- """
-
- def getStar():
- """
- Retrieves the star parameters of a world object.
- It is a list of nine floats :
- red component of the color
- green component of the color
- blue component of the color
- size of the stars
- minimal distance between the stars
- average distance between the stars
- variations of the stars color
- @rtype: list of nine floats
- @return: the star parameters
- """
-
- def setStar(star):
- """
- Sets the star parameters of a world object.
- See getStar for the semantics of the parameter.
- @type star: list of 9 floats
- @param star : the new star parameters.
- @rtype: None
- @return: None
- """
-
- def getMist():
- """
- Retrieves the mist parameters of a world object.
- It is a list of four floats :
- intensity of the mist
- start of the mist
- end of the mist
- height of the mist
- @rtype: list of four floats
- @return: the mist parameters
- """
-
- def setMist(mist):
- """
- Sets the mist parameters of a world object.
- See getMist for the semantics of the parameter.
- @type mist: list of 4 floats
- @param mist : the new mist parameters.
- @rtype: None
- @return: None
- """
-
- def getScriptLinks (event):
- """
- Get a list with this World's script links of type 'event'.
- @type event: string
- @param event: "FrameChanged", "Redraw", "Render".
- @rtype: list
- @return: a list with Blender L{Text} names (the script links of the given
- 'event' type) or None if there are no script links at all.
- """
-
- def clearScriptLinks (links = None):
- """
- Delete script links from this World :). If no list is specified, all
- script links are deleted.
- @type links: list of strings
- @param links: None (default) or a list of Blender L{Text} names.
- """
-
- def addScriptLink (text, event):
- """
- Add a new script link to this World.
- @type text: string
- @param text: the name of an existing Blender L{Text}.
- @type event: string
- @param event: "FrameChanged", "Redraw" or "Render".
- """
-
- def setCurrent ():
- """
- Make this world active in the current scene.
- @rtype: None
- @return: None
- """
-
- def insertIpoKey(keytype):
- """
- Inserts keytype values in world ipo at curframe. Uses module constants.
- @type keytype: Integer
- @param keytype:
- -ZENTIH
- -HORIZON
- -MIST
- -STARS
- -OFFSET
- -SIZE
- @return: py_none
- """
-
- def __copy__ ():
- """
- Make a copy of this world
- @rtype: World
- @return: a copy of this world
- """
-
-import id_generics
-World.__doc__ += id_generics.attributes
diff --git a/source/blender/python/api2_2x/doc/Worlddoc.txt b/source/blender/python/api2_2x/doc/Worlddoc.txt
deleted file mode 100644
index 78e325fd7ce..00000000000
--- a/source/blender/python/api2_2x/doc/Worlddoc.txt
+++ /dev/null
@@ -1,55 +0,0 @@
-METABALL Module documentation
-
-INTRODUCTION
-The metaball module effect allows you to access all the data of an metaball.
-A metaball consists of several (maybe only one) metaelems, which are spheres, interacting with each other, thus creating soft organic volumes.
-
-functions of the module :
-New(name) : creates ans returns a metaball object.
-Get(opt : name) : if the parameter name is given, returns the metaball object whose name has been passed, or Py_None, if no such metaball exists in the current scene. If no parameter is given, returns a list of all the metaballs in the current scene.
-get : alias for Get
-
-Metaball object member functions :
-
-getName()Return Metaball name
-setName(string newname) - Sets Metaball name
-getWiresize() - Return Metaball wire size
-setWiresize(float val) - Sets Metaball wire size
-getRendersize() - Return Metaball render size
-setRendersize(float newval- Sets Metaball render size
-getThresh()- Return Metaball threshold
-setThresh(float newval)- Sets Metaball threshold
-getBbox,- Return Metaball bounding box(a list of eight lists of three elements)
-getNMetaElems() Returns the number of Metaelems (basic spheres)
-getMetatype(int num_metaelem): returns the type of the metaelem number num_metaelem.
-0 : ball
-1 : tubex
-2 : tubey
-3 : tubez
-setMetatype(int num_metaelem,int newtype) : sets the type of the metaelem number num_metaelem.
-getMetadata(field_name,int num_metaelem) gets Metaball MetaData. Explained later.
-setMetadata(field_name,int num_metaelem,newval) sets Metaball MetaData. Explained later.
-getMetalay(int num_metaelem)
-getMetax(int num_metaelem) : gets the x coordinate of the metaelement
-setMetax(int num_metaelem,float newval) : sets the x coordinate of the metaelement
-getMetay(int num_metaelem) : gets the y coordinate of the metaelement
-setMetay(int num_metaelem,float newval) : sets the y coordinate of the metaelement
-getMetaz(int num_metaelem) : gets the z coordinate of the metaelement
-setMetaz(int num_metaelem,float newval) : sets the z coordinate of the metaelement
-getMetas(int num_metaelem) : gets the s coordinate of the metaelement
-setMetas(int num_metaelem,float newval) : sets the s coordinate of the metaelement
-getMetalen(int num_metaelem) : gets the length of the metaelement. Important for tubes.
-setMetalen(int num_metaelem,float newval) : sets the length of the metaelement. Important for tubes.
-getloc, - Gets Metaball loc values
-setloc, (f f f) - Sets Metaball loc values
-getrot, () - Gets Metaball rot values
-setrot,, (f f f) - Sets Metaball rot values
-getsize,() - Gets Metaball size values
-setsize,(f f f) - Sets Metaball size values
-
-
-
-
-The Object.attribute syntax
-
-The attribute can take these values : seed,nabla,sta,end,lifetime,normfac,obfac,randfac,texfac,randlife,vectsize,totpart,force,mult,life,child,mat,defvec. \ No newline at end of file
diff --git a/source/blender/python/api2_2x/doc/epy_docgen-3.sh b/source/blender/python/api2_2x/doc/epy_docgen-3.sh
deleted file mode 100644
index bec7653b152..00000000000
--- a/source/blender/python/api2_2x/doc/epy_docgen-3.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-# epy_docgen.sh
-# generates blender python doc using epydoc
-# requires epydoc in your PATH.
-# run from the doc directory containing the .py files
-# usage: sh epy_docgen.sh
-
-# set posix locale so regex works properly for [A-Z]*.py
-LC_ALL=POSIX
-
-epydoc -o BPY_API --url "http://www.blender.org" --top API_intro \
- --name "Blender" --no-private --no-frames \
-$( ls [A-Z]*.py )
diff --git a/source/blender/python/api2_2x/doc/epy_docgen.sh b/source/blender/python/api2_2x/doc/epy_docgen.sh
deleted file mode 100644
index d709ee73190..00000000000
--- a/source/blender/python/api2_2x/doc/epy_docgen.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-# epy_docgen.sh
-# generates blender python doc using epydoc
-# requires epydoc in your PATH.
-# run from the doc directory containing the .py files
-# usage: sh epy_docgen.sh
-
-# set posix locale so regex works properly for [A-Z]*.py
-LC_ALL=POSIX
-
-epydoc -o BPY_API --url "http://www.blender.org" -t API_intro.py \
- -n "Blender" --no-private --no-frames \
-$( ls [A-Z]*.py )
diff --git a/source/blender/python/api2_2x/doc/id_generics.py b/source/blender/python/api2_2x/doc/id_generics.py
deleted file mode 100644
index 30c7e5d6a3c..00000000000
--- a/source/blender/python/api2_2x/doc/id_generics.py
+++ /dev/null
@@ -1,30 +0,0 @@
-attributes = """
- @ivar name: unique name within each blend file.
-
- The name is case sensitive and 21 characters maximum length.
-
- B{Note}: a blend file may have naming collisions when external library data is used,
- be sure to check the value of L{lib}.
-
- B{Note}: Setting a value longer then 21 characters will be shortened
- @type name: string
- @ivar lib: path to the blend file this datablock is stored in (readonly).
-
- lib will be None unless you are using external blend files with (File, Append/Link)
-
- B{Note}: the path may be relative, to get the full path use L{Blender.sys.expandpath<Sys.expandpath>}
- @type lib: string or None
-
- @ivar fakeUser: When set to True, this datablock wont be removed, even if nothing is using it.
- All data has this disabled by default except for Actions.
- @type fakeUser: bool
- @ivar tag: A temporary tag that to flag data as being used within a loop.
- always set all tags to True or False before using since blender uses this flag for its own internal operations.
- @type tag: bool
- @ivar users: The number of users this datablock has. (readonly)
- Zero user datablocks are de-allocated after reloading and saving.
- @type users: int
- @ivar properties: Returns an L{IDGroup<IDProp.IDGroup>} reference to this
- datablocks's ID Properties.
- @type properties: L{IDGroup<IDProp.IDGroup>}
-""" \ No newline at end of file
diff --git a/source/blender/python/api2_2x/doc/testbgl.py b/source/blender/python/api2_2x/doc/testbgl.py
deleted file mode 100644
index e895d01df69..00000000000
--- a/source/blender/python/api2_2x/doc/testbgl.py
+++ /dev/null
@@ -1,45 +0,0 @@
-# Testing the BGL module
-
-import Blender
-from Blender.BGL import *
-from Blender import Draw
-
-R = G = B = 0
-A = 1
-
-instructions = "Hold mouse buttons to change the background color."
-quitting = " Press ESC or q to quit."
-
-def show_win():
- glClearColor(R,G,B,A) # define color used to clear buffers
- glClear(GL_COLOR_BUFFER_BIT) # use it to clear the color buffer
- glColor3f(1,1,1) # change default color
- glRasterPos2i(50,100) # move cursor to x = 50, y = 100
- Draw.Text("Testing BGL + Draw") # draw this text there
- glRasterPos2i(350,20) # move cursor again
- Draw.Text(instructions + quitting) # draw another msg
- glBegin(GL_LINE_LOOP) # begin a vertex-data list
- glVertex2i(46,92)
- glVertex2i(120,92)
- glVertex2i(120,115)
- glVertex2i(46,115)
- glEnd() # close this list
- glColor3f(0.35,0.18,0.92) # change default color again
- glBegin(GL_POLYGON) # another list, for a polygon
- glVertex2i(315, 292)
- glVertex2i(412, 200)
- glVertex2i(264, 256)
- glEnd()
- Draw.Redraw(1) # make changes visible.
-
-def ev(evt, val): # this is a callback for Draw.Register()
- global R,G,B,A # it handles input events
- if evt == Draw.ESCKEY or evt == Draw.QKEY:
- Draw.Exit() # this quits the script
- elif evt == Draw.LEFTMOUSE: R = 1 - R
- elif evt == Draw.MIDDLEMOUSE: G = 1 - G
- elif evt == Draw.RIGHTMOUSE: B = 1 - B
- else:
- Draw.Register(show_win, ev, None)
-
-Draw.Register(show_win, ev, None) # start the main loop
diff --git a/source/blender/python/api2_2x/doc/testcamera.py b/source/blender/python/api2_2x/doc/testcamera.py
deleted file mode 100644
index a84b3ac5b15..00000000000
--- a/source/blender/python/api2_2x/doc/testcamera.py
+++ /dev/null
@@ -1,137 +0,0 @@
-# Blender.Camera module and Camera PyType test file
-# This also works with Lamp and Material, simply uncomment the right
-# line below
-
-MODULE = "Camera"
-#MODULE = "Lamp"
-#MODULE = "Material"
-BPY_OBJECT = MODULE
-
-LONG_STRING = "Supercalifragilisticspialidous"
-
-import types, sys
-import Blender
-exec ("from Blender import %s" % MODULE)
-
-def PRINT_HEADER(header, sep):
- print "\n", sep * 79
- print header
- print sep * 79
-
-def PRINT_UNDERLINED(str):
- print "\n", str
- print "-" * len(str)
-
-def PRINT_AND_RM(arg, branch, d):
- for a in arg:
- if a in d:
- d.remove(a)
- print "\n%s.%s:" % (branch, a),
- exec("print %s.%s" % (branch, a))
-
-PRINT_HEADER("Testing the Blender.%s module" % MODULE, '=')
-
-exec ("Module_dir = dir (%s)" % MODULE)
-print "\ndir (%s):" % MODULE
-print Module_dir
-
-PRINT_AND_RM (["__name__", "__doc__"], MODULE, Module_dir)
-
-for item in Module_dir:
- hooked = 0
- branch = "%s.%s" % (MODULE, item)
- PRINT_HEADER(branch, "-")
- exec ("item_type = type (%s)" % branch)
- print item_type
- exec ("sub_dir = dir(%s)" % branch)
- PRINT_AND_RM (["__name__", "__doc__"], branch, sub_dir)
- if item_type == types.BuiltinFunctionType:
- PRINT_UNDERLINED ("Executing %s:" % branch)
- exec ("result = %s()" % branch)
- print "Returned value is: ", result
- if item in ["Get", "get"] and not hooked:
- if len(result):
- obj = result[0]
- hooked = 1
-
-if hooked:
- PRINT_HEADER(obj, "=")
- exec ("obj_dir = dir(obj)")
- print "\ndir():"
- print obj_dir
-
- methods = []
- member_vars = []
-
- for item in obj_dir:
- exec ("item_type = type (obj.%s)" % item)
- if item_type == types.BuiltinMethodType:
- methods.append(item)
- else:
- member_vars.append(item)
-
- PRINT_HEADER("%s Methods" % BPY_OBJECT, '-')
- if methods: print methods
- else: print "XXX No methods found in %s" % BPY_OBJECT
-
- PRINT_HEADER("%s Member Variables" % BPY_OBJECT, '-')
- if member_vars:
- for m in member_vars:
- PRINT_UNDERLINED(m)
- exec ("mvalue = obj.%s" % m)
- exec ("mtype = type (obj.%s)" % m)
- mtype = str(mtype).split("'")[1]
- print "%s: %s" % (mtype, mvalue)
-
- M = m[0].upper() + m[1:]
- setM = "set%s" % M
- getM = "get%s" % M
- if setM in methods:
- print "There is a .%s() method." % setM
- methods.remove(setM)
- if mtype == 'str':
- try:
- print "Trying to set string to %s" % LONG_STRING
- exec("obj.%s('%s')" % (setM, LONG_STRING))
- exec("get_str = obj.%s()" % getM)
- print "It returned:", get_str
- len_str = len(get_str)
- if len_str < 100:
- print "It correctly clamped the string to %s chars." % len_str
- except:
- PRINT_HEADER("FAILED in .%s()" % setM, "X")
- print sys.exc_info()[0]
- elif mtype == 'float':
- try:
- exec("obj.%s(%d)" % (setM, -999999))
- exec("result = obj.%s()" % getM)
- print "%s's minimum value is %f" % (m, result)
- exec("obj.%s(%d)" % (setM, 999999))
- exec("result = obj.%s()" % getM)
- print "%s's maximum value is %f" % (m, result)
- except:
- PRINT_HEADER("FAILED in %s or %s" % (setM, getM), "X")
- print sys.exc_info()[0]
- elif mtype == 'int':
- try:
- dict = M+"s"
- if dict in member_vars:
- exec("key = obj.%s.keys()[1]" % dict)
- exec("obj.%s('%s')" % (setM, key))
- exec("result = obj.%s()" % getM)
- except:
- PRINT_HEADER("FAILED in %s or %s" % (setM, getM), "X")
- print sys.exc_info()[0]
-
- if getM in methods:
- print "There is a .%s() method." % getM,
- methods.remove(getM)
- exec("result = obj.%s()" % getM)
- print "It returned:", result
-
- else: print "XXX No member variables found in %s" % BPY_OBJECT
-
-else: # the module .Get() function found nothing
- PRINT_HEADER("Failed trying to %s.Get() a %s object"
- % (MODULE, BPY_OBJECT), 'X')
-
diff --git a/source/blender/python/api2_2x/doc/testcurve.py b/source/blender/python/api2_2x/doc/testcurve.py
deleted file mode 100644
index 1db037bc385..00000000000
--- a/source/blender/python/api2_2x/doc/testcurve.py
+++ /dev/null
@@ -1,20 +0,0 @@
-import Blender
-
-
-list = Blender.Curve.Get()
-
-print list
-
-cur = Blender.Curve.Get('Curve')
-
-
-for prop in ["Name","PathLen","Totcol","Flag","Bevresol","Resolu","Resolv","Width","Ext1","Ext2","Loc","Rot","Size"]:
- value = eval("cur.get%s()"%prop)
- print prop,"-->",value
- exec("cur.set%s(value)"%prop)
-
-
-
-for attr in [ "name","pathlen","totcol","flag","bevresol","resolu","resolv","width","ext1","ext2","loc","rot","size"]:
- value = eval("cur.%s"%attr)
- exec("cur.%s = value"%attr) \ No newline at end of file
diff --git a/source/blender/python/api2_2x/doc/testeffect.py b/source/blender/python/api2_2x/doc/testeffect.py
deleted file mode 100644
index 5d9b65c36be..00000000000
--- a/source/blender/python/api2_2x/doc/testeffect.py
+++ /dev/null
@@ -1,65 +0,0 @@
-import Blender
-
-################## WARNING ########################
-#
-# this script tests the Effect module, and its submodules : Wave, Build and Particle
-# an object name "Plane" must be created, with three effects attached to it.
-# the first effect must be a "Build" effect
-# the second effect must be a "Wave" effect
-# the third effect must be a "Particle" effect
-#
-########################################################
-
-
-
-effect = Blender.Effect.New()
-print effect
-
-
-
-build = Blender.Effect.Get('Plane',0)
-
-
-for param in ['Type','Flag','Len','Sfra'] :
- value = eval("build.get%s()"%param)
- print param,value
- value1 = eval("build.set%s(%s)"%(param,value))
- print value1
-
-for param in ["sfra","len"]:
- str = "build.%s"%param
- value = eval(str)
- print str,value
- exec("build.%s = value"%param)
-
-
-
-wave = Blender.Effect.Get('Plane',1)
-for param in ['Type','Flag','Startx','Starty','Height', 'Width', 'Narrow', 'Speed', 'Minfac', 'Damp', 'Timeoffs' ,'Lifetime'] :
- value = eval("wave.get%s()"%param)
- print param,value
- value1 = eval("wave.set%s(%s)"%(param,value))
- print value1
-
-
-for param in ["lifetime","timeoffs","damp","minfac","speed","narrow","width","height","startx","starty"]:
- str = "wave.%s"%param
- value = eval(str)
- print str,value
- exec("wave.%s = value"%param)
-
-
-
-
-particle = Blender.Effect.Get('Plane',2)
-for param in ['Type','Flag','StartTime','EndTime','Lifetime','Normfac','Obfac','Randfac','Texfac','Randlife','Nabla','Totpart','Totkey','Seed','Force','Mult','Life','Child','Mat','Defvec'] :
- value = eval("particle.get%s()"%param)
- print param,value
- value1 = eval("particle.set%s(%s)"%(param,value))
- print value1
-
-for param in ['seed','nabla','sta','end','lifetime','normfac','obfac','randfac','texfac','randlife','vectsize','totpart','force','mult','life','child','mat','defvec']:
- str = "particle.%s"%param
- value = eval(str)
- print str,value
- exec("particle.%s = value"%param) \ No newline at end of file
diff --git a/source/blender/python/api2_2x/doc/testipo.py b/source/blender/python/api2_2x/doc/testipo.py
deleted file mode 100644
index 89db92f03c2..00000000000
--- a/source/blender/python/api2_2x/doc/testipo.py
+++ /dev/null
@@ -1,24 +0,0 @@
-import Blender
-
-ipo = Blender.Ipo.Get()
-print "Available ipos : ",ipo
-
-ipo = Blender.Ipo.Get('ObIpo')# hope there is an ipo named "ObIpo"...
-
-
-for prop in ["Name","Blocktype","Showkey","Pad","Rctf"]:
- val = eval("ipo.get%s()"%prop)
- print prop,"-->",val
- #exec("ipo.set%s(%s)"%(prop,val))
-
-try :
- val = ipo.getCurveBP(0)
- print "CurveBP -->",val
-except : print "error BP"
-val = ipo.getNcurves()
-print "NCurves -->",val
-
-curvebeztriple = ipo.getCurveBeztriple(0,0)
-print "curvebeztriple",curvebeztriple
-ipo.setCurveBeztriple(0,0,[1,2,3,4,5,6,7,8,9])
-print ipo.getCurveBeztriple(0,0)
diff --git a/source/blender/python/api2_2x/doc/testmball.py b/source/blender/python/api2_2x/doc/testmball.py
deleted file mode 100644
index 41c8377193f..00000000000
--- a/source/blender/python/api2_2x/doc/testmball.py
+++ /dev/null
@@ -1,37 +0,0 @@
-import Blender
-
-
-
-
-d = Blender.Metaball.Get('Meta')
-
-for prop in ["Name","Wiresize","Thresh","Rendersize","loc","rot","size"]:
- str = "d.get%s()"%prop
- val = eval(str)
- print str,"-->",val
- str1 = "d.set%s(%s)"%(prop,repr(val))
- val1 = eval(str1)
- print str1,"-->",val1
-
-
-
-nelem = d.getNMetaElems()
-print "getNMetaElems",nelem
-
-
-for prop in ['lay','type','selcol','flag','pad','x','y','z','expx','expy','expz','rad','rad2','s','len','maxrad2']:
- str = "d.getMeta%s(0)"%prop
- value = eval(str)
- print str,"-->",value
- str1 = "d.setMeta%s(0,%s)"%(prop,repr(value))
- value1 = eval(str1)
- print str1,"-->",value1
-print;print
-
-for field in ["name","loc","rot","size"]:
- str = "d.%s"%field
- val = eval(str)
- print str,"-->",val
- exec("d.%s = val"%field)
-
-
diff --git a/source/blender/python/api2_2x/doc/testtext.py b/source/blender/python/api2_2x/doc/testtext.py
deleted file mode 100644
index 3e3fd1a5b01..00000000000
--- a/source/blender/python/api2_2x/doc/testtext.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# Test Blender.Text
-
-import Blender
-from Blender import Text
-
-txt = Text.New("MyText")
-all_texts = Text.Get()
-
-for i in [1,4,7]:
- txt.write("%d\n%d\n%d little indians\n" % (i, i+1, i+2))
-
-x = txt.getNLines()
-
-txt.write("%d little indian boys!" % x)
-
-lines = txt.asLines()
-
-txt.clear()
-txt.write("... Yo-ho-ho! And a bottle of rum!")
-
-for s in lines:
- print s
-
-print all_texts
-print txt.asLines()
-
-Text.unlink(txt)
-
-print all_texts
diff --git a/source/blender/python/api2_2x/doc/testworld.py b/source/blender/python/api2_2x/doc/testworld.py
deleted file mode 100644
index 171855f66c9..00000000000
--- a/source/blender/python/api2_2x/doc/testworld.py
+++ /dev/null
@@ -1,21 +0,0 @@
-import Blender
-#testfile
-list = Blender.World.Get()
-print "available worlds",list
-
-w = Blender.World.Get("World")
-
-for param in ["Name","Colormodel","Fastcol","Skytype","Mode","Totex","Texact","Mistype","Hor","Zen","Amb","Star","Dof","Mist"]:
- val = eval("w.get%s()"%param)
- print param,val
- val1 = eval("w.set%s(val)"%param)
- print val1
-
-
-for param in ["name","colormodel","fastcol","skytype","mode","totex","texact","mistype","hor","zen","amb","star","dof","mist"]:
- exec("val = w.%s"%param)
- print param,val
- exec ("w.%s = val"%param)
-
-
-
diff --git a/source/blender/python/api2_2x/euler.c b/source/blender/python/api2_2x/euler.c
deleted file mode 100644
index acbc2b4e680..00000000000
--- a/source/blender/python/api2_2x/euler.c
+++ /dev/null
@@ -1,502 +0,0 @@
-/*
- * $Id: euler.c 12314 2007-10-20 20:24:09Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- *
- * Contributor(s): Joseph Gilbert
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include "Mathutils.h"
-
-#include "BLI_arithb.h"
-#include "BKE_utildefines.h"
-#include "BLI_blenlib.h"
-#include "gen_utils.h"
-
-
-//-------------------------DOC STRINGS ---------------------------
-char Euler_Zero_doc[] = "() - set all values in the euler to 0";
-char Euler_Unique_doc[] ="() - sets the euler rotation a unique shortest arc rotation - tests for gimbal lock";
-char Euler_ToMatrix_doc[] = "() - returns a rotation matrix representing the euler rotation";
-char Euler_ToQuat_doc[] = "() - returns a quaternion representing the euler rotation";
-char Euler_Rotate_doc[] = "() - rotate a euler by certain amount around an axis of rotation";
-char Euler_copy_doc[] = "() - returns a copy of the euler.";
-//-----------------------METHOD DEFINITIONS ----------------------
-struct PyMethodDef Euler_methods[] = {
- {"zero", (PyCFunction) Euler_Zero, METH_NOARGS, Euler_Zero_doc},
- {"unique", (PyCFunction) Euler_Unique, METH_NOARGS, Euler_Unique_doc},
- {"toMatrix", (PyCFunction) Euler_ToMatrix, METH_NOARGS, Euler_ToMatrix_doc},
- {"toQuat", (PyCFunction) Euler_ToQuat, METH_NOARGS, Euler_ToQuat_doc},
- {"rotate", (PyCFunction) Euler_Rotate, METH_VARARGS, Euler_Rotate_doc},
- {"__copy__", (PyCFunction) Euler_copy, METH_VARARGS, Euler_copy_doc},
- {"copy", (PyCFunction) Euler_copy, METH_VARARGS, Euler_copy_doc},
- {NULL, NULL, 0, NULL}
-};
-//-----------------------------METHODS----------------------------
-//----------------------------Euler.toQuat()----------------------
-//return a quaternion representation of the euler
-PyObject *Euler_ToQuat(EulerObject * self)
-{
- float eul[3], quat[4];
- int x;
-
- for(x = 0; x < 3; x++) {
- eul[x] = self->eul[x] * ((float)Py_PI / 180);
- }
- EulToQuat(eul, quat);
- return newQuaternionObject(quat, Py_NEW);
-}
-//----------------------------Euler.toMatrix()---------------------
-//return a matrix representation of the euler
-PyObject *Euler_ToMatrix(EulerObject * self)
-{
- float eul[3];
- float mat[9] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
- int x;
-
- for(x = 0; x < 3; x++) {
- eul[x] = self->eul[x] * ((float)Py_PI / 180);
- }
- EulToMat3(eul, (float (*)[3]) mat);
- return newMatrixObject(mat, 3, 3 , Py_NEW);
-}
-//----------------------------Euler.unique()-----------------------
-//sets the x,y,z values to a unique euler rotation
-PyObject *Euler_Unique(EulerObject * self)
-{
- double heading, pitch, bank;
- double pi2 = Py_PI * 2.0f;
- double piO2 = Py_PI / 2.0f;
- double Opi2 = 1.0f / pi2;
-
- //radians
- heading = self->eul[0] * (float)Py_PI / 180;
- pitch = self->eul[1] * (float)Py_PI / 180;
- bank = self->eul[2] * (float)Py_PI / 180;
-
- //wrap heading in +180 / -180
- pitch += Py_PI;
- pitch -= floor(pitch * Opi2) * pi2;
- pitch -= Py_PI;
-
-
- if(pitch < -piO2) {
- pitch = -Py_PI - pitch;
- heading += Py_PI;
- bank += Py_PI;
- } else if(pitch > piO2) {
- pitch = Py_PI - pitch;
- heading += Py_PI;
- bank += Py_PI;
- }
- //gimbal lock test
- if(fabs(pitch) > piO2 - 1e-4) {
- heading += bank;
- bank = 0.0f;
- } else {
- bank += Py_PI;
- bank -= (floor(bank * Opi2)) * pi2;
- bank -= Py_PI;
- }
-
- heading += Py_PI;
- heading -= (floor(heading * Opi2)) * pi2;
- heading -= Py_PI;
-
- //back to degrees
- self->eul[0] = (float)(heading * 180 / (float)Py_PI);
- self->eul[1] = (float)(pitch * 180 / (float)Py_PI);
- self->eul[2] = (float)(bank * 180 / (float)Py_PI);
-
- return EXPP_incr_ret((PyObject*)self);
-}
-//----------------------------Euler.zero()-------------------------
-//sets the euler to 0,0,0
-PyObject *Euler_Zero(EulerObject * self)
-{
- self->eul[0] = 0.0;
- self->eul[1] = 0.0;
- self->eul[2] = 0.0;
-
- return EXPP_incr_ret((PyObject*)self);
-}
-//----------------------------Euler.rotate()-----------------------
-//rotates a euler a certain amount and returns the result
-//should return a unique euler rotation (i.e. no 720 degree pitches :)
-PyObject *Euler_Rotate(EulerObject * self, PyObject *args)
-{
- float angle = 0.0f;
- char *axis;
- int x;
-
- if(!PyArg_ParseTuple(args, "fs", &angle, &axis)){
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "euler.rotate():expected angle (float) and axis (x,y,z)");
- }
- if(!STREQ3(axis,"x","y","z")){
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "euler.rotate(): expected axis to be 'x', 'y' or 'z'");
- }
-
- //covert to radians
- angle *= ((float)Py_PI / 180);
- for(x = 0; x < 3; x++) {
- self->eul[x] *= ((float)Py_PI / 180);
- }
- euler_rot(self->eul, angle, *axis);
- //convert back from radians
- for(x = 0; x < 3; x++) {
- self->eul[x] *= (180 / (float)Py_PI);
- }
-
- return EXPP_incr_ret((PyObject*)self);
-}
-//----------------------------Euler.rotate()-----------------------
-// return a copy of the euler
-PyObject *Euler_copy(EulerObject * self, PyObject *args)
-{
- return newEulerObject(self->eul, Py_NEW);
-}
-
-
-//----------------------------dealloc()(internal) ------------------
-//free the py_object
-static void Euler_dealloc(EulerObject * self)
-{
- //only free py_data
- if(self->data.py_data){
- PyMem_Free(self->data.py_data);
- }
- PyObject_DEL(self);
-}
-//----------------------------getattr()(internal) ------------------
-//object.attribute access (get)
-static PyObject *Euler_getattr(EulerObject * self, char *name)
-{
- if(STREQ(name,"x")){
- return PyFloat_FromDouble(self->eul[0]);
- }else if(STREQ(name, "y")){
- return PyFloat_FromDouble(self->eul[1]);
- }else if(STREQ(name, "z")){
- return PyFloat_FromDouble(self->eul[2]);
- }
- if(STREQ(name, "wrapped")){
- if(self->wrapped == Py_WRAP)
- return EXPP_incr_ret((PyObject *)Py_True);
- else
- return EXPP_incr_ret((PyObject *)Py_False);
- }
- return Py_FindMethod(Euler_methods, (PyObject *) self, name);
-}
-//----------------------------setattr()(internal) ------------------
-//object.attribute access (set)
-static int Euler_setattr(EulerObject * self, char *name, PyObject * e)
-{
- PyObject *f = NULL;
-
- f = PyNumber_Float(e);
- if(f == NULL) { // parsed item not a number
- return EXPP_ReturnIntError(PyExc_TypeError,
- "euler.attribute = x: argument not a number\n");
- }
-
- if(STREQ(name,"x")){
- self->eul[0] = (float)PyFloat_AS_DOUBLE(f);
- }else if(STREQ(name, "y")){
- self->eul[1] = (float)PyFloat_AS_DOUBLE(f);
- }else if(STREQ(name, "z")){
- self->eul[2] = (float)PyFloat_AS_DOUBLE(f);
- }else{
- Py_DECREF(f);
- return EXPP_ReturnIntError(PyExc_AttributeError,
- "euler.attribute = x: unknown attribute\n");
- }
-
- Py_DECREF(f);
- return 0;
-}
-//----------------------------print object (internal)--------------
-//print the object to screen
-static PyObject *Euler_repr(EulerObject * self)
-{
- int i;
- char buffer[48], str[1024];
-
- BLI_strncpy(str,"[",1024);
- for(i = 0; i < 3; i++){
- if(i < (2)){
- sprintf(buffer, "%.6f, ", self->eul[i]);
- strcat(str,buffer);
- }else{
- sprintf(buffer, "%.6f", self->eul[i]);
- strcat(str,buffer);
- }
- }
- strcat(str, "](euler)");
-
- return PyString_FromString(str);
-}
-//------------------------tp_richcmpr
-//returns -1 execption, 0 false, 1 true
-static PyObject* Euler_richcmpr(PyObject *objectA, PyObject *objectB, int comparison_type)
-{
- EulerObject *eulA = NULL, *eulB = NULL;
- int result = 0;
-
- if (!EulerObject_Check(objectA) || !EulerObject_Check(objectB)){
- if (comparison_type == Py_NE){
- return EXPP_incr_ret(Py_True);
- }else{
- return EXPP_incr_ret(Py_False);
- }
- }
- eulA = (EulerObject*)objectA;
- eulB = (EulerObject*)objectB;
-
- switch (comparison_type){
- case Py_EQ:
- result = EXPP_VectorsAreEqual(eulA->eul, eulB->eul, 3, 1);
- break;
- case Py_NE:
- result = EXPP_VectorsAreEqual(eulA->eul, eulB->eul, 3, 1);
- if (result == 0){
- result = 1;
- }else{
- result = 0;
- }
- break;
- default:
- printf("The result of the comparison could not be evaluated");
- break;
- }
- if (result == 1){
- return EXPP_incr_ret(Py_True);
- }else{
- return EXPP_incr_ret(Py_False);
- }
-}
-//------------------------tp_doc
-static char EulerObject_doc[] = "This is a wrapper for euler objects.";
-//---------------------SEQUENCE PROTOCOLS------------------------
-//----------------------------len(object)------------------------
-//sequence length
-static int Euler_len(EulerObject * self)
-{
- return 3;
-}
-//----------------------------object[]---------------------------
-//sequence accessor (get)
-static PyObject *Euler_item(EulerObject * self, int i)
-{
- if(i < 0 || i >= 3)
- return EXPP_ReturnPyObjError(PyExc_IndexError,
- "euler[attribute]: array index out of range\n");
-
- return PyFloat_FromDouble(self->eul[i]);
-
-}
-//----------------------------object[]-------------------------
-//sequence accessor (set)
-static int Euler_ass_item(EulerObject * self, int i, PyObject * ob)
-{
- PyObject *f = NULL;
-
- f = PyNumber_Float(ob);
- if(f == NULL) { // parsed item not a number
- return EXPP_ReturnIntError(PyExc_TypeError,
- "euler[attribute] = x: argument not a number\n");
- }
-
- if(i < 0 || i >= 3){
- Py_DECREF(f);
- return EXPP_ReturnIntError(PyExc_IndexError,
- "euler[attribute] = x: array assignment index out of range\n");
- }
- self->eul[i] = (float)PyFloat_AS_DOUBLE(f);
- Py_DECREF(f);
- return 0;
-}
-//----------------------------object[z:y]------------------------
-//sequence slice (get)
-static PyObject *Euler_slice(EulerObject * self, int begin, int end)
-{
- PyObject *list = NULL;
- int count;
-
- CLAMP(begin, 0, 3);
- if (end<0) end= 4+end;
- CLAMP(end, 0, 3);
- begin = MIN2(begin,end);
-
- list = PyList_New(end - begin);
- for(count = begin; count < end; count++) {
- PyList_SetItem(list, count - begin,
- PyFloat_FromDouble(self->eul[count]));
- }
-
- return list;
-}
-//----------------------------object[z:y]------------------------
-//sequence slice (set)
-static int Euler_ass_slice(EulerObject * self, int begin, int end,
- PyObject * seq)
-{
- int i, y, size = 0;
- float eul[3];
- PyObject *e, *f;
-
- CLAMP(begin, 0, 3);
- if (end<0) end= 4+end;
- CLAMP(end, 0, 3);
- begin = MIN2(begin,end);
-
- size = PySequence_Length(seq);
- if(size != (end - begin)){
- return EXPP_ReturnIntError(PyExc_TypeError,
- "euler[begin:end] = []: size mismatch in slice assignment\n");
- }
-
- for (i = 0; i < size; i++) {
- e = PySequence_GetItem(seq, i);
- if (e == NULL) { // Failed to read sequence
- return EXPP_ReturnIntError(PyExc_RuntimeError,
- "euler[begin:end] = []: unable to read sequence\n");
- }
-
- f = PyNumber_Float(e);
- if(f == NULL) { // parsed item not a number
- Py_DECREF(e);
- return EXPP_ReturnIntError(PyExc_TypeError,
- "euler[begin:end] = []: sequence argument not a number\n");
- }
-
- eul[i] = (float)PyFloat_AS_DOUBLE(f);
- EXPP_decr2(f,e);
- }
- //parsed well - now set in vector
- for(y = 0; y < 3; y++){
- self->eul[begin + y] = eul[y];
- }
- return 0;
-}
-//-----------------PROTCOL DECLARATIONS--------------------------
-static PySequenceMethods Euler_SeqMethods = {
- (inquiry) Euler_len, /* sq_length */
- (binaryfunc) 0, /* sq_concat */
- (intargfunc) 0, /* sq_repeat */
- (intargfunc) Euler_item, /* sq_item */
- (intintargfunc) Euler_slice, /* sq_slice */
- (intobjargproc) Euler_ass_item, /* sq_ass_item */
- (intintobjargproc) Euler_ass_slice, /* sq_ass_slice */
-};
-//------------------PY_OBECT DEFINITION--------------------------
-PyTypeObject euler_Type = {
- PyObject_HEAD_INIT(NULL) //tp_head
- 0, //tp_internal
- "euler", //tp_name
- sizeof(EulerObject), //tp_basicsize
- 0, //tp_itemsize
- (destructor)Euler_dealloc, //tp_dealloc
- 0, //tp_print
- (getattrfunc)Euler_getattr, //tp_getattr
- (setattrfunc) Euler_setattr, //tp_setattr
- 0, //tp_compare
- (reprfunc) Euler_repr, //tp_repr
- 0, //tp_as_number
- &Euler_SeqMethods, //tp_as_sequence
- 0, //tp_as_mapping
- 0, //tp_hash
- 0, //tp_call
- 0, //tp_str
- 0, //tp_getattro
- 0, //tp_setattro
- 0, //tp_as_buffer
- Py_TPFLAGS_DEFAULT, //tp_flags
- EulerObject_doc, //tp_doc
- 0, //tp_traverse
- 0, //tp_clear
- (richcmpfunc)Euler_richcmpr, //tp_richcompare
- 0, //tp_weaklistoffset
- 0, //tp_iter
- 0, //tp_iternext
- 0, //tp_methods
- 0, //tp_members
- 0, //tp_getset
- 0, //tp_base
- 0, //tp_dict
- 0, //tp_descr_get
- 0, //tp_descr_set
- 0, //tp_dictoffset
- 0, //tp_init
- 0, //tp_alloc
- 0, //tp_new
- 0, //tp_free
- 0, //tp_is_gc
- 0, //tp_bases
- 0, //tp_mro
- 0, //tp_cache
- 0, //tp_subclasses
- 0, //tp_weaklist
- 0 //tp_del
-};
-//------------------------newEulerObject (internal)-------------
-//creates a new euler object
-/*pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER
- (i.e. it was allocated elsewhere by MEM_mallocN())
- pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON
- (i.e. it must be created here with PyMEM_malloc())*/
-PyObject *newEulerObject(float *eul, int type)
-{
- EulerObject *self;
- int x;
-
- self = PyObject_NEW(EulerObject, &euler_Type);
- self->data.blend_data = NULL;
- self->data.py_data = NULL;
-
- if(type == Py_WRAP){
- self->data.blend_data = eul;
- self->eul = self->data.blend_data;
- self->wrapped = Py_WRAP;
- }else if (type == Py_NEW){
- self->data.py_data = PyMem_Malloc(3 * sizeof(float));
- self->eul = self->data.py_data;
- if(!eul) { //new empty
- for(x = 0; x < 3; x++) {
- self->eul[x] = 0.0f;
- }
- }else{
- for(x = 0; x < 3; x++){
- self->eul[x] = eul[x];
- }
- }
- self->wrapped = Py_NEW;
- }else{ //bad type
- return NULL;
- }
- return (PyObject *) self;
-}
-
diff --git a/source/blender/python/api2_2x/euler.h b/source/blender/python/api2_2x/euler.h
deleted file mode 100644
index d992d61b402..00000000000
--- a/source/blender/python/api2_2x/euler.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * $Id: euler.h 8367 2006-08-22 09:13:44Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joseph Gilbert
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- *
- */
-
-#ifndef EXPP_euler_h
-#define EXPP_euler_h
-
-#include <Python.h>
-
-extern PyTypeObject euler_Type;
-
-#define EulerObject_Check(v) ((v)->ob_type == &euler_Type)
-
-typedef struct {
- PyObject_VAR_HEAD
- struct{
- float *py_data; //python managed
- float *blend_data; //blender managed
- }data;
- float *eul; //1D array of data (alias)
- int wrapped; //is wrapped data?
-} EulerObject;
-
-/*struct data contains a pointer to the actual data that the
-object uses. It can use either PyMem allocated data (which will
-be stored in py_data) or be a wrapper for data allocated through
-blender (stored in blend_data). This is an either/or struct not both*/
-
-//prototypes
-PyObject *Euler_Zero( EulerObject * self );
-PyObject *Euler_Unique( EulerObject * self );
-PyObject *Euler_ToMatrix( EulerObject * self );
-PyObject *Euler_ToQuat( EulerObject * self );
-PyObject *Euler_Rotate( EulerObject * self, PyObject *args );
-PyObject *Euler_copy( EulerObject * self, PyObject *args );
-PyObject *newEulerObject( float *eul, int type );
-
-#endif /* EXPP_euler_h */
diff --git a/source/blender/python/api2_2x/gen_library.c b/source/blender/python/api2_2x/gen_library.c
deleted file mode 100644
index 8673fefdbb5..00000000000
--- a/source/blender/python/api2_2x/gen_library.c
+++ /dev/null
@@ -1,332 +0,0 @@
-#include "gen_library.h"
-#include "gen_utils.h" /*This must come first*/
-
-/* use for GenericLib_getProperties */
-#include "BKE_idprop.h"
-#include "IDProp.h"
-
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_library.h"
-#include "BKE_curve.h"
-
-/* GenericLib */
-#include "World.h"
-#include "Font.h"
-#include "Metaball.h"
-#include "Curve.h"
-#include "Camera.h"
-#include "NLA.h"
-#include "Lattice.h"
-#include "Armature.h"
-#include "Lamp.h"
-#include "Text.h"
-#include "Text3d.h"
-#include "Sound.h"
-#include "Scene.h"
-#include "Mesh.h"
-#include "Group.h"
-#include "Object.h"
-#include "Texture.h"
-#include "Ipo.h"
-#include "DNA_object_types.h"
-#include "DNA_ipo_types.h"
-
-
-/* Generic get/set attrs */
-PyObject *GenericLib_getName( void *self )
-{
- ID *id = ((BPy_GenericLib *)self)->id;
- if (!id) return ( EXPP_ReturnPyObjError( PyExc_RuntimeError, "data has been removed" ) );
- return PyString_FromString( id->name + 2 );
-}
-
-int GenericLib_setName( void *self, PyObject *value )
-{
- ID *id = ((BPy_GenericLib *)self)->id;
- char *name = NULL;
- if (!id) return ( EXPP_ReturnIntError( PyExc_RuntimeError, "data has been removed" ) );
-
- name = PyString_AsString ( value );
- if( !name )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected string argument" );
-
- rename_id( id, name );
-
- return 0;
-}
-
-PyObject *GenericLib_getFakeUser( void *self )
-{
- ID *id = ((BPy_GenericLib *)self)->id;
- if (!id) return ( EXPP_ReturnPyObjError( PyExc_RuntimeError, "data has been removed" ) );
- if (id->flag & LIB_FAKEUSER)
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
-}
-
-int GenericLib_setFakeUser( void *self, PyObject *value )
-{
- int param;
- ID *id = ((BPy_GenericLib *)self)->id;
- if (!id) return ( EXPP_ReturnIntError( PyExc_RuntimeError, "data has been removed" ) );
-
- param = PyObject_IsTrue( value );
- if( param == -1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected True/False or 0/1" );
-
- if (param) {
- if (!(id->flag & LIB_FAKEUSER)) {
- id->flag |= LIB_FAKEUSER;
- id_us_plus(id);
- }
- } else {
- if (id->flag & LIB_FAKEUSER) {
- id->flag &= ~LIB_FAKEUSER;
- id->us--;
- }
- }
- return 0;
-}
-
-PyObject *GenericLib_getTag( void *self )
-{
- ID *id = ((BPy_GenericLib *)self)->id;
- if (!id) return ( EXPP_ReturnPyObjError( PyExc_RuntimeError, "data has been removed" ) );
- if (id->flag & LIB_DOIT)
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
-}
-
-int GenericLib_setTag( void *self, PyObject *value )
-{
- int param;
- ID *id = ((BPy_GenericLib *)self)->id;
- if (!id) return ( EXPP_ReturnIntError( PyExc_RuntimeError, "data has been removed" ) );
-
- param = PyObject_IsTrue( value );
- if( param == -1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected int argument in range [0,1]" );
-
- if (param)
- id->flag |= LIB_DOIT;
- else
- id->flag &= ~LIB_DOIT;
- return 0;
-}
-
-
-/* read only */
-PyObject *GenericLib_getLib( void *self )
-{
- ID *id = ((BPy_GenericLib *)self)->id;
- if (!id) return ( EXPP_ReturnPyObjError( PyExc_RuntimeError, "data has been removed" ) );
-
- if (id->lib)
- return PyString_FromString(id->lib->name);
- else
- return EXPP_incr_ret( Py_None );
-}
-
-PyObject *GenericLib_getUsers( void *self )
-{
- ID *id = ((BPy_GenericLib *)self)->id;
- if (!id) return ( EXPP_ReturnPyObjError( PyExc_RuntimeError, "data has been removed" ) );
- return PyInt_FromLong(id->us);
-}
-
-PyObject *GenericLib_getProperties( void *self )
-{
- ID *id = ((BPy_GenericLib *)self)->id;
- if (!id) return ( EXPP_ReturnPyObjError( PyExc_RuntimeError, "data has been removed" ) );
- return BPy_Wrap_IDProperty( id, IDP_GetProperties(id, 1), NULL );
-}
-
-/* use for any.setName("name")*/
-PyObject * GenericLib_setName_with_method( void *self, PyObject *args )
-{
- return EXPP_setterWrapper( (void *)self, args, (setter)GenericLib_setName );
-}
-
-
-/*
- * returns the Blender lib type code from a PyObject
- * -1 for no match, only give this function libdata
- *
- * At the moment this is only used by GenericLib_assignData
- * so not all types are needed.
- */
-short GenericLib_getType(PyObject * pydata)
-{
- //~ if (BPy_Scene_Check(pydata)) return ID_SCE;
- if (BPy_Object_Check(pydata)) return ID_OB;
- if (BPy_Mesh_Check(pydata)) return ID_ME;
- //~ if (BPy_Curve_Check(pydata)) return ID_CU;
- //~ if (BPy_Metaball_Check(pydata)) return ID_MB;
- //~ if (BPy_Material_Check(pydata)) return ID_MA;
- if (BPy_Texture_Check(pydata)) return ID_TE;
- //~ if (BPy_Image_Check(pydata)) return ID_IM;
- //~ //if (BPy_Lattice_Check(pydata)) return ID_LT;
- //~ if (BPy_Lamp_Check(pydata)) return ID_LA;
- //~ if (BPy_Camera_Check(pydata)) return ID_CA;
- if (BPy_Ipo_Check(pydata)) return ID_IP;
- if (BPy_World_Check(pydata)) return ID_WO;
- //~ //if (BPy_Font_Check(pydata)) return ID_VF;
- //~ if (BPy_Text_Check(pydata)) return ID_TXT;
- //~ if (BPy_Sound_Check(pydata)) return ID_SO;
- if (BPy_Group_Check(pydata)) return ID_GR;
- //~ if (BPy_Armature_Check(pydata)) return ID_AR;
- if (BPy_Action_Check(pydata)) return ID_AC;
-
- return -1;
-}
-
-
-/*
- * This function is used to assign a PyObject representing
- * blender libdata to a pointer.
- *
- * Python examples of this are...
- * ob.DupGroup = dupliGroup
- * mesh.texMesh = texme
- * ob.ipo = None
- *
- * This function deals with type checking, data usercounts,
- * and raising errors.
- *
- * value - python value
- * data - Blender pointer to assign value to
- * ndata - Use this if there is a value data cannot be.
- * for instance, a curve's curve modifier cant point to its self.
- * refcount - non zero values will modify blenders user count.
- * type - ID type.
- * subtype - used only for objects and IPO's to stop the wrong types of obs/ipos
- * being assigned.
- *
- */
-int GenericLib_assignData(PyObject *value, void **data, void **ndata, short refcount, short type, short subtype)
-{
- ID *id= NULL;
-
- if (*data) {
- id = ((ID*)*data);
-
- if (ndata && *data == *ndata) {
- return EXPP_ReturnIntError( PyExc_TypeError,
- "Cannot set this data to its self" );
- }
- }
-
- if (value == Py_None) {
- *data = NULL;
- if (refcount && id) id->us--;
- } else if (GenericLib_getType(value) == type) {
-
- /* object subtypes */
- if (subtype != 0) {
- if (type == ID_OB) {
- Object *ob= (Object *)(((BPy_GenericLib *)value)->id);
- if (ob->type != subtype)
- return EXPP_ReturnIntError( PyExc_TypeError,
- "Object type not supported" );
- }
-
- if (type == ID_IP) {
- Ipo *ipo = (Ipo *)(((BPy_GenericLib *)value)->id);
- if (ipo->blocktype != subtype)
- return EXPP_ReturnIntError( PyExc_TypeError,
- "Ipo type does is not compatible" );
- }
-
-
- }
- if (refcount && id) id->us--;
- id = ((BPy_GenericLib *)value)->id;
- id->us++;
- *data = id;
- } else {
- return EXPP_ReturnIntError( PyExc_TypeError,
- "Could not assign Python Type - None or Library Object" );
- }
- return 0;
-}
-
-
-/*
- * returns the ID of the object with given name
- * from a given list.
- */
-ID *GetIdFromList( ListBase * list, char *name )
-{
- ID *id = list->first;
-
- while( id ) {
- if( strcmp( name, id->name + 2 ) == 0 )
- break;
- id = id->next;
- }
-
- return id;
-}
-
-
-PyObject *GetPyObjectFromID( ID * id )
-{
- switch ( MAKE_ID2( id->name[0], id->name[1] ) ) {
- case ID_SCE:
- return Scene_CreatePyObject( ( Scene *) id );
- case ID_OB:
- return Object_CreatePyObject( (Object *) id );
- case ID_ME:
- return Mesh_CreatePyObject( (Mesh *)id, NULL );
- case ID_CU:
- switch (curve_type((Curve *)id)) {
- case OB_FONT:
- return Text3d_CreatePyObject( (Text3d *)id );
- default:
- return Curve_CreatePyObject( (Curve *)id );
- }
- case ID_MB:
- return Metaball_CreatePyObject((MetaBall *)id);
- case ID_MA:
- return Material_CreatePyObject((Material *)id);
- case ID_TE:
- return Texture_CreatePyObject((Tex *)id);
- case ID_IM:
- return Image_CreatePyObject((Image *)id);
- case ID_LT:
- return Lattice_CreatePyObject((Lattice *)id);
- case ID_LA:
- return Lamp_CreatePyObject((Lamp *)id);
- case ID_CA:
- return Camera_CreatePyObject((Camera *)id);
- case ID_IP:
- return Ipo_CreatePyObject((Ipo *)id);
- case ID_WO:
- return World_CreatePyObject((World *)id);
- case ID_VF:
- return Font_CreatePyObject((VFont *)id);
- case ID_TXT:
- return Text_CreatePyObject((Text *)id);
- case ID_SO:
- return Sound_CreatePyObject((bSound *)id);
- case ID_GR:
- return Group_CreatePyObject((Group *)id);
- case ID_AR:
- return Armature_CreatePyObject((bArmature *)id);
- case ID_AC:
- return Action_CreatePyObject((bAction *)id);
- }
- Py_RETURN_NONE;
-}
-
-long GenericLib_hash(BPy_GenericLib * pydata)
-{
- return (long)pydata->id;
-}
-
diff --git a/source/blender/python/api2_2x/gen_library.h b/source/blender/python/api2_2x/gen_library.h
deleted file mode 100644
index ea182ad1a29..00000000000
--- a/source/blender/python/api2_2x/gen_library.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * $Id: gen_library.h 11877 2007-08-29 03:09:22Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Michel Selten, Willian P. Germano, Alex Mole, Joseph Gilbert
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_gen_library_h
-#define EXPP_gen_library_h
-
-#include <Python.h>
-
-#include "DNA_ID.h"
-#include "DNA_listBase.h"
-
-/* ID functions for all libdata */
-#define GENERIC_LIB_GETSETATTR \
- {"name",\
- (getter)GenericLib_getName, (setter)GenericLib_setName,\
- "name",\
- NULL},\
- {"lib",\
- (getter)GenericLib_getLib, (setter)NULL,\
- "external library path",\
- NULL},\
- {"users",\
- (getter)GenericLib_getUsers, (setter)NULL,\
- "user count",\
- NULL},\
- {"fakeUser",\
- (getter)GenericLib_getFakeUser, (setter)GenericLib_setFakeUser,\
- "fake user state",\
- NULL},\
- {"properties",\
- (getter)GenericLib_getProperties, (setter)NULL,\
- "properties",\
- NULL},\
- {"tag",\
- (getter)GenericLib_getTag, (setter)GenericLib_setTag,\
- "temproary tag",\
- NULL}
-
-/* Dummy struct for getting the ID from a libdata BPyObject */
-typedef struct {
- PyObject_HEAD /* required python macro */
- ID *id;
-} BPy_GenericLib;
-
-int GenericLib_setName( void *self, PyObject *value );
-PyObject *GenericLib_getName( void *self );
-PyObject *GenericLib_getFakeUser( void *self );
-int GenericLib_setFakeUser( void *self, PyObject *value );
-PyObject *GenericLib_getTag( void *self );
-int GenericLib_setTag( void *self, PyObject *value );
-PyObject *GenericLib_getLib( void *self );
-PyObject *GenericLib_getUsers( void *self );
-PyObject *GenericLib_getProperties( void *self );
-
-/* use this for oldstyle somedata.getName("name") */
-PyObject * GenericLib_setName_with_method( void *self, PyObject *value );
-
-int GenericLib_assignData(PyObject *value, void **data, void **ndata, short refcount, short type, short subtype);
-short GenericLib_getType(PyObject * pydata);
-
-/* Other ID functions */
-ID *GetIdFromList( ListBase * list, char *name );
-PyObject *GetPyObjectFromID( ID * id );
-long GenericLib_hash(BPy_GenericLib * pydata);
-#endif /* EXPP_gen_library_h */
diff --git a/source/blender/python/api2_2x/gen_utils.c b/source/blender/python/api2_2x/gen_utils.c
deleted file mode 100644
index f05be1ba68b..00000000000
--- a/source/blender/python/api2_2x/gen_utils.c
+++ /dev/null
@@ -1,948 +0,0 @@
-/*
- * $Id: gen_utils.c 11932 2007-09-03 17:28:50Z stiv $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Michel Selten, Willian P. Germano, Alex Mole, Ken Hughes,
- * Campbell Barton
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#include "gen_utils.h" /*This must come first*/
-
-#include "DNA_text_types.h"
-#include "MEM_guardedalloc.h"
-#include "BLI_blenlib.h"
-#include "BIF_space.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_library.h"
-
-#include "Mathutils.h"
-
-#include "constant.h"
-
-/*---------------------- EXPP_FloatsAreEqual -------------------------
- Floating point comparisons
- floatStep = number of representable floats allowable in between
- float A and float B to be considered equal. */
-int EXPP_FloatsAreEqual(float A, float B, int floatSteps)
-{
- int a, b, delta;
- assert(floatSteps > 0 && floatSteps < (4 * 1024 * 1024));
- a = *(int*)&A;
- if (a < 0)
- a = 0x80000000 - a;
- b = *(int*)&B;
- if (b < 0)
- b = 0x80000000 - b;
- delta = abs(a - b);
- if (delta <= floatSteps)
- return 1;
- return 0;
-}
-/*---------------------- EXPP_VectorsAreEqual -------------------------
- Builds on EXPP_FloatsAreEqual to test vectors */
-int EXPP_VectorsAreEqual(float *vecA, float *vecB, int size, int floatSteps){
-
- int x;
- for (x=0; x< size; x++){
- if (EXPP_FloatsAreEqual(vecA[x], vecB[x], floatSteps) == 0)
- return 0;
- }
- return 1;
-}
-/*---------------------- EXPP_GetModuleConstant -------------------------
- Helper function for returning a module constant */
-PyObject *EXPP_GetModuleConstant(char *module, char *constant)
-{
- PyObject *py_module = NULL, *py_dict = NULL, *py_constant = NULL;
-
- /*Careful to pass the correct Package.Module string here or
- * else you add a empty module somewhere*/
- py_module = PyImport_AddModule(module);
- if(!py_module){ /*null = error returning module*/
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "error encountered with returning module constant..." ) );
- }
- py_dict = PyModule_GetDict(py_module); /*never fails*/
-
- py_constant = PyDict_GetItemString(py_dict, constant);
- if(!py_constant){ /*null = key not found*/
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "error encountered with returning module constant..." ) );
- }
-
- return EXPP_incr_ret(py_constant);
-}
-
-/*****************************************************************************/
-/* Description: This function clamps an int to the given interval */
-/* [min, max]. */
-/*****************************************************************************/
-int EXPP_ClampInt( int value, int min, int max )
-{
- if( value < min )
- return min;
- else if( value > max )
- return max;
- return value;
-}
-
-/*****************************************************************************/
-/* Description: This function clamps a float to the given interval */
-/* [min, max]. */
-/*****************************************************************************/
-float EXPP_ClampFloat( float value, float min, float max )
-{
- if( value < min )
- return min;
- else if( value > max )
- return max;
- return value;
-}
-
-/*****************************************************************************/
-/* Description: This function returns true if both given strings are equal, */
-/* otherwise it returns false. */
-/*****************************************************************************/
-int StringEqual( const char *string1, const char *string2 )
-{
- return ( strcmp( string1, string2 ) == 0 );
-}
-
-
-/*****************************************************************************/
-/* Description: These functions set an internal string with the given type */
-/* and error_msg arguments. */
-/*****************************************************************************/
-
-PyObject *EXPP_ReturnPyObjError( PyObject * type, char *error_msg )
-{ /* same as above, just to change its name smoothly */
- PyErr_SetString( type, error_msg );
- return NULL;
-}
-
-int EXPP_ReturnIntError( PyObject * type, char *error_msg )
-{
- PyErr_SetString( type, error_msg );
- return -1;
-}
-
-int EXPP_intError(PyObject *type, const char *format, ...)
-{
- PyObject *error;
- va_list vlist;
-
- va_start(vlist, format);
- error = PyString_FromFormatV(format, vlist);
- va_end(vlist);
-
- PyErr_SetObject(type, error);
- Py_DECREF(error);
- return -1;
-}
-/*Like EXPP_ReturnPyObjError but takes a printf format string and multiple arguments*/
-PyObject *EXPP_objError(PyObject *type, const char *format, ...)
-{
- PyObject *error;
- va_list vlist;
-
- va_start(vlist, format);
- error = PyString_FromFormatV(format, vlist);
- va_end(vlist);
-
- PyErr_SetObject(type, error);
- Py_DECREF(error);
- return NULL;
-}
-
-/*****************************************************************************/
-/* Description: This function increments the reference count of the given */
-/* Python object (usually Py_None) and returns it. */
-/*****************************************************************************/
-
-PyObject *EXPP_incr_ret( PyObject * object )
-{
- Py_INCREF( object );
- return ( object );
-}
-
-/* return Py_False - to avoid warnings, we use the fact that
- * 0 == False in Python: */
-PyObject *EXPP_incr_ret_False()
-{
- return Py_BuildValue("i", 0);
-}
-
-/* return Py_True - to avoid warnings, we use the fact that
- * 1 == True in Python: */
-PyObject *EXPP_incr_ret_True()
-{
- return Py_BuildValue("i", 1);
-}
-
-void EXPP_incr2( PyObject * ob1, PyObject * ob2 )
-{
- Py_INCREF( ob1 );
- Py_INCREF( ob2 );
-}
-
-void EXPP_incr3( PyObject * ob1, PyObject * ob2, PyObject * ob3 )
-{
- Py_INCREF( ob1 );
- Py_INCREF( ob2 );
- Py_INCREF( ob3 );
-}
-
-void EXPP_decr2( PyObject * ob1, PyObject * ob2 )
-{
- Py_DECREF( ob1 );
- Py_DECREF( ob2 );
-}
-
-void EXPP_decr3( PyObject * ob1, PyObject * ob2, PyObject * ob3 )
-{
- Py_DECREF( ob1 );
- Py_DECREF( ob2 );
- Py_DECREF( ob3 );
-}
-/*****************************************************************************/
-/* Description: This function maps the event identifier to a string. */
-/*****************************************************************************/
-char *event_to_name( short event )
-{
- switch ( event ) {
- case SCRIPT_FRAMECHANGED:
- return "FrameChanged";
- case SCRIPT_ONLOAD:
- return "OnLoad";
- case SCRIPT_ONSAVE:
- return "OnSave";
- case SCRIPT_REDRAW:
- return "Redraw";
- case SCRIPT_RENDER:
- return "Render";
- case SCRIPT_POSTRENDER:
- return "PostRender";
- default:
- return "Unknown";
- }
-}
-
-/*****************************************************************************/
-/* Description: Checks whether all objects in a PySequence are of a same */
-/* given type. Returns 0 if not, 1 on success. */
-/*****************************************************************************/
-int EXPP_check_sequence_consistency( PyObject * seq, PyTypeObject * against )
-{
- PyObject *ob;
- int len = PySequence_Length( seq );
- int i, result = 1;
-
- for( i = 0; i < len; i++ ) {
- ob = PySequence_GetItem( seq, i );
- if( ob == Py_None )
- result = 2;
- else if( ob->ob_type != against ) {
- Py_DECREF( ob );
- return 0;
- }
- Py_DECREF( ob );
- }
- return result; /* 1 if all of 'against' type, 2 if there are (also) Nones */
-}
-
-PyObject *EXPP_tuple_repr( PyObject * self, int size )
-{
- PyObject *repr, *item;
- int i;
-
-/*@ note: a value must be built because the list is decrefed!
- * otherwise we have nirvana pointers inside python.. */
-
- repr = PyString_FromString( "" );
- if( !repr )
- return 0;
-
- item = PySequence_GetItem( self, 0 );
- PyString_ConcatAndDel( &repr, PyObject_Repr( item ) );
- Py_DECREF( item );
-
- for( i = 1; i < size; i++ ) {
- item = PySequence_GetItem( self, i );
- PyString_ConcatAndDel( &repr, PyObject_Repr( item ) );
- Py_DECREF( item );
- }
-
- return repr;
-}
-
-/****************************************************************************/
-/* Description: searches through a map for a pair with a given name. If the */
-/* pair is present, its ival is stored in *ival and nonzero is */
-/* returned. If the pair is absent, zero is returned. */
-/****************************************************************************/
-int EXPP_map_getIntVal( const EXPP_map_pair * map, const char *sval,
- int *ival )
-{
- while( map->sval ) {
- if( StringEqual( sval, map->sval ) ) {
- *ival = map->ival;
- return 1;
- }
- ++map;
- }
- return 0;
-}
-
-/* same as above, but string case is ignored */
-int EXPP_map_case_getIntVal( const EXPP_map_pair * map, const char *sval,
- int *ival )
-{
- while( map->sval ) {
- if( !BLI_strcasecmp( sval, map->sval ) ) {
- *ival = map->ival;
- return 1;
- }
- ++map;
- }
- return 0;
-}
-
-/****************************************************************************/
-/* Description: searches through a map for a pair with a given name. If the */
-/* pair is present, its ival is stored in *ival and nonzero is */
-/* returned. If the pair is absent, zero is returned. */
-/* note: this function is identical to EXPP_map_getIntVal except that the */
-/* output is stored in a short value. */
-/****************************************************************************/
-int EXPP_map_getShortVal( const EXPP_map_pair * map,
- const char *sval, short *ival )
-{
- while( map->sval ) {
- if( StringEqual( sval, map->sval ) ) {
- *ival = (short)map->ival;
- return 1;
- }
- ++map;
- }
- return 0;
-}
-
-/****************************************************************************/
-/* Description: searches through a map for a pair with a given ival. If the */
-/* pair is present, a pointer to its name is stored in *sval */
-/* and nonzero is returned. If the pair is absent, zero is */
-/* returned. */
-/****************************************************************************/
-int EXPP_map_getStrVal( const EXPP_map_pair * map, int ival,
- const char **sval )
-{
- while( map->sval ) {
- if( ival == map->ival ) {
- *sval = map->sval;
- return 1;
- }
- ++map;
- }
- return 0;
-}
-
-/* Redraw wrappers */
-
-/* this queues redraws if we're not in background mode: */
-void EXPP_allqueue(unsigned short event, short val)
-{
- if (!G.background) allqueue(event, val);
-}
-
-/************************************************************************/
-/* Scriptlink-related functions, used by scene, object, etc. bpyobjects */
-/************************************************************************/
-PyObject *EXPP_getScriptLinks( ScriptLink * slink, PyObject * value,
- int is_scene )
-{
- PyObject *list = NULL, *tmpstr;
- char *eventname = PyString_AsString(value);
- int i, event = 0;
-
-
- if( !eventname )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected event name (string) as argument" );
-
- list = PyList_New( 0 );
- if( !list )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create PyList!" );
-
- /* actually !scriptlink shouldn't happen ... */
- if( !slink || !slink->totscript )
- return list;
-
- if( !strcmp( eventname, "FrameChanged" ) )
- event = SCRIPT_FRAMECHANGED;
- else if( !strcmp( eventname, "Redraw" ) )
- event = SCRIPT_REDRAW;
- else if( !strcmp( eventname, "Render" ) )
- event = SCRIPT_RENDER;
- else if( is_scene && !strcmp( eventname, "OnLoad" ) )
- event = SCRIPT_ONLOAD;
- else if( is_scene && !strcmp( eventname, "OnSave" ) )
- event = SCRIPT_ONSAVE;
- else {
- Py_DECREF(list);
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "invalid event name" );
- }
-
- for( i = 0; i < slink->totscript; i++ ) {
- if( ( slink->flag[i] == event ) && slink->scripts[i] ) {
- tmpstr =PyString_FromString( slink->scripts[i]->name + 2 );
- PyList_Append( list, tmpstr );
- Py_DECREF(tmpstr);
- }
- }
-
- return list;
-}
-
-PyObject *EXPP_clearScriptLinks( ScriptLink * slink, PyObject * args )
-{
- int i, j, totLinks, deleted = 0;
- PyObject *seq = NULL;
- ID **stmp = NULL;
- short *ftmp = NULL;
-
- /* check for an optional list of strings */
- if( !PyArg_ParseTuple( args, "|O", &seq ) )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError,
- "expected no arguments or a list of strings" ) );
-
-
- /* if there was a parameter, handle it */
- if ( seq != NULL ) {
- /* check that parameter IS list of strings */
- if ( !PyList_Check ( seq ) )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError,
- "expected a list of strings" ) );
-
- totLinks = PyList_Size ( seq );
- for ( i = 0 ; i < totLinks ; ++i ) {
- if ( !PyString_Check ( PySequence_GetItem( seq, i ) ) )
- return ( EXPP_ReturnPyObjError
- ( PyExc_TypeError,
- "expected list to contain strings" ) );
- }
-
- /*
- parameters OK: now look for each script, and delete
- its link as we find it (this handles multiple links)
- */
- for ( i = 0 ; i < totLinks ; ++i )
- {
- char *str;
- str = PyString_AsString ( PySequence_GetItem( seq, i ) );
- for ( j = 0 ; j < slink->totscript ; ++j ) {
- if ( slink->scripts[j] && !strcmp( slink->scripts[j]->name+2, str ) )
- slink->scripts[j] = NULL;
- if( !slink->scripts[j] )
- ++deleted;
- }
- }
- }
- /* if no parameter, then delete all scripts */
- else {
- deleted = slink->totscript;
- }
-
- /*
- if not all scripts deleted, create new lists and copy remaining
- links to them
- */
-
- if ( slink->totscript > deleted ) {
- slink->totscript = slink->totscript - (short)deleted;
-
- stmp = slink->scripts;
- slink->scripts =
- MEM_mallocN( sizeof( ID * ) * ( slink->totscript ),
- "bpySlinkL" );
-
- ftmp = slink->flag;
- slink->flag =
- MEM_mallocN( sizeof( short * ) * ( slink->totscript ),
- "bpySlinkF" );
-
- for ( i = 0, j = 0 ; i < slink->totscript ; ++j ) {
- if ( stmp[j] != NULL ) {
- memcpy( slink->scripts+i, stmp+j, sizeof( ID * ) );
- memcpy( slink->flag+i, ftmp+j, sizeof( short ) );
- ++i;
- }
- }
- MEM_freeN( stmp );
- MEM_freeN( ftmp );
-
- /*EXPP_allqueue (REDRAWBUTSSCRIPT, 0 );*/
- slink->actscript = 1;
- } else {
-
- /* all scripts deleted, so delete entire list and free memory */
-
- if( slink->scripts )
- MEM_freeN( slink->scripts );
- if( slink->flag )
- MEM_freeN( slink->flag );
-
- slink->scripts = NULL;
- slink->flag = NULL;
- slink->totscript = slink->actscript = 0;
- }
-
- return EXPP_incr_ret( Py_None );
-}
-
-
-PyObject *EXPP_addScriptLink(ScriptLink *slink, PyObject *args, int is_scene)
-{
- int event = 0, found_txt = 0;
- void *stmp = NULL, *ftmp = NULL;
- Text *bltxt = G.main->text.first;
- char *textname = NULL;
- char *eventname = NULL;
-
- /* !scriptlink shouldn't happen ... */
- if( !slink ) {
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "internal error: no scriptlink!" );
- }
-
- if( !PyArg_ParseTuple( args, "ss", &textname, &eventname ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected two strings as arguments" );
-
- while( bltxt ) {
- if( !strcmp( bltxt->id.name + 2, textname ) ) {
- found_txt = 1;
- break;
- }
- bltxt = bltxt->id.next;
- }
-
- if( !found_txt )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "no such Blender Text" );
-
- if( !strcmp( eventname, "FrameChanged" ) )
- event = SCRIPT_FRAMECHANGED;
- else if( !strcmp( eventname, "Redraw" ) )
- event = SCRIPT_REDRAW;
- else if( !strcmp( eventname, "Render" ) )
- event = SCRIPT_RENDER;
- else if( is_scene && !strcmp( eventname, "OnLoad" ) )
- event = SCRIPT_ONLOAD;
- else if( is_scene && !strcmp( eventname, "OnSave" ) )
- event = SCRIPT_ONSAVE;
- else
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "invalid event name" );
-
- stmp = slink->scripts;
- slink->scripts =
- MEM_mallocN( sizeof( ID * ) * ( slink->totscript + 1 ),
- "bpySlinkL" );
-
- ftmp = slink->flag;
- slink->flag =
- MEM_mallocN( sizeof( short * ) * ( slink->totscript + 1 ),
- "bpySlinkF" );
-
- if( slink->totscript ) {
- memcpy( slink->scripts, stmp,
- sizeof( ID * ) * ( slink->totscript ) );
- MEM_freeN( stmp );
-
- memcpy( slink->flag, ftmp,
- sizeof( short ) * ( slink->totscript ) );
- MEM_freeN( ftmp );
- }
-
- slink->scripts[slink->totscript] = ( ID * ) bltxt;
- slink->flag[slink->totscript] = (short)event;
-
- slink->totscript++;
-
- if( slink->actscript < 1 )
- slink->actscript = 1;
-
- return EXPP_incr_ret (Py_None); /* normal exit */
-}
-
-/*
- * Utility routines to clamp and store various datatypes. The object type
- * is checked and a exception is raised if it's not the correct type.
- *
- * Inputs:
- * value: PyObject containing the new value
- * param: pointer to destination variable
- * max, min: range of values for clamping
- * type: kind of pointer and data (uses the same characters as
- * PyArgs_ParseTuple() and Py_BuildValue()
- *
- * Return 0 on success, -1 on error.
- */
-
-int EXPP_setFloatClamped( PyObject *value, float *param,
- float min, float max )
-{
- if( !PyNumber_Check ( value ) ) {
- char errstr[128];
- sprintf ( errstr, "expected float argument in [%f,%f]", min, max );
- return EXPP_ReturnIntError( PyExc_TypeError, errstr );
- }
-
- *param = EXPP_ClampFloat( (float)PyFloat_AsDouble( value ), min, max );
-
- return 0;
-}
-
-int EXPP_setIValueClamped( PyObject *value, void *param,
- int min, int max, char type )
-{
- int number;
-
- if( !PyInt_Check( value ) ) {
- char errstr[128];
- sprintf ( errstr, "expected int argument in [%d,%d]", min, max );
- return EXPP_ReturnIntError( PyExc_TypeError, errstr );
- }
-
- number = PyInt_AS_LONG( value );
-
- switch ( type ) {
- case 'b':
- *(char *)param = (char)EXPP_ClampInt( number, min, max );
- return 0;
- case 'h':
- *(short *)param = (short)EXPP_ClampInt( number, min, max );
- return 0;
- case 'H':
- *(unsigned short *)param = (unsigned short)EXPP_ClampInt( number, min, max );
- return 0;
- case 'i':
- *(int *)param = EXPP_ClampInt( number, min, max );
- return 0;
- default:
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "EXPP_setIValueClamped(): invalid type code" );
- }
-}
-
-int EXPP_setVec3Clamped( PyObject *value, float *param,
- float min, float max )
-{
- if( VectorObject_Check( value ) ) {
- VectorObject *vect = (VectorObject *)value;
- if( vect->size == 3 ) {
- param[0] = EXPP_ClampFloat( vect->vec[0], min, max );
- param[1] = EXPP_ClampFloat( vect->vec[1], min, max );
- param[2] = EXPP_ClampFloat( vect->vec[2], min, max );
- return 0;
- }
- }
-
- if (1) {
- char errstr[128];
- sprintf ( errstr, "expected vector argument in [%f,%f]", min, max );
- return EXPP_ReturnIntError( PyExc_TypeError, errstr );
- }
-}
-
-
-/*
- * Utility routines to range-check and store various datatypes. The object
- * type is checked and a exception is raised if it's not the correct type.
- * An exception is also raised if the value lies outside of the specified
- * range.
- *
- * Inputs:
- * value: PyObject containing the new value
- * param: pointer to destination variable
- * max, min: valid range for value
- * type: kind of pointer and data (uses the same characters as
- * PyArgs_ParseTuple() and Py_BuildValue()
- *
- * Return 0 on success, -1 on error.
- */
-
-int EXPP_setFloatRange( PyObject *value, float *param,
- float min, float max )
-{
- char errstr[128];
- float number;
-
- sprintf ( errstr, "expected int argument in [%f,%f]", min, max );
-
- if( !PyNumber_Check ( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError, errstr );
-
- number = (float)PyFloat_AsDouble( value );
- if ( number < min || number > max )
- return EXPP_ReturnIntError( PyExc_ValueError, errstr );
-
- *param = number;
- return 0;
-}
-
-int EXPP_setIValueRange( PyObject *value, void *param,
- int min, int max, char type )
-{
- char errstr[128];
- int number;
-
- sprintf ( errstr, "expected int argument in [%d,%d]", min, max );
-
- if( !PyInt_Check ( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError, errstr );
-
- number = PyInt_AS_LONG( value );
- if( number < min || number > max )
- return EXPP_ReturnIntError( PyExc_ValueError, errstr );
-
- switch ( type ) {
- case 'b':
- *(char *)param = (char)number;
- return 0;
- case 'h':
- *(short *)param = (short)number;
- return 0;
- case 'H':
- *(unsigned short *)param = (unsigned short)number;
- return 0;
- case 'i':
- *(int *)param = number;
- return 0;
- default:
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "EXPP_setIValueRange(): invalid type code" );
- }
-}
-
-/*
- * Utility routines to handle all attribute setters which use module
- * constants. Generic pointer to destination variable is used, and typecast
- * to the appropriate type based on the "type" specifier.
- *
- * Inputs:
- * constant: constant_Type value
- * param: pointer to destination variable
- * type: kind of pointer and data
- *
- * Return 0 on success, -1 on error.
- */
-
-int EXPP_setModuleConstant ( BPy_constant *constant, void *param, char type )
-{
- PyObject *item;
-
- if( constant->ob_type != &constant_Type )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected module constant" );
-
- item = PyDict_GetItemString( constant->dict, "value" );
- if( !item )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "module constant has no \"value\" key" );
-
- switch ( type ) {
- case 'h':
- *(short *)param = (short)PyInt_AS_LONG( item );
- return 0;
- case 'i':
- *(int *)param = PyInt_AS_LONG( item );
- return 0;
- case 'f':
- *(float *)param = (float)PyFloat_AS_DOUBLE( item );
- Py_DECREF(item); /* line above increfs */
- return 0;
- default:
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "EXPP_setModuleConstant(): invalid type code" );
- }
-}
-
-/*
- * Utility routines to get/set bits in bitfields. Adapted from code in
- * sceneRender.c (thanks, ascotan!).
- *
- * Inputs:
- * param: pointer to source/destination variable
- * setting: the bit to get/set
- * type: pointer type ('h' == short, 'i' == integer)
- */
-
-PyObject *EXPP_getBitfield( void *param, int setting, char type )
-{
- switch ( type ) {
- case 'b':
- return (*(char *)param & setting)
- ? EXPP_incr_ret_True() : EXPP_incr_ret_False();
- case 'h':
- return (*(short *)param & setting)
- ? EXPP_incr_ret_True() : EXPP_incr_ret_False();
- case 'i':
- return (*(int *)param & setting)
- ? EXPP_incr_ret_True() : EXPP_incr_ret_False();
- default:
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "EXPP_getBit(): invalid type code" );
- }
-}
-
-int EXPP_setBitfield( PyObject * value, void *param, int setting, char type )
-{
- int param_bool = PyObject_IsTrue( value );
-
- if( param_bool == -1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected True/False or 0/1" );
-
- switch ( type ) {
- case 'b':
- if ( param_bool )
- *(char *)param |= setting;
- else
- *(char *)param &= ~setting;
- return 0;
- case 'h':
- if ( param_bool )
- *(short *)param |= setting;
- else
- *(short *)param &= ~setting;
- return 0;
- case 'i':
- if ( param_bool )
- *(int *)param |= setting;
- else
- *(int *)param &= ~setting;
- return 0;
- default:
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "EXPP_setBit(): invalid type code" );
- }
-}
-
-/*
- * Procedure to handle older setStuff() methods. Assumes that argument
- * is a tuple with one object, and so grabs the object and passes it to
- * the specified tp_getset setter for the corresponding attribute.
- */
-
-PyObject *EXPP_setterWrapper ( PyObject * self, PyObject * args,
- setter func)
-{
- int error;
-
- if ( !PyTuple_Check( args ) || PyTuple_Size( args ) != 1 )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "expected tuple of one item" );
-
- error = func ( self, PyTuple_GET_ITEM( args, 0 ), NULL );
- if ( !error ) {
- Py_INCREF( Py_None );
- return Py_None;
- } else
- return NULL;
-}
-
-/*
- * Procedure to handle older setStuff() methods. Assumes that argument
- * is a tuple, so just passes it to the specified tp_getset setter for
- * the corresponding attribute.
- */
-
-PyObject *EXPP_setterWrapperTuple ( PyObject * self, PyObject * args,
- setter func)
-{
- int error;
-
- if ( !PyTuple_Check( args ) )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "expected tuple" );
-
- error = func ( self, args, NULL );
- if ( !error ) {
- Py_INCREF( Py_None );
- return Py_None;
- } else
- return NULL;
-}
-
-/*
- * Helper to keep dictionaries from causing memory leaks. When some object
- * is just created to be added to the dictionary, its reference count needs
- * to be decremented so it can be reclaimed.
- */
-
-int EXPP_dict_set_item_str( PyObject *dict, char *key, PyObject *value)
-{
- /* add value to dictionary */
- int ret = PyDict_SetItemString(dict, key, value);
- Py_DECREF( value ); /* delete original */
- return ret;
-}
-
-/*
- * Helper function for subtypes that what the base types methods.
- * The command below needs to have args modified to have 'self' added at the start
- * ret = PyObject_Call(PyDict_GetItemString(PyList_Type.tp_dict, "sort"), newargs, keywds);
- *
- * This is not easy with the python API so adding a function here,
- * remember to Py_DECREF the tuple after
- */
-
-PyObject * EXPP_PyTuple_New_Prepend(PyObject *tuple, PyObject *value)
-{
- PyObject *item;
- PyObject *new_tuple;
- int i;
-
- i = PyTuple_Size(tuple);
- new_tuple = PyTuple_New(i+1);
- PyTuple_SetItem(new_tuple, 0, value);
- Py_INCREF(value);
- while (i) {
- i--;
- item = PyTuple_GetItem(tuple, i);
- PyTuple_SetItem(new_tuple, i+1, item);
- Py_INCREF(item);
- }
- return new_tuple;
-}
diff --git a/source/blender/python/api2_2x/gen_utils.h b/source/blender/python/api2_2x/gen_utils.h
deleted file mode 100644
index 3ff1517b86c..00000000000
--- a/source/blender/python/api2_2x/gen_utils.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * $Id: gen_utils.h 11732 2007-08-20 10:08:59Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Michel Selten, Willian P. Germano, Alex Mole, Joseph Gilbert
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_gen_utils_h
-#define EXPP_gen_utils_h
-
-#include <Python.h>
-#include "DNA_ID.h"
-#include "DNA_scriptlink_types.h"
-#include "DNA_listBase.h"
-
-#include "constant.h"
-
-#define Py_PI 3.14159265358979323846
-#define Py_WRAP 1024
-#define Py_NEW 2048
-
-/*
- Py_RETURN_NONE
- Python 2.4 macro.
- defined here until we switch to 2.4
-*/
-#ifndef Py_RETURN_NONE
-#define Py_RETURN_NONE return Py_BuildValue("O", Py_None)
-#endif
-#ifndef Py_RETURN_FALSE
-#define Py_RETURN_FALSE return PyBool_FromLong(0)
-#endif
-#ifndef Py_RETURN_TRUE
-#define Py_RETURN_TRUE return PyBool_FromLong(1)
-#endif
-
-/* Py 2.5 adds a new Py_ssize_t type for 64 bit support */
-/* #if'ed for your compiling pleasure */
-#if 1
-
-/* for pre Py 2.5 */
-#if PY_VERSION_HEX < 0x02050000
-typedef int Py_ssize_t;
-#define PY_SSIZE_T_MAX INT_MAX
-#define PY_SSIZE_T_MIN INT_MIN
-#else
-/* Py 2.5 and later */
-#define intargfunc ssizeargfunc
-#define intintargfunc ssizessizeargfunc
-#endif
-
-#endif
-
-/* name of list of Armature weak refs built into __main__ */
-#define ARM_WEAKREF_LIST_NAME "__arm_weakrefs"
-
-int EXPP_FloatsAreEqual(float A, float B, int floatSteps);
-int EXPP_VectorsAreEqual(float *vecA, float *vecB, int size, int floatSteps);
-
-PyObject *EXPP_GetModuleConstant(char *module, char *constant);
-
-int StringEqual( const char *string1, const char *string2 );
-
-PyObject *PythonReturnErrorObject( PyObject * type, char *error_msg );
-PyObject *PythonIncRef( PyObject * object );
-
-char *event_to_name( short event );
-
-float EXPP_ClampFloat( float value, float min, float max );
-int EXPP_ClampInt( int value, int min, int max );
-
-void EXPP_incr2( PyObject * ob1, PyObject * ob2 );
-void EXPP_incr3( PyObject * ob1, PyObject * ob2, PyObject * ob3 );
-void EXPP_decr2( PyObject * ob1, PyObject * ob2 );
-void EXPP_decr3( PyObject * ob1, PyObject * ob2, PyObject * ob3 );
-PyObject *EXPP_incr_ret( PyObject * object );
-PyObject *EXPP_incr_ret_True(void);
-PyObject *EXPP_incr_ret_False(void);
-PyObject *EXPP_ReturnPyObjError( PyObject * type, char *error_msg );
-int EXPP_ReturnIntError( PyObject * type, char *error_msg );
-
-PyObject *EXPP_objError(PyObject *type, const char *format, ...);
-int EXPP_intError(PyObject *type, const char *format, ...);
-
-int EXPP_check_sequence_consistency( PyObject * seq, PyTypeObject * against );
-PyObject *EXPP_tuple_repr( PyObject * self, int size );
-
-/* mapping utilities - see Texture.c for an example of how to use these */
-typedef struct {
- const char *sval;
- int ival;
-} EXPP_map_pair;
-
-/* maps must end with a pair that has NULL as sval */
-int EXPP_map_getIntVal( const EXPP_map_pair * map,
- const char *sval, int *ival );
-int EXPP_map_case_getIntVal( const EXPP_map_pair * map,
- const char *sval, int *ival );
-int EXPP_map_getShortVal( const EXPP_map_pair * map,
- const char *sval, short *ival );
-int EXPP_map_getStrVal( const EXPP_map_pair * map,
- int ival, const char **sval );
-
-/* clamping and range-checking utilities */
-
-int EXPP_setIValueClamped( PyObject *value, void *param,
- int min, int max, char type );
-int EXPP_setFloatClamped ( PyObject *value, float *param,
- float min, float max);
-int EXPP_setVec3Clamped ( PyObject *value, float *param,
- float min, float max);
-int EXPP_setIValueRange( PyObject *value, void *param,
- int min, int max, char type );
-int EXPP_setFloatRange ( PyObject *value, float *param,
- float min, float max);
-
-/* utility routine for PyType attributes setters with module constant */
-
-int EXPP_setModuleConstant ( BPy_constant *constant, void *param,
- char type );
-
-/* utilities to get/set bits in bitfields */
-
-PyObject *EXPP_getBitfield( void *param, int setting, char type );
-int EXPP_setBitfield( PyObject * value, void *param, int setting, char type );
-
-/*
- * Procedures to handle older setStuff() methods, which now access
- * a PyType's setter attributes using the tp_getset mechanism.
- */
-
-PyObject *EXPP_setterWrapper ( PyObject * self, PyObject * args,
- setter func);
-
-PyObject *EXPP_setterWrapperTuple ( PyObject * self, PyObject * args,
- setter func);
-
-/* scriplinks-related: */
-PyObject *EXPP_getScriptLinks(ScriptLink *slink, PyObject *value, int is_scene);
-PyObject *EXPP_addScriptLink(ScriptLink *slink, PyObject *args, int is_scene);
-PyObject *EXPP_clearScriptLinks(ScriptLink *slink, PyObject *args);
-
-/* this queues redraws if we're not in background mode: */
-void EXPP_allqueue(unsigned short event, short val);
-
-/* helper to keep dictionaries from causing memory leaks */
-int EXPP_dict_set_item_str( PyObject *dict, char *key, PyObject *value);
-PyObject * EXPP_PyTuple_New_Prepend(PyObject *tuple, PyObject *value);
-
-#endif /* EXPP_gen_utils_h */
-
diff --git a/source/blender/python/api2_2x/logic.c b/source/blender/python/api2_2x/logic.c
deleted file mode 100644
index 6e0813be8f3..00000000000
--- a/source/blender/python/api2_2x/logic.c
+++ /dev/null
@@ -1,529 +0,0 @@
-/*
- * $Id: logic.c 11123 2007-06-29 08:59:26Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Joseph Gilbert
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#include "logic.h" /*This must come first*/
-
-#include "MEM_guardedalloc.h"
-#include "BLI_blenlib.h"
-#include "gen_utils.h"
-
-//--------------- Python BPy_Property methods declarations:---------------
-static PyObject *Property_getName( BPy_Property * self );
-static PyObject *Property_setName( BPy_Property * self, PyObject * value );
-static PyObject *Property_getData( BPy_Property * self );
-static PyObject *Property_setData( BPy_Property * self, PyObject * args );
-static PyObject *Property_getType( BPy_Property * self );
-//--------------- Python BPy_Property methods table:----------------------
-static PyMethodDef BPy_Property_methods[] = {
- {"getName", ( PyCFunction ) Property_getName, METH_NOARGS,
- "() - return Property name"},
- {"setName", ( PyCFunction ) Property_setName, METH_O,
- "() - set the name of this Property"},
- {"getData", ( PyCFunction ) Property_getData, METH_NOARGS,
- "() - return Property data"},
- {"setData", ( PyCFunction ) Property_setData, METH_VARARGS,
- "() - set the data of this Property"},
- {"getType", ( PyCFunction ) Property_getType, METH_NOARGS,
- "() - return Property type"},
- {NULL, NULL, 0, NULL}
-};
-//--------------- Python TypeProperty callback function prototypes--------
-static void Property_dealloc( BPy_Property * Property );
-static PyObject *Property_getAttr( BPy_Property * Property, char *name );
-static int Property_setAttr( BPy_Property * Property, char *name,
- PyObject * v );
-static PyObject *Property_repr( BPy_Property * Property );
-static int Property_compare( BPy_Property * a1, BPy_Property * a2 );
-//--------------- Python TypeProperty structure definition----------------
-PyTypeObject property_Type = {
- PyObject_HEAD_INIT( NULL )
- 0, /* ob_size */
- "Blender Property", /* tp_name */
- sizeof( BPy_Property ), /* tp_basicsize */
- 0, /* tp_itemsize */
- /* methods */
- ( destructor ) Property_dealloc, /* tp_dealloc */
- 0, /* tp_print */
- ( getattrfunc ) Property_getAttr, /* tp_getattr */
- ( setattrfunc ) Property_setAttr, /* tp_setattr */
- ( cmpfunc ) Property_compare, /* tp_compare */
- ( reprfunc ) Property_repr, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_as_hash */
- 0, 0, 0, 0, 0, 0,
- 0, /* tp_doc */
- 0, 0, 0, 0, 0, 0,
- BPy_Property_methods, /* tp_methods */
- 0, /* tp_members */
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-};
-//--------------- Property module internal callbacks-------------------
-
-//--------------- updatePyProperty-------------------------------------
-int updatePyProperty( BPy_Property * self )
-{
- if( !self->property ) {
- return 0; //nothing to update - not linked
- } else {
- BLI_strncpy( self->name, self->property->name, 32 );
- self->type = self->property->type;
- if( self->property->type == PROP_BOOL ) {
- if( *( ( int * ) &self->property->poin ) ) {
- self->data = EXPP_incr_ret_True();
- } else {
- self->data = EXPP_incr_ret_False();
- }
- } else if( self->property->type == PROP_INT ) {
- self->data = PyInt_FromLong( self->property->data );
- } else if( self->property->type == PROP_FLOAT ) {
- self->data =
- PyFloat_FromDouble( *
- ( ( float * ) &self->
- property->data ) );
- } else if( self->property->type == PROP_TIME ) {
- self->data =
- PyFloat_FromDouble( *
- ( ( float * ) &self->
- property->data ) );
- } else if( self->property->type == PROP_STRING ) {
- self->data =
- PyString_FromString( self->property->poin );
- }
- return 1;
- }
-}
-
-//--------------- updatePropertyData------------------------------------
-int updateProperyData( BPy_Property * self )
-{
- if( !self->property ) {
- //nothing to update - not linked
- return 0;
- } else {
- BLI_strncpy( self->property->name, self->name, 32 );
- self->property->type = self->type;
- if( PyInt_Check( self->data ) ) {
- *( ( int * ) &self->property->data ) =
- ( int ) PyInt_AsLong( self->data );
- } else if( PyFloat_Check( self->data ) ) {
- *( ( float * ) &self->property->data ) =
- ( float ) PyFloat_AsDouble( self->data );
- } else if( PyString_Check( self->data ) ) {
- BLI_strncpy( self->property->poin,
- PyString_AsString( self->data ),
- MAX_PROPSTRING );
- }
- return 1;
- }
-}
-
-//--------------- checkValidData_ptr--------------------------------
-static int checkValidData_ptr( BPy_Property * self )
-{
- int length;
- /* test pointer to see if data was removed (oops) */
- /* WARNING!!! - MEMORY LEAK HERE, why not free this??? */
- length = MEM_allocN_len( self->property );
- if( length != sizeof( bProperty ) ) { //data was freed
- self->property = NULL;
- return 0;
- } else { //it's ok as far as we can tell
- return 1;
- }
-}
-
-//---------------BPy_Property internal callbacks/methods------------
-
-//--------------- dealloc-------------------------------------------
-static void Property_dealloc( BPy_Property * self )
-{
- PyMem_Free( self->name );
- PyObject_DEL( self );
-}
-
-//---------------getattr--------------------------------------------
-static PyObject *Property_getAttr( BPy_Property * self, char *name )
-{
- checkValidData_ptr( self );
- if( strcmp( name, "name" ) == 0 )
- return Property_getName( self );
- else if( strcmp( name, "data" ) == 0 )
- return Property_getData( self );
- else if( strcmp( name, "type" ) == 0 )
- return Property_getType( self );
- else if( strcmp( name, "__members__" ) == 0 ) {
- return Py_BuildValue( "[s,s,s]", "name", "data", "type" );
- }
-
- return Py_FindMethod( BPy_Property_methods, ( PyObject * ) self, name );
-}
-
-//--------------- setattr-------------------------------------------
-static int
-Property_setAttr( BPy_Property * self, char *name, PyObject * value )
-{
- PyObject *error = NULL;
-
- checkValidData_ptr( self );
-
- if( strcmp( name, "name" ) == 0 ) {
- error = Property_setName( self, value );
- } else if( strcmp( name, "data" ) == 0 ) {
- PyObject *valtuple = Py_BuildValue( "(O)", value );
- if( !valtuple )
- return EXPP_ReturnIntError( PyExc_MemoryError,
- "PropertySetAttr: couldn't create tuple" );
-
- error = Property_setData( self, valtuple );
- Py_DECREF( valtuple );
- } else {
- return ( EXPP_ReturnIntError
- ( PyExc_KeyError, "attribute not found" ) );
- }
-
-
- if( error != Py_None )
- return -1;
-
- Py_DECREF( Py_None );
- return 0;
-}
-
-//--------------- repr----------------------------------------------
-static PyObject *Property_repr( BPy_Property * self )
-{
- checkValidData_ptr( self );
- if( self->property ) {
- return PyString_FromFormat( "[Property \"%s\"]",
- self->property->name );
- } else {
- return PyString_FromFormat( "[Property \"%s\"]", self->name );
- }
-}
-
-//--------------- compare-------------------------------------------
-//compares property.name and property.data
-static int Property_compare( BPy_Property * a, BPy_Property * b )
-{
- BPy_Property *py_propA, *py_propB;
- int retval = -1;
-
- checkValidData_ptr( a );
- checkValidData_ptr( b );
- //2 python objects
- if( !a->property && !b->property ) {
- if( a->type != b->type )
- retval = -1;
- if( BLI_streq( a->name, b->name ) ) {
- retval = PyObject_Compare( a->data, b->data );
- } else
- retval = -1;
- } else if( a->property && b->property ) { //2 real properties
- if( a->property->type != b->property->type )
- retval = -1;
- if( BLI_streq( a->property->name, b->property->name ) ) {
- if( a->property->type == PROP_BOOL
- || a->property->type == PROP_INT ) {
- if( a->property->data == b->property->data )
- retval = 0;
- else
- retval = -1;
- } else if( a->property->type == PROP_FLOAT
- || a->property->type == PROP_TIME ) {
- if( *( ( float * ) &a->property->data ) ==
- *( ( float * ) &b->property->data ) )
- retval = 0;
- else
- retval = -1;
- } else if( a->property->type == PROP_STRING ) {
- if( BLI_streq
- ( a->property->poin, b->property->poin ) )
- retval = 0;
- else
- retval = -1;
- }
- } else
- retval = -1;
- } else { //1 real 1 python
- if( !a->property ) {
- py_propA = a;
- py_propB = b;
- } else {
- py_propA = b;
- py_propB = a;
- }
- if( py_propB->property->type != py_propA->type )
- retval = -1;
- if( BLI_streq( py_propB->property->name, py_propA->name ) ) {
- if( py_propB->property->type == PROP_BOOL ||
- py_propB->property->type == PROP_INT ) {
- retval = PyObject_Compare( py_propA->data,
- PyInt_FromLong
- ( py_propB->
- property->
- data ) );
- } else if( py_propB->property->type == PROP_FLOAT
- || py_propB->property->type == PROP_TIME ) {
- retval = PyObject_Compare( py_propA->data,
- PyFloat_FromDouble
- ( *
- ( ( float * )
- &py_propB->
- property->
- data ) ) );
- } else if( py_propB->property->type == PROP_STRING ) {
- PyObject *tmpstr = PyString_FromString( py_propB->property->poin );
- retval = PyObject_Compare( py_propA->data, tmpstr );
- Py_DECREF(tmpstr);
- }
- } else
- retval = -1;
- }
- return retval;
-}
-
-//--------------- Property visible functions------------------------
-//--------------- Property_CreatePyObject---------------------------
-PyObject *Property_CreatePyObject( struct bProperty * Property )
-{
- BPy_Property *py_property;
-
- py_property =
- ( BPy_Property * ) PyObject_NEW( BPy_Property,
- &property_Type );
-
- //set the struct flag
- py_property->property = Property;
-
- //allocate space for python vars
- py_property->name = PyMem_Malloc( 32 );
-
- if( !updatePyProperty( py_property ) )
- return ( EXPP_ReturnPyObjError
- ( PyExc_AttributeError, "Property struct empty" ) );
-
- return ( ( PyObject * ) py_property );
-}
-
-//--------------- Property_FromPyObject-----------------------------
-struct bProperty *Property_FromPyObject( PyObject * py_obj )
-{
- BPy_Property *py_property;
-
- py_property = ( BPy_Property * ) py_obj;
- if( !py_property->property )
- return NULL;
- else
- return ( py_property->property );
-}
-
-//--------------- newPropertyObject()-------------------------------
-PyObject *newPropertyObject( char *name, PyObject * data, int type )
-{
- BPy_Property *py_property;
-
- py_property =
- ( BPy_Property * ) PyObject_NEW( BPy_Property,
- &property_Type );
- py_property->name = PyMem_Malloc( 32 );
- py_property->property = NULL;
-
- BLI_strncpy( py_property->name, name, 32 );
- py_property->data = data;
- py_property->type = (short)type;
-
- return ( PyObject * ) py_property;
-}
-
-//--------------- Python BPy_Property methods-----------------------
-//--------------- BPy_Property.getName()----------------------------
-static PyObject *Property_getName( BPy_Property * self )
-{
- if( !self->property )
- return PyString_FromString( self->name );
- else
- return PyString_FromString( self->property->name );
-}
-
-//--------------- BPy_Property.setName()----------------------------
-static PyObject *Property_setName( BPy_Property * self, PyObject * value )
-{
- char *name = PyString_AsString(value);
-
- if( !name )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected string argument" ) );
-
- if( !self->property ) {
- BLI_strncpy( self->name, name, 32 );
- } else {
- BLI_strncpy( self->property->name, name, 32 );
- updatePyProperty( self );
- }
-
- Py_RETURN_NONE;
-}
-
-//--------------- BPy_Property.getData()----------------------------
-static PyObject *Property_getData( BPy_Property * self )
-{
- PyObject *attr = NULL;
-
- if( !self->property ) {
- attr = EXPP_incr_ret( self->data );
- } else {
- if( self->property->type == PROP_BOOL ) {
- if( self->property->data )
- attr = EXPP_incr_ret_True();
- else
- attr = EXPP_incr_ret_False();
- } else if( self->property->type == PROP_INT ) {
- attr = PyInt_FromLong( self->property->data );
- } else if( self->property->type == PROP_FLOAT ||
- self->property->type == PROP_TIME ) {
- attr = PyFloat_FromDouble( *
- ( ( float * ) &self->
- property->data ) );
- } else if( self->property->type == PROP_STRING ) {
- attr = PyString_FromString( self->property->poin );
- }
- }
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Property.data attribute" ) );
-}
-
-//--------------- BPy_Property.setData()----------------------------
-static PyObject *Property_setData( BPy_Property * self, PyObject * args )
-{
- PyObject *data;
- char *type_str = NULL;
- int type = -1;
- short *p_type = NULL;
-
- if( !PyArg_ParseTuple( args, "O|s", &data, &type_str ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected object and optional string argument" ) );
-
- if( !PyInt_Check( data ) && !PyFloat_Check( data )
- && !PyString_Check( data ) )
- return ( EXPP_ReturnPyObjError
- ( PyExc_RuntimeError,
- "float, int, or string expected as data" ) );
-
- //parse property name
- if( type_str ) {
- if( BLI_streq( type_str, "BOOL" ) )
- type = PROP_BOOL;
- else if( BLI_streq( type_str, "INT" ) )
- type = PROP_INT;
- else if( BLI_streq( type_str, "FLOAT" ) )
- type = PROP_FLOAT;
- else if( BLI_streq( type_str, "TIME" ) )
- type = PROP_TIME;
- else if( BLI_streq( type_str, "STRING" ) )
- type = PROP_STRING;
- else
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "BOOL, INT, FLOAT, TIME or STRING expected" ) );
- }
- //get pointer to type
- if( self->property )
- p_type = &self->property->type;
- else
- p_type = &self->type;
-
- //set the type
- if( PyInt_Check( data ) ) {
- if( type == -1 || type == PROP_INT )
- *p_type = PROP_INT;
- else
- *p_type = PROP_BOOL;
- } else if( PyFloat_Check( data ) ) {
- if( type == -1 || type == PROP_FLOAT )
- *p_type = PROP_FLOAT;
- else
- *p_type = PROP_TIME;
- } else if( PyString_Check( data ) ) {
- if( type == -1 || type == PROP_STRING )
- *p_type = PROP_STRING;
- } else {
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "cant set unknown data type" ) );
- }
-
- //set the data
- if( self->property ) {
- if( PyInt_Check( data ) ) {
- *( ( int * ) &self->property->data ) =
- ( int ) PyInt_AsLong( data );
- } else if( PyFloat_Check( data ) ) {
- *( ( float * ) &self->property->data ) =
- ( float ) PyFloat_AsDouble( data );
- } else if( PyString_Check( data ) ) {
- BLI_strncpy( self->property->poin,
- PyString_AsString( data ),
- MAX_PROPSTRING );
- }
- updatePyProperty( self );
- } else {
- self->data = data;
- }
- Py_RETURN_NONE;
-}
-
-//--------------- BPy_Property.getType()----------------------------
-static PyObject *Property_getType( BPy_Property * self )
-{
- int type;
-
- if( self->property )
- type = self->property->type;
- else
- type = self->type;
-
- if( type == PROP_BOOL )
- return PyString_FromString( "BOOL" );
- else if( type == PROP_INT )
- return PyString_FromString( "INT" );
- else if( type == PROP_FLOAT )
- return PyString_FromString( "FLOAT" );
- else if( type == PROP_STRING )
- return PyString_FromString( "STRING" );
- else if( type == PROP_TIME )
- return PyString_FromString( "TIME" );
- Py_RETURN_NONE;
-}
diff --git a/source/blender/python/api2_2x/logic.h b/source/blender/python/api2_2x/logic.h
deleted file mode 100644
index ea415d06a0a..00000000000
--- a/source/blender/python/api2_2x/logic.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * $Id: logic.h 10269 2007-03-15 01:09:14Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Joseph Gilbert
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_LOGIC_H
-#define EXPP_LOGIC_H
-
-#include <Python.h>
-#include "DNA_property_types.h"
-
-extern PyTypeObject property_Type;
-
-#define BPy_Property_Check(v) ((v)->ob_type == &property_Type)
-
-//--------------------------Python BPy_Property structure definition.----
-typedef struct {
- PyObject_HEAD
- //reference to property data if object linked
- bProperty * property;
- //list of vars that define the property
- char *name;
- PyObject *data;
- short type;
-} BPy_Property;
-
-//------------------------------visible prototypes-----------------------
-PyObject *Property_CreatePyObject( struct bProperty *prop );
-bProperty *Property_FromPyObject( PyObject * py_obj );
-PyObject *newPropertyObject( char *name, PyObject * data, int type );
-int updatePyProperty( BPy_Property * self );
-int updateProperyData( BPy_Property * self );
-
-#endif
diff --git a/source/blender/python/api2_2x/matrix.c b/source/blender/python/api2_2x/matrix.c
deleted file mode 100644
index d52318e93bf..00000000000
--- a/source/blender/python/api2_2x/matrix.c
+++ /dev/null
@@ -1,975 +0,0 @@
-/*
- * $Id: matrix.c 11958 2007-09-07 07:55:36Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * Contributor(s): Michel Selten & Joseph Gilbert
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include "Mathutils.h"
-
-#include "BKE_utildefines.h"
-#include "BLI_arithb.h"
-#include "BLI_blenlib.h"
-#include "gen_utils.h"
-
-/*-------------------------DOC STRINGS ---------------------------*/
-char Matrix_Zero_doc[] = "() - set all values in the matrix to 0";
-char Matrix_Identity_doc[] = "() - set the square matrix to it's identity matrix";
-char Matrix_Transpose_doc[] = "() - set the matrix to it's transpose";
-char Matrix_Determinant_doc[] = "() - return the determinant of the matrix";
-char Matrix_Invert_doc[] = "() - set the matrix to it's inverse if an inverse is possible";
-char Matrix_TranslationPart_doc[] = "() - return a vector encompassing the translation of the matrix";
-char Matrix_RotationPart_doc[] = "() - return a vector encompassing the rotation of the matrix";
-char Matrix_scalePart_doc[] = "() - convert matrix to a 3D vector";
-char Matrix_Resize4x4_doc[] = "() - resize the matrix to a 4x4 square matrix";
-char Matrix_toEuler_doc[] = "() - convert matrix to a euler angle rotation";
-char Matrix_toQuat_doc[] = "() - convert matrix to a quaternion rotation";
-char Matrix_copy_doc[] = "() - return a copy of the matrix";
-/*-----------------------METHOD DEFINITIONS ----------------------*/
-struct PyMethodDef Matrix_methods[] = {
- {"zero", (PyCFunction) Matrix_Zero, METH_NOARGS, Matrix_Zero_doc},
- {"identity", (PyCFunction) Matrix_Identity, METH_NOARGS, Matrix_Identity_doc},
- {"transpose", (PyCFunction) Matrix_Transpose, METH_NOARGS, Matrix_Transpose_doc},
- {"determinant", (PyCFunction) Matrix_Determinant, METH_NOARGS, Matrix_Determinant_doc},
- {"invert", (PyCFunction) Matrix_Invert, METH_NOARGS, Matrix_Invert_doc},
- {"translationPart", (PyCFunction) Matrix_TranslationPart, METH_NOARGS, Matrix_TranslationPart_doc},
- {"rotationPart", (PyCFunction) Matrix_RotationPart, METH_NOARGS, Matrix_RotationPart_doc},
- {"scalePart", (PyCFunction) Matrix_scalePart, METH_NOARGS, Matrix_scalePart_doc},
- {"resize4x4", (PyCFunction) Matrix_Resize4x4, METH_NOARGS, Matrix_Resize4x4_doc},
- {"toEuler", (PyCFunction) Matrix_toEuler, METH_NOARGS, Matrix_toEuler_doc},
- {"toQuat", (PyCFunction) Matrix_toQuat, METH_NOARGS, Matrix_toQuat_doc},
- {"copy", (PyCFunction) Matrix_copy, METH_NOARGS, Matrix_copy_doc},
- {"__copy__", (PyCFunction) Matrix_copy, METH_NOARGS, Matrix_copy_doc},
- {NULL, NULL, 0, NULL}
-};
-/*-----------------------------METHODS----------------------------*/
-/*---------------------------Matrix.toQuat() ---------------------*/
-PyObject *Matrix_toQuat(MatrixObject * self)
-{
- float quat[4];
-
- /*must be 3-4 cols, 3-4 rows, square matrix*/
- if(self->colSize < 3 || self->rowSize < 3 || (self->colSize != self->rowSize)) {
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Matrix.toQuat(): inappropriate matrix size - expects 3x3 or 4x4 matrix\n");
- }
- if(self->colSize == 3){
- Mat3ToQuat((float (*)[3])*self->matrix, quat);
- }else{
- Mat4ToQuat((float (*)[4])*self->matrix, quat);
- }
-
- return newQuaternionObject(quat, Py_NEW);
-}
-/*---------------------------Matrix.toEuler() --------------------*/
-PyObject *Matrix_toEuler(MatrixObject * self)
-{
- float eul[3];
-
- int x;
-
- /*must be 3-4 cols, 3-4 rows, square matrix*/
- if(self->colSize ==3 && self->rowSize ==3) {
- Mat3ToEul((float (*)[3])*self->matrix, eul);
- }else if (self->colSize ==4 && self->rowSize ==4) {
- float tempmat3[3][3];
- Mat3CpyMat4(tempmat3, (float (*)[4])*self->matrix);
- Mat3ToEul(tempmat3, eul);
- }else
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Matrix.toEuler(): inappropriate matrix size - expects 3x3 or 4x4 matrix\n");
-
- /*have to convert to degrees*/
- for(x = 0; x < 3; x++) {
- eul[x] *= (float) (180 / Py_PI);
- }
- return newEulerObject(eul, Py_NEW);
-}
-/*---------------------------Matrix.resize4x4() ------------------*/
-PyObject *Matrix_Resize4x4(MatrixObject * self)
-{
- int x, first_row_elem, curr_pos, new_pos, blank_columns, blank_rows, index;
-
- if(self->data.blend_data){
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "cannot resize wrapped data - only python matrices\n");
- }
-
- self->data.py_data = PyMem_Realloc(self->data.py_data, (sizeof(float) * 16));
- if(self->data.py_data == NULL) {
- return EXPP_ReturnPyObjError(PyExc_MemoryError,
- "matrix.resize4x4(): problem allocating pointer space\n\n");
- }
- self->contigPtr = self->data.py_data; /*force*/
- self->matrix = PyMem_Realloc(self->matrix, (sizeof(float *) * 4));
- if(self->matrix == NULL) {
- return EXPP_ReturnPyObjError(PyExc_MemoryError,
- "matrix.resize4x4(): problem allocating pointer space\n\n");
- }
- /*set row pointers*/
- for(x = 0; x < 4; x++) {
- self->matrix[x] = self->contigPtr + (x * 4);
- }
- /*move data to new spot in array + clean*/
- for(blank_rows = (4 - self->rowSize); blank_rows > 0; blank_rows--){
- for(x = 0; x < 4; x++){
- index = (4 * (self->rowSize + (blank_rows - 1))) + x;
- if (index == 10 || index == 15){
- self->contigPtr[index] = 1.0f;
- }else{
- self->contigPtr[index] = 0.0f;
- }
- }
- }
- for(x = 1; x <= self->rowSize; x++){
- first_row_elem = (self->colSize * (self->rowSize - x));
- curr_pos = (first_row_elem + (self->colSize -1));
- new_pos = (4 * (self->rowSize - x )) + (curr_pos - first_row_elem);
- for(blank_columns = (4 - self->colSize); blank_columns > 0; blank_columns--){
- self->contigPtr[new_pos + blank_columns] = 0.0f;
- }
- for(curr_pos = curr_pos; curr_pos >= first_row_elem; curr_pos--){
- self->contigPtr[new_pos] = self->contigPtr[curr_pos];
- new_pos--;
- }
- }
- self->rowSize = 4;
- self->colSize = 4;
- return EXPP_incr_ret((PyObject*)self);
-}
-/*---------------------------Matrix.translationPart() ------------*/
-PyObject *Matrix_TranslationPart(MatrixObject * self)
-{
- float vec[4];
-
- if(self->colSize < 3 || self->rowSize < 4){
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Matrix.translationPart: inappropriate matrix size\n");
- }
-
- vec[0] = self->matrix[3][0];
- vec[1] = self->matrix[3][1];
- vec[2] = self->matrix[3][2];
-
- return newVectorObject(vec, 3, Py_NEW);
-}
-/*---------------------------Matrix.rotationPart() ---------------*/
-PyObject *Matrix_RotationPart(MatrixObject * self)
-{
- float mat[16] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
-
- if(self->colSize < 3 || self->rowSize < 3){
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Matrix.rotationPart: inappropriate matrix size\n");
- }
-
- mat[0] = self->matrix[0][0];
- mat[1] = self->matrix[0][1];
- mat[2] = self->matrix[0][2];
- mat[3] = self->matrix[1][0];
- mat[4] = self->matrix[1][1];
- mat[5] = self->matrix[1][2];
- mat[6] = self->matrix[2][0];
- mat[7] = self->matrix[2][1];
- mat[8] = self->matrix[2][2];
-
- return newMatrixObject(mat, 3, 3, Py_NEW);
-}
-/*---------------------------Matrix.scalePart() --------------------*/
-PyObject *Matrix_scalePart(MatrixObject * self)
-{
- float scale[3], rot[3];
- float mat[3][3], imat[3][3], tmat[3][3];
-
- /*must be 3-4 cols, 3-4 rows, square matrix*/
- if(self->colSize == 4 && self->rowSize == 4)
- Mat3CpyMat4(mat, (float (*)[4])*self->matrix);
- else if(self->colSize == 3 && self->rowSize == 3)
- Mat3CpyMat3(mat, (float (*)[3])*self->matrix);
- else
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Matrix.scalePart(): inappropriate matrix size - expects 3x3 or 4x4 matrix\n");
-
- /* functionality copied from editobject.c apply_obmat */
- Mat3ToEul(mat, rot);
- EulToMat3(rot, tmat);
- Mat3Inv(imat, tmat);
- Mat3MulMat3(tmat, imat, mat);
-
- scale[0]= tmat[0][0];
- scale[1]= tmat[1][1];
- scale[2]= tmat[2][2];
- return newVectorObject(scale, 3, Py_NEW);
-}
-/*---------------------------Matrix.invert() ---------------------*/
-PyObject *Matrix_Invert(MatrixObject * self)
-{
-
- int x, y, z = 0;
- float det = 0.0f;
- PyObject *f = NULL;
- float mat[16] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
-
- if(self->rowSize != self->colSize){
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Matrix.invert(ed): only square matrices are supported\n");
- }
-
- /*calculate the determinant*/
- f = Matrix_Determinant(self);
- det = (float)PyFloat_AS_DOUBLE(f); /*Increfs, so we need to decref*/
- Py_DECREF(f);
-
- if(det != 0) {
- /*calculate the classical adjoint*/
- if(self->rowSize == 2) {
- mat[0] = self->matrix[1][1];
- mat[1] = -self->matrix[1][0];
- mat[2] = -self->matrix[0][1];
- mat[3] = self->matrix[0][0];
- } else if(self->rowSize == 3) {
- Mat3Adj((float (*)[3]) mat,(float (*)[3]) *self->matrix);
- } else if(self->rowSize == 4) {
- Mat4Adj((float (*)[4]) mat, (float (*)[4]) *self->matrix);
- }
- /*divide by determinate*/
- for(x = 0; x < (self->rowSize * self->colSize); x++) {
- mat[x] /= det;
- }
- /*set values*/
- for(x = 0; x < self->rowSize; x++) {
- for(y = 0; y < self->colSize; y++) {
- self->matrix[x][y] = mat[z];
- z++;
- }
- }
- /*transpose
- Matrix_Transpose(self);*/
- } else {
- return EXPP_ReturnPyObjError(PyExc_ValueError,
- "matrix does not have an inverse");
- }
- return EXPP_incr_ret((PyObject*)self);
-}
-
-
-/*---------------------------Matrix.determinant() ----------------*/
-PyObject *Matrix_Determinant(MatrixObject * self)
-{
- float det = 0.0f;
-
- if(self->rowSize != self->colSize){
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Matrix.determinant: only square matrices are supported\n");
- }
-
- if(self->rowSize == 2) {
- det = Det2x2(self->matrix[0][0], self->matrix[0][1],
- self->matrix[1][0], self->matrix[1][1]);
- } else if(self->rowSize == 3) {
- det = Det3x3(self->matrix[0][0], self->matrix[0][1],
- self->matrix[0][2], self->matrix[1][0],
- self->matrix[1][1], self->matrix[1][2],
- self->matrix[2][0], self->matrix[2][1],
- self->matrix[2][2]);
- } else {
- det = Det4x4((float (*)[4]) *self->matrix);
- }
-
- return PyFloat_FromDouble( (double) det );
-}
-/*---------------------------Matrix.transpose() ------------------*/
-PyObject *Matrix_Transpose(MatrixObject * self)
-{
- float t = 0.0f;
-
- if(self->rowSize != self->colSize){
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Matrix.transpose(d): only square matrices are supported\n");
- }
-
- if(self->rowSize == 2) {
- t = self->matrix[1][0];
- self->matrix[1][0] = self->matrix[0][1];
- self->matrix[0][1] = t;
- } else if(self->rowSize == 3) {
- Mat3Transp((float (*)[3])*self->matrix);
- } else {
- Mat4Transp((float (*)[4])*self->matrix);
- }
-
- return EXPP_incr_ret((PyObject*)self);
-}
-
-
-/*---------------------------Matrix.zero() -----------------------*/
-PyObject *Matrix_Zero(MatrixObject * self)
-{
- int row, col;
-
- for(row = 0; row < self->rowSize; row++) {
- for(col = 0; col < self->colSize; col++) {
- self->matrix[row][col] = 0.0f;
- }
- }
- return EXPP_incr_ret((PyObject*)self);
-}
-/*---------------------------Matrix.identity(() ------------------*/
-PyObject *Matrix_Identity(MatrixObject * self)
-{
- if(self->rowSize != self->colSize){
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Matrix.identity: only square matrices are supported\n");
- }
-
- if(self->rowSize == 2) {
- self->matrix[0][0] = 1.0f;
- self->matrix[0][1] = 0.0f;
- self->matrix[1][0] = 0.0f;
- self->matrix[1][1] = 1.0f;
- } else if(self->rowSize == 3) {
- Mat3One((float (*)[3]) *self->matrix);
- } else {
- Mat4One((float (*)[4]) *self->matrix);
- }
-
- return EXPP_incr_ret((PyObject*)self);
-}
-
-/*---------------------------Matrix.inverted() ------------------*/
-PyObject *Matrix_copy(MatrixObject * self)
-{
- return (PyObject*)(MatrixObject*)newMatrixObject((float (*))*self->matrix, self->rowSize, self->colSize, Py_NEW);
-}
-
-/*----------------------------dealloc()(internal) ----------------*/
-/*free the py_object*/
-static void Matrix_dealloc(MatrixObject * self)
-{
- Py_XDECREF(self->coerced_object);
- PyMem_Free(self->matrix);
- /*only free py_data*/
- if(self->data.py_data){
- PyMem_Free(self->data.py_data);
- }
- PyObject_DEL(self);
-}
-/*----------------------------getattr()(internal) ----------------*/
-/*object.attribute access (get)*/
-static PyObject *Matrix_getattr(MatrixObject * self, char *name)
-{
- if(STREQ(name, "rowSize")) {
- return PyInt_FromLong((long) self->rowSize);
- } else if(STREQ(name, "colSize")) {
- return PyInt_FromLong((long) self->colSize);
- }
- if(STREQ(name, "wrapped")){
- if(self->wrapped == Py_WRAP)
- return EXPP_incr_ret((PyObject *)Py_True);
- else
- return EXPP_incr_ret((PyObject *)Py_False);
- }
- return Py_FindMethod(Matrix_methods, (PyObject *) self, name);
-}
-/*----------------------------setattr()(internal) ----------------*/
-/*object.attribute access (set)*/
-static int Matrix_setattr(MatrixObject * self, char *name, PyObject * v)
-{
- /* This is not supported. */
- return (-1);
-}
-/*----------------------------print object (internal)-------------*/
-/*print the object to screen*/
-static PyObject *Matrix_repr(MatrixObject * self)
-{
- int x, y;
- char buffer[48], str[1024];
-
- BLI_strncpy(str,"",1024);
- for(x = 0; x < self->rowSize; x++){
- sprintf(buffer, "[");
- strcat(str,buffer);
- for(y = 0; y < (self->colSize - 1); y++) {
- sprintf(buffer, "%.6f, ", self->matrix[x][y]);
- strcat(str,buffer);
- }
- if(x < (self->rowSize-1)){
- sprintf(buffer, "%.6f](matrix [row %d])\n", self->matrix[x][y], x);
- strcat(str,buffer);
- }else{
- sprintf(buffer, "%.6f](matrix [row %d])", self->matrix[x][y], x);
- strcat(str,buffer);
- }
- }
-
- return PyString_FromString(str);
-}
-/*------------------------tp_richcmpr*/
-/*returns -1 execption, 0 false, 1 true*/
-static PyObject* Matrix_richcmpr(PyObject *objectA, PyObject *objectB, int comparison_type)
-{
- MatrixObject *matA = NULL, *matB = NULL;
- int result = 0;
-
- if (!MatrixObject_Check(objectA) || !MatrixObject_Check(objectB)){
- if (comparison_type == Py_NE){
- return EXPP_incr_ret(Py_True);
- }else{
- return EXPP_incr_ret(Py_False);
- }
- }
- matA = (MatrixObject*)objectA;
- matB = (MatrixObject*)objectB;
-
- if (matA->colSize != matB->colSize || matA->rowSize != matB->rowSize){
- if (comparison_type == Py_NE){
- return EXPP_incr_ret(Py_True);
- }else{
- return EXPP_incr_ret(Py_False);
- }
- }
-
- switch (comparison_type){
- case Py_EQ:
- /*contigPtr is basically a really long vector*/
- result = EXPP_VectorsAreEqual(matA->contigPtr, matB->contigPtr,
- (matA->rowSize * matA->colSize), 1);
- break;
- case Py_NE:
- result = EXPP_VectorsAreEqual(matA->contigPtr, matB->contigPtr,
- (matA->rowSize * matA->colSize), 1);
- if (result == 0){
- result = 1;
- }else{
- result = 0;
- }
- break;
- default:
- printf("The result of the comparison could not be evaluated");
- break;
- }
- if (result == 1){
- return EXPP_incr_ret(Py_True);
- }else{
- return EXPP_incr_ret(Py_False);
- }
-}
-/*------------------------tp_doc*/
-static char MatrixObject_doc[] = "This is a wrapper for matrix objects.";
-/*---------------------SEQUENCE PROTOCOLS------------------------
- ----------------------------len(object)------------------------
- sequence length*/
-static int Matrix_len(MatrixObject * self)
-{
- return (self->colSize * self->rowSize);
-}
-/*----------------------------object[]---------------------------
- sequence accessor (get)
- the wrapped vector gives direct access to the matrix data*/
-static PyObject *Matrix_item(MatrixObject * self, int i)
-{
- if(i < 0 || i >= self->rowSize)
- return EXPP_ReturnPyObjError(PyExc_IndexError,
- "matrix[attribute]: array index out of range\n");
-
- return newVectorObject(self->matrix[i], self->colSize, Py_WRAP);
-}
-/*----------------------------object[]-------------------------
- sequence accessor (set)*/
-static int Matrix_ass_item(MatrixObject * self, int i, PyObject * ob)
-{
- int y, x, size = 0;
- float vec[4];
- PyObject *m, *f;
-
- if(i >= self->rowSize || i < 0){
- return EXPP_ReturnIntError(PyExc_TypeError,
- "matrix[attribute] = x: bad row\n");
- }
-
- if(PySequence_Check(ob)){
- size = PySequence_Length(ob);
- if(size != self->colSize){
- return EXPP_ReturnIntError(PyExc_TypeError,
- "matrix[attribute] = x: bad sequence size\n");
- }
- for (x = 0; x < size; x++) {
- m = PySequence_GetItem(ob, x);
- if (m == NULL) { /*Failed to read sequence*/
- return EXPP_ReturnIntError(PyExc_RuntimeError,
- "matrix[attribute] = x: unable to read sequence\n");
- }
-
- f = PyNumber_Float(m);
- if(f == NULL) { /*parsed item not a number*/
- Py_DECREF(m);
- return EXPP_ReturnIntError(PyExc_TypeError,
- "matrix[attribute] = x: sequence argument not a number\n");
- }
-
- vec[x] = (float)PyFloat_AS_DOUBLE(f);
- EXPP_decr2(m, f);
- }
- /*parsed well - now set in matrix*/
- for(y = 0; y < size; y++){
- self->matrix[i][y] = vec[y];
- }
- return 0;
- }else{
- return EXPP_ReturnIntError(PyExc_TypeError,
- "matrix[attribute] = x: expects a sequence of column size\n");
- }
-}
-/*----------------------------object[z:y]------------------------
- sequence slice (get)*/
-static PyObject *Matrix_slice(MatrixObject * self, int begin, int end)
-{
-
- PyObject *list = NULL;
- int count;
-
- CLAMP(begin, 0, self->rowSize);
- CLAMP(end, 0, self->rowSize);
- begin = MIN2(begin,end);
-
- list = PyList_New(end - begin);
- for(count = begin; count < end; count++) {
- PyList_SetItem(list, count - begin,
- newVectorObject(self->matrix[count], self->colSize, Py_WRAP));
- }
-
- return list;
-}
-/*----------------------------object[z:y]------------------------
- sequence slice (set)*/
-static int Matrix_ass_slice(MatrixObject * self, int begin, int end,
- PyObject * seq)
-{
- int i, x, y, size, sub_size = 0;
- float mat[16];
- PyObject *subseq;
- PyObject *m, *f;
-
- CLAMP(begin, 0, self->rowSize);
- CLAMP(end, 0, self->rowSize);
- begin = MIN2(begin,end);
-
- if(PySequence_Check(seq)){
- size = PySequence_Length(seq);
- if(size != (end - begin)){
- return EXPP_ReturnIntError(PyExc_TypeError,
- "matrix[begin:end] = []: size mismatch in slice assignment\n");
- }
- /*parse sub items*/
- for (i = 0; i < size; i++) {
- /*parse each sub sequence*/
- subseq = PySequence_GetItem(seq, i);
- if (subseq == NULL) { /*Failed to read sequence*/
- return EXPP_ReturnIntError(PyExc_RuntimeError,
- "matrix[begin:end] = []: unable to read sequence\n");
- }
-
- if(PySequence_Check(subseq)){
- /*subsequence is also a sequence*/
- sub_size = PySequence_Length(subseq);
- if(sub_size != self->colSize){
- Py_DECREF(subseq);
- return EXPP_ReturnIntError(PyExc_TypeError,
- "matrix[begin:end] = []: size mismatch in slice assignment\n");
- }
- for (y = 0; y < sub_size; y++) {
- m = PySequence_GetItem(subseq, y);
- if (m == NULL) { /*Failed to read sequence*/
- Py_DECREF(subseq);
- return EXPP_ReturnIntError(PyExc_RuntimeError,
- "matrix[begin:end] = []: unable to read sequence\n");
- }
-
- f = PyNumber_Float(m);
- if(f == NULL) { /*parsed item not a number*/
- EXPP_decr2(m, subseq);
- return EXPP_ReturnIntError(PyExc_TypeError,
- "matrix[begin:end] = []: sequence argument not a number\n");
- }
-
- mat[(i * self->colSize) + y] = (float)PyFloat_AS_DOUBLE(f);
- EXPP_decr2(f, m);
- }
- }else{
- Py_DECREF(subseq);
- return EXPP_ReturnIntError(PyExc_TypeError,
- "matrix[begin:end] = []: illegal argument type for built-in operation\n");
- }
- Py_DECREF(subseq);
- }
- /*parsed well - now set in matrix*/
- for(x = 0; x < (size * sub_size); x++){
- self->matrix[begin + (int)floor(x / self->colSize)][x % self->colSize] = mat[x];
- }
- return 0;
- }else{
- return EXPP_ReturnIntError(PyExc_TypeError,
- "matrix[begin:end] = []: illegal argument type for built-in operation\n");
- }
-}
-/*------------------------NUMERIC PROTOCOLS----------------------
- ------------------------obj + obj------------------------------*/
-static PyObject *Matrix_add(PyObject * m1, PyObject * m2)
-{
- int x, y;
- float mat[16] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
- MatrixObject *mat1 = NULL, *mat2 = NULL;
-
- mat1 = (MatrixObject*)m1;
- mat2 = (MatrixObject*)m2;
-
- if(mat1->coerced_object || mat2->coerced_object){
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Matrix addition: arguments not valid for this operation....\n");
- }
- if(mat1->rowSize != mat2->rowSize || mat1->colSize != mat2->colSize){
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Matrix addition: matrices must have the same dimensions for this operation\n");
- }
-
- for(x = 0; x < mat1->rowSize; x++) {
- for(y = 0; y < mat1->colSize; y++) {
- mat[((x * mat1->colSize) + y)] = mat1->matrix[x][y] + mat2->matrix[x][y];
- }
- }
-
- return newMatrixObject(mat, mat1->rowSize, mat1->colSize, Py_NEW);
-}
-/*------------------------obj - obj------------------------------
- subtraction*/
-static PyObject *Matrix_sub(PyObject * m1, PyObject * m2)
-{
- int x, y;
- float mat[16] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
- MatrixObject *mat1 = NULL, *mat2 = NULL;
-
- mat1 = (MatrixObject*)m1;
- mat2 = (MatrixObject*)m2;
-
- if(mat1->coerced_object || mat2->coerced_object){
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Matrix addition: arguments not valid for this operation....\n");
- }
- if(mat1->rowSize != mat2->rowSize || mat1->colSize != mat2->colSize){
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Matrix addition: matrices must have the same dimensions for this operation\n");
- }
-
- for(x = 0; x < mat1->rowSize; x++) {
- for(y = 0; y < mat1->colSize; y++) {
- mat[((x * mat1->colSize) + y)] = mat1->matrix[x][y] - mat2->matrix[x][y];
- }
- }
-
- return newMatrixObject(mat, mat1->rowSize, mat1->colSize, Py_NEW);
-}
-/*------------------------obj * obj------------------------------
- mulplication*/
-static PyObject *Matrix_mul(PyObject * m1, PyObject * m2)
-{
- int x, y, z;
- float scalar;
- float mat[16] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
- double dot = 0.0f;
- MatrixObject *mat1 = NULL, *mat2 = NULL;
- PyObject *f = NULL;
- PointObject *pt = NULL;
-
- mat1 = (MatrixObject*)m1;
- mat2 = (MatrixObject*)m2;
-
- if(mat1->coerced_object){
- if (PyFloat_Check(mat1->coerced_object) ||
- PyInt_Check(mat1->coerced_object)){ /*FLOAT/INT * MATRIX*/
- f = PyNumber_Float(mat1->coerced_object);
- if(f == NULL) { /*parsed item not a number*/
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Matrix multiplication: arguments not acceptable for this operation\n");
- }
-
- scalar = (float)PyFloat_AS_DOUBLE(f);
- Py_DECREF(f);
- for(x = 0; x < mat2->rowSize; x++) {
- for(y = 0; y < mat2->colSize; y++) {
- mat[((x * mat2->colSize) + y)] = scalar * mat2->matrix[x][y];
- }
- }
- return newMatrixObject(mat, mat2->rowSize, mat2->colSize, Py_NEW);
- }
- }else{
- if(mat2->coerced_object){
- /* MATRIX * VECTOR operation is now being done by vector */
- /*if(VectorObject_Check(mat2->coerced_object)){
- vec = (VectorObject*)mat2->coerced_object;
- return column_vector_multiplication(mat1, vec);
- }else */
- if(PointObject_Check(mat2->coerced_object)){ /*MATRIX * POINT*/
- pt = (PointObject*)mat2->coerced_object;
- return column_point_multiplication(mat1, pt);
- }else if (PyFloat_Check(mat2->coerced_object) ||
- PyInt_Check(mat2->coerced_object)){ /*MATRIX * FLOAT/INT*/
- f = PyNumber_Float(mat2->coerced_object);
- if(f == NULL) { /*parsed item not a number*/
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Matrix multiplication: arguments not acceptable for this operation\n");
- }
-
- scalar = (float)PyFloat_AS_DOUBLE(f);
- Py_DECREF(f);
- for(x = 0; x < mat1->rowSize; x++) {
- for(y = 0; y < mat1->colSize; y++) {
- mat[((x * mat1->colSize) + y)] = scalar * mat1->matrix[x][y];
- }
- }
- return newMatrixObject(mat, mat1->rowSize, mat1->colSize, Py_NEW);
- }
- }else{ /*MATRIX * MATRIX*/
- if(mat1->colSize != mat2->rowSize){
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Matrix multiplication: matrix A rowsize must equal matrix B colsize\n");
- }
- for(x = 0; x < mat1->rowSize; x++) {
- for(y = 0; y < mat2->colSize; y++) {
- for(z = 0; z < mat1->colSize; z++) {
- dot += (mat1->matrix[x][z] * mat2->matrix[z][y]);
- }
- mat[((x * mat1->rowSize) + y)] = (float)dot;
- dot = 0.0f;
- }
- }
- return newMatrixObject(mat, mat1->rowSize, mat2->colSize, Py_NEW);
- }
- }
-
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Matrix multiplication: arguments not acceptable for this operation\n");
-}
-PyObject* Matrix_inv(MatrixObject *self)
-{
- return Matrix_Invert(self);
-}
-/*------------------------coerce(obj, obj)-----------------------
- coercion of unknown types to type MatrixObject for numeric protocols.
-
- Coercion() is called whenever a math operation has 2 operands that
- it doesn't understand how to evaluate. 2+Matrix for example. We want to
- evaluate some of these operations like: (vector * 2), however, for math
- to proceed, the unknown operand must be cast to a type that python math will
- understand. (e.g. in the case above case, 2 must be cast to a vector and
- then call vector.multiply(vector, scalar_cast_as_vector)*/
-static int Matrix_coerce(PyObject ** m1, PyObject ** m2)
-{
- if(VectorObject_Check(*m2) || PyFloat_Check(*m2) || PyInt_Check(*m2) ||
- PointObject_Check(*m2)) {
- PyObject *coerced = EXPP_incr_ret(*m2);
- *m2 = newMatrixObject(NULL,3,3,Py_NEW);
- ((MatrixObject*)*m2)->coerced_object = coerced;
- Py_INCREF (*m1);
- return 0;
- }
-
- return EXPP_ReturnIntError(PyExc_TypeError,
- "matrix.coerce(): unknown operand - can't coerce for numeric protocols");
-}
-/*-----------------PROTOCOL DECLARATIONS--------------------------*/
-static PySequenceMethods Matrix_SeqMethods = {
- (inquiry) Matrix_len, /* sq_length */
- (binaryfunc) 0, /* sq_concat */
- (intargfunc) 0, /* sq_repeat */
- (intargfunc) Matrix_item, /* sq_item */
- (intintargfunc) Matrix_slice, /* sq_slice */
- (intobjargproc) Matrix_ass_item, /* sq_ass_item */
- (intintobjargproc) Matrix_ass_slice, /* sq_ass_slice */
-};
-static PyNumberMethods Matrix_NumMethods = {
- (binaryfunc) Matrix_add, /* __add__ */
- (binaryfunc) Matrix_sub, /* __sub__ */
- (binaryfunc) Matrix_mul, /* __mul__ */
- (binaryfunc) 0, /* __div__ */
- (binaryfunc) 0, /* __mod__ */
- (binaryfunc) 0, /* __divmod__ */
- (ternaryfunc) 0, /* __pow__ */
- (unaryfunc) 0, /* __neg__ */
- (unaryfunc) 0, /* __pos__ */
- (unaryfunc) 0, /* __abs__ */
- (inquiry) 0, /* __nonzero__ */
- (unaryfunc) Matrix_inv, /* __invert__ */
- (binaryfunc) 0, /* __lshift__ */
- (binaryfunc) 0, /* __rshift__ */
- (binaryfunc) 0, /* __and__ */
- (binaryfunc) 0, /* __xor__ */
- (binaryfunc) 0, /* __or__ */
- (coercion) Matrix_coerce, /* __coerce__ */
- (unaryfunc) 0, /* __int__ */
- (unaryfunc) 0, /* __long__ */
- (unaryfunc) 0, /* __float__ */
- (unaryfunc) 0, /* __oct__ */
- (unaryfunc) 0, /* __hex__ */
-};
-/*------------------PY_OBECT DEFINITION--------------------------*/
-PyTypeObject matrix_Type = {
- PyObject_HEAD_INIT(NULL) /*tp_head*/
- 0, /*tp_internal*/
- "matrix", /*tp_name*/
- sizeof(MatrixObject), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- (destructor)Matrix_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- (getattrfunc)Matrix_getattr, /*tp_getattr*/
- (setattrfunc) Matrix_setattr, /*tp_setattr*/
- 0, /*tp_compare*/
- (reprfunc) Matrix_repr, /*tp_repr*/
- &Matrix_NumMethods, /*tp_as_number*/
- &Matrix_SeqMethods, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash*/
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT, /*tp_flags*/
- MatrixObject_doc, /*tp_doc*/
- 0, /*tp_traverse*/
- 0, /*tp_clear*/
- (richcmpfunc)Matrix_richcmpr, /*tp_richcompare*/
- 0, /*tp_weaklistoffset*/
- 0, /*tp_iter*/
- 0, /*tp_iternext*/
- 0, /*tp_methods*/
- 0, /*tp_members*/
- 0, /*tp_getset*/
- 0, /*tp_base*/
- 0, /*tp_dict*/
- 0, /*tp_descr_get*/
- 0, /*tp_descr_set*/
- 0, /*tp_dictoffset*/
- 0, /*tp_init*/
- 0, /*tp_alloc*/
- 0, /*tp_new*/
- 0, /*tp_free*/
- 0, /*tp_is_gc*/
- 0, /*tp_bases*/
- 0, /*tp_mro*/
- 0, /*tp_cache*/
- 0, /*tp_subclasses*/
- 0, /*tp_weaklist*/
- 0 /*tp_del*/
-};
-
-/*------------------------newMatrixObject (internal)-------------
-creates a new matrix object
-self->matrix self->contiguous_ptr (reference to data.xxx)
- [0]------------->[0]
- [1]
- [2]
- [1]------------->[3]
- [4]
- [5]
- ....
-self->matrix[1][1] = self->contiguous_ptr[4] = self->data.xxx_data[4]*/
-
-/*pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER
- (i.e. it was allocated elsewhere by MEM_mallocN())
- pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON
- (i.e. it must be created here with PyMEM_malloc())*/
-PyObject *newMatrixObject(float *mat, int rowSize, int colSize, int type)
-{
- MatrixObject *self;
- int x, row, col;
-
- /*matrix objects can be any 2-4row x 2-4col matrix*/
- if(rowSize < 2 || rowSize > 4 || colSize < 2 || colSize > 4){
- return EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "matrix(): row and column sizes must be between 2 and 4\n");
- }
-
- self = PyObject_NEW(MatrixObject, &matrix_Type);
- self->data.blend_data = NULL;
- self->data.py_data = NULL;
- self->rowSize = rowSize;
- self->colSize = colSize;
- self->coerced_object = NULL;
-
- if(type == Py_WRAP){
- self->data.blend_data = mat;
- self->contigPtr = self->data.blend_data;
- /*create pointer array*/
- self->matrix = PyMem_Malloc(rowSize * sizeof(float *));
- if(self->matrix == NULL) { /*allocation failure*/
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "matrix(): problem allocating pointer space\n");
- }
- /*pointer array points to contigous memory*/
- for(x = 0; x < rowSize; x++) {
- self->matrix[x] = self->contigPtr + (x * colSize);
- }
- self->wrapped = Py_WRAP;
- }else if (type == Py_NEW){
- self->data.py_data = PyMem_Malloc(rowSize * colSize * sizeof(float));
- if(self->data.py_data == NULL) { /*allocation failure*/
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "matrix(): problem allocating pointer space\n");
- }
- self->contigPtr = self->data.py_data;
- /*create pointer array*/
- self->matrix = PyMem_Malloc(rowSize * sizeof(float *));
- if(self->matrix == NULL) { /*allocation failure*/
- PyMem_Free(self->data.py_data);
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "matrix(): problem allocating pointer space\n");
- }
- /*pointer array points to contigous memory*/
- for(x = 0; x < rowSize; x++) {
- self->matrix[x] = self->contigPtr + (x * colSize);
- }
- /*parse*/
- if(mat) { /*if a float array passed*/
- for(row = 0; row < rowSize; row++) {
- for(col = 0; col < colSize; col++) {
- self->matrix[row][col] = mat[(row * colSize) + col];
- }
- }
- } else if (rowSize == colSize ) { /*or if no arguments are passed return identity matrix for square matrices */
- Matrix_Identity(self);
- Py_DECREF(self);
- }
- self->wrapped = Py_NEW;
- }else{ /*bad type*/
- return NULL;
- }
- return (PyObject *) self;
-}
diff --git a/source/blender/python/api2_2x/matrix.h b/source/blender/python/api2_2x/matrix.h
deleted file mode 100644
index b830038bfcc..00000000000
--- a/source/blender/python/api2_2x/matrix.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * $Id: matrix.h 8363 2006-08-21 13:52:32Z campbellbarton $
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joseph Gilbert
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- *
- */
-
-#ifndef EXPP_matrix_h
-#define EXPP_matrix_h
-
-#include <Python.h>
-
-extern PyTypeObject matrix_Type;
-
-#define MatrixObject_Check(v) ((v)->ob_type == &matrix_Type)
-
-typedef float **ptRow;
-typedef struct _Matrix {
- PyObject_VAR_HEAD
- struct{
- float *py_data; /*python managed*/
- float *blend_data; /*blender managed*/
- }data;
- ptRow matrix; /*ptr to the contigPtr (accessor)*/
- float *contigPtr; /*1D array of data (alias)*/
- int rowSize;
- int colSize;
- int wrapped; /*is wrapped data?*/
- PyObject *coerced_object;
-} MatrixObject;
-/*coerced_object is a pointer to the object that it was
-coerced from when a dummy vector needs to be created from
-the coerce() function for numeric protocol operations*/
-
-/*struct data contains a pointer to the actual data that the
-object uses. It can use either PyMem allocated data (which will
-be stored in py_data) or be a wrapper for data allocated through
-blender (stored in blend_data). This is an either/or struct not both*/
-
-/*prototypes*/
-PyObject *Matrix_Zero( MatrixObject * self );
-PyObject *Matrix_Identity( MatrixObject * self );
-PyObject *Matrix_Transpose( MatrixObject * self );
-PyObject *Matrix_Determinant( MatrixObject * self );
-PyObject *Matrix_Invert( MatrixObject * self );
-PyObject *Matrix_TranslationPart( MatrixObject * self );
-PyObject *Matrix_RotationPart( MatrixObject * self );
-PyObject *Matrix_scalePart( MatrixObject * self );
-PyObject *Matrix_Resize4x4( MatrixObject * self );
-PyObject *Matrix_toEuler( MatrixObject * self );
-PyObject *Matrix_toQuat( MatrixObject * self );
-PyObject *Matrix_copy( MatrixObject * self );
-PyObject *newMatrixObject(float *mat, int rowSize, int colSize, int type);
-
-#endif /* EXPP_matrix_H */
diff --git a/source/blender/python/api2_2x/meshPrimitive.c b/source/blender/python/api2_2x/meshPrimitive.c
deleted file mode 100644
index 754f4986646..00000000000
--- a/source/blender/python/api2_2x/meshPrimitive.c
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * $Id: meshPrimitive.c 10773 2007-05-24 15:00:10Z khughes $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender, partially based on NMesh.c API.
- *
- * Contributor(s): Ken Hughes
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include "Mesh.h" /*This must come first*/
-
-#include "DNA_scene_types.h"
-#include "BDR_editobject.h"
-#include "BIF_editmesh.h"
-#include "BKE_global.h"
-#include "BKE_object.h"
-#include "BKE_scene.h"
-#include "BKE_library.h"
-#include "blendef.h"
-
-#include "gen_utils.h"
-
-/*
- * local helper procedure which does the dirty work of messing with the
- * edit mesh, active objects, etc.
- */
-
-static PyObject *make_mesh( int type, char *name, short tot, short seg,
- short subdiv, float dia, float height, short ext, short fill )
-{
- float cent[3] = {0,0,0};
- float imat[3][3]={{1,0,0},{0,1,0},{0,0,1}};
- Mesh *me;
- BPy_Mesh *obj;
- Object *ob;
- Base *base;
-
- /* remember active object (if any) for later, so we can re-activate */
- base = BASACT;
-
- /* make a new object, "copy" to the editMesh structure */
- ob = add_object(OB_MESH);
- me = (Mesh *)ob->data;
- G.obedit = BASACT->object;
- make_editMesh( );
-
- /* create the primitive in the edit mesh */
-
- make_prim( type, imat, /* mesh type, transform matrix */
- tot, seg, /* total vertices, segments */
- subdiv, /* subdivisions (for Icosphere only) */
- dia, -height, /* diameter-ish, height */
- ext, fill, /* extrude, fill end faces */
- cent ); /* location of center */
-
- /* copy primitive back to the real mesh */
- load_editMesh( );
- free_editMesh( G.editMesh );
- G.obedit = NULL;
-
- /* remove object link to the data, then delete the object */
- ob->data = NULL;
- me->id.us = 0;
- free_and_unlink_base(BASACT);
-
- /* if there was an active object, reactivate it */
- if( base )
- scene_select_base(G.scene, base);
-
- /* create the BPy_Mesh that wraps this mesh */
- obj = (BPy_Mesh *)PyObject_NEW( BPy_Mesh, &Mesh_Type );
-
- rename_id( &me->id, name );
- obj->mesh = me;
- obj->object = NULL;
- obj->new = 1;
- return (PyObject *) obj;
-}
-
-static PyObject *M_MeshPrim_Plane( PyObject *self_unused, PyObject *args )
-{
- float size = 2.0;
-
- if( !PyArg_ParseTuple( args, "|f", &size ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected optional float arg" );
-
- size *= (float)(sqrt(2.0)/2.0);
- return make_mesh( 0, "Plane", 4, 0, 0, size, -size, 0, 1 );
-}
-
-static PyObject *M_MeshPrim_Cube( PyObject *self_unused, PyObject *args )
-{
- float height = 2.0;
- float dia;
-
- if( !PyArg_ParseTuple( args, "|f", &height ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected optional float arg" );
-
- height /= 2.0;
- dia = height * (float)sqrt(2.0);
- return make_mesh( 1, "Cube", 4, 32, 2, dia, -height, 1, 1 );
-}
-
-static PyObject *M_MeshPrim_Circle( PyObject *self_unused, PyObject *args )
-{
- int tot = 32;
- float size = 2;
-
- if( !PyArg_ParseTuple( args, "|if", &tot, &size ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int and optional float arg" );
- if( tot < 3 || tot > 100 )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "number of vertices must be in the range [3:100]" );
-
- size /= 2.0;
- return make_mesh( 4, "Circle", tot, 0, 0, size, -size, 0, 0 );
-}
-
-static PyObject *M_MeshPrim_Cylinder( PyObject *self_unused, PyObject *args )
-{
- int tot = 32;
- float size = 2.0;
- float len = 2.0;
-
- if( !PyArg_ParseTuple( args, "|iff", &tot, &size, &len ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int and optional float arg" );
- if( tot < 3 || tot > 100 )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "number of vertices must be in the range [3:100]" );
-
- return make_mesh( 5, "Cylinder", tot, 0, 0, size/2.0, -len/2.0, 1, 1 );
-}
-
-static PyObject *M_MeshPrim_Tube( PyObject *self_unused, PyObject *args )
-{
- int tot = 32;
- float size = 2.0;
- float len = 2.0;
-
- if( !PyArg_ParseTuple( args, "|iff", &tot, &size, &len ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int and optional float arg" );
- if( tot < 3 || tot > 100 )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "number of vertices must be in the range [3:100]" );
-
- return make_mesh( 6, "Tube", tot, 0, 0, size/2.0, -len/2.0, 1, 0 );
-}
-
-static PyObject *M_MeshPrim_Cone( PyObject *self_unused, PyObject *args )
-{
- int tot = 32;
- float size = 2.0;
- float len = 2.0;
-
- if( !PyArg_ParseTuple( args, "|iff", &tot, &size, &len ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int and optional float arg" );
- if( tot < 3 || tot > 100 )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "number of vertices must be in the range [3:100]" );
-
- return make_mesh( 7, "Cone", tot, 0, 0, size/2.0, -len/2.0, 0, 1 );
-}
-
-static PyObject *M_MeshPrim_Grid( PyObject *self_unused, PyObject *args )
-{
- int xres = 32;
- int yres = 32;
- float size = 2.0;
-
- if( !PyArg_ParseTuple( args, "|iif", &xres, &yres, &size ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected two ints and an optional float arg" );
- if( xres < 2 || xres > 100 || yres < 2 || yres > 100 )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "resolution must be in the range [2:100]" );
-
- size /= 2.0;
- return make_mesh( 10, "Grid", xres, yres, 0, size, -size, 0, 0 );
-}
-
-static PyObject *M_MeshPrim_UVsphere( PyObject *self_unused, PyObject *args )
-{
- int segs = 32;
- int rings = 32;
- float size = 2.0;
-
- if( !PyArg_ParseTuple( args, "|iif", &segs, &rings, &size ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected two ints and an optional float arg" );
- if( segs < 3 || segs > 100 || rings < 3 || rings > 100 )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "segments and rings must be in the range [3:100]" );
-
- size /= 2.0;
- return make_mesh( 11, "UVsphere", segs, rings, 0, size, -size, 0, 0 );
-}
-
-static PyObject *M_MeshPrim_Icosphere( PyObject *self_unused, PyObject *args )
-{
- int subdiv = 2;
- float size = 2.0;
-
- if( !PyArg_ParseTuple( args, "|if", &subdiv, &size ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int and an optional float arg" );
- if( subdiv < 1 || subdiv > 5 )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "subdivisions must be in the range [1:5]" );
-
- size /= 2.0;
- return make_mesh( 12, "Icosphere", 0, 0, subdiv, size, -size, 0, 0 );
-}
-
-static PyObject *M_MeshPrim_Suzanne( PyObject *self_unused, PyObject *args )
-{
- return make_mesh( 13, "Monkey", 0, 0, 0, 0, 0, 0, 0 );
-}
-
-static struct PyMethodDef M_MeshPrim_methods[] = {
- {"Plane", (PyCFunction)M_MeshPrim_Plane, METH_VARARGS,
- "Create a plane mesh"},
- {"Cube", (PyCFunction)M_MeshPrim_Cube, METH_VARARGS,
- "Create a cube mesh"},
- {"Circle", (PyCFunction)M_MeshPrim_Circle, METH_VARARGS,
- "Create a circle mesh"},
- {"Cylinder", (PyCFunction)M_MeshPrim_Cylinder, METH_VARARGS,
- "Create a cylindrical mesh"},
- {"Tube", (PyCFunction)M_MeshPrim_Tube, METH_VARARGS,
- "Create a tube mesh"},
- {"Cone", (PyCFunction)M_MeshPrim_Cone, METH_VARARGS,
- "Create a conic mesh"},
- {"Grid", (PyCFunction)M_MeshPrim_Grid, METH_VARARGS,
- "Create a 2D grid mesh"},
- {"UVsphere", (PyCFunction)M_MeshPrim_UVsphere, METH_VARARGS,
- "Create a UV sphere mesh"},
- {"Icosphere", (PyCFunction)M_MeshPrim_Icosphere, METH_VARARGS,
- "Create a Ico sphere mesh"},
- {"Monkey", (PyCFunction)M_MeshPrim_Suzanne, METH_NOARGS,
- "Create a Suzanne mesh"},
- {NULL, NULL, 0, NULL},
-};
-
-static char M_MeshPrim_doc[] = "The Blender.Mesh.Primitives submodule";
-
-PyObject *MeshPrimitives_Init( void )
-{
- return Py_InitModule3( "Blender.Mesh.Primitives",
- M_MeshPrim_methods, M_MeshPrim_doc );
-}
-
diff --git a/source/blender/python/api2_2x/modules.h b/source/blender/python/api2_2x/modules.h
deleted file mode 100644
index 81e138da798..00000000000
--- a/source/blender/python/api2_2x/modules.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * $Id: modules.h 4803 2005-07-18 03:50:37Z ascotan $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Michel Selten, Willian P. Germano, Nathan Letwory,
- * Stephen Swaney
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_modules_h
-#define EXPP_modules_h
-
-/************************************************************
-Certain bpy module files ( BPY_interface.c, Blender.c, and Object.c )
-need to know about almost every other module. This file is a
-convenient way to include almost all the necessary declarations.
-
-The #includes commented out below currently do not exist.
-Their *_Init() method declarations are hacked in down below.
-************************************************************/
-
-#include <Python.h>
-
-/*****************************************************************************/
-/* Global variables */
-/*****************************************************************************/
-
-/****************************************************************************
-Module Init functions for modules without a .h file.
-BGL is a special case. It still has data declarations in the .h file
-and cannot be #included until it is cleaned up.
-****************************************************************************/
-
-PyObject *BGL_Init( void );
-
-PyObject *Library_Init( void );
-PyObject *Noise_Init( void );
-
-
-
-#endif /* EXPP_modules_h */
diff --git a/source/blender/python/api2_2x/point.c b/source/blender/python/api2_2x/point.c
deleted file mode 100644
index 969fe2d53af..00000000000
--- a/source/blender/python/api2_2x/point.c
+++ /dev/null
@@ -1,526 +0,0 @@
-/*
- * $Id: point.c 10782 2007-05-26 04:39:31Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Joseph Gilbert
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-#include "Mathutils.h"
-
-#include "BLI_blenlib.h"
-#include "BKE_utildefines.h"
-#include "gen_utils.h"
-
-//-------------------------DOC STRINGS ---------------------------
-char Point_Zero_doc[] = "() - set all values in the point to 0";
-char Point_toVector_doc[] = "() - create a vector representation of this point";
-//-----------------------METHOD DEFINITIONS ----------------------
-struct PyMethodDef Point_methods[] = {
- {"zero", (PyCFunction) Point_Zero, METH_NOARGS, Point_Zero_doc},
- {"toVector", (PyCFunction) Point_toVector, METH_NOARGS, Point_toVector_doc},
- {NULL, NULL, 0, NULL}
-};
-//-----------------------------METHODS----------------------------
-//--------------------------Vector.toPoint()----------------------
-//create a new point object to represent this vector
-PyObject *Point_toVector(PointObject * self)
-{
- float vec[3];
- int x;
-
- for(x = 0; x < self->size; x++){
- vec[x] = self->coord[x];
- }
-
- return newVectorObject(vec, self->size, Py_NEW);
-}
-//----------------------------Point.zero() ----------------------
-//set the point data to 0,0,0
-PyObject *Point_Zero(PointObject * self)
-{
- int x;
- for(x = 0; x < self->size; x++) {
- self->coord[x] = 0.0f;
- }
- return EXPP_incr_ret((PyObject*)self);
-}
-//----------------------------dealloc()(internal) ----------------
-//free the py_object
-static void Point_dealloc(PointObject * self)
-{
- Py_XDECREF(self->coerced_object);
- //only free py_data
- if(self->data.py_data){
- PyMem_Free(self->data.py_data);
- }
- PyObject_DEL(self);
-}
-//----------------------------getattr()(internal) ----------------
-//object.attribute access (get)
-static PyObject *Point_getattr(PointObject * self, char *name)
-{
- if(STREQ(name,"x")){
- return PyFloat_FromDouble(self->coord[0]);
- }else if(STREQ(name, "y")){
- return PyFloat_FromDouble(self->coord[1]);
- }else if(STREQ(name, "z")){
- if(self->size > 2){
- return PyFloat_FromDouble(self->coord[2]);
- }else{
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "point.z: illegal attribute access\n");
- }
- }
- if(STREQ(name, "wrapped")){
- if(self->wrapped == Py_WRAP)
- return EXPP_incr_ret((PyObject *)Py_True);
- else
- return EXPP_incr_ret((PyObject *)Py_False);
- }
- return Py_FindMethod(Point_methods, (PyObject *) self, name);
-}
-//----------------------------setattr()(internal) ----------------
-//object.attribute access (set)
-static int Point_setattr(PointObject * self, char *name, PyObject * v)
-{
- PyObject *f = NULL;
-
- f = PyNumber_Float(v);
- if(f == NULL) { // parsed item not a number
- return EXPP_ReturnIntError(PyExc_TypeError,
- "point.attribute = x: argument not a number\n");
- }
-
- if(STREQ(name,"x")){
- self->coord[0] = (float)PyFloat_AS_DOUBLE(f);
- }else if(STREQ(name, "y")){
- self->coord[1] = (float)PyFloat_AS_DOUBLE(f);
- }else if(STREQ(name, "z")){
- if(self->size > 2){
- self->coord[2] = (float)PyFloat_AS_DOUBLE(f);
- }else{
- Py_DECREF(f);
- return EXPP_ReturnIntError(PyExc_AttributeError,
- "point.z = x: illegal attribute access\n");
- }
- }else{
- Py_DECREF(f);
- return EXPP_ReturnIntError(PyExc_AttributeError,
- "point.attribute = x: unknown attribute\n");
- }
-
- Py_DECREF(f);
- return 0;
-}
-//----------------------------print object (internal)-------------
-//print the object to screen
-static PyObject *Point_repr(PointObject * self)
-{
- int i;
- char buffer[48], str[1024];
-
- BLI_strncpy(str,"[",1024);
- for(i = 0; i < self->size; i++){
- if(i < (self->size - 1)){
- sprintf(buffer, "%.6f, ", self->coord[i]);
- strcat(str,buffer);
- }else{
- sprintf(buffer, "%.6f", self->coord[i]);
- strcat(str,buffer);
- }
- }
- strcat(str, "](point)");
-
- return PyString_FromString(str);
-}
-//---------------------SEQUENCE PROTOCOLS------------------------
-//----------------------------len(object)------------------------
-//sequence length
-static int Point_len(PointObject * self)
-{
- return self->size;
-}
-//----------------------------object[]---------------------------
-//sequence accessor (get)
-static PyObject *Point_item(PointObject * self, int i)
-{
- if(i < 0 || i >= self->size)
- return EXPP_ReturnPyObjError(PyExc_IndexError,
- "point[attribute]: array index out of range\n");
-
- return PyFloat_FromDouble( (double)self->coord[i] );
-
-}
-//----------------------------object[]-------------------------
-//sequence accessor (set)
-static int Point_ass_item(PointObject * self, int i, PyObject * ob)
-{
- PyObject *f = NULL;
-
- f = PyNumber_Float(ob);
- if(f == NULL) { // parsed item not a number
- return EXPP_ReturnIntError(PyExc_TypeError,
- "point[attribute] = x: argument not a number\n");
- }
-
- if(i < 0 || i >= self->size){
- Py_DECREF(f);
- return EXPP_ReturnIntError(PyExc_IndexError,
- "point[attribute] = x: array assignment index out of range\n");
- }
- self->coord[i] = (float)PyFloat_AS_DOUBLE(f);
- Py_DECREF(f);
- return 0;
-}
-//----------------------------object[z:y]------------------------
-//sequence slice (get)
-static PyObject *Point_slice(PointObject * self, int begin, int end)
-{
- PyObject *list = NULL;
- int count;
-
- CLAMP(begin, 0, self->size);
- CLAMP(end, 0, self->size);
- begin = MIN2(begin,end);
-
- list = PyList_New(end - begin);
- for(count = begin; count < end; count++) {
- PyList_SetItem(list, count - begin,
- PyFloat_FromDouble(self->coord[count]));
- }
-
- return list;
-}
-//----------------------------object[z:y]------------------------
-//sequence slice (set)
-static int Point_ass_slice(PointObject * self, int begin, int end,
- PyObject * seq)
-{
- int i, y, size = 0;
- float coord[3];
- PyObject *v, *f;
-
- CLAMP(begin, 0, self->size);
- CLAMP(end, 0, self->size);
- begin = MIN2(begin,end);
-
- size = PySequence_Length(seq);
- if(size != (end - begin)){
- return EXPP_ReturnIntError(PyExc_TypeError,
- "point[begin:end] = []: size mismatch in slice assignment\n");
- }
-
- for (i = 0; i < size; i++) {
- v = PySequence_GetItem(seq, i);
- if (v == NULL) { // Failed to read sequence
- return EXPP_ReturnIntError(PyExc_RuntimeError,
- "point[begin:end] = []: unable to read sequence\n");
- }
- f = PyNumber_Float(v);
- if(f == NULL) { // parsed item not a number
- Py_DECREF(v);
- return EXPP_ReturnIntError(PyExc_TypeError,
- "point[begin:end] = []: sequence argument not a number\n");
- }
-
- coord[i] = (float)PyFloat_AS_DOUBLE(f);
- EXPP_decr2(f,v);
- }
- //parsed well - now set in point
- for(y = 0; y < size; y++){
- self->coord[begin + y] = coord[y];
- }
- return 0;
-}
-//------------------------NUMERIC PROTOCOLS----------------------
-//------------------------obj + obj------------------------------
-//addition
-static PyObject *Point_add(PyObject * v1, PyObject * v2)
-{
- int x, size;
- float coord[3];
- PointObject *coord1 = NULL, *coord2 = NULL;
- VectorObject *vec = NULL;
-
- coord1 = (PointObject*)v1;
- coord2 = (PointObject*)v2;
-
- if(!coord1->coerced_object){
- if(coord2->coerced_object){
- if(VectorObject_Check(coord2->coerced_object)){ //POINT + VECTOR
- //Point translation
- vec = (VectorObject*)coord2->coerced_object;
- size = coord1->size;
- if(vec->size == size){
- for(x = 0; x < size; x++){
- coord[x] = coord1->coord[x] + vec->vec[x];
- }
- }else{
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Point addition: arguments are the wrong size....\n");
- }
- return newPointObject(coord, size, Py_NEW);
- }
- }else{ //POINT + POINT
- size = coord1->size;
- if(coord2->size == size){
- for(x = 0; x < size; x++) {
- coord[x] = coord1->coord[x] + coord2->coord[x];
- }
- }else{
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Point addition: arguments are the wrong size....\n");
- }
- return newPointObject(coord, size, Py_NEW);
- }
- }
-
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Point addition: arguments not valid for this operation....\n");
-}
-//------------------------obj - obj------------------------------
-//subtraction
-static PyObject *Point_sub(PyObject * v1, PyObject * v2)
-{
- int x, size;
- float coord[3];
- PointObject *coord1 = NULL, *coord2 = NULL;
-
- coord1 = (PointObject*)v1;
- coord2 = (PointObject*)v2;
-
- if(coord1->coerced_object || coord2->coerced_object){
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Point subtraction: arguments not valid for this operation....\n");
- }
- if(coord1->size != coord2->size){
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Point subtraction: points must have the same dimensions for this operation\n");
- }
-
- size = coord1->size;
- for(x = 0; x < size; x++) {
- coord[x] = coord1->coord[x] - coord2->coord[x];
- }
-
- //Point - Point = Vector
- return newVectorObject(coord, size, Py_NEW);
-}
-//------------------------obj * obj------------------------------
-//mulplication
-static PyObject *Point_mul(PyObject * p1, PyObject * p2)
-{
- int x, size;
- float coord[3], scalar;
- PointObject *coord1 = NULL, *coord2 = NULL;
- PyObject *f = NULL;
- MatrixObject *mat = NULL;
- QuaternionObject *quat = NULL;
-
- coord1 = (PointObject*)p1;
- coord2 = (PointObject*)p2;
-
- if(coord1->coerced_object){
- if (PyFloat_Check(coord1->coerced_object) ||
- PyInt_Check(coord1->coerced_object)){ // FLOAT/INT * POINT
- f = PyNumber_Float(coord1->coerced_object);
- if(f == NULL) { // parsed item not a number
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Point multiplication: arguments not acceptable for this operation\n");
- }
-
- scalar = (float)PyFloat_AS_DOUBLE(f);
- size = coord2->size;
- for(x = 0; x < size; x++) {
- coord[x] = coord2->coord[x] * scalar;
- }
- Py_DECREF(f);
- return newPointObject(coord, size, Py_NEW);
- }
- }else{
- if(coord2->coerced_object){
- if (PyFloat_Check(coord2->coerced_object) ||
- PyInt_Check(coord2->coerced_object)){ // POINT * FLOAT/INT
- f = PyNumber_Float(coord2->coerced_object);
- if(f == NULL) { // parsed item not a number
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Point multiplication: arguments not acceptable for this operation\n");
- }
-
- scalar = (float)PyFloat_AS_DOUBLE(f);
- size = coord1->size;
- for(x = 0; x < size; x++) {
- coord[x] = coord1->coord[x] * scalar;
- }
- Py_DECREF(f);
- return newPointObject(coord, size, Py_NEW);
- }else if(MatrixObject_Check(coord2->coerced_object)){ //POINT * MATRIX
- mat = (MatrixObject*)coord2->coerced_object;
- return row_point_multiplication(coord1, mat);
- }else if(QuaternionObject_Check(coord2->coerced_object)){ //POINT * QUATERNION
- quat = (QuaternionObject*)coord2->coerced_object;
- if(coord1->size != 3){
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Point multiplication: only 3D point rotations (with quats) currently supported\n");
- }
- return quat_rotation((PyObject*)coord1, (PyObject*)quat);
- }
- }
- }
-
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Point multiplication: arguments not acceptable for this operation\n");
-}
-//-------------------------- -obj -------------------------------
-//returns the negative of this object
-static PyObject *Point_neg(PointObject *self)
-{
- int x;
- float coord[3];
-
- for(x = 0; x < self->size; x++)
- coord[x] = -self->coord[x];
-
- return newPointObject(coord, self->size, Py_NEW);
-}
-
-//------------------------coerce(obj, obj)-----------------------
-//coercion of unknown types to type PointObject for numeric protocols
-/*Coercion() is called whenever a math operation has 2 operands that
- it doesn't understand how to evaluate. 2+Matrix for example. We want to
- evaluate some of these operations like: (vector * 2), however, for math
- to proceed, the unknown operand must be cast to a type that python math will
- understand. (e.g. in the case above case, 2 must be cast to a vector and
- then call vector.multiply(vector, scalar_cast_as_vector)*/
-static int Point_coerce(PyObject ** p1, PyObject ** p2)
-{
- if(VectorObject_Check(*p2) || PyFloat_Check(*p2) || PyInt_Check(*p2) ||
- MatrixObject_Check(*p2) || QuaternionObject_Check(*p2)) {
- PyObject *coerced = EXPP_incr_ret(*p2);
- *p2 = newPointObject(NULL,3,Py_NEW);
- ((PointObject*)*p2)->coerced_object = coerced;
- Py_INCREF (*p1);
- return 0;
- }
-
- return EXPP_ReturnIntError(PyExc_TypeError,
- "point.coerce(): unknown operand - can't coerce for numeric protocols");
-}
-//-----------------PROTOCOL DECLARATIONS--------------------------
-static PySequenceMethods Point_SeqMethods = {
- (inquiry) Point_len, /* sq_length */
- (binaryfunc) 0, /* sq_concat */
- (intargfunc) 0, /* sq_repeat */
- (intargfunc) Point_item, /* sq_item */
- (intintargfunc) Point_slice, /* sq_slice */
- (intobjargproc) Point_ass_item, /* sq_ass_item */
- (intintobjargproc) Point_ass_slice, /* sq_ass_slice */
-};
-static PyNumberMethods Point_NumMethods = {
- (binaryfunc) Point_add, /* __add__ */
- (binaryfunc) Point_sub, /* __sub__ */
- (binaryfunc) Point_mul, /* __mul__ */
- (binaryfunc) 0, /* __div__ */
- (binaryfunc) 0, /* __mod__ */
- (binaryfunc) 0, /* __divmod__ */
- (ternaryfunc) 0, /* __pow__ */
- (unaryfunc) Point_neg, /* __neg__ */
- (unaryfunc) 0, /* __pos__ */
- (unaryfunc) 0, /* __abs__ */
- (inquiry) 0, /* __nonzero__ */
- (unaryfunc) 0, /* __invert__ */
- (binaryfunc) 0, /* __lshift__ */
- (binaryfunc) 0, /* __rshift__ */
- (binaryfunc) 0, /* __and__ */
- (binaryfunc) 0, /* __xor__ */
- (binaryfunc) 0, /* __or__ */
- (coercion) Point_coerce, /* __coerce__ */
- (unaryfunc) 0, /* __int__ */
- (unaryfunc) 0, /* __long__ */
- (unaryfunc) 0, /* __float__ */
- (unaryfunc) 0, /* __oct__ */
- (unaryfunc) 0, /* __hex__ */
-
-};
-//------------------PY_OBECT DEFINITION--------------------------
-PyTypeObject point_Type = {
- PyObject_HEAD_INIT(NULL)
- 0, /*ob_size */
- "point", /*tp_name */
- sizeof(PointObject), /*tp_basicsize */
- 0, /*tp_itemsize */
- (destructor) Point_dealloc, /*tp_dealloc */
- (printfunc) 0, /*tp_print */
- (getattrfunc) Point_getattr, /*tp_getattr */
- (setattrfunc) Point_setattr, /*tp_setattr */
- 0, /*tp_compare */
- (reprfunc) Point_repr, /*tp_repr */
- &Point_NumMethods, /*tp_as_number */
- &Point_SeqMethods, /*tp_as_sequence */
-};
-//------------------------newPointObject (internal)-------------
-//creates a new point object
-/*pass Py_WRAP - if point is a WRAPPER for data allocated by BLENDER
- (i.e. it was allocated elsewhere by MEM_mallocN())
- pass Py_NEW - if point is not a WRAPPER and managed by PYTHON
- (i.e. it must be created here with PyMEM_malloc())*/
-PyObject *newPointObject(float *coord, int size, int type)
-{
- PointObject *self;
- int x;
-
- point_Type.ob_type = &PyType_Type;
- self = PyObject_NEW(PointObject, &point_Type);
- self->data.blend_data = NULL;
- self->data.py_data = NULL;
- if(size > 3 || size < 2)
- return NULL;
- self->size = size;
- self->coerced_object = NULL;
-
- if(type == Py_WRAP){
- self->data.blend_data = coord;
- self->coord = self->data.blend_data;
- self->wrapped = Py_WRAP;
- }else if (type == Py_NEW){
- self->data.py_data = PyMem_Malloc(size * sizeof(float));
- self->coord = self->data.py_data;
- if(!coord) { //new empty
- for(x = 0; x < size; x++){
- self->coord[x] = 0.0f;
- }
- }else{
- for(x = 0; x < size; x++){
- self->coord[x] = coord[x];
- }
- }
- self->wrapped = Py_NEW;
- }else{ //bad type
- return NULL;
- }
- return (PyObject *) self;
-}
diff --git a/source/blender/python/api2_2x/point.h b/source/blender/python/api2_2x/point.h
deleted file mode 100644
index 4ecceb64491..00000000000
--- a/source/blender/python/api2_2x/point.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * $Id: point.h 7266 2006-04-16 15:28:50Z stiv $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Joseph Gilbert
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_point_h
-#define EXPP_point_h
-
-#include <Python.h>
-
-extern PyTypeObject point_Type;
-
-#define PointObject_Check(v) ((v)->ob_type == &point_Type)
-
-typedef struct {
- PyObject_VAR_HEAD
- struct{
- float *py_data; //python managed
- float *blend_data; //blender managed
- }data;
- float *coord; //1D array of data (alias)
- int size;
- int wrapped; //is wrapped data?
- PyObject *coerced_object;
-} PointObject;
-/*coerced_object is a pointer to the object that it was
-coerced from when a dummy vector needs to be created from
-the coerce() function for numeric protocol operations*/
-
-/*struct data contains a pointer to the actual data that the
-object uses. It can use either PyMem allocated data (which will
-be stored in py_data) or be a wrapper for data allocated through
-blender (stored in blend_data). This is an either/or struct not both*/
-
-//prototypes
-PyObject *Point_Zero( PointObject * self );
-PyObject *Point_toVector(PointObject * self);
-PyObject *newPointObject(float *coord, int size, int type);
-
-#endif /* EXPP_point_h */
diff --git a/source/blender/python/api2_2x/quat.c b/source/blender/python/api2_2x/quat.c
deleted file mode 100644
index 19e749f187c..00000000000
--- a/source/blender/python/api2_2x/quat.c
+++ /dev/null
@@ -1,668 +0,0 @@
-/*
- * $Id: quat.c 12314 2007-10-20 20:24:09Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- *
- * Contributor(s): Joseph Gilbert
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include "Mathutils.h"
-
-#include "BLI_arithb.h"
-#include "BKE_utildefines.h"
-#include "BLI_blenlib.h"
-#include "gen_utils.h"
-
-
-//-------------------------DOC STRINGS ---------------------------
-char Quaternion_Identity_doc[] = "() - set the quaternion to it's identity (1, vector)";
-char Quaternion_Negate_doc[] = "() - set all values in the quaternion to their negative";
-char Quaternion_Conjugate_doc[] = "() - set the quaternion to it's conjugate";
-char Quaternion_Inverse_doc[] = "() - set the quaternion to it's inverse";
-char Quaternion_Normalize_doc[] = "() - normalize the vector portion of the quaternion";
-char Quaternion_ToEuler_doc[] = "() - return a euler rotation representing the quaternion";
-char Quaternion_ToMatrix_doc[] = "() - return a rotation matrix representing the quaternion";
-char Quaternion_copy_doc[] = "() - return a copy of the quat";
-//-----------------------METHOD DEFINITIONS ----------------------
-struct PyMethodDef Quaternion_methods[] = {
- {"identity", (PyCFunction) Quaternion_Identity, METH_NOARGS, Quaternion_Identity_doc},
- {"negate", (PyCFunction) Quaternion_Negate, METH_NOARGS, Quaternion_Negate_doc},
- {"conjugate", (PyCFunction) Quaternion_Conjugate, METH_NOARGS, Quaternion_Conjugate_doc},
- {"inverse", (PyCFunction) Quaternion_Inverse, METH_NOARGS, Quaternion_Inverse_doc},
- {"normalize", (PyCFunction) Quaternion_Normalize, METH_NOARGS, Quaternion_Normalize_doc},
- {"toEuler", (PyCFunction) Quaternion_ToEuler, METH_NOARGS, Quaternion_ToEuler_doc},
- {"toMatrix", (PyCFunction) Quaternion_ToMatrix, METH_NOARGS, Quaternion_ToMatrix_doc},
- {"__copy__", (PyCFunction) Quaternion_copy, METH_NOARGS, Quaternion_copy_doc},
- {"copy", (PyCFunction) Quaternion_copy, METH_NOARGS, Quaternion_copy_doc},
- {NULL, NULL, 0, NULL}
-};
-//-----------------------------METHODS------------------------------
-//----------------------------Quaternion.toEuler()------------------
-//return the quat as a euler
-PyObject *Quaternion_ToEuler(QuaternionObject * self)
-{
- float eul[3];
- int x;
-
- QuatToEul(self->quat, eul);
- for(x = 0; x < 3; x++) {
- eul[x] *= (180 / (float)Py_PI);
- }
- return newEulerObject(eul, Py_NEW);
-}
-//----------------------------Quaternion.toMatrix()------------------
-//return the quat as a matrix
-PyObject *Quaternion_ToMatrix(QuaternionObject * self)
-{
- float mat[9] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
- QuatToMat3(self->quat, (float (*)[3]) mat);
-
- return newMatrixObject(mat, 3, 3, Py_NEW);
-}
-//----------------------------Quaternion.normalize()----------------
-//normalize the axis of rotation of [theta,vector]
-PyObject *Quaternion_Normalize(QuaternionObject * self)
-{
- NormalQuat(self->quat);
- return EXPP_incr_ret((PyObject*)self);
-}
-//----------------------------Quaternion.inverse()------------------
-//invert the quat
-PyObject *Quaternion_Inverse(QuaternionObject * self)
-{
- double mag = 0.0f;
- int x;
-
- for(x = 1; x < 4; x++) {
- self->quat[x] = -self->quat[x];
- }
- for(x = 0; x < 4; x++) {
- mag += (self->quat[x] * self->quat[x]);
- }
- mag = sqrt(mag);
- for(x = 0; x < 4; x++) {
- self->quat[x] /= (float)(mag * mag);
- }
-
- return EXPP_incr_ret((PyObject*)self);
-}
-//----------------------------Quaternion.identity()-----------------
-//generate the identity quaternion
-PyObject *Quaternion_Identity(QuaternionObject * self)
-{
- self->quat[0] = 1.0;
- self->quat[1] = 0.0;
- self->quat[2] = 0.0;
- self->quat[3] = 0.0;
-
- return EXPP_incr_ret((PyObject*)self);
-}
-//----------------------------Quaternion.negate()-------------------
-//negate the quat
-PyObject *Quaternion_Negate(QuaternionObject * self)
-{
- int x;
- for(x = 0; x < 4; x++) {
- self->quat[x] = -self->quat[x];
- }
- return EXPP_incr_ret((PyObject*)self);
-}
-//----------------------------Quaternion.conjugate()----------------
-//negate the vector part
-PyObject *Quaternion_Conjugate(QuaternionObject * self)
-{
- int x;
- for(x = 1; x < 4; x++) {
- self->quat[x] = -self->quat[x];
- }
- return EXPP_incr_ret((PyObject*)self);
-}
-//----------------------------Quaternion.copy()----------------
-//return a copy of the quat
-PyObject *Quaternion_copy(QuaternionObject * self)
-{
- return newQuaternionObject(self->quat, Py_NEW);
-}
-
-//----------------------------dealloc()(internal) ------------------
-//free the py_object
-static void Quaternion_dealloc(QuaternionObject * self)
-{
- Py_XDECREF(self->coerced_object);
- //only free py_data
- if(self->data.py_data){
- PyMem_Free(self->data.py_data);
- }
- PyObject_DEL(self);
-}
-//----------------------------getattr()(internal) ------------------
-//object.attribute access (get)
-static PyObject *Quaternion_getattr(QuaternionObject * self, char *name)
-{
- int x;
- double mag = 0.0f;
- float vec[3];
-
- if(STREQ(name,"w")){
- return PyFloat_FromDouble(self->quat[0]);
- }else if(STREQ(name, "x")){
- return PyFloat_FromDouble(self->quat[1]);
- }else if(STREQ(name, "y")){
- return PyFloat_FromDouble(self->quat[2]);
- }else if(STREQ(name, "z")){
- return PyFloat_FromDouble(self->quat[3]);
- }
- if(STREQ(name, "magnitude")) {
- for(x = 0; x < 4; x++) {
- mag += self->quat[x] * self->quat[x];
- }
- mag = sqrt(mag);
- return PyFloat_FromDouble(mag);
- }
- if(STREQ(name, "angle")) {
- mag = self->quat[0];
- mag = 2 * (acos(mag));
- mag *= (180 / Py_PI);
- return PyFloat_FromDouble(mag);
- }
- if(STREQ(name, "axis")) {
- mag = self->quat[0] * (Py_PI / 180);
- mag = 2 * (acos(mag));
- mag = sin(mag / 2);
- for(x = 0; x < 3; x++) {
- vec[x] = (float)(self->quat[x + 1] / mag);
- }
- Normalize(vec);
- //If the axis of rotation is 0,0,0 set it to 1,0,0 - for zero-degree rotations
- if( EXPP_FloatsAreEqual(vec[0], 0.0f, 10) &&
- EXPP_FloatsAreEqual(vec[1], 0.0f, 10) &&
- EXPP_FloatsAreEqual(vec[2], 0.0f, 10) ){
- vec[0] = 1.0f;
- }
- return (PyObject *) newVectorObject(vec, 3, Py_NEW);
- }
- if(STREQ(name, "wrapped")){
- if(self->wrapped == Py_WRAP)
- return EXPP_incr_ret((PyObject *)Py_True);
- else
- return EXPP_incr_ret((PyObject *)Py_False);
- }
-
- return Py_FindMethod(Quaternion_methods, (PyObject *) self, name);
-}
-//----------------------------setattr()(internal) ------------------
-//object.attribute access (set)
-static int Quaternion_setattr(QuaternionObject * self, char *name, PyObject * q)
-{
- PyObject *f = NULL;
-
- f = PyNumber_Float(q);
- if(f == NULL) { // parsed item not a number
- return EXPP_ReturnIntError(PyExc_TypeError,
- "quaternion.attribute = x: argument not a number\n");
- }
-
- if(STREQ(name,"w")){
- self->quat[0] = (float)PyFloat_AS_DOUBLE(f);
- }else if(STREQ(name, "x")){
- self->quat[1] = (float)PyFloat_AS_DOUBLE(f);
- }else if(STREQ(name, "y")){
- self->quat[2] = (float)PyFloat_AS_DOUBLE(f);
- }else if(STREQ(name, "z")){
- self->quat[3] = (float)PyFloat_AS_DOUBLE(f);
- }else{
- Py_DECREF(f);
- return EXPP_ReturnIntError(PyExc_AttributeError,
- "quaternion.attribute = x: unknown attribute\n");
- }
-
- Py_DECREF(f);
- return 0;
-}
-//----------------------------print object (internal)--------------
-//print the object to screen
-static PyObject *Quaternion_repr(QuaternionObject * self)
-{
- int i;
- char buffer[48], str[1024];
-
- BLI_strncpy(str,"[",1024);
- for(i = 0; i < 4; i++){
- if(i < (3)){
- sprintf(buffer, "%.6f, ", self->quat[i]);
- strcat(str,buffer);
- }else{
- sprintf(buffer, "%.6f", self->quat[i]);
- strcat(str,buffer);
- }
- }
- strcat(str, "](quaternion)");
-
- return PyString_FromString(str);
-}
-//------------------------tp_richcmpr
-//returns -1 execption, 0 false, 1 true
-static PyObject* Quaternion_richcmpr(PyObject *objectA, PyObject *objectB, int comparison_type)
-{
- QuaternionObject *quatA = NULL, *quatB = NULL;
- int result = 0;
-
- if (!QuaternionObject_Check(objectA) || !QuaternionObject_Check(objectB)){
- if (comparison_type == Py_NE){
- return EXPP_incr_ret(Py_True);
- }else{
- return EXPP_incr_ret(Py_False);
- }
- }
- quatA = (QuaternionObject*)objectA;
- quatB = (QuaternionObject*)objectB;
-
- switch (comparison_type){
- case Py_EQ:
- result = EXPP_VectorsAreEqual(quatA->quat, quatB->quat, 4, 1);
- break;
- case Py_NE:
- result = EXPP_VectorsAreEqual(quatA->quat, quatB->quat, 4, 1);
- if (result == 0){
- result = 1;
- }else{
- result = 0;
- }
- break;
- default:
- printf("The result of the comparison could not be evaluated");
- break;
- }
- if (result == 1){
- return EXPP_incr_ret(Py_True);
- }else{
- return EXPP_incr_ret(Py_False);
- }
-}
-//------------------------tp_doc
-static char QuaternionObject_doc[] = "This is a wrapper for quaternion objects.";
-//---------------------SEQUENCE PROTOCOLS------------------------
-//----------------------------len(object)------------------------
-//sequence length
-static int Quaternion_len(QuaternionObject * self)
-{
- return 4;
-}
-//----------------------------object[]---------------------------
-//sequence accessor (get)
-static PyObject *Quaternion_item(QuaternionObject * self, int i)
-{
- if(i < 0 || i >= 4)
- return EXPP_ReturnPyObjError(PyExc_IndexError,
- "quaternion[attribute]: array index out of range\n");
- return PyFloat_FromDouble(self->quat[i]);
-
-}
-//----------------------------object[]-------------------------
-//sequence accessor (set)
-static int Quaternion_ass_item(QuaternionObject * self, int i, PyObject * ob)
-{
- PyObject *f = NULL;
-
- f = PyNumber_Float(ob);
- if(f == NULL) { // parsed item not a number
- return EXPP_ReturnIntError(PyExc_TypeError,
- "quaternion[attribute] = x: argument not a number\n");
- }
-
- if(i < 0 || i >= 4){
- Py_DECREF(f);
- return EXPP_ReturnIntError(PyExc_IndexError,
- "quaternion[attribute] = x: array assignment index out of range\n");
- }
- self->quat[i] = (float)PyFloat_AS_DOUBLE(f);
- Py_DECREF(f);
- return 0;
-}
-//----------------------------object[z:y]------------------------
-//sequence slice (get)
-static PyObject *Quaternion_slice(QuaternionObject * self, int begin, int end)
-{
- PyObject *list = NULL;
- int count;
-
- CLAMP(begin, 0, 4);
- if (end<0) end= 5+end;
- CLAMP(end, 0, 4);
- begin = MIN2(begin,end);
-
- list = PyList_New(end - begin);
- for(count = begin; count < end; count++) {
- PyList_SetItem(list, count - begin,
- PyFloat_FromDouble(self->quat[count]));
- }
-
- return list;
-}
-//----------------------------object[z:y]------------------------
-//sequence slice (set)
-static int Quaternion_ass_slice(QuaternionObject * self, int begin, int end,
- PyObject * seq)
-{
- int i, y, size = 0;
- float quat[4];
- PyObject *q, *f;
-
- CLAMP(begin, 0, 4);
- if (end<0) end= 5+end;
- CLAMP(end, 0, 4);
- begin = MIN2(begin,end);
-
- size = PySequence_Length(seq);
- if(size != (end - begin)){
- return EXPP_ReturnIntError(PyExc_TypeError,
- "quaternion[begin:end] = []: size mismatch in slice assignment\n");
- }
-
- for (i = 0; i < size; i++) {
- q = PySequence_GetItem(seq, i);
- if (q == NULL) { // Failed to read sequence
- return EXPP_ReturnIntError(PyExc_RuntimeError,
- "quaternion[begin:end] = []: unable to read sequence\n");
- }
-
- f = PyNumber_Float(q);
- if(f == NULL) { // parsed item not a number
- Py_DECREF(q);
- return EXPP_ReturnIntError(PyExc_TypeError,
- "quaternion[begin:end] = []: sequence argument not a number\n");
- }
-
- quat[i] = (float)PyFloat_AS_DOUBLE(f);
- EXPP_decr2(f,q);
- }
- //parsed well - now set in vector
- for(y = 0; y < size; y++){
- self->quat[begin + y] = quat[y];
- }
- return 0;
-}
-//------------------------NUMERIC PROTOCOLS----------------------
-//------------------------obj + obj------------------------------
-//addition
-static PyObject *Quaternion_add(PyObject * q1, PyObject * q2)
-{
- int x;
- float quat[4];
- QuaternionObject *quat1 = NULL, *quat2 = NULL;
-
- quat1 = (QuaternionObject*)q1;
- quat2 = (QuaternionObject*)q2;
-
- if(quat1->coerced_object || quat2->coerced_object){
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Quaternion addition: arguments not valid for this operation....\n");
- }
- for(x = 0; x < 4; x++) {
- quat[x] = quat1->quat[x] + quat2->quat[x];
- }
-
- return newQuaternionObject(quat, Py_NEW);
-}
-//------------------------obj - obj------------------------------
-//subtraction
-static PyObject *Quaternion_sub(PyObject * q1, PyObject * q2)
-{
- int x;
- float quat[4];
- QuaternionObject *quat1 = NULL, *quat2 = NULL;
-
- quat1 = (QuaternionObject*)q1;
- quat2 = (QuaternionObject*)q2;
-
- if(quat1->coerced_object || quat2->coerced_object){
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Quaternion addition: arguments not valid for this operation....\n");
- }
- for(x = 0; x < 4; x++) {
- quat[x] = quat1->quat[x] - quat2->quat[x];
- }
-
- return newQuaternionObject(quat, Py_NEW);
-}
-//------------------------obj * obj------------------------------
-//mulplication
-static PyObject *Quaternion_mul(PyObject * q1, PyObject * q2)
-{
- int x;
- float quat[4], scalar;
- double dot = 0.0f;
- QuaternionObject *quat1 = NULL, *quat2 = NULL;
- PyObject *f = NULL;
- VectorObject *vec = NULL;
- PointObject *pt = NULL;
-
- quat1 = (QuaternionObject*)q1;
- quat2 = (QuaternionObject*)q2;
-
- if(quat1->coerced_object){
- if (PyFloat_Check(quat1->coerced_object) ||
- PyInt_Check(quat1->coerced_object)){ // FLOAT/INT * QUAT
- f = PyNumber_Float(quat1->coerced_object);
- if(f == NULL) { // parsed item not a number
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Quaternion multiplication: arguments not acceptable for this operation\n");
- }
-
- scalar = (float)PyFloat_AS_DOUBLE(f);
- Py_DECREF(f);
- for(x = 0; x < 4; x++) {
- quat[x] = quat2->quat[x] * scalar;
- }
- return newQuaternionObject(quat, Py_NEW);
- }
- }else{
- if(quat2->coerced_object){
- if (PyFloat_Check(quat2->coerced_object) ||
- PyInt_Check(quat2->coerced_object)){ // QUAT * FLOAT/INT
- f = PyNumber_Float(quat2->coerced_object);
- if(f == NULL) { // parsed item not a number
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Quaternion multiplication: arguments not acceptable for this operation\n");
- }
-
- scalar = (float)PyFloat_AS_DOUBLE(f);
- Py_DECREF(f);
- for(x = 0; x < 4; x++) {
- quat[x] = quat1->quat[x] * scalar;
- }
- return newQuaternionObject(quat, Py_NEW);
- }else if(VectorObject_Check(quat2->coerced_object)){ //QUAT * VEC
- vec = (VectorObject*)quat2->coerced_object;
- if(vec->size != 3){
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Quaternion multiplication: only 3D vector rotations currently supported\n");
- }
- return quat_rotation((PyObject*)quat1, (PyObject*)vec);
- }else if(PointObject_Check(quat2->coerced_object)){ //QUAT * POINT
- pt = (PointObject*)quat2->coerced_object;
- if(pt->size != 3){
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Quaternion multiplication: only 3D point rotations currently supported\n");
- }
- return quat_rotation((PyObject*)quat1, (PyObject*)pt);
- }
- }else{ //QUAT * QUAT (dot product)
- for(x = 0; x < 4; x++) {
- dot += quat1->quat[x] * quat1->quat[x];
- }
- return PyFloat_FromDouble(dot);
- }
- }
-
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Quaternion multiplication: arguments not acceptable for this operation\n");
-}
-//------------------------coerce(obj, obj)-----------------------
-//coercion of unknown types to type QuaternionObject for numeric protocols
-/*Coercion() is called whenever a math operation has 2 operands that
- it doesn't understand how to evaluate. 2+Matrix for example. We want to
- evaluate some of these operations like: (vector * 2), however, for math
- to proceed, the unknown operand must be cast to a type that python math will
- understand. (e.g. in the case above case, 2 must be cast to a vector and
- then call vector.multiply(vector, scalar_cast_as_vector)*/
-static int Quaternion_coerce(PyObject ** q1, PyObject ** q2)
-{
- if(VectorObject_Check(*q2) || PyFloat_Check(*q2) || PyInt_Check(*q2) ||
- PointObject_Check(*q2)) {
- PyObject *coerced = EXPP_incr_ret(*q2);
- *q2 = newQuaternionObject(NULL,Py_NEW);
- ((QuaternionObject*)*q2)->coerced_object = coerced;
- Py_INCREF (*q1);
- return 0;
- }
-
- return EXPP_ReturnIntError(PyExc_TypeError,
- "quaternion.coerce(): unknown operand - can't coerce for numeric protocols");
-}
-//-----------------PROTOCOL DECLARATIONS--------------------------
-static PySequenceMethods Quaternion_SeqMethods = {
- (inquiry) Quaternion_len, /* sq_length */
- (binaryfunc) 0, /* sq_concat */
- (intargfunc) 0, /* sq_repeat */
- (intargfunc) Quaternion_item, /* sq_item */
- (intintargfunc) Quaternion_slice, /* sq_slice */
- (intobjargproc) Quaternion_ass_item, /* sq_ass_item */
- (intintobjargproc) Quaternion_ass_slice, /* sq_ass_slice */
-};
-static PyNumberMethods Quaternion_NumMethods = {
- (binaryfunc) Quaternion_add, /* __add__ */
- (binaryfunc) Quaternion_sub, /* __sub__ */
- (binaryfunc) Quaternion_mul, /* __mul__ */
- (binaryfunc) 0, /* __div__ */
- (binaryfunc) 0, /* __mod__ */
- (binaryfunc) 0, /* __divmod__ */
- (ternaryfunc) 0, /* __pow__ */
- (unaryfunc) 0, /* __neg__ */
- (unaryfunc) 0, /* __pos__ */
- (unaryfunc) 0, /* __abs__ */
- (inquiry) 0, /* __nonzero__ */
- (unaryfunc) 0, /* __invert__ */
- (binaryfunc) 0, /* __lshift__ */
- (binaryfunc) 0, /* __rshift__ */
- (binaryfunc) 0, /* __and__ */
- (binaryfunc) 0, /* __xor__ */
- (binaryfunc) 0, /* __or__ */
- (coercion) Quaternion_coerce, /* __coerce__ */
- (unaryfunc) 0, /* __int__ */
- (unaryfunc) 0, /* __long__ */
- (unaryfunc) 0, /* __float__ */
- (unaryfunc) 0, /* __oct__ */
- (unaryfunc) 0, /* __hex__ */
-
-};
-//------------------PY_OBECT DEFINITION--------------------------
-PyTypeObject quaternion_Type = {
-PyObject_HEAD_INIT(NULL) //tp_head
- 0, //tp_internal
- "quaternion", //tp_name
- sizeof(QuaternionObject), //tp_basicsize
- 0, //tp_itemsize
- (destructor)Quaternion_dealloc, //tp_dealloc
- 0, //tp_print
- (getattrfunc)Quaternion_getattr, //tp_getattr
- (setattrfunc) Quaternion_setattr, //tp_setattr
- 0, //tp_compare
- (reprfunc) Quaternion_repr, //tp_repr
- &Quaternion_NumMethods, //tp_as_number
- &Quaternion_SeqMethods, //tp_as_sequence
- 0, //tp_as_mapping
- 0, //tp_hash
- 0, //tp_call
- 0, //tp_str
- 0, //tp_getattro
- 0, //tp_setattro
- 0, //tp_as_buffer
- Py_TPFLAGS_DEFAULT, //tp_flags
- QuaternionObject_doc, //tp_doc
- 0, //tp_traverse
- 0, //tp_clear
- (richcmpfunc)Quaternion_richcmpr, //tp_richcompare
- 0, //tp_weaklistoffset
- 0, //tp_iter
- 0, //tp_iternext
- 0, //tp_methods
- 0, //tp_members
- 0, //tp_getset
- 0, //tp_base
- 0, //tp_dict
- 0, //tp_descr_get
- 0, //tp_descr_set
- 0, //tp_dictoffset
- 0, //tp_init
- 0, //tp_alloc
- 0, //tp_new
- 0, //tp_free
- 0, //tp_is_gc
- 0, //tp_bases
- 0, //tp_mro
- 0, //tp_cache
- 0, //tp_subclasses
- 0, //tp_weaklist
- 0 //tp_del
-};
-//------------------------newQuaternionObject (internal)-------------
-//creates a new quaternion object
-/*pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER
- (i.e. it was allocated elsewhere by MEM_mallocN())
- pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON
- (i.e. it must be created here with PyMEM_malloc())*/
-PyObject *newQuaternionObject(float *quat, int type)
-{
- QuaternionObject *self;
- int x;
-
- self = PyObject_NEW(QuaternionObject, &quaternion_Type);
- self->data.blend_data = NULL;
- self->data.py_data = NULL;
- self->coerced_object = NULL;
-
- if(type == Py_WRAP){
- self->data.blend_data = quat;
- self->quat = self->data.blend_data;
- self->wrapped = Py_WRAP;
- }else if (type == Py_NEW){
- self->data.py_data = PyMem_Malloc(4 * sizeof(float));
- self->quat = self->data.py_data;
- if(!quat) { //new empty
- Quaternion_Identity(self);
- Py_DECREF(self);
- }else{
- for(x = 0; x < 4; x++){
- self->quat[x] = quat[x];
- }
- }
- self->wrapped = Py_NEW;
- }else{ //bad type
- return NULL;
- }
- return (PyObject *) self;
-}
diff --git a/source/blender/python/api2_2x/quat.h b/source/blender/python/api2_2x/quat.h
deleted file mode 100644
index c66300de498..00000000000
--- a/source/blender/python/api2_2x/quat.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * $Id: quat.h 8367 2006-08-22 09:13:44Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joseph Gilbert
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- *
- */
-
-#ifndef EXPP_quat_h
-#define EXPP_quat_h
-
-#include <Python.h>
-
-extern PyTypeObject quaternion_Type;
-
-#define QuaternionObject_Check(v) ((v)->ob_type == &quaternion_Type)
-
-typedef struct {
- PyObject_VAR_HEAD
- struct{
- float *py_data; //python managed
- float *blend_data; //blender managed
- }data;
- float *quat; //1D array of data (alias)
- int wrapped; //is wrapped data?
- PyObject *coerced_object;
-} QuaternionObject;
-/*coerced_object is a pointer to the object that it was
-coerced from when a dummy vector needs to be created from
-the coerce() function for numeric protocol operations*/
-
-/*struct data contains a pointer to the actual data that the
-object uses. It can use either PyMem allocated data (which will
-be stored in py_data) or be a wrapper for data allocated through
-blender (stored in blend_data). This is an either/or struct not both*/
-
-//prototypes
-PyObject *Quaternion_Identity( QuaternionObject * self );
-PyObject *Quaternion_Negate( QuaternionObject * self );
-PyObject *Quaternion_Conjugate( QuaternionObject * self );
-PyObject *Quaternion_Inverse( QuaternionObject * self );
-PyObject *Quaternion_Normalize( QuaternionObject * self );
-PyObject *Quaternion_ToEuler( QuaternionObject * self );
-PyObject *Quaternion_ToMatrix( QuaternionObject * self );
-PyObject *Quaternion_copy( QuaternionObject * self );
-PyObject *newQuaternionObject( float *quat, int type );
-
-#endif /* EXPP_quat_h */
diff --git a/source/blender/python/api2_2x/rgbTuple.c b/source/blender/python/api2_2x/rgbTuple.c
deleted file mode 100644
index 85fa26433fc..00000000000
--- a/source/blender/python/api2_2x/rgbTuple.c
+++ /dev/null
@@ -1,420 +0,0 @@
-/*
- * $Id: rgbTuple.c 11713 2007-08-19 19:06:42Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#include "rgbTuple.h" /*This must come first */
-
-#include "gen_utils.h"
-
-/* This file is heavily based on the old bpython Constant object code in
- Blender */
-
-/*****************************************************************************/
-/* Python rgbTuple_Type callback function prototypes: */
-/*****************************************************************************/
-static PyObject *rgbTuple_getAttr( BPy_rgbTuple * self, char *name );
-static int rgbTuple_setAttr( BPy_rgbTuple * self, char *name, PyObject * v );
-static PyObject *rgbTuple_repr( BPy_rgbTuple * self );
-
-static int rgbTupleLength( void );
-
-static PyObject *rgbTupleSubscript( BPy_rgbTuple * self, PyObject * key );
-static int rgbTupleAssSubscript( BPy_rgbTuple * self, PyObject * who,
- PyObject * cares );
-
-static PyObject *rgbTupleItem( BPy_rgbTuple * self, int i );
-static int rgbTupleAssItem( BPy_rgbTuple * self, int i, PyObject * ob );
-static PyObject *rgbTupleSlice( BPy_rgbTuple * self, int begin, int end );
-static int rgbTupleAssSlice( BPy_rgbTuple * self, int begin, int end,
- PyObject * seq );
-
-/*****************************************************************************/
-/* Python rgbTuple_Type Mapping Methods table: */
-/*****************************************************************************/
-static PyMappingMethods rgbTupleAsMapping = {
- ( inquiry ) rgbTupleLength, /* mp_length */
- ( binaryfunc ) rgbTupleSubscript, /* mp_subscript */
- ( objobjargproc ) rgbTupleAssSubscript, /* mp_ass_subscript */
-};
-
-/*****************************************************************************/
-/* Python rgbTuple_Type Sequence Methods table: */
-/*****************************************************************************/
-static PySequenceMethods rgbTupleAsSequence = {
- ( inquiry ) rgbTupleLength, /* sq_length */
- ( binaryfunc ) 0, /* sq_concat */
- ( intargfunc ) 0, /* sq_repeat */
- ( intargfunc ) rgbTupleItem, /* sq_item */
- ( intintargfunc ) rgbTupleSlice, /* sq_slice */
- ( intobjargproc ) rgbTupleAssItem, /* sq_ass_item */
- ( intintobjargproc ) rgbTupleAssSlice, /* sq_ass_slice */
- 0,0,0
-};
-
-/*****************************************************************************/
-/* Python rgbTuple_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject rgbTuple_Type = {
- PyObject_HEAD_INIT( NULL )
- 0, /* ob_size */
- "rgbTuple", /* tp_name */
- sizeof( BPy_rgbTuple ), /* tp_basicsize */
- 0, /* tp_itemsize */
- /* methods */
- 0, /* tp_dealloc */
- 0, /* tp_print */
- ( getattrfunc ) rgbTuple_getAttr, /* tp_getattr */
- ( setattrfunc ) rgbTuple_setAttr, /* tp_setattr */
- 0, /* tp_compare */
- ( reprfunc ) rgbTuple_repr, /* tp_repr */
- 0, /* tp_as_number */
- &rgbTupleAsSequence, /* tp_as_sequence */
- &rgbTupleAsMapping, /* tp_as_mapping */
- 0, /* tp_as_hash */
- 0, 0, 0, 0, 0, Py_TPFLAGS_DEFAULT,
- 0, /* tp_doc */
- 0, 0, 0, 0, 0, 0,
- 0, /* tp_methods */
- 0, /* tp_members */
- 0, /* struct PyGetSetDef *tp_getset; */
- 0, /* struct _typeobject *tp_base; */
- 0, /* PyObject *tp_dict; */
- 0, /* descrgetfunc tp_descr_get; */
- 0, /* descrsetfunc tp_descr_set; */
- 0, /* long tp_dictoffset; */
- 0, /* initproc tp_init; */
- 0, /* allocfunc tp_alloc; */
- 0, /* newfunc tp_new; */
- /* Low-level free-memory routine */
- 0, /* freefunc tp_free; */
- /* For PyObject_IS_GC */
- 0, /* inquiry tp_is_gc; */
- 0, /* PyObject *tp_bases; */
- /* method resolution order */
- 0, /* PyObject *tp_mro; */
- 0, /* PyObject *tp_cache; */
- 0, /* PyObject *tp_subclasses; */
- 0, /* PyObject *tp_weaklist; */
- 0
-};
-
-/*****************************************************************************/
-/* Function: rgbTuple_New */
-/*****************************************************************************/
-PyObject *rgbTuple_New( float *rgb[3] )
-{
- BPy_rgbTuple *rgbTuple = PyObject_NEW( BPy_rgbTuple, &rgbTuple_Type );
-
- if( rgbTuple == NULL )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create rgbTuple object" );
-
- rgbTuple->rgb[0] = rgb[0];
- rgbTuple->rgb[1] = rgb[1];
- rgbTuple->rgb[2] = rgb[2];
-
- return ( PyObject * ) rgbTuple;
-}
-
-/*****************************************************************************/
-/* Functions: rgbTuple_getCol and rgbTuple_setCol */
-/* Description: These functions get/set rgb color triplet values. The */
-/* get function returns a tuple, the set one accepts three */
-/* floats (separated or in a tuple) as arguments. */
-/*****************************************************************************/
-PyObject *rgbTuple_getCol( BPy_rgbTuple * self )
-{
- return Py_BuildValue( "[fff]", *(self->rgb[0]),
- *(self->rgb[1]), *(self->rgb[2]));
-}
-
-int rgbTuple_setCol( BPy_rgbTuple * self, PyObject * args )
-{
- int ok = 0;
- int i;
- float num[3]={0,0,0};
-
- /*
- * since rgbTuple_getCol() returns a list, be sure we accept a list
- * as valid input
- */
-
- if( PyObject_Length( args ) == 3 ) {
- if ( PyList_Check ( args ) ) {
- ok = 1;
- for( i = 0; i < 3; ++i ) {
- PyObject *tmp = PyList_GET_ITEM( args, i );
- if( !PyNumber_Check ( tmp ) ) {
- ok = 0;
- break;
- }
- num[i] = (float)PyFloat_AsDouble( tmp );
- }
- } else
- ok = PyArg_ParseTuple( args, "fff", &num[0], &num[1], &num[2] );
- } else
- ok = PyArg_ParseTuple( args, "|(fff)", &num[0], &num[1], &num[2] );
-
- if( !ok )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected [f,f,f], (f,f,f) or f,f,f as arguments (or nothing)" );
-
- for( i = 0; i < 3; ++i )
- *( self->rgb[i] ) = EXPP_ClampFloat( num[i], 0.0, 1.0 );
-
- return 0;
-}
-
-/*****************************************************************************/
-/* Function: rgbTuple_getAttr */
-/* Description: This is a callback function for the BPy_rgbTuple type. It is */
-/* the function that accesses BPy_rgbTuple member variables and */
-/* methods. */
-/*****************************************************************************/
-static PyObject *rgbTuple_getAttr( BPy_rgbTuple * self, char *name )
-{
- int i;
-
- if( strcmp( name, "__members__" ) == 0 )
- return Py_BuildValue( "[s,s,s]", "R", "G", "B" );
-
- else if( !strcmp( name, "R" ) || !strcmp( name, "r" ) )
- i = 0;
- else if( !strcmp( name, "G" ) || !strcmp( name, "g" ) )
- i = 1;
- else if( !strcmp( name, "B" ) || !strcmp( name, "b" ) )
- i = 2;
- else
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "attribute not found" ) );
-
- return PyFloat_FromDouble( (double)(*( self->rgb[i] )) );
-}
-
-/*****************************************************************************/
-/* Function: rgbTuple_setAttr */
-/* Description: This is a callback function for the BPy_rgbTuple type. It is */
-/* the function that changes BPy_rgbTuple member variables. */
-/*****************************************************************************/
-static int rgbTuple_setAttr( BPy_rgbTuple * self, char *name, PyObject * v )
-{
- float value;
-
- if( !PyArg_Parse( v, "f", &value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected float argument" );
-
- value = EXPP_ClampFloat( value, 0.0, 1.0 );
-
- if( !strcmp( name, "R" ) || !strcmp( name, "r" ) )
- *( self->rgb[0] ) = value;
-
- else if( !strcmp( name, "G" ) || !strcmp( name, "g" ) )
- *( self->rgb[1] ) = value;
-
- else if( !strcmp( name, "B" ) || !strcmp( name, "b" ) )
- *( self->rgb[2] ) = value;
-
- else
- return ( EXPP_ReturnIntError( PyExc_AttributeError,
- "attribute not found" ) );
-
- return 0;
-}
-
-/*****************************************************************************/
-/* Section: rgbTuple as Mapping */
-/* These functions provide code to access rgbTuple objects as */
-/* mappings. */
-/*****************************************************************************/
-static int rgbTupleLength( void )
-{
- return 3;
-}
-
-static PyObject *rgbTupleSubscript( BPy_rgbTuple * self, PyObject * key )
-{
- char *name = NULL;
- int i;
-
- if( PyNumber_Check( key ) )
- return rgbTupleItem( self, ( int ) PyInt_AsLong( key ) );
-
- if( !PyArg_ParseTuple( key, "s", &name ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int or string argument" );
-
- if( !strcmp( name, "R" ) || !strcmp( name, "r" ) )
- i = 0;
- else if( !strcmp( name, "G" ) || !strcmp( name, "g" ) )
- i = 1;
- else if( !strcmp( name, "B" ) || !strcmp( name, "b" ) )
- i = 2;
- else
- return EXPP_ReturnPyObjError( PyExc_AttributeError, name );
-
- return PyFloat_FromDouble( (double)(*( self->rgb[i] )) );
-}
-
-static int rgbTupleAssSubscript( BPy_rgbTuple * self, PyObject * key,
- PyObject * v )
-{
- char *name = NULL;
- int i;
-
- if( !PyNumber_Check( v ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "value to assign must be a number" );
-
- if( PyNumber_Check( key ) )
- return rgbTupleAssItem( self, ( int ) PyInt_AsLong( key ), v );
-
- if( !PyArg_Parse( key, "s", &name ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected int or string argument" );
-
- if( !strcmp( name, "R" ) || !strcmp( name, "r" ) )
- i = 0;
- else if( !strcmp( name, "G" ) || !strcmp( name, "g" ) )
- i = 1;
- else if( !strcmp( name, "B" ) || !strcmp( name, "b" ) )
- i = 2;
- else
- return EXPP_ReturnIntError( PyExc_AttributeError, name );
-
- *( self->rgb[i] ) = EXPP_ClampFloat( (float)PyFloat_AsDouble( v ), 0.0, 1.0 );
-
- return 0;
-}
-
-/*****************************************************************************/
-/* Section: rgbTuple as Sequence */
-/* These functions provide code to access rgbTuple objects as */
-/* sequences. */
-/*****************************************************************************/
-static PyObject *rgbTupleItem( BPy_rgbTuple * self, int i )
-{
- if( i < 0 || i >= 3 )
- return EXPP_ReturnPyObjError( PyExc_IndexError,
- "array index out of range" );
-
- return PyFloat_FromDouble( (long)(*( self->rgb[i] )) );
-}
-
-static PyObject *rgbTupleSlice( BPy_rgbTuple * self, int begin, int end )
-{
- PyObject *list;
- int count;
-
- if( begin < 0 )
- begin = 0;
- if( end > 3 )
- end = 3;
- if( begin > end )
- begin = end;
-
- list = PyList_New( end - begin );
-
- for( count = begin; count < end; count++ )
- PyList_SetItem( list, count - begin,
- PyFloat_FromDouble( *( self->rgb[count] ) ) );
-
- return list;
-}
-
-static int rgbTupleAssItem( BPy_rgbTuple * self, int i, PyObject * ob )
-{
- if( i < 0 || i >= 3 )
- return EXPP_ReturnIntError( PyExc_IndexError,
- "array assignment index out of range" );
-
- if( !PyNumber_Check( ob ) )
- return EXPP_ReturnIntError( PyExc_IndexError,
- "color component must be a number" );
-/* XXX this check above is probably ... */
- *( self->rgb[i] ) =
- EXPP_ClampFloat( (float)PyFloat_AsDouble( ob ), 0.0, 1.0 );
-
- return 0;
-}
-
-static int rgbTupleAssSlice( BPy_rgbTuple * self, int begin, int end,
- PyObject * seq )
-{
- int count;
-
- if( begin < 0 )
- begin = 0;
- if( end > 3 )
- end = 3;
- if( begin > end )
- begin = end;
-
- if( !PySequence_Check( seq ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "illegal argument type for built-in operation" );
-
- if( PySequence_Length( seq ) != ( end - begin ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "size mismatch in slice assignment" );
-
- for( count = begin; count < end; count++ ) {
- float value;
- PyObject *ob = PySequence_GetItem( seq, count );
-
- if( !PyArg_Parse( ob, "f", &value ) ) {
- Py_DECREF( ob );
- return -1;
- }
-
- *( self->rgb[count] ) = EXPP_ClampFloat( value, 0.0, 1.0 );
-
- Py_DECREF( ob );
- }
-
- return 0;
-}
-
-/*****************************************************************************/
-/* Function: rgbTuple_repr */
-/* Description: This is a callback function for the BPy_rgbTuple type. It */
-/* builds a meaninful string to represent rgbTuple objects. */
-/*****************************************************************************/
-static PyObject *rgbTuple_repr( BPy_rgbTuple * self )
-{
- float r, g, b;
-
- r = *( self->rgb[0] );
- g = *( self->rgb[1] );
- b = *( self->rgb[2] );
-
- return PyString_FromFormat( "[%f, %f, %f]", r, g, b );
-}
diff --git a/source/blender/python/api2_2x/rgbTuple.h b/source/blender/python/api2_2x/rgbTuple.h
deleted file mode 100644
index 59c0f02643f..00000000000
--- a/source/blender/python/api2_2x/rgbTuple.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * $Id: rgbTuple.h 5317 2005-09-21 19:48:40Z stiv $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_rgbTuple_H
-#define EXPP_rgbTuple_H
-
-#include <Python.h>
-
-/* Objects of <type 'rgbTuple'> are used inside other Blender Python
- * objects, so this header file must contain only 'public' declarations */
-
-/*****************************************************************************/
-/* Python BPy_rgbTuple structure definition: */
-/*****************************************************************************/
-typedef struct {
- PyObject_HEAD float *rgb[3]; /* array of three pointers to floats */
-
-} BPy_rgbTuple;
-
-/*****************************************************************************/
-/* Python API function prototypes for the rgbTuple helper module. */
-/*****************************************************************************/
-PyObject *rgbTuple_New( float *rgb[3] );
-PyObject *rgbTuple_getCol( BPy_rgbTuple * self );
-int rgbTuple_setCol( BPy_rgbTuple * self, PyObject * args );
-
-#endif /* EXPP_rgbTuple_H */
diff --git a/source/blender/python/api2_2x/sceneRadio.c b/source/blender/python/api2_2x/sceneRadio.c
deleted file mode 100644
index a39186b8e28..00000000000
--- a/source/blender/python/api2_2x/sceneRadio.c
+++ /dev/null
@@ -1,893 +0,0 @@
-/*
- * $Id: sceneRadio.c 10270 2007-03-15 01:47:53Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#include "sceneRadio.h" /*This must come first*/
-
-#include "BKE_global.h"
-#include "BKE_object.h" /* disable_where_script() */
-#include "gen_utils.h"
-#include "constant.h"
-#include "radio.h"
-
-
-/* bitflags */
-#define EXPP_RADIO_flag_SHOWLIM 1
-#define EXPP_RADIO_flag_Z 2
-/* shorts */
-#define EXPP_RADIO_hemires_MIN 100
-#define EXPP_RADIO_hemires_MAX 1000
-#define EXPP_RADIO_maxiter_MIN 0
-#define EXPP_RADIO_maxiter_MAX 10000
-#define EXPP_RADIO_subshootp_MIN 0
-#define EXPP_RADIO_subshootp_MAX 10
-#define EXPP_RADIO_subshoote_MIN 0
-#define EXPP_RADIO_subshoote_MAX 10
-#define EXPP_RADIO_nodelim_MIN 0
-#define EXPP_RADIO_nodelim_MAX 50
-#define EXPP_RADIO_maxsublamp_MIN 1
-#define EXPP_RADIO_maxsublamp_MAX 250
-#define EXPP_RADIO_pama_MIN 10
-#define EXPP_RADIO_pama_MAX 1000
-#define EXPP_RADIO_pami_MIN 10
-#define EXPP_RADIO_pami_MAX 1000
-#define EXPP_RADIO_elma_MIN 1
-#define EXPP_RADIO_elma_MAX 500
-#define EXPP_RADIO_elmi_MIN 1
-#define EXPP_RADIO_elmi_MAX 100
-/* ints */
-#define EXPP_RADIO_maxnode_MIN 1
-#define EXPP_RADIO_maxnode_MAX 250000
-/* floats */
-#define EXPP_RADIO_convergence_MIN 0.0
-#define EXPP_RADIO_convergence_MAX 0.1f
-#define EXPP_RADIO_radfac_MIN 0.001f
-#define EXPP_RADIO_radfac_MAX 250.0
-#define EXPP_RADIO_gamma_MIN 0.2f
-#define EXPP_RADIO_gamma_MAX 10.0
-/* drawtypes */
-#define EXPP_RADIO_drawtype_WIRE 0
-#define EXPP_RADIO_drawtype_SOLID 1
-#define EXPP_RADIO_drawtype_GOURAUD 2
-
-static int EXPP_check_scene( Scene * scene )
-{
- if( scene != G.scene ) {
- PyErr_SetString( PyExc_EnvironmentError,
- "\nradiosity only works on the current scene, check scene.makeCurrent()." );
- return 0;
- } else if( !scene->radio ) {
- PyErr_SetString( PyExc_EnvironmentError,
- "\nradiosity data was deleted from scene!" );
- return 0;
- }
-
- return 1;
-}
-
-static PyObject *Radio_collectMeshes( BPy_Radio * self );
-static PyObject *Radio_go( BPy_Radio * self );
-static PyObject *Radio_freeData( BPy_Radio * self );
-static PyObject *Radio_replaceMeshes( BPy_Radio * self );
-static PyObject *Radio_addMesh( BPy_Radio * self );
-static PyObject *Radio_filterFaces( BPy_Radio * self );
-static PyObject *Radio_filterElems( BPy_Radio * self );
-static PyObject *Radio_limitSubdivide( BPy_Radio * self );
-static PyObject *Radio_subdividePatches( BPy_Radio * self );
-static PyObject *Radio_subdivideElems( BPy_Radio * self );
-static PyObject *Radio_removeDoubles( BPy_Radio * self );
-
-static PyObject *Radio_repr( BPy_Radio * self );
-
-static PyObject *EXPP_create_ret_PyInt( int value )
-{
- PyObject *pyval = PyInt_FromLong( value );
-
- if( !pyval )
- PyErr_SetString( PyExc_MemoryError,
- "couldn't create py int!" );
-
- return pyval;
-}
-
-static PyObject *EXPP_create_ret_PyFloat( float value )
-{
- PyObject *pyval = PyFloat_FromDouble( ( double ) value );
-
- if( !pyval )
- PyErr_SetString( PyExc_MemoryError,
- "couldn't create py int!" );
-
- return pyval;
-}
-
-static PyObject *Radio_get_hemires( BPy_Radio * self )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
- return EXPP_create_ret_PyInt( ( int ) self->scene->radio->hemires );
-}
-
-static PyObject *Radio_get_maxiter( BPy_Radio * self )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
- return EXPP_create_ret_PyInt( ( int ) self->scene->radio->maxiter );
-}
-
-static PyObject *Radio_get_subshootp( BPy_Radio * self )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
- return EXPP_create_ret_PyInt( ( int ) self->scene->radio->subshootp );
-}
-
-static PyObject *Radio_get_subshoote( BPy_Radio * self )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
- return EXPP_create_ret_PyInt( ( int ) self->scene->radio->subshoote );
-}
-
-static PyObject *Radio_get_nodelim( BPy_Radio * self )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
- return EXPP_create_ret_PyInt( ( int ) self->scene->radio->nodelim );
-}
-
-static PyObject *Radio_get_maxsublamp( BPy_Radio * self )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
- return EXPP_create_ret_PyInt( ( int ) self->scene->radio->maxsublamp );
-}
-
-static PyObject *Radio_get_pama( BPy_Radio * self )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
- return EXPP_create_ret_PyInt( ( int ) self->scene->radio->pama );
-}
-
-static PyObject *Radio_get_pami( BPy_Radio * self )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
- return EXPP_create_ret_PyInt( ( int ) self->scene->radio->pami );
-}
-
-static PyObject *Radio_get_elma( BPy_Radio * self )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
- return EXPP_create_ret_PyInt( ( int ) self->scene->radio->elma );
-}
-
-static PyObject *Radio_get_elmi( BPy_Radio * self )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
- return EXPP_create_ret_PyInt( ( int ) self->scene->radio->elmi );
-}
-
-static PyObject *Radio_get_drawtype( BPy_Radio * self )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
- return EXPP_create_ret_PyInt( ( int ) self->scene->radio->drawtype );
-}
-
-static PyObject *Radio_get_flag( BPy_Radio * self )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
- return EXPP_create_ret_PyInt( ( int ) self->scene->radio->flag );
-}
-
-static PyObject *Radio_get_maxnode( BPy_Radio * self )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
- return EXPP_create_ret_PyInt( ( int ) self->scene->radio->maxnode );
-}
-
-static PyObject *Radio_get_convergence( BPy_Radio * self )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
- return EXPP_create_ret_PyFloat( self->scene->radio->convergence );
-}
-
-static PyObject *Radio_get_radfac( BPy_Radio * self )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
- return EXPP_create_ret_PyFloat( self->scene->radio->radfac );
-}
-
-static PyObject *Radio_get_gamma( BPy_Radio * self )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
- return EXPP_create_ret_PyFloat( self->scene->radio->gamma );
-}
-
-static PyObject *EXPP_unpack_set_int( PyObject * args, int *ptr,
- int min, int max )
-{
- int value;
-
- if( !PyArg_ParseTuple( args, "i", &value ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int argument" );
-
- *ptr = EXPP_ClampInt( value, min, max );
-
- return EXPP_incr_ret( Py_None );
-}
-
-/* could merge with set_int, but is cleaner this way */
-static PyObject *EXPP_unpack_set_short( PyObject * args, short *ptr,
- short min, short max )
-{
- int value;
-
- if( !PyArg_ParseTuple( args, "i", &value ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int argument" );
-
- *ptr = ( short ) EXPP_ClampInt( value, min, max );
-
- return EXPP_incr_ret( Py_None );
-}
-
-static PyObject *EXPP_unpack_set_float( PyObject * args, float *ptr,
- float min, float max )
-{
- float value;
-
- if( !PyArg_ParseTuple( args, "f", &value ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected float argument" );
-
- *ptr = EXPP_ClampFloat( value, min, max );
-
- return EXPP_incr_ret( Py_None );
-}
-
-static PyObject *Radio_set_hemires( BPy_Radio * self, PyObject * args )
-{
- PyObject *ret;
-
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
- ret = EXPP_unpack_set_short( args, &self->scene->radio->hemires,
- EXPP_RADIO_hemires_MIN,
- EXPP_RADIO_hemires_MAX );
-
- if( ret )
- rad_setlimits( );
-
- return ret;
-}
-
-static PyObject *Radio_set_maxiter( BPy_Radio * self, PyObject * args )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
- return EXPP_unpack_set_short( args, &self->scene->radio->maxiter,
- EXPP_RADIO_maxiter_MIN,
- EXPP_RADIO_maxiter_MAX );
-}
-
-static PyObject *Radio_set_subshootp( BPy_Radio * self, PyObject * args )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
- return EXPP_unpack_set_short( args, &self->scene->radio->subshootp,
- EXPP_RADIO_subshootp_MIN,
- EXPP_RADIO_subshootp_MAX );
-}
-
-static PyObject *Radio_set_subshoote( BPy_Radio * self, PyObject * args )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
- return EXPP_unpack_set_short( args, &self->scene->radio->subshoote,
- EXPP_RADIO_subshoote_MIN,
- EXPP_RADIO_subshoote_MAX );
-}
-
-static PyObject *Radio_set_nodelim( BPy_Radio * self, PyObject * args )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
- return EXPP_unpack_set_short( args, &self->scene->radio->nodelim,
- EXPP_RADIO_nodelim_MIN,
- EXPP_RADIO_nodelim_MAX );
-}
-
-static PyObject *Radio_set_maxsublamp( BPy_Radio * self, PyObject * args )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
- return EXPP_unpack_set_short( args, &self->scene->radio->maxsublamp,
- EXPP_RADIO_maxsublamp_MIN,
- EXPP_RADIO_maxsublamp_MAX );
-}
-
-static PyObject *Radio_set_pama( BPy_Radio * self, PyObject * args )
-{
- PyObject *ret;
-
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
- ret = EXPP_unpack_set_short( args, &self->scene->radio->pama,
- EXPP_RADIO_pama_MIN,
- EXPP_RADIO_pama_MAX );
-
- if( ret )
- rad_setlimits( );
-
- return ret;
-}
-
-static PyObject *Radio_set_pami( BPy_Radio * self, PyObject * args )
-{
- PyObject *ret;
-
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
- ret = EXPP_unpack_set_short( args, &self->scene->radio->pami,
- EXPP_RADIO_pami_MIN,
- EXPP_RADIO_pami_MAX );
-
- if( ret )
- rad_setlimits( );
-
- return ret;
-}
-
-static PyObject *Radio_set_elma( BPy_Radio * self, PyObject * args )
-{
- PyObject *ret;
-
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
- ret = EXPP_unpack_set_short( args, &self->scene->radio->elma,
- EXPP_RADIO_elma_MIN,
- EXPP_RADIO_elma_MAX );
-
- if( ret )
- rad_setlimits( );
-
- return ret;
-}
-
-static PyObject *Radio_set_elmi( BPy_Radio * self, PyObject * args )
-{
- PyObject *ret;
-
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
- ret = EXPP_unpack_set_short( args, &self->scene->radio->elmi,
- EXPP_RADIO_elmi_MIN,
- EXPP_RADIO_elmi_MAX );
-
- if( ret )
- rad_setlimits( );
-
- return ret;
-}
-
-static PyObject *Radio_set_drawtype( BPy_Radio * self, PyObject * args )
-{
- PyObject *pyob = NULL;
- char *str = NULL;
- short dt = EXPP_RADIO_drawtype_WIRE;
-
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
-
- if( !PyArg_ParseTuple( args, "O", &pyob ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int or string and another optional int as arguments" );
-
- if( PyString_Check( pyob ) ) {
- str = PyString_AsString( pyob );
- if( !str )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create py string!" );
- else if( !strcmp( str, "Wire" ) )
- dt = EXPP_RADIO_drawtype_WIRE;
- else if( !strcmp( str, "Solid" ) )
- dt = EXPP_RADIO_drawtype_SOLID;
- else if( !strcmp( str, "Gouraud" ) )
- dt = EXPP_RADIO_drawtype_GOURAUD;
- else
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "unknown drawtype string" );
- } else if( PyInt_Check( pyob ) ) {
- dt = ( short ) EXPP_ClampInt( PyInt_AsLong( pyob ),
- EXPP_RADIO_drawtype_WIRE,
- EXPP_RADIO_drawtype_GOURAUD );
- } else
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int or string as argument" );
-
- self->scene->radio->drawtype = dt;
-
- set_radglobal( ); /* needed to update 3d view(s) */
-
- return EXPP_incr_ret( Py_None );
-}
-
-static PyObject *Radio_set_flag( BPy_Radio * self, PyObject * args )
-{
- int i, imode = 0;
- char *mode[2] = { NULL, NULL };
-
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
-
- if( !PyArg_ParseTuple( args, "|ss", &mode[0], &mode[1] ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string arguments (or nothing)" );
-
- for( i = 0; i < 2; i++ ) {
- if( !mode[i] )
- break;
- else if( !strcmp( mode[i], "ShowLimits" ) )
- imode |= EXPP_RADIO_flag_SHOWLIM;
- else if( !strcmp( mode[i], "Z" ) )
- imode |= EXPP_RADIO_flag_Z;
- else
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "unknown mode string" );
- }
-
- self->scene->radio->flag = ( short ) EXPP_ClampInt( imode, 0, 3 );
-
- set_radglobal( ); /* needed to update 3d view(s) */
-
- return EXPP_incr_ret( Py_None );
-}
-
-static PyObject *Radio_set_maxnode( BPy_Radio * self, PyObject * args )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
- return EXPP_unpack_set_int( args, &self->scene->radio->maxnode,
- EXPP_RADIO_maxnode_MIN,
- EXPP_RADIO_maxnode_MAX );
-}
-
-static PyObject *Radio_set_convergence( BPy_Radio * self, PyObject * args )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
- return EXPP_unpack_set_float( args, &self->scene->radio->convergence,
- EXPP_RADIO_convergence_MIN,
- EXPP_RADIO_convergence_MAX );
-}
-
-static PyObject *Radio_set_radfac( BPy_Radio * self, PyObject * args )
-{
- PyObject *ret;
-
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
- ret = EXPP_unpack_set_float( args, &self->scene->radio->radfac,
- EXPP_RADIO_radfac_MIN,
- EXPP_RADIO_radfac_MAX );
-
- if( ret ) {
- set_radglobal( );
- if( rad_phase( ) & RAD_PHASE_FACES )
- make_face_tab( );
- else
- make_node_display( );
- }
-
- return ret;
-}
-
-static PyObject *Radio_set_gamma( BPy_Radio * self, PyObject * args )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
- return EXPP_unpack_set_float( args, &self->scene->radio->gamma,
- EXPP_RADIO_gamma_MIN,
- EXPP_RADIO_gamma_MAX );
-}
-
-static PyMethodDef BPy_Radio_methods[] = {
- {"collectMeshes", ( PyCFunction ) Radio_collectMeshes, METH_NOARGS,
- "() - Convert selected meshes to patches."},
- {"go", ( PyCFunction ) Radio_go, METH_NOARGS,
- "() - Start radiosity calculations."},
- {"freeData", ( PyCFunction ) Radio_freeData, METH_NOARGS,
- "() - Free all memory used by radiosity."},
- {"addMesh", ( PyCFunction ) Radio_addMesh, METH_NOARGS,
- "() - Add a new mesh with the radio values as vertex colors to Blender."},
- {"replaceMeshes", ( PyCFunction ) Radio_replaceMeshes, METH_NOARGS,
- "() - Replace input meshes with the one created by radiosity simulation."},
- {"limitSubdivide", ( PyCFunction ) Radio_limitSubdivide, METH_NOARGS,
- "() - Subdivide patches."},
- {"filterFaces", ( PyCFunction ) Radio_filterFaces, METH_NOARGS,
- "() - Force an extra smoothing."},
- {"filterElems", ( PyCFunction ) Radio_filterElems, METH_NOARGS,
- "() - Filter elements to remove aliasing artifacts."},
- {"subdividePatches", ( PyCFunction ) Radio_subdividePatches,
- METH_NOARGS,
- "() - Pre-subdivision: detect high-energy patches and subdivide them."},
- {"subdivideElems", ( PyCFunction ) Radio_subdivideElems, METH_NOARGS,
- "() - Pre-subdivision: detect high-energy elements and subdivide them."},
- {"removeDoubles", ( PyCFunction ) Radio_removeDoubles, METH_NOARGS,
- "() - Join elements which differ less than the defined node limit."},
- {"getHemiRes", ( PyCFunction ) Radio_get_hemires, METH_NOARGS,
- "() - Get hemicube size."},
- {"setHemiRes", ( PyCFunction ) Radio_set_hemires, METH_VARARGS,
- "(int) - Set hemicube size, the range is [100, 1000]."},
- {"getMaxIter", ( PyCFunction ) Radio_get_maxiter, METH_NOARGS,
- "() - Get maximum number of radiosity rounds."},
- {"setMaxIter", ( PyCFunction ) Radio_set_maxiter, METH_VARARGS,
- "(i) - Set maximum number of radiosity rounds in [0, 10000]."},
- {"getSubShPatch", ( PyCFunction ) Radio_get_subshootp, METH_NOARGS,
- "() - Get max number of times environment is tested to detect patches."},
- {"setSubShPatch", ( PyCFunction ) Radio_set_subshootp, METH_VARARGS,
- "(i) - Set max number of times environment is tested to detect patches.\n\
- Range is [0, 10]."},
- {"getSubShElem", ( PyCFunction ) Radio_get_subshoote, METH_NOARGS,
- "() - Get number of times environment is tested to detect elements."},
- {"setSubShElem", ( PyCFunction ) Radio_set_subshoote, METH_VARARGS,
- "(i) - Set number of times environment is tested to detect elements.\n\
- Range is [0, 10]."},
- {"getElemLimit", ( PyCFunction ) Radio_get_nodelim, METH_NOARGS,
- "() - Get the range for removing doubles."},
- {"setElemLimit", ( PyCFunction ) Radio_set_nodelim, METH_VARARGS,
- "(i) - Set the range for removing doubles in [0, 50]."},
- {"getMaxSubdivSh", ( PyCFunction ) Radio_get_maxsublamp, METH_NOARGS,
- "() - Get max number of initial shoot patches evaluated."},
- {"setMaxSubdivSh", ( PyCFunction ) Radio_set_maxsublamp, METH_VARARGS,
- "(i) - Set max number of initial shoot patches evaluated in [1, 250]."},
- {"getPatchMax", ( PyCFunction ) Radio_get_pama, METH_NOARGS,
- "() - Get max size of a patch."},
- {"setPatchMax", ( PyCFunction ) Radio_set_pama, METH_VARARGS,
- "(i) - Set max size of a patch in [10, 1000]."},
- {"getPatchMin", ( PyCFunction ) Radio_get_pami, METH_NOARGS,
- "() - Get minimum size of a patch."},
- {"setPatchMin", ( PyCFunction ) Radio_set_pami, METH_VARARGS,
- "(i) - Set minimum size of a patch in [10, 1000]."},
- {"getElemMax", ( PyCFunction ) Radio_get_elma, METH_NOARGS,
- "() - Get max size of an element."},
- {"setElemMax", ( PyCFunction ) Radio_set_elma, METH_VARARGS,
- "(i) - Set max size of an element in [1, 100]."},
- {"getElemMin", ( PyCFunction ) Radio_get_elmi, METH_NOARGS,
- "() - Get minimum size of an element."},
- {"setElemMin", ( PyCFunction ) Radio_set_elmi, METH_VARARGS,
- "(i) - Set minimum size of an element in [1, 100]."},
- {"getMaxElems", ( PyCFunction ) Radio_get_maxnode, METH_NOARGS,
- "() - Get maximum number of elements."},
- {"setMaxElems", ( PyCFunction ) Radio_set_maxnode, METH_VARARGS,
- "(i) - Set maximum nunber of elements in [1, 250000]."},
- {"getConvergence", ( PyCFunction ) Radio_get_convergence, METH_NOARGS,
- "() - Get lower threshold of unshot energy."},
- {"setConvergence", ( PyCFunction ) Radio_set_convergence, METH_VARARGS,
- "(f) - Set lower threshold of unshot energy in [0.0, 1.0]."},
- {"getMult", ( PyCFunction ) Radio_get_radfac, METH_NOARGS,
- "() - Get energy value multiplier."},
- {"setMult", ( PyCFunction ) Radio_set_radfac, METH_VARARGS,
- "(f) - Set energy value multiplier in [0.001, 250.0]."},
- {"getGamma", ( PyCFunction ) Radio_get_gamma, METH_NOARGS,
- "() - Get change in the contrast of energy values."},
- {"setGamma", ( PyCFunction ) Radio_set_gamma, METH_VARARGS,
- "(f) - Set change in the contrast of energy values in [0.2, 10.0]."},
- {"getDrawType", ( PyCFunction ) Radio_get_drawtype, METH_NOARGS,
- "() - Get the draw type: Wire, Solid or Gouraud as an int value."},
- {"setDrawType", ( PyCFunction ) Radio_set_drawtype, METH_VARARGS,
- "(i or s) - Set the draw type: wire, solid (default) or gouraud."},
- {"getMode", ( PyCFunction ) Radio_get_flag, METH_NOARGS,
- "() - Get mode as int (or'ed bitflags), see Radio.Modes dict."},
- {"setMode", ( PyCFunction ) Radio_set_flag, METH_VARARGS,
- "(|ss) - Set mode flags as strings: 'ShowLimits', 'Z'."},
- {NULL, NULL, 0, NULL}
-};
-
-static PyTypeObject Radio_Type = {
- PyObject_HEAD_INIT( NULL )
- 0, /*ob_size */
- "Blender Radiosity", /*tp_name */
- sizeof( BPy_Radio ), /*tp_basicsize */
- 0, /*tp_itemsize */
- NULL, /*tp_dealloc */
- 0, /*tp_print */
- 0, /*tp_getattr */
- 0, /*tp_setattr */
- 0, /*tp_compare */
- ( reprfunc ) Radio_repr, /*tp_repr */
- 0, /*tp_as_number */
- 0, /*tp_as_sequence */
- 0, /*tp_as_mapping */
- 0, /*tp_hash */
- 0, /*tp_call */
- 0, /*tp_str */
- 0, /*tp_getattro */
- 0, /*tp_setattro */
- 0, /*tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags */
- "Blender radiosity", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- BPy_Radio_methods, /* tp_methods */
- 0, /* tp_members */
- 0, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- 0, /* tp_init */
- 0, /* tp_alloc */
- 0, /* tp_new */
- 0, 0, 0, 0, 0, 0, 0, 0, /* up to tp_del, so we don't get a warning */
-};
-
-static PyObject *Radio_repr( BPy_Radio * self )
-{
- if( self->radio )
- return PyString_FromFormat( "[Radiosity \"%s\"]",
- self->scene->id.name + 2 );
- else
- return PyString_FromString( "NULL" );
-}
-
-PyObject *Radio_CreatePyObject( struct Scene * scene )
-{
- BPy_Radio *py_radio;
-
- if( scene != G.scene ) {
- return EXPP_ReturnPyObjError( PyExc_EnvironmentError,
- "\nradiosity only works on the current scene, check scene.makeCurrent()." );
- }
-
- py_radio = ( BPy_Radio * ) PyObject_NEW( BPy_Radio, &Radio_Type );
-
- if( !py_radio )
- return NULL;
-
- if( !scene->radio )
- add_radio( ); /* adds to G.scene */
-
- py_radio->radio = scene->radio;
- py_radio->scene = scene;
-
- return ( ( PyObject * ) py_radio );
-}
-
-static PyObject *Radio_collectMeshes( BPy_Radio * self )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
-
- disable_where_script( 1 ); /* used to avoid error popups */
- rad_collect_meshes( );
- disable_where_script( 0 );
-
- return EXPP_incr_ret( Py_None );
-}
-
-static PyObject *Radio_freeData( BPy_Radio * self )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
-
- delete_radio( );
-
- return EXPP_incr_ret( Py_None );
-}
-
-static PyObject *Radio_go( BPy_Radio * self )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
-
- if( rad_phase( ) == RAD_PHASE_PATCHES )
- rad_go( );
- else
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "you need to call radio.collectMeshes() first." );
-
- return EXPP_incr_ret( Py_None );
-}
-
-static PyObject *Radio_replaceMeshes( BPy_Radio * self )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
-
- if( rad_phase( ) & RAD_PHASE_FACES )
- rad_replacemesh( );
- else
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "you need to call radio.collectMeshes() and radio.go() first." );
-
- return EXPP_incr_ret( Py_None );
-}
-
-static PyObject *Radio_addMesh( BPy_Radio * self )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
-
- if( rad_phase( ) & RAD_PHASE_FACES )
- rad_addmesh( );
- else
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "you need to call radio.collectMeshes() and radio.go() first." );
-
- return EXPP_incr_ret( Py_None );
-}
-
-static PyObject *Radio_filterFaces( BPy_Radio * self )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
-
- if( rad_phase( ) & RAD_PHASE_FACES )
- filterFaces( );
- else
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "you need to call radio.collectMeshes() and radio.go() first." );
-
- return EXPP_incr_ret( Py_None );
-}
-
-static PyObject *Radio_filterElems( BPy_Radio * self )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
-
- if( rad_phase( ) & RAD_PHASE_FACES ) {
- set_radglobal( );
- filterNodes( );
- make_face_tab( );
- } else
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "you need to call radio.collectMeshes() and radio.go() first." );
-
- return EXPP_incr_ret( Py_None );
-}
-
-static PyObject *Radio_limitSubdivide( BPy_Radio * self )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
-
- if( rad_phase( ) == RAD_PHASE_PATCHES )
- rad_limit_subdivide( );
- else
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "you need to call this before calculating the radiosity simulation." );
-
- return EXPP_incr_ret( Py_None );
-}
-
-static PyObject *Radio_subdividePatches( BPy_Radio * self )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
-
- if( rad_phase( ) == RAD_PHASE_PATCHES )
- rad_subdivshootpatch( );
- else
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "you need to call this before calculating the radiosity simulation." );
-
- return EXPP_incr_ret( Py_None );
-}
-
-static PyObject *Radio_subdivideElems( BPy_Radio * self )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
-
- if( rad_phase( ) == RAD_PHASE_PATCHES )
- rad_subdivshootelem( );
- else
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "you need to call radio.collectMeshes() and radio.go() first." );
-
- return EXPP_incr_ret( Py_None );
-}
-
-static PyObject *Radio_removeDoubles( BPy_Radio * self )
-{
- if( !EXPP_check_scene( self->scene ) )
- return NULL;
-
- if( rad_phase( ) == RAD_PHASE_FACES ) {
- set_radglobal( );
- removeEqualNodes( self->scene->radio->nodelim );
- make_face_tab( );
- } else
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "you need to call radio.collectMeshes() and radio.go() first." );
-
- return EXPP_incr_ret( Py_None );
-}
-
-static PyMethodDef M_Radio_methods[] = { {NULL, NULL, 0, NULL} };
-
-PyObject *Radio_Init( void )
-{
- PyObject *submodule, *Modes, *DrawTypes;
-
- if( PyType_Ready( &Radio_Type ) < 0 )
- return NULL;
-
- submodule = Py_InitModule3( "Blender.Scene.Radio", M_Radio_methods,
- "The Blender Radiosity submodule" );
-
- Modes = PyConstant_New( );
- DrawTypes = PyConstant_New( );
-
- if( Modes ) {
- BPy_constant *d = ( BPy_constant * ) Modes;
-
- PyConstant_Insert( d, "ShowLimits",
- PyInt_FromLong( EXPP_RADIO_flag_SHOWLIM ) );
- PyConstant_Insert( d, "Z", PyInt_FromLong( EXPP_RADIO_flag_Z ) );
-
- PyModule_AddObject( submodule, "Modes", Modes );
- }
-
- if( DrawTypes ) {
- BPy_constant *d = ( BPy_constant * ) DrawTypes;
-
- PyConstant_Insert( d, "Wire",
- PyInt_FromLong( EXPP_RADIO_drawtype_WIRE ) );
- PyConstant_Insert( d, "Solid",
- PyInt_FromLong( EXPP_RADIO_drawtype_SOLID ) );
- PyConstant_Insert( d, "Gouraud",
- PyInt_FromLong
- ( EXPP_RADIO_drawtype_GOURAUD ) );
-
- PyModule_AddObject( submodule, "DrawTypes", DrawTypes );
- }
-
- return submodule;
-}
diff --git a/source/blender/python/api2_2x/sceneRender.c b/source/blender/python/api2_2x/sceneRender.c
deleted file mode 100644
index a160db1ad22..00000000000
--- a/source/blender/python/api2_2x/sceneRender.c
+++ /dev/null
@@ -1,3216 +0,0 @@
-/*
- * $Id: sceneRender.c 12813 2007-12-07 09:51:02Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Joseph Gilbert, Dietrich Bollmann
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-struct View3D; /* keep me up here */
-
-#include "sceneRender.h" /*This must come first*/
-
-#include "DNA_image_types.h"
-
-#include "BKE_image.h"
-#include "BKE_global.h"
-#include "BKE_screen.h"
-#include "BKE_scene.h"
-
-#include "BIF_drawscene.h"
-#include "BIF_renderwin.h"
-#include "BIF_writeimage.h"
-
-#include "BLI_blenlib.h"
-
-#include "RE_pipeline.h"
-
-#include "mydevice.h"
-#include "butspace.h"
-#include "blendef.h"
-#include "gen_utils.h"
-
-#include "Scene.h"
-
-/* local defines */
-#define PY_NONE 0
-#define PY_LOW 1
-#define PY_MEDIUM 2
-#define PY_HIGH 3
-#define PY_HIGHER 4
-#define PY_BEST 5
-#define PY_USEAOSETTINGS 6
-#define PY_SKYDOME 1
-#define PY_FULL 2
-
-enum rend_constants {
- EXPP_RENDER_ATTR_XPARTS = 0,
- EXPP_RENDER_ATTR_YPARTS,
- EXPP_RENDER_ATTR_ASPECTX,
- EXPP_RENDER_ATTR_ASPECTY,
- EXPP_RENDER_ATTR_CFRAME,
- EXPP_RENDER_ATTR_SFRAME,
- EXPP_RENDER_ATTR_EFRAME,
- EXPP_RENDER_ATTR_FPS,
- EXPP_RENDER_ATTR_FPS_BASE,
- EXPP_RENDER_ATTR_SIZEX,
- EXPP_RENDER_ATTR_SIZEY,
- EXPP_RENDER_ATTR_GAUSSFILTER,
- EXPP_RENDER_ATTR_MBLURFACTOR,
-};
-
-#define EXPP_RENDER_ATTR_CFRA 2
-#define EXPP_RENDER_ATTR_ANTISHIFT 3
-#define EXPP_RENDER_ATTR_EDGEINT 4
-#define EXPP_RENDER_ATTR_EFRA 5
-#define EXPP_RENDER_ATTR_QUALITY 11
-#define EXPP_RENDER_ATTR_GAUSS 13
-#define EXPP_RENDER_ATTR_BLURFAC 14
-
-#define EXPP_RENDER_ATTR_YF_EXPOSURE 20
-#define EXPP_RENDER_ATTR_YF_GAMMA 21
-#define EXPP_RENDER_ATTR_YF_GIDEPTH 22
-#define EXPP_RENDER_ATTR_YF_GICDEPTH 23
-#define EXPP_RENDER_ATTR_YF_GIPHOTONCOUNT 24
-#define EXPP_RENDER_ATTR_YF_GIPHOTONMIXCOUNT 25
-#define EXPP_RENDER_ATTR_YF_GIPHOTONRADIUS 26
-#define EXPP_RENDER_ATTR_YF_GIPIXPERSAMPLE 27
-#define EXPP_RENDER_ATTR_YF_GIPOWER 28
-#define EXPP_RENDER_ATTR_YF_GIREFINE 29
-#define EXPP_RENDER_ATTR_YF_GISHADOWQUAL 30
-#define EXPP_RENDER_ATTR_YF_RAYBIAS 31
-#define EXPP_RENDER_ATTR_YF_PROCCOUNT 32
-#define EXPP_RENDER_ATTR_YF_RAYDEPTH 33
-#define EXPP_RENDER_ATTR_YF_GIMETHOD 34
-#define EXPP_RENDER_ATTR_YF_GIQUALITY 35
-
-
-/* Render doc strings */
-static char M_Render_doc[] = "The Blender Render module";
-
-/* deprecated callbacks */
-static PyObject *RenderData_SetRenderPath( BPy_RenderData *self,
- PyObject *args );
-static PyObject *RenderData_SetBackbufPath( BPy_RenderData *self,
- PyObject *args );
-static PyObject *RenderData_SetFtypePath( BPy_RenderData *self,
- PyObject *args );
-static PyObject *RenderData_SetOversamplingLevel( BPy_RenderData * self,
- PyObject * args );
-static PyObject *RenderData_SetRenderWinSize( BPy_RenderData * self,
- PyObject * args );
-static PyObject *RenderData_SetBorder( BPy_RenderData * self,
- PyObject * args );
-static PyObject *RenderData_SetRenderer( BPy_RenderData * self,
- PyObject * args );
-static PyObject *RenderData_SetImageType( BPy_RenderData * self,
- PyObject * args );
-static PyObject *RenderData_Render( BPy_RenderData * self );
-
-/* BPy_RenderData Internal Protocols */
-
-static PyObject *RenderData_repr( BPy_RenderData * self )
-{
- if( self->renderContext )
- return PyString_FromFormat( "[RenderData \"%s\"]",
- self->scene->id.name + 2 );
- else
- return PyString_FromString( "NULL" );
-}
-
-/***************************************************************************/
-/* local utility routines for manipulating data */
-/***************************************************************************/
-static PyObject *M_Render_BitToggleInt( PyObject * args, int setting,
- int *structure )
-{
- int flag;
-
- if( !PyArg_ParseTuple( args, "i", &flag ) )
- return ( EXPP_ReturnPyObjError
- ( PyExc_AttributeError,
- "expected TRUE or FALSE (1 or 0)" ) );
-
- if( flag < 0 || flag > 1 )
- return ( EXPP_ReturnPyObjError
- ( PyExc_AttributeError,
- "expected TRUE or FALSE (1 or 0)" ) );
-
- if( flag )
- *structure |= setting;
- else
- *structure &= ~setting;
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
-
- Py_RETURN_NONE;
-
-}
-
-static PyObject *M_Render_BitToggleShort( PyObject * args, short setting,
- short *structure )
-{
- int flag;
-
- if( !PyArg_ParseTuple( args, "i", &flag ) )
- return ( EXPP_ReturnPyObjError
- ( PyExc_AttributeError,
- "expected TRUE or FALSE (1 or 0)" ) );
-
- if( flag < 0 || flag > 1 )
- return ( EXPP_ReturnPyObjError
- ( PyExc_AttributeError,
- "expected TRUE or FALSE (1 or 0)" ) );
-
- if( flag )
- *structure |= setting;
- else
- *structure &= ~setting;
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
-
- Py_RETURN_NONE;
-
-}
-
-static PyObject *M_Render_GetSetAttributeFloat( PyObject * args,
- float *structure, float min,
- float max )
-{
- float property = -10.0f;
- char error[48];
-
- if( !PyArg_ParseTuple( args, "|f", &property ) )
- return ( EXPP_ReturnPyObjError
- ( PyExc_AttributeError, "expected float" ) );
-
- if( property != -10.0f ) {
- if( property < min || property > max ) {
- sprintf( error, "out of range - expected %f to %f",
- min, max );
- return ( EXPP_ReturnPyObjError
- ( PyExc_AttributeError, error ) );
- }
-
- *structure = property;
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
- Py_RETURN_NONE;
- } else
- return PyFloat_FromDouble( *structure );
-}
-
-static PyObject *M_Render_GetSetAttributeShort( PyObject * args,
- short *structure, int min,
- int max )
-{
- short property = -10;
- char error[48];
-
- if( !PyArg_ParseTuple( args, "|h", &property ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected int" ) );
-
- if( property != -10 ) {
- if( property < min || property > max ) {
- sprintf( error, "out of range - expected %d to %d",
- min, max );
- return ( EXPP_ReturnPyObjError
- ( PyExc_AttributeError, error ) );
- }
-
- *structure = property;
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
- Py_RETURN_NONE;
- } else
- return PyInt_FromLong( (long int)*structure );
-}
-
-static PyObject *M_Render_GetSetAttributeInt( PyObject * args, int *structure,
- int min, int max )
-{
- int property = -10;
- char error[48];
-
- if( !PyArg_ParseTuple( args, "|i", &property ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected int" ) );
-
- if( property != -10 ) {
- if( property < min || property > max ) {
- sprintf( error, "out of range - expected %d to %d",
- min, max );
- return ( EXPP_ReturnPyObjError
- ( PyExc_AttributeError, error ) );
- }
-
- *structure = property;
-
- /* compare memory locations, not values */
- if (&G.scene->r.cfra == structure) {
- /* are we changing the current frame?
- update all objects, so python scripts can export all objects
- in a scene without worrying about the view layers */
- scene_update_for_newframe(G.scene, (1<<20) - 1);
- }
-
- /*I dont think this should be here, whatif the scene is not the current scene - campbell*/
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
-
- Py_RETURN_NONE;
- } else
- return PyInt_FromLong( *structure );
-}
-
-
-static void M_Render_DoSizePreset( BPy_RenderData * self, short xsch,
- short ysch, short xasp, short yasp,
- short size, short xparts, short yparts,
- short fps, float fps_base,
- float a, float b, float c,
- float d )
-{
- self->renderContext->xsch = xsch;
- self->renderContext->ysch = ysch;
- self->renderContext->xasp = xasp;
- self->renderContext->yasp = yasp;
- self->renderContext->size = size;
- self->renderContext->frs_sec = fps;
- self->renderContext->frs_sec_base = fps_base;
- self->renderContext->xparts = xparts;
- self->renderContext->yparts = yparts;
-
- BLI_init_rctf( &self->renderContext->safety, a, b, c, d );
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
- EXPP_allqueue( REDRAWVIEWCAM, 0 );
-}
-
-/** set / get boolean */
-
-static int M_Render_setBooleanShort( BPy_RenderData * self, PyObject *value, short* var )
-{
- if( !PyInt_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected boolean value" );
-
- *var = (PyInt_AsLong( value )) ? 1 : 0;
-
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
- return 0;
-}
-
-static PyObject *M_Render_getBooleanShort( BPy_RenderData * self, short var )
-{
- return PyInt_FromLong( (long) var );
-}
-
-/** set / get float */
-
-static int M_Render_setFloat( BPy_RenderData *self, PyObject *value, float *var, float min, float max )
-{
- float val;
- char error[48];
-
- if( !PyFloat_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected float value" );
-
- val = (float) PyFloat_AsDouble( value );
-
- /* check range */
- if ( val < min || val > max ) {
- sprintf( error, "out of range - expected %f to %f", min, max );
- return EXPP_ReturnIntError( PyExc_TypeError,error );
- }
-
- *var = val;
-
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
- return 0;
-}
-
-static PyObject *M_Render_getFloat( BPy_RenderData *self, float var )
-{
- return PyFloat_FromDouble( (double) var );
-}
-
-/** set / get integer */
-
-static int M_Render_setInt( BPy_RenderData *self, PyObject *value, int *var, int min, int max )
-{
- int val;
- char error[48];
-
- if( !PyInt_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected integer value" );
-
- val = (int) PyInt_AsLong( value );
-
- /* check range */
- if ( val < min || val > max ) {
- sprintf( error, "out of range - expected %d to %d", min, max );
- return EXPP_ReturnIntError( PyExc_TypeError,error );
- }
-
- *var = val;
-
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
- return 0;
-}
-
-static PyObject *M_Render_getInt( BPy_RenderData *self, int var )
-{
- return PyInt_FromLong( (long) var );
-}
-
-/***************************************************************************/
-/* Render Module Function Definitions */
-/***************************************************************************/
-
-PyObject *M_Render_CloseRenderWindow( PyObject * self )
-{
- BIF_close_render_display( );
- Py_RETURN_NONE;
-}
-
-PyObject *M_Render_SetRenderWinPos( PyObject * self, PyObject * args )
-{
- PyObject *list = NULL;
- char *loc = NULL;
- int x;
-
- if( !PyArg_ParseTuple( args, "O!", &PyList_Type, &list ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected a list" ) );
-
- G.winpos = 0;
- for( x = 0; x < PyList_Size( list ); x++ ) {
- if( !PyArg_Parse( PyList_GetItem( list, x ), "s", &loc ) ) {
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "python list not parseable" );
- }
- if( strcmp( loc, "SW" ) == 0 || strcmp( loc, "sw" ) == 0 )
- G.winpos |= 1;
- else if( strcmp( loc, "S" ) == 0 || strcmp( loc, "s" ) == 0 )
- G.winpos |= 2;
- else if( strcmp( loc, "SE" ) == 0 || strcmp( loc, "se" ) == 0 )
- G.winpos |= 4;
- else if( strcmp( loc, "W" ) == 0 || strcmp( loc, "w" ) == 0 )
- G.winpos |= 8;
- else if( strcmp( loc, "C" ) == 0 || strcmp( loc, "c" ) == 0 )
- G.winpos |= 16;
- else if( strcmp( loc, "E" ) == 0 || strcmp( loc, "e" ) == 0 )
- G.winpos |= 32;
- else if( strcmp( loc, "NW" ) == 0 || strcmp( loc, "nw" ) == 0 )
- G.winpos |= 64;
- else if( strcmp( loc, "N" ) == 0 || strcmp( loc, "n" ) == 0 )
- G.winpos |= 128;
- else if( strcmp( loc, "NE" ) == 0 || strcmp( loc, "ne" ) == 0 )
- G.winpos |= 256;
- else
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "list contains unknown string" );
- }
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
-
- Py_RETURN_NONE;
-}
-
-PyObject *M_Render_EnableDispView( PyObject * self )
-{
- G.displaymode = R_DISPLAYIMAGE;
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
-
- Py_RETURN_NONE;
-}
-
-PyObject *M_Render_EnableDispWin( PyObject * self )
-{
- G.displaymode = R_DISPLAYWIN;
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
-
- Py_RETURN_NONE;
-}
-
-
-/***************************************************************************/
-/* BPy_RenderData Function Definitions */
-/***************************************************************************/
-
-PyObject *RenderData_Render( BPy_RenderData * self )
-{
- Scene *oldsce;
-
- if (!G.background) {
- oldsce = G.scene;
- set_scene( self->scene );
- BIF_do_render( 0 );
- set_scene( oldsce );
- }
-
- else { /* background mode (blender -b file.blend -P script) */
- Render *re= RE_NewRender("Render");
-
- int end_frame = G.scene->r.efra; /* is of type short currently */
-
- if (G.scene != self->scene)
- return EXPP_ReturnPyObjError (PyExc_RuntimeError,
- "scene to render in bg mode must be the active scene");
-
- G.scene->r.efra = G.scene->r.sfra;
-
- RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra);
-
- G.scene->r.efra = (short)end_frame;
- }
-
- Py_RETURN_NONE;
-}
-
-/*
- * This will save the rendered image to an output file path already defined.
- */
-PyObject *RenderData_SaveRenderedImage ( BPy_RenderData * self, PyObject *args )
-{
- char dir[FILE_MAXDIR * 2], str[FILE_MAXFILE * 2];
- char *name_str, filepath[FILE_MAXDIR+FILE_MAXFILE];
- RenderResult *rr = NULL;
- int zbuff;
-
- if( !PyArg_ParseTuple( args, "s|i", &name_str, &zbuff ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected a filename (string) and optional int" );
-
- if( strlen(self->renderContext->pic) + strlen(name_str)
- >= sizeof(filepath) )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "full filename too long" );
-
- if (zbuff !=0 ) zbuff = 1; /*required 1/0 */ /* removed! (ton) */
-
- BLI_strncpy( filepath, self->renderContext->pic, sizeof(filepath) );
- strcat(filepath, name_str);
-
- rr = RE_GetResult(RE_GetRender(G.scene->id.name));
- if(!rr) {
- return EXPP_ReturnPyObjError (PyExc_ValueError, "No image rendered");
- } else {
- if(G.ima[0]==0) {
- strcpy(dir, G.sce);
- BLI_splitdirstring(dir, str);
- strcpy(G.ima, dir);
- }
- BIF_save_rendered_image(filepath);
- }
- Py_RETURN_NONE;
-}
-
-PyObject *RenderData_RenderAnim( BPy_RenderData * self )
-{
- Scene *oldsce;
-
- if (!G.background) {
- oldsce = G.scene;
- set_scene( self->scene );
- BIF_do_render( 1 );
- set_scene( oldsce );
- }
- else { /* background mode (blender -b file.blend -P script) */
- Render *re= RE_NewRender("Render");
-
- if (G.scene != self->scene)
- return EXPP_ReturnPyObjError (PyExc_RuntimeError,
- "scene to render in bg mode must be the active scene");
-
- if (G.scene->r.sfra > G.scene->r.efra)
- return EXPP_ReturnPyObjError (PyExc_RuntimeError,
- "start frame must be less or equal to end frame");
-
- RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra);
- }
- Py_RETURN_NONE;
-}
-
-PyObject *RenderData_Play( BPy_RenderData * self )
-{
- char file[FILE_MAXDIR + FILE_MAXFILE];
- extern char bprogname[];
- char str[FILE_MAXDIR + FILE_MAXFILE];
- int pos[2], size[2];
- char txt[64];
-
-#ifdef WITH_QUICKTIME
- if( self->renderContext->imtype == R_QUICKTIME ) {
-
- strcpy( file, self->renderContext->pic );
- BLI_convertstringcode( file, (char *) self->scene,
- self->renderContext->cfra );
- BLI_make_existing_file( file );
- if( BLI_strcasecmp( file + strlen( file ) - 4, ".mov" ) ) {
- sprintf( txt, "%04d_%04d.mov",
- ( self->renderContext->sfra ),
- ( self->renderContext->efra ) );
- strcat( file, txt );
- }
- } else
-#endif
- {
-
- strcpy( file, self->renderContext->pic );
- BLI_convertstringcode( file, G.sce,
- self->renderContext->cfra );
- BLI_make_existing_file( file );
- if( BLI_strcasecmp( file + strlen( file ) - 4, ".avi" ) ) {
- sprintf( txt, "%04d_%04d.avi",
- ( self->renderContext->sfra ),
- ( self->renderContext->efra ) );
- strcat( file, txt );
- }
- }
- if( BLI_exist( file ) ) {
- calc_renderwin_rectangle(640, 480, G.winpos, pos, size);
- sprintf( str, "%s -a -p %d %d \"%s\"", bprogname, pos[0],
- pos[1], file );
- system( str );
- } else {
- BKE_makepicstring( file, G.scene->r.pic, self->renderContext->sfra, G.scene->r.imtype);
- if( BLI_exist( file ) ) {
- calc_renderwin_rectangle(640, 480, G.winpos, pos, size);
-#ifdef WIN32
- sprintf( str, "%s -a -p %d %d \"%s\"", bprogname,
- pos[0], pos[1], file );
-#else
- sprintf( str, "\"%s\" -a -p %d %d \"%s\"", bprogname,
- pos[0], pos[1], file );
-#endif
- system( str );
- } else
- sprintf( "Can't find image: %s", file );
- }
-
- Py_RETURN_NONE;
-}
-
-PyObject *RenderData_EnableBackbuf( BPy_RenderData * self, PyObject * args )
-{
- return M_Render_BitToggleShort( args, 1,
- &self->renderContext->bufflag );
-}
-
-PyObject *RenderData_EnableExtensions( BPy_RenderData * self, PyObject * args )
-{
- return M_Render_BitToggleShort( args, R_EXTENSION,
- &self->renderContext->scemode );
-}
-
-PyObject *RenderData_EnableSequencer( BPy_RenderData * self, PyObject * args )
-{
- return M_Render_BitToggleShort( args, R_DOSEQ,
- &self->renderContext->scemode );
-}
-
-PyObject *RenderData_EnableRenderDaemon( BPy_RenderData * self,
- PyObject * args )
-{
- return M_Render_BitToggleShort( args, R_BG_RENDER,
- &self->renderContext->scemode );
-}
-
-PyObject *RenderData_EnableToonShading( BPy_RenderData * self,
- PyObject * args )
-{
- return M_Render_BitToggleInt( args, R_EDGE,
- &self->renderContext->mode );
-}
-
-PyObject *RenderData_EdgeIntensity( BPy_RenderData * self, PyObject * args )
-{
- return M_Render_GetSetAttributeShort( args,
- &self->renderContext->edgeint, 0,
- 255 );
-}
-
-PyObject *RenderData_SetEdgeColor( BPy_RenderData * self, PyObject * args )
-{
- float red, green, blue;
-
- if( !PyArg_ParseTuple( args, "fff", &red, &green, &blue ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected three floats" ) );
-
- if( red < 0 || red > 1 )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "value out of range 0.000 - 1.000 (red)" ) );
- if( green < 0 || green > 1 )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "value out of range 0.000 - 1.000 (green)" ) );
- if( blue < 0 || blue > 1 )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "value out of range 0.000 - 1.000 (blue)" ) );
-
- self->renderContext->edgeR = red;
- self->renderContext->edgeG = green;
- self->renderContext->edgeB = blue;
-
- Py_RETURN_NONE;
-}
-
-PyObject *RenderData_GetEdgeColor( BPy_RenderData * self )
-{
- char rgb[24];
-
- sprintf( rgb, "[%.3f,%.3f,%.3f]", self->renderContext->edgeR,
- self->renderContext->edgeG, self->renderContext->edgeB );
- return PyString_FromString( rgb );
-}
-
-PyObject *RenderData_EnableOversampling( BPy_RenderData * self,
- PyObject * args )
-{
- return M_Render_BitToggleInt( args, R_OSA,
- &self->renderContext->mode );
-}
-
-static int RenderData_setOSALevel( BPy_RenderData * self,
- PyObject * value )
-{
- int level;
-
- if( !PyInt_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected int argument" );
-
- level = PyInt_AsLong( value );
- if( level != 5 && level != 8 && level != 11 && level != 16 )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "expected 5, 8, 11, or 16" );
-
- self->renderContext->osa = (short)level;
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
-
- return 0;
-}
-
-PyObject *RenderData_EnableMotionBlur( BPy_RenderData * self, PyObject * args )
-{
- return M_Render_BitToggleInt( args, R_MBLUR,
- &self->renderContext->mode );
-}
-
-PyObject *RenderData_MotionBlurLevel( BPy_RenderData * self, PyObject * args )
-{
- return M_Render_GetSetAttributeFloat( args,
- &self->renderContext->blurfac,
- 0.01f, 5.0f );
-}
-
-PyObject *RenderData_PartsX( BPy_RenderData * self, PyObject * args )
-{
- return M_Render_GetSetAttributeShort( args,
- &self->renderContext->xparts, 1,
- 512 );
-}
-
-PyObject *RenderData_PartsY( BPy_RenderData * self, PyObject * args )
-{
- return M_Render_GetSetAttributeShort( args,
- &self->renderContext->yparts, 1,
- 64 );
-}
-
-PyObject *RenderData_EnableSky( BPy_RenderData * self )
-{
- self->renderContext->alphamode = R_ADDSKY;
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
-
- Py_RETURN_NONE;
-}
-
-PyObject *RenderData_EnablePremultiply( BPy_RenderData * self )
-{
- self->renderContext->alphamode = R_ALPHAPREMUL;
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
-
- Py_RETURN_NONE;
-}
-
-PyObject *RenderData_EnableKey( BPy_RenderData * self )
-{
- self->renderContext->alphamode = R_ALPHAKEY;
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
-
- Py_RETURN_NONE;
-}
-
-PyObject *RenderData_EnableShadow( BPy_RenderData * self, PyObject * args )
-{
- return M_Render_BitToggleInt( args, R_SHADOW,
- &self->renderContext->mode );
-}
-
-PyObject *RenderData_EnableEnvironmentMap( BPy_RenderData * self,
- PyObject * args )
-{
- return M_Render_BitToggleInt( args, R_ENVMAP,
- &self->renderContext->mode );
-}
-
-PyObject *RenderData_EnablePanorama( BPy_RenderData * self, PyObject * args )
-{
- return M_Render_BitToggleInt( args, R_PANORAMA,
- &self->renderContext->mode );
-}
-
-PyObject *RenderData_EnableRayTracing( BPy_RenderData * self, PyObject * args )
-{
- return M_Render_BitToggleInt( args, R_RAYTRACE,
- &self->renderContext->mode );
-}
-
-PyObject *RenderData_EnableRadiosityRender( BPy_RenderData * self,
- PyObject * args )
-{
- return M_Render_BitToggleInt( args, R_RADIO,
- &self->renderContext->mode );
-}
-PyObject *RenderData_EnableFieldRendering( BPy_RenderData * self,
- PyObject * args )
-{
- return M_Render_BitToggleInt( args, R_FIELDS,
- &self->renderContext->mode );
-}
-
-PyObject *RenderData_EnableOddFieldFirst( BPy_RenderData * self,
- PyObject * args )
-{
- return M_Render_BitToggleInt( args, R_ODDFIELD,
- &self->renderContext->mode );
-}
-
-PyObject *RenderData_EnableFieldTimeDisable( BPy_RenderData * self,
- PyObject * args )
-{
- return M_Render_BitToggleInt( args, R_FIELDSTILL,
- &self->renderContext->mode );
-}
-
-PyObject *RenderData_EnableGaussFilter( BPy_RenderData * self,
- PyObject * args )
-{
- return M_Render_BitToggleInt( args, R_GAUSS,
- &self->renderContext->mode );
-
- /* note, this now is obsolete (ton) */
- /* we now need a call like RenderData_SetFilter() or so */
- /* choices are listed in DNA_scene_types.h (search filtertype) */
-}
-
-PyObject *RenderData_EnableBorderRender( BPy_RenderData * self,
- PyObject * args )
-{
- return M_Render_BitToggleInt( args, R_BORDER,
- &self->renderContext->mode );
-}
-
-static int RenderData_setBorder( BPy_RenderData * self, PyObject * args )
-{
- float xmin, ymin, xmax, ymax;
-
- if( PyList_Check( args ) )
- args = PySequence_Tuple( args );
- else
- Py_INCREF( args );
-
- if( !PyArg_ParseTuple( args, "ffff", &xmin, &ymin, &xmax, &ymax ) ) {
- Py_DECREF( args );
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected four floats" );
- }
-
- self->renderContext->border.xmin = EXPP_ClampFloat( xmin, 0.0, 1.0 );
- self->renderContext->border.xmax = EXPP_ClampFloat( xmax, 0.0, 1.0 );
- self->renderContext->border.ymin = EXPP_ClampFloat( ymin, 0.0, 1.0 );
- self->renderContext->border.ymax = EXPP_ClampFloat( ymax, 0.0, 1.0 );
-
- EXPP_allqueue( REDRAWVIEWCAM, 1 );
-
- Py_DECREF( args );
- return 0;
-}
-
-static PyObject *RenderData_getBorder( BPy_RenderData * self )
-{
- return Py_BuildValue( "[ffff]",
- self->renderContext->border.xmin,
- self->renderContext->border.ymin,
- self->renderContext->border.xmax,
- self->renderContext->border.ymax );
-}
-
-PyObject *RenderData_EnableGammaCorrection( BPy_RenderData * self,
- PyObject * args )
-{
- return M_Render_BitToggleInt( args, R_GAMMA,
- &self->renderContext->mode );
-}
-
-PyObject *RenderData_GaussFilterSize( BPy_RenderData * self, PyObject * args )
-{
- return M_Render_GetSetAttributeFloat( args,
- &self->renderContext->gauss,
- 0.5f, 1.5f );
-}
-
-PyObject *RenderData_StartFrame( BPy_RenderData * self, PyObject * args )
-{
- return M_Render_GetSetAttributeInt( args, &self->renderContext->sfra,
- 1, MAXFRAME );
-}
-
-PyObject *RenderData_CurrentFrame( BPy_RenderData * self, PyObject * args )
-{
- return M_Render_GetSetAttributeInt( args, &self->renderContext->cfra,
- 1, MAXFRAME );
-}
-
-PyObject *RenderData_EndFrame( BPy_RenderData * self, PyObject * args )
-{
- return M_Render_GetSetAttributeInt( args, &self->renderContext->efra,
- 1, MAXFRAME );
-}
-
-PyObject *RenderData_ImageSizeX( BPy_RenderData * self, PyObject * args )
-{
- return M_Render_GetSetAttributeShort( args, &self->renderContext->xsch,
- 4, 10000 );
-}
-
-PyObject *RenderData_ImageSizeY( BPy_RenderData * self, PyObject * args )
-{
- return M_Render_GetSetAttributeShort( args, &self->renderContext->ysch,
- 4, 10000 );
-}
-
-PyObject *RenderData_AspectRatioX( BPy_RenderData * self, PyObject * args )
-{
- return M_Render_GetSetAttributeShort( args, &self->renderContext->xasp,
- 1, 200 );
-}
-
-PyObject *RenderData_AspectRatioY( BPy_RenderData * self, PyObject * args )
-{
- return M_Render_GetSetAttributeShort( args, &self->renderContext->yasp,
- 1, 200 );
-}
-
-static int RenderData_setRenderer( BPy_RenderData * self, PyObject * value )
-{
- int type;
-
- if( !PyInt_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected constant INTERNAL or YAFRAY" );
-
- type = PyInt_AsLong( value );
- if( type == R_INTERN )
- self->renderContext->renderer = R_INTERN;
- else if( type == R_YAFRAY )
- self->renderContext->renderer = R_YAFRAY;
- else
- return EXPP_ReturnIntError( PyExc_ValueError,
- "expected constant INTERNAL or YAFRAY" );
-
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
- return 0;
-}
-
-PyObject *RenderData_EnableCropping( void )
-{
-/* return M_Render_BitToggleInt( args, R_MOVIECROP,
- &self->renderContext->mode );
-*/
- printf("cropping option is now default, obsolete\n");
- Py_RETURN_NONE;
-}
-
-
-static int RenderData_setImageType( BPy_RenderData *self, PyObject *value )
-{
- int type;
-
- if( !PyInt_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected int constant" );
-
- type = PyInt_AS_LONG( value );
-
- /*
- * this same logic and more is in buttons_scene.c imagetype_pup code but
- * only in generating strings for the popup menu, no way to reuse that :(
- */
-
- switch( type ) {
- case R_AVIRAW :
- case R_AVIJPEG :
- case R_TARGA :
- case R_RAWTGA :
- case R_RADHDR :
- case R_PNG :
- case R_BMP :
- case R_JPEG90 :
- case R_HAMX :
- case R_IRIS :
- case R_IRIZ :
- case R_FTYPE :
- case R_TIFF :
- case R_CINEON :
- case R_DPX :
-#ifdef _WIN32
- case R_AVICODEC :
-#endif
-#ifdef WITH_OPENEXR
- case R_OPENEXR :
-#endif
-#ifdef WITH_FFMPEG
- case R_FFMPEG :
-#endif
- self->renderContext->imtype = type;
- break;
- case R_QUICKTIME :
- if( G.have_quicktime ) {
- self->renderContext->imtype = R_QUICKTIME;
- break;
- }
- default:
- return EXPP_ReturnIntError( PyExc_ValueError,
- "unknown constant - see modules dict for help" );
- }
-
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
- return 0;
-}
-
-PyObject *RenderData_Quality( BPy_RenderData * self, PyObject * args )
-{
- return M_Render_GetSetAttributeShort( args,
- &self->renderContext->quality,
- 10, 100 );
-}
-
-PyObject *RenderData_FramesPerSec( BPy_RenderData * self, PyObject * args )
-{
- return M_Render_GetSetAttributeShort( args,
- &self->renderContext->frs_sec, 1,
- 120 );
-}
-
-PyObject *RenderData_EnableGrayscale( BPy_RenderData * self )
-{
- self->renderContext->planes = R_PLANESBW;
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
-
- Py_RETURN_NONE;
-}
-
-PyObject *RenderData_EnableRGBColor( BPy_RenderData * self )
-{
- self->renderContext->planes = R_PLANES24;
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
-
- Py_RETURN_NONE;
-}
-
-PyObject *RenderData_EnableRGBAColor( BPy_RenderData * self )
-{
- self->renderContext->planes = R_PLANES32;
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
-
- Py_RETURN_NONE;
-}
-
-PyObject *RenderData_SizePreset( BPy_RenderData * self, PyObject * args )
-{
- int type;
-
- if( !PyArg_ParseTuple( args, "i", &type ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected constant" ) );
-
- if( type == B_PR_PAL ) {
- M_Render_DoSizePreset( self, 720, 576, 54, 51, 100,
- self->renderContext->xparts,
- self->renderContext->yparts, 25, 1.0f,
- 0.1f,
- 0.9f, 0.1f, 0.9f );
- self->renderContext->mode &= ~R_PANORAMA;
- BLI_init_rctf( &self->renderContext->safety, 0.1f, 0.9f, 0.1f,
- 0.9f );
- } else if( type == B_PR_NTSC ) {
- M_Render_DoSizePreset( self, 720, 480, 10, 11, 100, 1, 1,
- 30, 1.001f,
- 0.1f, 0.9f, 0.1f, 0.9f );
- self->renderContext->mode &= ~R_PANORAMA;
- BLI_init_rctf( &self->renderContext->safety, 0.1f, 0.9f, 0.1f,
- 0.9f );
- } else if( type == B_PR_PRESET ) {
- M_Render_DoSizePreset( self, 720, 576, 54, 51, 100, 1, 1,
- self->renderContext->frs_sec,
- self->renderContext->frs_sec_base,
- 0.1f, 0.9f,
- 0.1f, 0.9f );
- self->renderContext->mode = R_OSA + R_SHADOW + R_FIELDS;
- self->renderContext->imtype = R_TARGA;
- BLI_init_rctf( &self->renderContext->safety, 0.1f, 0.9f, 0.1f,
- 0.9f );
- } else if( type == B_PR_PRV ) {
- M_Render_DoSizePreset( self, 640, 512, 1, 1, 50, 1, 1,
- self->renderContext->frs_sec,
- self->renderContext->frs_sec_base,
- 0.1f, 0.9f,
- 0.1f, 0.9f );
- self->renderContext->mode &= ~R_PANORAMA;
- BLI_init_rctf( &self->renderContext->safety, 0.1f, 0.9f, 0.1f,
- 0.9f );
- } else if( type == B_PR_PC ) {
- M_Render_DoSizePreset( self, 640, 480, 100, 100, 100, 1, 1,
- self->renderContext->frs_sec,
- self->renderContext->frs_sec_base,
- 0.0f, 1.0f,
- 0.0f, 1.0f );
- self->renderContext->mode &= ~R_PANORAMA;
- BLI_init_rctf( &self->renderContext->safety, 0.0f, 1.0f, 0.0f,
- 1.0f );
- } else if( type == B_PR_PAL169 ) {
- M_Render_DoSizePreset( self, 720, 576, 64, 45, 100, 1, 1,
- 25, 1.0f, 0.1f, 0.9f, 0.1f, 0.9f );
- self->renderContext->mode &= ~R_PANORAMA;
- BLI_init_rctf( &self->renderContext->safety, 0.1f, 0.9f, 0.1f,
- 0.9f );
- } else if( type == B_PR_PANO ) {
- M_Render_DoSizePreset( self, 36, 176, 115, 100, 100, 16, 1,
- self->renderContext->frs_sec,
- self->renderContext->frs_sec_base,
- 0.1f, 0.9f,
- 0.1f, 0.9f );
- self->renderContext->mode |= R_PANORAMA;
- BLI_init_rctf( &self->renderContext->safety, 0.1f, 0.9f, 0.1f,
- 0.9f );
- } else if( type == B_PR_FULL ) {
- M_Render_DoSizePreset( self, 1280, 1024, 1, 1, 100, 1, 1,
- self->renderContext->frs_sec,
- self->renderContext->frs_sec_base,
- 0.1f, 0.9f,
- 0.1f, 0.9f );
- self->renderContext->mode &= ~R_PANORAMA;
- BLI_init_rctf( &self->renderContext->safety, 0.1f, 0.9f, 0.1f,
- 0.9f );
- } else
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "unknown constant - see modules dict for help" ) );
-
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
- Py_RETURN_NONE;
-}
-
-/*
-
-PyObject *RenderData_SetYafrayGIQuality( BPy_RenderData * self,
- PyObject * args )
-{
- int type;
-
- if( !PyArg_ParseTuple( args, "i", &type ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected constant" ) );
-
- if( type == PY_NONE || type == PY_LOW ||
- type == PY_MEDIUM || type == PY_HIGH ||
- type == PY_HIGHER || type == PY_BEST ) {
- self->renderContext->GIquality = (short)type;
- } else
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "unknown constant - see modules dict for help" ) );
-
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
- Py_RETURN_NONE;
-}
-
-PyObject *RenderData_SetYafrayGIMethod( BPy_RenderData * self,
- PyObject * args )
-{
- int type;
-
- if( !PyArg_ParseTuple( args, "i", &type ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected constant" ) );
-
- if( type == PY_NONE || type == PY_SKYDOME || type == PY_FULL ) {
- self->renderContext->GImethod = (short)type;
- } else
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "unknown constant - see modules dict for help" ) );
-
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
- Py_RETURN_NONE;
-}
-*/
-
-/* (die) beg */
-
-/* YafRay - Yafray GI Method */
-
-static int RenderData_setYafrayGIQuality( BPy_RenderData * self, PyObject * value )
-{
- long type;
-
- if( !PyInt_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected constant" );
-
- type = PyInt_AsLong( value );
-
- if( type == PY_NONE || type == PY_LOW ||
- type == PY_MEDIUM || type == PY_HIGH ||
- type == PY_HIGHER || type == PY_BEST ||
- type == PY_USEAOSETTINGS
- ) {
- self->renderContext->GIquality = (short)type;
- } else {
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected constant NONE, LOW, MEDIUM, HIGHER or BEST" );
- }
-
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
- return 0;
-}
-
-static PyObject *RenderData_getYafrayGIQuality( BPy_RenderData * self )
-{
- return PyInt_FromLong( (long) self->renderContext->GIquality );
-}
-
-static PyObject *RenderData_SetYafrayGIQuality( BPy_RenderData * self,
- PyObject * args )
-{
- return EXPP_setterWrapper( (void*) self, args,
- (setter) RenderData_setYafrayGIQuality );
-}
-
-static PyObject *RenderData_GetYafrayGIQuality( BPy_RenderData * self )
-{
- return RenderData_getYafrayGIQuality(self);
-}
-
-/* YafRay - Yafray GI Method */
-
-static int RenderData_setYafrayGIMethod( BPy_RenderData * self, PyObject * value )
-{
- int type;
-
- if( !PyInt_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected constant NONE, SKYDOME or FULL" );
-
- type = PyInt_AsLong( value );
- if( type == PY_NONE || type == PY_SKYDOME || type == PY_FULL ) {
- self->renderContext->GImethod = (short)type;
- } else {
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected constant NONE, SKYDOME or FULL" );
- }
-
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
- return 0;
-}
-
-static PyObject *RenderData_getYafrayGIMethod( BPy_RenderData * self )
-{
- return PyInt_FromLong( (long)self->renderContext->GImethod );
-}
-
-static PyObject *RenderData_GetYafrayGIMethod( BPy_RenderData * self )
-{
- return RenderData_getYafrayGIMethod(self);
-}
-
-static PyObject *RenderData_SetYafrayGIMethod( BPy_RenderData * self,
- PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)RenderData_setYafrayGIMethod );
-}
-
-
-/* YafRay - Export to XML */
-
-static int RenderData_setYafrayExportToXML( BPy_RenderData * self, PyObject * value )
-{
- return M_Render_setBooleanShort( self, value, &self->renderContext->YFexportxml );
-}
-
-static PyObject *RenderData_getYafrayExportToXML( BPy_RenderData * self )
-{
- return M_Render_getBooleanShort( self, self->renderContext->YFexportxml );
-}
-
-/** Auto AA */
-
-static int RenderData_setYafrayAutoAntiAliasing( BPy_RenderData * self, PyObject * value )
-{
- return M_Render_setBooleanShort( self, value, &self->renderContext->YF_AA );
-}
-
-static PyObject *RenderData_getYafrayAutoAntiAliasing( BPy_RenderData * self )
-{
- return M_Render_getBooleanShort( self, self->renderContext->YF_AA );
-}
-
-/** Clamp RGB */
-
-static int RenderData_setYafrayClampRGB( BPy_RenderData * self, PyObject * value )
-{
- return M_Render_setBooleanShort( self, value, &self->renderContext->YF_clamprgb );
-}
-
-static PyObject *RenderData_getYafrayClampRGB( BPy_RenderData * self )
-{
- return M_Render_getBooleanShort( self, self->renderContext->YF_clamprgb );
-}
-
-/** YafRay - Anti-Aliasing Passes */
-
-static int RenderData_setYafrayAntiAliasingPasses( BPy_RenderData * self, PyObject * value )
-{
- return M_Render_setInt( self, value, &self->renderContext->YF_AApasses, 0, 64 );
-}
-
-static PyObject *RenderData_getYafrayAntiAliasingPasses( BPy_RenderData * self )
-{
- return M_Render_getInt( self, self->renderContext->YF_AApasses );
-}
-
-/** YafRay - Anti-Aliasing Samples */
-
-static int RenderData_setYafrayAntiAliasingSamples( BPy_RenderData * self, PyObject * value )
-{
- return M_Render_setInt( self, value, &self->renderContext->YF_AAsamples, 0, 2048 );
-}
-
-static PyObject *RenderData_getYafrayAntiAliasingSamples( BPy_RenderData * self )
-{
- return M_Render_getInt( self, self->renderContext->YF_AAsamples );
-}
-
-/* YafRay - Anti-Aliasing Pixel Filter Size */
-
-static int RenderData_setYafrayAntiAliasingPixelSize( BPy_RenderData * self, PyObject * value )
-{
- return M_Render_setFloat( self, value, &self->renderContext->YF_AApixelsize, 1.0, 2.0 );
-}
-
-static PyObject *RenderData_getYafrayAntiAliasingPixelSize( BPy_RenderData * self )
-{
- return M_Render_getFloat( self, self->renderContext->YF_AApixelsize );
-}
-
-/* YafRay - Anti-Aliasing threshold */
-
-static int RenderData_setYafrayAntiAliasingThreshold( BPy_RenderData * self, PyObject * value )
-{
- return M_Render_setFloat( self, value, &self->renderContext->YF_AAthreshold, 0.05, 1.0 );
-}
-
-static PyObject *RenderData_getYafrayAntiAliasingThreshold( BPy_RenderData * self )
-{
- return M_Render_getFloat( self, self->renderContext->YF_AAthreshold );
-}
-
-/** YafRay - Number of processors to use */
-
-static int RenderData_setYafrayNumberOfProcessors( BPy_RenderData * self, PyObject * value )
-{
- return M_Render_setInt( self, value, &self->renderContext->YF_numprocs, 1, 8 );
-}
-
-static PyObject *RenderData_getYafrayNumberOfProcessors( BPy_RenderData * self )
-{
- return M_Render_getInt( self, self->renderContext->YF_numprocs );
-}
-
-/* YafRay - Cache occlusion/irradiance samples (faster) */
-
-static int RenderData_setYafrayGICache( BPy_RenderData * self, PyObject * value )
-{
- return M_Render_setBooleanShort( self, value, &self->renderContext->GIcache );
-}
-
-static PyObject *RenderData_getYafrayGICache( BPy_RenderData * self )
-{
- return M_Render_getBooleanShort( self, self->renderContext->GIcache );
-}
-
-/* YafRay - Enable/disable bumpnormals for cache
- (faster, but no bumpmapping in total indirectly lit areas) */
-
-static int RenderData_setYafrayGICacheBumpNormals( BPy_RenderData * self, PyObject * value )
-{
- return M_Render_setBooleanShort( self, value, &self->renderContext->YF_nobump );
-}
-
-static PyObject *RenderData_getYafrayGICacheBumpNormals( BPy_RenderData * self )
-{
- return M_Render_getBooleanShort( self, self->renderContext->YF_nobump );
-}
-
-/* YafRay - Shadow quality, keep it under 0.95 :-) */
-
-static int RenderData_setYafrayGICacheShadowQuality( BPy_RenderData * self, PyObject * value )
-{
- return M_Render_setFloat( self, value, &self->renderContext->GIshadowquality, 0.01, 1.0 );
-}
-
-static PyObject *RenderData_getYafrayGICacheShadowQuality( BPy_RenderData * self )
-{
- return M_Render_getFloat( self, self->renderContext->GIshadowquality );
-}
-
-/* YafRay - Threshold to refine shadows EXPERIMENTAL. 1 = no refinement */
-
-static int RenderData_setYafrayGICacheRefinement( BPy_RenderData * self, PyObject * value )
-{
- return M_Render_setFloat( self, value, &self->renderContext->GIrefinement, 0.001, 1.0 );
-}
-
-static PyObject *RenderData_getYafrayGICacheRefinement( BPy_RenderData * self )
-{
- return M_Render_getFloat( self, self->renderContext->GIrefinement );
-}
-
-/* YafRay - Maximum number of pixels without samples, the lower the better and slower */
-
-static int RenderData_setYafrayGICachePixelsPerSample( BPy_RenderData * self, PyObject * value )
-{
- return M_Render_setInt( self, value, &self->renderContext->GIpixelspersample, 1, 50 );
-}
-
-static PyObject *RenderData_getYafrayGICachePixelsPerSample( BPy_RenderData * self )
-{
- return M_Render_getInt( self, self->renderContext->GIpixelspersample );
-}
-
-/** YafRay - Enable/disable use of global photons to help in GI */
-
-static int RenderData_setYafrayGIPhotons( BPy_RenderData * self, PyObject * value )
-{
- return M_Render_setBooleanShort( self, value, &self->renderContext->GIphotons );
-}
-
-static PyObject *RenderData_getYafrayGIPhotons( BPy_RenderData * self )
-{
- return M_Render_getBooleanShort( self, self->renderContext->GIphotons );
-}
-
-/** YafRay - If true the photonmap is shown directly in the render for tuning */
-
-static int RenderData_setYafrayGITunePhotons( BPy_RenderData * self, PyObject * value )
-{
- return M_Render_setBooleanShort( self, value, &self->renderContext->GIdirect );
-}
-
-static PyObject *RenderData_getYafrayGITunePhotons( BPy_RenderData * self )
-{
- return M_Render_getBooleanShort( self, self->renderContext->GIdirect );
-}
-
-/* (die) end */
-
-PyObject *RenderData_YafrayGIPower( BPy_RenderData * self, PyObject * args )
-{
- if( self->renderContext->GImethod > 0 ) {
- return M_Render_GetSetAttributeFloat( args,
- &self->renderContext->
- GIpower, 0.01f,
- 100.00f );
- } else
- return ( EXPP_ReturnPyObjError( PyExc_StandardError,
- "YafrayGIMethod must be set to 'SKYDOME' or 'FULL'" ) );
-}
-
-PyObject *RenderData_YafrayGIIndirPower( BPy_RenderData * self, PyObject * args )
-{
- return M_Render_GetSetAttributeFloat( args,
- &self->renderContext->
- GIindirpower, 0.01f,
- 100.00f );
-}
-
-PyObject *RenderData_YafrayGIDepth( BPy_RenderData * self, PyObject * args )
-{
- if( self->renderContext->GImethod == 2 ) {
- return M_Render_GetSetAttributeInt( args,
- &self->renderContext->
- GIdepth, 1, 100 );
- } else
- return ( EXPP_ReturnPyObjError( PyExc_StandardError,
- "YafrayGIMethod must be set to 'FULL'" ) );
-}
-
-PyObject *RenderData_YafrayGICDepth( BPy_RenderData * self, PyObject * args )
-{
- if( self->renderContext->GImethod == 2 ) {
- return M_Render_GetSetAttributeInt( args,
- &self->renderContext->
- GIcausdepth, 1, 100 );
- } else
- return ( EXPP_ReturnPyObjError( PyExc_StandardError,
- "YafrayGIMethod must be set to 'FULL'" ) );
-}
-
-PyObject *RenderData_EnableYafrayGICache( BPy_RenderData * self,
- PyObject * args )
-{
- if( self->renderContext->GImethod == 2 ) {
- return M_Render_BitToggleShort( args, 1,
- &self->renderContext->
- GIcache );
- } else
- return ( EXPP_ReturnPyObjError( PyExc_StandardError,
- "YafrayGIMethod must be set to 'FULL'" ) );
-}
-
-PyObject *RenderData_EnableYafrayGIPhotons( BPy_RenderData * self,
- PyObject * args )
-{
- if( self->renderContext->GImethod == 2 ) {
- return M_Render_BitToggleShort( args, 1,
- &self->renderContext->
- GIphotons );;
- } else
- return ( EXPP_ReturnPyObjError( PyExc_StandardError,
- "YafrayGIMethod must be set to 'FULL'" ) );
-}
-
-PyObject *RenderData_YafrayGIPhotonCount( BPy_RenderData * self,
- PyObject * args )
-{
- if( self->renderContext->GImethod == 2
- && self->renderContext->GIphotons == 1 ) {
- return M_Render_GetSetAttributeInt( args,
- &self->renderContext->
- GIphotoncount, 100000,
- 10000000 );
- } else
- return ( EXPP_ReturnPyObjError( PyExc_StandardError,
- "YafrayGIMethod must be set to 'FULL' and GIPhotons must be enabled" ) );
-}
-
-PyObject *RenderData_YafrayGIPhotonRadius( BPy_RenderData * self,
- PyObject * args )
-{
- if( self->renderContext->GImethod == 2
- && self->renderContext->GIphotons == 1 ) {
- return M_Render_GetSetAttributeFloat( args,
- &self->renderContext->
- GIphotonradius, 0.00001f,
- 100.0f );
- } else
- return ( EXPP_ReturnPyObjError( PyExc_StandardError,
- "YafrayGIMethod must be set to 'FULL' and GIPhotons must be enabled" ) );
-}
-
-PyObject *RenderData_YafrayGIPhotonMixCount( BPy_RenderData * self,
- PyObject * args )
-{
- if( self->renderContext->GImethod == 2
- && self->renderContext->GIphotons == 1 ) {
- return M_Render_GetSetAttributeInt( args,
- &self->renderContext->
- GImixphotons, 100, 1000 );
- } else
- return ( EXPP_ReturnPyObjError( PyExc_StandardError,
- "YafrayGIMethod must be set to 'FULL' and GIPhotons must be enabled" ) );
-}
-
-PyObject *RenderData_EnableYafrayGITunePhotons( BPy_RenderData * self,
- PyObject * args )
-{
- if( self->renderContext->GImethod == 2
- && self->renderContext->GIphotons == 1 ) {
- return M_Render_BitToggleShort( args, 1,
- &self->renderContext->
- GIdirect );;
- } else
- return ( EXPP_ReturnPyObjError( PyExc_StandardError,
- "YafrayGIMethod must be set to 'FULL' and GIPhotons must be enabled" ) );
-}
-
-PyObject *RenderData_YafrayGIShadowQuality( BPy_RenderData * self,
- PyObject * args )
-{
- if( self->renderContext->GImethod == 2
- && self->renderContext->GIcache == 1 ) {
- return M_Render_GetSetAttributeFloat( args,
- &self->renderContext->
- GIshadowquality, 0.01f,
- 1.0f );
- } else
- return ( EXPP_ReturnPyObjError( PyExc_StandardError,
- "YafrayGIMethod must be set to 'FULL' and GICache must be enabled" ) );
-}
-
-PyObject *RenderData_YafrayGIPixelsPerSample( BPy_RenderData * self,
- PyObject * args )
-{
- if( self->renderContext->GImethod == 2
- && self->renderContext->GIcache == 1 ) {
- return M_Render_GetSetAttributeInt( args,
- &self->renderContext->
- GIpixelspersample, 1, 50 );
- } else
- return ( EXPP_ReturnPyObjError( PyExc_StandardError,
- "YafrayGIMethod must be set to 'FULL' and GICache must be enabled" ) );
-}
-
-PyObject *RenderData_YafrayGIRefinement( BPy_RenderData * self,
- PyObject * args )
-{
- if( self->renderContext->GImethod == 2
- && self->renderContext->GIcache == 1 ) {
- return M_Render_GetSetAttributeFloat( args,
- &self->renderContext->
- GIrefinement, 0.001f,
- 1.0f );
- } else
- return ( EXPP_ReturnPyObjError( PyExc_StandardError,
- "YafrayGIMethod must be set to 'FULL' and GICache must be enabled" ) );
-}
-
-PyObject *RenderData_YafrayRayBias( BPy_RenderData * self, PyObject * args )
-{
- return M_Render_GetSetAttributeFloat( args,
- &self->renderContext->YF_raybias,
- 0.0f, 10.0f );
-}
-
-PyObject *RenderData_YafrayRayDepth( BPy_RenderData * self, PyObject * args )
-{
- return M_Render_GetSetAttributeInt( args,
- &self->renderContext->YF_raydepth,
- 1, 80 );
-}
-
-PyObject *RenderData_YafrayGamma( BPy_RenderData * self, PyObject * args )
-{
- return M_Render_GetSetAttributeFloat( args,
- &self->renderContext->YF_gamma,
- 0.001f, 5.0f );
-}
-
-PyObject *RenderData_YafrayExposure( BPy_RenderData * self, PyObject * args )
-{
- return M_Render_GetSetAttributeFloat( args,
- &self->renderContext->
- YF_exposure, 0.0f, 10.0f );
-}
-
-PyObject *RenderData_YafrayProcessorCount( BPy_RenderData * self,
- PyObject * args )
-{
- return M_Render_GetSetAttributeInt( args,
- &self->renderContext->YF_numprocs,
- 1, 8 );
-}
-
-PyObject *RenderData_EnableGameFrameStretch( BPy_RenderData * self )
-{
- self->scene->framing.type = SCE_GAMEFRAMING_SCALE;
- Py_RETURN_NONE;
-}
-
-PyObject *RenderData_EnableGameFrameExpose( BPy_RenderData * self )
-{
- self->scene->framing.type = SCE_GAMEFRAMING_EXTEND;
- Py_RETURN_NONE;
-}
-
-PyObject *RenderData_EnableGameFrameBars( BPy_RenderData * self )
-{
- self->scene->framing.type = SCE_GAMEFRAMING_BARS;
- Py_RETURN_NONE;
-}
-
-PyObject *RenderData_SetGameFrameColor( BPy_RenderData * self,
- PyObject * args )
-{
- float red = 0.0f;
- float green = 0.0f;
- float blue = 0.0f;
-
- if( !PyArg_ParseTuple( args, "fff", &red, &green, &blue ) )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected three floats" ) );
-
- if( red < 0 || red > 1 )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "value out of range 0.000 - 1.000 (red)" ) );
- if( green < 0 || green > 1 )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "value out of range 0.000 - 1.000 (green)" ) );
- if( blue < 0 || blue > 1 )
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "value out of range 0.000 - 1.000 (blue)" ) );
-
- self->scene->framing.col[0] = red;
- self->scene->framing.col[1] = green;
- self->scene->framing.col[2] = blue;
-
- Py_RETURN_NONE;
-}
-
-PyObject *RenderData_GetGameFrameColor( BPy_RenderData * self )
-{
- char rgb[24];
-
- sprintf( rgb, "[%.3f,%.3f,%.3f]", self->scene->framing.col[0],
- self->scene->framing.col[1], self->scene->framing.col[2] );
- return PyString_FromString( rgb );
-}
-
-#ifdef __sgi
-PyObject *RenderData_SGIMaxsize( BPy_RenderData * self, PyObject * args )
-{
- return M_Render_GetSetAttributeShort( args,
- &self->renderContext->maximsize,
- 0, 500 );
-}
-
-PyObject *RenderData_EnableSGICosmo( BPy_RenderData *self, PyObject *args )
-{
- return M_Render_BitToggleInt( args, R_COSMO,
- &self->renderContext->mode );
-}
-#else
-PyObject *RenderData_SGIMaxsize( void )
-{
- return EXPP_ReturnPyObjError( PyExc_StandardError,
- "SGI is not defined on this machine" );
-}
-
-PyObject *RenderData_EnableSGICosmo( void )
-{
- return EXPP_ReturnPyObjError( PyExc_StandardError,
- "SGI is not defined on this machine" );
-}
-#endif
-
-PyObject *RenderData_OldMapValue( BPy_RenderData * self, PyObject * args )
-{
- PyObject *tmp = M_Render_GetSetAttributeInt(args,
- &self->renderContext->framapto, 1, 900);
- self->renderContext->framelen =
- (float)self->renderContext->framapto / self->renderContext->images;
- return tmp;
-}
-
-PyObject *RenderData_NewMapValue( BPy_RenderData * self, PyObject * args )
-{
- PyObject *tmp = M_Render_GetSetAttributeInt(args,
- &self->renderContext->images, 1, 900);
- self->renderContext->framelen =
- (float)self->renderContext->framapto / self->renderContext->images;
- return tmp;
-}
-
-static PyObject *RenderData_getTimeCode( BPy_RenderData * self) {
- char tc[12];
- int h, m, s, cfa;
- double fps;
-
- fps = (double) self->renderContext->frs_sec /
- self->renderContext->frs_sec_base;
- cfa = self->renderContext->cfra-1;
- s = cfa / fps;
- m = s / 60;
- h = m / 60;
- if( h > 99 )
- return PyString_FromString("Time Greater than 99 Hours!");
-
- sprintf( tc, "%02d:%02d:%02d:%02d", h%60, m%60, s%60,
- (int) (cfa - ((int) (cfa / fps) * fps)));
- return PyString_FromString(tc);
-}
-
-/***************************************************************************/
-/* generic handlers for getting/setting attributes */
-/***************************************************************************/
-
-/*
- * get floating point attributes
- */
-
-static PyObject *RenderData_getFloatAttr( BPy_RenderData *self, void *type )
-{
- float param;
-
- switch( (int)type ) {
- case EXPP_RENDER_ATTR_GAUSSFILTER:
- param = self->renderContext->gauss;
- break;
- case EXPP_RENDER_ATTR_MBLURFACTOR:
- param = self->renderContext->blurfac;
- break;
- case EXPP_RENDER_ATTR_FPS_BASE:
- param = self->renderContext->frs_sec_base;
- break;
- default:
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "undefined type constant in RenderData_getFloatAttr" );
- }
- return PyFloat_FromDouble( param );
-}
-
-/*
- * set floating point attributes which require clamping
- */
-
-static int RenderData_setFloatAttrClamp( BPy_RenderData *self, PyObject *value,
- void *type )
-{
- float *param;
- float min, max;
-
- switch( (int)type ) {
- case EXPP_RENDER_ATTR_GAUSSFILTER:
- min = 0.5f;
- max = 1.5f;
- param = &self->renderContext->gauss;
- break;
- case EXPP_RENDER_ATTR_MBLURFACTOR:
- min = 0.01f;
- max = 5.0f;
- param = &self->renderContext->blurfac;
- break;
- case EXPP_RENDER_ATTR_FPS_BASE:
- min = 1.0f;
- max = 120.0f;
- param = &self->renderContext->frs_sec_base;
- break;
- default:
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "undefined type constant in RenderData_setFloatAttrClamp" );
- }
- return EXPP_setFloatClamped( value, param, min, max );
-}
-
-/*
- * get integer attributes
- */
-
-static PyObject *RenderData_getIValueAttr( BPy_RenderData *self, void *type )
-{
- long param;
-
- switch( (int)type ) {
- case EXPP_RENDER_ATTR_XPARTS:
- param = (long)self->renderContext->xparts;
- break;
- case EXPP_RENDER_ATTR_YPARTS:
- param = (long)self->renderContext->yparts;
- break;
- case EXPP_RENDER_ATTR_ASPECTX:
- param = (long)self->renderContext->xasp;
- break;
- case EXPP_RENDER_ATTR_ASPECTY:
- param = (long)self->renderContext->yasp;
- break;
- case EXPP_RENDER_ATTR_CFRAME:
- param = (long)self->renderContext->cfra;
- break;
- case EXPP_RENDER_ATTR_EFRAME:
- param = (long)self->renderContext->efra;
- break;
- case EXPP_RENDER_ATTR_SFRAME:
- param = (long)self->renderContext->sfra;
- break;
- case EXPP_RENDER_ATTR_FPS:
- param = self->renderContext->frs_sec;
- break;
- case EXPP_RENDER_ATTR_SIZEX:
- param = self->renderContext->xsch;
- break;
- case EXPP_RENDER_ATTR_SIZEY:
- param = self->renderContext->ysch;
- break;
- default:
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "undefined type constant in RenderData_setIValueAttrClamp" );
- }
- return PyInt_FromLong( param );
-}
-
-/*
- * set integer attributes which require clamping
- */
-
-static int RenderData_setIValueAttrClamp( BPy_RenderData *self, PyObject *value,
- void *type )
-{
- void *param;
- int min, max, size;
-
- switch( (int)type ) {
- case EXPP_RENDER_ATTR_XPARTS:
- min = 1;
- max = 512;
- size = 'h';
- param = &self->renderContext->xparts;
- break;
- case EXPP_RENDER_ATTR_YPARTS:
- min = 1;
- max = 64;
- size = 'h';
- param = &self->renderContext->yparts;
- break;
- case EXPP_RENDER_ATTR_ASPECTX:
- min = 1;
- max = 200;
- size = 'h';
- param = &self->renderContext->xasp;
- break;
- case EXPP_RENDER_ATTR_ASPECTY:
- min = 1;
- max = 200;
- size = 'h';
- param = &self->renderContext->yasp;
- break;
- case EXPP_RENDER_ATTR_CFRAME:
- min = 1;
- max = MAXFRAME;
- size = 'h';
- param = &self->renderContext->cfra;
- break;
- case EXPP_RENDER_ATTR_EFRAME:
- min = 1;
- max = MAXFRAME;
- size = 'h';
- param = &self->renderContext->efra;
- break;
- case EXPP_RENDER_ATTR_SFRAME:
- min = 1;
- max = MAXFRAME;
- size = 'h';
- param = &self->renderContext->sfra;
- break;
- case EXPP_RENDER_ATTR_FPS:
- min = 1;
- max = 120;
- size = 'h';
- param = &self->renderContext->frs_sec;
- break;
- case EXPP_RENDER_ATTR_SIZEX:
- min = 4;
- max = 10000;
- size = 'h';
- param = &self->renderContext->xsch;
- break;
- case EXPP_RENDER_ATTR_SIZEY:
- min = 4;
- max = 10000;
- size = 'h';
- param = &self->renderContext->ysch;
- break;
- default:
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "undefined type constant in RenderData_setIValueAttrClamp" );
- }
- return EXPP_setIValueClamped( value, param, min, max, size );
-}
-
-/***************************************************************************/
-/* handlers for other getting/setting attributes */
-/***************************************************************************/
-
-static PyObject *RenderData_getModeBit( BPy_RenderData *self, void* type )
-{
- return EXPP_getBitfield( &self->renderContext->mode,
- (int)type, 'i' );
-}
-
-static int RenderData_setModeBit( BPy_RenderData* self, PyObject *value,
- void* type )
-{
- return EXPP_setBitfield( value, &self->renderContext->mode,
- (int)type, 'i' );
-}
-
-#define MODE_MASK ( R_OSA | R_SHADOW | R_GAMMA | R_ENVMAP | R_EDGE | \
- R_FIELDS | R_FIELDSTILL | R_RADIO | R_BORDER | R_PANORAMA | R_CROP | \
- R_ODDFIELD | R_MBLUR | R_RAYTRACE | R_THREADS )
-
-static PyObject *RenderData_getMode( BPy_RenderData *self )
-{
- return PyInt_FromLong( (long)(self->renderContext->mode & MODE_MASK) );
-}
-
-static int RenderData_setMode( BPy_RenderData* self, PyObject *arg )
-{
- int value;
-
- if( !PyInt_Check( arg ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected int argument" );
-
- value = PyInt_AsLong( arg );
- if( value & ~MODE_MASK )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "unexpected bits set in argument" );
-
- self->renderContext->mode = (short)value;
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
-
- return 0;
-}
-
-static PyObject *RenderData_getSceModeBits( BPy_RenderData *self, void* type )
-{
- return EXPP_getBitfield( &self->renderContext->scemode, (int)type, 'h' );
-}
-
-static int RenderData_setSceModeBits( BPy_RenderData* self, PyObject *value,
- void* type )
-{
- return EXPP_setBitfield( value, &self->renderContext->scemode,
- (int)type, 'h' );
-}
-
-static PyObject *RenderData_getSceMode( BPy_RenderData *self )
-{
- return PyInt_FromLong ( (long)self->renderContext->scemode );
-}
-
-static int RenderData_setSceMode( BPy_RenderData* self, PyObject *arg )
-{
- int value;
-
- if( !PyInt_Check( arg ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected int argument" );
-
- value = PyInt_AsLong( arg );
- if( value & ~( R_EXTENSION | R_DOSEQ ) )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "unexpected bits set in argument" );
-
- self->renderContext->scemode = (short)value;
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
-
- return 0;
-}
-
-static PyObject *RenderData_getFramingType( BPy_RenderData *self )
-{
- return PyInt_FromLong( (long)self->scene->framing.type );
-}
-
-static int RenderData_setFramingType( BPy_RenderData *self, PyObject *value )
-{
- return EXPP_setIValueRange( value, &self->scene->framing.type,
- SCE_GAMEFRAMING_BARS, SCE_GAMEFRAMING_SCALE, 'b' );
-}
-
-static PyObject *RenderData_getEdgeColor( BPy_RenderData * self )
-{
- return Py_BuildValue( "[fff]", self->renderContext->edgeR,
- self->renderContext->edgeG, self->renderContext->edgeB );
-}
-
-static int RenderData_setEdgeColor( BPy_RenderData * self, PyObject * args )
-{
- float red, green, blue;
-
- /* if we get a list, convert to a tuple; otherwise hope for the best */
- if( PyList_Check( args ) )
- args = PySequence_Tuple( args );
- else
- Py_INCREF( args );
-
- if( !PyArg_ParseTuple( args, "fff", &red, &green, &blue ) ) {
- Py_DECREF( args );
- return EXPP_ReturnIntError( PyExc_TypeError, "expected three floats" );
- }
- Py_DECREF( args );
-
- self->renderContext->edgeR = EXPP_ClampFloat( red, 0.0, 1.0 );
- self->renderContext->edgeG = EXPP_ClampFloat( green, 0.0, 1.0 );
- self->renderContext->edgeB = EXPP_ClampFloat( blue, 0.0, 1.0 );
- return 0;
-}
-
-static PyObject *RenderData_getOSALevel( BPy_RenderData * self )
-{
- return PyInt_FromLong( (long)self->renderContext->osa );
-}
-
-static PyObject *RenderData_getRenderer( BPy_RenderData * self )
-{
- return PyInt_FromLong( (long)self->renderContext->renderer );
-}
-
-static PyObject *RenderData_getImageType( BPy_RenderData * self )
-{
- return PyInt_FromLong( (long) self->renderContext->imtype );
-}
-
-static int RenderData_setGameFrameColor( BPy_RenderData * self,
- PyObject * args )
-{
- float red, green, blue;
-
- /* if we get a list, convert to a tuple; otherwise hope for the best */
- if( PyList_Check( args ) )
- args = PySequence_Tuple( args );
- else
- Py_INCREF( args );
-
- if( !PyArg_ParseTuple( args, "fff", &red, &green, &blue ) ) {
- Py_DECREF( args );
- return EXPP_ReturnIntError( PyExc_TypeError, "expected three floats" );
- }
- Py_DECREF( args );
-
- self->scene->framing.col[0] = EXPP_ClampFloat( red, 0.0, 1.0 );
- self->scene->framing.col[1] = EXPP_ClampFloat( green, 0.0, 1.0 );
- self->scene->framing.col[2] = EXPP_ClampFloat( blue, 0.0, 1.0 );
- return 0;
-}
-
-static PyObject *RenderData_getGameFrameColor( BPy_RenderData * self )
-{
- return Py_BuildValue( "[fff]", self->scene->framing.col[0],
- self->scene->framing.col[1], self->scene->framing.col[2] );
-}
-
-static PyObject *RenderData_getBackbuf( BPy_RenderData * self )
-{
- return EXPP_getBitfield( &self->renderContext->bufflag,
- R_BACKBUF, 'h' );
-}
-
-static int RenderData_setBackbuf( BPy_RenderData* self, PyObject *value )
-{
- return EXPP_setBitfield( value, &self->renderContext->bufflag,
- R_BACKBUF, 'h' );
-}
-
-static int RenderData_setImagePlanes( BPy_RenderData *self, PyObject *value )
-{
- int depth;
- char *errstr = "expected int argument of 8, 24, or 32";
-
- if( !PyInt_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError, errstr );
-
- depth = PyInt_AsLong( value );
- if( depth != 8 && depth != 24 && depth != 32 )
- return EXPP_ReturnIntError( PyExc_ValueError, errstr );
-
- self->renderContext->planes = (short)depth;
-
- return 0;
-}
-
-static PyObject *RenderData_getImagePlanes( BPy_RenderData * self )
-{
- return PyInt_FromLong( (long) self->renderContext->planes );
-}
-
-static int RenderData_setAlphaMode( BPy_RenderData *self, PyObject *value )
-{
- return EXPP_setIValueRange( value, &self->renderContext->alphamode,
- R_ADDSKY, R_ALPHAKEY, 'h' );
-}
-
-static PyObject *RenderData_getAlphaMode( BPy_RenderData * self )
-{
- return PyInt_FromLong( (long) self->renderContext->alphamode );
-}
-
-static PyObject *RenderData_getDisplayMode( void )
-{
- return PyInt_FromLong( (long) G.displaymode );
-}
-
-static int RenderData_setDisplayMode( BPy_RenderData *self,
- PyObject *value )
-{
- return EXPP_setIValueRange( value, &G.displaymode,
- R_DISPLAYIMAGE, R_DISPLAYSCREEN, 'h' );
-}
-
-static PyObject *RenderData_getRenderPath( BPy_RenderData * self )
-{
- return PyString_FromString( self->renderContext->pic );
-}
-
-static int RenderData_setRenderPath( BPy_RenderData * self, PyObject * value )
-{
- char *name;
-
- name = PyString_AsString( value );
- if( !name )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a string" );
-
- if( strlen( name ) >= sizeof(self->renderContext->pic) )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "render path is too long" );
-
- strcpy( self->renderContext->pic, name );
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
-
- return 0;
-}
-
-PyObject *RenderData_getBackbufPath( BPy_RenderData * self )
-{
- return PyString_FromString( self->renderContext->backbuf );
-}
-
-static int RenderData_setBackbufPath( BPy_RenderData *self, PyObject *value )
-{
- char *name;
- Image *ima;
-
- name = PyString_AsString( value );
- if( !name )
- return EXPP_ReturnIntError( PyExc_TypeError, "expected a string" );
-
- if( strlen( name ) >= sizeof(self->renderContext->backbuf) )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "backbuf path is too long" );
-
- strcpy( self->renderContext->backbuf, name );
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
-
- ima = BKE_add_image_file( name );
- if( ima )
- BKE_image_signal( ima, NULL, IMA_SIGNAL_RELOAD );
-
- return 0;
-}
-
-PyObject *RenderData_getFtypePath( BPy_RenderData * self )
-{
- return PyString_FromString( self->renderContext->ftype );
-}
-
-static int RenderData_setFtypePath( BPy_RenderData *self, PyObject *value )
-{
- char *name;
-
- name = PyString_AsString( value );
- if( !name )
- return EXPP_ReturnIntError( PyExc_TypeError, "expected a string" );
-
- if( strlen( name ) >= sizeof(self->renderContext->ftype) )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "ftype path is too long" );
-
- strcpy( self->renderContext->ftype, name );
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
-
- return 0;
-}
-
-PyObject *RenderData_getRenderWinSize( BPy_RenderData * self )
-{
- return PyInt_FromLong( (long) self->renderContext->size );
-}
-
-static int RenderData_setRenderWinSize( BPy_RenderData *self, PyObject *value )
-{
- int size;
- char *errstr = "expected int argument of 25, 50, 75, or 100";
-
- if( !PyInt_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError, errstr );
-
- size = PyInt_AsLong( value );
- if( size != 25 && size != 50 && size != 75 && size != 100 )
- return EXPP_ReturnIntError( PyExc_ValueError, errstr );
-
- self->renderContext->size = (short)size;
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
-
- return 0;
-}
-
-static PyObject *RenderData_getMapOld( BPy_RenderData *self )
-{
- return PyInt_FromLong( (long)self->renderContext->framapto );
-}
-
-static int RenderData_setMapOld( BPy_RenderData *self, PyObject *value )
-{
- int result = EXPP_setIValueClamped( value, &self->renderContext->framapto,
- 1, 900, 'h' );
- self->renderContext->framelen =
- (float)self->renderContext->framapto / self->renderContext->images;
- return result;
-}
-
-static PyObject *RenderData_getMapNew( BPy_RenderData *self )
-{
- return PyInt_FromLong( (long)self->renderContext->images );
-}
-
-static int RenderData_setMapNew( BPy_RenderData *self, PyObject *value )
-{
- int result = EXPP_setIValueClamped( value, &self->renderContext->images,
- 1, 900, 'h' );
- self->renderContext->framelen =
- (float)self->renderContext->framapto / self->renderContext->images;
- return result;
-}
-
-static PyObject *RenderData_getSet( BPy_RenderData *self )
-{
- if( self->scene->set )
- return Scene_CreatePyObject( self->scene->set );
- Py_RETURN_NONE;
-}
-
-static int RenderData_setSet( BPy_RenderData *self, PyObject *value )
-{
- BPy_Scene *sc;
-
- /* if "None", delete the link to the scene */
- if( value == Py_None ) {
- self->scene->set = NULL;
- return 0;
- }
-
- /* be sure argument is a Scene */
- if( !BPy_Scene_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected Scene as argument" );
-
- /* check for attempt to link to ourselves */
- sc = (BPy_Scene *)value;
- if( self->scene == sc->scene )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "cannot link a scene to itself" );
-
- /*
- * Accept the set link, then check for a circular link. If circular link
- * exists, scene_check_setscene() sets self->scene->set to NULL.
- */
-
- self->scene->set = sc->scene;
- if( !scene_check_setscene( self->scene ) )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "linking scene would create a cycle" );
-
- return 0;
-}
-
-
-PyObject *RenderData_getThreads( BPy_RenderData * self )
-{
- return PyInt_FromLong( (long) self->renderContext->threads );
-}
-
-static int RenderData_setThreads( BPy_RenderData *self, PyObject *value )
-{
- int threads;
-
- if( !PyInt_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError, "Error, threads must be an int" );
-
- threads = PyInt_AsLong( value );
- if (threads<1) threads = 1;
- else if (threads>8) threads = 8;
-
- self->renderContext->threads = (short)threads;
- EXPP_allqueue( REDRAWBUTSSCENE, 0 );
- return 0;
-}
-
-/***************************************************************************/
-/* BPy_RenderData attribute def */
-/***************************************************************************/
-static PyGetSetDef BPy_RenderData_getseters[] = {
- {"oversampling",
- (getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
- "Oversampling (anti-aliasing) enabled",
- (void *)R_OSA},
- {"shadow",
- (getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
- "Shadow calculation enabled",
- (void *)R_SHADOW},
- {"gammaCorrection",
- (getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
- "Gamma correction enabled",
- (void *)R_GAMMA},
-/* R_ORTHO unused */
- {"environmentMap",
- (getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
- "Environment map rendering enabled",
- (void *)R_ENVMAP},
- {"toonShading",
- (getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
- "Toon edge shading enabled",
- (void *)R_EDGE},
- {"fieldRendering",
- (getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
- "Field rendering enabled",
- (void *)R_FIELDS},
- {"fieldTimeDisable",
- (getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
- "Time difference in field calculations disabled ('X' in UI)",
- (void *)R_FIELDSTILL},
- {"radiosityRender",
- (getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
- "Radiosity rendering enabled",
- (void *)R_RADIO},
- {"borderRender",
- (getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
- "Small cut-out rendering enabled",
- (void *)R_BORDER},
- {"panorama",
- (getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
- "Panorama rendering enabled",
- (void *)R_PANORAMA},
- {"crop",
- (getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
- "Crop image during border renders",
- (void *)R_CROP},
-/* R_COSMO unsupported */
- {"oddFieldFirst",
- (getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
- "Odd field first rendering enabled",
- (void *)R_ODDFIELD},
- {"motionBlur",
- (getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
- "Motion blur enabled",
- (void *)R_MBLUR},
- {"rayTracing",
- (getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
- "Ray tracing enabled",
- (void *)R_RAYTRACE},
-/* R_GAUSS unused */
-/* R_FBUF unused */
-/* R_THREADS unused */
- {"threads",
- (getter)RenderData_getThreads, (setter)RenderData_setThreads,
- "Number of threads used to render",
- NULL},
-/* R_SPEED unused */
- {"mode",
- (getter)RenderData_getMode, (setter)RenderData_setMode,
- "Mode bitfield",
- NULL},
-
- /* scene modes */
- {"sequencer",
- (getter)RenderData_getSceModeBits, (setter)RenderData_setSceModeBits,
- "'Do Sequence' enabled",
- (void *)R_DOSEQ},
- {"extensions",
- (getter)RenderData_getSceModeBits, (setter)RenderData_setSceModeBits,
- "Add extensions to output (when rendering animations) enabled",
- (void *)R_EXTENSION},
- {"compositor",
- (getter)RenderData_getSceModeBits, (setter)RenderData_setSceModeBits,
- "'Do Compositor' enabled.",
- (void *)R_DOCOMP},
- {"freeImages",
- (getter)RenderData_getSceModeBits, (setter)RenderData_setSceModeBits,
- "Free texture images after render.",
- (void *)R_FREE_IMAGE},
- {"singleLayer",
- (getter)RenderData_getSceModeBits, (setter)RenderData_setSceModeBits,
- "Only render the active layer.",
- (void *)R_SINGLE_LAYER},
- {"saveBuffers",
- (getter)RenderData_getSceModeBits, (setter)RenderData_setSceModeBits,
- "Save render buffers to disk while rendering, saves memory.",
- (void *)R_EXR_TILE_FILE},
- {"compositeFree",
- (getter)RenderData_getSceModeBits, (setter)RenderData_setSceModeBits,
- "Free nodes that are not used while composite.",
- (void *)R_COMP_FREE},
-
- {"sceneMode",
- (getter)RenderData_getSceMode, (setter)RenderData_setSceMode,
- "Scene mode bitfield",
- NULL},
-/* R_BG_RENDER unused */
-
- {"gameFrame",
- (getter)RenderData_getFramingType, (setter)RenderData_setFramingType,
- "Game framing type",
- NULL},
-
- {"renderPath",
- (getter)RenderData_getRenderPath, (setter)RenderData_setRenderPath,
- "The path to output the rendered images to",
- NULL},
- {"backbufPath",
- (getter)RenderData_getBackbufPath, (setter)RenderData_setBackbufPath,
- "Path to a background image (setting loads image)",
- NULL},
- {"ftypePath",
- (getter)RenderData_getFtypePath, (setter)RenderData_setFtypePath,
- "The path to Ftype file",
- NULL},
- {"edgeColor",
- (getter)RenderData_getEdgeColor, (setter)RenderData_setEdgeColor,
- "RGB color triplet for edges in Toon shading",
- NULL},
- {"OSALevel",
- (getter)RenderData_getOSALevel, (setter)RenderData_setOSALevel,
- "Oversampling (anti-aliasing) level",
- NULL},
- {"renderwinSize",
- (getter)RenderData_getRenderWinSize, (setter)RenderData_setRenderWinSize,
- "Size of the rendering window (25, 50, 75, or 100)",
- NULL},
- {"border",
- (getter)RenderData_getBorder, (setter)RenderData_setBorder,
- "The border for border rendering",
- NULL},
- {"timeCode",
- (getter)RenderData_getTimeCode, (setter)NULL,
- "Get the current frame in HH:MM:SS:FF format",
- NULL},
- {"renderer",
- (getter)RenderData_getRenderer, (setter)RenderData_setRenderer,
- "Rendering engine choice",
- NULL},
- {"imageType",
- (getter)RenderData_getImageType, (setter)RenderData_setImageType,
- "File format for saving images",
- NULL},
- {"gameFrameColor",
- (getter)RenderData_getGameFrameColor,(setter)RenderData_setGameFrameColor,
- "RGB color triplet for bars",
- NULL},
- {"backbuf",
- (getter)RenderData_getBackbuf, (setter)RenderData_setBackbuf,
- "Backbuffer image enabled",
- NULL},
- {"imagePlanes",
- (getter)RenderData_getImagePlanes, (setter)RenderData_setImagePlanes,
- "Image depth (8, 24, or 32 bits)",
- NULL},
- {"alphaMode",
- (getter)RenderData_getAlphaMode, (setter)RenderData_setAlphaMode,
- "Setting for sky/background.",
- NULL},
- {"displayMode",
- (getter)RenderData_getDisplayMode, (setter)RenderData_setDisplayMode,
- "Render output in separate window or 3D view",
- NULL},
-
- {"xParts",
- (getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp,
- "Number of horizontal parts for image render",
- (void *)EXPP_RENDER_ATTR_XPARTS},
- {"yParts",
- (getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp,
- "Number of vertical parts for image render",
- (void *)EXPP_RENDER_ATTR_YPARTS},
- {"aspectX",
- (getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp,
- "Horizontal aspect ratio",
- (void *)EXPP_RENDER_ATTR_ASPECTX},
- {"aspectY",
- (getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp,
- "Vertical aspect ratio",
- (void *)EXPP_RENDER_ATTR_ASPECTY},
- {"cFrame",
- (getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp,
- "The current frame for rendering",
- (void *)EXPP_RENDER_ATTR_CFRAME},
- {"sFrame",
- (getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp,
- "Starting frame for rendering",
- (void *)EXPP_RENDER_ATTR_SFRAME},
- {"eFrame",
- (getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp,
- "Ending frame for rendering",
- (void *)EXPP_RENDER_ATTR_EFRAME},
- {"fps",
- (getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp,
- "Frames per second",
- (void *)EXPP_RENDER_ATTR_FPS},
- {"fpsBase",
- (getter)RenderData_getFloatAttr, (setter)RenderData_setFloatAttrClamp,
- "Frames per second base",
- (void *)EXPP_RENDER_ATTR_FPS_BASE},
- {"sizeX",
- (getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp,
- "Image width (in pixels)",
- (void *)EXPP_RENDER_ATTR_SIZEX},
- {"sizeY",
- (getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp,
- "Image height (in pixels)",
- (void *)EXPP_RENDER_ATTR_SIZEY},
-
- {"gaussFilter",
- (getter)RenderData_getFloatAttr, (setter)RenderData_setFloatAttrClamp,
- "Gauss filter size",
- (void *)EXPP_RENDER_ATTR_GAUSSFILTER},
- {"mblurFactor",
- (getter)RenderData_getFloatAttr, (setter)RenderData_setFloatAttrClamp,
- "Motion blur factor",
- (void *)EXPP_RENDER_ATTR_MBLURFACTOR},
- {"mapOld",
- (getter)RenderData_getMapOld, (setter)RenderData_setMapOld,
- "Number of frames the Map Old will last",
- NULL},
- {"mapNew",
- (getter)RenderData_getMapNew, (setter)RenderData_setMapNew,
- "New mapping value (in frames)",
- NULL},
- {"set",
- (getter)RenderData_getSet, (setter)RenderData_setSet,
- "Scene link 'set' value",
- NULL},
-
- {"yafrayGIMethod",
- (getter)RenderData_getYafrayGIMethod, (setter)RenderData_setYafrayGIMethod,
- "Global illumination method",
- NULL},
- {"yafrayGIQuality",
- (getter)RenderData_getYafrayGIQuality, (setter)RenderData_setYafrayGIQuality,
- "Global Illumination quality",
- NULL},
- {"yafrayExportToXML",
- (getter)RenderData_getYafrayExportToXML, (setter)RenderData_setYafrayExportToXML,
- "If true export to an xml file and call yafray instead of plugin",
- NULL},
- {"yafrayAutoAntiAliasing",
- (getter)RenderData_getYafrayAutoAntiAliasing, (setter)RenderData_setYafrayAutoAntiAliasing,
- "Automatic anti-aliasing enabled/disabled",
- NULL},
- {"yafrayClampRGB",
- (getter)RenderData_getYafrayClampRGB, (setter)RenderData_setYafrayClampRGB,
- "Clamp RGB enabled/disabled",
- NULL},
- {"yafrayAntiAliasingPasses",
- (getter)RenderData_getYafrayAntiAliasingPasses, (setter)RenderData_setYafrayAntiAliasingPasses,
- "Number of anti-aliasing passes (0 is no anti-aliasing)",
- NULL},
- {"yafrayAntiAliasingSamples",
- (getter)RenderData_getYafrayAntiAliasingSamples, (setter)RenderData_setYafrayAntiAliasingSamples,
- "Number of samples per pass",
- NULL},
- {"yafrayAntiAliasingPixelSize",
- (getter)RenderData_getYafrayAntiAliasingPixelSize, (setter)RenderData_setYafrayAntiAliasingPixelSize,
- "Anti-aliasing pixel filter size",
- NULL},
- {"yafrayAntiAliasingThreshold",
- (getter)RenderData_getYafrayAntiAliasingThreshold, (setter)RenderData_setYafrayAntiAliasingThreshold,
- "Anti-aliasing threshold",
- NULL},
- {"yafrayNumberOfProcessors",
- (getter)RenderData_getYafrayNumberOfProcessors, (setter)RenderData_setYafrayNumberOfProcessors,
- "Number of processors to use",
- NULL},
- {"yafrayGICache",
- (getter)RenderData_getYafrayGICache, (setter)RenderData_setYafrayGICache,
- "Cache occlusion/irradiance samples (faster)",
- NULL},
- {"yafrayGICacheBumpNormals",
- (getter)RenderData_getYafrayGICacheBumpNormals, (setter)RenderData_setYafrayGICacheBumpNormals,
- "Enable/disable bumpnormals for cache",
- NULL},
- {"yafrayGICacheShadowQuality",
- (getter)RenderData_getYafrayGICacheShadowQuality, (setter)RenderData_setYafrayGICacheShadowQuality,
- "Shadow quality, keep it under 0.95 :-)",
- NULL},
- {"yafrayGICachePixelsPerSample",
- (getter)RenderData_getYafrayGICachePixelsPerSample, (setter)RenderData_setYafrayGICachePixelsPerSample,
- "Maximum number of pixels without samples, the lower the better and slower",
- NULL},
- {"yafrayGICacheRefinement",
- (getter)RenderData_getYafrayGICacheRefinement, (setter)RenderData_setYafrayGICacheRefinement,
- "Threshold to refine shadows EXPERIMENTAL. 1 = no refinement",
- NULL},
- {"yafrayGIPhotons",
- (getter)RenderData_getYafrayGIPhotons, (setter)RenderData_setYafrayGIPhotons,
- "Enable/disable use of global photons to help in GI",
- NULL},
- {"yafrayGITunePhotons",
- (getter)RenderData_getYafrayGITunePhotons, (setter)RenderData_setYafrayGITunePhotons,
- "If true the photonmap is shown directly in the render for tuning",
- NULL},
-
- {NULL,NULL,NULL,NULL,NULL}
-};
-
-/***************************************************************************/
-/* BPy_RenderData method def */
-/***************************************************************************/
-static PyMethodDef BPy_RenderData_methods[] = {
- {"render", ( PyCFunction ) RenderData_Render, METH_NOARGS,
- "() - render the scene"},
- {"saveRenderedImage", (PyCFunction)RenderData_SaveRenderedImage, METH_VARARGS,
- "(filename) - save an image generated by a call to render() (set output path first)"},
- {"renderAnim", ( PyCFunction ) RenderData_RenderAnim, METH_NOARGS,
- "() - render a sequence from start frame to end frame"},
- {"play", ( PyCFunction ) RenderData_Play, METH_NOARGS,
- "() - play animation of rendered images/avi (searches Pics: field)"},
- {"setRenderPath", ( PyCFunction ) RenderData_SetRenderPath,
- METH_VARARGS,
- "(string) - get/set the path to output the rendered images to"},
- {"getRenderPath", ( PyCFunction ) RenderData_getRenderPath,
- METH_NOARGS,
- "() - get the path to directory where rendered images will go"},
- {"setBackbufPath", ( PyCFunction ) RenderData_SetBackbufPath,
- METH_VARARGS,
- "(string) - get/set the path to a background image and load it"},
- {"getBackbufPath", ( PyCFunction ) RenderData_getBackbufPath,
- METH_NOARGS,
- "() - get the path to background image file"},
- {"enableBackbuf", ( PyCFunction ) RenderData_EnableBackbuf,
- METH_VARARGS,
- "(bool) - enable/disable the backbuf image"},
- {"setFtypePath", ( PyCFunction ) RenderData_SetFtypePath, METH_VARARGS,
- "(string) - get/set the path to output the Ftype file"},
- {"getFtypePath", ( PyCFunction ) RenderData_getFtypePath, METH_NOARGS,
- "() - get the path to Ftype file"},
- {"enableExtensions", ( PyCFunction ) RenderData_EnableExtensions,
- METH_VARARGS,
- "(bool) - enable/disable windows extensions for output files"},
- {"enableSequencer", ( PyCFunction ) RenderData_EnableSequencer,
- METH_VARARGS,
- "(bool) - enable/disable Do Sequence"},
- {"enableRenderDaemon", ( PyCFunction ) RenderData_EnableRenderDaemon,
- METH_VARARGS,
- "(bool) - enable/disable Scene daemon"},
- {"enableToonShading", ( PyCFunction ) RenderData_EnableToonShading,
- METH_VARARGS,
- "(bool) - enable/disable Edge rendering"},
- {"edgeIntensity", ( PyCFunction ) RenderData_EdgeIntensity,
- METH_VARARGS,
- "(int) - get/set edge intensity for toon shading"},
- {"setEdgeColor", ( PyCFunction ) RenderData_SetEdgeColor, METH_VARARGS,
- "(f,f,f) - set the edge color for toon shading - Red,Green,Blue expected."},
- {"getEdgeColor", ( PyCFunction ) RenderData_GetEdgeColor, METH_NOARGS,
- "() - get the edge color for toon shading - Red,Green,Blue expected."},
- {"enableOversampling", ( PyCFunction ) RenderData_EnableOversampling,
- METH_VARARGS,
- "(bool) - enable/disable oversampling (anit-aliasing)."},
- {"setOversamplingLevel",
- ( PyCFunction ) RenderData_SetOversamplingLevel, METH_VARARGS,
- "(enum) - get/set the level of oversampling (anit-aliasing)."},
- {"enableMotionBlur", ( PyCFunction ) RenderData_EnableMotionBlur,
- METH_VARARGS,
- "(bool) - enable/disable MBlur."},
- {"motionBlurLevel", ( PyCFunction ) RenderData_MotionBlurLevel,
- METH_VARARGS,
- "(float) - get/set the length of shutter time for motion blur."},
- {"partsX", ( PyCFunction ) RenderData_PartsX, METH_VARARGS,
- "(int) - get/set the number of parts to divide the render in the X direction"},
- {"partsY", ( PyCFunction ) RenderData_PartsY, METH_VARARGS,
- "(int) - get/set the number of parts to divide the render in the Y direction"},
- {"enableSky", ( PyCFunction ) RenderData_EnableSky, METH_NOARGS,
- "() - enable render background with sky"},
- {"enablePremultiply", ( PyCFunction ) RenderData_EnablePremultiply,
- METH_NOARGS,
- "() - enable premultiply alpha"},
- {"enableKey", ( PyCFunction ) RenderData_EnableKey, METH_NOARGS,
- "() - enable alpha and color values remain unchanged"},
- {"enableShadow", ( PyCFunction ) RenderData_EnableShadow, METH_VARARGS,
- "(bool) - enable/disable shadow calculation"},
- {"enablePanorama", ( PyCFunction ) RenderData_EnablePanorama,
- METH_VARARGS,
- "(bool) - enable/disable panorama rendering (output width is multiplied by Xparts)"},
- {"enableEnvironmentMap",
- ( PyCFunction ) RenderData_EnableEnvironmentMap, METH_VARARGS,
- "(bool) - enable/disable environment map rendering"},
- {"enableRayTracing", ( PyCFunction ) RenderData_EnableRayTracing,
- METH_VARARGS,
- "(bool) - enable/disable ray tracing"},
- {"enableRadiosityRender",
- ( PyCFunction ) RenderData_EnableRadiosityRender, METH_VARARGS,
- "(bool) - enable/disable radiosity rendering"},
- {"getRenderWinSize", ( PyCFunction ) RenderData_getRenderWinSize,
- METH_NOARGS,
- "() - get the size of the render window"},
- {"setRenderWinSize", ( PyCFunction ) RenderData_SetRenderWinSize,
- METH_VARARGS,
- "(int) - set the size of the render window"},
- {"enableFieldRendering",
- ( PyCFunction ) RenderData_EnableFieldRendering, METH_VARARGS,
- "(bool) - enable/disable field rendering"},
- {"enableOddFieldFirst", ( PyCFunction ) RenderData_EnableOddFieldFirst,
- METH_VARARGS,
- "(bool) - enable/disable Odd field first rendering (Default: Even field)"},
- {"enableFieldTimeDisable",
- ( PyCFunction ) RenderData_EnableFieldTimeDisable, METH_VARARGS,
- "(bool) - enable/disable time difference in field calculations"},
- {"enableGaussFilter", ( PyCFunction ) RenderData_EnableGaussFilter,
- METH_VARARGS,
- "(bool) - enable/disable Gauss sampling filter for antialiasing"},
- {"enableBorderRender", ( PyCFunction ) RenderData_EnableBorderRender,
- METH_VARARGS,
- "(bool) - enable/disable small cut-out rendering"},
- {"setBorder", ( PyCFunction ) RenderData_SetBorder, METH_VARARGS,
- "(f,f,f,f) - set the border for border rendering"},
- {"gaussFilterSize", ( PyCFunction ) RenderData_GaussFilterSize,
- METH_VARARGS,
- "(float) - get/sets the Gauss filter size"},
- {"startFrame", ( PyCFunction ) RenderData_StartFrame, METH_VARARGS,
- "(int) - get/set the starting frame for rendering"},
- {"currentFrame", ( PyCFunction ) RenderData_CurrentFrame, METH_VARARGS,
- "(int) - get/set the current frame for rendering"},
- {"endFrame", ( PyCFunction ) RenderData_EndFrame, METH_VARARGS,
- "(int) - get/set the ending frame for rendering"},
- {"getTimeCode", ( PyCFunction ) RenderData_getTimeCode, METH_NOARGS,
- "get the current frame in HH:MM:SS:FF format"},
- {"imageSizeX", ( PyCFunction ) RenderData_ImageSizeX, METH_VARARGS,
- "(int) - get/set the image width in pixels"},
- {"imageSizeY", ( PyCFunction ) RenderData_ImageSizeY, METH_VARARGS,
- "(int) - get/set the image height in pixels"},
- {"aspectRatioX", ( PyCFunction ) RenderData_AspectRatioX, METH_VARARGS,
- "(int) - get/set the horizontal aspect ratio"},
- {"aspectRatioY", ( PyCFunction ) RenderData_AspectRatioY, METH_VARARGS,
- "(int) - get/set the vertical aspect ratio"},
- {"setRenderer", ( PyCFunction ) RenderData_SetRenderer, METH_VARARGS,
- "(enum) - get/set which renderer to render the output"},
- {"enableCropping", ( PyCFunction ) RenderData_EnableCropping,
- METH_VARARGS,
- "(bool) - enable/disable exclusion of border rendering from total image"},
- {"setImageType", ( PyCFunction ) RenderData_SetImageType, METH_VARARGS,
- "(enum) - get/set the type of image to output from the render"},
- {"quality", ( PyCFunction ) RenderData_Quality, METH_VARARGS,
- "(int) - get/set quality get/setting for JPEG images, AVI Jpeg and SGI movies"},
- {"framesPerSec", ( PyCFunction ) RenderData_FramesPerSec, METH_VARARGS,
- "(int) - get/set frames per second"},
- {"enableGrayscale", ( PyCFunction ) RenderData_EnableGrayscale,
- METH_NOARGS,
- "() - images are saved with BW (grayscale) data"},
- {"enableRGBColor", ( PyCFunction ) RenderData_EnableRGBColor,
- METH_NOARGS,
- "() - images are saved with RGB (color) data"},
- {"enableRGBAColor", ( PyCFunction ) RenderData_EnableRGBAColor,
- METH_NOARGS,
- "() - images are saved with RGB and Alpha data (if supported)"},
- {"sizePreset", ( PyCFunction ) RenderData_SizePreset, METH_VARARGS,
- "(enum) - get/set the render to one of a few preget/sets"},
- {"setYafrayGIQuality", ( PyCFunction ) RenderData_SetYafrayGIQuality,
- METH_VARARGS,
- "(enum) - set yafray global Illumination quality"},
- {"getYafrayGIQuality", ( PyCFunction ) RenderData_GetYafrayGIQuality,
- METH_VARARGS,
- "(enum) - get yafray global Illumination quality"},
- {"setYafrayGIMethod", ( PyCFunction ) RenderData_SetYafrayGIMethod,
- METH_VARARGS,
- "(enum) - set yafray global Illumination method"},
- {"getYafrayGIMethod", ( PyCFunction ) RenderData_GetYafrayGIMethod,
- METH_VARARGS,
- "(enum) - get yafray global Illumination method"},
- {"yafrayGIPower", ( PyCFunction ) RenderData_YafrayGIPower,
- METH_VARARGS,
- "(float) - get/set GI lighting intensity scale"},
- {"yafrayGIIndirPower", ( PyCFunction ) RenderData_YafrayGIIndirPower,
- METH_VARARGS,
- "(float) - get/set GI indifect lighting intensity scale"},
- {"yafrayGIDepth", ( PyCFunction ) RenderData_YafrayGIDepth,
- METH_VARARGS,
- "(int) - get/set number of bounces of the indirect light"},
- {"yafrayGICDepth", ( PyCFunction ) RenderData_YafrayGICDepth,
- METH_VARARGS,
- "(int) - get/set number of bounces inside objects (for caustics)"},
- {"enableYafrayGICache", ( PyCFunction ) RenderData_EnableYafrayGICache,
- METH_VARARGS,
- "(bool) - enable/disable cache irradiance samples (faster)"},
- {"enableYafrayGIPhotons",
- ( PyCFunction ) RenderData_EnableYafrayGIPhotons, METH_VARARGS,
- "(bool) - enable/disable use global photons to help in GI"},
- {"yafrayGIPhotonCount", ( PyCFunction ) RenderData_YafrayGIPhotonCount,
- METH_VARARGS,
- "(int) - get/set number of photons to shoot"},
- {"yafrayGIPhotonRadius",
- ( PyCFunction ) RenderData_YafrayGIPhotonRadius, METH_VARARGS,
- "(float) - get/set radius to search for photons to mix (blur)"},
- {"yafrayGIPhotonMixCount",
- ( PyCFunction ) RenderData_YafrayGIPhotonMixCount, METH_VARARGS,
- "(int) - get/set number of photons to mix"},
- {"enableYafrayGITunePhotons",
- ( PyCFunction ) RenderData_EnableYafrayGITunePhotons, METH_VARARGS,
- "(bool) - enable/disable show the photonmap directly in the render for tuning"},
- {"yafrayGIShadowQuality",
- ( PyCFunction ) RenderData_YafrayGIShadowQuality, METH_VARARGS,
- "(float) - get/set the shadow quality, keep it under 0.95"},
- {"yafrayGIPixelsPerSample",
- ( PyCFunction ) RenderData_YafrayGIPixelsPerSample, METH_VARARGS,
- "(int) - get/set maximum number of pixels without samples, the lower the better and slower"},
- {"yafrayGIRefinement", ( PyCFunction ) RenderData_YafrayGIRefinement,
- METH_VARARGS,
- "(float) - get/setthreshold to refine shadows EXPERIMENTAL. 1 = no refinement"},
- {"yafrayRayBias", ( PyCFunction ) RenderData_YafrayRayBias,
- METH_VARARGS,
- "(float) - get/set shadow ray bias to avoid self shadowing"},
- {"yafrayRayDepth", ( PyCFunction ) RenderData_YafrayRayDepth,
- METH_VARARGS,
- "(int) - get/set maximum render ray depth from the camera"},
- {"yafrayGamma", ( PyCFunction ) RenderData_YafrayGamma, METH_VARARGS,
- "(float) - get/set gamma correction, 1 is off"},
- {"yafrayExposure", ( PyCFunction ) RenderData_YafrayExposure,
- METH_VARARGS,
- "(float) - get/set exposure adjustment, 0 is off"},
- {"yafrayProcessorCount",
- ( PyCFunction ) RenderData_YafrayProcessorCount, METH_VARARGS,
- "(int) - get/set number of processors to use"},
- {"enableGameFrameStretch",
- ( PyCFunction ) RenderData_EnableGameFrameStretch, METH_NOARGS,
- "(l) - enble stretch or squeeze the viewport to fill the display window"},
- {"enableGameFrameExpose",
- ( PyCFunction ) RenderData_EnableGameFrameExpose, METH_NOARGS,
- "(l) - enable show the entire viewport in the display window, viewing more horizontally or vertically"},
- {"enableGameFrameBars", ( PyCFunction ) RenderData_EnableGameFrameBars,
- METH_NOARGS,
- "() - enable show the entire viewport in the display window, using bar horizontally or vertically"},
- {"setGameFrameColor", ( PyCFunction ) RenderData_SetGameFrameColor,
- METH_VARARGS,
- "(f,f,f) - set the red, green, blue component of the bars"},
- {"getGameFrameColor", ( PyCFunction ) RenderData_GetGameFrameColor,
- METH_NOARGS,
- "() - get the red, green, blue component of the bars"},
- {"SGIMaxsize", ( PyCFunction ) RenderData_SGIMaxsize, METH_VARARGS,
- "(int) - get/set maximum size per frame to save in an SGI movie"},
- {"enableSGICosmo", ( PyCFunction ) RenderData_EnableSGICosmo,
- METH_VARARGS,
- "(bool) - enable/disable attempt to save SGI movies using Cosmo hardware"},
- {"oldMapValue", ( PyCFunction ) RenderData_OldMapValue, METH_VARARGS,
- "(int) - get/set specify old map value in frames"},
- {"newMapValue", ( PyCFunction ) RenderData_NewMapValue, METH_VARARGS,
- "(int) - get/set specify new map value in frames"},
- {NULL, NULL, 0, NULL}
-};
-
-/*------------------------------------BPy_RenderData Type defintion------ */
-PyTypeObject RenderData_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender RenderData", /* char *tp_name; */
- sizeof( BPy_RenderData ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL, /* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- NULL, /* cmpfunc tp_compare; */
- ( reprfunc ) RenderData_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- 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; */
- 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, /* 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, /* 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 ***/
- BPy_RenderData_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_RenderData_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-/***************************************************************************/
-/* Render method def */
-/***************************************************************************/
-struct PyMethodDef M_Render_methods[] = {
- {"CloseRenderWindow", ( PyCFunction ) M_Render_CloseRenderWindow,
- METH_NOARGS,
- "() - close the rendering window"},
- {"EnableDispView", ( PyCFunction ) M_Render_EnableDispView,
- METH_NOARGS,
- "(bool) - enable Sceneing in view"},
- {"EnableDispWin", ( PyCFunction ) M_Render_EnableDispWin, METH_NOARGS,
- "(bool) - enable Sceneing in new window"},
- {"SetRenderWinPos", ( PyCFunction ) M_Render_SetRenderWinPos,
- METH_VARARGS,
- "([string list]) - position the rendering window in around the edge of the screen"},
- {NULL, NULL, 0, NULL}
-};
-
-static PyObject *M_Render_ModesDict( void )
-{
- PyObject *M = PyConstant_New( );
-
- if( M ) {
- BPy_constant *d = ( BPy_constant * ) M;
- PyConstant_Insert( d, "OSA", PyInt_FromLong( R_OSA ) );
- PyConstant_Insert( d, "SHADOW", PyInt_FromLong( R_SHADOW ) );
- PyConstant_Insert( d, "GAMMA", PyInt_FromLong( R_GAMMA ) );
- PyConstant_Insert( d, "ENVMAP", PyInt_FromLong( R_ENVMAP ) );
- PyConstant_Insert( d, "TOONSHADING", PyInt_FromLong( R_EDGE ) );
- PyConstant_Insert( d, "FIELDRENDER", PyInt_FromLong( R_FIELDS ) );
- PyConstant_Insert( d, "FIELDTIME", PyInt_FromLong( R_FIELDSTILL ) );
- PyConstant_Insert( d, "RADIOSITY", PyInt_FromLong( R_RADIO ) );
- PyConstant_Insert( d, "BORDER_RENDER", PyInt_FromLong( R_BORDER ) );
- PyConstant_Insert( d, "PANORAMA", PyInt_FromLong( R_PANORAMA ) );
- PyConstant_Insert( d, "CROP", PyInt_FromLong( R_CROP ) );
- PyConstant_Insert( d, "ODDFIELD", PyInt_FromLong( R_ODDFIELD ) );
- PyConstant_Insert( d, "MBLUR", PyInt_FromLong( R_MBLUR ) );
- PyConstant_Insert( d, "RAYTRACING", PyInt_FromLong( R_RAYTRACE ) );
- PyConstant_Insert( d, "THREADS", PyInt_FromLong( R_THREADS ) );
- }
- return M;
-}
-
-static PyObject *M_Render_SceModesDict( void )
-{
- PyObject *M = PyConstant_New( );
-
- if( M ) {
- BPy_constant *d = ( BPy_constant * ) M;
- PyConstant_Insert( d, "SEQUENCER", PyInt_FromLong( R_DOSEQ ) );
- PyConstant_Insert( d, "EXTENSION", PyInt_FromLong( R_EXTENSION ) );
- }
- return M;
-}
-
-static PyObject *M_Render_GameFramingDict( void )
-{
- PyObject *M = PyConstant_New( );
-
- if( M ) {
- BPy_constant *d = ( BPy_constant * ) M;
- PyConstant_Insert( d, "BARS",
- PyInt_FromLong( SCE_GAMEFRAMING_BARS ) );
- PyConstant_Insert( d, "EXTEND",
- PyInt_FromLong( SCE_GAMEFRAMING_EXTEND ) );
- PyConstant_Insert( d, "SCALE",
- PyInt_FromLong( SCE_GAMEFRAMING_SCALE ) );
- }
- return M;
-}
-
-/***************************************************************************/
-/* Render Module Init */
-/***************************************************************************/
-PyObject *Render_Init( void )
-{
- PyObject *submodule;
- PyObject *ModesDict = M_Render_ModesDict( );
- PyObject *SceModesDict = M_Render_SceModesDict( );
- PyObject *GFramingDict = M_Render_GameFramingDict( );
-
- if( PyType_Ready( &RenderData_Type ) < 0 )
- return NULL;
-
- submodule = Py_InitModule3( "Blender.Scene.Render",
- M_Render_methods, M_Render_doc );
-
- if( ModesDict )
- PyModule_AddObject( submodule, "Modes", ModesDict );
- if( SceModesDict )
- PyModule_AddObject( submodule, "SceModes", SceModesDict );
- if( GFramingDict )
- PyModule_AddObject( submodule, "FramingModes", GFramingDict );
-
- /* ugh: why aren't these in a constant dict? */
-
- PyModule_AddIntConstant( submodule, "INTERNAL", R_INTERN );
- PyModule_AddIntConstant( submodule, "YAFRAY", R_YAFRAY );
- PyModule_AddIntConstant( submodule, "AVIRAW", R_AVIRAW );
- PyModule_AddIntConstant( submodule, "AVIJPEG", R_AVIJPEG );
- PyModule_AddIntConstant( submodule, "AVICODEC", R_AVICODEC );
- PyModule_AddIntConstant( submodule, "QUICKTIME", R_QUICKTIME );
- PyModule_AddIntConstant( submodule, "TARGA", R_TARGA );
- PyModule_AddIntConstant( submodule, "RAWTGA", R_RAWTGA );
- PyModule_AddIntConstant( submodule, "HDR", R_RADHDR );
- PyModule_AddIntConstant( submodule, "PNG", R_PNG );
- PyModule_AddIntConstant( submodule, "BMP", R_BMP );
- PyModule_AddIntConstant( submodule, "JPEG", R_JPEG90 );
- PyModule_AddIntConstant( submodule, "HAMX", R_HAMX );
- PyModule_AddIntConstant( submodule, "IRIS", R_IRIS );
- PyModule_AddIntConstant( submodule, "IRISZ", R_IRIZ );
- PyModule_AddIntConstant( submodule, "FTYPE", R_FTYPE );
- PyModule_AddIntConstant( submodule, "PAL", B_PR_PAL );
- PyModule_AddIntConstant( submodule, "NTSC", B_PR_NTSC );
- PyModule_AddIntConstant( submodule, "DEFAULT", B_PR_PRESET );
- PyModule_AddIntConstant( submodule, "PREVIEW", B_PR_PRV );
- PyModule_AddIntConstant( submodule, "PC", B_PR_PC );
- PyModule_AddIntConstant( submodule, "PAL169", B_PR_PAL169 );
- PyModule_AddIntConstant( submodule, "PANO", B_PR_PANO );
- PyModule_AddIntConstant( submodule, "FULL", B_PR_FULL );
- PyModule_AddIntConstant( submodule, "NONE", PY_NONE );
- PyModule_AddIntConstant( submodule, "LOW", PY_LOW );
- PyModule_AddIntConstant( submodule, "MEDIUM", PY_MEDIUM );
- PyModule_AddIntConstant( submodule, "HIGH", PY_HIGH );
- PyModule_AddIntConstant( submodule, "HIGHER", PY_HIGHER );
- PyModule_AddIntConstant( submodule, "BEST", PY_BEST );
- PyModule_AddIntConstant( submodule, "USEAOSETTINGS", PY_USEAOSETTINGS );
- PyModule_AddIntConstant( submodule, "SKYDOME", PY_SKYDOME );
- PyModule_AddIntConstant( submodule, "GIFULL", PY_FULL );
- PyModule_AddIntConstant( submodule, "OPENEXR", R_OPENEXR );
- PyModule_AddIntConstant( submodule, "TIFF", R_TIFF );
- PyModule_AddIntConstant( submodule, "FFMPEG", R_FFMPEG );
- PyModule_AddIntConstant( submodule, "CINEON", R_CINEON );
- PyModule_AddIntConstant( submodule, "DPX", R_DPX );
-
- return ( submodule );
-}
-
-/***************************************************************************/
-/* BPy_RenderData Callbacks */
-/***************************************************************************/
-
-PyObject *RenderData_CreatePyObject( struct Scene * scene )
-{
- BPy_RenderData *py_renderdata;
-
- py_renderdata =
- ( BPy_RenderData * ) PyObject_NEW( BPy_RenderData,
- &RenderData_Type );
-
- if( py_renderdata == NULL ) {
- return ( NULL );
- }
- py_renderdata->renderContext = &scene->r;
- py_renderdata->scene = scene;
-
- return ( ( PyObject * ) py_renderdata );
-}
-
-/* #####DEPRECATED###### */
-
-static PyObject *RenderData_SetRenderPath( BPy_RenderData *self,
- PyObject *args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)RenderData_setRenderPath );
-}
-
-static PyObject *RenderData_SetBackbufPath( BPy_RenderData *self,
- PyObject *args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)RenderData_setBackbufPath );
-}
-
-static PyObject *RenderData_SetFtypePath( BPy_RenderData *self,
- PyObject *args )
-{
- return EXPP_setterWrapperTuple( (void *)self, args,
- (setter)RenderData_setFtypePath );
-}
-
-static PyObject *RenderData_SetOversamplingLevel( BPy_RenderData * self,
- PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)RenderData_setOSALevel );
-}
-
-static PyObject *RenderData_SetRenderWinSize( BPy_RenderData * self,
- PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)RenderData_setRenderWinSize );
-}
-
-static PyObject *RenderData_SetBorder( BPy_RenderData * self,
- PyObject * args )
-{
- return EXPP_setterWrapperTuple( (void *)self, args,
- (setter)RenderData_setBorder );
-}
-
-static PyObject *RenderData_SetRenderer( BPy_RenderData * self,
- PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)RenderData_setRenderer );
-}
-
-static PyObject *RenderData_SetImageType( BPy_RenderData * self,
- PyObject * args )
-{
- return EXPP_setterWrapper( (void *)self, args,
- (setter)RenderData_setImageType );
-}
diff --git a/source/blender/python/api2_2x/sceneRender.h b/source/blender/python/api2_2x/sceneRender.h
deleted file mode 100644
index df9e59b73e1..00000000000
--- a/source/blender/python/api2_2x/sceneRender.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * $Id: sceneRender.h 10269 2007-03-15 01:09:14Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Joseph Gilbert
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_SCENERENDER_H
-#define EXPP_SCENERENDER_H
-
-#include <Python.h>
-#include "DNA_scene_types.h"
-
-#define BPy_RenderData_Check(v) ((v)->ob_type == &RenderData_Type)
-
-//------------------------------------Struct definitions-------
-typedef struct {
- PyObject_HEAD
- struct RenderData *renderContext;
- Scene *scene;
-} BPy_RenderData;
-//------------------------------------Visible prototypes-------
-PyObject *Render_Init( void );
-
-PyObject *RenderData_CreatePyObject( struct Scene *scene );
-
-#endif /* EXPP_SCENERENDER_H */
diff --git a/source/blender/python/api2_2x/sceneSequence.c b/source/blender/python/api2_2x/sceneSequence.c
deleted file mode 100644
index 86e36655c28..00000000000
--- a/source/blender/python/api2_2x/sceneSequence.c
+++ /dev/null
@@ -1,1163 +0,0 @@
-/*
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Campbell Barton
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include "sceneSequence.h" /* This must come first */
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_sequence_types.h"
-#include "DNA_scene_types.h" /* for Base */
-
-#include "BKE_mesh.h"
-#include "BKE_library.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_scene.h"
-
-#include "BIF_editseq.h" /* get_last_seq */
-#include "BLI_blenlib.h"
-#include "BSE_sequence.h"
-#include "Ipo.h"
-#include "blendef.h" /* CLAMP */
-#include "BKE_utildefines.h"
-#include "Scene.h"
-#include "Sound.h"
-#include "gen_utils.h"
-
-enum seq_consts {
- EXPP_SEQ_ATTR_TYPE = 0,
- EXPP_SEQ_ATTR_CHAN,
- EXPP_SEQ_ATTR_LENGTH,
- EXPP_SEQ_ATTR_START,
- EXPP_SEQ_ATTR_STARTOFS,
- EXPP_SEQ_ATTR_ENDOFS,
- EXPP_SEQ_ATTR_STARTSTILL,
- EXPP_SEQ_ATTR_ENDSTILL
-};
-
-
-/*****************************************************************************/
-/* Python API function prototypes for the Blender module. */
-/*****************************************************************************/
-/*PyObject *M_Sequence_Get( PyObject * self, PyObject * args );*/
-
-/*****************************************************************************/
-/* Python method structure definition for Blender.Object module: */
-/*****************************************************************************/
-/*struct PyMethodDef M_Sequence_methods[] = {
- {"Get", ( PyCFunction ) M_Sequence_Get, METH_VARARGS,
-"(name) - return the sequence with the name 'name',\
-returns None if notfound.\nIf 'name' is not specified, it returns a list of all sequences."},
- {NULL, NULL, 0, NULL}
-};*/
-
-/*****************************************************************************/
-/* Python BPy_Sequence methods table: */
-/*****************************************************************************/
-static PyObject *Sequence_copy( BPy_Sequence * self );
-static PyObject *Sequence_new( BPy_Sequence * self, PyObject * args );
-static PyObject *Sequence_remove( BPy_Sequence * self, PyObject * args );
-
-static PyObject *SceneSeq_new( BPy_SceneSeq * self, PyObject * args );
-static PyObject *SceneSeq_remove( BPy_SceneSeq * self, PyObject * args );
-static void intern_pos_update(Sequence * seq);
-
-static PyMethodDef BPy_Sequence_methods[] = {
- /* name, method, flags, doc */
- {"new", ( PyCFunction ) Sequence_new, METH_VARARGS,
- "(data) - Return a new sequence."},
- {"remove", ( PyCFunction ) Sequence_remove, METH_VARARGS,
- "(data) - Remove a strip."},
- {"__copy__", ( PyCFunction ) Sequence_copy, METH_NOARGS,
- "() - Return a copy of the sequence containing the same objects."},
- {"copy", ( PyCFunction ) Sequence_copy, METH_NOARGS,
- "() - Return a copy of the sequence containing the same objects."},
- {NULL, NULL, 0, NULL}
-};
-
-static PyMethodDef BPy_SceneSeq_methods[] = {
- /* name, method, flags, doc */
- {"new", ( PyCFunction ) SceneSeq_new, METH_VARARGS,
- "(data) - Return a new sequence."},
- {"remove", ( PyCFunction ) SceneSeq_remove, METH_VARARGS,
- "(data) - Remove a strip."},
- {NULL, NULL, 0, NULL}
-};
-
-/* use to add a sequence to a scene or its listbase */
-static PyObject *NewSeq_internal(ListBase *seqbase, PyObject * args, Scene *sce)
-{
- PyObject *py_data = NULL;
-
- Sequence *seq;
- int a;
- Strip *strip;
- StripElem *se;
- int start, machine;
-
- if( !PyArg_ParseTuple( args, "Oii", &py_data, &start, &machine ) )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "expect sequence data then 2 ints - (seqdata, start, track)" );
-
- seq = alloc_sequence(seqbase, start, machine); /* warning, this sets last */
-
- if (PyTuple_Check(py_data)) {
- /* Image */
- PyObject *list;
- char *name;
-
- if (!PyArg_ParseTuple( py_data, "sO!", &name, &PyList_Type, &list)) {
- BLI_remlink(seqbase, seq);
- MEM_freeN(seq);
-
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "images data needs to be a tuple of a string and a list of images - (path, [filenames...])" );
- }
-
- seq->type= SEQ_IMAGE;
-
- seq->len = PyList_Size( list );
-
-
- /* strip and stripdata */
- seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
- strip->len= seq->len;
- strip->us= 1;
- strncpy(strip->dir, name, FILE_MAXDIR-1);
- strip->stripdata= se= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
-
- for(a=0; a<seq->len; a++) {
- name = PyString_AsString(PyList_GetItem( list, a ));
- strncpy(se->name, name, FILE_MAXFILE-1);
- se++;
- }
-
- } else if (BPy_Sound_Check(py_data)) {
- /* sound */
- int totframe;
- bSound *sound = (( BPy_Sound * )py_data)->sound;
-
-
- seq->type= SEQ_RAM_SOUND;
- seq->sound = sound;
-
- totframe= (int) ( ((float)(sound->streamlen-1)/( (float)sce->audio.mixrate*4.0 ))* (float)sce->r.frs_sec / sce->r.frs_sec_base);
-
- sound->flags |= SOUND_FLAGS_SEQUENCE;
-
-
- /* strip and stripdata */
- seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
- strip->len= totframe;
- strip->us= 1;
- strncpy(strip->dir, sound->name, FILE_MAXDIR-1);
- strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem");
-
- /* name sound in first strip */
- strncpy(se->name, sound->name, FILE_MAXFILE-1);
-
- } else if (BPy_Scene_Check(py_data)) {
- /* scene */
- Scene *sce = ((BPy_Scene *)py_data)->scene;
-
- seq->type= SEQ_SCENE;
- seq->scene= sce;
-
- /*seq->sfra= sce->r.sfra;*/
- seq->len= sce->r.efra - sce->r.sfra + 1;
-
- seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
- strncpy(seq->name + 2, sce->id.name + 2,
- sizeof(seq->name) - 2);
- strip->len= seq->len;
- strip->us= 1;
- } else {
- /* movie, pydata is a path to a movie file */
- char *name = PyString_AsString ( py_data );
- if (!name) {
- /* only free these 2 because other stuff isnt set */
- BLI_remlink(seqbase, seq);
- MEM_freeN(seq);
-
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expects a string for chan/bone name and an int for the frame where to put the new key" );
- }
-
- seq->type= SEQ_MOVIE;
- }
- strncpy(seq->name+2, "Untitled", 21);
- intern_pos_update(seq);
- return Sequence_CreatePyObject(seq, NULL, sce);
-}
-
-static PyObject *Sequence_new( BPy_Sequence * self, PyObject * args )
-{
- return NewSeq_internal(&self->seq->seqbase, args, self->scene);
-}
-
-static PyObject *SceneSeq_new( BPy_SceneSeq * self, PyObject * args )
-{
- return NewSeq_internal( &((Editing *)self->scene->ed)->seqbase, args, self->scene);
-}
-
-static void del_seq__internal(Sequence *seq)
-{
- if(seq->ipo) seq->ipo->id.us--;
-
- if(seq->type==SEQ_RAM_SOUND && seq->sound)
- seq->sound->id.us--;
- free_sequence(seq);
-}
-
-static void recurs_del_seq(ListBase *lb)
-{
- Sequence *seq, *seqn;
-
- seq= lb->first;
- while(seq) {
- seqn= seq->next;
- BLI_remlink(lb, seq);
- if(seq->type==SEQ_META) recurs_del_seq(&seq->seqbase);
- del_seq__internal(seq);
- seq= seqn;
- }
-}
-
-static PyObject *RemoveSeq_internal(ListBase *seqbase, PyObject * args, Scene *sce)
-{
- BPy_Sequence *bpy_seq = NULL;
-
- if( !PyArg_ParseTuple( args, "O!", &Sequence_Type, &bpy_seq ) )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "expects a sequence object" );
-
- /* quick way to tell if we dont have the seq */
- if (sce != bpy_seq->scene)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "Sequence does not exist here, cannot remove" );
-
- recurs_del_seq(&bpy_seq->seq->seqbase);
- del_seq__internal(bpy_seq->seq);
- clear_last_seq(); /* just incase */
- Py_RETURN_NONE;
-}
-
-static PyObject *Sequence_remove( BPy_Sequence * self, PyObject * args )
-{
- return RemoveSeq_internal(&self->seq->seqbase, args, self->scene);
-}
-
-static PyObject *SceneSeq_remove( BPy_SceneSeq * self, PyObject * args )
-{
- return RemoveSeq_internal( &((Editing *)self->scene->ed)->seqbase, args, self->scene);
-}
-
-
-static PyObject *Sequence_copy( BPy_Sequence * self )
-{
- printf("Sequence Copy not implimented yet!\n");
- Py_RETURN_NONE;
-}
-
-/*****************************************************************************/
-/* PythonTypeObject callback function prototypes */
-/*****************************************************************************/
-static PyObject *Sequence_repr( BPy_Sequence * obj );
-static PyObject *SceneSeq_repr( BPy_SceneSeq * obj );
-static int Sequence_compare( BPy_Sequence * a, BPy_Sequence * b );
-static int SceneSeq_compare( BPy_SceneSeq * a, BPy_SceneSeq * b );
-
-/*****************************************************************************/
-/* Python BPy_Sequence methods: */
-/*****************************************************************************/
-
-
-static PyObject *Sequence_getIter( BPy_Sequence * self )
-{
- Sequence *iter = self->seq->seqbase.first;
-
- if (!self->iter) {
- self->iter = iter;
- return EXPP_incr_ret ( (PyObject *) self );
- } else {
- return Sequence_CreatePyObject(self->seq, iter, self->scene);
- }
-}
-
-static PyObject *SceneSeq_getIter( BPy_SceneSeq * self )
-{
- Sequence *iter = ((Editing *)self->scene->ed)->seqbase.first;
-
- if (!self->iter) {
- self->iter = iter;
- return EXPP_incr_ret ( (PyObject *) self );
- } else {
- return SceneSeq_CreatePyObject(self->scene, iter);
- }
-}
-
-
-/*
- * Return next Seq
- */
-static PyObject *Sequence_nextIter( BPy_Sequence * self )
-{
- PyObject *object;
- if( !(self->iter) ) {
- self->iter = NULL; /* so we can add objects again */
- return EXPP_ReturnPyObjError( PyExc_StopIteration,
- "iterator at end" );
- }
-
- object= Sequence_CreatePyObject( self->iter, NULL, self->scene );
- self->iter= self->iter->next;
- return object;
-}
-
-
-/*
- * Return next Seq
- */
-static PyObject *SceneSeq_nextIter( BPy_Sequence * self )
-{
- PyObject *object;
- if( !(self->iter) ) {
- self->iter = NULL; /* so we can add objects again */
- return EXPP_ReturnPyObjError( PyExc_StopIteration,
- "iterator at end" );
- }
-
- object= Sequence_CreatePyObject( self->iter, NULL, self->scene );
- self->iter= self->iter->next;
- return object;
-}
-
-
-
-static PyObject *Sequence_getName( BPy_Sequence * self )
-{
- return PyString_FromString( self->seq->name+2 );
-}
-
-static int Sequence_setName( BPy_Sequence * self, PyObject * value )
-{
- char *name = NULL;
-
- name = PyString_AsString ( value );
- if( !name )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected string argument" );
-
- strncpy(self->seq->name+2, name, 21);
- return 0;
-}
-
-
-static PyObject *Sequence_getSound( BPy_Sequence * self )
-{
- if (self->seq->type == SEQ_RAM_SOUND && self->seq->sound)
- return Sound_CreatePyObject(self->seq->sound);
- Py_RETURN_NONE;
-}
-
-static PyObject *Sequence_getIpo( BPy_Sequence * self )
-{
- struct Ipo *ipo;
-
- ipo = self->seq->ipo;
-
- if( ipo )
- return Ipo_CreatePyObject( ipo );
- Py_RETURN_NONE;
-}
-
-
-static PyObject *SceneSeq_getActive( BPy_SceneSeq * self )
-{
- Sequence *last_seq = NULL, *seq;
- Editing *ed = self->scene->ed;
-
- if (!ed)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "scene has no sequence data to edit" );
-
- seq = ed->seqbasep->first;
-
- while (seq) {
- if (seq->flag & SELECT)
- last_seq = seq;
-
- seq = seq->next;
- }
- if (last_seq)
- return Sequence_CreatePyObject(last_seq, NULL, self->scene );
-
- Py_RETURN_NONE;
-}
-
-static PyObject *SceneSeq_getMetaStrip( BPy_SceneSeq * self )
-{
- Sequence *seq = NULL;
- Editing *ed = self->scene->ed;
- MetaStack *ms;
- if (!ed)
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "scene has no sequence data to edit" );
-
- ms = ed->metastack.last;
- if (!ms)
- Py_RETURN_NONE;
-
- seq = ms->parseq;
- return Sequence_CreatePyObject(seq, NULL, self->scene);
-}
-
-
-/*
- * this should accept a Py_None argument and just delete the Ipo link
- * (as Object_clearIpo() does)
- */
-
-static int Sequence_setIpo( BPy_Sequence * self, PyObject * value )
-{
- Ipo *ipo = NULL;
- Ipo *oldipo;
- ID *id;
-
- oldipo = self->seq->ipo;
-
- /* if parameter is not None, check for valid Ipo */
-
- if ( value != Py_None ) {
- if ( !BPy_Ipo_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected an Ipo object" );
-
- ipo = Ipo_FromPyObject( value );
-
- if( !ipo )
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "null ipo!" );
-
- if( ipo->blocktype != ID_SEQ )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "Ipo is not a sequence data Ipo" );
- }
-
- /* if already linked to Ipo, delete link */
-
- if ( oldipo ) {
- id = &oldipo->id;
- if( id->us > 0 )
- id->us--;
- }
-
- /* assign new Ipo and increment user count, or set to NULL if deleting */
-
- self->seq->ipo = ipo;
- if ( ipo )
- id_us_plus(&ipo->id);
-
- return 0;
-}
-
-static PyObject *Sequence_getScene( BPy_Sequence * self )
-{
- struct Scene *scene;
-
- scene = self->seq->scene;
-
- if( scene )
- return Scene_CreatePyObject( scene );
- Py_RETURN_NONE;
-}
-
-
-static PyObject *Sequence_getImages( BPy_Sequence * self )
-{
- Strip *strip;
- StripElem *se;
- int i;
- PyObject *list, *ret;
-
- if (self->seq->type != SEQ_IMAGE) {
- list = PyList_New(0);
- ret= Py_BuildValue( "sO", "", list);
- Py_DECREF(list);
- return ret;
- }
-
- /*return EXPP_ReturnPyObjError( PyExc_TypeError,
- "Sequence is not an image type" );*/
-
-
- strip = self->seq->strip;
- se = strip->stripdata;
- list = PyList_New(strip->len);
-
- for (i=0; i<strip->len; i++, se++) {
- PyList_SetItem( list, i, PyString_FromString(se->name) );
- }
-
- ret= Py_BuildValue( "sO", strip->dir, list);
- Py_DECREF(list);
- return ret;
-}
-
-static int Sequence_setImages( BPy_Sequence * self, PyObject *value )
-{
- Strip *strip;
- StripElem *se;
- int i;
- PyObject *list;
- char *basepath, *name;
-
- if (self->seq->type != SEQ_IMAGE) {
- return EXPP_ReturnIntError( PyExc_TypeError,
- "Sequence is not an image type" );
- }
-
- if( !PyArg_ParseTuple
- ( value, "sO!", &basepath, &PyList_Type, &list ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected string and optional list argument" );
-
- strip = self->seq->strip;
- se = strip->stripdata;
-
- /* for now dont support different image list sizes */
- if (PyList_Size(list) != strip->len) {
- return EXPP_ReturnIntError( PyExc_TypeError,
- "at the moment only image lista with the same number of images as the strip are supported" );
- }
-
- strncpy(strip->dir, basepath, sizeof(strip->dir));
-
- for (i=0; i<strip->len; i++, se++) {
- name = PyString_AsString(PyList_GetItem(list, i));
- if (name) {
- strncpy(se->name, name, sizeof(se->name));
- } else {
- PyErr_Clear();
- }
- }
-
- return 0;
-}
-
-/*
- * get floating point attributes
- */
-static PyObject *getIntAttr( BPy_Sequence *self, void *type )
-{
- int param;
- struct Sequence *seq= self->seq;
-
- /*printf("%i %i %i %i %i %i %i %i %i\n", seq->len, seq->start, seq->startofs, seq->endofs, seq->startstill, seq->endstill, seq->startdisp, seq->enddisp, seq->depth );*/
- switch( (int)type ) {
- case EXPP_SEQ_ATTR_TYPE:
- param = seq->type;
- break;
- case EXPP_SEQ_ATTR_CHAN:
- param = seq->machine;
- break;
- case EXPP_SEQ_ATTR_LENGTH:
- param = seq->len;
- break;
- case EXPP_SEQ_ATTR_START:
- param = seq->start;
- break;
- case EXPP_SEQ_ATTR_STARTOFS:
- param = seq->startofs;
- break;
- case EXPP_SEQ_ATTR_ENDOFS:
- param = seq->endofs;
- break;
- case EXPP_SEQ_ATTR_STARTSTILL:
- param = seq->startstill;
- break;
- case EXPP_SEQ_ATTR_ENDSTILL:
- param = seq->endstill;
- break;
- default:
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "undefined type in getIntAttr" );
- }
-
- return PyInt_FromLong( param );
-}
-
-/* internal functions for recursivly updating metastrip locatons */
-static void intern_pos_update(Sequence * seq) {
- /* update startdisp and enddisp */
- calc_sequence_disp(seq);
-}
-
-void intern_recursive_pos_update(Sequence * seq, int offset) {
- Sequence *iterseq;
- intern_pos_update(seq);
- if (seq->type != SEQ_META) return;
-
- for (iterseq = seq->seqbase.first; iterseq; iterseq= iterseq->next) {
- iterseq->start -= offset;
- intern_recursive_pos_update(iterseq, offset);
- }
-}
-
-
-static int setIntAttrClamp( BPy_Sequence *self, PyObject *value, void *type )
-{
- struct Sequence *seq= self->seq;
- int number, origval=0;
-
- if( !PyInt_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError, "expected an int value" );
-
- number = PyInt_AS_LONG( value );
-
- switch( (int)type ) {
- case EXPP_SEQ_ATTR_CHAN:
- CLAMP(number, 1, 1024);
- seq->machine = number;
- break;
- case EXPP_SEQ_ATTR_START:
- if (self->seq->type == SEQ_EFFECT)
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "cannot set the location of an effect directly" );
- CLAMP(number, -MAXFRAME, MAXFRAME);
- origval = seq->start;
- seq->start = number;
- break;
-
- case EXPP_SEQ_ATTR_STARTOFS:
- if (self->seq->type == SEQ_EFFECT)
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "This property dosnt apply to an effect" );
- CLAMP(number, 0, seq->len - seq->endofs);
- seq->startofs = number;
- break;
- case EXPP_SEQ_ATTR_ENDOFS:
- if (self->seq->type == SEQ_EFFECT)
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "This property dosnt apply to an effect" );
- CLAMP(number, 0, seq->len - seq->startofs);
- seq->endofs = number;
- break;
- case EXPP_SEQ_ATTR_STARTSTILL:
- if (self->seq->type == SEQ_EFFECT)
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "This property dosnt apply to an effect" );
- CLAMP(number, 1, MAXFRAME);
- seq->startstill = number;
- break;
- case EXPP_SEQ_ATTR_ENDSTILL:
- if (self->seq->type == SEQ_EFFECT)
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "This property dosnt apply to an effect" );
- CLAMP(number, seq->startstill+1, MAXFRAME);
- seq->endstill = number;
- break;
- case EXPP_SEQ_ATTR_LENGTH:
- if (self->seq->type == SEQ_EFFECT)
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "cannot set the length of an effect directly" );
- CLAMP(number, 1, MAXFRAME);
- origval = seq->len;
- seq->start = number;
- break;
- default:
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "undefined type in setFloatAttrClamp" );
- }
-
- intern_pos_update(seq);
-
- if ((int)type == EXPP_SEQ_ATTR_START && number != origval )
- intern_recursive_pos_update(seq, origval - seq->start);
-
- return 0;
-}
-
-
-static PyObject *getFlagAttr( BPy_Sequence *self, void *type )
-{
- if (self->seq->flag & (int)type)
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
-}
-
-
-/*
- * set floating point attributes which require clamping
- */
-
-static int setFlagAttr( BPy_Sequence *self, PyObject *value, void *type )
-{
- int t = (int)type;
- int param = PyObject_IsTrue( value );
-
- if( param == -1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected True/False or 0/1" );
-
- if (param)
- self->seq->flag |= t;
- else {
- /* dont allow leftsel and rightsel when its not selected */
- if (t == SELECT)
- t = t + SEQ_LEFTSEL + SEQ_RIGHTSEL;
-
- self->seq->flag &= ~t;
- }
- return 0;
-}
-
-
-/*****************************************************************************/
-/* Python attributes get/set structure: */
-/*****************************************************************************/
-static PyGetSetDef BPy_Sequence_getseters[] = {
- {"name",
- (getter)Sequence_getName, (setter)Sequence_setName,
- "Sequence name",
- NULL},
- {"ipo",
- (getter)Sequence_getIpo, (setter)Sequence_setIpo,
- "Sequence ipo",
- NULL},
-
- {"scene",
- (getter)Sequence_getScene, (setter)NULL,
- "Sequence scene",
- NULL},
- {"sound",
- (getter)Sequence_getSound, (setter)NULL,
- "Sequence name",
- NULL},
- {"images",
- (getter)Sequence_getImages, (setter)Sequence_setImages,
- "Sequence scene",
- NULL},
-
- {"type",
- (getter)getIntAttr, (setter)NULL,
- "",
- (void *) EXPP_SEQ_ATTR_TYPE},
- {"channel",
- (getter)getIntAttr, (setter)setIntAttrClamp,
- "",
- (void *) EXPP_SEQ_ATTR_CHAN},
-
- {"length",
- (getter)getIntAttr, (setter)setIntAttrClamp,
- "",
- (void *) EXPP_SEQ_ATTR_LENGTH},
- {"start",
- (getter)getIntAttr, (setter)setIntAttrClamp,
- "",
- (void *) EXPP_SEQ_ATTR_START},
- {"startOffset",
- (getter)getIntAttr, (setter)setIntAttrClamp,
- "",
- (void *) EXPP_SEQ_ATTR_STARTOFS},
- {"endOffset",
- (getter)getIntAttr, (setter)setIntAttrClamp,
- "",
- (void *) EXPP_SEQ_ATTR_ENDOFS},
- {"startStill",
- (getter)getIntAttr, (setter)setIntAttrClamp,
- "",
- (void *) EXPP_SEQ_ATTR_STARTSTILL},
- {"endStill",
- (getter)getIntAttr, (setter)setIntAttrClamp,
- "",
- (void *) EXPP_SEQ_ATTR_ENDSTILL},
-
- {"sel",
- (getter)getFlagAttr, (setter)setFlagAttr,
- "Sequence audio mute option",
- (void *)SELECT},
- {"selLeft",
- (getter)getFlagAttr, (setter)setFlagAttr,
- "",
- (void *)SEQ_LEFTSEL},
- {"selRight",
- (getter)getFlagAttr, (setter)setFlagAttr,
- "",
- (void *)SEQ_RIGHTSEL},
- {"filtery",
- (getter)getFlagAttr, (setter)setFlagAttr,
- "",
- (void *)SEQ_FILTERY},
- {"mute",
- (getter)getFlagAttr, (setter)setFlagAttr,
- "",
- (void *)SEQ_MUTE},
- {"premul",
- (getter)getFlagAttr, (setter)setFlagAttr,
- "",
- (void *)SEQ_MAKE_PREMUL},
- {"reversed",
- (getter)getFlagAttr, (setter)setFlagAttr,
- "",
- (void *)SEQ_REVERSE_FRAMES},
- {"ipoLocked",
- (getter)getFlagAttr, (setter)setFlagAttr,
- "",
- (void *)SEQ_IPO_FRAME_LOCKED},
- {"ipoLocked",
- (getter)getFlagAttr, (setter)setFlagAttr,
- "",
- (void *)SEQ_IPO_FRAME_LOCKED},
-
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-/*****************************************************************************/
-/* Python attributes get/set structure: */
-/*****************************************************************************/
-static PyGetSetDef BPy_SceneSeq_getseters[] = {
- {"active",
- (getter)SceneSeq_getActive, (setter)NULL,
- "the active strip",
- NULL},
- {"metastrip",
- (getter)SceneSeq_getMetaStrip, (setter)NULL,
- "The currently active metastrip the user is editing",
- NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-/*****************************************************************************/
-/* Python TypeSequence structure definition: */
-/*****************************************************************************/
-PyTypeObject Sequence_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender Sequence", /* char *tp_name; */
- sizeof( BPy_Sequence ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL,/* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- ( cmpfunc ) Sequence_compare, /* cmpfunc tp_compare; */
- ( reprfunc ) Sequence_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- 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; */
- 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, /* 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, /* richcmpfunc tp_richcompare; */
-
- /*** weak reference enabler ***/
- 0, /* long tp_weaklistoffset; */
-
- /*** Added in release 2.2 ***/
- /* Iterators */
- ( getiterfunc ) Sequence_getIter, /* getiterfunc tp_iter; */
- ( iternextfunc ) Sequence_nextIter, /* iternextfunc tp_iternext; */
-
- /*** Attribute descriptor and subclassing stuff ***/
- BPy_Sequence_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_Sequence_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-
-
-/*****************************************************************************/
-/* Python TypeSequence structure definition: */
-/*****************************************************************************/
-PyTypeObject SceneSeq_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender SceneSeq", /* char *tp_name; */
- sizeof( BPy_Sequence ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- NULL,/* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- ( cmpfunc ) SceneSeq_compare, /* cmpfunc tp_compare; */
- ( reprfunc ) SceneSeq_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- 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; */
- 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, /* 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, /* richcmpfunc tp_richcompare; */
-
- /*** weak reference enabler ***/
- 0, /* long tp_weaklistoffset; */
-
- /*** Added in release 2.2 ***/
- /* Iterators */
- ( getiterfunc ) SceneSeq_getIter, /* getiterfunc tp_iter; */
- ( iternextfunc ) SceneSeq_nextIter, /* iternextfunc tp_iternext; */
-
- /*** Attribute descriptor and subclassing stuff ***/
- BPy_SceneSeq_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_SceneSeq_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-
-/*****************************************************************************/
-/* Function: M_Sequence_Get */
-/* Python equivalent: Blender.Sequence.Get */
-/*****************************************************************************/
-/*
-PyObject *M_Sequence_Get( PyObject * self, PyObject * args )
-{
- return SceneSeq_CreatePyObject( G.scene, NULL );
-}
-*/
-
-/*****************************************************************************/
-/* Function: initObject */
-/*****************************************************************************/
-PyObject *Sequence_Init( void )
-{
- PyObject *submodule;
- if( PyType_Ready( &Sequence_Type ) < 0 )
- return NULL;
- if( PyType_Ready( &SceneSeq_Type ) < 0 )
- return NULL;
-
- /* NULL was M_Sequence_methods*/
- submodule = Py_InitModule3( "Blender.Scene.Sequence", NULL,
-"The Blender Sequence module\n\n\
-This module provides access to **Sequence Data** in Blender.\n" );
-
- /*Add SUBMODULES to the module*/
- /*PyDict_SetItemString(dict, "Constraint", Constraint_Init()); //creates a *new* module*/
- return submodule;
-}
-
-
-/*****************************************************************************/
-/* Function: Sequence_CreatePyObject */
-/* Description: This function will create a new BlenObject from an existing */
-/* Object structure. */
-/*****************************************************************************/
-PyObject *Sequence_CreatePyObject( struct Sequence * seq, struct Sequence * iter, struct Scene *sce)
-{
- BPy_Sequence *pyseq;
-
- if( !seq )
- Py_RETURN_NONE;
-
- pyseq =
- ( BPy_Sequence * ) PyObject_NEW( BPy_Sequence, &Sequence_Type );
-
- if( pyseq == NULL ) {
- return ( NULL );
- }
- pyseq->seq = seq;
- pyseq->iter = iter;
- pyseq->scene = sce;
-
- return ( ( PyObject * ) pyseq );
-}
-
-/*****************************************************************************/
-/* Function: SceneSeq_CreatePyObject */
-/* Description: This function will create a new BlenObject from an existing */
-/* Object structure. */
-/*****************************************************************************/
-PyObject *SceneSeq_CreatePyObject( struct Scene * scn, struct Sequence * iter)
-{
- BPy_SceneSeq *pysceseq;
-
- if( !scn )
- Py_RETURN_NONE;
-
- pysceseq =
- ( BPy_SceneSeq * ) PyObject_NEW( BPy_SceneSeq, &SceneSeq_Type );
-
- if( pysceseq == NULL ) {
- return ( NULL );
- }
- pysceseq->scene = scn;
- pysceseq->iter = iter;
-
- return ( ( PyObject * ) pysceseq );
-}
-
-/*****************************************************************************/
-/* Function: Sequence_FromPyObject */
-/* Description: This function returns the Blender sequence from the given */
-/* PyObject. */
-/*****************************************************************************/
-struct Sequence *Sequence_FromPyObject( PyObject * py_seq )
-{
- BPy_Sequence *blen_seq;
-
- blen_seq = ( BPy_Sequence * ) py_seq;
- return ( blen_seq->seq );
-}
-
-/*****************************************************************************/
-/* Function: Sequence_compare */
-/* Description: This is a callback function for the BPy_Sequence type. It */
-/* compares two Sequence_Type objects. Only the "==" and "!=" */
-/* comparisons are meaninful. Returns 0 for equality and -1 if */
-/* they don't point to the same Blender Object struct. */
-/* In Python it becomes 1 if they are equal, 0 otherwise. */
-/*****************************************************************************/
-static int Sequence_compare( BPy_Sequence * a, BPy_Sequence * b )
-{
- Sequence *pa = a->seq, *pb = b->seq;
- return ( pa == pb ) ? 0 : -1;
-}
-
-static int SceneSeq_compare( BPy_SceneSeq * a, BPy_SceneSeq * b )
-{
-
- Scene *pa = a->scene, *pb = b->scene;
- return ( pa == pb ) ? 0 : -1;
-}
-
-/*****************************************************************************/
-/* Function: Sequence_repr / SceneSeq_repr */
-/* Description: This is a callback function for the BPy_Sequence type. It */
-/* builds a meaninful string to represent object objects. */
-/*****************************************************************************/
-static PyObject *Sequence_repr( BPy_Sequence * self )
-{
- return PyString_FromFormat( "[Sequence Strip \"%s\"]",
- self->seq->name + 2 );
-}
-static PyObject *SceneSeq_repr( BPy_SceneSeq * self )
-{
- return PyString_FromFormat( "[Scene Sequence \"%s\"]",
- self->scene->id.name + 2 );
-}
-
diff --git a/source/blender/python/api2_2x/sceneSequence.h b/source/blender/python/api2_2x/sceneSequence.h
deleted file mode 100644
index 2d8431fae80..00000000000
--- a/source/blender/python/api2_2x/sceneSequence.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * $Id: sceneSequence.h 11400 2007-07-28 09:26:53Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Michel Selten
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_SEQUENCE_H
-#define EXPP_SEQUENCE_H
-
-#include <Python.h>
-#include "DNA_sequence_types.h"
-
-/* The Sequence PyTypeObject defined in Sequence.c */
-extern PyTypeObject Sequence_Type;
-extern PyTypeObject SceneSeq_Type;
-
-#define BPy_Sequence_Check(v) ((v)->ob_type == &Sequence_Type)
-#define BPy_SceneSeq_Check(v) ((v)->ob_type == &SceneSeq_Type)
-
-
-/*****************************************************************************/
-/* Python BPy_Sequence structure definition. */
-/*****************************************************************************/
-typedef struct {
- PyObject_HEAD /* required python macro */
-
- /*one of the folowing must be NULL*/
- struct Sequence *seq;/* if not NULL, this sequence is a Metaseq */
-
- /* used for looping over the scene or the strips strips */
- struct Sequence *iter;/* if not NULL, this sequence is a Metaseq */
-
- struct Scene *scene;
-
-} BPy_Sequence;
-
-
-
-/*****************************************************************************/
-/* Python BPy_Sequence structure definition. */
-/*****************************************************************************/
-typedef struct {
- PyObject_HEAD /* required python macro */
-
- /*one of the folowing must be NULL*/
- struct Scene *scene; /* if not NULL, this sequence is the root sequence for the scene*/
-
- /* used for looping over the scene or the strips strips */
- struct Sequence *iter;/* if not NULL, this sequence is a Metaseq */
-} BPy_SceneSeq;
-
-PyObject *Sequence_Init( void );
-PyObject *Sequence_CreatePyObject( struct Sequence * seq, struct Sequence * iter, struct Scene * scn);
-PyObject *SceneSeq_CreatePyObject( struct Scene * scn, struct Sequence * iter);
-struct Sequence *Sequence_FromPyObject( PyObject * py_obj );
-
-#endif /* EXPP_SEQUENCE_H */
diff --git a/source/blender/python/api2_2x/sceneTimeLine.c b/source/blender/python/api2_2x/sceneTimeLine.c
deleted file mode 100644
index 9feba1eb462..00000000000
--- a/source/blender/python/api2_2x/sceneTimeLine.c
+++ /dev/null
@@ -1,319 +0,0 @@
-/* $Id: sceneTimeLine.c 10778 2007-05-25 16:43:25Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Joilnen Leite
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#include <BLI_blenlib.h>
-#include "Scene.h"
-
-#include <stdio.h>
-#include <MEM_guardedalloc.h> /* for MEM_callocN */
-
-#include "gen_utils.h"
-#include "sceneTimeLine.h"
-
-// static PyObject *TimeLine_New (PyObject *self);
-static PyObject *M_TimeLine_Get (PyObject *self, PyObject *args);
-
-static char M_TimeLine_Get_doc[]= "Return the Scene.TimeLine.";
-
-//----------------------Scene.TimeMarker subsubmodule method def----------------------------
-struct PyMethodDef M_TimeLine_methods[]= {
-// {"New", (PyCFunction) M_TimeMarker_New, METH_NOVAR,
-// M_TimeLine_New_doc},
- {"Get", (PyCFunction) M_TimeLine_Get, METH_VARARGS,
- M_TimeLine_Get_doc},
- {NULL, NULL, 0, NULL}
-};
-
-static PyObject *TimeLine_addMarker (BPy_TimeLine *self, PyObject *args);
-static PyObject *TimeLine_delMarker (BPy_TimeLine *self, PyObject *args);
-static PyObject *TimeLine_setNameMarker (BPy_TimeLine *self, PyObject *args);
-static PyObject *TimeLine_getNameMarker (BPy_TimeLine *self, PyObject *args);
-static PyObject *TimeLine_getFramesMarked (BPy_TimeLine *self, PyObject *args);
-
-static PyObject *TimeLine_repr (BPy_TimeLine *self) {
-
- return PyString_FromFormat ("[TimeLine]");
-}
-
-static PyMethodDef BPy_TimeLine_methods[] = {
- {"add", (PyCFunction) TimeLine_addMarker,
- METH_VARARGS,
- "() - Add timemarker"},
- {"delete", (PyCFunction) TimeLine_delMarker,
- METH_VARARGS,
- "() - delete timemarker"},
- {"setName", (PyCFunction) TimeLine_setNameMarker,
- METH_VARARGS,
- "() - Get timemarker name"},
- {"getName", (PyCFunction) TimeLine_getNameMarker,
- METH_VARARGS,
- "() - Set timemarker name"},
- {"getMarked", (PyCFunction) TimeLine_getFramesMarked,
- METH_VARARGS,
- "() - Get frames timemarked"},
- {NULL, NULL, 0, NULL}
-};
-
-/*-----------------------dealloc----------------------------------------*/
-static void TimeLine_dealloc( BPy_TimeLine * self )
-{
- PyObject_DEL( self );
-}
-
-/*-----------------------getattr----------------------------------------*/
-static PyObject *TimeLine_getattr (BPy_TimeLine *self, char *name) {
- return Py_FindMethod( BPy_TimeLine_methods, ( PyObject * ) self, name );
-}
-
-/*-----------------------setattr----------------------------------------*/
-static int TimeLine_setattr (BPy_TimeLine *self, char *name, PyObject *value) {
- PyObject *valtuple;
- PyObject *error= NULL;
-
- valtuple= Py_BuildValue ("(O)", value);
-
- if (!valtuple)
- return EXPP_ReturnIntError( PyExc_MemoryError,
- "TimeLineSetAttr: couldn't create tuple" );
- if( strcmp( name, "name" ) == 0 )
- error = TimeLine_setNameMarker (self, valtuple);
- Py_DECREF (valtuple);
- if (error != Py_None)
- return -1;
-
- Py_DECREF (Py_None);
- return 0;
-}
-
-//-----------------------BPy_Scene method def------------------------------
-PyTypeObject TimeLine_Type = {
- PyObject_HEAD_INIT (NULL) 0, /* ob_size */
- "TimeLine", /* tp_name */
- sizeof (BPy_TimeLine), /* tp_basicsize */
- 0, /* tp_itemsize */
- /* methods */
- ( destructor ) TimeLine_dealloc, /* tp_dealloc */
- (printfunc) 0, /* tp_print */
- (getattrfunc) TimeLine_getattr, /* tp_getattr */
- (setattrfunc) TimeLine_setattr, /* tp_setattr */
- 0,
- (reprfunc) TimeLine_repr, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0,0,0,0,0,0,0,0,0,
- BPy_TimeLine_methods,
- 0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-};
-
-PyObject *TimeLine_Init (void)
-{
- PyObject *submodule;
-
- if (PyType_Ready (&TimeLine_Type) < 0)
- return NULL;
- submodule= Py_InitModule3 ("Blender.Scene.TimeLine", M_TimeLine_methods,
- "The Blender TimeLine subsubmodule");
-
- return submodule;
-}
-
-PyObject *TimeLine_CreatePyObject (BPy_TimeLine *tl) {
- BPy_TimeLine *bl_tl;
-
- bl_tl= (BPy_TimeLine *) PyObject_NEW (BPy_TimeLine, &TimeLine_Type);
-
- return (( PyObject * ) bl_tl);
-}
-
-
-PyObject *M_TimeLine_Get (PyObject *self, PyObject *args) {
-
- return EXPP_incr_ret (Py_None);
-}
-
-static PyObject *TimeLine_getFramesMarked (BPy_TimeLine *self, PyObject *args) {
-
- PyObject *marker_dict= NULL;
- TimeMarker *marker_it= NULL;
- PyObject *tmarker= NULL, *pyo= NULL, *tmpstr;
-
- if (!PyArg_ParseTuple (args, "|O", &tmarker))
- return EXPP_ReturnPyObjError (PyExc_AttributeError,
- "expected nothing, string or int as arguments.");
- if (tmarker) {
- char s[64];
- int frm= 0;
-
- if (PyString_Check (tmarker) && (BLI_strncpy(s, PyString_AsString (tmarker), 64)) ) {
- for (marker_it= self->marker_list->first; marker_it; marker_it= marker_it->next)
- if (!strcmp (marker_it->name, s)) {
- frm= (int)marker_it->frame;
- break;
- }
- }
- else if (PyInt_Check (tmarker))
- frm= (int)PyInt_AS_LONG (tmarker);
- else
- return EXPP_ReturnPyObjError (PyExc_AttributeError,
- "expected nothing, string or int as arguments.");
- if (frm>0) {
- marker_dict= PyDict_New ();
- for (marker_it= self->marker_list->first; marker_it; marker_it= marker_it->next){
- if (marker_it->frame==frm) {
- pyo= PyDict_GetItem ((PyObject*)marker_dict, PyInt_FromLong ((long int)marker_it->frame));
- tmpstr = PyString_FromString(marker_it->name);
- if (pyo) {
- PyList_Append (pyo, tmpstr);
- Py_INCREF(pyo);
- }else{
- pyo = PyList_New(0);
- PyList_Append (pyo, tmpstr);
- }
- Py_DECREF(tmpstr);
-
- PyDict_SetItem (marker_dict, PyInt_FromLong ((long int)marker_it->frame), pyo);
- if (pyo) {
- Py_DECREF (pyo);
- pyo= NULL;
- }
- }
- }
- }
-
- }else {
- marker_dict= PyDict_New ();
- for (marker_it= self->marker_list->first; marker_it; marker_it= marker_it->next) {
- pyo=PyDict_GetItem ((PyObject*)marker_dict, PyInt_FromLong ((long int)marker_it->frame));
- tmpstr = PyString_FromString(marker_it->name);
- if (pyo) {
- PyList_Append (pyo, tmpstr);
- Py_INCREF (pyo);
- }else{
- pyo= PyList_New (0);
- PyList_Append (pyo, tmpstr);
- }
- Py_DECREF(tmpstr);
-
- PyDict_SetItem (marker_dict, PyInt_FromLong ((long int)marker_it->frame), pyo);
- if (pyo) {
- Py_DECREF (pyo);
- pyo= NULL;
- }
- }
- }
-
- return marker_dict;
-}
-
-static PyObject *TimeLine_addMarker (BPy_TimeLine *self, PyObject *args) {
- int frame= 0;
- TimeMarker *marker= NULL, *marker_it= NULL;
-
- if (!PyArg_ParseTuple( args, "i", &frame ))
- return EXPP_ReturnPyObjError (PyExc_TypeError,
- "expected int as argument.");
- /* two markers can't be at the same place */
- for (marker_it= self->marker_list->first; marker_it; marker_it= marker_it->next) {
- if (marker_it->frame==frame)
- return EXPP_incr_ret (Py_None);
- }
- if (frame<self->sfra || frame>self->efra)
- return EXPP_ReturnPyObjError (PyExc_TypeError, "frame out of range.");
- marker= MEM_callocN (sizeof(TimeMarker), "TimeMarker");
- if (!marker) return EXPP_incr_ret (Py_None);
- marker->frame= frame;
- BLI_addtail (self->marker_list, marker);
- return EXPP_incr_ret (Py_None);
-}
-
-static PyObject *TimeLine_delMarker (BPy_TimeLine *self, PyObject *args) {
- int frame= 0;
- TimeMarker *marker= NULL;
-
- if (!PyArg_ParseTuple (args, "|i", &frame))
- return EXPP_ReturnPyObjError (PyExc_TypeError,
- "expected int as argument.");
-
- for (marker= self->marker_list->first; marker; marker= marker->next) {
- if (!frame)
- BLI_freelinkN (self->marker_list, marker);
- else if (marker->frame == frame) {
- BLI_freelinkN (self->marker_list, marker);
- return EXPP_incr_ret (Py_None);
- }
- }
-
- return EXPP_incr_ret (Py_None);
-}
-
-static PyObject *TimeLine_setNameMarker (BPy_TimeLine *self, PyObject *args) {
- char *buf;
- char name[64];
- int frame= 0;
- TimeMarker *marker= NULL;
-
- if (!PyArg_ParseTuple( args, "is", &frame, &buf))
- return EXPP_ReturnPyObjError (PyExc_TypeError,
- "expected int as argument.");
- PyOS_snprintf (name, sizeof (name), "%s", buf);
- for (marker= self->marker_list->first; marker; marker= marker->next) {
- if (marker->frame == frame) {
- BLI_strncpy(marker->name, name, sizeof(marker->name));
- return EXPP_incr_ret (Py_None);
- }
- }
-
- return EXPP_ReturnPyObjError (PyExc_TypeError, "frame not marked.");
-}
-
-static PyObject *TimeLine_getNameMarker (BPy_TimeLine *self, PyObject *args) {
- int frame= 0;
- TimeMarker *marker;
-
- if (!PyArg_ParseTuple (args, "i", &frame))
- return EXPP_ReturnPyObjError (PyExc_TypeError, "expected int as argument.");
-
- for (marker= self->marker_list->first; marker; marker= marker->next) {
- if (marker->frame == frame)
- return PyString_FromString (marker->name);
- }
-
- return EXPP_ReturnPyObjError (PyExc_TypeError, "frame not marked.");
-}
-
-
diff --git a/source/blender/python/api2_2x/sceneTimeLine.h b/source/blender/python/api2_2x/sceneTimeLine.h
deleted file mode 100644
index 0a3aa62b571..00000000000
--- a/source/blender/python/api2_2x/sceneTimeLine.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * $Id: sceneTimeLine.h 10269 2007-03-15 01:09:14Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Joilnen Leite
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef EXPP_TIMELINE_H
-#define EXPP_TIMELINE_H
-
-#include <Python.h>
-#include <DNA_scene_types.h>
-
-extern PyTypeObject TimeLine_Type;
-#define BPy_TimeLine_Check (v) \
- ((v)->ob_type == &TimeLine_Type)
-
-typedef struct {
- PyObject_HEAD
- ListBase *marker_list;
- int sfra, efra;
-} BPy_TimeLine;
-
-//---------------------------Python BPy_TimeLine visible prototypes-----------
-// Python TimeLine_Type helper functions needed by Blender (the Init function) and Object modules.
-
-
-PyObject *TimeLine_Init (void);
-PyObject *TimeLine_CreatePyObject (BPy_TimeLine *tl);
-BPy_TimeLine *TimeLine_FromPyObject (PyObject * pyobj);
-
-#endif /* EXPP_TMARKER_H */
-
diff --git a/source/blender/python/api2_2x/vector.c b/source/blender/python/api2_2x/vector.c
deleted file mode 100644
index 45ad36d0093..00000000000
--- a/source/blender/python/api2_2x/vector.c
+++ /dev/null
@@ -1,1264 +0,0 @@
-/*
- * $Id: vector.c 12314 2007-10-20 20:24:09Z campbellbarton $
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- *
- * Contributor(s): Willian P. Germano & Joseph Gilbert, Ken Hughes
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include "Mathutils.h"
-
-#include "BLI_blenlib.h"
-#include "BKE_utildefines.h"
-#include "BLI_arithb.h"
-#include "gen_utils.h"
-
-
-/*-------------------------DOC STRINGS ---------------------------*/
-char Vector_Zero_doc[] = "() - set all values in the vector to 0";
-char Vector_Normalize_doc[] = "() - normalize the vector";
-char Vector_Negate_doc[] = "() - changes vector to it's additive inverse";
-char Vector_Resize2D_doc[] = "() - resize a vector to [x,y]";
-char Vector_Resize3D_doc[] = "() - resize a vector to [x,y,z]";
-char Vector_Resize4D_doc[] = "() - resize a vector to [x,y,z,w]";
-char Vector_toPoint_doc[] = "() - create a new Point Object from this vector";
-char Vector_ToTrackQuat_doc[] = "(track, up) - extract a quaternion from the vector and the track and up axis";
-char Vector_copy_doc[] = "() - return a copy of the vector";
-/*-----------------------METHOD DEFINITIONS ----------------------*/
-struct PyMethodDef Vector_methods[] = {
- {"zero", (PyCFunction) Vector_Zero, METH_NOARGS, Vector_Zero_doc},
- {"normalize", (PyCFunction) Vector_Normalize, METH_NOARGS, Vector_Normalize_doc},
- {"negate", (PyCFunction) Vector_Negate, METH_NOARGS, Vector_Negate_doc},
- {"resize2D", (PyCFunction) Vector_Resize2D, METH_NOARGS, Vector_Resize2D_doc},
- {"resize3D", (PyCFunction) Vector_Resize3D, METH_NOARGS, Vector_Resize2D_doc},
- {"resize4D", (PyCFunction) Vector_Resize4D, METH_NOARGS, Vector_Resize2D_doc},
- {"toPoint", (PyCFunction) Vector_toPoint, METH_NOARGS, Vector_toPoint_doc},
- {"toTrackQuat", ( PyCFunction ) Vector_ToTrackQuat, METH_VARARGS, Vector_ToTrackQuat_doc},
- {"copy", (PyCFunction) Vector_copy, METH_NOARGS, Vector_copy_doc},
- {"__copy__", (PyCFunction) Vector_copy, METH_NOARGS, Vector_copy_doc},
- {NULL, NULL, 0, NULL}
-};
-
-/*-----------------------------METHODS----------------------------
- --------------------------Vector.toPoint()----------------------
- create a new point object to represent this vector */
-PyObject *Vector_toPoint(VectorObject * self)
-{
- float coord[3];
- int i;
-
- if(self->size < 2 || self->size > 3) {
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Vector.toPoint(): inappropriate vector size - expects 2d or 3d vector\n");
- }
- for(i = 0; i < self->size; i++){
- coord[i] = self->vec[i];
- }
-
- return newPointObject(coord, self->size, Py_NEW);
-}
-/*----------------------------Vector.zero() ----------------------
- set the vector data to 0,0,0 */
-PyObject *Vector_Zero(VectorObject * self)
-{
- int i;
- for(i = 0; i < self->size; i++) {
- self->vec[i] = 0.0f;
- }
- return EXPP_incr_ret((PyObject*)self);
-}
-/*----------------------------Vector.normalize() -----------------
- normalize the vector data to a unit vector */
-PyObject *Vector_Normalize(VectorObject * self)
-{
- int i;
- float norm = 0.0f;
-
- for(i = 0; i < self->size; i++) {
- norm += self->vec[i] * self->vec[i];
- }
- norm = (float) sqrt(norm);
- for(i = 0; i < self->size; i++) {
- self->vec[i] /= norm;
- }
- return EXPP_incr_ret((PyObject*)self);
-}
-
-
-/*----------------------------Vector.resize2D() ------------------
- resize the vector to x,y */
-PyObject *Vector_Resize2D(VectorObject * self)
-{
- if(self->wrapped==Py_WRAP)
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "vector.resize2d(): cannot resize wrapped data - only python vectors\n");
-
- self->vec = PyMem_Realloc(self->vec, (sizeof(float) * 2));
- if(self->vec == NULL)
- return EXPP_ReturnPyObjError(PyExc_MemoryError,
- "vector.resize2d(): problem allocating pointer space\n\n");
-
- self->size = 2;
- return EXPP_incr_ret((PyObject*)self);
-}
-/*----------------------------Vector.resize3D() ------------------
- resize the vector to x,y,z */
-PyObject *Vector_Resize3D(VectorObject * self)
-{
- if (self->wrapped==Py_WRAP)
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "vector.resize3d(): cannot resize wrapped data - only python vectors\n");
-
- self->vec = PyMem_Realloc(self->vec, (sizeof(float) * 3));
- if(self->vec == NULL)
- return EXPP_ReturnPyObjError(PyExc_MemoryError,
- "vector.resize3d(): problem allocating pointer space\n\n");
-
- if(self->size == 2)
- self->vec[2] = 0.0f;
-
- self->size = 3;
- return EXPP_incr_ret((PyObject*)self);
-}
-/*----------------------------Vector.resize4D() ------------------
- resize the vector to x,y,z,w */
-PyObject *Vector_Resize4D(VectorObject * self)
-{
- if(self->wrapped==Py_WRAP)
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "vector.resize4d(): cannot resize wrapped data - only python vectors\n");
-
- self->vec = PyMem_Realloc(self->vec, (sizeof(float) * 4));
- if(self->vec == NULL)
- return EXPP_ReturnPyObjError(PyExc_MemoryError,
- "vector.resize4d(): problem allocating pointer space\n\n");
-
- if(self->size == 2){
- self->vec[2] = 0.0f;
- self->vec[3] = 1.0f;
- }else if(self->size == 3){
- self->vec[3] = 1.0f;
- }
- self->size = 4;
- return EXPP_incr_ret((PyObject*)self);
-}
-/*----------------------------Vector.toTrackQuat(track, up) ----------------------
- extract a quaternion from the vector and the track and up axis */
-PyObject *Vector_ToTrackQuat( VectorObject * self, PyObject * args )
-{
- float vec[3];
- char *strack, *sup;
- short track = 2, up = 1;
-
- if( !PyArg_ParseTuple ( args, "|ss", &strack, &sup ) ) {
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected optional two strings\n" );
- }
- if (self->size != 3) {
- return EXPP_ReturnPyObjError( PyExc_TypeError, "only for 3D vectors\n" );
- }
-
- if (strack) {
- if (strlen(strack) == 2) {
- if (strack[0] == '-') {
- switch(strack[1]) {
- case 'X':
- case 'x':
- track = 3;
- break;
- case 'Y':
- case 'y':
- track = 4;
- break;
- case 'z':
- case 'Z':
- track = 5;
- break;
- default:
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "only X, -X, Y, -Y, Z or -Z for track axis\n" );
- }
- }
- else {
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "only X, -X, Y, -Y, Z or -Z for track axis\n" );
- }
- }
- else if (strlen(strack) == 1) {
- switch(strack[0]) {
- case '-':
- case 'X':
- case 'x':
- track = 0;
- break;
- case 'Y':
- case 'y':
- track = 1;
- break;
- case 'z':
- case 'Z':
- track = 2;
- break;
- default:
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "only X, -X, Y, -Y, Z or -Z for track axis\n" );
- }
- }
- else {
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "only X, -X, Y, -Y, Z or -Z for track axis\n" );
- }
- }
-
- if (sup) {
- if (strlen(sup) == 1) {
- switch(*sup) {
- case 'X':
- case 'x':
- up = 0;
- break;
- case 'Y':
- case 'y':
- up = 1;
- break;
- case 'z':
- case 'Z':
- up = 2;
- break;
- default:
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "only X, Y or Z for up axis\n" );
- }
- }
- else {
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "only X, Y or Z for up axis\n" );
- }
- }
-
- if (track == up) {
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "Can't have the same axis for track and up\n" );
- }
-
- /*
- flip vector around, since vectoquat expect a vector from target to tracking object
- and the python function expects the inverse (a vector to the target).
- */
- vec[0] = -self->vec[0];
- vec[1] = -self->vec[1];
- vec[2] = -self->vec[2];
-
- return newQuaternionObject(vectoquat(vec, track, up), Py_NEW);
-}
-
-
-
-/*----------------------------Vector.copy() --------------------------------------
- return a copy of the vector */
-PyObject *Vector_copy(VectorObject * self)
-{
- return newVectorObject(self->vec, self->size, Py_NEW);
-}
-
-/*----------------------------dealloc()(internal) ----------------
- free the py_object */
-static void Vector_dealloc(VectorObject * self)
-{
- /* only free non wrapped */
- if(self->wrapped != Py_WRAP){
- PyMem_Free(self->vec);
- }
- PyObject_DEL(self);
-}
-
-/*----------------------------print object (internal)-------------
- print the object to screen */
-static PyObject *Vector_repr(VectorObject * self)
-{
- int i;
- char buffer[48], str[1024];
-
- BLI_strncpy(str,"[",1024);
- for(i = 0; i < self->size; i++){
- if(i < (self->size - 1)){
- sprintf(buffer, "%.6f, ", self->vec[i]);
- strcat(str,buffer);
- }else{
- sprintf(buffer, "%.6f", self->vec[i]);
- strcat(str,buffer);
- }
- }
- strcat(str, "](vector)");
-
- return PyString_FromString(str);
-}
-/*---------------------SEQUENCE PROTOCOLS------------------------
- ----------------------------len(object)------------------------
- sequence length*/
-static int Vector_len(VectorObject * self)
-{
- return self->size;
-}
-/*----------------------------object[]---------------------------
- sequence accessor (get)*/
-static PyObject *Vector_item(VectorObject * self, int i)
-{
- if(i < 0 || i >= self->size)
- return EXPP_ReturnPyObjError(PyExc_IndexError,
- "vector[index]: out of range\n");
-
- return PyFloat_FromDouble(self->vec[i]);
-
-}
-/*----------------------------object[]-------------------------
- sequence accessor (set)*/
-static int Vector_ass_item(VectorObject * self, int i, PyObject * ob)
-{
-
- if(!(PyNumber_Check(ob))) { /* parsed item not a number */
- return EXPP_ReturnIntError(PyExc_TypeError,
- "vector[index] = x: index argument not a number\n");
- }
-
- if(i < 0 || i >= self->size){
- return EXPP_ReturnIntError(PyExc_IndexError,
- "vector[index] = x: assignment index out of range\n");
- }
- self->vec[i] = (float)PyFloat_AsDouble(ob);
- return 0;
-}
-
-/*----------------------------object[z:y]------------------------
- sequence slice (get) */
-static PyObject *Vector_slice(VectorObject * self, int begin, int end)
-{
- PyObject *list = NULL;
- int count;
-
- CLAMP(begin, 0, self->size);
- if (end<0) end= self->size+end+1;
- CLAMP(end, 0, self->size);
- begin = MIN2(begin,end);
-
- list = PyList_New(end - begin);
- for(count = begin; count < end; count++) {
- PyList_SetItem(list, count - begin,
- PyFloat_FromDouble(self->vec[count]));
- }
-
- return list;
-}
-/*----------------------------object[z:y]------------------------
- sequence slice (set) */
-static int Vector_ass_slice(VectorObject * self, int begin, int end,
- PyObject * seq)
-{
- int i, y, size = 0;
- float vec[4];
- PyObject *v;
-
- CLAMP(begin, 0, self->size);
- if (end<0) end= self->size+end+1;
- CLAMP(end, 0, self->size);
- begin = MIN2(begin,end);
-
- size = PySequence_Length(seq);
- if(size != (end - begin)){
- return EXPP_ReturnIntError(PyExc_TypeError,
- "vector[begin:end] = []: size mismatch in slice assignment\n");
- }
-
- for (i = 0; i < size; i++) {
- v = PySequence_GetItem(seq, i);
- if (v == NULL) { /* Failed to read sequence */
- return EXPP_ReturnIntError(PyExc_RuntimeError,
- "vector[begin:end] = []: unable to read sequence\n");
- }
-
- if(!PyNumber_Check(v)) { /* parsed item not a number */
- Py_DECREF(v);
- return EXPP_ReturnIntError(PyExc_TypeError,
- "vector[begin:end] = []: sequence argument not a number\n");
- }
-
- vec[i] = (float)PyFloat_AsDouble(v);
- Py_DECREF(v);
- }
- /*parsed well - now set in vector*/
- for(y = 0; y < size; y++){
- self->vec[begin + y] = vec[y];
- }
- return 0;
-}
-/*------------------------NUMERIC PROTOCOLS----------------------
- ------------------------obj + obj------------------------------
- addition*/
-static PyObject *Vector_add(PyObject * v1, PyObject * v2)
-{
- int i;
- float vec[4];
-
- VectorObject *vec1 = NULL, *vec2 = NULL;
-
- if VectorObject_Check(v1)
- vec1= (VectorObject *)v1;
-
- if VectorObject_Check(v2)
- vec2= (VectorObject *)v2;
-
- /* make sure v1 is always the vector */
- if (vec1 && vec2 ) {
- /*VECTOR + VECTOR*/
- if(vec1->size != vec2->size)
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Vector addition: vectors must have the same dimensions for this operation\n");
-
- for(i = 0; i < vec1->size; i++) {
- vec[i] = vec1->vec[i] + vec2->vec[i];
- }
- return newVectorObject(vec, vec1->size, Py_NEW);
- }
-
- if(PointObject_Check(v2)){ /*VECTOR + POINT*/
- /*Point translation*/
- PointObject *pt = (PointObject*)v2;
-
- if(pt->size == vec1->size){
- for(i = 0; i < vec1->size; i++){
- vec[i] = vec1->vec[i] + pt->coord[i];
- }
- }else{
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Vector addition: arguments are the wrong size....\n");
- }
- return newPointObject(vec, vec1->size, Py_NEW);
- }
-
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Vector addition: arguments not valid for this operation....\n");
-}
-
-/* ------------------------obj += obj------------------------------
- addition in place */
-static PyObject *Vector_iadd(PyObject * v1, PyObject * v2)
-{
- int i;
-
- VectorObject *vec1 = NULL, *vec2 = NULL;
-
- if VectorObject_Check(v1)
- vec1= (VectorObject *)v1;
-
- if VectorObject_Check(v2)
- vec2= (VectorObject *)v2;
-
- /* make sure v1 is always the vector */
- if (vec1 && vec2 ) {
- /*VECTOR + VECTOR*/
- if(vec1->size != vec2->size)
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Vector addition: vectors must have the same dimensions for this operation\n");
-
- for(i = 0; i < vec1->size; i++) {
- vec1->vec[i] += vec2->vec[i];
- }
- Py_INCREF( v1 );
- return v1;
- }
-
- if(PointObject_Check(v2)){ /*VECTOR + POINT*/
- /*Point translation*/
- PointObject *pt = (PointObject*)v2;
-
- if(pt->size == vec1->size){
- for(i = 0; i < vec1->size; i++){
- vec1->vec[i] += pt->coord[i];
- }
- }else{
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Vector addition: arguments are the wrong size....\n");
- }
- Py_INCREF( v1 );
- return v1;
- }
-
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Vector addition: arguments not valid for this operation....\n");
-}
-
-/*------------------------obj - obj------------------------------
- subtraction*/
-static PyObject *Vector_sub(PyObject * v1, PyObject * v2)
-{
- int i;
- float vec[4];
- VectorObject *vec1 = NULL, *vec2 = NULL;
-
- if (!VectorObject_Check(v1) || !VectorObject_Check(v2))
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Vector subtraction: arguments not valid for this operation....\n");
-
- vec1 = (VectorObject*)v1;
- vec2 = (VectorObject*)v2;
-
- if(vec1->size != vec2->size)
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Vector subtraction: vectors must have the same dimensions for this operation\n");
-
- for(i = 0; i < vec1->size; i++) {
- vec[i] = vec1->vec[i] - vec2->vec[i];
- }
-
- return newVectorObject(vec, vec1->size, Py_NEW);
-}
-
-/*------------------------obj -= obj------------------------------
- subtraction*/
-static PyObject *Vector_isub(PyObject * v1, PyObject * v2)
-{
- int i, size;
- VectorObject *vec1 = NULL, *vec2 = NULL;
-
- if (!VectorObject_Check(v1) || !VectorObject_Check(v2))
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Vector subtraction: arguments not valid for this operation....\n");
-
- vec1 = (VectorObject*)v1;
- vec2 = (VectorObject*)v2;
-
- if(vec1->size != vec2->size)
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Vector subtraction: vectors must have the same dimensions for this operation\n");
-
- size = vec1->size;
- for(i = 0; i < vec1->size; i++) {
- vec1->vec[i] = vec1->vec[i] - vec2->vec[i];
- }
-
- Py_INCREF( v1 );
- return v1;
-}
-
-/*------------------------obj * obj------------------------------
- mulplication*/
-static PyObject *Vector_mul(PyObject * v1, PyObject * v2)
-{
- VectorObject *vec1 = NULL, *vec2 = NULL;
-
- if VectorObject_Check(v1)
- vec1= (VectorObject *)v1;
-
- if VectorObject_Check(v2)
- vec2= (VectorObject *)v2;
-
- /* make sure v1 is always the vector */
- if (vec1 && vec2 ) {
- int i;
- double dot = 0.0f;
-
- if(vec1->size != vec2->size)
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "Vector multiplication: vectors must have the same dimensions for this operation\n");
-
- /*dot product*/
- for(i = 0; i < vec1->size; i++) {
- dot += vec1->vec[i] * vec2->vec[i];
- }
- return PyFloat_FromDouble(dot);
- }
-
- /*swap so vec1 is always the vector */
- if (vec2) {
- vec1= vec2;
- v2= v1;
- }
-
- if (PyNumber_Check(v2)) {
- /* VEC * NUM */
- int i;
- float vec[4];
- float scalar = (float)PyFloat_AsDouble( v2 );
-
- for(i = 0; i < vec1->size; i++) {
- vec[i] = vec1->vec[i] * scalar;
- }
- return newVectorObject(vec, vec1->size, Py_NEW);
-
- } else if (MatrixObject_Check(v2)) {
- /* VEC * MATRIX */
- if (v1==v2) /* mat*vec, we have swapped the order */
- return column_vector_multiplication((MatrixObject*)v2, vec1);
- else /* vec*mat */
- return row_vector_multiplication(vec1, (MatrixObject*)v2);
- } else if (QuaternionObject_Check(v2)) {
- QuaternionObject *quat = (QuaternionObject*)v2;
- if(vec1->size != 3)
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Vector multiplication: only 3D vector rotations (with quats) currently supported\n");
-
- return quat_rotation((PyObject*)vec1, (PyObject*)quat);
- }
-
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Vector multiplication: arguments not acceptable for this operation\n");
-}
-
-/*------------------------obj *= obj------------------------------
- in place mulplication */
-static PyObject *Vector_imul(PyObject * v1, PyObject * v2)
-{
- VectorObject *vec = (VectorObject *)v1;
- int i;
-
- /* only support vec*=float and vec*=mat
- vec*=vec result is a float so that wont work */
- if (PyNumber_Check(v2)) {
- /* VEC * NUM */
- float scalar = (float)PyFloat_AsDouble( v2 );
-
- for(i = 0; i < vec->size; i++) {
- vec->vec[i] *= scalar;
- }
-
- Py_INCREF( v1 );
- return v1;
-
- } else if (MatrixObject_Check(v2)) {
- float vecCopy[4];
- int x,y, size = vec->size;
- MatrixObject *mat= (MatrixObject*)v2;
-
- if(mat->colSize != size){
- if(mat->rowSize == 4 && vec->size != 3){
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "vector * matrix: matrix column size and the vector size must be the same");
- } 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];
- }
- vec->vec[i] = (float)dot;
- }
- Py_INCREF( v1 );
- return v1;
- }
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Vector multiplication: arguments not acceptable for this operation\n");
-}
-
-/*------------------------obj / obj------------------------------
- divide*/
-static PyObject *Vector_div(PyObject * v1, PyObject * v2)
-{
- int i, size;
- float vec[4], scalar;
- VectorObject *vec1 = NULL;
-
- if(!VectorObject_Check(v1)) /* not a vector */
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Vector division: Vector must be divided by a float\n");
-
- vec1 = (VectorObject*)v1; /* vector */
-
- if(!PyNumber_Check(v2)) /* parsed item not a number */
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Vector division: Vector must be divided by a float\n");
-
- scalar = (float)PyFloat_AsDouble(v2);
-
- if(scalar==0.0) /* not a vector */
- return EXPP_ReturnPyObjError(PyExc_ZeroDivisionError,
- "Vector division: divide by zero error.\n");
-
- size = vec1->size;
- for(i = 0; i < size; i++) {
- vec[i] = vec1->vec[i] / scalar;
- }
- return newVectorObject(vec, size, Py_NEW);
-}
-
-/*------------------------obj / obj------------------------------
- divide*/
-static PyObject *Vector_idiv(PyObject * v1, PyObject * v2)
-{
- int i, size;
- float scalar;
- VectorObject *vec1 = NULL;
-
- /*if(!VectorObject_Check(v1))
- return EXPP_ReturnIntError(PyExc_TypeError,
- "Vector division: Vector must be divided by a float\n");*/
-
- vec1 = (VectorObject*)v1; /* vector */
-
- if(!PyNumber_Check(v2)) /* parsed item not a number */
- return EXPP_ReturnPyObjError(PyExc_TypeError,
- "Vector division: Vector must be divided by a float\n");
-
- scalar = (float)PyFloat_AsDouble(v2);
-
- if(scalar==0.0) /* not a vector */
- return EXPP_ReturnPyObjError(PyExc_ZeroDivisionError,
- "Vector division: divide by zero error.\n");
-
- size = vec1->size;
- for(i = 0; i < size; i++) {
- vec1->vec[i] /= scalar;
- }
- Py_INCREF( v1 );
- return v1;
-}
-
-/*-------------------------- -obj -------------------------------
- returns the negative of this object*/
-static PyObject *Vector_neg(VectorObject *self)
-{
- int i;
- float vec[4];
- for(i = 0; i < self->size; i++){
- vec[i] = -self->vec[i];
- }
-
- return newVectorObject(vec, self->size, Py_NEW);
-}
-/*------------------------coerce(obj, obj)-----------------------
- coercion of unknown types to type VectorObject for numeric protocols
- Coercion() is called whenever a math operation has 2 operands that
- it doesn't understand how to evaluate. 2+Matrix for example. We want to
- evaluate some of these operations like: (vector * 2), however, for math
- to proceed, the unknown operand must be cast to a type that python math will
- understand. (e.g. in the case above case, 2 must be cast to a vector and
- then call vector.multiply(vector, scalar_cast_as_vector)*/
-
-
-static int Vector_coerce(PyObject ** v1, PyObject ** v2)
-{
- /* Just incref, each functon must raise errors for bad types */
- Py_INCREF (*v1);
- Py_INCREF (*v2);
- return 0;
-}
-
-
-/*------------------------tp_doc*/
-static char VectorObject_doc[] = "This is a wrapper for vector objects.";
-/*------------------------vec_magnitude_nosqrt (internal) - for comparing only */
-static double vec_magnitude_nosqrt(float *data, int size)
-{
- double dot = 0.0f;
- int i;
-
- for(i=0; i<size; i++){
- dot += data[i];
- }
- /*return (double)sqrt(dot);*/
- /* warning, line above removed because we are not using the length,
- rather the comparing the sizes and for this we do not need the sqrt
- for the actual length, the dot must be sqrt'd */
- return (double)dot;
-}
-
-
-/*------------------------tp_richcmpr
- returns -1 execption, 0 false, 1 true */
-PyObject* Vector_richcmpr(PyObject *objectA, PyObject *objectB, int comparison_type)
-{
- VectorObject *vecA = NULL, *vecB = NULL;
- int result = 0;
- float epsilon = .000001f;
- double lenA,lenB;
-
- if (!VectorObject_Check(objectA) || !VectorObject_Check(objectB)){
- if (comparison_type == Py_NE){
- return EXPP_incr_ret(Py_True);
- }else{
- return EXPP_incr_ret(Py_False);
- }
- }
- vecA = (VectorObject*)objectA;
- vecB = (VectorObject*)objectB;
-
- if (vecA->size != vecB->size){
- if (comparison_type == Py_NE){
- return EXPP_incr_ret(Py_True);
- }else{
- return EXPP_incr_ret(Py_False);
- }
- }
-
- switch (comparison_type){
- case Py_LT:
- lenA = vec_magnitude_nosqrt(vecA->vec, vecA->size);
- lenB = vec_magnitude_nosqrt(vecB->vec, vecB->size);
- if( lenA < lenB ){
- result = 1;
- }
- break;
- case Py_LE:
- lenA = vec_magnitude_nosqrt(vecA->vec, vecA->size);
- lenB = vec_magnitude_nosqrt(vecB->vec, vecB->size);
- if( lenA < lenB ){
- result = 1;
- }else{
- result = (((lenA + epsilon) > lenB) && ((lenA - epsilon) < lenB));
- }
- break;
- case Py_EQ:
- result = EXPP_VectorsAreEqual(vecA->vec, vecB->vec, vecA->size, 1);
- break;
- case Py_NE:
- result = EXPP_VectorsAreEqual(vecA->vec, vecB->vec, vecA->size, 1);
- if (result == 0){
- result = 1;
- }else{
- result = 0;
- }
- break;
- case Py_GT:
- lenA = vec_magnitude_nosqrt(vecA->vec, vecA->size);
- lenB = vec_magnitude_nosqrt(vecB->vec, vecB->size);
- if( lenA > lenB ){
- result = 1;
- }
- break;
- case Py_GE:
- lenA = vec_magnitude_nosqrt(vecA->vec, vecA->size);
- lenB = vec_magnitude_nosqrt(vecB->vec, vecB->size);
- if( lenA > lenB ){
- result = 1;
- }else{
- result = (((lenA + epsilon) > lenB) && ((lenA - epsilon) < lenB));
- }
- break;
- default:
- printf("The result of the comparison could not be evaluated");
- break;
- }
- if (result == 1){
- return EXPP_incr_ret(Py_True);
- }else{
- return EXPP_incr_ret(Py_False);
- }
-}
-/*-----------------PROTCOL DECLARATIONS--------------------------*/
-static PySequenceMethods Vector_SeqMethods = {
- (inquiry) Vector_len, /* sq_length */
- (binaryfunc) 0, /* sq_concat */
- (intargfunc) 0, /* sq_repeat */
- (intargfunc) Vector_item, /* sq_item */
- (intintargfunc) Vector_slice, /* sq_slice */
- (intobjargproc) Vector_ass_item, /* sq_ass_item */
- (intintobjargproc) Vector_ass_slice, /* sq_ass_slice */
-};
-
-
-/* For numbers without flag bit Py_TPFLAGS_CHECKTYPES set, all
- arguments are guaranteed to be of the object's type (modulo
- coercion hacks -- i.e. if the type's coercion function
- returns other types, then these are allowed as well). Numbers that
- have the Py_TPFLAGS_CHECKTYPES flag bit set should check *both*
- arguments for proper type and implement the necessary conversions
- in the slot functions themselves. */
-
-static PyNumberMethods Vector_NumMethods = {
- (binaryfunc) Vector_add, /* __add__ */
- (binaryfunc) Vector_sub, /* __sub__ */
- (binaryfunc) Vector_mul, /* __mul__ */
- (binaryfunc) Vector_div, /* __div__ */
- (binaryfunc) NULL, /* __mod__ */
- (binaryfunc) NULL, /* __divmod__ */
- (ternaryfunc) NULL, /* __pow__ */
- (unaryfunc) Vector_neg, /* __neg__ */
- (unaryfunc) NULL, /* __pos__ */
- (unaryfunc) NULL, /* __abs__ */
- (inquiry) NULL, /* __nonzero__ */
- (unaryfunc) NULL, /* __invert__ */
- (binaryfunc) NULL, /* __lshift__ */
- (binaryfunc) NULL, /* __rshift__ */
- (binaryfunc) NULL, /* __and__ */
- (binaryfunc) NULL, /* __xor__ */
- (binaryfunc) NULL, /* __or__ */
- (coercion) Vector_coerce, /* __coerce__ */
- (unaryfunc) NULL, /* __int__ */
- (unaryfunc) NULL, /* __long__ */
- (unaryfunc) NULL, /* __float__ */
- (unaryfunc) NULL, /* __oct__ */
- (unaryfunc) NULL, /* __hex__ */
-
- /* Added in release 2.0 */
- (binaryfunc) Vector_iadd, /*__iadd__*/
- (binaryfunc) Vector_isub, /*__isub__*/
- (binaryfunc) Vector_imul, /*__imul__*/
- (binaryfunc) Vector_idiv, /*__idiv__*/
- (binaryfunc) NULL, /*__imod__*/
- (ternaryfunc) NULL, /*__ipow__*/
- (binaryfunc) NULL, /*__ilshift__*/
- (binaryfunc) NULL, /*__irshift__*/
- (binaryfunc) NULL, /*__iand__*/
- (binaryfunc) NULL, /*__ixor__*/
- (binaryfunc) NULL, /*__ior__*/
-
- /* Added in release 2.2 */
- /* The following require the Py_TPFLAGS_HAVE_CLASS flag */
- (binaryfunc) NULL, /*__floordiv__ __rfloordiv__*/
- (binaryfunc) NULL, /*__truediv__ __rfloordiv__*/
- (binaryfunc) NULL, /*__ifloordiv__*/
- (binaryfunc) NULL, /*__itruediv__*/
-};
-/*------------------PY_OBECT DEFINITION--------------------------*/
-
-/*
- * vector axis, vector.x/y/z/w
- */
-
-static PyObject *Vector_getAxis( VectorObject * self, void *type )
-{
- switch( (long)type ) {
- case 'X': /* these are backwards, but that how it works */
- return PyFloat_FromDouble(self->vec[0]);
- case 'Y':
- return PyFloat_FromDouble(self->vec[1]);
- case 'Z': /* these are backwards, but that how it works */
- if(self->size < 3)
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "vector.z: error, cannot get this axis for a 2D vector\n");
- else
- return PyFloat_FromDouble(self->vec[2]);
- case 'W':
- if(self->size < 4)
- return EXPP_ReturnPyObjError(PyExc_AttributeError,
- "vector.w: error, cannot get this axis for a 3D vector\n");
-
- return PyFloat_FromDouble(self->vec[3]);
- default:
- {
- char errstr[1024];
- sprintf( errstr, "undefined type '%d' in Vector_getAxis",
- (int)((long)type & 0xff));
- return EXPP_ReturnPyObjError( PyExc_RuntimeError, errstr );
- }
- }
-}
-
-static int Vector_setAxis( VectorObject * self, PyObject * value, void * type )
-{
- float param;
-
- if (!PyNumber_Check(value))
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a number for the vector axis" );
-
- param= (float)PyFloat_AsDouble( value );
-
- switch( (long)type ) {
- case 'X': /* these are backwards, but that how it works */
- self->vec[0]= param;
- break;
- case 'Y':
- self->vec[1]= param;
- break;
- case 'Z': /* these are backwards, but that how it works */
- if(self->size < 3)
- return EXPP_ReturnIntError(PyExc_AttributeError,
- "vector.z: error, cannot get this axis for a 2D vector\n");
- self->vec[2]= param;
- break;
- case 'W':
- if(self->size < 4)
- return EXPP_ReturnIntError(PyExc_AttributeError,
- "vector.w: error, cannot get this axis for a 3D vector\n");
-
- self->vec[3]= param;
- break;
- default:
- {
- char errstr[1024];
- sprintf( errstr, "undefined type '%d' in Vector_setAxis",
- (int)((long)type & 0xff));
- return EXPP_ReturnIntError( PyExc_RuntimeError, errstr );
- }
- }
-
- return 0;
-}
-
-/* vector.length */
-static PyObject *Vector_getLength( VectorObject * self, void *type )
-{
- double dot = 0.0f;
- int i;
-
- for(i = 0; i < self->size; i++){
- dot += (self->vec[i] * self->vec[i]);
- }
- return PyFloat_FromDouble(sqrt(dot));
-}
-
-static int Vector_setLength( VectorObject * self, PyObject * value )
-{
- double dot = 0.0f, param;
- int i;
-
- if (!PyNumber_Check(value))
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected a number for the vector axis" );
-
- param= PyFloat_AsDouble( value );
-
- if (param < 0)
- return EXPP_ReturnIntError( PyExc_TypeError,
- "cannot set a vectors length to a negative value" );
-
- if (param==0) {
- for(i = 0; i < self->size; i++){
- self->vec[i]= 0;
- }
- return 0;
- }
-
- for(i = 0; i < self->size; i++){
- dot += (self->vec[i] * self->vec[i]);
- }
-
- if (!dot) /* cant sqrt zero */
- return 0;
-
- dot = sqrt(dot);
-
- if (dot==param)
- return 0;
-
- dot= dot/param;
-
- for(i = 0; i < self->size; i++){
- self->vec[i]= self->vec[i] / (float)dot;
- }
-
- return 0;
-}
-
-static PyObject *Vector_getWrapped( VectorObject * self, void *type )
-{
- if (self->wrapped == Py_WRAP)
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
-}
-
-
-/*****************************************************************************/
-/* Python attributes get/set structure: */
-/*****************************************************************************/
-static PyGetSetDef Vector_getseters[] = {
- {"x",
- (getter)Vector_getAxis, (setter)Vector_setAxis,
- "Vector X axis",
- (void *)'X'},
- {"y",
- (getter)Vector_getAxis, (setter)Vector_setAxis,
- "Vector Y axis",
- (void *)'Y'},
- {"z",
- (getter)Vector_getAxis, (setter)Vector_setAxis,
- "Vector Z axis",
- (void *)'Z'},
- {"w",
- (getter)Vector_getAxis, (setter)Vector_setAxis,
- "Vector Z axis",
- (void *)'W'},
- {"length",
- (getter)Vector_getLength, (setter)Vector_setLength,
- "Vector Length",
- NULL},
- {"magnitude",
- (getter)Vector_getLength, (setter)Vector_setLength,
- "Vector Length",
- NULL},
- {"wrapped",
- (getter)Vector_getWrapped, (setter)NULL,
- "Vector Length",
- NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-
-
-
-/* Note
- Py_TPFLAGS_CHECKTYPES allows us to avoid casting all types to Vector when coercing
- but this means for eg that
- vec*mat and mat*vec both get sent to Vector_mul and it neesd to sort out the order
-*/
-
-PyTypeObject vector_Type = {
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
- /* For printing, in format "<module>.<name>" */
- "Blender Vector", /* char *tp_name; */
- sizeof( VectorObject ), /* int tp_basicsize; */
- 0, /* tp_itemsize; For allocation */
-
- /* Methods to implement standard operations */
-
- ( destructor ) Vector_dealloc,/* destructor tp_dealloc; */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- NULL, /* cmpfunc tp_compare; */
- ( reprfunc ) Vector_repr, /* reprfunc tp_repr; */
-
- /* Method suites for standard classes */
-
- &Vector_NumMethods, /* PyNumberMethods *tp_as_number; */
- &Vector_SeqMethods, /* 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; */
- 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_CHECKTYPES, /* long tp_flags; */
-
- VectorObject_doc, /* 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 ***/
- (richcmpfunc)Vector_richcmpr, /* 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 ***/
- Vector_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- Vector_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* 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
-};
-
-
-/*------------------------newVectorObject (internal)-------------
- creates a new vector object
- pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER
- (i.e. it was allocated elsewhere by MEM_mallocN())
- pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON
- (i.e. it must be created here with PyMEM_malloc())*/
-PyObject *newVectorObject(float *vec, int size, int type)
-{
- int i;
- VectorObject *self = PyObject_NEW(VectorObject, &vector_Type);
-
- if(size > 4 || size < 2)
- return NULL;
- self->size = size;
-
- if(type == Py_WRAP) {
- self->vec = vec;
- self->wrapped = Py_WRAP;
- } else if (type == Py_NEW) {
- self->vec = PyMem_Malloc(size * sizeof(float));
- if(!vec) { /*new empty*/
- for(i = 0; i < size; i++){
- self->vec[i] = 0.0f;
- }
- if(size == 4) /* do the homogenous thing */
- self->vec[3] = 1.0f;
- }else{
- for(i = 0; i < size; i++){
- self->vec[i] = vec[i];
- }
- }
- self->wrapped = Py_NEW;
- }else{ /*bad type*/
- return NULL;
- }
- return (PyObject *) self;
-}
-
-/*
- #############################DEPRECATED################################
- #######################################################################
- ----------------------------Vector.negate() --------------------
- set the vector to it's negative -x, -y, -z */
-PyObject *Vector_Negate(VectorObject * self)
-{
- int i;
- for(i = 0; i < self->size; i++) {
- self->vec[i] = -(self->vec[i]);
- }
- /*printf("Vector.negate(): Deprecated: use -vector instead\n");*/
- return EXPP_incr_ret((PyObject*)self);
-}
-/*###################################################################
- ###########################DEPRECATED##############################*/
-
diff --git a/source/blender/python/api2_2x/windowTheme.c b/source/blender/python/api2_2x/windowTheme.c
deleted file mode 100644
index 98894c9a0ec..00000000000
--- a/source/blender/python/api2_2x/windowTheme.c
+++ /dev/null
@@ -1,828 +0,0 @@
-/*
- * $Id: windowTheme.c 12139 2007-09-25 03:31:12Z campbellbarton $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#include "windowTheme.h" /*This must come first*/
-
-#include "BLI_blenlib.h"
-#include "BIF_interface_icons.h"
-#include "BIF_resources.h"
-#include "MEM_guardedalloc.h"
-#include "charRGBA.h"
-#include "gen_utils.h"
-
-
-#define EXPP_THEME_VTX_SIZE_MIN 1
-#define EXPP_THEME_VTX_SIZE_MAX 10
-#define EXPP_THEME_FDOT_SIZE_MIN 1
-#define EXPP_THEME_FDOT_SIZE_MAX 10
-#define EXPP_THEME_DRAWTYPE_MIN 1
-#define EXPP_THEME_DRAWTYPE_MAX 4
-
-#define EXPP_THEME_NUMBEROFTHEMES 16
-static const EXPP_map_pair themes_map[] = {
- {"ui", -1},
- {"buts", SPACE_BUTS},
- {"view3d", SPACE_VIEW3D},
- {"file", SPACE_FILE},
- {"ipo", SPACE_IPO},
- {"info", SPACE_INFO},
- {"sound", SPACE_SOUND},
- {"action", SPACE_ACTION},
- {"nla", SPACE_NLA},
- {"seq", SPACE_SEQ},
- {"image", SPACE_IMAGE},
- {"imasel", SPACE_IMASEL},
- {"text", SPACE_TEXT},
- {"oops", SPACE_OOPS},
- {"time", SPACE_TIME},
- {"node", SPACE_NODE},
- {NULL, 0}
-};
-
-static PyObject *M_Theme_New( PyObject * self, PyObject * args );
-static PyObject *M_Theme_Get( PyObject * self, PyObject * args );
-
-static char M_Theme_doc[] = "The Blender Theme module\n\n\
-This module provides access to UI Theme data in Blender";
-
-static char M_Theme_New_doc[] = "Theme.New (name = 'New Theme',\
-theme = <default>):\n\
- Return a new Theme Data object.\n\
-(name) - string: the Theme's name, it defaults to 'New Theme';\n\
-(theme) - bpy Theme: a base Theme to copy all data from, it defaults to the\n\
-current one.";
-
-static char M_Theme_Get_doc[] = "Theme.Get (name = None):\n\
- Return the theme data with the given 'name', None if not found, or\n\
- Return a list with all Theme Data objects if no argument was given.";
-
-/*****************************************************************************/
-/* Python method structure definition for Blender.Theme module: */
-/*****************************************************************************/
-struct PyMethodDef M_Theme_methods[] = {
- {"New", M_Theme_New, METH_VARARGS, M_Theme_New_doc},
- {"Get", M_Theme_Get, METH_VARARGS, M_Theme_Get_doc},
- {NULL, NULL, 0, NULL}
-};
-
-static void ThemeSpace_dealloc( BPy_ThemeSpace * self );
-static int ThemeSpace_compare( BPy_ThemeSpace * a, BPy_ThemeSpace * b );
-static PyObject *ThemeSpace_repr( BPy_ThemeSpace * self );
-static PyObject *ThemeSpace_getAttr( BPy_ThemeSpace * self, char *name );
-static int ThemeSpace_setAttr( BPy_ThemeSpace * self, char *name,
- PyObject * val );
-
-static PyMethodDef BPy_ThemeSpace_methods[] = {
- {NULL, NULL, 0, NULL}
-};
-
-PyTypeObject ThemeSpace_Type = {
- PyObject_HEAD_INIT( NULL ) 0, /* ob_size */
- "Blender Space Theme", /* tp_name */
- sizeof( BPy_ThemeSpace ), /* tp_basicsize */
- 0, /* tp_itemsize */
- /* methods */
- ( destructor ) ThemeSpace_dealloc, /* tp_dealloc */
- 0, /* tp_print */
- ( getattrfunc ) ThemeSpace_getAttr, /* tp_getattr */
- ( setattrfunc ) ThemeSpace_setAttr, /* tp_setattr */
- ( cmpfunc ) ThemeSpace_compare, /* tp_compare */
- ( reprfunc ) ThemeSpace_repr, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_as_hash */
- 0, 0, 0, 0, 0, 0,
- 0, /* tp_doc */
- 0, 0, 0, 0, 0, 0,
- 0, //BPy_ThemeSpace_methods, /* tp_methods */
- 0, /* tp_members */
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-};
-
-static void ThemeSpace_dealloc( BPy_ThemeSpace * self )
-{
- PyObject_DEL( self );
-}
-
-#define ELSEIF_TSP_RGBA(attr)\
- else if (!strcmp(name, #attr))\
- attrib = charRGBA_New(&tsp->attr[0]);
-
-/* Example: ELSEIF_TSP_RGBA(back) becomes:
- * else if (!strcmp(name, "back")
- * attrib = charRGBA_New(&tsp->back[0])
- */
-
-static PyObject *ThemeSpace_getAttr( BPy_ThemeSpace * self, char *name )
-{
- PyObject *attrib = Py_None;
- ThemeSpace *tsp = self->tsp;
-
- if( !strcmp( name, "theme" ) )
- attrib = PyString_FromString( self->theme->name );
- ELSEIF_TSP_RGBA( back )
- ELSEIF_TSP_RGBA( text )
- ELSEIF_TSP_RGBA( text_hi )
- ELSEIF_TSP_RGBA( header )
- ELSEIF_TSP_RGBA( panel )
- ELSEIF_TSP_RGBA( shade1 )
- ELSEIF_TSP_RGBA( shade2 )
- ELSEIF_TSP_RGBA( hilite )
- ELSEIF_TSP_RGBA( grid )
- ELSEIF_TSP_RGBA( wire )
- ELSEIF_TSP_RGBA( select )
- ELSEIF_TSP_RGBA( lamp )
- ELSEIF_TSP_RGBA( active )
- ELSEIF_TSP_RGBA( group )
- ELSEIF_TSP_RGBA( group_active )
- ELSEIF_TSP_RGBA( transform )
- ELSEIF_TSP_RGBA( vertex )
- ELSEIF_TSP_RGBA( vertex_select )
- ELSEIF_TSP_RGBA( edge )
- ELSEIF_TSP_RGBA( edge_select )
- ELSEIF_TSP_RGBA( edge_seam )
- ELSEIF_TSP_RGBA( edge_sharp )
- ELSEIF_TSP_RGBA( editmesh_active )
- ELSEIF_TSP_RGBA( edge_facesel )
- ELSEIF_TSP_RGBA( face )
- ELSEIF_TSP_RGBA( face_select )
- ELSEIF_TSP_RGBA( face_dot )
- ELSEIF_TSP_RGBA( normal )
- ELSEIF_TSP_RGBA( bone_solid )
- ELSEIF_TSP_RGBA( bone_pose )
- ELSEIF_TSP_RGBA( strip )
- ELSEIF_TSP_RGBA( strip_select )
- ELSEIF_TSP_RGBA( syntaxl )
- ELSEIF_TSP_RGBA( syntaxn )
- ELSEIF_TSP_RGBA( syntaxb )
- ELSEIF_TSP_RGBA( syntaxv )
- ELSEIF_TSP_RGBA( syntaxc )
- ELSEIF_TSP_RGBA( movie )
- ELSEIF_TSP_RGBA( image )
- ELSEIF_TSP_RGBA( scene )
- ELSEIF_TSP_RGBA( audio )
- ELSEIF_TSP_RGBA( effect )
- ELSEIF_TSP_RGBA( plugin )
- ELSEIF_TSP_RGBA( transition )
- ELSEIF_TSP_RGBA( meta )
- else if( !strcmp( name, "vertex_size" ) )
- attrib = Py_BuildValue( "i", tsp->vertex_size );
- else if( !strcmp( name, "facedot_size" ) )
- attrib = Py_BuildValue( "i", tsp->facedot_size );
- else if( !strcmp( name, "__members__" ) )
- attrib = Py_BuildValue("[ssssssssssssssssssssssssssssssssssssssssssssssss]", "theme",
- "back", "text", "text_hi", "header",
- "panel", "shade1", "shade2", "hilite",
- "grid", "wire", "select", "lamp", "active",
- "group", "group_active",
- "transform", "vertex", "vertex_select",
- "edge", "edge_select", "edge_seam", "edge_sharp", "editmesh_active",
- "edge_facesel", "face", "face_select",
- "face_dot", "normal", "bone_solid", "bone_pose",
- "strip", "strip_select",
- "syntaxl", "syntaxn", "syntaxb", "syntaxv", "syntaxc",
- "movie", "image", "scene", "audio", "effect", "plugin",
- "transition", "meta",
- "vertex_size", "facedot_size" );
-
- if( attrib != Py_None )
- return attrib;
-
- return Py_FindMethod( BPy_ThemeSpace_methods, ( PyObject * ) self,
- name );
-}
-
-static int ThemeSpace_setAttr( BPy_ThemeSpace * self, char *name,
- PyObject * value )
-{
- PyObject *attrib = NULL;
- ThemeSpace *tsp = self->tsp;
- int ret = -1;
-
- if( !strcmp( name, "back" ) )
- attrib = charRGBA_New( &tsp->back[0] );
- ELSEIF_TSP_RGBA( text )
- ELSEIF_TSP_RGBA( text_hi )
- ELSEIF_TSP_RGBA( header )
- ELSEIF_TSP_RGBA( panel )
- ELSEIF_TSP_RGBA( shade1 )
- ELSEIF_TSP_RGBA( shade2 )
- ELSEIF_TSP_RGBA( hilite )
- ELSEIF_TSP_RGBA( grid )
- ELSEIF_TSP_RGBA( wire )
- ELSEIF_TSP_RGBA( select )
- ELSEIF_TSP_RGBA( lamp )
- ELSEIF_TSP_RGBA( active )
- ELSEIF_TSP_RGBA( group )
- ELSEIF_TSP_RGBA( group_active )
- ELSEIF_TSP_RGBA( transform )
- ELSEIF_TSP_RGBA( vertex )
- ELSEIF_TSP_RGBA( vertex_select )
- ELSEIF_TSP_RGBA( edge )
- ELSEIF_TSP_RGBA( edge_select )
- ELSEIF_TSP_RGBA( edge_seam )
- ELSEIF_TSP_RGBA( edge_sharp )
- ELSEIF_TSP_RGBA( edge_facesel )
- ELSEIF_TSP_RGBA( face )
- ELSEIF_TSP_RGBA( face_select )
- ELSEIF_TSP_RGBA( face_dot )
- ELSEIF_TSP_RGBA( normal )
- ELSEIF_TSP_RGBA( bone_solid )
- ELSEIF_TSP_RGBA( bone_pose )
- ELSEIF_TSP_RGBA( strip )
- ELSEIF_TSP_RGBA( strip_select )
- ELSEIF_TSP_RGBA( syntaxl )
- ELSEIF_TSP_RGBA( syntaxn )
- ELSEIF_TSP_RGBA( syntaxb )
- ELSEIF_TSP_RGBA( syntaxv )
- ELSEIF_TSP_RGBA( syntaxc )
- ELSEIF_TSP_RGBA( movie )
- ELSEIF_TSP_RGBA( image )
- ELSEIF_TSP_RGBA( scene )
- ELSEIF_TSP_RGBA( audio )
- ELSEIF_TSP_RGBA( effect )
- ELSEIF_TSP_RGBA( plugin )
- ELSEIF_TSP_RGBA( transition )
- ELSEIF_TSP_RGBA( meta )
- else if( !strcmp( name, "vertex_size" ) ) {
- int val;
-
- if( !PyInt_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected integer value" );
-
- val = ( int ) PyInt_AsLong( value );
- tsp->vertex_size = (char)EXPP_ClampInt( val,
- EXPP_THEME_VTX_SIZE_MIN,
- EXPP_THEME_VTX_SIZE_MAX );
- ret = 0;
- }
- else if( !strcmp( name, "facedot_size" ) ) {
- int val;
-
- if( !PyInt_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected integer value" );
-
- val = ( int ) PyInt_AsLong( value );
- tsp->vertex_size = (char)EXPP_ClampInt( val,
- EXPP_THEME_FDOT_SIZE_MIN,
- EXPP_THEME_FDOT_SIZE_MAX );
- ret = 0;
- } else
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "attribute not found" );
-
- if( attrib ) {
- PyObject *pyret = NULL;
- PyObject *valtuple = Py_BuildValue( "(O)", value );
-
- if( !valtuple )
- return EXPP_ReturnIntError( PyExc_MemoryError,
- "couldn't create tuple!" );
-
- pyret = charRGBA_setCol( ( BPy_charRGBA * ) attrib, valtuple );
- Py_DECREF( valtuple );
-
- if( pyret == Py_None ) {
- Py_DECREF( Py_None ); /* was increfed by charRGBA_setCol */
- ret = 0;
- }
-
- Py_DECREF( attrib ); /* we're done with it */
- }
-
- return ret; /* 0 if all went well */
-}
-
-static int ThemeSpace_compare( BPy_ThemeSpace * a, BPy_ThemeSpace * b )
-{
- ThemeSpace *pa = a->tsp, *pb = b->tsp;
- return ( pa == pb ) ? 0 : -1;
-}
-
-static PyObject *ThemeSpace_repr( BPy_ThemeSpace * self )
-{
- return PyString_FromFormat( "[Space theme from theme \"%s\"]",
- self->theme->name );
-}
-
-static void ThemeUI_dealloc( BPy_ThemeUI * self );
-static int ThemeUI_compare( BPy_ThemeUI * a, BPy_ThemeUI * b );
-static PyObject *ThemeUI_repr( BPy_ThemeUI * self );
-static PyObject *ThemeUI_getAttr( BPy_ThemeUI * self, char *name );
-static int ThemeUI_setAttr( BPy_ThemeUI * self, char *name, PyObject * val );
-
-static PyMethodDef BPy_ThemeUI_methods[] = {
- {NULL, NULL, 0, NULL}
-};
-
-PyTypeObject ThemeUI_Type = {
- PyObject_HEAD_INIT( NULL ) 0, /* ob_size */
- "Blender UI Theme", /* tp_name */
- sizeof( BPy_ThemeUI ), /* tp_basicsize */
- 0, /* tp_itemsize */
- /* methods */
- ( destructor ) ThemeUI_dealloc, /* tp_dealloc */
- 0, /* tp_print */
- ( getattrfunc ) ThemeUI_getAttr, /* tp_getattr */
- ( setattrfunc ) ThemeUI_setAttr, /* tp_setattr */
- ( cmpfunc ) ThemeUI_compare, /* tp_compare */
- ( reprfunc ) ThemeUI_repr, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_as_hash */
- 0, 0, 0, 0, 0, 0,
- 0, /* tp_doc */
- 0, 0, 0, 0, 0, 0,
- 0, //BPy_ThemeUI_methods, /* tp_methods */
- 0, /* tp_members */
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-};
-
-static void ThemeUI_dealloc( BPy_ThemeUI * self )
-{
- PyObject_DEL( self );
-}
-
-#define ELSEIF_TUI_RGBA(attr)\
- else if (!strcmp(name, #attr))\
- attrib = charRGBA_New(&tui->attr[0]);
-
-/* Example: ELSEIF_TUI_RGBA(outline) becomes:
- * else if (!strcmp(name, "outline")
- * attr = charRGBA_New(&tui->outline[0])
- */
-
-static PyObject *ThemeUI_getAttr( BPy_ThemeUI * self, char *name )
-{
- PyObject *attrib = Py_None;
- ThemeUI *tui = self->tui;
-
- if( !strcmp( name, "theme" ) )
- attrib = PyString_FromString( self->theme->name );
- ELSEIF_TUI_RGBA( outline )
- ELSEIF_TUI_RGBA( neutral )
- ELSEIF_TUI_RGBA( action )
- ELSEIF_TUI_RGBA( setting )
- ELSEIF_TUI_RGBA( setting1 )
- ELSEIF_TUI_RGBA( setting2 )
- ELSEIF_TUI_RGBA( num )
- ELSEIF_TUI_RGBA( textfield )
- ELSEIF_TUI_RGBA( textfield_hi )
- ELSEIF_TUI_RGBA( popup )
- ELSEIF_TUI_RGBA( text )
- ELSEIF_TUI_RGBA( text_hi )
- ELSEIF_TUI_RGBA( menu_back )
- ELSEIF_TUI_RGBA( menu_item )
- ELSEIF_TUI_RGBA( menu_hilite )
- ELSEIF_TUI_RGBA( menu_text )
- ELSEIF_TUI_RGBA( menu_text_hi )
- else if( !strcmp( name, "drawType" ) )
- attrib = PyInt_FromLong( ( char ) tui->but_drawtype );
- else if( !strcmp( name, "iconTheme" ) )
- attrib = PyString_FromString( tui->iconfile );
- else if( !strcmp( name, "__members__" ) )
- attrib = Py_BuildValue( "[ssssssssssssssssssss]", "theme",
- "outline", "neutral", "action",
- "setting", "setting1", "setting2",
- "num", "textfield", "textfield_hi", "popup", "text",
- "text_hi", "menu_back", "menu_item",
- "menu_hilite", "menu_text",
- "menu_text_hi", "drawType", "iconTheme" );
-
- if( attrib != Py_None )
- return attrib;
-
- return Py_FindMethod( BPy_ThemeUI_methods, ( PyObject * ) self, name );
-}
-
-static int ThemeUI_setAttr( BPy_ThemeUI * self, char *name, PyObject * value )
-{
- PyObject *attrib = NULL;
- ThemeUI *tui = self->tui;
- int ret = -1;
-
- if( !strcmp( name, "outline" ) )
- attrib = charRGBA_New( &tui->outline[0] );
- ELSEIF_TUI_RGBA( neutral )
- ELSEIF_TUI_RGBA( action )
- ELSEIF_TUI_RGBA( setting )
- ELSEIF_TUI_RGBA( setting1 )
- ELSEIF_TUI_RGBA( setting2 )
- ELSEIF_TUI_RGBA( num )
- ELSEIF_TUI_RGBA( textfield )
- ELSEIF_TUI_RGBA( textfield_hi )
- ELSEIF_TUI_RGBA( popup )
- ELSEIF_TUI_RGBA( text )
- ELSEIF_TUI_RGBA( text_hi )
- ELSEIF_TUI_RGBA( menu_back )
- ELSEIF_TUI_RGBA( menu_item )
- ELSEIF_TUI_RGBA( menu_hilite )
- ELSEIF_TUI_RGBA( menu_text )
- ELSEIF_TUI_RGBA( menu_text_hi )
- else if( !strcmp( name, "drawType" ) ) {
- int val;
-
- if( !PyInt_Check( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected integer value" );
-
- val = ( int ) PyInt_AsLong( value );
- tui->but_drawtype = (char)EXPP_ClampInt( val,
- EXPP_THEME_DRAWTYPE_MIN,
- EXPP_THEME_DRAWTYPE_MAX );
- ret = 0;
- } else if ( !strcmp( name, "iconTheme" ) ) {
- if ( !PyString_Check(value) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected string value" );
- BLI_strncpy(tui->iconfile, PyString_AsString(value), 80);
-
- BIF_icons_free();
- BIF_icons_init(BIFICONID_LAST+1);
-
- ret = 0;
- } else
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "attribute not found" );
-
- if( attrib ) {
- PyObject *pyret = NULL;
- PyObject *valtuple = Py_BuildValue( "(O)", value );
-
- if( !valtuple )
- return EXPP_ReturnIntError( PyExc_MemoryError,
- "couldn't create tuple!" );
-
- pyret = charRGBA_setCol( ( BPy_charRGBA * ) attrib, valtuple );
- Py_DECREF( valtuple );
-
- if( pyret == Py_None ) {
- Py_DECREF( Py_None ); /* was increfed by charRGBA_setCol */
- ret = 0;
- }
-
- Py_DECREF( attrib ); /* we're done with it */
- }
-
- return ret; /* 0 if all went well */
-}
-
-
-static int ThemeUI_compare( BPy_ThemeUI * a, BPy_ThemeUI * b )
-{
- ThemeUI *pa = a->tui, *pb = b->tui;
- return ( pa == pb ) ? 0 : -1;
-}
-
-static PyObject *ThemeUI_repr( BPy_ThemeUI * self )
-{
- return PyString_FromFormat( "[UI theme from theme \"%s\"]",
- self->theme->name );
-}
-
-static void Theme_dealloc( BPy_Theme * self );
-static int Theme_compare( BPy_Theme * a, BPy_Theme * b );
-static PyObject *Theme_getAttr( BPy_Theme * self, char *name );
-static PyObject *Theme_repr( BPy_Theme * self );
-
-static PyObject *Theme_get( BPy_Theme * self, PyObject * args );
-static PyObject *Theme_getName( BPy_Theme * self );
-static PyObject *Theme_setName( BPy_Theme * self, PyObject * value );
-
-static PyMethodDef BPy_Theme_methods[] = {
- {"get", ( PyCFunction ) Theme_get, METH_VARARGS,
- "(param) - Return UI or Space theme object.\n\
-(param) - the chosen theme object as an int or a string:\n\
-- () - default: UI;\n\
-- (i) - int: an entry from the Blender.Window.Types dictionary;\n\
-- (s) - string: 'UI' or a space name, like 'VIEW3D', etc."},
- {"getName", ( PyCFunction ) Theme_getName, METH_NOARGS,
- "() - Return Theme name"},
- {"setName", ( PyCFunction ) Theme_setName, METH_O,
- "(s) - Set Theme name"},
- {NULL, NULL, 0, NULL}
-};
-
-PyTypeObject Theme_Type = {
- PyObject_HEAD_INIT( NULL )
- 0, /* ob_size */
- "Blender Theme", /* tp_name */
- sizeof( BPy_Theme ), /* tp_basicsize */
- 0, /* tp_itemsize */
- /* methods */
- ( destructor ) Theme_dealloc, /* tp_dealloc */
- 0, /* tp_print */
- ( getattrfunc ) Theme_getAttr, /* tp_getattr */
- 0, //(setattrfunc) Theme_setAttr, /* tp_setattr */
- ( cmpfunc ) Theme_compare, /* tp_compare */
- ( reprfunc ) Theme_repr, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_as_hash */
- 0, 0, 0, 0, 0, 0,
- 0, /* tp_doc */
- 0, 0, 0, 0, 0, 0,
- 0, /*BPy_Theme_methods,*/ /* tp_methods */
- 0, /* tp_members */
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-};
-
-static PyObject *M_Theme_New( PyObject * self, PyObject * args )
-{
- char *name = "New Theme";
- BPy_Theme *pytheme = NULL, *base_pytheme = NULL;
- bTheme *btheme = NULL, *newtheme = NULL;
-
- if( !PyArg_ParseTuple
- ( args, "|sO!", &name, &Theme_Type, &base_pytheme ) )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected nothing or a name and optional theme object as arguments" );
-
- if( base_pytheme )
- btheme = base_pytheme->theme;
- if( !btheme )
- btheme = U.themes.first;
-
- newtheme = MEM_callocN( sizeof( bTheme ), "theme" );
-
- if( newtheme )
- pytheme = PyObject_New( BPy_Theme, &Theme_Type );
- if( !pytheme )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't create Theme Data in Blender" );
-
- memcpy( newtheme, btheme, sizeof( bTheme ) );
- BLI_addhead( &U.themes, newtheme );
- BLI_strncpy( newtheme->name, name, 32 );
-
- pytheme->theme = newtheme;
-
- return ( PyObject * ) pytheme;
-}
-
-static PyObject *M_Theme_Get( PyObject * self, PyObject * args )
-{
- char *name = NULL;
- bTheme *iter;
- PyObject *ret;
-
- if( !PyArg_ParseTuple( args, "|s", &name ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument (or nothing)" );
-
- iter = U.themes.first;
-
- if( name ) { /* (name) - return requested theme */
- BPy_Theme *wanted = NULL;
-
- while( iter ) {
- if( strcmp( name, iter->name ) == 0 ) {
- wanted = PyObject_New( BPy_Theme,
- &Theme_Type );
- wanted->theme = iter;
- break;
- }
- iter = iter->next;
- }
-
- if( !wanted ) {
- char emsg[64];
- PyOS_snprintf( emsg, sizeof( emsg ),
- "Theme \"%s\" not found", name );
- return EXPP_ReturnPyObjError( PyExc_NameError, emsg );
- }
-
- ret = ( PyObject * ) wanted;
- }
-
- else { /* () - return list with all themes */
- int index = 0;
- PyObject *list = NULL;
- BPy_Theme *pytheme = NULL;
-
- list = PyList_New( BLI_countlist( &( U.themes ) ) );
-
- if( !list )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create PyList" );
-
- while( iter ) {
- pytheme = PyObject_New( BPy_Theme, &Theme_Type );
- pytheme->theme = iter;
-
- if( !pytheme ) {
- Py_DECREF(list);
- return EXPP_ReturnPyObjError
- ( PyExc_MemoryError,
- "couldn't create Theme PyObject" );
- }
- PyList_SET_ITEM( list, index, ( PyObject * ) pytheme );
-
- iter = iter->next;
- index++;
- }
-
- ret = list;
- }
-
- return ret;
-}
-
-static PyObject *Theme_get( BPy_Theme * self, PyObject * args )
-{
- bTheme *btheme = self->theme;
- ThemeUI *tui = NULL;
- ThemeSpace *tsp = NULL;
- PyObject *pyob = NULL;
- BPy_ThemeUI *retUI = NULL;
- BPy_ThemeSpace *retSpc = NULL;
- int type;
-
- if( !PyArg_ParseTuple( args, "|O", &pyob ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string or int argument or nothing" );
-
- if( !pyob ) { /* (): return list with all names */
- PyObject *ret = PyList_New( EXPP_THEME_NUMBEROFTHEMES );
-
- if( !ret )
- return EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create pylist!" );
-
- type = 0; /* using as a counter only */
-
- while( type < EXPP_THEME_NUMBEROFTHEMES ) {
- PyList_SET_ITEM( ret, type,
- PyString_FromString( themes_map[type].sval ) );
- type++;
- }
-
- return ret;
- }
-
- else if( PyInt_Check( pyob ) ) /* (int) */
- type = ( int ) PyInt_AsLong( pyob );
- else if( PyString_Check( pyob ) ) { /* (str) */
- char *str = PyString_AsString( pyob );
- if( !EXPP_map_case_getIntVal( themes_map, str, &type ) )
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "unknown string argument" );
- } else
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string or int argument or nothing" );
-
- switch ( type ) {
- case -1: /* UI */
- tui = &btheme->tui;
- break;
- case SPACE_BUTS:
- tsp = &btheme->tbuts;
- break;
- case SPACE_VIEW3D:
- tsp = &btheme->tv3d;
- break;
- case SPACE_FILE:
- tsp = &btheme->tfile;
- break;
- case SPACE_IPO:
- tsp = &btheme->tipo;
- break;
- case SPACE_INFO:
- tsp = &btheme->tinfo;
- break;
- case SPACE_SOUND:
- tsp = &btheme->tsnd;
- break;
- case SPACE_ACTION:
- tsp = &btheme->tact;
- break;
- case SPACE_NLA:
- tsp = &btheme->tnla;
- break;
- case SPACE_SEQ:
- tsp = &btheme->tseq;
- break;
- case SPACE_IMAGE:
- tsp = &btheme->tima;
- break;
- case SPACE_IMASEL:
- tsp = &btheme->timasel;
- break;
- case SPACE_TEXT:
- tsp = &btheme->text;
- break;
- case SPACE_OOPS:
- tsp = &btheme->toops;
- break;
- case SPACE_TIME:
- tsp = &btheme->ttime;
- break;
- case SPACE_NODE:
- tsp = &btheme->tnode;
- break;
- }
-
- if( tui ) {
- retUI = PyObject_New( BPy_ThemeUI, &ThemeUI_Type );
- retUI->theme = btheme;
- retUI->tui = tui;
- return ( PyObject * ) retUI;
- } else if( tsp ) {
- retSpc = PyObject_New( BPy_ThemeSpace, &ThemeSpace_Type );
- retSpc->theme = btheme;
- retSpc->tsp = tsp;
- return ( PyObject * ) retSpc;
- } else
- return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "invalid parameter" );
-}
-
-static PyObject *Theme_getName( BPy_Theme * self )
-{
- return PyString_FromString( self->theme->name );
-}
-
-static PyObject *Theme_setName( BPy_Theme * self, PyObject * value )
-{
- char *name = PyString_AsString(value);
-
- if( !name )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected string argument" );
-
- BLI_strncpy( self->theme->name, name, 32 );
-
- return EXPP_incr_ret( Py_None );
-}
-
-PyObject *Theme_Init( void )
-{
- PyObject *submodule;
-
- Theme_Type.ob_type = &PyType_Type;
-
- submodule = Py_InitModule3( "Blender.Window.Theme",
- M_Theme_methods, M_Theme_doc );
-
- return submodule;
-}
-
-static void Theme_dealloc( BPy_Theme * self )
-{
- PyObject_DEL( self );
-}
-
-static PyObject *Theme_getAttr( BPy_Theme * self, char *name )
-{
- if( !strcmp( name, "name" ) )
- return PyString_FromString( self->theme->name );
- else if( !strcmp( name, "__members__" ) )
- return Py_BuildValue( "[s]", "name" );
-
- return Py_FindMethod( BPy_Theme_methods, ( PyObject * ) self, name );
-}
-
-static int Theme_compare( BPy_Theme * a, BPy_Theme * b )
-{
- bTheme *pa = a->theme, *pb = b->theme;
- return ( pa == pb ) ? 0 : -1;
-}
-
-static PyObject *Theme_repr( BPy_Theme * self )
-{
- return PyString_FromFormat( "[Theme \"%s\"]", self->theme->name );
-}
diff --git a/source/blender/src/.BCkey b/source/blender/src/.BCkey
deleted file mode 100644
index a0fd5e817d4..00000000000
--- a/source/blender/src/.BCkey
+++ /dev/null
@@ -1 +0,0 @@
-0xffffffff 0xfffffff0 fffffffe
diff --git a/source/blender/src/CMakeLists.txt b/source/blender/src/CMakeLists.txt
deleted file mode 100644
index 176ec036ada..00000000000
--- a/source/blender/src/CMakeLists.txt
+++ /dev/null
@@ -1,85 +0,0 @@
-# $Id$
-# ***** BEGIN GPL/BL DUAL 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. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# The Original Code is Copyright (C) 2006, Blender Foundation
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jacques Beaurain.
-#
-# ***** END GPL/BL DUAL LICENSE BLOCK *****
-
-FILE(GLOB SRC *.c)
-
-SET(INC
- ../../../intern/guardedalloc ../../../intern/memutil
- ../blenlib ../makesdna ../blenkernel
- ../include ../../../intern/bmfont ../imbuf ../render/extern/include
- ../../../intern/bsp/extern ../radiosity/extern/include
- ../../../intern/decimation/extern ../blenloader ../python
- ../../kernel/gen_system ../../../intern/SoundSystem ../readstreamglue
- ../quicktime ../../../intern/elbeem/extern
- ../../../intern/ghost ../../../intern/opennl/extern
- ../nodes
- ${PYTHON_INC}
- ${SDL_INC}
-)
-
-IF(WITH_INTERNATIONAL)
- SET(INC ${INC} ../ftfont)
- ADD_DEFINITIONS(-DINTERNATIONAL)
- ADD_DEFINITIONS(-DFTGL_STATIC_LIBRARY)
-ENDIF(WITH_INTERNATIONAL)
-
-IF(WITH_OPENEXR)
- ADD_DEFINITIONS(-DWITH_OPENEXR)
-ENDIF(WITH_OPENEXR)
-
-IF(WITH_QUICKTIME)
- SET(INC ${INC} ${QUICKTIME_INC})
- ADD_DEFINITIONS(-DWITH_QUICKTIME)
-ENDIF(WITH_QUICKTIME)
-
-IF(WITH_FFMPEG)
- SET(INC ${INC} ${FFMPEG_INC})
- ADD_DEFINITIONS(-DWITH_FFMPEG)
-ENDIF(WITH_FFMPEG)
-
-IF(WIN32)
- SET(INC ${INC} ${PTHREADS_INC})
-ENDIF(WIN32)
-
-IF(WITH_VERSE)
- SET(INC ${INC} ${VERSE_INC})
- ADD_DEFINITIONS(-DWITH_VERSE)
-ENDIF(WITH_VERSE)
-
-# TODO buildinfo
-IF(BF_BUILDINFO)
- ADD_DEFINITIONS(-DNAN_BUILDINFO)
-ENDIF(BF_BUILDINFO)
-
-BLENDERLIB_NOLIST(src "${SRC}" "${INC}")
-
-IF(WITH_VERSE)
- ADD_DEPENDENCIES(src mkprot verse)
-ENDIF(WITH_VERSE)
-
diff --git a/source/blender/src/Makefile b/source/blender/src/Makefile
deleted file mode 100644
index 5038c294bc6..00000000000
--- a/source/blender/src/Makefile
+++ /dev/null
@@ -1,149 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL/BL DUAL 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. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): none yet.
-#
-# ***** END GPL/BL DUAL LICENSE BLOCK *****
-#
-#
-
-ORGLIBNAME = src
-LIBNAME ?= $(ORGLIBNAME)
-DIR ?= $(OCGDIR)/blender/$(ORGLIBNAME)
-
-CSRCS ?= $(wildcard *.c)
-PUB_CSRCS ?= $(CSRCS)
-CRE_CSRCS ?= $(CSRCS) $(wildcard cre/*.c)
-
-OBJS = $(OCGDIR)/blender/makesdna/$(DEBUG_DIR)DNA.o
-
-ALLTARGETS = publisher
-
-include nan_compile.mk
-
-# Cflags stuff ------------------------------------------
-
-CFLAGS += $(LEVEL_1_C_WARNINGS)
-#CFLAGS += $(LEVEL_1_C_WARNINGS) -diag_error 1196
-
-# PreProcessor stuff ------------------------------------------
-
-CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION)
-CPPFLAGS += -I$(NAN_GHOST)/include
-CPPFLAGS += -I$(NAN_BMFONT)/include
-CPPFLAGS += -I$(NAN_ELBEEM)/include
-CPPFLAGS += -I$(NAN_SOUNDSYSTEM)/include $(NAN_SDLCFLAGS)
-
-# External interfaces of modules:
-CPPFLAGS += -I../render/extern/include
-CPPFLAGS += -I../blenkernel
-CPPFLAGS += -I../blenlib
-CPPFLAGS += -I../nodes
-CPPFLAGS += -I../python
-CPPFLAGS += -I../makesdna
-CPPFLAGS += -I../imbuf
-CPPFLAGS += -I../blenloader
-CPPFLAGS += -I..
-CPPFLAGS += -I../../kernel/gen_system
-CPPFLAGS += -I../../gameengine/SoundSystem
-CPPFLAGS += -I../ftfont
-
-# Only used by py_demo.c !!!
-CPPFLAGS += -I../radiosity/extern/include
-
-CPPFLAGS += -I$(SRCHOME)/gameengine/Physics/Sumo/include
-CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
-CPPFLAGS += -I$(NAN_MEMUTIL)/include
-
-CPPFLAGS += -I$(NAN_DECIMATION)/include
-CPPFLAGS += -I$(NAN_BSP)/include
-CPPFLAGS += -I$(NAN_OPENNL)/include
-
-CPPFLAGS += -I../readstreamglue
-CPPFLAGS += -I../include
-
-ifdef NAN_BUILDINFO
- CPPFLAGS += -DNAN_BUILDINFO
-endif
-
-ifeq ($(OS),linux)
- ifeq ($(CPU),alpha)
- CPPFLAGS += -I$(NAN_MESA)/include
- endif
- ifeq ($(CPU),i386)
- CPPFLAGS += -I$(NAN_MESA)/include
- endif
- ifeq ($(CPU),powerpc)
- CPPFLAGS += -I/usr/src/MesaCVS/include
- endif
-endif
-
-ifeq ($(WITH_QUICKTIME),true)
- CPPFLAGS += -I../quicktime
- CPPFLAGS += -DWITH_QUICKTIME
-endif
-
-ifeq ($(WITH_ICONV), true)
- CPPFLAGS += -DWITH_ICONV
- CPPFLAGS += $(NAN_ICONV_INC)
-endif
-
-ifeq ($(WITH_FFMPEG),true)
- CPPFLAGS += -DWITH_FFMPEG
- CPPFLAGS += $(NAN_FFMPEGCFLAGS)
-endif
-
-ifdef NAN_PTHREADS
- CPPFLAGS += -I$(NAN_PTHREADS)/include
-endif
-
-ifeq ($(WITH_OPENEXR),true)
- CPPFLAGS += -DWITH_OPENEXR
-endif
-
-ifeq ($(WITH_DDS),true)
- CPPFLAGS += -DWITH_DDS
-endif
-
-ifeq ($(INTERNATIONAL), true)
- CPPFLAGS += -DINTERNATIONAL
-endif
-
-ifeq ($(WITH_VERSE), true)
- CPPFLAGS += -DWITH_VERSE
- CPPFLAGS += -I$(NAN_VERSE)/include
- # print some other debug information
- ifeq ($(VERSE_DEBUG_PRINT), true)
- CPPFLAGS += -DVERSE_DEBUG_PRINT
- endif
-endif
-
-ifeq ($(NAN_TWEAK_MODE), true)
- CPPFLAGS += -DTWEAK_MODE
-endif
-
-CPPFLAGS += -I$(OPENGL_HEADERS)
diff --git a/source/blender/src/SConscript b/source/blender/src/SConscript
deleted file mode 100644
index f466798c40c..00000000000
--- a/source/blender/src/SConscript
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/usr/bin/python
-Import ('env')
-
-# TODO: src_env.Append (CCFLAGS = user_options_dict['SDL_CFLAGS'])
-
-sources = env.Glob('*.c')
-
-if env['BF_SPLIT_SRC'] == 1:
- numobj = len(sources)
- maxobj = 30
-
- numlibs = numobj / maxobj
- if (numobj % maxobj):
- numlibs = numlibs + 1
- subsources = []
-
- if (env['OURPLATFORM'] == 'win32-mingw'):
- for i in range(numlibs - 1):
- subsources.append(sources[i*maxobj:(i+1)*maxobj])
- subsources.append(sources[(numlibs-1)*maxobj:])
-
-incs = ' #/intern/guardedalloc #/intern/memutil'
-incs += ' ../blenlib ../makesdna ../blenkernel'
-incs += ' ../include #/intern/bmfont ../imbuf ../render/extern/include'
-incs += ' #/intern/bsp/extern ../radiosity/extern/include'
-incs += ' #/intern/decimation/extern ../blenloader ../python'
-incs += ' ../../kernel/gen_system #/intern/SoundSystem ../readstreamglue ../nodes'
-incs += ' ../quicktime #/intern/elbeem/extern'
-incs += ' #/intern/ghost #/intern/opennl/extern'
-
-
-incs += ' ' + env['BF_PYTHON_INC']
-incs += ' ' + env['BF_SDL_INC']
-incs += ' ' + env['BF_OPENGL_INC']
-
-defs = []
-
-if env['BF_TWEAK_MODE'] == 1:
- defs.append('TWEAK_MODE')
-
-if env['WITH_BF_YAFRAY'] == 0:
- defs.append('DISABLE_YAFRAY')
-
-if env['WITH_BF_INTERNATIONAL'] == 1:
- incs += ' ../ftfont'
- defs.append('INTERNATIONAL')
- defs.append('FTGL_STATIC_LIBRARY')
-
-if env['WITH_BF_OPENEXR'] == 1:
- defs.append('WITH_OPENEXR')
-
-if env['WITH_BF_DDS'] == 1:
- defs.append('WITH_DDS')
-
-if env['WITH_BF_QUICKTIME']==1:
- incs += ' ' + env['BF_QUICKTIME_INC']
- defs.append('WITH_QUICKTIME')
-
-if env['WITH_BF_ICONV'] == 1:
- incs += ' ' + env['BF_ICONV_INC']
- defs.append('WITH_ICONV')
-
-if env['WITH_BF_FFMPEG'] == 1:
- defs.append('WITH_FFMPEG')
- incs += ' ' + env['BF_FFMPEG_INC']
-
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw'):
- incs += ' ' + env['BF_PTHREADS_INC']
-
-if env['WITH_BF_VERSE']:
- defs.append('WITH_VERSE')
- incs += ' ' + env['BF_VERSE_INCLUDE']
-
-# TODO buildinfo
-if env['BF_BUILDINFO'] == 1:
- defs.append('NAN_BUILDINFO')
-
-if (env['BF_SPLIT_SRC'] == 1) and (env['OURPLATFORM'] == 'win32-mingw'):
- for i in range(numlibs):
- env.BlenderLib ( libname = 'src%d' % (i), sources = subsources[i], includes = Split(incs), defines = defs, libtype=['core', 'intern'], priority = [5, 25] )
-else:
- env.BlenderLib ( libname = 'src', sources = sources, includes = Split(incs), defines = defs, libtype=['core', 'intern'], priority = [5, 25] )
diff --git a/source/blender/src/booleanops.c b/source/blender/src/booleanops.c
deleted file mode 100644
index 04214beeb90..00000000000
--- a/source/blender/src/booleanops.c
+++ /dev/null
@@ -1,566 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * CSG operations.
- */
-
-#include <string.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_arithb.h"
-#include "BLI_blenlib.h"
-#include "BLI_ghash.h"
-
-#include "DNA_material_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-
-#include "CSG_BooleanOps.h"
-
-#include "BKE_booleanops.h"
-#include "BKE_cdderivedmesh.h"
-#include "BKE_customdata.h"
-#include "BKE_depsgraph.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_global.h"
-#include "BKE_library.h"
-#include "BKE_material.h"
-#include "BKE_mesh.h"
-#include "BKE_object.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_toolbox.h"
-
-#include "BDR_editface.h"
-
-#include <math.h>
-
-/**
- * Here's the vertex iterator structure used to walk through
- * the blender vertex structure.
- */
-
-typedef struct {
- Mesh *mesh;
- Object *ob;
- int pos;
-} VertexIt;
-
-/**
- * Implementations of local vertex iterator functions.
- * These describe a blender mesh to the CSG module.
- */
-
-static void VertexIt_Destruct(CSG_VertexIteratorDescriptor * iterator)
-{
- if (iterator->it) {
- // deallocate memory for iterator
- MEM_freeN(iterator->it);
- iterator->it = 0;
- }
- iterator->Done = NULL;
- iterator->Fill = NULL;
- iterator->Reset = NULL;
- iterator->Step = NULL;
- iterator->num_elements = 0;
-
-}
-
-static int VertexIt_Done(CSG_IteratorPtr it)
-{
- VertexIt * iterator = (VertexIt *)it;
- return(iterator->pos >= iterator->mesh->totvert);
-}
-
-static void VertexIt_Fill(CSG_IteratorPtr it, CSG_IVertex *vert)
-{
- VertexIt * iterator = (VertexIt *)it;
- MVert *verts = iterator->mesh->mvert;
-
- float global_pos[3];
-
- /* boolean happens in global space, transform both with obmat */
- VecMat4MulVecfl(
- global_pos,
- iterator->ob->obmat,
- verts[iterator->pos].co
- );
-
- vert->position[0] = global_pos[0];
- vert->position[1] = global_pos[1];
- vert->position[2] = global_pos[2];
-}
-
-static void VertexIt_Step(CSG_IteratorPtr it)
-{
- VertexIt * iterator = (VertexIt *)it;
- iterator->pos ++;
-}
-
-static void VertexIt_Reset(CSG_IteratorPtr it)
-{
- VertexIt * iterator = (VertexIt *)it;
- iterator->pos = 0;
-}
-
-static void VertexIt_Construct(CSG_VertexIteratorDescriptor *output, Object *ob)
-{
-
- VertexIt *it;
- if (output == 0) return;
-
- // allocate some memory for blender iterator
- it = (VertexIt *)(MEM_mallocN(sizeof(VertexIt),"Boolean_VIt"));
- if (it == 0) {
- return;
- }
- // assign blender specific variables
- it->ob = ob;
- it->mesh = ob->data;
-
- it->pos = 0;
-
- // assign iterator function pointers.
- output->Step = VertexIt_Step;
- output->Fill = VertexIt_Fill;
- output->Done = VertexIt_Done;
- output->Reset = VertexIt_Reset;
- output->num_elements = it->mesh->totvert;
- output->it = it;
-}
-
-/**
- * Blender Face iterator
- */
-
-typedef struct {
- Mesh *mesh;
- int pos;
- int offset;
-} FaceIt;
-
-static void FaceIt_Destruct(CSG_FaceIteratorDescriptor * iterator)
-{
- MEM_freeN(iterator->it);
- iterator->Done = NULL;
- iterator->Fill = NULL;
- iterator->Reset = NULL;
- iterator->Step = NULL;
- iterator->num_elements = 0;
-}
-
-static int FaceIt_Done(CSG_IteratorPtr it)
-{
- // assume CSG_IteratorPtr is of the correct type.
- FaceIt * iterator = (FaceIt *)it;
- return(iterator->pos >= iterator->mesh->totface);
-}
-
-static void FaceIt_Fill(CSG_IteratorPtr it, CSG_IFace *face)
-{
- // assume CSG_IteratorPtr is of the correct type.
- FaceIt *face_it = (FaceIt *)it;
- MFace *mfaces = face_it->mesh->mface;
- MFace *mface = &mfaces[face_it->pos];
-
- face->vertex_index[0] = mface->v1;
- face->vertex_index[1] = mface->v2;
- face->vertex_index[2] = mface->v3;
- if (mface->v4) {
- face->vertex_index[3] = mface->v4;
- face->vertex_number = 4;
- } else {
- face->vertex_number = 3;
- }
-
- face->orig_face = face_it->offset + face_it->pos;
-}
-
-static void FaceIt_Step(CSG_IteratorPtr it)
-{
- FaceIt * face_it = (FaceIt *)it;
- face_it->pos ++;
-}
-
-static void FaceIt_Reset(CSG_IteratorPtr it)
-{
- FaceIt * face_it = (FaceIt *)it;
- face_it->pos = 0;
-}
-
-static void FaceIt_Construct(
- CSG_FaceIteratorDescriptor *output, Object *ob, int offset)
-{
- FaceIt *it;
- if (output == 0) return;
-
- // allocate some memory for blender iterator
- it = (FaceIt *)(MEM_mallocN(sizeof(FaceIt),"Boolean_FIt"));
- if (it == 0) {
- return ;
- }
- // assign blender specific variables
- it->mesh = ob->data;
- it->offset = offset;
- it->pos = 0;
-
- // assign iterator function pointers.
- output->Step = FaceIt_Step;
- output->Fill = FaceIt_Fill;
- output->Done = FaceIt_Done;
- output->Reset = FaceIt_Reset;
- output->num_elements = it->mesh->totface;
- output->it = it;
-}
-
-static Object *AddNewBlenderMesh(Base *base)
-{
- // This little function adds a new mesh object to the blender object list
- // It uses ob to duplicate data as this seems to be easier than creating
- // a new one. This new oject contains no faces nor vertices.
- Mesh *old_me;
- Base *basen;
- Object *ob_new;
-
- // now create a new blender object.
- // duplicating all the settings from the previous object
- // to the new one.
- ob_new= copy_object(base->object);
-
- // Ok we don't want to use the actual data from the
- // last object, the above function incremented the
- // number of users, so decrement it here.
- old_me= ob_new->data;
- old_me->id.us--;
-
- // Now create a new base to add into the linked list of
- // vase objects.
-
- basen= MEM_mallocN(sizeof(Base), "duplibase");
- *basen= *base;
- BLI_addhead(&G.scene->base, basen); /* addhead: anders oneindige lus */
- basen->object= ob_new;
- basen->flag &= ~SELECT;
-
- // Initialize the mesh data associated with this object.
- ob_new->data= add_mesh("Mesh");
- G.totmesh++;
-
- // Finally assign the object type.
- ob_new->type= OB_MESH;
-
- return ob_new;
-}
-
-static void InterpCSGFace(
- DerivedMesh *dm, Mesh *orig_me, int index, int orig_index, int nr,
- float mapmat[][4])
-{
- float obco[3], *co[4], *orig_co[4], w[4][4];
- MFace *mface, *orig_mface;
- int j;
-
- mface = CDDM_get_face(dm, index);
- orig_mface = orig_me->mface + orig_index;
-
- // get the vertex coordinates from the original mesh
- orig_co[0] = (orig_me->mvert + orig_mface->v1)->co;
- orig_co[1] = (orig_me->mvert + orig_mface->v2)->co;
- orig_co[2] = (orig_me->mvert + orig_mface->v3)->co;
- orig_co[3] = (orig_mface->v4)? (orig_me->mvert + orig_mface->v4)->co: NULL;
-
- // get the vertex coordinates from the new derivedmesh
- co[0] = CDDM_get_vert(dm, mface->v1)->co;
- co[1] = CDDM_get_vert(dm, mface->v2)->co;
- co[2] = CDDM_get_vert(dm, mface->v3)->co;
- co[3] = (nr == 4)? CDDM_get_vert(dm, mface->v4)->co: NULL;
-
- for (j = 0; j < nr; j++) {
- // get coordinate into the space of the original mesh
- if (mapmat)
- VecMat4MulVecfl(obco, mapmat, co[j]);
- else
- VecCopyf(obco, co[j]);
-
- InterpWeightsQ3Dfl(orig_co[0], orig_co[1], orig_co[2], orig_co[3], obco, w[j]);
- }
-
- CustomData_interp(&orig_me->fdata, &dm->faceData, &orig_index, NULL, (float*)w, 1, index);
-}
-
-/* Iterate over the CSG Output Descriptors and create a new DerivedMesh
- from them */
-static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh(
- CSG_FaceIteratorDescriptor *face_it,
- CSG_VertexIteratorDescriptor *vertex_it,
- float parinv[][4],
- float mapmat[][4],
- Material **mat,
- int *totmat,
- Object *ob1,
- Object *ob2)
-{
- DerivedMesh *dm;
- GHash *material_hash = NULL;
- Mesh *me1= (Mesh*)ob1->data;
- Mesh *me2= (Mesh*)ob2->data;
- int i;
-
- // create a new DerivedMesh
- dm = CDDM_new(vertex_it->num_elements, 0, face_it->num_elements);
-
- CustomData_merge(&me1->fdata, &dm->faceData, CD_MASK_DERIVEDMESH,
- CD_DEFAULT, face_it->num_elements);
- CustomData_merge(&me2->fdata, &dm->faceData, CD_MASK_DERIVEDMESH,
- CD_DEFAULT, face_it->num_elements);
-
- // step through the vertex iterators:
- for (i = 0; !vertex_it->Done(vertex_it->it); i++) {
- CSG_IVertex csgvert;
- MVert *mvert = CDDM_get_vert(dm, i);
-
- // retrieve a csg vertex from the boolean module
- vertex_it->Fill(vertex_it->it, &csgvert);
- vertex_it->Step(vertex_it->it);
-
- // we have to map the vertex coordinates back in the coordinate frame
- // of the resulting object, since it was computed in world space
- VecMat4MulVecfl(mvert->co, parinv, csgvert.position);
- }
-
- // a hash table to remap materials to indices
- if (mat) {
- material_hash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp);
- *totmat = 0;
- }
-
- // step through the face iterators
- for(i = 0; !face_it->Done(face_it->it); i++) {
- Mesh *orig_me;
- Object *orig_ob;
- Material *orig_mat;
- CSG_IFace csgface;
- MFace *mface;
- int orig_index, mat_nr;
-
- // retrieve a csg face from the boolean module
- face_it->Fill(face_it->it, &csgface);
- face_it->Step(face_it->it);
-
- // find the original mesh and data
- orig_ob = (csgface.orig_face < me1->totface)? ob1: ob2;
- orig_me = (orig_ob == ob1)? me1: me2;
- orig_index = (orig_ob == ob1)? csgface.orig_face: csgface.orig_face - me1->totface;
-
- // copy all face layers, including mface
- CustomData_copy_data(&orig_me->fdata, &dm->faceData, orig_index, i, 1);
-
- // set mface
- mface = CDDM_get_face(dm, i);
- mface->v1 = csgface.vertex_index[0];
- mface->v2 = csgface.vertex_index[1];
- mface->v3 = csgface.vertex_index[2];
- mface->v4 = (csgface.vertex_number == 4)? csgface.vertex_index[3]: 0;
-
- // set material, based on lookup in hash table
- orig_mat= give_current_material(orig_ob, mface->mat_nr+1);
-
- if (mat && orig_mat) {
- if (!BLI_ghash_haskey(material_hash, orig_mat)) {
- mat[*totmat] = orig_mat;
- mat_nr = mface->mat_nr = (*totmat)++;
- BLI_ghash_insert(material_hash, orig_mat, (void*)mat_nr);
- }
- else
- mface->mat_nr = (int)BLI_ghash_lookup(material_hash, orig_mat);
- }
- else
- mface->mat_nr = 0;
-
- InterpCSGFace(dm, orig_me, i, orig_index, csgface.vertex_number,
- (orig_me == me2)? mapmat: NULL);
-
- test_index_face(mface, &dm->faceData, i, csgface.vertex_number);
- }
-
- if (material_hash)
- BLI_ghash_free(material_hash, NULL, NULL);
-
- CDDM_calc_edges(dm);
- CDDM_calc_normals(dm);
-
- return dm;
-}
-
-static void BuildMeshDescriptors(
- struct Object *ob,
- int face_offset,
- struct CSG_FaceIteratorDescriptor * face_it,
- struct CSG_VertexIteratorDescriptor * vertex_it)
-{
- VertexIt_Construct(vertex_it,ob);
- FaceIt_Construct(face_it,ob,face_offset);
-}
-
-static void FreeMeshDescriptors(
- struct CSG_FaceIteratorDescriptor *face_it,
- struct CSG_VertexIteratorDescriptor *vertex_it)
-{
- VertexIt_Destruct(vertex_it);
- FaceIt_Destruct(face_it);
-}
-
-DerivedMesh *NewBooleanDerivedMesh_intern(
- struct Object *ob, struct Object *ob_select,
- int int_op_type, Material **mat, int *totmat)
-{
-
- float inv_mat[4][4];
- float map_mat[4][4];
-
- DerivedMesh *dm = NULL;
- Mesh *me1 = get_mesh(ob_select);
- Mesh *me2 = get_mesh(ob);
-
- if (me1 == NULL || me2 == NULL) return 0;
- if (!me1->totface || !me2->totface) return 0;
-
- // we map the final object back into ob's local coordinate space. For this
- // we need to compute the inverse transform from global to ob (inv_mat),
- // and the transform from ob to ob_select for use in interpolation (map_mat)
- Mat4Invert(inv_mat, ob->obmat);
- Mat4MulMat4(map_mat, ob_select->obmat, inv_mat);
- Mat4Invert(inv_mat, ob_select->obmat);
-
- {
- // interface with the boolean module:
- //
- // the idea is, we pass the boolean module verts and faces using the
- // provided descriptors. once the boolean operation is performed, we
- // get back output descriptors, from which we then build a DerivedMesh
-
- CSG_VertexIteratorDescriptor vd_1, vd_2;
- CSG_FaceIteratorDescriptor fd_1, fd_2;
- CSG_OperationType op_type;
- CSG_BooleanOperation *bool_op;
-
- // work out the operation they chose and pick the appropriate
- // enum from the csg module.
- switch (int_op_type) {
- case 1 : op_type = e_csg_intersection; break;
- case 2 : op_type = e_csg_union; break;
- case 3 : op_type = e_csg_difference; break;
- case 4 : op_type = e_csg_classify; break;
- default : op_type = e_csg_intersection;
- }
-
- BuildMeshDescriptors(ob_select, 0, &fd_1, &vd_1);
- BuildMeshDescriptors(ob, me1->totface, &fd_2, &vd_2);
-
- bool_op = CSG_NewBooleanFunction();
-
- // perform the operation
- if (CSG_PerformBooleanOperation(bool_op, op_type, fd_1, vd_1, fd_2, vd_2)) {
- CSG_VertexIteratorDescriptor vd_o;
- CSG_FaceIteratorDescriptor fd_o;
-
- CSG_OutputFaceDescriptor(bool_op, &fd_o);
- CSG_OutputVertexDescriptor(bool_op, &vd_o);
-
- // iterate through results of operation and insert
- // into new object
- dm = ConvertCSGDescriptorsToDerivedMesh(
- &fd_o, &vd_o, inv_mat, map_mat, mat, totmat, ob_select, ob);
-
- // free up the memory
- CSG_FreeVertexDescriptor(&vd_o);
- CSG_FreeFaceDescriptor(&fd_o);
- }
- else
- error("Unknown internal error in boolean");
-
- CSG_FreeBooleanOperation(bool_op);
-
- FreeMeshDescriptors(&fd_1, &vd_1);
- FreeMeshDescriptors(&fd_2, &vd_2);
- }
-
- return dm;
-}
-
-int NewBooleanMesh(Base *base, Base *base_select, int int_op_type)
-{
- Mesh *me_new;
- int a, maxmat, totmat= 0;
- Object *ob_new, *ob, *ob_select;
- Material **mat;
- DerivedMesh *dm;
-
- ob= base->object;
- ob_select= base_select->object;
-
- maxmat= ob->totcol + ob_select->totcol;
- mat= (Material**)MEM_mallocN(sizeof(Material*)*maxmat, "NewBooleanMeshMat");
-
- dm= NewBooleanDerivedMesh_intern(ob, ob_select, int_op_type, mat, &totmat);
-
- if (dm == NULL) {
- MEM_freeN(mat);
- return 0;
- }
-
- /* create a new blender mesh object - using 'base' as a template */
- ob_new= AddNewBlenderMesh(base_select);
- me_new= ob_new->data;
-
- DM_to_mesh(dm, me_new);
- dm->release(dm);
-
- /* add materials to object */
- for (a = 0; a < totmat; a++)
- assign_material(ob_new, mat[a], a+1);
-
- MEM_freeN(mat);
-
- /* update dag */
- DAG_object_flush_update(G.scene, ob_new, OB_RECALC_DATA);
-
- return 1;
-}
-
-DerivedMesh *NewBooleanDerivedMesh(struct Object *ob, struct Object *ob_select,
- int int_op_type)
-{
- return NewBooleanDerivedMesh_intern(ob, ob_select, int_op_type, NULL, NULL);
-}
-
diff --git a/source/blender/src/booleanops_mesh.c b/source/blender/src/booleanops_mesh.c
deleted file mode 100644
index d0b40b6eb7e..00000000000
--- a/source/blender/src/booleanops_mesh.c
+++ /dev/null
@@ -1,296 +0,0 @@
-#if 0
-
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-#include "CSG_BooleanOps.h"
-
-#include "BKE_booleanops.h"
-#include "BKE_booleanops_mesh.h"
-#include "MEM_guardedalloc.h"
-
-#include "DNA_material_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-
-#include "BKE_global.h"
-#include "BKE_mesh.h"
-#include "BKE_displist.h"
-#include "BKE_object.h"
-#include "BKE_utildefines.h"
-#include "BKE_library.h"
-#include "BKE_material.h"
-
-#include "BLI_arithb.h"
-
-/**
- * Implementation of boolean ops mesh interface.
- */
-
- void
-CSG_DestroyMeshDescriptor(
- CSG_MeshDescriptor *mesh
-){
- // Call mesh descriptors destroy function....
- mesh->m_destroy_func(mesh);
-}
-
-// Destroy function for blender mesh internals.
-
-static
- void
-CSG_DestroyBlenderMeshInternals(
- CSG_MeshDescriptor *mesh
-) {
- // Free face and vertex iterators.
- FreeMeshDescriptors(&(mesh->m_face_iterator),&(mesh->m_vertex_iterator));
-}
-
-
-static
- void
-CSG_DestroyCSGMeshInternals(
- CSG_MeshDescriptor *mesh
-){
- CSG_FreeVertexDescriptor(&(mesh->m_vertex_iterator));
- CSG_FreeFaceDescriptor(&(mesh->m_face_iterator));
-}
-
-static
- int
-MakeCSGMeshFromBlenderBase(
- Base * base,
- CSG_MeshDescriptor * output
-) {
- Mesh *me;
- if (output == NULL || base == NULL) return 0;
-
- me = get_mesh(base->object);
-
- output->m_descriptor.user_face_vertex_data_size = 0;
- output->m_descriptor.user_data_size = sizeof(FaceData);
-
- output->base = base;
-
- BuildMeshDescriptors(
- base->object,
- &(output->m_face_iterator),
- &(output->m_vertex_iterator)
- );
-
- output->m_destroy_func = CSG_DestroyBlenderMeshInternals;
-
- return 1;
-}
-
- int
-CSG_LoadBlenderMesh(
- Object * obj,
- CSG_MeshDescriptor *output
-){
-
- Mesh *me;
- if (output == NULL || obj == NULL) return 0;
-
- me = get_mesh(obj);
-
- output->m_descriptor.user_face_vertex_data_size = 0;
- output->m_descriptor.user_data_size = sizeof(FaceData);
-
- output->base = NULL;
-
- BuildMeshDescriptors(
- obj,
- &(output->m_face_iterator),
- &(output->m_vertex_iterator)
- );
-
- output->m_destroy_func = CSG_DestroyBlenderMeshInternals;
- output->base = NULL;
-
- return 1;
-}
-
-
-
-
- int
-CSG_AddMeshToBlender(
- CSG_MeshDescriptor *mesh
-){
- Mesh *me_new = NULL;
- Object *ob_new = NULL;
- float inv_mat[4][4];
-
- if (mesh == NULL) return 0;
- if (mesh->base == NULL) return 0;
-
- Mat4Invert(inv_mat,mesh->base->object->obmat);
-
- // Create a new blender mesh object - using 'base' as
- // a template for the new object.
- ob_new= AddNewBlenderMesh(mesh->base);
-
- me_new = ob_new->data;
-
- // make sure the iterators are reset.
- mesh->m_face_iterator.Reset(mesh->m_face_iterator.it);
- mesh->m_vertex_iterator.Reset(mesh->m_vertex_iterator.it);
-
- // iterate through results of operation and insert into new object
- // see subsurf.c
-
- ConvertCSGDescriptorsToMeshObject(
- ob_new,
- &(mesh->m_descriptor),
- &(mesh->m_face_iterator),
- &(mesh->m_vertex_iterator),
- inv_mat
- );
-
- return 1;
-}
-
- int
-CSG_PerformOp(
- CSG_MeshDescriptor *mesh1,
- CSG_MeshDescriptor *mesh2,
- int int_op_type,
- CSG_MeshDescriptor *output
-){
-
- CSG_OperationType op_type;
- CSG_BooleanOperation * bool_op = CSG_NewBooleanFunction();
- int success = 0;
-
- if (bool_op == NULL) return 0;
-
- if ((mesh1 == NULL) || (mesh2 == NULL) || (output == NULL)) {
- return 0;
- }
- if ((int_op_type < 1) || (int_op_type > 3)) return 0;
-
- switch (int_op_type) {
- case 1 : op_type = e_csg_intersection; break;
- case 2 : op_type = e_csg_union; break;
- case 3 : op_type = e_csg_difference; break;
- case 4 : op_type = e_csg_classify; break;
- default : op_type = e_csg_intersection;
- }
-
- output->m_descriptor = CSG_DescibeOperands(bool_op,mesh1->m_descriptor,mesh2->m_descriptor);
- output->base = mesh1->base;
-
- if (output->m_descriptor.user_face_vertex_data_size) {
- // Then use the only interp function supported
- success =
- CSG_PerformBooleanOperation(
- bool_op,
- op_type,
- mesh1->m_face_iterator,
- mesh1->m_vertex_iterator,
- mesh2->m_face_iterator,
- mesh2->m_vertex_iterator,
- InterpFaceVertexData
- );
- } else {
- success =
- CSG_PerformBooleanOperation(
- bool_op,
- op_type,
- mesh1->m_face_iterator,
- mesh1->m_vertex_iterator,
- mesh2->m_face_iterator,
- mesh2->m_vertex_iterator,
- InterpNoUserData
- );
- }
-
- if (!success) {
- CSG_FreeBooleanOperation(bool_op);
- bool_op = NULL;
- return 0;
- }
-
- // get the ouput mesh descriptors.
-
- CSG_OutputFaceDescriptor(bool_op,&(output->m_face_iterator));
- CSG_OutputVertexDescriptor(bool_op,&(output->m_vertex_iterator));
- output->m_destroy_func = CSG_DestroyCSGMeshInternals;
-
- return 1;
-}
-
- int
-NewBooleanMeshTest(
- struct Base * base,
- struct Base * base_select,
- int op_type
-){
-
- CSG_MeshDescriptor m1,m2,output;
- CSG_MeshDescriptor output2,output3;
-
- if (!MakeCSGMeshFromBlenderBase(base,&m1)) {
- return 0;
- }
-
- if (!MakeCSGMeshFromBlenderBase(base_select,&m2)) {
- return 0;
- }
-
- CSG_PerformOp(&m1,&m2,1,&output);
- CSG_PerformOp(&m1,&m2,2,&output2);
- CSG_PerformOp(&m1,&m2,3,&output3);
-
- if (!CSG_AddMeshToBlender(&output)) {
- return 0;
- }
- if (!CSG_AddMeshToBlender(&output2)) {
- return 0;
- }
- if (!CSG_AddMeshToBlender(&output3)) {
- return 0;
- }
-
-
- CSG_DestroyMeshDescriptor(&m1);
- CSG_DestroyMeshDescriptor(&m2);
- CSG_DestroyMeshDescriptor(&output);
- CSG_DestroyMeshDescriptor(&output2);
- CSG_DestroyMeshDescriptor(&output3);
-
- return 1;
-}
-
-#endif
-
diff --git a/source/blender/src/butspace.c b/source/blender/src/butspace.c
deleted file mode 100644
index 2eddd362b62..00000000000
--- a/source/blender/src/butspace.c
+++ /dev/null
@@ -1,801 +0,0 @@
-/**
- * $Id:
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <time.h>
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "blendef.h"
-#include "MEM_guardedalloc.h"
-
-#include "DNA_color_types.h"
-#include "DNA_image_types.h"
-#include "DNA_material_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_space_types.h"
-#include "DNA_texture_types.h"
-
-#include "BKE_colortools.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_material.h"
-#include "BKE_library.h"
-#include "BKE_utildefines.h"
-
-#include "BLI_blenlib.h"
-
-#include "BSE_drawview.h" // for do_viewbuttons.c .... hurms
-#include "BSE_node.h"
-
-#include "BIF_gl.h"
-#include "BIF_graphics.h"
-#include "BIF_keyval.h"
-#include "BIF_interface.h"
-#include "BIF_toolbox.h"
-#include "BIF_space.h"
-#include "BIF_screen.h"
-#include "BIF_butspace.h"
-#include "BSE_headerbuttons.h"
-#include "BIF_previewrender.h"
-#include "BIF_mywindow.h"
-#include "BIF_glutil.h"
-#include "BIF_resources.h"
-
-#include "IMB_imbuf_types.h"
-#include "IMB_imbuf.h"
-
-#include "mydevice.h"
-#include "butspace.h" // own module
-
-/************************ function prototypes ***************************/
-void drawbutspace(ScrArea *, void *);
-
-
-/* Local vars ---------------------------------------------------------- */
-short bgpicmode=0, near=1000, far=1000;
-MTex emptytex;
-MTex mtexcopybuf;
-
-char texstr[20][12]= {"None" , "Clouds" , "Wood", "Marble", "Magic" , "Blend",
- "Stucci", "Noise" , "Image", "Plugin", "EnvMap" , "Musgrave",
- "Voronoi", "DistNoise", "", "", "", "", "", ""};
-/* ---------------------------------------------------------------------- */
-
-void test_idbutton_cb(void *namev, void *arg2)
-{
- char *name= namev;
-
- test_idbutton(name+2);
-}
-
-
-void test_scriptpoin_but(char *name, ID **idpp)
-{
- ID *id;
-
- id= G.main->text.first;
- while(id) {
- if( strcmp(name, id->name+2)==0 ) {
- *idpp= id;
- return;
- }
- id= id->next;
- }
- *idpp= NULL;
-}
-
-void test_actionpoin_but(char *name, ID **idpp)
-{
- ID *id;
-
- id= G.main->action.first;
- while(id) {
- if( strcmp(name, id->name+2)==0 ) {
- id_us_plus(id);
- *idpp= id;
- return;
- }
- id= id->next;
- }
- *idpp= NULL;
-}
-
-
-void test_obpoin_but(char *name, ID **idpp)
-{
- ID *id;
-
- if(idpp == (ID **)&(emptytex.object)) {
- error("You must add a texture first");
- *idpp= 0;
- return;
- }
-
- id= G.main->object.first;
- while(id) {
- if( strcmp(name, id->name+2)==0 ) {
- *idpp= id;
- id_lib_extern(id); /* checks lib data, sets correct flag for saving then */
- return;
- }
- id= id->next;
- }
- *idpp= NULL;
-}
-
-/* tests for an object of type OB_MESH */
-void test_meshobpoin_but(char *name, ID **idpp)
-{
- ID *id;
-
- id = G.main->object.first;
- while(id) {
- Object *ob = (Object *)id;
- if(ob->type == OB_MESH && strcmp(name, id->name + 2) == 0) {
- *idpp = id;
- /* checks lib data, sets correct flag for saving then */
- id_lib_extern(id);
- return;
- }
- id = id->next;
- }
- *idpp = NULL;
-}
-
-void test_meshpoin_but(char *name, ID **idpp)
-{
- ID *id;
-
- if( *idpp ) (*idpp)->us--;
-
- id= G.main->mesh.first;
- while(id) {
- if( strcmp(name, id->name+2)==0 ) {
- *idpp= id;
- id_us_plus(id);
- return;
- }
- id= id->next;
- }
- *idpp= NULL;
-}
-
-void test_matpoin_but(char *name, ID **idpp)
-{
- ID *id;
-
- if( *idpp ) (*idpp)->us--;
-
- id= G.main->mat.first;
- while(id) {
- if( strcmp(name, id->name+2)==0 ) {
- *idpp= id;
- id_us_plus(id);
- return;
- }
- id= id->next;
- }
- *idpp= NULL;
-}
-
-void test_scenepoin_but(char *name, ID **idpp)
-{
- ID *id;
-
- if( *idpp ) (*idpp)->us--;
-
- id= G.main->scene.first;
- while(id) {
- if( strcmp(name, id->name+2)==0 ) {
- *idpp= id;
- id_us_plus(id);
- return;
- }
- id= id->next;
- }
- *idpp= NULL;
-}
-
-void test_grouppoin_but(char *name, ID **idpp)
-{
- ID *id;
-
- if( *idpp ) (*idpp)->us--;
-
- id= G.main->group.first;
- while(id) {
- if( strcmp(name, id->name+2)==0 ) {
- *idpp= id;
- id_us_plus(id);
- return;
- }
- id= id->next;
- }
- *idpp= NULL;
-}
-
-void test_texpoin_but(char *name, ID **idpp)
-{
- ID *id;
-
- if( *idpp ) (*idpp)->us--;
-
- id= G.main->tex.first;
- while(id) {
- if( strcmp(name, id->name+2)==0 ) {
- *idpp= id;
- id_us_plus(id);
- return;
- }
- id= id->next;
- }
- *idpp= NULL;
-}
-
-void test_imapoin_but(char *name, ID **idpp)
-{
- ID *id;
-
- if( *idpp ) (*idpp)->us--;
-
- id= G.main->image.first;
- while(id) {
- if( strcmp(name, id->name+2)==0 ) {
- *idpp= id;
- id_us_plus(id);
- return;
- }
- id= id->next;
- }
- *idpp= NULL;
-}
-
-/* ----------- custom button group ---------------------- */
-
-static void curvemap_buttons_zoom_in(void *cumap_v, void *unused)
-{
- CurveMapping *cumap = cumap_v;
- float d;
-
- /* we allow 20 times zoom */
- if( (cumap->curr.xmax - cumap->curr.xmin) > 0.04f*(cumap->clipr.xmax - cumap->clipr.xmin) ) {
- d= 0.1154f*(cumap->curr.xmax - cumap->curr.xmin);
- cumap->curr.xmin+= d;
- cumap->curr.xmax-= d;
- d= 0.1154f*(cumap->curr.ymax - cumap->curr.ymin);
- cumap->curr.ymin+= d;
- cumap->curr.ymax-= d;
- }
-}
-
-static void curvemap_buttons_zoom_out(void *cumap_v, void *unused)
-{
- CurveMapping *cumap = cumap_v;
- float d, d1;
-
- /* we allow 20 times zoom, but dont view outside clip */
- if( (cumap->curr.xmax - cumap->curr.xmin) < 20.0f*(cumap->clipr.xmax - cumap->clipr.xmin) ) {
- d= d1= 0.15f*(cumap->curr.xmax - cumap->curr.xmin);
-
- if(cumap->flag & CUMA_DO_CLIP)
- if(cumap->curr.xmin-d < cumap->clipr.xmin)
- d1= cumap->curr.xmin - cumap->clipr.xmin;
- cumap->curr.xmin-= d1;
-
- if(cumap->flag & CUMA_DO_CLIP)
- if(cumap->curr.xmax+d > cumap->clipr.xmax)
- d1= -cumap->curr.xmax + cumap->clipr.xmax;
- cumap->curr.xmax+= d1;
-
- d= d1= 0.15f*(cumap->curr.ymax - cumap->curr.ymin);
-
- if(cumap->flag & CUMA_DO_CLIP)
- if(cumap->curr.ymin-d < cumap->clipr.ymin)
- d1= cumap->curr.ymin - cumap->clipr.ymin;
- cumap->curr.ymin-= d1;
-
- if(cumap->flag & CUMA_DO_CLIP)
- if(cumap->curr.ymax+d > cumap->clipr.ymax)
- d1= -cumap->curr.ymax + cumap->clipr.ymax;
- cumap->curr.ymax+= d1;
- }
-}
-
-static void curvemap_buttons_setclip(void *cumap_v, void *unused)
-{
- CurveMapping *cumap = cumap_v;
-
- curvemapping_changed(cumap, 0);
-}
-
-static void curvemap_buttons_delete(void *cumap_v, void *unused)
-{
- CurveMapping *cumap = cumap_v;
-
- curvemap_remove(cumap->cm+cumap->cur, SELECT);
- curvemapping_changed(cumap, 0);
-}
-
-/* NOTE: this is a block-menu, needs 0 events, otherwise the menu closes */
-static uiBlock *curvemap_clipping_func(void *cumap_v)
-{
- CurveMapping *cumap = cumap_v;
- uiBlock *block;
- uiBut *bt;
-
- block= uiNewBlock(&curarea->uiblocks, "curvemap_clipping_func", UI_EMBOSS, UI_HELV, curarea->win);
-
- /* use this for a fake extra empy space around the buttons */
- uiDefBut(block, LABEL, 0, "", -4, 16, 128, 106, NULL, 0, 0, 0, 0, "");
-
- bt= uiDefButBitI(block, TOG, CUMA_DO_CLIP, 1, "Use Clipping",
- 0,100,120,18, &cumap->flag, 0.0, 0.0, 10, 0, "");
- uiButSetFunc(bt, curvemap_buttons_setclip, cumap, NULL);
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, 0, "Min X ", 0,74,120,18, &cumap->clipr.xmin, -100.0, cumap->clipr.xmax, 10, 0, "");
- uiDefButF(block, NUM, 0, "Min Y ", 0,56,120,18, &cumap->clipr.ymin, -100.0, cumap->clipr.ymax, 10, 0, "");
- uiDefButF(block, NUM, 0, "Max X ", 0,38,120,18, &cumap->clipr.xmax, cumap->clipr.xmin, 100.0, 10, 0, "");
- uiDefButF(block, NUM, 0, "Max Y ", 0,20,120,18, &cumap->clipr.ymax, cumap->clipr.ymin, 100.0, 10, 0, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
-
- return block;
-}
-
-
-static void curvemap_tools_dofunc(void *cumap_v, int event)
-{
- CurveMapping *cumap = cumap_v;
- CurveMap *cuma= cumap->cm+cumap->cur;
-
- switch(event) {
- case 0:
- curvemap_reset(cuma, &cumap->clipr);
- curvemapping_changed(cumap, 0);
- break;
- case 1:
- cumap->curr= cumap->clipr;
- break;
- case 2: /* set vector */
- curvemap_sethandle(cuma, 1);
- curvemapping_changed(cumap, 0);
- break;
- case 3: /* set auto */
- curvemap_sethandle(cuma, 0);
- curvemapping_changed(cumap, 0);
- break;
- case 4: /* extend horiz */
- cuma->flag &= ~CUMA_EXTEND_EXTRAPOLATE;
- curvemapping_changed(cumap, 0);
- break;
- case 5: /* extend extrapolate */
- cuma->flag |= CUMA_EXTEND_EXTRAPOLATE;
- curvemapping_changed(cumap, 0);
- break;
- }
- addqueue(curarea->win, REDRAW, 1);
-}
-
-static uiBlock *curvemap_tools_func(void *cumap_v)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "curvemap_tools_func", UI_EMBOSSP, UI_HELV, curarea->win);
- uiBlockSetButmFunc(block, curvemap_tools_dofunc, cumap_v);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Reset View", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Vector Handle", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Auto Handle", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Horizontal", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Extrapolated", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Reset Curve", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 50);
- return block;
-}
-
-/* still unsure how this call evolves... we use labeltype for defining what curve-channels to show */
-void curvemap_buttons(uiBlock *block, CurveMapping *cumap, char labeltype, short event, short redraw, rctf *rect)
-{
- uiBut *bt;
- float dx, fy= rect->ymax-18.0f;
- int icon;
- short xco, yco;
-
- yco= (short)(rect->ymax-18.0f);
-
- /* curve choice options + tools/settings, 8 icons + spacer */
- dx= (rect->xmax-rect->xmin)/(9.0f);
-
- uiBlockBeginAlign(block);
- if(labeltype=='v') { /* vector */
- xco= (short)rect->xmin;
- if(cumap->cm[0].curve)
- uiDefButI(block, ROW, redraw, "X", xco, yco+2, dx, 16, &cumap->cur, 0.0, 0.0, 0.0, 0.0, "");
- xco= (short)(rect->xmin+1.0f*dx);
- if(cumap->cm[1].curve)
- uiDefButI(block, ROW, redraw, "Y", xco, yco+2, dx, 16, &cumap->cur, 0.0, 1.0, 0.0, 0.0, "");
- xco= (short)(rect->xmin+2.0f*dx);
- if(cumap->cm[2].curve)
- uiDefButI(block, ROW, redraw, "Z", xco, yco+2, dx, 16, &cumap->cur, 0.0, 2.0, 0.0, 0.0, "");
- }
- else if(labeltype=='c') { /* color */
- xco= (short)rect->xmin;
- if(cumap->cm[3].curve)
- uiDefButI(block, ROW, redraw, "C", xco, yco+2, dx, 16, &cumap->cur, 0.0, 3.0, 0.0, 0.0, "");
- xco= (short)(rect->xmin+1.0f*dx);
- if(cumap->cm[0].curve)
- uiDefButI(block, ROW, redraw, "R", xco, yco+2, dx, 16, &cumap->cur, 0.0, 0.0, 0.0, 0.0, "");
- xco= (short)(rect->xmin+2.0f*dx);
- if(cumap->cm[1].curve)
- uiDefButI(block, ROW, redraw, "G", xco, yco+2, dx, 16, &cumap->cur, 0.0, 1.0, 0.0, 0.0, "");
- xco= (short)(rect->xmin+3.0f*dx);
- if(cumap->cm[2].curve)
- uiDefButI(block, ROW, redraw, "B", xco, yco+2, dx, 16, &cumap->cur, 0.0, 2.0, 0.0, 0.0, "");
- }
- /* else no channels ! */
- uiBlockEndAlign(block);
-
- xco= (short)(rect->xmin+4.5f*dx);
- uiBlockSetEmboss(block, UI_EMBOSSN);
- bt= uiDefIconBut(block, BUT, redraw, ICON_ZOOMIN, xco, yco, dx, 14, NULL, 0.0, 0.0, 0.0, 0.0, "Zoom in");
- uiButSetFunc(bt, curvemap_buttons_zoom_in, cumap, NULL);
-
- xco= (short)(rect->xmin+5.25f*dx);
- bt= uiDefIconBut(block, BUT, redraw, ICON_ZOOMOUT, xco, yco, dx, 14, NULL, 0.0, 0.0, 0.0, 0.0, "Zoom out");
- uiButSetFunc(bt, curvemap_buttons_zoom_out, cumap, NULL);
-
- xco= (short)(rect->xmin+6.0f*dx);
- bt= uiDefIconBlockBut(block, curvemap_tools_func, cumap, event, ICON_MODIFIER, xco, yco, dx, 18, "Tools");
-
- xco= (short)(rect->xmin+7.0f*dx);
- if(cumap->flag & CUMA_DO_CLIP) icon= ICON_CLIPUV_HLT; else icon= ICON_CLIPUV_DEHLT;
- bt= uiDefIconBlockBut(block, curvemap_clipping_func, cumap, event, icon, xco, yco, dx, 18, "Clipping Options");
-
- xco= (short)(rect->xmin+8.0f*dx);
- bt= uiDefIconBut(block, BUT, event, ICON_X, xco, yco, dx, 18, NULL, 0.0, 0.0, 0.0, 0.0, "Delete points");
- uiButSetFunc(bt, curvemap_buttons_delete, cumap, NULL);
-
- uiBlockSetEmboss(block, UI_EMBOSS);
-
- uiDefBut(block, BUT_CURVE, event, "",
- rect->xmin, rect->ymin, rect->xmax-rect->xmin, fy-rect->ymin,
- cumap, 0.0f, 1.0f, 0, 0, "");
-
-
-}
-
-
-/* --------------------------------- */
-
-/* nodes have button callbacks, that can draw in butspace too. need separate handling */
-static void do_node_buts(unsigned short event)
-{
- Material *ma;
-
- /* all operations default on active material layer here */
- /* but this also gets called for lamp and world... */
- ma= G.buts->lockpoin;
- if(ma && GS(ma->id.name)==ID_MA)
- ma = editnode_get_active_material(ma);
- else
- ma= NULL;
-
- if(event>=B_NODE_EXEC) {
- if(ma) end_render_material(ma); /// temporal... 3d preview
- BIF_preview_changed(ID_MA);
- allqueue(REDRAWNODE, 0);
- allqueue(REDRAWBUTSSHADING, 0);
- }
-}
-
-void do_butspace(unsigned short event)
-{
- SpaceButs *buts;
-
- /* redraw windows of the same type? */
- buts= curarea->spacedata.first;
- if(buts->mainb==CONTEXT_SCENE) allqueue(REDRAWBUTSSCENE, curarea->win);
- if(buts->mainb==CONTEXT_OBJECT) allqueue(REDRAWBUTSOBJECT, curarea->win);
- if(buts->mainb==CONTEXT_SHADING) allqueue(REDRAWBUTSSHADING, curarea->win);
- if(buts->mainb==CONTEXT_EDITING) allqueue(REDRAWBUTSEDIT, curarea->win);
- if(buts->mainb==CONTEXT_SCRIPT) allqueue(REDRAWBUTSSCRIPT, curarea->win);
- if(buts->mainb==CONTEXT_LOGIC) allqueue(REDRAWBUTSLOGIC, curarea->win);
-
- if (event <=50){
- do_global_buttons2(event);
- }
- else if(event<=100) {
- do_global_buttons(event);
- }
- else if(event < 1000) {
- do_headerbuttons(event);
- }
- else if(event<=B_VIEWBUTS) {
- do_viewbuts(event);
- }
- else if(event<=B_LAMPBUTS) {
- do_lampbuts(event);
- }
- else if(event<=B_MATBUTS) {
- do_matbuts(event);
- }
- else if(event<=B_TEXBUTS) {
- do_texbuts(event);
- }
- else if(event<=B_ANIMBUTS) {
- do_object_panels(event);
- }
- else if(event<=B_WORLDBUTS) {
- do_worldbuts(event);
- }
- else if(event<=B_RENDERBUTS) {
- do_render_panels(event); // buttons_scene.c
- }
- else if(event<=B_COMMONEDITBUTS) {
- do_common_editbuts(event);
- }
- else if(event<=B_MESHBUTS) {
- do_meshbuts(event);
- }
- else if(event<=B_VGROUPBUTS) {
- do_vgroupbuts(event);
- }
- else if(event<=B_CURVEBUTS) {
- do_curvebuts(event);
- }
- else if(event<=B_FONTBUTS) {
- do_fontbuts(event);
- }
- else if(event<=B_ARMBUTS) {
- do_armbuts(event);
- }
- else if(event<=B_CAMBUTS) {
- do_cambuts(event);
- }
- else if(event<=B_MBALLBUTS) {
- do_mballbuts(event);
- }
- else if(event<=B_LATTBUTS) {
- do_latticebuts(event);
- }
- else if(event<=B_GAMEBUTS) {
- do_logic_buts(event); // buttons_logic.c
- }
- else if(event<=B_FPAINTBUTS) {
- do_fpaintbuts(event);
- }
- else if(event<=B_RADIOBUTS) {
- do_radiobuts(event);
- }
- else if(event<=B_SCRIPTBUTS) {
- do_scriptbuts(event);
- }
- else if(event<=B_SOUNDBUTS) {
- do_soundbuts(event);
- }
- else if(event<=B_CONSTRAINTBUTS) {
- do_constraintbuts(event);
- }
- else if(event<=B_UVAUTOCALCBUTS) {
- do_uvcalculationbuts(event);
- }
- else if(event<=B_EFFECTSBUTS) {
- do_effects_panels(event);
- }
- else if(event<=B_MODIFIER_BUTS) {
- extern void do_modifier_panels(unsigned short event);
- do_modifier_panels(event);
- }
- else if(event<=B_NODE_BUTS) {
- do_node_buts(event);
- }
- else if(event==REDRAWVIEW3D) allqueue(event, 1); // 1=do header too
- else if(event>REDRAWVIEW3D) allqueue(event, 0);
-}
-
-static void butspace_context_switch(SpaceButs *buts, Object *new)
-{
- // change type automatically
- if(new) {
- int tab= buts->tab[CONTEXT_SHADING];
-
- if(tab == TAB_SHADING_WORLD) {
- if(new->type==OB_CAMERA);
- else if(new->type==OB_LAMP) {
- buts->tab[CONTEXT_SHADING]= TAB_SHADING_LAMP;
- }
- else buts->tab[CONTEXT_SHADING]= TAB_SHADING_MAT;
-
- }
- else if(tab == TAB_SHADING_TEX) {
- if(new->type==OB_LAMP) buts->texfrom= 2;
- else if(new->type==OB_CAMERA) buts->texfrom= 1;
- else buts->texfrom= 0;
- }
- else if(tab == TAB_SHADING_RAD) {
- }
- else if(new->type==OB_CAMERA) {
- buts->tab[CONTEXT_SHADING]= TAB_SHADING_WORLD;
- }
- else if(new->type==OB_LAMP) {
- buts->tab[CONTEXT_SHADING]= TAB_SHADING_LAMP;
- }
- else {
- buts->tab[CONTEXT_SHADING]= TAB_SHADING_MAT;
- }
- }
-}
-
-/* new active object */
-void redraw_test_buttons(Object *new)
-{
- ScrArea *sa;
- SpaceButs *buts;
-
- sa= G.curscreen->areabase.first;
- while(sa) {
- if(sa->spacetype==SPACE_BUTS) {
- buts= sa->spacedata.first;
-
- if(ELEM5(buts->mainb, CONTEXT_OBJECT, CONTEXT_EDITING, CONTEXT_SHADING, CONTEXT_LOGIC, CONTEXT_SCRIPT)) {
- addqueue(sa->win, REDRAW, 1);
- buts->re_align= 1;
-
- if(new && buts->mainb==CONTEXT_SHADING) {
- /* does node previews too... */
- BIF_preview_changed(ID_TE);
- }
- }
- // always do context switch
- if(new) butspace_context_switch(buts, new);
-
- }
- sa= sa->next;
- }
-}
-
-
-/* callback */
-void drawbutspace(ScrArea *sa, void *spacedata)
-{
- ID *id, *idfrom;
- SpaceButs *sbuts= sa->spacedata.first;
- View2D *v2d= &sbuts->v2d;
- float col[3];
- int tab, align=0;
-
- /* context */
- buttons_active_id(&id, &idfrom);
- G.buts->lockpoin= id;
-
- myortho2(v2d->cur.xmin, v2d->cur.xmax, v2d->cur.ymin, v2d->cur.ymax);
-
- BIF_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- uiSetButLock(G.scene->id.lib!=0, ERROR_LIBDATA_MESSAGE);
- uiFreeBlocksWin(&sa->uiblocks, sa->win);
-
- /* select the context to be drawn, per contex/tab the actual context is tested */
- switch(sbuts->mainb) {
- case CONTEXT_SCENE:
- tab= sbuts->tab[CONTEXT_SCENE];
-
- if(tab== TAB_SCENE_RENDER)
- render_panels();
- else if(tab == TAB_SCENE_ANIM)
- anim_panels();
- else if(tab == TAB_SCENE_SOUND)
- sound_panels();
-
- break;
- case CONTEXT_OBJECT:
- tab= sbuts->tab[CONTEXT_OBJECT];
-
- if(tab==TAB_OBJECT_OBJECT)
- object_panels();
- else if(tab==TAB_OBJECT_PHYSICS)
- physics_panels();
- else if(tab==TAB_OBJECT_PARTICLE)
- particle_panels();
-
- break;
- case CONTEXT_SHADING:
- tab= sbuts->tab[CONTEXT_SHADING];
-
- if(tab==TAB_SHADING_MAT)
- material_panels();
- else if(tab==TAB_SHADING_LAMP)
- lamp_panels();
- else if(tab==TAB_SHADING_WORLD)
- world_panels();
- else if(tab==TAB_SHADING_RAD)
- radio_panels();
- else if(tab==TAB_SHADING_TEX)
- texture_panels();
-
- break;
- case CONTEXT_EDITING:
- /* no tabs */
- editing_panels();
-
- break;
- case CONTEXT_SCRIPT:
- script_panels();
-
- break;
- case CONTEXT_LOGIC:
- /* no tabs */
- logic_buts();
- break;
- }
-
- uiClearButLock();
-
- /* when align changes, also do this for new panels */
- /* don't always align, this function is called during AnmatePanels too */
- if(sbuts->align)
- if(sbuts->re_align || sbuts->mainbo!=sbuts->mainb || sbuts->tabo!=sbuts->tab[sbuts->mainb])
- align= 1;
-
- uiDrawBlocksPanels(sa, align);
-
- /* since panels give different layouts, we have to make sure v2d.tot matches */
- uiMatchPanel_view2d(sa);
-
- sbuts->re_align= 0;
- // also for memory for finding which texture you'd like to see
- sbuts->mainbo= sbuts->mainb;
- sbuts->tabo= sbuts->tab[sbuts->mainb];
-
- myortho2(-0.375, (float)(sa->winx)-0.375, -0.375, (float)(sa->winy)-0.375);
- draw_area_emboss(sa);
- myortho2(v2d->cur.xmin, v2d->cur.xmax, v2d->cur.ymin, v2d->cur.ymax);
-
- /* always in end */
- sa->win_swap= WIN_BACK_OK;
-}
-
-
diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c
deleted file mode 100644
index ca878933499..00000000000
--- a/source/blender/src/buttons_editing.c
+++ /dev/null
@@ -1,6153 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <time.h>
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef WIN32
-#ifndef snprintf
-#define snprintf _snprintf
-#endif
-#endif
-
-#include "MEM_guardedalloc.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_scene_types.h"
-
-#include "DNA_action_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_brush_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_color_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_effect_types.h"
-#include "DNA_group_types.h"
-#include "DNA_key_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_lattice_types.h"
-#include "DNA_material_types.h"
-#include "DNA_meta_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_modifier_types.h"
-#include "DNA_nla_types.h"
-#include "DNA_object_types.h"
-#include "DNA_object_force.h"
-#include "DNA_particle_types.h"
-#include "DNA_radio_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_vfont_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_world_types.h"
-#include "DNA_packedFile_types.h"
-
-#include "BKE_blender.h"
-#include "BKE_brush.h"
-#include "BKE_curve.h"
-#include "BKE_customdata.h"
-#include "BKE_colortools.h"
-#include "BKE_deform.h"
-#include "BKE_depsgraph.h"
-#include "BKE_global.h"
-#include "BKE_key.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
-#include "BKE_mesh.h"
-#include "BKE_modifier.h"
-#include "BKE_packedFile.h"
-#include "BKE_particle.h"
-#include "BKE_scene.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_vfontdata.h"
-#include "BLI_editVert.h"
-#include "BLI_dynstr.h"
-
-#include "BSE_filesel.h"
-
-#include "BIF_gl.h"
-#include "BIF_editarmature.h"
-#include "BIF_editconstraint.h"
-#include "BIF_editdeform.h"
-#include "BIF_editfont.h"
-#include "BIF_editkey.h"
-#include "BIF_editmesh.h"
-#include "BIF_editparticle.h"
-#include "BIF_imasel.h"
-#include "BIF_interface.h"
-#include "BIF_meshtools.h"
-#include "BIF_mywindow.h"
-#include "BIF_poseobject.h"
-#include "BIF_renderwin.h"
-#include "BIF_resources.h"
-#include "BIF_retopo.h"
-#include "BIF_screen.h"
-#include "BIF_scrarea.h"
-#include "BIF_space.h"
-#include "BIF_toets.h"
-#include "BIF_toolbox.h"
-#include "BIF_previewrender.h"
-#include "BIF_butspace.h"
-
-#ifdef WITH_VERSE
-#include "BIF_verse.h"
-#endif
-
-#include "mydevice.h"
-#include "blendef.h"
-
-#include "BKE_action.h"
-#include "BKE_anim.h"
-#include "BKE_armature.h"
-#include "BKE_constraint.h"
-#include "BKE_curve.h"
-#include "BKE_displist.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_effect.h"
-#include "BKE_font.h"
-#include "BKE_icons.h"
-#include "BKE_image.h"
-#include "BKE_ipo.h"
-#include "BKE_lattice.h"
-#include "BKE_material.h"
-#include "BKE_mball.h"
-#include "BKE_mesh.h"
-#include "BKE_object.h"
-#include "BKE_texture.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_poseobject.h"
-
-#include "BDR_drawobject.h"
-#include "BDR_editcurve.h"
-#include "BDR_editface.h"
-#include "BDR_editobject.h"
-#include "BDR_sculptmode.h"
-#include "BDR_vpaint.h"
-#include "BDR_unwrapper.h"
-
-#include "BSE_drawview.h"
-#include "BSE_editipo.h"
-#include "BSE_edit.h"
-#include "BSE_filesel.h"
-#include "BSE_headerbuttons.h"
-#include "BSE_trans_types.h"
-#include "BSE_view.h"
-#include "BSE_seqaudio.h"
-
-#include "RE_render_ext.h" // make_sticky
-
-#include "butspace.h" // own module
-#include "multires.h"
-
-static float editbutweight= 1.0;
-float editbutvweight= 1;
-static int actmcol= 0, acttface= 0, acttface_rnd = 0, actmcol_rnd = 0;
-
-extern ListBase editNurb;
-
-/* *************************** Unicode Character Groups ****************** */
-unicodect uctabname[125] = {
- {"All", "All", 0x0000, 0xffff},
- {"Basic Latin", "Basic Latin", 0x0000, 0x007f},
- {"Latin 1 Supp", "Latin-1 Supplement", 0x0080, 0x00ff},
-
- {"Latin Ext. A.", "Latin Extended-A", 0x0100, 0x017F},
- {"Latin Ext. B.", "Latin Extended-B", 0x0180,0x024F},
- {"Latin Ext. Add.", "Latin Extended Additional", 0x1e00, 0x1eff},
-
- {"IPA Ext", "IPA Extensions", 0x0250, 0x02AF},
- {"Spacing Mod.", "Spacing Modifier Letters", 0x02b0, 0x02ff},
-
- {"Comb. Dia.", "Combining Diacritical Marks", 0x0300, 0x036F},
- {"Greek, Coptic", "Greek and Coptic", 0x0370, 0x03ff},
- {"Greek Ext.", "Greek Extended", 0x1f00, 0x1fff},
-
- {"Cyrillic", "Cyrillic", 0x0400, 0x04ff},
- {"Cyrillic Supp.", "Cyrillic Supplementary", 0x0500, 0x052f},
-
- {"Armenian", "Armenian", 0x0530, 0x058f},
- {"Hebrew", "Hebrew", 0x0590, 0x05ff},
-
-
- {"Arabic", "Arabic", 0x0600, 0x06ff},
- {"Syriac", "Syriac", 0x0700, 0x074f},
-
- {"Thaana", "Thaana", 0x0780, 0x07bf},
- {"Devanagari", "Devanagari", 0x0900, 0x097f},
-
- {"Bengali", "Bengali", 0x0980, 0x09ff},
- {"Gurmukhi", "Gurmukhi", 0x0a00, 0x0a7f},
-
- {"Gujarati", "Gujarati", 0x0a80, 0x0aff},
- {"Oriya", "Oriya", 0x0b00, 0x0b7f},
-
- {"Tamil", "Tamil", 0x0b80, 0x0bff},
- {"Tegulu", "Tegulu", 0x0c00, 0x0c7f},
-
- {"Kannada", "Kannada", 0x0c80, 0x0cff},
- {"Malayalam", "Malayalam", 0x0d00, 0x0d7f},
-
- {"Sinhala", "Sinhala", 0x0d80, 0x0dff},
- {"Thai", "Thai", 0x0e00, 0x0e7f},
-
- {"Lao", "Lao", 0x0e80, 0x0eff},
- {"Tibetan", "Tibetan", 0x0f00, 0x0fff},
-
- {"Myanmar", "Myanmar", 0x1000, 0x109f},
- {"Georgian", "Georgian", 0x10a0, 0x10ff},
-
- {"Ethiopic", "Ethiopic", 0x1200, 0x137f},
-
- {"Cherokee", "Cherokee", 0x13a0, 0x13ff},
- {"Unif. Canadian", "Unified Canadian Aboriginal Syllabics", 0x1400, 0x167f},
-
- {"Ogham", "Ogham", 0x1680, 0x169f},
- {"Runic", "Runic", 0x16a0, 0x16ff},
-
- {"Tagalog", "Tagalog", 0x1700, 0x171f},
- {"Hanunoo", "Hanunoo", 0x1720, 0x173f},
-
- {"Buhid", "Buhid", 0x1740, 0x175f},
- {"Tagbanwa", "Tagbanwa", 0x1760, 0x177f},
-
- {"Khmer", "Khmer", 0x1780, 0x17ff},
- {"Khmer Symb", "Khmer Symbols", 0x19e0, 0x19ff},
-
- {"Mongolian", "Mongolian", 0x1800, 0x18af},
-
- {"Limbu", "Limbu", 0x1900, 0x194f},
- {"Tai Le", "Tai Le", 0x1950, 0x197f},
-
- {"Phon. Ext.", "Phonetic Extensions", 0x1d00, 0x1d7f},
-
-
- {"Gen. Punct.", "General Punctutation", 0x2000, 0x206f},
- {"Super, Sub", "Superscripts and Subscripts", 0x2070, 0x209f},
-
- {"Curr. Symb.", "Currency Symbols", 0x20a0, 0x20cf},
- {"Comb. Diacrit.", "Combining Diacritical Marks for Symbols", 0x20d0, 0x20ff},
-
- {"Letter Symb", "Letterlike Symbols", 0x2100, 0x214f},
- {"Numb. Forms", "Number Forms", 0x2150, 0x218f},
-
- {"Arrows", "Arrows", 0x2190, 0x21ff},
- {"Math Oper.", "Mathematical Operators", 0x2200, 0x22ff},
-
- {"Misc. Tech.", "Miscellaneous Technical", 0x2300, 0x23ff},
- {"Ctrl. Pict.", "Control Pictures", 0x2400, 0x243f},
-
- {"OCR", "Optical Character Recognition", 0x2440, 0x245f},
- {"Enc. Alpha", "Enclosed Alphanumerics", 0x2460, 0x24ff},
-
- {"Bow Drawing", "Box Drawing", 0x2500, 0x257f},
- {"BLock Elem.", "Block Elements", 0x2580, 0x259f},
-
- {"Geom. Shapes", "Geometric Shapes", 0x25a0, 0x25ff},
- {"Misc. Symb.", "Miscellaneous Symbols", 0x2600, 0x26ff},
-
- {"Dingbats", "Dingbats", 0x2700, 0x27bf},
- {"Misc. Math A", "Miscellaneous Mathematical Symbols-A", 0x27c0, 0x27ef},
-
- {"Supp. Arrows-A", "Supplemental Arrows-A", 0x27f0, 0x27ff},
- {"Braille Pat.", "Braille Patterns", 0x2800, 0x28ff},
-
- {"Supp. Arrows-B", "Supplemental Arrows-B", 0x2900, 0x297f},
- {"Misc. Math B", "Miscellaneous Mathematical Symbols-B", 0x2980, 0x29ff},
-
- {"Supp. Math Op.", "Supplemental Mathematical Operators", 0x2a00, 0x2aff},
- {"Misc. Symb.", "Miscellaneous Symbols and Arrows", 0x2b00, 0x2bff},
-
- {"Kangxi Rad.", "Kangxi Radicals", 0x2f00, 0x2fdf},
-
- {"Ideographic", "Ideographic Description Characters", 0x2ff0, 0x2fff},
-
- {"Hiragana", "Hiragana", 0x3040, 0x309f},
- {"Katakana", "Katakana", 0x30a0, 0x30ff},
- {"Katakana Ext.", "Katakana Phonetic Extensions", 0x31f0, 0x31ff},
-
- {"Bopomofo", "Bopomofo", 0x3100, 0x312f},
- {"Bopomofo Ext.", "Bopomofo Extended", 0x31a0, 0x31bf},
-
- {"Hangul", "Hangul Jamo", 0x1100, 0x11ff},
- {"Hangul Comp.", "Hangul Compatibility Jamo", 0x3130, 0x318f},
- {"Hangul Syll.", "Hangul Syllables", 0xac00, 0xd7af},
-
- {"Kanbun", "Kanbun", 0x3190, 0x319f},
-
-
-
- {"Yijing Hex.", "Yijing Hexagram Symbols", 0x4dc0, 0x4dff},
-
- {"Yi Syllables", "Yi Syllables", 0xa000, 0xa48f},
- {"Yi Radicals", "Yi Radicals", 0xa490, 0xa4cf},
-
- {"High Surr.", "High Surrogate Area", 0xd800, 0xdbff},
-
- {"Low Surr.", "Low Surrogates", 0xdc00, 0xdfff},
- {"Priv. Use Area", "Private Use Area", 0xe000, 0xf8ff},
-
- {"CJK Rad. Supp.", "CJK Radicals Supplement", 0x2e80, 0x2eff},
- {"CJK Ideographs", "CJK Unified Ideographs", 0x4e00, 0x9faf},
- {"CJK Ideog. Ext. A", "CJK Unified Ideographs Extension A", 0x3400, 0x4dbf},
- {"CJK Ideog. Ext. B", "CJK Unified Ideographs Extension B", 0x20000, 0x2a6df},
- {"CJK Symbols.", "CJK Symbols and Punctuation", 0x3000, 0x303f},
- {"Enclosed CJK", "Enclosed CJK Letters and Months", 0x3200, 0x32ff},
- {"CJK Comp.", "CJK Compatibility", 0x3300, 0x33ff},
- {"CJK Comp. Ideog.", "CJK Compatibility Ideographs", 0xf900, 0xfaff},
- {"CJK Comp. Forms", "CJK Compatibility Forms", 0xfe30, 0xfe4f},
- {"CJK Comp. Supp.", "CJK Compatibility Ideographs Supplement", 0x2f800, 0x2fa1f},
-
- {"Alpha. Pres. Forms", "Alphabetic Presentation Forms", 0xfb00, 0xfb4f},
-
- {"Arabic Pres. A", "Arabic Presentation Forms-A", 0xfb50, 0xfdff},
- {"Arabic Pres. B", "Arabic Presentation Forms-B", 0xfe70, 0xfeff},
-
- {"Var. Sel.", "Variation Selectors", 0xfe00, 0xfe0f},
-
- {"Comb. Half", "Combining Half Marks", 0xfe20, 0xfe2f},
-
- {"Sml. From Var.", "Small Form Variants", 0xfe50, 0xfe6f},
-
- {"Half, Full Forms", "Halfwidth and Fullwidth Forms", 0xff00, 0xffef},
- {"Specials", "Specials", 0xfff0, 0xffff},
-
- {"Lin. B Syllab.", "Linear B Syllabary", 0x10000, 0x1007f},
- {"Lin. B Idog.", "Linear B Ideograms", 0x10080, 0x100ff},
-
- {"Aegean Num.", "Aegean Numbers", 0x10100, 0x1013f},
- {"Old Italic", "Old Italic", 0x10300, 0x1032f},
-
- {"Gothic", "Gothic", 0x10330, 0x1034f},
- {"Ugaritic", "Ugaritic", 0x10380, 0x1039f},
-
- {"Deseret", "Deseret", 0x10400, 0x1044f},
- {"Shavian", "Shavian", 0x10450, 0x1047f},
-
- {"Osmanya", "Osmanya", 0x10480, 0x104af},
- {"Cypriot Syll", "Cypriot Syllabary", 0x10800, 0x1083f},
-
- {"Bysantine Mus.", "Bysantine Musical Symbols", 0x1d000, 0x1d0ff},
- {"Music Symb.", "Musical Symbols", 0x1d100, 0x1d1ff},
-
- {"Tai Xuan Symb", "Tai Xuan Jing Symbols", 0x1d300, 0x1d35f},
- {"Math. Alpha Symb.", "Mathematical Alpanumeric Symbols", 0x1d400, 0x1d7ff},
-
-
- {"Tags", "Tags", 0xe0000, 0xe007f},
- {"Var. Supp", "Variation Selectors Supplement", 0xe0100, 0xe01ef},
-
- {"Supp. Priv. A", "Supplementary Private Use Area-A", 0xf0000, 0xffffd},
- {"Supp. Priv. B", "Supplementary Private Use Area-B", 0x100000, 0x10fffd}
-};
-
-
-/* *************************** static functions prototypes ****************** */
-VFont *exist_vfont(char *str);
-
-/* *************** */
-
-void do_common_editbuts(unsigned short event) // old name, is a mix of object and editing events....
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
- Base *base;
- Object *ob= OBACT;
- Material *ma;
- Nurb *nu;
- Curve *cu;
- BezTriple *bezt;
- BPoint *bp;
- unsigned int local;
- int a, bit, index= -1;
-
- switch(event) {
-
- case B_MATWICH:
- if(G.obedit && G.obedit->actcol>0) {
- if(G.obedit->type == OB_MESH) {
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->f & SELECT) {
- if(index== -1) index= efa->mat_nr;
- else if(index!=efa->mat_nr) {
- error("Mixed colors");
- return;
- }
- }
- }
- }
- else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
- nu= editNurb.first;
- while(nu) {
- if( isNurbsel(nu) ) {
- if(index== -1) index= nu->mat_nr;
- else if(index!=nu->mat_nr) {
- error("Mixed colors");
- return;
- }
- }
- nu= nu->next;
- }
- }
- if(index>=0) {
- G.obedit->actcol= index+1;
- scrarea_queue_winredraw(curarea);
- }
- }
- break;
- case B_MATNEW:
- new_material_to_objectdata(ob);
- scrarea_queue_winredraw(curarea);
- BIF_undo_push("New material");
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWVIEW3D_Z, 0);
- allqueue(REDRAWOOPS, 0);
- break;
- case B_MATDEL:
- delete_material_index();
- scrarea_queue_winredraw(curarea);
- BIF_undo_push("Delete material index");
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWVIEW3D_Z, 0);
- allqueue(REDRAWOOPS, 0);
- break;
- case B_MATASS:
- if(G.obedit && G.obedit->actcol>0) {
- if(G.obedit->type == OB_MESH) {
- efa= em->faces.first;
- while(efa) {
- if(efa->f & SELECT)
- efa->mat_nr= G.obedit->actcol-1;
- efa= efa->next;
- }
- }
- else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
- nu= editNurb.first;
- while(nu) {
- if( isNurbsel(nu) )
- nu->mat_nr= nu->charidx= G.obedit->actcol-1;
- nu= nu->next;
- }
- }
- else if (G.obedit->type == OB_FONT) {
- if (mat_to_sel()) {
- allqueue(REDRAWVIEW3D, 0);
- }
- }
- allqueue(REDRAWVIEW3D_Z, 0);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- shade_buttons_change_3d();
- BIF_undo_push("Assign material index");
- }
- break;
- case B_MATASS_BROWSE:
- /* if slot available, make that index active, and assign */
- /* else, make new slot, and assign */
- ma= BLI_findlink(&G.main->mat, G.buts->menunr-1);
- if(ma) {
- ob->actcol= find_material_index(ob, ma);
- if(ob->actcol==0) {
- assign_material(ob, ma, ob->totcol+1);
- ob->actcol= ob->totcol;
- }
- }
- else {
- do_common_editbuts(B_MATNEW);
- }
- do_common_editbuts(B_MATASS);
- break;
-
- case B_MATCOL2:
- ma= give_current_material(ob, ob->actcol);
- BKE_icon_changed(BKE_icon_getid((ID *)ma));
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- break;
-
- case B_MATSEL:
- case B_MATDESEL:
- if(G.obedit) {
- if(G.obedit->type == OB_MESH) {
- if (event==B_MATSEL) {
- editmesh_select_by_material(G.obedit->actcol-1);
- } else {
- editmesh_deselect_by_material(G.obedit->actcol-1);
- }
- allqueue(REDRAWVIEW3D, 0);
- }
- else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
- nu= editNurb.first;
- while(nu) {
- if(nu->mat_nr==G.obedit->actcol-1) {
- if(nu->bezt) {
- a= nu->pntsu;
- bezt= nu->bezt;
- while(a--) {
- if(bezt->hide==0) {
- if(event==B_MATSEL) {
- bezt->f1 |= SELECT;
- bezt->f2 |= SELECT;
- bezt->f3 |= SELECT;
- }
- else {
- bezt->f1 &= ~SELECT;
- bezt->f2 &= ~SELECT;
- bezt->f3 &= ~SELECT;
- }
- }
- bezt++;
- }
- }
- else if(nu->bp) {
- a= nu->pntsu*nu->pntsv;
- bp= nu->bp;
- while(a--) {
- if(bp->hide==0) {
- if(event==B_MATSEL) bp->f1 |= SELECT;
- else bp->f1 &= ~SELECT;
- }
- bp++;
- }
- }
- }
- nu= nu->next;
- }
- BIF_undo_push("Select material index");
- allqueue(REDRAWVIEW3D, 0);
- }
- }
- countall();
- break;
- case B_HIDE:
- if(G.obedit) {
- if(G.obedit->type == OB_MESH) hide_mesh(0);
- else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) hideNurb(0);
- }
- break;
- case B_REVEAL:
- if(G.obedit) {
- if(G.obedit->type == OB_MESH) reveal_mesh();
- else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) revealNurb();
- }
- else if(FACESEL_PAINT_TEST) reveal_tface();
-
- break;
- case B_SELSWAP:
- if(G.obedit) {
- if(G.obedit->type == OB_MESH) selectswap_mesh();
- else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) selectswapNurb();
- }
- break;
- case B_AUTOTEX:
- if(ob && G.obedit==0) {
- if(ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) tex_space_curve(ob->data);
- }
- break;
- case B_DOCENTER:
- docenter(0);
- break;
- case B_DOCENTERNEW:
- docenter_new();
- break;
- case B_DOCENTERCURSOR:
- docenter_cursor();
- break;
- case B_SETSMOOTH:
- case B_SETSOLID:
- if(G.obedit) {
- if(G.obedit->type == OB_MESH) {
- mesh_set_smooth_faces((event==B_SETSMOOTH));
- }
- else {
- nurb_set_smooth((event==B_SETSMOOTH));
- }
- }
- else if(G.vd) {
- base= FIRSTBASE;
- while(base) {
- if(TESTBASELIB(base)) {
- if(base->object->type==OB_MESH) {
- mesh_set_smooth_flag(base->object, (event==B_SETSMOOTH));
- }
- else if ELEM(base->object->type, OB_SURF, OB_CURVE) {
- cu= base->object->data;
- nu= cu->nurb.first;
- while(nu) {
- if(event==B_SETSMOOTH) nu->flag |= ME_SMOOTH;
- else nu->flag &= ~ME_SMOOTH;
- nu= nu->next;
- }
- makeDispListCurveTypes(base->object, 0);
- }
- }
- base= base->next;
- }
- allqueue(REDRAWVIEW3D, 0);
-
- if(event == B_SETSMOOTH) BIF_undo_push("Set Smooth");
- else BIF_undo_push("Set Solid");
- }
- break;
- case B_CHANGEDEP:
- DAG_scene_sort(G.scene); // makes new dag
- if(ob) ob->recalc |= OB_RECALC;
- allqueue(REDRAWVIEW3D, 0);
- break;
-
- case B_ADDKEY:
- insert_shapekey(ob);
- break;
- case B_SETKEY:
- ob->shapeflag |= OB_SHAPE_TEMPLOCK;
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- break;
- case B_LOCKKEY:
- ob->shapeflag &= ~OB_SHAPE_TEMPLOCK;
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- break;
- case B_NEXTKEY:
- {
- Key *key= ob_get_key(ob);
- if(ob->shapenr == BLI_countlist(&key->block))
- ob->shapenr= 1;
- else ob->shapenr++;
- do_common_editbuts(B_SETKEY);
- break;
- }
- case B_PREVKEY:
- {
- Key *key= ob_get_key(ob);
- if(ob->shapenr <= 1)
- ob->shapenr= BLI_countlist(&key->block);
- else ob->shapenr--;
- do_common_editbuts(B_SETKEY);
- break;
- }
- case B_NAMEKEY:
- allspace(REMAKEIPO, 0);
- allqueue (REDRAWIPO, 0);
- break;
- case B_DELKEY:
- delete_key(OBACT);
- allqueue(REDRAWACTION, 0);
- break;
-
-
- default:
- if (G.vd==NULL)
- break;
-
- if(event>=B_OBLAY && event<=B_OBLAY+31) {
- local= BASACT->lay & 0xFF000000;
- BASACT->lay -= local;
- if(BASACT->lay==0 || (G.qual & LR_SHIFTKEY)==0) {
- bit= event-B_OBLAY;
- BASACT->lay= 1<<bit;
- scrarea_queue_winredraw(curarea);
- }
- BASACT->lay += local;
- /* optimal redraw */
- if( (ob->lay & G.vd->lay) && (BASACT->lay & G.vd->lay) );
- else if( (ob->lay & G.vd->lay)==0 && (BASACT->lay & G.vd->lay)==0 );
- else {
- allqueue(REDRAWVIEW3D, 0);
- DAG_scene_sort(G.scene);
- }
- ob->lay= BASACT->lay;
- }
- }
-
-}
-
-/* *************************** MESH ******************************** */
-
-static void verify_customdata_name_func(void *data1, void *data2)
-{
- CustomData *data= (CustomData*)data1;
- CustomDataLayer *layer= (CustomDataLayer*)data2;
-
- CustomData_set_layer_unique_name(data, layer - data->layers);
-}
-
-static void delete_customdata_layer(void *data1, void *data2)
-{
- Mesh *me= (Mesh*)data1;
- CustomData *data= (G.obedit)? &G.editMesh->fdata: &me->fdata;
- CustomDataLayer *layer= (CustomDataLayer*)data2;
- void *actlayerdata, *rndlayerdata, *layerdata=layer->data;
- int type= layer->type;
- int index= CustomData_get_layer_index(data, type);
- int i, actindex, rndindex;
-
- /*ok, deleting a non-active layer needs to preserve the active layer indices.
- to do this, we store a pointer to the .data member of both layer and the active layer,
- (to detect if we're deleting the active layer or not), then use the active
- layer data pointer to find where the active layer has ended up.
-
- this is necassary because the deletion functions only support deleting the active
- layer. */
- actlayerdata = data->layers[CustomData_get_active_layer_index(data, type)].data;
- rndlayerdata = data->layers[CustomData_get_render_layer_index(data, type)].data;
- CustomData_set_layer_active(data, type, layer - &data->layers[index]);
-
- /* Multires is handled seperately because the display data is separate
- from the data stored in multires */
- if(me && me->mr) {
- multires_delete_layer(me, &me->mr->fdata, type, layer - &data->layers[index]);
- }
- else if(G.obedit) {
- EM_free_data_layer(data, type);
- }
- else if(me) {
- CustomData_free_layer_active(data, type, me->totface);
- mesh_update_customdata_pointers(me);
- }
-
- if(!CustomData_has_layer(data, type)) {
- if(type == CD_MCOL && (G.f & G_VERTEXPAINT))
- G.f &= ~G_VERTEXPAINT; /* get out of vertexpaint mode */
- }
-
- /*reconstruct active layer*/
- if (actlayerdata != layerdata) {
- /*find index. . .*/
- actindex = CustomData_get_layer_index(data, type);
- for (i=actindex; i<data->totlayer; i++) {
- if (data->layers[i].data == actlayerdata) {
- actindex = i - actindex;
- break;
- }
- }
-
- /*set index. . .*/
- CustomData_set_layer_active(data, type, actindex);
- }
-
- if (rndlayerdata != layerdata) {
- /*find index. . .*/
- rndindex = CustomData_get_layer_index(data, type);
- for (i=rndindex; i<data->totlayer; i++) {
- if (data->layers[i].data == rndlayerdata) {
- rndindex = i - rndindex;
- break;
- }
- }
-
- /*set index. . .*/
- CustomData_set_layer_render(data, type, rndindex);
- }
-
-
- DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
-
- if(type == CD_MTFACE)
- BIF_undo_push("Delete UV Texture");
- else if(type == CD_MCOL)
- BIF_undo_push("Delete Vertex Color");
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIMAGE, 0);
- allqueue(REDRAWBUTSEDIT, 0);
-}
-
-static int customdata_buttons(
- uiBlock *block, Mesh *me, CustomData *data,
- int type, int *activep, int *renderp,
- int setevt, int setevt_rnd, int newevt,
- char *label, char *shortlabel, char *browsetip, char *browsetip_rnd,
- char *newtip, char *deltip, int x, int y)
-{
- CustomDataLayer *layer;
- uiBut *but;
- int i, count= CustomData_number_of_layers(data, type);
-
- if(count >= MAX_MTFACE) {
- uiDefBut(block, LABEL, 0, label, x,y,220,19, 0, 0.0, 0, 0, 0, "");
- }
- else {
- uiDefBut(block, LABEL, 0, label, x,y,140,19, 0, 0.0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefBut(block, BUT, newevt, "New", x+140,y,80,19, 0,0,0,0,0, newtip);
- uiBlockEndAlign(block);
- }
-
- y -= (count)? 24: 19;
-
- uiBlockBeginAlign(block);
- for (count=1, i=0; i<data->totlayer; i++) {
- layer= &data->layers[i];
-
- if(layer->type == type) {
- *activep= layer->active + 1;
- *renderp= layer->active_rnd + 1;
-
- uiDefIconButI(block, ROW, setevt, ICON_VIEW3D, x,y,25,19, activep, 1.0, count, 0, 0, browsetip);
- uiDefIconButI(block, ROW, setevt_rnd, ICON_SCENE, x+25,y,25,19, renderp, 1.0, count, 0, 0, browsetip_rnd);
- but=uiDefBut(block, TEX, setevt, "", x+50,y,145,19, layer->name, 0.0, 31.0, 0, 0, label);
- uiButSetFunc(but, verify_customdata_name_func, data, layer);
- but= uiDefIconBut(block, BUT, B_NOP, VICON_X, x+195,y,25,19, NULL, 0.0, 0.0, 0.0, 0.0, deltip);
- uiButSetFunc(but, delete_customdata_layer, me, layer);
-
-
- count++;
- y -= 19;
- }
- }
- uiBlockEndAlign(block);
-
- return y;
-}
-
-static void editing_panel_mesh_type(Object *ob, Mesh *me)
-{
- uiBlock *block;
- uiBut *but;
- float val;
- CustomData *fdata;
- int yco;
-
- block= uiNewBlock(&curarea->uiblocks, "editing_panel_mesh_type", UI_EMBOSS, UI_HELV, curarea->win);
- if( uiNewPanel(curarea, block, "Mesh", "Editing", 320, 0, 318, 204)==0) return;
- uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, ME_AUTOSMOOTH, REDRAWVIEW3D, "Auto Smooth",10,180,170,19, &me->flag, 0, 0, 0, 0, "Treats all set-smoothed faces with angles less than Degr: as 'smooth' during render");
- uiDefButS(block, NUM, B_DIFF, "Degr:", 10,160,170,19, &me->smoothresh, 1, 80, 0, 0, "Defines maximum angle between face normals that 'Auto Smooth' will operate on");
- uiBlockEndAlign(block);
-
- /* Retopo */
- if(G.obedit) {
- uiBlockBeginAlign(block);
- but= uiDefButBitC(block,TOG,RETOPO,B_NOP, "Retopo", 10,130,170,19, &G.scene->toolsettings->retopo_mode, 0,0,0,0, "Turn on the re-topology tool");
- uiButSetFunc(but,retopo_toggle,ob,me);
- if(G.scene->toolsettings->retopo_mode) {
- but= uiDefButBitC(block,TOG,RETOPO_PAINT,B_NOP,"Paint", 10,110,55,19, &G.scene->toolsettings->retopo_mode,0,0,0,0, "Draw intersecting lines in the 3d view, ENTER creates quad or tri faces, wrapped onto other objects in the 3d view.");
- uiButSetFunc(but,retopo_paint_toggle,ob,me);
- but= uiDefBut(block,BUT,B_NOP,"Retopo All", 65,110,115,19, 0,0,0,0,0, "Apply the re-topology tool to all selected vertices");
- uiButSetFunc(but,retopo_do_all_cb,ob,me);
- }
- uiBlockEndAlign(block);
- }
-
- uiBlockBeginAlign(block);
- uiDefBut(block, BUT,B_DOCENTER, "Center", 10, 80, 65, 19, 0, 0, 0, 0, 0, "Shifts object data to be centered about object's origin");
- uiDefBut(block, BUT,B_DOCENTERNEW, "Center New", 75, 80, 105, 19, 0, 0, 0, 0, 0, "Shifts object's origin to center of object data");
- uiDefBut(block, BUT,B_DOCENTERCURSOR, "Center Cursor", 10, 60, 170, 19, 0, 0, 0, 0, 0, "Shifts object's origin to cursor location");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, ME_TWOSIDED, REDRAWVIEW3D, "Double Sided", 10,30,170,19, &me->flag, 0, 0, 0, 0, "Render/display the mesh as double or single sided");
- uiDefButBitS(block, TOG, ME_NOPUNOFLIP, REDRAWVIEW3D, "No V.Normal Flip", 10,10,170,19, &me->flag, 0, 0, 0, 0, "Disables flipping of vertexnormals during render");
- uiBlockEndAlign(block);
-
- uiDefIDPoinBut(block, test_meshpoin_but, ID_ME, B_REDR, "TexMesh: ", 190,180,220,19, &me->texcomesh, "Derive texture coordinates from another mesh.");
-
- if(me->msticky) val= 1.0; else val= 0.0;
- uiDefBut(block, LABEL, 0, "Sticky", 190,155,140,19, 0, val, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- if(me->msticky==NULL) {
- uiDefBut(block, BUT, B_MAKESTICKY, "Make", 330,155, 80,19, 0, 0, 0, 0, 0, "Creates Sticky coordinates from the current camera view background picture");
- }
- else uiDefBut(block, BUT, B_DELSTICKY, "Delete", 330,155, 80,19, 0, 0, 0, 0, 0, "Deletes Sticky texture coordinates");
- uiBlockEndAlign(block);
-
- fdata= (G.obedit)? &G.editMesh->fdata: &me->fdata;
- yco= customdata_buttons(block, me, fdata, CD_MTFACE, &acttface, &acttface_rnd,
- B_SETTFACE, B_SETTFACE_RND, B_NEWTFACE, "UV Texture", "UV Texture:",
- "Set active UV texture", "Set rendering UV texture", "Creates a new UV texture layer",
- "Removes the current UV texture layer", 190, 130);
-
- yco= customdata_buttons(block, me, fdata, CD_MCOL, &actmcol, &actmcol_rnd,
- B_SETMCOL, B_SETMCOL_RND, B_NEWMCOL, "Vertex Color", "Vertex Color:",
- "Sets active vertex color layer", "Sets rendering vertex color layer", "Creates a new vertex color layer",
- "Removes the current vertex color layer", 190, yco-5);
-
- if(yco < 0)
- uiNewPanelHeight(block, 204 - yco);
-}
-
-/* *************************** MODIFIERS ******************************** */
-
-void do_modifier_panels(unsigned short event)
-{
- Object *ob = OBACT;
-
- switch(event) {
- case B_MODIFIER_REDRAW:
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWOOPS, 0);
- break;
-
- case B_MODIFIER_RECALC:
- ob->softflag |= OB_SB_RESET;
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIMAGE, 0);
- allqueue(REDRAWOOPS, 0);
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- object_handle_update(ob);
- countall();
- break;
- }
-}
-
-static void modifiers_add(void *ob_v, int type)
-{
- Object *ob = ob_v;
- ModifierTypeInfo *mti = modifierType_getInfo(type);
-
- if (mti->flags&eModifierTypeFlag_RequiresOriginalData) {
- ModifierData *md = ob->modifiers.first;
-
- while (md && modifierType_getInfo(md->type)->type==eModifierTypeType_OnlyDeform) {
- md = md->next;
- }
-
- BLI_insertlinkbefore(&ob->modifiers, md, modifier_new(type));
- } else {
- BLI_addtail(&ob->modifiers, modifier_new(type));
- }
- BIF_undo_push("Add modifier");
-}
-
-typedef struct MenuEntry {
- char *name;
- int ID;
-} MenuEntry;
-
-static int menuEntry_compare_names(const void *entry1, const void *entry2)
-{
- return strcmp(((MenuEntry *)entry1)->name, ((MenuEntry *)entry2)->name);
-}
-
-static uiBlock *modifiers_add_menu(void *ob_v)
-{
- Object *ob = ob_v;
- uiBlock *block;
- int i, yco=0;
- int numEntries = 0;
- MenuEntry entries[NUM_MODIFIER_TYPES];
-
- block= uiNewBlock(&curarea->uiblocks, "modifier_add_menu",
- UI_EMBOSSP, UI_HELV, curarea->win);
- uiBlockSetButmFunc(block, modifiers_add, ob);
-
- for (i=eModifierType_None+1; i<NUM_MODIFIER_TYPES; i++) {
- ModifierTypeInfo *mti = modifierType_getInfo(i);
-
- /* Only allow adding through appropriate other interfaces */
- if(ELEM3(i, eModifierType_Softbody, eModifierType_Hook, eModifierType_ParticleSystem)) continue;
-
- if((mti->flags&eModifierTypeFlag_AcceptsCVs) ||
- (ob->type==OB_MESH && (mti->flags&eModifierTypeFlag_AcceptsMesh))) {
- entries[numEntries].name = mti->name;
- entries[numEntries].ID = i;
-
- ++numEntries;
- }
- }
-
- qsort(entries, numEntries, sizeof(*entries), menuEntry_compare_names);
-
-
- for(i = 0; i < numEntries; ++i)
- uiDefBut(block, BUTM, B_MODIFIER_RECALC, entries[i].name,
- 0, yco -= 20, 160, 19, NULL, 0, 0, 1, entries[i].ID, "");
-
- uiTextBoundsBlock(block, 50);
- uiBlockSetDirection(block, UI_DOWN);
-
- return block;
-}
-
-static void modifiers_del(void *ob_v, void *md_v)
-{
- Object *ob = ob_v;
- ModifierData *md;
-
- /* It seems on rapid delete it is possible to
- * get called twice on same modifier, so make
- * sure it is in list.
- */
- for (md=ob->modifiers.first; md; md=md->next)
- if (md==md_v)
- break;
-
- if (!md)
- return;
-
- if(md->type==eModifierType_ParticleSystem){
- ParticleSystemModifierData *psmd=(ParticleSystemModifierData*)md;
- BLI_remlink(&ob->particlesystem, psmd->psys);
- psys_free(ob,psmd->psys);
- }
-
- BLI_remlink(&ob->modifiers, md_v);
-
- modifier_free(md_v);
-
- BIF_undo_push("Del modifier");
-}
-
-int mod_moveUp(void *ob_v, void *md_v)
-{
- Object *ob = ob_v;
- ModifierData *md = md_v;
-
- if (md->prev) {
- ModifierTypeInfo *mti = modifierType_getInfo(md->type);
-
- if (mti->type!=eModifierTypeType_OnlyDeform) {
- ModifierTypeInfo *nmti = modifierType_getInfo(md->prev->type);
-
- if (nmti->flags&eModifierTypeFlag_RequiresOriginalData)
- return -1;
- }
-
- BLI_remlink(&ob->modifiers, md);
- BLI_insertlink(&ob->modifiers, md->prev->prev, md);
- }
-
- return 0;
-}
-
-static void modifiers_moveUp(void *ob_v, void *md_v)
-{
- if( mod_moveUp( ob_v, md_v ) )
- error("Cannot move above a modifier requiring original data.");
- else
- BIF_undo_push("Move modifier");
-}
-
-int mod_moveDown(void *ob_v, void *md_v)
-{
- Object *ob = ob_v;
- ModifierData *md = md_v;
-
- if (md->next) {
- ModifierTypeInfo *mti = modifierType_getInfo(md->type);
-
- if (mti->flags&eModifierTypeFlag_RequiresOriginalData) {
- ModifierTypeInfo *nmti = modifierType_getInfo(md->next->type);
-
- if (nmti->type!=eModifierTypeType_OnlyDeform)
- return -1;
- }
-
- BLI_remlink(&ob->modifiers, md);
- BLI_insertlink(&ob->modifiers, md->next, md);
- }
-
- return 0;
-}
-
-static void modifiers_moveDown(void *ob_v, void *md_v)
-{
- if( mod_moveDown( ob_v, md_v ) )
- error("Cannot move beyond a non-deforming modifier.");
- else
- BIF_undo_push("Move modifier");
-}
-
-static void modifier_testLatticeObj(char *name, ID **idpp)
-{
- ID *id;
-
- for (id= G.main->object.first; id; id= id->next) {
- if( strcmp(name, id->name+2)==0 ) {
- if (((Object *)id)->type != OB_LATTICE) {
- error ("Lattice deform object must be a lattice");
- break;
- }
- *idpp= id;
- return;
- }
- }
- *idpp= 0;
-}
-
-static void modifier_testCurveObj(char *name, ID **idpp)
-{
- ID *id;
-
- for (id= G.main->object.first; id; id= id->next) {
- if( strcmp(name, id->name+2)==0 ) {
- if (((Object *)id)->type != OB_CURVE) {
- error ("Curve deform object must be a curve");
- break;
- }
- *idpp= id;
- return;
- }
- }
- *idpp= 0;
-}
-
-static void modifier_testMeshObj(char *name, ID **idpp)
-{
- ID *id;
-
- for (id= G.main->object.first; id; id= id->next) {
- /* no boolean on its own object */
- if(id != (ID *)OBACT) {
- if( strcmp(name, id->name+2)==0 ) {
- if (((Object *)id)->type != OB_MESH) {
- error ("Boolean modifier object must be a mesh");
- break;
- }
- *idpp= id;
- return;
- }
- }
- }
- *idpp= NULL;
-}
-
-static void modifier_testArmatureObj(char *name, ID **idpp)
-{
- ID *id;
-
- for (id= G.main->object.first; id; id= id->next) {
- if( strcmp(name, id->name+2)==0 ) {
- if (((Object *)id)->type != OB_ARMATURE) {
- error ("Armature deform object must be an armature");
- break;
- }
- *idpp= id;
- return;
- }
- }
- *idpp= 0;
-}
-
-static void modifier_testTexture(char *name, ID **idpp)
-{
- ID *id;
-
- for(id = G.main->tex.first; id; id = id->next) {
- if(strcmp(name, id->name + 2) == 0) {
- *idpp = id;
- /* texture gets user, objects not: delete object = clear modifier */
- id_us_plus(id);
- return;
- }
- }
- *idpp = 0;
-}
-
-#if 0 /* this is currently unused, but could be useful in the future */
-static void modifier_testMaterial(char *name, ID **idpp)
-{
- ID *id;
-
- for(id = G.main->mat.first; id; id = id->next) {
- if(strcmp(name, id->name + 2) == 0) {
- *idpp = id;
- return;
- }
- }
- *idpp = 0;
-}
-#endif
-
-static void modifier_testImage(char *name, ID **idpp)
-{
- ID *id;
-
- for(id = G.main->image.first; id; id = id->next) {
- if(strcmp(name, id->name + 2) == 0) {
- *idpp = id;
- return;
- }
- }
- *idpp = 0;
-}
-
-/* autocomplete callback for ID buttons */
-void autocomplete_image(char *str, void *arg_v)
-{
- /* search if str matches the beginning of an ID struct */
- if(str[0]) {
- AutoComplete *autocpl = autocomplete_begin(str, 22);
- ID *id;
-
- for(id = G.main->image.first; id; id = id->next)
- autocomplete_do_name(autocpl, id->name+2);
-
- autocomplete_end(autocpl, str);
- }
-}
-
-/* autocomplete callback for ID buttons */
-void autocomplete_meshob(char *str, void *arg_v)
-{
- /* search if str matches the beginning of an ID struct */
- if(str[0]) {
- AutoComplete *autocpl = autocomplete_begin(str, 22);
- ID *id;
-
- for(id = G.main->object.first; id; id = id->next)
- if(((Object *)id)->type == OB_MESH)
- autocomplete_do_name(autocpl, id->name+2);
-
- autocomplete_end(autocpl, str);
- }
-}
-static void modifiers_convertParticles(void *obv, void *mdv)
-{
- Object *obn;
- ModifierData *md = mdv;
- ParticleSystem *psys;
- ParticleCacheKey *key, **cache;
- Mesh *me;
- MVert *mvert;
- MFace *mface;
- int a, k, kmax;
- int totvert=0, totface=0, cvert=0;
- int totpart=0, totchild=0;
-
- if(md->type != eModifierType_ParticleSystem) return;
-
- if(G.f & G_PARTICLEEDIT) return;
-
- psys=((ParticleSystemModifierData *)md)->psys;
-
- if(psys->part->draw_as != PART_DRAW_PATH || psys->pathcache == 0) return;
-
- totpart= psys->totcached;
- totchild= psys->totchildcache;
-
- if(totchild && (psys->part->draw&PART_DRAW_PARENT)==0)
- totpart= 0;
-
- /* count */
- cache= psys->pathcache;
- for(a=0; a<totpart; a++) {
- key= cache[a];
- totvert+= (int)(key->col[3])+1;
- totface+= (int)(key->col[3]);
- }
-
- cache= psys->childcache;
- for(a=0; a<totchild; a++) {
- key= cache[a];
- totvert+= (int)(key->col[3])+1;
- totface+= (int)(key->col[3]);
- }
-
- if(totvert==0) return;
-
- /* add new mesh */
- obn= add_object(OB_MESH);
- me= obn->data;
-
- me->totvert= totvert;
- me->totface= totface;
-
- me->mvert= CustomData_add_layer(&me->vdata, CD_MVERT, CD_CALLOC, NULL, totvert);
- me->mface= CustomData_add_layer(&me->fdata, CD_MFACE, CD_CALLOC, NULL, totface);
-
- mvert= me->mvert;
- mface= me->mface;
-
- /* copy coordinates */
- cache= psys->pathcache;
- for(a=0; a<totpart; a++){
- key= cache[a];
- kmax= (int)(key->col[3]);
- for(k=0; k<=kmax; k++,key++,cvert++,mvert++) {
- VECCOPY(mvert->co,key->co);
- if(k){
- mface->v1= cvert-1;
- mface->v2= cvert;
- mface++;
- }
- }
- }
-
- cache=psys->childcache;
- for(a=0; a<totchild; a++) {
- key=cache[a];
- kmax=(int)(key->col[3]);
- for(k=0; k<=kmax; k++,key++,cvert++,mvert++) {
- VECCOPY(mvert->co,key->co);
- if(k){
- mface->v1=cvert-1;
- mface->v2=cvert;
- mface++;
- }
- }
- }
- make_edges(me, 0);
-}
-static void modifiers_applyModifier(void *obv, void *mdv)
-{
- Object *ob = obv;
- ModifierData *md = mdv;
- DerivedMesh *dm;
- Mesh *me = ob->data;
- int converted = 0;
-
- if (G.obedit) {
- error("Modifiers cannot be applied in editmode");
- return;
- } else if (((ID*) ob->data)->us>1) {
- error("Modifiers cannot be applied to multi-user data");
- return;
- }
-
- if (md!=ob->modifiers.first) {
- if (!okee("Modifier is not first"))
- return;
- }
-
- if (ob->type==OB_MESH) {
- if(me->mr && multires_modifier_warning()) {
- error("Modifier changes topology; cannot apply with multires active");
- return;
- }
- if(me->key) {
- error("Modifier cannot be applied to Mesh with Shape Keys");
- return;
- }
-
- sculptmode_pmv_off(me);
-
- dm = mesh_create_derived_for_modifier(ob, md);
- if (!dm) {
- error("Modifier is disabled or returned error, skipping apply");
- return;
- }
-
- DM_to_mesh(dm, me);
- converted = 1;
-
- dm->release(dm);
- }
- else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
- ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- Curve *cu = ob->data;
- int numVerts;
- float (*vertexCos)[3];
-
- if (!okee("Apply will only change CV points, not tesselated/bevel vertices"))
- return;
-
- if (!(md->mode&eModifierMode_Realtime) || (mti->isDisabled && mti->isDisabled(md))) {
- error("Modifier is disabled, skipping apply");
- return;
- }
-
- vertexCos = curve_getVertexCos(cu, &cu->nurb, &numVerts);
- mti->deformVerts(md, ob, NULL, vertexCos, numVerts);
- curve_applyVertexCos(cu, &cu->nurb, vertexCos);
-
- converted = 1;
-
- MEM_freeN(vertexCos);
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- }
- else {
- error("Cannot apply modifier for this object type");
- return;
- }
-
- if (converted) {
- BLI_remlink(&ob->modifiers, md);
- modifier_free(md);
-
- BIF_undo_push("Apply modifier");
- }
-}
-
-static void modifiers_copyModifier(void *ob_v, void *md_v)
-{
- Object *ob = ob_v;
- ModifierData *md = md_v;
- ModifierData *nmd = modifier_new(md->type);
-
- modifier_copyData(md, nmd);
-
- BLI_insertlink(&ob->modifiers, md, nmd);
-
- BIF_undo_push("Copy modifier");
-}
-
-static void modifiers_setOnCage(void *ob_v, void *md_v)
-{
- Object *ob = ob_v;
- ModifierData *md;
-
- int i, cageIndex = modifiers_getCageIndex(ob, NULL );
-
- for( i = 0, md=ob->modifiers.first; md; ++i, md=md->next )
- if( md == md_v ) {
- if( i >= cageIndex )
- md->mode ^= eModifierMode_OnCage;
- break;
- }
-}
-
-static void modifiers_clearHookOffset(void *ob_v, void *md_v)
-{
- Object *ob = ob_v;
- ModifierData *md = md_v;
- HookModifierData *hmd = (HookModifierData*) md;
-
- if (hmd->object) {
- Mat4Invert(hmd->object->imat, hmd->object->obmat);
- Mat4MulSerie(hmd->parentinv, hmd->object->imat, ob->obmat, NULL, NULL, NULL, NULL, NULL, NULL);
- BIF_undo_push("Clear hook offset");
- }
-}
-
-static void modifiers_cursorHookCenter(void *ob_v, void *md_v)
-{
- Object *ob = ob_v;
- ModifierData *md = md_v;
- HookModifierData *hmd = (HookModifierData*) md;
-
- if (G.vd) {
- float *curs = give_cursor();
- float bmat[3][3], imat[3][3];
-
- where_is_object(ob);
-
- Mat3CpyMat4(bmat, ob->obmat);
- Mat3Inv(imat, bmat);
-
- curs= give_cursor();
- hmd->cent[0]= curs[0]-ob->obmat[3][0];
- hmd->cent[1]= curs[1]-ob->obmat[3][1];
- hmd->cent[2]= curs[2]-ob->obmat[3][2];
- Mat3MulVecfl(imat, hmd->cent);
-
- BIF_undo_push("Hook cursor center");
- }
-}
-
-static void modifiers_selectHook(void *ob_v, void *md_v)
-{
- ModifierData *md = md_v;
- HookModifierData *hmd = (HookModifierData*) md;
-
- hook_select(hmd);
-}
-
-static void modifiers_reassignHook(void *ob_v, void *md_v)
-{
- ModifierData *md = md_v;
- HookModifierData *hmd = (HookModifierData*) md;
- float cent[3];
- int *indexar, tot, ok;
- char name[32];
-
- ok= hook_getIndexArray(&tot, &indexar, name, cent);
-
- if (!ok) {
- error("Requires selected vertices or active Vertex Group");
- } else {
- if (hmd->indexar) {
- MEM_freeN(hmd->indexar);
- }
-
- VECCOPY(hmd->cent, cent);
- hmd->indexar = indexar;
- hmd->totindex = tot;
- }
-}
-
-static void modifiers_convertToReal(void *ob_v, void *md_v)
-{
- Object *ob = ob_v;
- ModifierData *md = md_v;
- ModifierData *nmd = modifier_new(md->type);
-
- modifier_copyData(md, nmd);
- nmd->mode &= ~eModifierMode_Virtual;
-
- BLI_addhead(&ob->modifiers, nmd);
-
- ob->partype = PAROBJECT;
-
- BIF_undo_push("Modifier convert to real");
-}
-
-static void build_uvlayer_menu_vars(CustomData *data, char **menu_string,
- int *uvlayer_tmp, char *uvlayer_name)
-{
- char strtmp[38];
- int totuv, i;
- CustomDataLayer *layer
- = &data->layers[CustomData_get_layer_index(data, CD_MTFACE)];
-
- *uvlayer_tmp = -1;
-
- totuv = CustomData_number_of_layers(data, CD_MTFACE);
-
- *menu_string = MEM_callocN(sizeof(**menu_string) * (totuv * 38 + 10),
- "menu_string");
- sprintf(*menu_string, "UV Layer%%t");
- for(i = 0; i < totuv; i++) {
- /* assign first layer as uvlayer_name if uvlayer_name is null. */
- if(strcmp(layer->name, uvlayer_name) == 0) *uvlayer_tmp = i + 1;
- sprintf(strtmp, "|%s%%x%d", layer->name, i + 1);
- strcat(*menu_string, strtmp);
- layer++;
- }
-
- /* there is no uvlayer defined, or else it was deleted. Assign active
- * layer, then recalc modifiers.
- */
- if(*uvlayer_tmp == -1) {
- if(CustomData_get_active_layer_index(data, CD_MTFACE) != -1) {
- *uvlayer_tmp = 1;
- layer = data->layers;
- for(i = 0; i < CustomData_get_active_layer_index(data, CD_MTFACE);
- i++, layer++) {
- if(layer->type == CD_MTFACE) (*uvlayer_tmp)++;
- }
- strcpy(uvlayer_name, layer->name);
-
- /* update the modifiers */
- do_modifier_panels(B_MODIFIER_RECALC);
- } else {
- /* ok we have no uv layers, so make sure menu button knows that.*/
- *uvlayer_tmp = 0;
- }
- }
-}
-
-void set_displace_uvlayer(void *arg1, void *arg2)
-{
- DisplaceModifierData *dmd=arg1;
- CustomDataLayer *layer = arg2;
-
- /*check we have UV layers*/
- if (dmd->uvlayer_tmp < 1) return;
- layer = layer + (dmd->uvlayer_tmp-1);
-
- strcpy(dmd->uvlayer_name, layer->name);
-}
-
-void set_uvproject_uvlayer(void *arg1, void *arg2)
-{
- UVProjectModifierData *umd=arg1;
- CustomDataLayer *layer = arg2;
-
- /*check we have UV layers*/
- if (umd->uvlayer_tmp < 1) return;
- layer = layer + (umd->uvlayer_tmp-1);
-
- strcpy(umd->uvlayer_name, layer->name);
-}
-
-static void modifiers_bindMeshDeform(void *ob_v, void *md_v)
-{
- MeshDeformModifierData *mmd = (MeshDeformModifierData*) md_v;
- Object *ob = (Object*)ob_v;
-
- if(mmd->bindcos) {
- if(mmd->bindweights) MEM_freeN(mmd->bindweights);
- if(mmd->bindcos) MEM_freeN(mmd->bindcos);
- if(mmd->dyngrid) MEM_freeN(mmd->dyngrid);
- if(mmd->dyninfluences) MEM_freeN(mmd->dyninfluences);
- if(mmd->dynverts) MEM_freeN(mmd->dynverts);
- mmd->bindweights= NULL;
- mmd->bindcos= NULL;
- mmd->dyngrid= NULL;
- mmd->dyninfluences= NULL;
- mmd->dynverts= NULL;
- mmd->totvert= 0;
- mmd->totcagevert= 0;
- mmd->totinfluence= 0;
- }
- else {
- DerivedMesh *dm;
- int mode= mmd->modifier.mode;
-
- /* force modifier to run, it will call binding routine */
- mmd->needbind= 1;
- mmd->modifier.mode |= eModifierMode_Realtime;
-
- if(ob->type == OB_MESH) {
- dm= mesh_create_derived_view(ob, 0);
- dm->release(dm);
- }
- else if(ob->type == OB_LATTICE) {
- lattice_calc_modifiers(ob);
- }
- else if(ob->type==OB_MBALL) {
- makeDispListMBall(ob);
- }
- else if(ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
- makeDispListCurveTypes(ob, 0);
- }
-
- mmd->needbind= 0;
- mmd->modifier.mode= mode;
- }
-}
-
-void modifiers_explodeFacepa(void *arg1, void *arg2)
-{
- ExplodeModifierData *emd=arg1;
-
- emd->flag |= eExplodeFlag_CalcFaces;
-}
-
-static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco, int *yco, int index, int cageIndex, int lastCageIndex)
-{
- ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- uiBut *but;
- int isVirtual = md->mode&eModifierMode_Virtual;
- int x = *xco, y = *yco, color = md->error?TH_REDALERT:TH_BUT_NEUTRAL;
- int editing = (G.obedit==ob);
- short height=26, width = 295, buttonWidth = width-120-10;
- char str[128];
-
- /* rounded header */
- uiBlockSetCol(block, color);
- /* roundbox 4 free variables: corner-rounding, nop, roundbox type, shade */
- uiDefBut(block, ROUNDBOX, 0, "", x-10, y-4, width, 25, NULL, 7.0, 0.0,
- (!isVirtual && (md->mode&eModifierMode_Expanded))?3:15, 20, "");
- uiBlockSetCol(block, TH_AUTO);
-
- /* open/close icon */
- if (!isVirtual) {
- uiBlockSetEmboss(block, UI_EMBOSSN);
- uiDefIconButBitI(block, ICONTOG, eModifierMode_Expanded, B_MODIFIER_REDRAW, VICON_DISCLOSURE_TRI_RIGHT, x-10, y-2, 20, 20, &md->mode, 0.0, 0.0, 0.0, 0.0, "Collapse/Expand Modifier");
- }
-
- uiBlockSetEmboss(block, UI_EMBOSS);
-
- if (isVirtual) {
- sprintf(str, "%s parent deform", md->name);
- uiDefBut(block, LABEL, 0, str, x+10, y-1, width-110, 19, NULL, 0.0, 0.0, 0.0, 0.0, "Modifier name");
-
- but = uiDefBut(block, BUT, B_MODIFIER_RECALC, "Make Real", x+width-100, y, 80, 16, NULL, 0.0, 0.0, 0.0, 0.0, "Convert virtual modifier to a real modifier");
- uiButSetFunc(but, modifiers_convertToReal, ob, md);
- } else {
- uiBlockBeginAlign(block);
- uiDefBut(block, TEX, B_MODIFIER_REDRAW, "", x+10, y-1, buttonWidth-60, 19, md->name, 0.0, sizeof(md->name)-1, 0.0, 0.0, "Modifier name");
-
- /* Softbody not allowed in this situation, enforce! */
- if (md->type!=eModifierType_Softbody || !(ob->pd && ob->pd->deflect)) {
- uiDefIconButBitI(block, TOG, eModifierMode_Render, B_MODIFIER_RECALC, ICON_SCENE, x+10+buttonWidth-60, y-1, 19, 19,&md->mode, 0, 0, 1, 0, "Enable modifier during rendering");
- but= uiDefIconButBitI(block, TOG, eModifierMode_Realtime, B_MODIFIER_RECALC, VICON_VIEW3D, x+10+buttonWidth-40, y-1, 19, 19,&md->mode, 0, 0, 1, 0, "Enable modifier during interactive display");
- if (mti->flags&eModifierTypeFlag_SupportsEditmode) {
- uiDefIconButBitI(block, TOG, eModifierMode_Editmode, B_MODIFIER_RECALC, VICON_EDIT, x+10+buttonWidth-20, y-1, 19, 19,&md->mode, 0, 0, 1, 0, "Enable modifier during Editmode (only if enabled for display)");
- }
- }
- uiBlockEndAlign(block);
-
- uiBlockSetEmboss(block, UI_EMBOSSR);
-
- if (ob->type==OB_MESH && modifier_couldBeCage(md) && index<=lastCageIndex) {
- int icon, color;
-
- if (index==cageIndex) {
- color = TH_BUT_SETTING;
- icon = VICON_EDITMODE_HLT;
- } else if (index<cageIndex) {
- color = TH_BUT_NEUTRAL;
- icon = VICON_EDITMODE_DEHLT;
- } else {
- color = TH_BUT_NEUTRAL;
- icon = ICON_BLANK1;
- }
- uiBlockSetCol(block, color);
- but = uiDefIconBut(block, BUT, B_MODIFIER_RECALC, icon, x+width-105, y, 16, 16, NULL, 0.0, 0.0, 0.0, 0.0, "Apply modifier to editing cage during Editmode");
- uiButSetFunc(but, modifiers_setOnCage, ob, md);
- uiBlockSetCol(block, TH_AUTO);
- }
-
- uiBlockSetCol(block, TH_BUT_ACTION);
-
- but = uiDefIconBut(block, BUT, B_MODIFIER_RECALC, VICON_MOVE_UP, x+width-75, y, 16, 16, NULL, 0.0, 0.0, 0.0, 0.0, "Move modifier up in stack");
- uiButSetFunc(but, modifiers_moveUp, ob, md);
-
- but = uiDefIconBut(block, BUT, B_MODIFIER_RECALC, VICON_MOVE_DOWN, x+width-75+20, y, 16, 16, NULL, 0.0, 0.0, 0.0, 0.0, "Move modifier down in stack");
- uiButSetFunc(but, modifiers_moveDown, ob, md);
-
- uiBlockSetEmboss(block, UI_EMBOSSN);
-
- but = uiDefIconBut(block, BUT, B_MODIFIER_RECALC, VICON_X, x+width-70+40, y, 16, 16, NULL, 0.0, 0.0, 0.0, 0.0, "Delete modifier");
- uiButSetFunc(but, modifiers_del, ob, md);
- uiBlockSetCol(block, TH_AUTO);
- }
-
- uiBlockSetEmboss(block, UI_EMBOSS);
-
- if (isVirtual || !(md->mode&eModifierMode_Expanded)) {
- y -= 18;
- } else {
- int cy = y - 8;
- int lx = x + width - 60 - 15;
-
- if (md->type==eModifierType_Subsurf) {
- height = 105;
- } else if (md->type==eModifierType_Lattice) {
- height = 48;
- } else if (md->type==eModifierType_Curve) {
- height = 72;
- } else if (md->type==eModifierType_Build) {
- height = 86;
- } else if (md->type==eModifierType_Mirror) {
- height = 86;
- } else if (md->type==eModifierType_EdgeSplit) {
- EdgeSplitModifierData *emd = (EdgeSplitModifierData*) md;
- height = 48;
- if(emd->flags & MOD_EDGESPLIT_FROMANGLE) height += 19;
- } else if (md->type==eModifierType_Displace) {
- DisplaceModifierData *dmd = (DisplaceModifierData *)md;
- height = 124;
- if(dmd->texmapping == MOD_DISP_MAP_OBJECT ||
- dmd->texmapping == MOD_DISP_MAP_UV)
- height += 19;
- } else if (md->type==eModifierType_UVProject) {
- height = 114 + ((UVProjectModifierData *)md)->num_projectors * 19;
- } else if (md->type==eModifierType_Decimate) {
- height = 48;
- } else if (md->type==eModifierType_Smooth) {
- height = 86;
- } else if (md->type==eModifierType_Cast) {
- height = 143;
- } else if (md->type==eModifierType_Wave) {
- WaveModifierData *wmd = (WaveModifierData *)md;
- height = 294;
- if(wmd->texmapping == MOD_WAV_MAP_OBJECT ||
- wmd->texmapping == MOD_WAV_MAP_UV)
- height += 19;
- if(wmd->flag & MOD_WAVE_NORM)
- height += 19;
- } else if (md->type==eModifierType_Armature) {
- height = 105;
- } else if (md->type==eModifierType_Hook) {
- HookModifierData *hmd = (HookModifierData*) md;
- height = 86;
- if (editing)
- height += 20;
- if(hmd->indexar==NULL)
- height += 20;
- } else if (md->type==eModifierType_Softbody) {
- height = 31;
- } else if (md->type==eModifierType_Boolean) {
- height = 48;
- } else if (md->type==eModifierType_Array) {
- height = 211;
- } else if (md->type==eModifierType_MeshDeform) {
- MeshDeformModifierData *mmd= (MeshDeformModifierData*)md;
- height = (mmd->bindcos)? 73: 93;
- } else if (md->type==eModifierType_ParticleSystem) {
- height = 31;
- } else if (md->type==eModifierType_ParticleInstance) {
- height = 94;
- } else if (md->type==eModifierType_Explode) {
- height = 94;
- }
-
- /* roundbox 4 free variables: corner-rounding, nop, roundbox type, shade */
- uiDefBut(block, ROUNDBOX, 0, "", x-10, y-height-2, width, height-2, NULL, 5.0, 0.0, 12, 40, "");
-
- y -= 18;
-
- if (!isVirtual) {
- uiBlockBeginAlign(block);
- if (md->type==eModifierType_ParticleSystem) {
- but = uiDefBut(block, BUT, B_MODIFIER_RECALC, "Convert", lx,(cy-=19),60,19, 0, 0, 0, 0, 0, "Convert the current particles to a mesh object");
- uiButSetFunc(but, modifiers_convertParticles, ob, md);
- }
- else{
- but = uiDefBut(block, BUT, B_MODIFIER_RECALC, "Apply", lx,(cy-=19),60,19, 0, 0, 0, 0, 0, "Apply the current modifier and remove from the stack");
- uiButSetFunc(but, modifiers_applyModifier, ob, md);
- }
-
- if (md->type!=eModifierType_Softbody && md->type!=eModifierType_ParticleSystem) {
- but = uiDefBut(block, BUT, B_MODIFIER_RECALC, "Copy", lx,(cy-=19),60,19, 0, 0, 0, 0, 0, "Duplicate the current modifier at the same position in the stack");
- uiButSetFunc(but, modifiers_copyModifier, ob, md);
- }
- uiBlockEndAlign(block);
- }
-
- lx = x + 10;
- cy = y + 10 - 1;
- uiBlockBeginAlign(block);
- if (md->type==eModifierType_Subsurf) {
- SubsurfModifierData *smd = (SubsurfModifierData*) md;
- char subsurfmenu[]="Subsurf Type%t|Catmull-Clark%x0|Simple Subdiv.%x1";
- uiDefButS(block, MENU, B_MODIFIER_RECALC, subsurfmenu, lx,(cy-=19),buttonWidth,19, &smd->subdivType, 0, 0, 0, 0, "Selects type of subdivision algorithm.");
- uiDefButS(block, NUM, B_MODIFIER_RECALC, "Levels:", lx, (cy-=19), buttonWidth,19, &smd->levels, 1, 6, 0, 0, "Number subdivisions to perform");
- uiDefButS(block, NUM, B_MODIFIER_REDRAW, "Render Levels:", lx, (cy-=19), buttonWidth,19, &smd->renderLevels, 1, 6, 0, 0, "Number subdivisions to perform when rendering");
-
- /* Disabled until non-EM DerivedMesh implementation is complete */
-
- /*
- uiDefButBitS(block, TOG, eSubsurfModifierFlag_Incremental, B_MODIFIER_RECALC, "Incremental", lx, (cy-=19),90,19,&smd->flags, 0, 0, 0, 0, "Use incremental calculation, even outside of mesh mode");
- uiDefButBitS(block, TOG, eSubsurfModifierFlag_DebugIncr, B_MODIFIER_RECALC, "Debug", lx+90, cy,buttonWidth-90,19,&smd->flags, 0, 0, 0, 0, "Visualize the subsurf incremental calculation, for debugging effect of other modifiers");
- */
-
- uiDefButBitS(block, TOG, eSubsurfModifierFlag_ControlEdges, B_MODIFIER_RECALC, "Optimal Draw", lx, (cy-=19), buttonWidth,19,&smd->flags, 0, 0, 0, 0, "Skip drawing/rendering of interior subdivided edges");
- uiDefButBitS(block, TOG, eSubsurfModifierFlag_SubsurfUv, B_MODIFIER_RECALC, "Subsurf UV", lx, (cy-=19),buttonWidth,19,&smd->flags, 0, 0, 0, 0, "Use subsurf to subdivide UVs");
- } else if (md->type==eModifierType_Lattice) {
- LatticeModifierData *lmd = (LatticeModifierData*) md;
- uiDefIDPoinBut(block, modifier_testLatticeObj, ID_OB, B_CHANGEDEP, "Ob: ", lx, (cy-=19), buttonWidth,19, &lmd->object, "Lattice object to deform with");
- but=uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ", lx, (cy-=19), buttonWidth,19, &lmd->name, 0.0, 31.0, 0, 0, "Vertex Group name");
- uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)ob);
- } else if (md->type==eModifierType_Curve) {
- CurveModifierData *cmd = (CurveModifierData*) md;
- uiDefIDPoinBut(block, modifier_testCurveObj, ID_OB, B_CHANGEDEP, "Ob: ", lx, (cy-=19), buttonWidth,19, &cmd->object, "Curve object to deform with");
- but=uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ", lx, (cy-=19), buttonWidth,19, &cmd->name, 0.0, 31.0, 0, 0, "Vertex Group name");
- uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)ob);
-
- uiDefButS(block, ROW,B_MODIFIER_RECALC,"X", lx, (cy-=19), 19,19, &cmd->defaxis, 12.0, MOD_CURVE_POSX, 0, 0, "The axis that the curve deforms along");
- uiDefButS(block, ROW,B_MODIFIER_RECALC,"Y", (lx+buttonWidth/6), cy, 19,19, &cmd->defaxis, 12.0, MOD_CURVE_POSY, 0, 0, "The axis that the curve deforms along");
- uiDefButS(block, ROW,B_MODIFIER_RECALC,"Z", (lx+2*buttonWidth/6), cy, 19,19, &cmd->defaxis, 12.0, MOD_CURVE_POSZ, 0, 0, "The axis that the curve deforms along");
- uiDefButS(block, ROW,B_MODIFIER_RECALC,"-X", (lx+3*buttonWidth/6), cy, 24,19, &cmd->defaxis, 12.0, MOD_CURVE_NEGX, 0, 0, "The axis that the curve deforms along");
- uiDefButS(block, ROW,B_MODIFIER_RECALC,"-Y", (lx+4*buttonWidth/6), cy, 24,19, &cmd->defaxis, 12.0, MOD_CURVE_NEGY, 0, 0, "The axis that the curve deforms along");
- uiDefButS(block, ROW,B_MODIFIER_RECALC,"-Z", (lx+buttonWidth-buttonWidth/6), cy, 24,19, &cmd->defaxis, 12.0, MOD_CURVE_NEGZ, 0, 0, "The axis that the curve deforms along");
- } else if (md->type==eModifierType_Build) {
- BuildModifierData *bmd = (BuildModifierData*) md;
- uiDefButF(block, NUM, B_MODIFIER_RECALC, "Start:", lx, (cy-=19), buttonWidth,19, &bmd->start, 1.0, MAXFRAMEF, 100, 0, "Specify the start frame of the effect");
- uiDefButF(block, NUM, B_MODIFIER_RECALC, "Length:", lx, (cy-=19), buttonWidth,19, &bmd->length, 1.0, MAXFRAMEF, 100, 0, "Specify the total time the build effect requires");
- uiDefButI(block, TOG, B_MODIFIER_RECALC, "Randomize", lx, (cy-=19), buttonWidth,19, &bmd->randomize, 0, 0, 1, 0, "Randomize the faces or edges during build.");
- uiDefButI(block, NUM, B_MODIFIER_RECALC, "Seed:", lx, (cy-=19), buttonWidth,19, &bmd->seed, 1.0, MAXFRAMEF, 100, 0, "Specify the seed for random if used.");
- } else if (md->type==eModifierType_Mirror) {
- MirrorModifierData *mmd = (MirrorModifierData*) md;
- uiDefButF(block, NUM, B_MODIFIER_RECALC, "Merge Limit:", lx, (cy-=19), buttonWidth,19, &mmd->tolerance, 0.0, 1.0, 10, 10, "Distance from axis within which mirrored vertices are merged");
- uiDefButBitS(block, TOG, MOD_MIR_AXIS_X, B_MODIFIER_RECALC, "X", lx,(cy-=19),20,19, &mmd->flag, 0, 0, 0, 0, "Enable X axis mirror");
- uiDefButBitS(block, TOG, MOD_MIR_AXIS_Y, B_MODIFIER_RECALC, "Y", lx+20,cy,20,19, &mmd->flag, 0, 0, 0, 0, "Enable Y axis mirror");
- uiDefButBitS(block, TOG, MOD_MIR_AXIS_Z, B_MODIFIER_RECALC, "Z", lx+40,cy,20,19, &mmd->flag, 0, 0, 0, 0, "Enable Z axis mirror");
- uiDefButBitS(block, TOG, MOD_MIR_CLIPPING, B_MODIFIER_RECALC, "Do Clipping", lx+60, cy, buttonWidth-60,19, &mmd->flag, 1, 2, 0, 0, "Prevents during Transform vertices to go through Mirror");
- uiDefButBitS(block, TOG, MOD_MIR_MIRROR_U, B_MODIFIER_RECALC,
- "Mirror U",
- lx, (cy-=19), buttonWidth/2, 19,
- &mmd->flag, 0, 0, 0, 0,
- "Mirror the U texture coordinate around "
- "the 0.5 point");
- uiDefButBitS(block, TOG, MOD_MIR_MIRROR_V, B_MODIFIER_RECALC,
- "Mirror V",
- lx + buttonWidth/2 + 1, cy, buttonWidth/2, 19,
- &mmd->flag, 0, 0, 0, 0,
- "Mirror the V texture coordinate around "
- "the 0.5 point");
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CHANGEDEP,
- "Ob: ", lx, (cy -= 19), buttonWidth, 19,
- &mmd->mirror_ob,
- "Object to use as mirror");
-
- } else if (md->type==eModifierType_EdgeSplit) {
- EdgeSplitModifierData *emd = (EdgeSplitModifierData*) md;
- uiDefButBitI(block, TOG, MOD_EDGESPLIT_FROMANGLE,
- B_MODIFIER_RECALC, "From Edge Angle",
- lx, (cy -= 19), buttonWidth, 19,
- &emd->flags, 0, 0, 0, 0,
- "Split edges with high angle between faces");
- if(emd->flags & MOD_EDGESPLIT_FROMANGLE) {
- uiDefButF(block, NUM, B_MODIFIER_RECALC, "Split Angle:",
- lx, (cy -= 19), buttonWidth, 19, &emd->split_angle,
- 0.0, 180.0, 100, 2,
- "Angle above which to split edges");
- }
- uiDefButBitI(block, TOG, MOD_EDGESPLIT_FROMFLAG,
- B_MODIFIER_RECALC, "From Marked As Sharp",
- lx, (cy -= 19), buttonWidth, 19,
- &emd->flags, 0, 0, 0, 0,
- "Split edges that are marked as sharp");
- } else if (md->type==eModifierType_Displace) {
- DisplaceModifierData *dmd = (DisplaceModifierData*) md;
- but = uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ",
- lx, (cy -= 19), buttonWidth, 19,
- &dmd->defgrp_name, 0.0, 31.0, 0, 0,
- "Name of vertex group to displace"
- " (displace whole mesh if blank)");
- uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)ob);
- uiDefIDPoinBut(block, modifier_testTexture, ID_TE, B_CHANGEDEP,
- "Texture: ", lx, (cy -= 19), buttonWidth, 19,
- &dmd->texture,
- "Texture to use as displacement input");
- uiDefButF(block, NUM, B_MODIFIER_RECALC, "Midlevel:",
- lx, (cy -= 19), buttonWidth, 19, &dmd->midlevel,
- 0, 1, 10, 3,
- "Material value that gives no displacement");
- uiDefButF(block, NUM, B_MODIFIER_RECALC, "Strength:",
- lx, (cy -= 19), buttonWidth, 19, &dmd->strength,
- -1000, 1000, 10, 0.1,
- "Strength of displacement");
- sprintf(str, "Direction%%t|Normal%%x%d|RGB -> XYZ%%x%d|"
- "Z%%x%d|Y%%x%d|X%%x%d",
- MOD_DISP_DIR_NOR, MOD_DISP_DIR_RGB_XYZ,
- MOD_DISP_DIR_Z, MOD_DISP_DIR_Y, MOD_DISP_DIR_X);
- uiDefButI(block, MENU, B_MODIFIER_RECALC, str,
- lx, (cy -= 19), buttonWidth, 19, &dmd->direction,
- 0.0, 1.0, 0, 0, "Displace direction");
- sprintf(str, "Texture Coordinates%%t"
- "|Local%%x%d|Global%%x%d|Object%%x%d|UV%%x%d",
- MOD_DISP_MAP_LOCAL, MOD_DISP_MAP_GLOBAL,
- MOD_DISP_MAP_OBJECT, MOD_DISP_MAP_UV);
- uiDefButI(block, MENU, B_MODIFIER_RECALC, str,
- lx, (cy -= 19), buttonWidth, 19, &dmd->texmapping,
- 0.0, 1.0, 0, 0,
- "Texture coordinates used for displacement input");
- if (dmd->texmapping == MOD_DISP_MAP_UV) {
- char *strtmp;
- int i;
- CustomData *fdata = G.obedit ? &G.editMesh->fdata
- : &((Mesh*)ob->data)->fdata;
- build_uvlayer_menu_vars(fdata, &strtmp, &dmd->uvlayer_tmp,
- dmd->uvlayer_name);
- but = uiDefButI(block, MENU, B_MODIFIER_RECALC, strtmp,
- lx, (cy -= 19), buttonWidth, 19, &dmd->uvlayer_tmp,
- 0.0, 1.0, 0, 0, "Set the UV layer to use");
- MEM_freeN(strtmp);
- i = CustomData_get_layer_index(fdata, CD_MTFACE);
- uiButSetFunc(but, set_displace_uvlayer, dmd,
- &fdata->layers[i]);
- }
- if(dmd->texmapping == MOD_DISP_MAP_OBJECT) {
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CHANGEDEP,
- "Ob: ", lx, (cy -= 19), buttonWidth, 19,
- &dmd->map_object,
- "Object to get texture coordinates from");
- }
- } else if (md->type==eModifierType_UVProject) {
- UVProjectModifierData *umd = (UVProjectModifierData *) md;
- int i;
- char *strtmp;
- CustomData *fdata = G.obedit ? &G.editMesh->fdata
- : &((Mesh*)ob->data)->fdata;
- build_uvlayer_menu_vars(fdata, &strtmp, &umd->uvlayer_tmp,
- umd->uvlayer_name);
- but = uiDefButI(block, MENU, B_MODIFIER_RECALC, strtmp,
- lx, (cy -= 19), buttonWidth, 19, &umd->uvlayer_tmp,
- 0.0, 1.0, 0, 0, "Set the UV layer to use");
- i = CustomData_get_layer_index(fdata, CD_MTFACE);
- uiButSetFunc(but, set_uvproject_uvlayer, umd, &fdata->layers[i]);
- MEM_freeN(strtmp);
- uiDefButF(block, NUM, B_MODIFIER_RECALC, "AspX:",
- lx, (cy -= 19), buttonWidth / 2, 19, &umd->aspectx,
- 1, 1000, 100, 2,
- "Horizontal Aspect Ratio");
- uiDefButF(block, NUM, B_MODIFIER_RECALC, "AspY:",
- lx + (buttonWidth / 2) + 1, cy, buttonWidth / 2, 19,
- &umd->aspecty,
- 1, 1000, 100, 2,
- "Vertical Aspect Ratio");
- uiDefButI(block, NUM, B_MODIFIER_RECALC, "Projectors:",
- lx, (cy -= 19), buttonWidth, 19, &umd->num_projectors,
- 1, MOD_UVPROJECT_MAXPROJECTORS, 0, 0,
- "Number of objects to use as projectors");
- for(i = 0; i < umd->num_projectors; ++i) {
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CHANGEDEP,
- "Ob: ", lx, (cy -= 19), buttonWidth, 19,
- &umd->projectors[i],
- "Object to use as projector");
- }
- uiDefIDPoinBut(block, modifier_testImage, ID_IM, B_CHANGEDEP,
- "Image: ", lx, (cy -= 19), buttonWidth, 19,
- &umd->image,
- "Image to project (only faces with this image "
- "will be altered");
- uiButSetCompleteFunc(but, autocomplete_image, (void *)ob);
- uiDefButBitI(block, TOG, MOD_UVPROJECT_OVERRIDEIMAGE,
- B_MODIFIER_RECALC, "Override Image",
- lx, (cy -= 19), buttonWidth, 19,
- &umd->flags, 0, 0, 0, 0,
- "Override faces' current images with the "
- "given image");
- } else if (md->type==eModifierType_Decimate) {
- DecimateModifierData *dmd = (DecimateModifierData*) md;
- uiDefButF(block, NUM, B_MODIFIER_RECALC, "Ratio:", lx,(cy-=19),buttonWidth,19, &dmd->percent, 0.0, 1.0, 10, 0, "Defines the percentage of triangles to reduce to");
- sprintf(str, "Face Count: %d", dmd->faceCount);
- uiDefBut(block, LABEL, 1, str, lx, (cy-=19), 160,19, NULL, 0.0, 0.0, 0, 0, "Displays the current number of faces in the decimated mesh");
- } else if (md->type==eModifierType_Smooth) {
- SmoothModifierData *smd = (SmoothModifierData*) md;
-
- uiDefButBitS(block, TOG, MOD_SMOOTH_X, B_MODIFIER_RECALC, "X", lx,(cy-=19),45,19, &smd->flag, 0, 0, 0, 0, "Enable X axis smoothing");
- uiDefButBitS(block, TOG, MOD_SMOOTH_Y, B_MODIFIER_RECALC, "Y", lx+45,cy,45,19, &smd->flag, 0, 0, 0, 0, "Enable Y axis smoothing");
- uiDefButBitS(block, TOG, MOD_SMOOTH_Z, B_MODIFIER_RECALC, "Z", lx+90,cy,45,19, &smd->flag, 0, 0, 0, 0, "Enable Z axis smoothing");
-
- uiDefButF(block, NUM, B_MODIFIER_RECALC, "Factor:", lx,(cy-=19),buttonWidth, 19, &smd->fac, -10.0, 10.0, 0.5, 0, "Define the amount of smoothing, from 0.0 to 1.0 (lower / higher values can deform the mesh)");
- uiDefButS(block, NUM, B_MODIFIER_RECALC, "Repeat:", lx,(cy-=19),buttonWidth, 19, &smd->repeat, 0.0, 30.0, 1, 0, "Number of smoothing iterations");
- but=uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ", lx, (cy-=19), buttonWidth,19, &smd->defgrp_name, 0.0, 31.0, 0, 0, "Vertex Group name to define which vertices are affected");
- } else if (md->type==eModifierType_Cast) {
- CastModifierData *cmd = (CastModifierData*) md;
-
- char casttypemenu[]="Projection Type%t|Sphere%x0|Cylinder%x1|Cuboid%x2";
- uiDefButS(block, MENU, B_MODIFIER_RECALC, casttypemenu, lx,(cy-=19),buttonWidth - 30,19, &cmd->type, 0, 0, 0, 0, "Projection type to apply");
- uiDefButBitS(block, TOG, MOD_CAST_X, B_MODIFIER_RECALC, "X", lx,(cy-=19),45,19, &cmd->flag, 0, 0, 0, 0, "Enable (local) X axis deformation");
- uiDefButBitS(block, TOG, MOD_CAST_Y, B_MODIFIER_RECALC, "Y", lx+45,cy,45,19, &cmd->flag, 0, 0, 0, 0, "Enable (local) Y axis deformation");
- if (cmd->type != MOD_CAST_TYPE_CYLINDER) {
- uiDefButBitS(block, TOG, MOD_CAST_Z, B_MODIFIER_RECALC, "Z", lx+90,cy,45,19, &cmd->flag, 0, 0, 0, 0, "Enable (local) Z axis deformation");
- }
- uiDefButF(block, NUM, B_MODIFIER_RECALC, "Factor:", lx,(cy-=19),buttonWidth, 19, &cmd->fac, -10.0, 10.0, 5, 0, "Define the amount of deformation");
- uiDefButF(block, NUM, B_MODIFIER_RECALC, "Radius:", lx,(cy-=19),buttonWidth, 19, &cmd->radius, 0.0, 100.0, 10.0, 0, "Only deform vertices within this distance from the center of the effect (leave as 0 for infinite)");
- uiDefButF(block, NUM, B_MODIFIER_RECALC, "Size:", lx,(cy-=19),buttonWidth, 19, &cmd->size, 0.0, 100.0, 10.0, 0, "Size of projection shape (leave as 0 for auto)");
- uiDefButBitS(block, TOG, MOD_CAST_SIZE_FROM_RADIUS, B_MODIFIER_RECALC, "From radius", lx+buttonWidth,cy,80,19, &cmd->flag, 0, 0, 0, 0, "Use radius as size of projection shape (0 = auto)");
- if (ob->type == OB_MESH) {
- but=uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ", lx, (cy-=19), buttonWidth,19, &cmd->defgrp_name, 0.0, 31.0, 0, 0, "Vertex Group name to define which vertices are affected");
- }
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CHANGEDEP, "Ob: ", lx,(cy-=19), buttonWidth,19, &cmd->object, "Control object: if available, its location determines the center of the effect");
- if(cmd->object) {
- uiDefButBitS(block, TOG, MOD_CAST_USE_OB_TRANSFORM, B_MODIFIER_RECALC, "Use transform", lx+buttonWidth,cy,80,19, &cmd->flag, 0, 0, 0, 0, "Use object transform to control projection shape");
- }
- } else if (md->type==eModifierType_Wave) {
- WaveModifierData *wmd = (WaveModifierData*) md;
- uiDefButBitS(block, TOG, MOD_WAVE_X, B_MODIFIER_RECALC, "X", lx,(cy-=19),45,19, &wmd->flag, 0, 0, 0, 0, "Enable X axis motion");
- uiDefButBitS(block, TOG, MOD_WAVE_Y, B_MODIFIER_RECALC, "Y", lx+45,cy,45,19, &wmd->flag, 0, 0, 0, 0, "Enable Y axis motion");
- uiDefButBitS(block, TOG, MOD_WAVE_CYCL, B_MODIFIER_RECALC, "Cycl", lx+90,cy,buttonWidth-90,19, &wmd->flag, 0, 0, 0, 0, "Enable cyclic wave effect");
- uiDefButBitS(block, TOG, MOD_WAVE_NORM, B_MODIFIER_RECALC, "Normals", lx,(cy-=19),buttonWidth,19, &wmd->flag, 0, 0, 0, 0, "Displace along normals");
- if (wmd->flag & MOD_WAVE_NORM){
- if (ob->type==OB_MESH) {
- uiDefButBitS(block, TOG, MOD_WAVE_NORM_X, B_MODIFIER_RECALC, "X", lx,(cy-=19),buttonWidth/3,19, &wmd->flag, 0, 0, 0, 0, "Enable displacement along the X normal");
- uiDefButBitS(block, TOG, MOD_WAVE_NORM_Y, B_MODIFIER_RECALC, "Y", lx+(buttonWidth/3),cy,buttonWidth/3,19, &wmd->flag, 0, 0, 0, 0, "Enable displacement along the Y normal");
- uiDefButBitS(block, TOG, MOD_WAVE_NORM_Z, B_MODIFIER_RECALC, "Z", lx+(buttonWidth/3)*2,cy,buttonWidth/3,19, &wmd->flag, 0, 0, 0, 0, "Enable displacement along the Z normal");
- }
- else
- uiDefBut(block, LABEL, 1, "Meshes Only", lx, (cy-=19), buttonWidth,19, NULL, 0.0, 0.0, 0, 0, "");
- }
-
- uiBlockBeginAlign(block);
- if(wmd->speed >= 0)
- uiDefButF(block, NUM, B_MODIFIER_RECALC, "Time sta:", lx,(cy-=19),buttonWidth,19, &wmd->timeoffs, -MAXFRAMEF, MAXFRAMEF, 100, 0, "Specify starting frame of the wave");
- else
- uiDefButF(block, NUM, B_MODIFIER_RECALC, "Time end:", lx,(cy-=19),buttonWidth,19, &wmd->timeoffs, -MAXFRAMEF, MAXFRAMEF, 100, 0, "Specify ending frame of the wave");
- uiDefButF(block, NUM, B_MODIFIER_RECALC, "Lifetime:", lx,(cy-=19),buttonWidth,19, &wmd->lifetime, -MAXFRAMEF, MAXFRAMEF, 100, 0, "Specify the lifespan of the wave");
- uiDefButF(block, NUM, B_MODIFIER_RECALC, "Damptime:", lx,(cy-=19),buttonWidth,19, &wmd->damp, -MAXFRAMEF, MAXFRAMEF, 100, 0, "Specify the dampingtime of the wave");
- cy -= 9;
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_MODIFIER_RECALC, "Sta x:", lx,(cy-=19),113,19, &wmd->startx, -100.0, 100.0, 100, 0, "Starting position for the X axis");
- uiDefButF(block, NUM, B_MODIFIER_RECALC, "Sta y:", lx+115,cy,105,19, &wmd->starty, -100.0, 100.0, 100, 0, "Starting position for the Y axis");
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_MODIFIER_RECALC, "Ob: ", lx, (cy-=19), 220,19, &wmd->objectcenter, "Object to use as Starting Position (leave blank to disable)");
- uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ",lx, (cy -= 19), 220, 19,&wmd->defgrp_name, 0.0, 31.0, 0, 0, "Name of vertex group with which to modulate displacement");
- uiDefIDPoinBut(block, modifier_testTexture, ID_TE, B_CHANGEDEP,"Texture: ", lx, (cy -= 19), 220, 19, &wmd->texture,"Texture with which to modulate wave");
- sprintf(str, "Texture Coordinates%%t"
- "|Local%%x%d|Global%%x%d|Object%%x%d|UV%%x%d",
- MOD_WAV_MAP_LOCAL, MOD_WAV_MAP_GLOBAL,
- MOD_WAV_MAP_OBJECT, MOD_WAV_MAP_UV);
- uiDefButI(block, MENU, B_MODIFIER_RECALC, str,
- lx, (cy -= 19), 220, 19, &wmd->texmapping,
- 0.0, 1.0, 0, 0,
- "Texture coordinates used for modulation input");
- if (wmd->texmapping == MOD_WAV_MAP_UV) {
- char *strtmp;
- int i;
- CustomData *fdata = G.obedit ? &G.editMesh->fdata
- : &((Mesh*)ob->data)->fdata;
- build_uvlayer_menu_vars(fdata, &strtmp, &wmd->uvlayer_tmp,
- wmd->uvlayer_name);
- but = uiDefButI(block, MENU, B_MODIFIER_RECALC, strtmp,
- lx, (cy -= 19), 220, 19, &wmd->uvlayer_tmp,
- 0.0, 1.0, 0, 0, "Set the UV layer to use");
- MEM_freeN(strtmp);
- i = CustomData_get_layer_index(fdata, CD_MTFACE);
- uiButSetFunc(but, set_displace_uvlayer, wmd,
- &fdata->layers[i]);
- }
- if(wmd->texmapping == MOD_DISP_MAP_OBJECT) {
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CHANGEDEP,
- "Ob: ", lx, (cy -= 19), 220, 19,
- &wmd->map_object,
- "Object to get texture coordinates from");
- }
- cy -= 9;
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_MODIFIER_RECALC, "Speed:", lx,(cy-=19),220,19, &wmd->speed, -2.0, 2.0, 0, 0, "Specify the wave speed");
- uiDefButF(block, NUMSLI, B_MODIFIER_RECALC, "Height:", lx,(cy-=19),220,19, &wmd->height, -2.0, 2.0, 0, 0, "Specify the amplitude of the wave");
- uiDefButF(block, NUMSLI, B_MODIFIER_RECALC, "Width:", lx,(cy-=19),220,19, &wmd->width, 0.0, 5.0, 0, 0, "Specify the width of the wave");
- uiDefButF(block, NUMSLI, B_MODIFIER_RECALC, "Narrow:", lx,(cy-=19),220,19, &wmd->narrow, 0.0, 10.0, 0, 0, "Specify how narrow the wave follows");
- } else if (md->type==eModifierType_Armature) {
- ArmatureModifierData *amd = (ArmatureModifierData*) md;
- uiDefIDPoinBut(block, modifier_testArmatureObj, ID_OB, B_CHANGEDEP, "Ob: ", lx, (cy-=19), buttonWidth,19, &amd->object, "Armature object to deform with");
-
- but=uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ", lx, (cy-=19), buttonWidth-40,19, &amd->defgrp_name, 0.0, 31.0, 0, 0, "Vertex Group name to control overall armature influence");
- uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)ob);
- uiDefButBitS(block, TOG, ARM_DEF_INVERT_VGROUP, B_ARM_RECALCDATA, "Inv", lx+buttonWidth-40,cy, 40, 20, &amd->deformflag, 0, 0, 0, 0, "Invert vertex group influence");
-
- uiDefButBitS(block, TOG, ARM_DEF_VGROUP, B_ARM_RECALCDATA, "Vert.Groups", lx,cy-=19,buttonWidth/2,20, &amd->deformflag, 0, 0, 0, 0, "Enable VertexGroups defining deform");
- uiDefButBitS(block, TOG, ARM_DEF_ENVELOPE, B_ARM_RECALCDATA, "Envelopes", lx+buttonWidth/2,cy,(buttonWidth + 1)/2,20, &amd->deformflag, 0, 0, 0, 0, "Enable Bone Envelopes defining deform");
- uiDefButBitS(block, TOG, ARM_DEF_QUATERNION, B_ARM_RECALCDATA, "Quaternion", lx,(cy-=19),buttonWidth/2,20, &amd->deformflag, 0, 0, 0, 0, "Enable deform rotation interpolation with Quaternions");
- uiDefButBitS(block, TOG, ARM_DEF_B_BONE_REST, B_ARM_RECALCDATA, "B-Bone Rest", lx+buttonWidth/2,cy,(buttonWidth + 1)/2,20, &amd->deformflag, 0, 0, 0, 0, "Make B-Bones deform already in rest position");
-
- uiDefButS(block, TOG, B_ARM_RECALCDATA, "MultiModifier", lx,cy-=19, buttonWidth, 20, &amd->multi, 0, 0, 0, 0, "Use same input as previous modifier, and mix results using overall vgroup");
-
- } else if (md->type==eModifierType_Hook) {
- HookModifierData *hmd = (HookModifierData*) md;
- uiDefButF(block, NUM, B_MODIFIER_RECALC, "Falloff: ", lx, (cy-=19), buttonWidth,19, &hmd->falloff, 0.0, 100.0, 100, 0, "If not zero, the distance from hook where influence ends");
- uiDefButF(block, NUMSLI, B_MODIFIER_RECALC, "Force: ", lx, (cy-=19), buttonWidth,19, &hmd->force, 0.0, 1.0, 100, 0, "Set relative force of hook");
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CHANGEDEP, "Ob: ", lx, (cy-=19), buttonWidth,19, &hmd->object, "Parent Object for hook, also recalculates and clears offset");
- if(hmd->indexar==NULL) {
- but=uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ", lx, (cy-=19), buttonWidth,19, &hmd->name, 0.0, 31.0, 0, 0, "Vertex Group name");
- uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)ob);
- }
- uiBlockBeginAlign(block);
- but = uiDefBut(block, BUT, B_MODIFIER_RECALC, "Reset", lx, (cy-=19), 80,19, NULL, 0.0, 0.0, 0, 0, "Recalculate and clear offset (transform) of hook");
- uiButSetFunc(but, modifiers_clearHookOffset, ob, md);
- but = uiDefBut(block, BUT, B_MODIFIER_RECALC, "Recenter", lx+80, cy, buttonWidth-80,19, NULL, 0.0, 0.0, 0, 0, "Sets hook center to cursor position");
- uiButSetFunc(but, modifiers_cursorHookCenter, ob, md);
-
- if (editing) {
- but = uiDefBut(block, BUT, B_MODIFIER_RECALC, "Select", lx, (cy-=19), 80,19, NULL, 0.0, 0.0, 0, 0, "Selects effected vertices on mesh");
- uiButSetFunc(but, modifiers_selectHook, ob, md);
- but = uiDefBut(block, BUT, B_MODIFIER_RECALC, "Reassign", lx+80, cy, buttonWidth-80,19, NULL, 0.0, 0.0, 0, 0, "Reassigns selected vertices to hook");
- uiButSetFunc(but, modifiers_reassignHook, ob, md);
- }
- } else if (md->type==eModifierType_Softbody) {
- uiDefBut(block, LABEL, 1, "See Softbody panel.", lx, (cy-=19), buttonWidth,19, NULL, 0.0, 0.0, 0, 0, "");
- } else if (md->type==eModifierType_Boolean) {
- BooleanModifierData *bmd = (BooleanModifierData*) md;
- uiDefButI(block, MENU, B_MODIFIER_RECALC, "Operation%t|Intersect%x0|Union%x1|Difference%x2", lx,(cy-=19),buttonWidth,19, &bmd->operation, 0.0, 1.0, 0, 0, "Boolean operation to perform");
- uiDefIDPoinBut(block, modifier_testMeshObj, ID_OB, B_CHANGEDEP, "Ob: ", lx, (cy-=19), buttonWidth,19, &bmd->object, "Mesh object to use for boolean operation");
- } else if (md->type==eModifierType_Array) {
- ArrayModifierData *amd = (ArrayModifierData*) md;
- float range = 10000;
- int cytop, halfwidth = (width - 5)/2 - 15;
- int halflx = lx + halfwidth + 10;
-
- uiBlockSetEmboss(block, UI_EMBOSSX);
- uiBlockEndAlign(block);
-
- /* length parameters */
- uiBlockBeginAlign(block);
- sprintf(str, "Length Fit%%t|Fixed Count%%x%d|Fixed Length%%x%d"
- "|Fit To Curve Length%%x%d",
- MOD_ARR_FIXEDCOUNT, MOD_ARR_FITLENGTH, MOD_ARR_FITCURVE);
- uiDefButI(block, MENU, B_MODIFIER_RECALC, str,
- lx, (cy-=19), buttonWidth, 19, &amd->fit_type,
- 0.0, 1.0, 0, 0, "Array length calculation method");
- switch(amd->fit_type)
- {
- case MOD_ARR_FIXEDCOUNT:
- uiDefButI(block, NUM, B_MODIFIER_RECALC, "Count:",
- lx, (cy -= 19), buttonWidth, 19, &amd->count,
- 1, 1000, 0, 0, "Number of duplicates to make");
- break;
- case MOD_ARR_FITLENGTH:
- uiDefButF(block, NUM, B_MODIFIER_RECALC, "Length:",
- lx, (cy -= 19), buttonWidth, 19, &amd->length,
- 0, range, 10, 2,
- "Length to fit array within");
- break;
- case MOD_ARR_FITCURVE:
- uiDefIDPoinBut(block, modifier_testCurveObj, ID_OB,
- B_CHANGEDEP, "Ob: ",
- lx, (cy -= 19), buttonWidth, 19, &amd->curve_ob,
- "Curve object to fit array length to");
- break;
- }
- uiBlockEndAlign(block);
-
- /* offset parameters */
- cy -= 10;
- cytop= cy;
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, MOD_ARR_OFF_CONST, B_MODIFIER_RECALC,
- "Constant Offset", lx, (cy-=19), halfwidth, 19,
- &amd->offset_type, 0, 0, 0, 0,
- "Constant offset between duplicates "
- "(local coordinates)");
- uiDefButF(block, NUM, B_MODIFIER_RECALC, "X:",
- lx, (cy-=19), halfwidth, 19,
- &amd->offset[0],
- -range, range, 10, 3,
- "Constant component for duplicate offsets "
- "(local coordinates)");
- uiDefButF(block, NUM, B_MODIFIER_RECALC, "Y:",
- lx, (cy-=19), halfwidth, 19,
- &amd->offset[1],
- -range, range, 10, 3,
- "Constant component for duplicate offsets "
- "(local coordinates)");
- uiDefButF(block, NUM, B_MODIFIER_RECALC, "Z:",
- lx, (cy-=19), halfwidth, 19,
- &amd->offset[2],
- -range, range, 10, 3,
- "Constant component for duplicate offsets "
- "(local coordinates)");
- uiBlockEndAlign(block);
-
- cy= cytop;
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, MOD_ARR_OFF_RELATIVE, B_MODIFIER_RECALC,
- "Relative Offset", halflx, (cy-=19), halfwidth, 19,
- &amd->offset_type, 0, 0, 0, 0,
- "Offset between duplicates relative to object width "
- "(local coordinates)");
- uiDefButF(block, NUM, B_MODIFIER_RECALC, "X:",
- halflx, (cy-=19), halfwidth, 19,
- &amd->scale[0],
- -range, range, 10, 3,
- "Component for duplicate offsets relative to object "
- "width (local coordinates)");
- uiDefButF(block, NUM, B_MODIFIER_RECALC, "Y:",
- halflx, (cy-=19), halfwidth, 19,
- &amd->scale[1],
- -range, range, 10, 3,
- "Component for duplicate offsets relative to object "
- "width (local coordinates)");
- uiDefButF(block, NUM, B_MODIFIER_RECALC, "Z:",
- halflx, (cy-=19), halfwidth, 19,
- &amd->scale[2],
- -range, range, 10, 3,
- "Component for duplicate offsets relative to object "
- "width (local coordinates)");
- uiBlockEndAlign(block);
-
- /* vertex merging parameters */
- cy -= 10;
- cytop= cy;
-
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, MOD_ARR_MERGE, B_MODIFIER_RECALC,
- "Merge",
- lx, (cy-=19), halfwidth/2, 19, &amd->flags,
- 0, 0, 0, 0,
- "Merge vertices in adjacent duplicates");
- uiDefButBitI(block, TOG, MOD_ARR_MERGEFINAL, B_MODIFIER_RECALC,
- "First Last",
- lx + halfwidth/2, cy, (halfwidth+1)/2, 19,
- &amd->flags,
- 0, 0, 0, 0,
- "Merge vertices in first duplicate with vertices"
- " in last duplicate");
- uiDefButF(block, NUM, B_MODIFIER_RECALC, "Limit:",
- lx, (cy-=19), halfwidth, 19, &amd->merge_dist,
- 0, 1.0f, 1, 4,
- "Limit below which to merge vertices");
-
- /* offset ob */
- cy = cytop;
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, MOD_ARR_OFF_OBJ, B_MODIFIER_RECALC,
- "Object Offset", halflx, (cy -= 19), halfwidth, 19,
- &amd->offset_type, 0, 0, 0, 0,
- "Add an object transformation to the total offset");
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CHANGEDEP,
- "Ob: ", halflx, (cy -= 19), halfwidth, 19,
- &amd->offset_ob,
- "Object from which to take offset transformation");
- uiBlockEndAlign(block);
-
- cy -= 10;
- but = uiDefIDPoinBut(block, test_meshobpoin_but, ID_OB,
- B_CHANGEDEP, "Start cap: ",
- lx, (cy -= 19), halfwidth, 19,
- &amd->start_cap,
- "Mesh object to use as start cap");
- uiButSetCompleteFunc(but, autocomplete_meshob, (void *)ob);
- but = uiDefIDPoinBut(block, test_meshobpoin_but, ID_OB,
- B_CHANGEDEP, "End cap: ",
- halflx, cy, halfwidth, 19,
- &amd->end_cap,
- "Mesh object to use as end cap");
- uiButSetCompleteFunc(but, autocomplete_meshob, (void *)ob);
- } else if (md->type==eModifierType_MeshDeform) {
- MeshDeformModifierData *mmd = (MeshDeformModifierData*) md;
-
- uiBlockBeginAlign(block);
- uiDefIDPoinBut(block, test_meshobpoin_but, ID_OB, B_CHANGEDEP, "Ob: ", lx, (cy-=19), buttonWidth,19, &mmd->object, "Mesh object to be use as cage");
- but=uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ", lx, (cy-19), buttonWidth-40,19, &mmd->defgrp_name, 0.0, 31.0, 0, 0, "Vertex Group name to control overall meshdeform influence");
- uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)ob);
- uiDefButBitS(block, TOG, MOD_MDEF_INVERT_VGROUP, B_MODIFIER_RECALC, "Inv", lx+buttonWidth-40, (cy-=19), 40,19, &mmd->flag, 0.0, 31.0, 0, 0, "Invert vertex group influence");
-
- uiBlockBeginAlign(block);
- if(mmd->bindcos) {
- but= uiDefBut(block, BUT, B_MODIFIER_RECALC, "Unbind", lx,(cy-=24), buttonWidth,19, 0, 0, 0, 0, 0, "Unbind mesh from cage");
- uiButSetFunc(but,modifiers_bindMeshDeform,ob,md);
- }
- else {
- but= uiDefBut(block, BUT, B_MODIFIER_RECALC, "Bind", lx,(cy-=24), buttonWidth,19, 0, 0, 0, 0, 0, "Bind mesh to cage");
- uiButSetFunc(but,modifiers_bindMeshDeform,ob,md);
- uiDefButS(block, NUM, B_NOP, "Precision:", lx,(cy-19), buttonWidth/2 + 20,19, &mmd->gridsize, 2, 10, 0.5, 0, "The grid size for binding");
- uiDefButBitS(block, TOG, MOD_MDEF_DYNAMIC_BIND, B_MODIFIER_RECALC, "Dynamic", lx+(buttonWidth+1)/2 + 20, (cy-=19), buttonWidth/2 - 20,19, &mmd->flag, 0.0, 31.0, 0, 0, "Invert vertex group influence");
- }
- uiBlockEndAlign(block);
- } else if (md->type==eModifierType_ParticleSystem) {
- uiDefBut(block, LABEL, 1, "See Particle buttons.", lx, (cy-=19), buttonWidth,19, NULL, 0.0, 0.0, 0, 0, "");
- } else if (md->type==eModifierType_ParticleInstance) {
- ParticleInstanceModifierData *pimd = (ParticleInstanceModifierData*) md;
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CHANGEDEP, "Ob: ", lx, (cy -= 19), buttonWidth, 19, &pimd->ob, "Object that has the particlesystem");
- uiDefButS(block, NUM, B_MODIFIER_RECALC, "PSYS:", lx, (cy -= 19), buttonWidth, 19, &pimd->psys, 1, 10, 10, 3, "Particlesystem number in the object");
- uiDefButBitS(block, TOG, eParticleInstanceFlag_Parents, B_MODIFIER_RECALC, "Normal", lx, (cy -= 19), buttonWidth/3,19, &pimd->flag, 0, 0, 0, 0, "Create instances from normal particles");
- uiDefButBitS(block, TOG, eParticleInstanceFlag_Children, B_MODIFIER_RECALC, "Children", lx+buttonWidth/3, cy, buttonWidth/3,19, &pimd->flag, 0, 0, 0, 0, "Create instances from child particles");
- uiDefButBitS(block, TOG, eParticleInstanceFlag_Path, B_MODIFIER_RECALC, "Path", lx+buttonWidth*2/3, cy, buttonWidth/3,19, &pimd->flag, 0, 0, 0, 0, "Create instances along particle paths");
- uiDefButBitS(block, TOG, eParticleInstanceFlag_Unborn, B_MODIFIER_RECALC, "Unborn", lx, (cy -= 19), buttonWidth/3,19, &pimd->flag, 0, 0, 0, 0, "Show instances when particles are unborn");
- uiDefButBitS(block, TOG, eParticleInstanceFlag_Alive, B_MODIFIER_RECALC, "Alive", lx+buttonWidth/3, cy, buttonWidth/3,19, &pimd->flag, 0, 0, 0, 0, "Show instances when particles are alive");
- uiDefButBitS(block, TOG, eParticleInstanceFlag_Dead, B_MODIFIER_RECALC, "Dead", lx+buttonWidth*2/3, cy, buttonWidth/3,19, &pimd->flag, 0, 0, 0, 0, "Show instances when particles are dead");
- } else if (md->type==eModifierType_Explode) {
- ExplodeModifierData *emd = (ExplodeModifierData*) md;
- uiBut *but;
- char *menustr= get_vertexgroup_menustr(ob);
- int defCount=BLI_countlist(&ob->defbase);
- if(defCount==0) emd->vgroup=0;
-
- but=uiDefButS(block, MENU, B_MODIFIER_RECALC, menustr, lx, (cy-=19), buttonWidth/2,19, &emd->vgroup, 0, defCount, 0, 0, "Protect this vertex group");
- uiButSetFunc(but,modifiers_explodeFacepa,emd,0);
- MEM_freeN(menustr);
-
- but=uiDefButF(block, NUMSLI, B_MODIFIER_RECALC, "", lx+buttonWidth/2, cy, buttonWidth/2,19, &emd->protect, 0.0f, 1.0f, 0, 0, "Clean vertex group edges");
- uiButSetFunc(but,modifiers_explodeFacepa,emd,0);
-
- but=uiDefBut(block, BUT, B_MODIFIER_RECALC, "Refresh", lx, (cy-=19), buttonWidth/2,19, 0, 0, 0, 0, 0, "Recalculate faces assigned to particles");
- uiButSetFunc(but,modifiers_explodeFacepa,emd,0);
-
- uiDefButBitS(block, TOG, eExplodeFlag_EdgeSplit, B_MODIFIER_RECALC, "Split Edges", lx+buttonWidth/2, cy, buttonWidth/2,19, &emd->flag, 0, 0, 0, 0, "Split face edges for nicer shrapnel");
- uiDefButBitS(block, TOG, eExplodeFlag_Unborn, B_MODIFIER_RECALC, "Unborn", lx, (cy-=19), buttonWidth/3,19, &emd->flag, 0, 0, 0, 0, "Show mesh when particles are unborn");
- uiDefButBitS(block, TOG, eExplodeFlag_Alive, B_MODIFIER_RECALC, "Alive", lx+buttonWidth/3, cy, buttonWidth/3,19, &emd->flag, 0, 0, 0, 0, "Show mesh when particles are alive");
- uiDefButBitS(block, TOG, eExplodeFlag_Dead, B_MODIFIER_RECALC, "Dead", lx+buttonWidth*2/3, cy, buttonWidth/3,19, &emd->flag, 0, 0, 0, 0, "Show mesh when particles are dead");
- }
-
- uiBlockEndAlign(block);
-
- y-=height;
- }
-
- if (md->error) {
- char str[512];
-
- y -= 20;
-
- uiBlockSetCol(block, color);
- /* roundbox 4 free variables: corner-rounding, nop, roundbox type, shade */
- uiDefBut(block, ROUNDBOX, 0, "", x-10, y, width, 20, NULL, 5.0, 0.0, 15, 40, "");
- uiBlockSetCol(block, TH_AUTO);
-
- sprintf(str, "Modifier Error: %s", md->error);
- uiDefBut(block, LABEL, B_NOP, str, x+15, y+15, width-35, 19, NULL, 0.0, 0.0, 0.0, 0.0, "");
- }
-
- uiClearButLock();
-
- y -= 3+6;
-
- *xco = x;
- *yco = y;
-}
-
-static void editing_panel_modifiers(Object *ob)
-{
- ModifierData *md;
- uiBlock *block;
- char str[64];
- int xco, yco, i, lastCageIndex, cageIndex = modifiers_getCageIndex(ob, &lastCageIndex);
-
- block= uiNewBlock(&curarea->uiblocks, "editing_panel_modifiers", UI_EMBOSS, UI_HELV, curarea->win);
- if( uiNewPanel(curarea, block, "Modifiers", "Editing", 640, 0, 318, 204)==0) return;
-
- uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
- uiNewPanelHeight(block, 204);
-
- uiDefBlockBut(block, modifiers_add_menu, ob, "Add Modifier", 0, 190, 130, 20, "Add a new modifier");
-
- sprintf(str, "To: %s", ob->id.name+2);
- uiDefBut(block, LABEL, 1, str, 140, 190, 150, 20, NULL, 0.0, 0.0, 0, 0, "Object whose modifier stack is being edited");
-
- xco = 0;
- yco = 160;
-
- md = modifiers_getVirtualModifierList(ob);
-
- for (i=0; md; i++, md=md->next) {
- draw_modifier(block, ob, md, &xco, &yco, i, cageIndex, lastCageIndex);
- if (md->mode&eModifierMode_Virtual) i--;
- }
-
- if(yco < 0) uiNewPanelHeight(block, 204-yco);
-}
-
-static char *make_key_menu(Key *key, int startindex)
-{
- KeyBlock *kb;
- int index= 1;
- char *str, item[64];
-
- for (kb = key->block.first; kb; kb=kb->next, index++);
- str= MEM_mallocN(index*40, "key string");
- str[0]= 0;
-
- index= startindex;
- for (kb = key->block.first; kb; kb=kb->next, index++) {
- sprintf (item, "|%s%%x%d", kb->name, index);
- strcat(str, item);
- }
-
- return str;
-}
-
-static void editing_panel_shapes(Object *ob)
-{
- uiBlock *block;
- Key *key= NULL;
- KeyBlock *kb;
- int icon;
- char *strp;
-
- block= uiNewBlock(&curarea->uiblocks, "editing_panel_shapes", UI_EMBOSS, UI_HELV, curarea->win);
- uiNewPanelTabbed("Modifiers", "Editing");
- if( uiNewPanel(curarea, block, "Shapes", "Editing", 640, 0, 318, 204)==0) return;
-
- /* Todo check data is library here */
- uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
-
- uiDefBut(block, BUT, B_ADDKEY, "Add Shape Key" , 10, 180, 150, 20, NULL, 0.0, 0.0, 0, 0, "Add new Shape Key");
-
- key= ob_get_key(ob);
- if(key==NULL) {
- /* label aligns add button */
- uiDefBut(block, LABEL, 0, "", 170, 180,140,20, NULL, 0, 0, 0, 0, "");
- return;
- }
-
- uiDefButS(block, TOG, B_RELKEY, "Relative", 170, 180,140,20, &key->type, 0, 0, 0, 0, "Makes Shape Keys relative");
-
- kb= BLI_findlink(&key->block, ob->shapenr-1);
- if(kb==NULL) {
- ob->shapenr= 1;
- kb= key->block.first;
- }
-
- uiBlockBeginAlign(block);
- if(ob->shapeflag & OB_SHAPE_LOCK) icon= ICON_PIN_HLT; else icon= ICON_PIN_DEHLT;
- uiDefIconButBitS(block, TOG, OB_SHAPE_LOCK, B_LOCKKEY, icon, 10,150,25,20, &ob->shapeflag, 0, 0, 0, 0, "Always show the current Shape for this Object");
- if(kb->flag & KEYBLOCK_MUTE) icon= ICON_MUTE_IPO_ON; else icon = ICON_MUTE_IPO_OFF;
- uiDefIconButBitS(block, TOG, KEYBLOCK_MUTE, B_MODIFIER_RECALC, icon, 35,150,20,20, &kb->flag, 0, 0, 0, 0, "Mute the current Shape");
- uiSetButLock(G.obedit==ob, "Unable to perform in EditMode");
- uiDefIconBut(block, BUT, B_PREVKEY, ICON_TRIA_LEFT, 55,150,20,20, NULL, 0, 0, 0, 0, "Previous Shape Key");
- strp= make_key_menu(key, 1);
- uiDefButS(block, MENU, B_SETKEY, strp, 75,150,20,20, &ob->shapenr, 0, 0, 0, 0, "Browse existing choices");
- MEM_freeN(strp);
-
- uiDefIconBut(block, BUT, B_NEXTKEY, ICON_TRIA_RIGHT, 95,150,20,20, NULL, 0, 0, 0, 0, "Next Shape Key");
- uiClearButLock();
- uiDefBut(block, TEX, B_NAMEKEY, "", 115, 150, 170, 20, kb->name, 0.0, 31.0, 0, 0, "Current Shape Key name");
- uiDefIconBut(block, BUT, B_DELKEY, ICON_X, 285,150,25,20, 0, 0, 0, 0, 0, "Deletes current Shape Key");
- uiBlockEndAlign(block);
-
- if(key->type && (ob->shapeflag & OB_SHAPE_LOCK)==0 && ob->shapenr!=1) {
- uiBlockBeginAlign(block);
- make_rvk_slider(block, ob, ob->shapenr-1, 10, 120, 150, 20, "Key value, when used it inserts an animation curve point");
- uiDefButF(block, NUM, B_REDR, "Min ", 160,120, 75, 20, &kb->slidermin, -10.0, 10.0, 100, 1, "Minumum for slider");
- uiDefButF(block, NUM, B_REDR, "Max ", 235,120, 75, 20, &kb->slidermax, -10.0, 10.0, 100, 1, "Maximum for slider");
- uiBlockEndAlign(block);
- }
- if(key->type && ob->shapenr!=1) {
- uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ", 10, 90, 150,19, &kb->vgroup, 0.0, 31.0, 0, 0, "Vertex Weight Group name, to blend with Basis Shape");
-
- strp= make_key_menu(key, 0);
- uiDefButS(block, MENU, B_MODIFIER_RECALC, strp, 160, 90, 150,19, &kb->relative, 0.0, 0.0, 0, 0, "Shape used as a relative key");
- MEM_freeN(strp);
- }
-
- if(key->type==0)
- uiDefButS(block, NUM, B_DIFF, "Slurph:", 10, 60, 150, 19, &(key->slurph), -500.0, 500.0, 0, 0, "Creates a delay in amount of frames in applying keypositions, first vertex goes first");
-
-}
-
-/* *************************** FONT ******************************** */
-
-static short give_vfontnr(VFont *vfont)
-{
- VFont *vf;
- short nr= 1;
-
- vf= G.main->vfont.first;
- while(vf) {
- if(vf==vfont) return nr;
- nr++;
- vf= vf->id.next;
- }
- return -1;
-}
-
-static VFont *give_vfontpointer(int nr) /* nr= button */
-{
- VFont *vf;
- short tel= 1;
-
- vf= G.main->vfont.first;
- while(vf) {
- if(tel==nr) return vf;
- tel++;
- vf= vf->id.next;
- }
- return G.main->vfont.first;
-}
-
-VFont *exist_vfont(char *str)
-{
- VFont *vf;
-
- vf= G.main->vfont.first;
- while(vf) {
- if(strcmp(vf->name, str)==0) return vf;
- vf= vf->id.next;
- }
- return 0;
-}
-
-static char *give_vfontbutstr(void)
-{
- VFont *vf;
- int len= 0;
- char *str, di[FILE_MAXDIR], fi[FILE_MAXFILE];
-
- vf= G.main->vfont.first;
- while(vf) {
- strcpy(di, vf->name);
- BLI_splitdirstring(di, fi);
- len+= strlen(fi)+4;
- vf= vf->id.next;
- }
-
- str= MEM_callocN(len+21, "vfontbutstr");
- strcpy(str, "FONTS %t");
- vf= G.main->vfont.first;
- while(vf) {
-
- if(vf->id.us==0) strcat(str, "|0 ");
- else strcat(str, "| ");
-
- strcpy(di, vf->name);
- BLI_splitdirstring(di, fi);
-
- strcat(str, fi);
- vf= vf->id.next;
- }
- return str;
-}
-
-static void load_buts_vfont(char *name)
-{
- VFont *vf;
- Curve *cu;
-
- if(OBACT && OBACT->type==OB_FONT) cu= OBACT->data;
- else return;
-
- vf= exist_vfont(name);
- if(vf==0) {
- vf= load_vfont(name);
- if(vf==0) return;
- }
- else id_us_plus((ID *)vf);
-
- switch(cu->curinfo.flag & CU_STYLE) {
- case CU_BOLD:
- if(cu->vfontb) cu->vfontb->id.us--;
- cu->vfontb= vf;
- break;
- case CU_ITALIC:
- if(cu->vfonti) cu->vfonti->id.us--;
- cu->vfonti= vf;
- break;
- case (CU_BOLD|CU_ITALIC):
- if(cu->vfontbi) cu->vfontbi->id.us--;
- cu->vfontbi= vf;
- break;
- default:
- if(cu->vfont) cu->vfont->id.us--;
- cu->vfont= vf;
- break;
- }
-
- DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
- BIF_undo_push("Load vector font");
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
-}
-
-static void set_unicode_text_fs(char *file)
-{
- if (file > 0) paste_unicodeText(file);
-}
-
-void do_fontbuts(unsigned short event)
-{
- Curve *cu;
- VFont *vf;
- Object *ob;
- ScrArea *sa;
- char str[80];
- int ctevt;
- char *ctmenu;
- DynStr *ds;
- int i, style=0;
-
- ob= OBACT;
-
- switch(event) {
- case B_MAKEFONT:
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- break;
-
- case B_STYLETOSELU:
- case B_STYLETOSELB:
- case B_STYLETOSELI:
- switch (event) {
- case B_STYLETOSELU: style = CU_UNDERLINE; break;
- case B_STYLETOSELB: style = CU_BOLD; break;
- case B_STYLETOSELI: style = CU_ITALIC; break;
- }
- if (style_to_sel(style, ((Curve*)ob->data)->curinfo.flag & style)) {
- text_to_curve(ob, 0);
- makeDispListCurveTypes(ob, 0);
- allqueue(REDRAWVIEW3D, 0);
- }
- allqueue(REDRAWBUTSEDIT, 0);
- break;
-
- case B_FASTFONT:
- if (G.obedit) {
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- }
- break;
- case B_INSTB:
- cu= ob->data;
- if (cu->totbox < 256) {
- for (i = cu->totbox; i>cu->actbox; i--) cu->tb[i]= cu->tb[i-1];
- cu->tb[cu->actbox]= cu->tb[cu->actbox-1];
- cu->actbox++;
- cu->totbox++;
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWVIEW3D, 0);
- text_to_curve(ob, 0);
- makeDispListCurveTypes(ob, 0);
- }
- else {
- error("Do you really need that many text frames?");
- }
- break;
- case B_DELTB:
- cu= ob->data;
- if (cu->totbox > 1) {
- for (i = cu->actbox-1; i < cu->totbox; i++) cu->tb[i]= cu->tb[i+1];
- cu->totbox--;
- cu->actbox--;
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWVIEW3D, 0);
- text_to_curve(ob, 0);
- makeDispListCurveTypes(ob, 0);
- }
- break;
- case B_TOUPPER:
- to_upper();
- break;
- case B_LOADFONT:
- vf= give_vfontpointer(G.buts->texnr);
- if(vf && vf->id.prev!=vf->id.next) strcpy(str, vf->name);
- else strcpy(str, U.fontdir);
-
- sa= closest_bigger_area();
- areawinset(sa->win);
-
- activate_fileselect(FILE_LOADFONT, "SELECT FONT", str, load_buts_vfont);
-
- break;
- case B_PACKFONT:
- if (ob) {
- cu= ob->data;
- if(cu && cu->vfont) {
- if (cu->vfont->packedfile) {
- if (G.fileflags & G_AUTOPACK) {
- if (okee("Disable AutoPack ?")) {
- G.fileflags &= ~G_AUTOPACK;
- }
- }
-
- if ((G.fileflags & G_AUTOPACK) == 0) {
- if (unpackVFont(cu->vfont, PF_ASK) == RET_OK) {
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- }
- }
- } else {
- cu->vfont->packedfile = newPackedFile(cu->vfont->name);
- }
- }
- }
- allqueue(REDRAWHEADERS, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- break;
-
- case B_LOAD3DTEXT:
- if (!G.obedit) { error("Only in editmode!"); return; }
- if (G.obedit->type != OB_FONT) return;
- activate_fileselect(FILE_SPECIAL, "Open Text File", G.sce, load_3dtext_fs);
- break;
-
- case B_LOREM:
- if (!G.obedit) { error("Only in editmode!"); return; }
- if (G.obedit->type != OB_FONT) return;
- add_lorem();
-
- break;
-
- case B_SETFONT:
- if(ob) {
- cu= ob->data;
-
- vf= give_vfontpointer(G.buts->texnr);
- if(vf) {
- id_us_plus((ID *)vf);
-
- switch(cu->curinfo.flag & CU_STYLE) {
- case CU_BOLD:
- cu->vfontb->id.us--;
- cu->vfontb= vf;
- break;
- case CU_ITALIC:
- cu->vfonti->id.us--;
- cu->vfonti= vf;
- break;
- case (CU_BOLD|CU_ITALIC):
- cu->vfontbi->id.us--;
- cu->vfontbi= vf;
- break;
- default:
- cu->vfont->id.us--;
- cu->vfont= vf;
- break;
- }
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
-
- BIF_undo_push("Set vector font");
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- }
- }
- break;
-
- case B_SETCHAR:
- G.charmin = 0x0000;
- G.charmax = 0xffff;
- if(G.charstart < 0)
- G.charstart = 0;
- if(G.charstart > (0xffff - 12*6))
- G.charstart = 0xffff - (12*6);
- allqueue(REDRAWBUTSEDIT, 0);
- break;
-
- case B_SETUPCHAR:
- G.charstart = G.charstart - (12*6);
- if(G.charstart < 0)
- G.charstart = 0;
- if(G.charstart < G.charmin)
- G.charstart = G.charmin;
- allqueue(REDRAWBUTSEDIT, 0);
- break;
-
- case B_SETCAT:
- // Create new dynamic string
- ds = BLI_dynstr_new();
-
- // Fill the dynamic string with entries
- for(i=0;i<104;i++)
- {
- BLI_dynstr_append(ds, "|");
- BLI_dynstr_append(ds, uctabname[i].name);
- }
-
- // Create the menu string from dyn string
- ctmenu = BLI_dynstr_get_cstring(ds);
-
- // Call the popup menu
- ctevt = pupmenu_col(ctmenu, 40);
- G.charstart = uctabname[ctevt-1].start;
- G.charmin = uctabname[ctevt-1].start;
- G.charmax = uctabname[ctevt-1].end;
-
- // Free all data
- BLI_dynstr_free(ds);
- MEM_freeN(ctmenu);
-
- // And refresh
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
-
- break;
-
- case B_SETDOWNCHAR:
- G.charstart = G.charstart + (12*6);
- if(G.charstart > (0xffff - 12*6))
- G.charstart = 0xffff - (12*6);
- if(G.charstart > G.charmax - 12*6)
- G.charstart = G.charmax - 12*6;
- allqueue(REDRAWBUTSEDIT, 0);
- break;
-
- case B_SETUNITEXT:
- sa= closest_bigger_area();
- areawinset(sa->win);
-
- if(ob==G.obedit) {
- activate_fileselect(FILE_SPECIAL, "Open Text File", G.sce, set_unicode_text_fs);
- }
- break;
-
- case B_TEXTONCURVE:
- if(ob) {
- cu= ob->data;
- if(cu->textoncurve && cu->textoncurve->type!=OB_CURVE) {
- error("Only Curve Objects");
- cu->textoncurve= 0;
- allqueue(REDRAWBUTSEDIT, 0);
- }
- DAG_scene_sort(G.scene); // makes new dag
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- }
- }
-}
-
-#ifdef INTERNATIONAL
-static void editing_panel_char_type(Object *ob, Curve *cu)
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "editing_panel_char_type", UI_EMBOSS, UI_HELV, curarea->win);
- uiNewPanelTabbed("Font", "Editing");
- if(uiNewPanel(curarea, block, "Char", "Editing", 640, 0, 318, 204)==0)
- return;
-
- // Set the selected font
- G.selfont = cu->vfont;
-
- uiDefIconBut(block, BUT, B_SETUNITEXT, ICON_TEXT, 0,210,20,20, 0, 0, 0, 0, 0, "Load Unicode Text file");
-
- // Unicode categorization selection button
- uiDefBut(block, BUT, B_SETCAT, "Unicode Table", 22,210,226,20, 0, 0, 0, 0, 0, "Select Unicode Table");
- uiDefButI(block, NUM, /*B_SETUPCHAR*/ 0, "", 250,210,50,20, &G.charstart, 0, 0xffff, 0, 0, "UT");
-
- // Character selection button
- uiDefBut(block, CHARTAB, B_SETCHAR, "", 0, 0, 264, 200, 0, 0, 0, 0, 0, "Select character");
-
- // Buttons to change the max, min
- uiDefButI(block, BUT, B_SETUPCHAR, "U", 280, 185, 15, 15, &G.charstart, 0, 0xffff, 0, 0, "Scroll character table up");
- uiDefButI(block, BUT, B_SETDOWNCHAR, "D", 280, 0, 15, 15, &G.charstart, 0, 0xffff, 0, 0, "Scroll character table down");
-}
-#endif
-
-static void editing_panel_font_type(Object *ob, Curve *cu)
-{
- uiBlock *block;
- char *strp;
- static int packdummy = 0;
- char str[32];
-
- block= uiNewBlock(&curarea->uiblocks, "editing_panel_font_type", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Font", "Editing", 640, 0, 470, 204)==0) return;
-
- switch(cu->curinfo.flag & CU_STYLE) {
- case CU_BOLD:
- G.buts->texnr= give_vfontnr(cu->vfontb);
- break;
- case CU_ITALIC:
- G.buts->texnr= give_vfontnr(cu->vfonti);
- break;
- case (CU_BOLD|CU_ITALIC):
- G.buts->texnr= give_vfontnr(cu->vfontbi);
- break;
- default:
- G.buts->texnr= give_vfontnr(cu->vfont);
- break;
- }
-
- strp= give_vfontbutstr();
-// vfd= cu->vfont->data;
-
- uiDefBut(block, BUT,B_LOADFONT, "Load", 480,188,68,20, 0, 0, 0, 0, 0, "Load a new font");
- uiDefButS(block, MENU, B_SETFONT, strp, 550,188,220,20, &G.buts->texnr, 0, 0, 0, 0, "Change font for object");
-
- if (cu->vfont->packedfile) {
- packdummy = 1;
- } else {
- packdummy = 0;
- }
- uiDefIconButI(block, TOG|BIT|0, B_PACKFONT, ICON_PACKAGE, 772,188,20,20, &packdummy, 0, 0, 0, 0, "Pack/Unpack this font");
-
- /* This doesn't work anyway */
-// uiDefBut(block, LABEL, 0, vfd->name, 480, 165,314,20, 0, 0, 0, 0, 0, "Postscript name of the font");
-
- uiDefBut(block, BUT, B_LOAD3DTEXT, "Insert Text", 480, 165, 90, 20, 0, 0, 0, 0, 0, "Insert text file at cursor");
- uiDefBut(block, BUT, B_LOREM, "Lorem", 575, 165, 70, 20, 0, 0, 0, 0, 0, "Insert a paragraph of Lorem Ipsum at cursor");
- uiDefButC(block, TOG|BIT|2,B_STYLETOSELU, "U", 727,165,20,20, &(cu->curinfo.flag), 0,0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButBitC(block, TOG, CU_BOLD, B_STYLETOSELB, "B", 752,165,20,20, &(cu->curinfo.flag), 0,0, 0, 0, "");
- uiDefButBitC(block, TOG, CU_ITALIC, B_STYLETOSELI, "i", 772,165,20,20, &(cu->curinfo.flag), 0, 0, 0, 0, "");
- uiBlockEndAlign(block);
-
- MEM_freeN(strp);
-
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW,B_MAKEFONT, "Left", 480,135,47,20, &cu->spacemode, 0.0,0.0, 0, 0, "Left align the text from the object center");
- uiDefButS(block, ROW,B_MAKEFONT, "Center", 527,135,47,20, &cu->spacemode, 0.0,1.0, 0, 0, "Middle align the text from the object center");
- uiDefButS(block, ROW,B_MAKEFONT, "Right", 574,135,47,20, &cu->spacemode, 0.0,2.0, 0, 0, "Right align the text from the object center");
- uiDefButS(block, ROW,B_MAKEFONT, "Justify", 621,135,47,20, &cu->spacemode, 0.0,3.0, 0, 0, "Fill completed lines to maximum textframe width by expanding whitespace");
- uiDefButS(block, ROW,B_MAKEFONT, "Flush", 668,135,47,20, &cu->spacemode, 0.0,4.0, 0, 0, "Fill every line to maximum textframe width, distributing space among all characters");
- uiDefBut(block, BUT, B_TOUPPER, "ToUpper", 715,135,78,20, 0, 0, 0, 0, 0, "Toggle between upper and lower case in editmode");
- uiBlockEndAlign(block);
- uiDefButBitS(block, TOG, CU_FAST, B_FASTFONT, "Fast Edit", 715,105,78,20, &cu->flag, 0, 0, 0, 0, "Don't fill polygons while editing");
-
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_TEXTONCURVE, "TextOnCurve:", 480,105,220,19, &cu->textoncurve, "Apply a deforming curve to the text");
- uiDefBut(block, TEX,REDRAWVIEW3D, "Ob Family:", 480,84,220,19, cu->family, 0.0, 20.0, 0, 0, "Blender uses font from selfmade objects");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM,B_MAKEFONT, "Size:", 480,56,155,20, &cu->fsize, 0.1,10.0, 10, 0, "Size of the text");
- uiDefButF(block, NUM,B_MAKEFONT, "Linedist:", 640,56,155,20, &cu->linedist, 0.0,10.0, 10, 0, "Distance between text lines");
- uiDefButF(block, NUM,B_MAKEFONT, "Word spacing:", 795,56,155,20, &cu->wordspace, 0.0,10.0, 10, 0, "Distance factor between words");
- uiDefButF(block, NUM,B_MAKEFONT, "Spacing:", 480,34,155,20, &cu->spacing, 0.0,10.0, 10, 0, "Spacing of individual characters");
- uiDefButF(block, NUM,B_MAKEFONT, "X offset:", 640,34,155,20, &cu->xof, -50.0,50.0, 10, 0, "Horizontal position from object center");
- uiDefButF(block, NUM,B_MAKEFONT, "UL position:", 795,34,155,20, &cu->ulpos, -0.2,0.8, 10, 0, "Vertical position of underline");
- uiDefButF(block, NUM,B_MAKEFONT, "Shear:", 480,12,155,20, &cu->shear, -1.0,1.0, 10, 0, "Italic angle of the characters");
- uiDefButF(block, NUM,B_MAKEFONT, "Y offset:", 640,12,155,20, &cu->yof, -50.0,50.0, 10, 0, "Vertical position from object center");
- uiDefButF(block, NUM,B_MAKEFONT, "UL height:", 795,12,155,20, &cu->ulheight, 0.01,0.5, 10, 0, "Thickness of underline");
- uiBlockEndAlign(block);
-
- sprintf(str, "%d TextFrame: ", cu->totbox);
- uiBlockBeginAlign(block);
- uiDefButI(block, NUM, REDRAWVIEW3D, str, 805, 188, 145, 20, &cu->actbox, 1.0, cu->totbox, 0, 10, "Textbox to show settings for");
- uiDefBut(block, BUT,B_INSTB, "Insert", 805, 168, 72, 20, 0, 0, 0, 0, 0, "Insert a new text frame after the current one");
- uiDefBut(block, BUT,B_DELTB, "Delete", 877, 168, 73, 20, 0, 0, 0, 0, 0, "Delete current text frame and shift the others up");
- uiDefButF(block, NUM,B_MAKEFONT, "X:", 805, 148, 72, 20, &(cu->tb[cu->actbox-1].x), -50.0, 50.0, 10, 0, "Horizontal offset of text frame");
- uiDefButF(block, NUM,B_MAKEFONT, "Y:", 877, 148, 73, 20, &(cu->tb[cu->actbox-1].y), -50.0, 50.0, 10, 0, "Horizontal offset of text frame");
- uiDefButF(block, NUM,B_MAKEFONT, "Width:", 805, 128, 145, 20, &(cu->tb[cu->actbox-1].w), 0.0, 50.0, 10, 0, "Horizontal offset of text frame");
- uiDefButF(block, NUM,B_MAKEFONT, "Height:", 805, 108, 145, 20, &(cu->tb[cu->actbox-1].h), 0.0, 50.0, 10, 0, "Horizontal offset of text frame");
- uiBlockEndAlign(block);
-}
-
-
-/* *************************** CURVE ******************************** */
-
-
-void do_curvebuts(unsigned short event)
-{
- extern Nurb *lastnu;
- extern ListBase editNurb; /* from editcurve */
- Object *ob;
- Curve *cu;
- Nurb *nu;
-
- ob= OBACT;
- if(ob==0) return;
-
- switch(event) {
-
- case B_CONVERTPOLY:
- case B_CONVERTBEZ:
- case B_CONVERTBSPL:
- case B_CONVERTCARD:
- case B_CONVERTNURB:
- if(G.obedit) {
- setsplinetype(event-B_CONVERTPOLY);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- }
- break;
- case B_UNIFU:
- case B_ENDPU:
- case B_BEZU:
- case B_UNIFV:
- case B_ENDPV:
- case B_BEZV:
- if(G.obedit) {
- nu= editNurb.first;
- while(nu) {
- if(isNurbsel(nu)) {
- if((nu->type & 7)==CU_NURBS) {
- if(event<B_UNIFV) {
- nu->flagu &= 1;
- nu->flagu += ((event-B_UNIFU)<<1);
- makeknots(nu, 1, nu->flagu>>1);
- }
- else if(nu->pntsv>1) {
- nu->flagv &= 1;
- nu->flagv += ((event-B_UNIFV)<<1);
- makeknots(nu, 2, nu->flagv>>1);
- }
- }
- }
- nu= nu->next;
- }
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- }
- break;
- case B_SETWEIGHT:
- if(G.obedit) {
- weightflagNurb(1, editbutweight, 0);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- }
- break;
- case B_SETW1:
- editbutweight= 1.0;
- scrarea_queue_winredraw(curarea);
- break;
- case B_SETW2:
- editbutweight= sqrt(2.0)/4.0;
- scrarea_queue_winredraw(curarea);
- break;
- case B_SETW3:
- editbutweight= 0.25;
- scrarea_queue_winredraw(curarea);
- break;
- case B_SETW4:
- editbutweight= sqrt(0.5);
- scrarea_queue_winredraw(curarea);
- break;
- case B_SETORDER:
- if(G.obedit) {
- nu= lastnu;
- if(nu && (nu->type & 7)==CU_NURBS ) {
- if(nu->orderu>nu->pntsu) {
- nu->orderu= nu->pntsu;
- scrarea_queue_winredraw(curarea);
- }
- makeknots(nu, 1, nu->flagu>>1);
- if(nu->orderv>nu->pntsv) {
- nu->orderv= nu->pntsv;
- scrarea_queue_winredraw(curarea);
- }
- makeknots(nu, 2, nu->flagv>>1);
- }
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- }
- break;
- case B_TILTINTERP:
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_SUBSURFTYPE:
- /* fallthrough */
- case B_MAKEDISP:
- if(G.vd) {
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSALL, 0);
- allqueue(REDRAWINFO, 1); /* 1, because header->win==0! */
- }
- break;
-
- case B_SUBDIVCURVE:
- subdivideNurb();
- break;
- case B_SPINNURB:
- if( (G.obedit==NULL) || (G.obedit->type!=OB_SURF) || (G.vd==NULL) ||
- ((G.obedit->lay & G.vd->lay) == 0) ) return;
- spinNurb(0, 0);
- countall();
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_CU3D: /* allow 3D curve */
- if(G.obedit) {
- cu= G.obedit->data;
- nu= editNurb.first;
- while(nu) {
- nu->type &= ~CU_2D;
- if((cu->flag & CU_3D)==0) nu->type |= CU_2D;
- test2DNurb(nu);
- nu= nu->next;
- }
- }
- if(ob->type==OB_CURVE) {
- cu= ob->data;
- nu= cu->nurb.first;
- while(nu) {
- nu->type &= ~CU_2D;
- if((cu->flag & CU_3D)==0) nu->type |= CU_2D;
- test2DNurb(nu);
- nu= nu->next;
- }
- }
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_SETRESOLU:
- if(ob->type==OB_CURVE) {
- cu= ob->data;
- if(ob==G.obedit) nu= editNurb.first;
- else nu= cu->nurb.first;
-
- while(nu) {
- nu->resolu= cu->resolu;
- nu= nu->next;
- }
- }
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSALL, 0);
- allqueue(REDRAWINFO, 1); /* 1, because header->win==0! */
-
- break;
-
- /* Buttons for aligning handles */
- case B_SETPT_AUTO:
- if(ob->type==OB_CURVE) {
- sethandlesNurb(1);
- BIF_undo_push("Auto Curve Handles");
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- }
- break;
- case B_SETPT_VECTOR:
- if(ob->type==OB_CURVE) {
- sethandlesNurb(2);
- BIF_undo_push("Vector Curve Handles");
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- }
- break;
- case B_SETPT_ALIGN:
- if(ob->type==OB_CURVE) {
- sethandlesNurb(5);
- BIF_undo_push("Align Curve Handles");
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- }
- break;
- case B_SETPT_FREE:
- if(ob->type==OB_CURVE) {
- sethandlesNurb(6);
- BIF_undo_push("Free Align Curve Handles");
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- }
- break;
- }
-}
-
-static void editing_panel_curve_tools(Object *ob, Curve *cu)
-{
- Nurb *nu;
- extern ListBase editNurb; /* from editcurve */
- extern Nurb *lastnu;
- uiBlock *block;
- short *sp;
-
- block= uiNewBlock(&curarea->uiblocks, "editing_panel_curve_tools", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Curve Tools", "Editing", 640, 0, 318, 204)==0) return;
-
- uiDefBut(block, LABEL, 0, "Make Knots",562,173,102, 18, 0, 0, 0, 0, 0, "");
-
- if(ob->type==OB_CURVE) {
- uiDefBut(block, LABEL, 0, "Convert", 463,173,72, 18, 0, 0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefBut(block, BUT,B_CONVERTPOLY,"Poly", 467,152,72, 18, 0, 0, 0, 0, 0, "Converts selected into regular Polygon vertices");
- uiDefBut(block, BUT,B_CONVERTBEZ,"Bezier", 467,132,72, 18, 0, 0, 0, 0, 0, "Converts selected to Bezier triples");
- uiDefBut(block, BUT,B_CONVERTNURB,"Nurb", 467,112,72, 18, 0, 0, 0, 0, 0, "Converts selected to Nurbs Points");
- }
- uiBlockBeginAlign(block);
- uiDefBut(block, BUT,B_UNIFU,"Uniform U", 565,152,102, 18, 0, 0, 0, 0, 0, "Nurbs only; interpolated result doesn't go to end points in U");
- uiDefBut(block, BUT,B_UNIFV,"V", 670,152,50, 18, 0, 0, 0, 0, 0, "Nurbs only; interpolated result doesn't go to end points in V");
- uiDefBut(block, BUT,B_ENDPU,"Endpoint U", 565,132,102, 18, 0, 0, 0, 0, 0, "Nurbs only; interpolated result is forced to end points in U");
- uiDefBut(block, BUT,B_ENDPV,"V", 670,132,50, 18, 0, 0, 0, 0, 0, "Nurbs only; interpolated result is forced to end points in V");
- uiDefBut(block, BUT,B_BEZU,"Bezier U", 565,112,102, 18, 0, 0, 0, 0, 0, "Nurbs only; make knots array mimic a Bezier in U");
- uiDefBut(block, BUT,B_BEZV,"V", 670,112,50, 18, 0, 0, 0, 0, 0, "Nurbs only; make knots array mimic a Bezier in V");
- uiBlockEndAlign(block);
-
- uiDefBut(block, BUT,B_SETWEIGHT,"Set Weight", 465,11,95,49, 0, 0, 0, 0, 0, "Nurbs only; set weight for select points");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM,0,"Weight:", 565,36,102,22, &editbutweight, 0.01, 100.0, 10, 0, "The weight you can assign");
- uiDefBut(block, BUT,B_SETW1,"1.0", 670,36,50,22, 0, 0, 0, 0, 0, "");
- uiDefBut(block, BUT,B_SETW2,"sqrt(2)/4",565,11,55,20, 0, 0, 0, 0, 0, "");
- uiDefBut(block, BUT,B_SETW3,"0.25", 620,11,45,20, 0, 0, 0, 0, 0, "");
- uiDefBut(block, BUT,B_SETW4,"sqrt(0.5)",665,11,55,20, 0, 0, 0, 0, 0, "");
- uiBlockEndAlign(block);
-
- if(ob==G.obedit) {
- nu= lastnu;
- if(nu==NULL) nu= editNurb.first;
- if(nu) {
- if (ob->type==OB_CURVE) {
- uiDefBut(block, LABEL, 0, "Tilt",
- 467,87,72, 18, 0, 0, 0, 0, 0, "");
- /* KEY_LINEAR, KEY_CARDINAL, KEY_BSPLINE */
- uiDefButS(block, MENU, B_TILTINTERP, "Tilt Interpolation %t|Linear %x0|Cardinal %x1|BSpline %x2",
- 467,67,72, 18, &(nu->tilt_interp), 0, 0, 0, 0, "Tilt interpolation");
- }
-
- uiBlockBeginAlign(block);
- sp= &(nu->orderu);
- uiDefButS(block, NUM, B_SETORDER, "Order U:", 565,90,102, 19, sp, 2.0, 6.0, 0, 0, "Nurbs only; the amount of control points involved");
- sp= &(nu->orderv);
- uiDefButS(block, NUM, B_SETORDER, "V:", 670,90,50, 19, sp, 2.0, 6.0, 0, 0, "Nurbs only; the amount of control points involved");
- sp= &(nu->resolu);
- uiDefButS(block, NUM, B_MAKEDISP, "Resol U:", 565,70,102, 19, sp, 1.0, 1024.0, 0, 0, "The amount of new points interpolated per control vertex pair");
- sp= &(nu->resolv);
- uiDefButS(block, NUM, B_MAKEDISP, "V:", 670,70,50, 19, sp, 1.0, 1024.0, 0, 0, "The amount of new points interpolated per control vertex pair");
- }
- }
-
-
-}
-
-static void editing_panel_curve_tools1(Object *ob, Curve *cu)
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "editing_panel_curve_tools1", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Curve Tools1", "Editing", 960, 0, 318, 204)==0) return;
-
- uiDefBut(block, BUT, B_SUBDIVCURVE, "Subdivide", 400,180,150,20, 0, 0, 0, 0, 0, "Subdivide selected");
- if(ob->type==OB_SURF) {
- uiDefBut(block, BUT, B_SPINNURB, "Spin", 400,160,150,20, 0, 0, 0, 0, 0, "Spin selected 360 degrees");
- }
- uiBlockBeginAlign(block);
- uiDefBut(block, BUT,B_HIDE, "Hide", 400,140,150,18, 0, 0, 0, 0, 0, "Hides selected faces");
- uiDefBut(block, BUT,B_REVEAL, "Reveal", 400,120,150,18, 0, 0, 0, 0, 0, "Reveals selected faces");
- uiDefBut(block, BUT,B_SELSWAP, "Select Swap", 400,100,150,18, 0, 0, 0, 0, 0, "Selects unselected faces, and deselects selected faces");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, REDRAWVIEW3D, "NSize:", 400, 60, 150, 19, &G.scene->editbutsize, 0.001, 1.0, 10, 0, "Normal size for drawing");
- uiDefButBitI(block, TOGN, G_HIDDENHANDLES, REDRAWVIEW3D, "Draw Handles", 400, 40, 150, 19, &G.f, 0, 0, 0, 0, "Draw curve handles in 3D view");
- uiBlockEndAlign(block);
-
- if(G.obedit) {
- uiBut *but;
- uiBlockBeginAlign(block);
- but= uiDefButBitS(block,TOG,CU_RETOPO,B_NOP, "Retopo", 560,180,100,19, &cu->flag, 0,0,0,0, "Turn on the re-topology tool");
- uiButSetFunc(but,retopo_toggle,0,0);
- if(cu->flag & CU_RETOPO) {
- but= uiDefBut(block,BUT,B_NOP,"Retopo All", 560,160,100,19, 0,0,0,0,0, "Apply the re-topology tool to all selected vertices");
- uiButSetFunc(but,retopo_do_all_cb,0,0);
- }
- }
-}
-
-/* only for bevel or taper */
-static void test_obcurpoin_but(char *name, ID **idpp)
-{
- ID *id;
-
- for(id= G.main->object.first; id; id= id->next) {
- if( strcmp(name, id->name+2)==0 ) {
- if (((Object *)id)->type != OB_CURVE) {
- error ("Bevel/Taper Object must be a Curve");
- break;
- }
- if(id == (ID *)OBACT) {
- error ("Cannot Bevel/Taper own Object");
- break;
- }
-
- *idpp= id;
- return;
- }
- }
- *idpp= NULL;
-}
-
-
-
-/* for curve, surf and font! */
-static void editing_panel_curve_type(Object *ob, Curve *cu)
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "editing_panel_curve_type", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Curve and Surface", "Editing", 320, 0, 318, 204)==0) return;
-
- uiDefButBitS(block, TOG, CU_UV_ORCO, 0, "UV Orco", 600,160,150,19, &cu->flag, 0, 0, 0, 0, "Forces to use UV coordinates for texture mapping 'orco'");
- if(ob->type==OB_SURF)
- uiDefButBitS(block, TOG, CU_NOPUNOFLIP, REDRAWVIEW3D, "No Puno Flip", 600,140,150,19, &cu->flag, 0, 0, 0, 0, "Don't flip vertex normals while render");
-
- uiBlockBeginAlign(block);
- uiDefBut(block, BUT,B_DOCENTER, "Center", 600, 115, 55, 19, 0, 0, 0, 0, 0, "Shifts object data to be centered about object's origin");
- uiDefBut(block, BUT,B_DOCENTERNEW, "Center New", 655, 115, 95, 19, 0, 0, 0, 0, 0, "Shifts object's origin to center of object data");
- uiDefBut(block, BUT,B_DOCENTERCURSOR, "Center Cursor", 600, 95, 150, 19, 0, 0, 0, 0, 0, "Shifts object's origin to cursor location");
- uiBlockEndAlign(block);
-
- if(cu->key) {
- /* uiDefButS(block, NUM, B_DIFF, "Slurph:", 600,25,140,19, &(cu->key->slurph), -500.0, 500.0,0,0); ,""*/
- uiDefButS(block, TOG, B_RELKEY, "Relative Keys", 600, 72,150,19, &cu->key->type, 0, 0, 0, 0, "");
- }
-
-
- if(ob->type!=OB_SURF) {
-
- if(ob->type==OB_CURVE) {
- extern float prlen; // buttons_object.c, should be moved....
- char str[32];
-
- sprintf(str, "%.4f", prlen);
- uiDefBut(block, BUT, B_PRINTLEN, "PrintLen", 600,135,75,19, 0, 0, 0, 0, 0, "");
- uiDefBut(block, LABEL, 0, str, 675,135,75,19, 0, 1.0, 0, 0, 0, "");
-
- uiBlockBeginAlign(block);
- /*note, PathLen's max was MAXFRAMEF but this is a short, perhaps the pathlen should be increased later on */
- uiDefButS(block, NUM, B_RECALCPATH, "PathLen:", 600,50,150,19, &cu->pathlen, 1.0, 32767.0f, 0, 0, "If no speed Ipo was set, the amount of frames of the path");
- uiDefButBitS(block, TOG, CU_PATH, B_RECALCPATH, "CurvePath", 600,30,75,19 , &cu->flag, 0, 0, 0, 0, "Enables curve to become translation path");
- uiDefButBitS(block, TOG, CU_FOLLOW, REDRAWVIEW3D, "CurveFollow",675,30,75,19, &cu->flag, 0, 0, 0, 0, "Makes curve path children to rotate along path");
- uiDefButBitS(block, TOG, CU_STRETCH, B_CURVECHECK, "CurveStretch", 600,10,150,19, &cu->flag, 0, 0, 0, 0, "Option for curve-deform: makes deformed child to stretch along entire path");
- uiDefButBitS(block, TOG, CU_OFFS_PATHDIST, REDRAWVIEW3D, "PathDist Offs", 600,-10,150,19, &cu->flag, 0, 0, 0, 0, "Children will use TimeOffs value as path distance offset");
-
- uiBlockEndAlign(block);
- }
-
- uiBlockBeginAlign(block);
- uiDefButS(block, NUM, B_SETRESOLU, "DefResolU:", 760,160,150,19, &cu->resolu, 1.0, 1024.0, 0, 0, "Default resolution");
- uiDefButS(block, NUM, B_NOP, "RenResolU", 760,140,150,19, &cu->resolu_ren, 0.0f, 1024, 0, 0, "Set resolution for rendering. A value of zero skips this operation.");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_MAKEDISP, "Width:", 760,90,150,19, &cu->width, 0.0, 2.0, 1, 0, "Make interpolated result thinner or fatter");
- uiDefButF(block, NUM, B_MAKEDISP, "Extrude:", 760,70,150,19, &cu->ext1, 0.0, 100.0, 10, 0, "Curve extrusion size when not using a bevel object");
- uiDefButF(block, NUM, B_MAKEDISP, "Bevel Depth:", 760,50,150,19, &cu->ext2, 0.0, 2.0, 1, 0, "Bevel depth when not using a bevel object");
- uiDefButS(block, NUM, B_MAKEDISP, "BevResol:", 760,30,150,19, &cu->bevresol, 0.0, 32.0, 0, 0, "Bevel resolution when depth is non-zero and not using a bevel object");
- uiDefIDPoinBut(block, test_obcurpoin_but, ID_OB, B_CHANGEDEP, "BevOb:", 760,10,150,19, &cu->bevobj, "Curve object name that defines the bevel shape");
- uiDefIDPoinBut(block, test_obcurpoin_but, ID_OB, B_CHANGEDEP, "TaperOb:", 760,-10,150,19, &cu->taperobj, "Curve object name that defines the taper (width)");
-
- uiBlockBeginAlign(block);
- uiBlockSetCol(block, TH_BUT_SETTING1);
- uiDefButBitS(block, TOG, CU_BACK, B_MAKEDISP, "Back", 760,115,50,19, &cu->flag, 0, 0, 0, 0, "Draw filled back for extruded/beveled curves");
- uiDefButBitS(block, TOG, CU_FRONT, B_MAKEDISP, "Front",810,115,50,19, &cu->flag, 0, 0, 0, 0, "Draw filled front for extruded/beveled curves");
- uiDefButBitS(block, TOG, CU_3D, B_CU3D, "3D", 860,115,50,19, &cu->flag, 0, 0, 0, 0, "Allow Curve to be 3d, it doesn't fill then");
- }
-}
-
-
-/* *************************** CAMERA ******************************** */
-
-/* callback to handle angle to lens conversion */
-static void do_angletolensconversion_cb(void *lens1, void *angle1)
-{
- float *lens= (float *)lens1;
- float *angle= (float *)angle1;
- float anglevalue= *angle;
-
- if(lens) {
- *lens= 16.0f / tan(M_PI*anglevalue/360.0f);
- }
-
- allqueue(REDRAWVIEW3D, 0);
-}
-
-/* callback to handle lens to angle conversion */
-static void do_lenstoangleconversion_cb(void *lens1, void *angle1)
-{
- float *lens= (float *)lens1;
- float *angle= (float *)angle1;
- float lensvalue= *lens;
-
- if(lens) {
- *angle= 360.0f * atan(16.0f/lensvalue) / M_PI;
- }
-
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static void editing_panel_camera_type(Object *ob, Camera *cam)
-{
- uiBlock *block;
- uiBut *but;
- float grid=0.0;
-
- if(G.vd) grid= G.vd->grid;
- if(grid<1.0) grid= 1.0;
-
- block= uiNewBlock(&curarea->uiblocks, "editing_panel_camera_type", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Camera", "Editing", 320, 0, 318, 204)==0) return;
-
- uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
-
- uiDefBut(block, LABEL, 10, "Lens:", 10, 180, 150, 20, 0, 0.0, 0.0, 0, 0, "");
-
- uiBlockBeginAlign(block);
- if(cam->type==CAM_ORTHO) {
- uiDefButF(block, NUM,REDRAWVIEW3D, "Scale:",
- 10, 160, 150, 20, &cam->ortho_scale, 0.01, 1000.0, 50, 0, "Specify the ortho scaling of the used camera");
- } else {
- if(cam->flag & CAM_ANGLETOGGLE) {
- but= uiDefButF(block, NUM,REDRAWVIEW3D, "Lens:",
- 10, 160, 130, 20, &cam->angle, 7.323871, 172.847331, 100, 0, "Specify the lens of the camera in degrees");
- uiButSetFunc(but,do_angletolensconversion_cb, &cam->lens, &cam->angle);
- }
- else {
- but= uiDefButF(block, NUM,REDRAWVIEW3D, "Lens:",
- 10, 160, 130, 20, &cam->lens, 1.0, 250.0, 100, 0, "Specify the lens of the camera");
- uiButSetFunc(but,do_lenstoangleconversion_cb, &cam->lens, &cam->angle);
- }
-
- uiDefButS(block, TOG|BIT|5, B_REDR, "D",
- 140, 160, 20, 20, &cam->flag, 0, 0, 0, 0, "Use degree as the unit of the camera lens");
- }
- uiDefButS(block, TOG, REDRAWVIEW3D, "Orthographic",
- 10, 140, 150, 20, &cam->type, 0, 0, 0, 0, "Render with orthographic projection (no prespective)");
- uiBlockEndAlign(block);
-
-/* qdn: focal dist. param. from yafray now enabled for Blender as well, to use with defocus composit node */
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, REDRAWVIEW3D, "Dof Dist:", 10, 110, 150, 20 /*0, 125, 150, 20*/, &cam->YF_dofdist, 0.0, 5000.0, 50, 0, "Sets distance to point of focus (enable 'Limits' to make visible in 3Dview)");
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, REDRAWVIEW3D, "Dof Ob:", 10, 90, 150, 20, &cam->dof_ob, "Focus on this object (overrides the 'Dof Dist')");
- uiBlockEndAlign(block);
-
- uiDefBut(block, LABEL, 0, "Clipping Start/End:", 10, 45, 150, 20, 0, 0.0, 0.0, 0, 0, "");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM,REDRAWVIEW3D, "Start:",
- 10, 25, 150, 20, &cam->clipsta, 0.001*grid, 100.0*grid, 10, 0, "Clip out geometry closer then this distance to the camera");
- uiDefButF(block, NUM,REDRAWVIEW3D, "End:",
- 10, 5, 150, 20, &cam->clipend, 1.0, 5000.0*grid, 100, 0, "Clip out geometry further then this distance to the camera");
- uiBlockEndAlign(block);
-
- uiDefBut(block, LABEL, 0, "Show:", 170, 180, 150, 20, 0, 0.0, 0.0, 0, 0, "");
-
- uiBlockBeginAlign(block);
- uiDefButS(block, TOG|BIT|0, REDRAWVIEW3D, "Limits",
- 170, 160, 75, 20, &cam->flag, 0, 0, 0, 0, "Draw the clipping range and the focal point");
- uiDefButS(block, TOG|BIT|1, REDRAWVIEW3D, "Mist",
- 245, 160, 75, 20, &cam->flag, 0, 0, 0, 0, "Draw a line that indicates the mist area");
-
- uiDefButS(block, TOG|BIT|4, REDRAWVIEW3D, "Name",
- 170, 140, 75, 20, &cam->flag, 0, 0, 0, 0, "Draw the active camera's name in camera view");
- uiDefButS(block, TOG|BIT|3, REDRAWVIEW3D, "Title Safe",
- 245, 140, 75, 20, &cam->flag, 0, 0, 0, 0, "Draw a the title safe zone in camera view");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButS(block, TOG|BIT|2, REDRAWVIEW3D, "Passepartout",
- 170, 110, 150, 20, &cam->flag, 0, 0, 0, 0, "Draw a darkened passepartout over the off-screen area in camera view");
- uiDefButF(block, NUMSLI, REDRAWVIEW3D, "Alpha: ",
- 170, 90, 150, 20, &cam->passepartalpha, 0.0, 1.0, 0, 0, "The opacity (darkness) of the passepartout");
- uiBlockEndAlign(block);
-
- uiDefButF(block, NUM,REDRAWVIEW3D, "Size:",
- 170, 50, 150, 20, &cam->drawsize, 0.1*grid, 10.0, 10, 0, "The size that the camera is displayed in the 3D View (different from the object's scale)");
-
- uiDefBut(block, LABEL, 0, "Shift:", 170, 25, 150, 20, 0, 0.0, 0.0, 0, 0, "");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM,REDRAWVIEW3D, "X:",
- 170, 5, 75, 20, &cam->shiftx, -2.0, 2.0, 1, 2, "Horizontally shift the camera view, without changing the perspective");
- uiDefButF(block, NUM,REDRAWVIEW3D, "Y:",
- 245, 5, 75, 20, &cam->shifty, -2.0, 2.0, 1, 2, "Vertically shift the camera view, without changing the perspective");
- uiBlockEndAlign(block);
-}
-
-/* yafray: extra camera panel to set Depth-of-Field parameters */
-static void editing_panel_camera_yafraydof(Object *ob, Camera *cam)
-{
- uiBlock *block;
- char *mst1, *mst2;
-
- block= uiNewBlock(&curarea->uiblocks, "editing_panel_camera_yafraydof", UI_EMBOSS, UI_HELV, curarea->win);
- uiNewPanelTabbed("Camera", "Editing");
- if(uiNewPanel(curarea, block, "Yafray DoF", "Editing", 320, 0, 318, 204)==0) return;
-
- uiDefButF(block, NUM, REDRAWVIEW3D, "DoFDist:", 10, 147, 180, 20, &cam->YF_dofdist, 0.0, 5000.0, 50, 0, "Sets distance to point of focus (use camera 'ShowLimits' to make visible in 3Dview)");
- uiDefButF(block, NUM, B_DIFF, "Aperture:", 10, 125, 180, 20, &cam->YF_aperture, 0.0, 2.0, 1, 0, "Sets lens aperture, the larger, the more blur (use small values, 0 is no DoF)");
-
- uiDefButBitS(block, TOG, CAM_YF_NO_QMC, B_DIFF, "Random sampling", 10, 90, 180, 20, &cam->flag, 0, 0, 0, 0, "Use noisy random Lens sampling instead of QMC");
-
- uiDefBut(block, LABEL, 0, "Bokeh", 10, 60, 180, 19, 0, 0.0, 0.0, 0, 0, "");
- mst1 = "Bokeh Type%t|Disk1%x0|Disk2%x1|Triangle%x2|Square%x3|Pentagon%x4|Hexagon%x5|Ring%x6";
- uiDefButS(block, MENU, B_REDR, mst1, 10, 40, 89, 20, &cam->YF_bkhtype, 0.0, 0.0, 0, 0, "Sets Bokeh type");
-
- if ((cam->YF_bkhtype!=0) && (cam->YF_bkhtype!=6)) {
- mst2 = "Bokeh Bias%t|Uniform%x0|Center%x1|Edge%x2";
- uiDefButS(block, MENU, B_REDR, mst2, 100, 40, 90, 20, &cam->YF_bkhbias, 0.0, 0.0, 0, 0, "Sets Bokeh bias");
- if (cam->YF_bkhtype>1)
- uiDefButF(block, NUM, B_DIFF, "Rotation:", 10, 15, 180, 20, &cam->YF_bkhrot, 0.0, 360.0, 100, 0, "Shape rotation amount in degrees");
- }
-
-}
-
-/* **************************** CAMERA *************************** */
-
-void do_cambuts(unsigned short event)
-{
- Object *ob;
- Camera *cam;
-
- ob= OBACT;
- if (ob==0) return;
- cam= ob->data;
-
- switch(event) {
- case 0:
- ;
- break;
- }
-}
-
-/* *************************** MBALL ******************************** */
-
-void do_mballbuts(unsigned short event)
-{
- switch(event) {
- case B_RECALCMBALL:
- DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- break;
- }
-}
-
-static void editing_panel_mball_type(Object *ob, MetaBall *mb)
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "editing_panel_mball_type", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "MetaBall", "Editing", 320, 0, 318, 204)==0) return;
-
- ob= find_basis_mball(ob);
- mb= ob->data;
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_RECALCMBALL, "Wiresize:", 470,178,250,19, &mb->wiresize, 0.05, 1.0, 1, 0, "Polygonization resolution in 3d window");
- uiDefButF(block, NUM, B_NOP, "Rendersize:", 470,158,250,19, &mb->rendersize, 0.05, 1.0, 1, 0, "Polygonization resolution in rendering");
- uiDefButF(block, NUM, B_RECALCMBALL, "Threshold:", 470,138,250,19, &mb->thresh, 0.0001, 5.0, 1, 0, "Defines influence of meta elements");
-
- uiBlockBeginAlign(block);
- uiBlockSetCol(block, TH_BUT_SETTING1);
- uiDefBut(block, LABEL, 0, "Update:", 471,108,120,19, 0, 0, 0, 0, 0, "");
- uiDefButS(block, ROW, B_DIFF, "Always", 471, 85, 120, 19, &mb->flag, 0.0, 0.0, 0, 0, "While editing, always updates");
- uiDefButS(block, ROW, B_DIFF, "Half Res", 471, 65, 120, 19, &mb->flag, 0.0, 1.0, 0, 0, "While editing, updates in half resolution");
- uiDefButS(block, ROW, B_DIFF, "Fast", 471, 45, 120, 19, &mb->flag, 0.0, 2.0, 0, 0, "While editing, updates without polygonization");
- uiDefButS(block, ROW, B_DIFF, "Never", 471, 25, 120, 19, &mb->flag, 0.0, 3.0, 0, 0, "While editing, doesn't update");
-
-}
-
-static void editing_panel_mball_tools(Object *ob, MetaBall *mb)
-{
- extern MetaElem *lastelem;
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "editing_panel_mball_tools", UI_EMBOSS, UI_HELV, curarea->win);
- if( uiNewPanel(curarea, block, "MetaBall tools", "Editing", 640, 0, 318, 204)==0) return;
-
- if(ob==G.obedit && lastelem) {
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_RECALCMBALL, "Stiffness:", 750,178,250,19, &lastelem->s, 0.0, 10.0, 1, 0, "Stiffness for active meta");
- if(lastelem->type!=MB_BALL)
- uiDefButF(block, NUM, B_RECALCMBALL, "dx:", 750,158,250,19, &lastelem->expx, 0.0, 20.0, 1, 0, "X size for active meta");
- if((lastelem->type!=MB_BALL)&&(lastelem->type!=MB_TUBE))
- uiDefButF(block, NUM, B_RECALCMBALL, "dy:", 750,138,250,19, &lastelem->expy, 0.0, 20.0, 1, 0, "Y size for active meta");
-
- if((lastelem->type==MB_CUBE)||(lastelem->type==MB_ELIPSOID))
- uiDefButF(block, NUM, B_RECALCMBALL, "dz:", 750,118,250,19, &lastelem->expz, 0.0, 20.0, 1, 0, "Z size for active meta");
- uiBlockEndAlign(block);
-
- uiDefButS(block, ROW, B_RECALCMBALL, "Ball", 753,83,60,19, &lastelem->type, 1.0, MB_BALL, 0, 0, "Draw active meta as Ball");
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW, B_RECALCMBALL, "Tube", 753,62,60,19, &lastelem->type, 1.0, MB_TUBE, 0, 0, "Draw active meta as Ball");
- uiDefButS(block, ROW, B_RECALCMBALL, "Plane", 814,62,60,19, &lastelem->type, 1.0, MB_PLANE, 0, 0, "Draw active meta as Plane");
- uiDefButS(block, ROW, B_RECALCMBALL, "Elipsoid", 876,62,60,19, &lastelem->type, 1.0, MB_ELIPSOID, 0, 0, "Draw active meta as Ellipsoid");
- uiDefButS(block, ROW, B_RECALCMBALL, "Cube", 938,62,60,19, &lastelem->type, 1.0, MB_CUBE, 0, 0, "Draw active meta as Cube");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, MB_NEGATIVE, B_RECALCMBALL, "Negative",753,16,125,19, &lastelem->flag, 0, 0, 0, 0, "Make active meta creating holes");
- uiDefButBitS(block, TOG, MB_HIDE, B_RECALCMBALL, "Hide",878,16,125,19, &lastelem->flag, 0, 0, 0, 0, "Make active meta invisible");
- uiBlockEndAlign(block);
-
- }
-
-}
-
-
-/* *************************** LATTICE ******************************** */
-
-void do_latticebuts(unsigned short event)
-{
- Object *ob;
- Lattice *lt;
-
- ob= OBACT;
- if(ob->type!=OB_LATTICE) return;
-
- switch(event) {
- case B_REGULARLAT:
- if(ob) {
- lt = ob->data;
- if(ob==G.obedit) resizelattice(editLatt, lt->opntsu, lt->opntsv, lt->opntsw, NULL);
- else resizelattice(ob->data, lt->opntsu, lt->opntsv, lt->opntsw, NULL);
- ob->softflag |= OB_SB_REDO;
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- }
- case B_RESIZELAT:
- if(ob) {
- lt = ob->data;
- resizelattice(ob->data, lt->opntsu, lt->opntsv, lt->opntsw, ob);
- ob->softflag |= OB_SB_REDO;
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- }
- break;
- case B_DRAWLAT:
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_LATTCHANGED:
-
- lt= ob->data;
- if(lt->flag & LT_OUTSIDE) outside_lattice(lt);
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
-
- allqueue(REDRAWVIEW3D, 0);
-
- break;
- }
-}
-
-static void editing_panel_lattice_type(Object *ob, Lattice *lt)
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "editing_panel_lattice_type", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Lattice", "Editing", 320, 0, 318, 204)==0) return;
-
-
- uiSetButLock(lt->key!=0, "Not with VertexKeys");
- uiSetButLock(ob==G.obedit, "Unable to perform function in EditMode");
-
- uiBlockBeginAlign(block);
-
- lt->opntsu = lt->pntsu;
- lt->opntsv = lt->pntsv;
- lt->opntsw = lt->pntsw;
-
- uiDefButS(block, NUM, B_RESIZELAT, "U:", 469, 178,100,19, &lt->opntsu, 1.0, 64.0, 0, 0, "Points in U direction");
- uiDefButC(block, ROW, B_LATTCHANGED, "Lin", 572, 178, 40, 19, &lt->typeu, 1.0, (float)KEY_LINEAR, 0, 0, "Set Linear interpolation");
- uiDefButC(block, ROW, B_LATTCHANGED, "Card", 613, 178, 40, 19, &lt->typeu, 1.0, (float)KEY_CARDINAL, 0, 0, "Set Cardinal interpolation");
- uiDefButC(block, ROW, B_LATTCHANGED, "B", 652, 178, 40, 19, &lt->typeu, 1.0, (float)KEY_BSPLINE, 0, 0, "Set B-spline interpolation");
-
- uiDefButS(block, NUM, B_RESIZELAT, "V:", 469, 156,100,19, &lt->opntsv, 1.0, 64.0, 0, 0, "Points in V direction");
- uiDefButC(block, ROW, B_LATTCHANGED, "Lin", 572, 156, 40, 19, &lt->typev, 2.0, (float)KEY_LINEAR, 0, 0, "Set Linear interpolation");
- uiDefButC(block, ROW, B_LATTCHANGED, "Card", 613, 156, 40, 19, &lt->typev, 2.0, (float)KEY_CARDINAL, 0, 0, "Set Cardinal interpolation");
- uiDefButC(block, ROW, B_LATTCHANGED, "B", 652, 156, 40, 19, &lt->typev, 2.0, (float)KEY_BSPLINE, 0, 0, "Set B-spline interpolation");
-
- uiDefButS(block, NUM, B_RESIZELAT, "W:", 469, 134,100,19, &lt->opntsw, 1.0, 64.0, 0, 0, "Points in W direction");
- uiDefButC(block, ROW, B_LATTCHANGED, "Lin", 572, 134, 40, 19, &lt->typew, 3.0, (float)KEY_LINEAR, 0, 0, "Set Linear interpolation");
- uiDefButC(block, ROW, B_LATTCHANGED, "Card", 613, 134, 40, 19, &lt->typew, 3.0, (float)KEY_CARDINAL, 0, 0, "Set Cardinal interpolation");
- uiDefButC(block, ROW, B_LATTCHANGED, "B", 652, 134, 40, 19, &lt->typew, 3.0, (float)KEY_BSPLINE, 0, 0, "Set B-spline interpolation");
-
- uiBlockEndAlign(block);
-
- uiDefBut(block, BUT, B_REGULARLAT, "Make Regular", 469,98,102,31, 0, 0, 0, 0, 0, "Make Lattice regular");
-
- uiClearButLock();
- uiDefButBitS(block, TOG, LT_OUTSIDE, B_LATTCHANGED, "Outside", 571,98,122,31, &lt->flag, 0, 0, 0, 0, "Only draw, and take into account, the outer vertices");
-
- if(lt->key) {
- uiDefButS(block, NUM, B_DIFF, "Slurph:", 469,60,120,19, &(lt->key->slurph), -500.0, 500.0, 0, 0, "Set time value to denote 'slurph' (sequential delay) vertices with key framing");
- uiDefButS(block, TOG, B_RELKEY, "Relative Keys", 469,40,120,19, &lt->key->type, 0, 0, 0, 0, "Use relative keys (instead of absolute)");
- }
-
-}
-
-/* *************************** ARMATURE ******************************** */
-
-void do_armbuts(unsigned short event)
-{
- Object *ob= OBACT;
-
- switch(event) {
- case B_ARM_RECALCDATA:
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 1);
- allqueue(REDRAWBUTSEDIT, 0);
- break;
- case B_ARM_STRIDE:
- if(ob && ob->pose) {
- bPoseChannel *pchan;
- bActionStrip *strip;
-
- for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next)
- if(pchan->flag & POSE_STRIDE)
- break;
-
- /* we put the stride bone name in the strips, for lookup of action channel */
- for (strip=ob->nlastrips.first; strip; strip=strip->next){
- if(strip->flag & ACTSTRIP_USESTRIDE) {
- if(pchan) BLI_strncpy(strip->stridechannel, pchan->name, 32);
- else strip->stridechannel[0]= 0;
- }
- }
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 1);
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- }
- break;
- case B_ARM_CALCPATHS:
- if (ob && ob->pose)
- pose_calculate_path(ob);
- break;
- case B_ARM_CLEARPATHS:
- if (ob && ob->pose)
- pose_clear_paths(ob);
- break;
- }
-}
-
-static void validate_stridebutton_cb(void *pchanv, void *poin)
-{
- Object *ob= OBACT;
- bPoseChannel *pchan;
-
- if(ob && ob->pose) {
- for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next){
- if(pchan!=pchanv)
- pchan->flag &= ~POSE_STRIDE;
- }
- }
-}
-
-static int editbone_to_parnr (EditBone *bone)
-{
- EditBone *ebone;
- int index;
-
- for (ebone=G.edbo.first, index=0; ebone; ebone=ebone->next, index++){
- if (ebone==bone)
- return index;
- }
-
- return -1;
-}
-
-
-/* the "IK" button in editbuttons */
-static void attach_bone_to_parent_cb(void *bonev, void *arg2_unused)
-{
- EditBone *ebone= bonev;
-
- if (ebone->parent && (ebone->flag & BONE_CONNECTED)) {
- /* Attach this bone to its parent */
- VECCOPY(ebone->head, ebone->parent->tail);
- }
-}
-
-static void parnr_to_editbone(EditBone *bone)
-{
- if (bone->parNr == -1){
- bone->parent = NULL;
- bone->flag &= ~BONE_CONNECTED;
- }
- else{
- bone->parent = BLI_findlink(&G.edbo, bone->parNr);
- attach_bone_to_parent_cb(bone, NULL);
- }
-}
-
-static void parnr_to_editbone_cb(void *bonev, void *arg2_unused)
-{
- EditBone *curBone= bonev;
- parnr_to_editbone(curBone);
-}
-
-/* only used for showing parent of editbones */
-static void build_bonestring (char *string, EditBone *bone)
-{
- bArmature *arm= G.obedit->data;
- EditBone *curBone;
- EditBone *pBone;
- int skip=0;
- int index, numbones, i;
- char (*qsort_ptr)[32] = NULL;
-
- /* That space is there for a reason - for no parent */
- sprintf (string, "Parent%%t| %%x%d", -1);
-
- numbones = BLI_countlist(&G.edbo);
-
- /*
- * This will hold the bone names temporarily so we can sort them
- */
- if (numbones > 0)
- qsort_ptr = MEM_callocN (numbones * sizeof (qsort_ptr[0]),
- "qsort_ptr");
-
- numbones = 0;
- for (curBone = G.edbo.first, index=0; curBone;
- curBone=curBone->next, index++){
- /* Make sure this is a valid child */
- if (curBone != bone){
- skip=0;
- for (pBone=curBone->parent; pBone; pBone=pBone->parent){
- if (pBone==bone){
- skip=1;
- break;
- }
- }
- /* no browsing for bones in invisible layers */
- if ((arm->layer & curBone->layer) == 0) {
- /* but ensure the current parent at least shows */
- if(bone->parent!=curBone)
- skip= 1;
- }
-
- if (skip)
- continue;
-
- sprintf (qsort_ptr[numbones], "|%s%%x%d", curBone->name, index);
- numbones++;
- }
- }
- qsort (qsort_ptr, numbones, sizeof (qsort_ptr[0]),
- ( int (*)(const void *, const void *) ) strcmp);
-
- for (i=0; i < numbones; ++i) {
- sprintf (string, "%s%s", string, qsort_ptr[i]);
- }
-
- if (qsort_ptr)
- MEM_freeN(qsort_ptr);
-}
-
-/* assumes armature editmode */
-/* exported to drawview.c via BIF_butspace.h */
-void validate_editbonebutton_cb(void *bonev, void *namev)
-{
- EditBone *eBone= bonev;
- char oldname[32], newname[32];
-
- /* need to be on the stack */
- BLI_strncpy(newname, eBone->name, 32);
- BLI_strncpy(oldname, (char *)namev, 32);
- /* restore */
- BLI_strncpy(eBone->name, oldname, 32);
-
- armature_bone_rename(G.obedit->data, oldname, newname); // editarmature.c
- allqueue(REDRAWALL, 0);
-}
-
-/* assumes armature posemode */
-static void validate_posebonebutton_cb(void *bonev, void *namev)
-{
- Bone *bone= bonev;
- Object *ob= OBACT;
- char oldname[32], newname[32];
-
- /* need to be on the stack */
- BLI_strncpy(newname, bone->name, 32);
- BLI_strncpy(oldname, (char *)namev, 32);
- /* restore */
- BLI_strncpy(bone->name, oldname, 32);
-
- armature_bone_rename(ob->data, oldname, newname); // editarmature.c
- allqueue(REDRAWALL, 0);
-}
-
-static void armature_layer_cb(void *lay_v, void *value_v)
-{
- short *layer= lay_v;
- int value= (long)value_v;
-
- if(*layer==0 || G.qual==0) *layer= value;
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
-}
-
-static void editing_panel_armature_type(Object *ob, bArmature *arm)
-{
- uiBlock *block;
- uiBut *but;
- int a;
-
- block= uiNewBlock(&curarea->uiblocks, "editing_panel_armature_type", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Armature", "Editing", 320, 0, 318, 204)==0) return;
-
- uiDefBut(block, LABEL, 0, "Editing Options", 10,180,150,20, 0, 0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, ARM_MIRROR_EDIT, B_DIFF, "X-Axis Mirror", 10, 160,100,20, &arm->flag, 0, 0, 0, 0, "Enable X-axis mirrored editing");
- uiDefButBitC(block, TOG, OB_DRAWXRAY,REDRAWVIEW3D, "X-Ray", 110,160,100,20, &ob->dtx, 0, 0, 0, 0, "Draw armature in front of solid objects");
- uiDefButBitI(block, TOG, ARM_AUTO_IK, B_DIFF, "Auto IK", 210,160,100,20, &arm->flag, 0, 0, 0, 0, "Adds temporal IK chains while grabbing Bones");
- uiBlockEndAlign(block);
-
- uiDefBut(block, LABEL, 0, "Display Options", 10,133,150,19, 0, 0, 0, 0, 0, "");
-
- /* layers */
- uiBlockBeginAlign(block);
- for(a=0; a<8; a++) {
- short dx= 18;
- but= uiDefButBitS(block, BUT_TOGDUAL, 1<<a, REDRAWVIEW3D, "", 10+a*dx, 115, dx, 15, &arm->layer, 0, 0, 0, 0, "");
- uiButSetFunc(but, armature_layer_cb, &arm->layer, (void *)(1<<a));
- }
- uiBlockBeginAlign(block);
- for(a=8; a<16; a++) {
- short dx= 18;
- but= uiDefButBitS(block, BUT_TOGDUAL, 1<<a, REDRAWVIEW3D, "", 18+a*dx, 115, dx, 15, &arm->layer, 0, 0, 0, 0, "");
- uiButSetFunc(but, armature_layer_cb, &arm->layer, (void *)(1<<a));
- }
- /* quite bad here, but I don't know a better place for copy... */
- if(ob->pose)
- ob->pose->proxy_layer= arm->layer;
-
- uiBlockBeginAlign(block);
- uiDefButI(block, ROW, REDRAWVIEW3D, "Octahedron", 10, 87,90,20, &arm->drawtype, 0, ARM_OCTA, 0, 0, "Draw bones as octahedra");
- uiDefButI(block, ROW, REDRAWVIEW3D, "Stick", 100, 87,55,20, &arm->drawtype, 0, ARM_LINE, 0, 0, "Draw bones as simple 2d lines with dots");
- uiDefButI(block, ROW, REDRAWVIEW3D, "B-Bone", 155, 87,70,20, &arm->drawtype, 0, ARM_B_BONE, 0, 0, "Draw bones as boxes, showing subdivision and b-splines");
- uiDefButI(block, ROW, REDRAWVIEW3D, "Envelope", 225, 87,85,20, &arm->drawtype, 0, ARM_ENVELOPE, 0, 0, "Draw bones as extruded spheres, showing deformation influence volume");
-
- uiDefButBitI(block, TOG, ARM_DRAWAXES, REDRAWVIEW3D, "Draw Axes", 10, 67,100,20, &arm->flag, 0, 0, 0, 0, "Draw bone axes");
- uiDefButBitI(block, TOG, ARM_DRAWNAMES, REDRAWVIEW3D, "Draw Names", 110,67,100,20, &arm->flag, 0, 0, 0, 0, "Draw bone names");
- uiDefButBitI(block, TOGN, ARM_NO_CUSTOM, REDRAWVIEW3D, "Draw Shapes", 210,67,100,20, &arm->flag, 0, 0, 0, 0, "Draw custom bone shapes");
-
- uiBlockEndAlign(block);
-
- uiDefBut(block, LABEL, 0, "Deform Options", 10,40,150,20, 0, 0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, ARM_DEF_VGROUP, B_ARM_RECALCDATA, "Vertex Groups", 10, 20,100,20, &arm->deformflag, 0, 0, 0, 0, "Enable VertexGroups defining deform (not for Modifiers)");
- uiDefButBitS(block, TOG, ARM_DEF_ENVELOPE, B_ARM_RECALCDATA, "Envelopes", 110,20,100,20, &arm->deformflag, 0, 0, 0, 0, "Enable Bone Envelopes defining deform (not for Modifiers)");
- uiDefButBitS(block, TOG, ARM_DEF_QUATERNION, B_ARM_RECALCDATA, "Quaternion", 210,20,100,20, &arm->deformflag, 0, 0, 0, 0, "Enable deform rotation interpolation with Quaternions (not for Modifiers)");
- uiDefButBitI(block, TOG, ARM_RESTPOS, B_ARM_RECALCDATA,"Rest Position", 10,0,100,20, &arm->flag, 0, 0, 0, 0, "Show armature rest position, no posing possible");
- uiDefButBitI(block, TOG, ARM_DELAYDEFORM, REDRAWVIEW3D, "Delay Deform", 110,0,100,20, &arm->flag, 0, 0, 0, 0, "Don't deform children when manipulating bones in pose mode");
- uiDefButBitS(block, TOG, ARM_DEF_B_BONE_REST, B_ARM_RECALCDATA,"B-Bone Rest", 210,0,100,20, &arm->deformflag, 0, 0, 0, 0, "Make B-Bones deform already in rest position");
- uiBlockEndAlign(block);
-}
-
-static void editing_panel_armature_visuals(Object *ob, bArmature *arm)
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "editing_panel_armature_visuals", UI_EMBOSS, UI_HELV, curarea->win);
- uiNewPanelTabbed("Armature", "Editing");
- if(uiNewPanel(curarea, block, "Armature Visualisations", "Editing", 320, 0, 318, 204)==0) return;
-
- /* version patch for older files here (do_versions patch too complicated) */
- if ((arm->ghostsf == 0) || (arm->ghostef == 0)) {
- arm->ghostsf = CFRA - (arm->ghostep * arm->ghostsize);
- arm->ghostef = CFRA + (arm->ghostep * arm->ghostsize);
- }
- if ((arm->pathsf == 0) || (arm->pathef == 0)) {
- arm->pathsf = SFRA;
- arm->pathef = EFRA;
- }
- if ((arm->pathbc == 0) || (arm->pathac == 0)) {
- arm->pathbc = 15;
- arm->pathac = 15;
- }
-
- /* Ghost Drawing Options */
- uiDefBut(block, LABEL, 0, "Ghost Options", 10,180,150,20, 0, 0, 0, 0, 0, "");
-
- uiBlockBeginAlign(block);
- uiDefButS(block, MENU, REDRAWVIEW3D, "Ghosts %t|Around Current Frame %x0|In Range %x1|On Keyframes %x2",
- 10, 160, 150, 20, &arm->ghosttype, 0, 0, 0, 0, "Choose range of Ghosts to draw for current Action");
-
- if (arm->ghosttype != ARM_GHOST_KEYS)
- uiDefButS(block, NUM, REDRAWVIEW3D, "GStep: ", 10,140,120,20, &arm->ghostsize, 1.0f, 20.0f, 0, 0, "How many frames between Ghost instances");
- else
- uiDefBut(block, LABEL, REDRAWVIEW3D, "GStep: N/A", 10,140,120,20, NULL, 0.0f, 0.0f, 0, 0, "How many frames between Ghost instances");
- uiDefButBitI(block, TOG, ARM_GHOST_ONLYSEL, REDRAWVIEW3D, "Sel", 130, 140, 30, 20, &arm->flag, 0, 0, 0, 0, "Only show Ghosts for selected bones");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- if (arm->ghosttype == ARM_GHOST_CUR) {
- /* range is around current frame */
- uiDefButS(block, NUM, REDRAWVIEW3D, "Ghost: ", 10,110,150,20, &arm->ghostep, 0.0f, 30.0f, 0, 0, "Draw Ghosts around current frame, for current Action");
- }
- else if (ELEM(arm->ghosttype, ARM_GHOST_RANGE, ARM_GHOST_KEYS)) {
- /* range is defined by start+end frame below */
- uiDefButI(block, NUM,REDRAWVIEW3D,"GSta:",10,110,150,20, &arm->ghostsf,1.0,MAXFRAMEF, 0, 0, "The start frame for Ghost display range");
- uiDefButI(block, NUM,REDRAWVIEW3D,"GEnd:",10,90,150,20, &arm->ghostef,arm->ghostsf,MAXFRAMEF, 0, 0, "The end frame for Ghost display range");
- }
- uiBlockEndAlign(block);
-
- /* Bone Path Drawing Options */
- uiDefBut(block, LABEL, 0, "Bone Paths Drawing:", 165,180,170,20, 0, 0, 0, 0, 0, "");
-
- uiBlockBeginAlign(block);
- uiDefButS(block, NUM, REDRAWVIEW3D, "PStep:",170,160,80,20, &arm->pathsize,1,100, 10, 50, "Frames between highlighted points on bone path");
- uiDefButBitS(block, TOG, ARM_PATH_FNUMS, REDRAWVIEW3D, "Frame Nums", 250, 160, 80, 20, &arm->pathflag, 0, 0, 0, 0, "Show frame numbers on path");
-
- uiDefButBitS(block, TOG, ARM_PATH_KFRAS, REDRAWVIEW3D, "Show Keys", 170, 140, 80, 20, &arm->pathflag, 0, 0, 0, 0, "Show key frames on path");
- uiDefButBitS(block, TOG, ARM_PATH_KFNOS, REDRAWVIEW3D, "Keyframe Nums", 250, 140, 80, 20, &arm->pathflag, 0, 0, 0, 0, "Show frame numbers of key frames on path");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, ARM_PATH_ACFRA, REDRAWVIEW3D, "Around Current Frame", 170, 110, 160, 20, &arm->pathflag, 0, 0, 0, 0, "Only show Bone Path around the current frame");
-
- /* only show extra ranges when needed */
- if (arm->pathflag & ARM_PATH_ACFRA) {
- uiDefButI(block, NUM, REDRAWVIEW3D,"PPre:",170,90,80,20, &arm->pathbc, 1.0, MAXFRAMEF/2, 0, 0, "The number of frames before current frame for Bone Path display range");
- uiDefButI(block, NUM, REDRAWVIEW3D,"PPost:",250,90,80,20, &arm->pathac, 1.0, MAXFRAMEF/2, 0, 0, "The number of frames after current frame for Bone Path display range");
- }
- uiBlockEndAlign(block);
-
- /* Bone Path Calculation Options */
- uiDefBut(block, LABEL, 0, "Bone Paths Calc.", 10,50,170,20, 0, 0, 0, 0, 0, "");
-
- uiBlockBeginAlign(block);
- uiDefBut(block, BUT, B_ARM_CALCPATHS, "Calculate Paths", 10,30,155,20, 0, 0, 0, 0, 0, "(Re)calculates the paths of the selected bones");
- uiDefBut(block, BUT, B_ARM_CLEARPATHS, "Clear Paths", 10,10,155,20, 0, 0, 0, 0, 0, "Clears bone paths of the selected bones");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, ARM_PATH_HEADS, REDRAWVIEW3D, "Bone-Head Path", 170, 30, 160, 20, &arm->pathflag, 0, 0, 0, 0, "Calculate the Path travelled by the Bone's Head instead of Tail");
- uiDefButI(block, NUM,REDRAWVIEW3D,"PSta:",170,10,80,20, &arm->pathsf, 1.0, MAXFRAMEF, 0, 0, "The start frame for Bone Path display range");
- uiDefButI(block, NUM,REDRAWVIEW3D,"PEnd:",250,10,80,20, &arm->pathef, arm->pathsf, MAXFRAMEF, 0, 0, "The end frame for Bone Path display range");
- uiBlockEndAlign(block);
-}
-
-/* autocomplete callback for editbones */
-static void autocomplete_editbone(char *str, void *arg_v)
-{
- if(G.obedit==NULL) return;
-
- /* search if str matches the beginning of an ID struct */
- if(str[0]) {
- AutoComplete *autocpl= autocomplete_begin(str, 32);
- EditBone *ebone;
-
- for (ebone=G.edbo.first; ebone; ebone=ebone->next)
- if(ebone->name!=str)
- autocomplete_do_name(autocpl, ebone->name);
-
- autocomplete_end(autocpl, str);
- }
-}
-
-static void editing_panel_armature_bones(Object *ob, bArmature *arm)
-{
- uiBlock *block;
- uiBut *but;
- EditBone *curBone;
- char *boneString=NULL;
- int by=180;
- int index, a;
-
- /* Draw the bone name block */
-
- block= uiNewBlock(&curarea->uiblocks, "editing_panel_armature_bones", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Armature Bones", "Editing", 640, 0, 318, 204)==0) return;
-
- /* this is a variable height panel, newpanel doesnt force new size on existing panels */
- /* so first we make it default height */
- uiNewPanelHeight(block, 204);
-
-
- uiDefBut(block, LABEL, 0, "Selected Bones", 0,by,158,18, 0, 0, 0, 0, 0, "Only show in Armature Editmode");
- by-=20;
- for (curBone=G.edbo.first, index=0; curBone; curBone=curBone->next, index++){
- if ((curBone->flag & BONE_SELECTED) && (curBone->layer & arm->layer)) {
-
- /* Bone naming button */
- but=uiDefBut(block, TEX, REDRAWVIEW3D, "BO:", -10,by,117,18, curBone->name, 0, 31, 0, 0, "Change the bone name");
- uiButSetFunc(but, validate_editbonebutton_cb, curBone, NULL);
- uiButSetCompleteFunc(but, autocomplete_editbone, (void *)OBACT);
-
- uiDefBut(block, LABEL, 0, "child of", 107,by,73,18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- boneString = MEM_mallocN((BLI_countlist(&G.edbo) * 64)+64, "Bone str");
- build_bonestring (boneString, curBone);
-
- curBone->parNr = editbone_to_parnr(curBone->parent);
- but = uiDefButI(block, MENU,REDRAWVIEW3D, boneString, 180,by,120,18, &curBone->parNr, 0.0, 0.0, 0.0, 0.0, "Parent");
- /* last arg NULL means button will put old string there */
- uiButSetFunc(but, parnr_to_editbone_cb, curBone, NULL);
-
- MEM_freeN(boneString);
-
- /* Connect to parent flag */
- if (curBone->parent){
- but=uiDefButBitI(block, TOG, BONE_CONNECTED, B_ARM_RECALCDATA, "Con", 300,by,32,18, &curBone->flag, 0.0, 0.0, 0.0, 0.0, "Connect this Bone to Parent");
- uiButSetFunc(but, attach_bone_to_parent_cb, curBone, NULL);
- }
-
- /* Segment, dist and weight buttons */
- uiBlockBeginAlign(block);
- uiDefButS(block, NUM, B_ARM_RECALCDATA, "Segm: ", -10,by-19,117,18, &curBone->segments, 1.0, 32.0, 0.0, 0.0, "Subdivisions for B-bones");
- uiDefButF(block, NUM,B_ARM_RECALCDATA, "Dist:", 110, by-19, 105, 18, &curBone->dist, 0.0, 1000.0, 10.0, 0.0, "Bone deformation distance");
- uiDefButF(block, NUM,B_ARM_RECALCDATA, "Weight:", 225, by-19,105, 18, &curBone->weight, 0.0F, 1000.0F, 10.0F, 0.0F, "Bone deformation weight");
-
- /* bone types */
- uiDefButBitI(block, TOG, BONE_HINGE, B_ARM_RECALCDATA, "Hinge", -10,by-38,80,18, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Don't inherit rotation or scale from parent Bone");
- uiDefButBitI(block, TOG, BONE_NO_SCALE, B_ARM_RECALCDATA, "S", 70,by-38,20,18, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Don't inherit rotation or scale from parent Bone");
- uiDefButBitI(block, TOGN, BONE_NO_DEFORM, B_ARM_RECALCDATA, "Deform", 90, by-38, 80, 18, &curBone->flag, 0.0, 0.0, 0.0, 0.0, "Indicate if Bone deforms geometry");
- uiDefButBitI(block, TOG, BONE_MULT_VG_ENV, B_ARM_RECALCDATA, "Mult", 170,by-38,80,18, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Multiply Bone Envelope with VertexGroup");
- uiDefButBitI(block, TOG, BONE_HIDDEN_A, REDRAWVIEW3D, "Hide", 250,by-38,80,18, &curBone->flag, 0, 0, 0, 0, "Toggles display of this bone in Edit Mode");
-
- /* layers */
- uiBlockBeginAlign(block);
- for(a=0; a<8; a++) {
- short dx= 21;
- but= uiDefButBitS(block, TOG, 1<<a, REDRAWVIEW3D, "", -10+a*dx, by-57, dx, 15, &curBone->layer, 0, 0, 0, 0, "Armature layer that bone exists on");
- uiButSetFunc(but, armature_layer_cb, &curBone->layer, (void *)(1<<a));
- }
- uiBlockBeginAlign(block);
- for(a=8; a<16; a++) {
- short dx= 21;
- but= uiDefButBitS(block, TOG, 1<<a, REDRAWVIEW3D, "", -6+a*dx, by-57, dx, 15, &curBone->layer, 0, 0, 0, 0, "Armature layer that bone exists on");
- uiButSetFunc(but, armature_layer_cb, &curBone->layer, (void *)(1<<a));
- }
-
- uiBlockEndAlign(block);
- by-=80;
-
- if(by < -200) break; // for time being... extreme long panels are very slow
- }
- }
-
- if(by<0) {
- uiNewPanelHeight(block, 204 - by);
- }
-
-}
-
-/* sets warning popup for buttons, and returns 1 for protected proxy posechannels */
-static int ob_arm_bone_pchan_lock(Object *ob, bArmature *arm, Bone *bone, bPoseChannel *pchan)
-{
- /* ob lib case is already set globally */
- if(ob->id.lib)
- return 0;
- if(arm->id.lib) {
- if(pchan==NULL)
- uiSetButLock(1, ERROR_LIBDATA_MESSAGE);
- else if(ob->proxy && bone->layer & arm->layer_protected) {
- uiSetButLock(1, "Can't edit protected proxy channel");
- return 1;
- }
- else
- uiClearButLock();
- }
- return 0;
-}
-
-static void editing_panel_pose_bones(Object *ob, bArmature *arm)
-{
- uiBlock *block;
- uiBut *but;
- bPoseChannel *pchan;
- Bone *curBone;
- int by, a;
- int index, zerodof, zerolimit;
-
- /* Draw the bone name block */
- block= uiNewBlock(&curarea->uiblocks, "editing_panel_pose_bones", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Armature Bones", "Editing", 640, 0, 318, 204)==0) return;
-
- /* this is a variable height panel, newpanel doesnt force new size on existing panels */
- /* so first we make it default height */
- uiNewPanelHeight(block, 204);
-
- uiDefBut(block, LABEL, 0, "Selected Bones", 0,180,158,18, 0, 0, 0, 0, 0, "Only show in Armature Editmode/Posemode");
- by= 160;
-
- for (pchan=ob->pose->chanbase.first, index=0; pchan; pchan=pchan->next, index++){
- curBone= pchan->bone;
- if ((curBone->flag & BONE_SELECTED) && (curBone->layer & arm->layer)) {
-
- if(ob_arm_bone_pchan_lock(ob, arm, curBone, pchan))
- uiDefBut(block, LABEL, 0, "Proxy Locked", 160, 180,150,18, NULL, 1, 0, 0, 0, "");
-
- /* Bone naming button */
- uiBlockBeginAlign(block);
- but=uiDefBut(block, TEX, REDRAWVIEW3D, "BO:", -10,by,117,19, curBone->name, 0, 24, 0, 0, "Change the bone name");
- uiButSetFunc(but, validate_posebonebutton_cb, curBone, NULL);
- uiButSetCompleteFunc(but, autocomplete_bone, (void *)ob);
-
- /* Dist and weight buttons */
- uiDefButF(block, NUM,B_ARM_RECALCDATA, "Dist:", 107, by, 105, 19, &curBone->dist, 0.0, 1000.0, 10.0, 0.0, "Bone deformation distance");
- uiDefButF(block, NUM,B_ARM_RECALCDATA, "Weight:", 220, by, 110, 19, &curBone->weight, 0.0F, 1000.0F, 10.0F, 0.0F, "Bone deformation weight");
-
- /* Segment, ease in/out buttons */
- uiBlockBeginAlign(block);
- uiDefButS(block, NUM, B_ARM_RECALCDATA, "Segm: ", -10,by-19,117,19, &curBone->segments, 1.0, 32.0, 0.0, 0.0, "Subdivisions for B-bones");
- uiDefButF(block, NUM,B_ARM_RECALCDATA, "In:", 107, by-19,105, 19, &curBone->ease1, 0.0, 2.0, 10.0, 0.0, "First length of Bezier handle");
- uiDefButF(block, NUM,B_ARM_RECALCDATA, "Out:", 220, by-19, 110, 19, &curBone->ease2, 0.0, 2.0, 10.0, 0.0, "Second length of Bezier handle");
-
- /* bone types */
- uiDefButBitI(block, TOG, BONE_HINGE, B_ARM_RECALCDATA, "Hinge", -10,by-38,80,19, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Don't inherit rotation or scale from parent Bone");
- uiDefButBitI(block, TOG, BONE_NO_SCALE, B_ARM_RECALCDATA, "S", 70,by-38,20,19, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Don't inherit scale from parent Bone");
- uiDefButBitI(block, TOGN, BONE_NO_DEFORM, B_ARM_RECALCDATA, "Deform", 90, by-38, 80, 19, &curBone->flag, 0.0, 0.0, 0.0, 0.0, "Indicate if Bone deforms geometry");
- uiDefButBitI(block, TOG, BONE_MULT_VG_ENV, B_ARM_RECALCDATA, "Mult", 170,by-38,80,19, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Multiply Bone Envelope with VertexGroup");
- ob_arm_bone_pchan_lock(ob, arm, curBone, pchan);
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, REDRAWVIEW3D, "OB:", 250,by-38,80,19, &pchan->custom, "Object that defines custom draw type for this Bone");
- ob_arm_bone_pchan_lock(ob, arm, curBone, NULL);
-
- /* layers */
- uiBlockBeginAlign(block);
- for(a=0; a<8; a++) {
- short dx= 21;
- but= uiDefButBitS(block, TOG, 1<<a, REDRAWVIEW3D, "", -10+a*dx, by-57, dx, 15, &curBone->layer, 0, 0, 0, 0, "Armature layer that bone exists on");
- uiButSetFunc(but, armature_layer_cb, &curBone->layer, (void *)(1<<a));
- }
- uiBlockBeginAlign(block);
- for(a=8; a<16; a++) {
- short dx= 21;
- but= uiDefButBitS(block, TOG, 1<<a, REDRAWVIEW3D, "", -6+a*dx, by-57, dx, 15, &curBone->layer, 0, 0, 0, 0, "Armature layer that bone exists on");
- uiButSetFunc(but, armature_layer_cb, &curBone->layer, (void *)(1<<a));
- }
- uiBlockEndAlign(block);
-
- by-= 20;
-
- ob_arm_bone_pchan_lock(ob, arm, curBone, pchan);
-
- /* DOFs only for IK chains */
- zerodof = 1;
- zerolimit = 1;
- if(pose_channel_in_IK_chain(ob, pchan)) {
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, BONE_IK_NO_XDOF, B_ARM_RECALCDATA, "Lock X Rot", -10,by-60,114,19, &pchan->ikflag, 0.0, 0.0, 0.0, 0.0, "Disable X DoF for IK");
- if ((pchan->ikflag & BONE_IK_NO_XDOF)==0) {
- uiDefButF(block, NUM, B_ARM_RECALCDATA, "Stiff X:", -10, by-80, 114, 19, &pchan->stiffness[0], 0.0, 0.99, 1.0, 0.0, "Resistance to bending for X axis");
- uiDefButBitS(block, TOG, BONE_IK_XLIMIT, B_ARM_RECALCDATA, "Limit X", -10,by-100,114,19, &pchan->ikflag, 0.0, 0.0, 0.0, 0.0, "Limit rotation over X axis");
- if ((pchan->ikflag & BONE_IK_XLIMIT)) {
- uiDefButF(block, NUM, B_ARM_RECALCDATA, "Min X:", -10, by-120, 114, 19, &pchan->limitmin[0], -180.0, 0.0, 1000, 1, "Minimum X limit");
- uiDefButF(block, NUM, B_ARM_RECALCDATA, "Max X:", -10, by-140, 114, 19, &pchan->limitmax[0], 0.0, 180.0f, 1000, 1, "Maximum X limit");
- zerolimit = 0;
- }
- zerodof = 0;
- }
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, BONE_IK_NO_YDOF, B_ARM_RECALCDATA, "Lock Y Rot", 104,by-60,113,19, &pchan->ikflag, 0.0, 0.0, 0.0, 0.0, "Disable Y DoF for IK");
- if ((pchan->ikflag & BONE_IK_NO_YDOF)==0) {
- uiDefButF(block, NUM, B_ARM_RECALCDATA, "Stiff Y:", 104, by-80, 114, 19, &pchan->stiffness[1], 0.0, 0.99, 1.0, 0.0, "Resistance to twisting over Y axis");
- uiDefButBitS(block, TOG, BONE_IK_YLIMIT, B_ARM_RECALCDATA, "Limit Y", 104,by-100,113,19, &pchan->ikflag, 0.0, 0.0, 0.0, 0.0, "Limit rotation over Y axis");
- if ((pchan->ikflag & BONE_IK_YLIMIT)) {
- uiDefButF(block, NUM, B_ARM_RECALCDATA, "Min Y:", 104, by-120, 113, 19, &pchan->limitmin[1], -180.0, 0.0, 1000, 1, "Minimum Y limit");
- uiDefButF(block, NUM, B_ARM_RECALCDATA, "Max Y:", 104, by-140, 113, 19, &pchan->limitmax[1], 0.0, 180.0, 1000, 1, "Maximum Y limit");
- zerolimit = 0;
- }
- zerodof = 0;
- }
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, BONE_IK_NO_ZDOF, B_ARM_RECALCDATA, "Lock Z Rot", 217,by-60,113,19, &pchan->ikflag, 0.0, 0.0, 0.0, 0.0, "Disable Z DoF for IK");
- if ((pchan->ikflag & BONE_IK_NO_ZDOF)==0) {
- uiDefButF(block, NUM, B_ARM_RECALCDATA, "Stiff Z:", 217, by-80, 114, 19, &pchan->stiffness[2], 0.0, 0.99, 1.0, 0.0, "Resistance to bending for Z axis");
- uiDefButBitS(block, TOG, BONE_IK_ZLIMIT, B_ARM_RECALCDATA, "Limit Z", 217,by-100,113,19, &pchan->ikflag, 0.0, 0.0, 0.0, 0.0, "Limit rotation over Z axis");
- if ((pchan->ikflag & BONE_IK_ZLIMIT)) {
- uiDefButF(block, NUM, B_ARM_RECALCDATA, "Min Z:", 217, by-120, 113, 19, &pchan->limitmin[2], -180.0, 0.0, 1000, 1, "Minimum Z limit");
- uiDefButF(block, NUM, B_ARM_RECALCDATA, "Max Z:", 217, by-140, 113, 19, &pchan->limitmax[2], 0.0, 180.0, 1000, 1, "Maximum Z limit");
- zerolimit = 0;
- }
- zerodof = 0;
- }
- uiBlockEndAlign(block);
-
- by -= (zerodof)? 82: (zerolimit)? 122: 162;
-
- uiDefButF(block, NUM, B_ARM_RECALCDATA, "Stretch:", -10, by, 113, 19, &pchan->ikstretch, 0.0, 1.0, 1.0, 0.0, "Allow scaling of the bone for IK");
-
- by -= 20;
- }
- else {
- but= uiDefButBitS(block, TOG, POSE_STRIDE, B_ARM_STRIDE, "Stride Root", -10, by-60, 113, 19, &pchan->flag, 0.0, 0.0, 0, 0, "Set this PoseChannel to define the Stride distance");
- uiButSetFunc(but, validate_stridebutton_cb, pchan, NULL);
-
- uiDefBut(block, LABEL, 0, "(DoF only for IK chains)", 110,by-60, 190, 19, 0, 0, 0, 0, 0, "");
- by -= 82;
- }
-
-
- if(by < -200) break; // for time being... extreme long panels are very slow
- }
- }
-
- if(by<0) {
- uiNewPanelHeight(block, 204 - by);
- }
-
-}
-
-
-/* *************************** MESH ******************************** */
-
-/* from this object to all objects with same ob->data */
-static void copy_linked_vgroup_channels(Object *ob)
-{
- Base *base;
-
- for(base=FIRSTBASE; base; base= base->next) {
- if(base->object->type==ob->type) {
- if(base->object!=ob && base->object->data==ob->data) {
- BLI_freelistN(&base->object->defbase);
- duplicatelist(&base->object->defbase, &ob->defbase);
- base->object->actdef= ob->actdef;
- DAG_object_flush_update(G.scene, base->object, OB_RECALC_DATA);
- }
- }
- }
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
-}
-
-void do_vgroupbuts(unsigned short event)
-{
- Object *ob= OBACT;
-
- switch(event) {
- case B_NEWVGROUP:
- add_defgroup (ob);
- scrarea_queue_winredraw(curarea);
- allqueue(REDRAWOOPS, 0);
- break;
- case B_DELVGROUP:
- if ((G.obedit) && (G.obedit == ob))
- del_defgroup (ob);
- else
- del_defgroup_in_object_mode (ob);
- allqueue (REDRAWVIEW3D, 1);
- allqueue(REDRAWOOPS, 0);
- BIF_undo_push("Delete vertex group");
- break;
- case B_ASSIGNVGROUP:
- assign_verts_defgroup ();
- allqueue (REDRAWVIEW3D, 1);
- BIF_undo_push("Assign to vertex group");
- break;
- case B_REMOVEVGROUP:
- remove_verts_defgroup (0);
- allqueue (REDRAWVIEW3D, 1);
- allqueue(REDRAWOOPS, 0);
- BIF_undo_push("Remove from vertex group");
- break;
- case B_SELVGROUP:
- sel_verts_defgroup(1);
- allqueue (REDRAWVIEW3D, 1);
- allqueue(REDRAWOOPS, 0);
- countall();
- break;
- case B_DESELVGROUP:
- sel_verts_defgroup(0);
- allqueue (REDRAWVIEW3D, 1);
- allqueue(REDRAWOOPS, 0);
- countall();
- break;
- case B_LINKEDVGROUP:
- copy_linked_vgroup_channels(ob);
- break;
- case B_COPYVGROUP:
- duplicate_defgroup (ob);
- scrarea_queue_winredraw (curarea);
- allqueue (REDRAWOOPS, 0);
- break;
- }
-}
-
-void do_meshbuts(unsigned short event)
-{
- Object *ob;
- Mesh *me;
- MCol *mcol;
- EditMesh *em= G.editMesh;
- float fac;
- int count; /* store num of changes made to see if redraw & undo are needed*/
- int layernum;
- short randfac;
-
- ob= OBACT;
- if(ob && ob->type==OB_MESH) {
-
- me= get_mesh(ob);
- if(me==NULL) return;
-
- switch(event) {
- case B_DELSTICKY:
- if(me->msticky) {
- CustomData_free_layer_active(&me->vdata, CD_MSTICKY, me->totvert);
- me->msticky= NULL;
- BIF_undo_push("Delete Sticky");
- }
- allqueue(REDRAWBUTSEDIT, 0);
- break;
- case B_MAKESTICKY:
- RE_make_sticky();
- BIF_undo_push("Make Sticky");
- allqueue(REDRAWBUTSEDIT, 0);
- break;
-
- case B_NEWMCOL:
- if(G.obedit) {
- layernum= CustomData_number_of_layers(&em->fdata, CD_MCOL);
- EM_add_data_layer(&em->fdata, CD_MCOL);
- CustomData_set_layer_active(&em->fdata, CD_MCOL, layernum);
- }
- else if(me) {
- mcol= me->mcol;
- layernum= CustomData_number_of_layers(&me->fdata, CD_MCOL);
-
- if(mcol)
- CustomData_add_layer(&me->fdata, CD_MCOL, CD_DUPLICATE,
- mcol, me->totface);
- else
- CustomData_add_layer(&me->fdata, CD_MCOL, CD_CALLOC,
- NULL, me->totface);
-
- CustomData_set_layer_active(&me->fdata, CD_MCOL, layernum);
- mesh_update_customdata_pointers(me);
-
- if(!mcol)
- shadeMeshMCol(ob, me);
- }
-
- if (me->mr) multires_load_cols(me);
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- BIF_undo_push("New Vertex Color");
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- break;
- case B_SETMCOL:
- if (G.obedit || me) {
- CustomData *fdata= (G.obedit)? &em->fdata: &me->fdata;
- CustomData_set_layer_active(fdata, CD_MCOL, actmcol-1);
- mesh_update_customdata_pointers(me);
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- BIF_undo_push("Set Active Vertex Color");
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- }
- break;
- case B_SETMCOL_RND:
- if (G.obedit || me) {
- CustomData *fdata= (G.obedit)? &em->fdata: &me->fdata;
- CustomData_set_layer_render(fdata, CD_MCOL, actmcol_rnd-1);
-
- BIF_undo_push("Set Render Vertex Color");
- allqueue(REDRAWBUTSEDIT, 0);
- }
- break;
-
- case B_NEWTFACE:
- if(me)
- layernum= CustomData_number_of_layers(&me->fdata, CD_MTFACE);
- else
- layernum= CustomData_number_of_layers(&em->fdata, CD_MTFACE);
-
- if(me && me->mr) {
- multires_add_layer(me, &me->mr->fdata, CD_MTFACE, layernum);
- }
- else if(G.obedit) {
- EM_add_data_layer(&em->fdata, CD_MTFACE);
- CustomData_set_layer_active(&em->fdata, CD_MTFACE, layernum);
- }
- else if(me) {
- if(me->mtface)
- CustomData_add_layer(&me->fdata, CD_MTFACE, CD_DUPLICATE,
- me->mtface, me->totface);
- else
- CustomData_add_layer(&me->fdata, CD_MTFACE, CD_DEFAULT,
- NULL, me->totface);
-
- CustomData_set_layer_active(&me->fdata, CD_MTFACE, layernum);
- mesh_update_customdata_pointers(me);
- }
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- BIF_undo_push("New UV Texture");
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWIMAGE, 0);
- break;
- case B_SETTFACE:
- if (G.obedit || me) {
- CustomData *fdata= (G.obedit)? &em->fdata: &me->fdata;
-
- CustomData_set_layer_active(fdata, CD_MTFACE, acttface-1);
- mesh_update_customdata_pointers(me);
-
- /* Update first-level face data in multires */
- if(me && me->mr && me->mr->current != 1)
- CustomData_set_layer_active(&me->mr->fdata, CD_MTFACE, acttface-1);
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- BIF_undo_push("Set Active UV Texture");
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWIMAGE, 0);
- }
- break;
- case B_SETTFACE_RND:
- if (G.obedit || me) {
- CustomData *fdata= (G.obedit)? &em->fdata: &me->fdata;
- CustomData_set_layer_render(fdata, CD_MTFACE, acttface_rnd-1);
- BIF_undo_push("Set Render UV Texture");
- allqueue(REDRAWBUTSEDIT, 0);
- }
- break;
-
- case B_FLIPNORM:
- if(G.obedit) {
- flip_editnormals();
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- BIF_undo_push("Flip Normals");
- allqueue(REDRAWVIEW3D, 0);
- }
- break;
- }
- }
- if(G.obedit==NULL || (G.obedit->type!=OB_MESH)) return;
-
- switch(event) {
- case B_SPIN:
- if( select_area(SPACE_VIEW3D)) spin_mesh(G.scene->toolsettings->step, G.scene->toolsettings->degr, 0, 0);
- break;
- case B_SPINDUP:
- if( select_area(SPACE_VIEW3D)) spin_mesh(G.scene->toolsettings->step, G.scene->toolsettings->degr, 0, 1);
- break;
- case B_EXTR:
- G.f |= G_DISABLE_OK;
- if( select_area(SPACE_VIEW3D)) extrude_mesh();
- G.f -= G_DISABLE_OK;
- break;
- case B_SCREW:
- if( select_area(SPACE_VIEW3D)) screw_mesh(G.scene->toolsettings->step, G.scene->toolsettings->turn);
- break;
- case B_EXTREP:
- if( select_area(SPACE_VIEW3D)) extrude_repeat_mesh(G.scene->toolsettings->step, G.scene->toolsettings->extr_offs);
- break;
- case B_SPLIT:
- G.f |= G_DISABLE_OK;
- split_mesh();
- G.f -= G_DISABLE_OK;
- break;
- case B_REMDOUB:
- count= removedoublesflag(1, 0, G.scene->toolsettings->doublimit);
- notice("Removed: %d", count);
- if (count) { /* only undo and redraw if an action is taken */
- countall ();
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- BIF_undo_push("Rem Doubles");
- }
- break;
- case B_SUBDIV:
- waitcursor(1);
- esubdivideflag(1, 0.0, G.scene->toolsettings->editbutflag,1,0);
- countall();
- waitcursor(0);
- allqueue(REDRAWVIEW3D, 0);
- BIF_undo_push("Subdivide");
- break;
- case B_FRACSUBDIV:
- randfac= 10;
- if(button(&randfac, 1, 100, "Rand fac:")==0) return;
- waitcursor(1);
- fac= -( (float)randfac )/100;
- esubdivideflag(1, fac, G.scene->toolsettings->editbutflag,1,0);
- countall();
- waitcursor(0);
- allqueue(REDRAWVIEW3D, 0);
- BIF_undo_push("Fractal Subdivide");
- break;
- case B_XSORT:
- if( select_area(SPACE_VIEW3D)) xsortvert_flag(1);
- break;
- case B_HASH:
- hashvert_flag(1);
- break;
- case B_TOSPHERE:
- vertices_to_sphere();
- break;
- case B_VERTEXNOISE:
- vertexnoise();
- break;
- case B_VERTEXSMOOTH:
- vertexsmooth();
- break;
- case B_DRAWEDGES:
- G.f &= ~G_DRAWCREASES;
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_DRAWCREASES:
- G.f &= ~G_DRAWEDGES;
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_JOINTRIA:
- join_triangles();
- break;
- case B_GEN_SKELETON:
- generateSkeleton();
- break;
- }
-
- /* WATCH IT: previous events only in editmode! */
-}
-
-static void editing_panel_mesh_tools(Object *ob, Mesh *me)
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "editing_panel_mesh_tools", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Mesh Tools", "Editing", 640, 0, 318, 254)==0) return;
-
- uiBlockBeginAlign(block);
- //uiDefButBitS(block, TOG, B_AUTOFGON, 0, "FGon", 10,195,30,19, &G.scene->toolsettings->editbutflag, 0, 0, 0, 0, "Causes 'Subdivide' To create FGon on inner edges where possible");
- uiDefButBitS(block, TOG, B_BEAUTY, 0, "Beauty", 10,195,53,19, &G.scene->toolsettings->editbutflag, 0, 0, 0, 0, "Causes 'Subdivide' to split faces in halves instead of quarters using long edges unless 'Short' is selected");
- uiDefButBitS(block, TOG, B_BEAUTY_SHORT, 0, "Short", 63,195,52,19, &G.scene->toolsettings->editbutflag, 0, 0, 0, 0, "If Beauty is set, 'Subdivide' splits faces in halves using short edges");
-
- uiDefBut(block, BUT,B_SUBDIV,"Subdivide", 115,195,105,19, 0, 0, 0, 0, 0, "Splits selected faces into halves or quarters");
-
- uiDefButS(block, MENU, B_DIFF, "Corner Cut Type %t|Path %x0|Innervert %x1|Fan %x2",
- 220, 195, 105, 19, &G.scene->toolsettings->cornertype , 0, 0, 0, 0, "Choose Quad Corner Cut Type");
-
- uiDefBut(block, BUT,B_VERTEXNOISE,"Noise", 10,175,78,19, 0, 0, 0, 0, 0, "Use vertex coordinate as texture coordinate");
- uiDefBut(block, BUT,B_HASH,"Hash", 88,175,78,19, 0, 0, 0, 0, 0, "Randomizes selected vertex sequence data");
- uiDefBut(block, BUT,B_XSORT,"Xsort", 166,175,78,19, 0, 0, 0, 0, 0, "Sorts selected vertex data in the X direction");
- uiDefBut(block, BUT,B_FRACSUBDIV, "Fractal", 244,175,81,19, 0, 0, 0, 0, 0, "Subdivides selected faces with a random factor");
-
-
- uiDefBut(block, BUT,B_TOSPHERE,"To Sphere", 10,155,78,19, 0, 0, 0, 0, 0, "Moves selected vertices outwards into a spherical shape");
- uiDefBut(block, BUT,B_VERTEXSMOOTH,"Smooth", 88,155,78,19, 0, 0, 0, 0, 0, "Flattens angles of selected faces");
- uiDefBut(block, BUT,B_SPLIT,"Split", 166,155,78,19, 0, 0, 0, 0, 0, "Splits selected vertices to separate sub-mesh");
- uiDefBut(block, BUT,B_FLIPNORM,"Flip Normals", 244,155,81,19, 0, 0, 0, 0, 0, "Toggles the direction of the selected face's normals");
-
- uiDefBut(block, BUT,B_REMDOUB,"Rem Doubles", 10,135,78,19, 0, 0, 0, 0, 0, "Removes duplicates from selected vertices");
- uiDefButF(block, NUM, B_DIFF, "Limit:", 88,135,117,19, &G.scene->toolsettings->doublimit, 0.0001, 1.0, 10, 0, "Specifies the max distance 'Rem Doubles' will consider vertices as 'doubled'");
- uiDefButF(block, NUM, B_DIFF, "Threshold:", 205,135,120,19, &G.scene->toolsettings->select_thresh, 0.0001, 1.0, 10, 0, "Tolerence for the 'Select Group' tool (Shift+G) and 'Knife Exact' (vertex snap).");
- uiBlockEndAlign(block);
-
- uiDefBut(block, BUT,B_EXTR,"Extrude", 10,105,315,24, 0, 0, 0, 0, 0, "Converts selected edges to faces and selects the new vertices");
-
- uiBlockBeginAlign(block);
- uiDefBut(block, BUT,B_SPIN, "Spin", 10,75,100,24, 0, 0, 0, 0, 0, "Extrudes the selected vertices in a circle around the cursor in the indicated viewport");
- uiDefBut(block, BUT,B_SPINDUP,"Spin Dup", 110,75,100,24, 0, 0, 0, 0, 0, "Creates copies of the selected vertices in a circle around the cursor in the indicated viewport");
- uiDefBut(block, BUT,B_SCREW,"Screw", 210,75,115,24, 0, 0, 0, 0, 0, "Activates the screw tool"); // Bish - This could use some more definition
-
- uiDefButF(block, NUM, B_DIFF, "Degr:", 10,55,100,19, &G.scene->toolsettings->degr,-360.0,360.0, 1000, 0, "Specifies the number of degrees 'Spin' revolves");
- uiDefButS(block, NUM, B_DIFF, "Steps:", 110,55,100,19, &G.scene->toolsettings->step,1.0,180.0, 0, 0, "Specifies the total number of 'Spin' slices");
- uiDefButS(block, NUM, B_DIFF, "Turns:", 210,55,115,19, &G.scene->toolsettings->turn,1.0,360.0, 0, 0, "Specifies the number of revolutions the screw turns");
- uiDefButBitS(block, TOG, B_KEEPORIG, B_DIFF, "Keep Original",10,35,200,19, &G.scene->toolsettings->editbutflag, 0, 0, 0, 0, "Keeps a copy of the original vertices and faces after executing tools");
- uiDefButBitS(block, TOG, B_CLOCKWISE, B_DIFF, "Clockwise", 210,35,115,19, &G.scene->toolsettings->editbutflag, 0, 0, 0, 0, "Specifies the direction for 'Screw' and 'Spin'");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefBut(block, BUT,B_EXTREP, "Extrude Dup", 10,10,150,19, 0, 0, 0, 0, 0, "Creates copies of the selected vertices in a straight line away from the current viewport");
- uiDefButF(block, NUM, B_DIFF, "Offset:", 160,10,165,19, &G.scene->toolsettings->extr_offs, 0.01, 100.0, 100, 0, "Sets the distance between each copy for 'Extrude Dup'");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefBut(block, BUT, B_JOINTRIA, "Join Triangles", 10, -20, 120, 19, 0, 0, 0, 0, 0, "Convert selected triangles to Quads");
- uiDefButF(block, NUM, B_DIFF, "Threshold", 130, -20, 195, 19, &G.scene->toolsettings->jointrilimit, 0.0, 1.0, 5, 0, "Conversion threshold for complex islands");
- uiDefButBitS(block, TOG, B_JOINTRIA_UV, 0, "Delimit UVs", 10, -40, 78, 19, &G.scene->toolsettings->editbutflag, 0,0,0,0, "Join pairs only where UVs match");
- uiDefButBitS(block, TOG, B_JOINTRIA_VCOL, 0, "Delimit Vcol", 90, -40, 78, 19, &G.scene->toolsettings->editbutflag, 0,0,0,0, "Join pairs only where Vcols match");
- uiDefButBitS(block, TOG, B_JOINTRIA_SHARP, 0, "Delimit Sharp", 170, -40, 78, 19, &G.scene->toolsettings->editbutflag, 0,0,0,0, "Join pairs only where edge is not sharp");
- uiDefButBitS(block, TOG, B_JOINTRIA_MAT, 0, "Delimit Mat", 250, -40, 74, 19, &G.scene->toolsettings->editbutflag, 0,0,0,0, "Join pairs only where material matches");
- uiBlockEndAlign(block);
-
-
-}
-
-static void verify_vertexgroup_name_func(void *datav, void *data2_unused)
-{
- unique_vertexgroup_name((bDeformGroup*)datav, OBACT);
-}
-
-static void skgen_reorder(void *option, void *arg2)
-{
- char tmp;
- switch ((int)option)
- {
- case 0:
- tmp = G.scene->toolsettings->skgen_subdivisions[0];
- G.scene->toolsettings->skgen_subdivisions[0] = G.scene->toolsettings->skgen_subdivisions[1];
- G.scene->toolsettings->skgen_subdivisions[1] = tmp;
- break;
- case 1:
- tmp = G.scene->toolsettings->skgen_subdivisions[2];
- G.scene->toolsettings->skgen_subdivisions[2] = G.scene->toolsettings->skgen_subdivisions[1];
- G.scene->toolsettings->skgen_subdivisions[1] = tmp;
- break;
- case 2:
- tmp = G.scene->toolsettings->skgen_subdivisions[0];
- G.scene->toolsettings->skgen_subdivisions[0] = G.scene->toolsettings->skgen_subdivisions[2];
- G.scene->toolsettings->skgen_subdivisions[2] = G.scene->toolsettings->skgen_subdivisions[1];
- G.scene->toolsettings->skgen_subdivisions[1] = tmp;
- break;
- }
-}
-
-static void editing_panel_mesh_skgen(Object *ob, Mesh *me)
-{
- uiBlock *block;
- uiBut *but;
- int i;
-
- block= uiNewBlock(&curarea->uiblocks, "editing_panel_mesh_skgen", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Skeleton Generator", "Editing", 960, 0, 318, 204)==0) return;
-
- uiDefBut(block, BUT, B_GEN_SKELETON, "Generate Skeleton", 1025,170,250,19, 0, 0, 0, 0, 0, "Generate Skeleton from Mesh");
-
- uiBlockBeginAlign(block);
- uiDefButS(block, NUM, B_DIFF, "Resolution:", 1025,150,250,19, &G.scene->toolsettings->skgen_resolution,10.0,1000.0, 0, 0, "Specifies the resolution of the graph's embedding");
- uiDefButBitS(block, TOG, SKGEN_FILTER_INTERNAL, B_DIFF, "Filter In", 1025,130, 83,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0, "Filter internal small arcs from graph");
- uiDefButF(block, NUM, B_DIFF, "T:", 1111,130,164,19, &G.scene->toolsettings->skgen_threshold_internal,0.0, 1.0, 10, 0, "Specify the threshold ratio for filtering internal arcs");
- uiDefButBitS(block, TOG, SKGEN_FILTER_EXTERNAL, B_DIFF, "Filter Ex", 1025,110, 83,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0, "Filter external small arcs from graph");
- uiDefButF(block, NUM, B_DIFF, "T:", 1111,110,164,19, &G.scene->toolsettings->skgen_threshold_external,0.0, 1.0, 10, 0, "Specify the threshold ratio for filtering external arcs");
-
- for(i = 0; i < SKGEN_SUB_TOTAL; i++)
- {
- int y = 90 - 20 * i;
-
- but = uiDefIconBut(block, BUT, B_MODIFIER_RECALC, VICON_MOVE_DOWN, 1025, y, 16, 19, NULL, 0.0, 0.0, 0.0, 0.0, "Change the order the subdivisions algorithm are applied");
- uiButSetFunc(but, skgen_reorder, (void *)i, NULL);
-
- switch(G.scene->toolsettings->skgen_subdivisions[i])
- {
- case SKGEN_SUB_LENGTH:
- uiDefButBitS(block, TOG, SKGEN_CUT_LENGTH, B_DIFF, "Length", 1041, y, 67,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0, "Subdivide arcs in bones of equal length");
- uiDefButF(block, NUM, B_DIFF, "T:", 1111, y, 82,19, &G.scene->toolsettings->skgen_length_ratio,1.0, 4.0, 10, 0, "Specify the ratio limit between straight arc and embeddings to trigger equal subdivisions");
- uiDefButF(block, NUM, B_DIFF, "L:", 1193, y, 82,19, &G.scene->toolsettings->skgen_length_limit,0.1,50.0, 10, 0, "Maximum length of the bones when subdividing");
- break;
- case SKGEN_SUB_ANGLE:
- uiDefButBitS(block, TOG, SKGEN_CUT_ANGLE, B_DIFF, "Angle", 1041, y, 67,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0, "Subdivide arcs based on angle");
- uiDefButF(block, NUM, B_DIFF, "T:", 1111, y,164,19, &G.scene->toolsettings->skgen_angle_limit,0.0, 90.0, 10, 0, "Specify the threshold angle in degrees for subdivision");
- break;
- case SKGEN_SUB_CORRELATION:
- uiDefButBitS(block, TOG, SKGEN_CUT_CORRELATION, B_DIFF, "Correlation", 1041, y, 67,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0, "Subdivide arcs based on correlation");
- uiDefButF(block, NUM, B_DIFF, "T:", 1111, y,164,19, &G.scene->toolsettings->skgen_correlation_limit,0.0, 1.0, 0.01, 0, "Specify the threshold correlation for subdivision");
- break;
- }
- }
-
- uiDefButBitS(block, TOG, SKGEN_SYMMETRY, B_DIFF, "Symmetry", 1025, 30,125,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0, "Restore symmetries based on topology");
- uiDefButF(block, NUM, B_DIFF, "T:", 1150, 30,125,19, &G.scene->toolsettings->skgen_symmetry_limit,0.0, 1.0, 10, 0, "Specify the threshold distance for considering potential symmetric arcs");
- uiDefButC(block, NUM, B_DIFF, "P:", 1025, 10, 62,19, &G.scene->toolsettings->skgen_postpro_passes, 0, 10, 10, 0, "Specify the number of processing passes on the embeddings");
- uiDefButC(block, ROW, B_DIFF, "Smooth", 1087, 10, 63,19, &G.scene->toolsettings->skgen_postpro, 5.0, (float)SKGEN_SMOOTH, 0, 0, "Smooth embeddings");
- uiDefButC(block, ROW, B_DIFF, "Average", 1150, 10, 62,19, &G.scene->toolsettings->skgen_postpro, 5.0, (float)SKGEN_AVERAGE, 0, 0, "Average embeddings");
- uiDefButC(block, ROW, B_DIFF, "Sharpen", 1212, 10, 63,19, &G.scene->toolsettings->skgen_postpro, 5.0, (float)SKGEN_SHARPEN, 0, 0, "Sharpen embeddings");
- uiBlockEndAlign(block);
-}
-
-static void editing_panel_mesh_tools1(Object *ob, Mesh *me)
-{
- uiBlock *block;
-
-
- block= uiNewBlock(&curarea->uiblocks, "editing_panel_mesh_tools1", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Mesh Tools 1", "Editing", 960, 0, 318, 204)==0) return;
-
- uiBlockBeginAlign(block);
- uiDefBut(block, BUT,B_SELSWAP, "Select Swap", 955, 200, 106, 19, 0, 0, 0, 0, 0, "Selects unselected faces, and deselects selected faces (Ctrl+I)");
- uiDefBut(block, BUT,B_HIDE, "Hide", 1061, 200, 106, 19, 0, 0, 0, 0, 0, "Hides selected faces (H)");
- uiDefBut(block, BUT,B_REVEAL, "Reveal", 1167, 200, 107, 19, 0, 0, 0, 0, 0, "Reveals selected faces (Alt H)");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, REDRAWVIEW3D, "NSize:", 955, 170, 150, 19, &G.scene->editbutsize, 0.001, 2.0, 10, 0, "Sets the length to use when displaying face normals");
- uiDefButBitI(block, TOG, G_DRAWNORMALS, REDRAWVIEW3D, "Draw Normals", 955,148,150,19, &G.f, 0, 0, 0, 0, "Displays face normals as lines");
- uiDefButBitI(block, TOG, G_DRAW_VNORMALS, REDRAWVIEW3D, "Draw VNormals",955,126,150,19, &G.f, 0, 0, 0, 0, "Displays vertex normals as lines");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, G_DRAWFACES, REDRAWVIEW3D_IMAGE, "Draw Faces", 955,88,150,19, &G.f, 0, 0, 0, 0, "Displays all faces as shades in the 3d view and UV editor");
- uiDefButBitI(block, TOG, G_DRAWEDGES, REDRAWVIEW3D, "Draw Edges", 955,66,150,19, &G.f, 0, 0, 0, 0, "Displays selected edges using hilights");
- uiDefButBitI(block, TOG, G_DRAWCREASES, REDRAWVIEW3D, "Draw Creases", 955,44,150,19, &G.f, 0, 0, 0, 0, "Displays creases created for subsurf weighting");
- uiDefButBitI(block, TOG, G_DRAWSEAMS, REDRAWVIEW3D, "Draw Seams", 955,22,150,19, &G.f, 0, 0, 0, 0, "Displays UV unwrapping seams");
- uiDefButBitI(block, TOG, G_DRAWSHARP, REDRAWVIEW3D, "Draw Sharp", 955,0,150,19, &G.f, 0, 0, 0, 0, "Displays sharp edges, used with the EdgeSplit modifier");
- uiBlockEndAlign(block);
-
- /* Measurement drawing options */
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, G_DRAW_EDGELEN, REDRAWVIEW3D, "Edge Length", 1125,170,150,19, &G.f, 0, 0, 0, 0, "Displays selected edge lengths");
- uiDefButBitI(block, TOG, G_DRAW_EDGEANG, REDRAWVIEW3D, "Edge Angles", 1125,148,150,19, &G.f, 0, 0, 0, 0, "Displays the angles in the selected edges in degrees");
- uiDefButBitI(block, TOG, G_DRAW_FACEAREA, REDRAWVIEW3D, "Face Area", 1125,126,150,19, &G.f, 0, 0, 0, 0, "Displays the area of selected faces");
-#ifdef WITH_VERSE
- if(G.editMesh->vnode)
- uiDefButBitI(block, TOG, G_DRAW_VERSE_DEBUG, REDRAWVIEW3D, "Draw VDebug",1125,104,150,19, &G.f, 0, 0, 0, 0, "Displays verse debug information");
-#endif
-
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, G_ALLEDGES, 0, "All Edges", 1125, 22,150,19, &G.f, 0, 0, 0, 0, "Displays all edges in object mode without optimization");
- uiDefButBitS(block, TOG, B_MESH_X_MIRROR, B_DIFF, "X-axis mirror",1125,0,150,19, &G.scene->toolsettings->editbutflag, 0, 0, 0, 0, "While using transforms, mirrors the transformation");
- uiBlockEndAlign(block);
-}
-
-char *get_vertexgroup_menustr(Object *ob)
-{
- bDeformGroup *dg;
- int defCount, min, index;
- char (*qsort_ptr)[sizeof(dg->name)+6] = NULL; // +6 for "%x999|" max 999 groups selectable
- char *s, *menustr;
- int printed;
-
- defCount=BLI_countlist(&ob->defbase);
-
- if (!defCount) min=0;
- else min=1;
-
- if (defCount > 0) {
- /*
- * This will hold the group names temporarily
- * so we can sort them
- */
- qsort_ptr = MEM_callocN (defCount * sizeof (qsort_ptr[0]),
- "qsort_ptr");
- for (index = 1, dg = ob->defbase.first; dg; index++, dg=dg->next) {
- printed = snprintf (qsort_ptr[index - 1], sizeof (dg->name), dg->name);
- snprintf (qsort_ptr[index - 1]+printed, 6+1, "%%x%d|", index); // +1 to move the \0 see above 999 max here too
- }
-
- qsort (qsort_ptr, defCount, sizeof (qsort_ptr[0]),
- ( int (*)(const void *, const void *) ) strcmp);
- }
-
- s= menustr = MEM_callocN((sizeof(qsort_ptr[0]) * defCount)+30, "menustr"); // plus 30 for when defCount==0
- if(defCount) {
- for (index = 0; index < defCount; index++) {
- int cnt= sprintf (s, "%s", qsort_ptr[index]);
- if (cnt>0) s+= cnt;
- }
- }
- else strcpy(menustr, "No Vertex Groups in Object");
-
- if (qsort_ptr)
- MEM_freeN (qsort_ptr);
-
- return menustr;
-}
-
-static void editing_panel_links(Object *ob)
-{
- uiBlock *block;
- ID *id, *idfrom;
- int *poin, xco=143;
- float min;
- Material *ma;
- char str[64];
- uiBut *but;
-
- block= uiNewBlock(&curarea->uiblocks, "editing_panel_links", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Link and Materials", "Editing", 0, 0, 318, 204)==0) return;
-
- uiSetButLock((ob && ob->id.lib), ERROR_LIBDATA_MESSAGE);
-
- buttons_active_id(&id, &idfrom);
-
- if(id) {
- int alone= 0;
- int local= 0;
- int browse= B_EDITBROWSE;
-
- if(ob->type==OB_MESH) {
- browse= B_MESHBROWSE;
- alone= B_MESHALONE;
- local= B_MESHLOCAL;
- uiSetButLock(G.obedit!=0, "Unable to perform function in EditMode");
- }
- else if(ob->type==OB_MBALL) {
- alone= B_MBALLALONE;
- local= B_MBALLLOCAL;
- }
- else if ELEM3(ob->type, OB_CURVE, OB_FONT, OB_SURF) {
- alone= B_CURVEALONE;
- local= B_CURVELOCAL;
- }
- else if(ob->type==OB_CAMERA) {
- alone= B_CAMERAALONE;
- local= B_CAMERALOCAL;
- }
- else if(ob->type==OB_LAMP) {
- alone= B_LAMPALONE;
- local= B_LAMPLOCAL;
- }
- else if (ob->type==OB_ARMATURE){
- alone = B_ARMALONE;
- local = B_ARMLOCAL;
- }
- else if(ob->type==OB_LATTICE) {
- alone= B_LATTALONE;
- local= B_LATTLOCAL;
- }
- uiBlockSetCol(block, TH_BUT_SETTING2);
- xco= std_libbuttons(block, 143, 180, 0, NULL, browse, GS(id->name), 0, id, idfrom, &(G.buts->menunr), alone, local, 0, 0, B_KEEPDATA);
- uiBlockSetCol(block, TH_AUTO);
- }
- if(ob) {
- uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
- but = uiDefBut(block, TEX, B_IDNAME, "OB:", xco, 180, 454-xco, YIC, ob->id.name+2, 0.0, 21.0, 0, 0, "Active Object name.");
-#ifdef WITH_VERSE
- if(ob->vnode) uiButSetFunc(but, test_and_send_idbutton_cb, ob, ob->id.name);
- else uiButSetFunc(but, test_idbutton_cb, ob->id.name, NULL);
-#else
- uiButSetFunc(but, test_idbutton_cb, ob->id.name, NULL);
-#endif
-
- }
-
- /* empty display handling, note it returns! */
- if (ob->type==OB_EMPTY) {
- uiDefBut(block, LABEL,0,"Empty Display:",
- xco, 154, 130,20, 0, 0, 0, 0, 0, "");
-
- uiBlockBeginAlign(block);
- uiDefButC(block, MENU, REDRAWVIEW3D, "Empty Drawtype%t|Arrows%x1|Single Arrow%x4|Plain Axes%x2|Circle%x3|Cube%x5|Sphere%x6|Cone%x7",
- xco, 128, 140, 20, &ob->empty_drawtype, 0, 0, 0, 0, "The Empty 3D View display style");
- uiDefButF(block, NUM, REDRAWVIEW3D, "Size:",
- xco, 108, 140, 21, &ob->empty_drawsize, 0.01, 10.0, 1, 0, "The size to display the Empty");
- uiBlockEndAlign(block);
- return;
- }
-
- /* vertex group... partially editmode... */
- if(ob->type==OB_MESH || ob->type==OB_LATTICE) {
- bDeformGroup *defGroup;
- uiBut *but;
- int defCount;
-
- uiDefBut(block, LABEL,0,"Vertex Groups",
- 143,153,130,20, 0, 0, 0, 0, 0, "");
-
- defCount=BLI_countlist(&ob->defbase);
-
- if (defCount) {
- char *menustr= get_vertexgroup_menustr(ob);
-
- uiBlockBeginAlign(block);
-
- uiDefButS(block, MENU, B_MAKEDISP, menustr, 143, 132,18,21, (short *)&ob->actdef, 1, defCount, 0, 0, "Browses available vertex groups");
- MEM_freeN (menustr);
-
- if (ob->actdef){
- defGroup = BLI_findlink(&ob->defbase, ob->actdef-1);
- but= uiDefBut(block, TEX, REDRAWBUTSEDIT,"", 161,132,140-18,21, defGroup->name, 0, 31, 0, 0, "Displays current vertex group name. Click to change. (Match bone name for deformation.)");
- uiButSetFunc(but, verify_vertexgroup_name_func, defGroup, NULL);
- uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)ob);
-
- uiDefButF(block, NUM, REDRAWVIEW3D, "Weight:", 143, 111, 140, 21, &editbutvweight, 0, 1, 10, 0, "Sets the current vertex group's bone deformation strength");
- }
- uiBlockEndAlign(block);
- }
-
- if (G.obedit && G.obedit==ob){
- uiBlockBeginAlign(block);
- uiDefBut(block, BUT,B_NEWVGROUP,"New", 143,90,70,21, 0, 0, 0, 0, 0, "Creates a new vertex group");
- uiDefBut(block, BUT,B_DELVGROUP,"Delete", 213,90,70,21, 0, 0, 0, 0, 0, "Removes the current vertex group");
-
- uiDefBut(block, BUT,B_ASSIGNVGROUP,"Assign", 143,69,70,21, 0, 0, 0, 0, 0, "Assigns selected vertices to the current vertex group");
- uiDefBut(block, BUT,B_REMOVEVGROUP,"Remove", 213,69,70,21, 0, 0, 0, 0, 0, "Removes selected vertices from the current vertex group");
-
- uiDefBut(block, BUT,B_SELVGROUP,"Select", 143,48,70,21, 0, 0, 0, 0, 0, "Selects vertices belonging to the current vertex group");
- uiDefBut(block, BUT,B_DESELVGROUP,"Desel.", 213,48,70,21, 0, 0, 0, 0, 0, "Deselects vertices belonging to the current vertex group");
- uiBlockEndAlign(block);
- }
- else {
- ID *id= ob->data;
-
- uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
-
- uiBlockBeginAlign (block);
- uiDefBut (block, BUT, B_NEWVGROUP, "New", 143, 90, 70, 21, 0, 0, 0, 0, 0, "Creates a new vertex group");
- uiDefBut (block, BUT, B_DELVGROUP, "Delete", 213, 90, 70, 21, 0, 0, 0, 0, 0, "Removes the current vertex group");
- uiDefBut (block, BUT, B_COPYVGROUP, "Copy Group", 143, 70, 140, 19, 0, 0, 0, 0, 0, "Copy Group of Vertex");
- uiBlockEndAlign (block);
-
- if(id->us > 1)
- uiDefBut(block, BUT,B_LINKEDVGROUP, "Copy To Linked", 143,50,140,20, 0, 0, 0, 0, 0, "Creates identical vertex group names in other Objects using this Object-data");
- }
- }
-
- /* now only objects that can be visible rendered */
- if ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL);
- else return;
-
- id= ob->data;
- uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
-
- if(ob->type==OB_MESH) poin= &( ((Mesh *)ob->data)->texflag );
- else if(ob->type==OB_MBALL) poin= &( ((MetaBall *)ob->data)->texflag );
- else poin= &( ((Curve *)ob->data)->texflag );
- uiDefButBitI(block, TOG, AUTOSPACE, B_AUTOTEX, "AutoTexSpace", 143,15,140,19, poin, 0, 0, 0, 0, "Adjusts active object's texture space automatically when transforming object");
-
- sprintf(str,"%d Mat ", ob->totcol);
- if(ob->totcol) min= 1.0; else min= 0.0;
- ma= give_current_material(ob, ob->actcol);
-
- if(G.obedit) {
- char *str= NULL;
- IDnames_to_pupstring(&str, NULL, "ADD NEW %x 32767", &G.main->mat, NULL, NULL);
- uiDefButS(block, MENU, B_MATASS_BROWSE, str, 292,150,20,20, &G.buts->menunr, 0, 0, 0, 0, "Browses existing choices and assign");
- MEM_freeN(str);
- }
-
- if(ma) uiDefBut(block, LABEL, 0, ma->id.name+2, 318,150, 103, 20, 0, 0, 0, 0, 0, "");
-
- uiBlockBeginAlign(block);
- if(ma) uiDefButF(block, COL, B_MATCOL2, "", 292,113,31,30, &(ma->r), 0, 0, 0, 0, "");
- uiDefButC(block, NUM, B_ACTCOL, str, 324,113,100,30, &ob->actcol, min, (float)(ob->totcol), 0, 0, "Displays total number of material indices and the current index");
- uiDefBut(block, BUT,B_MATWICH, "?", 424,113,30,30, 0, 0, 0, 0, 0, "In EditMode, sets the active material index from selected faces");
-
- uiBlockBeginAlign(block);
- uiDefBut(block, BUT,B_MATNEW, "New", 292,90,80,20, 0, 0, 0, 0, 0, "Adds a new Material index");
- uiDefBut(block, BUT,B_MATDEL, "Delete", 372,90,80,20, 0, 0, 0, 0, 0, "Deletes this Material index");
- uiDefBut(block, BUT,B_MATSEL, "Select", 292,70,80,20, 0, 0, 0, 0, 0, "In EditMode, selects faces that have the active index");
- uiDefBut(block, BUT,B_MATDESEL, "Deselect", 372,70,80,20, 0, 0, 0, 0, 0, "Deselects everything with current indexnumber");
- uiDefBut(block, BUT,B_MATASS, "Assign", 292,50,160,20, 0, 0, 0, 0, 0, "In EditMode, assigns the active index to selected faces");
-
- uiBlockBeginAlign(block);
- uiDefBut(block, BUT,B_SETSMOOTH,"Set Smooth", 292,15,80,20, 0, 0, 0, 0, 0, "In EditMode, sets 'smooth' rendering of selected faces");
- uiDefBut(block, BUT,B_SETSOLID, "Set Solid", 372,15,80,20, 0, 0, 0, 0, 0, "In EditMode, sets 'solid' rendering of selected faces");
-
- uiBlockEndAlign(block);
-
-
-}
-
-void editing_panel_sculpting_tools()
-{
- uiBlock *block= uiNewBlock(&curarea->uiblocks, "editing_panel_sculpting_tools", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Sculpt", "Editing", 300, 0, 318, 204)==0) return;
-
- sculptmode_draw_interface_tools(block,0,200);
-}
-
-void editing_panel_sculpting_brush()
-{
- uiBlock *block= uiNewBlock(&curarea->uiblocks, "editing_panel_sculpting_brush", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Brush", "Editing", 300, 0, 318, 204)==0) return;
-
- sculptmode_draw_interface_brush(block,0,200);
-}
-
-void editing_panel_sculpting_textures()
-{
- uiBlock *block= uiNewBlock(&curarea->uiblocks, "editing_panel_sculpting_texture", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Texture", "Editing", 300, 0, 318, 204)==0) return;
-
- sculptmode_draw_interface_textures(block,0,200);
-}
-
-void sculptmode_draw_interface_tools(uiBlock *block, unsigned short cx, unsigned short cy)
-{
- SculptData *sd;
-
- if(!G.scene) return;
- sd= &G.scene->sculptdata;
-
- uiBlockBeginAlign(block);
-
- uiDefBut(block,LABEL,B_NOP,"Brush",cx,cy,90,19,NULL,0,0,0,0,"");
- cy-= 20;
-
- uiBlockBeginAlign(block);
- uiDefButS(block,ROW,REDRAWBUTSEDIT,"Draw",cx,cy,67,19,&sd->brush_type,14.0,DRAW_BRUSH,0,0,"Draw lines on the model");
- uiDefButS(block,ROW,REDRAWBUTSEDIT,"Smooth",cx+67,cy,67,19,&sd->brush_type,14.0,SMOOTH_BRUSH,0,0,"Interactively smooth areas of the model");
- uiDefButS(block,ROW,REDRAWBUTSEDIT,"Pinch",cx+134,cy,67,19,&sd->brush_type,14.0,PINCH_BRUSH,0,0,"Interactively pinch areas of the model");
- uiDefButS(block,ROW,REDRAWBUTSEDIT,"Inflate",cx+201,cy,67,19,&sd->brush_type,14,INFLATE_BRUSH,0,0,"Push vertices along the direction of their normals");
- cy-= 20;
- uiDefButS(block,ROW,REDRAWBUTSEDIT,"Grab", cx,cy,89,19,&sd->brush_type,14,GRAB_BRUSH,0,0,"Grabs a group of vertices and moves them with the mouse");
- uiDefButS(block,ROW,REDRAWBUTSEDIT,"Layer", cx+89,cy,89,19,&sd->brush_type,14, LAYER_BRUSH,0,0,"Adds a layer of depth");
- uiDefButS(block,ROW,REDRAWBUTSEDIT,"Flatten", cx+178,cy,90,19,&sd->brush_type,14, FLATTEN_BRUSH,0,0,"Interactively flatten areas of the model");
- cy-= 25;
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefBut(block,LABEL,B_NOP,"Shape",cx,cy,90,19,NULL,0,0,0,0,"");
- cy-= 20;
- uiBlockBeginAlign(block);
- if(sd->brush_type != SMOOTH_BRUSH && sd->brush_type != GRAB_BRUSH && sd->brush_type != FLATTEN_BRUSH) {
- uiDefButC(block,ROW,B_NOP,"Add",cx,cy,89,19,&sculptmode_brush()->dir,15.0,1.0,0, 0,"Add depth to model [Shift]");
- uiDefButC(block,ROW,B_NOP,"Sub",cx+89,cy,89,19,&sculptmode_brush()->dir,15.0,2.0,0, 0,"Subtract depth from model [Shift]");
- }
- if(sd->brush_type!=GRAB_BRUSH)
- uiDefButC(block,TOG,B_NOP,"Airbrush",cx+178,cy,89,19,&sculptmode_brush()->airbrush,0,0,0,0,"Brush makes changes without waiting for the mouse to move");
- cy-= 20;
- uiDefButS(block,NUMSLI,B_NOP,"Size: ",cx,cy,268,19,&sculptmode_brush()->size,1.0,200.0,0,0,"Set brush radius in pixels");
- cy-= 20;
- if(sd->brush_type!=GRAB_BRUSH)
- uiDefButC(block,NUMSLI,B_NOP,"Strength: ",cx,cy,268,19,&sculptmode_brush()->strength,1.0,100.0,0,0,"Set brush strength");
- cy-= 25;
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefBut( block,LABEL,B_NOP,"Symmetry",cx,cy,90,19,NULL,0,0,0,0,"");
- cy-= 20;
- uiBlockBeginAlign(block);
- uiDefButBitC(block, TOG, SYMM_X, 0, "X", cx,cy,89,19, &sd->symm, 0,0,0,0, "Mirror brush across X axis");
- uiDefButBitC(block, TOG, SYMM_Y, 0, "Y", cx+89,cy,89,19, &sd->symm, 0,0,0,0, "Mirror brush across Y axis");
- uiDefButBitC(block, TOG, SYMM_Z, 0, "Z", cx+178,cy,90,19, &sd->symm, 0,0,0,0, "Mirror brush across Z axis");
- uiBlockEndAlign(block);
-
- cx+= 210;
-}
-
-static void sculptmode_curves_reset(void *sd_v, void *j)
-{
- SculptData *sd = sd_v;
- sculpt_reset_curve(sd);
- curvemapping_changed(sd->cumap, 0);
-}
-
-void sculptmode_draw_interface_brush(uiBlock *block, unsigned short cx, unsigned short cy)
-{
- SculptData *sd= sculpt_data();
- int orig_y = cy;
- rctf rect;
- uiBut *but;
-
- uiBlockBeginAlign(block);
- cy-= 20;
- uiDefButC(block,TOG,REDRAWBUTSEDIT, "Curve", cx,cy,80,19, &sd->texfade, 0,0,0,0,"Use curve control for radial brush intensity");
- cy-= 20;
- but= uiDefBut(block, BUT, REDRAWBUTSEDIT, "Reset",cx,cy,80,19, NULL, 0,0,0,0, "Default curve preset");
- uiButSetFunc(but, sculptmode_curves_reset, sd, NULL);
- cy-= 25;
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButS(block,NUM,B_NOP, "Space", cx,cy,80,19, &sd->spacing, 0,500,20,0,"Non-zero inserts N pixels between dots");
- cy-= 20;
- if(sd->brush_type == DRAW_BRUSH)
- uiDefButC(block,NUM,B_NOP, "View", cx,cy,80,19, &sculptmode_brush()->view, 0,10,20,0,"Pulls brush direction towards view");
- uiBlockEndAlign(block);
-
- /* Draw curve */
- cx += 90;
- cy = orig_y;
- rect.xmin= cx; rect.xmax= cx + 178;
- rect.ymin= cy - 160; rect.ymax= cy + 20;
- uiBlockBeginAlign(block);
- curvemap_buttons(block, sd->cumap, (char)0, B_NOP, 0, &rect);
- uiBlockEndAlign(block);
-}
-
-void sculptmode_draw_interface_textures(uiBlock *block, unsigned short cx, unsigned short cy)
-{
- SculptData *sd= sculpt_data();
- MTex *mtex;
- int i;
- int orig_y= cy;
- char *strp;
- uiBut *but;
-
- uiBlockBeginAlign(block);
- cy-= 20;
- /* TEX CHANNELS */
- uiBlockBeginAlign(block);
- uiBlockSetCol(block, TH_BUT_NEUTRAL);
- for(i=-1; i<8; i++) {
- char str[64];
- int loos;
- mtex= sd->mtex[i];
-
- if(i==-1)
- strcpy(str, "Default");
- else {
- if(mtex && mtex->tex) splitIDname(mtex->tex->id.name+2, str, &loos);
- else strcpy(str, "");
- }
- str[10]= 0;
- uiDefButS(block, ROW, REDRAWBUTSEDIT, str,cx, cy, 80, 20, &sd->texact, 3.0, (float)i, 0, 0, "Texture channel");
- cy-= 18;
- }
-
- cy= orig_y-20;
- cx+= 85;
- mtex= sd->mtex[sd->texact];
-
- if(sd->texact == -1) {
- uiBlockBeginAlign(block);
- uiDefBut(block,LABEL,B_NOP,"",cx,cy,115,20,0,0,0,0,0,""); /* Padding */
- } else {
- ID *id= NULL;
- uiBlockBeginAlign(block);
-
- if(mtex && mtex->tex) id= &mtex->tex->id;
- IDnames_to_pupstring(&strp, NULL, "ADD NEW %x 32767", &G.main->tex, id, &G.buts->texnr);
-
- if(mtex && mtex->tex) {
- uiDefBut(block, TEX, B_IDNAME, "TE:",cx,cy,115,19, mtex->tex->id.name+2, 0.0, 21.0, 0, 0, "Texture name");
- cy-= 20;
-
- uiDefButS(block,MENU,B_SCULPT_TEXBROWSE, strp, cx,cy,20,19, &G.buts->texnr, 0,0,0,0, "Selects an existing texture or creates new");
- uiDefIconBut(block, BUT, B_AUTOTEXNAME, ICON_AUTO, cx+21,cy,21,20, 0, 0, 0, 0, 0, "Auto-assigns name to texture");
-
- but= uiDefBut(block, BUT, B_NOP, "Clear",cx+43, cy, 72, 20, 0, 0, 0, 0, 0, "Erases link to texture");
- uiButSetFunc(but,sculptmode_rem_tex,0,0);
- cy-= 25;
-
- uiBlockBeginAlign(block);
- uiDefButC(block,ROW, REDRAWBUTSEDIT, "Drag", cx, cy,39,19, &sd->texrept, 18,SCULPTREPT_DRAG,0,0,"Move the texture with the brush");
- uiDefButC(block,ROW, REDRAWBUTSEDIT, "Tile", cx+39,cy,39,19, &sd->texrept, 18,SCULPTREPT_TILE,0,0,"Treat the texture as a tiled image extending across the screen");
- uiDefButC(block,ROW, REDRAWBUTSEDIT, "3D", cx+78,cy,37,19, &sd->texrept, 18,SCULPTREPT_3D, 0,0,"Use vertex coords as texture coordinates");
- cy-= 20;
-
- if(sd->texrept != SCULPTREPT_3D) {
- uiBlockBeginAlign(block);
- uiDefButF(block,NUM,0, "Angle", cx,cy,115,19, &mtex->warpfac, 0,360,100,0, "Rotate texture counterclockwise");
- /*Moved inside, so that following buttons aren't made bigger for no reason*/
- cy-= 20;
- }
-
- /* Added Rake button. Needs to be turned off if 3D is on / disappear*/
- if(sd->texrept != SCULPTREPT_3D){
- uiDefButC(block,TOG,B_NOP, "Rake", cx,cy,115,19, &sd->rake, 0,0,0,0,"Rotate the brush in the direction of motion");
- cy-=20;
- }
-
- if(sd->texrept != SCULPTREPT_DRAG) {
- uiBlockBeginAlign(block);
- but= uiDefIconButC(block, TOG, REDRAWBUTSEDIT, sd->texsep ? ICON_UNLOCKED : ICON_LOCKED, cx,cy,20,19, &sd->texsep,0,0,0,0, "Locks the texture sizes together");
- uiBlockBeginAlign(block);
- uiDefButF(block,NUM,B_NOP, sd->texsep ? "SizeX" : "Size", cx+20,cy,95,19, &mtex->size[0],1,1000,100,0,"Scaling factor for texture");
- cy-= 20;
- if(sd->texsep) {
- uiDefButF(block,NUM,B_NOP, "SizeY", cx+20,cy,95,19, &mtex->size[1],1,1000,100,0,"Scaling factor for texture");
- cy-= 20;
- if(sd->texrept == SCULPTREPT_3D)
- uiDefButF(block,NUM,B_NOP, "SizeZ", cx+20,cy,95,19, &mtex->size[2],1,1000,100,0,"Scaling factor for texture");
- cy-= 20;
- }
- }
- }
- else {
- uiDefButS(block,TOG,B_SCULPT_TEXBROWSE, "Add New" ,cx, cy, 115, 19, &G.buts->texnr,-1,32767,0,0, "Adds a new texture");
- uiDefButS(block,MENU,B_SCULPT_TEXBROWSE, strp, cx,cy-20,20,19, &G.buts->texnr, 0,0,0,0, "Selects an existing texture or creates new");
- }
-
- MEM_freeN(strp);
- }
-
- uiBlockEndAlign(block);
-}
-
-/* *************************** FACE/PAINT *************************** */
-
-void do_fpaintbuts(unsigned short event)
-{
- Mesh *me;
- Object *ob;
- bDeformGroup *defGroup;
- MTFace *activetf, *tf;
- MFace *mf;
- MCol *activemcol;
- int a;
- SculptData *sd= &G.scene->sculptdata;
- ID *id, *idtest;
- extern VPaint Gwp; /* from vpaint */
- ToolSettings *settings= G.scene->toolsettings;
- int nr= 1;
- MTex *mtex;
- ParticleSystem *psys;
-
- ob= OBACT;
- if(ob==NULL) return;
-
- switch(event) {
-
- case B_VPGAMMA:
- vpaint_dogamma();
- break;
- case B_COPY_TF_MODE:
- case B_COPY_TF_UV:
- case B_COPY_TF_COL:
- case B_COPY_TF_TEX:
- me= get_mesh(OBACT);
- activetf= get_active_mtface(NULL, &activemcol, 0);
-
- if(me && activetf) {
- for (a=0, tf=me->mtface, mf=me->mface; a < me->totface; a++, tf++, mf++) {
- if(tf!=activetf && (mf->flag & ME_FACE_SEL)) {
- if(event==B_COPY_TF_MODE) {
- tf->mode= activetf->mode;
- tf->transp= activetf->transp;
- }
- else if(event==B_COPY_TF_UV) {
- memcpy(tf->uv, activetf->uv, sizeof(tf->uv));
- tf->tpage= activetf->tpage;
- tf->tile= activetf->tile;
-
- if(activetf->mode & TF_TILES) tf->mode |= TF_TILES;
- else tf->mode &= ~TF_TILES;
-
- }
- else if(event==B_COPY_TF_TEX) {
- tf->tpage= activetf->tpage;
- tf->tile= activetf->tile;
-
- if(activetf->mode & TF_TILES) tf->mode |= TF_TILES;
- else tf->mode &= ~TF_TILES;
- }
- else if(event==B_COPY_TF_COL && activemcol)
- memcpy(&me->mcol[a*4], activemcol, sizeof(MCol)*4);
- }
- }
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- do_shared_vertexcol(me);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIMAGE, 0);
- }
- break;
- case B_SET_VCOL:
- if(FACESEL_PAINT_TEST)
- clear_vpaint_selectedfaces();
- else
- clear_vpaint();
- break;
- case B_REDR_3D_IMA:
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIMAGE, 0);
- break;
- case B_ASSIGNMESH:
-
- test_object_materials(ob->data);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- break;
-
- case B_TFACE_HALO:
- activetf = get_active_mtface(NULL, NULL, 0);
- if(activetf) {
- activetf->mode &= ~TF_BILLBOARD2;
- allqueue(REDRAWBUTSEDIT, 0);
- }
- break;
-
- case B_TFACE_BILLB:
- activetf = get_active_mtface(NULL, NULL, 0);
- if(activetf) {
- activetf->mode &= ~TF_BILLBOARD;
- allqueue(REDRAWBUTSEDIT, 0);
- }
- break;
- case B_WEIGHT0_0:
- editbutvweight = 0.0f;
- allqueue(REDRAWBUTSEDIT, 0);
- break;
-
- case B_WEIGHT1_4:
- editbutvweight = 0.25f;
- allqueue(REDRAWBUTSEDIT, 0);
- break;
- case B_WEIGHT1_2:
- editbutvweight = 0.5f;
- allqueue(REDRAWBUTSEDIT, 0);
- break;
- case B_WEIGHT3_4:
- editbutvweight = 0.75f;
- allqueue(REDRAWBUTSEDIT, 0);
- break;
- case B_WEIGHT1_0:
- editbutvweight = 1.0f;
- allqueue(REDRAWBUTSEDIT, 0);
- break;
-
- case B_OPA1_8:
- Gwp.a = 0.125f;
- allqueue(REDRAWBUTSEDIT, 0);
- break;
- case B_OPA1_4:
- Gwp.a = 0.25f;
- allqueue(REDRAWBUTSEDIT, 0);
- break;
- case B_OPA1_2:
- Gwp.a = 0.5f;
- allqueue(REDRAWBUTSEDIT, 0);
- break;
- case B_OPA3_4:
- Gwp.a = 0.75f;
- allqueue(REDRAWBUTSEDIT, 0);
- break;
- case B_OPA1_0:
- Gwp.a = 1.0f;
- allqueue(REDRAWBUTSEDIT, 0);
- break;
- case B_CLR_WPAINT:
- if(!multires_level1_test()) {
- defGroup = BLI_findlink(&ob->defbase, ob->actdef-1);
- if(defGroup) {
- Mesh *me= ob->data;
- int a;
- for(a=0; a<me->totvert; a++)
- remove_vert_defgroup (ob, defGroup, a);
- allqueue(REDRAWVIEW3D, 0);
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- }
- }
- break;
- case B_SCULPT_TEXBROWSE:
- sd= &G.scene->sculptdata;
-
- if(G.buts->texnr== -2) {
- id= NULL;
- if(sd) {
- mtex= sd->mtex[sd->texact];
- if(mtex) id= &mtex->tex->id;
- }
-
- activate_databrowse((ID *)id, ID_TE, 0, B_SCULPT_TEXBROWSE, &G.buts->texnr, do_global_buttons);
- return;
- }
- if(G.buts->texnr < 0) break;
-
- if(G.buts->pin) {
-
- }
- else if(sd && sd->texact == -1) {
- error("No texture channel selected");
- allqueue(REDRAWBUTSSHADING, 0);
- }
- else if(sd && sd->texact != -1) {
- id= NULL;
-
- mtex= sd->mtex[sd->texact];
- if(mtex) id= &mtex->tex->id;
-
- idtest= G.main->tex.first;
- while(idtest) {
- if(nr==G.buts->texnr) {
- break;
- }
- nr++;
- idtest= idtest->next;
- }
- if(idtest==0) { /* new tex */
- if(id) idtest= (ID *)copy_texture((Tex *)id);
- else idtest= (ID *)add_texture("Tex");
- idtest->us--;
- }
- if(idtest!=id && sd) {
-
- if(sd->mtex[sd->texact]==0) {
- sd->mtex[sd->texact]= add_mtex();
- sd->mtex[sd->texact]->texco= TEXCO_VIEW;
- sd->mtex[sd->texact]->size[0]=
- sd->mtex[sd->texact]->size[1]=
- sd->mtex[sd->texact]->size[2]= 100;
- sd->mtex[sd->texact]->warpfac= 0;
- }
- sd->mtex[sd->texact]->tex= (Tex *)idtest;
- id_us_plus(idtest);
- if(id) id->us--;
-
- BIF_undo_push("Texture browse");
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWOOPS, 0);
- BIF_preview_changed(ID_TE);
- }
- }
- break;
-
- case B_BRUSHBROWSE:
- if(G.buts->menunr==-2) {
- activate_databrowse((ID*)settings->imapaint.brush, ID_BR, 0, B_BRUSHBROWSE, &G.buts->menunr, do_global_buttons);
- break;
- }
- else if(G.buts->menunr < 0) break;
-
- if(brush_set_nr(&settings->imapaint.brush, G.buts->menunr)) {
- BIF_undo_push("Browse Brush");
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWIMAGE, 0);
- }
- break;
- case B_BRUSHDELETE:
- if(brush_delete(&settings->imapaint.brush)) {
- BIF_undo_push("Unlink Brush");
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWIMAGE, 0);
- }
- break;
- case B_BRUSHKEEPDATA:
- brush_toggle_fake_user(settings->imapaint.brush);
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWIMAGE, 0);
- break;
- case B_BRUSHLOCAL:
- if(settings->imapaint.brush && settings->imapaint.brush->id.lib) {
- if(okee("Make local")) {
- make_local_brush(settings->imapaint.brush);
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWIMAGE, 0);
- }
- }
- break;
- case B_BTEXBROWSE:
- if(settings->imapaint.brush) {
- Brush *brush= settings->imapaint.brush;
-
- if(G.buts->menunr==-2) {
- MTex *mtex= brush->mtex[brush->texact];
- ID *id= (ID*)((mtex)? mtex->tex: NULL);
- if(G.qual & LR_CTRLKEY) {
- activate_databrowse_imasel(id, ID_TE, 0, B_BTEXBROWSE, &G.buts->menunr, do_fpaintbuts);
- } else {
- activate_databrowse(id, ID_TE, 0, B_BTEXBROWSE, &G.buts->menunr, do_fpaintbuts);
- }
- break;
- }
- else if(G.buts->menunr < 0) break;
-
- if(brush_texture_set_nr(brush, G.buts->menunr)) {
- BIF_undo_push("Browse Brush Texture");
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWIMAGE, 0);
- }
- }
- break;
- case B_BTEXDELETE:
- if(settings->imapaint.brush) {
- if (brush_texture_delete(settings->imapaint.brush)) {
- BIF_undo_push("Unlink Brush Texture");
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWIMAGE, 0);
- }
- }
- break;
- case B_BRUSHCHANGE:
- allqueue(REDRAWIMAGE, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- break;
- case B_BAKE_REDRAWEDIT:
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- break;
- case B_BAKE_RECACHE:
- psys=PE_get_current(ob);
- PE_hide_keys_time(psys,CFRA);
- psys_cache_paths(ob,psys,CFRA,0);
- if(PE_settings()->flag & PE_SHOW_CHILD)
- psys_cache_child_paths(ob,psys,CFRA,0);
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- break;
- }
-}
-
-/* -------------------- MODE: vpaint ------------------- */
-
-void weight_paint_buttons(uiBlock *block)
-{
- extern VPaint Gwp; /* from vpaint */
- Object *ob;
- ob= OBACT;
-
- if(ob==NULL) return;
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, REDRAWVIEW3D, "Weight:",10,170,225,19, &editbutvweight, 0, 1, 10, 0, "Sets the current vertex group's bone deformation strength");
-
- uiDefBut(block, BUT, B_WEIGHT0_0 , "0", 10,150,45,19, 0, 0, 0, 0, 0, "");
- uiDefBut(block, BUT, B_WEIGHT1_4 , "1/4", 55,150,45,19, 0, 0, 0, 0, 0, "");
- uiDefBut(block, BUT, B_WEIGHT1_2 , "1/2", 100,150,45,19, 0, 0, 0, 0, 0, "");
- uiDefBut(block, BUT, B_WEIGHT3_4 , "3/4", 145,150,45,19, 0, 0, 0, 0, 0, "");
- uiDefBut(block, BUT, B_WEIGHT1_0 , "1", 190,150,45,19, 0, 0, 0, 0, 0, "");
-
- uiDefButF(block, NUMSLI, B_NOP, "Opacity ", 10,130,225,19, &Gwp.a, 0.0, 1.0, 0, 0, "The amount of pressure on the brush");
-
- uiDefBut(block, BUT, B_OPA1_8 , "1/8", 10,110,45,19, 0, 0, 0, 0, 0, "");
- uiDefBut(block, BUT, B_OPA1_4 , "1/4", 55,110,45,19, 0, 0, 0, 0, 0, "");
- uiDefBut(block, BUT, B_OPA1_2 , "1/2", 100,110,45,19, 0, 0, 0, 0, 0, "");
- uiDefBut(block, BUT, B_OPA3_4 , "3/4", 145,110,45,19, 0, 0, 0, 0, 0, "");
- uiDefBut(block, BUT, B_OPA1_0 , "1", 190,110,45,19, 0, 0, 0, 0, 0, "");
-
- uiDefButF(block, NUMSLI, B_NOP, "Size ", 10,90,225,19, &Gwp.size, 2.0, 64.0, 0, 0, "The size of the brush");
-
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW, B_DIFF, "Mix", 250,170,60,17, &Gwp.mode, 1.0, 0.0, 0, 0, "Mix the vertex colors");
- uiDefButS(block, ROW, B_DIFF, "Add", 250,152,60,17, &Gwp.mode, 1.0, 1.0, 0, 0, "Add the vertex colors");
- uiDefButS(block, ROW, B_DIFF, "Sub", 250,134,60,17, &Gwp.mode, 1.0, 2.0, 0, 0, "Subtract from the vertex color");
- uiDefButS(block, ROW, B_DIFF, "Mul", 250,116,60,17, &Gwp.mode, 1.0, 3.0, 0, 0, "Multiply the vertex color");
- uiDefButS(block, ROW, B_DIFF, "Blur", 250, 98,60,17, &Gwp.mode, 1.0, 4.0, 0, 0, "Blur the weight with surrounding values");
- uiDefButS(block, ROW, B_DIFF, "Lighter", 250, 80,60,17, &Gwp.mode, 1.0, 5.0, 0, 0, "Paint over darker areas only");
- uiDefButS(block, ROW, B_DIFF, "Darker", 250, 62,60,17, &Gwp.mode, 1.0, 6.0, 0, 0, "Paint over lighter areas only");
- uiBlockEndAlign(block);
-
- /* draw options same as below */
- uiBlockBeginAlign(block);
- if (FACESEL_PAINT_TEST) {
- uiDefButBitI(block, TOG, G_DRAWFACES, B_UVAUTO_DRAWFACES, "Faces", 10,45,60,19, &G.f, 0, 0, 0, 0, "Displays all faces as shades");
- uiDefButBitI(block,TOG, G_DRAWEDGES, REDRAWVIEW3D,"Edges",70,45,60,19, &G.f, 2.0, 0, 0, 0, "Displays edges of visible faces");
- uiDefButBitI(block,TOG, G_HIDDENEDGES, REDRAWVIEW3D,"Hidden Edges",130,45,100,19, &G.f, 2.0, 1.0, 0, 0, "Displays edges of hidden faces");
- } else{
- uiDefButBitC(block, TOG, OB_DRAWWIRE, REDRAWVIEW3D, "Wire", 10,45,75,19, &ob->dtx, 0, 0, 0, 0, "Displays the active object's wireframe in shaded drawing modes");
- }
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, VP_AREA, 0, "All Faces", 10,20,60,19, &Gwp.flag, 0, 0, 0, 0, "Paint on all faces inside brush (otherwise only on face under mouse cursor)");
- uiDefButBitS(block, TOG, VP_SOFT, 0, "Vert Dist", 70,20,60,19, &Gwp.flag, 0, 0, 0, 0, "Use distances to vertices (instead of all vertices of face)");
- uiDefButBitS(block, TOGN, VP_HARD, 0, "Soft", 130,20,60,19, &Gwp.flag, 0, 0, 0, 0, "Use a soft brush");
- uiDefButBitS(block, TOG, VP_NORMALS, 0, "Normals", 190,20,60,19, &Gwp.flag, 0, 0, 0, 0, "Applies the vertex normal before painting");
- uiDefButBitS(block, TOG, VP_SPRAY, 0, "Spray", 250,20,55,19, &Gwp.flag, 0, 0, 0, 0, "Keep applying paint effect while holding mouse");
- uiBlockEndAlign(block);
-
- if(ob) {
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, VP_ONLYVGROUP, REDRAWVIEW3D, "Vgroup", 10,0,100,19, &Gwp.flag, 0, 0, 0, 0, "Only paint on vertices in the selected vertex group.");
- uiDefButBitS(block, TOG, VP_MIRROR_X, REDRAWVIEW3D, "X-Mirror", 110,0,100,19, &Gwp.flag, 0, 0, 0, 0, "Mirrored Paint, applying on mirrored Weight Group name");
- uiDefBut(block, BUT, B_CLR_WPAINT, "Clear", 210,0,100,19, NULL, 0, 0, 0, 0, "Removes reference to this deform group from all vertices");
- uiBlockEndAlign(block);
- }
-}
-
-static void editing_panel_mesh_paint(void)
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "editing_panel_mesh_paint", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Paint", "Editing", 640, 0, 318, 204)==0) return;
-
-
- if(G.f & G_WEIGHTPAINT) {
- weight_paint_buttons(block);
- }
- else if(G.f & G_VERTEXPAINT) {
- extern VPaint Gvp; /* from vpaint */
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_NOP, "R ", 979,170,150,19, &Gvp.r, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of red used for painting");
- uiDefButF(block, NUMSLI, B_NOP, "G ", 979,150,150,19, &Gvp.g, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of green used for painting");
- uiDefButF(block, NUMSLI, B_NOP, "B ", 979,130,150,19, &Gvp.b, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of blue used for painting");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_NOP, "Opacity ", 979,105,222,19, &Gvp.a, 0.0, 1.0, 0, 0, "The amount of pressure on the brush");
- uiDefButF(block, NUMSLI, B_NOP, "Size ", 979,85,222,19, &Gvp.size, 2.0, 64.0, 0, 0, "The size of the brush");
- uiBlockEndAlign(block);
-
- uiDefButF(block, COL, B_REDR, "", 1140,150,60,40, &(Gvp.r), 0, 0, 0, B_VPCOLSLI, "");
- uiDefBut(block, BUT, B_SET_VCOL, "SetVCol", 1140,130,60,20, 0, 0, 0, 0, 0, "Set Vertex color of selection to current (Shift+K)");
-
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW, B_DIFF, "Mix", 1212,170,63,17, &Gvp.mode, 1.0, 0.0, 0, 0, "Mix the vertex colors");
- uiDefButS(block, ROW, B_DIFF, "Add", 1212,152,63,17, &Gvp.mode, 1.0, 1.0, 0, 0, "Add the vertex color");
- uiDefButS(block, ROW, B_DIFF, "Sub", 1212, 134,63,17, &Gvp.mode, 1.0, 2.0, 0, 0, "Subtract from the vertex color");
- uiDefButS(block, ROW, B_DIFF, "Mul", 1212, 116,63,17, &Gvp.mode, 1.0, 3.0, 0, 0, "Multiply the vertex color");
- uiDefButS(block, ROW, B_DIFF, "Blur", 1212, 98,63,17, &Gvp.mode, 1.0, 4.0, 0, 0, "Blur the color with surrounding values");
- uiDefButS(block, ROW, B_DIFF, "Lighter", 1212, 80,63,17, &Gvp.mode, 1.0, 5.0, 0, 0, "Paint over darker areas only");
- uiDefButS(block, ROW, B_DIFF, "Darker", 1212, 62,63,17, &Gvp.mode, 1.0, 6.0, 0, 0, "Paint over lighter areas only");
- uiBlockEndAlign(block);
-
- /* draw options */
- uiBlockBeginAlign(block);
- if (FACESEL_PAINT_TEST) {
- uiDefButBitI(block, TOG, G_DRAWFACES, B_UVAUTO_DRAWFACES, "Faces", 979,50,60,19, &G.f, 0, 0, 0, 0, "Displays all faces as shades");
- uiDefButBitI(block,TOG, G_DRAWEDGES, REDRAWVIEW3D,"Edges",1039,50,60,19, &G.f, 2.0, 0, 0, 0, "Displays edges of visible faces");
- uiDefButBitI(block,TOG, G_HIDDENEDGES, REDRAWVIEW3D,"Hidden Edges",1099,50,100,19, &G.f, 2.0, 1.0, 0, 0, "Displays edges of hidden faces");
- }
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, VP_AREA, 0, "All Faces", 979,25,75,19, &Gvp.flag, 0, 0, 0, 0, "Paint on all faces inside brush");
- uiDefButBitS(block, TOG, VP_SOFT, 0, "Vertex Dist", 1054,25,75,19, &Gvp.flag, 0, 0, 0, 0, "Use distances to vertices (instead of paint entire faces)");
- uiDefButBitS(block, TOG, VP_NORMALS, 0, "Normals", 1129,25,75,19, &Gvp.flag, 0, 0, 0, 0, "Applies the vertex normal before painting");
- uiDefButBitS(block, TOG, VP_SPRAY, 0, "Spray", 1204,25,72,19, &Gvp.flag, 0, 0, 0, 0, "Keep applying paint effect while holding mouse");
-
- uiBlockBeginAlign(block);
- uiDefBut(block, BUT, B_VPGAMMA, "Set", 979,0,81,19, 0, 0, 0, 0, 0, "Apply Mul and Gamma to vertex colors");
- uiDefButF(block, NUM, B_DIFF, "Mul:", 1061,0,112,19, &Gvp.mul, 0.1, 50.0, 10, 0, "Set the number to multiply vertex colors with");
- uiDefButF(block, NUM, B_DIFF, "Gamma:", 1174,0,102,19, &Gvp.gamma, 0.1, 5.0, 10, 0, "Change the clarity of the vertex colors");
- uiBlockEndAlign(block);
- }
- else { /* texture paint */
- ToolSettings *settings= G.scene->toolsettings;
- Brush *brush= settings->imapaint.brush;
- ID *id;
- int yco, xco, butw;
-
- yco= 160;
-
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW, B_BRUSHCHANGE, "Draw", 0 ,yco,108,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_DRAW, 0, 0, "Draw brush");
- uiDefButS(block, ROW, B_BRUSHCHANGE, "Soften", 108 ,yco,106,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_SOFTEN, 0, 0, "Soften brush");
- uiDefButS(block, ROW, B_BRUSHCHANGE, "Smear", 214,yco,106,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_SMEAR, 0, 0, "Smear brush");
- uiBlockEndAlign(block);
- yco -= 30;
-
- uiBlockSetCol(block, TH_BUT_SETTING2);
- id= (ID*)settings->imapaint.brush;
- xco= std_libbuttons(block, 0, yco, 0, NULL, B_BRUSHBROWSE, ID_BR, 0, id, NULL, &(G.buts->menunr), 0, B_BRUSHLOCAL, B_BRUSHDELETE, 0, B_BRUSHKEEPDATA);
- uiBlockSetCol(block, TH_AUTO);
-
- if(brush && !brush->id.lib) {
- MTex *mtex= brush->mtex[brush->texact];
-
- butw= 320-(xco+10);
-
- uiDefButS(block, MENU, B_NOP, "Mix %x0|Add %x1|Subtract %x2|Multiply %x3|Lighten %x4|Darken %x5|Erase Alpha %x6|Add Alpha %x7", xco+10,yco,butw,19, &brush->blend, 0, 0, 0, 0, "Blending method for applying brushes");
-
- uiDefButBitS(block, TOG|BIT, BRUSH_TORUS, B_BRUSHCHANGE, "Wrap", xco+10,yco-25,butw,19, &brush->flag, 0, 0, 0, 0, "Enables torus wrapping");
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG|BIT, BRUSH_AIRBRUSH, B_BRUSHCHANGE, "Airbrush", xco+10,yco-50,butw,19, &brush->flag, 0, 0, 0, 0, "Keep applying paint effect while holding mouse (spray)");
- uiDefButF(block, NUM, B_NOP, "Rate ", xco+10,yco-70,butw,19, &brush->rate, 0.01, 1.0, 0, 0, "Number of paints per second for Airbrush");
- uiBlockEndAlign(block);
-
- yco -= 25;
-
- uiBlockBeginAlign(block);
- uiDefButF(block, COL, B_VPCOLSLI, "", 0,yco,200,19, brush->rgb, 0, 0, 0, 0, "");
- uiDefButF(block, NUMSLI, B_NOP, "Opacity ", 0,yco-20,180,19, &brush->alpha, 0.0, 1.0, 0, 0, "The amount of pressure on the brush");
- uiDefButBitS(block, TOG|BIT, BRUSH_ALPHA_PRESSURE, B_NOP, "P", 180,yco-20,20,19, &brush->flag, 0, 0, 0, 0, "Enables pressure sensitivity for tablets");
- uiDefButI(block, NUMSLI, B_NOP, "Size ", 0,yco-40,180,19, &brush->size, 1, 200, 0, 0, "The size of the brush");
- uiDefButBitS(block, TOG|BIT, BRUSH_SIZE_PRESSURE, B_NOP, "P", 180,yco-40,20,19, &brush->flag, 0, 0, 0, 0, "Enables pressure sensitivity for tablets");
- uiDefButF(block, NUMSLI, B_NOP, "Falloff ", 0,yco-60,180,19, &brush->innerradius, 0.0, 1.0, 0, 0, "The fall off radius of the brush");
- uiDefButBitS(block, TOG|BIT, BRUSH_RAD_PRESSURE, B_NOP, "P", 180,yco-60,20,19, &brush->flag, 0, 0, 0, 0, "Enables pressure sensitivity for tablets");
- uiDefButF(block, NUMSLI, B_NOP, "Spacing ",0,yco-80,180,19, &brush->spacing, 1.0, 100.0, 0, 0, "Repeating paint on %% of brush diameter");
- uiDefButBitS(block, TOG|BIT, BRUSH_SPACING_PRESSURE, B_NOP, "P", 180,yco-80,20,19, &brush->flag, 0, 0, 0, 0, "Enables pressure sensitivity for tablets");
- uiBlockEndAlign(block);
-
- yco -= 110;
-
- uiBlockSetCol(block, TH_BUT_SETTING2);
- id= (mtex)? (ID*)mtex->tex: NULL;
- xco= std_libbuttons(block, 0, yco, 0, NULL, B_BTEXBROWSE, ID_TE, 0, id, NULL, &(G.buts->menunr), 0, 0, B_BTEXDELETE, 0, 0);
- /*uiDefButBitS(block, TOG|BIT, BRUSH_FIXED_TEX, B_BRUSHCHANGE, "Fixed", xco+5,yco,butw,19, &brush->flag, 0, 0, 0, 0, "Keep texture origin in fixed position");*/
- uiBlockSetCol(block, TH_AUTO);
- }
- }
-}
-
-static void editing_panel_mesh_texface(void)
-{
- uiBlock *block;
- MTFace *tf;
-
- block= uiNewBlock(&curarea->uiblocks, "editing_panel_mesh_texface", UI_EMBOSS, UI_HELV, curarea->win);
- uiNewPanelTabbed("Multires", "Editing");
- if(uiNewPanel(curarea, block, "Texture Face", "Editing", 960, 0, 318, 204)==0) return;
-
- tf = get_active_mtface(NULL, NULL, 0);
- if(tf) {
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, TF_TEX, B_REDR_3D_IMA, "Tex", 600,160,60,19, &tf->mode, 0, 0, 0, 0, "Render face with texture");
- uiDefButBitS(block, TOG, TF_TILES, B_REDR_3D_IMA, "Tiles", 660,160,60,19, &tf->mode, 0, 0, 0, 0, "Use tilemode for face");
- uiDefButBitS(block, TOG, TF_LIGHT, REDRAWVIEW3D, "Light", 720,160,60,19, &tf->mode, 0, 0, 0, 0, "Use light for face");
- uiDefButBitS(block, TOG, TF_INVISIBLE, REDRAWVIEW3D, "Invisible",780,160,60,19, &tf->mode, 0, 0, 0, 0, "Make face invisible");
- uiDefButBitS(block, TOG, TF_DYNAMIC, REDRAWVIEW3D, "Collision", 840,160,60,19, &tf->mode, 0, 0, 0, 0, "Use face for collision detection");
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, TF_SHAREDCOL, REDRAWVIEW3D, "Shared", 600,135,60,19, &tf->mode, 0, 0, 0, 0, "Blend vertex colors across face when vertices are shared");
- uiDefButBitS(block, TOG, TF_TWOSIDE, REDRAWVIEW3D, "Twoside",660,135,60,19, &tf->mode, 0, 0, 0, 0, "Render face twosided");
- uiDefButBitS(block, TOG, TF_OBCOL, REDRAWVIEW3D, "ObColor",720,135,60,19, &tf->mode, 0, 0, 0, 0, "Use ObColor instead of vertex colors");
-
- uiBlockBeginAlign(block);
-
- uiDefButBitS(block, TOG, TF_BILLBOARD, B_TFACE_HALO, "Halo", 600,110,60,19, &tf->mode, 0, 0, 0, 0, "Screen aligned billboard");
- uiDefButBitS(block, TOG, TF_BILLBOARD2, B_TFACE_BILLB, "Billboard",660,110,60,19, &tf->mode, 0, 0, 0, 0, "Billboard with Z-axis constraint");
- uiDefButBitS(block, TOG, TF_SHADOW, REDRAWVIEW3D, "Shadow", 720,110,60,19, &tf->mode, 0, 0, 0, 0, "Face is used for shadow");
- uiDefButBitS(block, TOG, TF_BMFONT, REDRAWVIEW3D, "Text", 780,110,60,19, &tf->mode, 0, 0, 0, 0, "Enable bitmap text on face");
-
- uiBlockBeginAlign(block);
- uiBlockSetCol(block, TH_BUT_SETTING1);
- uiDefButC(block, ROW, REDRAWVIEW3D, "Opaque", 600,80,60,19, &tf->transp, 2.0, (float)TF_SOLID,0, 0, "Render color of textured face as color");
- uiDefButC(block, ROW, REDRAWVIEW3D, "Add", 660,80,60,19, &tf->transp, 2.0, (float)TF_ADD, 0, 0, "Render face transparent and add color of face");
- uiDefButC(block, ROW, REDRAWVIEW3D, "Alpha", 720,80,60,19, &tf->transp, 2.0, (float)TF_ALPHA,0, 0, "Render polygon transparent, depending on alpha channel of the texture");
- }
-}
-
-void do_uvcalculationbuts(unsigned short event)
-{
- switch(event) {
- case B_UVAUTO_DRAWFACES:
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIMAGE, 0);
- break;
- }
-}
-
-static void editing_panel_mesh_uvautocalculation(void)
-{
- uiBlock *block;
- int butH= 19, butHB= 20, row= 180, butS= 10;
-
- block= uiNewBlock(&curarea->uiblocks, "editing_panel_mesh_uvautocalculation", UI_EMBOSS, UI_HELV, curarea->win);
- /* make this a tab of "Texture face" to save screen space*/
- uiNewPanelTabbed("Multires", "Editing");
- if(uiNewPanel(curarea, block, "UV Calculation", "Editing", 960, 0, 318, 204)==0)
- return;
- row-= 4*butHB+butS;
-
- uiBlockBeginAlign(block);
- uiDefButS(block, MENU, REDRAWBUTSEDIT, "Unwrapper%t|Conformal%x0|Angle Based%x1",100,row,200,butH, &G.scene->toolsettings->unwrapper, 0, 0, 0, 0, "Unwrap method");
- uiDefButBitS(block, TOG, 1, B_NOP, "Fill Holes",100,row-butHB,200,butH,&G.scene->toolsettings->uvcalc_flag, 0, 0, 0, 0, "Fill holes to prevent internal overlaps");
- uiBlockEndAlign(block);
- row-= 2*butHB+butS;
-
- row= 180;
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM,B_UVAUTO_CUBESIZE ,"Cube Size:",315,row,200,butH, &G.scene->toolsettings->uvcalc_cubesize, 0.0001, 100.0, 10, 3, "Defines the cubemap size for cube mapping");
- uiBlockEndAlign(block);
- row-= butHB+butS;
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM,B_UVAUTO_CYLRADIUS ,"Cyl Radius:",315,row,200,butH, &G.scene->toolsettings->uvcalc_radius, 0.1, 100.0, 10, 3, "Defines the radius of the UV mapping cylinder");
- uiBlockEndAlign(block);
- row-= butHB+butS;
-
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW,B_UVAUTO_FACE,"View Aligns Face",315,row,200,butH, &G.scene->toolsettings->uvcalc_mapdir,2.0, 1.0, 0.0,0.0, "View is on equator for cylindrical and spherical UV mapping");
- uiDefButS(block, ROW,B_UVAUTO_TOP,"VA Top",315,row-butHB,100,butH, &G.scene->toolsettings->uvcalc_mapdir,2.0, 0.0, 0.0,0.0, "View is on poles for cylindrical and spherical UV mapping");
- uiDefButS(block, ROW,B_UVAUTO_TOP,"Al Obj",415,row-butHB,100,butH, &G.scene->toolsettings->uvcalc_mapdir,2.0, 2.0, 0.0,0.0, "Align to object for cylindrical and spherical UV mapping");
- uiBlockEndAlign(block);
- row-= 2*butHB+butS;
-
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW,B_UVAUTO_ALIGNX,"Polar ZX",315,row,100,butH, &G.scene->toolsettings->uvcalc_mapalign,2.0, 0.0, 0.0,0.0, "Polar 0 is X for cylindrical and spherical UV mapping");
- uiDefButS(block, ROW,B_UVAUTO_ALIGNY,"Polar ZY",415,row,100,butH, &G.scene->toolsettings->uvcalc_mapalign,2.0, 1.0, 0.0,0.0, "Polar 0 is Y for cylindrical and spherical UV mapping");
- uiBlockEndAlign(block);
-}
-
-void editing_panel_mesh_multires()
-{
- uiBlock *block;
- uiBut *but;
- Object *ob= OBACT;
- Mesh *me= get_mesh(ob);
- int cx= 100, cy= 0;
-
- block= uiNewBlock(&curarea->uiblocks, "editing_panel_mesh_multires", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Multires", "Editing", 500, 0, 318, 204)==0) return;
-
- uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
-
- if(!me->mr) {
- but= uiDefBut(block,BUT,B_NOP,"Add Multires", cx,cy,268,19,0,0,0,0,0,"");
- uiButSetFunc(but,multires_make,ob,me);
- } else {
- char subsurfmenu[]= "Subsurf Type%t|Catmull-Clark%x0|Simple Subdiv.%x1";
-
- but= uiDefBut(block,BUT,B_NOP,"Apply Multires", cx,cy,268,19,0,0,0,0,0,"Apply current multires level to mesh and the delete other levels");
- uiButSetFunc(but,multires_delete,ob,me);
- cy-= 24;
-
- uiBlockBeginAlign(block);
- but= uiDefBut(block,BUT,B_NOP,"Add Level", cx,cy,134,19,0,0,0,0,0,"Add a new level of subdivision at the end of the chain");
- uiButSetFunc(but,multires_add_level,ob,me);
- uiDefButC(block, MENU, B_NOP, subsurfmenu, cx + 134, cy, 134, 19, &G.scene->toolsettings->multires_subdiv_type, 0, 0, 0, 0, "Selects type of subdivision algorithm.");
- cy-= 20;
-
- if(me->mr->level_count>1) {
- but= uiDefBut(block,BUT,B_NOP,"Del Lower", cx,cy,134,19,0,0,0,0,0,"Remove all levels of subdivision below the current one");
- uiButSetFunc(but,multires_del_lower,ob,me);
- but= uiDefBut(block,BUT,B_NOP,"Del Higher", cx+134,cy,134,19,0,0,0,0,0,"Remove all levels of subdivision above the current one");
- uiButSetFunc(but,multires_del_higher,ob,me);
- cy-= 20;
-
- but= uiDefButC(block,NUM,B_NOP,"Level: ",cx,cy,268,19,(char *)&me->mr->newlvl,1.0,me->mr->level_count,0,0,"");
- uiButSetFunc(but,multires_set_level_cb, ob, me);
- cy-= 20;
-
- but= uiDefButC(block,NUM,B_NOP,"Edges: ",cx,cy,268,19,(char *)&me->mr->edgelvl,1.0,me->mr->level_count,0,0,"Set level of edges to display");
- uiButSetFunc(but,multires_edge_level_update,ob,me);
- cy-= 20;
- uiBlockEndAlign(block);
-
- cy-= 5;
- uiDefBut(block,LABEL,B_NOP,"Rendering",cx,cy,100,19,0,0,0,0,0,"");
- cy-= 20;
-
- uiBlockBeginAlign(block);
- uiDefButC(block,NUM,B_NOP,"Pin: ",cx,cy,268,19,(char *)&me->mr->pinlvl,1.0,me->mr->level_count,0,0,"Set level to apply modifiers to during render");
- cy-= 20;
-
- uiDefButC(block,NUM,B_NOP,"Render: ",cx,cy,268,19,(char *)&me->mr->renderlvl,1.0,me->mr->level_count,0,0,"Set level to render");
- cy-= 20;
-
- if(multires_modifier_warning()) {
- char *tip= "One or more modifiers are enabled that modify mesh topology";
- uiDefIconBut(block,LABEL,B_NOP,ICON_ERROR, cx,cy,20,20, 0,0,0,0,0, tip);
- uiDefBut(block,LABEL,B_NOP, "Cannot use render level", cx+20,cy,180,19, 0,0,0,0,0, tip);
- }
- }
- }
-
- uiBlockEndAlign(block);
-}
-
-void particle_edit_buttons(uiBlock *block)
-{
- Object *ob=OBACT;
- ParticleSystem *psys = PE_get_current(ob);
- ParticleEditSettings *pset = PE_settings();
- ParticleEdit *edit;
- uiBut *but;
- short butx=10,buty=150,butw=150,buth=20, lastbuty;
- static short partact;
-
- char *menustr;
-
- if(psys==NULL) return;
-
- menustr = psys_menu_string(ob, 0);
- partact = PE_get_current_num(ob)+1;
-
- but=uiDefButS(block, MENU, B_BAKE_REDRAWEDIT, menustr, 160,180,butw,buth, &partact, 14.0, 0.0, 0, 0, "Browse systems");
- uiButSetFunc(but, PE_change_act, ob, &partact);
-
- MEM_freeN(menustr);
-
- if(psys->edit) {
- edit= psys->edit;
-
- /* brushes */
- //uiDefBut(block, LABEL, 0, "Brush", butx,(buty-=buth),butw,buth, NULL, 0.0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButS(block,ROW,B_BAKE_REDRAWEDIT,"None",butx,buty,75,19,&pset->brushtype,14.0,PE_BRUSH_NONE,0,0,"Disable brush");
- uiDefButS(block,ROW,B_BAKE_REDRAWEDIT,"Comb",butx+75,buty,75,19,&pset->brushtype,14.0,PE_BRUSH_COMB,0,0,"Comb hairs");
- uiDefButS(block,ROW,B_BAKE_REDRAWEDIT,"Smooth",butx+150,buty,75,19,&pset->brushtype,14.0,PE_BRUSH_SMOOTH,0,0,"Smooth hairs");
- uiDefButS(block,ROW,B_BAKE_REDRAWEDIT,"Weight",butx+225,buty,75,19,&pset->brushtype,14,PE_BRUSH_WEIGHT,0,0,"Weight hairs");
- buty-= buth;
- uiDefButS(block,ROW,B_BAKE_REDRAWEDIT,"Add", butx,buty,75,19,&pset->brushtype,14,PE_BRUSH_ADD,0,0,"Add hairs");
- uiDefButS(block,ROW,B_BAKE_REDRAWEDIT,"Length", butx+75,buty,75,19,&pset->brushtype,14, PE_BRUSH_LENGTH,0,0,"Make hairs longer or shorter");
- uiDefButS(block,ROW,B_BAKE_REDRAWEDIT,"Puff", butx+150,buty,75,19,&pset->brushtype,14, PE_BRUSH_PUFF,0,0,"Make hairs stand up");
- uiDefButS(block,ROW,B_BAKE_REDRAWEDIT,"Cut", butx+225,buty,75,19,&pset->brushtype,14, PE_BRUSH_CUT,0,0,"Cut hairs");
- uiBlockEndAlign(block);
-
- buty-= 10;
- lastbuty= buty;
-
- /* brush options */
- if(pset->brushtype>=0) {
- ParticleBrushData *brush= &pset->brush[pset->brushtype];
-
- butw= 180;
-
- uiBlockBeginAlign(block);
- uiDefButS(block, NUMSLI, B_BAKE_REDRAWEDIT, "Size:", butx,(buty-=buth),butw,buth, &brush->size, 1.0, 100.0, 1, 1, "Brush size");
- uiDefButS(block, NUMSLI, B_BAKE_REDRAWEDIT, "Strength:", butx,(buty-=buth),butw,buth, &brush->strength, 1.0, 100.0, 1, 1, "Brush strength");
-
- if(ELEM(pset->brushtype, PE_BRUSH_LENGTH, PE_BRUSH_PUFF)) {
- char *str1, *str2, *tip1, *tip2;
-
- if(pset->brushtype == PE_BRUSH_LENGTH) {
- str1= "Grow"; tip1= "Make hairs longer [Shift]";
- str2= "Shrink"; tip2= "Make hairs shorter [Shift]";
- }
- else /*if(pset->brushtype == PE_BRUSH_PUFF)*/ {
- str1= "Add"; tip1= "Make hair more puffy [Shift]";
- str2= "Sub"; tip2= "Make hair less puffy [Shift]";
- }
-
- uiDefButS(block,ROW,B_NOP,str1, butx,(buty-=buth),butw/2,buth,&brush->invert,0.0,0.0,0, 0,tip1);
- uiDefButS(block,ROW,B_NOP,str2, butx+butw/2,buty,butw/2,buth,&brush->invert,0.0,1.0,0, 0,tip2);
- }
- uiBlockEndAlign(block);
-
- butx += butw+10;
- buty= lastbuty;
- butw= 110;
-
- if(pset->brushtype==PE_BRUSH_ADD) {
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, PE_INTERPOLATE_ADDED, B_BAKE_REDRAWEDIT, "Interpolate", butx,(buty-=buth),butw,buth, &pset->flag, 0, 0, 0, 0, "Interpolate new particles from the existing ones");
- uiDefButS(block, NUMSLI, B_BAKE_REDRAWEDIT, "Step:", butx,(buty-=buth),butw,buth, &brush->step, 1.0, 50.0, 1, 1, "Brush step");
- uiDefButS(block, NUMSLI, B_BAKE_REDRAWEDIT, "Keys:", butx,(buty-=buth),butw,buth, &pset->totaddkey, 2.0, 20.0, 1, 1, "How many keys to make new particles with");
- uiBlockEndAlign(block);
- }
- }
-
- /* keep options */
- butw= 150;
- butx= 10;
- buty= lastbuty - (buth*3 + 10);
- lastbuty= buty;
-
- uiDefBut(block, LABEL, 0, "Keep", butx,(buty-=buth),butw,buth, NULL, 0.0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, PE_KEEP_LENGTHS, B_BAKE_REDRAWEDIT, "Lengths", butx,(buty-=buth),butw/2,buth, &pset->flag, 0, 0, 0, 0, "Keep path lengths constant");
- uiDefButBitS(block, TOG, PE_LOCK_FIRST, B_BAKE_REDRAWEDIT, "Root", butx+butw/2,buty,butw/2,buth, &pset->flag, 0, 0, 0, 0, "Keep first keys unmodified");
- uiBlockEndAlign(block);
-
- buty -= 5;
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, PE_DEFLECT_EMITTER, B_BAKE_REDRAWEDIT, "Deflect Emitter", butx,(buty-=buth),butw,buth, &pset->flag, 0, 0, 0, 0, "Keep paths from intersecting the emitter");
- uiDefButF(block, NUM, B_BAKE_REDRAWEDIT, "Dist:", butx,(buty-=buth),butw,buth, &pset->emitterdist, 0.0, 10.0, 1, 1, "Distance from emitter");
- uiBlockEndAlign(block);
-
- buty= lastbuty;
- butx += butw+10;
- butw -= 10;
-
- uiDefBut(block, LABEL, 0, "Draw", butx,(buty-=buth),butw,buth, NULL, 0.0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButS(block, NUMSLI, B_BAKE_RECACHE, "Steps:", butx,(buty-=buth),butw,buth, &psys->part->draw_step, 0.0, 10.0, 1, 1, "Drawing accuracy of paths");
- uiBlockEndAlign(block);
-
- buty -= 5;
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, PE_SHOW_TIME, B_BAKE_REDRAWEDIT, "Show Time", butx,(buty-=buth),butw,buth, &pset->flag, 0, 0, 0, 0, "Show time values of the baked keys");
- uiDefButBitS(block, TOG, PE_SHOW_CHILD, B_BAKE_RECACHE, "Show Children", butx,(buty-=buth),butw,buth, &pset->flag, 0, 0, 0, 0, "Show child particles in particle mode");
- uiBlockEndAlign(block);
- }
- else{
- uiDefBut(block, LABEL, 0, "System isn't editable", butx,(buty-=buth),250,buth, NULL, 0.0, 0, 0, 0, "");
- }
-}
-/* this is a mode context sensitive system */
-
-void editing_panels()
-{
- Object *ob;
- Curve *cu;
- MetaBall *mb;
- Lattice *lt;
- bArmature *arm;
- Camera *cam;
-
- ob= OBACT;
- if(ob==NULL) return;
- uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
-
- switch(ob->type) {
- case OB_MESH:
- editing_panel_links(ob);
- editing_panel_mesh_type(ob, ob->data);
- editing_panel_modifiers(ob);
- editing_panel_shapes(ob);
- editing_panel_mesh_multires();
- /* modes */
- if(G.obedit) {
- editing_panel_mesh_tools(ob, ob->data);
- editing_panel_mesh_tools1(ob, ob->data);
- uiNewPanelTabbed("Mesh Tools 1", "Editing");
- editing_panel_mesh_skgen(ob, ob->data);
- editing_panel_mesh_uvautocalculation();
- if (EM_texFaceCheck())
- editing_panel_mesh_texface();
- }
- else if(G.f & G_SCULPTMODE) {
- uiNewPanelTabbed("Multires", "Editing");
- editing_panel_sculpting_tools();
- uiNewPanelTabbed("Multires", "Editing");
- editing_panel_sculpting_brush();
- uiNewPanelTabbed("Multires", "Editing");
- editing_panel_sculpting_textures();
- } else {
- if(G.f & (G_VERTEXPAINT | G_TEXTUREPAINT | G_WEIGHTPAINT) ) {
- editing_panel_mesh_paint();
- }
- }
- break;
-
- case OB_CURVE:
- case OB_SURF:
- cu= ob->data;
- editing_panel_links(ob);
- editing_panel_curve_type(ob, cu);
- editing_panel_modifiers(ob);
-// editing_panel_shapes(ob);
- if(G.obedit) {
- editing_panel_curve_tools(ob, cu);
- editing_panel_curve_tools1(ob, cu);
- }
- break;
-
- case OB_MBALL:
- mb= ob->data;
- editing_panel_links(ob);
- editing_panel_mball_type(ob, mb);
- if(G.obedit) {
- editing_panel_mball_tools(ob, mb);
- }
- break;
-
- case OB_FONT:
- cu= ob->data;
- editing_panel_links(ob);
- editing_panel_curve_type(ob, cu);
- editing_panel_font_type(ob, cu);
-
-#ifdef INTERNATIONAL
- if(G.obedit)
- {
- editing_panel_char_type(ob, cu);
- }
-#endif
- editing_panel_modifiers(ob);
- break;
-
- case OB_LATTICE:
- lt= ob->data;
- editing_panel_links(ob);
- editing_panel_lattice_type(ob, lt);
- editing_panel_modifiers(ob);
- editing_panel_shapes(ob);
- break;
-
- case OB_LAMP:
- editing_panel_links(ob);
- break;
-
- case OB_EMPTY:
- editing_panel_links(ob);
- break;
-
- case OB_CAMERA:
- cam= ob->data;
- editing_panel_links(ob); // no editmode!
- editing_panel_camera_type(ob, cam);
- /* yafray: extra panel for dof parameters */
- if (G.scene->r.renderer==R_YAFRAY) editing_panel_camera_yafraydof(ob, cam);
- break;
-
- case OB_ARMATURE:
- arm= ob->data;
- editing_panel_links(ob); // no editmode!
- editing_panel_armature_type(ob, arm);
- if(G.obedit) {
- editing_panel_armature_bones(ob, arm);
- }
- else if(ob->flag & OB_POSEMODE) {
- editing_panel_armature_visuals(ob, arm);
- editing_panel_pose_bones(ob, arm);
- object_panel_constraint("Editing");
- }
- break;
- }
- uiClearButLock();
-}
diff --git a/source/blender/src/buttons_logic.c b/source/blender/src/buttons_logic.c
deleted file mode 100644
index 77922f041d8..00000000000
--- a/source/blender/src/buttons_logic.c
+++ /dev/null
@@ -1,2814 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <math.h>
-#include <string.h>
-
-#ifndef WIN32
-#include <unistd.h>
-#else
-#include <io.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "DNA_action_types.h"
-#include "DNA_material_types.h"
-#include "DNA_sensor_types.h"
-#include "DNA_actuator_types.h"
-#include "DNA_controller_types.h"
-#include "DNA_property_types.h"
-#include "DNA_object_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_sound_types.h"
-#include "DNA_text_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_world_types.h"
-
-#include "BKE_library.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_sca.h"
-#include "BKE_property.h"
-
-#include "BIF_gl.h"
-#include "BIF_resources.h"
-#include "BIF_space.h"
-#include "BIF_interface.h"
-#include "BIF_butspace.h"
-#include "BIF_screen.h"
-#include "BIF_keyval.h"
-#include "BIF_editsound.h"
-
-#include "BIF_editsca.h"
-
-
-#include "BDR_editcurve.h"
-#include "BDR_editobject.h"
-#include "BSE_headerbuttons.h"
-#include "BSE_filesel.h"
-
-#include "blendef.h"
-#include "mydevice.h"
-#include "nla.h" /* For __NLA : Important, do not remove */
-#include "butspace.h" // own module
-
-/* internals */
-void buttons_enji(uiBlock *, Object *);
-void buttons_ketsji(uiBlock *, Object *);
-void buttons_bullet(uiBlock *, Object *);
-
-/****/
-
-static ID **get_selected_and_linked_obs(short *count, short scavisflag);
-static char *actuator_pup(Object *owner);
-
-/****/
-
-
-static void del_property(void *selpropv, void *data2_unused)
-{
- bProperty *prop, *selprop= selpropv;
- Object *ob;
- int a=0;
-
- ob= OBACT;
- if(ob==NULL) return;
-
- prop= ob->prop.first;
- while(prop) {
- if(prop==selprop) {
- if (strcmp(prop->name,"Text") == 0) {
- allqueue(REDRAWVIEW3D, 0);
- }
- BLI_remlink(&ob->prop, prop);
- free_property(prop);
- break;
- }
- a++;
- prop= prop->next;
- }
- BIF_undo_push("Delete property");
- allqueue(REDRAWBUTSLOGIC, 0);
-
-}
-
-static int vergname(const void *v1, const void *v2)
-{
- char **x1, **x2;
-
- x1= (char **)v1;
- x2= (char **)v2;
-
- return strcmp(*x1, *x2);
-}
-
-void make_unique_prop_names(char *str)
-{
- Object *ob;
- bProperty *prop;
- bSensor *sens;
- bController *cont;
- bActuator *act;
- ID **idar;
- short a, obcount, propcount=0, nr;
- char **names;
-
- /* this function is called by a Button, and gives the current
- * stringpointer as an argument, this is the one that can change
- */
-
- idar= get_selected_and_linked_obs(&obcount, BUTS_SENS_SEL|BUTS_SENS_ACT|BUTS_ACT_SEL|BUTS_ACT_ACT|BUTS_CONT_SEL|BUTS_CONT_ACT);
-
- /* for each object, make properties and sca names unique */
-
- /* count total names */
- for(a=0; a<obcount; a++) {
- ob= (Object *)idar[a];
- propcount+= BLI_countlist(&ob->prop);
- propcount+= BLI_countlist(&ob->sensors);
- propcount+= BLI_countlist(&ob->controllers);
- propcount+= BLI_countlist(&ob->actuators);
- }
- if(propcount==0) {
- if(idar) MEM_freeN(idar);
- return;
- }
-
- /* make names array for sorting */
- names= MEM_callocN(propcount*sizeof(void *), "names");
-
- /* count total names */
- nr= 0;
- for(a=0; a<obcount; a++) {
- ob= (Object *)idar[a];
- prop= ob->prop.first;
- while(prop) {
- names[nr++]= prop->name;
- prop= prop->next;
- }
- sens= ob->sensors.first;
- while(sens) {
- names[nr++]= sens->name;
- sens= sens->next;
- }
- cont= ob->controllers.first;
- while(cont) {
- names[nr++]= cont->name;
- cont= cont->next;
- }
- act= ob->actuators.first;
- while(act) {
- names[nr++]= act->name;
- act= act->next;
- }
- }
-
- qsort(names, propcount, sizeof(void *), vergname);
-
- /* now we check for double names, and change them */
-
- for(nr=0; nr<propcount; nr++) {
- if(names[nr]!=str && strcmp( names[nr], str )==0 ) {
- BLI_newname(str, +1);
- }
- }
-
- MEM_freeN(idar);
- MEM_freeN(names);
-}
-
-static void make_unique_prop_names_cb(void *strv, void *redraw_view3d_flagv)
-{
- char *str= strv;
- int redraw_view3d_flag= (int) redraw_view3d_flagv;
-
- make_unique_prop_names(str);
- if (redraw_view3d_flag) allqueue(REDRAWVIEW3D, 0);
-}
-
-static void sca_move_sensor(void *datav, void *data2_unused)
-{
- bSensor *sens_to_delete= datav;
- int val;
- Base *base;
- bSensor *sens;
-
- val= pupmenu("Move up%x1|Move down %x2");
-
- if(val>0) {
- /* now find out which object has this ... */
- base= FIRSTBASE;
- while(base) {
-
- sens= base->object->sensors.first;
- while(sens) {
- if(sens == sens_to_delete) break;
- sens= sens->next;
- }
-
- if(sens) {
- if( val==1 && sens->prev) {
- BLI_remlink(&base->object->sensors, sens);
- BLI_insertlinkbefore(&base->object->sensors, sens->prev, sens);
- }
- else if( val==2 && sens->next) {
- BLI_remlink(&base->object->sensors, sens);
- BLI_insertlink(&base->object->sensors, sens->next, sens);
- }
- BIF_undo_push("Move sensor");
- allqueue(REDRAWBUTSLOGIC, 0);
- break;
- }
-
- base= base->next;
- }
- }
-}
-
-static void sca_move_controller(void *datav, void *data2_unused)
-{
- bController *controller_to_del= datav;
- int val;
- Base *base;
- bController *cont;
-
- val= pupmenu("Move up%x1|Move down %x2");
-
- if(val>0) {
- /* now find out which object has this ... */
- base= FIRSTBASE;
- while(base) {
-
- cont= base->object->controllers.first;
- while(cont) {
- if(cont == controller_to_del) break;
- cont= cont->next;
- }
-
- if(cont) {
- if( val==1 && cont->prev) {
- BLI_remlink(&base->object->controllers, cont);
- BLI_insertlinkbefore(&base->object->controllers, cont->prev, cont);
- }
- else if( val==2 && cont->next) {
- BLI_remlink(&base->object->controllers, cont);
- BLI_insertlink(&base->object->controllers, cont->next, cont);
- }
- BIF_undo_push("Move controller");
- allqueue(REDRAWBUTSLOGIC, 0);
- break;
- }
-
- base= base->next;
- }
- }
-}
-
-static void sca_move_actuator(void *datav, void *data2_unused)
-{
- bActuator *actuator_to_move= datav;
- int val;
- Base *base;
- bActuator *act;
-
- val= pupmenu("Move up%x1|Move down %x2");
-
- if(val>0) {
- /* now find out which object has this ... */
- base= FIRSTBASE;
- while(base) {
-
- act= base->object->actuators.first;
- while(act) {
- if(act == actuator_to_move) break;
- act= act->next;
- }
-
- if(act) {
- if( val==1 && act->prev) {
- BLI_remlink(&base->object->actuators, act);
- BLI_insertlinkbefore(&base->object->actuators, act->prev, act);
- }
- else if( val==2 && act->next) {
- BLI_remlink(&base->object->actuators, act);
- BLI_insertlink(&base->object->actuators, act->next, act);
- }
- BIF_undo_push("Move actuator");
- allqueue(REDRAWBUTSLOGIC, 0);
- break;
- }
-
- base= base->next;
- }
- }
-}
-
-void do_logic_buts(unsigned short event)
-{
- bProperty *prop;
- bSensor *sens;
- bController *cont;
- bActuator *act;
- Base *base;
- Object *ob;
- int didit;
-
- ob= OBACT;
- if(ob==0) return;
-
- switch(event) {
-
- case B_SETSECTOR:
- /* check for inconsistant types */
- ob->gameflag &= ~(OB_PROP|OB_MAINACTOR|OB_DYNAMIC|OB_ACTOR);
- ob->dtx |= OB_BOUNDBOX;
- allqueue(REDRAWBUTSGAME, 0);
- allqueue(REDRAWVIEW3D, 0);
- break;
-
- case B_SETPROP:
- /* check for inconsistant types */
- ob->gameflag &= ~(OB_SECTOR|OB_MAINACTOR|OB_DYNAMIC|OB_ACTOR);
- allqueue(REDRAWBUTSGAME, 0);
- allqueue(REDRAWVIEW3D, 0);
- break;
-
- case B_SETACTOR:
- case B_SETDYNA:
- case B_SETMAINACTOR:
- ob->gameflag &= ~(OB_SECTOR|OB_PROP);
- allqueue(REDRAWBUTSGAME, 0);
- allqueue(REDRAWVIEW3D, 0);
- break;
-
-
- case B_ADD_PROP:
- prop= new_property(PROP_FLOAT);
- make_unique_prop_names(prop->name);
- BLI_addtail(&ob->prop, prop);
- BIF_undo_push("Add property");
- allqueue(REDRAWBUTSLOGIC, 0);
- break;
-
- case B_CHANGE_PROP:
- prop= ob->prop.first;
- while(prop) {
- if(prop->type!=prop->otype) {
- init_property(prop);
- if (strcmp(prop->name, "Text") == 0) {
- allqueue(REDRAWVIEW3D, 0);
- }
- }
- prop= prop->next;
- }
- allqueue(REDRAWBUTSLOGIC, 0);
- break;
-
- case B_ADD_SENS:
- base= FIRSTBASE;
- while(base) {
- if(base->object->scaflag & OB_ADDSENS) {
- base->object->scaflag &= ~OB_ADDSENS;
- sens= new_sensor(SENS_ALWAYS);
- BLI_addtail(&(base->object->sensors), sens);
- make_unique_prop_names(sens->name);
- base->object->scaflag |= OB_SHOWSENS;
- }
- base= base->next;
- }
-
- BIF_undo_push("Add sensor");
- allqueue(REDRAWBUTSLOGIC, 0);
- break;
-
- case B_CHANGE_SENS:
- base= FIRSTBASE;
- while(base) {
- sens= base->object->sensors.first;
- while(sens) {
- if(sens->type != sens->otype) {
- init_sensor(sens);
- sens->otype= sens->type;
- break;
- }
- sens= sens->next;
- }
- base= base->next;
- }
- allqueue(REDRAWBUTSLOGIC, 0);
- break;
-
- case B_DEL_SENS:
- base= FIRSTBASE;
- while(base) {
- sens= base->object->sensors.first;
- while(sens) {
- if(sens->flag & SENS_DEL) {
- BLI_remlink(&(base->object->sensors), sens);
- free_sensor(sens);
- break;
- }
- sens= sens->next;
- }
- base= base->next;
- }
- BIF_undo_push("Delete sensor");
- allqueue(REDRAWBUTSLOGIC, 0);
- break;
-
- case B_ADD_CONT:
- base= FIRSTBASE;
- while(base) {
- if(base->object->scaflag & OB_ADDCONT) {
- base->object->scaflag &= ~OB_ADDCONT;
- cont= new_controller(CONT_LOGIC_AND);
- make_unique_prop_names(cont->name);
- base->object->scaflag |= OB_SHOWCONT;
- BLI_addtail(&(base->object->controllers), cont);
- }
- base= base->next;
- }
- BIF_undo_push("Add controller");
- allqueue(REDRAWBUTSLOGIC, 0);
- break;
-
- case B_CHANGE_CONT:
- base= FIRSTBASE;
- while(base) {
- cont= base->object->controllers.first;
- while(cont) {
- if(cont->type != cont->otype) {
- init_controller(cont);
- cont->otype= cont->type;
- break;
- }
- cont= cont->next;
- }
- base= base->next;
- }
- allqueue(REDRAWBUTSLOGIC, 0);
- break;
-
-
- case B_DEL_CONT:
- base= FIRSTBASE;
- while(base) {
- cont= base->object->controllers.first;
- while(cont) {
- if(cont->flag & CONT_DEL) {
- BLI_remlink(&(base->object->controllers), cont);
- unlink_controller(cont);
- free_controller(cont);
- break;
- }
- cont= cont->next;
- }
- base= base->next;
- }
- BIF_undo_push("Delete controller");
- allqueue(REDRAWBUTSLOGIC, 0);
- break;
-
- case B_ADD_ACT:
- base= FIRSTBASE;
- while(base) {
- if(base->object->scaflag & OB_ADDACT) {
- base->object->scaflag &= ~OB_ADDACT;
- act= new_actuator(ACT_OBJECT);
- make_unique_prop_names(act->name);
- BLI_addtail(&(base->object->actuators), act);
- base->object->scaflag |= OB_SHOWACT;
- }
- base= base->next;
- }
- BIF_undo_push("Add actuator");
- allqueue(REDRAWBUTSLOGIC, 0);
- break;
-
- case B_CHANGE_ACT:
- base= FIRSTBASE;
- while(base) {
- act= base->object->actuators.first;
- while(act) {
- if(act->type != act->otype) {
- init_actuator(act);
- act->otype= act->type;
- break;
- }
- act= act->next;
- }
- base= base->next;
- }
- allqueue(REDRAWBUTSLOGIC, 0);
- break;
-
- case B_DEL_ACT:
- base= FIRSTBASE;
- while(base) {
- act= base->object->actuators.first;
- while(act) {
- if(act->flag & ACT_DEL) {
- BLI_remlink(&(base->object->actuators), act);
- unlink_actuator(act);
- free_actuator(act);
- break;
- }
- act= act->next;
- }
- base= base->next;
- }
- BIF_undo_push("Delete actuator");
- allqueue(REDRAWBUTSLOGIC, 0);
- break;
-
- case B_SOUNDACT_BROWSE:
- /* since we don't know which... */
- didit= 0;
- base= FIRSTBASE;
- while(base)
- {
- act= base->object->actuators.first;
- while(act)
- {
- if(act->type==ACT_SOUND)
- {
- bSoundActuator *sa= act->data;
- if(sa->sndnr)
- {
- bSound *sound= G.main->sound.first;
- int nr= 1;
-
- if(sa->sndnr == -2) {
- activate_databrowse((ID *)G.main->sound.first, ID_SO, 0, B_SOUNDACT_BROWSE,
- &sa->sndnr, do_logic_buts);
- break;
- }
-
- while(sound)
- {
- if(nr==sa->sndnr)
- break;
- nr++;
- sound= sound->id.next;
- }
-
- if(sa->sound)
- sa->sound->id.us--;
-
- sa->sound= sound;
-
- if(sound)
- sound->id.us++;
-
- sa->sndnr= 0;
- didit= 1;
- }
- }
- act= act->next;
- }
- if(didit)
- break;
- base= base->next;
- }
- allqueue(REDRAWBUTSLOGIC, 0);
- allqueue(REDRAWSOUND, 0);
-
- break;
- }
-}
-
-
-static char *sensor_name(int type)
-{
- switch (type) {
- case SENS_ALWAYS:
- return "Always";
- case SENS_TOUCH:
- return "Touch";
- case SENS_NEAR:
- return "Near";
- case SENS_KEYBOARD:
- return "Keyboard";
- case SENS_PROPERTY:
- return "Property";
- case SENS_MOUSE:
- return "Mouse";
- case SENS_COLLISION:
- return "Collision";
- case SENS_RADAR:
- return "Radar";
- case SENS_RANDOM:
- return "Random";
- case SENS_RAY:
- return "Ray";
- case SENS_MESSAGE:
- return "Message";
- case SENS_JOYSTICK:
- return "Joystick";
- }
- return "unknown";
-}
-
-static char *sensor_pup(void)
-{
- /* the number needs to match defines in game.h */
- return "Sensors %t|Always %x0|Keyboard %x3|Mouse %x5|"
- "Touch %x1|Collision %x6|Near %x2|Radar %x7|"
- "Property %x4|Random %x8|Ray %x9|Message %x10|Joystick %x11";
-}
-
-static char *controller_name(int type)
-{
- switch (type) {
- case CONT_LOGIC_AND:
- return "AND";
- case CONT_LOGIC_OR:
- return "OR";
- case CONT_EXPRESSION:
- return "Expression";
- case CONT_PYTHON:
- return "Python";
- }
- return "unknown";
-}
-
-static char *controller_pup(void)
-{
- return "Controllers %t|AND %x0|OR %x1|Expression %x2|Python %x3";
-}
-
-static char *actuator_name(int type)
-{
- switch (type) {
- case ACT_ACTION:
- return "Action";
- case ACT_OBJECT:
- return "Motion";
- case ACT_IPO:
- return "Ipo";
- case ACT_LAMP:
- return "Lamp";
- case ACT_CAMERA:
- return "Camera";
- case ACT_MATERIAL:
- return "Material";
- case ACT_SOUND:
- return "Sound";
- case ACT_CD:
- return "CD";
- case ACT_PROPERTY:
- return "Property";
- case ACT_EDIT_OBJECT:
- return "Edit Object";
- case ACT_CONSTRAINT:
- return "Constraint";
- case ACT_SCENE:
- return "Scene";
- case ACT_GROUP:
- return "Group";
- case ACT_RANDOM:
- return "Random";
- case ACT_MESSAGE:
- return "Message";
- case ACT_GAME:
- return "Game";
- case ACT_VISIBILITY:
- return "Visibility";
- }
- return "unknown";
-}
-
-
-
-
-static char *actuator_pup(Object *owner)
-{
- switch (owner->type)
- {
- case OB_ARMATURE:
- return "Actuators %t|Action %x15|Motion %x0|Constraint %x9|Ipo %x1"
- "|Camera %x3|Sound %x5|Property %x6|Edit Object %x10"
- "|Scene %x11|Random %x13|Message %x14|CD %x16|Game %x17"
- "|Visibility %x18";
- break;
- default:
- return "Actuators %t|Motion %x0|Constraint %x9|Ipo %x1"
- "|Camera %x3|Sound %x5|Property %x6|Edit Object %x10"
- "|Scene %x11|Random %x13|Message %x14|CD %x16|Game %x17"
- "|Visibility %x18";
- }
-}
-
-
-
-static void set_sca_ob(Object *ob)
-{
- bController *cont;
- bActuator *act;
-
- cont= ob->controllers.first;
- while(cont) {
- cont->mynew= (bController *)ob;
- cont= cont->next;
- }
- act= ob->actuators.first;
- while(act) {
- act->mynew= (bActuator *)ob;
- act= act->next;
- }
-}
-
-static ID **get_selected_and_linked_obs(short *count, short scavisflag)
-{
- Base *base;
- Object *ob, *obt;
- ID **idar;
- bSensor *sens;
- bController *cont;
- unsigned int lay;
- int a, nr, doit;
-
- /* we need a sorted object list */
- /* set scavisflags flags in Objects to indicate these should be evaluated */
- /* also hide ob pointers in ->new entries of controllerss/actuators */
-
- *count= 0;
-
- if(G.scene==NULL) return NULL;
-
- ob= G.main->object.first;
- while(ob) {
- ob->scavisflag= 0;
- set_sca_ob(ob);
- ob= ob->id.next;
- }
-
- if(G.vd) lay= G.vd->lay;
- else lay= G.scene->lay;
-
- base= FIRSTBASE;
- while(base) {
- if(base->lay & lay) {
- if(base->flag & SELECT) {
- if(scavisflag & BUTS_SENS_SEL) base->object->scavisflag |= OB_VIS_SENS;
- if(scavisflag & BUTS_CONT_SEL) base->object->scavisflag |= OB_VIS_CONT;
- if(scavisflag & BUTS_ACT_SEL) base->object->scavisflag |= OB_VIS_ACT;
- }
- }
- base= base->next;
- }
-
- if(OBACT) {
- if(scavisflag & BUTS_SENS_ACT) OBACT->scavisflag |= OB_VIS_SENS;
- if(scavisflag & BUTS_CONT_ACT) OBACT->scavisflag |= OB_VIS_CONT;
- if(scavisflag & BUTS_ACT_ACT) OBACT->scavisflag |= OB_VIS_ACT;
- }
-
- if(scavisflag & (BUTS_SENS_LINK|BUTS_CONT_LINK|BUTS_ACT_LINK)) {
- doit= 1;
- while(doit) {
- doit= 0;
-
- ob= G.main->object.first;
- while(ob) {
-
- /* 1st case: select sensor when controller selected */
- if((scavisflag & BUTS_SENS_LINK) && (ob->scavisflag & OB_VIS_SENS)==0) {
- sens= ob->sensors.first;
- while(sens) {
- for(a=0; a<sens->totlinks; a++) {
- if(sens->links[a]) {
- obt= (Object *)sens->links[a]->mynew;
- if(obt && (obt->scavisflag & OB_VIS_CONT)) {
- doit= 1;
- ob->scavisflag |= OB_VIS_SENS;
- break;
- }
- }
- }
- if(doit) break;
- sens= sens->next;
- }
- }
-
- /* 2nd case: select cont when act selected */
- if((scavisflag & BUTS_CONT_LINK) && (ob->scavisflag & OB_VIS_CONT)==0) {
- cont= ob->controllers.first;
- while(cont) {
- for(a=0; a<cont->totlinks; a++) {
- if(cont->links[a]) {
- obt= (Object *)cont->links[a]->mynew;
- if(obt && (obt->scavisflag & OB_VIS_ACT)) {
- doit= 1;
- ob->scavisflag |= OB_VIS_CONT;
- break;
- }
- }
- }
- if(doit) break;
- cont= cont->next;
- }
- }
-
- /* 3rd case: select controller when sensor selected */
- if((scavisflag & BUTS_CONT_LINK) && (ob->scavisflag & OB_VIS_SENS)) {
- sens= ob->sensors.first;
- while(sens) {
- for(a=0; a<sens->totlinks; a++) {
- if(sens->links[a]) {
- obt= (Object *)sens->links[a]->mynew;
- if(obt && (obt->scavisflag & OB_VIS_CONT)==0) {
- doit= 1;
- obt->scavisflag |= OB_VIS_CONT;
- }
- }
- }
- sens= sens->next;
- }
- }
-
- /* 4th case: select actuator when controller selected */
- if( (scavisflag & BUTS_ACT_LINK) && (ob->scavisflag & OB_VIS_CONT)) {
- cont= ob->controllers.first;
- while(cont) {
- for(a=0; a<cont->totlinks; a++) {
- if(cont->links[a]) {
- obt= (Object *)cont->links[a]->mynew;
- if(obt && (obt->scavisflag & OB_VIS_ACT)==0) {
- doit= 1;
- obt->scavisflag |= OB_VIS_ACT;
- }
- }
- }
- cont= cont->next;
- }
-
- }
- ob= ob->id.next;
- }
- }
- }
-
- /* now we count */
- ob= G.main->object.first;
- while(ob) {
- if( ob->scavisflag ) (*count)++;
- ob= ob->id.next;
- }
-
- if(*count==0) return NULL;
- if(*count>24) *count= 24; /* temporal */
-
- idar= MEM_callocN( (*count)*sizeof(void *), "idar");
-
- ob= G.main->object.first;
- nr= 0;
- while(ob) {
- if( ob->scavisflag ) {
- idar[nr]= (ID *)ob;
- nr++;
- }
- if(nr>=24) break;
- ob= ob->id.next;
- }
-
- /* just to be sure... these were set in set_sca_done_ob() */
- clear_sca_new_poins();
-
- return idar;
-}
-
-
-static int get_col_sensor(int type)
-{
- switch(type) {
- case SENS_ALWAYS: return TH_BUT_ACTION;
- case SENS_TOUCH: return TH_BUT_NEUTRAL;
- case SENS_COLLISION: return TH_BUT_SETTING;
- case SENS_NEAR: return TH_BUT_SETTING1;
- case SENS_KEYBOARD: return TH_BUT_SETTING2;
- case SENS_PROPERTY: return TH_BUT_NUM;
- case SENS_MOUSE: return TH_BUT_TEXTFIELD;
- case SENS_RADAR: return TH_BUT_POPUP;
- case SENS_RANDOM: return TH_BUT_NEUTRAL;
- case SENS_RAY: return TH_BUT_SETTING1;
- case SENS_MESSAGE: return TH_BUT_SETTING2;
- case SENS_JOYSTICK: return TH_BUT_NEUTRAL;
- default: return TH_BUT_NEUTRAL;
- }
-}
-static void set_col_sensor(int type, int medium)
-{
- int col= get_col_sensor(type);
- BIF_ThemeColorShade(col, medium?30:0);
-}
-
-/**
- * Draws a toggle for pulse mode, a frequency field and a toggle to invert
- * the value of this sensor. Operates on the shared data block of sensors.
- */
-static void draw_default_sensor_header(bSensor *sens,
- uiBlock *block,
- short x,
- short y,
- short w)
-{
- /* Pulsing and frequency */
- uiDefIconButBitS(block, TOG, SENS_PULSE_REPEAT, 1, ICON_DOTSUP,
- (short)(x + 10 + 0. * (w-20)), (short)(y - 19), (short)(0.15 * (w-20)), 19,
- &sens->pulse, 0.0, 0.0, 0, 0,
- "Activate TRUE level triggering (pulse mode)");
-
- uiDefIconButBitS(block, TOG, SENS_NEG_PULSE_MODE, 1, ICON_DOTSDOWN,
- (short)(x + 10 + 0.15 * (w-20)), (short)(y - 19), (short)(0.15 * (w-20)), 19,
- &sens->pulse, 0.0, 0.0, 0, 0,
- "Activate FALSE level triggering (pulse mode)");
- uiDefButS(block, NUM, 1, "f:",
- (short)(x + 10 + 0.3 * (w-20)), (short)(y - 19), (short)(0.275 * (w-20)), 19,
- &sens->freq, 0.0, 10000.0, 0, 0,
- "Delay between repeated pulses (in logic tics, 0 = no delay)");
-
- /* value or shift? */
- uiDefButS(block, TOG, 1, "Inv",
- (short)(x + 10 + 0.85 * (w-20)), (short)(y - 19), (short)(0.15 * (w-20)), 19,
- &sens->invert, 0.0, 0.0, 0, 0,
- "Invert the level (output) of this sensor");
-}
-
-static short draw_sensorbuttons(bSensor *sens, uiBlock *block, short xco, short yco, short width,char* objectname)
-{
- bNearSensor *ns = NULL;
- bTouchSensor *ts = NULL;
- bKeyboardSensor *ks = NULL;
- bPropertySensor *ps = NULL;
- bMouseSensor *ms = NULL;
- bCollisionSensor *cs = NULL;
- bRadarSensor *rs = NULL;
- bRandomSensor *randomSensor = NULL;
- bRaySensor *raySens = NULL;
- bMessageSensor *mes = NULL;
- bJoystickSensor *joy = NULL;
-
- short ysize;
- char *str;
-
- /* yco is at the top of the rect, draw downwards */
-
- uiBlockSetEmboss(block, UI_EMBOSSM);
-
- set_col_sensor(sens->type, 0);
-
- switch (sens->type)
- {
- case SENS_ALWAYS:
- {
- ysize= 24;
-
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- draw_default_sensor_header(sens, block, xco, yco, width);
-
- yco-= ysize;
-
- break;
- }
- case SENS_TOUCH:
- {
- ysize= 48;
-
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- draw_default_sensor_header(sens, block, xco, yco, width);
-
- ts= sens->data;
-
- /* uiDefBut(block, TEX, 1, "Property:", xco,yco-22,width, 19, &ts->name, 0, 31, 0, 0, "Only look for Objects with this property"); */
- uiDefIDPoinBut(block, test_matpoin_but, ID_MA, 1, "MA:",(short)(xco + 10),(short)(yco-44), (short)(width - 20), 19, &ts->ma, "Only look for floors with this Material");
- ///* uiDefButF(block, NUM, 1, "Margin:", xco+width/2,yco-44,width/2, 19, &ts->dist, 0.0, 10.0, 100, 0, "Extra margin (distance) for larger sensitivity");
- yco-= ysize;
- break;
- }
- case SENS_COLLISION:
- {
- ysize= 48;
-
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- draw_default_sensor_header(sens, block, xco, yco, width);
- cs= sens->data;
-
- /* The collision sensor will become a generic collision (i.e. it */
- /* absorb the old touch sensor). */
-
- uiDefButBitS(block, TOG, SENS_COLLISION_MATERIAL, B_REDR, "M/P",(short)(xco + 10),(short)(yco - 44),
- (short)(0.20 * (width-20)), 19, &cs->mode, 0.0, 0.0, 0, 0,
- "Toggle collision on material or property.");
-
- if (cs->mode & SENS_COLLISION_MATERIAL) {
- uiDefBut(block, TEX, 1, "Material:", (short)(xco + 10 + 0.20 * (width-20)),
- (short)(yco-44), (short)(0.8*(width-20)), 19, &cs->materialName, 0, 31, 0, 0,
- "Only look for Objects with this material");
- } else {
- uiDefBut(block, TEX, 1, "Property:", (short)(xco + 10 + 0.20 * (width-20)), (short)(yco-44),
- (short)(0.8*(width-20)), 19, &cs->name, 0, 31, 0, 0,
- "Only look for Objects with this property");
- }
-
- /* uiDefButS(block, NUM, 1, "Damp:", xco+10+width-90,yco-24, 70, 19, &cs->damp, 0, 250, 0, 0, "For 'damp' time don't detect another collision"); */
-
- yco-= ysize;
- break;
- }
- case SENS_NEAR:
- {
- ysize= 72;
-
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- draw_default_sensor_header(sens, block, xco, yco, width);
- ns= sens->data;
-
- uiDefBut(block, TEX, 1, "Property:",(short)(10+xco),(short)(yco-44), (short)(width-20), 19,
- &ns->name, 0, 31, 0, 0, "Only look for Objects with this property");
- uiDefButF(block, NUM, 1, "Dist",(short)(10+xco),(short)(yco-68),(short)((width-22)/2), 19,
- &ns->dist, 0.0, 1000.0, 1000, 0, "Trigger distance");
- uiDefButF(block, NUM, 1, "Reset",(short)(10+xco+(width-22)/2), (short)(yco-68), (short)((width-22)/2), 19,
- &ns->resetdist, 0.0, 1000.0, 1000, 0, "Reset distance");
- yco-= ysize;
- break;
- }
- case SENS_RADAR:
- {
- ysize= 72;
-
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- draw_default_sensor_header(sens, block, xco, yco, width);
-
- rs= sens->data;
-
- uiDefBut(block, TEX, 1, "Prop:",
- (short)(10+xco),(short)(yco-44), (short)(0.7 * (width-20)), 19,
- &rs->name, 0, 31, 0, 0,
- "Only look for Objects with this property");
- uiDefButS(block, ROW, 1, "X",
- (short)(10+xco+0.7 * (width-20)),(short)(yco-44), (short)(0.1 * (width-22)),19,
- &rs->axis, 2.0, 0, 0, 0,
- "Cast the cone along the object's positive x-axis");
- uiDefButS(block, ROW, 1, "Y",
- (short)(10+xco+0.8 * (width-20)),(short)(yco-44),(short)(0.1 * (width-22)), 19,
- &rs->axis, 2.0, 1, 0, 0,
- "Cast the cone along the object's positive y-axis");
- uiDefButS(block, ROW, 1, "Z",
- (short)(10+xco+0.9 * (width-20)), (short)(yco-44), (short)(0.1 * (width-22)), 19,
- &rs->axis, 2.0, 2, 0, 0,
- "Cast the cone along the object's positive z-axis");
- uiDefButF(block, NUM, 1, "Ang:",
- (short)(10+xco), (short)(yco-68), (short)((width-20)/2), 19,
- &rs->angle, 0.0, 179.9, 10, 0,
- "Opening angle of the radar cone.");
- uiDefButF(block, NUM, 1, "Dist:",
- (short)(xco+10 + (width-20)/2), (short)(yco-68), (short)((width-20)/2), 19,
- &rs->range, 0.01, 10000.0, 100, 0,
- "Depth of the radar cone");
- yco-= ysize;
- break;
- }
- case SENS_KEYBOARD:
- {
- /* 5 lines: 120 height */
- ysize= 120;
-
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- /* header line */
- draw_default_sensor_header(sens, block, xco, yco, width);
- ks= sens->data;
-
- /* line 2: hotkey and allkeys toggle */
- uiDefKeyevtButS(block, B_DIFF, "", xco+40, yco-44, (width)/2, 19, &ks->key, "Key code");
-
- /* line 3: two key modifyers (qual1, qual2) */
- uiDefKeyevtButS(block, B_DIFF, "", xco+40, yco-68, (width-50)/2, 19, &ks->qual, "Modifier key code");
- uiDefKeyevtButS(block, B_DIFF, "", xco+40+(width-50)/2, yco-68, (width-50)/2, 19, &ks->qual2, "Second Modifier key code");
-
- /* labels for line 1 and 2 */
- uiDefBut(block, LABEL, 0, "Key", xco, yco-44, 40, 19, NULL, 0, 0, 0, 0, "");
- uiDefBut(block, LABEL, 0, "Hold", xco, yco-68, 40, 19, NULL, 0, 0, 0, 0, "");
-
- /* part of line 1 */
- uiBlockSetCol(block, TH_BUT_SETTING2);
- uiDefButBitS(block, TOG, 1, 0, "All keys", xco+40+(width/2), yco-44, (width/2)-50, 19,
- &ks->type, 0, 0, 0, 0, "");
-
- /* line 4: toggle property for string logging mode */
- uiDefBut(block, TEX, 1, "LogToggle: ",
- xco+10, yco-92, (width-20), 19,
- ks->toggleName, 0, 31, 0, 0,
- "Property that indicates whether to log "
- "keystrokes as a string.");
-
- /* line 5: target property for string logging mode */
- uiDefBut(block, TEX, 1, "Target: ",
- xco+10, yco-116, (width-20), 19,
- ks->targetName, 0, 31, 0, 0,
- "Property that receives the keystrokes in case "
- "a string is logged.");
-
- yco-= ysize;
- break;
- }
- case SENS_PROPERTY:
- {
- ysize= 96;
-
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize,
- (float)xco+width, (float)yco, 1);
-
- draw_default_sensor_header(sens, block, xco, yco, width);
- ps= sens->data;
-
- str= "Type %t|Equal %x0|Not Equal %x1|Interval %x2|Changed %x3";
- /* str= "Type %t|Equal %x0|Not Equal %x1"; */
- uiDefButI(block, MENU, B_REDR, str, xco+30,yco-44,width-60, 19,
- &ps->type, 0, 31, 0, 0, "Type");
-
- if (ps->type != SENS_PROP_EXPRESSION)
- {
- uiDefBut(block, TEX, 1, "Prop: ", xco+30,yco-68,width-60, 19,
- ps->name, 0, 31, 0, 0, "Property name");
- }
-
- if(ps->type == SENS_PROP_INTERVAL)
- {
- uiDefBut(block, TEX, 1, "Min: ", xco,yco-92,width/2, 19,
- ps->value, 0, 31, 0, 0, "test for min value");
- uiDefBut(block, TEX, 1, "Max: ", xco+width/2,yco-92,width/2, 19,
- ps->maxvalue, 0, 31, 0, 0, "test for max value");
- }
- else if(ps->type == SENS_PROP_CHANGED);
- else
- {
- uiDefBut(block, TEX, 1, "Value: ", xco+30,yco-92,width-60, 19,
- ps->value, 0, 31, 0, 0, "test for value");
- }
-
- yco-= ysize;
- break;
- }
- case SENS_MOUSE:
- {
- ms= sens->data;
- /* Two lines: 48 pixels high. */
- ysize = 48;
-
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- /* line 1: header */
- draw_default_sensor_header(sens, block, xco, yco, width);
-
- /* Line 2: type selection. The number are a bit mangled to get
- * proper compatibility with older .blend files. */
- str= "Type %t|Left button %x1|Middle button %x2|"
- "Right button %x4|Wheel Up %x5|Wheel Down %x6|Movement %x8|Mouse over %x16|Mouse over any%x32";
- uiDefButS(block, MENU, B_REDR, str, xco+10, yco-44, width-20, 19,
- &ms->type, 0, 31, 0, 0,
- "Specify the type of event this mouse sensor should trigger on.");
-
- yco-= ysize;
- break;
- }
- case SENS_RANDOM:
- {
- ysize = 48;
-
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- draw_default_sensor_header(sens, block, xco, yco, width);
- randomSensor = sens->data;
- /* some files were wrongly written, avoid crash now */
- if (randomSensor)
- {
- uiDefButI(block, NUM, 1, "Seed: ", xco+10,yco-44,(width-20), 19,
- &randomSensor->seed, 0, 1000, 0, 0,
- "Initial seed of the generator. (Choose 0 for not random)");
- }
- yco-= ysize;
- break;
- }
- case SENS_RAY:
- {
- ysize = 72;
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- draw_default_sensor_header(sens, block, xco, yco, width);
- raySens = sens->data;
-
- /* 1. property or material */
- uiDefButBitS(block, TOG, SENS_COLLISION_MATERIAL, B_REDR, "M/P",
- xco + 10,yco - 44, 0.20 * (width-20), 19,
- &raySens->mode, 0.0, 0.0, 0, 0,
- "Toggle collision on material or property.");
-
- if (raySens->mode & SENS_COLLISION_MATERIAL)
- {
- uiDefBut(block, TEX, 1, "Material:", xco + 10 + 0.20 * (width-20), yco-44, 0.8*(width-20), 19,
- &raySens->matname, 0, 31, 0, 0,
- "Only look for Objects with this material");
- }
- else
- {
- uiDefBut(block, TEX, 1, "Property:", xco + 10 + 0.20 * (width-20), yco-44, 0.8*(width-20), 19,
- &raySens->propname, 0, 31, 0, 0,
- "Only look for Objects with this property");
- }
-
- /* 2. sensing range */
- uiDefButF(block, NUM, 1, "Range", xco+10, yco-68, 0.6 * (width-20), 19,
- &raySens->range, 0.01, 10000.0, 100, 0,
- "Sense objects no farther than this distance");
-
- /* 3. axis choice */
- str = "Type %t|+ X axis %x1|+ Y axis %x0|+ Z axis %x2|- X axis %x3|- Y axis %x4|- Z axis %x5";
- uiDefButI(block, MENU, B_REDR, str, xco+10 + 0.6 * (width-20), yco-68, 0.4 * (width-20), 19,
- &raySens->axisflag, 2.0, 31, 0, 0,
- "Specify along which axis the ray is cast.");
-
- yco-= ysize;
- break;
- }
- case SENS_MESSAGE:
- {
- mes = sens->data;
- ysize = 2 * 24; /* total number of lines * 24 pixels/line */
-
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize,
- (float)xco+width, (float)yco, 1);
-
- /* line 1: header line */
- draw_default_sensor_header(sens, block, xco, yco, width);
-
- /* line 2: Subject filter */
- uiDefBut(block, TEX, 1, "Subject: ",
- (xco+10), (yco-44), (width-20), 19,
- mes->subject, 0, 31, 0, 0,
- "Optional subject filter: only accept messages with this subject"
- ", or empty for all");
-
- yco -= ysize;
- break;
- }
- case SENS_JOYSTICK:
- {
-
- ysize = 72;
-
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- /* line 1: header */
- draw_default_sensor_header(sens, block, xco, yco, width);
-
- joy= sens->data;
-
-
- str= "Type %t|Button %x0|Axis %x1|Hat%x2";
- uiDefButS(block, MENU, B_REDR, str, xco+10, yco-44, 0.6 * (width-20), 19,
- &joy->type, 0, 31, 0, 0,
- "The type of event this joystick sensor is triggered on.");
-
- if(joy->type == SENS_JOY_BUTTON)
- {
- uiDefButI(block, NUM, 1, "Number:", xco+10, yco-68, 0.6 * (width-20), 19,
- &joy->button, 0, 18, 100, 0,
- "Specify which button to use");
-
- str = "Type %t|Pressed %x0|Released %x1";
- uiDefButI(block, MENU, B_REDR, str, xco+10 + 0.6 * (width-20), yco-68, 0.4 * (width-20), 19,
- &joy->buttonf, 2.0, 31, 0, 0,
- "Button pressed or released.");
- }
- else if(joy->type == SENS_JOY_AXIS)
- {
- uiDefButI(block, NUM, 1, "Number:", xco+10, yco-68, 0.6 * (width-20), 19,
- &joy->axis, 1, 2.0, 100, 0,
- "Specify which axis to use");
-
- uiDefButI(block, NUM, 1, "Threshold:", xco+10 + 0.6 * (width-20),yco-44, 0.4 * (width-20), 19,
- &joy->precision, 0, 32768.0, 100, 0,
- "Specify the precision of the axis");
-
- str = "Type %t|Up Axis %x1 |Down Axis %x3|Left Axis %x2|Right Axis %x0";
- uiDefButI(block, MENU, B_REDR, str, xco+10 + 0.6 * (width-20), yco-68, 0.4 * (width-20), 19,
- &joy->axisf, 2.0, 31, 0, 0,
- "The direction of the axis");
- }
- else
- {
- uiDefButI(block, NUM, 1, "Number:", xco+10, yco-68, 0.6 * (width-20), 19,
- &joy->hat, 1, 2.0, 100, 0,
- "Specify which hat to use");
-
- uiDefButI(block, NUM, 1, "Direction:", xco+10 + 0.6 * (width-20), yco-68, 0.4 * (width-20), 19,
- &joy->hatf, 0, 12, 100, 0,
- "Specify hat direction");
- }
- yco-= ysize;
- break;
- }
- }
-
- uiBlockSetEmboss(block, UI_EMBOSSM);
- uiBlockSetCol(block, TH_AUTO);
-
- return yco-4;
-}
-
-
-
-static short draw_controllerbuttons(bController *cont, uiBlock *block, short xco, short yco, short width)
-{
- bExpressionCont *ec;
- bPythonCont *pc;
- short ysize;
-
- uiBlockSetEmboss(block, UI_EMBOSSM);
-
- switch (cont->type) {
- case CONT_EXPRESSION:
- ysize= 28;
-
- BIF_ThemeColor(TH_BUT_SETTING);
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- /* uiDefBut(block, LABEL, 1, "Not yet...", xco,yco-24,80, 19, NULL, 0, 0, 0, 0, ""); */
- ec= cont->data;
- /* uiDefBut(block, BUT, 1, "Variables", xco,yco-24,80, 19, NULL, 0, 0, 0, 0, "Available variables for expression"); */
- uiDefBut(block, TEX, 1, "Exp:", xco + 10 , yco-21, width-20, 19,
- ec->str, 0, 127, 0, 0,
- "Expression");
-
- yco-= ysize;
- break;
- case CONT_PYTHON:
- ysize= 28;
-
- if(cont->data==NULL) init_controller(cont);
- pc= cont->data;
-
- BIF_ThemeColor(TH_BUT_SETTING1);
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- uiDefIDPoinBut(block, test_scriptpoin_but, ID_SCRIPT, 1, "Script: ", xco+45,yco-24,width-90, 19, &pc->text, "");
-
- yco-= ysize;
- break;
-
- default:
- ysize= 4;
-
- BIF_ThemeColor(TH_BUT_NEUTRAL);
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- yco-= ysize;
- }
-
- uiBlockSetEmboss(block, UI_EMBOSSM);
- uiBlockSetCol(block, TH_AUTO);
-
- return yco;
-}
-
-static int get_col_actuator(int type)
-{
- switch(type) {
- case ACT_ACTION: return TH_BUT_ACTION;
- case ACT_OBJECT: return TH_BUT_NEUTRAL;
- case ACT_IPO: return TH_BUT_SETTING;
- case ACT_PROPERTY: return TH_BUT_SETTING1;
- case ACT_SOUND: return TH_BUT_SETTING2;
- case ACT_CD: return TH_BUT_NUM;
- case ACT_CAMERA: return TH_BUT_TEXTFIELD;
- case ACT_EDIT_OBJECT: return TH_BUT_POPUP;
- case ACT_GROUP: return TH_BUT_ACTION;
- case ACT_RANDOM: return TH_BUT_NEUTRAL;
- case ACT_SCENE: return TH_BUT_SETTING;
- case ACT_MESSAGE: return TH_BUT_SETTING1;
- case ACT_GAME: return TH_BUT_SETTING2;
- case ACT_VISIBILITY: return TH_BUT_NUM;
- case ACT_CONSTRAINT: return TH_BUT_ACTION;
- default: return TH_BUT_NEUTRAL;
- }
-}
-static void set_col_actuator(int item, int medium)
-{
- int col= get_col_actuator(item);
- BIF_ThemeColorShade(col, medium?30:10);
-
-}
-
-static short draw_actuatorbuttons(bActuator *act, uiBlock *block, short xco, short yco, short width)
-{
- bSoundActuator *sa = NULL;
- bCDActuator *cda = NULL;
- bObjectActuator *oa = NULL;
- bIpoActuator *ia = NULL;
- bPropertyActuator *pa = NULL;
- bCameraActuator *ca = NULL;
- bEditObjectActuator *eoa = NULL;
- bConstraintActuator *coa = NULL;
- bSceneActuator *sca = NULL;
- bGroupActuator *ga = NULL;
- bRandomActuator *randAct = NULL;
- bMessageActuator *ma = NULL;
- bActionActuator *aa = NULL;
- bGameActuator *gma = NULL;
- bVisibilityActuator *visAct = NULL;
-
- float *fp;
- short ysize = 0, wval;
- char *str;
- int myline;
-
- /* yco is at the top of the rect, draw downwards */
- uiBlockSetEmboss(block, UI_EMBOSSM);
- set_col_actuator(act->type, 0);
-
- switch (act->type)
- {
- case ACT_OBJECT:
- {
- ysize= 129;
-
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- oa = act->data;
- wval = (width-100)/3;
-
- uiDefBut(block, LABEL, 0, "Force", xco, yco-22, 55, 19, NULL, 0, 0, 0, 0, "Sets the force");
- uiDefButF(block, NUM, 0, "", xco+45, yco-22, wval, 19, oa->forceloc, -10000.0, 10000.0, 10, 0, "");
- uiDefButF(block, NUM, 0, "", xco+45+wval, yco-22, wval, 19, oa->forceloc+1, -10000.0, 10000.0, 10, 0, "");
- uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-22, wval, 19, oa->forceloc+2, -10000.0, 10000.0, 10, 0, "");
-
- uiDefBut(block, LABEL, 0, "Torque", xco, yco-41, 55, 19, NULL, 0, 0, 0, 0, "Sets the torque");
- uiDefButF(block, NUM, 0, "", xco+45, yco-41, wval, 19, oa->forcerot, -10000.0, 10000.0, 10, 0, "");
- uiDefButF(block, NUM, 0, "", xco+45+wval, yco-41, wval, 19, oa->forcerot+1, -10000.0, 10000.0, 10, 0, "");
- uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-41, wval, 19, oa->forcerot+2, -10000.0, 10000.0, 10, 0, "");
-
- uiDefBut(block, LABEL, 0, "dLoc", xco, yco-64, 45, 19, NULL, 0, 0, 0, 0, "Sets the dLoc");
- uiDefButF(block, NUM, 0, "", xco+45, yco-64, wval, 19, oa->dloc, -10000.0, 10000.0, 10, 0, "");
- uiDefButF(block, NUM, 0, "", xco+45+wval, yco-64, wval, 19, oa->dloc+1, -10000.0, 10000.0, 10, 0, "");
- uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-64, wval, 19, oa->dloc+2, -10000.0, 10000.0, 10, 0, "");
-
- uiDefBut(block, LABEL, 0, "dRot", xco, yco-83, 45, 19, NULL, 0, 0, 0, 0, "Sets the dRot");
- uiDefButF(block, NUM, 0, "", xco+45, yco-83, wval, 19, oa->drot, -10000.0, 10000.0, 10, 0, "");
- uiDefButF(block, NUM, 0, "", xco+45+wval, yco-83, wval, 19, oa->drot+1, -10000.0, 10000.0, 10, 0, "");
- uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-83, wval, 19, oa->drot+2, -10000.0, 10000.0, 10, 0, "");
-
- uiDefBut(block, LABEL, 0, "linV", xco, yco-106, 45, 19, NULL, 0, 0, 0, 0, "Sets the linear velocity");
- uiDefButF(block, NUM, 0, "", xco+45, yco-106, wval, 19, oa->linearvelocity, -10000.0, 10000.0, 10, 0, "");
- uiDefButF(block, NUM, 0, "", xco+45+wval, yco-106, wval, 19, oa->linearvelocity+1, -10000.0, 10000.0, 10, 0, "");
- uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-106, wval, 19, oa->linearvelocity+2, -10000.0, 10000.0, 10, 0, "");
-
- uiDefBut(block, LABEL, 0, "angV", xco, yco-125, 45, 19, NULL, 0, 0, 0, 0, "Sets the angular velocity");
- uiDefButF(block, NUM, 0, "", xco+45, yco-125, wval, 19, oa->angularvelocity, -10000.0, 10000.0, 10, 0, "");
- uiDefButF(block, NUM, 0, "", xco+45+wval, yco-125, wval, 19, oa->angularvelocity+1, -10000.0, 10000.0, 10, 0, "");
- uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-125, wval, 19, oa->angularvelocity+2, -10000.0, 10000.0, 10, 0, "");
-
- uiDefButBitI(block, TOG, ACT_FORCE_LOCAL, 0, "L", xco+45+3*wval, yco-22, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Local transformation");
- uiDefButBitI(block, TOG, ACT_TORQUE_LOCAL, 0, "L", xco+45+3*wval, yco-41, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Local transformation");
- uiDefButBitI(block, TOG, ACT_DLOC_LOCAL, 0, "L", xco+45+3*wval, yco-64, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Local transformation");
- uiDefButBitI(block, TOG, ACT_DROT_LOCAL, 0, "L", xco+45+3*wval, yco-83, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Local transformation");
- uiDefButBitI(block, TOG, ACT_LIN_VEL_LOCAL, 0, "L", xco+45+3*wval, yco-106, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Local transformation");
- uiDefButBitI(block, TOG, ACT_ANG_VEL_LOCAL, 0, "L", xco+45+3*wval, yco-125, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Local transformation");
-
- uiDefButBitI(block, TOG, ACT_ADD_LIN_VEL, 0, "add",xco+45+3*wval+15, yco-106, 35, 19, &oa->flag, 0.0, 0.0, 0, 0, "Toggles between ADD and SET linV");
-
- yco-= ysize;
- break;
- }
- case ACT_ACTION:
- {
- /* DrawAct */
-#ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
- ysize = 112;
-#else
- ysize= 92;
-#endif
-
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- aa = act->data;
- wval = (width-60)/3;
-
- // str= "Action types %t|Play %x0|Ping Pong %x1|Flipper %x2|Loop Stop %x3|Loop End %x4|Property %x6";
-#ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
- str= "Action types %t|Play %x0|Flipper %x2|Loop Stop %x3|Loop End %x4|Property %x6|Displacement %x7";
-#else
- str= "Action types %t|Play %x0|Flipper %x2|Loop Stop %x3|Loop End %x4|Property %x6";
-#endif
- uiDefButS(block, MENU, B_REDR, str, xco+30, yco-24, width-60, 19, &aa->type, 0.0, 0.0, 0.0, 0.0, "Action playback type");
- uiDefIDPoinBut(block, test_actionpoin_but, ID_AC, 1, "AC: ", xco+30, yco-44, width-60, 19, &aa->act, "Action name");
-
- if(aa->type == ACT_ACTION_FROM_PROP)
- {
- uiDefBut(block, TEX, 0, "Prop: ",xco+30, yco-64, width-60, 19, aa->name, 0.0, 31.0, 0, 0, "Use this property to define the Action position");
- }
- else
- {
- uiDefButI(block, NUM, 0, "Sta: ",xco+30, yco-64, (width-60)/2, 19, &aa->sta, 0.0, MAXFRAMEF, 0, 0, "Start frame");
- uiDefButI(block, NUM, 0, "End: ",xco+30+(width-60)/2, yco-64, (width-60)/2, 19, &aa->end, 0.0, MAXFRAMEF, 0, 0, "End frame");
- }
-
-
-
- uiDefButI(block, NUM, 0, "Blendin: ", xco+30, yco-84, (width-60)/2, 19, &aa->blendin, 0.0, MAXFRAMEF, 0.0, 0.0, "Number of frames of motion blending");
- uiDefButS(block, NUM, 0, "Priority: ", xco+30+(width-60)/2, yco-84, (width-60)/2, 19, &aa->priority, 0.0, 100.0, 0.0, 0.0, "Execution priority - lower numbers will override actions with higher numbers");
-
-#ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
- if(aa->type == ACT_ACTION_MOTION)
- {
- uiDefButF(block, NUM, 0, "Cycle: ",xco+30, yco-104, (width-60)/2, 19, &aa->stridelength, 0.0, 2500.0, 0, 0, "Distance covered by a single cycle of the action");
- }
-#endif
-
- yco-=ysize;
- break;
- }
- case ACT_IPO:
- {
- ia= act->data;
-
- ysize= 52;
-
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- str = "Ipo types %t|Play %x0|Ping Pong %x1|Flipper %x2|Loop Stop %x3|Loop End %x4|Property %x6";
-
- uiDefButS(block, MENU, B_REDR, str, xco+20, yco-24, width-40 - (width-40)/3, 19, &ia->type, 0, 0, 0, 0, "");
- uiDefButBitS(block, TOG, ACT_IPOCHILD, B_REDR,
- "Child", xco+20+0.666*(width-40), yco-24, (width-40)/3, 19,
- &ia->flag, 0, 0, 0, 0,
- "Add all children Objects as well");
-
- if(ia->type==ACT_IPO_FROM_PROP) {
- uiDefBut(block, TEX, 0,
- "Prop: ", xco+20, yco-44, width-40, 19,
- ia->name, 0.0, 31.0, 0, 0,
- "Use this property to define the Ipo position");
- }
- else {
- uiDefButI(block, NUM, 0,
- "Sta", xco+20, yco-44, (width-100)/2, 19,
- &ia->sta, 0.0, MAXFRAMEF, 0, 0,
- "Start frame");
- uiDefButI(block, NUM, 0,
- "End", xco+18+(width-90)/2, yco-44, (width-100)/2, 19,
- &ia->end, 0.0, MAXFRAMEF, 0, 0,
- "End frame");
-
- uiDefButBitS(block, TOG, ACT_IPOFORCE, B_REDR,
- "Force", xco+width-78, yco-44, 43, 19,
- &ia->flag, 0, 0, 0, 0,
- "Convert Ipo to force");
-
- /* Only show the do-force-local toggle if force is requested */
- if (ia->flag & ACT_IPOFORCE) {
- uiDefButBitS(block, TOG, ACT_IPOFORCE_LOCAL, 0,
- "L", xco+width-35, yco-44, 15, 19,
- &ia->flag, 0, 0, 0, 0,
- "Let the force-ipo act in local coordinates.");
- }
-
- }
- yco-= ysize;
- break;
- }
- case ACT_PROPERTY:
- {
- ysize= 68;
-
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- pa= act->data;
-
- str= "Type %t|Assign %x0|Add %x1|Copy %x2";
- uiDefButI(block, MENU, B_REDR, str, xco+30,yco-24,width-60, 19, &pa->type, 0, 31, 0, 0, "Type");
-
- uiDefBut(block, TEX, 1, "Prop: ", xco+30,yco-44,width-60, 19, pa->name, 0, 31, 0, 0, "Property name");
-
- if(pa->type==ACT_PROP_COPY) {
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, 1, "OB:", xco+10, yco-64, (width-20)/2, 19, &(pa->ob), "Copy from this Object");
- uiDefBut(block, TEX, 1, "Prop: ", xco+10+(width-20)/2, yco-64, (width-20)/2, 19, pa->value, 0, 31, 0, 0, "Copy this property");
- }
- else {
- uiDefBut(block, TEX, 1, "Value: ", xco+30,yco-64,width-60, 19, pa->value, 0, 31, 0, 0, "change with this value");
- }
- yco-= ysize;
-
- break;
- }
- case ACT_SOUND:
- {
- ysize = 70;
-
- sa = act->data;
- sa->sndnr = 0;
-
- wval = (width-20)/2;
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- if(G.main->sound.first) {
- IDnames_to_pupstring(&str, "Sound files", NULL, &(G.main->sound), (ID *)sa->sound, &(sa->sndnr));
- /* reset this value, it is for handling the event */
- sa->sndnr = 0;
- uiDefButS(block, MENU, B_SOUNDACT_BROWSE, str, xco+10,yco-22,20,19, &(sa->sndnr), 0, 0, 0, 0, "");
-
- if(sa->sound) {
- char dummy_str[] = "Sound mode %t|Play Stop %x0|Play End %x1|Loop Stop %x2|Loop End %x3|Loop Ping Pong Stop %x5|Loop Ping Pong %x4";
- uiDefBut(block, TEX, B_IDNAME, "SO:",xco+30,yco-22,width-40,19, sa->sound->id.name+2, 0.0, 21.0, 0, 0, "");
- uiDefButS(block, MENU, 1, dummy_str,xco+10,yco-44,width-20, 19, &sa->type, 0.0, 0.0, 0, 0, "");
- uiDefButF(block, NUM, 0, "Volume:", xco+10,yco-66,wval, 19, &sa->sound->volume, 0.0, 1.0, 0, 0, "Sets the volume of this sound");
- uiDefButF(block, NUM, 0, "Pitch:",xco+wval+10,yco-66,wval, 19, &sa->sound->pitch,-12.0, 12.0, 0, 0, "Sets the pitch of this sound");
- }
- MEM_freeN(str);
- }
- else {
- uiDefBut(block, LABEL, 0, "Use Sound window (F10) to load samples", xco, yco-24, width, 19, NULL, 0, 0, 0, 0, "");
- }
-
- yco-= ysize;
-
- break;
- }
- case ACT_CD:
- {
- char cd_type_str[] = "Sound mode %t|Play all tracks %x0|Play one track %x1|"
- "Volume %x3|Stop %x4|Pause %x5|Resume %x6";
- cda = act->data;
-
- if (cda) {
- if (cda->track == 0) {
- cda->track = 1;
- cda->volume = 1;
- cda->type = ACT_CD_PLAY_ALL;
- }
-
- if (cda->type == ACT_CD_PLAY_TRACK || cda->type == ACT_CD_LOOP_TRACK) {
- ysize = 48;
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
- uiDefButS(block, NUM, 0, "Track:", xco+10,yco-44,width-20, 19, &cda->track, 1, 99, 0, 0, "Select the track to be played");
- }
- else if (cda->type == ACT_CD_VOLUME) {
- ysize = 48;
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
- uiDefButF(block, NUM, 0, "Volume:", xco+10,yco-44,width-20, 19, &cda->volume, 0, 1, 0, 0, "Set the volume for CD playback");
- }
- else {
- ysize = 28;
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
- }
- uiDefButS(block, MENU, B_REDR, cd_type_str,xco+10,yco-22,width-20, 19, &cda->type, 0.0, 0.0, 0, 0, "");
- }
- yco-= ysize;
- break;
- }
- case ACT_CAMERA:
-
- ysize= 48;
-
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- ca= act->data;
-
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, 1, "OB:", xco+10, yco-24, (width-20)/2, 19, &(ca->ob), "Look at this Object");
- uiDefButF(block, NUM, 0, "Height:", xco+10+(width-20)/2, yco-24, (width-20)/2, 19, &ca->height, 0.0, 20.0, 0, 0, "");
-
- uiDefButF(block, NUM, 0, "Min:", xco+10, yco-44, (width-60)/2, 19, &ca->min, 0.0, 20.0, 0, 0, "");
-
- if(ca->axis==0) ca->axis= 'x';
- uiDefButS(block, ROW, 0, "X", xco+10+(width-60)/2, yco-44, 20, 19, &ca->axis, 4.0, (float)'x', 0, 0, "Camera tries to get behind the X axis");
- uiDefButS(block, ROW, 0, "Y", xco+30+(width-60)/2, yco-44, 20, 19, &ca->axis, 4.0, (float)'y', 0, 0, "Camera tries to get behind the Y axis");
-
- uiDefButF(block, NUM, 0, "Max:", xco+20+(width)/2, yco-44, (width-60)/2, 19, &ca->max, 0.0, 20.0, 0, 0, "");
-
- yco-= ysize;
-
- break;
-
- case ACT_EDIT_OBJECT:
-
- eoa= act->data;
-
- if(eoa->type==ACT_EDOB_ADD_OBJECT) {
- int wval; /* just a temp width */
- ysize = 72;
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, 1, "OB:", xco+10, yco-44, (width-20)/2, 19, &(eoa->ob), "Add this Object (cant be on an visible layer)");
- uiDefButI(block, NUM, 0, "Time:", xco+10+(width-20)/2, yco-44, (width-20)/2, 19, &eoa->time, 0.0, 2000.0, 0, 0, "Duration the new Object lives");
-
- wval= (width-60)/3;
- uiDefBut(block, LABEL, 0, "linV", xco, yco-68, 45, 19,
- NULL, 0, 0, 0, 0,
- "Velocity upon creation.");
- uiDefButF(block, NUM, 0, "", xco+45, yco-68, wval, 19,
- eoa->linVelocity, -100.0, 100.0, 10, 0,
- "Velocity upon creation, x component.");
- uiDefButF(block, NUM, 0, "", xco+45+wval, yco-68, wval, 19,
- eoa->linVelocity+1, -100.0, 100.0, 10, 0,
- "Velocity upon creation, y component.");
- uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-68, wval, 19,
- eoa->linVelocity+2, -100.0, 100.0, 10, 0,
- "Velocity upon creation, z component.");
- uiDefButBitS(block, TOG, 2, 0, "L", xco+45+3*wval, yco-68, 15, 19,
- &eoa->localflag, 0.0, 0.0, 0, 0,
- "Apply the transformation locally");
-
- }
- else if(eoa->type==ACT_EDOB_END_OBJECT) {
- ysize= 28;
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
- }
- else if(eoa->type==ACT_EDOB_REPLACE_MESH) {
- ysize= 48;
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- uiDefIDPoinBut(block, test_meshpoin_but, ID_ME, 1, "ME:", xco+40, yco-44, (width-80), 19, &(eoa->me), "replace the existing mesh with this one");
- }
- else if(eoa->type==ACT_EDOB_TRACK_TO) {
- ysize= 48;
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, 1, "OB:", xco+10, yco-44, (width-20)/2, 19, &(eoa->ob), "Track to this Object");
- uiDefButI(block, NUM, 0, "Time:", xco+10+(width-20)/2, yco-44, (width-20)/2-40, 19, &eoa->time, 0.0, 2000.0, 0, 0, "Duration the tracking takes");
- uiDefButS(block, TOG, 0, "3D", xco+width-50, yco-44, 40, 19, &eoa->flag, 0.0, 0.0, 0, 0, "Enable 3D tracking");
- }
-
- str= "Edit Object %t|Add Object %x0|End Object %x1|Replace Mesh %x2|Track to %x3";
- uiDefButS(block, MENU, B_REDR, str, xco+40, yco-24, (width-80), 19, &eoa->type, 0.0, 0.0, 0, 0, "");
-
- yco-= ysize;
-
- break;
-
- case ACT_CONSTRAINT:
-
- ysize= 44;
-
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- coa= act->data;
-
-/* str= "Limit %t|None %x0|Loc X %x1|Loc Y %x2|Loc Z %x4|Rot X %x8|Rot Y %x16|Rot Z %x32"; */
- str= "Limit %t|None %x0|Loc X %x1|Loc Y %x2|Loc Z %x4";
- uiDefButS(block, MENU, 1, str, xco+10, yco-40, 70, 19, &coa->flag, 0.0, 0.0, 0, 0, "");
-
- uiDefButS(block, NUM, 0, "Damp:", xco+10, yco-20, 70, 19, &coa->damp, 0.0, 100.0, 0, 0, "");
- uiDefBut(block, LABEL, 0, "Min", xco+80, yco-20, (width-90)/2, 19, NULL, 0.0, 0.0, 0, 0, "");
- uiDefBut(block, LABEL, 0, "Max", xco+80+(width-90)/2, yco-20, (width-90)/2, 19, NULL, 0.0, 0.0, 0, 0, "");
-
- if(coa->flag & ACT_CONST_LOCX) fp= coa->minloc;
- else if(coa->flag & ACT_CONST_LOCY) fp= coa->minloc+1;
- else if(coa->flag & ACT_CONST_LOCZ) fp= coa->minloc+2;
- else if(coa->flag & ACT_CONST_ROTX) fp= coa->minrot;
- else if(coa->flag & ACT_CONST_ROTY) fp= coa->minrot+1;
- else fp= coa->minrot+2;
-
- uiDefButF(block, NUM, 0, "", xco+80, yco-40, (width-90)/2, 19, fp, -2000.0, 2000.0, 10, 0, "");
- uiDefButF(block, NUM, 0, "", xco+80+(width-90)/2, yco-40, (width-90)/2, 19, fp+3, -2000.0, 2000.0, 10, 0, "");
-
- yco-= ysize;
-
- break;
-
- case ACT_SCENE:
- sca= act->data;
-
- if(sca->type==ACT_SCENE_RESTART) {
- ysize= 28;
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
- }
- else if(sca->type==ACT_SCENE_CAMERA) {
-
- ysize= 48;
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, 1, "OB:", xco+40, yco-44, (width-80), 19, &(sca->camera), "Set this Camera");
- }
- else if(sca->type==ACT_SCENE_SET) {
-
- ysize= 48;
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:", xco+40, yco-44, (width-80), 19, &(sca->scene), "Set this Scene");
- }
- else if(sca->type==ACT_SCENE_ADD_FRONT) {
-
- ysize= 48;
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:", xco+40, yco-44, (width-80), 19, &(sca->scene), "Add an Overlay Scene");
- }
- else if(sca->type==ACT_SCENE_ADD_BACK) {
-
- ysize= 48;
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:", xco+40, yco-44, (width-80), 19, &(sca->scene), "Add a Background Scene");
- }
- else if(sca->type==ACT_SCENE_REMOVE) {
-
- ysize= 48;
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:", xco+40, yco-44, (width-80), 19, &(sca->scene), "Remove a Scene");
- }
- else if(sca->type==ACT_SCENE_SUSPEND) {
-
- ysize= 48;
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:", xco+40, yco-44, (width-80), 19, &(sca->scene), "Pause a Scene");
- }
- else if(sca->type==ACT_SCENE_RESUME) {
-
- ysize= 48;
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:", xco+40, yco-44, (width-80), 19, &(sca->scene), "Unpause a Scene");
- }
-
- str= "Scene %t|Restart %x0|Set Scene %x1|Set Camera %x2|Add OverlayScene %x3|Add BackgroundScene %x4|Remove Scene %x5|Suspend Scene %x6|Resume Scene %x7";
- uiDefButS(block, MENU, B_REDR, str, xco+40, yco-24, (width-80), 19, &sca->type, 0.0, 0.0, 0, 0, "");
-
- yco-= ysize;
- break;
- case ACT_GAME:
- {
- gma = act->data;
- if (gma->type == ACT_GAME_LOAD)
- {
- //ysize = 68;
- ysize = 48;
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
- uiDefBut(block, TEX, 1, "File: ", xco+10, yco-44,width-20,19, &(gma->filename), 0, 63, 0, 0, "Load this file");
-// uiDefBut(block, TEX, 1, "Anim: ", xco+10, yco-64,width-20,19, &(gma->loadaniname), 0, 63, 0, 0, "Use this loadinganimation");
- }
-/* else if (gma->type == ACT_GAME_START)
- {
- ysize = 68;
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- uiDefBut(block, TEX, 1, "File: ", xco+10, yco-44,width-20,19, &(gma->filename), 0, 63, 0, 0, "Load this file");
- uiDefBut(block, TEX, 1, "Anim: ", xco+10, yco-64,width-20,19, &(gma->loadaniname), 0, 63, 0, 0, "Use this loadinganimation");
- }
-*/ else if (gma->type == ACT_GAME_RESTART)
- {
- ysize = 28;
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
- }
- else if (gma->type == ACT_GAME_QUIT)
- {
- ysize = 28;
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
- }
-
- //str = "Scene %t|Load game%x0|Start loaded game%x1|Restart this game%x2|Quit this game %x3";
- str = "Scene %t|Start new game%x0|Restart this game%x2|Quit this game %x3";
- uiDefButS(block, MENU, B_REDR, str, xco+40, yco-24, (width-80), 19, &gma->type, 0.0, 0.0, 0, 0, "");
-
- yco -= ysize;
- break;
- }
- case ACT_GROUP:
- ga= act->data;
-
- ysize= 52;
-
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- str= "GroupKey types %t|Set Key %x6|Play %x0|Ping Pong %x1|Flipper %x2|Loop Stop %x3|Loop End %x4|Property %x5";
-
- uiDefButS(block, MENU, 1, str, xco+20, yco-24, width-40, 19, &ga->type, 0, 0, 0, 0, "");
- if(ga->type==ACT_GROUP_SET) {
- uiDefBut(block, TEX, 0, "Key: ", xco+20, yco-44, (width-10)/2, 19, ga->name, 0.0, 31.0, 0, 0, "This name defines groupkey to be set");
- uiDefButI(block, NUM, 0, "Frame:", xco+20+(width-10)/2, yco-44, (width-70)/2, 19, &ga->sta, 0.0, 2500.0, 0, 0, "Set this frame");
- }
- else if(ga->type==ACT_GROUP_FROM_PROP) {
- uiDefBut(block, TEX, 0, "Prop: ", xco+20, yco-44, width-40, 19, ga->name, 0.0, 31.0, 0, 0, "Use this property to define the Group position");
- }
- else {
- uiDefButI(block, NUM, 0, "Sta", xco+20, yco-44, (width-40)/2, 19, &ga->sta, 0.0, 2500.0, 0, 0, "Start frame");
- uiDefButI(block, NUM, 0, "End", xco+20+(width-40)/2, yco-44, (width-40)/2, 19, &ga->end, 0.0, 2500.0, 0, 0, "End frame");
- }
- yco-= ysize;
- break;
-
- case ACT_VISIBILITY:
- ysize = 24;
-
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco,
- (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- visAct = act->data;
-
- str= "Visibility %t|Visible %x0|Invisible %x1";
-
- uiDefButI(block, MENU, B_REDR, str,
- xco + 10, yco - 24, width - 20, 19, &visAct->flag,
- 0.0, 0.0, 0, 0,
- "Make the object invisible or visible.");
-/*
- uiDefButBitI(block, TOG, ACT_VISIBILITY_INVISIBLE, 0,
- "Invisible",
- xco + 10, yco - 24, width - 20, 19, &visAct->flag,
- 0.0, 0.0, 0, 0,
- "Make the object invisible or visible.");
-*/
- yco-= ysize;
-
- break;
-
- case ACT_RANDOM:
- ysize = 69;
-
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco,
- (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- randAct = act->data;
-
- /* 1. seed */
- uiDefButI(block, NUM, 1, "Seed: ", (xco+10),yco-24, 0.4 *(width-20), 19,
- &randAct->seed, 0, 1000, 0, 0,
- "Initial seed of the random generator. Use Python for more freedom. "
- " (Choose 0 for not random)");
-
- /* 2. distribution type */
- /* One pick per distribution. These numbers MUST match the #defines */
- /* in game.h !!! */
- str= "Distribution %t|Bool Constant %x0|Bool Uniform %x1"
- "|Bool Bernoulli %x2|Int Constant %x3|Int Uniform %x4"
- "|Int Poisson %x5|Float Constant %x6|Float Uniform %x7"
- "|Float Normal %x8|Float Neg. Exp. %x9";
- uiDefButI(block, MENU, B_REDR, str, (xco+10) + 0.4 * (width-20), yco-24, 0.6 * (width-20), 19,
- &randAct->distribution, 0.0, 0.0, 0, 0,
- "Choose the type of distribution");
-
- /* 3. property */
- uiDefBut(block, TEX, 1, "Property:", (xco+10), yco-44, (width-20), 19,
- &randAct->propname, 0, 31, 0, 0,
- "Assign the random value to this property");
-
- /*4. and 5. arguments for the distribution*/
- switch (randAct->distribution) {
- case ACT_RANDOM_BOOL_CONST:
- uiDefButBitI(block, TOG, 1, 1, "Always true", (xco+10), yco-64, (width-20), 19,
- &randAct->int_arg_1, 2.0, 1, 0, 0,
- "Always false or always true");
- break;
- case ACT_RANDOM_BOOL_UNIFORM:
- uiDefBut(block, LABEL, 0, " Do a 50-50 pick.", (xco+10), yco-64, (width-20), 19,
- NULL, 0, 0, 0, 0,
- "Choose between true and false, 50% chance each.");
- break;
- case ACT_RANDOM_BOOL_BERNOUILLI:
- uiDefButF(block, NUM, 1, "Chance", (xco+10), yco-64, (width-20), 19,
- &randAct->float_arg_1, 0.0, 1.0, 0, 0,
- "Pick a number between 0 and 1. Success if you stay "
- "below this value");
- break;
- case ACT_RANDOM_INT_CONST:
- uiDefButI(block, NUM, 1, "Value: ", (xco+10), yco-64, (width-20), 19,
- &randAct->int_arg_1, -1000, 1000, 0, 0,
- "Always return this number");
- break;
- case ACT_RANDOM_INT_UNIFORM:
- uiDefButI(block, NUM, 1, "Min: ", (xco+10), yco-64, (width-20)/2, 19,
- &randAct->int_arg_1, -1000, 1000, 0, 0,
- "Choose a number from a range. "
- "Lower boundary of the range.");
- uiDefButI(block, NUM, 1, "Max: ", (xco+10) + (width-20)/2, yco-64, (width-20)/2, 19,
- &randAct->int_arg_2, -1000, 1000, 0, 0,
- "Choose a number from a range. "
- "Upper boundary of the range.");
- break;
- case ACT_RANDOM_INT_POISSON:
- uiDefButF(block, NUM, 1, "Mean: ", (xco+10), yco-64, (width-20), 19,
- &randAct->float_arg_1, 0.01, 100.0, 0, 0,
- "Expected mean value of the distribution.");
- break;
- case ACT_RANDOM_FLOAT_CONST:
- uiDefButF(block, NUM, 1, "Value: ", (xco+10), yco-64, (width-20), 19,
- &randAct->float_arg_1, 0.0, 1.0, 0, 0,
- "Always return this number");
- break;
- case ACT_RANDOM_FLOAT_UNIFORM:
- uiDefButF(block, NUM, 1, "Min: ", (xco+10), yco-64, (width-20)/2, 19,
- &randAct->float_arg_1, -10000.0, 10000.0, 0, 0,
- "Choose a number from a range. "
- "Lower boundary of the range.");
- uiDefButF(block, NUM, 1, "Max: ", (xco+10) + (width-20)/2, yco-64, (width-20)/2, 19,
- &randAct->float_arg_2, -10000.0, 10000.0, 0, 0,
- "Choose a number from a range. "
- "Upper boundary of the range.");
- break;
- case ACT_RANDOM_FLOAT_NORMAL:
- uiDefButF(block, NUM, 1, "Mean: ", (xco+10), yco-64, (width-20)/2, 19,
- &randAct->float_arg_1, -10000.0, 10000.0, 0, 0,
- "A normal distribution. Mean of the distribution.");
- uiDefButF(block, NUM, 1, "SD: ", (xco+10) + (width-20)/2, yco-64, (width-20)/2, 19,
- &randAct->float_arg_2, 0.0, 10000.0, 0, 0,
- "A normal distribution. Standard deviation of the "
- "distribution.");
- break;
- case ACT_RANDOM_FLOAT_NEGATIVE_EXPONENTIAL:
- uiDefButF(block, NUM, 1, "Half-life time: ", (xco+10), yco-64, (width-20), 19,
- &randAct->float_arg_1, 0.001, 10000.0, 0, 0,
- "Negative exponential dropoff.");
- break;
- default:
- ; /* don't know what this distro is... can be useful for testing */
- /* though :) */
- }
-
- yco-= ysize;
- break;
- case ACT_MESSAGE:
- ma = act->data;
-
-#define MESSAGE_SENSOR_TO_FIELD_WORKS /* Really? Not really. Don't remove this ifdef yet */
-
-#ifdef MESSAGE_SENSOR_TO_FIELD_WORKS
- ysize = 4 + (3 * 24); /* footer + number of lines * 24 pixels/line */
-#else
- ysize = 4 + (2 * 24); /* footer + number of lines * 24 pixels/line */
-#endif
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize,
- (float)xco+width, (float)yco, 1);
-
- myline=1;
-
-
-#ifdef MESSAGE_SENSOR_TO_FIELD_WORKS
- /* line 1: To */
- uiDefBut(block, TEX, 1, "To: ",
- (xco+10), (yco-(myline++*24)), (width-20), 19,
- &ma->toPropName, 0, 31, 0, 0,
- "Optional send message to objects with this name only"
- ", or empty to broadcast");
-
-#endif
-
- /* line 2: Message Subject */
- uiDefBut(block, TEX, 1, "Subject: ",
- (xco+10), (yco-(myline++*24)), (width-20), 19,
- &ma->subject, 0, 31, 0, 0,
- "Optional message subject. This is what can be filtered on.");
-
- /* line 3: Text/Property */
- uiDefButBitS(block, TOG, 1, B_REDR, "T/P",
- (xco+10),(yco-(myline*24)), (0.20 * (width-20)), 19,
- &ma->bodyType, 0.0, 0.0, 0, 0,
- "Toggle message type: either Text or a PropertyName.");
-
- if (ma->bodyType == ACT_MESG_MESG)
- {
- /* line 3: Message Body */
- uiDefBut(block, TEX, 1, "Body: ",
- (xco+10+(0.20*(width-20))),(yco-(myline++*24)),(0.8*(width-20)),19,
- &ma->body, 0, 31, 0, 0,
- "Optional message body Text");
- } else
- {
- /* line 3: Property body (set by property) */
- uiDefBut(block, TEX, 1, "Propname: ",
- (xco+10+(0.20*(width-20))),(yco-(myline++*24)),(0.8*(width-20)),19,
- &ma->body, 0, 31, 0, 0,
- "The message body will be set by the Property Value");
- }
-
- yco -= ysize;
- break;
- default:
- ysize= 4;
-
- glRects(xco, yco-ysize, xco+width, yco);
- uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
-
- yco-= ysize;
- break;
- }
-
- uiBlockSetEmboss(block, UI_EMBOSSM);
-
- return yco-4;
-}
-
-static void do_sensor_menu(void *arg, int event)
-{
- ID **idar;
- Object *ob;
- bSensor *sens;
- short count, a;
-
- idar= get_selected_and_linked_obs(&count, G.buts->scaflag);
-
- for(a=0; a<count; a++) {
- ob= (Object *)idar[a];
- if(event==0 || event==2) ob->scaflag |= OB_SHOWSENS;
- else if(event==1) ob->scaflag &= ~OB_SHOWSENS;
- }
-
- for(a=0; a<count; a++) {
- ob= (Object *)idar[a];
- sens= ob->sensors.first;
- while(sens) {
- if(event==2) sens->flag |= SENS_SHOW;
- else if(event==3) sens->flag &= ~SENS_SHOW;
- sens= sens->next;
- }
- }
-
- if(idar) MEM_freeN(idar);
- allqueue(REDRAWBUTSLOGIC, 0);
-}
-
-static uiBlock *sensor_menu(void *arg_unused)
-{
- uiBlock *block;
- int yco=0;
-
- block= uiNewBlock(&curarea->uiblocks, "filemenu", UI_EMBOSSP, UI_HELV, curarea->win);
- uiBlockSetButmFunc(block, do_sensor_menu, NULL);
-
- uiDefBut(block, BUTM, 1, "Show Objects", 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefBut(block, BUTM, 1, "Hide Objects", 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefBut(block, SEPR, 0, "", 0, (short)(yco-=6), 160, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefBut(block, BUTM, 1, "Show Sensors", 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefBut(block, BUTM, 1, "Hide Sensors", 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 3, "");
-
- uiBlockSetDirection(block, UI_TOP);
-
- return block;
-}
-
-static void do_controller_menu(void *arg, int event)
-{
- ID **idar;
- Object *ob;
- bController *cont;
- short count, a;
-
- idar= get_selected_and_linked_obs(&count, G.buts->scaflag);
-
- for(a=0; a<count; a++) {
- ob= (Object *)idar[a];
- if(event==0 || event==2) ob->scaflag |= OB_SHOWCONT;
- else if(event==1) ob->scaflag &= ~OB_SHOWCONT;
- }
-
- for(a=0; a<count; a++) {
- ob= (Object *)idar[a];
- cont= ob->controllers.first;
- while(cont) {
- if(event==2) cont->flag |= CONT_SHOW;
- else if(event==3) cont->flag &= ~CONT_SHOW;
- cont= cont->next;
- }
- }
-
- if(idar) MEM_freeN(idar);
- allqueue(REDRAWBUTSLOGIC, 0);
-}
-
-static uiBlock *controller_menu(void *arg_unused)
-{
- uiBlock *block;
- int yco=0;
-
- block= uiNewBlock(&curarea->uiblocks, "filemenu", UI_EMBOSSP, UI_HELV, curarea->win);
- uiBlockSetButmFunc(block, do_controller_menu, NULL);
-
- uiDefBut(block, BUTM, 1, "Show Objects", 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefBut(block, BUTM, 1, "Hide Objects", 0,(short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefBut(block, SEPR, 0, "", 0, (short)(yco-=6), 160, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefBut(block, BUTM, 1, "Show Controllers", 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 2, 2, "");
- uiDefBut(block, BUTM, 1, "Hide Controllers", 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 3, 3, "");
-
- uiBlockSetDirection(block, UI_TOP);
-
- return block;
-}
-
-static void do_actuator_menu(void *arg, int event)
-{
- ID **idar;
- Object *ob;
- bActuator *act;
- short count, a;
-
- idar= get_selected_and_linked_obs(&count, G.buts->scaflag);
-
- for(a=0; a<count; a++) {
- ob= (Object *)idar[a];
- if(event==0 || event==2) ob->scaflag |= OB_SHOWACT;
- else if(event==1) ob->scaflag &= ~OB_SHOWACT;
- }
-
- for(a=0; a<count; a++) {
- ob= (Object *)idar[a];
- act= ob->actuators.first;
- while(act) {
- if(event==2) act->flag |= ACT_SHOW;
- else if(event==3) act->flag &= ~ACT_SHOW;
- act= act->next;
- }
- }
-
- if(idar) MEM_freeN(idar);
- allqueue(REDRAWBUTSLOGIC, 0);
-}
-
-static uiBlock *actuator_menu(void *arg_unused)
-{
- uiBlock *block;
- int xco=0;
-
- block= uiNewBlock(&curarea->uiblocks, "filemenu", UI_EMBOSSP, UI_HELV, curarea->win);
- uiBlockSetButmFunc(block, do_actuator_menu, NULL);
-
- uiDefBut(block, BUTM, 1, "Show Objects", 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefBut(block, BUTM, 1, "Hide Objects", 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefBut(block, SEPR, 0, "", 0, (short)(xco-=6), 160, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefBut(block, BUTM, 1, "Show Actuators", 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefBut(block, BUTM, 1, "Hide Actuators", 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 3, "");
-
- uiBlockSetDirection(block, UI_TOP);
-
- return block;
-}
-
-
-void buttons_enji(uiBlock *block, Object *ob)
-{
- uiDefButBitI(block, TOG, OB_SECTOR, B_SETSECTOR, "Sector",
- 10,205,65,19, &ob->gameflag, 0, 0, 0, 0,
- "All game elements should be in the Sector boundbox");
- uiDefButBitI(block, TOG, OB_PROP, B_SETPROP, "Prop",
- 75,205,65,19, &ob->gameflag, 0, 0, 0, 0,
- "An Object fixed within a sector");
- uiBlockSetCol(block, BUTPURPLE);
- uiDefButBitI(block, TOG, OB_ACTOR, B_SETACTOR, "Actor",
- 140,205,65,19, &ob->gameflag, 0, 0, 0, 0,
- "Objects that are evaluated by the engine ");
- if(ob->gameflag & OB_ACTOR) {
- uiDefButBitI(block, TOG, OB_DYNAMIC, B_SETDYNA, "Dynamic",
- 205,205,75,19, &ob->gameflag, 0, 0, 0, 0,
- "Motion defined by laws of physics");
- uiDefButBitI(block, TOG, OB_MAINACTOR, B_SETMAINACTOR, "MainActor",
- 280,205,70,19, &ob->gameflag, 0, 0, 0, 0, "");
-
- if(ob->gameflag & OB_DYNAMIC) {
- uiDefButBitI(block, TOG, OB_DO_FH, B_DIFF, "Do Fh",
- 10,185,50,19, &ob->gameflag, 0, 0, 0, 0,
- "Use Fh settings in Materials");
- uiDefButBitI(block, TOG, OB_ROT_FH, B_DIFF, "Rot Fh",
- 60,185,50,19, &ob->gameflag, 0, 0, 0, 0,
- "Use face normal to rotate Object");
-
- uiBlockSetCol(block, BUTGREY);
- uiDefButF(block, NUM, B_DIFF, "Mass:",
- 110, 185, 120, 19, &ob->mass, 0.01, 100.0, 10, 0,
- "The mass of the Object");
- uiDefButF(block, NUM, REDRAWVIEW3D, "Size:",
- 230, 185, 120, 19, &ob->inertia, 0.01, 10.0, 10, 0,
- "Bounding sphere size");
- uiDefButF(block, NUM, B_DIFF, "Damp:",
- 10, 165, 100, 19, &ob->damping, 0.0, 1.0, 10, 0,
- "General movement damping");
- uiDefButF(block, NUM, B_DIFF, "RotDamp:",
- 110, 165, 120, 19, &ob->rdamping, 0.0, 1.0, 10, 0,
- "General rotation damping");
- }
- }
-
-}
-
-void buttons_ketsji(uiBlock *block, Object *ob)
-{
- uiDefButBitI(block, TOG, OB_ACTOR, B_REDR, "Actor",
- 10,205,55,19, &ob->gameflag, 0, 0, 0, 0,
- "Objects that are evaluated by the engine ");
- if(ob->gameflag & OB_ACTOR) {
- uiDefButBitI(block, TOG, OB_GHOST, B_REDR, "Ghost", 65,205,55,19,
- &ob->gameflag, 0, 0, 0, 0,
- "Objects that don't restitute collisions (like a ghost)");
- uiDefButBitI(block, TOG, OB_DYNAMIC, B_REDR, "Dynamic", 120,205,70,19,
- &ob->gameflag, 0, 0, 0, 0,
- "Motion defined by laws of physics");
-
- if(ob->gameflag & OB_DYNAMIC) {
- uiDefButBitI(block, TOG, OB_RIGID_BODY, B_REDR, "Rigid Body", 190,205,80,19,
- &ob->gameflag, 0, 0, 0, 0,
- "Enable rolling physics");
- uiDefButBitI(block, TOG, OB_COLLISION_RESPONSE, B_REDR, "No sleeping", 270,205,80,19,
- &ob->gameflag, 0, 0, 0, 0,
- "Disable auto (de)activation");
-
- uiDefButBitI(block, TOG, OB_DO_FH, B_DIFF, "Do Fh", 10,185,50,19,
- &ob->gameflag, 0, 0, 0, 0,
- "Use Fh settings in Materials");
- uiDefButBitI(block, TOG, OB_ROT_FH, B_DIFF, "Rot Fh", 60,185,50,19,
- &ob->gameflag, 0, 0, 0, 0,
- "Use face normal to rotate Object");
- uiDefButF(block, NUM, B_DIFF, "Mass:", 110, 185, 80, 19,
- &ob->mass, 0.01, 10000.0, 10, 0,
- "The mass of the Object");
- uiDefButF(block, NUM, REDRAWVIEW3D, "Radius:", 190, 185, 80, 19,
- &ob->inertia, 0.01, 10.0, 10, 0,
- "Bounding sphere radius");
- uiDefButF(block, NUM, B_DIFF, "Form:", 270, 185, 80, 19,
- &ob->formfactor, 0.01, 100.0, 10, 0,
- "Form factor");
-
- uiDefButF(block, NUM, B_DIFF, "Damp:", 10, 165, 100, 19,
- &ob->damping, 0.0, 1.0, 10, 0,
- "General movement damping");
- uiDefButF(block, NUM, B_DIFF, "RotDamp:", 110, 165, 120, 19,
- &ob->rdamping, 0.0, 1.0, 10, 0,
- "General rotation damping");
- uiDefButBitI(block, TOG, OB_ANISOTROPIC_FRICTION, B_REDR, "Anisotropic",
- 230, 165, 120, 19,
- &ob->gameflag, 0.0, 1.0, 10, 0,
- "Enable anisotropic friction");
- }
-
- if (ob->gameflag & OB_ANISOTROPIC_FRICTION) {
- uiDefButF(block, NUM, B_DIFF, "x friction:", 10, 145, 114, 19,
- &ob->anisotropicFriction[0], 0.0, 1.0, 10, 0,
- "Relative friction coefficient in the x-direction.");
- uiDefButF(block, NUM, B_DIFF, "y friction:", 124, 145, 113, 19,
- &ob->anisotropicFriction[1], 0.0, 1.0, 10, 0,
- "Relative friction coefficient in the y-direction.");
- uiDefButF(block, NUM, B_DIFF, "z friction:", 237, 145, 113, 19,
- &ob->anisotropicFriction[2], 0.0, 1.0, 10, 0,
- "Relative friction coefficient in the z-direction.");
- }
- }
-
- if (!(ob->gameflag & OB_GHOST)) {
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, OB_BOUNDS, B_REDR, "Bounds", 10, 125, 75, 19,
- &ob->gameflag, 0, 0,0, 0,
- "Specify a bounds object for physics");
- if (ob->gameflag & OB_BOUNDS) {
- uiDefButS(block, MENU, REDRAWVIEW3D, "Boundary Display%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Convex Hull Polytope%x5|Static TriangleMesh %x4",
- 85, 125, 160, 19, &ob->boundtype, 0, 0, 0, 0, "Selects the collision type");
- uiDefButBitI(block, TOG, OB_CHILD, B_REDR, "Compound", 250,125,100,19,
- &ob->gameflag, 0, 0, 0, 0,
- "Add Children");
- }
- uiBlockEndAlign(block);
- }
-}
-
-void buttons_bullet(uiBlock *block, Object *ob)
-{
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, OB_ACTOR, B_REDR, "Actor",
- 10,205,55,19, &ob->gameflag, 0, 0, 0, 0,
- "Objects that are evaluated by the engine ");
- if(ob->gameflag & OB_ACTOR) {
- uiDefButBitI(block, TOG, OB_GHOST, B_REDR, "Ghost", 65,205,55,19,
- &ob->gameflag, 0, 0, 0, 0,
- "Objects that don't restitute collisions (like a ghost)");
- uiDefButBitI(block, TOG, OB_DYNAMIC, B_REDR, "Dynamic", 120,205,70,19,
- &ob->gameflag, 0, 0, 0, 0,
- "Motion defined by laws of physics");
-
- if(ob->gameflag & OB_DYNAMIC) {
- uiDefButBitI(block, TOG, OB_RIGID_BODY, B_REDR, "Rigid Body", 190,205,80,19,
- &ob->gameflag, 0, 0, 0, 0,
- "Enable rolling physics");
- uiDefButBitI(block, TOG, OB_COLLISION_RESPONSE, B_REDR, "No sleeping", 270,205,80,19,
- &ob->gameflag, 0, 0, 0, 0,
- "Disable auto (de)activation");
-
- uiDefButF(block, NUM, B_DIFF, "Mass:", 10, 185, 170, 19,
- &ob->mass, 0.01, 10000.0, 10, 2,
- "The mass of the Object");
- uiDefButF(block, NUM, REDRAWVIEW3D, "Radius:", 180, 185, 170, 19,
- &ob->inertia, 0.01, 10.0, 10, 2,
- "Bounding sphere radius");
-
- uiDefButF(block, NUMSLI, B_DIFF, "Damp ", 10, 165, 150, 19,
- &ob->damping, 0.0, 1.0, 10, 0,
- "General movement damping");
- uiDefButF(block, NUMSLI, B_DIFF, "RotDamp ", 160, 165, 190, 19,
- &ob->rdamping, 0.0, 1.0, 10, 0,
- "General rotation damping");
- }
- }
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, OB_BOUNDS, B_REDR, "Bounds", 10, 125, 75, 19,
- &ob->gameflag, 0, 0,0, 0,
- "Specify a bounds object for physics");
- if (ob->gameflag & OB_BOUNDS) {
- uiDefButS(block, MENU, REDRAWVIEW3D, "Boundary Display%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Convex Hull Polytope%x5|Static TriangleMesh %x4",
- //almost ready to enable this one: uiDefButS(block, MENU, REDRAWVIEW3D, "Boundary Display%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Convex Hull Polytope%x5|Static TriangleMesh %x4|Dynamic Mesh %x5|",
- 85, 125, 160, 19, &ob->boundtype, 0, 0, 0, 0, "Selects the collision type");
- uiDefButBitI(block, TOG, OB_CHILD, B_REDR, "Compound", 250,125,100,19,
- &ob->gameflag, 0, 0, 0, 0,
- "Add Children");
- }
- uiBlockEndAlign(block);
-}
-
-/* never used, see CVS 1.134 for the code */
-/* static FreeCamera *new_freecamera(void) */
-
-/* never used, see CVS 1.120 for the code */
-/* static uiBlock *freecamera_menu(void) */
-
-
-void logic_buts(void)
-{
- ID **idar;
- Object *ob;
- bProperty *prop;
- bSensor *sens;
- bController *cont;
- bActuator *act;
- uiBlock *block;
- uiBut *but;
- World *wrld;
- int a;
- short xco, yco, count, width, ycoo;
- char *pupstr, name[32];
-
- wrld= G.scene->world;
-
- ob= OBACT;
-
- if(ob==0) return;
- uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
-
- sprintf(name, "buttonswin %d", curarea->win);
- block= uiNewBlock(&curarea->uiblocks, name, UI_EMBOSS, UI_HELV, curarea->win);
-
- uiBlockSetCol(block, TH_BUT_SETTING2);
-
- if(wrld) {
- switch(wrld->physicsEngine) {
- case WOPHY_ENJI:
- buttons_enji(block, ob);
- break;
- case WOPHY_BULLET:
- buttons_bullet(block, ob);
- break;
- default:
- buttons_ketsji(block, ob);
- break;
- }
- }
- else buttons_ketsji(block, ob);
-
- uiBlockSetCol(block, TH_AUTO);
- uiBlockBeginAlign(block);
- uiDefBut(block, BUT, B_ADD_PROP, "Add Property", 10, 90, 340, 24,
- NULL, 0.0, 100.0, 100, 0,
- "");
-
- pupstr= "Types %t|Bool %x0|Int %x1|Float %x2|String %x3|Timer %x5";
-
- a= 0;
- prop= ob->prop.first;
- while(prop) {
- but= uiDefBut(block, BUT, 1, "Del", 10, (short)(70-20*a), 40, 20, NULL, 0.0, 0.0, 1, (float)a, "");
- uiButSetFunc(but, del_property, prop, NULL);
- uiDefButS(block, MENU, B_CHANGE_PROP, pupstr, 50, (short)(70-20*a), 60, 20, &prop->type, 0, 0, 0, 0, "");
- but= uiDefBut(block, TEX, 1, "Name:", 110, (short)(70-20*a), 110, 20, prop->name, 0, 31, 0, 0, "");
- uiButSetFunc(but, make_unique_prop_names_cb, prop->name, (void*) 1);
-
- if(prop->type==PROP_BOOL) {
- uiDefButBitI(block, TOG, 1, B_REDR, "True", 220, (short)(70-20*a), 55, 20, &prop->data, 0, 0, 0, 0, "");
- uiDefButBitI(block, TOGN, 1, B_REDR, "False", 270, (short)(70-20*a), 55, 20, &prop->data, 0, 0, 0, 0, "");
- }
- else if(prop->type==PROP_INT)
- uiDefButI(block, NUM, B_REDR, "", 220, (short)(70-20*a), 110, 20, &prop->data, -10000, 10000, 0, 0, "");
- else if(prop->type==PROP_FLOAT)
- uiDefButF(block, NUM, B_REDR, "", 220, (short)(70-20*a), 110, 20, (float*) &prop->data, -10000, 10000, 100, 3, "");
- else if(prop->type==PROP_STRING)
- uiDefBut(block, TEX, B_REDR, "", 220, (short)(70-20*a), 110, 20, prop->poin, 0, 127, 0, 0, "");
- else if(prop->type==PROP_TIME)
- uiDefButF(block, NUM, B_REDR, "", 220, (short)(70-20*a), 110, 20, (float*) &prop->data, -10000, 10000, 100, 3, "");
-
- uiDefButBitS(block, TOG, PROP_DEBUG, B_REDR, "D", 330, (short)(70-20*a), 20, 20, &prop->flag, 0, 0, 0, 0, "Print Debug info");
-
- a++;
- prop= prop->next;
-
- }
- uiBlockEndAlign(block);
-
- uiClearButLock();
-
- idar= get_selected_and_linked_obs(&count, G.buts->scaflag);
-
- /* ******************************* */
- xco= 375; yco= 170; width= 230;
-
- uiBlockSetEmboss(block, UI_EMBOSSP);
- uiDefBlockBut(block, sensor_menu, NULL, "Sensors", xco-10, yco+35, 80, 19, "");
- uiBlockSetEmboss(block, UI_EMBOSS);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, BUTS_SENS_SEL, B_REDR, "Sel", xco+110, yco+35, (width-100)/3, 19, &G.buts->scaflag, 0, 0, 0, 0, "Show all selected Objects");
- uiDefButBitS(block, TOG, BUTS_SENS_ACT, B_REDR, "Act", xco+110+(width-100)/3, yco+35, (width-100)/3, 19, &G.buts->scaflag, 0, 0, 0, 0, "Show active Object");
- uiDefButBitS(block, TOG, BUTS_SENS_LINK, B_REDR, "Link", xco+110+2*(width-100)/3, yco+35, (width-100)/3, 19, &G.buts->scaflag, 0, 0, 0, 0, "Show linked Objects to Controller");
- uiBlockEndAlign(block);
-
- for(a=0; a<count; a++) {
- ob= (Object *)idar[a];
- uiClearButLock();
- uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
-
- if( (ob->scavisflag & OB_VIS_SENS) == 0) continue;
-
- /* presume it is only objects for now */
- uiBlockSetEmboss(block, UI_EMBOSS);
- uiBlockBeginAlign(block);
- if(ob->sensors.first) uiSetCurFont(block, UI_HELVB);
- uiDefButBitS(block, TOG, OB_SHOWSENS, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), 19, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide sensors");
- if(ob->sensors.first) uiSetCurFont(block, UI_HELV);
- uiDefButBitS(block, TOG, OB_ADDSENS, B_ADD_SENS, "Add",(short)(xco+width-40), yco, 50, 19, &ob->scaflag, 0, 0, 0, 0, "Add a new Sensor");
- uiBlockEndAlign(block);
- yco-=20;
-
- if(ob->scaflag & OB_SHOWSENS) {
-
- sens= ob->sensors.first;
- while(sens) {
- uiBlockSetEmboss(block, UI_EMBOSSM);
- uiDefIconButBitS(block, TOG, SENS_DEL, B_DEL_SENS, ICON_X, xco, yco, 22, 19, &sens->flag, 0, 0, 0, 0, "Delete Sensor");
- uiDefIconButBitS(block, ICONTOG, SENS_SHOW, B_REDR, ICON_RIGHTARROW, (short)(xco+width-22), yco, 22, 19, &sens->flag, 0, 0, 0, 0, "Sensor settings");
-
- ycoo= yco;
- if(sens->flag & SENS_SHOW)
- {
- uiDefButS(block, MENU, B_CHANGE_SENS, sensor_pup(), (short)(xco+22), yco, 100, 19, &sens->type, 0, 0, 0, 0, "Sensor type");
- but= uiDefBut(block, TEX, 1, "", (short)(xco+122), yco, (short)(width-144), 19, sens->name, 0, 31, 0, 0, "Sensor name");
- uiButSetFunc(but, make_unique_prop_names_cb, sens->name, (void*) 0);
-
- sens->otype= sens->type;
- yco= draw_sensorbuttons(sens, block, xco, yco, width,ob->id.name);
- if(yco-6 < ycoo) ycoo= (yco+ycoo-20)/2;
- }
- else {
- set_col_sensor(sens->type, 1);
- glRecti(xco+22, yco, xco+width-22,yco+19);
- but= uiDefBut(block, LABEL, 0, sensor_name(sens->type), (short)(xco+22), yco, 100, 19, sens, 0, 0, 0, 0, "");
- uiButSetFunc(but, sca_move_sensor, sens, NULL);
- but= uiDefBut(block, LABEL, 0, sens->name, (short)(xco+122), yco, (short)(width-144), 19, sens, 0, 31, 0, 0, "");
- uiButSetFunc(but, sca_move_sensor, sens, NULL);
- }
-
- but= uiDefIconBut(block, LINK, 0, ICON_LINK, (short)(xco+width), ycoo, 19, 19, NULL, 0, 0, 0, 0, "");
- uiSetButLink(but, NULL, (void ***)&(sens->links), &sens->totlinks, LINK_SENSOR, LINK_CONTROLLER);
-
- yco-=20;
-
- sens= sens->next;
- }
- yco-= 6;
- }
- }
-
- /* ******************************* */
- xco= 675; yco= 170; width= 230;
-
- uiBlockSetEmboss(block, UI_EMBOSSP);
- uiDefBlockBut(block, controller_menu, NULL, "Controllers", xco-10, yco+35, 100, 19, "");
- uiBlockSetEmboss(block, UI_EMBOSS);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, BUTS_CONT_SEL, B_REDR, "Sel", xco+110, yco+35, (width-100)/3, 19, &G.buts->scaflag, 0, 0, 0, 0, "Show all selected Objects");
- uiDefButBitS(block, TOG, BUTS_CONT_ACT, B_REDR, "Act", xco+110+(width-100)/3, yco+35, (width-100)/3, 19, &G.buts->scaflag, 0, 0, 0, 0, "Show active Object");
- uiDefButBitS(block, TOG, BUTS_CONT_LINK, B_REDR, "Link", xco+110+2*(width-100)/3, yco+35, (width-100)/3, 19, &G.buts->scaflag, 0, 0, 0, 0, "Show linked Objects to Sensor/Actuator");
- uiBlockEndAlign(block);
-
- ob= OBACT;
-
- for(a=0; a<count; a++) {
- ob= (Object *)idar[a];
- uiClearButLock();
- uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
- if( (ob->scavisflag & OB_VIS_CONT) == 0) continue;
-
- /* presume it is only objects for now */
- uiBlockSetEmboss(block, UI_EMBOSS);
- uiBlockBeginAlign(block);
- if(ob->controllers.first) uiSetCurFont(block, UI_HELVB);
- uiDefButBitS(block, TOG, OB_SHOWCONT, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), 19, &ob->scaflag, 0, 0, 0, 0, "Active Object name");
- if(ob->controllers.first) uiSetCurFont(block, UI_HELV);
- uiDefButBitS(block, TOG, OB_ADDCONT, B_ADD_CONT, "Add",(short)(xco+width-40), yco, 50, 19, &ob->scaflag, 0, 0, 0, 0, "Add a new Controller");
- uiBlockEndAlign(block);
- yco-=20;
-
- if(ob->scaflag & OB_SHOWCONT) {
-
- cont= ob->controllers.first;
- while(cont) {
- uiBlockSetEmboss(block, UI_EMBOSSM);
- uiDefIconButBitS(block, TOG, CONT_DEL, B_DEL_CONT, ICON_X, xco, yco, 22, 19, &cont->flag, 0, 0, 0, 0, "Delete Controller");
- uiDefIconButBitS(block, ICONTOG, CONT_SHOW, B_REDR, ICON_RIGHTARROW, (short)(xco+width-22), yco, 22, 19, &cont->flag, 0, 0, 0, 0, "Controller settings");
-
- if(cont->flag & CONT_SHOW) {
- cont->otype= cont->type;
- uiDefButS(block, MENU, B_CHANGE_CONT, controller_pup(),(short)(xco+22), yco, 100, 19, &cont->type, 0, 0, 0, 0, "Controller type");
- but= uiDefBut(block, TEX, 1, "", (short)(xco+122), yco, (short)(width-144), 19, cont->name, 0, 31, 0, 0, "Controller name");
- uiButSetFunc(but, make_unique_prop_names_cb, cont->name, (void*) 0);
-
- ycoo= yco;
- yco= draw_controllerbuttons(cont, block, xco, yco, width);
- if(yco-6 < ycoo) ycoo= (yco+ycoo-20)/2;
- }
- else {
- cpack(0x999999);
- glRecti(xco+22, yco, xco+width-22,yco+19);
- but= uiDefBut(block, LABEL, 0, controller_name(cont->type), (short)(xco+22), yco, 100, 19, cont, 0, 0, 0, 0, "Controller type");
- uiButSetFunc(but, sca_move_controller, cont, NULL);
- but= uiDefBut(block, LABEL, 0, cont->name,(short)(xco+122), yco,(short)(width-144), 19, cont, 0, 0, 0, 0, "Controller name");
- uiButSetFunc(but, sca_move_controller, cont, NULL);
- ycoo= yco;
- }
-
- but= uiDefIconBut(block, LINK, 0, ICON_LINK, (short)(xco+width), ycoo, 19, 19, NULL, 0, 0, 0, 0, "");
- uiSetButLink(but, NULL, (void ***)&(cont->links), &cont->totlinks, LINK_CONTROLLER, LINK_ACTUATOR);
-
- uiDefIconBut(block, INLINK, 0, ICON_INLINK,(short)(xco-19), ycoo, 19, 19, cont, LINK_CONTROLLER, 0, 0, 0, "");
-
- yco-=20;
-
- cont= cont->next;
- }
- yco-= 6;
- }
- }
-
- /* ******************************* */
- xco= 985; yco= 170; width= 280;
-
- uiBlockSetEmboss(block, UI_EMBOSSP);
- uiDefBlockBut(block, actuator_menu, NULL, "Actuators", xco-10, yco+35, 100, 19, "");
- uiBlockSetEmboss(block, UI_EMBOSS);
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, BUTS_ACT_SEL, B_REDR, "Sel", xco+110, yco+35, (width-110)/3, 19, &G.buts->scaflag, 0, 0, 0, 0, "Show all selected Objects");
- uiDefButBitS(block, TOG, BUTS_ACT_ACT, B_REDR, "Act", xco+110+(width-110)/3, yco+35, (width-110)/3, 19, &G.buts->scaflag, 0, 0, 0, 0, "Show active Object");
- uiDefButBitS(block, TOG, BUTS_ACT_LINK, B_REDR, "Link", xco+110+2*(width-110)/3, yco+35, (width-110)/3, 19, &G.buts->scaflag, 0, 0, 0, 0, "Show linked Objects to Controller");
- uiBlockEndAlign(block);
- for(a=0; a<count; a++) {
- ob= (Object *)idar[a];
- uiClearButLock();
- uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
- if( (ob->scavisflag & OB_VIS_ACT) == 0) continue;
-
- /* presume it is only objects for now */
- uiBlockSetEmboss(block, UI_EMBOSS);
- uiBlockBeginAlign(block);
- if(ob->actuators.first) uiSetCurFont(block, UI_HELVB);
- uiDefButBitS(block, TOG, OB_SHOWACT, B_REDR, ob->id.name+2,(short)(xco-10), yco,(short)(width-30), 19, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide actuators");
- if(ob->actuators.first) uiSetCurFont(block, UI_HELV);
- uiDefButBitS(block, TOG, OB_ADDACT, B_ADD_ACT, "Add",(short)(xco+width-40), yco, 50, 19, &ob->scaflag, 0, 0, 0, 0, "Add a new Actuator");
- uiBlockEndAlign(block);
- yco-=20;
-
- if(ob->scaflag & OB_SHOWACT) {
-
- act= ob->actuators.first;
- while(act) {
- uiBlockSetEmboss(block, UI_EMBOSSM);
- uiDefIconButBitS(block, TOG, ACT_DEL, B_DEL_ACT, ICON_X, xco, yco, 22, 19, &act->flag, 0, 0, 0, 0, "Delete Actuator");
- uiDefIconButBitS(block, ICONTOG, ACT_SHOW, B_REDR, ICON_RIGHTARROW, (short)(xco+width-22), yco, 22, 19, &act->flag, 0, 0, 0, 0, "Actuator settings");
-
- if(act->flag & ACT_SHOW) {
- act->otype= act->type;
- uiDefButS(block, MENU, B_CHANGE_ACT, actuator_pup(ob), (short)(xco+22), yco, 100, 19, &act->type, 0, 0, 0, 0, "Actuator type");
- but= uiDefBut(block, TEX, 1, "", (short)(xco+122), yco, (short)(width-144), 19, act->name, 0, 31, 0, 0, "Actuator name");
- uiButSetFunc(but, make_unique_prop_names_cb, act->name, (void*) 0);
-
- ycoo= yco;
- yco= draw_actuatorbuttons(act, block, xco, yco, width);
- if(yco-6 < ycoo) ycoo= (yco+ycoo-20)/2;
- }
- else {
- set_col_actuator(act->type, 1);
- glRecti((short)(xco+22), yco, (short)(xco+width-22),(short)(yco+19));
- but= uiDefBut(block, LABEL, 0, actuator_name(act->type), (short)(xco+22), yco, 100, 19, act, 0, 0, 0, 0, "Actuator type");
- uiButSetFunc(but, sca_move_actuator, act, NULL);
- but= uiDefBut(block, LABEL, 0, act->name, (short)(xco+122), yco, (short)(width-144), 19, act, 0, 0, 0, 0, "Actuator name");
- uiButSetFunc(but, sca_move_actuator, act, NULL);
- ycoo= yco;
- }
-
- uiDefIconBut(block, INLINK, 0, ICON_INLINK,(short)(xco-19), ycoo, 19, 19, act, LINK_ACTUATOR, 0, 0, 0, "");
-
- yco-=20;
-
- act= act->next;
- }
- yco-= 6;
- }
- }
-
- uiComposeLinks(block);
- uiDrawBlock(block);
-
- if(idar) MEM_freeN(idar);
-}
-
diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c
deleted file mode 100644
index e5bb4dd8a10..00000000000
--- a/source/blender/src/buttons_object.c
+++ /dev/null
@@ -1,4749 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <time.h>
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_ID.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_scene_types.h"
-
-#include "BKE_action.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_library.h"
-#include "BKE_softbody.h"
-#include "BKE_utildefines.h"
-#include "BKE_particle.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "BSE_filesel.h"
-#include "BSE_headerbuttons.h"
-
-#include "BIF_butspace.h"
-#include "BIF_editaction.h"
-#include "BIF_editparticle.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-#include "BIF_graphics.h"
-#include "BIF_interface.h"
-#include "BIF_keyval.h"
-#include "BIF_mainqueue.h"
-#include "BIF_mywindow.h"
-#include "BIF_poseobject.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-#include "BIF_outliner.h"
-
-#include "BDR_drawobject.h"
-#include "BDR_editcurve.h"
-
-#include "mydevice.h"
-#include "blendef.h"
-
-/* -----includes for this file specific----- */
-
-
-#include "DNA_action_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_effect_types.h"
-#include "DNA_group_types.h"
-#include "DNA_image_types.h"
-#include "DNA_key_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_lattice_types.h"
-#include "DNA_material_types.h"
-#include "DNA_meta_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_modifier_types.h"
-#include "DNA_object_types.h"
-#include "DNA_object_force.h"
-#include "DNA_object_fluidsim.h"
-#include "DNA_particle_types.h"
-#include "DNA_radio_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_sound_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_vfont_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_world_types.h"
-#include "DNA_text_types.h"
-
-#include "BKE_anim.h"
-#include "BKE_armature.h"
-#include "BKE_constraint.h"
-#include "BKE_curve.h"
-#include "BKE_deform.h"
-#include "BKE_depsgraph.h"
-#include "BKE_displist.h"
-#include "BKE_effect.h"
-#include "BKE_font.h"
-#include "BKE_group.h"
-#include "BKE_image.h"
-#include "BKE_ipo.h"
-#include "BKE_lattice.h"
-#include "BKE_material.h"
-#include "BKE_mball.h"
-#include "BKE_mesh.h"
-#include "BKE_modifier.h"
-#include "BKE_object.h"
-#include "BKE_particle.h"
-#include "BKE_sound.h"
-#include "BKE_texture.h"
-#include "BKE_utildefines.h"
-#include "BKE_DerivedMesh.h"
-
-#include "LBM_fluidsim.h"
-#include "elbeem.h"
-
-#include "BIF_editconstraint.h"
-#include "BIF_editdeform.h"
-#include "BIF_editparticle.h"
-
-#include "BSE_editipo.h"
-#include "BSE_edit.h"
-
-#include "BDR_editobject.h"
-#include "BPY_extern.h"
-
-#include "butspace.h" // own module
-
-static float prspeed=0.0;
-float prlen=0.0;
-
-
-/* ********************* CONSTRAINT ***************************** */
-
-static void constraint_active_func(void *ob_v, void *con_v)
-{
- Object *ob= ob_v;
- bConstraint *con;
- ListBase *lb;
-
- /* lets be nice and escape if its active already */
- if(con_v) {
- con= con_v;
- if(con->flag & CONSTRAINT_ACTIVE) return;
- }
-
- lb= get_active_constraints(ob);
-
- for(con= lb->first; con; con= con->next) {
- if(con==con_v) con->flag |= CONSTRAINT_ACTIVE;
- else con->flag &= ~CONSTRAINT_ACTIVE;
- }
-
- /* make sure ipowin and buttons shows it */
- if(ob->ipowin==ID_CO) {
- allqueue(REDRAWIPO, ID_CO);
- allspace(REMAKEIPO, 0);
- allqueue(REDRAWNLA, 0);
- }
- allqueue(REDRAWBUTSOBJECT, 0);
-}
-
-static void add_constraint_to_active(Object *ob, bConstraint *con)
-{
- ListBase *list;
-
- list = get_active_constraints(ob);
- if (list) {
- unique_constraint_name(con, list);
- BLI_addtail(list, con);
-
- con->flag |= CONSTRAINT_ACTIVE;
- for(con= con->prev; con; con= con->prev)
- con->flag &= ~CONSTRAINT_ACTIVE;
- }
-}
-
-/* returns base ID for Ipo, sets actname to channel if appropriate */
-/* should not make action... */
-static void get_constraint_ipo_context(void *ob_v, char *actname)
-{
- Object *ob= ob_v;
-
- /* todo; check object if it has ob-level action ipo */
-
- if (ob->flag & OB_POSEMODE) {
- bPoseChannel *pchan;
-
- pchan = get_active_posechannel(ob);
- if (pchan) {
- BLI_strncpy(actname, pchan->name, 32);
- }
- }
- else if(ob->ipoflag & OB_ACTION_OB)
- strcpy(actname, "Object");
-}
-
-/* initialize UI to show Ipo window and make sure channels etc exist */
-static void enable_constraint_ipo_func (void *ob_v, void *con_v)
-{
- Object *ob= ob_v;
- bConstraint *con = con_v;
- char actname[32]="";
-
- /* verifies if active constraint is set and shown in UI */
- constraint_active_func(ob_v, con_v);
-
- /* the context */
- get_constraint_ipo_context(ob, actname);
-
- /* adds ipo & channels & curve if needed */
- if(con->flag & CONSTRAINT_OWN_IPO)
- verify_ipo((ID *)ob, ID_CO, NULL, con->name, actname);
- else
- verify_ipo((ID *)ob, ID_CO, actname, con->name, NULL);
-
- /* make sure ipowin shows it */
- ob->ipowin= ID_CO;
- allqueue(REDRAWIPO, ID_CO);
- allspace(REMAKEIPO, 0);
- allqueue(REDRAWNLA, 0);
-}
-
-
-static void add_influence_key_to_constraint_func (void *ob_v, void *con_v)
-{
- Object *ob= ob_v;
- bConstraint *con = con_v;
- IpoCurve *icu;
- char actname[32]="";
-
- /* verifies if active constraint is set and shown in UI */
- constraint_active_func(ob_v, con_v);
-
- /* the context */
- get_constraint_ipo_context(ob, actname);
-
- /* adds ipo & channels & curve if needed */
- if(con->flag & CONSTRAINT_OWN_IPO)
- icu= verify_ipocurve((ID *)ob, ID_CO, NULL, con->name, actname, CO_ENFORCE);
- else
- icu= verify_ipocurve((ID *)ob, ID_CO, actname, con->name, NULL, CO_ENFORCE);
-
- if (!icu) {
- error("Cannot get a curve from this IPO, may be dealing with linked data");
- return;
- }
-
- if(ob->action)
- insert_vert_icu(icu, get_action_frame(ob, (float)CFRA), con->enforce, 0);
- else
- insert_vert_icu(icu, CFRA, con->enforce, 0);
-
- /* make sure ipowin shows it */
- ob->ipowin= ID_CO;
- allqueue(REDRAWIPO, ID_CO);
- allspace(REMAKEIPO, 0);
- allqueue(REDRAWNLA, 0);
-
- BIF_undo_push("Insert Influence Key");
-}
-
-void del_constr_func (void *ob_v, void *con_v)
-{
- bConstraint *con= con_v;
- bConstraintChannel *chan;
- ListBase *lb;
-
- /* remove ipo channel */
- lb= get_active_constraint_channels(ob_v, 0);
- if(lb) {
- chan = get_constraint_channel(lb, con->name);
- if(chan) {
- if(chan->ipo) chan->ipo->id.us--;
- BLI_freelinkN(lb, chan);
- }
- }
- /* remove constraint itself */
- lb= get_active_constraints(ob_v);
- free_constraint_data (con);
- BLI_freelinkN(lb, con);
-
- constraint_active_func(ob_v, NULL);
-}
-
-static void del_constraint_func (void *ob_v, void *con_v)
-{
- del_constr_func (ob_v, con_v);
- BIF_undo_push("Delete constraint");
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWIPO, 0);
-}
-
-static void verify_constraint_name_func (void *con_v, void *name_v)
-{
- Object *ob= OBACT;
- bConstraint *con= con_v;
- char oldname[32];
-
- if (!con)
- return;
-
- /* put on the stack */
- BLI_strncpy(oldname, (char *)name_v, 32);
-
- rename_constraint(ob, con, oldname);
-
- constraint_active_func(ob, con);
- allqueue(REDRAWACTION, 0);
-}
-
-void const_moveUp(void *ob_v, void *con_v)
-{
- bConstraint *con, *constr= con_v;
- ListBase *conlist;
-
- if(constr->prev) {
- conlist = get_active_constraints(ob_v);
- for(con= conlist->first; con; con= con->next) {
- if(con==constr) {
- BLI_remlink(conlist, con);
- BLI_insertlink(conlist, con->prev->prev, con);
- break;
- }
- }
- }
-}
-
-static void constraint_moveUp(void *ob_v, void *con_v)
-{
- const_moveUp(ob_v, con_v);
- BIF_undo_push("Move constraint");
-}
-
-void const_moveDown(void *ob_v, void *con_v)
-{
- bConstraint *con, *constr= con_v;
- ListBase *conlist;
-
- if(constr->next) {
- conlist = get_active_constraints(ob_v);
- for(con= conlist->first; con; con= con->next) {
- if(con==constr) {
- BLI_remlink(conlist, con);
- BLI_insertlink(conlist, con->next, con);
- break;
- }
- }
- }
-}
-
-static void constraint_moveDown(void *ob_v, void *con_v)
-{
- const_moveDown(ob_v, con_v);
- BIF_undo_push("Move constraint");
-}
-
-/* autocomplete callback for buttons */
-void autocomplete_bone(char *str, void *arg_v)
-{
- Object *ob= (Object *)arg_v;
-
- if(ob==NULL || ob->pose==NULL) return;
-
- /* search if str matches the beginning of name */
- if(str[0]) {
- AutoComplete *autocpl= autocomplete_begin(str, 32);
- bPoseChannel *pchan;
-
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next)
- autocomplete_do_name(autocpl, pchan->name);
-
- autocomplete_end(autocpl, str);
- }
-}
-
-/* autocomplete callback for buttons */
-void autocomplete_vgroup(char *str, void *arg_v)
-{
- Object *ob= (Object *)arg_v;
-
- if(ob==NULL) return;
-
- /* search if str matches the beginning of a name */
- if(str[0]) {
- AutoComplete *autocpl= autocomplete_begin(str, 32);
- bDeformGroup *dg;
-
- for(dg= ob->defbase.first; dg; dg= dg->next)
- if(dg->name!=str)
- autocomplete_do_name(autocpl, dg->name);
-
- autocomplete_end(autocpl, str);
- }
-}
-
-/* pole angle callback */
-void con_kinematic_set_pole_angle(void *ob_v, void *con_v)
-{
- bConstraint *con= con_v;
- bKinematicConstraint *data = con->data;
-
- if(data->poletar) {
- if(data->flag & CONSTRAINT_IK_SETANGLE) {
- data->flag |= CONSTRAINT_IK_GETANGLE;
- data->flag &= ~CONSTRAINT_IK_SETANGLE;
- }
- else {
- data->flag &= ~CONSTRAINT_IK_GETANGLE;
- data->flag |= CONSTRAINT_IK_SETANGLE;
- }
- }
-}
-
-/* some commonly used macros in the constraints drawing code */
-#define is_armature_target(target) (target && target->type==OB_ARMATURE)
-#define is_armature_owner(ob) ((ob->type == OB_ARMATURE) && (ob->flag & OB_POSEMODE))
-#define is_geom_target(target) (target && (ELEM(target->type, OB_MESH, OB_LATTICE)) )
-
-/* Helper function for draw constraint - draws constraint space stuff
- * This function should not be called if no menus are required
- * owner/target: -1 = don't draw menu; 0= not posemode, 1 = posemode
- */
-static void draw_constraint_spaceselect (uiBlock *block, bConstraint *con, short xco, short yco, short owner, short target)
-{
- short tarx, ownx;
- short bwidth;
-
- /* calculate sizes and placement of menus */
- if (owner == -1) {
- bwidth = 125;
- tarx = 120;
- ownx = 0;
- }
- else if (target == -1) {
- bwidth = 125;
- tarx = 0;
- ownx = 120;
- }
- else {
- bwidth = 100;
- tarx = 95;
- ownx = tarx + bwidth;
- }
-
-
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "CSpace:", xco, yco, 80,18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- uiBlockBeginAlign(block);
-
- /* Target-Space */
- if (target == 1) {
- uiDefButC(block, MENU, B_CONSTRAINT_TEST, "Target Space %t|World Space %x0|Pose Space %x3|Local with Parent %x4|Local Space %x1",
- tarx, yco, bwidth, 18, &con->tarspace, 0, 0, 0, 0, "Choose space that target is evaluated in");
- }
- else if (target == 0) {
- uiDefButC(block, MENU, B_CONSTRAINT_TEST, "Target Space %t|World Space %x0|Local (Without Parent) Space %x1",
- tarx, yco, bwidth, 18, &con->tarspace, 0, 0, 0, 0, "Choose space that target is evaluated in");
- }
-
- /* Owner-Space */
- if (owner == 1) {
- uiDefButC(block, MENU, B_CONSTRAINT_TEST, "Owner Space %t|World Space %x0|Pose Space %x3|Local with Parent %x4|Local Space %x1",
- ownx, yco, bwidth, 18, &con->ownspace, 0, 0, 0, 0, "Choose space that owner is evaluated in");
- }
- else if (owner == 0) {
- uiDefButC(block, MENU, B_CONSTRAINT_TEST, "Owner Space %t|World Space %x0|Local (Without Parent) Space %x1",
- ownx, yco, bwidth, 18, &con->ownspace, 0, 0, 0, 0, "Choose space that owner is evaluated in");
- }
-
- uiBlockEndAlign(block);
-}
-
-/* draw panel showing settings for a constraint */
-static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, short *xco, short *yco)
-{
- Object *ob= OBACT;
- bConstraintTypeInfo *cti;
- uiBut *but;
- char typestr[32];
- short height, width = 265;
- int rb_col;
-
- cti= constraint_get_typeinfo(con);
- if (cti == NULL) {
- /* exception for 'Null' constraint - it doesn't have constraint typeinfo! */
- if (con->type == CONSTRAINT_TYPE_NULL)
- strcpy(typestr, "Null");
- else
- strcpy(typestr, "Unknown");
- }
- else
- strcpy(typestr, cti->name);
-
- /* unless button has own callback, it adds this callback to button */
- uiBlockSetFunc(block, constraint_active_func, ob, con);
-
- /* Draw constraint header */
- uiBlockSetEmboss(block, UI_EMBOSSN);
-
- /* rounded header */
- rb_col= (con->flag & CONSTRAINT_ACTIVE)?50:20;
- uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-1, width+40, 22, NULL, 5.0, 0.0,
- (con->flag & CONSTRAINT_EXPAND)?3:15 , rb_col-20, "");
-
- /* open/close */
- uiDefIconButBitS(block, ICONTOG, CONSTRAINT_EXPAND, B_CONSTRAINT_TEST, ICON_DISCLOSURE_TRI_RIGHT, *xco-10, *yco, 20, 20, &con->flag, 0.0, 0.0, 0.0, 0.0, "Collapse/Expand Constraint");
-
- /* up/down */
- uiBlockBeginAlign(block);
- uiBlockSetEmboss(block, UI_EMBOSS);
- but = uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, VICON_MOVE_UP, *xco+width-50, *yco, 16, 18, NULL, 0.0, 0.0, 0.0, 0.0, "Move constraint up in constraint stack");
- uiButSetFunc(but, constraint_moveUp, ob, con);
-
- but = uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, VICON_MOVE_DOWN, *xco+width-50+18, *yco, 16, 18, NULL, 0.0, 0.0, 0.0, 0.0, "Move constraint down in constraint stack");
- uiButSetFunc(but, constraint_moveDown, ob, con);
- uiBlockEndAlign(block);
-
- if (con->flag & CONSTRAINT_EXPAND) {
- if (con->flag & CONSTRAINT_DISABLE)
- uiBlockSetCol(block, TH_REDALERT);
-
- uiBlockSetEmboss(block, UI_EMBOSS);
-
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, typestr, *xco+10, *yco, 100, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- but = uiDefBut(block, TEX, B_CONSTRAINT_TEST, "", *xco+120, *yco, 85, 18, con->name, 0.0, 29.0, 0.0, 0.0, "Constraint name");
- uiButSetFunc(but, verify_constraint_name_func, con, NULL);
- }
- else {
- uiBlockSetEmboss(block, UI_EMBOSSN);
-
- if (con->flag & CONSTRAINT_DISABLE)
- uiBlockSetCol(block, TH_REDALERT);
-
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, typestr, *xco+10, *yco, 100, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, con->name, *xco+120, *yco-1, 135, 19, NULL, 0.0, 0.0, 0.0, 0.0, "");
- }
-
- uiBlockSetCol(block, TH_AUTO);
-
- uiBlockSetEmboss(block, UI_EMBOSSN);
-
- but = uiDefIconBut(block, BUT, B_CONSTRAINT_CHANGETARGET, ICON_X, *xco+262, *yco, 19, 19, list, 0.0, 0.0, 0.0, 0.0, "Delete constraint");
- uiButSetFunc(but, del_constraint_func, ob, con);
-
- uiBlockSetEmboss(block, UI_EMBOSS);
-
-
- /* Draw constraint data */
- if ((con->flag & CONSTRAINT_EXPAND) == 0) {
- (*yco) -= 21;
- }
- else {
- switch (con->type) {
- case CONSTRAINT_TYPE_PYTHON:
- {
- bPythonConstraint *data = con->data;
- bConstraintTarget *ct;
- uiBut *but2;
- int tarnum, theight;
- static int pyconindex=0;
- char *menustr;
-
- theight = (data->tarnum)? (data->tarnum * 38) : (38);
- height = theight + 78;
- uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+40, height-1, NULL, 5.0, 0.0, 12, rb_col, "");
-
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Script:", *xco+60, *yco-24, 55, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- /* do the scripts menu */
- menustr = buildmenu_pyconstraints(data->text, &pyconindex);
- but2 = uiDefButI(block, MENU, B_CONSTRAINT_TEST, menustr,
- *xco+120, *yco-24, 150, 20, &pyconindex,
- 0.0, 1.0, 0, 0, "Set the Script Constraint to use");
- uiButSetFunc(but2, validate_pyconstraint_cb, data, &pyconindex);
- MEM_freeN(menustr);
-
- /* draw target(s) */
- if (data->flag & PYCON_USETARGETS) {
- /* Draw target parameters */
- for (ct=data->targets.first, tarnum=1; ct; ct=ct->next, tarnum++) {
- char tarstr[32];
- short yoffset= ((tarnum-1) * 38);
-
- /* target label */
- sprintf(tarstr, "Target %02d:", tarnum);
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, tarstr, *xco+45, *yco-(48+yoffset), 60, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- /* target space-selector - per target */
- if (is_armature_target(ct->tar)) {
- uiDefButS(block, MENU, B_CONSTRAINT_TEST, "Target Space %t|World Space %x0|Pose Space %x3|Local with Parent %x4|Local Space %x1",
- *xco+10, *yco-(66+yoffset), 100, 18, &ct->space, 0, 0, 0, 0, "Choose space that target is evaluated in");
- }
- else {
- uiDefButS(block, MENU, B_CONSTRAINT_TEST, "Target Space %t|World Space %x0|Local (Without Parent) Space %x1",
- *xco+10, *yco-(66+yoffset), 100, 18, &ct->space, 0, 0, 0, 0, "Choose space that target is evaluated in");
- }
-
- uiBlockBeginAlign(block);
- /* target object */
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CONSTRAINT_CHANGETARGET, "OB:", *xco+120, *yco-(48+yoffset), 150, 18, &ct->tar, "Target Object");
-
- /* subtarget */
- if (is_armature_target(ct->tar)) {
- but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", *xco+120, *yco-(66+yoffset),150,18, &ct->subtarget, 0, 24, 0, 0, "Subtarget Bone");
- uiButSetCompleteFunc(but, autocomplete_bone, (void *)ct->tar);
- }
- else if (is_geom_target(ct->tar)) {
- but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "VG:", *xco+120, *yco-(66+yoffset),150,18, &ct->subtarget, 0, 24, 0, 0, "Name of Vertex Group defining 'target' points");
- uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)ct->tar);
- }
- else {
- strcpy(ct->subtarget, "");
- }
- uiBlockEndAlign(block);
- }
- }
- else {
- /* Draw indication that no target needed */
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", *xco+60, *yco-48, 55, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Not Applicable", *xco+120, *yco-48, 150, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
- }
-
- /* settings */
- uiBlockBeginAlign(block);
- but=uiDefBut(block, BUT, B_CONSTRAINT_TEST, "Options", *xco, *yco-(52+theight), (width/2),18, NULL, 0, 24, 0, 0, "Change some of the constraint's settings.");
- uiButSetFunc(but, BPY_pyconstraint_settings, data, NULL);
-
- but=uiDefBut(block, BUT, B_CONSTRAINT_TEST, "Refresh", *xco+((width/2)+10), *yco-(52+theight), (width/2),18, NULL, 0, 24, 0, 0, "Force constraint to refresh it's settings");
- uiBlockEndAlign(block);
-
- /* constraint space settings */
- draw_constraint_spaceselect(block, con, *xco, *yco-(73+theight), is_armature_owner(ob), -1);
- }
- break;
- case CONSTRAINT_TYPE_ACTION:
- {
- bActionConstraint *data = con->data;
- float minval, maxval;
-
- height = 108;
- uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+40,height-1, NULL, 5.0, 0.0, 12, rb_col, "");
-
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", *xco+65, *yco-24, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- /* Draw target parameters */
- uiBlockBeginAlign(block);
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CONSTRAINT_CHANGETARGET, "OB:", *xco+120, *yco-24, 135, 18, &data->tar, "Target Object");
-
- if (is_armature_target(data->tar)) {
- but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", *xco+120, *yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone");
- uiButSetCompleteFunc(but, autocomplete_bone, (void *)data->tar);
- }
- else {
- strcpy(data->subtarget, "");
- }
-
- uiBlockEndAlign(block);
-
- /* Draw action/type buttons */
- uiBlockBeginAlign(block);
- uiDefIDPoinBut(block, test_actionpoin_but, ID_AC, B_CONSTRAINT_TEST, "AC:", *xco+((width/2)-117), *yco-64, 78, 18, &data->act, "Action containing the keyed motion for this bone");
- uiDefButS(block, MENU, B_CONSTRAINT_TEST, "Key on%t|Loc X%x20|Loc Y%x21|Loc Z%x22|Rot X%x0|Rot Y%x1|Rot Z%x2|Size X%x10|Size Y%x11|Size Z%x12", *xco+((width/2)-117), *yco-84, 78, 18, &data->type, 0, 24, 0, 0, "Specify which transformation channel from the target is used to key the action");
- uiBlockEndAlign(block);
-
- /* Draw start/end frame buttons */
- uiBlockBeginAlign(block);
- uiDefButI(block, NUM, B_CONSTRAINT_TEST, "Start:", *xco+((width/2)-36), *yco-64, 78, 18, &data->start, 1, MAXFRAME, 0.0, 0.0, "Starting frame of the keyed motion");
- uiDefButI(block, NUM, B_CONSTRAINT_TEST, "End:", *xco+((width/2)-36), *yco-84, 78, 18, &data->end, 1, MAXFRAME, 0.0, 0.0, "Ending frame of the keyed motion");
- uiBlockEndAlign(block);
-
- /* Draw minimum/maximum transform range buttons */
- uiBlockBeginAlign(block);
- if (data->type < 10) { /* rotation */
- minval = -180.0f;
- maxval = 180.0f;
- }
- else if (data->type < 20) { /* scaling */
- minval = 0.0001f;
- maxval = 1000.0f;
- }
- else { /* location */
- minval = -1000.0f;
- maxval = 1000.0f;
- }
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Min:", *xco+((width/2)+45), *yco-64, 78, 18, &data->min, minval, maxval, 0, 0, "Minimum value for target channel range");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Max:", *xco+((width/2)+45), *yco-84, 78, 18, &data->max, minval, maxval, 0, 0, "Maximum value for target channel range");
- uiBlockEndAlign(block);
-
- /* constraint space settings */
- draw_constraint_spaceselect(block, con, *xco, *yco-104, -1, is_armature_target(data->tar));
- }
- break;
- case CONSTRAINT_TYPE_CHILDOF:
- {
- bChildOfConstraint *data = con->data;
- short normButWidth = (width/3);
-
- height = 165;
- uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+40,height-1, NULL, 5.0, 0.0, 12, rb_col, "");
-
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Parent:", *xco+65, *yco-24, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- /* Draw target parameters */
- uiBlockBeginAlign(block);
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CONSTRAINT_CHANGETARGET, "OB:", *xco+120, *yco-24, 135, 18, &data->tar, "Target Object to use as Parent");
-
- if (is_armature_target(data->tar)) {
- but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", *xco+120, *yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone to use as Parent");
- uiButSetCompleteFunc(but, autocomplete_bone, (void *)data->tar);
- }
- else if (is_geom_target(data->tar)) {
- but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "VG:", *xco+120, *yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Name of Vertex Group defining 'target' points");
- uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)data->tar);
- }
- else {
- strcpy(data->subtarget, "");
- }
- uiBlockEndAlign(block);
-
- /* Draw triples of channel toggles */
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Use Channel(s):", *xco+65, *yco-64, 150, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, CHILDOF_LOCX, B_CONSTRAINT_TEST, "Loc X", *xco, *yco-84, normButWidth, 18, &data->flag, 0, 24, 0, 0, "Parent affects x-location");
- uiDefButBitI(block, TOG, CHILDOF_LOCY, B_CONSTRAINT_TEST, "Loc Y", *xco+normButWidth, *yco-84, normButWidth, 18, &data->flag, 0, 24, 0, 0, "Parent affects y-location");
- uiDefButBitI(block, TOG, CHILDOF_LOCZ, B_CONSTRAINT_TEST, "Loc Z", *xco+(normButWidth * 2), *yco-84, normButWidth, 18, &data->flag, 0, 24, 0, 0, "Parent affects z-location");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, CHILDOF_ROTX, B_CONSTRAINT_TEST, "Rot X", *xco, *yco-105, normButWidth, 18, &data->flag, 0, 24, 0, 0, "Parent affects x-rotation");
- uiDefButBitI(block, TOG, CHILDOF_ROTY, B_CONSTRAINT_TEST, "Rot Y", *xco+normButWidth, *yco-105, normButWidth, 18, &data->flag, 0, 24, 0, 0, "Parent affects y-rotation");
- uiDefButBitI(block, TOG, CHILDOF_ROTZ, B_CONSTRAINT_TEST, "Rot Z", *xco+(normButWidth * 2), *yco-105, normButWidth, 18, &data->flag, 0, 24, 0, 0, "Parent affects z-rotation");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, CHILDOF_SIZEX, B_CONSTRAINT_TEST, "Scale X", *xco, *yco-126, normButWidth, 18, &data->flag, 0, 24, 0, 0, "Parent affects x-scaling");
- uiDefButBitI(block, TOG, CHILDOF_SIZEY, B_CONSTRAINT_TEST, "Scale Y", *xco+normButWidth, *yco-126, normButWidth, 18, &data->flag, 0, 24, 0, 0, "Parent affects y-scaling");
- uiDefButBitI(block, TOG, CHILDOF_SIZEZ, B_CONSTRAINT_TEST, "Scale Z", *xco+(normButWidth * 2), *yco-126, normButWidth, 18, &data->flag, 0, 24, 0, 0, "Parent affects z-scaling");
- uiBlockEndAlign(block);
-
-
- /* Inverse options */
- uiBlockBeginAlign(block);
- but=uiDefBut(block, BUT, B_CONSTRAINT_TEST, "Set Offset", *xco, *yco-151, (width/2),18, NULL, 0, 24, 0, 0, "Calculate current Parent-Inverse Matrix (i.e. restore offset from parent)");
- uiButSetFunc(but, childof_const_setinv, data, NULL);
-
- but=uiDefBut(block, BUT, B_CONSTRAINT_TEST, "Clear Offset", *xco+((width/2)+10), *yco-151, (width/2),18, NULL, 0, 24, 0, 0, "Clear Parent-Inverse Matrix (i.e. clear offset from parent)");
- uiButSetFunc(but, childof_const_clearinv, data, NULL);
- uiBlockEndAlign(block);
- }
- break;
- case CONSTRAINT_TYPE_LOCLIKE:
- {
- bLocateLikeConstraint *data = con->data;
-
- height = 111;
- uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+40,height-1, NULL, 5.0, 0.0, 12, rb_col, "");
-
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", *xco+65, *yco-24, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- /* Draw target parameters */
- uiBlockBeginAlign(block);
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CONSTRAINT_CHANGETARGET, "OB:", *xco+120, *yco-24, 135, 18, &data->tar, "Target Object");
-
- if (is_armature_target(data->tar)) {
- but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", *xco+120, *yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone");
- uiButSetCompleteFunc(but, autocomplete_bone, (void *)data->tar);
- }
- else if (is_geom_target(data->tar)) {
- but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "VG:", *xco+120, *yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Name of Vertex Group defining 'target' points");
- uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)data->tar);
- }
- else {
- strcpy(data->subtarget, "");
- }
- uiBlockEndAlign(block);
-
- /* Draw XYZ toggles */
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, LOCLIKE_X, B_CONSTRAINT_TEST, "X", *xco+((width/2)-48), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Copy X component");
- uiDefButBitI(block, TOG, LOCLIKE_X_INVERT, B_CONSTRAINT_TEST, "-", *xco+((width/2)-16), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Invert X component");
- uiDefButBitI(block, TOG, LOCLIKE_Y, B_CONSTRAINT_TEST, "Y", *xco+((width/2)+16), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Copy Y component");
- uiDefButBitI(block, TOG, LOCLIKE_Y_INVERT, B_CONSTRAINT_TEST, "-", *xco+((width/2)+48), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Invert Y component");
- uiDefButBitI(block, TOG, LOCLIKE_Z, B_CONSTRAINT_TEST, "Z", *xco+((width/2)+96), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Copy Z component");
- uiDefButBitI(block, TOG, LOCLIKE_Z_INVERT, B_CONSTRAINT_TEST, "-", *xco+((width/2)+128), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Invert Z component");
- uiBlockEndAlign(block);
-
- /* Draw options */
- uiDefButBitI(block, TOG, LOCLIKE_OFFSET, B_CONSTRAINT_TEST, "Offset", *xco, *yco-89, (width/2), 18, &data->flag, 0, 24, 0, 0, "Add original location onto copied location");
- if (is_armature_target(data->tar)) {
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Head/Tail:", *xco+(width/2), *yco-89, (width/2), 18, &con->headtail, 0.0, 1, 0.1, 0.1, "Target along length of bone: Head=0, Tail=1");
- }
-
- /* constraint space settings */
- draw_constraint_spaceselect(block, con, *xco, *yco-109, is_armature_owner(ob), is_armature_target(data->tar));
- }
- break;
- case CONSTRAINT_TYPE_ROTLIKE:
- {
- bRotateLikeConstraint *data = con->data;
-
- height = 101;
- uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+40,height-1, NULL, 5.0, 0.0, 12, rb_col, "");
-
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", *xco+65, *yco-24, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- /* Draw target parameters */
- uiBlockBeginAlign(block);
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CONSTRAINT_CHANGETARGET, "OB:", *xco+120, *yco-24, 135, 18, &data->tar, "Target Object");
-
- if (is_armature_target(data->tar)) {
- but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", *xco+120, *yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone");
- uiButSetCompleteFunc(but, autocomplete_bone, (void *)data->tar);
- }
- else if (is_geom_target(data->tar)) {
- but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "VG:", *xco+120, *yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Name of Vertex Group defining 'target' points");
- uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)data->tar);
- }
- else {
- strcpy(data->subtarget, "");
- }
- uiBlockEndAlign(block);
-
- /* Draw XYZ toggles */
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, ROTLIKE_X, B_CONSTRAINT_TEST, "X", *xco+((width/2)-48), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Copy X component");
- uiDefButBitI(block, TOG, ROTLIKE_X_INVERT, B_CONSTRAINT_TEST, "-", *xco+((width/2)-16), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Invert X component");
- uiDefButBitI(block, TOG, ROTLIKE_Y, B_CONSTRAINT_TEST, "Y", *xco+((width/2)+16), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Copy Y component");
- uiDefButBitI(block, TOG, ROTLIKE_Y_INVERT, B_CONSTRAINT_TEST, "-", *xco+((width/2)+48), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Invert Y component");
- uiDefButBitI(block, TOG, ROTLIKE_Z, B_CONSTRAINT_TEST, "Z", *xco+((width/2)+96), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Copy Z component");
- uiDefButBitI(block, TOG, ROTLIKE_Z_INVERT, B_CONSTRAINT_TEST, "-", *xco+((width/2)+128), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Invert Z component");
- uiBlockEndAlign(block);
-
- /* draw offset toggle */
- uiDefButBitI(block, TOG, ROTLIKE_OFFSET, B_CONSTRAINT_TEST, "Offset", *xco, *yco-64, 80, 18, &data->flag, 0, 24, 0, 0, "Add original rotation onto copied rotation");
-
- /* constraint space settings */
- draw_constraint_spaceselect(block, con, *xco, *yco-94, is_armature_owner(ob), is_armature_target(data->tar));
- }
- break;
- case CONSTRAINT_TYPE_SIZELIKE:
- {
- bSizeLikeConstraint *data = con->data;
-
- height = 101;
-
- uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+40,height-1, NULL, 5.0, 0.0, 12, rb_col, "");
-
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", *xco+65, *yco-24, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- /* Draw target parameters */
- uiBlockBeginAlign(block);
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CONSTRAINT_CHANGETARGET, "OB:", *xco+120, *yco-24, 135, 18, &data->tar, "Target Object");
-
- if (is_armature_target(data->tar)) {
- but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", *xco+120, *yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone");
- uiButSetCompleteFunc(but, autocomplete_bone, (void *)data->tar);
- }
- else if (is_geom_target(data->tar)) {
- but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "VG:", *xco+120, *yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Name of Vertex Group defining 'target' points");
- uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)data->tar);
- }
- else {
- strcpy(data->subtarget, "");
- }
- uiBlockEndAlign(block);
-
- /* Draw XYZ toggles */
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, SIZELIKE_X, B_CONSTRAINT_TEST, "X", *xco+((width/2)-48), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Copy X component");
- uiDefButBitI(block, TOG, SIZELIKE_Y, B_CONSTRAINT_TEST, "Y", *xco+((width/2)-16), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Copy Y component");
- uiDefButBitI(block, TOG, SIZELIKE_Z, B_CONSTRAINT_TEST, "Z", *xco+((width/2)+16), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Copy Z component");
- uiBlockEndAlign(block);
-
- /* draw offset toggle */
- uiDefButBitI(block, TOG, SIZELIKE_OFFSET, B_CONSTRAINT_TEST, "Offset", *xco, *yco-64, 80, 18, &data->flag, 0, 24, 0, 0, "Add original scaling onto copied scaling");
-
- /* constraint space settings */
- draw_constraint_spaceselect(block, con, *xco, *yco-94, is_armature_owner(ob), is_armature_target(data->tar));
- }
- break;
- case CONSTRAINT_TYPE_KINEMATIC:
- {
- bKinematicConstraint *data = con->data;
-
- height = 146;
- if(data->poletar)
- height += 30;
-
- uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+40,height-1, NULL, 5.0, 0.0, 12, rb_col, "");
-
- /* IK Target */
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", *xco, *yco-24, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- /* Draw target parameters */
- uiBlockBeginAlign(block);
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CONSTRAINT_CHANGETARGET, "OB:", *xco, *yco-44, 137, 19, &data->tar, "Target Object");
-
- if (is_armature_target(data->tar)) {
- but=uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", *xco, *yco-62,137,19, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone");
- uiButSetCompleteFunc(but, autocomplete_bone, (void *)data->tar);
- }
- else if (is_geom_target(data->tar)) {
- but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "VG:", *xco, *yco-62,137,18, &data->subtarget, 0, 24, 0, 0, "Name of Vertex Group defining 'target' points");
- uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)data->tar);
- }
- else {
- strcpy (data->subtarget, "");
- }
-
- uiBlockEndAlign(block);
-
- /* Settings */
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, CONSTRAINT_IK_TIP, B_CONSTRAINT_TEST, "Use Tail", *xco, *yco-92, 137, 19, &data->flag, 0, 0, 0, 0, "Include Bone's tail als last element in Chain");
- uiDefButS(block, NUM, B_CONSTRAINT_TEST, "ChainLen:", *xco, *yco-112,137,19, &data->rootbone, 0, 255, 0, 0, "If not zero, the amount of bones in this chain");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_CONSTRAINT_TEST, "PosW ", *xco+147, *yco-92, 137, 19, &data->weight, 0.01, 1.0, 2, 2, "For Tree-IK: weight of position control for this target");
- uiDefButBitS(block, TOG, CONSTRAINT_IK_ROT, B_CONSTRAINT_TEST, "Rot", *xco+147, *yco-112, 40,19, &data->flag, 0, 0, 0, 0, "Chain follows rotation of target");
- uiDefButF(block, NUMSLI, B_CONSTRAINT_TEST, "W ", *xco+187, *yco-112, 97, 19, &data->orientweight, 0.01, 1.0, 2, 2, "For Tree-IK: Weight of orientation control for this target");
-
- uiBlockBeginAlign(block);
-
- uiDefButBitS(block, TOG, CONSTRAINT_IK_STRETCH, B_CONSTRAINT_TEST, "Stretch", *xco, *yco-137,137,19, &data->flag, 0, 0, 0, 0, "Enable IK stretching");
- uiBlockBeginAlign(block);
- uiDefButS(block, NUM, B_CONSTRAINT_TEST, "Iterations:", *xco+147, *yco-137, 137, 19, &data->iterations, 1, 10000, 0, 0, "Maximum number of solving iterations");
- uiBlockEndAlign(block);
-
- /* Pole Vector */
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Pole Target:", *xco+147, *yco-24, 100, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- uiBlockBeginAlign(block);
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CONSTRAINT_CHANGETARGET, "OB:", *xco+147, *yco-44, 137, 19, &data->poletar, "Pole Target Object");
- if (is_armature_target(data->poletar)) {
- but=uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", *xco+147, *yco-62,137,19, &data->polesubtarget, 0, 24, 0, 0, "Pole Subtarget Bone");
- uiButSetCompleteFunc(but, autocomplete_bone, (void *)data->poletar);
- }
- else if (is_geom_target(data->poletar)) {
- but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "VG:", *xco+147, *yco-62,137,18, &data->polesubtarget, 0, 24, 0, 0, "Name of Vertex Group defining pole 'target' points");
- uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)data->poletar);
- }
- else {
- strcpy (data->polesubtarget, "");
- }
-
- if(data->poletar) {
- uiBlockBeginAlign(block);
-#if 0
- but = uiDefBut(block, BUT, B_CONSTRAINT_TEST, (data->flag & CONSTRAINT_IK_SETANGLE)? "Set Pole Offset": "Clear Pole Offset", *xco, *yco-167, 137, 19, 0, 0.0, 1.0, 0.0, 0.0, "Set the pole rotation offset from the current pose");
- uiButSetFunc(but, con_kinematic_set_pole_angle, ob, con);
- if(!(data->flag & CONSTRAINT_IK_SETANGLE))
-#endif
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Pole Offset ", *xco, *yco-167, 137, 19, &data->poleangle, -180.0, 180.0, 0, 0, "Pole rotation offset");
- }
- }
- break;
- case CONSTRAINT_TYPE_TRACKTO:
- {
- bTrackToConstraint *data = con->data;
-
- if (is_armature_target(data->tar))
- height = 118;
- else
- height = 96;
-
- uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+40,height-1, NULL, 5.0, 0.0, 12, rb_col, "");
-
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", *xco+65, *yco-24, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- /* Draw target parameters */
- uiBlockBeginAlign(block);
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CONSTRAINT_CHANGETARGET, "OB:", *xco+120, *yco-24, 135, 18, &data->tar, "Target Object");
-
- if (is_armature_target(data->tar)) {
- but=uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", *xco+120, *yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone");
- uiButSetCompleteFunc(but, autocomplete_bone, (void *)data->tar);
- }
- else if (is_geom_target(data->tar)) {
- but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "VG:", *xco+120, *yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Name of Vertex Group defining 'target' points");
- uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)data->tar);
- }
- else {
- strcpy(data->subtarget, "");
- }
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Align:", *xco+5, *yco-42, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- uiDefButBitI(block, TOG, 1, B_CONSTRAINT_TEST, "TargetZ", *xco+60, *yco-42, 50, 18, &data->flags, 0, 1, 0, 0, "Target Z axis, not world Z axis, will constrain up direction");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "To:", *xco+12, *yco-64, 25, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- uiDefButI(block, ROW,B_CONSTRAINT_TEST,"X", *xco+39, *yco-64,17,18, &data->reserved1, 12.0, 0.0, 0, 0, "X axis points to the target object");
- uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Y", *xco+56, *yco-64,17,18, &data->reserved1, 12.0, 1.0, 0, 0, "Y axis points to the target object");
- uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Z", *xco+73, *yco-64,17,18, &data->reserved1, 12.0, 2.0, 0, 0, "Z axis points to the target object");
- uiDefButI(block, ROW,B_CONSTRAINT_TEST,"-X", *xco+90, *yco-64,24,18, &data->reserved1, 12.0, 3.0, 0, 0, "-X axis points to the target object");
- uiDefButI(block, ROW,B_CONSTRAINT_TEST,"-Y", *xco+114, *yco-64,24,18, &data->reserved1, 12.0, 4.0, 0, 0, "-Y axis points to the target object");
- uiDefButI(block, ROW,B_CONSTRAINT_TEST,"-Z", *xco+138, *yco-64,24,18, &data->reserved1, 12.0, 5.0, 0, 0, "-Z axis points to the target object");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Up:", *xco+174, *yco-64, 30, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- uiDefButI(block, ROW,B_CONSTRAINT_TEST,"X", *xco+204, *yco-64,17,18, &data->reserved2, 13.0, 0.0, 0, 0, "X axis points upward");
- uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Y", *xco+221, *yco-64,17,18, &data->reserved2, 13.0, 1.0, 0, 0, "Y axis points upward");
- uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Z", *xco+238, *yco-64,17,18, &data->reserved2, 13.0, 2.0, 0, 0, "Z axis points upward");
- uiBlockEndAlign(block);
-
- if (is_armature_target(data->tar)) {
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Head/Tail:", *xco, *yco-94, 241, 18, &con->headtail, 0.0, 1, 0.1, 0.1, "Target along length of bone: Head=0, Tail=1");
-
- /* constraint space settings */
- draw_constraint_spaceselect(block, con, *xco, *yco-116, is_armature_owner(ob), is_armature_target(data->tar));
- }
- else {
- /* constraint space settings */
- draw_constraint_spaceselect(block, con, *xco, *yco-94, is_armature_owner(ob), is_armature_target(data->tar));
- }
- }
- break;
- case CONSTRAINT_TYPE_MINMAX:
- {
- bMinMaxConstraint *data = con->data;
-
- if (is_armature_target(data->tar))
- height = 88;
- else
- height = 66;
-
- uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+40,height-1, NULL, 5.0, 0.0, 12, rb_col, "");
-
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", *xco+65, *yco-24, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Offset:", *xco, *yco-44, 100, 18, &data->offset, -100, 100, 100.0, 0.0, "Offset from the position of the object center");
-
- /* Draw target parameters */
- uiBlockBeginAlign(block);
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CONSTRAINT_CHANGETARGET, "OB:", *xco+120, *yco-24, 135, 18, &data->tar, "Target Object");
-
- if (is_armature_target(data->tar)) {
- but=uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", *xco+120, *yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone");
- uiButSetCompleteFunc(but, autocomplete_bone, (void *)data->tar);
- }
- else if (is_geom_target(data->tar)) {
- but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "VG:", *xco+120, *yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Name of Vertex Group defining 'target' points");
- uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)data->tar);
- }
- else {
- strcpy(data->subtarget, "");
- }
- uiBlockEndAlign(block);
-
- uiDefButBitI(block, TOG, MINMAX_STICKY, B_CONSTRAINT_TEST, "Sticky", *xco, *yco-24, 44, 18, &data->flag, 0, 24, 0, 0, "Immobilize object while constrained");
- uiDefButBitI(block, TOG, MINMAX_USEROT, B_CONSTRAINT_TEST, "Use Rot", *xco+44, *yco-24, 64, 18, &data->flag, 0, 24, 0, 0, "Use target object rotation");
-
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Max/Min:", *xco-8, *yco-64, 54, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- uiBlockBeginAlign(block);
- uiDefButI(block, ROW, B_CONSTRAINT_TEST,"X", *xco+51, *yco-64,17,18, &data->minmaxflag, 12.0, 0.0, 0, 0, "Will not pass below X of target");
- uiDefButI(block, ROW, B_CONSTRAINT_TEST,"Y", *xco+67, *yco-64,17,18, &data->minmaxflag, 12.0, 1.0, 0, 0, "Will not pass below Y of target");
- uiDefButI(block, ROW, B_CONSTRAINT_TEST,"Z", *xco+85, *yco-64,17,18, &data->minmaxflag, 12.0, 2.0, 0, 0, "Will not pass below Z of target");
- uiDefButI(block, ROW, B_CONSTRAINT_TEST,"-X", *xco+102, *yco-64,24,18, &data->minmaxflag, 12.0, 3.0, 0, 0, "Will not pass above X of target");
- uiDefButI(block, ROW, B_CONSTRAINT_TEST,"-Y", *xco+126, *yco-64,24,18, &data->minmaxflag, 12.0, 4.0, 0, 0, "Will not pass above Y of target");
- uiDefButI(block, ROW, B_CONSTRAINT_TEST,"-Z", *xco+150, *yco-64,24,18, &data->minmaxflag, 12.0, 5.0, 0, 0, "Will not pass above Z of target");
- uiBlockEndAlign(block);
-
- if (is_armature_target(data->tar)) {
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Head/Tail:", *xco, *yco-86, 241, 18, &con->headtail, 0.0, 1, 0.1, 0.1, "Target along length of bone: Head=0, Tail=1");
- }
-
- }
- break;
- case CONSTRAINT_TYPE_LOCKTRACK:
- {
- bLockTrackConstraint *data = con->data;
- height = 66;
- uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+40,height-1, NULL, 5.0, 0.0, 12, rb_col, "");
-
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", *xco+65, *yco-24, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- /* Draw target parameters */
- uiBlockBeginAlign(block);
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CONSTRAINT_CHANGETARGET, "OB:", *xco+120, *yco-24, 135, 18, &data->tar, "Target Object");
-
- if (is_armature_target(data->tar)) {
- but=uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", *xco+120, *yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone");
- uiButSetCompleteFunc(but, autocomplete_bone, (void *)data->tar);
- }
- else if (is_geom_target(data->tar)) {
- but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "VG:", *xco+120, *yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Name of Vertex Group defining 'target' points");
- uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)data->tar);
- }
- else {
- strcpy(data->subtarget, "");
- }
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "To:", *xco+12, *yco-64, 25, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- uiDefButI(block, ROW, B_CONSTRAINT_TEST,"X", *xco+39, *yco-64,17,18, &data->trackflag, 12.0, 0.0, 0, 0, "X axis points to the target object");
- uiDefButI(block, ROW, B_CONSTRAINT_TEST,"Y", *xco+56, *yco-64,17,18, &data->trackflag, 12.0, 1.0, 0, 0, "Y axis points to the target object");
- uiDefButI(block, ROW, B_CONSTRAINT_TEST,"Z", *xco+73, *yco-64,17,18, &data->trackflag, 12.0, 2.0, 0, 0, "Z axis points to the target object");
- uiDefButI(block, ROW, B_CONSTRAINT_TEST,"-X", *xco+90, *yco-64,24,18, &data->trackflag, 12.0, 3.0, 0, 0, "-X axis points to the target object");
- uiDefButI(block, ROW, B_CONSTRAINT_TEST,"-Y", *xco+114, *yco-64,24,18, &data->trackflag, 12.0, 4.0, 0, 0, "-Y axis points to the target object");
- uiDefButI(block, ROW, B_CONSTRAINT_TEST,"-Z", *xco+138, *yco-64,24,18, &data->trackflag, 12.0, 5.0, 0, 0, "-Z axis points to the target object");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Lock:", *xco+166, *yco-64, 38, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- uiDefButI(block, ROW, B_CONSTRAINT_TEST,"X", *xco+204, *yco-64,17,18, &data->lockflag, 13.0, 0.0, 0, 0, "X axis is locked");
- uiDefButI(block, ROW, B_CONSTRAINT_TEST,"Y", *xco+221, *yco-64,17,18, &data->lockflag, 13.0, 1.0, 0, 0, "Y axis is locked");
- uiDefButI(block, ROW, B_CONSTRAINT_TEST,"Z", *xco+238, *yco-64,17,18, &data->lockflag, 13.0, 2.0, 0, 0, "Z axis is locked");
- uiBlockEndAlign(block);
- }
- break;
- case CONSTRAINT_TYPE_FOLLOWPATH:
- {
- bFollowPathConstraint *data = con->data;
-
- height = 66;
- uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+40,height-1, NULL, 5.0, 0.0, 12, rb_col, "");
-
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", *xco+65, *yco-24, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- /* Draw target parameters */
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CONSTRAINT_CHANGETARGET, "OB:", *xco+120, *yco-24, 135, 18, &data->tar, "Target Object");
-
- /* Draw Curve Follow toggle */
- uiDefButBitI(block, TOG, 1, B_CONSTRAINT_TEST, "CurveFollow", *xco+39, *yco-44, 100, 18, &data->followflag, 0, 24, 0, 0, "Object will follow the heading and banking of the curve");
-
- /* Draw Offset number button */
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Offset:", *xco+155, *yco-44, 100, 18, &data->offset, -MAXFRAMEF, MAXFRAMEF, 100.0, 0.0, "Offset from the position corresponding to the time frame");
-
- uiBlockBeginAlign(block);
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Fw:", *xco+12, *yco-64, 27, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- uiDefButI(block, ROW, B_CONSTRAINT_TEST,"X", *xco+39, *yco-64,17,18, &data->trackflag, 12.0, 0.0, 0, 0, "The axis that points forward along the path");
- uiDefButI(block, ROW, B_CONSTRAINT_TEST,"Y", *xco+56, *yco-64,17,18, &data->trackflag, 12.0, 1.0, 0, 0, "The axis that points forward along the path");
- uiDefButI(block, ROW, B_CONSTRAINT_TEST,"Z", *xco+73, *yco-64,17,18, &data->trackflag, 12.0, 2.0, 0, 0, "The axis that points forward along the path");
- uiDefButI(block, ROW, B_CONSTRAINT_TEST,"-X", *xco+90, *yco-64,24,18, &data->trackflag, 12.0, 3.0, 0, 0, "The axis that points forward along the path");
- uiDefButI(block, ROW, B_CONSTRAINT_TEST,"-Y", *xco+114, *yco-64,24,18, &data->trackflag, 12.0, 4.0, 0, 0, "The axis that points forward along the path");
- uiDefButI(block, ROW, B_CONSTRAINT_TEST,"-Z", *xco+138, *yco-64,24,18, &data->trackflag, 12.0, 5.0, 0, 0, "The axis that points forward along the path");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Up:", *xco+174, *yco-64, 30, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- uiDefButI(block, ROW, B_CONSTRAINT_TEST,"X", *xco+204, *yco-64,17,18, &data->upflag, 13.0, 0.0, 0, 0, "The axis that points upward");
- uiDefButI(block, ROW, B_CONSTRAINT_TEST,"Y", *xco+221, *yco-64,17,18, &data->upflag, 13.0, 1.0, 0, 0, "The axis that points upward");
- uiDefButI(block, ROW, B_CONSTRAINT_TEST,"Z", *xco+238, *yco-64,17,18, &data->upflag, 13.0, 2.0, 0, 0, "The axis that points upward");
- uiBlockEndAlign(block);
- }
- break;
- case CONSTRAINT_TYPE_STRETCHTO:
- {
- bStretchToConstraint *data = con->data;
-
- height = 105;
- uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+40,height-1, NULL, 5.0, 0.0, 12, rb_col, "");
-
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", *xco+65, *yco-24, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- /* Draw target parameters */
- uiBlockBeginAlign(block);
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CONSTRAINT_CHANGETARGET, "OB:", *xco+120, *yco-24, 135, 18, &data->tar, "Target Object");
-
- if (is_armature_target(data->tar)) {
- but=uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", *xco+120, *yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone");
- uiButSetCompleteFunc(but, autocomplete_bone, (void *)data->tar);
- }
- else if (is_geom_target(data->tar)) {
- but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "VG:", *xco+120, *yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Name of Vertex Group defining 'target' points");
- uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)data->tar);
- }
- else {
- strcpy(data->subtarget, "");
- }
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- if (is_armature_target(data->tar)) {
- uiDefButF(block, BUTM, B_CONSTRAINT_TEST, "R", *xco, *yco-60, 20, 18, &data->orglength, 0.0, 0, 0, 0, "Recalculate RLength");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Rest Length:", *xco+18, *yco-60,139,18, &data->orglength, 0.0, 100, 0.5, 0.5, "Length at Rest Position");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Head/Tail:", *xco+155, *yco-60,97,18, &con->headtail, 0.0, 1, 0.1, 0.1, "Target along length of bone: Head=0, Tail=1");
- }
- else {
- uiDefButF(block, BUTM, B_CONSTRAINT_TEST, "R", *xco, *yco-60, 20, 18, &data->orglength, 0.0, 0, 0, 0, "Recalculate RLength");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Rest Length:", *xco+18, *yco-60, 237, 18, &data->orglength, 0.0, 100, 0.5, 0.5, "Length at Rest Position");
- }
- uiBlockEndAlign(block);
-
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Volume Variation:", *xco+18, *yco-82, 237, 18, &data->bulge, 0.0, 100, 0.5, 0.5, "Factor between volume variation and stretching");
-
- uiBlockBeginAlign(block);
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Vol:",*xco+14, *yco-104,30,18, NULL, 0.0, 0.0, 0.0, 0.0, "");
- uiDefButI(block, ROW,B_CONSTRAINT_TEST,"XZ", *xco+44, *yco-104,30,18, &data->volmode, 12.0, 0.0, 0, 0, "Keep Volume: Scaling X & Z");
- uiDefButI(block, ROW,B_CONSTRAINT_TEST,"X", *xco+74, *yco-104,20,18, &data->volmode, 12.0, 1.0, 0, 0, "Keep Volume: Scaling X");
- uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Z", *xco+94, *yco-104,20,18, &data->volmode, 12.0, 2.0, 0, 0, "Keep Volume: Scaling Z");
- uiDefButI(block, ROW,B_CONSTRAINT_TEST,"NONE", *xco+114, *yco-104,50,18, &data->volmode, 12.0, 3.0, 0, 0, "Ignore Volume");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST,"Plane:",*xco+175, *yco-104,40,18, NULL, 0.0, 0.0, 0.0, 0.0, "");
- uiDefButI(block, ROW,B_CONSTRAINT_TEST,"X", *xco+215, *yco-104,20,18, &data->plane, 12.0, 0.0, 0, 0, "Keep X axis");
- uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Z", *xco+235, *yco-104,20,18, &data->plane, 12.0, 2.0, 0, 0, "Keep Z axis");
- uiBlockEndAlign(block);
- }
- break;
- case CONSTRAINT_TYPE_LOCLIMIT:
- {
- bLocLimitConstraint *data = con->data;
-
- int togButWidth = 50;
- int textButWidth = ((width/2)-togButWidth);
-
- height = 136;
- uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+40,height-1, NULL, 5.0, 0.0, 12, rb_col, "");
-
- /* Draw Pairs of LimitToggle+LimitValue */
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, LIMIT_XMIN, B_CONSTRAINT_TEST, "minX", *xco, *yco-28, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use minimum x value");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", *xco+togButWidth, *yco-28, (textButWidth-5), 18, &(data->xmin), -1000, 1000, 0.1,0.5,"Lowest x value to allow");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, LIMIT_XMAX, B_CONSTRAINT_TEST, "maxX", *xco+(width-(textButWidth-5)-togButWidth), *yco-28, 50, 18, &data->flag, 0, 24, 0, 0, "Use maximum x value");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", *xco+(width-textButWidth-5), *yco-28, (textButWidth-5), 18, &(data->xmax), -1000, 1000, 0.1,0.5,"Highest x value to allow");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, LIMIT_YMIN, B_CONSTRAINT_TEST, "minY", *xco, *yco-50, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use minimum y value");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", *xco+togButWidth, *yco-50, (textButWidth-5), 18, &(data->ymin), -1000, 1000, 0.1,0.5,"Lowest y value to allow");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, LIMIT_YMAX, B_CONSTRAINT_TEST, "maxY", *xco+(width-(textButWidth-5)-togButWidth), *yco-50, 50, 18, &data->flag, 0, 24, 0, 0, "Use maximum y value");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", *xco+(width-textButWidth-5), *yco-50, (textButWidth-5), 18, &(data->ymax), -1000, 1000, 0.1,0.5,"Highest y value to allow");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, LIMIT_ZMIN, B_CONSTRAINT_TEST, "minZ", *xco, *yco-72, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use minimum z value");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", *xco+togButWidth, *yco-72, (textButWidth-5), 18, &(data->zmin), -1000, 1000, 0.1,0.5,"Lowest z value to allow");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, LIMIT_ZMAX, B_CONSTRAINT_TEST, "maxZ", *xco+(width-(textButWidth-5)-togButWidth), *yco-72, 50, 18, &data->flag, 0, 24, 0, 0, "Use maximum z value");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", *xco+(width-textButWidth-5), *yco-72, (textButWidth-5), 18, &(data->zmax), -1000, 1000, 0.1,0.5,"Highest z value to allow");
- uiBlockEndAlign(block);
-
- /* special option(s) */
- uiDefButBitS(block, TOG, LIMIT_TRANSFORM, B_CONSTRAINT_TEST, "For Transform", *xco+(width/4), *yco-100, (width/2), 18, &data->flag2, 0, 24, 0, 0, "Transforms are affected by this constraint as well");
-
- /* constraint space settings */
- draw_constraint_spaceselect(block, con, *xco, *yco-130, is_armature_owner(ob), -1);
- }
- break;
- case CONSTRAINT_TYPE_ROTLIMIT:
- {
- bRotLimitConstraint *data = con->data;
- int normButWidth = (width/3);
-
- height = 106;
-
- uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+40,height-1, NULL, 5.0, 0.0, 12, rb_col, "");
-
- /* Draw Pairs of LimitToggle+LimitValue */
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, LIMIT_XROT, B_CONSTRAINT_TEST, "LimitX", *xco, *yco-28, normButWidth, 18, &data->flag, 0, 24, 0, 0, "Limit rotation on x-axis");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "min:", *xco+normButWidth, *yco-28, normButWidth, 18, &(data->xmin), -360, 360, 0.1,0.5,"Lowest x value to allow");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "max:", *xco+(normButWidth * 2), *yco-28, normButWidth, 18, &(data->xmax), -360, 360, 0.1,0.5,"Highest x value to allow");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, LIMIT_YROT, B_CONSTRAINT_TEST, "LimitY", *xco, *yco-50, normButWidth, 18, &data->flag, 0, 24, 0, 0, "Limit rotation on y-axis");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "min:", *xco+normButWidth, *yco-50, normButWidth, 18, &(data->ymin), -360, 360, 0.1,0.5,"Lowest y value to allow");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "max:", *xco+(normButWidth * 2), *yco-50, normButWidth, 18, &(data->ymax), -360, 360, 0.1,0.5,"Highest y value to allow");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, LIMIT_ZROT, B_CONSTRAINT_TEST, "LimitZ", *xco, *yco-72, normButWidth, 18, &data->flag, 0, 24, 0, 0, "Limit rotation on z-axis");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "min:", *xco+normButWidth, *yco-72, normButWidth, 18, &(data->zmin), -360, 360, 0.1,0.5,"Lowest z value to allow");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "max:", *xco+(normButWidth * 2), *yco-72, normButWidth, 18, &(data->zmax), -360, 360, 0.1,0.5,"Highest z value to allow");
- uiBlockEndAlign(block);
-
- /* constraint space settings */
- draw_constraint_spaceselect(block, con, *xco, *yco-100, is_armature_owner(ob), -1);
- }
- break;
- case CONSTRAINT_TYPE_SIZELIMIT:
- {
- bSizeLimitConstraint *data = con->data;
-
- int togButWidth = 50;
- int textButWidth = ((width/2)-togButWidth);
-
- height = 106;
-
- uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+40,height-1, NULL, 5.0, 0.0, 12, rb_col, "");
-
- /* Draw Pairs of LimitToggle+LimitValue */
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, LIMIT_XMIN, B_CONSTRAINT_TEST, "minX", *xco, *yco-28, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use minimum x value");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", *xco+togButWidth, *yco-28, (textButWidth-5), 18, &(data->xmin), 0.0001, 1000, 0.1,0.5,"Lowest x value to allow");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, LIMIT_XMAX, B_CONSTRAINT_TEST, "maxX", *xco+(width-(textButWidth-5)-togButWidth), *yco-28, 50, 18, &data->flag, 0, 24, 0, 0, "Use maximum x value");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", *xco+(width-textButWidth-5), *yco-28, (textButWidth-5), 18, &(data->xmax), 0.0001, 1000, 0.1,0.5,"Highest x value to allow");
- uiBlockEndAlign(block);
-
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, LIMIT_YMIN, B_CONSTRAINT_TEST, "minY", *xco, *yco-50, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use minimum y value");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", *xco+togButWidth, *yco-50, (textButWidth-5), 18, &(data->ymin), 0.0001, 1000, 0.1,0.5,"Lowest y value to allow");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, LIMIT_YMAX, B_CONSTRAINT_TEST, "maxY", *xco+(width-(textButWidth-5)-togButWidth), *yco-50, 50, 18, &data->flag, 0, 24, 0, 0, "Use maximum y value");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", *xco+(width-textButWidth-5), *yco-50, (textButWidth-5), 18, &(data->ymax), 0.0001, 1000, 0.1,0.5,"Highest y value to allow");
- uiBlockEndAlign(block);
-
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, LIMIT_ZMIN, B_CONSTRAINT_TEST, "minZ", *xco, *yco-72, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use minimum z value");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", *xco+togButWidth, *yco-72, (textButWidth-5), 18, &(data->zmin), 0.0001, 1000, 0.1,0.5,"Lowest z value to allow");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, LIMIT_ZMAX, B_CONSTRAINT_TEST, "maxZ", *xco+(width-(textButWidth-5)-togButWidth), *yco-72, 50, 18, &data->flag, 0, 24, 0, 0, "Use maximum z value");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", *xco+(width-textButWidth-5), *yco-72, (textButWidth-5), 18, &(data->zmax), 0.0001, 1000, 0.1,0.5,"Highest z value to allow");
- uiBlockEndAlign(block);
-
- /* constraint space settings */
- draw_constraint_spaceselect(block, con, *xco, *yco-100, is_armature_owner(ob), -1);
- }
- break;
- case CONSTRAINT_TYPE_RIGIDBODYJOINT:
- {
- bRigidBodyJointConstraint *data = con->data;
- float extremeLin = 999.f;
- float extremeAngX = 180.f;
- float extremeAngY = 45.f;
- float extremeAngZ = 45.f;
- int togButWidth = 70;
- int offsetY = 150;
- int textButWidth = ((width/2)-togButWidth);
-
- uiDefButI(block, MENU, B_CONSTRAINT_TEST, "Joint Types%t|Ball%x1|Hinge%x2|Cone Twist%x4|Generic (experimental)%x12",//|Extra Force%x6",
- *xco, *yco-25, 150, 18, &data->type, 0, 0, 0, 0, "Choose the joint type");
- height = 140;
- if (data->type==CONSTRAINT_RB_GENERIC6DOF)
- height = 270;
- if (data->type==CONSTRAINT_RB_CONETWIST)
- height = 200;
-
- uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+40,height-1, NULL, 5.0, 0.0, 12, rb_col, "");
-
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CONSTRAINT_CHANGETARGET, "toObject:", *xco, *yco-50, 130, 18, &data->tar, "Child Object");
- uiDefButBitS(block, TOG, CONSTRAINT_DRAW_PIVOT, B_CONSTRAINT_TEST, "ShowPivot", *xco+135, *yco-50, 130, 18, &data->flag, 0, 24, 0, 0, "Show pivot position and rotation");
-
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Pivot X:", *xco, *yco-75, 130, 18, &data->pivX, -1000, 1000, 100, 0.0, "Offset pivot on X");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Pivot Y:", *xco, *yco-100, 130, 18, &data->pivY, -1000, 1000, 100, 0.0, "Offset pivot on Y");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Pivot Z:", *xco, *yco-125, 130, 18, &data->pivZ, -1000, 1000, 100, 0.0, "Offset pivot on z");
-
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Ax X:", *xco+135, *yco-75, 130, 18, &data->axX, -360, 360, 1500, 0.0, "Rotate pivot on X Axis (in degrees)");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Ax Y:", *xco+135, *yco-100, 130, 18, &data->axY, -360, 360, 1500, 0.0, "Rotate pivot on Y Axis (in degrees)");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Ax Z:", *xco+135, *yco-125, 130, 18, &data->axZ, -360, 360, 1500, 0.0, "Rotate pivot on Z Axis (in degrees)");
-
- if (data->type==CONSTRAINT_RB_GENERIC6DOF) {
- /* Draw Pairs of LimitToggle+LimitValue */
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, 1, B_CONSTRAINT_TEST, "LinMinX", *xco, *yco-offsetY, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use minimum x limit");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", *xco+togButWidth, *yco-offsetY, (textButWidth-5), 18, &(data->minLimit[0]), -extremeLin, extremeLin, 0.1,0.5,"min x limit");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, 1, B_CONSTRAINT_TEST, "LinMaxX", *xco+(width-(textButWidth-5)-togButWidth), *yco-offsetY, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use maximum x limit");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", *xco+(width-textButWidth-5), *yco-offsetY, (textButWidth), 18, &(data->maxLimit[0]), -extremeLin, extremeLin, 0.1,0.5,"max x limit");
- uiBlockEndAlign(block);
-
- offsetY += 20;
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, 2, B_CONSTRAINT_TEST, "LinMinY", *xco, *yco-offsetY, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use minimum y limit");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", *xco+togButWidth, *yco-offsetY, (textButWidth-5), 18, &(data->minLimit[1]), -extremeLin, extremeLin, 0.1,0.5,"min y limit");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, 2, B_CONSTRAINT_TEST, "LinMaxY", *xco+(width-(textButWidth-5)-togButWidth), *yco-offsetY, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use maximum y limit");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", *xco+(width-textButWidth-5), *yco-offsetY, (textButWidth), 18, &(data->maxLimit[1]), -extremeLin, extremeLin, 0.1,0.5,"max y limit");
- uiBlockEndAlign(block);
-
- offsetY += 20;
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, 4, B_CONSTRAINT_TEST, "LinMinZ", *xco, *yco-offsetY, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use minimum z limit");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", *xco+togButWidth, *yco-offsetY, (textButWidth-5), 18, &(data->minLimit[2]), -extremeLin, extremeLin, 0.1,0.5,"min z limit");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, 4, B_CONSTRAINT_TEST, "LinMaxZ", *xco+(width-(textButWidth-5)-togButWidth), *yco-offsetY, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use maximum z limit");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", *xco+(width-textButWidth-5), *yco-offsetY, (textButWidth), 18, &(data->maxLimit[2]), -extremeLin, extremeLin, 0.1,0.5,"max z limit");
- uiBlockEndAlign(block);
- offsetY += 20;
- }
- if ((data->type==CONSTRAINT_RB_GENERIC6DOF) || (data->type==CONSTRAINT_RB_CONETWIST)) {
- /* Draw Pairs of LimitToggle+LimitValue */
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, 8, B_CONSTRAINT_TEST, "AngMinX", *xco, *yco-offsetY, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use minimum x limit");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", *xco+togButWidth, *yco-offsetY, (textButWidth-5), 18, &(data->minLimit[3]), -extremeAngX, extremeAngX, 0.1,0.5,"min x limit");
- uiBlockEndAlign(block);
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, 8, B_CONSTRAINT_TEST, "AngMaxX", *xco+(width-(textButWidth-5)-togButWidth), *yco-offsetY, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use maximum x limit");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", *xco+(width-textButWidth-5), *yco-offsetY, (textButWidth), 18, &(data->maxLimit[3]), -extremeAngX, extremeAngX, 0.1,0.5,"max x limit");
- uiBlockEndAlign(block);
-
- offsetY += 20;
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, 16, B_CONSTRAINT_TEST, "AngMinY", *xco, *yco-offsetY, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use minimum y limit");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", *xco+togButWidth, *yco-offsetY, (textButWidth-5), 18, &(data->minLimit[4]), -extremeAngY, extremeAngY, 0.1,0.5,"min y limit");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, 16, B_CONSTRAINT_TEST, "AngMaxY", *xco+(width-(textButWidth-5)-togButWidth), *yco-offsetY, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use maximum y limit");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", *xco+(width-textButWidth-5), *yco-offsetY, (textButWidth), 18, &(data->maxLimit[4]), -extremeAngY, extremeAngY, 0.1,0.5,"max y limit");
- uiBlockEndAlign(block);
-
- offsetY += 20;
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, 32, B_CONSTRAINT_TEST, "AngMinZ", *xco, *yco-offsetY, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use minimum z limit");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", *xco+togButWidth, *yco-offsetY, (textButWidth-5), 18, &(data->minLimit[5]), -extremeAngZ, extremeAngZ, 0.1,0.5,"min z limit");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, 32, B_CONSTRAINT_TEST, "AngMaxZ", *xco+(width-(textButWidth-5)-togButWidth), *yco-offsetY, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use maximum z limit");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", *xco+(width-textButWidth-5), *yco-offsetY, (textButWidth), 18, &(data->maxLimit[5]), -extremeAngZ, extremeAngZ, 0.1,0.5,"max z limit");
- uiBlockEndAlign(block);
- }
- }
- break;
- case CONSTRAINT_TYPE_CLAMPTO:
- {
- bClampToConstraint *data = con->data;
-
- height = 90;
- uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+40,height-1, NULL, 5.0, 0.0, 12, rb_col, "");
-
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", *xco+65, *yco-24, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- /* Draw target parameters */
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CONSTRAINT_CHANGETARGET, "OB:", *xco+120, *yco-24, 135, 18, &data->tar, "Target Object");
-
- /* Draw XYZ toggles */
- uiBlockBeginAlign(block);
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Main Axis:", *xco, *yco-64, 90, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
- uiDefButI(block, ROW, B_CONSTRAINT_TEST, "Auto", *xco+100, *yco-64, 50, 18, &data->flag, 12.0, CLAMPTO_AUTO, 0, 0, "Automatically determine main-axis of movement");
- uiDefButI(block, ROW, B_CONSTRAINT_TEST, "X", *xco+150, *yco-64, 32, 18, &data->flag, 12.0, CLAMPTO_X, 0, 0, "Main axis of movement is x-axis");
- uiDefButI(block, ROW, B_CONSTRAINT_TEST, "Y", *xco+182, *yco-64, 32, 18, &data->flag, 12.0, CLAMPTO_Y, 0, 0, "Main axis of movement is y-axis");
- uiDefButI(block, ROW, B_CONSTRAINT_TEST, "Z", *xco+214, *yco-64, 32, 18, &data->flag, 12.0, CLAMPTO_Z, 0, 0, "Main axis of movement is z-axis");
- uiBlockEndAlign(block);
-
- /* Extra Options Controlling Behaviour */
- //uiBlockBeginAlign(block);
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Options:", *xco, *yco-88, 90, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
- uiDefButBitI(block, TOG, CLAMPTO_CYCLIC, B_CONSTRAINT_TEST, "Cyclic", *xco+((width/2)), *yco-88,60,19, &data->flag2, 0, 0, 0, 0, "Treat curve as cyclic curve (no clamping to curve bounding box)");
- //uiBlockEndAlign(block);
- }
- break;
- case CONSTRAINT_TYPE_TRANSFORM:
- {
- bTransformConstraint *data = con->data;
- float fmin, fmax, tmin, tmax;
-
- height = 178;
- uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+40,height-1, NULL, 5.0, 0.0, 12, rb_col, "");
-
- /* Draw target parameters */
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", *xco+65, *yco-24, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- /* Draw target parameters */
- uiBlockBeginAlign(block);
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CONSTRAINT_CHANGETARGET, "OB:", *xco+120, *yco-24, 135, 18, &data->tar, "Target Object to use as Parent");
-
- if (is_armature_target(data->tar)) {
- but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", *xco+120, *yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone to use as Parent");
- uiButSetCompleteFunc(but, autocomplete_bone, (void *)data->tar);
- }
- else if (is_geom_target(data->tar)) {
- but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "VG:", *xco+120, *yco-66,150,18, &data->subtarget, 0, 24, 0, 0, "Name of Vertex Group defining 'target' points");
- uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)data->tar);
- }
- else {
- strcpy(data->subtarget, "");
- }
- uiBlockEndAlign(block);
-
- /* Extrapolate Ranges? */
- uiDefButBitC(block, TOG, 1, B_CONSTRAINT_TEST, "Extrapolate", *xco, *yco-42,80,19, &data->expo, 0, 0, 0, 0, "Extrapolate ranges");
-
- /* Draw options for source motion */
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Source:", *xco-10, *yco-62, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- /* draw Loc/Rot/Size toggles */
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW, B_CONSTRAINT_TEST, "Loc", *xco-5, *yco-82, 45, 18, &data->from, 12.0, 0, 0, 0, "Use Location transform channels from Target");
- uiDefButS(block, ROW, B_CONSTRAINT_TEST, "Rot", *xco+40, *yco-82, 45, 18, &data->from, 12.0, 1, 0, 0, "Use Rotation transform channels from Target");
- uiDefButS(block, ROW, B_CONSTRAINT_TEST, "Scale", *xco+85, *yco-82, 45, 18, &data->from, 12.0, 2, 0, 0, "Use Scale transform channels from Target");
- uiBlockEndAlign(block);
-
- /* Draw Pairs of Axis: Min/Max Value*/
- if (data->from == 2) {
- fmin= 0.0001;
- fmax= 1000.0;
- }
- else if (data->from == 1) {
- fmin= -360.0;
- fmax= 360.0;
- }
- else {
- fmin = -1000.0;
- fmax= 1000.0;
- }
-
- uiBlockBeginAlign(block);
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "X:", *xco-10, *yco-107, 30, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "min", *xco+20, *yco-107, 55, 18, &data->from_min[0], fmin, fmax, 0, 0, "Bottom of range of x-axis source motion for source->target mapping");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "max", *xco+75, *yco-107, 55, 18, &data->from_max[0], fmin, fmax, 0, 0, "Top of range of x-axis source motion for source->target mapping");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Y:", *xco-10, *yco-127, 30, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "min", *xco+20, *yco-127, 55, 18, &data->from_min[1], fmin, fmax, 0, 0, "Bottom of range of y-axis source motion for source->target mapping");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "max", *xco+75, *yco-127, 55, 18, &data->from_max[1], fmin, fmax, 0, 0, "Top of range of y-axis source motion for source->target mapping");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Z:", *xco-10, *yco-147, 30, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "min", *xco+20, *yco-147, 55, 18, &data->from_min[2], fmin, fmax, 0, 0, "Bottom of range of z-axis source motion for source->target mapping");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "max", *xco+75, *yco-147, 55, 18, &data->from_max[2], fmin, fmax, 0, 0, "Top of range of z-axis source motion for source->target mapping");
- uiBlockEndAlign(block);
-
-
- /* Draw options for target motion */
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Destination:", *xco+150, *yco-62, 150, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- /* draw Loc/Rot/Size toggles */
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW, B_CONSTRAINT_TEST, "Loc", *xco+150, *yco-82, 45, 18, &data->to, 12.0, 0, 0, 0, "Use as Location transform");
- uiDefButS(block, ROW, B_CONSTRAINT_TEST, "Rot", *xco+195, *yco-82, 45, 18, &data->to, 12.0, 1, 0, 0, "Use as Rotation transform");
- uiDefButS(block, ROW, B_CONSTRAINT_TEST, "Scale", *xco+245, *yco-82, 45, 18, &data->to, 12.0, 2, 0, 0, "Use as Scale transform");
- uiBlockEndAlign(block);
-
- /* Draw Pairs of Source-Axis: Min/Max Value*/
- if (data->to == 2) {
- tmin= 0.0001;
- tmax= 1000.0;
- }
- else if (data->to == 1) {
- tmin= -360.0;
- tmax= 360.0;
- }
- else {
- tmin = -1000.0;
- tmax= 1000.0;
- }
-
- uiBlockBeginAlign(block);
- uiDefButC(block, MENU, B_CONSTRAINT_TEST, "Axis Mapping%t|X->X%x0|Y->X%x1|Z->X%x2", *xco+150, *yco-107, 40, 18, &data->map[0], 0, 24, 0, 0, "Specify which source axis the x-axis destination uses");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "min", *xco+175, *yco-107, 50, 18, &data->to_min[0], tmin, tmax, 0, 0, "Bottom of range of x-axis destination motion for source->target mapping");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "max", *xco+240, *yco-107, 50, 18, &data->to_max[0], tmin, tmax, 0, 0, "Top of range of x-axis destination motion for source->target mapping");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButC(block, MENU, B_CONSTRAINT_TEST, "Axis Mapping%t|X->Y%x0|Y->Y%x1|Z->Y%x2", *xco+150, *yco-127, 40, 18, &data->map[1], 0, 24, 0, 0, "Specify which source axis the y-axis destination uses");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "min", *xco+175, *yco-127, 50, 18, &data->to_min[1], tmin, tmax, 0, 0, "Bottom of range of y-axis destination motion for source->target mapping");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "max", *xco+240, *yco-127, 50, 18, &data->to_max[1], tmin, tmax, 0, 0, "Top of range of y-axis destination motion for source->target mapping");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButC(block, MENU, B_CONSTRAINT_TEST, "Axis Mapping%t|X->Z%x0|Y->Z%x1|Z->Z%x2", *xco+150, *yco-147, 40, 18, &data->map[2], 0, 24, 0, 0, "Specify which source axis the z-axis destination uses");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "min", *xco+175, *yco-147, 50, 18, &data->to_min[2], tmin, tmax, 0, 0, "Bottom of range of z-axis destination motion for source->target mapping");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "max", *xco+240, *yco-147, 50, 18, &data->to_max[2], tmin, tmax, 0, 0, "Top of range of z-axis destination motion for source->target mapping");
- uiBlockEndAlign(block);
-
- /* constraint space settings */
- draw_constraint_spaceselect(block, con, *xco, *yco-170, is_armature_owner(ob), is_armature_target(data->tar));
- }
- break;
- case CONSTRAINT_TYPE_NULL:
- {
- height = 17;
- uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+40,height-1, NULL, 5.0, 0.0, 12, rb_col, "");
- }
- break;
- default:
- height = 0;
- break;
- }
-
- (*yco)-=(24+height);
- }
-
- if (ELEM(con->type, CONSTRAINT_TYPE_NULL, CONSTRAINT_TYPE_RIGIDBODYJOINT)==0) {
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_CONSTRAINT_INF, "Influence ", *xco, *yco, 197, 20, &(con->enforce), 0.0, 1.0, 0.0, 0.0, "Amount of influence this constraint will have on the final solution");
- but = uiDefBut(block, BUT, B_CONSTRAINT_TEST, "Show", *xco+200, *yco, 45, 20, 0, 0.0, 1.0, 0.0, 0.0, "Show constraint's ipo in the Ipo window, adds a channel if not there");
- /* If this is on an object or bone, add ipo channel the constraint */
- uiButSetFunc (but, enable_constraint_ipo_func, ob, con);
- but = uiDefBut(block, BUT, B_CONSTRAINT_TEST, "Key", *xco+245, *yco, 40, 20, 0, 0.0, 1.0, 0.0, 0.0, "Add an influence keyframe to the constraint");
- /* Add a keyframe to the influence IPO */
- uiButSetFunc (but, add_influence_key_to_constraint_func, ob, con);
- uiBlockEndAlign(block);
- (*yco)-=24;
- }
- else {
- (*yco)-=3;
- }
-}
-
-static uiBlock *add_constraintmenu(void *arg_unused)
-{
- Object *ob= OBACT;
- uiBlock *block;
- ListBase *conlist;
- short yco= 0;
-
- conlist = get_active_constraints(ob);
-
- block= uiNewBlock(&curarea->uiblocks, "add_constraintmenu", UI_EMBOSSP, UI_HELV, curarea->win);
-
- uiDefBut(block, BUTM, B_CONSTRAINT_ADD_CHILDOF, "Child Of", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefBut(block, BUTM, B_CONSTRAINT_ADD_TRANSFORM, "Transformation", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, 120, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefBut(block, BUTM, B_CONSTRAINT_ADD_LOCLIKE, "Copy Location", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefBut(block, BUTM, B_CONSTRAINT_ADD_ROTLIKE, "Copy Rotation", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefBut(block, BUTM, B_CONSTRAINT_ADD_SIZELIKE, "Copy Scale", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, 120, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefBut(block, BUTM, B_CONSTRAINT_ADD_LOCLIMIT, "Limit Location", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefBut(block, BUTM, B_CONSTRAINT_ADD_ROTLIMIT, "Limit Rotation", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefBut(block, BUTM, B_CONSTRAINT_ADD_SIZELIMIT, "Limit Scale", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, 120, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefBut(block, BUTM, B_CONSTRAINT_ADD_TRACKTO, "Track To", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefBut(block, BUTM, B_CONSTRAINT_ADD_MINMAX, "Floor", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefBut(block, BUTM, B_CONSTRAINT_ADD_LOCKTRACK, "Locked Track", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefBut(block, BUTM, B_CONSTRAINT_ADD_FOLLOWPATH, "Follow Path", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, 120, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefBut(block, BUTM, B_CONSTRAINT_ADD_CLAMPTO, "Clamp To", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefBut(block, BUTM, B_CONSTRAINT_ADD_STRETCHTO, "Stretch To", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiDefBut(block, BUTM, B_CONSTRAINT_ADD_RIGIDBODYJOINT, "Rigid Body Joint", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");//rcruiz
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, 120, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- if (ob->flag & OB_POSEMODE) {
- uiDefBut(block, BUTM, B_CONSTRAINT_ADD_KINEMATIC, "IK Solver", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
- }
- uiDefBut(block, BUTM, B_CONSTRAINT_ADD_ACTION, "Action", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, 120, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefBut(block, BUTM, B_CONSTRAINT_ADD_PYTHON, "Script", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, 120, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefBut(block, BUTM, B_CONSTRAINT_ADD_NULL, "Null", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
-
-
- uiTextBoundsBlock(block, 50);
- uiBlockSetDirection(block, UI_DOWN);
-
- return block;
-}
-
-void do_constraintbuts(unsigned short event)
-{
- Object *ob= OBACT;
- bConstraint *con;
-
- switch(event) {
- case B_CONSTRAINT_TEST:
- break; // no handling
- case B_CONSTRAINT_INF:
- /* influence; do not execute actions for 1 dag_flush */
- if (ob->pose)
- ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK);
-
- case B_CONSTRAINT_CHANGETARGET:
- if (ob->pose) ob->pose->flag |= POSE_RECALC; // checks & sorts pose channels
- DAG_scene_sort(G.scene);
- break;
-
- case B_CONSTRAINT_ADD_NULL:
- {
- con = add_new_constraint(CONSTRAINT_TYPE_NULL);
- add_constraint_to_active(ob, con);
-
- BIF_undo_push("Add constraint");
- }
- break;
- case B_CONSTRAINT_ADD_PYTHON:
- {
- con = add_new_constraint(CONSTRAINT_TYPE_PYTHON);
- add_constraint_to_active(ob, con);
-
- BIF_undo_push("Add constraint");
- }
- break;
- case B_CONSTRAINT_ADD_KINEMATIC:
- {
- con = add_new_constraint(CONSTRAINT_TYPE_KINEMATIC);
- add_constraint_to_active(ob, con);
-
- BIF_undo_push("Add constraint");
- }
- break;
- case B_CONSTRAINT_ADD_CHILDOF:
- {
- con= add_new_constraint(CONSTRAINT_TYPE_CHILDOF);
- add_constraint_to_active(ob, con);
-
- /* if this constraint is being added to a posechannel, make sure
- * the constraint gets evaluated in pose-space
- */
- if (ob->flag & OB_POSEMODE) {
- con->ownspace = CONSTRAINT_SPACE_POSE;
- con->flag |= CONSTRAINT_SPACEONCE;
- }
-
- BIF_undo_push("Add constraint");
- }
- break;
- case B_CONSTRAINT_ADD_TRACKTO:
- {
- con = add_new_constraint(CONSTRAINT_TYPE_TRACKTO);
- add_constraint_to_active(ob, con);
-
- BIF_undo_push("Add constraint");
- }
- break;
- case B_CONSTRAINT_ADD_MINMAX:
- {
- con = add_new_constraint(CONSTRAINT_TYPE_MINMAX);
- add_constraint_to_active(ob, con);
-
- BIF_undo_push("Add constraint");
- }
- break;
- case B_CONSTRAINT_ADD_ROTLIKE:
- {
- con = add_new_constraint(CONSTRAINT_TYPE_ROTLIKE);
- add_constraint_to_active(ob, con);
-
- BIF_undo_push("Add constraint");
- }
- break;
- case B_CONSTRAINT_ADD_LOCLIKE:
- {
- con = add_new_constraint(CONSTRAINT_TYPE_LOCLIKE);
- add_constraint_to_active(ob, con);
-
- BIF_undo_push("Add constraint");
- }
- break;
- case B_CONSTRAINT_ADD_SIZELIKE:
- {
- con = add_new_constraint(CONSTRAINT_TYPE_SIZELIKE);
- add_constraint_to_active(ob, con);
-
- BIF_undo_push("Add constraint");
- }
- break;
- case B_CONSTRAINT_ADD_ACTION:
- {
- con = add_new_constraint(CONSTRAINT_TYPE_ACTION);
- add_constraint_to_active(ob, con);
-
- BIF_undo_push("Add constraint");
- }
- break;
- case B_CONSTRAINT_ADD_LOCKTRACK:
- {
- con = add_new_constraint(CONSTRAINT_TYPE_LOCKTRACK);
- add_constraint_to_active(ob, con);
-
- BIF_undo_push("Add constraint");
- }
- break;
- case B_CONSTRAINT_ADD_FOLLOWPATH:
- {
- con = add_new_constraint(CONSTRAINT_TYPE_FOLLOWPATH);
- add_constraint_to_active(ob, con);
-
- BIF_undo_push("Add constraint");
- }
- break;
- case B_CONSTRAINT_ADD_STRETCHTO:
- {
- con = add_new_constraint(CONSTRAINT_TYPE_STRETCHTO);
- add_constraint_to_active(ob, con);
-
- BIF_undo_push("Add constraint");
- }
- break;
- case B_CONSTRAINT_ADD_LOCLIMIT:
- {
- con = add_new_constraint(CONSTRAINT_TYPE_LOCLIMIT);
- add_constraint_to_active(ob, con);
-
- BIF_undo_push("Add constraint");
- }
- break;
- case B_CONSTRAINT_ADD_ROTLIMIT:
- {
- con = add_new_constraint(CONSTRAINT_TYPE_ROTLIMIT);
- add_constraint_to_active(ob, con);
-
- BIF_undo_push("Add constraint");
- }
- break;
- case B_CONSTRAINT_ADD_SIZELIMIT:
- {
- con = add_new_constraint(CONSTRAINT_TYPE_SIZELIMIT);
- add_constraint_to_active(ob, con);
-
- BIF_undo_push("Add constraint");
- }
- break;
- case B_CONSTRAINT_ADD_RIGIDBODYJOINT:
- {
- bRigidBodyJointConstraint *data;
- Base *base_iter;
-
- con = add_new_constraint(CONSTRAINT_TYPE_RIGIDBODYJOINT);
- add_constraint_to_active(ob, con);
-
- /* set selected first object as target - moved from new_constraint_data */
- data = (bRigidBodyJointConstraint*)con->data;
- base_iter = G.scene->base.first;
- while ( base_iter && !data->tar ) {
- if( ( ( base_iter->flag & SELECT ) &&
-// ( base_iter->lay & G.vd->lay ) ) &&
- ( base_iter != G.scene->basact ) ))
- {
- data->tar=base_iter->object;
- break;
- }
- base_iter = base_iter->next;
- }
-
- BIF_undo_push("Add constraint");
- }
- break;
- case B_CONSTRAINT_ADD_CLAMPTO:
- {
- con = add_new_constraint(CONSTRAINT_TYPE_CLAMPTO);
- add_constraint_to_active(ob, con);
-
- BIF_undo_push("Add constraint");
- }
- break;
- case B_CONSTRAINT_ADD_TRANSFORM:
- {
- con = add_new_constraint(CONSTRAINT_TYPE_TRANSFORM);
- add_constraint_to_active(ob, con);
-
- BIF_undo_push("Add constraint");
- }
- break;
-
- default:
- break;
- }
-
- object_test_constraints(ob);
-
- if(ob->pose) update_pose_constraint_flags(ob->pose);
-
- if(ob->type==OB_ARMATURE) DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA|OB_RECALC_OB);
- else DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
-
- allqueue (REDRAWVIEW3D, 0);
- allqueue (REDRAWBUTSOBJECT, 0);
-}
-
-void softbody_bake(Object *ob)
-{
- Base *base;
- SoftBody *sb;
- ScrArea *sa;
- float frameleno= G.scene->r.framelen;
- int cfrao= CFRA, sfra=100000, efra=0, didbreak =0;
-
-
- G.scene->r.framelen= 1.0; // baking has to be in uncorrected time
- sbSetInterruptCallBack(blender_test_break); // make softbody module ESC aware
- G.afbreek=0; // init global break system
-
- if(ob) {
- sb= ob->soft;
- sfra= MIN2(sfra, sb->sfra);
- efra= MAX2(efra, sb->efra);
- sbObjectToSoftbody(ob); // put softbody in restposition, free bake
- ob->softflag |= OB_SB_BAKEDO;
- }
- else {
- for(base=G.scene->base.first; base; base= base->next) {
- if(TESTBASELIB(base)) {
- if(base->object->soft) {
- sb= base->object->soft;
- sfra= MIN2(sfra, sb->sfra);
- efra= MAX2(efra, sb->efra);
- sbObjectToSoftbody(base->object); // put softbody in restposition, free bake
- base->object->softflag |= OB_SB_BAKEDO;
- }
- }
- }
- }
-
- CFRA= sfra;
- update_for_newframe_muted(); // put everything on this frame
-
- curarea->win_swap= 0; // clean swapbuffers
-
- for(; CFRA <= efra; CFRA++) {
- set_timecursor(CFRA);
-
- update_for_newframe_muted();
-
- for(sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- if(sa->spacetype == SPACE_VIEW3D) {
- scrarea_do_windraw(sa);
- }
- }
- screen_swapbuffers();
- //blender_test_break() has a granularity of 10 ms, who cares .. baking the unit cube is kinda boring
- if (blender_test_break()){
- didbreak = 1;
- break;
- }
-
- }
- if((didbreak)&&(G.qual!=LR_SHIFTKEY)) {
- if(ob)
- sbObjectToSoftbody(ob); // free bake
- else {
- for(base=G.scene->base.first; base; base= base->next) {
- if(TESTBASELIB(base)) {
- if(base->object->soft) {
- sbObjectToSoftbody(base->object); // free bake
- }
- }
- }
- }
- }
-
- /* restore */
- waitcursor(0);
- sbSetInterruptCallBack(NULL); // softbody module won't ESC
- G.afbreek=0; // reset global break system
-
- if(ob)
- ob->softflag &= ~OB_SB_BAKEDO;
- else {
- for(base=G.scene->base.first; base; base= base->next)
- if(TESTBASELIB(base))
- if(base->object->soft)
- base->object->softflag &= ~OB_SB_BAKEDO;
- }
-
- CFRA= cfrao;
- G.scene->r.framelen= frameleno;
- update_for_newframe_muted();
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
-}
-
-// store processed path & file prefix for fluidsim bake directory
-void fluidsimFilesel(char *selection)
-{
- Object *ob = OBACT;
- char srcDir[FILE_MAXDIR+FILE_MAXFILE], srcFile[FILE_MAXFILE];
- char prefix[FILE_MAXFILE];
- char *srch, *srchSub, *srchExt, *lastFound;
- int isElbeemSurf = 0;
-
- // make prefix
- strcpy(srcDir, selection);
- BLI_splitdirstring(srcDir, srcFile);
- strcpy(prefix, srcFile);
- // check if this is a previously generated surface mesh file
- srch = strstr(prefix, "fluidsurface_");
- // TODO search from back...
- if(srch) {
- srchSub = strstr(prefix,"_preview_");
- if(!srchSub) srchSub = strstr(prefix,"_final_");
- srchExt = strstr(prefix,".gz.bobj");
- if(!srchExt) srchExt = strstr(prefix,".bobj");
- if(srchSub && srchExt) {
- *srch = '\0';
- isElbeemSurf = 1;
- }
- }
- if(!isElbeemSurf) {
- // try to remove suffix
- lastFound = NULL;
- srch = strchr(prefix, '.'); // search last . from extension
- while(srch) {
- lastFound = srch;
- if(srch) {
- srch++;
- srch = strchr(srch, '.');
- }
- }
- if(lastFound) {
- *lastFound = '\0';
- }
- }
-
- if(ob->fluidsimSettings) {
- strcpy(ob->fluidsimSettings->surfdataPath, srcDir);
- //not necessary? strcat(ob->fluidsimSettings->surfdataPath, "/");
- strcat(ob->fluidsimSettings->surfdataPath, prefix);
-
- // redraw view & buttons...
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWVIEW3D, 0);
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- }
-}
-
-void do_object_panels(unsigned short event)
-{
- Object *ob;
- Effect *eff;
-
- ob= OBACT;
- if(ob==NULL)
- return;
-
- switch(event) {
- case B_TRACKBUTS:
- DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_RECALCPATH:
- DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_DUPLI_FRAME:
- ob->transflag &= ~(OB_DUPLIVERTS|OB_DUPLIFACES|OB_DUPLIGROUP);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- break;
- case B_DUPLI_VERTS:
- ob->transflag &= ~(OB_DUPLIFRAMES|OB_DUPLIFACES|OB_DUPLIGROUP);
- DAG_scene_sort(G.scene);
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- break;
- case B_DUPLI_FACES:
- ob->transflag &= ~(OB_DUPLIVERTS|OB_DUPLIFRAMES|OB_DUPLIGROUP);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- break;
- case B_DUPLI_GROUP:
- ob->transflag &= ~(OB_DUPLIVERTS|OB_DUPLIFRAMES|OB_DUPLIFACES);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- break;
-
- case B_PRINTSPEED:
- {
- float vec[3];
- CFRA++;
- do_ob_ipo(ob);
- where_is_object(ob);
- VECCOPY(vec, ob->obmat[3]);
- CFRA--;
- do_ob_ipo(ob);
- where_is_object(ob);
- VecSubf(vec, vec, ob->obmat[3]);
- prspeed= Normalize(vec);
- scrarea_queue_winredraw(curarea);
- }
- break;
- case B_PRINTLEN:
- if(ob->type==OB_CURVE) {
- Curve *cu=ob->data;
-
- if(cu->path) prlen= cu->path->totdist; else prlen= -1.0;
- scrarea_queue_winredraw(curarea);
- }
- break;
- case B_RELKEY:
- allspace(REMAKEIPO, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWIPO, 0);
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- break;
- case B_CURVECHECK:
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- break;
-
- case B_SOFTBODY_CHANGE:
- ob= OBACT;
- if(ob) {
- ParticleSystem *psys = PE_get_current(ob);
- if(psys)
- psys->softflag |= OB_SB_REDO;
- else
- ob->softflag |= OB_SB_REDO;
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWVIEW3D, 0);
- }
- break;
- case B_SOFTBODY_DEL_VG:
- if(ob->soft) {
- ob->soft->vertgroup= 0;
- ob->softflag |= OB_SB_REDO;
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWVIEW3D, 0);
- }
- break;
- case B_SOFTBODY_BAKE:
- if(ob->soft) softbody_bake(ob);
- break;
- case B_SOFTBODY_BAKE_FREE:
- if(ob->soft) sbObjectToSoftbody(ob);
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_FLUIDSIM_BAKE:
- /* write config files (currently no simulation) */
- fluidsimBake(ob);
- break;
- case B_FLUIDSIM_MAKEPART:
- {
- PartEff *paf= NULL;
- /* prepare fluidsim particle display */
- // simplified delete effect, create new - recalc some particles...
- if(ob==NULL || ob->type!=OB_MESH) break;
- ob->fluidsimSettings->type = 0;
- // reset type, and init particle system once normally
- paf= give_parteff(ob);
- if( (BLI_countlist(&ob->effect)<MAX_EFFECT) &&
- (!paf)) {
- // create new entry
- copy_act_effect(ob); DAG_scene_sort(G.scene); }
- paf = give_parteff(ob);
- if(paf) {
- paf->totpart = 1000; paf->sta = paf->end = 1.0; // generate some particles...
- build_particle_system(ob);
- ob->fluidsimSettings->type = OB_FLUIDSIM_PARTICLE;
- }
- }
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- break;
- case B_FLUIDSIM_SELDIR:
- {
- ScrArea *sa = closest_bigger_area();
- /* choose dir for surface files */
- areawinset(sa->win);
- activate_fileselect(FILE_SPECIAL, "Select Directory", ob->fluidsimSettings->surfdataPath, fluidsimFilesel);
- }
- break;
- case B_FLUIDSIM_FORCEREDRAW:
- /* force redraw */
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWVIEW3D, 0);
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- break;
- case B_GROUP_RELINK:
- group_relink_nla_objects(ob);
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_BAKEABLE_CHANGE:
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_OBJECT_IPOFLAG:
- if(ob->ipo) ob->ipo->showkey= (ob->ipoflag & OB_DRAWKEY)?1:0;
- allqueue(REDRAWVIEW3D, 0);
- break;
-
- default:
- if(event>=B_SELEFFECT && event<B_SELEFFECT+MAX_EFFECT) {
- int a=B_SELEFFECT;
-
- eff= ob->effect.first;
- while(eff) {
- if(event==a) eff->flag |= SELECT;
- else eff->flag &= ~SELECT;
-
- a++;
- eff= eff->next;
- }
- allqueue(REDRAWBUTSOBJECT, 0);
- }
- }
-
-}
-
-static void do_add_groupmenu(void *arg, int event)
-{
- Object *ob= OBACT;
-
- if(ob) {
-
- if(event== -1) {
- Group *group= add_group( "Group" );
- add_to_group(group, ob);
- }
- else
- add_to_group(BLI_findlink(&G.main->group, event), ob);
-
- ob->flag |= OB_FROMGROUP;
- BASACT->flag |= OB_FROMGROUP;
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWVIEW3D, 0);
- }
-}
-
-static uiBlock *add_groupmenu(void *arg_unused)
-{
- uiBlock *block;
- Group *group;
- short yco= 0;
- char str[32];
-
- block= uiNewBlock(&curarea->uiblocks, "add_constraintmenu", UI_EMBOSSP, UI_HELV, curarea->win);
- uiBlockSetButmFunc(block, do_add_groupmenu, NULL);
-
- uiDefBut(block, BUTM, B_NOP, "ADD NEW", 0, 20, 160, 19, NULL, 0.0, 0.0, 1, -1, "");
- for(group= G.main->group.first; group; group= group->id.next, yco++) {
- if(group->id.lib) strcpy(str, "L ");
- else strcpy(str, " ");
- strcat(str, group->id.name+2);
- uiDefBut(block, BUTM, B_NOP, str, 0, -20*yco, 160, 19, NULL, 0.0, 0.0, 1, yco, "");
- }
-
- uiTextBoundsBlock(block, 50);
- uiBlockSetDirection(block, UI_DOWN);
-
- return block;
-}
-
-static void group_ob_rem(void *gr_v, void *ob_v)
-{
- Object *ob= OBACT;
-
- rem_from_group(gr_v, ob);
- if(find_group(ob)==NULL) {
- ob->flag &= ~OB_FROMGROUP;
- BASACT->flag &= ~OB_FROMGROUP;
- }
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWVIEW3D, 0);
-
-}
-
-static void group_local(void *gr_v, void *unused)
-{
- Group *group= gr_v;
-
- group->id.lib= NULL;
-
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWVIEW3D, 0);
-
-}
-
-static void object_panel_object(Object *ob)
-{
- uiBlock *block;
- uiBut *but;
- Group *group;
- int a, xco, yco=0;
- short dx= 33, dy= 30;
-
- block= uiNewBlock(&curarea->uiblocks, "object_panel_object", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Object and Links", "Object", 0, 0, 318, 204)==0) return;
-
- uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
-
- /* object name */
- uiBlockSetCol(block, TH_BUT_SETTING2);
- xco= std_libbuttons(block, 10, 180, 0, NULL, 0, ID_OB, 0, &ob->id, NULL, &(G.buts->menunr), B_OBALONE, B_OBLOCAL, 0, 0, B_KEEPDATA);
- uiBlockSetCol(block, TH_AUTO);
-
- /* parent */
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_OBJECTPANELPARENT, "Par:", xco+5, 180, 305-xco, 20, &ob->parent, "Parent Object");
-
- /* TODO, check for ob->id.lib */
- but = uiDefButS(block, NUM, B_NOP, "PassIndex:", xco+5, 150, 305-xco, 20, &ob->index, 0.0, 1000.0, 0, 0, "Index # for the IndexOB render pass.");
-
- uiDefBlockBut(block, add_groupmenu, NULL, "Add to Group", 10,150,150,20, "Add Object to a new Group");
-
- /* all groups */
- for(group= G.main->group.first; group; group= group->id.next) {
- if(object_in_group(ob, group)) {
- xco= 160;
-
- uiBlockBeginAlign(block);
- but = uiDefBut(block, TEX, B_IDNAME, "GR:", 10, 120-yco, 150, 20, group->id.name+2, 0.0, 21.0, 0, 0, "Displays Group name. Click to change.");
- uiButSetFunc(but, test_idbutton_cb, group->id.name, NULL);
-
- if(group->id.lib) {
- but= uiDefIconBut(block, BUT, B_NOP, ICON_PARLIB, 160, 120-yco, 20, 20, NULL, 0.0, 0.0, 0.0, 0.0, "Make Group local");
- uiButSetFunc(but, group_local, group, NULL);
- xco= 180;
- }
- but = uiDefIconBut(block, BUT, B_NOP, VICON_X, xco, 120-yco, 20, 20, NULL, 0.0, 0.0, 0.0, 0.0, "Remove Group membership");
- uiButSetFunc(but, group_ob_rem, group, ob);
-
- yco+= 20;
- xco= 10;
-
- /* layers */
- uiBlockBeginAlign(block);
- for(a=0; a<5; a++)
- uiDefButBitI(block, TOG, 1<<a, REDRAWVIEW3D, "", (short)(xco+a*(dx/2)), 120-yco, (short)(dx/2), (short)(dy/2), (int *)&(group->layer), 0, 0, 0, 0, "");
- for(a=0; a<5; a++)
- uiDefButBitI(block, TOG, 1<<(a+10), REDRAWVIEW3D, "", (short)(xco+a*(dx/2)), 105-yco, (short)(dx/2), (short)(dy/2), (int *)&(group->layer), 0, 0, 0, 0, "");
-
- xco+= 7;
- uiBlockBeginAlign(block);
- for(a=5; a<10; a++)
- uiDefButBitI(block, TOG, 1<<a, REDRAWVIEW3D, "", (short)(xco+a*(dx/2)), 120-yco, (short)(dx/2), (short)(dy/2), (int *)&(group->layer), 0, 0, 0, 0, "");
- for(a=5; a<10; a++)
- uiDefButBitI(block, TOG, 1<<(a+10), REDRAWVIEW3D, "", (short)(xco+a*(dx/2)), 105-yco, (short)(dx/2), (short)(dy/2), (int *)&(group->layer), 0, 0, 0, 0, "");
-
- uiBlockEndAlign(block);
-
- yco+= 40;
- }
- }
-
- if(120-yco < -10)
- uiNewPanelHeight(block, 204 - (120-yco));
-}
-
-static void object_panel_anim(Object *ob)
-{
- uiBlock *block;
- char str[32];
-
- block= uiNewBlock(&curarea->uiblocks, "object_panel_anim", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Anim settings", "Object", 320, 0, 318, 204)==0) return;
-
- uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
-
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW,B_TRACKBUTS,"TrackX", 24,180,59,19, &ob->trackflag, 12.0, 0.0, 0, 0, "Specify the axis that points to another object");
- uiDefButS(block, ROW,B_TRACKBUTS,"Y", 85,180,19,19, &ob->trackflag, 12.0, 1.0, 0, 0, "Specify the axis that points to another object");
- uiDefButS(block, ROW,B_TRACKBUTS,"Z", 104,180,19,19, &ob->trackflag, 12.0, 2.0, 0, 0, "Specify the axis that points to another object");
- uiDefButS(block, ROW,B_TRACKBUTS,"-X", 124,180,24,19, &ob->trackflag, 12.0, 3.0, 0, 0, "Specify the axis that points to another object");
- uiDefButS(block, ROW,B_TRACKBUTS,"-Y", 150,180,24,19, &ob->trackflag, 12.0, 4.0, 0, 0, "Specify the axis that points to another object");
- uiDefButS(block, ROW,B_TRACKBUTS,"-Z", 178,180,24,19, &ob->trackflag, 12.0, 5.0, 0, 0, "Specify the axis that points to another object");
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW,REDRAWVIEW3D,"UpX", 226,180,45,19, &ob->upflag, 13.0, 0.0, 0, 0, "Specify the axis that points up");
- uiDefButS(block, ROW,REDRAWVIEW3D,"Y", 274,180,20,19, &ob->upflag, 13.0, 1.0, 0, 0, "Specify the axis that points up");
- uiDefButS(block, ROW,REDRAWVIEW3D,"Z", 298,180,19,19, &ob->upflag, 13.0, 2.0, 0, 0, "Specify the axis that points up");
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, OB_DRAWKEY, B_OBJECT_IPOFLAG, "Draw Key", 24,155,71,19, &ob->ipoflag, 0, 0, 0, 0, "Draw object as key position");
- uiDefButBitS(block, TOG, OB_DRAWKEYSEL, REDRAWVIEW3D, "Draw Key Sel", 97,155,81,19, &ob->ipoflag, 0, 0, 0, 0, "Limit the drawing of object keys");
- uiDefButBitS(block, TOG, OB_POWERTRACK, REDRAWVIEW3D, "Powertrack", 180,155,78,19, &ob->transflag, 0, 0, 0, 0, "Switch objects rotation off");
- uiDefButBitS(block, TOG, PARSLOW, 0, "SlowPar", 260,155,56,19, &ob->partype, 0, 0, 0, 0, "Create a delay in the parent relationship");
- uiBlockBeginAlign(block);
-
- uiDefButBitS(block, TOG, OB_DUPLIFRAMES, B_DUPLI_FRAME, "DupliFrames", 24,130,95,20, &ob->transflag, 0, 0, 0, 0, "Make copy of object for every frame");
- uiDefButBitS(block, TOG, OB_DUPLIVERTS, B_DUPLI_VERTS, "DupliVerts", 119,130,95,20, &ob->transflag, 0, 0, 0, 0, "Duplicate child objects on all vertices");
- uiDefButBitS(block, TOG, OB_DUPLIFACES, B_DUPLI_FACES, "DupliFaces", 214,130,102,20, &ob->transflag, 0, 0, 0, 0, "Duplicate child objects on all faces");
- uiDefButBitS(block, TOG, OB_DUPLIGROUP, B_DUPLI_GROUP, "DupliGroup", 24,110,150,20, &ob->transflag, 0, 0, 0, 0, "Enable group instancing");
- if(ob->transflag & OB_DUPLIFRAMES) {
- uiDefButBitS(block, TOG, OB_DUPLINOSPEED, REDRAWVIEW3D, "No Speed", 174,110,142,20, &ob->transflag, 0, 0, 0, 0, "Set dupliframes to still, regardless of frame");
- } else if(ob->transflag & OB_DUPLIVERTS) {
- uiDefButBitS(block, TOG, OB_DUPLIROT, REDRAWVIEW3D, "Rot", 174,110,142,20, &ob->transflag, 0, 0, 0, 0, "Rotate dupli according to vertex normal");
- } else if(ob->transflag & OB_DUPLIFACES) {
- uiDefButBitS(block, TOG, OB_DUPLIFACES_SCALE, REDRAWVIEW3D, "Scale", 174,110,80,20, &ob->transflag, 0, 0, 0, 0, "Scale dupli based on face size");
- uiDefButF(block, NUM, REDRAWVIEW3D, "", 254,110,62,20, &ob->dupfacesca, 0.001, 10000.0, 0, 0, "Scale the DupliFace objects");
- } else {
- uiDefIDPoinBut(block, test_grouppoin_but, ID_GR, B_GROUP_RELINK, "GR:", 174,110,142,20, &ob->dup_group, "Instance an existing group");
- }
-
- uiBlockBeginAlign(block);
- /* DupSta and DupEnd are both shorts, so the maxframe is greater then their range
- just limit the buttons to the max short */
- uiDefButI(block, NUM, REDRAWVIEW3D, "DupSta:", 24,85,141,19, &ob->dupsta, 1.0, 32767, 0, 0, "Specify startframe for Dupliframes");
- uiDefButI(block, NUM, REDRAWVIEW3D, "DupOn:", 170,85,146,19, &ob->dupon, 1.0, 1500.0, 0, 0, "Specify the number of frames to use between DupOff frames");
- uiDefButI(block, NUM, REDRAWVIEW3D, "DupEnd", 24,65,140,19, &ob->dupend, 1.0, 32767, 0, 0, "Specify endframe for Dupliframes");
- uiDefButI(block, NUM, REDRAWVIEW3D, "DupOff", 171,65,145,19, &ob->dupoff, 0.0, 1500.0, 0, 0, "Specify recurring frames to exclude from the Dupliframes");
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, OB_OFFS_OB, REDRAWALL, "Offs Ob", 24,35,56,20, &ob->ipoflag, 0, 0, 0, 0, "Not functional at the moment!");
- uiDefButBitS(block, TOG, OB_OFFS_PARENT, REDRAWALL, "Offs Par", 82,35,56,20 , &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on the parent");
- uiDefButBitS(block, TOG, OB_OFFS_PARTICLE, REDRAWALL, "Offs Particle", 140,35,103,20, &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on the particle effect");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, REDRAWALL, "TimeOffset:", 24,10,115,20, &ob->sf, -MAXFRAMEF, MAXFRAMEF, 100, 0, "Specify an offset in frames");
- uiDefBut(block, BUT, B_AUTOTIMEOFS, "Automatic Time", 139,10,104,20, 0, 0, 0, 0, 0, "Generate automatic timeoffset values for all selected frames");
- uiDefBut(block, BUT, B_PRINTSPEED, "PrSpeed", 248,10,67,20, 0, 0, 0, 0, 0, "Print objectspeed");
- uiBlockEndAlign(block);
-
- sprintf(str, "%.4f", prspeed);
- uiDefBut(block, LABEL, 0, str, 247,35,63,31, NULL, 1.0, 0, 0, 0, "");
-
-}
-
-static void object_panel_draw(Object *ob)
-{
- uiBlock *block;
- int xco, a, dx, dy;
-
- block= uiNewBlock(&curarea->uiblocks, "object_panel_draw", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Draw", "Object", 640, 0, 318, 204)==0) return;
-
- uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
-
- /* LAYERS */
- xco= 120;
- dx= 35;
- dy= 30;
-
- uiDefBut(block, LABEL, 0, "Layers", 10,170,100,20, NULL, 0, 0, 0, 0, "");
-
- uiBlockBeginAlign(block);
- for(a=0; a<5; a++)
- uiDefButBitI(block, TOG, 1<<a, B_OBLAY+a, "", (short)(xco+a*(dx/2)), 180, (short)(dx/2), (short)(dy/2), (int *)&(BASACT->lay), 0, 0, 0, 0, "");
- for(a=0; a<5; a++)
- uiDefButBitI(block, TOG, 1<<(a+10), B_OBLAY+a+10, "", (short)(xco+a*(dx/2)), 165, (short)(dx/2), (short)(dy/2), (int *)&(BASACT->lay), 0, 0, 0, 0, "");
-
- xco+= 7;
- uiBlockBeginAlign(block);
- for(a=5; a<10; a++)
- uiDefButBitI(block, TOG, 1<<a, B_OBLAY+a, "", (short)(xco+a*(dx/2)), 180, (short)(dx/2), (short)(dy/2), (int *)&(BASACT->lay), 0, 0, 0, 0, "");
- for(a=5; a<10; a++)
- uiDefButBitI(block, TOG, 1<<(a+10), B_OBLAY+a+10, "", (short)(xco+a*(dx/2)), 165, (short)(dx/2), (short)(dy/2), (int *)&(BASACT->lay), 0, 0, 0, 0, "");
-
- uiBlockEndAlign(block);
-
- uiDefBut(block, LABEL, 0, "Drawtype", 10,120,100,20, NULL, 0, 0, 0, 0, "");
-
- uiBlockBeginAlign(block);
- uiDefButC(block, ROW, REDRAWVIEW3D, "Shaded", 10,100,100, 20, &ob->dt, 0, OB_SHADED, 0, 0, "Draw active object shaded or textured");
- uiDefButC(block, ROW, REDRAWVIEW3D, "Solid", 10,80,100, 20, &ob->dt, 0, OB_SOLID, 0, 0, "Draw active object in solid");
- uiDefButC(block, ROW, REDRAWVIEW3D, "Wire", 10,60, 100, 20, &ob->dt, 0, OB_WIRE, 0, 0, "Draw active object in wireframe");
- uiDefButC(block, ROW, REDRAWVIEW3D, "Bounds", 10,40, 100, 20, &ob->dt, 0, OB_BOUNDBOX, 0, 0, "Only draw object with bounding box");
- uiBlockEndAlign(block);
-
- uiDefBut(block, LABEL, 0, "Draw Extra", 120,120,90,20, NULL, 0, 0, 0, 0, "");
-
- uiBlockBeginAlign(block);
- uiDefButBitC(block, TOG, OB_BOUNDBOX, REDRAWVIEW3D, "Bounds", 120, 100, 90, 20, &ob->dtx, 0, 0, 0, 0, "Displays the active object's bounds");
- uiDefButBitC(block, TOG, OB_DRAWNAME, REDRAWVIEW3D, "Name", 210, 100, 90, 20, &ob->dtx, 0, 0, 0, 0, "Displays the active object's name");
-
- uiDefButS(block, MENU, REDRAWVIEW3D, "Boundary Display%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Polyheder%x4",
- 120, 80, 90, 20, &ob->boundtype, 0, 0, 0, 0, "Selects the boundary display type");
- uiDefButBitC(block, TOG, OB_AXIS, REDRAWVIEW3D, "Axis", 210, 80, 90, 20, &ob->dtx, 0, 0, 0, 0, "Displays the active object's center and axis");
-
- uiDefButBitC(block, TOG, OB_TEXSPACE, REDRAWVIEW3D, "TexSpace", 120, 60, 90, 20, &ob->dtx, 0, 0, 0, 0, "Displays the active object's texture space");
- uiDefButBitC(block, TOG, OB_DRAWWIRE, REDRAWVIEW3D, "Wire", 210, 60, 90, 20, &ob->dtx, 0, 0, 0, 0, "Adds the active object's wireframe over solid drawing");
-
- uiDefButBitC(block, TOG, OB_DRAWTRANSP, REDRAWVIEW3D, "Transp", 120, 40, 90, 20, &ob->dtx, 0, 0, 0, 0, "Enables transparent materials for the active object (Mesh only)");
- uiDefButBitC(block, TOG, OB_DRAWXRAY, REDRAWVIEW3D, "X-ray", 210, 40, 90, 20, &ob->dtx, 0, 0, 0, 0, "Makes the active object draw in front of others");
-}
-
-void object_panel_constraint(char *context)
-{
- uiBlock *block;
- Object *ob= OBACT;
- ListBase *conlist;
- bConstraint *curcon;
- short xco, yco;
- char str[64];
-
- block= uiNewBlock(&curarea->uiblocks, "object_panel_constraint", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Constraints", context, 960, 0, 318, 204)==0) return;
-
- uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
-
- /* this is a variable height panel, newpanel doesnt force new size on existing panels */
- /* so first we make it default height */
- uiNewPanelHeight(block, 204);
-
- /* do not allow this panel to draw in editmode - why?*/
- if(G.obedit==OBACT) return; // ??
-
- conlist = get_active_constraints(OBACT);
-
- if (conlist) {
- uiDefBlockBut(block, add_constraintmenu, NULL, "Add Constraint", 0, 190, 130, 20, "Add a new constraint");
-
- /* print active object or bone */
- str[0]= 0;
- if (ob->flag & OB_POSEMODE) {
- bPoseChannel *pchan= get_active_posechannel(ob);
- if(pchan) sprintf(str, "To Bone: %s", pchan->name);
- }
- else {
- sprintf(str, "To Object: %s", ob->id.name+2);
- }
- uiDefBut(block, LABEL, 1, str, 150, 190, 150, 20, NULL, 0.0, 0.0, 0, 0, "Displays Active Object or Bone name");
-
- /* Go through the list of constraints and draw them */
- xco = 10;
- yco = 160;
-
- for (curcon = conlist->first; curcon; curcon=curcon->next) {
- /* hrms, the temporal constraint should not draw! */
- if(curcon->type==CONSTRAINT_TYPE_KINEMATIC) {
- bKinematicConstraint *data= curcon->data;
- if(data->flag & CONSTRAINT_IK_TEMP)
- continue;
- }
- /* Draw default constraint header */
- draw_constraint(block, conlist, curcon, &xco, &yco);
- }
-
- if(yco < 0) uiNewPanelHeight(block, 204-yco);
-
- }
-}
-
-void do_effects_panels(unsigned short event)
-{
- Object *ob;
- Base *base;
- Effect *eff, *effn;
- PartEff *paf;
- ModifierData *md;
- ParticleSystemModifierData *psmd;
- ParticleSystem *psys;
- ParticleSettings *part;
- ID *id,*idtest;
- int nr;
-
- ob= OBACT;
-
- psys=psys_get_current(ob);
-
- switch(event) {
-
- case B_AUTOTIMEOFS:
- auto_timeoffs();
- break;
- case B_FRAMEMAP:
- G.scene->r.framelen= G.scene->r.framapto;
- G.scene->r.framelen/= G.scene->r.images;
- allqueue(REDRAWALL, 0);
- break;
- case B_NEWEFFECT:
- if(ob) {
- if(ob->fluidsimFlag & OB_FLUIDSIM_ENABLE) {
- // NT particles and fluid meshes currently dont work together -> switch off beforehand
- if(ob->fluidsimSettings->type == OB_FLUIDSIM_DOMAIN) {
- pupmenu("Fluidsim Particle Error%t|Please disable the fluidsim domain before activating particles.%x0");
- break;
- //ob->fluidsimFlag = 0; ob->fluidsimSettings->type = 0; allqueue(REDRAWVIEW3D, 0);
- }
- }
- if (BLI_countlist(&ob->effect)==MAX_EFFECT)
- error("Unable to add: effect limit reached");
- else
- copy_act_effect(ob);
- }
- DAG_scene_sort(G.scene);
- BIF_undo_push("New effect");
- allqueue(REDRAWBUTSOBJECT, 0);
- break;
- case B_DELEFFECT:
- if(ob==NULL || ob->type!=OB_MESH) break;
- eff= ob->effect.first;
- while(eff) {
- effn= eff->next;
- if(eff->flag & SELECT) {
- BLI_remlink(&ob->effect, eff);
- free_effect(eff);
- break;
- }
- eff= effn;
- }
- BIF_undo_push("Delete effect");
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- break;
- case B_NEXTEFFECT:
- if(ob==0 || ob->type!=OB_MESH) break;
- eff= ob->effect.first;
- while(eff) {
- if(eff->flag & SELECT) {
- if(eff->next) {
- eff->flag &= ~SELECT;
- eff->next->flag |= SELECT;
- }
- break;
- }
- eff= eff->next;
- }
- allqueue(REDRAWBUTSOBJECT, 0);
- break;
- case B_PREVEFFECT:
- if(ob==0 || ob->type!=OB_MESH) break;
- eff= ob->effect.first;
- while(eff) {
- if(eff->flag & SELECT) {
- if(eff->prev) {
- eff->flag &= ~SELECT;
- eff->prev->flag |= SELECT;
- }
- break;
- }
- eff= eff->next;
- }
- allqueue(REDRAWBUTSOBJECT, 0);
- break;
- case B_EFFECT_DEP:
- DAG_scene_sort(G.scene);
- /* no break, pass on */
- case B_CALCEFFECT:
- if(ob==NULL || ob->type!=OB_MESH) break;
- eff= ob->effect.first;
- while(eff) {
- if(eff->flag & SELECT) {
- if(eff->type==EFF_PARTICLE) build_particle_system(ob);
- }
- eff= eff->next;
- }
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- break;
- case B_PAF_SET_VG:
-
- paf= give_parteff(ob);
- if(paf) {
- bDeformGroup *dg= get_named_vertexgroup(ob, paf->vgroupname);
- if(dg)
- paf->vertgroup= get_defgroup_num(ob, dg)+1;
- else
- paf->vertgroup= 0;
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- }
- break;
- case B_PAF_SET_VG1:
-
- paf= give_parteff(ob);
- if(paf) {
- bDeformGroup *dg= get_named_vertexgroup(ob, paf->vgroupname_v);
- if(dg)
- paf->vertgroup_v= get_defgroup_num(ob, dg)+1;
- else
- paf->vertgroup_v= 0;
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- }
- break;
- case B_PARTBROWSE:
- if(G.buts->menunr== -2) {
- activate_databrowse((ID *)G.buts->lockpoin, ID_PA, 0, B_PARTBROWSE, &G.buts->menunr, do_effects_panels);
- return;
- }
-
- if(G.buts->menunr < 0) return;
-
- if(G.buts->pin) {
-
- }
- else {
- psys= psys_get_current(ob);
- if(psys)
- part=psys->part;
- else
- part=NULL;
-
- nr= 1;
-
- id= (ID *)part;
-
- idtest= G.main->particle.first;
- while(idtest) {
- if(nr==G.buts->menunr) {
- break;
- }
- nr++;
- idtest= idtest->next;
- }
- if(idtest==0) { /* new particle system */
- if(id){
- idtest= (ID *)psys_copy_settings((ParticleSettings *)id);
- }
- else {
- idtest= (ID *)psys_new_settings("PSys", G.main);
- }
- idtest->us--;
- }
- if(idtest!=id) {
- short nr=0;
- if(id==0){ /* no psys previously -> no modifier -> need to create that also */
- psys = MEM_callocN(sizeof(ParticleSystem), "particle_system");
- BLI_addtail(&ob->particlesystem,psys);
-
- md= modifier_new(eModifierType_ParticleSystem);
- sprintf(md->name, "ParticleSystem %i", BLI_countlist(&ob->particlesystem));
- psmd= (ParticleSystemModifierData*) md;
- psmd->psys=psys;
- BLI_addtail(&ob->modifiers, md);
- }
-
- idtest->us++;
- psys->part=(ParticleSettings*)idtest;
- psys->totpart=0;
- psys->flag=PSYS_ENABLED|PSYS_CURRENT;
- psys->cfra=bsystem_time(ob,G.scene->r.cfra+1,0.0);
-
- /* check need for dupliobjects */
- nr=0;
- for(psys=ob->particlesystem.first; psys; psys=psys->next){
- if(ELEM(psys->part->draw_as,PART_DRAW_OB,PART_DRAW_GR))
- nr++;
- }
- if(nr)
- ob->transflag |= OB_DUPLIPARTS;
- else
- ob->transflag &= ~OB_DUPLIPARTS;
-
- BIF_undo_push("Browse Particle System");
-
- DAG_scene_sort(G.scene);
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWOOPS, 0);
- }
-
- }
- break;
- case B_PARTDELETE:
- if(ob && ob->particlesystem.first){
- psys= psys_get_current(ob);
- if(psys) {
- /* clear modifier */
- psmd= psys_get_modifier(ob,psys);
- BLI_remlink(&ob->modifiers, psmd);
- modifier_free((ModifierData *)psmd);
-
- /* clear particle system */
- BLI_remlink(&ob->particlesystem,psys);
- psys_free(ob,psys);
-
- BIF_undo_push("Delete particle system");
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWOOPS, 0);
- }
- }
- break;
- case B_PARTALONE: /* TODO: not too sure of how this works so someone check please, jahka */
- if(ob && (psys=psys_get_current(ob))){
- if(psys->part) {
- if(psys->part->id.us>1){
- if(okee("Make local")){
- part=psys_copy_settings(psys->part);
- part->id.us=1;
- psys->part->id.us--;
- psys->part=part;
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWOOPS, 0);
-
- BIF_undo_push("Make single user or local");
- }
- }
- }
- }
- break;
- case B_PART_ALLOC:
- case B_PART_ALLOC_CHILD:
- if(psys){
- psys_flush_settings(psys->part,PSYS_ALLOC,event==B_PART_ALLOC);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWOOPS, 0);
- }
- break;
- case B_PART_DISTR:
- case B_PART_DISTR_CHILD:
- if(psys){
- psys_flush_settings(psys->part,PSYS_DISTR,event==B_PART_DISTR);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWOOPS, 0);
- }
- break;
- case B_PART_INIT:
- case B_PART_INIT_CHILD:
- if(psys){
- psys_flush_settings(psys->part,PSYS_INIT,event==B_PART_INIT);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWOOPS, 0);
- }
- break;
- case B_PART_ENABLE:
- if(psys) {
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- }
- break;
- case B_PART_RECALC:
- case B_PART_RECALC_CHILD:
- if(psys){
- psys_flush_settings(psys->part,0,event==B_PART_RECALC);
- allqueue(REDRAWOOPS, 0);
- }
- /* no break! */
- case B_PART_REDRAW:
- nr=0;
- for(psys=ob->particlesystem.first; psys; psys=psys->next){
- if(ELEM(psys->part->draw_as,PART_DRAW_OB,PART_DRAW_GR))
- nr++;
- }
- if(nr)
- ob->transflag |= OB_DUPLIPARTS;
- else
- ob->transflag &= ~OB_DUPLIPARTS;
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- break;
- case B_PARTTYPE:
- if((psys=psys_get_current(ob))){
- DAG_scene_sort(G.scene);
-
- psys_flush_settings(psys->part,PSYS_TYPE,1);
- }
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- break;
- case B_PARTACT:
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWIPO, 0);
- break;
- case B_PARTTARGET:
- if((psys=psys_get_current(ob))){
- if(psys->keyed_ob==ob || psys->target_ob==ob){
- if(psys->keyed_ob==ob)
- psys->keyed_ob=NULL;
- else
- psys->target_ob=NULL;
- }
- else{
- DAG_scene_sort(G.scene);
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- }
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- }
- break;
- case B_PART_REKEY:
- PE_rekey();
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- break;
- case B_PART_EDITABLE:
- if((psys = psys_get_current(ob))) {
- if(psys->flag & PSYS_EDITED){
- if(okee("Lose changes done in particle mode?")){
- if(psys->edit)
- PE_free_particle_edit(psys);
-
- psys->flag &= ~PSYS_EDITED;
- psys->recalc |= PSYS_RECALC_HAIR;
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- }
- }
- else {
- psys->flag |= PSYS_EDITED;
- if(G.f & G_PARTICLEEDIT)
- PE_create_particle_edit(ob, psys);
- }
- }
- case B_FIELD_DEP:
- /* do this before scene sort, that one checks for CU_PATH */
- if(ob->type==OB_CURVE && ob->pd->forcefield==PFIELD_GUIDE) {
- Curve *cu= ob->data;
-
- cu->flag |= (CU_PATH|CU_3D);
- do_curvebuts(B_CU3D); /* all curves too */
- }
- DAG_scene_sort(G.scene);
-
- if(ob->type==OB_CURVE && ob->pd->forcefield==PFIELD_GUIDE)
- DAG_object_flush_update(G.scene, ob, OB_RECALC);
- else
- DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- break;
- case B_FIELD_CHANGE:
- if(ob->pd->forcefield != PFIELD_TEXTURE && ob->pd->tex){
- ob->pd->tex->id.us--;
- ob->pd->tex=0;
- }
- DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_RECALCAL:
- if (G.vd==NULL)
- break;
-
- base= FIRSTBASE;
- while(base) {
- if(base->lay & G.vd->lay) {
- ob= base->object;
- eff= ob->effect.first;
- while(eff) {
- if(eff->flag & SELECT) {
- if(eff->type==EFF_PARTICLE) build_particle_system(ob);
- }
- eff= eff->next;
- }
- }
- base= base->next;
- }
- allqueue(REDRAWVIEW3D, 0);
- break;
- default:
- if(event>=B_SELEFFECT && event<B_SELEFFECT+MAX_EFFECT) {
- ob= OBACT;
- if(ob) {
- int a=B_SELEFFECT;
-
- eff= ob->effect.first;
- while(eff) {
- if(event==a) eff->flag |= SELECT;
- else eff->flag &= ~SELECT;
-
- a++;
- eff= eff->next;
- }
- allqueue(REDRAWBUTSOBJECT, 0);
- }
- }
- }
-
-}
-
-/* copy from buttons_editing.c */
-static void field_testTexture(char *name, ID **idpp)
-{
- ID *id;
-
- for(id = G.main->tex.first; id; id = id->next) {
- if(strcmp(name, id->name + 2) == 0) {
- *idpp = id;
- /* texture gets user, objects not: delete object = clear modifier */
- id_us_plus(id);
- return;
- }
- }
- *idpp = 0;
-}
-/* Panels for particle interaction settings */
-static void object_panel_deflection(Object *ob)
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "object_panel_deflection", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Deflection", "Physics", 0, 0, 318, 204)==0) return;
-
- uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
-
- /* should become button, option? */
- if(ob->pd==NULL) {
- ob->pd= MEM_callocN(sizeof(PartDeflect), "PartDeflect");
- /* and if needed, init here */
- ob->pd->pdef_sbdamp = 0.1f;
- ob->pd->pdef_sbift = 0.2f;
- ob->pd->pdef_sboft = 0.02f;
- }
-
- /* only meshes collide now */
- if(ob->pd && ob->type==OB_MESH) {
- PartDeflect *pd= ob->pd;
-
- uiDefButBitS(block, TOG, 1, B_REDR, "Deflection",160,160,150,20, &pd->deflect, 0, 0, 0, 0, "Deflects particles based on collision");
- if(pd->deflect) {
- uiDefBut(block, LABEL, 0, "Particles", 160,140,75,20, NULL, 0.0, 0, 0, 0, "");
- uiDefButBitS(block, TOG, PDEFLE_KILL_PART, B_DIFF, "Kill",235,140,75,20, &pd->flag, 0, 0, 0, 0, "Kill collided particles");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_DIFF, "Damping: ", 160,120,75,20, &pd->pdef_damp, 0.0, 1.0, 10, 0, "Amount of damping during particle collision");
- uiDefButF(block, NUM, B_DIFF, "Rnd Damping: ", 235,120,75,20, &pd->pdef_rdamp, 0.0, 1.0, 10, 0, "Random variation of damping");
- uiDefButF(block, NUM, B_DIFF, "Friction: ", 160,100,75,20, &pd->pdef_frict, 0.0, 1.0, 10, 0, "Amount of friction during particle collision");
- uiDefButF(block, NUM, B_DIFF, "Rnd Friction: ", 235,100,75,20, &pd->pdef_rfrict, 0.0, 1.0, 10, 0, "Random variation of friction");
- uiDefButF(block, NUM, B_DIFF, "Permeability: ", 160,80,150,20, &pd->pdef_perm, 0.0, 1.0, 10, 0, "Chance that the particle will pass through the mesh");
- uiBlockEndAlign(block);
-
- uiDefBut(block, LABEL, 0, "Soft Body", 160,60,150,20, NULL, 0.0, 0, 0, 0, "");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_FIELD_CHANGE, "Damping:", 160,40,150,20, &pd->pdef_sbdamp, 0.0, 1.0, 10, 0, "Amount of damping during soft body collision");
- uiDefButF(block, NUM, B_FIELD_CHANGE, "Inner:", 160,20,150,20, &pd->pdef_sbift, 0.001, 1.0, 10, 0, "Inner face thickness");
- uiDefButF(block, NUM, B_FIELD_CHANGE, "Outer:", 160, 0,150,20, &pd->pdef_sboft, 0.001, 1.0, 10, 0, "Outer face thickness");
- }
- }
-}
-static void object_panel_fields(Object *ob)
-{
- uiBlock *block;
- uiBut *but;
- int particles=0;
- static short actpsys=-1;
-
- block= uiNewBlock(&curarea->uiblocks, "object_panel_fields", UI_EMBOSS, UI_HELV, curarea->win);
- uiNewPanelTabbed("Deflection", "Physics");
- if(uiNewPanel(curarea, block, "Fields", "Physics", 0, 0, 318, 204)==0) return;
-
- uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
-
- /* should become button, option? */
- if(ob->pd==NULL) {
- ob->pd= MEM_callocN(sizeof(PartDeflect), "PartDeflect");
- /* and if needed, init here */
- ob->pd->pdef_sbdamp = 0.1f;
- ob->pd->pdef_sbift = 0.2f;
- ob->pd->pdef_sboft = 0.02f;
- }
-
- if(ob->pd) {
- PartDeflect *pd= ob->pd;
- char *menustr= MEM_mallocN(256, "temp string");
- char *tipstr="Choose field type";
-
- if(ob->particlesystem.first) {
- ParticleSystem *psys;
- char *menustr2= psys_menu_string(ob,1);
-
- psys= psys_get_current(ob);
- if(psys && actpsys >= 0) {
- actpsys= psys_get_current_num(ob)+1;
-
- if(psys->part->pd==NULL)
- psys->part->pd= MEM_callocN(sizeof(PartDeflect), "PartDeflect");
-
- pd= psys->part->pd;
- particles=1;
- }
- else
- actpsys= -1; /* -1 = object */
-
- but=uiDefButS(block, MENU, B_BAKE_REDRAWEDIT, menustr2, 10,180,70,20, &actpsys, 14.0, 0.0, 0, 0, "Browse systems");
- uiButSetFunc(but, PE_change_act, ob, &actpsys);
-
- MEM_freeN(menustr2);
- }
-
- /* setup menu button */
- if(particles){
- sprintf(menustr, "Field Type%%t|None%%x0|Spherical%%x%d|Wind%%x%d|Vortex%%x%d|Magnetic%%x%d|Harmonic%%x%d",
- PFIELD_FORCE, PFIELD_WIND, PFIELD_VORTEX, PFIELD_MAGNET, PFIELD_HARMONIC);
-
- if(pd->forcefield==PFIELD_FORCE) tipstr= "Particle attracts or repels particles";
- else if(pd->forcefield==PFIELD_WIND) tipstr= "Constant force applied in direction of particle Z axis";
- else if(pd->forcefield==PFIELD_VORTEX) tipstr= "Particles swirl around Z-axis of the particle";
- }
- else{
- if(ob->type==OB_CURVE)
- sprintf(menustr, "Field Type%%t|None%%x0|Spherical%%x%d|Wind%%x%d|Vortex%%x%d|Curve Guide%%x%d|Magnetic%%x%d|Harmonic%%x%d|Texture%%x%d",
- PFIELD_FORCE, PFIELD_WIND, PFIELD_VORTEX, PFIELD_GUIDE, PFIELD_MAGNET, PFIELD_HARMONIC, PFIELD_TEXTURE);
- else
- sprintf(menustr, "Field Type%%t|None%%x0|Spherical%%x%d|Wind%%x%d|Vortex%%x%d|Magnetic%%x%d|Harmonic%%x%d|Texture%%x%d",
- PFIELD_FORCE, PFIELD_WIND, PFIELD_VORTEX, PFIELD_MAGNET, PFIELD_HARMONIC, PFIELD_TEXTURE);
-
- if(pd->forcefield==PFIELD_FORCE) tipstr= "Object center attracts or repels particles";
- else if(pd->forcefield==PFIELD_WIND) tipstr= "Constant force applied in direction of Object Z axis";
- else if(pd->forcefield==PFIELD_VORTEX) tipstr= "Particles swirl around Z-axis of the Object";
- else if(pd->forcefield==PFIELD_GUIDE) tipstr= "Use a Curve Path to guide particles";
- }
-
- if(ob->particlesystem.first)
- uiDefButS(block, MENU, B_FIELD_DEP, menustr, 80,180,70,20, &pd->forcefield, 0.0, 0.0, 0, 0, tipstr);
- else
- uiDefButS(block, MENU, B_FIELD_DEP, menustr, 10,180,140,20, &pd->forcefield, 0.0, 0.0, 0, 0, tipstr);
-
- MEM_freeN(menustr);
-
- if(pd->forcefield) {
- uiBlockBeginAlign(block);
- if(pd->forcefield == PFIELD_GUIDE) {
- uiDefButF(block, NUM, B_FIELD_CHANGE, "MinDist: ", 10,140,140,20, &pd->f_strength, 0.0, 1000.0, 10, 0, "The distance from which particles are affected fully.");
- uiDefButF(block, NUM, B_FIELD_CHANGE, "Fall-off: ", 10,120,140,20, &pd->f_power, 0.0, 10.0, 10, 0, "Falloff factor, between mindist and maxdist");
- uiDefButF(block, NUM, B_FIELD_CHANGE, "Free: ", 10,100,140,20, &pd->free_end, 0.0, 0.99, 10, 0, "Guide-free time from particle life's end");
- uiBlockEndAlign(block);
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, PFIELD_USEMAX, B_FIELD_CHANGE, "Use", 10,80,40,20, &pd->flag, 0.0, 0, 0, 0, "Use a maximum distance for the field to work");
- uiDefButF(block, NUM, B_FIELD_CHANGE, "MaxDist: ", 50,80,100,20, &pd->maxdist, 0, 1000.0, 10, 0, "Maximum distance for the field to work");
- }
- else {
- uiDefButF(block, NUM, B_FIELD_CHANGE, "Strength: ", 10,140,140,20, &pd->f_strength, -1000, 1000, 10, 0, "Strength of force field");
-
- if(pd->forcefield == PFIELD_TEXTURE){
- uiDefIDPoinBut(block, field_testTexture, ID_TE, B_FIELD_CHANGE, "Texture: ", 10, 120, 140, 20, &pd->tex, "Texture to use as force");
- uiDefButBitS(block, TOG, PFIELD_TEX_OBJECT, B_FIELD_CHANGE, "Use Object Co", 10,100,140,20, &pd->flag, 0.0, 0, 0, 0, "Use object/global coordinates for texture");
- uiDefButBitS(block, TOG, PFIELD_TEX_2D, B_FIELD_CHANGE, "2D", 10,80,140,20, &pd->flag, 0.0, 0, 0, 0, "Apply force only in 2d");
- }
- else if(pd->forcefield == PFIELD_HARMONIC)
- uiDefButF(block, NUM, B_FIELD_CHANGE, "Damp: ", 10,120,140,20, &pd->f_damp, 0, 10, 10, 0, "Damping of the harmonic force");
- }
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- if(pd->forcefield == PFIELD_GUIDE){
- uiDefButBitS(block, TOG, PFIELD_GUIDE_PATH_ADD, B_FIELD_CHANGE, "Additive", 10,40,140,20, &pd->flag, 0.0, 0, 0, 0, "Based on distance/falloff it adds a portion of the entire path");
- }
- else if(pd->forcefield==PFIELD_TEXTURE){
- uiDefButS(block, MENU, B_FIELD_CHANGE, "Texture mode%t|RGB%x0|Gradient%x1|Curl%x2", 10,40,140,20, &pd->tex_mode, 0.0, 0.0, 0, 0, "How the texture effect is calculated (RGB & Curl need a RGB texture)");
-
- uiDefButF(block, NUM, B_FIELD_CHANGE, "Nabla:", 10,20,140,20, &pd->tex_nabla, 0.0001f, 1.0, 1, 0, "Specify the dimension of the area for gradient and curl calculation");
- }
- else if(particles==0 && ELEM(pd->forcefield,PFIELD_VORTEX,PFIELD_WIND)==0){
- //uiDefButF(block, NUM, B_FIELD_CHANGE, "Distance: ", 10,20,140,20, &pd->f_dist, 0, 1000.0, 10, 0, "Falloff power (real gravitational fallof = 2)");
- uiDefButBitS(block, TOG, PFIELD_PLANAR, B_FIELD_CHANGE, "Planar", 10,0,140,20, &pd->flag, 0.0, 0, 0, 0, "Create planar field");
- }
- uiBlockEndAlign(block);
-
- if(pd->forcefield==PFIELD_GUIDE){
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_FIELD_CHANGE, "Clump:", 160,180,140,20, &pd->clump_fac, -1.0, 1.0, 1, 3, "Amount of clumpimg");
- uiDefButF(block, NUMSLI, B_FIELD_CHANGE, "Shape:", 160,160,140,20, &pd->clump_pow, -0.999, 0.999, 1, 3, "Shape of clumpimg");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- if(pd->kink){
- uiDefButS(block, MENU, B_FIELD_CHANGE, "Kink:%t|Roll%x6|Rotation%x5|Braid%x4|Wave%x3|Radial%x2|Curl%x1|Nothing%x0", 160,120,70,20, &pd->kink, 14.0, 0.0, 0, 0, "Type of periodic offset on the curve");
- uiDefButS(block, MENU, B_FIELD_CHANGE, "Axis %t|Z %x2|Y %x1|X %x0", 230,120,70,20, &pd->kink_axis, 14.0, 0.0, 0, 0, "Which axis to use for offset");
- uiDefButF(block, NUM, B_FIELD_CHANGE, "Freq:", 160,100,140,20, &pd->kink_freq, 0.0, 10.0, 1, 3, "The frequency of the offset (1/total length)");
- uiDefButF(block, NUMSLI, B_FIELD_CHANGE, "Shape:", 160,80,140,20, &pd->kink_shape, -0.999, 0.999, 1, 3, "Adjust the offset to the beginning/end");
- uiDefButF(block, NUM, B_FIELD_CHANGE, "Amplitude:", 160,60,140,20, &pd->kink_amp, 0.0, 10.0, 1, 3, "The amplitude of the offset");
- }
- else{
- uiDefButS(block, MENU, B_FIELD_CHANGE, "Kink:%t|Roll%x6|Rotation%x5|Braid%x4|Wave%x3|Radial%x2|Curl%x1|Nothing%x0", 160,120,140,20, &pd->kink, 14.0, 0.0, 0, 0, "Type of periodic offset on the curve");
- }
- uiBlockEndAlign(block);
- }
- else{
- uiDefButS(block, MENU, B_FIELD_DEP, "Fall-off%t|Cone%x2|Tube%x1|Sphere%x0", 160,180,140,20, &pd->falloff, 0.0, 0.0, 0, 0, tipstr);
- if(pd->falloff==PFIELD_FALL_TUBE)
- uiDefBut(block, LABEL, 0, "Lognitudinal", 160,160,70,20, NULL, 0.0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, PFIELD_POSZ, B_FIELD_CHANGE, "Pos", 160,140,40,20, &pd->flag, 0.0, 0, 0, 0, "Effect only in direction of positive Z axis");
- uiDefButF(block, NUM, B_FIELD_CHANGE, "Fall-off: ", 200,140,100,20, &pd->f_power, 0, 10, 10, 0, "Falloff power (real gravitational falloff = 2)");
- uiDefButBitS(block, TOG, PFIELD_USEMAX, B_FIELD_CHANGE, "Use", 160,120,40,20, &pd->flag, 0.0, 0, 0, 0, "Use a maximum distance for the field to work");
- uiDefButF(block, NUM, B_FIELD_CHANGE, "MaxDist: ", 200,120,100,20, &pd->maxdist, 0, 1000.0, 10, 0, "Maximum distance for the field to work");
- uiDefButBitS(block, TOG, PFIELD_USEMIN, B_FIELD_CHANGE, "Use", 160,100,40,20, &pd->flag, 0.0, 0, 0, 0, "Use a minimum distance for the field's fall-off");
- uiDefButF(block, NUM, B_FIELD_CHANGE, "MinDist: ", 200,100,100,20, &pd->mindist, 0, 1000.0, 10, 0, "Minimum distance for the field's fall-off");
- uiBlockEndAlign(block);
-
- if(pd->falloff==PFIELD_FALL_TUBE){
- uiDefBut(block, LABEL, 0, "Radial", 160,80,70,20, NULL, 0.0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_FIELD_CHANGE, "Fall-off: ", 160,60,140,20, &pd->f_power_r, 0, 10, 10, 0, "Radial falloff power (real gravitational falloff = 2)");
- uiDefButBitS(block, TOG, PFIELD_USEMAXR, B_FIELD_CHANGE, "Use", 160,40,40,20, &pd->flag, 0.0, 0, 0, 0, "Use a maximum radial distance for the field to work");
- uiDefButF(block, NUM, B_FIELD_CHANGE, "MaxDist: ", 200,40,100,20, &pd->maxrad, 0, 1000.0, 10, 0, "Maximum radial distance for the field to work");
- uiDefButBitS(block, TOG, PFIELD_USEMINR, B_FIELD_CHANGE, "Use", 160,20,40,20, &pd->flag, 0.0, 0, 0, 0, "Use a minimum radial distance for the field's fall-off");
- uiDefButF(block, NUM, B_FIELD_CHANGE, "MinDist: ", 200,20,100,20, &pd->minrad, 0, 1000.0, 10, 0, "Minimum radial distance for the field's fall-off");
- uiBlockEndAlign(block);
- }
- else if(pd->falloff==PFIELD_FALL_CONE){
- uiDefBut(block, LABEL, 0, "Angular", 160,80,70,20, NULL, 0.0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_FIELD_CHANGE, "Fall-off: ", 160,60,140,20, &pd->f_power_r, 0, 10, 10, 0, "Radial falloff power (real gravitational falloff = 2)");
- uiDefButBitS(block, TOG, PFIELD_USEMAXR, B_FIELD_CHANGE, "Use", 160,40,40,20, &pd->flag, 0.0, 0, 0, 0, "Use a maximum angle for the field to work");
- uiDefButF(block, NUM, B_FIELD_CHANGE, "MaxAngle: ", 200,40,100,20, &pd->maxrad, 0, 89.0, 10, 0, "Maximum angle for the field to work (in radians)");
- uiDefButBitS(block, TOG, PFIELD_USEMINR, B_FIELD_CHANGE, "Use", 160,20,40,20, &pd->flag, 0.0, 0, 0, 0, "Use a minimum angle for the field's fall-off");
- uiDefButF(block, NUM, B_FIELD_CHANGE, "MinAngle: ", 200,20,100,20, &pd->minrad, 0, 89.0, 10, 0, "Minimum angle for the field's fall-off (in radians)");
- uiBlockEndAlign(block);
- }
- }
- }
- }
-}
-
-/* Panel for softbodies */
-static void object_softbodies__enable(void *ob_v, void *arg2)
-{
- Object *ob = ob_v;
- ModifierData *md = modifiers_findByType(ob, eModifierType_Softbody);
-
- if (modifiers_isSoftbodyEnabled(ob)) {
- if (md) {
- md->mode &= ~(eModifierMode_Render|eModifierMode_Realtime);
- }
- } else {
- if (!md) {
- md = modifier_new(eModifierType_Softbody);
- BLI_addhead(&ob->modifiers, md);
- }
-
- md->mode |= eModifierMode_Render|eModifierMode_Realtime;
-
- if (!ob->soft) {
- ob->soft= sbNew();
- ob->softflag |= OB_SB_GOAL|OB_SB_EDGES;
- softbody_clear_cache(ob, CFRA);
- }
- }
- /* needed so that initial state is cached correctly */
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
-
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static int _can_softbodies_at_all(Object *ob)
-{
- // list of Yes
- if ((ob->type==OB_MESH)
- || (ob->type==OB_CURVE)
- || (ob->type==OB_LATTICE)
- || (ob->type==OB_SURF)
- ) return 1;
- // else deny
- return 0;
-}
-static void object_softbodies__enable_psys(void *ob_v, void *psys_v)
-{
- ParticleSystem *psys = psys_v;
- Object *ob = ob_v;
-
- if(psys->softflag & OB_SB_ENABLE){
- psys->softflag &= ~OB_SB_ENABLE;
- }
- else{
- if (!psys->soft) {
- psys->soft= sbNew();
- psys->softflag |= OB_SB_GOAL|OB_SB_EDGES;
- psys->soft->particles=psys;
- clear_particles_from_cache(ob, psys, CFRA);
- }
- psys->softflag |= OB_SB_ENABLE;
- }
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
-
- allqueue(REDRAWBUTSEDIT, 0);
-}
-
-static void object_softbodies_II(Object *ob)
-{
- SoftBody *sb=ob->soft;
- uiBlock *block;
- static int val;
- short *softflag=&ob->softflag, psys_cur=0;
- int ob_has_hair=psys_ob_has_hair(ob);
- if(!_can_softbodies_at_all(ob)) return;
- /*bah that is ugly! creating missing data members in UI code*/
- if(ob->pd == NULL){
- ob->pd= MEM_callocN(sizeof(PartDeflect), "PartDeflect");
- ob->pd->pdef_sbdamp = 0.1f;
- ob->pd->pdef_sbift = 0.2f;
- ob->pd->pdef_sboft = 0.02f;
- }
- block= uiNewBlock(&curarea->uiblocks, "object_softbodies_II", UI_EMBOSS, UI_HELV, curarea->win);
- uiNewPanelTabbed("Soft Body", "Physics");
- if(uiNewPanel(curarea, block, "Soft Body Collision", "Physics", 651, 0, 318, 204)==0) return;
-
- uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
-
- if(ob_has_hair) {
- if(PE_get_current_num(ob) >= 0) {
- ParticleSystem *psys = PE_get_current(ob);
- if(psys) {
- sb = psys->soft;
- softflag = &psys->softflag;
- psys_cur = 1;
- }
- }
- }
-
- if(psys_cur) {
- if(*softflag & OB_SB_ENABLE)
- val = 1;
- else
- val = 0;
- }
- else
- val = modifiers_isSoftbodyEnabled(ob);
-
- if(!val) {
- uiDefBut(block, LABEL, 0, "",10,10,1,2, NULL, 0.0, 0, 0, 0, ""); /* tell UI we go to 10,10*/
- uiBlockBeginAlign(block);
- if(psys_cur){
- uiDefBut(block, LABEL, 0, "Hair is not a softbody",10,190,300,20, NULL, 0.0, 0, 0, 0, "");
- uiDefBut(block, LABEL, 0, "However the emitter can deflect a softbody",10,170,300,20, NULL, 0.0, 0, 0, 0, "");
- }
- else {
- uiDefBut(block, LABEL, 0, "Object is not a softbody",10,190,300,20, NULL, 0.0, 0, 0, 0, "");
- uiDefBut(block, LABEL, 0, "However it can deflect a softbody",10,170,300,20, NULL, 0.0, 0, 0, 0, "");
- }
- /* OTHER OBJECTS COLLISION STUFF */
- if (ob->type==OB_MESH){
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, 1, B_REDR, "Deflection",10,50,150,20, &ob->pd->deflect, 0, 0, 0, 0, "Makes this object visible to softbody objects");
- if(ob->pd->deflect) {
- uiDefButF(block, NUM, B_FIELD_CHANGE, "Damping:", 160,50,150,20, &ob->pd->pdef_sbdamp, 0.0, 1.0, 10, 0, "Amount of damping during soft body collision");
- uiDefButBitS(block, TOG,OB_SB_COLLFINAL , B_DIFF, "Ev.M.Stack",10,30,150,20, &ob->softflag, 0, 0, 0, 0, "Pick collision object from modifier stack");
- uiDefButF(block, NUM, B_FIELD_CHANGE, "Inner:", 160,30,150,20, &ob->pd->pdef_sbift, 0.001, 1.0, 10, 0, "Inner face thickness");
- uiDefButF(block, NUM, B_FIELD_CHANGE, "Outer:", 160,10,150,20, &ob->pd->pdef_sboft, 0.001, 1.0, 10, 0, "Outer face thickness");
- }
- }
- uiBlockEndAlign(block);
- }
- else{
- /* SELF COLLISION STUFF */
- if ((ob->type==OB_MESH)||(ob->type==OB_CURVE) ) {
- uiBlockBeginAlign(block);
- if (*softflag & OB_SB_EDGES){
- uiDefButBitS(block, TOG, OB_SB_SELF, B_SOFTBODY_CHANGE, "Self Collision", 10,170,150,20, softflag, 0, 0, 0, 0, "enable naive vertex ball self collision");
- if(*softflag & OB_SB_SELF){
- uiDefButF(block, NUM, B_SOFTBODY_CHANGE, "Ball Size:", 160,170,150,20, &sb->colball, -10.0, 10.0, 10, 0, "Absolute ball size or factor if not manual adjusted");
- uiDefButS(block, ROW, B_DIFF, "Man",10,150,60,20, &sb->sbc_mode, 4.0,SBC_MODE_MANUAL, 0, 0, "Manual adjust");
- uiDefButS(block, ROW, B_DIFF, "Av",70,150,60,20, &sb->sbc_mode, 4.0,SBC_MODE_AVG, 0, 0, "Average Spring lenght * Ball Size");
- uiDefButS(block, ROW, B_DIFF, "Min",130,150,60,20, &sb->sbc_mode, 4.0,SBC_MODE_MIN, 0, 0, "Minimal Spring lenght * Ball Size");
- uiDefButS(block, ROW, B_DIFF, "Max",190,150,60,20, &sb->sbc_mode, 4.0,SBC_MODE_MAX, 0, 0, "Maximal Spring lenght * Ball Size");
- uiDefButS(block, ROW, B_DIFF, "AvMiMa",250,150,60,20, &sb->sbc_mode, 4.0,SBC_MODE_AVGMINMAX, 0, 0, "(Min+Max)/2 * Ball Size");
- uiDefButF(block, NUM, B_DIFF, "B Stiff:", 10,130,150,20, &sb->ballstiff, 0.001, 100.0, 10, 0, "Ball inflating presure");
- uiDefButF(block, NUM, B_DIFF, "B Damp:", 160,130,150,20, &sb->balldamp, 0.001, 1.0, 10, 0, "Blending to inelastic collision");
- }
- }
- else{
- uiDefBut(block, LABEL, 0, "<Self Collision> not available because there",10,170,300,20, NULL, 0.0, 0, 0, 0, "");
- uiDefBut(block, LABEL, 0, "are no edges, enable <Use Edges>",10,150,300,20, NULL, 0.0, 0, 0, 0, "");
- }
-
- uiBlockEndAlign(block);
- /*SOLVER SETTINGS*/
- uiDefButF(block, NUM, B_DIFF, "Error Lim:", 10,100,130,20, &sb->rklimit , 0.001, 10.0, 10, 0, "The Runge-Kutta ODE solver error limit, low value gives more precision, high values speed");
- uiDefButBitS(block, TOG, SBSO_OLDERR, B_DIFF,"O", 140,100,20,20, &sb->solverflags, 0, 0, 0, 0, "Old Error Calculation");
- uiDefButS(block, NUM, B_DIFF, "Fuzzy:", 160,100,130,20, &sb->fuzzyness, 1.00, 100.0, 10, 0, "Fuzzyness while on collision, high values make collsion handling faster but less stable");
- uiDefButBitS(block, TOG, SBSO_MONITOR, B_DIFF,"M", 290,100,20,20, &sb->solverflags, 0, 0, 0, 0, "Turn on SB diagnose console prints");
- uiDefButS(block, NUM, B_DIFF, "MinS:", 10,80,100,20, &sb->minloops, 0.00, 30000.0, 10, 0, "Minimal # solver steps/frame ");
- uiDefButS(block, NUM, B_DIFF, "MaxS:", 110,80,100,20, &sb->maxloops, 0.00, 30000.0, 10, 0, "Maximal # solver steps/frame ");
- uiDefButS(block, NUM, B_DIFF, "Choke:", 210,80,100,20, &sb->choke, 0.00, 100.0, 10, 0, "'Viscosity' inside collision target ");
- }
- /* OTHER OBJECTS COLLISION STUFF */
- if (ob->type==OB_MESH){
- uiDefButBitS(block, TOG, 1, B_REDR, "Deflection",10,50,150,20, &ob->pd->deflect, 0, 0, 0, 0, "Makes this object visible to other softbody objects");
- if(ob->pd->deflect) {
- uiDefButF(block, NUM, B_DIFF, "Damping:", 160,50,150,20, &ob->pd->pdef_sbdamp, 0.0, 1.0, 10, 0, "Amount of damping during soft body collision");
- uiDefButBitS(block, TOG,OB_SB_COLLFINAL , B_DIFF, "Ev.M.Stack",10,30,150,20, softflag, 0, 0, 0, 0, "Pick collision object from modifier stack");
- uiDefButF(block, NUM, B_DIFF, "Inner:", 160,30,150,20, &ob->pd->pdef_sbift, 0.001, 1.0, 10, 0, "Inner face thickness");
- uiDefButF(block, NUM, B_DIFF, "Outer:", 160,10,150,20, &ob->pd->pdef_sboft, 0.001, 1.0, 10, 0, "Outer face thickness");
- }
- }
- uiDefBut(block, LABEL, 0, "",10,10,1,2, NULL, 0.0, 0, 0, 0, ""); /* tell UI we go to 10,10*/
- }
- uiBlockEndAlign(block);
-}
-
-static void sb_clear_cache(void *ob_v, void *actsoft_v)
-{
- Object *ob = ob_v;
- short *actsoft = actsoft_v;
-
- if(actsoft >= 0)
- clear_particles_from_cache(ob, BLI_findlink(&ob->particlesystem, *actsoft), CFRA);
- else
- softbody_clear_cache(ob, CFRA);
-}
-static void object_softbodies(Object *ob)
-{
- SoftBody *sb=ob->soft;
- ParticleSystem *psys=NULL;
- uiBlock *block;
- uiBut *but;
- static int val;
- short *softflag=&ob->softflag, psys_cur=0;
- int ob_has_hair = psys_ob_has_hair(ob);
- static short actsoft= -1;
-
- if(!_can_softbodies_at_all(ob)) return;
- block= uiNewBlock(&curarea->uiblocks, "object_softbodies", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Soft Body", "Physics", 640, 0, 318, 204)==0) return;
- uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
-
- if(ob_has_hair) {
- char *menustr = psys_menu_string(ob,1);
-
- psys= psys_get_current(ob);
- if(psys && actsoft >= 0) {
- actsoft= psys_get_current_num(ob)+1;
-
- sb=psys->soft;
- softflag=&psys->softflag;
- psys_cur=1;
- }
- else
- actsoft= -1; /* -1 = object */
-
- but=uiDefButS(block, MENU, B_BAKE_REDRAWEDIT, menustr, 10,200,100,20, &actsoft, 14.0, 0.0, 0, 0, "Browse systems");
- uiButSetFunc(but, PE_change_act, ob, &actsoft);
-
- MEM_freeN(menustr);
- }
-
- if(psys_cur && psys){
- if(*softflag & OB_SB_ENABLE)
- val=1;
- else
- val=0;
-
- but = uiDefButI(block, TOG, REDRAWBUTSOBJECT, "Soft Body", 110,200,70,20, &val, 0, 0, 0, 0, "Sets hair to become soft body");
- uiButSetFunc(but, object_softbodies__enable_psys, ob, psys);
- }
- else{
- val = modifiers_isSoftbodyEnabled(ob);
- if(ob_has_hair)
- but = uiDefButI(block, TOG, REDRAWBUTSOBJECT, "Soft Body", 110,200,70,20, &val, 0, 0, 0, 0, "Sets object to become soft body");
- else
- but = uiDefButI(block, TOG, REDRAWBUTSOBJECT, "Soft Body", 10,200,130,20, &val, 0, 0, 0, 0, "Sets object to become soft body");
-
- uiButSetFunc(but, object_softbodies__enable, ob, NULL);
- }
-
- uiDefBut(block, LABEL, 0, "",10,10,300,0, NULL, 0.0, 0, 0, 0, ""); /* tell UI we go to 10,10*/
-
- if(val){
- int defCount;
- char *menustr;
- static char str[128];
-
- //uiDefButBitS(block, TOG, OB_SB_BAKESET, REDRAWBUTSOBJECT, "Bake settings", 180,200,130,20, &ob->softflag, 0, 0, 0, 0, "To convert simulation into baked (cached) result");
-
- //if(sb->keys) uiSetButLock(1, "Soft Body is baked, free it first");
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, OB_SB_PROTECT_CACHE, REDRAWBUTSOBJECT, "Protect", 180,200,50,20, softflag, 0.0, 0.0, 10, 0, "Protect the cache");
- but=uiDefBut(block, BUT, B_SOFTBODY_CHANGE, "Clear", 230,200,50,20, NULL, 0.0, 0.0, 10, 0, "Clear the cache");
- if((*softflag & PSYS_PROTECT_CACHE)==0)
- uiButSetFunc(but, sb_clear_cache, ob, &actsoft);
-
- uiBlockEndAlign(block);
-
- if(*softflag & OB_SB_PROTECT_CACHE) uiSetButLock(1, "Cache is protected");
-
- //if(ob->softflag & OB_SB_BAKESET) {
- // uiBlockBeginAlign(block);
- // uiDefButI(block, NUM, B_DIFF, "Start:", 10, 170,100,20, &sb->sfra, 1.0, 10000.0, 10, 0, "Start frame for baking");
- // uiDefButI(block, NUM, B_DIFF, "End:", 110, 170,100,20, &sb->efra, 1.0, 10000.0, 10, 0, "End frame for baking");
- // uiDefButI(block, NUM, B_DIFF, "Interval:", 210, 170,100,20, &sb->interval, 1.0, 10.0, 10, 0, "Interval in frames between baked keys");
- // uiBlockEndAlign(block);
-
- // uiDefButS(block, TOG, B_DIFF, "Local", 10, 145,100,20, &sb->local, 0.0, 0.0, 0, 0, "Use local coordinates for baking");
-
-
- // uiClearButLock();
- // uiBlockBeginAlign(block);
-
- // if(sb->keys) {
- // char str[128];
- // uiDefIconTextBut(block, BUT, B_SOFTBODY_BAKE_FREE, ICON_X, "FREE BAKE", 10, 120,300,20, NULL, 0.0, 0.0, 0, 0, "Free baked result");
- // sprintf(str, "Stored %d vertices %d keys %.3f MB", sb->totpoint, sb->totkey, ((float)16*sb->totpoint*sb->totkey)/(1024.0*1024.0));
- // uiDefBut(block, LABEL, 0, str, 10, 100,300,20, NULL, 0.0, 0.0, 00, 0, "");
- // }
- // else
- // uiDefBut(block, BUT, B_SOFTBODY_BAKE, "BAKE", 10, 120,300,20, NULL, 0.0, 0.0, 10, 0, "Start baking. Press ESC to exit without baking");
- //}
- //else {
- /* GENERAL STUFF */
- if (sb->totpoint){
- sprintf(str, "Vertex Mass; Object mass %f [k]",sb->nodemass*sb->totpoint/1000.0f);
- }
- else{
- sprintf(str, "Vertex Mass");
- }
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_DIFF, "Friction:", 10, 170,150,20, &sb->mediafrict, 0.0, 50.0, 10, 0, "General media friction for point movements");
- uiDefButF(block, NUM, B_DIFF, "Mass:", 160, 170,150,20, &sb->nodemass , 0.001, 50000.0, 10, 0, str);
- uiDefButF(block, NUM, B_DIFF, "Grav:", 10,150,150,20, &sb->grav , 0.0, 10.0, 10, 0, "Apply gravitation to point movement");
- uiDefButF(block, NUM, B_DIFF, "Speed:", 160,150,150,20, &sb->physics_speed , 0.01, 100.0, 10, 0, "Tweak timing for physics to control frequency and speed");
- uiBlockEndAlign(block);
-
- /* GOAL STUFF */
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, OB_SB_GOAL, B_SOFTBODY_CHANGE, "Use Goal", 10,120,130,20, softflag, 0, 0, 0, 0, "Define forces for vertices to stick to animated position");
- if (*softflag & OB_SB_GOAL){
- if(ob->type==OB_MESH) {
- menustr= get_vertexgroup_menustr(ob);
- defCount=BLI_countlist(&ob->defbase);
- if(defCount==0) sb->vertgroup= 0;
- uiDefButS(block, MENU, B_SOFTBODY_CHANGE, menustr, 140,120,20,20, &sb->vertgroup, 0, defCount, 0, 0, "Browses available vertex groups");
- MEM_freeN (menustr);
-
- if(sb->vertgroup) {
- bDeformGroup *defGroup = BLI_findlink(&ob->defbase, sb->vertgroup-1);
- if(defGroup)
- uiDefBut(block, BUT, B_DIFF, defGroup->name, 160,120,130,20, NULL, 0.0, 0.0, 0, 0, "Name of current vertex group");
- else
- uiDefBut(block, BUT, B_DIFF, "(no group)", 160,120,130,20, NULL, 0.0, 0.0, 0, 0, "Vertex Group doesn't exist anymore");
- uiDefIconBut(block, BUT, B_SOFTBODY_DEL_VG, ICON_X, 290,120,20,20, 0, 0, 0, 0, 0, "Disable use of vertex group");
- }
- else
- uiDefButF(block, NUM, B_SOFTBODY_CHANGE, "Goal:", 160,120,150,20, &sb->defgoal, 0.0, 1.0, 10, 0, "Default Goal (vertex target position) value, when no Vertex Group used");
- }
- else {
- uiDefButS(block, TOG, B_SOFTBODY_CHANGE, "W", 140,120,20,20, &sb->vertgroup, 0, 1, 0, 0, "Use control point weight values");
- uiDefButF(block, NUM, B_SOFTBODY_CHANGE, "Goal:", 160,120,150,20, &sb->defgoal, 0.0, 1.0, 10, 0, "Default Goal (vertex target position) value, when no Vertex Group used");
- }
-
- uiDefButF(block, NUM, B_DIFF, "G Stiff:", 10,100,150,20, &sb->goalspring, 0.0, 0.999, 10, 0, "Goal (vertex target position) spring stiffness");
- uiDefButF(block, NUM, B_DIFF, "G Damp:", 160,100,150,20, &sb->goalfrict , 0.0, 50.0, 10, 0, "Goal (vertex target position) friction");
- uiDefButF(block, NUM, B_SOFTBODY_CHANGE, "G Min:", 10,80,150,20, &sb->mingoal, 0.0, 1.0, 10, 0, "Goal minimum, vertex group weights are scaled to match this range");
- uiDefButF(block, NUM, B_SOFTBODY_CHANGE, "G Max:", 160,80,150,20, &sb->maxgoal, 0.0, 1.0, 10, 0, "Goal maximum, vertex group weights are scaled to match this range");
- }
- uiBlockEndAlign(block);
-
- /* EDGE SPRING STUFF */
- if(ob->type!=OB_SURF) {
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, OB_SB_EDGES, B_SOFTBODY_CHANGE, "Use Edges", 10,50,90,20, softflag, 0, 0, 0, 0, "Use Edges as springs");
- if (*softflag & OB_SB_EDGES){
- uiDefButBitS(block, TOG, OB_SB_QUADS, B_SOFTBODY_CHANGE, "Stiff Quads", 110,50,90,20, softflag, 0, 0, 0, 0, "Adds diagonal springs on 4-gons");
- uiDefButBitS(block, TOG, OB_SB_EDGECOLL, B_DIFF, "CEdge", 220,50,45,20, softflag, 0, 0, 0, 0, "Edge collide too");
- uiDefButBitS(block, TOG, OB_SB_FACECOLL, B_DIFF, "CFace", 265,50,45,20, softflag, 0, 0, 0, 0, "Faces collide too SLOOOOOW warning ");
- uiDefButF(block, NUM, B_DIFF, "E Stiff:", 10,30,150,20, &sb->inspring, 0.0, 0.999, 10, 0, "Edge spring stiffness");
- uiDefButF(block, NUM, B_DIFF, "E Damp:", 160,30,150,20, &sb->infrict, 0.0, 50.0, 10, 0, "Edge spring friction");
- uiDefButS(block, NUM, B_DIFF, "Aero:", 10,10,150,20, &sb->aeroedge, 0.00, 30000.0, 10, 0, "Make edges 'sail'");
- if(ob->type==OB_MESH) {
- uiDefButF(block, NUM, B_SOFTBODY_CHANGE, "Rigidity:", 160,10,150,20, &sb->secondspring, 0.0, 10.0, 10, 0, "Strenght of Springs over 2 Edges");
- }
- else sb->secondspring = 0;
- uiDefBut(block, LABEL, 0, "",10,10,1,0, NULL, 0.0, 0, 0, 0, ""); /* tell UI we go to 10,10*/
- }
- uiBlockEndAlign(block);
- }
- //}
- }
- uiBlockEndAlign(block);
-}
-
- /* Panels for new particles*/
-static void object_panel_particle_children(Object *ob)
-{
- uiBlock *block;
- ParticleSystem *psys = psys_get_current(ob);
- ParticleSettings *part;
- short butx=0, buty=160, butw=150, buth=20;
- static short kink_ui=0;
-
- if (psys==NULL) return;
- part=psys->part;
- if(part==NULL) return;
-
- block= uiNewBlock(&curarea->uiblocks, "object_panel_particle_child", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Children", "Particle", 1300, 0, 318, 204)==0) return;
- uiNewPanelTabbed("Extras", "Particle");
-
- uiDefButS(block, MENU, B_PART_ALLOC_CHILD, "Children from:%t|Faces%x2|Particles%x1|None%x0", butx,buty,butw,buth, &part->childtype, 14.0, 0.0, 0, 0, "Create child particles");
-
- if(part->childtype==0) return;
-
- if((psys->flag&(PSYS_HAIR_DONE|PSYS_KEYED))==0) {
- uiDefBut(block, LABEL, 0, "Hair or keyed", butx,(buty-=2*buth),butw,buth, NULL, 0.0, 0, 0, 0, "");
- uiDefBut(block, LABEL, 0, "particles needed!", butx,(buty-=2*buth),butw,buth, NULL, 0.0, 0, 0, 0, "");
- return;
- }
-
- uiBlockBeginAlign(block);
-
- buty -= buth/2;
-
- uiDefButI(block, NUM, B_PART_ALLOC_CHILD, "Amount:", butx,(buty-=buth),butw,buth, &part->child_nbr, 0.0, MAX_PART_CHILDREN, 0, 0, "Amount of children/parent");
- uiDefButI(block, NUM, B_DIFF, "Render Amount:", butx,(buty-=buth),butw,buth, &part->ren_child_nbr, 0.0, MAX_PART_CHILDREN, 0, 0, "Amount of children/parent for rendering");
- if(part->from!=PART_FROM_PARTICLE && part->childtype==PART_CHILD_FACES) {
- uiDefButF(block, NUMSLI, B_PART_DISTR_CHILD, "VParents:", butx,(buty-=buth),butw,buth, &part->parents, 0.0, 1.0, 1, 3, "Relative amount of virtual parents");
- }
- else {
- uiDefButF(block, NUM, B_PART_RECALC_CHILD, "Rad:", butx,(buty-=buth),butw,buth, &part->childrad, 0.0, 10.0, 1, 3, "Radius of children around parent");
- uiDefButF(block, NUMSLI, B_PART_RECALC_CHILD, "Round:", butx,(buty-=buth),butw,buth, &part->childflat, 0.0, 1.0, 1, 3, "Roundness of children around parent");
- }
- uiBlockEndAlign(block);
-
- buty -= buth/2;
-
- /* clump */
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_PART_RECALC_CHILD, "Clump:", butx,(buty-=buth),butw,buth, &part->clumpfac, -1.0, 1.0, 1, 3, "Amount of clumpimg");
- uiDefButF(block, NUMSLI, B_PART_RECALC_CHILD, "Shape:", butx,(buty-=buth),butw,buth, &part->clumppow, -0.999, 0.999, 1, 3, "Shape of clumpimg");
- uiBlockEndAlign(block);
-
- buty -= buth/2;
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_PART_REDRAW, "Size:", butx,(buty-=buth),butw/2,buth, &part->childsize, 0.01, 100, 10, 1, "A multiplier for the child particle size");
- uiDefButF(block, NUM, B_PART_REDRAW, "Rand:", butx+butw/2,buty,butw/2,buth, &part->childrandsize, 0.0, 1.0, 10, 1, "Random variation to the size of the child particles");
- if(part->childtype==PART_CHILD_FACES) {
- uiDefButF(block, NUM, B_PART_REDRAW, "Spread:",butx,(buty-=buth),butw/2,buth, &part->childspread, -1.0, 1.0, 10, 1, "Spread children from the faces");
- uiDefButBitI(block, TOG, PART_CHILD_SEAMS, B_PART_DISTR_CHILD, "Use Seams", butx+butw/2,buty,butw/2,buth, &part->flag, 0, 0, 0, 0, "Use seams to determine parents");
- }
- uiBlockEndAlign(block);
-
- butx=160;
- buty=180;
-
- uiDefButBitS(block, TOG, 1, B_PART_REDRAW, "Kink/Branch", butx,(buty-=buth),butw,buth, &kink_ui, 0, 0, 0, 0, "Show kink and branch options");
-
- if(kink_ui) {
- buty -= buth/2;
-
- /* kink */
- uiBlockBeginAlign(block);
- if(part->kink) {
- uiDefButS(block, MENU, B_PART_RECALC_CHILD, "Kink:%t|Roll%x6|Rotation%x5|Braid%x4|Wave%x3|Radial%x2|Curl%x1|Nothing%x0", butx,(buty-=buth),butw/2,buth, &part->kink, 14.0, 0.0, 0, 0, "Type of periodic offset on the path");
- uiDefButS(block, MENU, B_PART_RECALC_CHILD, "Axis %t|Z %x2|Y %x1|X %x0", butx+butw/2,buty,butw/2,buth, &part->kink_axis, 14.0, 0.0, 0, 0, "Which axis to use for offset");
- uiDefButF(block, NUM, B_PART_RECALC_CHILD, "Freq:", butx,(buty-=buth),butw,buth, &part->kink_freq, 0.0, 10.0, 1, 3, "The frequency of the offset (1/total length)");
- uiDefButF(block, NUMSLI, B_PART_RECALC_CHILD, "Shape:", butx,(buty-=buth),butw,buth, &part->kink_shape, -0.999, 0.999, 1, 3, "Adjust the offset to the beginning/end");
- uiDefButF(block, NUM, B_PART_RECALC_CHILD, "Amplitude:", butx,(buty-=buth),butw,buth, &part->kink_amp, 0.0, 10.0, 1, 3, "The amplitude of the offset");
- }
- else {
- uiDefButS(block, MENU, B_PART_RECALC_CHILD, "Kink:%t|Roll%x6|Rotation%x5|Braid%x4|Wave%x3|Radial%x2|Curl%x1|Nothing%x0", butx,(buty-=buth),butw,buth, &part->kink, 14.0, 0.0, 0, 0, "Type of periodic offset on the path");
- buty-=3*buth;
- }
- uiBlockEndAlign(block);
-
- if(part->childtype==PART_CHILD_PARTICLES) {
- if(part->flag & PART_BRANCHING) {
- uiDefButBitI(block, TOG, PART_BRANCHING, B_PART_RECALC_CHILD, "Branching", butx,(buty-=2*buth),butw,buth, &part->flag, 0, 0, 0, 0, "Branch child paths from eachother");
- uiDefButBitI(block, TOG, PART_ANIM_BRANCHING, B_PART_RECALC_CHILD, "Animated", butx,(buty-=buth),butw/2,buth, &part->flag, 0, 0, 0, 0, "Animate branching");
- uiDefButBitI(block, TOG, PART_SYMM_BRANCHING, B_PART_RECALC_CHILD, "Symmetric", butx+butw/2,buty,butw/2,buth, &part->flag, 0, 0, 0, 0, "Start and end points are the same");
- uiDefButF(block, NUM, B_PART_RECALC_CHILD, "Threshold:", butx,(buty-=buth),butw,buth, &part->branch_thres, 0.0, 1.0, 1, 3, "Threshold of branching");
- }
- else
- uiDefButBitI(block, TOG, PART_BRANCHING, B_PART_RECALC_CHILD, "Branching", butx,(buty-=2*buth),butw,buth, &part->flag, 0, 0, 0, 0, "Branch child paths from eachother");
- }
- }
- else {
- /* rough */
- buty -= buth/2;
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_PART_RECALC_CHILD, "Rough1:", butx,(buty-=buth),butw,buth, &part->rough1, 0.0, 10.0, 1, 3, "Amount of location dependant rough");
- uiDefButF(block, NUM, B_PART_RECALC_CHILD, "Size1:", butx,(buty-=buth),butw,buth, &part->rough1_size, 0.01, 10.0, 1, 3, "Size of location dependant rough");
- uiBlockEndAlign(block);
- buty -= buth/2;
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_PART_RECALC_CHILD, "Rough2:", butx,(buty-=buth),butw,buth, &part->rough2, 0.0, 10.0, 1, 3, "Amount of random rough");
- uiDefButF(block, NUM, B_PART_RECALC_CHILD, "Size2:", butx,(buty-=buth),butw,buth, &part->rough2_size, 0.01, 10.0, 1, 3, "Size of random rough");
- uiDefButF(block, NUMSLI, B_PART_RECALC_CHILD, "Thresh:", butx,(buty-=buth),butw,buth, &part->rough2_thres, 0.00, 1.0, 1, 3, "Amount of particles left untouched by random rough");
- uiBlockEndAlign(block);
- buty -= buth/2;
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_PART_RECALC_CHILD, "RoughE:", butx,(buty-=buth),butw,buth, &part->rough_end, 0.0, 10.0, 1, 3, "Amount of end point rough");
- uiDefButF(block, NUMSLI, B_PART_RECALC_CHILD, "Shape:", butx,(buty-=buth),butw,buth, &part->rough_end_shape, 0.0, 10.0, 1, 3, "Shape of end point rough");
- uiBlockEndAlign(block);
- }
-}
-static void particle_set_vg(void *ob_v, void *vgnum_v)
-{
- Object *ob= ob_v;
- ParticleSystem *psys=psys_get_current(ob);
- short vgnum = *((short *)vgnum_v);
-
- if(vgnum==PSYS_VG_DENSITY)
- psys->recalc|=PSYS_DISTR;
- else if(vgnum!=PSYS_VG_SIZE)
- psys->recalc|=PSYS_INIT;
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
-}
-static void particle_del_vg(void *ob_v, void *vgnum_v)
-{
- Object *ob= ob_v;
- ParticleSystem *psys=psys_get_current(ob);
- short vgnum = *((short *)vgnum_v);
-
- if(vgnum==PSYS_VG_DENSITY) {
- psys->recalc|=PSYS_DISTR;
- }
-
- psys->vgroup[vgnum]=0;
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
-}
-static void object_panel_particle_extra(Object *ob)
-{
- uiBlock *block;
- uiBut *but;
- ParticleSystem *psys=psys_get_current(ob);
- ParticleSettings *part;
- short butx=0, buty=160, butw=150, buth=20;
- static short vgnum=0;
- int event;
-
- if (psys==NULL) return;
- part=psys->part;
- if(part==NULL) return;
-
- block= uiNewBlock(&curarea->uiblocks, "object_panel_particle_extra", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Extras", "Particle", 980, 0, 318, 204)==0) return;
-
- uiDefBut(block, LABEL, 0, "Effectors:", butx,buty,butw,buth, NULL, 0.0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefIDPoinBut(block, test_grouppoin_but, ID_GR, B_PART_RECALC, "GR:", butx, (buty-=buth), butw/2, buth, &part->eff_group, "Limit effectors to this Group");
- uiDefButBitI(block, TOG, PART_SIZE_DEFL, B_PART_RECALC, "Size Deflect", butx+butw/2,buty,butw/2,buth, &part->flag, 0, 0, 0, 0, "Use particle's size in deflection");
- uiDefButBitI(block, TOG, PART_DIE_ON_COL, B_PART_RECALC, "Die on hit",butx,(buty-=buth),butw/2,buth, &part->flag, 0, 0, 0, 0, "Particles die when they collide with a deflector object");
- uiDefButBitI(block, TOG, PART_STICKY, B_PART_RECALC, "Sticky", butx+butw/2,buty,butw/2,buth, &part->flag, 0, 0, 0, 0, "Particles stick to collided objects if they die in the collision");
- uiBlockEndAlign(block);
-
- uiDefBut(block, LABEL, 0, "Time:", butx,(buty-=buth),butw/3,buth, NULL, 0.0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, PART_GLOB_TIME, B_PART_RECALC, "Global", butx,(buty-=buth),butw/2,buth, &part->flag, 0, 0, 0, 0, "Set all ipos that work on particles to be calculated in global/object time");
- uiDefButBitI(block, TOG, PART_ABS_TIME, B_PART_RECALC, "Absolute", butx+butw/2,buty,butw/2,buth, &part->flag, 0, 0, 0, 0, "Set all ipos that work on particles to be calculated in absolute/relative time");
-
- if(part->flag & PART_LOOP){
- uiDefButBitI(block, TOG, PART_LOOP, B_PART_RECALC, "Loop", butx,(buty-=buth),butw/2,buth, &part->flag, 0, 0, 0, 0, "Loop particle lives");
- uiDefButBitI(block, TOG, PART_LOOP_INSTANT, B_PART_RECALC, "Instantly", butx+butw/2,buty,butw/2,buth, &part->flag, 0, 0, 0, 0, "Loop particle life at time of death");
- }
- else
- uiDefButBitI(block, TOG, PART_LOOP, B_PART_RECALC, "Loop", butx,(buty-=buth),butw,buth, &part->flag, 0, 0, 0, 0, "Loop particle lives");
-
- uiDefButF(block, NUM, B_PART_RECALC, "Tweak:", butx,(buty-=buth),butw,buth, &part->timetweak, 0.0, 10.0, 1, 0, "A multiplier for physics timestep (1.0 means one frame = 1/25 seconds)");
- uiBlockEndAlign(block);
-
- if(ob->type==OB_MESH) {
- char *menustr= get_vertexgroup_menustr(ob);
- int defCount=BLI_countlist(&ob->defbase);
- if(defCount==0) psys->vgroup[vgnum]= 0;
-
- uiDefBut(block, LABEL, 0, "Vertex group:", butx,(buty-=2*buth),butw,buth, NULL, 0.0, 0, 0, 0, "");
-
- uiBlockBeginAlign(block);
-
- uiDefButS(block, MENU, B_PART_REDRAW, "Attribute%t|TanRot%x10|TanVel%x9|Size%x8|RoughE%x7|Rough2%x6|Rough1%x5|Kink%x4|Clump%x3|Length%x2|Velocity%x1|Density%x0", butx,(buty-=buth),butw-40,buth, &vgnum, 14.0, 0.0, 0, 0, "Attribute effected by vertex group");
- but=uiDefButBitS(block, TOG, (1<<vgnum), B_PART_REDRAW, "Neg", butx+butw-40,buty,40,buth, &psys->vg_neg, 0, 0, 0, 0, "Negate the effect of the vertex group");
- uiButSetFunc(but, particle_set_vg, (void *)ob, (void *)(&vgnum));
-
- butx+=butw;
-
- but= uiDefButS(block, MENU, B_PART_REDRAW, menustr, butx,buty,buth,buth, psys->vgroup+vgnum, 0, defCount, 0, 0, "Browses available vertex groups");
- uiButSetFunc(but, particle_set_vg, (void *)ob, (void *)(&vgnum));
- MEM_freeN (menustr);
-
- if(psys->vgroup[vgnum]) {
- bDeformGroup *defGroup = BLI_findlink(&ob->defbase, psys->vgroup[vgnum]-1);
- if(defGroup)
- uiDefBut(block, BUT, B_PART_REDRAW, defGroup->name, butx+buth,buty,butw-2*buth,buth, NULL, 0.0, 0.0, 0, 0, "Name of current vertex group");
- else{
- uiDefBut(block, BUT, B_PART_REDRAW, "(no group)", butx+buth,buty,butw-2*buth,buth, NULL, 0.0, 0.0, 0, 0, "Vertex Group doesn't exist anymore");
- }
- but=uiDefIconBut(block, BUT, B_PART_REDRAW, ICON_X, butx+butw-buth,buty,buth,buth, 0, 0, 0, 0, 0, "Disable use of vertex group");
- uiButSetFunc(but, particle_del_vg, (void *)ob, (void *)(&vgnum));
- }
-
- uiBlockEndAlign(block);
- }
-
- buty=butx=160;
-
- uiDefButI(block, NUM, B_PART_DISTR, "Seed:", butx,(buty-=buth),butw,buth, &psys->seed, 0.0, 255.0, 1, 0, "Set an offset in the random table");
-
- event=(part->flag&PART_SIZEMASS)?B_PART_RECALC:B_PART_REDRAW;
- uiDefButF(block, NUM, event, "Size:", butx,(buty-=2*buth),butw,buth, &part->size, 0.01, 100, 10, 1, "The size of the particles");
- uiDefButF(block, NUM, event, "Rand:", butx,(buty-=buth),butw,buth, &part->randsize, 0.0, 2.0, 10, 1, "Give the particle size a random variation");
-
- uiDefButBitI(block, TOG, PART_SIZEMASS, B_PART_RECALC, "Mass from size", butx,(buty-=buth),butw,buth, &part->flag, 0, 0, 0, 0, "Multiply mass with particle size");
- uiDefButF(block, NUM, B_PART_RECALC, "Mass:", butx,(buty-=buth),butw,buth, &part->mass, 0.01, 100, 10, 1, "Specify the mass of the particles");
-}
-/* copy from buttons_shading.c */
-static void autocomplete_uv(char *str, void *arg_v)
-{
- Mesh *me;
- CustomDataLayer *layer;
- AutoComplete *autocpl;
- int a;
-
- if(str[0]==0)
- return;
-
- autocpl= autocomplete_begin(str, 32);
-
- /* search if str matches the beginning of name */
- for(me= G.main->mesh.first; me; me=me->id.next)
- for(a=0, layer= me->fdata.layers; a<me->fdata.totlayer; a++, layer++)
- if(layer->type == CD_MTFACE)
- autocomplete_do_name(autocpl, layer->name);
-
- autocomplete_end(autocpl, str);
-}
-static void object_panel_particle_visual(Object *ob)
-{
- uiBlock *block;
- uiBut *but;
- ParticleSystem *psys=psys_get_current(ob);
- ParticleSettings *part;
- short butx=0, buty=160, butw=150, buth=20;
- static short bbuvnum=0;
-
- if (psys==NULL) return;
- part=psys->part;
- if(part==NULL) return;
-
- block= uiNewBlock(&curarea->uiblocks, "object_panel_particle_visual", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Visualization", "Particle", 640, 0, 318, 204)==0) return;
-
- uiDefButS(block, MENU, B_PART_RECALC, "Billboard %x9|Group %x8|Object %x7|Path %x6|Line %x5|Axis %x4|Cross %x3|Circle %x2|Point %x1|None %x0", butx,buty,butw,buth, &part->draw_as, 14.0, 0.0, 0, 0, "How particles are visualized");
-
- if(part->draw_as==PART_DRAW_NOT) {
- uiDefButBitS(block, TOG, PART_DRAW_EMITTER, B_PART_REDRAW, "Render emitter", butx,(buty-=2*buth),butw,buth, &part->draw, 0, 0, 0, 0, "Render emitter object");
- return;
- }
-
- uiDefBut(block, LABEL, 0, "Draw:", butx,(buty-=buth),butw,buth, NULL, 0.0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, PART_DRAW_VEL, B_PART_REDRAW, "Vel", butx,(buty-=buth),butw/3,buth, &part->draw, 0, 0, 0, 0, "Show particle velocity");
- uiDefButBitS(block, TOG, PART_DRAW_SIZE, B_PART_REDRAW, "Size", butx+butw/3,buty,butw/3,buth, &part->draw, 0, 0, 0, 0, "Show particle size");
- uiDefButBitS(block, TOG, PART_DRAW_NUM, B_PART_REDRAW, "Num", butx+2*butw/3,buty,butw/3,buth, &part->draw, 0, 0, 0, 0, "Show particle number");
- uiDefButS(block, NUM, B_PART_REDRAW, "Draw Size:", butx,(buty-=buth),butw,buth, &part->draw_size, 0.0, 10.0, 0, 0, "Size of particles on viewport in pixels (0=default)");
- uiDefButS(block, NUM, B_PART_RECALC, "Disp:", butx,(buty-=buth),butw,buth, &part->disp, 0.0, 100.0, 10, 0, "Percentage of particles to calculate for 3d view");
- uiBlockEndAlign(block);
-
- uiDefBut(block, LABEL, 0, "Render:", butx,(buty-=buth),butw,buth, NULL, 0.0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButS(block, NUM, B_PART_DISTR, "Material:", butx,(buty-=buth),butw-30,buth, &part->omat, 1.0, 16.0, 0, 0, "Specify material used for the particles");
- uiDefButBitS(block, TOG, PART_DRAW_MAT_COL, B_PART_RECALC, "Col", butx+butw-30,buty,30,buth, &part->draw, 0, 0, 0, 0, "Draw particles using material's diffuse color");
- uiDefButBitS(block, TOG, PART_DRAW_EMITTER, B_PART_REDRAW, "Emitter", butx,(buty-=buth),butw/2,buth, &part->draw, 0, 0, 0, 0, "Render emitter Object also");
- uiDefButBitS(block, TOG, PART_DRAW_PARENT, B_PART_REDRAW, "Parents", butx+butw/2,buty,butw/2,buth, &part->draw, 0, 0, 0, 0, "Render parent particles");
- uiDefButBitI(block, TOG, PART_UNBORN, B_PART_REDRAW, "Unborn", butx,(buty-=buth),butw/2,buth, &part->flag, 0, 0, 0, 0, "Show particles before they are emitted");
- uiDefButBitI(block, TOG, PART_DIED, B_PART_REDRAW, "Died", butx+butw/2,buty,butw/2,buth, &part->flag, 0, 0, 0, 0, "Show particles after they have died");
-
- uiBlockEndAlign(block);
-
- butx=160;
- buty=160-buth;
-
- uiBlockBeginAlign(block);
-
- switch(part->draw_as) {
- case PART_DRAW_OB:
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_PART_REDRAW, "OB:", butx,(buty-=buth),butw,buth, &part->dup_ob, "Show this Object in place of particles");
- break;
- case PART_DRAW_GR:
- uiDefIDPoinBut(block, test_grouppoin_but, ID_GR, B_PART_REDRAW, "GR:", butx,(buty-=buth),butw,buth, &part->dup_group, "Show Objects in this Group in place of particles");
- uiDefButBitS(block, TOG, PART_DRAW_WHOLE_GR, B_PART_REDRAW, "Dupli Group", butx,(buty-=buth),butw,buth, &part->draw, 0, 0, 0, 0, "Use whole group at once");
- if((part->draw & PART_DRAW_WHOLE_GR)==0)
- uiDefButBitS(block, TOG, PART_DRAW_RAND_GR, B_PART_REDRAW, "Pick Random", butx,(buty-=buth),butw,buth, &part->draw, 0, 0, 0, 0, "Pick objects from group randomly");
- break;
- case PART_DRAW_BB:
- uiDefButBitS(block, TOG, PART_DRAW_BB_LOCK, B_PART_REDRAW, "Lock", butx,(buty+=buth),butw/2,buth, &part->draw, 0, 0, 0, 0, "Lock the billboards align axis");
- uiDefButS(block, MENU, B_PART_REDRAW, "Align to%t|Velocity%x4|View%x3|Z%x2|Y%x1|X%x0", butx+butw/2,buty,butw/2,buth, &part->bb_align, 14.0, 0.0, 0, 0, "In respect to what the billboards are aligned");
- uiDefButF(block, NUM, B_PART_REDRAW, "Tilt:", butx,(buty-=buth),butw/2,buth, &part->bb_tilt, -1.0, 1.0, 0, 0, "Tilt of the billboards");
- uiDefButF(block, NUM, B_PART_REDRAW, "Rand:", butx+butw/2,buty,butw/2,buth, &part->bb_rand_tilt, 0.0, 1.0, 0, 0, "Random tilt of the billboards");
- uiDefButS(block, NUM, B_PART_REDRAW, "UV Split:", butx,(buty-=buth),butw,buth, &part->bb_uv_split, 1.0, 10.0, 0, 0, "Amount of rows/columns to split uv coordinates for billboards");
- uiDefButS(block, MENU, B_PART_REDRAW, "Animate%t|Angle%x2|Time%x1|None%x0", butx,(buty-=buth),butw/2,buth, &part->bb_anim, 14.0, 0.0, 0, 0, "How to animate billboard textures");
- uiDefButS(block, MENU, B_PART_REDRAW, "Offset%t|Random%x2|Linear%x1|None%x0", butx+butw/2,buty,butw/2,buth, &part->bb_split_offset, 14.0, 0.0, 0, 0, "How to offset billboard textures");
- uiDefButF(block, NUM, B_PART_REDRAW, "OffsetX:", butx,(buty-=buth),butw,buth, part->bb_offset, -1.0, 1.0, 0, 0, "Offset billboards horizontally");
- uiDefButF(block, NUM, B_PART_REDRAW, "OffsetY:", butx,(buty-=buth),butw,buth, part->bb_offset+1, -1.0, 1.0, 0, 0, "Offset billboards vertically");
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_PART_REDRAW, "OB:", butx,(buty-=buth),butw,buth, &part->bb_ob, "Billboards face this object (default is active camera)");
- uiDefButS(block, MENU, B_PART_REDRAW, "UV channel%t|Split%x2|Time-Index (X-Y)%x1|Normal%x0", butx,(buty-=buth),butw,buth, &bbuvnum, 14.0, 0.0, 0, 0, "UV channel");
- but=uiDefBut(block, TEX, B_PART_REDRAW, "UV:", butx,(buty-=buth),butw,buth, psys->bb_uvname+bbuvnum, 0, 31, 0, 0, "Set name of UV layer to use with billboards, default is active UV layer");
- uiButSetCompleteFunc(but, autocomplete_uv, NULL);
- break;
- case PART_DRAW_LINE:
- uiDefButBitS(block, TOG, PART_DRAW_VEL_LENGTH, B_PART_REDRAW, "Speed", butx,(buty-=buth),butw,buth, &part->draw, 0, 0, 0, 0, "Multiply line length by particle speed");
- uiDefButF(block, NUM, B_PART_REDRAW, "Back:", butx,(buty-=buth),butw,buth, &part->draw_line[0], 0.0, 10.0, 0, 0, "Length of the line's tail");
- uiDefButF(block, NUM, B_PART_REDRAW, "Front:", butx,(buty-=buth),butw,buth, &part->draw_line[1], 0.0, 10.0, 0, 0, "Length of the line's head");
- break;
- case PART_DRAW_PATH:
- if(psys->flag & (PSYS_HAIR_DONE|PSYS_KEYED)) {
- uiDefButS(block, NUM, B_PART_RECALC, "Steps:", butx,(buty+=buth),butw,buth, &part->draw_step, 0.0, 7.0, 0, 0, "How many steps paths are drawn with (power of 2)");
- uiDefButS(block, NUM, B_PART_REDRAW, "Render:", butx,(buty-=buth),butw,buth, &part->ren_step, 0.0, 9.0, 0, 0, "How many steps paths are rendered with (power of 2)");
-
- uiDefButBitI(block, TOG, PART_ABS_LENGTH, B_PART_RECALC, "Abs Length", butx,(buty-=buth),butw,buth, &part->flag, 0, 0, 0, 0, "Use maximum length in absolute blender units");
- uiDefButF(block, NUM, B_PART_RECALC, "Max Length:", butx,(buty-=buth),butw,buth, &part->abslength, 0.0, 10000.0, 1, 3, "Absolute path length");
- uiDefButF(block, NUMSLI, B_PART_RECALC, "RLength:", butx,(buty-=buth),butw,buth, &part->randlength, 0.0, 1.0, 1, 3, "Give path length a random variation");
- uiBlockEndAlign(block);
-
- uiDefButBitI(block, TOG, PART_HAIR_BSPLINE, B_PART_RECALC, "B-Spline", butx,(buty-=buth),butw,buth, &part->flag, 0, 0, 0, 0, "Interpolate hair using B-Splines");
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, PART_DRAW_REN_STRAND, B_PART_REDRAW, "Strand render", butx,buty-=buth,butw,buth, &part->draw, 0, 0, 0, 0, "Use the strand primitive for rendering");
- if(part->draw & PART_DRAW_REN_STRAND) {
- uiDefButS(block, NUM, B_PART_REDRAW, "Angle:", butx,(buty-=buth),butw,buth, &part->adapt_angle, 0.0, 45.0, 0, 0, "How many degrees path has to curve to make another render segment");
- }
- else {
- uiDefButBitS(block, TOG, PART_DRAW_REN_ADAPT, B_PART_REDRAW, "Adaptive render", butx,buty-=buth,butw,buth, &part->draw, 0, 0, 0, 0, "Draw steps of the particle path");
- if(part->draw & PART_DRAW_REN_ADAPT) {
- uiDefButS(block, NUM, B_PART_REDRAW, "Angle:", butx,(buty-=buth),butw/2,buth, &part->adapt_angle, 0.0, 45.0, 0, 0, "How many degrees path has to curve to make another render segment");
- uiDefButS(block, NUM, B_PART_REDRAW, "Pixel:", butx+butw/2,buty,(butw+1)/2,buth, &part->adapt_pix, 0.0, 50.0, 0, 0, "How many pixels path has to cover to make another render segment");
- }
- }
- }
- else {
- uiDefBut(block, LABEL, 0, "Baked or keyed", butx,(buty-=2*buth),butw,buth, NULL, 0.0, 0, 0, 0, "");
- uiDefBut(block, LABEL, 0, "particles needed!", butx,(buty-=2*buth),butw,buth, NULL, 0.0, 0, 0, 0, "");
- }
- break;
- }
- uiBlockEndAlign(block);
-}
-static void object_panel_particle_simplification(Object *ob)
-{
- uiBlock *block;
- ParticleSystem *psys=psys_get_current(ob);
- ParticleSettings *part;
- short butx=0, buty=160, butw=150, buth=20;
-
- if (psys==NULL) return;
- part=psys->part;
- if(part==NULL) return;
-
- if(part->draw_as!=PART_DRAW_PATH || !(part->draw & PART_DRAW_REN_STRAND))
- return;
- if(part->childtype!=PART_CHILD_FACES)
- return;
-
- block= uiNewBlock(&curarea->uiblocks, "object_panel_particle_simplification", UI_EMBOSS, UI_HELV, curarea->win);
- uiNewPanelTabbed("Visualization", "Particle");
- if(uiNewPanel(curarea, block, "Simplification", "Particle", 640, 0, 318, 204)==0) return;
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, PART_SIMPLIFY_ENABLE, B_PART_REDRAW, "Child Simplification", butx,buty-=buth,butw,buth, &part->simplify_flag, 0, 0, 0, 0, "Remove child strands as the object becomes smaller on the screen");
- uiBlockEndAlign(block);
- if(part->simplify_flag & PART_SIMPLIFY_ENABLE) {
- buty -= 10;
-
- uiBlockBeginAlign(block);
- uiDefButS(block, NUM, B_NOP, "Reference Size:", butx,(buty-=buth),butw,buth, &part->simplify_refsize, 1.0, 32768.0, 0, 0, "Reference size size in pixels, after which simplification begins");
- uiDefButF(block, NUM, B_NOP, "Rate:", butx,(buty-=buth),butw,buth, &part->simplify_rate, 0.0, 1.0, 0, 0, "Speed of simplification");
- uiDefButF(block, NUM, B_NOP, "Transition:", butx,(buty-=buth),butw,buth, &part->simplify_transition, 0.0, 1.0, 0, 0, "Transition period for fading out strands");
- uiBlockEndAlign(block);
-
- buty -= 10;
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, PART_SIMPLIFY_VIEWPORT, B_PART_REDRAW, "Viewport", butx,buty-=buth,butw,buth, &part->simplify_flag, 0, 0, 0, 0, "Remove child strands as the object goes outside the viewport");
- uiDefButF(block, NUM, B_NOP, "Rate:", butx,(buty-=buth),butw,buth, &part->simplify_viewport, 0.0, 0.999, 0, 0, "Speed of simplification");
- uiBlockEndAlign(block);
- }
- uiBlockEndAlign(block);
-}
-static void boidrule_moveDown(void *part_v, void *rule_v)
-{
- ParticleSettings *part = part_v;
- char r, *rule = rule_v;
-
- int n= rule - part->boidrule;
-
- if(n+1 < BOID_TOT_RULES) {
- r=part->boidrule[n];
- part->boidrule[n]=part->boidrule[n+1];
- part->boidrule[n+1]=r;
- }
-}
-static void boidrule_moveUp(void *part_v, void *rule_v)
-{
- ParticleSettings *part = part_v;
- char r, *rule = rule_v;
-
- int n= rule - part->boidrule;
-
- if(n-1 >= 0) {
- r=part->boidrule[n];
- part->boidrule[n]=part->boidrule[n-1];
- part->boidrule[n-1]=r;
- }
-}
-static void object_panel_particle_physics(Object *ob)
-{
- uiBlock *block;
- uiBut *but;
- ParticleSystem *psys=psys_get_current(ob);
- ParticleSettings *part;
- short butx=0, buty=160, butw=150, buth=20;
-
- if (psys==NULL) return;
-
- part=psys->part;
-
- if(part==NULL) return;
-
- block= uiNewBlock(&curarea->uiblocks, "object_panel_particle_physics", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Physics", "Particle", 320, 0, 318, 204)==0) return;
-
- if(ob->id.lib) uiSetButLock(1, "Can't edit library data");
-
- if(psys->flag & PSYS_EDITED || psys->flag & PSYS_PROTECT_CACHE) {
- uiSetButLock(1, "Hair is edited or cache is protected!");
- }
-
- if(part->phystype==PART_PHYS_KEYED){
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, PSYS_FIRST_KEYED, B_PART_RECALC, "First", butx,buty,45,buth, &psys->flag, 0, 0, 0, 0, "Sets the system to be the starting point of keyed particles");
- uiDefButS(block, MENU, B_PART_RECALC, "Physics %t|Boids%x3|Keyed %x2|Newtonian %x1|None %x0", butx+45,buty,butw-45,buth, &part->phystype, 14.0, 0.0, 0, 0, "Select particle physics type");
- uiBlockEndAlign(block);
- }
- else
- uiDefButS(block, MENU, B_PART_RECALC, "Physics%t|Boids%x3|Keyed%x2|Newtonian%x1|None%x0", butx,buty,butw,buth, &part->phystype, 14.0, 0.0, 0, 0, "Select particle physics type");
-
- if(part->phystype==PART_PHYS_BOIDS) {
- int i;
- char *rules[BOID_TOT_RULES] = {"Collision", "Avoid", "Crowd", "Center", "AvVel", "Velocity", "Goal", "Level"};
- char *ruletext[BOID_TOT_RULES] = {
- "Avoid deflector objects",
- "Avoid predators",
- "Avoid other boids",
- "Get to flock center",
- "Maintain average velocity",
- "Match velocity of nearby boids",
- "Seek goal",
- "Keep the Z level"
- };
- /* left column */
- uiDefBut(block, LABEL, 0, "Behaviour:", butx,(buty-=buth),butw,buth, NULL, 0.0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- for(i=0; i<BOID_TOT_RULES; i++) {
- uiBlockSetCol(block, TH_BUT_ACTION);
-
- but = uiDefIconBut(block, BUT, B_PART_RECALC, VICON_MOVE_UP, butx, (buty-=buth), 20, 20, NULL, 0.0, 0.0, 0.0, 0.0, "Move rule up");
- uiButSetFunc(but, boidrule_moveUp, part, part->boidrule+i);
-
- but = uiDefIconBut(block, BUT, B_PART_RECALC, VICON_MOVE_DOWN, butx+20, buty, 20, 20, NULL, 0.0, 0.0, 0.0, 0.0, "Move rule down");
- uiButSetFunc(but, boidrule_moveDown, part, part->boidrule+i);
-
- uiBlockSetCol(block, TH_BUT_SETTING2);
-
- uiDefButF(block, NUM, B_PART_RECALC, rules[part->boidrule[i]], butx+40,buty,butw-40,buth, part->boidfac+part->boidrule[i], -1.0, 2.0, 1, 3, ruletext[part->boidrule[i]]);
- }
- uiBlockSetCol(block, TH_AUTO);
- uiBlockEndAlign(block);
-
- buty=140;
- butx=160;
-
- uiDefBut(block, LABEL, 0, "Physics:", butx,buty,butw,buth, NULL, 0.0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, PART_BOIDS_2D, B_PART_RECALC, "2D", butx,(buty-=buth),butw,buth, &part->flag, 0, 0, 0, 0, "Constrain boids to a surface");
- uiDefButF(block, NUM, B_PART_RECALC, "MaxVelocity:", butx,(buty-=buth),butw,buth, &part->max_vel, 0.0, 200.0, 1, 3, "Maximum velocity");
- uiDefButF(block, NUM, B_PART_RECALC, "AvVelocity:", butx,(buty-=buth),butw,buth, &part->average_vel, 0.0, 1.0, 1, 3, "The usual speed % of max velocity");
- uiDefButF(block, NUM, B_PART_RECALC, "LatAcc:", butx,(buty-=buth),butw,buth, &part->max_lat_acc, 0.0, 1.0, 1, 3, "Lateral acceleration % of max velocity");
- uiDefButF(block, NUM, B_PART_RECALC, "TanAcc:", butx,(buty-=buth),butw,buth, &part->max_tan_acc, 0.0, 1.0, 1, 3, "Tangential acceleration % of max velocity");
- if(part->flag & PART_BOIDS_2D) {
- uiDefButF(block, NUM, B_PART_RECALC, "GroundZ:", butx,(buty-=buth),butw,buth, &part->groundz, -100.0, 100.0, 1, 3, "Default Z value");
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_PARTTARGET, "OB:", butx,(buty-=buth),butw,buth, &psys->keyed_ob, "Constrain boids to object's surface");
- }
- else {
- uiDefButF(block, NUM, B_PART_RECALC, "Banking:", butx,(buty-=buth),butw,buth, &part->banking, -10.0, 10.0, 1, 3, "Banking of boids on turns (1.0==natural banking)");
- uiDefButF(block, NUM, B_PART_RECALC, "MaxBank:", butx,(buty-=buth),butw,buth, &part->max_bank, 0.0, 1.0, 1, 3, "How much a boid can bank at a single step");
- }
- uiBlockEndAlign(block);
- uiDefButS(block, NUM, B_PART_RECALC, "N:", butx,(buty-=buth),butw,buth, &part->boidneighbours, 1.0, 10.0, 1, 3, "How many neighbours to consider for each boid");
- }
- else {
- /* left column */
- uiDefBut(block, LABEL, 0, "Initial velocity:", butx,(buty-=buth),butw,buth, NULL, 0.0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiBlockSetCol(block, TH_BUT_SETTING2);
- uiDefButF(block, NUM, B_PART_RECALC, "Object:", butx,(buty-=buth*4/5),butw,buth*4/5, &part->obfac, -1.0, 1.0, 1, 3, "Let the object give the particle a starting speed");
- uiDefButF(block, NUM, B_PART_RECALC, "Normal:", butx,(buty-=buth*4/5),butw,buth*4/5, &part->normfac, -200.0, 200.0, 1, 3, "Let the surface normal give the particle a starting speed");
- uiDefButF(block, NUM, B_PART_RECALC, "Random:", butx,(buty-=buth*4/5),butw,buth*4/5, &part->randfac, 0.0, 200.0, 1, 3, "Give the starting speed a random variation");
- if(part->type==PART_REACTOR) {
- uiDefButF(block, NUM, B_PART_RECALC, "Particle:", butx,(buty-=buth*4/5),butw,buth*4/5, &part->partfac, -10.0, 10.0, 1, 3, "Let the target particle give the particle a starting speed");
- uiDefButF(block, NUM, B_PART_RECALC, "Reactor:", butx,(buty-=buth*4/5),butw,buth*4/5, &part->reactfac, -10.0, 10.0, 1, 3, "Let the vector from target particle give the particle a starting speed");
- }
- else {
- uiDefButF(block, NUM, B_PART_RECALC, "Tan:", butx,(buty-=buth*4/5),butw,buth*4/5, &part->tanfac, -200.0, 200.0, 1, 3, "Let the surface tangent give the particle a starting speed");
- uiDefButF(block, NUM, B_PART_RECALC, "Rot:", butx,(buty-=buth*4/5),butw,buth*4/5, &part->tanphase, -1.0, 1.0, 1, 3, "Rotate the surface tangent");
- }
- uiBlockSetCol(block, TH_AUTO);
- uiBlockEndAlign(block);
-
- buty=160;
- butx=160;
-
- if(part->phystype==PART_PHYS_NEWTON)
- uiDefButS(block, MENU, B_PART_RECALC, "Integration%t|RK4%x2|Midpoint%x1|Euler%x0", butx,buty,butw,buth, &part->integrator, 14.0, 0.0, 0, 0, "Select physics integrator type");
-
- uiDefBut(block, LABEL, 0, "Rotation:", butx, (buty-=buth),butw,buth, NULL, 0.0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, PART_ROT_DYN, B_PART_RECALC, "Dynamic", butx,(buty-=buth*4/5),butw/2,buth*4/5, &part->flag, 0, 0, 0, 0, "Sets rotation to dynamic/constant");
- uiDefButS(block, MENU, B_PART_RECALC, "Rotation %t|Random %x3|Velocity %x2|Normal %x1|None %x0", butx+butw/2,buty,butw/2,buth*4/5, &part->rotmode, 14.0, 0.0, 0, 0, "Select particle rotation mode");
- uiBlockSetCol(block, TH_BUT_SETTING2);
- uiDefButF(block, NUM, B_PART_RECALC, "Amount:", butx,(buty-=buth*4/5),butw,buth*4/5, &part->rotfac, -1.0, 1.0, 1, 3, "Rotation amount");
- uiDefButF(block, NUM, B_PART_RECALC, "Phase:", butx,(buty-=buth*4/5),butw,buth*4/5, &part->phasefac, -1.0, 1.0, 1, 3, "Initial rotation phase");
- uiBlockSetCol(block, TH_AUTO);
-
- uiDefButS(block, MENU, B_PART_RECALC, "Angular v %t|Velocity%x3|Random%x2|Spin%x1|None%x0", butx,(buty-=buth*4/5),butw,buth*4/5, &part->avemode, 14.0, 0.0, 0, 0, "Select particle angular velocity mode");
- uiBlockSetCol(block, TH_BUT_SETTING2);
- uiDefButF(block, NUM, B_PART_RECALC, "Angular v:", butx,(buty-=buth*4/5),butw,buth*4/5, &part->avefac, -200.0, 200.0, 1, 3, "Angular velocity amount");
- uiBlockSetCol(block, TH_AUTO);
- uiBlockEndAlign(block);
-
- if(part->phystype==PART_PHYS_NEWTON) {
- butx=0;
- buty=40;
- uiDefBut(block, LABEL, 0, "Global effects:", butx,buty,butw,buth, NULL, 0.0, 0, 0, 0, "");
-
- butw=103;
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_PART_RECALC, "AccX:", butx,(buty-=buth),butw,buth, part->acc, -200.0, 200.0, 10, 0, "Specify a constant acceleration along the X-axis");
- uiDefButF(block, NUM, B_PART_RECALC, "AccY:", butx+butw,buty,butw,buth, part->acc+1,-200.0, 200.0, 10, 0, "Specify a constant acceleration along the Y-axis");
- uiDefButF(block, NUM, B_PART_RECALC, "AccZ:", butx+2*butw,buty,butw+1,buth, part->acc+2, -200.0, 200.0, 10, 0, "Specify a constant acceleration along the Z-axis");
-
- uiDefButF(block, NUM, B_PART_RECALC, "Drag:", butx,(buty-=buth),butw,buth, &part->dragfac, 0.0, 1.0, 1, 0, "Specify the amount of air-drag");
- uiDefButF(block, NUM, B_PART_RECALC, "Brown:", butx+butw,buty,butw,buth, &part->brownfac, 0.0, 200.0, 1, 0, "Specify the amount of brownian motion");
- uiDefButF(block, NUM, B_PART_RECALC, "Damp:", butx+2*butw,buty,butw+1,buth, &part->dampfac, 0.0, 1.0, 1, 0, "Specify the amount of damping");
- uiBlockEndAlign(block);
- }
- else if(part->phystype==PART_PHYS_KEYED) {
- short totkpsys=1;
- butx=0;
- buty=40;
- uiDefBut(block, LABEL, 0, "Keyed Target:", butx,buty,butw,buth, NULL, 0.0, 0, 0, 0, "");
- if(psys->keyed_ob){
- if(psys->keyed_ob==ob || BLI_findlink(&psys->keyed_ob->particlesystem,psys->keyed_psys-1)==0)
- uiBlockSetCol(block, TH_REDALERT);
- else
- totkpsys = BLI_countlist(&psys->keyed_ob->particlesystem);
- }
- else
- uiBlockSetCol(block, TH_REDALERT);
-
- uiBlockBeginAlign(block);
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_PARTTARGET, "OB:", butx,(buty-=buth),butw*2/3,buth, &psys->keyed_ob, "The object that has the target particle system");
- uiDefButS(block, NUM, B_PARTTARGET, "Psys:", butx+butw*2/3,buty,butw/3,buth, &psys->keyed_psys, 1.0, totkpsys, 0, 0, "The target particle system number in the object");
- uiBlockEndAlign(block);
-
- uiBlockSetCol(block, TH_AUTO);
-
- butx=160;
-
- if(psys->flag & PSYS_FIRST_KEYED)
- uiDefButBitI(block, TOG, PSYS_KEYED_TIME, B_PART_RECALC, "Timed", butx,buty,butw,buth, &psys->flag, 0, 0, 0, 0, "Use intermediate key times");
- else
- uiDefButF(block, NUMSLI, B_PART_RECALC, "Time:", butx,buty,butw,buth, &part->keyed_time, 0.0, 1.0, 1, 3, "Keyed key time relative to remaining particle life");
- }
- }
-}
-
-static void psys_clear_cache(void *ob_v, void *psys_v)
-{
- clear_particles_from_cache((Object *)ob_v, (ParticleSystem *)psys_v, CFRA);
-}
-static void object_panel_particle_system(Object *ob)
-{
- uiBlock *block;
- uiBut *but;
- ParticleSystem *psys=NULL;
- ParticleSettings *part;
- ID *id, *idfrom;
- short butx=0, buty=160, butw=150, buth=20;
- char str[30];
- static short partact;
- short totpart;
-
- block= uiNewBlock(&curarea->uiblocks, "object_panel_particle_system", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Particle System", "Particle", 0, 0, 318, 204)==0) return;
-
- if(ob->id.lib) uiSetButLock(1, "Can't edit library data");
-
- if(ELEM4(ob->type,OB_MESH,OB_FONT,OB_CURVE,OB_SURF)==0) {
- uiDefBut(block, LABEL, 0, "Only Mesh or Curve Objects can generate particles", 10,180,300,20, NULL, 0.0, 0, 0, 0, "");
- return;
- }
- psys=psys_get_current(ob);
-
- if(psys)
- id=(ID*)(psys->part);
- else
- id=NULL;
- idfrom=&ob->id;
-
- /* browse buttons */
- uiBlockSetCol(block, TH_BUT_SETTING2);
- butx= std_libbuttons(block, butx, buty, 0, NULL, B_PARTBROWSE, ID_PA, 0, id, idfrom, &(G.buts->menunr), B_PARTALONE, 0, B_PARTDELETE, 0, 0);
-
- partact=psys_get_current_num(ob)+1;
- totpart=BLI_countlist(&ob->particlesystem);
- sprintf(str, "%d Part", totpart);
- but=uiDefButS(block, NUM, B_PARTACT, str, 224,buty,88,buth, &partact, 1.0, totpart+1, 0, 0, "Shows the number of particle systems in the object and the active particle system");
- uiButSetFunc(but, PE_change_act, ob, &partact);
-
- if(psys==NULL)
- return;
-
- part=psys->part;
-
- if(part==NULL) return;
-
- butx=0;
- buty-=5;
-
- uiDefButBitI(block, TOG, PSYS_ENABLED, B_PART_ENABLE, "Enabled", 0,(buty-=buth),100,buth, &psys->flag, 0, 0, 0, 0, "Sets particle system to be calculated and shown");
-
- if(part->type == PART_HAIR){
- if(psys->flag & PSYS_EDITED)
- uiDefBut(block, BUT, B_PART_EDITABLE, "Free Edit", 105,buty,100,buth, NULL, 0.0, 0.0, 10, 0, "Free editing");
- else
- uiDefBut(block, BUT, B_PART_EDITABLE, "Set Editable", 105,buty,100,buth, NULL, 0.0, 0.0, 10, 0, "Finalize hair to enable editing in particle mode");
-
- }
- else {
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, PSYS_PROTECT_CACHE, B_PART_REDRAW, "Protect", 105,buty,50,buth, &psys->flag, 0.0, 0.0, 10, 0, "Protect the cache");
- but=uiDefBut(block, BUT, B_PART_RECALC, "Clear", 155,buty,50,buth, NULL, 0.0, 0.0, 10, 0, "Clear the cache");
- if((psys->flag & PSYS_PROTECT_CACHE)==0)
- uiButSetFunc(but, psys_clear_cache, ob, &partact);
-
- uiBlockEndAlign(block);
- }
-
- if(psys->flag & PSYS_EDITED || psys->flag & PSYS_PROTECT_CACHE) {
- uiSetButLock(1, "Hair is edited or cache is protected!");
- }
-
- uiDefButS(block, MENU, B_PARTTYPE, "Type%t|Hair%x2|Reactor%x1|Emitter%x0", 210,buty,100,buth, &part->type, 14.0, 0.0, 0, 0, "Type of particle system");
-
- buty-=5;
- uiDefBut(block, LABEL, 0, "Basic:", butx,(buty-=buth),butw,buth, NULL, 0.0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
-
- if(part->distr==PART_DISTR_GRID)
- uiDefButI(block, NUM, B_PART_ALLOC, "Resol:", butx,(buty-=buth),butw,buth, &part->grid_res, 1.0, 100.0, 0, 0, "The resolution of the particle grid");
- else
- uiDefButI(block, NUM, B_PART_ALLOC, "Amount:", butx,(buty-=buth),butw,buth, &part->totpart, 0.0, 100000.0, 0, 0, "The total number of particles");
- if(part->type==PART_REACTOR) {
- uiDefButBitI(block, TOG, PART_REACT_STA_END, B_PART_INIT, "Sta/End", butx,(buty-=buth),butw/2,buth, &part->flag, 0, 0, 0, 0, "Give birth to unreacted particles eventually");
- uiDefButS(block, MENU, B_PART_RECALC, "React on %t|Near %x2|Collision %x1|Death %x0", butx+butw/2,buty,butw/2,buth, &part->reactevent, 14.0, 0.0, 0, 0, "The event of target particles to react");
- if(part->flag&PART_REACT_STA_END) {
- uiDefButF(block, NUM, B_PART_INIT, "Sta:", butx,(buty-=buth),butw,buth, &part->sta, 1.0, part->end, 100, 1, "Frame # to start emitting particles");
- uiDefButF(block, NUM, B_PART_INIT, "End:", butx,(buty-=buth),butw,buth, &part->end, part->sta, MAXFRAMEF, 100, 1, "Frame # to stop emitting particles");
- }
- if(part->from!=PART_FROM_PARTICLE) {
- uiDefButBitI(block, TOG, PART_REACT_MULTIPLE, B_PART_RECALC, "Multi React", butx,(buty-=buth),butw,buth, &part->flag, 0, 0, 0, 0, "React multiple times");
- uiDefButF(block, NUM, B_PART_RECALC, "Shape:", butx,(buty-=buth),butw,buth, &part->reactshape, 0.0, 10.0, 100, 1, "Power of reaction strength dependence on distance to target");
- }
- }
- else if(part->type==PART_HAIR) {
- uiDefButS(block, NUM, B_PART_RECALC, "Segments:", butx,(buty-=buth),butw,buth, &part->hair_step, 2.0, 50.0, 0, 0, "Amount of hair segments");
- }
- else {
- uiDefButF(block, NUM, B_PART_INIT, "Sta:", butx,(buty-=buth),butw,buth, &part->sta, 1.0, part->end, 100, 1, "Frame # to start emitting particles");
- uiDefButF(block, NUM, B_PART_INIT, "End:", butx,(buty-=buth),butw,buth, &part->end, part->sta, MAXFRAMEF, 100, 1, "Frame # to stop emitting particles");
- }
-
- if(part->type!=PART_HAIR) {
- uiDefButF(block, NUM, B_PART_INIT, "Life:", butx,(buty-=buth),butw,buth, &part->lifetime, 1.0, MAXFRAMEF, 100, 1, "Specify the life span of the particles");
- uiDefButF(block, NUM, B_PART_INIT, "Rand:", butx,(buty-=buth),butw,buth, &part->randlife, 0.0, 2.0, 10, 1, "Give the particle life a random variation");
- }
-
- uiBlockEndAlign(block);
-
- butx=160;
- buty=120;
-
- buty-=10;
-
- uiDefBut(block, LABEL, 0, "Emit From:", butx,buty,butw,buth, NULL, 0.0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, PART_TRAND, B_PART_DISTR, "Random", butx,(buty-=buth),butw/2,buth, &part->flag, 0, 0, 0, 0, "Emit in random order of elements");
-
- if(part->type==PART_REACTOR)
- uiDefButS(block, MENU, B_PART_DISTR, "Particle %x3|Volume %x2|Faces %x1|Verts %x0", butx+butw/2,buty,butw/2,buth, &part->from, 14.0, 0.0, 0, 0, "Where to emit particles from");
- else
- uiDefButS(block, MENU, B_PART_DISTR, "Volume %x2|Faces %x1|Verts%x0", butx+butw/2,buty,butw/2,buth, &part->from, 14.0, 0.0, 0, 0, "Where to emit particles from");
-
- if(ELEM(part->from,PART_FROM_FACE,PART_FROM_VOLUME)) {
- uiDefButBitI(block, TOG, PART_EDISTR, B_PART_DISTR, "Even",butx,(buty-=buth),butw/2,buth, &part->flag, 0, 0, 0, 0, "Use even distribution from faces based on face areas or edge lengths");
- uiDefButS(block, MENU, B_PART_DISTR, "Distribution %t|Grid%x2|Random%x1|Jittered%x0", butx+butw/2,buty,butw/2,buth, &part->distr, 14.0, 0.0, 0, 0, "How to distribute particles on selected element");
- if(part->distr==PART_DISTR_JIT) {
- uiDefButF(block, NUM, B_PART_DISTR, "Amount:", butx,(buty-=buth),butw,buth, &part->jitfac, 0, 2.0, 1, 1, "Amount of jitter applied to the sampling");
- uiDefButI(block, NUM, B_PART_DISTR, "P/F:", butx,(buty-=buth),butw,buth, &part->userjit, 0, 1000.0, 1, 1, "Emission locations / face (0 = automatic)");
- }
- if(part->distr==PART_DISTR_GRID){
- uiDefButBitI(block, TOG, PART_GRID_INVERT, B_PART_DISTR, "Invert",butx,(buty-=buth),butw,buth, &part->flag, 0, 0, 0, 0, "Invert what is considered object and what is not.");
- }
- }
- uiBlockEndAlign(block);
-
- buty=50;
-
- if(part->type==PART_REACTOR) {
- ParticleSystem *tpsys=0;
- Object *tob=0;
- int tottpsys;
-
- uiDefBut(block, LABEL, 0, "Target:", butx,(buty-=buth),butw,buth, NULL, 0.0, 0, 0, 0, "");
-
- if(psys->target_ob)
- tob=psys->target_ob;
- else
- tob=ob;
-
- tottpsys=BLI_countlist(&tob->particlesystem);
-
- uiBlockBeginAlign(block);
-
- if(tob->particlesystem.first==0)
- uiBlockSetCol(block, TH_REDALERT);
-
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_PARTTARGET, "OB:", butx,(buty-=buth),butw*2/3,buth, &psys->target_ob, "The object that has the target particle system (empty if same object)");
-
- tpsys=BLI_findlink(&tob->particlesystem,psys->target_psys-1);
- if(tpsys) {
- if(tob==ob && tpsys==psys)
- uiBlockSetCol(block, TH_REDALERT);
- }
- else
- uiBlockSetCol(block, TH_REDALERT);
-
- uiDefButS(block, NUM, B_PARTTARGET, "Psys:", butx+butw*2/3,buty,butw/3,buth, &psys->target_psys, 1.0, tottpsys, 0, 0, "The target particle system number in the object");
- uiBlockEndAlign(block);
-
- uiBlockSetCol(block, TH_AUTO);
- }
-}
-
-/* NT - Panel for fluidsim settings */
-static void object_panel_fluidsim(Object *ob)
-{
-#ifndef DISABLE_ELBEEM
- uiBlock *block;
- int yline = 160;
- const int lineHeight = 20;
- const int separateHeight = 3;
- const int objHeight = 20;
- char *msg = NULL;
-
- block= uiNewBlock(&curarea->uiblocks, "object_fluidsim", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Fluid Simulation", "Physics", 1060, 0, 318, 204)==0) return;
-
- uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
-
- if(ob->type==OB_MESH) {
- if(((Mesh *)ob->data)->totvert == 0) {
- msg = "Mesh has no vertices.";
- goto errMessage;
- }
- uiDefButBitS(block, TOG, OB_FLUIDSIM_ENABLE, REDRAWBUTSOBJECT, "Enable", 0,yline, 75,objHeight,
- &ob->fluidsimFlag, 0, 0, 0, 0, "Sets object to participate in fluid simulation");
-
- if(ob->fluidsimFlag & OB_FLUIDSIM_ENABLE) {
- FluidsimSettings *fss= ob->fluidsimSettings;
-
- if(fss==NULL) {
- fss = ob->fluidsimSettings = fluidsimSettingsNew(ob);
- }
-
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW, REDRAWBUTSOBJECT ,"Domain", 90, yline, 70,objHeight, &fss->type, 15.0, OB_FLUIDSIM_DOMAIN, 20.0, 1.0, "Bounding box of this object represents the computational domain of the fluid simulation.");
- uiDefButS(block, ROW, REDRAWBUTSOBJECT ,"Fluid", 160, yline, 70,objHeight, &fss->type, 15.0, OB_FLUIDSIM_FLUID, 20.0, 2.0, "Object represents a volume of fluid in the simulation.");
- uiDefButS(block, ROW, REDRAWBUTSOBJECT ,"Obstacle", 230, yline, 70,objHeight, &fss->type, 15.0, OB_FLUIDSIM_OBSTACLE,20.0, 3.0, "Object is a fixed obstacle.");
- yline -= lineHeight;
-
- uiDefButS(block, ROW, REDRAWBUTSOBJECT ,"Inflow", 90, yline, 70,objHeight, &fss->type, 15.0, OB_FLUIDSIM_INFLOW, 20.0, 4.0, "Object adds fluid to the simulation.");
- uiDefButS(block, ROW, REDRAWBUTSOBJECT ,"Outflow", 160, yline, 70,objHeight, &fss->type, 15.0, OB_FLUIDSIM_OUTFLOW, 20.0, 5.0, "Object removes fluid from the simulation.");
- uiDefButS(block, ROW, B_FLUIDSIM_MAKEPART ,"Particle", 230, yline, 70,objHeight, &fss->type, 15.0, OB_FLUIDSIM_PARTICLE,20.0, 3.0, "Object is made a particle system to display particles generated by a fluidsim domain object.");
- uiBlockEndAlign(block);
- yline -= lineHeight;
- yline -= 2*separateHeight;
-
- /* display specific settings for each type */
- if(fss->type == OB_FLUIDSIM_DOMAIN) {
- const int maxRes = 512;
- char memString[32];
-
- // use mesh bounding box and object scaling
- // TODO fix redraw issue
- elbeemEstimateMemreq(fss->resolutionxyz,
- ob->fluidsimSettings->bbSize[0],ob->fluidsimSettings->bbSize[1],ob->fluidsimSettings->bbSize[2], fss->maxRefine, memString);
-
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW, REDRAWBUTSOBJECT, "Std", 0,yline, 25,objHeight, &fss->show_advancedoptions, 16.0, 0, 20.0, 0, "Show standard domain options.");
- uiDefButS(block, ROW, REDRAWBUTSOBJECT, "Adv", 25,yline, 25,objHeight, &fss->show_advancedoptions, 16.0, 1, 20.0, 1, "Show advanced domain options.");
- uiDefButS(block, ROW, REDRAWBUTSOBJECT, "Bnd", 50,yline, 25,objHeight, &fss->show_advancedoptions, 16.0, 2, 20.0, 2, "Show domain boundary options.");
- uiBlockEndAlign(block);
-
- uiDefBut(block, BUT, B_FLUIDSIM_BAKE, "BAKE",90, yline,210,objHeight, NULL, 0.0, 0.0, 10, 0, "Perform simulation and output and surface&preview meshes for each frame.");
- yline -= lineHeight;
- yline -= 2*separateHeight;
-
- if(fss->show_advancedoptions == 0) {
- uiDefBut(block, LABEL, 0, "Req. BAKE Memory:", 0,yline,150,objHeight, NULL, 0.0, 0, 0, 0, "");
- uiDefBut(block, LABEL, 0, memString, 200,yline,100,objHeight, NULL, 0.0, 0, 0, 0, "");
- yline -= lineHeight;
-
- uiBlockBeginAlign(block);
- uiDefButS(block, NUM, REDRAWBUTSOBJECT, "Resolution:", 0, yline,150,objHeight, &fss->resolutionxyz, 1, maxRes, 10, 0, "Domain resolution in X, Y and Z direction");
- uiDefButS(block, NUM, B_DIFF, "Preview-Res.:", 150, yline,150,objHeight, &fss->previewresxyz, 1, 100, 10, 0, "Resolution of the preview meshes to generate, also in X, Y and Z direction");
- uiBlockEndAlign(block);
- yline -= lineHeight;
- yline -= 1*separateHeight;
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_DIFF, "Start time:", 0, yline,150,objHeight, &fss->animStart, 0.0, 100.0, 10, 0, "Simulation time of the first blender frame.");
- uiDefButF(block, NUM, B_DIFF, "End time:", 150, yline,150,objHeight, &fss->animEnd , 0.0, 100.0, 10, 0, "Simulation time of the last blender frame.");
- uiBlockEndAlign(block);
- yline -= lineHeight;
- yline -= 2*separateHeight;
-
- if((fss->guiDisplayMode<1) || (fss->guiDisplayMode>3)){ fss->guiDisplayMode=2; } // can be changed by particle setting
- uiDefBut(block, LABEL, 0, "Disp.-Qual.:", 0,yline, 90,objHeight, NULL, 0.0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButS(block, MENU, B_FLUIDSIM_FORCEREDRAW, "GuiDisplayMode%t|Geometry %x1|Preview %x2|Final %x3",
- 90,yline,105,objHeight, &fss->guiDisplayMode, 0, 0, 0, 0, "How to display the fluid mesh in the Blender GUI.");
- uiDefButS(block, MENU, B_DIFF, "RenderDisplayMode%t|Geometry %x1|Preview %x2|Final %x3",
- 195,yline,105,objHeight, &fss->renderDisplayMode, 0, 0, 0, 0, "How to display the fluid mesh for rendering.");
- uiBlockEndAlign(block);
- yline -= lineHeight;
- yline -= 1*separateHeight;
-
- uiBlockBeginAlign(block);
- uiDefIconBut(block, BUT, B_FLUIDSIM_SELDIR, ICON_FILESEL, 0, yline, 20, objHeight, 0, 0, 0, 0, 0, "Select Directory (and/or filename prefix) to store baked fluid simulation files in");
- uiDefBut(block, TEX, B_FLUIDSIM_FORCEREDRAW,"", 20, yline, 280, objHeight, fss->surfdataPath, 0.0,79.0, 0, 0, "Enter Directory (and/or filename prefix) to store baked fluid simulation files in");
- uiBlockEndAlign(block);
- // FIXME what is the 79.0 above?
- } else if(fss->show_advancedoptions == 1) {
- // advanced options
- uiDefBut(block, LABEL, 0, "Gravity:", 0, yline, 90,objHeight, NULL, 0.0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_DIFF, "X:", 90, yline, 70,objHeight, &fss->gravx, -1000.1, 1000.1, 10, 0, "Gravity in X direction");
- uiDefButF(block, NUM, B_DIFF, "Y:", 160, yline, 70,objHeight, &fss->gravy, -1000.1, 1000.1, 10, 0, "Gravity in Y direction");
- uiDefButF(block, NUM, B_DIFF, "Z:", 230, yline, 70,objHeight, &fss->gravz, -1000.1, 1000.1, 10, 0, "Gravity in Z direction");
- uiBlockEndAlign(block);
- yline -= lineHeight;
- yline -= 1*separateHeight;
-
- /* viscosity */
- if (fss->viscosityMode==1) /*manual*/
- uiBlockBeginAlign(block);
- uiDefButS(block, MENU, REDRAWVIEW3D, "Viscosity%t|Manual %x1|Water %x2|Oil %x3|Honey %x4",
- 0,yline, 90,objHeight, &fss->viscosityMode, 0, 0, 0, 0, "Set viscosity of the fluid to a preset value, or use manual input.");
- if(fss->viscosityMode==1) {
- uiDefButF(block, NUM, B_DIFF, "Value:", 90, yline, 105,objHeight, &fss->viscosityValue, 0.0, 10.0, 10, 0, "Viscosity setting: value that is multiplied by 10 to the power of (exponent*-1).");
- uiDefButS(block, NUM, B_DIFF, "Neg-Exp.:", 195, yline, 105,objHeight, &fss->viscosityExponent, 0, 10, 10, 0, "Negative exponent for the viscosity value (to simplify entering small values e.g. 5*10^-6.");
- uiBlockEndAlign(block);
- } else {
- // display preset values
- uiDefBut(block, LABEL, 0, fluidsimViscosityPresetString[fss->viscosityMode], 90,yline,200,objHeight, NULL, 0.0, 0, 0, 0, "");
- }
- yline -= lineHeight;
- yline -= 1*separateHeight;
-
- uiDefBut(block, LABEL, 0, "Realworld-size:", 0,yline,150,objHeight, NULL, 0.0, 0, 0, 0, "");
- uiDefButF(block, NUM, B_DIFF, "", 150, yline,150,objHeight, &fss->realsize, 0.001, 10.0, 10, 0, "Size of the simulation domain in meters.");
- yline -= lineHeight;
- yline -= 2*separateHeight;
-
- uiDefBut(block, LABEL, 0, "Gridlevels:", 0,yline,150,objHeight, NULL, 0.0, 0, 0, 0, "");
- uiDefButI(block, NUM, B_DIFF, "", 150, yline,150,objHeight, &fss->maxRefine, -1, 4, 10, 0, "Number of coarsened Grids to use (set to -1 for automatic selection).");
- yline -= lineHeight;
-
- uiDefBut(block, LABEL, 0, "Compressibility:", 0,yline,150,objHeight, NULL, 0.0, 0, 0, 0, "");
- uiDefButF(block, NUM, B_DIFF, "", 150, yline,150,objHeight, &fss->gstar, 0.001, 0.10, 10,0, "Allowed compressibility due to gravitational force for standing fluid (directly affects simulation step size).");
- yline -= lineHeight;
-
- } else if(fss->show_advancedoptions == 2) {
- // copied from obstacle...
- //yline -= lineHeight + 5;
- //uiDefBut(block, LABEL, 0, "Domain boundary type settings:", 0,yline,300,objHeight, NULL, 0.0, 0, 0, 0, "");
- //yline -= lineHeight;
-
- uiBlockBeginAlign(block); // domain
- uiDefButS(block, ROW, REDRAWBUTSOBJECT ,"Noslip", 0, yline,100,objHeight, &fss->typeFlags, 15.0, OB_FSBND_NOSLIP, 20.0, 1.0, "Obstacle causes zero normal and tangential velocity (=sticky). Default for all. Only option for moving objects.");
- uiDefButS(block, ROW, REDRAWBUTSOBJECT ,"Part", 100, yline,100,objHeight, &fss->typeFlags, 15.0, OB_FSBND_PARTSLIP, 20.0, 2.0, "Mix between no-slip and free-slip. Non moving objects only!");
- uiDefButS(block, ROW, REDRAWBUTSOBJECT ,"Free", 200, yline,100,objHeight, &fss->typeFlags, 15.0, OB_FSBND_FREESLIP, 20.0, 3.0, "Obstacle only causes zero normal velocity (=not sticky). Non moving objects only!");
- uiBlockEndAlign(block);
- yline -= lineHeight;
-
- if(fss->typeFlags&OB_FSBND_PARTSLIP) {
- uiDefBut(block, LABEL, 0, "PartSlipValue:", 0,yline,200,objHeight, NULL, 0.0, 0, 0, 0, "");
- uiDefButF(block, NUM, B_DIFF, "", 200, yline,100,objHeight, &fss->partSlipValue, 0.0, 1.0, 10,0, ".");
- yline -= lineHeight;
- } else {
- //uiDefBut(block, LABEL, 0, "-", 200,yline,100,objHeight, NULL, 0.0, 0, 0, 0, "");
- }
- // copied from obstacle...
-
- uiDefBut(block, LABEL, 0, "Tracer Particles:", 0,yline,200,objHeight, NULL, 0.0, 0, 0, 0, "");
- uiDefButI(block, NUM, B_DIFF, "", 200, yline,100,objHeight, &fss->generateTracers, 0.0, 10000.0, 10,0, "Number of tracer particles to generate.");
- yline -= lineHeight;
- uiDefBut(block, LABEL, 0, "Generate Particles:", 0,yline,200,objHeight, NULL, 0.0, 0, 0, 0, "");
- uiDefButF(block, NUM, B_DIFF, "", 200, yline,100,objHeight, &fss->generateParticles, 0.0, 10.0, 10,0, "Amount of particles to generate (0=off, 1=normal, >1=more).");
- yline -= lineHeight;
- uiDefBut(block, LABEL, 0, "Surface Subdiv:", 0,yline,200,objHeight, NULL, 0.0, 0, 0, 0, "");
- uiDefButI(block, NUM, B_DIFF, "", 200, yline,100,objHeight, &fss->surfaceSubdivs, 0.0, 5.0, 10,0, "Number of isosurface subdivisions. This is necessary for the inclusion of particles into the surface generation. Warning - can lead to longer computation times!");
- yline -= lineHeight;
-
- uiDefBut(block, LABEL, 0, "Surface Smoothing:", 0,yline,200,objHeight, NULL, 0.0, 0, 0, 0, "");
- uiDefButF(block, NUM, B_DIFF, "", 200, yline,100,objHeight, &fss->surfaceSmoothing, 0.0, 5.0, 10,0, "Amount of surface smoothing (0=off, 1=normal, >1=stronger smoothing).");
- yline -= lineHeight;
-
- // use new variable...
- uiDefBut(block, LABEL, 0, "Generate&Use SpeedVecs:", 0,yline,200,objHeight, NULL, 0.0, 0, 0, 0, "");
- uiDefButBitC(block, TOG, 1, REDRAWBUTSOBJECT, "Disable", 200, yline,100,objHeight, &fss->domainNovecgen, 0, 0, 0, 0, "Default is to generate and use fluidsim vertex speed vectors, this option switches calculation off during bake, and disables loading.");
- yline -= lineHeight;
- } // domain 3
- }
- else if(
- (fss->type == OB_FLUIDSIM_FLUID)
- || (fss->type == OB_FLUIDSIM_INFLOW)
- ) {
- uiBlockBeginAlign(block); // fluid
- uiDefButC(block, ROW, REDRAWBUTSOBJECT ,"Init Volume", 0, yline,100,objHeight, &fss->volumeInitType, 15.0, 1, 20.0, 1.0, "Type of volume init: use only inner region of mesh.");
- uiDefButC(block, ROW, REDRAWBUTSOBJECT ,"Init Shell", 100, yline,100,objHeight, &fss->volumeInitType, 15.0, 2, 20.0, 2.0, "Type of volume init: use only the hollow shell defined by the faces of the mesh.");
- uiDefButC(block, ROW, REDRAWBUTSOBJECT ,"Init Both", 200, yline,100,objHeight, &fss->volumeInitType, 15.0, 3, 20.0, 3.0, "Type of volume init: use both the inner volume and the outer shell.");
- uiBlockEndAlign(block);
- yline -= lineHeight;
-
- yline -= lineHeight + 5; // fluid + inflow
- if(fss->type == OB_FLUIDSIM_FLUID) uiDefBut(block, LABEL, 0, "Initial velocity:", 0,yline,200,objHeight, NULL, 0.0, 0, 0, 0, "");
- if(fss->type == OB_FLUIDSIM_INFLOW) uiDefBut(block, LABEL, 0, "Inflow velocity:", 0,yline,200,objHeight, NULL, 0.0, 0, 0, 0, "");
- yline -= lineHeight;
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_DIFF, "X:", 0, yline, 100,objHeight, &fss->iniVelx, -1000.1, 1000.1, 10, 0, "Fluid velocity in X direction");
- uiDefButF(block, NUM, B_DIFF, "Y:", 100, yline, 100,objHeight, &fss->iniVely, -1000.1, 1000.1, 10, 0, "Fluid velocity in Y direction");
- uiDefButF(block, NUM, B_DIFF, "Z:", 200, yline, 100,objHeight, &fss->iniVelz, -1000.1, 1000.1, 10, 0, "Fluid velocity in Z direction");
- uiBlockEndAlign(block);
- yline -= lineHeight;
-
- if(fss->type == OB_FLUIDSIM_INFLOW) { // inflow
- uiDefBut(block, LABEL, 0, "Local Inflow Coords", 0,yline,200,objHeight, NULL, 0.0, 0, 0, 0, "");
- uiDefButBitS(block, TOG, OB_FSINFLOW_LOCALCOORD, REDRAWBUTSOBJECT, "Enable", 200, yline,100,objHeight, &fss->typeFlags, 0, 0, 0, 0, "Use local coordinates for inflow (e.g. for rotating objects).");
- yline -= lineHeight;
- } else {
- }
-
- // domainNovecgen "misused" here
- uiDefBut(block, LABEL, 0, "Animated Mesh:", 0,yline,200,objHeight, NULL, 0.0, 0, 0, 0, "");
- uiDefButBitC(block, TOG, 1, REDRAWBUTSOBJECT, "Export", 200, yline,100,objHeight, &fss->domainNovecgen, 0, 0, 0, 0, "Export this mesh as an animated one. Slower, only use if really necessary (e.g. armatures or parented objects), animated pos/rot/scale IPOs do not require it.");
- yline -= lineHeight;
-
- } // fluid inflow
- else if( (fss->type == OB_FLUIDSIM_OUTFLOW) ) {
- yline -= lineHeight + 5;
-
- uiBlockBeginAlign(block); // outflow
- uiDefButC(block, ROW, REDRAWBUTSOBJECT ,"Init Volume", 0, yline,100,objHeight, &fss->volumeInitType, 15.0, 1, 20.0, 1.0, "Type of volume init: use only inner region of mesh.");
- uiDefButC(block, ROW, REDRAWBUTSOBJECT ,"Init Shell", 100, yline,100,objHeight, &fss->volumeInitType, 15.0, 2, 20.0, 2.0, "Type of volume init: use only the hollow shell defined by the faces of the mesh.");
- uiDefButC(block, ROW, REDRAWBUTSOBJECT ,"Init Both", 200, yline,100,objHeight, &fss->volumeInitType, 15.0, 3, 20.0, 3.0, "Type of volume init: use both the inner volume and the outer shell.");
- uiBlockEndAlign(block);
- yline -= lineHeight;
-
- // domainNovecgen "misused" here
- uiDefBut(block, LABEL, 0, "Animated Mesh:", 0,yline,200,objHeight, NULL, 0.0, 0, 0, 0, "");
- uiDefButBitC(block, TOG, 1, REDRAWBUTSOBJECT, "Export", 200, yline,100,objHeight, &fss->domainNovecgen, 0, 0, 0, 0, "Export this mesh as an animated one. Slower, only use if really necessary (e.g. armatures or parented objects), animated pos/rot/scale IPOs do not require it.");
- yline -= lineHeight;
-
- //uiDefBut(block, LABEL, 0, "No additional settings as of now...", 0,yline,300,objHeight, NULL, 0.0, 0, 0, 0, "");
- }
- else if( (fss->type == OB_FLUIDSIM_OBSTACLE) ) {
- yline -= lineHeight + 5; // obstacle
-
- uiBlockBeginAlign(block); // obstacle
- uiDefButC(block, ROW, REDRAWBUTSOBJECT ,"Init Volume", 0, yline,100,objHeight, &fss->volumeInitType, 15.0, 1, 20.0, 1.0, "Type of volume init: use only inner region of mesh.");
- uiDefButC(block, ROW, REDRAWBUTSOBJECT ,"Init Shell", 100, yline,100,objHeight, &fss->volumeInitType, 15.0, 2, 20.0, 2.0, "Type of volume init: use only the hollow shell defined by the faces of the mesh.");
- uiDefButC(block, ROW, REDRAWBUTSOBJECT ,"Init Both", 200, yline,100,objHeight, &fss->volumeInitType, 15.0, 3, 20.0, 3.0, "Type of volume init: use both the inner volume and the outer shell.");
- uiBlockEndAlign(block);
- yline -= lineHeight;
-
- uiBlockBeginAlign(block); // obstacle
- uiDefButS(block, ROW, REDRAWBUTSOBJECT ,"Noslip", 0, yline,100,objHeight, &fss->typeFlags, 15.0, OB_FSBND_NOSLIP, 20.0, 1.0, "Obstacle causes zero normal and tangential velocity (=sticky). Default for all. Only option for moving objects.");
- uiDefButS(block, ROW, REDRAWBUTSOBJECT ,"Part", 100, yline,100,objHeight, &fss->typeFlags, 15.0, OB_FSBND_PARTSLIP, 20.0, 2.0, "Mix between no-slip and free-slip. Non moving objects only!");
- uiDefButS(block, ROW, REDRAWBUTSOBJECT ,"Free", 200, yline,100,objHeight, &fss->typeFlags, 15.0, OB_FSBND_FREESLIP, 20.0, 3.0, "Obstacle only causes zero normal velocity (=not sticky). Non moving objects only!");
- uiBlockEndAlign(block);
- yline -= lineHeight;
-
- // domainNovecgen "misused" here
- uiDefBut(block, LABEL, 0, "Animated Mesh:", 0,yline,200,objHeight, NULL, 0.0, 0, 0, 0, "");
- uiDefButBitC(block, TOG, 1, REDRAWBUTSOBJECT, "Export", 200, yline,100,objHeight, &fss->domainNovecgen, 0, 0, 0, 0, "Export this mesh as an animated one. Slower, only use if really necessary (e.g. armatures or parented objects), animated loc/rot/scale IPOs do not require it.");
- yline -= lineHeight;
-
- uiDefBut(block, LABEL, 0, "PartSlip Amount:", 0,yline,200,objHeight, NULL, 0.0, 0, 0, 0, "");
- if(fss->typeFlags&OB_FSBND_PARTSLIP) {
- uiDefButF(block, NUM, B_DIFF, "", 200, yline,100,objHeight, &fss->partSlipValue, 0.0, 1.0, 10,0, "Amount of mixing between no- and free-slip, 0=stickier, 1=same as free slip.");
- } else { uiDefBut(block, LABEL, 0, "-", 200,yline,100,objHeight, NULL, 0.0, 0, 0, 0, ""); }
- yline -= lineHeight;
-
- // generateParticles "misused" here
- uiDefBut(block, LABEL, 0, "Impact Factor:", 0,yline,200,objHeight, NULL, 0.0, 0, 0, 0, "");
- uiDefButF(block, NUM, B_DIFF, "", 200, yline,100,objHeight, &fss->surfaceSmoothing, -2.0, 10.0, 10,0, "This is an unphysical value for moving objects - it controls the impact an obstacle has on the fluid, =0 behaves a bit like outflow (deleting fluid), =1 is default, while >1 results in high forces. Can be used to tweak total mass.");
- yline -= lineHeight;
-
- yline -= lineHeight; // obstacle
- }
- else if(fss->type == OB_FLUIDSIM_PARTICLE) {
-
- //fss->type == 0; // off, broken...
- if(1) {
- // limited selection, old fixed: fss->typeFlags = (1<<5)|(1<<1);
-# define PARTBUT_WIDTH (300/3)
- uiDefButBitS(block, TOG, (1<<2) , REDRAWBUTSOBJECT, "Drops", 0*PARTBUT_WIDTH, yline, PARTBUT_WIDTH,objHeight, &fss->typeFlags, 0, 0, 0, 0, "Show drop particles.");
- uiDefButBitS(block, TOG, (1<<4) , REDRAWBUTSOBJECT, "Floats", 1*PARTBUT_WIDTH, yline, PARTBUT_WIDTH,objHeight, &fss->typeFlags, 0, 0, 0, 0, "Show floating foam particles.");
- uiDefButBitS(block, TOG, (1<<5) , REDRAWBUTSOBJECT, "Tracer", 2*PARTBUT_WIDTH, yline, PARTBUT_WIDTH,objHeight, &fss->typeFlags, 0, 0, 0, 0, "Show tracer particles.");
- yline -= lineHeight;
-# undef PARTBUT_WIDTH
-
-
- uiDefBut(block, LABEL, 0, "Size Influence:", 0,yline,150,objHeight, NULL, 0.0, 0, 0, 0, "");
- uiDefButF(block, NUM, B_DIFF, "", 150, yline,150,objHeight, &fss->particleInfSize, 0.0, 2.0, 10,0, "Amount of particle size scaling: 0=off (all same size), 1=full (range 0.2-2.0), >1=stronger.");
- yline -= lineHeight;
- uiDefBut(block, LABEL, 0, "Alpha Influence:", 0,yline,150,objHeight, NULL, 0.0, 0, 0, 0, "");
- uiDefButF(block, NUM, B_DIFF, "", 150, yline,150,objHeight, &fss->particleInfAlpha, 0.0, 2.0, 10,0, "Amount of particle alpha change, inverse of size influence: 0=off (all same alpha), 1=full (large particles get lower alphas, smaller ones higher values).");
- yline -= lineHeight;
-
- yline -= 1*separateHeight;
-
- // FSPARTICLE also select input files
- uiBlockBeginAlign(block);
- uiDefIconBut(block, BUT, B_FLUIDSIM_SELDIR, ICON_FILESEL, 0, yline, 20, objHeight, 0, 0, 0, 0, 0, "Select fluid simulation bake directory/prefix to load particles from, same as for domain object.");
- uiDefBut(block, TEX, B_FLUIDSIM_FORCEREDRAW,"", 20, yline, 280, objHeight, fss->surfdataPath, 0.0,79.0, 0, 0, "Enter fluid simulation bake directory/prefix to load particles from, same as for domain object.");
- uiBlockEndAlign(block);
- yline -= lineHeight;
- } // disabled for now...
-
- }
- else {
- yline -= lineHeight + 5;
- /* not yet set */
- uiDefBut(block, LABEL, 0, "Select object type for simulation", 0,yline,300,objHeight, NULL, 0.0, 0, 0, 0, "");
- yline -= lineHeight;
- }
- return;
-
- } else {
- msg = "Object not enabled for fluid simulation...";
- }
- } else {
- msg = "Only Mesh Objects can participate.";
- }
-errMessage:
- yline -= lineHeight + 5;
- uiDefBut(block, LABEL, 0, msg, 0,yline,300,objHeight, NULL, 0.0, 0, 0, 0, "");
- yline -= lineHeight;
-
-#endif // DISABLE_ELBEEM
-}
-
-void object_panels()
-{
- Object *ob;
-
- /* check context here */
- ob= OBACT;
- if(ob) {
- object_panel_object(ob);
- object_panel_anim(ob);
- object_panel_draw(ob);
- object_panel_constraint("Object");
-
- uiClearButLock();
- }
-}
-
-void physics_panels()
-{
- Object *ob;
-
- /* check context here */
- ob= OBACT;
- if(ob) {
- if(ob->type==OB_MESH)
- object_panel_deflection(ob);
- object_panel_fields(ob);
- object_softbodies(ob);
- object_softbodies_II(ob);
- object_panel_fluidsim(ob);
- }
-}
-void particle_panels()
-{
- Object *ob;
- ParticleSystem *psys;
-
- ob=OBACT;
-
- if(ob && ob->type==OB_MESH) {
- object_panel_particle_system(ob);
-
- psys=psys_get_current(ob);
-
- if(psys){
- object_panel_particle_physics(ob);
- object_panel_particle_visual(ob);
- object_panel_particle_simplification(ob);
- object_panel_particle_extra(ob);
- object_panel_particle_children(ob);
- }
- }
-}
diff --git a/source/blender/src/buttons_scene.c b/source/blender/src/buttons_scene.c
deleted file mode 100644
index 8fd74ddc08e..00000000000
--- a/source/blender/src/buttons_scene.c
+++ /dev/null
@@ -1,2082 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <time.h>
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "MEM_guardedalloc.h"
-#include "DNA_node_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_sound_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_packedFile_types.h"
-
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_node.h"
-#include "BKE_library.h"
-#include "BKE_scene.h"
-#include "BKE_sound.h"
-#include "BKE_packedFile.h"
-#include "BKE_utildefines.h"
-
-#include "BLI_blenlib.h"
-
-#include "BSE_filesel.h"
-
-#include "BIF_gl.h"
-#include "BIF_graphics.h"
-#include "BIF_glutil.h"
-#include "BIF_interface.h"
-#include "BIF_imasel.h"
-#include "BIF_keyval.h"
-#include "BIF_mainqueue.h"
-#include "BIF_mywindow.h"
-#include "BIF_meshtools.h"
-#include "BIF_resources.h"
-#include "BIF_renderwin.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-
-#include "BIF_butspace.h"
-
-#include "mydevice.h"
-#include "blendef.h"
-
-/* -----includes for this file specific----- */
-
-#include "DNA_image_types.h"
-
-#include "BKE_writeavi.h"
-#include "BKE_writeffmpeg.h"
-#include "BKE_image.h"
-
-#include "BLI_threads.h"
-
-#include "BIF_editsound.h"
-#include "BIF_writeimage.h"
-#include "BIF_writeavicodec.h"
-
-#include "BSE_seqaudio.h"
-#include "BSE_headerbuttons.h"
-
-#include "RE_pipeline.h"
-
-#include "butspace.h" // own module
-
-#ifdef WITH_QUICKTIME
-#include "quicktime_export.h"
-#endif
-
-#ifdef WITH_FFMPEG
-
-#include <ffmpeg/avcodec.h> /* for PIX_FMT_* and CODEC_ID_* */
-#include <ffmpeg/avformat.h>
-
-static int ffmpeg_preset_sel = 0;
-
-extern int is_container(int);
-
-extern void makeffmpegstring(char* string);
-
-#endif
-
-/* here the calls for scene buttons
- - render
- - world
- - anim settings, audio
-*/
-
-/* prototypes */
-void playback_anim(void);
-
-/* ************************ SOUND *************************** */
-static void load_new_sample(char *str) /* called from fileselect */
-{
- char name[FILE_MAX];
- bSound *sound;
- bSample *sample, *newsample;
-
- sound = G.buts->lockpoin;
-
- if (sound) {
- // save values
- sample = sound->sample;
- strcpy(name, sound->sample->name);
-
- strcpy(sound->name, str);
- sound_set_sample(sound, NULL);
- sound_initialize_sample(sound);
-
- if (sound->sample->type == SAMPLE_INVALID) {
- error("Not a valid sample: %s", str);
-
- newsample = sound->sample;
-
- // restore values
- strcpy(sound->name, name);
- sound_set_sample(sound, sample);
-
- // remove invalid sample
-
- sound_free_sample(newsample);
- BLI_remlink(samples, newsample);
- MEM_freeN(newsample);
- }
- }
-
- BIF_undo_push("Load new audio file");
- allqueue(REDRAWBUTSSCENE, 0);
-
-}
-
-
-void do_soundbuts(unsigned short event)
-{
- char name[FILE_MAX];
- bSound *sound;
- bSample *sample;
- bSound* tempsound;
- ID *id;
-
- sound = G.buts->lockpoin;
-
- switch(event) {
- case B_SOUND_REDRAW:
- allqueue(REDRAWBUTSSCENE, 0);
- break;
-
- case B_SOUND_LOAD_SAMPLE:
- if (sound) strcpy(name, sound->name);
- else strcpy(name, U.sounddir);
-
- activate_fileselect(FILE_SPECIAL, "SELECT WAV FILE", name, load_new_sample);
- break;
-
- case B_SOUND_PLAY_SAMPLE:
- if (sound) {
- if (sound->sample->type != SAMPLE_INVALID) {
- sound_play_sound(sound);
- allqueue(REDRAWBUTSSCENE, 0);
- }
- }
- break;
-
- case B_SOUND_MENU_SAMPLE:
- if (G.buts->menunr > 0) {
- sample = BLI_findlink(samples, G.buts->menunr - 1);
- if (sample && sound) {
- BLI_strncpy(sound->name, sample->name, sizeof(sound->name));
- sound_set_sample(sound, sample);
- do_soundbuts(B_SOUND_REDRAW);
- }
- }
-
- break;
- case B_SOUND_NAME_SAMPLE:
- load_new_sample(sound->name);
- break;
-
- case B_SOUND_UNPACK_SAMPLE:
- if(sound && sound->sample) {
- sample = sound->sample;
-
- if (sample->packedfile) {
- if (G.fileflags & G_AUTOPACK) {
- if (okee("Disable AutoPack ?")) {
- G.fileflags &= ~G_AUTOPACK;
- }
- }
-
- if ((G.fileflags & G_AUTOPACK) == 0) {
- unpackSample(sample, PF_ASK);
- }
- } else {
- sound_set_packedfile(sample, newPackedFile(sample->name));
- }
- allqueue(REDRAWHEADERS, 0);
- do_soundbuts(B_SOUND_REDRAW);
- }
- break;
-
- case B_SOUND_COPY_SOUND:
- if (sound) {
- tempsound = sound_make_copy(sound);
- sound = tempsound;
- id = &sound->id;
- G.buts->lockpoin = (bSound*)id;
- BIF_undo_push("Copy sound");
- do_soundbuts(B_SOUND_REDRAW);
- }
- break;
-
- case B_SOUND_RECALC:
- waitcursor(1);
- sound = G.main->sound.first;
- while (sound) {
- free(sound->stream);
- sound->stream = 0;
- audio_makestream(sound);
- sound = (bSound *) sound->id.next;
- }
- waitcursor(0);
- allqueue(REDRAWSEQ, 0);
- break;
-
- case B_SOUND_RATECHANGED:
-
- allqueue(REDRAWBUTSSCENE, 0);
- allqueue(REDRAWSEQ, 0);
- break;
-
- case B_SOUND_MIXDOWN:
- audio_mixdown();
- break;
-
- default:
- if (G.f & G_DEBUG) {
- printf("do_soundbuts: unhandled event %d\n", event);
- }
- }
-}
-
-
-static void sound_panel_listener(void)
-{
- uiBlock *block;
- int xco= 100, yco=100, mixrate;
- char mixrateinfo[256];
-
- block= uiNewBlock(&curarea->uiblocks, "sound_panel_listener", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Listener", "Sound", 320, 0, 318, 204)==0) return;
-
- mixrate = sound_get_mixrate();
- sprintf(mixrateinfo, "Game Mixrate: %d Hz", mixrate);
- uiDefBut(block, LABEL, 0, mixrateinfo, xco,yco,295,20, 0, 0, 0, 0, 0, "");
-
- yco -= 30;
- uiDefBut(block, LABEL, 0, "Game listener settings:",xco,yco,195,20, 0, 0, 0, 0, 0, "");
-
- yco -= 30;
- uiDefButF(block, NUMSLI, B_SOUND_CHANGED, "Volume: ",
- xco,yco,195,24,&G.listener->gain, 0.0, 1.0, 1.0, 0, "Sets the maximum volume for the overall sound");
-
- yco -= 30;
- uiDefBut(block, LABEL, 0, "Game Doppler effect settings:",xco,yco,195,20, 0, 0, 0, 0, 0, "");
-
- yco -= 30;
- uiDefButF(block, NUMSLI, B_SOUND_CHANGED, "Doppler: ",
- xco,yco,195,24,&G.listener->dopplerfactor, 0.0, 10.0, 1.0, 0, "Use this for scaling the doppler effect");
-
- yco -=30;
- uiDefButF(block, NUMSLI, B_SOUND_CHANGED, "Velocity: ",
- xco,yco,195,24,&G.listener->dopplervelocity,0.0,10000.0, 1.0,0, "Sets the propagation speed of sound");
-
-
-}
-
-static void sound_panel_sequencer(void)
-{
- uiBlock *block;
- short xco, yco;
- char mixrateinfo[256];
-
- block= uiNewBlock(&curarea->uiblocks, "sound_panel_sequencer", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Sequencer", "Sound", 640, 0, 318, 204)==0) return;
-
- /* audio sequence engine settings ------------------------------------------------------------------ */
-
- xco = 1010;
- yco = 195;
-
- uiDefBut(block, LABEL, 0, "Audio sequencer settings", xco,yco,295,20, 0, 0, 0, 0, 0, "");
-
- yco -= 25;
- sprintf(mixrateinfo, "Mixing/Sync (latency: %d ms)", (int)( (((float)U.mixbufsize)/(float)G.scene->audio.mixrate)*1000.0 ) );
- uiDefBut(block, LABEL, 0, mixrateinfo, xco,yco,295,20, 0, 0, 0, 0, 0, "");
-
- yco -= 25;
- uiDefButI(block, ROW, B_SOUND_RATECHANGED, "44.1 kHz", xco,yco,75,20, &G.scene->audio.mixrate, 2.0, 44100.0, 0, 0, "Mix at 44.1 kHz");
- uiDefButI(block, ROW, B_SOUND_RATECHANGED, "48.0 kHz", xco+80,yco,75,20, &G.scene->audio.mixrate, 2.0, 48000.0, 0, 0, "Mix at 48 kHz");
- uiDefBut(block, BUT, B_SOUND_RECALC, "Recalc", xco+160,yco,75,20, 0, 0, 0, 0, 0, "Recalculate samples");
-
- yco -= 25;
- uiDefButBitS(block, TOG, AUDIO_SYNC, B_SOUND_CHANGED, "Sync", xco,yco,115,20, &G.scene->audio.flag, 0, 0, 0, 0, "Use sample clock for syncing animation to audio");
- uiDefButBitS(block, TOG, AUDIO_SCRUB, B_SOUND_CHANGED, "Scrub", xco+120,yco,115,20, &G.scene->audio.flag, 0, 0, 0, 0, "Scrub when changing frames");
-
- yco -= 25;
- uiDefBut(block, LABEL, 0, "Main mix", xco,yco,295,20, 0, 0, 0, 0, 0, "");
-
- yco -= 25;
- uiDefButF(block, NUMSLI, B_SOUND_CHANGED, "Main (dB): ",
- xco,yco,235,24,&G.scene->audio.main, -24.0, 6.0, 0, 0, "Set the audio master gain/attenuation in dB");
-
- yco -= 25;
- uiDefButBitS(block, TOG, AUDIO_MUTE, 0, "Mute", xco,yco,235,24, &G.scene->audio.flag, 0, 0, 0, 0, "Mute audio from sequencer");
-
- yco -= 35;
- uiDefBut(block, BUT, B_SOUND_MIXDOWN, "MIXDOWN", xco,yco,235,24, 0, 0, 0, 0, 0, "Create WAV file from sequenced audio (output goes to render output dir)");
-
-}
-
-static char *make_sample_menu(void)
-{
- int len= BLI_countlist(samples); /* BKE_sound.h */
-
- if(len) {
- bSample *sample;
- char *str;
- int nr, a=0;
-
- str= MEM_callocN(32*len, "menu");
-
- for(nr=1, sample= samples->first; sample; sample= sample->id.next, nr++) {
- a+= sprintf(str+a, "|%s %%x%d", sample->id.name+2, nr);
- }
- return str;
- }
- return NULL;
-}
-
-static void sound_panel_sound(bSound *sound)
-{
- static int packdummy=0;
- ID *id, *idfrom;
- uiBlock *block;
- bSample *sample;
- char *strp, ch[256];
-
- block= uiNewBlock(&curarea->uiblocks, "sound_panel_sound", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Sound", "Sound", 0, 0, 318, 204)==0) return;
-
- uiDefBut(block, LABEL, 0, "Blender Sound block",10,180,195,20, 0, 0, 0, 0, 0, "");
-
- // warning: abuse of texnr here! (ton didnt code!)
- buttons_active_id(&id, &idfrom);
- std_libbuttons(block, 10, 160, 0, NULL, B_SOUNDBROWSE2, ID_SO, 0, id, idfrom, &(G.buts->texnr), 1, 0, 0, 0, 0);
-
- if (sound) {
-
- uiDefBut(block, BUT, B_SOUND_COPY_SOUND, "Copy sound", 220,160,90,20, 0, 0, 0, 0, 0, "Make another copy (duplicate) of the current sound");
-
- uiSetButLock(sound->id.lib!=0, ERROR_LIBDATA_MESSAGE);
- sound_initialize_sample(sound);
- sample = sound->sample;
-
- /* info string */
- if (sound->sample && sound->sample->len) {
- char *tmp;
- if (sound->sample->channels == 1) tmp= "Mono";
- else if (sound->sample->channels == 2) tmp= "Stereo";
- else tmp= "Unknown";
-
- sprintf(ch, "Sample: %s, %d bit, %d Hz, %d samples", tmp, sound->sample->bits, sound->sample->rate, (sound->sample->len/(sound->sample->bits/8)/sound->sample->channels));
- uiDefBut(block, LABEL, 0, ch, 35,140,225,20, 0, 0, 0, 0, 0, "");
- }
- else {
- uiDefBut(block, LABEL, 0, "Sample: No sample info available.",35,140,225,20, 0, 0, 0, 0, 0, "");
- }
-
- /* sample browse buttons */
- uiBlockBeginAlign(block);
- strp= make_sample_menu();
- if (strp) {
- uiDefButS(block, MENU, B_SOUND_MENU_SAMPLE, strp, 10,120,23,20, &(G.buts->menunr), 0, 0, 0, 0, "Select another loaded sample");
- MEM_freeN(strp);
- }
- uiDefBut(block, TEX, B_SOUND_NAME_SAMPLE, "", 35,120,250,20, sound->name, 0.0, 79.0, 0, 0, "The sample file used by this Sound");
-
- if (sound->sample->packedfile) packdummy = 1;
- else packdummy = 0;
-
- uiDefIconButBitI(block, TOG, 1, B_SOUND_UNPACK_SAMPLE, ICON_PACKAGE,
- 285, 120,25,20, &packdummy, 0, 0, 0, 0,"Pack/Unpack this sample");
-
- uiBlockBeginAlign(block);
- uiDefBut(block, BUT, B_SOUND_LOAD_SAMPLE, "Load sample", 10, 95,150,24, 0, 0, 0, 0, 0, "Load a different sample file");
-
- uiDefBut(block, BUT, B_SOUND_PLAY_SAMPLE, "Play", 160, 95, 150, 24, 0, 0.0, 0, 0, 0, "Playback sample using settings below");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_SOUND_CHANGED, "Volume: ",
- 10,70,150,20, &sound->volume, 0.0, 1.0, 0, 0, "Game engine only: Set the volume of this sound");
-
- uiDefButF(block, NUMSLI, B_SOUND_CHANGED, "Pitch: ",
- 160,70,150,20, &sound->pitch, -12.0, 12.0, 0, 0, "Game engine only: Set the pitch of this sound");
-
- /* looping */
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, SOUND_FLAGS_LOOP, B_SOUND_REDRAW, "Loop",
- 10, 50, 95, 20, &sound->flags, 0.0, 0.0, 0, 0, "Game engine only: Toggle between looping on/off");
-
- if (sound->flags & SOUND_FLAGS_LOOP) {
- uiDefButBitI(block, TOG, SOUND_FLAGS_BIDIRECTIONAL_LOOP, B_SOUND_REDRAW, "Ping Pong",
- 105, 50, 95, 20, &sound->flags, 0.0, 0.0, 0, 0, "Game engine only: Toggle between A->B and A->B->A looping");
-
- }
-
-
- /* 3D settings ------------------------------------------------------------------ */
- uiBlockBeginAlign(block);
-
- if (sound->sample->channels == 1) {
- uiDefButBitI(block, TOG, SOUND_FLAGS_3D, B_SOUND_REDRAW, "3D Sound",
- 10, 10, 90, 20, &sound->flags, 0, 0, 0, 0, "Game engine only: Turns 3D sound on");
-
- if (sound->flags & SOUND_FLAGS_3D) {
- uiDefButF(block, NUMSLI, B_SOUND_CHANGED, "Scale: ",
- 100,10,210,20, &sound->attenuation, 0.0, 5.0, 1.0, 0, "Game engine only: Sets the surround scaling factor for this sound");
-
- }
- }
- }
-}
-
-
-/* ************************* SCENE *********************** */
-
-
-static void output_pic(char *name)
-{
- strcpy(G.scene->r.pic, name);
- allqueue(REDRAWBUTSSCENE, 0);
- BIF_undo_push("Change output picture directory");
-}
-
-static void backbuf_pic(char *name)
-{
- Image *ima;
-
- strcpy(G.scene->r.backbuf, name);
- allqueue(REDRAWBUTSSCENE, 0);
-
- ima= BKE_add_image_file(name);
- if(ima)
- BKE_image_signal(ima, NULL, IMA_SIGNAL_RELOAD);
-
- BIF_undo_push("Change background picture");
-}
-
-static void ftype_pic(char *name)
-{
- strcpy(G.scene->r.ftype, name);
- allqueue(REDRAWBUTSSCENE, 0);
-}
-
-static void run_playanim(char *file)
-{
- extern char bprogname[]; /* usiblender.c */
- char str[FILE_MAX];
- int pos[2], size[2];
-
- /* use current settings for defining position of window. it actually should test image size */
- calc_renderwin_rectangle((G.scene->r.xsch*G.scene->r.size)/100,
- (G.scene->r.ysch*G.scene->r.size)/100, G.winpos, pos, size);
-#ifdef WIN32
- sprintf(str, "%s -a -p %d %d -f %d %g \"%s\"", bprogname, pos[0], pos[1], G.scene->r.frs_sec, G.scene->r.frs_sec_base, file);
-#else
- sprintf(str, "\"%s\" -a -p %d %d -f %d %g \"%s\"", bprogname, pos[0], pos[1], G.scene->r.frs_sec, G.scene->r.frs_sec_base, file);
-#endif
- system(str);
-}
-
-void playback_anim(void)
-{
- char file[FILE_MAX];
-
- if(BKE_imtype_is_movie(G.scene->r.imtype)) {
- switch (G.scene->r.imtype) {
-#ifdef WITH_QUICKTIME
- case R_QUICKTIME:
- makeqtstring(file);
- break;
-#endif
-#ifdef WITH_FFMPEG
- case R_FFMPEG:
- makeffmpegstring(file);
- break;
-#endif
- default:
- makeavistring(&G.scene->r, file);
- break;
- }
- if(BLI_exist(file)) {
- run_playanim(file);
- }
- else error("Can't find movie: %s", file);
- }
- else {
- BKE_makepicstring(file, G.scene->r.pic, G.scene->r.sfra, G.scene->r.imtype);
- if(BLI_exist(file)) {
- run_playanim(file);
- }
- else error("Can't find image: %s", file);
- }
-}
-
-#ifdef WITH_FFMPEG
-static void set_ffmpeg_preset(int preset);
-#endif
-
-void do_render_panels(unsigned short event)
-{
- ScrArea *sa;
- ID *id;
-
- switch(event) {
-
- case B_DORENDER:
- BIF_do_render(0);
- break;
- case B_RTCHANGED:
- allqueue(REDRAWALL, 0);
- break;
- case B_SWITCHRENDER:
- /* new panels added, so... */
- G.buts->re_align= 1;
- allqueue(REDRAWBUTSSCENE, 0);
- break;
- case B_PLAYANIM:
- playback_anim();
- break;
-
- case B_DOANIM:
- BIF_do_render(1);
- break;
-
- case B_FS_PIC:
- sa= closest_bigger_area();
- areawinset(sa->win);
- if(G.qual == LR_CTRLKEY)
- activate_imageselect(FILE_SPECIAL, "SELECT OUTPUT PICTURES", G.scene->r.pic, output_pic);
- else
- activate_fileselect(FILE_SPECIAL, "SELECT OUTPUT PICTURES", G.scene->r.pic, output_pic);
- break;
-
- case B_FS_BACKBUF:
- sa= closest_bigger_area();
- areawinset(sa->win);
- if(G.qual == LR_CTRLKEY)
- activate_imageselect(FILE_SPECIAL, "SELECT BACKBUF PICTURE", G.scene->r.backbuf, backbuf_pic);
- else
- activate_fileselect(FILE_SPECIAL, "SELECT BACKBUF PICTURE", G.scene->r.backbuf, backbuf_pic);
- break;
-
- case B_FS_FTYPE:
- sa= closest_bigger_area();
- areawinset(sa->win);
- if(G.qual == LR_CTRLKEY)
- activate_imageselect(FILE_SPECIAL, "SELECT FTYPE", G.scene->r.ftype, ftype_pic);
- else
- activate_fileselect(FILE_SPECIAL, "SELECT FTYPE", G.scene->r.ftype, ftype_pic);
- break;
-
- case B_PR_PAL:
- G.scene->r.xsch= 720;
- G.scene->r.ysch= 576;
- G.scene->r.xasp= 54;
- G.scene->r.yasp= 51;
- G.scene->r.size= 100;
- G.scene->r.frs_sec= 25;
- G.scene->r.frs_sec_base= 1;
- G.scene->r.mode &= ~R_PANORAMA;
- G.scene->r.xparts= G.scene->r.yparts= 4;
-#ifdef WITH_FFMPEG
- G.scene->r.ffcodecdata.gop_size = 15;
-#endif
- BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
- BIF_undo_push("Set PAL");
- allqueue(REDRAWBUTSSCENE, 0);
- allqueue(REDRAWVIEWCAM, 0);
- break;
-
- case B_FILETYPEMENU:
- allqueue(REDRAWBUTSSCENE, 0);
-#ifdef WITH_FFMPEG
- if (G.scene->r.imtype == R_FFMPEG) {
- if (G.scene->r.ffcodecdata.type <= 0 ||
- G.scene->r.ffcodecdata.codec <= 0 ||
- G.scene->r.ffcodecdata.audio_codec <= 0 ||
- G.scene->r.ffcodecdata.video_bitrate <= 1) {
- G.scene->r.ffcodecdata.codec
- = CODEC_ID_MPEG2VIDEO;
- set_ffmpeg_preset(FFMPEG_PRESET_DVD);
- }
-
- if (G.scene->r.ffcodecdata.audio_codec <= 0) {
- G.scene->r.ffcodecdata.audio_codec
- = CODEC_ID_MP2;
- G.scene->r.ffcodecdata.audio_bitrate = 128;
- }
- break;
- }
-#endif
-#if defined (_WIN32) || defined (__APPLE__)
- // fall through to codec settings if this is the first
- // time R_AVICODEC is selected for this scene.
- if (((G.scene->r.imtype == R_AVICODEC)
- && (G.scene->r.avicodecdata == NULL)) ||
- ((G.scene->r.imtype == R_QUICKTIME)
- && (G.scene->r.qtcodecdata == NULL))) {
- } else {
- break;
- }
-#endif /*_WIN32 || __APPLE__ */
-
- case B_SELECTCODEC:
-#if defined (_WIN32) || defined (__APPLE__)
- if ((G.scene->r.imtype == R_QUICKTIME)) { /* || (G.scene->r.qtcodecdata)) */
-#ifdef WITH_QUICKTIME
- get_qtcodec_settings();
-#endif /* WITH_QUICKTIME */
- }
-#if defined (_WIN32) && !defined(FREE_WINDOWS)
- else
- get_avicodec_settings();
-#endif /* _WIN32 && !FREE_WINDOWS */
-#endif /* _WIN32 || __APPLE__ */
- break;
-
- case B_PR_HD:
- G.scene->r.xsch= 1920;
- G.scene->r.ysch= 1080;
- G.scene->r.xasp= 1;
- G.scene->r.yasp= 1;
- G.scene->r.size= 100;
- G.scene->r.mode &= ~R_PANORAMA;
- G.scene->r.xparts= G.scene->r.yparts= 4;
-
- BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
- BIF_undo_push("Set FULL");
- allqueue(REDRAWBUTSSCENE, 0);
- allqueue(REDRAWVIEWCAM, 0);
- break;
- case B_PR_FULL:
- G.scene->r.xsch= 1280;
- G.scene->r.ysch= 1024;
- G.scene->r.xasp= 1;
- G.scene->r.yasp= 1;
- G.scene->r.size= 100;
- G.scene->r.mode &= ~R_PANORAMA;
- G.scene->r.xparts= G.scene->r.yparts= 4;
-
- BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
- BIF_undo_push("Set FULL");
- allqueue(REDRAWBUTSSCENE, 0);
- allqueue(REDRAWVIEWCAM, 0);
- break;
- case B_PR_PRV:
- G.scene->r.xsch= 640;
- G.scene->r.ysch= 512;
- G.scene->r.xasp= 1;
- G.scene->r.yasp= 1;
- G.scene->r.size= 50;
- G.scene->r.mode &= ~R_PANORAMA;
- G.scene->r.xparts= G.scene->r.yparts= 2;
-
- BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
- allqueue(REDRAWVIEWCAM, 0);
- allqueue(REDRAWBUTSSCENE, 0);
- break;
- case B_PR_PAL169:
- G.scene->r.xsch= 720;
- G.scene->r.ysch= 576;
- G.scene->r.xasp= 64;
- G.scene->r.yasp= 45;
- G.scene->r.size= 100;
- G.scene->r.frs_sec= 25;
- G.scene->r.frs_sec_base= 1;
- G.scene->r.mode &= ~R_PANORAMA;
- G.scene->r.xparts= G.scene->r.yparts= 4;
-#ifdef WITH_FFMPEG
- G.scene->r.ffcodecdata.gop_size = 15;
-#endif
-
- BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
- BIF_undo_push("Set PAL 16/9");
- allqueue(REDRAWVIEWCAM, 0);
- allqueue(REDRAWBUTSSCENE, 0);
- break;
- case B_PR_PC:
- G.scene->r.xsch= 640;
- G.scene->r.ysch= 480;
- G.scene->r.xasp= 100;
- G.scene->r.yasp= 100;
- G.scene->r.size= 100;
- G.scene->r.mode &= ~R_PANORAMA;
- G.scene->r.xparts= G.scene->r.yparts= 4;
-
- BLI_init_rctf(&G.scene->r.safety, 0.0, 1.0, 0.0, 1.0);
- BIF_undo_push("Set PC");
- allqueue(REDRAWVIEWCAM, 0);
- allqueue(REDRAWBUTSSCENE, 0);
- break;
- case B_PR_PRESET:
- G.scene->r.xsch= 720;
- G.scene->r.ysch= 576;
- G.scene->r.xasp= 54;
- G.scene->r.yasp= 51;
- G.scene->r.size= 100;
- G.scene->r.mode= R_OSA+R_SHADOW+R_FIELDS;
- G.scene->r.imtype= R_TARGA;
- G.scene->r.xparts= G.scene->r.yparts= 4;
-
- BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
- BIF_undo_push("Set Default");
- allqueue(REDRAWVIEWCAM, 0);
- allqueue(REDRAWBUTSSCENE, 0);
- break;
- case B_PR_PANO:
- G.scene->r.xsch= 576;
- G.scene->r.ysch= 176;
- G.scene->r.xasp= 115;
- G.scene->r.yasp= 100;
- G.scene->r.size= 100;
- G.scene->r.mode |= R_PANORAMA;
- G.scene->r.xparts= 16;
- G.scene->r.yparts= 1;
-
- BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
- BIF_undo_push("Set Panorama");
- allqueue(REDRAWVIEWCAM, 0);
- allqueue(REDRAWBUTSSCENE, 0);
- break;
- case B_PR_NTSC:
- G.scene->r.xsch= 720;
- G.scene->r.ysch= 480;
- G.scene->r.xasp= 10;
- G.scene->r.yasp= 11;
- G.scene->r.size= 100;
- G.scene->r.frs_sec= 30;
- G.scene->r.frs_sec_base = 1.001;
- G.scene->r.mode &= ~R_PANORAMA;
- G.scene->r.xparts= G.scene->r.yparts= 2;
-#ifdef WITH_FFMPEG
- G.scene->r.ffcodecdata.gop_size = 18;
-#endif
-
- BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
- BIF_undo_push("Set NTSC");
- allqueue(REDRAWBUTSSCENE, 0);
- allqueue(REDRAWVIEWCAM, 0);
- break;
-
- case B_SETBROWSE:
- id= (ID*) G.scene->set;
-
- if (G.buts->menunr==-2) {
- activate_databrowse(id, ID_SCE, 0, B_SETBROWSE, &G.buts->menunr, do_render_panels);
- }
- else if (G.buts->menunr>0) {
- Scene *newset= (Scene*) BLI_findlink(&G.main->scene, G.buts->menunr-1);
-
- if (newset==G.scene)
- error("Can't use the same scene as its own set");
- else if (newset) {
- G.scene->set= newset;
- if (scene_check_setscene(G.scene)==0)
- error("This would create a cycle");
-
- allqueue(REDRAWBUTSSCENE, 0);
- allqueue(REDRAWVIEW3D, 0);
- BIF_undo_push("Change Set Scene");
- }
- }
- break;
- case B_CLEARSET:
- G.scene->set= NULL;
- allqueue(REDRAWBUTSSCENE, 0);
- allqueue(REDRAWVIEW3D, 0);
- BIF_undo_push("Clear Set Scene");
-
- break;
- case B_SET_EDGE:
- allqueue(REDRAWBUTSSCENE, 0);
- break;
- case B_SET_ZBLUR:
- G.scene->r.mode &= ~R_EDGE;
- allqueue(REDRAWBUTSSCENE, 0);
- break;
- case B_ADD_RENDERLAYER:
- if(G.scene->r.actlay==32767) {
- scene_add_render_layer(G.scene);
- G.scene->r.actlay= BLI_countlist(&G.scene->r.layers) - 1;
- }
- allqueue(REDRAWBUTSSCENE, 0);
- allqueue(REDRAWNODE, 0);
- break;
- case B_SET_PASS:
- if(G.scene->nodetree) {
- ntreeCompositForceHidden(G.scene->nodetree);
- allqueue(REDRAWNODE, 0);
- }
- allqueue(REDRAWBUTSSCENE, 0);
- allqueue(REDRAWOOPS, 0);
- }
-}
-
-/* NOTE: this is a block-menu, needs 0 events, otherwise the menu closes */
-static uiBlock *edge_render_menu(void *arg_unused)
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "edge render", UI_EMBOSS, UI_HELV, curarea->win);
-
- /* use this for a fake extra empy space around the buttons */
- uiDefBut(block, LABEL, 0, "", 0, 0, 220, 115, NULL, 0, 0, 0, 0, "");
-
- uiDefButS(block, NUM, 0,"Eint:", 45,75,175,19, &G.scene->r.edgeint, 0.0, 255.0, 0, 0,
- "Sets edge intensity for Toon shading");
-
- /* color settings for the toon shading */
- uiDefButF(block, COL, 0, "", 10, 10,30,60, &(G.scene->r.edgeR), 0, 0, 0, B_EDGECOLSLI, "");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, 0, "R ", 45, 50, 175,19, &G.scene->r.edgeR, 0.0, 1.0, B_EDGECOLSLI, 0,
- "Color for edges in toon shading mode.");
- uiDefButF(block, NUMSLI, 0, "G ", 45, 30, 175,19, &G.scene->r.edgeG, 0.0, 1.0, B_EDGECOLSLI, 0,
- "Color for edges in toon shading mode.");
- uiDefButF(block, NUMSLI, 0, "B ", 45, 10, 175,19, &G.scene->r.edgeB, 0.0, 1.0, B_EDGECOLSLI, 0,
- "Color for edges in toon shading mode.");
-
-
- uiBlockSetDirection(block, UI_TOP);
-
- return block;
-}
-
-
-/* NOTE: this is a block-menu, needs 0 events, otherwise the menu closes */
-static uiBlock *framing_render_menu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 190, xco = 0;
- int randomcolorindex = 1234;
-
- block= uiNewBlock(&curarea->uiblocks, "framing_options", UI_EMBOSS, UI_HELV, curarea->win);
-
- /* use this for a fake extra empy space around the buttons */
- uiDefBut(block, LABEL, 0, "", -5, -10, 295, 224, NULL, 0, 0, 0, 0, "");
-
- uiDefBut(block, LABEL, 0, "Framing:", xco, yco, 68,19, 0, 0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButC(block, ROW, 0, "Stretch", xco += 70, yco, 68, 19, &G.scene->framing.type, 1.0, SCE_GAMEFRAMING_SCALE , 0, 0, "Stretch or squeeze the viewport to fill the display window");
- uiDefButC(block, ROW, 0, "Expose", xco += 70, yco, 68, 19, &G.scene->framing.type, 1.0, SCE_GAMEFRAMING_EXTEND, 0, 0, "Show the entire viewport in the display window, viewing more horizontally or vertically");
- uiDefButC(block, ROW, 0, "Letterbox", xco += 70, yco, 68, 19, &G.scene->framing.type, 1.0, SCE_GAMEFRAMING_BARS , 0, 0, "Show the entire viewport in the display window, using bar horizontally or vertically");
- uiBlockEndAlign(block);
-
- yco -= 25;
- xco = 40;
-
- uiDefButF(block, COL, 0, "", 0, yco - 58 + 18, 33, 58, &G.scene->framing.col[0], 0, 0, 0, randomcolorindex, "");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, 0, "R ", xco,yco,243,18, &G.scene->framing.col[0], 0.0, 1.0, randomcolorindex, 0, "Set the red component of the bars");
- yco -= 20;
- uiDefButF(block, NUMSLI, 0, "G ", xco,yco,243,18, &G.scene->framing.col[1], 0.0, 1.0, randomcolorindex, 0, "Set the green component of the bars");
- yco -= 20;
- uiDefButF(block, NUMSLI, 0, "B ", xco,yco,243,18, &G.scene->framing.col[2], 0.0, 1.0, randomcolorindex, 0, "Set the blue component of the bars");
- uiBlockEndAlign(block);
-
- xco = 0;
- uiDefBut(block, LABEL, 0, "Fullscreen:", xco, yco-=30, 100, 19, 0, 0.0, 0.0, 0, 0, "");
- uiDefButS(block, TOG, 0, "Fullscreen", xco+70, yco, 68, 19, &G.scene->r.fullscreen, 0.0, 0.0, 0, 0, "Starts player in a new fullscreen display");
- uiBlockBeginAlign(block);
- uiDefButS(block, NUM, 0, "X:", xco+40, yco-=27, 100, 19, &G.scene->r.xplay, 10.0, 2000.0, 0, 0, "Displays current X screen/window resolution. Click to change.");
- uiDefButS(block, NUM, 0, "Y:", xco+140, yco, 100, 19, &G.scene->r.yplay, 10.0, 2000.0, 0, 0, "Displays current Y screen/window resolution. Click to change.");
- uiDefButS(block, NUM, 0, "Freq:", xco+40, yco-=21, 100, 19, &G.scene->r.freqplay, 10.0, 2000.0, 0, 0, "Displays clock frequency of fullscreen display. Click to change.");
- uiDefButS(block, NUM, 0, "Bits:", xco+140, yco, 100, 19, &G.scene->r.depth, 8.0, 32.0, 800.0, 0, "Displays bit depth of full screen display. Click to change.");
- uiBlockEndAlign(block);
-
- /* stereo settings */
- /* can't use any definition from the game engine here so hardcode it. Change it here when it changes there!
- * RAS_IRasterizer has definitions:
- * RAS_STEREO_NOSTEREO 1
- * RAS_STEREO_QUADBUFFERED 2
- * RAS_STEREO_ABOVEBELOW 3
- * RAS_STEREO_INTERLACED 4 future
- * RAS_STEREO_ANAGLYPH 5
- * RAS_STEREO_SIDEBYSIDE 6
- * RAS_STEREO_VINTERLACE 7
- */
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW, 0, "No Stereo", xco, yco-=30, 88, 19, &(G.scene->r.stereomode), 7.0, 1.0, 0, 0, "Disables stereo");
- uiDefButS(block, ROW, 0, "Pageflip", xco+=90, yco, 88, 19, &(G.scene->r.stereomode), 7.0, 2.0, 0, 0, "Enables hardware pageflip stereo method");
- uiDefButS(block, ROW, 0, "Syncdouble", xco+=90, yco, 88, 19, &(G.scene->r.stereomode), 7.0, 3.0, 0, 0, "Enables syncdoubling stereo method");
- uiDefButS(block, ROW, 0, "Anaglyph", xco-=180, yco-=21, 88, 19, &(G.scene->r.stereomode), 7.0, 5.0, 0, 0, "Enables anaglyph (Red-Blue) stereo method");
- uiDefButS(block, ROW, 0, "Side by Side", xco+=90, yco, 88, 19, &(G.scene->r.stereomode), 7.0, 6.0, 0, 0, "Enables side by side left and right images");
- uiDefButS(block, ROW, 0, "V Interlace", xco+=90, yco, 88, 19, &(G.scene->r.stereomode), 7.0, 7.0, 0, 0, "Enables interlaced vertical strips for autostereo display");
-
- uiBlockEndAlign(block);
-
- uiBlockSetDirection(block, UI_TOP);
-
- return block;
-}
-
-#ifdef WITH_FFMPEG
-
-static char* ffmpeg_format_pup(void)
-{
- static char string[2048];
- char formatstring[2048];
-#if 0
- int i = 0;
- int stroffs = 0;
- AVOutputFormat* next = first_oformat;
- formatstring = "FFMpeg format: %%t";
- sprintf(string, formatstring);
- formatstring = "|%s %%x%d";
- /* FIXME: This should only be generated once */
- while (next != NULL) {
- if (next->video_codec != CODEC_ID_NONE && !(next->flags & AVFMT_NOFILE)) {
- sprintf(string+stroffs, formatstring, next->name, i++);
- stroffs += strlen(string+stroffs);
- }
- next = next->next;
- }
- return string;
-#endif
- strcpy(formatstring, "FFMpeg format: %%t|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d");
- sprintf(string, formatstring,
- "MPEG-1", FFMPEG_MPEG1,
- "MPEG-2", FFMPEG_MPEG2,
- "MPEG-4", FFMPEG_MPEG4,
- "AVI", FFMPEG_AVI,
- "Quicktime", FFMPEG_MOV,
- "DV", FFMPEG_DV,
- "H264", FFMPEG_H264,
- "XVid", FFMPEG_XVID);
- return string;
-}
-
-static char* ffmpeg_preset_pup(void)
-{
- static char string[2048];
- char formatstring[2048];
-
- strcpy(formatstring, "FFMpeg preset: %%t|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d");
- sprintf(string, formatstring,
- "", FFMPEG_PRESET_NONE,
- "DVD", FFMPEG_PRESET_DVD,
- "SVCD", FFMPEG_PRESET_SVCD,
- "VCD", FFMPEG_PRESET_VCD,
- "DV", FFMPEG_PRESET_DV);
- return string;
-}
-
-
-static char* ffmpeg_codec_pup(void) {
- static char string[2048];
- char formatstring[2048];
- strcpy(formatstring, "FFMpeg format: %%t|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d");
- sprintf(string, formatstring,
- "MPEG1", CODEC_ID_MPEG1VIDEO,
- "MPEG2", CODEC_ID_MPEG2VIDEO,
- "MPEG4(divx)", CODEC_ID_MPEG4,
- "HuffYUV", CODEC_ID_HUFFYUV,
- "DV", CODEC_ID_DVVIDEO,
- "H264", CODEC_ID_H264,
- "XVid", CODEC_ID_XVID);
- return string;
-
-}
-
-static char* ffmpeg_audio_codec_pup(void) {
- static char string[2048];
- char formatstring[2048];
- strcpy(formatstring, "FFMpeg format: %%t|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d");
- sprintf(string, formatstring,
- "MP2", CODEC_ID_MP2,
- "MP3", CODEC_ID_MP3,
- "AC3", CODEC_ID_AC3,
- "AAC", CODEC_ID_AAC,
- "PCM", CODEC_ID_PCM_S16LE);
- return string;
-
-}
-
-#endif
-
-static char *imagetype_pup(void)
-{
- static char string[1024];
- char formatstring[1024];
- char appendstring[1024];
-
- strcpy(formatstring, "Save image as: %%t|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d");
-
-#ifdef __sgi
- strcat(formatstring, "|%s %%x%d"); // add space for Movie
-#endif
-
- strcat(formatstring, "|%s %%x%d"); // add space for PNG
-/* Commented out until implemented
-#ifdef WITH_DDS
- strcat(formatstring, "|%s %%x%d"); // add space for DDS
-#endif
-*/
- strcat(formatstring, "|%s %%x%d"); // add space for BMP
- strcat(formatstring, "|%s %%x%d"); // add space for Radiance HDR
- strcat(formatstring, "|%s %%x%d"); // add space for Cineon
- strcat(formatstring, "|%s %%x%d"); // add space for DPX
-
-#ifdef _WIN32
- strcat(formatstring, "|%s %%x%d"); // add space for AVI Codec
-#endif
-
-#ifdef WITH_FFMPEG
- strcat(formatstring, "|%s %%x%d"); // Add space for ffmpeg
-#endif
- strcat(formatstring, "|%s %%x%d"); // Add space for frameserver
-
-#ifdef WITH_QUICKTIME
- if(G.have_quicktime)
- strcat(formatstring, "|%s %%x%d"); // add space for Quicktime
-#endif
-
- if(G.have_quicktime) {
- sprintf(string, formatstring,
- "Frameserver", R_FRAMESERVER,
-#ifdef WITH_FFMPEG
- "FFMpeg", R_FFMPEG,
-#endif
- "AVI Raw", R_AVIRAW,
- "AVI Jpeg", R_AVIJPEG,
-#ifdef _WIN32
- "AVI Codec", R_AVICODEC,
-#endif
-#ifdef WITH_QUICKTIME
- "QuickTime", R_QUICKTIME,
-#endif
- "Targa", R_TARGA,
- "Targa Raw", R_RAWTGA,
- "PNG", R_PNG,
-/* commented out until implemented
-#ifdef WITH_DDS
- "DDS", R_DDS,
-#endif
-*/
- "BMP", R_BMP,
- "Jpeg", R_JPEG90,
- "HamX", R_HAMX,
- "Iris", R_IRIS,
- "Radiance HDR", R_RADHDR,
- "Cineon", R_CINEON,
- "DPX", R_DPX
-#ifdef __sgi
- ,"Movie", R_MOVIE
-#endif
- );
- } else {
- sprintf(string, formatstring,
- "Frameserver", R_FRAMESERVER,
-#ifdef WITH_FFMPEG
- "FFMpeg", R_FFMPEG,
-#endif
- "AVI Raw", R_AVIRAW,
- "AVI Jpeg", R_AVIJPEG,
-#ifdef _WIN32
- "AVI Codec", R_AVICODEC,
-#endif
- "Targa", R_TARGA,
- "Targa Raw", R_RAWTGA,
- "PNG", R_PNG,
-#ifdef WITH_DDS
- "DDS", R_DDS,
-#endif
- "BMP", R_BMP,
- "Jpeg", R_JPEG90,
- "HamX", R_HAMX,
- "Iris", R_IRIS,
- "Radiance HDR", R_RADHDR,
- "Cineon", R_CINEON,
- "DPX", R_DPX
-#ifdef __sgi
- ,"Movie", R_MOVIE
-#endif
- );
- }
-
-#ifdef WITH_OPENEXR
- strcpy(formatstring, "|%s %%x%d");
- sprintf(appendstring, formatstring, "OpenEXR", R_OPENEXR);
- strcat(string, appendstring);
- sprintf(appendstring, formatstring, "MultiLayer", R_MULTILAYER);
- strcat(string, appendstring);
-#endif
-
- if (G.have_libtiff) {
- strcpy(formatstring, "|%s %%x%d");
- sprintf(appendstring, formatstring, "TIFF", R_TIFF);
- strcat(string, appendstring);
- }
-
- return (string);
-}
-
-#ifdef _WIN32
-static char *avicodec_str(void)
-{
- static char string[1024];
-
- sprintf(string, "Codec: %s", G.scene->r.avicodecdata->avicodecname);
-
- return string;
-}
-#endif
-
-static void render_panel_output(void)
-{
- ID *id;
- int a,b;
- uiBlock *block;
- char *strp;
-
-
- block= uiNewBlock(&curarea->uiblocks, "render_panel_output", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Output", "Render", 0, 0, 318, 204)==0) return;
-
- uiBlockBeginAlign(block);
- uiDefIconBut(block, BUT, B_FS_PIC, ICON_FILESEL, 10, 190, 20, 20, 0, 0, 0, 0, 0, "Open Fileselect to get Pics dir/name");
- uiDefBut(block, TEX,0,"", 31, 190, 279, 20,G.scene->r.pic, 0.0,79.0, 0, 0, "Directory/name to save rendered Pics to");
- uiDefIconBut(block, BUT,B_FS_BACKBUF, ICON_FILESEL, 10, 168, 20, 20, 0, 0, 0, 0, 0, "Open Fileselect to get Backbuf image");
- uiDefBut(block, TEX,0,"", 31, 168, 279, 20,G.scene->r.backbuf, 0.0,79.0, 0, 0, "Image to use as background for rendering");
- uiDefIconBut(block, BUT,B_FS_FTYPE, ICON_FILESEL, 10, 146, 20, 20, 0, 0, 0, 0, 0, "Open Fileselect to get Ftype image");
- uiDefBut(block, TEX,0,"", 31, 146, 279, 20,G.scene->r.ftype,0.0,79.0, 0, 0, "Image to use with FTYPE Image type");
- uiBlockEndAlign(block);
-
-
- /* SET BUTTON */
- uiBlockBeginAlign(block);
- id= (ID *)G.scene->set;
- IDnames_to_pupstring(&strp, NULL, NULL, &(G.main->scene), id, &(G.buts->menunr));
- if(strp[0])
- uiDefButS(block, MENU, B_SETBROWSE, strp, 10, 120, 20, 20, &(G.buts->menunr), 0, 0, 0, 0, "Scene to link as a Set");
- MEM_freeN(strp);
-
- if(G.scene->set) {
- uiSetButLock(1, NULL);
- uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, B_NOP, "", 31, 120, 100, 20, &(G.scene->set), "Name of the Set");
- uiClearButLock();
- uiDefIconBut(block, BUT, B_CLEARSET, ICON_X, 132, 120, 20, 20, 0, 0, 0, 0, 0, "Remove Set link");
- }
- uiBlockEndAlign(block);
-
- uiBlockSetCol(block, TH_BUT_SETTING1);
- uiDefButBitS(block, TOG, R_BACKBUF, B_NOP,"Backbuf", 10, 94, 80, 20, &G.scene->r.bufflag, 0, 0, 0, 0, "Enable/Disable use of Backbuf image");
- uiDefButS(block, NUM, B_NOP, "Threads:", 10, 68, 100, 20, &G.scene->r.threads, 1, BLENDER_MAX_THREADS, 0, 0, "Amount of threads for render");
- uiBlockSetCol(block, TH_AUTO);
-
- uiBlockBeginAlign(block);
- for(b=2; b>=0; b--)
- for(a=0; a<3; a++)
- uiDefButBitS(block, TOG, 1<<(3*b+a), 800,"", (short)(10+18*a),(short)(10+14*b),16,12, &G.winpos, 0, 0, 0, 0, "Render window placement on screen");
- uiBlockEndAlign(block);
-
- uiDefButBitS(block, TOG, R_EXR_TILE_FILE, B_NOP, "Save Buffers", 72, 31, 120, 19, &G.scene->r.scemode, 0.0, 0.0, 0, 0, "Save the tiles for all RenderLayers and used SceneNodes to files, to save memory");
-
- uiDefButS(block, MENU, B_REDR, "Render Display %t|Render Window %x1|Image Editor %x0|Full Screen %x2",
- 72, 10, 120, 19, &G.displaymode, 0.0, (float)R_DISPLAYWIN, 0, 0, "Sets render output display");
-
- uiDefButBitS(block, TOG, R_EXTENSION, B_NOP, "Extensions", 205, 10, 105, 19, &G.scene->r.scemode, 0.0, 0.0, 0, 0, "Adds extensions to the output when rendering animations");
-
- /* Dither control */
- uiDefButF(block, NUM,B_DIFF, "Dither:", 205,31,105,19, &G.scene->r.dither_intensity, 0.0, 2.0, 0, 0, "The amount of dithering noise present in the output image (0.0 = no dithering)");
-
- /* Toon shading buttons */
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, R_EDGE, B_NOP,"Edge", 100, 94, 70, 20, &G.scene->r.mode, 0, 0, 0, 0, "Enable Toon Edge-enhance");
- uiDefBlockBut(block, edge_render_menu, NULL, "Edge Settings", 170, 94, 140, 20, "Display Edge settings");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, R_NO_TEX, B_NOP, "Disable Tex", 115, 68, 70, 20, &G.scene->r.scemode, 0.0, 0.0, 0, 0, "Disables Textures for render");
- uiDefButBitS(block, TOG, R_FREE_IMAGE, B_NOP, "Free Tex Images", 205, 68, 100, 20, &G.scene->r.scemode, 0.0, 0.0, 0, 0, "Frees all Images used by Textures after each render");
- uiBlockEndAlign(block);
-}
-
-static void do_bake_func(void *unused_v, void *unused_p)
-{
- objects_bake_render(0);
-}
-
-static void render_panel_bake(void)
-{
- uiBlock *block;
- uiBut *but;
-
- block= uiNewBlock(&curarea->uiblocks, "render_panel_bake", UI_EMBOSS, UI_HELV, curarea->win);
- uiNewPanelTabbed("Anim", "Render");
- if(uiNewPanel(curarea, block, "Bake", "Render", 320, 0, 318, 204)==0) return;
-
- but= uiDefBut(block, BUT, B_NOP, "BAKE", 10, 150, 190,40, 0, 0, 0, 0, 0, "Start the bake render for selected Objects");
- uiButSetFunc(but, do_bake_func, NULL, NULL);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, R_BAKE_TO_ACTIVE, B_DIFF, "Selected to Active", 10,120,190,20,&G.scene->r.bake_flag, 0.0, 0, 0, 0, "Bake shading on the surface of selected objects to the active object");
- uiDefButF(block, NUM, B_DIFF, "Dist:", 10,100,(G.scene->r.bake_mode == RE_BAKE_NORMALS)? 95: 190,20,&G.scene->r.bake_maxdist, 0.0, 10.0, 1, 0, "Maximum distance from active object to other object");
-
- if(G.scene->r.bake_mode == RE_BAKE_NORMALS)
- uiDefButS(block, MENU, B_DIFF, "Normal Space %t|Camera %x0|World %x1|Object %x2|Tangent %x3",
- 105,100,95,20, &G.scene->r.bake_normal_space, 0, 0, 0, 0, "Choose normal space for baking");
- uiBlockEndAlign(block);
-
-#if 0
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, R_BAKE_OSA, B_DIFF, "OSA", 10,120,190,20, &G.scene->r.bake_flag, 0, 0, 0, 0, "Enables Oversampling (Anti-aliasing)");
- uiDefButS(block, ROW,B_DIFF,"5", 10,100,50,20,&G.scene->r.bake_osa,2.0,5.0, 0, 0, "Sets oversample level to 5");
- uiDefButS(block, ROW,B_DIFF,"8", 60,100,45,20,&G.scene->r.bake_osa,2.0,8.0, 0, 0, "Sets oversample level to 8");
- uiDefButS(block, ROW,B_DIFF,"11", 105,100,45,20,&G.scene->r.bake_osa,2.0,11.0, 0, 0, "Sets oversample level to 11");
- uiDefButS(block, ROW,B_DIFF,"16", 150,100,50,20,&G.scene->r.bake_osa,2.0,16.0, 0, 0, "Sets oversample level to 16");
-#endif
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW,B_REDR,"Full Render", 210,170,120,20,&G.scene->r.bake_mode, 1.0, RE_BAKE_ALL, 0, 0, "");
- uiDefButS(block, ROW,B_REDR,"Ambient Occlusion",210,150,120,20,&G.scene->r.bake_mode, 1.0, RE_BAKE_AO, 0, 0, "");
- uiDefButS(block, ROW,B_REDR,"Normals", 210,130,120,20,&G.scene->r.bake_mode, 1.0, RE_BAKE_NORMALS, 0, 0, "");
- uiDefButS(block, ROW,B_REDR,"Textures", 210,110,120,20,&G.scene->r.bake_mode, 1.0, RE_BAKE_TEXTURE, 0, 0, "");
- uiBlockEndAlign(block);
-
- uiDefButBitS(block, TOG, R_BAKE_CLEAR, B_DIFF, "Clear", 210,80,120,20,&G.scene->r.bake_flag, 0.0, 0, 0, 0, "Clear Images before baking");
-
- uiDefButS(block, NUM, B_DIFF,"Margin:", 210,50,120,20,&G.scene->r.bake_filter, 0.0, 32.0, 0, 0, "Amount of pixels to extend the baked result with, as post process filter");
-}
-
-static void render_panel_render(void)
-{
- uiBlock *block;
- char str[256];
-
- block= uiNewBlock(&curarea->uiblocks, "render_panel_render", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Render", "Render", 320, 0, 318, 204)==0) return;
-
- uiBlockBeginAlign(block);
- uiDefBut(block, BUT,B_DORENDER,"RENDER", 369, 164, 191,37, 0, 0, 0, 0, 0, "Start the rendering");
-#ifndef DISABLE_YAFRAY
- /* yafray: on request, render engine menu is back again, and moved to Render panel */
- uiDefButS(block, MENU, B_SWITCHRENDER, "Rendering Engine %t|Blender Internal %x0|YafRay %x1",
- 369, 142, 191, 20, &G.scene->r.renderer, 0, 0, 0, 0, "Choose rendering engine");
-#else
- uiDefButS(block, MENU, B_SWITCHRENDER, "Rendering Engine %t|Blender Internal %x0",
- 369, 142, 191, 20, &G.scene->r.renderer, 0, 0, 0, 0, "Choose rendering engine");
-#endif /* disable yafray */
-
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, R_OSA, B_DIFF, "OSA", 369,109,122,20,&G.scene->r.mode, 0, 0, 0, 0, "Enables Oversampling (Anti-aliasing)");
- uiDefButS(block, ROW,B_DIFF,"5", 369,88,29,20,&G.scene->r.osa,2.0,5.0, 0, 0, "Sets oversample level to 5");
- uiDefButS(block, ROW,B_DIFF,"8", 400,88,29,20,&G.scene->r.osa,2.0,8.0, 0, 0, "Sets oversample level to 8 (Recommended)");
- uiDefButS(block, ROW,B_DIFF,"11", 431,88,29,20,&G.scene->r.osa,2.0,11.0, 0, 0, "Sets oversample level to 11");
- uiDefButS(block, ROW,B_DIFF,"16", 462,88,29,20,&G.scene->r.osa,2.0,16.0, 0, 0, "Sets oversample level to 16");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, R_MBLUR, B_REDR, "MBLUR", 496,109,64,20,&G.scene->r.mode, 0, 0, 0, 0, "Enables Motion Blur calculation");
- uiDefButF(block, NUM,B_DIFF,"Bf:", 496,88,64,20,&G.scene->r.blurfac, 0.01, 5.0, 10, 2, "Sets motion blur factor");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButS(block, NUM,B_DIFF,"Xparts:", 369,46,95,29,&G.scene->r.xparts,1.0, 512.0, 0, 0, "Sets the number of horizontal parts to render image in (For panorama sets number of camera slices)");
- uiDefButS(block, NUM,B_DIFF,"Yparts:", 465,46,95,29,&G.scene->r.yparts,1.0, 64.0, 0, 0, "Sets the number of vertical parts to render image in");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW,800,"Sky", 369,13,35,20,&G.scene->r.alphamode,3.0,0.0, 0, 0, "Fill background with sky");
- uiDefButS(block, ROW,800,"Premul", 405,13,50,20,&G.scene->r.alphamode,3.0,1.0, 0, 0, "Multiply alpha in advance");
- uiDefButS(block, ROW,800,"Key", 456,13,35,20,&G.scene->r.alphamode,3.0,2.0, 0, 0, "Alpha and color values remain unchanged");
- uiBlockEndAlign(block);
-
- if(G.scene->r.mode & R_RAYTRACE)
- uiDefButS(block, MENU, B_DIFF,"Octree resolution %t|64 %x64|128 %x128|256 %x256|512 %x512", 496,13,64,20,&G.scene->r.ocres,0.0,0.0, 0, 0, "Octree resolution for ray tracing");
-
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, R_SHADOW, B_REDR,"Shadow", 565,172,60,29, &G.scene->r.mode, 0, 0, 0, 0, "Enable shadow calculation");
- uiDefButBitI(block, TOG, R_ENVMAP, B_REDR,"EnvMap", 627,172,60,29, &G.scene->r.mode, 0, 0, 0, 0, "Enable environment map rendering");
- uiDefButBitI(block, TOG, R_PANORAMA, B_REDR,"Pano", 565,142,40,29, &G.scene->r.mode, 0, 0, 0, 0, "Enable panorama rendering (output width is multiplied by Xparts)");
- uiDefButBitI(block, TOG, R_RAYTRACE, B_REDR,"Ray",606,142,40,29, &G.scene->r.mode, 0, 0, 0, 0, "Enable ray tracing");
- uiDefButBitI(block, TOG, R_RADIO, B_REDR,"Radio", 647,142,40,29, &G.scene->r.mode, 0, 0, 0, 0, "Enable radiosity rendering");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW,B_DIFF,"100%", 565,109,122,20,&G.scene->r.size,1.0,100.0, 0, 0, "Set render size to defined size");
- uiDefButS(block, ROW,B_DIFF,"75%", 565,88,40,20,&G.scene->r.size,1.0,75.0, 0, 0, "Set render size to 3/4 of defined size");
- uiDefButS(block, ROW,B_DIFF,"50%", 606,88,40,20,&G.scene->r.size,1.0,50.0, 0, 0, "Set render size to 1/2 of defined size");
- uiDefButS(block, ROW,B_DIFF,"25%", 647,88,40,20,&G.scene->r.size,1.0,25.0, 0, 0, "Set render size to 1/4 of defined size");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, R_FIELDS, B_REDR,"Fields", 565,55,60,20,&G.scene->r.mode, 0, 0, 0, 0, "Enables field rendering");
- uiDefButBitI(block, TOG, R_ODDFIELD, B_REDR,"Odd", 627,55,39,20,&G.scene->r.mode, 0, 0, 0, 0, "Enables Odd field first rendering (Default: Even field)");
- uiDefButBitI(block, TOG, R_FIELDSTILL, B_REDR,"X", 668,55,19,20,&G.scene->r.mode, 0, 0, 0, 0, "Disables time difference in field calculations");
-
- sprintf(str, "Filter%%t|Box %%x%d|Tent %%x%d|Quad %%x%d|Cubic %%x%d|Gauss %%x%d|CatRom %%x%d|Mitch %%x%d", R_FILTER_BOX, R_FILTER_TENT, R_FILTER_QUAD, R_FILTER_CUBIC, R_FILTER_GAUSS, R_FILTER_CATROM, R_FILTER_MITCH);
- uiDefButS(block, MENU, B_DIFF,str, 565,34,60,20, &G.scene->r.filtertype, 0, 0, 0, 0, "Set sampling filter for antialiasing");
- uiDefButF(block, NUM,B_DIFF,"", 627,34,60,20,&G.scene->r.gauss,0.5, 1.5, 10, 2, "Sets the filter size");
-
- uiDefButBitI(block, TOG, R_BORDER, REDRAWVIEWCAM, "Border", 565,13,122,20, &G.scene->r.mode, 0, 0, 0, 0, "Render a small cut-out of the image");
- uiBlockEndAlign(block);
-
-}
-
-static void render_panel_anim(void)
-{
- uiBlock *block;
-
-
- block= uiNewBlock(&curarea->uiblocks, "render_panel_anim", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Anim", "Render", 640, 0, 318, 204)==0) return;
-
-
- uiDefBut(block, BUT,B_DOANIM,"ANIM", 692,142,192,47, 0, 0, 0, 0, 0, "Start rendering a sequence");
-
- uiBlockSetCol(block, TH_BUT_SETTING1);
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, R_DOSEQ, B_NOP, "Do Sequence",692,114,192,20, &G.scene->r.scemode, 0, 0, 0, 0, "Enables sequence output rendering (Default: 3D rendering)");
- uiDefButBitS(block, TOG, R_DOCOMP, B_NOP, "Do Composite",692,90,192,20, &G.scene->r.scemode, 0, 0, 0, 0, "Uses compositing nodes for output rendering");
- uiBlockEndAlign(block);
-
- uiBlockSetCol(block, TH_AUTO);
- uiDefBut(block, BUT,B_PLAYANIM, "PLAY",692,40,94,33, 0, 0, 0, 0, 0, "Play animation of rendered images/avi (searches Pics: field)");
- uiDefButS(block, NUM, B_RTCHANGED, "rt:",789,40,95,33, &G.rt, -1000.0, 1000.0, 0, 0, "General testing/debug button");
-
- uiBlockBeginAlign(block);
- uiDefButI(block, NUM,REDRAWSEQ,"Sta:",692,10,94,24, &G.scene->r.sfra,1.0,MAXFRAMEF, 0, 0, "The start frame of the animation");
- uiDefButI(block, NUM,REDRAWSEQ,"End:",789,10,95,24, &G.scene->r.efra,SFRA,MAXFRAMEF, 0, 0, "The end frame of the animation");
- uiBlockEndAlign(block);
-}
-
-#ifdef WITH_FFMPEG
-static void set_ffmpeg_preset(int preset)
-{
- int isntsc = (G.scene->r.frs_sec != 25);
- switch (preset) {
- case FFMPEG_PRESET_VCD:
- G.scene->r.ffcodecdata.type = FFMPEG_MPEG1;
- G.scene->r.ffcodecdata.video_bitrate = 1150;
- G.scene->r.xsch = 352;
- G.scene->r.ysch = isntsc ? 240 : 288;
- G.scene->r.ffcodecdata.gop_size = isntsc ? 18 : 15;
- G.scene->r.ffcodecdata.rc_max_rate = 1150;
- G.scene->r.ffcodecdata.rc_min_rate = 1150;
- G.scene->r.ffcodecdata.rc_buffer_size = 40*8;
- G.scene->r.ffcodecdata.mux_packet_size = 2324;
- G.scene->r.ffcodecdata.mux_rate = 2352 * 75 * 8;
- break;
- case FFMPEG_PRESET_SVCD:
- G.scene->r.ffcodecdata.type = FFMPEG_MPEG2;
- G.scene->r.ffcodecdata.video_bitrate = 2040;
- G.scene->r.xsch = 480;
- G.scene->r.ysch = isntsc ? 480 : 576;
- G.scene->r.ffcodecdata.gop_size = isntsc ? 18 : 15;
- G.scene->r.ffcodecdata.rc_max_rate = 2516;
- G.scene->r.ffcodecdata.rc_min_rate = 0;
- G.scene->r.ffcodecdata.rc_buffer_size = 224*8;
- G.scene->r.ffcodecdata.mux_packet_size = 2324;
- G.scene->r.ffcodecdata.mux_rate = 0;
-
- break;
- case FFMPEG_PRESET_DVD:
- G.scene->r.ffcodecdata.type = FFMPEG_MPEG2;
- G.scene->r.ffcodecdata.video_bitrate = 6000;
- G.scene->r.xsch = 720;
- G.scene->r.ysch = isntsc ? 480 : 576;
- G.scene->r.ffcodecdata.gop_size = isntsc ? 18 : 15;
- G.scene->r.ffcodecdata.rc_max_rate = 9000;
- G.scene->r.ffcodecdata.rc_min_rate = 0;
- G.scene->r.ffcodecdata.rc_buffer_size = 224*8;
- G.scene->r.ffcodecdata.mux_packet_size = 2048;
- G.scene->r.ffcodecdata.mux_rate = 10080000;
-
- break;
- case FFMPEG_PRESET_DV:
- G.scene->r.ffcodecdata.type = FFMPEG_DV;
- G.scene->r.xsch = 720;
- G.scene->r.ysch = isntsc ? 480 : 576;
- break;
- }
-}
-
-static void render_panel_ffmpeg_video(void)
-{
- uiBlock *block;
- int yofs;
- int xcol1;
- int xcol2;
-
- block = uiNewBlock(&curarea->uiblocks, "render_panel_ffmpeg_video",
- UI_EMBOSS, UI_HELV, curarea->win);
-
- uiNewPanelTabbed("Format", "Render");
- if (uiNewPanel(curarea, block, "Video", "Render", 960, 0, 318, 204)== 0)
- return;
-
- if (ffmpeg_preset_sel != 0) {
- set_ffmpeg_preset(ffmpeg_preset_sel);
- ffmpeg_preset_sel = 0;
- allqueue(REDRAWBUTSSCENE, 0);
- }
-
- xcol1 = 872;
- xcol2 = 1002;
-
- yofs = 54;
- uiDefBut(block, LABEL, B_DIFF, "Format", xcol1, yofs+88,
- 110, 20, 0, 0, 0, 0, 0, "");
- uiDefBut(block, LABEL, B_DIFF, "Preset", xcol2, yofs+88,
- 110, 20, 0, 0, 0, 0, 0, "");
- uiDefButI(block, MENU, B_DIFF, ffmpeg_format_pup(),
- xcol1, yofs+66, 110, 20, &G.scene->r.ffcodecdata.type,
- 0,0,0,0, "output file format");
- uiDefButI(block, NUM, B_DIFF, "Bitrate",
- xcol1, yofs+44, 110, 20,
- &G.scene->r.ffcodecdata.video_bitrate,
- 1, 14000, 0, 0, "Video bitrate(kb/s)");
- uiDefButI(block, NUM, B_DIFF, "Min Rate",
- xcol1, yofs+22, 110, 20, &G.scene->r.ffcodecdata.rc_min_rate,
- 0, 14000, 0, 0, "Rate control: min rate(kb/s)");
- uiDefButI(block, NUM, B_DIFF, "Max Rate",
- xcol1, yofs, 110, 20, &G.scene->r.ffcodecdata.rc_max_rate,
- 1, 14000, 0, 0, "Rate control: max rate(kb/s)");
-
- uiDefButI(block, NUM, B_DIFF, "Mux Rate",
- xcol1, yofs-22, 110, 20,
- &G.scene->r.ffcodecdata.mux_rate,
- 0, 100000000, 0, 0, "Mux rate (bits/s(!))");
-
-
- uiDefButI(block, MENU, B_REDR, ffmpeg_preset_pup(),
- xcol2, yofs+66, 110, 20, &ffmpeg_preset_sel,
- 0,0,0,0, "Output file format preset selection");
- uiDefButI(block, NUM, B_DIFF, "GOP Size",
- xcol2, yofs+44, 110, 20, &G.scene->r.ffcodecdata.gop_size,
- 0, 100, 0, 0, "Distance between key frames");
- uiDefButI(block, NUM, B_DIFF, "Buffersize",
- xcol2, yofs+22, 110, 20,
- &G.scene->r.ffcodecdata.rc_buffer_size,
- 0, 2000, 0, 0, "Rate control: buffer size (kb)");
- uiDefButI(block, NUM, B_DIFF, "Mux PSize",
- xcol2, yofs, 110, 20,
- &G.scene->r.ffcodecdata.mux_packet_size,
- 0, 16384, 0, 0, "Mux packet size (byte)");
-
- uiDefButBitI(block, TOG, FFMPEG_AUTOSPLIT_OUTPUT, B_NOP,
- "Autosplit Output",
- xcol2, yofs-22, 110, 20,
- &G.scene->r.ffcodecdata.flags,
- 0, 1, 0,0, "Autosplit output at 2GB boundary.");
-
-
- if (ELEM(G.scene->r.ffcodecdata.type, FFMPEG_AVI, FFMPEG_MOV)) {
- uiDefBut(block, LABEL, 0, "Codec",
- xcol1, yofs-44, 110, 20, 0, 0, 0, 0, 0, "");
- uiDefButI(block, MENU,B_REDR, ffmpeg_codec_pup(),
- xcol1, yofs-66, 110, 20,
- &G.scene->r.ffcodecdata.codec,
- 0,0,0,0, "FFMpeg codec to use");
- }
-}
-
-static void render_panel_ffmpeg_audio(void)
-{
- uiBlock *block;
- int yofs;
- int xcol;
-
- block = uiNewBlock(&curarea->uiblocks, "render_panel_ffmpeg_audio", UI_EMBOSS, UI_HELV, curarea->win);
- uiNewPanelTabbed("Format", "Render");
- if (uiNewPanel(curarea, block, "Audio", "Render", 960, 0, 318, 204) == 0) return;
-
- yofs = 54;
- xcol = 892;
-
- uiDefButBitI(block, TOG, FFMPEG_MULTIPLEX_AUDIO, B_NOP,
- "Multiplex audio", xcol, yofs, 225, 20,
- &G.scene->r.ffcodecdata.flags,
- 0, 1, 0,0, "Interleave audio with the output video");
- uiDefBut(block, LABEL, 0, "Codec",
- xcol, yofs-22, 225, 20, 0, 0, 0, 0, 0, "");
- uiDefButI(block, MENU,B_NOP, ffmpeg_audio_codec_pup(),
- xcol, yofs-44, 225, 20,
- &G.scene->r.ffcodecdata.audio_codec,
- 0,0,0,0, "FFMpeg codec to use");
- uiDefButI(block, NUM, B_DIFF, "Bitrate",
- xcol, yofs-66, 110, 20,
- &G.scene->r.ffcodecdata.audio_bitrate,
- 32, 384, 0, 0, "Audio bitrate(kb/s)");
-}
-#endif
-
-static void render_panel_stamp(void)
-{
- uiBlock *block;
- int yofs=0, xofs=550;
-
- block= uiNewBlock (&curarea->uiblocks, "render_panel_stamp", UI_EMBOSS, UI_HELV, curarea->win);
- uiNewPanelTabbed ("Format", "Render");
- if(uiNewPanel (curarea, block, "Stamp", "Render", 960, 0, 318, 204)==0) return;
-
- if (G.scene->r.scemode & R_STAMP_INFO) {
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, R_STAMP_NOTE, B_REDR, "Note", xofs, yofs, 120, 19, &G.scene->r.stamp, 0, 0, 0, 0, "Stamp user data");
- uiDefBut(block, TEX, B_NOP, "", xofs+120, yofs, 180, 19, &G.scene->r.stamp_udata, 0.0, 128.0, 100, 0, "User Note");
- uiBlockEndAlign(block);
- yofs += 30; /* gap */
-
-
- yofs += 80;
- /* Order is important for alligning ... grr */
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, R_STAMP_FILENAME, B_REDR, "Filename", xofs, yofs, 120, 19, &G.scene->r.stamp, 0, 0, 0, 0, "Stamp blend filename");
- yofs -= 20;
- uiDefButBitI(block, TOG, R_STAMP_SCENE, B_REDR, "Scene", xofs, yofs, 60, 19, &G.scene->r.stamp, 0, 0, 0, 0, "Stamp scene name");
- uiDefButBitI(block, TOG, R_STAMP_CAMERA, B_REDR, "Camera", xofs+60, yofs, 60, 19, &G.scene->r.stamp, 0, 0, 0, 0, "Stamp camera name");
- yofs -= 20;
- uiDefButBitI(block, TOG, R_STAMP_TIME, B_REDR, "Time", xofs, yofs, 60, 19, &G.scene->r.stamp, 0, 0, 0, 0, "Stamp time (HH:MM:SS)");
- uiDefButBitI(block, TOG, R_STAMP_DATE, B_REDR, "Date", xofs+60, yofs, 60, 19, &G.scene->r.stamp, 0, 0, 0, 0, "Stamp date");
- yofs -= 20;
- uiDefButBitI(block, TOG, R_STAMP_FRAME, B_REDR, "Frame", xofs, yofs, 60, 19, &G.scene->r.stamp, 0, 0, 0, 0, "Stamp frame number");
- uiDefButBitI(block, TOG, R_STAMP_MARKER, B_REDR, "Marker", xofs+60, yofs, 60, 19, &G.scene->r.stamp, 0, 0, 0, 0, "Stamp the last marker");
- yofs -= 20;
- uiDefButBitI(block, TOG, R_STAMP_SEQSTRIP, B_REDR, "Sequence Strip", xofs, yofs, 120, 19, &G.scene->r.stamp, 0, 0, 0, 0, "Stamp the forground sequence strip name");
- uiBlockEndAlign(block);
- yofs += 80;
-
- /* draw font selector */
- if (G.scene->r.stamp & R_STAMP_DRAW) {
- uiDefButS(block, MENU, B_REDR, "Stamp Font Size%t|Tiny Text%x1|Small Text%x2|Medium Text%x3|Large Text%x0|Extra Large Text%x4|",
- xofs+130, yofs, 170, 19, &G.scene->r.stamp_font_id, 0, 0, 0, 0, "Choose stamp text size");
-
- /* draw fg/bg next to the scene */
- yofs -= 25;
- uiDefBut(block, LABEL, B_NOP, "Text Color", xofs+130, yofs, 70, 19, 0, 0, 0, 0, 0, "");
- uiDefBut(block, LABEL, B_NOP, "Background", xofs+215, yofs, 70, 19, 0, 0, 0, 0, 0, "");
- yofs -= 20;
- uiDefButF(block, COL, B_NOP, "", xofs+130, yofs, 80, 19, G.scene->r.fg_stamp, 0, 0, 0, 0, "Foreground text color");
- uiDefButF(block, COL, B_NOP, "", xofs+220, yofs, 80, 19, G.scene->r.bg_stamp, 0, 0, 0, 0, "Background color");
- yofs -= 30;
- uiDefButF(block, NUMSLI, B_NOP, "A ", xofs+130, yofs, 170, 19, &G.scene->r.bg_stamp[3], 0, 1.0, 0, 0, "Alpha for text background");
- yofs += 105;
- } else {
- yofs += 30;
- }
-
- uiDefButBitS(block, TOG, R_STAMP_INFO, B_REDR, "Enable Stamp", xofs, yofs, 120, 20, &G.scene->r.scemode, 0, 0, 0, 0, "Disable stamp info in images metadata");
- uiDefButBitI(block, TOG, R_STAMP_DRAW, B_REDR, "Draw Stamp", xofs+130, yofs, 170, 20, &G.scene->r.stamp, 0, 0, 0, 0, "Draw the stamp info into each frame");
- yofs += 20;
- }
- else {
- uiDefButBitS(block, TOG, R_STAMP_INFO, B_REDR, "Enable Stamp", xofs, 142, 120, 20, &G.scene->r.scemode, 0, 0, 0, 0, "Enable stamp info to image metadata");
- yofs += 20;
- uiDefBut(block, LABEL, 0, "", xofs, yofs, 300, 19, 0, 0, 0, 0, 0, "");
- }
-}
-
-static void render_panel_format(void)
-{
- uiBlock *block;
- int yofs;
-
-
- block= uiNewBlock(&curarea->uiblocks, "render_panel_format", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Format", "Render", 960, 0, 318, 204)==0) return;
- uiDefBlockBut(block, framing_render_menu, NULL,
- "Game framing settings",
- 892, 169, 227, 20, "Display game framing settings");
- /* uiDefIconTextBlockBut(block, framing_render_menu, NULL,
- ICON_BLOCKBUT_CORNER,
- "Game framing settings",
- 892, 169, 227, 20,
- "Display game framing settings"); */
-
- uiBlockBeginAlign(block);
- uiDefButS(block, NUM,REDRAWVIEWCAM,"SizeX:", 892 ,136,112,27, &G.scene->r.xsch, 4.0, 10000.0, 0, 0, "The image width in pixels");
- uiDefButS(block, NUM,REDRAWVIEWCAM,"SizeY:", 1007,136,112,27, &G.scene->r.ysch, 4.0,10000.0, 0, 0, "The image height in scanlines");
- uiDefButS(block, NUM,REDRAWVIEWCAM,"AspX:", 892 ,114,112,20, &G.scene->r.xasp, 1.0,200.0, 0, 0, "The horizontal aspect ratio");
- uiDefButS(block, NUM,REDRAWVIEWCAM,"AspY:", 1007,114,112,20, &G.scene->r.yasp, 1.0,200.0, 0, 0, "The vertical aspect ratio");
- uiBlockEndAlign(block);
-
- yofs = 54;
-
-#ifdef __sgi
- yofs = 76;
- uiDefButS(block, NUM,B_DIFF,"MaxSize:", 892,32,165,20, &G.scene->r.maximsize, 0.0, 500.0, 0, 0, "Maximum size per frame to save in an SGI movie");
- uiDefButBitI(block, TOG, R_COSMO, 0,"Cosmo", 1059,32,60,20, &G.scene->r.mode, 0, 0, 0, 0, "Attempt to save SGI movies using Cosmo hardware");
-#endif
-
- uiDefButS(block, MENU,B_FILETYPEMENU,imagetype_pup(), 892,yofs,174,20, &G.scene->r.imtype, 0, 0, 0, 0, "Images are saved in this file format");
- uiDefButBitI(block, TOG, R_CROP, B_DIFF, "Crop", 1068,yofs,51,20, &G.scene->r.mode, 0, 0, 0, 0, "When Border render, the resulting image gets cropped");
-
- yofs -= 22;
-
- if(G.scene->r.quality==0) G.scene->r.quality= 90;
-
-#ifdef WITH_QUICKTIME
- if (G.scene->r.imtype == R_AVICODEC || G.scene->r.imtype == R_QUICKTIME) {
-#else /* WITH_QUICKTIME */
- if (0) {
-#endif
- if(G.scene->r.imtype == R_QUICKTIME) {
-#ifdef WITH_QUICKTIME
-#if defined (_WIN32) || defined (__APPLE__)
- //glColor3f(0.65, 0.65, 0.7);
- //glRecti(892,yofs+46,892+225,yofs+45+20);
- if(G.scene->r.qtcodecdata == NULL)
- uiDefBut(block, LABEL, 0, "Codec: not set", 892,yofs+44,225,20, 0, 0, 0, 0, 0, "");
- else
- uiDefBut(block, LABEL, 0, G.scene->r.qtcodecdata->qtcodecname, 892,yofs+44,225,20, 0, 0, 0, 0, 0, "");
- uiDefBut(block, BUT,B_SELECTCODEC, "Set codec", 892,yofs,74,20, 0, 0, 0, 0, 0, "Set codec settings for Quicktime");
-#endif
-#endif /* WITH_QUICKTIME */
- } else {
-#ifdef _WIN32
- //glColor3f(0.65, 0.65, 0.7);
- //glRecti(892,yofs+46,892+225,yofs+45+20);
- if(G.scene->r.avicodecdata == NULL)
- uiDefBut(block, LABEL, 0, "Codec: not set.", 892,yofs+43,225,20, 0, 0, 0, 0, 0, "");
- else
- uiDefBut(block, LABEL, 0, avicodec_str(), 892,yofs+43,225,20, 0, 0, 0, 0, 0, "");
-#endif
- uiDefBut(block, BUT,B_SELECTCODEC, "Set codec", 892,yofs,74,20, 0, 0, 0, 0, 0, "Set codec settings for AVI");
- }
-#ifdef WITH_OPENEXR
- }
- else if (ELEM(G.scene->r.imtype, R_OPENEXR, R_MULTILAYER)) {
- if (G.scene->r.quality > 5) G.scene->r.quality = 2;
-
- if(G.scene->r.imtype==R_OPENEXR) {
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, R_OPENEXR_HALF, B_NOP,"Half", 892,yofs+44,60,20, &G.scene->r.subimtype, 0, 0, 0, 0, "Use 16 bit floats instead of 32 bit floats per channel");
- uiDefButBitS(block, TOG, R_OPENEXR_ZBUF, B_NOP,"Zbuf", 952,yofs+44,60,20, &G.scene->r.subimtype, 0, 0, 0, 0, "Save the z-depth per pixel (32 bit unsigned int zbuffer)");
- uiBlockEndAlign(block);
- uiDefButBitS(block, TOG, R_PREVIEW_JPG, B_NOP,"Preview",1027,yofs+44,90,20, &G.scene->r.subimtype, 0, 0, 0, 0, "When animation render, save JPG preview images in same directory");
- }
- uiDefButS(block, MENU,B_NOP, "Codec %t|None %x0|Pxr24 (lossy) %x1|ZIP (lossless) %x2|PIZ (lossless) %x3|RLE (lossless) %x4",
- 892,yofs,74,20, &G.scene->r.quality, 0, 0, 0, 0, "Set codec settings for OpenEXR");
-
-#endif
- } else {
- if(G.scene->r.quality < 5) G.scene->r.quality = 90; /* restore from openexr */
-
- uiDefButS(block, NUM,B_DIFF, "Q:", 892,yofs,74,20, &G.scene->r.quality, 10.0, 100.0, 0, 0, "Quality setting for JPEG images, AVI Jpeg and SGI movies");
- }
- uiDefButS(block, NUM,B_FRAMEMAP,"FPS:", 968,yofs,75,20, &G.scene->r.frs_sec, 1.0, 120.0, 100.0, 0, "Frames per second");
- uiDefButF(block, NUM,B_FRAMEMAP,"/", 1043,yofs,75,20, &G.scene->r.frs_sec_base, 1.0, 120.0, 0.1, 3, "Frames per second base");
-
-
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW,B_DIFF,"BW", 892, 10,74,19, &G.scene->r.planes, 5.0,(float)R_PLANESBW, 0, 0, "Images are saved with BW (grayscale) data");
- uiDefButS(block, ROW,B_DIFF,"RGB", 968, 10,74,19, &G.scene->r.planes, 5.0,(float)R_PLANES24, 0, 0, "Images are saved with RGB (color) data");
- uiDefButS(block, ROW,B_DIFF,"RGBA", 1044, 10,75,19, &G.scene->r.planes, 5.0,(float)R_PLANES32, 0, 0, "Images are saved with RGB and Alpha data (if supported)");
-
- uiBlockBeginAlign(block);
- uiDefBut(block, BUT,B_PR_PAL, "PAL", 1146,170,100,18, 0, 0, 0, 0, 0, "Size preset: Image size - 720x576, Aspect ratio - 54x51, 25 fps");
- uiDefBut(block, BUT,B_PR_NTSC, "NTSC", 1146,150,100,18, 0, 0, 0, 0, 0, "Size preset: Image size - 720x480, Aspect ratio - 10x11, 30 fps");
- uiDefBut(block, BUT,B_PR_PRESET, "Default", 1146,130,100,18, 0, 0, 0, 0, 0, "Same as PAL, with render settings (OSA, Shadows, Fields)");
- uiDefBut(block, BUT,B_PR_PRV, "Preview", 1146,110,100,18, 0, 0, 0, 0, 0, "Size preset: Image size - 640x512, Render size 50%");
- uiDefBut(block, BUT,B_PR_PC, "PC", 1146,90,100,18, 0, 0, 0, 0, 0, "Size preset: Image size - 640x480, Aspect ratio - 100x100");
- uiDefBut(block, BUT,B_PR_PAL169, "PAL 16:9",1146,70,100,18, 0, 0, 0, 0, 0, "Size preset: Image size - 720x576, Aspect ratio - 64x45");
- uiDefBut(block, BUT,B_PR_PANO, "PANO", 1146,50,100,18, 0, 0, 0, 0, 0, "Standard panorama settings");
- uiDefBut(block, BUT,B_PR_FULL, "FULL", 1146,30,100,18, 0, 0, 0, 0, 0, "Size preset: Image size - 1280x1024, Aspect ratio - 1x1");
- uiDefBut(block, BUT,B_PR_HD, "HD", 1146,10,100,18, 0, 0, 0, 0, 0, "Size preset: Image size - 1920x1080, Aspect ratio - 1x1");
- uiBlockEndAlign(block);
-}
-
-#ifndef DISABLE_YAFRAY /* disable yafray stuff */
-/* yafray: global illumination options panel */
-static void render_panel_yafrayGI()
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "render_panel_yafrayGI", UI_EMBOSS, UI_HELV, curarea->win);
- uiNewPanelTabbed("Render", "Render");
- if(uiNewPanel(curarea, block, "YafRay GI", "Render", 320, 0, 318, 204)==0) return;
-
- // label to force a boundbox for buttons not to be centered
- uiDefBut(block, LABEL, 0, " ", 305,180,10,10, 0, 0, 0, 0, 0, "");
-
- uiDefBut(block, LABEL, 0, "Method", 5,175,70,20, 0, 1.0, 0, 0, 0, "");
- uiDefButS(block, MENU, B_REDR, "GiMethod %t|None %x0|SkyDome %x1|Full %x2", 70,175,89,20, &G.scene->r.GImethod, 0, 0, 0, 0, "Global Illumination Method");
-
- uiDefBut(block, LABEL, 0, "Quality", 5,150,70,20, 0, 1.0, 0, 0, 0, "");
- uiDefButS(block, MENU, B_REDR, "GiQuality %t|None %x0|Low %x1|Medium %x2 |High %x3|Higher %x4|Best %x5|Use Blender AO settings %x6", 70,150,89,20, &G.scene->r.GIquality, 0, 0, 0, 0, "Global Illumination Quality");
-
- if (G.scene->r.GImethod>0) {
- uiDefButF(block, NUM, B_DIFF, "EmitPwr:", 5,35,154,20, &G.scene->r.GIpower, 0.01, 100.0, 10, 0, "arealight, material emit and background intensity scaling, 1 is normal");
- if (G.scene->r.GImethod==2) uiDefButF(block, NUM, B_DIFF, "GI Pwr:", 5,10,154,20, &G.scene->r.GIindirpower, 0.01, 100.0, 10, 0, "GI indirect lighting intensity scaling, 1 is normal");
- }
-
- if (G.scene->r.GImethod>0)
- {
- if (G.scene->r.GIdepth==0) G.scene->r.GIdepth=2;
-
- if (G.scene->r.GImethod==2) {
- uiDefButI(block, NUM, B_DIFF, "Depth:", 180,175,110,20, &G.scene->r.GIdepth, 1.0, 100.0, 10, 10, "Number of bounces of the indirect light");
- uiDefButI(block, NUM, B_DIFF, "CDepth:", 180,150,110,20, &G.scene->r.GIcausdepth, 1.0, 100.0, 10, 10, "Number of bounces inside objects (for caustics)");
- uiDefButBitS(block, TOG, 1, B_REDR, "Photons",210,125,100,20, &G.scene->r.GIphotons, 0, 0, 0, 0, "Use global photons to help in GI");
- }
-
- uiDefButBitS(block, TOG, 1, B_REDR, "Cache",6,125,95,20, &G.scene->r.GIcache, 0, 0, 0, 0, "Cache occlusion/irradiance samples (faster)");
- if (G.scene->r.GIcache)
- {
- uiDefButBitS(block,TOG, 1, B_REDR, "NoBump",108,125,95,20, &G.scene->r.YF_nobump, 0, 0, 0, 0, "Don't use bumpnormals for cache (faster, but no bumpmapping in total indirectly lit areas)");
- uiDefBut(block, LABEL, 0, "Cache parameters:", 5,105,130,20, 0, 1.0, 0, 0, 0, "");
- if (G.scene->r.GIshadowquality==0.0) G.scene->r.GIshadowquality=0.9;
- uiDefButF(block, NUM, B_DIFF,"ShadQu:", 5,85,154,20, &(G.scene->r.GIshadowquality), 0.01, 1.0 ,1,0, "Sets the shadow quality, keep it under 0.95 :-) ");
- if (G.scene->r.GIpixelspersample==0) G.scene->r.GIpixelspersample=10;
- uiDefButI(block, NUM, B_DIFF, "Prec:", 5,60,75,20, &G.scene->r.GIpixelspersample, 1, 50, 10, 10, "Maximum number of pixels without samples, the lower the better and slower");
- if (G.scene->r.GIrefinement==0) G.scene->r.GIrefinement=1.0;
- uiDefButF(block, NUM, B_DIFF, "Ref:", 84,60,75,20, &G.scene->r.GIrefinement, 0.001, 1.0, 1, 0, "Threshold to refine shadows EXPERIMENTAL. 1 = no refinement");
- }
-
- if (G.scene->r.GImethod==2) {
- if (G.scene->r.GIphotons)
- {
- uiDefBut(block, LABEL, 0, "Photon parameters:", 170,105,130,20, 0, 1.0, 0, 0, 0, "");
- if(G.scene->r.GIphotoncount==0) G.scene->r.GIphotoncount=100000;
- uiDefButI(block, NUM, B_DIFF, "Count:", 170,85,140,20, &G.scene->r.GIphotoncount,
- 0, 10000000, 10, 10, "Number of photons to shoot");
- if(G.scene->r.GIphotonradius==0.0) G.scene->r.GIphotonradius=1.0;
- uiDefButF(block, NUMSLI, B_DIFF,"Radius:", 170,60,140,20, &(G.scene->r.GIphotonradius),
- 0.00001, 100.0 ,0,0, "Radius to search for photons to mix (blur)");
- if(G.scene->r.GImixphotons==0) G.scene->r.GImixphotons=100;
- uiDefButI(block, NUM, B_DIFF, "MixCount:", 170,35,140,20, &G.scene->r.GImixphotons,
- 0, 1000, 10, 10, "Number of photons to mix");
- uiDefButBitS(block, TOG, 1, B_REDR, "Tune Photons",170,10,140,20, &G.scene->r.GIdirect,
- 0, 0, 0, 0, "Show the photonmap directly in the render for tuning");
- }
- }
-
- }
-}
-
-/* yafray: global options panel */
-static void render_panel_yafrayGlobal()
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "render_panel_yafrayGlobal", UI_EMBOSS, UI_HELV, curarea->win);
- uiNewPanelTabbed("Render", "Render");
- if(uiNewPanel(curarea, block, "YafRay", "Render", 320, 0, 318, 204)==0) return;
-
- // label to force a boundbox for buttons not to be centered
- uiDefBut(block, LABEL, 0, " ", 305,180,10,10, 0, 0, 0, 0, 0, "");
-
- uiDefButBitS(block, TOGN, 1, B_REDR, "xml", 5,180,75,20, &G.scene->r.YFexportxml,
- 0, 0, 0, 0, "Export to an xml file and call yafray instead of plugin");
-
- uiDefButF(block, NUMSLI, B_DIFF,"Bi ", 5,35,150,20, &(G.scene->r.YF_raybias),
- 0.0, 10.0 ,0,0, "Shadow ray bias to avoid self shadowing");
- uiDefButI(block, NUM, B_DIFF, "Raydepth ", 5,60,150,20,
- &G.scene->r.YF_raydepth, 1.0, 80.0, 10, 10, "Maximum render ray depth from the camera");
- uiDefButF(block, NUMSLI, B_DIFF, "Gam ", 5,10,150,20, &G.scene->r.YF_gamma, 0.001, 5.0, 0, 0, "Gamma correction, 1 is off");
- uiDefButF(block, NUMSLI, B_DIFF, "Exp ", 160,10,150,20,&G.scene->r.YF_exposure, 0.0, 10.0, 0, 0, "Exposure adjustment, 0 is off");
-
- uiDefButI(block, NUM, B_DIFF, "Processors:", 160,60,150,20, &G.scene->r.YF_numprocs, 1.0, 8.0, 10, 10, "Number of processors to use");
-
- /*AA Settings*/
- uiDefButBitS(block, TOGN, 1, B_REDR, "Auto AA", 5,140,150,20, &G.scene->r.YF_AA,
- 0, 0, 0, 0, "Set AA using OSA and GI quality, disable for manual control");
- uiDefButBitS(block, TOGN, 1, B_DIFF, "Clamp RGB", 160,140,150,20, &G.scene->r.YF_clamprgb, 1.0, 8.0, 10, 10, "For AA on fast high contrast changes. Not advisable for Bokeh! Dulls lens shape detail.");
- if(G.scene->r.YF_AA){
- uiDefButI(block, NUM, B_DIFF, "AA Passes ", 5,115,150,20, &G.scene->r.YF_AApasses, 0, 64, 10, 10, "Number of AA passes (0 is no AA)");
- uiDefButI(block, NUM, B_DIFF, "AA Samples ", 160,115,150,20, &G.scene->r.YF_AAsamples, 0, 2048, 10, 10, "Number of samples per pass");
- uiDefButF(block, NUMSLI, B_DIFF, "Psz ", 5,90,150,20, &G.scene->r.YF_AApixelsize, 1.0, 2.0, 0, 0, "AA pixel filter size");
- uiDefButF(block, NUMSLI, B_DIFF, "Thr ", 160,90,150,20, &G.scene->r.YF_AAthreshold, 0.000001, 1.0, 0, 0, "AA threshold");
- }
-}
-#endif /* disable yafray stuff */
-
-static void layer_copy_func(void *lay_v, void *lay_p)
-{
- unsigned int *lay= lay_p;
- int laybit= (int)lay_v;
-
- if(G.qual & LR_SHIFTKEY) {
- if(*lay==0) *lay= 1<<laybit;
- }
- else
- *lay= 1<<laybit;
-
- copy_view3d_lock(REDRAW);
- allqueue(REDRAWBUTSSCENE, 0);
-}
-
-static void delete_scene_layer_func(void *srl_v, void *act_i)
-{
- if(BLI_countlist(&G.scene->r.layers)>1) {
- long act= (long)act_i;
-
- BLI_remlink(&G.scene->r.layers, srl_v);
- MEM_freeN(srl_v);
- G.scene->r.actlay= 0;
-
- if(G.scene->nodetree) {
- bNode *node;
- for(node= G.scene->nodetree->nodes.first; node; node= node->next) {
- if(node->type==CMP_NODE_R_LAYERS && node->id==NULL) {
- if(node->custom1==act)
- node->custom1= 0;
- else if(node->custom1>act)
- node->custom1--;
- }
- }
- }
- allqueue(REDRAWBUTSSCENE, 0);
- allqueue(REDRAWNODE, 0);
- }
-}
-
-static void rename_scene_layer_func(void *srl_v, void *unused_v)
-{
- if(G.scene->nodetree) {
- SceneRenderLayer *srl= srl_v;
- bNode *node;
- for(node= G.scene->nodetree->nodes.first; node; node= node->next) {
- if(node->type==CMP_NODE_R_LAYERS && node->id==NULL) {
- if(node->custom1==G.scene->r.actlay)
- BLI_strncpy(node->name, srl->name, NODE_MAXSTR);
- }
- }
- }
- allqueue(REDRAWBUTSSCENE, 0);
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWNODE, 0);
-}
-
-static char *scene_layer_menu(void)
-{
- SceneRenderLayer *srl;
- int len= 32 + 32*BLI_countlist(&G.scene->r.layers);
- short a, nr;
- char *str= MEM_callocN(len, "menu layers");
-
- strcpy(str, "ADD NEW %x32767");
- a= strlen(str);
- for(nr=0, srl= G.scene->r.layers.first; srl; srl= srl->next, nr++) {
- if(srl->layflag & SCE_LAY_DISABLE)
- a+= sprintf(str+a, "|%s %%i%d %%x%d", srl->name, ICON_BLANK1, nr);
- else
- a+= sprintf(str+a, "|%s %%i%d %%x%d", srl->name, ICON_CHECKBOX_HLT, nr);
- }
-
- return str;
-}
-
-static void draw_3d_layer_buttons(uiBlock *block, unsigned int *poin, short xco, short yco, short dx, short dy)
-{
- uiBut *bt;
- long a;
-
- uiBlockBeginAlign(block);
- for(a=0; a<5; a++) {
- bt= uiDefButBitI(block, TOG, 1<<a, B_NOP, "", (short)(xco+a*(dx/2)), yco+dy/2, (short)(dx/2), (short)(dy/2), (int *)poin, 0, 0, 0, 0, "");
- uiButSetFunc(bt, layer_copy_func, (void *)a, poin);
- }
- for(a=0; a<5; a++) {
- bt=uiDefButBitI(block, TOG, 1<<(a+10), B_NOP, "", (short)(xco+a*(dx/2)), yco, (short)(dx/2), (short)(dy/2), (int *)poin, 0, 0, 0, 0, "");
- uiButSetFunc(bt, layer_copy_func, (void *)(a+10), poin);
- }
-
- xco+= 7;
- uiBlockBeginAlign(block);
- for(a=5; a<10; a++) {
- bt=uiDefButBitI(block, TOG, 1<<a, B_NOP, "", (short)(xco+a*(dx/2)), yco+dy/2, (short)(dx/2), (short)(dy/2), (int *)poin, 0, 0, 0, 0, "");
- uiButSetFunc(bt, layer_copy_func, (void *)a, poin);
- }
- for(a=5; a<10; a++) {
- bt=uiDefButBitI(block, TOG, 1<<(a+10), B_NOP, "", (short)(xco+a*(dx/2)), yco, (short)(dx/2), (short)(dy/2), (int *)poin, 0, 0, 0, 0, "");
- uiButSetFunc(bt, layer_copy_func, (void *)(a+10), poin);
- }
-
- uiBlockEndAlign(block);
-}
-
-static void render_panel_layers(void)
-{
- uiBlock *block;
- uiBut *bt;
- SceneRenderLayer *srl= BLI_findlink(&G.scene->r.layers, G.scene->r.actlay);
- char *strp;
-
- if(srl==NULL) {
- G.scene->r.actlay= 0;
- srl= G.scene->r.layers.first;
- }
-
- block= uiNewBlock(&curarea->uiblocks, "render_panel_layers", UI_EMBOSS, UI_HELV, curarea->win);
- uiNewPanelTabbed("Output", "Render");
- if(uiNewPanel(curarea, block, "Render Layers", "Render", 320, 0, 318, 204)==0) return;
-
- /* first, as reminder, the scene layers */
- uiDefBut(block, LABEL, 0, "Scene:", 10,170,100,20, NULL, 0, 0, 0, 0, "");
- draw_3d_layer_buttons(block, &G.scene->lay, 130, 170, 35, 30);
-
- /* layer disable, menu, name, delete button */
- uiBlockBeginAlign(block);
- uiDefIconButBitI(block, ICONTOGN, SCE_LAY_DISABLE, B_REDR, ICON_CHECKBOX_HLT-1, 10, 145, 20, 20, &srl->layflag, 0.0, 0.0, 0, 0, "Disable or enable this RenderLayer");
- strp= scene_layer_menu();
- uiDefButS(block, MENU, B_ADD_RENDERLAYER, strp, 30,145,23,20, &(G.scene->r.actlay), 0, 0, 0, 0, "Choose Active Render Layer");
- MEM_freeN(strp);
-
- /* name max 20, exr format limit... */
- bt= uiDefBut(block, TEX, REDRAWNODE, "", 53,145,172,20, srl->name, 0.0, 20.0, 0, 0, "");
- uiButSetFunc(bt, rename_scene_layer_func, srl, NULL);
-
- uiDefButBitS(block, TOG, R_SINGLE_LAYER, B_NOP, "Single", 230,145,60,20, &G.scene->r.scemode, 0, 0, 0, 0, "Only render this layer");
- bt=uiDefIconBut(block, BUT, B_NOP, ICON_X, 285, 145, 25, 20, 0, 0, 0, 0, 0, "Deletes current Render Layer");
- uiButSetFunc(bt, delete_scene_layer_func, srl, (void *)(long)G.scene->r.actlay);
- uiBlockEndAlign(block);
-
- /* RenderLayer visible-layers */
- uiDefBut(block, LABEL, 0, "Layer:", 10,110,100,20, NULL, 0, 0, 0, 0, "");
- draw_3d_layer_buttons(block, &srl->lay, 130,110, 35, 30);
-
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, SCE_LAY_ALL_Z, B_NOP,"AllZ", 10, 85, 40, 20, &srl->layflag, 0, 0, 0, 0, "Fill in Z values for all not-rendered faces, for masking");
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, SCE_LAY_SOLID, B_NOP,"Solid", 50, 85, 45, 20, &srl->layflag, 0, 0, 0, 0, "Render Solid faces in this Layer");
- uiDefButBitI(block, TOG, SCE_LAY_HALO, B_NOP,"Halo", 95, 85, 40, 20, &srl->layflag, 0, 0, 0, 0, "Render Halos in this Layer (on top of Solid)");
- uiDefButBitI(block, TOG, SCE_LAY_ZTRA, B_NOP,"Ztra", 135, 85, 40, 20, &srl->layflag, 0, 0, 0, 0, "Render Z-Transparent faces in this Layer (On top of Solid and Halos)");
- uiDefButBitI(block, TOG, SCE_LAY_SKY, B_NOP,"Sky", 175, 85, 40, 20, &srl->layflag, 0, 0, 0, 0, "Render Sky or backbuffer in this Layer");
- uiDefButBitI(block, TOG, SCE_LAY_EDGE, B_NOP,"Edge", 215, 85, 45, 20, &srl->layflag, 0, 0, 0, 0, "Render Edge-enhance in this Layer (only works for Solid faces)");
- uiDefButBitI(block, TOG, SCE_LAY_STRAND, B_NOP,"Strand",260, 85, 50, 20, &srl->layflag, 0, 0, 0, 0, "Render Strands in this Layer");
-
- uiDefIDPoinBut(block, test_grouppoin_but, ID_GR, B_SET_PASS, "Light:", 10, 65, 150, 20, &(srl->light_override), "Name of Group to use as Lamps instead");
- uiDefIDPoinBut(block, test_matpoin_but, ID_MA, B_SET_PASS, "Mat:", 160, 65, 150, 20, &(srl->mat_override), "Name of Material to use as Materials instead");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, SCE_PASS_COMBINED, B_SET_PASS,"Combined", 10, 30, 80, 20, &srl->passflag, 0, 0, 0, 0, "Deliver full combined RGBA buffer");
- uiDefButBitI(block, TOG, SCE_PASS_Z, B_SET_PASS,"Z", 90, 30, 30, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Z values pass");
- uiDefButBitI(block, TOG, SCE_PASS_VECTOR, B_SET_PASS,"Vec", 120, 30, 40, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Speed Vector pass");
- uiDefButBitI(block, TOG, SCE_PASS_NORMAL, B_SET_PASS,"Nor", 160, 30, 40, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Normal pass");
- uiDefButBitI(block, TOG, SCE_PASS_UV, B_SET_PASS,"UV", 200, 30, 40, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Texture UV pass");
- uiDefButBitI(block, TOG, SCE_PASS_INDEXOB, B_SET_PASS,"IndexOb",240, 30, 70, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Object Index pass");
-
- uiDefButBitI(block, TOG, SCE_PASS_RGBA, B_SET_PASS,"Col", 10, 10, 35, 20, &srl->passflag, 0, 0, 0, 0, "Deliver shade-less Color pass");
- uiDefButBitI(block, TOG, SCE_PASS_DIFFUSE, B_SET_PASS,"Diff", 45, 10, 35, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Diffuse pass");
- uiDefButBitI(block, BUT_TOGDUAL, SCE_PASS_SPEC, B_SET_PASS,"Spec", 80, 10, 40, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Specular pass");
- uiDefButBitI(block, BUT_TOGDUAL, SCE_PASS_SHADOW, B_SET_PASS,"Shad", 120, 10, 40, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Shadow pass");
- uiDefButBitI(block, BUT_TOGDUAL, SCE_PASS_AO, B_SET_PASS,"AO", 160, 10, 30, 20, &srl->passflag, 0, 0, 0, 0, "Deliver AO pass");
- uiDefButBitI(block, BUT_TOGDUAL, SCE_PASS_REFLECT, B_SET_PASS,"Refl", 190, 10, 40, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Raytraced Reflection pass");
- uiDefButBitI(block, BUT_TOGDUAL, SCE_PASS_REFRACT, B_SET_PASS,"Refr", 230, 10, 40, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Raytraced Refraction pass");
- uiDefButBitI(block, BUT_TOGDUAL, SCE_PASS_RADIO, B_SET_PASS,"Rad", 270, 10, 40, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Radiosity pass");
-}
-
-void render_panels()
-{
-
- render_panel_output();
- render_panel_layers();
- render_panel_render();
- render_panel_anim();
- render_panel_bake();
-
- render_panel_format();
- render_panel_stamp();
-#ifdef WITH_FFMPEG
- if (G.scene->r.imtype == R_FFMPEG) {
- render_panel_ffmpeg_video();
- render_panel_ffmpeg_audio();
- }
-#endif
-
-#ifndef DISABLE_YAFRAY
- /* yafray: GI & Global panel, only available when yafray enabled for rendering */
- if (G.scene->r.renderer==R_YAFRAY) {
- if (G.scene->r.YF_gamma==0.0) G.scene->r.YF_gamma=1.0;
- if (G.scene->r.YF_raybias==0.0) G.scene->r.YF_raybias=0.001;
- if (G.scene->r.YF_raydepth==0) G.scene->r.YF_raydepth=5;
- if (G.scene->r.YF_AApixelsize==0.0) G.scene->r.YF_AApixelsize=1.5;
- if (G.scene->r.YF_AAthreshold==0.0) G.scene->r.YF_AAthreshold=0.05;
- if (G.scene->r.GIpower==0.0) G.scene->r.GIpower=1.0;
- if (G.scene->r.GIindirpower==0.0) G.scene->r.GIindirpower=1.0;
- render_panel_yafrayGlobal();
- render_panel_yafrayGI();
- }
-#endif
-
-}
-
-/* --------------------------------------------- */
-
-void anim_panels()
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "anim_panel", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Anim", "Anim", 0, 0, 318, 204)==0) return;
-
- uiBlockBeginAlign(block);
- uiDefButI(block, NUM,B_FRAMEMAP,"Map Old:", 10,160,150,20,&G.scene->r.framapto,1.0,900.0, 0, 0, "Specify old mapping value in frames");
- uiDefButI(block, NUM,B_FRAMEMAP,"Map New:", 160,160,150,20,&G.scene->r.images,1.0,900.0, 0, 0, "Specify how many frames the Map Old will last");
-
- uiBlockBeginAlign(block);
- uiDefButS(block, NUM,B_FRAMEMAP,"FPS:", 10,130,75,20, &G.scene->r.frs_sec, 1.0, 120.0, 100.0, 0, "Frames per second");
- uiDefButF(block, NUM,B_FRAMEMAP,"/", 85,130,75,20, &G.scene->r.frs_sec_base, 1.0, 120.0, 0.1, 3, "Frames per second base");
-
- uiDefButBitS(block, TOG, AUDIO_SYNC, B_SOUND_CHANGED, "Sync",160,130,150,20, &G.scene->audio.flag, 0, 0, 0, 0, "Use sample clock for syncing animation to audio");
-
- uiBlockBeginAlign(block);
- uiDefButI(block, NUM,REDRAWALL,"Sta:", 10,100,150,20,&G.scene->r.sfra,1.0,MAXFRAMEF, 0, 0, "Specify the start frame of the animation");
- uiDefButI(block, NUM,REDRAWALL,"End:", 160,100,150,20,&G.scene->r.efra,1.0,MAXFRAMEF, 0, 0, "Specify the end frame of the animation");
-
- uiBlockBeginAlign(block);
- uiDefButS(block, NUM, REDRAWTIME, "Steps:",10, 70, 150, 20,&(G.scene->jumpframe), 1, 100, 1, 100, "Set spacing between frames changes with up and down arrow keys");
-
-
-}
-
-/* --------------------------------------------- */
-
-void sound_panels()
-{
- bSound *sound;
-
- /* paranoia check */
- sound = G.buts->lockpoin;
- if(sound && GS(sound->id.name)!=ID_SO) {
- sound= NULL;
- G.buts->lockpoin= NULL;
- }
-
- sound_panel_sound(sound);
- sound_panel_listener();
- sound_panel_sequencer();
-}
-
-
-
diff --git a/source/blender/src/buttons_script.c b/source/blender/src/buttons_script.c
deleted file mode 100644
index 52e7be7c93e..00000000000
--- a/source/blender/src/buttons_script.c
+++ /dev/null
@@ -1,384 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <time.h>
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-#include "DNA_action_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_effect_types.h"
-#include "DNA_group_types.h"
-#include "DNA_ID.h"
-#include "DNA_image_types.h"
-#include "DNA_key_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_lattice_types.h"
-#include "DNA_material_types.h"
-#include "DNA_meta_types.h"
-#include "DNA_object_types.h"
-#include "DNA_radio_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_sound_types.h"
-#include "DNA_text_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_vfont_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_world_types.h"
-#include "DNA_space_types.h"
-
-#include "BKE_anim.h"
-#include "BKE_armature.h"
-#include "BKE_constraint.h"
-#include "BKE_curve.h"
-#include "BKE_displist.h"
-#include "BKE_effect.h"
-#include "BKE_font.h"
-#include "BKE_image.h"
-#include "BKE_ipo.h"
-#include "BKE_lattice.h"
-#include "BKE_main.h"
-#include "BKE_material.h"
-#include "BKE_mball.h"
-#include "BKE_mesh.h"
-#include "BKE_object.h"
-#include "BKE_sound.h"
-#include "BKE_texture.h"
-#include "BKE_global.h"
-#include "BKE_utildefines.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_dynstr.h"
-
-#include "BSE_filesel.h"
-
-#include "BIF_gl.h"
-#include "BIF_graphics.h"
-#include "BIF_keyval.h"
-#include "BIF_mainqueue.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_mywindow.h"
-#include "BIF_space.h"
-#include "BIF_glutil.h"
-#include "BIF_interface.h"
-#include "BIF_toolbox.h"
-
-#include "BIF_butspace.h"
-
-#include "mydevice.h"
-#include "blendef.h"
-#include "butspace.h"
-
-/* ************************ function prototypes ********************** */
-void draw_scriptlink(uiBlock *, ScriptLink *, int , int , int ) ;
-
-/* *************************** SCRIPT ******************************** */
-
-static void extend_scriptlink(ScriptLink *slink)
-{
- void *stmp, *ftmp;
-
- if (!slink) return;
-
- stmp= slink->scripts;
- slink->scripts= MEM_mallocN(sizeof(ID*)*(slink->totscript+1), "scriptlistL");
-
- ftmp= slink->flag;
- slink->flag= MEM_mallocN(sizeof(short*)*(slink->totscript+1), "scriptlistF");
-
- if (slink->totscript) {
- memcpy(slink->scripts, stmp, sizeof(ID*)*(slink->totscript));
- MEM_freeN(stmp);
-
- memcpy(slink->flag, ftmp, sizeof(short)*(slink->totscript));
- MEM_freeN(ftmp);
- }
-
- slink->scripts[slink->totscript]= NULL;
- slink->flag[slink->totscript]= SCRIPT_FRAMECHANGED;
-
- slink->totscript++;
- slink->actscript = slink->totscript;
-}
-
-static void delete_scriptlink(ScriptLink *slink)
-{
- int i;
-
- if (!slink) return;
-
- if (slink->totscript>0) {
- for (i=slink->actscript-1; i<slink->totscript-1; i++) {
- slink->flag[i]= slink->flag[i+1];
- slink->scripts[i]= slink->scripts[i+1];
- }
-
- slink->totscript--;
- }
-
- CLAMP(slink->actscript, 1, slink->totscript);
-
- if (slink->totscript==0) {
- if (slink->scripts) MEM_freeN(slink->scripts);
- if (slink->flag) MEM_freeN(slink->flag);
-
- slink->scripts= NULL;
- slink->flag= NULL;
- slink->totscript= slink->actscript= 0;
- }
-}
-
-static char *scriptlinks_menu_string(void)
-{
- char *menu = NULL;
- DynStr *ds = BLI_dynstr_new();
- Text *text = G.main->text.first;
- int txtcounter = 0;
-
- if (text) {
- BLI_dynstr_append(ds, "Select Script Link%t");
- while (text) {
- BLI_dynstr_append(ds, "|");
- BLI_dynstr_append(ds, text->id.name+2);
- txtcounter += 1;
- text = text->id.next;
- }
- if (txtcounter) menu = BLI_dynstr_get_cstring(ds);
- }
- BLI_dynstr_free(ds);
- return menu;
-}
-
-static void scriptlinks_pupmenu(ScriptLink *slink)
-{
- short menuitem;
- char *menustr = scriptlinks_menu_string();
-
- if (!slink) return;
-
- if (menustr) {
- menuitem = pupmenu_col(menustr, 20);
- MEM_freeN(menustr);
- if (menuitem > 0) {
- Text *text = G.main->text.first;
- while (--menuitem) text = text->id.next;
- if (text) slink->scripts[slink->totscript - 1]= (ID *)text;
- }
- }
-}
-
-void do_scriptbuts(unsigned short event)
-{
- Object *ob=NULL;
- ScriptLink *slink=NULL;
- Material *ma;
-
- switch (event) {
- case B_SSCRIPT_ADD:
- slink = &G.scene->scriptlink;
- extend_scriptlink(slink);
- BIF_undo_push("Add scriptlink");
- scriptlinks_pupmenu(slink);
- break;
- case B_SSCRIPT_DEL:
- BIF_undo_push("Delete scriptlink");
- delete_scriptlink(&G.scene->scriptlink);
- break;
-
- case B_SCRIPT_ADD:
- case B_SCRIPT_DEL:
- ob= OBACT;
-
- if (ob && G.buts->scriptblock==ID_OB) {
- slink= &ob->scriptlink;
-
- } else if (ob && G.buts->scriptblock==ID_MA) {
- ma= give_current_material(ob, ob->actcol);
- if (ma) slink= &ma->scriptlink;
-
- } else if (ob && G.buts->scriptblock==ID_CA) {
- if (ob->type==OB_CAMERA)
- slink= &((Camera *)ob->data)->scriptlink;
-
- } else if (ob && G.buts->scriptblock==ID_LA) {
- if (ob->type==OB_LAMP)
- slink= &((Lamp *)ob->data)->scriptlink;
-
- } else if (G.buts->scriptblock==ID_WO) {
- if (G.scene->world)
- slink= &(G.scene->world->scriptlink);
- }
-
- if (event==B_SCRIPT_ADD) {
- extend_scriptlink(slink);
- BIF_undo_push("Add scriptlink");
- scriptlinks_pupmenu(slink);
- }
- else {
- delete_scriptlink(slink);
- BIF_undo_push("Delete scriptlink");
- }
- break;
- default:
- break;
- }
-
- allqueue(REDRAWBUTSSCRIPT, 0);
- allqueue(REDRAWOOPS, 0);
-}
-
-void draw_scriptlink(uiBlock *block, ScriptLink *script, int sx, int sy, int scene)
-{
- char str[256];
-
- if (script->totscript) {
- strcpy(str, "FrameChanged%x 1|");
- strcat(str, "Redraw%x 4|");
- strcat(str, "Render%x 16|");
- if (scene) {
- strcat(str, "OnLoad%x 2|");
- strcat(str, "OnSave%x 8");
- }
- uiBlockBeginAlign(block);
- uiDefButS(block, MENU, 1, str, (short)sx, (short)sy, 140, 19, &script->flag[script->actscript-1], 0, 0, 0, 0, "Script links for this event");
-
- uiDefIDPoinBut(block, test_scriptpoin_but, ID_SCRIPT, 1, "", (short)(sx+140),(short)sy, 140, 19, &script->scripts[script->actscript-1], "Name of Script to link");
- uiBlockEndAlign(block);
- }
-
- sprintf(str,"%d Scr:", script->totscript);
-
- uiDefButS(block, NUM, REDRAWBUTSSCRIPT, str, (short)(sx+140), (short)sy-20,60,19, &script->actscript, 1, script->totscript, 0, 0, "Total / Active Script link (LeftMouse + Drag to change)");
-
- if (scene) {
-
- if (script->totscript<32767)
- uiDefBut(block, BUT, B_SSCRIPT_ADD, "New", (short)(sx+240), (short)sy-20, 40, 19, 0, 0, 0, 0, 0, "Add a new Script link");
- if (script->totscript)
- uiDefBut(block, BUT, B_SSCRIPT_DEL, "Del", (short)(sx+200), (short)sy-20, 40, 19, 0, 0, 0, 0, 0, "Delete the current Script link");
- uiDefBut(block, LABEL, 0, "Scene Script link", sx,sy-20,140,20, 0, 0, 0, 0, 0, "");
- }
- else {
- if (script->totscript<32767)
- uiDefBut(block, BUT, B_SCRIPT_ADD, "New", (short)(sx+240), (short)sy-20, 40, 19, 0, 0, 0, 0, 0, "Add a new Script link");
- if (script->totscript)
- uiDefBut(block, BUT, B_SCRIPT_DEL, "Del", (short)(sx+200), (short)sy-20, 40, 19, 0, 0, 0, 0, 0, "Delete the current Script link");
- uiDefBut(block, LABEL, 0, "Selected Script link", sx,sy-20,140,20, 0, 0, 0, 0, 0, "");
-
- }
-
-}
-
-/* ************************************* */
-
-static void script_panel_scriptlink(void)
-{
- uiBlock *block;
- Object *ob=NULL;
- ScriptLink *script=NULL;
- Material *ma;
- int xco = 10;
-
- block= uiNewBlock(&curarea->uiblocks, "script_panel_scriptlink", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Scriptlinks", "Script", 0, 0, 318, 204)==0) return;
-
- uiDefButBitI(block, TOG, G_DOSCRIPTLINKS, REDRAWBUTSSCRIPT,
- "Enable Script Links", xco, 200, 150, 20, &G.f, 0, 0, 0, 0,
- "Enable execution of all assigned Script links and Space Handelers");
- /* for proper alignment: */
- uiDefBut(block, LABEL, 0, "", 160, 200,150,20, NULL, 0.0, 0.0, 0, 0, "");
-
- if (G.f & G_DOSCRIPTLINKS) {
- //uiBlockBeginAlign(block);
- ob= OBACT;
- if(ob)
- uiDefIconButS(block, ROW, B_REDR, ICON_OBJECT, xco,175,25,20, &G.buts->scriptblock, 2.0, (float)ID_OB, 0, 0, "Displays Object script links");
-
- if(ob && give_current_material(ob, ob->actcol))
- uiDefIconButS(block, ROW, B_REDR, ICON_MATERIAL, xco+=25,175,25,20, &G.buts->scriptblock, 2.0, (float)ID_MA, 0, 0, "Displays Material script links ");
-
- if(G.scene->world)
- uiDefIconButS(block, ROW, B_REDR, ICON_WORLD, xco+=25,175,25,20, &G.buts->scriptblock, 2.0, (float)ID_WO, 0, 0, "Displays World script links");
-
- if(ob && ob->type==OB_CAMERA)
- uiDefIconButS(block, ROW, B_REDR, ICON_CAMERA, xco+=25,175,25,20, &G.buts->scriptblock, 2.0, (float)ID_CA, 0, 0, "Displays Camera script links");
-
- if(ob && ob->type==OB_LAMP)
- uiDefIconButS(block, ROW, B_REDR, ICON_LAMP, xco+=25,175,25,20, &G.buts->scriptblock, 2.0, (float)ID_LA, 0, 0, "Displays Lamp script links");
- //uiBlockEndAlign(block);
-
- if (ob && G.buts->scriptblock==ID_OB) {
- script= &ob->scriptlink;
-
- } else if (ob && G.buts->scriptblock==ID_MA) {
- ma= give_current_material(ob, ob->actcol);
- if (ma) script= &ma->scriptlink;
-
- } else if (ob && G.buts->scriptblock==ID_CA) {
- if (ob->type==OB_CAMERA)
- script= &((Camera *)ob->data)->scriptlink;
-
- } else if (ob && G.buts->scriptblock==ID_LA) {
- if (ob->type==OB_LAMP)
- script= &((Lamp *)ob->data)->scriptlink;
-
- } else if (G.buts->scriptblock==ID_WO) {
- if (G.scene->world)
- script= &(G.scene->world->scriptlink);
- }
-
- if (script) draw_scriptlink(block, script, 10, 140, 0);
-
- draw_scriptlink(block, &G.scene->scriptlink, 10, 80, 1);
- }
-}
-
-
-
-
-void script_panels()
-{
- script_panel_scriptlink();
-
-}
diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c
deleted file mode 100644
index ad1afcc0608..00000000000
--- a/source/blender/src/buttons_shading.c
+++ /dev/null
@@ -1,4372 +0,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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: not all of this file anymore. :)
- *
- * Contributor(s):
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include <time.h>
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "IMB_imbuf_types.h"
-#include "IMB_imbuf.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_brush_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_customdata_types.h"
-#include "DNA_image_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_material_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_object_types.h"
-#include "DNA_node_types.h"
-#include "DNA_packedFile_types.h"
-#include "DNA_particle_types.h"
-#include "DNA_radio_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_world_types.h"
-
-#include "BKE_colortools.h"
-#include "BKE_depsgraph.h"
-#include "BKE_displist.h"
-#include "BKE_effect.h"
-#include "BKE_global.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
-#include "BKE_node.h"
-#include "BKE_material.h"
-#include "BKE_particle.h"
-#include "BKE_utildefines.h"
-#include "BKE_texture.h"
-
-#include "BKE_packedFile.h"
-#include "BKE_plugin_types.h"
-#include "BKE_image.h"
-
-#include "BLI_blenlib.h"
-#include "BMF_Api.h"
-
-#include "BSE_filesel.h"
-#include "BSE_headerbuttons.h"
-#include "BSE_node.h"
-
-#include "BDR_drawmesh.h"
-
-#include "BIF_drawimage.h"
-#include "BIF_gl.h"
-#include "BIF_graphics.h"
-#include "BIF_keyval.h"
-#include "BIF_mainqueue.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_mywindow.h"
-#include "BIF_space.h"
-#include "BIF_glutil.h"
-#include "BIF_imasel.h"
-#include "BIF_interface.h"
-#include "BIF_toolbox.h"
-#include "BIF_space.h"
-#include "BIF_previewrender.h"
-#include "BIF_butspace.h"
-#include "BIF_writeimage.h"
-#include "BIF_toets.h"
-
-#include "mydevice.h"
-#include "blendef.h"
-#include "radio.h"
-
-#include "RE_pipeline.h"
-
-/* -----includes for this file specific----- */
-
-#include "butspace.h" // own module
-
-
-static MTex emptytex;
-static int packdummy = 0;
-
-static char *mapto_blendtype_pup(void)
-{
- static char formatstr[] = "|%s %%x%d";
- static char string[1024];
- char *str = string;
-
- str += sprintf(str, formatstr, "Mix", MTEX_BLEND);
-
- str += sprintf(str, formatstr, "Add", MTEX_ADD);
- str += sprintf(str, formatstr, "Subtract", MTEX_SUB);
-
- str += sprintf(str, formatstr, "Multiply", MTEX_MUL);
- str += sprintf(str, formatstr, "Screen", MTEX_SCREEN);
- str += sprintf(str, formatstr, "Overlay", MTEX_OVERLAY);
-
- str += sprintf(str, formatstr, "Difference", MTEX_DIFF);
- str += sprintf(str, formatstr, "Divide", MTEX_DIV);
-
- str += sprintf(str, formatstr, "Darken", MTEX_DARK);
- str += sprintf(str, formatstr, "Lighten", MTEX_LIGHT);
-
- return string;
-}
-
-void shade_buttons_change_3d(void)
-{
- Object *ob= OBACT;
- ScrArea *sa;
-
- if(ob==NULL) return;
-
- for(sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- if(sa->spacetype==SPACE_VIEW3D) {
- View3D *v3d= sa->spacedata.first;
-
- if(v3d->drawtype >= OB_SOLID) addqueue(sa->win, REDRAW, 0);
- if(v3d->drawtype == OB_SHADED) {
- if(ob->type==OB_LAMP) reshadeall_displist();
- else {
- /* all objects using material */
- Base *base= FIRSTBASE;
- Material *ma= give_current_material(ob, ob->actcol);
- int a;
-
- while(base) {
- if(base->lay & G.vd->lay) {
- for(a=1; a<=ob->totcol; a++) {
- if(ma == give_current_material(base->object, a)) {
- freedisplist(&(base->object->disp));
- break;
- }
- }
- }
- base= base->next;
- }
- }
- }
- }
- }
-}
-
-/* *************************** TEXTURE ******************************** */
-
-static void load_image_cb(char *str, void *ima_pp_v, void *iuser_v) /* called from fileselect or button */
-{
- Image **ima_pp= (Image **)ima_pp_v;
- Image *ima= NULL;
-
- ima= BKE_add_image_file(str);
- if(ima) {
- if(*ima_pp) {
- (*ima_pp)->id.us--;
- }
- *ima_pp= ima;
-
- BKE_image_signal(ima, iuser_v, IMA_SIGNAL_RELOAD);
-
- /* button event gets lost when it goes via filewindow */
- if(G.buts && G.buts->lockpoin) {
- Tex *tex= G.buts->lockpoin;
- if(GS(tex->id.name)==ID_TE) {
- BIF_preview_changed(ID_TE);
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWOOPS, 0);
- }
- }
- }
-
- BIF_undo_push("Load image");
-}
-
-static void load_plugin_tex(char *str, void *tex_v, void *unused) /* called from fileselect */
-{
- Tex *tex= tex_v;
-
- if(tex->type!=TEX_PLUGIN) return;
-
- if(tex->plugin) free_plugin_tex(tex->plugin);
-
- tex->stype= 0;
- tex->plugin= add_plugin_tex(str);
-
- allqueue(REDRAWBUTSSHADING, 0);
- BIF_preview_changed(ID_TE);
-}
-
-static void save_env(char *name)
-{
- Tex *tex;
- char str[FILE_MAX];
-
- strcpy(str, name);
- BLI_convertstringcode(str, G.sce, G.scene->r.cfra);
- tex= G.buts->lockpoin;
-
- if(tex && GS(tex->id.name)==ID_TE) {
- if(tex->env && tex->env->ok && saveover(str)) {
- waitcursor(1);
- BIF_save_envmap(tex->env, str);
- strcpy(G.ima, name);
- waitcursor(0);
- }
- }
-
-}
-
-static int vergcband(const void *a1, const void *a2)
-{
- const CBData *x1=a1, *x2=a2;
-
- if( x1->pos > x2->pos ) return 1;
- else if( x1->pos < x2->pos) return -1;
- return 0;
-}
-
-void do_texbuts(unsigned short event)
-{
- Tex *tex;
- ScrArea *sa;
- char str[FILE_MAX];
-
- tex= G.buts->lockpoin;
-
- switch(event) {
- case B_TEXPRV:
- BIF_preview_changed(ID_TE);
- allqueue(REDRAWBUTSSHADING, 0);
-
- if(tex && G.scene->nodetree) {
- NodeTagIDChanged(G.scene->nodetree, &tex->id);
- allqueue(RECALC_COMPOSITE, 0);
- }
- break;
- case B_TEXCHANNEL:
- scrarea_queue_headredraw(curarea);
- BIF_preview_changed(ID_TE);
- allqueue(REDRAWBUTSSHADING, 0);
- if(G.buts->texfrom == 3) /* brush texture */
- allqueue(REDRAWIMAGE, 0);
- break;
- case B_TEXTYPE:
- if(tex==NULL) return;
- tex->stype= 0;
- allqueue(REDRAWBUTSSHADING, 0);
- BIF_preview_changed(ID_TE);
-
- if(tex && G.scene->nodetree) {
- NodeTagIDChanged(G.scene->nodetree, &tex->id);
- allqueue(RECALC_COMPOSITE, 0);
- }
- break;
- case B_DEFTEXVAR:
- if(tex==NULL) return;
- default_tex(tex);
- BIF_undo_push("Default texture vars");
- allqueue(REDRAWBUTSSHADING, 0);
- BIF_preview_changed(ID_TE);
- break;
-
- case B_IMAGECHANGED:
- BIF_preview_changed(ID_TE);
- allqueue(REDRAWBUTSSHADING, 0);
-
- if(tex) {
- if(G.scene->nodetree) {
- NodeTagIDChanged(G.scene->nodetree, &tex->id);
- allqueue(RECALC_COMPOSITE, 0);
- }
- if(tex->ima && (tex->imaflag & TEX_MIPMAP) && (tex->ima->flag & IMA_FIELDS)) {
- error("Cannot combine fields and mipmap");
- tex->imaflag -= TEX_MIPMAP;
- }
- if(tex->env)
- BKE_free_envmapdata(tex->env);
- }
-
- break;
-
- case B_TEXREDR_PRV:
- allqueue(REDRAWBUTSSHADING, 0);
- BIF_preview_changed(ID_TE);
- shade_buttons_change_3d();
- break;
-
-
- case B_LOADPLUGIN:
- if(tex==NULL) return;
-
- sa= closest_bigger_area();
- areawinset(sa->win);
- if(tex->plugin) strcpy(str, tex->plugin->name);
- else {
- strcpy(str, U.plugtexdir);
- }
- activate_fileselect_args(FILE_SPECIAL, "SELECT PLUGIN", str, load_plugin_tex, tex, NULL);
-
- break;
-
- case B_NAMEPLUGIN:
- if(tex==NULL || tex->plugin==NULL) return;
- strcpy(str, tex->plugin->name);
- free_plugin_tex(tex->plugin);
- tex->stype= 0;
- tex->plugin= add_plugin_tex(str);
- allqueue(REDRAWBUTSSHADING, 0);
- BIF_preview_changed(ID_TE);
- break;
-
- case B_COLORBAND:
- if(tex==NULL) return;
- if(tex->coba==NULL) tex->coba= add_colorband(0);
- allqueue(REDRAWBUTSSHADING, 0);
- BIF_preview_changed(ID_TE); // also ramps, so we do this
- break;
-
- case B_ENV_DELETE:
- if(tex->env) {
- BKE_free_envmap(tex->env);
- tex->env= 0;
- allqueue(REDRAWBUTSSHADING, 0);
- BIF_preview_changed(ID_TE);
- }
- break;
- case B_ENV_FREE:
- if(tex->env) {
- BKE_free_envmapdata(tex->env);
- allqueue(REDRAWBUTSSHADING, 0);
- BIF_preview_changed(ID_TE);
- }
- break;
- case B_ENV_FREE_ALL:
- tex= G.main->tex.first;
- while(tex) {
- if(tex->id.us && tex->type==TEX_ENVMAP) {
- if(tex->env) {
- if(tex->env->stype!=ENV_LOAD) BKE_free_envmapdata(tex->env);
- }
- }
- tex= tex->id.next;
- }
- allqueue(REDRAWBUTSSHADING, 0);
- BIF_preview_changed(ID_TE);
- break;
- case B_ENV_SAVE:
- if(tex->env && tex->env->ok) {
- if(tex->env->type==ENV_PLANE) {
- notice("Sorry, not implemented yet");
- }
- else {
- sa= closest_bigger_area();
- areawinset(sa->win);
- save_image_filesel_str(str);
- activate_fileselect(FILE_SPECIAL, str, G.ima, save_env);
- }
- }
- break;
- case B_ENV_OB:
- if(tex->env && tex->env->object) {
- BIF_preview_changed(ID_TE);
- if ELEM(tex->env->object->type, OB_CAMERA, OB_LAMP) {
- error("Camera or Lamp not allowed");
- tex->env->object= NULL;
- }
- }
- break;
-
- default:
- if(event>=B_PLUGBUT && event<=B_PLUGBUT+23) {
- PluginTex *pit= tex->plugin;
- if(pit && pit->callback) {
- pit->callback(event - B_PLUGBUT);
- BIF_preview_changed(ID_TE);
- allqueue(REDRAWBUTSSHADING, 0);
- }
- }
- }
-}
-
-static void texture_panel_plugin(Tex *tex)
-{
- uiBlock *block;
- VarStruct *varstr;
- PluginTex *pit;
- short xco, yco, a;
-
- block= uiNewBlock(&curarea->uiblocks, "texture_panel_plugin", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Plugin", "Texture", 640, 0, 318, 204)==0) return;
- uiSetButLock(tex->id.lib!=0, ERROR_LIBDATA_MESSAGE);
-
- if(tex->plugin && tex->plugin->doit) {
-
- pit= tex->plugin;
-
- for(a=0; a<pit->stypes; a++) {
- uiDefButS(block, ROW, B_TEXREDR_PRV, pit->stnames+16*a, (76*a), 152, 75, 20, &tex->stype, 2.0, (float)a, 0, 0, "");
- }
-
- varstr= pit->varstr;
- if(varstr) {
- for(a=0; a<pit->vars; a++, varstr++) {
- xco= 140*(a/6)+1;
- yco= 125 - 20*(a % 6)+1;
- uiDefBut(block, varstr->type, B_PLUGBUT+a, varstr->name, xco,yco,137,19, &(pit->data[a]), varstr->min, varstr->max, 100, 0, varstr->tip);
- }
- }
- uiDefBut(block, TEX, B_NAMEPLUGIN, "", 0,180,318,24, pit->name, 0.0, 159.0, 0, 0, "");
- }
-
- uiDefBut(block, BUT, B_LOADPLUGIN, "Load Plugin", 0,204,137,24, 0, 0, 0, 0, 0, "");
-
-}
-
-
-static void texture_panel_magic(Tex *tex)
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "texture_panel_magic", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Magic", "Texture", 640, 0, 318, 204)==0) return;
- uiSetButLock(tex->id.lib!=0, ERROR_LIBDATA_MESSAGE);
-
- uiBlockBeginAlign(block);
- uiDefButS(block, NUM, B_TEXPRV, "Depth:", 10, 90, 150, 19, &tex->noisedepth, 0.0, 10.0, 0, 0, "Sets the depth of the pattern");
- uiDefButF(block, NUM, B_TEXPRV, "Turbulence:", 10, 70, 150, 19, &tex->turbul, 0.0, 200.0, 10, 0, "Sets the strength of the pattern");
-}
-
-static void texture_panel_blend(Tex *tex)
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "texture_panel_blend", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Blend", "Texture", 640, 0, 318, 204)==0) return;
- uiSetButLock(tex->id.lib!=0, ERROR_LIBDATA_MESSAGE);
-
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW, B_TEXPRV, "Lin", 10, 180, 75, 19, &tex->stype, 2.0, (float)TEX_LIN, 0, 0, "Creates a linear progresion");
- uiDefButS(block, ROW, B_TEXPRV, "Quad", 85, 180, 75, 19, &tex->stype, 2.0, (float)TEX_QUAD, 0, 0, "Creates a quadratic progression");
- uiDefButS(block, ROW, B_TEXPRV, "Ease", 160, 180, 75, 19, &tex->stype, 2.0, (float)TEX_EASE, 0, 0, "Creates a progression easing from one step to the next");
- uiDefButBitS(block, TOG, TEX_FLIPBLEND, B_TEXPRV, "Flip XY", 235, 180, 75, 19, &tex->flag, 0, 0, 0, 0, "Flips the direction of the progression 90 degrees");
-
- uiDefButS(block, ROW, B_TEXPRV, "Diag", 10, 160, 75, 19, &tex->stype, 2.0, (float)TEX_DIAG, 0, 0, "Use a diagonal progression");
- uiDefButS(block, ROW, B_TEXPRV, "Sphere", 85, 160, 75, 19, &tex->stype, 2.0, (float)TEX_SPHERE, 0, 0, "Use progression with the shape of a sphere");
- uiDefButS(block, ROW, B_TEXPRV, "Halo", 160, 160, 75, 19, &tex->stype, 2.0, (float)TEX_HALO, 0, 0, "Use a quadratic progression with the shape of a sphere");
- uiDefButS(block, ROW, B_TEXPRV, "Radial", 235, 160, 75, 19, &tex->stype, 2.0, (float)TEX_RAD, 0, 0, "Use a polar progression");
-
-}
-
-/* newnoise: noisebasis menu string */
-static char* noisebasis_menu()
-{
- static char nbmenu[256];
- sprintf(nbmenu, "Noise Basis %%t|Blender Original %%x%d|Original Perlin %%x%d|Improved Perlin %%x%d|Voronoi F1 %%x%d|Voronoi F2 %%x%d|Voronoi F3 %%x%d|Voronoi F4 %%x%d|Voronoi F2-F1 %%x%d|Voronoi Crackle %%x%d|CellNoise %%x%d", TEX_BLENDER, TEX_STDPERLIN, TEX_NEWPERLIN, TEX_VORONOI_F1, TEX_VORONOI_F2, TEX_VORONOI_F3, TEX_VORONOI_F4, TEX_VORONOI_F2F1, TEX_VORONOI_CRACKLE, TEX_CELLNOISE);
- return nbmenu;
-}
-
-static void texture_panel_wood(Tex *tex)
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "texture_panel_wood", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Wood", "Texture", 640, 0, 318, 204)==0) return;
- uiSetButLock(tex->id.lib!=0, ERROR_LIBDATA_MESSAGE);
-
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW, B_TEXPRV, "Bands", 10, 180, 75, 18, &tex->stype, 2.0, (float)TEX_BAND, 0, 0, "Uses standard wood texture in bands");
- uiDefButS(block, ROW, B_TEXPRV, "Rings", 85, 180, 75, 18, &tex->stype, 2.0, (float)TEX_RING, 0, 0, "Uses wood texture in rings");
- uiDefButS(block, ROW, B_TEXPRV, "BandNoise", 160, 180, 75, 18, &tex->stype, 2.0, (float)TEX_BANDNOISE, 0, 0, "Adds noise to standard wood");
- uiDefButS(block, ROW, B_TEXPRV, "RingNoise", 235, 180, 75, 18, &tex->stype, 2.0, (float)TEX_RINGNOISE, 0, 0, "Adds noise to rings");
-
- uiDefButS(block, ROW, B_TEXPRV, "Sin", 10, 160, 50, 19, &tex->noisebasis2, 8.0, (float)TEX_SIN, 0, 0, "Uses a sine wave to produce bands");
- uiDefButS(block, ROW, B_TEXPRV, "Saw", 60, 160, 50, 19, &tex->noisebasis2, 8.0, (float)TEX_SAW, 0, 0, "Uses a saw wave to produce bands");
- uiDefButS(block, ROW, B_TEXPRV, "Tri", 110, 160, 50, 19, &tex->noisebasis2, 8.0, (float)TEX_TRI, 0, 0, "Uses a triangle wave to produce bands");
- uiDefButS(block, ROW, B_TEXPRV, "Soft noise", 160, 160, 75, 19, &tex->noisetype, 12.0, (float)TEX_NOISESOFT, 0, 0, "Generates soft noise");
- uiDefButS(block, ROW, B_TEXPRV, "Hard noise", 235, 160, 75, 19, &tex->noisetype, 12.0, (float)TEX_NOISEPERL, 0, 0, "Generates hard noise");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_TEXPRV, "NoiseSize :", 10, 130, 150, 19, &tex->noisesize, 0.0001, 2.0, 10, 0, "Sets scaling for noise input");
- uiDefButF(block, NUM, B_TEXPRV, "Turbulence:", 160, 130, 150, 19, &tex->turbul, 0.0, 200.0, 10, 0, "Sets the turbulence of the bandnoise and ringnoise types");
- uiBlockEndAlign(block);
-
- /* newnoise: noisebasis menu */
- uiDefBut(block, LABEL, 0, "Noise Basis", 10, 30, 150, 19, 0, 0.0, 0.0, 0, 0, "");
- uiDefButS(block, MENU, B_TEXPRV, noisebasis_menu(), 10, 10, 150, 19, &tex->noisebasis, 0,0,0,0, "Sets the noise basis used for turbulence");
- uiDefButF(block, NUM, B_NOP, "Nabla: ", 160, 10, 150, 19, &tex->nabla, 0.001, 0.1, 1, 0, "Defines size of derivative offset used for calculating normal");
-
-}
-
-static void texture_panel_stucci(Tex *tex)
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "texture_panel_stucci", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Stucci", "Texture", 640, 0, 318, 204)==0) return;
- uiSetButLock(tex->id.lib!=0, ERROR_LIBDATA_MESSAGE);
-
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW, B_TEXPRV, "Plastic", 10, 180, 100, 19, &tex->stype, 2.0, (float)TEX_PLASTIC, 0, 0, "Uses standard stucci");
- uiDefButS(block, ROW, B_TEXPRV, "Wall In", 110, 180, 100, 19, &tex->stype, 2.0, (float)TEX_WALLIN, 0, 0, "Creates Dimples");
- uiDefButS(block, ROW, B_TEXPRV, "Wall Out", 210, 180, 100, 19, &tex->stype, 2.0, (float)TEX_WALLOUT, 0, 0, "Creates Ridges");
-
- uiDefButS(block, ROW, B_TEXPRV, "Soft noise", 10, 160, 150, 19, &tex->noisetype, 12.0, (float)TEX_NOISESOFT, 0, 0, "Generates soft noise");
- uiDefButS(block, ROW, B_TEXPRV, "Hard noise", 160, 160, 150, 19, &tex->noisetype, 12.0, (float)TEX_NOISEPERL, 0, 0, "Generates hard noise");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_TEXPRV, "NoiseSize :", 10, 110, 150, 19, &tex->noisesize, 0.0001, 2.0, 10, 0, "Sets scaling for noise input");
- uiDefButF(block, NUM, B_TEXPRV, "Turbulence:", 10, 90, 150, 19, &tex->turbul, 0.0, 200.0, 10, 0, "Sets the depth of the stucci");
- uiBlockEndAlign(block);
-
- /* newnoise: noisebasis menu */
- uiDefBut(block, LABEL, 0, "Noise Basis", 10, 30, 150, 19, 0, 0.0, 0.0, 0, 0, "");
- uiDefButS(block, MENU, B_TEXPRV, noisebasis_menu(), 10, 10, 150, 19, &tex->noisebasis, 0,0,0,0, "Sets the noise basis used for turbulence");
- // note, nabla not supported here!
-// uiDefButF(block, NUM, B_NOP, "Nabla: ", 160, 10, 150, 19, &tex->nabla, 0.001, 0.1, 1, 0, "Defines size of derivative offset used for calculating normal");
-
-}
-
-static void texture_panel_marble(Tex *tex)
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "texture_panel_marble", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Marble", "Texture", 640, 0, 318, 204)==0) return;
- uiSetButLock(tex->id.lib!=0, ERROR_LIBDATA_MESSAGE);
-
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW, B_TEXPRV, "Soft", 10, 180, 100, 18, &tex->stype, 2.0, (float)TEX_SOFT, 0, 0, "Uses soft marble");
- uiDefButS(block, ROW, B_TEXPRV, "Sharp", 110, 180, 100, 18, &tex->stype, 2.0, (float)TEX_SHARP, 0, 0, "Uses more clearly defined marble");
- uiDefButS(block, ROW, B_TEXPRV, "Sharper", 210, 180, 100, 18, &tex->stype, 2.0, (float)TEX_SHARPER, 0, 0, "Uses very clearly defined marble");
-
- uiDefButS(block, ROW, B_TEXPRV, "Soft noise", 10, 160, 150, 19, &tex->noisetype, 12.0, (float)TEX_NOISESOFT, 0, 0, "Generates soft noise");
- uiDefButS(block, ROW, B_TEXPRV, "Hard noise", 160, 160, 150, 19, &tex->noisetype, 12.0, (float)TEX_NOISEPERL, 0, 0, "Generates hard noise");
-
- uiDefButS(block, ROW, B_TEXPRV, "Sin", 10, 140, 100, 18, &tex->noisebasis2, 8.0, 0.0, 0, 0, "Uses a sine wave to produce bands.");
- uiDefButS(block, ROW, B_TEXPRV, "Saw", 110, 140, 100, 18, &tex->noisebasis2, 8.0, 1.0, 0, 0, "Uses a saw wave to produce bands");
- uiDefButS(block, ROW, B_TEXPRV, "Tri", 210, 140, 100, 18, &tex->noisebasis2, 8.0, 2.0, 0, 0, "Uses a triangle wave to produce bands");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_TEXPRV, "NoiseSize :", 10, 110, 150, 19, &tex->noisesize, 0.0001, 2.0, 10, 0, "Sets scaling for noise input");
- uiDefButS(block, NUM, B_TEXPRV, "NoiseDepth:", 10, 90, 150, 19, &tex->noisedepth, 0.0, 6.0, 0, 0, "Sets the depth of the marble calculation");
- uiDefButF(block, NUM, B_TEXPRV, "Turbulence:", 10, 70, 150, 19, &tex->turbul, 0.0, 200.0, 10, 0, "Sets the turbulence of the sine bands");
- uiBlockEndAlign(block);
-
- /* newnoise: noisebasis menu */
- uiDefBut(block, LABEL, 0, "Noise Basis", 10, 30, 150, 19, 0, 0.0, 0.0, 0, 0, "");
- uiDefButS(block, MENU, B_TEXPRV, noisebasis_menu(), 10, 10, 150, 19, &tex->noisebasis, 0,0,0,0, "Sets the noise basis used for turbulence");
- uiDefButF(block, NUM, B_NOP, "Nabla: ", 160, 10, 150, 19, &tex->nabla, 0.001, 0.1, 1, 0, "Defines size of derivative offset used for calculating normal");
-
-}
-
-static void texture_panel_clouds(Tex *tex)
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "texture_panel_clouds", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Clouds", "Texture", 640, 0, 318, 204)==0) return;
- uiSetButLock(tex->id.lib!=0, ERROR_LIBDATA_MESSAGE);
-
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW, B_TEXPRV, "Default", 10, 180, 70, 18, &tex->stype, 2.0, (float)TEX_DEFAULT, 0, 0, "Uses standard noise");
- uiDefButS(block, ROW, B_TEXPRV, "Color", 80, 180, 70, 18, &tex->stype, 2.0, (float)TEX_COLOR, 0, 0, "Lets Noise return RGB value");
- uiDefButS(block, ROW, B_TEXPRV, "Soft noise", 155, 180, 75, 18, &tex->noisetype, 12.0, (float)TEX_NOISESOFT, 0, 0, "Generates soft noise");
- uiDefButS(block, ROW, B_TEXPRV, "Hard noise", 230, 180, 80, 18, &tex->noisetype, 12.0, (float)TEX_NOISEPERL, 0, 0, "Generates hard noise");
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_TEXPRV, "NoiseSize :", 10, 130, 150, 19, &tex->noisesize, 0.0001, 2.0, 10, 0, "Sets scaling for noise input");
- uiDefButS(block, NUM, B_TEXPRV, "NoiseDepth:", 160, 130, 150, 19, &tex->noisedepth, 0.0, 6.0, 0, 0, "Sets the depth of the cloud calculation");
- uiBlockEndAlign(block);
-
- /* newnoise: noisebasis menu */
- uiDefBut(block, LABEL, 0, "Noise Basis", 10, 30, 150, 19, 0, 0.0, 0.0, 0, 0, "");
- uiDefButS(block, MENU, B_TEXPRV, noisebasis_menu(), 10, 10, 150, 19, &tex->noisebasis, 0,0,0,0, "Sets the noise basis used for turbulence");
- uiDefButF(block, NUM, B_NOP, "Nabla: ", 160, 10, 150, 19, &tex->nabla, 0.001, 0.1, 1, 0, "Defines size of derivative offset used for calculating normal");
-
-}
-
-/*****************************************/
-/* newnoise: panel(s) for musgrave types */
-/*****************************************/
-
-static void texture_panel_musgrave(Tex *tex)
-{
- uiBlock *block;
- char *str;
-
- block= uiNewBlock(&curarea->uiblocks, "texture_panel_musgrave", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Musgrave", "Texture", 640, 0, 318, 204)==0) return;
- uiSetButLock(tex->id.lib!=0, ERROR_LIBDATA_MESSAGE);
-
- /* TEX_MFRACTAL, TEX_RIDGEDMF, TEX_HYBRIDMF, TEX_FBM, TEX_HTERRAIN */
- str= "Multifractal %x0|Ridged Multifractal %x1|Hybrid Multifractal %x2|Hetero Terrain %x4|fBm %x3";
- uiDefButS(block, MENU, B_TEXREDR_PRV, str, 10, 160, 150, 19, &tex->stype, 0.0, 0.0, 0, 0, "Sets Musgrave type");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_TEXPRV, "H: ", 10, 130, 150, 19, &tex->mg_H, 0.0001, 2.0, 10, 0, "Sets the highest fractal dimension");
- uiDefButF(block, NUMSLI, B_TEXPRV, "Lacu: ", 160, 130, 150, 19, &tex->mg_lacunarity, 0.0, 6.0, 10, 0, "Sets the gap between succesive frequencies");
- uiDefButF(block, NUMSLI, B_TEXPRV, "Octs: ", 10, 110, 150, 19, &tex->mg_octaves, 0.0, 8.0, 10, 0, "Sets the number of frequencies used");
- if ((tex->stype==TEX_RIDGEDMF) || (tex->stype==TEX_HYBRIDMF) || (tex->stype==TEX_HTERRAIN)) {
- uiDefButF(block, NUMSLI, B_TEXPRV, "Ofst: ", 160, 110, 150, 19, &tex->mg_offset, 0.0, 6.0, 10, 0, "Sets the fractal offset");
- if ((tex->stype==TEX_RIDGEDMF) || (tex->stype==TEX_HYBRIDMF))
- uiDefButF(block, NUMSLI, B_TEXPRV, "Gain: ", 10, 90, 150, 19, &tex->mg_gain, 0.0, 6.0, 10, 0, "Sets the gain multiplier");
- }
-
- uiBlockBeginAlign(block);
- /* noise output scale */
- uiDefButF(block, NUM, B_TEXPRV, "iScale: ", 10, 60, 150, 19, &tex->ns_outscale, 0.0, 10.0, 10, 0, "Scales intensity output");
- /* frequency scale */
- uiDefButF(block, NUM, B_TEXPRV, "NoiseSize: ", 160, 60, 150, 19, &tex->noisesize, 0.0001, 2.0, 10, 0, "Sets scaling for noise input");
- uiBlockEndAlign(block);
-
- /* noisebasis menu */
- uiDefBut(block, LABEL, 0, "Noise Basis", 10, 30, 150, 19, 0, 0.0, 0.0, 0, 0, "");
- uiDefButS(block, MENU, B_TEXPRV, noisebasis_menu(), 10, 10, 150, 19, &tex->noisebasis, 0,0,0,0, "Sets the noise basis used for turbulence");
- uiDefButF(block, NUM, B_NOP, "Nabla: ", 160, 10, 150, 19, &tex->nabla, 0.001, 0.1, 1, 0, "Defines size of derivative offset used for calculating normal");
-
-}
-
-
-static void texture_panel_distnoise(Tex *tex)
-{
- uiBlock *block;
- block= uiNewBlock(&curarea->uiblocks, "texture_panel_distnoise", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Distorted Noise", "Texture", 640, 0, 318, 204)==0) return;
- uiSetButLock(tex->id.lib!=0, ERROR_LIBDATA_MESSAGE);
-
- uiBlockBeginAlign(block);
- /* distortion amount */
- uiDefButF(block, NUM, B_TEXPRV, "DistAmnt: ", 10, 130, 150, 19, &tex->dist_amount, 0.0, 10.0, 10, 0, "Sets amount of distortion");
- /* frequency scale */
- uiDefButF(block, NUM, B_TEXPRV, "NoiseSize: ", 160, 130, 150, 19, &tex->noisesize, 0.0001, 2.0, 10, 0, "Sets scaling for noise input");
- uiBlockEndAlign(block);
-
- uiDefBut(block, LABEL, 0, "Distortion Noise", 10, 100, 150, 19, 0, 0.0, 0.0, 0, 0, "");
- uiDefBut(block, LABEL, 0, "Noise Basis", 160, 100, 150, 19, 0, 0.0, 0.0, 0, 0, "");
-
- uiBlockBeginAlign(block);
- /* noisebasis used for the distortion */
- uiDefButS(block, MENU, B_TEXPRV, noisebasis_menu(), 10, 80, 150, 19, &tex->noisebasis, 0,0,0,0, "Sets the noise basis which does the distortion");
- /* noisebasis to distort */
- uiDefButS(block, MENU, B_TEXPRV, noisebasis_menu(), 160, 80, 150, 19, &tex->noisebasis2, 0,0,0,0, "Sets the noise basis to distort");
- uiBlockEndAlign(block);
-
- uiDefButF(block, NUM, B_NOP, "Nabla: ", 10, 50, 150, 19, &tex->nabla, 0.001, 0.1, 1, 0, "Defines size of derivative offset used for calculating normal");
-}
-
-
-static void texture_panel_voronoi(Tex *tex)
-{
- char dm_menu[256];
- uiBlock *block;
- block= uiNewBlock(&curarea->uiblocks, "texture_panel_voronoi", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Voronoi", "Texture", 640, 0, 318, 204)==0) return;
- uiSetButLock(tex->id.lib!=0, ERROR_LIBDATA_MESSAGE);
-
- /* color types */
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW, B_TEXPRV, "Int", 10, 180, 75, 18, &tex->vn_coltype, 1.0, 0.0, 0, 0, "Only calculate intensity");
- uiDefButS(block, ROW, B_TEXPRV, "Col1", 85, 180, 75, 18, &tex->vn_coltype, 1.0, 1.0, 0, 0, "Color cells by position");
- uiDefButS(block, ROW, B_TEXPRV, "Col2", 160, 180, 75, 18, &tex->vn_coltype, 1.0, 2.0, 0, 0, "Same as Col1 + outline based on F2-F1");
- uiDefButS(block, ROW, B_TEXPRV, "Col3", 235, 180, 75, 18, &tex->vn_coltype, 1.0, 3.0, 0, 0, "Same as Col2 * intensity");
- uiBlockEndAlign(block);
-
- /* distance metric */
- sprintf(dm_menu, "Distance Metric %%t|Actual Distance %%x%d|Distance Squared %%x%d|Manhattan %%x%d|Chebychev %%x%d|Minkovsky 1/2 %%x%d|Minkovsky 4 %%x%d|Minkovsky %%x%d", TEX_DISTANCE, TEX_DISTANCE_SQUARED, TEX_MANHATTAN, TEX_CHEBYCHEV, TEX_MINKOVSKY_HALF, TEX_MINKOVSKY_FOUR, TEX_MINKOVSKY);
- uiDefBut(block, LABEL, B_TEXPRV, "Distance Metric", 10, 160, 150, 19, 0, 0, 0, 0, 0, "");
- uiDefButS(block, MENU, B_TEXPRV, dm_menu, 10, 140, 150, 19, &tex->vn_distm, 0,0,0,0, "Sets the distance metric to be used");
-
- if (tex->vn_distm==TEX_MINKOVSKY)
- uiDefButF(block, NUMSLI, B_TEXPRV, "Exp: ", 10, 120, 150, 19, &tex->vn_mexp, 0.01, 10.0, 10, 0, "Sets minkovsky exponent");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_TEXPRV, "iScale: ", 160, 140, 150, 19, &tex->ns_outscale, 0.01, 10.0, 10, 0, "Scales intensity output");
- uiDefButF(block, NUM, B_TEXPRV, "Size: ", 160, 120, 150, 19, &tex->noisesize, 0.0001, 2.0, 10, 0, "Sets scaling for noise input");
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_NOP, "Nabla: ", 160, 70, 150, 19, &tex->nabla, 0.001, 0.1, 1, 0, "Defines size of derivative offset used for calculating normal");
-
- /* weights */
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_TEXPRV, "W1: ", 10, 70, 150, 19, &tex->vn_w1, -2.0, 2.0, 10, 0, "Sets feature weight 1");
- uiDefButF(block, NUMSLI, B_TEXPRV, "W2: ", 10, 50, 150, 19, &tex->vn_w2, -2.0, 2.0, 10, 0, "Sets feature weight 2");
- uiDefButF(block, NUMSLI, B_TEXPRV, "W3: ", 10, 30, 150, 19, &tex->vn_w3, -2.0, 2.0, 10, 0, "Sets feature weight 3");
- uiDefButF(block, NUMSLI, B_TEXPRV, "W4: ", 10, 10, 150, 19, &tex->vn_w4, -2.0, 2.0, 10, 0, "Sets feature weight 4");
-}
-
-
-static char *layer_menu(RenderResult *rr, short *curlay)
-{
- RenderLayer *rl;
- int len= 64 + 32*BLI_countlist(&rr->layers);
- short a, nr= 0;
- char *str= MEM_callocN(len, "menu layers");
-
- strcpy(str, "Layer %t");
- a= strlen(str);
-
- /* compo result */
- if(rr->rectf) {
- a+= sprintf(str+a, "|Composite %%x0");
- nr= 1;
- }
- for(rl= rr->layers.first; rl; rl= rl->next, nr++) {
- a+= sprintf(str+a, "|%s %%x%d", rl->name, nr);
- }
-
- if(*curlay >= nr)
- *curlay= 0;
-
- return str;
-}
-
-/* rl==NULL means composite result */
-static char *pass_menu(RenderLayer *rl, short *curpass)
-{
- RenderPass *rpass;
- int len= 64 + 32*(rl?BLI_countlist(&rl->passes):1);
- short a, nr= 0;
- char *str= MEM_callocN(len, "menu layers");
-
- strcpy(str, "Pass %t");
- a= strlen(str);
-
- /* rendered results don't have a Combined pass */
- if(rl==NULL || rl->rectf) {
- a+= sprintf(str+a, "|Combined %%x0");
- nr= 1;
- }
-
- if(rl)
- for(rpass= rl->passes.first; rpass; rpass= rpass->next, nr++)
- a+= sprintf(str+a, "|%s %%x%d", rpass->name, nr);
-
- if(*curpass >= nr)
- *curpass= 0;
-
- return str;
-}
-
-static void set_frames_cb(void *ima_v, void *iuser_v)
-{
- Image *ima= ima_v;
- ImageUser *iuser= iuser_v;
-
- if(ima->anim) {
- iuser->frames = IMB_anim_get_duration(ima->anim);
- BKE_image_user_calc_imanr(iuser, G.scene->r.cfra, 0);
- }
-}
-
-static void image_src_change_cb(void *ima_v, void *iuser_v)
-{
- BKE_image_signal(ima_v, iuser_v, IMA_SIGNAL_SRC_CHANGE);
-}
-
-/* buttons have 2 arg callbacks, filewindow has 3 args... so thats why the wrapper below */
-static void image_browse_cb1(char *unused, void *ima_pp_v, void *iuser_v)
-{
- Image **ima_pp= (Image **)ima_pp_v;
- ImageUser *iuser= iuser_v;
-
- if(ima_pp) {
- Image *ima= *ima_pp;
-
- if(iuser->menunr== -2) {
- activate_databrowse_args(&ima->id, ID_IM, 0, &iuser->menunr, image_browse_cb1, ima_pp, iuser);
- }
- else if (iuser->menunr>0) {
- Image *newima= (Image*) BLI_findlink(&G.main->image, iuser->menunr-1);
-
- if (newima && newima!=ima) {
- *ima_pp= newima;
- id_us_plus(&newima->id);
- if(ima) ima->id.us--;
-
- BKE_image_signal(newima, iuser, IMA_SIGNAL_USER_NEW_IMAGE);
-
- BIF_undo_push("Browse image");
- }
- }
- }
-}
-
-static void image_browse_cb(void *ima_pp_v, void *iuser_v)
-{
- image_browse_cb1(NULL, ima_pp_v, iuser_v);
-}
-
-static void image_reload_cb(void *ima_v, void *iuser_v)
-{
- if(ima_v) {
- BKE_image_signal(ima_v, iuser_v, IMA_SIGNAL_RELOAD);
- }
-}
-
-static void image_field_test(void *ima_v, void *iuser_v)
-{
- Image *ima= ima_v;
-
- if(ima) {
- ImBuf *ibuf= BKE_image_get_ibuf(ima, iuser_v);
- if(ibuf) {
- short nr= 0;
- if( !(ima->flag & IMA_FIELDS) && (ibuf->flags & IB_fields) ) nr= 1;
- if( (ima->flag & IMA_FIELDS) && !(ibuf->flags & IB_fields) ) nr= 1;
- if(nr) {
- BKE_image_signal(ima, iuser_v, IMA_SIGNAL_FREE);
- }
- }
- }
-}
-
-static void image_unlink_cb(void *ima_pp_v, void *unused)
-{
- Image **ima_pp= (Image **)ima_pp_v;
-
- if(ima_pp && *ima_pp) {
- Image *ima= *ima_pp;
- ima->id.us--;
- *ima_pp= NULL;
- }
-}
-
-static void image_load_fs_cb(void *ima_pp_v, void *iuser_v)
-{
- Image **ima_pp= (Image **)ima_pp_v;
- ScrArea *sa;
- char *name;
-
- if(ima_pp==NULL) return;
-
- sa= closest_bigger_area();
- areawinset(sa->win);
- if(*ima_pp) name= (*ima_pp)->name;
-#ifdef _WIN32
- else {
- if (strcmp (U.textudir, "/") == 0)
- name= G.sce;
- else
- name= U.textudir;
- }
-#else
- else name = U.textudir;
-#endif
- if (G.qual & LR_CTRLKEY) {
- activate_imageselect_args(FILE_SPECIAL, "SELECT IMAGE", name, load_image_cb, ima_pp_v, iuser_v);
- }
- else {
- activate_fileselect_args(FILE_SPECIAL, "SELECT IMAGE", name, load_image_cb, ima_pp_v, iuser_v);
- }
-}
-
-/* 5 layer button callbacks... */
-static void image_multi_cb(void *rr_v, void *iuser_v)
-{
- BKE_image_multilayer_index(rr_v, iuser_v);
-}
-static void image_multi_inclay_cb(void *rr_v, void *iuser_v)
-{
- RenderResult *rr= rr_v;
- ImageUser *iuser= iuser_v;
- int tot= BLI_countlist(&rr->layers) + (rr->rectf?1:0); /* fake compo result layer */
- if(iuser->layer<tot-1)
- iuser->layer++;
- BKE_image_multilayer_index(rr, iuser);
-}
-static void image_multi_declay_cb(void *rr_v, void *iuser_v)
-{
- ImageUser *iuser= iuser_v;
- if(iuser->layer>0)
- iuser->layer--;
- BKE_image_multilayer_index(rr_v, iuser);
-}
-static void image_multi_incpass_cb(void *rr_v, void *iuser_v)
-{
- RenderResult *rr= rr_v;
- ImageUser *iuser= iuser_v;
- RenderLayer *rl= BLI_findlink(&rr->layers, iuser->layer);
- if(rl) {
- int tot= BLI_countlist(&rl->passes) + (rl->rectf?1:0); /* builtin render result has no combined pass in list */
- if(iuser->pass<tot-1) {
- iuser->pass++;
- BKE_image_multilayer_index(rr, iuser);
- }
- }
-}
-static void image_multi_decpass_cb(void *rr_v, void *iuser_v)
-{
- ImageUser *iuser= iuser_v;
- if(iuser->pass>0) {
- iuser->pass--;
- BKE_image_multilayer_index(rr_v, iuser);
- }
-}
-
-static void image_pack_cb(void *ima_v, void *iuser_v)
-{
- if(ima_v) {
- Image *ima= ima_v;
- if(ima->source!=IMA_SRC_SEQUENCE && ima->source!=IMA_SRC_MOVIE) {
- if (ima->packedfile) {
- if (G.fileflags & G_AUTOPACK) {
- if (okee("Disable AutoPack ?")) {
- G.fileflags &= ~G_AUTOPACK;
- }
- }
-
- if ((G.fileflags & G_AUTOPACK) == 0) {
- unpackImage(ima, PF_ASK);
- BIF_undo_push("Unpack image");
- }
- }
- else {
- ImBuf *ibuf= BKE_image_get_ibuf(ima, iuser_v);
- if (ibuf && (ibuf->userflags & IB_BITMAPDIRTY)) {
- error("Can't pack painted image. Save image or use Repack as PNG.");
- } else {
- ima->packedfile = newPackedFile(ima->name);
- BIF_undo_push("Pack image");
- }
- }
- }
- }
-}
-
-static void image_load_cb(void *ima_pp_v, void *iuser_v)
-{
- if(ima_pp_v) {
- Image *ima= *((Image **)ima_pp_v);
- ImBuf *ibuf= BKE_image_get_ibuf(ima, iuser_v);
- char str[FILE_MAX];
-
- /* name in ima has been changed by button! */
- BLI_strncpy(str, ima->name, FILE_MAX);
- if(ibuf) BLI_strncpy(ima->name, ibuf->name, FILE_MAX);
-
- load_image_cb(str, ima_pp_v, iuser_v);
- }
-}
-
-static void image_freecache_cb(void *ima_v, void *unused)
-{
- BKE_image_free_anim_ibufs(ima_v, G.scene->r.cfra);
- allqueue(REDRAWIMAGE, 0);
-}
-
-static void image_generated_change_cb(void *ima_v, void *iuser_v)
-{
- BKE_image_signal(ima_v, iuser_v, IMA_SIGNAL_FREE);
-}
-
-static void image_user_change(void *iuser_v, void *unused)
-{
- BKE_image_user_calc_imanr(iuser_v, G.scene->r.cfra, 0);
-}
-
-void uiblock_layer_pass_buttons(uiBlock *block, RenderResult *rr, ImageUser *iuser, int event, int x, int y, int w)
-{
- uiBut *but;
- RenderLayer *rl= NULL;
- int wmenu1, wmenu2;
- char *strp;
-
- /* layer menu is 1/3 larger than pass */
- wmenu1= (3*w)/5;
- wmenu2= (2*w)/5;
-
- /* menu buts */
- strp= layer_menu(rr, &iuser->layer);
- but= uiDefButS(block, MENU, event, strp, x, y, wmenu1, 20, &iuser->layer, 0,0,0,0, "Select Layer");
- uiButSetFunc(but, image_multi_cb, rr, iuser);
- MEM_freeN(strp);
-
- rl= BLI_findlink(&rr->layers, iuser->layer - (rr->rectf?1:0)); /* fake compo layer, return NULL is meant to be */
- strp= pass_menu(rl, &iuser->pass);
- but= uiDefButS(block, MENU, event, strp, x+wmenu1, y, wmenu2, 20, &iuser->pass, 0,0,0,0, "Select Pass");
- uiButSetFunc(but, image_multi_cb, rr, iuser);
- MEM_freeN(strp);
-}
-
-static void uiblock_layer_pass_arrow_buttons(uiBlock *block, RenderResult *rr, ImageUser *iuser, int imagechanged)
-{
- uiBut *but;
-
- if(rr==NULL || iuser==NULL)
- return;
- if(rr->layers.first==NULL) {
- uiDefBut(block, LABEL, 0, "No Layers in Render Result,", 10, 107, 300, 20, NULL, 1, 0, 0, 0, "");
- return;
- }
-
- uiBlockBeginAlign(block);
-
- /* decrease, increase arrows */
- but= uiDefIconBut(block, BUT, imagechanged, ICON_TRIA_LEFT, 10,107,17,20, NULL, 0, 0, 0, 0, "Previous Layer");
- uiButSetFunc(but, image_multi_declay_cb, rr, iuser);
- but= uiDefIconBut(block, BUT, imagechanged, ICON_TRIA_RIGHT, 27,107,18,20, NULL, 0, 0, 0, 0, "Next Layer");
- uiButSetFunc(but, image_multi_inclay_cb, rr, iuser);
-
- uiblock_layer_pass_buttons(block, rr, iuser, imagechanged, 45, 107, 230);
-
- /* decrease, increase arrows */
- but= uiDefIconBut(block, BUT, imagechanged, ICON_TRIA_LEFT, 275,107,17,20, NULL, 0, 0, 0, 0, "Previous Pass");
- uiButSetFunc(but, image_multi_decpass_cb, rr, iuser);
- but= uiDefIconBut(block, BUT, imagechanged, ICON_TRIA_RIGHT, 292,107,18,20, NULL, 0, 0, 0, 0, "Next Pass");
- uiButSetFunc(but, image_multi_incpass_cb, rr, iuser);
-
- uiBlockEndAlign(block);
-
-}
-
-/* The general Image panel with the loadsa callbacks! */
-void uiblock_image_panel(uiBlock *block, Image **ima_pp, ImageUser *iuser,
- short redraw, short imagechanged)
-{
- Image *ima= *ima_pp;
- uiBut *but;
- char str[128], *strp;
-
- /* different stuff when we show viewer */
- if(ima && ima->source==IMA_SRC_VIEWER) {
- ImBuf *ibuf= BKE_image_get_ibuf(ima, iuser);
-
- image_info(ima, ibuf, str);
- uiDefBut(block, LABEL, 0, ima->id.name+2, 10, 180, 300, 20, NULL, 1, 0, 0, 0, "");
- uiDefBut(block, LABEL, 0, str, 10, 160, 300, 20, NULL, 1, 0, 0, 0, "");
-
- if(ima->type==IMA_TYPE_COMPOSITE) {
- iuser= ntree_get_active_iuser(G.scene->nodetree);
- if(iuser) {
- uiBlockBeginAlign(block);
- uiDefIconTextBut(block, BUT, B_SIMA_RECORD, ICON_REC, "Record", 10,120,100,20, 0, 0, 0, 0, 0, "");
- uiDefIconTextBut(block, BUT, B_SIMA_PLAY, ICON_PLAY, "Play", 110,120,100,20, 0, 0, 0, 0, 0, "");
- but= uiDefBut(block, BUT, B_NOP, "Free Cache", 210,120,100,20, 0, 0, 0, 0, 0, "");
- uiButSetFunc(but, image_freecache_cb, ima, NULL);
-
- if(iuser->frames)
- sprintf(str, "(%d) Frames:", iuser->framenr);
- else strcpy(str, "Frames:");
- uiBlockBeginAlign(block);
- uiDefButI(block, NUM, imagechanged, str, 10, 90,150, 20, &iuser->frames, 0.0, MAXFRAMEF, 0, 0, "Sets the number of images of a movie to use");
- uiDefButI(block, NUM, imagechanged, "StartFr:", 160,90,150,20, &iuser->sfra, 1.0, MAXFRAMEF, 0, 0, "Sets the global starting frame of the movie");
- }
- }
- else if(ima->type==IMA_TYPE_R_RESULT) {
- /* browse layer/passes */
- uiblock_layer_pass_arrow_buttons(block, RE_GetResult(RE_GetRender(G.scene->id.name)), iuser, imagechanged);
- }
- return;
- }
-
- /* the main ima source types */
- if(ima) {
- uiSetButLock(ima->id.lib!=NULL, ERROR_LIBDATA_MESSAGE);
- uiBlockBeginAlign(block);
- uiBlockSetFunc(block, image_src_change_cb, ima, iuser);
- uiDefButS(block, ROW, imagechanged, "Still", 10, 180, 60, 20, &ima->source, 0.0, IMA_SRC_FILE, 0, 0, "Single Image file");
- uiDefButS(block, ROW, imagechanged, "Movie", 70, 180, 60, 20, &ima->source, 0.0, IMA_SRC_MOVIE, 0, 0, "Movie file");
- uiDefButS(block, ROW, imagechanged, "Sequence", 130, 180, 90, 20, &ima->source, 0.0, IMA_SRC_SEQUENCE, 0, 0, "Multiple Image files, as a sequence");
- uiDefButS(block, ROW, imagechanged, "Generated", 220, 180, 90, 20, &ima->source, 0.0, IMA_SRC_GENERATED, 0, 0, "Generated Image");
- uiBlockSetFunc(block, NULL, NULL, NULL);
- }
- else
- uiDefBut(block, LABEL, 0, " ", 10, 180, 300, 20, 0, 0, 0, 0, 0, ""); /* for align in panel */
-
- /* Browse */
- IMAnames_to_pupstring(&strp, NULL, NULL, &(G.main->image), NULL, &iuser->menunr);
-
- uiBlockBeginAlign(block);
- but= uiDefButS(block, MENU, imagechanged, strp, 10,155,23,20, &iuser->menunr, 0, 0, 0, 0, "Selects an existing Image or Movie");
- uiButSetFunc(but, image_browse_cb, ima_pp, iuser);
-
- MEM_freeN(strp);
-
- /* name + options, or only load */
- if(ima) {
- int drawpack= (ima->source!=IMA_SRC_SEQUENCE && ima->source!=IMA_SRC_MOVIE && ima->ok);
-
- but= uiDefBut(block, TEX, B_IDNAME, "IM:", 33, 155, 177, 20, ima->id.name+2, 0.0, 21.0, 0, 0, "Current Image Datablock name.");
- uiButSetFunc(but, test_idbutton_cb, ima->id.name, NULL);
- but= uiDefBut(block, BUT, imagechanged, "Reload", 210, 155, 60, 20, NULL, 0, 0, 0, 0, "Reloads Image or Movie");
- uiButSetFunc(but, image_reload_cb, ima, iuser);
-
- but= uiDefIconBut(block, BUT, imagechanged, ICON_X, 270,155,20,20, 0, 0, 0, 0, 0, "Unlink Image block");
- uiButSetFunc(but, image_unlink_cb, ima_pp, NULL);
- sprintf(str, "%d", ima->id.us);
- uiDefBut(block, BUT, B_NOP, str, 290,155,20,20, 0, 0, 0, 0, 0, "Only displays number of users of Image block");
-
- but= uiDefIconBut(block, BUT, imagechanged, ICON_FILESEL, 10, 135, 23, 20, 0, 0, 0, 0, 0, "Open Fileselect to load new Image");
- uiButSetFunc(but, image_load_fs_cb, ima_pp, iuser);
- but= uiDefBut(block, TEX, imagechanged, "", 33,135,257+(drawpack?0:20),20, ima->name, 0.0, 239.0, 0, 0, "Image/Movie file name, change to load new");
- uiButSetFunc(but, image_load_cb, ima_pp, iuser);
-
- if(drawpack) {
- if (ima->packedfile) packdummy = 1;
- else packdummy = 0;
- but= uiDefIconButBitI(block, TOG, 1, redraw, ICON_PACKAGE, 290,135,20,20, &packdummy, 0, 0, 0, 0, "Toggles Packed status of this Image");
- uiButSetFunc(but, image_pack_cb, ima, iuser);
- }
-
- }
- else {
- but= uiDefBut(block, BUT, imagechanged, "Load", 33, 155, 100,20, NULL, 0, 0, 0, 0, "Load new Image of Movie");
- uiButSetFunc(but, image_load_fs_cb, ima_pp, iuser);
- }
- uiBlockEndAlign(block);
-
- if(ima) {
- ImBuf *ibuf= BKE_image_get_ibuf(ima, iuser);
-
- /* check for re-render, only buttons */
- if(imagechanged==B_IMAGECHANGED) {
- if(iuser->flag & IMA_ANIM_REFRESHED) {
- iuser->flag &= ~IMA_ANIM_REFRESHED;
- BIF_preview_changed(ID_TE);
- }
- }
-
- /* multilayer? */
- if(ima->type==IMA_TYPE_MULTILAYER && ima->rr) {
- uiblock_layer_pass_arrow_buttons(block, ima->rr, iuser, imagechanged);
- }
- else {
- image_info(ima, ibuf, str);
- uiDefBut(block, LABEL, 0, str, 10, 112, 300, 20, NULL, 1, 0, 0, 0, "");
- }
-
- /* exception, let's do because we only use this panel 3 times in blender... but not real good code! */
- if( (FACESEL_PAINT_TEST) && G.sima && &G.sima->iuser==iuser)
- return;
- /* left side default per-image options, right half the additional options */
-
- /* fields */
- uiBlockBeginAlign(block);
- but= uiDefButBitS(block, TOG, IMA_FIELDS, imagechanged, "Fields", 10, 90, 65, 20, &ima->flag, 0, 0, 0, 0, "Click to enable use of fields in Image");
- uiButSetFunc(but, image_field_test, ima, iuser);
- uiDefButBitS(block, TOG, IMA_STD_FIELD, B_NOP, "Odd", 75, 90, 45, 20, &ima->flag, 0, 0, 0, 0, "Standard Field Toggle");
-
- uiBlockSetFunc(block, image_reload_cb, ima, iuser);
- uiDefButBitS(block, TOG, IMA_ANTIALI, B_NOP, "Anti", 10, 70, 45, 20, &ima->flag, 0, 0, 0, 0, "Toggles Image anti-aliasing, only works with solid colors");
- uiDefButBitS(block, TOG, IMA_DO_PREMUL, imagechanged, "Premul", 55, 70, 65, 20, &ima->flag, 0, 0, 0, 0, "Toggles premultiplying alpha");
- uiBlockEndAlign(block);
-
- if( ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
- sprintf(str, "(%d) Frames:", iuser->framenr);
-
- uiBlockBeginAlign(block);
- uiBlockSetFunc(block, image_user_change, iuser, NULL);
- uiDefButBitS(block, TOG, IMA_ANIM_ALWAYS, B_NOP, "Auto Refresh", 120, 90, 190, 20, &iuser->flag, 0, 0, 0, 0, "Always refresh Image on frame changes");
-
- if(ima->anim) {
- uiDefButI(block, NUM, imagechanged, str, 120, 70,170, 20, &iuser->frames, 0.0, MAXFRAMEF, 0, 0, "Sets the number of images of a movie to use");
- but= uiDefBut(block, BUT, redraw, "<", 290, 70, 20, 20, 0, 0, 0, 0, 0, "Copies number of frames in movie file to Frames: button");
- uiButSetFunc(but, set_frames_cb, ima, iuser);
- }
- else
- uiDefButI(block, NUM, imagechanged, str, 120, 70,190, 20, &iuser->frames, 0.0, MAXFRAMEF, 0, 0, "Sets the number of images of a movie to use");
-
- uiDefButI(block, NUM, imagechanged, "Offs:", 120,50,100,20, &iuser->offset, -MAXFRAMEF, MAXFRAMEF, 0, 0, "Offsets the number of the frame to use in the animation");
- uiDefButS(block, NUM, imagechanged, "Fie/Ima:", 220,50,90,20, &iuser->fie_ima, 1.0, 200.0, 0, 0, "The number of fields per rendered frame (2 fields is 1 image)");
-
- uiDefButI(block, NUM, imagechanged, "StartFr:", 120,30,100,20, &iuser->sfra, 1.0, MAXFRAMEF, 0, 0, "Sets the global starting frame of the movie");
- uiDefButS(block, TOG, imagechanged, "Cyclic", 220,30,90,20, &iuser->cycl, 0.0, 1.0, 0, 0, "Cycle the images in the movie");
-
- uiBlockSetFunc(block, NULL, iuser, NULL);
- }
- else if(ima->source==IMA_SRC_GENERATED) {
-
- uiBlockBeginAlign(block);
- uiBlockSetFunc(block, image_generated_change_cb, ima, iuser);
- uiDefButS(block, NUM, imagechanged, "SizeX:", 120,90,100,20, &ima->gen_x, 1.0, 5000.0, 0, 0, "Image size x");
- uiDefButS(block, NUM, imagechanged, "SizeY:", 220,90,90,20, &ima->gen_y, 1.0, 5000.0, 0, 0, "Image size y");
- uiDefButS(block, TOG, imagechanged, "UV Test grid",120,70,190,20, &ima->gen_type, 0.0, 1.0, 0, 0, "");
- uiBlockSetFunc(block, NULL, NULL, NULL);
- }
- }
- uiBlockEndAlign(block);
-}
-
-static void texture_panel_image(Image **ima, ImageUser *iuser)
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "texture_panel_image", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Image", "Texture", 960, 0, 318, 204)==0) return;
-
- uiblock_image_panel(block, ima, iuser, B_REDR, B_IMAGECHANGED);
-}
-
-static void texture_panel_image_map(Tex *tex, MTex *mtex)
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "texture_panel_image_map", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Map Image", "Texture", 640, 0, 318, 204)==0) return;
- uiSetButLock(tex->id.lib!=0, ERROR_LIBDATA_MESSAGE);
-
- /* types */
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, TEX_MIPMAP, B_IMAGECHANGED, "MipMap", 10, 180, 75, 20, &tex->imaflag, 0, 0, 0, 0, "Generates and uses mipmaps");
- uiDefButBitS(block, TOG, TEX_GAUSS_MIP, 0, "Gauss", 85, 180, 75, 20, &tex->imaflag, 0, 0, 0, 0, "Enable Gauss filter to sample down mipmaps");
- uiDefButBitS(block, TOG, TEX_INTERPOL, 0, "Interpol", 160, 180, 75, 20, &tex->imaflag, 0, 0, 0, 0, "Interpolates pixels using Area filter");
- uiDefButBitS(block, TOG, TEX_IMAROT, B_TEXPRV, "Rot90", 235, 180, 75, 20, &tex->imaflag, 0, 0, 0, 0, "Actually flips X and Y for rendering, rotates and mirrors");
-
- uiDefButBitS(block, TOG, TEX_USEALPHA, B_TEXPRV, "UseAlpha", 10, 160, 100, 20, &tex->imaflag, 0, 0, 0, 0, "Click to use Image's alpha channel");
- uiDefButBitS(block, TOG, TEX_CALCALPHA, B_TEXPRV, "CalcAlpha", 110, 160, 100, 20, &tex->imaflag, 0, 0, 0, 0, "Click to calculate an alpha channel based on Image RGB values");
- uiDefButBitS(block, TOG, TEX_NEGALPHA, B_TEXPRV, "NegAlpha", 210, 160, 100, 20, &tex->flag, 0, 0, 0, 0, "Click to invert the alpha values");
- uiBlockEndAlign(block);
-
- uiDefButF(block, NUM, B_TEXPRV, "Filter :", 10,120,150,20, &tex->filtersize, 0.1, 25.0, 10, 3, "Sets the filter size used by mipmap and interpol");
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, TEX_NORMALMAP, B_NOP, "Normal Map", 160,120,(mtex)? 75: 150,20, &tex->imaflag,
- 0, 0, 0, 0, "Use image RGB values for normal mapping");
- if(mtex)
- uiDefButS(block, MENU, B_DIFF, "Normal Space %t|Camera %x0|World %x1|Object %x2|Tangent %x3",
- 235,120,75,20, &mtex->normapspace, 0, 0, 0, 0, "Sets space of normal map image");
- uiBlockEndAlign(block);
-
- /* crop extend clip */
-
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW, B_TEXREDR_PRV, "Extend", 10,90,63,19, &tex->extend, 4.0, 1.0, 0, 0, "Extends the color of the edge pixels");
- uiDefButS(block, ROW, B_TEXREDR_PRV, "Clip", 73,90,48,19, &tex->extend, 4.0, 2.0, 0, 0, "Sets alpha 0.0 outside Image edges");
- uiDefButS(block, ROW, B_TEXREDR_PRV, "ClipCube", 121,90,63,19, &tex->extend, 4.0, 4.0, 0, 0, "Sets alpha to 0.0 outside cubeshaped area around Image");
- uiDefButS(block, ROW, B_TEXREDR_PRV, "Repeat", 184,90,63,19, &tex->extend, 4.0, 3.0, 0, 0, "Causes Image to repeat horizontally and vertically");
- uiDefButS(block, ROW, B_TEXREDR_PRV, "Checker", 247,90,63,19, &tex->extend, 4.0, 5.0, 0, 0, "Causes Image to repeat in checker pattern");
-
- if(tex->extend==TEX_REPEAT) {
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, TEX_REPEAT_XMIR, B_TEXPRV, "Mirr", 10,60,30,19, &tex->flag, 0.0, 0.0, 0, 0, "Mirrors X direction repeat");
- uiDefButS(block, NUM, B_TEXPRV, "Xrepeat:", 40,60,120,19, &tex->xrepeat, 1.0, 512.0, 0, 0, "Sets a repetition multiplier in the X direction");
- uiDefButBitS(block, TOG, TEX_REPEAT_YMIR, B_TEXPRV, "Mirr", 160,60,30,19, &tex->flag, 0.0, 0.0, 0, 0, "Mirrors Y direction repeat");
- uiDefButS(block, NUM, B_TEXPRV, "Yrepeat:", 190,60,120,19, &tex->yrepeat, 1.0, 512.0, 0, 0, "Sets a repetition multiplier in the Y direction");
- }
- else if(tex->extend==TEX_CHECKER) {
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, TEX_CHECKER_ODD, B_TEXPRV, "Odd", 10,60,100,19, &tex->flag, 0.0, 0.0, 0, 0, "Sets odd checker tiles");
- uiDefButBitS(block, TOG, TEX_CHECKER_EVEN, B_TEXPRV, "Even", 110,60,100,19, &tex->flag, 0.0, 0.0, 0, 0, "Sets even checker tiles");
- uiDefButF(block, NUM, B_TEXPRV, "Mortar:", 210,60,100,19, &tex->checkerdist, 0.0, 0.99, 0, 0, "Set checkers distance (like mortar)");
- }
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_TEXPRV, "MinX ", 10,30,150,19, &tex->cropxmin, -10.0, 10.0, 10, 0, "Sets minimum X value to crop Image");
- uiDefButF(block, NUM, B_TEXPRV, "MinY ", 10,10,150,19, &tex->cropymin, -10.0, 10.0, 10, 0, "Sets minimum Y value to crop Image");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_TEXPRV, "MaxX ", 160,30,150,19, &tex->cropxmax, -10.0, 10.0, 10, 0, "Sets maximum X value to crop Image");
- uiDefButF(block, NUM, B_TEXPRV, "MaxY ", 160,10,150,19, &tex->cropymax, -10.0, 10.0, 10, 0, "Sets maximum Y value to crop Image");
- uiBlockEndAlign(block);
-
-}
-
-/***************************************/
-
-static void texture_panel_envmap(Tex *tex)
-{
- uiBlock *block;
- uiBut *but;
- EnvMap *env;
- ID *id;
- short a, xco, yco, dx, dy;
- char *strp, str[32];
-
- block= uiNewBlock(&curarea->uiblocks, "texture_panel_envmap", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Envmap", "Texture", 640, 0, 318, 204)==0) return;
- uiSetButLock(tex->id.lib!=0, ERROR_LIBDATA_MESSAGE);
-
- if(tex->env==NULL) {
- tex->env= BKE_add_envmap();
- tex->env->object= OBACT;
- }
- if(tex->env) {
- env= tex->env;
-
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW, B_REDR, "Static", 10, 180, 100, 19, &env->stype, 2.0, (float)ENV_STATIC, 0, 0, "Calculates environment map only once");
- uiDefButS(block, ROW, B_REDR, "Anim", 110, 180, 100, 19, &env->stype, 2.0, (float)ENV_ANIM, 0, 0, "Calculates environment map at each rendering");
- uiDefButS(block, ROW, B_ENV_FREE, "Load", 210, 180, 100, 19, &env->stype, 2.0, (float)ENV_LOAD, 0, 0, "Loads saved environment map from disk");
- uiBlockEndAlign(block);
-
- if(env->stype==ENV_LOAD) {
- /* file input */
- id= (ID *)tex->ima;
- IMAnames_to_pupstring(&strp, NULL, NULL, &(G.main->image), id, &(G.buts->menunr));
- if(strp[0]) {
- uiBlockBeginAlign(block);
-
- but= uiDefButS(block, MENU, B_TEXPRV, strp, 10,145,23,20, &tex->iuser.menunr, 0, 0, 0, 0, "Selects an existing environment map");
- uiButSetFunc(but, image_browse_cb, &tex->ima, &tex->iuser);
-
- if(tex->ima) {
- but= uiDefBut(block, TEX, B_NAMEIMA, "", 35,145,255,20, tex->ima->name, 0.0, 79.0, 0, 0, "Displays environment map name: click to change");
- uiButSetFunc(but, image_load_cb, &tex->ima, &tex->iuser);
-
- sprintf(str, "%d", tex->ima->id.us);
- uiDefBut(block, BUT, 0, str, 290,145,20,20, 0, 0, 0, 0, 0, "Displays number of users of environment map: click to make single user");
- uiBlockEndAlign(block);
-
- but= uiDefBut(block, BUT, B_IMAGECHANGED, "Reload", 230,125,80,20, 0, 0, 0, 0, 0, "Reloads saved environment map");
- uiButSetFunc(but, image_reload_cb, tex->ima, NULL);
-
- if (tex->ima->packedfile) packdummy = 1;
- else packdummy = 0;
- but= uiDefIconButBitI(block, TOG, 1, B_REDR, ICON_PACKAGE, 205,125,24,20, &packdummy, 0, 0, 0, 0, "Toggles Packed status of this environment map");
- uiButSetFunc(but, image_pack_cb, tex->ima, &tex->iuser);
- }
- else uiBlockEndAlign(block);
- }
- MEM_freeN(strp);
-
- but= uiDefBut(block, BUT, B_IMAGECHANGED, "Load Image", 10,125,150,20, 0, 0, 0, 0, 0, "Loads saved environment map - file select");
- uiButSetFunc(but, image_load_fs_cb, &tex->ima, &tex->iuser);
- }
- else {
- uiBlockBeginAlign(block);
- uiDefBut(block, BUT, B_ENV_FREE, "Free Data", 10,145,100,20, 0, 0, 0, 0, 0, "Releases all images associated with this environment map");
- uiDefBut(block, BUT, B_ENV_SAVE, "Save EnvMap", 110,145,100,20, 0, 0, 0, 0, 0, "Saves current environment map");
- uiDefBut(block, BUT, B_ENV_FREE_ALL, "Free all EnvMaps", 210,145,100,20, 0, 0, 0, 0, 0, "Frees all rendered environment maps for all materials");
-
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW, B_NOP, "Cube", 10,120,100,20, &env->type, 3.0f, (float)ENV_CUBE, 0, 0, "Use environment map with six cube sides");
- uiDefButS(block, ROW, B_NOP, "Plane", 110,120,100,20, &env->type, 3.0f, (float)ENV_PLANE, 0, 0, "Only one side is rendered, with Z axis pointing in direction of image");
- uiDefButF(block, NUM, B_NOP, "Zoom: ", 210,120,100,20, &env->viewscale, 0.5f, 5.0f, 100, 2, "Zoom factor for planar environment map");
- uiBlockEndAlign(block);
- }
-
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_ENV_OB, "Ob:", 10,90,150,20, &(env->object), "Displays object to use as viewpoint for environment map: click to change");
- if(env->stype!=ENV_LOAD)
- uiDefButS(block, NUM, B_ENV_FREE, "CubeRes", 160,90,150,20, &env->cuberes, 50, 4096.0, 0, 0, "Sets the pixel resolution of the rendered environment map");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_TEXPRV, "Filter :", 10,65,150,20, &tex->filtersize, 0.1, 25.0, 0, 3, "Adjusts sharpness or blurriness of the reflection"),
- uiDefButS(block, NUM, B_ENV_FREE, "Depth:", 160,65,150,20, &env->depth, 0, 5.0, 0, 0, "Sets the number of times a map will be rendered recursively mirror effects"),
- uiDefButF(block, NUM, REDRAWVIEW3D, "ClipSta", 10,40,150,20, &env->clipsta, 0.01, 50.0, 100, 0, "Sets start value for clipping: objects nearer than this are not visible to map");
- uiDefButF(block, NUM, B_NOP, "ClipEnd", 160,40,150,20, &env->clipend, 0.1, 20000.0, 1000, 0, "Sets end value for clipping beyond which objects are not visible to map");
- uiBlockEndAlign(block);
-
- uiDefBut(block, LABEL, 0, "Don't render layer:", 10,10,140,22, 0, 0.0, 0.0, 0, 0, "");
- xco= 160;
- yco= 10;
- dx= 28;
- dy= 26;
-
- uiBlockBeginAlign(block);
- for(a=0; a<5; a++)
- uiDefButBitI(block, TOG, 1<<a, 0, "", (xco+a*(dx/2)), (yco+dy/2), (dx/2), (1+dy/2), (int *)&env->notlay, 0, 0, 0, 0, "Toggles layer visibility to environment map");
- for(a=0; a<5; a++)
- uiDefButBitI(block, TOG, 1<<(a+10), 0, "",(xco+a*(dx/2)), yco, (dx/2), (dy/2), (int *)&env->notlay, 0, 0, 0, 0, "Toggles layer visibility to environment map");
-
- uiBlockBeginAlign(block);
- xco+= 5;
- for(a=5; a<10; a++)
- uiDefButBitI(block, TOG, 1<<a, 0, "", (xco+a*(dx/2)), (yco+dy/2), (dx/2), (1+dy/2), (int *)&env->notlay, 0, 0, 0, 0, "Toggles layer visibility to environment map");
- for(a=5; a<10; a++)
- uiDefButBitI(block, TOG, 1<<(a+10), 0, "",(xco+a*(dx/2)), yco, (dx/2), (dy/2), (int *)&env->notlay, 0, 0, 0, 0, "Toggles layer visibility to environment map");
-
- }
-}
-
-static void colorband_pos_cb(void *coba_v, void *unused_v)
-{
- ColorBand *coba= coba_v;
- int a;
-
- if(coba->tot<2) return;
-
- for(a=0; a<coba->tot; a++) coba->data[a].cur= a;
- qsort(coba->data, coba->tot, sizeof(CBData), vergcband);
- for(a=0; a<coba->tot; a++) {
- if(coba->data[a].cur==coba->cur) {
- if(coba->cur!=a) addqueue(curarea->win, REDRAW, 0); /* button cur */
- coba->cur= a;
- break;
- }
- }
-}
-
-static void colorband_add_cb(void *coba_v, void *unused_v)
-{
- ColorBand *coba= coba_v;
-
- if(coba->tot < MAXCOLORBAND-1) coba->tot++;
- coba->cur= coba->tot-1;
-
- colorband_pos_cb(coba, NULL);
- BIF_undo_push("Add colorband");
-
-}
-
-static void colorband_del_cb(void *coba_v, void *unused_v)
-{
- ColorBand *coba= coba_v;
- int a;
-
- if(coba->tot<2) return;
-
- for(a=coba->cur; a<coba->tot; a++) {
- coba->data[a]= coba->data[a+1];
- }
- if(coba->cur) coba->cur--;
- coba->tot--;
-
- BIF_undo_push("Delete colorband");
- BIF_preview_changed(ID_TE);
-}
-
-
-/* offset aligns from bottom, standard width 300, height 115 */
-static void draw_colorband_buts(uiBlock *block, ColorBand *coba, int xoffs, int yoffs, int redraw)
-{
- CBData *cbd;
- uiBut *bt;
-
- if(coba==NULL) return;
-
- bt= uiDefBut(block, BUT, redraw, "Add", 80+xoffs,95+yoffs,37,20, 0, 0, 0, 0, 0, "Adds a new color position to the colorband");
- uiButSetFunc(bt, colorband_add_cb, coba, NULL);
- uiDefButS(block, NUM, redraw, "Cur:", 117+xoffs,95+yoffs,81,20, &coba->cur, 0.0, (float)(coba->tot-1), 0, 0, "Displays the active color from the colorband");
- bt= uiDefBut(block, BUT, redraw, "Del", 199+xoffs,95+yoffs,37,20, 0, 0, 0, 0, 0, "Deletes the active position");
- uiButSetFunc(bt, colorband_del_cb, coba, NULL);
- uiDefButS(block, ROW, redraw, "E", 236+xoffs,95+yoffs,16,20, &coba->ipotype, 5.0, 1.0, 0, 0, "Sets interpolation type 'Ease' (quadratic) ");
- uiDefButS(block, ROW, redraw, "C", 252+xoffs,95+yoffs,16,20, &coba->ipotype, 5.0, 3.0, 0, 0, "Sets interpolation type Cardinal");
- uiDefButS(block, ROW, redraw, "L", 268+xoffs,95+yoffs,16,20, &coba->ipotype, 5.0, 0.0, 0, 0, "Sets interpolation type Linear");
- uiDefButS(block, ROW, redraw, "S", 284+xoffs,95+yoffs,16,20, &coba->ipotype, 5.0, 2.0, 0, 0, "Sets interpolation type B-Spline");
-
- uiDefBut(block, BUT_COLORBAND, redraw, "", xoffs,65+yoffs,300,30, coba, 0, 0, 0, 0, "");
-
- cbd= coba->data + coba->cur;
-
- uiBlockBeginAlign(block);
- bt= uiDefButF(block, NUM, redraw, "Pos", xoffs,40+yoffs,110,20, &cbd->pos, 0.0, 1.0, 10, 0, "Sets the position of the active color");
- uiButSetFunc(bt, colorband_pos_cb, coba, NULL);
- uiDefButF(block, COL, redraw, "", xoffs,20+yoffs,110,20, &(cbd->r), 0, 0, 0, B_BANDCOL, "");
- uiDefButF(block, NUMSLI, redraw, "A ", xoffs,yoffs,110,20, &cbd->a, 0.0, 1.0, 10, 0, "Sets the alpha value for this position");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, redraw, "R ", 115+xoffs,40+yoffs,185,20, &cbd->r, 0.0, 1.0, B_BANDCOL, 0, "Sets the red value for the active color");
- uiDefButF(block, NUMSLI, redraw, "G ", 115+xoffs,20+yoffs,185,20, &cbd->g, 0.0, 1.0, B_BANDCOL, 0, "Sets the green value for the active color");
- uiDefButF(block, NUMSLI, redraw, "B ", 115+xoffs,yoffs,185,20, &cbd->b, 0.0, 1.0, B_BANDCOL, 0, "Sets the blue value for the active color");
- uiBlockEndAlign(block);
-}
-
-void draw_colorband_buts_small(uiBlock *block, ColorBand *coba, rctf *butr, int event)
-{
- CBData *cbd;
- uiBut *bt;
- float unit= (butr->xmax-butr->xmin)/14.0f;
- float xs= butr->xmin;
-
- cbd= coba->data + coba->cur;
-
- uiBlockBeginAlign(block);
- uiDefButF(block, COL, event, "", xs,butr->ymin+20.0f,2.0f*unit,20, &(cbd->r), 0, 0, 0, B_BANDCOL, "");
- uiDefButF(block, NUM, event, "A:", xs+2.0f*unit,butr->ymin+20.0f,4.0f*unit,20, &(cbd->a), 0.0f, 1.0f, 10, 2, "");
- bt= uiDefBut(block, BUT, event, "Add", xs+6.0f*unit,butr->ymin+20.0f,2.0f*unit,20, NULL, 0, 0, 0, 0, "Adds a new color position to the colorband");
- uiButSetFunc(bt, colorband_add_cb, coba, NULL);
- bt= uiDefBut(block, BUT, event, "Del", xs+8.0f*unit,butr->ymin+20.0f,2.0f*unit,20, NULL, 0, 0, 0, 0, "Deletes the active position");
- uiButSetFunc(bt, colorband_del_cb, coba, NULL);
- uiDefButS(block, ROW, event, "E", xs+10.0f*unit,butr->ymin+20.0f,unit,20, &coba->ipotype, 5.0, 1.0, 0, 0, "Sets interpolation type 'Ease' (quadratic) ");
- uiDefButS(block, ROW, event, "C", xs+11.0f*unit,butr->ymin+20.0f,unit,20, &coba->ipotype, 5.0, 3.0, 0, 0, "Sets interpolation type Cardinal");
- uiDefButS(block, ROW, event, "L", xs+12.0f*unit,butr->ymin+20.0f,unit,20, &coba->ipotype, 5.0, 0.0, 0, 0, "Sets interpolation type Linear");
- uiDefButS(block, ROW, event, "S", xs+13.0f*unit,butr->ymin+20.0f,unit,20, &coba->ipotype, 5.0, 2.0, 0, 0, "Sets interpolation type B-Spline");
-
- uiDefBut(block, BUT_COLORBAND, event, "", xs,butr->ymin,butr->xmax-butr->xmin,20.0f, coba, 0, 0, 0, 0, "");
- uiBlockEndAlign(block);
-
-}
-
-static void texture_panel_colors(Tex *tex)
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "texture_panel_colors", UI_EMBOSS, UI_HELV, curarea->win);
- uiNewPanelTabbed("Texture", "Texture");
- if(uiNewPanel(curarea, block, "Colors", "Texture", 1280, 0, 318, 204)==0) return;
-
-
- /* COLORBAND */
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, TEX_COLORBAND, B_COLORBAND, "Colorband",10,180,80,20, &tex->flag, 0, 0, 0, 0, "Toggles colorband operations");
-
- if(tex->flag & TEX_COLORBAND) {
- draw_colorband_buts(block, tex->coba, 10, 85, B_TEXREDR_PRV);
- }
-
- /* RGB-BRICON */
- if((tex->flag & TEX_COLORBAND)==0) {
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_TEXPRV, "R ", 60,80,200,20, &tex->rfac, 0.0, 2.0, 0, 0, "Changes the red value of the texture");
- uiDefButF(block, NUMSLI, B_TEXPRV, "G ", 60,60,200,20, &tex->gfac, 0.0, 2.0, 0, 0, "Changes the green value of the texture");
- uiDefButF(block, NUMSLI, B_TEXPRV, "B ", 60,40,200,20, &tex->bfac, 0.0, 2.0, 0, 0, "Changes the blue value of the texture");
- }
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_TEXPRV, "Bright", 10,10,150,20, &tex->bright, 0.0, 2.0, 0, 0, "Changes the brightness of the color or intensity of a texture");
- uiDefButF(block, NUMSLI, B_TEXPRV, "Contr", 160,10,150,20, &tex->contrast, 0.01, 5.0, 0, 0, "Changes the contrast of the color or intensity of a texture");
-}
-
-
-static void texture_panel_texture(MTex *mtex, Material *ma, World *wrld, Lamp *la, bNode *node, Brush *br, SculptData *sd)
-{
- MTex *mt=NULL;
- uiBlock *block;
- ID *id=NULL, *idfrom;
- int a, yco, loos;
- char str[32];
-
-
- block= uiNewBlock(&curarea->uiblocks, "texture_panel_texture", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Texture", "Texture", 320, 0, 318, 204)==0) return;
-
- /* first do the browse but */
- if(mtex)
- id= (ID *)mtex->tex;
- else if(node)
- id= node->id;
-
- if(ma) idfrom= &ma->id;
- else if(wrld) idfrom= &wrld->id;
- else if(la) idfrom= &la->id;
- else if(br) idfrom= &br->id;
- else if(sd) idfrom= NULL; /* Not sure what this does */
- else idfrom= NULL;
-
- uiBlockSetCol(block, TH_BUT_SETTING2);
- if(ma) {
- std_libbuttons(block, 10, 180, 0, NULL, B_TEXBROWSE, ID_TE, 0, id, idfrom, &(G.buts->texnr), B_TEXALONE, B_TEXLOCAL, B_TEXDELETE, B_AUTOTEXNAME, B_KEEPDATA);
- }
- else if(wrld) {
- std_libbuttons(block, 10, 180, 0, NULL, B_WTEXBROWSE, ID_TE, 0, id, idfrom, &(G.buts->texnr), B_TEXALONE, B_TEXLOCAL, B_TEXDELETE, B_AUTOTEXNAME, B_KEEPDATA);
- }
- else if(la) {
- std_libbuttons(block, 10, 180, 0, NULL, B_LTEXBROWSE, ID_TE, 0, id, idfrom, &(G.buts->texnr), B_TEXALONE, B_TEXLOCAL, B_TEXDELETE, B_AUTOTEXNAME, B_KEEPDATA);
- }
- else if(br) {
- std_libbuttons(block, 10, 180, 0, NULL, B_BTEXBROWSE, ID_TE, 0, id, idfrom, &(G.buts->menunr), B_TEXALONE, B_TEXLOCAL, B_TEXDELETE, B_AUTOTEXNAME, B_KEEPDATA);
- }
- else if(sd) {
- std_libbuttons(block, 10, 180, 0, NULL, B_SCULPT_TEXBROWSE, ID_TE, 0, id, idfrom, &(G.buts->texnr), B_TEXALONE, B_TEXLOCAL, B_TEXDELETE, B_AUTOTEXNAME, B_KEEPDATA);
- }
- else if(node) {
-
- }
- uiBlockSetCol(block, TH_BUT_NEUTRAL);
-
- /* From button: removed */
-
- /* CHANNELS */
- if(node==NULL) {
- uiBlockBeginAlign(block);
- yco= 150;
- for(a= 0; a<MAX_MTEX; a++) {
-
- if(ma) mt= ma->mtex[a];
- else if(wrld) mt= wrld->mtex[a];
- else if(la) mt= la->mtex[a];
- else if(br) mt= br->mtex[a];
- else if(sd) mt= sd->mtex[a];
-
- if(mt && mt->tex) splitIDname(mt->tex->id.name+2, str, &loos);
- else strcpy(str, "");
- str[14]= 0;
-
- if(ma) {
- uiDefButC(block, ROW, B_TEXCHANNEL, str, 10,yco,140,19, &(ma->texact), 0.0, (float)a, 0, 0, "Click to select texture channel");
- yco-= 20;
- }
- else if(wrld) {
- uiDefButS(block, ROW, B_TEXCHANNEL, str, 10,yco,140,19, &(wrld->texact), 0.0, (float)a, 0, 0, "");
- yco-= 20;
- }
- else if(la) {
- uiDefButS(block, ROW, B_TEXCHANNEL, str, 10,yco,140,19, &(la->texact), 0.0, (float)a, 0, 0, "");
- yco-= 20;
- }
- else if(br) {
- uiDefButS(block, ROW, B_TEXCHANNEL, str, 10,yco,140,19, &(br->texact), 0.0, (float)a, 0, 0, "");
- yco-= 20;
- }
- else if(sd) {
- uiDefButS(block, ROW, B_TEXCHANNEL, str, 10,yco,140,19, &(sd->texact), 0.0, (float)a, 0, 0, "");
- yco-= 20;
- }
- }
- uiBlockEndAlign(block);
- }
- uiBlockSetCol(block, TH_AUTO);
-
- /* TYPES */
- if(id) {
- char textypes[512];
- Tex *tex= (Tex *)id;
-
- uiSetButLock(tex->id.lib!=0, ERROR_LIBDATA_MESSAGE);
-
- /* newnoise: all texture types as menu, not enough room for more buttons.
- * Can widen panel, but looks ugly when other panels overlap it */
-
- sprintf(textypes, "Texture Type %%t|None %%x%d|Image %%x%d|EnvMap %%x%d|Clouds %%x%d|Marble %%x%d|Stucci %%x%d|Wood %%x%d|Magic %%x%d|Blend %%x%d|Noise %%x%d|Plugin %%x%d|Musgrave %%x%d|Voronoi %%x%d|DistortedNoise %%x%d", 0, TEX_IMAGE, TEX_ENVMAP, TEX_CLOUDS, TEX_MARBLE, TEX_STUCCI, TEX_WOOD, TEX_MAGIC, TEX_BLEND, TEX_NOISE, TEX_PLUGIN, TEX_MUSGRAVE, TEX_VORONOI, TEX_DISTNOISE);
- uiDefBut(block, LABEL, 0, "Texture Type", 160, 150, 140, 20, 0, 0.0, 0.0, 0, 0, "");
- uiDefButS(block, MENU, B_TEXTYPE, textypes, 160, 125, 140, 25, &tex->type, 0,0,0,0, "Select texture type");
-
- }
- else {
- // label to avoid centering
- uiDefBut(block, LABEL, 0, " ", 160, 10, 140, 20, 0, 0, 0, 0, 0, "");
- }
-}
-
-static void texture_panel_preview(MTex *mtex, int preview)
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "texture_panel_preview", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Preview", "Texture", 0, 0, 318, 204)==0) return;
-
- if(preview) uiBlockSetDrawExtraFunc(block, BIF_previewdraw);
-
- // label to force a boundbox for buttons not to be centered
- uiDefBut(block, LABEL, 0, " ", 20,20,10,10, 0, 0, 0, 0, 0, "");
-
- uiBlockBeginAlign(block);
- uiDefButC(block, ROW, B_TEXREDR_PRV, "Mat", 200,175,80,25, &G.buts->texfrom, 3.0, 0.0, 0, 0, "Displays the textures of the active material");
- uiDefButC(block, ROW, B_TEXREDR_PRV, "World", 200,150,80,25, &G.buts->texfrom, 3.0, 1.0, 0, 0, "Displays the textures of the world block");
- uiDefButC(block, ROW, B_TEXREDR_PRV, "Lamp", 200,125,80,25, &G.buts->texfrom, 3.0, 2.0, 0, 0, "Displays the textures of the selected lamp");
- uiDefButC(block, ROW, B_TEXREDR_PRV, "Brush", 200,100,80,25, &G.buts->texfrom, 3.0, 3.0, 0, 0, "Displays the textures of the selected brush");
- uiBlockEndAlign(block);
-
- if(mtex && mtex->tex)
- uiDefButBitS(block, TOG, TEX_PRV_ALPHA, B_TEXREDR_PRV, "Alpha", 200,60,80,20, &mtex->tex->flag, 0, 0, 0, 0, "Show alpha in preview");
-
- uiDefBut(block, BUT, B_DEFTEXVAR, "Default Vars",200,10,80,20, 0, 0, 0, 0, 0, "Sets all values to defaults");
-
-}
-
-
-
-/* *************************** RADIO ******************************** */
-
-void do_radiobuts(unsigned short event)
-{
- Radio *rad;
- int phase;
-
- phase= rad_phase();
- rad= G.scene->radio;
-
- switch(event) {
- case B_RAD_ADD:
- add_radio();
- BIF_undo_push("Add radiosity");
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_RAD_DELETE:
- delete_radio();
- BIF_undo_push("Delete radiosity");
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_RAD_FREE:
- freeAllRad();
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_RAD_COLLECT:
- rad_collect_meshes();
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_RAD_INIT:
- if(phase==RAD_PHASE_PATCHES) {
- rad_limit_subdivide();
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWVIEW3D, 0);
- }
- break;
- case B_RAD_SHOOTP:
- if(phase==RAD_PHASE_PATCHES) {
- waitcursor(1);
- rad_subdivshootpatch();
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWVIEW3D, 0);
- waitcursor(0);
- }
- break;
- case B_RAD_SHOOTE:
- if(phase==RAD_PHASE_PATCHES) {
- waitcursor(1);
- rad_subdivshootelem();
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWVIEW3D, 0);
- waitcursor(0);
- }
- break;
- case B_RAD_GO:
- if(phase==RAD_PHASE_PATCHES) {
- waitcursor(1);
- rad_go();
- waitcursor(0);
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWVIEW3D, 0);
- }
- break;
- case B_RAD_LIMITS:
- rad_setlimits();
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSSHADING, 0);
- break;
- case B_RAD_FAC:
- set_radglobal();
- if(phase & RAD_PHASE_FACES) make_face_tab();
- else make_node_display(); /* radio solver also uses nodes, different ones :) */
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_RAD_NODELIM:
- if(phase & RAD_PHASE_FACES) {
- set_radglobal();
- removeEqualNodes(rad->nodelim);
- make_face_tab();
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSSHADING, 0);
- }
- break;
- case B_RAD_NODEFILT:
- if(phase & RAD_PHASE_FACES) {
- set_radglobal();
- filterNodes();
- make_face_tab();
- allqueue(REDRAWVIEW3D, 0);
- }
- break;
- case B_RAD_FACEFILT:
- if(phase & RAD_PHASE_FACES) {
- filterFaces();
- allqueue(REDRAWVIEW3D, 0);
- }
- break;
- case B_RAD_DRAW:
- set_radglobal();
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_RAD_ADDMESH:
- if(phase & RAD_PHASE_FACES) rad_addmesh();
- BIF_undo_push("Radiosity add mesh");
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_RAD_REPLACE:
- if(phase & RAD_PHASE_FACES) rad_replacemesh();
- BIF_undo_push("Radiosity replace mesh");
- allqueue(REDRAWVIEW3D, 0);
- break;
- }
-
-}
-
-
-static void radio_panel_calculation(Radio *rad, int flag)
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "radio_panel_calculation", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Calculation", "Radio", 640, 0, 318, 204)==0) return;
- uiAutoBlock(block, 10, 10, 300, 200, UI_BLOCK_ROWS);
-
- if(flag != RAD_PHASE_PATCHES) uiBlockSetCol(block, TH_BUT_NEUTRAL);
- uiDefBut(block, BUT, B_RAD_GO, "GO", 0, 0, 10, 15, NULL, 0, 0, 0, 0, "Starts the radiosity simulation");
-
- uiBlockSetCol(block, TH_AUTO);
- uiDefButS(block, NUM, B_NOP, "SubSh Patch:", 1, 0, 10, 10, &rad->subshootp, 0.0, 10.0, 0, 0, "Sets the number of times the environment is tested to detect pathes");
- uiDefButS(block, NUM, B_NOP, "SubSh Element:", 1, 0, 10, 10, &rad->subshoote, 0.0, 10.0, 0, 0, "Sets the number of times the environment is tested to detect elements");
-
- if(flag != RAD_PHASE_PATCHES) uiBlockSetCol(block, TH_BUT_NEUTRAL);
- uiDefBut(block, BUT, B_RAD_SHOOTE, "Subdiv Shoot Element", 2, 0, 10, 10, NULL, 0, 0, 0, 0, "For pre-subdivision, Detects high energy changes and subdivide Elements");
- uiDefBut(block, BUT, B_RAD_SHOOTP, "Subdiv Shoot Patch", 2, 0, 10, 10, NULL, 0, 0, 0, 0, "For pre-subdivision, Detects high energy changes and subdivide Patches");
-
- uiBlockSetCol(block, TH_AUTO);
- uiDefButI(block, NUM, B_NOP, "MaxEl:", 3, 0, 10, 10, &rad->maxnode, 1.0, 250000.0, 0, 0, "Sets the maximum allowed number of elements");
- uiDefButS(block, NUM, B_NOP, "Max Subdiv Shoot:", 3, 0, 10, 10, &rad->maxsublamp, 1.0, 250.0, 0, 0, "Sets the maximum number of initial shoot patches that are evaluated");
-
- if(flag & RAD_PHASE_FACES);
- else uiBlockSetCol(block, TH_BUT_NEUTRAL);
- uiDefBut(block, BUT, B_RAD_FACEFILT, "FaceFilter", 4, 0, 10, 10, NULL, 0, 0, 0, 0, "Forces an extra smoothing");
- uiDefBut(block, BUT, B_RAD_NODEFILT, "Element Filter", 4, 0, 10, 10, NULL, 0, 0, 0, 0, "Filters elements to remove aliasing artefacts");
-
- uiDefBut(block, BUT, B_RAD_NODELIM, "RemoveDoubles", 5, 0, 30, 10, NULL, 0.0, 50.0, 0, 0, "Joins elements which differ less than 'Lim'");
- uiBlockSetCol(block, TH_AUTO);
- uiDefButS(block, NUM, B_NOP, "Lim:", 5, 0, 10, 10, &rad->nodelim, 0.0, 50.0, 0, 0, "Sets the range for removing doubles");
-
-
-}
-
-static void radio_panel_tool(Radio *rad, int flag)
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "radio_panel_tool", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Radio Tool", "Radio", 320, 0, 318, 204)==0) return;
- uiAutoBlock(block, 10, 10, 300, 200, UI_BLOCK_ROWS);
-
- if(flag & RAD_PHASE_PATCHES) uiBlockSetCol(block, TH_BUT_SETTING1);
- uiDefBut(block, BUT, B_RAD_COLLECT, "Collect Meshes", 0, 0, 10, 15, NULL, 0, 0, 0, 0, "Converts selected visible meshes to patches");
-
- if(flag & RAD_PHASE_PATCHES)uiBlockSetCol(block, TH_AUTO);
- else uiBlockSetCol(block, TH_BUT_NEUTRAL);
- uiDefBut(block, BUT, B_RAD_FREE, "Free Radio Data", 0, 0, 10, 15, NULL, 0, 0, 0, 0, "Releases all memory used by Radiosity");
-
- if(flag & RAD_PHASE_FACES) uiBlockSetCol(block, TH_AUTO);
- else uiBlockSetCol(block, TH_BUT_NEUTRAL);
- uiDefBut(block, BUT, B_RAD_REPLACE, "Replace Meshes", 1, 0, 10, 12, NULL, 0, 0, 0, 0, "Converts meshes to Mesh objects with vertex colors, changing input-meshes");
- uiDefBut(block, BUT, B_RAD_ADDMESH, "Add new Meshes", 1, 0, 10, 12, NULL, 0, 0, 0, 0, "Converts meshes to Mesh objects with vertex colors, unchanging input-meshes");
-
- uiBlockSetCol(block, TH_AUTO);
- uiDefButS(block, ROW, B_RAD_DRAW, "Wire", 2, 0, 10, 10, &rad->drawtype, 0.0, 0.0, 0, 0, "Enables wireframe drawmode");
- uiDefButS(block, ROW, B_RAD_DRAW, "Solid", 2, 0, 10, 10, &rad->drawtype, 0.0, 1.0, 0, 0, "Enables solid drawmode");
- uiDefButS(block, ROW, B_RAD_DRAW, "Gour", 2, 0, 10, 10, &rad->drawtype, 0.0, 2.0, 0, 0, "Enables Gourad drawmode");
- uiDefButBitS(block, TOG, 1, B_RAD_DRAW, "ShowLim", 2, 0, 10, 10, &rad->flag, 0, 0, 0, 0, "Draws patch and element limits");
- uiDefButBitS(block, TOG, 2, B_RAD_DRAW, "Z", 2, 0, 3, 10, &rad->flag, 0, 0, 0, 0, "Draws limits differently");
-
- uiDefButS(block, NUM, B_RAD_LIMITS, "ElMax:", 3, 0, 10, 10, &rad->elma, 1.0, 500.0, 0, 0, "Sets maximum size of an element");
- uiDefButS(block, NUM, B_RAD_LIMITS, "ElMin:", 3, 0, 10, 10, &rad->elmi, 1.0, 100.0, 0, 0, "Sets minimum size of an element");
- uiDefButS(block, NUM, B_RAD_LIMITS, "PaMax:", 3, 0, 10, 10, &rad->pama, 10.0, 1000.0, 0, 0, "Sets maximum size of a patch");
- uiDefButS(block, NUM, B_RAD_LIMITS, "PaMin:", 3, 0, 10, 10, &rad->pami, 10.0, 1000.0, 0, 0, "Sets minimum size of a patch");
-
- uiDefBut(block, BUT, B_RAD_INIT, "Limit Subdivide", 5, 0, 10, 10, NULL, 0, 0, 0, 0, "Subdivides patches");
-}
-
-
-static void radio_panel_render(Radio *rad)
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "radio_panel_render", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Radio Render", "Radio", 0, 0, 318, 204)==0) return;
- uiAutoBlock(block, 210, 30, 230, 150, UI_BLOCK_ROWS);
-
- uiDefButS(block, NUMSLI, B_RAD_LIMITS, "Hemires:", 0, 0, 10, 10, &rad->hemires, 100.0, 1000.0, 100, 0, "Sets the size of a hemicube");
- uiDefButS(block, NUM, B_NOP, "Max Iterations:", 2, 0, 10, 15, &rad->maxiter, 0.0, 10000.0, 0, 0, "Limits the maximum number of radiosity rounds");
- uiDefButF(block, NUM, B_RAD_FAC, "Mult:", 3, 0, 10, 15, &rad->radfac, 0.001, 250.0, 100, 0, "Mulitplies the energy values");
- uiDefButF(block, NUM, B_RAD_FAC, "Gamma:", 3, 0, 10, 15, &rad->gamma, 0.2, 10.0, 10, 0, "Changes the contrast of the energy values");
- uiDefButF(block, NUMSLI, B_NOP, "Convergence:", 5, 0, 10, 10, &rad->convergence, 0.0, 1.0, 10, 0, "Sets the lower threshold of unshot energy");
-}
-
-
-/* ***************************** WORLD ************************** */
-
-void do_worldbuts(unsigned short event)
-{
- static short mtexcopied=0;
- static MTex mtexcopybuf;
- World *wrld;
- MTex *mtex;
-
- switch(event) {
- case B_TEXCLEARWORLD:
- wrld= G.buts->lockpoin;
- mtex= wrld->mtex[ wrld->texact ];
- if(mtex) {
- if(mtex->tex) mtex->tex->id.us--;
- MEM_freeN(mtex);
- wrld->mtex[ wrld->texact ]= 0;
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWOOPS, 0);
- BIF_undo_push("Unlink world texture");
- BIF_preview_changed(ID_WO);
- }
- break;
- case B_WMTEXCOPY:
- wrld= G.buts->lockpoin;
- if(wrld && wrld->mtex[(int)wrld->texact] ) {
- mtex= wrld->mtex[(int)wrld->texact];
- if(mtex->tex==NULL) {
- error("No texture available");
- }
- else {
- memcpy(&mtexcopybuf, wrld->mtex[(int)wrld->texact], sizeof(MTex));
- mtexcopied= 1;
- }
- }
- break;
- case B_WMTEXPASTE:
- wrld= G.buts->lockpoin;
- if(wrld && mtexcopied && mtexcopybuf.tex) {
- if(wrld->mtex[(int)wrld->texact]==NULL )
- wrld->mtex[(int)wrld->texact]= MEM_mallocN(sizeof(MTex), "mtex");
- else if(wrld->mtex[(int)wrld->texact]->tex)
- wrld->mtex[(int)wrld->texact]->tex->id.us--;
-
- memcpy(wrld->mtex[(int)wrld->texact], &mtexcopybuf, sizeof(MTex));
-
- id_us_plus((ID *)mtexcopybuf.tex);
- BIF_undo_push("Paste mapping settings");
- BIF_preview_changed(ID_WO);
- scrarea_queue_winredraw(curarea);
- }
- break;
- case B_AO_FALLOFF:
- /* falloff distances option only supports plain */
- wrld= G.buts->lockpoin;
- if(wrld)
- wrld->aocolor= WO_AOPLAIN;
- scrarea_queue_winredraw(curarea);
- break;
- }
-}
-
-static void world_panel_mapto(World *wrld)
-{
- uiBlock *block;
- MTex *mtex;
-
- block= uiNewBlock(&curarea->uiblocks, "world_panel_mapto", UI_EMBOSS, UI_HELV, curarea->win);
- uiNewPanelTabbed("Texture and Input", "World");
- if(uiNewPanel(curarea, block, "Map To", "World", 1280, 0, 318, 204)==0) return;
-
- uiSetButLock(wrld->id.lib!=0, ERROR_LIBDATA_MESSAGE);
-
- mtex= wrld->mtex[ wrld->texact ];
- if(mtex==NULL) {
- mtex= &emptytex;
- default_mtex(mtex);
- mtex->texco= TEXCO_VIEW;
- }
-
- /* TEXTURE OUTPUT */
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, MTEX_STENCIL, B_WORLDPRV, "Stencil", 10,125,45,19, &(mtex->texflag), 0, 0, 0, 0, "Use this texture as a blending value on the next texture");
- uiDefButBitS(block, TOG, MTEX_NEGATIVE, B_WORLDPRV, "Neg", 55,125,30,19, &(mtex->texflag), 0, 0, 0, 0, "Inverts the values of the texture to reverse its effect");
- uiDefButBitS(block, TOG, MTEX_RGBTOINT, B_WORLDPRV, "No RGB", 85,125,60,19, &(mtex->texflag), 0, 0, 0, 0, "Converts texture RGB values to intensity (gray) values");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButF(block, COL, B_WORLDPRV, "", 10,100,135,19, &(mtex->r), 0, 0, 0, B_MTEXCOL, "");
- uiDefButF(block, NUMSLI, B_WORLDPRV, "R ", 10,80,135,19, &(mtex->r), 0.0, 1.0, B_MTEXCOL, 0, "The default color for textures that don't return RGB");
- uiDefButF(block, NUMSLI, B_WORLDPRV, "G ", 10,60,135,19, &(mtex->g), 0.0, 1.0, B_MTEXCOL, 0, "The default color for textures that don't return RGB");
- uiDefButF(block, NUMSLI, B_WORLDPRV, "B ", 10,40,135,19, &(mtex->b), 0.0, 1.0, B_MTEXCOL, 0, "The default color for textures that don't return RGB");
- uiBlockEndAlign(block);
- uiDefButF(block, NUMSLI, B_WORLDPRV, "DVar ", 10,10,135,19, &(mtex->def_var), 0.0, 1.0, 0, 0, "Value to use for Ref, Spec, Amb, Emit, Alpha, RayMir, TransLu and Hard");
-
- /* MAP TO */
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, WOMAP_BLEND, B_WORLDPRV, "Blend", 10,180,75,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the color progression of the background");
- uiDefButBitS(block, TOG, WOMAP_HORIZ, B_WORLDPRV, "Hori", 85,180,75,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the color of the horizon");
- uiDefButBitS(block, TOG, WOMAP_ZENUP, B_WORLDPRV, "ZenUp", 160,180,75,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the color of the zenith above");
- uiDefButBitS(block, TOG, WOMAP_ZENDOWN, B_WORLDPRV, "ZenDo", 235,180,75,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the color of the zenith below");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButS(block, MENU, B_WORLDPRV, mapto_blendtype_pup(),155,125,155,19, &(mtex->blendtype), 0, 0, 0, 0, "Texture blending mode");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_WORLDPRV, "Col ", 155,100,155,19, &(mtex->colfac), 0.0, 1.0, 0, 0, "Sets the amount the texture affects color values");
- uiDefButF(block, NUMSLI, B_WORLDPRV, "Nor ", 155,80,155,19, &(mtex->norfac), 0.0, 1.0, 0, 0, "Sets the amount the texture affects normal values");
- uiDefButF(block, NUMSLI, B_WORLDPRV, "Var ", 155,60,155,19, &(mtex->varfac), 0.0, 1.0, 0, 0, "Sets the amount the texture affects other values");
-
-}
-
-static void world_panel_texture(World *wrld)
-{
- uiBlock *block;
- MTex *mtex;
- ID *id;
- int a, loos;
- char str[64], *strp;
-
- block= uiNewBlock(&curarea->uiblocks, "world_panel_texture", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Texture and Input", "World", 960, 0, 318, 204)==0) return;
-
- uiSetButLock(wrld->id.lib!=0, ERROR_LIBDATA_MESSAGE);
-
- /* TEX CHANNELS */
- uiBlockSetCol(block, TH_BUT_NEUTRAL);
- uiBlockBeginAlign(block);
- for(a= 0; a<MAX_MTEX; a++) {
- mtex= wrld->mtex[a];
- if(mtex && mtex->tex) splitIDname(mtex->tex->id.name+2, str, &loos);
- else strcpy(str, "");
- str[10]= 0;
- uiDefButS(block, ROW, REDRAWBUTSSHADING, str,10, 160-18*a, 80, 20, &(wrld->texact), 3.0, (float)a, 0, 0, "Texture channel");
- }
- uiBlockEndAlign(block);
-
- mtex= wrld->mtex[ wrld->texact ];
- if(mtex==NULL) {
- mtex= &emptytex;
- default_mtex(mtex);
- mtex->texco= TEXCO_VIEW;
- }
-
- /* TEXTUREBLOCK SELECT */
- uiBlockSetCol(block, TH_BUT_SETTING2);
- id= (ID *)mtex->tex;
- IDnames_to_pupstring(&strp, NULL, "ADD NEW %x 32767", &(G.main->tex), id, &(G.buts->texnr));
- uiDefButS(block, MENU, B_WTEXBROWSE, strp, 100,140,20,19, &(G.buts->texnr), 0, 0, 0, 0, "Selects an existing texture or creates new");
- MEM_freeN(strp);
-
- if(id) {
- uiDefBut(block, TEX, B_IDNAME, "TE:", 100,160,200,19, id->name+2, 0.0, 21.0, 0, 0, "Displays name of the texture block: click to change");
- sprintf(str, "%d", id->us);
- uiDefBut(block, BUT, 0, str, 196,140,21,19, 0, 0, 0, 0, 0, "Displays number of users of texture: click to make single user");
- uiDefIconBut(block, BUT, B_AUTOTEXNAME, ICON_AUTO, 220,140,21,19, 0, 0, 0, 0, 0, "Auto-assigns name to texture");
- if(id->lib) {
- if(wrld->id.lib) uiDefIconBut(block, BUT, 0, ICON_DATALIB, 219,140,21,19, 0, 0, 0, 0, 0, "");
- else uiDefIconBut(block, BUT, 0, ICON_PARLIB, 219,140,21,19, 0, 0, 0, 0, 0, "");
- }
- uiBlockSetCol(block, TH_AUTO);
- uiDefBut(block, BUT, B_TEXCLEARWORLD, "Clear", 122, 140, 72, 19, 0, 0, 0, 0, 0, "Erases link to texture");
- }
- else
- uiDefButS(block, TOG, B_WTEXBROWSE, "Add New" ,100, 160, 200, 19, &(G.buts->texnr), -1.0, 32767.0, 0, 0, "Adds a new texture datablock");
-
- uiBlockSetCol(block, TH_AUTO);
-
- /* copy/paste */
- uiBlockBeginAlign(block);
- uiDefIconBut(block, BUT, B_WMTEXCOPY, ICON_COPYUP, 250,140,25,19, 0, 0, 0, 0, 0, "Copies the mapping settings to the buffer");
- uiDefIconBut(block, BUT, B_WMTEXPASTE, ICON_PASTEUP,275,140,25,19, 0, 0, 0, 0, 0, "Pastes the mapping settings from the buffer");
-
- /* TEXCO */
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW, B_WORLDPRV, "View", 100,110,100,20, &(mtex->texco), 4.0, (float)TEXCO_VIEW, 0, 0, "Uses view vector for the texture coordinates");
- uiDefButS(block, ROW, B_WORLDPRV, "Global", 200,110,100,20, &(mtex->texco), 4.0, (float)TEXCO_GLOB, 0, 0, "Uses global coordinates for the texture coordinates (interior mist)");
-
- uiDefButS(block, ROW, B_WORLDPRV, "AngMap", 100,90,70,20, &(mtex->texco), 4.0, (float)TEXCO_ANGMAP, 0, 0, "Uses 360 degree angular coordinates, e.g. for spherical light probes");
- uiDefButS(block, ROW, B_WORLDPRV, "Sphere", 170,90,65,20, &(mtex->texco), 4.0, (float)TEXCO_H_SPHEREMAP, 0, 0, "For 360 degree panorama sky, spherical mapped, only top half");
- uiDefButS(block, ROW, B_WORLDPRV, "Tube", 235,90,65,20, &(mtex->texco), 4.0, (float)TEXCO_H_TUBEMAP, 0, 0, "For 360 degree panorama sky, cylindrical mapped, only top half");
-
- uiDefButS(block, ROW, B_WORLDPRV, "Object", 100,70,70,20, &(mtex->texco), 4.0, (float)TEXCO_OBJECT, 0, 0, "Uses linked object's coordinates for texture coordinates");
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_WORLDPRV, "OB:", 170,70,130,20, &(mtex->object), "Object name to use for mapping");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_WORLDPRV, "dX", 100,40,100,19, mtex->ofs, -20.0, 20.0, 10, 0, "Fine tunes texture mapping X coordinate");
- uiDefButF(block, NUM, B_WORLDPRV, "dY", 100,20,100,19, mtex->ofs+1, -20.0, 20.0, 10, 0, "Fine tunes texture mapping Y coordinate");
- uiDefButF(block, NUM, B_WORLDPRV, "dZ", 100, 0,100,19, mtex->ofs+2, -20.0, 20.0, 10, 0, "Fine tunes texture mapping Z coordinate");
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_WORLDPRV, "sizeX", 200,40,100,19, mtex->size, -10.0, 10.0, 10, 0, "Sets scaling for the texture's X size");
- uiDefButF(block, NUM, B_WORLDPRV, "sizeY", 200,20,100,19, mtex->size+1, -10.0, 10.0, 10, 0, "Sets scaling for the texture's Y size");
- uiDefButF(block, NUM, B_WORLDPRV, "sizeZ", 200, 0,100,19, mtex->size+2, -10.0, 10.0, 10, 0, "Sets scaling for the texture's Z size");
-
-}
-
-static void world_panel_mistaph(World *wrld)
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "world_panel_mistaph", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Mist / Stars / Physics", "World", 640, 0, 318, 204)==0) return;
-
- uiSetButLock(wrld->id.lib!=0, ERROR_LIBDATA_MESSAGE);
-
-#if GAMEBLENDER == 1
- uiDefButI(block, MENU, 1,
-#ifdef USE_ODE
- "Physics %t|None %x0|Sumo %x2|Ode %x4 |Bullet %x5",
-#else
- //"Physics %t|None %x0|Sumo %x2|Bullet %x5", //disable Sumo, until too many people complain ;-)
- "Physics %t|None %x0|Sumo (deprecated) %x2|Bullet %x5",
-#endif
- 10,180,140,19, &wrld->physicsEngine, 0, 0, 0, 0,
- "Physics Engine");
-
- /* Gravitation for the game worlds */
- uiDefButF(block, NUMSLI,0, "Grav ", 150,180,150,19, &(wrld->gravity), 0.0, 25.0, 0, 0, "Sets the gravitation constant of the game world");
-#endif
-
- uiBlockSetCol(block, TH_BUT_SETTING1);
- uiDefButBitS(block, TOG, WO_MIST, B_WORLDPRV2,"Mist", 10,120,140,19, &wrld->mode, 0, 0, 0, 0, "Toggles mist simulation");
- uiBlockSetCol(block, TH_AUTO);
-
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW, B_WORLDPRV2, "Quad", 10, 90, 40, 19, &wrld->mistype, 1.0, 0.0, 0, 0, "Mist uses quadratic progression");
- uiDefButS(block, ROW, B_WORLDPRV2, "Lin", 50, 90, 50, 19, &wrld->mistype, 1.0, 1.0, 0, 0, "Mist uses linear progression");
- uiDefButS(block, ROW, B_WORLDPRV2, "Sqr", 100, 90, 50, 19, &wrld->mistype, 1.0, 2.0, 0, 0, "Mist uses inverse quadratic progression");
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM,B_WORLDPRV2, "Start:",10,70,140,19, &wrld->miststa, 0.0, 10000.0, 10, 0, "Specifies the starting distance of the mist");
- uiDefButF(block, NUM,B_WORLDPRV2, "Dist:",10,50,140,19, &wrld->mistdist, 0.0,10000.0, 10, 00, "Specifies the depth of the mist");
- uiDefButF(block, NUM,B_WORLDPRV2,"Height:", 10,30,140,19, &wrld->misthi,0.0,100.0, 10, 0, "Specifies the factor for a less dense mist with increasing height");
- uiDefButF(block, NUMSLI, B_WORLDPRV2, "Misi ", 10,10,140,19, &(wrld->misi), 0., 1.0, 0, 0, "Sets the mist intensity");
- uiBlockEndAlign(block);
-
- uiBlockSetCol(block, TH_BUT_SETTING1);
- uiDefButBitS(block, TOG, WO_STARS, B_WORLDPRV2, "Stars",160,120,140,19, &wrld->mode, 0, 0, 0, 0, "Toggles starfield generation");
- uiBlockSetCol(block, TH_AUTO);
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM,B_WORLDPRV2,"StarDist:", 160,70,140,19, &(wrld->stardist), 2.0, 1000.0, 100, 0, "Specifies the average distance between any two stars");
- uiDefButF(block, NUM,B_WORLDPRV2,"MinDist:", 160,50,140,19, &(wrld->starmindist), 0.0, 1000.0, 100, 0, "Specifies the minimum distance to the camera for stars");
- uiDefButF(block, NUMSLI,B_WORLDPRV2,"Size:", 160,30,140,19, &(wrld->starsize), 0.0, 10.0, 10, 0, "Specifies the average screen dimension of stars");
- uiDefButF(block, NUMSLI,B_WORLDPRV2,"Colnoise:", 160,10,140,19, &(wrld->starcolnoise), 0.0, 1.0, 100, 0, "Randomizes star color");
- uiBlockEndAlign(block);
-
-}
-
-static void world_panel_amb_occ(World *wrld)
-{
- uiBlock *block;
- short yco=PANEL_YMAX;
-
- block= uiNewBlock(&curarea->uiblocks, "world_panel_amb_oc", UI_EMBOSS, UI_HELV, curarea->win);
- uiNewPanelTabbed("Mist / Stars / Physics", "World");
- if(uiNewPanel(curarea, block, "Amb Occ", "World", PANELX, PANELY, PANELW, PANELH)==0) return;
-
- uiBlockSetCol(block, TH_BUT_SETTING1);
- uiDefButBitS(block, TOG, WO_AMB_OCC, B_REDR, "Ambient Occlusion",
- X2CLM1, yco-=BUTH, BUTW1, BUTH, &wrld->mode, 0, 0, 0, 0, "Toggles ambient occlusion (soft shadows)");
- uiBlockSetCol(block, TH_AUTO);
-
- if(!(wrld->mode & WO_AMB_OCC)) return;
-
- yco -= YSPACE;
-
- uiDefButS(block, NUM, B_REDR, "Samples:",
- X2CLM1, yco-=BUTH, BUTW2, BUTH, &wrld->aosamp, 1.0, 32.0, 100, 0, "Sets the number of samples used for AO (actual number: squared)");
-
- yco -= YSPACE;
-
- uiDefButF(block, NUM, B_REDR, "Max Dist:",
- X2CLM1, yco-=BUTH, BUTW2, BUTH, &wrld->aodist, 0.001, 5000.0, 100, 0, "Sets length of AO rays, defines how far away other faces give occlusion effect");
-
- yco -= YSPACE;
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, WO_AODIST, B_AO_FALLOFF, "Use Falloff",
- X2CLM1, yco-=BUTH, BUTW2, BUTH, &wrld->aomode, 0, 0, 0, 0, "When enabled, distances to objects will be used to attenuate shadows. Only for Plain AO.");
- if (wrld->aomode & WO_AODIST)
- uiDefButF(block, NUM, B_REDR, "Strength:",
- X2CLM1, yco-=BUTH, BUTW2, BUTH, &wrld->aodistfac, 0.00001, 10.0, 100, 0, "Distance attenuation factor, the higher, the 'shorter' the shadows");
- uiBlockEndAlign(block);
-
- /* column 2 */
- yco = PANEL_YMAX - BUTH - YSPACE;
-
- uiDefButS(block, MENU, B_REDR, "Constant QMC %x2|Adaptive QMC %x1|Constant Jittered %x0",
- X2CLM2, yco-=BUTH, BUTW2, BUTH, &wrld->ao_samp_method, 0, 0, 0, 0, "Method for generating shadow samples: Constant QMC: best quality, Adaptive QMC: fast in high contrast areas");
-
- yco -= YSPACE;
-
- if (wrld->ao_samp_method == WO_AOSAMP_HALTON) {
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_REDR, "Threshold:",
- X2CLM2, yco-=BUTH, BUTW2, BUTH, &wrld->ao_adapt_thresh, 0.0, 1.0, 100, 0, "Samples below this threshold will be considered fully shadowed/unshadowed and skipped");
- uiDefButF(block, NUMSLI, B_REDR, "Adapt Vec:",
- X2CLM2, yco-=BUTH, BUTW2, BUTH, &wrld->ao_adapt_speed_fac, 0.0, 1.0, 100, 0, "Use the speed vector pass to reduce AO samples in fast moving pixels. The higher the value, the more aggressive the sample reduction. Requires Vec pass enabled.");
- uiBlockEndAlign(block);
- } else if (wrld->ao_samp_method == WO_AOSAMP_CONSTANT) {
- uiDefButF(block, NUMSLI, B_REDR, "Bias:",
- X2CLM2, yco-=BUTH, BUTW2, BUTH, &wrld->aobias, 0.0, 0.5, 10, 0, "Sets bias to prevent smoothed faces to show banding (in radians)");
- }
-
-
- yco = PANEL_YMAX - (5*BUTH+4*YSPACE);
-
- /* result mix modes */
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW, B_REDR, "Add",
- X3CLM1, yco-=BUTH, BUTW3, BUTH, &wrld->aomix, 1.0, (float)WO_AOADD, 0, 0, "adds light/shadows");
- uiDefButS(block, ROW, B_REDR, "Sub",
- X3CLM2, yco, BUTW3, BUTH, &wrld->aomix, 1.0, (float)WO_AOSUB, 0, 0, "subtracts light/shadows (needs at least one normal light to make anything visible)");
- uiDefButS(block, ROW, B_REDR, "Both",
- X3CLM3, yco, BUTW3, BUTH, &wrld->aomix, 1.0, (float)WO_AOADDSUB, 0, 0, "both lightens & darkens");
-
- yco -= YSPACE;
-
- /* color treatment */
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW, B_REDR, "Plain",
- X3CLM1, yco-=BUTH, BUTW3, BUTH, &wrld->aocolor, 2.0, (float)WO_AOPLAIN, 0, 0, "Plain diffuse energy (white)");
- uiDefButS(block, ROW, B_REDR, "Sky Color",
- X3CLM2, yco, BUTW3, BUTH, &wrld->aocolor, 2.0, (float)WO_AOSKYCOL, 0, 0, "Use horizon and zenith color for diffuse energy");
- uiDefButS(block, ROW, B_REDR, "Sky Texture",
- X3CLM3, yco, BUTW3, BUTH, &wrld->aocolor, 2.0, (float)WO_AOSKYTEX, 0, 0, "Does full Sky texture render for diffuse energy");
- uiBlockEndAlign(block);
-
- yco -= YSPACE;
-
- uiDefButF(block, NUMSLI, B_REDR, "Energy:",
- X2CLM1, yco-=BUTH, BUTW2, BUTH, &wrld->aoenergy, 0.01, 3.0, 100, 0, "Sets global energy scale for AO");
-
-}
-
-static void world_panel_world(World *wrld)
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "world_panel_world", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "World", "World", 320, 0, 318, 204)==0) return;
-
- uiBlockSetCol(block, TH_BUT_SETTING2);
- std_libbuttons(block, 10, 180, 0, NULL, B_WORLDBROWSE, ID_WO, 0, (ID *)wrld, (ID *)G.scene, &(G.buts->menunr), B_WORLDALONE, B_WORLDLOCAL, B_WORLDDELETE, 0, B_KEEPDATA);
-
- if(wrld==NULL) return;
-
- uiSetButLock(wrld->id.lib!=0, ERROR_LIBDATA_MESSAGE);
- uiBlockSetCol(block, TH_AUTO);
-
- uiBlockBeginAlign(block);
- uiDefButF(block, COL, B_WORLDPRV, "", 10,150,145,19, &wrld->horr, 0, 0, 0, B_COLHOR, "");
- uiDefButF(block, NUMSLI,B_WORLDPRV,"HoR ", 10,130,145,19, &(wrld->horr), 0.0, 1.0, B_COLHOR,0, "Sets the amount of red color at the horizon");
- uiDefButF(block, NUMSLI,B_WORLDPRV,"HoG ", 10,110,145,19, &(wrld->horg), 0.0, 1.0, B_COLHOR,0, "Sets the amount of green color at the horizon");
- uiDefButF(block, NUMSLI,B_WORLDPRV,"HoB ", 10,90,145,19, &(wrld->horb), 0.0, 1.0, B_COLHOR,0, "Sets the amount of blue color at the horizon");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, COL, B_WORLDPRV, "", 160,150,145,19, &wrld->zenr, 0, 0, 0, B_COLZEN, "");
- uiDefButF(block, NUMSLI,B_WORLDPRV,"ZeR ", 160,130,145,19, &(wrld->zenr), 0.0, 1.0, B_COLZEN,0, "Sets the amount of red color at the zenith");
- uiDefButF(block, NUMSLI,B_WORLDPRV,"ZeG ", 160,110,145,19, &(wrld->zeng), 0.0, 1.0, B_COLZEN,0, "Sets the amount of green color at the zenith");
- uiDefButF(block, NUMSLI,B_WORLDPRV,"ZeB ", 160,90,145,19, &(wrld->zenb), 0.0, 1.0, B_COLZEN,0, "Sets the amount of blue color at the zenith");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, COL, B_WORLDPRV, "", 10,70,145,19, &wrld->ambr, 0, 0, 0, 0, "");
- uiDefButF(block, NUMSLI,B_WORLDPRV,"AmbR ", 10,50,145,19, &(wrld->ambr), 0.0, 1.0 ,0,0, "Sets the amount of red ambient color");
- uiDefButF(block, NUMSLI,B_WORLDPRV,"AmbG ", 10,30,145,19, &(wrld->ambg), 0.0, 1.0 ,0,0, "Sets the amount of green ambient color");
- uiDefButF(block, NUMSLI,B_WORLDPRV,"AmbB ", 10,10,145,19, &(wrld->ambb), 0.0, 1.0 ,0,0, "Sets the amount of blue ambient color");
-
- uiBlockBeginAlign(block);
- uiBlockSetCol(block, TH_BUT_SETTING1);
- uiDefButF(block, NUMSLI,B_WORLDPRV, "Exp ", 160,30,145,19, &(wrld->exp), 0.0, 1.0, 0, 2, "Sets amount of exponential color correction for light");
- uiDefButF(block, NUMSLI,B_WORLDPRV, "Range ", 160,10,145,19, &(wrld->range), 0.2, 5.0, 0, 2, "Sets the color amount that will be mapped on color 1.0");
-
-
-}
-
-static void world_panel_preview(World *wrld)
-{
- uiBlock *block;
-
- /* name "Preview" is abused to detect previewrender offset panel */
- block= uiNewBlock(&curarea->uiblocks, "world_panel_preview", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Preview", "World", 0, 0, 318, 204)==0) return;
-
- if(wrld==NULL) return;
-
- uiSetButLock(wrld->id.lib!=0, ERROR_LIBDATA_MESSAGE);
-
- uiBlockSetDrawExtraFunc(block, BIF_previewdraw);
-
- // label to force a boundbox for buttons not to be centered
- uiDefBut(block, LABEL, 0, " ", 20,20,10,10, 0, 0, 0, 0, 0, "");
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, WO_SKYREAL, B_WORLDPRV,"Real", 200,175,80,25, &wrld->skytype, 0, 0, 0, 0, "Renders background with a real horizon");
- uiDefButBitS(block, TOG, WO_SKYBLEND, B_WORLDPRV,"Blend",200,150,80,25, &wrld->skytype, 0, 0, 0, 0, "Renders background with natural progression from horizon to zenith");
- uiDefButBitS(block, TOG,WO_SKYPAPER, B_WORLDPRV,"Paper",200,125,80,25, &wrld->skytype, 0, 0, 0, 0, "Flattens blend or texture coordinates");
- uiBlockEndAlign(block);
-
-}
-
-/* ************************ LAMP *************************** */
-
-void do_lampbuts(unsigned short event)
-{
- static short mtexcopied=0;
- static MTex mtexcopybuf;
- Lamp *la;
- MTex *mtex;
-
- switch(event) {
- case B_LAMPREDRAW:
- BIF_preview_changed(ID_LA);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSSHADING, 0);
- break;
- case B_TEXCLEARLAMP:
- la= G.buts->lockpoin;
- mtex= la->mtex[ la->texact ];
- if(mtex) {
- if(mtex->tex) mtex->tex->id.us--;
- MEM_freeN(mtex);
- la->mtex[ la->texact ]= 0;
- BIF_undo_push("Unlink world texture");
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWOOPS, 0);
- BIF_preview_changed(ID_LA);
- }
- break;
- case B_SBUFF:
- la= G.buts->lockpoin;
- la->bufsize = la->bufsize&=(~15);
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWOOPS, 0);
- break;
- case B_SHADBUF:
- la= G.buts->lockpoin;
- la->mode &= ~LA_SHAD_RAY;
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_SHADRAY:
- la= G.buts->lockpoin;
- la->mode &= ~LA_SHAD_BUF;
- /* yafray: 'softlight' uses it's own shadbuf. flag.
- Must be cleared here too when switching from ray shadow */
- la->mode &= ~LA_YF_SOFT;
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_LMTEXCOPY:
- la= G.buts->lockpoin;
- if(la && la->mtex[(int)la->texact] ) {
- mtex= la->mtex[(int)la->texact];
- if(mtex->tex==NULL) {
- error("No texture available");
- }
- else {
- memcpy(&mtexcopybuf, la->mtex[(int)la->texact], sizeof(MTex));
- mtexcopied= 1;
- }
- }
- break;
- case B_LMTEXPASTE:
- la= G.buts->lockpoin;
- if(la && mtexcopied && mtexcopybuf.tex) {
- if(la->mtex[(int)la->texact]==NULL )
- la->mtex[(int)la->texact]= MEM_mallocN(sizeof(MTex), "mtex");
- else if(la->mtex[(int)la->texact]->tex)
- la->mtex[(int)la->texact]->tex->id.us--;
-
- memcpy(la->mtex[(int)la->texact], &mtexcopybuf, sizeof(MTex));
-
- id_us_plus((ID *)mtexcopybuf.tex);
- BIF_undo_push("Paste mapping settings");
- BIF_preview_changed(ID_LA);
- scrarea_queue_winredraw(curarea);
- }
- break;
- case B_LFALLOFFCHANGED:
- la= G.buts->lockpoin;
- curvemapping_changed(la->curfalloff, 1);
- BIF_undo_push("Edit Lamp falloff curve");
- BIF_preview_changed(ID_LA);
- scrarea_queue_winredraw(curarea);
- break;
-
- }
-}
-
-
-static void lamp_panel_mapto(Object *ob, Lamp *la)
-{
- uiBlock *block;
- MTex *mtex;
-
- block= uiNewBlock(&curarea->uiblocks, "lamp_panel_mapto", UI_EMBOSS, UI_HELV, curarea->win);
- uiNewPanelTabbed("Texture and Input", "Lamp");
- if(uiNewPanel(curarea, block, "Map To", "Lamp", 1280, 0, 318, 204)==0) return;
-
- uiSetButLock(la->id.lib!=0, ERROR_LIBDATA_MESSAGE);
-
- mtex= la->mtex[ la->texact ];
- if(mtex==NULL) {
- mtex= &emptytex;
- default_mtex(mtex);
- mtex->texco= TEXCO_VIEW;
- }
-
- /* TEXTURE OUTPUT */
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, MTEX_STENCIL, B_LAMPPRV, "Stencil", 10,125,45,19, &(mtex->texflag), 0, 0, 0, 0, "Use this texture as a blending value on the next texture");
- uiDefButBitS(block, TOG, MTEX_NEGATIVE, B_LAMPPRV, "Neg", 55,125,30,19, &(mtex->texflag), 0, 0, 0, 0, "Inverts the values of the texture to reverse its effect");
- uiDefButBitS(block, TOG, MTEX_RGBTOINT, B_LAMPPRV, "No RGB", 85,125,60,19, &(mtex->texflag), 0, 0, 0, 0, "Converts texture RGB values to intensity (gray) values");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButF(block, COL, B_LAMPPRV, "", 10,100,135,19, &(mtex->r), 0, 0, 0, B_MTEXCOL, "");
- uiDefButF(block, NUMSLI, B_LAMPPRV, "R ", 10,80,135,19, &(mtex->r), 0.0, 1.0, B_MTEXCOL, 0, "The default color for textures that don't return RGB");
- uiDefButF(block, NUMSLI, B_LAMPPRV, "G ", 10,60,135,19, &(mtex->g), 0.0, 1.0, B_MTEXCOL, 0, "The default color for textures that don't return RGB");
- uiDefButF(block, NUMSLI, B_LAMPPRV, "B ", 10,40,135,19, &(mtex->b), 0.0, 1.0, B_MTEXCOL, 0, "The default color for textures that don't return RGB");
- uiBlockEndAlign(block);
- uiDefButF(block, NUMSLI, B_LAMPPRV, "DVar ", 10,10,135,19, &(mtex->def_var), 0.0, 1.0, 0, 0, "Value to use for Ref, Spec, Amb, Emit, Alpha, RayMir, TransLu and Hard");
-
- /* MAP TO */
- uiDefButBitS(block, TOG, MAP_COL, B_LAMPPRV, "Col", 10,180,135,19, &(mtex->mapto), 0, 0, 0, 0, "Lets the texture affect the basic color of the lamp");
-
- uiBlockBeginAlign(block);
- uiDefButS(block, MENU, B_LAMPPRV, mapto_blendtype_pup(),155,125,155,19, &(mtex->blendtype), 0, 0, 0, 0, "Texture blending mode");
- uiBlockEndAlign(block);
-
- uiDefButF(block, NUMSLI, B_LAMPPRV, "Col ", 155,100,155,19, &(mtex->colfac), 0.0, 1.0, 0, 0, "Sets the amount the texture affects color values");
-
-}
-
-
-static void lamp_panel_texture(Object *ob, Lamp *la)
-{
- uiBlock *block;
- MTex *mtex;
- ID *id;
- int a, loos;
- char *strp, str[64];
-
- block= uiNewBlock(&curarea->uiblocks, "lamp_panel_texture", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Texture and Input", "Lamp", 960, 0, 318, 204)==0) return;
-
- uiSetButLock(la->id.lib!=0, ERROR_LIBDATA_MESSAGE);
-
- /* TEX CHANNELS */
- uiBlockSetCol(block, TH_BUT_NEUTRAL);
- uiBlockBeginAlign(block);
- for(a= 0; a<MAX_MTEX; a++) {
- mtex= la->mtex[a];
- if(mtex && mtex->tex) splitIDname(mtex->tex->id.name+2, str, &loos);
- else strcpy(str, "");
- str[10]= 0;
- uiDefButS(block, ROW, B_REDR, str, 10, 160-18*a, 80, 20, &(la->texact), 3.0, (float)a, 0, 0, "");
- }
- uiBlockEndAlign(block);
-
- mtex= la->mtex[ la->texact ];
- if(mtex==NULL) {
- mtex= &emptytex;
- default_mtex(mtex);
- mtex->texco= TEXCO_VIEW;
- }
-
- /* TEXTUREBLOK SELECT */
- uiBlockSetCol(block, TH_BUT_SETTING2);
- id= (ID *)mtex->tex;
- IDnames_to_pupstring(&strp, NULL, "ADD NEW %x 32767", &(G.main->tex), id, &(G.buts->texnr));
-
- /* doesnt work, because lockpoin points to lamp, not to texture */
- uiDefButS(block, MENU, B_LTEXBROWSE, strp, 100,140,20,19, &(G.buts->texnr), 0, 0, 0, 0, "Selects an existing texture or creates new");
- MEM_freeN(strp);
-
- if(id) {
- uiDefBut(block, TEX, B_IDNAME, "TE:", 100,160,200,19, id->name+2, 0.0, 21.0, 0, 0, "Displays name of the texture block: click to change");
- sprintf(str, "%d", id->us);
- uiDefBut(block, BUT, 0, str, 196,140,21,19, 0, 0, 0, 0, 0, "Displays number of users of texture: click to make single user");
- uiDefIconBut(block, BUT, B_AUTOTEXNAME, ICON_AUTO, 221,140,21,19, 0, 0, 0, 0, 0, "Auto-assigns name to texture");
- if(id->lib) {
- if(la->id.lib) uiDefIconBut(block, BUT, 0, ICON_DATALIB, 219,140,21,19, 0, 0, 0, 0, 0, "");
- else uiDefIconBut(block, BUT, 0, ICON_PARLIB, 219,140,21,19, 0, 0, 0, 0, 0, "");
- }
- uiBlockSetCol(block, TH_AUTO);
- uiDefBut(block, BUT, B_TEXCLEARLAMP, "Clear", 122, 140, 72, 19, 0, 0, 0, 0, 0, "Erases link to texture");
- }
- else
- uiDefButS(block, TOG, B_LTEXBROWSE, "Add New" ,100, 160, 200, 19, &(G.buts->texnr), -1.0, 32767.0, 0, 0, "Adds a new texture datablock");
-
- /* copy/paste */
- uiBlockBeginAlign(block);
- uiDefIconBut(block, BUT, B_LMTEXCOPY, ICON_COPYUP, 250,140,25,19, 0, 0, 0, 0, 0, "Copies the mapping settings to the buffer");
- uiDefIconBut(block, BUT, B_LMTEXPASTE, ICON_PASTEUP, 275,140,25,19, 0, 0, 0, 0, 0, "Pastes the mapping settings from the buffer");
-
- /* TEXCO */
- uiBlockSetCol(block, TH_AUTO);
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW, B_LAMPPRV, "Glob", 100,110,60,20, &(mtex->texco), 4.0, (float)TEXCO_GLOB, 0, 0, "Uses global coordinates for the texture coordinates");
- uiDefButS(block, ROW, B_LAMPPRV, "View", 160,110,70,20, &(mtex->texco), 4.0, (float)TEXCO_VIEW, 0, 0, "Uses view coordinates for the texture coordinates");
- uiDefButS(block, ROW, B_LAMPPRV, "Object", 230,110,70,20, &(mtex->texco), 4.0, (float)TEXCO_OBJECT, 0, 0, "Uses linked object's coordinates for texture coordinates");
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_LAMPPRV, "", 100,90,200,20, &(mtex->object), "");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_LAMPPRV, "dX", 100,50,100,18, mtex->ofs, -20.0, 20.0, 10, 0, "Fine tunes texture mapping X coordinate");
- uiDefButF(block, NUM, B_LAMPPRV, "dY", 100,30,100,18, mtex->ofs+1, -20.0, 20.0, 10, 0, "Fine tunes texture mapping Y coordinate");
- uiDefButF(block, NUM, B_LAMPPRV, "dZ", 100,10,100,18, mtex->ofs+2, -20.0, 20.0, 10, 0, "Fine tunes texture mapping Z coordinate");
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_LAMPPRV, "sizeX", 200,50,100,18, mtex->size, -10.0, 10.0, 10, 0, "Sets scaling for the texture's X size");
- uiDefButF(block, NUM, B_LAMPPRV, "sizeY", 200,30,100,18, mtex->size+1, -10.0, 10.0, 10, 0, "Sets scaling for the texture's Y size");
- uiDefButF(block, NUM, B_LAMPPRV, "sizeZ", 200,10,100,18, mtex->size+2, -10.0, 10.0, 10, 0, "Sets scaling for the texture's Z size");
- uiBlockEndAlign(block);
-}
-
-static void lamp_panel_spot(Object *ob, Lamp *la)
-{
- uiBlock *block;
- float grid=0.0;
-
- block= uiNewBlock(&curarea->uiblocks, "lamp_panel_spot", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Shadow and Spot", "Lamp", 640, 0, 318, 204)==0) return;
-
- /* hemis and ray shadow dont work at all... */
- /* yafray: ignore photonlight as well */
- if ((la->type==LA_HEMI) || (la->type==LA_YF_PHOTON)) return;
-
- if(G.vd) grid= G.vd->grid;
- if(grid<1.0) grid= 1.0;
-
- uiSetButLock(la->id.lib!=0, ERROR_LIBDATA_MESSAGE);
-
- uiBlockSetCol(block, TH_BUT_SETTING1);
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, LA_SHAD_RAY, B_SHADRAY,"Ray Shadow",10,180,80,19,&la->mode, 0, 0, 0, 0, "Use ray tracing for shadow");
- if(la->type==LA_SPOT) {
- uiDefButBitS(block, TOG, LA_SHAD_BUF, B_SHADBUF, "Buf.Shadow",10,160,80,19,&la->mode, 0, 0, 0, 0, "Lets spotlight produce shadows using shadow buffer");
- if(la->mode & LA_SHAD_BUF) {
- char *tip= "Regular buffer type";
- if(la->buftype==LA_SHADBUF_IRREGULAR)
- tip= "Irregular buffer produces sharp shadow always, but it doesn't show up for raytracing";
- else if(la->buftype==LA_SHADBUF_HALFWAY)
- tip= "Regular buffer, averaging the closest and 2nd closest Z value for reducing biasing";
-
- uiDefButC(block, MENU, B_REDR, "Classical %x0|Classic-Halfway %x2|Irregular %x1", 10,140,80,19,&la->buftype, 0, 0, 0, 0, tip);
- }
- }
- uiBlockEndAlign(block);
-
- uiDefButBitS(block, TOG, LA_ONLYSHADOW, B_LAMPPRV,"OnlyShadow", 10,110,80,19,&la->mode, 0, 0, 0, 0, "Causes light to cast shadows only without illuminating objects");
-
- if(la->type==LA_SPOT) {
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, LA_SQUARE, B_LAMPREDRAW,"Square", 10,60,80,19,&la->mode, 0, 0, 0, 0, "Sets square spotbundles");
- uiDefButBitS(block, TOG, LA_HALO, B_LAMPREDRAW,"Halo", 10,40,80,19,&la->mode, 0, 0, 0, 0, "Renders spotlight with a volumetric halo");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI,B_LAMPREDRAW,"SpotSi ", 100,180,200,19,&la->spotsize, 1.0, 180.0, 0, 0, "Sets the angle of the spotlight beam in degrees");
- uiDefButF(block, NUMSLI,B_LAMPREDRAW,"SpotBl ", 100,160,200,19,&la->spotblend, 0.0, 1.0, 0, 0, "Sets the softness of the spotlight edge");
- uiBlockEndAlign(block);
-
- uiDefButF(block, NUMSLI,B_LAMPREDRAW,"HaloInt ", 100,135,200,19,&la->haint, 0.0, 5.0, 0, 0, "Sets the intensity of the spotlight halo");
-
- if(la->mode & LA_SHAD_BUF) {
- if(ELEM(la->buftype, LA_SHADBUF_REGULAR, LA_SHADBUF_HALFWAY)) {
- uiBlockBeginAlign(block);
- uiDefButS(block, NUM,B_SBUFF,"ShadowBufferSize:", 100,110,200,19, &la->bufsize,512,10240, 0, 0, "Sets the size of the shadow buffer to nearest multiple of 16");
- uiDefButS(block, ROW,B_NOP, "Box", 100,90,65,19, &la->filtertype, 0.0, LA_SHADBUF_BOX, 0, 0, "Apply Box filter for shadowbuffer samples");
- uiDefButS(block, ROW,B_NOP, "Tent", 165,90,65,19, &la->filtertype, 0.0, LA_SHADBUF_TENT, 0, 0, "Apply Tent filter for shadowbuffer samples");
- uiDefButS(block, ROW,B_NOP, "Gauss", 230,90,70,19, &la->filtertype, 0.0, LA_SHADBUF_GAUSS, 0, 0, "Apply Gauss filter for shadowbuffer samples");
-
- // uiDefButS(block, ROW,B_NOP,"SubSamples: 1", 100,90,140,19, &la->buffers, 1.0, 1.0, 0, 0, "Amount of lampbuffer subsamples, a value of larger than 1 halves the shadowbuffer size");
- // uiDefButS(block, ROW,B_NOP,"4", 240,90,30,19, &la->buffers, 1.0, 4.0, 0, 0, "Amount of lampbuffer subsamples, this halves the actual shadowbuffer size");
- // uiDefButS(block, ROW,B_NOP,"9", 270,90,30,19, &la->buffers, 1.0, 9.0, 0, 0, "Amount of lampbuffer subsamples, this halves the shadowbuffer size");
-
- uiBlockBeginAlign(block);
- uiDefButS(block, NUM,B_LAMPREDRAW,"Samples:", 100,60,100,19, &la->samp,1.0,16.0, 0, 0, "Sets the number of shadow map samples");
- uiDefButS(block, NUM,B_NOP,"Halo step:", 200,60,100,19, &la->shadhalostep, 0.0, 12.0, 0, 0, "Sets the volumetric halo sampling frequency");
- uiDefButF(block, NUM,B_LAMPREDRAW,"Bias:", 100,40,100,19, &la->bias, 0.001, 5.0, 1, 0, "Sets the shadow map sampling bias");
- uiDefButF(block, NUM,B_LAMPREDRAW,"Soft:", 200,40,100,19, &la->soft,1.0,100.0, 100, 0, "Sets the size of the shadow sample area");
- }
- else { /* LA_SHADBUF_IRREGULAR */
- uiDefButF(block, NUM,B_LAMPREDRAW,"Bias:", 100,40,100,19, &la->bias, 0.01, 5.0, 1, 0, "Sets the shadow map sampling bias");
- }
-
- uiBlockBeginAlign(block);
- uiDefIconButBitC(block, TOG, LA_SHADBUF_AUTO_START, B_REDR, ICON_AUTO, 10, 10, 25, 19, &la->bufflag, 0.0, 0.0, 0, 0, "Automatic calculation of clipping-start, based on visible vertices");
- if(la->bufflag & LA_SHADBUF_AUTO_START)
- uiDefBut(block, LABEL, B_NOP, "ClipSta: Auto", 35,10,115,19, NULL, 0, 0, 0, 0, "");
- else
- uiDefButF(block, NUM,REDRAWVIEW3D,"ClipSta:", 35,10,115,19, &la->clipsta, 0.1*grid,1000.0*grid, 10, 0, "Sets the shadow map clip start: objects closer will not generate shadows");
- uiDefIconButBitC(block, TOG, LA_SHADBUF_AUTO_END, B_REDR, ICON_AUTO, 160, 10, 25, 19, &la->bufflag, 0.0, 0.0, 0, 0, "Automatic calculation of clipping-end, based on visible vertices");
- if(la->bufflag & LA_SHADBUF_AUTO_END)
- uiDefBut(block, LABEL,B_NOP, "ClipEnd: Auto", 185,10,115,19, NULL, 0, 0, 0, 0, "");
- else
- uiDefButF(block, NUM,REDRAWVIEW3D,"ClipEnd:", 185,10,115,19,&la->clipend, 1.0, 5000.0*grid, 100, 0, "Sets the shadow map clip end beyond which objects will not generate shadows");
- uiBlockEndAlign(block);
-
- }
- }
- if(ELEM4(la->type, LA_AREA, LA_SPOT, LA_SUN, LA_LOCAL) && (la->mode & LA_SHAD_RAY)) {
-
- if (ELEM3(la->type, LA_SPOT, LA_SUN, LA_LOCAL)) {
- if (la->ray_samp_method == LA_SAMP_CONSTANT) la->ray_samp_method = LA_SAMP_HALTON;
-
- uiDefButS(block, MENU, B_REDR, "Adaptive QMC %x1|Constant QMC %x2",
- 100,110,200,19, &la->ray_samp_method, 0, 0, 0, 0, "Method for generating shadow samples: Adaptive QMC is fastest, Constant QMC is less noisy but slower");
-
- uiDefButF(block, NUM,B_LAMPREDRAW,"Soft Size", 100,80,200,19, &la->area_size, 0.01, 100.0, 10, 0, "Area light size, doesn't affect energy amount");
-
- uiDefButS(block, NUM,0,"Samples:", 100,60,200,19, &la->ray_samp, 1.0, 16.0, 100, 0, "Sets the amount of samples taken extra (samp x samp)");
- uiDefButF(block, NUM,0,"Threshold:", 100,40,200,19, &la->adapt_thresh, 0.0, 1.0, 100, 0, "Threshold for adaptive sampling, to control what level is considered already in shadow");
- }
- else if (la->type == LA_AREA) {
- uiDefButS(block, MENU, B_REDR, "Adaptive QMC %x1|Constant QMC %x2|Constant Jittered %x0",
- 100,180,200,19, &la->ray_samp_method, 0, 0, 0, 0, "Method for generating shadow samples: Adaptive QMC is fastest");
-
- if(la->area_shape==LA_AREA_SQUARE)
- uiDefButS(block, NUM,0,"Samples:", 100,150,200,19, &la->ray_samp, 1.0, 16.0, 100, 0, "Sets the amount of samples taken extra (samp x samp)");
- else if(la->area_shape==LA_AREA_CUBE)
- uiDefButS(block, NUM,0,"Samples:", 100,130,200,19, &la->ray_samp, 1.0, 16.0, 100, 0, "Sets the amount of samples taken extra (samp x samp x samp)");
-
- if (ELEM(la->area_shape, LA_AREA_RECT, LA_AREA_BOX)) {
- uiDefButS(block, NUM,0,"SamplesX:", 100,150,200,19, &la->ray_samp, 1.0, 16.0, 100, 0, "Sets the amount of X samples taken extra");
- uiDefButS(block, NUM,0,"SamplesY:", 100,130,200,19, &la->ray_sampy, 1.0, 16.0, 100, 0, "Sets the amount of Y samples taken extra");
- if(la->area_shape==LA_AREA_BOX)
- uiDefButS(block, NUM,0,"SamplesZ:", 100,110,200,19, &la->ray_sampz, 1.0, 8.0, 100, 0, "Sets the amount of Z samples taken extra");
- }
-
- if (la->ray_samp_method == LA_SAMP_CONSTANT) {
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, LA_SAMP_UMBRA, 0,"Umbra", 100,90,200,19,&la->ray_samp_type, 0, 0, 0, 0, "Emphasis parts that are fully shadowed");
- uiDefButBitS(block, TOG, LA_SAMP_DITHER, 0,"Dither", 100,70,100,19,&la->ray_samp_type, 0, 0, 0, 0, "Use 2x2 dithering for sampling");
- uiDefButBitS(block, TOG, LA_SAMP_JITTER, 0,"Noise", 200,70,100,19,&la->ray_samp_type, 0, 0, 0, 0, "Use noise for sampling");
- } else if (la->ray_samp_method == LA_SAMP_HALTON) {
- uiDefButF(block, NUM,0,"Threshold:", 100,90,200,19, &la->adapt_thresh, 0.0, 1.0, 100, 0, "Threshold for adaptive sampling, to control what level is considered already in shadow");
- }
- }
-
-
- }
- else uiDefBut(block, LABEL,0," ", 100,180,200,19,NULL, 0, 0, 0, 0, "");
-
-}
-
-/* yafray: adaptation of lamp_panel_spot above with yafray specific parameters */
-static void lamp_panel_yafray(Object *ob, Lamp *la)
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "lamp_panel_yafray", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Yafray: Shadow and Photons", "Lamp", 640, 0, 318, 204)==0) return;
-
- /* hemis not used in yafray */
- if(la->type==LA_HEMI) return;
-
- uiSetButLock(la->id.lib!=0, ERROR_LIBDATA_MESSAGE);
-
- /* photonlight params */
- if (la->type==LA_YF_PHOTON) {
- uiBlockSetCol(block, TH_BUT_SETTING1);
- uiDefButBitS(block, TOG, 1, B_DIFF,"Use QMC",10,180,80,19,&la->YF_useqmc, 0, 0, 0, 0, "Use QMC sampling (sometimes visible patterns)");
- uiBlockSetCol(block, TH_AUTO);
- uiDefButF(block, NUMSLI,B_LAMPREDRAW,"Angle ", 100,180,200,19,&la->spotsize, 1.0, 180.0, 0, 0, "Sets the angle of the photonlight beam in degrees");
- uiDefButI(block, NUM,B_DIFF,"photons:", 10,150,290,19, &la->YF_numphotons, 10000, 100000000, 0, 0, "Maximum number of photons to shoot");
- uiDefButI(block, NUM,B_DIFF,"search:", 10,130,290,19, &la->YF_numsearch, 100, 1000, 0, 0, "Number of photons to mix (blur)");
- uiDefButS(block, NUM,B_DIFF,"depth:", 10,100,290,19, &la->YF_phdepth, 1, 100, 0, 0, "Maximum caustic bounce depth");
- uiDefButF(block, NUM,B_DIFF,"Blur:", 10,70,290,19, &la->YF_causticblur, 0.01, 1.0, 1, 0, "Amount of caustics blurring (also depends on search)");
- return;
- }
-
- uiBlockSetCol(block, TH_BUT_SETTING1);
-
- /* in yafray arealights always cast shadows, so ray shadow flag not needed */
- /* ray shadow also not used when halo for spot enabled */
- if ((la->type!=LA_AREA) && (!((la->type==LA_SPOT) && (la->mode & LA_HALO))))
- uiDefButBitS(block, TOG, LA_SHAD_RAY, B_SHADRAY,"Ray Shadow",10,180,80,19,&la->mode, 0, 0, 0, 0, "Use ray tracing for shadow");
-
- /* in yafray the regular lamp can use shadowbuffers (softlight), used by spot with halo as well */
- /* to prevent clash with blender shadowbuf flag, a special flag is used for yafray */
- if (la->type==LA_LOCAL) {
- uiDefButBitS(block, TOG, LA_YF_SOFT, B_SHADBUF, "Buf.Shadow",10,160,80,19,&la->mode, 0, 0, 0, 0, "Lets light produce shadows using shadow buffer");
- uiDefButF(block, NUM, B_DIFF, "GloInt:", 100,155,200,19, &la->YF_glowint, 0.0, 1.0, 1, 0, "Sets light glow intensity, 0 is off");
- uiDefButF(block, NUM, B_DIFF, "GloOfs:", 100,135,100,19, &la->YF_glowofs, 0.0, 2.0, 1, 0, "Sets light glow offset, the higher, the less 'peaked' the glow");
- uiDefButS(block, NUM, B_DIFF, "GlowType:", 200,135,100,19, &la->YF_glowtype, 0, 1, 1, 0, "Sets light glow type");
- }
-
- /* shadowbuffers used only for 'softlight' & spotlight with halo */
- if (((la->type==LA_LOCAL) && (la->mode & LA_YF_SOFT)) || ((la->type==LA_SPOT) && (la->mode & LA_HALO))) {
- /* Shadow buffer size can be anything in yafray, but reasonable minimum is 128 */
- /* Maximum is 1024, since zbuf in yafray is float, no multiple of 16 restriction */
- uiDefButS(block, NUM,B_DIFF,"ShadowBufferSize:", 100,110,200,19, &la->YF_bufsize, 128, 1024, 0, 0, "Sets the size of the shadow buffer");
-
- /* samples & halostep params only used for spotlight with halo */
- if ((la->type==LA_SPOT) && (la->mode & LA_HALO)) {
- uiDefButS(block, NUM,B_DIFF,"Samples:", 100,30,100,19, &la->samp,1.0,16.0, 0, 0, "Sets the number of shadow map samples");
- uiDefButS(block, NUM,B_DIFF,"Halo step:", 200,30,100,19, &la->shadhalostep, 0.0, 12.0, 0, 0, "Sets the volumetric halo sampling frequency");
- }
- uiDefButF(block, NUM,B_DIFF,"Bias:", 100,10,100,19, &la->bias, 0.01, 5.0, 1, 0, "Sets the shadow map sampling bias");
- /* here can use the Blender soft param, since for yafray it has the same function as in Blender */
- uiDefButF(block, NUM,B_DIFF,"Soft:", 200,10,100,19, &la->soft,1.0,100.0, 100, 0, "Sets the size of the shadow sample area");
- }
- else if ((la->type==LA_LOCAL) && (la->mode & LA_SHAD_RAY)) {
- /* for spherelight, light radius */
- uiDefButF(block, NUM,B_DIFF,"Radius:", 200,10,100,19, &la->YF_ltradius, 0.0,100.0, 100, 0, "Sets the radius of the lightsource, 0 is same as pointlight");
- }
-
- if (la->type==LA_SPOT) {
-
- uiDefButBitS(block, TOG, LA_HALO, B_LAMPREDRAW,"Halo", 10,50,80,19,&la->mode, 0, 0, 0, 0, "Renders spotlight with a volumetric halo");
-
- uiBlockSetCol(block, TH_AUTO);
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI,B_LAMPREDRAW,"SpotSi ", 100,180,200,19,&la->spotsize, 1.0, 180.0, 0, 0, "Sets the angle of the spotlight beam in degrees");
- uiDefButF(block, NUMSLI,B_LAMPREDRAW,"SpotBl ", 100,160,200,19,&la->spotblend, 0.0, 1.0, 0, 0, "Sets the softness of the spotlight edge");
- uiBlockEndAlign(block);
-
- if (la->mode & LA_HALO) uiDefButF(block, NUMSLI,0,"HaloInt ", 100,135,200,19,&la->haint, 0.0, 5.0, 0, 0, "Sets the intensity of the spotlight halo");
- }
- else if ((la->type==LA_AREA) || ((la->type==LA_LOCAL) && (la->mode & LA_SHAD_RAY))) {
- /* area samples param also used for 'spherelight' */
- uiBlockBeginAlign(block);
- uiBlockSetCol(block, TH_AUTO);
-
- uiDefButS(block, NUM,B_DIFF,"Samples:", 100,180,200,19, &la->ray_samp, 1.0, 16.0, 100, 0, "Sets the amount of samples taken extra (samp x samp)");
-
- /* shadow sampling types not used in yafray, removed */
- }
- else uiDefBut(block, LABEL,0," ", 100,180,200,19,NULL, 0, 0, 0, 0, "");
-
-}
-
-static void lamp_panel_falloff(Object *ob, Lamp *la)
-{
- uiBlock *block;
- rctf butr;
- short yco=PANEL_YMAX;
- float grid= 0.0;
-
- /* name "Preview" is abused to detect previewrender offset panel */
- block= uiNewBlock(&curarea->uiblocks, "lamp_panel_falloff", UI_EMBOSS, UI_HELV, curarea->win);
- uiNewPanelTabbed("Lamp", "Lamp");
- if(uiNewPanel(curarea, block, "Falloff Curve", "Lamp", PANELX, PANELY, PANELW, PANELH)==0) return;
-
- if(G.vd) grid= G.vd->grid;
- if(grid<1.0) grid= 1.0;
-
- uiSetButLock(la->id.lib!=0, ERROR_LIBDATA_MESSAGE);
-
- BLI_init_rctf(&butr, 10.0, 310.0, 10.0, (float)yco);
- curvemap_buttons(block, la->curfalloff, 's', B_LFALLOFFCHANGED, B_LAMPREDRAW, &butr);
-
-}
-
-static void lamp_panel_lamp(Object *ob, Lamp *la)
-{
- uiBlock *block;
- float grid= 0.0;
- short xco;
-
- block= uiNewBlock(&curarea->uiblocks, "lamp_panel_lamp", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Lamp", "Lamp", 320, 0, 318, 204)==0) return;
-
- if(G.vd) grid= G.vd->grid;
- if(grid<1.0) grid= 1.0;
-
- uiSetButLock(la->id.lib!=0, ERROR_LIBDATA_MESSAGE);
-
- uiBlockSetCol(block, TH_BUT_SETTING2);
- xco= std_libbuttons(block, 8, 180, 0, NULL, B_LAMPBROWSE, ID_LA, 0, (ID *)la, (ID *)ob, &(G.buts->menunr), B_LAMPALONE, B_LAMPLOCAL, 0, 0, 0);
-
- uiBlockSetCol(block, TH_AUTO);
- uiDefButF(block, NUM,B_LAMPREDRAW,"Dist:", xco,180,300-xco,20,&la->dist, 0.01, 5000.0*grid, 100, 0, "Sets the distance value at which light intensity is half");
-
- uiBlockBeginAlign(block);
- uiSetButLock(la->id.lib!=0, ERROR_LIBDATA_MESSAGE);
- if(la->type==LA_AREA) {
- //uiDefButS(block, MENU, B_LAMPREDRAW, "Shape %t|Square %x0|Rect %x1|Cube %x2|Box %x3",
- uiDefButS(block, MENU, B_LAMPREDRAW, "Shape %t|Square %x0|Rect %x1",
- 10, 150, 100, 19, &la->area_shape, 0,0,0,0, "Sets area light shape");
- if (ELEM(la->area_shape, LA_AREA_RECT, LA_AREA_BOX)){
- uiDefButF(block, NUM,B_LAMPREDRAW,"SizeX ", 10,130,100,19, &la->area_size, 0.01, 100.0, 10, 0, "Area light size X, doesn't affect energy amount");
- uiDefButF(block, NUM,B_LAMPREDRAW,"SizeY ", 10,110,100,19, &la->area_sizey, 0.01, 100.0, 10, 0, "Area light size Y, doesn't affect energy amount");
- }
- if(la->area_shape==LA_AREA_BOX)
- uiDefButF(block, NUM,B_LAMPREDRAW,"SizeZ ", 10,90,100,19, &la->area_sizez, 0.01, 100.0, 10, 0, "Area light size Z, doesn't affect energy amount");
- if (ELEM(la->area_shape, LA_AREA_SQUARE, LA_AREA_CUBE))
- uiDefButF(block, NUM,B_LAMPREDRAW,"Size ", 10,130,100,19, &la->area_size, 0.01, 100.0, 10, 0, "Area light size, doesn't affect energy amount");
- }
- else if( ELEM(la->type, LA_LOCAL, LA_SPOT)) {
- uiBlockSetCol(block, TH_BUT_SETTING1);
- uiDefButS(block, MENU, B_LAMPREDRAW, "Falloff %t|Constant %x0|Inverse Linear %x1|Inverse Square %x2|Custom Curve %x3|Lin/Quad Weighted %x4|",
- 10,150,100,19, &la->falloff_type, 0,0,0,0, "Lamp falloff - intensity decay with distance");
- uiDefButBitS(block, TOG, LA_SPHERE, REDRAWVIEW3D,"Sphere", 10,130,100,19,&la->mode, 0, 0, 0, 0, "Sets light intensity to zero for objects beyond the distance value");
- }
-
- uiBlockBeginAlign(block);
- uiBlockSetCol(block, TH_BUT_SETTING1);
- uiDefButBitS(block, TOG, LA_LAYER, 0,"Layer", 10,70,100,19,&la->mode, 0, 0, 0, 0, "Illuminates objects in the same layer as the lamp only");
- uiDefButBitS(block, TOG, LA_NEG, B_LAMPPRV,"Negative", 10,50,100,19,&la->mode, 0, 0, 0, 0, "Sets lamp to cast negative light");
- uiDefButBitS(block, TOG, LA_NO_DIFF, 0,"No Diffuse", 10,30,100,19,&la->mode, 0, 0, 0, 0, "Disables diffuse shading of material illuminated by this lamp");
- uiDefButBitS(block, TOG, LA_NO_SPEC, 0,"No Specular", 10,10,100,19,&la->mode, 0, 0, 0, 0, "Disables specular shading of material illuminated by this lamp");
- uiBlockEndAlign(block);
-
- uiBlockSetCol(block, TH_AUTO);
- uiDefButF(block, NUMSLI,B_LAMPPRV,"Energy ", 120,150,180,20, &(la->energy), 0.0, 10.0, 0, 0, "Sets the intensity of the light");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI,B_LAMPPRV,"R ", 120,120,180,20,&la->r, 0.0, 1.0, B_COLLAMP, 0, "Sets the red component of the light");
- uiDefButF(block, NUMSLI,B_LAMPPRV,"G ", 120,100,180,20,&la->g, 0.0, 1.0, B_COLLAMP, 0, "Sets the green component of the light");
- uiDefButF(block, NUMSLI,B_LAMPPRV,"B ", 120,80,180,20,&la->b, 0.0, 1.0, B_COLLAMP, 0, "Sets the blue component of the light");
- uiBlockEndAlign(block);
-
- uiDefButF(block, COL, B_LAMPPRV, "", 120,52,180,24, &la->r, 0, 0, 0, B_COLLAMP, "");
-
- uiBlockBeginAlign(block);
- if (ELEM(la->type, LA_LOCAL, LA_SPOT) && (la->falloff_type == LA_FALLOFF_SLIDERS)) {
- uiDefButF(block, NUMSLI,B_LAMPPRV,"Linear ", 120,30,180,19,&la->att1, 0.0, 1.0, 0, 0, "Set the linear distance attenuatation for a quad lamp");
- uiDefButF(block, NUMSLI,B_LAMPPRV,"Quad ", 120,10,180,19,&la->att2, 0.0, 1.0, 0, 0, "Set the quadratic distance attenuatation for a quad lamp");
- }
- else if(la->type==LA_AREA) {
- if(la->k==0.0) la->k= 1.0;
- uiDefButF(block, NUMSLI,0,"Gamma ", 120,10,180,19,&la->k, 0.001, 2.0, 100, 0, "Set the light gamma correction value");
- }
-}
-
-
-static void lamp_panel_preview(Object *ob, Lamp *la)
-{
- uiBlock *block;
-
- /* name "Preview" is abused to detect previewrender offset panel */
- block= uiNewBlock(&curarea->uiblocks, "lamp_panel_preview", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Preview", "Lamp", 0, 0, 318, 204)==0) return;
-
- uiSetButLock(la->id.lib!=0, ERROR_LIBDATA_MESSAGE);
-
- uiBlockSetDrawExtraFunc(block, BIF_previewdraw);
-
- // label to force a boundbox for buttons not to be centered
- uiDefBut(block, LABEL, 0, " ", 20,20,10,10, 0, 0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW,B_LAMPREDRAW,"Lamp", 200,175,80,25,&la->type,1.0,(float)LA_LOCAL, 0, 0, "Creates an omnidirectional point light source");
- uiDefButS(block, ROW,B_LAMPREDRAW,"Area", 200,150,80,25,&la->type,1.0,(float)LA_AREA, 0, 0, "Creates a directional area light source");
- uiDefButS(block, ROW,B_LAMPREDRAW,"Spot", 200,125,80,25,&la->type,1.0,(float)LA_SPOT, 0, 0, "Creates a directional cone light source");
- uiDefButS(block, ROW,B_LAMPREDRAW,"Sun", 200,100,80,25,&la->type,1.0,(float)LA_SUN, 0, 0, "Creates a constant direction parallel ray light source");
- uiDefButS(block, ROW,B_LAMPREDRAW,"Hemi", 200,75,80,25,&la->type,1.0,(float)LA_HEMI, 0, 0, "Creates a 180 degree constant light source");
- /* yafray: extra type, photonlight */
- if (G.scene->r.renderer==R_YAFRAY)
- uiDefButS(block, ROW,B_LAMPREDRAW,"Photon", 200,50,80,25,&la->type,1.0,(float)LA_YF_PHOTON, 0, 0, "Creates a special caustics photon 'light', not a real lightsource, use with other lights");
-}
-
-
-/* ****************** MATERIAL ***************** */
-
-
-void do_matbuts(unsigned short event)
-{
- static short mtexcopied=0;
- static MTex mtexcopybuf;
- Material *ma;
- MTex *mtex;
-
- /* all operations default on active material layer here */
- /* but this also gets called for lamp and world... */
- ma= G.buts->lockpoin;
- if(ma && GS(ma->id.name)==ID_MA)
- ma = editnode_get_active_material(ma);
- else
- ma= NULL;
-
- switch(event) {
- case B_MAT_YF_PRESET: {
- switch (ma->YF_preset) {
- case 0:
- /* normal mode, no reflection/refraction */
- ma->alpha = 1;
- ma->mode &= ~(MA_RAYMIRROR+MA_RAYTRANSP+MA_ZTRA);
- break;
- case 1: {
- /* clear glass */
- ma->alpha = 0.001;
- ma->ray_mirror = 1;
- ma->fresnel_mir_i = 5;
- ma->mode |= (MA_RAYMIRROR+MA_RAYTRANSP);
- ma->mode &= ~MA_ZTRA;
- ma->filter = 0;
- ma->ang = 1.5;
- break;
- }
- case 2: {
- /* color glass */
- ma->alpha = 0.001;
- ma->ray_mirror = 1;
- ma->fresnel_mir_i = 5;
- ma->mode |= (MA_RAYMIRROR+MA_RAYTRANSP);
- ma->mode &= ~MA_ZTRA;
- ma->filter = 1;
- ma->ang = 1.5;
- break;
- }
- case 3: {
- /* uniform reflect */
- ma->alpha = 1;
- ma->ray_mirror = 1;
- ma->fresnel_mir_i = 1;
- ma->mode |= MA_RAYMIRROR;
- ma->mode &= ~(MA_RAYTRANSP+MA_ZTRA);
- break;
- }
- case 4: {
- /* fresnel reflect */
- ma->alpha = 1;
- ma->ray_mirror = 1;
- ma->fresnel_mir_i = 5;
- ma->mode |= MA_RAYMIRROR;
- ma->mode &= ~(MA_RAYTRANSP+MA_ZTRA);
- ma->ang = 3;
- break;
- }
- }
- BIF_preview_changed(ID_MA);
- allqueue(REDRAWBUTSSHADING, 0);
- shade_buttons_change_3d();
- break;
- }
- case B_ACTCOL:
- scrarea_queue_headredraw(curarea);
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWOOPS, 0);
- BIF_preview_changed(ID_MA);
- break;
- case B_MATFROM:
- scrarea_queue_headredraw(curarea);
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWOOPS, 0);
- // BIF_previewdraw(); push/pop!
- break;
- case B_MATPRV:
- if(ma) end_render_material(ma); /// temporal... 3d preview
- BIF_preview_changed(ID_MA);
- allqueue(REDRAWBUTSSHADING, 0);
- shade_buttons_change_3d();
- break;
- case B_LAMPPRV:
- BIF_preview_changed(ID_LA);
- allqueue(REDRAWBUTSSHADING, 0);
- break;
- case B_WORLDPRV:
- BIF_preview_changed(ID_WO);
- allqueue(REDRAWBUTSSHADING, 0);
- break;
- case B_WORLDPRV2:
- BIF_preview_changed(ID_WO);
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_MATHALO:
- /* when halo is disabled, clear star flag, this is the same as MA_FACETEXTURE <blush> */
- /* same for 'xtreme alpha' which is 'only shadow' */
- if(ma) {
- if((ma->mode & MA_HALO)==0) {
- ma->mode &= ~(MA_STAR|MA_HALO_XALPHA|MA_ZINV|MA_ENV);
- }
- BIF_preview_changed(ID_MA);
- allqueue(REDRAWBUTSSHADING, 0);
- shade_buttons_change_3d();
- }
- break;
- case B_TEXCLEAR:
- mtex= ma->mtex[(int) ma->texact ];
- if(mtex) {
- if(mtex->tex) mtex->tex->id.us--;
- MEM_freeN(mtex);
- ma->mtex[ (int) ma->texact ]= 0;
- BIF_undo_push("Unlink material texture");
- if(ma) end_render_material(ma); /// temporal... 3d preview
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWOOPS, 0);
- BIF_preview_changed(ID_MA);
- }
- break;
- case B_MTEXCOPY:
- if(ma && ma->mtex[(int)ma->texact] ) {
- mtex= ma->mtex[(int)ma->texact];
- if(mtex->tex==NULL) {
- error("No texture available");
- }
- else {
- memcpy(&mtexcopybuf, ma->mtex[(int)ma->texact], sizeof(MTex));
- mtexcopied= 1;
- }
- }
- break;
- case B_MTEXPASTE:
- if(ma && mtexcopied && mtexcopybuf.tex) {
- if(ma->mtex[(int)ma->texact]==NULL )
- ma->mtex[(int)ma->texact]= MEM_mallocN(sizeof(MTex), "mtex");
- else if(ma->mtex[(int)ma->texact]->tex)
- ma->mtex[(int)ma->texact]->tex->id.us--;
-
- memcpy(ma->mtex[(int)ma->texact], &mtexcopybuf, sizeof(MTex));
-
- id_us_plus((ID *)mtexcopybuf.tex);
- BIF_undo_push("Paste mapping settings");
- BIF_preview_changed(ID_MA);
- scrarea_queue_winredraw(curarea);
- }
- break;
- case B_MATZTRANSP:
- if(ma) {
- ma->mode &= ~MA_RAYTRANSP;
- //BIF_view3d_previewrender_signal(curarea, PR_DBASE|PR_DISPRECT); /// temporal... 3d preview
- allqueue(REDRAWBUTSSHADING, 0);
- BIF_preview_changed(ID_MA);
- }
- break;
- case B_MATRAYTRANSP:
- if(ma) {
- ma->mode &= ~MA_ZTRA;
- if(ma) end_render_material(ma); /// temporal... 3d preview
- allqueue(REDRAWBUTSSHADING, 0);
- BIF_preview_changed(ID_MA);
- }
- break;
- case B_MATCOLORBAND:
- if(ma) {
- if(ma->mode & MA_RAMP_COL)
- if(ma->ramp_col==NULL) ma->ramp_col= add_colorband(0);
- if(ma->mode & MA_RAMP_SPEC)
- if(ma->ramp_spec==NULL) ma->ramp_spec= add_colorband(0);
-
- if(ma) end_render_material(ma); /// temporal... 3d preview
- allqueue(REDRAWBUTSSHADING, 0);
- BIF_preview_changed(ID_MA);
- shade_buttons_change_3d();
- }
- break;
- case B_MAT_USENODES:
- ma= G.buts->lockpoin; /* use base material instead */
- if(ma) {
- if(ma->use_nodes && ma->nodetree==NULL) {
- node_shader_default(ma);
- }
- if(ma) end_render_material(ma); /// temporal... 3d preview
- BIF_preview_changed(ID_MA);
- allqueue(REDRAWNODE, 0);
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWIPO, 0);
- }
- break;
- case B_MAT_VCOL_PAINT:
- if(ma) {
- ma->mode &= ~MA_VERTEXCOL;
- BIF_preview_changed(ID_MA);
- allqueue(REDRAWBUTSSHADING, 0);
- }
- break;
- case B_MAT_VCOL_LIGHT:
- if(ma) {
- ma->mode &= ~MA_VERTEXCOLP;
- BIF_preview_changed(ID_MA);
- allqueue(REDRAWBUTSSHADING, 0);
- }
- break;
-
- case B_MAT_PARTICLE:
- if(ma) {
- Base *base;
- Object *ob;
- ParticleSystem *psys;
-
- base= G.scene->base.first;
- while(base){
- if(base->object->type==OB_MESH) {
- ob=base->object;
- for(psys=ob->particlesystem.first; psys; psys=psys->next) {
- if(psys && ma==give_current_material(ob,psys->part->omat)) {
- psys->flag |= PSYS_INIT;
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- }
- }
- }
- base = base->next;
- }
- allqueue(REDRAWVIEW3D, 0);
- }
- }
-}
-
-static void particle_recalc_material(void *ma_v, void *arg2)
-{
- Material *ma = ma_v;
- Base *base;
- Object *ob;
- ParticleSystem *psys;
-
- base= G.scene->base.first;
- while(base){
- if(base->object->type==OB_MESH){
- ob=base->object;
- for(psys=ob->particlesystem.first; psys; psys=psys->next){
- if(psys && ma==give_current_material(ob,psys->part->omat)){
- psys->recalc |= PSYS_INIT;
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- }
- }
- }
- base = base->next;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-/* if from nodes, hide options that are not available */
-static void material_panel_map_to(Object *ob, Material *ma, int from_nodes)
-{
- uiBlock *block;
- uiBut *but;
- MTex *mtex;
- ParticleSystem *psys;
- int psys_mapto=0;
- static short pattr=0;
-
- block= uiNewBlock(&curarea->uiblocks, "material_panel_map_to", UI_EMBOSS, UI_HELV, curarea->win);
- uiNewPanelTabbed("Texture", "Material");
- if(uiNewPanel(curarea, block, "Map To", "Material", 1600, 0, 318, 204)==0) return;
-
- uiSetButLock(ma->id.lib!=NULL, ERROR_LIBDATA_MESSAGE);
-
- mtex= ma->mtex[ ma->texact ];
- if(mtex==NULL) {
- mtex= &emptytex;
- default_mtex(mtex);
- }
-
- /* TEXTURE OUTPUT */
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, MTEX_STENCIL, B_MATPRV, "Stencil", 10,125,45,19, &(mtex->texflag), 0, 0, 0, 0, "Use this texture as a blending value on the next texture");
- uiDefButBitS(block, TOG, MTEX_NEGATIVE, B_MATPRV, "Neg", 55,125,30,19, &(mtex->texflag), 0, 0, 0, 0, "Inverts the values of the texture to reverse its effect");
- uiDefButBitS(block, TOG,MTEX_RGBTOINT, B_MATPRV, "No RGB", 85,125,60,19, &(mtex->texflag), 0, 0, 0, 0, "Converts texture RGB values to intensity (gray) values");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButF(block, COL, B_MATPRV, "", 10,100,135,19, &(mtex->r), 0, 0, 0, B_MTEXCOL, "");
-
- if(ma->colormodel==MA_HSV) {
- uiBlockSetCol(block, TH_BUT_SETTING1);
- uiDefButF(block, HSVSLI, B_MATPRV, "H ", 10,80,135,19, &(mtex->r), 0.0, 0.9999, B_MTEXCOL, 0, "");
- uiDefButF(block, HSVSLI, B_MATPRV, "S ", 10,60,135,19, &(mtex->r), 0.0001, 1.0, B_MTEXCOL, 0, "");
- uiDefButF(block, HSVSLI, B_MATPRV, "V ", 10,40,135,19, &(mtex->r), 0.0001, 1.0, B_MTEXCOL, 0, "");
- uiBlockSetCol(block, TH_AUTO);
- }
- else {
- uiDefButF(block, NUMSLI, B_MATPRV, "R ", 10,80,135,19, &(mtex->r), 0.0, 1.0, B_MTEXCOL, 0, "The default color for textures that don't return RGB");
- uiDefButF(block, NUMSLI, B_MATPRV, "G ", 10,60,135,19, &(mtex->g), 0.0, 1.0, B_MTEXCOL, 0, "The default color for textures that don't return RGB");
- uiDefButF(block, NUMSLI, B_MATPRV, "B ", 10,40,135,19, &(mtex->b), 0.0, 1.0, B_MTEXCOL, 0, "The default color for textures that don't return RGB");
- }
- uiBlockEndAlign(block);
-
- uiDefButF(block, NUMSLI, B_MATPRV, "DVar ", 10,10,135,19, &(mtex->def_var), 0.0, 1.0, 0, 0, "Value to use for Ref, Spec, Amb, Emit, Alpha, RayMir, TransLu and Hard");
-
- /* MAP TO */
- uiBlockBeginAlign(block);
-
- /*check if material is being used by particles*/
- for(psys=ob->particlesystem.first; psys; psys=psys->next)
- if(psys->part->omat==ob->actcol)
- psys_mapto=1;
-
- if(psys_mapto && pattr) {
- but=uiDefButBitS(block, TOG3, MAP_PA_TIME, B_MAT_PARTICLE, "Time", 10,180,60,19, &(mtex->pmapto), 0, 0, 0, 0, "Causes the texture to affect the emission time of particles");
- //uiButSetFunc(but, particle_recalc_material, ma, NULL);
- but=uiDefButBitS(block, TOG3, MAP_PA_LIFE, B_MAT_PARTICLE, "Life", 70,180,60,19, &(mtex->pmapto), 0, 0, 0, 0, "Causes the texture to affect the life time of particles");
- //uiButSetFunc(but, particle_recalc_material, ma, NULL);
- but=uiDefButBitS(block, TOG3, MAP_PA_DENS, B_MAT_PARTICLE, "Dens", 130,180,60,19, &(mtex->pmapto), 0, 0, 0, 0, "Causes the texture to affect the density of particles");
- //uiButSetFunc(but, particle_recalc_material, ma, NULL);
- uiDefButBitS(block, TOG3, MAP_PA_IVEL, B_MAT_PARTICLE, "IVel", 190,180,60,19, &(mtex->pmapto), 0, 0, 0, 0, "Causes the texture to affect the initial velocity of particles");
- uiDefButBitS(block, TOG3, MAP_PA_ROUGH, B_MAT_PARTICLE, "Rough", 250,180,60,19, &(mtex->pmapto), 0, 0, 0, 0, "Causes the texture to affect the roughness of child particles");
-
- but=uiDefButBitS(block, TOG3, MAP_PA_SIZE, B_MAT_PARTICLE, "Size", 10,160,60,19, &(mtex->pmapto), 0, 0, 0, 0, "Causes the texture to affect the size of particles");
- //uiButSetFunc(but, particle_recalc_material, ma, NULL);
- but=uiDefButBitS(block, TOG3, MAP_PA_KINK, B_MAT_PARTICLE, "Kink", 70,160,60,19, &(mtex->pmapto), 0, 0, 0, 0, "Causes the texture to affect the kink of child particles");
- //uiButSetFunc(but, particle_recalc_material, ma, NULL);
- but=uiDefButBitS(block, TOG3, MAP_PA_LENGTH, B_MAT_PARTICLE, "Length",130,160,60,19, &(mtex->pmapto), 0, 0, 0, 0, "Causes the texture to affect the length of particles");
- //uiButSetFunc(but, particle_recalc_material, ma, NULL);
- but=uiDefButBitS(block, TOG3, MAP_PA_CLUMP, B_MAT_PARTICLE, "Clump", 190,160,60,19, &(mtex->pmapto), 0, 0, 0, 0, "Causes the texture to affect the clump of child particles");
- //uiButSetFunc(but, particle_recalc_material, ma, NULL);
-
- uiBlockSetCol(block, TH_BUT_SETTING1);
- uiDefButBitS(block, TOG, 1, B_MATPRV, "PAttr", 250,160,60,19, &pattr, 0, 0, 0, 0, "Display settings for particle attributes");
- uiBlockSetCol(block, TH_AUTO);
- }
- else {
- uiDefButBitS(block, TOG, MAP_COL, B_MATPRV, "Col", 10,180,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect basic colour of the material");
- uiDefButBitS(block, TOG3, MAP_NORM, B_MATPRV, "Nor", 50,180,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the rendered normal");
- uiDefButBitS(block, TOG, MAP_COLSPEC, B_MATPRV, "Csp", 90,180,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the specularity colour");
- uiDefButBitS(block, TOG, MAP_COLMIR, B_MATPRV, "Cmir", 130,180,50,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the mirror colour");
- uiDefButBitS(block, TOG3, MAP_REF, B_MATPRV, "Ref", 180,180,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the value of the materials reflectivity");
- uiDefButBitS(block, TOG3, MAP_SPEC, B_MATPRV, "Spec", 220,180,50,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the value of specularity");
- uiDefButBitS(block, TOG3, MAP_AMB, B_MATPRV, "Amb", 270,180,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the value of ambient");
-
- if(psys_mapto) {
- uiDefButBitS(block, TOG3, MAP_HAR, B_MATPRV, "Hard", 10,160,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the hardness value");
- uiDefButBitS(block, TOG3, MAP_RAYMIRR, B_MATPRV, "RayMir", 50,160,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the ray-mirror value");
- uiDefButBitS(block, TOG3, MAP_ALPHA, B_MATPRV, "Alpha", 90,160,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the alpha value");
- uiDefButBitS(block, TOG3, MAP_EMIT, B_MATPRV, "Emit", 130,160,50,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the emit value");
- uiDefButBitS(block, TOG3, MAP_TRANSLU, B_MATPRV, "TransLu", 180,160,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the layer blending value");
- if(from_nodes==0)
- uiDefButBitS(block, TOG3, MAP_DISPLACE, B_MATPRV, "Disp", 220,160,50,19, &(mtex->mapto), 0, 0, 0, 0, "Let the texture displace the surface");
- uiBlockSetCol(block, TH_BUT_SETTING1);
- uiDefButBitS(block, TOG, 1, B_MATPRV, "PAttr", 270,160,40,19, &pattr, 0, 0, 0, 0, "Display settings for particle attributes");
- uiBlockSetCol(block, TH_AUTO);
- }
- else {
- uiDefButBitS(block, TOG3, MAP_HAR, B_MATPRV, "Hard", 10,160,50,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the hardness value");
- uiDefButBitS(block, TOG3, MAP_RAYMIRR, B_MATPRV, "RayMir", 60,160,50,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the ray-mirror value");
- uiDefButBitS(block, TOG3, MAP_ALPHA, B_MATPRV, "Alpha", 110,160,50,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the alpha value");
- uiDefButBitS(block, TOG3, MAP_EMIT, B_MATPRV, "Emit", 160,160,45,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the emit value");
- uiDefButBitS(block, TOG3, MAP_TRANSLU, B_MATPRV, "TransLu", 205,160,60,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the layer blending value");
- if(from_nodes==0)
- uiDefButBitS(block, TOG3, MAP_DISPLACE, B_MATPRV, "Disp", 265,160,45,19, &(mtex->mapto), 0, 0, 0, 0, "Let the texture displace the surface");
- }
- }
-
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- but=uiDefButS(block, MENU, B_MATPRV, mapto_blendtype_pup(),155,125,155,19, &(mtex->blendtype), 0, 0, 0, 0, "Texture blending mode");
- uiBlockEndAlign(block);
- if(psys_mapto && mtex->pmapto & MAP_PA_INIT)
- uiButSetFunc(but, particle_recalc_material, ma, NULL);
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_MATPRV, "Col ", 155,100,155,19, &(mtex->colfac), 0.0, 1.0, 0, 0, "Sets the amount the texture affects color values");
- /* newnoise: increased range to 25, the constant offset for bumpmapping quite often needs a higher nor setting */
- uiDefButF(block, NUMSLI, B_MATPRV, "Nor ", 155,80,155,19, &(mtex->norfac), 0.0, 25.0, 0, 0, "Sets the amount the texture affects normal values");
- but=uiDefButF(block, NUMSLI, B_MATPRV, "Var ", 155,60,155,19, &(mtex->varfac), 0.0, 1.0, 0, 0, "Sets the amount the texture affects other values");
- if(psys_mapto && mtex->pmapto & MAP_PA_INIT)
- uiButSetFunc(but, particle_recalc_material, ma, NULL);
- uiDefButF(block, NUMSLI, B_MATPRV, "Disp ", 155,40,155,19, &(mtex->dispfac), 0.0, 1.0, 0, 0, "Sets the amount the texture displaces the surface");
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, MAP_WARP, B_MATPRV, "Warp", 155,10,40,19, &(mtex->mapto), 0, 0, 0, 0, "Let the texture warp texture coordinates of next channels");
- uiDefButF(block, NUMSLI, B_MATPRV, "fac ", 195,10,115,19, &(mtex->warpfac), 0.0, 1.0, 0, 0, "Sets the amount the texture affects texture coordinates of next channels");
-}
-
-/* autocomplete callback for buttons */
-void autocomplete_uv(char *str, void *arg_v)
-{
- Mesh *me;
- CustomDataLayer *layer;
- AutoComplete *autocpl;
- int a;
-
- if(str[0]==0)
- return;
-
- autocpl= autocomplete_begin(str, 32);
-
- /* search if str matches the beginning of name */
- for(me= G.main->mesh.first; me; me=me->id.next)
- for(a=0, layer= me->fdata.layers; a<me->fdata.totlayer; a++, layer++)
- if(layer->type == CD_MTFACE)
- autocomplete_do_name(autocpl, layer->name);
-
- autocomplete_end(autocpl, str);
-}
-
-int verify_valid_uv_name(char *str)
-{
- Mesh *me;
- CustomDataLayer *layer;
- int a;
-
- if(str[0]==0)
- return 1;
-
- /* search if str matches the name */
- for(me= G.main->mesh.first; me; me=me->id.next)
- for(a=0, layer= me->fdata.layers; a<me->fdata.totlayer; a++, layer++)
- if(layer->type == CD_MTFACE)
- if(strcmp(layer->name, str)==0)
- return 1;
-
- return 0;
-}
-
-static void material_panel_map_input(Object *ob, Material *ma)
-{
- uiBlock *block;
- uiBut *but;
- MTex *mtex;
- int b;
-
- block= uiNewBlock(&curarea->uiblocks, "material_panel_map_input", UI_EMBOSS, UI_HELV, curarea->win);
- uiNewPanelTabbed("Texture", "Material");
- if(uiNewPanel(curarea, block, "Map Input", "Material", 1280, 0, 318, 204)==0) return;
-
- uiSetButLock(ma->id.lib!=NULL, ERROR_LIBDATA_MESSAGE);
-
- mtex= ma->mtex[ ma->texact ];
- if(mtex==NULL) {
- mtex= &emptytex;
- default_mtex(mtex);
- }
-
- /* TEXCO */
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW, B_MATPRV, "Glob", 630,180,45,18, &(mtex->texco), 4.0, (float)TEXCO_GLOB, 0, 0, "Uses global coordinates for the texture coordinates");
- uiDefButS(block, ROW, B_MATPRV, "Object", 675,180,75,18, &(mtex->texco), 4.0, (float)TEXCO_OBJECT, 0, 0, "Uses linked object's coordinates for texture coordinates");
- if(mtex->texco == TEXCO_UV) {
- if(!verify_valid_uv_name(mtex->uvname))
- uiBlockSetCol(block, TH_REDALERT);
- but=uiDefBut(block, TEX, B_MATPRV, "UV:", 750,180,158,18, mtex->uvname, 0, 31, 0, 0, "Set name of UV layer to use, default is active UV layer");
- uiButSetCompleteFunc(but, autocomplete_uv, NULL);
- uiBlockSetCol(block, TH_AUTO);
- }
- else
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_MATPRV, "Ob:",750,180,158,18, &(mtex->object), "");
-
- uiDefButS(block, ROW, B_MATPRV, "UV", 630,160,40,18, &(mtex->texco), 4.0, (float)TEXCO_UV, 0, 0, "Uses UV coordinates for texture coordinates");
- uiDefButS(block, ROW, B_MATPRV, "Orco", 670,160,55,18, &(mtex->texco), 4.0, (float)TEXCO_ORCO, 0, 0, "Uses the original undeformed coordinates of the object");
- if( ob->particlesystem.first )
- uiDefButS(block, ROW, B_MATPRV, "Strand", 725,160,50,18, &(mtex->texco), 4.0, (float)TEXCO_STRAND, 0, 0, "Uses normalized strand texture coordinate (1D)");
- else
- uiDefButS(block, ROW, B_MATPRV, "Stick", 725,160,50,18, &(mtex->texco), 4.0, (float)TEXCO_STICKY, 0, 0, "Uses mesh's sticky coordinates for the texture coordinates");
- uiDefButS(block, ROW, B_MATPRV, "Win", 775,160,45,18, &(mtex->texco), 4.0, (float)TEXCO_WINDOW, 0, 0, "Uses screen coordinates as texture coordinates");
- uiDefButS(block, ROW, B_MATPRV, "Nor", 820,160,44,18, &(mtex->texco), 4.0, (float)TEXCO_NORM, 0, 0, "Uses normal vector as texture coordinates");
- uiDefButS(block, ROW, B_MATPRV, "Refl", 864,160,44,18, &(mtex->texco), 4.0, (float)TEXCO_REFL, 0, 0, "Uses reflection vector as texture coordinates");
-
- uiDefButS(block, ROW, B_MATPRV, "Stress", 630,140,70,18, &(mtex->texco), 4.0, (float)TEXCO_STRESS, 0, 0, "Uses the difference of edge lengths compared to original coordinates of the mesh");
- uiDefButS(block, ROW, B_MATPRV, "Tangent", 700,140,70,18, &(mtex->texco), 4.0, (float)TEXCO_TANGENT, 0, 0, "Uses the optional tangent vector as texture coordinates");
-
- /* COORDS */
- uiBlockBeginAlign(block);
- uiDefButC(block, ROW, B_MATPRV, "Flat", 630,115,48,19, &(mtex->mapping), 5.0, (float)MTEX_FLAT, 0, 0, "Maps X and Y coordinates directly");
- uiDefButC(block, ROW, B_MATPRV, "Cube", 681,115,50,19, &(mtex->mapping), 5.0, (float)MTEX_CUBE, 0, 0, "Maps using the normal vector");
- uiDefButC(block, ROW, B_MATPRV, "Tube", 630,95,48,19, &(mtex->mapping), 5.0, (float)MTEX_TUBE, 0, 0, "Maps with Z as central axis (tube-like)");
- uiDefButC(block, ROW, B_MATPRV, "Sphe", 681,95,50,19, &(mtex->mapping), 5.0, (float)MTEX_SPHERE, 0, 0, "Maps with Z as central axis (sphere-like)");
-
- uiBlockBeginAlign(block);
- for(b=0; b<3; b++) {
- char *cp;
- if(b==0) cp= &(mtex->projx);
- else if(b==1) cp= &(mtex->projy);
- else cp= &(mtex->projz);
-
- uiDefButC(block, ROW, B_MATPRV, "", 630, 50-20*b, 24, 18, cp, 6.0+b, 0.0, 0, 0, "");
- uiDefButC(block, ROW, B_MATPRV, "X", 656, 50-20*b, 24, 18, cp, 6.0+b, 1.0, 0, 0, "");
- uiDefButC(block, ROW, B_MATPRV, "Y", 682, 50-20*b, 24, 18, cp, 6.0+b, 2.0, 0, 0, "");
- uiDefButC(block, ROW, B_MATPRV, "Z", 708, 50-20*b, 24, 18, cp, 6.0+b, 3.0, 0, 0, "");
- }
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_MATPRV, "ofsX", 778,115,130,19, mtex->ofs, -10.0, 10.0, 10, 0, "Fine tunes texture mapping X coordinate");
- uiDefButF(block, NUM, B_MATPRV, "ofsY", 778,95,130,19, mtex->ofs+1, -10.0, 10.0, 10, 0, "Fine tunes texture mapping Y coordinate");
- uiDefButF(block, NUM, B_MATPRV, "ofsZ", 778,75,130,19, mtex->ofs+2, -10.0, 10.0, 10, 0, "Fine tunes texture mapping Z coordinate");
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_MATPRV, "sizeX", 778,50,130,19, mtex->size, -100.0, 100.0, 10, 0, "Sets scaling for the texture's X size");
- uiDefButF(block, NUM, B_MATPRV, "sizeY", 778,30,130,19, mtex->size+1, -100.0, 100.0, 10, 0, "Sets scaling for the texture's Y size");
- uiDefButF(block, NUM, B_MATPRV, "sizeZ", 778,10,130,19, mtex->size+2, -100.0, 100.0, 10, 0, "Sets scaling for the texture's Z size");
- uiBlockEndAlign(block);
-
-}
-
-
-static void material_panel_texture(Object *ob, Material *ma)
-{
- uiBlock *block;
- uiBut *but;
- MTex *mtex;
- ID *id;
- ParticleSystem *psys;
- int loos, psys_mapto=0;
- int a;
- char str[64], *strp;
-
- block= uiNewBlock(&curarea->uiblocks, "material_panel_texture", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Texture", "Material", 960, 0, 318, 204)==0) return;
- uiClearButLock();
-
- /*check if material is being used by particles*/
- for(psys=ob->particlesystem.first; psys; psys=psys->next)
- if(psys->part->omat==ob->actcol)
- psys_mapto=1;
-
- /* TEX CHANNELS */
- uiBlockSetCol(block, TH_BUT_NEUTRAL);
-
- uiBlockBeginAlign(block);
- for(a= 0; a<MAX_MTEX; a++) {
- mtex= ma->mtex[a];
- if(mtex && mtex->tex) splitIDname(mtex->tex->id.name+2, str, &loos);
- else strcpy(str, "");
- str[10]= 0;
- uiDefButC(block, ROW, B_TEXCHANNEL, str, 10, 180-18*a, 70, 20, &(ma->texact), 3.0, (float)a, 0, 0, "");
- }
- uiBlockEndAlign(block);
-
- uiSetButLock(ma->id.lib!=NULL, ERROR_LIBDATA_MESSAGE);
-
- /* SEPTEX */
- uiBlockSetCol(block, TH_AUTO);
-
- for(a= 0; a<MAX_MTEX; a++) {
- mtex= ma->mtex[a];
- if(mtex && mtex->tex) {
- but=uiDefIconButBitS(block, ICONTOGN, 1<<a, B_MATPRV, ICON_CHECKBOX_HLT-1, -20, 180-18*a, 28, 20, &ma->septex, 0.0, 0.0, 0, 0, "Click to disable or enable this texture channel");
-
- if(psys_mapto && ma->mtex[a]->mapto & MAP_PA_IVEL)
- uiButSetFunc(but, particle_recalc_material, ma, NULL);
- }
- }
- uiBlockBeginAlign(block);
- uiDefIconBut(block, BUT, B_MTEXCOPY, ICON_COPYUP, 100,180,23,21, 0, 0, 0, 0, 0, "Copies the mapping settings to the buffer");
- uiDefIconBut(block, BUT, B_MTEXPASTE, ICON_PASTEUP, 125,180,23,21, 0, 0, 0, 0, 0, "Pastes the mapping settings from the buffer");
- uiBlockEndAlign(block);
- uiBlockSetCol(block, TH_AUTO);
-
- mtex= ma->mtex[ ma->texact ];
- if(mtex==NULL) {
- mtex= &emptytex;
- default_mtex(mtex);
- }
-
- /* TEXTUREBLOK SELECT */
- uiBlockSetCol(block, TH_BUT_SETTING2);
- if(G.main->tex.first==NULL)
- id= NULL;
- else
- id= (ID*) mtex->tex;
- IDnames_to_pupstring(&strp, NULL, "ADD NEW %x32767", &(G.main->tex), id, &(G.buts->texnr));
- uiDefButS(block, MENU, B_EXTEXBROWSE, strp, 100,130,20,20, &(G.buts->texnr), 0, 0, 0, 0, "Selects an existing texture or creates new");
- MEM_freeN(strp);
-
- if(id) {
- uiDefBut(block, TEX, B_IDNAME, "TE:", 100,150,163,20, id->name+2, 0.0, 21.0, 0, 0, "Displays name of the texture block: click to change");
- sprintf(str, "%d", id->us);
- uiDefBut(block, BUT, 0, str, 196,130,21,20, 0, 0, 0, 0, 0, "Displays number of users of texture");
- uiDefIconBut(block, BUT, B_AUTOTEXNAME, ICON_AUTO, 241,130,21,20, 0, 0, 0, 0, 0, "Auto-assigns name to texture");
- if(id->lib) {
- if(ma->id.lib) uiDefIconBut(block, BUT, 0, ICON_DATALIB, 219,130,21,20, 0, 0, 0, 0, 0, "");
- else uiDefIconBut(block, BUT, 0, ICON_PARLIB, 219,130,21,20, 0, 0, 0, 0, 0, "");
- }
- uiBlockSetCol(block, TH_AUTO);
- uiDefBut(block, BUT, B_TEXCLEAR, "Clear", 122, 130, 72, 20, 0, 0, 0, 0, 0, "Erases link to texture");
-
- }
- else
- uiDefButS(block, TOG, B_EXTEXBROWSE, "Add New" ,100, 150, 163, 20, &(G.buts->texnr), -1.0, 32767.0, 0, 0, "Adds a new texture datablock");
-
- // force no centering
- uiDefBut(block, LABEL, 0, " ", 250, 10, 25, 20, 0, 0, 0, 0, 0, "");
-
- uiBlockSetCol(block, TH_AUTO);
-}
-
-static void material_panel_tramir(Material *ma)
-{
- uiBlock *block;
- short yco=PANEL_YMAX;
-
- block= uiNewBlock(&curarea->uiblocks, "material_panel_tramir", UI_EMBOSS, UI_HELV, curarea->win);
- uiNewPanelTabbed("Shaders", "Material");
- if(uiNewPanel(curarea, block, "Mirror Transp", "Material", PANELX, PANELY, PANELW, PANELH+80)==0) return;
-
- uiSetButLock(ma->id.lib!=NULL, ERROR_LIBDATA_MESSAGE);
-
- uiDefButBitI(block, TOG, MA_RAYMIRROR, B_MATPRV, "Ray Mirror",
- X2CLM1, yco-=BUTH, BUTW2, BUTH, &(ma->mode), 0, 0, 0, 0, "Enables raytracing for mirror reflection rendering");
-
- yco -= YSPACE;
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_MATPRV, "RayMir: ",
- X2CLM1, yco-=BUTH, BUTW2, BUTH, &(ma->ray_mirror), 0.0, 1.0, 100, 2, "Sets the amount mirror reflection for raytrace");
- uiDefButF(block, NUMSLI, B_MATPRV, "Fresnel: ",
- X2CLM1, yco-=BUTH, BUTW2, BUTH, &(ma->fresnel_mir), 0.0, 5.0, 10, 2, "Power of Fresnel for mirror reflection");
- uiDefButF(block, NUMSLI, B_MATPRV, "Fac: ",
- X2CLM1, yco-=BUTH, BUTW2, BUTH, &(ma->fresnel_mir_i), 1.0, 5.0, 10, 2, "Blending factor for Fresnel");
- uiBlockEndAlign(block);
-
- yco -= YSPACE;
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_MATPRV, "Gloss: ",
- X2CLM1, yco-=BUTH, BUTW2, BUTH, &(ma->gloss_mir), 0.0, 1.0, 100, 0, "The shininess of the reflection. Values < 1.0 give diffuse, blurry reflections ");
- uiDefButF(block, NUMSLI, B_MATPRV, "Aniso: ",
- X2CLM1, yco-=BUTH, BUTW2, BUTH, &(ma->aniso_gloss_mir), 0.0, 1.0, 100, 0, "The shape of the reflection, from 0. (circular) to 1.0 (fully stretched along the tangent)");
- uiDefButS(block, NUM, B_MATPRV, "Samples:",
- X2CLM1, yco-=BUTH, BUTW2, BUTH, &(ma->samp_gloss_mir), 1.0, 1024.0, 100, 0, "Number of cone samples averaged for blurry reflections");
- uiDefButF(block, NUM, B_MATPRV, "Thresh: ",
- X2CLM1, yco-=BUTH, BUTW2, BUTH, &(ma->adapt_thresh_mir), 0.0, 1.0, 100, 0, "Threshold for adaptive sampling. If a sample contributes less than this amount (as a percentage), sampling is stopped");
- uiBlockEndAlign(block);
-
- yco -= YSPACE;
- uiDefButS(block, NUM, B_MATPRV, "Depth:",
- X2CLM1, yco-=BUTH, BUTW2, BUTH, &(ma->ray_depth), 0.0, 10.0, 100, 0, "Maximum allowed number of light inter-reflections");
-
- yco -= YSPACE;
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_MATPRV, "Max Dist:",
- X2CLM1, yco-=BUTH, BUTW2, BUTH, &(ma->dist_mir), 0.0, 100.0, 100, 0, "Maximum distance of reflected rays. Reflections further than this range fade to sky color");
- uiDefButS(block, MENU, B_MATPRV, "Ray end fade-out: %t|Fade to Sky Color %x0|Fade to Material Color %x1",
- X2CLM1, yco-=BUTH, BUTW2, BUTH, &(ma->fadeto_mir), 0, 0, 0, 0, "The color that rays with no intersection within the Max Distance take. Material color can be best for indoor scenes, sky color for outdoor.");
- uiBlockEndAlign(block);
-
- yco=PANEL_YMAX;
-
- uiDefButBitI(block, TOG, MA_RAYTRANSP, B_MATRAYTRANSP,"Ray Transp",
- X2CLM2, yco-=BUTH, BUTW2, BUTH, &(ma->mode), 0, 0, 0, 0, "Enables raytracing for transparent refraction rendering");
-
- yco -= YSPACE;
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_MATPRV, "IOR: ",
- X2CLM2, yco-=BUTH, BUTW2, BUTH, &(ma->ang), 1.0, 3.0, 100, 2, "Sets angular index of refraction for raytraced refraction");
- uiDefButF(block, NUMSLI, B_MATPRV, "Fresnel: ",
- X2CLM2, yco-=BUTH, BUTW2, BUTH, &(ma->fresnel_tra), 0.0, 5.0, 10, 2, "Power of Fresnel for mirror reflection");
- uiDefButF(block, NUMSLI, B_MATPRV, "Fac: ",
- X2CLM2, yco-=BUTH, BUTW2, BUTH, &(ma->fresnel_tra_i), 1.0, 5.0, 10, 2, "Blending factor for Fresnel");
- uiBlockEndAlign(block);
-
- yco -= YSPACE;
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_MATPRV, "Gloss: ",
- X2CLM2, yco-=BUTH, BUTW2, BUTH, &(ma->gloss_tra), 0.0, 1.0, 100, 0, "The clarity of the refraction. Values < 1.0 give diffuse, blurry reflections ");
- uiDefButS(block, NUM, B_MATPRV, "Samples:",
- X2CLM2, yco-=BUTH, BUTW2, BUTH, &(ma->samp_gloss_tra), 0.0, 1024.0, 100, 0, "Number of cone samples averaged for blurry refractions");
- uiDefButF(block, NUM, B_MATPRV, "Thresh: ",
- X2CLM2, yco-=BUTH, BUTW2, BUTH, &(ma->adapt_thresh_tra), 0.0, 1.0, 100, 0, "Threshold for adaptive sampling. If a sample contributes less than this amount (as a percentage), sampling is stopped");
- uiBlockEndAlign(block);
-
- yco -= YSPACE;
-
- uiDefButS(block, NUM, B_MATPRV, "Depth:",
- X2CLM2, yco-=BUTH, BUTW2, BUTH, &(ma->ray_depth_tra), 0.0, 10.0, 100, 0, "Maximum allowed number of light inter-refractions");
-
- yco -= YSPACE;
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_MATPRV, "Filter:",
- X2CLM2, yco-=BUTH, BUTW2, BUTH, &(ma->filter), 0.0, 1.0, 10, 0, "Amount to blend in the material's diffuse color in raytraced transparency (simulating absorption)");
- uiDefButF(block, NUMSLI, B_MATPRV, "Limit: ",
- X2CLM2, yco-=BUTH, BUTW2, BUTH, &(ma->tx_limit), 0.0, 100.0, 10, 2, "Maximum depth for light to travel through the transparent material before becoming fully filtered (0.0 is disabled)");
- uiDefButF(block, NUMSLI, B_MATPRV, "Falloff: ",
- X2CLM2, yco-=BUTH, BUTW2, BUTH, &(ma->tx_falloff), 0.1, 10.0, 10, 2, "Falloff power for transmissivity filter effect (1.0 is linear)");
- uiBlockEndAlign(block);
-
- yco -= YSPACE;
-
- uiDefButF(block, NUMSLI, B_MATPRV, "SpecTra: ",
- X2CLM2, yco-=BUTH, BUTW2, BUTH, &(ma->spectra), 0.0, 1.0, 0, 0, "Makes specular areas opaque on transparent materials");
-}
-
-/* yafray: adapted version of Blender's tramir panel.
- * Only removed the buttons not needed, so only the ones that are important for yafray are left.
- * Also re-arranged buttons for more room for extra parameters.
- * With the exception of the material preset menu and the new parameters,
- * most of blender's parameters are re-used without interfering with them.
- */
-static void material_panel_tramir_yafray(Material *ma)
-{
- uiBlock *block;
- char *mstr = "Material presets %t|No Reflect/Transmit %x0|Clear Glass %x1|Color Glass %x2|Uniform Reflect %x3|Fresnel Reflect %x4";
-
- /* better to use same name as original panel */
- block= uiNewBlock(&curarea->uiblocks, "material_panel_tramir", UI_EMBOSS, UI_HELV, curarea->win);
- uiNewPanelTabbed("Shaders", "Material");
- if(uiNewPanel(curarea, block, "Mirror Transp", "Material", 640, 0, 318, 204)==0) return;
-
- uiSetButLock(ma->id.lib!=NULL, ERROR_LIBDATA_MESSAGE);
-
- /* material preset menu */
- uiDefBut(block, LABEL, 0, "Mat.Preset", 20, 182, 100, 20, 0, 0.0, 0.0, 0, 0, "");
- uiDefButI(block, MENU, B_MAT_YF_PRESET, mstr, 110, 182, 200, 20, &ma->YF_preset, 0.0, 0.0, 0, 0, "Basic material presets to start with");
-
- uiDefButBitI(block, TOG, MA_RAYMIRROR, B_MATPRV,"Ray Mirror", 10,160,100,20, &(ma->mode), 0, 0, 0, 0, "Enables raytracing for mirror reflection rendering");
- uiDefButBitI(block, TOG, MA_RAYTRANSP, B_MATRAYTRANSP,"Ray Transp", 110,160,100,20, &(ma->mode), 0, 0, 0, 0, "Enables raytracing for transparency rendering");
- uiDefButBitI(block, TOG, MA_ZTRA, B_MATZTRANSP,"ZTransp", 210,160,100,20, &(ma->mode), 0, 0, 0, 0, "Use for objects with alphamap textures");
-
- uiDefButF(block, NUMSLI, B_MATPRV, "rayMir ", 10,140,150,20, &(ma->ray_mirror), 0.0, 1.0, 100, 2, "Sets the amount mirror reflection for raytrace");
- uiDefButF(block, NUMSLI, B_MATPRV, "frsOfs ", 160,140,150,20, &(ma->fresnel_mir_i), 1.0, 5.0, 10, 2, "Fresnel offset, 1 is uniform mirror, 5 is fresnel mirror (IOR>1)");
-
- /* ior has extended range up to 30, for use with total fresnel reflection */
- uiDefButF(block, NUMSLI, B_MATPRV, "IOR ", 10,115,150,20, &(ma->ang), 1.0, 30.0, 100, 2, "Sets the angular index of refraction for raytrace");
-
- // parameters only used in ray_transp mode
- if(ma->mode & MA_RAYTRANSP) {
- // Filter
- uiDefButF(block, NUM, B_MATPRV, "Filt:", 160,115,150,20, &(ma->filter), 0.0, 1.0, 10, 0, "Amount of filtering for transparent raytrace");
-
- /* absorption color */
- uiDefBut(block, LABEL, 0, "Absorption Color", 10, 98, 150, 18, 0, 0.0, 0.0, 0, 0, "");
- uiDefButF(block, COL, B_MATPRV, "", 10, 38, 30, 58, &ma->YF_ar, 0, 0, 0, B_MATCOL, "transmit absorption color, white is no absorption");
- uiDefButF(block, NUMSLI, B_MATPRV, "aR ", 40, 78, 120, 18, &ma->YF_ar, 1e-7f, 1.0, B_MATCOL, 0, "");
- uiDefButF(block, NUMSLI, B_MATPRV, "aG ", 40, 58, 120, 18, &ma->YF_ag, 1e-7f, 1.0, B_MATCOL, 0, "");
- uiDefButF(block, NUMSLI, B_MATPRV, "aB ", 40, 38, 120, 18, &ma->YF_ab, 1e-7f, 1.0, B_MATCOL, 0, "");
- uiDefButF(block, NUM, B_MATPRV, "Ds", 10, 18, 150, 18, &ma->YF_dscale, 1e-7f, 100.0, 10.0, 0, "absorption distance scale, 1 is one blender (world) unit of distance");
-
- /* disperions parameters */
- uiDefBut(block, LABEL, 0, "Dispersion", 160, 98, 150, 18, 0, 0.0, 0.0, 0, 0, "");
- uiDefButF(block, NUM, B_MATPRV, "Pwr ", 160, 78, 150, 18, &ma->YF_dpwr, 0.0, 1.0, 0.25, 0, "Dispersion power, the higher, the more dispersion, 0 is no dispersion");
- uiDefButI(block, NUM, B_MATPRV, "Samples ", 160, 58, 150, 18, &ma->YF_dsmp, 1.0, 100.0, 0, 0, "Dispersion samples, minimum at least 10, unless using jitter ");
- uiDefButBitI(block, TOG, 1, B_MATPRV, "Jitter", 160, 38, 150, 18, &ma->YF_djit, 0.0, 1.0, 0, 0, "Enable jittering of wavelenghts, adds noise");
- }
-
-}
-
-static void material_sss_preset_cb(void *material_v, void *unused_v)
-{
- static const float presets[11][7] = {
- {0.909578, 0.905931, 0.665691, 6.961082, 6.400181, 1.895899, 1.300000},
- {0.429632, 0.210025, 0.167767, 11.605177, 3.883766, 1.754386, 1.300000},
- {0.439300, 0.216000, 0.141027, 9.435642, 3.347647, 1.790287, 1.300000},
- {0.986552, 0.942637, 0.827285, 15.027623, 4.663968, 2.541380, 1.300000},
- {0.221636, 0.007505, 0.002154, 4.761743, 0.574827, 0.394116, 1.300000},
- {0.925008, 0.905025, 0.884275, 8.509412, 5.566180, 3.951266, 1.500000},
- {0.855344, 0.740311, 0.291994, 14.266395, 7.227615, 2.036157, 1.300000},
- {0.889319, 0.888034, 0.795811, 18.424364, 10.443473, 3.501882, 1.300000},
- {0.573652, 0.312750, 0.174289, 3.673294, 1.366534, 0.682693, 1.300000},
- {0.748679, 0.570766, 0.467133, 4.821475, 1.693699, 1.089971, 1.300000},
- {0.947235, 0.931028, 0.851872, 10.898815, 6.575351, 2.508417, 1.300000}};
-
- Material *ma= (Material*)material_v;
-
- if(ma->sss_preset==0) return;
-
- ma->sss_col[0]= presets[ma->sss_preset][0];
- ma->sss_col[1]= presets[ma->sss_preset][1];
- ma->sss_col[2]= presets[ma->sss_preset][2];
- ma->sss_radius[0]= presets[ma->sss_preset][3];
- ma->sss_radius[1]= presets[ma->sss_preset][4];
- ma->sss_radius[2]= presets[ma->sss_preset][5];
- ma->sss_ior= presets[ma->sss_preset][6];
-}
-
-static void material_sss_custom_set_cb(void *material_v, void *unused_v)
-{
- Material *ma= (Material*)material_v;
-
- ma->sss_preset= 0;
- allqueue(REDRAWNODE, 0);
-}
-
-static void material_panel_sss(Material *ma)
-{
- uiBlock *block;
- uiBut *bt;
-
- block= uiNewBlock(&curarea->uiblocks, "material_panel_sss", UI_EMBOSS, UI_HELV, curarea->win);
- uiNewPanelTabbed("Mirror Transp", "Material");
- if(uiNewPanel(curarea, block, "SSS", "Material", 640, 0, 318, 204)==0) return;
-
- uiSetButLock(ma->id.lib!=NULL, ERROR_LIBDATA_MESSAGE);
-
- uiDefButBitS(block, TOG, MA_DIFF_SSS, B_MATPRV,"Subsurface Scattering",10,180,180,20, &(ma->sss_flag), 0, 0, 0, 0, "Enables diffuse subsurface scattering");
-
- bt=uiDefButS(block, MENU, B_MATPRV, "Apple %x1|Chicken %x2|Cream %x3|Ketchup %x4|Marble %x5|Potato %x6|Skim Milk %x7|Skin 1 %x8|Skin 2 %x9|Whole Milk %x10|Custom %x0",
- 200,180,110,20, &ma->sss_preset, 0, 0, 0, 0, "");
- uiButSetFunc(bt, material_sss_preset_cb, ma, NULL);
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_MATPRV, "Scale:", 10,150,145,20,
- &ma->sss_scale, 0.001, 1000, 1, 3, "Object scale");
- bt=uiDefButF(block, NUM, B_MATPRV, "Radius R", 10,130,145,20,
- &ma->sss_radius[0], 0.0001, 10000, 1, 3,
- "Mean red scattering path length");
- uiButSetFunc(bt, material_sss_custom_set_cb, ma, NULL);
- bt=uiDefButF(block, NUM, B_MATPRV, "Radius G", 10,110,145,20,
- &ma->sss_radius[1], 0.0001, 10000, 1, 3,
- "Mean green scattering path length");
- uiButSetFunc(bt, material_sss_custom_set_cb, ma, NULL);
- bt=uiDefButF(block, NUM, B_MATPRV, "Radius B", 10,90,145,20,
- &ma->sss_radius[2], 0.0001, 10000, 1, 3,
- "Mean blue scattering path length");
- uiButSetFunc(bt, material_sss_custom_set_cb, ma, NULL);
- uiBlockEndAlign(block);
-
- bt=uiDefButF(block, NUM, B_MATPRV, "IOR:", 10,60,145,20,
- &ma->sss_ior, 0.1, 2, 1, 3, "Index of refraction (higher values are denser)");
- uiButSetFunc(bt, material_sss_custom_set_cb, ma, NULL);
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_MATPRV, "Error:", 10,30,145,20,
- &ma->sss_error, 0.0001, 10, 1, 3, "Error tolerance (low values are slower and higher quality)");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- bt=uiDefButF(block, COL, B_MATPRV, "", 165,150,145,20,
- &ma->sss_col[0], 0.0, 1.0, 0, 0,
- "Scattering color");
- uiButSetFunc(bt, material_sss_custom_set_cb, ma, NULL);
- uiDefButF(block, NUMSLI, B_MATPRV, "Col ", 165,130,145,20,
- &ma->sss_colfac, 0.0, 1.0, 0, 0,
- "Blend factor for SSS colors");
- uiDefButF(block, NUMSLI, B_MATPRV, "Tex ", 165,110,145,20,
- &ma->sss_texfac, 0.0, 1.0, 0, 0,
- "Texture scattering factor");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_MATPRV, "Front ", 165,80,145,20,
- &ma->sss_front, 0.0, 2.0, 0, 0,
- "Front scattering weight");
- uiDefButF(block, NUMSLI, B_MATPRV, "Back ", 165,60,145,20,
- &ma->sss_back, 0.0, 10.0, 0, 0,
- "Back scattering weight");
- uiBlockEndAlign(block);
-}
-
-static void material_panel_shading(Material *ma)
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "material_panel_shading", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Shaders", "Material", 640, 0, 318, 204)==0) return;
-
- uiSetButLock(ma->id.lib!=NULL, ERROR_LIBDATA_MESSAGE);
-
- if(ma->mode & MA_HALO) {
- uiDefButF(block, NUM, B_MATPRV, "HaloSize: ", 10,155,190,18, &(ma->hasize), 0.0, 100.0, 10, 3, "Sets the dimension of the halo");
- uiDefButS(block, NUMSLI, B_MATPRV, "Hard ", 10,135,190,18, &(ma->har), 1.0, 127.0, 0, 0, "Sets the hardness of the halo");
- uiDefButF(block, NUMSLI, B_MATPRV, "Add ", 10,115,190,18, &(ma->add), 0.0, 1.0, 0, 0, "Sets the strength of the add effect");
-
- uiDefButS(block, NUM, B_MATPRV, "Rings: ", 10,90,90,18, &(ma->ringc), 0.0, 24.0, 0, 0, "Sets the number of rings rendered over the halo");
- uiDefButS(block, NUM, B_MATPRV, "Lines: ", 100,90,100,18, &(ma->linec), 0.0, 250.0, 0, 0, "Sets the number of star shaped lines rendered over the halo");
- uiDefButS(block, NUM, B_MATPRV, "Star: ", 10,70,90,18, &(ma->starc), 3.0, 50.0, 0, 0, "Sets the number of points on the star shaped halo");
- uiDefButC(block, NUM, B_MATPRV, "Seed: ", 100,70,100,18, &(ma->seed1), 0.0, 255.0, 0, 0, "Randomizes ring dimension and line location");
- if(ma->mode & MA_HALO_FLARE) {
- uiDefButF(block, NUM, B_MATPRV, "FlareSize: ", 10,50,95,18, &(ma->flaresize), 0.1, 25.0, 10, 3, "Sets the factor by which the flare is larger than the halo");
- uiDefButF(block, NUM, B_MATPRV, "Sub Size: ", 100,50,100,18, &(ma->subsize), 0.1, 25.0, 10, 3, "Sets the dimension of the subflares, dots and circles");
- uiDefButF(block, NUMSLI, B_MATPRV, "Boost: ", 10,30,190,18, &(ma->flareboost), 0.1, 10.0, 10, 3, "Gives the flare extra strength");
- uiDefButC(block, NUM, B_MATPRV, "Fl.seed: ", 10,10,90,18, &(ma->seed2), 0.0, 255.0, 0, 0, "Specifies an offset in the flare seed table");
- uiDefButS(block, NUM, B_MATPRV, "Flares: ", 100,10,100,18, &(ma->flarec), 1.0, 32.0, 0, 0, "Sets the number of subflares");
- }
- uiBlockSetCol(block, TH_BUT_SETTING1);
-
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, MA_HALO_FLARE, B_MATPRV, "Flare",245,142,65,28, &(ma->mode), 0, 0, 0, 0, "Renders halo as a lensflare");
- uiDefButBitI(block, TOG, MA_HALO_RINGS, B_MATPRV, "Rings", 245,123,65, 18, &(ma->mode), 0, 0, 0, 0, "Renders rings over halo");
- uiDefButBitI(block, TOG, MA_HALO_LINES, B_MATPRV, "Lines", 245,104,65, 18, &(ma->mode), 0, 0, 0, 0, "Renders star shaped lines over halo");
- uiDefButBitI(block, TOG, MA_STAR, B_MATPRV, "Star", 245,85,65, 18, &(ma->mode), 0, 0, 0, 0, "Renders halo as a star");
- uiDefButBitI(block, TOG, MA_HALOTEX, B_MATPRV, "HaloTex", 245,66,65, 18, &(ma->mode), 0, 0, 0, 0, "Gives halo a texture");
- uiDefButBitI(block, TOG, MA_HALOPUNO, B_MATPRV, "HaloPuno", 245,47,65, 18, &(ma->mode), 0, 0, 0, 0, "Uses the vertex normal to specify the dimension of the halo");
- uiDefButBitI(block, TOG, MA_HALO_XALPHA, B_MATPRV, "X Alpha", 245,28,65, 18, &(ma->mode), 0, 0, 0, 0, "Uses extreme alpha");
- uiDefButBitI(block, TOG, MA_HALO_SHADE, B_MATPRV, "Shaded", 245,9,65, 18, &(ma->mode), 0, 0, 0, 0, "Lets halo receive light and shadows");
- uiBlockEndAlign(block);
- }
- else {
- char *str1= "Diffuse Shader%t|Lambert %x0|Oren-Nayar %x1|Toon %x2|Minnaert %x3|Fresnel %x4";
- char *str2= "Specular Shader%t|CookTorr %x0|Phong %x1|Blinn %x2|Toon %x3|WardIso %x4";
-
- /* diff shader buttons */
- uiDefButS(block, MENU, B_MATPRV, str1, 9, 180,78,19, &(ma->diff_shader), 0.0, 0.0, 0, 0, "Creates a diffuse shader");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_MATPRV, "Ref ", 90,180,150,19, &(ma->ref), 0.0, 1.0, 0, 0, "Sets the amount of reflection");
- if(ma->diff_shader==MA_DIFF_ORENNAYAR)
- uiDefButF(block, NUMSLI, B_MATPRV, "Rough:",90,160, 150,19, &(ma->roughness), 0.0, 3.14, 0, 0, "Sets Oren Nayar Roughness");
- else if(ma->diff_shader==MA_DIFF_TOON) {
- uiDefButF(block, NUMSLI, B_MATPRV, "Size:", 90, 160,150,19, &(ma->param[0]), 0.0, 3.14, 0, 0, "Sets size of diffuse toon area");
- uiDefButF(block, NUMSLI, B_MATPRV, "Smooth:",90,140,150,19, &(ma->param[1]), 0.0, 1.0, 0, 0, "Sets smoothness of diffuse toon area");
- }
- else if(ma->diff_shader==MA_DIFF_MINNAERT)
- uiDefButF(block, NUMSLI, B_MATPRV, "Dark:",90,160, 150,19, &(ma->darkness), 0.0, 2.0, 0, 0, "Sets Minnaert darkness");
- else if(ma->diff_shader==MA_DIFF_FRESNEL) {
- uiDefButF(block, NUMSLI, B_MATPRV, "Fresnel:", 90, 160,150,19, &(ma->param[1]), 0.0, 5.0, 0, 0, "Power of Fresnel");
- uiDefButF(block, NUMSLI, B_MATPRV, "Fac:",90,140,150,19, &(ma->param[0]), 1.0, 5.0, 0, 0, "Blending factor");
- }
- uiBlockEndAlign(block);
-
- /* spec shader buttons */
- uiDefButS(block, MENU, B_MATPRV, str2, 9,120,77,19, &(ma->spec_shader), 0.0, 0.0, 0, 0, "Creates a specular shader");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_MATPRV, "Spec ", 90,120,150,19, &(ma->spec), 0.0, 2.0, 0, 0, "Sets the degree of specularity");
- if ELEM3(ma->spec_shader, MA_SPEC_COOKTORR, MA_SPEC_PHONG, MA_SPEC_BLINN) {
- uiDefButS(block, NUMSLI, B_MATPRV, "Hard:", 90, 100, 150,19, &(ma->har), 1.0, 511, 0, 0, "Sets the hardness of the specularity");
- }
- if(ma->spec_shader==MA_SPEC_BLINN)
- uiDefButF(block, NUMSLI, B_MATPRV, "Refr:", 90, 80,150,19, &(ma->refrac), 1.0, 10.0, 0, 0, "Sets the material's Index of Refraction");
- if(ma->spec_shader==MA_SPEC_TOON) {
- uiDefButF(block, NUMSLI, B_MATPRV, "Size:", 90, 100,150,19, &(ma->param[2]), 0.0, 1.53, 0, 0, "Sets the size of specular toon area");
- uiDefButF(block, NUMSLI, B_MATPRV, "Smooth:",90, 80,150,19, &(ma->param[3]), 0.0, 1.0, 0, 0, "Sets the smoothness of specular toon area");
- }
- if(ma->spec_shader==MA_SPEC_WARDISO)
- uiDefButF(block, NUMSLI, B_MATPRV, "rms:", 90, 100,150,19, &(ma->rms), 0.0, 0.4, 0, 0, "Sets the standard deviation of surface slope");
- /* default shading variables */
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_MATPRV, "Tralu ", 9,30,150,19, &(ma->translucency), 0.0, 1.0, 100, 2, "Translucency, amount of diffuse shading of the back side");
- uiDefButF(block, NUMSLI, B_MATPRV, "SBias ", 159,30,151,19, &(ma->sbias), 0.0, 0.25, 10, 2, "Shadow bias, to prevent terminator problems on shadow boundary");
- uiDefButF(block, NUMSLI, B_MATPRV, "Amb ", 9,10,150,19, &(ma->amb), 0.0, 1.0, 0, 0, "Sets the amount of global ambient color the material receives");
- uiDefButF(block, NUMSLI, B_MATPRV, "Emit ", 159,10,151,19, &(ma->emit), 0.0, 2.0, 0, 0, "Sets the amount of light the material emits");
- uiBlockEndAlign(block);
-
- uiBlockSetCol(block, TH_BUT_SETTING1);
- uiDefButBitI(block, TOG, MA_TANGENT_V, B_MATPRV, "Tangent V", 245,180,65,19, &(ma->mode), 0, 0, 0, 0, "Use the tangent vector in V direction for shading");
-
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, MA_SHADOW, B_MATPRV, "Shadow", 245,140,65,19, &(ma->mode), 0, 0, 0, 0, "Makes material receive shadows");
- uiDefButBitI(block, TOG, MA_SHADOW_TRA, B_MATPRV, "TraShadow", 245,120,65,19, &(ma->mode), 0, 0, 0, 0, "Receives transparent shadows based at material color and alpha");
- uiDefButBitI(block, TOG, MA_ONLYSHADOW, B_MATPRV, "OnlyShad", 245,100,65,20, &(ma->mode), 0, 0, 0, 0, "Renders shadows on material as Alpha value");
- uiDefButBitI(block, TOG, MA_RAYBIAS, B_MATPRV, "Bias", 245,80,65,19, &(ma->mode), 0, 0, 0, 0, "Prevents ray traced shadow errors with phong interpolated normals (terminator problem)");
-
- uiBlockBeginAlign(block);
- uiDefIDPoinBut(block, test_grouppoin_but, ID_GR, B_MATPRV, "GR:", 9, 55, 150, 19, &ma->group, "Limit Lighting to Lamps in this Group");
- uiDefButBitI(block, TOG, MA_GROUP_NOLAY, B_MATPRV, "Exclusive", 159,55, 85,20, &(ma->mode), 0, 0, 0, 0, "The material exclusively uses Lamps in this Group");
- }
-}
-
-static void material_panel_ramps(Material *ma)
-{
- uiBlock *block;
- ColorBand *coba;
- float *facp;
- char *inputc, *methodc;
-
- block= uiNewBlock(&curarea->uiblocks, "material_panel_ramps", UI_EMBOSS, UI_HELV, curarea->win);
- uiNewPanelTabbed("Material", "Material");
- if(uiNewPanel(curarea, block, "Ramps", "Material", 640, 0, 318, 204)==0) return;
-
- uiSetButLock(ma->id.lib!=NULL, ERROR_LIBDATA_MESSAGE);
-
- uiBlockBeginAlign(block);
- uiBlockSetCol(block, TH_BUT_SETTING1);
- uiDefButS(block, ROW, B_REDR, "Show Col Ramp",10,180,150,20, &ma->ramp_show, 0, 0, 0, 0, "Show ramp buttons for material diffuse color");
- uiDefButS(block, ROW, B_REDR, "Show Spec Ramp",160,180,150,20, &ma->ramp_show, 0, 1, 0, 0, "Show ramp buttons for material specular color");
- uiBlockSetCol(block, TH_AUTO);
-
- /* COLORBAND */
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, ma->ramp_show?MA_RAMP_SPEC:MA_RAMP_COL, B_MATCOLORBAND, "Colorband",10,145,80,20, &ma->mode, 0, 0, 0, 0, "Toggles colorband ramp operations");
-
- if(ma->mode & (ma->ramp_show?MA_RAMP_SPEC:MA_RAMP_COL)) {
- if(ma->ramp_show==0) {
- coba= ma->ramp_col;
- inputc= &ma->rampin_col;
- methodc= &ma->rampblend_col;
- facp= &ma->rampfac_col;
- }
- else {
- coba= ma->ramp_spec;
- inputc= &ma->rampin_spec;
- methodc= &ma->rampblend_spec;
- facp= &ma->rampfac_spec;
- }
- draw_colorband_buts(block, coba, 10, 50, B_MATPRV); // aligns with previous button
-
- uiDefBut(block, LABEL, 0, "Input",10,30,90,20, NULL, 0, 0, 0, 0, "");
- uiDefBut(block, LABEL, 0, "Method",100,30,90,20, NULL, 0, 0, 0, 0, "");
- uiDefBut(block, LABEL, 0, "Factor",190,30,120,20, NULL, 0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButC(block, MENU, B_MATPRV, "Shader %x0|Energy %x1|Normal %x2|Result %x3",10,10,90,20, inputc, 0, 0, 0, 0, "Input for Ramp");
- uiDefButC(block, MENU, B_MATPRV, "Mix %x0|Add %x1|Subtract %x3|Multiply %x2|Screen %x4|Overlay %x9|Divide %x5|Difference %x6|Darken %x7|Lighten %x8|Dodge %x10|Burn %x11|Color %x15|Value %x14|Saturation %x13|Hue %x12",110,10,90,20, methodc, 0, 0, 0, 0, "Blending method for Ramp (uses alpha in Colorband)");
- uiDefButF(block, NUMSLI, B_MATPRV, "", 190,10,120,20, facp, 0.0, 1.0, 100, 0, "Blending factor (also uses alpha in Colorband)");
- }
-}
-
-/* NOTE: this is a block-menu, needs 0 events, otherwise the menu closes */
-static uiBlock *strand_menu(void *mat_v)
-{
- Material *ma= mat_v;
- uiBlock *block;
- int buth=20, butw=230, butx=10, buty=160;
-
- block= uiNewBlock(&curarea->uiblocks, "strand menu", UI_EMBOSS, UI_HELV, curarea->win);
-
- if(ma->mode & MA_STR_B_UNITS)
- buty += buth;
-
- /* use this for a fake extra empy space around the buttons */
- uiDefBut(block, LABEL, 0, "", 0, 0, butw+20, buty+10, NULL, 0, 0, 0, 0, "");
- /* event return 0, to prevent menu to close */
-
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, MA_TANGENT_STR, 0, "Use Tangent Shading", butx,buty-=buth,butw,buth, &(ma->mode), 0, 0, 0, 0, "Uses direction of strands as normal for tangent-shading");
- uiDefButBitI(block, TOG, MA_STR_SURFDIFF, 0, "Surface Diffuse", butx,buty-=buth,butw/2,buth, &(ma->mode), 0, 0, 0, 0, "Make diffuse shading more similar to shading the surface");
- uiDefButF(block, NUM, 0, "Dist", butx+butw/2,buty,butw/2,buth, &ma->strand_surfnor, 0.0f, 10.0f, 2, 0, "Distance in Blender units over which to blend in the surface normal");
-
- buty -= 5;
-
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, MA_STR_B_UNITS, 0, "Use Blender Units", butx,buty-=buth,butw,buth, &(ma->mode), 0, 0, 0, 0, "Use actual Blender units for widths instead of pixels");
- if(ma->mode & MA_STR_B_UNITS){
- uiDefButF(block, NUMSLI, 0, "Start ", butx,buty-=buth, butw,buth, &ma->strand_sta, 0.0001, 2.0, 2, 0, "Start size of strands in Blender units");
- uiDefButF(block, NUMSLI, 0, "End ", butx,buty-=buth, butw,buth, &ma->strand_end, 0.0001, 1.0, 2, 0, "End size of strands in Blender units");
- uiDefButF(block, NUMSLI, 0, "Minimum ", butx,buty-=buth, butw,buth, &ma->strand_min, 0.001, 10.0, 0, 0, "Minimum size of strands in pixels");
- }
- else{
- uiDefButF(block, NUMSLI, 0, "Start ", butx,buty-=buth, butw,buth, &ma->strand_sta, 0.25, 20.0, 2, 0, "Start size of strands in pixels");
- uiDefButF(block, NUMSLI, 0, "End ", butx,buty-=buth, butw,buth, &ma->strand_end, 0.25, 10.0, 2, 0, "End size of strands in pixels");
- }
- uiDefButF(block, NUMSLI, 0, "Shape ", butx,buty-=buth, butw,buth, &ma->strand_ease, -0.9, 0.9, 2, 0, "Shape of strands, positive value makes it rounder, negative makes it spiky");
- uiDefBut(block, TEX, B_MATPRV, "UV:", butx,buty-=buth,butw,buth, ma->strand_uvname, 0, 31, 0, 0, "Set name of UV layer to override");
-
- uiBlockSetDirection(block, UI_TOP);
- BIF_preview_changed(ID_MA);
- return block;
-}
-
-
-static void material_panel_material(Material *ma)
-{
- uiBlock *block;
- float *colpoin = NULL;
- int rgbsel = 0;
-
- block= uiNewBlock(&curarea->uiblocks, "material_panel_material", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Material", "Material", 320, 0, 318, 204)==0) return;
-
- uiSetButLock(ma->id.lib!=NULL, ERROR_LIBDATA_MESSAGE);
- uiBlockBeginAlign(block);
- uiDefIconBut(block, BUT, B_MATCOPY, ICON_COPYUP, 262,200,XIC,YIC, 0, 0, 0, 0, 0, "Copies Material to the buffer");
- uiDefIconBut(block, BUT, B_MATPASTE, ICON_PASTEUP, 283,200,XIC,YIC, 0, 0, 0, 0, 0, "Pastes Material from the buffer");
- uiBlockEndAlign(block);
- if(ma->dynamode & MA_DRAW_DYNABUTS) {
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_DIFF, "Restitut ", 128,120,175,20, &ma->reflect, 0.0, 1.0, 0, 0, "Elasticity of collisions");
- uiDefButF(block, NUMSLI, B_DIFF, "Friction ", 128,100 ,175,20, &ma->friction, 0.0, 100.0, 0, 0, "Coulomb friction coefficient");
- uiDefButF(block, NUMSLI, B_DIFF, "Fh Force ", 128,80 ,175,20, &ma->fh, 0.0, 1.0, 0, 0, "Upward spring force within the Fh area");
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_NOP, "Fh Damp ", 8,120,100,20, &ma->xyfrict, 0.0, 1.0, 10, 0, "Damping of the Fh spring force");
- uiDefButF(block, NUM, B_NOP, "Fh Dist ", 8,100 ,100,20, &ma->fhdist, 0.0, 20.0, 10, 0, "Height of the Fh area");
- uiDefButBitS(block, TOG, MA_FH_NOR, 0, "Fh Norm", 8,80 ,100,20, &ma->dynamode, 0.0, 0.0, 0, 0, "Add a horizontal spring force on slopes");
- }
- else {
- if(!(ma->mode & MA_HALO)) {
- uiBlockBeginAlign(block);
- uiBlockSetCol(block, TH_BUT_SETTING1);
- uiDefButBitI(block, TOG, MA_VERTEXCOL, B_MAT_VCOL_LIGHT, "VCol Light", 8,166,74,20, &(ma->mode), 0, 0, 0, 0, "Adds vertex colors as extra light");
- uiDefButBitI(block, TOG, MA_VERTEXCOLP, B_MAT_VCOL_PAINT, "VCol Paint", 82,166,74,20, &(ma->mode), 0, 0, 0, 0, "Replaces material's colors with vertex colors");
- uiDefButBitI(block, TOG, MA_FACETEXTURE, B_REDR, "TexFace", 156,166,64,20, &(ma->mode), 0, 0, 0, 0, "Sets UV-Editor assigned texture as color and texture info for faces");
- if (ma->mode & MA_FACETEXTURE) uiDefButBitI(block, TOG, MA_FACETEXTURE_ALPHA, B_REDR, "A", 220,166,20,20, &(ma->mode), 0, 0, 0, 0, "Use alpha channel in 'TexFace' assigned images");
- uiDefButBitI(block, TOG, MA_SHLESS, B_MATPRV, "Shadeless", 240,166,63,20, &(ma->mode), 0, 0, 0, 0, "Makes material insensitive to light or shadow");
-
- uiDefButBitI(block, TOG, MA_NOMIST, B_NOP, "No Mist", 8,146,74,20, &(ma->mode), 0, 0, 0, 0, "Sets the material to ignore mist values");
- uiDefButBitI(block, TOG, MA_ENV, B_MATPRV, "Env", 82,146,74,20, &(ma->mode), 0, 0, 0, 0, "Causes faces to render with alpha zero: allows sky/backdrop to show through (only for solid faces)");
- uiDefButF(block, NUM, B_NOP, "Shad A ", 156,146,147,19, &ma->shad_alpha, 0.001, 1.0f, 100, 0, "Shadow casting alpha, only in use for Irregular Shadowbuffer");
- }
- uiBlockSetCol(block, TH_AUTO);
- uiBlockBeginAlign(block);
- uiDefButF(block, COL, B_MATPRV, "", 8,97,72,20, &(ma->r), 0, 0, 0, B_MATCOL, "");
- uiDefButF(block, COL, B_MATPRV, "", 8,77,72,20, &(ma->specr), 0, 0, 0, B_SPECCOL, "");
- uiDefButF(block, COL, B_MATPRV, "", 8,57,72,20, &(ma->mirr), 0, 0, 0, B_MIRCOL, "");
-
- uiBlockBeginAlign(block);
- if(ma->mode & MA_HALO) {
- uiDefButC(block, ROW, REDRAWBUTSSHADING, "Halo", 83,97,40,20, &(ma->rgbsel), 2.0, 0.0, 0, 0, "Sets the color of the halo with the RGB sliders");
- uiDefButC(block, ROW, REDRAWBUTSSHADING, "Line", 83,77,40,20, &(ma->rgbsel), 2.0, 1.0, 0, 0, "Sets the color of the lines with the RGB sliders");
- uiDefButC(block, ROW, REDRAWBUTSSHADING, "Ring", 83,57,40,20, &(ma->rgbsel), 2.0, 2.0, 0, 0, "Sets the color of the rings with the RGB sliders");
- }
- else {
- uiDefButC(block, ROW, REDRAWBUTSSHADING, "Col", 83,97,40,20, &(ma->rgbsel), 2.0, 0.0, 0, 0, "Sets the diffuse color of the material");
- uiDefButC(block, ROW, REDRAWBUTSSHADING, "Spe", 83,77,40,20, &(ma->rgbsel), 2.0, 1.0, 0, 0, "Sets the specular color of the material");
- uiDefButC(block, ROW, REDRAWBUTSSHADING, "Mir", 83,57,40,20, &(ma->rgbsel), 2.0, 2.0, 0, 0, "Sets the mirror color of the material");
- }
-
- if(ma->rgbsel==0) {colpoin= &(ma->r); rgbsel= B_MATCOL;}
- else if(ma->rgbsel==1) {colpoin= &(ma->specr); rgbsel= B_SPECCOL;}
- else if(ma->rgbsel==2) {colpoin= &(ma->mirr); rgbsel= B_MIRCOL;}
-
- if(ma->rgbsel==0 && (ma->mode & (MA_VERTEXCOLP|MA_FACETEXTURE) && !(ma->mode & MA_HALO)));
- else if(ma->colormodel==MA_HSV) {
- uiBlockSetCol(block, TH_BUT_SETTING1);
- uiBlockBeginAlign(block);
- uiDefButF(block, HSVSLI, B_MATPRV, "H ", 128,97,175,19, colpoin, 0.0, 0.9999, rgbsel, 0, "");
- uiDefButF(block, HSVSLI, B_MATPRV, "S ", 128,77,175,19, colpoin, 0.0001, 1.0, rgbsel, 0, "");
- uiDefButF(block, HSVSLI, B_MATPRV, "V ", 128,57,175,19, colpoin, 0.0001, 1.0, rgbsel, 0, "");
- uiBlockSetCol(block, TH_AUTO);
- }
- else {
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_MATPRV, "R ", 128,97,175,19, colpoin, 0.0, 1.0, rgbsel, 0, "");
- uiDefButF(block, NUMSLI, B_MATPRV, "G ", 128,77,175,19, colpoin+1, 0.0, 1.0, rgbsel, 0, "");
- uiDefButF(block, NUMSLI, B_MATPRV, "B ", 128,57,175,19, colpoin+2, 0.0, 1.0, rgbsel, 0, "");
- }
- uiBlockEndAlign(block);
- if (ma->mode & (MA_FACETEXTURE) && ma->mode & (MA_FACETEXTURE_ALPHA)) ;
- else uiDefButF(block, NUMSLI, B_MATPRV, "A ", 128,30,175,19, &ma->alpha, 0.0, 1.0, 0, 0, "Alpha");
-
- }
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW, REDRAWBUTSSHADING, "RGB", 8,30,38,19, &(ma->colormodel), 1.0, (float)MA_RGB, 0, 0, "Creates color using red, green and blue");
- uiDefButS(block, ROW, REDRAWBUTSSHADING, "HSV", 46,30,38,19, &(ma->colormodel), 1.0, (float)MA_HSV, 0, 0, "Creates color using hue, saturation and value");
- uiDefButBitS(block, TOG, MA_DRAW_DYNABUTS, REDRAWBUTSSHADING, "DYN", 84,30,39,19, &(ma->dynamode), 0.0, 0.0, 0, 0, "Adjusts parameters for dynamics options");
-
-}
-
-static void material_panel_nodes(Material *ma)
-{
- bNode *node;
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "material_panel_nodes", UI_EMBOSS, UI_HELV, curarea->win);
- uiNewPanelTabbed("Links and Pipeline", "Material");
- if(uiNewPanel(curarea, block, "Nodes", "Material", 640, 0, 318, 204)==0) return;
-
- node= editnode_get_active(ma->nodetree);
- if(node==NULL) return;
- /* we dont display the buttons here for the active material, is in links panel */
- if(node==editnode_get_active_idnode(ma->nodetree, ID_MA)) return;
-
- if(node->typeinfo->butfunc) {
- /* we use butfunc to retrieve height for the butrect, but node->width is
- used to calculate that too. Could be done smarter once */
- rctf rct;
- rct.xmin= 10.0f;
- rct.xmax= rct.xmin+node->width-NODE_DY;
- rct.ymax= 155.0;
- rct.ymin= rct.ymax - (float)node->typeinfo->butfunc(NULL, NULL, node, NULL);
- node->typeinfo->butfunc(block, ma->nodetree, node, &rct);
- }
-}
-
-static void material_panel_links(Object *ob, Material *ma)
-{
- uiBlock *block;
- uiBut *but;
- ID *id, *idn, *idfrom;
- bNode *node=NULL;
- float min;
- short xco;
- char str[30];
-
- block= uiNewBlock(&curarea->uiblocks, "material_panel_links", UI_EMBOSS, UI_HELV, curarea->win);
- /* 310 makes sorting code to put it right after preview panel */
- if(uiNewPanel(curarea, block, "Links and Pipeline", "Material", 310, 0, 318, 204)==0) return;
-
- /* Links from object to material/nodes */
- uiDefBut(block, ROUNDBOX, 0, "", 5, 90, 310, 110, NULL, 7.0, 0.0, 15 , 20, "");
- uiDefBut(block, LABEL, B_DIFF, "Link to Object", 10, 180, 300, 20, 0, 0, 0, 0, 0, "");
-
- /* the main material browse but */
- buttons_active_id(&id, &idfrom); /* base material! */
-
- uiBlockSetCol(block, TH_BUT_SETTING2);
- xco= std_libbuttons(block, 10, 160, 0, NULL, B_MATBROWSE, ID_MA, 0, id, idfrom, &(G.buts->menunr), B_MATALONE, B_MATLOCAL, B_MATDELETE, B_AUTOMATNAME, B_KEEPDATA);
-
- if(ma) uiSetButLock(ma->id.lib!=NULL, ERROR_LIBDATA_MESSAGE);
-
- if(ma)
- uiDefButC(block, TOG, B_MAT_USENODES, "Nodes", xco+5,160,300-xco-5,20, &ma->use_nodes, 0.0f, 0.0f, 0, 0, "");
-
- if(ob->actcol==0) ob->actcol= 1; /* because of TOG|BIT button */
-
- uiBlockBeginAlign(block);
-
- /* id is the block from which the material is used */
- if( BTST(ob->colbits, ob->actcol-1) ) id= (ID *)ob;
- else id= ob->data;
-
- /* indicate which one is linking a material */
- if(id) {
- if(id->lib)
- uiSetButLock(1, ERROR_LIBDATA_MESSAGE);
- else
- uiClearButLock();
-
- strncpy(str, id->name, 2);
- str[2]= ':'; str[3]= 0;
- but= uiDefBut(block, TEX, B_IDNAME, str, 10,135,115,20, id->name+2, 0.0, 21.0, 0, 0, "Shows the block the material is linked to");
- uiButSetFunc(but, test_idbutton_cb, id->name, NULL);
- }
-
- uiBlockSetCol(block, TH_BUT_ACTION);
- uiDefButBitS(block, TOG, 1<<(ob->actcol-1), B_MATFROM, "OB", 125,135,32,20, &ob->colbits, 0, 0, 0, 0, "Links material to object");
- idn= ob->data;
- strncpy(str, idn->name, 2);
- str[2]= 0;
- uiBlockSetCol(block, TH_BUT_SETTING);
- uiDefButBitS(block, TOGN, 1<<(ob->actcol-1), B_MATFROM, str, 158,135,32,20, &ob->colbits, 0, 0, 0, 0, "Shows the block the material is linked to");
- uiBlockSetCol(block, TH_AUTO);
-
- sprintf(str, "%d Mat", ob->totcol);
- if(ob->totcol) min= 1.0; else min= 0.0;
- uiDefButC(block, NUM, B_ACTCOL, str, 190,135,110,20, &(ob->actcol), min, (float)ob->totcol, 0, 0, "Shows the number of materials on object and the active material");
- uiBlockEndAlign(block);
-
- if(ma==NULL) return;
- uiSetButLock(ma->id.lib!=NULL, ERROR_LIBDATA_MESSAGE);
-
- /* Active material node */
- if(ma->use_nodes) {
- uiDefBut(block, LABEL, B_DIFF, "Active Material Node", 10, 115, 300, 20, 0, 0, 0, 0, 0, "");
-
- if(ma) node= editnode_get_active_idnode(ma->nodetree, ID_MA);
- if(node==NULL) {
- node= editnode_get_active(ma->nodetree);
- if(node && node->type!=SH_NODE_MATERIAL)
- node= NULL;
- }
- if(node) {
- rctf rct;
- rct.xmin= 10.0f;
- rct.xmax= 300.0f;
- rct.ymax= 114.0f;
- rct.ymin= 95.0f;
- node->typeinfo->butfunc(block, ma->nodetree, node, &rct);
- }
- }
-
- /* main render pipeline settings */
- uiDefBut(block, LABEL, B_DIFF, "Render Pipeline", 10, 70, 300, 20, 0, 0, 0, 0, 0, "");
-
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, MA_HALO, B_MATHALO, "Halo", 10,50,100,19, &(ma->mode), 0, 0, 0, 0, "Renders material as a halo");
- uiDefButBitI(block, TOG, MA_ZTRA, B_MATZTRANSP,"ZTransp", 110,50,100,19, &(ma->mode), 0, 0, 0, 0, "Enables Z-Buffering of transparent faces");
- uiDefButF(block, NUM, B_DIFF, "Zoffs:", 210,50,100,19, &(ma->zoffs), 0.0, 100.0, 100, 0, "Gives faces an artificial offset in the Z buffer for Ztransp option");
-
- uiDefButBitI(block, TOG, MA_FULL_OSA, 0, "Full Osa", 10,30,75,19, &(ma->mode), 0.0, 10.0, 0, 0, "Forces to render all OSA samples, for shading and texture antialiasing");
- uiDefButBitI(block, TOG, MA_WIRE, B_MATPRV, "Wire", 85,30,75,19, &(ma->mode), 0, 0, 0, 0, "Renders only the edges of faces as a wireframe");
- uiDefBlockBut(block, strand_menu, ma, "Strands", 160,30,75, 19, "Display strand settings for static particles");
- uiDefButBitI(block, TOG, MA_ZINV, B_MATPRV, "ZInvert", 236,30,75,19, &(ma->mode), 0, 0, 0, 0, "Renders material's faces with inverted Z Buffer");
-
- uiDefButBitI(block, TOG, MA_RADIO, B_NOP, "Radio", 10,10,75,19, &(ma->mode), 0, 0, 0, 0, "Enables radiosity rendering for material");
- uiDefButBitI(block, TOG, MA_ONLYCAST, B_MATPRV,"OnlyCast", 85,10,75,19, &(ma->mode), 0, 0, 0, 0, "Makes faces cast shadows only, not rendered");
- uiDefButBitI(block, TOG, MA_TRACEBLE, B_NOP,"Traceable", 160,10,75,19, &(ma->mode), 0, 0, 0, 0, "Makes material detectable by ray tracing");
- uiDefButBitI(block, TOG, MA_SHADBUF, B_MATPRV, "Shadbuf", 235,10,75,19, &(ma->mode), 0, 0, 0, 0, "Makes material cast shadows from shadow buffer lamps");
-
-
-}
-
-static void material_panel_preview(Material *ma)
-{
- uiBlock *block;
-
- /* name "Preview" is abused to detect previewrender offset panel */
- block= uiNewBlock(&curarea->uiblocks, "material_panel_preview", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Preview", "Material", 0, 0, 318, 204)==0) return;
-
- if(ma) {
- G.buts->lockpoin= ma; /* BIF_previewdraw callback will read it */
-
- uiBlockSetDrawExtraFunc(block, BIF_previewdraw);
-
- // label to force a boundbox for buttons not to be centered
- uiDefBut(block, LABEL, 0, " ", 20,20,10,10, 0, 0, 0, 0, 0, "");
- uiBlockSetCol(block, TH_BUT_NEUTRAL);
- uiBlockBeginAlign(block);
- uiDefIconButC(block, ROW, B_MATPRV, ICON_MATPLANE, 210,180,25,22, &(ma->pr_type), 10, MA_FLAT, 0, 0, "Preview type: Flat XY plane");
- uiDefIconButC(block, ROW, B_MATPRV, ICON_MATSPHERE, 210,158,25,22, &(ma->pr_type), 10, MA_SPHERE, 0, 0, "Preview type: Sphere");
- uiDefIconButC(block, ROW, B_MATPRV, ICON_MATCUBE, 210,136,25,22, &(ma->pr_type), 10, MA_CUBE, 0, 0, "Preview type: Cube");
- uiDefIconButC(block, ROW, B_MATPRV, ICON_MONKEY, 210,114,25,22, &(ma->pr_type), 10, MA_MONKEY, 0, 0, "Preview type: Monkey");
- uiDefIconButC(block, ROW, B_MATPRV, ICON_HAIR, 210, 92,25,22, &(ma->pr_type), 10, MA_HAIR, 0, 0, "Preview type: Hair strands");
- uiDefIconButC(block, ROW, B_MATPRV, ICON_MATSPHERE, 210, 70,25,22, &(ma->pr_type), 10, MA_SPHERE_A, 0, 0, "Preview type: Large sphere with sky");
- uiBlockEndAlign(block);
-
- uiDefIconButBitC(block, TOG, SB_PRV_OSA, B_MATPRV, ICON_RING, 210, 10,25,22, &(G.buts->flag), 0, 0, 0, 0, "Preview uses OSA (oversampling)");
- }
-}
-
-void material_panels()
-{
- Material *ma;
- MTex *mtex;
- Object *ob= OBACT;
-
- if(ob==NULL) return;
-
- // type numbers are ordered
- if((ob->type<OB_LAMP) && ob->type) {
- int from_nodes= 0;
-
- ma= give_current_material(ob, ob->actcol);
-
- // always draw first 2 panels
- material_panel_preview(ma);
- material_panel_links(ob, ma);
-
- if(ma && ma->use_nodes) {
- material_panel_nodes(ma);
- from_nodes= 1;
- }
-
- ma= editnode_get_active_material(ma);
- if(ma) {
- material_panel_material(ma);
- material_panel_ramps(ma);
- material_panel_shading(ma);
-
- if (G.scene->r.renderer==R_INTERN)
- material_panel_tramir(ma);
- else {
- if(ma->YF_ar==0.f) {
- ma->YF_ar = ma->YF_ag = ma->YF_ab = 1;
- ma->YF_dscale = 1;
- }
- material_panel_tramir_yafray(ma);
- }
-
- material_panel_sss(ma);
- material_panel_texture(ob, ma);
-
- mtex= ma->mtex[ ma->texact ];
- if(mtex && mtex->tex) {
- material_panel_map_input(ob, ma);
- material_panel_map_to(ob, ma, from_nodes);
- }
- }
- }
-}
-
-void lamp_panels()
-{
- Object *ob= OBACT;
- Lamp *la;
-
- if(ob==NULL || ob->type!= OB_LAMP) return;
- la= ob->data;
-
- lamp_panel_preview(ob, ob->data);
- lamp_panel_lamp(ob, ob->data);
-
- if (ELEM(la->type, LA_SPOT, LA_LOCAL) && (la->falloff_type == LA_FALLOFF_CURVE))
- lamp_panel_falloff(ob, ob->data);
-
- /* switch to yafray lamp panel if yafray enabled */
- if (G.scene->r.renderer==R_INTERN)
- lamp_panel_spot(ob, ob->data);
- else {
- /* init vars */
- if (la->YF_numphotons==0) la->YF_numphotons=1000;
- if (la->YF_numsearch==0) la->YF_numsearch=10;
- if (la->YF_phdepth==0) la->YF_phdepth=1;
- if (la->YF_causticblur==0.0) la->YF_causticblur=0.001;
- if (la->YF_bufsize==0) la->YF_bufsize=128;
- /* spherelight radius default is zero, so nothing to do */
- lamp_panel_yafray(ob, la);
- }
- lamp_panel_texture(ob, ob->data);
- lamp_panel_mapto(ob, ob->data);
-
-}
-
-void world_panels()
-{
- World *wrld;
-
- wrld= G.scene->world;
-
- world_panel_preview(wrld);
- world_panel_world(wrld);
-
- if(wrld) {
- world_panel_mistaph(wrld);
- world_panel_amb_occ(wrld);
- world_panel_texture(wrld);
- world_panel_mapto(wrld);
- }
-}
-
-void texture_panels()
-{
- Material *ma=NULL;
- Brush *br=NULL;
- SculptData *sd=NULL;
- Lamp *la=NULL;
- World *wrld=NULL;
- bNode *node=NULL;
- Object *ob= OBACT;
- MTex *mtex= NULL;
-
- if(G.buts->texfrom==0) {
- if(ob) {
- ma= give_current_material(ob, ob->actcol);
-
- if(ma && ma->use_nodes) {
- node= editnode_get_active_idnode(ma->nodetree, ID_TE);
-
- if(node)
- ma= NULL;
- else {
- ma= editnode_get_active_material(ma);
- }
- }
- if(ma) mtex= ma->mtex[ ma->texact ];
- }
- }
- else if(G.buts->texfrom==1) {
- wrld= G.scene->world;
- if(wrld) mtex= wrld->mtex[ wrld->texact ];
- }
- else if(G.buts->texfrom==2) {
- if(ob && ob->type==OB_LAMP) {
- la= ob->data;
- mtex= la->mtex[ la->texact ];
- }
- }
- else if(G.buts->texfrom==3) {
- if(G.f & G_SCULPTMODE) {
- sd= &G.scene->sculptdata;
- if(sd->texact != -1)
- mtex= sd->mtex[sd->texact];
- }
- else {
- br= G.scene->toolsettings->imapaint.brush;
- if(br) mtex= br->mtex[br->texact];
- }
- }
-
- texture_panel_preview(mtex, ma || wrld || la || br || node || sd); // for 'from' buttons
-
- if(ma || wrld || la || br || node || sd) {
- Tex *tex= NULL;
-
- texture_panel_texture(mtex, ma, wrld, la, node, br, sd);
-
- if(mtex) tex= mtex->tex;
- else if(node) tex= (Tex *)node->id;
-
- if(tex) {
- texture_panel_colors(tex);
-
- switch(tex->type) {
- case TEX_IMAGE:
- texture_panel_image(&tex->ima, &tex->iuser);
- texture_panel_image_map(tex, mtex);
- break;
- case TEX_ENVMAP:
- texture_panel_envmap(tex);
- break;
- case TEX_CLOUDS:
- texture_panel_clouds(tex);
- break;
- case TEX_MARBLE:
- texture_panel_marble(tex);
- break;
- case TEX_STUCCI:
- texture_panel_stucci(tex);
- break;
- case TEX_WOOD:
- texture_panel_wood(tex);
- break;
- case TEX_BLEND:
- texture_panel_blend(tex);
- break;
- case TEX_MAGIC:
- texture_panel_magic(tex);
- break;
- case TEX_PLUGIN:
- texture_panel_plugin(tex);
- break;
- case TEX_NOISE:
- // no panel! (e: not really true, is affected by noisedepth param)
- break;
- /* newnoise: musgrave panels */
- case TEX_MUSGRAVE:
- texture_panel_musgrave(tex);
- break;
- case TEX_DISTNOISE:
- texture_panel_distnoise(tex);
- break;
- /* newnoise: voronoi */
- case TEX_VORONOI:
- texture_panel_voronoi(tex);
- break;
- }
- }
- }
-}
-
-void radio_panels()
-{
- Radio *rad;
- int flag;
-
- rad= G.scene->radio;
- if(rad==NULL) {
- add_radio();
- rad= G.scene->radio;
- }
-
- radio_panel_render(rad);
-
- flag= rad_phase();
-
- radio_panel_tool(rad, flag);
- if(flag) radio_panel_calculation(rad, flag);
-
-
-}
diff --git a/source/blender/src/cmap.tga.c b/source/blender/src/cmap.tga.c
deleted file mode 100644
index da515b6b106..00000000000
--- a/source/blender/src/cmap.tga.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/* DataToC output of file <cmap_tga> */
-/*
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-int datatoc_cmap_tga_size= 13400;
-char datatoc_cmap_tga[]= {"\x00\x01\x01\x00\x00\x00\x01\x18\x00\x00\x00\x00\x9a\x00\x50\x00\x08\x08\xf3\xf3\xf3\xdb\xdb\xdb\xc4\xc4\xc4\xad\xad\xad\x96\x96\x96\x7f\x7f\x7f\x67\x67\x67\x50\x50\x50\x39\x39\x39\x22\x22\x22\x0b\x0b\x0b\xf4\xf4\xf4\xe6\xc8\xec\xe6\xa4\xec\xe6\x7f\xec\xe6\x5b\xec\xe6\x36\xec\xe6\x12\xec\xb3\xec\xec\xb3\xc8\xec\xb3\xa4\xec\xb3\x7f\xec\xb3\x5b\xec" \
-"\xb3\x36\xec\xb3\x12\xec\x80\xec\xec\x80\xc8\xec\x80\xa4\xec\x80\x7f\xec\x80\x5b\xec\x80\x36\xec\x80\x12\xec\x4d\xec\xec\x4d\xc8\xec\x4d\xa4\xec\x4d\x7f\xec\x4d\x5b\xec\x4d\x36\xec\x4d\x12\xec\x1a\xec\xec\x1a\xc8\xec\x1a\xa4\xec\x1a\x7f\xec\x1a\x5b\xec\x1a\x36\xec\x1a\x12\xec\xe6\xec\xc8\xe6\xc8\xc8\xe6\xa4\xc8\xe6\x7f\xc8\xe6\x5b\xc8\xe6\x36\xc8\xe6\x12\xc8\xb3\xec\xc8\xb3\xc8\xc8\xb3\xa4\xc8\xb3\x7f\xc8\xb3\x5b\xc8\xb3\x36\xc8\xb3\x12\xc8\x80\xec\xc8\x80\xc8\xc8\x80\xa4\xc8\x80\x7f\xc8\x80\x5b\xc8\x80\x36\xc8\x80\x12\xc8\x4d\xec\xc8\x4d\xc8\xc8\x4d\xa4\xc8\x4d\x7f\xc8\x4d\x5b\xc8\x4d\x36\xc8\x4d\x12\xc8\x1a\xec\xc8\x1a\xc8\xc8\x1a\xa4\xc8\x1a\x7f\xc8\x1a\x5b\xc8\x1a\x36\xc8\x1a\x12\xc8\xe6\xec\xa4\xe6\xc8\xa4\xe6\xa4\xa4\xe6\x7f\xa4\xe6\x5b\xa4\xe6\x36\xa4\xe6\x12\xa4\xb3\xec\xa4\xb3\xc8\xa4\xb3\xa4\xa4\xb3\x7f\xa4\xb3\x5b\xa4\xb3\x36\xa4\xb3\x12\xa4\x80\xec\xa4\x80\xc8\xa4\x80\xa4\xa4\x80\x7f\xa4\x80\x5b\xa4\x80\x36\xa4\x80\x12\xa4\x4d\xec\xa4\x4d\xc8\xa4\x4d\xa4\xa4\x4d\x7f\xa4\x4d\x5b\xa4\x4d\x36\xa4\x4d" \
-"\x12\xa4\x1a\xec\xa4\x1a\xc8\xa4\x1a\xa4\xa4\x1a\x7f\xa4\x1a\x5b\xa4\x1a\x36\xa4\x1a\x12\xa4\xe6\xec\x7f\xe6\xc8\x7f\xe6\xa4\x7f\xe6\x7f\x7f\xe6\x5b\x7f\xe6\x36\x7f\xe6\x12\x7f\xb3\xec\x7f\xb3\xc8\x7f\xb3\xa4\x7f\xb3\x7f\x7f\xb3\x5b\x7f\xb3\x36\x7f\xb3\x12\x7f\x80\xec\x7f\x80\xc8\x7f\x80\xa4\x7f\x80\x7f\x7f\x80\x5b\x7f\x80\x36\x7f\x80\x12\x7f\x4d\xec\x7f\x4d\xc8\x7f\x4d\xa4\x7f\x4d\x7f\x7f\x4d\x5b\x7f\x4d\x36\x7f\x4d\x12\x7f\x1a\xec\x7f\x1a\xc8\x7f\x1a\xa4\x7f\x1a\x7f\x7f\x1a\x5b\x7f\x1a\x36\x7f\x1a\x12\x7f\xe6\xec\x5b\xe6\xc8\x5b\xe6\xa4\x5b\xe6\x7f\x5b\xe6\x5b\x5b\xe6\x36\x5b\xe6\x12\x5b\xb3\xec\x5b\xb3\xc8\x5b\xb3\xa4\x5b\xb3\x7f\x5b\xb3\x5b\x5b\xb3\x36\x5b\xb3\x12\x5b\x80\xec\x5b\x80\xc8\x5b\x80\xa4\x5b\x80\x7f\x5b\x80\x5b\x5b\x80\x36\x5b\x80\x12\x5b\x4d\xec\x5b\x4d\xc8\x5b\x4d\xa4\x5b\x4d\x7f\x5b\x4d\x5b\x5b\x4d\x36\x5b\x4d\x12\x5b\x1a\xec\x5b\x1a\xc8\x5b\x1a\xa4\x5b\x1a\x7f\x5b\x1a\x5b\x5b\x1a\x36\x5b\x1a\x12\x5b\xe6\xec\x36\xe6\xc8\x36\xe6\xa4\x36\xe6\x7f\x36\xe6\x5b\x36\xe6\x36\x36\xe6\x12\x36\xb3\xec" \
-"\x36\xb3\xc8\x36\xb3\xa4\x36\xb3\x7f\x36\xb3\x5b\x36\xb3\x36\x36\xb3\x12\x36\x80\xec\x36\x80\xc8\x36\x80\xa4\x36\x80\x7f\x36\x80\x5b\x36\x80\x36\x36\x80\x12\x36\x4d\xec\x36\x4d\xc8\x36\x4d\xa4\x36\x4d\x7f\x36\x4d\x5b\x36\x4d\x36\x36\x4d\x12\x36\x1a\xec\x36\x1a\xc8\x36\x1a\xa4\x36\x1a\x7f\x36\x1a\x5b\x36\x1a\x36\x36\x1a\x12\x36\xe6\xec\x12\xe6\xc8\x12\xe6\xa4\x12\xe6\x7f\x12\xe6\x5b\x12\xe6\x36\x12\xe6\x12\x12\xb3\xec\x12\xb3\xc8\x12\xb3\xa4\x12\xb3\x7f\x12\xb3\x5b\x12\xb3\x36\x12\xb3\x12\x12\x80\xec\x12\x80\xc8\x12\x80\xa4\x12\x80\x7f\x12\x80\x5b\x12\x80\x36\x12\x80\x12\x12\x4d\xec\x12\x4d\xc8\x12\x4d\xa4\x12\x4d\x7f\x12\x4d\x5b\x12\x4d\x36\x12\x4d\x12\x12\x1a\xec\x12\x1a\xc8\x12\x1a\xa4\x12\x1a\x7f\x12\x1a\x5b\x12\x1a\x36\x12\x1a\x12\x12\x03\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02" \
-"\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x04\x07\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x07\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x02\x04\x07\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x02\x07\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a" \
-"\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x02\x04\x07\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x02\x07\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a" \
-"\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x02\x04\x07\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x02\x07\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x02\x04\x07\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x02\x07\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a" \
-"\x0a\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x02\x04\x07\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x02\x07\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\xff\xff\xff\xff\xff\x09\x09\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x09\x09\x09\xff\xff\xff\xff\xff\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x02\x04\x07\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x02\x07\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\xdc\xdc\xdc\xdc\xdc" \
-"\xdc\xdc\xdc\xdc\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\x09\x09\x09\x09\x09\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x09\x09\x09\x09\x09\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x02\x04\x07\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x02\x07\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\x09\x09\x09\x09\xdb\xdb\xdb\xdb\xdb\xdb\x09\x09\x09\x09\x09\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\x09\x09\x09\x09\x09\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x09\x09\x09\x09\xdc\xdc\xdc\xdc" \
-"\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x02\x04\x07\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x02\x07\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\x09\x09\x09\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x09\x09\x09\x09\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\x02\x04\x07\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x02\x07\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe" \
-"\xfe\xfe\xfe\xfe\xf7\xf7\xf7\xf7\xf7\xf7\xf7\xf7\xf7\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\x02\x04\x07\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x02\x07\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xf7\xf7\xf7\xf7\xf7\xf7\xf7\xf7\xf7\xf7\xf7\xf7\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\xdc\x02\x04\x07\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x02\x07\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9" \
-"\xb9\xb8\xb8\xb8\xb8\xb8\xb8\xb8\xb8\xb8\xb7\xb7\xda\xda\xda\xda\xda\xda\xda\xda\xda\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xf6\xf6\xf6\xf6\xf6\xf7\xf7\xf7\xf7\xf7\xf7\xf7\xf7\xf7\xf7\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xb2\xb2\xb2\xb2\xb2\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\x02\x04\x07\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x02\x07\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb8\xb8\xb8\xb8\xb8\xb8\xb8\xb8\xb8\xb7\xb7\xb7\xb7\xda\xda\xda\xda\xda\xda\xda\xda\xda\xda\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xf6\xf6\xf6\xf6\xf6\xf6\xf6\xf6\xf7\xf7\xf7\xf7\xf7\xf7\xf7\xf7\xf7\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xb2" \
-"\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\x02\x04\x07\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x02\x07\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb8\xb8\xb8\xb8\xb8\xb8\xb8\xb8\xb8\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xda\xda\xda\xda\xda\xda\xda\xda\xda\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xf6\xf6\xf6\xf6\xf6\xf6\xf6\xf6\xf6\xf6\xf7\xf7\xf7\xf7\xf7\xf7\xf7\xf7\xf7\xf7\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\x02\x04\x07\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x02\x07\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb8\xb8\xb8\xb8\xb8\xb8\xb8\xb8\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xda\xda\xda\xda\xda\xda\xda\xda\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xf6" \
-"\xf6\xf6\xf6\xf6\xf6\xf6\xf6\xf6\xf6\xf6\xf6\xf6\xf7\xf7\xf7\xf7\xf7\xf7\xf7\xf7\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\x02\x04\x07\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\x02\x07\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb8\xb8\xb8\xb8\xb8\xb8\xb8\xb8\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xda\xda\xda\xda\xda\xda\xda\xda\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xf6\xf6\xf6\xf6\xf6\xf6\xf6\xf6\xf6\xf6\xf6\xf6\xf6\xf6\xf6\xf7\xf7\xf7\xf7\xf7\xf7\xf7\xf7\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\x02\x04\x07\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\x02\x07\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb8" \
-"\xb8\xb8\xb8\xb8\xb8\xb8\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xda\xda\xda\xda\xda\xda\xda\xda\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xf6\xf6\xf6\xf6\xf6\xf6\xf6\xf6\xf6\xf6\xef\xef\xef\xef\xef\xef\xef\xf0\xf0\xf0\xf0\xf0\xf0\xf0\xf0\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xce\xce\xce\xce\xce\xce\xce\xab\xab\xab\xab\xab\xab\xab\xab\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\x02\x04\x07\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\x02\x07\x96\x96\x96\x96\x96\x96\x96\x96\x95\x95\x95\x95\x95\x95\x95\x94\x94\x94\x94\x94\x94\x94\x94\xb6\xb6\xb6\xb6\xb6\xb6\xb6\xb6\xd9\xd9\xd9\xd9\xd9\xd9\xd9\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xf5\xf5\xf5\xf5\xf5\xf5\xf5\xf5\xf5\xf5\xee\xef\xef\xef\xef\xef\xef\xef\xef\xf0\xf0\xf0\xf0\xf0\xf0\xf0\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xce\xce\xce\xce\xce\xce\xce\xab\xab\xab\xab\xab" \
-"\xab\xab\xab\x88\x88\x8f\x8f\x8f\x8f\x8f\x8f\x8f\x8f\x8f\x8f\x96\x96\x96\x96\x96\x96\x96\x96\x96\x96\x96\x02\x04\x07\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x02\x07\x96\x96\x96\x96\x96\x96\x96\x96\x95\x95\x95\x95\x95\x95\x94\x94\x94\x94\x94\x94\x94\x94\x93\x93\xb6\xb6\xb6\xb6\xb6\xb6\xb6\xb6\xd9\xd9\xd9\xd9\xd9\xd9\xd9\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xf5\xf5\xf5\xf5\xf5\xf5\xf5\xf5\xf5\xf5\xee\xee\xee\xef\xef\xef\xef\xef\xef\xef\xef\xf0\xf0\xf0\xf0\xf0\xf0\xf0\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xce\xce\xce\xce\xce\xce\xab\xab\xab\xab\xab\xab\xab\xab\x88\x88\x88\x88\x8f\x8f\x8f\x8f\x8f\x8f\x8f\x8f\x8f\x8f\x96\x96\x96\x96\x96\x96\x96\x96\x96\x96\x02\x04\x07\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x02\x07\x96\x96\x96\x96\x96\x96\x96\x95\x95\x95\x95\x95\x95\x95\x94\x94\x94\x94\x94\x94\x94\x93\x93\x93\x93\x93\xb6\xb6\xb6\xb6\xb6\xb6\xb6\xd9\xd9\xd9\xd9\xd9\xd9\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xf5\xf5\xf5" \
-"\xf5\xf5\xf5\xf5\xf5\xf5\xee\xee\xee\xee\xee\xef\xef\xef\xef\xef\xef\xef\xef\xf0\xf0\xf0\xf0\xf0\xf0\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xce\xce\xce\xce\xce\xce\xce\xab\xab\xab\xab\xab\xab\xab\x88\x88\x88\x88\x88\x88\x8f\x8f\x8f\x8f\x8f\x8f\x8f\x8f\x8f\x96\x96\x96\x96\x96\x96\x96\x96\x96\x96\x02\x04\x07\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x02\x07\x96\x96\x96\x96\x96\x96\x96\x95\x95\x95\x95\x95\x95\x94\x94\x94\x94\x94\x94\x94\x93\x93\x93\x93\x93\x93\xb6\xb6\xb6\xb6\xb6\xb6\xb6\xd9\xd9\xd9\xd9\xd9\xd9\xd9\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xf5\xf5\xf5\xf5\xf5\xf5\xf5\xf5\xf5\xee\xee\xee\xee\xee\xee\xee\xef\xef\xef\xef\xef\xef\xef\xef\xf0\xf0\xf0\xf0\xf0\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xce\xce\xce\xce\xce\xce\xab\xab\xab\xab\xab\xab\xab\x88\x88\x88\x88\x88\x88\x88\x88\x8f\x8f\x8f\x8f\x8f\x8f\x8f\x8f\x8f\x96\x96\x96\x96\x96\x96\x96\x96\x96\x02\x04\x07\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x02\x07\x96\x96\x96\x96\x96\x96\x95\x95" \
-"\x95\x95\x95\x95\x94\x94\x94\x94\x94\x94\x94\x93\x93\x93\x93\x93\x93\x93\x93\xb6\xb6\xb6\xb6\xb6\xb6\xb6\xd9\xd9\xd9\xd9\xd9\xd9\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xf5\xf5\xf5\xf5\xf5\xf5\xf5\xf5\xf5\xee\xee\xee\xee\xee\xee\xee\xee\xee\xef\xef\xef\xef\xef\xef\xef\xf0\xf0\xf0\xf0\xf0\xf0\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xce\xce\xce\xce\xce\xce\xab\xab\xab\xab\xab\xab\xab\x88\x88\x88\x88\x88\x88\x88\x88\x88\x88\x8f\x8f\x8f\x8f\x8f\x8f\x8f\x8f\x96\x96\x96\x96\x96\x96\x96\x96\x96\x02\x04\x07\x08\x08\x08\x08\x08\x08\x08\x08\x08\x07\x07\x02\x07\x73\x73\x73\x73\x73\x73\x72\x72\x72\x72\x72\x71\x71\x71\x71\x71\x71\x71\x70\x70\x70\x70\x70\x92\x92\x92\x92\x92\xb5\xb5\xb5\xb5\xb5\xb5\xb5\xd8\xd8\xd8\xd8\xd8\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xf4\xf4\xf4\xf4\xf4\xf4\xf4\xf4\xed\xed\xed\xed\xed\xed\xed\xee\xee\xee\xee\xef\xef\xef\xef\xef\xef\xef\xf0\xf0\xf0\xf0\xf0\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xce\xce\xce\xce\xce\xce\xab\xab\xab\xab\xab\xab" \
-"\x88\x88\x88\x88\x88\x65\x65\x65\x65\x65\x65\x65\x6c\x6c\x6c\x6c\x6c\x6c\x6c\x6c\x73\x73\x73\x73\x73\x73\x73\x73\x02\x04\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x07\x73\x73\x73\x73\x73\x73\x72\x72\x72\x72\x72\x71\x71\x71\x71\x71\x71\x71\x70\x70\x70\x70\x6f\x6f\x92\x92\x92\x92\x92\xb5\xb5\xb5\xb5\xb5\xb5\xb5\xd8\xd8\xd8\xd8\xd8\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xf4\xf4\xf4\xf4\xf4\xf4\xf4\xf4\xed\xed\xed\xed\xed\xed\xed\xee\xee\xee\xee\xee\xef\xef\xef\xef\xef\xef\xf0\xf0\xf0\xf0\xf0\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xce\xce\xce\xce\xce\xab\xab\xab\xab\xab\xab\xab\x88\x88\x88\x88\x65\x65\x65\x65\x65\x65\x65\x65\x6c\x6c\x6c\x6c\x6c\x6c\x6c\x6c\x73\x73\x73\x73\x73\x73\x73\x73\x02\x04\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x07\x73\x73\x73\x73\x73\x73\x72\x72\x72\x72\x72\x71\x71\x71\x71\x71\x71\x70\x70\x70\x70\x6f\x6f\x6f\x6f\x92\x92\x92\x92\x92\xb5\xb5\xb5\xb5\xb5\xb5\xd8\xd8\xd8\xd8\xd8\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xf4\xf4\xf4\xf4" \
-"\xf4\xf4\xf4\xf4\xed\xed\xed\xed\xed\xed\xed\xed\xed\xee\xee\xee\xee\xef\xef\xef\xef\xef\xef\xef\xf0\xf0\xf0\xf0\xf0\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xf1\xce\xce\xce\xce\xab\xab\xab\xab\xab\xab\xab\x88\x88\x88\x88\x65\x65\x65\x65\x65\x65\x65\x65\x65\x65\x6c\x6c\x6c\x6c\x6c\x6c\x6c\x6c\x73\x73\x73\x73\x73\x73\x73\x02\x04\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x07\x73\x73\x73\x73\x73\x72\x72\x72\x72\x72\x71\x71\x71\x71\x71\x71\x70\x70\x70\x70\x70\x6f\x6f\x6f\x6f\x6f\x92\x92\x92\x92\xb5\xb5\xb5\xb5\xb5\xb5\xd8\xd8\xd8\xd8\xd8\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xf4\xf4\xf4\xf4\xf4\xf4\xf4\xed\xed\xed\xed\xed\xed\xed\xed\xe6\xe6\xe6\xe7\xe7\xe7\xe7\xe8\xe8\xe8\xe8\xe8\xe8\xe9\xe9\xe9\xe9\xe9\xea\xea\xea\xea\xea\xea\xea\xea\xea\xea\xc7\xc7\xc7\xc7\xc7\xa4\xa4\xa4\xa4\xa4\xa4\x81\x81\x81\x81\x5e\x5e\x5e\x5e\x65\x65\x65\x65\x65\x65\x65\x65\x6c\x6c\x6c\x6c\x6c\x6c\x6c\x73\x73\x73\x73\x73\x73\x73\x02\x04\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x07\x73\x73\x73\x73\x73\x72" \
-"\x72\x72\x72\x71\x71\x71\x71\x71\x71\x70\x70\x70\x70\x70\x6f\x6f\x6f\x6f\x6f\x6f\x6f\x92\x92\x92\x92\xb5\xb5\xb5\xb5\xb5\xb5\xd8\xd8\xd8\xd8\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xf4\xf4\xf4\xf4\xf4\xf4\xf4\xf4\xed\xed\xed\xed\xed\xed\xed\xe6\xe6\xe6\xe6\xe7\xe7\xe7\xe7\xe7\xe8\xe8\xe8\xe8\xe8\xe8\xe9\xe9\xe9\xe9\xea\xea\xea\xea\xea\xea\xea\xea\xea\xea\xc7\xc7\xc7\xc7\xc7\xa4\xa4\xa4\xa4\xa4\x81\x81\x81\x81\x81\x5e\x5e\x5e\x5e\x5e\x65\x65\x65\x65\x65\x65\x65\x6c\x6c\x6c\x6c\x6c\x6c\x6c\x73\x73\x73\x73\x73\x73\x73\x02\x04\x07\xb0\xb0\xb0\xb0\xb0\xb0\xb0\xb0\xb0\xb0\xb0\x02\x07\x73\x73\x73\x73\x73\x72\x72\x72\x72\x71\x71\x71\x71\x71\x71\x70\x70\x70\x70\x6f\x6f\x6f\x6f\x6f\x6f\x6f\x6f\x92\x92\x92\x92\xb5\xb5\xb5\xb5\xb5\xb5\xd8\xd8\xd8\xd8\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xfb\xf4\xf4\xf4\xf4\xf4\xf4\xf4\xed\xed\xed\xed\xed\xed\xed\xe6\xe6\xe6\xe6\xe6\xe6\xe7\xe7\xe7\xe7\xe8\xe8\xe8\xe8\xe8\xe8\xe9\xe9\xe9\xe9\xea\xea\xea\xea\xea\xea\xea\xea\xea\xea\xc7\xc7\xc7\xc7\xa4\xa4\xa4\xa4\xa4\xa4\x81" \
-"\x81\x81\x81\x5e\x5e\x5e\x5e\x5e\x5e\x65\x65\x65\x65\x65\x65\x65\x65\x6c\x6c\x6c\x6c\x6c\x6c\x6c\x73\x73\x73\x73\x73\x73\x02\x04\x07\xb0\xb0\xb0\xb0\xb0\xb0\xb0\xb0\xb0\xb0\xb0\x02\x07\x50\x50\x50\x50\x50\x4f\x4f\x4f\x4f\x4e\x4e\x4e\x4e\x4e\x4d\x4d\x4d\x4d\x4d\x4c\x4c\x4c\x4c\x6e\x6e\x6e\x6e\x6e\x91\x91\x91\x91\xb4\xb4\xb4\xb4\xb4\xb4\xd7\xd7\xd7\xd7\xfa\xfa\xfa\xfa\xfa\xfa\xfa\xfa\xfa\xfa\xfa\xf3\xf3\xf3\xf3\xf3\xf3\xf3\xec\xec\xec\xec\xec\xec\xec\xe5\xe5\xe5\xe6\xe6\xe6\xe6\xe7\xe7\xe7\xe7\xe8\xe8\xe8\xe8\xe8\xe9\xe9\xe9\xe9\xe9\xea\xea\xea\xea\xea\xea\xea\xea\xea\xc7\xc7\xc7\xc7\xa4\xa4\xa4\xa4\xa4\xa4\x81\x81\x81\x81\x5e\x5e\x5e\x5e\x3b\x3b\x3b\x42\x42\x42\x42\x42\x42\x42\x49\x49\x49\x49\x49\x49\x49\x50\x50\x50\x50\x50\x50\x02\x04\x07\xb0\xb0\xb0\xb0\xb0\xb0\xb0\xb0\xb0\xb0\xb0\x02\x07\x50\x50\x50\x50\x4f\x4f\x4f\x4f\x4f\x4e\x4e\x4e\x4e\x4e\x4d\x4d\x4d\x4d\x4c\x4c\x4c\x4c\x4b\x4b\x6e\x6e\x6e\x6e\x6e\x91\x91\x91\x91\xb4\xb4\xb4\xb4\xb4\xd7\xd7\xd7\xd7\xfa\xfa\xfa\xfa\xfa\xfa\xfa\xfa\xfa\xfa\xfa\xf3\xf3\xf3" \
-"\xf3\xf3\xf3\xec\xec\xec\xec\xec\xec\xec\xe5\xe5\xe5\xe5\xe6\xe6\xe6\xe6\xe6\xe7\xe7\xe7\xe8\xe8\xe8\xe8\xe8\xe8\xe9\xe9\xe9\xe9\xea\xea\xea\xea\xea\xea\xea\xea\xea\xc7\xc7\xc7\xc7\xa4\xa4\xa4\xa4\xa4\x81\x81\x81\x81\x5e\x5e\x5e\x5e\x3b\x3b\x3b\x3b\x3b\x42\x42\x42\x42\x42\x42\x42\x49\x49\x49\x49\x49\x49\x50\x50\x50\x50\x50\x50\x02\x04\x07\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x02\x07\x50\x50\x50\x50\x4f\x4f\x4f\x4f\x4e\x4e\x4e\x4e\x4e\x4d\x4d\x4d\x4d\x4c\x4c\x4c\x4c\x4c\x4b\x4b\x4b\x6e\x6e\x6e\x6e\x91\x91\x91\x91\xb4\xb4\xb4\xb4\xb4\xd7\xd7\xd7\xd7\xfa\xfa\xfa\xfa\xfa\xfa\xfa\xfa\xfa\xfa\xfa\xf3\xf3\xf3\xf3\xf3\xec\xec\xec\xec\xec\xec\xec\xec\xe5\xe5\xe5\xe5\xe5\xe6\xe6\xe6\xe6\xe7\xe7\xe7\xe7\xe8\xe8\xe8\xe8\xe8\xe9\xe9\xe9\xe9\xea\xea\xea\xea\xea\xea\xea\xea\xea\xc7\xc7\xc7\xa4\xa4\xa4\xa4\xa4\x81\x81\x81\x81\x5e\x5e\x5e\x5e\x5e\x3b\x3b\x3b\x3b\x3b\x42\x42\x42\x42\x42\x42\x42\x42\x49\x49\x49\x49\x49\x50\x50\x50\x50\x50\x50\x02\x04\x07\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x02\x07\x50\x50\x50\x50" \
-"\x4f\x4f\x4f\x4f\x4e\x4e\x4e\x4e\x4e\x4d\x4d\x4d\x4d\x4c\x4c\x4c\x4c\x4b\x4b\x4b\x4b\x4b\x6e\x6e\x6e\x6e\x91\x91\x91\xb4\xb4\xb4\xb4\xb4\xb4\xd7\xd7\xd7\xfa\xfa\xfa\xfa\xfa\xfa\xfa\xfa\xfa\xfa\xf3\xf3\xf3\xf3\xf3\xf3\xec\xec\xec\xec\xec\xec\xec\xe5\xe5\xe5\xe5\xe5\xe5\xe6\xe6\xe6\xe6\xe7\xe7\xe7\xe7\xe8\xe8\xe8\xe8\xe8\xe9\xe9\xe9\xe9\xea\xea\xea\xea\xea\xea\xea\xea\xc7\xc7\xc7\xc7\xa4\xa4\xa4\xa4\xa4\x81\x81\x81\x81\x5e\x5e\x5e\x5e\x3b\x3b\x3b\x3b\x3b\x3b\x3b\x42\x42\x42\x42\x42\x42\x42\x49\x49\x49\x49\x49\x50\x50\x50\x50\x50\x50\x02\x04\x07\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x02\x07\x50\x50\x50\x50\x4f\x4f\x4f\x4f\x4e\x4e\x4e\x4e\x4d\x4d\x4d\x4d\x4c\x4c\x4c\x4c\x4c\x4b\x4b\x4b\x4b\x4b\x6e\x6e\x6e\x6e\x91\x91\x91\x91\xb4\xb4\xb4\xb4\xb4\xd7\xd7\xd7\xfa\xfa\xfa\xfa\xfa\xfa\xfa\xfa\xfa\xfa\xf3\xf3\xf3\xf3\xf3\xf3\xec\xec\xec\xec\xec\xec\xe5\xe5\xe5\xe5\xe5\xde\xde\xde\xdf\xdf\xdf\xdf\xe0\xe0\xe0\xe0\xe1\xe1\xe1\xe1\xe1\xe2\xe2\xe2\xe3\xe3\xe3\xe3\xe3\xe3\xe3\xe3\xc0\xc0\xc0\xc0\x9d\x9d\x9d\x9d\x9d\x7a" \
-"\x7a\x7a\x57\x57\x57\x57\x34\x34\x34\x34\x3b\x3b\x3b\x3b\x42\x42\x42\x42\x42\x42\x42\x49\x49\x49\x49\x49\x49\x50\x50\x50\x50\x50\x02\x04\x07\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x02\x07\x50\x50\x50\x50\x4f\x4f\x4f\x4e\x4e\x4e\x4e\x4e\x4d\x4d\x4d\x4d\x4c\x4c\x4c\x4c\x4b\x4b\x4b\x4b\x4b\x4b\x6e\x6e\x6e\x6e\x6e\x91\x91\x91\xb4\xb4\xb4\xb4\xb4\xd7\xd7\xd7\xfa\xfa\xfa\xfa\xfa\xfa\xfa\xfa\xfa\xfa\xf3\xf3\xf3\xf3\xf3\xf3\xec\xec\xec\xec\xec\xec\xe5\xe5\xe5\xe5\xe5\xde\xde\xde\xdf\xdf\xdf\xdf\xdf\xe0\xe0\xe0\xe1\xe1\xe1\xe1\xe1\xe2\xe2\xe2\xe3\xe3\xe3\xe3\xe3\xe3\xe3\xe3\xc0\xc0\xc0\xc0\x9d\x9d\x9d\x9d\x7a\x7a\x7a\x7a\x57\x57\x57\x57\x34\x34\x34\x34\x3b\x3b\x3b\x3b\x3b\x42\x42\x42\x42\x42\x42\x49\x49\x49\x49\x49\x49\x50\x50\x50\x50\x50\x02\x04\x07\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x02\x07\x2d\x2d\x2d\x2d\x2c\x2c\x2c\x2b\x2b\x2b\x2b\x2a\x2a\x2a\x2a\x29\x29\x29\x29\x28\x28\x28\x28\x4a\x4a\x4a\x4a\x6d\x6d\x6d\x6d\x90\x90\x90\x90\xb3\xb3\xb3\xb3\xd6\xd6\xd6\xd6\xf9\xf9\xf9\xf9\xf9\xf9\xf9\xf9\xf9\xf2\xf2" \
-"\xf2\xf2\xf2\xeb\xeb\xeb\xeb\xeb\xeb\xe4\xe4\xe4\xe4\xe4\xdd\xde\xde\xde\xde\xdf\xdf\xdf\xdf\xe0\xe0\xe0\xe1\xe1\xe1\xe1\xe1\xe2\xe2\xe2\xe3\xe3\xe3\xe3\xe3\xe3\xe3\xe3\xc0\xc0\xc0\x9d\x9d\x9d\x9d\x9d\x7a\x7a\x7a\x57\x57\x57\x57\x57\x34\x34\x34\x11\x11\x18\x18\x18\x18\x18\x1f\x1f\x1f\x1f\x1f\x1f\x26\x26\x26\x26\x26\x2d\x2d\x2d\x2d\x2d\x02\x04\x07\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x02\x07\x2d\x2d\x2d\x2d\x2c\x2c\x2c\x2b\x2b\x2b\x2b\x2a\x2a\x2a\x2a\x29\x29\x29\x29\x28\x28\x28\x28\x27\x4a\x4a\x4a\x4a\x6d\x6d\x6d\x6d\x90\x90\x90\xb3\xb3\xb3\xb3\xd6\xd6\xd6\xd6\xf9\xf9\xf9\xf9\xf9\xf9\xf9\xf9\xf9\xf2\xf2\xf2\xf2\xf2\xeb\xeb\xeb\xeb\xeb\xeb\xe4\xe4\xe4\xe4\xdd\xdd\xdd\xde\xde\xde\xdf\xdf\xdf\xdf\xe0\xe0\xe0\xe0\xe1\xe1\xe1\xe1\xe2\xe2\xe2\xe3\xe3\xe3\xe3\xe3\xe3\xe3\xe3\xc0\xc0\xc0\x9d\x9d\x9d\x9d\x7a\x7a\x7a\x7a\x57\x57\x57\x57\x34\x34\x34\x34\x11\x11\x18\x18\x18\x18\x18\x1f\x1f\x1f\x1f\x1f\x1f\x26\x26\x26\x26\x26\x2d\x2d\x2d\x2d\x2d\x02\x04\x07\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x02\x07\x2d\x2d" \
-"\x2d\x2d\x2c\x2c\x2c\x2b\x2b\x2b\x2b\x2a\x2a\x2a\x29\x29\x29\x29\x28\x28\x28\x28\x27\x27\x4a\x4a\x4a\x4a\x6d\x6d\x6d\x6d\x90\x90\x90\x90\xb3\xb3\xb3\xb3\xd6\xd6\xd6\xf9\xf9\xf9\xf9\xf9\xf9\xf9\xf9\xf2\xf2\xf2\xf2\xf2\xeb\xeb\xeb\xeb\xeb\xeb\xe4\xe4\xe4\xe4\xe4\xdd\xdd\xdd\xde\xde\xde\xde\xdf\xdf\xdf\xdf\xe0\xe0\xe0\xe1\xe1\xe1\xe1\xe2\xe2\xe2\xe3\xe3\xe3\xe3\xe3\xe3\xe3\xe3\xc0\xc0\xc0\x9d\x9d\x9d\x9d\x7a\x7a\x7a\x7a\x57\x57\x57\x34\x34\x34\x34\x11\x11\x11\x11\x18\x18\x18\x18\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x26\x26\x26\x26\x2d\x2d\x2d\x2d\x2d\x02\x04\x07\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x02\x07\x2d\x2d\x2d\x2d\x2c\x2c\x2c\x2b\x2b\x2b\x2b\x2a\x2a\x2a\x29\x29\x29\x29\x28\x28\x28\x28\x27\x27\x27\x4a\x4a\x4a\x6d\x6d\x6d\x6d\x6d\x90\x90\x90\xb3\xb3\xb3\xb3\xd6\xd6\xd6\xf9\xf9\xf9\xf9\xf9\xf9\xf9\xf9\xf2\xf2\xf2\xf2\xf2\xeb\xeb\xeb\xeb\xeb\xeb\xe4\xe4\xe4\xe4\xdd\xdd\xdd\xdd\xdd\xde\xde\xde\xdf\xdf\xdf\xdf\xe0\xe0\xe0\xe0\xe1\xe1\xe1\xe2\xe2\xe2\xe2\xe3\xe3\xe3\xe3\xe3\xe3\xe3\xc0\xc0\xc0\x9d\x9d\x9d\x9d\x7a" \
-"\x7a\x7a\x57\x57\x57\x57\x34\x34\x34\x34\x11\x11\x11\x11\x11\x18\x18\x18\x18\x1f\x1f\x1f\x1f\x1f\x1f\x26\x26\x26\x26\x26\x2d\x2d\x2d\x2d\x02\x04\x07\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x02\x07\x2d\x2d\x2d\x2d\x2c\x2c\x2b\x2b\x2b\x2b\x2b\x2a\x2a\x2a\x29\x29\x29\x28\x28\x28\x28\x27\x27\x27\x27\x27\x4a\x4a\x4a\x6d\x6d\x6d\x6d\x90\x90\x90\xb3\xb3\xb3\xb3\xd6\xd6\xd6\xf9\xf9\xf9\xf9\xf9\xf9\xf9\xf9\xf2\xf2\xf2\xf2\xf2\xeb\xeb\xeb\xeb\xeb\xe4\xe4\xe4\xe4\xe4\xdd\xdd\xdd\xdd\xdd\xde\xde\xde\xde\xdf\xdf\xdf\xdf\xe0\xe0\xe0\xe1\xe1\xe1\xe1\xe2\xe2\xe2\xe3\xe3\xe3\xe3\xe3\xe3\xe3\xc0\xc0\x9d\x9d\x9d\x9d\x7a\x7a\x7a\x7a\x57\x57\x57\x57\x34\x34\x34\x11\x11\x11\x11\x11\x11\x18\x18\x18\x18\x18\x1f\x1f\x1f\x1f\x1f\x26\x26\x26\x26\x26\x2d\x2d\x2d\x2d\x02\x04\x07\x05\x05\x05\x05\x85\x85\x85\x85\x85\x85\x85\x02\x07\x2d\x2d\x2d\x2c\x2c\x2c\x2b\x2b\x2b\x2b\x2a\x2a\x2a\x29\x29\x29\x29\x28\x28\x28\x28\x27\x27\x27\x27\x27\x4a\x4a\x4a\x6d\x6d\x6d\x6d\x90\x90\x90\xb3\xb3\xb3\xb3\xd6\xd6\xd6\xf9\xf9\xf9\xf9\xf9\xf9\xf9\xf9\xf2" \
-"\xf2\xf2\xf2\xeb\xeb\xeb\xeb\xeb\xeb\xe4\xe4\xe4\xe4\xe4\xdd\xdd\xdd\xdd\xdd\xdd\xde\xde\xde\xdf\xdf\xdf\xdf\xe0\xe0\xe0\xe1\xe1\xe1\xe1\xe2\xe2\xe2\xe3\xe3\xe3\xe3\xe3\xe3\xc0\xc0\xc0\x9d\x9d\x9d\x9d\x7a\x7a\x7a\x57\x57\x57\x57\x34\x34\x34\x34\x11\x11\x11\x11\x11\x11\x18\x18\x18\x18\x18\x1f\x1f\x1f\x1f\x1f\x26\x26\x26\x26\x26\x2d\x2d\x2d\x2d\x02\x04\x07\x85\x85\x85\x85\x85\x85\x85\x85\x85\x85\x85\x02\x07\x2d\x2d\x2d\x2c\x2c\x2c\x2b\x2b\x2b\x2a\x2a\x2a\x2a\x29\x29\x29\x29\x28\x28\x28\x28\x27\x27\x27\x27\x27\x4a\x4a\x4a\x6d\x6d\x6d\x6d\x90\x90\x90\x90\xb3\xb3\xb3\xb3\xd6\xd6\xd6\xf9\xf9\xf9\xf9\xf9\xf9\xf2\xf2\xf2\xf2\xf2\xeb\xeb\xeb\xeb\xeb\xeb\xe4\xe4\xe4\xe4\xe4\xdd\xdd\xdd\xdd\xdd\xdd\xde\xde\xde\xdf\xdf\xdf\xdf\xe0\xe0\xe0\xe0\xe1\xe1\xe1\xe1\xe2\xe2\xe3\xe3\xe3\xe3\xe3\xe3\xc0\xc0\xc0\x9d\x9d\x9d\x9d\x7a\x7a\x7a\x57\x57\x57\x57\x34\x34\x34\x34\x11\x11\x11\x11\x11\x11\x18\x18\x18\x18\x18\x1f\x1f\x1f\x1f\x1f\x1f\x26\x26\x26\x26\x2d\x2d\x2d\x2d\x02\x04\x07\x85\x85\x85\x85\x85\x85\x85\x85\x85\x85\x85\x02\x07" \
-"\x2d\x2d\x2c\x2c\x2c\x2b\x2b\x2b\x2b\x2a\x2a\x2a\x2a\x29\x29\x29\x29\x28\x28\x28\x28\x27\x27\x27\x27\x27\x4a\x4a\x4a\x4a\x6d\x6d\x6d\x6d\x90\x90\x90\xb3\xb3\xb3\xb3\xd6\xd6\xd6\xf9\xf9\xf9\xf9\xf9\xf9\xf2\xf2\xf2\xf2\xf2\xeb\xeb\xeb\xeb\xeb\xeb\xe4\xe4\xe4\xe4\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xde\xde\xde\xdf\xdf\xdf\xdf\xdf\xe0\xe0\xe0\xe1\xe1\xe1\xe1\xe2\xe2\xe2\xe3\xe3\xe3\xe3\xc0\xc0\xc0\x9d\x9d\x9d\x9d\x7a\x7a\x7a\x7a\x57\x57\x57\x57\x34\x34\x34\x34\x11\x11\x11\x11\x11\x11\x18\x18\x18\x18\x18\x1f\x1f\x1f\x1f\x1f\x1f\x26\x26\x26\x26\x26\x2d\x2d\x2d\x02\x04\x07\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x02\x07\x2d\x2d\x2c\x2c\x2c\x2b\x2b\x2b\x2b\x2a\x2a\x2a\x29\x29\x29\x29\x29\x28\x28\x28\x28\x27\x27\x27\x27\x27\x4a\x4a\x4a\x4a\x6d\x6d\x6d\x6d\x90\x90\x90\x90\xb3\xb3\xb3\xb3\xd6\xd6\xd6\xf9\xf9\xf9\xf9\xf2\xf2\xf2\xf2\xf2\xeb\xeb\xeb\xeb\xeb\xeb\xe4\xe4\xe4\xe4\xe4\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xde\xde\xde\xde\xdf\xdf\xdf\xdf\xe0\xe0\xe0\xe1\xe1\xe1\xe1\xe1\xe2\xe2\xe3\xe3\xe3\xe3\xc0\xc0\xc0\x9d\x9d\x9d\x9d\x7a" \
-"\x7a\x7a\x7a\x57\x57\x57\x57\x34\x34\x34\x11\x11\x11\x11\x11\x11\x11\x11\x18\x18\x18\x18\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x26\x26\x26\x26\x2d\x2d\x2d\x02\x04\x07\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x02\x07\x2d\x2c\x2c\x2c\x2b\x2b\x2b\x2b\x2b\x2a\x2a\x2a\x29\x29\x29\x29\x28\x28\x28\x28\x27\x27\x27\x27\x27\x27\x4a\x4a\x4a\x4a\x6d\x6d\x6d\x6d\x6d\x90\x90\x90\xb3\xb3\xb3\xb3\xd6\xd6\xd6\xf9\xf9\xf9\xf9\xf2\xf2\xf2\xf2\xf2\xeb\xeb\xeb\xeb\xeb\xeb\xe4\xe4\xe4\xe4\xe4\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xde\xde\xde\xde\xdf\xdf\xdf\xdf\xe0\xe0\xe0\xe0\xe1\xe1\xe1\xe1\xe2\xe2\xe2\xe3\xe3\xc0\xc0\xc0\x9d\x9d\x9d\x9d\x7a\x7a\x7a\x7a\x57\x57\x57\x57\x34\x34\x34\x34\x11\x11\x11\x11\x11\x11\x11\x11\x18\x18\x18\x18\x18\x1f\x1f\x1f\x1f\x1f\x1f\x26\x26\x26\x26\x26\x2d\x2d\x02\x04\x07\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x02\x07\x2d\x2c\x2c\x2c\x2b\x2b\x2b\x2b\x2a\x2a\x2a\x29\x29\x29\x29\x29\x28\x28\x28\x28\x27\x27\x27\x27\x27\x27\x4a\x4a\x4a\x4a\x4a\x6d\x6d\x6d\x6d\x90\x90\x90\x90\xb3\xb3\xb3\xb3\xd6\xd6\xd6\xf9\xf9\xf2\xf2" \
-"\xf2\xf2\xf2\xeb\xeb\xeb\xeb\xeb\xeb\xeb\xe4\xe4\xe4\xe4\xe4\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xde\xde\xde\xde\xdf\xdf\xdf\xdf\xdf\xe0\xe0\xe0\xe1\xe1\xe1\xe1\xe1\xe2\xe2\xe2\xc0\xc0\xc0\xc0\x9d\x9d\x9d\x9d\x7a\x7a\x7a\x7a\x57\x57\x57\x57\x34\x34\x34\x34\x11\x11\x11\x11\x11\x11\x11\x11\x18\x18\x18\x18\x18\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x26\x26\x26\x26\x26\x2d\x02\x04\x07\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x02\x07\x2c\x2c\x2c\x2b\x2b\x2b\x2b\x2a\x2a\x2a\x2a\x29\x29\x29\x29\x29\x28\x28\x28\x28\x27\x27\x27\x27\x27\x27\x4a\x4a\x4a\x4a\x4a\x6d\x6d\x6d\x6d\x6d\x90\x90\x90\xb3\xb3\xb3\xb3\xd6\xd6\xd6\xd6\xd6\xcf\xcf\xcf\xcf\xcf\xc8\xc8\xc8\xc8\xc8\xc8\xc1\xc1\xc1\xc1\xc1\xc1\xba\xba\xba\xba\xba\xba\xba\xbb\xbb\xbb\xbb\xbc\xbc\xbc\xbc\xbc\xbd\xbd\xbd\xbd\xbe\xbe\xbe\xbe\xbf\xbf\xbf\xbf\xbf\xbf\x9c\x9c\x9c\x9c\x79\x79\x79\x79\x56\x56\x56\x56\x56\x33\x33\x33\x33\x10\x10\x10\x10\x10\x10\x10\x10\x17\x17\x17\x17\x17\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x25\x25\x25\x25\x25\x2c\x02\x04\x07\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04" \
-"\x02\x07\x2c\x2c\x2b\x2b\x2b\x2b\x2b\x2a\x2a\x2a\x2a\x29\x29\x29\x29\x29\x28\x28\x28\x28\x27\x27\x27\x27\x27\x27\x4a\x4a\x4a\x4a\x4a\x6d\x6d\x6d\x6d\x6d\x90\x90\x90\x90\xb3\xb3\xb3\xb3\xd6\xd6\xd6\xcf\xcf\xcf\xcf\xcf\xc8\xc8\xc8\xc8\xc8\xc8\xc8\xc1\xc1\xc1\xc1\xc1\xc1\xba\xba\xba\xba\xba\xba\xba\xbb\xbb\xbb\xbb\xbb\xbc\xbc\xbc\xbc\xbc\xbd\xbd\xbd\xbe\xbe\xbe\xbe\xbe\xbf\xbf\xbf\xbf\xbf\x9c\x9c\x9c\x9c\x79\x79\x79\x79\x56\x56\x56\x56\x56\x33\x33\x33\x33\x10\x10\x10\x10\x10\x10\x10\x10\x17\x17\x17\x17\x17\x17\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x25\x25\x25\x25\x25\x02\x04\x07\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x02\x07\x25\x25\x24\x24\x24\x24\x23\x23\x23\x23\x22\x22\x22\x22\x22\x21\x21\x21\x21\x21\x20\x20\x20\x20\x20\x20\x43\x43\x43\x43\x43\x66\x66\x66\x66\x66\x89\x89\x89\x89\xac\xac\xac\xac\xac\xcf\xcf\xcf\xcf\xcf\xcf\xcf\xc8\xc8\xc8\xc8\xc8\xc8\xc1\xc1\xc1\xc1\xc1\xc1\xc1\xba\xba\xba\xba\xba\xba\xba\xbb\xbb\xbb\xbb\xbb\xbc\xbc\xbc\xbc\xbc\xbd\xbd\xbd\xbd\xbe\xbe\xbe\xbe\xbf\xbf\xbf\xbf\x9c\x9c\x9c\x9c\x79\x79" \
-"\x79\x79\x56\x56\x56\x56\x56\x33\x33\x33\x33\x33\x10\x10\x10\x10\x10\x10\x10\x10\x17\x17\x17\x17\x17\x17\x17\x1e\x1e\x1e\x1e\x1e\x1e\x25\x25\x25\x25\x25\x02\x04\x07\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x02\x07\x25\x24\x24\x24\x24\x24\x23\x23\x23\x23\x22\x22\x22\x22\x22\x21\x21\x21\x21\x21\x20\x20\x20\x20\x20\x20\x20\x43\x43\x43\x43\x66\x66\x66\x66\x66\x66\x89\x89\x89\x89\xac\xac\xac\xac\xcf\xcf\xcf\xcf\xcf\xcf\xc8\xc8\xc8\xc8\xc8\xc8\xc8\xc1\xc1\xc1\xc1\xc1\xc1\xba\xba\xba\xba\xba\xba\xba\xba\xbb\xbb\xbb\xbb\xbb\xbc\xbc\xbc\xbc\xbc\xbc\xbd\xbd\xbd\xbd\xbe\xbe\xbe\xbe\xbf\xbf\x9c\x9c\x9c\x9c\x9c\x79\x79\x79\x79\x56\x56\x56\x56\x56\x33\x33\x33\x33\x33\x10\x10\x10\x10\x10\x10\x10\x10\x10\x17\x17\x17\x17\x17\x17\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x25\x25\x25\x25\x02\x04\x07\x5a\x5a\x5a\x5a\x5a\x5a\x5a\x5a\x5a\x5a\x5a\x02\x07\x25\x24\x24\x24\x24\x23\x23\x23\x23\x22\x22\x22\x22\x22\x22\x21\x21\x21\x21\x21\x20\x20\x20\x20\x20\x20\x20\x43\x43\x43\x43\x43\x66\x66\x66\x66\x66\x89\x89\x89\x89\xac\xac\xac\xac\xac\xcf\xcf" \
-"\xcf\xcf\xc8\xc8\xc8\xc8\xc8\xc8\xc8\xc8\xc1\xc1\xc1\xc1\xc1\xc1\xba\xba\xba\xba\xba\xba\xba\xba\xbb\xbb\xbb\xbb\xbb\xbc\xbc\xbc\xbc\xbc\xbc\xbd\xbd\xbd\xbd\xbe\xbe\xbe\xbe\xbe\x9c\x9c\x9c\x9c\x9c\x79\x79\x79\x79\x56\x56\x56\x56\x56\x56\x33\x33\x33\x33\x33\x10\x10\x10\x10\x10\x10\x10\x10\x10\x17\x17\x17\x17\x17\x17\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x25\x25\x25\x25\x02\x04\x07\x5a\x5a\x5a\x5a\x5a\x5a\x5a\x5a\x5a\x5a\x5a\x02\x07\x24\x24\x24\x24\x23\x23\x23\x23\x23\x22\x22\x22\x22\x22\x21\x21\x21\x21\x21\x21\x20\x20\x20\x20\x20\x20\x20\x43\x43\x43\x43\x43\x66\x66\x66\x66\x66\x66\x89\x89\x89\x89\xac\xac\xac\xac\xac\xac\xac\xac\xa5\xa5\xa5\xa5\xa5\xa5\xa5\x9e\x9e\x9e\x9e\x9e\x9e\x9e\x97\x97\x97\x97\x97\x97\x97\x97\x97\x98\x98\x98\x98\x98\x99\x99\x99\x99\x99\x9a\x9a\x9a\x9a\x9a\x9b\x9b\x9b\x9b\x9b\x9b\x9b\x9b\x9b\x78\x78\x78\x78\x55\x55\x55\x55\x55\x55\x32\x32\x32\x32\x32\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x16\x16\x16\x16\x16\x16\x1d\x1d\x1d\x1d\x1d\x1d\x1d\x1d\x24\x24\x24\x02\x04\x07\x5a\x5a\x5a\x5a\x5a\x5a\x5a\x5a\x5a" \
-"\x5a\x5a\x02\x07\x24\x24\x24\x24\x23\x23\x23\x23\x22\x22\x22\x22\x22\x22\x21\x21\x21\x21\x21\x20\x20\x20\x20\x20\x20\x20\x20\x43\x43\x43\x43\x43\x43\x66\x66\x66\x66\x66\x89\x89\x89\x89\x89\xac\xac\xac\xac\xac\xac\xa5\xa5\xa5\xa5\xa5\xa5\xa5\xa5\x9e\x9e\x9e\x9e\x9e\x9e\x9e\x97\x97\x97\x97\x97\x97\x97\x97\x97\x98\x98\x98\x98\x98\x99\x99\x99\x99\x99\x99\x9a\x9a\x9a\x9a\x9b\x9b\x9b\x9b\x9b\x9b\x9b\x9b\x78\x78\x78\x78\x55\x55\x55\x55\x55\x55\x32\x32\x32\x32\x32\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x16\x16\x16\x16\x16\x16\x16\x1d\x1d\x1d\x1d\x1d\x1d\x1d\x1d\x24\x24\x02\x04\x07\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x02\x07\x24\x24\x24\x23\x23\x23\x23\x22\x22\x22\x22\x22\x22\x22\x21\x21\x21\x21\x21\x20\x20\x20\x20\x20\x20\x20\x20\x43\x43\x43\x43\x43\x43\x66\x66\x66\x66\x66\x66\x89\x89\x89\x89\xac\xac\xac\xac\xac\xa5\xa5\xa5\xa5\xa5\xa5\xa5\xa5\x9e\x9e\x9e\x9e\x9e\x9e\x9e\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x98\x98\x98\x98\x98\x98\x99\x99\x99\x99\x99\x99\x9a\x9a\x9a\x9a\x9b\x9b\x9b\x9b\x9b\x9b\x78\x78\x78" \
-"\x78\x55\x55\x55\x55\x55\x55\x55\x32\x32\x32\x32\x32\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x16\x16\x16\x16\x16\x16\x16\x16\x1d\x1d\x1d\x1d\x1d\x1d\x1d\x1d\x24\x02\x04\x07\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x02\x07\x24\x24\x23\x23\x23\x23\x23\x22\x22\x22\x22\x22\x22\x21\x21\x21\x21\x21\x21\x20\x20\x20\x20\x20\x20\x20\x20\x43\x43\x43\x43\x43\x43\x66\x66\x66\x66\x66\x66\x66\x89\x89\x89\x89\xac\xac\xac\xac\xa5\xa5\xa5\xa5\xa5\xa5\xa5\x9e\x9e\x9e\x9e\x9e\x9e\x9e\x9e\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x98\x98\x98\x98\x98\x98\x99\x99\x99\x99\x99\x99\x9a\x9a\x9a\x9a\x9a\x9b\x9b\x9b\x9b\x78\x78\x78\x78\x78\x55\x55\x55\x55\x55\x55\x32\x32\x32\x32\x32\x32\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x16\x16\x16\x16\x16\x16\x16\x1d\x1d\x1d\x1d\x1d\x1d\x1d\x1d\x24\x02\x04\x07\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x02\x07\x24\x23\x23\x23\x23\x23\x22\x22\x22\x22\x22\x22\x22\x21\x21\x21\x21\x21\x21\x20\x20\x20\x20\x20\x20\x20\x20\x20\x43\x43\x43\x43\x43\x43\x66\x66\x66\x66\x66\x66\x89\x89\x89\x89\x89\xac" \
-"\xac\xa5\xa5\xa5\xa5\xa5\xa5\xa5\xa5\x9e\x9e\x9e\x9e\x9e\x9e\x9e\x9e\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x98\x98\x98\x98\x98\x98\x98\x99\x99\x99\x99\x99\x99\x9a\x9a\x9a\x9a\x9a\x9b\x9b\x9b\x78\x78\x78\x78\x55\x55\x55\x55\x55\x55\x55\x32\x32\x32\x32\x32\x32\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x16\x16\x16\x16\x16\x16\x16\x16\x1d\x1d\x1d\x1d\x1d\x1d\x1d\x1d\x02\x04\x07\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x02\x07\x1d\x1c\x1c\x1c\x1c\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x19\x19\x19\x19\x19\x19\x19\x19\x19\x3c\x3c\x3c\x3c\x3c\x3c\x5f\x5f\x5f\x5f\x5f\x5f\x5f\x82\x82\x82\x82\x82\xa5\xa5\xa5\xa5\xa5\xa5\xa5\xa5\x9e\x9e\x9e\x9e\x9e\x9e\x9e\x9e\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x98\x98\x98\x98\x98\x98\x98\x99\x99\x99\x99\x99\x99\x99\x9a\x9a\x9a\x9a\x9a\x9b\x78\x78\x78\x78\x55\x55\x55\x55\x55\x55\x55\x32\x32\x32\x32\x32\x32\x32\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x16\x16\x16\x16\x16\x16\x16\x16\x16\x1d\x1d\x1d\x1d\x1d\x1d\x1d\x02\x04\x07\x03\x03\x03\x03\x03\x03\x03" \
-"\x03\x03\x03\x03\x02\x07\x1c\x1c\x1c\x1c\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x3c\x3c\x3c\x3c\x3c\x3c\x3c\x5f\x5f\x5f\x5f\x5f\x5f\x5f\x82\x82\x82\x82\x82\x82\x82\x82\x82\x82\x82\x7b\x7b\x7b\x7b\x7b\x7b\x7b\x7b\x7b\x74\x74\x74\x74\x74\x74\x74\x74\x74\x74\x74\x74\x75\x75\x75\x75\x75\x75\x75\x76\x76\x76\x76\x76\x76\x76\x77\x77\x77\x77\x77\x77\x77\x77\x77\x54\x54\x54\x54\x54\x54\x54\x31\x31\x31\x31\x31\x31\x31\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x15\x15\x15\x15\x15\x15\x15\x15\x1c\x1c\x1c\x1c\x1c\x1c\x1c\x02\x04\x07\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x07\x1c\x1c\x1c\x1c\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x3c\x3c\x3c\x3c\x3c\x3c\x3c\x3c\x5f\x5f\x5f\x5f\x5f\x5f\x5f\x82\x82\x82\x82\x82\x82\x82\x82\x82\x82\x7b\x7b\x7b\x7b\x7b\x7b\x7b\x7b\x7b\x74\x74\x74\x74\x74\x74\x74\x74\x74\x74\x74\x74\x75\x75\x75\x75\x75\x75\x75\x75\x76\x76\x76\x76\x76\x76\x76\x77\x77\x77\x77\x77\x77\x54" \
-"\x54\x54\x54\x54\x54\x54\x54\x31\x31\x31\x31\x31\x31\x31\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x15\x15\x15\x15\x15\x15\x15\x15\x15\x1c\x1c\x1c\x1c\x1c\x1c\x02\x04\x07\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x07\x1c\x1c\x1c\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x3c\x3c\x3c\x3c\x3c\x3c\x3c\x3c\x5f\x5f\x5f\x5f\x5f\x5f\x5f\x5f\x82\x82\x82\x82\x82\x82\x82\x82\x7b\x7b\x7b\x7b\x7b\x7b\x7b\x7b\x7b\x74\x74\x74\x74\x74\x74\x74\x74\x74\x74\x74\x74\x74\x75\x75\x75\x75\x75\x75\x75\x75\x76\x76\x76\x76\x76\x76\x76\x77\x77\x77\x77\x77\x77\x54\x54\x54\x54\x54\x54\x54\x31\x31\x31\x31\x31\x31\x31\x31\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x15\x15\x15\x15\x15\x15\x15\x15\x15\x1c\x1c\x1c\x1c\x1c\x02\x04\x07\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x07\x1c\x1c\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x3c\x3c\x3c\x3c\x3c\x3c\x3c\x3c\x5f\x5f\x5f\x5f\x5f\x5f\x5f" \
-"\x5f\x82\x82\x82\x82\x82\x82\x7b\x7b\x7b\x7b\x7b\x7b\x7b\x7b\x7b\x7b\x74\x74\x74\x74\x74\x74\x74\x74\x74\x74\x74\x74\x74\x74\x75\x75\x75\x75\x75\x75\x75\x75\x76\x76\x76\x76\x76\x76\x76\x76\x77\x77\x77\x54\x54\x54\x54\x54\x54\x54\x54\x31\x31\x31\x31\x31\x31\x31\x31\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x1c\x1c\x1c\x1c\x02\x04\x07\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x07\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x3c\x3c\x3c\x3c\x3c\x3c\x3c\x3c\x3c\x5f\x5f\x5f\x5f\x5f\x5f\x5f\x5f\x82\x82\x82\x82\x7b\x7b\x7b\x7b\x7b\x7b\x7b\x7b\x7b\x7b\x74\x74\x74\x74\x74\x74\x74\x74\x74\x74\x74\x74\x74\x74\x74\x75\x75\x75\x75\x75\x75\x75\x75\x75\x76\x76\x76\x76\x76\x76\x76\x76\x54\x54\x54\x54\x54\x54\x54\x54\x31\x31\x31\x31\x31\x31\x31\x31\x31\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x1c\x1c\x1c\x02\x04\x07\x02\x02\x02\x02\x02" \
-"\x02\x02\x02\x02\x02\x02\x02\x07\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x3c\x3c\x3c\x3c\x3c\x3c\x3c\x3c\x3c\x5f\x5f\x5f\x5f\x5f\x5f\x5f\x5f\x5f\x5f\x58\x58\x58\x58\x58\x58\x58\x58\x58\x58\x58\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x52\x52\x52\x52\x52\x52\x52\x52\x52\x52\x53\x53\x53\x53\x53\x53\x53\x53\x53\x53\x53\x53\x53\x53\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x1b\x1b\x02\x04\x07\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x07\x1b\x1b\x1b\x1b\x1b\x1b\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x3c\x3c\x3c\x3c\x3c\x3c\x3c\x3c\x3c\x3c\x5f\x5f\x5f\x5f\x5f\x5f\x5f\x58\x58\x58\x58\x58\x58\x58\x58\x58\x58\x58\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x52\x52\x52\x52\x52\x52\x52\x52\x52\x52\x53\x53\x53\x53\x53\x53\x53\x53" \
-"\x53\x53\x53\x53\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x02\x04\x07\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x07\x14\x14\x14\x14\x14\x13\x13\x13\x13\x13\x13\x13\x13\x13\x13\x13\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x35\x35\x35\x35\x35\x35\x35\x35\x35\x35\x58\x58\x58\x58\x58\x58\x58\x58\x58\x58\x58\x58\x58\x58\x58\x58\x58\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x52\x52\x52\x52\x52\x52\x52\x52\x52\x52\x52\x53\x53\x53\x53\x53\x53\x53\x53\x53\x53\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x02\x04\x07\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x02\x07\x14\x14\x14\x14\x13\x13\x13\x13\x13\x13\x13\x13\x13\x13\x13\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x35\x35\x35\x35\x35\x35\x35\x35\x35\x35\x35" \
-"\x35\x58\x58\x58\x58\x58\x58\x58\x58\x58\x58\x58\x58\x58\x58\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x52\x52\x52\x52\x52\x52\x52\x52\x52\x52\x52\x52\x53\x53\x53\x53\x53\x53\x53\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x02\x04\x07\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x02\x07\x14\x14\x13\x13\x13\x13\x13\x13\x13\x13\x13\x13\x13\x13\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x35\x35\x35\x35\x35\x35\x35\x35\x35\x35\x35\x35\x58\x58\x58\x58\x58\x58\x58\x58\x58\x58\x58\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x52\x52\x52\x52\x52\x52\x52\x52\x52\x52\x52\x52\x53\x53\x53\x53\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x14\x14\x14\x14\x14\x14\x14\x14\x14\x02\x04\x07\x01\x01\x01" \
-"\x01\x01\x01\x01\x01\x01\x01\x01\x02\x07\x14\x13\x13\x13\x13\x13\x13\x13\x13\x13\x13\x13\x13\x13\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x35\x35\x35\x35\x35\x35\x35\x35\x35\x35\x35\x35\x58\x58\x58\x58\x58\x58\x58\x58\x58\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x51\x52\x52\x52\x52\x52\x52\x52\x52\x52\x52\x52\x52\x53\x53\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x0d\x14\x14\x14\x14\x14\x14\x14\x02\x04\x07\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x02\x07\x13\x13\x13\x13\x13\x13\x13\x13\x13\x13\x13\x13\x13\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x35\x35\x35\x35\x35\x35\x35\x35\x35\x35\x35\x35\x35\x35\x35\x35\x35\x35\x35\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f" \
-"\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x13\x13\x13\x13\x13\x13\x02\x04\x07\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x02\x07\x13\x13\x13\x13\x13\x13\x13\x13\x13\x13\x13\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x35\x35\x35\x35\x35\x35\x35\x35\x35\x35\x35\x35\x35\x35\x35\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x13\x13\x13\x13\x02\x04\x07\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x02\x07\x13\x13\x13\x13\x13\x13\x01\x01\x01\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x12\x01\x01\x01" \
-"\x35\x35\x35\x35\x35\x35\x35\x35\x35\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x13\x13\x02\x04\x07\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x02\x07\x0c\x0c\x0c\x0c\x01\x01\x01\x01\x01\x01\x01\x12\x12\x12\x12\x12\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x12\x12\x12\x12\x01\x01\x01\x01\x01\x01\x01\x01\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x01\x01\x01\x01\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x01\x01\x01\x01\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x02\x04\x07\x0b" \
-"\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x02\x07\x0c\x01\x01\x01\x01\x01\x01\x01\x01\x01\x12\x12\x12\x12\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x12\x12\x12\x12\x12\x01\x01\x01\x01\x01\x01\x01\x01\x01\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x02\x04\x07\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x02\x07\x01\x01\x01\x01\x01\x01\x01\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x01\x01\x01\x01\x01\x01\x01\x01\x01\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x2e\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x01\x01\x01\x01\x01" \
-"\x01\x01\x01\x01\x01\x01\x01\x01\x01\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x01\x02\x04\x07\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x02\x07\x0c\x0c\x0c\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x2e\x2e\x2e\x2e\x2e\x2e\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0c\x0c\x02\x04\x07\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x02\x07\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" \
-"\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x02\x04\x07\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x02\x07\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x02\x04" \
-"\x07\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x02\x07\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x02\x04\x07\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x02\x07\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" \
-"\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x02\x04\x07\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x04\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x03\x01\x00\x14\x00\x3e\x33\x00\x00\x00\x01\x00\x00\x38\x42\x49\x4d\x03\xed\x00\x00\x00\x00\x00\x10\x00\x48\x00\x00\x00\x01\x00\x01\x00\x48\x00\x00\x00" \
-"\x01\x00\x01\x38\x42\x49\x4d\x03\xf3\x00\x00\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x38\x42\x49\x4d\x03\xf5\x00\x00\x00\x00\x00\x48\x00\x2f\x66\x66\x00\x01\x00\x6c\x66\x66\x00\x06\x00\x00\x00\x00\x00\x00\x00\x2f\x66\x66\x00\x01\x00\xa1\x99\x9a\x00\x06\x00\x00\x00\x00\x00\x00\x00\x32\x00\x00\x00\x01\x00\x5a\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x35\x00\x00\x00\x01\x00\x2d\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x38\x42\x49\x4d\x03\xf8\x00\x00\x00\x00\x00\x70\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x03\xe8\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x03\xe8\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x03\xe8\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x03\xe8\x00\x00\x00\x00\x00\x00\x32\x33\x00\x00\x54\x52\x55\x45\x56\x49\x53\x49\x4f\x4e\x2d\x58\x46\x49\x4c\x45\x2e" \
-"\x00"};
diff --git a/source/blender/src/cmovie.tga.c b/source/blender/src/cmovie.tga.c
deleted file mode 100644
index 391c032168d..00000000000
--- a/source/blender/src/cmovie.tga.c
+++ /dev/null
@@ -1,205 +0,0 @@
-/* DataToC output of file <cmovie_tga> */
-/*
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-int datatoc_cmovie_tga_size= 6247;
-char datatoc_cmovie_tga[]= {"\x00\x00\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x34\x00\x20\x00\x01\x0c\x0c\x0c\xff\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\x83\x0c\x0c\x0c\xff\x17\xfe\xfe\xfe\xff\xfd\xfd\xfd\xff\xfd\xfd\xfd\xff\xfe\xfe\xfe\xff\x50\x50\x50\xff\x9c\x9c\x9c\xff\x9c\x9c\x9c\xff\x9d\x9d\x9d\xff\xac\xac\xac\xff\xb8\xb8\xb8\xff\xb6\xb6\xb6\xff\xa9\xa9\xa9\xff\x9c\x9c\x9c\xff\xa4\xa4\xa4" \
-"\xff\xb2\xb2\xb2\xff\x3b\x35\x35\xff\x58\x51\x51\xff\xa3\x9c\x9c\xff\x9a\x97\x97\xff\xb8\xb8\xb8\xff\xaf\xae\xae\xff\x47\x42\x42\xff\x86\x80\x80\xff\xb4\xb4\xb4\xff\x8c\xb7\xb7\xb7\xff\x84\xb8\xb8\xb8\xff\x83\x0c\x0c\x0c\xff\x00\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\x8b\x0c\x0c\x0c\xff\x83\xfe\xfe\xfe\xff\x13\x52\x52\x52\xff\x9f\x9f\x9f\xff\xa0\xa0\xa0\xff\xa9\xa9\xa9\xff\xb6\xb6\xb6\xff\xb7\xb7\xb7\xff\xac\xac\xac\xff\x9d\x9d\x9d\xff\x9c\x9c\x9c\xff\xa6\xa6\xa6\xff\xa6\xa6\xa6\xff\x38\x32\x32\xff\x72\x6a\x6a\xff\x86\x80\x80\xff\xaf\xaf\xaf\xff\xb7\xb7\xb7\xff\x5d\x5a\x5a\xff\x4d\x46\x46\xff\x9a\x93\x93\xff\xb4\xb4\xb4\xff\x8b\xb7\xb7\xb7\xff\x85\xb8\xb8\xb8\xff\x95\x0c\x0c\x0c\xff\x83\xfe\xfe\xfe\xff\x13\x5a\x5a\x5a\xff\xb3\xb3\xb3\xff\xb4\xb4\xb4\xff\xb7\xb7\xb7\xff\xb8\xb8\xb8\xff\xb5\xb5\xb5\xff\xa2\xa2\xa2\xff\x9c\x9c\x9c\xff\x9d\x9d\x9d\xff\xad\xad\xad\xff\xb8\xb8\xb8\xff\x91\x8f\x8f\xff\x8e\x8b\x8b\xff\xad\xac\xac\xff\xb8\xb8\xb8\xff\x9a\x99\x99\xff\x33\x2c\x2c\xff\x84" \
-"\x7d\x7d\xff\x9e\x99\x99\xff\xb6\xb6\xb6\xff\x8b\xb7\xb7\xb7\xff\x85\xb8\xb8\xb8\xff\x8b\x0c\x0c\x0c\xff\x00\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\x83\x0c\x0c\x0c\xff\x83\xc3\x73\x00\xff\x00\x5c\x5c\x5c\xff\x83\xb8\xb8\xb8\xff\x04\xb5\xb5\xb5\xff\xa3\xa3\xa3\xff\x9e\x9e\x9e\xff\xa7\xa7\xa7\xff\xb6\xb6\xb6\xff\x83\xb8\xb8\xb8\xff\x04\xb7\xb7\xb7\xff\x92\x90\x90\xff\x43\x3b\x3b\xff\x7b\x74\x74\xff\xa0\x9d\x9d\xff\x89\xb7\xb7\xb7\xff\x01\xb6\xb6\xb6\xff\xb7\xb7\xb7\xff\x86\xb8\xb8\xb8\xff\x83\x0c\x0c\x0c\xff\x00\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x03\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\x0c\x0c\x0c\xff\x0c\x0c\x0c\xff\x83\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\xdf\xdf\xdf\xff\x83\x0c\x0c\x0c\xff\x83\xc3\x73\x00\xff\x00\x5c\x5c\x5c\xff\x83\xb8\xb8\xb8\xff\x03\xb7\xb7\xb7\xff\xb3\xb3\xb3\xff\xb2\xb2\xb2\xff\xb7\xb7\xb7\xff\x83\xb8\xb8\xb8\xff\x04\xb7\xb7\xb7\xff\xb7\xb7\xb7\xff\xb6\xb6\xb6\xff\x91\x8f\x8f\xff\xa2\xa0\xa0\xff\x8b\xb7\xb7\xb7\xff\x87\xb8\xb8\xb8\xff\x83\x0c\x0c\x0c\xff\x83" \
-"\xe0\xe0\xe0\xff\x03\xdf\xdf\xdf\xff\xdf\xdf\xdf\xff\x0c\x0c\x0c\xff\x0c\x0c\x0c\xff\x83\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\xdf\xdf\xdf\xff\x83\x0c\x0c\x0c\xff\x83\xc3\x73\x00\xff\x00\x5c\x5c\x5c\xff\x89\xb8\xb8\xb8\xff\x01\xb7\xb7\xb7\xff\xb8\xb8\xb8\xff\x8f\xb7\xb7\xb7\xff\x88\xb8\xb8\xb8\xff\x83\x0c\x0c\x0c\xff\x83\xe0\xe0\xe0\xff\x04\xdf\xdf\xdf\xff\xdf\xdf\xdf\xff\x0c\x0c\x0c\xff\x0c\x0c\x0c\xff\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\xb1\x0c\x0c\x0c\xff\x00\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\xff\x0c\x0c\x0c\xff\x81\x0c\x0c\x0c\xff\x00\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\x83\x0c\x0c\x0c\xff\x83\xfe\xfe\xfe\xff\x00\x5c\x5c\x5c\xff\x85\xb8\xb8\xb8\xff\x00\xb7\xb7\xb7\xff\x83\xb6\xb6\xb6\xff\x8d\xb8\xb8\xb8\xff\x02\xb7\xb7\xb7\xff\xb7\xb7\xb7\xff\xb8\xb8\xb8\xff\x82\xb7\xb7\xb7\xff\x85\xb8\xb8\xb8\xff\x83\x0c\x0c\x0c\xff\x00\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x03\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\x0c\x0c" \
-"\x0c\xff\x0c\x0c\x0c\xff\x83\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\xdf\xdf\xdf\xff\x83\x0c\x0c\x0c\xff\x83\xfe\xfe\xfe\xff\x00\x5c\x5c\x5c\xff\x83\xb8\xb8\xb8\xff\x09\xb6\xb6\xb6\xff\xb2\xb2\xb2\xff\xae\xae\xae\xff\xa9\xa9\xa9\xff\xa6\xa6\xa6\xff\xa6\xa6\xa6\xff\xa8\xa8\xa8\xff\xab\xab\xab\xff\xb2\xb2\xb2\xff\xb6\xb6\xb6\xff\x89\xb8\xb8\xb8\xff\x86\xb7\xb7\xb7\xff\x85\xb8\xb8\xb8\xff\x83\x0c\x0c\x0c\xff\x83\xe0\xe0\xe0\xff\x03\xdf\xdf\xdf\xff\xdf\xdf\xdf\xff\x0c\x0c\x0c\xff\x0c\x0c\x0c\xff\x83\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\xdf\xdf\xdf\xff\x83\x0c\x0c\x0c\xff\x83\xe0\xb8\x7f\xff\x06\x5c\x5c\x5c\xff\xb8\xb8\xb8\xff\xb8\xb8\xb8\xff\xb7\xb7\xb7\xff\xb1\xb1\xb1\xff\xa8\xa8\xa8\xff\xa0\xa0\xa0\xff\x85\x9c\x9c\x9c\xff\x05\x9e\x9e\x9e\xff\xa4\xa4\xa4\xff\xb0\xb0\xb0\xff\xb9\xb9\xb9\xff\xba\xba\xba\xff\xb9\xb9\xb9\xff\x86\xb8\xb8\xb8\xff\x85\xb7\xb7\xb7\xff\x85\xb8\xb8\xb8\xff\x83\x0c\x0c\x0c\xff\x83\xe0\xe0\xe0\xff\x04\xdf\xdf\xdf\xff\xdf\xdf\xdf\xff\x0c\x0c\x0c\xff\x0c\x0c\x0c\xff\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0" \
-"\xff\x01\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\x83\x0c\x0c\x0c\xff\x83\xc3\x73\x00\xff\x04\x5c\x5c\x5c\xff\xb8\xb8\xb8\xff\xb6\xb6\xb6\xff\xae\xae\xae\xff\xa1\xa1\xa1\xff\x87\x9c\x9c\x9c\xff\x09\x9d\x9d\x9d\xff\xa0\xa0\xa0\xff\xa3\xa3\xa3\xff\xa9\xa9\xa9\xff\x9c\x9b\x9c\xff\x8c\x8a\x8b\xff\x7f\x7e\x7e\xff\x8c\x8a\x8b\xff\xa1\xa1\xa1\xff\xb5\xb5\xb5\xff\x83\xb8\xb8\xb8\xff\x84\xb7\xb7\xb7\xff\x85\xb8\xb8\xb8\xff\x83\x0c\x0c\x0c\xff\x00\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\x8b\x0c\x0c\x0c\xff\x83\xc3\x73\x00\xff\x03\x5c\x5c\x5c\xff\xb7\xb7\xb7\xff\xac\xac\xac\xff\x9f\x9f\x9f\xff\x87\x9c\x9c\x9c\xff\x0e\x9d\x9d\x9d\xff\xa0\xa0\xa0\xff\x9f\x9f\x9f\xff\x6e\x6c\x6c\xff\x36\x31\x32\xff\x21\x1b\x1c\xff\x20\x1a\x1b\xff\x1f\x19\x1a\xff\x1e\x19\x1a\xff\x24\x1f\x20\xff\x42\x3e\x3f\xff\x84\x83\x83\xff\xb2\xb2\xb2\xff\xb8\xb8\xb8\xff\xb8\xb8\xb8\xff\x84\xb7\xb7\xb7\xff\x85\xb8\xb8\xb8\xff\x95\x0c\x0c\x0c\xff\x83\xe0\xb8\x7f\xff\x02\x5c\x5c\x5c\xff\xb1\xb1\xb1\xff\xa0\xa0\xa0\xff\x88\x9c\x9c\x9c" \
-"\xff\x0d\x9d\x9d\x9d\xff\x96\x96\x96\xff\x42\x3e\x3f\xff\x21\x1b\x1c\xff\x1e\x22\x20\xff\x16\x3e\x34\xff\x10\x4f\x41\xff\x0e\x53\x44\xff\x10\x41\x35\xff\x14\x1f\x1c\xff\x19\x14\x15\xff\x1e\x19\x1a\xff\x45\x41\x42\xff\xa2\xa1\xa1\xff\x85\xb7\xb7\xb7\xff\x85\xb8\xb8\xb8\xff\x8b\x0c\x0c\x0c\xff\x00\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\x83\x0c\x0c\x0c\xff\x83\xfe\xfe\xfe\xff\x01\x5a\x5a\x5a\xff\xa5\xa5\xa5\xff\x89\x9c\x9c\x9c\xff\x0e\x96\x96\x96\xff\x41\x3d\x3e\xff\x20\x1d\x1e\xff\x14\x4d\x3f\xff\x07\x98\x78\xff\x05\xaf\x8a\xff\x05\xbc\x94\xff\x05\xbb\x92\xff\x05\xba\x92\xff\x05\xa0\x7d\xff\x09\x62\x4d\xff\x10\x21\x1c\xff\x19\x14\x15\xff\x2f\x2a\x2b\xff\x99\x98\x99\xff\x84\xb7\xb7\xb7\xff\x85\xb8\xb8\xb8\xff\x83\x0c\x0c\x0c\xff\x00\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x03\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\x0c\x0c\x0c\xff\x0c\x0c\x0c\xff\x83\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\xdf\xdf\xdf\xff\x83\x0c\x0c\x0c\xff\x05\xfe\xfe\xfe\xff\xfd\xfd\xfd\xff\xfd\xfd\xfd\xff\xfe\xfe\xfe\xff\x55" \
-"\x55\x55\xff\x9d\x9d\x9d\xff\x88\x9c\x9c\x9c\xff\x10\x9b\x9b\x9b\xff\x48\x45\x46\xff\x20\x1b\x1c\xff\x11\x6a\x55\xff\x06\x9d\x79\xff\x06\xa8\x82\xff\x06\xb2\x8a\xff\x06\xc3\x96\xff\x06\xd1\xa4\xff\x06\xd0\xa3\xff\x06\xbd\x94\xff\x04\xad\x88\xff\x05\x88\x6a\xff\x0b\x37\x2c\xff\x16\x12\x12\xff\x31\x2d\x2e\xff\xa2\xa2\xa2\xff\x84\xb7\xb7\xb7\xff\x84\xb8\xb8\xb8\xff\x83\x0c\x0c\x0c\xff\x83\xe0\xe0\xe0\xff\x03\xdf\xdf\xdf\xff\xdf\xdf\xdf\xff\x0c\x0c\x0c\xff\x0c\x0c\x0c\xff\x83\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\xdf\xdf\xdf\xff\x83\x0c\x0c\x0c\xff\x83\xfe\xfe\xfe\xff\x01\x55\x55\x55\xff\x9e\x9e\x9e\xff\x88\x9c\x9c\x9c\xff\x11\x75\x74\x75\xff\x22\x1d\x1e\xff\x1a\x48\x3d\xff\x06\x9f\x7b\xff\x06\xaf\x8a\xff\x06\xb4\x8c\xff\x06\xc0\x95\xff\x08\xc9\x9c\xff\x09\xcd\xa3\xff\x08\xc5\x9b\xff\x07\xca\x9f\xff\x05\xba\x92\xff\x04\xa5\x81\xff\x04\x90\x71\xff\x0b\x33\x28\xff\x17\x12\x12\xff\x4d\x49\x4a\xff\xb3\xb3\xb3\xff\x83\xb7\xb7\xb7\xff\x84\xb8\xb8\xb8\xff\x83\x0c\x0c\x0c\xff\x83\xe0\xe0\xe0\xff\x04\xdf\xdf\xdf\xff\xdf\xdf" \
-"\xdf\xff\x0c\x0c\x0c\xff\x0c\x0c\x0c\xff\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\x83\x0c\x0c\x0c\xff\x83\xc3\x73\x00\xff\x02\x5b\x5b\x5b\xff\xb0\xb0\xb0\xff\xa2\xa2\xa2\xff\x86\x9c\x9c\x9c\xff\x12\x9b\x9b\x9b\xff\x3c\x39\x39\xff\x24\x1f\x20\xff\x0e\x92\x75\xff\x07\xab\x85\xff\x07\xaf\x88\xff\x07\xbd\x94\xff\x06\x97\x76\xff\x0b\x66\x4f\xff\x13\x3c\x33\xff\x19\x2d\x33\xff\x1d\x39\x46\xff\x17\x61\x5e\xff\x0b\x91\x77\xff\x04\x9d\x7b\xff\x05\x86\x69\xff\x0d\x20\x1b\xff\x1d\x18\x18\xff\x86\x84\x84\xff\x83\xb7\xb7\xb7\xff\x84\xb8\xb8\xb8\xff\x83\x0c\x0c\x0c\xff\x00\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\x8b\x0c\x0c\x0c\xff\x83\xc3\x73\x00\xff\x02\x5c\x5c\x5c\xff\xb7\xb7\xb7\xff\xa7\xa7\xa7\xff\x86\x9c\x9c\x9c\xff\x13\x8e\x8e\x8e\xff\x27\x23\x23\xff\x1d\x4c\x42\xff\x09\xb3\x8d\xff\x08\xaf\x87\xff\x09\xbf\x95\xff\x08\x9e\x7d\xff\x0b\x48\x39\xff\x1a\x10\x14\xff\x23\x12\x2a\xff\x2c\x19\x47\xff\x2d\x1b\x56\xff\x2b\x1a\x59\xff\x26\x24\x58\xff\x12\x76\x6e\xff" \
-"\x04\xa3\x80\xff\x07\x63\x4d\xff\x13\x0f\x0f\xff\x42\x3e\x3f\xff\xb4\xb4\xb4\xff\x82\xb7\xb7\xb7\xff\x84\xb8\xb8\xb8\xff\x95\x0c\x0c\x0c\xff\x83\xc3\x73\x00\xff\x02\x5c\x5c\x5c\xff\xb6\xb6\xb6\xff\xa3\xa3\xa3\xff\x86\x9c\x9c\x9c\xff\x13\x9b\x9b\x9b\xff\x88\x92\x8f\xff\x0f\xa5\x83\xff\x0a\xba\x93\xff\x0b\xb5\x8d\xff\x0a\xc4\x9b\xff\x08\x6c\x57\xff\x14\x0f\x0e\xff\x1d\x10\x20\xff\x28\x18\x42\xff\x30\x1d\x5d\xff\x36\x21\x72\xff\x39\x23\x82\xff\x37\x23\x85\xff\x2e\x27\x72\xff\x0b\x9a\x82\xff\x04\x97\x74\xff\x0c\x20\x1a\xff\x20\x1a\x1c\xff\x9f\x9e\x9e\xff\x82\xb7\xb7\xb7\xff\x84\xb8\xb8\xb8\xff\x8b\x0c\x0c\x0c\xff\x00\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\x83\x0c\x0c\x0c\xff\x83\xe0\xb8\x7f\xff\x02\x5b\x5b\x5b\xff\xb3\xb3\xb3\xff\xa4\xa4\xa4\xff\x86\x9c\x9c\x9c\xff\x13\x9d\x9d\x9d\xff\x8b\xa2\x9b\xff\x11\xb9\x96\xff\x0e\xc7\xa0\xff\x0e\xc8\xa0\xff\x0b\xb4\x8e\xff\x0d\x3b\x30\xff\x16\x0b\x10\xff\x21\x14\x2f\xff\x2d\x1c\x52\xff\x36\x22\x70\xff\x4a\x33\x9c\xff\x5d\x45\xc1\xff\x59\x42" \
-"\xc9\xff\x43\x2d\xaa\xff\x1e\x65\x7c\xff\x04\xb5\x8e\xff\x08\x50\x40\xff\x20\x22\x22\xff\x86\x85\x85\xff\x82\xb7\xb7\xb7\xff\x84\xb8\xb8\xb8\xff\x83\x0c\x0c\x0c\xff\x00\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x03\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\x0c\x0c\x0c\xff\x0c\x0c\x0c\xff\x83\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\xdf\xdf\xdf\xff\x83\x0c\x0c\x0c\xff\x83\xfe\xfe\xfe\xff\x02\x52\x52\x52\xff\xa1\xa1\xa1\xff\x9e\x9e\x9e\xff\x87\x9c\x9c\x9c\xff\x12\x88\xa4\x9d\xff\x14\xb6\x92\xff\x12\xbb\x95\xff\x12\xca\xa1\xff\x0f\xb0\x8a\xff\x0f\x2c\x24\xff\x18\x0c\x17\xff\x26\x15\x3c\xff\x33\x20\x67\xff\x47\x30\x94\xff\x71\x57\xd5\xff\xa3\x87\xfc\xff\x92\x76\xfc\xff\x5b\x41\xda\xff\x2d\x4d\x90\xff\x06\xbc\x92\xff\x05\xaa\x84\xff\x55\xaf\x98\xff\xbc\xbc\xbc\xff\x82\xb7\xb7\xb7\xff\x84\xb8\xb8\xb8\xff\x83\x0c\x0c\x0c\xff\x83\xe0\xe0\xe0\xff\x03\xdf\xdf\xdf\xff\xdf\xdf\xdf\xff\x0c\x0c\x0c\xff\x0c\x0c\x0c\xff\x83\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\xdf\xdf\xdf\xff\x83\x0c\x0c\x0c\xff\x83\xfe\xfe\xfe\xff\x00\x51\x51\x51\xff\x88\x9c\x9c" \
-"\x9c\xff\x13\x98\x97\x97\xff\x93\x9d\x9a\xff\x45\xb3\x99\xff\x17\xc9\xa1\xff\x17\xca\xa1\xff\x15\xca\xa3\xff\x11\x3c\x31\xff\x17\x0b\x19\xff\x26\x15\x44\xff\x34\x21\x6f\xff\x4f\x37\xa4\xff\x85\x6b\xf0\xff\xc1\xa3\xff\xff\xad\x8f\xff\xff\x66\x4a\xec\xff\x30\x49\x91\xff\x07\xca\x9f\xff\x06\xb7\x8e\xff\x49\xb8\x9e\xff\xbe\xbe\xbe\xff\x82\xb7\xb7\xb7\xff\x84\xb8\xb8\xb8\xff\x83\x0c\x0c\x0c\xff\x83\xe0\xe0\xe0\xff\x04\xdf\xdf\xdf\xff\xdf\xdf\xdf\xff\x0c\x0c\x0c\xff\x0c\x0c\x0c\xff\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\x83\x0c\x0c\x0c\xff\x83\xfe\xfe\xfe\xff\x00\x55\x55\x55\xff\x88\x9c\x9c\x9c\xff\x16\x7a\x79\x79\xff\x86\x7f\x7f\xff\xa6\xb6\xaf\xff\x23\xd0\xaa\xff\x1e\xdc\xb1\xff\x1d\xe3\xb8\xff\x15\x7e\x65\xff\x18\x0d\x17\xff\x24\x15\x3e\xff\x33\x1f\x6a\xff\x49\x32\x9e\xff\x6f\x54\xdf\xff\x95\x78\xfe\xff\x88\x69\xfe\xff\x5b\x3e\xdf\xff\x26\x76\x91\xff\x07\xcf\xa2\xff\x07\xb8\x90\xff\x4b\xb6\x9c\xff\xbf\xbf\xbf\xff\xb8\xb8\xb8\xff\xb7\xb7\xb7\xff\xb7\xb7\xb7\xff\x84\xb8\xb8\xb8\xff" \
-"\x83\x0c\x0c\x0c\xff\x00\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\x8b\x0c\x0c\x0c\xff\x83\xc3\x73\x00\xff\x05\x59\x59\x59\xff\xa2\xa2\xa2\xff\x9c\x9c\x9c\xff\x9c\x9c\x9c\xff\x9b\x9b\x9b\xff\x99\x99\x99\xff\x83\x9c\x9c\x9c\xff\x16\x93\x93\x93\xff\x6c\x65\x65\xff\xc1\xba\xb9\xff\x4d\xd8\xb7\xff\x25\xe2\xb8\xff\x24\xe1\xb6\xff\x1f\xd1\xa8\xff\x17\x2a\x28\xff\x21\x14\x32\xff\x2f\x1c\x5b\xff\x3e\x28\x88\xff\x50\x37\xb6\xff\x5f\x42\xdc\xff\x60\x40\xe8\xff\x46\x43\xb6\xff\x12\xd5\xb8\xff\x07\xd3\xa6\xff\x09\x85\x69\xff\x57\x5e\x5a\xff\xab\xa8\xa8\xff\xb8\xb8\xb8\xff\xb7\xb7\xb7\xff\xb7\xb7\xb7\xff\x84\xb8\xb8\xb8\xff\x95\x0c\x0c\x0c\xff\x83\xc3\x73\x00\xff\x20\x5c\x5c\x5c\xff\xac\xac\xac\xff\x9d\x9d\x9d\xff\x8f\x8f\x8f\xff\x4d\x48\x48\xff\x56\x50\x50\xff\x66\x62\x62\xff\x74\x71\x71\xff\x7f\x7c\x7c\xff\x8d\x8a\x8a\xff\x99\x99\x99\xff\x5d\x59\x59\xff\xc2\xba\xba\xff\xa2\xd7\xc9\xff\x2d\xdd\xb5\xff\x2b\xe9\xbf\xff\x29\xef\xc8\xff\x21\xb9\x99\xff\x1a\x28\x2e\xff\x24\x16\x3f\xff\x33\x20\x66" \
-"\xff\x3c\x24\x85\xff\x43\x2b\x9d\xff\x43\x40\xa8\xff\x1e\xbe\xb2\xff\x0a\xea\xba\xff\x07\xd6\xaa\xff\x0c\x53\x42\xff\x79\x72\x72\xff\xa9\xa6\xa6\xff\xb7\xb7\xb7\xff\xb8\xb8\xb8\xff\xb7\xb7\xb7\xff\x84\xb8\xb8\xb8\xff\x8b\x0c\x0c\x0c\xff\x00\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\x83\x0c\x0c\x0c\xff\x83\xc3\x73\x00\xff\x1d\x5c\x5c\x5c\xff\xb6\xb6\xb6\xff\xa5\xa5\xa5\xff\x65\x62\x62\xff\x43\x3b\x3b\xff\x77\x6f\x6f\xff\xa0\x99\x99\xff\x9f\x98\x98\xff\x91\x8a\x8a\xff\x91\x8f\x8f\xff\x9b\x9b\x9b\xff\x7e\x7d\x7d\xff\x92\x8b\x8b\xff\xd7\xd4\xd2\xff\x5f\xda\xbd\xff\x30\xe0\xb9\xff\x2e\xd7\xb0\xff\x2b\xde\xb7\xff\x25\xbe\x9c\xff\x1f\x71\x63\xff\x21\x48\x55\xff\x26\x4d\x63\xff\x26\x88\x90\xff\x19\xe4\xc7\xff\x10\xeb\xbc\xff\x0b\xdd\xae\xff\x08\xb5\x8f\xff\x25\x34\x2f\xff\x96\x8f\x8f\xff\xb2\xb1\xb1\xff\x82\xb7\xb7\xb7\xff\x84\xb8\xb8\xb8\xff\x83\x0c\x0c\x0c\xff\x00\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x03\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\x0c\x0c\x0c\xff\x0c\x0c\x0c\xff\x83\xe0\xe0\xe0\xff" \
-"\x01\xdf\xdf\xdf\xff\xdf\xdf\xdf\xff\x83\x0c\x0c\x0c\xff\x83\xe0\xb8\x7f\xff\x1d\x5c\x5c\x5c\xff\xb7\xb7\xb7\xff\xb3\xb3\xb3\xff\x98\x98\x98\xff\x4d\x49\x49\xff\x5e\x57\x57\xff\x77\x70\x70\xff\x80\x7c\x7c\xff\x93\x92\x92\xff\x9c\x9c\x9c\xff\x9c\x9c\x9c\xff\x9b\x9b\x9b\xff\x61\x5d\x5d\xff\xcb\xc4\xc4\xff\xca\xda\xd4\xff\x45\xd5\xb2\xff\x31\xd3\xae\xff\x2e\xd0\xab\xff\x2b\xdc\xb8\xff\x29\xe0\xb7\xff\x24\xd8\xae\xff\x20\xe0\xb7\xff\x1b\xea\xbe\xff\x15\xe5\xb7\xff\x10\xe3\xb5\xff\x0c\xd0\xa5\xff\x0d\x69\x55\xff\x70\x6a\x6a\xff\xa3\x9d\x9d\xff\xb8\xb7\xb7\xff\x82\xb7\xb7\xb7\xff\x84\xb8\xb8\xb8\xff\x83\x0c\x0c\x0c\xff\x83\xe0\xe0\xe0\xff\x03\xdf\xdf\xdf\xff\xdf\xdf\xdf\xff\x0c\x0c\x0c\xff\x0c\x0c\x0c\xff\x83\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\xdf\xdf\xdf\xff\x83\x0c\x0c\x0c\xff\x0a\xfe\xfe\xfe\xff\xfd\xfd\xfd\xff\xfd\xfd\xfd\xff\xfe\xfe\xfe\xff\x59\x59\x59\xff\xae\xae\xae\xff\xb3\xb3\xb3\xff\xb2\xb2\xb2\xff\xa2\xa2\xa2\xff\x90\x90\x90\xff\x97\x97\x97\xff\x84\x9c\x9c\x9c\xff\x10\x92\x92\x92\xff\x77\x73\x73\xff\xe0" \
-"\xd9\xd9\xff\xc7\xdd\xd6\xff\x4e\xce\xaf\xff\x33\xd8\xb4\xff\x2f\xd4\xb0\xff\x2a\xd4\xad\xff\x25\xda\xb1\xff\x21\xd0\xa8\xff\x1b\xda\xb2\xff\x15\xd7\xaf\xff\x0f\xc3\x9c\xff\x0d\x84\x6a\xff\x4f\x55\x52\xff\x9d\x96\x96\xff\xb1\xae\xae\xff\x83\xb7\xb7\xb7\xff\x84\xb8\xb8\xb8\xff\x83\x0c\x0c\x0c\xff\x83\xe0\xe0\xe0\xff\x04\xdf\xdf\xdf\xff\xdf\xdf\xdf\xff\x0c\x0c\x0c\xff\x0c\x0c\x0c\xff\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\x83\x0c\x0c\x0c\xff\x1f\xfe\xfe\xfe\xff\xfd\xfd\xfd\xff\xfd\xfd\xfd\xff\xfe\xfe\xfe\xff\x4f\x4f\x4f\xff\xa3\xa3\xa3\xff\xb4\xb4\xb4\xff\xb8\xb8\xb8\xff\xb4\xb4\xb4\xff\xa7\xa7\xa7\xff\x9e\x9e\x9e\xff\x9c\x9c\x9c\xff\x9c\x9c\x9c\xff\x9b\x9b\x9b\xff\x96\x96\x96\xff\x85\x83\x83\xff\x95\x94\x94\xff\x89\x89\x89\xff\x85\x80\x80\xff\xe8\xe0\xe0\xff\xd8\xe4\xdf\xff\x76\xdd\xc6\xff\x37\xcd\xab\xff\x2d\xcc\xa8\xff\x27\xd3\xae\xff\x21\xc7\xa1\xff\x1a\xbe\x97\xff\x13\xa6\x84\xff\x18\x73\x5f\xff\x5d\x61\x5f\xff\x9c\x95\x95\xff\xac\xa8\xa8\xff\x84\xb7\xb7\xb7\xff\x84\xb8\xb8" \
-"\xb8\xff\x83\x0c\x0c\x0c\xff\x00\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\x8b\x0c\x0c\x0c\xff\x83\xfe\xfe\xfe\xff\x01\x51\x51\x51\xff\xb0\xb0\xb0\xff\x82\xb8\xb8\xb8\xff\x16\xb6\xb6\xb6\xff\xaf\xaf\xaf\xff\x90\x90\x90\xff\x68\x65\x65\xff\x5a\x55\x55\xff\x63\x5d\x5d\xff\x88\x81\x81\xff\x9a\x9a\x9a\xff\x9c\x9c\x9c\xff\x8e\x8d\x8d\xff\x90\x8d\x8d\xff\xdf\xd8\xd8\xff\xee\xe7\xe7\xff\xcc\xda\xd4\xff\x8a\xcb\xbc\xff\x5b\xb5\x9f\xff\x48\xa0\x8b\xff\x4b\x8e\x7e\xff\x6b\x84\x7d\xff\x98\x92\x91\xff\xa5\x9e\x9e\xff\xae\xab\xab\xff\xb6\xb6\xb6\xff\x84\xb7\xb7\xb7\xff\x84\xb8\xb8\xb8\xff\x95\x0c\x0c\x0c\xff\x83\xc3\x73\x00\xff\x19\x59\x59\x59\xff\xb7\xb7\xb7\xff\xb8\xb8\xb8\xff\xb8\xb8\xb8\xff\xb5\xb5\xb5\xff\xae\xae\xae\xff\x8f\x8e\x8e\xff\x39\x32\x32\xff\x5f\x58\x58\xff\x91\x8a\x8a\xff\x98\x92\x92\xff\x9d\x9c\x9c\xff\xa7\xa7\xa7\xff\xa7\xa7\xa7\xff\xaa\xaa\xaa\xff\xad\xac\xac\xff\x9a\x9a\x9a\xff\xbf\xbb\xbb\xff\xd9\xd3\xd3\xff\xe2\xda\xda\xff\xd7\xcf\xcf\xff\xca\xc3\xc3\xff\xbf\xb8\xb8\xff" \
-"\xb8\xb1\xb1\xff\xb4\xaf\xaf\xff\xb5\xb3\xb3\xff\x86\xb7\xb7\xb7\xff\x84\xb8\xb8\xb8\xff\x8b\x0c\x0c\x0c\xff\x00\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\x83\x0c\x0c\x0c\xff\x83\xc3\x73\x00\xff\x17\x5c\x5c\x5c\xff\xb8\xb8\xb8\xff\xb7\xb7\xb7\xff\xb1\xb1\xb1\xff\xa4\xa4\xa4\xff\xa8\xa8\xa8\xff\x71\x6e\x6e\xff\x4a\x42\x42\xff\x7f\x78\x78\xff\x91\x8a\x8a\xff\xa3\xa1\xa1\xff\xb8\xb8\xb8\xff\xb8\xb8\xb8\xff\xb7\xb7\xb7\xff\x8b\x89\x89\xff\xa1\x9e\x9e\xff\xb8\xb8\xb8\xff\xb8\xb8\xb8\xff\xab\xab\xab\xff\xb8\xb7\xb7\xff\xc1\xbe\xbe\xff\xc3\xc1\xc1\xff\xbd\xbb\xbb\xff\xb9\xb8\xb8\xff\x89\xb7\xb7\xb7\xff\x83\xb8\xb8\xb8\xff\x83\x0c\x0c\x0c\xff\x00\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x03\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\x0c\x0c\x0c\xff\x0c\x0c\x0c\xff\x83\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\xdf\xdf\xdf\xff\x83\x0c\x0c\x0c\xff\x83\xc3\x73\x00\xff\x12\x5c\x5c\x5c\xff\xb4\xb4\xb4\xff\xac\xac\xac\xff\x9f\x9f\x9f\xff\x9c\x9c\x9c\xff\xae\xae\xae\xff\xb3\xb3\xb3\xff\x84\x82\x82\xff\x7d\x7a\x7a\xff" \
-"\x98\x97\x97\xff\xb6\xb6\xb6\xff\xb8\xb8\xb8\xff\xb3\xb3\xb3\xff\x73\x71\x71\xff\x6a\x63\x63\xff\xaf\xae\xae\xff\xb8\xb8\xb8\xff\xb7\xb7\xb7\xff\x97\x95\x95\xff\x8e\xb7\xb7\xb7\xff\x83\xb6\xb6\xb6\xff\x83\x0c\x0c\x0c\xff\x83\xe0\xe0\xe0\xff\x03\xdf\xdf\xdf\xff\xdf\xdf\xdf\xff\x0c\x0c\x0c\xff\x0c\x0c\x0c\xff\x83\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\xdf\xdf\xdf\xff\x83\x0c\x0c\x0c\xff\x83\xe0\xb8\x7f\xff\x13\x58\x58\x58\xff\xa3\xa3\xa3\xff\x9c\x9c\x9c\xff\x9c\x9c\x9c\xff\xa2\xa2\xa2\xff\xb4\xb4\xb4\xff\xb8\xb8\xb8\xff\xb5\xb5\xb5\xff\xa4\xa4\xa4\xff\xa3\xa3\xa3\xff\xb6\xb6\xb6\xff\xa0\x9f\x9f\xff\x4f\x4a\x4a\xff\x56\x4e\x4e\xff\x95\x8f\x8f\xff\xb5\xb5\xb5\xff\xb8\xb8\xb8\xff\x8e\x8d\x8d\xff\x78\x72\x72\xff\xb6\xb5\xb5\xff\x8c\xb7\xb7\xb7\xff\x84\xb8\xb8\xb8\xff\x83\x0c\x0c\x0c\xff\x83\xe0\xe0\xe0\xff\x04\xdf\xdf\xdf\xff\xdf\xdf\xdf\xff\x0c\x0c\x0c\xff\x0c\x0c\x0c\xff\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\x83\x0c\x0c\x0c\xff\x17\xfe\xfe\xfe\xff\xfd\xfd\xfd\xff\xfd\xfd\xfd\xff\xfe" \
-"\xfe\xfe\xff\x50\x50\x50\xff\x9c\x9c\x9c\xff\x9c\x9c\x9c\xff\x9d\x9d\x9d\xff\xac\xac\xac\xff\xb8\xb8\xb8\xff\xb6\xb6\xb6\xff\xa9\xa9\xa9\xff\x9c\x9c\x9c\xff\xa4\xa4\xa4\xff\xb2\xb2\xb2\xff\x3b\x35\x35\xff\x58\x51\x51\xff\xa3\x9c\x9c\xff\x9a\x97\x97\xff\xb8\xb8\xb8\xff\xaf\xae\xae\xff\x47\x42\x42\xff\x86\x80\x80\xff\xb4\xb4\xb4\xff\x8c\xb7\xb7\xb7\xff\x84\xb8\xb8\xb8\xff\x83\x0c\x0c\x0c\xff\x00\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\x8b\x0c\x0c\x0c\xff\x83\xfe\xfe\xfe\xff\x13\x52\x52\x52\xff\x9f\x9f\x9f\xff\xa0\xa0\xa0\xff\xa9\xa9\xa9\xff\xb6\xb6\xb6\xff\xb7\xb7\xb7\xff\xac\xac\xac\xff\x9d\x9d\x9d\xff\x9c\x9c\x9c\xff\xa6\xa6\xa6\xff\xa6\xa6\xa6\xff\x38\x32\x32\xff\x72\x6a\x6a\xff\x86\x80\x80\xff\xaf\xaf\xaf\xff\xb7\xb7\xb7\xff\x5d\x5a\x5a\xff\x4d\x46\x46\xff\x9a\x93\x93\xff\xb4\xb4\xb4\xff\x8b\xb7\xb7\xb7\xff\x85\xb8\xb8\xb8\xff\x95\x0c\x0c\x0c\xff\x83\xfe\xfe\xfe\xff\x13\x5a\x5a\x5a\xff\xb3\xb3\xb3\xff\xb4\xb4\xb4\xff\xb7\xb7\xb7\xff\xb8\xb8\xb8\xff\xb5\xb5\xb5\xff\xa2\xa2\xa2" \
-"\xff\x9c\x9c\x9c\xff\x9d\x9d\x9d\xff\xad\xad\xad\xff\xb8\xb8\xb8\xff\x91\x8f\x8f\xff\x8e\x8b\x8b\xff\xad\xac\xac\xff\xb8\xb8\xb8\xff\x9a\x99\x99\xff\x33\x2c\x2c\xff\x84\x7d\x7d\xff\x9e\x99\x99\xff\xb6\xb6\xb6\xff\x8b\xb7\xb7\xb7\xff\x85\xb8\xb8\xb8\xff\x8b\x0c\x0c\x0c\xff\x00\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\x83\x0c\x0c\x0c\xff\x83\xc3\x73\x00\xff\x00\x5c\x5c\x5c\xff\x83\xb8\xb8\xb8\xff\x04\xb5\xb5\xb5\xff\xa3\xa3\xa3\xff\x9e\x9e\x9e\xff\xa7\xa7\xa7\xff\xb6\xb6\xb6\xff\x83\xb8\xb8\xb8\xff\x04\xb7\xb7\xb7\xff\x92\x90\x90\xff\x43\x3b\x3b\xff\x7b\x74\x74\xff\xa0\x9d\x9d\xff\x89\xb7\xb7\xb7\xff\x01\xb6\xb6\xb6\xff\xb7\xb7\xb7\xff\x86\xb8\xb8\xb8\xff\x83\x0c\x0c\x0c\xff\x00\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x03\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\x0c\x0c\x0c\xff\x0c\x0c\x0c\xff\x83\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\xdf\xdf\xdf\xff\x83\x0c\x0c\x0c\xff\x83\xc3\x73\x00\xff\x00\x5c\x5c\x5c\xff\x83\xb8\xb8\xb8\xff\x03\xb7\xb7\xb7\xff\xb3\xb3\xb3\xff\xb2\xb2\xb2\xff\xb7\xb7\xb7\xff" \
-"\x83\xb8\xb8\xb8\xff\x04\xb7\xb7\xb7\xff\xb7\xb7\xb7\xff\xb6\xb6\xb6\xff\x91\x8f\x8f\xff\xa2\xa0\xa0\xff\x8b\xb7\xb7\xb7\xff\x87\xb8\xb8\xb8\xff\x83\x0c\x0c\x0c\xff\x83\xe0\xe0\xe0\xff\x03\xdf\xdf\xdf\xff\xdf\xdf\xdf\xff\x0c\x0c\x0c\xff\x0c\x0c\x0c\xff\x83\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\xdf\xdf\xdf\xff\x83\x0c\x0c\x0c\xff\x83\xc3\x73\x00\xff\x00\x5c\x5c\x5c\xff\x89\xb8\xb8\xb8\xff\x01\xb7\xb7\xb7\xff\xb8\xb8\xb8\xff\x8f\xb7\xb7\xb7\xff\x88\xb8\xb8\xb8\xff\x83\x0c\x0c\x0c\xff\x83\xe0\xe0\xe0\xff\x04\xdf\xdf\xdf\xff\xdf\xdf\xdf\xff\x0c\x0c\x0c\xff\x0c\x0c\x0c\xff\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\xb1\x0c\x0c\x0c\xff\x00\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\xff\x0c\x0c\x0c\xff\x81\x0c\x0c\x0c\xff\x00\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\x83\x0c\x0c\x0c\xff\x83\xfe\xfe\xfe\xff\x00\x5c\x5c\x5c\xff\x85\xb8\xb8\xb8\xff\x00\xb7\xb7\xb7\xff\x83\xb6\xb6\xb6\xff\x8d\xb8\xb8\xb8\xff\x02\xb7\xb7\xb7\xff\xb7\xb7" \
-"\xb7\xff\xb8\xb8\xb8\xff\x82\xb7\xb7\xb7\xff\x85\xb8\xb8\xb8\xff\x83\x0c\x0c\x0c\xff\x00\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x03\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\x0c\x0c\x0c\xff\x0c\x0c\x0c\xff\x83\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\xdf\xdf\xdf\xff\x83\x0c\x0c\x0c\xff\x83\xfe\xfe\xfe\xff\x00\x5c\x5c\x5c\xff\x83\xb8\xb8\xb8\xff\x09\xb6\xb6\xb6\xff\xb2\xb2\xb2\xff\xae\xae\xae\xff\xa9\xa9\xa9\xff\xa6\xa6\xa6\xff\xa6\xa6\xa6\xff\xa8\xa8\xa8\xff\xab\xab\xab\xff\xb2\xb2\xb2\xff\xb6\xb6\xb6\xff\x89\xb8\xb8\xb8\xff\x86\xb7\xb7\xb7\xff\x85\xb8\xb8\xb8\xff\x83\x0c\x0c\x0c\xff\x83\xe0\xe0\xe0\xff\x03\xdf\xdf\xdf\xff\xdf\xdf\xdf\xff\x0c\x0c\x0c\xff\x0c\x0c\x0c\xff\x83\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\xdf\xdf\xdf\xff\x83\x0c\x0c\x0c\xff\x83\xe0\xb8\x7f\xff\x06\x5c\x5c\x5c\xff\xb8\xb8\xb8\xff\xb8\xb8\xb8\xff\xb7\xb7\xb7\xff\xb1\xb1\xb1\xff\xa8\xa8\xa8\xff\xa0\xa0\xa0\xff\x85\x9c\x9c\x9c\xff\x05\x9e\x9e\x9e\xff\xa4\xa4\xa4\xff\xb0\xb0\xb0\xff\xb9\xb9\xb9\xff\xba\xba\xba\xff\xb9\xb9\xb9\xff\x86\xb8\xb8\xb8\xff\x85\xb7\xb7" \
-"\xb7\xff\x85\xb8\xb8\xb8\xff\x83\x0c\x0c\x0c\xff\x83\xe0\xe0\xe0\xff\x04\xdf\xdf\xdf\xff\xdf\xdf\xdf\xff\x0c\x0c\x0c\xff\x0c\x0c\x0c\xff\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\x83\x0c\x0c\x0c\xff\x83\xc3\x73\x00\xff\x04\x5c\x5c\x5c\xff\xb8\xb8\xb8\xff\xb6\xb6\xb6\xff\xae\xae\xae\xff\xa1\xa1\xa1\xff\x87\x9c\x9c\x9c\xff\x09\x9d\x9d\x9d\xff\xa0\xa0\xa0\xff\xa3\xa3\xa3\xff\xa9\xa9\xa9\xff\x9c\x9b\x9c\xff\x8c\x8a\x8b\xff\x7f\x7e\x7e\xff\x8c\x8a\x8b\xff\xa1\xa1\xa1\xff\xb5\xb5\xb5\xff\x83\xb8\xb8\xb8\xff\x84\xb7\xb7\xb7\xff\x85\xb8\xb8\xb8\xff\x83\x0c\x0c\x0c\xff\x00\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\x8b\x0c\x0c\x0c\xff\x83\xc3\x73\x00\xff\x03\x5c\x5c\x5c\xff\xb7\xb7\xb7\xff\xac\xac\xac\xff\x9f\x9f\x9f\xff\x87\x9c\x9c\x9c\xff\x0e\x9d\x9d\x9d\xff\xa0\xa0\xa0\xff\x9f\x9f\x9f\xff\x6e\x6c\x6c\xff\x36\x31\x32\xff\x21\x1b\x1c\xff\x20\x1a\x1b\xff\x1f\x19\x1a\xff\x1e\x19\x1a\xff\x24\x1f\x20\xff\x42\x3e\x3f\xff\x84\x83\x83\xff\xb2\xb2\xb2\xff\xb8\xb8\xb8" \
-"\xff\xb8\xb8\xb8\xff\x84\xb7\xb7\xb7\xff\x85\xb8\xb8\xb8\xff\x95\x0c\x0c\x0c\xff\x83\xe0\xb8\x7f\xff\x02\x5c\x5c\x5c\xff\xb1\xb1\xb1\xff\xa0\xa0\xa0\xff\x88\x9c\x9c\x9c\xff\x0d\x9d\x9d\x9d\xff\x96\x96\x96\xff\x42\x3e\x3f\xff\x21\x1b\x1c\xff\x1e\x22\x20\xff\x16\x3e\x34\xff\x10\x4f\x41\xff\x0e\x53\x44\xff\x10\x41\x35\xff\x14\x1f\x1c\xff\x19\x14\x15\xff\x1e\x19\x1a\xff\x45\x41\x42\xff\xa2\xa1\xa1\xff\x85\xb7\xb7\xb7\xff\x85\xb8\xb8\xb8\xff\x8b\x0c\x0c\x0c\xff\x00\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x01\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\x83\x0c\x0c\x0c\xff\x83\xfe\xfe\xfe\xff\x01\x5a\x5a\x5a\xff\xa5\xa5\xa5\xff\x89\x9c\x9c\x9c\xff\x0e\x96\x96\x96\xff\x41\x3d\x3e\xff\x20\x1d\x1e\xff\x14\x4d\x3f\xff\x07\x98\x78\xff\x05\xaf\x8a\xff\x05\xbc\x94\xff\x05\xbb\x92\xff\x05\xba\x92\xff\x05\xa0\x7d\xff\x09\x62\x4d\xff\x10\x21\x1c\xff\x19\x14\x15\xff\x2f\x2a\x2b\xff\x99\x98\x99\xff\x84\xb7\xb7\xb7\xff\x85\xb8\xb8\xb8\xff\x83\x0c\x0c\x0c\xff\x00\x0d\x0d\x0d\xff\x82\xe0\xe0\xe0\xff\x02\xdf\xdf\xdf\xff\x0d\x0d\x0d\xff\x0c\x0c\x0c" \
-"\xff"};
-
-/* these are not the monkeys you are looking for */
-int monkeyo= 4;
-int monkeynv= 271;
-int monkeynf= 250;
-signed char monkeyv[271][3]= {
-{-71,21,98},{-63,12,88},{-57,7,74},{-82,-3,79},{-82,4,92},
-{-82,17,100},{-92,21,102},{-101,12,95},{-107,7,83},
-{-117,31,84},{-109,31,95},{-96,31,102},{-92,42,102},
-{-101,50,95},{-107,56,83},{-82,66,79},{-82,58,92},
-{-82,46,100},{-71,42,98},{-63,50,88},{-57,56,74},
-{-47,31,72},{-55,31,86},{-67,31,97},{-66,31,99},
-{-70,43,100},{-82,48,103},{-93,43,105},{-98,31,105},
-{-93,20,105},{-82,31,106},{-82,15,103},{-70,20,100},
-{-127,55,95},{-127,45,105},{-127,-87,94},{-127,-41,100},
-{-127,-24,102},{-127,-99,92},{-127,52,77},{-127,73,73},
-{-127,115,-70},{-127,72,-109},{-127,9,-106},{-127,-49,-45},
-{-101,-24,72},{-87,-56,73},{-82,-89,73},{-80,-114,68},
-{-85,-121,67},{-104,-124,71},{-127,-126,74},{-71,-18,68},
-{-46,-5,69},{-21,19,57},{-17,55,76},{-36,62,80},
-{-64,77,88},{-86,97,94},{-107,92,97},{-119,63,96},
-{-106,53,99},{-111,39,98},{-101,12,95},{-79,2,90},
-{-64,8,86},{-47,24,83},{-45,38,83},{-50,48,85},
-{-72,56,92},{-95,60,97},{-127,-98,94},{-113,-92,94},
-{-112,-107,91},{-119,-113,89},{-127,-114,88},{-127,-25,96},
-{-127,-18,95},{-114,-19,95},{-111,-29,96},{-116,-37,95},
-{-76,-6,86},{-48,7,80},{-34,26,77},{-32,48,84},
-{-39,53,93},{-71,70,102},{-87,82,107},{-101,79,109},
-{-114,55,108},{-111,-13,104},{-100,-57,91},{-95,-90,88},
-{-93,-105,85},{-97,-117,81},{-106,-119,81},{-127,-121,82},
-{-127,6,93},{-127,27,98},{-85,61,95},{-106,18,96},
-{-110,27,97},{-112,-88,94},{-117,-57,96},{-127,-57,96},
-{-127,-42,95},{-115,-35,100},{-110,-29,102},{-113,-17,100},
-{-122,-16,100},{-127,-26,106},{-121,-19,104},{-115,-20,104},
-{-113,-29,106},{-117,-32,103},{-127,-37,103},{-94,-40,71},
-{-106,-31,91},{-104,-40,91},{-97,-32,71},{-127,-112,88},
-{-121,-111,88},{-115,-105,91},{-115,-95,93},{-127,-100,84},
-{-115,-96,85},{-115,-104,82},{-121,-109,81},{-127,-110,81},
-{-105,28,100},{-103,20,99},{-84,55,97},{-92,54,99},
-{-73,51,99},{-55,45,89},{-52,37,88},{-53,25,87},
-{-66,13,92},{-79,8,95},{-98,14,100},{-104,38,100},
-{-100,48,100},{-97,46,97},{-102,38,97},{-96,16,97},
-{-79,11,93},{-68,15,90},{-57,27,86},{-56,36,86},
-{-59,43,87},{-74,50,96},{-91,51,98},{-84,52,96},
-{-101,22,96},{-102,29,96},{-113,59,78},{-102,85,79},
-{-84,88,76},{-65,71,71},{-40,58,63},{-25,52,59},
-{-28,21,48},{-50,0,53},{-71,-12,60},{-127,115,37},
-{-127,126,-10},{-127,-25,-86},{-127,-59,24},{-127,-125,59},
-{-127,-103,44},{-127,-73,41},{-127,-62,36},{-18,30,7},
-{-17,41,-6},{-28,34,-56},{-68,56,-90},{-33,-6,9},
-{-51,-16,-21},{-45,-1,-55},{-84,7,-85},{-97,-45,52},
-{-104,-53,33},{-90,-91,49},{-95,-64,50},{-85,-117,51},
-{-109,-97,47},{-111,-69,46},{-106,-121,56},{-99,-36,55},
-{-100,-29,60},{-101,-22,64},{-100,-50,21},{-89,-40,-34},
-{-83,-19,-69},{-69,111,-49},{-69,119,-9},{-69,109,30},
-{-68,67,55},{-34,52,43},{-46,58,36},{-45,90,7},
-{-25,72,16},{-25,79,-15},{-45,96,-25},{-45,87,-57},
-{-25,69,-46},{-48,42,-75},{-65,3,-70},{-22,42,-26},
-{-75,-22,19},{-72,-25,-27},{-13,52,-30},{-28,-18,-16},
-{6,-13,-42},{37,7,-55},{46,41,-54},{31,65,-54},
-{4,61,-40},{3,53,-37},{25,56,-50},{35,37,-52},
-{28,10,-52},{5,-5,-39},{-21,-9,-17},{-9,46,-28},
-{-6,39,-37},{-14,-3,-27},{6,0,-47},{25,12,-57},
-{31,32,-57},{23,46,-56},{4,44,-46},{-19,37,-27},
-{-20,22,-35},{-30,12,-35},{-22,11,-35},{-19,2,-35},
-{-23,-2,-35},{-34,0,-9},{-35,-3,-22},{-35,5,-24},
-{-25,26,-27},{-13,31,-34},{-13,30,-41},{-23,-2,-41},
-{-18,2,-41},{-21,10,-41},{-29,12,-41},{-19,22,-41},
-{6,42,-53},{25,44,-62},{34,31,-63},{28,11,-62},
-{7,0,-54},{-14,-2,-34},{-5,37,-44},{-13,14,-42},
-{-7,8,-43},{1,16,-47},{-4,22,-45},{3,30,-48},
-{8,24,-49},{15,27,-50},{12,35,-50},{4,56,-62},
-{33,60,-70},{48,38,-64},{41,7,-68},{6,-11,-63},
-{-26,-16,-42},{-17,49,-49},
-};
-
-signed char monkeyf[250][4]= {
-{27,4,5,26}, {25,4,5,24}, {3,6,5,4}, {1,6,5,2}, {5,6,7,4},
-{3,6,7,2}, {5,8,7,6}, {3,8,7,4}, {7,8,9,6},
-{5,8,9,4}, {7,10,9,8}, {5,10,9,6}, {9,10,11,8},
-{7,10,11,6}, {9,12,11,10}, {7,12,11,8}, {11,6,13,12},
-{5,4,13,12}, {3,-2,13,12}, {-3,-4,13,12}, {-5,-10,13,12},
-{-11,-12,14,12}, {-13,-18,14,13}, {-19,4,5,13}, {10,12,4,4},
-{10,11,9,9}, {8,7,9,9}, {7,5,6,6}, {6,3,4,4},
-{5,1,2,2}, {4,-1,0,0}, {3,-3,-2,-2}, {22,67,68,23},
-{20,65,66,21}, {18,63,64,19}, {16,61,62,17}, {14,59,60,15},
-{12,19,48,57}, {18,19,48,47}, {18,19,48,47}, {18,19,48,47},
-{18,19,48,47}, {18,19,48,47}, {18,19,48,47}, {18,19,48,47},
-{18,19,48,47}, {18,-9,-8,47}, {18,27,45,46}, {26,55,43,44},
-{24,41,42,54}, {22,39,40,23}, {20,37,38,21}, {18,35,36,19},
-{16,33,34,17}, {14,31,32,15}, {12,39,30,13}, {11,48,45,38},
-{8,36,-19,9}, {8,-20,44,47}, {42,45,46,43}, {18,19,40,39},
-{16,17,38,37}, {14,15,36,35}, {32,44,43,33}, {12,33,32,42},
-{19,44,43,42}, {40,41,42,-27}, {8,9,39,-28}, {15,43,42,16},
-{13,43,42,14}, {11,43,42,12}, {9,-30,42,10}, {37,12,38,-32},
-{-33,37,45,46}, {-33,40,41,39}, {38,40,41,37}, {36,40,41,35},
-{34,40,41,33}, {36,39,38,37}, {35,40,39,38}, {1,2,14,21},
-{1,2,40,13}, {1,2,40,39}, {1,24,12,39}, {-34,36,38,11},
-{35,38,36,37}, {-37,8,35,37}, {-11,-12,-45,40}, {-11,-12,39,38},
-{-11,-12,37,36}, {-11,-12,35,34}, {33,34,40,41}, {33,34,38,39},
-{33,34,36,37}, {33,-52,34,35}, {33,37,36,34}, {33,35,34,34},
-{8,7,37,36}, {-32,7,35,46}, {-34,-33,45,46}, {4,-33,43,34},
-{-34,-33,41,42}, {-34,-33,39,40}, {-34,-33,37,38}, {-34,-33,35,36},
-{-34,-33,33,34}, {-34,-33,31,32}, {-34,-4,28,30}, {-5,-34,28,27},
-{-35,-44,36,27}, {26,35,36,45}, {24,25,44,45}, {25,23,44,42},
-{25,24,41,40}, {25,24,39,38}, {25,24,37,36}, {25,24,35,34},
-{25,24,33,32}, {25,24,31,30}, {15,24,29,38}, {25,24,27,26},
-{23,12,37,26}, {11,12,35,36}, {-86,-59,36,-80}, {-60,-61,36,35},
-{-62,-63,36,35}, {-64,-65,36,35}, {-66,-67,36,35}, {-68,-69,36,35},
-{-70,-71,36,35}, {-72,-73,36,35}, {-74,-75,36,35}, {42,43,53,58},
-{40,41,57,56}, {38,39,55,57}, {-81,-80,37,56}, {-83,-82,55,52},
-{-85,-84,51,49}, {-87,-86,48,49}, {47,50,51,48}, {46,48,51,49},
-{43,46,49,44}, {-92,-91,45,42}, {-23,49,50,-20}, {-94,40,48,-24},
-{-96,-22,48,49}, {-97,48,21,-90}, {-100,36,50,23}, {22,49,48,-100},
-{-101,47,46,22}, {21,45,35,25}, {33,34,44,41}, {13,14,28,24},
-{-107,26,30,-106}, {14,46,45,15}, {14,44,43,-110}, {-111,42,23,-110},
-{6,7,45,46}, {45,44,47,46}, {45,46,47,48}, {47,46,49,48},
-{17,49,47,48}, {17,36,46,48}, {35,36,44,45}, {35,36,40,43},
-{35,36,38,39}, {-4,-3,37,35}, {-123,34,33,1}, {-9,-8,-7,-6},
-{-10,-7,32,-125}, {-127,-11,-126,-126}, {-7,-6,5,31}, {4,5,33,30},
-{4,39,33,32}, {4,35,32,38}, {20,21,39,38}, {4,37,38,5},
-{-11,-10,36,3}, {-11,15,14,35}, {13,16,34,34}, {-13,14,13,13},
-{-3,1,30,29}, {-3,28,29,1}, {-2,31,28,-1}, {12,13,27,30},
-{-2,26,12,12}, {35,29,42,36}, {34,35,36,33}, {32,35,36,31},
-{30,35,36,29}, {28,35,36,27}, {26,35,36,25}, {34,39,38,35},
-{32,39,38,33}, {30,39,38,31}, {28,39,38,29}, {26,39,38,27},
-{25,31,32,38}, {-18,-17,45,44}, {-18,17,28,44}, {-24,-20,42,-23},
-{11,35,27,14}, {25,28,39,41}, {37,41,40,38}, {34,40,36,35},
-{32,40,39,33}, {30,39,31,40}, {21,29,39,22}, {-31,37,28,4},
-{-32,33,35,36}, {32,33,34,34}, {18,35,36,48}, {34,25,40,35},
-{24,25,38,39}, {24,25,36,37}, {24,25,34,35}, {24,25,32,33},
-{24,13,41,31}, {17,11,41,35}, {15,16,34,35}, {13,14,34,35},
-{11,12,34,35}, {9,10,34,35}, {7,8,34,35}, {26,25,37,36},
-{35,36,37,38}, {37,36,39,38}, {37,38,39,40}, {25,31,36,39},
-{18,34,35,30}, {17,22,30,33}, {19,29,21,20}, {16,26,29,17},
-{24,29,28,25}, {22,31,28,23}, {20,31,30,21}, {18,31,30,19},
-{16,30,17,17}, {-21,-22,35,34}, {-21,-22,33,32}, {-21,-22,31,30},
-{-21,-22,29,28}, {-21,-22,27,26}, {-28,-22,25,31}, {24,28,29,30},
-{23,24,26,27}, {23,24,25,25}, {-69,-35,-32,27}, {-70,26,25,-66},
-{-68,-67,24,-33},
-};
diff --git a/source/blender/src/cre/license_key.c b/source/blender/src/cre/license_key.c
deleted file mode 100644
index 4daa7628f53..00000000000
--- a/source/blender/src/cre/license_key.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include "license_key.h"
-#include "keyed_functions.h"
-#include "BKE_utildefines.h"
-#include "BIF_screen.h" // splash
-#include "BIF_toolbox.h"
-#include <stdio.h>
-#include <string.h>
-#include "BLO_readfile.h"
-//#include "BLO_keyStore.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-int LICENSE_KEY_VALID = TRUE;
-int I_AM_PUBLISHER = TRUE;
-
-// Python stuff
-
-#include "Python.h"
-#include "marshal.h"
-#include "compile.h" /* to give us PyCodeObject */
-#include "eval.h" /* prototype for PyEval_EvalCode */
-
-#include "BPY_extern.h"
-#include "IMB_imbuf.h"
-
-Fptr g_functab[PYKEY_TABLEN];
-Fptr g_ptrtab[PYKEY_TABLEN];
-
-static int g_seed[3] = PYKEY_SEED;
-static PyObject *g_module_self;
-static PyObject *g_main;
-
-
-// end Python stuff
-
-// **************** PYTHON STUFF **************************
-/* ----------------------------------------------------- */
-/* this is the dummy functions to demonstrate */
-
-int sticky_shoes(void *vp)
-{
-#ifndef NDEBUG
- printf("feature not enabled: Buy our Key NOW!\n");
-#endif
- return 0;
-}
-
-/*
-int key_func1(void *vp) {
- printf("function 1 called\n");
-}
-
-*/
-int key_return_true(void *vp) {
-#ifndef NDEBUG
- printf("function 2 called (return true)\n");
-#endif
- return 1;
-}
-
-/* ----------------------------------------------------- */
-
-/* Declarations for objects of type Fplist */
-
-
-#ifndef NDEBUG
-void feature1(void)
-{
- Fptr f;
-
- printf("feature 2 called\n");
- f = g_ptrtab[KEY_FUNC2];
- if (f) f(0);
-}
-
-void feature2(void)
-{
- Fptr f;
-
- printf("feature 3 called\n");
- f = g_ptrtab[KEY_FUNC3];
- if (f) f(0);
-}
-
-#endif
-
-
-/* Initialization function for the module (*must* be called initprot) */
-
-static void init_ftable(void) // initializes functiontable
-{
- int i;
-
- g_functab[0] = &key_func1;
-
- for (i = 1; i < PYKEY_TABLEN; i++)
- {
- g_functab[i] = &sticky_shoes;
- }
-
- // for debugging perposes
- /*
- for (i = 0; i < PYKEY_TABLEN; i++)
- {
- g_functab[i] = (Fptr *) (i + 100);
- }
- */
-}
-
-
-static void init_ptable(void) // initializes functiontable
-{
- int i;
-
- for (i = 0; i < PYKEY_TABLEN; i++)
- {
- g_ptrtab[i] = &sticky_shoes;
- }
-}
-
-
-#ifdef NDEBUG
-static void print_ptable(void)
-{
- int i;
-
- for (i = 0; i < PYKEY_TABLEN; i++)
- {
- printf ("index[%02d] = %08x\n", i, g_ptrtab[i]);
- }
-}
-#endif
-
-static void insertname(PyObject *m,PyObject *p, char *name)
-{
-}
-
-/* initialisation */
-static void initprot()
-{
- init_ftable(); // malloc
- init_ptable(); // malloc
-}
-
-// ******************************* KEY STUFF *********************
-
-void create_key_name(char * keyname)
-{
-}
-
-void checkhome()
-{
- initprot(); // initialize module and function tables
-
-}
-
-void SHOW_LICENSE_KEY(void)
-{
-}
-
-void loadKeyboard(char * name)
-{
-}
diff --git a/source/blender/src/drawaction.c b/source/blender/src/drawaction.c
deleted file mode 100644
index 58dfdd89df2..00000000000
--- a/source/blender/src/drawaction.c
+++ /dev/null
@@ -1,1294 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * Drawing routines for the Action window type
- */
-
-/* System includes ----------------------------------------------------- */
-
-#include <math.h>
-#include <stdlib.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "BMF_Api.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-/* Types --------------------------------------------------------------- */
-#include "DNA_listBase.h"
-#include "DNA_action_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_ipo_types.h"
-#include "DNA_object_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_space_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_key_types.h"
-
-#include "BKE_action.h"
-#include "BKE_depsgraph.h"
-#include "BKE_ipo.h"
-#include "BKE_key.h"
-#include "BKE_global.h"
-#include "BKE_utildefines.h"
-
-/* Everything from source (BIF, BDR, BSE) ------------------------------ */
-
-#include "BIF_editaction.h"
-#include "BIF_editkey.h"
-#include "BIF_editnla.h"
-#include "BIF_interface.h"
-#include "BIF_interface_icons.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_mywindow.h"
-#include "BIF_space.h"
-
-#include "BDR_drawaction.h"
-#include "BDR_editcurve.h"
-
-#include "BSE_drawnla.h"
-#include "BSE_drawipo.h"
-#include "BSE_editaction_types.h"
-#include "BSE_editipo.h"
-#include "BSE_time.h"
-#include "BSE_view.h"
-
-/* 'old' stuff": defines and types, and own include -------------------- */
-
-#include "blendef.h"
-#include "mydevice.h"
-
-/********************************** Slider Stuff **************************** */
-
-/* sliders for shapekeys */
-static void meshactionbuts(SpaceAction *saction, Object *ob, Key *key)
-{
- int i;
- char str[64];
- float x, y;
- uiBlock *block;
- uiBut *but;
-
-#define XIC 20
-#define YIC 20
-
- /* lets make the rvk sliders */
-
- /* reset the damn myortho2 or the sliders won't draw/redraw
- * correctly *grumble*
- */
- mywinset(curarea->win);
- myortho2(-0.375, curarea->winx-0.375, G.v2d->cur.ymin, G.v2d->cur.ymax);
-
- sprintf(str, "actionbuttonswin %d", curarea->win);
- block= uiNewBlock (&curarea->uiblocks, str, UI_EMBOSS, UI_HELV, curarea->win);
-
- x = NAMEWIDTH + 1;
- y = 0.0f;
-
- /* make the little 'open the sliders' widget */
- // should eventually be removed
- BIF_ThemeColor(TH_FACE); // this slot was open... (???... Aligorith)
- glRects(2, y + 2*CHANNELHEIGHT - 2, ACTWIDTH - 2, y + CHANNELHEIGHT + 2);
- glColor3ub(0, 0, 0);
- glRasterPos2f(4, y + CHANNELHEIGHT + 6);
- BMF_DrawString(G.font, "Sliders");
-
- uiBlockSetEmboss(block, UI_EMBOSSN);
-
- if (!(G.saction->flag & SACTION_SLIDERS)) {
- ACTWIDTH = NAMEWIDTH;
- but=uiDefIconButBitS(block, TOG, SACTION_SLIDERS, B_REDR,
- ICON_DISCLOSURE_TRI_RIGHT,
- NAMEWIDTH - XIC - 5, y + CHANNELHEIGHT,
- XIC,YIC-2,
- &(G.saction->flag), 0, 0, 0, 0,
- "Show action window sliders");
- /* no hilite, the winmatrix is not correct later on... */
- uiButSetFlag(but, UI_NO_HILITE);
-
- }
- else {
- but= uiDefIconButBitS(block, TOG, SACTION_SLIDERS, B_REDR,
- ICON_DISCLOSURE_TRI_DOWN,
- NAMEWIDTH - XIC - 5, y + CHANNELHEIGHT,
- XIC,YIC-2,
- &(G.saction->flag), 0, 0, 0, 0,
- "Hide action window sliders");
- /* no hilite, the winmatrix is not correct later on... */
- uiButSetFlag(but, UI_NO_HILITE);
-
- ACTWIDTH = NAMEWIDTH + SLIDERWIDTH;
-
- /* sliders are open so draw them */
- BIF_ThemeColor(TH_FACE);
-
- glRects(NAMEWIDTH, 0, NAMEWIDTH+SLIDERWIDTH, curarea->winy);
- uiBlockSetEmboss(block, UI_EMBOSS);
- for (i=1; i < key->totkey; i++) {
- make_rvk_slider(block, ob, i,
- x, y, SLIDERWIDTH-2, CHANNELHEIGHT-1, "Slider to control Shape Keys");
-
- y-=CHANNELHEIGHT+CHANNELSKIP;
-
- /* see sliderval array in editkey.c */
- if(i >= 255) break;
- }
- }
- uiDrawBlock(block);
-
-}
-
-static void icu_slider_func(void *voidicu, void *voidignore)
-{
- /* the callback for the icu sliders ... copies the
- * value from the icu->curval into a bezier at the
- * right frame on the right ipo curve (creating both the
- * ipo curve and the bezier if needed).
- */
- IpoCurve *icu= voidicu;
- BezTriple *bezt=NULL;
- float cfra, icuval;
-
- cfra = frame_to_float(CFRA);
- if (G.saction->pin==0 && OBACT)
- cfra= get_action_frame(OBACT, cfra);
-
- /* if the ipocurve exists, try to get a bezier
- * for this frame
- */
- bezt = get_bezt_icu_time(icu, &cfra, &icuval);
-
- /* create the bezier triple if one doesn't exist,
- * otherwise modify it's value
- */
- if (bezt == NULL) {
- insert_vert_icu(icu, cfra, icu->curval, 0);
- }
- else {
- bezt->vec[1][1] = icu->curval;
- }
-
- /* make sure the Ipo's are properly processed and
- * redraw as necessary
- */
- sort_time_ipocurve(icu);
- testhandles_ipocurve(icu);
-
- /* nla-update (in case this affects anything) */
- synchronize_action_strips();
-
- /* do redraw pushes, and also the depsgraph flushes */
- if (OBACT->pose || ob_get_key(OBACT))
- DAG_object_flush_update(G.scene, OBACT, OB_RECALC);
- else
- DAG_object_flush_update(G.scene, OBACT, OB_RECALC_OB);
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWIPO, 0);
- allspace(REMAKEIPO, 0);
- allqueue(REDRAWBUTSALL, 0);
-}
-
-static void make_icu_slider(uiBlock *block, IpoCurve *icu,
- int x, int y, int w, int h, char *tip)
-{
- /* create a slider for the ipo-curve*/
- uiBut *but;
-
- if(icu==NULL) return;
-
- if (IS_EQ(icu->slide_max, icu->slide_min)) {
- if (IS_EQ(icu->ymax, icu->ymin)) {
- if (ELEM(icu->blocktype, ID_CO, ID_KE)) {
- /* hack for constraints and shapekeys (and maybe a few others) */
- icu->slide_min= 0.0;
- icu->slide_max= 1.0;
- }
- else {
- icu->slide_min= -100;
- icu->slide_max= 100;
- }
- }
- else {
- icu->slide_min= icu->ymin;
- icu->slide_max= icu->ymax;
- }
- }
- if (icu->slide_min >= icu->slide_max) {
- SWAP(float, icu->slide_min, icu->slide_max);
- }
-
- but=uiDefButF(block, NUMSLI, REDRAWVIEW3D, "",
- x, y , w, h,
- &(icu->curval), icu->slide_min, icu->slide_max,
- 10, 2, tip);
-
- uiButSetFunc(but, icu_slider_func, icu, NULL);
-
- // no hilite, the winmatrix is not correct later on...
- uiButSetFlag(but, UI_NO_HILITE);
-}
-
-/* sliders for ipo-curves of active action-channel */
-static void action_icu_buts(SpaceAction *saction)
-{
- bAction *act= saction->action;
- bActionChannel *achan;
- bConstraintChannel *conchan;
- IpoCurve *icu;
- char str[64];
- float x, y;
- uiBlock *block;
-
- /* lets make the action sliders */
-
- /* reset the damn myortho2 or the sliders won't draw/redraw
- * correctly *grumble*
- */
- mywinset(curarea->win);
- myortho2(-0.375, curarea->winx-0.375, G.v2d->cur.ymin, G.v2d->cur.ymax);
-
- sprintf(str, "actionbuttonswin %d", curarea->win);
- block= uiNewBlock (&curarea->uiblocks, str,
- UI_EMBOSS, UI_HELV, curarea->win);
-
- x = NAMEWIDTH + 1;
- y = 0.0f;
-
- uiBlockSetEmboss(block, UI_EMBOSSN);
-
- if (G.saction->flag & SACTION_SLIDERS) {
- /* sliders are open so draw them */
-
- /* draw backdrop first */
- BIF_ThemeColor(TH_FACE); // change this color... it's ugly
- glRects(NAMEWIDTH, G.v2d->cur.ymin, NAMEWIDTH+SLIDERWIDTH, G.v2d->cur.ymax);
-
- uiBlockSetEmboss(block, UI_EMBOSS);
- for (achan=act->chanbase.first; achan; achan= achan->next) {
- if(VISIBLE_ACHAN(achan)) {
- y-=CHANNELHEIGHT+CHANNELSKIP;
-
- if (EXPANDED_ACHAN(achan)) {
- if (achan->ipo) {
- y-=CHANNELHEIGHT+CHANNELSKIP;
-
- if (FILTER_IPO_ACHAN(achan)) {
- for (icu= achan->ipo->curve.first; icu; icu=icu->next) {
- if (achan->flag & ACHAN_HILIGHTED) {
- make_icu_slider(block, icu,
- x, y, SLIDERWIDTH-2, CHANNELHEIGHT-2,
- "Slider to control current value of IPO-Curve");
- }
-
- y-=CHANNELHEIGHT+CHANNELSKIP;
- }
- }
- }
-
- if (achan->constraintChannels.first) {
- y-=CHANNELHEIGHT+CHANNELSKIP;
-
- if (FILTER_CON_ACHAN(achan)) {
- for (conchan= achan->constraintChannels.first; conchan; conchan=conchan->next) {
- if ((achan->flag & ACHAN_HILIGHTED) && EDITABLE_CONCHAN(conchan)) {
- icu= (IpoCurve *)conchan->ipo->curve.first;
- make_icu_slider(block, icu,
- x, y, SLIDERWIDTH-2, CHANNELHEIGHT-2,
- "Slider to control current value of Constraint Channel");
- }
-
- y-=CHANNELHEIGHT+CHANNELSKIP;
- }
- }
- }
- }
- }
- }
- }
- uiDrawBlock(block);
-}
-
-/********************************** Current Frame **************************** */
-
-void draw_cfra_action (void)
-{
- Object *ob;
- float vec[2];
-
- /* Draw a light green line to indicate current frame */
- vec[0]= (G.scene->r.cfra);
- vec[0]*= G.scene->r.framelen;
-
- vec[1]= G.v2d->cur.ymin;
- BIF_ThemeColor(TH_CFRAME);
- glLineWidth(2.0);
-
- glBegin(GL_LINE_STRIP);
- glVertex2fv(vec);
- vec[1]= G.v2d->cur.ymax;
- glVertex2fv(vec);
- glEnd();
-
- /* Draw dark green line if slow-parenting/time-offset is enabled */
- ob= (G.scene->basact) ? (G.scene->basact->object) : 0;
- if ((ob) && (ob->sf!=0.0) && (ob->ipoflag & OB_OFFS_OB)) {
- vec[0]-= ob->sf;
-
- BIF_ThemeColorShade(TH_CFRAME, -30);
-
- glBegin(GL_LINE_STRIP);
- glVertex2fv(vec);
- vec[1]= G.v2d->cur.ymin;
- glVertex2fv(vec);
- glEnd();
- }
-
- glLineWidth(1.0);
-}
-
-/********************************** Left-Hand Panel + Generics **************************** */
-
-/* left hand part */
-static void draw_channel_names(void)
-{
- ListBase act_data = {NULL, NULL};
- bActListElem *ale;
- int filter;
- void *data;
- short datatype;
- short ofsx = 0, ofsy = 0;
- float x= 0.0f, y= 0.0f;
-
- /* determine what type of data we are operating on */
- data = get_action_context(&datatype);
- if (data == NULL) return;
-
- /* Clip to the scrollable area */
- if(curarea->winx>SCROLLB+10 && curarea->winy>SCROLLH+10) {
- if(G.v2d->scroll) {
- ofsx= curarea->winrct.xmin;
- ofsy= curarea->winrct.ymin;
- glViewport(ofsx, ofsy+G.v2d->mask.ymin, NAMEWIDTH,
- (ofsy+G.v2d->mask.ymax) -
- (ofsy+G.v2d->mask.ymin));
- glScissor(ofsx, ofsy+G.v2d->mask.ymin, NAMEWIDTH,
- (ofsy+G.v2d->mask.ymax) -
- (ofsy+G.v2d->mask.ymin));
- }
- }
-
- /* prepare scaling for LHS panel */
- myortho2(0, NAMEWIDTH, G.v2d->cur.ymin, G.v2d->cur.ymax);
-
- /* set default color back to black */
- glColor3ub(0x00, 0x00, 0x00);
-
- /* build list of channels to draw */
- filter= (ACTFILTER_FORDRAWING|ACTFILTER_VISIBLE|ACTFILTER_CHANNELS);
- actdata_filter(&act_data, filter, data, datatype);
-
- /* loop through channels, and set up drawing depending on their type */
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
- for (ale= act_data.first; ale; ale= ale->next) {
- short indent= 0, offset= 0, sel= 0;
- int expand= -1, protect = -1, special= -1, mute = -1;
- char name[32];
-
- /* determine what needs to be drawn */
- switch (ale->type) {
- case ACTTYPE_ACHAN: /* action channel */
- {
- bActionChannel *achan= (bActionChannel *)ale->data;
-
- indent = 0;
- special = -1;
-
- if (EXPANDED_ACHAN(achan))
- expand = ICON_TRIA_DOWN;
- else
- expand = ICON_TRIA_RIGHT;
-
- if (EDITABLE_ACHAN(achan))
- protect = ICON_UNLOCKED;
- else
- protect = ICON_LOCKED;
-
- if (achan->ipo) {
- if (achan->ipo->muteipo)
- mute = ICON_MUTE_IPO_ON;
- else
- mute = ICON_MUTE_IPO_OFF;
- }
-
- sel = SEL_ACHAN(achan);
- sprintf(name, achan->name);
- }
- break;
- case ACTTYPE_CONCHAN: /* constraint channel */
- {
- bConstraintChannel *conchan = (bConstraintChannel *)ale->data;
-
- indent = 2;
-
- if (EDITABLE_CONCHAN(conchan))
- protect = ICON_UNLOCKED;
- else
- protect = ICON_LOCKED;
-
- if (conchan->ipo) {
- if (conchan->ipo->muteipo)
- mute = ICON_MUTE_IPO_ON;
- else
- mute = ICON_MUTE_IPO_OFF;
- }
-
- sel = SEL_CONCHAN(conchan);
- sprintf(name, conchan->name);
- }
- break;
- case ACTTYPE_ICU: /* ipo-curve channel */
- {
- IpoCurve *icu = (IpoCurve *)ale->data;
-
- indent = 2;
- protect = -1; // for now, until this can be supported by others
-
- if (icu->flag & IPO_MUTE)
- mute = ICON_MUTE_IPO_ON;
- else
- mute = ICON_MUTE_IPO_OFF;
-
- sel = SEL_ICU(icu);
- if (G.saction->pin)
- sprintf(name, getname_ipocurve(icu, NULL));
- else
- sprintf(name, getname_ipocurve(icu, OBACT));
- }
- break;
- case ACTTYPE_SHAPEKEY: /* shapekey channel */
- {
- KeyBlock *kb = (KeyBlock *)ale->data;
-
- indent = 0;
- special = -1;
-
- if (kb->name[0] == '\0')
- sprintf(name, "Key %d", ale->index);
- else
- sprintf(name, kb->name);
- }
- break;
- case ACTTYPE_FILLIPO: /* ipo expand widget */
- {
- bActionChannel *achan = (bActionChannel *)ale->data;
-
- indent = 1;
- special = geticon_ipo_blocktype(achan->ipo->blocktype);
-
- if (FILTER_IPO_ACHAN(achan))
- expand = ICON_TRIA_DOWN;
- else
- expand = ICON_TRIA_RIGHT;
-
- sel = SEL_ACHAN(achan);
- sprintf(name, "IPO Curves");
- }
- break;
- case ACTTYPE_FILLCON: /* constraint expand widget */
- {
- bActionChannel *achan = (bActionChannel *)ale->data;
-
- indent = 1;
- special = ICON_CONSTRAINT;
-
- if (FILTER_CON_ACHAN(achan))
- expand = ICON_TRIA_DOWN;
- else
- expand = ICON_TRIA_RIGHT;
-
- sel = SEL_ACHAN(achan);
- sprintf(name, "Constraint");
- }
- break;
- }
-
- /* now, start drawing based on this information */
- /* draw backing strip behind channel name */
- BIF_ThemeColorShade(TH_HEADER, ((indent==0)?20: (indent==1)?-20: -40));
- offset = 7 * indent;
- glRectf(x+offset, y-CHANNELHEIGHT/2, (float)NAMEWIDTH, y+CHANNELHEIGHT/2);
-
- /* draw expand/collapse triangle */
- if (expand > 0) {
- BIF_icon_draw(x+offset, y-CHANNELHEIGHT/2, expand);
- offset += 17;
- }
-
- /* draw special icon indicating type of ipo-blocktype?
- * only for expand widgets for Ipo and Constraint Channels
- */
- if (special > 0) {
- offset = 24;
- BIF_icon_draw(x+offset, y-CHANNELHEIGHT/2, special);
- offset += 17;
- }
-
- /* draw name */
- if (sel)
- BIF_ThemeColor(TH_TEXT_HI);
- else
- BIF_ThemeColor(TH_TEXT);
- offset += 3;
- glRasterPos2f(x+offset, y-4);
- BMF_DrawString(G.font, name);
-
- /* reset offset - for RHS of panel */
- offset = 0;
-
- /* draw protect 'lock' */
- if (protect > 0) {
- offset = 16;
- BIF_icon_draw(NAMEWIDTH-offset, y-CHANNELHEIGHT/2, protect);
- }
-
- /* draw mute 'eye' */
- if (mute > 0) {
- offset += 16;
- BIF_icon_draw(NAMEWIDTH-offset, y-CHANNELHEIGHT/2, mute);
- }
-
- /* adjust y-position for next one */
- y-=CHANNELHEIGHT+CHANNELSKIP;
- }
-
- /* free tempolary channels */
- BLI_freelistN(&act_data);
-
- /* re-adjust view matrices for correct scaling */
- myortho2(0, NAMEWIDTH, 0, (ofsy+G.v2d->mask.ymax) - (ofsy+G.v2d->mask.ymin)); // Scaling
-}
-
-/* sets or clears hidden flags */
-void check_action_context(SpaceAction *saction)
-{
- bActionChannel *achan;
-
- if (saction->action==NULL) return;
-
- for (achan=saction->action->chanbase.first; achan; achan=achan->next)
- achan->flag &= ~ACHAN_HIDDEN;
-
- if ((saction->pin==0) && ((saction->flag & SACTION_NOHIDE)==0) && (OBACT)) {
- Object *ob= OBACT;
- bPoseChannel *pchan;
- bArmature *arm= ob->data;
-
- for (achan=saction->action->chanbase.first; achan; achan=achan->next) {
- pchan= get_pose_channel(ob->pose, achan->name);
- if (pchan) {
- if ((pchan->bone->layer & arm->layer)==0)
- achan->flag |= ACHAN_HIDDEN;
- else if (pchan->bone->flag & BONE_HIDDEN_P)
- achan->flag |= ACHAN_HIDDEN;
- }
- }
- }
-}
-
-static void draw_channel_strips(void)
-{
- ListBase act_data = {NULL, NULL};
- bActListElem *ale;
- int filter;
- void *data;
- short datatype;
-
- rcti scr_rct;
- gla2DDrawInfo *di;
- float y, sta, end;
- int act_start, act_end, dummy;
- char col1[3], col2[3];
-
- BIF_GetThemeColor3ubv(TH_SHADE2, col2);
- BIF_GetThemeColor3ubv(TH_HILITE, col1);
-
- /* get editor data */
- data= get_action_context(&datatype);
- if (data == NULL) return;
-
- scr_rct.xmin= G.saction->area->winrct.xmin + G.saction->v2d.mask.xmin;
- scr_rct.ymin= G.saction->area->winrct.ymin + G.saction->v2d.mask.ymin;
- scr_rct.xmax= G.saction->area->winrct.xmin + G.saction->v2d.hor.xmax;
- scr_rct.ymax= G.saction->area->winrct.ymin + G.saction->v2d.mask.ymax;
- di= glaBegin2DDraw(&scr_rct, &G.v2d->cur);
-
- /* if in NLA there's a strip active, map the view */
- if (datatype == ACTCONT_ACTION) {
- if (NLA_ACTION_SCALED)
- map_active_strip(di, OBACT, 0);
-
- /* start and end of action itself */
- calc_action_range(data, &sta, &end, 0);
- gla2DDrawTranslatePt(di, sta, 0.0f, &act_start, &dummy);
- gla2DDrawTranslatePt(di, end, 0.0f, &act_end, &dummy);
-
- if (NLA_ACTION_SCALED)
- map_active_strip(di, OBACT, 1);
- }
-
- /* build list of channels to draw */
- filter= (ACTFILTER_FORDRAWING|ACTFILTER_VISIBLE|ACTFILTER_CHANNELS);
- actdata_filter(&act_data, filter, data, datatype);
-
- /* first backdrop strips */
- y = 0.0;
- glEnable(GL_BLEND);
- for (ale= act_data.first; ale; ale= ale->next) {
- int frame1_x, channel_y, sel=0;
-
- /* determine if any need to draw channel */
- if (ale->datatype != ALE_NONE) {
- /* determine if channel is selected */
- switch (ale->type) {
- case ACTTYPE_ACHAN:
- {
- bActionChannel *achan = (bActionChannel *)ale->data;
- sel = SEL_ACHAN(achan);
- }
- break;
- case ACTTYPE_CONCHAN:
- {
- bConstraintChannel *conchan = (bConstraintChannel *)ale->data;
- sel = SEL_CONCHAN(conchan);
- }
- break;
- case ACTTYPE_ICU:
- {
- IpoCurve *icu = (IpoCurve *)ale->data;
- sel = SEL_ICU(icu);
- }
- break;
- }
-
- if (datatype == ACTCONT_ACTION) {
- gla2DDrawTranslatePt(di, G.v2d->cur.xmin, y, &frame1_x, &channel_y);
-
- if (sel) glColor4ub(col1[0], col1[1], col1[2], 0x22);
- else glColor4ub(col2[0], col2[1], col2[2], 0x22);
- glRectf(frame1_x, channel_y-CHANNELHEIGHT/2, G.v2d->hor.xmax, channel_y+CHANNELHEIGHT/2);
-
- if (sel) glColor4ub(col1[0], col1[1], col1[2], 0x22);
- else glColor4ub(col2[0], col2[1], col2[2], 0x22);
- glRectf(act_start, channel_y-CHANNELHEIGHT/2, act_end, channel_y+CHANNELHEIGHT/2);
- }
- else if (datatype == ACTCONT_SHAPEKEY) {
- gla2DDrawTranslatePt(di, 1, y, &frame1_x, &channel_y);
-
- /* all frames that have a frame number less than one
- * get a desaturated orange background
- */
- glColor4ub(col2[0], col2[1], col2[2], 0x22);
- glRectf(0, channel_y-CHANNELHEIGHT/2, frame1_x, channel_y+CHANNELHEIGHT/2);
-
- /* frames one and higher get a saturated orange background */
- glColor4ub(col2[0], col2[1], col2[2], 0x44);
- glRectf(frame1_x, channel_y-CHANNELHEIGHT/2, G.v2d->hor.xmax, channel_y+CHANNELHEIGHT/2);
- }
- }
-
- /* Increment the step */
- y-=CHANNELHEIGHT+CHANNELSKIP;
- }
- glDisable(GL_BLEND);
-
- if (NLA_ACTION_SCALED)
- map_active_strip(di, OBACT, 0);
-
- /* draw keyframes */
- y = 0.0;
- for (ale= act_data.first; ale; ale= ale->next) {
- switch (ale->datatype) {
- case ALE_IPO:
- draw_ipo_channel(di, ale->key_data, y);
- break;
- case ALE_ICU:
- draw_icu_channel(di, ale->key_data, y);
- break;
- }
-
- y-=CHANNELHEIGHT+CHANNELSKIP;
- }
-
- /* free tempolary channels used for drawing */
- BLI_freelistN(&act_data);
-
- /* black line marking 'current frame' for Time-Slide transform mode */
- if (G.saction->flag & SACTION_MOVING) {
- int frame1_x, channel_y;
-
- gla2DDrawTranslatePt(di, G.saction->timeslide, 0, &frame1_x, &channel_y);
- cpack(0x0);
-
- glBegin(GL_LINES);
- glVertex2f(frame1_x, G.v2d->mask.ymin - 100);
- glVertex2f(frame1_x, G.v2d->mask.ymax);
- glEnd();
- }
-
- glaEnd2DDraw(di);
-}
-
-/* ********* action panel *********** */
-
-
-void do_actionbuts(unsigned short event)
-{
- switch(event) {
- case REDRAWVIEW3D:
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_REDR:
- allqueue(REDRAWACTION, 0);
- break;
- }
-}
-
-
-static void action_panel_properties(short cntrl) // ACTION_HANDLER_PROPERTIES
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "action_panel_properties", UI_EMBOSS, UI_HELV, curarea->win);
- uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | cntrl);
- uiSetPanelHandler(ACTION_HANDLER_PROPERTIES); // for close and esc
- if(uiNewPanel(curarea, block, "Transform Properties", "Action", 10, 230, 318, 204)==0) return;
-
- uiDefBut(block, LABEL, 0, "test text", 10,180,300,19, 0, 0, 0, 0, 0, "");
-
-}
-
-static void action_blockhandlers(ScrArea *sa)
-{
- SpaceAction *sact= sa->spacedata.first;
- short a;
-
- for(a=0; a<SPACE_MAXHANDLER; a+=2) {
- switch(sact->blockhandler[a]) {
-
- case ACTION_HANDLER_PROPERTIES:
- action_panel_properties(sact->blockhandler[a+1]);
- break;
-
- }
- /* clear action value for event */
- sact->blockhandler[a+1]= 0;
- }
- uiDrawBlocksPanels(sa, 0);
-}
-
-/* ************************* Action Editor Space ***************************** */
-
-void drawactionspace(ScrArea *sa, void *spacedata)
-{
- bAction *act = NULL;
- Key *key = NULL;
- void *data;
- short datatype;
-
- short ofsx = 0, ofsy = 0;
- float col[3];
-
- /* this is unlikely to occur, but it may */
- if (G.saction == NULL)
- return;
-
- /* warning: blocks need to be freed each time, handlers dont remove */
- uiFreeBlocksWin(&sa->uiblocks, sa->win);
-
- /* only try to refresh action that's displayed if not pinned */
- if (G.saction->pin==0) {
- /* TODO: allow more than one active action sometime? */
- if (OBACT)
- G.saction->action = OBACT->action;
- else
- G.saction->action= NULL;
- }
-
- /* get data */
- data = get_action_context(&datatype);
- if (datatype == ACTCONT_ACTION)
- act = data;
- else if (datatype == ACTCONT_SHAPEKEY)
- key = data;
-
- /* Lets make sure the width of the left hand of the screen
- * is set to an appropriate value based on whether sliders
- * are showing of not
- */
- if ((data) && (G.saction->flag & SACTION_SLIDERS))
- ACTWIDTH = NAMEWIDTH + SLIDERWIDTH;
- else
- ACTWIDTH = NAMEWIDTH;
-
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
- calc_scrollrcts(sa, G.v2d, curarea->winx, curarea->winy);
-
- /* background color for entire window (used in lefthand part though) */
- BIF_GetThemeColor3fv(TH_HEADER, col);
- glClearColor(col[0], col[1], col[2], 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- if(curarea->winx>SCROLLB+10 && curarea->winy>SCROLLH+10) {
- if(G.v2d->scroll) {
- ofsx= curarea->winrct.xmin;
- ofsy= curarea->winrct.ymin;
- glViewport(ofsx+G.v2d->mask.xmin, ofsy+G.v2d->mask.ymin,
- ( ofsx+G.v2d->mask.xmax-1)-(ofsx+G.v2d->mask.xmin)+1,
- ( ofsy+G.v2d->mask.ymax-1)-( ofsy+G.v2d->mask.ymin)+1);
- glScissor(ofsx+G.v2d->mask.xmin, ofsy+G.v2d->mask.ymin,
- ( ofsx+G.v2d->mask.xmax-1)-(ofsx+G.v2d->mask.xmin)+1,
- ( ofsy+G.v2d->mask.ymax-1)-( ofsy+G.v2d->mask.ymin)+1);
- }
- }
-
- BIF_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax);
- bwin_clear_viewmat(sa->win); /* clear buttons view */
- glLoadIdentity();
-
- /* Draw backdrop */
- calc_ipogrid();
- draw_ipogrid();
-
- check_action_context(G.saction);
-
- /* Draw channel strips */
- draw_channel_strips();
-
- /* reset matrices for stuff to be drawn on top of keys*/
- glViewport(ofsx+G.v2d->mask.xmin,
- ofsy+G.v2d->mask.ymin,
- ( ofsx+G.v2d->mask.xmax-1)-(ofsx+G.v2d->mask.xmin)+1,
- ( ofsy+G.v2d->mask.ymax-1)-( ofsy+G.v2d->mask.ymin)+1);
- glScissor(ofsx+G.v2d->mask.xmin,
- ofsy+G.v2d->mask.ymin,
- ( ofsx+G.v2d->mask.xmax-1)-(ofsx+G.v2d->mask.xmin)+1,
- ( ofsy+G.v2d->mask.ymax-1)-( ofsy+G.v2d->mask.ymin)+1);
- myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax);
-
- /* Draw current frame */
- draw_cfra_action();
-
- /* Draw markers */
- draw_markers_timespace(0);
-
- /* Draw 'curtains' for preview */
- draw_anim_preview_timespace();
-
- /* Draw scroll */
- mywinset(curarea->win); // reset scissor too
- if (curarea->winx>SCROLLB+10 && curarea->winy>SCROLLH+10) {
- myortho2(-0.375, curarea->winx-0.375, -0.375, curarea->winy-0.375);
- if (G.v2d->scroll) drawscroll(0);
- }
-
- /* Draw Left-Hand Panel if enough space in window */
- if (G.v2d->mask.xmin!=0) {
- /* Draw channel names */
- draw_channel_names();
-
- if(sa->winx > 50 + NAMEWIDTH + SLIDERWIDTH) {
- if (act) {
- /* if there is an action, draw sliders for its
- * ipo-curve channels in the action window
- */
- action_icu_buts(G.saction);
- }
- else if (key) {
- /* if there is a mesh with rvk's selected,
- * then draw the key frames in the action window
- */
- meshactionbuts(G.saction, OBACT, key);
- }
- }
- }
-
- mywinset(curarea->win); // reset scissor too
- myortho2(-0.375, curarea->winx-0.375, -0.375, curarea->winy-0.375);
- draw_area_emboss(sa);
-
- /* it is important to end a view in a transform compatible with buttons */
- bwin_scalematrix(sa->win, G.saction->blockscale, G.saction->blockscale, G.saction->blockscale);
- action_blockhandlers(sa);
-
- curarea->win_swap= WIN_BACK_OK;
-}
-
-/* *************************** Keyframe Drawing *************************** */
-
-static void add_bezt_to_keycolumnslist(ListBase *keys, BezTriple *bezt)
-{
- /* The equivilant of add_to_cfra_elem except this version
- * makes ActKeyColumns - one of the two datatypes required
- * for action editor drawing.
- */
- ActKeyColumn *ak, *akn;
-
- if (!(keys) || !(bezt)) return;
-
- /* try to find a keyblock that starts on the previous beztriple */
- for (ak= keys->first; ak; ak= ak->next) {
- /* do because of double keys */
- if (ak->cfra == bezt->vec[1][0]) {
- /* set selection status and 'touched' status */
- if (BEZSELECTED(bezt)) ak->sel = SELECT;
- ak->modified += 1;
-
- return;
- }
- else if (ak->cfra > bezt->vec[1][0]) break;
- }
-
- /* add new block */
- akn= MEM_callocN(sizeof(ActKeyColumn), "ActKeyColumn");
- if (ak) BLI_insertlinkbefore(keys, ak, akn);
- else BLI_addtail(keys, akn);
-
- akn->cfra= bezt->vec[1][0];
- akn->modified += 1;
-
- // TODO: handle type = bezt->h1 or bezt->h2
- akn->handle_type= 0;
-
- if (BEZSELECTED(bezt))
- akn->sel = SELECT;
- else
- akn->sel = 0;
-}
-
-static void add_bezt_to_keyblockslist(ListBase *blocks, IpoCurve *icu, int index)
-{
- /* The equivilant of add_to_cfra_elem except this version
- * makes ActKeyBlocks - one of the two datatypes required
- * for action editor drawing.
- */
- ActKeyBlock *ab, *abn;
- BezTriple *beztn=NULL, *prev=NULL;
- BezTriple *bezt;
- int v;
-
- /* get beztriples */
- beztn= (icu->bezt + index);
-
- for (v=0, bezt=icu->bezt; v<icu->totvert; v++, bezt++) {
- /* skip if beztriple is current */
- if (v != index) {
- /* check if beztriple is immediately before */
- if (beztn->vec[1][0] > bezt->vec[1][0]) {
- /* check if closer than previous was */
- if (prev) {
- if (prev->vec[1][0] < bezt->vec[1][0])
- prev= bezt;
- }
- else {
- prev= bezt;
- }
- }
- }
- }
-
- /* check if block needed - same value(s)?
- * -> firstly, handles must have same central value as each other
- * -> secondly, handles which control that section of the curve must be constant
- */
- if ((!prev) || (!beztn)) return;
- if (IS_EQ(beztn->vec[1][1], prev->vec[1][1])==0) return;
- if (IS_EQ(beztn->vec[1][1], beztn->vec[0][1])==0) return;
- if (IS_EQ(prev->vec[1][1], prev->vec[2][1])==0) return;
-
- /* try to find a keyblock that starts on the previous beztriple */
- for (ab= blocks->first; ab; ab= ab->next) {
- /* check if alter existing block or add new block */
- if (ab->start == prev->vec[1][0]) {
- /* set selection status and 'touched' status */
- if (BEZSELECTED(beztn)) ab->sel = SELECT;
- ab->modified += 1;
-
- return;
- }
- else if (ab->start > prev->vec[1][0]) break;
- }
-
- /* add new block */
- abn= MEM_callocN(sizeof(ActKeyBlock), "ActKeyBlock");
- if (ab) BLI_insertlinkbefore(blocks, ab, abn);
- else BLI_addtail(blocks, abn);
-
- abn->start= prev->vec[1][0];
- abn->end= beztn->vec[1][0];
- abn->val= beztn->vec[1][1];
-
- if (BEZSELECTED(prev) || BEZSELECTED(beztn))
- abn->sel = SELECT;
- else
- abn->sel = 0;
- abn->modified = 1;
-}
-
-/* helper function - find actkeycolumn that occurs on cframe */
-static ActKeyColumn *cfra_find_actkeycolumn (ListBase *keys, float cframe)
-{
- ActKeyColumn *ak;
-
- if (keys==NULL)
- return NULL;
-
- for (ak= keys->first; ak; ak= ak->next) {
- if (ak->cfra == cframe)
- return ak;
- }
-
- return NULL;
-}
-
-static void draw_keylist(gla2DDrawInfo *di, ListBase *keys, ListBase *blocks, float ypos)
-{
- ActKeyColumn *ak;
- ActKeyBlock *ab;
-
- glEnable(GL_BLEND);
-
- /* draw keyblocks */
- if (blocks) {
- for (ab= blocks->first; ab; ab= ab->next) {
- short startCurves, endCurves, totCurves;
-
- /* find out how many curves occur at each keyframe */
- ak= cfra_find_actkeycolumn(keys, ab->start);
- startCurves = (ak)? ak->totcurve: 0;
-
- ak= cfra_find_actkeycolumn(keys, ab->end);
- endCurves = (ak)? ak->totcurve: 0;
-
- /* only draw keyblock if it appears in at all of the keyframes at lowest end */
- if (!startCurves && !endCurves)
- continue;
- else
- totCurves = (startCurves>endCurves)? endCurves: startCurves;
-
- if (ab->totcurve >= totCurves) {
- int sc_xa, sc_ya;
- int sc_xb, sc_yb;
-
- /* get co-ordinates of block */
- gla2DDrawTranslatePt(di, ab->start, ypos, &sc_xa, &sc_ya);
- gla2DDrawTranslatePt(di, ab->end, ypos, &sc_xb, &sc_yb);
-
- /* draw block */
- if (ab->sel)
- BIF_ThemeColor4(TH_STRIP_SELECT);
- else
- BIF_ThemeColor4(TH_STRIP);
- glRectf(sc_xa, sc_ya-3, sc_xb, sc_yb+5);
- }
- }
- }
-
- /* draw keys */
- if (keys) {
- for (ak= keys->first; ak; ak= ak->next) {
- int sc_x, sc_y;
-
- /* get co-ordinate to draw at */
- gla2DDrawTranslatePt(di, ak->cfra, ypos, &sc_x, &sc_y);
-
- if(ak->sel & 1) BIF_icon_draw_aspect(sc_x-7, sc_y-6, ICON_SPACE2, 1.0f);
- else BIF_icon_draw_aspect(sc_x-7, sc_y-6, ICON_SPACE3, 1.0f);
- }
- }
-
- glDisable(GL_BLEND);
-}
-
-void draw_object_channel(gla2DDrawInfo *di, Object *ob, float ypos)
-{
- ListBase keys = {0, 0};
- ListBase blocks = {0, 0};
-
- ob_to_keylist(ob, &keys, &blocks);
- draw_keylist(di, &keys, &blocks, ypos);
-
- BLI_freelistN(&keys);
- BLI_freelistN(&blocks);
-}
-
-void draw_ipo_channel(gla2DDrawInfo *di, Ipo *ipo, float ypos)
-{
- ListBase keys = {0, 0};
- ListBase blocks = {0, 0};
-
- ipo_to_keylist(ipo, &keys, &blocks);
- draw_keylist(di, &keys, &blocks, ypos);
-
- BLI_freelistN(&keys);
- BLI_freelistN(&blocks);
-}
-
-void draw_icu_channel(gla2DDrawInfo *di, IpoCurve *icu, float ypos)
-{
- ListBase keys = {0, 0};
- ListBase blocks = {0, 0};
-
- icu_to_keylist(icu, &keys, &blocks);
- draw_keylist(di, &keys, &blocks, ypos);
-
- BLI_freelistN(&keys);
- BLI_freelistN(&blocks);
-}
-
-void draw_action_channel(gla2DDrawInfo *di, bAction *act, float ypos)
-{
- ListBase keys = {0, 0};
-
- action_to_keylist(act, &keys, NULL);
- draw_keylist(di, &keys, NULL, ypos);
- BLI_freelistN(&keys);
-}
-
-/* --------------- Conversion: data -> keyframe list ------------------ */
-
-void ob_to_keylist(Object *ob, ListBase *keys, ListBase *blocks)
-{
- bConstraintChannel *conchan;
-
- if (ob) {
- /* Add object keyframes */
- if (ob->ipo)
- ipo_to_keylist(ob->ipo, keys, blocks);
-
- /* Add constraint keyframes */
- for (conchan=ob->constraintChannels.first; conchan; conchan=conchan->next){
- if(conchan->ipo)
- ipo_to_keylist(conchan->ipo, keys, blocks);
- }
-
- /* Add object data keyframes */
- // TODO??
- }
-}
-
-void icu_to_keylist(IpoCurve *icu, ListBase *keys, ListBase *blocks)
-{
- BezTriple *bezt;
- ActKeyColumn *ak;
- ActKeyBlock *ab;
- int v;
-
- if (icu && icu->totvert) {
- /* loop through beztriples, making ActKeys and ActKeyBlocks */
- bezt= icu->bezt;
-
- for (v=0; v<icu->totvert; v++, bezt++) {
- add_bezt_to_keycolumnslist(keys, bezt);
- if (blocks) add_bezt_to_keyblockslist(blocks, icu, v);
- }
-
- /* update the number of curves that elements have appeared in */
- if (keys) {
- for (ak= keys->first; ak; ak= ak->next) {
- if (ak->modified) {
- ak->modified = 0;
- ak->totcurve += 1;
- }
- }
- }
- if (blocks) {
- for (ab= blocks->first; ab; ab= ab->next) {
- if (ab->modified) {
- ab->modified = 0;
- ab->totcurve += 1;
- }
- }
- }
- }
-}
-
-void ipo_to_keylist(Ipo *ipo, ListBase *keys, ListBase *blocks)
-{
- IpoCurve *icu;
-
- if (ipo) {
- for (icu= ipo->curve.first; icu; icu= icu->next)
- icu_to_keylist(icu, keys, blocks);
- }
-}
-
-void action_to_keylist(bAction *act, ListBase *keys, ListBase *blocks)
-{
- bActionChannel *achan;
- bConstraintChannel *conchan;
-
- if (act) {
- /* loop through action channels */
- for (achan= act->chanbase.first; achan; achan= achan->next) {
- /* firstly, add keys from action channel's ipo block */
- if (achan->ipo)
- ipo_to_keylist(achan->ipo, keys, blocks);
-
- /* then, add keys from constraint channels */
- for (conchan= achan->constraintChannels.first; conchan; conchan= conchan->next) {
- if (conchan->ipo)
- ipo_to_keylist(achan->ipo, keys, blocks);
- }
- }
- }
-}
-
diff --git a/source/blender/src/drawarmature.c b/source/blender/src/drawarmature.c
deleted file mode 100644
index 9ec688b5d8d..00000000000
--- a/source/blender/src/drawarmature.c
+++ /dev/null
@@ -1,2279 +0,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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2005 by the Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "BMF_Api.h"
-
-#include "DNA_action_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_ID.h"
-#include "DNA_nla_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_view3d_types.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "BKE_action.h"
-#include "BKE_armature.h"
-#include "BKE_constraint.h"
-#include "BKE_depsgraph.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_object.h"
-#include "BKE_ipo.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_editaction.h"
-#include "BIF_editarmature.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-#include "BIF_graphics.h"
-#include "BIF_interface.h"
-#include "BIF_poseobject.h"
-#include "BIF_mywindow.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-
-#include "BDR_editobject.h"
-#include "BDR_drawobject.h"
-#include "BDR_drawaction.h"
-
-#include "BSE_edit.h"
-#include "BSE_view.h"
-
-#include "mydevice.h"
-#include "blendef.h"
-#include "nla.h"
-
-/* half the cube, in Y */
-static float cube[8][3] = {
-{-1.0, 0.0, -1.0},
-{-1.0, 0.0, 1.0},
-{-1.0, 1.0, 1.0},
-{-1.0, 1.0, -1.0},
-{ 1.0, 0.0, -1.0},
-{ 1.0, 0.0, 1.0},
-{ 1.0, 1.0, 1.0},
-{ 1.0, 1.0, -1.0},
-};
-
-
-/* *************** Armature drawing, helper calls for parts ******************* */
-
-static void drawsolidcube_size(float xsize, float ysize, float zsize)
-{
- static GLuint displist=0;
- float n[3];
-
- glScalef(xsize, ysize, zsize);
-
- n[0]=0; n[1]=0; n[2]=0;
-
- if(displist==0) {
- displist= glGenLists(1);
- glNewList(displist, GL_COMPILE_AND_EXECUTE);
-
- glBegin(GL_QUADS);
- n[0]= -1.0;
- glNormal3fv(n);
- glVertex3fv(cube[0]); glVertex3fv(cube[1]); glVertex3fv(cube[2]); glVertex3fv(cube[3]);
- n[0]=0;
- n[1]= -1.0;
- glNormal3fv(n);
- glVertex3fv(cube[0]); glVertex3fv(cube[4]); glVertex3fv(cube[5]); glVertex3fv(cube[1]);
- n[1]=0;
- n[0]= 1.0;
- glNormal3fv(n);
- glVertex3fv(cube[4]); glVertex3fv(cube[7]); glVertex3fv(cube[6]); glVertex3fv(cube[5]);
- n[0]=0;
- n[1]= 1.0;
- glNormal3fv(n);
- glVertex3fv(cube[7]); glVertex3fv(cube[3]); glVertex3fv(cube[2]); glVertex3fv(cube[6]);
- n[1]=0;
- n[2]= 1.0;
- glNormal3fv(n);
- glVertex3fv(cube[1]); glVertex3fv(cube[5]); glVertex3fv(cube[6]); glVertex3fv(cube[2]);
- n[2]=0;
- n[2]= -1.0;
- glNormal3fv(n);
- glVertex3fv(cube[7]); glVertex3fv(cube[4]); glVertex3fv(cube[0]); glVertex3fv(cube[3]);
- glEnd();
-
- glEndList();
- }
- else glCallList(displist);
-
-}
-
-static void drawcube_size(float xsize, float ysize, float zsize)
-{
- static GLuint displist=0;
-
- glScalef(xsize, ysize, zsize);
-
- if(displist==0) {
- displist= glGenLists(1);
- glNewList(displist, GL_COMPILE_AND_EXECUTE);
-
- glBegin(GL_LINE_STRIP);
- glVertex3fv(cube[0]); glVertex3fv(cube[1]);glVertex3fv(cube[2]); glVertex3fv(cube[3]);
- glVertex3fv(cube[0]); glVertex3fv(cube[4]);glVertex3fv(cube[5]); glVertex3fv(cube[6]);
- glVertex3fv(cube[7]); glVertex3fv(cube[4]);
- glEnd();
-
- glBegin(GL_LINES);
- glVertex3fv(cube[1]); glVertex3fv(cube[5]);
- glVertex3fv(cube[2]); glVertex3fv(cube[6]);
- glVertex3fv(cube[3]); glVertex3fv(cube[7]);
- glEnd();
-
- glEndList();
- }
- else glCallList(displist);
-
-}
-
-
-static void draw_bonevert(void)
-{
- static GLuint displist=0;
-
- if(displist==0) {
- GLUquadricObj *qobj;
-
- displist= glGenLists(1);
- glNewList(displist, GL_COMPILE_AND_EXECUTE);
-
- glPushMatrix();
-
- qobj = gluNewQuadric();
- gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
- gluDisk( qobj, 0.0, 0.05, 16, 1);
-
- glRotatef (90, 0, 1, 0);
- gluDisk( qobj, 0.0, 0.05, 16, 1);
-
- glRotatef (90, 1, 0, 0);
- gluDisk( qobj, 0.0, 0.05, 16, 1);
-
- gluDeleteQuadric(qobj);
-
- glPopMatrix();
- glEndList();
- }
- else glCallList(displist);
-}
-
-static void draw_bonevert_solid(void)
-{
- static GLuint displist=0;
-
- if(displist==0) {
- GLUquadricObj *qobj;
-
- displist= glGenLists(1);
- glNewList(displist, GL_COMPILE_AND_EXECUTE);
-
- qobj = gluNewQuadric();
- gluQuadricDrawStyle(qobj, GLU_FILL);
- glShadeModel(GL_SMOOTH);
- gluSphere( qobj, 0.05, 8, 5);
- glShadeModel(GL_FLAT);
- gluDeleteQuadric(qobj);
-
- glEndList();
- }
- else glCallList(displist);
-}
-
-static void draw_bone_octahedral()
-{
- static GLuint displist=0;
-
- if(displist==0) {
- float vec[6][3];
-
- displist= glGenLists(1);
- glNewList(displist, GL_COMPILE_AND_EXECUTE);
-
- vec[0][0]= vec[0][1]= vec[0][2]= 0.0;
- vec[5][0]= vec[5][2]= 0.0; vec[5][1]= 1.0;
-
- vec[1][0]= 0.1; vec[1][2]= 0.1; vec[1][1]= 0.1;
- vec[2][0]= 0.1; vec[2][2]= -0.1; vec[2][1]= 0.1;
- vec[3][0]= -0.1; vec[3][2]= -0.1; vec[3][1]= 0.1;
- vec[4][0]= -0.1; vec[4][2]= 0.1; vec[4][1]= 0.1;
-
- /* Section 1, sides */
- glBegin(GL_LINE_LOOP);
- glVertex3fv(vec[0]);
- glVertex3fv(vec[1]);
- glVertex3fv(vec[5]);
- glVertex3fv(vec[3]);
- glVertex3fv(vec[0]);
- glVertex3fv(vec[4]);
- glVertex3fv(vec[5]);
- glVertex3fv(vec[2]);
- glEnd();
-
- /* Section 1, square */
- glBegin(GL_LINE_LOOP);
- glVertex3fv(vec[1]);
- glVertex3fv(vec[2]);
- glVertex3fv(vec[3]);
- glVertex3fv(vec[4]);
- glEnd();
-
- glEndList();
- }
- else glCallList(displist);
-}
-
-static void draw_bone_solid_octahedral(void)
-{
- static GLuint displist=0;
-
- if(displist==0) {
- float vec[6][3], nor[3];
-
- displist= glGenLists(1);
- glNewList(displist, GL_COMPILE_AND_EXECUTE);
-
- vec[0][0]= vec[0][1]= vec[0][2]= 0.0;
- vec[5][0]= vec[5][2]= 0.0; vec[5][1]= 1.0;
-
- vec[1][0]= 0.1; vec[1][2]= 0.1; vec[1][1]= 0.1;
- vec[2][0]= 0.1; vec[2][2]= -0.1; vec[2][1]= 0.1;
- vec[3][0]= -0.1; vec[3][2]= -0.1; vec[3][1]= 0.1;
- vec[4][0]= -0.1; vec[4][2]= 0.1; vec[4][1]= 0.1;
-
-
- glBegin(GL_TRIANGLES);
- /* bottom */
- CalcNormFloat(vec[2], vec[1], vec[0], nor);
- glNormal3fv(nor);
- glVertex3fv(vec[2]);glVertex3fv(vec[1]);glVertex3fv(vec[0]);
-
- CalcNormFloat(vec[3], vec[2], vec[0], nor);
- glNormal3fv(nor);
- glVertex3fv(vec[3]);glVertex3fv(vec[2]);glVertex3fv(vec[0]);
-
- CalcNormFloat(vec[4], vec[3], vec[0], nor);
- glNormal3fv(nor);
- glVertex3fv(vec[4]);glVertex3fv(vec[3]);glVertex3fv(vec[0]);
-
- CalcNormFloat(vec[1], vec[4], vec[0], nor);
- glNormal3fv(nor);
- glVertex3fv(vec[1]);glVertex3fv(vec[4]);glVertex3fv(vec[0]);
-
- /* top */
- CalcNormFloat(vec[5], vec[1], vec[2], nor);
- glNormal3fv(nor);
- glVertex3fv(vec[5]);glVertex3fv(vec[1]);glVertex3fv(vec[2]);
-
- CalcNormFloat(vec[5], vec[2], vec[3], nor);
- glNormal3fv(nor);
- glVertex3fv(vec[5]);glVertex3fv(vec[2]);glVertex3fv(vec[3]);
-
- CalcNormFloat(vec[5], vec[3], vec[4], nor);
- glNormal3fv(nor);
- glVertex3fv(vec[5]);glVertex3fv(vec[3]);glVertex3fv(vec[4]);
-
- CalcNormFloat(vec[5], vec[4], vec[1], nor);
- glNormal3fv(nor);
- glVertex3fv(vec[5]);glVertex3fv(vec[4]);glVertex3fv(vec[1]);
-
- glEnd();
-
- glEndList();
- }
- else glCallList(displist);
-}
-
-/* *************** Armature drawing, bones ******************* */
-
-
-static void draw_bone_points(int dt, int armflag, unsigned int boneflag, int id)
-{
- /* Draw root point if we are not connected */
- if (!(boneflag & BONE_CONNECTED)){
- if (id != -1)
- glLoadName (id | BONESEL_ROOT);
-
- if(dt<=OB_WIRE) {
- if(armflag & ARM_EDITMODE) {
- if (boneflag & BONE_ROOTSEL) BIF_ThemeColor(TH_VERTEX_SELECT);
- else BIF_ThemeColor(TH_VERTEX);
- }
- }
- else
- BIF_ThemeColor(TH_BONE_SOLID);
-
- if(dt>OB_WIRE) draw_bonevert_solid();
- else draw_bonevert();
- }
-
- /* Draw tip point */
- if (id != -1)
- glLoadName (id | BONESEL_TIP);
-
- if(dt<=OB_WIRE) {
- if(armflag & ARM_EDITMODE) {
- if (boneflag & BONE_TIPSEL) BIF_ThemeColor(TH_VERTEX_SELECT);
- else BIF_ThemeColor(TH_VERTEX);
- }
- }
- else {
- BIF_ThemeColor(TH_BONE_SOLID);
- }
-
- glTranslatef(0.0, 1.0, 0.0);
- if(dt>OB_WIRE) draw_bonevert_solid();
- else draw_bonevert();
- glTranslatef(0.0, -1.0, 0.0);
-
-}
-
-/* 16 values of sin function (still same result!) */
-static float si[16] = {
- 0.00000000,
- 0.20129852, 0.39435585,
- 0.57126821, 0.72479278,
- 0.84864425, 0.93775213,
- 0.98846832, 0.99871650,
- 0.96807711, 0.89780453,
- 0.79077573, 0.65137248,
- 0.48530196, 0.29936312,
- 0.10116832
-};
-/* 16 values of cos function (still same result!) */
-static float co[16] ={
- 1.00000000,
- 0.97952994, 0.91895781,
- 0.82076344, 0.68896691,
- 0.52896401, 0.34730525,
- 0.15142777, -0.05064916,
- -0.25065253, -0.44039415,
- -0.61210598, -0.75875812,
- -0.87434661, -0.95413925,
- -0.99486932
-};
-
-
-
-/* smat, imat = mat & imat to draw screenaligned */
-static void draw_sphere_bone_dist(float smat[][4], float imat[][4], int boneflag, bPoseChannel *pchan, EditBone *ebone)
-{
- float head, tail, length, dist;
- float *headvec, *tailvec, dirvec[3];
-
- /* figure out the sizes of spheres */
- if(ebone) {
- /* this routine doesn't call set_matrix_editbone() that calculates it */
- ebone->length = VecLenf(ebone->head, ebone->tail);
-
- length= ebone->length;
- tail= ebone->rad_tail;
- dist= ebone->dist;
- if (ebone->parent && (ebone->flag & BONE_CONNECTED))
- head= ebone->parent->rad_tail;
- else
- head= ebone->rad_head;
- headvec= ebone->head;
- tailvec= ebone->tail;
- }
- else {
- length= pchan->bone->length;
- tail= pchan->bone->rad_tail;
- dist= pchan->bone->dist;
- if (pchan->parent && (pchan->bone->flag & BONE_CONNECTED))
- head= pchan->parent->bone->rad_tail;
- else
- head= pchan->bone->rad_head;
- headvec= pchan->pose_head;
- tailvec= pchan->pose_tail;
- }
-
- /* ***** draw it ***** */
-
- /* move vector to viewspace */
- VecSubf(dirvec, tailvec, headvec);
- Mat4Mul3Vecfl(smat, dirvec);
- /* clear zcomp */
- dirvec[2]= 0.0;
- /* move vector back */
- Mat4Mul3Vecfl(imat, dirvec);
-
- if(0.0f != Normalize(dirvec)) {
- float norvec[3], vec1[3], vec2[3], vec[3];
- int a;
-
- //VecMulf(dirvec, head);
- Crossf(norvec, dirvec, imat[2]);
-
- glBegin(GL_QUAD_STRIP);
-
- for(a=0; a<16; a++) {
- vec[0]= - *(si+a) * dirvec[0] + *(co+a) * norvec[0];
- vec[1]= - *(si+a) * dirvec[1] + *(co+a) * norvec[1];
- vec[2]= - *(si+a) * dirvec[2] + *(co+a) * norvec[2];
-
- vec1[0]= headvec[0] + head*vec[0];
- vec1[1]= headvec[1] + head*vec[1];
- vec1[2]= headvec[2] + head*vec[2];
- vec2[0]= headvec[0] + (head+dist)*vec[0];
- vec2[1]= headvec[1] + (head+dist)*vec[1];
- vec2[2]= headvec[2] + (head+dist)*vec[2];
-
- glColor4ub(255, 255, 255, 50);
- glVertex3fv(vec1);
- //glColor4ub(255, 255, 255, 0);
- glVertex3fv(vec2);
- }
-
- for(a=15; a>=0; a--) {
- vec[0]= *(si+a) * dirvec[0] + *(co+a) * norvec[0];
- vec[1]= *(si+a) * dirvec[1] + *(co+a) * norvec[1];
- vec[2]= *(si+a) * dirvec[2] + *(co+a) * norvec[2];
-
- vec1[0]= tailvec[0] + tail*vec[0];
- vec1[1]= tailvec[1] + tail*vec[1];
- vec1[2]= tailvec[2] + tail*vec[2];
- vec2[0]= tailvec[0] + (tail+dist)*vec[0];
- vec2[1]= tailvec[1] + (tail+dist)*vec[1];
- vec2[2]= tailvec[2] + (tail+dist)*vec[2];
-
- //glColor4ub(255, 255, 255, 50);
- glVertex3fv(vec1);
- //glColor4ub(255, 255, 255, 0);
- glVertex3fv(vec2);
- }
- /* make it cyclic... */
-
- vec[0]= - *(si) * dirvec[0] + *(co) * norvec[0];
- vec[1]= - *(si) * dirvec[1] + *(co) * norvec[1];
- vec[2]= - *(si) * dirvec[2] + *(co) * norvec[2];
-
- vec1[0]= headvec[0] + head*vec[0];
- vec1[1]= headvec[1] + head*vec[1];
- vec1[2]= headvec[2] + head*vec[2];
- vec2[0]= headvec[0] + (head+dist)*vec[0];
- vec2[1]= headvec[1] + (head+dist)*vec[1];
- vec2[2]= headvec[2] + (head+dist)*vec[2];
-
- //glColor4ub(255, 255, 255, 50);
- glVertex3fv(vec1);
- //glColor4ub(255, 255, 255, 0);
- glVertex3fv(vec2);
-
- glEnd();
- }
-}
-
-
-/* smat, imat = mat & imat to draw screenaligned */
-static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
-{
- float head, tail, length;
- float *headvec, *tailvec, dirvec[3];
-
- /* figure out the sizes of spheres */
- if(ebone) {
- /* this routine doesn't call set_matrix_editbone() that calculates it */
- ebone->length = VecLenf(ebone->head, ebone->tail);
-
- length= ebone->length;
- tail= ebone->rad_tail;
- if (ebone->parent && (boneflag & BONE_CONNECTED))
- head= ebone->parent->rad_tail;
- else
- head= ebone->rad_head;
- headvec= ebone->head;
- tailvec= ebone->tail;
- }
- else {
- length= pchan->bone->length;
- tail= pchan->bone->rad_tail;
- if (pchan->parent && (boneflag & BONE_CONNECTED))
- head= pchan->parent->bone->rad_tail;
- else
- head= pchan->bone->rad_head;
- headvec= pchan->pose_head;
- tailvec= pchan->pose_tail;
- }
-
- /* sphere root color */
- if(armflag & ARM_EDITMODE) {
- if (boneflag & BONE_ROOTSEL) BIF_ThemeColor(TH_VERTEX_SELECT);
- else BIF_ThemeColor(TH_VERTEX);
- }
- else if(armflag & ARM_POSEMODE) {
- /* in black or selection color */
- if (boneflag & BONE_ACTIVE) BIF_ThemeColorShade(TH_BONE_POSE, 40);
- else if (boneflag & BONE_SELECTED) BIF_ThemeColor(TH_BONE_POSE);
- else BIF_ThemeColor(TH_WIRE);
- }
-
- /* Draw root point if we are not connected */
- if (!(boneflag & BONE_CONNECTED)){
- if (id != -1)
- glLoadName (id | BONESEL_ROOT);
-
- drawcircball(GL_LINE_LOOP, headvec, head, imat);
- }
-
- /* Draw tip point */
- if(armflag & ARM_EDITMODE) {
- if (boneflag & BONE_TIPSEL) BIF_ThemeColor(TH_VERTEX_SELECT);
- else BIF_ThemeColor(TH_VERTEX);
- }
-
- if (id != -1)
- glLoadName (id | BONESEL_TIP);
-
- drawcircball(GL_LINE_LOOP, tailvec, tail, imat);
-
- /* base */
- if(armflag & ARM_EDITMODE) {
- if (boneflag & BONE_SELECTED) BIF_ThemeColor(TH_SELECT);
- else BIF_ThemeColor(TH_WIRE);
- }
-
- VecSubf(dirvec, tailvec, headvec);
-
- /* move vector to viewspace */
- Mat4Mul3Vecfl(smat, dirvec);
- /* clear zcomp */
- dirvec[2]= 0.0;
- /* move vector back */
- Mat4Mul3Vecfl(imat, dirvec);
-
- if(0.0f != Normalize(dirvec)) {
- float norvech[3], norvect[3], vec[3];
-
- VECCOPY(vec, dirvec);
-
- VecMulf(dirvec, head);
- Crossf(norvech, dirvec, imat[2]);
-
- VecMulf(vec, tail);
- Crossf(norvect, vec, imat[2]);
-
- if (id != -1)
- glLoadName (id | BONESEL_BONE);
-
- glBegin(GL_LINES);
- vec[0]= headvec[0] + norvech[0];
- vec[1]= headvec[1] + norvech[1];
- vec[2]= headvec[2] + norvech[2];
- glVertex3fv(vec);
- vec[0]= tailvec[0] + norvect[0];
- vec[1]= tailvec[1] + norvect[1];
- vec[2]= tailvec[2] + norvect[2];
- glVertex3fv(vec);
- vec[0]= headvec[0] - norvech[0];
- vec[1]= headvec[1] - norvech[1];
- vec[2]= headvec[2] - norvech[2];
- glVertex3fv(vec);
- vec[0]= tailvec[0] - norvect[0];
- vec[1]= tailvec[1] - norvect[1];
- vec[2]= tailvec[2] - norvect[2];
- glVertex3fv(vec);
-
- glEnd();
- }
-}
-
-/* does wire only for outline selecting */
-static void draw_sphere_bone(int dt, int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
-{
- GLUquadricObj *qobj;
- float head, tail, length;
- float fac1, fac2;
-
- glPushMatrix();
- qobj = gluNewQuadric();
-
- /* figure out the sizes of spheres */
- if(ebone) {
- length= ebone->length;
- tail= ebone->rad_tail;
- if (ebone->parent && (boneflag & BONE_CONNECTED))
- head= ebone->parent->rad_tail;
- else
- head= ebone->rad_head;
- }
- else {
- length= pchan->bone->length;
- tail= pchan->bone->rad_tail;
- if (pchan->parent && (boneflag & BONE_CONNECTED))
- head= pchan->parent->bone->rad_tail;
- else
- head= pchan->bone->rad_head;
- }
-
- /* move to z-axis space */
- glRotatef (-90.0f, 1.0f, 0.0f, 0.0f);
-
- if(dt==OB_SOLID) {
- /* set up solid drawing */
- glEnable(GL_COLOR_MATERIAL);
- glEnable(GL_LIGHTING);
-
- gluQuadricDrawStyle(qobj, GLU_FILL);
- glShadeModel(GL_SMOOTH);
- }
- else {
- gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
- }
-
- /* sphere root color */
- if(armflag & ARM_EDITMODE) {
- if (boneflag & BONE_ROOTSEL) BIF_ThemeColor(TH_VERTEX_SELECT);
- else BIF_ThemeColorShade(TH_BONE_SOLID, -30);
- }
- else if(armflag & ARM_POSEMODE) {
- if (boneflag & BONE_ACTIVE) BIF_ThemeColorShade(TH_BONE_POSE, 10);
- else if (boneflag & BONE_SELECTED) BIF_ThemeColorShade(TH_BONE_POSE, -30);
- else BIF_ThemeColorShade(TH_BONE_SOLID, -30);
-
- }
- else if(dt==OB_SOLID)
- BIF_ThemeColorShade(TH_BONE_SOLID, -30);
-
- /* Draw root point if we are not connected */
- if (!(boneflag & BONE_CONNECTED)){
- if (id != -1)
- glLoadName (id | BONESEL_ROOT);
- gluSphere( qobj, head, 16, 10);
- }
-
- /* Draw tip point */
- if(armflag & ARM_EDITMODE) {
- if (boneflag & BONE_TIPSEL) BIF_ThemeColor(TH_VERTEX_SELECT);
- else BIF_ThemeColorShade(TH_BONE_SOLID, -30);
- }
-
- if (id != -1)
- glLoadName (id | BONESEL_TIP);
-
- glTranslatef(0.0, 0.0, length);
- gluSphere( qobj, tail, 16, 10);
- glTranslatef(0.0, 0.0, -length);
-
- /* base */
- if(armflag & ARM_EDITMODE) {
- if (boneflag & BONE_SELECTED) BIF_ThemeColor(TH_SELECT);
- else BIF_ThemeColor(TH_BONE_SOLID);
- }
- else if(armflag & ARM_POSEMODE) {
- if (boneflag & BONE_ACTIVE) BIF_ThemeColorShade(TH_BONE_POSE, 40);
- else if (boneflag & BONE_SELECTED) BIF_ThemeColor(TH_BONE_POSE);
- else BIF_ThemeColor(TH_BONE_SOLID);
-
- }
- else if(dt==OB_SOLID)
- BIF_ThemeColor(TH_BONE_SOLID);
-
- fac1= (length-head)/length;
- fac2= (length-tail)/length;
-
- if(length > head+tail) {
- if (id != -1)
- glLoadName (id | BONESEL_BONE);
-
- glEnable(GL_POLYGON_OFFSET_FILL);
- glPolygonOffset(-1.0, -1.0);
-
- glTranslatef(0.0f, 0.0f, head);
- gluCylinder(qobj, fac1*head + (1.0f-fac1)*tail, fac2*tail + (1.0f-fac2)*head, length-head-tail, 16, 1);
- glTranslatef(0.0f, 0.0f, -head);
-
- glDisable(GL_POLYGON_OFFSET_FILL);
-
- /* draw sphere on extrema */
- glTranslatef(0.0f, 0.0f, length-tail);
- gluSphere( qobj, fac2*tail + (1.0f-fac2)*head, 16, 10);
- glTranslatef(0.0f, 0.0f, -length+tail);
-
- glTranslatef(0.0f, 0.0f, head);
- gluSphere( qobj, fac1*head + (1.0f-fac1)*tail, 16, 10);
- }
- else {
- /* 1 sphere in center */
- glTranslatef(0.0f, 0.0f, (head + length-tail)/2.0);
- gluSphere( qobj, fac1*head + (1.0f-fac1)*tail, 16, 10);
- }
-
- /* restore */
- if(dt==OB_SOLID) {
- glShadeModel(GL_FLAT);
- glDisable(GL_LIGHTING);
- glDisable(GL_COLOR_MATERIAL);
- }
-
- glPopMatrix();
- gluDeleteQuadric(qobj);
-}
-
-static GLubyte bm_dot6[]= {0x0, 0x18, 0x3C, 0x7E, 0x7E, 0x3C, 0x18, 0x0};
-static GLubyte bm_dot8[]= {0x3C, 0x7E, 0xFF, 0xFF, 0xFF, 0xFF, 0x7E, 0x3C};
-
-static GLubyte bm_dot5[]= {0x0, 0x0, 0x10, 0x38, 0x7c, 0x38, 0x10, 0x0};
-static GLubyte bm_dot7[]= {0x0, 0x38, 0x7C, 0xFE, 0xFE, 0xFE, 0x7C, 0x38};
-
-
-static void draw_line_bone(int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
-{
- float length;
-
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-
- if(pchan)
- length= pchan->bone->length;
- else
- length= ebone->length;
-
- glPushMatrix();
- glScalef(length, length, length);
-
- /* this chunk not in object mode */
- if(armflag & (ARM_EDITMODE|ARM_POSEMODE)) {
- glLineWidth(4.0);
- if(armflag & ARM_POSEMODE) {
- /* outline in black or selection color */
- if (boneflag & BONE_ACTIVE) BIF_ThemeColorShade(TH_BONE_POSE, 40);
- else if (boneflag & BONE_SELECTED) BIF_ThemeColor(TH_BONE_POSE);
- else BIF_ThemeColor(TH_WIRE);
- }
- else if (armflag & ARM_EDITMODE) {
- BIF_ThemeColor(TH_WIRE);
- }
-
- /* Draw root point if we are not connected */
- if (!(boneflag & BONE_CONNECTED)){
- if (G.f & G_PICKSEL) { // no bitmap in selection mode, crashes 3d cards...
- glLoadName (id | BONESEL_ROOT);
- glBegin(GL_POINTS);
- glVertex3f(0.0f, 0.0f, 0.0f);
- glEnd();
- }
- else {
- glRasterPos3f(0.0f, 0.0f, 0.0f);
- glBitmap(8, 8, 4, 4, 0, 0, bm_dot8);
- }
- }
-
- if (id != -1)
- glLoadName ((GLuint) id|BONESEL_BONE);
-
- glBegin(GL_LINES);
- glVertex3f(0.0f, 0.0f, 0.0f);
- glVertex3f(0.0f, 1.0f, 0.0f);
- glEnd();
-
- /* tip */
- if (G.f & G_PICKSEL) { // no bitmap in selection mode, crashes 3d cards...
- glLoadName (id | BONESEL_TIP);
- glBegin(GL_POINTS);
- glVertex3f(0.0f, 1.0f, 0.0f);
- glEnd();
- }
- else {
- glRasterPos3f(0.0f, 1.0f, 0.0f);
- glBitmap(8, 8, 4, 4, 0, 0, bm_dot7);
- }
-
- /* further we send no names */
- if (id != -1)
- glLoadName (id & 0xFFFF); // object tag, for bordersel optim
-
- if(armflag & ARM_POSEMODE) {
- /* inner part in background color or constraint */
- if(constflag) {
- if(constflag & PCHAN_HAS_STRIDE) glColor3ub(0, 0, 200);
- else if(constflag & PCHAN_HAS_TARGET) glColor3ub(255, 150, 0);
- else if(constflag & PCHAN_HAS_IK) glColor3ub(255, 255, 0);
- else if(constflag & PCHAN_HAS_CONST) glColor3ub(0, 255, 120);
- else BIF_ThemeColor(TH_BONE_POSE); // PCHAN_HAS_ACTION
- }
- else BIF_ThemeColorShade(TH_BACK, -30);
- }
- }
-
- glLineWidth(2.0);
-
- /* Draw root point if we are not connected */
- if (!(boneflag & BONE_CONNECTED)){
- if ((G.f & G_PICKSEL)==0) { // no bitmap in selection mode, crashes 3d cards...
- if(armflag & ARM_EDITMODE) {
- if (boneflag & BONE_ROOTSEL) BIF_ThemeColor(TH_VERTEX_SELECT);
- else BIF_ThemeColor(TH_VERTEX);
- }
- glRasterPos3f(0.0f, 0.0f, 0.0f);
- glBitmap(8, 8, 4, 4, 0, 0, bm_dot6);
- }
- }
-
- if(armflag & ARM_EDITMODE) {
- if (boneflag & BONE_SELECTED) BIF_ThemeColor(TH_EDGE_SELECT);
- else BIF_ThemeColorShade(TH_BACK, -30);
- }
- glBegin(GL_LINES);
- glVertex3f(0.0f, 0.0f, 0.0f);
- glVertex3f(0.0f, 1.0f, 0.0f);
- glEnd();
-
- /* tip */
- if ((G.f & G_PICKSEL)==0) { // no bitmap in selection mode, crashes 3d cards...
- if(armflag & ARM_EDITMODE) {
- if (boneflag & BONE_TIPSEL) BIF_ThemeColor(TH_VERTEX_SELECT);
- else BIF_ThemeColor(TH_VERTEX);
- }
- glRasterPos3f(0.0f, 1.0f, 0.0f);
- glBitmap(8, 8, 4, 4, 0, 0, bm_dot5);
- }
-
- glLineWidth(1.0);
-
- glPopMatrix();
-}
-
-static void draw_b_bone_boxes(int dt, bPoseChannel *pchan, float xwidth, float length, float zwidth)
-{
- int segments= 0;
-
- if(pchan) segments= pchan->bone->segments;
-
- if(segments>1 && pchan) {
- float dlen= length/(float)segments;
- Mat4 *bbone= b_bone_spline_setup(pchan, 0);
- int a;
-
- for(a=0; a<segments; a++, bbone++) {
- glPushMatrix();
- glMultMatrixf(bbone->mat);
- if(dt==OB_SOLID) drawsolidcube_size(xwidth, dlen, zwidth);
- else drawcube_size(xwidth, dlen, zwidth);
- glPopMatrix();
- }
- }
- else {
- glPushMatrix();
- if(dt==OB_SOLID) drawsolidcube_size(xwidth, length, zwidth);
- else drawcube_size(xwidth, length, zwidth);
- glPopMatrix();
- }
-}
-
-static void draw_b_bone(int dt, int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
-{
- float xwidth, length, zwidth;
-
- if(pchan) {
- xwidth= pchan->bone->xwidth;
- length= pchan->bone->length;
- zwidth= pchan->bone->zwidth;
- }
- else {
- xwidth= ebone->xwidth;
- length= ebone->length;
- zwidth= ebone->zwidth;
- }
-
- /* draw points only if... */
- if(armflag & ARM_EDITMODE) {
- /* move to unitspace */
- glPushMatrix();
- glScalef(length, length, length);
- draw_bone_points(dt, armflag, boneflag, id);
- glPopMatrix();
- length*= 0.95f; // make vertices visible
- }
-
- /* colors for modes */
- if (armflag & ARM_POSEMODE) {
- if(dt==OB_WIRE) {
- if (boneflag & BONE_ACTIVE) BIF_ThemeColorShade(TH_BONE_POSE, 40);
- else if (boneflag & BONE_SELECTED) BIF_ThemeColor(TH_BONE_POSE);
- else BIF_ThemeColor(TH_WIRE);
- }
- else
- BIF_ThemeColor(TH_BONE_SOLID);
- }
- else if (armflag & ARM_EDITMODE) {
- if(dt==OB_WIRE) {
- if (boneflag & BONE_ACTIVE) BIF_ThemeColor(TH_EDGE_SELECT);
- else if (boneflag & BONE_SELECTED) BIF_ThemeColorShade(TH_EDGE_SELECT, -20);
- else BIF_ThemeColor(TH_WIRE);
- }
- else
- BIF_ThemeColor(TH_BONE_SOLID);
- }
-
- if (id != -1) {
- glLoadName ((GLuint) id|BONESEL_BONE);
- }
-
- /* set up solid drawing */
- if(dt > OB_WIRE) {
- glEnable(GL_COLOR_MATERIAL);
- glEnable(GL_LIGHTING);
- BIF_ThemeColor(TH_BONE_SOLID);
-
- draw_b_bone_boxes(OB_SOLID, pchan, xwidth, length, zwidth);
-
- /* disable solid drawing */
- glDisable(GL_COLOR_MATERIAL);
- glDisable(GL_LIGHTING);
- }
- else { // wire
- if (armflag & ARM_POSEMODE){
- if(constflag) {
- glEnable(GL_BLEND);
-
- if(constflag & PCHAN_HAS_STRIDE) glColor4ub(0, 0, 200, 80);
- else if(constflag & PCHAN_HAS_TARGET) glColor4ub(255, 150, 0, 80);
- else if(constflag & PCHAN_HAS_IK) glColor4ub(255, 255, 0, 80);
- else if(constflag & PCHAN_HAS_CONST) glColor4ub(0, 255, 120, 80);
- else BIF_ThemeColor4(TH_BONE_POSE); // PCHAN_HAS_ACTION
-
- draw_b_bone_boxes(OB_SOLID, pchan, xwidth, length, zwidth);
-
- glDisable(GL_BLEND);
-
- /* restore colors */
- if (boneflag & BONE_ACTIVE) BIF_ThemeColorShade(TH_BONE_POSE, 40);
- else if (boneflag & BONE_SELECTED) BIF_ThemeColor(TH_BONE_POSE);
- else BIF_ThemeColor(TH_WIRE);
- }
- }
-
- draw_b_bone_boxes(OB_WIRE, pchan, xwidth, length, zwidth);
- }
-}
-
-static void draw_bone(int dt, int armflag, int boneflag, int constflag, unsigned int id, float length)
-{
-
- /* Draw a 3d octahedral bone, we use normalized space based on length,
- for glDisplayLists */
-
- glScalef(length, length, length);
-
- /* set up solid drawing */
- if(dt > OB_WIRE) {
- glEnable(GL_COLOR_MATERIAL);
- glEnable(GL_LIGHTING);
- BIF_ThemeColor(TH_BONE_SOLID);
- }
-
- /* colors for posemode */
- if (armflag & ARM_POSEMODE) {
- if(dt==OB_WIRE) {
- if (boneflag & BONE_ACTIVE) BIF_ThemeColorShade(TH_BONE_POSE, 40);
- else if (boneflag & BONE_SELECTED) BIF_ThemeColor(TH_BONE_POSE);
- else BIF_ThemeColor(TH_WIRE);
- }
- else
- BIF_ThemeColor(TH_BONE_SOLID);
- }
-
-
- draw_bone_points(dt, armflag, boneflag, id);
-
- /* now draw the bone itself */
-
- if (id != -1) {
- glLoadName ((GLuint) id|BONESEL_BONE);
- }
-
- /* wire? */
- if(dt <= OB_WIRE) {
- /* colors */
- if (armflag & ARM_EDITMODE) {
- if (boneflag & BONE_ACTIVE) BIF_ThemeColor(TH_EDGE_SELECT);
- else if (boneflag & BONE_SELECTED) BIF_ThemeColorShade(TH_EDGE_SELECT, -20);
- else BIF_ThemeColor(TH_WIRE);
- }
- else if (armflag & ARM_POSEMODE){
- if(constflag) {
- glEnable(GL_BLEND);
-
- if(constflag & PCHAN_HAS_STRIDE) glColor4ub(0, 0, 200, 80);
- else if(constflag & PCHAN_HAS_TARGET) glColor4ub(255, 150, 0, 80);
- else if(constflag & PCHAN_HAS_IK) glColor4ub(255, 255, 0, 80);
- else if(constflag & PCHAN_HAS_CONST) glColor4ub(0, 255, 120, 80);
- else BIF_ThemeColor4(TH_BONE_POSE); // PCHAN_HAS_ACTION
-
- draw_bone_solid_octahedral();
- glDisable(GL_BLEND);
-
- /* restore colors */
- if (boneflag & BONE_ACTIVE) BIF_ThemeColorShade(TH_BONE_POSE, 40);
- else if (boneflag & BONE_SELECTED) BIF_ThemeColor(TH_BONE_POSE);
- else BIF_ThemeColor(TH_WIRE);
- }
- }
- draw_bone_octahedral();
- }
- else { /* solid */
-
- BIF_ThemeColor(TH_BONE_SOLID);
- draw_bone_solid_octahedral();
- }
-
- /* disable solid drawing */
- if(dt>OB_WIRE) {
- glDisable(GL_COLOR_MATERIAL);
- glDisable(GL_LIGHTING);
- }
-}
-
-static void draw_custom_bone(Object *ob, int dt, int armflag, int boneflag, unsigned int id, float length)
-{
-
- if(ob==NULL) return;
-
- glScalef(length, length, length);
-
- /* colors for posemode */
- if (armflag & ARM_POSEMODE) {
- if (boneflag & BONE_ACTIVE) BIF_ThemeColorShade(TH_BONE_POSE, 40);
- else if (boneflag & BONE_SELECTED) BIF_ThemeColor(TH_BONE_POSE);
- else BIF_ThemeColor(TH_WIRE);
- }
-
- if (id != -1) {
- glLoadName ((GLuint) id|BONESEL_BONE);
- }
-
- draw_object_instance(ob, dt, armflag & ARM_POSEMODE);
-}
-
-
-static void pchan_draw_IK_root_lines(bPoseChannel *pchan)
-{
- bConstraint *con;
- bPoseChannel *parchan;
-
- for(con= pchan->constraints.first; con; con= con->next) {
- if(con->type == CONSTRAINT_TYPE_KINEMATIC) {
- bKinematicConstraint *data = (bKinematicConstraint*)con->data;
- int segcount= 0;
-
- setlinestyle(3);
- glBegin(GL_LINES);
-
- /* exclude tip from chain? */
- if(!(data->flag & CONSTRAINT_IK_TIP))
- parchan= pchan->parent;
- else
- parchan= pchan;
-
- glVertex3fv(parchan->pose_tail);
-
- /* Find the chain's root */
- while (parchan->parent){
- segcount++;
- if(segcount==data->rootbone || segcount>255) break; // 255 is weak
- parchan= parchan->parent;
- }
- if(parchan)
- glVertex3fv(parchan->pose_head);
-
- glEnd();
- setlinestyle(0);
- }
- }
-}
-
-static void bgl_sphere_project(float ax, float az)
-{
- float dir[3], sine, q3;
-
- sine= 1.0f-ax*ax-az*az;
- q3= (sine < 0.0f)? 0.0f: 2.0f*sqrt(sine);
-
- dir[0]= -az*q3;
- dir[1]= 1.0f-2.0f*sine;
- dir[2]= ax*q3;
-
- glVertex3fv(dir);
-}
-
-static void draw_dof_ellipse(float ax, float az)
-{
- static float staticSine[16] = {
- 0.0, 0.104528463268, 0.207911690818, 0.309016994375,
- 0.406736643076, 0.5, 0.587785252292, 0.669130606359,
- 0.743144825477, 0.809016994375, 0.866025403784,
- 0.913545457643, 0.951056516295, 0.978147600734,
- 0.994521895368, 1.0
- };
-
- int i, j, n=16;
- float x, z, px, pz;
-
- glEnable(GL_BLEND);
- glDepthMask(0);
-
- glColor4ub(70, 70, 70, 50);
-
- glBegin(GL_QUADS);
- pz= 0.0f;
- for(i=1; i<n; i++) {
- z= staticSine[i];
-
- px= 0.0f;
- for(j=1; j<n-i+1; j++) {
- x = staticSine[j];
-
- if(j == n-i) {
- glEnd();
- glBegin(GL_TRIANGLES);
- bgl_sphere_project(ax*px, az*z);
- bgl_sphere_project(ax*px, az*pz);
- bgl_sphere_project(ax*x, az*pz);
- glEnd();
- glBegin(GL_QUADS);
- }
- else {
- bgl_sphere_project(ax*x, az*z);
- bgl_sphere_project(ax*x, az*pz);
- bgl_sphere_project(ax*px, az*pz);
- bgl_sphere_project(ax*px, az*z);
- }
-
- px= x;
- }
- pz= z;
- }
- glEnd();
-
- glDisable(GL_BLEND);
- glDepthMask(1);
-
- glColor3ub(0, 0, 0);
-
- glBegin(GL_LINE_STRIP);
- for(i=0; i<n; i++)
- bgl_sphere_project(staticSine[n-i-1]*ax, staticSine[i]*az);
- glEnd();
-}
-
-static void draw_pose_dofs(Object *ob)
-{
- bArmature *arm= ob->data;
- bPoseChannel *pchan;
- Bone *bone;
-
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- bone= pchan->bone;
- if(bone && !(bone->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG))) {
- if(bone->flag & BONE_SELECTED) {
- if(bone->layer & arm->layer) {
- if(pchan->ikflag & (BONE_IK_XLIMIT|BONE_IK_ZLIMIT)) {
- if(pose_channel_in_IK_chain(ob, pchan)) {
- float corner[4][3], posetrans[3], mat[4][4];
- float phi=0.0f, theta=0.0f, scale;
- int a, i;
-
- /* in parent-bone pose, but own restspace */
- glPushMatrix();
-
- VECCOPY(posetrans, pchan->pose_mat[3]);
- glTranslatef(posetrans[0], posetrans[1], posetrans[2]);
-
- if(pchan->parent) {
- Mat4CpyMat4(mat, pchan->parent->pose_mat);
- mat[3][0]= mat[3][1]= mat[3][2]= 0.0f;
- glMultMatrixf(mat);
- }
-
- Mat4CpyMat3(mat, pchan->bone->bone_mat);
- glMultMatrixf(mat);
-
- scale= bone->length*pchan->size[1];
- glScalef(scale, scale, scale);
-
- if(pchan->ikflag & BONE_IK_XLIMIT) {
- if(pchan->ikflag & BONE_IK_ZLIMIT) {
- float amin[3], amax[3];
-
- for(i=0; i<3; i++) {
- amin[i]= sin(pchan->limitmin[i]*M_PI/360.0);
- amax[i]= sin(pchan->limitmax[i]*M_PI/360.0);
- }
-
- glScalef(1.0, -1.0, 1.0);
- if (amin[0] != 0.0 && amin[2] != 0.0)
- draw_dof_ellipse(amin[0], amin[2]);
- if (amin[0] != 0.0 && amax[2] != 0.0)
- draw_dof_ellipse(amin[0], amax[2]);
- if (amax[0] != 0.0 && amin[2] != 0.0)
- draw_dof_ellipse(amax[0], amin[2]);
- if (amax[0] != 0.0 && amax[2] != 0.0)
- draw_dof_ellipse(amax[0], amax[2]);
- glScalef(1.0, -1.0, 1.0);
- }
- }
-
- /* arcs */
- if(pchan->ikflag & BONE_IK_ZLIMIT) {
- theta= 0.5*(pchan->limitmin[2]+pchan->limitmax[2]);
- glRotatef(theta, 0.0f, 0.0f, 1.0f);
-
- glColor3ub(50, 50, 255); // blue, Z axis limit
- glBegin(GL_LINE_STRIP);
- for(a=-16; a<=16; a++) {
- float fac= ((float)a)/16.0f;
- phi= fac*(M_PI/360.0f)*(pchan->limitmax[2]-pchan->limitmin[2]);
-
- if(a==-16) i= 0; else i= 1;
- corner[i][0]= sin(phi);
- corner[i][1]= cos(phi);
- corner[i][2]= 0.0f;
- glVertex3fv(corner[i]);
- }
- glEnd();
-
- glRotatef(-theta, 0.0f, 0.0f, 1.0f);
- }
-
- if(pchan->ikflag & BONE_IK_XLIMIT) {
- theta= 0.5*( pchan->limitmin[0]+pchan->limitmax[0]);
- glRotatef(theta, 1.0f, 0.0f, 0.0f);
-
- glColor3ub(255, 50, 50); // Red, X axis limit
- glBegin(GL_LINE_STRIP);
- for(a=-16; a<=16; a++) {
- float fac= ((float)a)/16.0f;
- phi= 0.5f*M_PI + fac*(M_PI/360.0f)*(pchan->limitmax[0]-pchan->limitmin[0]);
-
- if(a==-16) i= 2; else i= 3;
- corner[i][0]= 0.0f;
- corner[i][1]= sin(phi);
- corner[i][2]= cos(phi);
- glVertex3fv(corner[i]);
- }
- glEnd();
-
- glRotatef(-theta, 1.0f, 0.0f, 0.0f);
- }
-
- glPopMatrix(); // out of cone, out of bone
- }
- }
- }
- }
- }
- }
-}
-
-/* assumes object is Armature with pose */
-static void draw_pose_channels(Base *base, int dt)
-{
- Object *ob= base->object;
- bArmature *arm= ob->data;
- bPoseChannel *pchan;
- Bone *bone;
- GLfloat tmp;
- float smat[4][4], imat[4][4];
- int index= -1;
- int do_dashed= 1;
- short flag, constflag;
-
- /* hacky... prevent outline select from drawing dashed helplines */
- glGetFloatv(GL_LINE_WIDTH, &tmp);
- if(tmp > 1.1) do_dashed= 0;
- if (G.vd->flag & V3D_HIDE_HELPLINES) do_dashed= 0;
-
- /* precalc inverse matrix for drawing screen aligned */
- if(arm->drawtype==ARM_ENVELOPE) {
- /* precalc inverse matrix for drawing screen aligned */
- mygetmatrix(smat);
- Mat4MulFloat3(smat[0], 1.0f/VecLength(ob->obmat[0]));
- Mat4Invert(imat, smat);
-
- /* and draw blended distances */
- if(arm->flag & ARM_POSEMODE) {
- glEnable(GL_BLEND);
- //glShadeModel(GL_SMOOTH);
-
- if(G.vd->zbuf) glDisable(GL_DEPTH_TEST);
-
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- bone= pchan->bone;
- if(bone && !(bone->flag & (BONE_HIDDEN_P|BONE_NO_DEFORM|BONE_HIDDEN_PG))) {
- if(bone->flag & (BONE_SELECTED))
- if(bone->layer & arm->layer)
- draw_sphere_bone_dist(smat, imat, bone->flag, pchan, NULL);
- }
- }
-
- if(G.vd->zbuf) glEnable(GL_DEPTH_TEST);
- glDisable(GL_BLEND);
- //glShadeModel(GL_FLAT);
- }
- }
-
- /* little speedup, also make sure transparent only draws once */
- glCullFace(GL_BACK);
- glEnable(GL_CULL_FACE);
-
- /* if solid we draw that first, with selection codes, but without names, axes etc */
- if(dt>OB_WIRE) {
- if(arm->flag & ARM_POSEMODE) index= base->selcol;
-
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- bone= pchan->bone;
- if(bone && !(bone->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG))) {
- if(bone->layer & arm->layer) {
- glPushMatrix();
- glMultMatrixf(pchan->pose_mat);
-
- /* catch exception for bone with hidden parent */
- flag= bone->flag;
- if(bone->parent && (bone->parent->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG)))
- flag &= ~BONE_CONNECTED;
-
- if(pchan->custom && !(arm->flag & ARM_NO_CUSTOM))
- draw_custom_bone(pchan->custom, OB_SOLID, arm->flag, flag, index, bone->length);
- else if(arm->drawtype==ARM_LINE)
- ; /* nothing in solid */
- else if(arm->drawtype==ARM_ENVELOPE)
- draw_sphere_bone(OB_SOLID, arm->flag, flag, 0, index, pchan, NULL);
- else if(arm->drawtype==ARM_B_BONE)
- draw_b_bone(OB_SOLID, arm->flag, flag, 0, index, pchan, NULL);
- else {
- draw_bone(OB_SOLID, arm->flag, flag, 0, index, bone->length);
- }
- glPopMatrix();
- }
- }
- if (index!= -1) index+= 0x10000; // pose bones count in higher 2 bytes only
- }
- /* very very confusing... but in object mode, solid draw, we cannot do glLoadName yet, stick bones are drawn in next loop */
- if(arm->drawtype!=ARM_LINE) {
- glLoadName (index & 0xFFFF); // object tag, for bordersel optim
- index= -1;
- }
- }
-
- /* wire draw over solid only in posemode */
- if( dt<=OB_WIRE || (arm->flag & ARM_POSEMODE) || arm->drawtype==ARM_LINE) {
-
- /* draw line check first. we do selection indices */
- if (arm->drawtype==ARM_LINE) {
- if (arm->flag & ARM_POSEMODE) index= base->selcol;
- }
- /* if solid && posemode, we draw again with polygonoffset */
- else if (dt>OB_WIRE && (arm->flag & ARM_POSEMODE))
- bglPolygonOffset(1.0);
- else
- /* and we use selection indices if not done yet */
- if (arm->flag & ARM_POSEMODE) index= base->selcol;
-
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- bone= pchan->bone;
- if(bone && !(bone->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG))) {
- if(bone->layer & arm->layer) {
- if (do_dashed && bone->parent) {
- /* Draw a line from our root to the parent's tip */
- if(!(bone->flag & BONE_CONNECTED) ){
- if (arm->flag & ARM_POSEMODE) {
- glLoadName (index & 0xFFFF); // object tag, for bordersel optim
- BIF_ThemeColor(TH_WIRE);
- }
- setlinestyle(3);
- glBegin(GL_LINES);
- glVertex3fv(pchan->pose_head);
- glVertex3fv(pchan->parent->pose_tail);
- glEnd();
- setlinestyle(0);
- }
- // Draw a line to IK root bone
- if(arm->flag & ARM_POSEMODE) {
- if(pchan->constflag & PCHAN_HAS_IK) {
- if(bone->flag & BONE_SELECTED) {
-
- if(pchan->constflag & PCHAN_HAS_TARGET) glColor3ub(200, 120, 0);
- else glColor3ub(200, 200, 50); // add theme!
-
- glLoadName (index & 0xFFFF);
- pchan_draw_IK_root_lines(pchan);
- }
- }
- }
- }
-
- if(arm->drawtype!=ARM_ENVELOPE) {
- glPushMatrix();
- glMultMatrixf(pchan->pose_mat);
- }
-
- /* catch exception for bone with hidden parent */
- flag= bone->flag;
- if(bone->parent && (bone->parent->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG)))
- flag &= ~BONE_CONNECTED;
-
- /* extra draw service for pose mode */
- constflag= pchan->constflag;
- if(pchan->flag & (POSE_ROT|POSE_LOC|POSE_SIZE))
- constflag |= PCHAN_HAS_ACTION;
- if(pchan->flag & POSE_STRIDE)
- constflag |= PCHAN_HAS_STRIDE;
-
- if(pchan->custom && !(arm->flag & ARM_NO_CUSTOM)) {
- if(dt<OB_SOLID)
- draw_custom_bone(pchan->custom, OB_WIRE, arm->flag, flag, index, bone->length);
- }
- else if(arm->drawtype==ARM_ENVELOPE) {
- if(dt<OB_SOLID)
- draw_sphere_bone_wire(smat, imat, arm->flag, flag, constflag, index, pchan, NULL);
- }
- else if(arm->drawtype==ARM_LINE)
- draw_line_bone(arm->flag, flag, constflag, index, pchan, NULL);
- else if(arm->drawtype==ARM_B_BONE)
- draw_b_bone(OB_WIRE, arm->flag, flag, constflag, index, pchan, NULL);
- else {
- draw_bone(OB_WIRE, arm->flag, flag, constflag, index, bone->length);
- }
-
- if(arm->drawtype!=ARM_ENVELOPE)
- glPopMatrix();
- }
- }
- if (index!= -1) index+= 0x10000; // pose bones count in higher 2 bytes only
- }
- /* restore things */
- if (arm->drawtype!=ARM_LINE && dt>OB_WIRE && (arm->flag & ARM_POSEMODE))
- bglPolygonOffset(0.0);
-
- }
-
- /* restore */
- glDisable(GL_CULL_FACE);
-
- /* draw DoFs */
- if (arm->flag & ARM_POSEMODE)
- draw_pose_dofs(ob);
-
- /* finally names and axes */
- if(arm->flag & (ARM_DRAWNAMES|ARM_DRAWAXES)) {
- // patch for several 3d cards (IBM mostly) that crash on glSelect with text drawing
- if((G.f & G_PICKSEL) == 0) {
- float vec[3];
-
- if(G.vd->zbuf) glDisable(GL_DEPTH_TEST);
-
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if((pchan->bone->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG))==0) {
- if(pchan->bone->layer & arm->layer) {
- if (arm->flag & (ARM_EDITMODE|ARM_POSEMODE)) {
- bone= pchan->bone;
- if(bone->flag & BONE_SELECTED) BIF_ThemeColor(TH_TEXT_HI);
- else BIF_ThemeColor(TH_TEXT);
- }
- else if(dt > OB_WIRE) BIF_ThemeColor(TH_TEXT);
-
- if (arm->flag & ARM_DRAWNAMES){
- VecMidf(vec, pchan->pose_head, pchan->pose_tail);
- glRasterPos3fv(vec);
- BMF_DrawString(G.font, " ");
- BMF_DrawString(G.font, pchan->name);
- }
- /* Draw additional axes */
- if( (arm->flag & ARM_DRAWAXES) && (arm->flag & ARM_POSEMODE) ){
- glPushMatrix();
- glMultMatrixf(pchan->pose_mat);
- glTranslatef(0.0f, pchan->bone->length, 0.0f);
- drawaxes(0.25f*pchan->bone->length, 0, OB_ARROWS);
- glPopMatrix();
- }
- }
- }
- }
-
- if(G.vd->zbuf) glEnable(GL_DEPTH_TEST);
- }
- }
-
-}
-
-/* in editmode, we don't store the bone matrix... */
-static void set_matrix_editbone(EditBone *eBone)
-{
- float delta[3],offset[3];
- float mat[3][3], bmat[4][4];
-
- /* Compose the parent transforms (i.e. their translations) */
- VECCOPY (offset, eBone->head);
-
- glTranslatef (offset[0],offset[1],offset[2]);
-
- VecSubf(delta, eBone->tail, eBone->head);
-
- eBone->length = sqrt (delta[0]*delta[0] + delta[1]*delta[1] +delta[2]*delta[2]);
-
- vec_roll_to_mat3(delta, eBone->roll, mat);
- Mat4CpyMat3(bmat, mat);
-
- glMultMatrixf (bmat);
-
-}
-
-static void draw_ebones(Object *ob, int dt)
-{
- EditBone *eBone;
- bArmature *arm= ob->data;
- float smat[4][4], imat[4][4];
- unsigned int index;
- int flag;
-
- /* envelope (deform distance) */
- if(arm->drawtype==ARM_ENVELOPE) {
- /* precalc inverse matrix for drawing screen aligned */
- mygetmatrix(smat);
- Mat4MulFloat3(smat[0], 1.0f/VecLength(ob->obmat[0]));
- Mat4Invert(imat, smat);
-
- /* and draw blended distances */
- glEnable(GL_BLEND);
- //glShadeModel(GL_SMOOTH);
-
- if(G.vd->zbuf) glDisable(GL_DEPTH_TEST);
-
- for (eBone=G.edbo.first, index=0; eBone; eBone=eBone->next, index++){
- if(eBone->layer & arm->layer)
- if(!(eBone->flag & (BONE_HIDDEN_A|BONE_NO_DEFORM)))
- if(eBone->flag & (BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL))
- draw_sphere_bone_dist(smat, imat, eBone->flag, NULL, eBone);
- }
-
- if(G.vd->zbuf) glEnable(GL_DEPTH_TEST);
- glDisable(GL_BLEND);
- //glShadeModel(GL_FLAT);
- }
-
- /* if solid we draw it first */
- if(dt>OB_WIRE && arm->drawtype!=ARM_LINE) {
- index= 0;
- for (eBone=G.edbo.first, index=0; eBone; eBone=eBone->next, index++){
- if(eBone->layer & arm->layer) {
- if(!(eBone->flag & BONE_HIDDEN_A)) {
- glPushMatrix();
- set_matrix_editbone(eBone);
-
- /* catch exception for bone with hidden parent */
- flag= eBone->flag;
- if(eBone->parent && ((eBone->parent->flag & BONE_HIDDEN_A) || (eBone->parent->layer & arm->layer)==0) )
- flag &= ~BONE_CONNECTED;
-
- if(arm->drawtype==ARM_ENVELOPE)
- draw_sphere_bone(OB_SOLID, arm->flag, flag, 0, index, NULL, eBone);
- else if(arm->drawtype==ARM_B_BONE)
- draw_b_bone(OB_SOLID, arm->flag, flag, 0, index, NULL, eBone);
- else {
- draw_bone(OB_SOLID, arm->flag, flag, 0, index, eBone->length);
- }
-
- glPopMatrix();
- }
- }
- }
- }
-
- /* if wire over solid, set offset */
- index= -1;
- glLoadName(-1);
- if(arm->drawtype==ARM_LINE) {
- if(G.f & G_PICKSEL)
- index= 0;
- }
- else if (dt>OB_WIRE)
- bglPolygonOffset(1.0);
- else if(arm->flag & ARM_EDITMODE)
- index= 0; // do selection codes
-
- for (eBone=G.edbo.first; eBone; eBone=eBone->next){
- if(eBone->layer & arm->layer) {
- if(!(eBone->flag & BONE_HIDDEN_A)) {
-
- /* catch exception for bone with hidden parent */
- flag= eBone->flag;
- if(eBone->parent && ((eBone->parent->flag & BONE_HIDDEN_A) || (eBone->parent->layer & arm->layer)==0) )
- flag &= ~BONE_CONNECTED;
-
- if(arm->drawtype==ARM_ENVELOPE) {
- if(dt<OB_SOLID)
- draw_sphere_bone_wire(smat, imat, arm->flag, flag, 0, index, NULL, eBone);
- }
- else {
- glPushMatrix();
- set_matrix_editbone(eBone);
-
- if(arm->drawtype==ARM_LINE)
- draw_line_bone(arm->flag, flag, 0, index, NULL, eBone);
- else if(arm->drawtype==ARM_B_BONE)
- draw_b_bone(OB_WIRE, arm->flag, flag, 0, index, NULL, eBone);
- else
- draw_bone(OB_WIRE, arm->flag, flag, 0, index, eBone->length);
-
- glPopMatrix();
- }
-
- /* offset to parent */
- if (eBone->parent) {
- BIF_ThemeColor(TH_WIRE);
- glLoadName (-1); // -1 here is OK!
- setlinestyle(3);
-
- glBegin(GL_LINES);
- glVertex3fv(eBone->parent->tail);
- glVertex3fv(eBone->head);
- glEnd();
-
- setlinestyle(0);
- }
- }
- }
- if(index!=-1) index++;
- }
-
- /* restore */
- if(arm->drawtype==ARM_LINE);
- else if (dt>OB_WIRE) bglPolygonOffset(0.0);
-
- /* finally names and axes */
- if(arm->flag & (ARM_DRAWNAMES|ARM_DRAWAXES)) {
- // patch for several 3d cards (IBM mostly) that crash on glSelect with text drawing
- if((G.f & G_PICKSEL) == 0) {
- float vec[3];
-
- if(G.vd->zbuf) glDisable(GL_DEPTH_TEST);
-
- for (eBone=G.edbo.first, index=0; eBone; eBone=eBone->next, index++){
- if(eBone->layer & arm->layer) {
- if(!(eBone->flag & BONE_HIDDEN_A)) {
-
- if(eBone->flag & BONE_SELECTED) BIF_ThemeColor(TH_TEXT_HI);
- else BIF_ThemeColor(TH_TEXT);
-
- /* Draw name */
- if(arm->flag & ARM_DRAWNAMES){
- VecMidf(vec, eBone->head, eBone->tail);
- glRasterPos3fv(vec);
- BMF_DrawString(G.font, " ");
- BMF_DrawString(G.font, eBone->name);
- }
- /* Draw additional axes */
- if(arm->flag & ARM_DRAWAXES){
- glPushMatrix();
- set_matrix_editbone(eBone);
- glTranslatef(0.0f, eBone->length, 0.0f);
- drawaxes(eBone->length*0.25f, 0, OB_ARROWS);
- glPopMatrix();
- }
-
- }
- }
- }
-
- if(G.vd->zbuf) glEnable(GL_DEPTH_TEST);
- }
- }
-}
-
-/* ****************************** Armature Visualisation ******************************** */
-
-/* ---------- Paths --------- */
-
-/* draw bone paths
- * - in view space
- */
-static void draw_pose_paths(Object *ob)
-{
- bArmature *arm= ob->data;
- bPoseChannel *pchan;
- bAction *act;
- bActionChannel *achan;
- ActKeyColumn *ak;
- ListBase keys;
- float *fp, *fp_start;
- int a, stepsize;
- int sfra, efra, len;
-
- if (G.vd->zbuf) glDisable(GL_DEPTH_TEST);
-
- glPushMatrix();
- glLoadMatrixf(G.vd->viewmat);
-
- /* version patch here - cannot access frame info from file reading */
- if (arm->pathsize == 0) arm->pathsize= 1;
- stepsize = arm->pathsize;
-
- for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if (pchan->bone->layer & arm->layer) {
- if (pchan->path) {
- /* version patch here - cannot access frame info from file reading */
- if ((pchan->pathsf == 0) || (pchan->pathef == 0)) {
- pchan->pathsf= SFRA;
- pchan->pathef= EFRA;
- }
-
- /* get frame ranges */
- if (arm->pathflag & ARM_PATH_ACFRA) {
- int sind;
-
- /* With "Around Current", we only choose frames from around
- * the current frame to draw. However, this range is still
- * restricted by the limits of the original path.
- */
- sfra= CFRA - arm->pathbc;
- efra= CFRA + arm->pathac;
- if (sfra < pchan->pathsf) sfra= pchan->pathsf;
- if (efra > pchan->pathef) efra= pchan->pathef;
-
- len= efra - sfra;
-
- sind= sfra - pchan->pathsf;
- fp_start= (pchan->path + (3*sind));
- }
- else {
- sfra= pchan->pathsf;
- efra = sfra + pchan->pathlen;
- len = pchan->pathlen;
- fp_start = pchan->path;
- }
-
- /* draw curve-line of path */
- glShadeModel(GL_SMOOTH);
-
- glBegin(GL_LINE_STRIP);
- for (a=0, fp=fp_start; a<len; a++, fp+=3) {
- float intensity; /* how faint */
-
- /* set colour
- * - more intense for active/selected bones, less intense for unselected bones
- * - black for before current frame, green for current frame, blue for after current frame
- * - intensity decreases as distance from current frame increases
- */
- #define SET_INTENSITY(A, B, C, min, max) (((1.0f - ((C - B) / (C - A))) * (max-min)) + min)
- if ((a+sfra) < CFRA) {
- /* black - before cfra */
- if (pchan->bone->flag & BONE_SELECTED) {
- // intensity= 0.5;
- intensity = SET_INTENSITY(sfra, a, CFRA, 0.25f, 0.75f);
- }
- else {
- //intensity= 0.8;
- intensity = SET_INTENSITY(sfra, a, CFRA, 0.68f, 0.92f);
- }
- BIF_ThemeColorBlend(TH_WIRE, TH_BACK, intensity);
- }
- else if ((a+sfra) > CFRA) {
- /* blue - after cfra */
- if (pchan->bone->flag & BONE_SELECTED) {
- //intensity = 0.5;
- intensity = SET_INTENSITY(CFRA, a, efra, 0.25f, 0.75f);
- }
- else {
- //intensity = 0.8;
- intensity = SET_INTENSITY(CFRA, a, efra, 0.68f, 0.92f);
- }
- BIF_ThemeColorBlend(TH_BONE_POSE, TH_BACK, intensity);
- }
- else {
- /* green - on cfra */
- if (pchan->bone->flag & BONE_SELECTED) {
- intensity= 0.3;
- }
- else {
- intensity= 0.8;
- }
- BIF_ThemeColorBlend(TH_CFRAME, TH_BACK, intensity);
- }
-
- /* draw a vertex with this colour */
- glVertex3fv(fp);
- }
-
- glEnd();
- glShadeModel(GL_FLAT);
-
- glPointSize(1.0);
-
- /* draw little black point at each frame
- * NOTE: this is not really visible/noticable
- */
- glBegin(GL_POINTS);
- for (a=0, fp=fp_start; a<len; a++, fp+=3)
- glVertex3fv(fp);
- glEnd();
-
- /* Draw little white dots at each framestep value */
- BIF_ThemeColor(TH_TEXT_HI);
- glBegin(GL_POINTS);
- for (a=0, fp=fp_start; a<len; a+=stepsize, fp+=(stepsize*3))
- glVertex3fv(fp);
- glEnd();
-
- /* Draw frame numbers at each framestep value */
- if (arm->pathflag & ARM_PATH_FNUMS) {
- for (a=0, fp=fp_start; a<len; a+=stepsize, fp+=(stepsize*3)) {
- char str[32];
-
- /* only draw framenum if several consecutive highlighted points don't occur on same point */
- if (a == 0) {
- glRasterPos3fv(fp);
- sprintf(str, " %d\n", (a+sfra));
- BMF_DrawString(G.font, str);
- }
- else if ((a > stepsize) && (a < len-stepsize)) {
- if ((VecEqual(fp, fp-(stepsize*3))==0) || (VecEqual(fp, fp+(stepsize*3))==0)) {
- glRasterPos3fv(fp);
- sprintf(str, " %d\n", (a+sfra));
- BMF_DrawString(G.font, str);
- }
- }
- }
- }
-
- /* Keyframes - dots and numbers */
- if (arm->pathflag & ARM_PATH_KFRAS) {
- /* build list of all keyframes in active action for pchan */
- keys.first = keys.last = NULL;
- act= ob_get_action(ob);
- if (act) {
- achan= get_action_channel(act, pchan->name);
- if (achan)
- ipo_to_keylist(achan->ipo, &keys, NULL);
- }
-
- /* Draw slightly-larger yellow dots at each keyframe */
- BIF_ThemeColor(TH_VERTEX_SELECT);
- glPointSize(5.0);
-
- glBegin(GL_POINTS);
- for (a=0, fp=fp_start; a<len; a++, fp+=3) {
- for (ak= keys.first; ak; ak= ak->next) {
- if (ak->cfra == (a+sfra))
- glVertex3fv(fp);
- }
- }
- glEnd();
-
- glPointSize(1.0);
-
- /* Draw frame numbers of keyframes */
- if ((arm->pathflag & ARM_PATH_FNUMS) || (arm->pathflag & ARM_PATH_KFNOS)) {
- for(a=0, fp=fp_start; a<len; a++, fp+=3) {
- for (ak= keys.first; ak; ak= ak->next) {
- if (ak->cfra == (a+sfra)) {
- char str[32];
-
- glRasterPos3fv(fp);
- sprintf(str, " %d\n", (a+sfra));
- BMF_DrawString(G.font, str);
- }
- }
- }
- }
-
- BLI_freelistN(&keys);
- }
- }
- }
- }
-
- if (G.vd->zbuf) glEnable(GL_DEPTH_TEST);
- glPopMatrix();
-}
-
-
-/* ---------- Ghosts --------- */
-
-/* helper function for ghost drawing - sets/removes flags for temporarily
- * hiding unselected bones while drawing ghosts
- */
-static void ghost_poses_tag_unselected(Object *ob, short unset)
-{
- bArmature *arm= ob->data;
- bPose *pose= ob->pose;
- bPoseChannel *pchan;
-
- /* don't do anything if no hiding any bones */
- if ((arm->flag & ARM_GHOST_ONLYSEL)==0)
- return;
-
- /* loop over all pchans, adding/removing tags as appropriate */
- for (pchan= pose->chanbase.first; pchan; pchan= pchan->next) {
- if ((pchan->bone) && (arm->layer & pchan->bone->layer)) {
- if (unset) {
- /* remove tags from all pchans if cleaning up */
- pchan->bone->flag &= ~BONE_HIDDEN_PG;
- }
- else {
- /* set tags on unselected pchans only */
- if ((pchan->bone->flag & BONE_SELECTED)==0)
- pchan->bone->flag |= BONE_HIDDEN_PG;
- }
- }
- }
-}
-
-/* draw ghosts that occur within a frame range
- * note: object should be in posemode
- */
-static void draw_ghost_poses_range(Base *base)
-{
- Object *ob= base->object;
- bArmature *arm= ob->data;
- bPose *posen, *poseo;
- float start, end, stepsize, range, colfac;
- int cfrao, flago, ipoflago;
-
- start = arm->ghostsf;
- end = arm->ghostef;
- if (end <= start)
- return;
-
- stepsize= (float)(arm->ghostsize);
- range= (float)(end - start);
-
- /* store values */
- ob->flag &= ~OB_POSEMODE;
- cfrao= CFRA;
- flago= arm->flag;
- arm->flag &= ~(ARM_DRAWNAMES|ARM_DRAWAXES);
- ipoflago= ob->ipoflag;
- ob->ipoflag |= OB_DISABLE_PATH;
-
- /* copy the pose */
- poseo= ob->pose;
- copy_pose(&posen, ob->pose, 1);
- ob->pose= posen;
- armature_rebuild_pose(ob, ob->data); /* child pointers for IK */
- ghost_poses_tag_unselected(ob, 0); /* hide unselected bones if need be */
-
- glEnable(GL_BLEND);
- if (G.vd->zbuf) glDisable(GL_DEPTH_TEST);
-
- /* draw from first frame of range to last */
- for (CFRA= start; CFRA<end; CFRA+=stepsize) {
- colfac = (end-CFRA)/range;
- BIF_ThemeColorShadeAlpha(TH_WIRE, 0, -128-(int)(120.0f*sqrt(colfac)));
-
- do_all_pose_actions(ob);
- where_is_pose(ob);
- draw_pose_channels(base, OB_WIRE);
- }
- glDisable(GL_BLEND);
- if (G.vd->zbuf) glEnable(GL_DEPTH_TEST);
-
- ghost_poses_tag_unselected(ob, 1); /* unhide unselected bones if need be */
- free_pose_channels(posen);
- MEM_freeN(posen);
-
- /* restore */
- CFRA= cfrao;
- ob->pose= poseo;
- arm->flag= flago;
- armature_rebuild_pose(ob, ob->data);
- ob->flag |= OB_POSEMODE;
- ob->ipoflag= ipoflago;
-}
-
-/* draw ghosts on keyframes in action within range
- * - object should be in posemode
- */
-static void draw_ghost_poses_keys(Base *base)
-{
- Object *ob= base->object;
- bAction *act= ob_get_action(ob);
- bArmature *arm= ob->data;
- bPose *posen, *poseo;
- ListBase keys= {NULL, NULL};
- ActKeyColumn *ak, *akn;
- float start, end, range, colfac, i;
- int cfrao, flago, ipoflago;
-
- start = arm->ghostsf;
- end = arm->ghostef;
- if (end <= start)
- return;
-
- /* get keyframes - then clip to only within range */
- action_to_keylist(act, &keys, NULL);
- range= 0;
- for (ak= keys.first; ak; ak= akn) {
- akn= ak->next;
-
- if ((ak->cfra < start) || (ak->cfra > end))
- BLI_freelinkN(&keys, ak);
- else
- range++;
- }
- if (range == 0) return;
-
- /* store values */
- ob->flag &= ~OB_POSEMODE;
- cfrao= CFRA;
- flago= arm->flag;
- arm->flag &= ~(ARM_DRAWNAMES|ARM_DRAWAXES);
- ipoflago= ob->ipoflag;
- ob->ipoflag |= OB_DISABLE_PATH;
-
- /* copy the pose */
- poseo= ob->pose;
- copy_pose(&posen, ob->pose, 1);
- ob->pose= posen;
- armature_rebuild_pose(ob, ob->data); /* child pointers for IK */
- ghost_poses_tag_unselected(ob, 0); /* hide unselected bones if need be */
-
- glEnable(GL_BLEND);
- if (G.vd->zbuf) glDisable(GL_DEPTH_TEST);
-
- /* draw from first frame of range to last */
- for (ak=keys.first, i=0; ak; ak=ak->next, i++) {
- colfac = i/range;
- BIF_ThemeColorShadeAlpha(TH_WIRE, 0, -128-(int)(120.0f*sqrt(colfac)));
-
- CFRA= (int)ak->cfra;
-
- do_all_pose_actions(ob);
- where_is_pose(ob);
- draw_pose_channels(base, OB_WIRE);
- }
- glDisable(GL_BLEND);
- if (G.vd->zbuf) glEnable(GL_DEPTH_TEST);
-
- ghost_poses_tag_unselected(ob, 1); /* unhide unselected bones if need be */
- free_pose_channels(posen);
- BLI_freelistN(&keys);
- MEM_freeN(posen);
-
- /* restore */
- CFRA= cfrao;
- ob->pose= poseo;
- arm->flag= flago;
- armature_rebuild_pose(ob, ob->data);
- ob->flag |= OB_POSEMODE;
- ob->ipoflag= ipoflago;
-}
-
-/* draw ghosts around current frame
- * - object is supposed to be armature in posemode
- */
-static void draw_ghost_poses(Base *base)
-{
- Object *ob= base->object;
- bArmature *arm= ob->data;
- bPose *posen, *poseo;
- bActionStrip *strip;
- float cur, start, end, stepsize, range, colfac, actframe, ctime;
- int cfrao, maptime, flago, ipoflago;
-
- /* pre conditions, get an action with sufficient frames */
- if (ob->action==NULL)
- return;
-
- calc_action_range(ob->action, &start, &end, 0);
- if (start == end)
- return;
-
- stepsize= (float)(arm->ghostsize);
- range= (float)(arm->ghostep)*stepsize + 0.5f; /* plus half to make the for loop end correct */
-
- /* we only map time for armature when an active strip exists */
- for (strip=ob->nlastrips.first; strip; strip=strip->next)
- if (strip->flag & ACTSTRIP_ACTIVE)
- break;
-
- maptime= (strip!=NULL);
-
- /* store values */
- ob->flag &= ~OB_POSEMODE;
- cfrao= CFRA;
- if (maptime) actframe= get_action_frame(ob, (float)CFRA);
- else actframe= CFRA;
- flago= arm->flag;
- arm->flag &= ~(ARM_DRAWNAMES|ARM_DRAWAXES);
- ipoflago= ob->ipoflag;
- ob->ipoflag |= OB_DISABLE_PATH;
-
- /* copy the pose */
- poseo= ob->pose;
- copy_pose(&posen, ob->pose, 1);
- ob->pose= posen;
- armature_rebuild_pose(ob, ob->data); /* child pointers for IK */
- ghost_poses_tag_unselected(ob, 0); /* hide unselected bones if need be */
-
- glEnable(GL_BLEND);
- if (G.vd->zbuf) glDisable(GL_DEPTH_TEST);
-
- /* draw from darkest blend to lowest */
- for(cur= stepsize; cur<range; cur+=stepsize) {
- ctime= cur - fmod((float)cfrao, stepsize); /* ensures consistant stepping */
- colfac= ctime/range;
- BIF_ThemeColorShadeAlpha(TH_WIRE, 0, -128-(int)(120.0f*sqrt(colfac)));
-
- /* only within action range */
- if (actframe+ctime >= start && actframe+ctime <= end) {
- if (maptime) CFRA= (int)get_action_frame_inv(ob, actframe+ctime);
- else CFRA= (int)floor(actframe+ctime);
-
- if (CFRA!=cfrao) {
- do_all_pose_actions(ob);
- where_is_pose(ob);
- draw_pose_channels(base, OB_WIRE);
- }
- }
-
- ctime= cur + fmod((float)cfrao, stepsize) - stepsize+1.0f; /* ensures consistant stepping */
- colfac= ctime/range;
- BIF_ThemeColorShadeAlpha(TH_WIRE, 0, -128-(int)(120.0f*sqrt(colfac)));
-
- /* only within action range */
- if ((actframe-ctime >= start) && (actframe-ctime <= end)) {
- if (maptime) CFRA= (int)get_action_frame_inv(ob, actframe-ctime);
- else CFRA= (int)floor(actframe-ctime);
-
- if (CFRA != cfrao) {
- do_all_pose_actions(ob);
- where_is_pose(ob);
- draw_pose_channels(base, OB_WIRE);
- }
- }
- }
- glDisable(GL_BLEND);
- if (G.vd->zbuf) glEnable(GL_DEPTH_TEST);
-
- ghost_poses_tag_unselected(ob, 1); /* unhide unselected bones if need be */
- free_pose_channels(posen);
- MEM_freeN(posen);
-
- /* restore */
- CFRA= cfrao;
- ob->pose= poseo;
- arm->flag= flago;
- armature_rebuild_pose(ob, ob->data);
- ob->flag |= OB_POSEMODE;
- ob->ipoflag= ipoflago;
-}
-
-/* ********************************** Armature Drawing - Main ************************* */
-
-/* called from drawobject.c, return 1 if nothing was drawn */
-int draw_armature(Base *base, int dt)
-{
- Object *ob= base->object;
- bArmature *arm= ob->data;
- int retval= 0;
-
- if(dt>OB_WIRE && arm->drawtype!=ARM_LINE) {
- /* we use color for solid lighting */
- glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR);
- glEnable(GL_COLOR_MATERIAL);
- glColor3ub(0,0,0); // clear spec
- glDisable(GL_COLOR_MATERIAL);
-
- glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
- glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW); // only for lighting...
- }
-
- /* arm->flag is being used to detect mode... */
- /* editmode? */
- if(ob==G.obedit || (G.obedit && ob->data==G.obedit->data)) {
- if(ob==G.obedit) arm->flag |= ARM_EDITMODE;
- draw_ebones(ob, dt);
- arm->flag &= ~ARM_EDITMODE;
- }
- else{
- /* Draw Pose */
- if(ob->pose && ob->pose->chanbase.first) {
- /* drawing posemode selection indices or colors only in these cases */
- if(!(base->flag & OB_FROMDUPLI)) {
- if(G.f & G_PICKSEL) {
- if(ob->flag & OB_POSEMODE)
- arm->flag |= ARM_POSEMODE;
- }
- else if(ob->flag & OB_POSEMODE) {
- if (arm->ghosttype == ARM_GHOST_RANGE) {
- draw_ghost_poses_range(base);
- }
- else if (arm->ghosttype == ARM_GHOST_KEYS) {
- draw_ghost_poses_keys(base);
- }
- else if (arm->ghosttype == ARM_GHOST_CUR) {
- if (arm->ghostep)
- draw_ghost_poses(base);
- }
-
- if(ob==OBACT)
- arm->flag |= ARM_POSEMODE;
- else if(G.f & G_WEIGHTPAINT)
- arm->flag |= ARM_POSEMODE;
-
- draw_pose_paths(ob);
- }
- }
- draw_pose_channels(base, dt);
- arm->flag &= ~ARM_POSEMODE;
-
- if(ob->flag & OB_POSEMODE)
- BIF_ThemeColor(TH_WIRE); /* restore, for extra draw stuff */
- }
- else retval= 1;
- }
- /* restore */
- glFrontFace(GL_CCW);
-
- return retval;
-}
-
-/* *************** END Armature drawing ******************* */
-
diff --git a/source/blender/src/drawdeps.c b/source/blender/src/drawdeps.c
deleted file mode 100644
index d948f31009b..00000000000
--- a/source/blender/src/drawdeps.c
+++ /dev/null
@@ -1,316 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2004 Blender Foundation.
- * All rights reserved.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-
-#ifdef _WIN32
-#include "BLI_winstuff.h"
-#endif
-
-#include "BMF_Api.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "DNA_ID.h"
-#include "DNA_object_types.h"
-#include "DNA_oops_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_view2d_types.h"
-#include "DNA_action_types.h"
-
-#include "BKE_utildefines.h"
-#include "BKE_global.h"
-
-#include "BIF_interface.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-#include "BIF_mywindow.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-
-#include "BIF_oops.h"
-
-#include "BSE_drawipo.h"
-#include "BSE_drawoops.h"
-#include "MEM_guardedalloc.h"
-#include "blendef.h"
-
-
-#include "depsgraph_private.h"
-
-#ifdef WIN32
-#else
-#include <sys/time.h>
-#endif
-
-
-
-void boundbox_deps()
-{
- DagNode *node;
- float min[2], max[2];
-
- if(G.soops==0) return;
-
- min[0]= 1000.0;
- max[0]= -10000.0;
- min[1]= 1000.0;
- max[1]= -1000.0;
-
- node = getMainDag()->DagNode.first;
- while(node) {
- min[0]= MIN2(min[0], node->x);
- max[0]= MAX2(max[0], node->x+OOPSX);
- min[1]= MIN2(min[1], node->y);
- max[1]= MAX2(max[1], node->y+OOPSY);
-
- node= node->next;
- }
-
- G.v2d->tot.xmin= min[0];
- G.v2d->tot.xmax= max[0];
- G.v2d->tot.ymin= min[1];
- G.v2d->tot.ymax= max[1];
-}
-
-static unsigned int get_line_color(DagAdjList *child)
-{
- switch (child->type) {
- case DAG_RL_SCENE :
- return 0x00000;
- case DAG_RL_DATA :
- return 0xFF0000;
- case DAG_RL_OB_OB :
- return 0x00FF00;
- case DAG_RL_OB_DATA :
- return 0xFFFF00;
- case DAG_RL_DATA_OB :
- return 0x000000;
- case DAG_RL_DATA_DATA :
- return 0x0000FF;
- default :
- return 0xFF00FF;
- }
- //return 0x00000;
-}
-
-
-static void draw_deps(DagNode *node)
-{
- float v1[2], x1, y1, x2, y2;
- unsigned int body, border;
- short line= 0;
- char str[32];
- DagAdjList *itA = node->child;
-
- x1= node->x;
- x2= node->x+DEPSX;
- y1= node->y;
- y2= node->y+DEPSY;
-
- if(x2 < G.v2d->cur.xmin || x1 > G.v2d->cur.xmax) return;
- if(y2 < G.v2d->cur.ymin || y1 > G.v2d->cur.ymax) return;
-
- body = give_oops_color(node->type, 0, &border);
-
- line= 0;
-// border= 00;
- cpack(body);
-
- glRectf(x1, y1, x2, y2);
-
- v1[0]= x1;
- v1[1]= (y1+y2)/2 -0.3f;
- sprintf(str, " %s", ((ID *) node->ob)->name+2);
-
- calc_oopstext(str, v1);
-
- /* ICON */
-// if(str[1] && oopscalex>1.1) {
- draw_icon_oops(v1, node->type);
-// }
-
-
- cpack(0x0);
- glRasterPos3f(v1[0], v1[1], 0.0);
- BMF_DrawString(G.fonts, str);
-
-
- if(line) setlinestyle(2);
- cpack(border);
-
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- glRectf(x1, y1, x2, y2);
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- if(line) setlinestyle(0);
-
- while (itA) { /* draw connection lines */
- cpack(get_line_color(itA));
- glBegin(GL_LINE_STRIP);
- glVertex2f(node->x+DEPSX, node->y+ 0.5*DEPSY);
- glVertex2f(itA->node->x, itA->node->y+ 0.5*DEPSY);
- glEnd();
- itA = itA->next;
- }
- /* Draw the little rounded connection point */
- glColor3ub(0, 0, 0);
- glPushMatrix();
-
- glTranslatef(node->x , node->y+ 0.5*DEPSY, 0.0);
- glutil_draw_filled_arc(-M_PI/2, M_PI, 0.07*DEPSX, 7);
-
- glPopMatrix();
-
-}
-
-void draw_all_deps(void)
-{
- DagNode *node;
- DagForest *dag;
-
- dag = getMainDag();
- node = dag->DagNode.first;
- //node = node->next;
- while(node) {
- draw_deps(node);
- node = node->next;
- }
- free_forest(dag);
- MEM_freeN(dag);
- setMainDag(NULL);
-}
-
-
-
-
-int build_deps(short mask)
-{
- Base *base;
- Object *ob = NULL;
- DagNode * node = NULL;
- DagNode * node2 = NULL ;
-DagNode * scenenode;
- DagForest *dag;
-
-#ifdef DEPS_DEBUG
- //timers
- struct timeval tp1, tp2, tp3, tp4;
-
- gettimeofday(&tp1,NULL);
-#endif
-
- DagNodeQueue *retqueue;
-
-// float y = 0;
-// int maxlev = 0;
-
- if(G.soops==0) return -1;
-
-
- // rebuilt each time for now
- dag = getMainDag();
- if ( dag)
- free_forest( dag );
- else {
- dag = dag_init();
- setMainDag(dag);
- }
-
- // add base node for scene. scene is always the first node in DAG
- scenenode = dag_add_node(dag, G.scene);
- set_node_xy(scenenode,0.0, 0.0);
- /* blocks from this scene */
-
-
- /* targets in object struct yet to be added. should even they ?
- struct Ipo *ipo;
- ListBase nlastrips;
- ListBase hooks;
- */
-
-
- base= FIRSTBASE;
- while(base) { // add all objects in any case
- int addtoroot = 1;
-
- // graph_print_adj_list();
- ob= (Object *) base->object;
-
- node = dag_get_node(dag,ob);
-
- if ((ob->data) && (mask&DAG_RL_DATA)) {
- node2 = dag_get_node(dag,ob->data);
- dag_add_relation(dag,node,node2,DAG_RL_DATA);
- node2->first_ancestor = ob;
- node2->ancestor_count += 1;
-
- }
-
- if (addtoroot == 1 )
- dag_add_relation(dag,scenenode,node,DAG_RL_SCENE);
-
- base= base->next;
- }
-
-//graph_print_adj_list();
-//fprintf(stderr,"building deps\n");
-#ifdef DEPS_DEBUG
- gettimeofday(&tp2,NULL);
-#endif
-
-//graph_bfs(); //set levels
-
-#ifdef DEPS_DEBUG
-gettimeofday(&tp3,NULL);
-#endif
-
-
-retqueue = graph_dfs(); //set levels
-#ifdef DEPS_DEBUG
-gettimeofday(&tp4,NULL);
-fprintf(stderr,"************************************\n");
-graph_print_queue_dist(retqueue);
-//graph_print_queue(retqueue);
-
-fprintf(stderr,"TIME BUILD %d %d BFS %d %d DFS %d %d\n",tp2.tv_sec-tp1.tv_sec ,tp2.tv_usec-tp1.tv_usec
- , tp3.tv_sec-tp2.tv_sec ,tp3.tv_usec-tp2.tv_usec
- , tp4.tv_sec-tp3.tv_sec ,tp4.tv_usec-tp3.tv_usec);
-#endif
-
-queue_delete(retqueue);
-
-//graph_print_adj_list();
-return 0;
-}
diff --git a/source/blender/src/drawimage.c b/source/blender/src/drawimage.c
deleted file mode 100644
index 65ee3077adb..00000000000
--- a/source/blender/src/drawimage.c
+++ /dev/null
@@ -1,2721 +0,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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Blender Foundation, 2002-2006
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include <math.h>
-#include <string.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef WIN32
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-#include "MEM_guardedalloc.h"
-
-#include "BLI_arithb.h"
-#include "BLI_blenlib.h"
-#include "BLI_editVert.h"
-
-#include "IMB_imbuf.h"
-#include "IMB_imbuf_types.h"
-
-#include "DNA_brush_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_color_types.h"
-#include "DNA_image_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_node_types.h"
-#include "DNA_object_types.h"
-#include "DNA_packedFile_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_userdef_types.h"
-
-#include "BKE_brush.h"
-#include "BKE_colortools.h"
-#include "BKE_utildefines.h"
-#include "BKE_global.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
-#include "BKE_mesh.h"
-#include "BKE_node.h"
-#include "BKE_image.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_displist.h"
-#include "BKE_object.h"
-
-#include "BDR_editface.h"
-#include "BDR_drawobject.h"
-#include "BDR_drawmesh.h"
-#include "BDR_imagepaint.h"
-
-#include "BIF_cursors.h"
-#include "BIF_gl.h"
-#include "BIF_graphics.h"
-#include "BIF_mywindow.h"
-#include "BIF_drawimage.h"
-#include "BIF_resources.h"
-#include "BIF_interface.h"
-#include "BIF_interface_icons.h"
-#include "BIF_editsima.h"
-#include "BIF_glutil.h"
-#include "BIF_renderwin.h"
-#include "BIF_space.h"
-#include "BIF_screen.h"
-#include "BIF_toolbox.h"
-#include "BIF_transform.h"
-#include "BIF_editmesh.h"
-
-#include "BSE_drawipo.h"
-#include "BSE_drawview.h"
-#include "BSE_filesel.h"
-#include "BSE_headerbuttons.h"
-#include "BSE_node.h"
-#include "BSE_trans_types.h"
-#include "BSE_view.h"
-
-#include "RE_pipeline.h"
-#include "BMF_Api.h"
-
-#include "PIL_time.h"
-
-/* Modules used */
-#include "mydevice.h"
-#include "blendef.h"
-#include "butspace.h" // event codes
-#include "winlay.h"
-
-#include "interface.h" /* bad.... but preview code needs UI info. Will solve... (ton) */
-
-static unsigned char *alloc_alpha_clone_image(int *width, int *height)
-{
- Brush *brush = G.scene->toolsettings->imapaint.brush;
- ImBuf *ibuf;
- unsigned int size, alpha;
- unsigned char *rect, *cp;
-
- if(!brush || !brush->clone.image)
- return NULL;
-
- ibuf= BKE_image_get_ibuf(brush->clone.image, NULL);
-
- if(!ibuf || !ibuf->rect)
- return NULL;
-
- rect= MEM_dupallocN(ibuf->rect);
- if(!rect)
- return NULL;
-
- *width= ibuf->x;
- *height= ibuf->y;
-
- size= (*width)*(*height);
- alpha= (unsigned char)255*brush->clone.alpha;
- cp= rect;
-
- while(size-- > 0) {
- cp[3]= alpha;
- cp += 4;
- }
-
- return rect;
-}
-
-static int image_preview_active(ScrArea *sa, float *xim, float *yim)
-{
- SpaceImage *sima= sa->spacedata.first;
-
- /* only when compositor shows, and image handler set */
- if(sima->image && sima->image->type==IMA_TYPE_COMPOSITE) {
- short a;
-
- for(a=0; a<SPACE_MAXHANDLER; a+=2) {
- if(sima->blockhandler[a] == IMAGE_HANDLER_PREVIEW) {
- if(xim) *xim= (G.scene->r.size*G.scene->r.xsch)/100;
- if(yim) *yim= (G.scene->r.size*G.scene->r.ysch)/100;
- return 1;
- }
- }
- }
- return 0;
-}
-
-
-/**
- * Sets up the fields of the View2D member of the SpaceImage struct
- * This routine can be called in two modes:
- * mode == 'f': float mode (0.0 - 1.0)
- * mode == 'p': pixel mode (0 - size)
- *
- * @param sima the image space to update
- * @param mode the mode to use for the update
- * @return void
- *
- */
-void calc_image_view(SpaceImage *sima, char mode)
-{
- float xim=256, yim=256;
- float x1, y1;
-
- if(image_preview_active(curarea, &xim, &yim));
- else if(sima->image) {
- ImBuf *ibuf= BKE_image_get_ibuf(sima->image, &sima->iuser);
- float xuser_asp, yuser_asp;
-
- aspect_sima(sima, &xuser_asp, &yuser_asp);
- if(ibuf) {
- xim= ibuf->x * xuser_asp;
- yim= ibuf->y * yuser_asp;
- }
- else if( sima->image->type==IMA_TYPE_R_RESULT ) {
- /* not very important, just nice */
- xim= (G.scene->r.xsch*G.scene->r.size)/100;
- yim= (G.scene->r.ysch*G.scene->r.size)/100;
- }
- }
-
- sima->v2d.tot.xmin= 0;
- sima->v2d.tot.ymin= 0;
- sima->v2d.tot.xmax= xim;
- sima->v2d.tot.ymax= yim;
-
- sima->v2d.mask.xmin= sima->v2d.mask.ymin= 0;
- sima->v2d.mask.xmax= curarea->winx;
- sima->v2d.mask.ymax= curarea->winy;
-
-
- /* Which part of the image space do we see? */
- /* Same calculation as in lrectwrite: area left and down*/
- x1= curarea->winrct.xmin+(curarea->winx-sima->zoom*xim)/2;
- y1= curarea->winrct.ymin+(curarea->winy-sima->zoom*yim)/2;
-
- x1-= sima->zoom*sima->xof;
- y1-= sima->zoom*sima->yof;
-
- /* relative display right */
- sima->v2d.cur.xmin= ((curarea->winrct.xmin - (float)x1)/sima->zoom);
- sima->v2d.cur.xmax= sima->v2d.cur.xmin + ((float)curarea->winx/sima->zoom);
-
- /* relative display left */
- sima->v2d.cur.ymin= ((curarea->winrct.ymin-(float)y1)/sima->zoom);
- sima->v2d.cur.ymax= sima->v2d.cur.ymin + ((float)curarea->winy/sima->zoom);
-
- if(mode=='f') {
- sima->v2d.cur.xmin/= xim;
- sima->v2d.cur.xmax/= xim;
- sima->v2d.cur.ymin/= yim;
- sima->v2d.cur.ymax/= yim;
- }
-}
-
-/* check for facelesect, and set active image */
-void what_image(SpaceImage *sima)
-{
- MTFace *activetf;
-
- if( (sima->mode!=SI_TEXTURE) ||
- (sima->image && sima->image->source==IMA_SRC_VIEWER) ||
- (G.obedit != OBACT) ||
- (sima->pin)
- ) {
- return;
- }
-
- /* viewer overrides uv editmode */
- if (EM_texFaceCheck()) {
- sima->image= NULL;
-
- activetf = get_active_mtface(NULL, NULL, 1); /* partially selected face is ok */
-
- if(activetf && activetf->mode & TF_TEX) {
- if (!sima->pin)
- sima->image= activetf->tpage;
-
- if(sima->flag & SI_EDITTILE);
- else sima->curtile= activetf->tile;
-
- if(sima->image) {
- if(activetf->mode & TF_TILES)
- sima->image->tpageflag |= IMA_TILES;
- else sima->image->tpageflag &= ~IMA_TILES;
- }
- }
- }
-}
-
-/* after a what_image(), this call will give ibufs, includes the spare image */
-ImBuf *imagewindow_get_ibuf(SpaceImage *sima)
-{
-
- if(G.sima->image) {
- /* check for spare */
- if(sima->image->type==IMA_TYPE_R_RESULT && sima->showspare)
- return sima->spare;
- else
- return BKE_image_get_ibuf(sima->image, &sima->iuser);
- }
- return NULL;
-}
-
-extern int EM_texFaceCheck(void); /* from editmesh.c */
-/* called to assign images to UV faces */
-void image_changed(SpaceImage *sima, Image *image)
-{
- MTFace *tface;
- EditMesh *em = G.editMesh;
- EditFace *efa;
- ImBuf *ibuf = NULL;
- short change = 0;
-
- if(image==NULL) {
- sima->flag &= ~SI_DRAWTOOL;
- } else {
- ibuf = BKE_image_get_ibuf(image, NULL);
- }
-
- if(sima->mode!=SI_TEXTURE)
- return;
-
- /* skip assigning these procedural images... */
- if(image && (image->type==IMA_TYPE_R_RESULT || image->type==IMA_TYPE_COMPOSITE)) {
- return;
- } else if ((G.obedit) &&
- (G.obedit->type == OB_MESH) &&
- (G.editMesh) &&
- (G.editMesh->faces.first)
- ) {
-
- /* Add a UV layer if there is none, editmode only */
- if ( !CustomData_has_layer(&G.editMesh->fdata, CD_MTFACE) ) {
- EM_add_data_layer(&em->fdata, CD_MTFACE);
- CustomData_set_layer_active(&em->fdata, CD_MTFACE, 0); /* always zero because we have no other UV layers */
- change = 1; /* so we update the object, incase no faces are selected */
-
- /* BIF_undo_push("New UV Texture"); - undo should be done by whatever changes the image */
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- }
-
- for (efa= em->faces.first; efa; efa= efa->next) {
- tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (efa->h==0 && efa->f & SELECT) {
- if (image) {
- tface->tpage= image;
- tface->mode |= TF_TEX;
-
- if(image->tpageflag & IMA_TILES) tface->mode |= TF_TILES;
- else tface->mode &= ~TF_TILES;
-
- if(image->id.us==0) id_us_plus(&image->id);
- else id_lib_extern(&image->id);
-
- if (tface->transp==TF_ADD) {} /* they obviously know what they are doing! - leave as is */
- else if (ibuf && ibuf->depth == 32) tface->transp = TF_ALPHA;
- else tface->transp = TF_SOLID;
-
- } else {
- tface->tpage= NULL;
- tface->mode &= ~TF_TEX;
- tface->transp = TF_SOLID;
- }
- change = 1;
- }
- }
- }
- /* change the space image after because simaFaceDraw_Check uses the space image
- * to check if the face is displayed in UV-localview */
- sima->image = image;
-
- if (change)
- object_uvs_changed(OBACT);
-
- allqueue(REDRAWBUTSEDIT, 0);
-}
-/*
- * dotile - 1, set the tile flag (from the space image)
- * 2, set the tile index for the faces.
- * */
-void image_set_tile(SpaceImage *sima, int dotile)
-{
- MTFace *tface;
- EditMesh *em = G.editMesh;
- EditFace *efa;
-
- if(!sima->image || sima->mode!=SI_TEXTURE || !EM_texFaceCheck())
- return;
-
- /* skip assigning these procedural images... */
- if(sima->image && (sima->image->type==IMA_TYPE_R_RESULT || sima->image->type==IMA_TYPE_COMPOSITE))
- return;
-
- for (efa= em->faces.first; efa; efa= efa->next) {
- tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (efa->h==0 && efa->f & SELECT) {
- if (dotile==1) {
- /* set tile flag */
- if (sima->image->tpageflag & IMA_TILES) {
- tface->mode |= TF_TILES;
- } else {
- tface->mode &= ~TF_TILES;
- }
- } else if (dotile==2) {
- /* set tile index */
- tface->tile= sima->curtile;
- }
- }
- }
- object_uvs_changed(OBACT);
- allqueue(REDRAWBUTSEDIT, 0);
-}
-
-
-
-void uvco_to_areaco(float *vec, short *mval)
-{
- float x, y;
-
- mval[0]= IS_CLIPPED;
-
- x= (vec[0] - G.v2d->cur.xmin)/(G.v2d->cur.xmax-G.v2d->cur.xmin);
- y= (vec[1] - G.v2d->cur.ymin)/(G.v2d->cur.ymax-G.v2d->cur.ymin);
-
- if(x>=0.0 && x<=1.0) {
- if(y>=0.0 && y<=1.0) {
- mval[0]= G.v2d->mask.xmin + x*(G.v2d->mask.xmax-G.v2d->mask.xmin);
- mval[1]= G.v2d->mask.ymin + y*(G.v2d->mask.ymax-G.v2d->mask.ymin);
- }
- }
-}
-
-void uvco_to_areaco_noclip(float *vec, int *mval)
-{
- float x, y;
-
- mval[0]= IS_CLIPPED;
-
- x= (vec[0] - G.v2d->cur.xmin)/(G.v2d->cur.xmax-G.v2d->cur.xmin);
- y= (vec[1] - G.v2d->cur.ymin)/(G.v2d->cur.ymax-G.v2d->cur.ymin);
-
- x= G.v2d->mask.xmin + x*(G.v2d->mask.xmax-G.v2d->mask.xmin);
- y= G.v2d->mask.ymin + y*(G.v2d->mask.ymax-G.v2d->mask.ymin);
-
- mval[0]= x;
- mval[1]= y;
-}
-
-static void drawcursor_sima(float xuser_asp, float yuser_asp)
-{
- int wi, hi;
- float w, h;
-
- if (!G.obedit || !CustomData_has_layer(&G.editMesh->fdata, CD_MTFACE)) return;
-
- transform_width_height_tface_uv(&wi, &hi);
- w = (((float)wi)/256.0f)*G.sima->zoom * xuser_asp;
- h = (((float)hi)/256.0f)*G.sima->zoom * yuser_asp;
-
- cpack(0xFFFFFF);
- glTranslatef(G.v2d->cursor[0], G.v2d->cursor[1], 0.0f);
- fdrawline(-0.05/w, 0, 0, 0.05/h);
- fdrawline(0, 0.05/h, 0.05/w, 0);
- fdrawline(0.05/w, 0, 0, -0.05/h);
- fdrawline(0, -0.05/h, -0.05/w, 0);
-
- setlinestyle(4);
- cpack(0xFF);
- fdrawline(-0.05/w, 0, 0, 0.05/h);
- fdrawline(0, 0.05/h, 0.05/w, 0);
- fdrawline(0.05/w, 0, 0, -0.05/h);
- fdrawline(0, -0.05/h, -0.05/w, 0);
-
-
- setlinestyle(0);
- cpack(0x0);
- fdrawline(-0.020/w, 0, -0.1/w, 0);
- fdrawline(0.1/w, 0, .020/w, 0);
- fdrawline(0, -0.020/h, 0, -0.1/h);
- fdrawline(0, 0.1/h, 0, 0.020/h);
-
- setlinestyle(1);
- cpack(0xFFFFFF);
- fdrawline(-0.020/w, 0, -0.1/w, 0);
- fdrawline(0.1/w, 0, .020/w, 0);
- fdrawline(0, -0.020/h, 0, -0.1/h);
- fdrawline(0, 0.1/h, 0, 0.020/h);
-
- glTranslatef(-G.v2d->cursor[0], -G.v2d->cursor[1], 0.0f);
- setlinestyle(0);
-}
-
-// checks if we are selecting only faces
-int draw_uvs_face_check(void)
-{
- if (G.sima==NULL)
- return 0;
- if (G.sima->flag & SI_SYNC_UVSEL && G.scene->selectmode == SCE_SELECT_FACE)
- return 2;
- if (G.sima->flag & SI_SELACTFACE)
- return 1;
- return 0;
-}
-
-void tface_center(MTFace *tf, float cent[2], void * isquad)
-{
-
- if (isquad) {
- cent[0] = (tf->uv[0][0] + tf->uv[1][0] + tf->uv[2][0] + tf->uv[3][0]) / 4.0;
- cent[1] = (tf->uv[0][1] + tf->uv[1][1] + tf->uv[2][1] + tf->uv[3][1]) / 4.0;
- } else {
- cent[0] = (tf->uv[0][0] + tf->uv[1][0] + tf->uv[2][0]) / 3.0;
- cent[1] = (tf->uv[0][1] + tf->uv[1][1] + tf->uv[2][1]) / 3.0;
- }
-}
-
-/* draws uv's in the image space */
-void draw_uvs_sima(void)
-{
- MTFace *tface,*activetface = NULL;
- EditMesh *em = G.editMesh;
- EditFace *efa, *efa_act;
-
- char col1[4], col2[4];
- float pointsize;
- int drawface;
-
- if (!G.obedit || !CustomData_has_layer(&em->fdata, CD_MTFACE))
- return;
-
- drawface = draw_uvs_face_check();
-
- calc_image_view(G.sima, 'f'); /* float */
- myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax);
- glLoadIdentity();
-
-
- if(G.sima->flag & SI_DRAWTOOL) {
- /* draws the grey mesh when painting */
- glColor3ub(112, 112, 112);
- for (efa= em->faces.first; efa; efa= efa->next) {
- tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- glBegin(GL_LINE_LOOP);
- glVertex2fv(tface->uv[0]);
- glVertex2fv(tface->uv[1]);
- glVertex2fv(tface->uv[2]);
- if(efa->v4) glVertex2fv(tface->uv[3]);
- glEnd();
- }
- return; /* only draw shadow mesh */
- } else if (G.sima->flag & SI_DRAWSHADOW) {
- /* draw shadow mesh - this is the mesh with the modifier applied */
- glColor3ub(112, 112, 112);
- if ( em->derivedFinal &&
- em->derivedFinal->drawUVEdges &&
- CustomData_has_layer(&em->derivedFinal->faceData, CD_MTFACE)
- ) {
- /* we can use the existing final mesh */
- glColor3ub(112, 112, 112);
- em->derivedFinal->drawUVEdges(em->derivedFinal);
- } else {
- DerivedMesh *finalDM, *cageDM;
-
- /* draw final mesh with modifiers applied */
- cageDM = editmesh_get_derived_cage_and_final(&finalDM, CD_MASK_BAREMESH | CD_MASK_MTFACE);
-
- if (finalDM->drawUVEdges &&
- DM_get_face_data_layer(finalDM, CD_MTFACE) &&
- /* When sync selection is enabled, all faces are drawn (except for hidden)
- * so if cage is the same as the final, theres no point in drawing the shadowmesh. */
- !((G.sima->flag & SI_SYNC_UVSEL && cageDM==finalDM))
- ) {
- glColor3ub(112, 112, 112);
- finalDM->drawUVEdges(finalDM);
- }
-
- if (cageDM != finalDM)
- cageDM->release(cageDM);
- finalDM->release(finalDM);
- }
- }
-
- activetface = get_active_mtface(&efa_act, NULL, 0); /* will be set to NULL if hidden */
-
- /* draw transparent faces */
- if(G.f & G_DRAWFACES) {
- BIF_GetThemeColor4ubv(TH_FACE, col1);
- BIF_GetThemeColor4ubv(TH_FACE_SELECT, col2);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
-
- for (efa= em->faces.first; efa; efa= efa->next) {
- tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-
- if (simaFaceDraw_Check(efa, tface)) {
- efa->tmp.p = tface;
- if (tface==activetface) continue; /* important the temp pointer is set above */
- if( simaFaceSel_Check(efa, tface) )
- glColor4ubv((GLubyte *)col2);
- else
- glColor4ubv((GLubyte *)col1);
-
- glBegin(efa->v4?GL_QUADS:GL_TRIANGLES);
- glVertex2fv(tface->uv[0]);
- glVertex2fv(tface->uv[1]);
- glVertex2fv(tface->uv[2]);
- if(efa->v4) glVertex2fv(tface->uv[3]);
- glEnd();
-
- } else {
- if (tface == activetface)
- activetface= NULL;
- efa->tmp.p = NULL;
- }
- }
- } else {
- /* would be nice to do this within a draw loop but most below are optional, so it would involve too many checks */
- for (efa= em->faces.first; efa; efa= efa->next) {
- tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tface)) {
- efa->tmp.p = tface;
- } else {
- if (tface == activetface)
- activetface= NULL;
- efa->tmp.p = NULL;
- }
- }
- glDisable(GL_BLEND);
- }
-
- if (activetface) {
- GLubyte act_face_stipple[32*32/8] = DM_FACE_STIPPLE;
-
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- BIF_ThemeColor4(TH_EDITMESH_ACTIVE);
- glEnable(GL_POLYGON_STIPPLE);
- glPolygonStipple(act_face_stipple);
- glBegin(efa_act->v4?GL_QUADS:GL_TRIANGLES);
- glVertex2fv(activetface->uv[0]);
- glVertex2fv(activetface->uv[1]);
- glVertex2fv(activetface->uv[2]);
- if(efa_act->v4) glVertex2fv(activetface->uv[3]);
- glEnd();
- glDisable(GL_POLYGON_STIPPLE);
- glDisable(GL_BLEND);
- }
-
- if (G.sima->flag & SI_SMOOTH_UV) {
- glEnable( GL_LINE_SMOOTH );
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- }
-
- switch (G.sima->dt_uv) {
- case SI_UVDT_DASH:
- for (efa= em->faces.first; efa; efa= efa->next) {
-// tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-// if (simaFaceDraw_Check(efa, tface)) {
-
- /*this is a shortcut to do the same as above but a faster for drawing */
- if ((tface=(MTFace *)efa->tmp.p)) {
-
- cpack(0x111111);
- glBegin(GL_LINE_LOOP);
- glVertex2fv(tface->uv[0]);
- glVertex2fv(tface->uv[1]);
- glVertex2fv(tface->uv[2]);
- if(efa->v4) glVertex2fv(tface->uv[3]);
- glEnd();
-
- setlinestyle(2);
- cpack(0x909090);
- glBegin(GL_LINE_STRIP);
- glVertex2fv(tface->uv[0]);
- glVertex2fv(tface->uv[1]);
- glEnd();
-
- glBegin(GL_LINE_STRIP);
- glVertex2fv(tface->uv[0]);
- if(efa->v4) glVertex2fv(tface->uv[3]);
- else glVertex2fv(tface->uv[2]);
- glEnd();
-
- glBegin(GL_LINE_STRIP);
- glVertex2fv(tface->uv[1]);
- glVertex2fv(tface->uv[2]);
- if(efa->v4) glVertex2fv(tface->uv[3]);
- glEnd();
- setlinestyle(0);
- }
- }
- break;
- case SI_UVDT_BLACK: /* black/white */
- case SI_UVDT_WHITE:
- cpack((G.sima->dt_uv==SI_UVDT_WHITE) ? 0xFFFFFF : 0x0);
- for (efa= em->faces.first; efa; efa= efa->next) {
-// tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-// if (simaFaceDraw_Check(efa, tface)) {
-
- /*this is a shortcut to do the same as above but a faster for drawing */
- if ((tface=(MTFace *)efa->tmp.p)) {
-
- glBegin(GL_LINE_LOOP);
- glVertex2fv(tface->uv[0]);
- glVertex2fv(tface->uv[1]);
- glVertex2fv(tface->uv[2]);
- if(efa->v4) glVertex2fv(tface->uv[3]);
- glEnd();
- }
- }
- break;
- case SI_UVDT_OUTLINE:
- glLineWidth(3);
- cpack(0x0);
-
- for (efa= em->faces.first; efa; efa= efa->next) {
-// tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-// if (simaFaceDraw_Check(efa, tface)) {
-
- /*this is a shortcut to do the same as above but a faster for drawing */
- if ((tface=(MTFace *)efa->tmp.p)) {
-
- glBegin(GL_LINE_LOOP);
- glVertex2fv(tface->uv[0]);
- glVertex2fv(tface->uv[1]);
- glVertex2fv(tface->uv[2]);
- if(efa->v4) glVertex2fv(tface->uv[3]);
- glEnd();
- }
- }
-
- glLineWidth(1);
- cpack(0xFFFFFF);
- for (efa= em->faces.first; efa; efa= efa->next) {
-// tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-// if (simaFaceDraw_Check(efa, tface)) {
-
- /*this is a shortcut to do the same as above but a faster for drawing */
- if ((tface=(MTFace *)efa->tmp.p)) {
-
- glBegin(GL_LINE_LOOP);
- glVertex2fv(tface->uv[0]);
- glVertex2fv(tface->uv[1]);
- glVertex2fv(tface->uv[2]);
- if(efa->v4) glVertex2fv(tface->uv[3]);
- glEnd();
- }
- }
- break;
- }
-
- if (G.sima->flag & SI_SMOOTH_UV) {
- glDisable( GL_LINE_SMOOTH);
- glDisable(GL_BLEND);
- }
-
- if (drawface) {
- // draw UV face points
- float cent[2];
-
-
- /* unselected faces's */
- pointsize = BIF_GetThemeValuef(TH_FACEDOT_SIZE);
- // TODO - drawobject.c changes this value after - Investiagate!
- glPointSize(pointsize);
-
- BIF_ThemeColor(TH_WIRE);
- bglBegin(GL_POINTS);
- for (efa= em->faces.first; efa; efa= efa->next) {
-
-// tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-// if (simaFaceDraw_Check(efa, tface)) {
-
- /*this is a shortcut to do the same as above but a faster for drawing */
- if ((tface=(MTFace *)efa->tmp.p)) {
- if( ! simaFaceSel_Check(efa, tface) ) {
- tface_center(tface, cent, (void *)efa->v4);
- bglVertex2fv(cent);
- }
- }
- }
- bglEnd();
- /* selected faces's */
- BIF_ThemeColor(TH_FACE_DOT);
- bglBegin(GL_POINTS);
- for (efa= em->faces.first; efa; efa= efa->next) {
-
-// tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-// if (simaFaceDraw_Check(efa, tface)) {
-
- /*this is a shortcut to do the same as above but a faster for drawing */
- if ((tface=(MTFace *)efa->tmp.p)) {
- if( simaFaceSel_Check(efa, tface) ) {
- tface_center(tface, cent, (void *)efa->v4);
- bglVertex2fv(cent);
- }
- }
- }
- bglEnd();
- }
-
- if (drawface != 2) { /* 2 means Mesh Face Mode */
- /* unselected uv's */
- BIF_ThemeColor(TH_VERTEX);
- pointsize = BIF_GetThemeValuef(TH_VERTEX_SIZE);
- glPointSize(pointsize);
-
- bglBegin(GL_POINTS);
- for (efa= em->faces.first; efa; efa= efa->next) {
-
-// tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-// if (simaFaceDraw_Check(efa, tface)) {
-
- /*this is a shortcut to do the same as above but a faster for drawing */
- if ((tface=(MTFace *)efa->tmp.p)) {
-
- if(simaUVSel_Check(efa, tface, 0)); else bglVertex2fv(tface->uv[0]);
- if(simaUVSel_Check(efa, tface, 1)); else bglVertex2fv(tface->uv[1]);
- if(simaUVSel_Check(efa, tface, 2)); else bglVertex2fv(tface->uv[2]);
- if(efa->v4) {
- if(simaUVSel_Check(efa, tface, 3)); else bglVertex2fv(tface->uv[3]);
- }
- }
- }
- bglEnd();
-
- /* pinned uv's */
- /* give odd pointsizes odd pin pointsizes */
- glPointSize(pointsize*2 + (((int)pointsize % 2)? (-1): 0));
- cpack(0xFF);
-
- bglBegin(GL_POINTS);
- for (efa= em->faces.first; efa; efa= efa->next) {
-// tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-// if (simaFaceDraw_Check(efa, tface)) {
-
- /*this is a shortcut to do the same as above but a faster for drawing */
- if ((tface=(MTFace *)efa->tmp.p)) {
-
- if(tface->unwrap & TF_PIN1) bglVertex2fv(tface->uv[0]);
- if(tface->unwrap & TF_PIN2) bglVertex2fv(tface->uv[1]);
- if(tface->unwrap & TF_PIN3) bglVertex2fv(tface->uv[2]);
- if(efa->v4) {
- if(tface->unwrap & TF_PIN4) bglVertex2fv(tface->uv[3]);
- }
- }
- }
- bglEnd();
-
- /* selected uv's */
- BIF_ThemeColor(TH_VERTEX_SELECT);
- glPointSize(pointsize);
-
- bglBegin(GL_POINTS);
- for (efa= em->faces.first; efa; efa= efa->next) {
-// tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-// if (simaFaceDraw_Check(efa, tface)) {
-
- /*this is a shortcut to do the same as above but a faster for drawing */
- if ((tface=(MTFace *)efa->tmp.p)) {
-
- if(!simaUVSel_Check(efa, tface, 0)); else bglVertex2fv(tface->uv[0]);
- if(!simaUVSel_Check(efa, tface, 1)); else bglVertex2fv(tface->uv[1]);
- if(!simaUVSel_Check(efa, tface, 2)); else bglVertex2fv(tface->uv[2]);
- if(efa->v4) {
- if(!simaUVSel_Check(efa, tface, 3)); else bglVertex2fv(tface->uv[3]);
- }
- }
- }
- bglEnd();
- }
- glPointSize(1.0);
-}
-
-static unsigned int *get_part_from_ibuf(ImBuf *ibuf, short startx, short starty, short endx, short endy)
-{
- unsigned int *rt, *rp, *rectmain;
- short y, heigth, len;
-
- /* the right offset in rectot */
-
- rt= ibuf->rect+ (starty*ibuf->x+ startx);
-
- len= (endx-startx);
- heigth= (endy-starty);
-
- rp=rectmain= MEM_mallocN(heigth*len*sizeof(int), "rect");
-
- for(y=0; y<heigth; y++) {
- memcpy(rp, rt, len*4);
- rt+= ibuf->x;
- rp+= len;
- }
- return rectmain;
-}
-
-static void draw_image_transform(ImBuf *ibuf, float xuser_asp, float yuser_asp)
-{
- if(G.moving) {
- float aspx, aspy, center[3];
-
- BIF_drawConstraint();
-
- if(ibuf==0 || ibuf->rect==0 || ibuf->x==0 || ibuf->y==0) {
- aspx= aspy= 1.0;
- }
- else {
- aspx= (256.0/ibuf->x) * xuser_asp;
- aspy= (256.0/ibuf->y) * yuser_asp;
- }
- BIF_getPropCenter(center);
-
- /* scale and translate the circle into place and draw it */
- glPushMatrix();
- glScalef(aspx, aspy, 1.0);
- glTranslatef((1/aspx)*center[0] - center[0],
- (1/aspy)*center[1] - center[1], 0.0);
-
- BIF_drawPropCircle();
-
- glPopMatrix();
- }
-}
-
-static void draw_image_view_icon(void)
-{
- float xPos = 5.0;
-
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
-
- if (G.sima->flag & SI_SYNC_UVSEL) {
- /* take settings from the editmesh */
- if (G.scene->selectmode == SCE_SELECT_FACE || G.sima->flag & SI_SELACTFACE) {
- BIF_icon_draw_aspect(xPos, 5.0, ICON_FACESEL_HLT, 1.0f);
- }
-
- } else {
- /* use the flags for UV mode - normal operation */
- if(G.sima->flag & SI_SELACTFACE) {
- BIF_icon_draw_aspect(xPos, 5.0, ICON_FACESEL_HLT, 1.0f);
- }
- }
-
- glBlendFunc(GL_ONE, GL_ZERO);
- glDisable(GL_BLEND);
-}
-
-static void draw_image_view_tool(void)
-{
- ToolSettings *settings= G.scene->toolsettings;
- Brush *brush= settings->imapaint.brush;
- short mval[2];
- float radius;
- int draw= 0;
-
- if(brush) {
- if(settings->imapaint.flag & IMAGEPAINT_DRAWING) {
- if(settings->imapaint.flag & IMAGEPAINT_DRAW_TOOL_DRAWING)
- draw= 1;
- }
- else if(settings->imapaint.flag & IMAGEPAINT_DRAW_TOOL)
- draw= 1;
-
- if(draw) {
- getmouseco_areawin(mval);
-
- radius= brush->size*G.sima->zoom/2;
- fdrawXORcirc(mval[0], mval[1], radius);
-
- if (brush->innerradius != 1.0) {
- radius *= brush->innerradius;
- fdrawXORcirc(mval[0], mval[1], radius);
- }
- }
- }
-}
-
-/* ************ panel stuff ************* */
-
-/* this function gets the values for cursor and vertex number buttons */
-static void image_transform_but_attr(int *imx, int *imy, int *step, int *digits) /*, float *xcoord, float *ycoord)*/
-{
- ImBuf *ibuf= imagewindow_get_ibuf(G.sima);
- if(ibuf) {
- *imx= ibuf->x;
- *imy= ibuf->y;
- }
-
- if (G.sima->flag & SI_COORDFLOATS) {
- *step= 1;
- *digits= 3;
- }
- else {
- *step= 100;
- *digits= 2;
- }
-}
-
-
-/* is used for both read and write... */
-void image_editvertex_buts(uiBlock *block)
-{
- static float ocent[2];
- float cent[2]= {0.0, 0.0};
- int imx= 256, imy= 256;
- int nactive= 0, step, digits;
- EditMesh *em = G.editMesh;
- EditFace *efa;
- MTFace *tf;
-
- if( is_uv_tface_editing_allowed_silent()==0 ) return;
-
- image_transform_but_attr(&imx, &imy, &step, &digits);
-
- for (efa= em->faces.first; efa; efa= efa->next) {
- tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tf)) {
-
- if (simaUVSel_Check(efa, tf, 0)) {
- cent[0]+= tf->uv[0][0];
- cent[1]+= tf->uv[0][1];
- nactive++;
- }
- if (simaUVSel_Check(efa, tf, 1)) {
- cent[0]+= tf->uv[1][0];
- cent[1]+= tf->uv[1][1];
- nactive++;
- }
- if (simaUVSel_Check(efa, tf, 2)) {
- cent[0]+= tf->uv[2][0];
- cent[1]+= tf->uv[2][1];
- nactive++;
- }
- if (efa->v4 && simaUVSel_Check(efa, tf, 3)) {
- cent[0]+= tf->uv[3][0];
- cent[1]+= tf->uv[3][1];
- nactive++;
- }
- }
- }
-
- if(block) { // do the buttons
- if (nactive) {
- ocent[0]= cent[0]/nactive;
- ocent[1]= cent[1]/nactive;
- if (G.sima->flag & SI_COORDFLOATS) {
- } else {
- ocent[0] *= imx;
- ocent[1] *= imy;
- }
-
- //uiBlockBeginAlign(block);
- if(nactive==1) {
- uiDefButF(block, NUM, B_TRANS_IMAGE, "Vertex X:", 10, 10, 145, 19, &ocent[0], -10*imx, 10.0*imx, step, digits, "");
- uiDefButF(block, NUM, B_TRANS_IMAGE, "Vertex Y:", 165, 10, 145, 19, &ocent[1], -10*imy, 10.0*imy, step, digits, "");
- }
- else {
- uiDefButF(block, NUM, B_TRANS_IMAGE, "Median X:", 10, 10, 145, 19, &ocent[0], -10*imx, 10.0*imx, step, digits, "");
- uiDefButF(block, NUM, B_TRANS_IMAGE, "Median Y:", 165, 10, 145, 19, &ocent[1], -10*imy, 10.0*imy, step, digits, "");
- }
- //uiBlockEndAlign(block);
- }
- }
- else { // apply event
- float delta[2];
-
- cent[0]= cent[0]/nactive;
- cent[1]= cent[1]/nactive;
-
- if (G.sima->flag & SI_COORDFLOATS) {
- delta[0]= ocent[0]-cent[0];
- delta[1]= ocent[1]-cent[1];
- }
- else {
- delta[0]= ocent[0]/imx - cent[0];
- delta[1]= ocent[1]/imy - cent[1];
- }
-
- for (efa= em->faces.first; efa; efa= efa->next) {
- tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tf)) {
- if (simaUVSel_Check(efa, tf, 0)) {
- tf->uv[0][0]+= delta[0];
- tf->uv[0][1]+= delta[1];
- }
- if (simaUVSel_Check(efa, tf, 1)) {
- tf->uv[1][0]+= delta[0];
- tf->uv[1][1]+= delta[1];
- }
- if (simaUVSel_Check(efa, tf, 2)) {
- tf->uv[2][0]+= delta[0];
- tf->uv[2][1]+= delta[1];
- }
- if (efa->v4 && simaUVSel_Check(efa, tf, 3)) {
- tf->uv[3][0]+= delta[0];
- tf->uv[3][1]+= delta[1];
- }
- }
- }
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIMAGE, 0);
- }
-}
-
-
-/* is used for both read and write... */
-void image_editcursor_buts(uiBlock *block)
-{
- static float ocent[2];
- int imx= 256, imy= 256;
- int step, digits;
-
- if( is_uv_tface_editing_allowed_silent()==0 ) return;
-
- image_transform_but_attr(&imx, &imy, &step, &digits);
-
- if(block) { // do the buttons
- ocent[0]= G.v2d->cursor[0];
- ocent[1]= G.v2d->cursor[1];
- if (G.sima->flag & SI_COORDFLOATS) {
- } else {
- ocent[0] *= imx;
- ocent[1] *= imy;
- }
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_CURSOR_IMAGE, "Cursor X:", 165, 120, 145, 19, &ocent[0], -10*imx, 10.0*imx, step, digits, "");
- uiDefButF(block, NUM, B_CURSOR_IMAGE, "Cursor Y:", 165, 100, 145, 19, &ocent[1], -10*imy, 10.0*imy, step, digits, "");
- uiBlockEndAlign(block);
- }
- else { // apply event
- if (G.sima->flag & SI_COORDFLOATS) {
- G.v2d->cursor[0]= ocent[0];
- G.v2d->cursor[1]= ocent[1];
- }
- else {
- G.v2d->cursor[0]= ocent[0]/imx;
- G.v2d->cursor[1]= ocent[1]/imy;
- }
- allqueue(REDRAWIMAGE, 0);
- }
-}
-
-
-void image_info(Image *ima, ImBuf *ibuf, char *str)
-{
- int ofs= 0;
-
- str[0]= 0;
-
- if(ima==NULL) return;
- if(ibuf==NULL) {
- sprintf(str, "Can not get an image");
- return;
- }
-
- if(ima->source==IMA_SRC_MOVIE) {
- ofs= sprintf(str, "Movie ");
- if(ima->anim)
- ofs+= sprintf(str+ofs, "%d frs", IMB_anim_get_duration(ima->anim));
- }
- else
- ofs= sprintf(str, "Image ");
-
- ofs+= sprintf(str+ofs, ": size %d x %d,", ibuf->x, ibuf->y);
-
- if(ibuf->rect_float) {
- if(ibuf->channels!=4) {
- sprintf(str+ofs, "%d float channel(s)", ibuf->channels);
- }
- else if(ibuf->depth==32)
- strcat(str, " RGBA float");
- else
- strcat(str, " RGB float");
- }
- else {
- if(ibuf->depth==32)
- strcat(str, " RGBA byte");
- else
- strcat(str, " RGB byte");
- }
- if(ibuf->zbuf || ibuf->zbuf_float)
- strcat(str, " + Z");
-
-}
-
-static void image_panel_properties(short cntrl) // IMAGE_HANDLER_PROPERTIES
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "image_panel_properties", UI_EMBOSS, UI_HELV, curarea->win);
- uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | cntrl);
- uiSetPanelHandler(IMAGE_HANDLER_PROPERTIES); // for close and esc
- if(uiNewPanel(curarea, block, "Image Properties", "Image", 10, 10, 318, 204)==0)
- return;
-
- /* note, it draws no bottom half in facemode, for vertex buttons */
- uiblock_image_panel(block, &G.sima->image, &G.sima->iuser, B_REDR, B_REDR);
- image_editvertex_buts(block);
-}
-
-static void image_panel_game_properties(short cntrl) // IMAGE_HANDLER_GAME_PROPERTIES
-{
- ImBuf *ibuf= BKE_image_get_ibuf(G.sima->image, &G.sima->iuser);
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "image_panel_game_properties", UI_EMBOSS, UI_HELV, curarea->win);
- uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | cntrl);
- uiSetPanelHandler(IMAGE_HANDLER_GAME_PROPERTIES); // for close and esc
- if(uiNewPanel(curarea, block, "Real-time Properties", "Image", 10, 10, 318, 204)==0)
- return;
-
- if (ibuf) {
- char str[128];
-
- image_info(G.sima->image, ibuf, str);
- uiDefBut(block, LABEL, B_NOP, str, 10,180,300,19, 0, 0, 0, 0, 0, "");
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, IMA_TWINANIM, B_TWINANIM, "Anim", 10,150,140,19, &G.sima->image->tpageflag, 0, 0, 0, 0, "Toggles use of animated texture");
- uiDefButS(block, NUM, B_TWINANIM, "Start:", 10,130,140,19, &G.sima->image->twsta, 0.0, 128.0, 0, 0, "Displays the start frame of an animated texture");
- uiDefButS(block, NUM, B_TWINANIM, "End:", 10,110,140,19, &G.sima->image->twend, 0.0, 128.0, 0, 0, "Displays the end frame of an animated texture");
- uiDefButS(block, NUM, B_NOP, "Speed", 10,90,140,19, &G.sima->image->animspeed, 1.0, 100.0, 0, 0, "Displays Speed of the animation in frames per second");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, IMA_TILES, B_SIMAGETILE, "Tiles", 160,150,140,19, &G.sima->image->tpageflag, 0, 0, 0, 0, "Toggles use of tilemode for faces (Shift LMB to pick the tile for selected faces)");
- uiDefButS(block, NUM, B_SIMA_REDR_IMA_3D, "X:", 160,130,70,19, &G.sima->image->xrep, 1.0, 16.0, 0, 0, "Sets the degree of repetition in the X direction");
- uiDefButS(block, NUM, B_SIMA_REDR_IMA_3D, "Y:", 230,130,70,19, &G.sima->image->yrep, 1.0, 16.0, 0, 0, "Sets the degree of repetition in the Y direction");
- uiBlockBeginAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, IMA_CLAMP_U, B_SIMA3DVIEWDRAW, "ClampX", 160,100,70,19, &G.sima->image->tpageflag, 0, 0, 0, 0, "Disable texture repeating horizontaly");
- uiDefButBitS(block, TOG, IMA_CLAMP_V, B_SIMA3DVIEWDRAW, "ClampY", 230,100,70,19, &G.sima->image->tpageflag, 0, 0, 0, 0, "Disable texture repeating vertically");
- uiBlockEndAlign(block);
- }
-}
-
-//static void image_panel_transform_properties(short cntrl) // IMAGE_HANDLER_TRANSFORM_PROPERTIES
-//{
-// uiBlock *block;
-//
-// block= uiNewBlock(&curarea->uiblocks, "image_transform_properties", UI_EMBOSS, UI_HELV, curarea->win);
-// uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | cntrl);
-// uiSetPanelHandler(IMAGE_HANDLER_TRANSFORM_PROPERTIES); // for close and esc
-// if(uiNewPanel(curarea, block, "Transform Properties", "Image", 10, 10, 318, 204)==0)
-// return;
-//
-// image_editvertex_buts(block);
-//}
-
-static void image_panel_view_properties(short cntrl) // IMAGE_HANDLER_VIEW_PROPERTIES
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "image_view_properties", UI_EMBOSS, UI_HELV, curarea->win);
- uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | cntrl);
- uiSetPanelHandler(IMAGE_HANDLER_VIEW_PROPERTIES); // for close and esc
- if(uiNewPanel(curarea, block, "View Properties", "Image", 10, 10, 318, 204)==0)
- return;
-
-
- uiDefButBitI(block, TOG, SI_DRAW_TILE, B_REDR, "Repeat Image", 10,160,140,19, &G.sima->flag, 0, 0, 0, 0, "Repeat/Tile the image display");
- uiDefButBitI(block, TOG, SI_COORDFLOATS, B_REDR, "Normalized Coords", 165,160,145,19, &G.sima->flag, 0, 0, 0, 0, "Display coords from 0.0 to 1.0 rather then in pixels");
-
-
- if (G.sima->image) {
- uiDefBut(block, LABEL, B_NOP, "Image Display:", 10,140,140,19, 0, 0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_REDR, "AspX:", 10,120,140,19, &G.sima->image->aspx, 0.1, 5000.0, 100, 0, "X Display Aspect for this image, does not affect renderingm 0 disables.");
- uiDefButF(block, NUM, B_REDR, "AspY:", 10,100,140,19, &G.sima->image->aspy, 0.1, 5000.0, 100, 0, "X Display Aspect for this image, does not affect rendering 0 disables.");
- uiBlockEndAlign(block);
- }
-
-
- if (EM_texFaceCheck()) {
- uiDefBut(block, LABEL, B_NOP, "Draw Type:", 10, 20,120,19, 0, 0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButC(block, ROW, B_REDR, "Dash", 10, 0,58,19, &G.sima->dt_uv, 0.0, SI_UVDT_DASH, 0, 0, "Dashed Wire UV drawtype");
- uiDefButC(block, ROW, B_REDR, "Black", 68, 0,58,19, &G.sima->dt_uv, 0.0, SI_UVDT_BLACK, 0, 0, "Black Wire UV drawtype");
- uiDefButC(block, ROW, B_REDR, "White", 126,0,58,19, &G.sima->dt_uv, 0.0, SI_UVDT_WHITE, 0, 0, "White Wire UV drawtype");
- uiDefButC(block, ROW, B_REDR, "Outline", 184,0,58,19, &G.sima->dt_uv, 0.0, SI_UVDT_OUTLINE, 0, 0, "Outline Wire UV drawtype");
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, SI_SMOOTH_UV, B_REDR, "Smooth", 250,0,60,19, &G.sima->flag, 0, 0, 0, 0, "Display smooth lines in the UV view");
- }
- image_editcursor_buts(block);
-}
-
-static void image_panel_paint(short cntrl) // IMAGE_HANDLER_PAINT
-{
- /* B_SIMABRUSHCHANGE only redraws and eats the mouse messages */
- /* so that LEFTMOUSE does not 'punch' through the floating panel */
- /* B_SIMANOTHING */
- ToolSettings *settings= G.scene->toolsettings;
- Brush *brush= settings->imapaint.brush;
- uiBlock *block;
- ID *id;
- int yco, xco, butw;
-
- block= uiNewBlock(&curarea->uiblocks, "image_panel_paint", UI_EMBOSS, UI_HELV, curarea->win);
- uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | cntrl);
- uiSetPanelHandler(IMAGE_HANDLER_PAINT); // for close and esc
- if(uiNewPanel(curarea, block, "Image Paint", "Image", 10, 230, 318, 204)==0)
- return;
-
- yco= 160;
-
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW, B_SIMABRUSHCHANGE, "Draw", 0 ,yco,80,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_DRAW, 0, 0, "Draw brush");
- uiDefButS(block, ROW, B_SIMABRUSHCHANGE, "Soften", 80 ,yco,80,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_SOFTEN, 0, 0, "Soften brush");
- uiDefButS(block, ROW, B_SIMABRUSHCHANGE, "Smear", 160,yco,80,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_SMEAR, 0, 0, "Smear brush");
- uiDefButS(block, ROW, B_SIMABRUSHCHANGE, "Clone", 240,yco,80,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_CLONE, 0, 0, "Clone brush, use RMB to drag source image");
- uiBlockEndAlign(block);
- yco -= 30;
-
- uiBlockSetCol(block, TH_BUT_SETTING2);
- id= (ID*)settings->imapaint.brush;
- xco= std_libbuttons(block, 0, yco, 0, NULL, B_SIMABRUSHBROWSE, ID_BR, 0, id, NULL, &(G.sima->menunr), 0, B_SIMABRUSHLOCAL, B_SIMABRUSHDELETE, 0, B_KEEPDATA);
- uiBlockSetCol(block, TH_AUTO);
-
- if(brush && !brush->id.lib) {
- butw= 320-(xco+10);
-
- uiDefButS(block, MENU, B_SIMANOTHING, "Mix %x0|Add %x1|Subtract %x2|Multiply %x3|Lighten %x4|Darken %x5|Erase Alpha %x6|Add Alpha %x7", xco+10,yco,butw,19, &brush->blend, 0, 0, 0, 0, "Blending method for applying brushes");
-
- uiDefButBitS(block, TOG|BIT, BRUSH_TORUS, B_SIMABRUSHCHANGE, "Wrap", xco+10,yco-25,butw,19, &brush->flag, 0, 0, 0, 0, "Enables torus wrapping");
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG|BIT, BRUSH_AIRBRUSH, B_SIMABRUSHCHANGE, "Airbrush", xco+10,yco-50,butw,19, &brush->flag, 0, 0, 0, 0, "Keep applying paint effect while holding mouse (spray)");
- uiDefButF(block, NUM, B_SIMANOTHING, "Rate ", xco+10,yco-70,butw,19, &brush->rate, 0.01, 1.0, 0, 0, "Number of paints per second for Airbrush");
- uiBlockEndAlign(block);
-
- yco -= 25;
-
- uiBlockBeginAlign(block);
- uiDefButF(block, COL, B_VPCOLSLI, "", 0,yco,200,19, brush->rgb, 0, 0, 0, 0, "");
- uiDefButF(block, NUMSLI, B_SIMANOTHING, "Opacity ", 0,yco-20,180,19, &brush->alpha, 0.0, 1.0, 0, 0, "The amount of pressure on the brush");
- uiDefButBitS(block, TOG|BIT, BRUSH_ALPHA_PRESSURE, B_SIMANOTHING, "P", 180,yco-20,20,19, &brush->flag, 0, 0, 0, 0, "Enables pressure sensitivity for tablets");
- uiDefButI(block, NUMSLI, B_SIMANOTHING, "Size ", 0,yco-40,180,19, &brush->size, 1, 200, 0, 0, "The size of the brush");
- uiDefButBitS(block, TOG|BIT, BRUSH_SIZE_PRESSURE, B_SIMANOTHING, "P", 180,yco-40,20,19, &brush->flag, 0, 0, 0, 0, "Enables pressure sensitivity for tablets");
- uiDefButF(block, NUMSLI, B_SIMANOTHING, "Falloff ", 0,yco-60,180,19, &brush->innerradius, 0.0, 1.0, 0, 0, "The fall off radius of the brush");
- uiDefButBitS(block, TOG|BIT, BRUSH_RAD_PRESSURE, B_SIMANOTHING, "P", 180,yco-60,20,19, &brush->flag, 0, 0, 0, 0, "Enables pressure sensitivity for tablets");
- uiDefButF(block, NUMSLI, B_SIMANOTHING, "Spacing ",0,yco-80,180,19, &brush->spacing, 1.0, 100.0, 0, 0, "Repeating paint on %% of brush diameter");
- uiDefButBitS(block, TOG|BIT, BRUSH_SPACING_PRESSURE, B_SIMANOTHING, "P", 180,yco-80,20,19, &brush->flag, 0, 0, 0, 0, "Enables pressure sensitivity for tablets");
- uiBlockEndAlign(block);
-
- yco -= 110;
-
- if(settings->imapaint.tool == PAINT_TOOL_CLONE) {
- id= (ID*)brush->clone.image;
- uiBlockSetCol(block, TH_BUT_SETTING2);
- xco= std_libbuttons(block, 0, yco, 0, NULL, B_SIMACLONEBROWSE, ID_IM, 0, id, 0, &G.sima->menunr, 0, 0, B_SIMACLONEDELETE, 0, 0);
- uiBlockSetCol(block, TH_AUTO);
- if(id) {
- butw= 320-(xco+5);
- uiDefButF(block, NUMSLI, B_SIMABRUSHCHANGE, "B ",xco+5,yco,butw,19, &brush->clone.alpha , 0.0, 1.0, 0, 0, "Opacity of clone image display");
- }
- }
- else {
- MTex *mtex= brush->mtex[brush->texact];
-
- uiBlockSetCol(block, TH_BUT_SETTING2);
- id= (mtex)? (ID*)mtex->tex: NULL;
- xco= std_libbuttons(block, 0, yco, 0, NULL, B_SIMABTEXBROWSE, ID_TE, 0, id, NULL, &(G.sima->menunr), 0, 0, B_SIMABTEXDELETE, 0, 0);
- /*uiDefButBitS(block, TOG|BIT, BRUSH_FIXED_TEX, B_SIMABRUSHCHANGE, "Fixed", xco+5,yco,butw,19, &brush->flag, 0, 0, 0, 0, "Keep texture origin in fixed position");*/
- uiBlockSetCol(block, TH_AUTO);
- }
- }
-
-#if 0
- uiDefButBitS(block, TOG|BIT, IMAGEPAINT_DRAW_TOOL_DRAWING, B_SIMABRUSHCHANGE, "TD", 0,1,50,19, &settings->imapaint.flag.flag, 0, 0, 0, 0, "Enables brush shape while drawing");
- uiDefButBitS(block, TOG|BIT, IMAGEPAINT_DRAW_TOOL, B_SIMABRUSHCHANGE, "TP", 50,1,50,19, &settings->imapaint.flag.flag, 0, 0, 0, 0, "Enables brush shape while not drawing");
-#endif
-}
-
-static void image_panel_curves_reset(void *cumap_v, void *ibuf_v)
-{
- CurveMapping *cumap = cumap_v;
- int a;
-
- for(a=0; a<CM_TOT; a++)
- curvemap_reset(cumap->cm+a, &cumap->clipr);
-
- cumap->black[0]=cumap->black[1]=cumap->black[2]= 0.0f;
- cumap->white[0]=cumap->white[1]=cumap->white[2]= 1.0f;
- curvemapping_set_black_white(cumap, NULL, NULL);
-
- curvemapping_changed(cumap, 0);
- curvemapping_do_ibuf(cumap, ibuf_v);
-
- allqueue(REDRAWIMAGE, 0);
-}
-
-
-static void image_panel_curves(short cntrl) // IMAGE_HANDLER_CURVES
-{
- ImBuf *ibuf;
- uiBlock *block;
- uiBut *bt;
-
- /* and we check for spare */
- ibuf= imagewindow_get_ibuf(G.sima);
-
- block= uiNewBlock(&curarea->uiblocks, "image_panel_curves", UI_EMBOSS, UI_HELV, curarea->win);
- uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | cntrl);
- uiSetPanelHandler(IMAGE_HANDLER_CURVES); // for close and esc
- if(uiNewPanel(curarea, block, "Curves", "Image", 10, 450, 318, 204)==0)
- return;
-
- if (ibuf) {
- rctf rect;
-
- if(G.sima->cumap==NULL)
- G.sima->cumap= curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f);
-
- rect.xmin= 110; rect.xmax= 310;
- rect.ymin= 10; rect.ymax= 200;
- curvemap_buttons(block, G.sima->cumap, 'c', B_SIMACURVES, B_REDR, &rect);
-
- bt=uiDefBut(block, BUT, B_SIMARANGE, "Reset", 10, 160, 90, 19, NULL, 0.0f, 0.0f, 0, 0, "Reset Black/White point and curves");
- uiButSetFunc(bt, image_panel_curves_reset, G.sima->cumap, ibuf);
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_SIMARANGE, "Min R:", 10, 120, 90, 19, G.sima->cumap->black, -1000.0f, 1000.0f, 10, 2, "Black level");
- uiDefButF(block, NUM, B_SIMARANGE, "Min G:", 10, 100, 90, 19, G.sima->cumap->black+1, -1000.0f, 1000.0f, 10, 2, "Black level");
- uiDefButF(block, NUM, B_SIMARANGE, "Min B:", 10, 80, 90, 19, G.sima->cumap->black+2, -1000.0f, 1000.0f, 10, 2, "Black level");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_SIMARANGE, "Max R:", 10, 50, 90, 19, G.sima->cumap->white, -1000.0f, 1000.0f, 10, 2, "White level");
- uiDefButF(block, NUM, B_SIMARANGE, "Max G:", 10, 30, 90, 19, G.sima->cumap->white+1, -1000.0f, 1000.0f, 10, 2, "White level");
- uiDefButF(block, NUM, B_SIMARANGE, "Max B:", 10, 10, 90, 19, G.sima->cumap->white+2, -1000.0f, 1000.0f, 10, 2, "White level");
-
- }
-}
-
-/* are there curves? curves visible? and curves do something? */
-static int image_curves_active(ScrArea *sa)
-{
- SpaceImage *sima= sa->spacedata.first;
-
- if(sima->cumap) {
- if(curvemapping_RGBA_does_something(sima->cumap)) {
- short a;
- for(a=0; a<SPACE_MAXHANDLER; a+=2) {
- if(sima->blockhandler[a] == IMAGE_HANDLER_CURVES)
- return 1;
- }
- }
- }
- return 0;
-}
-
-/* 0: disable preview
- otherwise refresh preview
-*/
-void image_preview_event(int event)
-{
- int exec= 0;
-
-
- if(event==0) {
- G.scene->r.scemode &= ~R_COMP_CROP;
- exec= 1;
- }
- else {
- if(image_preview_active(curarea, NULL, NULL)) {
- G.scene->r.scemode |= R_COMP_CROP;
- exec= 1;
- }
- else
- G.scene->r.scemode &= ~R_COMP_CROP;
- }
-
- if(exec && G.scene->nodetree) {
- /* should work when no node editor in screen..., so we execute right away */
-
- ntreeCompositTagGenerators(G.scene->nodetree);
-
- G.afbreek= 0;
- G.scene->nodetree->timecursor= set_timecursor;
- G.scene->nodetree->test_break= blender_test_break;
-
- BIF_store_spare();
-
- ntreeCompositExecTree(G.scene->nodetree, &G.scene->r, 1); /* 1 is do_previews */
-
- G.scene->nodetree->timecursor= NULL;
- G.scene->nodetree->test_break= NULL;
-
- scrarea_do_windraw(curarea);
- waitcursor(0);
-
- allqueue(REDRAWNODE, 1);
- }
-}
-
-
-/* nothing drawn here, we use it to store values */
-static void preview_cb(struct ScrArea *sa, struct uiBlock *block)
-{
- rctf dispf;
- rcti *disprect= &G.scene->r.disprect;
- int winx= (G.scene->r.size*G.scene->r.xsch)/100;
- int winy= (G.scene->r.size*G.scene->r.ysch)/100;
- short mval[2];
-
- if(G.scene->r.mode & R_BORDER) {
- winx*= (G.scene->r.border.xmax - G.scene->r.border.xmin);
- winy*= (G.scene->r.border.ymax - G.scene->r.border.ymin);
- }
-
- /* while dragging we need to update the rects, otherwise it doesn't end with correct one */
-
- BLI_init_rctf(&dispf, 15.0f, (block->maxx - block->minx)-15.0f, 15.0f, (block->maxy - block->miny)-15.0f);
- ui_graphics_to_window_rct(sa->win, &dispf, disprect);
-
- /* correction for gla draw */
- BLI_translate_rcti(disprect, -curarea->winrct.xmin, -curarea->winrct.ymin);
-
- calc_image_view(G.sima, 'p');
-// printf("winrct %d %d %d %d\n", disprect->xmin, disprect->ymin,disprect->xmax, disprect->ymax);
- /* map to image space coordinates */
- mval[0]= disprect->xmin; mval[1]= disprect->ymin;
- areamouseco_to_ipoco(G.v2d, mval, &dispf.xmin, &dispf.ymin);
- mval[0]= disprect->xmax; mval[1]= disprect->ymax;
- areamouseco_to_ipoco(G.v2d, mval, &dispf.xmax, &dispf.ymax);
-
- /* map to render coordinates */
- disprect->xmin= dispf.xmin;
- disprect->xmax= dispf.xmax;
- disprect->ymin= dispf.ymin;
- disprect->ymax= dispf.ymax;
-
- CLAMP(disprect->xmin, 0, winx);
- CLAMP(disprect->xmax, 0, winx);
- CLAMP(disprect->ymin, 0, winy);
- CLAMP(disprect->ymax, 0, winy);
-// printf("drawrct %d %d %d %d\n", disprect->xmin, disprect->ymin,disprect->xmax, disprect->ymax);
-
-}
-
-static int is_preview_allowed(ScrArea *cur)
-{
- SpaceImage *sima= cur->spacedata.first;
- ScrArea *sa;
-
- /* check if another areawindow has preview set */
- for(sa=G.curscreen->areabase.first; sa; sa= sa->next) {
- if(sa!=cur && sa->spacetype==SPACE_IMAGE) {
- if(image_preview_active(sa, NULL, NULL))
- return 0;
- }
- }
- /* check image type */
- if(sima->image==NULL || sima->image->type!=IMA_TYPE_COMPOSITE)
- return 0;
-
- return 1;
-}
-
-static void image_panel_preview(ScrArea *sa, short cntrl) // IMAGE_HANDLER_PREVIEW
-{
- uiBlock *block;
- SpaceImage *sima= sa->spacedata.first;
- int ofsx, ofsy;
-
- if(is_preview_allowed(sa)==0) {
- rem_blockhandler(sa, IMAGE_HANDLER_PREVIEW);
- G.scene->r.scemode &= ~R_COMP_CROP; /* quite weak */
- return;
- }
-
- block= uiNewBlock(&sa->uiblocks, "image_panel_preview", UI_EMBOSS, UI_HELV, sa->win);
- uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | UI_PNL_SCALE | cntrl);
- uiSetPanelHandler(IMAGE_HANDLER_PREVIEW); // for close and esc
-
- ofsx= -150+(sa->winx/2)/sima->blockscale;
- ofsy= -100+(sa->winy/2)/sima->blockscale;
- if(uiNewPanel(sa, block, "Preview", "Image", ofsx, ofsy, 300, 200)==0) return;
-
- uiBlockSetDrawExtraFunc(block, preview_cb);
-
-}
-
-static void image_blockhandlers(ScrArea *sa)
-{
- SpaceImage *sima= sa->spacedata.first;
- short a;
-
- /* warning; blocks need to be freed each time, handlers dont remove */
- uiFreeBlocksWin(&sa->uiblocks, sa->win);
-
- for(a=0; a<SPACE_MAXHANDLER; a+=2) {
- switch(sima->blockhandler[a]) {
-
- case IMAGE_HANDLER_PROPERTIES:
- image_panel_properties(sima->blockhandler[a+1]);
- break;
- case IMAGE_HANDLER_GAME_PROPERTIES:
- image_panel_game_properties(sima->blockhandler[a+1]);
- break;
-// case IMAGE_HANDLER_TRANSFORM_PROPERTIES:
-// if (EM_texFaceCheck())
-// image_panel_transform_properties(sima->blockhandler[a+1]);
-// break;
- case IMAGE_HANDLER_VIEW_PROPERTIES:
- image_panel_view_properties(sima->blockhandler[a+1]);
- break;
- case IMAGE_HANDLER_PAINT:
- image_panel_paint(sima->blockhandler[a+1]);
- break;
- case IMAGE_HANDLER_CURVES:
- image_panel_curves(sima->blockhandler[a+1]);
- break;
- case IMAGE_HANDLER_PREVIEW:
- image_panel_preview(sa, sima->blockhandler[a+1]);
- break;
- }
- /* clear action value for event */
- sima->blockhandler[a+1]= 0;
- }
- uiDrawBlocksPanels(sa, 0);
-}
-
-void imagespace_composite_flipbook(ScrArea *sa)
-{
- SpaceImage *sima= sa->spacedata.first;
- ImBuf *ibuf;
- int cfrao= G.scene->r.cfra;
- int sfra, efra;
-
- if(sa->spacetype!=SPACE_IMAGE)
- return;
- if(sima->iuser.frames<2)
- return;
- if(G.scene->nodetree==NULL)
- return;
-
- sfra= sima->iuser.sfra;
- efra= sima->iuser.sfra + sima->iuser.frames-1;
- G.scene->nodetree->test_break= blender_test_break;
-
- for(G.scene->r.cfra=sfra; G.scene->r.cfra<=efra; G.scene->r.cfra++) {
-
- set_timecursor(CFRA);
-
- BKE_image_all_free_anim_ibufs(CFRA);
- ntreeCompositTagAnimated(G.scene->nodetree);
- ntreeCompositExecTree(G.scene->nodetree, &G.scene->r, G.scene->r.cfra!=cfrao); /* 1 is no previews */
-
- force_draw(0);
-
- ibuf= BKE_image_get_ibuf(sima->image, &sima->iuser);
- /* save memory in flipbooks */
- if(ibuf)
- imb_freerectfloatImBuf(ibuf);
-
- if(blender_test_break())
- break;
- }
- G.scene->nodetree->test_break= NULL;
- waitcursor(0);
-
- play_anim(0);
-
- allqueue(REDRAWNODE, 1);
- allqueue(REDRAWIMAGE, 1);
-
- G.scene->r.cfra= cfrao;
-}
-
-static void imagespace_grid(SpaceImage *sima)
-{
- float gridsize, gridstep= 1.0f/32.0f;
- float fac, blendfac;
-
- gridsize= sima->zoom;
-
- calc_image_view(sima, 'f');
- myortho2(sima->v2d.cur.xmin, sima->v2d.cur.xmax, sima->v2d.cur.ymin, sima->v2d.cur.ymax);
-
- BIF_ThemeColorShade(TH_BACK, 20);
- glRectf(0.0, 0.0, 1.0, 1.0);
-
- if(gridsize<=0.0f) return;
-
- if(gridsize<1.0f) {
- while(gridsize<1.0f) {
- gridsize*= 4.0;
- gridstep*= 4.0;
- }
- }
- else {
- while(gridsize>=4.0f) {
- gridsize/= 4.0;
- gridstep/= 4.0;
- }
- }
-
- /* the fine resolution level */
- blendfac= 0.25*gridsize - floor(0.25*gridsize);
- CLAMP(blendfac, 0.0, 1.0);
- BIF_ThemeColorShade(TH_BACK, (int)(20.0*(1.0-blendfac)));
-
- fac= 0.0f;
- glBegin(GL_LINES);
- while(fac<1.0) {
- glVertex2f(0.0f, fac);
- glVertex2f(1.0f, fac);
- glVertex2f(fac, 0.0f);
- glVertex2f(fac, 1.0f);
- fac+= gridstep;
- }
-
- /* the large resolution level */
- BIF_ThemeColor(TH_BACK);
-
- fac= 0.0f;
- while(fac<1.0) {
- glVertex2f(0.0f, fac);
- glVertex2f(1.0f, fac);
- glVertex2f(fac, 0.0f);
- glVertex2f(fac, 1.0f);
- fac+= 4.0*gridstep;
- }
- glEnd();
-
-}
-
-static void sima_draw_alpha_backdrop(SpaceImage *sima, float x1, float y1, float xsize, float ysize)
-{
- GLubyte checker_stipple[32*32/8] =
- {
- 255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0, \
- 255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0, \
- 255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0, \
- 255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0, \
- 0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255, \
- 0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255, \
- 0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255, \
- 0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255, \
- };
-
- glColor3ub(100, 100, 100);
- glRectf(x1, y1, x1 + sima->zoom*xsize, y1 + sima->zoom*ysize);
- glColor3ub(160, 160, 160);
-
- glEnable(GL_POLYGON_STIPPLE);
- glPolygonStipple(checker_stipple);
- glRectf(x1, y1, x1 + sima->zoom*xsize, y1 + sima->zoom*ysize);
- glEnd();
- glDisable(GL_POLYGON_STIPPLE);
- return;
-}
-
-static void sima_draw_alpha_pixels(float x1, float y1, int rectx, int recty, unsigned int *recti)
-{
-
- /* swap bytes, so alpha is most significant one, then just draw it as luminance int */
- if(G.order==B_ENDIAN)
- glPixelStorei(GL_UNPACK_SWAP_BYTES, 1);
- glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_LUMINANCE, GL_UNSIGNED_INT, recti);
- glPixelStorei(GL_UNPACK_SWAP_BYTES, 0);
-}
-
-static void sima_draw_alpha_pixelsf(float x1, float y1, int rectx, int recty, float *rectf)
-{
- float *trectf= MEM_mallocN(rectx*recty*4, "temp");
- int a, b;
-
- for(a= rectx*recty -1, b= 4*a+3; a>=0; a--, b-=4)
- trectf[a]= rectf[b];
-
- glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_LUMINANCE, GL_FLOAT, trectf);
- MEM_freeN(trectf);
- /* ogl trick below is slower... (on ATI 9600) */
-// glColorMask(1, 0, 0, 0);
-// glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_RGBA, GL_FLOAT, rectf+3);
-// glColorMask(0, 1, 0, 0);
-// glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_RGBA, GL_FLOAT, rectf+2);
-// glColorMask(0, 0, 1, 0);
-// glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_RGBA, GL_FLOAT, rectf+1);
-// glColorMask(1, 1, 1, 1);
-}
-
-static void sima_draw_zbuf_pixels(float x1, float y1, int rectx, int recty, int *recti)
-{
- if(recti==NULL)
- return;
-
- /* zbuffer values are signed, so we need to shift color range */
- glPixelTransferf(GL_RED_SCALE, 0.5f);
- glPixelTransferf(GL_GREEN_SCALE, 0.5f);
- glPixelTransferf(GL_BLUE_SCALE, 0.5f);
- glPixelTransferf(GL_RED_BIAS, 0.5f);
- glPixelTransferf(GL_GREEN_BIAS, 0.5f);
- glPixelTransferf(GL_BLUE_BIAS, 0.5f);
-
- glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_LUMINANCE, GL_INT, recti);
-
- glPixelTransferf(GL_RED_SCALE, 1.0f);
- glPixelTransferf(GL_GREEN_SCALE, 1.0f);
- glPixelTransferf(GL_BLUE_SCALE, 1.0f);
- glPixelTransferf(GL_RED_BIAS, 0.0f);
- glPixelTransferf(GL_GREEN_BIAS, 0.0f);
- glPixelTransferf(GL_BLUE_BIAS, 0.0f);
-}
-
-static void sima_draw_zbuffloat_pixels(float x1, float y1, int rectx, int recty, float *rect_float)
-{
- float bias, scale, *rectf, clipend;
- int a;
-
- if(rect_float==NULL)
- return;
-
- if(G.scene->camera && G.scene->camera->type==OB_CAMERA) {
- bias= ((Camera *)G.scene->camera->data)->clipsta;
- clipend= ((Camera *)G.scene->camera->data)->clipend;
- scale= 1.0f/(clipend-bias);
- }
- else {
- bias= 0.1f;
- scale= 0.01f;
- clipend= 100.0f;
- }
-
- rectf= MEM_mallocN(rectx*recty*4, "temp");
- for(a= rectx*recty -1; a>=0; a--) {
- if(rect_float[a]>clipend)
- rectf[a]= 0.0f;
- else if(rect_float[a]<bias)
- rectf[a]= 1.0f;
- else {
- rectf[a]= 1.0f - (rect_float[a]-bias)*scale;
- rectf[a]*= rectf[a];
- }
- }
- glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_LUMINANCE, GL_FLOAT, rectf);
-
- MEM_freeN(rectf);
-}
-
-static void imagewindow_draw_renderinfo(ScrArea *sa)
-{
- SpaceImage *sima= sa->spacedata.first;
- rcti rect;
- float colf[3];
- char *str= sima->showspare?sima->info_spare:sima->info_str;
-
- if(str==NULL)
- return;
-
- rect= sa->winrct;
- rect.ymin= rect.ymax-RW_HEADERY;
-
- glaDefine2DArea(&rect);
-
- /* clear header rect */
- BIF_GetThemeColor3fv(TH_BACK, colf);
- glClearColor(colf[0]+0.1f, colf[1]+0.1f, colf[2]+0.1f, 1.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- BIF_ThemeColor(TH_TEXT_HI);
- glRasterPos2i(12, 5);
- if(sima->showspare) {
- BMF_DrawString(G.fonts, "(Previous)");
- glRasterPos2i(72, 5);
- }
- BMF_DrawString(G.fonts, str);
-}
-
-void drawimagespace(ScrArea *sa, void *spacedata)
-{
- SpaceImage *sima= spacedata;
- ImBuf *ibuf= NULL;
- Brush *brush;
- float col[3];
- unsigned int *rect;
- float x1, y1;
- short sx, sy, dx, dy, show_render= 0, show_viewer= 0;
- float xuser_asp, yuser_asp;
- /* If derived data is used then make sure that object
- * is up-to-date... might not be the case because updates
- * are normally done in drawview and could get here before
- * drawing a View3D.
- */
- if (G.obedit && OBACT && (sima->flag & SI_DRAWSHADOW)) {
- object_handle_update(OBACT);
- }
-
- BIF_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- bwin_clear_viewmat(sa->win); /* clear buttons view */
- glLoadIdentity();
-
- if(sima->image && sima->image->source==IMA_SRC_VIEWER) {
- show_viewer= 1;
- if(sima->image->type==IMA_TYPE_R_RESULT)
- show_render= 1;
- }
- what_image(sima);
-
- aspect_sima(sima, &xuser_asp, &yuser_asp);
-
- if(sima->image) {
-
- /* UGLY hack? until now iusers worked fine... but for flipbook viewer we need this */
- if(sima->image->type==IMA_TYPE_COMPOSITE) {
- ImageUser *iuser= ntree_get_active_iuser(G.scene->nodetree);
- if(iuser) {
- BKE_image_user_calc_imanr(iuser, G.scene->r.cfra, 0);
- G.sima->iuser= *iuser;
- }
- }
- /* and we check for spare */
- ibuf= imagewindow_get_ibuf(sima);
- }
-
- if(ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL)) {
- imagespace_grid(sima);
- if(show_viewer==0) {
- draw_uvs_sima();
- drawcursor_sima(xuser_asp, yuser_asp);
- }
- }
- else {
- float xim, yim, xoffs=0.0f, yoffs= 0.0f;
-
- if(image_preview_active(sa, &xim, &yim)) {
- xoffs= G.scene->r.disprect.xmin;
- yoffs= G.scene->r.disprect.ymin;
- glColor3ub(0,0,0);
- calc_image_view(sima, 'f');
- myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax);
- glRectf(0.0f, 0.0f, 1.0f, 1.0f);
- glLoadIdentity();
- }
- else {
- xim= ibuf->x * xuser_asp; yim= ibuf->y * yuser_asp;
- }
-
- /* calc location */
- x1= sima->zoom*xoffs + ((float)sa->winx - sima->zoom*(float)xim)/2.0f;
- y1= sima->zoom*yoffs + ((float)sa->winy - sima->zoom*(float)yim)/2.0f;
-
- x1-= sima->zoom*sima->xof;
- y1-= sima->zoom*sima->yof;
-
- /* needed for gla draw */
- if(show_render) {
- rcti rct= sa->winrct;
-
- imagewindow_draw_renderinfo(sa); /* calls glaDefine2DArea too */
-
- rct.ymax-=RW_HEADERY;
- glaDefine2DArea(&rct);
- }
- else glaDefine2DArea(&sa->winrct);
-
- glPixelZoom(sima->zoom * xuser_asp, sima->zoom * yuser_asp);
-
- if(sima->flag & SI_EDITTILE) {
- /* create char buffer from float if needed */
- if(ibuf->rect_float && ibuf->rect==NULL)
- IMB_rect_from_float(ibuf);
-
- glaDrawPixelsSafe(x1, y1, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
-
- glPixelZoom(1.0, 1.0);
-
- dx= ibuf->x/sima->image->xrep;
- dy= ibuf->y/sima->image->yrep;
- sy= (sima->curtile / sima->image->xrep);
- sx= sima->curtile - sy*sima->image->xrep;
-
- sx*= dx;
- sy*= dy;
-
- calc_image_view(sima, 'p'); /* pixel */
- myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax);
-
- cpack(0x0);
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); glRects(sx, sy, sx+dx-1, sy+dy-1); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- cpack(0xFFFFFF);
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); glRects(sx+1, sy+1, sx+dx, sy+dy); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- }
- else if(sima->mode==SI_TEXTURE) {
-
- if(sima->image->tpageflag & IMA_TILES) {
-
- /* just leave this a while */
- if(sima->image->xrep<1) return;
- if(sima->image->yrep<1) return;
-
- if(sima->curtile >= sima->image->xrep*sima->image->yrep)
- sima->curtile = sima->image->xrep*sima->image->yrep - 1;
-
- dx= ibuf->x/sima->image->xrep;
- dy= ibuf->y/sima->image->yrep;
-
- sy= (sima->curtile / sima->image->xrep);
- sx= sima->curtile - sy*sima->image->xrep;
-
- sx*= dx;
- sy*= dy;
-
- /* create char buffer from float if needed */
- if(ibuf->rect_float && ibuf->rect==NULL)
- IMB_rect_from_float(ibuf);
-
- rect= get_part_from_ibuf(ibuf, sx, sy, sx+dx, sy+dy);
-
- /* rect= ibuf->rect; */
- for(sy= 0; sy+dy<=ibuf->y; sy+= dy) {
- for(sx= 0; sx+dx<=ibuf->x; sx+= dx) {
- glaDrawPixelsSafe(x1+sx*sima->zoom, y1+sy*sima->zoom, dx, dy, dx, GL_RGBA, GL_UNSIGNED_BYTE, rect);
- }
- }
-
- MEM_freeN(rect);
- }
- else {
- float x1_rep, y1_rep;
- int x_rep, y_rep;
- double time_current;
- short loop_draw_ok = 0;
-
- if (sima->flag & SI_DRAW_TILE) {
- loop_draw_ok= 1;
- }
-
- time_current = PIL_check_seconds_timer();
-
- for (x_rep= ((int)G.v2d->cur.xmin)-1; x_rep < G.v2d->cur.xmax; x_rep++) {
- x1_rep=x1+ ((x_rep* ibuf->x * sima->zoom) *xuser_asp);
- for (y_rep= ((int)G.v2d->cur.ymin)-1; y_rep < G.v2d->cur.ymax; y_rep++) {
- y1_rep=y1+ ((y_rep * ibuf->y *sima->zoom) *yuser_asp);
-
- /* end repeating image loop */
-
- if(!loop_draw_ok) {
- y1_rep = y1;
- x1_rep = x1;
- }
-
- /*printf("Drawing %d %d zoom:%.6f (%.6f %.6f), (%.6f %.6f)\n", x_rep, y_rep, sima->zoom, G.v2d->cur.xmin, G.v2d->cur.ymin, G.v2d->cur.xmax, G.v2d->cur.ymax);*/
-
- /* this part is generic image display */
- if(sima->flag & SI_SHOW_ALPHA) {
- if(ibuf->rect)
- sima_draw_alpha_pixels(x1_rep, y1_rep, ibuf->x, ibuf->y, ibuf->rect);
- else if(ibuf->rect_float && ibuf->channels==4)
- sima_draw_alpha_pixelsf(x1_rep, y1_rep, ibuf->x, ibuf->y, ibuf->rect_float);
- }
- else if(sima->flag & SI_SHOW_ZBUF && ((ibuf->zbuf || ibuf->zbuf_float || (ibuf->channels==1)) == 0)) {
- if(ibuf->zbuf)
- sima_draw_zbuf_pixels(x1_rep, y1_rep, ibuf->x, ibuf->y, ibuf->zbuf);
- else if(ibuf->zbuf_float)
- sima_draw_zbuffloat_pixels(x1_rep, y1_rep, ibuf->x, ibuf->y, ibuf->zbuf_float);
- else if(ibuf->channels==1)
- sima_draw_zbuffloat_pixels(x1_rep, y1_rep, ibuf->x, ibuf->y, ibuf->rect_float);
- }
- else {
- if(sima->flag & SI_USE_ALPHA) {
- sima_draw_alpha_backdrop(sima, x1_rep, y1_rep, (float)ibuf->x, (float)ibuf->y);
- glEnable(GL_BLEND);
- glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- }
-
- /* detect if we need to redo the curve map.
- ibuf->rect is zero for compositor and render results after change
- convert to 32 bits always... drawing float rects isnt supported well (atis)
-
- NOTE: if float buffer changes, we have to manually remove the rect
- */
-
- if(ibuf->rect_float) {
- if(ibuf->rect==NULL) {
- if(image_curves_active(sa))
- curvemapping_do_ibuf(G.sima->cumap, ibuf);
- else
- IMB_rect_from_float(ibuf);
- }
- }
-
- if(ibuf->rect)
- glaDrawPixelsSafe(x1_rep, y1_rep, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
- // else
- // glaDrawPixelsSafe(x1_rep, y1_rep, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_FLOAT, ibuf->rect_float);
-
- if(sima->flag & SI_USE_ALPHA)
- glDisable(GL_BLEND);
- }
-
- /* only draw once */
- if(!loop_draw_ok) {
- break; /* only draw once */
- } else if ((PIL_check_seconds_timer() - time_current) > 0.25) {
- loop_draw_ok = 0;
- break;
- }
-
- /* tile draw loop */
- }
- /* only draw once */
- if(!loop_draw_ok) break;
- }
- /* tile draw loop */
-
- }
-
- brush= G.scene->toolsettings->imapaint.brush;
- if(brush && (G.scene->toolsettings->imapaint.tool == PAINT_TOOL_CLONE)) {
- int w, h;
- unsigned char *clonerect;
-
- /* this is not very efficient, but glDrawPixels doesn't allow
- drawing with alpha */
- clonerect= alloc_alpha_clone_image(&w, &h);
-
- if(clonerect) {
- int offx, offy;
- offx = sima->zoom*ibuf->x * + brush->clone.offset[0];
- offy = sima->zoom*ibuf->y * + brush->clone.offset[1];
-
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glaDrawPixelsSafe(x1 + offx, y1 + offy, w, h, w, GL_RGBA, GL_UNSIGNED_BYTE, clonerect);
- glDisable(GL_BLEND);
-
- MEM_freeN(clonerect);
- }
- }
-
- glPixelZoom(1.0, 1.0);
-
- if(show_viewer==0) {
- draw_uvs_sima();
- drawcursor_sima(xuser_asp, yuser_asp);
- }
- }
-
- glPixelZoom(1.0, 1.0);
-
- calc_image_view(sima, 'f'); /* float */
- }
-
- draw_image_transform(ibuf, xuser_asp, yuser_asp);
-
- mywinset(sa->win); /* restore scissor after gla call... */
- myortho2(-0.375, sa->winx-0.375, -0.375, sa->winy-0.375);
-
- if(G.rendering==0) {
- draw_image_view_tool();
- draw_image_view_icon();
- }
- draw_area_emboss(sa);
-
- /* it is important to end a view in a transform compatible with buttons */
- bwin_scalematrix(sa->win, sima->blockscale, sima->blockscale, sima->blockscale);
- if(!(G.rendering && show_render))
- image_blockhandlers(sa);
-
- sa->win_swap= WIN_BACK_OK;
-}
-
-static void image_zoom_power_of_two(void)
-{
- /* Make zoom a power of 2 */
-
- G.sima->zoom = 1 / G.sima->zoom;
- G.sima->zoom = log(G.sima->zoom) / log(2);
- G.sima->zoom = ceil(G.sima->zoom);
- G.sima->zoom = pow(2, G.sima->zoom);
- G.sima->zoom = 1 / G.sima->zoom;
-}
-
-static void image_zoom_set_factor(float zoomfac)
-{
- SpaceImage *sima= curarea->spacedata.first;
- int width, height;
-
- if (zoomfac <= 0.0f)
- return;
-
- sima->zoom *= zoomfac;
-
- if (sima->zoom > 0.1f && sima->zoom < 4.0f)
- return;
-
- /* check zoom limits */
-
- calc_image_view(G.sima, 'f'); /* was 'p' are there any cases where this should be 'p'?*/
- width= 256;
- height= 256;
- if (sima->image) {
- ImBuf *ibuf= imagewindow_get_ibuf(sima);
-
- if (ibuf) {
- float xim, yim;
- /* I know a bit weak... but preview uses not actual image size */
- if(image_preview_active(curarea, &xim, &yim)) {
- width= (int) xim;
- height= (int) yim;
- }
- else {
- width= ibuf->x;
- height= ibuf->y;
- }
- }
- }
- width *= sima->zoom;
- height *= sima->zoom;
-
- if ((width < 4) && (height < 4))
- sima->zoom /= zoomfac;
- else if((curarea->winrct.xmax - curarea->winrct.xmin) <= sima->zoom)
- sima->zoom /= zoomfac;
- else if((curarea->winrct.ymax - curarea->winrct.ymin) <= sima->zoom)
- sima->zoom /= zoomfac;
-}
-
-void image_viewmove(int mode)
-{
- short mval[2], mvalo[2], zoom0;
- int oldcursor;
- Window *win;
-
- getmouseco_sc(mvalo);
- zoom0= G.sima->zoom;
-
- oldcursor=get_cursor();
- win=winlay_get_active_window();
-
- SetBlenderCursor(BC_NSEW_SCROLLCURSOR);
-
- while(get_mbut()&(L_MOUSE|M_MOUSE)) {
-
- getmouseco_sc(mval);
-
- if(mvalo[0]!=mval[0] || mvalo[1]!=mval[1]) {
-
- if(mode==0) {
- G.sima->xof += (mvalo[0]-mval[0])/G.sima->zoom;
- G.sima->yof += (mvalo[1]-mval[1])/G.sima->zoom;
- }
- else if (mode==1) {
- float factor;
-
- factor= 1.0+(float)(mvalo[0]-mval[0]+mvalo[1]-mval[1])/300.0;
- image_zoom_set_factor(factor);
- }
-
- mvalo[0]= mval[0];
- mvalo[1]= mval[1];
-
- scrarea_do_windraw(curarea);
- screen_swapbuffers();
- }
- else BIF_wait_for_statechange();
- }
- window_set_cursor(win, oldcursor);
-
- if(image_preview_active(curarea, NULL, NULL)) {
- /* recalculates new preview rect */
- scrarea_do_windraw(curarea);
- image_preview_event(2);
- }
-}
-
-void image_viewzoom(unsigned short event, int invert)
-{
- SpaceImage *sima= curarea->spacedata.first;
-
- if(event==WHEELDOWNMOUSE || event==PADMINUS)
- image_zoom_set_factor((U.uiflag & USER_WHEELZOOMDIR)? 1.25: 0.8);
- else if(event==WHEELUPMOUSE || event==PADPLUSKEY)
- image_zoom_set_factor((U.uiflag & USER_WHEELZOOMDIR)? 0.8: 1.25);
- else if(event==PAD1)
- sima->zoom= 1.0;
- else if(event==PAD2)
- sima->zoom= (invert)? 2.0: 0.5;
- else if(event==PAD4)
- sima->zoom= (invert)? 4.0: 0.25;
- else if(event==PAD8)
- sima->zoom= (invert)? 8.0: 0.125;
-
- /* ensure pixel exact locations for draw */
- sima->xof= (int)sima->xof;
- sima->yof= (int)sima->yof;
-
- if(image_preview_active(curarea, NULL, NULL)) {
- /* recalculates new preview rect */
- scrarea_do_windraw(curarea);
- image_preview_event(2);
- }
-}
-
-/**
- * Updates the fields of the View2D member of the SpaceImage struct.
- * Default behavior is to reset the position of the image and set the zoom to 1
- * If the image will not fit within the window rectangle, the zoom is adjusted
- *
- * @return void
- *
- */
-void image_home(void)
-{
- ImBuf *ibuf;
- int width, height, imgwidth, imgheight;
- float zoomX, zoomY;
-
- if (curarea->spacetype != SPACE_IMAGE) return;
- ibuf= imagewindow_get_ibuf(G.sima);
-
- if (ibuf == NULL) {
- imgwidth = 256;
- imgheight = 256;
- }
- else {
- imgwidth = ibuf->x;
- imgheight = ibuf->y;
- }
-
- /* Check if the image will fit in the image with zoom==1 */
- width = curarea->winx;
- height = curarea->winy;
- if (((imgwidth >= width) || (imgheight >= height)) &&
- ((width > 0) && (height > 0))) {
- /* Find the zoom value that will fit the image in the image space */
- zoomX = ((float)width) / ((float)imgwidth);
- zoomY = ((float)height) / ((float)imgheight);
- G.sima->zoom= MIN2(zoomX, zoomY);
-
- image_zoom_power_of_two();
- }
- else {
- G.sima->zoom= 1.0f;
- }
-
- G.sima->xof= G.sima->yof= 0.0f;
-
- calc_image_view(G.sima, 'f'); /* was 'p' are there any cases where this should be 'p'?*/
- /*calc_arearcts(curarea);*/
- scrarea_queue_winredraw(curarea);
- scrarea_queue_winredraw(curarea);
-}
-
-void image_viewcenter(void)
-{
- ImBuf *ibuf= BKE_image_get_ibuf(G.sima->image, &G.sima->iuser);
- float size, min[2], max[2], d[2], xim=256.0f, yim=256.0f;
-
- if( is_uv_tface_editing_allowed()==0 ) return;
-
- if (!minmax_tface_uv(min, max)) return;
-
- if(ibuf) {
- xim= ibuf->x;
- yim= ibuf->y;
- }
-
- G.sima->xof= (int) (((min[0] + max[0])*0.5f - 0.5f)*xim);
- G.sima->yof= (int) (((min[1] + max[1])*0.5f - 0.5f)*yim);
-
- d[0] = max[0] - min[0];
- d[1] = max[1] - min[1];
- size= 0.5*MAX2(d[0], d[1])*MAX2(xim, yim)/256.0f;
-
- if(size<=0.01) size= 0.01;
-
- G.sima->zoom= 0.7/size;
-
- calc_image_view(G.sima, 'f'); /* was 'p' are there any cases where 'p' is still needed? */
-
- scrarea_queue_winredraw(curarea);
-}
-
-
-/* *********************** render callbacks ***************** */
-
-/* set on initialize render, only one render output to imagewindow can exist, so the global isnt dangerous yet :) */
-static ScrArea *image_area= NULL;
-
-/* can get as well the full picture, as the parts while rendering */
-static void imagewindow_progress(ScrArea *sa, RenderResult *rr, volatile rcti *renrect)
-{
- SpaceImage *sima= sa->spacedata.first;
- float x1, y1, *rectf= NULL;
- unsigned int *rect32= NULL;
- int ymin, ymax, xmin, xmax;
-
- /* if renrect argument, we only display scanlines */
- if(renrect) {
- /* if ymax==recty, rendering of layer is ready, we should not draw, other things happen... */
- if(rr->renlay==NULL || renrect->ymax>=rr->recty)
- return;
-
- /* xmin here is first subrect x coord, xmax defines subrect width */
- xmin = renrect->xmin;
- xmax = renrect->xmax - xmin;
- if (xmax<2) return;
-
- ymin= renrect->ymin;
- ymax= renrect->ymax - ymin;
- if(ymax<2)
- return;
- renrect->ymin= renrect->ymax;
- }
- else {
- xmin = ymin = 0;
- xmax = rr->rectx - 2*rr->crop;
- ymax = rr->recty - 2*rr->crop;
- }
-
- /* image window cruft */
-
- /* find current float rect for display, first case is after composit... still weak */
- if(rr->rectf)
- rectf= rr->rectf;
- else {
- if(rr->rect32)
- rect32= (unsigned int *)rr->rect32;
- else {
- if(rr->renlay==NULL || rr->renlay->rectf==NULL) return;
- rectf= rr->renlay->rectf;
- }
- }
- if(rectf) {
- /* if scanline updates... */
- rectf+= 4*(rr->rectx*ymin + xmin);
-
- /* when rendering more pixels than needed, we crop away cruft */
- if(rr->crop)
- rectf+= 4*(rr->crop*rr->rectx + rr->crop);
- }
-
- /* tilerect defines drawing offset from (0,0) */
- /* however, tilerect (xmin, ymin) is first pixel */
- x1 = sima->centx + (rr->tilerect.xmin + rr->crop + xmin)*sima->zoom;
- y1 = sima->centy + (rr->tilerect.ymin + rr->crop + ymin)*sima->zoom;
-
- /* needed for gla draw */
- { rcti rct= sa->winrct; rct.ymax-= RW_HEADERY; glaDefine2DArea(&rct);}
-
- glPixelZoom(sima->zoom, sima->zoom);
-
- if(rect32)
- glaDrawPixelsSafe(x1, y1, xmax, ymax, rr->rectx, GL_RGBA, GL_UNSIGNED_BYTE, rect32);
- else
- glaDrawPixelsSafe_to32(x1, y1, xmax, ymax, rr->rectx, rectf);
-
- glPixelZoom(1.0, 1.0);
-
-}
-
-
-/* in render window; display a couple of scanlines of rendered image */
-/* NOTE: called while render, so no malloc allowed! */
-static void imagewindow_progress_display_cb(RenderResult *rr, volatile rcti *rect)
-{
-
- if (image_area) {
-
- imagewindow_progress(image_area, rr, rect);
-
- /* no screen_swapbuffers, prevent any other window to draw */
- myswapbuffers();
- }
-}
-
-/* unused, init_display_cb is called on each render */
-static void imagewindow_clear_display_cb(RenderResult *rr)
-{
- if (image_area) {
- }
-}
-
-/* returns biggest area that is not uv/image editor. Note that it uses buttons */
-/* window as the last possible alternative. */
-static ScrArea *biggest_non_image_area(void)
-{
- ScrArea *sa, *big= NULL;
- int size, maxsize= 0, bwmaxsize= 0;
- short foundwin= 0;
-
- for(sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- if(sa->winx > 10 && sa->winy > 10) {
- size= sa->winx*sa->winy;
- if(sa->spacetype == SPACE_BUTS) {
- if(foundwin == 0 && size > bwmaxsize) {
- bwmaxsize= size;
- big= sa;
- }
- }
- else if(sa->spacetype != SPACE_IMAGE && size > maxsize) {
- maxsize= size;
- big= sa;
- foundwin= 1;
- }
- }
- }
-
- return big;
-}
-
-static ScrArea *biggest_area(void)
-{
- ScrArea *sa, *big= NULL;
- int size, maxsize= 0;
-
- for(sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- size= sa->winx*sa->winy;
- if(size > maxsize) {
- maxsize= size;
- big= sa;
- }
- }
- return big;
-}
-
-
-/* if R_DISPLAYIMAGE
- use Image Window showing Render Result
- else: turn largest non-image area into Image Window (not to frustrate texture or composite usage)
- else: then we use Image Window anyway...
- if R_DISPSCREEN
- make a new temp fullscreen area with Image Window
-*/
-
-static ScrArea *find_area_showing_r_result(void)
-{
- ScrArea *sa;
- SpaceImage *sima;
-
- /* find an imagewindow showing render result */
- for(sa=G.curscreen->areabase.first; sa; sa= sa->next) {
- if(sa->spacetype==SPACE_IMAGE) {
- sima= sa->spacedata.first;
- if(sima->image && sima->image->type==IMA_TYPE_R_RESULT)
- break;
- }
- }
- return sa;
-}
-
-static ScrArea *imagewindow_set_render_display(void)
-{
- ScrArea *sa;
- SpaceImage *sima;
-
- sa= find_area_showing_r_result();
-
- if(sa==NULL) {
- /* find largest open non-image area */
- sa= biggest_non_image_area();
- if(sa) {
- newspace(sa, SPACE_IMAGE);
- sima= sa->spacedata.first;
-
- /* makes ESC go back to prev space */
- sima->flag |= SI_PREVSPACE;
- }
- else {
- /* use any area of decent size */
- sa= biggest_area();
- if(sa->spacetype!=SPACE_IMAGE) {
- newspace(sa, SPACE_IMAGE);
- sima= sa->spacedata.first;
-
- /* makes ESC go back to prev space */
- sima->flag |= SI_PREVSPACE;
- }
- }
- }
-
- sima= sa->spacedata.first;
-
- /* get the correct image, and scale it */
- sima->image= BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result");
-
- if(G.displaymode==R_DISPLAYSCREEN) {
- if(sa->full==0) {
- sima->flag |= SI_FULLWINDOW;
- /* fullscreen works with lousy curarea */
- curarea= sa;
- area_fullscreen();
- sa= curarea;
- }
- }
-
- return sa;
-}
-
-static void imagewindow_init_display_cb(RenderResult *rr)
-{
-
- image_area= imagewindow_set_render_display();
-
- if(image_area) {
- SpaceImage *sima= image_area->spacedata.first;
-
- areawinset(image_area->win);
-
- if(sima->info_str==NULL)
- sima->info_str= MEM_callocN(RW_MAXTEXT, "info str imagewin");
-
- /* calc location using original size (tiles don't tell) */
- sima->centx= (image_area->winx - sima->zoom*(float)rr->rectx)/2.0f;
- sima->centy= (image_area->winy - sima->zoom*(float)rr->recty)/2.0f;
-
- sima->centx-= sima->zoom*sima->xof;
- sima->centy-= sima->zoom*sima->yof;
-
- drawimagespace(image_area, sima);
- if(image_area->headertype) scrarea_do_headdraw(image_area);
-
- /* no screen_swapbuffers, prevent any other window to draw */
- myswapbuffers();
-
- allqueue(REDRAWIMAGE, 0); /* redraw in end */
- }
-}
-
-/* coming from BIF_toggle_render_display() */
-void imagewindow_toggle_render(void)
-{
- ScrArea *sa;
-
- /* check if any imagewindow is showing temporal render output */
- for(sa=G.curscreen->areabase.first; sa; sa= sa->next) {
- if(sa->spacetype==SPACE_IMAGE) {
- SpaceImage *sima= sa->spacedata.first;
-
- if(sima->image && sima->image->type==IMA_TYPE_R_RESULT)
- if(sima->flag & (SI_PREVSPACE|SI_FULLWINDOW))
- break;
- }
- }
- if(sa) {
- addqueue(sa->win, ESCKEY, 1); /* also returns from fullscreen */
- }
- else {
- sa= imagewindow_set_render_display();
- scrarea_queue_headredraw(sa);
- scrarea_queue_winredraw(sa);
- }
-}
-
-/* NOTE: called while render, so no malloc allowed! */
-static void imagewindow_renderinfo_cb(RenderStats *rs)
-{
-
- if(image_area) {
- SpaceImage *sima= image_area->spacedata.first;
-
- if(rs)
- make_renderinfo_string(rs, sima->info_str);
-
- imagewindow_draw_renderinfo(image_area);
-
- /* no screen_swapbuffers, prevent any other window to draw */
- myswapbuffers();
- }
-}
-
-void imagewindow_render_callbacks(Render *re)
-{
- RE_display_init_cb(re, imagewindow_init_display_cb);
- RE_display_draw_cb(re, imagewindow_progress_display_cb);
- RE_display_clear_cb(re, imagewindow_clear_display_cb);
- RE_stats_draw_cb(re, imagewindow_renderinfo_cb);
-}
-
-void imagewin_store_spare(void)
-{
- ScrArea *sa= find_area_showing_r_result();
-
- if(sa) {
- ImBuf *ibuf;
- SpaceImage *sima= sa->spacedata.first;
-
- if(sima->spare==NULL)
- return;
-
- /* only store when it does not show spare */
- if(sima->showspare==0)
- return;
- sima->showspare= 0;
-
- /* free spare */
- IMB_freeImBuf(sima->spare);
-
- /* make a copy of render result */
- ibuf= BKE_image_get_ibuf(sima->image, &sima->iuser);
- sima->spare= IMB_dupImBuf(ibuf);
-
- if(sima->info_str)
- BLI_strncpy(sima->info_spare, sima->info_str, RW_MAXTEXT);
-
- }
-}
-
-/* context: in current image window? */
-void imagewindow_swap_render_rects(void)
-{
- ScrArea *sa= find_area_showing_r_result();
-
- if(sa) {
- SpaceImage *sima= sa->spacedata.first;
- ImBuf *ibuf= BKE_image_get_ibuf(sima->image, &sima->iuser);
- if(ibuf) {
-
- sima->showspare ^= 1;
-
- if(sima->spare==NULL)
- sima->spare= IMB_allocImBuf(ibuf->x, ibuf->y, 32, 0, 0);
- if(sima->info_spare==NULL)
- sima->info_spare= MEM_callocN(RW_MAXTEXT, "info str imagewin");
-
- allqueue(REDRAWIMAGE, 0);
- }
- }
-}
-
diff --git a/source/blender/src/drawimasel.c b/source/blender/src/drawimasel.c
deleted file mode 100644
index 88b6beb54c5..00000000000
--- a/source/blender/src/drawimasel.c
+++ /dev/null
@@ -1,735 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <string.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef _WIN32
-#pragma warning (once : 4761)
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_ID.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_object_types.h"
-#include "DNA_material_types.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_storage_types.h"
-#ifdef WIN32
-#include "BLI_winstuff.h"
-#endif
-
-
-#include "BKE_global.h"
-#include "BKE_library.h"
-#include "BKE_icons.h"
-#include "BKE_utildefines.h"
-#include "BIF_filelist.h"
-
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-#include "BIF_mywindow.h"
-#include "BIF_screen.h"
-#include "BIF_resources.h"
-#include "BIF_language.h"
-
-#include "BIF_interface.h"
-#include "BIF_interface_icons.h"
-#include "BIF_previewrender.h"
-#include "BIF_fsmenu.h"
-#include "BIF_space.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-
-#include "BSE_drawimasel.h"
-#include "BSE_drawipo.h" /* for v2d functions */
-#include "BSE_view.h"
-
-#include "BLO_readfile.h"
-
-#include "IMB_imbuf.h"
-#include "IMB_imbuf_types.h"
-
-#include "PIL_time.h"
-
-#include "blendef.h"
-#include "mydevice.h"
-
-#include "interface.h" /* urm... for rasterpos_safe, roundbox */
-
-#define BUTTONWIDTH 20
-#define BOOKMARKWIDTH_MAX 240
-
-void calc_imasel_rcts(SpaceImaSel *simasel, int winx, int winy)
-{
- int width = (int)16.0f*simasel->aspect;
- int numtiles;
- int numfiles = 0;
- int tilewidth = simasel->prv_w + TILE_BORDER_X*4;
- int tileheight = simasel->prv_h + TILE_BORDER_Y*4 + U.fontsize;
-
- // complete area of the space
- simasel->v2d.mask.xmin= simasel->v2d.mask.ymin = 0;
- simasel->v2d.mask.xmax= winx;
- simasel->v2d.mask.ymax= winy;
-
- // vertical scroll bar
- simasel->v2d.vert= simasel->v2d.mask;
- simasel->v2d.vert.xmax -= TILE_BORDER_X + 2;
- simasel->v2d.vert.xmin= simasel->v2d.vert.xmax- width - TILE_BORDER_X - 2;
- simasel->v2d.vert.ymax -= IMASEL_BUTTONS_HEIGHT + TILE_BORDER_Y + 2;
- simasel->v2d.vert.ymin += TILE_BORDER_Y + 2;
- // simasel->v2d.mask.xmax= simasel->v2d.vert.xmin;
-
- if (simasel->flag & FILE_BOOKMARKS) {
- int bmwidth = (simasel->v2d.vert.xmin - simasel->v2d.mask.xmin)/4.0f;
- if (bmwidth > BOOKMARKWIDTH_MAX) bmwidth = BOOKMARKWIDTH_MAX;
-
- simasel->bookmarkrect.xmin = simasel->v2d.mask.xmin + TILE_BORDER_X;
- simasel->bookmarkrect.xmax = simasel->v2d.mask.xmin + bmwidth - TILE_BORDER_X;
- simasel->bookmarkrect.ymax = simasel->v2d.mask.ymax - IMASEL_BUTTONS_HEIGHT - TILE_BORDER_Y;
- simasel->bookmarkrect.ymin = simasel->v2d.mask.ymin + TILE_BORDER_Y;
-
- simasel->viewrect.xmin = simasel->bookmarkrect.xmax + TILE_BORDER_X;
- simasel->viewrect.xmax = simasel->v2d.vert.xmin - TILE_BORDER_X;
- simasel->viewrect.ymax = simasel->v2d.mask.ymax - IMASEL_BUTTONS_HEIGHT - TILE_BORDER_Y;
- simasel->viewrect.ymin = simasel->v2d.mask.ymin + TILE_BORDER_Y;
- } else {
- simasel->viewrect.xmin = simasel->v2d.mask.xmin + TILE_BORDER_X;
- simasel->viewrect.xmax = simasel->v2d.vert.xmin - TILE_BORDER_X;
- simasel->viewrect.ymax = simasel->v2d.mask.ymax - IMASEL_BUTTONS_HEIGHT - TILE_BORDER_Y;
- simasel->viewrect.ymin = simasel->v2d.mask.ymin + TILE_BORDER_Y;
- }
-
- simasel->numtilesx = (simasel->viewrect.xmax - simasel->viewrect.xmin) / tilewidth;
- simasel->numtilesy = (simasel->viewrect.ymax - simasel->viewrect.ymin) / tileheight;
- numtiles = simasel->numtilesx*simasel->numtilesy;
-
- if (simasel->files) {
- numfiles = BIF_filelist_numfiles(simasel->files);
- }
- if (numtiles > numfiles) numtiles = numfiles;
-
- simasel->scrollarea = ((float)simasel->v2d.vert.ymax - (float)simasel->v2d.vert.ymin);
- if (numtiles < numfiles) {
- simasel->scrollheight = ((float)numtiles / (float)numfiles)*simasel->scrollarea;
- simasel->scrollarea -= simasel->scrollheight;
- } else {
- simasel->scrollheight = simasel->scrollarea;
- }
- if (simasel->scrollarea < 0) simasel->scrollarea = 0;
-}
-
-void draw_imasel_scroll(SpaceImaSel *simasel)
-{
- rcti scrollbar;
- rcti scrollhandle;
-
- scrollbar.xmin= simasel->v2d.cur.xmin + simasel->v2d.vert.xmin;
- scrollbar.ymin = simasel->v2d.cur.ymin + simasel->v2d.vert.ymin;
- scrollbar.xmax= simasel->v2d.cur.xmin + simasel->v2d.vert.xmax;
- scrollbar.ymax = simasel->v2d.cur.ymin + simasel->v2d.vert.ymax;
-
- scrollhandle.xmin= scrollbar.xmin;
- scrollhandle.ymin = scrollbar.ymax - simasel->scrollpos -1;
- scrollhandle.xmax= scrollbar.xmax-1;
- scrollhandle.ymax = scrollbar.ymax - simasel->scrollpos - simasel->scrollheight;
-
- BIF_ThemeColor(TH_SHADE1);
- glRecti(scrollbar.xmin, scrollbar.ymin, scrollbar.xmax, scrollbar.ymax);
- uiEmboss(scrollbar.xmin-2, scrollbar.ymin-2, scrollbar.xmax+2, scrollbar.ymax+2, 1);
-
- BIF_ThemeColor(TH_SHADE2);
- glRecti(scrollhandle.xmin, scrollhandle.ymin, scrollhandle.xmax, scrollhandle.ymax);
-
- uiEmboss(scrollhandle.xmin, scrollhandle.ymin, scrollhandle.xmax, scrollhandle.ymax, 1);
-}
-
-static void draw_tile(SpaceImaSel *simasel, short sx, short sy, int colorid)
-{
- /* TODO: BIF_ThemeColor seems to need this to show the color, not sure why? - elubie */
- glEnable(GL_BLEND);
- glColor4ub(0, 0, 0, 100);
- glDisable(GL_BLEND);
-
- BIF_ThemeColor4(colorid);
- uiSetRoundBox(15);
- uiRoundBox(sx+TILE_BORDER_X, sy - simasel->prv_h - TILE_BORDER_Y*3 - U.fontsize, sx + simasel->prv_w + TILE_BORDER_X*3, sy, 6);
-}
-
-static float shorten_string(SpaceImaSel *simasel, char* string, float w)
-{
- short shortened = 0;
- float sw = 0;
-
- sw = BIF_GetStringWidth(simasel->curfont, string, 0);
- while (sw>w) {
- int slen = strlen(string);
- string[slen-1] = '\0';
- sw = BIF_GetStringWidth(simasel->curfont, string, 0);
- shortened = 1;
- }
- if (shortened) {
- int slen = strlen(string);
- if (slen > 3) {
- BLI_strncpy(string+slen-3, "...", 4);
- }
- }
- return sw;
-}
-
-static void draw_file(SpaceImaSel *simasel, short sx, short sy, struct direntry *file)
-{
- short soffs;
- char fname[FILE_MAXFILE];
- float sw;
-
- BLI_strncpy(fname,file->relname, FILE_MAXFILE);
- sw = shorten_string(simasel, fname, simasel->prv_w );
- soffs = (simasel->prv_w + TILE_BORDER_X*4 - sw) / 2;
-
- ui_rasterpos_safe(sx+soffs, sy - simasel->prv_h - TILE_BORDER_Y*2 - U.fontsize, simasel->aspect);
-#ifdef WIN32
- BIF_DrawString(simasel->curfont, fname, ((U.transopts & USER_TR_MENUS) | CONVERT_TO_UTF8));
-#else
- BIF_DrawString(simasel->curfont, fname, (U.transopts & USER_TR_MENUS));
-#endif
-}
-
-static void draw_imasel_bookmarks(ScrArea *sa, SpaceImaSel *simasel)
-{
- char bookmark[FILE_MAX];
- float sw;
-
- if (simasel->flag & FILE_BOOKMARKS) {
- int nentries = fsmenu_get_nentries();
- int i;
- short sx, sy;
- int bmwidth;
- int linestep = U.fontsize*3/2;
-
- sx = simasel->bookmarkrect.xmin + TILE_BORDER_X;
- sy = simasel->bookmarkrect.ymax - TILE_BORDER_Y - linestep;
- bmwidth = simasel->bookmarkrect.xmax - simasel->bookmarkrect.xmin - 2*TILE_BORDER_X;
-
- if (bmwidth < 0) return;
-
- for (i=0; i< nentries && sy > linestep ;++i) {
- char *fname = fsmenu_get_entry(i);
- char *sname = NULL;
-
- if (fname) {
- int sl;
- BLI_strncpy(bookmark, fname, FILE_MAX);
-
- sl = strlen(bookmark)-1;
- if (bookmark[sl] == '\\' || bookmark[sl] == '/') {
- bookmark[sl] = '\0';
- sl--;
- }
- while (sl) {
- if (bookmark[sl] == '\\' || bookmark[sl] == '/'){
- sl++;
- break;
- };
- sl--;
- }
- sname = &bookmark[sl];
- sw = shorten_string(simasel, sname, bmwidth);
-
-
- if (simasel->active_bookmark == i ) {
- glEnable(GL_BLEND);
- glColor4ub(0, 0, 0, 100);
- glDisable(GL_BLEND);
- BIF_ThemeColor(TH_HILITE);
- uiSetRoundBox(15);
- uiRoundBox(simasel->bookmarkrect.xmin + TILE_BORDER_X - 1, sy - linestep*0.25, simasel->bookmarkrect.xmax - TILE_BORDER_X + 1, sy + linestep*0.75, 6);
- BIF_ThemeColor(TH_TEXT_HI);
- } else {
- BIF_ThemeColor(TH_TEXT);
- }
- ui_rasterpos_safe(sx, sy, simasel->aspect);
-#ifdef WIN32
- BIF_DrawString(simasel->curfont, sname, ((U.transopts & USER_TR_MENUS) | CONVERT_TO_UTF8));
-#else
- BIF_DrawString(simasel->curfont, sname, (U.transopts & USER_TR_MENUS));
-#endif
- sy -= linestep;
- } else {
- cpack(0xB0B0B0);
- sdrawline(sx, sy + U.fontsize/2 , sx + bmwidth, sy + U.fontsize/2);
- cpack(0x303030);
- sdrawline(sx, sy + 1 + U.fontsize/2 , sx + bmwidth, sy + 1 + U.fontsize/2);
- sy -= linestep;
- }
- }
-
- uiEmboss(simasel->bookmarkrect.xmin, simasel->bookmarkrect.ymin, simasel->bookmarkrect.xmax-1, simasel->bookmarkrect.ymax-1, 1);
- }
-}
-
-static void draw_imasel_previews(ScrArea *sa, SpaceImaSel *simasel)
-{
- static double lasttime= 0;
- struct FileList* files = simasel->files;
- int numfiles;
- struct direntry *file;
- int numtiles;
-
- int tilewidth = simasel->prv_w + TILE_BORDER_X*4;
- int tileheight = simasel->prv_h + TILE_BORDER_Y*4 + U.fontsize;
- short sx, sy;
- int do_load = 1;
-
- ImBuf* imb=0;
- int i,j;
- short type;
- int colorid = 0;
- int todo;
- int fileoffset, rowoffset, columnoffset;
- float scrollofs;
-
-
- rcti viewrect = simasel->viewrect;
-
- if (!files) return;
- /* Reload directory */
- BLI_strncpy(simasel->dir, BIF_filelist_dir(files), FILE_MAXDIR);
-
- type = BIF_filelist_gettype(simasel->files);
-
- if (BIF_filelist_empty(files))
- {
- unsigned int filter = 0;
- BIF_filelist_hidedot(simasel->files, simasel->flag & FILE_HIDE_DOT);
- if (simasel->flag & FILE_FILTER) {
- filter = simasel->filter ;
- } else {
- filter = 0;
- }
-
- BIF_filelist_setfilter(simasel->files, filter);
- BIF_filelist_readdir(files);
-
- if(simasel->sort!=FILE_SORTALPHA) BIF_filelist_sort(simasel->files, simasel->sort);
- }
-
- BIF_filelist_imgsize(simasel->files,simasel->prv_w,simasel->prv_h);
-
- numfiles = BIF_filelist_numfiles(files);
- numtiles = simasel->numtilesx*simasel->numtilesy;
-
- if (numtiles > numfiles) numtiles = numfiles;
-
- todo = 0;
- if (lasttime < 0.001) lasttime = PIL_check_seconds_timer();
-
-
- if (simasel->numtilesx > 0) {
- /* calculate the offset to start drawing */
- if ((numtiles < numfiles) && (simasel->scrollarea > 0)) {
- fileoffset = numfiles*( (simasel->scrollpos) / simasel->scrollarea) + 0.5;
- } else {
- fileoffset = 0;
- }
- rowoffset = (fileoffset / simasel->numtilesx)*simasel->numtilesx;
- columnoffset = fileoffset % simasel->numtilesx;
- scrollofs = (float)tileheight*(float)columnoffset/(float)simasel->numtilesx;
- } else {
- rowoffset = 0;
- scrollofs = 0;
- }
- /* add partially visible row */
- numtiles += simasel->numtilesx;
- for (i=rowoffset, j=0 ; (i < numfiles) && (j < numtiles); ++i, ++j)
- {
- sx = simasel->v2d.cur.xmin + viewrect.xmin + (j % simasel->numtilesx)*tilewidth;
- sy = simasel->v2d.cur.ymin + viewrect.ymax + (short)scrollofs - (viewrect.ymin + (j / simasel->numtilesx)*tileheight);
-
- file = BIF_filelist_file(files, i);
-
- if (simasel->active_file == i) {
- colorid = TH_ACTIVE;
- draw_tile(simasel, sx, sy, colorid);
- } else if (file->flags & ACTIVE) {
- colorid = TH_HILITE;
- draw_tile(simasel, sx, sy, colorid);
- } else {
- /*
- colorid = TH_PANEL;
- draw_tile(simasel, sx, sy, colorid);
- */
- }
-
- if ( type == FILE_MAIN) {
- ID *id;
- int icon_id = 0;
- int idcode;
- idcode= BIF_groupname_to_code(simasel->dir);
- if (idcode == ID_MA || idcode == ID_TE || idcode == ID_LA || idcode == ID_WO || idcode == ID_IM) {
- id = (ID *)file->poin;
- icon_id = BKE_icon_getid(id);
- }
- if (icon_id) {
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- if (do_load) {
- BIF_icon_draw_preview(sx+2*TILE_BORDER_X, sy-simasel->prv_w-TILE_BORDER_X, icon_id, 0);
- } else {
- BIF_icon_draw_preview(sx+2*TILE_BORDER_X, sy-simasel->prv_w-TILE_BORDER_X, icon_id, 1);
- todo++;
- }
-
- glDisable(GL_BLEND);
- }
- }
- else {
- if ( (file->flags & IMAGEFILE) || (file->flags & MOVIEFILE))
- {
- if (do_load) {
- BIF_filelist_loadimage(simasel->files, i);
- } else {
- todo++;
- }
- imb = BIF_filelist_getimage(simasel->files, i);
- } else {
- imb = BIF_filelist_getimage(simasel->files, i);
- }
-
- if (imb) {
- float fx = ((float)simasel->prv_w - (float)imb->x)/2.0f;
- float fy = ((float)simasel->prv_h - (float)imb->y)/2.0f;
- short dx = (short)(fx + 0.5f);
- short dy = (short)(fy + 0.5f);
-
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- // glaDrawPixelsSafe((float)sx+8 + dx, (float)sy - imgwidth + dy - 8, imb->x, imb->y, imb->x, GL_RGBA, GL_UNSIGNED_BYTE, imb->rect);
- glColor4f(1.0, 1.0, 1.0, 1.0);
- glaDrawPixelsTex((float)sx+2*TILE_BORDER_X + dx, (float)sy - simasel->prv_h + dy - 2*TILE_BORDER_Y, imb->x, imb->y,GL_UNSIGNED_BYTE, imb->rect);
- // glDisable(GL_BLEND);
- imb = 0;
- }
- }
-
- if (type == FILE_MAIN) {
- glColor3f(1.0f, 1.0f, 1.0f);
- }
- else {
- if (S_ISDIR(file->type)) {
- glColor3f(1.0f, 1.0f, 0.9f);
- }
- else if (file->flags & IMAGEFILE) {
- BIF_ThemeColor(TH_SEQ_IMAGE);
- }
- else if (file->flags & MOVIEFILE) {
- BIF_ThemeColor(TH_SEQ_MOVIE);
- }
- else if (file->flags & BLENDERFILE) {
- BIF_ThemeColor(TH_SEQ_SCENE);
- }
- else {
- if (simasel->active_file == i) {
- BIF_ThemeColor(TH_GRID); /* grid used for active text */
- } else if (file->flags & ACTIVE) {
- BIF_ThemeColor(TH_TEXT_HI);
- } else {
- BIF_ThemeColor(TH_TEXT);
- }
- }
- }
-
- draw_file(simasel, sx, sy, file);
-
- if(do_load && (PIL_check_seconds_timer() - lasttime > 0.3)) {
- lasttime= PIL_check_seconds_timer();
- do_load = 0;
- }
- }
-
- if (!do_load && todo > 0) /* we broke off loading */
- addafterqueue(sa->win, RENDERPREVIEW, 1);
-}
-
-
-/* in panel space! */
-static void imasel_imgdraw(ScrArea *sa, uiBlock *block)
-{
- SpaceImaSel *simasel= sa->spacedata.first;
- rctf dispf;
- rcti winrect;
- struct direntry *file;
- char path[FILE_MAX];
- float tsize;
- short ofsx=0;
- short ofsy=0;
- short ex, ey;
- float scaledx, scaledy;
- int index;
-
- BLI_init_rctf(&dispf, 0.0f, (block->maxx - block->minx)-0.0f, 0.0f, (block->maxy - block->miny)-0.0f);
- ui_graphics_to_window_rct(sa->win, &dispf, &winrect);
-
- if (!simasel->img) {
- BLI_join_dirfile(path, simasel->dir, simasel->file);
- if (!BLI_exists(path))
- return;
-
- index = BIF_filelist_find(simasel->files, simasel->file);
- if (index >= 0) {
- file = BIF_filelist_file(simasel->files,index);
- if (file->flags & IMAGEFILE || file->flags & MOVIEFILE) {
- simasel->img = IMB_loadiffname(path, IB_rect);
-
- if (simasel->img) {
- tsize = MIN2(winrect.xmax - winrect.xmin,winrect.ymax - winrect.ymin);
-
- if (simasel->img->x > simasel->img->y) {
- scaledx = (float)tsize;
- scaledy = ( (float)simasel->img->y/(float)simasel->img->x )*tsize;
- ofsy = (scaledx - scaledy) / 2.0;
- ofsx = 0;
- }
- else {
- scaledy = (float)tsize;
- scaledx = ( (float)simasel->img->x/(float)simasel->img->y )*tsize;
- ofsx = (scaledy - scaledx) / 2.0;
- ofsy = 0;
- }
- ex = (short)scaledx;
- ey = (short)scaledy;
-
- IMB_scaleImBuf(simasel->img, ex, ey);
- }
- }
- }
- }
- if (simasel->img == NULL)
- return;
- if(simasel->img->rect==NULL)
- return;
-
- /* correction for gla draw */
- BLI_translate_rcti(&winrect, -curarea->winrct.xmin, -curarea->winrct.ymin);
-
- glaDefine2DArea(&sa->winrct);
- glaDrawPixelsSafe(winrect.xmin+ofsx, winrect.ymin+ofsy, simasel->img->x, simasel->img->y, simasel->img->x, GL_RGBA, GL_UNSIGNED_BYTE, simasel->img->rect);
-}
-
-static void imasel_panel_image(ScrArea *sa, short cntrl)
-{
- uiBlock *block;
- SpaceImaSel *simasel= sa->spacedata.first;
- short w = 300;
- short h = 300;
- short offsx, offsy;
-
- if (simasel->img) {
- w = simasel->img->x;
- h = simasel->img->y;
- }
-
- offsx = -150 + (simasel->v2d.mask.xmax - simasel->v2d.mask.xmin)/2;
- offsy = -150 + (simasel->v2d.mask.ymax - simasel->v2d.mask.ymin)/2;
-
- block= uiNewBlock(&curarea->uiblocks, "imasel_panel_image", UI_EMBOSS, UI_HELV, curarea->win);
- uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | cntrl);
- uiSetPanelHandler(IMASEL_HANDLER_IMAGE); // for close and esc
- if(uiNewPanel(curarea, block, "Image Preview", "Image Browser", offsx, offsy, w, h)==0)
- return;
- uiBlockSetDrawExtraFunc(block, imasel_imgdraw);
-}
-
-static void imasel_blockhandlers(ScrArea *sa)
-{
- SpaceImaSel *simasel= sa->spacedata.first;
- short a;
-
- for(a=0; a<SPACE_MAXHANDLER; a+=2) {
- switch(simasel->blockhandler[a]) {
-
- case IMASEL_HANDLER_IMAGE:
- imasel_panel_image(sa, simasel->blockhandler[a+1]);
- break;
-
- }
- /* clear action value for event */
- simasel->blockhandler[a+1]= 0;
- }
- uiDrawBlocksPanels(sa, 0);
-}
-
-
-static void draw_imasel_buttons(ScrArea *sa, SpaceImaSel* simasel)
-{
- uiBlock *block;
- int loadbutton;
- char name[20];
- char *menu;
- float slen;
- float parentbut_width = 20;
- float bookmarkbut_width = 0.0f;
- int filebuty1, filebuty2;
-
- float xmin = simasel->v2d.mask.xmin + 10;
- float xmax = simasel->v2d.mask.xmax - 10;
-
- filebuty1= simasel->v2d.mask.ymax - IMASEL_BUTTONS_HEIGHT;
- filebuty2= filebuty1+IMASEL_BUTTONS_HEIGHT/2 -6;
-
- /* HEADER */
- sprintf(name, "win %d", sa->win);
- block = uiNewBlock(&sa->uiblocks, name, UI_EMBOSS, UI_HELV, sa->win);
-
- uiSetButLock( BIF_filelist_gettype(simasel->files)==FILE_MAIN && simasel->returnfunc, NULL);
-
- /* space available for load/save buttons? */
- slen = BIF_GetStringWidth(G.font, simasel->title, simasel->aspect);
- loadbutton= slen > 60 ? slen + 20 : 80; /* MAX2(80, 20+BIF_GetStringWidth(G.font, simasel->title)); */
- if(simasel->v2d.mask.xmax-simasel->v2d.mask.xmin > loadbutton+20) {
- if(simasel->title[0]==0) {
- loadbutton= 0;
- }
- }
- else {
- loadbutton= 0;
- }
-
- menu= fsmenu_build_menu();
-
- if (menu[0]) {
- bookmarkbut_width = parentbut_width;
- }
-
- uiDefBut(block, TEX, B_FS_FILENAME,"", xmin+parentbut_width+bookmarkbut_width+2, filebuty1, xmax-xmin-loadbutton-parentbut_width-bookmarkbut_width, 21, simasel->file, 0.0, (float)FILE_MAXFILE-1, 0, 0, "");
- uiDefBut(block, TEX, B_FS_DIRNAME,"", xmin+parentbut_width, filebuty2, xmax-xmin-loadbutton-parentbut_width, 21, simasel->dir, 0.0, (float)FILE_MAXFILE-1, 0, 0, "");
-
- if(loadbutton) {
- uiSetCurFont(block, UI_HELV);
- uiDefBut(block, BUT,B_FS_LOAD, simasel->title, xmax-loadbutton, filebuty2, loadbutton, 21, simasel->dir, 0.0, (float)FILE_MAXFILE-1, 0, 0, "");
- uiDefBut(block, BUT,B_FS_CANCEL, "Cancel", xmax-loadbutton, filebuty1, loadbutton, 21, simasel->file, 0.0, (float)FILE_MAXFILE-1, 0, 0, "");
- }
-
- if(menu[0]) { // happens when no .Bfs is there, and first time browse
- uiDefButS(block, MENU,B_FS_DIR_MENU, menu, xmin, filebuty1, parentbut_width, 21, &simasel->menu, 0, 0, 0, 0, "");
- uiDefBut(block, BUT, B_FS_BOOKMARK, "B", xmin+22, filebuty1, bookmarkbut_width, 21, 0, 0, 0, 0, 0, "Bookmark current directory");
- }
- MEM_freeN(menu);
-
- uiDefBut(block, BUT, B_FS_PARDIR, "P", xmin, filebuty2, parentbut_width, 21, 0, 0, 0, 0, 0, "Move to the parent directory (PKEY)");
-
- uiDrawBlock(block);
-}
-
-
-
-/* ************** main drawing function ************** */
-
-void drawimaselspace(ScrArea *sa, void *spacedata)
-{
- float col[3];
- SpaceImaSel *simasel= curarea->spacedata.first;
-
- BIF_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- /* HACK: somehow when going fullscreen, v2d isn't set correctly */
- simasel->v2d.cur.xmin= simasel->v2d.cur.ymin= 0.0f;
- simasel->v2d.cur.xmax= sa->winx;
- simasel->v2d.cur.ymax= sa->winy;
- simasel->v2d.tot= simasel->v2d.cur;
- test_view2d(G.v2d, sa->winx, sa->winy);
-
- calc_imasel_rcts(simasel, sa->winx, sa->winy);
-
- myortho2(simasel->v2d.cur.xmin, simasel->v2d.cur.xmax, simasel->v2d.cur.ymin, simasel->v2d.cur.ymax);
- bwin_clear_viewmat(sa->win); /* clear buttons view */
- glLoadIdentity();
-
- /* warning; blocks need to be freed each time, handlers dont remove */
- uiFreeBlocksWin(&sa->uiblocks, sa->win);
-
- /* aspect+font, set each time */
- simasel->aspect= (simasel->v2d.cur.xmax - simasel->v2d.cur.xmin)/((float)sa->winx);
- simasel->curfont= uiSetCurFont_ext(simasel->aspect);
-
- if (!simasel->files) {
- simasel->files = BIF_filelist_new();
- BIF_filelist_setdir(simasel->files, simasel->dir);
- BIF_filelist_settype(simasel->files, simasel->type);
- }
-
- /* Buttons */
- draw_imasel_buttons(sa, simasel);
-
- /* scrollbar */
- draw_imasel_scroll(simasel);
-
- /* bookmarks */
- draw_imasel_bookmarks(sa, simasel);
-
- uiEmboss(simasel->viewrect.xmin, simasel->viewrect.ymin, simasel->v2d.mask.xmax-TILE_BORDER_X, simasel->viewrect.ymax, 1);
-
-
- glScissor(sa->winrct.xmin + simasel->viewrect.xmin ,
- sa->winrct.ymin + simasel->viewrect.ymin,
- simasel->viewrect.xmax - simasel->viewrect.xmin ,
- simasel->viewrect.ymax - simasel->viewrect.ymin);
-
- /* previews */
- draw_imasel_previews(sa, simasel);
-
- /* BIF_ThemeColor(TH_HEADER);*/
- /* glRecti(simasel->viewrect.xmin, simasel->viewrect.ymin, simasel->viewrect.xmax, simasel->viewrect.ymax);*/
-
- /* restore viewport (not needed yet) */
- mywinset(sa->win);
-
- /* ortho at pixel level curarea */
- myortho2(-0.375, curarea->winx-0.375, -0.375, curarea->winy-0.375);
-
- draw_area_emboss(sa);
-
- imasel_blockhandlers(sa);
-
- curarea->win_swap= WIN_BACK_OK;
-}
diff --git a/source/blender/src/drawipo.c b/source/blender/src/drawipo.c
deleted file mode 100644
index fd3fa0df927..00000000000
--- a/source/blender/src/drawipo.c
+++ /dev/null
@@ -1,2730 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef _WIN32
-#include <unistd.h>
-#else
-#include <io.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "DNA_action_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_ipo_types.h"
-#include "DNA_key_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_sequence_types.h"
-#include "DNA_userdef_types.h"
-
-#include "BKE_curve.h"
-#include "BKE_depsgraph.h"
-#include "BKE_global.h"
-#include "BKE_ipo.h"
-#include "BKE_key.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_cursors.h"
-#include "BIF_gl.h"
-#include "BIF_graphics.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_interface.h"
-#include "BIF_mywindow.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-#include "BIF_glutil.h"
-#include "BIF_editseq.h"
-#include "BIF_editaction.h"
-#include "BIF_language.h"
-
-#include "BSE_drawipo.h"
-#include "BSE_view.h"
-#include "BSE_editipo.h"
-#include "BSE_editipo_types.h"
-#include "BSE_editnla_types.h"
-#include "BSE_time.h"
-
-#include "BPY_extern.h"
-
-#include "mydevice.h"
-#include "blendef.h"
-#include "butspace.h" // shouldnt be...
-#include "interface.h" /* for ui_rasterpos_safe */
-#include "winlay.h"
-
-/* local define... also used in editipo ... */
-#define ISPOIN(a, b, c) ( (a->b) && (a->c) )
-#define ISPOIN3(a, b, c, d) ( (a->b) && (a->c) && (a->d) )
-#define ISPOIN4(a, b, c, d, e) ( (a->b) && (a->c) && (a->d) && (a->e) )
-
- /* minimum pixels per gridstep */
-#define IPOSTEP 35
-
-static float ipogrid_dx, ipogrid_dy, ipogrid_startx, ipogrid_starty;
-static int ipomachtx, ipomachty;
-
-static int vertymin, vertymax, horxmin, horxmax; /* globals to test LEFTMOUSE for scrollbar */
-
-static void scroll_prstr(float x, float y, float val, char dir, int disptype)
-{
- int len, macht;
- char str[32];
-
- if(dir=='v') {
- macht= ipomachty;
- if ELEM(disptype, IPO_DISPDEGR, IPO_DISPTIME) {
- macht+=1;
- val *= 10;
- }
- }
- else macht= ipomachtx;
-
- if (macht<=0) sprintf(str, "%.*f", 1-macht, val);
- else sprintf(str, "%d", (int)floor(val + 0.375));
-
- len= strlen(str);
- if(dir=='h') x-= 4*len;
-
- if(dir=='v' && disptype==IPO_DISPDEGR) {
- str[len]= 186; /* Degree symbol */
- str[len+1]= 0;
- }
-
- ui_rasterpos_safe(x, y, 1.0);
- BIF_DrawString(G.fonts, str, 0);
-}
-
-static void step_to_grid(float *step, int *macht)
-{
- float loga, rem;
-
- /* try to write step as a power of 10 */
-
- loga= log10(*step);
- *macht= (int)(loga);
-
- rem= loga- *macht;
- rem= pow(10.0, rem);
-
- if(loga<0.0) {
- if(rem < 0.2) rem= 0.2;
- else if(rem < 0.5) rem= 0.5;
- else rem= 1.0;
-
- *step= rem*pow(10.0, (float)*macht);
-
- // partial of a frame have no meaning
- switch(curarea->spacetype) {
- case SPACE_TIME: {
- SpaceTime *stime= curarea->spacedata.first;
- if(stime->flag & TIME_DRAWFRAMES) {
- rem = 1.0;
- *step = 1.0;
- }
- break;
- }
- case SPACE_SEQ: {
- SpaceTime * sseq= curarea->spacedata.first;
- if (sseq->flag & SEQ_DRAWFRAMES) {
- rem = 1.0;
- *step = 1.0;
- }
- }
- default:
- break;
- }
-
-
-
- if(rem==1.0) (*macht)++; // prevents printing 1.0 2.0 3.0 etc
- }
- else {
- if(rem < 2.0) rem= 2.0;
- else if(rem < 5.0) rem= 5.0;
- else rem= 10.0;
-
- *step= rem*pow(10.0, (float)*macht);
-
- (*macht)++;
- if(rem==10.0) (*macht)++; // prevents printing 1.0 2.0 3.0 etc
- }
-}
-
-void calc_ipogrid()
-{
- float space, pixels, secondiv=1.0;
- int secondgrid= 0;
- /* rule: gridstep is minimal IPOSTEP pixels */
- /* how large is IPOSTEP pixels? */
-
- if(G.v2d==0) return;
-
- /* detect of we have seconds or frames, should become argument */
-
- switch(curarea->spacetype) {
- case SPACE_TIME: {
- SpaceTime *stime= curarea->spacedata.first;
- if(!(stime->flag & TIME_DRAWFRAMES)) {
- secondgrid= 1;
- secondiv= 0.01 * FPS;
- }
- break;
- }
- case SPACE_SEQ: {
- SpaceSeq * sseq = curarea->spacedata.first;
- if (!(sseq->flag & SEQ_DRAWFRAMES)) {
- secondgrid = 1;
- secondiv = 0.01 * FPS;
- }
- break;
- }
- case SPACE_ACTION: {
- SpaceAction *saction = curarea->spacedata.first;
- if (saction->flag & SACTION_DRAWTIME) {
- secondgrid = 1;
- secondiv = 0.01 * FPS;
- }
- break;
- }
- case SPACE_NLA: {
- SpaceNla *snla = curarea->spacedata.first;
- if (snla->flag & SNLA_DRAWTIME) {
- secondgrid = 1;
- secondiv = 0.01 * FPS;
- }
- break;
- }
- default:
- break;
- }
-
- space= G.v2d->cur.xmax - G.v2d->cur.xmin;
- pixels= G.v2d->mask.xmax-G.v2d->mask.xmin;
-
- ipogrid_dx= IPOSTEP*space/(secondiv*pixels);
- step_to_grid(&ipogrid_dx, &ipomachtx);
- ipogrid_dx*= secondiv;
-
- if ELEM5(curarea->spacetype, SPACE_SEQ, SPACE_SOUND, SPACE_TIME, SPACE_ACTION, SPACE_NLA) {
- if(ipogrid_dx < 0.1) ipogrid_dx= 0.1;
- ipomachtx-= 2;
- if(ipomachtx<-2) ipomachtx= -2;
- }
-
- space= (G.v2d->cur.ymax - G.v2d->cur.ymin);
- pixels= curarea->winy;
- ipogrid_dy= IPOSTEP*space/pixels;
- step_to_grid(&ipogrid_dy, &ipomachty);
-
- if ELEM5(curarea->spacetype, SPACE_SEQ, SPACE_SOUND, SPACE_TIME, SPACE_ACTION, SPACE_NLA) {
- if(ipogrid_dy < 1.0) ipogrid_dy= 1.0;
- if(ipomachty<1) ipomachty= 1;
- }
-
- ipogrid_startx= secondiv*(G.v2d->cur.xmin/secondiv - fmod(G.v2d->cur.xmin/secondiv, ipogrid_dx/secondiv));
- if(G.v2d->cur.xmin<0.0) ipogrid_startx-= ipogrid_dx;
-
- ipogrid_starty= (G.v2d->cur.ymin-fmod(G.v2d->cur.ymin, ipogrid_dy));
- if(G.v2d->cur.ymin<0.0) ipogrid_starty-= ipogrid_dy;
-
-}
-
-void draw_ipogrid(void)
-{
- float vec1[2], vec2[2];
- int a, step;
-
- vec1[0]= vec2[0]= ipogrid_startx;
- vec1[1]= ipogrid_starty;
- vec2[1]= G.v2d->cur.ymax;
-
- step= (G.v2d->mask.xmax-G.v2d->mask.xmin+1)/IPOSTEP;
-
- BIF_ThemeColor(TH_GRID);
-
- for(a=0; a<step; a++) {
- glBegin(GL_LINE_STRIP);
- glVertex2fv(vec1); glVertex2fv(vec2);
- glEnd();
- vec2[0]= vec1[0]+= ipogrid_dx;
- }
-
- vec2[0]= vec1[0]-= 0.5*ipogrid_dx;
-
- BIF_ThemeColorShade(TH_GRID, 16);
-
- step++;
- for(a=0; a<=step; a++) {
- glBegin(GL_LINE_STRIP);
- glVertex2fv(vec1); glVertex2fv(vec2);
- glEnd();
- vec2[0]= vec1[0]-= ipogrid_dx;
- }
-
- if ELEM4(curarea->spacetype, SPACE_SOUND, SPACE_ACTION, SPACE_NLA, SPACE_TIME);
- else {
- vec1[0]= ipogrid_startx;
- vec1[1]= vec2[1]= ipogrid_starty;
- vec2[0]= G.v2d->cur.xmax;
-
- step= (curarea->winy+1)/IPOSTEP;
-
- BIF_ThemeColor(TH_GRID);
- for(a=0; a<=step; a++) {
- glBegin(GL_LINE_STRIP);
- glVertex2fv(vec1); glVertex2fv(vec2);
- glEnd();
- vec2[1]= vec1[1]+= ipogrid_dy;
- }
- vec2[1]= vec1[1]-= 0.5*ipogrid_dy;
- step++;
-
- if(curarea->spacetype==SPACE_IPO) {
- BIF_ThemeColorShade(TH_GRID, 16);
- for(a=0; a<step; a++) {
- glBegin(GL_LINE_STRIP);
- glVertex2fv(vec1); glVertex2fv(vec2);
- glEnd();
- vec2[1]= vec1[1]-= ipogrid_dy;
- }
- }
- }
-
- BIF_ThemeColorShade(TH_GRID, -50);
-
- if (curarea->spacetype!=SPACE_ACTION && curarea->spacetype!=SPACE_NLA)
- { /* Horizontal axis */
- vec1[0]= G.v2d->cur.xmin;
- vec2[0]= G.v2d->cur.xmax;
- vec1[1]= vec2[1]= 0.0;
- glBegin(GL_LINE_STRIP);
-
- glVertex2fv(vec1);
- glVertex2fv(vec2);
-
- glEnd();
- }
-
- /* Vertical axis */
-
- vec1[1]= G.v2d->cur.ymin;
- vec2[1]= G.v2d->cur.ymax;
- vec1[0]= vec2[0]= 0.0;
- glBegin(GL_LINE_STRIP);
- glVertex2fv(vec1); glVertex2fv(vec2);
- glEnd();
-
- /* Limits box */
- if(curarea->spacetype==SPACE_IPO) {
- if(G.sipo->blocktype==ID_SEQ) {
- Sequence * last_seq = get_last_seq();
- float start = 0.0;
- float end = 100.0;
-
- if (last_seq &&
- ((last_seq->flag & SEQ_IPO_FRAME_LOCKED) != 0)) {
- start = last_seq->startdisp;
- end = last_seq->enddisp;
- }
-
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- glRectf(start, 0.0, end, 1.0);
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- }
- else if(ELEM(G.sipo->blocktype, ID_CU, ID_CO)) {
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- glRectf(0.0, 1.0, G.v2d->cur.xmax, 1.0);
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- }
- }
-}
-
-void areamouseco_to_ipoco(View2D *v2d, short *mval, float *x, float *y)
-{
- float div, ofs;
-
- div= v2d->mask.xmax-v2d->mask.xmin;
- ofs= v2d->mask.xmin;
-
- *x= v2d->cur.xmin+ (v2d->cur.xmax-v2d->cur.xmin)*(mval[0]-ofs)/div;
-
- div= v2d->mask.ymax-v2d->mask.ymin;
- ofs= v2d->mask.ymin;
-
- *y= v2d->cur.ymin+ (v2d->cur.ymax-v2d->cur.ymin)*(mval[1]-ofs)/div;
-}
-
-void ipoco_to_areaco(View2D *v2d, float *vec, short *mval)
-{
- float x, y;
-
- mval[0]= IS_CLIPPED;
-
- x= (vec[0] - v2d->cur.xmin)/(v2d->cur.xmax-v2d->cur.xmin);
- y= (vec[1] - v2d->cur.ymin)/(v2d->cur.ymax-v2d->cur.ymin);
-
- if(x>=0.0 && x<=1.0) {
- if(y>=0.0 && y<=1.0) {
- mval[0]= v2d->mask.xmin + x*(v2d->mask.xmax-v2d->mask.xmin);
- mval[1]= v2d->mask.ymin + y*(v2d->mask.ymax-v2d->mask.ymin);
- }
- }
-}
-
-void ipoco_to_areaco_noclip(View2D *v2d, float *vec, short *mval)
-{
- float x, y;
-
- x= (vec[0] - v2d->cur.xmin)/(v2d->cur.xmax-v2d->cur.xmin);
- y= (vec[1] - v2d->cur.ymin)/(v2d->cur.ymax-v2d->cur.ymin);
-
- x= v2d->mask.xmin + x*(v2d->mask.xmax-v2d->mask.xmin);
- y= v2d->mask.ymin + y*(v2d->mask.ymax-v2d->mask.ymin);
-
- if(x<-32760) mval[0]= -32760;
- else if(x>32760) mval[0]= 32760;
- else mval[0]= x;
-
- if(y<-32760) mval[1]= -32760;
- else if(y>32760) mval[1]= 32760;
- else mval[1]= y;
-}
-
-int in_ipo_buttons(void)
-{
- short mval[2];
-
- getmouseco_areawin(mval);
-
- if(mval[0]< G.v2d->mask.xmax) return 0;
- else return 1;
-}
-
-static View2D *spacelink_get_view2d(SpaceLink *sl)
-{
- if(sl->spacetype==SPACE_IPO)
- return &((SpaceIpo *)sl)->v2d;
- else if(sl->spacetype==SPACE_SOUND)
- return &((SpaceSound *)sl)->v2d;
- if(sl->spacetype==SPACE_ACTION)
- return &((SpaceAction *)sl)->v2d;
- if(sl->spacetype==SPACE_NLA)
- return &((SpaceNla *)sl)->v2d;
- if(sl->spacetype==SPACE_TIME)
- return &((SpaceTime *)sl)->v2d;
- if(sl->spacetype==SPACE_SEQ)
- return &((SpaceSeq *)sl)->v2d;
- return NULL;
-}
-
-/* copies changes in this view from or to all 2d views with lock option open */
-/* do not call this inside of drawing routines, to prevent eternal loops */
-void view2d_do_locks(ScrArea *cursa, int flag)
-{
- ScrArea *sa;
- View2D *v2d, *curv2d;
- SpaceLink *sl;
-
- curv2d= spacelink_get_view2d(cursa->spacedata.first);
- if(curv2d==NULL) return;
- if((curv2d->flag & V2D_VIEWLOCK)==0) return;
-
- for(sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- if(sa!=cursa) {
- for(sl= sa->spacedata.first; sl; sl= sl->next) {
-
- v2d= spacelink_get_view2d(sl);
- if(v2d) {
- if(v2d->flag & V2D_VIEWLOCK) {
- if(flag & V2D_LOCK_COPY) {
- v2d->cur.xmin= curv2d->cur.xmin;
- v2d->cur.xmax= curv2d->cur.xmax;
- }
- else {
- curv2d->cur.xmin= v2d->cur.xmin;
- curv2d->cur.xmax= v2d->cur.xmax;
- scrarea_queue_winredraw(sa);
- }
-
- if(flag & V2D_LOCK_REDRAW) {
- if(sl == sa->spacedata.first)
- scrarea_do_windraw(sa);
- }
- else
- scrarea_queue_winredraw(sa);
- }
- }
- }
- }
- }
-}
-
-/* event based, note: curarea is in here... */
-void view2d_zoom(View2D *v2d, float factor, int winx, int winy)
-{
- float dx= factor*(v2d->cur.xmax-v2d->cur.xmin);
- float dy= factor*(v2d->cur.ymax-v2d->cur.ymin);
- if ((v2d->keepzoom & V2D_LOCKZOOM_X)==0) {
- v2d->cur.xmin+= dx;
- v2d->cur.xmax-= dx;
- }
- if ((v2d->keepzoom & V2D_LOCKZOOM_Y)==0) {
- v2d->cur.ymin+= dy;
- v2d->cur.ymax-= dy;
- }
- test_view2d(v2d, winx, winy);
- view2d_do_locks(curarea, V2D_LOCK_COPY);
-}
-
-
-void test_view2d(View2D *v2d, int winx, int winy)
-{
- /* cur is not allowed to be larger than max, smaller than min, or outside of tot */
- rctf *cur, *tot;
- float dx, dy, temp, fac, zoom;
-
- /* correct winx for scroll */
- if(v2d->scroll & L_SCROLL) winx-= SCROLLB;
- if(v2d->scroll & B_SCROLL) winy-= SCROLLH;
- if(v2d->scroll & B_SCROLLO) winy-= SCROLLH; /* B_SCROLL and B_SCROLLO are basically same thing */
-
- /* header completely closed window */
- if(winy<=0) return;
-
- cur= &v2d->cur;
- tot= &v2d->tot;
-
- dx= cur->xmax-cur->xmin;
- dy= cur->ymax-cur->ymin;
-
- /* Reevan's test */
- if (v2d->keepzoom & V2D_LOCKZOOM_Y)
- v2d->cur.ymax=v2d->cur.ymin+((float)winy);
-
- if (v2d->keepzoom & V2D_LOCKZOOM_X)
- v2d->cur.xmax=v2d->cur.xmin+((float)winx);
-
- if(v2d->keepzoom) {
-
- zoom= ((float)winx)/dx;
-
- if(zoom<v2d->minzoom || zoom>v2d->maxzoom) {
- if(zoom<v2d->minzoom) fac= zoom/v2d->minzoom;
- else fac= zoom/v2d->maxzoom;
-
- dx*= fac;
- temp= 0.5*(cur->xmax+cur->xmin);
-
- cur->xmin= temp-0.5*dx;
- cur->xmax= temp+0.5*dx;
- }
-
- zoom= ((float)winy)/dy;
-
- if(zoom<v2d->minzoom || zoom>v2d->maxzoom) {
- if(zoom<v2d->minzoom) fac= zoom/v2d->minzoom;
- else fac= zoom/v2d->maxzoom;
-
- dy*= fac;
- temp= 0.5*(cur->ymax+cur->ymin);
- cur->ymin= temp-0.5*dy;
- cur->ymax= temp+0.5*dy;
- }
- }
- else {
- if(dx<G.v2d->min[0]) {
- dx= G.v2d->min[0];
- temp= 0.5*(cur->xmax+cur->xmin);
- cur->xmin= temp-0.5*dx;
- cur->xmax= temp+0.5*dx;
- }
- else if(dx>G.v2d->max[0]) {
- dx= G.v2d->max[0];
- temp= 0.5*(cur->xmax+cur->xmin);
- cur->xmin= temp-0.5*dx;
- cur->xmax= temp+0.5*dx;
- }
-
- if(dy<G.v2d->min[1]) {
- dy= G.v2d->min[1];
- temp= 0.5*(cur->ymax+cur->ymin);
- cur->ymin= temp-0.5*dy;
- cur->ymax= temp+0.5*dy;
- }
- else if(dy>G.v2d->max[1]) {
- dy= G.v2d->max[1];
- temp= 0.5*(cur->ymax+cur->ymin);
- cur->ymin= temp-0.5*dy;
- cur->ymax= temp+0.5*dy;
- }
- }
-
- if(v2d->keepaspect) {
- short do_x=0, do_y=0;
-
- /* when a window edge changes, the aspect ratio can't be used to
- find which is the best new 'cur' rect. thats why it stores 'old' */
- if(winx!=v2d->oldwinx) do_x= 1;
- if(winy!=v2d->oldwiny) do_y= 1;
-
- dx= (cur->ymax-cur->ymin)/(cur->xmax-cur->xmin);
- dy= ((float)winy)/((float)winx);
-
- if(do_x==do_y) { // both sizes change, ctrl+uparrow
- if(do_x==1 && do_y==1) {
- if( ABS(winx-v2d->oldwinx)>ABS(winy-v2d->oldwiny)) do_y= 0;
- else do_x= 0;
- }
- else if( dy > 1.0) do_x= 0; else do_x= 1;
- }
-
- if( do_x ) {
- if (v2d->keeptot == 2 && winx < v2d->oldwinx) {
- /* This is a special hack for the outliner, to ensure that the
- * outliner contents will not eventually get pushed out of view
- * when shrinking the view.
- */
- cur->xmax -= cur->xmin;
- cur->xmin= 0.0f;
- }
- else {
- /* portrait window: correct for x */
- dx= cur->ymax-cur->ymin;
- temp= (cur->xmax+cur->xmin);
-
- cur->xmin= temp/2.0 - 0.5*dx/dy;
- cur->xmax= temp/2.0 + 0.5*dx/dy;
- }
- }
- else {
- dx= cur->xmax-cur->xmin;
- temp= (cur->ymax+cur->ymin);
-
- cur->ymin= temp/2.0 - 0.5*dy*dx;
- cur->ymax= temp/2.0 + 0.5*dy*dx;
- }
-
- v2d->oldwinx= winx;
- v2d->oldwiny= winy;
- }
-
- if(v2d->keeptot) {
- dx= cur->xmax-cur->xmin;
- dy= cur->ymax-cur->ymin;
-
- if(dx > tot->xmax-tot->xmin) {
- if(v2d->keepzoom==0) {
- if(cur->xmin<tot->xmin) cur->xmin= tot->xmin;
- if(cur->xmax>tot->xmax) cur->xmax= tot->xmax;
- }
- else {
- if(cur->xmax < tot->xmax) {
- dx= tot->xmax-cur->xmax;
- cur->xmin+= dx;
- cur->xmax+= dx;
- }
- else if(cur->xmin > tot->xmin) {
- dx= cur->xmin-tot->xmin;
- cur->xmin-= dx;
- cur->xmax-= dx;
- }
- }
- }
- else {
- if(cur->xmin < tot->xmin) {
- dx= tot->xmin-cur->xmin;
- cur->xmin+= dx;
- cur->xmax+= dx;
- }
- else if((v2d->keeptot!=2) && (cur->xmax > tot->xmax)) {
- /* keeptot==2 is a special case for the outliner. see space.c, init_v2d_oops for details */
- dx= cur->xmax-tot->xmax;
- cur->xmin-= dx;
- cur->xmax-= dx;
- }
- }
-
- if(dy > tot->ymax-tot->ymin) {
- if(v2d->keepzoom==0) {
- if(cur->ymin<tot->ymin) cur->ymin= tot->ymin;
- if(cur->ymax>tot->ymax) cur->ymax= tot->ymax;
- }
- else {
- if(cur->ymax < tot->ymax) {
- dy= tot->ymax-cur->ymax;
- cur->ymin+= dy;
- cur->ymax+= dy;
- }
- else if(cur->ymin > tot->ymin) {
- dy= cur->ymin-tot->ymin;
- cur->ymin-= dy;
- cur->ymax-= dy;
- }
- }
- }
- else {
- if(cur->ymin < tot->ymin) {
- dy= tot->ymin-cur->ymin;
- cur->ymin+= dy;
- cur->ymax+= dy;
- }
- else if(cur->ymax > tot->ymax) {
- dy= cur->ymax-tot->ymax;
- cur->ymin-= dy;
- cur->ymax-= dy;
- }
- }
- }
-}
-
-#define IPOBUTX 70
-static int calc_ipobuttonswidth(ScrArea *sa)
-{
- SpaceIpo *sipo= sa->spacedata.first;
- EditIpo *ei;
- int ipowidth = IPOBUTX;
- int a;
- float textwidth = 0;
-
- /* default width when no space ipo or no channels */
- if (sipo == NULL) return IPOBUTX;
- if ((sipo->totipo==0) || (sipo->editipo==NULL)) return IPOBUTX;
-
- ei= sipo->editipo;
-
- for(a=0; a<sipo->totipo; a++, ei++) {
- textwidth = BIF_GetStringWidth(G.font, ei->name, 0);
- if (textwidth + 18 > ipowidth)
- ipowidth = textwidth + 18;
- }
- return ipowidth;
-
-}
-
-void calc_scrollrcts(ScrArea *sa, View2D *v2d, int winx, int winy)
-{
- v2d->mask.xmin= v2d->mask.ymin= 0;
- v2d->mask.xmax= winx;
- v2d->mask.ymax= winy;
-
- if(sa->spacetype==SPACE_ACTION) {
- if(sa->winx > ACTWIDTH+50) {
- v2d->mask.xmin+= ACTWIDTH;
- v2d->hor.xmin+=ACTWIDTH;
- }
- }
- else if(sa->spacetype==SPACE_NLA){
- if(sa->winx > NLAWIDTH+50) {
- v2d->mask.xmin+= NLAWIDTH;
- v2d->hor.xmin+=NLAWIDTH;
- }
- }
- else if(sa->spacetype==SPACE_IPO) {
- int ipobutx = calc_ipobuttonswidth(sa);
-
- v2d->mask.xmax-= ipobutx;
-
- if(v2d->mask.xmax<ipobutx)
- v2d->mask.xmax= winx;
- }
-
- if(v2d->scroll) {
- if(v2d->scroll & L_SCROLL) {
- v2d->vert= v2d->mask;
- v2d->vert.xmax= SCROLLB;
- v2d->mask.xmin= SCROLLB;
- }
- else if(v2d->scroll & R_SCROLL) {
- v2d->vert= v2d->mask;
- v2d->vert.xmin= v2d->vert.xmax-SCROLLB;
- v2d->mask.xmax= v2d->vert.xmin;
- }
-
- if((v2d->scroll & B_SCROLL) || (v2d->scroll & B_SCROLLO)) {
- v2d->hor= v2d->mask;
- v2d->hor.ymax= SCROLLH;
- v2d->mask.ymin= SCROLLH;
- }
- else if(v2d->scroll & T_SCROLL) {
- v2d->hor= v2d->mask;
- v2d->hor.ymin= v2d->hor.ymax-SCROLLH;
- v2d->mask.ymax= v2d->hor.ymin;
- }
- }
-}
-
- /* draws a line in left vertical scrollbar at the given height */
-static void draw_solution_line(View2D *v2d, float h)
-{
- float vec[2];
- short mval[2];
-
- vec[0]= v2d->cur.xmin;
- vec[1]= h;
- ipoco_to_areaco(v2d, vec, mval);
- if(mval[0]!=IS_CLIPPED) {
- glBegin(GL_LINES);
- glVertex2f(v2d->vert.xmin, mval[1]);
- glVertex2f(v2d->vert.xmax, mval[1]);
- glEnd();
- }
-}
-
-static void draw_solution(SpaceIpo *sipo)
-{
- View2D *v2d= &sipo->v2d;
- EditIpo *ei;
- int a;
-
- if (!(v2d->scroll & VERT_SCROLL)) return;
-
- ei= sipo->editipo;
- for(a=0; a<sipo->totipo; a++, ei++) {
- if ISPOIN(ei, flag & IPO_VISIBLE, icu) {
- cpack(ei->col);
-
- /* DISPBITS ipos have 'multiple' values. */
- if(ei->disptype==IPO_DISPBITS) {
- int b, val= ei->icu->curval;
-
- for (b=0; b<31; b++)
- if (val & (1<<b))
- draw_solution_line(v2d, b+1);
- } else {
- draw_solution_line(v2d, ei->icu->curval);
- }
- }
- }
-}
-
-/* used for drawing timeline */
-void draw_view2d_numbers_horiz(int drawframes)
-{
- float fac, fac2, dfac, val;
-
- /* the numbers: convert ipogrid_startx and -dx to scroll coordinates */
-
- fac= (ipogrid_startx- G.v2d->cur.xmin)/(G.v2d->cur.xmax-G.v2d->cur.xmin);
- fac= G.v2d->mask.xmin+fac*(G.v2d->mask.xmax-G.v2d->mask.xmin);
-
- dfac= (ipogrid_dx)/(G.v2d->cur.xmax-G.v2d->cur.xmin);
- dfac= dfac*(G.v2d->mask.xmax-G.v2d->mask.xmin);
-
- BIF_ThemeColor(TH_TEXT);
- val= ipogrid_startx;
- while(fac < G.v2d->mask.xmax) {
-
- if(drawframes) {
- ipomachtx= 1;
- scroll_prstr(fac, 2.0+(float)(G.v2d->mask.ymin), val, 'h', 0);
- }
- else {
- fac2= val/FPS;
- scroll_prstr(fac, 2.0+(float)(G.v2d->mask.ymin), fac2, 'h', 0);
- }
-
- fac+= dfac;
- val+= ipogrid_dx;
- }
-}
-
-
-void drawscroll(int disptype)
-{
- rcti vert, hor;
- float fac, dfac, val, fac2, tim;
- int darker, dark, light, lighter;
-
- vert= (G.v2d->vert);
- hor= (G.v2d->hor);
-
- darker= -40;
- dark= 0;
- light= 20;
- lighter= 50;
-
- if((G.v2d->scroll & HOR_SCROLL) || (G.v2d->scroll & HOR_SCROLLO)) {
-
- BIF_ThemeColorShade(TH_SHADE1, light);
- glRecti(hor.xmin, hor.ymin, hor.xmax, hor.ymax);
-
- /* slider */
- fac= (G.v2d->cur.xmin- G.v2d->tot.xmin)/(G.v2d->tot.xmax-G.v2d->tot.xmin);
- if(fac<0.0) fac= 0.0;
- horxmin= hor.xmin+fac*(hor.xmax-hor.xmin);
-
- fac= (G.v2d->cur.xmax- G.v2d->tot.xmin)/(G.v2d->tot.xmax-G.v2d->tot.xmin);
- if(fac>1.0) fac= 1.0;
- horxmax= hor.xmin+fac*(hor.xmax-hor.xmin);
-
- if(horxmin > horxmax) horxmin= horxmax;
-
- BIF_ThemeColorShade(TH_SHADE1, dark);
- glRecti(horxmin, hor.ymin, horxmax, hor.ymax);
-
- /* decoration bright line */
- BIF_ThemeColorShade(TH_SHADE1, lighter);
- sdrawline(hor.xmin, hor.ymax, hor.xmax, hor.ymax);
-
- /* the numbers: convert ipogrid_startx and -dx to scroll coordinates */
- fac= (ipogrid_startx- G.v2d->cur.xmin)/(G.v2d->cur.xmax-G.v2d->cur.xmin);
- fac= hor.xmin+fac*(hor.xmax-hor.xmin);
-
- dfac= (ipogrid_dx)/(G.v2d->cur.xmax-G.v2d->cur.xmin);
- dfac= dfac*(hor.xmax-hor.xmin);
-
- BIF_ThemeColor(TH_TEXT);
- val= ipogrid_startx;
- while(fac < hor.xmax) {
-
- if(curarea->spacetype==SPACE_OOPS) {
- /* Under no circumstances may the outliner/oops display numbers on its scrollbar
- * Unfortunately, versions of Blender without this patch will hang on loading files with
- * horizontally scrollable Outliners.
- */
- break;
- }
- else if(curarea->spacetype==SPACE_SEQ) {
- SpaceSeq * sseq = curarea->spacedata.first;
- if (sseq->flag & SEQ_DRAWFRAMES) {
- ipomachtx = 1;
- scroll_prstr(fac, 3.0+(float)(hor.ymin), val, 'h', disptype);
- } else {
- fac2= val/FPS;
- tim= floor(fac2);
- fac2= fac2-tim;
- scroll_prstr(fac, 3.0+(float)(hor.ymin), tim+FPS*fac2/100.0, 'h', disptype);
- }
- }
- else if (curarea->spacetype==SPACE_SOUND) {
- SpaceSound *ssound= curarea->spacedata.first;
-
- if(ssound->flag & SND_DRAWFRAMES) {
- ipomachtx= 1;
- scroll_prstr(fac, 3.0+(float)(hor.ymin), val, 'h', disptype);
- }
- else {
- fac2= val/FPS;
- scroll_prstr(fac, 3.0+(float)(hor.ymin), fac2, 'h', disptype);
- }
- }
- else if (curarea->spacetype==SPACE_TIME) {
- SpaceTime *stime= curarea->spacedata.first;
-
- if(stime->flag & TIME_DRAWFRAMES) {
- ipomachtx= 1;
- scroll_prstr(fac, 3.0+(float)(hor.ymin), val, 'h', disptype);
- }
- else {
- fac2= val/FPS;
- scroll_prstr(fac, 3.0+(float)(hor.ymin), fac2, 'h', disptype);
- }
- }
- else if (curarea->spacetype==SPACE_IPO) {
- EditIpo *ei= get_active_editipo();
-
- if(ei && ei->icu && ei->icu->driver) {
- int adrcode= ei->icu->driver->adrcode;
-
- if(adrcode==OB_ROT_X || adrcode==OB_ROT_Y || adrcode==OB_ROT_Z) {
- scroll_prstr(fac, 3.0+(float)(hor.ymin), val, 'v', IPO_DISPDEGR);
- }
- else
- scroll_prstr(fac, 3.0+(float)(hor.ymin), val, 'h', disptype);
- }
- else
- scroll_prstr(fac, 3.0+(float)(hor.ymin), val, 'h', disptype);
- }
- else if (curarea->spacetype==SPACE_ACTION) {
- SpaceAction *saction= curarea->spacedata.first;
-
- if (saction->flag & SACTION_DRAWTIME) {
- fac2= val/FPS;
- scroll_prstr(fac, 3.0+(float)(hor.ymin), fac2, 'h', disptype);
- }
- else {
- ipomachtx= 1;
- scroll_prstr(fac, 3.0+(float)(hor.ymin), val, 'h', disptype);
- }
- }
- else if (curarea->spacetype==SPACE_NLA) {
- SpaceNla *snla= curarea->spacedata.first;
-
- if (snla->flag & SNLA_DRAWTIME) {
- fac2= val/FPS;
- scroll_prstr(fac, 3.0+(float)(hor.ymin), fac2, 'h', disptype);
- }
- else {
- ipomachtx= 1;
- scroll_prstr(fac, 3.0+(float)(hor.ymin), val, 'h', disptype);
- }
- }
- else {
- scroll_prstr(fac, 3.0+(float)(hor.ymin), val, 'h', disptype);
- }
-
- fac+= dfac;
- val+= ipogrid_dx;
- }
- }
-
- if(G.v2d->scroll & VERT_SCROLL) {
- BIF_ThemeColorShade(TH_SHADE1, light);
- glRecti(vert.xmin, vert.ymin, vert.xmax, vert.ymax);
-
- /* slider */
- fac= (G.v2d->cur.ymin- G.v2d->tot.ymin)/(G.v2d->tot.ymax-G.v2d->tot.ymin);
- if(fac<0.0) fac= 0.0;
- vertymin= vert.ymin+fac*(vert.ymax-vert.ymin);
-
- fac= (G.v2d->cur.ymax- G.v2d->tot.ymin)/(G.v2d->tot.ymax-G.v2d->tot.ymin);
- if(fac>1.0) fac= 1.0;
- vertymax= vert.ymin+fac*(vert.ymax-vert.ymin);
-
- if(vertymin > vertymax) vertymin= vertymax;
-
- BIF_ThemeColorShade(TH_SHADE1, dark);
- glRecti(vert.xmin, vertymin, vert.xmax, vertymax);
-
- /* decoration black line */
- BIF_ThemeColorShade(TH_SHADE1, darker);
- if(G.v2d->scroll & HOR_SCROLL)
- sdrawline(vert.xmax, vert.ymin+SCROLLH, vert.xmax, vert.ymax);
- else
- sdrawline(vert.xmax, vert.ymin, vert.xmax, vert.ymax);
-
- /* the numbers: convert ipogrid_starty and -dy to scroll coordinates */
- fac= (ipogrid_starty- G.v2d->cur.ymin)/(G.v2d->cur.ymax-G.v2d->cur.ymin);
- fac= vert.ymin+SCROLLH+fac*(vert.ymax-vert.ymin-SCROLLH);
-
- dfac= (ipogrid_dy)/(G.v2d->cur.ymax-G.v2d->cur.ymin);
- dfac= dfac*(vert.ymax-vert.ymin-SCROLLH);
-
- if(curarea->spacetype==SPACE_OOPS);
- else if(curarea->spacetype==SPACE_SEQ) {
- BIF_ThemeColor(TH_TEXT);
- val= ipogrid_starty;
- fac+= 0.5*dfac;
- while(fac < vert.ymax) {
- scroll_prstr((float)(vert.xmax)-14.0, fac, val, 'v', disptype);
- fac+= dfac;
- val+= ipogrid_dy;
- }
- }
- else if (curarea->spacetype==SPACE_NLA){
- }
- else if (curarea->spacetype==SPACE_ACTION){
- /* No digits on vertical axis in action mode! */
- }
- else {
- BIF_ThemeColor(TH_TEXT);
- val= ipogrid_starty;
- while(fac < vert.ymax) {
- scroll_prstr((float)(vert.xmax)-14.0, fac, val, 'v', disptype);
- fac+= dfac;
- val+= ipogrid_dy;
- }
- }
- }
-}
-
-static void draw_ipobuts(SpaceIpo *sipo)
-{
- ScrArea *area= sipo->area;
- View2D *v2d= &sipo->v2d;
- Object *ob= OBACT;
- uiBlock *block;
- uiBut *but;
- EditIpo *ei;
- int a, y, sel, tot, ipobutx;
- char naam[20];
-
- if(area->winx< calc_ipobuttonswidth(area)) return;
-
- if(sipo->butofs) {
- tot= 30+IPOBUTY*sipo->totipo;
- if(tot<area->winy) sipo->butofs= 0;
- }
-
- ipobutx = calc_ipobuttonswidth(area);
-
- BIF_ThemeColor(TH_SHADE2);
- glRects(v2d->mask.xmax, 0, area->winx, area->winy);
-
- cpack(0x0);
- sdrawline(v2d->mask.xmax, 0, v2d->mask.xmax, area->winy);
-
- if(sipo->totipo==0) return;
- if(sipo->editipo==0) return;
-
- sprintf(naam, "ipowin %d", area->win);
- block= uiNewBlock(&area->uiblocks, naam, UI_EMBOSSN, UI_HELV, area->win);
-
- ei= sipo->editipo;
- y= area->winy-30+sipo->butofs;
-
- if(ob && sipo->blocktype==ID_KE) {
- int icon;
- if(ob->shapeflag & OB_SHAPE_LOCK) icon= ICON_PIN_HLT; else icon= ICON_PIN_DEHLT;
- uiDefIconButBitS(block, TOG, OB_SHAPE_LOCK, B_SETKEY, icon,
- v2d->mask.xmax+18,y,25,20, &ob->shapeflag, 0, 0, 0, 0, "Always show the current Shape for this Object");
- y-= IPOBUTY;
- }
-
- for(a=0; a<sipo->totipo; a++, ei++, y-=IPOBUTY) {
- // this button defines visiblity, bit zero of flag (IPO_VISIBLE)
- but= uiDefButBitS(block, TOG, IPO_VISIBLE, a+1, ei->name, v2d->mask.xmax+18, y, ipobutx-15, IPOBUTY-1, &(ei->flag), 0, 0, 0, 0, "");
- // no hilite, its not visible, but most of all the winmatrix is not correct later on...
- uiButSetFlag(but, UI_TEXT_LEFT|UI_NO_HILITE);
-
- // this fake button defines selection of curves
- if(ei->icu) {
- cpack(ei->col);
-
- glRects(v2d->mask.xmax+8, y+2, v2d->mask.xmax+15, y+IPOBUTY-2);
- sel= ei->flag & (IPO_SELECT + IPO_EDIT);
-
- uiEmboss((float)(v2d->mask.xmax+8), (float)(y+2), (float)(v2d->mask.xmax+15), (float)(y+IPOBUTY-2), sel);
-
- if(ei->icu->driver) {
- cpack(0x0);
- fdrawbox((float)v2d->mask.xmax+11, (float)y+8, (float)v2d->mask.xmax+12.5, (float)y+9.5);
- }
- }
-
- if(ei->flag & IPO_ACTIVE) {
- cpack(0x0);
- fdrawbox(v2d->mask.xmax+7, y+1, v2d->mask.xmax+16, y+IPOBUTY-1);
- }
- }
- uiDrawBlock(block);
-}
-
-static void draw_ipovertices(int sel)
-{
- EditIpo *ei;
- BezTriple *bezt;
- float v1[2];
- int val, ok, nr, a, b;
-
- if(G.f & G_PICKSEL) return;
-
- glPointSize(BIF_GetThemeValuef(TH_VERTEX_SIZE));
-
- ei= G.sipo->editipo;
- for(nr=0; nr<G.sipo->totipo; nr++, ei++) {
- if ISPOIN(ei, flag & IPO_VISIBLE, icu) {
-
- if(G.sipo->showkey) {
- if(sel) BIF_ThemeColor(TH_TEXT_HI);
- else BIF_ThemeColor(TH_TEXT);
- } else if(ei->flag & IPO_EDIT) {
- if(sel) BIF_ThemeColor(TH_VERTEX_SELECT);
- else BIF_ThemeColor(TH_VERTEX);
- } else {
- if(sel) BIF_ThemeColor(TH_TEXT_HI);
- else BIF_ThemeColor(TH_TEXT);
-
- val= (ei->icu->flag & IPO_SELECT)!=0;
- if(sel != val) continue;
- }
-
- /* We can't change the color in the middle of
- * GL_POINTS because then Blender will segfault
- * on TNT2 / Linux with NVidia's drivers
- * (at least up to ver. 4349) */
-
- a= ei->icu->totvert;
- bezt= ei->icu->bezt;
- bglBegin(GL_POINTS);
-
- while(a--) {
-
- /* IPO_DISPBITS is used for displaying layer ipo types as well as modes */
- if(ei->disptype==IPO_DISPBITS) {
- /*if (G.v2d->cur.xmin < bezt->vec[1][0] < G.v2d->cur.xmax) {*/
- ok= 0;
-
- if(ei->flag & IPO_EDIT) {
- if( (bezt->f2 & SELECT) == sel ) ok= 1;
- }
- else ok= 1;
-
- if(ok) {
- val= bezt->vec[1][1];
- b= 0;
- v1[0]= bezt->vec[1][0];
-
- while(b<31) {
- if(val & (1<<b)) {
- v1[1]= b+1;
- bglVertex3fv(v1);
- }
- b++;
- }
- }
- /*}*/
- } else { /* normal non bit curves */
- if(ei->flag & IPO_EDIT) {
- if(ei->icu->ipo==IPO_BEZ) {
- /* Draw the editmode hendels for a bezier curve */
- if( (bezt->f1 & SELECT) == sel)/* && G.v2d->cur.xmin < bezt->vec[0][0] < G.v2d->cur.xmax)*/
- bglVertex3fv(bezt->vec[0]);
-
- if( (bezt->f3 & SELECT) == sel)/* && G.v2d->cur.xmin < bezt->vec[2][0] < G.v2d->cur.xmax)*/
- bglVertex3fv(bezt->vec[2]);
-
- }
-
- if( (bezt->f2 & SELECT) == sel) /* && G.v2d->cur.xmin < bezt->vec[1][0] < G.v2d->cur.xmax)*/
- bglVertex3fv(bezt->vec[1]);
-
- }
- else {
- /* draw only if in bounds */
- /*if (G.v2d->cur.xmin < bezt->vec[1][0] < G.v2d->cur.xmax)*/
- bglVertex3fv(bezt->vec[1]);
-
- }
- }
-
- bezt++;
- }
- bglEnd();
- }
- }
-
- glPointSize(1.0);
-}
-
-static void draw_ipohandles(int sel)
-{
- extern unsigned int nurbcol[];
- EditIpo *ei;
- BezTriple *bezt;
- float *fp;
- unsigned int *col;
- int a, b;
-
- if(sel) col= nurbcol+4;
- else col= nurbcol;
-
- ei= G.sipo->editipo;
- for(a=0; a<G.sipo->totipo; a++, ei++) {
- if ISPOIN4(ei, flag & IPO_VISIBLE, flag & IPO_EDIT, icu, disptype!=IPO_DISPBITS) {
- if(ei->icu->ipo==IPO_BEZ) {
- bezt= ei->icu->bezt;
- b= ei->icu->totvert;
- while(b--) {
-
- if( (bezt->f2 & SELECT)==sel) {
- fp= bezt->vec[0];
- cpack(col[bezt->h1]);
-
- glBegin(GL_LINE_STRIP);
- glVertex2fv(fp); glVertex2fv(fp+3);
- glEnd();
- cpack(col[bezt->h2]);
-
- glBegin(GL_LINE_STRIP);
- glVertex2fv(fp+3); glVertex2fv(fp+6);
- glEnd();
- }
- else if( (bezt->f1 & 1)==sel) {
- fp= bezt->vec[0];
- cpack(col[bezt->h1]);
-
- glBegin(GL_LINE_STRIP);
- glVertex2fv(fp); glVertex2fv(fp+3);
- glEnd();
- }
- else if( (bezt->f3 & SELECT)==sel) {
- fp= bezt->vec[1];
- cpack(col[bezt->h2]);
-
- glBegin(GL_LINE_STRIP);
- glVertex2fv(fp); glVertex2fv(fp+3);
- glEnd();
- }
-
- bezt++;
- }
- }
- }
- }
-}
-
-int pickselcode;
-
-static void init_pickselcode(void)
-{
- pickselcode= 1;
-}
-
-static void draw_ipocurves(int sel)
-{
- EditIpo *ei;
- IpoCurve *icu;
- BezTriple *bezt, *prevbezt;
- float *fp, fac, data[120], v1[2], v2[2], v3[2], v4[2];
- float cycdx=0, cycdy=0, cycxofs, cycyofs;
- int a, b, resol, cycount, val, nr;
-
-
- ei= G.sipo->editipo;
- for(nr=0; nr<G.sipo->totipo; nr++, ei++) {
- if ISPOIN3(ei, flag & IPO_VISIBLE, icu, icu->bezt) {
-
- if(G.f & G_PICKSEL) {
- glLoadName(pickselcode++);
- val= 1;
- }
- else {
- val= (ei->flag & (IPO_SELECT+IPO_EDIT))!=0;
- val= (val==sel);
- }
-
- if(val) {
-
- cycyofs= cycxofs= 0.0;
- cycount= 1;
-
- icu= ei->icu;
-
- /* curve */
- if(G.sipo->showkey) BIF_ThemeColor(TH_TEXT);
- else cpack(ei->col);
-
- /* cyclic */
- if(icu->extrap & IPO_CYCL) {
- cycdx= (icu->bezt+icu->totvert-1)->vec[1][0] - icu->bezt->vec[1][0];
- cycdy= (icu->bezt+icu->totvert-1)->vec[1][1] - icu->bezt->vec[1][1];
- if(cycdx>0.01) {
-
- while(icu->bezt->vec[1][0]+cycxofs > G.v2d->cur.xmin) {
- cycxofs-= cycdx;
- if(icu->extrap & IPO_DIR) cycyofs-= cycdy;
- cycount++;
- }
- bezt= icu->bezt+(icu->totvert-1);
- fac= 0.0;
- while(bezt->vec[1][0]+fac < G.v2d->cur.xmax) {
- cycount++;
- fac+= cycdx;
- }
- }
- }
-
- while(cycount--) {
-
- if(ei->disptype==IPO_DISPBITS) {
-
- /* lines */
- cpack(ei->col);
- bezt= icu->bezt;
- a= icu->totvert;
-
- while(a--) {
- val= bezt->vec[1][1];
- b= 0;
-
- while(b<31) {
- if(val & (1<<b)) {
- v1[1]= b+1;
-
- glBegin(GL_LINE_STRIP);
- if(icu->extrap & IPO_CYCL) ;
- else if(a==icu->totvert-1) {
- v1[0]= G.v2d->cur.xmin+cycxofs;
- glVertex2fv(v1);
- }
- v1[0]= bezt->vec[1][0]+cycxofs;
- glVertex2fv(v1);
-
- if(a) v1[0]= (bezt+1)->vec[1][0]+cycxofs;
- else if(icu->extrap & IPO_CYCL) ;
- else v1[0]= G.v2d->cur.xmax+cycxofs;
-
- glVertex2fv(v1);
- glEnd();
- }
- b++;
- }
- bezt++;
- }
-
- }
- else {
-
- b= icu->totvert-1;
- prevbezt= icu->bezt;
- bezt= prevbezt+1;
-
- glBegin(GL_LINE_STRIP);
-
- /* extrapolate to left? */
- if( (icu->extrap & IPO_CYCL)==0) {
- if(prevbezt->vec[1][0] > G.v2d->cur.xmin) {
- v1[0]= G.v2d->cur.xmin;
- if(icu->extrap==IPO_HORIZ || icu->ipo==IPO_CONST) v1[1]= prevbezt->vec[1][1];
- else {
- fac= (prevbezt->vec[0][0]-prevbezt->vec[1][0])/(prevbezt->vec[1][0]-v1[0]);
- if(fac!=0.0) fac= 1.0/fac;
- v1[1]= prevbezt->vec[1][1]-fac*(prevbezt->vec[0][1]-prevbezt->vec[1][1]);
- }
- glVertex2fv(v1);
- }
- }
-
- if(b==0) {
- v1[0]= prevbezt->vec[1][0]+cycxofs;
- v1[1]= prevbezt->vec[1][1]+cycyofs;
- glVertex2fv(v1);
- }
-
- while(b--) {
- if(icu->ipo==IPO_CONST) {
- v1[0]= prevbezt->vec[1][0]+cycxofs;
- v1[1]= prevbezt->vec[1][1]+cycyofs;
- glVertex2fv(v1);
- v1[0]= bezt->vec[1][0]+cycxofs;
- v1[1]= prevbezt->vec[1][1]+cycyofs;
- glVertex2fv(v1);
- }
- else if(icu->ipo==IPO_LIN) {
- v1[0]= prevbezt->vec[1][0]+cycxofs;
- v1[1]= prevbezt->vec[1][1]+cycyofs;
- glVertex2fv(v1);
- }
- else {
- /* resol not depending on horizontal resolution anymore, drivers for example... */
- if(icu->driver) resol= 32;
- else resol= 3.0*sqrt(bezt->vec[1][0] - prevbezt->vec[1][0]);
-
- if(resol<2) {
- v1[0]= prevbezt->vec[1][0]+cycxofs;
- v1[1]= prevbezt->vec[1][1]+cycyofs;
- glVertex2fv(v1);
- }
- else {
- if(resol>32) resol= 32;
-
- v1[0]= prevbezt->vec[1][0]+cycxofs;
- v1[1]= prevbezt->vec[1][1]+cycyofs;
- v2[0]= prevbezt->vec[2][0]+cycxofs;
- v2[1]= prevbezt->vec[2][1]+cycyofs;
-
- v3[0]= bezt->vec[0][0]+cycxofs;
- v3[1]= bezt->vec[0][1]+cycyofs;
- v4[0]= bezt->vec[1][0]+cycxofs;
- v4[1]= bezt->vec[1][1]+cycyofs;
-
- correct_bezpart(v1, v2, v3, v4);
-
- forward_diff_bezier(v1[0], v2[0], v3[0], v4[0], data, resol, 3);
- forward_diff_bezier(v1[1], v2[1], v3[1], v4[1], data+1, resol, 3);
-
- fp= data;
- while(resol--) {
- glVertex2fv(fp);
- fp+= 3;
- }
- }
- }
- prevbezt= bezt;
- bezt++;
-
- /* last point? */
- if(b==0) {
- v1[0]= prevbezt->vec[1][0]+cycxofs;
- v1[1]= prevbezt->vec[1][1]+cycyofs;
- glVertex2fv(v1);
- }
- }
-
- /* extrapolate to right? */
- if( (icu->extrap & IPO_CYCL)==0) {
- if(prevbezt->vec[1][0] < G.v2d->cur.xmax) {
- v1[0]= G.v2d->cur.xmax;
- if(icu->extrap==IPO_HORIZ || icu->ipo==IPO_CONST) v1[1]= prevbezt->vec[1][1];
- else {
- fac= (prevbezt->vec[2][0]-prevbezt->vec[1][0])/(prevbezt->vec[1][0]-v1[0]);
- if(fac!=0.0) fac= 1.0/fac;
- v1[1]= prevbezt->vec[1][1]-fac*(prevbezt->vec[2][1]-prevbezt->vec[1][1]);
- }
- glVertex2fv(v1);
- }
- }
-
- glEnd();
-
- }
- cycxofs+= cycdx;
- if(icu->extrap & IPO_DIR) cycyofs+= cycdy;
- }
-
- /* line that indicates the end of a speed curve */
- if(G.sipo->blocktype==ID_CU && icu->adrcode==CU_SPEED) {
- b= icu->totvert-1;
- if(b) {
- glColor3ub(0, 0, 0);
- bezt= icu->bezt+b;
- glBegin(GL_LINES);
- glVertex2f(bezt->vec[1][0], 0.0);
- glVertex2f(bezt->vec[1][0], bezt->vec[1][1]);
- glEnd();
- }
- }
- }
- }
- }
-}
-
-static int get_ipo_cfra_from_cfra(SpaceIpo * sipo, int cfra)
-{
- if (sipo->blocktype==ID_SEQ) {
- Sequence * seq = (Sequence*) sipo->from;
-
- if (!seq) {
- return cfra;
- }
-
- if ((seq->flag & SEQ_IPO_FRAME_LOCKED) != 0) {
- return cfra;
- } else {
- float ctime= frame_to_float(cfra - seq->startdisp);
- float div= (seq->enddisp - seq->startdisp)/100.0f;
-
- if(div == 0.0) {
- return 0;
- } else {
- return ctime / div;
- }
- }
- } else {
- return cfra;
- }
-}
-
-static void draw_cfra(SpaceIpo *sipo)
-{
- View2D *v2d= &sipo->v2d;
- Object *ob;
- float vec[2];
-
- vec[0] = get_ipo_cfra_from_cfra(sipo, G.scene->r.cfra);
- vec[0]*= G.scene->r.framelen;
-
- vec[1]= v2d->cur.ymin;
- BIF_ThemeColor(TH_CFRAME);
- glLineWidth(2.0);
-
- glBegin(GL_LINE_STRIP);
- glVertex2fv(vec);
- vec[1]= v2d->cur.ymax;
- glVertex2fv(vec);
- glEnd();
-
- if(sipo->blocktype==ID_OB) {
- ob= (G.scene->basact) ? (G.scene->basact->object) : 0;
- if (ob && (ob->sf!=0.0) && (ob->ipoflag & OB_OFFS_OB) ) {
- vec[0]-= ob->sf;
-
- BIF_ThemeColorShade(TH_HILITE, -30);
-
- glBegin(GL_LINE_STRIP);
- glVertex2fv(vec);
- vec[1]= G.v2d->cur.ymin;
- glVertex2fv(vec);
- glEnd();
- }
- }
-
- glLineWidth(1.0);
-}
-
-static void draw_ipokey(SpaceIpo *sipo)
-{
- IpoKey *ik;
-
- glBegin(GL_LINES);
- for (ik= sipo->ipokey.first; ik; ik= ik->next) {
- if(ik->flag & 1) glColor3ub(0xFF, 0xFF, 0x99);
- else glColor3ub(0xAA, 0xAA, 0x55);
-
- glVertex2f(ik->val, G.v2d->cur.ymin);
- glVertex2f(ik->val, G.v2d->cur.ymax);
- }
- glEnd();
-}
-
-static void draw_key(SpaceIpo *sipo, int visible)
-{
- View2D *v2d= &sipo->v2d;
- Key *key;
- KeyBlock *kb, *act=NULL;
- Object *ob= OBACT;
- unsigned int col;
- int index;
-
- key= ob_get_key((Object *)sipo->from);
- if(key==NULL)
- return;
-
- if(key->type== KEY_RELATIVE) if(visible==0) return;
-
- for(index=1, kb= key->block.first; kb; kb= kb->next, index++) {
- if(kb->type==KEY_LINEAR) setlinestyle(2);
- else if(kb->type==KEY_BSPLINE) setlinestyle(4);
- else setlinestyle(0);
-
- if(kb==key->refkey) col= 0x22FFFF;
- else col= 0xFFFF00;
-
- if(ob->shapenr!=index) col-= 0x225500;
- else act= kb;
-
- cpack(col);
-
- glBegin(GL_LINE_STRIP);
- glVertex2f(v2d->cur.xmin, kb->pos);
- glVertex2f(v2d->cur.xmax, kb->pos);
- glEnd();
-
- }
-
- if(act) {
- if(act->type==KEY_LINEAR) setlinestyle(2);
- else if(act->type==KEY_BSPLINE) setlinestyle(4);
- else setlinestyle(0);
-
- if(act==key->refkey) cpack(0x22FFFF);
- else cpack(0xFFFF00);
-
- glBegin(GL_LINE_STRIP);
- glVertex2f(v2d->cur.xmin, act->pos);
- glVertex2f(v2d->cur.xmax, act->pos);
- glEnd();
- }
-
- setlinestyle(0);
-}
-
-/* ************************** buttons *********************** */
-
-
-#define B_SETSPEED 3401
-#define B_MUL_IPO 3402
-#define B_TRANS_IPO 3403
-#define B_IPO_NONE 3404
-#define B_IPO_DRIVER 3405
-#define B_IPO_REDR 3406
-#define B_IPO_DEPCHANGE 3407
-#define B_IPO_DRIVERTYPE 3408
-
-static float hspeed= 0;
-
-static void boundbox_ipo_curves(SpaceIpo *si)
-{
- EditIpo *ei;
- Key *key;
- KeyBlock *kb;
- int a, first= 1;
-
- ei= si->editipo;
- if(ei==0)
- return;
-
- for(a=0; a<si->totipo; a++, ei++) {
-
- if(ei->icu) {
- if(ei->flag & IPO_VISIBLE) {
-
- boundbox_ipocurve(ei->icu, 0);
- if(first) {
- si->v2d.tot= ei->icu->totrct;
- first= 0;
- }
- else BLI_union_rctf(&(si->v2d.tot), &(ei->icu->totrct));
- }
- }
- }
- /* keylines? */
- if(si->blocktype==ID_KE) {
- key= ob_get_key((Object *)si->from);
- if(key && key->block.first) {
- kb= key->block.first;
- if(kb->pos < si->v2d.tot.ymin) si->v2d.tot.ymin= kb->pos;
- kb= key->block.last;
- if(kb->pos > si->v2d.tot.ymax) si->v2d.tot.ymax= kb->pos;
- }
- }
- si->tot= si->v2d.tot;
-}
-
-
-/* is used for both read and write... */
-static void ipo_editvertex_buts(uiBlock *block, SpaceIpo *si, float min, float max)
-{
- Object *ob= OBACT;
- EditIpo *ei;
- BezTriple *bezt;
- float median[3];
- int a, b, tot, iskey=0;
-
- median[0]= median[1]= median[2]= 0.0;
- tot= 0;
-
- ei= G.sipo->editipo;
- for(a=0; a<G.sipo->totipo; a++, ei++) {
-
- if ISPOIN(ei, flag & IPO_VISIBLE, icu) {
- if( (ei->flag & IPO_EDIT) || G.sipo->showkey) {
-
- if(ei->icu->bezt) {
- bezt= ei->icu->bezt;
- b= ei->icu->totvert;
- while(b--) {
- // all three selected
- if(bezt->f2 & SELECT) {
- VecAddf(median, median, bezt->vec[1]);
- tot++;
- }
- else {
- if(bezt->f1 & SELECT) {
- VecAddf(median, median, bezt->vec[0]);
- tot++;
- }
- if(bezt->f3 & SELECT) {
- VecAddf(median, median, bezt->vec[2]);
- tot++;
- }
- }
- bezt++;
- }
-
- }
- }
- }
- }
- /* check for keys */
- if(tot==0) {
- if(G.sipo->blocktype==ID_KE) {
- Key *key= ob_get_key((Object *)G.sipo->from);
- KeyBlock *kb;
-
- if(key==NULL || ob->shapenr==0) return;
- iskey= 1;
-
- kb= BLI_findlink(&key->block, ob->shapenr-1);
- median[1]+= kb->pos;
- tot++;
- }
- }
- if(tot==0) return;
-
- median[0] /= (float)tot;
- median[1] /= (float)tot;
- median[2] /= (float)tot;
-
- if(block) { // buttons
-
- VECCOPY(si->median, median);
-
- uiBlockBeginAlign(block);
- if(tot==1) {
- if(iskey)
- uiDefButF(block, NUM, B_TRANS_IPO, "Key Y:", 10, 80, 300, 19, &(si->median[1]), min, max, 10, 0, "");
- else {
- uiDefButF(block, NUM, B_TRANS_IPO, "Vertex X:", 10, 100, 150, 19, &(si->median[0]), min, max, 100, 0, "");
- uiDefButF(block, NUM, B_TRANS_IPO, "Vertex Y:", 160, 100, 150, 19, &(si->median[1]), min, max, 100, 0, "");
- }
- }
- else {
- if(iskey)
- uiDefButF(block, NUM, B_TRANS_IPO, "Median Key Y:", 10, 80, 300, 19, &(si->median[1]), min, max, 10, 0, "");
- else {
- uiDefButF(block, NUM, B_TRANS_IPO, "Median X:", 10, 100, 150, 19, &(si->median[0]), min, max, 100, 0, "");
- uiDefButF(block, NUM, B_TRANS_IPO, "Median Y:", 160, 100, 150, 19, &(si->median[1]), min, max, 100, 0, "");
- }
- }
- }
- else if(iskey) { // apply
- VecSubf(median, si->median, median);
-
- if(G.sipo->blocktype==ID_KE) {
- Key *key= ob_get_key((Object *)G.sipo->from);
- KeyBlock *kb;
-
- if(key==NULL || ob->shapenr==0) return;
-
- kb= BLI_findlink(&key->block, ob->shapenr-1);
- kb->pos+= median[1];
- tot++;
-
- sort_keys(key);
- }
- }
- else {
-
- VecSubf(median, si->median, median);
-
- ei= G.sipo->editipo;
- for(a=0; a<G.sipo->totipo; a++, ei++) {
-
- if ISPOIN(ei, flag & IPO_VISIBLE, icu) {
- if( (ei->flag & IPO_EDIT) || G.sipo->showkey) {
-
- if(ei->icu->bezt) {
- bezt= ei->icu->bezt;
- b= ei->icu->totvert;
- while(b--) {
- // all three selected
- if(bezt->f2 & SELECT) {
- VecAddf(bezt->vec[0], bezt->vec[0], median);
- VecAddf(bezt->vec[1], bezt->vec[1], median);
- VecAddf(bezt->vec[2], bezt->vec[2], median);
- }
- else {
- if(bezt->f1 & SELECT) {
- VecAddf(bezt->vec[0], bezt->vec[0], median);
- }
- if(bezt->f3 & SELECT) {
- VecAddf(bezt->vec[2], bezt->vec[2], median);
- }
- }
- bezt++;
- }
-
- }
- }
- }
- }
- }
-}
-
-void do_ipobuts(unsigned short event)
-{
- Object *ob= OBACT;
- EditIpo *ei;
-
- if(G.sipo->from==NULL) return;
-
- switch(event) {
- case B_IPO_REDR:
- ei= get_active_editipo();
- if(ei) {
- if(ei->icu->driver) {
- if (ei->icu->driver->type == IPO_DRIVER_TYPE_PYTHON) {
- /* first del pydriver's global dict, just in case
- * an available pydrivers.py module needs to be reloaded */
- BPY_pydriver_update();
- /* eval user's expression once for validity; update DAG */
- BPY_pydriver_eval(ei->icu->driver);
- DAG_scene_sort(G.scene);
- }
- else if(G.sipo->blocktype==ID_KE || G.sipo->blocktype==ID_AC)
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- else
- DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
- }
- }
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_SETSPEED:
- set_speed_editipo(hspeed);
- break;
- case B_MUL_IPO:
- scale_editipo();
- allqueue(REDRAWIPO, 0);
- break;
- case B_TRANS_IPO:
- ipo_editvertex_buts(NULL, G.sipo, 0.0, 0.0);
- editipo_changed(G.sipo, 1);
- allqueue(REDRAWIPO, 0);
- break;
- case B_SETKEY:
- ob->shapeflag &= ~OB_SHAPE_TEMPLOCK;
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- break;
- case B_IPO_DRIVER:
- ei= get_active_editipo();
- if(ei) {
- if(ei->icu==NULL) {
- ei->icu= verify_ipocurve(G.sipo->from, G.sipo->blocktype, G.sipo->actname, G.sipo->constname, G.sipo->bonename, ei->adrcode);
- if (!ei->icu) {
- error("Could not add a driver to this curve, may be linked data!");
- break;
- }
- ei->flag |= IPO_SELECT;
- ei->icu->flag= ei->flag;
- }
- if(ei->icu->driver) {
- MEM_freeN(ei->icu->driver);
- ei->icu->driver= NULL;
- if(ei->icu->bezt==NULL) {
- BLI_remlink( &(G.sipo->ipo->curve), ei->icu);
- free_ipo_curve(ei->icu);
- ei->icu= NULL;
- }
- }
- else {
- ei->icu->driver= MEM_callocN(sizeof(IpoDriver), "ipo driver");
- ei->icu->driver->blocktype= ID_OB;
- ei->icu->driver->adrcode= OB_LOC_X;
- }
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- DAG_scene_sort(G.scene);
-
- BIF_undo_push("Add/Remove Ipo driver");
- }
- break;
- case B_IPO_DRIVERTYPE:
- ei= get_active_editipo();
- if(ei) {
- if(ei->icu->driver) {
- IpoDriver *driver= ei->icu->driver;
-
- if(driver->type == IPO_DRIVER_TYPE_PYTHON) {
- /* pydriver expression shouldn't reference own ob,
- * so we need to store ob ptr to check against it */
- driver->ob= ob;
- }
- else {
- driver->ob= NULL;
- driver->blocktype= ID_OB;
- driver->adrcode= OB_LOC_X;
- driver->flag &= ~IPO_DRIVER_FLAG_INVALID;
- }
- }
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- DAG_scene_sort(G.scene);
-
- BIF_undo_push("Change Ipo driver type");
- }
- break;
- case B_IPO_DEPCHANGE:
- ei= get_active_editipo();
- if(ei) {
- if(ei->icu->driver) {
- IpoDriver *driver= ei->icu->driver;
-
- if(driver->type == IPO_DRIVER_TYPE_PYTHON) {
- }
- else {
- if(driver->ob) {
- if(ob==driver->ob && G.sipo->bonename[0]==0) {
- error("Cannot assign a Driver to own Object");
- driver->ob= NULL;
- }
- else {
- /* check if type is still OK */
- if(driver->ob->type==OB_ARMATURE && driver->blocktype==ID_AR);
- else driver->blocktype= ID_OB;
- }
- }
- }
- DAG_scene_sort(G.scene);
-
- if(G.sipo->blocktype==ID_KE || G.sipo->blocktype==ID_AC)
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- else
- DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
- }
- }
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- break;
- }
-}
-
-static char *ipodriver_modeselect_pup(Object *ob)
-{
- static char string[265];
- char tmpstr[64];
- char formatstring[64];
-
- strcpy(string, "Driver type: %t");
-
- strcpy(formatstring, "|%s %%x%d %%i%d");
-
- if(ob) {
- sprintf(tmpstr,formatstring,"Object",ID_OB, ICON_OBJECT);
- strcat(string,tmpstr);
- }
- if(ob && ob->type==OB_ARMATURE) {
- sprintf(tmpstr,formatstring,"Pose",ID_AR, ICON_POSE_DEHLT);
- strcat(string,tmpstr);
- }
-
- return (string);
-}
-
-static char *ipodriver_channelselect_pup(int is_armature)
-{
- static char string[1024];
- char *tmp;
-
- strcpy(string, "Driver channel: %t");
- tmp= string+strlen(string);
-
- tmp+= sprintf(tmp, "|Loc X %%x%d", OB_LOC_X);
- tmp+= sprintf(tmp, "|Loc Y %%x%d", OB_LOC_Y);
- tmp+= sprintf(tmp, "|Loc Z %%x%d", OB_LOC_Z);
- tmp+= sprintf(tmp, "|Rot X %%x%d", OB_ROT_X);
- tmp+= sprintf(tmp, "|Rot Y %%x%d", OB_ROT_Y);
- tmp+= sprintf(tmp, "|Rot Z %%x%d", OB_ROT_Z);
- tmp+= sprintf(tmp, "|Scale X %%x%d", OB_SIZE_X);
- tmp+= sprintf(tmp, "|Scale Y %%x%d", OB_SIZE_Y);
- tmp+= sprintf(tmp, "|Scale Z %%x%d", OB_SIZE_Z);
- if(is_armature)
- tmp+= sprintf(tmp, "|Rotation Difference %%x%d", OB_ROT_DIFF);
-
- return (string);
-}
-
-static void ipo_panel_properties(short cntrl) // IPO_HANDLER_PROPERTIES
-{
- extern int totipo_curve; // editipo.c
- uiBlock *block;
- EditIpo *ei;
- char name[48];
-
- block= uiNewBlock(&curarea->uiblocks, "ipo_panel_properties", UI_EMBOSS, UI_HELV, curarea->win);
- uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | cntrl);
- uiSetPanelHandler(IPO_HANDLER_PROPERTIES); // for close and esc
- if(uiNewPanel(curarea, block, "Transform Properties", "Ipo", 10, 230, 318, 204)==0) return;
-
- /* this is new panel height, newpanel doesnt force new size on existing panels */
- uiNewPanelHeight(block, 204);
-
- /* driver buttons first */
- ei= get_active_editipo();
- if(ei) {
-
- sprintf(name, "Driven Channel: %s", ei->name);
- uiDefBut(block, LABEL, 0, name, 10, 265, 200, 19, NULL, 1.0, 0.0, 0, 0, "");
-
- if(ei->icu && ei->icu->driver) {
- IpoDriver *driver= ei->icu->driver;
-
- uiDefBut(block, BUT, B_IPO_DRIVER, "Remove", 210,265,100,20, NULL, 0.0f, 0.0f, 0, 0, "Remove Driver for this Ipo Channel");
-
- uiBlockBeginAlign(block);
- uiDefIconButS(block, TOG, B_IPO_DRIVERTYPE, ICON_PYTHON, 10,240,25,20, &driver->type, (float)IPO_DRIVER_TYPE_NORMAL, (float)IPO_DRIVER_TYPE_PYTHON, 0, 0, "Use a one-line Python Expression as Driver");
-
- if(driver->type == IPO_DRIVER_TYPE_PYTHON) {
- uiDefBut(block, TEX, B_IPO_REDR, "", 35,240,275,20, driver->name, 0, 127, 0, 0, "Python Expression");
- uiBlockEndAlign(block);
- if(driver->flag & IPO_DRIVER_FLAG_INVALID) {
- uiDefBut(block, LABEL, 0, "Error: invalid Python expression",
- 5,215,230,19, NULL, 0, 0, 0, 0, "");
- }
- }
- else {
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_IPO_DEPCHANGE, "OB:", 35, 240, 125, 20, &(driver->ob), "Driver Object");
- if(driver->ob) {
- int icon=ICON_OBJECT;
-
- if(driver->ob->type==OB_ARMATURE && driver->blocktype==ID_AR) {
- icon = ICON_POSE_DEHLT;
- uiDefBut(block, TEX, B_IPO_REDR, "BO:", 10,220,150,20, driver->name, 0, 31, 0, 0, "Bone name");
-
- if(driver->adrcode==OB_ROT_DIFF)
- uiDefBut(block, TEX, B_IPO_REDR, "BO:", 10,200,150,20, driver->name+DRIVER_NAME_OFFS, 0, 31, 0, 0, "Bone name for angular reference");
-
- }
- else driver->blocktype= ID_OB; /* safety when switching object button */
-
- uiBlockBeginAlign(block);
- uiDefIconTextButS(block, MENU, B_IPO_DEPCHANGE, icon,
- ipodriver_modeselect_pup(driver->ob), 165,240,145,20, &(driver->blocktype), 0, 0, 0, 0, "Driver type");
-
- uiDefButS(block, MENU, B_IPO_REDR,
- ipodriver_channelselect_pup(driver->ob->type==OB_ARMATURE && driver->blocktype==ID_AR),
- 165,220,145,20, &(driver->adrcode), 0, 0, 0, 0, "Driver channel");
- }
- uiBlockEndAlign(block);
- }
- }
- else {
- uiDefBut(block, BUT, B_IPO_DRIVER, "Add Driver", 210,265,100,19, NULL, 0.0f, 0.0f, 0, 0, "Create a Driver for this Ipo Channel");
- }
- }
- else
- uiDefBut(block, LABEL, 0, " ", 10, 265, 150, 19, NULL, 1.0, 0.0, 0, 0, "");
-
- boundbox_ipo_curves(G.sipo); // should not be needed... transform/draw calls should update
-
- /* note ranges for buttons below are idiot... we need 2 ranges, one for sliding scale, one for real clip */
- if(G.sipo->ipo && G.sipo->ipo->curve.first && totipo_curve) {
- extern int totipo_vertsel; // editipo.c
- uiDefBut(block, LABEL, 0, "Visible curves", 160, 200, 150, 19, NULL, 1.0, 0.0, 0, 0, "");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_MUL_IPO, "Xmin:", 10, 180, 150, 19, &G.sipo->tot.xmin, G.sipo->tot.xmin-1000.0, MAXFRAMEF, 100, 0, "");
- uiDefButF(block, NUM, B_MUL_IPO, "Xmax:", 160, 180, 150, 19, &G.sipo->tot.xmax, G.sipo->tot.ymin-1000.0, MAXFRAMEF, 100, 0, "");
-
- uiDefButF(block, NUM, B_MUL_IPO, "Ymin:", 10, 160, 150, 19, &G.sipo->tot.ymin, G.sipo->tot.ymin-1000.0, 5000.0, 100, 0, "");
- uiDefButF(block, NUM, B_MUL_IPO, "Ymax:", 160, 160, 150, 19, &G.sipo->tot.ymax, G.sipo->tot.ymin-1000.0, 5000.0, 100, 0, "");
-
- /* SPEED BUTTON */
- if(totipo_vertsel) {
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_IPO_NONE, "Speed:", 10,130,150,19, &hspeed, 0.0, 180.0, 1, 0, "");
- uiDefBut(block, BUT, B_SETSPEED,"SET", 160,130,50,19, 0, 0, 0, 0, 0, "");
- }
- }
-
- /* this one also does keypositions */
- if(G.sipo->ipo) ipo_editvertex_buts(block, G.sipo, -10000, MAXFRAMEF);
-}
-
-static void ipo_blockhandlers(ScrArea *sa)
-{
- SpaceIpo *sipo= sa->spacedata.first;
- short a;
-
- /* warning; blocks need to be freed each time, handlers dont remove (for ipo moved to drawipospace) */
-
- for(a=0; a<SPACE_MAXHANDLER; a+=2) {
- switch(sipo->blockhandler[a]) {
-
- case IPO_HANDLER_PROPERTIES:
- ipo_panel_properties(sipo->blockhandler[a+1]);
- break;
-
- }
- /* clear action value for event */
- sipo->blockhandler[a+1]= 0;
- }
- uiDrawBlocksPanels(sa, 0);
-
-}
-
-
-void drawipospace(ScrArea *sa, void *spacedata)
-{
- SpaceIpo *sipo= sa->spacedata.first;
- View2D *v2d= &sipo->v2d;
- EditIpo *ei;
- float col[3];
- int ofsx, ofsy, a, disptype;
-
- bwin_clear_viewmat(sa->win); /* clear buttons view */
- glLoadIdentity();
-
- uiFreeBlocksWin(&sa->uiblocks, sa->win); /* for panel handler to work */
-
- test_editipo(0); /* test if current editipo is correct, make_editipo sets v2d->cur, call here because of calc_ipobuttonswidth() */
-
- v2d->hor.xmax+=calc_ipobuttonswidth(sa);
- calc_scrollrcts(sa, G.v2d, sa->winx, sa->winy);
-
- BIF_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
-
- if (sipo->pin)
- glClearColor(col[0]+0.05,col[1],col[2], 0.0); // litepink
- else
- glClearColor(col[0],col[1],col[2], 0.0);
-
- glClear(GL_COLOR_BUFFER_BIT);
-
- if(sa->winx>SCROLLB+10 && sa->winy>SCROLLH+10) {
- if(v2d->scroll) {
- ofsx= sa->winrct.xmin; // ivm mywin
- ofsy= sa->winrct.ymin;
- glViewport(ofsx+v2d->mask.xmin, ofsy+v2d->mask.ymin, ( ofsx+v2d->mask.xmax-1)-(ofsx+v2d->mask.xmin)+1, ( ofsy+v2d->mask.ymax-1)-( ofsy+v2d->mask.ymin)+1);
- glScissor(ofsx+v2d->mask.xmin, ofsy+v2d->mask.ymin, ( ofsx+v2d->mask.xmax-1)-(ofsx+v2d->mask.xmin)+1, ( ofsy+v2d->mask.ymax-1)-( ofsy+v2d->mask.ymin)+1);
- }
- }
-
- myortho2(v2d->cur.xmin, v2d->cur.xmax, v2d->cur.ymin, v2d->cur.ymax);
-
- if(sipo->editipo) {
-
- /* correct scale for degrees? */
- disptype= -1;
- ei= sipo->editipo;
- for(a=0; a<sipo->totipo; a++, ei++) {
- if(ei->flag & IPO_VISIBLE) {
- if(disptype== -1) disptype= ei->disptype;
- else if(disptype!=ei->disptype) disptype= 0;
- }
- }
-
- calc_ipogrid();
- draw_ipogrid();
-
- draw_cfra(sipo);
-
- /* ipokeys */
- if(sipo->showkey) {
- if(sipo->ipokey.first==0) make_ipokey();
- else update_ipokey_val();
- draw_ipokey(sipo);
- }
-
- if(sipo->blocktype==ID_KE) {
- ei= sipo->editipo;
- draw_key(sipo, ei->flag & IPO_VISIBLE);
- }
-
- /* map ipo-points for drawing if scaled ipo */
- if (NLA_IPO_SCALED)
- actstrip_map_ipo_keys(OBACT, sipo->ipo, 0, 0);
-
- /* draw deselect */
- draw_ipocurves(0);
- draw_ipohandles(0);
- draw_ipovertices(0);
-
- /* draw select */
- draw_ipocurves(1);
- draw_ipohandles(1);
- draw_ipovertices(1);
-
- /* undo mapping of ipo-points for drawing if scaled ipo */
- if (NLA_IPO_SCALED)
- actstrip_map_ipo_keys(OBACT, sipo->ipo, 1, 0);
-
- /* Draw 'curtains' for preview */
- draw_anim_preview_timespace();
-
- /* draw markers */
- draw_markers_timespace(0);
-
- /* restore viewport */
- mywinset(sa->win);
-
- if(sa->winx>SCROLLB+10 && sa->winy>SCROLLH+10) {
-
- /* ortho at pixel level sa */
- myortho2(-0.375, sa->winx-0.375, -0.375, sa->winy-0.375);
-
- if(v2d->scroll) {
- drawscroll(disptype);
- draw_solution(sipo);
- }
-
- draw_ipobuts(sipo);
- }
- }
- else {
- calc_ipogrid();
- draw_ipogrid();
- }
-
- myortho2(-0.375, sa->winx-0.375, -0.375, sa->winy-0.375);
- draw_area_emboss(sa);
-
- /* it is important to end a view in a transform compatible with buttons */
- bwin_scalematrix(sa->win, sipo->blockscale, sipo->blockscale, sipo->blockscale);
- /* only draw panels when relevant */
- if(sipo->editipo) ipo_blockhandlers(sa);
-
- sa->win_swap= WIN_BACK_OK;
-}
-
-void scroll_ipobuts()
-{
- int tot;
- short yo, mval[2];
-
- tot= 30+IPOBUTY*G.sipo->totipo;
- if(tot<curarea->winy) return;
-
- getmouseco_areawin(mval);
- yo= mval[1];
-
- while(get_mbut()&M_MOUSE) {
- getmouseco_areawin(mval);
- if(mval[1]!=yo) {
- G.sipo->butofs+= (mval[1]-yo);
- if(G.sipo->butofs<0) G.sipo->butofs= 0;
- else if(G.sipo->butofs+curarea->winy>tot) G.sipo->butofs= tot-curarea->winy;
-
- scrarea_do_windraw(curarea);
- screen_swapbuffers();
-
- yo= mval[1];
- }
- else BIF_wait_for_statechange();
- }
-}
-
-/* total mess function, especially with mousewheel, needs cleanup badly (ton) */
-int view2dzoom(unsigned short event)
-{
- ScrArea *sa;
- float fac, dx, dy, wtemp;
- short mval[2], mvalo[2];
- short is_wheel= (event==WHEELUPMOUSE) || (event==WHEELDOWNMOUSE);
-
- getmouseco_areawin(mvalo);
- mval[0]= mvalo[0];
- mval[1]= mvalo[1];
-
- while( (get_mbut()&(L_MOUSE|M_MOUSE)) || is_wheel ) {
-
- /* regular mousewheel: zoom regular
- * alt-shift mousewheel: zoom y only
- * alt-ctrl mousewheel: zoom x only
- */
- if (event==WHEELUPMOUSE) {
- if(U.uiflag & USER_WHEELZOOMDIR)
- wtemp = -0.0375;
- else
- wtemp = 0.03;
- if(curarea->spacetype!=SPACE_BUTS) wtemp*= 3;
-
- dx= (float)(wtemp*(G.v2d->cur.xmax-G.v2d->cur.xmin));
- dy= (float)(wtemp*(G.v2d->cur.ymax-G.v2d->cur.ymin));
-
- switch (G.qual & (LR_CTRLKEY|LR_SHIFTKEY|LR_ALTKEY)) {
- case 0:
- break;
- case (LR_SHIFTKEY|LR_ALTKEY):
- dx = 0;
- break;
- case (LR_CTRLKEY|LR_ALTKEY):
- dy = 0;
- break;
- default:
- if(curarea->spacetype==SPACE_BUTS); // exception
- else return 0;
- break;
- }
- }
- else if (event==WHEELDOWNMOUSE) {
- if(U.uiflag & USER_WHEELZOOMDIR)
- wtemp = 0.03;
- else
- wtemp = -0.0375;
- if(curarea->spacetype!=SPACE_BUTS) wtemp*= 3;
-
- dx= (float)(wtemp*(G.v2d->cur.xmax-G.v2d->cur.xmin));
- dy= (float)(wtemp*(G.v2d->cur.ymax-G.v2d->cur.ymin));
-
- switch (G.qual & (LR_CTRLKEY|LR_SHIFTKEY|LR_ALTKEY)) {
- case 0:
- break;
- case (LR_SHIFTKEY|LR_ALTKEY):
- dx = 0;
- break;
- case (LR_CTRLKEY|LR_ALTKEY):
- dy = 0;
- break;
- default:
- if(curarea->spacetype==SPACE_BUTS);
- else return 0;
- break;
- }
- }
- else {
- getmouseco_areawin(mval);
- if(U.viewzoom==USER_ZOOM_SCALE) {
- float dist;
-
- dist = (G.v2d->mask.xmax - G.v2d->mask.xmin)/2.0;
- dx= 1.0-(fabs(mvalo[0]-dist)+2.0)/(fabs(mval[0]-dist)+2.0);
- dx*= 0.5*(G.v2d->cur.xmax-G.v2d->cur.xmin);
-
- dist = (G.v2d->mask.ymax - G.v2d->mask.ymin)/2.0;
- dy= 1.0-(fabs(mvalo[1]-dist)+2.0)/(fabs(mval[1]-dist)+2.0);
- dy*= 0.5*(G.v2d->cur.ymax-G.v2d->cur.ymin);
-
- }
- else {
- fac= 0.01*(mval[0]-mvalo[0]);
- dx= fac*(G.v2d->cur.xmax-G.v2d->cur.xmin);
- fac= 0.01*(mval[1]-mvalo[1]);
- dy= fac*(G.v2d->cur.ymax-G.v2d->cur.ymin);
-
- if(U.viewzoom==USER_ZOOM_CONT) {
- dx/= 20.0;
- dy/= 20.0;
- }
- }
- }
-
- if (ELEM(event, WHEELUPMOUSE, WHEELDOWNMOUSE) || mval[0]!=mvalo[0] || mval[1]!=mvalo[1]) {
-
- if(U.viewzoom!=USER_ZOOM_CONT) {
- mvalo[0]= mval[0];
- mvalo[1]= mval[1];
- }
-
- if( ELEM(curarea->spacetype, SPACE_NLA, SPACE_ACTION) ) {
- if(mvalo[0] < G.v2d->mask.xmin) {
- G.v2d->cur.ymin+= dy;
- G.v2d->cur.ymax-= dy;
- }
- else {
- G.v2d->cur.xmin+= dx;
- G.v2d->cur.xmax-= dx;
- }
- }
- else if (ELEM(curarea->spacetype, SPACE_SOUND, SPACE_TIME)) {
- G.v2d->cur.xmin+= dx;
- G.v2d->cur.xmax-= dx;
- }
- else if (curarea->spacetype == SPACE_SEQ) {
- /* less sensitivity on y scale */
- G.v2d->cur.xmin+= dx;
- G.v2d->cur.xmax-= dx;
- if (!(ELEM(event, WHEELUPMOUSE, WHEELDOWNMOUSE))) {
- G.v2d->cur.ymin+= dy/2;
- G.v2d->cur.ymax-= dy/2;
- }
- }
- else {
- G.v2d->cur.xmin+= dx;
- G.v2d->cur.xmax-= dx;
- G.v2d->cur.ymin+= dy;
- G.v2d->cur.ymax-= dy;
- }
-
- test_view2d(G.v2d, curarea->winx, curarea->winy); /* cur min max rects */
-
- sa= curarea; /* now when are you going to kill this one! */
- view2d_do_locks(curarea, V2D_LOCK_COPY|V2D_LOCK_REDRAW);
- areawinset(sa->win);
-
- scrarea_do_windraw(curarea);
- screen_swapbuffers();
- }
- else BIF_wait_for_statechange();
- /* return if we were using the mousewheel
- */
- if ( is_wheel ) return 1;
- }
- return 1;
-}
-
-void center_currframe(void)
-{
- /* place the current frame in the
- * center of the 2D window.
- */
- float width;
-
- width = G.v2d->cur.xmax - G.v2d->cur.xmin;
- G.v2d->cur.xmin = CFRA - 0.5*(width);
- G.v2d->cur.xmax = CFRA + 0.5*(width);
-
- test_view2d(G.v2d, curarea->winx, curarea->winy);
- view2d_do_locks(curarea, V2D_LOCK_COPY);
-
- scrarea_queue_winredraw(curarea);
-}
-
-/* total mess function, especially with mousewheel, needs cleanup badly (ton) */
-int view2dmove(unsigned short event)
-{
- /* return 1 when something was done */
- float facx=0.0, facy=0.0, dx, dy, left=1.0, right=1.0;
- short mval[2], mvalo[2], leftret=1, mousebut;
- short is_wheel= (event==WHEELUPMOUSE) || (event==WHEELDOWNMOUSE);
- int oldcursor, cursor;
- Window *win;
-
- /* when wheel is used, we only draw it once */
-
- /* try to do some zooming if the
- * middlemouse and ctrl are pressed
- * or if the mousewheel is being used.
- * Return if zooming was done.
- */
-
- /* check for left mouse / right mouse button select */
- if (U.flag & USER_LMOUSESELECT) mousebut = R_MOUSE;
- else mousebut = L_MOUSE;
-
- if ( (G.qual & LR_CTRLKEY) || is_wheel ) {
- /* patch for oops & buttonswin, standard scroll no zoom */
- if(curarea->spacetype==SPACE_OOPS) {
- SpaceOops *soops= curarea->spacedata.first;
- if(soops->type==SO_OUTLINER);
- else if (view2dzoom(event)) {
- return 0;
- }
- }
- else if(curarea->spacetype==SPACE_BUTS && (G.qual & LR_CTRLKEY)==0);
- else if (view2dzoom(event)) {
- return 0;
- }
- }
-
- /* test where mouse is */
- getmouseco_areawin(mvalo);
- /* initialize this too */
- mval[0]= mvalo[0];
- mval[1]= mvalo[1];
-
- if ELEM7(curarea->spacetype, SPACE_IPO, SPACE_SEQ, SPACE_OOPS, SPACE_SOUND, SPACE_ACTION, SPACE_NLA, SPACE_TIME) {
-
- if( BLI_in_rcti(&G.v2d->mask, (int)mvalo[0], (int)mvalo[1]) ) {
- facx= (G.v2d->cur.xmax-G.v2d->cur.xmin)/(float)(G.v2d->mask.xmax-G.v2d->mask.xmin);
- facy= (G.v2d->cur.ymax-G.v2d->cur.ymin)/(float)(G.v2d->mask.ymax-G.v2d->mask.ymin);
- }
- /* stoopid exception to allow scroll in lefthand side */
- else if(curarea->spacetype==SPACE_ACTION && BLI_in_rcti(&G.v2d->mask, ACTWIDTH+(int)mvalo[0], (int)mvalo[1]) ) {
- facx= 0.0f;
- facy= (G.v2d->cur.ymax-G.v2d->cur.ymin)/(float)(G.v2d->mask.ymax-G.v2d->mask.ymin);
- }
- else if(curarea->spacetype==SPACE_NLA && BLI_in_rcti(&G.v2d->mask, NLAWIDTH+(int)mvalo[0], (int)mvalo[1]) ) {
- facx= 0.0f;
- facy= (G.v2d->cur.ymax-G.v2d->cur.ymin)/(float)(G.v2d->mask.ymax-G.v2d->mask.ymin);
- }
- else if(IN_2D_VERT_SCROLL((int)mvalo)) {
- facy= -(G.v2d->tot.ymax-G.v2d->tot.ymin)/(float)(G.v2d->mask.ymax-G.v2d->mask.ymin);
- if(get_mbut() & mousebut) {
- /* which part of scrollbar should move? */
- if(mvalo[1]< (vertymin+vertymax)/2 ) right= 0.0;
- else left= 0.0;
- leftret= 0;
- }
- if(is_wheel)
- facy= -facy;
- }
- else if(IN_2D_HORIZ_SCROLL((int)mvalo)) {
- facx= -(G.v2d->tot.xmax-G.v2d->tot.xmin)/(float)(G.v2d->mask.xmax-G.v2d->mask.xmin);
- if(get_mbut() & mousebut) {
- /* which part of scrollbar should move? */
- if(mvalo[0]< (horxmin+horxmax)/2 ) right= 0.0;
- else left= 0.0;
- leftret= 0;
- }
- }
- }
- else {
- facx= (G.v2d->cur.xmax-G.v2d->cur.xmin)/(float)(curarea->winx);
- facy= (G.v2d->cur.ymax-G.v2d->cur.ymin)/(float)(curarea->winy);
- }
-
- cursor = BC_NSEW_SCROLLCURSOR;
-
- /* no y move in audio & time */
- if ELEM(curarea->spacetype, SPACE_SOUND, SPACE_TIME) {
- facy= 0.0;
- cursor = BC_EW_SCROLLCURSOR;
- }
-
- /* store the old cursor to temporarily change it */
- oldcursor=get_cursor();
- win=winlay_get_active_window();
-
-
- if(get_mbut() & mousebut && leftret) return 0;
- if(facx==0.0 && facy==0.0) return 1;
-
- if (!is_wheel) SetBlenderCursor(cursor);
-
- while( (get_mbut()&(L_MOUSE|M_MOUSE)) || is_wheel) {
-
- /* If the mousewheel is used with shift key
- * the scroll up and down. If the mousewheel
- * is used with the ctrl key then scroll left
- * and right.
- */
- if (is_wheel) {
-
- if(event==WHEELDOWNMOUSE) {
- facx= -facx; facy= -facy;
- }
- switch (G.qual & (LR_CTRLKEY|LR_SHIFTKEY|LR_ALTKEY)) {
- case (LR_SHIFTKEY):
- dx = 0.0;
- dy= facy*20.0;
- break;
- case (LR_CTRLKEY):
- dx= facx*20.0;
- dy = 0.0;
- break;
- default:
- if(curarea->spacetype==SPACE_OOPS) {
- dx= 0.0;
- dy= facy*20;
- }
- else if(curarea->spacetype==SPACE_BUTS) {
- if(G.buts->align==BUT_HORIZONTAL) {
- dx= facx*30; dy= 0.0;
- } else {
- dx= 0.0; dy= facy*30;
- }
- }
- else return 0;
- break;
- }
- }
- else {
-
-
- getmouseco_areawin(mval);
- dx= facx*(mvalo[0]-mval[0]);
- dy= facy*(mvalo[1]-mval[1]);
- }
-
- if(mval[0]!=mvalo[0] || mval[1]!=mvalo[1] || is_wheel) {
- ScrArea *sa;
-
- G.v2d->cur.xmin+= left*dx;
- G.v2d->cur.xmax+= right*dx;
- G.v2d->cur.ymin+= left*dy;
- G.v2d->cur.ymax+= right*dy;
-
- test_view2d(G.v2d, curarea->winx, curarea->winy);
-
- sa= curarea; /* bad global */
- view2d_do_locks(curarea, V2D_LOCK_COPY|V2D_LOCK_REDRAW);
- areawinset(sa->win);
-
- if(curarea->spacetype==SPACE_OOPS)
- ((SpaceOops *)curarea->spacedata.first)->storeflag |= SO_TREESTORE_REDRAW;
-
- scrarea_do_windraw(curarea);
- screen_swapbuffers();
-
- mvalo[0]= mval[0];
- mvalo[1]= mval[1];
- }
- else BIF_wait_for_statechange();
- /* return if we were using the mousewheel
- */
- if ( is_wheel ) return 1;
- }
-
- window_set_cursor(win, oldcursor);
- return 1;
-}
-
-void view2dborder(void)
-{
-
-}
-
-EditIpo *select_proj_ipo(rctf *rectf, int event)
-{
- EditIpo *ei;
- float xmin, ymin, xmax, ymax;
- /* this was IGLuint, but it's a useless typedef... */
- GLuint buffer[MAXPICKBUF];
- int a, b;
- int hits;
- unsigned int code;
- short mval[2];
-
- G.f |= G_PICKSEL;
-
- if(rectf==0) {
- getmouseco_areawin(mval);
-
- mval[0]-= 6; mval[1]-= 6;
- areamouseco_to_ipoco(G.v2d, mval, &xmin, &ymin);
- mval[0]+= 12; mval[1]+= 12;
- areamouseco_to_ipoco(G.v2d, mval, &xmax, &ymax);
-
- myortho2(xmin, xmax, ymin, ymax);
- }
- else myortho2(rectf->xmin, rectf->xmax, rectf->ymin, rectf->ymax);
-
- glSelectBuffer( MAXPICKBUF, buffer);
- glRenderMode(GL_SELECT);
- glInitNames(); /* whatfor? but otherwise it does not work */
- glPushName(-1);
-
- /* get rid of buttons view */
- glPushMatrix();
- glLoadIdentity();
-
- init_pickselcode(); /* drawipo.c */
- draw_ipocurves(0);
-
- /* restore buttons view */
- glPopMatrix();
-
- G.f -= G_PICKSEL;
-
- hits= glRenderMode(GL_RENDER);
- glPopName(); /* see above (pushname) */
- if(hits<1) return 0;
-
- code= 1;
- ei= G.sipo->editipo;
- for(a=0; a<G.sipo->totipo; a++, ei++) {
- if ISPOIN(ei, icu, flag & IPO_VISIBLE) {
- if(rectf) {
- for(b=0; b<hits; b++) {
- /* conversion for glSelect */
- if(code == buffer[ (4 * b) + 3] ) {
- if(event==LEFTMOUSE) ei->flag |= IPO_SELECT;
- else ei->flag &= ~IPO_SELECT;
- ei->icu->flag= ei->flag;
- }
- }
- }
- else {
- /* also conversion for glSelect */
- if(code==buffer[ 3 ]) return ei;
- }
- code++;
- }
- }
- return 0;
-}
diff --git a/source/blender/src/drawmesh.c b/source/blender/src/drawmesh.c
deleted file mode 100644
index df5334dd27d..00000000000
--- a/source/blender/src/drawmesh.c
+++ /dev/null
@@ -1,1222 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <string.h>
-#include <math.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_edgehash.h"
-#include "BLI_editVert.h"
-
-#include "IMB_imbuf.h"
-#include "IMB_imbuf_types.h"
-
-#include "DNA_image_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_material_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_object_types.h"
-#include "DNA_property_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_userdef_types.h"
-
-#include "BKE_bmfont.h"
-#include "BKE_displist.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_effect.h"
-#include "BKE_global.h"
-#include "BKE_image.h"
-#include "BKE_main.h"
-#include "BKE_material.h"
-#include "BKE_mesh.h"
-#include "BKE_object.h"
-#include "BKE_property.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_editmesh.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-#include "BIF_mywindow.h"
-#include "BIF_resources.h"
-
-#include "BDR_editface.h"
-#include "BDR_vpaint.h"
-#include "BDR_drawmesh.h"
-
-#include "BSE_drawview.h"
-
-#include "blendef.h"
-#include "nla.h"
-
-#ifndef GL_CLAMP_TO_EDGE
-#define GL_CLAMP_TO_EDGE 0x812F
-#endif
-
-//#include "glext.h"
-/* some local functions */
-#if defined(GL_EXT_texture_object) && (!defined(__sun__) || (!defined(__sun))) && !defined(__APPLE__) && !defined(__linux__) && !defined(WIN32)
- #define glBindTexture(A,B) glBindTextureEXT(A,B)
- #define glGenTextures(A,B) glGenTexturesEXT(A,B)
- #define glDeleteTextures(A,B) glDeleteTexturesEXT(A,B)
- #define glPolygonOffset(A,B) glPolygonOffsetEXT(A,B)
-
-#else
-
-/* #define GL_FUNC_ADD_EXT GL_FUNC_ADD */
-/* #define GL_FUNC_REVERSE_SUBTRACT_EXT GL_FUNC_REVERSE_SUBTRACT */
-/* #define GL_POLYGON_OFFSET_EXT GL_POLYGON_OFFSET */
-
-#endif
-
- /* (n&(n-1)) zeros the least significant bit of n */
-static int is_pow2(int num) {
- return ((num)&(num-1))==0;
-}
-static int smaller_pow2(int num) {
- while (!is_pow2(num))
- num= num&(num-1);
- return num;
-}
-
-/* These are used to enable texture clamping */
-static int is_pow2_limit(int num) {
- if (U.glreslimit != 0 && num > U.glreslimit) return 0;
- return ((num)&(num-1))==0;
-}
-
-static int smaller_pow2_limit(int num) {
- if (U.glreslimit != 0 && num > U.glreslimit)
- return U.glreslimit;
- return smaller_pow2(num);
-}
-
-static int fCurtile=0, fCurmode=0,fCurtileXRep=0,fCurtileYRep=0;
-static Image *fCurpage=0;
-static short fTexwindx, fTexwindy, fTexwinsx, fTexwinsy;
-static int fDoMipMap = 1;
-static int fLinearMipMap = 0;
-
-/* local prototypes --------------- */
-void update_realtime_textures(void);
-
-
-/* static int source, dest; also not used */
-
-/**
- * Enables or disable mipmapping for realtime images.
- * @param mipmap Turn mipmapping on (mipmap!=0) or off (mipmap==0).
- */
-void set_mipmap(int mipmap)
-{
- if (fDoMipMap != (mipmap != 0)) {
- free_all_realtime_images();
- fDoMipMap = mipmap != 0;
- }
-}
-
-/**
- * Returns the current setting for mipmapping.
- */
-static int get_mipmap(void)
-{
- return fDoMipMap && (!(G.f & G_TEXTUREPAINT));
-}
-
-/**
- * Enables or disable linear mipmap setting for realtime images (textures).
- * Note that this will will destroy all texture bindings in OpenGL.
- * @see free_realtime_image()
- * @param mipmap Turn linear mipmapping on (linear!=0) or off (linear==0).
- */
-void set_linear_mipmap(int linear)
-{
- if (fLinearMipMap != (linear != 0)) {
- free_all_realtime_images();
- fLinearMipMap = linear != 0;
- }
-}
-
-/**
- * Returns the current setting for linear mipmapping.
- */
-int get_linear_mipmap(void)
-{
- return fLinearMipMap;
-}
-
-
-/**
- * Resets the realtime image cache variables.
- */
-void clear_realtime_image_cache()
-{
- fCurpage = NULL;
- fCurtile = 0;
- fCurmode = 0;
- fCurtileXRep = 0;
- fCurtileYRep = 0;
-}
-
-/* REMEMBER! Changes here must go into my_set_tpage() as well */
-int set_tpage(MTFace *tface)
-{
- static int alphamode= -1;
- static MTFace *lasttface= 0;
- Image *ima;
- ImBuf *ibuf;
- unsigned int *rect=NULL, *bind;
- int tpx=0, tpy=0, tilemode, tileXRep,tileYRep;
-
- /* disable */
- if(tface==0) {
- if(lasttface==0) return 0;
-
- lasttface= 0;
- fCurtile= 0;
- fCurpage= 0;
- if(fCurmode!=0) {
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
- }
- fCurmode= 0;
- fCurtileXRep=0;
- fCurtileYRep=0;
- alphamode= -1;
-
- glDisable(GL_BLEND);
- glDisable(GL_TEXTURE_2D);
- glDisable(GL_TEXTURE_GEN_S);
- glDisable(GL_TEXTURE_GEN_T);
- glDisable ( GL_ALPHA_TEST );
- return 0;
- }
- lasttface= tface;
-
- if( alphamode != tface->transp) {
- alphamode= tface->transp;
-
- if(alphamode) {
- glEnable(GL_BLEND);
-
- if(alphamode==TF_ADD) {
- glBlendFunc(GL_ONE, GL_ONE);
- /* glBlendEquationEXT(GL_FUNC_ADD_EXT); */
- }
- else if(alphamode==TF_ALPHA) {
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
- /* added after 2.45 to clip alpha */
-
- /*if U.glalphaclip == 1.0, some cards go bonkers... turn off alpha test in this case*/
- if(U.glalphaclip == 1.0) glDisable(GL_ALPHA_TEST);
- else{
- glEnable ( GL_ALPHA_TEST );
- glAlphaFunc ( GL_GREATER, U.glalphaclip );
- }
-
- /* glBlendEquationEXT(GL_FUNC_ADD_EXT); */
- }
- /* else { */
- /* glBlendFunc(GL_ONE, GL_ONE); */
- /* glBlendEquationEXT(GL_FUNC_REVERSE_SUBTRACT_EXT); */
- /* } */
- } else {
- glDisable(GL_BLEND);
- glDisable ( GL_ALPHA_TEST );
- }
- }
-
- ima= tface->tpage;
-
- /* Enable or disable reflection mapping */
- if (ima && (ima->flag & IMA_REFLECT)){
-
-// glActiveTextureARB(GL_TEXTURE0_ARB);
- glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
- glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
-
- glEnable(GL_TEXTURE_GEN_S);
- glEnable(GL_TEXTURE_GEN_T);
-
- /* Handle multitexturing here */
- }
- else{
- glDisable(GL_TEXTURE_GEN_S);
- glDisable(GL_TEXTURE_GEN_T);
- }
-
- tilemode= tface->mode & TF_TILES;
- tileXRep = 0;
- tileYRep = 0;
- if (ima) {
- tileXRep = ima->xrep;
- tileYRep = ima->yrep;
- }
-
-
- if(ima==fCurpage && fCurtile==tface->tile && tilemode==fCurmode && fCurtileXRep==tileXRep && fCurtileYRep == tileYRep) return ima!=0;
-
- if(tilemode!=fCurmode || fCurtileXRep!=tileXRep || fCurtileYRep != tileYRep) {
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
-
- if(tilemode && ima!=NULL)
- glScalef(ima->xrep, ima->yrep, 1.0);
-
- glMatrixMode(GL_MODELVIEW);
- }
-
- if(ima==NULL || ima->ok==0) {
- glDisable(GL_TEXTURE_2D);
-
- fCurtile= tface->tile;
- fCurpage= 0;
- fCurmode= tilemode;
- fCurtileXRep = tileXRep;
- fCurtileYRep = tileYRep;
-
- return 0;
- }
-
- ibuf= BKE_image_get_ibuf(ima, NULL);
- if(ibuf==NULL) {
-
- fCurtile= tface->tile;
- fCurpage= 0;
- fCurmode= tilemode;
- fCurtileXRep = tileXRep;
- fCurtileYRep = tileYRep;
-
- glDisable(GL_TEXTURE_2D);
- return 0;
- }
-
- if ((ibuf->rect==NULL) && ibuf->rect_float)
- IMB_rect_from_float(ibuf);
-
- if(ima->tpageflag & IMA_TWINANIM) fCurtile= ima->lastframe;
- else fCurtile= tface->tile;
-
- if(tilemode) {
- if(ima->repbind==0) make_repbind(ima);
-
- if(fCurtile>=ima->totbind) fCurtile= 0;
-
- /* this happens when you change repeat buttons */
- if(ima->repbind) bind= ima->repbind+fCurtile;
- else bind= &ima->bindcode;
-
- if(*bind==0) {
-
- fTexwindx= ibuf->x/ima->xrep;
- fTexwindy= ibuf->y/ima->yrep;
-
- if(fCurtile>=ima->xrep*ima->yrep) fCurtile= ima->xrep*ima->yrep-1;
-
- fTexwinsy= fCurtile / ima->xrep;
- fTexwinsx= fCurtile - fTexwinsy*ima->xrep;
-
- fTexwinsx*= fTexwindx;
- fTexwinsy*= fTexwindy;
-
- tpx= fTexwindx;
- tpy= fTexwindy;
-
- rect= ibuf->rect + fTexwinsy*ibuf->x + fTexwinsx;
- }
- }
- else {
- bind= &ima->bindcode;
-
- if(*bind==0) {
- tpx= ibuf->x;
- tpy= ibuf->y;
- rect= ibuf->rect;
- }
- }
-
- if(*bind==0) {
- int rectw= tpx, recth= tpy;
- unsigned int *tilerect= NULL, *scalerect= NULL;
-
- /*
- * Maarten:
- * According to Ton this code is not needed anymore. It was used only
- * in really old Blenders.
- * Reevan:
- * Actually it is needed for backwards compatibility. Simpledemo 6 does not display correctly without it.
- */
-#if 1
- if (tilemode) {
- int y;
-
- tilerect= MEM_mallocN(rectw*recth*sizeof(*tilerect), "tilerect");
- for (y=0; y<recth; y++) {
- unsigned int *rectrow= &rect[y*ibuf->x];
- unsigned int *tilerectrow= &tilerect[y*rectw];
-
- memcpy(tilerectrow, rectrow, tpx*sizeof(*rectrow));
- }
-
- rect= tilerect;
- }
-#endif
- if (!is_pow2_limit(rectw) || !is_pow2_limit(recth)) {
- rectw= smaller_pow2_limit(rectw);
- recth= smaller_pow2_limit(recth);
-
- scalerect= MEM_mallocN(rectw*recth*sizeof(*scalerect), "scalerect");
- gluScaleImage(GL_RGBA, tpx, tpy, GL_UNSIGNED_BYTE, rect, rectw, recth, GL_UNSIGNED_BYTE, scalerect);
- rect= scalerect;
- }
-
- glGenTextures(1, (GLuint *)bind);
-
- if((G.f & G_DEBUG) || !*bind) {
- GLenum error = glGetError();
- printf("Texture: %s\n", ima->id.name+2);
- printf("name: %d, tpx: %d\n", *bind, tpx);
- printf("tile: %d, mode: %d\n", fCurtile, tilemode);
- if (error)
- printf("error: %s\n", gluErrorString(error));
- }
- glBindTexture( GL_TEXTURE_2D, *bind);
-
- if (!get_mipmap())
- {
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, rectw, recth, 0, GL_RGBA, GL_UNSIGNED_BYTE, rect);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- } else
- {
- int minfilter= fLinearMipMap?GL_LINEAR_MIPMAP_LINEAR:GL_LINEAR_MIPMAP_NEAREST;
-
- gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, rectw, recth, GL_RGBA, GL_UNSIGNED_BYTE, rect);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, minfilter);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-
- ima->tpageflag |= IMA_MIPMAP_COMPLETE;
- }
-
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
- if (tilerect)
- MEM_freeN(tilerect);
- if (scalerect)
- MEM_freeN(scalerect);
- }
- else glBindTexture( GL_TEXTURE_2D, *bind);
-
- /* dont tile x/y as set the the game properties */
- if (ima->tpageflag & IMA_CLAMP_U)
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- else
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
- if (ima->tpageflag & IMA_CLAMP_V)
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- else
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
-
- /* tag_image_time(ima);*/ /* Did this get lost in the image recode? */
-
- glEnable(GL_TEXTURE_2D);
-
- fCurpage= ima;
- fCurmode= tilemode;
- fCurtileXRep = tileXRep;
- fCurtileYRep = tileYRep;
-
- return 1;
-}
-
-void update_realtime_image(Image *ima, int x, int y, int w, int h)
-{
- ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
-
- if (ima->repbind || get_mipmap() || !ima->bindcode || !ibuf ||
- (!is_pow2(ibuf->x) || !is_pow2(ibuf->y)) ||
- (w == 0) || (h == 0)) {
- /* these special cases require full reload still */
- free_realtime_image(ima);
- }
- else {
- int row_length = glaGetOneInteger(GL_UNPACK_ROW_LENGTH);
- int skip_pixels = glaGetOneInteger(GL_UNPACK_SKIP_PIXELS);
- int skip_rows = glaGetOneInteger(GL_UNPACK_SKIP_ROWS);
-
- if ((ibuf->rect==NULL) && ibuf->rect_float)
- IMB_rect_from_float(ibuf);
-
- glBindTexture(GL_TEXTURE_2D, ima->bindcode);
-
- glPixelStorei(GL_UNPACK_ROW_LENGTH, ibuf->x);
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, x);
- glPixelStorei(GL_UNPACK_SKIP_ROWS, y);
-
- glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, GL_RGBA,
- GL_UNSIGNED_BYTE, ibuf->rect);
-
- glPixelStorei(GL_UNPACK_ROW_LENGTH, row_length);
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, skip_pixels);
- glPixelStorei(GL_UNPACK_SKIP_ROWS, skip_rows);
-
- if(ima->tpageflag & IMA_MIPMAP_COMPLETE)
- ima->tpageflag &= ~IMA_MIPMAP_COMPLETE;
- }
-}
-
-void free_realtime_image(Image *ima)
-{
- if(ima->bindcode) {
- glDeleteTextures(1, (GLuint *)&ima->bindcode);
- ima->bindcode= 0;
- ima->tpageflag &= ~IMA_MIPMAP_COMPLETE;
- }
- if(ima->repbind) {
- glDeleteTextures(ima->totbind, (GLuint *)ima->repbind);
-
- MEM_freeN(ima->repbind);
- ima->repbind= NULL;
- ima->tpageflag &= ~IMA_MIPMAP_COMPLETE;
- }
-}
-
-void free_all_realtime_images(void)
-{
- Image* ima;
-
- for(ima=G.main->image.first; ima; ima=ima->id.next)
- free_realtime_image(ima);
-}
-
-/* these two functions are called on entering and exiting texture paint mode,
- temporary disabling/enabling mipmapping on all images for quick texture
- updates with glTexSubImage2D. images that didn't change don't have to be
- re-uploaded to OpenGL */
-void texpaint_disable_mipmap(void)
-{
- Image* ima;
-
- if(!fDoMipMap)
- return;
-
- for(ima=G.main->image.first; ima; ima=ima->id.next) {
- if(ima->bindcode) {
- glBindTexture(GL_TEXTURE_2D, ima->bindcode);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- }
- }
-}
-
-void texpaint_enable_mipmap(void)
-{
- Image* ima;
-
- if(!fDoMipMap)
- return;
-
- for(ima=G.main->image.first; ima; ima=ima->id.next) {
- if(ima->bindcode) {
- if(ima->tpageflag & IMA_MIPMAP_COMPLETE) {
- int minfilter= fLinearMipMap?GL_LINEAR_MIPMAP_LINEAR:GL_LINEAR_MIPMAP_NEAREST;
-
- glBindTexture(GL_TEXTURE_2D, ima->bindcode);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, minfilter);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- }
- else
- free_realtime_image(ima);
- }
- }
-}
-
-void make_repbind(Image *ima)
-{
- ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
-
- if(ibuf==NULL) return;
-
- if(ima->repbind) {
- glDeleteTextures(ima->totbind, (GLuint *)ima->repbind);
- MEM_freeN(ima->repbind);
- ima->repbind= 0;
- ima->tpageflag &= ~IMA_MIPMAP_COMPLETE;
- }
- ima->totbind= ima->xrep*ima->yrep;
- if(ima->totbind>1) {
- ima->repbind= MEM_callocN(sizeof(int)*ima->totbind, "repbind");
- }
-}
-
-void update_realtime_textures()
-{
- Image *ima;
-
- ima= G.main->image.first;
- while(ima) {
- if(ima->tpageflag & IMA_TWINANIM) {
- if(ima->twend >= ima->xrep*ima->yrep) ima->twend= ima->xrep*ima->yrep-1;
-
- /* check: is bindcode not in the array? Free. (to do) */
-
- ima->lastframe++;
- if(ima->lastframe > ima->twend) ima->lastframe= ima->twsta;
-
- }
- ima= ima->id.next;
- }
-}
-
-/***/
-
- /* Flags for marked edges */
-enum {
- eEdge_Visible = (1<<0),
- eEdge_Select = (1<<1),
-};
-
- /* Creates a hash of edges to flags indicating
- * adjacent tface select/active/etc flags.
- */
-static void get_marked_edge_info__orFlags(EdgeHash *eh, int v0, int v1, int flags)
-{
- int *flags_p;
-
- if (!BLI_edgehash_haskey(eh, v0, v1)) {
- BLI_edgehash_insert(eh, v0, v1, 0);
- }
-
- flags_p = (int*) BLI_edgehash_lookup_p(eh, v0, v1);
- *flags_p |= flags;
-}
-
-EdgeHash *get_tface_mesh_marked_edge_info(Mesh *me)
-{
- EdgeHash *eh = BLI_edgehash_new();
- int i;
- MFace *mf;
- MTFace *tf = NULL;
-
- for (i=0; i<me->totface; i++) {
- mf = &me->mface[i];
- if (me->mtface)
- tf = &me->mtface[i];
-
- if (mf->v3) {
- if (!(mf->flag&ME_HIDE)) {
- unsigned int flags = eEdge_Visible;
- if (mf->flag&ME_FACE_SEL) flags |= eEdge_Select;
-
- get_marked_edge_info__orFlags(eh, mf->v1, mf->v2, flags);
- get_marked_edge_info__orFlags(eh, mf->v2, mf->v3, flags);
- if (mf->v4) {
- get_marked_edge_info__orFlags(eh, mf->v3, mf->v4, flags);
- get_marked_edge_info__orFlags(eh, mf->v4, mf->v1, flags);
- } else {
- get_marked_edge_info__orFlags(eh, mf->v3, mf->v1, flags);
- }
- }
- }
- }
-
- return eh;
-}
-
-
-static int draw_tfaces3D__setHiddenOpts(void *userData, int index)
-{
- struct { Mesh *me; EdgeHash *eh; } *data = userData;
- MEdge *med = &data->me->medge[index];
- unsigned long flags = (long) BLI_edgehash_lookup(data->eh, med->v1, med->v2);
-
- if((G.f & G_DRAWSEAMS) && (med->flag&ME_SEAM)) {
- return 0;
- } else if(G.f & G_DRAWEDGES){
- if (G.f&G_HIDDENEDGES) {
- return 1;
- } else {
- return (flags & eEdge_Visible);
- }
- } else {
- return (flags & eEdge_Select);
- }
-}
-static int draw_tfaces3D__setSeamOpts(void *userData, int index)
-{
- struct { Mesh *me; EdgeHash *eh; } *data = userData;
- MEdge *med = &data->me->medge[index];
- unsigned long flags = (long) BLI_edgehash_lookup(data->eh, med->v1, med->v2);
-
- if (med->flag&ME_SEAM) {
- if (G.f&G_HIDDENEDGES) {
- return 1;
- } else {
- return (flags & eEdge_Visible);
- }
- } else {
- return 0;
- }
-}
-static int draw_tfaces3D__setSelectOpts(void *userData, int index)
-{
- struct { Mesh *me; EdgeHash *eh; } *data = userData;
- MEdge *med = &data->me->medge[index];
- unsigned long flags = (long) BLI_edgehash_lookup(data->eh, med->v1, med->v2);
-
- return flags & eEdge_Select;
-}
-static int draw_tfaces3D__setActiveOpts(void *userData, int index)
-{
- struct { Mesh *me; EdgeHash *eh; } *data = userData;
- MEdge *med = &data->me->medge[index];
- unsigned long flags = (long) BLI_edgehash_lookup(data->eh, med->v1, med->v2);
-
- if (flags & eEdge_Select) {
- return 1;
- } else {
- return 0;
- }
-}
-static int draw_tfaces3D__drawFaceOpts(void *userData, int index)
-{
- Mesh *me = (Mesh*)userData;
-
- MFace *mface = &me->mface[index];
- if (!(mface->flag&ME_HIDE) && (mface->flag&ME_FACE_SEL))
- return 2; /* Don't set color */
- else
- return 0;
-}
-static void draw_tfaces3D(Object *ob, Mesh *me, DerivedMesh *dm)
-{
- struct { Mesh *me; EdgeHash *eh; } data;
-
- data.me = me;
- data.eh = get_tface_mesh_marked_edge_info(me);
-
- glEnable(GL_DEPTH_TEST);
- glDisable(GL_LIGHTING);
- bglPolygonOffset(1.0);
-
- /* Draw (Hidden) Edges */
- BIF_ThemeColor(TH_EDGE_FACESEL);
- dm->drawMappedEdges(dm, draw_tfaces3D__setHiddenOpts, &data);
-
- /* Draw Seams */
- if(G.f & G_DRAWSEAMS) {
- BIF_ThemeColor(TH_EDGE_SEAM);
- glLineWidth(2);
-
- dm->drawMappedEdges(dm, draw_tfaces3D__setSeamOpts, &data);
-
- glLineWidth(1);
- }
-
- /* Draw Selected Faces */
- if(G.f & G_DRAWFACES) {
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- BIF_ThemeColor4(TH_FACE_SELECT);
-
- dm->drawMappedFacesTex(dm, draw_tfaces3D__drawFaceOpts, (void*)me);
-
- glDisable(GL_BLEND);
- }
-
- bglPolygonOffset(1.0);
-
- /* Draw Stippled Outline for selected faces */
- glColor3ub(255, 255, 255);
- setlinestyle(1);
- dm->drawMappedEdges(dm, draw_tfaces3D__setSelectOpts, &data);
- setlinestyle(0);
-
- dm->drawMappedEdges(dm, draw_tfaces3D__setActiveOpts, &data);
-
- bglPolygonOffset(0.0); // resets correctly now, even after calling accumulated offsets
-
- BLI_edgehash_free(data.eh, NULL);
-}
-
-static int set_gl_light(Object *ob)
-{
- Base *base;
- Lamp *la;
- int count;
- /* float zero[4]= {0.0, 0.0, 0.0, 0.0}; */
- float vec[4];
-
- vec[3]= 1.0;
-
- for(count=0; count<8; count++) glDisable(GL_LIGHT0+count);
-
- count= 0;
-
- base= FIRSTBASE;
- while(base) {
- if(base->object->type==OB_LAMP ) {
- if(base->lay & G.vd->lay) {
- if(base->lay & ob->lay)
- {
- la= base->object->data;
-
- glPushMatrix();
- glLoadMatrixf((float *)G.vd->viewmat);
-
- where_is_object_simul(base->object);
- VECCOPY(vec, base->object->obmat[3]);
-
- if(la->type==LA_SUN) {
- vec[0]= base->object->obmat[2][0];
- vec[1]= base->object->obmat[2][1];
- vec[2]= base->object->obmat[2][2];
- vec[3]= 0.0;
- glLightfv(GL_LIGHT0+count, GL_POSITION, vec);
- }
- else {
- vec[3]= 1.0;
- glLightfv(GL_LIGHT0+count, GL_POSITION, vec);
- glLightf(GL_LIGHT0+count, GL_CONSTANT_ATTENUATION, 1.0);
- glLightf(GL_LIGHT0+count, GL_LINEAR_ATTENUATION, la->att1/la->dist);
- /* post 2.25 engine supports quad lights */
- glLightf(GL_LIGHT0+count, GL_QUADRATIC_ATTENUATION, la->att2/(la->dist*la->dist));
-
- if(la->type==LA_SPOT) {
- vec[0]= -base->object->obmat[2][0];
- vec[1]= -base->object->obmat[2][1];
- vec[2]= -base->object->obmat[2][2];
- glLightfv(GL_LIGHT0+count, GL_SPOT_DIRECTION, vec);
- glLightf(GL_LIGHT0+count, GL_SPOT_CUTOFF, la->spotsize/2.0);
- glLightf(GL_LIGHT0+count, GL_SPOT_EXPONENT, 128.0*la->spotblend);
- }
- else glLightf(GL_LIGHT0+count, GL_SPOT_CUTOFF, 180.0);
- }
-
- vec[0]= la->energy*la->r;
- vec[1]= la->energy*la->g;
- vec[2]= la->energy*la->b;
- vec[3]= 1.0;
- glLightfv(GL_LIGHT0+count, GL_DIFFUSE, vec);
- glLightfv(GL_LIGHT0+count, GL_SPECULAR, vec);//zero);
- glEnable(GL_LIGHT0+count);
-
- glPopMatrix();
-
- count++;
- if(count>7) break;
- }
- }
- }
- base= base->next;
- }
-
- return count;
-}
-
-static Material *give_current_material_or_def(Object *ob, int matnr)
-{
- extern Material defmaterial; // render module abuse...
- Material *ma= give_current_material(ob, matnr);
-
- return ma?ma:&defmaterial;
-}
-
-static int set_draw_settings_cached(int clearcache, int textured, MTFace *texface, int lit, Object *litob, int litmatnr, int doublesided)
-{
- static int c_textured;
- static int c_lit;
- static int c_doublesided;
- static MTFace *c_texface;
- static Object *c_litob;
- static int c_litmatnr;
- static int c_badtex;
-
- if (clearcache) {
- c_textured= c_lit= c_doublesided= -1;
- c_texface= (MTFace*) -1;
- c_litob= (Object*) -1;
- c_litmatnr= -1;
- c_badtex= 0;
- }
-
- if (texface) {
- lit = lit && (lit==-1 || texface->mode&TF_LIGHT);
- textured = textured && (texface->mode&TF_TEX);
- doublesided = texface->mode&TF_TWOSIDE;
- } else {
- textured = 0;
- }
-
- if (doublesided!=c_doublesided) {
- if (doublesided) glDisable(GL_CULL_FACE);
- else glEnable(GL_CULL_FACE);
-
- c_doublesided= doublesided;
- }
-
- if (textured!=c_textured || texface!=c_texface) {
- if (textured ) {
- c_badtex= !set_tpage(texface);
- } else {
- set_tpage(0);
- c_badtex= 0;
- }
- c_textured= textured;
- c_texface= texface;
- }
-
- if (c_badtex) lit= 0;
- if (lit!=c_lit || litob!=c_litob || litmatnr!=c_litmatnr) {
- if (lit) {
- Material *ma= give_current_material_or_def(litob, litmatnr+1);
- float spec[4];
-
- spec[0]= ma->spec*ma->specr;
- spec[1]= ma->spec*ma->specg;
- spec[2]= ma->spec*ma->specb;
- spec[3]= 1.0;
-
- glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, spec);
- glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
- glEnable(GL_LIGHTING);
- glEnable(GL_COLOR_MATERIAL);
- }
- else {
- glDisable(GL_LIGHTING);
- glDisable(GL_COLOR_MATERIAL);
- }
- c_lit= lit;
- c_litob= litob;
- c_litmatnr= litmatnr;
- }
-
- return c_badtex;
-}
-
-/* Icky globals, fix with userdata parameter */
-
-struct TextureDrawState {
- Object *ob;
- int islit, istex;
- unsigned char obcol[4];
-} Gtexdraw = {NULL, 0, 0, {0, 0, 0, 0}};
-
-static void draw_textured_begin(Object *ob)
-{
- unsigned char obcol[4];
- int istex, solidtex= 0;
-
- if(G.vd->drawtype==OB_SOLID || (ob==G.obedit && G.vd->drawtype!=OB_TEXTURE)) {
- /* draw with default lights in solid draw mode and edit mode */
- solidtex= 1;
- Gtexdraw.islit= -1;
- }
- else
- /* draw with lights in the scene otherwise */
- Gtexdraw.islit= set_gl_light(ob);
-
- obcol[0]= CLAMPIS(ob->col[0]*255, 0, 255);
- obcol[1]= CLAMPIS(ob->col[1]*255, 0, 255);
- obcol[2]= CLAMPIS(ob->col[2]*255, 0, 255);
- obcol[3]= CLAMPIS(ob->col[3]*255, 0, 255);
-
- glCullFace(GL_BACK); glEnable(GL_CULL_FACE);
- if(solidtex || G.vd->drawtype==OB_TEXTURE) istex= 1;
- else istex= 0;
-
- Gtexdraw.ob = ob;
- Gtexdraw.istex = istex;
- memcpy(Gtexdraw.obcol, obcol, sizeof(obcol));
- set_draw_settings_cached(1, 0, 0, Gtexdraw.islit, 0, 0, 0);
- glShadeModel(GL_SMOOTH);
-}
-
-static void draw_textured_end()
-{
- /* switch off textures */
- set_tpage(0);
-
- glShadeModel(GL_FLAT);
- glDisable(GL_CULL_FACE);
-
- /* XXX, bad patch - default_gl_light() calls
- * glLightfv(GL_LIGHT_POSITION, ...) which
- * is transformed by the current matrix... we
- * need to make sure that matrix is identity.
- *
- * It would be better if drawmesh.c kept track
- * of and restored the light settings it changed.
- * - zr
- */
- glPushMatrix();
- glLoadIdentity();
- default_gl_light();
- glPopMatrix();
-}
-
-
-static int draw_tface__set_draw(MTFace *tface, MCol *mcol, int matnr)
-{
- if (tface && (tface->mode&TF_INVISIBLE)) return 0;
-
- if (tface && set_draw_settings_cached(0, Gtexdraw.istex, tface, Gtexdraw.islit, Gtexdraw.ob, matnr, TF_TWOSIDE)) {
- glColor3ub(0xFF, 0x00, 0xFF);
- return 2; /* Don't set color */
- } else if (tface && tface->mode&TF_OBCOL) {
- glColor3ubv(Gtexdraw.obcol);
- return 2; /* Don't set color */
- } else if (!mcol) {
- if (tface) glColor3f(1.0, 1.0, 1.0);
- else {
- Material *ma= give_current_material(Gtexdraw.ob, matnr+1);
- if(ma) glColor3f(ma->r, ma->g, ma->b);
- else glColor3f(1.0, 1.0, 1.0);
- }
- return 2; /* Don't set color */
- } else {
- return 1; /* Set color from mcol */
- }
-}
-
-static int draw_tface_mapped__set_draw(void *userData, int index)
-{
- Mesh *me = (Mesh*)userData;
- MTFace *tface = (me->mtface)? &me->mtface[index]: NULL;
- MFace *mface = (me->mface)? &me->mface[index]: NULL;
- MCol *mcol = (me->mcol)? &me->mcol[index]: NULL;
- int matnr = me->mface[index].mat_nr;
- if (mface && mface->flag&ME_HIDE) return 0;
- return draw_tface__set_draw(tface, mcol, matnr);
-}
-
-static int draw_em_tf_mapped__set_draw(void *userData, int index)
-{
- EditMesh *em = userData;
- EditFace *efa = EM_get_face_for_index(index);
- MTFace *tface;
- MCol *mcol;
- int matnr;
-
- if (efa==NULL || efa->h)
- return 0;
-
- tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- mcol = CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
- matnr = efa->mat_nr;
-
- return draw_tface__set_draw(tface, mcol, matnr);
-}
-
-static int wpaint__setSolidDrawOptions(void *userData, int index, int *drawSmooth_r)
-{
- Mesh *me = (Mesh*)userData;
- MTFace *tface = (me->mtface)? &me->mtface[index]: NULL;
- MFace *mface = (me->mface)? &me->mface[index]: NULL;
-
- if ((mface->flag&ME_HIDE) || (tface && (tface->mode&TF_INVISIBLE)))
- return 0;
-
- *drawSmooth_r = 1;
- return 1;
-}
-
-static void draw_game_text_mesh(Object *ob, Mesh *me)
-{
- DerivedMesh *ddm = mesh_get_derived_deform(ob, CD_MASK_BAREMESH);
- MFace *mface= me->mface;
- MTFace *tface= me->mtface;
- MCol *mcol= me->mcol; /* why does mcol exist? */
- bProperty *prop = get_property(ob, "Text");
- int a, start= 0, totface= me->totface;
-
- tface+= start;
- mcol+= start*4;
- for (a=start; a<totface; a++, tface++, mcol+=4) {
- MFace *mf= &mface[a];
- int mode= tface->mode;
- int matnr= mf->mat_nr;
- int mf_smooth= mf->flag & ME_SMOOTH;
-
- if (!(mf->flag&ME_HIDE) && !(mode&TF_INVISIBLE) && (mode&TF_BMFONT)) {
- int badtex= set_draw_settings_cached(0, Gtexdraw.istex, tface, Gtexdraw.islit, Gtexdraw.ob, matnr, TF_TWOSIDE);
- float v1[3], v2[3], v3[3], v4[3];
- char string[MAX_PROPSTRING];
- int characters, index;
- ImBuf *ibuf;
- float curpos;
-
- if (badtex)
- continue;
-
- ddm->getVertCo(ddm, mf->v1, v1);
- ddm->getVertCo(ddm, mf->v2, v2);
- ddm->getVertCo(ddm, mf->v3, v3);
- if (mf->v4) ddm->getVertCo(ddm, mf->v4, v4);
-
- // The BM_FONT handling code is duplicated in the gameengine
- // Search for 'Frank van Beek' ;-)
- // string = "Frank van Beek";
-
- set_property_valstr(prop, string);
- characters = strlen(string);
-
- ibuf= BKE_image_get_ibuf(tface->tpage, NULL);
- if (ibuf == NULL) {
- characters = 0;
- }
-
- if (!mf_smooth) {
- float nor[3];
-
- CalcNormFloat(v1, v2, v3, nor);
-
- glNormal3fv(nor);
- }
-
- curpos= 0.0;
- glBegin(mf->v4?GL_QUADS:GL_TRIANGLES);
- for (index = 0; index < characters; index++) {
- float centerx, centery, sizex, sizey, transx, transy, movex, movey, advance;
- int character = string[index];
- char *cp= NULL;
-
- // lets calculate offset stuff
- // space starts at offset 1
- // character = character - ' ' + 1;
-
- matrixGlyph(ibuf, character, & centerx, &centery, &sizex, &sizey, &transx, &transy, &movex, &movey, &advance);
- movex+= curpos;
-
- if (tface->mode & TF_OBCOL)
- glColor3ubv(Gtexdraw.obcol);
- else if (me->mcol) cp= (char *)mcol;
- else glColor3ub(255, 255, 255);
-
- glTexCoord2f((tface->uv[0][0] - centerx) * sizex + transx, (tface->uv[0][1] - centery) * sizey + transy);
- if (cp) glColor3ub(cp[3], cp[2], cp[1]);
- glVertex3f(sizex * v1[0] + movex, sizey * v1[1] + movey, v1[2]);
-
- glTexCoord2f((tface->uv[1][0] - centerx) * sizex + transx, (tface->uv[1][1] - centery) * sizey + transy);
- if (cp) glColor3ub(cp[7], cp[6], cp[5]);
- glVertex3f(sizex * v2[0] + movex, sizey * v2[1] + movey, v2[2]);
-
- glTexCoord2f((tface->uv[2][0] - centerx) * sizex + transx, (tface->uv[2][1] - centery) * sizey + transy);
- if (cp) glColor3ub(cp[11], cp[10], cp[9]);
- glVertex3f(sizex * v3[0] + movex, sizey * v3[1] + movey, v3[2]);
-
- if(mf->v4) {
- glTexCoord2f((tface->uv[3][0] - centerx) * sizex + transx, (tface->uv[3][1] - centery) * sizey + transy);
- if (cp) glColor3ub(cp[15], cp[14], cp[13]);
- glVertex3f(sizex * v4[0] + movex, sizey * v4[1] + movey, v4[2]);
- }
-
- curpos+= advance;
- }
- glEnd();
- }
- }
-
- ddm->release(ddm);
-}
-
-void draw_mesh_textured(Object *ob, DerivedMesh *dm, int faceselect)
-{
- Mesh *me= ob->data;
- int editing= 0;
-
- /* correct for negative scale */
- if(ob->transflag & OB_NEG_SCALE) glFrontFace(GL_CW);
- else glFrontFace(GL_CCW);
-
- /* draw the textured mesh */
- draw_textured_begin(ob);
-
-#ifdef WITH_VERSE
- if(me->vnode) {
- /* verse-blender doesn't support uv mapping of textures yet */
- dm->drawFacesTex(dm, NULL);
- }
- else {
-#endif
- if(ob==G.obedit) {
- dm->drawMappedFacesTex(dm, draw_em_tf_mapped__set_draw, G.editMesh);
- } else if(faceselect) {
- if(G.f & G_WEIGHTPAINT)
- dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me, 1);
- else
- dm->drawMappedFacesTex(dm, draw_tface_mapped__set_draw, me);
- }
- else
- dm->drawFacesTex(dm, draw_tface__set_draw);
-#ifdef WITH_VERSE
- }
-#endif
-
- /* draw game engine text hack - but not if we are editing the mesh */
- if (me->mtface && get_property(ob, "Text")) {
- if(ob==G.obedit)
- editing= 1;
- else if(ob==OBACT)
- if(FACESEL_PAINT_TEST)
- editing= 1;
-
- if(!editing)
- draw_game_text_mesh(ob, me);
- }
-
- draw_textured_end();
-
- /* draw edges and selected faces over textured mesh */
- if(!G.obedit && faceselect)
- draw_tfaces3D(ob, me, dm);
-
- /* reset from negative scale correction */
- glFrontFace(GL_CCW);
-
- /* in editmode, the blend mode needs to be set incase it was ADD */
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-}
-
-void init_realtime_GL(void)
-{
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
-}
-
diff --git a/source/blender/src/drawnla.c b/source/blender/src/drawnla.c
deleted file mode 100644
index ea49c05b322..00000000000
--- a/source/blender/src/drawnla.c
+++ /dev/null
@@ -1,862 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef _WIN32
-#pragma warning (once : 4761)
-#endif
-
-#include "BMF_Api.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-#include "DNA_view3d_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_object_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_ipo_types.h"
-#include "DNA_action_types.h"
-#include "DNA_nla_types.h"
-#include "DNA_constraint_types.h"
-
-#include "BLI_blenlib.h"
-#include "MEM_guardedalloc.h"
-
-#include "BKE_action.h"
-#include "BKE_depsgraph.h"
-#include "BKE_global.h"
-
-#include "BSE_drawnla.h"
-#include "BSE_drawipo.h"
-#include "BSE_editnla_types.h"
-#include "BSE_headerbuttons.h"
-#include "BSE_time.h"
-
-#include "BIF_editnla.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-#include "BIF_interface.h"
-#include "BIF_interface_icons.h"
-#include "BIF_mywindow.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-
-#include "BDR_drawaction.h"
-#include "BDR_editcurve.h"
-
-#include "blendef.h"
-#include "butspace.h"
-#include "mydevice.h"
-
-#define TESTBASE_SAFE(base) ((base)->flag & SELECT && ((base)->object->restrictflag & OB_RESTRICT_VIEW)==0)
-
-
-/* the left hand side with channels only */
-static void draw_nla_channels(void)
-{
- bActionStrip *strip;
- Base *base;
- Object *ob;
- float x, y;
- short ofsx, ofsy = 0;
-
- myortho2(0, NLAWIDTH, G.v2d->cur.ymin, G.v2d->cur.ymax); // Scaling
-
- /* Clip to the scrollable area */
- if(curarea->winx>SCROLLB+10 && curarea->winy>SCROLLH+10) {
- if(G.v2d->scroll) {
- ofsx= curarea->winrct.xmin;
- ofsy= curarea->winrct.ymin;
- glViewport(ofsx, ofsy+G.v2d->mask.ymin, NLAWIDTH, ( ofsy+G.v2d->mask.ymax)-( ofsy+G.v2d->mask.ymin));
- glScissor(ofsx, ofsy+G.v2d->mask.ymin, NLAWIDTH, ( ofsy+G.v2d->mask.ymax)-( ofsy+G.v2d->mask.ymin));
- }
- }
-
- glColor3ub(0x00, 0x00, 0x00);
-
- x = 0.0;
- y = count_nla_levels();
- y*= (NLACHANNELHEIGHT+NLACHANNELSKIP);
-
- for (base=G.scene->base.first; base; base=base->next){
- if (nla_filter(base)) {
- ob= base->object;
-
- BIF_ThemeColorShade(TH_HEADER, 20);
- glRectf(x, y-NLACHANNELHEIGHT/2, (float)NLAWIDTH, y+NLACHANNELHEIGHT/2);
-
- /* Draw the name / ipo timeline*/
- if (TESTBASE_SAFE(base))
- BIF_ThemeColor(TH_TEXT_HI);
- else
- BIF_ThemeColor(TH_TEXT);
- glRasterPos2f(x+34, y-4);
- BMF_DrawString(G.font, ob->id.name+2);
-
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) ;
-
- /* icon to indicate expanded or collapsed */
- if ((ob->nlastrips.first) || (ob->action)) {
- if (ob->nlaflag & OB_NLA_COLLAPSED)
- BIF_icon_draw(x+1, y-8, ICON_TRIA_RIGHT);
- else
- BIF_icon_draw(x+1, y-8, ICON_TRIA_DOWN);
- }
-
- /* icon to indicate nla or action */
- if(ob->nlastrips.first && ob->action) {
- if(ob->nlaflag & OB_NLA_OVERRIDE)
- BIF_icon_draw(x+17, y-8, ICON_NLA);
- else
- BIF_icon_draw(x+17, y-8, ICON_ACTION);
- }
-
- /* icon to indicate if ipo-channel muted */
- if (ob->ipo) {
- if (ob->ipo->muteipo)
- BIF_icon_draw(NLAWIDTH-16, y-NLACHANNELHEIGHT/2, ICON_MUTE_IPO_ON);
- else
- BIF_icon_draw(NLAWIDTH-16, y-NLACHANNELHEIGHT/2, ICON_MUTE_IPO_OFF);
- }
-
- glDisable(GL_BLEND);
- y-=NLACHANNELHEIGHT+NLACHANNELSKIP;
-
- /* check if object's nla strips are collapsed or not */
- if ((ob->nlaflag & OB_NLA_COLLAPSED)==0) {
- /* Draw the action timeline */
- if (ob->action){
- BIF_ThemeColorShade(TH_HEADER, -20);
- glRectf(x+19, y-NLACHANNELHEIGHT/2, (float)NLAWIDTH, y+NLACHANNELHEIGHT/2);
-
- if (TESTBASE_SAFE(base))
- BIF_ThemeColor(TH_TEXT_HI);
- else
- BIF_ThemeColor(TH_TEXT);
- glRasterPos2f(x+38, y-4);
- BMF_DrawString(G.font, ob->action->id.name+2);
-
- /* icon for active action (no strip mapping) */
- for (strip = ob->nlastrips.first; strip; strip=strip->next)
- if(strip->flag & ACTSTRIP_ACTIVE) break;
- if(strip==NULL) {
- glEnable(GL_BLEND);
- BIF_icon_draw(x+5, y-8, ICON_DOT);
- glDisable(GL_BLEND);
- }
-
- y-=NLACHANNELHEIGHT+NLACHANNELSKIP;
- }
-
- /* Draw the nla strips */
- for (strip = ob->nlastrips.first; strip; strip=strip->next){
- BIF_ThemeColorShade(TH_HEADER, -40);
- glRectf(x+32, y-NLACHANNELHEIGHT/2, (float)NLAWIDTH, y+NLACHANNELHEIGHT/2);
-
- if (TESTBASE_SAFE(base))
- BIF_ThemeColor(TH_TEXT_HI);
- else
- BIF_ThemeColor(TH_TEXT);
-
- // why this test? check freeing mem when deleting strips? (ton)
- if(strip->act) {
- glRasterPos2f(x+48, y-4);
- BMF_DrawString(G.font, strip->act->id.name+2);
-
- glEnable(GL_BLEND);
-
- if(strip->flag & ACTSTRIP_ACTIVE)
- BIF_icon_draw(x+16, y-8, ICON_DOT);
-
- if(strip->modifiers.first)
- BIF_icon_draw(x+34, y-8, ICON_MODIFIER);
-
- if(strip->flag & ACTSTRIP_MUTE)
- BIF_icon_draw(NLAWIDTH-16, y-NLACHANNELHEIGHT/2, ICON_MUTE_IPO_ON);
- else
- BIF_icon_draw(NLAWIDTH-16, y-NLACHANNELHEIGHT/2, ICON_MUTE_IPO_OFF);
-
- glDisable(GL_BLEND);
- }
-
- y-=(NLACHANNELHEIGHT+NLACHANNELSKIP);
- }
- }
- }
- }
-
- myortho2(0, NLAWIDTH, 0, ( ofsy+G.v2d->mask.ymax)-( ofsy+G.v2d->mask.ymin)); // Scaling
-}
-
-void map_active_strip(gla2DDrawInfo *di, Object *ob, int restore)
-{
- static rctf stored;
-
- if(restore)
- gla2DSetMap(di, &stored);
- else {
- rctf map;
-
- gla2DGetMap(di, &stored);
- map= stored;
- map.xmin= get_action_frame(ob, map.xmin);
- map.xmax= get_action_frame(ob, map.xmax);
- if(map.xmin==map.xmax) map.xmax+= 1.0;
- gla2DSetMap(di, &map);
- }
-}
-
-/* the right hand side, with strips and keys */
-static void draw_nla_strips_keys(SpaceNla *snla)
-{
- Base *base;
- rcti scr_rct;
- gla2DDrawInfo *di;
- float y;
- char col1[3], col2[3];
-
- BIF_GetThemeColor3ubv(TH_SHADE2, col2);
- BIF_GetThemeColor3ubv(TH_HILITE, col1);
-
- /* Draw strips */
-
- scr_rct.xmin= snla->area->winrct.xmin + snla->v2d.mask.xmin;
- scr_rct.ymin= snla->area->winrct.ymin + snla->v2d.mask.ymin;
- scr_rct.xmax= snla->area->winrct.xmin + snla->v2d.hor.xmax;
- scr_rct.ymax= snla->area->winrct.ymin + snla->v2d.mask.ymax;
- di= glaBegin2DDraw(&scr_rct, &G.v2d->cur);
-
- y=count_nla_levels();
- y*= (NLACHANNELHEIGHT+NLACHANNELSKIP);
-
- for (base=G.scene->base.first; base; base=base->next){
- Object *ob= base->object;
- bActionStrip *strip;
- int frame1_x, channel_y;
-
- if (nla_filter(base)==0)
- continue;
-
- /* Draw the field */
- glEnable (GL_BLEND);
- if (TESTBASE_SAFE(base))
- glColor4ub (col1[0], col1[1], col1[2], 0x22);
- else
- glColor4ub (col2[0], col2[1], col2[2], 0x22);
-
- gla2DDrawTranslatePt(di, 1, y, &frame1_x, &channel_y);
- glRectf(0, channel_y-NLACHANNELHEIGHT/2, frame1_x, channel_y+NLACHANNELHEIGHT/2);
-
-
- if (TESTBASE_SAFE(base))
- glColor4ub (col1[0], col1[1], col1[2], 0x44);
- else
- glColor4ub (col2[0], col2[1], col2[2], 0x44);
- glRectf(frame1_x, channel_y-NLACHANNELHEIGHT/2, G.v2d->hor.xmax, channel_y+NLACHANNELHEIGHT/2);
-
- glDisable (GL_BLEND);
-
- /* Draw the ipo keys */
- draw_object_channel(di, ob, y);
-
- y-=NLACHANNELHEIGHT+NLACHANNELSKIP;
-
- /* check if object nla-strips expanded or not */
- if (ob->nlaflag & OB_NLA_COLLAPSED)
- continue;
-
-
- /* Draw the action strip */
- if (ob->action) {
-
- /* Draw the field */
- glEnable (GL_BLEND);
- if (TESTBASE_SAFE(base))
- glColor4ub (col1[0], col1[1], col1[2], 0x22);
- else
- glColor4ub (col2[0], col2[1], col2[2], 0x22);
-
- gla2DDrawTranslatePt(di, 1, y, &frame1_x, &channel_y);
- glRectf(0, channel_y-NLACHANNELHEIGHT/2+4, frame1_x, channel_y+NLACHANNELHEIGHT/2-4);
-
- if (TESTBASE_SAFE(base))
- glColor4ub (col1[0], col1[1], col1[2], 0x44);
- else
- glColor4ub (col2[0], col2[1], col2[2], 0x44);
- glRectf(frame1_x, channel_y-NLACHANNELHEIGHT/2+4, G.v2d->hor.xmax, channel_y+NLACHANNELHEIGHT/2-4);
-
- glDisable (GL_BLEND);
-
- /* Draw the action keys, optionally corrected for active strip */
- map_active_strip(di, ob, 0);
- draw_action_channel(di, ob->action, y);
- map_active_strip(di, ob, 1);
-
- y-=NLACHANNELHEIGHT+NLACHANNELSKIP;
-
- }
-
- /* Draw the nla strips */
- for (strip=ob->nlastrips.first; strip; strip=strip->next){
- int stripstart, stripend;
- int blendstart, blendend;
-
- /* Draw rect */
- if (strip->flag & ACTSTRIP_SELECT)
- BIF_ThemeColor(TH_STRIP_SELECT);
- else
- BIF_ThemeColor(TH_STRIP);
-
- gla2DDrawTranslatePt(di, strip->start+strip->blendin, y, &stripstart, &channel_y);
- gla2DDrawTranslatePt(di, strip->end-strip->blendout, y, &stripend, &channel_y);
- glRectf(stripstart, channel_y-NLACHANNELHEIGHT/2+3, stripend, channel_y+NLACHANNELHEIGHT/2-3);
-
- if (strip->flag & ACTSTRIP_SELECT)
- BIF_ThemeColorShade(TH_STRIP_SELECT, -60);
- else
- BIF_ThemeColorShade(TH_STRIP, -60);
-
- /* Draw blendin */
- if (strip->blendin>0){
- glBegin(GL_TRIANGLES);
-
- gla2DDrawTranslatePt(di, strip->start, y, &blendstart, &channel_y);
-
- glVertex2f(blendstart, channel_y-NLACHANNELHEIGHT/2+3);
- glVertex2f(stripstart, channel_y+NLACHANNELHEIGHT/2-3);
- glVertex2f(stripstart, channel_y-NLACHANNELHEIGHT/2+3);
-
-
- glEnd();
- }
- if (strip->blendout>0){
- glBegin(GL_TRIANGLES);
-
- gla2DDrawTranslatePt(di, strip->end, y, &blendend, &channel_y);
-
- glVertex2f(blendend, channel_y-NLACHANNELHEIGHT/2+3);
- glVertex2f(stripend, channel_y+NLACHANNELHEIGHT/2-3);
- glVertex2f(stripend, channel_y-NLACHANNELHEIGHT/2+3);
- glEnd();
- }
-
- gla2DDrawTranslatePt(di, strip->start, y, &stripstart, &channel_y);
- gla2DDrawTranslatePt(di, strip->end, y, &stripend, &channel_y);
-
- /* muted strip */
- if(strip->flag & ACTSTRIP_MUTE) {
- glColor3f(1, 0, 0);
- glBegin(GL_LINES);
- glVertex2f(stripstart, channel_y-NLACHANNELHEIGHT/2+3);
- glVertex2f(stripend, channel_y+NLACHANNELHEIGHT/2-3);
- glEnd();
- }
-
- /* Draw border */
- glEnable (GL_BLEND);
- glBegin(GL_LINE_STRIP);
- glColor4f(1, 1, 1, 0.7);
-
- glVertex2f(stripstart, channel_y-NLACHANNELHEIGHT/2+3);
- glVertex2f(stripstart, channel_y+NLACHANNELHEIGHT/2-3);
- glVertex2f(stripend, channel_y+NLACHANNELHEIGHT/2-3);
- glColor4f(0, 0, 0, 0.7);
- glVertex2f(stripend, channel_y-NLACHANNELHEIGHT/2+3);
- glVertex2f(stripstart, channel_y-NLACHANNELHEIGHT/2+3);
- glEnd();
-
- /* Show strip extension */
- if (strip->flag & ACTSTRIP_HOLDLASTFRAME){
- if (strip->flag & ACTSTRIP_SELECT)
- BIF_ThemeColorShadeAlpha(TH_STRIP_SELECT, 0, -180);
- else
- BIF_ThemeColorShadeAlpha(TH_STRIP, 0, -180);
-
- glRectf(stripend, channel_y-NLACHANNELHEIGHT/2+4, G.v2d->hor.xmax, channel_y+NLACHANNELHEIGHT/2-2);
- }
-
- /* Show repeat */
- if (strip->repeat > 1.0 && !(strip->flag & ACTSTRIP_USESTRIDE)){
- float rep = 1;
- glBegin(GL_LINES);
- while (rep<strip->repeat){
- /* Draw line */
- glColor4f(0, 0, 0, 0.5);
- gla2DDrawTranslatePt(di, strip->start+(rep*((strip->end-strip->start)/strip->repeat)), y, &frame1_x, &channel_y);
- glVertex2f(frame1_x, channel_y-NLACHANNELHEIGHT/2+4);
- glVertex2f(frame1_x, channel_y+NLACHANNELHEIGHT/2-2);
-
- glColor4f(1.0, 1.0, 1.0, 0.5);
- gla2DDrawTranslatePt(di, strip->start+(rep*((strip->end-strip->start)/strip->repeat)), y, &frame1_x, &channel_y);
- glVertex2f(frame1_x+1, channel_y-NLACHANNELHEIGHT/2+4);
- glVertex2f(frame1_x+1, channel_y+NLACHANNELHEIGHT/2-2);
- rep+=1.0;
- }
- glEnd();
-
- }
- glDisable (GL_BLEND);
-
- y-=(NLACHANNELHEIGHT+NLACHANNELSKIP);
- }
- }
- glaEnd2DDraw(di);
-
-}
-
-/* ******* panel *********** */
-
-#define B_NLA_PANEL 121
-#define B_NLA_LOCK 122
-#define B_NLA_SCALE 123
-#define B_NLA_SCALE2 124
-#define B_NLA_MOD_ADD 125
-#define B_NLA_MOD_NEXT 126
-#define B_NLA_MOD_PREV 127
-#define B_NLA_MOD_DEL 128
-#define B_NLA_MOD_DEPS 129
-
-/* For now just returns the first selected strip */
-bActionStrip *get_active_nlastrip(Object **obpp)
-{
- Base *base;
- bActionStrip *strip;
-
- for (base=G.scene->base.first; base; base=base->next){
- if ((base->object->nlaflag & OB_NLA_COLLAPSED)==0) {
- for (strip=base->object->nlastrips.first; strip; strip=strip->next){
- if (strip->flag & ACTSTRIP_SELECT) {
- *obpp= base->object;
- return strip;
- }
- }
- }
- }
-
- return NULL;
-}
-
-void do_nlabuts(unsigned short event)
-{
- Object *ob;
- bActionStrip *strip;
-
- /* Determine if an nla strip has been selected */
- strip = get_active_nlastrip(&ob);
- if (!strip) return;
-
- switch(event) {
- case B_REDR:
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWNLA, 0);
- break;
- case B_NLA_PANEL:
- DAG_object_flush_update(G.scene, ob, OB_RECALC_OB|OB_RECALC_DATA);
- allqueue (REDRAWNLA, 0);
- allqueue (REDRAWVIEW3D, 0);
- break;
- case B_NLA_SCALE:
- {
- float actlen= strip->actend - strip->actstart;
- float mapping= strip->scale * strip->repeat;
-
- strip->end = (actlen * mapping) + strip->start;
-
- allqueue (REDRAWNLA, 0);
- allqueue (REDRAWIPO, 0);
- allqueue (REDRAWACTION, 0);
- allqueue (REDRAWVIEW3D, 0);
- }
- break;
- case B_NLA_SCALE2:
- {
- float actlen= strip->actend - strip->actstart;
- float len= strip->end - strip->start;
-
- strip->scale= len / (actlen * strip->repeat);
-
- allqueue (REDRAWNLA, 0);
- allqueue (REDRAWIPO, 0);
- allqueue (REDRAWACTION, 0);
- allqueue (REDRAWVIEW3D, 0);
- }
- break;
- case B_NLA_LOCK:
- synchronize_action_strips();
-
- allqueue (REDRAWNLA, 0);
- allqueue (REDRAWIPO, 0);
- allqueue (REDRAWACTION, 0);
- allqueue (REDRAWVIEW3D, 0);
- break;
-
- case B_NLA_MOD_ADD:
- {
- bActionModifier *amod= MEM_callocN(sizeof(bActionModifier), "bActionModifier");
-
- BLI_addtail(&strip->modifiers, amod);
- strip->curmod= BLI_countlist(&strip->modifiers)-1;
- allqueue (REDRAWNLA, 0);
- }
- break;
- case B_NLA_MOD_DEL:
- if(strip->modifiers.first) {
- bActionModifier *amod= BLI_findlink(&strip->modifiers, strip->curmod);
- BLI_remlink(&strip->modifiers, amod);
- MEM_freeN(amod);
- if(strip->curmod) strip->curmod--;
- allqueue (REDRAWNLA, 0);
- }
- break;
- case B_NLA_MOD_NEXT:
- if(strip->curmod < BLI_countlist(&strip->modifiers)-1)
- strip->curmod++;
- allqueue (REDRAWNLA, 0);
- break;
- case B_NLA_MOD_PREV:
- if(strip->curmod > 0)
- strip->curmod--;
- allqueue (REDRAWNLA, 0);
- break;
- case B_NLA_MOD_DEPS:
- DAG_scene_sort(G.scene);
- DAG_object_flush_update(G.scene, ob, OB_RECALC_OB|OB_RECALC_DATA);
- break;
- }
-}
-
-static char *make_modifier_menu(ListBase *lb)
-{
- bActionModifier *amod;
- int index= 1;
- char *str, item[64], *types[3]={"Deform", "Noise", "Oomph"};
-
- for (amod = lb->first; amod; amod=amod->next, index++);
- str= MEM_mallocN(index*64, "key string");
- str[0]= 0;
-
- index= 0;
- for (amod = lb->first; amod; amod=amod->next, index++) {
- sprintf (item, "|%s %s%%x%d", types[amod->type], amod->channel, index);
- strcat(str, item);
- }
-
- return str;
-}
-
-
-static void nla_panel_properties(short cntrl) // NLA_HANDLER_PROPERTIES
-{
- Object *ob;
- bActionStrip *strip;
- uiBlock *block;
- uiBut *but;
-
- block= uiNewBlock(&curarea->uiblocks, "nla_panel_properties", UI_EMBOSS, UI_HELV, curarea->win);
- uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | cntrl);
- uiSetPanelHandler(NLA_HANDLER_PROPERTIES); // for close and esc
- if(uiNewPanel(curarea, block, "Transform Properties", "NLA", 10, 230, 318, 224)==0) return;
-
- /* Determine if an nla strip has been selected */
- strip = get_active_nlastrip(&ob);
- if (!strip) return;
-
- /* first labels, for simpler align code :) */
- uiDefBut(block, LABEL, 0, "Timeline Range:", 10,180,300,19, 0, 0, 0, 0, 0, "");
- uiDefBut(block, LABEL, 0, "Blending:", 10,120,150,19, 0, 0, 0, 0, 0, "");
- uiDefBut(block, LABEL, 0, "Options:", 160,120,150,19, 0, 0, 0, 0, 0, "");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_NLA_PANEL, "Strip Start:", 10,160,150,19, &strip->start, -1000.0, strip->end-1, 100, 0, "First frame in the timeline");
- uiDefButF(block, NUM, B_NLA_SCALE2, "Strip End:", 160,160,150,19, &strip->end, strip->start+1, MAXFRAMEF, 100, 0, "Last frame in the timeline");
-
- uiDefIconButBitS(block, ICONTOG, ACTSTRIP_LOCK_ACTION, B_NLA_LOCK, ICON_UNLOCKED, 10,140,20,19, &(strip->flag), 0, 0, 0, 0, "Toggles Action end/start to be automatic mapped to strip duration");
- if(strip->flag & ACTSTRIP_LOCK_ACTION) {
- char str[40];
- sprintf(str, "Action Start: %.2f", strip->actstart);
- uiDefBut(block, LABEL, B_NOP, str, 30,140,140,19, NULL, 0.0, 0.0, 0, 0, "First frame of the action to map to the playrange");
- sprintf(str, "Action End: %.2f", strip->actend);
- uiDefBut(block, LABEL, B_NOP, str, 170,140,140,19, NULL, 0.0, 0.0, 0, 0, "Last frame of the action to map to the playrange");
- }
- else {
- uiDefButF(block, NUM, B_NLA_PANEL, "Action Start:", 30,140,140,19, &strip->actstart, -1000.0, strip->actend-1, 100, 0, "First frame of the action to map to the playrange");
- uiDefButF(block, NUM, B_NLA_PANEL, "Action End:", 170,140,140,19, &strip->actend, strip->actstart+1, MAXFRAMEF, 100, 0, "Last frame of the action to map to the playrange");
- }
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, ACTSTRIP_AUTO_BLENDS, B_NLA_LOCK, "Auto-Blending", 10,100,145,19, &(strip->flag), 0, 0, 0, 0, "Toggles automatic calculation of blendin/out values");
- if (strip->flag & ACTSTRIP_AUTO_BLENDS) {
- char str[32];
- sprintf(str, "In: %.2f", strip->blendin);
- uiDefBut(block, LABEL, B_NOP, str, 10,80,77,19, NULL, 0.0, 0.0, 0, 0, "Number of frames of ease-in");
- sprintf(str, "Out: %.2f", strip->blendout);
- uiDefBut(block, LABEL, B_NOP, str, 77,80,78,19, NULL, 0.0, 0.0, 0, 0, "Number of frames of ease-out");
- }
- else {
- uiDefButF(block, NUM, B_NLA_PANEL, "In:", 10,80,77,19, &strip->blendin, 0.0, strip->end-strip->start, 100, 0, "Number of frames of ease-in");
- uiDefButF(block, NUM, B_NLA_PANEL, "Out:", 77,80,78,19, &strip->blendout, 0.0, strip->end-strip->start, 100, 0, "Number of frames of ease-out");
- }
- uiDefButBitS(block, TOG, ACTSTRIP_MUTE, B_NLA_PANEL, "Mute", 10,60,145,19, &strip->flag, 0, 0, 0, 0, "Toggles whether the strip contributes to the NLA solution");
-
- uiBlockBeginAlign(block);
- // FIXME: repeat and scale are too cramped!
- uiDefButF(block, NUM, B_NLA_SCALE, "Repeat:", 160,100,75,19, &strip->repeat, 0.001, 1000.0f, 100, 0, "Number of times the action should repeat");
- if ((strip->actend - strip->actstart) < 1.0f) {
- uiBlockSetCol(block, TH_REDALERT);
- uiDefButF(block, NUM, B_NLA_SCALE, "Scale:", 235,100,75,19, &strip->scale, 0.001, 1000.0f, 100, 0, "Please run Alt-S to fix up this error");
- uiBlockSetCol(block, TH_AUTO);
- }
- else
- uiDefButF(block, NUM, B_NLA_SCALE, "Scale:", 235,100,75,19, &strip->scale, 0.001, 1000.0f, 100, 0, "Amount the action should be scaled by");
- but= uiDefButC(block, TEX, B_NLA_PANEL, "OffsBone:", 160,80,150,19, strip->offs_bone, 0, 31.0f, 0, 0, "Name of Bone that defines offset for repeat");
- uiButSetCompleteFunc(but, autocomplete_bone, (void *)ob);
- uiDefButBitS(block, TOG, ACTSTRIP_HOLDLASTFRAME, B_NLA_PANEL, "Hold", 160,60,75,19, &strip->flag, 0, 0, 0, 0, "Toggles whether to continue displaying the last frame past the end of the strip");
- uiDefButS(block, TOG, B_NLA_PANEL, "Add", 235,60,75,19, &strip->mode, 0, 0, 0, 0, "Toggles additive blending mode");
-
- uiBlockEndAlign(block);
-
- uiDefButBitS(block, TOG, ACTSTRIP_USESTRIDE, B_NLA_PANEL, "Stride Path", 10, 30,140,19, &strip->flag, 0, 0, 0, 0, "Plays action based on path position & stride");
-
- if (strip->offs_bone[0]) {
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, ACTSTRIP_CYCLIC_USEX, B_NLA_PANEL, "Use X", 160,30,50,19, &strip->flag, 0, 0, 0, 0, "Turn off automatic single-axis cycling and use X as an offset axis. Note that you can use multiple axes at once.");
- uiDefButBitS(block, TOG, ACTSTRIP_CYCLIC_USEY, B_NLA_PANEL, "Use Y", 210,30,50,19, &strip->flag, 0, 0, 0, 0, "Turn off automatic single-axis cycling and use Y as an offset axis. Note that you can use multiple axes at once.");
- uiDefButBitS(block, TOG, ACTSTRIP_CYCLIC_USEZ, B_NLA_PANEL, "Use Z", 260,30,50,19, &strip->flag, 0, 0, 0, 0, "Turn off automatic single-axis cycling and use Z as an offset axis. Note that you can use multiple axes at once.");
- uiBlockEndAlign(block);
- }
-
- if(ob->dup_group)
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_NLA_PANEL, "Target:", 160,30, 150, 19, &strip->object, "Target Object in this group");
-
- if(strip->flag & ACTSTRIP_USESTRIDE) {
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, OB_DISABLE_PATH, B_NLA_PANEL, "Disable", 10,0,60,19, &ob->ipoflag, 0, 0, 0, 0, "Disable path temporally, for editing cycles");
-
- uiDefButF(block, NUM, B_NLA_PANEL, "Offs:", 70,0,120,19, &strip->actoffs, -500, 500.0, 100, 0, "Action offset in frames to tweak cycle of the action within the stride");
- uiDefButF(block, NUM, B_NLA_PANEL, "Stri:", 190,0,120,19, &strip->stridelen, 0.0001, 1000.0, 100, 0, "Distance covered by one complete cycle of the action specified in the Action Range");
-
- uiDefButS(block, ROW, B_NLA_PANEL, "X", 10, -20, 33, 19, &strip->stride_axis, 1, 0, 0, 0, "Dominant axis for Stride Bone");
- uiDefButS(block, ROW, B_NLA_PANEL, "Y", 43, -20, 33, 19, &strip->stride_axis, 1, 1, 0, 0, "Dominant axis for Stride Bone");
- uiDefButS(block, ROW, B_NLA_PANEL, "Z", 76, -20, 34, 19, &strip->stride_axis, 1, 2, 0, 0, "Dominant axis for Stride Bone");
-
- but= uiDefBut(block, TEX, B_NLA_PANEL, "Stride Bone:", 110, -20, 200, 19, strip->stridechannel, 1, 31, 0, 0, "Name of Bone used for stride");
- uiButSetCompleteFunc(but, autocomplete_bone, (void *)ob);
- }
- else { /* modifiers */
- bActionModifier *amod= BLI_findlink(&strip->modifiers, strip->curmod);
-
- uiBlockBeginAlign(block);
- uiDefBut(block, BUT, B_NLA_MOD_ADD, "Add Modifier", 10,0,140,19, NULL, 0, 0, 0, 0, "");
- if(amod) {
- char *strp= make_modifier_menu(&strip->modifiers);
-
- uiDefIconBut(block, BUT, B_NLA_MOD_NEXT, ICON_TRIA_LEFT, 150,0,20,19, NULL, 0, 0, 0, 0, "Previous Modifier");
- uiDefButS(block, MENU, B_NLA_PANEL, strp, 170,0,20,19, &strip->curmod, 0, 0, 0, 0, "Browse modifier");
- MEM_freeN(strp);
- uiDefIconBut(block, BUT, B_NLA_MOD_PREV, ICON_TRIA_RIGHT, 190,0,20,19, NULL, 0, 0, 0, 0, "Next Modifier");
- uiDefButS(block, MENU, B_REDR, "Deform %x0|Noise %x1|Oomph %x2", 210,0,80,19, &amod->type, 0, 0, 0, 0, "Modifier type");
- uiDefIconBut(block, BUT, B_NLA_MOD_DEL, ICON_X, 290,0,20,19, NULL, 0, 0, 0, 0, "Delete Modifier");
-
- if(amod->type==ACTSTRIP_MOD_DEFORM) {
- but= uiDefBut(block, TEX, B_NLA_PANEL, "Chan:", 10, -20, 130, 19, amod->channel, 1, 31, 0, 0, "Name of channel used for modifier");
- uiButSetCompleteFunc(but, autocomplete_bone, (void *)ob);
- uiDefButS(block, MENU, B_REDR, "All%x0|XY%x3|XZ%x2|YZ%x1", 140,-20,40,19, &amod->no_rot_axis, 0, 0, 0, 0, "Enable rotation axes (local for curve)");
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_NLA_MOD_DEPS, "Ob:", 180,-20, 130, 19, &amod->ob, "Curve Object");
- }
-#if 0 /* this is not really ready for the primetime yet, but is here for testing */
- else if(amod->type==ACTSTRIP_MOD_NOISE) {
- but= uiDefBut(block, TEX, B_NLA_PANEL, "Chan:", 10, -20, 130, 19, amod->channel, 1, 31, 0, 0, "Name of channel used for modifier");
- uiButSetCompleteFunc(but, autocomplete_bone, (void *)ob);
- uiDefButBitS(block, TOG, 1, B_NLA_PANEL, "L", 140, -20, 20, 19, &amod->channels, 0, 24, 0, 0, "Apply noise to Location of channel");
- uiDefButBitS(block, TOG, 2, B_NLA_PANEL, "R", 160, -20, 20, 19, &amod->channels, 0, 24, 0, 0, "Apply noise to Rotation of channel");
- uiDefButBitS(block, TOG, 4, B_NLA_PANEL, "S", 180, -20, 20, 19, &amod->channels, 0, 24, 0, 0, "Apply noise to Scaling of channel");
- uiDefButF(block, NUM, B_NLA_PANEL, "NSize:", 200,-20,55,19, &amod->noisesize, 0.0001, 2.0, 10, 0, "Sets scaling for noise input");
- uiDefButF(block, NUM, B_NLA_PANEL, "Turb:", 255,-20,55,19, &amod->turbul, 0.0, 200.0, 10, 0, "Sets the depth of the noise");
- }
-#endif
- else
- uiDefBut(block, LABEL, B_NOP, "Ack! Not implemented.", 10, -20, 150, 19, NULL, 0, 0, 0, 0, "");
-
- }
- else { /* for panel aligning */
- uiBlockEndAlign(block);
- uiDefBut(block, LABEL, B_NOP, " ", 10, -20, 150, 19, NULL, 0, 0, 0, 0, "");
- }
- }
-}
-
-static void nla_blockhandlers(ScrArea *sa)
-{
- SpaceNla *snla= sa->spacedata.first;
- short a;
-
- for(a=0; a<SPACE_MAXHANDLER; a+=2) {
- switch(snla->blockhandler[a]) {
-
- case NLA_HANDLER_PROPERTIES:
- nla_panel_properties(snla->blockhandler[a+1]);
- break;
-
- }
- /* clear action value for event */
- snla->blockhandler[a+1]= 0;
- }
- uiDrawBlocksPanels(sa, 0);
-}
-
-
-void drawnlaspace(ScrArea *sa, void *spacedata)
-{
- float col[3];
- short ofsx = 0, ofsy = 0;
-
- uiFreeBlocksWin(&sa->uiblocks, sa->win); /* for panel handler to work */
-
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) ;
-
- calc_scrollrcts(sa, G.v2d, curarea->winx, curarea->winy);
-
- /* clear all, becomes the color for left part */
- BIF_GetThemeColor3fv(TH_HEADER, col);
- glClearColor(col[0], col[1], col[2], 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- if(curarea->winx>SCROLLB+10 && curarea->winy>SCROLLH+10) {
- if(G.v2d->scroll) {
- ofsx= curarea->winrct.xmin;
- ofsy= curarea->winrct.ymin;
- glViewport(ofsx+G.v2d->mask.xmin, ofsy+G.v2d->mask.ymin, ( ofsx+G.v2d->mask.xmax-1)-(ofsx+G.v2d->mask.xmin)+1, ( ofsy+G.v2d->mask.ymax-1)-( ofsy+G.v2d->mask.ymin)+1);
- glScissor(ofsx+G.v2d->mask.xmin, ofsy+G.v2d->mask.ymin, ( ofsx+G.v2d->mask.xmax-1)-(ofsx+G.v2d->mask.xmin)+1, ( ofsy+G.v2d->mask.ymax-1)-( ofsy+G.v2d->mask.ymin)+1);
- }
- }
-
- BIF_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax);
- bwin_clear_viewmat(sa->win); /* clear buttons view */
- glLoadIdentity();
-
- /* Draw backdrop */
- calc_ipogrid();
- draw_ipogrid();
-
- /* the right hand side, with strips and keys */
- draw_nla_strips_keys(G.snla);
-
-
- glViewport(ofsx+G.v2d->mask.xmin, ofsy+G.v2d->mask.ymin, ( ofsx+G.v2d->mask.xmax-1)-(ofsx+G.v2d->mask.xmin)+1, ( ofsy+G.v2d->mask.ymax-1)-( ofsy+G.v2d->mask.ymin)+1);
- glScissor(ofsx+G.v2d->mask.xmin, ofsy+G.v2d->mask.ymin, ( ofsx+G.v2d->mask.xmax-1)-(ofsx+G.v2d->mask.xmin)+1, ( ofsy+G.v2d->mask.ymax-1)-( ofsy+G.v2d->mask.ymin)+1);
- myortho2 (G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax);
-
- /* Draw current frame */
- draw_cfra_action();
-
- /* draw markers */
- draw_markers_timespace(0);
-
- /* Draw preview 'curtains' */
- draw_anim_preview_timespace();
-
- /* Draw scroll */
- mywinset(curarea->win); // reset scissor too
- if(curarea->winx>SCROLLB+10 && curarea->winy>SCROLLH+10) {
- myortho2(-0.375, curarea->winx-0.375, -0.375, curarea->winy-0.375);
- if(G.v2d->scroll) drawscroll(0);
- }
- if(G.v2d->mask.xmin!=0) {
- /* Draw channel names */
- draw_nla_channels();
- }
- mywinset(curarea->win); // reset scissor too
- myortho2(-0.375, sa->winx-0.375, -0.375, sa->winy-0.375);
- draw_area_emboss(sa);
-
- /* it is important to end a view in a transform compatible with buttons */
- bwin_scalematrix(sa->win, G.snla->blockscale, G.snla->blockscale, G.snla->blockscale);
- nla_blockhandlers(sa);
-
- curarea->win_swap= WIN_BACK_OK;
-}
-
-int count_nla_levels(void)
-{
- Base *base;
- int y= 0;
-
- for (base=G.scene->base.first; base; base=base->next) {
- if (nla_filter(base)) {
- /* object level */
- y++;
-
- /* nla strips for object collapsed? */
- if ((base->object->nlaflag & OB_NLA_COLLAPSED)==0) {
- if(base->object->action)
- y++;
-
- /* Nla strips */
- y+= BLI_countlist(&base->object->nlastrips);
- }
- }
- }
-
- return y;
-}
-
-int nla_filter (Base *base)
-{
- Object *ob = base->object;
-
- if ((G.snla->flag & SNLA_ALLKEYED) || (base->lay & G.scene->lay)) {
- if(ob->action || ob->nlastrips.first)
- return 1;
-
- /* should become option */
- if (ob->ipo)
- return 1;
-
- if (ob->constraintChannels.first)
- return 1;
- }
- return 0;
-}
-
diff --git a/source/blender/src/drawnode.c b/source/blender/src/drawnode.c
deleted file mode 100644
index b0c55d104f3..00000000000
--- a/source/blender/src/drawnode.c
+++ /dev/null
@@ -1,2886 +0,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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2005 Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "DNA_action_types.h"
-#include "DNA_color_types.h"
-#include "DNA_customdata_types.h"
-#include "DNA_ipo_types.h"
-#include "DNA_ID.h"
-#include "DNA_image_types.h"
-#include "DNA_material_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_node_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_space_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_userdef_types.h"
-
-#include "BKE_global.h"
-#include "BKE_image.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
-#include "BKE_material.h"
-#include "BKE_node.h"
-#include "BKE_object.h"
-#include "BKE_texture.h"
-#include "BKE_utildefines.h"
-
-#include "CMP_node.h"
-#include "SHD_node.h"
-
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-#include "BIF_interface.h"
-#include "BIF_interface_icons.h"
-#include "BIF_language.h"
-#include "BIF_mywindow.h"
-#include "BIF_previewrender.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-
-#include "BSE_drawipo.h"
-#include "BSE_node.h"
-#include "BSE_view.h"
-
-#include "BMF_Api.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "RE_pipeline.h"
-#include "IMB_imbuf_types.h"
-
-#include "blendef.h"
-#include "butspace.h"
-#include "interface.h" /* urm... for rasterpos_safe, roundbox */
-#include "mydevice.h"
-
-extern void autocomplete_uv(char *str, void *arg_v);
-extern int verify_valid_uv_name(char *str);
-
-/* autocomplete callback for buttons */
-static void autocomplete_vcol(char *str, void *arg_v)
-{
- Mesh *me;
- CustomDataLayer *layer;
- AutoComplete *autocpl;
- int a;
-
- if(str[0]==0)
- return;
-
- autocpl= autocomplete_begin(str, 32);
-
- /* search if str matches the beginning of name */
- for(me= G.main->mesh.first; me; me=me->id.next)
- for(a=0, layer= me->fdata.layers; a<me->fdata.totlayer; a++, layer++)
- if(layer->type == CD_MCOL)
- autocomplete_do_name(autocpl, layer->name);
-
- autocomplete_end(autocpl, str);
-}
-
-static int verify_valid_vcol_name(char *str)
-{
- Mesh *me;
- CustomDataLayer *layer;
- int a;
-
- if(str[0]==0)
- return 1;
-
- /* search if str matches the name */
- for(me= G.main->mesh.first; me; me=me->id.next)
- for(a=0, layer= me->fdata.layers; a<me->fdata.totlayer; a++, layer++)
- if(layer->type == CD_MCOL)
- if(strcmp(layer->name, str)==0)
- return 1;
-
- return 0;
-}
-
-static void snode_drawstring(SpaceNode *snode, char *str, int okwidth)
-{
- char drawstr[NODE_MAXSTR];
- int width;
-
- if(str[0]==0 || okwidth<4) return;
-
- BLI_strncpy(drawstr, str, NODE_MAXSTR);
- width= snode->aspect*BIF_GetStringWidth(snode->curfont, drawstr, 0);
-
- if(width > okwidth) {
- int len= strlen(drawstr)-1;
-
- while(width > okwidth && len>=0) {
- drawstr[len]= 0;
-
- width= snode->aspect*BIF_GetStringWidth(snode->curfont, drawstr, 0);
- len--;
- }
- if(len==0) return;
- }
- BIF_DrawString(snode->curfont, drawstr, 0);
-
-}
-
-/* ************** Socket callbacks *********** */
-
-static void socket_vector_menu_cb(void *node_v, void *ntree_v)
-{
- if(node_v && ntree_v) {
- NodeTagChanged(ntree_v, node_v);
- addqueue(curarea->win, UI_BUT_EVENT, B_NODE_EXEC+((bNode *)node_v)->nr);
- }
-}
-
-/* NOTE: this is a block-menu, needs 0 events, otherwise the menu closes */
-static uiBlock *socket_vector_menu(void *socket_v)
-{
- SpaceNode *snode= curarea->spacedata.first;
- bNode *node;
- bNodeSocket *sock= socket_v;
- bNodeStack *ns= &sock->ns;
- uiBlock *block;
- uiBut *bt;
-
- /* a bit ugly... retrieve the node the socket comes from */
- for(node= snode->nodetree->nodes.first; node; node= node->next) {
- bNodeSocket *sockt;
- for(sockt= node->inputs.first; sockt; sockt= sockt->next)
- if(sockt==sock)
- break;
- if(sockt)
- break;
- }
-
- block= uiNewBlock(&curarea->uiblocks, "socket menu", UI_EMBOSS, UI_HELV, curarea->win);
-
- /* use this for a fake extra empy space around the buttons */
- uiDefBut(block, LABEL, 0, "", -4, -4, 188, 68, NULL, 0, 0, 0, 0, "");
-
- uiBlockBeginAlign(block);
- bt= uiDefButF(block, NUMSLI, 0, "X ", 0,40,180,20, ns->vec, ns->min, ns->max, 10, 0, "");
- uiButSetFunc(bt, socket_vector_menu_cb, node, snode->nodetree);
- bt= uiDefButF(block, NUMSLI, 0, "Y ", 0,20,180,20, ns->vec+1, ns->min, ns->max, 10, 0, "");
- uiButSetFunc(bt, socket_vector_menu_cb, node, snode->nodetree);
- bt= uiDefButF(block, NUMSLI, 0, "Z ", 0,0,180,20, ns->vec+2, ns->min, ns->max, 10, 0, "");
- uiButSetFunc(bt, socket_vector_menu_cb, node, snode->nodetree);
-
- uiBlockSetDirection(block, UI_TOP);
-
- allqueue(REDRAWNODE, 0);
-
- return block;
-}
-
-static void node_sync_cb(void *snode_v, void *node_v)
-{
- SpaceNode *snode= snode_v;
-
- if(snode->treetype==NTREE_SHADER) {
- nodeShaderSynchronizeID(node_v, 1);
- allqueue(REDRAWBUTSSHADING, 0);
- }
-}
-
-/* ****************** GENERAL CALLBACKS FOR NODES ***************** */
-
-static void node_ID_title_cb(void *node_v, void *unused_v)
-{
- bNode *node= node_v;
-
- if(node->id) {
- test_idbutton(node->id->name+2); /* library.c, verifies unique name */
- BLI_strncpy(node->name, node->id->name+2, 21);
-
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWNODE, 0);
- allqueue(REDRAWOOPS, 0);
- }
-}
-
-
-static void node_but_title_cb(void *node_v, void *but_v)
-{
- bNode *node= node_v;
- uiBut *bt= but_v;
- BLI_strncpy(node->name, bt->drawstr, NODE_MAXSTR);
-
- allqueue(REDRAWNODE, 0);
-}
-
-
-/* ****************** BUTTON CALLBACKS FOR ALL TREES ***************** */
-
-static int node_buts_group(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block && node->id) {
- uiBut *bt;
- short width;
-
- uiBlockBeginAlign(block);
-
- /* name button */
- width= (short)(butr->xmax-butr->xmin - (node->id->us>1?19.0f:0.0f));
- bt= uiDefBut(block, TEX, B_NOP, "NT:",
- butr->xmin, butr->ymin, width, 19,
- node->id->name+2, 0.0, 19.0, 0, 0, "NodeTree name");
- uiButSetFunc(bt, node_ID_title_cb, node, NULL);
-
- /* user amount */
- if(node->id->us>1) {
- char str1[32];
- sprintf(str1, "%d", node->id->us);
- bt= uiDefBut(block, BUT, B_NOP, str1,
- butr->xmax-19, butr->ymin, 19, 19,
- NULL, 0, 0, 0, 0, "Displays number of users.");
- //uiButSetFunc(bt, node_mat_alone_cb, node, NULL);
- }
-
- uiBlockEndAlign(block);
- }
- return 19;
-}
-
-static int node_buts_value(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- bNodeSocket *sock= node->outputs.first; /* first socket stores value */
-
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "",
- butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
- sock->ns.vec, sock->ns.min, sock->ns.max, 10, 2, "");
-
- }
- return 20;
-}
-
-static int node_buts_rgb(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- bNodeSocket *sock= node->outputs.first; /* first socket stores value */
- if(sock) {
- /* enforce square box drawing */
- uiBlockSetEmboss(block, UI_EMBOSSP);
-
- uiDefButF(block, HSVCUBE, B_NODE_EXEC+node->nr, "",
- butr->xmin, butr->ymin, butr->xmax-butr->xmin, 12,
- sock->ns.vec, 0.0f, 1.0f, 3, 0, "");
- uiDefButF(block, HSVCUBE, B_NODE_EXEC+node->nr, "",
- butr->xmin, butr->ymin+15, butr->xmax-butr->xmin, butr->ymax-butr->ymin -15 -15,
- sock->ns.vec, 0.0f, 1.0f, 2, 0, "");
- uiDefButF(block, COL, B_NOP, "",
- butr->xmin, butr->ymax-12, butr->xmax-butr->xmin, 12,
- sock->ns.vec, 0.0, 0.0, -1, 0, "");
- /* the -1 above prevents col button to popup a color picker */
-
- uiBlockSetEmboss(block, UI_EMBOSS);
- }
- }
- return 30 + (int)(node->width-NODE_DY);
-}
-
-static int node_buts_mix_rgb(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- uiBut *bt;
- int a_but= (ntree->type==NTREE_COMPOSIT);
-
- /* blend type */
- uiBlockBeginAlign(block);
- bt=uiDefButS(block, MENU, B_NODE_EXEC+node->nr, "Mix %x0|Add %x1|Subtract %x3|Multiply %x2|Screen %x4|Overlay %x9|Divide %x5|Difference %x6|Darken %x7|Lighten %x8|Dodge %x10|Burn %x11|Color %x15|Value %x14|Saturation %x13|Hue %x12",
- butr->xmin, butr->ymin, butr->xmax-butr->xmin -(a_but?20:0), 20,
- &node->custom1, 0, 0, 0, 0, "");
- uiButSetFunc(bt, node_but_title_cb, node, bt);
- /* Alpha option, composite */
- if(a_but)
- uiDefButS(block, TOG, B_NODE_EXEC+node->nr, "A",
- butr->xmax-20, butr->ymin, 20, 20,
- &node->custom2, 0, 0, 0, 0, "Include Alpha of 2nd input in this operation");
- }
- return 20;
-}
-
-static int node_buts_time(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- CurveMapping *cumap= node->storage;
- short dx= (short)((butr->xmax-butr->xmin)/2);
- butr->ymin += 26;
-
- curvemap_buttons(block, node->storage, 's', B_NODE_EXEC+node->nr, B_REDR, butr);
-
- if(cumap) cumap->flag |= CUMA_DRAW_CFRA;
- if(node->custom1<node->custom2)
- cumap->black[0]= (float)(CFRA - node->custom1)/(float)(node->custom2-node->custom1);
-
- uiBlockBeginAlign(block);
- uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Sta:",
- butr->xmin, butr->ymin-22, dx, 19,
- &node->custom1, 1.0, 20000.0, 0, 0, "Start frame");
- uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "End:",
- butr->xmin+dx, butr->ymin-22, dx, 19,
- &node->custom2, 1.0, 20000.0, 0, 0, "End frame");
- }
-
- return node->width-NODE_DY;
-}
-
-static int node_buts_valtorgb(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- if(node->storage) {
- draw_colorband_buts_small(block, node->storage, butr, B_NODE_EXEC+node->nr);
- }
- }
- return 40;
-}
-
-static int node_buts_curvevec(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- curvemap_buttons(block, node->storage, 'v', B_NODE_EXEC+node->nr, B_REDR, butr);
- }
- return (int)(node->width-NODE_DY);
-}
-
-static int node_buts_curvecol(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- curvemap_buttons(block, node->storage, 'c', B_NODE_EXEC+node->nr, B_REDR, butr);
- }
- return (int)(node->width-NODE_DY);
-}
-
-static int node_buts_normal(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- bNodeSocket *sock= node->outputs.first; /* first socket stores normal */
-
- uiDefButF(block, BUT_NORMAL, B_NODE_EXEC+node->nr, "",
- butr->xmin, butr->ymin, butr->xmax-butr->xmin, butr->ymax-butr->ymin,
- sock->ns.vec, 0.0f, 1.0f, 0, 0, "");
-
- }
- return (int)(node->width-NODE_DY);
-}
-
-static void node_browse_tex_cb(void *ntree_v, void *node_v)
-{
- bNodeTree *ntree= ntree_v;
- bNode *node= node_v;
- Tex *tex;
-
- if(node->menunr<1) return;
-
- if(node->id) {
- node->id->us--;
- node->id= NULL;
- }
- tex= BLI_findlink(&G.main->tex, node->menunr-1);
-
- node->id= &tex->id;
- id_us_plus(node->id);
- BLI_strncpy(node->name, node->id->name+2, 21);
-
- nodeSetActive(ntree, node);
-
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWNODE, 0);
- NodeTagChanged(ntree, node);
-
- node->menunr= 0;
-}
-
-static int node_buts_texture(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- uiBut *bt;
- char *strp;
-
- /* browse button texture */
- uiBlockBeginAlign(block);
- IDnames_to_pupstring(&strp, NULL, "", &(G.main->tex), NULL, NULL);
- node->menunr= 0;
- bt= uiDefButS(block, MENU, B_NODE_EXEC+node->nr, strp,
- butr->xmin, butr->ymin, 20, 19,
- &node->menunr, 0, 0, 0, 0, "Browse texture");
- uiButSetFunc(bt, node_browse_tex_cb, ntree, node);
- if(strp) MEM_freeN(strp);
-
- if(node->id) {
- bt= uiDefBut(block, TEX, B_NOP, "TE:",
- butr->xmin+19, butr->ymin, butr->xmax-butr->xmin-19, 19,
- node->id->name+2, 0.0, 19.0, 0, 0, "Texture name");
- uiButSetFunc(bt, node_ID_title_cb, node, NULL);
- }
-
- }
- return 19;
-}
-
-static int node_buts_math(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- uiBut *bt;
-
- bt=uiDefButS(block, MENU, B_NODE_EXEC, "Add %x0|Subtract %x1|Multiply %x2|Divide %x3|Sine %x4|Cosine %x5|Tangent %x6|Arcsine %x7|Arccosine %x8|Arctangent %x9|Power %x10|Logarithm %x11|Minimum %x12|Maximum %x13|Round %x14", butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, &node->custom1, 0, 0, 0, 0, "");
- uiButSetFunc(bt, node_but_title_cb, node, bt);
- }
- return 20;
-}
-
-
-/* ****************** BUTTON CALLBACKS FOR SHADER NODES ***************** */
-
-
-static void node_mat_alone_cb(void *node_v, void *unused)
-{
- bNode *node= node_v;
-
- node->id= (ID *)copy_material((Material *)node->id);
-
- BIF_undo_push("Single user material");
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWNODE, 0);
- allqueue(REDRAWOOPS, 0);
-}
-
-static void node_browse_mat_cb(void *ntree_v, void *node_v)
-{
- bNodeTree *ntree= ntree_v;
- bNode *node= node_v;
-
- if(node->menunr<1) return;
-
- if(node->menunr==32767) { /* code for Add New */
- if(node->id) {
- /* make copy, but make sure it doesnt have the node tag nor nodes */
- Material *ma= (Material *)node->id;
- ma->id.us--;
- ma= copy_material(ma);
- ma->use_nodes= 0;
- if(ma->nodetree) {
- ntreeFreeTree(ma->nodetree);
- MEM_freeN(ma->nodetree);
- }
- ma->nodetree= NULL;
- node->id= (ID *)ma;
- }
- else node->id= (ID *)add_material("MatNode");
- }
- else {
- if(node->id) node->id->us--;
- node->id= BLI_findlink(&G.main->mat, node->menunr-1);
- id_us_plus(node->id);
- }
- BLI_strncpy(node->name, node->id->name+2, 21);
-
- nodeSetActive(ntree, node);
-
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWNODE, 0);
- BIF_preview_changed(ID_MA);
-
- node->menunr= 0;
-}
-
-static void node_new_mat_cb(void *ntree_v, void *node_v)
-{
- bNodeTree *ntree= ntree_v;
- bNode *node= node_v;
-
- node->id= (ID *)add_material("MatNode");
- BLI_strncpy(node->name, node->id->name+2, 21);
-
- nodeSetActive(ntree, node);
-
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWNODE, 0);
- BIF_preview_changed(ID_MA);
-
-}
-
-static void node_texmap_cb(void *texmap_v, void *unused_v)
-{
- init_mapping(texmap_v);
-}
-
-static int node_shader_buts_material(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- uiBut *bt;
- short dx= (short)((butr->xmax-butr->xmin)/3.0f), has_us= (node->id && node->id->us>1);
- short dy= (short)butr->ymin;
- char *strp;
-
- /* WATCH IT: we use this callback in material buttons, but then only want first row */
- if(butr->ymax-butr->ymin > 21.0f) dy+= 19;
-
- uiBlockBeginAlign(block);
- if(node->id==NULL) uiBlockSetCol(block, TH_REDALERT);
- else if(has_us) uiBlockSetCol(block, TH_BUT_SETTING1);
- else uiBlockSetCol(block, TH_BUT_SETTING2);
-
- /* browse button */
- IDnames_to_pupstring(&strp, NULL, "ADD NEW %x32767", &(G.main->mat), NULL, NULL);
- node->menunr= 0;
- bt= uiDefButS(block, MENU, B_NOP, strp,
- butr->xmin, dy, 19, 19,
- &node->menunr, 0, 0, 0, 0, "Browses existing choices or adds NEW");
- uiButSetFunc(bt, node_browse_mat_cb, ntree, node);
- if(strp) MEM_freeN(strp);
-
- /* Add New button */
- if(node->id==NULL) {
- bt= uiDefBut(block, BUT, B_NOP, "Add New",
- butr->xmin+19, dy, (short)(butr->xmax-butr->xmin-19.0f), 19,
- NULL, 0.0, 0.0, 0, 0, "Add new Material");
- uiButSetFunc(bt, node_new_mat_cb, ntree, node);
- uiBlockSetCol(block, TH_AUTO);
- }
- else {
- /* name button */
- short width= (short)(butr->xmax-butr->xmin-19.0f - (has_us?19.0f:0.0f));
- bt= uiDefBut(block, TEX, B_NOP, "MA:",
- butr->xmin+19, dy, width, 19,
- node->id->name+2, 0.0, 19.0, 0, 0, "Material name");
- uiButSetFunc(bt, node_ID_title_cb, node, NULL);
-
- /* user amount */
- if(has_us) {
- char str1[32];
- sprintf(str1, "%d", node->id->us);
- bt= uiDefBut(block, BUT, B_NOP, str1,
- butr->xmax-19, dy, 19, 19,
- NULL, 0, 0, 0, 0, "Displays number of users. Click to make a single-user copy.");
- uiButSetFunc(bt, node_mat_alone_cb, node, NULL);
- }
-
- /* WATCH IT: we use this callback in material buttons, but then only want first row */
- if(butr->ymax-butr->ymin > 21.0f) {
- /* node options */
- uiBlockSetCol(block, TH_AUTO);
- uiDefButBitS(block, TOG, SH_NODE_MAT_DIFF, B_NODE_EXEC+node->nr, "Diff",
- butr->xmin, butr->ymin, dx, 19,
- &node->custom1, 0, 0, 0, 0, "Material Node outputs Diffuse");
- uiDefButBitS(block, TOG, SH_NODE_MAT_SPEC, B_NODE_EXEC+node->nr, "Spec",
- butr->xmin+dx, butr->ymin, dx, 19,
- &node->custom1, 0, 0, 0, 0, "Material Node outputs Specular");
- uiDefButBitS(block, TOG, SH_NODE_MAT_NEG, B_NODE_EXEC+node->nr, "Neg Normal",
- butr->xmax-dx, butr->ymin, dx, 19,
- &node->custom1, 0, 0, 0, 0, "Material Node uses inverted Normal");
- }
- }
- uiBlockEndAlign(block);
- }
- return 38;
-}
-
-static int node_shader_buts_mapping(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- TexMapping *texmap= node->storage;
- short dx= (short)((butr->xmax-butr->xmin)/7.0f);
- short dy= (short)(butr->ymax-19);
-
- uiBlockSetFunc(block, node_texmap_cb, texmap, NULL); /* all buttons get this */
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+dx, dy, 2*dx, 19, texmap->loc, -1000.0f, 1000.0f, 10, 2, "");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->loc+1, -1000.0f, 1000.0f, 10, 2, "");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->loc+2, -1000.0f, 1000.0f, 10, 2, "");
- dy-= 19;
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+dx, dy, 2*dx, 19, texmap->rot, -1000.0f, 1000.0f, 1000, 1, "");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->rot+1, -1000.0f, 1000.0f, 1000, 1, "");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->rot+2, -1000.0f, 1000.0f, 1000, 1, "");
- dy-= 19;
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+dx, dy, 2*dx, 19, texmap->size, -1000.0f, 1000.0f, 10, 2, "");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->size+1, -1000.0f, 1000.0f, 10, 2, "");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->size+2, -1000.0f, 1000.0f, 10, 2, "");
- dy-= 25;
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+dx, dy, 2*dx, 19, texmap->min, -10.0f, 10.0f, 100, 2, "");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->min+1, -10.0f, 10.0f, 100, 2, "");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->min+2, -10.0f, 10.0f, 100, 2, "");
- dy-= 19;
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+dx, dy, 2*dx, 19, texmap->max, -10.0f, 10.0f, 10, 2, "");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->max+1, -10.0f, 10.0f, 10, 2, "");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->max+2, -10.0f, 10.0f, 10, 2, "");
- uiBlockEndAlign(block);
-
- /* labels/options */
-
- dy= (short)(butr->ymax-19);
- uiDefBut(block, LABEL, B_NOP, "Loc", butr->xmin, dy, dx, 19, NULL, 0.0f, 0.0f, 0, 0, "");
- dy-= 19;
- uiDefBut(block, LABEL, B_NOP, "Rot", butr->xmin, dy, dx, 19, NULL, 0.0f, 0.0f, 0, 0, "");
- dy-= 19;
- uiDefBut(block, LABEL, B_NOP, "Size", butr->xmin, dy, dx, 19, NULL, 0.0f, 0.0f, 0, 0, "");
- dy-= 25;
- uiDefButBitI(block, TOG, TEXMAP_CLIP_MIN, B_NODE_EXEC+node->nr, "Min", butr->xmin, dy, dx-4, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, "");
- dy-= 19;
- uiDefButBitI(block, TOG, TEXMAP_CLIP_MAX, B_NODE_EXEC+node->nr, "Max", butr->xmin, dy, dx-4, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, "");
-
- }
- return 5*19 + 6;
-}
-
-static int node_shader_buts_vect_math(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- uiBut *bt;
-
- bt=uiDefButS(block, MENU, B_NODE_EXEC, "Add %x0|Subtract %x1|Average %x2|Dot Product %x3 |Cross Product %x4|Normalize %x5", butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, &node->custom1, 0, 0, 0, 0, "");
- uiButSetFunc(bt, node_but_title_cb, node, bt);
- }
- return 20;
-}
-
-static int node_shader_buts_geometry(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- uiBut *but;
- NodeGeometry *ngeo= (NodeGeometry*)node->storage;
-
- if(!verify_valid_uv_name(ngeo->uvname))
- uiBlockSetCol(block, TH_REDALERT);
- but= uiDefBut(block, TEX, B_NODE_EXEC+node->nr, "UV:", butr->xmin, butr->ymin+20, butr->xmax-butr->xmin, 20, ngeo->uvname, 0, 31, 0, 0, "Set name of UV layer to use, default is active UV layer");
- uiButSetCompleteFunc(but, autocomplete_uv, NULL);
- uiBlockSetCol(block, TH_AUTO);
-
- if(!verify_valid_vcol_name(ngeo->colname))
- uiBlockSetCol(block, TH_REDALERT);
- but= uiDefBut(block, TEX, B_NODE_EXEC+node->nr, "Col:", butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, ngeo->colname, 0, 31, 0, 0, "Set name of vertex color layer to use, default is active vertex color layer");
- uiButSetCompleteFunc(but, autocomplete_vcol, NULL);
- uiBlockSetCol(block, TH_AUTO);
- }
-
- return 40;
-}
-
-/* only once called */
-static void node_shader_set_butfunc(bNodeType *ntype)
-{
- switch(ntype->type) {
- /* case NODE_GROUP: note, typeinfo for group is generated... see "XXX ugly hack" */
-
- case SH_NODE_MATERIAL:
- case SH_NODE_MATERIAL_EXT:
- ntype->butfunc= node_shader_buts_material;
- break;
- case SH_NODE_TEXTURE:
- ntype->butfunc= node_buts_texture;
- break;
- case SH_NODE_NORMAL:
- ntype->butfunc= node_buts_normal;
- break;
- case SH_NODE_CURVE_VEC:
- ntype->butfunc= node_buts_curvevec;
- break;
- case SH_NODE_CURVE_RGB:
- ntype->butfunc= node_buts_curvecol;
- break;
- case SH_NODE_MAPPING:
- ntype->butfunc= node_shader_buts_mapping;
- break;
- case SH_NODE_VALUE:
- ntype->butfunc= node_buts_value;
- break;
- case SH_NODE_RGB:
- ntype->butfunc= node_buts_rgb;
- break;
- case SH_NODE_MIX_RGB:
- ntype->butfunc= node_buts_mix_rgb;
- break;
- case SH_NODE_VALTORGB:
- ntype->butfunc= node_buts_valtorgb;
- break;
- case SH_NODE_MATH:
- ntype->butfunc= node_buts_math;
- break;
- case SH_NODE_VECT_MATH:
- ntype->butfunc= node_shader_buts_vect_math;
- break;
- case SH_NODE_GEOMETRY:
- ntype->butfunc= node_shader_buts_geometry;
- break;
- default:
- ntype->butfunc= NULL;
- }
-}
-
-/* ****************** BUTTON CALLBACKS FOR COMPOSITE NODES ***************** */
-
-
-
-static void node_browse_image_cb(void *ntree_v, void *node_v)
-{
- bNodeTree *ntree= ntree_v;
- bNode *node= node_v;
-
- nodeSetActive(ntree, node);
-
- if(node->menunr<1) return;
- if(node->menunr==32767) { /* code for Load New */
- addqueue(curarea->win, UI_BUT_EVENT, B_NODE_LOADIMAGE);
- }
- else {
- if(node->id) node->id->us--;
- node->id= BLI_findlink(&G.main->image, node->menunr-1);
- id_us_plus(node->id);
-
- BLI_strncpy(node->name, node->id->name+2, 21);
-
- NodeTagChanged(ntree, node);
- BKE_image_signal((Image *)node->id, node->storage, IMA_SIGNAL_USER_NEW_IMAGE);
- addqueue(curarea->win, UI_BUT_EVENT, B_NODE_EXEC+node->nr);
- }
- node->menunr= 0;
-}
-
-static void node_active_cb(void *ntree_v, void *node_v)
-{
- nodeSetActive(ntree_v, node_v);
-}
-static void node_image_type_cb(void *node_v, void *unused)
-{
-
- allqueue(REDRAWNODE, 1);
-}
-
-static char *node_image_type_pup(void)
-{
- char *str= MEM_mallocN(256, "image type pup");
- int a;
-
- str[0]= 0;
-
- a= sprintf(str, "Image Type %%t|");
- a+= sprintf(str+a, " Image %%x%d %%i%d|", IMA_SRC_FILE, ICON_IMAGE_DEHLT);
- a+= sprintf(str+a, " Movie %%x%d %%i%d|", IMA_SRC_MOVIE, ICON_SEQUENCE);
- a+= sprintf(str+a, " Sequence %%x%d %%i%d|", IMA_SRC_SEQUENCE, ICON_IMAGE_COL);
- a+= sprintf(str+a, " Generated %%x%d %%i%d", IMA_SRC_GENERATED, ICON_BLANK1);
-
- return str;
-}
-
-/* copy from buttons_shading.c */
-static char *layer_menu(RenderResult *rr)
-{
- RenderLayer *rl;
- int len= 40 + 40*BLI_countlist(&rr->layers);
- short a, nr;
- char *str= MEM_callocN(len, "menu layers");
-
- strcpy(str, "Layer %t");
- a= strlen(str);
- for(nr=0, rl= rr->layers.first; rl; rl= rl->next, nr++) {
- a+= sprintf(str+a, "|%s %%x%d", rl->name, nr);
- }
-
- return str;
-}
-
-static void image_layer_cb(void *ima_v, void *iuser_v)
-{
-
- ntreeCompositForceHidden(G.scene->nodetree);
- BKE_image_multilayer_index(ima_v, iuser_v);
- allqueue(REDRAWNODE, 0);
-}
-
-static int node_composit_buts_image(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- ImageUser *iuser= node->storage;
-
- if(block) {
- uiBut *bt;
- short dy= (short)butr->ymax-19;
- char *strp;
-
- uiBlockBeginAlign(block);
- uiBlockSetCol(block, TH_BUT_SETTING2);
-
- /* browse button */
- IMAnames_to_pupstring(&strp, NULL, "LOAD NEW %x32767", &(G.main->image), NULL, NULL);
- node->menunr= 0;
- bt= uiDefButS(block, MENU, B_NOP, strp,
- butr->xmin, dy, 19, 19,
- &node->menunr, 0, 0, 0, 0, "Browses existing choices");
- uiButSetFunc(bt, node_browse_image_cb, ntree, node);
- if(strp) MEM_freeN(strp);
-
- /* Add New button */
- if(node->id==NULL) {
- bt= uiDefBut(block, BUT, B_NODE_LOADIMAGE, "Load New",
- butr->xmin+19, dy, (short)(butr->xmax-butr->xmin-19.0f), 19,
- NULL, 0.0, 0.0, 0, 0, "Add new Image");
- uiButSetFunc(bt, node_active_cb, ntree, node);
- uiBlockSetCol(block, TH_AUTO);
- }
- else {
- /* name button + type */
- Image *ima= (Image *)node->id;
- short xmin= (short)butr->xmin, xmax= (short)butr->xmax;
- short width= xmax - xmin - 45;
- short icon= ICON_IMAGE_DEHLT;
-
- if(ima->source==IMA_SRC_MOVIE) icon= ICON_SEQUENCE;
- else if(ima->source==IMA_SRC_SEQUENCE) icon= ICON_IMAGE_COL;
- else if(ima->source==IMA_SRC_GENERATED) icon= ICON_BLANK1;
-
- bt= uiDefBut(block, TEX, B_NOP, "IM:",
- xmin+19, dy, width, 19,
- node->id->name+2, 0.0, 19.0, 0, 0, "Image name");
- uiButSetFunc(bt, node_ID_title_cb, node, NULL);
-
- /* buffer type option */
- strp= node_image_type_pup();
- bt= uiDefIconTextButS(block, MENU, B_NOP, icon, strp,
- xmax-26, dy, 26, 19,
- &ima->source, 0.0, 19.0, 0, 0, "Image type");
- uiButSetFunc(bt, node_image_type_cb, node, ima);
- MEM_freeN(strp);
-
- if( ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE) ) {
- width= (xmax-xmin)/2;
-
- dy-= 19;
- uiDefButI(block, NUM, B_NODE_EXEC+node->nr, "Frs:",
- xmin, dy, width, 19,
- &iuser->frames, 0.0, MAXFRAMEF, 0, 0, "Amount of images used in animation");
- uiDefButI(block, NUM, B_NODE_EXEC+node->nr, "SFra:",
- xmin+width, dy, width, 19,
- &iuser->sfra, 1.0, MAXFRAMEF, 0, 0, "Start frame of animation");
- dy-= 19;
- uiDefButI(block, NUM, B_NODE_EXEC+node->nr, "Offs:",
- xmin, dy, width, 19,
- &iuser->offset, -MAXFRAMEF, MAXFRAMEF, 0, 0, "Offsets the number of the frame to use in the animation");
- uiDefButS(block, TOG, B_NODE_EXEC+node->nr, "Cycl",
- xmin+width, dy, width-20, 19,
- &iuser->cycl, 0.0, 0.0, 0, 0, "Make animation go cyclic");
- uiDefIconButBitS(block, TOG, IMA_ANIM_ALWAYS, B_NODE_EXEC+node->nr, ICON_AUTO,
- xmax-20, dy, 20, 19,
- &iuser->flag, 0.0, 0.0, 0, 0, "Always refresh Image on frame changes");
- }
- if( ima->type==IMA_TYPE_MULTILAYER && ima->rr) {
- RenderLayer *rl= BLI_findlink(&ima->rr->layers, iuser->layer);
- if(rl) {
- width= (xmax-xmin);
- dy-= 19;
- strp= layer_menu(ima->rr);
- bt= uiDefButS(block, MENU, B_NODE_EXEC+node->nr, strp,
- xmin, dy, width, 19,
- &iuser->layer, 0.0, 10000.0, 0, 0, "Layer");
- uiButSetFunc(bt, image_layer_cb, ima, node->storage);
- MEM_freeN(strp);
- }
- }
- }
-
- }
- if(node->id) {
- Image *ima= (Image *)node->id;
- int retval= 19;
-
- /* for each draw we test for anim refresh event */
- if(iuser->flag & IMA_ANIM_REFRESHED) {
- iuser->flag &= ~IMA_ANIM_REFRESHED;
- addqueue(curarea->win, UI_BUT_EVENT, B_NODE_EXEC+node->nr);
- }
-
- if( ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE) )
- retval+= 38;
- if( ima->type==IMA_TYPE_MULTILAYER)
- retval+= 19;
- return retval;
- }
- else
- return 19;
-}
-
-/* if we use render layers from other scene, we make a nice title */
-static void set_render_layers_title(void *node_v, void *unused)
-{
- bNode *node= node_v;
- Scene *sce;
- SceneRenderLayer *srl;
- char str[64];
-
- if(node->id) {
- BLI_strncpy(str, node->id->name+2, 21);
- strcat(str, "|");
- sce= (Scene *)node->id;
- }
- else {
- str[0]= 0;
- sce= G.scene;
- }
- srl= BLI_findlink(&sce->r.layers, node->custom1);
- if(srl==NULL) {
- node->custom1= 0;
- srl= sce->r.layers.first;
- }
-
- strcat(str, srl->name);
- BLI_strncpy(node->name, str, 32);
-}
-
-static char *scene_layer_menu(Scene *sce)
-{
- SceneRenderLayer *srl;
- int len= 40 + 40*BLI_countlist(&sce->r.layers);
- short a, nr;
- char *str= MEM_callocN(len, "menu layers");
-
- strcpy(str, "Active Layer %t");
- a= strlen(str);
- for(nr=0, srl= sce->r.layers.first; srl; srl= srl->next, nr++) {
- a+= sprintf(str+a, "|%s %%x%d", srl->name, nr);
- }
-
- return str;
-}
-
-static void node_browse_scene_cb(void *ntree_v, void *node_v)
-{
- bNodeTree *ntree= ntree_v;
- bNode *node= node_v;
- Scene *sce;
-
- if(node->menunr<1) return;
-
- if(node->id) {
- node->id->us--;
- node->id= NULL;
- }
- sce= BLI_findlink(&G.main->scene, node->menunr-1);
- if(sce!=G.scene) {
- node->id= &sce->id;
- id_us_plus(node->id);
- }
-
- set_render_layers_title(node, NULL);
- nodeSetActive(ntree, node);
-
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWNODE, 0);
- NodeTagChanged(ntree, node);
-
- node->menunr= 0;
-}
-
-
-static int node_composit_buts_renderlayers(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- uiBut *bt;
- char *strp;
-
- /* browse button scene */
- uiBlockBeginAlign(block);
- IDnames_to_pupstring(&strp, NULL, "", &(G.main->scene), NULL, NULL);
- node->menunr= 0;
- bt= uiDefButS(block, MENU, B_NOP, strp,
- butr->xmin, butr->ymin, 20, 19,
- &node->menunr, 0, 0, 0, 0, "Browse Scene to use RenderLayer from");
- uiButSetFunc(bt, node_browse_scene_cb, ntree, node);
- if(strp) MEM_freeN(strp);
-
- /* browse button layer */
- strp= scene_layer_menu(node->id?(Scene *)node->id:G.scene);
- if(node->id)
- bt= uiDefIconTextButS(block, MENU, B_NODE_EXEC+node->nr, ICON_SCENE_DEHLT, strp,
- butr->xmin+20, butr->ymin, (butr->xmax-butr->xmin)-40, 19,
- &node->custom1, 0, 0, 0, 0, "Choose Render Layer");
- else
- bt= uiDefButS(block, MENU, B_NODE_EXEC+node->nr, strp,
- butr->xmin+20, butr->ymin, (butr->xmax-butr->xmin)-40, 19,
- &node->custom1, 0, 0, 0, 0, "Choose Render Layer");
- uiButSetFunc(bt, set_render_layers_title, node, NULL);
- MEM_freeN(strp);
-
- /* re-render */
- /* uses custom2, not the best implementation of the world... but we need it to work now :) */
- bt= uiDefIconButS(block, TOG, B_NODE_EXEC+node->nr, ICON_SCENE,
- butr->xmax-20, butr->ymin, 20, 19,
- &node->custom2, 0, 0, 0, 0, "Re-render this Layer");
-
- }
- return 19;
-}
-
-static int node_composit_buts_blur(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- NodeBlurData *nbd= node->storage;
- uiBut *bt;
- short dy= butr->ymin+38;
- short dx= (butr->xmax-butr->xmin)/2;
- char str[256];
-
- uiBlockBeginAlign(block);
- sprintf(str, "Filter Type%%t|Flat %%x%d|Tent %%x%d|Quad %%x%d|Cubic %%x%d|Gauss %%x%d|Fast Gauss%%x%d|CatRom %%x%d|Mitch %%x%d", R_FILTER_BOX, R_FILTER_TENT, R_FILTER_QUAD, R_FILTER_CUBIC, R_FILTER_GAUSS, R_FILTER_FAST_GAUSS, R_FILTER_CATROM, R_FILTER_MITCH);
- uiDefButS(block, MENU, B_NODE_EXEC+node->nr,str,
- butr->xmin, dy, dx*2, 19,
- &nbd->filtertype, 0, 0, 0, 0, "Set sampling filter for blur");
- dy-=19;
- if (nbd->filtertype != R_FILTER_FAST_GAUSS) {
- uiDefButC(block, TOG, B_NODE_EXEC+node->nr, "Bokeh",
- butr->xmin, dy, dx, 19,
- &nbd->bokeh, 0, 0, 0, 0, "Uses circular filter, warning it's slow!");
- uiDefButC(block, TOG, B_NODE_EXEC+node->nr, "Gamma",
- butr->xmin+dx, dy, dx, 19,
- &nbd->gamma, 0, 0, 0, 0, "Applies filter on gamma corrected values");
- } else {
- uiBlockEndAlign(block);
- uiBlockBeginAlign(block);
- }
- dy-=19;
- bt=uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "X:",
- butr->xmin, dy, dx, 19,
- &nbd->sizex, 0, 256, 0, 0, "");
- bt=uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Y:",
- butr->xmin+dx, dy, dx, 19,
- &nbd->sizey, 0, 256, 0, 0, "");
- uiBlockEndAlign(block);
- }
- return 57;
-}
-
-/* qdn: defocus node */
-static int node_composit_buts_defocus(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- NodeDefocus *nqd = node->storage;
- short dy = butr->ymin + 209;
- short dx = butr->xmax - butr->xmin;
- char* mstr1 = "Bokeh Type%t|Octagon %x8|Heptagon %x7|Hexagon %x6|Pentagon %x5|Square %x4|Triangle %x3|Disk %x0";
-
- uiDefBut(block, LABEL, B_NOP, "Bokeh Type", butr->xmin, dy, dx, 19, NULL, 0, 0, 0, 0, "");
- uiDefButC(block, MENU, B_NODE_EXEC+node->nr, mstr1,
- butr->xmin, dy-19, dx, 19,
- &nqd->bktype, 0, 0, 0, 0, "Bokeh type");
- if (nqd->bktype) { /* for some reason rotating a disk doesn't seem to work... ;) */
- uiDefButC(block, NUM, B_NODE_EXEC+node->nr, "Rotate:",
- butr->xmin, dy-38, dx, 19,
- &nqd->rotation, 0, 90, 0, 0, "Bokeh shape rotation offset in degrees");
- }
- uiDefButC(block, TOG, B_NODE_EXEC+node->nr, "Gamma Correct",
- butr->xmin, dy-57, dx, 19,
- &nqd->gamco, 0, 0, 0, 0, "Enable gamma correction before and after main process");
- if (nqd->no_zbuf==0) {
- // only needed for zbuffer input
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "fStop:",
- butr->xmin, dy-76, dx, 19,
- &nqd->fstop, 0.5, 128, 10, 0, "Amount of focal blur, 128=infinity=perfect focus, half the value doubles the blur radius");
- }
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Maxblur:",
- butr->xmin, dy-95, dx, 19,
- &nqd->maxblur, 0, 10000, 1000, 0, "blur limit, maximum CoC radius, 0=no limit");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "BThreshold:",
- butr->xmin, dy-114, dx, 19,
- &nqd->bthresh, 0, 100, 100, 0, "CoC radius threshold, prevents background bleed on in-focus midground, 0=off");
- uiDefButC(block, TOG, B_NODE_EXEC+node->nr, "Preview",
- butr->xmin, dy-142, dx, 19,
- &nqd->preview, 0, 0, 0, 0, "Enable sampling mode, useful for preview when using low samplecounts");
- if (nqd->preview) {
- /* only visible when sampling mode enabled */
- uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Samples:",
- butr->xmin, dy-161, dx, 19,
- &nqd->samples, 16, 256, 0, 0, "Number of samples (16=grainy, higher=less noise)");
- }
- uiDefButS(block, TOG, B_NODE_EXEC+node->nr, "No zbuffer",
- butr->xmin, dy-190, dx, 19,
- &nqd->no_zbuf, 0, 0, 0, 0, "Enable when using an image as input instead of actual zbuffer (auto enabled if node not image based, eg. time node)");
- if (nqd->no_zbuf) {
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Zscale:",
- butr->xmin, dy-209, dx, 19,
- &nqd->scale, 0, 1000, 100, 0, "Scales the Z input when not using a zbuffer, controls maximum blur designated by the color white or input value 1");
- }
- }
- return 228;
-}
-
-
-/* qdn: glare node */
-static int node_composit_buts_glare(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- NodeGlare *ndg = node->storage;
- short dy = butr->ymin + 152, dx = butr->xmax - butr->xmin;
- char* mn1 = "Type%t|Ghosts%x3|Streaks%x2|Fog Glow%x1|Simple Star%x0";
- char* mn2 = "Quality/Speed%t|High/Slow%x0|Medium/Medium%x1|Low/Fast%x2";
- uiDefButC(block, MENU, B_NODE_EXEC+node->nr, mn1,
- butr->xmin, dy, dx, 19,
- &ndg->type, 0, 0, 0, 0, "Glow/Flare/Bloom type");
- uiDefButC(block, MENU, B_NODE_EXEC+node->nr, mn2,
- butr->xmin, dy-19, dx, 19,
- &ndg->quality, 0, 0, 0, 0,
- "Quality speed trade off, if not set to high quality, effect will be applied to low-res copy of source image");
- if (ndg->type != 1) {
- uiDefButC(block, NUM, B_NODE_EXEC+node->nr, "Iterations:",
- butr->xmin, dy-38, dx, 19,
- &ndg->iter, 2, 5, 1, 0,
- "higher values will generate longer/more streaks/ghosts");
- if (ndg->type != 0)
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "ColMod:",
- butr->xmin, dy-57, dx, 19,
- &ndg->colmod, 0, 1, 10, 0,
- "Amount of Color Modulation, modulates colors of streaks and ghosts for a spectral dispersion effect");
- }
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Mix:",
- butr->xmin, dy-76, dx, 19,
- &ndg->mix, -1, 1, 10, 0,
- "Mix balance, -1 is original image only, 0 is exact 50/50 mix, 1 is processed image only");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Threshold:",
- butr->xmin, dy-95, dx, 19,
- &ndg->threshold, 0, 1000, 10, 0,
- "Brightness threshold, the glarefilter will be applied only to pixels brighter than this value");
- if ((ndg->type == 2) || (ndg->type == 0))
- {
- if (ndg->type == 2) {
- uiDefButC(block, NUM, B_NODE_EXEC+node->nr, "streaks:",
- butr->xmin, dy-114, dx, 19,
- &ndg->angle, 2, 16, 1000, 0,
- "Total number of streaks");
- uiDefButC(block, NUM, B_NODE_EXEC+node->nr, "AngOfs:",
- butr->xmin, dy-133, dx, 19,
- &ndg->angle_ofs, 0, 180, 1000, 0,
- "Streak angle rotation offset in degrees");
- }
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Fade:",
- butr->xmin, dy-152, dx, 19,
- &ndg->fade, 0.75, 1, 5, 0,
- "Streak fade out factor");
- }
- if (ndg->type == 0)
- uiDefButC(block, TOG, B_NODE_EXEC+node->nr, "Rot45",
- butr->xmin, dy-114, dx, 19,
- &ndg->angle, 0, 0, 0, 0,
- "simple star filter, add 45 degree rotation offset");
- if ((ndg->type == 1) || (ndg->type > 3)) // PBGH and fog glow
- uiDefButC(block, NUM, B_NODE_EXEC+node->nr, "Size:",
- butr->xmin, dy-114, dx, 19,
- &ndg->size, 6, 9, 1000, 0,
- "glow/glare size (not actual size, relative to initial size of bright area of pixels)");
- }
- return 171;
-}
-
-/* qdn: tonemap node */
-static int node_composit_buts_tonemap(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- NodeTonemap *ntm = node->storage;
- short dy = butr->ymin + 76, dx = butr->xmax - butr->xmin;
- char* mn = "Type%t|R/D Photoreceptor%x1|Rh Simple%x0";
-
- uiBlockBeginAlign(block);
- uiDefButI(block, MENU, B_NODE_EXEC+node->nr, mn,
- butr->xmin, dy, dx, 19,
- &ntm->type, 0, 0, 0, 0,
- "Tone mapping type");
- if (ntm->type == 0) {
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Key:",
- butr->xmin, dy-19, dx, 19,
- &ntm->key, 0, 1, 5, 0,
- "The value the average luminance is mapped to");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Offset:",
- butr->xmin, dy-38, dx, 19,
- &ntm->offset, 0.001, 10, 5, 0,
- "Tonemap offset, normally always 1, but can be used as an extra control to alter the brightness curve");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Gamma:",
- butr->xmin, dy-57, dx, 19,
- &ntm->gamma, 0.001, 3, 5, 0,
- "Gamma factor, if not used, set to 1");
- }
- else {
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Intensity:",
- butr->xmin, dy-19, dx, 19,
- &ntm->f, -8, 8, 10, 0, "if less than zero, darkens image, otherwise makes it brighter");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Contrast:",
- butr->xmin, dy-38, dx, 19,
- &ntm->m, 0, 1, 5, 0, "Set to 0 to use estimate from input image");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Adaptation:",
- butr->xmin, dy-57, dx, 19,
- &ntm->a, 0, 1, 5, 0, "if 0, global, if 1, based on pixel intensity");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "ColCorrect:",
- butr->xmin, dy-76, dx, 19,
- &ntm->c, 0, 1, 5, 0, "color correction, if 0, same for all channels, if 1, each independent");
- }
- uiBlockEndAlign(block);
- }
- return 95;
-}
-
-/* qdn: lens distortion node */
-static int node_composit_buts_lensdist(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- NodeLensDist *nld = node->storage;
- short dy = butr->ymin + 19, dx = butr->xmax - butr->xmin;
- uiBlockBeginAlign(block);
- uiDefButS(block, TOG, B_NODE_EXEC+node->nr, "Projector",
- butr->xmin, dy, dx, 19,
- &nld->proj, 0, 0, 0, 0,
- "Enable/disable projector mode, effect is applied in horizontal direction only");
- if (!nld->proj) {
- uiDefButS(block, TOG, B_NODE_EXEC+node->nr, "Jitter",
- butr->xmin, dy-19, dx/2, 19,
- &nld->jit, 0, 0, 0, 0,
- "Enable/disable jittering, faster, but also noisier");
- uiDefButS(block, TOG, B_NODE_EXEC+node->nr, "Fit",
- butr->xmin+dx/2, dy-19, dx/2, 19,
- &nld->fit, 0, 0, 0, 0,
- "For positive distortion factor only, scale image such that black areas are not visible");
- }
- uiBlockEndAlign(block);
- }
- return 38;
-}
-
-
-static int node_composit_buts_vecblur(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- NodeBlurData *nbd= node->storage;
- short dy= butr->ymin;
- short dx= (butr->xmax-butr->xmin);
-
- uiBlockBeginAlign(block);
- uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Samples:",
- butr->xmin, dy+57, dx, 19,
- &nbd->samples, 1, 256, 0, 0, "Amount of samples");
- uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "MinSpeed:",
- butr->xmin, dy+38, dx, 19,
- &nbd->minspeed, 0, 1024, 0, 0, "Minimum speed for a pixel to be blurred, used to separate background from foreground");
- uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "MaxSpeed:",
- butr->xmin, dy+19, dx, 19,
- &nbd->maxspeed, 0, 1024, 0, 0, "If not zero, maximum speed in pixels");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "BlurFac:",
- butr->xmin, dy, dx, 19,
- &nbd->fac, 0.0f, 2.0f, 10, 2, "Scaling factor for motion vectors, actually 'shutter speed' in frames");
- }
- return 76;
-}
-
-static int node_composit_buts_filter(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- uiBut *bt;
-
- /* blend type */
- bt=uiDefButS(block, MENU, B_NODE_EXEC+node->nr, "Soften %x0|Sharpen %x1|Laplace %x2|Sobel %x3|Prewitt %x4|Kirsch %x5|Shadow %x6",
- butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
- &node->custom1, 0, 0, 0, 0, "");
- uiButSetFunc(bt, node_but_title_cb, node, bt);
- }
- return 20;
-}
-
-static int node_composit_buts_flip(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- uiBut *bt;
-
- /* flip x\y */
- bt=uiDefButS(block, MENU, B_NODE_EXEC+node->nr, "Flip X %x0|Flip Y %x1|Flip X & Y %x2",
- butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
- &node->custom1, 0, 0, 0, 0, "");
- uiButSetFunc(bt, node_but_title_cb, node, bt);
- }
- return 20;
-}
-
-static int node_composit_buts_crop(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- NodeTwoXYs *ntxy= node->storage;
- uiBut *bt;
- char elementheight = 19;
- short dx= (butr->xmax-butr->xmin)/2;
- short dy= butr->ymax - elementheight;
- short xymin= 0, xymax= 10000;
-
- uiBlockBeginAlign(block);
-
- /* crop image size toggle */
- uiDefButS(block, TOG, B_NODE_EXEC+node->nr, "Crop Image Size",
- butr->xmin, dy, dx*2, elementheight,
- &node->custom1, 0, 0, 0, 0, "Crop the size of the input image.");
-
- dy-=elementheight;
-
- /* x1 */
- bt=uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "X1:",
- butr->xmin, dy, dx, elementheight,
- &ntxy->x1, xymin, xymax, 0, 0, "");
- /* y1 */
- bt=uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Y1:",
- butr->xmin+dx, dy, dx, elementheight,
- &ntxy->y1, xymin, xymax, 0, 0, "");
-
- dy-=elementheight;
-
- /* x2 */
- bt=uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "X2:",
- butr->xmin, dy, dx, elementheight,
- &ntxy->x2, xymin, xymax, 0, 0, "");
- /* y2 */
- bt=uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Y2:",
- butr->xmin+dx, dy, dx, elementheight,
- &ntxy->y2, xymin, xymax, 0, 0, "");
-
- uiBlockEndAlign(block);
- }
- return 60;
-}
-
-static int node_composit_buts_splitviewer(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- uiBlockBeginAlign(block);
-
- uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "X",
- butr->xmin, butr->ymin+19, (butr->xmax-butr->xmin)/2, 20,
- &node->custom2, 0.0, 0.0, 0, 0, "");
- uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "Y",
- butr->xmin+(butr->xmax-butr->xmin)/2, butr->ymin+19, (butr->xmax-butr->xmin)/2, 20,
- &node->custom2, 0.0, 1.0, 0, 0, "");
-
- uiDefButS(block, NUMSLI, B_NODE_EXEC+node->nr, "Split %: ",
- butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, &node->custom1, 0, 100, 10, 0, "");
- }
- return 40;
-}
-
-static int node_composit_buts_map_value(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- TexMapping *texmap= node->storage;
- short xstart= (short)butr->xmin;
- short dy= (short)(butr->ymax-19.0f);
- short dx= (short)(butr->xmax-butr->xmin)/2;
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Offs:", xstart, dy, 2*dx, 19, texmap->loc, -1000.0f, 1000.0f, 10, 2, "");
- dy-= 19;
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Size:", xstart, dy, 2*dx, 19, texmap->size, -1000.0f, 1000.0f, 10, 3, "");
- dy-= 23;
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, TEXMAP_CLIP_MIN, B_NODE_EXEC+node->nr, "Min", xstart, dy, dx, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, "");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", xstart+dx, dy, dx, 19, texmap->min, -1000.0f, 1000.0f, 10, 2, "");
- dy-= 19;
- uiDefButBitI(block, TOG, TEXMAP_CLIP_MAX, B_NODE_EXEC+node->nr, "Max", xstart, dy, dx, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, "");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", xstart+dx, dy, dx, 19, texmap->max, -1000.0f, 1000.0f, 10, 2, "");
- }
- return 80;
-}
-
-static int node_composit_buts_alphaover(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
-
- /* alpha type */
- uiDefButS(block, TOG, B_NODE_EXEC+node->nr, "ConvertPremul",
- butr->xmin, butr->ymin, butr->xmax-butr->xmin, 19,
- &node->custom1, 0, 0, 0, 0, "");
- }
- return 19;
-}
-
-static int node_composit_buts_hue_sat(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- NodeHueSat *nhs= node->storage;
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Hue: ",
- butr->xmin, butr->ymin+40.0f, butr->xmax-butr->xmin, 20,
- &nhs->hue, 0.0f, 1.0f, 100, 0, "");
- uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Sat: ",
- butr->xmin, butr->ymin+20.0f, butr->xmax-butr->xmin, 20,
- &nhs->sat, 0.0f, 2.0f, 100, 0, "");
- uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Val: ",
- butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
- &nhs->val, 0.0f, 2.0f, 100, 0, "");
- }
- return 60;
-}
-
-static int node_composit_buts_dilateerode(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Distance:",
- butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
- &node->custom2, -100, 100, 0, 0, "Distance to grow/shrink (number of iterations)");
- }
- return 20;
-}
-
-static int node_composit_buts_diff_matte(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- short sx= (butr->xmax-butr->xmin)/4;
- short dx= (butr->xmax-butr->xmin)/3;
- NodeChroma *c= node->storage;
-
- uiBlockBeginAlign(block);
- /*color space selectors*/
- uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"RGB",
- butr->xmin,butr->ymin+60,sx,20,
- &node->custom1,1,1, 0, 0, "RGB Color Space");
- uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"HSV",
- butr->xmin+sx,butr->ymin+60,sx,20,
- &node->custom1,1,2, 0, 0, "HSV Color Space");
- uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"YUV",
- butr->xmin+2*sx,butr->ymin+60,sx,20,
- &node->custom1,1,3, 0, 0, "YUV Color Space");
- uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"YCC",
- butr->xmin+3*sx,butr->ymin+60,sx,20,
- &node->custom1,1,4, 0, 0, "YCbCr Color Space");
- /*channel tolorences*/
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, " ",
- butr->xmin, butr->ymin+40, dx, 20,
- &c->t1, 0.0f, 1.0f, 100, 0, "Channel 1 Tolerance");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, " ",
- butr->xmin+dx, butr->ymin+40, dx, 20,
- &c->t2, 0.0f, 1.0f, 100, 0, "Channel 2 Tolorence");
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, " ",
- butr->xmin+2*dx, butr->ymin+40, dx, 20,
- &c->t3, 0.0f, 1.0f, 100, 0, "Channel 3 Tolorence");
- /*falloff parameters*/
- /*
- uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Falloff Size ",
- butr->xmin, butr->ymin+20, butr->xmax-butr->xmin, 20,
- &c->fsize, 0.0f, 1.0f, 100, 0, "");
- */
- uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Falloff: ",
- butr->xmin, butr->ymin+20, butr->xmax-butr->xmin, 20,
- &c->fstrength, 0.0f, 1.0f, 100, 0, "");
- }
- return 80;
-}
-
-static int node_composit_buts_color_spill(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- short dx= (butr->xmax-butr->xmin)/3;
-
- NodeChroma *c=node->storage;
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Enhance: ",
- butr->xmin, butr->ymin+20.0, butr->xmax-butr->xmin, 20,
- &c->t1, 0.0f, 0.5f, 100, 2, "Adjusts how much selected channel is affected by color spill algorithm");
- uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "R",
- butr->xmin,butr->ymin,dx,20,
- &node->custom1,1,1, 0, 0, "Red Spill Suppression");
- uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "G",
- butr->xmin+dx,butr->ymin,dx,20,
- &node->custom1,1,2, 0, 0, "Green Spill Suppression");
- uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "B",
- butr->xmin+2*dx,butr->ymin,dx,20,
- &node->custom1, 1, 3, 0, 0, "Blue Spill Suppression");
- uiBlockEndAlign(block);
- }
- return 60;
- }
-
-static int node_composit_buts_chroma_matte(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- short dx=(butr->xmax-butr->xmin)/2;
- NodeChroma *c= node->storage;
- uiBlockBeginAlign(block);
-
- uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Acceptance ",
- butr->xmin, butr->ymin+60, butr->xmax-butr->xmin, 20,
- &c->t1, 1.0f, 80.0f, 100, 0, "Tolerance for colors to be considered a keying color");
- uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Cutoff ",
- butr->xmin, butr->ymin+40, butr->xmax-butr->xmin, 20,
- &c->t2, 0.0f, 30.0f, 100, 0, "Colors below this will be considered as exact matches for keying color");
-
- uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Lift ",
- butr->xmin, butr->ymin+20, dx, 20,
- &c->fsize, 0.0f, 1.0f, 100, 0, "Alpha Lift");
- uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Gain ",
- butr->xmin+dx, butr->ymin+20, dx, 20,
- &c->fstrength, 0.0f, 1.0f, 100, 0, "Alpha Gain");
-
- uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Shadow Adjust ",
- butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
- &c->t3, 0.0f, 1.0f, 100, 0, "Adjusts the brightness of any shadows captured");
-
- if(c->t2 > c->t1)
- c->t2=c->t1;
- }
- return 80;
-}
-
-static int node_composit_buts_channel_matte(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- short sx= (butr->xmax-butr->xmin)/4;
- short cx= (butr->xmax-butr->xmin)/3;
- NodeChroma *c=node->storage;
- char *c1, *c2, *c3;
-
- /*color space selectors*/
- uiBlockBeginAlign(block);
- uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"RGB",
- butr->xmin,butr->ymin+60,sx,20,&node->custom1,1,1, 0, 0, "RGB Color Space");
- uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"HSV",
- butr->xmin+sx,butr->ymin+60,sx,20,&node->custom1,1,2, 0, 0, "HSV Color Space");
- uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"YUV",
- butr->xmin+2*sx,butr->ymin+60,sx,20,&node->custom1,1,3, 0, 0, "YUV Color Space");
- uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"YCC",
- butr->xmin+3*sx,butr->ymin+60,sx,20,&node->custom1,1,4, 0, 0, "YCbCr Color Space");
-
- if (node->custom1==1) {
- c1="R"; c2="G"; c3="B";
- }
- else if(node->custom1==2){
- c1="H"; c2="S"; c3="V";
- }
- else if(node->custom1==3){
- c1="Y"; c2="U"; c3="V";
- }
- else { // if(node->custom1==4){
- c1="Y"; c2="Cb"; c3="Cr";
- }
-
- /*channel selector */
- uiDefButS(block, ROW, B_NODE_EXEC+node->nr, c1,
- butr->xmin,butr->ymin+40,cx,20,&node->custom2,1, 1, 0, 0, "Channel 1");
- uiDefButS(block, ROW, B_NODE_EXEC+node->nr, c2,
- butr->xmin+cx,butr->ymin+40,cx,20,&node->custom2,1, 2, 0, 0, "Channel 2");
- uiDefButS(block, ROW, B_NODE_EXEC+node->nr, c3,
- butr->xmin+cx+cx,butr->ymin+40,cx,20,&node->custom2, 1, 3, 0, 0, "Channel 3");
-
- /*tolerance sliders */
- uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "High ",
- butr->xmin, butr->ymin+20.0, butr->xmax-butr->xmin, 20,
- &c->t1, 0.0f, 1.0f, 100, 0, "Values higher than this setting are 100% opaque");
- uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Low ",
- butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
- &c->t2, 0.0f, 1.0f, 100, 0, "Values lower than this setting are 100% keyed");
- uiBlockEndAlign(block);
-
- /*keep t2 (low) less than t1 (high) */
- if(c->t2 > c->t1) {
- c->t2=c->t1;
- }
- }
- return 80;
-}
-
-static int node_composit_buts_luma_matte(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- NodeChroma *c=node->storage;
-
- /*tolerance sliders */
- uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "High ",
- butr->xmin, butr->ymin+20.0, butr->xmax-butr->xmin, 20,
- &c->t1, 0.0f, 1.0f, 100, 0, "Values higher than this setting are 100% opaque");
- uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Low ",
- butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
- &c->t2, 0.0f, 1.0f, 100, 0, "Values lower than this setting are 100% keyed");
- uiBlockEndAlign(block);
-
- /*keep t2 (low) less than t1 (high) */
- if(c->t2 > c->t1) {
- c->t2=c->t1;
- }
- }
- return 40;
-}
-
-static int node_composit_buts_map_uv(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Alpha:",
- butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
- &node->custom1, 0, 100, 0, 0, "Conversion percentage of UV differences to Alpha");
- }
- return 20;
-}
-
-static int node_composit_buts_id_mask(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "ID:",
- butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
- &node->custom1, 0, 10000, 0, 0, "Pass Index number to convert to Alpha");
- }
- return 20;
-}
-
-
-/* allocate sufficient! */
-static void node_imagetype_string(char *str)
-{
- str += sprintf(str, "Save Image as: %%t|");
- str += sprintf(str, "Targa %%x%d|", R_TARGA);
- str += sprintf(str, "Targa Raw %%x%d|", R_RAWTGA);
- str += sprintf(str, "PNG %%x%d|", R_PNG);
- str += sprintf(str, "BMP %%x%d|", R_BMP);
- str += sprintf(str, "Jpeg %%x%d|", R_JPEG90);
- str += sprintf(str, "Iris %%x%d|", R_IRIS);
- str += sprintf(str, "Radiance HDR %%x%d|", R_RADHDR);
- str += sprintf(str, "Cineon %%x%d|", R_CINEON);
- str += sprintf(str, "DPX %%x%d|", R_DPX);
- str += sprintf(str, "OpenEXR %%x%d", R_OPENEXR);
-}
-
-static int node_composit_buts_file_output(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- NodeImageFile *nif= node->storage;
- short x= (short)butr->xmin;
- short y= (short)butr->ymin;
- short w= (short)butr->xmax-butr->xmin;
- char str[320];
-
- node_imagetype_string(str);
-
- uiBlockBeginAlign(block);
-
- uiDefBut(block, TEX, B_NOP, "",
- x, y+60, w, 20,
- nif->name, 0.0f, 240.0f, 0, 0, "");
-
- uiDefButS(block, MENU, B_NOP, str,
- x, y+40, w, 20,
- &nif->imtype, 0.0f, 1.0f, 0, 0, "");
-
- if(nif->imtype==R_OPENEXR) {
- uiDefButBitS(block, TOG, R_OPENEXR_HALF, B_REDR, "Half",
- x, y+20, w/2, 20,
- &nif->subimtype, 0, 0, 0, 0, "");
-
- uiDefButS(block, MENU,B_NOP, "Codec %t|None %x0|Pxr24 (lossy) %x1|ZIP (lossless) %x2|PIZ (lossless) %x3|RLE (lossless) %x4",
- x+w/2, y+20, w/2, 20,
- &nif->codec, 0, 0, 0, 0, "");
- }
- else {
- uiDefButS(block, NUM, B_NOP, "Quality: ",
- x, y+20, w, 20,
- &nif->quality, 10.0f, 100.0f, 10, 0, "");
- }
-
- /* start frame, end frame */
- uiDefButI(block, NUM, B_NODE_EXEC+node->nr, "SFra: ",
- x, y, w/2, 20,
- &nif->sfra, 1, MAXFRAMEF, 10, 0, "");
- uiDefButI(block, NUM, B_NODE_EXEC+node->nr, "EFra: ",
- x+w/2, y, w/2, 20,
- &nif->efra, 1, MAXFRAMEF, 10, 0, "");
-
- }
- return 80;
-}
-
-static void node_scale_cb(void *node_v, void *unused_v)
-{
- bNode *node= node_v;
- bNodeSocket *nsock;
-
- /* check the 2 inputs, and set them to reasonable values */
- for(nsock= node->inputs.first; nsock; nsock= nsock->next) {
- if(ELEM(node->custom1, CMP_SCALE_RELATIVE, CMP_SCALE_SCENEPERCENT))
- nsock->ns.vec[0]= 1.0;
- else {
- if(nsock->next==NULL)
- nsock->ns.vec[0]= (float)G.scene->r.ysch;
- else
- nsock->ns.vec[0]= (float)G.scene->r.xsch;
- }
- }
-}
-
-static int node_composit_buts_scale(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- uiBut *bt= uiDefButS(block, MENU, B_NODE_EXEC+node->nr, "Relative %x0|Absolute %x1|Scene Size % %x2|",
- butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
- &node->custom1, 0, 0, 0, 0, "Scale new image to absolute pixel size, size relative to the incoming image, or using the 'percent' size of the scene");
- uiButSetFunc(bt, node_scale_cb, node, NULL);
- }
- return 20;
-}
-
-static int node_composit_buts_invert(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
- if(block) {
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, CMP_CHAN_RGB, B_NODE_EXEC+node->nr, "RGB",
- butr->xmin, butr->ymin, (butr->xmax-butr->xmin)/2, 20,
- &node->custom1, 0, 0, 0, 0, "");
- uiDefButBitS(block, TOG, CMP_CHAN_A, B_NODE_EXEC+node->nr, "A",
- butr->xmin+(butr->xmax-butr->xmin)/2, butr->ymin, (butr->xmax-butr->xmin)/2, 20,
- &node->custom1, 0, 0, 0, 0, "");
- uiBlockEndAlign(block);
- }
- return 20;
-}
-
-/* only once called */
-static void node_composit_set_butfunc(bNodeType *ntype)
-{
- switch(ntype->type) {
- /* case NODE_GROUP: note, typeinfo for group is generated... see "XXX ugly hack" */
-
- case CMP_NODE_IMAGE:
- ntype->butfunc= node_composit_buts_image;
- break;
- case CMP_NODE_R_LAYERS:
- ntype->butfunc= node_composit_buts_renderlayers;
- break;
- case CMP_NODE_NORMAL:
- ntype->butfunc= node_buts_normal;
- break;
- case CMP_NODE_CURVE_VEC:
- ntype->butfunc= node_buts_curvevec;
- break;
- case CMP_NODE_CURVE_RGB:
- ntype->butfunc= node_buts_curvecol;
- break;
- case CMP_NODE_VALUE:
- ntype->butfunc= node_buts_value;
- break;
- case CMP_NODE_RGB:
- ntype->butfunc= node_buts_rgb;
- break;
- case CMP_NODE_FLIP:
- ntype->butfunc= node_composit_buts_flip;
- break;
- case CMP_NODE_SPLITVIEWER:
- ntype->butfunc= node_composit_buts_splitviewer;
- break;
- case CMP_NODE_MIX_RGB:
- ntype->butfunc= node_buts_mix_rgb;
- break;
- case CMP_NODE_VALTORGB:
- ntype->butfunc= node_buts_valtorgb;
- break;
- case CMP_NODE_CROP:
- ntype->butfunc= node_composit_buts_crop;
- break;
- case CMP_NODE_BLUR:
- ntype->butfunc= node_composit_buts_blur;
- break;
- /* qdn: defocus node */
- case CMP_NODE_DEFOCUS:
- ntype->butfunc = node_composit_buts_defocus;
- break;
- /* qdn: glare node */
- case CMP_NODE_GLARE:
- ntype->butfunc = node_composit_buts_glare;
- break;
- /* qdn: tonemap node */
- case CMP_NODE_TONEMAP:
- ntype->butfunc = node_composit_buts_tonemap;
- break;
- /* qdn: lens distortion node */
- case CMP_NODE_LENSDIST:
- ntype->butfunc = node_composit_buts_lensdist;
- break;
- case CMP_NODE_VECBLUR:
- ntype->butfunc= node_composit_buts_vecblur;
- break;
- case CMP_NODE_FILTER:
- ntype->butfunc= node_composit_buts_filter;
- break;
- case CMP_NODE_MAP_VALUE:
- ntype->butfunc= node_composit_buts_map_value;
- break;
- case CMP_NODE_TIME:
- ntype->butfunc= node_buts_time;
- break;
- case CMP_NODE_ALPHAOVER:
- ntype->butfunc= node_composit_buts_alphaover;
- break;
- case CMP_NODE_HUE_SAT:
- ntype->butfunc= node_composit_buts_hue_sat;
- break;
- case CMP_NODE_TEXTURE:
- ntype->butfunc= node_buts_texture;
- break;
- case CMP_NODE_DILATEERODE:
- ntype->butfunc= node_composit_buts_dilateerode;
- break;
- case CMP_NODE_OUTPUT_FILE:
- ntype->butfunc= node_composit_buts_file_output;
- break;
-
- case CMP_NODE_DIFF_MATTE:
- ntype->butfunc=node_composit_buts_diff_matte;
- break;
- case CMP_NODE_COLOR_SPILL:
- ntype->butfunc=node_composit_buts_color_spill;
- break;
- case CMP_NODE_CHROMA:
- ntype->butfunc=node_composit_buts_chroma_matte;
- break;
- case CMP_NODE_SCALE:
- ntype->butfunc= node_composit_buts_scale;
- break;
- case CMP_NODE_CHANNEL_MATTE:
- ntype->butfunc= node_composit_buts_channel_matte;
- break;
- case CMP_NODE_LUMA_MATTE:
- ntype->butfunc= node_composit_buts_luma_matte;
- break;
- case CMP_NODE_MAP_UV:
- ntype->butfunc= node_composit_buts_map_uv;
- break;
- case CMP_NODE_ID_MASK:
- ntype->butfunc= node_composit_buts_id_mask;
- break;
- case CMP_NODE_MATH:
- ntype->butfunc= node_buts_math;
- break;
- case CMP_NODE_INVERT:
- ntype->butfunc= node_composit_buts_invert;
- break;
- default:
- ntype->butfunc= NULL;
- }
-}
-
-
-/* ******* init draw callbacks for all tree types, only called in usiblender.c, once ************* */
-
-void init_node_butfuncs(void)
-{
- bNodeType *ntype;
-
- /* shader nodes */
- ntype= node_all_shaders.first;
- while(ntype) {
- node_shader_set_butfunc(ntype);
- ntype= ntype->next;
- }
- /* composit nodes */
- ntype= node_all_composit.first;
- while(ntype) {
- node_composit_set_butfunc(ntype);
- ntype= ntype->next;
- }
-}
-
-/* ************** Generic drawing ************** */
-
-static void draw_nodespace_grid(SpaceNode *snode)
-{
- float start, step= 25.0f;
-
- BIF_ThemeColorShade(TH_BACK, -10);
-
- start= snode->v2d.cur.xmin -fmod(snode->v2d.cur.xmin, step);
-
- glBegin(GL_LINES);
- for(; start<snode->v2d.cur.xmax; start+=step) {
- glVertex2f(start, snode->v2d.cur.ymin);
- glVertex2f(start, snode->v2d.cur.ymax);
- }
-
- start= snode->v2d.cur.ymin -fmod(snode->v2d.cur.ymin, step);
- for(; start<snode->v2d.cur.ymax; start+=step) {
- glVertex2f(snode->v2d.cur.xmin, start);
- glVertex2f(snode->v2d.cur.xmax, start);
- }
-
- /* X and Y axis */
- BIF_ThemeColorShade(TH_BACK, -18);
- glVertex2f(0.0f, snode->v2d.cur.ymin);
- glVertex2f(0.0f, snode->v2d.cur.ymax);
- glVertex2f(snode->v2d.cur.xmin, 0.0f);
- glVertex2f(snode->v2d.cur.xmax, 0.0f);
-
- glEnd();
-}
-
-static void draw_nodespace_back(ScrArea *sa, SpaceNode *snode)
-{
-
- draw_nodespace_grid(snode);
-
- if(snode->flag & SNODE_BACKDRAW) {
- Image *ima= BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node");
- ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
- if(ibuf) {
- int x, y;
- float zoom = 1.0;
-
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
-
- glaDefine2DArea(&sa->winrct);
-
- if(ibuf->x > sa->winx || ibuf->y > sa->winy) {
- float zoomx, zoomy;
- zoomx= (float)sa->winx/ibuf->x;
- zoomy= (float)sa->winy/ibuf->y;
- zoom = MIN2(zoomx, zoomy);
- }
-
- x = (sa->winx-zoom*ibuf->x)/2 + snode->xof;
- y = (sa->winy-zoom*ibuf->y)/2 + snode->yof;
-
- glPixelZoom(zoom, zoom);
-
- glColor4f(1.0, 1.0, 1.0, 1.0);
- if(ibuf->rect)
- glaDrawPixelsTex(x, y, ibuf->x, ibuf->y, GL_UNSIGNED_BYTE, ibuf->rect);
- else if(ibuf->channels==4)
- glaDrawPixelsTex(x, y, ibuf->x, ibuf->y, GL_FLOAT, ibuf->rect_float);
-
- glPixelZoom(1.0, 1.0);
-
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
- }
- }
-}
-
-/* nice AA filled circle */
-static void socket_circle_draw(float x, float y, float size, int type, int select)
-{
- /* 16 values of sin function */
- static float si[16] = {
- 0.00000000, 0.39435585,0.72479278,0.93775213,
- 0.99871650,0.89780453,0.65137248,0.29936312,
- -0.10116832,-0.48530196,-0.79077573,-0.96807711,
- -0.98846832,-0.84864425,-0.57126821,-0.20129852
- };
- /* 16 values of cos function */
- static float co[16] ={
- 1.00000000,0.91895781,0.68896691,0.34730525,
- -0.05064916,-0.44039415,-0.75875812,-0.95413925,
- -0.99486932,-0.87434661,-0.61210598,-0.25065253,
- 0.15142777,0.52896401,0.82076344,0.97952994,
- };
- int a;
-
- if(select==0) {
- if(type==-1)
- glColor3ub(0, 0, 0);
- else if(type==SOCK_VALUE)
- glColor3ub(160, 160, 160);
- else if(type==SOCK_VECTOR)
- glColor3ub(100, 100, 200);
- else if(type==SOCK_RGBA)
- glColor3ub(200, 200, 40);
- else
- glColor3ub(100, 200, 100);
- }
- else {
- if(type==SOCK_VALUE)
- glColor3ub(200, 200, 200);
- else if(type==SOCK_VECTOR)
- glColor3ub(140, 140, 240);
- else if(type==SOCK_RGBA)
- glColor3ub(240, 240, 100);
- else
- glColor3ub(140, 240, 140);
- }
-
- glBegin(GL_POLYGON);
- for(a=0; a<16; a++)
- glVertex2f(x+size*si[a], y+size*co[a]);
- glEnd();
-
- glColor4ub(0, 0, 0, 150);
- glEnable(GL_BLEND);
- glEnable( GL_LINE_SMOOTH );
- glBegin(GL_LINE_LOOP);
- for(a=0; a<16; a++)
- glVertex2f(x+size*si[a], y+size*co[a]);
- glEnd();
- glDisable( GL_LINE_SMOOTH );
- glDisable(GL_BLEND);
-}
-
-/* not a callback */
-static void node_draw_preview(bNodePreview *preview, rctf *prv)
-{
- float xscale= (prv->xmax-prv->xmin)/((float)preview->xsize);
- float yscale= (prv->ymax-prv->ymin)/((float)preview->ysize);
- float tile= (prv->xmax - prv->xmin) / 10.0;
- float x, y;
-
- /* draw checkerboard backdrop to show alpha */
- glColor3ub(120, 120, 120);
- glRectf(prv->xmin, prv->ymin, prv->xmax, prv->ymax);
- glColor3ub(160, 160, 160);
-
- for(y=prv->ymin; y<prv->ymax; y+=tile*2) {
- for(x=prv->xmin; x<prv->xmax; x+=tile*2) {
- float tilex= tile, tiley= tile;
-
- if(x+tile > prv->xmax)
- tilex= prv->xmax-x;
- if(y+tile > prv->ymax)
- tiley= prv->ymax-y;
-
- glRectf(x, y, x + tilex, y + tiley);
- }
- }
- for(y=prv->ymin+tile; y<prv->ymax; y+=tile*2) {
- for(x=prv->xmin+tile; x<prv->xmax; x+=tile*2) {
- float tilex= tile, tiley= tile;
-
- if(x+tile > prv->xmax)
- tilex= prv->xmax-x;
- if(y+tile > prv->ymax)
- tiley= prv->ymax-y;
-
- glRectf(x, y, x + tilex, y + tiley);
- }
- }
-
- glPixelZoom(xscale, yscale);
- glEnable(GL_BLEND);
- glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA ); /* premul graphics */
-
- glColor4f(1.0, 1.0, 1.0, 1.0);
- glaDrawPixelsTex(prv->xmin, prv->ymin, preview->xsize, preview->ysize, GL_FLOAT, preview->rect);
-
- glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
- glDisable(GL_BLEND);
- glPixelZoom(1.0f, 1.0f);
-
- BIF_ThemeColorShadeAlpha(TH_BACK, -15, +100);
- fdrawbox(prv->xmin, prv->ymin, prv->xmax, prv->ymax);
-
-}
-
-/* based on settings in node, sets drawing rect info. each redraw! */
-static void node_update_hidden(bNode *node)
-{
- bNodeSocket *nsock;
- float rad, drad, hiddenrad= HIDDEN_RAD;
- int totin=0, totout=0, tot;
-
- /* calculate minimal radius */
- for(nsock= node->inputs.first; nsock; nsock= nsock->next)
- if(!(nsock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL)))
- totin++;
- for(nsock= node->outputs.first; nsock; nsock= nsock->next)
- if(!(nsock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL)))
- totout++;
-
- tot= MAX2(totin, totout);
- if(tot>4) {
- hiddenrad += 5.0*(float)(tot-4);
- }
-
- node->totr.xmin= node->locx;
- node->totr.xmax= node->locx + 3*hiddenrad + node->miniwidth;
- node->totr.ymax= node->locy + (hiddenrad - 0.5f*NODE_DY);
- node->totr.ymin= node->totr.ymax - 2*hiddenrad;
-
- /* output sockets */
- rad=drad= M_PI/(1.0f + (float)totout);
-
- for(nsock= node->outputs.first; nsock; nsock= nsock->next) {
- if(!(nsock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL))) {
- nsock->locx= node->totr.xmax - hiddenrad + sin(rad)*hiddenrad;
- nsock->locy= node->totr.ymin + hiddenrad + cos(rad)*hiddenrad;
- rad+= drad;
- }
- }
-
- /* input sockets */
- rad=drad= - M_PI/(1.0f + (float)totin);
-
- for(nsock= node->inputs.first; nsock; nsock= nsock->next) {
- if(!(nsock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL))) {
- nsock->locx= node->totr.xmin + hiddenrad + sin(rad)*hiddenrad;
- nsock->locy= node->totr.ymin + hiddenrad + cos(rad)*hiddenrad;
- rad+= drad;
- }
- }
-}
-
-/* based on settings in node, sets drawing rect info. each redraw! */
-static void node_update(bNode *node)
-{
- bNodeSocket *nsock;
- float dy= node->locy;
-
- /* header */
- dy-= NODE_DY;
-
- /* little bit space in top */
- if(node->outputs.first)
- dy-= NODE_DYS/2;
-
- /* output sockets */
- for(nsock= node->outputs.first; nsock; nsock= nsock->next) {
- if(!(nsock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL))) {
- nsock->locx= node->locx + node->width;
- nsock->locy= dy - NODE_DYS;
- dy-= NODE_DY;
- }
- }
-
- node->prvr.xmin= node->butr.xmin= node->locx + NODE_DYS;
- node->prvr.xmax= node->butr.xmax= node->locx + node->width- NODE_DYS;
-
- /* preview rect? */
- if(node->flag & NODE_PREVIEW) {
- /* only recalculate size when there's a preview actually, otherwise we use stored result */
- if(node->preview && node->preview->rect) {
- float aspect= 1.0f;
-
- if(node->preview && node->preview->xsize && node->preview->ysize)
- aspect= (float)node->preview->ysize/(float)node->preview->xsize;
-
- dy-= NODE_DYS/2;
- node->prvr.ymax= dy;
-
- if(aspect <= 1.0f)
- node->prvr.ymin= dy - aspect*(node->width-NODE_DY);
- else {
- float dx= (node->width - NODE_DYS) - (node->width- NODE_DYS)/aspect; /* width correction of image */
-
- node->prvr.ymin= dy - (node->width-NODE_DY);
-
- node->prvr.xmin+= 0.5*dx;
- node->prvr.xmax-= 0.5*dx;
- }
-
- dy= node->prvr.ymin - NODE_DYS/2;
-
- /* make sure that maximums are bigger or equal to minimums */
- if(node->prvr.xmax < node->prvr.xmin) SWAP(float, node->prvr.xmax, node->prvr.xmin);
- if(node->prvr.ymax < node->prvr.ymin) SWAP(float, node->prvr.ymax, node->prvr.ymin);
- }
- else {
- float oldh= node->prvr.ymax - node->prvr.ymin;
- if(oldh==0.0f)
- oldh= 0.6f*node->width-NODE_DY;
- dy-= NODE_DYS/2;
- node->prvr.ymax= dy;
- node->prvr.ymin= dy - oldh;
- dy= node->prvr.ymin - NODE_DYS/2;
- }
- }
-
- /* XXX ugly hack, typeinfo for group is generated */
- if(node->type == NODE_GROUP)
- node->typeinfo->butfunc= node_buts_group;
-
- /* buttons rect? */
- if((node->flag & NODE_OPTIONS) && node->typeinfo->butfunc) {
- dy-= NODE_DYS/2;
- node->butr.ymax= dy;
- node->butr.ymin= dy - (float)node->typeinfo->butfunc(NULL, NULL, node, NULL);
- dy= node->butr.ymin - NODE_DYS/2;
- }
-
- /* input sockets */
- for(nsock= node->inputs.first; nsock; nsock= nsock->next) {
- if(!(nsock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL))) {
- nsock->locx= node->locx;
- nsock->locy= dy - NODE_DYS;
- dy-= NODE_DY;
- }
- }
-
- /* little bit space in end */
- if(node->inputs.first || (node->flag & (NODE_OPTIONS|NODE_PREVIEW))==0 )
- dy-= NODE_DYS/2;
-
- node->totr.xmin= node->locx;
- node->totr.xmax= node->locx + node->width;
- node->totr.ymax= node->locy;
- node->totr.ymin= dy;
-}
-
-/* based on settings in node, sets drawing rect info. each redraw! */
-/* note: this assumes only 1 group at a time is drawn (linked data) */
-/* in node->totr the entire boundbox for the group is stored */
-static void node_update_group(bNode *gnode)
-{
- bNodeTree *ngroup= (bNodeTree *)gnode->id;
- bNode *node;
- bNodeSocket *nsock;
- rctf *rect= &gnode->totr;
- int counter;
-
- /* center them, is a bit of abuse of locx and locy though */
- for(node= ngroup->nodes.first; node; node= node->next) {
- node->locx+= gnode->locx;
- node->locy+= gnode->locy;
- if(node->flag & NODE_HIDDEN)
- node_update_hidden(node);
- else
- node_update(node);
- node->locx-= gnode->locx;
- node->locy-= gnode->locy;
- }
- counter= 1;
- for(node= ngroup->nodes.first; node; node= node->next) {
- if(counter) {
- *rect= node->totr;
- counter= 0;
- }
- else
- BLI_union_rctf(rect, &node->totr);
- }
- if(counter==1) return; /* should be prevented? */
-
- rect->xmin-= NODE_DY;
- rect->ymin-= NODE_DY;
- rect->xmax+= NODE_DY;
- rect->ymax+= NODE_DY;
-
- /* output sockets */
- for(nsock= gnode->outputs.first; nsock; nsock= nsock->next) {
- nsock->locx= rect->xmax;
- nsock->locy= nsock->tosock->locy;
- }
-
- /* input sockets */
- for(nsock= gnode->inputs.first; nsock; nsock= nsock->next) {
- nsock->locx= rect->xmin;
- nsock->locy= nsock->tosock->locy;
- }
-}
-
-static void node_scaling_widget(int color_id, float aspect, float xmin, float ymin, float xmax, float ymax)
-{
- float dx;
- float dy;
-
- dx= 0.5f*(xmax-xmin);
- dy= 0.5f*(ymax-ymin);
-
- BIF_ThemeColorShade(color_id, +30);
- fdrawline(xmin, ymin, xmax, ymax);
- fdrawline(xmin+dx, ymin, xmax, ymax-dy);
-
- BIF_ThemeColorShade(color_id, -10);
- fdrawline(xmin, ymin+aspect, xmax, ymax+aspect);
- fdrawline(xmin+dx, ymin+aspect, xmax, ymax-dy+aspect);
-}
-
-static int node_get_colorid(bNode *node)
-{
- if(node->typeinfo->nclass==NODE_CLASS_INPUT)
- return TH_NODE_IN_OUT;
- if(node->typeinfo->nclass==NODE_CLASS_OUTPUT) {
- if(node->flag & NODE_DO_OUTPUT)
- return TH_NODE_IN_OUT;
- else
- return TH_NODE;
- }
- if(node->typeinfo->nclass==NODE_CLASS_CONVERTOR)
- return TH_NODE_CONVERTOR;
- if(ELEM3(node->typeinfo->nclass, NODE_CLASS_OP_COLOR, NODE_CLASS_OP_VECTOR, NODE_CLASS_OP_FILTER))
- return TH_NODE_OPERATOR;
- if(node->typeinfo->nclass==NODE_CLASS_GROUP)
- return TH_NODE_GROUP;
- return TH_NODE;
-}
-
-static void node_draw_basis(ScrArea *sa, SpaceNode *snode, bNode *node)
-{
- bNodeSocket *sock;
- uiBlock *block= NULL;
- uiBut *bt;
- rctf *rct= &node->totr;
- float slen, iconofs;
- int ofs, color_id= node_get_colorid(node);
-
- uiSetRoundBox(15-4);
- ui_dropshadow(rct, BASIS_RAD, snode->aspect, node->flag & SELECT);
-
- /* header */
- if(color_id==TH_NODE)
- BIF_ThemeColorShade(color_id, -20);
- else
- BIF_ThemeColor(color_id);
-
- uiSetRoundBox(3);
- uiRoundBox(rct->xmin, rct->ymax-NODE_DY, rct->xmax, rct->ymax, BASIS_RAD);
-
- /* show/hide icons, note this sequence is copied in editnode.c */
- iconofs= rct->xmax;
-
- if(node->typeinfo->flag & NODE_PREVIEW) {
- int icon_id;
-
- if(node->flag & (NODE_ACTIVE_ID|NODE_DO_OUTPUT))
- icon_id= ICON_MATERIAL;
- else
- icon_id= ICON_MATERIAL_DEHLT;
- iconofs-= 18.0f;
- glEnable(GL_BLEND);
- BIF_icon_draw_aspect_blended(iconofs, rct->ymax-NODE_DY+2, icon_id, snode->aspect, -60);
- glDisable(GL_BLEND);
- }
- if(node->type == NODE_GROUP) {
-
- iconofs-= 18.0f;
- glEnable(GL_BLEND);
- if(node->id->lib) {
- glPixelTransferf(GL_GREEN_SCALE, 0.7f);
- glPixelTransferf(GL_BLUE_SCALE, 0.3f);
- BIF_icon_draw_aspect(iconofs, rct->ymax-NODE_DY+2, ICON_NODE, snode->aspect);
- glPixelTransferf(GL_GREEN_SCALE, 1.0f);
- glPixelTransferf(GL_BLUE_SCALE, 1.0f);
- }
- else {
- BIF_icon_draw_aspect_blended(iconofs, rct->ymax-NODE_DY+2, ICON_NODE, snode->aspect, -60);
- }
- glDisable(GL_BLEND);
- }
- if(node->typeinfo->flag & NODE_OPTIONS) {
- iconofs-= 18.0f;
- glEnable(GL_BLEND);
- BIF_icon_draw_aspect_blended(iconofs, rct->ymax-NODE_DY+2, ICON_BUTS, snode->aspect, -60);
- glDisable(GL_BLEND);
- }
- { /* always hide/reveil unused sockets */
- int shade;
-
- iconofs-= 18.0f;
- if(node_has_hidden_sockets(node))
- shade= -40;
- else
- shade= -90;
- glEnable(GL_BLEND);
- BIF_icon_draw_aspect_blended(iconofs, rct->ymax-NODE_DY+2, ICON_PLUS, snode->aspect, shade);
- glDisable(GL_BLEND);
- }
-
- /* title */
- if(node->flag & SELECT)
- BIF_ThemeColor(TH_TEXT_HI);
- else
- BIF_ThemeColorBlendShade(TH_TEXT, color_id, 0.4, 10);
-
- /* open/close entirely? */
- ui_draw_tria_icon(rct->xmin+8.0f, rct->ymax-NODE_DY+4.0f, snode->aspect, 'v');
-
- if(node->flag & SELECT)
- BIF_ThemeColor(TH_TEXT_HI);
- else
- BIF_ThemeColor(TH_TEXT);
-
- ui_rasterpos_safe(rct->xmin+19.0f, rct->ymax-NODE_DY+5.0f, snode->aspect);
- snode_drawstring(snode, node->name, (int)(iconofs - rct->xmin-18.0f));
-
- /* body */
- BIF_ThemeColor4(TH_NODE);
- glEnable(GL_BLEND);
- uiSetRoundBox(8);
- uiRoundBox(rct->xmin, rct->ymin, rct->xmax, rct->ymax-NODE_DY, BASIS_RAD);
- glDisable(GL_BLEND);
-
- /* scaling indicator */
- node_scaling_widget(TH_NODE, snode->aspect, rct->xmax-BASIS_RAD*snode->aspect, rct->ymin, rct->xmax, rct->ymin+BASIS_RAD*snode->aspect);
-
- /* outline active emphasis */
- if(node->flag & NODE_ACTIVE) {
- glEnable(GL_BLEND);
- glColor4ub(200, 200, 200, 140);
- uiSetRoundBox(15-4);
- gl_round_box(GL_LINE_LOOP, rct->xmin, rct->ymin, rct->xmax, rct->ymax, BASIS_RAD);
- glDisable(GL_BLEND);
- }
-
- /* we make buttons for input sockets, if... */
- if(node->flag & NODE_OPTIONS) {
- if(node->inputs.first || node->typeinfo->butfunc) {
- char str[32];
-
- /* make unique block name, also used for handling blocks in editnode.c */
- sprintf(str, "node buttons %p", node);
-
- block= uiNewBlock(&sa->uiblocks, str, UI_EMBOSS, UI_HELV, sa->win);
- uiBlockSetFlag(block, UI_BLOCK_NO_HILITE);
- if(snode->id)
- uiSetButLock(snode->id->lib!=NULL, ERROR_LIBDATA_MESSAGE);
- }
- }
-
- /* hurmf... another candidate for callback, have to see how this works first */
- if(node->id && block && snode->treetype==NTREE_SHADER)
- nodeShaderSynchronizeID(node, 0);
-
- /* socket inputs, buttons */
- for(sock= node->inputs.first; sock; sock= sock->next) {
- if(!(sock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL))) {
- socket_circle_draw(sock->locx, sock->locy, NODE_SOCKSIZE, sock->type, sock->flag & SELECT);
-
- if(block && sock->link==NULL) {
- float *butpoin= sock->ns.vec;
-
- if(sock->type==SOCK_VALUE) {
- bt= uiDefButF(block, NUM, B_NODE_EXEC+node->nr, sock->name,
- (short)sock->locx+NODE_DYS, (short)(sock->locy)-9, (short)node->width-NODE_DY, 17,
- butpoin, sock->ns.min, sock->ns.max, 10, 2, "");
- uiButSetFunc(bt, node_sync_cb, snode, node);
- }
- else if(sock->type==SOCK_VECTOR) {
- uiDefBlockBut(block, socket_vector_menu, sock, sock->name,
- (short)sock->locx+NODE_DYS, (short)sock->locy-9, (short)node->width-NODE_DY, 17,
- "");
- }
- else if(block && sock->type==SOCK_RGBA) {
- short labelw= node->width-NODE_DY-40, width;
-
- if(labelw>0) width= 40; else width= node->width-NODE_DY;
-
- bt= uiDefButF(block, COL, B_NODE_EXEC+node->nr, "",
- (short)(sock->locx+NODE_DYS), (short)sock->locy-8, width, 15,
- butpoin, 0, 0, 0, 0, "");
- uiButSetFunc(bt, node_sync_cb, snode, node);
-
- if(labelw>0) uiDefBut(block, LABEL, 0, sock->name,
- (short)(sock->locx+NODE_DYS) + 40, (short)sock->locy-8, labelw, 15,
- NULL, 0, 0, 0, 0, "");
- }
- }
- else {
- BIF_ThemeColor(TH_TEXT);
- ui_rasterpos_safe(sock->locx+8.0f, sock->locy-5.0f, snode->aspect);
- BIF_DrawString(snode->curfont, sock->name, 0);
- }
- }
- }
-
- /* socket outputs */
- for(sock= node->outputs.first; sock; sock= sock->next) {
- if(!(sock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL))) {
- socket_circle_draw(sock->locx, sock->locy, NODE_SOCKSIZE, sock->type, sock->flag & SELECT);
-
- BIF_ThemeColor(TH_TEXT);
- ofs= 0;
- slen= snode->aspect*BIF_GetStringWidth(snode->curfont, sock->name, 0);
- while(slen > node->width) {
- ofs++;
- slen= snode->aspect*BIF_GetStringWidth(snode->curfont, sock->name+ofs, 0);
- }
- ui_rasterpos_safe(sock->locx-8.0f-slen, sock->locy-5.0f, snode->aspect);
- BIF_DrawString(snode->curfont, sock->name+ofs, 0);
- }
- }
-
- /* preview */
- if(node->flag & NODE_PREVIEW)
- if(node->preview && node->preview->rect)
- node_draw_preview(node->preview, &node->prvr);
-
- /* buttons */
- if(node->flag & NODE_OPTIONS) {
- if(block) {
- if(node->typeinfo->butfunc) {
- node->typeinfo->butfunc(block, snode->nodetree, node, &node->butr);
- }
- uiDrawBlock(block);
- }
- }
-
-}
-
-void node_draw_hidden(SpaceNode *snode, bNode *node)
-{
- bNodeSocket *sock;
- rctf *rct= &node->totr;
- float dx, centy= 0.5f*(rct->ymax+rct->ymin);
- float hiddenrad= 0.5f*(rct->ymax-rct->ymin);
- int color_id= node_get_colorid(node);
-
- /* shadow */
- uiSetRoundBox(15);
- ui_dropshadow(rct, hiddenrad, snode->aspect, node->flag & SELECT);
-
- /* body */
- BIF_ThemeColor(color_id);
- uiRoundBox(rct->xmin, rct->ymin, rct->xmax, rct->ymax, hiddenrad);
-
- /* outline active emphasis */
- if(node->flag & NODE_ACTIVE) {
- glEnable(GL_BLEND);
- glColor4ub(200, 200, 200, 140);
- gl_round_box(GL_LINE_LOOP, rct->xmin, rct->ymin, rct->xmax, rct->ymax, hiddenrad);
- glDisable(GL_BLEND);
- }
-
- /* title */
- if(node->flag & SELECT)
- BIF_ThemeColor(TH_TEXT_HI);
- else
- BIF_ThemeColorBlendShade(TH_TEXT, color_id, 0.4, 10);
-
- /* open entirely icon */
- ui_draw_tria_icon(rct->xmin+9.0f, centy-6.0f, snode->aspect, 'h');
-
- if(node->flag & SELECT)
- BIF_ThemeColor(TH_TEXT_HI);
- else
- BIF_ThemeColor(TH_TEXT);
-
- if(node->miniwidth>0.0f) {
- ui_rasterpos_safe(rct->xmin+21.0f, centy-4.0f, snode->aspect);
- snode_drawstring(snode, node->name, (int)(rct->xmax - rct->xmin-18.0f -12.0f));
- }
-
- /* scale widget thing */
- BIF_ThemeColorShade(color_id, -10);
- dx= 10.0f;
- fdrawline(rct->xmax-dx, centy-4.0f, rct->xmax-dx, centy+4.0f);
- fdrawline(rct->xmax-dx-3.0f*snode->aspect, centy-4.0f, rct->xmax-dx-3.0f*snode->aspect, centy+4.0f);
-
- BIF_ThemeColorShade(color_id, +30);
- dx-= snode->aspect;
- fdrawline(rct->xmax-dx, centy-4.0f, rct->xmax-dx, centy+4.0f);
- fdrawline(rct->xmax-dx-3.0f*snode->aspect, centy-4.0f, rct->xmax-dx-3.0f*snode->aspect, centy+4.0f);
-
- /* sockets */
- for(sock= node->inputs.first; sock; sock= sock->next) {
- if(!(sock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL)))
- socket_circle_draw(sock->locx, sock->locy, NODE_SOCKSIZE, sock->type, sock->flag & SELECT);
- }
-
- for(sock= node->outputs.first; sock; sock= sock->next) {
- if(!(sock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL)))
- socket_circle_draw(sock->locx, sock->locy, NODE_SOCKSIZE, sock->type, sock->flag & SELECT);
- }
-}
-
-/* note; this is used for fake links in groups too */
-void node_draw_link(SpaceNode *snode, bNodeLink *link)
-{
- float vec[4][3];
- float dist, spline_step, mx=0.0f, my=0.0f;
- int curve_res, do_shaded= 1, th_col1= TH_WIRE, th_col2= TH_WIRE;
-
- if(link->fromnode==NULL && link->tonode==NULL)
- return;
-
- /* this is dragging link */
- if(link->fromnode==NULL || link->tonode==NULL) {
- short mval[2];
- getmouseco_areawin(mval);
- areamouseco_to_ipoco(G.v2d, mval, &mx, &my);
- BIF_ThemeColor(TH_WIRE);
- do_shaded= 0;
- }
- else {
- /* going to give issues once... */
- if(link->tosock->flag & SOCK_UNAVAIL)
- return;
- if(link->fromsock->flag & SOCK_UNAVAIL)
- return;
-
- /* a bit ugly... but thats how we detect the internal group links */
- if(link->fromnode==link->tonode) {
- BIF_ThemeColorBlend(TH_BACK, TH_WIRE, 0.25f);
- do_shaded= 0;
- }
- else {
- /* check cyclic */
- if(link->fromnode->level >= link->tonode->level && link->tonode->level!=0xFFF) {
- if(link->fromnode->flag & SELECT)
- th_col1= TH_EDGE_SELECT;
- if(link->tonode->flag & SELECT)
- th_col2= TH_EDGE_SELECT;
- }
- else {
- BIF_ThemeColor(TH_REDALERT);
- do_shaded= 0;
- }
- }
- }
-
- vec[0][2]= vec[1][2]= vec[2][2]= vec[3][2]= 0.0; /* only 2d spline, set the Z to 0*/
-
- /* in v0 and v3 we put begin/end points */
- if(link->fromnode) {
- vec[0][0]= link->fromsock->locx;
- vec[0][1]= link->fromsock->locy;
- }
- else {
- vec[0][0]= mx;
- vec[0][1]= my;
- }
- if(link->tonode) {
- vec[3][0]= link->tosock->locx;
- vec[3][1]= link->tosock->locy;
- }
- else {
- vec[3][0]= mx;
- vec[3][1]= my;
- }
-
- dist= 0.5f*ABS(vec[0][0] - vec[3][0]);
-
- /* check direction later, for top sockets */
- vec[1][0]= vec[0][0]+dist;
- vec[1][1]= vec[0][1];
-
- vec[2][0]= vec[3][0]-dist;
- vec[2][1]= vec[3][1];
-
- if( MIN4(vec[0][0], vec[1][0], vec[2][0], vec[3][0]) > G.v2d->cur.xmax); /* clipped */
- else if ( MAX4(vec[0][0], vec[1][0], vec[2][0], vec[3][0]) < G.v2d->cur.xmin); /* clipped */
- else {
- curve_res = 24;
-
- /* we can reuse the dist variable here to increment the GL curve eval amount*/
- dist = 1.0f/curve_res;
- spline_step = 0.0f;
-
- glMap1f(GL_MAP1_VERTEX_3, 0.0, 1.0, 3, 4, vec[0]);
- glBegin(GL_LINE_STRIP);
- while (spline_step < 1.000001f) {
- if(do_shaded)
- BIF_ThemeColorBlend(th_col1, th_col2, spline_step);
- glEvalCoord1f(spline_step);
- spline_step += dist;
- }
- glEnd();
- }
-}
-
-static void node_draw_nodetree(ScrArea *sa, SpaceNode *snode, bNodeTree *ntree)
-{
- bNode *node;
- bNodeLink *link;
- int a;
-
- if(ntree==NULL) return; /* groups... */
-
- /* node lines */
- glEnable(GL_BLEND);
- glEnable( GL_LINE_SMOOTH );
- for(link= ntree->links.first; link; link= link->next)
- node_draw_link(snode, link);
- glDisable(GL_BLEND);
- glDisable( GL_LINE_SMOOTH );
-
- /* not selected first */
- for(a=0, node= ntree->nodes.first; node; node= node->next, a++) {
- node->nr= a; /* index of node in list, used for exec event code */
- if(!(node->flag & SELECT)) {
- if(node->flag & NODE_GROUP_EDIT);
- else if(node->flag & NODE_HIDDEN)
- node_draw_hidden(snode, node);
- else
- node_draw_basis(sa, snode, node);
- }
- }
-
- /* selected */
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->flag & SELECT) {
- if(node->flag & NODE_GROUP_EDIT);
- else if(node->flag & NODE_HIDDEN)
- node_draw_hidden(snode, node);
- else
- node_draw_basis(sa, snode, node);
- }
- }
-}
-
-/* fake links from groupnode to internal nodes */
-static void node_draw_group_links(SpaceNode *snode, bNode *gnode)
-{
- bNodeLink fakelink;
- bNodeSocket *sock;
-
- glEnable(GL_BLEND);
- glEnable( GL_LINE_SMOOTH );
-
- fakelink.tonode= fakelink.fromnode= gnode;
-
- for(sock= gnode->inputs.first; sock; sock= sock->next) {
- if(!(sock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL))) {
- if(sock->tosock) {
- fakelink.fromsock= sock;
- fakelink.tosock= sock->tosock;
- node_draw_link(snode, &fakelink);
- }
- }
- }
-
- for(sock= gnode->outputs.first; sock; sock= sock->next) {
- if(!(sock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL))) {
- if(sock->tosock) {
- fakelink.tosock= sock;
- fakelink.fromsock= sock->tosock;
- node_draw_link(snode, &fakelink);
- }
- }
- }
-
- glDisable(GL_BLEND);
- glDisable( GL_LINE_SMOOTH );
-}
-
-/* groups are, on creation, centered around 0,0 */
-static void node_draw_group(ScrArea *sa, SpaceNode *snode, bNode *gnode)
-{
- bNodeTree *ngroup= (bNodeTree *)gnode->id;
- bNodeSocket *sock;
- rctf rect= gnode->totr;
-
- /* backdrop header */
- glEnable(GL_BLEND);
- uiSetRoundBox(3);
- BIF_ThemeColorShadeAlpha(TH_NODE_GROUP, 0, -70);
- gl_round_box(GL_POLYGON, rect.xmin, rect.ymax, rect.xmax, rect.ymax+NODE_DY, BASIS_RAD);
-
- /* backdrop body */
- BIF_ThemeColorShadeAlpha(TH_BACK, -8, -70);
- uiSetRoundBox(12);
- gl_round_box(GL_POLYGON, rect.xmin, rect.ymin, rect.xmax, rect.ymax, BASIS_RAD);
-
- /* selection outline */
- uiSetRoundBox(15);
- glColor4ub(200, 200, 200, 140);
- glEnable( GL_LINE_SMOOTH );
- gl_round_box(GL_LINE_LOOP, rect.xmin, rect.ymin, rect.xmax, rect.ymax+NODE_DY, BASIS_RAD);
- glDisable( GL_LINE_SMOOTH );
- glDisable(GL_BLEND);
-
- /* backdrop title */
- BIF_ThemeColor(TH_TEXT_HI);
- ui_rasterpos_safe(rect.xmin+8.0f, rect.ymax+5.0f, snode->aspect);
- BIF_DrawString(snode->curfont, ngroup->id.name+2, 0);
-
- /* links from groupsockets to the internal nodes */
- node_draw_group_links(snode, gnode);
-
- /* group sockets */
- for(sock= gnode->inputs.first; sock; sock= sock->next)
- if(!(sock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL)))
- socket_circle_draw(sock->locx, sock->locy, NODE_SOCKSIZE, sock->type, sock->flag & SELECT);
- for(sock= gnode->outputs.first; sock; sock= sock->next)
- if(!(sock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL)))
- socket_circle_draw(sock->locx, sock->locy, NODE_SOCKSIZE, sock->type, sock->flag & SELECT);
-
- /* and finally the whole tree */
- node_draw_nodetree(sa, snode, ngroup);
-}
-
-
-void drawnodespace(ScrArea *sa, void *spacedata)
-{
- SpaceNode *snode= sa->spacedata.first;
- float col[3];
-
- BIF_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- calc_scrollrcts(sa, &(snode->v2d), sa->winx, sa->winy);
-
- myortho2(snode->v2d.cur.xmin, snode->v2d.cur.xmax, snode->v2d.cur.ymin, snode->v2d.cur.ymax);
- bwin_clear_viewmat(sa->win); /* clear buttons view */
- glLoadIdentity();
-
- /* always free, blocks here have no unique identifier (1 block per node) */
- uiFreeBlocksWin(&sa->uiblocks, sa->win);
-
- /* only set once */
- glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
- glEnable(GL_MAP1_VERTEX_3);
-
- /* aspect+font, set each time */
- snode->aspect= (snode->v2d.cur.xmax - snode->v2d.cur.xmin)/((float)sa->winx);
- snode->curfont= uiSetCurFont_ext(snode->aspect);
-
- /* backdrop */
- draw_nodespace_back(sa, snode);
-
- /* nodes */
- snode_set_context(snode);
-
- if(snode->nodetree) {
- bNode *node;
-
- /* for now, we set drawing coordinates on each redraw */
- for(node= snode->nodetree->nodes.first; node; node= node->next) {
- if(node->flag & NODE_GROUP_EDIT)
- node_update_group(node);
- else if(node->flag & NODE_HIDDEN)
- node_update_hidden(node);
- else
- node_update(node);
- }
-
- node_draw_nodetree(sa, snode, snode->nodetree);
-
- /* active group */
- for(node= snode->nodetree->nodes.first; node; node= node->next) {
- if(node->flag & NODE_GROUP_EDIT)
- node_draw_group(sa, snode, node);
- }
- }
-
- /* restore viewport (not needed yet) */
- mywinset(sa->win);
-
- /* ortho at pixel level curarea */
- myortho2(-0.375, sa->winx-0.375, -0.375, sa->winy-0.375);
-
- draw_area_emboss(sa);
- curarea->win_swap= WIN_BACK_OK;
-
- /* in the end, this is a delayed previewrender test, to allow buttons to be first */
- if(snode->flag & SNODE_DO_PREVIEW) {
- addafterqueue(sa->win, RENDERPREVIEW, 1);
- snode->flag &= ~SNODE_DO_PREVIEW;
- }
-}
diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c
deleted file mode 100644
index db2225f4823..00000000000
--- a/source/blender/src/drawobject.c
+++ /dev/null
@@ -1,5555 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <string.h>
-#include <math.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "BMF_Api.h"
-
-#include "IMB_imbuf.h"
-
-
-#include "MTC_matrixops.h"
-
-#include "DNA_armature_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_constraint_types.h" // for drawing constraint
-#include "DNA_effect_types.h"
-#include "DNA_ipo_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_lattice_types.h"
-#include "DNA_material_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_meta_types.h"
-#include "DNA_modifier_types.h"
-#include "DNA_object_types.h"
-#include "DNA_object_force.h"
-#include "DNA_particle_types.h"
-#include "DNA_space_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_world_types.h"
-// FSPARTICLE
-#include "DNA_object_fluidsim.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_editVert.h"
-#include "BLI_edgehash.h"
-#include "BLI_rand.h"
-
-#include "BKE_utildefines.h"
-#include "BKE_curve.h"
-#include "BKE_constraint.h" // for the get_constraint_target function
-#include "BKE_DerivedMesh.h"
-#include "BKE_displist.h"
-#include "BKE_effect.h"
-#include "BKE_font.h"
-#include "BKE_global.h"
-#include "BKE_image.h"
-#include "BKE_ipo.h"
-#include "BKE_key.h"
-#include "BKE_lattice.h"
-#include "BKE_mesh.h"
-#include "BKE_material.h"
-#include "BKE_mball.h"
-#include "BKE_modifier.h"
-#include "BKE_object.h"
-#include "BKE_anim.h" //for the where_on_path function
-#include "BKE_particle.h"
-#include "BKE_utildefines.h"
-#ifdef WITH_VERSE
-#include "BKE_verse.h"
-#endif
-
-#include "BIF_editarmature.h"
-#include "BIF_editdeform.h"
-#include "BIF_editmesh.h"
-#include "BIF_editparticle.h"
-#include "BIF_glutil.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-#include "BIF_mywindow.h"
-#include "BIF_resources.h"
-#include "BIF_retopo.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-
-#include "BDR_drawmesh.h"
-#include "BDR_drawobject.h"
-#include "BDR_editobject.h"
-#include "BDR_sculptmode.h"
-#include "BDR_vpaint.h"
-
-#include "BSE_drawview.h"
-#include "BSE_node.h"
-#include "BSE_trans_types.h"
-#include "BSE_view.h"
-
-#include "blendef.h"
-#include "mydevice.h"
-#include "nla.h"
-
-#include "BKE_deform.h"
-
-/* pretty stupid */
-/* extern Lattice *editLatt; already in BKE_lattice.h */
-/* editcurve.c */
-extern ListBase editNurb;
-/* editmball.c */
-extern ListBase editelems;
-
-static void draw_bounding_volume(Object *ob);
-
-static void drawcube_size(float size);
-static void drawcircle_size(float size);
-static void draw_empty_sphere(float size);
-static void draw_empty_cone(float size);
-
-/* ************* Setting OpenGL Material ************ */
-
-// Materials start counting at # one....
-#define MAXMATBUF (MAXMAT + 1)
-static float matbuf[MAXMATBUF][2][4];
-static int totmat_gl= 0;
-
-int set_gl_material(int nr)
-{
- static int last_gl_matnr= -1;
- static int last_ret_val= 1;
-
- /* prevent index to use un-initialized array items */
- if(nr>totmat_gl) nr= totmat_gl;
-
- if(nr<0) {
- last_gl_matnr= -1;
- last_ret_val= 1;
- }
- else if(nr<MAXMATBUF && nr!=last_gl_matnr) {
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, matbuf[nr][0]);
- glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, matbuf[nr][1]);
- last_gl_matnr = nr;
- last_ret_val= matbuf[nr][0][3]!=0.0;
-
- /* matbuf alpha: 0.0 = skip draw, 1.0 = no blending, else blend */
- if(matbuf[nr][0][3]!= 0.0 && matbuf[nr][0][3]!= 1.0) {
- glEnable(GL_BLEND);
- }
- else
- glDisable(GL_BLEND);
-
- }
-
- return last_ret_val;
-}
-
-/* returns 1: when there's alpha needed to be drawn in a 2nd pass */
-int init_gl_materials(Object *ob, int check_alpha)
-{
- extern Material defmaterial; // render module abuse...
- Material *ma;
- int a, has_alpha= 0;
-
- if(ob->totcol==0) {
- matbuf[0][0][0]= defmaterial.r;
- matbuf[0][0][1]= defmaterial.g;
- matbuf[0][0][2]= defmaterial.b;
- matbuf[0][0][3]= 1.0;
-
- matbuf[0][1][0]= defmaterial.specr;
- matbuf[0][1][1]= defmaterial.specg;
- matbuf[0][1][2]= defmaterial.specb;
- matbuf[0][1][3]= 1.0;
-
- /* do material 1 too, for displists! */
- QUATCOPY(matbuf[1][0], matbuf[0][0]);
- QUATCOPY(matbuf[1][1], matbuf[0][1]);
- }
-
- for(a=1; a<=ob->totcol; a++) {
- ma= give_current_material(ob, a);
- ma= editnode_get_active_material(ma);
- if(ma==NULL) ma= &defmaterial;
-
- if(a<MAXMATBUF) {
- if (ma->mode & MA_SHLESS) {
- matbuf[a][0][0]= 2*ma->r;
- matbuf[a][0][1]= 2*ma->g;
- matbuf[a][0][2]= 2*ma->b;
- } else {
- matbuf[a][0][0]= (ma->ref+ma->emit)*ma->r;
- matbuf[a][0][1]= (ma->ref+ma->emit)*ma->g;
- matbuf[a][0][2]= (ma->ref+ma->emit)*ma->b;
- }
-
- /* draw transparent, not in pick-select, nor editmode */
- if(check_alpha && !(G.f & G_PICKSEL) && (ob->dtx & OB_DRAWTRANSP) && !(G.obedit && G.obedit->data==ob->data)) {
- if(G.vd->transp) { // drawing the transparent pass
- if(ma->alpha==1.0) matbuf[a][0][3]= 0.0; // means skip solid
- else matbuf[a][0][3]= ma->alpha;
- }
- else { // normal pass
- if(ma->alpha==1.0) matbuf[a][0][3]= 1.0;
- else {
- matbuf[a][0][3]= 0.0; // means skip transparent
- has_alpha= 1; // return value, to indicate adding to after-draw queue
- }
- }
- }
- else
- matbuf[a][0][3]= 1.0;
-
- if (!(ma->mode & MA_SHLESS)) {
- matbuf[a][1][0]= ma->spec*ma->specr;
- matbuf[a][1][1]= ma->spec*ma->specg;
- matbuf[a][1][2]= ma->spec*ma->specb;
- matbuf[a][1][3]= 1.0;
- }
- }
- }
-
- totmat_gl= ob->totcol;
- set_gl_material(-1); // signal for static variable
- return has_alpha;
-}
-
-
- /***/
-static unsigned int colortab[24]=
- {0x0, 0xFF88FF, 0xFFBBFF,
- 0x403000, 0xFFFF88, 0xFFFFBB,
- 0x104040, 0x66CCCC, 0x77CCCC,
- 0x104010, 0x55BB55, 0x66FF66,
- 0xFFFFFF
-};
-
-
-static float cube[8][3] = {
- {-1.0, -1.0, -1.0},
- {-1.0, -1.0, 1.0},
- {-1.0, 1.0, 1.0},
- {-1.0, 1.0, -1.0},
- { 1.0, -1.0, -1.0},
- { 1.0, -1.0, 1.0},
- { 1.0, 1.0, 1.0},
- { 1.0, 1.0, -1.0},
-};
-
-/* ----------------- OpenGL Circle Drawing - Tables for Optimised Drawing Speed ------------------ */
-/* 32 values of sin function (still same result!) */
-static float sinval[32] = {
- 0.00000000,
- 0.20129852,
- 0.39435585,
- 0.57126821,
- 0.72479278,
- 0.84864425,
- 0.93775213,
- 0.98846832,
- 0.99871650,
- 0.96807711,
- 0.89780453,
- 0.79077573,
- 0.65137248,
- 0.48530196,
- 0.29936312,
- 0.10116832,
- -0.10116832,
- -0.29936312,
- -0.48530196,
- -0.65137248,
- -0.79077573,
- -0.89780453,
- -0.96807711,
- -0.99871650,
- -0.98846832,
- -0.93775213,
- -0.84864425,
- -0.72479278,
- -0.57126821,
- -0.39435585,
- -0.20129852,
- 0.00000000
-};
-
-/* 32 values of cos function (still same result!) */
-static float cosval[32] ={
- 1.00000000,
- 0.97952994,
- 0.91895781,
- 0.82076344,
- 0.68896691,
- 0.52896401,
- 0.34730525,
- 0.15142777,
- -0.05064916,
- -0.25065253,
- -0.44039415,
- -0.61210598,
- -0.75875812,
- -0.87434661,
- -0.95413925,
- -0.99486932,
- -0.99486932,
- -0.95413925,
- -0.87434661,
- -0.75875812,
- -0.61210598,
- -0.44039415,
- -0.25065253,
- -0.05064916,
- 0.15142777,
- 0.34730525,
- 0.52896401,
- 0.68896691,
- 0.82076344,
- 0.91895781,
- 0.97952994,
- 1.00000000
-};
-
-/* flag is same as for draw_object */
-void drawaxes(float size, int flag, char drawtype)
-{
- int axis;
- float v1[3]= {0.0, 0.0, 0.0};
- float v2[3]= {0.0, 0.0, 0.0};
- float v3[3]= {0.0, 0.0, 0.0};
-
- switch(drawtype) {
-
- case OB_PLAINAXES:
- for (axis=0; axis<3; axis++) {
- float v1[3]= {0.0, 0.0, 0.0};
- float v2[3]= {0.0, 0.0, 0.0};
-
- glBegin(GL_LINES);
-
- v1[axis]= size;
- v2[axis]= -size;
- glVertex3fv(v1);
- glVertex3fv(v2);
-
- glEnd();
- }
- break;
- case OB_SINGLE_ARROW:
-
- glBegin(GL_LINES);
- /* in positive z direction only */
- v1[2]= size;
- glVertex3fv(v1);
- glVertex3fv(v2);
- glEnd();
-
- /* square pyramid */
- glBegin(GL_TRIANGLES);
-
- v2[0]= size*0.035; v2[1] = size*0.035;
- v3[0]= size*-0.035; v3[1] = size*0.035;
- v2[2]= v3[2]= size*0.75;
-
- for (axis=0; axis<4; axis++) {
- if (axis % 2 == 1) {
- v2[0] *= -1;
- v3[1] *= -1;
- } else {
- v2[1] *= -1;
- v3[0] *= -1;
- }
-
- glVertex3fv(v1);
- glVertex3fv(v2);
- glVertex3fv(v3);
-
- }
- glEnd();
-
- break;
- case OB_CUBE:
- drawcube_size(size);
- break;
-
- case OB_CIRCLE:
- drawcircle_size(size);
- break;
-
- case OB_EMPTY_SPHERE:
- draw_empty_sphere(size);
- break;
-
- case OB_EMPTY_CONE:
- draw_empty_cone(size);
- break;
-
- case OB_ARROWS:
- default:
- for (axis=0; axis<3; axis++) {
- float v1[3]= {0.0, 0.0, 0.0};
- float v2[3]= {0.0, 0.0, 0.0};
- int arrow_axis= (axis==0)?1:0;
-
- glBegin(GL_LINES);
-
- v2[axis]= size;
- glVertex3fv(v1);
- glVertex3fv(v2);
-
- v1[axis]= size*0.8;
- v1[arrow_axis]= -size*0.125;
- glVertex3fv(v1);
- glVertex3fv(v2);
-
- v1[arrow_axis]= size*0.125;
- glVertex3fv(v1);
- glVertex3fv(v2);
-
- glEnd();
-
- v2[axis]+= size*0.125;
- glRasterPos3fv(v2);
-
- // patch for 3d cards crashing on glSelect for text drawing (IBM)
- if((flag & DRAW_PICKING) == 0) {
- if (axis==0)
- BMF_DrawString(G.font, "x");
- else if (axis==1)
- BMF_DrawString(G.font, "y");
- else
- BMF_DrawString(G.font, "z");
- }
- }
- break;
- }
-}
-
-/* circle for object centers, special_color is for library or ob users */
-static void drawcentercircle(float *vec, int selstate, int special_color)
-{
- View3D *v3d= G.vd;
- float size;
-
- size= v3d->persmat[0][3]*vec[0]+ v3d->persmat[1][3]*vec[1]+ v3d->persmat[2][3]*vec[2]+ v3d->persmat[3][3];
- size*= v3d->pixsize*((float)U.obcenter_dia*0.5f);
-
- /* using gldepthfunc guarantees that it does write z values, but not checks for it, so centers remain visible independt order of drawing */
- if(v3d->zbuf) glDepthFunc(GL_ALWAYS);
- glEnable(GL_BLEND);
-
- if(special_color) {
-#ifdef WITH_VERSE
- if (selstate==VERSE) glColor4ub(0x00, 0xFF, 0x00, 155);
- else if (selstate==ACTIVE || selstate==SELECT) glColor4ub(0x88, 0xFF, 0xFF, 155);
-#else
- if (selstate==ACTIVE || selstate==SELECT) glColor4ub(0x88, 0xFF, 0xFF, 155);
-#endif
-
- else glColor4ub(0x55, 0xCC, 0xCC, 155);
- }
- else {
- if (selstate == ACTIVE) BIF_ThemeColorShadeAlpha(TH_ACTIVE, 0, -80);
- else if (selstate == SELECT) BIF_ThemeColorShadeAlpha(TH_SELECT, 0, -80);
- else if (selstate == DESELECT) BIF_ThemeColorShadeAlpha(TH_TRANSFORM, 0, -80);
- }
- drawcircball(GL_POLYGON, vec, size, v3d->viewinv);
-
- BIF_ThemeColorShadeAlpha(TH_WIRE, 0, -30);
- drawcircball(GL_LINE_LOOP, vec, size, v3d->viewinv);
-
- glDisable(GL_BLEND);
- if(v3d->zbuf) glDepthFunc(GL_LEQUAL);
-}
-
-
-void drawsolidcube(float size)
-{
- float n[3];
-
- glPushMatrix();
- glScalef(size, size, size);
-
- n[0]=0; n[1]=0; n[2]=0;
- glBegin(GL_QUADS);
- n[0]= -1.0;
- glNormal3fv(n);
- glVertex3fv(cube[0]); glVertex3fv(cube[1]); glVertex3fv(cube[2]); glVertex3fv(cube[3]);
- n[0]=0;
- glEnd();
-
- glBegin(GL_QUADS);
- n[1]= -1.0;
- glNormal3fv(n);
- glVertex3fv(cube[0]); glVertex3fv(cube[4]); glVertex3fv(cube[5]); glVertex3fv(cube[1]);
- n[1]=0;
- glEnd();
-
- glBegin(GL_QUADS);
- n[0]= 1.0;
- glNormal3fv(n);
- glVertex3fv(cube[4]); glVertex3fv(cube[7]); glVertex3fv(cube[6]); glVertex3fv(cube[5]);
- n[0]=0;
- glEnd();
-
- glBegin(GL_QUADS);
- n[1]= 1.0;
- glNormal3fv(n);
- glVertex3fv(cube[7]); glVertex3fv(cube[3]); glVertex3fv(cube[2]); glVertex3fv(cube[6]);
- n[1]=0;
- glEnd();
-
- glBegin(GL_QUADS);
- n[2]= 1.0;
- glNormal3fv(n);
- glVertex3fv(cube[1]); glVertex3fv(cube[5]); glVertex3fv(cube[6]); glVertex3fv(cube[2]);
- n[2]=0;
- glEnd();
-
- glBegin(GL_QUADS);
- n[2]= -1.0;
- glNormal3fv(n);
- glVertex3fv(cube[7]); glVertex3fv(cube[4]); glVertex3fv(cube[0]); glVertex3fv(cube[3]);
- glEnd();
-
- glPopMatrix();
-}
-
-static void drawcube(void)
-{
-
- glBegin(GL_LINE_STRIP);
- glVertex3fv(cube[0]); glVertex3fv(cube[1]);glVertex3fv(cube[2]); glVertex3fv(cube[3]);
- glVertex3fv(cube[0]); glVertex3fv(cube[4]);glVertex3fv(cube[5]); glVertex3fv(cube[6]);
- glVertex3fv(cube[7]); glVertex3fv(cube[4]);
- glEnd();
-
- glBegin(GL_LINE_STRIP);
- glVertex3fv(cube[1]); glVertex3fv(cube[5]);
- glEnd();
-
- glBegin(GL_LINE_STRIP);
- glVertex3fv(cube[2]); glVertex3fv(cube[6]);
- glEnd();
-
- glBegin(GL_LINE_STRIP);
- glVertex3fv(cube[3]); glVertex3fv(cube[7]);
- glEnd();
-}
-
-/* draws a cube on given the scaling of the cube, assuming that
- * all required matrices have been set (used for drawing empties)
- */
-static void drawcube_size(float size)
-{
- glBegin(GL_LINE_STRIP);
- glVertex3f(-size,-size,-size); glVertex3f(-size,-size,size);glVertex3f(-size,size,size); glVertex3f(-size,size,-size);
- glVertex3f(-size,-size,-size); glVertex3f(size,-size,-size);glVertex3f(size,-size,size); glVertex3f(size,size,size);
- glVertex3f(size,size,-size); glVertex3f(size,-size,-size);
- glEnd();
-
- glBegin(GL_LINE_STRIP);
- glVertex3f(-size,-size,size); glVertex3f(size,-size,size);
- glEnd();
-
- glBegin(GL_LINE_STRIP);
- glVertex3f(-size,size,size); glVertex3f(size,size,size);
- glEnd();
-
- glBegin(GL_LINE_STRIP);
- glVertex3f(-size,size,-size); glVertex3f(size,size,-size);
- glEnd();
-}
-
-/* this is an unused (old) cube-drawing function based on a given size */
-#if 0
-static void drawcube_size(float *size)
-{
-
- glPushMatrix();
- glScalef(size[0], size[1], size[2]);
-
-
- glBegin(GL_LINE_STRIP);
- glVertex3fv(cube[0]); glVertex3fv(cube[1]);glVertex3fv(cube[2]); glVertex3fv(cube[3]);
- glVertex3fv(cube[0]); glVertex3fv(cube[4]);glVertex3fv(cube[5]); glVertex3fv(cube[6]);
- glVertex3fv(cube[7]); glVertex3fv(cube[4]);
- glEnd();
-
- glBegin(GL_LINE_STRIP);
- glVertex3fv(cube[1]); glVertex3fv(cube[5]);
- glEnd();
-
- glBegin(GL_LINE_STRIP);
- glVertex3fv(cube[2]); glVertex3fv(cube[6]);
- glEnd();
-
- glBegin(GL_LINE_STRIP);
- glVertex3fv(cube[3]); glVertex3fv(cube[7]);
- glEnd();
-
- glPopMatrix();
-}
-#endif
-
-static void drawshadbuflimits(Lamp *la, float mat[][4])
-{
- float sta[3], end[3], lavec[3];
-
- lavec[0]= -mat[2][0];
- lavec[1]= -mat[2][1];
- lavec[2]= -mat[2][2];
- Normalize(lavec);
-
- sta[0]= mat[3][0]+ la->clipsta*lavec[0];
- sta[1]= mat[3][1]+ la->clipsta*lavec[1];
- sta[2]= mat[3][2]+ la->clipsta*lavec[2];
-
- end[0]= mat[3][0]+ la->clipend*lavec[0];
- end[1]= mat[3][1]+ la->clipend*lavec[1];
- end[2]= mat[3][2]+ la->clipend*lavec[2];
-
-
- glBegin(GL_LINE_STRIP);
- glVertex3fv(sta);
- glVertex3fv(end);
- glEnd();
-
- glPointSize(3.0);
- bglBegin(GL_POINTS);
- bglVertex3fv(sta);
- bglVertex3fv(end);
- bglEnd();
- glPointSize(1.0);
-}
-
-
-
-static void spotvolume(float *lvec, float *vvec, float inp)
-{
- /* camera is at 0,0,0 */
- float temp[3],plane[3],mat1[3][3],mat2[3][3],mat3[3][3],mat4[3][3],q[4],co,si,angle;
-
- Normalize(lvec);
- Normalize(vvec); /* is this the correct vector ? */
-
- Crossf(temp,vvec,lvec); /* equation for a plane through vvec en lvec */
- Crossf(plane,lvec,temp); /* a plane perpendicular to this, parrallel with lvec */
-
- Normalize(plane);
-
- /* now we've got two equations: one of a cone and one of a plane, but we have
- three unknowns. We remove one unkown by rotating the plane to z=0 (the plane normal) */
-
- /* rotate around cross product vector of (0,0,1) and plane normal, dot product degrees */
- /* according definition, we derive cross product is (plane[1],-plane[0],0), en cos = plane[2]);*/
-
- /* translating this comment to english didnt really help me understanding the math! :-) (ton) */
-
- q[1] = plane[1] ;
- q[2] = -plane[0] ;
- q[3] = 0 ;
- Normalize(&q[1]);
-
- angle = saacos(plane[2])/2.0;
- co = cos(angle);
- si = sqrt(1-co*co);
-
- q[0] = co;
- q[1] *= si;
- q[2] *= si;
- q[3] = 0;
-
- QuatToMat3(q,mat1);
-
- /* rotate lamp vector now over acos(inp) degrees */
-
- vvec[0] = lvec[0] ;
- vvec[1] = lvec[1] ;
- vvec[2] = lvec[2] ;
-
- Mat3One(mat2);
- co = inp;
- si = sqrt(1-inp*inp);
-
- mat2[0][0] = co;
- mat2[1][0] = -si;
- mat2[0][1] = si;
- mat2[1][1] = co;
- Mat3MulMat3(mat3,mat2,mat1);
-
- mat2[1][0] = si;
- mat2[0][1] = -si;
- Mat3MulMat3(mat4,mat2,mat1);
- Mat3Transp(mat1);
-
- Mat3MulMat3(mat2,mat1,mat3);
- Mat3MulVecfl(mat2,lvec);
- Mat3MulMat3(mat2,mat1,mat4);
- Mat3MulVecfl(mat2,vvec);
-
- return;
-}
-
-static void drawlamp(Object *ob)
-{
- Lamp *la;
- View3D *v3d= G.vd;
- float vec[3], lvec[3], vvec[3], circrad, x,y,z;
- float pixsize, lampsize;
- float imat[4][4], curcol[4];
- char col[4];
-
- la= ob->data;
-
- /* we first draw only the screen aligned & fixed scale stuff */
- glPushMatrix();
- myloadmatrix(G.vd->viewmat);
-
- /* lets calculate the scale: */
- pixsize= v3d->persmat[0][3]*ob->obmat[3][0]+ v3d->persmat[1][3]*ob->obmat[3][1]+ v3d->persmat[2][3]*ob->obmat[3][2]+ v3d->persmat[3][3];
- pixsize*= v3d->pixsize;
- lampsize= pixsize*((float)U.obcenter_dia*0.5f);
-
- /* and view aligned matrix: */
- Mat4CpyMat4(imat, G.vd->viewinv);
- Normalize(imat[0]);
- Normalize(imat[1]);
-
- /* for AA effects */
- glGetFloatv(GL_CURRENT_COLOR, curcol);
- curcol[3]= 0.6;
- glColor4fv(curcol);
-
- if(ob->id.us>1) {
- if (ob==OBACT || (ob->flag & SELECT)) glColor4ub(0x88, 0xFF, 0xFF, 155);
- else glColor4ub(0x77, 0xCC, 0xCC, 155);
- }
-
- /* Inner Circle */
- VECCOPY(vec, ob->obmat[3]);
- glEnable(GL_BLEND);
- drawcircball(GL_LINE_LOOP, vec, lampsize, imat);
- glDisable(GL_BLEND);
- drawcircball(GL_POLYGON, vec, lampsize, imat);
-
- /* restore */
- if(ob->id.us>1)
- glColor4fv(curcol);
-
- /* Outer circle */
- circrad = 3.0f*lampsize;
- drawcircball(GL_LINE_LOOP, vec, circrad, imat);
-
- setlinestyle(3);
-
- /* draw dashed outer circle if shadow is on. remember some lamps can't have certain shadows! */
- if (la->type!=LA_HEMI) {
- if ((la->mode & LA_SHAD_RAY) ||
- ((la->mode & LA_SHAD_BUF) && (la->type==LA_SPOT)) )
- {
- drawcircball(GL_LINE_LOOP, vec, circrad + 3.0f*pixsize, imat);
- }
- }
-
- /* draw the pretty sun rays */
- if(la->type==LA_SUN) {
- float v1[3], v2[3], mat[3][3];
- short axis;
-
- /* setup a 45 degree rotation matrix */
- VecRotToMat3(imat[2], M_PI/4.0f, mat);
-
- /* vectors */
- VECCOPY(v1, imat[0]);
- VecMulf(v1, circrad*1.2f);
- VECCOPY(v2, imat[0]);
- VecMulf(v2, circrad*2.5f);
-
- /* center */
- glTranslatef(vec[0], vec[1], vec[2]);
-
- setlinestyle(3);
-
- glBegin(GL_LINES);
- for (axis=0; axis<8; axis++) {
- glVertex3fv(v1);
- glVertex3fv(v2);
- Mat3MulVecfl(mat, v1);
- Mat3MulVecfl(mat, v2);
- }
- glEnd();
-
- glTranslatef(-vec[0], -vec[1], -vec[2]);
-
- }
-
- if (la->type==LA_LOCAL) {
- if(la->mode & LA_SPHERE) {
- drawcircball(GL_LINE_LOOP, vec, la->dist, imat);
- }
- /* yafray: for photonlight also draw lightcone as for spot */
- }
-
- glPopMatrix(); /* back in object space */
- vec[0]= vec[1]= vec[2]= 0.0f;
-
- if ((la->type==LA_SPOT) || (la->type==LA_YF_PHOTON)) {
- lvec[0]=lvec[1]= 0.0;
- lvec[2] = 1.0;
- x = G.vd->persmat[0][2];
- y = G.vd->persmat[1][2];
- z = G.vd->persmat[2][2];
- vvec[0]= x*ob->obmat[0][0] + y*ob->obmat[0][1] + z*ob->obmat[0][2];
- vvec[1]= x*ob->obmat[1][0] + y*ob->obmat[1][1] + z*ob->obmat[1][2];
- vvec[2]= x*ob->obmat[2][0] + y*ob->obmat[2][1] + z*ob->obmat[2][2];
-
- y = cos( M_PI*la->spotsize/360.0 );
- spotvolume(lvec, vvec, y);
- x = -la->dist;
- lvec[0] *= x ;
- lvec[1] *= x ;
- lvec[2] *= x;
- vvec[0] *= x ;
- vvec[1] *= x ;
- vvec[2] *= x;
-
- /* draw the angled sides of the cone */
- glBegin(GL_LINE_STRIP);
- glVertex3fv(vvec);
- glVertex3fv(vec);
- glVertex3fv(lvec);
- glEnd();
-
- z = x*sqrt(1.0 - y*y);
- x *= y;
-
- /* draw the circle/square at the end of the cone */
- glTranslatef(0.0, 0.0 , x);
- if(la->mode & LA_SQUARE) {
- vvec[0]= fabs(z);
- vvec[1]= fabs(z);
- vvec[2]= 0.0;
- glBegin(GL_LINE_LOOP);
- glVertex3fv(vvec);
- vvec[1]= -fabs(z);
- glVertex3fv(vvec);
- vvec[0]= -fabs(z);
- glVertex3fv(vvec);
- vvec[1]= fabs(z);
- glVertex3fv(vvec);
- glEnd();
- }
- else circ(0.0, 0.0, fabs(z));
-
- /* draw the circle/square representing spotbl */
- if(la->type==LA_SPOT) {
- float spotblcirc = fabs(z)*(1 - pow(la->spotblend, 2));
- /* make sure the line is always visible - prevent it from reaching the outer border (or 0)
- * values are kinda arbitrary - just what seemed to work well */
- if (spotblcirc == 0) spotblcirc = 0.15;
- else if (spotblcirc == fabs(z)) spotblcirc = fabs(z) - 0.07;
- circ(0.0, 0.0, spotblcirc);
- }
-
- }
- else if ELEM(la->type, LA_HEMI, LA_SUN) {
-
- /* draw the line from the circle along the dist */
- glBegin(GL_LINE_STRIP);
- vec[2] = -circrad;
- glVertex3fv(vec);
- vec[2]= -la->dist;
- glVertex3fv(vec);
- glEnd();
-
- if(la->type==LA_HEMI) {
- /* draw the hemisphere curves */
- short axis, steps, dir;
- float outdist, zdist, mul;
- vec[0]=vec[1]=vec[2]= 0.0;
- outdist = 0.14; mul = 1.4; dir = 1;
-
- setlinestyle(4);
- /* loop over the 4 compass points, and draw each arc as a LINE_STRIP */
- for (axis=0; axis<4; axis++) {
- float v[3]= {0.0, 0.0, 0.0};
- zdist = 0.02;
-
- glBegin(GL_LINE_STRIP);
-
- for (steps=0; steps<6; steps++) {
- if (axis == 0 || axis == 1) { /* x axis up, x axis down */
- /* make the arcs start at the edge of the energy circle */
- if (steps == 0) v[0] = dir*circrad;
- else v[0] = v[0] + dir*(steps*outdist);
- } else if (axis == 2 || axis == 3) { /* y axis up, y axis down */
- /* make the arcs start at the edge of the energy circle */
- if (steps == 0) v[1] = dir*circrad;
- else v[1] = v[1] + dir*(steps*outdist);
- }
-
- v[2] = v[2] - steps*zdist;
-
- glVertex3fv(v);
-
- zdist = zdist * mul;
- }
-
- glEnd();
- /* flip the direction */
- dir = -dir;
- }
- }
- } else if(la->type==LA_AREA) {
- setlinestyle(3);
- if(la->area_shape==LA_AREA_SQUARE)
- fdrawbox(-la->area_size*0.5, -la->area_size*0.5, la->area_size*0.5, la->area_size*0.5);
- else if(la->area_shape==LA_AREA_RECT)
- fdrawbox(-la->area_size*0.5, -la->area_sizey*0.5, la->area_size*0.5, la->area_sizey*0.5);
-
- glBegin(GL_LINE_STRIP);
- glVertex3f(0.0,0.0,-circrad);
- glVertex3f(0.0,0.0,-la->dist);
- glEnd();
- }
-
- /* and back to viewspace */
- myloadmatrix(G.vd->viewmat);
- VECCOPY(vec, ob->obmat[3]);
-
- setlinestyle(0);
-
- if(la->type==LA_SPOT && (la->mode & LA_SHAD_BUF) ) {
- drawshadbuflimits(la, ob->obmat);
- }
-
- BIF_GetThemeColor4ubv(TH_LAMP, col);
- glColor4ub(col[0], col[1], col[2], col[3]);
-
- glEnable(GL_BLEND);
-
- if (vec[2]>0) vec[2] -= circrad;
- else vec[2] += circrad;
-
- glBegin(GL_LINE_STRIP);
- glVertex3fv(vec);
- vec[2]= 0;
- glVertex3fv(vec);
- glEnd();
-
- glPointSize(2.0);
- glBegin(GL_POINTS);
- glVertex3fv(vec);
- glEnd();
- glPointSize(1.0);
-
- glDisable(GL_BLEND);
-
- /* restore for drawing extra stuff */
- glColor3fv(curcol);
-
-}
-
-static void draw_limit_line(float sta, float end, unsigned int col)
-{
- glBegin(GL_LINES);
- glVertex3f(0.0, 0.0, -sta);
- glVertex3f(0.0, 0.0, -end);
- glEnd();
-
- glPointSize(3.0);
- glBegin(GL_POINTS);
- cpack(col);
- glVertex3f(0.0, 0.0, -sta);
- glVertex3f(0.0, 0.0, -end);
- glEnd();
- glPointSize(1.0);
-}
-
-
-/* yafray: draw camera focus point (cross, similar to aqsis code in tuhopuu) */
-/* qdn: now also enabled for Blender to set focus point for defocus composit node */
-static void draw_focus_cross(float dist, float size)
-{
- glBegin(GL_LINES);
- glVertex3f(-size, 0.f, -dist);
- glVertex3f(size, 0.f, -dist);
- glVertex3f(0.f, -size, -dist);
- glVertex3f(0.f, size, -dist);
- glEnd();
-}
-
-/* flag similar to draw_object() */
-static void drawcamera(Object *ob, int flag)
-{
- /* a standing up pyramid with (0,0,0) as top */
- Camera *cam;
- World *wrld;
- float vec[8][4], tmat[4][4], fac, facx, facy, depth;
- int i;
-
- cam= ob->data;
-
- glDisable(GL_LIGHTING);
- glDisable(GL_CULL_FACE);
-
- if(G.vd->persp>=2 && cam->type==CAM_ORTHO && ob==G.vd->camera) {
- facx= 0.5*cam->ortho_scale*1.28;
- facy= 0.5*cam->ortho_scale*1.024;
- depth= -cam->clipsta-0.1;
- }
- else {
- fac= cam->drawsize;
- if(G.vd->persp>=2 && ob==G.vd->camera) fac= cam->clipsta+0.1; /* that way it's always visible */
-
- depth= - fac*cam->lens/16.0;
- facx= fac*1.28;
- facy= fac*1.024;
- }
-
- vec[0][0]= 0.0; vec[0][1]= 0.0; vec[0][2]= 0.001; /* GLBUG: for picking at iris Entry (well thats old!) */
- vec[1][0]= facx; vec[1][1]= facy; vec[1][2]= depth;
- vec[2][0]= facx; vec[2][1]= -facy; vec[2][2]= depth;
- vec[3][0]= -facx; vec[3][1]= -facy; vec[3][2]= depth;
- vec[4][0]= -facx; vec[4][1]= facy; vec[4][2]= depth;
-
- glBegin(GL_LINE_LOOP);
- glVertex3fv(vec[1]);
- glVertex3fv(vec[2]);
- glVertex3fv(vec[3]);
- glVertex3fv(vec[4]);
- glEnd();
-
-
- if(G.vd->persp>=2 && ob==G.vd->camera) return;
-
- glBegin(GL_LINE_STRIP);
- glVertex3fv(vec[2]);
- glVertex3fv(vec[0]);
- glVertex3fv(vec[1]);
- glVertex3fv(vec[4]);
- glVertex3fv(vec[0]);
- glVertex3fv(vec[3]);
- glEnd();
-
-
- /* arrow on top */
- vec[0][2]= depth;
-
-
- /* draw an outline arrow for inactive cameras and filled
- * for active cameras. We actually draw both outline+filled
- * for active cameras so the wire can be seen side-on */
- for (i=0;i<2;i++) {
- if (i==0) glBegin(GL_LINE_LOOP);
- else if (i==1 && (ob == G.vd->camera)) glBegin(GL_TRIANGLES);
- else break;
-
- vec[0][0]= -0.7*cam->drawsize;
- vec[0][1]= 1.1*cam->drawsize;
- glVertex3fv(vec[0]);
-
- vec[0][0]= 0.0;
- vec[0][1]= 1.8*cam->drawsize;
- glVertex3fv(vec[0]);
-
- vec[0][0]= 0.7*cam->drawsize;
- vec[0][1]= 1.1*cam->drawsize;
- glVertex3fv(vec[0]);
-
- glEnd();
- }
-
- if(flag==0) {
- if(cam->flag & (CAM_SHOWLIMITS+CAM_SHOWMIST)) {
- myloadmatrix(G.vd->viewmat);
- Mat4CpyMat4(vec, ob->obmat);
- Mat4Ortho(vec);
- mymultmatrix(vec);
-
- MTC_Mat4SwapMat4(G.vd->persmat, tmat);
- mygetsingmatrix(G.vd->persmat);
-
- if(cam->flag & CAM_SHOWLIMITS) {
- draw_limit_line(cam->clipsta, cam->clipend, 0x77FFFF);
- /* qdn: was yafray only, now also enabled for Blender to be used with defocus composit node */
- draw_focus_cross(dof_camera(ob), cam->drawsize);
- }
-
- wrld= G.scene->world;
- if(cam->flag & CAM_SHOWMIST)
- if(wrld) draw_limit_line(wrld->miststa, wrld->miststa+wrld->mistdist, 0xFFFFFF);
-
- MTC_Mat4SwapMat4(G.vd->persmat, tmat);
- }
- }
-}
-
-static void lattice_draw_verts(Lattice *lt, DispList *dl, short sel)
-{
- BPoint *bp = lt->def;
- float *co = dl?dl->verts:NULL;
- int u, v, w;
-
- BIF_ThemeColor(sel?TH_VERTEX_SELECT:TH_VERTEX);
- glPointSize(BIF_GetThemeValuef(TH_VERTEX_SIZE));
- bglBegin(GL_POINTS);
-
- for(w=0; w<lt->pntsw; w++) {
- int wxt = (w==0 || w==lt->pntsw-1);
- for(v=0; v<lt->pntsv; v++) {
- int vxt = (v==0 || v==lt->pntsv-1);
- for(u=0; u<lt->pntsu; u++, bp++, co+=3) {
- int uxt = (u==0 || u==lt->pntsu-1);
- if(!(lt->flag & LT_OUTSIDE) || uxt || vxt || wxt) {
- if(bp->hide==0) {
- if((bp->f1 & SELECT)==sel) {
- bglVertex3fv(dl?co:bp->vec);
- }
- }
- }
- }
- }
- }
-
- glPointSize(1.0);
- bglEnd();
-}
-
-void lattice_foreachScreenVert(void (*func)(void *userData, BPoint *bp, int x, int y), void *userData)
-{
- int i, N = editLatt->pntsu*editLatt->pntsv*editLatt->pntsw;
- DispList *dl = find_displist(&G.obedit->disp, DL_VERTS);
- float *co = dl?dl->verts:NULL;
- BPoint *bp = editLatt->def;
- float pmat[4][4], vmat[4][4];
- short s[2];
-
- view3d_get_object_project_mat(curarea, G.obedit, pmat, vmat);
-
- for (i=0; i<N; i++, bp++, co+=3) {
- if (bp->hide==0) {
- view3d_project_short_clip(curarea, dl?co:bp->vec, s, pmat, vmat);
- func(userData, bp, s[0], s[1]);
- }
- }
-}
-
-static void drawlattice__point(Lattice *lt, DispList *dl, int u, int v, int w, int use_wcol)
-{
- int index = ((w*lt->pntsv + v)*lt->pntsu) + u;
-
- if(use_wcol) {
- float col[3];
- MDeformWeight *mdw= get_defweight (lt->dvert+index, use_wcol-1);
-
- weight_to_rgb(mdw?mdw->weight:0.0f, col, col+1, col+2);
- glColor3fv(col);
- }
-
- if (dl) {
- glVertex3fv(&dl->verts[index*3]);
- } else {
- glVertex3fv(lt->def[index].vec);
- }
-}
-
-/* lattice color is hardcoded, now also shows weightgroup values in edit mode */
-static void drawlattice(Object *ob)
-{
- Lattice *lt;
- DispList *dl;
- int u, v, w;
- int use_wcol= 0;
-
- lt= (ob==G.obedit)?editLatt:ob->data;
- dl= find_displist(&ob->disp, DL_VERTS);
- if(ob==G.obedit) {
- cpack(0x004000);
-
- if(ob->defbase.first && lt->dvert) {
- use_wcol= ob->actdef;
- glShadeModel(GL_SMOOTH);
- }
- }
-
- glBegin(GL_LINES);
- for(w=0; w<lt->pntsw; w++) {
- int wxt = (w==0 || w==lt->pntsw-1);
- for(v=0; v<lt->pntsv; v++) {
- int vxt = (v==0 || v==lt->pntsv-1);
- for(u=0; u<lt->pntsu; u++) {
- int uxt = (u==0 || u==lt->pntsu-1);
-
- if(w && ((uxt || vxt) || !(lt->flag & LT_OUTSIDE))) {
- drawlattice__point(lt, dl, u, v, w-1, use_wcol);
- drawlattice__point(lt, dl, u, v, w, use_wcol);
- }
- if(v && ((uxt || wxt) || !(lt->flag & LT_OUTSIDE))) {
- drawlattice__point(lt, dl, u, v-1, w, use_wcol);
- drawlattice__point(lt, dl, u, v, w, use_wcol);
- }
- if(u && ((vxt || wxt) || !(lt->flag & LT_OUTSIDE))) {
- drawlattice__point(lt, dl, u-1, v, w, use_wcol);
- drawlattice__point(lt, dl, u, v, w, use_wcol);
- }
- }
- }
- }
- glEnd();
-
- /* restoration for weight colors */
- if(use_wcol)
- glShadeModel(GL_FLAT);
-
- if(ob==G.obedit) {
- if(G.vd->zbuf) glDisable(GL_DEPTH_TEST);
-
- lattice_draw_verts(lt, dl, 0);
- lattice_draw_verts(lt, dl, 1);
-
- if(G.vd->zbuf) glEnable(GL_DEPTH_TEST);
- }
-}
-
-/* ***************** ******************** */
-
-static void mesh_foreachScreenVert__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s)
-{
- struct { void (*func)(void *userData, EditVert *eve, int x, int y, int index); void *userData; int clipVerts; float pmat[4][4], vmat[4][4]; } *data = userData;
- EditVert *eve = EM_get_vert_for_index(index);
- short s[2];
-
- if (eve->h==0) {
- if (data->clipVerts) {
- view3d_project_short_clip(curarea, co, s, data->pmat, data->vmat);
- } else {
- view3d_project_short_noclip(curarea, co, s, data->pmat);
- }
-
- data->func(data->userData, eve, s[0], s[1], index);
- }
-}
-void mesh_foreachScreenVert(void (*func)(void *userData, EditVert *eve, int x, int y, int index), void *userData, int clipVerts)
-{
- struct { void (*func)(void *userData, EditVert *eve, int x, int y, int index); void *userData; int clipVerts; float pmat[4][4], vmat[4][4]; } data;
- DerivedMesh *dm = editmesh_get_derived_cage(CD_MASK_BAREMESH);
-
- data.func = func;
- data.userData = userData;
- data.clipVerts = clipVerts;
-
- view3d_get_object_project_mat(curarea, G.obedit, data.pmat, data.vmat);
-
- EM_init_index_arrays(1, 0, 0);
- dm->foreachMappedVert(dm, mesh_foreachScreenVert__mapFunc, &data);
- EM_free_index_arrays();
-
- dm->release(dm);
-}
-
-static void mesh_foreachScreenEdge__mapFunc(void *userData, int index, float *v0co, float *v1co)
-{
- struct { void (*func)(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index); void *userData; int clipVerts; float pmat[4][4], vmat[4][4]; } *data = userData;
- EditEdge *eed = EM_get_edge_for_index(index);
- short s[2][2];
-
- if (eed->h==0) {
- if (data->clipVerts==1) {
- view3d_project_short_clip(curarea, v0co, s[0], data->pmat, data->vmat);
- view3d_project_short_clip(curarea, v1co, s[1], data->pmat, data->vmat);
- } else {
- view3d_project_short_noclip(curarea, v0co, s[0], data->pmat);
- view3d_project_short_noclip(curarea, v1co, s[1], data->pmat);
-
- if (data->clipVerts==2) {
- if (!(s[0][0]>=0 && s[0][1]>= 0 && s[0][0]<curarea->winx && s[0][1]<curarea->winy))
- if (!(s[1][0]>=0 && s[1][1]>= 0 && s[1][0]<curarea->winx && s[1][1]<curarea->winy))
- return;
- }
- }
-
- data->func(data->userData, eed, s[0][0], s[0][1], s[1][0], s[1][1], index);
- }
-}
-void mesh_foreachScreenEdge(void (*func)(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index), void *userData, int clipVerts)
-{
- struct { void (*func)(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index); void *userData; int clipVerts; float pmat[4][4], vmat[4][4]; } data;
- DerivedMesh *dm = editmesh_get_derived_cage(CD_MASK_BAREMESH);
-
- data.func = func;
- data.userData = userData;
- data.clipVerts = clipVerts;
-
- view3d_get_object_project_mat(curarea, G.obedit, data.pmat, data.vmat);
-
- EM_init_index_arrays(0, 1, 0);
- dm->foreachMappedEdge(dm, mesh_foreachScreenEdge__mapFunc, &data);
- EM_free_index_arrays();
-
- dm->release(dm);
-}
-
-static void mesh_foreachScreenFace__mapFunc(void *userData, int index, float *cent, float *no)
-{
- struct { void (*func)(void *userData, EditFace *efa, int x, int y, int index); void *userData; float pmat[4][4], vmat[4][4]; } *data = userData;
- EditFace *efa = EM_get_face_for_index(index);
- short s[2];
-
- if (efa && efa->h==0 && efa->fgonf!=EM_FGON) {
- view3d_project_short_clip(curarea, cent, s, data->pmat, data->vmat);
-
- data->func(data->userData, efa, s[0], s[1], index);
- }
-}
-void mesh_foreachScreenFace(void (*func)(void *userData, EditFace *efa, int x, int y, int index), void *userData)
-{
- struct { void (*func)(void *userData, EditFace *efa, int x, int y, int index); void *userData; float pmat[4][4], vmat[4][4]; } data;
- DerivedMesh *dm = editmesh_get_derived_cage(CD_MASK_BAREMESH);
-
- data.func = func;
- data.userData = userData;
-
- view3d_get_object_project_mat(curarea, G.obedit, data.pmat, data.vmat);
-
- EM_init_index_arrays(0, 0, 1);
- dm->foreachMappedFaceCenter(dm, mesh_foreachScreenFace__mapFunc, &data);
- EM_free_index_arrays();
-
- dm->release(dm);
-}
-
-void nurbs_foreachScreenVert(void (*func)(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y), void *userData)
-{
- float pmat[4][4], vmat[4][4];
- short s[2];
- Nurb *nu;
- int i;
-
- view3d_get_object_project_mat(curarea, G.obedit, pmat, vmat);
-
- for (nu= editNurb.first; nu; nu=nu->next) {
- if((nu->type & 7)==CU_BEZIER) {
- for (i=0; i<nu->pntsu; i++) {
- BezTriple *bezt = &nu->bezt[i];
-
- if(bezt->hide==0) {
- if (G.f & G_HIDDENHANDLES) {
- view3d_project_short_clip(curarea, bezt->vec[1], s, pmat, vmat);
- if (s[0] != IS_CLIPPED)
- func(userData, nu, NULL, bezt, 1, s[0], s[1]);
- } else {
- view3d_project_short_clip(curarea, bezt->vec[0], s, pmat, vmat);
- if (s[0] != IS_CLIPPED)
- func(userData, nu, NULL, bezt, 0, s[0], s[1]);
- view3d_project_short_clip(curarea, bezt->vec[1], s, pmat, vmat);
- if (s[0] != IS_CLIPPED)
- func(userData, nu, NULL, bezt, 1, s[0], s[1]);
- view3d_project_short_clip(curarea, bezt->vec[2], s, pmat, vmat);
- if (s[0] != IS_CLIPPED)
- func(userData, nu, NULL, bezt, 2, s[0], s[1]);
- }
- }
- }
- }
- else {
- for (i=0; i<nu->pntsu*nu->pntsv; i++) {
- BPoint *bp = &nu->bp[i];
-
- if(bp->hide==0) {
- view3d_project_short_clip(curarea, bp->vec, s, pmat, vmat);
- func(userData, nu, bp, NULL, -1, s[0], s[1]);
- }
- }
- }
- }
-}
-
-/* ************** DRAW MESH ****************** */
-
-/* First section is all the "simple" draw routines,
- * ones that just pass some sort of primitive to GL,
- * with perhaps various options to control lighting,
- * color, etc.
- *
- * These routines should not have user interface related
- * logic!!!
- */
-
-static void draw_dm_face_normals__mapFunc(void *userData, int index, float *cent, float *no)
-{
- EditFace *efa = EM_get_face_for_index(index);
-
- if (efa->h==0 && efa->fgonf!=EM_FGON) {
- glVertex3fv(cent);
- glVertex3f( cent[0] + no[0]*G.scene->editbutsize,
- cent[1] + no[1]*G.scene->editbutsize,
- cent[2] + no[2]*G.scene->editbutsize);
- }
-}
-static void draw_dm_face_normals(DerivedMesh *dm) {
- glBegin(GL_LINES);
- dm->foreachMappedFaceCenter(dm, draw_dm_face_normals__mapFunc, 0);
- glEnd();
-}
-
-static void draw_dm_face_centers__mapFunc(void *userData, int index, float *cent, float *no)
-{
- EditFace *efa = EM_get_face_for_index(index);
- int sel = *((int*) userData);
-
- if (efa->h==0 && efa->fgonf!=EM_FGON && (efa->f&SELECT)==sel) {
- bglVertex3fv(cent);
- }
-}
-static void draw_dm_face_centers(DerivedMesh *dm, int sel)
-{
- bglBegin(GL_POINTS);
- dm->foreachMappedFaceCenter(dm, draw_dm_face_centers__mapFunc, &sel);
- bglEnd();
-}
-
-static void draw_dm_vert_normals__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s)
-{
- EditVert *eve = EM_get_vert_for_index(index);
-
- if (eve->h==0) {
- glVertex3fv(co);
-
- if (no_f) {
- glVertex3f( co[0] + no_f[0]*G.scene->editbutsize,
- co[1] + no_f[1]*G.scene->editbutsize,
- co[2] + no_f[2]*G.scene->editbutsize);
- } else {
- glVertex3f( co[0] + no_s[0]*G.scene->editbutsize/32767.0f,
- co[1] + no_s[1]*G.scene->editbutsize/32767.0f,
- co[2] + no_s[2]*G.scene->editbutsize/32767.0f);
- }
- }
-}
-static void draw_dm_vert_normals(DerivedMesh *dm) {
- glBegin(GL_LINES);
- dm->foreachMappedVert(dm, draw_dm_vert_normals__mapFunc, NULL);
- glEnd();
-}
-
- /* Draw verts with color set based on selection */
-static void draw_dm_verts__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s)
-{
- struct { int sel; EditVert *eve_act; } * data = userData;
- EditVert *eve = EM_get_vert_for_index(index);
-
- if (eve->h==0 && (eve->f&SELECT)==data->sel) {
- /* draw active larger - need to stop/start point drawing for this :/ */
- if (eve==data->eve_act) {
- float size = BIF_GetThemeValuef(TH_VERTEX_SIZE);
- BIF_ThemeColor4(TH_EDITMESH_ACTIVE);
-
- bglEnd();
-
- glPointSize(size);
- bglBegin(GL_POINTS);
- bglVertex3fv(co);
- bglEnd();
-
- BIF_ThemeColor4(TH_VERTEX_SELECT);
- glPointSize(size);
- bglBegin(GL_POINTS);
- } else {
- bglVertex3fv(co);
- }
- }
-}
-static void draw_dm_verts(DerivedMesh *dm, int sel, EditVert *eve_act)
-{
- struct { int sel; EditVert *eve_act; } data;
- data.sel = sel;
- data.eve_act = eve_act;
-
- bglBegin(GL_POINTS);
- dm->foreachMappedVert(dm, draw_dm_verts__mapFunc, &data);
- bglEnd();
-}
-
- /* Draw edges with color set based on selection */
-static int draw_dm_edges_sel__setDrawOptions(void *userData, int index)
-{
- EditEdge *eed = EM_get_edge_for_index(index);
- //unsigned char **cols = userData, *col;
- struct { unsigned char *baseCol, *selCol, *actCol; EditEdge *eed_act; } * data = userData;
- unsigned char *col;
-
- if (eed->h==0) {
- if (eed==data->eed_act) {
- glColor4ubv(data->actCol);
- } else {
- if (eed->f&SELECT) {
- col = data->selCol;
- } else {
- col = data->baseCol;
- }
- /* no alpha, this is used so a transparent color can disable drawing unselected edges in editmode */
- if (col[3]==0) return 0;
-
- glColor4ubv(col);
- }
- return 1;
- } else {
- return 0;
- }
-}
-static void draw_dm_edges_sel(DerivedMesh *dm, unsigned char *baseCol, unsigned char *selCol, unsigned char *actCol, EditEdge *eed_act)
-{
- struct { unsigned char *baseCol, *selCol, *actCol; EditEdge *eed_act; } data;
-
- data.baseCol = baseCol;
- data.selCol = selCol;
- data.actCol = actCol;
- data.eed_act = eed_act;
- dm->drawMappedEdges(dm, draw_dm_edges_sel__setDrawOptions, &data);
-}
-
- /* Draw edges */
-static int draw_dm_edges__setDrawOptions(void *userData, int index)
-{
- return EM_get_edge_for_index(index)->h==0;
-}
-static void draw_dm_edges(DerivedMesh *dm)
-{
- dm->drawMappedEdges(dm, draw_dm_edges__setDrawOptions, NULL);
-}
-
- /* Draw edges with color interpolated based on selection */
-static int draw_dm_edges_sel_interp__setDrawOptions(void *userData, int index)
-{
- return EM_get_edge_for_index(index)->h==0;
-}
-static void draw_dm_edges_sel_interp__setDrawInterpOptions(void *userData, int index, float t)
-{
- EditEdge *eed = EM_get_edge_for_index(index);
- unsigned char **cols = userData;
- unsigned char *col0 = cols[(eed->v1->f&SELECT)?1:0];
- unsigned char *col1 = cols[(eed->v2->f&SELECT)?1:0];
-
- glColor4ub( col0[0] + (col1[0]-col0[0])*t,
- col0[1] + (col1[1]-col0[1])*t,
- col0[2] + (col1[2]-col0[2])*t,
- col0[3] + (col1[3]-col0[3])*t);
-}
-static void draw_dm_edges_sel_interp(DerivedMesh *dm, unsigned char *baseCol, unsigned char *selCol)
-{
- unsigned char *cols[2];
- cols[0] = baseCol;
- cols[1] = selCol;
- dm->drawMappedEdgesInterp(dm, draw_dm_edges_sel_interp__setDrawOptions, draw_dm_edges_sel_interp__setDrawInterpOptions, cols);
-}
-
- /* Draw only seam edges */
-static int draw_dm_edges_seams__setDrawOptions(void *userData, int index)
-{
- EditEdge *eed = EM_get_edge_for_index(index);
-
- return (eed->h==0 && eed->seam);
-}
-static void draw_dm_edges_seams(DerivedMesh *dm)
-{
- dm->drawMappedEdges(dm, draw_dm_edges_seams__setDrawOptions, NULL);
-}
-
- /* Draw only sharp edges */
-static int draw_dm_edges_sharp__setDrawOptions(void *userData, int index)
-{
- EditEdge *eed = EM_get_edge_for_index(index);
-
- return (eed->h==0 && eed->sharp);
-}
-static void draw_dm_edges_sharp(DerivedMesh *dm)
-{
- dm->drawMappedEdges(dm, draw_dm_edges_sharp__setDrawOptions, NULL);
-}
-
-
- /* Draw faces with color set based on selection
- * return 2 for the active face so it renders with stipple enabled */
-static int draw_dm_faces_sel__setDrawOptions(void *userData, int index, int *drawSmooth_r)
-{
- struct { unsigned char *cols[3]; EditFace *efa_act; } * data = userData;
- EditFace *efa = EM_get_face_for_index(index);
- unsigned char *col;
-
- if (efa->h==0) {
- if (efa == data->efa_act) {
- glColor4ubv(data->cols[2]);
- return 2; /* stipple */
- } else {
- col = data->cols[(efa->f&SELECT)?1:0];
- if (col[3]==0) return 0;
- glColor4ubv(col);
- return 1;
- }
- }
- return 0;
-}
-
-/* also draws the active face */
-static void draw_dm_faces_sel(DerivedMesh *dm, unsigned char *baseCol, unsigned char *selCol, unsigned char *actCol, EditFace *efa_act)
-{
- struct { unsigned char *cols[3]; EditFace *efa_act; } data;
- data.cols[0] = baseCol;
- data.cols[1] = selCol;
- data.cols[2] = actCol;
- data.efa_act = efa_act;
-
- dm->drawMappedFaces(dm, draw_dm_faces_sel__setDrawOptions, &data, 0);
-}
-
-static int draw_dm_creases__setDrawOptions(void *userData, int index)
-{
- EditEdge *eed = EM_get_edge_for_index(index);
-
- if (eed->h==0 && eed->crease!=0.0) {
- BIF_ThemeColorBlend(TH_WIRE, TH_EDGE_SELECT, eed->crease);
- return 1;
- } else {
- return 0;
- }
-}
-static void draw_dm_creases(DerivedMesh *dm)
-{
- glLineWidth(3.0);
- dm->drawMappedEdges(dm, draw_dm_creases__setDrawOptions, NULL);
- glLineWidth(1.0);
-}
-
-/* Second section of routines: Combine first sets to form fancy
- * drawing routines (for example rendering twice to get overlays).
- *
- * Also includes routines that are basic drawing but are too
- * specialized to be split out (like drawing creases or measurements).
- */
-
-/* EditMesh drawing routines*/
-
-static void draw_em_fancy_verts(EditMesh *em, DerivedMesh *cageDM, EditVert *eve_act)
-{
- int sel;
-
- if(G.vd->zbuf) glDepthMask(0); // disable write in zbuffer, zbuf select
-
- for (sel=0; sel<2; sel++) {
- char col[4], fcol[4];
- int pass;
-
- BIF_GetThemeColor3ubv(sel?TH_VERTEX_SELECT:TH_VERTEX, col);
- BIF_GetThemeColor3ubv(sel?TH_FACE_DOT:TH_WIRE, fcol);
-
- for (pass=0; pass<2; pass++) {
- float size = BIF_GetThemeValuef(TH_VERTEX_SIZE);
- float fsize = BIF_GetThemeValuef(TH_FACEDOT_SIZE);
-
- if (pass==0) {
- if(G.vd->zbuf && !(G.vd->flag&V3D_ZBUF_SELECT)) {
- glDisable(GL_DEPTH_TEST);
-
- glEnable(GL_BLEND);
- } else {
- continue;
- }
-
- size = (size>2.1?size/2.0:size);
- fsize = (fsize>2.1?fsize/2.0:fsize);
- col[3] = fcol[3] = 100;
- } else {
- col[3] = fcol[3] = 255;
- }
-
- if(G.scene->selectmode & SCE_SELECT_VERTEX) {
- glPointSize(size);
- glColor4ubv((GLubyte *)col);
- draw_dm_verts(cageDM, sel, eve_act);
- }
-
- if( CHECK_OB_DRAWFACEDOT(G.scene, G.vd, G.obedit->dt) ) {
- glPointSize(fsize);
- glColor4ubv((GLubyte *)fcol);
- draw_dm_face_centers(cageDM, sel);
- }
-
- if (pass==0) {
- glDisable(GL_BLEND);
- glEnable(GL_DEPTH_TEST);
- }
- }
- }
-
- if(G.vd->zbuf) glDepthMask(1);
- glPointSize(1.0);
-}
-
-static void draw_em_fancy_edges(DerivedMesh *cageDM, short sel_only, EditEdge *eed_act)
-{
- int pass;
- unsigned char wireCol[4], selCol[4], actCol[4];
-
- /* since this function does transparant... */
- BIF_GetThemeColor3ubv(TH_EDGE_SELECT, (char *)selCol);
- BIF_GetThemeColor3ubv(TH_WIRE, (char *)wireCol);
- BIF_GetThemeColor3ubv(TH_EDITMESH_ACTIVE, (char *)actCol);
-
- /* when sel only is used, dont render wire, only selected, this is used for
- * textured draw mode when the 'edges' option is disabled */
- if (sel_only)
- wireCol[3] = 0;
-
- for (pass=0; pass<2; pass++) {
- /* show wires in transparant when no zbuf clipping for select */
- if (pass==0) {
- if (G.vd->zbuf && (G.vd->flag & V3D_ZBUF_SELECT)==0) {
- glEnable(GL_BLEND);
- glDisable(GL_DEPTH_TEST);
- selCol[3] = 85;
- if (!sel_only) wireCol[3] = 85;
- } else {
- continue;
- }
- } else {
- selCol[3] = 255;
- if (!sel_only) wireCol[3] = 255;
- }
-
- if(G.scene->selectmode == SCE_SELECT_FACE) {
- draw_dm_edges_sel(cageDM, wireCol, selCol, actCol, eed_act);
- }
- else if( (G.f & G_DRAWEDGES) || (G.scene->selectmode & SCE_SELECT_EDGE) ) {
- if(cageDM->drawMappedEdgesInterp && (G.scene->selectmode & SCE_SELECT_VERTEX)) {
- glShadeModel(GL_SMOOTH);
- draw_dm_edges_sel_interp(cageDM, wireCol, selCol);
- glShadeModel(GL_FLAT);
- } else {
- draw_dm_edges_sel(cageDM, wireCol, selCol, actCol, eed_act);
- }
- }
- else {
- if (!sel_only) {
- glColor4ubv(wireCol);
- draw_dm_edges(cageDM);
- }
- }
-
- if (pass==0) {
- glDisable(GL_BLEND);
- glEnable(GL_DEPTH_TEST);
- }
- }
-}
-
-#ifdef WITH_VERSE
-/*
- * draw some debug info about verse mesh (vertex indexes,
- * face indexes, status of )
- */
-static void draw_verse_debug(Object *ob, EditMesh *em)
-{
- struct EditVert *eve=NULL;
- struct EditFace *efa=NULL;
- float v1[3], v2[3], v3[3], v4[3], fvec[3], col[3];
- char val[32];
-
- if(G.vd->zbuf && (G.vd->flag & V3D_ZBUF_SELECT)==0)
- glDisable(GL_DEPTH_TEST);
-
- if(G.vd->zbuf) bglPolygonOffset(5.0);
-
- BIF_GetThemeColor3fv(TH_TEXT, col);
- /* make color a bit more red */
- if(col[0]> 0.5) {col[1]*=0.7; col[2]*= 0.7;}
- else col[0]= col[0]*0.7 + 0.3;
- glColor3fv(col);
-
- /* draw IDs of verse vertexes */
- for(eve = em->verts.first; eve; eve = eve->next) {
- if(eve->vvert) {
- VecLerpf(fvec, ob->loc, eve->co, 1.1);
- glRasterPos3f(fvec[0], fvec[1], fvec[2]);
-
- sprintf(val, "%d", ((VerseVert*)eve->vvert)->id);
- BMF_DrawString(G.fonts, val);
- }
- }
-
- /* draw IDs of verse faces */
- for(efa = em->faces.first; efa; efa = efa->next) {
- if(efa->vface) {
- VECCOPY(v1, efa->v1->co);
- VECCOPY(v2, efa->v2->co);
- VECCOPY(v3, efa->v3->co);
- if(efa->v4) {
- VECCOPY(v4, efa->v4->co);
- glRasterPos3f(0.25*(v1[0]+v2[0]+v3[0]+v4[0]),
- 0.25*(v1[1]+v2[1]+v3[1]+v4[1]),
- 0.25*(v1[2]+v2[2]+v3[2]+v4[2]));
- }
- else {
- glRasterPos3f((v1[0]+v2[0]+v3[0])/3,
- (v1[1]+v2[1]+v3[1])/3,
- (v1[2]+v2[2]+v3[2])/3);
- }
-
- sprintf(val, "%d", ((VerseFace*)efa->vface)->id);
- BMF_DrawString(G.fonts, val);
-
- }
- }
-
- if(G.vd->zbuf) {
- glEnable(GL_DEPTH_TEST);
- bglPolygonOffset(0.0);
- }
-}
-#endif
-
-static void draw_em_measure_stats(Object *ob, EditMesh *em)
-{
- EditEdge *eed;
- EditFace *efa;
- float v1[3], v2[3], v3[3], v4[3];
- float fvec[3];
- char val[32]; /* Stores the measurement display text here */
- char conv_float[5]; /* Use a float conversion matching the grid size */
- float area, col[3]; /* area of the face, color of the text to draw */
-
- /* make the precission of the pronted value proportionate to the gridsize */
- if ((G.vd->grid) < 0.01)
- strcpy(conv_float, "%.6f");
- else if ((G.vd->grid) < 0.1)
- strcpy(conv_float, "%.5f");
- else if ((G.vd->grid) < 1.0)
- strcpy(conv_float, "%.4f");
- else if ((G.vd->grid) < 10.0)
- strcpy(conv_float, "%.3f");
- else
- strcpy(conv_float, "%.2f");
-
-
- if(G.vd->zbuf && (G.vd->flag & V3D_ZBUF_SELECT)==0)
- glDisable(GL_DEPTH_TEST);
-
- if(G.vd->zbuf) bglPolygonOffset(5.0);
-
- if(G.f & G_DRAW_EDGELEN) {
- BIF_GetThemeColor3fv(TH_TEXT, col);
- /* make color a bit more red */
- if(col[0]> 0.5) {col[1]*=0.7; col[2]*= 0.7;}
- else col[0]= col[0]*0.7 + 0.3;
- glColor3fv(col);
-
- for(eed= em->edges.first; eed; eed= eed->next) {
- /* draw non fgon edges, or selected edges, or edges next to selected verts while draging */
- if((eed->h != EM_FGON) && ((eed->f & SELECT) || (G.moving && ((eed->v1->f & SELECT) || (eed->v2->f & SELECT)) ))) {
- VECCOPY(v1, eed->v1->co);
- VECCOPY(v2, eed->v2->co);
-
- glRasterPos3f( 0.5*(v1[0]+v2[0]), 0.5*(v1[1]+v2[1]), 0.5*(v1[2]+v2[2]));
-
- if(G.vd->flag & V3D_GLOBAL_STATS) {
- Mat4MulVecfl(ob->obmat, v1);
- Mat4MulVecfl(ob->obmat, v2);
- }
-
- sprintf(val, conv_float, VecLenf(v1, v2));
- BMF_DrawString( G.fonts, val);
- }
- }
- }
-
- if(G.f & G_DRAW_FACEAREA) {
- extern int faceselectedOR(EditFace *efa, int flag); // editmesh.h shouldn't be in this file... ok for now?
-
- BIF_GetThemeColor3fv(TH_TEXT, col);
- /* make color a bit more green */
- if(col[1]> 0.5) {col[0]*=0.7; col[2]*= 0.7;}
- else col[1]= col[1]*0.7 + 0.3;
- glColor3fv(col);
-
- for(efa= em->faces.first; efa; efa= efa->next) {
- if((efa->f & SELECT) || (G.moving && faceselectedOR(efa, SELECT)) ) {
- VECCOPY(v1, efa->v1->co);
- VECCOPY(v2, efa->v2->co);
- VECCOPY(v3, efa->v3->co);
- if (efa->v4) {
- VECCOPY(v4, efa->v4->co);
- }
- if(G.vd->flag & V3D_GLOBAL_STATS) {
- Mat4MulVecfl(ob->obmat, v1);
- Mat4MulVecfl(ob->obmat, v2);
- Mat4MulVecfl(ob->obmat, v3);
- if (efa->v4) Mat4MulVecfl(ob->obmat, v4);
- }
-
- if (efa->v4)
- area= AreaQ3Dfl(v1, v2, v3, v4);
- else
- area = AreaT3Dfl(v1, v2, v3);
-
- sprintf(val, conv_float, area);
- glRasterPos3fv(efa->cent);
- BMF_DrawString( G.fonts, val);
- }
- }
- }
-
- if(G.f & G_DRAW_EDGEANG) {
- EditEdge *e1, *e2, *e3, *e4;
-
- BIF_GetThemeColor3fv(TH_TEXT, col);
- /* make color a bit more blue */
- if(col[2]> 0.5) {col[0]*=0.7; col[1]*= 0.7;}
- else col[2]= col[2]*0.7 + 0.3;
- glColor3fv(col);
-
- for(efa= em->faces.first; efa; efa= efa->next) {
- VECCOPY(v1, efa->v1->co);
- VECCOPY(v2, efa->v2->co);
- VECCOPY(v3, efa->v3->co);
- if(efa->v4) {
- VECCOPY(v4, efa->v4->co);
- }
- else {
- VECCOPY(v4, v3);
- }
- if(G.vd->flag & V3D_GLOBAL_STATS) {
- Mat4MulVecfl(ob->obmat, v1);
- Mat4MulVecfl(ob->obmat, v2);
- Mat4MulVecfl(ob->obmat, v3);
- if (efa->v4) Mat4MulVecfl(ob->obmat, v4);
- }
-
- e1= efa->e1;
- e2= efa->e2;
- e3= efa->e3;
- if(efa->e4) e4= efa->e4; else e4= e3;
-
- /* Calculate the angles */
-
- if( (e4->f & e1->f & SELECT) || (G.moving && (efa->v1->f & SELECT)) ) {
- /* Vec 1 */
- sprintf(val,"%.3f", VecAngle3(v4, v1, v2));
- VecLerpf(fvec, efa->cent, efa->v1->co, 0.8);
- glRasterPos3fv(fvec);
- BMF_DrawString( G.fonts, val);
- }
- if( (e1->f & e2->f & SELECT) || (G.moving && (efa->v2->f & SELECT)) ) {
- /* Vec 2 */
- sprintf(val,"%.3f", VecAngle3(v1, v2, v3));
- VecLerpf(fvec, efa->cent, efa->v2->co, 0.8);
- glRasterPos3fv(fvec);
- BMF_DrawString( G.fonts, val);
- }
- if( (e2->f & e3->f & SELECT) || (G.moving && (efa->v3->f & SELECT)) ) {
- /* Vec 3 */
- if(efa->v4)
- sprintf(val,"%.3f", VecAngle3(v2, v3, v4));
- else
- sprintf(val,"%.3f", VecAngle3(v2, v3, v1));
- VecLerpf(fvec, efa->cent, efa->v3->co, 0.8);
- glRasterPos3fv(fvec);
- BMF_DrawString( G.fonts, val);
- }
- /* Vec 4 */
- if(efa->v4) {
- if( (e3->f & e4->f & SELECT) || (G.moving && (efa->v4->f & SELECT)) ) {
- sprintf(val,"%.3f", VecAngle3(v3, v4, v1));
- VecLerpf(fvec, efa->cent, efa->v4->co, 0.8);
- glRasterPos3fv(fvec);
- BMF_DrawString( G.fonts, val);
- }
- }
- }
- }
-
- if(G.vd->zbuf) {
- glEnable(GL_DEPTH_TEST);
- bglPolygonOffset(0.0);
- }
-}
-
-static int draw_em_fancy__setFaceOpts(void *userData, int index, int *drawSmooth_r)
-{
- EditFace *efa = EM_get_face_for_index(index);
-
- if (efa->h==0) {
- set_gl_material(efa->mat_nr+1);
- return 1;
- } else {
- return 0;
- }
-}
-static void draw_em_fancy(Object *ob, EditMesh *em, DerivedMesh *cageDM, DerivedMesh *finalDM, int dt)
-{
- Mesh *me = ob->data;
- EditFace *efa_act = NULL;
- EditEdge *eed_act = NULL;
- EditVert *eve_act = NULL;
-
- if (G.editMesh->selected.last) {
- EditSelection *ese = G.editMesh->selected.last;
- if ( ese->type == EDITFACE ) {
- efa_act = (EditFace *)ese->data;
- } else if ( ese->type == EDITEDGE ) {
- eed_act = (EditEdge *)ese->data;
- } else if ( ese->type == EDITVERT ) {
- eve_act = (EditVert *)ese->data;
- }
- }
-
- EM_init_index_arrays(1, 1, 1);
-
- if(dt>OB_WIRE) {
- if( CHECK_OB_DRAWTEXTURE(G.vd, dt) ) {
- draw_mesh_textured(ob, finalDM, 0);
- } else {
- glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, me->flag & ME_TWOSIDED);
-
- glEnable(GL_LIGHTING);
- glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
-
- finalDM->drawMappedFaces(finalDM, draw_em_fancy__setFaceOpts, 0, 0);
-
- glFrontFace(GL_CCW);
- glDisable(GL_LIGHTING);
- }
-
- // Setup for drawing wire over, disable zbuffer
- // write to show selected edge wires better
- BIF_ThemeColor(TH_WIRE);
-
- bglPolygonOffset(1.0);
- glDepthMask(0);
- }
- else {
- if (cageDM!=finalDM) {
- BIF_ThemeColorBlend(TH_WIRE, TH_BACK, 0.7);
- finalDM->drawEdges(finalDM, 1);
- }
- }
-
- if((G.f & (G_DRAWFACES)) || FACESEL_PAINT_TEST) { /* transp faces */
- unsigned char col1[4], col2[4], col3[4];
-
- BIF_GetThemeColor4ubv(TH_FACE, (char *)col1);
- BIF_GetThemeColor4ubv(TH_FACE_SELECT, (char *)col2);
- BIF_GetThemeColor4ubv(TH_EDITMESH_ACTIVE, (char *)col3);
-
- glEnable(GL_BLEND);
- glDepthMask(0); // disable write in zbuffer, needed for nice transp
-
- /* dont draw unselected faces, only selected, this is MUCH nicer when texturing */
- if CHECK_OB_DRAWTEXTURE(G.vd, dt)
- col1[3] = 0;
-
- draw_dm_faces_sel(cageDM, col1, col2, col3, efa_act);
-
- glDisable(GL_BLEND);
- glDepthMask(1); // restore write in zbuffer
- } else if (efa_act) {
- /* even if draw faces is off it would be nice to draw the stipple face
- * Make all other faces zero alpha except for the active
- * */
- unsigned char col1[4], col2[4], col3[4];
- col1[3] = col2[3] = 0; /* dont draw */
- BIF_GetThemeColor4ubv(TH_EDITMESH_ACTIVE, (char *)col3);
-
- glEnable(GL_BLEND);
- glDepthMask(0); // disable write in zbuffer, needed for nice transp
-
- draw_dm_faces_sel(cageDM, col1, col2, col3, efa_act);
-
- glDisable(GL_BLEND);
- glDepthMask(1); // restore write in zbuffer
-
- }
-
- /* here starts all fancy draw-extra over */
- if((G.f & G_DRAWEDGES)==0 && CHECK_OB_DRAWTEXTURE(G.vd, dt)) {
- /* we are drawing textures and 'G_DRAWEDGES' is disabled, dont draw any edges */
-
- /* only draw selected edges otherwise there is no way of telling if a face is selected */
- draw_em_fancy_edges(cageDM, 1, eed_act);
-
- } else {
- if(G.f & G_DRAWSEAMS) {
- BIF_ThemeColor(TH_EDGE_SEAM);
- glLineWidth(2);
-
- draw_dm_edges_seams(cageDM);
-
- glColor3ub(0,0,0);
- glLineWidth(1);
- }
-
- if(G.f & G_DRAWSHARP) {
- BIF_ThemeColor(TH_EDGE_SHARP);
- glLineWidth(2);
-
- draw_dm_edges_sharp(cageDM);
-
- glColor3ub(0,0,0);
- glLineWidth(1);
- }
-
- if(G.f & G_DRAWCREASES) {
- draw_dm_creases(cageDM);
- }
-
- draw_em_fancy_edges(cageDM, 0, eed_act);
- }
- if(ob==G.obedit) {
- retopo_matrix_update(G.vd);
-
- draw_em_fancy_verts(em, cageDM, eve_act);
-
- if(G.f & G_DRAWNORMALS) {
- BIF_ThemeColor(TH_NORMAL);
- draw_dm_face_normals(cageDM);
- }
- if(G.f & G_DRAW_VNORMALS) {
- BIF_ThemeColor(TH_NORMAL);
- draw_dm_vert_normals(cageDM);
- }
-
- if(G.f & (G_DRAW_EDGELEN|G_DRAW_FACEAREA|G_DRAW_EDGEANG))
- draw_em_measure_stats(ob, em);
-#ifdef WITH_VERSE
- if(em->vnode && (G.f & G_DRAW_VERSE_DEBUG))
- draw_verse_debug(ob, em);
-#endif
- }
-
- if(dt>OB_WIRE) {
- glDepthMask(1);
- bglPolygonOffset(0.0);
- }
-
- EM_free_index_arrays();
-}
-
-/* Mesh drawing routines */
-
-static void draw_mesh_object_outline(Object *ob, DerivedMesh *dm)
-{
-
- if(G.vd->transp==0) { // not when we draw the transparent pass
- glLineWidth(2.0);
- glDepthMask(0);
-
- /* if transparent, we cannot draw the edges for solid select... edges have no material info.
- drawFacesSolid() doesn't draw the transparent faces */
- if(ob->dtx & OB_DRAWTRANSP) {
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- dm->drawFacesSolid(dm, set_gl_material);
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- }
- else {
- dm->drawEdges(dm, 0);
- }
-
- glLineWidth(1.0);
- glDepthMask(1);
- }
-}
-
-static int wpaint__setSolidDrawOptions(void *userData, int index, int *drawSmooth_r)
-{
- *drawSmooth_r = 1;
- return 1;
-}
-
-static void draw_mesh_fancy(Base *base, int dt, int flag)
-{
- Object *ob= base->object;
- Mesh *me = ob->data;
- Material *ma= give_current_material(ob, 1);
- int hasHaloMat = (ma && (ma->mode&MA_HALO));
- int draw_wire = ob->dtx&OB_DRAWWIRE;
- int totvert, totedge, totface;
- DispList *dl;
- DerivedMesh *dm= mesh_get_derived_final(ob, get_viewedit_datamask());
-
- if(!dm)
- return;
-
-#ifdef WITH_VERSE
- if(me->vnode) {
- struct VNode *vnode = (VNode*)me->vnode;
- struct VLayer *vert_vlayer = find_verse_layer_type((VGeomData*)vnode->data, VERTEX_LAYER);
- struct VLayer *face_vlayer = find_verse_layer_type((VGeomData*)vnode->data, POLYGON_LAYER);
-
- if(vert_vlayer) totvert = vert_vlayer->dl.da.count;
- else totvert = 0;
- totedge = 0; /* total count of edge needn't to be zero, but verse doesn't know edges */
- if(face_vlayer) totface = face_vlayer->dl.da.count;
- else totface = 0;
- }
- else {
- totvert = dm->getNumVerts(dm);
- totedge = dm->getNumEdges(dm);
- totface = dm->getNumFaces(dm);
- }
-#else
- totvert = dm->getNumVerts(dm);
- totedge = dm->getNumEdges(dm);
- totface = dm->getNumFaces(dm);
-#endif
-
- /* vertexpaint, faceselect wants this, but it doesnt work for shaded? */
- if(dt!=OB_SHADED)
- glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
-
- // Unwanted combination.
- if (ob==OBACT && FACESEL_PAINT_TEST) draw_wire = 0;
-
- if(dt==OB_BOUNDBOX) {
- draw_bounding_volume(ob);
- }
- else if(hasHaloMat || (totface==0 && totedge==0)) {
- glPointSize(1.5);
- dm->drawVerts(dm);
- glPointSize(1.0);
- }
- else if(dt==OB_WIRE || totface==0) {
- draw_wire = 1;
- }
- else if( (ob==OBACT && (G.f & G_TEXTUREPAINT || FACESEL_PAINT_TEST)) ||
- CHECK_OB_DRAWTEXTURE(G.vd, dt))
- {
- int faceselect= (ob==OBACT && FACESEL_PAINT_TEST);
-
- if ((G.vd->flag&V3D_SELECT_OUTLINE) && (base->flag&SELECT) && !(G.f&G_PICKSEL || FACESEL_PAINT_TEST) && !draw_wire) {
- draw_mesh_object_outline(ob, dm);
- }
-
- draw_mesh_textured(ob, dm, faceselect);
-
- if(!faceselect) {
- if(base->flag & SELECT)
- BIF_ThemeColor((ob==OBACT)?TH_ACTIVE:TH_SELECT);
- else
- BIF_ThemeColor(TH_WIRE);
-
- dm->drawLooseEdges(dm);
- }
- }
- else if(dt==OB_SOLID ) {
-
- if ((G.vd->flag&V3D_SELECT_OUTLINE) && (base->flag&SELECT) && !draw_wire) {
- draw_mesh_object_outline(ob, dm);
- }
-
- glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, me->flag & ME_TWOSIDED );
-
- glEnable(GL_LIGHTING);
- glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
-
- dm->drawFacesSolid(dm, set_gl_material);
-
- glFrontFace(GL_CCW);
- glDisable(GL_LIGHTING);
-
- if(base->flag & SELECT) {
- BIF_ThemeColor((ob==OBACT)?TH_ACTIVE:TH_SELECT);
- } else {
- BIF_ThemeColor(TH_WIRE);
- }
- dm->drawLooseEdges(dm);
- }
- else if(dt==OB_SHADED) {
- int do_draw= 1; /* to resolve all G.f settings below... */
-
- if(ob==OBACT) {
- do_draw= 0;
- if( (G.f & G_WEIGHTPAINT)) {
- set_gl_material(0); /* enforce defmaterial settings */
-
- /* but set default spec */
- glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR);
- glEnable(GL_COLOR_MATERIAL); /* according manpages needed */
- glColor3ub(120, 120, 120);
- glDisable(GL_COLOR_MATERIAL);
- /* diffuse */
- glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
- glEnable(GL_LIGHTING);
- glEnable(GL_COLOR_MATERIAL);
-
- dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me->mface, 1);
- glDisable(GL_COLOR_MATERIAL);
- glDisable(GL_LIGHTING);
- }
- else if((G.f & (G_VERTEXPAINT+G_TEXTUREPAINT)) && me->mcol) {
- dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 1);
- }
- else if(G.f & (G_VERTEXPAINT+G_TEXTUREPAINT)) {
- glColor3f(1.0f, 1.0f, 1.0f);
- dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 0);
- }
- else do_draw= 1;
- }
- if(do_draw) {
- dl = ob->disp.first;
- if (!dl || !dl->col1) {
- /* release and reload derivedmesh because it might be freed in
- shadeDispList due to a different datamask */
- dm->release(dm);
- shadeDispList(base);
- dl = find_displist(&ob->disp, DL_VERTCOL);
- dm= mesh_get_derived_final(ob, get_viewedit_datamask());
- }
-
- if ((G.vd->flag&V3D_SELECT_OUTLINE) && (base->flag&SELECT) && !draw_wire) {
- draw_mesh_object_outline(ob, dm);
- }
-
- /* False for dupliframe objects */
- if (dl) {
- unsigned int *obCol1 = dl->col1;
- unsigned int *obCol2 = dl->col2;
-
- dm->drawFacesColored(dm, me->flag&ME_TWOSIDED, (unsigned char*) obCol1, (unsigned char*) obCol2);
- }
-
- if(base->flag & SELECT) {
- BIF_ThemeColor((ob==OBACT)?TH_ACTIVE:TH_SELECT);
- } else {
- BIF_ThemeColor(TH_WIRE);
- }
- dm->drawLooseEdges(dm);
- }
- }
-
- /* set default draw color back for wire or for draw-extra later on */
- if (dt!=OB_WIRE) {
- if(base->flag & SELECT) {
- if(ob==OBACT && ob->flag & OB_FROMGROUP)
- BIF_ThemeColor(TH_GROUP_ACTIVE);
- else if(ob->flag & OB_FROMGROUP)
- BIF_ThemeColorShade(TH_GROUP_ACTIVE, -16);
- else if(flag!=DRAW_CONSTCOLOR)
- BIF_ThemeColor((ob==OBACT)?TH_ACTIVE:TH_SELECT);
- else
- glColor3ub(80,80,80);
- } else {
- if (ob->flag & OB_FROMGROUP)
- BIF_ThemeColor(TH_GROUP);
- else {
- if(ob->dtx & OB_DRAWWIRE && flag==DRAW_CONSTCOLOR)
- glColor3ub(80,80,80);
- else
- BIF_ThemeColor(TH_WIRE);
- }
- }
- }
- if (draw_wire) {
- /* If drawing wire and drawtype is not OB_WIRE then we are
- * overlaying the wires.
- */
-
- if (dt!=OB_WIRE) {
- bglPolygonOffset(1.0);
- glDepthMask(0); // disable write in zbuffer, selected edge wires show better
- }
-
- dm->drawEdges(dm, (dt==OB_WIRE || totface==0));
-
- if (dt!=OB_WIRE) {
- glDepthMask(1);
- bglPolygonOffset(0.0);
- }
- }
-
- dm->release(dm);
-}
-
-/* returns 1 if nothing was drawn, for detecting to draw an object center */
-static int draw_mesh_object(Base *base, int dt, int flag)
-{
- Object *ob= base->object;
- Mesh *me= ob->data;
- int has_alpha= 0, drawlinked= 0, retval= 0;
-
- if(G.obedit && ob!=G.obedit && ob->data==G.obedit->data) {
- if(ob_get_key(ob));
- else drawlinked= 1;
- }
-
- if(ob==G.obedit || drawlinked) {
- DerivedMesh *finalDM, *cageDM;
-
- if (G.obedit!=ob)
- finalDM = cageDM = editmesh_get_derived_base();
- else
- cageDM = editmesh_get_derived_cage_and_final(&finalDM,
- get_viewedit_datamask());
-
- if(dt>OB_WIRE) init_gl_materials(ob, 0); // no transp in editmode, the fancy draw over goes bad then
- draw_em_fancy(ob, G.editMesh, cageDM, finalDM, dt);
-
- if (G.obedit!=ob && finalDM)
- finalDM->release(finalDM);
- }
- else if(!G.obedit && (G.f & G_SCULPTMODE) &&(G.scene->sculptdata.flags & SCULPT_DRAW_FAST) &&
- OBACT==ob && !sculpt_modifiers_active(ob)) {
- sculptmode_draw_mesh(0);
- }
- else {
- /* don't create boundbox here with mesh_get_bb(), the derived system will make it, puts deformed bb's OK */
- if(me->totface<=4 || boundbox_clip(ob->obmat, (ob->bb)? ob->bb: me->bb)) {
- if(dt==OB_SOLID) has_alpha= init_gl_materials(ob, (base->flag & OB_FROMDUPLI)==0);
- draw_mesh_fancy(base, dt, flag);
-
- if(me->totvert==0) retval= 1;
- }
- }
-
- /* init_gl_materials did the proper checking if this is needed */
- if(has_alpha) add_view3d_after(G.vd, base, V3D_TRANSP);
-
- return retval;
-}
-
-/* ************** DRAW DISPLIST ****************** */
-
-static int draw_index_wire= 1;
-static int index3_nors_incr= 1;
-
-/* returns 1 when nothing was drawn */
-static int drawDispListwire(ListBase *dlbase)
-{
- DispList *dl;
- int parts, nr;
- float *data;
-
- if(dlbase==NULL) return 1;
-
- glDisableClientState(GL_NORMAL_ARRAY);
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
-
- for(dl= dlbase->first; dl; dl= dl->next) {
- if(dl->parts==0 || dl->nr==0)
- continue;
-
- data= dl->verts;
-
- switch(dl->type) {
- case DL_SEGM:
-
- glVertexPointer(3, GL_FLOAT, 0, data);
-
- for(parts=0; parts<dl->parts; parts++)
- glDrawArrays(GL_LINE_STRIP, parts*dl->nr, dl->nr);
-
- break;
- case DL_POLY:
-
- glVertexPointer(3, GL_FLOAT, 0, data);
-
- for(parts=0; parts<dl->parts; parts++)
- glDrawArrays(GL_LINE_LOOP, parts*dl->nr, dl->nr);
-
- break;
- case DL_SURF:
-
- glVertexPointer(3, GL_FLOAT, 0, data);
-
- for(parts=0; parts<dl->parts; parts++) {
- if(dl->flag & DL_CYCL_U)
- glDrawArrays(GL_LINE_LOOP, parts*dl->nr, dl->nr);
- else
- glDrawArrays(GL_LINE_STRIP, parts*dl->nr, dl->nr);
- }
-
- for(nr=0; nr<dl->nr; nr++) {
- int ofs= 3*dl->nr;
-
- data= ( dl->verts )+3*nr;
- parts= dl->parts;
-
- if(dl->flag & DL_CYCL_V) glBegin(GL_LINE_LOOP);
- else glBegin(GL_LINE_STRIP);
-
- while(parts--) {
- glVertex3fv(data);
- data+=ofs;
- }
- glEnd();
-
- /* (ton) this code crashes for me when resolv is 86 or higher... no clue */
-// glVertexPointer(3, GL_FLOAT, sizeof(float)*3*dl->nr, data + 3*nr);
-// if(dl->flag & DL_CYCL_V)
-// glDrawArrays(GL_LINE_LOOP, 0, dl->parts);
-// else
-// glDrawArrays(GL_LINE_STRIP, 0, dl->parts);
- }
- break;
-
- case DL_INDEX3:
- if(draw_index_wire) {
- glVertexPointer(3, GL_FLOAT, 0, dl->verts);
- glDrawElements(GL_TRIANGLES, 3*dl->parts, GL_UNSIGNED_INT, dl->index);
- }
- break;
-
- case DL_INDEX4:
- if(draw_index_wire) {
- glVertexPointer(3, GL_FLOAT, 0, dl->verts);
- glDrawElements(GL_QUADS, 4*dl->parts, GL_UNSIGNED_INT, dl->index);
- }
- break;
- }
- }
-
- glEnableClientState(GL_NORMAL_ARRAY);
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-
- return 0;
-}
-
-static void drawDispListsolid(ListBase *lb, Object *ob)
-{
- DispList *dl;
- float *data, curcol[4];
- float *ndata;
-
- if(lb==NULL) return;
-
- /* for drawing wire */
- glGetFloatv(GL_CURRENT_COLOR, curcol);
-
- glEnable(GL_LIGHTING);
-
- if(ob->transflag & OB_NEG_SCALE) glFrontFace(GL_CW);
- else glFrontFace(GL_CCW);
-
- if(ob->type==OB_MBALL) { // mball always smooth shaded
- glShadeModel(GL_SMOOTH);
- }
-
- dl= lb->first;
- while(dl) {
- data= dl->verts;
- ndata= dl->nors;
-
- switch(dl->type) {
- case DL_SEGM:
- if(ob->type==OB_SURF) {
- int nr;
-
- glDisable(GL_LIGHTING);
- glColor3fv(curcol);
-
- // glVertexPointer(3, GL_FLOAT, 0, dl->verts);
- // glDrawArrays(GL_LINE_STRIP, 0, dl->nr);
-
- glBegin(GL_LINE_STRIP);
- for(nr= dl->nr; nr; nr--, data+=3)
- glVertex3fv(data);
- glEnd();
-
- glEnable(GL_LIGHTING);
- }
- break;
- case DL_POLY:
- if(ob->type==OB_SURF) {
- int nr;
-
- BIF_ThemeColor(TH_WIRE);
- glDisable(GL_LIGHTING);
-
- /* for some reason glDrawArrays crashes here in half of the platforms (not osx) */
- //glVertexPointer(3, GL_FLOAT, 0, dl->verts);
- //glDrawArrays(GL_LINE_LOOP, 0, dl->nr);
-
- glBegin(GL_LINE_LOOP);
- for(nr= dl->nr; nr; nr--, data+=3)
- glVertex3fv(data);
- glEnd();
-
- glEnable(GL_LIGHTING);
- break;
- }
- case DL_SURF:
-
- if(dl->index) {
- set_gl_material(dl->col+1);
-
- if(dl->rt & CU_SMOOTH) glShadeModel(GL_SMOOTH);
- else glShadeModel(GL_FLAT);
-
- glVertexPointer(3, GL_FLOAT, 0, dl->verts);
- glNormalPointer(GL_FLOAT, 0, dl->nors);
- glDrawElements(GL_QUADS, 4*dl->totindex, GL_UNSIGNED_INT, dl->index);
- }
- break;
-
- case DL_INDEX3:
-
- set_gl_material(dl->col+1);
-
- glVertexPointer(3, GL_FLOAT, 0, dl->verts);
-
- /* voor polys only one normal needed */
- if(index3_nors_incr==0) {
- glDisableClientState(GL_NORMAL_ARRAY);
- glNormal3fv(ndata);
- }
- else
- glNormalPointer(GL_FLOAT, 0, dl->nors);
-
- glDrawElements(GL_TRIANGLES, 3*dl->parts, GL_UNSIGNED_INT, dl->index);
-
- if(index3_nors_incr==0)
- glEnableClientState(GL_NORMAL_ARRAY);
-
- break;
-
- case DL_INDEX4:
-
- set_gl_material(dl->col+1);
-
- glVertexPointer(3, GL_FLOAT, 0, dl->verts);
- glNormalPointer(GL_FLOAT, 0, dl->nors);
- glDrawElements(GL_QUADS, 4*dl->parts, GL_UNSIGNED_INT, dl->index);
-
- break;
- }
- dl= dl->next;
- }
-
- glShadeModel(GL_FLAT);
- glDisable(GL_LIGHTING);
- glFrontFace(GL_CCW);
-}
-
-static void drawDispListshaded(ListBase *lb, Object *ob)
-{
- DispList *dl, *dlob;
- unsigned int *cdata;
-
- if(lb==NULL) return;
-
- glShadeModel(GL_SMOOTH);
- glDisableClientState(GL_NORMAL_ARRAY);
- glEnableClientState(GL_COLOR_ARRAY);
-
- dl= lb->first;
- dlob= ob->disp.first;
- while(dl && dlob) {
-
- cdata= dlob->col1;
- if(cdata==NULL) break;
-
- switch(dl->type) {
- case DL_SURF:
- if(dl->index) {
- glVertexPointer(3, GL_FLOAT, 0, dl->verts);
- glColorPointer(4, GL_UNSIGNED_BYTE, 0, cdata);
- glDrawElements(GL_QUADS, 4*dl->totindex, GL_UNSIGNED_INT, dl->index);
- }
- break;
-
- case DL_INDEX3:
-
- glVertexPointer(3, GL_FLOAT, 0, dl->verts);
- glColorPointer(4, GL_UNSIGNED_BYTE, 0, cdata);
- glDrawElements(GL_TRIANGLES, 3*dl->parts, GL_UNSIGNED_INT, dl->index);
- break;
-
- case DL_INDEX4:
-
- glVertexPointer(3, GL_FLOAT, 0, dl->verts);
- glColorPointer(4, GL_UNSIGNED_BYTE, 0, cdata);
- glDrawElements(GL_QUADS, 4*dl->parts, GL_UNSIGNED_INT, dl->index);
- break;
- }
-
- dl= dl->next;
- dlob= dlob->next;
- }
-
- glShadeModel(GL_FLAT);
- glEnableClientState(GL_NORMAL_ARRAY);
- glDisableClientState(GL_COLOR_ARRAY);
-}
-
-/* returns 1 when nothing was drawn */
-static int drawDispList(Base *base, int dt)
-{
- Object *ob= base->object;
- ListBase *lb=0;
- DispList *dl;
- Curve *cu;
- int solid, retval= 0;
-
- solid= (dt > OB_WIRE);
-
- switch(ob->type) {
- case OB_FONT:
- case OB_CURVE:
- cu= ob->data;
-
- lb= &cu->disp;
-
- if(solid) {
- dl= lb->first;
- if(dl==NULL) return 1;
-
- if(dl->nors==0) addnormalsDispList(ob, lb);
- index3_nors_incr= 0;
-
- if( displist_has_faces(lb)==0) {
- draw_index_wire= 0;
- drawDispListwire(lb);
- draw_index_wire= 1;
- }
- else {
- if(dt==OB_SHADED) {
- if(ob->disp.first==0) shadeDispList(base);
- drawDispListshaded(lb, ob);
- }
- else {
- init_gl_materials(ob, 0);
- glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0);
- drawDispListsolid(lb, ob);
- }
- if(ob==G.obedit && cu->bevobj==NULL && cu->taperobj==NULL) {
- cpack(0);
- draw_index_wire= 0;
- drawDispListwire(lb);
- draw_index_wire= 1;
- }
- }
- index3_nors_incr= 1;
- }
- else {
- draw_index_wire= 0;
- retval= drawDispListwire(lb);
- draw_index_wire= 1;
- }
- break;
- case OB_SURF:
-
- lb= &((Curve *)ob->data)->disp;
-
- if(solid) {
- dl= lb->first;
- if(dl==NULL) return 1;
-
- if(dl->nors==NULL) addnormalsDispList(ob, lb);
-
- if(dt==OB_SHADED) {
- if(ob->disp.first==NULL) shadeDispList(base);
- drawDispListshaded(lb, ob);
- }
- else {
- init_gl_materials(ob, 0);
- glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0);
-
- drawDispListsolid(lb, ob);
- }
- }
- else {
- retval= drawDispListwire(lb);
- }
- break;
- case OB_MBALL:
-
- if( is_basis_mball(ob)) {
- lb= &ob->disp;
- if(lb->first==NULL) makeDispListMBall(ob);
- if(lb->first==NULL) return 1;
-
- if(solid) {
-
- if(dt==OB_SHADED) {
- dl= lb->first;
- if(dl && dl->col1==0) shadeDispList(base);
- drawDispListshaded(lb, ob);
- }
- else {
- init_gl_materials(ob, 0);
- glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0);
-
- drawDispListsolid(lb, ob);
- }
- }
- else{
- /* MetaBalls use DL_INDEX4 type of DispList */
- retval= drawDispListwire(lb);
- }
- }
- break;
- }
-
- return retval;
-}
-
-/* ******************************** */
-
-
-static void draw_particle_system(Base *base, PartEff *paf)
-{
- Object *ob= base->object;
- Particle *pa;
- float ptime, ctime, vec[3], vec1[3], mat[4][4];
- int a, totpart;
-
- pa= paf->keys;
- // FSPARTICLE always rebuild fluid particle system upon change...
- if( (pa==NULL)
- || ( (ob->fluidsimFlag & OB_FLUIDSIM_ENABLE) && (ob->fluidsimSettings) && (ob->fluidsimSettings->type == OB_FLUIDSIM_PARTICLE))
- ) {
- build_particle_system(ob);
- pa= paf->keys;
- if(pa==NULL) return;
- }
-
- myloadmatrix(G.vd->viewmat);
- /* flag abuse... but I need working code too now. This feature doesnt work for per frame animated objects */
- if( (base->flag & OB_FROMDUPLI) && (ob->flag & OB_FROMGROUP) ) {
- Mat4MulMat4(mat, paf->imat, ob->obmat);
- mymultmatrix(mat);
- }
-
- if(ob->ipoflag & OB_OFFS_PARTICLE) ptime= ob->sf;
- else ptime= 0.0;
- ctime= bsystem_time(ob, (float)(G.scene->r.cfra), ptime);
-
- glPointSize(1.0);
-
- if(paf->stype==PAF_VECT) glBegin(GL_LINES);
- else glBegin(GL_POINTS);
-
- totpart= (paf->disp*paf->totpart)/100;
- for(a=0; a<totpart; a++, pa+=paf->totkey) {
-
- if(ctime > pa->time) {
- if(ctime < pa->time+pa->lifetime) {
-
- if(paf->stype==PAF_VECT) {
- where_is_particle(paf, pa, ctime, vec);
- where_is_particle(paf, pa, ctime+1.0, vec1);
-
- glVertex3fv(vec);
- glVertex3fv(vec1);
- }
- else {
- where_is_particle(paf, pa, ctime, vec);
-
- glVertex3fv(vec);
- }
- }
- }
- }
- glEnd();
-
- myloadmatrix(G.vd->viewmat);
- mymultmatrix(ob->obmat); // bring back local matrix for dtx
-}
-
-static void draw_static_particle_system(Object *ob, PartEff *paf, int dt)
-{
- Particle *pa;
- float ctime, mtime, vec[3], veco[3];
- int a, use_norm=0, totpart;
-
- pa= paf->keys;
- // FSPARTICLE always rebuild upon change...
- if( (pa==NULL)
- || ( (ob->fluidsimFlag & OB_FLUIDSIM_ENABLE) && (ob->fluidsimSettings) && (ob->fluidsimSettings->type == OB_FLUIDSIM_PARTICLE))
- ) {
- build_particle_system(ob);
- pa= paf->keys;
- if(pa==NULL) return;
- }
-
- if(paf->stype==PAF_VECT) {
- if(dt>OB_WIRE) {
-
- /* shaded/texture mode: we still draw solid, so have to set materials */
- if(dt>OB_SOLID) init_gl_materials(ob, 0);
-
- glEnable(GL_LIGHTING);
- set_gl_material(paf->omat);
- use_norm= 1;
- }
- }
- else {
- glPointSize(1.0);
- glBegin(GL_POINTS);
- }
-
- totpart= (paf->disp*paf->totpart)/100;
- for(a=0; a<totpart; a++, pa+=paf->totkey) {
-
- if(paf->stype==PAF_VECT) {
-
- glBegin(GL_LINE_STRIP);
- where_is_particle(paf, pa, pa->time, veco);
-
- mtime= pa->time+pa->lifetime+paf->staticstep;
- for(ctime= pa->time+paf->staticstep; ctime<mtime; ctime+=paf->staticstep) {
-
- where_is_particle(paf, pa, ctime, vec);
-
- if(use_norm) {
- float no[3];
- VECSUB(no, vec, veco);
- glNormal3fv(no);
- }
- glVertex3fv(veco);
- VECCOPY(veco, vec);
- }
-
- glVertex3fv(veco);
- glEnd();
- }
- else {
- mtime= pa->time+pa->lifetime+paf->staticstep-1;
- for(ctime= pa->time; ctime<mtime; ctime+=paf->staticstep) {
- where_is_particle(paf, pa, ctime, vec);
- glVertex3fv(vec);
- }
- }
- }
- if(paf->stype==PAF_VECT) {
- glDisable(GL_LIGHTING);
- }
- else {
- glEnd();
- }
-
-}
-
-/* unified drawing of all new particle systems draw types except dupli ob & group */
-/* mostly tries to use vertex arrays for speed */
-
-/* 1. check that everything is ok & updated */
-/* 2. start initialising things */
-/* 3. initialize according to draw type */
-/* 4. allocate drawing data arrays */
-/* 5. start filling the arrays */
-/* 6. draw the arrays */
-/* 7. clean up */
-static void draw_new_particle_system(Base *base, ParticleSystem *psys)
-{
- View3D *v3d= G.vd;
- Object *ob=base->object;
- ParticleSystemModifierData *psmd;
- ParticleSettings *part;
- ParticleData *pars, *pa;
- ParticleKey state, *states=0;
- ParticleCacheKey *cache=0;
- Material *ma;
- Object *bb_ob=0;
- float vel[3], vec[3], vec2[3], imat[4][4], onevec[3]={0.0f,0.0f,0.0f}, bb_center[3];
- float timestep, pixsize=1.0, pa_size, pa_time, r_tilt;
- float cfra=bsystem_time(ob,(float)CFRA,0.0);
- float *vdata=0, *vedata=0, *cdata=0, *ndata=0, *vd=0, *ved=0, *cd=0, *nd=0, xvec[3], yvec[3], zvec[3];
- int a, k, k_max=0, totpart, totpoint=0, draw_as, path_nbr=0;
- int path_possible=0, keys_possible=0, draw_keys=0, totchild=0;
- int select=ob->flag&SELECT;
- GLint polygonmode[2];
- char val[32];
-
-/* 1. */
- if(psys==0)
- return;
-
- part=psys->part;
- pars=psys->particles;
-
- if(part==0 || !psys_check_enabled(ob, psys))
- return;
-
- if(pars==0) return;
-
- if(!G.obedit && psys_in_edit_mode(psys)
- && psys->flag & PSYS_HAIR_DONE && part->draw_as==PART_DRAW_PATH)
- return;
-
- if(part->draw_as==PART_DRAW_NOT) return;
-
-/* 2. */
- if(part->phystype==PART_PHYS_KEYED){
- if(psys->flag & PSYS_FIRST_KEYED){
- if(psys->flag&PSYS_KEYED){
- select=psys_count_keyed_targets(ob,psys);
- if(psys->totkeyed==0)
- return;
- }
- }
- else
- return;
- }
-
- if(select){
- select=0;
- if(psys_get_current(ob)==psys)
- select=1;
- }
-
- psys->flag|=PSYS_DRAWING;
-
- if(!psys->childcache)
- totchild=0;
- else
- totchild=psys->totchild*part->disp/100;
-
- ma= give_current_material(ob,part->omat);
-
- if(select)
- cpack(0xFFFFFF);
- else if(part->draw&PART_DRAW_MAT_COL)
- glColor3f(ma->r,ma->g,ma->b);
- else
- cpack(0);
-
- psmd= psys_get_modifier(ob,psys);
-
- timestep= psys_get_timestep(part);
-
- myloadmatrix(G.vd->viewmat);
-
- if( (base->flag & OB_FROMDUPLI) && (ob->flag & OB_FROMGROUP) ) {
- float mat[4][4];
- Mat4MulMat4(mat, psys->imat, ob->obmat);
- mymultmatrix(mat);
- }
-
- totpart=psys->totpart;
- draw_as=part->draw_as;
-
- if(part->flag&PART_ABS_TIME && part->ipo){
- calc_ipo(part->ipo, cfra);
- execute_ipo((ID *)part, part->ipo);
- }
-
- if(part->flag&PART_GLOB_TIME)
- cfra=bsystem_time(0,(float)CFRA,0.0);
-
- if(psys->pathcache){
- path_possible=1;
- keys_possible=1;
- }
- if(draw_as==PART_DRAW_PATH && path_possible==0)
- draw_as=PART_DRAW_DOT;
-
- if(draw_as!=PART_DRAW_PATH && keys_possible && part->draw&PART_DRAW_KEYS){
- path_nbr=part->keys_step;
- draw_keys=1;
- }
-
-/* 3. */
- switch(draw_as){
- case PART_DRAW_DOT:
- if(part->draw_size)
- glPointSize(part->draw_size);
- else
- glPointSize(2.0); /* default dot size */
- break;
- case PART_DRAW_CIRC:
- /* calculate view aligned matrix: */
- Mat4CpyMat4(imat, G.vd->viewinv);
- Normalize(imat[0]);
- Normalize(imat[1]);
- /* no break! */
- case PART_DRAW_CROSS:
- case PART_DRAW_AXIS:
- /* lets calculate the scale: */
- pixsize= v3d->persmat[0][3]*ob->obmat[3][0]+ v3d->persmat[1][3]*ob->obmat[3][1]+ v3d->persmat[2][3]*ob->obmat[3][2]+ v3d->persmat[3][3];
- pixsize*= v3d->pixsize;
- if(part->draw_size==0.0)
- pixsize*=2.0;
- else
- pixsize*=part->draw_size;
- break;
- case PART_DRAW_OB:
- if(part->dup_ob==0)
- draw_as=PART_DRAW_DOT;
- else
- draw_as=0;
- break;
- case PART_DRAW_GR:
- if(part->dup_group==0)
- draw_as=PART_DRAW_DOT;
- else
- draw_as=0;
- break;
- case PART_DRAW_BB:
- if(G.vd->camera==0 && part->bb_ob==0){
- error("Billboards need an active camera or a target object!");
-
- draw_as=part->draw_as=PART_DRAW_DOT;
-
- if(part->draw_size)
- glPointSize(part->draw_size);
- else
- glPointSize(2.0); /* default dot size */
- }
- else if(part->bb_ob)
- bb_ob=part->bb_ob;
- else
- bb_ob=G.vd->camera;
-
- if(part->bb_align<PART_BB_VIEW)
- onevec[part->bb_align]=1.0f;
- break;
- case PART_DRAW_PATH:
- break;
- }
- if(part->draw & PART_DRAW_SIZE && part->draw_as!=PART_DRAW_CIRC){
- Mat4CpyMat4(imat, G.vd->viewinv);
- Normalize(imat[0]);
- Normalize(imat[1]);
- }
-
-/* 4. */
- if(draw_as && draw_as!=PART_DRAW_PATH){
- if(draw_as!=PART_DRAW_CIRC){
- switch(draw_as){
- case PART_DRAW_AXIS:
- cdata=MEM_callocN((totpart+totchild)*(path_nbr+1)*6*3*sizeof(float), "particle_cdata");
- /* no break! */
- case PART_DRAW_CROSS:
- vdata=MEM_callocN((totpart+totchild)*(path_nbr+1)*6*3*sizeof(float), "particle_vdata");
- break;
- case PART_DRAW_LINE:
- vdata=MEM_callocN((totpart+totchild)*(path_nbr+1)*2*3*sizeof(float), "particle_vdata");
- break;
- case PART_DRAW_BB:
- vdata=MEM_callocN((totpart+totchild)*(path_nbr+1)*4*3*sizeof(float), "particle_vdata");
- ndata=MEM_callocN((totpart+totchild)*(path_nbr+1)*4*3*sizeof(float), "particle_vdata");
- break;
- default:
- vdata=MEM_callocN((totpart+totchild)*(path_nbr+1)*3*sizeof(float), "particle_vdata");
- }
- }
-
- if(part->draw&PART_DRAW_VEL && draw_as!=PART_DRAW_LINE)
- vedata=MEM_callocN((totpart+totchild)*2*3*(path_nbr+1)*sizeof(float), "particle_vedata");
-
- vd=vdata;
- ved=vedata;
- cd=cdata;
- nd=ndata;
-
- psys->lattice=psys_get_lattice(ob,psys);
- }
-
- if(draw_as){
-/* 5. */
- for(a=0,pa=pars; a<totpart+totchild; a++, pa++){
- if(a<totpart){
- if(totchild && (part->draw&PART_DRAW_PARENT)==0) continue;
- if(pa->flag & PARS_NO_DISP || pa->flag & PARS_UNEXIST) continue;
-
- pa_time=(cfra-pa->time)/pa->lifetime;
-
- if((part->flag&PART_ABS_TIME)==0 && part->ipo){
- calc_ipo(part->ipo, 100*pa_time);
- execute_ipo((ID *)part, part->ipo);
- }
-
- pa_size=pa->size;
-
- r_tilt=1.0f+pa->r_ave[0];
-
- if(path_nbr){
- cache=psys->pathcache[a];
- k_max=(int)(cache->steps);
- }
- }
- else{
- ChildParticle *cpa= &psys->child[a-totpart];
-
- pa_time=psys_get_child_time(psys,cpa,cfra);
-
- if((part->flag&PART_ABS_TIME)==0 && part->ipo){
- calc_ipo(part->ipo, 100*pa_time);
- execute_ipo((ID *)part, part->ipo);
- }
-
- pa_size=psys_get_child_size(psys,cpa,cfra,0);
-
- r_tilt=2.0f*cpa->rand[2];
- if(path_nbr){
- cache=psys->childcache[a-totpart];
- k_max=(int)(cache->steps);
- }
- }
-
- if(draw_as!=PART_DRAW_PATH){
- int next_pa=0;
- for(k=0; k<=path_nbr; k++){
- if(draw_keys){
- state.time=(float)k/(float)path_nbr;
- psys_get_particle_on_path(ob,psys,a,&state,1);
- }
- else if(path_nbr){
- if(k<=k_max){
- VECCOPY(state.co,(cache+k)->co);
- VECCOPY(state.vel,(cache+k)->vel);
- QUATCOPY(state.rot,(cache+k)->rot);
- }
- else
- continue;
- }
- else{
- state.time=cfra;
- if(psys_get_particle_state(ob,psys,a,&state,0)==0){
- next_pa=1;
- break;
- }
- }
-
- switch(draw_as){
- case PART_DRAW_DOT:
- if(vd){
- VECCOPY(vd,state.co) vd+=3;
- }
- break;
- case PART_DRAW_CROSS:
- case PART_DRAW_AXIS:
- vec[0]=2.0f*pixsize;
- vec[1]=vec[2]=0.0;
- QuatMulVecf(state.rot,vec);
- if(draw_as==PART_DRAW_AXIS){
- cd[1]=cd[2]=cd[4]=cd[5]=0.0;
- cd[0]=cd[3]=1.0;
- cd[6]=cd[8]=cd[9]=cd[11]=0.0;
- cd[7]=cd[10]=1.0;
- cd[13]=cd[12]=cd[15]=cd[16]=0.0;
- cd[14]=cd[17]=1.0;
- cd+=18;
-
- VECCOPY(vec2,state.co);
- }
- else VECSUB(vec2,state.co,vec);
-
- VECADD(vec,state.co,vec);
- VECCOPY(vd,vec); vd+=3;
- VECCOPY(vd,vec2); vd+=3;
-
- vec[1]=2.0f*pixsize;
- vec[0]=vec[2]=0.0;
- QuatMulVecf(state.rot,vec);
- if(draw_as==PART_DRAW_AXIS){
- VECCOPY(vec2,state.co);
- }
- else VECSUB(vec2,state.co,vec);
-
- VECADD(vec,state.co,vec);
- VECCOPY(vd,vec); vd+=3;
- VECCOPY(vd,vec2); vd+=3;
-
- vec[2]=2.0f*pixsize;
- vec[0]=vec[1]=0.0;
- QuatMulVecf(state.rot,vec);
- if(draw_as==PART_DRAW_AXIS){
- VECCOPY(vec2,state.co);
- }
- else VECSUB(vec2,state.co,vec);
-
- VECADD(vec,state.co,vec);
-
- VECCOPY(vd,vec); vd+=3;
- VECCOPY(vd,vec2); vd+=3;
- break;
- case PART_DRAW_LINE:
- VECCOPY(vec,state.vel);
- Normalize(vec);
- if(part->draw & PART_DRAW_VEL_LENGTH)
- VecMulf(vec,VecLength(state.vel));
- VECADDFAC(vd,state.co,vec,-part->draw_line[0]); vd+=3;
- VECADDFAC(vd,state.co,vec,part->draw_line[1]); vd+=3;
- break;
- case PART_DRAW_CIRC:
- drawcircball(GL_LINE_LOOP, state.co, pixsize, imat);
- break;
- case PART_DRAW_BB:
- if(part->draw&PART_DRAW_BB_LOCK && part->bb_align==PART_BB_VIEW){
- VECCOPY(xvec,bb_ob->obmat[0]);
- Normalize(xvec);
- VECCOPY(yvec,bb_ob->obmat[1]);
- Normalize(yvec);
- VECCOPY(zvec,bb_ob->obmat[2]);
- Normalize(zvec);
- }
- else if(part->bb_align==PART_BB_VEL){
- float temp[3];
- VECCOPY(temp,state.vel);
- Normalize(temp);
- VECSUB(zvec,bb_ob->obmat[3],state.co);
- if(part->draw&PART_DRAW_BB_LOCK){
- float fac=-Inpf(zvec,temp);
- VECADDFAC(zvec,zvec,temp,fac);
- }
- Normalize(zvec);
- Crossf(xvec,temp,zvec);
- Normalize(xvec);
- Crossf(yvec,zvec,xvec);
- }
- else{
- VECSUB(zvec,bb_ob->obmat[3],state.co);
- if(part->draw&PART_DRAW_BB_LOCK)
- zvec[part->bb_align]=0.0f;
- Normalize(zvec);
-
- if(part->bb_align<PART_BB_VIEW)
- Crossf(xvec,onevec,zvec);
- else
- Crossf(xvec,bb_ob->obmat[1],zvec);
- Normalize(xvec);
- Crossf(yvec,zvec,xvec);
- }
-
- VECCOPY(vec,xvec);
- VECCOPY(vec2,yvec);
-
- VecMulf(xvec,cos(part->bb_tilt*(1.0f-part->bb_rand_tilt*r_tilt)*(float)M_PI));
- VecMulf(vec2,sin(part->bb_tilt*(1.0f-part->bb_rand_tilt*r_tilt)*(float)M_PI));
- VECADD(xvec,xvec,vec2);
-
- VecMulf(yvec,cos(part->bb_tilt*(1.0f-part->bb_rand_tilt*r_tilt)*(float)M_PI));
- VecMulf(vec,-sin(part->bb_tilt*(1.0f-part->bb_rand_tilt*r_tilt)*(float)M_PI));
- VECADD(yvec,yvec,vec);
-
- VecMulf(xvec,pa_size);
- VecMulf(yvec,pa_size);
-
- VECADDFAC(bb_center,state.co,xvec,part->bb_offset[0]);
- VECADDFAC(bb_center,bb_center,yvec,part->bb_offset[1]);
-
- VECADD(vd,bb_center,xvec);
- VECADD(vd,vd,yvec); vd+=3;
-
- VECSUB(vd,bb_center,xvec);
- VECADD(vd,vd,yvec); vd+=3;
-
- VECSUB(vd,bb_center,xvec);
- VECSUB(vd,vd,yvec); vd+=3;
-
- VECADD(vd,bb_center,xvec);
- VECSUB(vd,vd,yvec); vd+=3;
-
- VECCOPY(nd, zvec); nd+=3;
- VECCOPY(nd, zvec); nd+=3;
- VECCOPY(nd, zvec); nd+=3;
- VECCOPY(nd, zvec); nd+=3;
- break;
- }
-
- if(vedata){
- VECCOPY(ved,state.co);
- ved+=3;
- VECCOPY(vel,state.vel);
- VecMulf(vel,timestep);
- VECADD(ved,state.co,vel);
- ved+=3;
- }
-
- if(part->draw & PART_DRAW_SIZE){
- setlinestyle(3);
- drawcircball(GL_LINE_LOOP, state.co, pa_size, imat);
- setlinestyle(0);
- }
-
- totpoint++;
- }
- if(next_pa)
- continue;
- if(part->draw&PART_DRAW_NUM){
- /* in path drawing state.co is the end point */
- glRasterPos3f(state.co[0], state.co[1], state.co[2]);
- sprintf(val," %i",a);
- BMF_DrawString(G.font, val);
- }
- }
- }
-/* 6. */
-
- glGetIntegerv(GL_POLYGON_MODE, polygonmode);
- glDisableClientState(GL_NORMAL_ARRAY);
-
- if(draw_as != PART_DRAW_CIRC){
- if(draw_as==PART_DRAW_PATH){
- ParticleCacheKey **cache, *path;
- float *cd2=0,*cdata2=0;
-
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_NORMAL_ARRAY);
- glEnable(GL_LIGHTING);
-
- if(part->draw&PART_DRAW_MAT_COL) {
- glEnableClientState(GL_COLOR_ARRAY);
- glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
- glEnable(GL_COLOR_MATERIAL);
- }
-
- if(totchild && (part->draw&PART_DRAW_PARENT)==0)
- totpart=0;
-
- cache=psys->pathcache;
- for(a=0, pa=psys->particles; a<totpart; a++, pa++){
- path=cache[a];
- glVertexPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), path->co);
- glNormalPointer(GL_FLOAT, sizeof(ParticleCacheKey), path->vel);
- if(part->draw&PART_DRAW_MAT_COL)
- glColorPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), path->col);
- glDrawArrays(GL_LINE_STRIP, 0, path->steps + 1);
- }
-
- cache=psys->childcache;
- for(a=0; a<totchild; a++){
- path=cache[a];
- glVertexPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), path->co);
- glNormalPointer(GL_FLOAT, sizeof(ParticleCacheKey), path->vel);
- if(part->draw&PART_DRAW_MAT_COL)
- glColorPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), path->col);
- glDrawArrays(GL_LINE_STRIP, 0, path->steps + 1);
- }
-
- if(part->draw&PART_DRAW_MAT_COL) {
- glDisable(GL_COLOR_ARRAY);
- glDisable(GL_COLOR_MATERIAL);
- }
-
- if(cdata2)
- MEM_freeN(cdata2);
- cd2=cdata2=0;
-
- glLineWidth(1.0f);
-
- /* draw particle edit mode key points*/
- }
-
- if(draw_as!=PART_DRAW_PATH){
- glDisableClientState(GL_COLOR_ARRAY);
-
- if(vdata){
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(3, GL_FLOAT, 0, vdata);
- }
- else
- glDisableClientState(GL_VERTEX_ARRAY);
-
- if(ndata && MIN2(G.vd->drawtype, ob->dt)>OB_WIRE){
- glEnableClientState(GL_NORMAL_ARRAY);
- glNormalPointer(GL_FLOAT, 0, ndata);
- glEnable(GL_LIGHTING);
- }
- else{
- glDisableClientState(GL_NORMAL_ARRAY);
- glDisable(GL_LIGHTING);
- }
-
- switch(draw_as){
- case PART_DRAW_AXIS:
- case PART_DRAW_CROSS:
- if(cdata){
- glEnableClientState(GL_COLOR_ARRAY);
- glColorPointer(3, GL_FLOAT, 0, cdata);
- }
- glDrawArrays(GL_LINES, 0, 6*totpoint);
- break;
- case PART_DRAW_LINE:
- glDrawArrays(GL_LINES, 0, 2*totpoint);
- break;
- case PART_DRAW_BB:
- if(MIN2(G.vd->drawtype, ob->dt)<=OB_WIRE)
- glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
-
- glDrawArrays(GL_QUADS, 0, 4*totpoint);
- break;
- default:
- glDrawArrays(GL_POINTS, 0, totpoint);
- break;
- }
- }
-
- }
- if(vedata){
- glDisableClientState(GL_COLOR_ARRAY);
- cpack(0xC0C0C0);
-
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(3, GL_FLOAT, 0, vedata);
-
- glDrawArrays(GL_LINES, 0, 2*totpoint);
- }
-
- glPolygonMode(GL_FRONT, polygonmode[0]);
- glPolygonMode(GL_BACK, polygonmode[1]);
- }
-
-/* 7. */
-
- glDisable(GL_LIGHTING);
- glDisableClientState(GL_COLOR_ARRAY);
- glEnableClientState(GL_NORMAL_ARRAY);
- glEnable(GL_DEPTH_TEST);
-
- if(states)
- MEM_freeN(states);
- if(vdata)
- MEM_freeN(vdata);
- if(vedata)
- MEM_freeN(vedata);
- if(cdata)
- MEM_freeN(cdata);
- if(ndata)
- MEM_freeN(ndata);
-
- psys->flag &= ~PSYS_DRAWING;
-
- if(psys->lattice){
- end_latt_deform();
- psys->lattice=0;
- }
-
- myloadmatrix(G.vd->viewmat);
- mymultmatrix(ob->obmat); // bring back local matrix for dtx
-}
-
-static void draw_particle_edit(Object *ob, ParticleSystem *psys)
-{
- ParticleEdit *edit = psys->edit;
- ParticleData *pa;
- ParticleCacheKey **path;
- ParticleEditKey *key;
- ParticleEditSettings *pset = PE_settings();
- int i, k, totpart = psys->totpart, totchild=0, timed = pset->draw_timed;
- char nosel[4], sel[4];
- float sel_col[3];
- float nosel_col[3];
- char val[32];
-
- if(psys->pathcache==0){
- PE_hide_keys_time(psys,CFRA);
- psys_cache_paths(ob,psys,CFRA,0);
- }
-
- if(pset->flag & PE_SHOW_CHILD && psys->part->draw_as == PART_DRAW_PATH) {
- if(psys->childcache==0)
- psys_cache_child_paths(ob, psys, CFRA, 0);
- }
- else if(psys->childcache)
- free_child_path_cache(psys);
-
- if((G.vd->flag & V3D_ZBUF_SELECT)==0)
- glDisable(GL_DEPTH_TEST);
-
- myloadmatrix(G.vd->viewmat);
-
- BIF_GetThemeColor3ubv(TH_VERTEX_SELECT, sel);
- BIF_GetThemeColor3ubv(TH_VERTEX, nosel);
- sel_col[0]=(float)sel[0]/255.0f;
- sel_col[1]=(float)sel[1]/255.0f;
- sel_col[2]=(float)sel[2]/255.0f;
- nosel_col[0]=(float)nosel[0]/255.0f;
- nosel_col[1]=(float)nosel[1]/255.0f;
- nosel_col[2]=(float)nosel[2]/255.0f;
-
- if(psys->childcache)
- totchild = psys->totchildcache;
-
- /* draw paths */
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_NORMAL_ARRAY);
- glEnableClientState(GL_COLOR_ARRAY);
- if(timed)
- glEnable(GL_BLEND);
-
- if(pset->brushtype == PE_BRUSH_WEIGHT){
- glLineWidth(2.0f);
- glEnableClientState(GL_COLOR_ARRAY);
- glDisable(GL_LIGHTING);
- }
-
- glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
- glEnable(GL_COLOR_MATERIAL);
-
- for(i=0, pa=psys->particles, path = psys->pathcache; i<totpart; i++, pa++, path++){
- glVertexPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), (*path)->co);
- glNormalPointer(GL_FLOAT, sizeof(ParticleCacheKey), (*path)->vel);
- glColorPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), (*path)->col);
-
- glDrawArrays(GL_LINE_STRIP, 0, (int)(*path)->steps + 1);
- }
-
- glEnable(GL_LIGHTING);
-
- for(i=0, path=psys->childcache; i<totchild; i++,path++){
- glVertexPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), (*path)->co);
- glNormalPointer(GL_FLOAT, sizeof(ParticleCacheKey), (*path)->vel);
- glColorPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), (*path)->col);
-
- glDrawArrays(GL_LINE_STRIP, 0, (int)(*path)->steps + 1);
- }
-
- glDisable(GL_COLOR_MATERIAL);
-
- /* draw edit vertices */
- if(G.scene->selectmode!=SCE_SELECT_PATH){
- glDisableClientState(GL_NORMAL_ARRAY);
- glEnableClientState(GL_COLOR_ARRAY);
- glDisable(GL_LIGHTING);
- glPointSize(4.0f);
-
- if(G.scene->selectmode==SCE_SELECT_POINT){
- float *cd=0,*cdata=0;
- cd=cdata=MEM_callocN(edit->totkeys*(timed?4:3)*sizeof(float), "particle edit color data");
-
- for(i=0, pa=psys->particles; i<totpart; i++, pa++){
- for(k=0, key=edit->keys[i]; k<pa->totkey; k++, key++){
- if(key->flag&PEK_SELECT){
- VECCOPY(cd,sel_col);
- }
- else{
- VECCOPY(cd,nosel_col);
- }
- if(timed)
- *(cd+3) = (key->flag&PEK_HIDE)?0.0f:1.0f;
- cd += (timed?4:3);
- }
- }
- cd=cdata;
- for(i=0, pa=psys->particles; i<totpart; i++, pa++){
- if((pa->flag & PARS_HIDE)==0){
- glVertexPointer(3, GL_FLOAT, sizeof(ParticleEditKey), edit->keys[i]->world_co);
- glColorPointer((timed?4:3), GL_FLOAT, (timed?4:3)*sizeof(float), cd);
- glDrawArrays(GL_POINTS, 0, pa->totkey);
- }
- cd += (timed?4:3) * pa->totkey;
-
- if(pset->flag&PE_SHOW_TIME && (pa->flag&PARS_HIDE)==0){
- for(k=0, key=edit->keys[i]+k; k<pa->totkey; k++, key++){
- if(key->flag & PEK_HIDE) continue;
-
- glRasterPos3fv(key->world_co);
- sprintf(val," %.1f",*key->time);
- BMF_DrawString(G.font, val);
- }
- }
- }
- if(cdata)
- MEM_freeN(cdata);
- cd=cdata=0;
- }
- else if(G.scene->selectmode == SCE_SELECT_END){
- for(i=0, pa=psys->particles; i<totpart; i++, pa++){
- if((pa->flag & PARS_HIDE)==0){
- key = edit->keys[i] + pa->totkey - 1;
- if(key->flag & PEK_SELECT)
- glColor3fv(sel_col);
- else
- glColor3fv(nosel_col);
- /* has to be like this.. otherwise selection won't work, have try glArrayElement later..*/
- glBegin(GL_POINTS);
- glVertex3fv(key->world_co);
- glEnd();
-
- if(pset->flag & PE_SHOW_TIME){
- glRasterPos3fv(key->world_co);
- sprintf(val," %.1f",*key->time);
- BMF_DrawString(G.font, val);
- }
- }
- }
- }
- }
-
- glDisable(GL_BLEND);
- glDisable(GL_LIGHTING);
- glDisableClientState(GL_COLOR_ARRAY);
- glEnableClientState(GL_NORMAL_ARRAY);
- glEnable(GL_DEPTH_TEST);
- glLineWidth(1.0f);
-
- mymultmatrix(ob->obmat); // bring back local matrix for dtx
-}
-
-unsigned int nurbcol[8]= {
- 0, 0x9090, 0x409030, 0x603080, 0, 0x40fff0, 0x40c033, 0xA090F0 };
-
-static void tekenhandlesN(Nurb *nu, short sel)
-{
- BezTriple *bezt;
- float *fp;
- unsigned int *col;
- int a;
-
- if(nu->hide || (G.f & G_HIDDENHANDLES)) return;
-
- glBegin(GL_LINES);
-
- if( (nu->type & 7)==1) {
- if(sel) col= nurbcol+4;
- else col= nurbcol;
-
- bezt= nu->bezt;
- a= nu->pntsu;
- while(a--) {
- if(bezt->hide==0) {
- if( (bezt->f2 & SELECT)==sel) {
- fp= bezt->vec[0];
-
- cpack(col[bezt->h1]);
- glVertex3fv(fp);
- glVertex3fv(fp+3);
-
- cpack(col[bezt->h2]);
- glVertex3fv(fp+3);
- glVertex3fv(fp+6);
- }
- else if( (bezt->f1 & SELECT)==sel) {
- fp= bezt->vec[0];
-
- cpack(col[bezt->h1]);
- glVertex3fv(fp);
- glVertex3fv(fp+3);
- }
- else if( (bezt->f3 & SELECT)==sel) {
- fp= bezt->vec[1];
-
- cpack(col[bezt->h2]);
- glVertex3fv(fp);
- glVertex3fv(fp+3);
- }
- }
- bezt++;
- }
- }
- glEnd();
-}
-
-static void tekenvertsN(Nurb *nu, short sel)
-{
- BezTriple *bezt;
- BPoint *bp;
- float size;
- int a;
-
- if(nu->hide) return;
-
- if(sel) BIF_ThemeColor(TH_VERTEX_SELECT);
- else BIF_ThemeColor(TH_VERTEX);
-
- size= BIF_GetThemeValuef(TH_VERTEX_SIZE);
- glPointSize(size);
-
- bglBegin(GL_POINTS);
-
- if((nu->type & 7)==1) {
-
- bezt= nu->bezt;
- a= nu->pntsu;
- while(a--) {
- if(bezt->hide==0) {
- if (G.f & G_HIDDENHANDLES) {
- if((bezt->f2 & SELECT)==sel) bglVertex3fv(bezt->vec[1]);
- } else {
- if((bezt->f1 & SELECT)==sel) bglVertex3fv(bezt->vec[0]);
- if((bezt->f2 & SELECT)==sel) bglVertex3fv(bezt->vec[1]);
- if((bezt->f3 & SELECT)==sel) bglVertex3fv(bezt->vec[2]);
- }
- }
- bezt++;
- }
- }
- else {
- bp= nu->bp;
- a= nu->pntsu*nu->pntsv;
- while(a--) {
- if(bp->hide==0) {
- if((bp->f1 & SELECT)==sel) bglVertex3fv(bp->vec);
- }
- bp++;
- }
- }
-
- bglEnd();
- glPointSize(1.0);
-}
-
-static void draw_editnurb(Object *ob, Nurb *nurb, int sel)
-{
- Nurb *nu;
- BPoint *bp, *bp1;
- int a, b, ofs;
-
- nu= nurb;
- while(nu) {
- if(nu->hide==0) {
- switch(nu->type & 7) {
- case CU_POLY:
- cpack(nurbcol[3]);
- bp= nu->bp;
- for(b=0; b<nu->pntsv; b++) {
- if(nu->flagu & 1) glBegin(GL_LINE_LOOP);
- else glBegin(GL_LINE_STRIP);
-
- for(a=0; a<nu->pntsu; a++, bp++) {
- glVertex3fv(bp->vec);
- }
-
- glEnd();
- }
- break;
- case CU_NURBS:
-
- bp= nu->bp;
- for(b=0; b<nu->pntsv; b++) {
- bp1= bp;
- bp++;
- for(a=nu->pntsu-1; a>0; a--, bp++) {
- if(bp->hide==0 && bp1->hide==0) {
- if(sel) {
- if( (bp->f1 & SELECT) && ( bp1->f1 & SELECT ) ) {
- cpack(nurbcol[5]);
-
- glBegin(GL_LINE_STRIP);
- glVertex3fv(bp->vec);
- glVertex3fv(bp1->vec);
- glEnd();
- }
- }
- else {
- if( (bp->f1 & SELECT) && ( bp1->f1 & SELECT) );
- else {
- cpack(nurbcol[1]);
-
- glBegin(GL_LINE_STRIP);
- glVertex3fv(bp->vec);
- glVertex3fv(bp1->vec);
- glEnd();
- }
- }
- }
- bp1= bp;
- }
- }
- if(nu->pntsv > 1) { /* surface */
-
- ofs= nu->pntsu;
- for(b=0; b<nu->pntsu; b++) {
- bp1= nu->bp+b;
- bp= bp1+ofs;
- for(a=nu->pntsv-1; a>0; a--, bp+=ofs) {
- if(bp->hide==0 && bp1->hide==0) {
- if(sel) {
- if( (bp->f1 & SELECT) && ( bp1->f1 & SELECT) ) {
- cpack(nurbcol[7]);
-
- glBegin(GL_LINE_STRIP);
- glVertex3fv(bp->vec);
- glVertex3fv(bp1->vec);
- glEnd();
- }
- }
- else {
- if( (bp->f1 & SELECT) && ( bp1->f1 & SELECT) );
- else {
- cpack(nurbcol[3]);
-
- glBegin(GL_LINE_STRIP);
- glVertex3fv(bp->vec);
- glVertex3fv(bp1->vec);
- glEnd();
- }
- }
- }
- bp1= bp;
- }
- }
-
- }
- break;
- }
- }
- nu= nu->next;
- }
-}
-
-static void drawnurb(Base *base, Nurb *nurb, int dt)
-{
- Object *ob= base->object;
- Curve *cu = ob->data;
- Nurb *nu;
- BevList *bl;
-
- retopo_matrix_update(G.vd);
-
- /* DispList */
- BIF_ThemeColor(TH_WIRE);
- drawDispList(base, dt);
-
- if(G.vd->zbuf) glDisable(GL_DEPTH_TEST);
-
- /* first non-selected handles */
- for(nu=nurb; nu; nu=nu->next) {
- if((nu->type & 7)==CU_BEZIER) {
- tekenhandlesN(nu, 0);
- }
- }
- draw_editnurb(ob, nurb, 0);
- draw_editnurb(ob, nurb, 1);
- /* selected handles */
- for(nu=nurb; nu; nu=nu->next) {
- if((nu->type & 7)==1) tekenhandlesN(nu, 1);
- tekenvertsN(nu, 0);
- }
-
- if(G.vd->zbuf) glEnable(GL_DEPTH_TEST);
-
- /* direction vectors for 3d curve paths
- when at its lowest, dont render normals */
- if(cu->flag & CU_3D && G.scene->editbutsize > 0.0015) {
- BIF_ThemeColor(TH_WIRE);
- for (bl=cu->bev.first,nu=nurb; nu && bl; bl=bl->next,nu=nu->next) {
- BevPoint *bevp= (BevPoint *)(bl+1);
- int nr= bl->nr;
- int skip= nu->resolu/16;
- float fac;
-
- while (nr-->0) { /* accounts for empty bevel lists */
- float ox,oy,oz; // Offset perpendicular to the curve
- float dx,dy,dz; // Delta along the curve
-
- fac = calc_curve_subdiv_radius(cu, nu, (bl->nr - nr)) * G.scene->editbutsize;
-
- ox = fac*bevp->mat[0][0];
- oy = fac*bevp->mat[0][1];
- oz = fac*bevp->mat[0][2];
-
- dx = fac*bevp->mat[2][0];
- dy = fac*bevp->mat[2][1];
- dz = fac*bevp->mat[2][2];
-
- glBegin(GL_LINE_STRIP);
- glVertex3f(bevp->x - ox - dx, bevp->y - oy - dy, bevp->z - oz - dz);
- glVertex3f(bevp->x, bevp->y, bevp->z);
- glVertex3f(bevp->x + ox - dx, bevp->y + oy - dy, bevp->z + oz - dz);
- glEnd();
-
- bevp += skip+1;
- nr -= skip;
- }
- }
- }
-
- if(G.vd->zbuf) glDisable(GL_DEPTH_TEST);
-
- for(nu=nurb; nu; nu=nu->next) {
- tekenvertsN(nu, 1);
- }
-
- if(G.vd->zbuf) glEnable(GL_DEPTH_TEST);
-}
-
-/* draw a sphere for use as an empty drawtype */
-static void draw_empty_sphere (float size)
-{
- float cent=0;
- GLUquadricObj *qobj = gluNewQuadric();
- gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
-
- glPushMatrix();
- glTranslatef(cent, cent, cent);
- glScalef(size, size, size);
- gluSphere(qobj, 1.0, 8, 5);
-
- glPopMatrix();
-
- gluDeleteQuadric(qobj);
-}
-
-/* draw a cone for use as an empty drawtype */
-static void draw_empty_cone (float size)
-{
- float cent=0;
- float radius;
- GLUquadricObj *qobj = gluNewQuadric();
- gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
-
-
- glPushMatrix();
-
- radius = size;
- glTranslatef(cent,cent, cent);
- glScalef(radius, 2.0*size, radius);
- glRotatef(-90., 1.0, 0.0, 0.0);
- gluCylinder(qobj, 1.0, 0.0, 1.0, 8, 1);
-
- glPopMatrix();
-
- gluDeleteQuadric(qobj);
-}
-
-/* draw points on curve speed handles */
-static void curve_draw_speed(Object *ob)
-{
- Curve *cu= ob->data;
- IpoCurve *icu;
- BezTriple *bezt;
- float loc[4], dir[3];
- int a;
-
- if(cu->ipo==NULL)
- return;
-
- icu= cu->ipo->curve.first;
- if(icu==NULL || icu->totvert<2)
- return;
-
- glPointSize( BIF_GetThemeValuef(TH_VERTEX_SIZE) );
- bglBegin(GL_POINTS);
-
- for(a=0, bezt= icu->bezt; a<icu->totvert; a++, bezt++) {
- if( where_on_path(ob, bezt->vec[1][1], loc, dir)) {
- BIF_ThemeColor((bezt->f2 & SELECT) && ob==OBACT?TH_VERTEX_SELECT:TH_VERTEX);
- bglVertex3fv(loc);
- }
- }
-
- glPointSize(1.0);
- bglEnd();
-}
-
-
-static void tekentextcurs(void)
-{
- cpack(0);
-
- set_inverted_drawing(1);
- glBegin(GL_QUADS);
- glVertex2fv(G.textcurs[0]);
- glVertex2fv(G.textcurs[1]);
- glVertex2fv(G.textcurs[2]);
- glVertex2fv(G.textcurs[3]);
- glEnd();
- set_inverted_drawing(0);
-}
-
-static void drawspiral(float *cent, float rad, float tmat[][4], int start)
-{
- float vec[3], vx[3], vy[3];
- int a, tot=32;
- char inverse=0;
-
- if (start < 0) {
- inverse = 1;
- start *= -1;
- }
-
- VECCOPY(vx, tmat[0]);
- VECCOPY(vy, tmat[1]);
- VecMulf(vx, rad);
- VecMulf(vy, rad);
-
- VECCOPY(vec, cent);
-
- if (inverse==0) {
- for(a=0; a<tot; a++) {
- if (a+start>31)
- start=-a + 1;
- glBegin(GL_LINES);
- glVertex3fv(vec);
- vec[0]= cent[0] + *(sinval+a+start) * (vx[0] * (float)a/(float)tot) + *(cosval+a+start) * (vy[0] * (float)a/(float)tot);
- vec[1]= cent[1] + *(sinval+a+start) * (vx[1] * (float)a/(float)tot) + *(cosval+a+start) * (vy[1] * (float)a/(float)tot);
- vec[2]= cent[2] + *(sinval+a+start) * (vx[2] * (float)a/(float)tot) + *(cosval+a+start) * (vy[2] * (float)a/(float)tot);
- glVertex3fv(vec);
- glEnd();
- }
- }
- else {
- a=0;
- vec[0]= cent[0] + *(sinval+a+start) * (vx[0] * (float)(-a+31)/(float)tot) + *(cosval+a+start) * (vy[0] * (float)(-a+31)/(float)tot);
- vec[1]= cent[1] + *(sinval+a+start) * (vx[1] * (float)(-a+31)/(float)tot) + *(cosval+a+start) * (vy[1] * (float)(-a+31)/(float)tot);
- vec[2]= cent[2] + *(sinval+a+start) * (vx[2] * (float)(-a+31)/(float)tot) + *(cosval+a+start) * (vy[2] * (float)(-a+31)/(float)tot);
- for(a=0; a<tot; a++) {
- if (a+start>31)
- start=-a + 1;
- glBegin(GL_LINES);
- glVertex3fv(vec);
- vec[0]= cent[0] + *(sinval+a+start) * (vx[0] * (float)(-a+31)/(float)tot) + *(cosval+a+start) * (vy[0] * (float)(-a+31)/(float)tot);
- vec[1]= cent[1] + *(sinval+a+start) * (vx[1] * (float)(-a+31)/(float)tot) + *(cosval+a+start) * (vy[1] * (float)(-a+31)/(float)tot);
- vec[2]= cent[2] + *(sinval+a+start) * (vx[2] * (float)(-a+31)/(float)tot) + *(cosval+a+start) * (vy[2] * (float)(-a+31)/(float)tot);
- glVertex3fv(vec);
- glEnd();
- }
- }
-}
-
-/* draws a circle on x-z plane given the scaling of the circle, assuming that
- * all required matrices have been set (used for drawing empties)
- */
-static void drawcircle_size(float size)
-{
- float x, y;
- short degrees;
-
- glBegin(GL_LINE_LOOP);
-
- /* coordinates are: cos(degrees*11.25)=x, sin(degrees*11.25)=y, 0.0f=z */
- for (degrees=0; degrees<32; degrees++) {
- x= *(cosval + degrees);
- y= *(sinval + degrees);
-
- glVertex3f(x*size, 0.0f, y*size);
- }
-
- glEnd();
-
-}
-
-void drawcircball(int mode, float *cent, float rad, float tmat[][4])
-{
- float vec[3], vx[3], vy[3];
- int a, tot=32;
-
- VECCOPY(vx, tmat[0]);
- VECCOPY(vy, tmat[1]);
- VecMulf(vx, rad);
- VecMulf(vy, rad);
-
- glBegin(mode);
- for(a=0; a<tot; a++) {
- vec[0]= cent[0] + *(sinval+a) * vx[0] + *(cosval+a) * vy[0];
- vec[1]= cent[1] + *(sinval+a) * vx[1] + *(cosval+a) * vy[1];
- vec[2]= cent[2] + *(sinval+a) * vx[2] + *(cosval+a) * vy[2];
- glVertex3fv(vec);
- }
- glEnd();
-}
-/* needs fixing if non-identity matrice used */
-static void drawtube(float *vec, float radius, float height, float tmat[][4])
-{
- float cur[3];
- drawcircball(GL_LINE_LOOP, vec, radius, tmat);
-
- VecCopyf(cur,vec);
- cur[2]+=height;
-
- drawcircball(GL_LINE_LOOP, cur, radius, tmat);
-
- glBegin(GL_LINES);
- glVertex3f(vec[0]+radius,vec[1],vec[2]);
- glVertex3f(cur[0]+radius,cur[1],cur[2]);
- glVertex3f(vec[0]-radius,vec[1],vec[2]);
- glVertex3f(cur[0]-radius,cur[1],cur[2]);
- glVertex3f(vec[0],vec[1]+radius,vec[2]);
- glVertex3f(cur[0],cur[1]+radius,cur[2]);
- glVertex3f(vec[0],vec[1]-radius,vec[2]);
- glVertex3f(cur[0],cur[1]-radius,cur[2]);
- glEnd();
-}
-/* needs fixing if non-identity matrice used */
-static void drawcone(float *vec, float radius, float height, float tmat[][4])
-{
- float cur[3];
-
- VecCopyf(cur,vec);
- cur[2]+=height;
-
- drawcircball(GL_LINE_LOOP, cur, radius, tmat);
-
- glBegin(GL_LINES);
- glVertex3f(vec[0],vec[1],vec[2]);
- glVertex3f(cur[0]+radius,cur[1],cur[2]);
- glVertex3f(vec[0],vec[1],vec[2]);
- glVertex3f(cur[0]-radius,cur[1],cur[2]);
- glVertex3f(vec[0],vec[1],vec[2]);
- glVertex3f(cur[0],cur[1]+radius,cur[2]);
- glVertex3f(vec[0],vec[1],vec[2]);
- glVertex3f(cur[0],cur[1]-radius,cur[2]);
- glEnd();
-}
-/* return 1 if nothing was drawn */
-static int drawmball(Base *base, int dt)
-{
- Object *ob= base->object;
- MetaBall *mb;
- MetaElem *ml;
- float imat[4][4], tmat[4][4];
- int code= 1;
-
- mb= ob->data;
-
- if(ob==G.obedit) {
- BIF_ThemeColor(TH_WIRE);
- if((G.f & G_PICKSEL)==0 ) drawDispList(base, dt);
- ml= editelems.first;
- }
- else {
- if((base->flag & OB_FROMDUPLI)==0)
- drawDispList(base, dt);
- ml= mb->elems.first;
- }
-
- if(ml==NULL) return 1;
-
- /* in case solid draw, reset wire colors */
- if(ob!=G.obedit && (ob->flag & SELECT)) {
- if(ob==OBACT) BIF_ThemeColor(TH_ACTIVE);
- else BIF_ThemeColor(TH_SELECT);
- }
- else BIF_ThemeColor(TH_WIRE);
-
- mygetmatrix(tmat);
- Mat4Invert(imat, tmat);
- Normalize(imat[0]);
- Normalize(imat[1]);
-
- while(ml) {
-
- /* draw radius */
- if(ob==G.obedit) {
- if((ml->flag & SELECT) && (ml->flag & MB_SCALE_RAD)) cpack(0xA0A0F0);
- else cpack(0x3030A0);
-
- if(G.f & G_PICKSEL) {
- ml->selcol1= code;
- glLoadName(code++);
- }
- }
- drawcircball(GL_LINE_LOOP, &(ml->x), ml->rad, imat);
-
- /* draw stiffness */
- if(ob==G.obedit) {
- if((ml->flag & SELECT) && !(ml->flag & MB_SCALE_RAD)) cpack(0xA0F0A0);
- else cpack(0x30A030);
-
- if(G.f & G_PICKSEL) {
- ml->selcol2= code;
- glLoadName(code++);
- }
- drawcircball(GL_LINE_LOOP, &(ml->x), ml->rad*atan(ml->s)/M_PI_2, imat);
- }
-
- ml= ml->next;
- }
- return 0;
-}
-
-static void draw_forcefield(Object *ob)
-{
- PartDeflect *pd= ob->pd;
- float imat[4][4], tmat[4][4];
- float vec[3]= {0.0, 0.0, 0.0};
- int curcol;
- float size;
-
- if(ob!=G.obedit && (ob->flag & SELECT)) {
- if(ob==OBACT) curcol= TH_ACTIVE;
- else curcol= TH_SELECT;
- }
- else curcol= TH_WIRE;
-
- /* scale size of circle etc with the empty drawsize */
- if (ob->type == OB_EMPTY) size = ob->empty_drawsize;
- else size = 1.0;
-
- /* calculus here, is reused in PFIELD_FORCE */
- mygetmatrix(tmat);
- Mat4Invert(imat, tmat);
-// Normalize(imat[0]); // we don't do this because field doesnt scale either... apart from wind!
-// Normalize(imat[1]);
-
- if (pd->forcefield == PFIELD_WIND) {
- float force_val;
-
- Mat4One(tmat);
- BIF_ThemeColorBlend(curcol, TH_BACK, 0.5);
-
- if (has_ipo_code(ob->ipo, OB_PD_FSTR))
- force_val = IPO_GetFloatValue(ob->ipo, OB_PD_FSTR, G.scene->r.cfra);
- else
- force_val = pd->f_strength;
- force_val*= 0.1;
- drawcircball(GL_LINE_LOOP, vec, size, tmat);
- vec[2]= 0.5*force_val;
- drawcircball(GL_LINE_LOOP, vec, size, tmat);
- vec[2]= 1.0*force_val;
- drawcircball(GL_LINE_LOOP, vec, size, tmat);
- vec[2]= 1.5*force_val;
- drawcircball(GL_LINE_LOOP, vec, size, tmat);
-
- }
- else if (pd->forcefield == PFIELD_FORCE) {
- float ffall_val;
-
- if (has_ipo_code(ob->ipo, OB_PD_FFALL))
- ffall_val = IPO_GetFloatValue(ob->ipo, OB_PD_FFALL, G.scene->r.cfra);
- else
- ffall_val = pd->f_power;
-
- BIF_ThemeColorBlend(curcol, TH_BACK, 0.5);
- drawcircball(GL_LINE_LOOP, vec, size, imat);
- BIF_ThemeColorBlend(curcol, TH_BACK, 0.9 - 0.4 / pow(1.5, (double)ffall_val));
- drawcircball(GL_LINE_LOOP, vec, size*1.5, imat);
- BIF_ThemeColorBlend(curcol, TH_BACK, 0.9 - 0.4 / pow(2.0, (double)ffall_val));
- drawcircball(GL_LINE_LOOP, vec, size*2.0, imat);
- }
- else if (pd->forcefield == PFIELD_VORTEX) {
- float ffall_val, force_val;
-
- Mat4One(tmat);
- if (has_ipo_code(ob->ipo, OB_PD_FFALL))
- ffall_val = IPO_GetFloatValue(ob->ipo, OB_PD_FFALL, G.scene->r.cfra);
- else
- ffall_val = pd->f_power;
-
- if (has_ipo_code(ob->ipo, OB_PD_FSTR))
- force_val = IPO_GetFloatValue(ob->ipo, OB_PD_FSTR, G.scene->r.cfra);
- else
- force_val = pd->f_strength;
-
- BIF_ThemeColorBlend(curcol, TH_BACK, 0.7);
- if (force_val < 0) {
- drawspiral(vec, size*1.0, tmat, 1);
- drawspiral(vec, size*1.0, tmat, 16);
- }
- else {
- drawspiral(vec, size*1.0, tmat, -1);
- drawspiral(vec, size*1.0, tmat, -16);
- }
- }
- else if (pd->forcefield == PFIELD_GUIDE && ob->type==OB_CURVE) {
- Curve *cu= ob->data;
- if((cu->flag & CU_PATH) && cu->path && cu->path->data) {
- float mindist, guidevec1[4], guidevec2[3];
-
- if (has_ipo_code(ob->ipo, OB_PD_FSTR))
- mindist = IPO_GetFloatValue(ob->ipo, OB_PD_FSTR, G.scene->r.cfra);
- else
- mindist = pd->f_strength;
-
- /*path end*/
- setlinestyle(3);
- where_on_path(ob, 1.0f, guidevec1, guidevec2);
- BIF_ThemeColorBlend(curcol, TH_BACK, 0.5);
- drawcircball(GL_LINE_LOOP, guidevec1, mindist, imat);
-
- /*path beginning*/
- setlinestyle(0);
- where_on_path(ob, 0.0f, guidevec1, guidevec2);
- BIF_ThemeColorBlend(curcol, TH_BACK, 0.5);
- drawcircball(GL_LINE_LOOP, guidevec1, mindist, imat);
-
- VECCOPY(vec, guidevec1); /* max center */
- }
- }
-
- setlinestyle(3);
- BIF_ThemeColorBlend(curcol, TH_BACK, 0.5);
-
- if(pd->falloff==PFIELD_FALL_SPHERE){
- /* as last, guide curve alters it */
- if(pd->flag & PFIELD_USEMAX)
- drawcircball(GL_LINE_LOOP, vec, pd->maxdist, imat);
-
- if(pd->flag & PFIELD_USEMIN)
- drawcircball(GL_LINE_LOOP, vec, pd->mindist, imat);
- }
- else if(pd->falloff==PFIELD_FALL_TUBE){
- float radius,distance;
-
- Mat4One(tmat);
-
- vec[0]=vec[1]=0.0f;
- radius=(pd->flag&PFIELD_USEMAXR)?pd->maxrad:1.0f;
- distance=(pd->flag&PFIELD_USEMAX)?pd->maxdist:0.0f;
- vec[2]=distance;
- distance=(pd->flag&PFIELD_POSZ)?-distance:-2.0f*distance;
-
- if(pd->flag & (PFIELD_USEMAX|PFIELD_USEMAXR))
- drawtube(vec,radius,distance,tmat);
-
- radius=(pd->flag&PFIELD_USEMINR)?pd->minrad:1.0f;
- distance=(pd->flag&PFIELD_USEMIN)?pd->mindist:0.0f;
- vec[2]=distance;
- distance=(pd->flag&PFIELD_POSZ)?-distance:-2.0f*distance;
-
- if(pd->flag & (PFIELD_USEMIN|PFIELD_USEMINR))
- drawtube(vec,radius,distance,tmat);
- }
- else if(pd->falloff==PFIELD_FALL_CONE){
- float radius,distance;
-
- Mat4One(tmat);
-
- radius=(pd->flag&PFIELD_USEMAXR)?pd->maxrad:1.0f;
- radius*=(float)M_PI/180.0f;
- distance=(pd->flag&PFIELD_USEMAX)?pd->maxdist:0.0f;
-
- if(pd->flag & (PFIELD_USEMAX|PFIELD_USEMAXR)){
- drawcone(vec,distance*sin(radius),distance*cos(radius),tmat);
- if((pd->flag & PFIELD_POSZ)==0)
- drawcone(vec,distance*sin(radius),-distance*cos(radius),tmat);
- }
-
- radius=(pd->flag&PFIELD_USEMINR)?pd->minrad:1.0f;
- radius*=(float)M_PI/180.0f;
- distance=(pd->flag&PFIELD_USEMIN)?pd->mindist:0.0f;
-
- if(pd->flag & (PFIELD_USEMIN|PFIELD_USEMINR)){
- drawcone(vec,distance*sin(radius),distance*cos(radius),tmat);
- if((pd->flag & PFIELD_POSZ)==0)
- drawcone(vec,distance*sin(radius),-distance*cos(radius),tmat);
- }
- }
- setlinestyle(0);
-}
-
-static void draw_box(float vec[8][3])
-{
- glBegin(GL_LINE_STRIP);
- glVertex3fv(vec[0]); glVertex3fv(vec[1]);glVertex3fv(vec[2]); glVertex3fv(vec[3]);
- glVertex3fv(vec[0]); glVertex3fv(vec[4]);glVertex3fv(vec[5]); glVertex3fv(vec[6]);
- glVertex3fv(vec[7]); glVertex3fv(vec[4]);
- glEnd();
-
- glBegin(GL_LINES);
- glVertex3fv(vec[1]); glVertex3fv(vec[5]);
- glVertex3fv(vec[2]); glVertex3fv(vec[6]);
- glVertex3fv(vec[3]); glVertex3fv(vec[7]);
- glEnd();
-}
-
-/* uses boundbox, function used by Ketsji */
-void get_local_bounds(Object *ob, float *center, float *size)
-{
- BoundBox *bb= object_get_boundbox(ob);
-
- if(bb==NULL) {
- center[0]= center[1]= center[2]= 0.0;
- VECCOPY(size, ob->size);
- }
- else {
- size[0]= 0.5*fabs(bb->vec[0][0] - bb->vec[4][0]);
- size[1]= 0.5*fabs(bb->vec[0][1] - bb->vec[2][1]);
- size[2]= 0.5*fabs(bb->vec[0][2] - bb->vec[1][2]);
-
- center[0]= (bb->vec[0][0] + bb->vec[4][0])/2.0;
- center[1]= (bb->vec[0][1] + bb->vec[2][1])/2.0;
- center[2]= (bb->vec[0][2] + bb->vec[1][2])/2.0;
- }
-}
-
-
-
-static void draw_bb_quadric(BoundBox *bb, short type)
-{
- float size[3], cent[3];
- GLUquadricObj *qobj = gluNewQuadric();
-
- gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
-
- size[0]= 0.5*fabs(bb->vec[0][0] - bb->vec[4][0]);
- size[1]= 0.5*fabs(bb->vec[0][1] - bb->vec[2][1]);
- size[2]= 0.5*fabs(bb->vec[0][2] - bb->vec[1][2]);
-
- cent[0]= (bb->vec[0][0] + bb->vec[4][0])/2.0;
- cent[1]= (bb->vec[0][1] + bb->vec[2][1])/2.0;
- cent[2]= (bb->vec[0][2] + bb->vec[1][2])/2.0;
-
- glPushMatrix();
- if(type==OB_BOUND_SPHERE) {
- glTranslatef(cent[0], cent[1], cent[2]);
- glScalef(size[0], size[1], size[2]);
- gluSphere(qobj, 1.0, 8, 5);
- }
- else if(type==OB_BOUND_CYLINDER) {
- float radius = size[0] > size[1] ? size[0] : size[1];
- glTranslatef(cent[0], cent[1], cent[2]-size[2]);
- glScalef(radius, radius, 2.0*size[2]);
- gluCylinder(qobj, 1.0, 1.0, 1.0, 8, 1);
- }
- else if(type==OB_BOUND_CONE) {
- float radius = size[0] > size[1] ? size[0] : size[1];
- glTranslatef(cent[0], cent[2]-size[2], cent[1]);
- glScalef(radius, 2.0*size[2], radius);
- glRotatef(-90., 1.0, 0.0, 0.0);
- gluCylinder(qobj, 1.0, 0.0, 1.0, 8, 1);
- }
- glPopMatrix();
-
- gluDeleteQuadric(qobj);
-}
-
-static void draw_bounding_volume(Object *ob)
-{
- BoundBox *bb=0;
-
- if(ob->type==OB_MESH) {
- bb= mesh_get_bb(ob);
- }
- else if ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT) {
- bb= ( (Curve *)ob->data )->bb;
- }
- else if(ob->type==OB_MBALL) {
- bb= ob->bb;
- if(bb==0) {
- makeDispListMBall(ob);
- bb= ob->bb;
- }
- }
- else {
- drawcube();
- return;
- }
-
- if(bb==0) return;
-
- if(ob->boundtype==OB_BOUND_BOX) draw_box(bb->vec);
- else draw_bb_quadric(bb, ob->boundtype);
-
-}
-
-static void drawtexspace(Object *ob)
-{
- float vec[8][3], loc[3], size[3];
-
- if(ob->type==OB_MESH) {
- mesh_get_texspace(ob->data, loc, NULL, size);
- }
- else if ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT) {
- Curve *cu= ob->data;
- VECCOPY(size, cu->size);
- VECCOPY(loc, cu->loc);
- }
- else if(ob->type==OB_MBALL) {
- MetaBall *mb= ob->data;
- VECCOPY(size, mb->size);
- VECCOPY(loc, mb->loc);
- }
- else return;
-
- vec[0][0]=vec[1][0]=vec[2][0]=vec[3][0]= loc[0]-size[0];
- vec[4][0]=vec[5][0]=vec[6][0]=vec[7][0]= loc[0]+size[0];
-
- vec[0][1]=vec[1][1]=vec[4][1]=vec[5][1]= loc[1]-size[1];
- vec[2][1]=vec[3][1]=vec[6][1]=vec[7][1]= loc[1]+size[1];
-
- vec[0][2]=vec[3][2]=vec[4][2]=vec[7][2]= loc[2]-size[2];
- vec[1][2]=vec[2][2]=vec[5][2]=vec[6][2]= loc[2]+size[2];
-
- setlinestyle(2);
-
- draw_box(vec);
-
- setlinestyle(0);
-}
-
-/* draws wire outline */
-static void drawSolidSelect(Base *base)
-{
- Object *ob= base->object;
-
- glLineWidth(2.0);
- glDepthMask(0);
-
- if(ELEM3(ob->type, OB_FONT,OB_CURVE, OB_SURF)) {
- Curve *cu = ob->data;
- if (displist_has_faces(&cu->disp) && boundbox_clip(ob->obmat, cu->bb)) {
- draw_index_wire= 0;
- drawDispListwire(&cu->disp);
- draw_index_wire= 1;
- }
- } else if (ob->type==OB_MBALL) {
- if((base->flag & OB_FROMDUPLI)==0)
- drawDispListwire(&ob->disp);
- }
- else if(ob->type==OB_ARMATURE) {
- if(!(ob->flag & OB_POSEMODE)) {
- draw_armature(base, OB_WIRE);
- }
- }
-
- glLineWidth(1.0);
- glDepthMask(1);
-}
-
-static void drawWireExtra(Object *ob)
-{
- if(ob!=G.obedit && (ob->flag & SELECT)) {
- if(ob==OBACT) {
- if(ob->flag & OB_FROMGROUP) BIF_ThemeColor(TH_GROUP_ACTIVE);
- else BIF_ThemeColor(TH_ACTIVE);
- }
- else if(ob->flag & OB_FROMGROUP)
- BIF_ThemeColorShade(TH_GROUP_ACTIVE, -16);
- else
- BIF_ThemeColor(TH_SELECT);
- }
- else {
- if(ob->flag & OB_FROMGROUP)
- BIF_ThemeColor(TH_GROUP);
- else {
- if(ob->dtx & OB_DRAWWIRE) {
- glColor3ub(80,80,80);
- } else {
- BIF_ThemeColor(TH_WIRE);
- }
- }
- }
-
- bglPolygonOffset(1.0);
- glDepthMask(0); // disable write in zbuffer, selected edge wires show better
-
- if (ELEM3(ob->type, OB_FONT, OB_CURVE, OB_SURF)) {
- Curve *cu = ob->data;
- if (boundbox_clip(ob->obmat, cu->bb)) {
- if (ob->type==OB_CURVE)
- draw_index_wire= 0;
- drawDispListwire(&cu->disp);
- if (ob->type==OB_CURVE)
- draw_index_wire= 1;
- }
- } else if (ob->type==OB_MBALL) {
- drawDispListwire(&ob->disp);
- }
-
- glDepthMask(1);
- bglPolygonOffset(0.0);
-}
-
-/* should be called in view space */
-static void draw_hooks(Object *ob)
-{
- ModifierData *md;
- float vec[3];
-
- for (md=ob->modifiers.first; md; md=md->next) {
- if (md->type==eModifierType_Hook) {
- HookModifierData *hmd = (HookModifierData*) md;
-
- VecMat4MulVecfl(vec, ob->obmat, hmd->cent);
-
- if(hmd->object) {
- setlinestyle(3);
- glBegin(GL_LINES);
- glVertex3fv(hmd->object->obmat[3]);
- glVertex3fv(vec);
- glEnd();
- setlinestyle(0);
- }
-
- glPointSize(3.0);
- bglBegin(GL_POINTS);
- bglVertex3fv(vec);
- bglEnd();
- glPointSize(1.0);
- }
- }
-}
-
-
-//<rcruiz>
-void drawRBpivot(bRigidBodyJointConstraint *data){
- float radsPerDeg = 6.283185307179586232f / 360.f;
- int axis;
- float v1[3]= {data->pivX, data->pivY, data->pivZ};
- float eu[3]= {radsPerDeg*data->axX, radsPerDeg*data->axY, radsPerDeg*data->axZ};
-
-
-
- float mat[4][4];
- EulToMat4(eu,mat);
- glLineWidth (4.0f);
- setlinestyle(2);
- for (axis=0; axis<3; axis++) {
- float dir[3] = {0,0,0};
- float v[3]= {data->pivX, data->pivY, data->pivZ};
-
- dir[axis] = 1.f;
- glBegin(GL_LINES);
- Mat4MulVecfl(mat,dir);
- v[0] += dir[0];
- v[1] += dir[1];
- v[2] += dir[2];
- glVertex3fv(v1);
- glVertex3fv(v);
- glEnd();
- glRasterPos3fv(v);
- if (axis==0)
- BMF_DrawString(G.font, "px");
- else if (axis==1)
- BMF_DrawString(G.font, "py");
- else
- BMF_DrawString(G.font, "pz");
- }
- glLineWidth (1.0f);
- setlinestyle(0);
-}
-
-/* flag can be DRAW_PICKING and/or DRAW_CONSTCOLOR */
-void draw_object(Base *base, int flag)
-{
- static int warning_recursive= 0;
- Object *ob;
- Curve *cu;
- float cfraont;
- float vec1[3], vec2[3];
- unsigned int col=0;
- int sel, drawtype, colindex= 0, ipoflag;
- int i, selstart, selend, empty_object=0;
- short dt, dtx, zbufoff= 0;
-
- /* only once set now, will be removed too, should become a global standard */
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
- ob= base->object;
-
- if (ob!=G.obedit) {
- if (ob->restrictflag & OB_RESTRICT_VIEW)
- return;
- }
-
- /* xray delay? */
- if((flag & DRAW_PICKING)==0 && (base->flag & OB_FROMDUPLI)==0) {
- /* don't do xray in particle mode, need the z-buffer */
- if(!(G.f & G_PARTICLEEDIT)) {
- /* xray and transp are set when it is drawing the 2nd/3rd pass */
- if(!G.vd->xray && !G.vd->transp && (ob->dtx & OB_DRAWXRAY)) {
- add_view3d_after(G.vd, base, V3D_XRAY);
- return;
- }
- }
- }
-
- /* draw keys? */
- if(base==(G.scene->basact) || (base->flag & (SELECT+BA_WAS_SEL))) {
- if(flag==0 && warning_recursive==0 && ob!=G.obedit) {
- if(ob->ipo && ob->ipo->showkey && (ob->ipoflag & OB_DRAWKEY)) {
- ListBase elems;
- CfraElem *ce;
- float temp[7][3];
-
- warning_recursive= 1;
-
- elems.first= elems.last= 0;
- make_cfra_list(ob->ipo, &elems);
-
- cfraont= (G.scene->r.cfra);
- drawtype= G.vd->drawtype;
- if(drawtype>OB_WIRE) G.vd->drawtype= OB_WIRE;
- sel= base->flag;
- memcpy(temp, &ob->loc, 7*3*sizeof(float));
-
- ipoflag= ob->ipoflag;
- ob->ipoflag &= ~OB_OFFS_OB;
-
- set_no_parent_ipo(1);
- disable_speed_curve(1);
-
- if ((ob->ipoflag & OB_DRAWKEYSEL)==0) {
- ce= elems.first;
- while(ce) {
- if(!ce->sel) {
- (G.scene->r.cfra)= ce->cfra/G.scene->r.framelen;
-
- base->flag= 0;
-
- where_is_object_time(ob, (G.scene->r.cfra));
- draw_object(base, 0);
- }
- ce= ce->next;
- }
- }
-
- ce= elems.first;
- while(ce) {
- if(ce->sel) {
- (G.scene->r.cfra)= ce->cfra/G.scene->r.framelen;
-
- base->flag= SELECT;
-
- where_is_object_time(ob, (G.scene->r.cfra));
- draw_object(base, 0);
- }
- ce= ce->next;
- }
-
- set_no_parent_ipo(0);
- disable_speed_curve(0);
-
- base->flag= sel;
- ob->ipoflag= ipoflag;
-
- /* restore icu->curval */
- (G.scene->r.cfra)= cfraont;
-
- memcpy(&ob->loc, temp, 7*3*sizeof(float));
- where_is_object(ob);
- G.vd->drawtype= drawtype;
-
- BLI_freelistN(&elems);
-
- warning_recursive= 0;
- }
- }
- }
-
- /* patch? children objects with a timeoffs change the parents. How to solve! */
- /* if( ((int)ob->ctime) != F_(G.scene->r.cfra)) where_is_object(ob); */
-
- mymultmatrix(ob->obmat);
-
- /* which wire color */
- if((flag & DRAW_CONSTCOLOR) == 0) {
- project_short(ob->obmat[3], &base->sx);
-
- if((G.moving & G_TRANSFORM_OBJ) && (base->flag & (SELECT+BA_WAS_SEL))) BIF_ThemeColor(TH_TRANSFORM);
- else {
-
- if(ob->type==OB_LAMP) BIF_ThemeColor(TH_LAMP);
- else BIF_ThemeColor(TH_WIRE);
-
- if((G.scene->basact)==base) {
- if(base->flag & (SELECT+BA_WAS_SEL)) BIF_ThemeColor(TH_ACTIVE);
- }
- else {
- if(base->flag & (SELECT+BA_WAS_SEL)) BIF_ThemeColor(TH_SELECT);
- }
-
- // no theme yet
- if(ob->id.lib) {
- if(base->flag & (SELECT+BA_WAS_SEL)) colindex = 4;
- else colindex = 3;
- }
- else if(warning_recursive==1) {
- if(base->flag & (SELECT+BA_WAS_SEL)) {
- if(G.scene->basact==base) colindex = 8;
- else colindex= 7;
- }
- else colindex = 6;
- }
- else if(ob->flag & OB_FROMGROUP) {
- if(base->flag & (SELECT+BA_WAS_SEL)) {
- if(G.scene->basact==base) BIF_ThemeColor(TH_GROUP_ACTIVE);
- else BIF_ThemeColorShade(TH_GROUP_ACTIVE, -16);
- }
- else BIF_ThemeColor(TH_GROUP);
- colindex= 0;
- }
-
- }
-
- if(colindex) {
- col= colortab[colindex];
- cpack(col);
- }
- }
-
- /* maximum drawtype */
- dt= MIN2(G.vd->drawtype, ob->dt);
- if(G.vd->zbuf==0 && dt>OB_WIRE) dt= OB_WIRE;
- dtx= 0;
-
- /* faceselect exception: also draw solid when dt==wire, except in editmode */
- if(ob==OBACT && (G.f & (G_VERTEXPAINT+G_TEXTUREPAINT+G_WEIGHTPAINT))) {
- if(ob->type==OB_MESH) {
-
- if(ob==G.obedit);
- else {
- dt= OB_SHADED;
-
- glClearDepth(1.0); glClear(GL_DEPTH_BUFFER_BIT);
- glEnable(GL_DEPTH_TEST);
- if(dt<OB_SOLID) zbufoff= 1;
- }
- }
- else {
- if(dt<OB_SOLID) {
- dt= OB_SOLID;
- glClearDepth(1.); glClear(GL_DEPTH_BUFFER_BIT);
- glEnable(GL_DEPTH_TEST);
- zbufoff= 1;
- }
- }
- }
-
- /* draw-extra supported for boundbox drawmode too */
- if(dt>=OB_BOUNDBOX ) {
-
- dtx= ob->dtx;
- if(G.obedit==ob) {
- // the only 2 extra drawtypes alowed in editmode
- dtx= dtx & (OB_DRAWWIRE|OB_TEXSPACE);
- }
-
- if(G.f & G_DRAW_EXT) {
- if(ob->type==OB_EMPTY || ob->type==OB_CAMERA || ob->type==OB_LAMP) dt= OB_WIRE;
- }
- }
-
- /* draw outline for selected solid objects, mesh does itself */
- if((G.vd->flag & V3D_SELECT_OUTLINE) && ob->type!=OB_MESH) {
- if(dt>OB_WIRE && dt<OB_TEXTURE && ob!=G.obedit) {
- if (!(ob->dtx&OB_DRAWWIRE) && (ob->flag&SELECT) && !(flag&DRAW_PICKING)) {
- drawSolidSelect(base);
- }
- }
- }
-
- switch( ob->type) {
- case OB_MESH:
- if (!(base->flag&OB_RADIO)) {
- empty_object= draw_mesh_object(base, dt, flag);
- if(flag!=DRAW_CONSTCOLOR) dtx &= ~OB_DRAWWIRE; // mesh draws wire itself
-
- if(G.obedit!=ob && warning_recursive==0) {
- PartEff *paf = give_parteff(ob);
-
- if(paf) {
- if(col || (ob->flag & SELECT)) cpack(0xFFFFFF); /* for visibility, also while wpaint */
- if(paf->flag & PAF_STATIC) draw_static_particle_system(ob, paf, dt);
- else if((flag & DRAW_PICKING) == 0) draw_particle_system(base, paf); // selection errors happen to easy
- if(col) cpack(col);
- }
- }
- }
-
- break;
- case OB_FONT:
- cu= ob->data;
- if (cu->disp.first==NULL) makeDispListCurveTypes(ob, 0);
- if(ob==G.obedit) {
- tekentextcurs();
-
- if (cu->flag & CU_FAST) {
- cpack(0xFFFFFF);
- set_inverted_drawing(1);
- drawDispList(base, OB_WIRE);
- set_inverted_drawing(0);
- } else {
- drawDispList(base, dt);
- }
-
- if (cu->linewidth != 0.0) {
- cpack(0xff44ff);
- BIF_ThemeColor(TH_WIRE);
- VECCOPY(vec1, ob->orig);
- VECCOPY(vec2, ob->orig);
- vec1[0] += cu->linewidth;
- vec2[0] += cu->linewidth;
- vec1[1] += cu->linedist * cu->fsize;
- vec2[1] -= cu->lines * cu->linedist * cu->fsize;
- setlinestyle(3);
- glBegin(GL_LINE_STRIP);
- glVertex2fv(vec1);
- glVertex2fv(vec2);
- glEnd();
- setlinestyle(0);
- }
-
- setlinestyle(3);
- for (i=0; i<cu->totbox; i++) {
- if (cu->tb[i].w != 0.0) {
- if (i == (cu->actbox-1))
- BIF_ThemeColor(TH_ACTIVE);
- else
- BIF_ThemeColor(TH_WIRE);
- vec1[0] = cu->tb[i].x;
- vec1[1] = cu->tb[i].y + cu->fsize;
- vec1[2] = 0.001;
- glBegin(GL_LINE_STRIP);
- glVertex3fv(vec1);
- vec1[0] += cu->tb[i].w;
- glVertex3fv(vec1);
- vec1[1] -= cu->tb[i].h;
- glVertex3fv(vec1);
- vec1[0] -= cu->tb[i].w;
- glVertex3fv(vec1);
- vec1[1] += cu->tb[i].h;
- glVertex3fv(vec1);
- glEnd();
- }
- }
- setlinestyle(0);
-
-
- if (getselection(&selstart, &selend) && selboxes) {
- float selboxw;
-
- cpack(0xffffff);
- set_inverted_drawing(1);
- for (i=0; i<(selend-selstart+1); i++) {
- SelBox *sb = &(selboxes[i]);
-
- if (i<(selend-selstart)) {
- if (selboxes[i+1].y == sb->y)
- selboxw= selboxes[i+1].x - sb->x;
- else
- selboxw= sb->w;
- }
- else {
- selboxw= sb->w;
- }
- glBegin(GL_QUADS);
- glVertex3f(sb->x, sb->y, 0.001);
- glVertex3f(sb->x+selboxw, sb->y, 0.001);
- glVertex3f(sb->x+selboxw, sb->y+sb->h, 0.001);
- glVertex3f(sb->x, sb->y+sb->h, 0.001);
- glEnd();
- }
- set_inverted_drawing(0);
- }
- }
- else if(dt==OB_BOUNDBOX)
- draw_bounding_volume(ob);
- else if(boundbox_clip(ob->obmat, cu->bb))
- empty_object= drawDispList(base, dt);
-
- break;
- case OB_CURVE:
- case OB_SURF:
- cu= ob->data;
- /* still needed for curves hidden in other layers. depgraph doesnt handle that yet */
- if (cu->disp.first==NULL) makeDispListCurveTypes(ob, 0);
-
- if(ob==G.obedit) {
- drawnurb(base, editNurb.first, dt);
- }
- else if(dt==OB_BOUNDBOX)
- draw_bounding_volume(ob);
- else if(boundbox_clip(ob->obmat, cu->bb)) {
- empty_object= drawDispList(base, dt);
-
- if(cu->path)
- curve_draw_speed(ob);
- }
- break;
- case OB_MBALL:
- if(ob==G.obedit)
- drawmball(base, dt);
- else if(dt==OB_BOUNDBOX)
- draw_bounding_volume(ob);
- else
- empty_object= drawmball(base, dt);
- break;
- case OB_EMPTY:
- drawaxes(ob->empty_drawsize, flag, ob->empty_drawtype);
- break;
- case OB_LAMP:
- drawlamp(ob);
- if(dtx || (base->flag & SELECT)) mymultmatrix(ob->obmat);
- break;
- case OB_CAMERA:
- drawcamera(ob, flag);
- break;
- case OB_LATTICE:
- drawlattice(ob);
- break;
- case OB_ARMATURE:
- if(dt>OB_WIRE) set_gl_material(0); // we use defmaterial
- empty_object= draw_armature(base, dt);
- break;
- default:
- drawaxes(1.0, flag, OB_ARROWS);
- }
- if(ob->pd && ob->pd->forcefield) draw_forcefield(ob);
-
- /* code for new particle system */
- if(warning_recursive==0 && (flag & DRAW_PICKING)==0 && ob!=G.obedit){
- glDepthMask(GL_FALSE);
- if(col || (ob->flag & SELECT)) cpack(0xFFFFFF); /* for visibility, also while wpaint */
- if(ob->particlesystem.first) {
- ParticleSystem *psys;
-
- for(psys=ob->particlesystem.first; psys; psys=psys->next)
- draw_new_particle_system(base, psys);
-
- if(G.f & G_PARTICLEEDIT && ob==OBACT) {
- psys= PE_get_current(ob);
- if(psys && !G.obedit && psys_in_edit_mode(psys))
- draw_particle_edit(ob, psys);
- }
- }
- if(col) cpack(col);
- glDepthMask(GL_TRUE);
- }
-
- {
- bConstraint *con;
- for(con=ob->constraints.first; con; con= con->next)
- {
- if(con->type==CONSTRAINT_TYPE_RIGIDBODYJOINT)
- {
- bRigidBodyJointConstraint *data = (bRigidBodyJointConstraint*)con->data;
- if(data->flag&CONSTRAINT_DRAW_PIVOT)
- drawRBpivot(data);
- }
- }
- }
-
- /* draw extra: after normal draw because of makeDispList */
- if(dtx) {
- if(G.f & G_SIMULATION);
- else if(dtx & OB_AXIS) {
- drawaxes(1.0f, flag, OB_ARROWS);
- }
- if(dtx & OB_BOUNDBOX) draw_bounding_volume(ob);
- if(dtx & OB_TEXSPACE) drawtexspace(ob);
- if(dtx & OB_DRAWNAME) {
- /* patch for several 3d cards (IBM mostly) that crash on glSelect with text drawing */
- /* but, we also dont draw names for sets or duplicators */
- if(flag == 0) {
- glRasterPos3f(0.0, 0.0, 0.0);
-
- BMF_DrawString(G.font, " ");
- BMF_DrawString(G.font, ob->id.name+2);
- }
- }
- /*if(dtx & OB_DRAWIMAGE) drawDispListwire(&ob->disp);*/
- if((dtx & OB_DRAWWIRE) && dt>=OB_SOLID) drawWireExtra(ob);
- }
-
- if(dt<OB_SHADED) {
- if((ob->gameflag & OB_ACTOR) && (ob->gameflag & OB_DYNAMIC)) {
- float tmat[4][4], imat[4][4], vec[3];
-
- vec[0]= vec[1]= vec[2]= 0.0;
- mygetmatrix(tmat);
- Mat4Invert(imat, tmat);
-
- setlinestyle(2);
- drawcircball(GL_LINE_LOOP, vec, ob->inertia, imat);
- setlinestyle(0);
- }
- }
-
- myloadmatrix(G.vd->viewmat);
-
- if(zbufoff) glDisable(GL_DEPTH_TEST);
-
- if(warning_recursive) return;
- if(base->flag & (OB_FROMDUPLI|OB_RADIO)) return;
- if(G.f & G_SIMULATION) return;
-
- /* object centers, need to be drawn in viewmat space for speed, but OK for picking select */
- if(ob!=OBACT || (G.f & (G_VERTEXPAINT|G_TEXTUREPAINT|G_WEIGHTPAINT))==0) {
- int do_draw_center= -1; /* defines below are zero or positive... */
-
- if((G.scene->basact)==base)
- do_draw_center= ACTIVE;
- else if(base->flag & SELECT)
- do_draw_center= SELECT;
- else if(empty_object || (G.vd->flag & V3D_DRAW_CENTERS))
- do_draw_center= DESELECT;
-
- if(do_draw_center != -1) {
- if(flag & DRAW_PICKING) {
- /* draw a single point for opengl selection */
- glBegin(GL_POINTS);
- glVertex3fv(ob->obmat[3]);
- glEnd();
- }
- else if((flag & DRAW_CONSTCOLOR)==0) {
- /* we don't draw centers for duplicators and sets */
-#ifdef WITH_VERSE
- if(ob->vnode)
- drawcentercircle(ob->obmat[3], VERSE, 1);
- else
-#endif
- drawcentercircle(ob->obmat[3], do_draw_center, ob->id.lib || ob->id.us>1);
- }
- }
- }
-
- /* not for sets, duplicators or picking */
- if(flag==0 && (!(G.vd->flag & V3D_HIDE_HELPLINES))) {
- ListBase *list;
-
- /* draw hook center and offset line */
- if(ob!=G.obedit) draw_hooks(ob);
-
- /* help lines and so */
- if(ob!=G.obedit && ob->parent && (ob->parent->lay & G.vd->lay)) {
- setlinestyle(3);
- glBegin(GL_LINES);
- glVertex3fv(ob->obmat[3]);
- glVertex3fv(ob->orig);
- glEnd();
- setlinestyle(0);
- }
-
- /* Drawing the constraint lines */
- list = &ob->constraints;
- if (list) {
- bConstraint *curcon;
- bConstraintOb *cob;
- char col[4], col2[4];
-
- BIF_GetThemeColor3ubv(TH_GRID, col);
- make_axis_color(col, col2, 'z');
- glColor3ubv((GLubyte *)col2);
-
- cob= constraints_make_evalob(ob, NULL, CONSTRAINT_OBTYPE_OBJECT);
-
- for (curcon = list->first; curcon; curcon=curcon->next) {
- bConstraintTypeInfo *cti= constraint_get_typeinfo(curcon);
- ListBase targets = {NULL, NULL};
- bConstraintTarget *ct;
-
- if ((curcon->flag & CONSTRAINT_EXPAND) && (cti) && (cti->get_constraint_targets)) {
- cti->get_constraint_targets(curcon, &targets);
-
- for (ct= targets.first; ct; ct= ct->next) {
- /* calculate target's matrix */
- if (cti->get_target_matrix)
- cti->get_target_matrix(curcon, cob, ct, bsystem_time(ob, (float)(G.scene->r.cfra), ob->sf));
- else
- Mat4One(ct->matrix);
-
- setlinestyle(3);
- glBegin(GL_LINES);
- glVertex3fv(ct->matrix[3]);
- glVertex3fv(ob->obmat[3]);
- glEnd();
- setlinestyle(0);
- }
-
- if (cti->flush_constraint_targets)
- cti->flush_constraint_targets(curcon, &targets, 1);
- }
- }
-
- constraints_clear_evalob(cob);
- }
- }
-
- free_old_images();
-}
-
-void draw_object_ext(Base *base)
-{
-
- if(G.vd==NULL || base==NULL) return;
-
- if(G.vd->drawtype > OB_WIRE) {
- G.vd->zbuf= 1;
- glEnable(GL_DEPTH_TEST);
- }
-
- G.f |= G_DRAW_EXT;
-
- glDrawBuffer(GL_FRONT);
- persp(PERSP_VIEW);
-
- if(G.vd->flag & V3D_CLIPPING)
- view3d_set_clipping(G.vd);
-
- draw_object(base, 0);
-
- if(G.vd->flag & V3D_CLIPPING)
- view3d_clr_clipping();
-
- G.f &= ~G_DRAW_EXT;
-
- bglFlush(); /* reveil frontbuffer drawing */
- glDrawBuffer(GL_BACK);
-
- if(G.vd->zbuf) {
- G.vd->zbuf= 0;
- glDisable(GL_DEPTH_TEST);
- }
- curarea->win_swap= WIN_FRONT_OK;
-}
-
-/* ***************** BACKBUF SEL (BBS) ********* */
-
-static void bbs_mesh_verts__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s)
-{
- int offset = (long) userData;
- EditVert *eve = EM_get_vert_for_index(index);
-
- if (eve->h==0) {
- set_framebuffer_index_color(offset+index);
- bglVertex3fv(co);
- }
-}
-static int bbs_mesh_verts(DerivedMesh *dm, int offset)
-{
- glPointSize( BIF_GetThemeValuef(TH_VERTEX_SIZE) );
- bglBegin(GL_POINTS);
- dm->foreachMappedVert(dm, bbs_mesh_verts__mapFunc, (void*)(long) offset);
- bglEnd();
- glPointSize(1.0);
-
- return offset + G.totvert;
-}
-
-static int bbs_mesh_wire__setDrawOptions(void *userData, int index)
-{
- int offset = (long) userData;
- EditEdge *eed = EM_get_edge_for_index(index);
-
- if (eed->h==0) {
- set_framebuffer_index_color(offset+index);
- return 1;
- } else {
- return 0;
- }
-}
-static int bbs_mesh_wire(DerivedMesh *dm, int offset)
-{
- dm->drawMappedEdges(dm, bbs_mesh_wire__setDrawOptions, (void*)(long) offset);
-
- return offset + G.totedge;
-}
-
-static int bbs_mesh_solid__setSolidDrawOptions(void *userData, int index, int *drawSmooth_r)
-{
- if (EM_get_face_for_index(index)->h==0) {
- if (userData) {
- set_framebuffer_index_color(index+1);
- }
- return 1;
- } else {
- return 0;
- }
-}
-
-static void bbs_mesh_solid__drawCenter(void *userData, int index, float *cent, float *no)
-{
- EditFace *efa = EM_get_face_for_index(index);
-
- if (efa->h==0 && efa->fgonf!=EM_FGON) {
- set_framebuffer_index_color(index+1);
-
- bglVertex3fv(cent);
- }
-}
-
-/* two options, facecolors or black */
-static int bbs_mesh_solid_EM(DerivedMesh *dm, int facecol)
-{
- cpack(0);
-
- if (facecol) {
- dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, (void*)(long) 1, 0);
-
- if( CHECK_OB_DRAWFACEDOT(G.scene, G.vd, G.obedit->dt) ) {
- glPointSize(BIF_GetThemeValuef(TH_FACEDOT_SIZE));
-
- bglBegin(GL_POINTS);
- dm->foreachMappedFaceCenter(dm, bbs_mesh_solid__drawCenter, NULL);
- bglEnd();
- }
-
- return 1+G.totface;
- } else {
- dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, (void*) 0, 0);
- return 1;
- }
-}
-
-static int bbs_mesh_solid__setDrawOpts(void *userData, int index, int *drawSmooth_r)
-{
- Mesh *me = userData;
-
- if (!(me->mface[index].flag&ME_HIDE)) {
- set_framebuffer_index_color(index+1);
- return 1;
- } else {
- return 0;
- }
-}
-
-static int bbs_mesh_wire__setDrawOpts(void *userData, int index)
-{
- struct { Mesh *me; EdgeHash *eh; int offset; } *data = userData;
- MEdge *med = data->me->medge + index;
- unsigned long flags = (long)BLI_edgehash_lookup(data->eh, med->v1, med->v2);
-
- if (flags & 1) {
- set_framebuffer_index_color(data->offset+index);
- return 1;
- } else
- return 0;
-}
-
-/* TODO remove this - since face select mode now only works with painting */
-static void bbs_mesh_solid(Object *ob)
-{
- DerivedMesh *dm = mesh_get_derived_final(ob, get_viewedit_datamask());
- Mesh *me = (Mesh*)ob->data;
-
- glColor3ub(0, 0, 0);
- dm->drawMappedFaces(dm, bbs_mesh_solid__setDrawOpts, me, 0);
-
- /* draw edges for seam marking in faceselect mode, but not when painting,
- so that painting doesn't get interrupted on an edge */
- if ((G.f & G_FACESELECT) && !(G.f & (G_VERTEXPAINT|G_TEXTUREPAINT|G_WEIGHTPAINT))) {
- struct { Mesh *me; EdgeHash *eh; int offset; } userData;
-
- userData.me = me;
- userData.eh = get_tface_mesh_marked_edge_info(me);
- userData.offset = userData.me->totface+1;
-
- bglPolygonOffset(1.0);
- dm->drawMappedEdges(dm, bbs_mesh_wire__setDrawOpts, (void*)&userData);
- bglPolygonOffset(0.0);
-
- BLI_edgehash_free(userData.eh, NULL);
- }
-
- dm->release(dm);
-}
-
-void draw_object_backbufsel(Object *ob)
-{
-
- mymultmatrix(ob->obmat);
-
- glClearDepth(1.0); glClear(GL_DEPTH_BUFFER_BIT);
- glEnable(GL_DEPTH_TEST);
-
- switch( ob->type) {
- case OB_MESH:
- if(ob==G.obedit) {
- DerivedMesh *dm = editmesh_get_derived_cage(CD_MASK_BAREMESH);
-
- EM_init_index_arrays(1, 1, 1);
-
- em_solidoffs= bbs_mesh_solid_EM(dm, G.scene->selectmode & SCE_SELECT_FACE);
-
- bglPolygonOffset(1.0);
-
- // we draw edges always, for loop (select) tools
- em_wireoffs= bbs_mesh_wire(dm, em_solidoffs);
-
- // we draw verts if vert select mode or if in transform (for snap).
- if(G.scene->selectmode & SCE_SELECT_VERTEX || G.moving & G_TRANSFORM_EDIT)
- em_vertoffs= bbs_mesh_verts(dm, em_wireoffs);
- else em_vertoffs= em_wireoffs;
-
- bglPolygonOffset(0.0);
-
- dm->release(dm);
-
- EM_free_index_arrays();
- }
- else bbs_mesh_solid(ob);
-
- break;
- case OB_CURVE:
- case OB_SURF:
- break;
- }
-
- myloadmatrix(G.vd->viewmat);
-}
-
-
-/* ************* draw object instances for bones, for example ****************** */
-/* assumes all matrices/etc set OK */
-
-/* helper function for drawing object instances - meshes */
-static void draw_object_mesh_instance(Object *ob, int dt, int outline)
-{
- DerivedMesh *dm=NULL, *edm=NULL;
-
- if(G.obedit && ob->data==G.obedit->data)
- edm= editmesh_get_derived_base();
- else
- dm = mesh_get_derived_final(ob, CD_MASK_BAREMESH);
-
- if(dt<=OB_WIRE) {
- if(dm)
- dm->drawEdges(dm, 1);
- else if(edm)
- edm->drawEdges(edm, 1);
- }
- else {
- if(outline)
- draw_mesh_object_outline(ob, dm?dm:edm);
-
- if(dm)
- init_gl_materials(ob, 0);
- else {
- glEnable(GL_COLOR_MATERIAL);
- BIF_ThemeColor(TH_BONE_SOLID);
- glDisable(GL_COLOR_MATERIAL);
- }
-
- glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0);
- glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
- glEnable(GL_LIGHTING);
-
- if(dm)
- dm->drawFacesSolid(dm, set_gl_material);
- else if(edm)
- edm->drawMappedFaces(edm, NULL, NULL, 0);
-
- glDisable(GL_LIGHTING);
- }
-
- if(edm) edm->release(edm);
- if(dm) dm->release(dm);
-}
-
-void draw_object_instance(Object *ob, int dt, int outline)
-{
- if (ob == NULL)
- return;
-
- switch (ob->type) {
- case OB_MESH:
- draw_object_mesh_instance(ob, dt, outline);
- break;
- case OB_EMPTY:
- drawaxes(ob->empty_drawsize, 0, ob->empty_drawtype);
- break;
- }
-}
diff --git a/source/blender/src/drawoops.c b/source/blender/src/drawoops.c
deleted file mode 100644
index ef32d2c7039..00000000000
--- a/source/blender/src/drawoops.c
+++ /dev/null
@@ -1,521 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "BMF_Api.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "DNA_ID.h"
-#include "DNA_object_types.h"
-#include "DNA_oops_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_view2d_types.h"
-
-#include "BKE_utildefines.h"
-#include "BKE_global.h"
-
-#include "BIF_interface.h"
-#include "BIF_interface_icons.h"
-#include "BIF_language.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-#include "BIF_mywindow.h"
-#include "BIF_outliner.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-
-/* #include "BIF_drawoops.h" bad name :(*/
-#include "BIF_oops.h"
-
-#include "BSE_drawipo.h"
-#include "BSE_drawoops.h"
-
-float aspect;
-void *font;
-
-
-static float icon_width();
-float center_oops_text(char *str);
-
-
-void boundbox_oops(short sel)
-{
- Oops *oops;
- float min[2], max[2];
- int ok= 0;
-
- if(G.soops==0) return;
-
- min[0]= 1000.0;
- max[0]= -1000.0;
- min[1]= 1000.0;
- max[1]= -1000.0;
-
- oops= G.soops->oops.first;
- while(oops) {
- if ((oops->hide==0 && !sel) || (sel && oops->flag & SELECT )) {
- ok= 1;
-
- min[0]= MIN2(min[0], oops->x);
- max[0]= MAX2(max[0], oops->x+OOPSX);
- min[1]= MIN2(min[1], oops->y);
- max[1]= MAX2(max[1], oops->y+OOPSY);
- }
- oops= oops->next;
- }
-
- if(ok==0) return;
-
- G.v2d->tot.xmin= min[0];
- G.v2d->tot.xmax= max[0];
- G.v2d->tot.ymin= min[1];
- G.v2d->tot.ymax= max[1];
-
-}
-
-void give_oopslink_line(Oops *oops, OopsLink *ol, float *v1, float *v2)
-{
-
- if(ol->to && ol->to->hide==0) {
- v1[0]= oops->x+ol->xof;
- v1[1]= oops->y+ol->yof;
- v2[0]= ol->to->x+OOPSX/2;
- v2[1]= ol->to->y;
- }
- else if(ol->from && ol->from->hide==0) {
- v1[0]= ol->from->x + ol->xof;
- v1[1]= ol->from->y + ol->xof;
- v2[0]= oops->x+OOPSX/2;
- v2[1]= oops->y;
- }
-}
-
-void draw_oopslink(Oops *oops)
-{
- OopsLink *ol;
- float vec[4][3], dist, spline_step;
- short curve_res;
-
- if(oops->type==ID_SCE || oops->type==ID_GR) {
- if(oops->flag & SELECT) {
- /* when using python Mesh to make meshes a file was saved
- that had an oops with no ID, stops a segfault when looking for lib */
- if(oops->id && oops->id->lib) cpack(0x4080A0);
- else cpack(0x808080);
- }
- else cpack(0x606060);
- }
- else {
- if(oops->flag & SELECT) {
- if(oops->id && oops->id->lib) cpack(0x11AAFF);
- else cpack(0xFFFFFF);
- }
- else cpack(0x0);
- }
-
- glEnable(GL_MAP1_VERTEX_3);
- vec[0][2]= vec[1][2]= vec[2][2]= vec[3][2]= 0.0; /* only 2d spline, set the Z to 0*/
-
- ol= oops->link.first;
- while(ol) {
- if(ol->to && ol->to->hide==0) {
-
- give_oopslink_line(oops, ol, vec[0], vec[3]);
-
- dist= 0.5*VecLenf(vec[0], vec[3]);
-
- /* check ol->xof and yof for direction */
- if(ol->xof == 0.0) {
- vec[1][0]= vec[0][0]-dist;
- vec[1][1]= vec[0][1];
- }
- else if(ol->xof==OOPSX) {
- vec[1][0]= vec[0][0]+dist;
- vec[1][1]= vec[0][1];
- }
- else {
- vec[1][0]= vec[0][0];
- vec[1][1]= vec[0][1]+dist;
- }
-
- /* v3 is always pointing down */
- vec[2][0]= vec[3][0];
- vec[2][1]= vec[3][1] - dist;
-
- if( MIN4(vec[0][0], vec[1][0], vec[2][0], vec[3][0]) > G.v2d->cur.xmax); /* clipped */
- else if ( MAX4(vec[0][0], vec[1][0], vec[2][0], vec[3][0]) < G.v2d->cur.xmin); /* clipped */
- else {
- /* calculate a curve resolution to use based on the length of the curve.*/
- curve_res = MIN2(40, MAX2(2, 2*dist/aspect));
-
- /* we can reuse the dist variable here to increment the GL curve eval amount*/
- dist = (float)1/curve_res;
- spline_step = 0.0;
-
- glMap1f(GL_MAP1_VERTEX_3, 0.0, 1.0, 3, 4, vec[0]);
- glBegin(GL_LINE_STRIP);
- while (spline_step < 1.000001) {
- glEvalCoord1f(spline_step);
- spline_step += dist;
- }
- glEnd();
- }
-
- }
- ol= ol->next;
- }
-}
-
-static float icon_width()
-{
- /* change it in *one place* when you mess around */
- return 0.8*OOPSY;
-}
-
-void draw_icon_oops(float *co, short type)
-{
- BIFIconID icon;
- float ofs;
-
- switch(type) {
- default: return;
-
- case ID_OB: icon= ICON_OBJECT_HLT; break;
- case ID_ME: icon= ICON_MESH_HLT; break;
- case ID_CU: icon= ICON_CURVE_HLT; break;
- case ID_MB: icon= ICON_MBALL_HLT; break;
- case ID_LT: icon= ICON_LATTICE_HLT; break;
- case ID_LA: icon= ICON_LAMP_HLT; break;
- case ID_MA: icon= ICON_MATERIAL_HLT; break;
- case ID_TE: icon= ICON_TEXTURE_HLT; break;
- case ID_IP: icon= ICON_IPO_HLT; break;
- case ID_LI: icon= ICON_LIBRARY_HLT; break;
- case ID_IM: icon= ICON_IMAGE_HLT; break;
- case ID_GR: icon= ICON_CIRCLE_DEHLT; break;
- }
-
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
- /* height of box is OOPSY...icon is centered vertically */
- ofs = (OOPSY - icon_width())/2.0;
- BIF_icon_draw_aspect(co[0], co[1]+ofs, icon, icon_width()*aspect*ICON_DEFAULT_HEIGHT/OOPSY);
-
- glBlendFunc(GL_ONE, GL_ZERO);
- glDisable(GL_BLEND);
-}
-
-void mysbox(float x1, float y1, float x2, float y2)
-{
- float vec[2];
-
- glBegin(GL_LINE_LOOP);
- vec[0]= x1; vec[1]= y1;
- glVertex2fv(vec);
- vec[0]= x2;
- glVertex2fv(vec);
- vec[1]= y2;
- glVertex2fv(vec);
- vec[0]= x1;
- glVertex2fv(vec);
- glEnd();
-}
-
-unsigned int give_oops_color(short type, short sel, unsigned int *border)
-{
- unsigned int body;
- /* also finds out if a dashed line should be drawn */
-
- switch(type) {
- case ID_OB:
- body= 0x707070; break;
- case ID_SCE:
- body= 0x608060; break;
- case ID_MA:
- body= 0x808060; break;
- case ID_TE:
- body= 0x7080a0; break;
- case ID_IP:
- body= 0x906050; break;
- case ID_LA:
- body= 0x608080; break;
- case ID_LI:
- body= 0x2198DC; break;
- case ID_IM:
- body= 0x35659F; break;
- case ID_GR:
- body= 0x507050; break;
- default:
- body= 0x606070; break;
- }
-
- if(sel) {
- if(G.moving) *border= 0xf0f0f0;
- else *border= 0xc0c0c0;
- }
- else *border= 0x0;
-
-
- return body;
-}
-
-
-float center_oops_text(char *str)
-/* gives x offset at which to draw oops text -- takes icon into account */
-{
- int len;
- float width;
-
- len= strlen(str);
- if(len < 1) return 0;
-
- /* center at box width of OOPSX */
- width= aspect*BIF_GetStringWidth(font, str, 0) + icon_width();
-
- while(width > OOPSX && len >= 0) {
- str[len] = 0;
- width= aspect*BIF_GetStringWidth(font, str, 0) + icon_width();
- len--;
- }
- return (OOPSX - width)/2;
-}
-
-void draw_oops(Oops *oops)
-{
- OopsLink *ol;
- float v1[2], x1, y1, x2, y2, f1, f2;
- unsigned int body, border;
- short line= 0;
- char str[FILE_MAXDIR+FILE_MAXFILE+5];
-
- x1= oops->x;
- x2= oops->x+OOPSX;
- y1= oops->y;
- y2= oops->y+OOPSY;
-
- /* do clip */
- if(x2 < G.v2d->cur.xmin || x1 > G.v2d->cur.xmax) return;
- if(y2 < G.v2d->cur.ymin || y1 > G.v2d->cur.ymax) return;
-
- body= give_oops_color(oops->type, oops->flag & SELECT, &border);
- if(oops->id== (ID *)((G.scene->basact) ? (G.scene->basact->object) : 0)) line= 1;
- else if(oops->id== (ID *)G.scene) line= 1;
-
- if (!oops->id) return;
-
- if(oops->id->us) {
- cpack(body);
-
- glRectf(x1, y1, x2, y2);
- }
-
- if(oops->id->lib) {
- if(oops->id->flag & LIB_INDIRECT) cpack(0x1144FF);
- else cpack(0x11AAFF);
-
- glRectf(x2-0.2*OOPSX, y2-0.2*OOPSX, x2-0.1*OOPSX, y2-0.1*OOPSX);
- }
-
- v1[0]= x1;
- v1[1] = y1;
-
- if(oops->type==ID_LI) {
- sprintf(str, " %s", ((Library *)oops->id)->name);
- }
- else {
- sprintf(str, " %s", oops->id->name+2);
- }
-
- BIF_SetScale(aspect);
- v1[0] += center_oops_text(str);
-
- draw_icon_oops(v1, oops->type);
- v1[0] += icon_width();
-
- v1[1] = y1+(y2-y1)/3.0;
- if(oops->flag & SELECT) BIF_ThemeColor(TH_TEXT_HI);
- else BIF_ThemeColor(TH_TEXT);
- glRasterPos2f(v1[0], v1[1]);
- BIF_RasterPos(v1[0], v1[1]);
- BIF_SetScale(aspect);
- BIF_DrawString(font, str, 0);
-
-
- if(line) setlinestyle(2);
- cpack(border);
-
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- glRectf(x1, y1, x2, y2);
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- if(line) setlinestyle(0);
-
- /* connection blocks */
- ol= oops->link.first;
- while(ol) {
-
- f1= x1+ol->xof;
- f2= y1+ol->yof;
-
- body= give_oops_color(ol->type, oops->flag & SELECT, &border);
- cpack(body);
-
- glRectf(f1-.2, f2-.2, f1+.2, f2+.2);
- cpack(border);
-
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
-
- glRectf(f1-.2, f2-.2, f1+.2, f2+.2);
-
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-
- ol= ol->next;
- }
-
- if(oops->flag & OOPS_REFER) {
- /* Draw the little rounded connection point */
- glColor3ub(0, 0, 0);
- glPushMatrix();
-
- glTranslatef(oops->x + 0.5*OOPSX, oops->y, 0.0);
- glutil_draw_filled_arc(0.0, M_PI, 0.05*OOPSX, 7);
-
- glPopMatrix();
- }
-}
-
-void drawoopsspace(ScrArea *sa, void *spacedata)
-{
- SpaceOops *soops= spacedata;
- Oops *oops;
- float col[3];
-
- BIF_GetThemeColor3fv(TH_BACK, col);
-
- if(soops==0) return;
-
- /* darker background for oops */
- if(soops->type!=SO_OUTLINER) {
- col[0] = col[0] * 0.75; col[1] = col[1] * 0.75; col[2] = col[2] * 0.75;
- }
-
- glClearColor(col[0], col[1], col[2], 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- if(soops->type==SO_OUTLINER) draw_outliner(sa, soops);
- else {
- build_oops(); /* changed to become first call... */
-
- boundbox_oops(0);
- calc_scrollrcts(sa, G.v2d, curarea->winx, curarea->winy);
-
- myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax);
- bwin_clear_viewmat(sa->win); /* clear buttons view */
- glLoadIdentity();
-
- aspect= (G.v2d->cur.xmax - G.v2d->cur.xmin)/((float)sa->winx);
- font= uiSetCurFont_ext(30*aspect);
-
- calc_ipogrid(); /* for scrollvariables */
-
- /* drop shadow */
- BIF_ThemeColorShade(TH_BACK, -96); /* drop shadow color */
- glRectf(G.v2d->tot.xmin-1, G.v2d->tot.ymin-3, G.v2d->tot.xmax+3,
- G.v2d->tot.ymax+1);
-
- /* light square in the center */
- BIF_GetThemeColor3fv(TH_BACK, col);
- glColor3fv(col);
- glRectf(G.v2d->tot.xmin-2, G.v2d->tot.ymin-2, G.v2d->tot.xmax+2,
- G.v2d->tot.ymax+2);
-
- /* box around the oops. */
- cpack(0x0);
- mysbox(G.v2d->tot.xmin-2, G.v2d->tot.ymin-2, G.v2d->tot.xmax+2,
- G.v2d->tot.ymax+2);
-
-
- /* Draw unselected oops links */
- for(oops= soops->oops.first; oops; oops = oops->next) {
- if(oops->hide==0 && (oops->flag & SELECT)); else {
- draw_oopslink(oops);
- }
- }
-
- /* Draw selected oops links */
- for(oops= soops->oops.first; oops; oops = oops->next) {
- if(oops->hide==0 && (oops->flag & SELECT)) {
- draw_oopslink(oops);
- }
- }
-
- for(oops= soops->oops.first; oops; oops = oops->next) {
- if(oops->hide==0) {
- if(oops->flag & SELECT); else draw_oops(oops);
- }
- }
-
- for(oops= soops->oops.first; oops; oops = oops->next) {
- if(oops->hide==0) {
- if(oops->flag & SELECT) draw_oops(oops);
- }
- }
- }
-
- /* restore viewport */
- mywinset(curarea->win);
-
- /* ortho at pixel level curarea */
- myortho2(-0.375, sa->winx-0.375, -0.375, sa->winy-0.375);
-
- if(soops->type==SO_OUTLINER) {
- if(sa->winx>SCROLLB+10 && sa->winy>SCROLLH+10) {
- if(G.v2d->scroll) drawscroll(0);
- }
- }
- draw_area_emboss(sa);
-
- curarea->win_swap= WIN_BACK_OK;
-}
-
-
-
diff --git a/source/blender/src/drawscene.c b/source/blender/src/drawscene.c
deleted file mode 100644
index 557083d2b97..00000000000
--- a/source/blender/src/drawscene.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * drawing graphics and editing
- */
-
-#include <math.h>
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "DNA_scene_types.h"
-#include "DNA_space_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_view3d_types.h"
-
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_scene.h"
-
-#include "BDR_editobject.h"
-#include "BDR_editface.h"
-#include "BDR_sculptmode.h"
-#include "BDR_vpaint.h"
-
-#include "BIF_space.h"
-#include "BIF_drawscene.h"
-#include "BIF_poseobject.h"
-
-#include "BSE_view.h"
-
-#include "radio.h"
-
-#include "blendef.h" /* old */
-#include "mydevice.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-void set_scene(Scene *sce) /* also see scene.c: set_scene_bg() */
-{
- bScreen *sc;
-
- /* ending all modes */
- if( G.obedit)
- exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR);
-
- exit_paint_modes();
-
- G.scene= sce;
-
- sc= G.main->screen.first;
- while(sc) {
- if((U.flag & USER_SCENEGLOBAL) || sc==G.curscreen) {
-
- if(sce != sc->scene) {
- /* all areas endlocalview */
- ScrArea *sa= sc->areabase.first;
- while(sa) {
- endlocalview(sa);
- sa= sa->next;
- }
- sc->scene= sce;
- }
-
- }
- sc= sc->id.next;
- }
-
- copy_view3d_lock(0); /* space.c */
-
- /* are there cameras in the views that are not in the scene? */
- sc= G.main->screen.first;
- while(sc) {
- if( (U.flag & USER_SCENEGLOBAL) || sc==G.curscreen) {
- ScrArea *sa= sc->areabase.first;
- while(sa) {
- SpaceLink *sl= sa->spacedata.first;
- while(sl) {
- if(sl->spacetype==SPACE_VIEW3D) {
- View3D *v3d= (View3D*) sl;
- if (!v3d->camera || !object_in_scene(v3d->camera, sce)) {
- v3d->camera= scene_find_camera(sc->scene);
- if (sc==G.curscreen) handle_view3d_lock();
- if (!v3d->camera && v3d->persp>1) v3d->persp= 1;
- }
- }
- sl= sl->next;
- }
- sa= sa->next;
- }
- }
- sc= sc->id.next;
- }
-
- set_scene_bg(G.scene);
- scene_update_for_newframe(G.scene, G.scene->lay);
-
- set_radglobal();
-
- /* complete redraw */
- allqueue(REDRAWALL, 0);
- allqueue(REDRAWDATASELECT, 0); /* does a remake */
-}
-
-
diff --git a/source/blender/src/drawscript.c b/source/blender/src/drawscript.c
deleted file mode 100644
index b009c3b8388..00000000000
--- a/source/blender/src/drawscript.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: drawtext.c.
- *
- * Contributor(s): Willian Padovani Germano.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <math.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef _WIN32
-#include <unistd.h>
-#else
-#include <io.h>
-#endif
-#include "MEM_guardedalloc.h"
-#include "PIL_time.h"
-
-#include "BMF_Api.h"
-
-#include "BLI_blenlib.h"
-
-#include "DNA_space_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_userdef_types.h"
-
-#include "BKE_utildefines.h"
-#include "BKE_text.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-
-#include "BPI_script.h"
-#include "BPY_extern.h"
-
-#include "BIF_gl.h"
-#include "BIF_keyval.h"
-#include "BIF_interface.h"
-#include "BIF_drawscript.h"
-#include "BIF_editfont.h"
-#include "BIF_spacetypes.h"
-#include "BIF_usiblender.h"
-#include "BIF_screen.h"
-#include "BIF_toolbox.h"
-#include "BIF_space.h"
-#include "BIF_mywindow.h"
-
-#include "BSE_filesel.h"
-
-#include "mydevice.h"
-#include "blendef.h"
-#include "interface.h"
-
-void drawscriptspace(ScrArea *sa, void *spacedata);
-void winqreadscriptspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
-
-void drawscriptspace(ScrArea *sa, void *spacedata)
-{
- SpaceScript *sc = curarea->spacedata.first;
- Script *script = NULL;
-
- glClearColor(0.6, 0.6, 0.6, 1.0);
- glClear(GL_COLOR_BUFFER_BIT);
- myortho2(-0.5, curarea->winrct.xmax-curarea->winrct.xmin-0.5, -0.5, curarea->winrct.ymax-curarea->winrct.ymin-0.5);
-
- if (!sc->script) return;
-
- script = sc->script;
-
- if (script->py_draw) {
- BPY_spacescript_do_pywin_draw(sc);
- }
- /* quick hack for 2.37a for scripts that call the progress bar inside a
- * file selector callback, to show previous space after finishing, w/o
- * needing an event */
- else if (!script->flags && !script->py_event && !script->py_button)
- addqueue(curarea->win, MOUSEX, 0);
-}
-
-void winqreadscriptspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt)
-{
- unsigned short event = evt->event;
- short val = evt->val;
- char ascii = evt->ascii;
- SpaceScript *sc = curarea->spacedata.first;
- Script *script = sc->script;
-
- if (script) {
- if (script->py_event || script->py_button)
- BPY_spacescript_do_pywin_event(sc, event, val, ascii);
-
- /* for file/image sel scripts: if user leaves file/image selection space,
- * this frees the script (since it can't be accessed anymore): */
- else if (script->flags == SCRIPT_FILESEL) {
- script->flags = 0;
- script->lastspace = SPACE_SCRIPT;
- }
-
- if (!script->flags) {/* finished with this script, let's free it */
- if (script->lastspace != SPACE_SCRIPT)
- newspace (curarea, script->lastspace);
- BPY_free_finished_script(script);
- sc->script = NULL;
- }
- }
- else {
- if (event == QKEY)
- if (val && (G.qual & LR_CTRLKEY) && okee("Quit Blender")) exit_usiblender();
- }
-
- return;
-}
-
-void free_scriptspace (SpaceScript *sc)
-{
- if (!sc) return;
-
- /*free buttons references*/
- if (sc->but_refs) {
- BPy_Set_DrawButtonsList(sc->but_refs);
- BPy_Free_DrawButtonsList();
- sc->but_refs = NULL;
- }
- sc->script = NULL;
-}
diff --git a/source/blender/src/drawseq.c b/source/blender/src/drawseq.c
deleted file mode 100644
index 6213b669530..00000000000
--- a/source/blender/src/drawseq.c
+++ /dev/null
@@ -1,1482 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <math.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "BMF_Api.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "IMB_imbuf_types.h"
-
-#include "DNA_sequence_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_view2d_types.h"
-#include "DNA_userdef_types.h"
-
-#include "BKE_global.h"
-#include "BKE_plugin_types.h"
-#include "BKE_scene.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_cursors.h"
-#include "BIF_gl.h"
-#include "BIF_graphics.h"
-#include "BIF_mywindow.h"
-#include "BIF_screen.h"
-#include "BIF_drawseq.h"
-#include "BIF_editseq.h"
-#include "BIF_glutil.h"
-#include "BIF_resources.h"
-#include "BIF_space.h"
-#include "BIF_interface.h"
-
-#include "BSE_view.h"
-#include "BSE_drawipo.h"
-#include "BSE_sequence.h"
-#include "BSE_seqeffects.h"
-#include "BSE_seqscopes.h"
-#include "BSE_seqaudio.h"
-#include "BSE_time.h"
-
-#include "IMB_imbuf_types.h"
-#include "IMB_imbuf.h"
-
-#include "blendef.h" /* CFRA */
-#include "mydevice.h" /* REDRAWSEQ */
-#include "interface.h"
-#include "winlay.h"
-
-#define SEQ_LEFTHANDLE 1
-#define SEQ_RIGHTHANDLE 2
-
-#define SEQ_STRIP_OFSBOTTOM 0.2
-#define SEQ_STRIP_OFSTOP 0.8
-
-int no_rightbox=0, no_leftbox= 0;
-static void draw_seq_handle(Sequence *seq, SpaceSeq *sseq, float pixelx, short direction);
-static void draw_seq_extensions(Sequence *seq, SpaceSeq *sseq);
-static void draw_seq_text(Sequence *seq, float x1, float x2, float y1, float y2);
-static void draw_shadedstrip(Sequence *seq, char *col, float x1, float y1, float x2, float y2);
-static void draw_seq_strip(struct Sequence *seq, struct ScrArea *sa, struct SpaceSeq *sseq, int outline_tint, float pixelx);
-
-static char *give_seqname(Sequence *seq)
-{
- if(seq->type==SEQ_META) return "Meta";
- else if(seq->type==SEQ_IMAGE) return "Image";
- else if(seq->type==SEQ_SCENE) return "Scene";
- else if(seq->type==SEQ_MOVIE) return "Movie";
- else if(seq->type==SEQ_RAM_SOUND) return "Audio (RAM)";
- else if(seq->type==SEQ_HD_SOUND) return "Audio (HD)";
- else if(seq->type<SEQ_EFFECT) return seq->strip->dir;
- else if(seq->type==SEQ_CROSS) return "Cross";
- else if(seq->type==SEQ_GAMCROSS) return "Gamma Cross";
- else if(seq->type==SEQ_ADD) return "Add";
- else if(seq->type==SEQ_SUB) return "Sub";
- else if(seq->type==SEQ_MUL) return "Mul";
- else if(seq->type==SEQ_ALPHAOVER) return "Alpha Over";
- else if(seq->type==SEQ_ALPHAUNDER) return "Alpha Under";
- else if(seq->type==SEQ_OVERDROP) return "Over Drop";
- else if(seq->type==SEQ_WIPE) return "Wipe";
- else if(seq->type==SEQ_GLOW) return "Glow";
- else if(seq->type==SEQ_TRANSFORM) return "Transform";
- else if(seq->type==SEQ_COLOR) return "Color";
- else if(seq->type==SEQ_SPEED) return "Speed";
- else if(seq->type==SEQ_PLUGIN) {
- if(!(seq->flag & SEQ_EFFECT_NOT_LOADED) &&
- seq->plugin && seq->plugin->doit) return seq->plugin->pname;
- return "Plugin";
- }
- else return "Effect";
-
-}
-static void draw_cfra_seq(void)
-{
- glColor3ub(0x30, 0x90, 0x50);
- glLineWidth(2.0);
- glBegin(GL_LINES);
- glVertex2f(G.scene->r.cfra, G.v2d->cur.ymin);
- glVertex2f(G.scene->r.cfra, G.v2d->cur.ymax);
- glEnd();
- glLineWidth(1.0);
-}
-
-static void get_seq_color3ubv(Sequence *seq, char *col)
-{
- char blendcol[3];
- float hsv[3], rgb[3];
- SolidColorVars *colvars = (SolidColorVars *)seq->effectdata;
-
- switch(seq->type) {
- case SEQ_IMAGE:
- BIF_GetThemeColor3ubv(TH_SEQ_IMAGE, col);
- break;
- case SEQ_META:
- BIF_GetThemeColor3ubv(TH_SEQ_META, col);
- break;
- case SEQ_MOVIE:
- BIF_GetThemeColor3ubv(TH_SEQ_MOVIE, col);
- break;
- case SEQ_SCENE:
- BIF_GetThemeColor3ubv(TH_SEQ_SCENE, col);
-
- if(seq->scene==G.scene) {
- BIF_GetColorPtrBlendShade3ubv(col, col, col, 1.0, 20);
- }
- break;
-
- /* transitions */
- case SEQ_CROSS:
- case SEQ_GAMCROSS:
- case SEQ_WIPE:
- /* slightly offset hue to distinguish different effects */
- BIF_GetThemeColor3ubv(TH_SEQ_TRANSITION, col);
-
- rgb[0] = col[0]/255.0; rgb[1] = col[1]/255.0; rgb[2] = col[2]/255.0;
- rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
-
- if (seq->type == SEQ_CROSS) hsv[0]+= 0.04;
- if (seq->type == SEQ_GAMCROSS) hsv[0]+= 0.08;
- if (seq->type == SEQ_WIPE) hsv[0]+= 0.12;
-
- if(hsv[0]>1.0) hsv[0]-=1.0; else if(hsv[0]<0.0) hsv[0]+= 1.0;
- hsv_to_rgb(hsv[0], hsv[1], hsv[2], rgb, rgb+1, rgb+2);
- col[0] = (char)(rgb[0]*255); col[1] = (char)(rgb[1]*255); col[2] = (char)(rgb[2]*255);
- break;
-
- /* effects */
- case SEQ_TRANSFORM:
- case SEQ_SPEED:
- case SEQ_ADD:
- case SEQ_SUB:
- case SEQ_MUL:
- case SEQ_ALPHAOVER:
- case SEQ_ALPHAUNDER:
- case SEQ_OVERDROP:
- case SEQ_GLOW:
- /* slightly offset hue to distinguish different effects */
- BIF_GetThemeColor3ubv(TH_SEQ_EFFECT, col);
-
- rgb[0] = col[0]/255.0; rgb[1] = col[1]/255.0; rgb[2] = col[2]/255.0;
- rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
-
- if (seq->type == SEQ_ADD) hsv[0]+= 0.04;
- if (seq->type == SEQ_SUB) hsv[0]+= 0.08;
- if (seq->type == SEQ_MUL) hsv[0]+= 0.12;
- if (seq->type == SEQ_ALPHAOVER) hsv[0]+= 0.16;
- if (seq->type == SEQ_ALPHAUNDER) hsv[0]+= 0.20;
- if (seq->type == SEQ_OVERDROP) hsv[0]+= 0.24;
- if (seq->type == SEQ_GLOW) hsv[0]+= 0.28;
- if (seq->type == SEQ_TRANSFORM) hsv[0]+= 0.36;
-
- if(hsv[0]>1.0) hsv[0]-=1.0; else if(hsv[0]<0.0) hsv[0]+= 1.0;
- hsv_to_rgb(hsv[0], hsv[1], hsv[2], rgb, rgb+1, rgb+2);
- col[0] = (char)(rgb[0]*255); col[1] = (char)(rgb[1]*255); col[2] = (char)(rgb[2]*255);
- break;
- case SEQ_COLOR:
- if (colvars->col) {
- col[0]= (char)(colvars->col[0]*255);
- col[1]= (char)(colvars->col[1]*255);
- col[2]= (char)(colvars->col[2]*255);
- } else {
- col[0] = col[1] = col[2] = 128;
- }
- break;
- case SEQ_PLUGIN:
- BIF_GetThemeColor3ubv(TH_SEQ_PLUGIN, col);
- break;
- case SEQ_HD_SOUND:
- case SEQ_RAM_SOUND:
- BIF_GetThemeColor3ubv(TH_SEQ_AUDIO, col);
- blendcol[0] = blendcol[1] = blendcol[2] = 128;
- if(seq->flag & SEQ_MUTE) BIF_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.5, 20);
- break;
- default:
- col[0] = 10; col[1] = 255; col[2] = 40;
- }
-}
-
-static void drawmeta_contents(Sequence *seqm, float x1, float y1, float x2, float y2)
-{
- Sequence *seq;
- float dx;
- int nr;
- char col[3];
-
- nr= 0;
- WHILE_SEQ(&seqm->seqbase) {
- nr++;
- }
- END_SEQ
-
- dx= (x2-x1)/nr;
-
- WHILE_SEQ(&seqm->seqbase) {
- get_seq_color3ubv(seq, col);
-
- glColor3ubv((GLubyte *)col);
-
- glRectf(x1, y1, x1+0.9*dx, y2);
-
- BIF_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -30);
- glColor3ubv((GLubyte *)col);
-
- fdrawbox(x1, y1, x1+0.9*dx, y2);
-
- x1+= dx;
- }
- END_SEQ
-}
-
-static void drawseqwave(Sequence *seq, float x1, float y1, float x2, float y2, int winx)
-{
- /*
- x1 is the starting x value to draw the wave,
- x2 the end x value, same for y1 and y2
- winx is the zoom level.
- */
-
- float
- f, /* floating point value used to store the X draw location for the wave lines when openGL drawing*/
- midy, /* fast access to the middle location (y1+y2)/2 */
- clipxmin, /* the minimum X value, clip this with the window */
- clipxmax, /* the maximum X value, clip this with the window */
- sample_step, /* steps to move per sample, floating value must later translate into an int */
- fsofs, /* steps to move per sample, floating value must later translate into an int */
- feofs_sofs, /* */
- sound_width, /* convenience: x2-x1 */
- wavemulti; /* scale the samples by this value when GL_LINE drawing so it renders the right height */
-
- int
- offset, /* initial offset value for the wave drawing */
- offset_next, /* when in the wave drawing loop this value is the samples intil the next vert */
- sofs, /* Constrained offset value (~3) for the wave, start */
- eofs, /* ditto, end */
- wavesample, /* inner loop storage if the current wave sample value, used to make the 2 values below */
- wavesamplemin, /* used for finding the min and max wave peaks */
- wavesamplemax, /* ditto */
- subsample_step=4; /* when the sample step is 4 every sample of
- the wave is evaluated for min and max values used to draw the wave,
- however this is slow ehrn zoomed out so when the sample step is above
- 1 (the larger the further out the zoom is) so not evaluate all samples, only some. */
-
- signed short* s;
- bSound *sound;
- Uint8 *stream;
-
- audio_makestream(seq->sound);
- if(seq->sound==NULL || seq->sound->stream==NULL) return;
-
- if (seq->flag & SEQ_MUTE) glColor3ub(0x70, 0x80, 0x80); else glColor3ub(0x70, 0xc0, 0xc0);
-
- sofs = ((int)( FRA2TIME(seq->startdisp-seq->start)*(float)G.scene->audio.mixrate*4.0 )) & (~3);
- eofs = ((int)( FRA2TIME(seq->enddisp-seq->start)*(float)G.scene->audio.mixrate*4.0 )) & (~3);
-
- /* clip the drawing area to the screen bounds to save time */
- sample_step= (G.v2d->cur.xmax - G.v2d->cur.xmin)/winx;
- clipxmin= MAX2(x1, G.v2d->cur.xmin);
- clipxmax= MIN2(x2, G.v2d->cur.xmax);
-
- if (sample_step > 1)
- subsample_step= ((int)(subsample_step*sample_step*8)) & (~3);
-
- /* for speedy access */
- midy = (y1+y2)/2;
- fsofs= (float)sofs;
- feofs_sofs= (float)(eofs-sofs);
- sound_width= x2-x1;
- sound = seq->sound;
- stream = sound->stream;
- wavemulti = (y2-y1)/196605; /*y2-y1 is the height*/
- wavesample=0;
-
- /* we need to get the starting offset value, excuse the duplicate code */
- f=clipxmin;
- offset= (int) (fsofs + ((f-x1)/sound_width) * feofs_sofs) & (~3);
-
- /* start the loop, draw a line per sample_step -sample_step is about 1 line drawn per pixel */
- glBegin(GL_LINES);
- for (f=x1+sample_step; f<=clipxmax; f+=sample_step) {
-
- offset_next = (int) (fsofs + ((f-x1)/sound_width) * feofs_sofs) & (~3);
- if (f > G.v2d->cur.xmin) {
- /* if this is close to the last sample just exit */
- if (offset_next >= sound->streamlen) break;
-
- wavesamplemin = 131070;
- wavesamplemax = -131070;
-
- /*find with high and low of the waveform for this draw,
- evaluate small samples to find this range */
- while (offset < offset_next) {
- s = (signed short*)(stream+offset);
-
- wavesample = s[0]*2 + s[1];
- if (wavesamplemin>wavesample)
- wavesamplemin=wavesample;
- if (wavesamplemax<wavesample)
- wavesamplemax=wavesample;
- offset+=subsample_step;
- }
- /* draw the wave line, looks good up close and zoomed out */
- glVertex2f(f, midy-(wavemulti*wavesamplemin) );
- glVertex2f(f, midy-(wavemulti*wavesamplemax) );
- } else {
- while (offset < offset_next) offset+=subsample_step;
- }
-
- offset=offset_next;
- }
- glEnd();
-}
-
-/* draw a handle, for each end of a sequence strip */
-static void draw_seq_handle(Sequence *seq, SpaceSeq *sseq, float pixelx, short direction)
-{
- float v1[2], v2[2], v3[2], rx1=0, rx2=0; //for triangles and rect
- float x1, x2, y1, y2;
- float handsize;
- float minhandle, maxhandle;
- char str[120];
- unsigned int whichsel=0;
- View2D *v2d;
-
- x1= seq->startdisp;
- x2= seq->enddisp;
-
- y1= seq->machine+SEQ_STRIP_OFSBOTTOM;
- y2= seq->machine+SEQ_STRIP_OFSTOP;
-
- v2d = &sseq->v2d;
-
- /* clamp handles to defined size in pixel space */
- handsize = seq->handsize;
- minhandle = 7;
- maxhandle = 40;
- CLAMP(handsize, minhandle*pixelx, maxhandle*pixelx);
-
- /* set up co-ordinates/dimensions for either left or right handle */
- if (direction == SEQ_LEFTHANDLE) {
- rx1 = x1;
- rx2 = x1+handsize*0.75;
-
- v1[0]= x1+handsize/4; v1[1]= y1+( ((y1+y2)/2.0 - y1)/2);
- v2[0]= x1+handsize/4; v2[1]= y2-( ((y1+y2)/2.0 - y1)/2);
- v3[0]= v2[0] + handsize/4; v3[1]= (y1+y2)/2.0;
-
- whichsel = SEQ_LEFTSEL;
- } else if (direction == SEQ_RIGHTHANDLE) {
- rx1 = x2-handsize*0.75;
- rx2 = x2;
-
- v1[0]= x2-handsize/4; v1[1]= y1+( ((y1+y2)/2.0 - y1)/2);
- v2[0]= x2-handsize/4; v2[1]= y2-( ((y1+y2)/2.0 - y1)/2);
- v3[0]= v2[0] - handsize/4; v3[1]= (y1+y2)/2.0;
-
- whichsel = SEQ_RIGHTSEL;
- }
-
- /* draw! */
- if(seq->type < SEQ_EFFECT ||
- get_sequence_effect_num_inputs(seq->type) == 0) {
- glEnable( GL_BLEND );
-
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
- if(seq->flag & whichsel) glColor4ub(0, 0, 0, 80);
- else if (seq->flag & SELECT) glColor4ub(255, 255, 255, 30);
- else glColor4ub(0, 0, 0, 22);
-
- glRectf(rx1, y1, rx2, y2);
-
- if(seq->flag & whichsel) glColor4ub(255, 255, 255, 200);
- else glColor4ub(0, 0, 0, 50);
-
- glEnable( GL_POLYGON_SMOOTH );
- glBegin(GL_TRIANGLES);
- glVertex2fv(v1); glVertex2fv(v2); glVertex2fv(v3);
- glEnd();
-
- glDisable( GL_POLYGON_SMOOTH );
- glDisable( GL_BLEND );
- }
-
- if(G.moving || (seq->flag & whichsel)) {
- cpack(0xFFFFFF);
- if (direction == SEQ_LEFTHANDLE) {
- sprintf(str, "%d", seq->startdisp);
- glRasterPos3f(rx1, y1-0.15, 0.0);
- } else {
- sprintf(str, "%d", seq->enddisp - 1);
- glRasterPos3f((x2-BMF_GetStringWidth(G.font, str)*pixelx), y2+0.05, 0.0);
- }
- BMF_DrawString(G.font, str);
- }
-}
-
-static void draw_seq_extensions(Sequence *seq, SpaceSeq *sseq)
-{
- float x1, x2, y1, y2, pixely, a;
- char col[3], blendcol[3];
- View2D *v2d;
-
- if(seq->type >= SEQ_EFFECT) return;
-
- x1= seq->startdisp;
- x2= seq->enddisp;
-
- y1= seq->machine+SEQ_STRIP_OFSBOTTOM;
- y2= seq->machine+SEQ_STRIP_OFSTOP;
-
- v2d = &sseq->v2d;
- pixely = (v2d->cur.ymax - v2d->cur.ymin)/(v2d->mask.ymax - v2d->mask.ymin);
-
- blendcol[0] = blendcol[1] = blendcol[2] = 120;
-
- if(seq->startofs) {
- glEnable( GL_BLEND );
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
- get_seq_color3ubv(seq, col);
-
- if (seq->flag & SELECT) {
- BIF_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.3, -40);
- glColor4ub(col[0], col[1], col[2], 170);
- } else {
- BIF_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.6, 0);
- glColor4ub(col[0], col[1], col[2], 110);
- }
-
- glRectf((float)(seq->start), y1-SEQ_STRIP_OFSBOTTOM, x1, y1);
-
- if (seq->flag & SELECT) glColor4ub(col[0], col[1], col[2], 255);
- else glColor4ub(col[0], col[1], col[2], 160);
-
- fdrawbox((float)(seq->start), y1-SEQ_STRIP_OFSBOTTOM, x1, y1); //outline
-
- glDisable( GL_BLEND );
- }
- if(seq->endofs) {
- glEnable( GL_BLEND );
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
- get_seq_color3ubv(seq, col);
-
- if (seq->flag & SELECT) {
- BIF_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.3, -40);
- glColor4ub(col[0], col[1], col[2], 170);
- } else {
- BIF_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.6, 0);
- glColor4ub(col[0], col[1], col[2], 110);
- }
-
- glRectf(x2, y2, (float)(seq->start+seq->len), y2+SEQ_STRIP_OFSBOTTOM);
-
- if (seq->flag & SELECT) glColor4ub(col[0], col[1], col[2], 255);
- else glColor4ub(col[0], col[1], col[2], 160);
-
- fdrawbox(x2, y2, (float)(seq->start+seq->len), y2+SEQ_STRIP_OFSBOTTOM); //outline
-
- glDisable( GL_BLEND );
- }
- if(seq->startstill) {
- get_seq_color3ubv(seq, col);
- BIF_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.75, 40);
- glColor3ubv((GLubyte *)col);
-
- draw_shadedstrip(seq, col, x1, y1, (float)(seq->start), y2);
-
- /* feint pinstripes, helps see exactly which is extended and which isn't,
- * especially when the extension is very small */
- if (seq->flag & SELECT) BIF_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 24);
- else BIF_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -16);
-
- glColor3ubv((GLubyte *)col);
-
- for(a=y1; a< y2; a+= pixely*2.0 ) {
- fdrawline(x1, a, (float)(seq->start), a);
- }
- }
- if(seq->endstill) {
- get_seq_color3ubv(seq, col);
- BIF_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.75, 40);
- glColor3ubv((GLubyte *)col);
-
- draw_shadedstrip(seq, col, (float)(seq->start+seq->len), y1, x2, y2);
-
- /* feint pinstripes, helps see exactly which is extended and which isn't,
- * especially when the extension is very small */
- if (seq->flag & SELECT) BIF_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 24);
- else BIF_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -16);
-
- glColor3ubv((GLubyte *)col);
-
- for(a=y1; a< y2; a+= pixely*2.0 ) {
- fdrawline((float)(seq->start+seq->len), a, x2, a);
- }
- }
-}
-
-/* draw info text on a sequence strip */
-static void draw_seq_text(Sequence *seq, float x1, float x2, float y1, float y2)
-{
- float v1[2], v2[2];
- int len, size;
- char str[32 + FILE_MAXDIR+FILE_MAXFILE], *strp;
- short mval[2];
-
- v1[1]= y1;
- v2[1]= y2;
-
- v1[0]= x1;
- ipoco_to_areaco_noclip(G.v2d, v1, mval);
- x1= mval[0];
- v2[0]= x2;
- ipoco_to_areaco_noclip(G.v2d, v2, mval);
- x2= mval[0];
- size= x2-x1;
-
- if(seq->name[2]) {
- sprintf(str, "%d | %s: %s", seq->len, give_seqname(seq), seq->name+2);
- }else{
- if(seq->type == SEQ_META) {
- sprintf(str, "%d | %s", seq->len, give_seqname(seq));
- }
- else if(seq->type == SEQ_SCENE) {
- if(seq->scene) sprintf(str, "%d | %s: %s", seq->len, give_seqname(seq), seq->scene->id.name+2);
- else sprintf(str, "%d | %s", seq->len, give_seqname(seq));
-
- }
- else if(seq->type == SEQ_IMAGE) {
- sprintf(str, "%d | %s%s", seq->len, seq->strip->dir, seq->strip->stripdata->name);
- }
- else if(seq->type & SEQ_EFFECT) {
- int can_float = (seq->type != SEQ_PLUGIN)
- || (seq->plugin && seq->plugin->version >= 4);
-
- if(seq->seq3!=seq->seq2 && seq->seq1!=seq->seq3)
- sprintf(str, "%d | %s: %d>%d (use %d)%s", seq->len, give_seqname(seq), seq->seq1->machine, seq->seq2->machine, seq->seq3->machine, can_float ? "" : " No float, upgrade plugin!");
- else if (seq->seq1 && seq->seq2)
- sprintf(str, "%d | %s: %d>%d%s", seq->len, give_seqname(seq), seq->seq1->machine, seq->seq2->machine, can_float ? "" : " No float, upgrade plugin!");
- else
- sprintf(str, "%d | %s", seq->len, give_seqname(seq));
- }
- else if (seq->type == SEQ_RAM_SOUND) {
- sprintf(str, "%d | %s", seq->len, seq->strip->stripdata->name);
- }
- else if (seq->type == SEQ_HD_SOUND) {
- sprintf(str, "%d | %s", seq->len, seq->strip->stripdata->name);
- }
- else if (seq->type == SEQ_MOVIE) {
- sprintf(str, "%d | %s%s", seq->len, seq->strip->dir, seq->strip->stripdata->name);
- }
- }
-
- strp= str;
-
- while( (len= BMF_GetStringWidth(G.font, strp)) > size) {
- if(len < 10) break;
- if(strp[1]==0) break;
- strp++;
- }
-
- mval[0]= (x1+x2-len+1)/2;
- mval[1]= 1;
- areamouseco_to_ipoco(G.v2d, mval, &x1, &x2);
-
- if(seq->flag & SELECT) cpack(0xFFFFFF);
- else cpack(0);
- glRasterPos3f(x1, y1+SEQ_STRIP_OFSBOTTOM, 0.0);
- BMF_DrawString(G.font, strp);
-}
-
-/* draws a shaded strip, made from gradient + flat color + gradient */
-static void draw_shadedstrip(Sequence *seq, char *col, float x1, float y1, float x2, float y2)
-{
- float ymid1, ymid2;
-
- ymid1 = (y2-y1)*0.25 + y1;
- ymid2 = (y2-y1)*0.65 + y1;
-
- glShadeModel(GL_SMOOTH);
- glBegin(GL_QUADS);
-
- if(seq->flag & SELECT) BIF_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -50);
- else BIF_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 0);
-
- glColor3ubv((GLubyte *)col);
-
- glVertex2f(x1,y1);
- glVertex2f(x2,y1);
-
- if(seq->flag & SELECT) BIF_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 5);
- else BIF_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -5);
-
- glColor3ubv((GLubyte *)col);
-
- glVertex2f(x2,ymid1);
- glVertex2f(x1,ymid1);
-
- glEnd();
-
- glRectf(x1, ymid1, x2, ymid2);
-
- glBegin(GL_QUADS);
-
- glVertex2f(x1,ymid2);
- glVertex2f(x2,ymid2);
-
- if(seq->flag & SELECT) BIF_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -15);
- else BIF_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 25);
-
- glColor3ubv((GLubyte *)col);
-
- glVertex2f(x2,y2);
- glVertex2f(x1,y2);
-
- glEnd();
-
-}
-
-/*
-Draw a sequence strip, bounds check alredy made
-ScrArea is currently only used to get the windows width in pixels
-so wave file sample drawing precission is zoom adjusted
-*/
-static void draw_seq_strip(Sequence *seq, ScrArea *sa, SpaceSeq *sseq, int outline_tint, float pixelx)
-{
- float x1, x2, y1, y2;
- char col[3], is_single_image;
-
- /* we need to know if this is a single image/color or not for drawing */
- is_single_image = (char)check_single_seq(seq);
-
- /* body */
- if(seq->startstill) x1= seq->start;
- else x1= seq->startdisp;
- y1= seq->machine+SEQ_STRIP_OFSBOTTOM;
- if(seq->endstill) x2= seq->start+seq->len;
- else x2= seq->enddisp;
- y2= seq->machine+SEQ_STRIP_OFSTOP;
-
-
- /* get the correct color per strip type*/
- get_seq_color3ubv(seq, col);
-
- /* draw the main strip body */
- if (is_single_image) /* single image */
- draw_shadedstrip(seq, col, seq_tx_get_final_left(seq), y1, seq_tx_get_final_right(seq), y2);
- else /* normal operation */
- draw_shadedstrip(seq, col, x1, y1, x2, y2);
-
- /* draw additional info and controls */
- if (seq->type == SEQ_RAM_SOUND)
- drawseqwave(seq, x1, y1, x2, y2, sa->winx);
-
- if (!is_single_image)
- draw_seq_extensions(seq, sseq);
-
- draw_seq_handle(seq, sseq, pixelx, SEQ_LEFTHANDLE);
- draw_seq_handle(seq, sseq, pixelx, SEQ_RIGHTHANDLE);
-
- /* draw the strip outline */
- x1= seq->startdisp;
- x2= seq->enddisp;
-
- get_seq_color3ubv(seq, col);
- if (G.moving && (seq->flag & SELECT)) {
- if(seq->flag & SEQ_OVERLAP) {
- col[0]= 255; col[1]= col[2]= 40;
- } else BIF_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 120);
- }
-
- BIF_GetColorPtrBlendShade3ubv(col, col, col, 0.0, outline_tint);
-
- glColor3ubv((GLubyte *)col);
- gl_round_box_shade(GL_LINE_LOOP, x1, y1, x2, y2, 0.0, 0.1, 0.0);
-
-
- /* calculate if seq is long enough to print a name */
- x1= seq->startdisp+seq->handsize;
- x2= seq->enddisp-seq->handsize;
-
- /* but first the contents of a meta */
- if(seq->type==SEQ_META) drawmeta_contents(seq, x1, y1+0.15, x2, y2-0.15);
-
- /* info text on the strip */
- if(x1<G.v2d->cur.xmin) x1= G.v2d->cur.xmin;
- else if(x1>G.v2d->cur.xmax) x1= G.v2d->cur.xmax;
- if(x2<G.v2d->cur.xmin) x2= G.v2d->cur.xmin;
- else if(x2>G.v2d->cur.xmax) x2= G.v2d->cur.xmax;
-
- /* nice text here would require changing the view matrix for texture text */
- if( (x2-x1) / pixelx > 32) {
- draw_seq_text(seq, x1, x2, y1, y2);
- }
-}
-
-static Sequence *special_seq_update= 0;
-
-void set_special_seq_update(int val)
-{
- int x;
-
- /* if mouse over a sequence && LEFTMOUSE */
- if(val) {
- special_seq_update= find_nearest_seq(&x);
- }
- else special_seq_update= 0;
-}
-
-
-static void draw_image_seq(ScrArea *sa)
-{
- SpaceSeq *sseq;
- struct ImBuf *ibuf;
- int x1, y1, rectx, recty;
- int free_ibuf = 0;
- static int recursive= 0;
- float zoom;
-
- glClearColor(0.0, 0.0, 0.0, 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- sseq= sa->spacedata.first;
- if(sseq==0) return;
-
- rectx= (G.scene->r.size*G.scene->r.xsch)/100;
- recty= (G.scene->r.size*G.scene->r.ysch)/100;
-
- /* BIG PROBLEM: the give_ibuf_seq() can call a rendering, which in turn calls redraws...
- this shouldn't belong in a window drawing....
- So: solve this once event based.
- Now we check for recursion, space type and active area again (ton) */
-
- if(recursive)
- return;
- else {
- recursive= 1;
- if (special_seq_update) {
- ibuf= give_ibuf_seq_direct(
- rectx, recty, (G.scene->r.cfra),
- special_seq_update);
- } else if (!U.prefetchframes || (G.f & G_PLAYANIM) == 0) {
- ibuf= (ImBuf *)give_ibuf_seq(
- rectx, recty, (G.scene->r.cfra),
- sseq->chanshown);
- } else {
- ibuf= (ImBuf *)give_ibuf_seq_threaded(
- rectx, recty, (G.scene->r.cfra),
- sseq->chanshown);
- }
- recursive= 0;
-
- /* HURMF! the give_ibuf_seq can call image display in this window */
- if(sa->spacetype!=SPACE_SEQ)
- return;
- if(sa!=curarea) {
- areawinset(sa->win);
- }
- }
-
- if(ibuf==NULL)
- return;
- if(ibuf->rect_float && ibuf->rect==NULL)
- IMB_rect_from_float(ibuf);
- if(ibuf->rect==NULL)
- return;
-
- if (sseq->mainb == SEQ_DRAW_IMG_WAVEFORM) {
- ibuf = make_waveform_view_from_ibuf(ibuf);
- free_ibuf = 1;
- } else if (sseq->mainb == SEQ_DRAW_IMG_VECTORSCOPE) {
- ibuf = make_vectorscope_view_from_ibuf(ibuf);
- free_ibuf = 1;
- }
-
- if (sseq->zoom > 0) {
- zoom = sseq->zoom;
- } else if (sseq->zoom == 0) {
- zoom = 1.0;
- } else {
- zoom = -1.0/sseq->zoom;
- }
-
- /* calc location */
- x1= (sa->winx-zoom*ibuf->x)/2 + sseq->xof;
- y1= (sa->winy-zoom*ibuf->y)/2 + sseq->yof;
-
- /* needed for gla draw */
- glaDefine2DArea(&curarea->winrct);
-
- glPixelZoom(zoom * ((float)G.scene->r.xasp / (float)G.scene->r.yasp), zoom);
-
- glaDrawPixelsSafe(x1, y1, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
-
- glPixelZoom(1.0, 1.0);
-
- if (free_ibuf) {
- IMB_freeImBuf(ibuf);
- }
-
- sa->win_swap= WIN_BACK_OK;
-}
-
-static void draw_extra_seqinfo(void)
-{
- Sequence *last_seq = get_last_seq();
- StripElem *se, *last;
- float xco, xfac, yco, yfac;
- int sta, end;
- char str[256];
-
- if(last_seq==0) return;
-
- /* xfac: size of 1 pixel */
- xfac= G.v2d->cur.xmax - G.v2d->cur.xmin;
- xfac/= (float)(G.v2d->mask.xmax-G.v2d->mask.xmin);
- xco= G.v2d->cur.xmin+10*xfac;
-
- yfac= G.v2d->cur.ymax - G.v2d->cur.ymin;
- yfac/= (float)(G.v2d->mask.ymax-G.v2d->mask.ymin);
- yco= G.v2d->cur.ymin+40*yfac;
-
- BIF_ThemeColor(TH_TEXT_HI);
-
- /* NAME */
- glRasterPos3f(xco, yco, 0.0);
- strncpy(str, give_seqname(last_seq), 255);
- BMF_DrawString(G.font, str);
- xco += xfac*BMF_GetStringWidth(G.font, str) +10.0*xfac;
-
- if(last_seq->type==SEQ_SCENE && last_seq->scene) {
- glRasterPos3f(xco, yco, 0.0);
- BMF_DrawString(G.font, last_seq->scene->id.name+2);
- xco += xfac*BMF_GetStringWidth(G.font, last_seq->scene->id.name+2) +30.0*xfac;
- }
-
- /* LEN, dont bother with single images */
- if (check_single_seq(last_seq)==0) {
- if(last_seq->type & SEQ_EFFECT)
- sprintf(str, "len: %d From %d - %d", last_seq->len, last_seq->startdisp, last_seq->enddisp-1);
- else
- sprintf(str, "len: %d (%d)", last_seq->enddisp-last_seq->startdisp, last_seq->len);
-
- glRasterPos3f(xco, yco, 0.0);
-
- BMF_DrawString(G.font, str);
- xco += xfac*BMF_GetStringWidth(G.font, str) +10.0*xfac;
- }
-
-
- if(last_seq->type==SEQ_IMAGE) {
- if (last_seq->len > 1) {
- /* CURRENT */
- se= give_stripelem(last_seq, (G.scene->r.cfra));
- if(se) {
- sprintf(str, "Cur: %s%s", last_seq->strip->dir, se->name);
- glRasterPos3f(xco, yco, 0.0);
- BMF_DrawString(G.font, str);
- xco += xfac*BMF_GetStringWidth(G.font, str) +10.0*xfac;
- }
-
- /* FIRST AND LAST */
-
- if(last_seq->strip) {
- se= last_seq->strip->stripdata;
- last= se+last_seq->len-1;
- if(last_seq->startofs) se+= last_seq->startofs;
- if(last_seq->endofs) last-= last_seq->endofs;
-
- sprintf(str, "First: %s at %d Last: %s at %d", se->name, last_seq->startdisp, last->name, last_seq->enddisp-1);
- glRasterPos3f(xco, yco, 0.0);
- BMF_DrawString(G.font, str);
- xco += xfac*BMF_GetStringWidth(G.font, str) +30.0*xfac;
- }
- } else { /* single image */
- if (last_seq->strip) {
- sprintf(str, "Single: %s%s len: %d", last_seq->strip->dir, last_seq->strip->stripdata->name, last_seq->enddisp-last_seq->startdisp);
- glRasterPos3f(xco, yco, 0.0);
- BMF_DrawString(G.font, str);
- xco += xfac*BMF_GetStringWidth(G.font, str) +30.0*xfac;
- }
- }
- /* orig size */
- if(last_seq->strip) {
- sprintf(str, "OrigSize: %d x %d", last_seq->strip->orx, last_seq->strip->ory);
- glRasterPos3f(xco, yco, 0.0);
- BMF_DrawString(G.font, str);
- xco += xfac*BMF_GetStringWidth(G.font, str) +30.0*xfac;
- }
- }
- else if(last_seq->type==SEQ_MOVIE) {
-
- sta= last_seq->startofs;
- end= last_seq->len-1-last_seq->endofs;
-
- sprintf(str, "%s %s%s First: %d at %d Last: %d at %d Cur: %d",
- last_seq->name+2, last_seq->strip->dir, last_seq->strip->stripdata->name,
- sta, last_seq->startdisp, end, last_seq->enddisp-1, (G.scene->r.cfra)-last_seq->startdisp);
-
- glRasterPos3f(xco, yco, 0.0);
- BMF_DrawString(G.font, str);
- }
- else if(last_seq->type==SEQ_SCENE) {
- TStripElem * se= give_tstripelem(last_seq, (G.scene->r.cfra));
- if(se && last_seq->scene) {
- sprintf(str, "Cur: %d First: %d Last: %d", last_seq->sfra+se->nr, last_seq->sfra, last_seq->sfra+last_seq->len-1);
- glRasterPos3f(xco, yco, 0.0);
- BMF_DrawString(G.font, str);
- }
- }
- else if(last_seq->type==SEQ_RAM_SOUND
- || last_seq->type == SEQ_HD_SOUND) {
-
- sta= last_seq->startofs;
- end= last_seq->len-1-last_seq->endofs;
-
- sprintf(str, "%s %s%s First: %d at %d Last: %d at %d Cur: %d Gain: %.2f dB Pan: %.2f",
- last_seq->name+2, last_seq->strip->dir, last_seq->strip->stripdata->name,
- sta, last_seq->startdisp, end, last_seq->enddisp-1, (G.scene->r.cfra)-last_seq->startdisp,
- last_seq->level, last_seq->pan);
-
- glRasterPos3f(xco, yco, 0.0);
- BMF_DrawString(G.font, str);
- }
- else if(last_seq->type == SEQ_SPEED) {
- SpeedControlVars * vars =
- (SpeedControlVars*) last_seq->effectdata;
-
- if (vars) {
- sprintf(str, "Last mapped frame: %d at %d",
- vars->lastValidFrame,
- vars->lastValidFrame
- + last_seq->startdisp);
-
- glRasterPos3f(xco, yco, 0.0);
- BMF_DrawString(G.font, str);
- }
- }
-}
-
-void seq_reset_imageofs(SpaceSeq *sseq)
-{
- sseq->xof = sseq->yof = sseq->zoom = 0;
-}
-
-void seq_viewmove(SpaceSeq *sseq)
-{
- ScrArea *sa;
- short mval[2], mvalo[2];
- short rectx, recty, xmin, xmax, ymin, ymax, pad;
- int oldcursor;
- Window *win;
-
- sa = sseq->area;
- rectx= (G.scene->r.size*G.scene->r.xsch)/100;
- recty= (G.scene->r.size*G.scene->r.ysch)/100;
-
- pad = 10;
- xmin = -(sa->winx/2) - rectx/2 + pad;
- xmax = sa->winx/2 + rectx/2 - pad;
- ymin = -(sa->winy/2) - recty/2 + pad;
- ymax = sa->winy/2 + recty/2 - pad;
-
- getmouseco_sc(mvalo);
-
- oldcursor=get_cursor();
- win=winlay_get_active_window();
-
- SetBlenderCursor(BC_NSEW_SCROLLCURSOR);
-
- while(get_mbut()&(L_MOUSE|M_MOUSE)) {
-
- getmouseco_sc(mval);
-
- if(mvalo[0]!=mval[0] || mvalo[1]!=mval[1]) {
-
- sseq->xof -= (mvalo[0]-mval[0]);
- sseq->yof -= (mvalo[1]-mval[1]);
-
- /* prevent dragging image outside of the window and losing it! */
- CLAMP(sseq->xof, xmin, xmax);
- CLAMP(sseq->yof, ymin, ymax);
-
- mvalo[0]= mval[0];
- mvalo[1]= mval[1];
-
- scrarea_do_windraw(curarea);
- screen_swapbuffers();
- }
- else BIF_wait_for_statechange();
- }
- window_set_cursor(win, oldcursor);
-}
-
-#define SEQ_BUT_PLUGIN 1
-#define SEQ_BUT_RELOAD 2
-#define SEQ_BUT_EFFECT 3
-#define SEQ_BUT_RELOAD_ALL 4
-
-void do_seqbuttons(short val)
-{
- Sequence *last_seq = get_last_seq();
-
- switch(val) {
- case SEQ_BUT_PLUGIN:
- case SEQ_BUT_EFFECT:
- update_changed_seq_and_deps(last_seq, 0, 1);
- break;
-
- case SEQ_BUT_RELOAD:
- case SEQ_BUT_RELOAD_ALL:
- update_seq_ipo_rect(last_seq);
- update_seq_icu_rects(last_seq);
-
- free_imbuf_seq(); // frees all
-
- break;
- }
-
- if (val == SEQ_BUT_RELOAD_ALL) {
- allqueue(REDRAWALL, 0);
- } else {
- allqueue(REDRAWSEQ, 0);
- }
-}
-
-static void seq_panel_properties(short cntrl) // SEQ_HANDLER_PROPERTIES
-{
- Sequence *last_seq = get_last_seq();
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "seq_panel_properties", UI_EMBOSS, UI_HELV, curarea->win);
- uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | cntrl);
- uiSetPanelHandler(SEQ_HANDLER_PROPERTIES); // for close and esc
- if(uiNewPanel(curarea, block, "Strip Properties", "Seq", 10, 230, 318, 204)==0) return;
-
- if(last_seq==NULL) return;
-
- if(last_seq->type==SEQ_PLUGIN) {
- PluginSeq *pis;
- VarStruct *varstr;
- int a, xco, yco;
-
- get_sequence_effect(last_seq);/* make sure, plugin is loaded */
-
- uiDefBut(block, LABEL, 0, "Type: Plugin", 10,50,70,20, 0, 0, 0, 0, 0, "");
-
- pis= last_seq->plugin;
- if(pis->vars==0) return;
-
- varstr= pis->varstr;
- if(varstr) {
- for(a=0; a<pis->vars; a++, varstr++) {
- xco= 150*(a/6)+10;
- yco= 125 - 20*(a % 6)+1;
- uiDefBut(block, varstr->type, SEQ_BUT_PLUGIN, varstr->name, xco,yco,150,19, &(pis->data[a]), varstr->min, varstr->max, 100, 0, varstr->tip);
-
- }
- }
- uiDefButBitS(block, TOG, SEQ_IPO_FRAME_LOCKED,
- SEQ_BUT_RELOAD_ALL, "IPO Frame locked",
- 10,-40,150,19, &last_seq->flag,
- 0.0, 1.0, 0, 0,
- "Lock the IPO coordinates to the "
- "global frame counter.");
-
- }
- else if(last_seq->type==SEQ_IMAGE) {
-
- uiDefBut(block, LABEL, 0, "Type: Image", 10,160,150,20, 0, 0, 0, 0, 0, "");
- uiDefBut(block, TEX, B_NOP, "Name: ", 10,140,150,19, last_seq->name+2, 0.0, 21.0, 100, 0, "");
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, SEQ_MAKE_PREMUL, SEQ_BUT_RELOAD, "Convert to Premul", 10,110,150,19, &last_seq->flag, 0.0, 21.0, 100, 0, "Converts RGB values to become premultiplied with Alpha");
- uiDefButBitS(block, TOG, SEQ_FILTERY, SEQ_BUT_RELOAD, "FilterY", 10,90,150,19, &last_seq->flag, 0.0, 21.0, 100, 0, "For video movies to remove fields");
-
- uiDefButBitS(block, TOG, SEQ_FLIPX, SEQ_BUT_RELOAD, "FlipX", 10,70,75,19, &last_seq->flag, 0.0, 21.0, 100, 0, "Flip on the X axis");
- uiDefButBitS(block, TOG, SEQ_FLIPY, SEQ_BUT_RELOAD, "FlipY", 85,70,75,19, &last_seq->flag, 0.0, 21.0, 100, 0, "Flip on the Y axis");
-
- uiDefButF(block, NUM, SEQ_BUT_RELOAD, "Mul:", 10,50,150,19, &last_seq->mul, 0.001, 5.0, 100, 0, "Multiply colors");
- uiDefButS(block, TOG|BIT|7, SEQ_BUT_RELOAD, "Reverse Frames", 10,30,150,19, &last_seq->flag, 0.0, 21.0, 100, 0, "Reverse frame order");
- uiDefButF(block, NUM, SEQ_BUT_RELOAD, "Strobe:", 10,10,150,19, &last_seq->strobe, 1.0, 30.0, 100, 0, "Only display every nth frame");
- uiBlockEndAlign(block);
- }
- else if(last_seq->type==SEQ_META) {
-
- uiDefBut(block, LABEL, 0, "Type: Meta", 10,140,150,20, 0, 0, 0, 0, 0, "");
- uiDefBut(block, TEX, B_NOP, "Name: ", 10,120,150,19, last_seq->name+2, 0.0, 21.0, 100, 0, "");
-
- }
- else if(last_seq->type==SEQ_SCENE) {
-
- uiDefBut(block, LABEL, 0, "Type: Scene", 10,140,150,20, 0, 0, 0, 0, 0, "");
- uiDefBut(block, TEX, B_NOP, "Name: ", 10,120,150,19, last_seq->name+2, 0.0, 21.0, 100, 0, "");
- uiDefButS(block, TOG|BIT|7, SEQ_BUT_RELOAD, "Reverse Frames", 10,90,150,19, &last_seq->flag, 0.0, 21.0, 100, 0, "Reverse frame order");
- }
- else if(last_seq->type==SEQ_MOVIE) {
-
- if(last_seq->mul==0.0) last_seq->mul= 1.0;
-
- uiDefBut(block, LABEL, 0, "Type: Movie", 10,140,150,20, 0, 0, 0, 0, 0, "");
- uiDefBut(block, TEX, B_NOP, "Name: ", 10,120,150,19, last_seq->name+2, 0.0, 21.0, 100, 0, "");
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, SEQ_MAKE_PREMUL, SEQ_BUT_RELOAD, "Make Premul Alpha ", 10,90,150,19, &last_seq->flag, 0.0, 21.0, 100, 0, "Converts RGB values to become premultiplied with Alpha");
- uiDefButBitS(block, TOG, SEQ_FILTERY, SEQ_BUT_RELOAD, "FilterY ", 10,70,150,19, &last_seq->flag, 0.0, 21.0, 100, 0, "For video movies to remove fields");
- uiDefButF(block, NUM, SEQ_BUT_RELOAD, "Mul:", 10,50,150,19, &last_seq->mul, 0.001, 5.0, 100, 0, "Multiply colors");
-
- uiDefButS(block, TOG|BIT|7, SEQ_BUT_RELOAD, "Reverse Frames", 10,30,150,19, &last_seq->flag, 0.0, 21.0, 100, 0, "Reverse frame order");
- uiDefButF(block, NUM, SEQ_BUT_RELOAD, "Strobe:", 10,10,150,19, &last_seq->strobe, 1.0, 30.0, 100, 0, "Only display every nth frame");
- uiDefButI(block, NUM, SEQ_BUT_RELOAD, "Preseek:", 10,-10,150,19, &last_seq->anim_preseek, 0.0, 50.0, 100, 0, "On MPEG-seeking preseek this many frames");
- uiBlockEndAlign(block);
- }
- else if(last_seq->type==SEQ_RAM_SOUND ||
- last_seq->type==SEQ_HD_SOUND) {
-
- uiDefBut(block, LABEL, 0, "Type: Audio", 10,140,150,20, 0, 0, 0, 0, 0, "");
- uiDefBut(block, TEX, 0, "Name: ", 10,120,150,19, last_seq->name+2, 0.0, 21.0, 100, 0, "");
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, SEQ_IPO_FRAME_LOCKED,
- SEQ_BUT_RELOAD_ALL, "IPO Frame locked",
- 10,90,150,19, &last_seq->flag,
- 0.0, 1.0, 0, 0,
- "Lock the IPO coordinates to the "
- "global frame counter.");
-
- uiDefButBitS(block, TOG, SEQ_MUTE, B_NOP, "Mute", 10,70,120,19, &last_seq->flag, 0.0, 21.0, 100, 0, "");
- uiDefButF(block, NUM, SEQ_BUT_RELOAD, "Gain (dB):", 10,50,150,19, &last_seq->level, -96.0, 6.0, 100, 0, "");
- uiDefButF(block, NUM, SEQ_BUT_RELOAD, "Pan:", 10,30,150,19, &last_seq->pan, -1.0, 1.0, 100, 0, "");
- uiBlockEndAlign(block);
- }
- else if(last_seq->type>=SEQ_EFFECT) {
- uiDefBut(block, LABEL, 0, "Type: Effect", 10,140,150,20, 0, 0, 0, 0, 0, "");
- uiDefBut(block, TEX, B_NOP, "Name: ", 10,120,150,19, last_seq->name+2, 0.0, 21.0, 100, 0, "");
-
- uiDefButBitS(block, TOG, SEQ_IPO_FRAME_LOCKED,
- SEQ_BUT_RELOAD_ALL, "IPO Frame locked",
- 10,90,150,19, &last_seq->flag,
- 0.0, 1.0, 0, 0,
- "Lock the IPO coordinates to the "
- "global frame counter.");
-
- uiBlockBeginAlign(block);
- if(last_seq->type==SEQ_WIPE){
- WipeVars *wipe = (WipeVars *)last_seq->effectdata;
- char formatstring[256];
-
- strncpy(formatstring, "Transition Type %t|Single Wipe%x0|Double Wipe %x1|Iris Wipe %x4|Clock Wipe %x5", 255);
- uiDefButS(block, MENU,SEQ_BUT_EFFECT, formatstring, 10,65,220,22, &wipe->wipetype, 0, 0, 0, 0, "What type of wipe should be performed");
- uiDefButF(block, NUM,SEQ_BUT_EFFECT,"Blur:", 10,40,220,22, &wipe->edgeWidth,0.0,1.0, 1, 2, "The percent width of the blur edge");
- switch(wipe->wipetype){ /*Skip Types that do not require angle*/
- case DO_IRIS_WIPE:
- case DO_CLOCK_WIPE:
- break;
-
- default:
- uiDefButF(block, NUM,SEQ_BUT_EFFECT,"Angle:", 10,15,220,22, &wipe->angle,-90.0,90.0, 1, 2, "The Angle of the Edge");
- }
- uiDefButS(block, TOG,SEQ_BUT_EFFECT,"Wipe In", 10,-10,220,22, &wipe->forward,0,0, 0, 0, "Controls Primary Direction of Wipe");
- }
- else if(last_seq->type==SEQ_GLOW){
- GlowVars *glow = (GlowVars *)last_seq->effectdata;
-
- uiDefButF(block, NUM, SEQ_BUT_EFFECT, "Threshold:", 10,70,150,19, &glow->fMini, 0.0, 1.0, 0, 0, "Trigger Intensity");
- uiDefButF(block, NUM, SEQ_BUT_EFFECT, "Clamp:", 10,50,150,19, &glow->fClamp, 0.0, 1.0, 0, 0, "Brightness limit of intensity");
- uiDefButF(block, NUM, SEQ_BUT_EFFECT, "Boost factor:", 10,30,150,19, &glow->fBoost, 0.0, 10.0, 0, 0, "Brightness multiplier");
- uiDefButF(block, NUM, SEQ_BUT_EFFECT, "Blur distance:", 10,10,150,19, &glow->dDist, 0.5, 20.0, 0, 0, "Radius of glow effect");
- uiDefButI(block, NUM, B_NOP, "Quality:", 10,-5,150,19, &glow->dQuality, 1.0, 5.0, 0, 0, "Accuracy of the blur effect");
- uiDefButI(block, TOG, B_NOP, "Only boost", 10,-25,150,19, &glow->bNoComp, 0.0, 0.0, 0, 0, "Show the glow buffer only");
- }
- else if(last_seq->type==SEQ_TRANSFORM){
- TransformVars *transform = (TransformVars *)last_seq->effectdata;
-
- uiDefButF(block, NUM, SEQ_BUT_EFFECT, "xScale Start:", 10,70,150,19, &transform->ScalexIni, 0.0, 10.0, 0, 0, "X Scale Start");
- uiDefButF(block, NUM, SEQ_BUT_EFFECT, "xScale End:", 160,70,150,19, &transform->ScalexFin, 0.0, 10.0, 0, 0, "X Scale End");
- uiDefButF(block, NUM, SEQ_BUT_EFFECT, "yScale Start:", 10,50,150,19, &transform->ScaleyIni, 0.0, 10.0, 0, 0, "Y Scale Start");
- uiDefButF(block, NUM, SEQ_BUT_EFFECT, "yScale End:", 160,50,150,19, &transform->ScaleyFin, 0.0, 10.0, 0, 0, "Y Scale End");
-
- uiDefButI(block, ROW, SEQ_BUT_EFFECT, "Percent", 10, 30, 150, 19, &transform->percent, 0.0, 1.0, 0.0, 0.0, "Percent Translate");
- uiDefButI(block, ROW, SEQ_BUT_EFFECT, "Pixels", 160, 30, 150, 19, &transform->percent, 0.0, 0.0, 0.0, 0.0, "Pixels Translate");
- if(transform->percent==1){
- uiDefButF(block, NUM, SEQ_BUT_EFFECT, "x Start:", 10,10,150,19, &transform->xIni, -500.0, 500.0, 0, 0, "X Position Start");
- uiDefButF(block, NUM, SEQ_BUT_EFFECT, "x End:", 160,10,150,19, &transform->xFin, -500.0, 500.0, 0, 0, "X Position End");
- uiDefButF(block, NUM, SEQ_BUT_EFFECT, "y Start:", 10,-10,150,19, &transform->yIni, -500.0, 500.0, 0, 0, "Y Position Start");
- uiDefButF(block, NUM, SEQ_BUT_EFFECT, "y End:", 160,-10,150,19, &transform->yFin, -500.0, 500.0, 0, 0, "Y Position End");
- }else{
- uiDefButF(block, NUM, SEQ_BUT_EFFECT, "x Start:", 10,10,150,19, &transform->xIni, -10000.0, 10000.0, 0, 0, "X Position Start");
- uiDefButF(block, NUM, SEQ_BUT_EFFECT, "x End:", 160,10,150,19, &transform->xFin, -10000.0, 10000.0, 0, 0, "X Position End");
- uiDefButF(block, NUM, SEQ_BUT_EFFECT, "y Start:", 10,-10,150,19, &transform->yIni, -10000.0, 10000.0, 0, 0, "Y Position Start");
- uiDefButF(block, NUM, SEQ_BUT_EFFECT, "y End:", 160,-10,150,19, &transform->yFin, -10000.0, 10000.0, 0, 0, "Y Position End");
-
- }
-
-
-
- uiDefButF(block, NUM, SEQ_BUT_EFFECT, "rot Start:",10,-30,150,19, &transform->rotIni, 0.0, 360.0, 0, 0, "Rotation Start");
- uiDefButF(block, NUM, SEQ_BUT_EFFECT, "rot End:",160,-30,150,19, &transform->rotFin, 0.0, 360.0, 0, 0, "Rotation End");
-
- uiDefButI(block, ROW, SEQ_BUT_EFFECT, "No Interpolat", 10, -50, 100, 19, &transform->interpolation, 0.0, 0.0, 0.0, 0.0, "No interpolation");
- uiDefButI(block, ROW, SEQ_BUT_EFFECT, "Bilinear", 101, -50, 100, 19, &transform->interpolation, 0.0, 1.0, 0.0, 0.0, "Bilinear interpolation");
- uiDefButI(block, ROW, SEQ_BUT_EFFECT, "Bicubic", 202, -50, 100, 19, &transform->interpolation, 0.0, 2.0, 0.0, 0.0, "Bicubic interpolation");
- } else if(last_seq->type==SEQ_COLOR) {
- SolidColorVars *colvars = (SolidColorVars *)last_seq->effectdata;
- uiDefButF(block, COL, SEQ_BUT_RELOAD, "",10,90,150,19, colvars->col, 0, 0, 0, 0, "");
- } else if(last_seq->type==SEQ_SPEED){
- SpeedControlVars *sp =
- (SpeedControlVars *)last_seq->effectdata;
-
- uiDefButF(block, NUM, SEQ_BUT_RELOAD, "Global Speed:", 10,70,150,19, &sp->globalSpeed, 0.0, 100.0, 0, 0, "Global Speed");
-
- uiDefButBitI(block, TOG, SEQ_SPEED_INTEGRATE,
- SEQ_BUT_RELOAD,
- "IPO is velocity",
- 10,50,150,19, &sp->flags,
- 0.0, 1.0, 0, 0,
- "Interpret the IPO value as a "
- "velocity instead of a frame number");
-
- uiDefButBitI(block, TOG, SEQ_SPEED_BLEND,
- SEQ_BUT_RELOAD,
- "Enable frame blending",
- 10,30,150,19, &sp->flags,
- 0.0, 1.0, 0, 0,
- "Blend two frames into the "
- "target for a smoother result");
-
- uiDefButBitI(block, TOG, SEQ_SPEED_COMPRESS_IPO_Y,
- SEQ_BUT_RELOAD,
- "IPO value runs from [0..1]",
- 10,10,150,19, &sp->flags,
- 0.0, 1.0, 0, 0,
- "Scale IPO value to get the "
- "target frame number.");
- }
-
- uiBlockEndAlign(block);
- }
-}
-
-static void seq_blockhandlers(ScrArea *sa)
-{
- SpaceSeq *sseq= sa->spacedata.first;
- short a;
-
- /* warning; blocks need to be freed each time, handlers dont remove (for ipo moved to drawipospace) */
- uiFreeBlocksWin(&sa->uiblocks, sa->win);
-
- for(a=0; a<SPACE_MAXHANDLER; a+=2) {
- switch(sseq->blockhandler[a]) {
-
- case SEQ_HANDLER_PROPERTIES:
- seq_panel_properties(sseq->blockhandler[a+1]);
- break;
-
- }
- /* clear action value for event */
- sseq->blockhandler[a+1]= 0;
- }
- uiDrawBlocksPanels(sa, 0);
-
-}
-
-void drawprefetchseqspace(ScrArea *sa, void *spacedata)
-{
- SpaceSeq *sseq= sa->spacedata.first;
- int rectx, recty;
-
- rectx= (G.scene->r.size*G.scene->r.xsch)/100;
- recty= (G.scene->r.size*G.scene->r.ysch)/100;
-
- if(sseq->mainb) {
- give_ibuf_prefetch_request(
- rectx, recty, (G.scene->r.cfra), sseq->chanshown);
- }
-}
-
-void drawseqspace(ScrArea *sa, void *spacedata)
-{
- SpaceSeq *sseq= sa->spacedata.first;
- View2D *v2d= &sseq->v2d;
- Editing *ed;
- Sequence *seq;
- float col[3];
- int ofsx, ofsy;
- int i;
-
- ed= G.scene->ed;
-
- if(sseq->mainb) {
- draw_image_seq(sa);
- return;
- }
-
- bwin_clear_viewmat(sa->win); /* clear buttons view */
- glLoadIdentity();
-
- BIF_GetThemeColor3fv(TH_BACK, col);
- if(ed && ed->metastack.first) glClearColor(col[0], col[1], col[2]-0.1, 0.0);
- else glClearColor(col[0], col[1], col[2], 0.0);
-
- glClear(GL_COLOR_BUFFER_BIT);
-
- calc_scrollrcts(sa, v2d, sa->winx, sa->winy);
-
- if(sa->winx>SCROLLB+10 && sa->winy>SCROLLH+10) {
- if(v2d->scroll) {
- ofsx= sa->winrct.xmin; /* because of mywin */
- ofsy= sa->winrct.ymin;
- glViewport(ofsx+v2d->mask.xmin, ofsy+v2d->mask.ymin, ( ofsx+v2d->mask.xmax-1)-(ofsx+v2d->mask.xmin)+1, ( ofsy+v2d->mask.ymax-1)-( ofsy+v2d->mask.ymin)+1);
- glScissor(ofsx+v2d->mask.xmin, ofsy+v2d->mask.ymin, ( ofsx+v2d->mask.xmax-1)-(ofsx+v2d->mask.xmin)+1, ( ofsy+v2d->mask.ymax-1)-( ofsy+v2d->mask.ymin)+1);
- }
- }
-
-
- myortho2(v2d->cur.xmin, v2d->cur.xmax, v2d->cur.ymin, v2d->cur.ymax);
-
- BIF_ThemeColorShade(TH_BACK, -20);
- glRectf(v2d->cur.xmin, 0.0, v2d->cur.xmax, 1.0);
-
-
- boundbox_seq();
- calc_ipogrid();
-
- /* Alternating horizontal stripes */
- i= MAX2(1, ((int)G.v2d->cur.ymin)-1);
-
- glBegin(GL_QUADS);
- while (i<v2d->cur.ymax) {
- if (((int)i) & 1)
- BIF_ThemeColorShade(TH_BACK, -15);
- else
- BIF_ThemeColorShade(TH_BACK, -25);
-
- glVertex2f(v2d->cur.xmax, i);
- glVertex2f(v2d->cur.xmin, i);
- glVertex2f(v2d->cur.xmin, i+1);
- glVertex2f(v2d->cur.xmax, i+1);
- i+=1.0;
- }
- glEnd();
-
- /* Force grid lines */
- i= MAX2(1, ((int)G.v2d->cur.ymin)-1);
- glBegin(GL_LINES);
-
- while (i<G.v2d->cur.ymax) {
- BIF_ThemeColor(TH_GRID);
- glVertex2f(G.v2d->cur.xmax, i);
- glVertex2f(G.v2d->cur.xmin, i);
- i+=1.0;
- }
- glEnd();
-
-
- draw_ipogrid();
- draw_cfra_seq();
-
-
- /* sequences: first deselect */
- if(ed) {
- Sequence *last_seq = get_last_seq();
- int sel = 0, j;
- int outline_tint;
- float pixelx = (v2d->cur.xmax - v2d->cur.xmin)/(v2d->mask.xmax - v2d->mask.xmin);
- /* loop through twice, first unselected, then selected */
- for (j=0; j<2; j++) {
- seq= ed->seqbasep->first;
- if (j==0) outline_tint = -150;
- else outline_tint = -60;
-
- while(seq) { /* bound box test, dont draw outside the view */
- if ( ((seq->flag & SELECT) == sel) ||
- seq == last_seq ||
- MIN2(seq->startdisp, seq->start) > v2d->cur.xmax ||
- MAX2(seq->enddisp, seq->start+seq->len) < v2d->cur.xmin ||
- seq->machine+1.0 < v2d->cur.ymin ||
- seq->machine > v2d->cur.ymax)
- {
- /* dont draw */
- } else {
- draw_seq_strip(seq, sa, sseq, outline_tint, pixelx);
- }
- seq= seq->next;
- }
- sel= SELECT; /* draw selected next time round */
- }
- /* draw the last selected last, removes some overlapping error */
- if (last_seq) {
- draw_seq_strip(last_seq, sa, sseq, 120, pixelx);
- }
- }
-
- draw_extra_seqinfo();
-
- /* Draw markers */
- draw_markers_timespace(1);
-
- /* restore viewport */
- mywinset(sa->win);
-
- /* ortho at pixel level sa */
- myortho2(-0.375, sa->winx-0.375, -0.375, sa->winy-0.375);
-
- if(sa->winx>SCROLLB+10 && sa->winy>SCROLLH+10) {
- if(v2d->scroll) {
- drawscroll(0);
- }
- }
-
- draw_area_emboss(sa);
-
- if(sseq->mainb==0) {
- /* it is important to end a view in a transform compatible with buttons */
- bwin_scalematrix(sa->win, sseq->blockscale, sseq->blockscale, sseq->blockscale);
- seq_blockhandlers(sa);
- }
-
- sa->win_swap= WIN_BACK_OK;
-}
-
-
diff --git a/source/blender/src/drawsound.c b/source/blender/src/drawsound.c
deleted file mode 100644
index 17d340b802c..00000000000
--- a/source/blender/src/drawsound.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <math.h>
-#include <stdio.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "DNA_scene_types.h"
-#include "DNA_sound_types.h"
-#include "DNA_space_types.h"
-#include "DNA_screen_types.h"
-
-#include "BKE_utildefines.h"
-#include "BKE_global.h"
-
-#include "BIF_gl.h"
-#include "BIF_mywindow.h"
-#include "BIF_screen.h"
-#include "BIF_editsound.h"
-#include "BIF_resources.h"
-
-#include "BSE_drawipo.h"
-#include "BSE_time.h"
-#include "BMF_Api.h"
-
-#include "blendef.h"
-
-/* local */
-void drawsoundspace(ScrArea *sa, void *spacedata);
-
-/*implementation */
-static void draw_wave(int startsamp, int endsamp, short sampdx, short offset, short *sp, float sampfac, float y)
-{
- float min, max, v1[2], v2[3];
- int i, j, deltasp, value; /*deltasp, value: were both shorts but for music files 5min, zooming out cased a crash */
-
- sp+= offset*startsamp;
-
- deltasp= offset*sampdx;
-
- glBegin(GL_LINES);
- for(i=startsamp; i<endsamp; i+=sampdx, sp+=deltasp) {
-
- /* filter */
- min= max= 0.0;
- for(j=0; j<sampdx; j++) {
- value= sp[offset*j];
- if(value < min) min= value;
- else if(value > max) max= value;
- }
- v1[1]= y + 0.002*min;
- v2[1]= y + 0.002*max;
-
- v1[0]=v2[0]= sampfac*i;
-
- glVertex2fv(v1);
- glVertex2fv(v2);
- }
- glEnd();
-}
-
-static void draw_sample(bSample *sample)
-{
- float sampxlen, sampfac;
- int samples, startsamp, endsamp;
- short *sp, sampdx;
-
- /* one sample is where in v2d space? (v2d space in frames!) */
- sampfac= FPS/(sample->rate);
-
- /* how many samples? */
- samples= sample->len/(sample->channels*(sample->bits/8));
- /* total len in v2d space */
- sampxlen= sampfac*samples;
-
- /* one pixel is how many samples? */
- sampdx= (samples*((G.v2d->cur.xmax-G.v2d->cur.xmin)/sampxlen))/curarea->winx;
-
- if(sampdx==0) sampdx= 1;
-
- /* start and and */
- startsamp = G.v2d->cur.xmin/sampfac;
- CLAMP(startsamp, 0, samples-1);
- endsamp= G.v2d->cur.xmax/sampfac;
- CLAMP(endsamp, 0, samples-1);
- endsamp-= sampdx;
-
- /* set 'tot' for sliders */
- G.v2d->tot.xmax= sampfac*samples;
-
- /* channels? */
- if(sample->channels==2) {
-
- cpack(0x905050);
- sp= (short *)(sample->data);
- draw_wave(startsamp, endsamp, sampdx, 2, sp, sampfac, 85.0);
-
- cpack(0x506890);
- sp++;
- draw_wave(startsamp, endsamp, sampdx, 2, sp, sampfac, 190.0);
- }
- else {
- cpack(0x905050);
- sp= (short *)(sample->data);
-
- draw_wave(startsamp, endsamp, sampdx, 1, sp, sampfac, 128.0);
- }
-}
-
-static void draw_cfra_sound(SpaceSound *ssound)
-{
- float vec[2];
-
- if(ssound->flag & SND_CFRA_NUM) {
- short mval[2];
- float x, y;
- char str[32];
- /* little box with frame */
-
- getmouseco_areawin(mval);
-
- if(mval[1]>curarea->winy-10) mval[1]= curarea->winy - 13;
-
- if (curarea->winy < 25) {
- if (mval[1]<17) mval[1]= 17;
- } else if (mval[1]<22) mval[1]= 22;
-
- areamouseco_to_ipoco(G.v2d, mval, &x, &y);
-
- if(ssound->flag & SND_DRAWFRAMES)
- sprintf(str, " %d\n", CFRA);
- else sprintf(str, " %.2f\n", FRA2TIME(CFRA));
-
- glRasterPos2f(x, y);
- glColor3ub(0, 0, 0);
- BMF_DrawString(G.font, str);
-
- }
-
- vec[0]= (G.scene->r.cfra);
- vec[0]*= G.scene->r.framelen;
-
- vec[1]= G.v2d->cur.ymin;
- BIF_ThemeColor(TH_CFRAME);
- glLineWidth(2.0);
-
- glBegin(GL_LINE_STRIP);
- glVertex2fv(vec);
- vec[1]= G.v2d->cur.ymax;
- glVertex2fv(vec);
- glEnd();
-
- glLineWidth(1.0);
-}
-
-void drawsoundspace(ScrArea *sa, void *spacedata)
-{
- float col[3];
- short ofsx, ofsy;
-
- BIF_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- calc_scrollrcts(sa, G.v2d, curarea->winx, curarea->winy);
-
- if(curarea->winx>SCROLLB+10 && curarea->winy>SCROLLH+10) {
- if(G.v2d->scroll) {
- ofsx= curarea->winrct.xmin; /* because mywin */
- ofsy= curarea->winrct.ymin;
- glViewport(ofsx+G.v2d->mask.xmin, ofsy+G.v2d->mask.ymin, ( ofsx+G.v2d->mask.xmax-1)-(ofsx+G.v2d->mask.xmin)+1, ( ofsy+G.v2d->mask.ymax-1)-( ofsy+G.v2d->mask.ymin)+1);
- glScissor(ofsx+G.v2d->mask.xmin, ofsy+G.v2d->mask.ymin, ( ofsx+G.v2d->mask.xmax-1)-(ofsx+G.v2d->mask.xmin)+1, ( ofsy+G.v2d->mask.ymax-1)-( ofsy+G.v2d->mask.ymin)+1);
- }
- }
-
- myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax);
-
- /* boundbox_seq(); */
- calc_ipogrid();
- draw_ipogrid();
-
- if (G.ssound->sound) {
- sound_initialize_sample(G.ssound->sound);
- draw_sample(G.ssound->sound->sample);
- }
-
- draw_cfra_sound(spacedata);
- draw_markers_timespace(0);
-
- /* restore viewport */
- mywinset(curarea->win);
-
- /* ortho at pixel level curarea */
- myortho2(-0.375, curarea->winx-0.375, -0.375, curarea->winy-0.375);
-
- if(curarea->winx>SCROLLB+10 && curarea->winy>SCROLLH+10) {
- if(G.v2d->scroll) {
- drawscroll(0);
- }
- }
-
- myortho2(-0.375, curarea->winx-0.375, -0.375, curarea->winy-0.375);
- draw_area_emboss(sa);
- curarea->win_swap= WIN_BACK_OK;
-}
diff --git a/source/blender/src/drawtext.c b/source/blender/src/drawtext.c
deleted file mode 100644
index b4026746a35..00000000000
--- a/source/blender/src/drawtext.c
+++ /dev/null
@@ -1,2230 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <math.h>
-#include <string.h>
-#include <ctype.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef _WIN32
-#include <unistd.h>
-#else
-#include <io.h>
-#include "BLI_winstuff.h"
-#endif
-#include "MEM_guardedalloc.h"
-#include "PIL_time.h"
-
-#include "BMF_Api.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "DNA_text_types.h"
-#include "DNA_space_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_userdef_types.h"
-
-#include "BKE_utildefines.h"
-#include "BKE_text.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-#include "BIF_keyval.h"
-#include "BIF_interface.h"
-#include "BIF_drawtext.h"
-#include "BIF_editfont.h"
-#include "BIF_spacetypes.h"
-#include "BIF_usiblender.h"
-#include "BIF_screen.h"
-#include "BIF_toolbox.h"
-#include "BIF_space.h"
-#include "BIF_mywindow.h"
-#include "BIF_resources.h"
-
-#include "BSE_filesel.h"
-
-#include "BPY_extern.h"
-
-#include "mydevice.h"
-#include "blendef.h"
-
-#define TEXTXLOC 38
-
-/* forward declarations */
-
-void drawtextspace(ScrArea *sa, void *spacedata);
-void winqreadtextspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
-void txt_copy_selectbuffer (Text *text);
-void txt_paste_clipboard(Text *text); /* blank on non Win32 */
-void txt_copy_clipboard(Text *text); /* blank on non Win32 */
-void do_brackets();
-
-int check_bracket(char *string);
-static int check_delim(char *string);
-static int check_numbers(char *string);
-static int check_builtinfuncs(char *string);
-static int check_specialvars(char *string);
-
-static void *last_txt_find_string= NULL;
-
-static BMF_Font *spacetext_get_font(SpaceText *st) {
- static BMF_Font *scr12= NULL;
- static BMF_Font *scr15= NULL;
-
- switch (st->font_id) {
- default:
- case 0:
- if (!scr12)
- scr12= BMF_GetFont(BMF_kScreen12);
- return scr12;
- case 1:
- if (!scr15)
- scr15= BMF_GetFont(BMF_kScreen15);
- return scr15;
- }
-}
-
-static int spacetext_get_fontwidth(SpaceText *st) {
- return BMF_GetCharacterWidth(spacetext_get_font(st), ' ');
-}
-
-static char *temp_char_buf= NULL;
-static int *temp_char_accum= NULL;
-static int temp_char_len= 0;
-static int temp_char_pos= 0;
-
-static void temp_char_write(char c, int accum) {
- if (temp_char_len==0 || temp_char_pos>=temp_char_len) {
- char *nbuf; int *naccum;
- int olen= temp_char_len;
-
- if (olen) temp_char_len*= 2;
- else temp_char_len= 256;
-
- nbuf= MEM_mallocN(sizeof(*temp_char_buf)*temp_char_len, "temp_char_buf");
- naccum= MEM_mallocN(sizeof(*temp_char_accum)*temp_char_len, "temp_char_accum");
-
- if (olen) {
- memcpy(nbuf, temp_char_buf, olen);
- memcpy(naccum, temp_char_accum, olen);
-
- MEM_freeN(temp_char_buf);
- MEM_freeN(temp_char_accum);
- }
-
- temp_char_buf= nbuf;
- temp_char_accum= naccum;
- }
-
- temp_char_buf[temp_char_pos]= c;
- temp_char_accum[temp_char_pos]= accum;
-
- if (c==0) temp_char_pos= 0;
- else temp_char_pos++;
-}
-
-void free_txt_data(void) {
- txt_free_cut_buffer();
-
- if (last_txt_find_string) MEM_freeN(last_txt_find_string);
- if (temp_char_buf) MEM_freeN(temp_char_buf);
- if (temp_char_accum) MEM_freeN(temp_char_accum);
-}
-
-static int render_string (SpaceText *st, char *in) {
- int r = 0, i = 0;
-
- while(*in) {
- if (*in=='\t') {
- if (temp_char_pos && *(in-1)=='\t') i= st->tabnumber;
- else if (st->tabnumber > 0) i= st->tabnumber - (temp_char_pos%st->tabnumber);
- while(i--) temp_char_write(' ', r);
- } else temp_char_write(*in, r);
-
- r++;
- in++;
- }
- r= temp_char_pos;
- temp_char_write(0, 0);
-
- return r;
-}
-
-void get_format_string(SpaceText *st)
-{
- Text *text = st->text;
- TextLine *tmp;
- char *in_line;
- char format[2000], check[200], other[2];
- unsigned char c;
- int a, b, len, spot, letter, tabs, mem_amount;
-
- if(!text) return;
- tmp = text->lines.first;
-
- while(tmp) {
- in_line = tmp->line;
-
- len = strlen(in_line);
- /* weak code... but we dont want crashes (ton) */
- if(len>2000-1) {
- if (tmp->format) MEM_freeN(tmp->format);
- tmp->format= NULL;
- }
- else {
-
- spot = 0;
- tabs = 0;
- //see how many tabs we have
- for(a = 0; a <len; a++) {
- c = (unsigned char) in_line[a];
- if(c == '\t') {
- tabs++;
- }
- }
- //calculate the amount of MEM_mallocN we neen
- mem_amount = (((tabs*st->tabnumber)-tabs)+2)+len; // +2 for good measure
- if (tmp->format) MEM_freeN(tmp->format);
- tmp->format = MEM_mallocN(mem_amount, "Syntax_format");
-
- for (a = 0; a < len; a++) {
- c = (unsigned char) in_line[a];
-
- check[0] = c;
- check[1] = '\0';
-
- if (check_delim(check))
- {
- switch (c) {
- case '\"':
- if(in_line[a] == '\"' && in_line[a+1] == '\"' && in_line[a+2] == '\"') {
- format[spot] = format[spot+1] = format[spot+2] = 'l';
- spot +=3;
- a += 3;
- while(in_line[a] != '\"' || in_line[a-1] != '\"' || in_line[a-2] != '\"') {
- c = (unsigned char) in_line[a];
- if(a >= len) {
- format[spot] = '\0';
- memcpy(tmp->format, format, strlen(format));
- if(!(tmp= tmp->next)) {
- return;
- } else {
- in_line = tmp->line;
- len = strlen(in_line);
- tabs = 0;
- for(b = 0; b <len; b++) {
- c = (unsigned char) in_line[b];
- if(c == '\t') {
- tabs++;
- }
- }
- mem_amount = (((tabs*st->tabnumber)-tabs)+2)+len;
- if (tmp->format) MEM_freeN(tmp->format);
- tmp->format = MEM_mallocN(mem_amount, "Syntax_format");
- a = 0; spot = 0;
- }
- } else {
- if(c == '\t' || c == ' ') {
- if(c == '\t') {
- for(b = st->tabnumber-(spot%st->tabnumber); b > 0; b--) {
- format[spot] = ' ';
- spot++;
- }
- a++;
- } else {
- format[spot] = ' ';
- a++; spot++;
- }
- } else {
- format[spot] = 'l';
- a++; spot++;
- }
- }
- }
- format[spot] = 'l';
- spot++;
- } else {
- format[spot] = 'l';
- a++; spot++;
- while(in_line[a] != '\"') {
- c = (unsigned char) in_line[a];
- if(a >= len) {
- format[spot] = '\0';
- memcpy(tmp->format, format, strlen(format));
- if(!(tmp= tmp->next)) {
- return;
- } else {
- in_line = tmp->line;
- len = strlen(in_line);
- for(b = 0; b <len; b++) {
- c = (unsigned char) in_line[b];
- if(c == '\t') {
- tabs++;
- }
- }
- //calculate the amount of MEM_mallocN we neen
- mem_amount = (((tabs*st->tabnumber)-tabs)+2)+len;
- if (tmp->format) MEM_freeN(tmp->format);
- tmp->format = MEM_mallocN(mem_amount, "Syntax_format");
- a = 0; spot = 0;
- }
- }
- if(c == '\t' || c == ' ') {
- if(c == '\t') {
- for(b = st->tabnumber-(spot%st->tabnumber); b > 0; b--) {
- format[spot] = ' ';
- spot++;
- }
- a++;
- } else {
- format[spot] = ' ';
- a++; spot++;
- }
- } else {
- format[spot] = 'l';
- a++; spot++;
- }
- }
- format[spot] = 'l';
- spot++;
- }
- break;
- case '\'':
- if(in_line[a] == '\'' && in_line[a+1] == '\'' && in_line[a+2] == '\'') {
- format[spot] = format[spot+1] = format[spot+2] = 'l';
- spot +=3;
- a += 3;
- while(in_line[a] != '\'' || in_line[a-1] != '\'' || in_line[a-2] != '\'') {
- c = (unsigned char) in_line[a];
- if(a >= len) {
- format[spot] = '\0';
- memcpy(tmp->format, format, strlen(format));
- if(!(tmp= tmp->next)) {
- return;
- } else {
- in_line = tmp->line;
- len = strlen(in_line);
- tabs = 0;
- for(b = 0; b <len; b++) {
- c = (unsigned char) in_line[b];
- if(c == '\t') {
- tabs++;
- }
- }
- mem_amount = (((tabs*st->tabnumber)-tabs)+2)+len;
- if (tmp->format) MEM_freeN(tmp->format);
- tmp->format = MEM_mallocN(mem_amount, "Syntax_format");
- a = 0; spot = 0;
- }
- } else {
- if(c == '\t' || c == ' ') {
- if(c == '\t') {
- for(b = st->tabnumber-(spot%st->tabnumber); b > 0; b--) {
- format[spot] = ' ';
- spot++;
- }
- a++;
- } else {
- format[spot] = ' ';
- a++; spot++;
- }
- } else {
- format[spot] = 'l';
- a++; spot++;
- }
- }
- }
- format[spot] = 'l';
- spot++;
- } else {
- format[spot] = 'l';
- a++; spot++;
- while(in_line[a] != '\'') {
- c = (unsigned char) in_line[a];
- if(a >= len) {
- format[spot] = '\0';
- memcpy(tmp->format, format, strlen(format));
- if(!(tmp= tmp->next)) {
- return;
- } else {
- in_line = tmp->line;
- len = strlen(in_line);
- for(b = 0; b <len; b++) {
- c = (unsigned char) in_line[b];
- if(c == '\t') {
- tabs++;
- }
- }
- //calculate the amount of MEM_mallocN we neen
- mem_amount = (((tabs*st->tabnumber)-tabs)+2)+len;
- if (tmp->format) MEM_freeN(tmp->format);
- tmp->format = MEM_mallocN(mem_amount, "Syntax_format");
- a = 0; spot = 0;
- }
- }
- if(c == '\t' || c == ' ') {
- if(c == '\t') {
- for(b = st->tabnumber-(spot%st->tabnumber); b > 0; b--) {
- format[spot] = ' ';
- spot++;
- }
- a++;
- } else {
- format[spot] = ' ';
- a++; spot++;
- }
- } else {
- format[spot] = 'l';
- a++; spot++;
- }
- }
- format[spot] = 'l';
- spot++;
- }
- break;
- case '#':
- while(a<len) {
- c = (unsigned char) in_line[a];
- if(c == '\t' || c == ' ') {
- if(c == '\t') {
- for(b = st->tabnumber-(spot%st->tabnumber); b > 0; b--) {
- format[spot] = '#';
- spot++;
- }
- a++;
- } else {
- format[spot] = '#';
- a++; spot++;
- }
- } else {
- format[spot] = '#';
- a++; spot++;
- }
- }
- break;
- case ' ':
- format[spot] = ' ';
- spot++;
- break;
- case '\t':
- for(b = st->tabnumber-(spot%st->tabnumber); b > 0; b--) {
- format[spot] = ' ';
- spot++;
- }
- break;
- default:
- format[spot] = 'q';
- spot++;
-
- break;
- }
- } else if (check_numbers(check)) {
- while (a < len) {
- c = (unsigned char) in_line[a];
- other[0] = c;
- other[1] = '\0';
- if (check_delim(other) && c != '.') {
- a--; break;
- } else {
- format[spot] = 'n';
- a++; spot++;
- }
- }
- } else {
- letter = 0;
- while (a < len) {
- c = (unsigned char) in_line[a];
- other[0] = c;
- other[1] = '\0';
- if (check_delim(other)) {
- a--;
- break;
- } else {
- check[letter] = (unsigned char) in_line[a];
- letter++;
- a++;
- }
- }
- check[letter] = '\0';
- if (check_builtinfuncs(check)) {
- for (b = 0; b < strlen(check); b++) {
- format[spot] = 'b';
- spot++;
- }
- } else if (check_specialvars(check)) { /*If TRUE then color and color next word*/
- for (b = 0; b < strlen(check); b++) {
- format[spot] = 'b';
- spot++;
- }
- a++;
- format[spot] = 'q';
- spot++; a++;
- letter = 0;
- while (a < len) {
- c = (unsigned char) in_line[a];
- other[0] = c;
- other[1] = '\0';
- if (check_delim(other)) {
- a--;
- break;
- } else {
- check[letter] = (unsigned char) in_line[a];
- letter++;
- a++;
- }
- }
- check[letter] = '\0';
- for (b = 0; b < strlen(check); b++) {
- format[spot] = 'v';
- spot++;
- }
- }else {
- for (b = 0; b < strlen(check); b++) {
- format[spot] = 'q';
- spot++;
- }
- }
- }
- }
- format[spot] = '\0';
- memcpy(tmp->format, format, strlen(format));
- }
-
- tmp = tmp->next;
- }
-}
-
-static int text_draw(SpaceText *st, char *str, int cshift, int maxwidth, int draw, int x, int y, char *format) {
- int r=0, w= 0;
- char *in;
- int *acc;
-
- w= render_string(st, str);
- if(w<cshift ) return 0; /* String is shorter than shift */
-
- in= temp_char_buf+cshift;
- acc= temp_char_accum+cshift;
- w= w-cshift;
-
- if (draw) {
- if(st->showsyntax && format) {
- int amount, a;
- char out[2];
- format = format+cshift;
-
- amount = strlen(in);
-
- for(a = 0; a < amount; a++) {
- out[0] = (unsigned char) in[a];
- out[1] = '\0';
- switch (format[a]) {
- case 'l':
- BIF_ThemeColor(TH_SYNTAX_L);
- break;
- case 'b':
- BIF_ThemeColor(TH_SYNTAX_B);
- break;
- case '#':
- BIF_ThemeColor(TH_SYNTAX_C);
- break;
- case 'v':
- BIF_ThemeColor(TH_SYNTAX_V);
- break;
- case 'n':
- BIF_ThemeColor(TH_SYNTAX_N);
- break;
- case 'q':
- BIF_ThemeColor(TH_TEXT);
- break;
- default:
- BIF_ThemeColor(TH_TEXT);
- break;
- }
- glRasterPos2i(x, y);
- BMF_DrawString(spacetext_get_font(st), out);
- x = x+BMF_GetStringWidth(spacetext_get_font(st), out);
- }
- } else {
- glRasterPos2i(x, y);
- BMF_DrawString(spacetext_get_font(st), in);
- }
- } else {
- while (w-- && *acc++ < maxwidth) {
- r+= spacetext_get_fontwidth(st);
- }
- }
-
- if (cshift && r==0) return 0;
- else if (st->showlinenrs)
- return r+TXT_OFFSET+TEXTXLOC;
- else
- return r+TXT_OFFSET;
-}
-
-static void set_cursor_to_pos (SpaceText *st, int x, int y, int sel)
-{
- Text *text;
- TextLine **linep;
- int *charp;
- int w;
-
- text= st->text;
-
- if(sel) { linep= &text->sell; charp= &text->selc; }
- else { linep= &text->curl; charp= &text->curc; }
-
- y= (curarea->winy - y)/st->lheight;
-
- y-= txt_get_span(text->lines.first, *linep) - st->top;
-
- if (y>0) {
- while (y-- != 0) if((*linep)->next) *linep= (*linep)->next;
- } else if (y<0) {
- while (y++ != 0) if((*linep)->prev) *linep= (*linep)->prev;
- }
-
- if(st->showlinenrs)
- x-= TXT_OFFSET+TEXTXLOC;
- else
- x-= TXT_OFFSET;
-
- if (x<0) x= 0;
- x = (x/spacetext_get_fontwidth(st)) + st->left;
-
- w= render_string(st, (*linep)->line);
- if(x<w) *charp= temp_char_accum[x];
- else *charp= (*linep)->len;
-
- if(!sel) txt_pop_sel(text);
-}
-
-static void draw_cursor(SpaceText *st) {
- int h, x, i;
- Text *text= st->text;
- TextLine *linef, *linel;
- int charf, charl;
-
- if (text->curl==text->sell && text->curc==text->selc) {
- x= text_draw(st, text->curl->line, st->left, text->curc, 0, 0, 0, NULL);
-
- if (x) {
- h= txt_get_span(text->lines.first, text->curl) - st->top;
-
- BIF_ThemeColor(TH_HILITE);
-
- glRecti(x-1, curarea->winy-st->lheight*(h)-2, x+1, curarea->winy-st->lheight*(h+1)-2);
- }
- } else {
- int span= txt_get_span(text->curl, text->sell);
-
- if (span<0) {
- linef= text->sell;
- charf= text->selc;
-
- linel= text->curl;
- charl= text->curc;
- } else if (span>0) {
- linef= text->curl;
- charf= text->curc;
-
- linel= text->sell;
- charl= text->selc;
- } else {
- linef= linel= text->curl;
-
- if (text->curc<text->selc) {
- charf= text->curc;
- charl= text->selc;
- } else {
- charf= text->selc;
- charl= text->curc;
- }
- }
-
- /* Walk to the beginning of visible text */
- h= txt_get_span(text->lines.first, linef) - st->top;
- while (h++<-1 && linef!=linel) linef= linef->next;
-
- x= text_draw(st, linef->line, st->left, charf, 0, 0, 0, NULL);
-
- BIF_ThemeColor(TH_SHADE2);
-
- if(st->showlinenrs) {
- if (!x) x= TXT_OFFSET + TEXTXLOC -4;
- } else {
- if (!x) x= TXT_OFFSET - 4;
- }
-
- while (linef && linef != linel) {
- h= txt_get_span(text->lines.first, linef) - st->top;
- if (h>st->viewlines) break;
-
- glRecti(x, curarea->winy-st->lheight*(h)-2, curarea->winx, curarea->winy-st->lheight*(h+1)-2);
- if(st->showlinenrs)
- glRecti(TXT_OFFSET+TEXTXLOC-4, curarea->winy-st->lheight*(h+1)-2, TXT_OFFSET+TEXTXLOC, curarea->winy-st->lheight*(h+2)-2);
- else
- glRecti(TXT_OFFSET-4, curarea->winy-st->lheight*(h+1)-2, TXT_OFFSET, curarea->winy-st->lheight*(h+2)-2);
-
- if(st->showlinenrs)
- x= TXT_OFFSET + TEXTXLOC;
- else
- x= TXT_OFFSET;
-
- linef= linef->next;
- }
-
- h= txt_get_span(text->lines.first, linef) - st->top;
-
- i= text_draw(st, linel->line, st->left, charl, 0, 0, 0, NULL);
- if(i) glRecti(x, curarea->winy-st->lheight*(h)-2, i, curarea->winy-st->lheight*(h+1)-2);
-
- }
-
- do_brackets();
- BIF_ThemeColor(TH_TEXT);
-}
-
-static void calc_text_rcts(SpaceText *st)
-{
- int lhlstart, lhlend, ltexth;
- short barheight, barstart, hlstart, hlend, blank_lines;
- short pix_available, pix_top_margin, pix_bottom_margin, pix_bardiff;
-
- pix_top_margin = 8;
- pix_bottom_margin = 4;
- pix_available = curarea->winy - pix_top_margin - pix_bottom_margin;
- ltexth= txt_get_span(st->text->lines.first, st->text->lines.last);
- blank_lines = st->viewlines / 2;
-
- /* when resizing a vieport with the bar at the bottom to a greater height more blank lines will be added */
- if (ltexth + blank_lines < st->top + st->viewlines) {
- blank_lines = st->top + st->viewlines - ltexth;
- }
-
- ltexth += blank_lines;
-
- barheight = (st->viewlines*pix_available) / ltexth;
- pix_bardiff = 0;
- if (barheight < 20) {
- pix_bardiff = 20 - barheight; /* take into account the now non-linear sizing of the bar */
- barheight = 20;
- }
- barstart = ((pix_available - pix_bardiff) * st->top) / ltexth;
-
- st->txtbar.xmin = 5;
- st->txtbar.xmax = 17;
- st->txtbar.ymax = curarea->winy - pix_top_margin - barstart;
- st->txtbar.ymin = st->txtbar.ymax - barheight;
-
- CLAMP(st->txtbar.ymin, pix_bottom_margin, curarea->winy - pix_top_margin);
- CLAMP(st->txtbar.ymax, pix_bottom_margin, curarea->winy - pix_top_margin);
-
- st->pix_per_line= (float) ltexth/pix_available;
- if (st->pix_per_line<.1) st->pix_per_line=.1f;
-
- lhlstart = MIN2(txt_get_span(st->text->lines.first, st->text->curl),
- txt_get_span(st->text->lines.first, st->text->sell));
- lhlend = MAX2(txt_get_span(st->text->lines.first, st->text->curl),
- txt_get_span(st->text->lines.first, st->text->sell));
-
- hlstart = (lhlstart * pix_available) / ltexth;
- hlend = (lhlend * pix_available) / ltexth;
-
- /* the scrollbar is non-linear sized */
- if (pix_bardiff > 0) {
- /* the start of the highlight is in the current viewport */
- if (lhlstart >= st->top && lhlstart <= st->top + st->viewlines) {
- /* speed the progresion of the start of the highlight through the scrollbar */
- hlstart = ( ( (pix_available - pix_bardiff) * lhlstart) / ltexth) + (pix_bardiff * (lhlstart - st->top) / st->viewlines);
- }
- else if (lhlstart > st->top + st->viewlines && hlstart < barstart + barheight && hlstart > barstart) {
- /* push hl start down */
- hlstart = barstart + barheight;
- }
- else if (lhlend > st->top && lhlstart < st->top && hlstart > barstart) {
- /*fill out start */
- hlstart = barstart;
- }
-
- if (hlend <= hlstart) {
- hlend = hlstart + 2;
- }
-
- /* the end of the highlight is in the current viewport */
- if (lhlend >= st->top && lhlend <= st->top + st->viewlines) {
- /* speed the progresion of the end of the highlight through the scrollbar */
- hlend = (((pix_available - pix_bardiff )*lhlend)/ltexth) + (pix_bardiff * (lhlend - st->top)/st->viewlines);
- }
- else if (lhlend < st->top && hlend >= barstart - 2 && hlend < barstart + barheight) {
- /* push hl end up */
- hlend = barstart;
- }
- else if (lhlend > st->top + st->viewlines && lhlstart < st->top + st->viewlines && hlend < barstart + barheight) {
- /* fill out end */
- hlend = barstart + barheight;
- }
-
- if (hlend <= hlstart) {
- hlstart = hlend - 2;
- }
- }
-
- if (hlend - hlstart < 2) {
- hlend = hlstart + 2;
- }
-
- st->txtscroll.xmin= 5;
- st->txtscroll.xmax= 17;
- st->txtscroll.ymax= curarea->winy - pix_top_margin - hlstart;
- st->txtscroll.ymin= curarea->winy - pix_top_margin - hlend;
-
- CLAMP(st->txtscroll.ymin, pix_bottom_margin, curarea->winy - pix_top_margin);
- CLAMP(st->txtscroll.ymax, pix_bottom_margin, curarea->winy - pix_top_margin);
-}
-
-static void draw_textscroll(SpaceText *st)
-{
- if (!st->text) return;
-
- calc_text_rcts(st);
-
- BIF_ThemeColorShade(TH_SHADE1, -20);
- glRecti(2, 2, 20, curarea->winy-6);
- uiEmboss(2, 2, 20, curarea->winy-6, 1);
-
- BIF_ThemeColor(TH_SHADE1);
- glRecti(st->txtbar.xmin, st->txtbar.ymin, st->txtbar.xmax, st->txtbar.ymax);
-
- BIF_ThemeColor(TH_SHADE2);
- glRecti(st->txtscroll.xmin, st->txtscroll.ymin, st->txtscroll.xmax, st->txtscroll.ymax);
-
- uiEmboss(st->txtbar.xmin, st->txtbar.ymin, st->txtbar.xmax, st->txtbar.ymax, st->flags & ST_SCROLL_SELECT);
-}
-
-static void screen_skip(SpaceText *st, int lines)
-{
- int last;
-
- if (!st) return;
- if (st->spacetype != SPACE_TEXT) return;
- if (!st->text) return;
-
- st->top += lines;
-
- last= txt_get_span(st->text->lines.first, st->text->lines.last);
- last= last - (st->viewlines/2);
-
- if (st->top>last) st->top= last;
- if (st->top<0) st->top= 0;
-}
-
-/*
- * mode 1 == view scroll
- * mode 2 == scrollbar
- */
-static void do_textscroll(SpaceText *st, int mode)
-{
- short delta[2]= {0, 0};
- short mval[2], hold[2], old[2];
-
- if (!st->text) return;
-
- calc_text_rcts(st);
-
- st->flags|= ST_SCROLL_SELECT;
-
- glDrawBuffer(GL_FRONT);
- uiEmboss(st->txtbar.xmin, st->txtbar.ymin, st->txtbar.xmax, st->txtbar.ymax, st->flags & ST_SCROLL_SELECT);
- bglFlush();
- glDrawBuffer(GL_BACK);
-
- getmouseco_areawin(mval);
- old[0]= hold[0]= mval[0];
- old[1]= hold[1]= mval[1];
-
- while(get_mbut()&(L_MOUSE|M_MOUSE)) {
- getmouseco_areawin(mval);
-
- if(old[0]!=mval[0] || old[1]!=mval[1]) {
- if (mode==1) {
- delta[0]= (hold[0]-mval[0])/spacetext_get_fontwidth(st);
- delta[1]= (mval[1]-hold[1])/st->lheight;
- }
- else delta[1]= (hold[1]-mval[1])*st->pix_per_line;
-
- if (delta[0] || delta[1]) {
- screen_skip(st, delta[1]);
- st->left+= delta[0];
- if (st->left<0) st->left= 0;
-
- scrarea_do_windraw(curarea);
- screen_swapbuffers();
-
- hold[0]=mval[0];
- hold[1]=mval[1];
- }
- old[0]=mval[0];
- old[1]=mval[1];
- } else {
- BIF_wait_for_statechange();
- }
- }
- st->flags^= ST_SCROLL_SELECT;
-
- glDrawBuffer(GL_FRONT);
- uiEmboss(st->txtbar.xmin, st->txtbar.ymin, st->txtbar.xmax, st->txtbar.ymax, st->flags & ST_SCROLL_SELECT);
- bglFlush();
- glDrawBuffer(GL_BACK);
-}
-
-static void do_selection(SpaceText *st, int selecting)
-{
- short mval[2], old[2];
- int sell, selc;
- int linep2, charp2;
- int first= 1;
-
- getmouseco_areawin(mval);
- old[0]= mval[0];
- old[1]= mval[1];
-
- if (!selecting) {
- int curl= txt_get_span(st->text->lines.first, st->text->curl);
- int curc= st->text->curc;
- int linep2, charp2;
-
- set_cursor_to_pos(st, mval[0], mval[1], 0);
-
- linep2= txt_get_span(st->text->lines.first, st->text->curl);
- charp2= st->text->selc;
-
- if (curl!=linep2 || curc!=charp2)
- txt_undo_add_toop(st->text, UNDO_CTO, curl, curc, linep2, charp2);
- }
-
- sell= txt_get_span(st->text->lines.first, st->text->sell);
- selc= st->text->selc;
-
- while(get_mbut()&L_MOUSE) {
- getmouseco_areawin(mval);
-
- if (mval[1]<0 || mval[1]>curarea->winy) {
- int d= (old[1]-mval[1])*st->pix_per_line;
- if (d) screen_skip(st, d);
-
- set_cursor_to_pos(st, mval[0], mval[1]<0?0:curarea->winy, 1);
-
- scrarea_do_windraw(curarea);
- screen_swapbuffers();
- } else if (mval[0]<0 || mval[0]>curarea->winx) {
- if (mval[0]>curarea->winx) st->left++;
- else if (mval[0]<0 && st->left>0) st->left--;
-
- set_cursor_to_pos(st, mval[0], mval[1], 1);
-
- scrarea_do_windraw(curarea);
- screen_swapbuffers();
-
- PIL_sleep_ms(10);
- } else if (first || old[0]!=mval[0] || old[1]!=mval[1]) {
- set_cursor_to_pos(st, mval[0], mval[1], 1);
-
- scrarea_do_windraw(curarea);
- screen_swapbuffers();
-
- old[0]= mval[0];
- old[1]= mval[1];
- first= 1;
- } else {
- BIF_wait_for_statechange();
- }
- }
-
- linep2= txt_get_span(st->text->lines.first, st->text->sell);
- charp2= st->text->selc;
-
- if (sell!=linep2 || selc!=charp2)
- txt_undo_add_toop(st->text, UNDO_STO, sell, selc, linep2, charp2);
-}
-
-void drawtextspace(ScrArea *sa, void *spacedata)
-{
- SpaceText *st= curarea->spacedata.first;
- Text *text;
- int i;
- TextLine *tmp;
- char linenr[12];
- float col[3];
- int linecount = 0;
-
- if (st==NULL || st->spacetype != SPACE_TEXT) return;
-
- BIF_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
- myortho2(-0.375, (float)(sa->winx)-0.375, -0.375, (float)(sa->winy)-0.375);
-
- draw_area_emboss(sa);
-
- text= st->text;
- if(!text) return;
-
- /* Make sure all the positional pointers exist */
- if (!text->curl || !text->sell || !text->lines.first || !text->lines.last)
- txt_clean_text(text);
-
- if(st->lheight) st->viewlines= (int) curarea->winy/st->lheight;
- else st->viewlines= 0;
-
- if(st->showlinenrs) {
- cpack(0x8c787c);
- glRecti(23, 0, (st->lheight==15)?63:59, curarea->winy - 2);
- }
-
- BIF_ThemeColor(TH_TEXT);
-
- draw_cursor(st);
-
- tmp= text->lines.first;
- for (i= 0; i<st->top && tmp; i++) {
- tmp= tmp->next;
- linecount++;
- }
-
- if(st->showsyntax) {
- if (tmp && !tmp->format) {
- get_format_string(st);
- }
- }
-
- for (i=0; i<st->viewlines && tmp; i++, tmp= tmp->next) {
- if(st->showlinenrs) {
- BIF_ThemeColor(TH_TEXT);
- if(((float)(i + linecount + 1)/10000.0) < 1.0) {
- sprintf(linenr, "%4d", i + linecount + 1);
- glRasterPos2i(TXT_OFFSET - 7, curarea->winy-st->lheight*(i+1));
- } else {
- sprintf(linenr, "%5d", i + linecount + 1);
- glRasterPos2i(TXT_OFFSET - 11, curarea->winy-st->lheight*(i+1));
- }
- BMF_DrawString(spacetext_get_font(st), linenr);
- text_draw(st, tmp->line, st->left, 0, 1, TXT_OFFSET + TEXTXLOC, curarea->winy-st->lheight*(i+1), tmp->format);
- } else
- text_draw(st, tmp->line, st->left, 0, 1, TXT_OFFSET, curarea->winy-st->lheight*(i+1), tmp->format);
- }
-
- draw_textscroll(st);
-
- curarea->win_swap= WIN_BACK_OK;
-}
-
-/* Moves the view to the cursor location,
- also used to make sure the view isnt outside the file */
-void pop_space_text (SpaceText *st)
-{
- int i, x;
-
- if(!st) return;
- if(!st->text) return;
- if(!st->text->curl) return;
-
- i= txt_get_span(st->text->lines.first, st->text->curl);
- if (st->top+st->viewlines <= i || st->top > i) {
- st->top= i - st->viewlines/2;
- }
-
- x= text_draw(st, st->text->curl->line, st->left, st->text->curc, 0, 0, 0, NULL);
-
- if (x==0 || x>curarea->winx) {
- st->left= st->text->curc-0.5*(curarea->winx)/spacetext_get_fontwidth(st);
- }
-
- if (st->top < 0) st->top= 0;
- if (st->left <0) st->left= 0;
-}
-
-void add_text_fs(char *file) /* bad but cant pass an as arg here */
-{
- SpaceText *st= curarea->spacedata.first;
- Text *text;
-
- if (st==NULL || st->spacetype != SPACE_TEXT) return;
-
- text= add_text(file);
-
- st->text= text;
-
- st->top= 0;
-
- if (st->showsyntax) get_format_string(st);
- allqueue(REDRAWTEXT, 0);
- allqueue(REDRAWHEADERS, 0);
-}
-
-void free_textspace(SpaceText *st)
-{
- if (!st) return;
-
- st->text= NULL;
-}
-
-static void save_mem_text(char *str)
-{
- SpaceText *st= curarea->spacedata.first;
- Text *text;
-
- if (!str) return;
-
- if (!st) return;
- if (st->spacetype != SPACE_TEXT) return;
-
- text= st->text;
- if(!text) return;
-
- if (text->name) MEM_freeN(text->name);
- text->name= MEM_mallocN(strlen(str)+1, "textname");
- strcpy(text->name, str);
-
- text->flags ^= TXT_ISMEM;
-
- txt_write_file(text);
-}
-
-void txt_write_file(Text *text)
-{
- FILE *fp;
- TextLine *tmp;
-
- /* Do we need to get a filename? */
- if (text->flags & TXT_ISMEM) {
- if (text->name)
- activate_fileselect(FILE_SPECIAL, "SAVE TEXT FILE", text->name, save_mem_text);
- else
- activate_fileselect(FILE_SPECIAL, "SAVE TEXT FILE", text->id.name+2, save_mem_text);
- return;
- }
-
- /* Should we ask to save over? */
- if (text->flags & TXT_ISTMP) {
- if (BLI_exists(text->name)) {
- if (!okee("Save over")) return;
- } else if (!okee("Create new file")) return;
-
- text->flags ^= TXT_ISTMP;
- }
-
- fp= fopen(text->name, "w");
- if (fp==NULL) {
- error("Unable to save file");
- return;
- }
-
- tmp= text->lines.first;
- while (tmp) {
- if (tmp->next) fprintf(fp, "%s\n", tmp->line);
- else fprintf(fp, "%s", tmp->line);
-
- tmp= tmp->next;
- }
-
- fclose (fp);
-
- if (text->flags & TXT_ISDIRTY) text->flags ^= TXT_ISDIRTY;
-}
-
-void unlink_text(Text *text)
-{
- bScreen *scr;
- ScrArea *area;
- SpaceLink *sl;
-
- /* check if this text was used as script link:
- * this check function unsets the pointers and returns how many
- * script links used this Text */
- if (BPY_check_all_scriptlinks (text)) {
- allqueue(REDRAWBUTSSCRIPT, 0);
- }
-
- for (scr= G.main->screen.first; scr; scr= scr->id.next) {
- for (area= scr->areabase.first; area; area= area->next) {
- for (sl= area->spacedata.first; sl; sl= sl->next) {
- if (sl->spacetype==SPACE_TEXT) {
- SpaceText *st= (SpaceText*) sl;
-
- if (st->text==text) {
- st->text= NULL;
- st->top= 0;
-
- if (st==area->spacedata.first) {
- scrarea_queue_redraw(area);
- }
- }
- }
- }
- }
- }
-}
-
-int jumptoline_interactive(SpaceText *st) {
- short nlines= txt_get_span(st->text->lines.first, st->text->lines.last)+1;
- short tmp= txt_get_span(st->text->lines.first, st->text->curl)+1;
-
- if (button(&tmp, 1, nlines, "Jump to line:")) {
- txt_move_toline(st->text, tmp-1, 0);
- pop_space_text(st);
- return 1;
- } else {
- return 0;
- }
-}
-
-
-int bufferlength;
-static char *copybuffer = NULL;
-
-void txt_copy_selectbuffer (Text *text)
-{
- int length=0;
- TextLine *tmp, *linef, *linel;
- int charf, charl;
-
- if (!text) return;
- if (!text->curl) return;
- if (!text->sell) return;
-
- if (!txt_has_sel(text)) return;
-
- if (copybuffer) {
- MEM_freeN(copybuffer);
- copybuffer= NULL;
- }
-
- if (text->curl==text->sell) {
- linef= linel= text->curl;
-
- if (text->curc < text->selc) {
- charf= text->curc;
- charl= text->selc;
- } else{
- charf= text->selc;
- charl= text->curc;
- }
- } else if (txt_get_span(text->curl, text->sell)<0) {
- linef= text->sell;
- linel= text->curl;
-
- charf= text->selc;
- charl= text->curc;
- } else {
- linef= text->curl;
- linel= text->sell;
-
- charf= text->curc;
- charl= text->selc;
- }
-
- if (linef == linel) {
- length= charl-charf;
-
- copybuffer= MEM_mallocN(length+1, "cut buffera");
-
- BLI_strncpy(copybuffer, linef->line + charf, length+1);
- } else {
- length+= linef->len - charf;
- length+= charl;
- length++; /* For the '\n' */
-
- tmp= linef->next;
- while (tmp && tmp!= linel) {
- length+= tmp->len+1;
- tmp= tmp->next;
- }
-
- copybuffer= MEM_mallocN(length+1, "cut bufferb");
-
- strncpy(copybuffer, linef->line+ charf, linef->len-charf);
- length= linef->len-charf;
-
- copybuffer[length++]='\n';
-
- tmp= linef->next;
- while (tmp && tmp!=linel) {
- strncpy(copybuffer+length, tmp->line, tmp->len);
- length+= tmp->len;
-
- copybuffer[length++]='\n';
-
- tmp= tmp->next;
- }
- strncpy(copybuffer+length, linel->line, charl);
- length+= charl;
-
- copybuffer[length]=0;
- }
-
- bufferlength = length;
-}
-
-
-#ifdef _WIN32
-static char *unixNewLine(char *buffer)
-{
- char *p, *p2, *output;
-
- /* we can afford the few extra bytes */
- output= MEM_callocN(strlen(buffer)+1, "unixnewline");
- for (p= buffer, p2= output; *p; p++)
- if (*p != '\r') *(p2++)= *p;
-
- *p2= 0;
- return(output);
-}
-
-static char *winNewLine(char *buffer)
-{
- char *p, *p2, *output;
- int add= 0;
-
- for (p= buffer; *p; p++)
- if (*p == '\n') add++;
-
- bufferlength= p-buffer+add+1;
- output= MEM_callocN(bufferlength, "winnewline");
- for (p= buffer, p2= output; *p; p++, p2++) {
- if (*p == '\n') {
- *(p2++)= '\r'; *p2= '\n';
- } else *p2= *p;
- }
- *p2= 0;
-
- return(output);
-}
-#endif
-
-
-void txt_paste_clipboard(Text *text) {
-#ifdef _WIN32
- char * buffer = NULL;
-
- if ( OpenClipboard(NULL) ) {
- HANDLE hData = GetClipboardData( CF_TEXT );
- buffer = (char*)GlobalLock( hData );
- if (buffer) {
- buffer = unixNewLine(buffer);
- if (buffer) txt_insert_buf(text, buffer);
- }
- GlobalUnlock( hData );
- CloseClipboard();
- MEM_freeN(buffer);
- }
-#endif
-}
-
-void txt_copy_clipboard(Text *text) {
-#ifdef _WIN32
- txt_copy_selectbuffer(text);
-
- if (OpenClipboard(NULL)) {
- HLOCAL clipbuffer;
- char* buffer;
-
- if (copybuffer) {
- copybuffer = winNewLine(copybuffer);
-
- EmptyClipboard();
- clipbuffer = LocalAlloc(LMEM_FIXED,((bufferlength+1)));
- buffer = (char *) LocalLock(clipbuffer);
-
- strncpy(buffer, copybuffer, bufferlength);
- buffer[bufferlength] = '\0';
- LocalUnlock(clipbuffer);
- SetClipboardData(CF_TEXT,clipbuffer);
- }
- CloseClipboard();
- }
-
- if (copybuffer) {
- MEM_freeN(copybuffer);
- copybuffer= NULL;
- }
-#endif
-}
-
-/*
- * again==0 show find panel or find
- * again==1 find text again */
-void txt_find_panel(SpaceText *st, int again)
-{
- Text *text=st->text;
- char *findstr= last_txt_find_string;
-
- if (again==0) {
- findstr= txt_sel_to_buf(text);
- } else if (again==1) {
- char buf[256];
-
- if (findstr && strlen(findstr)<(sizeof(buf)-1))
- strcpy(buf, findstr);
- else
- buf[0]= 0;
-
- if (sbutton(buf, 0, sizeof(buf)-1, "Find: ") && buf[0])
- findstr= BLI_strdup(buf);
- else
- findstr= NULL;
- }
-
- if (findstr!=last_txt_find_string) {
- if (last_txt_find_string)
- MEM_freeN(last_txt_find_string);
- last_txt_find_string= findstr;
- }
-
- if (findstr) {
- if (txt_find_string(text, findstr))
- pop_space_text(st);
- else
- error("Not found: %s", findstr);
- }
-}
-
-void run_python_script(SpaceText *st)
-{
- char *py_filename;
- Text *text=st->text;
-
- if (!BPY_txt_do_python_Text(text)) {
- int lineno = BPY_Err_getLinenumber();
- // jump to error if happened in current text:
- py_filename = (char*) BPY_Err_getFilename();
-
- /* st->text can become NULL: user called Blender.Load(blendfile)
- * before the end of the script. */
- if (!st->text) return;
-
- if (!strcmp(py_filename, st->text->id.name+2)) {
- error("Python script error, check console");
- if (lineno >= 0) {
- txt_move_toline(text, lineno-1, 0);
- txt_sel_line(text);
- pop_space_text(st);
- }
- } else {
- error("Error in other (possibly external) file, "\
- "check console");
- }
- }
-}
-
-static void set_tabs(Text *text)
-{
- SpaceText *st = curarea->spacedata.first;
- st->currtab_set = setcurr_tab(text);
-}
-
-void winqreadtextspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
-{
- unsigned short event= evt->event;
- short val= evt->val;
- char ascii= evt->ascii;
- SpaceText *st= curarea->spacedata.first;
- Text *text;
- int do_draw=0, p;
-
- if (st==NULL || st->spacetype != SPACE_TEXT) return;
-
- /* smartass code to prevent the CTRL/ALT events below from not working! */
- if(G.qual & (LR_ALTKEY|LR_CTRLKEY))
- if(!ispunct(ascii))
- ascii= 0;
-
- text= st->text;
-
- if (!text) {
- if (event==RIGHTMOUSE) {
- switch (pupmenu("File %t|New %x0|Open... %x1")) {
- case 0:
- st->text= add_empty_text("Text");
- st->top= 0;
-
- allqueue(REDRAWTEXT, 0);
- allqueue(REDRAWHEADERS, 0);
- break;
- case 1:
- activate_fileselect(FILE_SPECIAL, "Open Text File", G.sce, add_text_fs);
- break;
- }
- }
- if (val && !ELEM(G.qual, 0, LR_SHIFTKEY)) {
- if (event==FKEY && G.qual == (LR_ALTKEY|LR_SHIFTKEY)) {
- switch (pupmenu("File %t|New %x0|Open... %x1")) {
- case 0:
- st->text= add_empty_text("Text");
- st->top= 0;
-
- allqueue(REDRAWTEXT, 0);
- allqueue(REDRAWHEADERS, 0);
- break;
- case 1:
- activate_fileselect(FILE_SPECIAL, "Open Text File", G.sce, add_text_fs);
- break;
- }
- }
- else if (event==QKEY) {
- if (G.qual & LR_CTRLKEY) {
- if(okee("Quit Blender")) exit_usiblender();
- }
- }
- else if (event==NKEY) {
- if (G.qual & LR_ALTKEY) {
- st->text= add_empty_text("Text");
- st->top= 0;
-
- allqueue(REDRAWTEXT, 0);
- allqueue(REDRAWHEADERS, 0);
- }
- }
- else if (event==OKEY) {
- if (G.qual & LR_ALTKEY) {
- activate_fileselect(FILE_SPECIAL, "Open Text File", G.sce, add_text_fs);
- }
- }
- }
- return;
- }
-
- if (event==LEFTMOUSE) {
- if (val) {
- short mval[2];
- set_tabs(text);
- getmouseco_areawin(mval);
-
- if (mval[0]>2 && mval[0]<20 && mval[1]>2 && mval[1]<curarea->winy-2) {
- do_textscroll(st, 2);
- } else {
- do_selection(st, G.qual&LR_SHIFTKEY);
- do_draw= 1;
- }
- }
- } else if (event==MIDDLEMOUSE) {
- if (val) {
- do_textscroll(st, 1);
- }
- } else if (event==RIGHTMOUSE) {
- if (val) {
- p= pupmenu("File %t|New %x0|Open... %x1|Save %x2|Save As...%x3|Execute Script%x4");
-
- switch(p) {
- case 0:
- st->text= add_empty_text("Text");
- st->top= 0;
-
- allqueue(REDRAWTEXT, 0);
- allqueue(REDRAWHEADERS, 0);
- break;
-
- case 1:
- activate_fileselect(FILE_SPECIAL, "Open Text File", G.sce, add_text_fs);
- break;
-
- case 3:
- text->flags |= TXT_ISMEM;
-
- case 2:
- txt_write_file(text);
- do_draw= 1;
- break;
- case 4:
- run_python_script(st);
- do_draw= 1;
- break;
- default:
- break;
- }
- }
- } else if (ascii) {
- if (txt_add_char(text, ascii)) {
- if (st->showsyntax) get_format_string(st);
- pop_space_text(st);
- do_draw= 1;
- }
- } else if (val) {
- switch (event) {
- case AKEY:
- if (G.qual & LR_ALTKEY) {
- txt_move_bol(text, G.qual & LR_SHIFTKEY);
- do_draw= 1;
- pop_space_text(st);
- } else if (G.qual & LR_CTRLKEY) {
- txt_sel_all(text);
- do_draw= 1;
- }
- break; /* BREAK A */
- case CKEY:
- if (G.qual & LR_ALTKEY || G.qual & LR_CTRLKEY) {
- if(G.qual & LR_SHIFTKEY)
- txt_copy_clipboard(text);
- else
- txt_copy_sel(text);
-
- do_draw= 1;
- }
- break; /* BREAK C */
- case DKEY:
- if (G.qual == (LR_CTRLKEY|LR_SHIFTKEY)) {
- //uncommenting
- txt_order_cursors(text);
- uncomment(text);
- do_draw = 1;
- if (st->showsyntax) get_format_string(st);
- break;
- } else if (G.qual == LR_CTRLKEY) {
- txt_delete_char(text);
- if (st->showsyntax) get_format_string(st);
- do_draw= 1;
- pop_space_text(st);
- }
- break; /* BREAK D */
- case EKEY:
- if (G.qual == (LR_ALTKEY|LR_SHIFTKEY)) {
- switch(pupmenu("Edit %t|Cut %x0|Copy %x1|Paste %x2|Print Cut Buffer %x3")) {
- case 0:
- txt_cut_sel(text);
- do_draw= 1;
- break;
- case 1:
- txt_copy_sel(text);
- do_draw= 1;
- break;
- case 2:
- txt_paste(text);
- if (st->showsyntax) get_format_string(st);
- do_draw= 1;
- break;
- case 3:
- txt_print_cutbuffer();
- break;
- }
- }
- else if (G.qual == LR_CTRLKEY || G.qual == (LR_CTRLKEY|LR_SHIFTKEY)) {
- txt_move_eol(text, G.qual & LR_SHIFTKEY);
- do_draw= 1;
- pop_space_text(st);
- }
- break; /* BREAK E */
- case FKEY:
- if (G.qual == (LR_ALTKEY|LR_SHIFTKEY)) {
- switch(pupmenu("File %t|New %x0|Open... %x1|Save %x2|Save As...%x3")) {
- case 0:
- st->text= add_empty_text("Text");
- st->top= 0;
-
- allqueue(REDRAWTEXT, 0);
- allqueue(REDRAWHEADERS, 0);
- break;
- case 1:
- activate_fileselect(FILE_SPECIAL, "Open Text File", G.sce, add_text_fs);
- break;
- case 3:
- text->flags |= TXT_ISMEM;
- case 2:
- txt_write_file(text);
- do_draw= 1;
- break;
- }
- }
- else if (G.qual == LR_ALTKEY) {
- if (txt_has_sel(text)) {
- txt_find_panel(st,0);
- do_draw= 1;
- }
- }
- else if (G.qual == (LR_ALTKEY|LR_CTRLKEY)) { /* always search button */
- txt_find_panel(st,1);
- do_draw= 1;
- }
- break; /* BREAK F */
- case JKEY:
- if (G.qual == LR_ALTKEY) {
- do_draw= jumptoline_interactive(st);
- }
- break; /* BREAK J */
- case MKEY:
- if (G.qual == LR_ALTKEY) {
- txt_export_to_object(text);
- do_draw= 1;
- }
- break; /* BREAK M */
- case NKEY:
- if (G.qual == LR_ALTKEY) {
- st->text= add_empty_text("Text");
- st->top= 0;
-
- allqueue(REDRAWTEXT, 0);
- allqueue(REDRAWHEADERS, 0);
-
- }
- break; /* BREAK N */
- case OKEY:
- if (G.qual == LR_ALTKEY) {
- activate_fileselect(FILE_SPECIAL, "Open Text File", G.sce, add_text_fs);
- }
- break; /* BREAK O */
- case PKEY:
- if (G.qual == LR_ALTKEY) {
- run_python_script(st);
- do_draw= 1;
- }
- break; /* BREAK P */
- case QKEY:
- if(okee("Quit Blender")) exit_usiblender();
- break; /* BREAK Q */
- case RKEY:
- if (G.qual == LR_ALTKEY) {
- if (text->compiled) BPY_free_compiled_text(text);
- text->compiled = NULL;
- if (okee("Reopen text")) {
- if (!reopen_text(text))
- error("Could not reopen file");
- if (st->showsyntax) get_format_string(st);
- }
- do_draw= 1;
- }
- break; /* BREAK R */
- case SKEY:
- if (G.qual == (LR_ALTKEY|LR_SHIFTKEY)) {
- p= pupmenu("Select %t|"
- "Select All %x0|"
- "Select Line %x1|"
- "Jump to Line %x3");
- switch(p) {
- case 0:
- txt_sel_all(text);
- do_draw= 1;
- break;
-
- case 1:
- txt_sel_line(text);
- do_draw= 1;
- break;
-
- case 3:
- do_draw= jumptoline_interactive(st);
- break;
- }
- }
- else if (G.qual & LR_ALTKEY) {
- /* Event treatment CANNOT enter this if
- if (G.qual & LR_SHIFTKEY)
- if (text) text->flags |= TXT_ISMEM;
- */
- txt_write_file(text);
- do_draw= 1;
- }
- break; /* BREAK S */
- case UKEY:
- //txt_print_undo(text); //debug buffer in console
- if (G.qual == (LR_ALTKEY|LR_SHIFTKEY)) {
- txt_do_redo(text);
- do_draw= 1;
- }
- if (G.qual == LR_ALTKEY) {
- txt_do_undo(text);
- if (st->showsyntax) get_format_string(st);
- do_draw= 1;
- }
- break; /* BREAK U */
- case VKEY:
- if (G.qual == (LR_ALTKEY| LR_SHIFTKEY)) {
- switch(pupmenu("View %t|Top of File %x0|Bottom of File %x1|Page Up %x2|Page Down %x3")) {
- case 0:
- txt_move_bof(text, 0);
- do_draw= 1;
- pop_space_text(st);
- break;
- case 1:
- txt_move_eof(text, 0);
- do_draw= 1;
- pop_space_text(st);
- break;
- case 2:
- screen_skip(st, -st->viewlines);
- do_draw= 1;
- break;
- case 3:
- screen_skip(st, st->viewlines);
- do_draw= 1;
- break;
- }
- }
- /* Support for both Alt-V and Ctrl-V for Paste, for backward compatibility reasons */
- else if (G.qual & LR_ALTKEY || G.qual & LR_CTRLKEY) {
- /* Throwing in the Shift modifier Paste from the OS clipboard */
- if (G.qual & LR_SHIFTKEY)
- txt_paste_clipboard(text);
- else
- txt_paste(text);
- if (st->showsyntax) get_format_string(st);
- do_draw= 1;
- pop_space_text(st);
- }
- break; /* BREAK V */
- case XKEY:
- if (G.qual == LR_ALTKEY || G.qual == LR_CTRLKEY) {
- txt_cut_sel(text);
- if (st->showsyntax) get_format_string(st);
- do_draw= 1;
- pop_space_text(st);
- }
- break;
- case ZKEY:
- if (G.qual & (LR_ALTKEY|LR_CTRLKEY|LR_COMMANDKEY)) {
- if (G.qual & LR_SHIFTKEY) {
- txt_do_redo(text);
- } else {
- txt_do_undo(text);
- }
- if (st->showsyntax) get_format_string(st);
- do_draw= 1;
- }
- break;
- case TABKEY:
- if (G.qual & LR_SHIFTKEY) {
- if (txt_has_sel(text)) {
- txt_order_cursors(text);
- unindent(text);
-
- }
- } else {
- if ( txt_has_sel(text)) {
- txt_order_cursors(text);
- indent(text);
- } else {
- txt_add_char(text, '\t');
- }
- }
- if (st->showsyntax) get_format_string(st);
- pop_space_text(st);
- do_draw= 1;
- st->currtab_set = setcurr_tab(text);
- break;
- case RETKEY:
- //double check tabs before splitting the line
- st->currtab_set = setcurr_tab(text);
- txt_split_curline(text);
- {
- int a = 0;
- if (a < st->currtab_set)
- {
- while ( a < st->currtab_set) {
- txt_add_char(text, '\t');
- a++;
- }
- }
- }
- if (st->showsyntax) get_format_string(st);
- do_draw= 1;
- pop_space_text(st);
- break;
- case BACKSPACEKEY:
- txt_backspace_char(text);
- set_tabs(text);
- if (st->showsyntax) get_format_string(st);
- do_draw= 1;
- pop_space_text(st);
- break;
- case DELKEY:
- txt_delete_char(text);
- if (st->showsyntax) get_format_string(st);
- do_draw= 1;
- pop_space_text(st);
- st->currtab_set = setcurr_tab(text);
- break;
- case DOWNARROWKEY:
- txt_move_down(text, G.qual & LR_SHIFTKEY);
- set_tabs(text);
- do_draw= 1;
- pop_space_text(st);
- break;
- case LEFTARROWKEY:
- if (G.qual & LR_COMMANDKEY)
- txt_move_bol(text, G.qual & LR_SHIFTKEY);
- else
- txt_move_left(text, G.qual & LR_SHIFTKEY);
- set_tabs(text);
- do_draw= 1;
- pop_space_text(st);
- break;
- case RIGHTARROWKEY:
- if (G.qual & LR_COMMANDKEY)
- txt_move_eol(text, G.qual & LR_SHIFTKEY);
- else
- txt_move_right(text, G.qual & LR_SHIFTKEY);
- set_tabs(text);
- do_draw= 1;
- pop_space_text(st);
- break;
- case UPARROWKEY:
- txt_move_up(text, G.qual & LR_SHIFTKEY);
- set_tabs(text);
- do_draw= 1;
- pop_space_text(st);
- break;
- case PAGEDOWNKEY:
- screen_skip(st, st->viewlines);
- do_draw= 1;
- break;
- case PAGEUPKEY:
- screen_skip(st, -st->viewlines);
- do_draw= 1;
- break;
- case HOMEKEY:
- txt_move_bol(text, G.qual & LR_SHIFTKEY);
- do_draw= 1;
- pop_space_text(st);
- break;
- case ENDKEY:
- txt_move_eol(text, G.qual & LR_SHIFTKEY);
- do_draw= 1;
- pop_space_text(st);
- break;
- case WHEELUPMOUSE:
- screen_skip(st, -U.wheellinescroll);
- do_draw= 1;
- break;
- case WHEELDOWNMOUSE:
- screen_skip(st, U.wheellinescroll);
- do_draw= 1;
- break;
- }
- }
-
- if (do_draw) {
- ScrArea *sa;
-
- for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- SpaceText *st= sa->spacedata.first;
-
- if (st && st->spacetype==SPACE_TEXT) {
- scrarea_queue_redraw(sa);
- }
- }
- }
-}
-
-void do_brackets(void)
-{
- SpaceText *st = curarea->spacedata.first;
- Text *text = st->text;
- TextLine *tmp, *start;
- char test[2];
- int d, pos, open, x, y, x2, y2, h=0;
-
- if(!text) return;
-
- tmp = text->curl;
- start = text->curl;
-
- test[0] = (unsigned char) tmp->line[text->curc];
- test[1] = '\0';
-
- d = check_bracket(test);
- if (!d) /* If not pri char */
- {
- test[0] = (unsigned char) tmp->line[text->curc-1];
- test[1] = '\0';
- d = check_bracket(test);
- if(!d) {
- return; /*If the current char or prev is not a bracket then return*/
- } else { /* current char */
- h= txt_get_span(text->lines.first, start) - st->top;
- x = text_draw(st, start->line, st->left, text->curc-1, 0, 0, 0, NULL);
- y = text_draw(st, start->line, st->left, text->curc, 0, 0, 0, NULL);
- if (d < 4) {
- pos = text->curc;
- } else {
- pos = text->curc-2;
- }
- }
- } else { /* is pri char */
- h= txt_get_span(text->lines.first, start) - st->top;
- x = text_draw(st, start->line, st->left, text->curc, 0, 0, 0, NULL);
- y = text_draw(st, start->line, st->left, text->curc+1, 0, 0, 0, NULL);
- if (d < 4) {
- pos = text->curc+1;
- } else {
- pos = text->curc-1;
- }
- }
-
- if (d < 4) /*reading forward*/
- {
- open = 1;
- while ( tmp ) {
- while (pos <= tmp->len) {
- test[0] = (unsigned char) tmp->line[pos];
- test[1] = '\0';
- if(check_bracket(test) == d) {
- open++;
- } else if (check_bracket(test) == d+3) {
- open--;
- if (open == 0) {
- BIF_ThemeColorBlend(TH_BACK, TH_SHADE2, 0.5);
- glRecti(x, curarea->winy-st->lheight*(h)-2, y, curarea->winy-st->lheight*(h+1)-2);
-
- h= txt_get_span(text->lines.first, tmp) - st->top;
- x2= text_draw(st, tmp->line, st->left, pos, 0, 0, 0, NULL);
- y2= text_draw(st, tmp->line, st->left, pos+1, 0, 0, 0, NULL);
- glRecti(x2, curarea->winy-st->lheight*(h)-2, y2, curarea->winy-st->lheight*(h+1)-2);
- BIF_ThemeColor(TH_TEXT);
- return;
- }
- }
- pos++;
- }
- tmp = tmp->next;
- pos = 0;
- }
- } else { /* reading back */
- open = 1;
- while ( tmp ) {
- while (pos >= 0) {
- test[0] = (unsigned char) tmp->line[pos];
- test[1] = '\0';
- if(check_bracket(test) == d) {
- open++;
- } else if (check_bracket(test) == d-3) {
- open--;
- if (open == 0) {
- BIF_ThemeColorBlend(TH_BACK, TH_SHADE2, 0.5);
- glRecti(x, curarea->winy-st->lheight*(h)-2, y, curarea->winy-st->lheight*(h+1)-2);
-
- h= txt_get_span(text->lines.first, tmp) - st->top;
- x2= text_draw(st, tmp->line, st->left, pos, 0, 0, 0, NULL);
- y2= text_draw(st, tmp->line, st->left, pos+1, 0, 0, 0, NULL);
- glRecti(x2, curarea->winy-st->lheight*(h)-2, y2, curarea->winy-st->lheight*(h+1)-2);
- BIF_ThemeColor(TH_TEXT);
- return;
- }
- }
- pos--;
- }
- tmp = tmp->prev;
- if (tmp) {
- pos = tmp->len;
- }
- }
- }
-
-}
-
-int check_bracket(char *string)
-{
- int number, a = 0;
- char other[][3] = {"(", "[", "{", ")", "]", "}"};
-
- number = 6;
-
- while(a < number) {
- if(strcmp(other[a], string) == 0)
- {
- return a+1;
- }
- a++;
- }
- return 0;
-}
-
-static int check_builtinfuncs(char *string)
-{
- int number = 30, a = 0;
-
- char builtinfuncs[][11] = {"and", "as", "assert", "break", "class", "continue", "def",
- "del", "elif", "else", "except", "exec", "finally",
- "for", "from", "global", "if", "import", "in",
- "is", "lambda", "not", "or", "pass", "print",
- "raise", "return", "try", "while", "yield"};
-
- for( a = 0; a < number; a++) {
- if(!strcmp(builtinfuncs[a], string))
- return 1;
- }
- return 0;
-}
-
-static int check_specialvars(char *string)
-{
- int number = 2, a = 0;
- char specialvars[][7] = {"def", "class"};
-
- for( a = 0; a < number; a++) {
- if(!strcmp(specialvars[a], string))
- return a+1;
- }
- return 0;
-}
-
-static int check_delim(char *string)
-{
- int number = 28, a = 0;
- char other[][3] = {"(", ")", ":", "\"", "\'", " ", "~", "!", "%", "^", "&", "*", "-", "+", "=", "[", "]", "{", "}", ";", "/", "<", ">", "|", ".", "#", "\t", ","};
-
- for( a = 0; a < number; a++) {
- if(!strcmp(other[a], string))
- return 1;
- }
- return 0;
-}
-
-static int check_numbers(char *string)
-{
- int number = 10, a = 0;
- char other[][2] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
-
- for( a = 0; a < number; a++) {
- if(!strcmp(other[a], string))
- return 1;
- }
- return 0;
-}
-
-void convert_tabs (struct SpaceText *st, int tab)
-{
- Text *text = st->text;
- TextLine *tmp;
- char *check_line, *new_line, *format;
- int a, j, extra, number; //unknown for now
-
- if (!text) return;
-
- tmp = text->lines.first;
-
- //first convert to all space, this make it alot easier to convert to tabs because there is no mixtures of ' ' && '\t'
- while(tmp) {
- check_line = tmp->line;
- new_line = MEM_mallocN(render_string(st, check_line)+1, "Converted_Line");
- format = MEM_mallocN(render_string(st, check_line)+1, "Converted_Syntax_format");
- j = 0;
- for (a=0; a < strlen(check_line); a++) { //foreach char in line
- if(check_line[a] == '\t') { //checking for tabs
- //get the number of spaces this tabs is showing
- //i dont like doing it this way but will look into it later
- new_line[j] = '\0';
- number = render_string(st, new_line);
- new_line[j] = '\t';
- new_line[j+1] = '\0';
- number = render_string(st, new_line)-number;
- for(extra = 0; extra < number; extra++) {
- new_line[j] = ' ';
- j++;
- }
- } else {
- new_line[j] = check_line[a];
- ++j;
- }
- }
- new_line[j] = '\0';
- // put new_line in the tmp->line spot still need to try and set the curc correctly
- if (tmp->line) MEM_freeN(tmp->line);
- if(tmp->format) MEM_freeN(tmp->format);
-
- tmp->line = new_line;
- tmp->len = strlen(new_line);
- tmp->format = format;
- tmp = tmp->next;
- }
-
- if (tab) // Converting to tabs
- { //start over from the begining
- tmp = text->lines.first;
-
- while(tmp) {
- check_line = tmp->line;
- extra = 0;
- for (a = 0; a < strlen(check_line); a++) {
- number = 0;
- for (j = 0; j < st->tabnumber; j++) {
- if ((a+j) <= strlen(check_line)) { //check to make sure we are not pass the end of the line
- if(check_line[a+j] != ' ') {
- number = 1;
- }
- }
- }
- if (!number) { //found all number of space to equal a tab
- a = a+(st->tabnumber-1);
- extra = extra+1;
- }
- }
-
- if ( extra > 0 ) { //got tabs make malloc and do what you have to do
- new_line = MEM_mallocN(strlen(check_line)-(((st->tabnumber*extra)-extra)-1), "Converted_Line");
- format = MEM_mallocN(strlen(check_line)-(((st->tabnumber*extra)-extra)-1), "Converted_Syntax_format");
- extra = 0; //reuse vars
- for (a = 0; a < strlen(check_line); a++) {
- number = 0;
- for (j = 0; j < st->tabnumber; j++) {
- if ((a+j) <= strlen(check_line)) { //check to make sure we are not pass the end of the line
- if(check_line[a+j] != ' ') {
- number = 1;
- }
- }
- }
- if (!number) { //found all number of space to equal a tab
- new_line[extra] = '\t';
- a = a+(st->tabnumber-1);
- ++extra;
-
- } else { //not adding a tab
- new_line[extra] = check_line[a];
- ++extra;
- }
- }
- new_line[extra] = '\0';
- // put new_line in the tmp->line spot still need to try and set the curc correctly
- if (tmp->line) MEM_freeN(tmp->line);
- if(tmp->format) MEM_freeN(tmp->format);
-
- tmp->line = new_line;
- tmp->len = strlen(new_line);
- tmp->format = format;
- }
- tmp = tmp->next;
- }
- }
-}
diff --git a/source/blender/src/drawtime.c b/source/blender/src/drawtime.c
deleted file mode 100644
index 3743d6c963e..00000000000
--- a/source/blender/src/drawtime.c
+++ /dev/null
@@ -1,454 +0,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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2005 Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "DNA_action_types.h"
-#include "DNA_ipo_types.h"
-#include "DNA_object_types.h"
-#include "DNA_material_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_space_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_sound_types.h"
-#include "DNA_view2d_types.h"
-
-#include "BKE_ipo.h"
-#include "BKE_object.h"
-#include "BKE_material.h"
-#include "BKE_utildefines.h"
-#include "BKE_global.h"
-
-#include "BIF_editaction.h"
-#include "BIF_gl.h"
-#include "BIF_interface.h"
-#include "BIF_interface_icons.h"
-#include "BIF_mywindow.h"
-#include "BIF_screen.h"
-#include "BIF_resources.h"
-#include "BIF_language.h"
-
-#include "BSE_drawipo.h"
-#include "BSE_view.h"
-
-#include "blendef.h"
-#include "interface.h" /* for ui_rasterpos_safe */
-
-#define TIMELINE_STIPPLE \
-{ \
- 136,136,136,136,0,0,0,0,34,34,34,34,0,0,0,0, \
- 136,136,136,136,0,0,0,0,34,34,34,34,0,0,0,0, \
- 136,136,136,136,0,0,0,0,34,34,34,34,0,0,0,0, \
- 136,136,136,136,0,0,0,0,34,34,34,34,0,0,0,0, \
- 136,136,136,136,0,0,0,0,34,34,34,34,0,0,0,0, \
- 136,136,136,136,0,0,0,0,34,34,34,34,0,0,0,0, \
- 136,136,136,136,0,0,0,0,34,34,34,34,0,0,0,0, \
- 136,136,136,136,0,0,0,0,34,34,34,34,0,0,0,0 \
-}
-
-/* ---- prototypes ------ */
-void drawtimespace(ScrArea *, void *);
-
-
-static void draw_cfra_time(SpaceTime *stime)
-{
- float vec[2];
-
- vec[0]= (G.scene->r.cfra);
- vec[0]*= G.scene->r.framelen;
-
- vec[1]= G.v2d->cur.ymin;
- BIF_ThemeColor(TH_CFRAME); // no theme, should be global color once...
- glLineWidth(3.0);
-
- glBegin(GL_LINES);
- glVertex2fv(vec);
- vec[1]= G.v2d->cur.ymax;
- glVertex2fv(vec);
- glEnd();
-
- glLineWidth(1.0);
-
- if(stime->flag & TIME_CFRA_NUM) {
- short mval[2];
- float x, y;
- float xscale, yscale;
- char str[32];
-
- /* little box with frame drawn beside */
-
- glFlush(); // huhh... without this glColor won't work for the text...
- getmouseco_areawin(mval);
-
- if(mval[1]>curarea->winy-10) mval[1]= curarea->winy - 13;
-
- if (curarea->winy < 25) {
- if (mval[1]<17) mval[1]= 17;
- } else if (mval[1]<22) mval[1]= 22;
-
- areamouseco_to_ipoco(G.v2d, mval, &x, &y);
-
- if(stime->flag & TIME_DRAWFRAMES)
- sprintf(str, " %d", CFRA);
- else sprintf(str, " %.2f", FRA2TIME(CFRA));
-
- /* HACK! somehow the green color won't go away... */
- glColor4ub(0, 0, 0, 0);
- BIF_ThemeColor(TH_TEXT);
-
- xscale = (G.v2d->mask.xmax-G.v2d->mask.xmin)/(G.v2d->cur.xmax-G.v2d->cur.xmin);
- yscale = (G.v2d->mask.ymax-G.v2d->mask.ymin)/(G.v2d->cur.ymax-G.v2d->cur.ymin);
-
- /* because the frame number text is subject to the same scaling as the contents of the view */
- glScalef( 1.0/xscale, 1.0/yscale, 1.0);
-
- ui_rasterpos_safe(x * xscale, y * yscale, 1.0);
- BIF_DrawString(G.fonts, str, 0);
- glScalef(xscale, yscale, 1.0);
- }
-
-}
-
-static void draw_marker(TimeMarker *marker, int lines)
-{
- float xpos, ypixels, xscale, yscale;
-
- xpos = marker->frame;
- /* no time correction for framelen! space is drawn with old values */
-
- ypixels= G.v2d->mask.ymax-G.v2d->mask.ymin;
- xscale = (G.v2d->mask.xmax-G.v2d->mask.xmin)/(G.v2d->cur.xmax-G.v2d->cur.xmin);
- yscale = (G.v2d->mask.ymax-G.v2d->mask.ymin)/(G.v2d->cur.ymax-G.v2d->cur.ymin);
-
- glScalef( 1.0/xscale, 1.0/yscale, 1.0);
-
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
- /* verticle line */
- if (lines) {
- setlinestyle(3);
- if(marker->flag & SELECT)
- glColor4ub(255,255,255, 96);
- else
- glColor4ub(0,0,0, 96);
-
- glBegin(GL_LINES);
- glVertex2f((xpos*xscale)+0.5, 12);
- glVertex2f((xpos*xscale)+0.5, 34*yscale); /* a bit lazy but we know it cant be greater then 34 strips high*/
- glEnd();
- setlinestyle(0);
- }
-
- /* 5 px to offset icon to align properly, space / pixels corrects for zoom */
- if(marker->flag & SELECT)
- BIF_icon_draw(xpos*xscale-5.0, 12.0, ICON_MARKER_HLT);
- else
- BIF_icon_draw(xpos*xscale-5.0, 12.0, ICON_MARKER);
-
- glBlendFunc(GL_ONE, GL_ZERO);
- glDisable(GL_BLEND);
-
- /* and the marker name too, shifted slightly to the top-right */
- if(marker->name && marker->name[0]) {
- if(marker->flag & SELECT) {
- BIF_ThemeColor(TH_TEXT_HI);
- ui_rasterpos_safe(xpos*xscale+4.0, (ypixels<=39.0)?(ypixels-10.0):29.0, 1.0);
- }
- else {
- BIF_ThemeColor(TH_TEXT);
- if((marker->frame <= G.scene->r.cfra) && (marker->frame+5 > G.scene->r.cfra))
- ui_rasterpos_safe(xpos*xscale+4.0, (ypixels<=39.0)?(ypixels-10.0):29.0, 1.0);
- else
- ui_rasterpos_safe(xpos*xscale+4.0, 17.0, 1.0);
- }
- BIF_DrawString(G.font, marker->name, 0);
- }
- glScalef(xscale, yscale, 1.0);
-}
-
-static void draw_markers_time(int lines)
-{
- TimeMarker *marker;
-
- /* unselected markers are drawn at the first time */
- for(marker= G.scene->markers.first; marker; marker= marker->next) {
- if(!(marker->flag & SELECT)) draw_marker(marker, lines);
- }
-
- /* selected markers are drawn later ... selected markers have to cover unselected
- * markers laying at the same position as selected markers
- * (jiri: it is hack, it could be solved better) */
- for(marker= G.scene->markers.first; marker; marker= marker->next) {
- if(marker->flag & SELECT) draw_marker(marker, lines);
- }
-}
-
-void draw_markers_timespace(int lines)
-{
- TimeMarker *marker;
- float yspace, ypixels;
-
- /* move ortho view to align with slider in bottom */
- glTranslatef(0.0f, G.v2d->cur.ymin, 0.0f);
-
- /* bad hacks in drawing markers... inverse correct that as well */
- yspace= G.v2d->cur.ymax - G.v2d->cur.ymin;
- ypixels= G.v2d->mask.ymax - G.v2d->mask.ymin;
- glTranslatef(0.0f, -11.0*yspace/ypixels, 0.0f);
-
- /* unselected markers are drawn at the first time */
- for(marker= G.scene->markers.first; marker; marker= marker->next) {
- if(!(marker->flag & SELECT)) draw_marker(marker, lines);
- }
-
- /* selected markers are drawn later ... selected markers have to cover unselected
- * markers laying at the same position as selected markers */
- for(marker= G.scene->markers.first; marker; marker= marker->next) {
- if(marker->flag & SELECT) draw_marker(marker, lines);
- }
-
- glTranslatef(0.0f, -G.v2d->cur.ymin, 0.0f);
- glTranslatef(0.0f, 11.0*yspace/ypixels, 0.0f);
-
-}
-
-void draw_anim_preview_timespace()
-{
- /* only draw this if preview range is set */
- if (G.scene->r.psfra) {
- glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
- glEnable(GL_BLEND);
- glColor4f(0, 0, 0, 0.4);
-
- if (PSFRA < PEFRA) {
- glRectf(G.v2d->cur.xmin, G.v2d->cur.ymin, PSFRA, G.v2d->cur.ymax);
- glRectf(PEFRA, G.v2d->cur.ymin, G.v2d->cur.xmax, G.v2d->cur.ymax);
- }
- else {
- glRectf(G.v2d->cur.xmin, G.v2d->cur.ymin, G.v2d->cur.xmax, G.v2d->cur.ymax);
- }
-
- glDisable(GL_BLEND);
- }
-}
-
-static void draw_sfra_efra()
-{
- BIF_ThemeColorShade(TH_BACK, -25);
-
- if (PSFRA < PEFRA) {
- glRectf(G.v2d->cur.xmin, G.v2d->cur.ymin, PSFRA, G.v2d->cur.ymax);
- glRectf(PEFRA, G.v2d->cur.ymin, G.v2d->cur.xmax, G.v2d->cur.ymax);
- }
- else {
- glRectf(G.v2d->cur.xmin, G.v2d->cur.ymin, G.v2d->cur.xmax, G.v2d->cur.ymax);
- }
-
- BIF_ThemeColorShade(TH_BACK, -60);
- /* thin lines where the actual frames are */
- fdrawline(PSFRA, G.v2d->cur.ymin, PSFRA, G.v2d->cur.ymax);
- fdrawline(PEFRA, G.v2d->cur.ymin, PEFRA, G.v2d->cur.ymax);
-
- glDisable(GL_BLEND);
-}
-
-static void draw_mapoldnew()
-{
- float anim_end; /* the end of the blender frames that are actually animated (map old)*/
- float frames_end; /* the end of the frames that get rendered and saved to disk (map new) */
- GLubyte timeline_stipple[32*32/8] = TIMELINE_STIPPLE;
-
- if (G.scene->r.framelen == 1.0) return;
-
- anim_end = PEFRA * G.scene->r.framelen;
- frames_end = PEFRA;
-
- glEnable(GL_POLYGON_STIPPLE);
- glPolygonStipple(timeline_stipple);
- BIF_ThemeColorShade(TH_BACK, -65);
-
- if (anim_end < frames_end)
- glRectf(anim_end, G.v2d->cur.ymin, frames_end, G.v2d->cur.ymax);
-
- glDisable(GL_POLYGON_STIPPLE);
-}
-
-/*draw all the keys in a list (elems) as lines */
-static void draw_key_list(ListBase elems, char col[3])
-{
- CfraElem *ce;
- float drawframe;
-
- ce= elems.first;
- while(ce) {
- drawframe = ce->cfra; //not correct for G.scene->r.framelen;
- glColor3ub(col[0], col[1], col[2]);
-
- fdrawline(drawframe, G.v2d->cur.ymin, drawframe, G.v2d->cur.ymax);
-
- ce= ce->next;
- }
-}
-
-/* This function draws keyframes that the active object has (as long as
- * it is not in EditMode). Some filters are available to optimise the
- * drawing efficiency.
- */
-static void draw_ob_keys()
-{
- /* mostly copied from drawobject.c, draw_object() */
- SpaceTime *stime= curarea->spacedata.first;
- ListBase elems= {0, 0};
-
- Object *ob= OBACT;
- short filter, ok;
- char col[3];
- int a;
-
- if (ob && ob!=G.obedit) {
- /* Object's IPO block - show all keys */
- if (ob->ipo) {
- /* convert the ipo to a list of 'current frame elements' */
- elems.first= elems.last= NULL;
- make_cfra_list(ob->ipo, &elems);
-
- /* draw the list of current frame elements */
- col[0] = 0xDD; col[1] = 0xD7; col[2] = 0x00;
- draw_key_list(elems, col);
-
- BLI_freelistN(&elems);
- }
-
- /* Object's Action block - may be filtered in some cases */
- if (ob->action) {
- bAction *act = ob->action;
- bActionChannel *achan;
-
- /* only apply filter if action is likely to be for pose channels + filter is on */
- filter= ((stime->flag & TIME_ONLYACTSEL) &&
- (ob->pose) && (ob->flag & OB_POSEMODE));
-
- /* go through each channel in the action */
- for (achan=act->chanbase.first; achan; achan=achan->next) {
- /* if filtering, check if this channel passes */
- if (filter) {
- ok= (SEL_ACHAN(achan))? 1 : 0;
- }
- else ok= 1;
-
- /* convert the ipo to a list of 'current frame elements' */
- if (achan->ipo && ok) {
- elems.first= elems.last= NULL;
- make_cfra_list(achan->ipo, &elems);
-
- col[0] = 0x00; col[1] = 0x82; col[2] = 0x8B;
- draw_key_list(elems, col);
-
- BLI_freelistN(&elems);
- }
- }
- }
-
- /* Materials (only relevant for geometry objects) - some filtering might occur */
- filter= (stime->flag & TIME_ONLYACTSEL);
- for (a=0; a<ob->totcol; a++) {
- Material *ma= give_current_material(ob, a+1);
-
- /* the only filter we apply right now is only showing the active material */
- if (filter) {
- ok= (ob->actcol==a)? 1 : 0;
- }
- else ok= 1;
-
- if (ma && ma->ipo && ok) {
- elems.first= elems.last= NULL;
- make_cfra_list(ma->ipo, &elems);
-
- col[0] = 0xDD; col[1] = 0xA7; col[2] = 0x00;
- draw_key_list(elems, col);
-
- BLI_freelistN(&elems);
- }
- }
- }
-}
-
-void drawtimespace(ScrArea *sa, void *spacedata)
-{
- SpaceTime *stime= sa->spacedata.first;
- float col[3];
-
- BIF_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- calc_scrollrcts(sa, &(stime->v2d), curarea->winx, curarea->winy);
-
- myortho2(stime->v2d.cur.xmin, stime->v2d.cur.xmax, stime->v2d.cur.ymin, stime->v2d.cur.ymax);
-
- /* draw darkened area outside of active timeline
- * frame range used is preview range or scene range
- */
- draw_sfra_efra();
- draw_mapoldnew();
-
- /* boundbox_seq(); */
- calc_ipogrid();
- draw_ipogrid();
-
- draw_cfra_time(spacedata);
- draw_ob_keys();
- draw_markers_time(0);
-
- /* restore viewport */
- mywinset(curarea->win);
-
- /* ortho at pixel level curarea */
- myortho2(-0.375, curarea->winx-0.375, -0.375, curarea->winy-0.375);
-
- /* the bottom with time values */
- BIF_ThemeColor(TH_HEADER);
- glRectf(0.0f, 0.0f, (float)curarea->winx, 12.0f);
- BIF_ThemeColorShade(TH_HEADER, 50);
- fdrawline(0.0f, 12.0f, (float)curarea->winx, 12.0f);
- draw_view2d_numbers_horiz(stime->flag & TIME_DRAWFRAMES);
-
- draw_area_emboss(sa);
- curarea->win_swap= WIN_BACK_OK;
-}
diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c
deleted file mode 100644
index 5568cc17231..00000000000
--- a/source/blender/src/drawview.c
+++ /dev/null
@@ -1,3633 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-//#define NAN_LINEAR_PHYSICS
-
-#include <math.h>
-#include <string.h>
-
-#ifndef WIN32
-#include <unistd.h>
-#include <sys/times.h>
-#else
-#include <io.h>
-#endif
-
-#ifdef WIN32
-#ifndef snprintf
-#define snprintf _snprintf
-#endif
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "PIL_time.h"
-
-#include "BMF_Api.h"
-
-#include "IMB_imbuf_types.h"
-#include "IMB_imbuf.h"
-
-#include "DNA_action_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_brush_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_group_types.h"
-#include "DNA_image_types.h"
-#include "DNA_key_types.h"
-#include "DNA_lattice_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_meta_types.h"
-#include "DNA_modifier_types.h"
-#include "DNA_object_force.h"
-#include "DNA_object_types.h"
-#include "DNA_particle_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_space_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_world_types.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_editVert.h"
-
-#include "BKE_action.h"
-#include "BKE_armature.h"
-#include "BKE_anim.h"
-#include "BKE_constraint.h"
-#include "BKE_curve.h"
-#include "BKE_customdata.h"
-#include "BKE_displist.h"
-#include "BKE_depsgraph.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_global.h"
-#include "BKE_lattice.h"
-#include "BKE_library.h"
-#include "BKE_image.h"
-#include "BKE_ipo.h"
-#include "BKE_key.h"
-#include "BKE_main.h"
-#include "BKE_mesh.h"
-#include "BKE_modifier.h"
-#include "BKE_object.h"
-#include "BKE_particle.h"
-#include "BKE_pointcache.h"
-#include "BKE_scene.h"
-#include "BKE_texture.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_butspace.h"
-#include "BIF_drawimage.h"
-#include "BIF_editgroup.h"
-#include "BIF_editarmature.h"
-#include "BIF_editmesh.h"
-#include "BIF_editparticle.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-#include "BIF_interface.h"
-#include "BIF_interface_icons.h"
-#include "BIF_mywindow.h"
-#include "BIF_poseobject.h"
-#include "BIF_previewrender.h"
-#include "BIF_resources.h"
-#include "BIF_retopo.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-
-#ifdef WITH_VERSE
-#include "BIF_verse.h"
-#endif
-
-#include "BDR_drawmesh.h"
-#include "BDR_drawobject.h"
-#include "BDR_editobject.h"
-#include "BDR_vpaint.h"
-#include "BDR_sculptmode.h"
-
-#include "BSE_drawview.h"
-#include "BSE_filesel.h"
-#include "BSE_headerbuttons.h"
-#include "BSE_seqaudio.h"
-#include "BSE_sequence.h"
-#include "BSE_trans_types.h"
-#include "BSE_time.h"
-#include "BSE_view.h"
-
-#include "BPY_extern.h"
-
-#include "RE_render_ext.h"
-
-#include "blendef.h"
-#include "mydevice.h"
-#include "butspace.h" // event codes
-
-#include "BIF_transform.h"
-
-#include "RE_pipeline.h" // make_stars
-
-#include "multires.h"
-
-/* For MULTISAMPLE_ARB #define.
- Note that older systems like irix
- may not have this, and will need a #ifdef
- to disable it.*/
-/* #include "GL/glext.h" Disabled for release, to avoid possibly breaking platforms.
- Instead, the define we need will just be #defined if it's not in the platform opengl.h.
-*/
-
-/* Modules used */
-#include "radio.h"
-
-/* locals */
-void drawname(Object *ob);
-
-static void star_stuff_init_func(void)
-{
- cpack(-1);
- glPointSize(1.0);
- glBegin(GL_POINTS);
-}
-static void star_stuff_vertex_func(float* i)
-{
- glVertex3fv(i);
-}
-static void star_stuff_term_func(void)
-{
- glEnd();
-}
-
-void default_gl_light(void)
-{
- int a;
-
- /* initialize */
- if(U.light[0].flag==0 && U.light[1].flag==0 && U.light[2].flag==0) {
- U.light[0].flag= 1;
- U.light[0].vec[0]= -0.3; U.light[0].vec[1]= 0.3; U.light[0].vec[2]= 0.9;
- U.light[0].col[0]= 0.8; U.light[0].col[1]= 0.8; U.light[0].col[2]= 0.8;
- U.light[0].spec[0]= 0.5; U.light[0].spec[1]= 0.5; U.light[0].spec[2]= 0.5;
- U.light[0].spec[3]= 1.0;
-
- U.light[1].flag= 0;
- U.light[1].vec[0]= 0.5; U.light[1].vec[1]= 0.5; U.light[1].vec[2]= 0.1;
- U.light[1].col[0]= 0.4; U.light[1].col[1]= 0.4; U.light[1].col[2]= 0.8;
- U.light[1].spec[0]= 0.3; U.light[1].spec[1]= 0.3; U.light[1].spec[2]= 0.5;
- U.light[1].spec[3]= 1.0;
-
- U.light[2].flag= 0;
- U.light[2].vec[0]= 0.3; U.light[2].vec[1]= -0.3; U.light[2].vec[2]= -0.2;
- U.light[2].col[0]= 0.8; U.light[2].col[1]= 0.5; U.light[2].col[2]= 0.4;
- U.light[2].spec[0]= 0.5; U.light[2].spec[1]= 0.4; U.light[2].spec[2]= 0.3;
- U.light[2].spec[3]= 1.0;
- }
-
-
- glLightfv(GL_LIGHT0, GL_POSITION, U.light[0].vec);
- glLightfv(GL_LIGHT0, GL_DIFFUSE, U.light[0].col);
- glLightfv(GL_LIGHT0, GL_SPECULAR, U.light[0].spec);
-
- glLightfv(GL_LIGHT1, GL_POSITION, U.light[1].vec);
- glLightfv(GL_LIGHT1, GL_DIFFUSE, U.light[1].col);
- glLightfv(GL_LIGHT1, GL_SPECULAR, U.light[1].spec);
-
- glLightfv(GL_LIGHT2, GL_POSITION, U.light[2].vec);
- glLightfv(GL_LIGHT2, GL_DIFFUSE, U.light[2].col);
- glLightfv(GL_LIGHT2, GL_SPECULAR, U.light[2].spec);
-
- for(a=0; a<8; a++) {
- if(a<3) {
- if(U.light[a].flag) glEnable(GL_LIGHT0+a);
- else glDisable(GL_LIGHT0+a);
-
- // clear stuff from other opengl lamp usage
- glLightf(GL_LIGHT0+a, GL_SPOT_CUTOFF, 180.0);
- glLightf(GL_LIGHT0+a, GL_CONSTANT_ATTENUATION, 1.0);
- glLightf(GL_LIGHT0+a, GL_LINEAR_ATTENUATION, 0.0);
- }
- else glDisable(GL_LIGHT0+a);
- }
-
- glDisable(GL_LIGHTING);
-
- glDisable(GL_COLOR_MATERIAL);
-}
-
-/* also called when render 'ogl' */
-void init_gl_stuff(void)
-{
- float mat_ambient[] = { 0.0, 0.0, 0.0, 0.0 };
- float mat_specular[] = { 0.5, 0.5, 0.5, 1.0 };
- float mat_shininess[] = { 35.0 };
- int a, x, y;
- GLubyte pat[32*32];
- const GLubyte *patc= pat;
-
-
- glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, mat_ambient);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, mat_specular);
- glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, mat_specular);
- glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, mat_shininess);
-
- default_gl_light();
-
- /* no local viewer, looks ugly in ortho mode */
- /* glLightModelfv(GL_LIGHT_MODEL_LOCAL_VIEWER, &one); */
-
- glDepthFunc(GL_LEQUAL);
- /* scaling matrices */
- glEnable(GL_NORMALIZE);
-
- glShadeModel(GL_FLAT);
-
- glDisable(GL_ALPHA_TEST);
- glDisable(GL_BLEND);
- glDisable(GL_DEPTH_TEST);
- glDisable(GL_FOG);
- glDisable(GL_LIGHTING);
- glDisable(GL_LOGIC_OP);
- glDisable(GL_STENCIL_TEST);
- glDisable(GL_TEXTURE_1D);
- glDisable(GL_TEXTURE_2D);
-
- /* default on, disable/enable should be local per function */
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_NORMAL_ARRAY);
-
- glPixelTransferi(GL_MAP_COLOR, GL_FALSE);
- glPixelTransferi(GL_RED_SCALE, 1);
- glPixelTransferi(GL_RED_BIAS, 0);
- glPixelTransferi(GL_GREEN_SCALE, 1);
- glPixelTransferi(GL_GREEN_BIAS, 0);
- glPixelTransferi(GL_BLUE_SCALE, 1);
- glPixelTransferi(GL_BLUE_BIAS, 0);
- glPixelTransferi(GL_ALPHA_SCALE, 1);
- glPixelTransferi(GL_ALPHA_BIAS, 0);
-
- glPixelTransferi(GL_DEPTH_BIAS, 0);
- glPixelTransferi(GL_DEPTH_SCALE, 1);
- glDepthRange(0.0, 1.0);
-
- a= 0;
- for(x=0; x<32; x++) {
- for(y=0; y<4; y++) {
- if( (x) & 1) pat[a++]= 0x88;
- else pat[a++]= 0x22;
- }
- }
-
- glPolygonStipple(patc);
-
-
- init_realtime_GL();
-}
-
-void circf(float x, float y, float rad)
-{
- GLUquadricObj *qobj = gluNewQuadric();
-
- gluQuadricDrawStyle(qobj, GLU_FILL);
-
- glPushMatrix();
-
- glTranslatef(x, y, 0.);
-
- gluDisk( qobj, 0.0, rad, 32, 1);
-
- glPopMatrix();
-
- gluDeleteQuadric(qobj);
-}
-
-void circ(float x, float y, float rad)
-{
- GLUquadricObj *qobj = gluNewQuadric();
-
- gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
-
- glPushMatrix();
-
- glTranslatef(x, y, 0.);
-
- gluDisk( qobj, 0.0, rad, 32, 1);
-
- glPopMatrix();
-
- gluDeleteQuadric(qobj);
-}
-
-/* ********** ********** */
-
-static void draw_bgpic(void)
-{
- BGpic *bgpic;
- Image *ima;
- ImBuf *ibuf= NULL;
- float vec[4], fac, asp, zoomx, zoomy;
- float x1, y1, x2, y2, cx, cy;
-
- bgpic= G.vd->bgpic;
- if(bgpic==NULL) return;
-
- ima= bgpic->ima;
-
- if(ima)
- ibuf= BKE_image_get_ibuf(ima, &bgpic->iuser);
- if(ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL) )
- return;
- if(ibuf->channels!=4)
- return;
- if(ibuf->rect==NULL)
- IMB_rect_from_float(ibuf);
-
- if(G.vd->persp==2) {
- rctf vb;
-
- calc_viewborder(G.vd, &vb);
-
- x1= vb.xmin;
- y1= vb.ymin;
- x2= vb.xmax;
- y2= vb.ymax;
- }
- else {
- float sco[2];
-
- /* calc window coord */
- initgrabz(0.0, 0.0, 0.0);
- window_to_3d(vec, 1, 0);
- fac= MAX3( fabs(vec[0]), fabs(vec[1]), fabs(vec[1]) );
- fac= 1.0/fac;
-
- asp= ( (float)ibuf->y)/(float)ibuf->x;
-
- vec[0] = vec[1] = vec[2] = 0.0;
- view3d_project_float(curarea, vec, sco, G.vd->persmat);
- cx = sco[0];
- cy = sco[1];
-
- x1= cx+ fac*(bgpic->xof-bgpic->size);
- y1= cy+ asp*fac*(bgpic->yof-bgpic->size);
- x2= cx+ fac*(bgpic->xof+bgpic->size);
- y2= cy+ asp*fac*(bgpic->yof+bgpic->size);
- }
-
- /* complete clip? */
-
- if(x2 < 0 ) return;
- if(y2 < 0 ) return;
- if(x1 > curarea->winx ) return;
- if(y1 > curarea->winy ) return;
-
- zoomx= (x2-x1)/ibuf->x;
- zoomy= (y2-y1)/ibuf->y;
-
- /* for some reason; zoomlevels down refuses to use GL_ALPHA_SCALE */
- if(zoomx < 1.0f || zoomy < 1.0f) {
- float tzoom= MIN2(zoomx, zoomy);
- int mip= 0;
-
- if(ibuf->mipmap[0]==NULL)
- IMB_makemipmap(ibuf, 0);
-
- while(tzoom < 1.0f && mip<8 && ibuf->mipmap[mip]) {
- tzoom*= 2.0f;
- zoomx*= 2.0f;
- zoomy*= 2.0f;
- mip++;
- }
- if(mip>0)
- ibuf= ibuf->mipmap[mip-1];
- }
-
- if(G.vd->zbuf) glDisable(GL_DEPTH_TEST);
-
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
-
- glaDefine2DArea(&curarea->winrct);
-
- glEnable(GL_BLEND);
-
- glPixelZoom(zoomx, zoomy);
- glColor4f(1.0, 1.0, 1.0, 1.0-bgpic->blend);
- glaDrawPixelsTex(x1, y1, ibuf->x, ibuf->y, GL_UNSIGNED_BYTE, ibuf->rect);
-
- glPixelZoom(1.0, 1.0);
- glPixelTransferf(GL_ALPHA_SCALE, 1.0f);
-
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
-
- glDisable(GL_BLEND);
- if(G.vd->zbuf) glEnable(GL_DEPTH_TEST);
-
- areawinset(curarea->win); // restore viewport / scissor
-}
-
-static void drawgrid_draw(float wx, float wy, float x, float y, float dx)
-{
- float fx, fy;
-
- x+= (wx);
- y+= (wy);
- fx= x/dx;
- fx= x-dx*floor(fx);
-
- while(fx< curarea->winx) {
- fdrawline(fx, 0.0, fx, (float)curarea->winy);
- fx+= dx;
- }
-
- fy= y/dx;
- fy= y-dx*floor(fy);
-
-
- while(fy< curarea->winy) {
- fdrawline(0.0, fy, (float)curarea->winx, fy);
- fy+= dx;
- }
-
-}
-
-// not intern, called in editobject for constraint axis too
-void make_axis_color(char *col, char *col2, char axis)
-{
- if(axis=='x') {
- col2[0]= col[0]>219?255:col[0]+36;
- col2[1]= col[1]<26?0:col[1]-26;
- col2[2]= col[2]<26?0:col[2]-26;
- }
- else if(axis=='y') {
- col2[0]= col[0]<46?0:col[0]-36;
- col2[1]= col[1]>189?255:col[1]+66;
- col2[2]= col[2]<46?0:col[2]-36;
- }
- else {
- col2[0]= col[0]<26?0:col[0]-26;
- col2[1]= col[1]<26?0:col[1]-26;
- col2[2]= col[2]>209?255:col[2]+46;
- }
-
-}
-
-static void drawgrid(void)
-{
- /* extern short bgpicmode; */
- float wx, wy, x, y, fw, fx, fy, dx;
- float vec4[4];
- char col[3], col2[3];
- short sublines = G.vd->gridsubdiv;
-
- vec4[0]=vec4[1]=vec4[2]=0.0;
- vec4[3]= 1.0;
- Mat4MulVec4fl(G.vd->persmat, vec4);
- fx= vec4[0];
- fy= vec4[1];
- fw= vec4[3];
-
- wx= (curarea->winx/2.0); /* because of rounding errors, grid at wrong location */
- wy= (curarea->winy/2.0);
-
- x= (wx)*fx/fw;
- y= (wy)*fy/fw;
-
- vec4[0]=vec4[1]=G.vd->grid;
- vec4[2]= 0.0;
- vec4[3]= 1.0;
- Mat4MulVec4fl(G.vd->persmat, vec4);
- fx= vec4[0];
- fy= vec4[1];
- fw= vec4[3];
-
- dx= fabs(x-(wx)*fx/fw);
- if(dx==0) dx= fabs(y-(wy)*fy/fw);
-
- glDepthMask(0); // disable write in zbuffer
-
- /* check zoom out */
- BIF_ThemeColor(TH_GRID);
- persp(PERSP_WIN);
-
- if(dx<6.0) {
- G.vd->gridview*= sublines;
- dx*= sublines;
-
- if(dx<6.0) {
- G.vd->gridview*= sublines;
- dx*= sublines;
-
- if(dx<6.0) {
- G.vd->gridview*= sublines;
- dx*=sublines;
- if(dx<6.0);
- else {
- BIF_ThemeColor(TH_GRID);
- drawgrid_draw(wx, wy, x, y, dx);
- }
- }
- else { // start blending out
- BIF_ThemeColorBlend(TH_BACK, TH_GRID, dx/60.0);
- drawgrid_draw(wx, wy, x, y, dx);
-
- BIF_ThemeColor(TH_GRID);
- drawgrid_draw(wx, wy, x, y, sublines*dx);
- }
- }
- else { // start blending out (6 < dx < 60)
- BIF_ThemeColorBlend(TH_BACK, TH_GRID, dx/60.0);
- drawgrid_draw(wx, wy, x, y, dx);
-
- BIF_ThemeColor(TH_GRID);
- drawgrid_draw(wx, wy, x, y, sublines*dx);
- }
- }
- else {
- if(dx>60.0) { // start blending in
- G.vd->gridview/= sublines;
- dx/= sublines;
- if(dx>60.0) { // start blending in
- G.vd->gridview/= sublines;
- dx/= sublines;
- if(dx>60.0) {
- BIF_ThemeColor(TH_GRID);
- drawgrid_draw(wx, wy, x, y, dx);
- }
- else {
- BIF_ThemeColorBlend(TH_BACK, TH_GRID, dx/60.0);
- drawgrid_draw(wx, wy, x, y, dx);
- BIF_ThemeColor(TH_GRID);
- drawgrid_draw(wx, wy, x, y, dx*sublines);
- }
- }
- else {
- BIF_ThemeColorBlend(TH_BACK, TH_GRID, dx/60.0);
- drawgrid_draw(wx, wy, x, y, dx);
- BIF_ThemeColor(TH_GRID);
- drawgrid_draw(wx, wy, x, y, dx*sublines);
- }
- }
- else {
- BIF_ThemeColorBlend(TH_BACK, TH_GRID, dx/60.0);
- drawgrid_draw(wx, wy, x, y, dx);
- BIF_ThemeColor(TH_GRID);
- drawgrid_draw(wx, wy, x, y, dx*sublines);
- }
- }
-
- x+= (wx);
- y+= (wy);
- BIF_GetThemeColor3ubv(TH_GRID, col);
-
- setlinestyle(0);
-
- /* center cross */
- if(G.vd->view==3) make_axis_color(col, col2, 'y');
- else make_axis_color(col, col2, 'x');
- glColor3ubv((GLubyte *)col2);
-
- fdrawline(0.0, y, (float)curarea->winx, y);
-
- if(G.vd->view==7) make_axis_color(col, col2, 'y');
- else make_axis_color(col, col2, 'z');
- glColor3ubv((GLubyte *)col2);
-
- fdrawline(x, 0.0, x, (float)curarea->winy);
-
- glDepthMask(1); // enable write in zbuffer
- persp(PERSP_VIEW);
-}
-
-
-
-static void drawfloor(void)
-{
- View3D *vd;
- float vert[3], grid;
- int a, gridlines, emphasise;
- char col[3], col2[3];
- short draw_line = 0;
-
- vd= curarea->spacedata.first;
-
- vert[2]= 0.0;
-
- if(vd->gridlines<3) return;
-
- if(G.vd->zbuf && G.obedit) glDepthMask(0); // for zbuffer-select
-
- gridlines= vd->gridlines/2;
- grid= gridlines*vd->grid;
-
- BIF_GetThemeColor3ubv(TH_GRID, col);
- BIF_GetThemeColor3ubv(TH_BACK, col2);
-
- /* emphasise division lines lighter instead of darker, if background is darker than grid */
- if ( ((col[0]+col[1]+col[2])/3+10) > (col2[0]+col2[1]+col2[2])/3 )
- emphasise = 20;
- else
- emphasise = -10;
-
- /* draw the Y axis and/or grid lines */
- for(a= -gridlines;a<=gridlines;a++) {
- if(a==0) {
- /* check for the 'show Y axis' preference */
- if (vd->gridflag & V3D_SHOW_Y) {
- make_axis_color(col, col2, 'y');
- glColor3ubv((GLubyte *)col2);
-
- draw_line = 1;
- } else if (vd->gridflag & V3D_SHOW_FLOOR) {
- BIF_ThemeColorShade(TH_GRID, emphasise);
- } else {
- draw_line = 0;
- }
- } else {
- /* check for the 'show grid floor' preference */
- if (vd->gridflag & V3D_SHOW_FLOOR) {
- if( (a % 10)==0) {
- BIF_ThemeColorShade(TH_GRID, emphasise);
- }
- else BIF_ThemeColorShade(TH_GRID, 10);
-
- draw_line = 1;
- } else {
- draw_line = 0;
- }
- }
-
- if (draw_line) {
- glBegin(GL_LINE_STRIP);
- vert[0]= a*vd->grid;
- vert[1]= grid;
- glVertex3fv(vert);
- vert[1]= -grid;
- glVertex3fv(vert);
- glEnd();
- }
- }
-
- /* draw the X axis and/or grid lines */
- for(a= -gridlines;a<=gridlines;a++) {
- if(a==0) {
- /* check for the 'show X axis' preference */
- if (vd->gridflag & V3D_SHOW_X) {
- make_axis_color(col, col2, 'x');
- glColor3ubv((GLubyte *)col2);
-
- draw_line = 1;
- } else if (vd->gridflag & V3D_SHOW_FLOOR) {
- BIF_ThemeColorShade(TH_GRID, emphasise);
- } else {
- draw_line = 0;
- }
- } else {
- /* check for the 'show grid floor' preference */
- if (vd->gridflag & V3D_SHOW_FLOOR) {
- if( (a % 10)==0) {
- BIF_ThemeColorShade(TH_GRID, emphasise);
- }
- else BIF_ThemeColorShade(TH_GRID, 10);
-
- draw_line = 1;
- } else {
- draw_line = 0;
- }
- }
-
- if (draw_line) {
- glBegin(GL_LINE_STRIP);
- vert[1]= a*vd->grid;
- vert[0]= grid;
- glVertex3fv(vert );
- vert[0]= -grid;
- glVertex3fv(vert);
- glEnd();
- }
- }
-
- /* draw the Z axis line */
- /* check for the 'show Z axis' preference */
- if (vd->gridflag & V3D_SHOW_Z) {
- make_axis_color(col, col2, 'z');
- glColor3ubv((GLubyte *)col2);
-
- glBegin(GL_LINE_STRIP);
- vert[0]= 0;
- vert[1]= 0;
- vert[2]= grid;
- glVertex3fv(vert );
- vert[2]= -grid;
- glVertex3fv(vert);
- glEnd();
- }
-
- if(G.vd->zbuf && G.obedit) glDepthMask(1);
-
-}
-
-static void drawcursor(View3D *v3d)
-{
- short mx,my,co[2];
- int flag;
-
- /* we dont want the clipping for cursor */
- flag= v3d->flag;
- v3d->flag= 0;
- project_short( give_cursor(), co);
- v3d->flag= flag;
-
- mx = co[0];
- my = co[1];
-
- if(mx!=IS_CLIPPED) {
- setlinestyle(0);
- cpack(0xFF);
- circ((float)mx, (float)my, 10.0);
- setlinestyle(4);
- cpack(0xFFFFFF);
- circ((float)mx, (float)my, 10.0);
- setlinestyle(0);
- cpack(0x0);
-
- sdrawline(mx-20, my, mx-5, my);
- sdrawline(mx+5, my, mx+20, my);
- sdrawline(mx, my-20, mx, my-5);
- sdrawline(mx, my+5, mx, my+20);
- }
-}
-
-/* ********* custom clipping *********** */
-
-static void view3d_draw_clipping(View3D *v3d)
-{
- BoundBox *bb= v3d->clipbb;
-
- BIF_ThemeColorShade(TH_BACK, -8);
-
- glBegin(GL_QUADS);
-
- glVertex3fv(bb->vec[0]); glVertex3fv(bb->vec[1]); glVertex3fv(bb->vec[2]); glVertex3fv(bb->vec[3]);
- glVertex3fv(bb->vec[0]); glVertex3fv(bb->vec[4]); glVertex3fv(bb->vec[5]); glVertex3fv(bb->vec[1]);
- glVertex3fv(bb->vec[4]); glVertex3fv(bb->vec[7]); glVertex3fv(bb->vec[6]); glVertex3fv(bb->vec[5]);
- glVertex3fv(bb->vec[7]); glVertex3fv(bb->vec[3]); glVertex3fv(bb->vec[2]); glVertex3fv(bb->vec[6]);
- glVertex3fv(bb->vec[1]); glVertex3fv(bb->vec[5]); glVertex3fv(bb->vec[6]); glVertex3fv(bb->vec[2]);
- glVertex3fv(bb->vec[7]); glVertex3fv(bb->vec[4]); glVertex3fv(bb->vec[0]); glVertex3fv(bb->vec[3]);
-
- glEnd();
-}
-
-void view3d_set_clipping(View3D *v3d)
-{
- double plane[4];
- int a;
-
- for(a=0; a<4; a++) {
- QUATCOPY(plane, v3d->clip[a]);
- glClipPlane(GL_CLIP_PLANE0+a, plane);
- glEnable(GL_CLIP_PLANE0+a);
- }
-}
-
-void view3d_clr_clipping(void)
-{
- int a;
-
- for(a=0; a<4; a++) {
- glDisable(GL_CLIP_PLANE0+a);
- }
-}
-
-int view3d_test_clipping(View3D *v3d, float *vec)
-{
- /* vec in world coordinates, returns 1 if clipped */
- float view[3];
-
- VECCOPY(view, vec);
-
- if(0.0f < v3d->clip[0][3] + INPR(view, v3d->clip[0]))
- if(0.0f < v3d->clip[1][3] + INPR(view, v3d->clip[1]))
- if(0.0f < v3d->clip[2][3] + INPR(view, v3d->clip[2]))
- if(0.0f < v3d->clip[3][3] + INPR(view, v3d->clip[3]))
- return 0;
-
- return 1;
-}
-
-/* ********* end custom clipping *********** */
-
-static void view3d_get_viewborder_size(View3D *v3d, float size_r[2])
-{
- float winmax= MAX2(v3d->area->winx, v3d->area->winy);
- float aspect= (float) (G.scene->r.xsch*G.scene->r.xasp)/(G.scene->r.ysch*G.scene->r.yasp);
-
- if(aspect>1.0) {
- size_r[0]= winmax;
- size_r[1]= winmax/aspect;
- } else {
- size_r[0]= winmax*aspect;
- size_r[1]= winmax;
- }
-}
-
-void calc_viewborder(struct View3D *v3d, rctf *viewborder_r)
-{
- float zoomfac, size[2];
- float dx= 0.0f, dy= 0.0f;
-
- view3d_get_viewborder_size(v3d, size);
-
- /* magic zoom calculation, no idea what
- * it signifies, if you find out, tell me! -zr
- */
- /* simple, its magic dude!
- * well, to be honest, this gives a natural feeling zooming
- * with multiple keypad presses (ton)
- */
-
- zoomfac= (M_SQRT2 + v3d->camzoom/50.0);
- zoomfac= (zoomfac*zoomfac)*0.25;
-
- size[0]= size[0]*zoomfac;
- size[1]= size[1]*zoomfac;
-
- /* center in window */
- viewborder_r->xmin= 0.5*v3d->area->winx - 0.5*size[0];
- viewborder_r->ymin= 0.5*v3d->area->winy - 0.5*size[1];
- viewborder_r->xmax= viewborder_r->xmin + size[0];
- viewborder_r->ymax= viewborder_r->ymin + size[1];
-
- dx= v3d->area->winx*G.vd->camdx*zoomfac*2.0f;
- dy= v3d->area->winy*G.vd->camdy*zoomfac*2.0f;
-
- /* apply offset */
- viewborder_r->xmin-= dx;
- viewborder_r->ymin-= dy;
- viewborder_r->xmax-= dx;
- viewborder_r->ymax-= dy;
-
- if(v3d->camera && v3d->camera->type==OB_CAMERA) {
- Camera *cam= v3d->camera->data;
- float w = viewborder_r->xmax - viewborder_r->xmin;
- float h = viewborder_r->ymax - viewborder_r->ymin;
- float side = MAX2(w, h);
-
- viewborder_r->xmin+= cam->shiftx*side;
- viewborder_r->xmax+= cam->shiftx*side;
- viewborder_r->ymin+= cam->shifty*side;
- viewborder_r->ymax+= cam->shifty*side;
- }
-}
-
-void view3d_set_1_to_1_viewborder(View3D *v3d)
-{
- float size[2];
- int im_width= (G.scene->r.size*G.scene->r.xsch)/100;
-
- view3d_get_viewborder_size(v3d, size);
-
- v3d->camzoom= (sqrt(4.0*im_width/size[0]) - M_SQRT2)*50.0;
- v3d->camzoom= CLAMPIS(v3d->camzoom, -30, 300);
-}
-
-
-static void drawviewborder_flymode(void)
-{
- /* draws 4 edge brackets that frame the safe area where the
- mouse can move during fly mode without spinning the view */
- float x1, x2, y1, y2;
-
- x1= 0.45*(float)curarea->winx;
- y1= 0.45*(float)curarea->winy;
- x2= 0.55*(float)curarea->winx;
- y2= 0.55*(float)curarea->winy;
- cpack(0);
-
-
- glBegin(GL_LINES);
- /* bottom left */
- glVertex2f(x1,y1);
- glVertex2f(x1,y1+5);
-
- glVertex2f(x1,y1);
- glVertex2f(x1+5,y1);
-
- /* top right */
- glVertex2f(x2,y2);
- glVertex2f(x2,y2-5);
-
- glVertex2f(x2,y2);
- glVertex2f(x2-5,y2);
-
- /* top left */
- glVertex2f(x1,y2);
- glVertex2f(x1,y2-5);
-
- glVertex2f(x1,y2);
- glVertex2f(x1+5,y2);
-
- /* bottom right */
- glVertex2f(x2,y1);
- glVertex2f(x2,y1+5);
-
- glVertex2f(x2,y1);
- glVertex2f(x2-5,y1);
- glEnd();
-}
-
-
-static void drawviewborder(void)
-{
- extern void gl_round_box(int mode, float minx, float miny, float maxx, float maxy, float rad); // interface_panel.c
- float fac, a;
- float x1, x2, y1, y2;
- float x3, y3, x4, y4;
- rctf viewborder;
- Camera *ca= NULL;
-
- if(G.vd->camera==NULL)
- return;
- if(G.vd->camera->type==OB_CAMERA)
- ca = G.vd->camera->data;
-
- calc_viewborder(G.vd, &viewborder);
- x1= viewborder.xmin;
- y1= viewborder.ymin;
- x2= viewborder.xmax;
- y2= viewborder.ymax;
-
- /* passepartout, specified in camera edit buttons */
- if (ca && (ca->flag & CAM_SHOWPASSEPARTOUT) && ca->passepartalpha > 0.000001) {
- if (ca->passepartalpha == 1.0) {
- glColor3f(0, 0, 0);
- } else {
- glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
- glEnable(GL_BLEND);
- glColor4f(0, 0, 0, ca->passepartalpha);
- }
- if (x1 > 0.0)
- glRectf(0.0, (float)curarea->winy, x1, 0.0);
- if (x2 < (float)curarea->winx)
- glRectf(x2, (float)curarea->winy, (float)curarea->winx, 0.0);
- if (y2 < (float)curarea->winy)
- glRectf(x1, (float)curarea->winy, x2, y2);
- if (y2 > 0.0)
- glRectf(x1, y1, x2, 0.0);
-
- glDisable(GL_BLEND);
- }
-
- /* edge */
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
-
- setlinestyle(0);
- BIF_ThemeColor(TH_BACK);
- glRectf(x1, y1, x2, y2);
-
- setlinestyle(3);
- BIF_ThemeColor(TH_WIRE);
- glRectf(x1, y1, x2, y2);
-
- /* camera name - draw in highlighted text color */
- if (ca && (ca->flag & CAM_SHOWNAME)) {
- BIF_ThemeColor(TH_TEXT_HI);
- glRasterPos2f(x1, y1-15);
-
- BMF_DrawString(G.font, G.vd->camera->id.name+2);
- BIF_ThemeColor(TH_WIRE);
- }
-
-
- /* border */
- if(G.scene->r.mode & R_BORDER) {
-
- cpack(0);
- x3= x1+ G.scene->r.border.xmin*(x2-x1);
- y3= y1+ G.scene->r.border.ymin*(y2-y1);
- x4= x1+ G.scene->r.border.xmax*(x2-x1);
- y4= y1+ G.scene->r.border.ymax*(y2-y1);
-
- cpack(0x4040FF);
- glRectf(x3, y3, x4, y4);
- }
-
- /* safety border */
- if (ca && (ca->flag & CAM_SHOWTITLESAFE)) {
- fac= 0.1;
-
- a= fac*(x2-x1);
- x1+= a;
- x2-= a;
-
- a= fac*(y2-y1);
- y1+= a;
- y2-= a;
-
- BIF_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0);
-
- uiSetRoundBox(15);
- gl_round_box(GL_LINE_LOOP, x1, y1, x2, y2, 12.0);
- }
-
- setlinestyle(0);
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-
-}
-
-void backdrawview3d(int test)
-{
- struct Base *base;
-
-/*for 2.43 release, don't use glext and just define the constant.
- this to avoid possibly breaking platforms before release.*/
-#ifndef GL_MULTISAMPLE_ARB
- #define GL_MULTISAMPLE_ARB 0x809D
-#endif
-
-#ifdef GL_MULTISAMPLE_ARB
- int m;
-#endif
-
- if(G.f & G_VERTEXPAINT || G.f & G_WEIGHTPAINT || G.f & G_TEXTUREPAINT);
- else if(G.obedit && G.vd->drawtype>OB_WIRE && (G.vd->flag & V3D_ZBUF_SELECT));
- else {
- G.vd->flag &= ~V3D_NEEDBACKBUFDRAW;
- return;
- }
-
- if( !(G.vd->flag & V3D_NEEDBACKBUFDRAW) ) return;
-
- if(test) {
- if(qtest()) {
- addafterqueue(curarea->win, BACKBUFDRAW, 1);
- return;
- }
- }
- persp(PERSP_VIEW);
-
- /*Disable FSAA for backbuffer selection.
-
- Only works if GL_MULTISAMPLE_ARB is defined by the header
- file, which is should be for every OS that supports FSAA.*/
-
-#ifdef GL_MULTISAMPLE_ARB
- m = glIsEnabled(GL_MULTISAMPLE_ARB);
- if (m) glDisable(GL_MULTISAMPLE_ARB);
-#endif
-
-#ifdef __APPLE__
- glDrawBuffer(GL_AUX0);
-#endif
- if(G.vd->drawtype > OB_WIRE) G.vd->zbuf= TRUE;
- curarea->win_swap &= ~WIN_BACK_OK;
-
- glDisable(GL_DITHER);
-
- glClearColor(0.0, 0.0, 0.0, 0.0);
- if(G.vd->zbuf) {
- glEnable(GL_DEPTH_TEST);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- }
- else {
- glClear(GL_COLOR_BUFFER_BIT);
- glDisable(GL_DEPTH_TEST);
- }
-
- if(G.vd->flag & V3D_CLIPPING)
- view3d_set_clipping(G.vd);
-
- G.f |= G_BACKBUFSEL;
-
- base= (G.scene->basact);
- if(base && (base->lay & G.vd->lay)) {
- draw_object_backbufsel(base->object);
- }
-
- G.vd->flag &= ~V3D_NEEDBACKBUFDRAW;
-
- G.f &= ~G_BACKBUFSEL;
- G.vd->zbuf= FALSE;
- glDisable(GL_DEPTH_TEST);
- glEnable(GL_DITHER);
-
-#ifdef __APPLE__
- glDrawBuffer(GL_BACK); /* we were in aux buffers */
-#endif
-
- if(G.vd->flag & V3D_CLIPPING)
- view3d_clr_clipping();
-
-#ifdef GL_MULTISAMPLE_ARB
- if (m) glEnable(GL_MULTISAMPLE_ARB);
-#endif
-
- /* it is important to end a view in a transform compatible with buttons */
- persp(PERSP_WIN); // set ortho
- bwin_scalematrix(curarea->win, G.vd->blockscale, G.vd->blockscale, G.vd->blockscale);
-
-}
-
-void check_backbuf(void)
-{
- if(G.vd->flag & V3D_NEEDBACKBUFDRAW)
- backdrawview3d(0);
-}
-
-/* samples a single pixel (copied from vpaint) */
-unsigned int sample_backbuf(int x, int y)
-{
- unsigned int col;
-
- if(x>=curarea->winx || y>=curarea->winy) return 0;
- x+= curarea->winrct.xmin;
- y+= curarea->winrct.ymin;
-
- check_backbuf(); // actually not needed for apple
-
-#ifdef __APPLE__
- glReadBuffer(GL_AUX0);
-#endif
- glReadPixels(x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &col);
- glReadBuffer(GL_BACK);
-
- if(G.order==B_ENDIAN) SWITCH_INT(col);
-
- return framebuffer_to_index(col);
-}
-
-/* reads full rect, converts indices */
-ImBuf *read_backbuf(short xmin, short ymin, short xmax, short ymax)
-{
- unsigned int *dr, *rd;
- struct ImBuf *ibuf, *ibuf1;
- int a;
- short xminc, yminc, xmaxc, ymaxc, xs, ys;
-
- /* clip */
- if(xmin<0) xminc= 0; else xminc= xmin;
- if(xmax>=curarea->winx) xmaxc= curarea->winx-1; else xmaxc= xmax;
- if(xminc > xmaxc) return NULL;
-
- if(ymin<0) yminc= 0; else yminc= ymin;
- if(ymax>=curarea->winy) ymaxc= curarea->winy-1; else ymaxc= ymax;
- if(yminc > ymaxc) return NULL;
-
- ibuf= IMB_allocImBuf((xmaxc-xminc+1), (ymaxc-yminc+1), 32, IB_rect,0);
-
- check_backbuf(); // actually not needed for apple
-
-#ifdef __APPLE__
- glReadBuffer(GL_AUX0);
-#endif
- glReadPixels(curarea->winrct.xmin+xminc, curarea->winrct.ymin+yminc, (xmaxc-xminc+1), (ymaxc-yminc+1), GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
- glReadBuffer(GL_BACK);
-
- if(G.order==B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf);
-
- a= (xmaxc-xminc+1)*(ymaxc-yminc+1);
- dr= ibuf->rect;
- while(a--) {
- if(*dr) *dr= framebuffer_to_index(*dr);
- dr++;
- }
-
- /* put clipped result back, if needed */
- if(xminc==xmin && xmaxc==xmax && yminc==ymin && ymaxc==ymax)
- return ibuf;
-
- ibuf1= IMB_allocImBuf( (xmax-xmin+1),(ymax-ymin+1),32,IB_rect,0);
- rd= ibuf->rect;
- dr= ibuf1->rect;
-
- for(ys= ymin; ys<=ymax; ys++) {
- for(xs= xmin; xs<=xmax; xs++, dr++) {
- if( xs>=xminc && xs<=xmaxc && ys>=yminc && ys<=ymaxc) {
- *dr= *rd;
- rd++;
- }
- }
- }
- IMB_freeImBuf(ibuf);
- return ibuf1;
-}
-
-/* smart function to sample a rect spiralling outside, nice for backbuf selection */
-unsigned int sample_backbuf_rect(short mval[2], int size, unsigned int min, unsigned int max, int *dist, short strict, unsigned int (*indextest)(unsigned int index))
-{
- struct ImBuf *buf;
- unsigned int *bufmin, *bufmax, *tbuf;
- int minx, miny;
- int a, b, rc, nr, amount, dirvec[4][2];
- int distance=0;
- unsigned int index = 0;
- short indexok = 0;
-
- amount= (size-1)/2;
-
- minx = mval[0]-(amount+1);
- miny = mval[1]-(amount+1);
- buf = read_backbuf(minx, miny, minx+size-1, miny+size-1);
- if (!buf) return 0;
-
- rc= 0;
-
- dirvec[0][0]= 1; dirvec[0][1]= 0;
- dirvec[1][0]= 0; dirvec[1][1]= -size;
- dirvec[2][0]= -1; dirvec[2][1]= 0;
- dirvec[3][0]= 0; dirvec[3][1]= size;
-
- bufmin = buf->rect;
- tbuf = buf->rect;
- bufmax = buf->rect + size*size;
- tbuf+= amount*size+ amount;
-
- for(nr=1; nr<=size; nr++) {
-
- for(a=0; a<2; a++) {
- for(b=0; b<nr; b++, distance++) {
- if (*tbuf && *tbuf>=min && *tbuf<max) { //we got a hit
- if(strict){
- indexok = indextest(*tbuf - min+1);
- if(indexok){
- *dist= (short) sqrt( (float)distance );
- index = *tbuf - min+1;
- goto exit;
- }
- }
- else{
- *dist= (short) sqrt( (float)distance ); // XXX, this distance is wrong -
- index = *tbuf - min+1; // messy yah, but indices start at 1
- goto exit;
- }
- }
-
- tbuf+= (dirvec[rc][0]+dirvec[rc][1]);
-
- if(tbuf<bufmin || tbuf>=bufmax) {
- goto exit;
- }
- }
- rc++;
- rc &= 3;
- }
- }
-
-exit:
- IMB_freeImBuf(buf);
- return index;
-}
-
-void drawname(Object *ob)
-{
- cpack(0x404040);
- glRasterPos3f(0.0, 0.0, 0.0);
-
- BMF_DrawString(G.font, " ");
- BMF_DrawString(G.font, ob->id.name+2);
-}
-
-
-static void draw_selected_name(Object *ob)
-{
- char info[128];
- short offset=30;
-
- if(ob->type==OB_ARMATURE) {
- bArmature *arm= ob->data;
- char *name= NULL;
-
- if(ob==G.obedit) {
- EditBone *ebo;
- for (ebo=G.edbo.first; ebo; ebo=ebo->next){
- if ((ebo->flag & BONE_ACTIVE) && (ebo->layer & arm->layer)) {
- name= ebo->name;
- break;
- }
- }
- }
- else if(ob->pose && (ob->flag & OB_POSEMODE)) {
- bPoseChannel *pchan;
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if((pchan->bone->flag & BONE_ACTIVE) && (pchan->bone->layer & arm->layer)) {
- name= pchan->name;
- break;
- }
- }
- }
- if(name)
- sprintf(info, "(%d) %s %s", CFRA, ob->id.name+2, name);
- else
- sprintf(info, "(%d) %s", CFRA, ob->id.name+2);
- }
- else if(ob->type==OB_MESH) {
- Key *key= NULL;
- KeyBlock *kb = NULL;
- char shapes[75];
-
- shapes[0] = 0;
- key = ob_get_key(ob);
- if(key){
- kb = BLI_findlink(&key->block, ob->shapenr-1);
- if(kb){
- sprintf(shapes, ": %s ", kb->name);
- if(ob->shapeflag == OB_SHAPE_LOCK){
- sprintf(shapes, "%s (Pinned)",shapes);
- }
- }
- }
- sprintf(info, "(%d) %s %s", CFRA, ob->id.name+2, shapes);
- }
- else sprintf(info, "(%d) %s", CFRA, ob->id.name+2);
-
- BIF_ThemeColor(TH_TEXT_HI);
- if (U.uiflag & USER_SHOW_ROTVIEWICON)
- offset = 14 + (U.rvisize * 2);
-
- glRasterPos2i(offset, 10);
- BMF_DrawString(G.fonts, info);
-}
-
-
-/* Draw a live substitute of the view icon, which is always shown */
-static void draw_view_axis(void)
-{
- const float k = U.rvisize; /* axis size */
- const float toll = 0.5; /* used to see when view is quasi-orthogonal */
- const float start = k + 1.0; /* axis center in screen coordinates, x=y */
- float ydisp = 0.0; /* vertical displacement to allow obj info text */
-
- /* rvibright ranges approx. from original axis icon color to gizmo color */
- float bright = U.rvibright / 15.0f;
-
- unsigned char col[3];
- unsigned char gridcol[3];
- float colf[3];
-
- float vec[4];
- float dx, dy;
- float h, s, v;
-
- BIF_GetThemeColor3ubv(TH_GRID, (char *)gridcol);
-
- /* X */
- vec[0] = vec[3] = 1;
- vec[1] = vec[2] = 0;
- QuatMulVecf(G.vd->viewquat, vec);
-
- make_axis_color((char *)gridcol, (char *)col, 'x');
- rgb_to_hsv(col[0]/255.0f, col[1]/255.0f, col[2]/255.0f, &h, &s, &v);
- s = s<0.5 ? s+0.5 : 1.0;
- v = 0.3;
- v = (v<1.0-(bright) ? v+bright : 1.0);
- hsv_to_rgb(h, s, v, colf, colf+1, colf+2);
- glColor3fv(colf);
-
- dx = vec[0] * k;
- dy = vec[1] * k;
- fdrawline(start, start + ydisp, start + dx, start + dy + ydisp);
- if (fabs(dx) > toll || fabs(dy) > toll) {
- glRasterPos2i(start + dx + 2, start + dy + ydisp + 2);
- BMF_DrawString(G.fonts, "x");
- }
-
- /* Y */
- vec[1] = vec[3] = 1;
- vec[0] = vec[2] = 0;
- QuatMulVecf(G.vd->viewquat, vec);
-
- make_axis_color((char *)gridcol, (char *)col, 'y');
- rgb_to_hsv(col[0]/255.0f, col[1]/255.0f, col[2]/255.0f, &h, &s, &v);
- s = s<0.5 ? s+0.5 : 1.0;
- v = 0.3;
- v = (v<1.0-(bright) ? v+bright : 1.0);
- hsv_to_rgb(h, s, v, colf, colf+1, colf+2);
- glColor3fv(colf);
-
- dx = vec[0] * k;
- dy = vec[1] * k;
- fdrawline(start, start + ydisp, start + dx, start + dy + ydisp);
- if (fabs(dx) > toll || fabs(dy) > toll) {
- glRasterPos2i(start + dx + 2, start + dy + ydisp + 2);
- BMF_DrawString(G.fonts, "y");
- }
-
- /* Z */
- vec[2] = vec[3] = 1;
- vec[1] = vec[0] = 0;
- QuatMulVecf(G.vd->viewquat, vec);
-
- make_axis_color((char *)gridcol, (char *)col, 'z');
- rgb_to_hsv(col[0]/255.0f, col[1]/255.0f, col[2]/255.0f, &h, &s, &v);
- s = s<0.5 ? s+0.5 : 1.0;
- v = 0.5;
- v = (v<1.0-(bright) ? v+bright : 1.0);
- hsv_to_rgb(h, s, v, colf, colf+1, colf+2);
- glColor3fv(colf);
-
- dx = vec[0] * k;
- dy = vec[1] * k;
- fdrawline(start, start + ydisp, start + dx, start + dy + ydisp);
- if (fabs(dx) > toll || fabs(dy) > toll) {
- glRasterPos2i(start + dx + 2, start + dy + ydisp + 2);
- BMF_DrawString(G.fonts, "z");
- }
-}
-
-
-static void draw_view_icon(void)
-{
- BIFIconID icon;
-
- if(G.vd->view==7) icon= ICON_AXIS_TOP;
- else if(G.vd->view==1) icon= ICON_AXIS_FRONT;
- else if(G.vd->view==3) icon= ICON_AXIS_SIDE;
- else return ;
-
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
- BIF_icon_draw(5.0, 5.0, icon);
-
- glDisable(GL_BLEND);
-}
-
-static void draw_viewport_name(ScrArea *sa)
-{
- char *name = NULL;
- char *printable = NULL;
-
- switch(G.vd->view) {
- case 1:
- if (G.vd->persp & V3D_PERSP_DO_3D_PERSP)
- name = (G.vd->flag2 & V3D_OPP_DIRECTION_NAME) ? "Back Persp" : "Front Persp";
- else
- name = (G.vd->flag2 & V3D_OPP_DIRECTION_NAME) ? "Back Ortho" : "Front Ortho";
- break;
- case 3:
- if (G.vd->persp & V3D_PERSP_DO_3D_PERSP)
- name = (G.vd->flag2 & V3D_OPP_DIRECTION_NAME) ? "Left Persp" : "Right Persp";
- else
- name = (G.vd->flag2 & V3D_OPP_DIRECTION_NAME) ? "Left Ortho" : "Right Ortho";
- break;
- case 7:
- if (G.vd->persp & V3D_PERSP_DO_3D_PERSP)
- name = (G.vd->flag2 & V3D_OPP_DIRECTION_NAME) ? "Bottom Persp" : "Top Persp";
- else
- name = (G.vd->flag2 & V3D_OPP_DIRECTION_NAME) ? "Bottom Ortho" : "Top Ortho";
- break;
- default:
- if (G.vd->persp==V3D_PERSP_USE_THE_CAMERA) {
- if ((G.vd->camera) && (G.vd->camera->type == OB_CAMERA)) {
- Camera *cam;
- cam = G.vd->camera->data;
- name = (cam->type != CAM_ORTHO) ? "Camera Persp" : "Camera Ortho";
- } else {
- name = "Object as Camera";
- }
- } else {
- name = (G.vd->persp & V3D_PERSP_DO_3D_PERSP) ? "User Persp" : "User Ortho";
- }
- }
-
- if (G.vd->localview) {
- printable = malloc(strlen(name) + strlen(" (Local)_")); /* '_' gives space for '\0' */
- strcpy(printable, name);
- strcat(printable, " (Local)");
- } else {
- printable = name;
- }
-
- if (printable) {
- BIF_ThemeColor(TH_TEXT_HI);
- glRasterPos2i(10, sa->winy-20);
- BMF_DrawString(G.fonts, printable);
- }
-
- if (G.vd->localview) {
- free(printable);
- }
-}
-
-/* ******************* view3d space & buttons ************** */
-
-
-/* temporal struct for storing transform properties */
-typedef struct {
- float ob_eul[4]; // used for quat too....
- float ob_scale[3]; // need temp space due to linked values
- float ob_dims[3];
- short link_scale;
- float ve_median[5];
- int curdef;
- float *defweightp;
-} TransformProperties;
-
-/* is used for both read and write... */
-static void v3d_editvertex_buts(uiBlock *block, Object *ob, float lim)
-{
- EditMesh *em = G.editMesh;
- EditVert *eve, *evedef=NULL;
- EditEdge *eed;
- MDeformVert *dvert=NULL;
- TransformProperties *tfp= G.vd->properties_storage;
- float median[5];
- int tot, totw, totweight, totedge;
- char defstr[320];
-
- median[0]= median[1]= median[2]= median[3]= median[4]= 0.0;
- tot= totw= totweight= totedge= 0;
- defstr[0]= 0;
-
- if(ob->type==OB_MESH) {
- eve= em->verts.first;
- while(eve) {
- if(eve->f & 1) {
- evedef= eve;
- tot++;
- VecAddf(median, median, eve->co);
- }
- eve= eve->next;
- }
- eed= em->edges.first;
- while(eed) {
- if((eed->f & SELECT)) {
- totedge++;
- median[3]+= eed->crease;
- }
- eed= eed->next;
- }
-
- /* check for defgroups */
- if(evedef)
- dvert= CustomData_em_get(&em->vdata, evedef->data, CD_MDEFORMVERT);
- if(tot==1 && dvert && dvert->totweight) {
- bDeformGroup *dg;
- int i, max=1, init=1;
- char str[320];
-
- for (i=0; i<dvert->totweight; i++){
- dg = BLI_findlink (&ob->defbase, dvert->dw[i].def_nr);
- if(dg) {
- max+= snprintf(str, sizeof(str), "%s %%x%d|", dg->name, dvert->dw[i].def_nr);
- if(max<320) strcat(defstr, str);
- }
- else printf("oh no!\n");
- if(tfp->curdef==dvert->dw[i].def_nr) {
- init= 0;
- tfp->defweightp= &dvert->dw[i].weight;
- }
- }
-
- if(init) { // needs new initialized
- tfp->curdef= dvert->dw[0].def_nr;
- tfp->defweightp= &dvert->dw[0].weight;
- }
- }
- }
- else if(ob->type==OB_CURVE || ob->type==OB_SURF) {
- extern ListBase editNurb; /* editcurve.c */
- Nurb *nu;
- BPoint *bp;
- BezTriple *bezt;
- int a;
-
- nu= editNurb.first;
- while(nu) {
- if((nu->type & 7)==CU_BEZIER) {
- bezt= nu->bezt;
- a= nu->pntsu;
- while(a--) {
- if(bezt->f2 & SELECT) {
- VecAddf(median, median, bezt->vec[1]);
- tot++;
- median[4]+= bezt->weight;
- totweight++;
- }
- else {
- if(bezt->f1 & SELECT) {
- VecAddf(median, median, bezt->vec[0]);
- tot++;
- }
- if(bezt->f3 & SELECT) {
- VecAddf(median, median, bezt->vec[2]);
- tot++;
- }
- }
- bezt++;
- }
- }
- else {
- bp= nu->bp;
- a= nu->pntsu*nu->pntsv;
- while(a--) {
- if(bp->f1 & SELECT) {
- VecAddf(median, median, bp->vec);
- median[3]+= bp->vec[3];
- totw++;
- tot++;
- median[4]+= bp->weight;
- totweight++;
- }
- bp++;
- }
- }
- nu= nu->next;
- }
- }
- else if(ob->type==OB_LATTICE) {
- BPoint *bp;
- int a;
-
- a= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw;
- bp= editLatt->def;
- while(a--) {
- if(bp->f1 & SELECT) {
- VecAddf(median, median, bp->vec);
- tot++;
- median[4]+= bp->weight;
- totweight++;
- }
- bp++;
- }
- }
-
- if(tot==0) return;
-
- median[0] /= (float)tot;
- median[1] /= (float)tot;
- median[2] /= (float)tot;
- if(totedge) median[3] /= (float)totedge;
- else if(totw) median[3] /= (float)totw;
- if(totweight) median[4] /= (float)totweight;
-
- if(G.vd->flag & V3D_GLOBAL_STATS)
- Mat4MulVecfl(ob->obmat, median);
-
- if(block) { // buttons
- uiBlockBeginAlign(block);
- if((ob->parent) && (ob->partype == PARBONE)) {
- uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, REDRAWVIEW3D, "Global", 160, 135, 70, 19, &G.vd->flag, 0, 0, 0, 0, "Displays global values");
- uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, REDRAWVIEW3D, "Local", 230, 135, 70, 19, &G.vd->flag, 0, 0, 0, 0, "Displays local values");
- }
- else {
- uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, REDRAWVIEW3D, "Global", 160, 150, 70, 19, &G.vd->flag, 0, 0, 0, 0, "Displays global values");
- uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, REDRAWVIEW3D, "Local", 230, 150, 70, 19, &G.vd->flag, 0, 0, 0, 0, "Displays local values");
- }
-
- memcpy(tfp->ve_median, median, sizeof(tfp->ve_median));
-
- uiBlockBeginAlign(block);
- if(tot==1) {
- uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Vertex X:", 10, 110, 290, 19, &(tfp->ve_median[0]), -lim, lim, 10, 3, "");
- uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Vertex Y:", 10, 90, 290, 19, &(tfp->ve_median[1]), -lim, lim, 10, 3, "");
- uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Vertex Z:", 10, 70, 290, 19, &(tfp->ve_median[2]), -lim, lim, 10, 3, "");
- if(totw==1)
- uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Vertex W:", 10, 50, 290, 19, &(tfp->ve_median[3]), 0.01, 100.0, 10, 3, "");
- uiBlockEndAlign(block);
-
- if(defstr[0]) {
- uiDefBut(block, LABEL, 1, "Vertex Deform Groups", 10, 40, 290, 20, NULL, 0.0, 0.0, 0, 0, "");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_NOP, "Weight:", 10, 20, 150, 19, tfp->defweightp, 0.0f, 1.0f, 10, 3, "Weight value");
- uiDefButI(block, MENU, REDRAWVIEW3D, defstr, 160, 20, 140, 19, &tfp->curdef, 0.0, 0.0, 0, 0, "Current Vertex Group");
- uiBlockEndAlign(block);
- }
- else if(totweight)
- uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 10, 20, 290, 19, &(tfp->ve_median[4]), 0.0, 1.0, 10, 3, "");
-
- }
- else {
- uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Median X:", 10, 110, 290, 19, &(tfp->ve_median[0]), -lim, lim, 10, 3, "");
- uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Median Y:", 10, 90, 290, 19, &(tfp->ve_median[1]), -lim, lim, 10, 3, "");
- uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Median Z:", 10, 70, 290, 19, &(tfp->ve_median[2]), -lim, lim, 10, 3, "");
- if(totw==tot)
- uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Median W:", 10, 50, 290, 19, &(tfp->ve_median[3]), 0.01, 100.0, 10, 3, "");
- uiBlockEndAlign(block);
- if(totweight)
- uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 10, 20, 290, 19, &(tfp->ve_median[4]), 0.0, 1.0, 10, 3, "Weight is used for SoftBody Goal");
- }
-
- if(ob->type==OB_CURVE && (totw==0)) { /* bez curves have no w */
- uiBlockBeginAlign(block);
- uiDefBut(block, BUT,B_SETPT_AUTO,"Auto", 10, 44, 72, 19, 0, 0, 0, 0, 0, "Auto handles (Shift H)");
- uiDefBut(block, BUT,B_SETPT_VECTOR,"Vector",82, 44, 73, 19, 0, 0, 0, 0, 0, "Vector handles (V)");
- uiDefBut(block, BUT,B_SETPT_ALIGN,"Align",155, 44, 73, 19, 0, 0, 0, 0, 0, "Align handles (H Toggles)");
- uiDefBut(block, BUT,B_SETPT_FREE,"Free", 227, 44, 72, 19, 0, 0, 0, 0, 0, "Align handles (H Toggles)");
- uiBlockEndAlign(block);
- }
-
- if(totedge==1)
- uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Crease W:", 10, 30, 290, 19, &(tfp->ve_median[3]), 0.0, 1.0, 10, 3, "");
- else if(totedge>1)
- uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Median Crease W:", 10, 30, 290, 19, &(tfp->ve_median[3]), 0.0, 1.0, 10, 3, "");
-
- }
- else { // apply
-
- if(G.vd->flag & V3D_GLOBAL_STATS) {
- Mat4Invert(ob->imat, ob->obmat);
- Mat4MulVecfl(ob->imat, median);
- Mat4MulVecfl(ob->imat, tfp->ve_median);
- }
- VecSubf(median, tfp->ve_median, median);
- median[3]= tfp->ve_median[3]-median[3];
- median[4]= tfp->ve_median[4]-median[4];
-
- if(ob->type==OB_MESH) {
-
- eve= em->verts.first;
- while(eve) {
- if(eve->f & 1) {
- VecAddf(eve->co, eve->co, median);
- }
- eve= eve->next;
- }
-
- for(eed= em->edges.first; eed; eed= eed->next) {
- if(eed->f & SELECT) {
- /* ensure the median can be set to zero or one */
- if(tfp->ve_median[3]==0.0f) eed->crease= 0.0f;
- else if(tfp->ve_median[3]==1.0f) eed->crease= 1.0f;
- else {
- eed->crease+= median[3];
- CLAMP(eed->crease, 0.0, 1.0);
- }
- }
- }
-
- recalc_editnormals();
- }
- else if(ob->type==OB_CURVE || ob->type==OB_SURF) {
- extern ListBase editNurb; /* editcurve.c */
- Nurb *nu;
- BPoint *bp;
- BezTriple *bezt;
- int a;
-
- nu= editNurb.first;
- while(nu) {
- if((nu->type & 7)==1) {
- bezt= nu->bezt;
- a= nu->pntsu;
- while(a--) {
- if(bezt->f2 & SELECT) {
- VecAddf(bezt->vec[0], bezt->vec[0], median);
- VecAddf(bezt->vec[1], bezt->vec[1], median);
- VecAddf(bezt->vec[2], bezt->vec[2], median);
- bezt->weight+= median[4];
- }
- else {
- if(bezt->f1 & SELECT) {
- VecAddf(bezt->vec[0], bezt->vec[0], median);
- }
- if(bezt->f3 & SELECT) {
- VecAddf(bezt->vec[2], bezt->vec[2], median);
- }
- }
- bezt++;
- }
- }
- else {
- bp= nu->bp;
- a= nu->pntsu*nu->pntsv;
- while(a--) {
- if(bp->f1 & SELECT) {
- VecAddf(bp->vec, bp->vec, median);
- bp->vec[3]+= median[3];
- bp->weight+= median[4];
- }
- bp++;
- }
- }
- test2DNurb(nu);
- testhandlesNurb(nu); /* test for bezier too */
-
- nu= nu->next;
- }
- }
- else if(ob->type==OB_LATTICE) {
- BPoint *bp;
- int a;
-
- a= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw;
- bp= editLatt->def;
- while(a--) {
- if(bp->f1 & SELECT) {
- VecAddf(bp->vec, bp->vec, median);
- bp->weight+= median[4];
- }
- bp++;
- }
- }
-
- BIF_undo_push("Transform properties");
- }
-}
-
-/* assumes armature active */
-static void validate_bonebutton_cb(void *bonev, void *namev)
-{
- Object *ob= OBACT;
-
- if(ob && ob->type==OB_ARMATURE) {
- Bone *bone= bonev;
- char oldname[32], newname[32];
-
- /* need to be on the stack */
- BLI_strncpy(newname, bone->name, 32);
- BLI_strncpy(oldname, (char *)namev, 32);
- /* restore */
- BLI_strncpy(bone->name, oldname, 32);
-
- armature_bone_rename(ob->data, oldname, newname); // editarmature.c
- allqueue(REDRAWALL, 0);
- }
-}
-
-static void v3d_posearmature_buts(uiBlock *block, Object *ob, float lim)
-{
- uiBut *but;
- bArmature *arm;
- bPoseChannel *pchan;
- Bone *bone= NULL;
- TransformProperties *tfp= G.vd->properties_storage;
-
- arm = get_armature(OBACT);
- if (!arm || !ob->pose) return;
-
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- bone = pchan->bone;
- if(bone && (bone->flag & BONE_ACTIVE) && (bone->layer & arm->layer))
- break;
- }
- if (!pchan || !bone) return;
-
- if((ob->parent) && (ob->partype == PARBONE))
- but= uiDefBut (block, TEX, B_DIFF, "Bone:", 160, 130, 140, 19, bone->name, 1, 31, 0, 0, "");
- else
- but= uiDefBut(block, TEX, B_DIFF, "Bone:", 160, 140, 140, 19, bone->name, 1, 31, 0, 0, "");
- uiButSetFunc(but, validate_bonebutton_cb, bone, NULL);
-
- QuatToEul(pchan->quat, tfp->ob_eul);
- tfp->ob_eul[0]*= 180.0/M_PI;
- tfp->ob_eul[1]*= 180.0/M_PI;
- tfp->ob_eul[2]*= 180.0/M_PI;
-
- uiBlockBeginAlign(block);
- uiDefIconButBitS(block, ICONTOG, OB_LOCK_LOCX, REDRAWVIEW3D, ICON_UNLOCKED, 10,140,20,19, &(pchan->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
- uiDefButF(block, NUM, B_ARMATUREPANEL2, "LocX:", 30, 140, 120, 19, pchan->loc, -lim, lim, 100, 3, "");
- uiDefIconButBitS(block, ICONTOG, OB_LOCK_LOCY, REDRAWVIEW3D, ICON_UNLOCKED, 10,120,20,19, &(pchan->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
- uiDefButF(block, NUM, B_ARMATUREPANEL2, "LocY:", 30, 120, 120, 19, pchan->loc+1, -lim, lim, 100, 3, "");
- uiDefIconButBitS(block, ICONTOG, OB_LOCK_LOCZ, REDRAWVIEW3D, ICON_UNLOCKED, 10,100,20,19, &(pchan->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
- uiDefButF(block, NUM, B_ARMATUREPANEL2, "LocZ:", 30, 100, 120, 19, pchan->loc+2, -lim, lim, 100, 3, "");
-
- uiBlockBeginAlign(block);
- uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTX, REDRAWVIEW3D, ICON_UNLOCKED, 10,70,20,19, &(pchan->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
- uiDefButF(block, NUM, B_ARMATUREPANEL3, "RotX:", 30, 70, 120, 19, tfp->ob_eul, -1000.0, 1000.0, 100, 3, "");
- uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTY, REDRAWVIEW3D, ICON_UNLOCKED, 10,50,20,19, &(pchan->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
- uiDefButF(block, NUM, B_ARMATUREPANEL3, "RotY:", 30, 50, 120, 19, tfp->ob_eul+1, -1000.0, 1000.0, 100, 3, "");
- uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTZ, REDRAWVIEW3D, ICON_UNLOCKED, 10,30,20,19, &(pchan->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
- uiDefButF(block, NUM, B_ARMATUREPANEL3, "RotZ:", 30, 30, 120, 19, tfp->ob_eul+2, -1000.0, 1000.0, 100, 3, "");
-
- uiBlockBeginAlign(block);
- uiDefIconButBitS(block, ICONTOG, OB_LOCK_SCALEX, REDRAWVIEW3D, ICON_UNLOCKED, 160,70,20,19, &(pchan->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
- uiDefButF(block, NUM, B_ARMATUREPANEL2, "ScaleX:", 180, 70, 120, 19, pchan->size, -lim, lim, 10, 3, "");
- uiDefIconButBitS(block, ICONTOG, OB_LOCK_SCALEY, REDRAWVIEW3D, ICON_UNLOCKED, 160,50,20,19, &(pchan->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
- uiDefButF(block, NUM, B_ARMATUREPANEL2, "ScaleY:", 180, 50, 120, 19, pchan->size+1, -lim, lim, 10, 3, "");
- uiDefIconButBitS(block, ICONTOG, OB_LOCK_SCALEZ, REDRAWVIEW3D, ICON_UNLOCKED, 160,30,20,19, &(pchan->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
- uiDefButF(block, NUM, B_ARMATUREPANEL2, "ScaleZ:", 180, 30, 120, 19, pchan->size+2, -lim, lim, 10, 3, "");
- uiBlockEndAlign(block);
-}
-
-static void v3d_editarmature_buts(uiBlock *block, Object *ob, float lim)
-{
- bArmature *arm= G.obedit->data;
- EditBone *ebone;
- uiBut *but;
- TransformProperties *tfp= G.vd->properties_storage;
-
- ebone= G.edbo.first;
-
- for (ebone = G.edbo.first; ebone; ebone=ebone->next){
- if ((ebone->flag & BONE_ACTIVE) && (ebone->layer & arm->layer))
- break;
- }
-
- if (!ebone)
- return;
-
- if((ob->parent) && (ob->partype == PARBONE))
- but= uiDefBut(block, TEX, B_DIFF, "Bone:", 160, 130, 140, 19, ebone->name, 1, 31, 0, 0, "");
- else
- but= uiDefBut(block, TEX, B_DIFF, "Bone:", 160, 150, 140, 19, ebone->name, 1, 31, 0, 0, "");
- uiButSetFunc(but, validate_editbonebutton_cb, ebone, NULL);
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_ARMATUREPANEL1, "HeadX:", 10, 70, 140, 19, ebone->head, -lim, lim, 10, 3, "");
- uiDefButF(block, NUM, B_ARMATUREPANEL1, "HeadY:", 10, 50, 140, 19, ebone->head+1, -lim, lim, 10, 3, "");
- uiDefButF(block, NUM, B_ARMATUREPANEL1, "HeadZ:", 10, 30, 140, 19, ebone->head+2, -lim, lim, 10, 3, "");
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_ARMATUREPANEL1, "TailX:", 160, 70, 140, 19, ebone->tail, -lim, lim, 10, 3, "");
- uiDefButF(block, NUM, B_ARMATUREPANEL1, "TailY:", 160, 50, 140, 19, ebone->tail+1, -lim, lim, 10, 3, "");
- uiDefButF(block, NUM, B_ARMATUREPANEL1, "TailZ:", 160, 30, 140, 19, ebone->tail+2, -lim, lim, 10, 3, "");
- uiBlockEndAlign(block);
-
- tfp->ob_eul[0]= 180.0*ebone->roll/M_PI;
- uiDefButF(block, NUM, B_ARMATUREPANEL1, "Roll:", 10, 100, 140, 19, tfp->ob_eul, -lim, lim, 1000, 3, "");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_ARMATUREPANEL1, "TailRadius:", 10, 150, 140, 19, &ebone->rad_tail, 0, lim, 10, 3, "");
- if (ebone->parent && ebone->flag & BONE_CONNECTED )
- uiDefButF(block, NUM, B_ARMATUREPANEL1, "HeadRadius:", 10, 130, 140, 19, &ebone->parent->rad_tail, 0, lim, 10, 3, "");
- else
- uiDefButF(block, NUM, B_ARMATUREPANEL1, "HeadRadius:", 10, 130, 140, 19, &ebone->rad_head, 0, lim, 10, 3, "");
- uiBlockEndAlign(block);
-}
-
-static void v3d_editmetaball_buts(uiBlock *block, Object *ob, float lim)
-{
- extern MetaElem *lastelem;
-
- if(lastelem) {
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_RECALCMBALL, "LocX:", 10, 70, 140, 19, &lastelem->x, -lim, lim, 100, 3, "");
- uiDefButF(block, NUM, B_RECALCMBALL, "LocY:", 10, 50, 140, 19, &lastelem->y, -lim, lim, 100, 3, "");
- uiDefButF(block, NUM, B_RECALCMBALL, "LocZ:", 10, 30, 140, 19, &lastelem->z, -lim, lim, 100, 3, "");
-
- uiBlockBeginAlign(block);
- if(lastelem->type!=MB_BALL)
- uiDefButF(block, NUM, B_RECALCMBALL, "dx:", 160, 70, 140, 19, &lastelem->expx, 0, lim, 100, 3, "");
- if((lastelem->type!=MB_BALL) && (lastelem->type!=MB_TUBE))
- uiDefButF(block, NUM, B_RECALCMBALL, "dy:", 160, 50, 140, 19, &lastelem->expy, 0, lim, 100, 3, "");
- if((lastelem->type==MB_ELIPSOID) || (lastelem->type==MB_CUBE))
- uiDefButF(block, NUM, B_RECALCMBALL, "dz:", 160, 30, 140, 19, &lastelem->expz, 0, lim, 100, 3, "");
-
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, B_RECALCMBALL, "Radius:", 10, 120, 140, 19, &lastelem->rad, 0, lim, 100, 3, "Size of the active metaball");
- uiDefButF(block, NUM, B_RECALCMBALL, "Stiffness:", 10, 100, 140, 19, &lastelem->s, 0, 10, 100, 3, "Stiffness of the active metaball");
- uiBlockEndAlign(block);
-
- uiDefButS(block, MENU, B_RECALCMBALL, "Type%t|Ball%x0|Tube%x4|Plane%x5|Elipsoid%x6|Cube%x7", 160, 120, 140, 19, &lastelem->type, 0.0, 0.0, 0, 0, "Set active element type");
-
- }
-}
-
-void do_viewbuts(unsigned short event)
-{
- BoundBox *bb;
- View3D *vd;
- Object *ob= OBACT;
- TransformProperties *tfp= G.vd->properties_storage;
-
- vd= G.vd;
- if(vd==NULL) return;
-
- switch(event) {
-
- case B_OBJECTPANEL:
- DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
- allqueue(REDRAWVIEW3D, 1);
- break;
-
- case B_OBJECTPANELROT:
- if(ob) {
- ob->rot[0]= M_PI*tfp->ob_eul[0]/180.0;
- ob->rot[1]= M_PI*tfp->ob_eul[1]/180.0;
- ob->rot[2]= M_PI*tfp->ob_eul[2]/180.0;
- DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
- allqueue(REDRAWVIEW3D, 1);
- }
- break;
-
- case B_OBJECTPANELSCALE:
- if(ob) {
-
- /* link scale; figure out which axis changed */
- if (tfp->link_scale) {
- float ratio, tmp, max = 0.0;
- int axis;
-
- axis = 0;
- max = fabs(tfp->ob_scale[0] - ob->size[0]);
- tmp = fabs(tfp->ob_scale[1] - ob->size[1]);
- if (tmp > max) {
- axis = 1;
- max = tmp;
- }
- tmp = fabs(tfp->ob_scale[2] - ob->size[2]);
- if (tmp > max) {
- axis = 2;
- max = tmp;
- }
-
- if (ob->size[axis] != tfp->ob_scale[axis]) {
- if (fabs(ob->size[axis]) > FLT_EPSILON) {
- ratio = tfp->ob_scale[axis] / ob->size[axis];
- ob->size[0] *= ratio;
- ob->size[1] *= ratio;
- ob->size[2] *= ratio;
- }
- }
- }
- else {
- VECCOPY(ob->size, tfp->ob_scale);
-
- }
- DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
- allqueue(REDRAWVIEW3D, 1);
- }
- break;
-
- case B_OBJECTPANELDIMS:
- bb= object_get_boundbox(ob);
- if(bb) {
- float old_dims[3], scale[3], ratio, len[3];
- int axis;
-
- Mat4ToSize(ob->obmat, scale);
-
- len[0] = bb->vec[4][0] - bb->vec[0][0];
- len[1] = bb->vec[2][1] - bb->vec[0][1];
- len[2] = bb->vec[1][2] - bb->vec[0][2];
-
- old_dims[0] = fabs(scale[0]) * len[0];
- old_dims[1] = fabs(scale[1]) * len[1];
- old_dims[2] = fabs(scale[2]) * len[2];
-
- /* for each axis changed */
- for (axis = 0; axis<3; axis++) {
- if (fabs(old_dims[axis] - tfp->ob_dims[axis]) > 0.0001) {
- if (old_dims[axis] > 0.0) {
- ratio = tfp->ob_dims[axis] / old_dims[axis];
- if (tfp->link_scale) {
- ob->size[0] *= ratio;
- ob->size[1] *= ratio;
- ob->size[2] *= ratio;
- break;
- }
- else {
- ob->size[axis] *= ratio;
- }
- }
- else {
- if (len[axis] > 0) {
- ob->size[axis] = tfp->ob_dims[axis] / len[axis];
- }
- }
- }
- }
-
- /* prevent multiple B_OBJECTPANELDIMS events to keep scaling, cycling with TAB on buttons can cause that */
- VECCOPY(tfp->ob_dims, old_dims);
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
- allqueue(REDRAWVIEW3D, 1);
- }
- break;
-
- case B_OBJECTPANELMEDIAN:
- if(ob) {
- v3d_editvertex_buts(NULL, ob, 1.0);
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 1);
- }
- break;
-
- /* note; this case also used for parbone */
- case B_OBJECTPANELPARENT:
- if(ob) {
- if(ob->id.lib || test_parent_loop(ob->parent, ob) )
- ob->parent= NULL;
- else {
- DAG_scene_sort(G.scene);
- DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
- }
- allqueue(REDRAWVIEW3D, 1);
- allqueue(REDRAWBUTSOBJECT, 0);
- }
- break;
-
- case B_ARMATUREPANEL1:
- {
- bArmature *arm= G.obedit->data;
- EditBone *ebone, *child;
-
- for (ebone = G.edbo.first; ebone; ebone=ebone->next){
- if ((ebone->flag & BONE_ACTIVE) && (ebone->layer & arm->layer))
- break;
- }
- if (ebone) {
- ebone->roll= M_PI*tfp->ob_eul[0]/180.0;
- // Update our parent
- if (ebone->parent && ebone->flag & BONE_CONNECTED){
- VECCOPY (ebone->parent->tail, ebone->head);
- }
-
- // Update our children if necessary
- for (child = G.edbo.first; child; child=child->next){
- if (child->parent == ebone && (child->flag & BONE_CONNECTED)){
- VECCOPY (child->head, ebone->tail);
- }
- }
- if(arm->flag & ARM_MIRROR_EDIT) {
- EditBone *eboflip= armature_bone_get_mirrored(ebone);
- if(eboflip) {
- eboflip->roll= -ebone->roll;
- eboflip->head[0]= -ebone->head[0];
- eboflip->tail[0]= -ebone->tail[0];
-
- // Update our parent
- if (eboflip->parent && eboflip->flag & BONE_CONNECTED){
- VECCOPY (eboflip->parent->tail, eboflip->head);
- }
-
- // Update our children if necessary
- for (child = G.edbo.first; child; child=child->next){
- if (child->parent == eboflip && (child->flag & BONE_CONNECTED)){
- VECCOPY (child->head, eboflip->tail);
- }
- }
- }
- }
-
- allqueue(REDRAWVIEW3D, 1);
- }
- }
- break;
- case B_ARMATUREPANEL3: // rotate button on channel
- {
- bArmature *arm;
- bPoseChannel *pchan;
- Bone *bone;
- float eul[3];
-
- arm = get_armature(OBACT);
- if (!arm || !ob->pose) return;
-
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- bone = pchan->bone;
- if(bone && (bone->flag & BONE_ACTIVE) && (bone->layer & arm->layer))
- break;
- }
- if (!pchan) return;
-
- /* make a copy to eul[3], to allow TAB on buttons to work */
- eul[0]= M_PI*tfp->ob_eul[0]/180.0;
- eul[1]= M_PI*tfp->ob_eul[1]/180.0;
- eul[2]= M_PI*tfp->ob_eul[2]/180.0;
- EulToQuat(eul, pchan->quat);
- }
- /* no break, pass on */
- case B_ARMATUREPANEL2:
- {
- ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK);
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 1);
- }
- break;
- }
-}
-
-static void view3d_panel_object(short cntrl) // VIEW3D_HANDLER_OBJECT
-{
- uiBlock *block;
- uiBut *bt;
- Object *ob= OBACT;
- TransformProperties *tfp;
- float lim;
- static char hexcol[128];
-
- if(ob==NULL) return;
-
- /* make sure we got storage */
- if(G.vd->properties_storage==NULL)
- G.vd->properties_storage= MEM_callocN(sizeof(TransformProperties), "TransformProperties");
- tfp= G.vd->properties_storage;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_panel_object", UI_EMBOSS, UI_HELV, curarea->win);
- uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | cntrl);
- uiSetPanelHandler(VIEW3D_HANDLER_OBJECT); // for close and esc
-
- if((G.f & G_SCULPTMODE) && !G.obedit) {
- if(!uiNewPanel(curarea, block, "Transform Properties", "View3d", 10, 230, 318, 234))
- return;
- } else if(G.f & G_PARTICLEEDIT && !G.obedit){
- if(!uiNewPanel(curarea, block, "Transform Properties", "View3d", 10, 230, 318, 234))
- return;
- } else {
- if(!uiNewPanel(curarea, block, "Transform Properties", "View3d", 10, 230, 318, 204))
- return;
- }
-
- uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
-
- if(G.f & (G_VERTEXPAINT|G_TEXTUREPAINT|G_WEIGHTPAINT)) {
- uiBlockSetFlag(block, UI_BLOCK_FRONTBUFFER); // force old style frontbuffer draw
- }
- else {
- bt= uiDefBut(block, TEX, B_IDNAME, "OB: ", 10,180,140,20, ob->id.name+2, 0.0, 21.0, 0, 0, "");
-#ifdef WITH_VERSE
- if(ob->vnode) uiButSetFunc(bt, test_and_send_idbutton_cb, ob, ob->id.name);
- else uiButSetFunc(bt, test_idbutton_cb, ob->id.name, NULL);
-#else
- uiButSetFunc(bt, test_idbutton_cb, ob->id.name, NULL);
-#endif
-
- if((G.f & G_PARTICLEEDIT)==0) {
- uiBlockBeginAlign(block);
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_OBJECTPANELPARENT, "Par:", 160, 180, 140, 20, &ob->parent, "Parent Object");
- if((ob->parent) && (ob->partype == PARBONE)) {
- bt= uiDefBut(block, TEX, B_OBJECTPANELPARENT, "ParBone:", 160, 160, 140, 20, ob->parsubstr, 0, 30, 0, 0, "");
- uiButSetCompleteFunc(bt, autocomplete_bone, (void *)ob->parent);
- }
- else {
- strcpy(ob->parsubstr, "");
- }
- uiBlockEndAlign(block);
- }
- }
-
- lim= 10000.0f*MAX2(1.0, G.vd->grid);
-
- if(ob==G.obedit) {
- if(ob->type==OB_ARMATURE) v3d_editarmature_buts(block, ob, lim);
- if(ob->type==OB_MBALL) v3d_editmetaball_buts(block, ob, lim);
- else v3d_editvertex_buts(block, ob, lim);
- }
- else if(ob->flag & OB_POSEMODE) {
- v3d_posearmature_buts(block, ob, lim);
- }
- else if(G.f & G_WEIGHTPAINT) {
- uiNewPanelTitle(block, "Weight Paint Properties");
- weight_paint_buttons(block);
- }
- else if(G.f & (G_VERTEXPAINT|G_TEXTUREPAINT)) {
- extern VPaint Gvp; /* from vpaint */
- static float hsv[3], old[3]; // used as temp mem for picker
- float *rgb= NULL;
- ToolSettings *settings= G.scene->toolsettings;
-
- if(G.f & G_VERTEXPAINT) rgb= &Gvp.r;
- else if(settings->imapaint.brush) rgb= settings->imapaint.brush->rgb;
-
- uiNewPanelTitle(block, "Paint Properties");
- if (rgb)
- /* 'f' is for floating panel */
- uiBlockPickerButtons(block, rgb, hsv, old, hexcol, 'f', REDRAWBUTSEDIT);
- }
- else if(G.f & G_SCULPTMODE) {
- uiNewPanelTitle(block, "Sculpt Properties");
- sculptmode_draw_interface_tools(block,10,150);
- } else if(G.f & G_PARTICLEEDIT){
- uiNewPanelTitle(block, "Particle Edit Properties");
- particle_edit_buttons(block);
- } else {
- BoundBox *bb = NULL;
-
- uiBlockBeginAlign(block);
- uiDefIconButBitS(block, ICONTOG, OB_LOCK_LOCX, REDRAWVIEW3D, ICON_UNLOCKED, 10,150,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
- uiDefButF(block, NUM, B_OBJECTPANEL, "LocX:", 30, 150, 120, 19, &(ob->loc[0]), -lim, lim, 100, 3, "");
- uiDefIconButBitS(block, ICONTOG, OB_LOCK_LOCY, REDRAWVIEW3D, ICON_UNLOCKED, 10,130,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
- uiDefButF(block, NUM, B_OBJECTPANEL, "LocY:", 30, 130, 120, 19, &(ob->loc[1]), -lim, lim, 100, 3, "");
- uiDefIconButBitS(block, ICONTOG, OB_LOCK_LOCZ, REDRAWVIEW3D, ICON_UNLOCKED, 10,110,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
- uiDefButF(block, NUM, B_OBJECTPANEL, "LocZ:", 30, 110, 120, 19, &(ob->loc[2]), -lim, lim, 100, 3, "");
-
- tfp->ob_eul[0]= 180.0*ob->rot[0]/M_PI;
- tfp->ob_eul[1]= 180.0*ob->rot[1]/M_PI;
- tfp->ob_eul[2]= 180.0*ob->rot[2]/M_PI;
-
- uiBlockBeginAlign(block);
- if ((ob->parent) && (ob->partype == PARBONE)) {
- uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTX, REDRAWVIEW3D, ICON_UNLOCKED, 160,130,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
- uiDefButF(block, NUM, B_OBJECTPANELROT, "RotX:", 180, 130, 120, 19, &(tfp->ob_eul[0]), -lim, lim, 1000, 3, "");
- uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTY, REDRAWVIEW3D, ICON_UNLOCKED, 160,110,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
- uiDefButF(block, NUM, B_OBJECTPANELROT, "RotY:", 180, 110, 120, 19, &(tfp->ob_eul[1]), -lim, lim, 1000, 3, "");
- uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTZ, REDRAWVIEW3D, ICON_UNLOCKED, 160,90,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
- uiDefButF(block, NUM, B_OBJECTPANELROT, "RotZ:", 180, 90, 120, 19, &(tfp->ob_eul[2]), -lim, lim, 1000, 3, "");
-
- }
- else {
- uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTX, REDRAWVIEW3D, ICON_UNLOCKED, 160,150,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
- uiDefButF(block, NUM, B_OBJECTPANELROT, "RotX:", 180, 150, 120, 19, &(tfp->ob_eul[0]), -lim, lim, 1000, 3, "");
- uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTY, REDRAWVIEW3D, ICON_UNLOCKED, 160,130,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
- uiDefButF(block, NUM, B_OBJECTPANELROT, "RotY:", 180, 130, 120, 19, &(tfp->ob_eul[1]), -lim, lim, 1000, 3, "");
- uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTZ, REDRAWVIEW3D, ICON_UNLOCKED, 160,110,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
- uiDefButF(block, NUM, B_OBJECTPANELROT, "RotZ:", 180, 110, 120, 19, &(tfp->ob_eul[2]), -lim, lim, 1000, 3, "");
- }
-
- tfp->ob_scale[0]= ob->size[0];
- tfp->ob_scale[1]= ob->size[1];
- tfp->ob_scale[2]= ob->size[2];
-
- uiBlockBeginAlign(block);
- uiDefIconButBitS(block, ICONTOG, OB_LOCK_SCALEX, REDRAWVIEW3D, ICON_UNLOCKED, 10,80,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
- uiDefButF(block, NUM, B_OBJECTPANELSCALE, "ScaleX:", 30, 80, 120, 19, &(tfp->ob_scale[0]), -lim, lim, 10, 3, "");
- uiDefIconButBitS(block, ICONTOG, OB_LOCK_SCALEY, REDRAWVIEW3D, ICON_UNLOCKED, 10,60,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
- uiDefButF(block, NUM, B_OBJECTPANELSCALE, "ScaleY:", 30, 60, 120, 19, &(tfp->ob_scale[1]), -lim, lim, 10, 3, "");
- uiDefIconButBitS(block, ICONTOG, OB_LOCK_SCALEZ, REDRAWVIEW3D, ICON_UNLOCKED, 10,40,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
- uiDefButF(block, NUM, B_OBJECTPANELSCALE, "ScaleZ:", 30, 40, 120, 19, &(tfp->ob_scale[2]), -lim, lim, 10, 3, "");
- uiBlockEndAlign(block);
-
- uiDefButS(block, TOG, REDRAWVIEW3D, "Link Scale", 10, 10, 140, 19, &(tfp->link_scale), 0, 1, 0, 0, "Scale values vary proportionally in all directions");
-
- bb= object_get_boundbox(ob);
- if (bb) {
- float scale[3];
-
- Mat4ToSize(ob->obmat, scale);
-
- tfp->ob_dims[0] = fabs(scale[0]) * (bb->vec[4][0] - bb->vec[0][0]);
- tfp->ob_dims[1] = fabs(scale[1]) * (bb->vec[2][1] - bb->vec[0][1]);
- tfp->ob_dims[2] = fabs(scale[2]) * (bb->vec[1][2] - bb->vec[0][2]);
-
- uiBlockBeginAlign(block);
- if ((ob->parent) && (ob->partype == PARBONE)) {
- uiDefButF(block, NUM, B_OBJECTPANELDIMS, "DimX:", 160, 60, 140, 19, &(tfp->ob_dims[0]), 0.0, lim, 10, 3, "Manipulate bounding box size");
- uiDefButF(block, NUM, B_OBJECTPANELDIMS, "DimY:", 160, 40, 140, 19, &(tfp->ob_dims[1]), 0.0, lim, 10, 3, "Manipulate bounding box size");
- uiDefButF(block, NUM, B_OBJECTPANELDIMS, "DimZ:", 160, 20, 140, 19, &(tfp->ob_dims[2]), 0.0, lim, 10, 3, "Manipulate bounding box size");
-
- }
- else {
- uiDefButF(block, NUM, B_OBJECTPANELDIMS, "DimX:", 160, 80, 140, 19, &(tfp->ob_dims[0]), 0.0, lim, 10, 3, "Manipulate bounding box size");
- uiDefButF(block, NUM, B_OBJECTPANELDIMS, "DimY:", 160, 60, 140, 19, &(tfp->ob_dims[1]), 0.0, lim, 10, 3, "Manipulate bounding box size");
- uiDefButF(block, NUM, B_OBJECTPANELDIMS, "DimZ:", 160, 40, 140, 19, &(tfp->ob_dims[2]), 0.0, lim, 10, 3, "Manipulate bounding box size");
- }
-
- uiBlockEndAlign(block);
- }
- }
- uiClearButLock();
-}
-
-static void view3d_panel_background(short cntrl) // VIEW3D_HANDLER_BACKGROUND
-{
- uiBlock *block;
- View3D *vd;
-
- vd= G.vd;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_panel_background", UI_EMBOSS, UI_HELV, curarea->win);
- uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | cntrl);
- uiSetPanelHandler(VIEW3D_HANDLER_BACKGROUND); // for close and esc
- if(uiNewPanel(curarea, block, "Background Image", "View3d", 340, 10, 318, 204)==0) return;
-
- if(G.f & G_VERTEXPAINT || G.f & G_WEIGHTPAINT || G.f & G_TEXTUREPAINT) {
- uiBlockSetFlag(block, UI_BLOCK_FRONTBUFFER); // force old style frontbuffer draw
- }
-
- if(vd->flag & V3D_DISPBGPIC) {
- if(vd->bgpic==NULL) {
- vd->bgpic= MEM_callocN(sizeof(BGpic), "bgpic");
- vd->bgpic->size= 5.0;
- vd->bgpic->blend= 0.5;
- vd->bgpic->iuser.fie_ima= 2;
- vd->bgpic->iuser.ok= 1;
- }
- }
-
- if(!(vd->flag & V3D_DISPBGPIC)) {
- uiDefButBitS(block, TOG, V3D_DISPBGPIC, B_REDR, "Use Background Image", 10, 180, 150, 20, &vd->flag, 0, 0, 0, 0, "Display an image in the background of this 3D View");
- uiDefBut(block, LABEL, 1, " ", 160, 180, 150, 20, NULL, 0.0, 0.0, 0, 0, "");
- }
- else {
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, V3D_DISPBGPIC, B_REDR, "Use", 10, 225, 50, 20, &vd->flag, 0, 0, 0, 0, "Display an image in the background of this 3D View");
- uiDefButF(block, NUMSLI, B_REDR, "Blend:", 60, 225, 150, 20, &vd->bgpic->blend, 0.0,1.0, 0, 0, "Set the transparency of the background image");
- uiDefButF(block, NUM, B_REDR, "Size:", 210, 225, 100, 20, &vd->bgpic->size, 0.1, 250.0*vd->grid, 100, 0, "Set the size (width) of the background image");
-
- uiDefButF(block, NUM, B_REDR, "X Offset:", 10, 205, 150, 20, &vd->bgpic->xof, -250.0*vd->grid,250.0*vd->grid, 10, 2, "Set the horizontal offset of the background image");
- uiDefButF(block, NUM, B_REDR, "Y Offset:", 160, 205, 150, 20, &vd->bgpic->yof, -250.0*vd->grid,250.0*vd->grid, 10, 2, "Set the vertical offset of the background image");
-
- uiblock_image_panel(block, &vd->bgpic->ima, &vd->bgpic->iuser, B_REDR, B_REDR);
- }
-}
-
-
-static void view3d_panel_properties(short cntrl) // VIEW3D_HANDLER_SETTINGS
-{
- uiBlock *block;
- View3D *vd;
- float *curs;
-
- vd= G.vd;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_panel_properties", UI_EMBOSS, UI_HELV, curarea->win);
- uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | cntrl);
- uiSetPanelHandler(VIEW3D_HANDLER_PROPERTIES); // for close and esc
- if(uiNewPanel(curarea, block, "View Properties", "View3d", 340, 30, 318, 254)==0) return;
-
- /* to force height */
- uiNewPanelHeight(block, 264);
-
- if(G.f & (G_VERTEXPAINT|G_FACESELECT|G_TEXTUREPAINT|G_WEIGHTPAINT)) {
- uiBlockSetFlag(block, UI_BLOCK_FRONTBUFFER); // force old style frontbuffer draw
- }
-
- uiDefBut(block, LABEL, 1, "Grid:", 10, 220, 150, 19, NULL, 0.0, 0.0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, REDRAWVIEW3D, "Spacing:", 10, 200, 140, 19, &vd->grid, 0.001, 100.0, 10, 0, "Set the distance between grid lines");
- uiDefButS(block, NUM, REDRAWVIEW3D, "Lines:", 10, 180, 140, 19, &vd->gridlines, 0.0, 100.0, 100, 0, "Set the number of grid lines in perspective view");
- uiDefButS(block, NUM, REDRAWVIEW3D, "Divisions:", 10, 160, 140, 19, &vd->gridsubdiv, 1.0, 100.0, 100, 0, "Set the number of grid lines");
- uiBlockEndAlign(block);
-
- uiDefBut(block, LABEL, 1, "3D Display:", 160, 220, 150, 19, NULL, 0.0, 0.0, 0, 0, "");
- uiDefButBitS(block, TOG, V3D_SHOW_FLOOR, REDRAWVIEW3D, "Grid Floor",160, 200, 150, 19, &vd->gridflag, 0, 0, 0, 0, "Show the grid floor in free camera mode");
- uiDefButBitS(block, TOG, V3D_SHOW_X, REDRAWVIEW3D, "X Axis", 160, 176, 48, 19, &vd->gridflag, 0, 0, 0, 0, "Show the X Axis line");
- uiDefButBitS(block, TOG, V3D_SHOW_Y, REDRAWVIEW3D, "Y Axis", 212, 176, 48, 19, &vd->gridflag, 0, 0, 0, 0, "Show the Y Axis line");
- uiDefButBitS(block, TOG, V3D_SHOW_Z, REDRAWVIEW3D, "Z Axis", 262, 176, 48, 19, &vd->gridflag, 0, 0, 0, 0, "Show the Z Axis line");
-
- uiDefBut(block, LABEL, 1, "View Camera:", 10, 140, 140, 19, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefButF(block, NUM, REDRAWVIEW3D, "Lens:", 10, 120, 140, 19, &vd->lens, 10.0, 120.0, 100, 0, "The lens angle in perspective view");
- uiBlockBeginAlign(block);
- uiDefButF(block, NUM, REDRAWVIEW3D, "Clip Start:", 10, 96, 140, 19, &vd->near, vd->grid/100.0, 100.0, 10, 0, "Set the beginning of the range in which 3D objects are displayed (perspective view)");
- uiDefButF(block, NUM, REDRAWVIEW3D, "Clip End:", 10, 76, 140, 19, &vd->far, 1.0, 10000.0*vd->grid, 100, 0, "Set the end of the range in which 3D objects are displayed (perspective view)");
- uiBlockEndAlign(block);
-
- uiDefBut(block, LABEL, 1, "3D Cursor:", 160, 150, 140, 19, NULL, 0.0, 0.0, 0, 0, "");
-
- uiBlockBeginAlign(block);
- curs= give_cursor();
- uiDefButF(block, NUM, REDRAWVIEW3D, "X:", 160, 130, 150, 22, curs, -10000.0*vd->grid, 10000.0*vd->grid, 10, 0, "X co-ordinate of the 3D cursor");
- uiDefButF(block, NUM, REDRAWVIEW3D, "Y:", 160, 108, 150, 22, curs+1, -10000.0*vd->grid, 10000.0*vd->grid, 10, 0, "Y co-ordinate of the 3D cursor");
- uiDefButF(block, NUM, REDRAWVIEW3D, "Z:", 160, 86, 150, 22, curs+2, -10000.0*vd->grid, 10000.0*vd->grid, 10, 0, "Z co-ordinate of the 3D cursor");
- uiBlockEndAlign(block);
-
- uiDefBut(block, LABEL, 1, "Display:", 10, 50, 150, 19, NULL, 0.0, 0.0, 0, 0, "");
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, V3D_SELECT_OUTLINE, REDRAWVIEW3D, "Outline Selected", 10, 30, 140, 19, &vd->flag, 0, 0, 0, 0, "Highlight selected objects with an outline, in Solid, Shaded or Textured viewport shading modes");
- uiDefButBitS(block, TOG, V3D_DRAW_CENTERS, REDRAWVIEW3D, "All Object Centers", 10, 10, 140, 19, &vd->flag, 0, 0, 0, 0, "Draw the center points on all objects");
- uiDefButBitS(block, TOGN, V3D_HIDE_HELPLINES, REDRAWVIEW3D, "Relationship Lines", 10, -10, 140, 19, &vd->flag, 0, 0, 0, 0, "Draw dashed lines indicating Parent, Constraint, or Hook relationships");
- uiDefButBitS(block, TOG, V3D_SOLID_TEX, REDRAWVIEW3D, "Solid Tex", 10, -30, 140, 19, &vd->flag2, 0, 0, 0, 0, "Display textures in Solid draw type (Shift T)");
- uiBlockEndAlign(block);
-
- uiDefBut(block, LABEL, 1, "View Locking:", 160, 50, 150, 19, NULL, 0.0, 0.0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, REDRAWVIEW3D, "Object:", 160, 30, 140, 19, &vd->ob_centre, "Lock view to center to this Object");
- uiDefBut(block, TEX, REDRAWVIEW3D, "Bone:", 160, 10, 140, 19, vd->ob_centre_bone, 1, 31, 0, 0, "If view locked to Object, use this Bone to lock to view to");
-
-}
-
-static void view3d_panel_preview(ScrArea *sa, short cntrl) // VIEW3D_HANDLER_PREVIEW
-{
- uiBlock *block;
- View3D *v3d= sa->spacedata.first;
- int ofsx, ofsy;
-
- block= uiNewBlock(&sa->uiblocks, "view3d_panel_preview", UI_EMBOSS, UI_HELV, sa->win);
- uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | UI_PNL_SCALE | cntrl);
- uiSetPanelHandler(VIEW3D_HANDLER_PREVIEW); // for close and esc
-
- ofsx= -150+(sa->winx/2)/v3d->blockscale;
- ofsy= -100+(sa->winy/2)/v3d->blockscale;
- if(uiNewPanel(sa, block, "Preview", "View3d", ofsx, ofsy, 300, 200)==0) return;
-
- uiBlockSetDrawExtraFunc(block, BIF_view3d_previewdraw);
-
- if(G.scene->recalc & SCE_PRV_CHANGED) {
- G.scene->recalc &= ~SCE_PRV_CHANGED;
- //printf("found recalc\n");
- BIF_view3d_previewrender_free(sa->spacedata.first);
- BIF_preview_changed(0);
- }
-}
-
-
-static void view3d_blockhandlers(ScrArea *sa)
-{
- View3D *v3d= sa->spacedata.first;
- short a;
-
- /* warning; blocks need to be freed each time, handlers dont remove */
- uiFreeBlocksWin(&sa->uiblocks, sa->win);
-
- /*uv face-sel and wp mode when mixed with wire leave depth enabled causing
- models to draw over the UI */
- glDisable(GL_DEPTH_TEST);
-
- for(a=0; a<SPACE_MAXHANDLER; a+=2) {
-
- switch(v3d->blockhandler[a]) {
-
- case VIEW3D_HANDLER_PROPERTIES:
- view3d_panel_properties(v3d->blockhandler[a+1]);
- break;
- case VIEW3D_HANDLER_BACKGROUND:
- view3d_panel_background(v3d->blockhandler[a+1]);
- break;
- case VIEW3D_HANDLER_OBJECT:
- view3d_panel_object(v3d->blockhandler[a+1]);
- break;
- case VIEW3D_HANDLER_PREVIEW:
- view3d_panel_preview(sa, v3d->blockhandler[a+1]);
- break;
- }
- /* clear action value for event */
- v3d->blockhandler[a+1]= 0;
- }
- uiDrawBlocksPanels(sa, 0);
-
-}
-
-/* ****************** View3d afterdraw *************** */
-
-typedef struct View3DAfter {
- struct View3DAfter *next, *prev;
- struct Base *base;
- int type;
-} View3DAfter;
-
-/* temp storage of Objects that need to be drawn as last */
-void add_view3d_after(View3D *v3d, Base *base, int type)
-{
- View3DAfter *v3da= MEM_callocN(sizeof(View3DAfter), "View 3d after");
-
- BLI_addtail(&v3d->afterdraw, v3da);
- v3da->base= base;
- v3da->type= type;
-}
-
-/* clears zbuffer and draws it over */
-static void view3d_draw_xray(View3D *v3d, int flag)
-{
- View3DAfter *v3da, *next;
- int doit= 0;
-
- for(v3da= v3d->afterdraw.first; v3da; v3da= v3da->next)
- if(v3da->type==V3D_XRAY) doit= 1;
-
- if(doit) {
- if(v3d->zbuf) glClear(GL_DEPTH_BUFFER_BIT);
- v3d->xray= TRUE;
-
- for(v3da= v3d->afterdraw.first; v3da; v3da= next) {
- next= v3da->next;
- if(v3da->type==V3D_XRAY) {
- draw_object(v3da->base, flag);
- BLI_remlink(&v3d->afterdraw, v3da);
- MEM_freeN(v3da);
- }
- }
- v3d->xray= FALSE;
- }
-}
-
-/* disables write in zbuffer and draws it over */
-static void view3d_draw_transp(View3D *v3d, int flag)
-{
- View3DAfter *v3da, *next;
-
- glDepthMask(0);
- v3d->transp= TRUE;
-
- for(v3da= v3d->afterdraw.first; v3da; v3da= next) {
- next= v3da->next;
- if(v3da->type==V3D_TRANSP) {
- draw_object(v3da->base, flag);
- BLI_remlink(&v3d->afterdraw, v3da);
- MEM_freeN(v3da);
- }
- }
- v3d->transp= FALSE;
-
- glDepthMask(1);
-
-}
-
-/* *********************** */
-
-/*
- In most cases call draw_dupli_objects,
- draw_dupli_objects_color was added because when drawing set dupli's
- we need to force the color
-*/
-static void draw_dupli_objects_color(View3D *v3d, Base *base, int color)
-{
- ListBase *lb;
- DupliObject *dob;
- Base tbase;
- BoundBox *bb= NULL;
- GLuint displist=0;
- short transflag, use_displist= -1; /* -1 is initialize */
- char dt, dtx;
-
- if (base->object->restrictflag & OB_RESTRICT_VIEW) return;
-
- /* test if we can do a displist */
- if(base->object->transflag & OB_DUPLIGROUP)
- use_displist= 0;
-
- tbase.flag= OB_FROMDUPLI|base->flag;
- lb= object_duplilist(G.scene, base->object);
-
- for(dob= lb->first; dob; dob= dob->next) {
- if(dob->no_draw);
- else {
- tbase.object= dob->ob;
-
- /* extra service: draw the duplicator in drawtype of parent */
- dt= tbase.object->dt; tbase.object->dt= base->object->dt;
- dtx= tbase.object->dtx; tbase.object->dtx= base->object->dtx;
-
- /* negative scale flag has to propagate */
- transflag= tbase.object->transflag;
- if(base->object->transflag & OB_NEG_SCALE)
- tbase.object->transflag ^= OB_NEG_SCALE;
-
- BIF_ThemeColorBlend(color, TH_BACK, 0.5);
-
- /* generate displist, test for new object */
- if(use_displist==1 && dob->prev && dob->prev->ob!=dob->ob) {
- use_displist= -1;
- glDeleteLists(displist, 1);
- }
- /* generate displist */
- if(use_displist == -1) {
-
- /* lamp drawing messes with matrices, could be handled smarter... but this works */
- if(dob->ob->type==OB_LAMP)
- use_displist= 0;
- else {
- /* disable boundbox check for list creation */
- object_boundbox_flag(dob->ob, OB_BB_DISABLED, 1);
- /* need this for next part of code */
- bb= object_get_boundbox(dob->ob);
-
- Mat4One(dob->ob->obmat); /* obmat gets restored */
-
- displist= glGenLists(1);
- glNewList(displist, GL_COMPILE);
- draw_object(&tbase, DRAW_CONSTCOLOR);
- glEndList();
-
- use_displist= 1;
- object_boundbox_flag(dob->ob, OB_BB_DISABLED, 0);
- }
- }
- if(use_displist) {
- mymultmatrix(dob->mat);
- if(boundbox_clip(dob->mat, bb))
- glCallList(displist);
- myloadmatrix(G.vd->viewmat);
- }
- else {
- Mat4CpyMat4(dob->ob->obmat, dob->mat);
- draw_object(&tbase, DRAW_CONSTCOLOR);
- }
-
- tbase.object->dt= dt;
- tbase.object->dtx= dtx;
- tbase.object->transflag= transflag;
- }
- }
-
- /* Transp afterdraw disabled, afterdraw only stores base pointers, and duplis can be same obj */
-
- free_object_duplilist(lb); /* does restore */
-
- if(use_displist)
- glDeleteLists(displist, 1);
-}
-
-static void draw_dupli_objects(View3D *v3d, Base *base)
-{
- /* define the color here so draw_dupli_objects_color can be called
- * from the set loop */
-
- int color= (base->flag & SELECT)?TH_SELECT:TH_WIRE;
- /* debug */
- if(base->object->dup_group && base->object->dup_group->id.us<1)
- color= TH_REDALERT;
-
- draw_dupli_objects_color(v3d, base, color);
-}
-
-void view3d_update_depths(View3D *v3d)
-{
- /* Create storage for, and, if necessary, copy depth buffer */
- if(!v3d->depths) v3d->depths= MEM_callocN(sizeof(ViewDepths),"ViewDepths");
- if(v3d->depths) {
- ViewDepths *d= v3d->depths;
- if(d->w != v3d->area->winx ||
- d->h != v3d->area->winy ||
- !d->depths) {
- d->w= v3d->area->winx;
- d->h= v3d->area->winy;
- if(d->depths)
- MEM_freeN(d->depths);
- d->depths= MEM_mallocN(sizeof(float)*d->w*d->h,"View depths");
- d->damaged= 1;
- }
-
- if(d->damaged) {
- glReadPixels(v3d->area->winrct.xmin,v3d->area->winrct.ymin,d->w,d->h,
- GL_DEPTH_COMPONENT,GL_FLOAT, d->depths);
-
- glGetDoublev(GL_DEPTH_RANGE,d->depth_range);
-
- d->damaged= 0;
- }
- }
-}
-
-/* Enable sculpting in wireframe mode by drawing sculpt object only to the depth buffer */
-static void draw_sculpt_depths(View3D *v3d)
-{
- Object *ob = OBACT;
-
- int dt= MIN2(v3d->drawtype, ob->dt);
- if(v3d->zbuf==0 && dt>OB_WIRE)
- dt= OB_WIRE;
- if(dt == OB_WIRE) {
- GLboolean depth_on;
- int orig_vdt = v3d->drawtype;
- int orig_zbuf = v3d->zbuf;
- int orig_odt = ob->dt;
-
- glGetBooleanv(GL_DEPTH_TEST, &depth_on);
- v3d->drawtype = ob->dt = OB_SOLID;
- v3d->zbuf = 1;
-
- glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
- glEnable(GL_DEPTH_TEST);
- draw_object(BASACT, 0);
- glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
- if(!depth_on)
- glDisable(GL_DEPTH_TEST);
-
- v3d->drawtype = orig_vdt;
- v3d->zbuf = orig_zbuf;
- ob->dt = orig_odt;
- }
-}
-
-static void draw_viewport_fps(ScrArea *sa);
-
-
-void drawview3dspace(ScrArea *sa, void *spacedata)
-{
- View3D *v3d= spacedata;
- Base *base;
- Object *ob;
- Scene *sce;
- char retopo, sculpt;
- Object *obact = OBACT;
-
- /* update all objects, ipos, matrices, displists, etc. Flags set by depgraph or manual,
- no layer check here, gets correct flushed */
- /* sets first, we allow per definition current scene to have dependencies on sets */
- if(G.scene->set) {
- for(SETLOOPER(G.scene->set, base))
- object_handle_update(base->object); // bke_object.h
- }
-
- for(base= G.scene->base.first; base; base= base->next)
- object_handle_update(base->object); // bke_object.h
-
- setwinmatrixview3d(sa->winx, sa->winy, NULL); /* 0= no pick rect */
- setviewmatrixview3d(); /* note: calls where_is_object for camera... */
-
- Mat4MulMat4(v3d->persmat, v3d->viewmat, sa->winmat);
- Mat4Invert(v3d->persinv, v3d->persmat);
- Mat4Invert(v3d->viewinv, v3d->viewmat);
-
- /* calculate pixelsize factor once, is used for lamps and obcenters */
- {
- float len1, len2, vec[3];
-
- VECCOPY(vec, v3d->persinv[0]);
- len1= Normalize(vec);
- VECCOPY(vec, v3d->persinv[1]);
- len2= Normalize(vec);
-
- v3d->pixsize= 2.0f*(len1>len2?len1:len2);
-
- /* correct for window size */
- if(sa->winx > sa->winy) v3d->pixsize/= (float)sa->winx;
- else v3d->pixsize/= (float)sa->winy;
- }
-
- if(v3d->drawtype > OB_WIRE) {
- if(G.f & G_SIMULATION)
- glClearColor(0.0, 0.0, 0.0, 0.0);
- else {
- float col[3];
- BIF_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
- }
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- glLoadIdentity();
- }
- else {
- float col[3];
- BIF_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
- }
-
- myloadmatrix(v3d->viewmat);
- persp(PERSP_STORE); // store correct view for persp(PERSP_VIEW) calls
-
- if(v3d->flag & V3D_CLIPPING)
- view3d_draw_clipping(v3d);
-
- /* set zbuffer after we draw clipping region */
- if(v3d->drawtype > OB_WIRE) {
- v3d->zbuf= TRUE;
- glEnable(GL_DEPTH_TEST);
- }
-
- // needs to be done always, gridview is adjusted in drawgrid() now
- v3d->gridview= v3d->grid;
-
- if(v3d->view==0 || v3d->persp!=0) {
- drawfloor();
- if(v3d->persp==2) {
- if(G.scene->world) {
- if(G.scene->world->mode & WO_STARS) {
- RE_make_stars(NULL, star_stuff_init_func, star_stuff_vertex_func,
- star_stuff_term_func);
- }
- }
- if(v3d->flag & V3D_DISPBGPIC) draw_bgpic();
- }
- }
- else {
- drawgrid();
-
- if(v3d->flag & V3D_DISPBGPIC) {
- draw_bgpic();
- }
- }
-
- if(v3d->flag & V3D_CLIPPING)
- view3d_set_clipping(v3d);
-
- /* draw set first */
- if(G.scene->set) {
- for(SETLOOPER(G.scene->set, base)) {
-
- if(v3d->lay & base->lay) {
-
- BIF_ThemeColorBlend(TH_WIRE, TH_BACK, 0.6f);
- draw_object(base, DRAW_CONSTCOLOR);
-
- if(base->object->transflag & OB_DUPLI) {
- draw_dupli_objects_color(v3d, base, TH_WIRE);
- }
- }
- }
-
- /* Transp and X-ray afterdraw stuff */
- view3d_draw_xray(v3d, DRAW_CONSTCOLOR); // clears zbuffer if it is used!
- view3d_draw_transp(v3d, DRAW_CONSTCOLOR);
- }
-
- /* then draw not selected and the duplis, but skip editmode object */
- for(base= G.scene->base.first; base; base= base->next) {
- if(v3d->lay & base->lay) {
-
- /* dupli drawing */
- if(base->object->transflag & OB_DUPLI) {
- draw_dupli_objects(v3d, base);
- }
- if((base->flag & SELECT)==0) {
- if(base->object!=G.obedit) draw_object(base, 0);
- }
- }
- }
-
- retopo= retopo_mesh_check() || retopo_curve_check();
- sculpt= (G.f & G_SCULPTMODE) && !G.obedit;
- if(retopo)
- view3d_update_depths(v3d);
-
- /* draw selected and editmode */
- for(base= G.scene->base.first; base; base= base->next) {
- if(v3d->lay & base->lay) {
- if (base->object==G.obedit || ( base->flag & SELECT) )
- draw_object(base, 0);
- }
- }
-
- if(!retopo && sculpt && !(obact && (obact->dtx & OB_DRAWXRAY))) {
- draw_sculpt_depths(v3d);
- view3d_update_depths(v3d);
- }
-
- if(G.moving) {
- BIF_drawConstraint();
- if(G.obedit || (G.f & G_PARTICLEEDIT))
- BIF_drawPropCircle(); // only editmode and particles have proportional edit
- BIF_drawSnap();
- }
-
- if(G.scene->radio) RAD_drawall(v3d->drawtype>=OB_SOLID);
-
- /* Transp and X-ray afterdraw stuff */
- view3d_draw_xray(v3d, 0); // clears zbuffer if it is used!
- view3d_draw_transp(v3d, 0);
-
- if(!retopo && sculpt && (obact && (OBACT->dtx & OB_DRAWXRAY))) {
- draw_sculpt_depths(v3d);
- view3d_update_depths(v3d);
- }
-
- if(v3d->flag & V3D_CLIPPING)
- view3d_clr_clipping();
-
- BIF_draw_manipulator(sa);
-
- if(v3d->zbuf) {
- v3d->zbuf= FALSE;
- glDisable(GL_DEPTH_TEST);
- }
-
- persp(PERSP_WIN); // set ortho
-
- /* Draw Sculpt Mode brush */
- if(!G.obedit && (G.f & G_SCULPTMODE) && area_is_active_area(v3d->area) && sculpt_session()) {
- PropsetData *pd= sculpt_session()->propset;
- short r1=100, r2=100, r3=100;
- short mouse[2];
-
- if(sculpt_data()->flags & SCULPT_INPUT_SMOOTH)
- sculpt_stroke_draw();
-
- if(pd) {
- if(pd->mode == PropsetSize) {
- r1= sculptmode_brush()->size;
- r2= pd->origsize;
- r3= r1;
- } else if(pd->mode == PropsetStrength) {
- r1= 200 - sculptmode_brush()->strength * 2;
- r2= 200;
- r3= 200;
- } else if(pd->mode == PropsetTexRot) {
- r1= r2= 200;
- r3= 200;
- }
-
- /* Draw brush with texture */
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
- glBindTexture(GL_TEXTURE_2D, pd->tex);
-
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-
- glPushMatrix();
- glTranslatef(pd->origloc[0], pd->origloc[1], 0);
- glRotatef(tex_angle(), 0, 0, 1);
-
- glEnable(GL_TEXTURE_2D);
- glBegin(GL_QUADS);
- glColor4f(0,0,0,1);
- glTexCoord2f(0,0);
- glVertex2f(-r3, -r3);
- glTexCoord2f(1,0);
- glVertex2f(r3, -r3);
- glTexCoord2f(1,1);
- glVertex2f(r3, r3);
- glTexCoord2f(0,1);
- glVertex2f(-r3, r3);
- glEnd();
- glDisable(GL_TEXTURE_2D);
-
- glPopMatrix();
-
- if(r1 != r2)
- fdrawXORcirc(pd->origloc[0], pd->origloc[1], r1);
- fdrawXORcirc(pd->origloc[0], pd->origloc[1], r2);
-
- if(pd->mode == PropsetTexRot) {
- const float ang= pd->origtexrot * (M_PI/180.0f);
- getmouseco_areawin(mouse);
- sdrawXORline(pd->origloc[0], pd->origloc[1],
- pd->origloc[0]+200*cos(ang), pd->origloc[1]+200*sin(ang));
- sdrawXORline(pd->origloc[0], pd->origloc[1], mouse[0], mouse[1]);
- }
- }
- else if(sculpt_data()->flags & SCULPT_DRAW_BRUSH) {
- short csc[2], car[2];
- getmouseco_sc(csc);
- getmouseco_areawin(car);
- if(csc[0] > v3d->area->winrct.xmin &&
- csc[1] > v3d->area->winrct.ymin &&
- csc[0] < v3d->area->winrct.xmax &&
- csc[1] < v3d->area->winrct.ymax)
- fdrawXORcirc((float)car[0], (float)car[1], sculptmode_brush()->size);
- }
- }
-
- retopo_paint_view_update(v3d);
- retopo_draw_paint_lines();
-
- if(!G.obedit && OBACT && G.f&G_PARTICLEEDIT && area_is_active_area(v3d->area)){
- ParticleSystem *psys = PE_get_current(OBACT);
- ParticleEditSettings *pset = PE_settings();
-
- short c[2];
- if(psys && psys->edit && pset->brushtype>=0){
- getmouseco_areawin(c);
- fdrawXORcirc((float)c[0], (float)c[1], (float)pset->brush[pset->brushtype].size);
- }
- }
-
- if(v3d->persp>1) drawviewborder();
- if(v3d->flag2 & V3D_FLYMODE) drawviewborder_flymode();
- if(!(G.f & G_PLAYANIM)) drawcursor(v3d);
- if(U.uiflag & USER_SHOW_ROTVIEWICON)
- draw_view_axis();
- else
- draw_view_icon();
-
- if(U.uiflag & USER_SHOW_FPS && G.f & G_PLAYANIM) {
- draw_viewport_fps(sa);
- } else if(U.uiflag & USER_SHOW_VIEWPORTNAME) {
- draw_viewport_name(sa);
- }
-
- ob= OBACT;
- if(ob && (U.uiflag & USER_DRAWVIEWINFO))
- draw_selected_name(ob);
-
- draw_area_emboss(sa);
-
- /* it is important to end a view in a transform compatible with buttons */
-
- bwin_scalematrix(sa->win, v3d->blockscale, v3d->blockscale, v3d->blockscale);
- view3d_blockhandlers(sa);
-
- sa->win_swap= WIN_BACK_OK;
-
- if(G.f & G_VERTEXPAINT || G.f & G_WEIGHTPAINT || G.f & G_TEXTUREPAINT) {
- v3d->flag |= V3D_NEEDBACKBUFDRAW;
- addafterqueue(sa->win, BACKBUFDRAW, 1);
- }
- // test for backbuf select
- if(G.obedit && v3d->drawtype>OB_WIRE && (v3d->flag & V3D_ZBUF_SELECT)) {
- extern int afterqtest(short win, unsigned short evt); //editscreen.c
-
- v3d->flag |= V3D_NEEDBACKBUFDRAW;
- if(afterqtest(sa->win, BACKBUFDRAW)==0) {
- addafterqueue(sa->win, BACKBUFDRAW, 1);
- }
- }
-
- /* run any view3d draw handler script links */
- if (sa->scriptlink.totscript)
- BPY_do_spacehandlers(sa, 0, SPACEHANDLER_VIEW3D_DRAW);
-
- /* run scene redraw script links */
- if((G.f & G_DOSCRIPTLINKS) && G.scene->scriptlink.totscript &&
- !during_script()) {
- BPY_do_pyscript((ID *)G.scene, SCRIPT_REDRAW);
- }
-
-}
-
-
-void drawview3d_render(struct View3D *v3d, int winx, int winy, float winmat[][4])
-{
- Base *base;
- Scene *sce;
- float v3dwinmat[4][4];
-
- if(!winmat)
- setwinmatrixview3d(winx, winy, NULL);
-
- setviewmatrixview3d();
- myloadmatrix(v3d->viewmat);
-
- /* when winmat is not NULL, it overrides the regular window matrix */
- glMatrixMode(GL_PROJECTION);
- if(winmat)
- myloadmatrix(winmat);
- mygetmatrix(v3dwinmat);
- glMatrixMode(GL_MODELVIEW);
-
- Mat4MulMat4(v3d->persmat, v3d->viewmat, v3dwinmat);
- Mat4Invert(v3d->persinv, v3d->persmat);
- Mat4Invert(v3d->viewinv, v3d->viewmat);
-
- free_all_realtime_images();
- reshadeall_displist();
-
- if(v3d->drawtype > OB_WIRE) {
- v3d->zbuf= TRUE;
- glEnable(GL_DEPTH_TEST);
- }
-
- if(v3d->flag & V3D_CLIPPING)
- view3d_set_clipping(v3d);
-
- if (v3d->drawtype==OB_TEXTURE && G.scene->world) {
- glClearColor(G.scene->world->horr, G.scene->world->horg, G.scene->world->horb, 0.0);
- } else {
- float col[3];
- BIF_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
- }
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- /* abuse! to make sure it doesnt draw the helpstuff */
- G.f |= G_SIMULATION;
-
- /* first draw set */
- if(G.scene->set) {
-
- for(SETLOOPER(G.scene->set, base)) {
- if(v3d->lay & base->lay) {
- if ELEM3(base->object->type, OB_LAMP, OB_CAMERA, OB_LATTICE);
- else {
- where_is_object(base->object);
-
- BIF_ThemeColorBlend(TH_WIRE, TH_BACK, 0.6f);
- draw_object(base, DRAW_CONSTCOLOR);
-
- if(base->object->transflag & OB_DUPLI) {
- draw_dupli_objects(v3d, base);
- }
- }
- }
- }
-
- /* Transp and X-ray afterdraw stuff */
- view3d_draw_xray(v3d, DRAW_CONSTCOLOR); // clears zbuffer if it is used!
- view3d_draw_transp(v3d, DRAW_CONSTCOLOR);
- }
-
- /* first not selected and duplis */
- base= G.scene->base.first;
- while(base) {
-
- if(v3d->lay & base->lay) {
- if ELEM3(base->object->type, OB_LAMP, OB_CAMERA, OB_LATTICE);
- else {
-
- if(base->object->transflag & OB_DUPLI) {
- draw_dupli_objects(v3d, base);
- }
- else if((base->flag & SELECT)==0) {
- draw_object(base, 0);
- }
- }
- }
-
- base= base->next;
- }
-
- /* draw selected */
- base= G.scene->base.first;
- while(base) {
-
- if ( ((base)->flag & SELECT) && ((base)->lay & v3d->lay) ) {
- if ELEM3(base->object->type, OB_LAMP, OB_CAMERA, OB_LATTICE);
- else draw_object(base, 0);
- }
-
- base= base->next;
- }
-
- if(G.scene->radio) RAD_drawall(v3d->drawtype>=OB_SOLID);
-
- /* Transp and X-ray afterdraw stuff */
- view3d_draw_xray(v3d, 0); // clears zbuffer if it is used!
- view3d_draw_transp(v3d, 0);
-
- if(v3d->flag & V3D_CLIPPING)
- view3d_clr_clipping();
-
- if(v3d->zbuf) {
- v3d->zbuf= FALSE;
- glDisable(GL_DEPTH_TEST);
- }
-
- G.f &= ~G_SIMULATION;
-
- glFlush();
-
- glLoadIdentity();
-
- free_all_realtime_images();
-}
-
-
-double tottime = 0.0;
-static ScrArea *oldsa;
-static double swaptime;
-static int curmode;
-
-/* used for fps display */
-static double redrawtime;
-static double lredrawtime;
-
-int update_time(void)
-{
- static double ltime;
- double time;
-
- if ((audiostream_pos() != CFRA)
- && (G.scene->audio.flag & AUDIO_SYNC)) {
- return 0;
- }
-
- time = PIL_check_seconds_timer();
-
- tottime += (time - ltime);
- ltime = time;
- return (tottime < 0.0);
-}
-
-static void draw_viewport_fps(ScrArea *sa)
-{
- float fps;
- char printable[16];
-
-
- if (lredrawtime == redrawtime)
- return;
-
- printable[0] = '\0';
- fps = (float)(1.0/(lredrawtime-redrawtime));
-
- /* is this more then half a frame behind? */
- if (fps+0.5 < FPS) {
- BIF_ThemeColor(TH_REDALERT);
- sprintf(printable, "fps: %.2f", (float)fps);
- } else {
- BIF_ThemeColor(TH_TEXT_HI);
- sprintf(printable, "fps: %i", (int)(fps+0.5));
- }
-
- glRasterPos2i(10, sa->winy-20);
- BMF_DrawString(G.fonts, printable);
-}
-
-static void inner_play_prefetch_frame(int mode, int cfra)
-{
- ScrArea *sa;
- int oldcfra = CFRA;
- ScrArea *oldcurarea = curarea;
-
- if (!U.prefetchframes) {
- return;
- }
-
- CFRA = cfra;
-
- sa= G.curscreen->areabase.first;
- while(sa) {
- if(sa==oldsa) {
- scrarea_do_winprefetchdraw(sa);
- }
- else if(mode & 1) { /* all view3d and seq spaces */
- if ELEM(sa->spacetype, SPACE_VIEW3D, SPACE_SEQ) {
- scrarea_do_winprefetchdraw(sa);
- }
- }
- else if(mode & 4) { /* all seq spaces */
- if (sa->spacetype == SPACE_SEQ) {
- scrarea_do_winprefetchdraw(sa);
- }
- }
-
- sa= sa->next;
- }
-
- CFRA = oldcfra;
- curarea = oldcurarea;
-}
-
-static void inner_play_prefetch_startup(int mode)
-{
- int i;
-
- if (!U.prefetchframes) {
- return;
- }
-
- seq_start_threads();
-
- for (i = 0; i <= U.prefetchframes; i++) {
- int cfra = CFRA + i;
- inner_play_prefetch_frame(mode, cfra);
- }
-
- seq_wait_for_prefetch_ready();
-}
-
-static void inner_play_prefetch_shutdown(int mode)
-{
- if (!U.prefetchframes) {
- return;
- }
- seq_stop_threads();
-}
-
-static int cached_dynamics(int sfra, int efra)
-{
- Base *base = G.scene->base.first;
- Object *ob;
- ModifierData *md;
- ParticleSystem *psys;
- int i, stack_index=-1, cached=1;
-
- while(base && cached) {
- ob = base->object;
- if(ob->softflag & OB_SB_ENABLE && ob->soft) {
- for(i=0, md=ob->modifiers.first; md; i++, md=md->next) {
- if(md->type == eModifierType_Softbody) {
- stack_index = i;
- break;
- }
- }
- for(i=sfra; i<=efra && cached; i++)
- cached &= BKE_ptcache_id_exist(&ob->id,i,stack_index);
- }
-
- for(psys=ob->particlesystem.first; psys; psys=psys->next) {
- stack_index = modifiers_indexInObject(ob,(ModifierData*)psys_get_modifier(ob,psys));
- if(psys->part->type==PART_HAIR) {
- if(psys->softflag & OB_SB_ENABLE && psys->soft);
- else
- stack_index = -1;
- }
-
- if(stack_index >= 0)
- for(i=sfra; i<=efra && cached; i++)
- cached &= BKE_ptcache_id_exist(&ob->id,i,stack_index);
- }
-
- base = base->next;
- }
-
- return cached;
-}
-void inner_play_anim_loop(int init, int mode)
-{
- ScrArea *sa;
- static int last_cfra = -1;
- static int cached = 0;
-
- /* init */
- if(init) {
- oldsa= curarea;
- swaptime= 1.0/FPS;
- tottime= 0.0;
- curmode= mode;
- last_cfra = -1;
- cached = cached_dynamics(PSFRA,PEFRA);
-
- redrawtime = 1.0/FPS;
- lredrawtime = 0.0;
- return;
- }
-
- if (CFRA != last_cfra) {
- int pf;
- set_timecursor(CFRA);
-
- update_for_newframe_nodraw(1); /* adds no events in UI */
-
- sa= G.curscreen->areabase.first;
- while(sa) {
- if(sa==oldsa) {
- scrarea_do_windraw(sa);
- }
- else if(curmode & 1) { /* all view3d and seq spaces */
- if ELEM(sa->spacetype, SPACE_VIEW3D, SPACE_SEQ) {
- scrarea_do_windraw(sa);
- }
- }
- else if(curmode & 4) { /* all seq spaces */
- if (sa->spacetype == SPACE_SEQ) {
- scrarea_do_windraw(sa);
- }
- }
-
- sa= sa->next;
- }
-
- if (last_cfra == -1) {
- last_cfra = CFRA - 1;
- }
-
- if (U.prefetchframes) {
- pf = last_cfra;
-
- if (CFRA - last_cfra >= U.prefetchframes ||
- CFRA - last_cfra < 0) {
- pf = CFRA - U.prefetchframes;
- fprintf(stderr,
- "SEQ-THREAD: Lost sync, "
- "stopping threads, "
- "back to skip mode...\n");
- seq_stop_threads();
- } else {
- while (pf < CFRA) {
- int c;
- pf++;
- c = pf + U.prefetchframes;
- if (c >= PEFRA) {
- c -= PEFRA;
- c += PSFRA;
- }
-
- inner_play_prefetch_frame(curmode, c);
- }
- }
-
- }
- }
-
- last_cfra = CFRA;
-
- /* make sure that swaptime passed by */
- tottime -= swaptime;
- while (update_time()) {
- PIL_sleep_ms(1);
- }
-
- if (CFRA >= PEFRA) {
- if (tottime > 0.0) {
- tottime = 0.0;
- }
- CFRA = PSFRA;
- audiostream_stop();
- audiostream_start( CFRA );
- cached = cached_dynamics(PSFRA,PEFRA);
- } else {
- if (cached
- && (G.scene->audio.flag & AUDIO_SYNC)) {
- CFRA = audiostream_pos();
- } else {
- CFRA++;
- }
- if (CFRA < last_cfra) {
- fprintf(stderr,
- "SEQ-THREAD: CFRA running backwards: %d\n",
- CFRA);
- }
- }
-
-}
-
-/* play_anim: 'mode' defines where to play and if repeat is on (now bitfield):
- * - mode & 1 : All view3d and seq areas
- * - mode & 2 : No replay
- * - mode & 4 : All seq areas
- */
-int play_anim(int mode)
-{
- ScrArea *sa, *oldsa;
- int cfraont;
- unsigned short event=0;
- short val;
-
- /* patch for very very old scenes */
- if(SFRA==0) SFRA= 1;
- if(EFRA==0) EFRA= 250;
-
- if(PSFRA>PEFRA) return 0;
-
- /* waitcursor(1); */
- G.f |= G_PLAYANIM; /* in sequence.c and view.c this is handled */
-
- cfraont= CFRA;
- oldsa= curarea;
-
- if (curarea && curarea->spacetype == SPACE_SEQ) {
- SpaceSeq *sseq = curarea->spacedata.first;
- if (sseq->mainb == 0) mode |= 4;
- }
-
- inner_play_prefetch_startup(mode);
-
- update_time();
-
- inner_play_anim_loop(1, mode); /* 1==init */
-
- audiostream_start( CFRA );
-
- /* forces all buffers to be OK for current frame (otherwise other windows get redrawn with CFRA+1) */
- curarea->win_swap= WIN_BACK_OK;
- screen_swapbuffers();
-
- while(TRUE) {
-
- if (U.uiflag & USER_SHOW_FPS)
- lredrawtime = PIL_check_seconds_timer();
-
- while(qtest()) {
-
- /* we test events first because of MKEY event */
-
- event= extern_qread(&val);
- if(event==ESCKEY) break;
- else if(event==MIDDLEMOUSE) {
- if(U.flag & USER_VIEWMOVE) {
- if(G.qual & LR_SHIFTKEY) viewmove(0);
- else if(G.qual & LR_CTRLKEY) viewmove(2);
- else viewmove(1);
- }
- else {
- if(G.qual & LR_SHIFTKEY) viewmove(1);
- else if(G.qual & LR_CTRLKEY) viewmove(2);
- else viewmove(0);
- }
- }
- else if(event==MKEY) {
- if(val) add_marker(CFRA-1);
- }
- }
- if(ELEM3(event, ESCKEY, SPACEKEY, RIGHTMOUSE)) break;
-
- inner_play_anim_loop(0, 0);
-
-
- screen_swapbuffers();
-
- if (U.uiflag & USER_SHOW_FPS)
- redrawtime = lredrawtime;
-
- if((mode & 2) && CFRA==PEFRA) break; /* no replay */
- }
-
- if(event==SPACEKEY);
- else CFRA= cfraont;
-
- inner_play_prefetch_shutdown(mode);
- audiostream_stop();
-
- if(oldsa!=curarea) areawinset(oldsa->win);
-
- /* restore all areas */
- sa= G.curscreen->areabase.first;
- while(sa) {
- if( ((mode & 1) && sa->spacetype==SPACE_VIEW3D) || sa==curarea) addqueue(sa->win, REDRAW, 1);
- sa= sa->next;
- }
-
- /* groups could have changed ipo */
- allspace(REMAKEIPO, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWNLA, 0);
- allqueue (REDRAWACTION, 0);
-
- /* restore for cfra */
- update_for_newframe_muted();
-
- waitcursor(0);
- G.f &= ~G_PLAYANIM;
-
- if (event==ESCKEY || event==SPACEKEY) return 1;
- else return 0;
-}
diff --git a/source/blender/src/edit.c b/source/blender/src/edit.c
deleted file mode 100644
index fcd38ef16a7..00000000000
--- a/source/blender/src/edit.c
+++ /dev/null
@@ -1,1936 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <math.h>
-#include <string.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef WIN32
-#include <unistd.h>
-#else
-#include <io.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "BMF_Api.h"
-
-#include "PIL_time.h"
-
-#include "DNA_action_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_group_types.h"
-#include "DNA_ipo_types.h"
-#include "DNA_lattice_types.h"
-#include "DNA_meta_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_modifier_types.h"
-#include "DNA_object_types.h"
-#include "DNA_particle_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_space_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_userdef_types.h" /* for U.dupflag */
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_editVert.h"
-#include "BLI_linklist.h"
-
-#include "BKE_action.h"
-#include "BKE_armature.h"
-#include "BKE_anim.h"
-#include "BKE_curve.h"
-#include "BKE_depsgraph.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_displist.h"
-#include "BKE_global.h"
-#include "BKE_ipo.h"
-#include "BKE_lattice.h"
-#include "BKE_mesh.h"
-#include "BKE_modifier.h"
-#include "BKE_object.h"
-#include "BKE_particle.h"
-#include "BKE_utildefines.h"
-
-#ifdef WITH_VERSE
-#include "BKE_verse.h"
-#endif
-
-#include "BIF_editmesh.h"
-#include "BIF_editview.h"
-#include "BIF_editarmature.h"
-#include "BIF_editparticle.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-#include "BIF_interface.h"
-#include "BIF_mywindow.h"
-#include "BIF_resources.h"
-#include "BIF_space.h"
-#include "BIF_screen.h"
-#include "BIF_toolbox.h"
-
-#ifdef WITH_VERSE
-#include "BIF_verse.h"
-#endif
-
-#include "BSE_edit.h"
-#include "BSE_drawipo.h"
-#include "BSE_drawview.h"
-#include "BSE_trans_types.h"
-#include "BSE_view.h"
-
-#include "BDR_editobject.h"
-#include "BDR_editmball.h"
-#include "BDR_editcurve.h"
-
-/* old stuff */
-#include "blendef.h"
-#include "mydevice.h"
-
-/*#include "armature.h"*/
-/* #include "edit.h" */
-#include "nla.h"
-#include "transform.h"
-
-#ifdef __NLA
-#include "BIF_editarmature.h"
-#endif
-
-
-/* circle selection callback */
-typedef void (*select_CBfunc)(short selecting, Object *editobj, short *mval, float rad);
-
-extern void obedit_selectionCB(short selecting, Object *editobj,
- short *mval, float rad);
-extern void uvedit_selectionCB(short selecting, Object *editobj,
- short *mval, float rad);
-
-void circle_selectCB(select_CBfunc func);
-
-/* local protos ---------------*/
-void snap_curs_to_firstsel(void);
-
-/* flag==2 only border, flag==3 cross+border
- flag==5 cross + border + start&end frame
- */
-int get_border(rcti *rect, short flag)
-{
- float dvec[4], fac1, fac2;
- int retval=1;
- unsigned short event= 0;
- short mval[2], mvalo[4], val, x1, y1;
- char str[64];
-
- mywinset(G.curscreen->mainwin);
-
- /* slightly larger, 1 pixel at the edge */
- glReadBuffer(GL_FRONT);
- glDrawBuffer(GL_FRONT);
-
- /* removed my_get_frontbuffer, this crashes when it gets a part outside the screen */
- /* solved it with just a redraw! */
-
- mywinset(curarea->win);
-
- glDrawBuffer(GL_FRONT);
- persp(PERSP_WIN);
- initgrabz(0.0, 0.0, 0.0);
-
- if(flag & 1) {
- getmouseco_areawin(mvalo);
-
- /* draws the selection initial cross */
- sdrawXORline4(0, 0, mvalo[1], curarea->winx, mvalo[1]);
- sdrawXORline4(1, mvalo[0], 0, mvalo[0], curarea->winy);
- bglFlush();
-
- while(TRUE) {
-
- /* selection loop while mouse pressed */
- getmouseco_areawin(mval);
-
- if(mvalo[0]!=mval[0] || mvalo[1]!=mval[1]) {
-
- /* aiming cross */
- sdrawXORline4(0, 0, mval[1], curarea->winx, mval[1]);
- sdrawXORline4(1, mval[0], 0, mval[0], curarea->winy);
- bglFlush();
-
- mvalo[0]= mval[0];
- mvalo[1]= mval[1];
- }
- event= extern_qread(&val);
-
- if(event && val) {
-
- /* for when a renderwindow is open, and a mouse cursor activates it */
- persp(PERSP_VIEW);
- mywinset(curarea->win);
- persp(PERSP_WIN);
-
- if(event==ESCKEY) {
- retval= 0;
- break;
- }
- else if(event==BKEY) {
- /* b has been pressed twice: proceed with circle select */
- retval= 0;
- break;
- }
- else if(event==LEFTMOUSE) break;
- else if(event==MIDDLEMOUSE) break;
- else if(event==RIGHTMOUSE) break;
- }
- else PIL_sleep_ms(10);
-
- } /* end while (TRUE) */
-
- /* erase XORed lines */
- sdrawXORline4(-1, 0, 0, 0, 0);
- }
- else getmouseco_areawin(mval);
-
- if(retval) {
- /* box select */
- x1= mval[0];
- y1= mval[1];
-
- getmouseco_areawin(mvalo);
-
- sdrawXORline4(0, x1, y1, x1, mvalo[1]);
- sdrawXORline4(1, x1, mvalo[1], mvalo[0], mvalo[1]);
- sdrawXORline4(2, mvalo[0], mvalo[1], mvalo[0], y1);
- sdrawXORline4(3, mvalo[0], y1, x1, y1);
- bglFlush();
-
- while(TRUE) {
- getmouseco_areawin(mval);
- if(mvalo[0]!=mval[0] || mvalo[1]!=mval[1]) {
-
- sdrawXORline4(0, x1, y1, x1, mval[1]);
- sdrawXORline4(1, x1, mval[1], mval[0], mval[1]);
- sdrawXORline4(2, mval[0], mval[1], mval[0], y1);
- sdrawXORline4(3, mval[0], y1, x1, y1);
-
- /* draw size information in corner */
- if(curarea->spacetype==SPACE_VIEW3D) {
- BIF_ThemeColor(TH_BACK);
- glRecti(10, 25, 250, 40);
-
- if(G.vd->persp==0) {
- window_to_3d(dvec, mvalo[0]-x1, mvalo[1]-y1);
-
- sprintf(str, "X %.4f Y %.4f Z %.4f Dia %.4f", dvec[0], dvec[1], dvec[2], sqrt(dvec[0]*dvec[0]+dvec[1]*dvec[1]+dvec[2]*dvec[2]));
- glColor3f(0.0, 0.0, 0.0);
- glRasterPos2i(15, 27);
- BMF_DrawString(G.fonts, str);
- glColor3f(0.7, 0.7, 0.7);
- glRasterPos2i(16, 28);
- BMF_DrawString(G.fonts, str);
- }
- else if(G.vd->persp==2) {
- rctf vb;
-
- calc_viewborder(G.vd, &vb);
-
- fac1= (mvalo[0]-x1)/( (float) (vb.xmax-vb.xmin) );
- fac1*= 0.01*G.scene->r.size*G.scene->r.xsch;
-
- fac2= (mvalo[1]-y1)/( (float) (vb.ymax-vb.ymin) );
- fac2*= 0.01*G.scene->r.size*G.scene->r.ysch;
-
- sprintf(str, "X %.1f Y %.1f Dia %.1f", fabs(fac1), fabs(fac2), sqrt(fac1*fac1 + fac2*fac2) );
- glColor3f(0.0, 0.0, 0.0);
- glRasterPos2i(15, 27);
- BMF_DrawString(G.fonts, str);
- glColor3f(0.7, 0.7, 0.7);
- glRasterPos2i(16, 28);
- BMF_DrawString(G.fonts, str);
- }
- }
- else if(curarea->spacetype==SPACE_IPO) {
- SpaceIpo *sipo= curarea->spacedata.first;
-
- BIF_ThemeColor(TH_BACK);
- glRecti(20, 30, 170, 40);
-
- mvalo[2]= x1;
- mvalo[3]= y1;
- areamouseco_to_ipoco(&sipo->v2d, mval, dvec, dvec+1);
- areamouseco_to_ipoco(&sipo->v2d, mvalo+2, dvec+2, dvec+3);
-
- if (flag == 5) {
- /* setting preview range */
- if (dvec[0] < dvec[2])
- sprintf(str, "Preview Range: %d to %d", (int)dvec[0], (int)dvec[2]);
- else
- sprintf(str, "Preview Range: %d to %d", (int)dvec[2], (int)dvec[0]);
- }
- else
- sprintf(str, "Time: %.4f Y %.4f", dvec[0]-dvec[2], dvec[1]-dvec[3]);
-
- BIF_ThemeColor(TH_BACK);
- glRecti(14, 24, 165, 38);
-
- glColor3f(0.0, 0.0, 0.0);
- glRasterPos2i(15, 27);
- BMF_DrawString(G.fonts, str);
- glColor3f(0.8, 0.8, 0.8);
- glRasterPos2i(16, 28);
- BMF_DrawString(G.fonts, str);
- }
- else if ((ELEM3(curarea->spacetype, SPACE_ACTION, SPACE_NLA, SPACE_TIME)) && flag==5) {
- /* only while setting preview range */
- View2D *v2d;
-
- switch (curarea->spacetype)
- {
- case SPACE_ACTION:
- {
- SpaceAction *saaction= curarea->spacedata.first;
- v2d= &saaction->v2d;
- }
- break;
- case SPACE_NLA:
- {
- SpaceNla *snla= curarea->spacedata.first;
- v2d= &snla->v2d;
- }
- break;
- default:
- v2d= G.v2d;
- break;
- }
-
- mvalo[2]= x1;
- mvalo[3]= y1;
- areamouseco_to_ipoco(v2d, mval, dvec, dvec+1);
- areamouseco_to_ipoco(v2d, mvalo+2, dvec+2, dvec+3);
-
- if (dvec[0] < dvec[2])
- sprintf(str, "Preview Range: %d to %d", (int)dvec[0], (int)dvec[2]);
- else
- sprintf(str, "Preview Range: %d to %d", (int)dvec[2], (int)dvec[0]);
-
- BIF_ThemeColor(TH_BACK);
- glRecti(14, 24, 165, 38);
-
- glColor3f(0.0, 0.0, 0.0);
- glRasterPos2i(15, 27);
- BMF_DrawString(G.fonts, str);
- glColor3f(0.8, 0.8, 0.8);
- glRasterPos2i(16, 28);
- BMF_DrawString(G.fonts, str);
- }
-
- bglFlush();
-
- mvalo[0]= mval[0];
- mvalo[1]= mval[1];
- }
-
- event= extern_qread(&val);
-
- if(event && val==0) {
- /* still because of the renderwindow... */
- persp(PERSP_VIEW);
- mywinset(curarea->win);
- persp(PERSP_WIN);
-
- if(event==ESCKEY) {
- retval= 0;
- break;
- }
- else if(event==LEFTMOUSE) break;
- else if(event==MIDDLEMOUSE) break;
- else if(event==RIGHTMOUSE) break;
- }
-
- } /* end while (TRUE) */
- sdrawXORline4(-1, 0, 0, 0, 0);
-
- if(retval) {
- rect->xmin= x1;
- rect->ymin= y1;
- rect->xmax= mval[0];
- rect->ymax= mval[1];
- retval= event;
-
- /* normalize */
- if(rect->xmin>rect->xmax) SWAP(int, rect->xmin, rect->xmax);
- if(rect->ymin>rect->ymax) SWAP(int, rect->ymin, rect->ymax);
-
- if(rect->xmin==rect->xmax) retval= 0;
- if(rect->ymin==rect->ymax) retval= 0;
- }
- }
-
-
- /* clear */
- if(event!=BKEY) {
- if ELEM(curarea->spacetype, SPACE_VIEW3D, SPACE_IPO) {
- scrarea_queue_winredraw(curarea);
- }
- else if ELEM3(curarea->spacetype, SPACE_ACTION, SPACE_NLA, SPACE_TIME) {
- scrarea_queue_winredraw(curarea); // only really needed for
- }
- }
-
- bglFlush();
- glReadBuffer(GL_BACK);
- glDrawBuffer(GL_BACK);
-
- persp(PERSP_VIEW);
-
- /* pressed B again ? -> brush select */
- if(event==BKEY) {
- setlinestyle(0);
- switch (curarea->spacetype) {
- case SPACE_VIEW3D:
- if (G.obedit) {
- if ELEM4(G.obedit->type, OB_MESH, OB_CURVE, OB_SURF, OB_LATTICE) {
- circle_selectCB(&obedit_selectionCB);
- }
- }
- else if (FACESEL_PAINT_TEST) {
- circle_selectCB(&obedit_selectionCB);
- }
- else if (G.f&G_PARTICLEEDIT) {
- circle_selectCB(&PE_selectionCB);
- }
- return 0;
-
- case SPACE_IMAGE: // brush select in UV editor
- circle_selectCB(&uvedit_selectionCB);
- // this is a hack; we return 0 that the caller from get_border
- // doesn't execute the selection code for border select..
- return 0;
- }
- }
- return retval;
-}
-
-void draw_sel_circle(short *mval, short *mvalo, float rad, float rado, int selecting)
-{
- static short no_mvalo=0;
-
- if(mval==NULL && mvalo==NULL) { /* signal */
- no_mvalo= 1;
- return;
- }
-
- persp(PERSP_WIN);
- glReadBuffer(GL_FRONT);
- glDrawBuffer(GL_FRONT);
- //setlinestyle(2);
-
- /* draw circle */
- if(mvalo && no_mvalo==0) {
- fdrawXORcirc(mvalo[0], mvalo[1], rado);
- }
-
- if(mval) {
- fdrawXORcirc(mval[0], mval[1], rad);
- }
- //setlinestyle(0);
-
- bglFlush();
- persp(PERSP_VIEW);
- glDrawBuffer(GL_BACK);
- glReadBuffer(GL_BACK);
-
- no_mvalo= 0;
-}
-
-/** This function does the same as editview.c:circle_select(),
- * but the selection actions are defined by a callback, making
- * it (hopefully) reusable for other windows than the 3D view.
- */
-
-void circle_selectCB(select_CBfunc callback)
-{
- static float rad= 40.0;
- float rado= rad;
- int firsttime=1;
- int escape= 0;
- unsigned short event;
- short mvalo[2], mval[2], val;
- short selecting=0;
- Object *obj;
-
- if(G.obedit) obj = G.obedit;
- else obj = OBACT;
-
- mywinset(curarea->win);
-
- getmouseco_areawin(mvalo);
- mval[0]= mvalo[0]; mval[1]= mvalo[1];
-
- draw_sel_circle(mval, NULL, rad, 0.0, selecting); // draws frontbuffer, but sets backbuf again
-
- while(TRUE) {
-
- if(mval[0]!=mvalo[0] || mval[1]!=mvalo[1] || rado!=rad || firsttime) {
- firsttime= 0;
-
- if(selecting) {
- callback(selecting, obj, mval, rad);
- }
-
- draw_sel_circle(mval, mvalo, rad, rado, selecting);
-
- mvalo[0]= mval[0];
- mvalo[1]= mval[1];
- rado= rad;
-
- }
-
- while(qtest()) {
- event= extern_qread(&val);
- if (event) {
-
- /* for when another window is open and a mouse cursor activates it */
- if(event!=MOUSEY && event!=MOUSEX) mywinset(curarea->win);
-
- getmouseco_areawin(mval); // important to do here, trust events!
-
- switch(event) {
-
- case LEFTMOUSE:
- case MIDDLEMOUSE:
- if(val) selecting= event;
- else selecting= 0;
- firsttime= 1;
-
- break;
- case PAGEUPKEY:
- case WHEELDOWNMOUSE:
- case PADPLUSKEY:
- case EQUALKEY:
- if(val) if(rad<200.0) rad*= 1.2;
- break;
- case PAGEDOWNKEY:
- case WHEELUPMOUSE:
- case PADMINUS:
- case MINUSKEY:
- if(val) if(rad>5.0) rad/= 1.2;
- break;
-
- case ESCKEY: case SPACEKEY: case RIGHTMOUSE: case INPUTCHANGE:
- case GKEY: case SKEY: case RKEY: case XKEY: case EKEY: case TABKEY:
- escape= 1;
- break;
-
- }
-
- if(escape) break;
- }
- }
- PIL_sleep_ms(10);
-
- if(escape) break;
- }
-
- /* clear circle */
- draw_sel_circle(NULL, mvalo, 0, rad, 1);
- BIF_undo_push("Circle Select");
- countall();
- allqueue(REDRAWINFO, 0);
-}
-
-static void count_object(Object *ob, int sel, int totob)
-{
- Mesh *me;
- Curve *cu;
- DerivedMesh *dm;
- int tot=0, totf=0;
-
- switch(ob->type) {
- case OB_MESH:
- G.totmesh+=totob;
- me= get_mesh(ob);
- if(me) {
- int totvert, totedge, totface;
- dm = mesh_get_derived_final(ob, get_viewedit_datamask());
- totvert = dm->getNumVerts(dm);
- totedge = dm->getNumEdges(dm);
- totface = dm->getNumFaces(dm);
-
- G.totvert+= totvert*totob;
- G.totedge+= totedge*totob;
- G.totface+= totface*totob;
- if(sel) {
- G.totvertsel+= totvert;
- G.totfacesel+= totface;
- }
- }
- break;
-
- case OB_LAMP:
- G.totlamp+=totob;
- break;
- case OB_SURF:
- case OB_CURVE:
- case OB_FONT:
- G.totcurve+=totob;
- tot=totf= 0;
- cu= ob->data;
- if(cu->disp.first)
- count_displist( &cu->disp, &tot, &totf);
- tot*= totob;
- totf*= totob;
- G.totvert+= tot;
- G.totface+= totf;
- if(sel) {
- G.totvertsel+= tot;
- G.totfacesel+= totf;
- }
- break;
- case OB_MBALL:
- count_displist( &ob->disp, &tot, &totf);
- tot*= totob;
- totf*= totob;
- G.totvert+= tot;
- G.totface+= totf;
- if(sel) {
- G.totvertsel+= tot;
- G.totfacesel+= totf;
- }
- break;
- }
-
-}
-
-/* countall does statistics */
-/* is called on most actions, like select/add/delete/layermove */
-void countall()
-{
- extern ListBase editNurb;
- Base *base;
- Object *ob= OBACT;
- Mesh *me;
- Nurb *nu;
- BezTriple *bezt;
- BPoint *bp;
- MetaElem *ml;
- struct EditBone *ebo;
- int a;
-
- G.totvert= G.totvertsel= G.totedge= G.totedgesel= G.totfacesel= G.totface= G.totobj=
- G.totmesh= G.totlamp= G.totcurve= G.totobjsel= G.totbone= G.totbonesel= 0;
-
- if(G.obedit) {
-
- if(G.obedit->type==OB_MESH) {
- EditMesh *em = G.editMesh;
- EditVert *eve;
- EditEdge *eed;
- EditFace *efa;
-
- for(eve= em->verts.first; eve; eve= eve->next) {
- G.totvert++;
- if(eve->f & SELECT) G.totvertsel++;
- }
- for(eed= em->edges.first; eed; eed= eed->next) {
- G.totedge++;
- if(eed->f & SELECT) G.totedgesel++;
- }
- for(efa= em->faces.first; efa; efa= efa->next) {
- G.totface++;
- if(efa->f & SELECT) G.totfacesel++;
- }
-
- EM_validate_selections();
- }
- else if (G.obedit->type==OB_ARMATURE){
- for (ebo=G.edbo.first;ebo;ebo=ebo->next){
- G.totbone++;
-
- /* Sync selection to parent for connected children */
- if ((ebo->flag & BONE_CONNECTED) && ebo->parent){
- G.totvert--;
- if (ebo->parent->flag & BONE_TIPSEL)
- ebo->flag |= BONE_ROOTSEL;
- else
- ebo->flag &= ~BONE_ROOTSEL;
- }
-
- if (ebo->flag & BONE_TIPSEL)
- G.totvertsel++;
- if (ebo->flag & BONE_ROOTSEL)
- G.totvertsel++;
-
- if ((ebo->flag & BONE_TIPSEL) && (ebo->flag & BONE_ROOTSEL))
- ebo->flag |= BONE_SELECTED;
- else
- ebo->flag &= ~BONE_SELECTED;
-
- if(ebo->flag & BONE_SELECTED) G.totbonesel++;
-
- // If this is a connected child and it's parent is being moved, remove our root
- if ((ebo->flag & BONE_CONNECTED)&& (ebo->flag & BONE_ROOTSEL) && ebo->parent && (ebo->parent->flag & BONE_TIPSEL)){
- G.totvertsel--;
- }
-
- G.totvert+=2;
- }
- }
- else if ELEM3(G.obedit->type, OB_CURVE, OB_SURF, OB_FONT) {
- nu= editNurb.first;
- while(nu) {
- if((nu->type & 7)==CU_BEZIER) {
- bezt= nu->bezt;
- a= nu->pntsu;
- while(a--) {
- G.totvert+=3;
- if(bezt->f1) G.totvertsel++;
- if(bezt->f2) G.totvertsel++;
- if(bezt->f3) G.totvertsel++;
- bezt++;
- }
- }
- else {
- bp= nu->bp;
- a= nu->pntsu*nu->pntsv;
- while(a--) {
- G.totvert++;
- if(bp->f1 & SELECT) G.totvertsel++;
- bp++;
- }
- }
- nu= nu->next;
- }
- }
- else if(G.obedit->type==OB_MBALL) {
- /* editmball.c */
- extern ListBase editelems; /* go away ! */
-
- ml= editelems.first;
- while(ml) {
- G.totvert++;
- if(ml->flag & SELECT) G.totvertsel++;
- ml= ml->next;
- }
- }
- else if(G.obedit->type==OB_LATTICE) {
- bp= editLatt->def;
-
- a= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw;
- while(a--) {
- G.totvert++;
- if(bp->f1 & SELECT) G.totvertsel++;
- bp++;
- }
- }
-
- allqueue(REDRAWINFO, 1); /* 1, because header->win==0! */
- return;
- }
- else if(ob && (ob->flag & OB_POSEMODE)) {
- if(ob->pose) {
- bArmature *arm= ob->data;
- bPoseChannel *pchan;
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- G.totbone++;
- if(pchan->bone && (pchan->bone->flag & BONE_SELECTED))
- if(pchan->bone->layer & arm->layer)
- G.totbonesel++;
- }
- }
- allqueue(REDRAWINFO, 1); /* 1, because header->win==0! */
- return;
- }
- else if(FACESEL_PAINT_TEST) {
- me= get_mesh((G.scene->basact) ? (G.scene->basact->object) : 0);
- if(me) {
- G.totface= me->totface;
- G.totvert= me->totvert;
- }
- allqueue(REDRAWINFO, 1); /* 1, because header->win==0! */
- return;
- }
-
- if(G.scene==NULL) return;
-
- base= (G.scene->base.first);
- while(base) {
- if(G.scene->lay & base->lay) {
- ob= base->object; /* warning, ob not is obact anymore */
-
- if(base->flag & SELECT) G.totobjsel++;
-
- if(ob->transflag & OB_DUPLIPARTS) {
- ParticleSystem *psys;
- ParticleSettings *part;
- int step_nbr;
-
- for(psys=ob->particlesystem.first; psys; psys=psys->next){
- part=psys->part;
-
- //if(psys->flag&PSYS_BAKED && part->draw&PART_DRAW_KEYS)
- // step_nbr=part->keys_step;
- //else
- step_nbr=1;
-
- if(part->draw_as==PART_DRAW_OB && part->dup_ob){
- int tot=count_particles(psys);
- count_object(part->dup_ob, 0, tot*step_nbr);
- }
- else if(part->draw_as==PART_DRAW_GR && part->dup_group){
- GroupObject *go;
- int tot, totgroup=0, cur=0;
-
- go= part->dup_group->gobject.first;
- while(go){
- go=go->next;
- totgroup++;
- }
- go= part->dup_group->gobject.first;
- while(go){
- tot=count_particles_mod(psys,totgroup,cur);
- count_object(go->ob, 0, tot*step_nbr);
- cur++;
- go=go->next;
- }
- }
- }
-
- count_object(ob, base->flag & SELECT, 1);
- G.totobj++;
- }
- else if(ob->parent && (ob->parent->transflag & (OB_DUPLIVERTS|OB_DUPLIFACES))) {
- int tot= count_duplilist(ob->parent);
- G.totobj+=tot;
- count_object(ob, base->flag & SELECT, tot);
- }
- else if(ob->transflag & OB_DUPLIFRAMES) {
- int tot= count_duplilist(ob);
- G.totobj+=tot;
- count_object(ob, base->flag & SELECT, tot);
- }
- else {
- count_object(ob, base->flag & SELECT, 1);
- G.totobj++;
- }
- }
- base= base->next;
- }
- allqueue(REDRAWINFO, 1); /* 1, because header->win==0! */
-}
-
-/* ************************************************** */
-/* ********************* old transform stuff ******** */
-/* ************************************************** */
-
-static TransVert *transvmain=NULL;
-static int tottrans= 0;
-
-/* copied from editobject.c, now uses (almost) proper depgraph */
-static void special_transvert_update(void)
-{
-
- if(G.obedit) {
-
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-
- if(G.obedit->type==OB_MESH) {
-#ifdef WITH_VERSE
- if(G.editMesh->vnode)
- sync_all_verseverts_with_editverts((VNode*)G.editMesh->vnode);
-#endif
- recalc_editnormals(); // does face centers too
- }
- else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
- extern ListBase editNurb;
- Nurb *nu= editNurb.first;
- while(nu) {
- test2DNurb(nu);
- testhandlesNurb(nu); /* test for bezier too */
- nu= nu->next;
- }
- }
- else if(G.obedit->type==OB_ARMATURE){
- bArmature *arm= G.obedit->data;
- EditBone *ebo;
- TransVert *tv= transvmain;
- int a=0;
-
- /* Ensure all bone tails are correctly adjusted */
- for (ebo=G.edbo.first; ebo; ebo=ebo->next) {
- /* adjust tip if both ends selected */
- if ((ebo->flag & BONE_ROOTSEL) && (ebo->flag & BONE_TIPSEL)) {
- if (tv) {
- float diffvec[3];
-
- VecSubf(diffvec, tv->loc, tv->oldloc);
- VecAddf(ebo->tail, ebo->tail, diffvec);
-
- a++;
- if (a<tottrans) tv++;
- }
- }
- }
-
- /* Ensure all bones are correctly adjusted */
- for (ebo=G.edbo.first; ebo; ebo=ebo->next) {
- if ((ebo->flag & BONE_CONNECTED) && ebo->parent){
- /* If this bone has a parent tip that has been moved */
- if (ebo->parent->flag & BONE_TIPSEL){
- VECCOPY (ebo->head, ebo->parent->tail);
- }
- /* If this bone has a parent tip that has NOT been moved */
- else{
- VECCOPY (ebo->parent->tail, ebo->head);
- }
- }
- }
- if(arm->flag & ARM_MIRROR_EDIT)
- transform_armature_mirror_update();
- }
- else if(G.obedit->type==OB_LATTICE) {
- if(editLatt->flag & LT_OUTSIDE) outside_lattice(editLatt);
- }
- }
-}
-
-/* copied from editobject.c, needs to be replaced with new transform code still */
-/* mode: 1 = proportional, 2 = all joints (for bones only) */
-static void make_trans_verts(float *min, float *max, int mode)
-{
- extern ListBase editNurb;
- EditMesh *em = G.editMesh;
- Nurb *nu;
- BezTriple *bezt;
- BPoint *bp;
- TransVert *tv=NULL;
- MetaElem *ml;
- EditVert *eve;
- EditBone *ebo;
- float total, center[3], centroid[3];
- int a;
-
- tottrans= 0; // global!
-
- INIT_MINMAX(min, max);
- centroid[0]=centroid[1]=centroid[2]= 0.0;
-
- /* note for transform refactor: dont rely on countall anymore... its ancient */
- /* I skip it for editmesh now (ton) */
- if(G.obedit->type!=OB_MESH) {
- countall();
- if(mode) tottrans= G.totvert;
- else tottrans= G.totvertsel;
-
- if(G.totvertsel==0) {
- tottrans= 0;
- return;
- }
- tv=transvmain= MEM_callocN(tottrans*sizeof(TransVert), "maketransverts");
- }
-
- /* we count again because of hide (old, not for mesh!) */
- tottrans= 0;
-
- if(G.obedit->type==OB_MESH) {
- int proptrans= 0;
-
- // transform now requires awareness for select mode, so we tag the f1 flags in verts
- tottrans= 0;
- if(G.scene->selectmode & SCE_SELECT_VERTEX) {
- for(eve= em->verts.first; eve; eve= eve->next) {
- if(eve->h==0 && (eve->f & SELECT)) {
- eve->f1= SELECT;
- tottrans++;
- }
- else eve->f1= 0;
- }
- }
- else if(G.scene->selectmode & SCE_SELECT_EDGE) {
- EditEdge *eed;
- for(eve= em->verts.first; eve; eve= eve->next) eve->f1= 0;
- for(eed= em->edges.first; eed; eed= eed->next) {
- if(eed->h==0 && (eed->f & SELECT)) eed->v1->f1= eed->v2->f1= SELECT;
- }
- for(eve= em->verts.first; eve; eve= eve->next) if(eve->f1) tottrans++;
- }
- else {
- EditFace *efa;
- for(eve= em->verts.first; eve; eve= eve->next) eve->f1= 0;
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->h==0 && (efa->f & SELECT)) {
- efa->v1->f1= efa->v2->f1= efa->v3->f1= SELECT;
- if(efa->v4) efa->v4->f1= SELECT;
- }
- }
- for(eve= em->verts.first; eve; eve= eve->next) if(eve->f1) tottrans++;
- }
-
- /* proportional edit exception... */
- if((mode & 1) && tottrans) {
- for(eve= em->verts.first; eve; eve= eve->next) {
- if(eve->h==0) {
- eve->f1 |= 2;
- proptrans++;
- }
- }
- if(proptrans>tottrans) tottrans= proptrans;
- }
-
- /* and now make transverts */
- if(tottrans) {
- tv=transvmain= MEM_callocN(tottrans*sizeof(TransVert), "maketransverts");
-
- for(eve= em->verts.first; eve; eve= eve->next) {
- if(eve->f1) {
- VECCOPY(tv->oldloc, eve->co);
- tv->loc= eve->co;
- if(eve->no[0]!=0.0 || eve->no[1]!=0.0 ||eve->no[2]!=0.0)
- tv->nor= eve->no; // note this is a hackish signal (ton)
- tv->flag= eve->f1 & SELECT;
- tv++;
- }
- }
- }
- }
- else if (G.obedit->type==OB_ARMATURE){
- bArmature *arm= G.obedit->data;
-
- for (ebo=G.edbo.first;ebo;ebo=ebo->next){
- if(ebo->layer & arm->layer) {
- short tipsel= (ebo->flag & BONE_TIPSEL);
- short rootsel= (ebo->flag & BONE_ROOTSEL);
- short rootok= (!(ebo->parent && (ebo->flag & BONE_CONNECTED) && ebo->parent->flag & BONE_TIPSEL));
-
- if ((tipsel && rootsel) || (rootsel)) {
- /* Don't add the tip (unless mode & 2, for getting all joints),
- * otherwise we get zero-length bones as tips will snap to the same
- * location as heads.
- */
- if (rootok) {
- VECCOPY (tv->oldloc, ebo->head);
- tv->loc= ebo->head;
- tv->nor= NULL;
- tv->flag= 1;
- tv++;
- tottrans++;
- }
-
- if ((mode & 2) && (tipsel)) {
- VECCOPY (tv->oldloc, ebo->tail);
- tv->loc= ebo->tail;
- tv->nor= NULL;
- tv->flag= 1;
- tv++;
- tottrans++;
- }
- }
- else if (tipsel) {
- VECCOPY (tv->oldloc, ebo->tail);
- tv->loc= ebo->tail;
- tv->nor= NULL;
- tv->flag= 1;
- tv++;
- tottrans++;
- }
- }
- }
- }
- else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
- nu= editNurb.first;
- while(nu) {
- if((nu->type & 7)==CU_BEZIER) {
- a= nu->pntsu;
- bezt= nu->bezt;
- while(a--) {
- if(bezt->hide==0) {
- if((mode & 1) || (bezt->f1 & SELECT)) {
- VECCOPY(tv->oldloc, bezt->vec[0]);
- tv->loc= bezt->vec[0];
- tv->flag= bezt->f1 & SELECT;
- tv++;
- tottrans++;
- }
- if((mode & 1) || (bezt->f2 & SELECT)) {
- VECCOPY(tv->oldloc, bezt->vec[1]);
- tv->loc= bezt->vec[1];
- tv->val= &(bezt->alfa);
- tv->oldval= bezt->alfa;
- tv->flag= bezt->f2 & SELECT;
- tv++;
- tottrans++;
- }
- if((mode & 1) || (bezt->f3 & SELECT)) {
- VECCOPY(tv->oldloc, bezt->vec[2]);
- tv->loc= bezt->vec[2];
- tv->flag= bezt->f3 & SELECT;
- tv++;
- tottrans++;
- }
- }
- bezt++;
- }
- }
- else {
- a= nu->pntsu*nu->pntsv;
- bp= nu->bp;
- while(a--) {
- if(bp->hide==0) {
- if((mode & 1) || (bp->f1 & SELECT)) {
- VECCOPY(tv->oldloc, bp->vec);
- tv->loc= bp->vec;
- tv->val= &(bp->alfa);
- tv->oldval= bp->alfa;
- tv->flag= bp->f1 & SELECT;
- tv++;
- tottrans++;
- }
- }
- bp++;
- }
- }
- nu= nu->next;
- }
- }
- else if(G.obedit->type==OB_MBALL) {
- extern ListBase editelems; /* go away ! */
- ml= editelems.first;
- while(ml) {
- if(ml->flag & SELECT) {
- tv->loc= &ml->x;
- VECCOPY(tv->oldloc, tv->loc);
- tv->val= &(ml->rad);
- tv->oldval= ml->rad;
- tv->flag= 1;
- tv++;
- tottrans++;
- }
- ml= ml->next;
- }
- }
- else if(G.obedit->type==OB_LATTICE) {
- bp= editLatt->def;
-
- a= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw;
-
- while(a--) {
- if((mode & 1) || (bp->f1 & SELECT)) {
- if(bp->hide==0) {
- VECCOPY(tv->oldloc, bp->vec);
- tv->loc= bp->vec;
- tv->flag= bp->f1 & SELECT;
- tv++;
- tottrans++;
- }
- }
- bp++;
- }
- }
-
- /* cent etc */
- tv= transvmain;
- total= 0.0;
- for(a=0; a<tottrans; a++, tv++) {
- if(tv->flag & SELECT) {
- centroid[0]+= tv->oldloc[0];
- centroid[1]+= tv->oldloc[1];
- centroid[2]+= tv->oldloc[2];
- total+= 1.0;
- DO_MINMAX(tv->oldloc, min, max);
- }
- }
- if(total!=0.0) {
- centroid[0]/= total;
- centroid[1]/= total;
- centroid[2]/= total;
- }
-
- center[0]= (min[0]+max[0])/2.0;
- center[1]= (min[1]+max[1])/2.0;
- center[2]= (min[2]+max[2])/2.0;
-
-}
-
-void snap_sel_to_grid()
-{
- extern float originmat[3][3]; /* object.c */
- TransVert *tv;
- Base *base;
- Object *ob;
- float gridf, imat[3][3], bmat[3][3], vec[3];
- int a;
-
- gridf= G.vd->gridview;
-
-
- if(G.obedit) {
- tottrans= 0;
-
- if ELEM6(G.obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE, OB_MBALL)
- make_trans_verts(bmat[0], bmat[1], 0);
- if(tottrans==0) return;
-
- Mat3CpyMat4(bmat, G.obedit->obmat);
- Mat3Inv(imat, bmat);
-
- tv= transvmain;
- for(a=0; a<tottrans; a++, tv++) {
-
- VECCOPY(vec, tv->loc);
- Mat3MulVecfl(bmat, vec);
- VecAddf(vec, vec, G.obedit->obmat[3]);
- vec[0]= G.vd->gridview*floor(.5+ vec[0]/gridf);
- vec[1]= G.vd->gridview*floor(.5+ vec[1]/gridf);
- vec[2]= G.vd->gridview*floor(.5+ vec[2]/gridf);
- VecSubf(vec, vec, G.obedit->obmat[3]);
-
- Mat3MulVecfl(imat, vec);
- VECCOPY(tv->loc, vec);
-
- }
-
- special_transvert_update();
-
- MEM_freeN(transvmain);
- transvmain= 0;
-
- allqueue(REDRAWVIEW3D, 0);
- return;
- }
-
- base= (G.scene->base.first);
- while(base) {
- if( ( ((base)->flag & SELECT) && ((base)->lay & G.vd->lay) && ((base)->object->id.lib==0))) {
- ob= base->object;
- if(ob->flag & OB_POSEMODE) {
- bPoseChannel *pchan;
- bArmature *arm= ob->data;
-
- for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if(pchan->bone->flag & BONE_SELECTED) {
- if(pchan->bone->layer & arm->layer) {
- if((pchan->bone->flag & BONE_CONNECTED)==0) {
- float vecN[3], nLoc[3];
-
- /* get nearest grid point to snap to */
- VECCOPY(nLoc, pchan->pose_mat[3]);
- vec[0]= gridf * (float)(floor(.5+ nLoc[0]/gridf));
- vec[1]= gridf * (float)(floor(.5+ nLoc[1]/gridf));
- vec[2]= gridf * (float)(floor(.5+ nLoc[2]/gridf));
-
- /* get bone-space location of grid point */
- armature_loc_pose_to_bone(pchan, vec, vecN);
-
- /* adjust location */
- VECCOPY(pchan->loc, vecN);
- }
- /* if the bone has a parent and is connected to the parent,
- * don't do anything - will break chain unless we do auto-ik.
- */
- }
- }
- }
- ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK);
-
- /* auto-keyframing */
- autokeyframe_pose_cb_func(ob, TFM_TRANSLATION, 0);
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- }
- else {
- ob->recalc |= OB_RECALC_OB;
-
- vec[0]= -ob->obmat[3][0]+G.vd->gridview*floor(.5+ ob->obmat[3][0]/gridf);
- vec[1]= -ob->obmat[3][1]+G.vd->gridview*floor(.5+ ob->obmat[3][1]/gridf);
- vec[2]= -ob->obmat[3][2]+G.vd->gridview*floor(.5+ ob->obmat[3][2]/gridf);
-
- if(ob->parent) {
- where_is_object(ob);
-
- Mat3Inv(imat, originmat);
- Mat3MulVecfl(imat, vec);
- ob->loc[0]+= vec[0];
- ob->loc[1]+= vec[1];
- ob->loc[2]+= vec[2];
- }
- else {
- ob->loc[0]+= vec[0];
- ob->loc[1]+= vec[1];
- ob->loc[2]+= vec[2];
- }
-#ifdef WITH_VERSE
- if(ob->vnode) b_verse_send_transformation(ob);
-#endif
-
- /* auto-keyframing */
- autokeyframe_ob_cb_func(ob, TFM_TRANSLATION);
- }
- }
-
- base= base->next;
- }
- DAG_scene_flush_update(G.scene, screen_view3d_layers());
- allqueue(REDRAWVIEW3D, 0);
-}
-
-void snap_sel_to_curs()
-{
- extern float originmat[3][3]; /* object.c */
- TransVert *tv;
- Base *base;
- Object *ob;
- float *curs, imat[3][3], bmat[3][3], vec[3];
- int a;
-
- curs= give_cursor();
-
- if(G.obedit) {
- tottrans= 0;
-
- if ELEM6(G.obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE, OB_MBALL)
- make_trans_verts(bmat[0], bmat[1], 0);
- if(tottrans==0) return;
-
- Mat3CpyMat4(bmat, G.obedit->obmat);
- Mat3Inv(imat, bmat);
-
- tv= transvmain;
- for(a=0; a<tottrans; a++, tv++) {
- vec[0]= curs[0]-G.obedit->obmat[3][0];
- vec[1]= curs[1]-G.obedit->obmat[3][1];
- vec[2]= curs[2]-G.obedit->obmat[3][2];
-
- Mat3MulVecfl(imat, vec);
- VECCOPY(tv->loc, vec);
- }
-
- special_transvert_update();
-
- MEM_freeN(transvmain);
- transvmain= 0;
-
- allqueue(REDRAWVIEW3D, 0);
- return;
- }
-
- base= (G.scene->base.first);
- while(base) {
- if( ( ((base)->flag & SELECT) && ((base)->lay & G.vd->lay) && ((base)->object->id.lib==0))) {
- ob= base->object;
- if(ob->flag & OB_POSEMODE) {
- bPoseChannel *pchan;
- bArmature *arm= ob->data;
- float cursp[3];
-
- Mat4Invert(ob->imat, ob->obmat);
- VECCOPY(cursp, curs);
- Mat4MulVecfl(ob->imat, cursp);
-
- for (pchan = ob->pose->chanbase.first; pchan; pchan=pchan->next) {
- if(pchan->bone->flag & BONE_SELECTED) {
- if(pchan->bone->layer & arm->layer) {
- if((pchan->bone->flag & BONE_CONNECTED)==0) {
- float curspn[3];
-
- /* get location of cursor in bone-space */
- armature_loc_pose_to_bone(pchan, cursp, curspn);
-
- /* calculate new position */
- VECCOPY(pchan->loc, curspn);
- }
- /* if the bone has a parent and is connected to the parent,
- * don't do anything - will break chain unless we do auto-ik.
- */
- }
- }
- }
- ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK);
-
- /* auto-keyframing */
- autokeyframe_pose_cb_func(ob, TFM_TRANSLATION, 0);
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- }
- else {
- ob->recalc |= OB_RECALC_OB;
-
- vec[0]= -ob->obmat[3][0] + curs[0];
- vec[1]= -ob->obmat[3][1] + curs[1];
- vec[2]= -ob->obmat[3][2] + curs[2];
-
- if(ob->parent) {
- where_is_object(ob);
-
- Mat3Inv(imat, originmat);
- Mat3MulVecfl(imat, vec);
- ob->loc[0]+= vec[0];
- ob->loc[1]+= vec[1];
- ob->loc[2]+= vec[2];
- }
- else {
- ob->loc[0]+= vec[0];
- ob->loc[1]+= vec[1];
- ob->loc[2]+= vec[2];
- }
-#ifdef WITH_VERSE
- if(ob->vnode) b_verse_send_transformation(ob);
-#endif
-
- /* auto-keyframing */
- autokeyframe_ob_cb_func(ob, TFM_TRANSLATION);
- }
- }
-
- base= base->next;
- }
- DAG_scene_flush_update(G.scene, screen_view3d_layers());
- allqueue(REDRAWVIEW3D, 0);
-}
-
-void snap_curs_to_grid()
-{
- float gridf, *curs;
-
- gridf= G.vd->gridview;
- curs= give_cursor();
-
- curs[0]= G.vd->gridview*floor(.5+curs[0]/gridf);
- curs[1]= G.vd->gridview*floor(.5+curs[1]/gridf);
- curs[2]= G.vd->gridview*floor(.5+curs[2]/gridf);
-
- allqueue(REDRAWVIEW3D, 0);
-}
-
-void snap_curs_to_sel()
-{
- TransVert *tv;
- Base *base;
- float *curs, bmat[3][3], vec[3], min[3], max[3], centroid[3];
- int count, a;
-
- curs= give_cursor();
-
- count= 0;
- INIT_MINMAX(min, max);
- centroid[0]= centroid[1]= centroid[2]= 0.0;
-
- if(G.obedit) {
- tottrans=0;
-
- if ELEM6(G.obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE, OB_MBALL)
- make_trans_verts(bmat[0], bmat[1], 2);
- if(tottrans==0) return;
-
- Mat3CpyMat4(bmat, G.obedit->obmat);
-
- tv= transvmain;
- for(a=0; a<tottrans; a++, tv++) {
- VECCOPY(vec, tv->loc);
- Mat3MulVecfl(bmat, vec);
- VecAddf(vec, vec, G.obedit->obmat[3]);
- VecAddf(centroid, centroid, vec);
- DO_MINMAX(vec, min, max);
- }
-
- if(G.vd->around==V3D_CENTROID) {
- VecMulf(centroid, 1.0/(float)tottrans);
- VECCOPY(curs, centroid);
- }
- else {
- curs[0]= (min[0]+max[0])/2;
- curs[1]= (min[1]+max[1])/2;
- curs[2]= (min[2]+max[2])/2;
- }
- MEM_freeN(transvmain);
- transvmain= 0;
- }
- else {
- Object *ob= OBACT;
-
- if(ob && (ob->flag & OB_POSEMODE)) {
- bArmature *arm= ob->data;
- bPoseChannel *pchan;
- for (pchan = ob->pose->chanbase.first; pchan; pchan=pchan->next) {
- if(arm->layer & pchan->bone->layer) {
- if(pchan->bone->flag & BONE_SELECTED) {
- VECCOPY(vec, pchan->pose_head);
- Mat4MulVecfl(ob->obmat, vec);
- VecAddf(centroid, centroid, vec);
- DO_MINMAX(vec, min, max);
- count++;
- }
- }
- }
- }
- else {
- for(base= G.scene->base.first; base; base= base->next) {
- if(((base)->flag & SELECT) && ((base)->lay & G.vd->lay) ) {
- VECCOPY(vec, base->object->obmat[3]);
- VecAddf(centroid, centroid, vec);
- DO_MINMAX(vec, min, max);
- count++;
- }
- }
- }
- if(count) {
- if(G.vd->around==V3D_CENTROID) {
- VecMulf(centroid, 1.0/(float)count);
- VECCOPY(curs, centroid);
- }
- else {
- curs[0]= (min[0]+max[0])/2;
- curs[1]= (min[1]+max[1])/2;
- curs[2]= (min[2]+max[2])/2;
- }
- }
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-void snap_curs_to_firstsel()
-{
- TransVert *tv;
- Base *base;
- float *curs, bmat[3][3], vec[3], min[3], max[3], centroid[3];
- int count;
-
- curs= give_cursor();
-
- count= 0;
- INIT_MINMAX(min, max);
- centroid[0]= centroid[1]= centroid[2]= 0.0;
-
- if(G.obedit) {
- tottrans=0;
-
- if ELEM6(G.obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE, OB_MBALL)
- make_trans_verts(bmat[0], bmat[1], 0);
- if(tottrans==0) return;
-
- Mat3CpyMat4(bmat, G.obedit->obmat);
-
- tv= transvmain;
- VECCOPY(vec, tv->loc);
- /*Mat3MulVecfl(bmat, vec);
- VecAddf(vec, vec, G.obedit->obmat[3]);
- VecAddf(centroid, centroid, vec);
- DO_MINMAX(vec, min, max);*/
-
- if(G.vd->around==V3D_CENTROID) {
- VecMulf(vec, 1.0/(float)tottrans);
- VECCOPY(curs, vec);
- }
- else {
- curs[0]= vec[0];
- curs[1]= vec[1];
- curs[2]= vec[2];
- }
- MEM_freeN(transvmain);
- transvmain= 0;
- }
- else {
- base= (G.scene->base.first);
- while(base) {
- if(((base)->flag & SELECT) && ((base)->lay & G.vd->lay) ) {
- VECCOPY(vec, base->object->obmat[3]);
- VecAddf(centroid, centroid, vec);
- DO_MINMAX(vec, min, max);
- count++;
- }
- base= base->next;
- }
- if(count) {
- if(G.vd->around==V3D_CENTROID) {
- VecMulf(centroid, 1.0/(float)count);
- VECCOPY(curs, centroid);
- }
- else {
- curs[0]= (min[0]+max[0])/2;
- curs[1]= (min[1]+max[1])/2;
- curs[2]= (min[2]+max[2])/2;
- }
- }
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-void snap_to_center()
-{
- extern float originmat[3][3];
- TransVert *tv;
- Base *base;
- Object *ob;
- float snaploc[3], imat[3][3], bmat[3][3], vec[3], min[3], max[3], centroid[3];
- int count, a;
-
- /*calculate the snaplocation (centerpoint) */
- count= 0;
- INIT_MINMAX(min, max);
- centroid[0]= centroid[1]= centroid[2]= 0.0f;
- snaploc[0]= snaploc[1]= snaploc[2]= 0.0f;
-
- if(G.obedit) {
- tottrans= 0;
-
- if ELEM6(G.obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE, OB_MBALL)
- make_trans_verts(bmat[0], bmat[1], 0);
- if(tottrans==0) return;
-
- Mat3CpyMat4(bmat, G.obedit->obmat);
- Mat3Inv(imat, bmat);
-
- tv= transvmain;
- for(a=0; a<tottrans; a++, tv++) {
- VECCOPY(vec, tv->loc);
- Mat3MulVecfl(bmat, vec);
- VecAddf(vec, vec, G.obedit->obmat[3]);
- VecAddf(centroid, centroid, vec);
- DO_MINMAX(vec, min, max);
- }
-
- if(G.vd->around==V3D_CENTROID) {
- VecMulf(centroid, 1.0/(float)tottrans);
- VECCOPY(snaploc, centroid);
- }
- else {
- snaploc[0]= (min[0]+max[0])/2;
- snaploc[1]= (min[1]+max[1])/2;
- snaploc[2]= (min[2]+max[2])/2;
- }
-
- MEM_freeN(transvmain);
- transvmain= 0;
- }
- else {
- base= (G.scene->base.first);
- while(base) {
- if(((base)->flag & SELECT) && ((base)->lay & G.vd->lay) ) {
- ob= base->object;
- if(ob->flag & OB_POSEMODE) {
- bPoseChannel *pchan;
- bArmature *arm= ob->data;
-
- for (pchan = ob->pose->chanbase.first; pchan; pchan=pchan->next) {
- if(pchan->bone->flag & BONE_SELECTED) {
- if(pchan->bone->layer & arm->layer) {
- VECCOPY(vec, pchan->pose_mat[3]);
- VecAddf(centroid, centroid, vec);
- DO_MINMAX(vec, min, max);
- count++;
- }
- }
- }
- }
- else {
- /* not armature bones (i.e. objects) */
- VECCOPY(vec, base->object->obmat[3]);
- VecAddf(centroid, centroid, vec);
- DO_MINMAX(vec, min, max);
- count++;
- }
- }
- base= base->next;
- }
- if(count) {
- if(G.vd->around==V3D_CENTROID) {
- VecMulf(centroid, 1.0/(float)count);
- VECCOPY(snaploc, centroid);
- }
- else {
- snaploc[0]= (min[0]+max[0])/2;
- snaploc[1]= (min[1]+max[1])/2;
- snaploc[2]= (min[2]+max[2])/2;
- }
- }
- }
-
- /* Snap the selection to the snaplocation (duh!) */
- if(G.obedit) {
- tottrans= 0;
-
- if ELEM6(G.obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE, OB_MBALL)
- make_trans_verts(bmat[0], bmat[1], 0);
- if(tottrans==0) return;
-
- Mat3CpyMat4(bmat, G.obedit->obmat);
- Mat3Inv(imat, bmat);
-
- tv= transvmain;
- for(a=0; a<tottrans; a++, tv++) {
- vec[0]= snaploc[0]-G.obedit->obmat[3][0];
- vec[1]= snaploc[1]-G.obedit->obmat[3][1];
- vec[2]= snaploc[2]-G.obedit->obmat[3][2];
-
- Mat3MulVecfl(imat, vec);
- VECCOPY(tv->loc, vec);
- }
-
- special_transvert_update();
-
- MEM_freeN(transvmain);
- transvmain= 0;
-
- allqueue(REDRAWVIEW3D, 0);
- return;
- }
-
- base= (G.scene->base.first);
- while(base) {
- if( ( ((base)->flag & SELECT) && ((base)->lay & G.vd->lay) && ((base)->object->id.lib==0))) {
- ob= base->object;
- if(ob->flag & OB_POSEMODE) {
- bPoseChannel *pchan;
- bArmature *arm= ob->data;
-
- for (pchan = ob->pose->chanbase.first; pchan; pchan=pchan->next) {
- if(pchan->bone->flag & BONE_SELECTED) {
- if(pchan->bone->layer & arm->layer) {
- if((pchan->bone->flag & BONE_CONNECTED)==0) {
- /* get location of cursor in bone-space */
- armature_loc_pose_to_bone(pchan, snaploc, vec);
-
- /* calculate new position */
- VECCOPY(pchan->loc, vec);
- }
- /* if the bone has a parent and is connected to the parent,
- * don't do anything - will break chain unless we do auto-ik.
- */
- }
- }
- }
-
- /* auto-keyframing */
- ob->pose->flag |= POSE_DO_UNLOCK;
- autokeyframe_pose_cb_func(ob, TFM_TRANSLATION, 0);
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- }
- else {
- ob->recalc |= OB_RECALC_OB;
-
- vec[0]= -ob->obmat[3][0] + snaploc[0];
- vec[1]= -ob->obmat[3][1] + snaploc[1];
- vec[2]= -ob->obmat[3][2] + snaploc[2];
-
- if(ob->parent) {
- where_is_object(ob);
-
- Mat3Inv(imat, originmat);
- Mat3MulVecfl(imat, vec);
- ob->loc[0]+= vec[0];
- ob->loc[1]+= vec[1];
- ob->loc[2]+= vec[2];
- }
- else {
- ob->loc[0]+= vec[0];
- ob->loc[1]+= vec[1];
- ob->loc[2]+= vec[2];
- }
-#ifdef WITH_VERSE
- if(ob->vnode) b_verse_send_transformation(ob);
-#endif
-
- /* auto-keyframing */
- autokeyframe_ob_cb_func(ob, TFM_TRANSLATION);
- }
- }
-
- base= base->next;
- }
- DAG_scene_flush_update(G.scene, screen_view3d_layers());
- allqueue(REDRAWVIEW3D, 0);
-}
-
-
-void snapmenu()
-{
- short event;
-
- event = pupmenu("Snap %t|Selection -> Grid%x1|Selection -> Cursor%x2|Cursor-> Grid%x3|Cursor-> Selection%x4|Selection-> Center%x5");
-
- switch (event) {
- case 1: /*Selection to grid*/
- snap_sel_to_grid();
- BIF_undo_push("Snap selection to grid");
- break;
- case 2: /*Selection to cursor*/
- snap_sel_to_curs();
- BIF_undo_push("Snap selection to cursor");
- break;
- case 3: /*Cursor to grid*/
- snap_curs_to_grid();
- break;
- case 4: /*Cursor to selection*/
- snap_curs_to_sel();
- break;
- case 5: /*Selection to center of selection*/
- snap_to_center();
- BIF_undo_push("Snap selection to center");
- break;
- }
-}
-
-
-#define MERGELIMIT 0.001
-void mergemenu(void)
-{
-
- short event;
- int remCount = 0;
-
- if(G.scene->selectmode & SCE_SELECT_VERTEX)
- if(G.editMesh->selected.first && G.editMesh->selected.last &&
- ((EditSelection*)G.editMesh->selected.first)->type == EDITVERT && ((EditSelection*)G.editMesh->selected.last)->type == EDITVERT)
- event = pupmenu("Merge %t|At First %x6|At Last%x1|At Center%x3|At Cursor%x4|Collapse%x2");
- else if (G.editMesh->selected.first && ((EditSelection*)G.editMesh->selected.first)->type == EDITVERT)
- event = pupmenu("Merge %t|At First %x6|At Center%x3|At Cursor%x4|Collapse%x2");
- else if (G.editMesh->selected.last && ((EditSelection*)G.editMesh->selected.last)->type == EDITVERT)
- event = pupmenu("Merge %t|At Last %x1|At Center%x3|At Cursor%x4|Collapse%x2");
- else event = pupmenu("Merge %t|At Center%x3|At Cursor%x4|Collapse%x2");
- else event = pupmenu("Merge %t|At Center%x3|At Cursor%x4|Collapse%x2");
- switch (event)
- {
- case -1:
- return;
- case 3:
- if(G.qual & LR_CTRLKEY) remCount = merge_target(0,1);
- else remCount = merge_target(0,0);
- BIF_undo_push("Merge at center");
- break;
- case 4:
- if(G.qual & LR_CTRLKEY) remCount = merge_target(1,1);
- else remCount = merge_target(1,0);
- BIF_undo_push("Merge at cursor");
- break;
- case 1:
- if(G.qual & LR_CTRLKEY) remCount = merge_firstlast(0,1);
- else remCount = merge_firstlast(0,0);
- BIF_undo_push("Merge at last selected");
- break;
- case 6:
- if(G.qual & LR_CTRLKEY) remCount = merge_firstlast(1,1);
- else remCount = merge_firstlast(1,0);
- BIF_undo_push("Merge at first selected");
- break;
- case 2:
- remCount = collapseEdges();
- BIF_undo_push("Collapse");
- break;
- }
- notice("Removed %d Vertices", remCount);
- allqueue(REDRAWVIEW3D, 0);
- countall();
-}
-#undef MERGELIMIT
-
-
-void delete_context_selected(void)
-{
- if(G.obedit) {
- if(G.obedit->type==OB_MESH) delete_mesh();
- else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) delNurb();
- else if(G.obedit->type==OB_MBALL) delete_mball();
- else if (G.obedit->type==OB_ARMATURE) delete_armature();
- }
- else if(G.f & G_PARTICLEEDIT){
- PE_delete_particle();
- }
- else delete_obj(0);
-}
-
-void duplicate_context_selected(void)
-{
- if(G.obedit) {
- if(G.obedit->type==OB_MESH) adduplicate_mesh();
- else if(G.obedit->type==OB_ARMATURE) adduplicate_armature();
- else if(G.obedit->type==OB_MBALL) adduplicate_mball();
- else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) adduplicate_nurb();
- }
- else if(G.f & G_PARTICLEEDIT);
- else
- adduplicate(0, U.dupflag);
-}
-
-void toggle_shading(void)
-{
- if(G.qual & LR_SHIFTKEY) {
- if(G.qual & LR_ALTKEY) {
- reshadeall_displist();
- G.vd->drawtype= OB_SHADED;
- }
- else {
- if(G.vd->drawtype== OB_SHADED) G.vd->drawtype= OB_WIRE;
- else G.vd->drawtype= OB_SHADED;
- }
- }
- else if(G.qual & LR_ALTKEY) {
- if(G.vd->drawtype== OB_TEXTURE) G.vd->drawtype= OB_SOLID;
- else G.vd->drawtype= OB_TEXTURE;
- }
- else {
- if(G.vd->drawtype==OB_SOLID || G.vd->drawtype==OB_SHADED) G.vd->drawtype= OB_WIRE;
- else G.vd->drawtype= OB_SOLID;
- }
-
- if(G.vd->drawtype != OB_WIRE && G.vd->depths) {
- G.vd->depths->damaged= 1;
- }
-}
-
-int minmax_verts(float *min, float *max)
-{
- TransVert *tv;
- float centroid[3], vec[3], bmat[3][3];
- int a;
-
- tottrans=0;
- if ELEM5(G.obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE)
- make_trans_verts(bmat[0], bmat[1], 0);
- if(tottrans==0) return 0;
-
- Mat3CpyMat4(bmat, G.obedit->obmat);
-
- tv= transvmain;
- for(a=0; a<tottrans; a++, tv++) {
- VECCOPY(vec, tv->loc);
- Mat3MulVecfl(bmat, vec);
- VecAddf(vec, vec, G.obedit->obmat[3]);
- VecAddf(centroid, centroid, vec);
- DO_MINMAX(vec, min, max);
- }
-
- MEM_freeN(transvmain);
- transvmain= 0;
- return 1;
-}
-
diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c
deleted file mode 100644
index cb032ddfb61..00000000000
--- a/source/blender/src/editaction.c
+++ /dev/null
@@ -1,3097 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): 2007, Joshua Leung (major rewrite of Action Editor)
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <string.h>
-#include <math.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "PIL_time.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "DNA_action_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_ipo_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_key_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_nla_types.h"
-#include "DNA_lattice_types.h"
-
-#include "BKE_action.h"
-#include "BKE_armature.h"
-#include "BKE_constraint.h"
-#include "BKE_curve.h"
-#include "BKE_depsgraph.h"
-#include "BKE_global.h"
-#include "BKE_ipo.h"
-#include "BKE_key.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
-#include "BKE_utildefines.h"
-#include "BKE_object.h" /* for where_is_object in obanim -> action baking */
-
-#include "BIF_butspace.h"
-#include "BIF_editaction.h"
-#include "BIF_editarmature.h"
-#include "BIF_editnla.h"
-#include "BIF_editview.h"
-#include "BIF_gl.h"
-#include "BIF_interface.h"
-#include "BIF_mywindow.h"
-#include "BIF_poseobject.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-#include "BIF_transform.h"
-
-#include "BSE_edit.h"
-#include "BSE_drawipo.h"
-#include "BSE_headerbuttons.h"
-#include "BSE_editaction_types.h"
-#include "BSE_editipo.h"
-#include "BSE_time.h"
-#include "BSE_trans_types.h"
-
-#include "BDR_drawaction.h"
-#include "BDR_editobject.h"
-
-#include "mydevice.h"
-#include "blendef.h"
-#include "nla.h"
-
-/* **************************************************** */
-/* ACTION API */
-
-/* this function adds a new Action block */
-bAction *add_empty_action (char *name)
-{
- bAction *act;
-
- act= alloc_libblock(&G.main->action, ID_AC, name);
- act->id.flag |= LIB_FAKEUSER;
- act->id.us++;
-
- return act;
-}
-
-/* generic get current action call, for action window context */
-bAction *ob_get_action (Object *ob)
-{
- bActionStrip *strip;
-
- if(ob->action)
- return ob->action;
-
- for (strip=ob->nlastrips.first; strip; strip=strip->next) {
- if (strip->flag & ACTSTRIP_SELECT)
- return strip->act;
- }
- return NULL;
-}
-
-/* used by ipo, outliner, buttons to find the active channel */
-bActionChannel *get_hilighted_action_channel (bAction *action)
-{
- bActionChannel *achan;
-
- if (!action)
- return NULL;
-
- for (achan= action->chanbase.first; achan; achan= achan->next) {
- if (VISIBLE_ACHAN(achan)) {
- if (SEL_ACHAN(achan) && (achan->flag & ACHAN_HILIGHTED))
- return achan;
- }
- }
-
- return NULL;
-}
-
-/* ----------------------------------------- */
-
-void remake_action_ipos (bAction *act)
-{
- bActionChannel *achan;
- bConstraintChannel *conchan;
- IpoCurve *icu;
-
- for (achan= act->chanbase.first; achan; achan= achan->next) {
- if (achan->ipo) {
- for (icu = achan->ipo->curve.first; icu; icu=icu->next) {
- sort_time_ipocurve(icu);
- testhandles_ipocurve(icu);
- }
- }
- for (conchan=achan->constraintChannels.first; conchan; conchan=conchan->next){
- if (conchan->ipo) {
- for (icu = conchan->ipo->curve.first; icu; icu=icu->next){
- sort_time_ipocurve(icu);
- testhandles_ipocurve(icu);
- }
- }
- }
- }
-
- synchronize_action_strips();
-}
-
-/* **************************************************** */
-/* FILTER->EDIT STRUCTURES */
-/*
- * This method involves generating a list of edit structures which enable
- * tools to naively perform the actions they require without all the boiler-plate
- * associated with loops within loops and checking for cases to ignore.
- */
-
-/* this function allocates memory for a new bActListElem struct for the
- * provided action channel-data.
- */
-bActListElem *make_new_actlistelem (void *data, short datatype, void *owner, short ownertype)
-{
- bActListElem *ale= NULL;
-
- /* only allocate memory if there is data to convert */
- if (data) {
- /* allocate and set generic data */
- ale= MEM_callocN(sizeof(bActListElem), "bActListElem");
-
- ale->data= data;
- ale->type= datatype;
- ale->owner= owner;
- ale->ownertype= ownertype;
-
- /* do specifics */
- switch (datatype) {
- case ACTTYPE_ACHAN:
- {
- bActionChannel *achan= (bActionChannel *)data;
-
- ale->flag= achan->flag;
-
- if (achan->ipo) {
- ale->key_data= achan->ipo;
- ale->datatype= ALE_IPO;
- }
- else {
- ale->key_data= NULL;
- ale->datatype= ALE_NONE;
- }
- }
- break;
- case ACTTYPE_CONCHAN:
- {
- bConstraintChannel *conchan= (bConstraintChannel *)data;
-
- ale->flag= conchan->flag;
-
- if (conchan->ipo && conchan->ipo->curve.first) {
- /* we assume that constraint ipo blocks only have 1 curve:
- * INFLUENCE, so we pretend that a constraint channel is
- * really just a Ipo-Curve channel instead.
- */
- ale->key_data= conchan->ipo->curve.first;
- ale->datatype= ALE_ICU;
- }
- else {
- ale->key_data= NULL;
- ale->datatype= ALE_NONE;
- }
- }
- break;
- case ACTTYPE_ICU:
- {
- IpoCurve *icu= (IpoCurve *)data;
-
- ale->flag= icu->flag;
- ale->key_data= icu;
- ale->datatype= ALE_ICU;
- }
- break;
-
- case ACTTYPE_FILLIPO:
- case ACTTYPE_FILLCON:
- {
- bActionChannel *achan= (bActionChannel *)data;
-
- if (datatype == ACTTYPE_FILLIPO)
- ale->flag= FILTER_IPO_ACHAN(achan);
- else
- ale->flag= FILTER_CON_ACHAN(achan);
-
- ale->key_data= NULL;
- ale->datatype= ALE_NONE;
- }
- break;
- case ACTTYPE_IPO:
- {
- ale->flag= 0;
- ale->key_data= data;
- ale->datatype= ALE_IPO;
- }
- break;
- }
- }
-
- /* return created datatype */
- return ale;
-}
-
-/* ----------------------------------------- */
-
-static void actdata_filter_action (ListBase *act_data, bAction *act, int filter_mode)
-{
- bActListElem *ale;
- bActionChannel *achan;
- bConstraintChannel *conchan;
- IpoCurve *icu;
-
- /* loop over action channels, performing the necessary checks */
- for (achan= act->chanbase.first; achan; achan= achan->next) {
- /* only work with this channel and its subchannels if it is visible */
- if (!(filter_mode & ACTFILTER_VISIBLE) || VISIBLE_ACHAN(achan)) {
- /* only work with this channel and its subchannels if it is editable */
- if (!(filter_mode & ACTFILTER_FOREDIT) || EDITABLE_ACHAN(achan)) {
- /* check if this achan should only be included if it is selected */
- if (!(filter_mode & ACTFILTER_SEL) || SEL_ACHAN(achan)) {
- /* are we only interested in the ipo-curves? */
- if ((filter_mode & ACTFILTER_ONLYICU)==0) {
- ale= make_new_actlistelem(achan, ACTTYPE_ACHAN, achan, ACTTYPE_ACHAN);
- if (ale) BLI_addtail(act_data, ale);
- }
- }
- else {
- /* only consider selected channels - achan not selected */
- continue;
- }
-
- /* check if expanded - if not, continue on to next action channel */
- if (EXPANDED_ACHAN(achan) == 0 && (filter_mode & ACTFILTER_ONLYICU)==0)
- continue;
-
- /* ipo channels */
- if (achan->ipo) {
- /* include ipo-expand widget? */
- if ((filter_mode & ACTFILTER_CHANNELS) && (filter_mode & ACTFILTER_ONLYICU)==0) {
- ale= make_new_actlistelem(achan, ACTTYPE_FILLIPO, achan, ACTTYPE_ACHAN);
- if (ale) BLI_addtail(act_data, ale);
- }
-
- /* add ipo-curve channels? */
- if (FILTER_IPO_ACHAN(achan) || (filter_mode & ACTFILTER_ONLYICU)) {
- /* loop through ipo-curve channels, adding them */
- for (icu= achan->ipo->curve.first; icu; icu=icu->next) {
- ale= make_new_actlistelem(icu, ACTTYPE_ICU, achan, ACTTYPE_ACHAN);
- if (ale) BLI_addtail(act_data, ale);
- }
- }
- }
-
- /* constraint channels */
- if (achan->constraintChannels.first) {
- /* include constraint-expand widget? */
- if ((filter_mode & ACTFILTER_CHANNELS) && (filter_mode & ACTFILTER_ONLYICU)==0) {
- ale= make_new_actlistelem(achan, ACTTYPE_FILLCON, achan, ACTTYPE_ACHAN);
- if (ale) BLI_addtail(act_data, ale);
- }
-
- /* add constaint channels? */
- if (FILTER_CON_ACHAN(achan)) {
- /* loop through constraint channels, checking and adding them */
- for (conchan=achan->constraintChannels.first; conchan; conchan=conchan->next) {
- /* only work with this channel and its subchannels if it is editable */
- if (!(filter_mode & ACTFILTER_FOREDIT) || EDITABLE_CONCHAN(conchan)) {
- /* check if this conchan should only be included if it is selected */
- if (!(filter_mode & ACTFILTER_SEL) || SEL_CONCHAN(conchan)) {
- if ((filter_mode & ACTFILTER_ONLYICU)==0) {
- ale= make_new_actlistelem(conchan, ACTTYPE_CONCHAN, achan, ACTTYPE_ACHAN);
- if (ale) BLI_addtail(act_data, ale);
- }
- }
- }
- }
- }
- }
- }
- }
- }
-}
-
-static void actdata_filter_shapekey (ListBase *act_data, Key *key, int filter_mode)
-{
- bActListElem *ale;
- KeyBlock *kb;
- IpoCurve *icu;
- int i;
-
- /* are we filtering for display or editing */
- if (filter_mode & ACTFILTER_FORDRAWING) {
- /* for display - loop over shapekeys, adding ipo-curve references where needed */
- kb= key->block.first;
-
- /* loop through possible shapekeys, manually creating entries */
- for (i= 1; i < key->totkey; i++) {
- ale= MEM_callocN(sizeof(bActListElem), "bActListElem");
- kb = kb->next;
-
- ale->data= kb;
- ale->type= ACTTYPE_SHAPEKEY; /* 'abused' usage of this type */
- ale->owner= key;
- ale->ownertype= ACTTYPE_SHAPEKEY;
- ale->datatype= ALE_NONE;
- ale->index = i;
-
- if (key->ipo) {
- for (icu= key->ipo->curve.first; icu; icu=icu->next) {
- if (icu->adrcode == i) {
- ale->key_data= icu;
- ale->datatype= ALE_ICU;
- break;
- }
- }
- }
-
- BLI_addtail(act_data, ale);
- }
- }
- else {
- /* loop over ipo curves if present - for editing */
- if (key->ipo) {
- if (filter_mode & ACTFILTER_IPOKEYS) {
- ale= make_new_actlistelem(key->ipo, ACTTYPE_IPO, key, ACTTYPE_SHAPEKEY);
- if (ale) BLI_addtail(act_data, ale);
- }
- else {
- for (icu= key->ipo->curve.first; icu; icu=icu->next) {
- ale= make_new_actlistelem(icu, ACTTYPE_ICU, key, ACTTYPE_SHAPEKEY);
- if (ale) BLI_addtail(act_data, ale);
- }
- }
- }
- }
-}
-
-/* This function filters the active data source to leave only the desired
- * data types. 'Public' api call.
- * *act_data: is a pointer to a ListBase, to which the filtered action data
- * will be placed for use.
- * filter_mode: how should the data be filtered - bitmapping accessed flags
- */
-void actdata_filter (ListBase *act_data, int filter_mode, void *data, short datatype)
-{
- /* only filter data if there's somewhere to put it */
- if (data && act_data) {
- bActListElem *ale, *next;
-
- /* firstly filter the data */
- switch (datatype) {
- case ACTCONT_ACTION:
- actdata_filter_action(act_data, data, filter_mode);
- break;
- case ACTCONT_SHAPEKEY:
- actdata_filter_shapekey(act_data, data, filter_mode);
- break;
- }
-
- /* remove any weedy entries */
- for (ale= act_data->first; ale; ale= next) {
- next= ale->next;
-
- if (ale->type == ACTTYPE_NONE)
- BLI_freelinkN(act_data, ale);
-
- if (filter_mode & ACTFILTER_IPOKEYS) {
- if (ale->datatype != ALE_IPO)
- BLI_freelinkN(act_data, ale);
- else if (ale->key_data == NULL)
- BLI_freelinkN(act_data, ale);
- }
- }
- }
-}
-
-/* **************************************************** */
-/* GENERAL ACTION TOOLS */
-
-
-/* gets the key data from the currently selected
- * mesh/lattice. If a mesh is not selected, or does not have
- * key data, then we return NULL (currently only
- * returns key data for RVK type meshes). If there
- * is an action that is pinned, return null
- */
-/* Note: there's a similar function in key.c (ob_get_key) */
-Key *get_action_mesh_key(void)
-{
- Object *ob;
- Key *key;
-
- ob = OBACT;
- if (ob == NULL)
- return NULL;
-
- if (G.saction->pin) return NULL;
-
- if (ob->type==OB_MESH)
- key = ((Mesh *)ob->data)->key;
- else if (ob->type==OB_LATTICE)
- key = ((Lattice *)ob->data)->key;
- else
- return NULL;
-
- if (key) {
- if (key->type == KEY_RELATIVE)
- return key;
- }
-
- return NULL;
-}
-
-/* TODO: kill this! */
-int get_nearest_key_num (Key *key, short *mval, float *x)
-{
- /* returns the key num that cooresponds to the
- * y value of the mouse click. Does not check
- * if this is a valid keynum. Also gives the Ipo
- * x coordinate.
- */
- int num;
- float y;
-
- areamouseco_to_ipoco(G.v2d, mval, x, &y);
- num = (int) ((CHANNELHEIGHT/2 - y) / (CHANNELHEIGHT+CHANNELSKIP));
-
- return (num + 1);
-}
-
-/* this function is used to get a pointer to an action or shapekey
- * datablock, thus simplying that process.
- */
-/* this function is intended for use */
-void *get_nearest_act_channel (short mval[], short *ret_type)
-{
- ListBase act_data = {NULL, NULL};
- bActListElem *ale;
- void *data;
- short datatype;
- int filter;
-
- int clickmin, clickmax;
- float x,y;
-
- /* determine what type of data we are operating on */
- data = get_action_context(&datatype);
- if (data == NULL) {
- *ret_type= ACTTYPE_NONE;
- return NULL;
- }
-
- areamouseco_to_ipoco(G.v2d, mval, &x, &y);
- clickmin = (int) (((CHANNELHEIGHT/2) - y) / (CHANNELHEIGHT+CHANNELSKIP));
- clickmax = clickmin;
-
- if (clickmax < 0) {
- *ret_type= ACTTYPE_NONE;
- return NULL;
- }
-
- /* filter data */
- filter= (ACTFILTER_FORDRAWING | ACTFILTER_VISIBLE | ACTFILTER_CHANNELS);
- actdata_filter(&act_data, filter, data, datatype);
-
- for (ale= act_data.first; ale; ale= ale->next) {
- if (clickmax < 0)
- break;
- if (clickmin <= 0) {
- /* found match */
- *ret_type= ale->type;
- data= ale->data;
-
- BLI_freelistN(&act_data);
-
- return data;
- }
- --clickmin;
- --clickmax;
- }
-
- /* cleanup */
- BLI_freelistN(&act_data);
-
- *ret_type= ACTTYPE_NONE;
- return NULL;
-}
-
-/* used only by mouse_action. It is used to find the location of the nearest
- * keyframe to where the mouse clicked,
- */
-static void *get_nearest_action_key (float *selx, short *sel, short *ret_type, bActionChannel **par)
-{
- ListBase act_data = {NULL, NULL};
- ListBase act_keys = {NULL, NULL};
- bActListElem *ale;
- ActKeyColumn *ak;
- void *data;
- short datatype;
- int filter;
-
- rctf rectf;
- float xmin, xmax, x, y;
- int clickmin, clickmax;
- short mval[2];
- short found = 0;
-
- getmouseco_areawin (mval);
-
- /* action-channel */
- *par= NULL;
-
- /* determine what type of data we are operating on */
- data = get_action_context(&datatype);
- if (data == NULL) {
- *ret_type= ACTTYPE_NONE;
- return NULL;
- }
-
- areamouseco_to_ipoco(G.v2d, mval, &x, &y);
- clickmin = (int) (((CHANNELHEIGHT/2) - y) / (CHANNELHEIGHT+CHANNELSKIP));
- clickmax = clickmin;
-
- mval[0]-=7;
- areamouseco_to_ipoco(G.v2d, mval, &rectf.xmin, &rectf.ymin);
- mval[0]+=14;
- areamouseco_to_ipoco(G.v2d, mval, &rectf.xmax, &rectf.ymax);
-
- /* if action is mapped in NLA, it returns a correction */
- if (NLA_ACTION_SCALED && datatype==ACTCONT_ACTION) {
- xmin= get_action_frame(OBACT, rectf.xmin);
- xmax= get_action_frame(OBACT, rectf.xmax);
- }
- else {
- xmin= rectf.xmin;
- xmax= rectf.xmax;
- }
-
- if (clickmax < 0) {
- *ret_type= ACTTYPE_NONE;
- return NULL;
- }
-
- /* filter data */
- filter= (ACTFILTER_FORDRAWING | ACTFILTER_VISIBLE | ACTFILTER_CHANNELS);
- actdata_filter(&act_data, filter, data, datatype);
-
- for (ale= act_data.first; ale; ale= ale->next) {
- if (clickmax < 0)
- break;
- if (clickmin <= 0) {
- /* found match */
-
- /* make list of keyframes */
- if (ale->key_data) {
- switch (ale->datatype) {
- case ALE_IPO:
- {
- Ipo *ipo= (Ipo *)ale->key_data;
- ipo_to_keylist(ipo, &act_keys, NULL);
- }
- break;
- case ALE_ICU:
- {
- IpoCurve *icu= (IpoCurve *)ale->key_data;
- icu_to_keylist(icu, &act_keys, NULL);
- }
- break;
- }
- }
-
- /* loop through keyframes, finding one that was clicked on */
- for (ak= act_keys.first; ak; ak= ak->next) {
- if (IN_RANGE(ak->cfra, xmin, xmax)) {
- *selx= ak->cfra;
- found= 1;
- break;
- }
- }
- /* no matching keyframe found - set to mean frame value so it doesn't actually select anything */
- if (found == 0)
- *selx= ((xmax+xmin) / 2);
-
- /* figure out what to return */
- if (datatype == ACTCONT_ACTION) {
- *par= ale->owner; /* assume that this is an action channel */
- *ret_type= ale->type;
- data = ale->data;
- }
- else if (datatype == ACTCONT_SHAPEKEY) {
- data = ale->key_data;
- *ret_type= ACTTYPE_ICU;
- }
-
- /* cleanup tempolary lists */
- BLI_freelistN(&act_keys);
- act_keys.first = act_keys.last = NULL;
-
- BLI_freelistN(&act_data);
-
- return data;
- }
- --clickmin;
- --clickmax;
- }
-
- /* cleanup */
- BLI_freelistN(&act_data);
-
- *ret_type= ACTTYPE_NONE;
- return NULL;
-}
-
-void *get_action_context (short *datatype)
-{
- bAction *act;
- Key *key;
-
- /* get pointers to active action/shapekey blocks */
- act = (G.saction)? G.saction->action: NULL;
- key = get_action_mesh_key();
-
- if (act) {
- *datatype= ACTCONT_ACTION;
- return act;
- }
- else if (key) {
- *datatype= ACTCONT_SHAPEKEY;
- return key;
- }
- else {
- *datatype= ACTCONT_NONE;
- return NULL;
- }
-}
-
-/* **************************************************** */
-/* TRANSFORM TOOLS */
-
-/* main call to start transforming keyframes */
-void transform_action_keys (int mode, int dummy)
-{
- void *data;
- short datatype;
-
- /* determine what type of data we are operating on */
- data = get_action_context(&datatype);
- if (data == NULL) return;
-
- switch (mode) {
- case 'g':
- {
- initTransform(TFM_TIME_TRANSLATE, CTX_NONE);
- Transform();
- }
- break;
- case 's':
- {
- initTransform(TFM_TIME_SCALE, CTX_NONE);
- Transform();
- }
- break;
- case 't':
- {
- initTransform(TFM_TIME_SLIDE, CTX_NONE);
- Transform();
- }
- break;
- case 'e':
- {
- initTransform(TFM_TIME_EXTEND, CTX_NONE);
- Transform();
- }
- break;
- }
-}
-
-/* ----------------------------------------- */
-
-/* duplicate keyframes */
-void duplicate_action_keys (void)
-{
- ListBase act_data = {NULL, NULL};
- bActListElem *ale;
- void *data;
- short datatype;
- int filter;
-
- /* determine what type of data we are operating on */
- data = get_action_context(&datatype);
- if (data == NULL) return;
-
- /* filter data */
- filter= (ACTFILTER_VISIBLE | ACTFILTER_FOREDIT | ACTFILTER_IPOKEYS);
- actdata_filter(&act_data, filter, data, datatype);
-
- /* loop through filtered data and duplicate selected keys */
- for (ale= act_data.first; ale; ale= ale->next) {
- duplicate_ipo_keys((Ipo *)ale->key_data);
- }
-
- /* free filtered list */
- BLI_freelistN(&act_data);
-
- /* now, go into transform-grab mode, to move keys */
- transform_action_keys('g', 0);
-}
-
-/* this function is responsible for snapping the current frame to selected data */
-void snap_cfra_action()
-{
- ListBase act_data = {NULL, NULL};
- bActListElem *ale;
- int filter;
- void *data;
- short datatype;
-
- /* get data */
- data= get_action_context(&datatype);
- if (data == NULL) return;
-
- /* filter data */
- filter= (ACTFILTER_VISIBLE | ACTFILTER_IPOKEYS);
- actdata_filter(&act_data, filter, data, datatype);
-
- /* snap current frame to selected data */
- snap_cfra_ipo_keys(NULL, -1);
-
- for (ale= act_data.first; ale; ale= ale->next) {
- if (NLA_ACTION_SCALED && datatype==ACTCONT_ACTION) {
- actstrip_map_ipo_keys(OBACT, ale->key_data, 0, 1);
- snap_cfra_ipo_keys(ale->key_data, 0);
- actstrip_map_ipo_keys(OBACT, ale->key_data, 1, 1);
- }
- else
- snap_cfra_ipo_keys(ale->key_data, 0);
- }
- BLI_freelistN(&act_data);
-
- snap_cfra_ipo_keys(NULL, 1);
-
- BIF_undo_push("Snap Current Frame to Keys");
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWNLA, 0);
-}
-
-/* this function is responsible for snapping keyframes to frame-times */
-void snap_action_keys(short mode)
-{
- ListBase act_data = {NULL, NULL};
- bActListElem *ale;
- int filter;
- void *data;
- short datatype;
- char str[32];
-
- /* get data */
- data= get_action_context(&datatype);
- if (data == NULL) return;
-
- /* determine mode */
- switch (mode) {
- case 1:
- strcpy(str, "Snap Keys To Nearest Frame");
- break;
- case 2:
- if (G.saction->flag & SACTION_DRAWTIME)
- strcpy(str, "Snap Keys To Current Time");
- else
- strcpy(str, "Snap Keys To Current Frame");
- break;
- case 3:
- strcpy(str, "Snap Keys To Nearest Marker");
- break;
- case 4:
- strcpy(str, "Snap Keys To Nearest Second");
- break;
- default:
- return;
- }
-
- /* filter data */
- filter= (ACTFILTER_VISIBLE | ACTFILTER_FOREDIT | ACTFILTER_IPOKEYS);
- actdata_filter(&act_data, filter, data, datatype);
-
- /* snap to frame */
- for (ale= act_data.first; ale; ale= ale->next) {
- if (NLA_ACTION_SCALED && datatype==ACTCONT_ACTION) {
- actstrip_map_ipo_keys(OBACT, ale->key_data, 0, 1);
- snap_ipo_keys(ale->key_data, mode);
- actstrip_map_ipo_keys(OBACT, ale->key_data, 1, 1);
- }
- else
- snap_ipo_keys(ale->key_data, mode);
- }
- BLI_freelistN(&act_data);
-
- if (datatype == ACTCONT_ACTION)
- remake_action_ipos(data);
-
- BIF_undo_push(str);
- allspace(REMAKEIPO, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWNLA, 0);
-}
-
-/* this function is responsible for snapping keyframes to frame-times */
-void mirror_action_keys(short mode)
-{
- ListBase act_data = {NULL, NULL};
- bActListElem *ale;
- int filter;
- void *data;
- short datatype;
- char str[32];
-
- /* get data */
- data= get_action_context(&datatype);
- if (data == NULL) return;
-
- /* determine mode */
- switch (mode) {
- case 1:
- strcpy(str, "Mirror Keys Over Current Frame");
- break;
- case 2:
- strcpy(str, "Mirror Keys Over Y-Axis");
- break;
- case 3:
- strcpy(str, "Mirror Keys Over X-Axis");
- break;
- case 4:
- strcpy(str, "Mirror Keys Over Marker");
- break;
- default:
- return;
- }
-
- /* filter data */
- filter= (ACTFILTER_VISIBLE | ACTFILTER_FOREDIT | ACTFILTER_IPOKEYS);
- actdata_filter(&act_data, filter, data, datatype);
-
- /* mirror */
- for (ale= act_data.first; ale; ale= ale->next) {
- if (NLA_ACTION_SCALED && datatype==ACTCONT_ACTION) {
- actstrip_map_ipo_keys(OBACT, ale->key_data, 0, 1);
- mirror_ipo_keys(ale->key_data, mode);
- actstrip_map_ipo_keys(OBACT, ale->key_data, 1, 1);
- }
- else
- mirror_ipo_keys(ale->key_data, mode);
- }
- BLI_freelistN(&act_data);
-
- if (datatype == ACTCONT_ACTION)
- remake_action_ipos(data);
-
- BIF_undo_push(str);
- allspace(REMAKEIPO, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWNLA, 0);
-}
-
-/* **************************************************** */
-/* ADD/REMOVE KEYFRAMES */
-
-/* This function allows the user to insert keyframes on the current
- * frame from the Action Editor, using the current values of the channels
- * to be keyframed.
- */
-void insertkey_action(void)
-{
- void *data;
- short datatype;
-
- Object *ob= OBACT;
- short mode;
- float cfra;
-
- /* get data */
- data= get_action_context(&datatype);
- if (data == NULL) return;
- cfra = frame_to_float(CFRA);
-
- if (datatype == ACTCONT_ACTION) {
- ListBase act_data = {NULL, NULL};
- bActListElem *ale;
- int filter;
-
- /* ask user what to keyframe */
- mode = pupmenu("Insert Key%t|All Channels%x1|Only Selected Channels%x2");
- if (mode <= 0) return;
-
- /* filter data */
- filter= (ACTFILTER_VISIBLE | ACTFILTER_FOREDIT | ACTFILTER_ONLYICU );
- if (mode == 2) filter |= ACTFILTER_SEL;
-
- actdata_filter(&act_data, filter, data, datatype);
-
- /* loop through ipo curves retrieved */
- for (ale= act_data.first; ale; ale= ale->next) {
- /* verify that this is indeed an ipo curve */
- if (ale->key_data && ale->owner) {
- bActionChannel *achan= (bActionChannel *)ale->owner;
- IpoCurve *icu= (IpoCurve *)ale->key_data;
-
- if (ob)
- insertkey((ID *)ob, icu->blocktype, achan->name, NULL, icu->adrcode, 0);
- else
- insert_vert_icu(icu, cfra, icu->curval, 0);
- }
- }
-
- /* cleanup */
- BLI_freelistN(&act_data);
- }
- else if (datatype == ACTCONT_SHAPEKEY) {
- Key *key= (Key *)data;
- IpoCurve *icu;
-
- /* ask user if they want to insert a keyframe */
- mode = okee("Insert Keyframe?");
- if (mode <= 0) return;
-
- if (key->ipo) {
- for (icu= key->ipo->curve.first; icu; icu=icu->next) {
- insert_vert_icu(icu, cfra, icu->curval, 0);
- }
- }
- }
-
- BIF_undo_push("Insert Key");
- allspace(REMAKEIPO, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWNLA, 0);
-}
-
-/* delete selected keyframes */
-void delete_action_keys (void)
-{
- ListBase act_data = {NULL, NULL};
- bActListElem *ale;
- void *data;
- short datatype;
- int filter;
-
- /* determine what type of data we are operating on */
- data = get_action_context(&datatype);
- if (data == NULL) return;
-
- /* filter data */
- filter= (ACTFILTER_VISIBLE | ACTFILTER_FOREDIT | ACTFILTER_IPOKEYS);
- actdata_filter(&act_data, filter, data, datatype);
-
- /* loop through filtered data and delete selected keys */
- for (ale= act_data.first; ale; ale= ale->next) {
- delete_ipo_keys((Ipo *)ale->key_data);
- }
-
- /* free filtered list */
- BLI_freelistN(&act_data);
-
- if (datatype == ACTCONT_ACTION)
- remake_action_ipos(data);
-
- BIF_undo_push("Delete Action Keys");
- allspace(REMAKEIPO, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWNLA, 0);
-}
-
-/* delete selected keyframes */
-void delete_action_channels (void)
-{
- ListBase act_data = {NULL, NULL};
- bActListElem *ale, *next;
- bAction *act;
- void *data;
- short datatype;
- int filter;
-
- /* determine what type of data we are operating on */
- data = get_action_context(&datatype);
- if (data == NULL) return;
- if (datatype != ACTCONT_ACTION) return;
- act= (bAction *)data;
-
- /* filter data */
- filter= (ACTFILTER_VISIBLE | ACTFILTER_FOREDIT | ACTFILTER_CHANNELS | ACTFILTER_SEL);
- actdata_filter(&act_data, filter, data, datatype);
-
- /* remove irrelevant entries */
- for (ale= act_data.first; ale; ale= next) {
- next= ale->next;
-
- if (ale->type != ACTTYPE_ACHAN)
- BLI_freelinkN(&act_data, ale);
- }
-
- /* clean up action channels */
- for (ale= act_data.first; ale; ale= next) {
- bActionChannel *achan= (bActionChannel *)ale->data;
- bConstraintChannel *conchan, *cnext;
- next= ale->next;
-
- /* release reference to ipo users */
- if (achan->ipo)
- achan->ipo->id.us--;
-
- for (conchan= achan->constraintChannels.first; conchan; conchan=cnext) {
- cnext= conchan->next;
-
- if (conchan->ipo)
- conchan->ipo->id.us--;
- }
-
- /* free memory */
- BLI_freelistN(&achan->constraintChannels);
- BLI_freelinkN(&act->chanbase, achan);
- BLI_freelinkN(&act_data, ale);
- }
-
- remake_action_ipos(data);
-
- BIF_undo_push("Delete Action Channels");
- allspace(REMAKEIPO, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWNLA, 0);
-}
-
-/* 'Clean' IPO curves - remove any unnecessary keyframes */
-void clean_action (void)
-{
- ListBase act_data = {NULL, NULL};
- bActListElem *ale;
- int filter;
- void *data;
- short datatype, ok;
-
- /* don't proceed any further if nothing to work on or user refuses */
- data= get_action_context(&datatype);
- ok= fbutton(&G.scene->toolsettings->clean_thresh,
- 0.0000001f, 1.0, 0.001, 0.1,
- "Clean Threshold");
- if (!ok) return;
-
- /* filter data */
- filter= (ACTFILTER_VISIBLE | ACTFILTER_FOREDIT | ACTFILTER_SEL | ACTFILTER_ONLYICU);
- actdata_filter(&act_data, filter, data, datatype);
-
- /* loop through filtered data and clean curves */
- for (ale= act_data.first; ale; ale= ale->next) {
- clean_ipo_curve((IpoCurve *)ale->key_data);
- }
-
- /* admin and redraws */
- BLI_freelistN(&act_data);
-
- BIF_undo_push("Clean Action");
- allqueue(REMAKEIPO, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
-}
-
-/* **************************************************** */
-/* COPY/PASTE FOR ACTIONS */
-/* - The copy/paste buffer currently stores a set of Action Channels, with temporary
- * IPO-blocks, and also temporary IpoCurves which only contain the selected keyframes.
- * - Only pastes between compatable data is possible (i.e. same achan->name, ipo-curve type, etc.)
- */
-
-/* globals for copy/paste data (like for other copy/paste buffers) */
-ListBase actcopybuf = {NULL, NULL};
-
-/* This function frees any MEM_calloc'ed copy/paste buffer data */
-void free_actcopybuf ()
-{
- bActionChannel *achan, *anext;
- bConstraintChannel *conchan, *cnext;
-
- for (achan= actcopybuf.first; achan; achan= anext) {
- anext= achan->next;
-
- if (achan->ipo) {
- free_ipo(achan->ipo);
- MEM_freeN(achan->ipo);
- }
-
- for (conchan=achan->constraintChannels.first; conchan; conchan=cnext) {
- cnext= conchan->next;
-
- if (conchan->ipo) {
- free_ipo(conchan->ipo);
- MEM_freeN(conchan->ipo);
- }
-
- BLI_freelinkN(&achan->constraintChannels, conchan);
- }
-
- BLI_freelinkN(&actcopybuf, achan);
- }
-}
-
-/* This function adds data to the copy/paste buffer, freeing existing data first
- * Only the selected action channels gets their selected keyframes copied.
- */
-void copy_actdata ()
-{
- ListBase act_data = {NULL, NULL};
- bActListElem *ale;
- int filter;
- void *data;
- short datatype;
-
- /* clear buffer first */
- free_actcopybuf();
-
- /* get data */
- data= get_action_context(&datatype);
- if (data == NULL) return;
-
- /* filter data */
- filter= (ACTFILTER_VISIBLE | ACTFILTER_SEL | ACTFILTER_IPOKEYS);
- actdata_filter(&act_data, filter, data, datatype);
-
- /* assume that each of these is an ipo-block */
- for (ale= act_data.first; ale; ale= ale->next) {
- bActionChannel *achan;
- Ipo *ipo= ale->key_data;
- Ipo *ipn;
- IpoCurve *icu, *icn;
- BezTriple *bezt;
- int i;
-
- /* coerce an action-channel out of owner */
- if (ale->ownertype == ACTTYPE_ACHAN) {
- bActionChannel *achanO= ale->owner;
- achan= MEM_callocN(sizeof(bActionChannel), "ActCopyPasteAchan");
- strcpy(achan->name, achanO->name);
- }
- else if (ale->ownertype == ACTTYPE_SHAPEKEY) {
- achan= MEM_callocN(sizeof(bActionChannel), "ActCopyPasteAchan");
- strcpy(achan->name, "#ACP_ShapeKey");
- }
- else
- continue;
- BLI_addtail(&actcopybuf, achan);
-
- /* add constraint channel if needed, then add new ipo-block */
- if (ale->type == ACTTYPE_CONCHAN) {
- bConstraintChannel *conchanO= ale->data;
- bConstraintChannel *conchan;
-
- conchan= MEM_callocN(sizeof(bConstraintChannel), "ActCopyPasteConchan");
- strcpy(conchan->name, conchanO->name);
- BLI_addtail(&achan->constraintChannels, conchan);
-
- conchan->ipo= ipn= MEM_callocN(sizeof(Ipo), "ActCopyPasteIpo");
- }
- else {
- achan->ipo= ipn= MEM_callocN(sizeof(Ipo), "ActCopyPasteIpo");
- }
- ipn->blocktype = ipo->blocktype;
-
- /* now loop through curves, and only copy selected keyframes */
- for (icu= ipo->curve.first; icu; icu= icu->next) {
- /* allocate a new curve */
- icn= MEM_callocN(sizeof(IpoCurve), "ActCopyPasteIcu");
- icn->blocktype = icu->blocktype;
- icn->adrcode = icu->adrcode;
- BLI_addtail(&ipn->curve, icn);
-
- /* find selected BezTriples to add to the buffer */
- for (i=0, bezt=icu->bezt; i < icu->totvert; i++, bezt++) {
- if (BEZSELECTED(bezt))
- insert_bezt_icu(icn, bezt);
- }
- }
- }
-
- /* check if anything ended up in the buffer */
- if (actcopybuf.first==NULL || actcopybuf.last==NULL)
- error("Nothing copied to buffer");
-
- /* free temp memory */
- BLI_freelistN(&act_data);
-}
-
-void paste_actdata ()
-{
- ListBase act_data = {NULL, NULL};
- bActListElem *ale;
- int filter;
- void *data;
- short datatype;
-
- /* check if buffer is empty */
- if (actcopybuf.first==NULL || actcopybuf.last==NULL) {
- error("No data in buffer to paste");
- return;
- }
-
- /* get data */
- data= get_action_context(&datatype);
- if (data == NULL) return;
-
- /* filter data */
- filter= (ACTFILTER_VISIBLE | ACTFILTER_SEL | ACTFILTER_FOREDIT | ACTFILTER_IPOKEYS);
- actdata_filter(&act_data, filter, data, datatype);
-
- /* from selected channels */
- for (ale= act_data.first; ale; ale= ale->next) {
- Ipo *ipo_src=NULL, *ipo_dst=ale->key_data;
- bActionChannel *achan;
- IpoCurve *ico, *icu;
- BezTriple *bezt;
- int i;
- float offset= 0.0f;
- short offsetInit= 1;
-
- /* find matching ipo-block */
- for (achan= actcopybuf.first; achan; achan= achan->next) {
- /* try to match data */
- if (ale->ownertype == ACTTYPE_ACHAN) {
- bActionChannel *achant= ale->owner;
-
- /* check if we have a corresponding action channel */
- if (strcmp(achan->name, achant->name)==0) {
- /* check if this is a constraint channel */
- if (ale->type == ACTTYPE_CONCHAN) {
- bConstraintChannel *conchant= ale->data;
- bConstraintChannel *conchan;
-
- for (conchan=achan->constraintChannels.first; conchan; conchan=conchan->next) {
- if (strcmp(conchan->name, conchant->name)==0) {
- ipo_src= conchan->ipo;
- break;
- }
- }
- if (ipo_src) break;
- }
- else {
- ipo_src= achan->ipo;
- break;
- }
- }
- }
- else if (ale->ownertype == ACTTYPE_SHAPEKEY) {
- /* check if this action channel is "#ACP_ShapeKey" */
- if (strcmp(achan->name, "#ACP_ShapeKey")==0) {
- ipo_src= achan->ipo;
- break;
- }
- }
- }
-
- /* loop over curves, pasting keyframes */
- for (icu= ipo_dst->curve.first; icu; icu= icu->next) {
- for (ico= ipo_src->curve.first; ico; ico= ico->next) {
- /* only paste if compatable blocktype + adrcode */
- if ((ico->blocktype==icu->blocktype) && (ico->adrcode==icu->adrcode)) {
- /* just start pasting, with the the first keyframe on the current frame, and so on */
- for (i=0, bezt=ico->bezt; i < ico->totvert; i++, bezt++) {
- /* initialise offset (if not already done) */
- if (offsetInit) {
- offset= CFRA - bezt->vec[1][0];
- offsetInit= 0;
- }
-
- /* temporarily apply offset to src beztriple while copying */
- bezt->vec[0][0] += offset;
- bezt->vec[1][0] += offset;
- bezt->vec[2][0] += offset;
-
- /* insert the keyframe */
- insert_bezt_icu(icu, bezt);
-
- /* un-apply offset from src beztriple after copying */
- bezt->vec[0][0] -= offset;
- bezt->vec[1][0] -= offset;
- bezt->vec[2][0] -= offset;
- }
-
- /* recalculate channel's handles? */
- calchandles_ipocurve(icu);
-
- /* done for this channel */
- break;
- }
- }
- }
- }
-
- /* free temp memory */
- BLI_freelistN(&act_data);
-
- /* undo and redraw stuff */
- allqueue(REDRAWVIEW3D, 0);
- allspace(REMAKEIPO, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWNLA, 0);
- BIF_undo_push("Paste Action Keyframes");
-}
-
-/* **************************************************** */
-/* VARIOUS SETTINGS */
-
-/* This function combines several features related to setting
- * various ipo extrapolation/interpolation
- */
-void action_set_ipo_flags (short mode, short event)
-{
- ListBase act_data = {NULL, NULL};
- bActListElem *ale;
- void *data;
- short datatype;
- int filter;
-
- /* determine what type of data we are operating on */
- data = get_action_context(&datatype);
- if (data == NULL) return;
-
- /* determine which set of processing we are doing */
- switch (mode) {
- case SET_EXTEND_POPUP:
- {
- /* present popup menu for ipo extrapolation type */
- event
- = pupmenu("Channel Extending Type %t|"
- "Constant %x11|"
- "Extrapolation %x12|"
- "Cyclic %x13|"
- "Cyclic extrapolation %x14");
- if (event < 1) return;
- }
- break;
- case SET_IPO_POPUP:
- {
- /* present popup menu for ipo interpolation type */
- event
- = pupmenu("Channel Ipo Type %t|"
- "Constant %x1|"
- "Linear %x2|"
- "Bezier %x3");
- if (event < 1) return;
- }
- break;
-
- case SET_IPO_MENU: /* called from menus */
- case SET_EXTEND_MENU:
- break;
-
- default: /* weird, unhandled case */
- return;
- }
-
- /* filter data */
- filter= (ACTFILTER_VISIBLE | ACTFILTER_SEL | ACTFILTER_FOREDIT | ACTFILTER_IPOKEYS);
- actdata_filter(&act_data, filter, data, datatype);
-
- /* loop through setting flags */
- for (ale= act_data.first; ale; ale= ale->next) {
- Ipo *ipo= (Ipo *)ale->key_data;
-
- /* depending on the mode */
- switch (mode) {
- case SET_EXTEND_POPUP: /* extrapolation */
- case SET_EXTEND_MENU:
- {
- switch (event) {
- case SET_EXTEND_CONSTANT:
- setexprap_ipoloop(ipo, IPO_HORIZ);
- break;
- case SET_EXTEND_EXTRAPOLATION:
- setexprap_ipoloop(ipo, IPO_DIR);
- break;
- case SET_EXTEND_CYCLIC:
- setexprap_ipoloop(ipo, IPO_CYCL);
- break;
- case SET_EXTEND_CYCLICEXTRAPOLATION:
- setexprap_ipoloop(ipo, IPO_CYCLX);
- break;
- }
- }
- break;
- case SET_IPO_POPUP: /* interpolation */
- case SET_IPO_MENU:
- {
- setipotype_ipo(ipo, event);
- }
- break;
- }
- }
-
- /* cleanup */
- BLI_freelistN(&act_data);
-
- if (datatype == ACTCONT_ACTION)
- remake_action_ipos(data);
-
- BIF_undo_push("Set Ipo Type");
- allspace(REMAKEIPO, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWNLA, 0);
-}
-
-/* this function sets the handles on keyframes */
-void sethandles_action_keys (int code)
-{
- ListBase act_data = {NULL, NULL};
- bActListElem *ale;
- void *data;
- short datatype;
- int filter;
-
- /* determine what type of data we are operating on */
- data = get_action_context(&datatype);
- if (data == NULL) return;
-
- /* filter data */
- filter= (ACTFILTER_VISIBLE | ACTFILTER_FOREDIT | ACTFILTER_IPOKEYS);
- actdata_filter(&act_data, filter, data, datatype);
-
- /* loop through setting flags */
- for (ale= act_data.first; ale; ale= ale->next) {
- sethandles_ipo_keys((Ipo *)ale->key_data, code);
- }
-
- /* cleanup */
- BLI_freelistN(&act_data);
- if (datatype == ACTCONT_ACTION)
- remake_action_ipos(data);
-
- BIF_undo_push("Set Handle Type");
- allspace(REMAKEIPO, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWNLA, 0);
-}
-
-/* ----------------------------------------- */
-
-/* this gets called when nkey is pressed (no Transform Properties panel yet) */
-static void numbuts_action ()
-{
- void *data;
- short datatype;
-
- void *act_channel;
- short chantype;
-
- bActionChannel *achan= NULL;
- bConstraintChannel *conchan= NULL;
- IpoCurve *icu= NULL;
- KeyBlock *kb= NULL;
-
- short mval[2];
-
- int but=0;
- char str[64];
- short expand, protect, mute;
- float slidermin, slidermax;
-
-
- /* determine what type of data we are operating on */
- data = get_action_context(&datatype);
- if (data == NULL) return;
-
- /* figure out what is under cursor */
- getmouseco_areawin(mval);
- if (mval[0] < NAMEWIDTH)
- return;
- act_channel= get_nearest_act_channel(mval, &chantype);
-
- /* create items for clever-numbut */
- if (chantype == ACTTYPE_ACHAN) {
- /* Action Channel */
- achan= (bActionChannel *)act_channel;
-
- strcpy(str, achan->name);
- protect= (achan->flag & ACHAN_PROTECTED);
- expand = (achan->flag & ACHAN_EXPANDED);
- mute = (achan->ipo)? (achan->ipo->muteipo): 0;
-
- add_numbut(but++, TEX, "ActChan: ", 0, 31, str, "Name of Action Channel");
- add_numbut(but++, TOG|SHO, "Expanded", 0, 24, &expand, "Action Channel is Expanded");
- add_numbut(but++, TOG|SHO, "Muted", 0, 24, &mute, "Channel is Muted");
- add_numbut(but++, TOG|SHO, "Protected", 0, 24, &protect, "Channel is Protected");
- }
- else if (chantype == ACTTYPE_CONCHAN) {
- /* Constraint Channel */
- conchan= (bConstraintChannel *)act_channel;
-
- strcpy(str, conchan->name);
- protect= (conchan->flag & CONSTRAINT_CHANNEL_PROTECTED);
- mute = (conchan->ipo)? (conchan->ipo->muteipo): 0;
-
- add_numbut(but++, TEX, "ConChan: ", 0, 29, str, "Name of Constraint Channel");
- add_numbut(but++, TOG|SHO, "Muted", 0, 24, &mute, "Channel is Muted");
- add_numbut(but++, TOG|SHO, "Protected", 0, 24, &protect, "Channel is Protected");
- }
- else if (chantype == ACTTYPE_ICU) {
- /* IPO Curve */
- icu= (IpoCurve *)act_channel;
-
- if (G.saction->pin)
- sprintf(str, getname_ipocurve(icu, NULL));
- else
- sprintf(str, getname_ipocurve(icu, OBACT));
-
- if (IS_EQ(icu->slide_max, icu->slide_min)) {
- if (IS_EQ(icu->ymax, icu->ymin)) {
- icu->slide_min= -100.0;
- icu->slide_max= 100.0;
- }
- else {
- icu->slide_min= icu->ymin;
- icu->slide_max= icu->ymax;
- }
- }
- slidermin= icu->slide_min;
- slidermax= icu->slide_max;
-
- //protect= (icu->flag & IPO_PROTECT);
- mute = (icu->flag & IPO_MUTE);
-
- add_numbut(but++, NUM|FLO, "Slider Min:", -10000, slidermax, &slidermin, 0);
- add_numbut(but++, NUM|FLO, "Slider Max:", slidermin, 10000, &slidermax, 0);
- add_numbut(but++, TOG|SHO, "Muted", 0, 24, &mute, "Channel is Muted");
- //add_numbut(but++, TOG|SHO, "Protected", 0, 24, &protect, "Channel is Protected");
- }
- else if (chantype == ACTTYPE_SHAPEKEY) {
- /* Shape Key */
- kb= (KeyBlock *)act_channel;
-
- if (kb->name[0] == '\0') {
- Key *key= (Key *)data;
- int keynum= BLI_findindex(&key->block, kb);
-
- sprintf(str, "Key %d", keynum);
- }
- else
- strcpy(str, kb->name);
-
- if (kb->slidermin >= kb->slidermax) {
- kb->slidermin = 0.0;
- kb->slidermax = 1.0;
- }
-
- add_numbut(but++, TEX, "KB: ", 0, 24, str,
- "Does this really need a tool tip?");
- add_numbut(but++, NUM|FLO, "Slider Min:",
- -10000, kb->slidermax, &kb->slidermin, 0);
- add_numbut(but++, NUM|FLO, "Slider Max:",
- kb->slidermin, 10000, &kb->slidermax, 0);
- }
- else {
- /* nothing under-cursor */
- return;
- }
-
- /* draw clever-numbut */
- if (do_clever_numbuts(str, but, REDRAW)) {
- /* restore settings based on type */
- if (icu) {
- icu->slide_min= slidermin;
- icu->slide_max= slidermax;
-
- //if (protect) icu->flag |= IPO_PROTECT;
- //else icu->flag &= ~IPO_PROTECT;
- if (mute) icu->flag |= IPO_MUTE;
- else icu->flag &= ~IPO_MUTE;
- }
- else if (conchan) {
- strcpy(conchan->name, str);
-
- if (protect) conchan->flag |= CONSTRAINT_CHANNEL_PROTECTED;
- else conchan->flag &= ~CONSTRAINT_CHANNEL_PROTECTED;
-
- if (conchan->ipo)
- conchan->ipo->muteipo = mute;
- }
- else if (achan) {
- strcpy(achan->name, str);
-
- if (expand) achan->flag |= ACHAN_EXPANDED;
- else achan->flag &= ~ACHAN_EXPANDED;
-
- if (protect) achan->flag |= ACHAN_PROTECTED;
- else achan->flag &= ~ACHAN_PROTECTED;
-
- if (achan->ipo)
- achan->ipo->muteipo = mute;
- }
-
- allqueue(REDRAWACTION, 0);
- allspace(REMAKEIPO, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWVIEW3D, 0);
- }
-}
-
-
-
-/* **************************************************** */
-/* CHANNEL SELECTION */
-
-static void hilight_channel(bAction *act, bActionChannel *achan, short select)
-{
- bActionChannel *curchan;
-
- if (!act)
- return;
-
- for (curchan=act->chanbase.first; curchan; curchan=curchan->next) {
- if (curchan==achan && select)
- curchan->flag |= ACHAN_HILIGHTED;
- else
- curchan->flag &= ~ACHAN_HILIGHTED;
- }
-}
-
-/* messy call... */
-static void select_poseelement_by_name(char *name, int select)
-{
- /* Syncs selection of channels with selection of object elements in posemode */
- Object *ob= OBACT;
- bPoseChannel *pchan;
-
- if (!ob || ob->type!=OB_ARMATURE)
- return;
-
- if(select==2) {
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next)
- pchan->bone->flag &= ~(BONE_ACTIVE);
- }
-
- pchan= get_pose_channel(ob->pose, name);
- if(pchan) {
- if(select)
- pchan->bone->flag |= (BONE_SELECTED);
- else
- pchan->bone->flag &= ~(BONE_SELECTED);
- if(select==2)
- pchan->bone->flag |= (BONE_ACTIVE);
- }
-}
-
-/* apparently within active object context */
-/* called extern, like on bone selection */
-void select_actionchannel_by_name (bAction *act, char *name, int select)
-{
- bActionChannel *achan;
-
- if (!act)
- return;
-
- for (achan = act->chanbase.first; achan; achan= achan->next) {
- if (!strcmp(achan->name, name)) {
- if (select) {
- achan->flag |= ACHAN_SELECTED;
- hilight_channel(act, achan, 1);
- }
- else {
- achan->flag &= ~ACHAN_SELECTED;
- hilight_channel(act, achan, 0);
- }
- return;
- }
- }
-}
-
-/* select_mode = SELECT_REPLACE
- * = SELECT_ADD
- * = SELECT_SUBTRACT
- * = SELECT_INVERT
- */
-
-/* exported for outliner (ton) */
-/* apparently within active object context */
-int select_channel(bAction *act, bActionChannel *achan, int selectmode)
-{
- /* Select the channel based on the selection mode */
- int flag;
-
- switch (selectmode) {
- case SELECT_ADD:
- achan->flag |= ACHAN_SELECTED;
- break;
- case SELECT_SUBTRACT:
- achan->flag &= ~ACHAN_SELECTED;
- break;
- case SELECT_INVERT:
- achan->flag ^= ACHAN_SELECTED;
- break;
- }
- flag = (achan->flag & ACHAN_SELECTED) ? 1 : 0;
-
- hilight_channel(act, achan, flag);
- select_poseelement_by_name(achan->name, flag);
-
- return flag;
-}
-
-static int select_constraint_channel(bAction *act,
- bConstraintChannel *conchan,
- int selectmode)
-{
- /* Select the constraint channel based on the selection mode */
- int flag;
-
- switch (selectmode) {
- case SELECT_ADD:
- conchan->flag |= CONSTRAINT_CHANNEL_SELECT;
- break;
- case SELECT_SUBTRACT:
- conchan->flag &= ~CONSTRAINT_CHANNEL_SELECT;
- break;
- case SELECT_INVERT:
- conchan->flag ^= CONSTRAINT_CHANNEL_SELECT;
- break;
- }
- flag = (conchan->flag & CONSTRAINT_CHANNEL_SELECT) ? 1 : 0;
-
- return flag;
-}
-
-int select_icu_channel(bAction *act, IpoCurve *icu, int selectmode)
-{
- /* Select the channel based on the selection mode */
- int flag;
-
- switch (selectmode) {
- case SELECT_ADD:
- icu->flag |= IPO_SELECT;
- break;
- case SELECT_SUBTRACT:
- icu->flag &= ~IPO_SELECT;
- break;
- case SELECT_INVERT:
- icu->flag ^= IPO_SELECT;
- break;
- }
- flag = (icu->flag & IPO_SELECT) ? 1 : 0;
- return flag;
-}
-
-/* ----------------------------------------- */
-
-/* deselects action channels in given action */
-void deselect_actionchannels (bAction *act, short test)
-{
- ListBase act_data = {NULL, NULL};
- bActListElem *ale;
- int filter, sel=1;
-
- /* filter data */
- filter= ACTFILTER_VISIBLE;
- actdata_filter(&act_data, filter, act, ACTCONT_ACTION);
-
- /* See if we should be selecting or deselecting */
- if (test) {
- for (ale= act_data.first; ale; ale= ale->next) {
- if (sel == 0)
- break;
-
- switch (ale->type) {
- case ACTTYPE_ACHAN:
- if (ale->flag & ACHAN_SELECTED)
- sel= 0;
- break;
- case ACTTYPE_CONCHAN:
- if (ale->flag & CONSTRAINT_CHANNEL_SELECT)
- sel=0;
- break;
- case ACTTYPE_ICU:
- if (ale->flag & IPO_SELECT)
- sel=0;
- break;
- }
- }
- }
- else
- sel= 0;
-
- /* Now set the flags */
- for (ale= act_data.first; ale; ale= ale->next) {
- switch (ale->type) {
- case ACTTYPE_ACHAN:
- {
- bActionChannel *achan= (bActionChannel *)ale->data;
-
- if (sel)
- achan->flag |= ACHAN_SELECTED;
- else
- achan->flag &= ~ACHAN_SELECTED;
- select_poseelement_by_name(achan->name, sel);
- }
- break;
- case ACTTYPE_CONCHAN:
- {
- bConstraintChannel *conchan= (bConstraintChannel *)ale->data;
-
- if (sel)
- conchan->flag |= CONSTRAINT_CHANNEL_SELECT;
- else
- conchan->flag &= ~CONSTRAINT_CHANNEL_SELECT;
- }
- break;
- case ACTTYPE_ICU:
- {
- IpoCurve *icu= (IpoCurve *)ale->data;
-
- if (sel)
- icu->flag |= IPO_SELECT;
- else
- icu->flag &= ~IPO_SELECT;
- }
- break;
- }
- }
-
- /* Cleanup */
- BLI_freelistN(&act_data);
-}
-
-/* deselects channels in the action editor */
-void deselect_action_channels (short test)
-{
- void *data;
- short datatype;
-
- /* determine what type of data we are operating on */
- data = get_action_context(&datatype);
- if (data == NULL) return;
-
- /* based on type */
- if (datatype == ACTCONT_ACTION)
- deselect_actionchannels(data, test);
- // should shapekey channels be allowed to do this?
-}
-
-/* deselects keyframes in the action editor */
-void deselect_action_keys (short test, short sel)
-{
- ListBase act_data = {NULL, NULL};
- bActListElem *ale;
- int filter;
- void *data;
- short datatype;
-
- /* determine what type of data we are operating on */
- data = get_action_context(&datatype);
- if (data == NULL) return;
-
- /* filter data */
- filter= (ACTFILTER_VISIBLE | ACTFILTER_IPOKEYS);
- actdata_filter(&act_data, filter, data, datatype);
-
- /* See if we should be selecting or deselecting */
- if (test) {
- for (ale= act_data.first; ale; ale= ale->next) {
- if (is_ipo_key_selected(ale->key_data)) {
- sel= 0;
- break;
- }
- }
- }
-
- /* Now set the flags */
- for (ale= act_data.first; ale; ale= ale->next) {
- set_ipo_key_selection(ale->key_data, sel);
- }
-
- /* Cleanup */
- BLI_freelistN(&act_data);
-}
-
-/* selects all keyframes in the action editor - per channel or time
- * mode = 0: all in channel; mode = 1: all in frame
- */
-void selectall_action_keys (short mval[], short mode, short select_mode)
-{
- void *data;
- short datatype;
-
- /* determine what type of data we are operating on */
- data = get_action_context(&datatype);
- if (data == NULL) return;
-
- if (select_mode == SELECT_REPLACE) {
- deselect_action_keys(0, 0);
- select_mode = SELECT_ADD;
- }
-
- /* depending on mode */
- switch (mode) {
- case 0: /* all in channel*/
- {
- void *act_channel;
- short chantype;
-
- /* get channel, and act according to type */
- act_channel= get_nearest_act_channel(mval, &chantype);
- switch (chantype) {
- case ACTTYPE_ACHAN:
- {
- bActionChannel *achan= (bActionChannel *)act_channel;
- select_ipo_bezier_keys(achan->ipo, select_mode);
- }
- break;
- case ACTTYPE_CONCHAN:
- {
- bConstraintChannel *conchan= (bConstraintChannel *)act_channel;
- select_ipo_bezier_keys(conchan->ipo, select_mode);
- }
- break;
- case ACTTYPE_ICU:
- {
- IpoCurve *icu= (IpoCurve *)act_channel;
- select_icu_bezier_keys(icu, select_mode);
- }
- break;
- }
- }
- break;
- case 1: /* all in frame */
- {
- ListBase act_data = {NULL, NULL};
- bActListElem *ale;
- int filter;
- rcti rect;
- rctf rectf;
-
- /* use bounding box to find kframe */
- rect.xmin = rect.xmax = mval[0];
- rect.ymin = rect.ymax = mval[1];
-
- mval[0]= rect.xmin;
- mval[1]= rect.ymin+2;
- areamouseco_to_ipoco(G.v2d, mval, &rectf.xmin, &rectf.ymin);
- rectf.xmax= rectf.xmin;
- rectf.ymax= rectf.ymin;
-
- rectf.xmin = rectf.xmin - 0.5;
- rectf.xmax = rectf.xmax + 0.5;
-
- /* filter data */
- filter= (ACTFILTER_VISIBLE | ACTFILTER_IPOKEYS);
- actdata_filter(&act_data, filter, data, datatype);
-
- /* Now set the flags */
- for (ale= act_data.first; ale; ale= ale->next)
- borderselect_ipo_key(ale->key_data, rectf.xmin, rectf.xmax, select_mode);
-
- /* Cleanup */
- BLI_freelistN(&act_data);
- }
- break;
- }
-
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWIPO, 0);
-}
-
-void markers_selectkeys_between (void)
-{
- ListBase act_data = {NULL, NULL};
- bActListElem *ale;
- int filter;
- void *data;
- short datatype;
- float min, max;
-
- /* determine what type of data we are operating on */
- data = get_action_context(&datatype);
- if (data == NULL) return;
-
- /* get extreme markers */
- get_minmax_markers(1, &min, &max);
- if (min==max) return;
- min -= 0.5f;
- max += 0.5f;
-
- /* filter data */
- filter= (ACTFILTER_VISIBLE | ACTFILTER_IPOKEYS);
- actdata_filter(&act_data, filter, data, datatype);
-
- /* select keys in-between */
- for (ale= act_data.first; ale; ale= ale->next) {
- if(NLA_ACTION_SCALED && datatype==ACTCONT_ACTION) {
- actstrip_map_ipo_keys(OBACT, ale->key_data, 0, 1);
- borderselect_ipo_key(ale->key_data, min, max, SELECT_ADD);
- actstrip_map_ipo_keys(OBACT, ale->key_data, 1, 1);
- }
- else {
- borderselect_ipo_key(ale->key_data, min, max, SELECT_ADD);
- }
- }
-
- /* Cleanup */
- BLI_freelistN(&act_data);
-}
-
-void selectkeys_leftright (short leftright, short select_mode)
-{
- ListBase act_data = {NULL, NULL};
- bActListElem *ale;
- int filter;
- void *data;
- short datatype;
- float min, max;
-
- if (select_mode==SELECT_REPLACE) {
- select_mode=SELECT_ADD;
- deselect_action_keys(0, 0);
- }
-
- /* determine what type of data we are operating on */
- data = get_action_context(&datatype);
- if (data == NULL) return;
-
- if (leftright==1) {
- min = -MAXFRAMEF;
- max = (float)CFRA+0.1f;
- }
- else {
- min = (float)CFRA-0.1f;
- max = MAXFRAMEF;
- }
-
- /* filter data */
- filter= (ACTFILTER_VISIBLE | ACTFILTER_IPOKEYS);
- actdata_filter(&act_data, filter, data, datatype);
-
- /* select keys to the right */
- for (ale= act_data.first; ale; ale= ale->next) {
- if(NLA_ACTION_SCALED && datatype==ACTCONT_ACTION) {
- actstrip_map_ipo_keys(OBACT, ale->key_data, 0, 1);
- borderselect_ipo_key(ale->key_data, min, max, SELECT_ADD);
- actstrip_map_ipo_keys(OBACT, ale->key_data, 1, 1);
- }
- else {
- borderselect_ipo_key(ale->key_data, min, max, SELECT_ADD);
- }
- }
-
- /* Cleanup */
- BLI_freelistN(&act_data);
-
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWIPO, 0);
-
-}
-
-
-/* ----------------------------------------- */
-
-/* This function makes a list of the selected keyframes
- * in the ipo curves it has been passed
- */
-static void make_sel_cfra_list(Ipo *ipo, ListBase *elems)
-{
- IpoCurve *icu;
-
- if (ipo == NULL) return;
-
- for(icu= ipo->curve.first; icu; icu= icu->next) {
- BezTriple *bezt;
- int a= 0;
-
- for (bezt=icu->bezt; a<icu->totvert; a++, bezt++) {
- if (bezt && BEZSELECTED(bezt))
- add_to_cfra_elem(elems, bezt);
- }
- }
-}
-
-/* This function selects all key frames in the same column(s) as a already selected key(s)
- * or marker(s), or all the keyframes on a particular frame (triggered by a RMB on x-scrollbar)
- */
-void column_select_action_keys(int mode)
-{
- ListBase elems= {NULL, NULL};
- CfraElem *ce;
- IpoCurve *icu;
- ListBase act_data = {NULL, NULL};
- bActListElem *ale;
- int filter;
- void *data;
- short datatype;
-
- /* determine what type of data we are operating on */
- data = get_action_context(&datatype);
- if (data == NULL) return;
-
- /* build list of columns */
- switch (mode) {
- case 1: /* list of selected keys */
- filter= (ACTFILTER_VISIBLE | ACTFILTER_IPOKEYS);
- actdata_filter(&act_data, filter, data, datatype);
-
- for (ale= act_data.first; ale; ale= ale->next)
- make_sel_cfra_list(ale->key_data, &elems);
-
- BLI_freelistN(&act_data);
- break;
- case 2: /* list of selected markers */
- make_marker_cfra_list(&elems, 1);
-
- /* apply scaled action correction if needed */
- if (NLA_ACTION_SCALED && datatype==ACTCONT_ACTION) {
- for (ce= elems.first; ce; ce= ce->next)
- ce->cfra= get_action_frame(OBACT, ce->cfra);
- }
- break;
- }
-
- /* loop through all of the keys and select additional keyframes
- * based on the keys found to be selected above
- */
- filter= (ACTFILTER_VISIBLE | ACTFILTER_ONLYICU);
- actdata_filter(&act_data, filter, data, datatype);
-
- for (ale= act_data.first; ale; ale= ale->next) {
- for (ce= elems.first; ce; ce= ce->next) {
- for (icu= ale->key_data; icu; icu= icu->next) {
- BezTriple *bezt;
- int verts = 0;
-
- for (bezt=icu->bezt; verts<icu->totvert; bezt++, verts++) {
- if (bezt) {
- if( (int)(ce->cfra) == (int)(bezt->vec[1][0]) )
- bezt->f2 |= 1;
- }
- }
- }
- }
- }
-
- BLI_freelistN(&act_data);
- BLI_freelistN(&elems);
-}
-
-/* some quick defines for borderselect modes */
-#define ACTEDIT_BORDERSEL_ALL 0
-#define ACTEDIT_BORDERSEL_FRA 1
-#define ACTEDIT_BORDERSEL_CHA 2
-
-/* borderselect: for keyframes only */
-void borderselect_action (void)
-{
- ListBase act_data = {NULL, NULL};
- bActListElem *ale;
- int filter;
- void *data;
- short datatype;
-
- rcti rect;
- rctf rectf;
- int val, selectmode, mode;
- int (*select_function)(BezTriple *);
- short mval[2];
- float ymin, ymax;
-
- /* determine what type of data we are operating on */
- data = get_action_context(&datatype);
- if (data == NULL) return;
-
- /* what should be selected (based on the starting location of cursor) */
- getmouseco_areawin(mval);
- if (IN_2D_VERT_SCROLL(mval))
- mode = ACTEDIT_BORDERSEL_CHA;
- else if (IN_2D_HORIZ_SCROLL(mval))
- mode = ACTEDIT_BORDERSEL_FRA;
- else
- mode = ACTEDIT_BORDERSEL_ALL;
-
- /* draw and handle the borderselect stuff (ui) and get the select rect */
- if ( (val = get_border(&rect, 3)) ) {
- if (val == LEFTMOUSE) {
- selectmode = SELECT_ADD;
- select_function = select_bezier_add;
- }
- else {
- selectmode = SELECT_SUBTRACT;
- select_function = select_bezier_subtract;
- }
-
- mval[0]= rect.xmin;
- mval[1]= rect.ymin+2;
- areamouseco_to_ipoco(G.v2d, mval, &rectf.xmin, &rectf.ymin);
- mval[0]= rect.xmax;
- mval[1]= rect.ymax-2;
- areamouseco_to_ipoco(G.v2d, mval, &rectf.xmax, &rectf.ymax);
-
- /* if action is mapped in NLA, it returns a correction */
- if (NLA_ACTION_SCALED && datatype==ACTCONT_ACTION) {
- rectf.xmin= get_action_frame(OBACT, rectf.xmin);
- rectf.xmax= get_action_frame(OBACT, rectf.xmax);
- }
-
- ymax = CHANNELHEIGHT/2;
-
- /* filter data */
- filter= (ACTFILTER_VISIBLE | ACTFILTER_CHANNELS);
- actdata_filter(&act_data, filter, data, datatype);
-
- /* loop over data, doing border select */
- for (ale= act_data.first; ale; ale= ale->next) {
- ymin=ymax-(CHANNELHEIGHT+CHANNELSKIP);
-
- /* what gets selected depends on the mode (based on initial position of cursor) */
- switch (mode) {
- case ACTEDIT_BORDERSEL_FRA: /* all in frame(s) */
- if (ale->key_data) {
- if (ale->datatype == ALE_IPO)
- borderselect_ipo_key(ale->key_data, rectf.xmin, rectf.xmax, selectmode);
- else if (ale->datatype == ALE_ICU)
- borderselect_icu_key(ale->key_data, rectf.xmin, rectf.xmax, select_function);
- }
- break;
- case ACTEDIT_BORDERSEL_CHA: /* all in channel(s) */
- if (!((ymax < rectf.ymin) || (ymin > rectf.ymax))) {
- if (ale->key_data) {
- if (ale->datatype == ALE_IPO)
- select_ipo_bezier_keys(ale->key_data, selectmode);
- else if (ale->datatype == ALE_ICU)
- select_icu_bezier_keys(ale->key_data, selectmode);
- }
- }
- break;
- default: /* any keyframe inside region defined by region */
- if (!((ymax < rectf.ymin) || (ymin > rectf.ymax))) {
- if (ale->key_data) {
- if (ale->datatype == ALE_IPO)
- borderselect_ipo_key(ale->key_data, rectf.xmin, rectf.xmax, selectmode);
- else if (ale->datatype == ALE_ICU)
- borderselect_icu_key(ale->key_data, rectf.xmin, rectf.xmax, select_function);
- }
- }
- }
-
- ymax=ymin;
- }
-
- /* cleanup */
- BLI_freelistN(&act_data);
-
- BIF_undo_push("Border Select Action");
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- }
-}
-
-/* **************************************************** */
-/* MOUSE-HANDLING */
-
-/* right-hand side - mouse click */
-static void mouse_action (int selectmode)
-{
- void *data;
- short datatype;
-
- bAction *act= NULL;
- bActionChannel *achan= NULL;
- bConstraintChannel *conchan= NULL;
- IpoCurve *icu= NULL;
- TimeMarker *marker;
-
- void *act_channel;
- short sel, act_type;
- float selx;
-
- /* determine what type of data we are operating on */
- data = get_action_context(&datatype);
- if (data == NULL) return;
- if (datatype == ACTCONT_ACTION) act= (bAction *)data;
-
- act_channel= get_nearest_action_key(&selx, &sel, &act_type, &achan);
- marker=find_nearest_marker(1);
-
- if (act_channel) {
- switch (act_type) {
- case ACTTYPE_ICU:
- icu= (IpoCurve *)act_channel;
- break;
- case ACTTYPE_CONCHAN:
- conchan= (bConstraintChannel *)act_channel;
- break;
- case ACTTYPE_ACHAN:
- achan= (bActionChannel *)act_channel;
- break;
- default:
- return;
- }
-
- if (selectmode == SELECT_REPLACE) {
- selectmode = SELECT_ADD;
-
- deselect_action_keys(0, 0);
-
- if (datatype == ACTCONT_ACTION) {
- deselect_action_channels(0);
-
- achan->flag |= ACHAN_SELECTED;
- hilight_channel(act, achan, 1);
- select_poseelement_by_name(achan->name, 2); /* 2 is activate */
- }
- }
-
- if (icu)
- select_icu_key(icu, selx, selectmode);
- else if (conchan)
- select_ipo_key(conchan->ipo, selx, selectmode);
- else
- select_ipo_key(achan->ipo, selx, selectmode);
-
- std_rmouse_transform(transform_action_keys);
-
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWBUTSALL, 0);
- }
- else if (marker) {
- /* not channel, so maybe marker */
- if (selectmode == SELECT_REPLACE) {
- deselect_markers(0, 0);
- marker->flag |= SELECT;
- }
- else if (selectmode == SELECT_INVERT) {
- if (marker->flag & SELECT)
- marker->flag &= ~SELECT;
- else
- marker->flag |= SELECT;
- }
- else if (selectmode == SELECT_ADD)
- marker->flag |= SELECT;
- else if (selectmode == SELECT_SUBTRACT)
- marker->flag &= ~SELECT;
-
- std_rmouse_transform(transform_markers);
-
- allqueue(REDRAWMARKER, 0);
- }
-}
-
-/* lefthand side - mouse-click */
-static void mouse_actionchannels (short mval[])
-{
- bAction *act= G.saction->action;
- void *data, *act_channel;
- short datatype, chantype;
-
- /* determine what type of data we are operating on */
- data = get_action_context(&datatype);
- if (data == NULL) return;
-
- /* get channel to work on */
- act_channel= get_nearest_act_channel(mval, &chantype);
-
- /* action to take depends on what channel we've got */
- switch (chantype) {
- case ACTTYPE_ACHAN:
- {
- bActionChannel *achan= (bActionChannel *)act_channel;
-
- if (mval[0] >= (NAMEWIDTH-16)) {
- /* toggle protect */
- achan->flag ^= ACHAN_PROTECTED;
- }
- else if ((mval[0] >= (NAMEWIDTH-32)) && (achan->ipo)) {
- /* toggle mute */
- achan->ipo->muteipo = (achan->ipo->muteipo)? 0: 1;
- }
- else if (mval[0] <= 17) {
- /* toggle expand */
- achan->flag ^= ACHAN_EXPANDED;
- }
- else {
- /* select/deselect achan */
- if (G.qual & LR_SHIFTKEY) {
- select_channel(act, achan, SELECT_INVERT);
- }
- else {
- deselect_actionchannels(act, 0);
- select_channel(act, achan, SELECT_ADD);
- }
-
- /* messy... set active bone */
- select_poseelement_by_name(achan->name, 2);
- }
- }
- break;
- case ACTTYPE_FILLIPO:
- {
- bActionChannel *achan= (bActionChannel *)act_channel;
-
- achan->flag ^= ACHAN_SHOWIPO;
-
- if ((mval[0] > 24) && (achan->flag & ACHAN_SHOWIPO)) {
- /* select+make active achan */
- deselect_actionchannels(act, 0);
- select_channel(act, achan, SELECT_ADD);
-
- /* messy... set active bone */
- select_poseelement_by_name(achan->name, 2);
- }
- }
- break;
- case ACTTYPE_FILLCON:
- {
- bActionChannel *achan= (bActionChannel *)act_channel;
-
- achan->flag ^= ACHAN_SHOWCONS;
-
- if ((mval[0] > 24) && (achan->flag & ACHAN_SHOWCONS)) {
- /* select+make active achan */
- deselect_actionchannels(act, 0);
- select_channel(act, achan, SELECT_ADD);
-
- /* messy... set active bone */
- select_poseelement_by_name(achan->name, 2);
- }
- }
- break;
- case ACTTYPE_ICU:
- {
- IpoCurve *icu= (IpoCurve *)act_channel;
-
-#if 0 /* disabled until all ipo tools support this -------> */
- if (mval[0] >= (NAMEWIDTH-16)) {
- /* toggle protection */
- icu->flag ^= IPO_PROTECT;
- }
-#endif /* <------- end of disabled code */
- if (mval[0] >= (NAMEWIDTH-16)) {
- /* toggle mute */
- icu->flag ^= IPO_MUTE;
- }
- else {
- /* select/deselect */
- select_icu_channel(act, icu, SELECT_INVERT);
- }
- }
- break;
- case ACTTYPE_CONCHAN:
- {
- bConstraintChannel *conchan= (bConstraintChannel *)act_channel;
-
- if (mval[0] >= (NAMEWIDTH-16)) {
- /* toggle protection */
- conchan->flag ^= CONSTRAINT_CHANNEL_PROTECTED;
- }
- else if ((mval[0] >= (NAMEWIDTH-32)) && (conchan->ipo)) {
- /* toggle mute */
- conchan->ipo->muteipo = (conchan->ipo->muteipo)? 0: 1;
- }
- else {
- /* select/deselect */
- select_constraint_channel(act, conchan, SELECT_INVERT);
- }
- }
- break;
- default:
- return;
- }
-
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWTIME, 0);
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWBUTSALL, 0);
-}
-
-/* **************************************************** */
-/* ACTION CHANNEL RE-ORDERING */
-
-void top_sel_action ()
-{
- bAction *act;
- bActionChannel *achan;
-
- /* Get the selected action, exit if none are selected */
- act = G.saction->action;
- if (!act) return;
-
- for (achan= act->chanbase.first; achan; achan= achan->next){
- if (VISIBLE_ACHAN(achan)) {
- if (SEL_ACHAN(achan) && !(achan->flag & ACHAN_MOVED)){
- /* take it out off the chain keep data */
- BLI_remlink (&act->chanbase, achan);
- /* make it first element */
- BLI_insertlinkbefore(&act->chanbase, act->chanbase.first, achan);
- achan->flag |= ACHAN_MOVED;
- /* restart with rest of list */
- achan= achan->next;
- }
- }
- }
- /* clear temp flags */
- for (achan= act->chanbase.first; achan; achan= achan->next){
- achan->flag = achan->flag & ~ACHAN_MOVED;
- }
-
- /* Clean up and redraw stuff */
- remake_action_ipos (act);
- BIF_undo_push("Top Action channel");
- allspace(REMAKEIPO, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWNLA, 0);
-}
-
-void up_sel_action ()
-{
- bAction *act;
- bActionChannel *achan, *prev;
-
- /* Get the selected action, exit if none are selected */
- act = G.saction->action;
- if (!act) return;
-
- for (achan=act->chanbase.first; achan; achan= achan->next) {
- if (VISIBLE_ACHAN(achan)) {
- if (SEL_ACHAN(achan) && !(achan->flag & ACHAN_MOVED)){
- prev = achan->prev;
- if (prev) {
- /* take it out off the chain keep data */
- BLI_remlink (&act->chanbase, achan);
- /* push it up */
- BLI_insertlinkbefore(&act->chanbase, prev, achan);
- achan->flag |= ACHAN_MOVED;
- /* restart with rest of list */
- achan= achan->next;
- }
- }
- }
- }
- /* clear temp flags */
- for (achan=act->chanbase.first; achan; achan= achan->next){
- achan->flag = achan->flag & ~ACHAN_MOVED;
- }
-
- /* Clean up and redraw stuff */
- remake_action_ipos (act);
- BIF_undo_push("Up Action channel");
- allspace(REMAKEIPO, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWNLA, 0);
-}
-
-void down_sel_action ()
-{
- bAction *act;
- bActionChannel *achan, *next;
-
- /* Get the selected action, exit if none are selected */
- act = G.saction->action;
- if (!act) return;
-
- for (achan= act->chanbase.last; achan; achan= achan->prev) {
- if (VISIBLE_ACHAN(achan)) {
- if (SEL_ACHAN(achan) && !(achan->flag & ACHAN_MOVED)){
- next = achan->next;
- if (next) next = next->next;
- if (next) {
- /* take it out off the chain keep data */
- BLI_remlink (&act->chanbase, achan);
- /* move it down */
- BLI_insertlinkbefore(&act->chanbase, next, achan);
- achan->flag |= ACHAN_MOVED;
- }
- else {
- /* take it out off the chain keep data */
- BLI_remlink (&act->chanbase, achan);
- /* add at end */
- BLI_addtail(&act->chanbase, achan);
- achan->flag |= ACHAN_MOVED;
- }
- }
- }
- }
- /* clear temp flags */
- for (achan= act->chanbase.first; achan; achan= achan->next){
- achan->flag = achan->flag & ~ACHAN_MOVED;
- }
-
- /* Clean up and redraw stuff */
- remake_action_ipos (act);
- BIF_undo_push("Down Action channel");
- allspace(REMAKEIPO, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWNLA, 0);
-}
-
-void bottom_sel_action ()
-{
- bAction *act;
- bActionChannel *achan;
-
- /* Get the selected action, exit if none are selected */
- act = G.saction->action;
- if (!act) return;
-
- for (achan=act->chanbase.last; achan; achan= achan->prev) {
- if (VISIBLE_ACHAN(achan)) {
- if (SEL_ACHAN(achan) && !(achan->flag & ACHAN_MOVED)) {
- /* take it out off the chain keep data */
- BLI_remlink (&act->chanbase, achan);
- /* add at end */
- BLI_addtail(&act->chanbase, achan);
- achan->flag |= ACHAN_MOVED;
- }
- }
- }
- /* clear temp flags */
- for (achan=act->chanbase.first; achan; achan= achan->next) {
- achan->flag = achan->flag & ~ACHAN_MOVED;
- }
-
- /* Clean up and redraw stuff */
- remake_action_ipos (act);
- BIF_undo_push("Bottom Action channel");
- allspace(REMAKEIPO, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWNLA, 0);
-}
-
-/* **************************************************** */
-/* EVENT HANDLING */
-
-void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
-{
- extern void do_actionbuts(unsigned short event); // drawaction.c
- SpaceAction *saction;
- void *data;
- short datatype;
- float dx, dy;
- int doredraw= 0;
- int cfra;
- short mval[2];
- unsigned short event= evt->event;
- short val= evt->val;
- short mousebut = L_MOUSE;
-
- if (curarea->win==0) return;
-
- saction= curarea->spacedata.first;
- if (!saction)
- return;
-
- data= get_action_context(&datatype);
-
- if (val) {
- if ( uiDoBlocks(&curarea->uiblocks, event, 1)!=UI_NOTHING ) event= 0;
-
- /* swap mouse buttons based on user preference */
- if (U.flag & USER_LMOUSESELECT) {
- if (event == LEFTMOUSE) {
- event = RIGHTMOUSE;
- mousebut = L_MOUSE;
- } else if (event == RIGHTMOUSE) {
- event = LEFTMOUSE;
- mousebut = R_MOUSE;
- }
- }
-
- getmouseco_areawin(mval);
-
- switch(event) {
- case UI_BUT_EVENT:
- do_actionbuts(val); // window itself
- break;
-
- case HOMEKEY:
- do_action_buttons(B_ACTHOME); // header
- break;
-
- case AKEY:
- if (mval[0]<NAMEWIDTH) {
- deselect_action_channels (1);
- allqueue (REDRAWVIEW3D, 0);
- allqueue (REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- allqueue (REDRAWIPO, 0);
- }
- else if (mval[0]>ACTWIDTH) {
- if (G.qual == LR_CTRLKEY) {
- deselect_markers (1, 0);
- allqueue(REDRAWTIME, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWSOUND, 0);
- }
- else {
- deselect_action_keys (1, 1);
- allqueue (REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- allqueue (REDRAWIPO, 0);
- }
- }
- break;
-
- case BKEY:
- if (G.qual & LR_CTRLKEY) {
- borderselect_markers();
- }
- else {
- if (mval[0]>ACTWIDTH)
- borderselect_action();
- }
- break;
-
- case CKEY:
- /* scroll the window so the current
- * frame is in the center.
- */
- center_currframe();
- break;
-
- case DKEY:
- if (mval[0]>ACTWIDTH) {
- if (G.qual == (LR_CTRLKEY|LR_SHIFTKEY))
- duplicate_marker();
- else if (G.qual == LR_SHIFTKEY)
- duplicate_action_keys();
- }
- break;
-
- case EKEY:
- if (mval[0] >= ACTWIDTH)
- transform_action_keys('e', 0);
- break;
-
- case GKEY:
- if (G.qual & LR_CTRLKEY) {
- transform_markers('g', 0);
- }
- else {
- if (mval[0]>=ACTWIDTH)
- transform_action_keys('g', 0);
- }
- break;
-
- case HKEY:
- if (G.qual & LR_SHIFTKEY) {
- if (okee("Set Keys to Auto Handle"))
- sethandles_action_keys(HD_AUTO);
- }
- else {
- if (okee("Toggle Keys Aligned Handle"))
- sethandles_action_keys(HD_ALIGN);
- }
- break;
-
- case KKEY:
- if (G.qual & LR_CTRLKEY) {
- markers_selectkeys_between();
- }
- else {
- val= (G.qual & LR_SHIFTKEY) ? 2 : 1;
- column_select_action_keys(val);
- }
-
- allqueue(REDRAWMARKER, 0);
- break;
-
- case MKEY:
- if (G.qual & LR_SHIFTKEY) {
- /* mirror keyframes */
- if (data) {
- if (G.saction->flag & SACTION_DRAWTIME)
- val = pupmenu("Mirror Keys Over%t|Current Time%x1|Vertical Axis%x2|Horizontal Axis %x3|Selected Marker %x4");
- else
- val = pupmenu("Mirror Keys Over%t|Current Frame%x1|Vertical Axis%x2|Horizontal Axis %x3|Selected Marker %x4");
-
- mirror_action_keys(val);
- }
- }
- else {
- /* marker operations */
- if (G.qual == 0)
- add_marker(CFRA);
- else if (G.qual == LR_CTRLKEY)
- rename_marker();
- else
- break;
- allqueue(REDRAWMARKER, 0);
- }
- break;
-
- case NKEY:
- if(G.qual==0) {
- numbuts_action();
-
- /* no panel (yet). current numbuts are not easy to put in panel... */
- //add_blockhandler(curarea, ACTION_HANDLER_PROPERTIES, UI_PNL_TO_MOUSE);
- //scrarea_queue_winredraw(curarea);
- }
- break;
-
- case OKEY:
- clean_action();
- break;
-
- case PKEY:
- if (G.qual & LR_CTRLKEY) /* set preview range */
- anim_previewrange_set();
- else if (G.qual & LR_ALTKEY) /* clear preview range */
- anim_previewrange_clear();
-
- allqueue(REDRAWMARKER, 0);
- allqueue(REDRAWBUTSALL, 0);
- break;
-
- case SKEY:
- if (mval[0]>=ACTWIDTH) {
- if (G.qual == (LR_SHIFTKEY|LR_CTRLKEY)) {
- if (data) {
- snap_cfra_action();
- }
- }
- else if (G.qual & LR_SHIFTKEY) {
- if (data) {
- if (G.saction->flag & SACTION_DRAWTIME)
- val = pupmenu("Snap Keys To%t|Nearest Second%x4|Current Time%x2|Nearest Marker %x3");
- else
- val = pupmenu("Snap Keys To%t|Nearest Frame%x1|Current Frame%x2|Nearest Marker %x3");
-
- snap_action_keys(val);
- }
- }
- else {
- transform_action_keys('s', 0);
- }
- }
- break;
-
- case TKEY:
- if (G.qual & LR_SHIFTKEY)
- action_set_ipo_flags(SET_IPO_POPUP, 0);
- else if (G.qual & LR_CTRLKEY) {
- val= pupmenu("Time value%t|Frames %x1|Seconds%x2");
-
- if (val > 0) {
- if (val == 2) saction->flag |= SACTION_DRAWTIME;
- else saction->flag &= ~SACTION_DRAWTIME;
-
- doredraw= 1;
- }
- }
- else
- transform_action_keys ('t', 0);
- break;
-
- case VKEY:
- if (okee("Set Keys to Vector Handle"))
- sethandles_action_keys(HD_VECT);
- break;
-
- case PAGEUPKEY:
- if (datatype == ACTCONT_ACTION) {
- if(G.qual & LR_SHIFTKEY)
- top_sel_action();
- else if (G.qual & LR_CTRLKEY)
- up_sel_action();
- else
- nextprev_marker(1);
- }
- else if (datatype == ACTCONT_SHAPEKEY) {
- /* only jump to markers possible (key channels can't be moved yet) */
- nextprev_marker(1);
- }
- break;
- case PAGEDOWNKEY:
- if (datatype == ACTCONT_ACTION) {
- if(G.qual & LR_SHIFTKEY)
- bottom_sel_action();
- else if (G.qual & LR_CTRLKEY)
- down_sel_action();
- else
- nextprev_marker(-1);
- }
- else if (datatype == ACTCONT_SHAPEKEY) {
- /* only jump to markers possible (key channels can't be moved yet) */
- nextprev_marker(-1);
- }
- break;
-
- case DELKEY:
- case XKEY:
- if (okee("Erase selected")) {
- if (mval[0]<NAMEWIDTH)
- delete_action_channels();
- else
- delete_action_keys();
-
- if (mval[0] >= NAMEWIDTH)
- remove_marker();
-
- allqueue(REDRAWTIME, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWSOUND, 0);
- }
- break;
-
- /* LEFTMOUSE and RIGHTMOUSE event codes can be swapped above,
- * based on user preference USER_LMOUSESELECT
- */
- case LEFTMOUSE:
- if (view2dmove(LEFTMOUSE)) /* only checks for sliders */
- break;
- else if ((G.v2d->mask.xmin==0) || (mval[0]>ACTWIDTH)) {
- /* moving time-marker / current frame */
- do {
- getmouseco_areawin(mval);
- areamouseco_to_ipoco(G.v2d, mval, &dx, &dy);
-
- cfra= (int)dx;
- if (cfra < 1) cfra= 1;
-
- if (cfra != CFRA) {
- CFRA= cfra;
- update_for_newframe();
- force_draw_all(0);
- }
- else PIL_sleep_ms(30);
-
- } while(get_mbut() & mousebut);
- break;
- }
- /* passed on as selection */
- case RIGHTMOUSE:
- /* Clicking in the channel area */
- if ((G.v2d->mask.xmin) && (mval[0]<NAMEWIDTH)) {
- if (datatype == ACTCONT_ACTION) {
- /* mouse is over action channels */
- if (G.qual & LR_CTRLKEY)
- numbuts_action();
- else
- mouse_actionchannels(mval);
- }
- else numbuts_action();
- }
- else {
- short select_mode= (G.qual & LR_SHIFTKEY)? SELECT_INVERT: SELECT_REPLACE;
-
- /* Clicking in the vertical scrollbar selects
- * all of the keys for that channel at that height
- */
- if (IN_2D_VERT_SCROLL(mval))
- selectall_action_keys(mval, 0, select_mode);
-
- /* Clicking in the horizontal scrollbar selects
- * all of the keys within 0.5 of the nearest integer
- * frame
- */
- else if (IN_2D_HORIZ_SCROLL(mval))
- selectall_action_keys(mval, 1, select_mode);
-
- /* Clicking in the main area of the action window
- * selects keys and markers
- */
- else if (G.qual & LR_ALTKEY) {
- areamouseco_to_ipoco(G.v2d, mval, &dx, &dy);
-
- /* sends a 1 for left and 0 for right */
- selectkeys_leftright((dx < (float)CFRA), select_mode);
- }
- else
- mouse_action(select_mode);
- }
- break;
- case PADPLUSKEY:
- view2d_zoom(G.v2d, 0.1154, sa->winx, sa->winy);
- test_view2d(G.v2d, sa->winx, sa->winy);
- view2d_do_locks(curarea, V2D_LOCK_COPY);
-
- doredraw= 1;
- break;
- case PADMINUS:
- view2d_zoom(G.v2d, -0.15, sa->winx, sa->winy);
- test_view2d(G.v2d, sa->winx, sa->winy);
- view2d_do_locks(curarea, V2D_LOCK_COPY);
-
- doredraw= 1;
- break;
- case MIDDLEMOUSE:
- case WHEELUPMOUSE:
- case WHEELDOWNMOUSE:
- view2dmove(event); /* in drawipo.c */
- break;
- }
- }
-
- if(doredraw) addqueue(curarea->win, REDRAW, 1);
-
-}
-
-/* **************************************************** */
diff --git a/source/blender/src/editarmature.c b/source/blender/src/editarmature.c
deleted file mode 100644
index 8efa44213ed..00000000000
--- a/source/blender/src/editarmature.c
+++ /dev/null
@@ -1,4770 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * editarmature.c: Interface for creating and posing armature objects
- */
-
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "BMF_Api.h"
-
-#include "DNA_action_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_ID.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_nla_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_modifier_types.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_editVert.h"
-#include "BLI_ghash.h"
-
-#include "BKE_action.h"
-#include "BKE_armature.h"
-#include "BKE_constraint.h"
-#include "BKE_deform.h"
-#include "BKE_depsgraph.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_object.h"
-#include "BKE_subsurf.h"
-#include "BKE_utildefines.h"
-#include "BKE_modifier.h"
-
-#include "BIF_editaction.h"
-#include "BIF_editmode_undo.h"
-#include "BIF_editdeform.h"
-#include "BIF_editarmature.h"
-#include "BIF_editconstraint.h"
-#include "BIF_gl.h"
-#include "BIF_graphics.h"
-#include "BIF_interface.h"
-#include "BIF_meshlaplacian.h"
-#include "BIF_meshtools.h"
-#include "BIF_poseobject.h"
-#include "BIF_mywindow.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-#include "BIF_transform.h"
-
-#include "BDR_editobject.h"
-#include "BDR_drawobject.h"
-
-#include "BSE_edit.h"
-#include "BSE_view.h"
-#include "BSE_trans_types.h"
-
-#include "PIL_time.h"
-
-#include "reeb.h" // FIX ME
-
-#include "mydevice.h"
-#include "blendef.h"
-#include "nla.h"
-
-extern float center[3], centroid[3]; /* Originally defined in editobject.c */
-
-/* Macros */
-#define TEST_EDITARMATURE {if(G.obedit==0) return; if( (G.vd->lay & G.obedit->lay)==0 ) return;}
-
-/* prototypes for later */
-static EditBone *editbone_name_exists (ListBase *ebones, char *name); // proto for below
-
-/* **************** tools on Editmode Armature **************** */
-
-/* converts Bones to EditBone list, used for tools as well */
-void make_boneList(ListBase* list, ListBase *bones, EditBone *parent)
-{
- EditBone *eBone;
- Bone *curBone;
- float delta[3];
- float premat[3][3];
- float postmat[3][3];
- float imat[3][3];
- float difmat[3][3];
-
- for (curBone=bones->first; curBone; curBone=curBone->next){
- eBone= MEM_callocN(sizeof(EditBone), "make_editbone");
-
- /* Copy relevant data from bone to eBone */
- eBone->parent=parent;
- BLI_strncpy (eBone->name, curBone->name, 32);
- eBone->flag = curBone->flag;
-
- /* fix selection flags */
- if(eBone->flag & BONE_SELECTED) {
- eBone->flag |= BONE_TIPSEL;
- if(eBone->parent && (eBone->flag & BONE_CONNECTED))
- eBone->parent->flag |= BONE_TIPSEL;
- else
- eBone->flag |= BONE_ROOTSEL;
- }
- else
- eBone->flag &= ~BONE_ROOTSEL;
-
- VECCOPY(eBone->head, curBone->arm_head);
- VECCOPY(eBone->tail, curBone->arm_tail);
-
- eBone->roll= 0.0;
-
- /* roll fixing */
- VecSubf (delta, eBone->tail, eBone->head);
- vec_roll_to_mat3(delta, 0.0, postmat);
-
- Mat3CpyMat4(premat, curBone->arm_mat);
-
- Mat3Inv(imat, postmat);
- Mat3MulMat3(difmat, imat, premat);
-
- eBone->roll = atan2(difmat[2][0], difmat[2][2]);
-
- /* rest of stuff copy */
- eBone->length= curBone->length;
- eBone->dist= curBone->dist;
- eBone->weight= curBone->weight;
- eBone->xwidth= curBone->xwidth;
- eBone->zwidth= curBone->zwidth;
- eBone->ease1= curBone->ease1;
- eBone->ease2= curBone->ease2;
- eBone->rad_head= curBone->rad_head;
- eBone->rad_tail= curBone->rad_tail;
- eBone->segments = curBone->segments;
- eBone->layer = curBone->layer;
-
- BLI_addtail (list, eBone);
-
- /* Add children if necessary */
- if (curBone->childbase.first)
- make_boneList (list, &curBone->childbase, eBone);
- }
-}
-
-/* nasty stuff for converting roll in editbones into bones */
-/* also sets restposition in armature (arm_mat) */
-static void fix_bonelist_roll (ListBase *bonelist, ListBase *editbonelist)
-{
- Bone *curBone;
- EditBone *ebone;
- float premat[3][3];
- float postmat[3][3];
- float difmat[3][3];
- float imat[3][3];
- float delta[3];
-
- for (curBone=bonelist->first; curBone; curBone=curBone->next) {
- /* sets local matrix and arm_mat (restpos) */
- where_is_armature_bone(curBone, curBone->parent);
-
- /* Find the associated editbone */
- for (ebone = editbonelist->first; ebone; ebone=ebone->next)
- if ((Bone*)ebone->temp == curBone)
- break;
-
- if (ebone) {
- /* Get the ebone premat */
- VecSubf (delta, ebone->tail, ebone->head);
- vec_roll_to_mat3(delta, ebone->roll, premat);
-
- /* Get the bone postmat */
- Mat3CpyMat4(postmat, curBone->arm_mat);
-
- Mat3Inv(imat, premat);
- Mat3MulMat3(difmat, imat, postmat);
-#if 0
- printf ("Bone %s\n", curBone->name);
- printmatrix4 ("premat", premat);
- printmatrix4 ("postmat", postmat);
- printmatrix4 ("difmat", difmat);
- printf ("Roll = %f\n", (-atan2(difmat[2][0], difmat[2][2]) * (180.0/M_PI)));
-#endif
- curBone->roll = -atan2(difmat[2][0], difmat[2][2]);
-
- /* and set restposition again */
- where_is_armature_bone(curBone, curBone->parent);
- }
- fix_bonelist_roll (&curBone->childbase, editbonelist);
- }
-}
-
-/* converts the editbones back to the armature */
-void editbones_to_armature (ListBase *list, Object *ob)
-{
- bArmature *arm;
- EditBone *eBone, *neBone;
- Bone *newBone;
- Object *obt;
-
- arm = get_armature(ob);
- if (!list) return;
- if (!arm) return;
-
- /* armature bones */
- free_bones(arm);
-
- /* remove zero sized bones, this gives instable restposes */
- for (eBone=list->first; eBone; eBone= neBone) {
- float len= VecLenf(eBone->head, eBone->tail);
- neBone= eBone->next;
- if(len <= FLT_EPSILON) {
- EditBone *fBone;
-
- /* Find any bones that refer to this bone */
- for (fBone=list->first; fBone; fBone= fBone->next){
- if (fBone->parent==eBone)
- fBone->parent= eBone->parent;
- }
- printf("Warning: removed zero sized bone: %s\n", eBone->name);
- BLI_freelinkN (list, eBone);
- }
- }
-
- /* Copy the bones from the editData into the armature */
- for (eBone=list->first; eBone; eBone=eBone->next){
- newBone= MEM_callocN (sizeof(Bone), "bone");
- eBone->temp= newBone; /* Associate the real Bones with the EditBones */
-
- BLI_strncpy (newBone->name, eBone->name, 32);
- memcpy (newBone->head, eBone->head, sizeof(float)*3);
- memcpy (newBone->tail, eBone->tail, sizeof(float)*3);
- newBone->flag= eBone->flag;
- if(eBone->flag & BONE_ACTIVE) newBone->flag |= BONE_SELECTED; /* important, editbones can be active with only 1 point selected */
- newBone->roll = 0.0f;
-
- newBone->weight = eBone->weight;
- newBone->dist = eBone->dist;
-
- newBone->xwidth = eBone->xwidth;
- newBone->zwidth = eBone->zwidth;
- newBone->ease1= eBone->ease1;
- newBone->ease2= eBone->ease2;
- newBone->rad_head= eBone->rad_head;
- newBone->rad_tail= eBone->rad_tail;
- newBone->segments= eBone->segments;
- newBone->layer = eBone->layer;
-
- }
-
- /* Fix parenting in a separate pass to ensure ebone->bone connections
- are valid at this point */
- for (eBone=list->first;eBone;eBone=eBone->next) {
- newBone= (Bone*) eBone->temp;
- if (eBone->parent){
- newBone->parent=(Bone*) eBone->parent->temp;
- BLI_addtail (&newBone->parent->childbase,newBone);
-
- {
- float M_boneRest[3][3];
- float M_parentRest[3][3];
- float iM_parentRest[3][3];
- float delta[3];
-
- /* Get the parent's matrix (rotation only) */
- VecSubf (delta, eBone->parent->tail, eBone->parent->head);
- vec_roll_to_mat3(delta, eBone->parent->roll, M_parentRest);
-
- /* Get this bone's matrix (rotation only) */
- VecSubf (delta, eBone->tail, eBone->head);
- vec_roll_to_mat3(delta, eBone->roll, M_boneRest);
-
- /* Invert the parent matrix */
- Mat3Inv(iM_parentRest, M_parentRest);
-
- /* Get the new head and tail */
- VecSubf (newBone->head, eBone->head, eBone->parent->tail);
- VecSubf (newBone->tail, eBone->tail, eBone->parent->tail);
-
- Mat3MulVecfl(iM_parentRest, newBone->head);
- Mat3MulVecfl(iM_parentRest, newBone->tail);
- }
- }
- /* ...otherwise add this bone to the armature's bonebase */
- else
- BLI_addtail (&arm->bonebase,newBone);
- }
-
- /* Make a pass through the new armature to fix rolling */
- /* also builds restposition again (like where_is_armature) */
- fix_bonelist_roll (&arm->bonebase, list);
-
- /* so all users of this armature should get rebuilt */
- for (obt= G.main->object.first; obt; obt= obt->id.next) {
- if(obt->data==arm)
- armature_rebuild_pose(obt, arm);
- }
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
-}
-
-
-
-void apply_rot_armature (Object *ob, float mat[3][3])
-{
- ListBase list;
- EditBone *ebone;
- bArmature *arm;
- float scale = Mat3ToScalef(mat); /* store the scale of the matrix here to use on envelopes */
- arm = get_armature(ob);
-
- if (!arm)
- return;
-
- /* Put the armature into editmode */
- list.first= list.last = NULL;
- make_boneList(&list, &arm->bonebase, NULL);
-
- /* Do the rotations */
- for (ebone = list.first; ebone; ebone=ebone->next){
- Mat3MulVecfl(mat, ebone->head);
- Mat3MulVecfl(mat, ebone->tail);
-
- ebone->rad_head *= scale;
- ebone->rad_tail *= scale;
- ebone->dist *= scale;
- }
-
- /* Turn the list into an armature */
- editbones_to_armature(&list, ob);
-
- /* Free the editbones */
- if (list.first){
- BLI_freelistN (&list);
- }
-}
-
-/* 0 == do center, 1 == center new, 2 == center cursor */
-void docenter_armature (Object *ob, int centermode)
-{
- ListBase list;
- EditBone *ebone;
- bArmature *arm;
- float cent[3] = {0.0f, 0.0f, 0.0f};
- float min[3], max[3];
- float omat[3][3];
-
- arm = get_armature(ob);
- if (!arm) return;
-
- /* Put the armature into editmode */
- list.first= list.last = NULL;
- make_boneList(&list, &arm->bonebase, NULL);
-
- /* Find the centerpoint */
- if (centermode == 2) {
- VECCOPY(cent, give_cursor());
- Mat4Invert(ob->imat, ob->obmat);
- Mat4MulVecfl(ob->imat, cent);
- }
- else {
- INIT_MINMAX(min, max);
-
- for (ebone= list.first; ebone; ebone=ebone->next) {
- DO_MINMAX(ebone->head, min, max);
- DO_MINMAX(ebone->tail, min, max);
- }
-
- cent[0]= (min[0]+max[0])/2.0f;
- cent[1]= (min[1]+max[1])/2.0f;
- cent[2]= (min[2]+max[2])/2.0f;
- }
-
- /* Do the adjustments */
- for (ebone= list.first; ebone; ebone=ebone->next){
- VecSubf(ebone->head, ebone->head, cent);
- VecSubf(ebone->tail, ebone->tail, cent);
- }
-
- /* Turn the list into an armature */
- editbones_to_armature(&list, ob);
-
- /* Free the editbones */
- if (list.first){
- BLI_freelistN(&list);
- }
-
- /* Adjust object location for new centerpoint */
- if(centermode && G.obedit==0) {
- Mat3CpyMat4(omat, ob->obmat);
-
- Mat3MulVecfl(omat, cent);
- ob->loc[0]+= cent[0];
- ob->loc[1]+= cent[1];
- ob->loc[2]+= cent[2];
- }
-}
-
-/* Helper function for armature joining - link fixing */
-static void joined_armature_fix_links(Object *tarArm, Object *srcArm, bPoseChannel *pchan, EditBone *curbone)
-{
- Object *ob;
- bPose *pose;
- bPoseChannel *pchant;
- bConstraint *con;
-
- /* let's go through all objects in database */
- for (ob= G.main->object.first; ob; ob= ob->id.next) {
- /* do some object-type specific things */
- if (ob->type == OB_ARMATURE) {
- pose= ob->pose;
- for (pchant= pose->chanbase.first; pchant; pchant= pchant->next) {
- for (con= pchant->constraints.first; con; con= con->next) {
- bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
- ListBase targets = {NULL, NULL};
- bConstraintTarget *ct;
-
- /* constraint targets */
- if (cti && cti->get_constraint_targets) {
- cti->get_constraint_targets(con, &targets);
-
- for (ct= targets.first; ct; ct= ct->next) {
- if (ct->tar == srcArm) {
- if (strcmp(ct->subtarget, "")==0) {
- ct->tar = tarArm;
- }
- else if (strcmp(ct->subtarget, pchan->name)==0) {
- ct->tar = tarArm;
- strcpy(ct->subtarget, curbone->name);
- }
- }
- }
-
- if (cti->flush_constraint_targets)
- cti->flush_constraint_targets(con, &targets, 0);
- }
-
- /* action constraint? */
- if (con->type == CONSTRAINT_TYPE_ACTION) {
- bActionConstraint *data= con->data;
- bAction *act;
- bActionChannel *achan;
-
- if (data->act) {
- act= data->act;
-
- for (achan= act->chanbase.first; achan; achan= achan->next) {
- if (strcmp(achan->name, pchan->name)==0)
- BLI_strncpy(achan->name, curbone->name, 32);
- }
- }
- }
-
- }
- }
- }
-
- /* fix object-level constraints */
- if (ob != srcArm) {
- for (con= ob->constraints.first; con; con= con->next) {
- bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
- ListBase targets = {NULL, NULL};
- bConstraintTarget *ct;
-
- /* constraint targets */
- if (cti && cti->get_constraint_targets) {
- cti->get_constraint_targets(con, &targets);
-
- for (ct= targets.first; ct; ct= ct->next) {
- if (ct->tar == srcArm) {
- if (strcmp(ct->subtarget, "")==0) {
- ct->tar = tarArm;
- }
- else if (strcmp(ct->subtarget, pchan->name)==0) {
- ct->tar = tarArm;
- strcpy(ct->subtarget, curbone->name);
- }
- }
- }
-
- if (cti->flush_constraint_targets)
- cti->flush_constraint_targets(con, &targets, 0);
- }
- }
- }
-
- /* See if an object is parented to this armature */
- if (ob->parent && (ob->parent == srcArm)) {
- /* Is object parented to a bone of this src armature? */
- if (ob->partype==PARBONE) {
- /* bone name in object */
- if (!strcmp(ob->parsubstr, pchan->name))
- BLI_strncpy(ob->parsubstr, curbone->name, 32);
- }
-
- /* make tar armature be new parent */
- ob->parent = tarArm;
- }
- }
-}
-
-int join_armature(void)
-{
- Object *ob;
- bArmature *arm;
- Base *base, *nextbase;
- bPose *pose, *opose;
- bPoseChannel *pchan, *pchann;
- ListBase ebbase, eblist;
- EditBone *curbone;
- float mat[4][4], imat[4][4];
-
- /* Ensure we're not in editmode and that the active object is an armature*/
- /* if(G.obedit) return; */ /* Alredy checked in join_menu() */
-
- ob= OBACT;
- if(ob->type!=OB_ARMATURE) return 0;
- if (object_data_is_libdata(ob)) {
- error_libdata();
- return 0;
- }
- arm= get_armature(ob);
-
- /* Get editbones of active armature to add editbones to */
- ebbase.first=ebbase.last= NULL;
- make_boneList(&ebbase, &arm->bonebase, NULL);
- pose= ob->pose;
-
- for (base=FIRSTBASE; base; base=nextbase) {
- nextbase = base->next;
- if (TESTBASE(base)){
- if ((base->object->type==OB_ARMATURE) && (base->object!=ob)){
- /* Make a list of editbones in current armature */
- eblist.first=eblist.last= NULL;
- make_boneList (&eblist, &((bArmature*)base->object->data)->bonebase,NULL);
-
- /* Get Pose of current armature */
- opose= base->object->pose;
-
- /* Find the difference matrix */
- Mat4Invert(imat, ob->obmat);
- Mat4MulMat4(mat, base->object->obmat, imat);
-
- /* Copy bones and posechannels from the object to the edit armature */
- for (pchan=opose->chanbase.first; pchan; pchan=pchann) {
- pchann= pchan->next;
- curbone= editbone_name_exists(&eblist, pchan->name);
-
- /* Get new name */
- unique_editbone_name (&ebbase, curbone->name);
-
- /* Transform the bone */
- {
- float premat[4][4];
- float postmat[4][4];
- float difmat[4][4];
- float imat[4][4];
- float temp[3][3];
- float delta[3];
-
- /* Get the premat */
- VecSubf (delta, curbone->tail, curbone->head);
- vec_roll_to_mat3(delta, curbone->roll, temp);
-
- Mat4MulMat34 (premat, temp, mat);
-
- Mat4MulVecfl(mat, curbone->head);
- Mat4MulVecfl(mat, curbone->tail);
-
- /* Get the postmat */
- VecSubf (delta, curbone->tail, curbone->head);
- vec_roll_to_mat3(delta, curbone->roll, temp);
- Mat4CpyMat3(postmat, temp);
-
- /* Find the roll */
- Mat4Invert (imat, premat);
- Mat4MulMat4 (difmat, postmat, imat);
-
- curbone->roll -= atan2(difmat[2][0], difmat[2][2]);
-
- }
-
- /* Fix Constraints and Other Links to this Bone and Armature */
- joined_armature_fix_links(ob, base->object, pchan, curbone);
-
- /* Rename pchan */
- sprintf(pchan->name, curbone->name);
-
- /* Jump Ship! */
- BLI_remlink(&eblist, curbone);
- BLI_addtail(&ebbase, curbone);
-
- BLI_remlink(&opose->chanbase, pchan);
- BLI_addtail(&pose->chanbase, pchan);
- }
-
- free_and_unlink_base(base);
- }
- }
- }
-
- DAG_scene_sort(G.scene); // because we removed object(s)
-
- editbones_to_armature(&ebbase, ob);
- if (ebbase.first) BLI_freelistN(&ebbase);
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWOOPS, 0);
- return 1;
-}
-
-/* **************** END tools on Editmode Armature **************** */
-/* **************** PoseMode & EditMode *************************** */
-
-/* only for opengl selection indices */
-Bone *get_indexed_bone (Object *ob, int index)
-{
- bPoseChannel *pchan;
- int a= 0;
-
- if(ob->pose==NULL) return NULL;
- index>>=16; // bone selection codes use left 2 bytes
-
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next, a++) {
- if(a==index) return pchan->bone;
- }
- return NULL;
-}
-
-/* See if there are any selected bones in this buffer */
-static void *get_bone_from_selectbuffer(Base *base, unsigned int *buffer, short hits, short findunsel)
-{
- Object *ob= base->object;
- Bone *bone;
- EditBone *ebone;
- void *firstunSel=NULL, *firstSel=NULL, *data;
- unsigned int hitresult;
- short i, takeNext=0, sel;
-
- for (i=0; i< hits; i++){
- hitresult = buffer[3+(i*4)];
-
- if (!(hitresult & BONESEL_NOSEL)) { // -1
- if(hitresult & BONESEL_ANY) { // to avoid including objects in selection
-
- hitresult &= ~(BONESEL_ANY);
- /* Determine what the current bone is */
- if (G.obedit==NULL || base->object!=G.obedit) {
- /* no singular posemode, so check for correct object */
- if(base->selcol == (hitresult & 0xFFFF)) {
- bone = get_indexed_bone(ob, hitresult);
-
- if (findunsel)
- sel = (bone->flag & BONE_SELECTED);
- else
- sel = !(bone->flag & BONE_SELECTED);
-
- data = bone;
- }
- else {
- data= NULL;
- sel= 0;
- }
- }
- else{
- ebone = BLI_findlink(&G.edbo, hitresult);
- if (findunsel)
- sel = (ebone->flag & BONE_SELECTED);
- else
- sel = !(ebone->flag & BONE_SELECTED);
-
- data = ebone;
- }
-
- if(data) {
- if (sel) {
- if(!firstSel) firstSel= data;
- takeNext=1;
- }
- else {
- if (!firstunSel)
- firstunSel=data;
- if (takeNext)
- return data;
- }
- }
- }
- }
- }
-
- if (firstunSel)
- return firstunSel;
- else
- return firstSel;
-}
-
-/* used by posemode as well editmode */
-static void *get_nearest_bone (short findunsel)
-{
- unsigned int buffer[MAXPICKBUF];
- short hits;
-
- persp(PERSP_VIEW);
-
- glInitNames();
- hits= view3d_opengl_select(buffer, MAXPICKBUF, 0, 0, 0, 0);
-
- if (hits>0)
- return get_bone_from_selectbuffer(BASACT, buffer, hits, findunsel);
-
- return NULL;
-}
-
-/* used by posemode and editmode */
-void select_bone_parent (void)
-{
- Object *ob;
- bArmature *arm;
-
- /* get data */
- if (G.obedit)
- ob= G.obedit;
- else if (OBACT)
- ob= OBACT;
- else
- return;
- arm= (bArmature *)ob->data;
-
- /* determine which mode armature is in */
- if ((!G.obedit) && (ob->flag & OB_POSEMODE)) {
- /* deal with pose channels */
- /* channels are sorted on dependency, so the loop below won't result in a flood-select */
- bPoseChannel *pchan=NULL;
-
- for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- /* check if bone in original selection */
- if (pchan->bone->flag & BONE_SELECTED) {
- bPoseChannel *chanpar= pchan->parent;
-
- /* check if any parent */
- if ((chanpar) && ((chanpar->bone->flag & BONE_SELECTED)==0)) {
- chanpar->bone->flag |= BONE_SELECTED;
- select_actionchannel_by_name (ob->action, pchan->name, 1);
- }
- }
- }
- }
- else if (G.obedit) {
- /* deal with editbones */
- EditBone *curbone, *parbone, *parpar;
-
- /* prevent floods */
- for (curbone= G.edbo.first; curbone; curbone= curbone->next)
- curbone->temp= NULL;
-
- for (curbone= G.edbo.first; curbone; curbone= curbone->next) {
- /* check if bone selected */
- if ((curbone->flag & BONE_SELECTED) && curbone->temp==NULL) {
- parbone= curbone->parent;
-
- /* check if any parent */
- if ((parbone) && ((parbone->flag & BONE_SELECTED)==0)) {
- /* select the parent bone */
- parbone->flag |= (BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
-
- /* check if parent has parent */
- parpar= parbone->parent;
-
- if ((parpar) && (parbone->flag & BONE_CONNECTED)) {
- parpar->flag |= BONE_TIPSEL;
- }
- /* tag this bone to not flood selection */
- parbone->temp= parbone;
- }
- }
- }
-
- /* to be sure... */
- for (curbone= G.edbo.first; curbone; curbone= curbone->next)
- curbone->temp= NULL;
-
- }
-
- /* undo + redraw pushes */
- countall(); // flushes selection!
-
- allqueue (REDRAWVIEW3D, 0);
- allqueue (REDRAWBUTSEDIT, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWOOPS, 0);
-
- BIF_undo_push("Select Parent");
-}
-
-
-/* **************** END PoseMode & EditMode *************************** */
-/* **************** Posemode stuff ********************** */
-
-
-static void selectconnected_posebonechildren (Object *ob, Bone *bone)
-{
- Bone *curBone;
-
- if (!(bone->flag & BONE_CONNECTED))
- return;
-
- select_actionchannel_by_name (ob->action, bone->name, !(G.qual & LR_SHIFTKEY));
-
- if (G.qual & LR_SHIFTKEY)
- bone->flag &= ~BONE_SELECTED;
- else
- bone->flag |= BONE_SELECTED;
-
- for (curBone=bone->childbase.first; curBone; curBone=curBone->next){
- selectconnected_posebonechildren (ob, curBone);
- }
-}
-
-/* within active object context */
-void selectconnected_posearmature(void)
-{
- Bone *bone, *curBone, *next;
- Object *ob= OBACT;
-
- if(!ob || !ob->pose) return;
-
- if (G.qual & LR_SHIFTKEY)
- bone= get_nearest_bone(0);
- else
- bone = get_nearest_bone(1);
-
- if (!bone)
- return;
-
- /* Select parents */
- for (curBone=bone; curBone; curBone=next){
- select_actionchannel_by_name (ob->action, curBone->name, !(G.qual & LR_SHIFTKEY));
- if (G.qual & LR_SHIFTKEY)
- curBone->flag &= ~BONE_SELECTED;
- else
- curBone->flag |= BONE_SELECTED;
-
- if (curBone->flag & BONE_CONNECTED)
- next=curBone->parent;
- else
- next=NULL;
- }
-
- /* Select children */
- for (curBone=bone->childbase.first; curBone; curBone=next){
- selectconnected_posebonechildren (ob, curBone);
- }
-
- countall(); // flushes selection!
-
- allqueue (REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue (REDRAWACTION, 0);
- allqueue(REDRAWOOPS, 0);
- BIF_undo_push("Select connected");
-
-}
-
-/* **************** END Posemode stuff ********************** */
-/* **************** EditMode stuff ********************** */
-
-/* called in space.c */
-void selectconnected_armature(void)
-{
- EditBone *bone, *curBone, *next;
-
- if (G.qual & LR_SHIFTKEY)
- bone= get_nearest_bone(0);
- else
- bone= get_nearest_bone(1);
-
- if (!bone)
- return;
-
- /* Select parents */
- for (curBone=bone; curBone; curBone=next){
- if (G.qual & LR_SHIFTKEY){
- curBone->flag &= ~(BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
- }
- else{
- curBone->flag |= (BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
- }
-
- if (curBone->flag & BONE_CONNECTED)
- next=curBone->parent;
- else
- next=NULL;
- }
-
- /* Select children */
- while (bone){
- for (curBone=G.edbo.first; curBone; curBone=next){
- next = curBone->next;
- if (curBone->parent == bone){
- if (curBone->flag & BONE_CONNECTED){
- if (G.qual & LR_SHIFTKEY)
- curBone->flag &= ~(BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
- else
- curBone->flag |= (BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
- bone=curBone;
- break;
- }
- else{
- bone=NULL;
- break;
- }
- }
- }
- if (!curBone)
- bone=NULL;
-
- }
-
- countall(); // flushes selection!
-
- allqueue (REDRAWVIEW3D, 0);
- allqueue (REDRAWBUTSEDIT, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWOOPS, 0);
-
- BIF_undo_push("Select connected");
-
-}
-
-/* does bones and points */
-/* note that BONE ROOT only gets drawn for root bones (or without IK) */
-static EditBone * get_nearest_editbonepoint (int findunsel, int *selmask)
-{
- EditBone *ebone;
- unsigned int buffer[MAXPICKBUF];
- unsigned int hitresult, besthitresult=BONESEL_NOSEL;
- int i, mindep= 4;
- short hits, mval[2];
-
- persp(PERSP_VIEW);
-
- glInitNames();
-
- getmouseco_areawin(mval);
- hits= view3d_opengl_select(buffer, MAXPICKBUF, mval[0]-5, mval[1]-5, mval[0]+5, mval[1]+5);
- if(hits==0)
- hits= view3d_opengl_select(buffer, MAXPICKBUF, mval[0]-12, mval[1]-12, mval[0]+12, mval[1]+12);
-
- /* See if there are any selected bones in this group */
- if (hits>0) {
-
- if(hits==1) {
- if (!(buffer[3] & BONESEL_NOSEL))
- besthitresult= buffer[3];
- }
- else {
- for (i=0; i< hits; i++) {
- hitresult= buffer[3+(i*4)];
- if (!(hitresult & BONESEL_NOSEL)) {
- int dep;
-
- ebone = BLI_findlink(&G.edbo, hitresult & ~BONESEL_ANY);
-
- /* clicks on bone points get advantage */
- if( hitresult & (BONESEL_ROOT|BONESEL_TIP)) {
- /* but also the unselected one */
- if(findunsel) {
- if( (hitresult & BONESEL_ROOT) && (ebone->flag & BONE_ROOTSEL)==0)
- dep= 1;
- else if( (hitresult & BONESEL_TIP) && (ebone->flag & BONE_TIPSEL)==0)
- dep= 1;
- else
- dep= 2;
- }
- else dep= 2;
- }
- else {
- /* bone found */
- if(findunsel) {
- if((ebone->flag & BONE_SELECTED)==0)
- dep= 2;
- else
- dep= 3;
- }
- else dep= 3;
- }
- if(dep < mindep) {
- mindep= dep;
- besthitresult= hitresult;
- }
- }
- }
- }
-
- if (!(besthitresult & BONESEL_NOSEL)) {
-
- ebone= BLI_findlink(&G.edbo, besthitresult & ~BONESEL_ANY);
-
- *selmask = 0;
- if (besthitresult & BONESEL_ROOT)
- *selmask |= BONE_ROOTSEL;
- if (besthitresult & BONESEL_TIP)
- *selmask |= BONE_TIPSEL;
- if (besthitresult & BONESEL_BONE)
- *selmask |= BONE_SELECTED;
- return ebone;
- }
- }
- *selmask = 0;
- return NULL;
-}
-
-static void delete_bone(EditBone* exBone)
-{
- EditBone *curBone;
-
- /* Find any bones that refer to this bone */
- for (curBone=G.edbo.first;curBone;curBone=curBone->next){
- if (curBone->parent==exBone){
- curBone->parent=exBone->parent;
- curBone->flag &= ~BONE_CONNECTED;
- }
- }
-
- BLI_freelinkN (&G.edbo,exBone);
-}
-
-/* only editmode! */
-void delete_armature(void)
-{
- bArmature *arm= G.obedit->data;
- EditBone *curBone, *next;
- bConstraint *con;
-
- TEST_EDITARMATURE;
- if (okee("Erase selected bone(s)")==0) return;
-
- /* Select mirrored bones */
- if (arm->flag & ARM_MIRROR_EDIT) {
- for (curBone=G.edbo.first; curBone; curBone=curBone->next) {
- if (arm->layer & curBone->layer) {
- if (curBone->flag & BONE_SELECTED) {
- next = armature_bone_get_mirrored(curBone);
- if (next)
- next->flag |= BONE_SELECTED;
- }
- }
- }
- }
-
- /* First erase any associated pose channel */
- if (G.obedit->pose) {
- bPoseChannel *chan, *next;
- for (chan=G.obedit->pose->chanbase.first; chan; chan=next) {
- next= chan->next;
- curBone = editbone_name_exists (&G.edbo, chan->name);
-
- if (curBone && (curBone->flag & BONE_SELECTED) && (arm->layer & curBone->layer)) {
- free_constraints(&chan->constraints);
- BLI_freelinkN (&G.obedit->pose->chanbase, chan);
- }
- else {
- for (con= chan->constraints.first; con; con= con->next) {
- bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
- ListBase targets = {NULL, NULL};
- bConstraintTarget *ct;
-
- if (cti && cti->get_constraint_targets) {
- cti->get_constraint_targets(con, &targets);
-
- for (ct= targets.first; ct; ct= ct->next) {
- if (ct->tar == G.obedit) {
- if (ct->subtarget[0]) {
- curBone = editbone_name_exists(&G.edbo, ct->subtarget);
- if (curBone && (curBone->flag & BONE_SELECTED) && (arm->layer & curBone->layer)) {
- con->flag |= CONSTRAINT_DISABLE;
- ct->subtarget[0]= 0;
- }
- }
- }
- }
-
- if (cti->flush_constraint_targets)
- cti->flush_constraint_targets(con, &targets, 0);
- }
- }
- }
- }
- }
-
-
- for (curBone=G.edbo.first;curBone;curBone=next) {
- next=curBone->next;
- if (arm->layer & curBone->layer)
- if (curBone->flag & BONE_SELECTED)
- delete_bone(curBone);
- }
-
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWOOPS, 0);
- countall(); // flushes selection!
-
- BIF_undo_push("Delete bone(s)");
-}
-
-/* context: editmode armature */
-void mouse_armature(void)
-{
- EditBone *nearBone = NULL, *ebone;
- int selmask;
-
- nearBone= get_nearest_editbonepoint(1, &selmask);
- if (nearBone) {
-
- if (!(G.qual & LR_SHIFTKEY)) {
- deselectall_armature(0, 0);
- }
-
- /* by definition the non-root connected bones have no root point drawn,
- so a root selection needs to be delivered to the parent tip,
- countall() (bad location) flushes these flags */
-
- if(selmask & BONE_SELECTED) {
- if(nearBone->parent && (nearBone->flag & BONE_CONNECTED)) {
- /* click in a chain */
- if(G.qual & LR_SHIFTKEY) {
- /* hold shift inverts this bone's selection */
- if(nearBone->flag & BONE_SELECTED) {
- /* deselect this bone */
- nearBone->flag &= ~(BONE_TIPSEL|BONE_SELECTED);
- /* only deselect parent tip if it is not selected */
- if(!(nearBone->parent->flag & BONE_SELECTED))
- nearBone->parent->flag &= ~BONE_TIPSEL;
- }
- else {
- /* select this bone */
- nearBone->flag |= BONE_TIPSEL;
- nearBone->parent->flag |= BONE_TIPSEL;
- }
- }
- else {
- /* select this bone */
- nearBone->flag |= BONE_TIPSEL;
- nearBone->parent->flag |= BONE_TIPSEL;
- }
- }
- else {
- if(G.qual & LR_SHIFTKEY) {
- /* hold shift inverts this bone's selection */
- if(nearBone->flag & BONE_SELECTED)
- nearBone->flag &= ~(BONE_TIPSEL|BONE_ROOTSEL);
- else
- nearBone->flag |= (BONE_TIPSEL|BONE_ROOTSEL);
- }
- else nearBone->flag |= (BONE_TIPSEL|BONE_ROOTSEL);
- }
- }
- else {
- if ((G.qual & LR_SHIFTKEY) && (nearBone->flag & selmask))
- nearBone->flag &= ~selmask;
- else
- nearBone->flag |= selmask;
- }
-
- countall(); // flushes selection!
-
- if(nearBone) {
- /* then now check for active status */
- for (ebone=G.edbo.first;ebone;ebone=ebone->next) ebone->flag &= ~BONE_ACTIVE;
- if(nearBone->flag & BONE_SELECTED) nearBone->flag |= BONE_ACTIVE;
- }
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWOOPS, 0);
- }
-
- rightmouse_transform();
-}
-
-void free_editArmature(void)
-{
-
- /* Clear the editbones list */
- if (G.edbo.first){
- BLI_freelistN (&G.edbo);
- }
-}
-
-void remake_editArmature(void)
-{
- if(okee("Reload original data")==0) return;
-
- make_editArmature();
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWBUTSHEAD, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
-
-// BIF_undo_push("Delete bone");
-
-}
-
-/* Put object in EditMode */
-void make_editArmature(void)
-{
- bArmature *arm;
-
- if (G.obedit==0) return;
-
- free_editArmature();
-
- arm= get_armature(G.obedit);
- if (!arm)
- return;
-
- make_boneList (&G.edbo, &arm->bonebase,NULL);
-}
-
-/* put EditMode back in Object */
-void load_editArmature(void)
-{
- bArmature *arm;
-
- arm= get_armature(G.obedit);
- if (!arm) return;
-
- editbones_to_armature(&G.edbo, G.obedit);
-}
-
-/* toggle==0: deselect
- toggle==1: swap
- toggle==2: only active tag
-*/
-void deselectall_armature(int toggle, int doundo)
-{
- bArmature *arm= G.obedit->data;
- EditBone *eBone;
- int sel=1;
-
- if(toggle==1) {
- /* Determine if there are any selected bones
- And therefore whether we are selecting or deselecting */
- for (eBone=G.edbo.first;eBone;eBone=eBone->next){
-// if(arm->layer & eBone->layer) {
- if (eBone->flag & (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL)){
- sel=0;
- break;
- }
-// }
- }
- }
- else sel= toggle;
-
- /* Set the flags */
- for (eBone=G.edbo.first;eBone;eBone=eBone->next){
- if (sel==1) {
- if(arm->layer & eBone->layer && (eBone->flag & BONE_HIDDEN_A)==0) {
- eBone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
- if(eBone->parent)
- eBone->parent->flag |= (BONE_TIPSEL);
- }
- }
- else if (sel==2)
- eBone->flag &= ~(BONE_ACTIVE);
- else
- eBone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL | BONE_ACTIVE);
- }
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWOOPS, 0);
-
- countall(); // flushes selection!
- if (doundo) {
- if (sel==1) BIF_undo_push("Select All");
- else BIF_undo_push("Deselect All");
- }
-}
-
-/* Sets the roll value of selected bones, depending on the mode
- * mode == 0: their z-axes point upwards
- * mode == 1: their z-axes point towards 3d-cursor
- */
-void auto_align_armature(short mode)
-{
- bArmature *arm= G.obedit->data;
- EditBone *ebone;
- EditBone *flipbone = NULL;
- float delta[3];
- float curmat[3][3];
- float *cursor= give_cursor();
-
- for (ebone = G.edbo.first; ebone; ebone=ebone->next) {
- if (arm->layer & ebone->layer) {
- if (arm->flag & ARM_MIRROR_EDIT)
- flipbone = armature_bone_get_mirrored(ebone);
-
- if ((ebone->flag & BONE_SELECTED) ||
- (flipbone && flipbone->flag & BONE_SELECTED))
- {
- /* specific method used to calculate roll depends on mode */
- if (mode == 1) {
- /* Z-Axis point towards cursor */
- float mat[4][4], tmat[4][4], imat[4][4];
- float rmat[4][4], rot[3];
- float vec[3];
-
- /* find the current bone matrix as a 4x4 matrix (in Armature Space) */
- VecSubf(delta, ebone->tail, ebone->head);
- vec_roll_to_mat3(delta, ebone->roll, curmat);
- Mat4CpyMat3(mat, curmat);
- VECCOPY(mat[3], ebone->head);
-
- /* multiply bone-matrix by object matrix (so that bone-matrix is in WorldSpace) */
- Mat4MulMat4(tmat, mat, G.obedit->obmat);
- Mat4Invert(imat, tmat);
-
- /* find position of cursor relative to bone */
- VecMat4MulVecfl(vec, imat, cursor);
-
- /* check that cursor is in usable position */
- if ((IS_EQ(vec[0], 0)==0) && (IS_EQ(vec[2], 0)==0)) {
- /* Compute a rotation matrix around y */
- rot[1] = atan2(vec[0], vec[2]);
- rot[0] = rot[2] = 0.0f;
- EulToMat4(rot, rmat);
-
- /* Multiply the bone matrix by rotation matrix. This should be new bone-matrix */
- Mat4MulMat4(tmat, rmat, mat);
- Mat3CpyMat4(curmat, tmat);
-
- /* Now convert from new bone-matrix, back to a roll value (in radians) */
- mat3_to_vec_roll(curmat, delta, &ebone->roll);
- }
- }
- else {
- /* Z-Axis Point Up */
- float xaxis[3]={1.0, 0.0, 0.0}, yaxis[3], zaxis[3]={0.0, 0.0, 1.0};
- float targetmat[3][3], imat[3][3], diffmat[3][3];
-
- /* Find the current bone matrix */
- VecSubf(delta, ebone->tail, ebone->head);
- vec_roll_to_mat3(delta, 0.0, curmat);
-
- /* Make new matrix based on y axis & z-up */
- VECCOPY (yaxis, curmat[1]);
-
- Mat3One(targetmat);
- VECCOPY (targetmat[0], xaxis);
- VECCOPY (targetmat[1], yaxis);
- VECCOPY (targetmat[2], zaxis);
- Mat3Ortho(targetmat);
-
- /* Find the difference between the two matrices */
- Mat3Inv(imat, targetmat);
- Mat3MulMat3(diffmat, imat, curmat);
-
- ebone->roll = atan2(diffmat[2][0], diffmat[2][2]);
- }
- }
- }
- }
-}
-
-/* **************** undo for armatures ************** */
-
-static void undoBones_to_editBones(void *lbv)
-{
- ListBase *lb= lbv;
- EditBone *ebo, *newebo;
-
- BLI_freelistN(&G.edbo);
-
- /* copy */
- for(ebo= lb->first; ebo; ebo= ebo->next) {
- newebo= MEM_dupallocN(ebo);
- ebo->temp= newebo;
- BLI_addtail(&G.edbo, newebo);
- }
-
- /* set pointers */
- for(newebo= G.edbo.first; newebo; newebo= newebo->next) {
- if(newebo->parent) newebo->parent= newebo->parent->temp;
- }
- /* be sure they dont hang ever */
- for(newebo= G.edbo.first; newebo; newebo= newebo->next) {
- newebo->temp= NULL;
- }
-}
-
-static void *editBones_to_undoBones(void)
-{
- ListBase *lb;
- EditBone *ebo, *newebo;
-
- lb= MEM_callocN(sizeof(ListBase), "listbase undo");
-
- /* copy */
- for(ebo= G.edbo.first; ebo; ebo= ebo->next) {
- newebo= MEM_dupallocN(ebo);
- ebo->temp= newebo;
- BLI_addtail(lb, newebo);
- }
-
- /* set pointers */
- for(newebo= lb->first; newebo; newebo= newebo->next) {
- if(newebo->parent) newebo->parent= newebo->parent->temp;
- }
-
- return lb;
-}
-
-static void free_undoBones(void *lbv)
-{
- ListBase *lb= lbv;
-
- BLI_freelistN(lb);
- MEM_freeN(lb);
-}
-
-/* and this is all the undo system needs to know */
-void undo_push_armature(char *name)
-{
- undo_editmode_push(name, free_undoBones, undoBones_to_editBones, editBones_to_undoBones);
-}
-
-
-
-/* **************** END EditMode stuff ********************** */
-/* *************** Adding stuff in editmode *************** */
-
-/* default bone add, returns it selected, but without tail set */
-static EditBone *add_editbone(char *name)
-{
- bArmature *arm= G.obedit->data;
-
- EditBone *bone= MEM_callocN(sizeof(EditBone), "eBone");
-
- BLI_strncpy(bone->name, name, 32);
- unique_editbone_name(&G.edbo, bone->name);
-
- BLI_addtail(&G.edbo, bone);
-
- bone->flag |= BONE_TIPSEL;
- bone->weight= 1.0F;
- bone->dist= 0.25F;
- bone->xwidth= 0.1;
- bone->zwidth= 0.1;
- bone->ease1= 1.0;
- bone->ease2= 1.0;
- bone->rad_head= 0.10;
- bone->rad_tail= 0.05;
- bone->segments= 1;
- bone->layer= arm->layer;
-
- return bone;
-}
-
-static void add_primitive_bone(Object *ob, short newob)
-{
- float obmat[3][3], curs[3], viewmat[3][3], totmat[3][3], imat[3][3];
- EditBone *bone;
-
- VECCOPY (curs, give_cursor());
-
- /* Get inverse point for head and orientation for tail */
- Mat4Invert(G.obedit->imat, G.obedit->obmat);
- Mat4MulVecfl(G.obedit->imat, curs);
-
- if ( !(newob) || U.flag & USER_ADD_VIEWALIGNED) Mat3CpyMat4(obmat, G.vd->viewmat);
- else Mat3One(obmat);
-
- Mat3CpyMat4(viewmat, G.obedit->obmat);
- Mat3MulMat3(totmat, obmat, viewmat);
- Mat3Inv(imat, totmat);
-
- deselectall_armature(0, 0);
-
- /* Create a bone */
- bone= add_editbone("Bone");
-
- VECCOPY(bone->head, curs);
-
- if ( !(newob) || U.flag & USER_ADD_VIEWALIGNED)
- VecAddf(bone->tail, bone->head, imat[1]); // bone with unit length 1
- else
- VecAddf(bone->tail, bone->head, imat[2]); // bone with unit length 1, pointing up Z
-
-}
-
-void add_primitiveArmature(int type)
-{
- short newob=0;
-
- if(G.scene->id.lib) return;
-
- /* this function also comes from an info window */
- if ELEM(curarea->spacetype, SPACE_VIEW3D, SPACE_INFO); else return;
- if(G.vd==NULL) return;
-
- G.f &= ~(G_VERTEXPAINT+G_TEXTUREPAINT+G_WEIGHTPAINT);
- setcursor_space(SPACE_VIEW3D, CURSOR_STD);
-
- check_editmode(OB_ARMATURE);
-
- /* If we're not the "obedit", make a new object and enter editmode */
- if(G.obedit==NULL) {
- add_object(OB_ARMATURE);
- base_init_from_view3d(BASACT, G.vd);
- G.obedit= BASACT->object;
-
- where_is_object(G.obedit);
-
- make_editArmature();
- setcursor_space(SPACE_VIEW3D, CURSOR_EDIT);
- newob=1;
- }
-
- /* no primitive support yet */
- add_primitive_bone(G.obedit, newob);
-
- countall(); // flushes selection!
-
- if ( (newob) && !(U.flag & USER_ADD_EDITMODE)) {
- exit_editmode(2);
- }
-
- allqueue(REDRAWALL, 0);
- BIF_undo_push("Add primitive");
-}
-
-/* the ctrl-click method */
-void addvert_armature(void)
-{
- bArmature *arm= G.obedit->data;
- EditBone *ebone, *newbone, *flipbone;
- float *curs, mat[3][3],imat[3][3];
- int a, to_root= 0;
-
- TEST_EDITARMATURE;
-
- /* find the active or selected bone */
- for (ebone = G.edbo.first; ebone; ebone=ebone->next)
- if(arm->layer & ebone->layer)
- if(ebone->flag & (BONE_ACTIVE|BONE_TIPSEL)) break;
-
- if(ebone==NULL) {
- for (ebone = G.edbo.first; ebone; ebone=ebone->next)
- if(arm->layer & ebone->layer)
- if(ebone->flag & (BONE_ACTIVE|BONE_ROOTSEL)) break;
-
- if(ebone==NULL)
- return;
- to_root= 1;
- }
-
- deselectall_armature(0, 0);
-
- /* we re-use code for mirror editing... */
- flipbone= NULL;
- if(arm->flag & ARM_MIRROR_EDIT)
- flipbone= armature_bone_get_mirrored(ebone);
-
- for(a=0; a<2; a++) {
- if(a==1) {
- if(flipbone==NULL)
- break;
- else {
- SWAP(EditBone *, flipbone, ebone);
- }
- }
-
- newbone= add_editbone(ebone->name);
- newbone->flag |= BONE_ACTIVE;
-
- if(to_root) {
- VECCOPY(newbone->head, ebone->head);
- newbone->rad_head= ebone->rad_tail;
- newbone->parent= ebone->parent;
- }
- else {
- VECCOPY(newbone->head, ebone->tail);
- newbone->rad_head= ebone->rad_tail;
- newbone->parent= ebone;
- newbone->flag |= BONE_CONNECTED;
- }
-
- curs= give_cursor();
- VECCOPY(newbone->tail, curs);
- VecSubf(newbone->tail, newbone->tail, G.obedit->obmat[3]);
-
- if(a==1)
- newbone->tail[0]= -newbone->tail[0];
-
- Mat3CpyMat4(mat, G.obedit->obmat);
- Mat3Inv(imat, mat);
- Mat3MulVecfl(imat, newbone->tail);
-
- newbone->length= VecLenf(newbone->head, newbone->tail);
- newbone->rad_tail= newbone->length*0.05f;
- newbone->dist= newbone->length*0.25f;
-
- }
-
-
- countall();
-
- BIF_undo_push("Add Bone");
- allqueue(REDRAWVIEW3D, 0);
-
- while(get_mbut()&R_MOUSE);
-}
-
-/* adds an EditBone between the nominated locations (should be in the right space) */
-static EditBone *add_points_bone (float head[], float tail[])
-{
- EditBone *ebo;
-
- ebo= add_editbone("Bone");
-
- VECCOPY(ebo->head, head);
- VECCOPY(ebo->tail, tail);
-
- return ebo;
-}
-
-
-static EditBone *get_named_editbone(char *name)
-{
- EditBone *eBone;
-
- if (name)
- for (eBone=G.edbo.first; eBone; eBone=eBone->next){
- if (!strcmp (name, eBone->name))
- return eBone;
- }
-
- return NULL;
-}
-
-static void update_dup_subtarget(EditBone *dupBone)
-{
- /* If an edit bone has been duplicated, lets
- * update it's constraints if the subtarget
- * they point to has also been duplicated
- */
- EditBone *oldtarget, *newtarget;
- bPoseChannel *chan;
- bConstraint *curcon;
- ListBase *conlist;
-
-
- if ( (chan = verify_pose_channel(OBACT->pose, dupBone->name)) ) {
- if ( (conlist = &chan->constraints) ) {
- for (curcon = conlist->first; curcon; curcon=curcon->next) {
- /* does this constraint have a subtarget in
- * this armature?
- */
- bConstraintTypeInfo *cti= constraint_get_typeinfo(curcon);
- ListBase targets = {NULL, NULL};
- bConstraintTarget *ct;
-
- if (cti && cti->get_constraint_targets) {
- cti->get_constraint_targets(curcon, &targets);
-
- for (ct= targets.first; ct; ct= ct->next) {
- if ((ct->tar == G.obedit) && (ct->subtarget[0])) {
- oldtarget = get_named_editbone(ct->subtarget);
- if (oldtarget) {
- /* was the subtarget bone duplicated too? If
- * so, update the constraint to point at the
- * duplicate of the old subtarget.
- */
- if (oldtarget->flag & BONE_SELECTED){
- newtarget = (EditBone *) oldtarget->temp;
- strcpy(ct->subtarget, newtarget->name);
- }
- }
- }
- }
-
- if (cti->flush_constraint_targets)
- cti->flush_constraint_targets(curcon, &targets, 0);
- }
- }
- }
- }
-}
-
-
-void adduplicate_armature(void)
-{
- bArmature *arm= G.obedit->data;
- EditBone *eBone = NULL;
- EditBone *curBone;
- EditBone *firstDup=NULL; /* The beginning of the duplicated bones in the edbo list */
-
- countall(); // flushes selection!
-
- /* Select mirrored bones */
- if (arm->flag & ARM_MIRROR_EDIT) {
- for (curBone=G.edbo.first; curBone; curBone=curBone->next) {
- if (arm->layer & curBone->layer) {
- if (curBone->flag & BONE_SELECTED) {
- eBone = armature_bone_get_mirrored(curBone);
- if (eBone)
- eBone->flag |= BONE_SELECTED;
- }
- }
- }
- }
-
- /* Find the selected bones and duplicate them as needed */
- for (curBone=G.edbo.first; curBone && curBone!=firstDup; curBone=curBone->next){
- if (arm->layer & curBone->layer) {
- if (curBone->flag & BONE_SELECTED) {
-
- eBone=MEM_callocN(sizeof(EditBone), "addup_editbone");
- eBone->flag |= BONE_SELECTED;
-
- /* Copy data from old bone to new bone */
- memcpy (eBone, curBone, sizeof(EditBone));
-
- curBone->temp = eBone;
- eBone->temp = curBone;
-
- unique_editbone_name (&G.edbo, eBone->name);
- BLI_addtail (&G.edbo, eBone);
- if (!firstDup)
- firstDup=eBone;
-
- /* Lets duplicate the list of constraints that the
- * current bone has.
- */
- if (OBACT->pose) {
- bPoseChannel *chanold, *channew;
- ListBase *listold, *listnew;
-
- chanold = verify_pose_channel (OBACT->pose, curBone->name);
- if (chanold) {
- listold = &chanold->constraints;
- if (listold) {
- /* WARNING: this creates a new posechannel, but there will not be an attached bone
- * yet as the new bones created here are still 'EditBones' not 'Bones'.
- */
- channew =
- verify_pose_channel(OBACT->pose, eBone->name);
- if (channew) {
- /* copy transform locks */
- channew->protectflag = chanold->protectflag;
-
- /* ik (dof) settings */
- channew->ikflag = chanold->ikflag;
- VECCOPY(channew->limitmin, chanold->limitmin);
- VECCOPY(channew->limitmax, chanold->limitmax);
- VECCOPY(channew->stiffness, chanold->stiffness);
- channew->ikstretch= chanold->ikstretch;
-
- /* constraints */
- listnew = &channew->constraints;
- copy_constraints (listnew, listold);
- }
- }
- }
- }
- }
- }
- }
-
- /* Run though the list and fix the pointers */
- for (curBone=G.edbo.first; curBone && curBone!=firstDup; curBone=curBone->next){
- if(arm->layer & curBone->layer) {
- if (curBone->flag & BONE_SELECTED){
- eBone=(EditBone*) curBone->temp;
-
- /* If this bone has no parent,
- Set the duplicate->parent to NULL
- */
- if (!curBone->parent){
- eBone->parent = NULL;
- }
- /* If this bone has a parent that IS selected,
- Set the duplicate->parent to the curBone->parent->duplicate
- */
- else if (curBone->parent->flag & BONE_SELECTED){
- eBone->parent=(EditBone*) curBone->parent->temp;
- }
- /* If this bone has a parent that IS not selected,
- Set the duplicate->parent to the curBone->parent
- */
- else {
- eBone->parent=(EditBone*) curBone->parent;
- eBone->flag &= ~BONE_CONNECTED;
- }
-
- /* Lets try to fix any constraint subtargets that might
- have been duplicated */
- update_dup_subtarget(eBone);
- }
- }
- }
-
- /* Deselect the old bones and select the new ones */
-
- for (curBone=G.edbo.first; curBone && curBone!=firstDup; curBone=curBone->next){
- if(arm->layer & curBone->layer)
- curBone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL | BONE_ACTIVE);
- }
-
- BIF_TransformSetUndo("Add Duplicate");
- initTransform(TFM_TRANSLATION, CTX_NO_PET);
- Transform();
-
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWOOPS, 0);
-}
-
-
-
-/* *************** END Adding stuff in editmode *************** */
-/* ************** Add/Remove stuff in editmode **************** */
-
-/* temporary data-structure for merge/fill bones */
-typedef struct EditBonePoint {
- struct EditBonePoint *next, *prev;
-
- EditBone *head_owner; /* EditBone which uses this point as a 'head' point */
- EditBone *tail_owner; /* EditBone which uses this point as a 'tail' point */
-
- float vec[3]; /* the actual location of the point in local/EditMode space */
-} EditBonePoint;
-
-/* find chain-tips (i.e. bones without children) */
-static void chains_find_tips (ListBase *list)
-{
- EditBone *curBone, *ebo;
- LinkData *ld;
-
- /* note: this is potentially very slow ... there's got to be a better way */
- for (curBone= G.edbo.first; curBone; curBone= curBone->next) {
- short stop= 0;
-
- /* is this bone contained within any existing chain? (skip if so) */
- for (ld= list->first; ld; ld= ld->next) {
- for (ebo= ld->data; ebo; ebo= ebo->parent) {
- if (ebo == curBone) {
- stop= 1;
- break;
- }
- }
-
- if (stop) break;
- }
- /* skip current bone if it is part of an existing chain */
- if (stop) continue;
-
- /* is any existing chain part of the chain formed by this bone? */
- stop= 0;
- for (ebo= curBone->parent; ebo; ebo= ebo->parent) {
- for (ld= list->first; ld; ld= ld->next) {
- if (ld->data == ebo) {
- ld->data= curBone;
- stop= 1;
- break;
- }
- }
-
- if (stop) break;
- }
- /* current bone has already been added to a chain? */
- if (stop) continue;
-
- /* add current bone to a new chain */
- ld= MEM_callocN(sizeof(LinkData), "BoneChain");
- ld->data= curBone;
- BLI_addtail(list, ld);
- }
-}
-
-
-static void fill_add_joint (EditBone *ebo, short eb_tail, ListBase *points)
-{
- EditBonePoint *ebp;
- float vec[3];
- short found= 0;
-
- if (eb_tail) {
- VECCOPY(vec, ebo->tail);
- }
- else {
- VECCOPY(vec, ebo->head);
- }
-
- // FIXME: this algorithm sucks... it misses things it shouldn't
- for (ebp= points->first; ebp; ebp= ebp->next) {
- if (VecEqual(ebp->vec, vec)) {
- if (eb_tail) {
- if ((ebp->head_owner) && (ebp->head_owner->parent == ebo)) {
- /* so this bone's tail owner is this bone*/
- ebp->tail_owner= ebo;
- found= 1;
- break;
- }
- }
- else {
- if ((ebp->tail_owner) && (ebo->parent == ebp->tail_owner)) {
- /* so this bone's head owner is this bone */
- ebp->head_owner= ebo;
- found = 1;
- break;
- }
- }
- }
- }
-
- /* allocate a new point if no existing point was related */
- if (found == 0) {
- ebp= MEM_callocN(sizeof(EditBonePoint), "EditBonePoint");
-
- if (eb_tail) {
- VECCOPY(ebp->vec, ebo->tail);
- ebp->tail_owner= ebo;
- }
- else {
- VECCOPY(ebp->vec, ebo->head);
- ebp->head_owner= ebo;
- }
-
- BLI_addtail(points, ebp);
- }
-}
-
-/* bone adding between selected joints */
-void fill_bones_armature(void)
-{
- bArmature *arm= G.obedit->data;
- EditBone *ebo, *newbone=NULL;
- ListBase points = {NULL, NULL};
- int count;
-
- /* loop over all bones, and only consider if visible */
- for (ebo= G.edbo.first; ebo; ebo= ebo->next) {
- if ((arm->layer & ebo->layer) && !(ebo->flag & BONE_HIDDEN_A)) {
- if (!(ebo->flag & BONE_CONNECTED) && (ebo->flag & BONE_ROOTSEL))
- fill_add_joint(ebo, 0, &points);
- if (ebo->flag & BONE_TIPSEL)
- fill_add_joint(ebo, 1, &points);
- }
- }
-
- /* the number of joints determines how we fill:
- * 1) between joint and cursor (joint=head, cursor=tail)
- * 2) between the two joints (order is dependent on active-bone/hierachy)
- * 3+) error (a smarter method involving finding chains needs to be worked out
- */
- count= BLI_countlist(&points);
-
- if (count == 0) {
- error("No joints selected");
- return;
- }
- else if (count == 1) {
- EditBonePoint *ebp;
- float curs[3];
-
- /* Get Points - selected joint */
- ebp= (EditBonePoint *)points.first;
-
- /* Get points - cursor (tail) */
- VECCOPY (curs, give_cursor());
-
- Mat4Invert(G.obedit->imat, G.obedit->obmat);
- Mat4MulVecfl(G.obedit->imat, curs);
-
- /* Create a bone */
- newbone= add_points_bone(ebp->vec, curs);
- }
- else if (count == 2) {
- EditBonePoint *ebp, *ebp2;
- float head[3], tail[3];
-
- /* check that the points don't belong to the same bone */
- ebp= (EditBonePoint *)points.first;
- ebp2= ebp->next;
-
- if ((ebp->head_owner==ebp2->tail_owner) && (ebp->head_owner!=NULL)) {
- error("Same bone selected...");
- BLI_freelistN(&points);
- return;
- }
- if ((ebp->tail_owner==ebp2->head_owner) && (ebp->tail_owner!=NULL)) {
- error("Same bone selected...");
- BLI_freelistN(&points);
- return;
- }
-
- /* find which one should be the 'head' */
- if ((ebp->head_owner && ebp2->head_owner) || (ebp->tail_owner && ebp2->tail_owner)) {
- /* rule: whichever one is closer to 3d-cursor */
- float curs[3];
- float vecA[3], vecB[3];
- float distA, distB;
-
- /* get cursor location */
- VECCOPY (curs, give_cursor());
-
- Mat4Invert(G.obedit->imat, G.obedit->obmat);
- Mat4MulVecfl(G.obedit->imat, curs);
-
- /* get distances */
- VecSubf(vecA, ebp->vec, curs);
- VecSubf(vecB, ebp2->vec, curs);
- distA= VecLength(vecA);
- distB= VecLength(vecB);
-
- /* compare distances - closer one therefore acts as direction for bone to go */
- if (distA < distB) {
- VECCOPY(head, ebp2->vec);
- VECCOPY(tail, ebp->vec);
- }
- else {
- VECCOPY(head, ebp->vec);
- VECCOPY(tail, ebp2->vec);
- }
- }
- else if (ebp->head_owner) {
- VECCOPY(head, ebp->vec);
- VECCOPY(tail, ebp2->vec);
- }
- else if (ebp2->head_owner) {
- VECCOPY(head, ebp2->vec);
- VECCOPY(tail, ebp->vec);
- }
-
- /* add new bone */
- newbone= add_points_bone(head, tail);
- }
- else {
- // FIXME.. figure out a method for multiple bones
- error("Too many points selected");
- printf("Points selected: %d \n", count);
- BLI_freelistN(&points);
- return;
- }
-
- /* free points */
- BLI_freelistN(&points);
-
- /* undo + updates */
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- BIF_undo_push("Fill Bones");
-}
-
-/* this function merges between two bones, removes them and those in-between,
- * and adjusts the parent relationships for those in-between
- */
-static void bones_merge(EditBone *start, EditBone *end, ListBase *chains)
-{
- EditBone *ebo, *ebone, *newbone;
- LinkData *chain;
- float head[3], tail[3];
-
- /* check if same bone */
- if (start == end) {
- printf("Error: same bone! \n");
- printf("\tstart = %s, end = %s \n", start->name, end->name);
- }
-
- /* step 1: add a new bone
- * - head = head/tail of start (default head)
- * - tail = head/tail of end (default tail)
- * - parent = parent of start
- */
- if ((start->flag & BONE_TIPSEL) && !(start->flag & (BONE_SELECTED|BONE_ACTIVE))) {
- VECCOPY(head, start->tail);
- }
- else {
- VECCOPY(head, start->head);
- }
- if ((end->flag & BONE_ROOTSEL) && !(end->flag & (BONE_SELECTED|BONE_ACTIVE))) {
- VECCOPY(tail, end->head);
- }
- else {
- VECCOPY(tail, end->tail);
- }
- newbone= add_points_bone(head, tail);
- newbone->parent = start->parent;
-
- /* step 2: parent children of in-between bones to newbone */
- for (chain= chains->first; chain; chain= chain->next) {
- /* ick: we need to check if parent of each bone in chain is */
- for (ebo= chain->data; ebo; ebo= ebo->parent) {
- short found= 0;
-
- /* try to find which bone from the list to be removed, is the parent */
- for (ebone= end; ebone; ebone= ebone->parent) {
- if (ebo->parent == ebone) {
- found= 1;
- break;
- }
- }
-
- /* adjust this bone's parent to newbone then */
- if (found) {
- ebo->parent= newbone;
- break;
- }
- }
- }
-
- /* step 3: delete all bones between and including start and end */
- for (ebo= end; ebo; ebo= ebone) {
- ebone= (ebo == start) ? (NULL) : (ebo->parent);
- BLI_freelinkN(&G.edbo, ebo);
- }
-}
-
-/* bone merging - has a menu! */
-void merge_armature(void)
-{
- bArmature *arm= G.obedit->data;
- short val= 0;
-
- /* process a menu to determine how to merge */
- // TODO: there's room for more modes of merging stuff...
- val= pupmenu("Merge Selected Bones%t|Within Chains%x1");
- if (val <= 0) return;
-
- if (val == 1) {
- /* go down chains, merging bones */
- ListBase chains = {NULL, NULL};
- LinkData *chain, *nchain;
- EditBone *ebo;
-
- /* get chains (ends on chains) */
- chains_find_tips(&chains);
- if (chains.first == NULL) return;
-
- /* each 'chain' is the last bone in the chain (with no children) */
- for (chain= chains.first; chain; chain= nchain) {
- EditBone *bstart= NULL, *bend= NULL;
-
- /* temporarily remove chain from list of chains */
- nchain= chain->next;
- BLI_remlink(&chains, chain);
-
- /* only consider bones that are visible and selected */
- for (ebo= chain->data; ebo; ebo= ebo->parent) {
- /* check if visible + selected */
- if ( (arm->layer & ebo->layer) && !(ebo->flag & BONE_HIDDEN_A) &&
- ((ebo->flag & BONE_CONNECTED) || (ebo->parent==NULL)) &&
- (ebo->flag & (BONE_SELECTED|BONE_ACTIVE)) )
- {
- /* set either end or start (end gets priority, unless it is already set) */
- if (bend == NULL)
- bend= ebo;
- else
- bstart= ebo;
- }
- else {
- /* chain is broken... merge any continous segments then clear */
- if (bstart && bend)
- bones_merge(bstart, bend, &chains);
-
- bstart = NULL;
- bend = NULL;
- }
- }
-
- /* merge from bstart to bend if something not merged */
- if (bstart && bend)
- bones_merge(bstart, bend, &chains);
-
- /* put back link */
- BLI_insertlinkbefore(&chains, nchain, chain);
- }
-
- BLI_freelistN(&chains);
- }
-
- /* undo + updates */
- countall();
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- BIF_undo_push("Merge Bones");
-}
-
-/* ************** END Add/Remove stuff in editmode ************ */
-/* *************** Tools in editmode *********** */
-
-
-void hide_selected_armature_bones(void)
-{
- bArmature *arm= G.obedit->data;
- EditBone *ebone;
-
- for (ebone = G.edbo.first; ebone; ebone=ebone->next){
- if(arm->layer & ebone->layer) {
- if(ebone->flag & (BONE_SELECTED)) {
- ebone->flag &= ~(BONE_TIPSEL|BONE_SELECTED|BONE_ROOTSEL|BONE_ACTIVE);
- ebone->flag |= BONE_HIDDEN_A;
- }
- }
- }
- countall();
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- BIF_undo_push("Hide Bones");
-}
-
-void hide_unselected_armature_bones(void)
-{
- EditBone *ebone;
-
- for (ebone = G.edbo.first; ebone; ebone=ebone->next){
- bArmature *arm= G.obedit->data;
- if(arm->layer & ebone->layer) {
- if(ebone->flag & (BONE_TIPSEL|BONE_SELECTED|BONE_ROOTSEL));
- else {
- ebone->flag &= ~BONE_ACTIVE;
- ebone->flag |= BONE_HIDDEN_A;
- }
- }
- }
- countall();
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- BIF_undo_push("Hide Unselected Bones");
-}
-
-void show_all_armature_bones(void)
-{
- EditBone *ebone;
-
- for (ebone = G.edbo.first; ebone; ebone=ebone->next){
- bArmature *arm= G.obedit->data;
- if(arm->layer & ebone->layer) {
- if(ebone->flag & BONE_HIDDEN_A) {
- ebone->flag |= (BONE_TIPSEL|BONE_SELECTED|BONE_ROOTSEL);
- ebone->flag &= ~BONE_HIDDEN_A;
- }
- }
- }
- countall();
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- BIF_undo_push("Reveal Bones");
-}
-
-/* check for null, before calling! */
-static void bone_connect_to_existing_parent(EditBone *bone)
-{
- bone->flag |= BONE_CONNECTED;
- VECCOPY(bone->head, bone->parent->tail);
- bone->rad_head = bone->parent->rad_tail;
-}
-
-static void bone_connect_to_new_parent(EditBone *selbone, EditBone *actbone, short mode)
-{
- EditBone *ebone;
- float offset[3];
-
- if ((selbone->parent) && (selbone->flag & BONE_CONNECTED))
- selbone->parent->flag &= ~(BONE_TIPSEL);
-
- /* make actbone the parent of selbone */
- selbone->parent= actbone;
-
- /* in actbone tree we cannot have a loop */
- for (ebone= actbone->parent; ebone; ebone= ebone->parent) {
- if (ebone->parent==selbone) {
- ebone->parent= NULL;
- ebone->flag &= ~BONE_CONNECTED;
- }
- }
-
- if (mode == 1) {
- /* Connected: Child bones will be moved to the parent tip */
- selbone->flag |= BONE_CONNECTED;
- VecSubf(offset, actbone->tail, selbone->head);
-
- VECCOPY(selbone->head, actbone->tail);
- selbone->rad_head= actbone->rad_tail;
-
- VecAddf(selbone->tail, selbone->tail, offset);
-
- /* offset for all its children */
- for (ebone = G.edbo.first; ebone; ebone=ebone->next) {
- EditBone *par;
-
- for (par= ebone->parent; par; par= par->parent) {
- if (par==selbone) {
- VecAddf(ebone->head, ebone->head, offset);
- VecAddf(ebone->tail, ebone->tail, offset);
- break;
- }
- }
- }
- }
- else {
- /* Offset: Child bones will retain their distance from the parent tip */
- selbone->flag &= ~BONE_CONNECTED;
- }
-}
-
-void make_bone_parent(void)
-{
- bArmature *arm= G.obedit->data;
- EditBone *actbone, *ebone, *selbone;
- EditBone *flipbone, *flippar;
- short allchildbones= 0, foundselbone= 0;
- short val;
-
- /* find active bone to parent to */
- for (actbone = G.edbo.first; actbone; actbone=actbone->next) {
- if (arm->layer & actbone->layer) {
- if (actbone->flag & BONE_ACTIVE)
- break;
- }
- }
- if (actbone == NULL) {
- error("Needs an active bone");
- return;
- }
-
- /* find selected bones */
- for (ebone = G.edbo.first; ebone; ebone=ebone->next) {
- if (arm->layer & ebone->layer) {
- if ((ebone->flag & BONE_SELECTED) && (ebone != actbone)) {
- foundselbone++;
- if (ebone->parent != actbone) allchildbones= 1;
- }
- }
- }
- /* abort if no selected bones, and active bone doesn't have a parent to work with instead */
- if (foundselbone==0 && actbone->parent==NULL) {
- error("Need selected bone(s)");
- return;
- }
-
- /* 'Keep Offset' option is only displayed if it's likely to be useful */
- if (allchildbones)
- val= pupmenu("Make Parent%t|Connected%x1|Keep Offset%x2");
- else
- val= pupmenu("Make Parent%t|Connected%x1");
-
- if (val < 1) return;
-
- if (foundselbone==0 && actbone->parent) {
- /* When only the active bone is selected, and it has a parent,
- * connect it to the parent, as that is the only possible outcome.
- */
- bone_connect_to_existing_parent(actbone);
-
- if (arm->flag & ARM_MIRROR_EDIT) {
- flipbone = armature_bone_get_mirrored(actbone);
- if (flipbone)
- bone_connect_to_existing_parent(flipbone);
- }
- }
- else {
- /* loop through all editbones, parenting all selected bones to the active bone */
- for (selbone = G.edbo.first; selbone; selbone=selbone->next) {
- if (arm->layer & selbone->layer) {
- if ((selbone->flag & BONE_SELECTED) && (selbone!=actbone)) {
- /* parent selbone to actbone */
- bone_connect_to_new_parent(selbone, actbone, val);
-
- if (arm->flag & ARM_MIRROR_EDIT) {
- /* - if there's a mirrored copy of selbone, try to find a mirrored copy of actbone
- * (i.e. selbone="child.L" and actbone="parent.L", find "child.R" and "parent.R").
- * This is useful for arm-chains, for example parenting lower arm to upper arm
- * - if there's no mirrored copy of actbone (i.e. actbone = "parent.C" or "parent")
- * then just use actbone. Useful when doing upper arm to spine.
- */
- flipbone = armature_bone_get_mirrored(selbone);
- flippar = armature_bone_get_mirrored(actbone);
-
- if (flipbone) {
- if (flippar)
- bone_connect_to_new_parent(flipbone, flippar, val);
- else
- bone_connect_to_new_parent(flipbone, actbone, val);
- }
- }
- }
- }
- }
- }
-
- countall(); /* checks selection */
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWOOPS, 0);
- BIF_undo_push("Make Parent");
-
- return;
-}
-
-static void editbone_clear_parent(EditBone *ebone, int mode)
-{
- if (ebone->parent) {
- /* for nice selection */
- ebone->parent->flag &= ~(BONE_TIPSEL);
- }
-
- if(mode==1) ebone->parent= NULL;
- ebone->flag &= ~BONE_CONNECTED;
-}
-
-void clear_bone_parent(void)
-{
- bArmature *arm= G.obedit->data;
- EditBone *ebone;
- EditBone *flipbone = NULL;
- short val;
-
- val= pupmenu("Clear Parent%t|Clear Parent%x1|Disconnect Bone%x2");
-
- if(val<1) return;
- for (ebone = G.edbo.first; ebone; ebone=ebone->next) {
- if(arm->layer & ebone->layer) {
- if(ebone->flag & BONE_SELECTED) {
-
- if(arm->flag & ARM_MIRROR_EDIT)
- flipbone = armature_bone_get_mirrored(ebone);
-
- if (flipbone)
- editbone_clear_parent(flipbone, val);
- editbone_clear_parent(ebone, val);
- }
- }
- }
- countall(); // checks selection
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWOOPS, 0);
- BIF_undo_push("Clear Parent");
-}
-
-
-static EditBone *editbone_name_exists (ListBase *ebones, char *name)
-{
- EditBone *eBone;
-
- if (ebones == NULL) ebones = &G.edbo;
-
- for (eBone=ebones->first; eBone; eBone=eBone->next){
- if (!strcmp (name, eBone->name))
- return eBone;
- }
- return NULL;
-}
-
-/* note: there's a unique_bone_name() too! */
-void unique_editbone_name (ListBase *ebones, char *name)
-{
- char tempname[64];
- int number;
- char *dot;
-
-
- if (editbone_name_exists(ebones, name)) {
-
- /* Strip off the suffix, if it's a number */
- number= strlen(name);
- if(number && isdigit(name[number-1])) {
- dot= strrchr(name, '.'); // last occurrance
- if (dot)
- *dot=0;
- }
-
- for (number = 1; number <=999; number++){
- sprintf (tempname, "%s.%03d", name, number);
- if (!editbone_name_exists(ebones, tempname)){
- BLI_strncpy (name, tempname, 32);
- return;
- }
- }
- }
-}
-
-/* context; editmode armature */
-/* if forked && mirror-edit: makes two bones with flipped names */
-void extrude_armature(int forked)
-{
- bArmature *arm= G.obedit->data;
- EditBone *newbone, *ebone, *flipbone, *first=NULL;
- int a, totbone= 0, do_extrude;
-
- TEST_EDITARMATURE;
-
- /* since we allow root extrude too, we have to make sure selection is OK */
- for (ebone = G.edbo.first; ebone; ebone=ebone->next){
- if(arm->layer & ebone->layer) {
- if(ebone->flag & BONE_ROOTSEL) {
- if(ebone->parent && (ebone->flag & BONE_CONNECTED)) {
- if(ebone->parent->flag & BONE_TIPSEL)
- ebone->flag &= ~BONE_ROOTSEL;
- }
- }
- }
- }
-
- /* Duplicate the necessary bones */
- for (ebone = G.edbo.first; ((ebone) && (ebone!=first)); ebone=ebone->next){
- if(arm->layer & ebone->layer) {
-
- /* we extrude per definition the tip */
- do_extrude= 0;
- if (ebone->flag & (BONE_TIPSEL|BONE_SELECTED))
- do_extrude= 1;
- else if(ebone->flag & BONE_ROOTSEL) {
- /* but, a bone with parent deselected we do the root... */
- if(ebone->parent && (ebone->parent->flag & BONE_TIPSEL));
- else do_extrude= 2;
- }
-
- if (do_extrude) {
-
- /* we re-use code for mirror editing... */
- flipbone= NULL;
- if(arm->flag & ARM_MIRROR_EDIT) {
- flipbone= armature_bone_get_mirrored(ebone);
- if (flipbone) {
- forked= 0; // we extrude 2 different bones
- if(flipbone->flag & (BONE_TIPSEL|BONE_ROOTSEL|BONE_SELECTED))
- /* don't want this bone to be selected... */
- flipbone->flag &= ~(BONE_TIPSEL|BONE_SELECTED|BONE_ROOTSEL|BONE_ACTIVE);
- }
- if(flipbone==NULL && forked)
- flipbone= ebone;
- }
-
- for(a=0; a<2; a++) {
- if(a==1) {
- if(flipbone==NULL)
- break;
- else {
- SWAP(EditBone *, flipbone, ebone);
- }
- }
-
- totbone++;
- newbone = MEM_callocN(sizeof(EditBone), "extrudebone");
-
- if(do_extrude==1) {
- VECCOPY (newbone->head, ebone->tail);
- VECCOPY (newbone->tail, newbone->head);
- newbone->parent = ebone;
-
- newbone->flag = ebone->flag & BONE_TIPSEL; // copies it, in case mirrored bone
- }
- else {
- VECCOPY(newbone->head, ebone->head);
- VECCOPY(newbone->tail, ebone->head);
- newbone->parent= ebone->parent;
-
- newbone->flag= BONE_TIPSEL;
- }
-
- newbone->weight= ebone->weight;
- newbone->dist= ebone->dist;
- newbone->xwidth= ebone->xwidth;
- newbone->zwidth= ebone->zwidth;
- newbone->ease1= ebone->ease1;
- newbone->ease2= ebone->ease2;
- newbone->rad_head= ebone->rad_tail; // dont copy entire bone...
- newbone->rad_tail= ebone->rad_tail;
- newbone->segments= 1;
- newbone->layer= ebone->layer;
-
- if(newbone->parent) newbone->flag |= BONE_CONNECTED;
-
- BLI_strncpy (newbone->name, ebone->name, 32);
-
- if(flipbone && forked) { // only set if mirror edit
- if(strlen(newbone->name)<30) {
- if(a==0) strcat(newbone->name, "_L");
- else strcat(newbone->name, "_R");
- }
- }
- unique_editbone_name(&G.edbo, newbone->name);
-
- /* Add the new bone to the list */
- BLI_addtail(&G.edbo, newbone);
- if (!first)
- first = newbone;
-
- /* restore ebone if we were flipping */
- if(a==1 && flipbone)
- SWAP(EditBone *, flipbone, ebone);
-
- }
- }
-
- /* Deselect the old bone */
- ebone->flag &= ~(BONE_TIPSEL|BONE_SELECTED|BONE_ROOTSEL|BONE_ACTIVE);
- }
- }
- /* if only one bone, make this one active */
- if(totbone==1 && first) first->flag |= BONE_ACTIVE;
-
- /* Transform the endpoints */
- countall(); // flushes selection!
- BIF_TransformSetUndo("Extrude");
- initTransform(TFM_TRANSLATION, CTX_NO_PET);
- Transform();
-
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWOOPS, 0);
-}
-
-/* context; editmode armature */
-void subdivide_armature(int numcuts)
-{
- bArmature *arm= G.obedit->data;
- EditBone *ebone, *newbone, *tbone, *mbone;
- int a, i;
-
- if(numcuts < 1) return;
-
- for (mbone = G.edbo.last; mbone; mbone= mbone->prev) {
- if(arm->layer & mbone->layer) {
- if(mbone->flag & BONE_SELECTED) {
- for(i=numcuts+1; i>1; i--) {
- /* compute cut ratio first */
- float cutratio= 1/(float)i;
- float cutratioI= 1-cutratio;
-
- /* take care of mirrored stuff */
- for(a=0; a<2; a++) {
- float val1[3];
- float val2[3];
- float val3[3];
-
- /* try to find mirrored bone on a != 0 */
- if(a) {
- if(arm->flag & ARM_MIRROR_EDIT)
- ebone= armature_bone_get_mirrored(mbone);
- else ebone= NULL;
- }
- else
- ebone= mbone;
-
- if(ebone) {
- newbone= MEM_mallocN(sizeof(EditBone), "ebone subdiv");
- *newbone = *ebone;
- BLI_addtail(&G.edbo, newbone);
-
- /* calculate location of newbone->head */
- VECCOPY(val1, ebone->head);
- VECCOPY(val2, ebone->tail);
- VECCOPY(val3, newbone->head);
-
- val3[0]= val1[0]*cutratio+val2[0]*cutratioI;
- val3[1]= val1[1]*cutratio+val2[1]*cutratioI;
- val3[2]= val1[2]*cutratio+val2[2]*cutratioI;
-
- VECCOPY(newbone->head, val3);
- VECCOPY(newbone->tail, ebone->tail);
- VECCOPY(ebone->tail, newbone->head);
-
- newbone->rad_head= 0.5*(ebone->rad_head+ebone->rad_tail);
- ebone->rad_tail= newbone->rad_head;
-
- newbone->flag |= BONE_CONNECTED;
-
- unique_editbone_name (&G.edbo, newbone->name);
-
- /* correct parent bones */
- for (tbone = G.edbo.first; tbone; tbone=tbone->next){
- if(tbone->parent==ebone)
- tbone->parent= newbone;
- }
- newbone->parent= ebone;
- }
- }
- }
- }
- }
- }
-
- if(numcuts==1) BIF_undo_push("Subdivide");
- else BIF_undo_push("Subdivide multi");
-}
-
-/* ***************** Pose tools ********************* */
-
-void clear_armature(Object *ob, char mode)
-{
- bPoseChannel *pchan;
- bArmature *arm;
-
- arm=get_armature(ob);
-
- if (!arm)
- return;
-
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if(pchan->bone && (pchan->bone->flag & BONE_SELECTED)) {
- if(arm->layer & pchan->bone->layer) {
- switch (mode) {
- case 'r':
- pchan->quat[1]=pchan->quat[2]=pchan->quat[3]=0.0F; pchan->quat[0]=1.0F;
- break;
- case 'g':
- pchan->loc[0]=pchan->loc[1]=pchan->loc[2]=0.0F;
- break;
- case 's':
- pchan->size[0]=pchan->size[1]=pchan->size[2]=1.0F;
- break;
-
- }
-
- /* the current values from IPO's may not be zero, so tag as unkeyed */
- pchan->bone->flag |= BONE_UNKEYED;
- }
- }
- }
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- /* no update for this object, this will execute the action again */
- /* is weak... like for ipo editing which uses ctime now... */
- where_is_pose (ob);
- ob->recalc= 0;
-}
-
-/* helper for function below */
-static int clear_active_flag(Object *ob, Bone *bone, void *data)
-{
- bone->flag &= ~BONE_ACTIVE;
- return 0;
-}
-
-
-/* called from editview.c, for mode-less pose selection */
-int do_pose_selectbuffer(Base *base, unsigned int *buffer, short hits)
-{
- Object *ob= base->object;
- Bone *nearBone;
-
- if (!ob || !ob->pose) return 0;
-
- nearBone= get_bone_from_selectbuffer(base, buffer, hits, 1);
-
- if (nearBone) {
- bArmature *arm= ob->data;
-
- /* since we do unified select, we don't shift+select a bone if the armature object was not active yet */
- if (!(G.qual & LR_SHIFTKEY) || base!=BASACT){
- deselectall_posearmature(ob, 0, 0);
- nearBone->flag |= (BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL|BONE_ACTIVE);
- select_actionchannel_by_name(ob->action, nearBone->name, 1);
- }
- else {
- if (nearBone->flag & BONE_SELECTED) {
- /* if not active, we make it active */
- if((nearBone->flag & BONE_ACTIVE)==0) {
- bone_looper(ob, arm->bonebase.first, NULL, clear_active_flag);
- nearBone->flag |= BONE_ACTIVE;
- }
- else {
- nearBone->flag &= ~(BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL|BONE_ACTIVE);
- select_actionchannel_by_name(ob->action, nearBone->name, 0);
- }
- }
- else{
- bone_looper(ob, arm->bonebase.first, NULL, clear_active_flag);
-
- nearBone->flag |= (BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL|BONE_ACTIVE);
- select_actionchannel_by_name(ob->action, nearBone->name, 1);
- }
- }
-
- /* in weightpaint we select the associated vertex group too */
- if(G.f & G_WEIGHTPAINT) {
- if(nearBone->flag & BONE_ACTIVE) {
- vertexgroup_select_by_name(OBACT, nearBone->name);
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- }
- }
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWIPO, 0); /* To force action/constraint ipo update */
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWOOPS, 0);
- }
-
- return nearBone!=NULL;
-
-}
-
-/* test==0: deselect all
- test==1: swap select
- test==2: only clear active tag
-*/
-void deselectall_posearmature (Object *ob, int test, int doundo)
-{
- bArmature *arm;
- bPoseChannel *pchan;
- int selectmode= 0;
-
- /* we call this from outliner too, but with OBACT set OK */
- if(!ob || !ob->pose) return;
- arm= get_armature(ob);
-
- /* Determine if we're selecting or deselecting */
- if (test==1) {
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next)
- if(pchan->bone->layer & arm->layer && !(pchan->bone->flag & BONE_HIDDEN_P))
- if(pchan->bone->flag & BONE_SELECTED)
- break;
-
- if (pchan==NULL)
- selectmode= 1;
- }
- else if(test==2)
- selectmode= 2;
-
- /* Set the flags accordingly */
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if(pchan->bone->layer & arm->layer && !(pchan->bone->flag & BONE_HIDDEN_P)) {
- if(selectmode==0) pchan->bone->flag &= ~(BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL|BONE_ACTIVE);
- else if(selectmode==1) pchan->bone->flag |= BONE_SELECTED;
- else pchan->bone->flag &= ~BONE_ACTIVE;
- }
- }
-
- /* action editor */
- deselect_actionchannels(ob->action, 0); /* deselects for sure */
- if(selectmode==1)
- deselect_actionchannels(ob->action, 1); /* swaps */
-
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWACTION, 0);
-
- countall();
-
- if (doundo) {
- if (selectmode==1) BIF_undo_push("Select All");
- else BIF_undo_push("Deselect All");
- }
-}
-
-
-int bone_looper(Object *ob, Bone *bone, void *data,
- int (*bone_func)(Object *, Bone *, void *))
-{
-
- /* We want to apply the function bone_func to every bone
- * in an armature -- feed bone_looper the first bone and
- * a pointer to the bone_func and watch it go!. The int count
- * can be useful for counting bones with a certain property
- * (e.g. skinnable)
- */
- int count = 0;
-
- if (bone) {
-
- /* only do bone_func if the bone is non null
- */
- count += bone_func(ob, bone, data);
-
- /* try to execute bone_func for the first child
- */
- count += bone_looper(ob, bone->childbase.first, data,
- bone_func);
-
- /* try to execute bone_func for the next bone at this
- * depth of the recursion.
- */
- count += bone_looper(ob, bone->next, data, bone_func);
- }
-
- return count;
-}
-
-
-static int bone_skinnable(Object *ob, Bone *bone, void *datap)
-{
- /* Bones that are deforming
- * are regarded to be "skinnable" and are eligible for
- * auto-skinning.
- *
- * This function performs 2 functions:
- *
- * a) It returns 1 if the bone is skinnable.
- * If we loop over all bones with this
- * function, we can count the number of
- * skinnable bones.
- * b) If the pointer data is non null,
- * it is treated like a handle to a
- * bone pointer -- the bone pointer
- * is set to point at this bone, and
- * the pointer the handle points to
- * is incremented to point to the
- * next member of an array of pointers
- * to bones. This way we can loop using
- * this function to construct an array of
- * pointers to bones that point to all
- * skinnable bones.
- */
- Bone ***hbone;
- int a, segments;
- struct { Object *armob; void *list; int heat; } *data = datap;
-
- if(!(G.f & G_WEIGHTPAINT) || !(bone->flag & BONE_HIDDEN_P)) {
- if (!(bone->flag & BONE_NO_DEFORM)) {
- if(data->heat && data->armob->pose && get_pose_channel(data->armob->pose, bone->name))
- segments = bone->segments;
- else
- segments = 1;
-
- if (data->list != NULL) {
- hbone = (Bone ***) &data->list;
-
- for(a=0; a<segments; a++) {
- **hbone = bone;
- ++*hbone;
- }
- }
- return segments;
- }
- }
- return 0;
-}
-
-static int add_defgroup_unique_bone(Object *ob, Bone *bone, void *data)
-{
- /* This group creates a vertex group to ob that has the
- * same name as bone (provided the bone is skinnable).
- * If such a vertex group aleady exist the routine exits.
- */
- if (!(bone->flag & BONE_NO_DEFORM)) {
- if (!get_named_vertexgroup(ob,bone->name)) {
- add_defgroup_name(ob, bone->name);
- return 1;
- }
- }
- return 0;
-}
-
-static int dgroup_skinnable(Object *ob, Bone *bone, void *datap)
-{
- /* Bones that are deforming
- * are regarded to be "skinnable" and are eligible for
- * auto-skinning.
- *
- * This function performs 2 functions:
- *
- * a) If the bone is skinnable, it creates
- * a vertex group for ob that has
- * the name of the skinnable bone
- * (if one doesn't exist already).
- * b) If the pointer data is non null,
- * it is treated like a handle to a
- * bDeformGroup pointer -- the
- * bDeformGroup pointer is set to point
- * to the deform group with the bone's
- * name, and the pointer the handle
- * points to is incremented to point to the
- * next member of an array of pointers
- * to bDeformGroups. This way we can loop using
- * this function to construct an array of
- * pointers to bDeformGroups, all with names
- * of skinnable bones.
- */
- bDeformGroup ***hgroup, *defgroup;
- int a, segments;
- struct { Object *armob; void *list; int heat; } *data= datap;
-
- if(!(G.f & G_WEIGHTPAINT) || !(bone->flag & BONE_HIDDEN_P)) {
- if (!(bone->flag & BONE_NO_DEFORM)) {
- if(data->heat && data->armob->pose && get_pose_channel(data->armob->pose, bone->name))
- segments = bone->segments;
- else
- segments = 1;
-
- if(!(defgroup = get_named_vertexgroup(ob, bone->name)))
- defgroup = add_defgroup_name(ob, bone->name);
-
- if (data->list != NULL) {
- hgroup = (bDeformGroup ***) &data->list;
-
- for(a=0; a<segments; a++) {
- **hgroup = defgroup;
- ++*hgroup;
- }
- }
- return segments;
- }
- }
- return 0;
-}
-
-static void add_vgroups__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s)
-{
- /* DerivedMesh mapFunc for getting final coords in weight paint mode */
-
- float (*verts)[3] = userData;
- VECCOPY(verts[index], co);
-}
-
-static void envelope_bone_weighting(Object *ob, Mesh *mesh, float (*verts)[3], int numbones, Bone **bonelist, bDeformGroup **dgrouplist, bDeformGroup **dgroupflip, float (*root)[3], float (*tip)[3], int *selected, float scale)
-{
- /* Create vertex group weights from envelopes */
-
- Bone *bone;
- bDeformGroup *dgroup;
- float distance;
- int i, iflip, j;
-
- /* for each vertex in the mesh */
- for (i=0; i < mesh->totvert; i++) {
- iflip = (dgroupflip)? mesh_get_x_mirror_vert(ob, i): 0;
-
- /* for each skinnable bone */
- for (j=0; j < numbones; ++j) {
- if(!selected[j])
- continue;
-
- bone = bonelist[j];
- dgroup = dgrouplist[j];
-
- /* store the distance-factor from the vertex to the bone */
- distance = distfactor_to_bone (verts[i], root[j], tip[j],
- bone->rad_head * scale, bone->rad_tail * scale, bone->dist * scale);
-
- /* add the vert to the deform group if weight!=0.0 */
- if (distance!=0.0)
- add_vert_to_defgroup (ob, dgroup, i, distance, WEIGHT_REPLACE);
- else
- remove_vert_defgroup (ob, dgroup, i);
-
- /* do same for mirror */
- if (dgroupflip && dgroupflip[j] && iflip >= 0) {
- if (distance!=0.0)
- add_vert_to_defgroup (ob, dgroupflip[j], iflip, distance,
- WEIGHT_REPLACE);
- else
- remove_vert_defgroup (ob, dgroupflip[j], iflip);
- }
- }
- }
-}
-
-void add_verts_to_dgroups(Object *ob, Object *par, int heat, int mirror)
-{
- /* This functions implements the automatic computation of vertex group
- * weights, either through envelopes or using a heat equilibrium.
- *
- * This function can be called both when parenting a mesh to an armature,
- * or in weightpaint + posemode. In the latter case selection is taken
- * into account and vertex weights can be mirrored.
- *
- * The mesh vertex positions used are either the final deformed coords
- * from the derivedmesh in weightpaint mode, the final subsurf coords
- * when parenting, or simply the original mesh coords.
- */
-
- bArmature *arm;
- Bone **bonelist, *bone;
- bDeformGroup **dgrouplist, **dgroupflip;
- bDeformGroup *dgroup, *curdg;
- bPoseChannel *pchan;
- Mesh *mesh;
- Mat4 *bbone = NULL;
- float (*root)[3], (*tip)[3], (*verts)[3];
- int *selected;
- int numbones, vertsfilled = 0, i, j, segments = 0;
- int wpmode = (G.f & G_WEIGHTPAINT);
- struct { Object *armob; void *list; int heat; } looper_data;
-
- /* If the parent object is not an armature exit */
- arm = get_armature(par);
- if (!arm)
- return;
-
- looper_data.armob = par;
- looper_data.heat= heat;
- looper_data.list= NULL;
-
- /* count the number of skinnable bones */
- numbones = bone_looper(ob, arm->bonebase.first, &looper_data, bone_skinnable);
-
- if (numbones == 0)
- return;
-
- /* create an array of pointer to bones that are skinnable
- * and fill it with all of the skinnable bones */
- bonelist = MEM_callocN(numbones*sizeof(Bone *), "bonelist");
- looper_data.list= bonelist;
- bone_looper(ob, arm->bonebase.first, &looper_data, bone_skinnable);
-
- /* create an array of pointers to the deform groups that
- * coorespond to the skinnable bones (creating them
- * as necessary. */
- dgrouplist = MEM_callocN(numbones*sizeof(bDeformGroup *), "dgrouplist");
- dgroupflip = MEM_callocN(numbones*sizeof(bDeformGroup *), "dgroupflip");
-
- looper_data.list= dgrouplist;
- bone_looper(ob, arm->bonebase.first, &looper_data, dgroup_skinnable);
-
- /* create an array of root and tip positions transformed into
- * global coords */
- root = MEM_callocN(numbones*sizeof(float)*3, "root");
- tip = MEM_callocN(numbones*sizeof(float)*3, "tip");
- selected = MEM_callocN(numbones*sizeof(int), "selected");
-
- for (j=0; j < numbones; ++j) {
- bone = bonelist[j];
- dgroup = dgrouplist[j];
-
- /* handle bbone */
- if(heat) {
- if(segments == 0) {
- segments = 1;
- bbone = NULL;
-
- if(par->pose && (pchan=get_pose_channel(par->pose, bone->name))) {
- if(bone->segments > 1) {
- segments = bone->segments;
- bbone = b_bone_spline_setup(pchan, 1);
- }
- }
- }
-
- segments--;
- }
-
- /* compute root and tip */
- if(bbone) {
- VECCOPY(root[j], bbone[segments].mat[3]);
- Mat4MulVecfl(bone->arm_mat, root[j]);
- if(segments+1 < bone->segments) {
- VECCOPY(tip[j], bbone[segments+1].mat[3])
- Mat4MulVecfl(bone->arm_mat, tip[j]);
- }
- else
- VECCOPY(tip[j], bone->arm_tail)
- }
- else {
- VECCOPY(root[j], bone->arm_head);
- VECCOPY(tip[j], bone->arm_tail);
- }
-
- Mat4MulVecfl(par->obmat, root[j]);
- Mat4MulVecfl(par->obmat, tip[j]);
-
- /* set selected */
- if(wpmode) {
- if ((arm->layer & bone->layer) && (bone->flag & BONE_SELECTED))
- selected[j] = 1;
- }
- else
- selected[j] = 1;
-
- /* find flipped group */
- if(mirror) {
- char name[32];
-
- BLI_strncpy(name, dgroup->name, 32);
- // 0 = don't strip off number extensions
- bone_flip_name(name, 0);
-
- for (curdg = ob->defbase.first; curdg; curdg=curdg->next)
- if (!strcmp(curdg->name, name))
- break;
-
- dgroupflip[j] = curdg;
- }
- }
-
- /* create verts */
- mesh = (Mesh*)ob->data;
- verts = MEM_callocN(mesh->totvert*sizeof(*verts), "closestboneverts");
-
- if (wpmode) {
- /* if in weight paint mode, use final verts from derivedmesh */
- DerivedMesh *dm = mesh_get_derived_final(ob, CD_MASK_BAREMESH);
-
- if(dm->foreachMappedVert) {
- dm->foreachMappedVert(dm, add_vgroups__mapFunc, (void*)verts);
- vertsfilled = 1;
- }
-
- dm->release(dm);
- }
- else if (modifiers_findByType(ob, eModifierType_Subsurf)) {
- /* is subsurf on? Lets use the verts on the limit surface then.
- * = same amount of vertices as mesh, but vertices moved to the
- * subsurfed position, like for 'optimal'. */
- subsurf_calculate_limit_positions(mesh, verts);
- vertsfilled = 1;
- }
-
- /* transform verts to global space */
- for (i=0; i < mesh->totvert; i++) {
- if (!vertsfilled)
- VECCOPY(verts[i], mesh->mvert[i].co)
- Mat4MulVecfl(ob->obmat, verts[i]);
- }
-
- /* compute the weights based on gathered vertices and bones */
- if (heat)
- heat_bone_weighting(ob, mesh, verts, numbones, dgrouplist, dgroupflip,
- root, tip, selected);
- else
- envelope_bone_weighting(ob, mesh, verts, numbones, bonelist, dgrouplist,
- dgroupflip, root, tip, selected, Mat4ToScalef(par->obmat));
-
- /* free the memory allocated */
- MEM_freeN(bonelist);
- MEM_freeN(dgrouplist);
- MEM_freeN(dgroupflip);
- MEM_freeN(root);
- MEM_freeN(tip);
- MEM_freeN(selected);
- MEM_freeN(verts);
-}
-
-void create_vgroups_from_armature(Object *ob, Object *par)
-{
- /* Lets try to create some vertex groups
- * based on the bones of the parent armature.
- */
-
- bArmature *arm;
- short mode;
-
- /* If the parent object is not an armature exit */
- arm = get_armature(par);
- if (!arm)
- return;
-
- /* Prompt the user on whether/how they want the vertex groups
- * added to the child mesh */
- mode= pupmenu("Create Vertex Groups? %t|"
- "Don't Create Groups %x1|"
- "Name Groups %x2|"
- "Create From Envelopes %x3|"
- "Create From Bone Heat %x4|");
- switch (mode){
- case 2:
- /* Traverse the bone list, trying to create empty vertex
- * groups cooresponding to the bone.
- */
- bone_looper(ob, arm->bonebase.first, NULL,
- add_defgroup_unique_bone);
- if (ob->type == OB_MESH)
- create_dverts(ob->data);
-
- break;
-
- case 3:
- case 4:
- /* Traverse the bone list, trying to create vertex groups
- * that are populated with the vertices for which the
- * bone is closest.
- */
- add_verts_to_dgroups(ob, par, (mode == 4), 0);
- break;
-
- }
-}
-
-static int hide_selected_pose_bone(Object *ob, Bone *bone, void *ptr)
-{
- bArmature *arm= ob->data;
-
- if(arm->layer & bone->layer) {
- if (bone->flag & BONE_SELECTED) {
- bone->flag |= BONE_HIDDEN_P;
- bone->flag &= ~(BONE_SELECTED|BONE_ACTIVE);
- }
- }
- return 0;
-}
-
-/* active object is armature */
-void hide_selected_pose_bones(void)
-{
- bArmature *arm= OBACT->data;
-
- if (!arm)
- return;
-
- bone_looper(OBACT, arm->bonebase.first, NULL,
- hide_selected_pose_bone);
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWACTION, 0);
- BIF_undo_push("Hide Bones");
-}
-
-static int hide_unselected_pose_bone(Object *ob, Bone *bone, void *ptr)
-{
- bArmature *arm= ob->data;
-
- if(arm->layer & bone->layer) {
- if (~bone->flag & BONE_SELECTED) {
- bone->flag |= BONE_HIDDEN_P;
- bone->flag &= ~BONE_ACTIVE;
- }
- }
- return 0;
-}
-
-/* active object is armature */
-void hide_unselected_pose_bones(void)
-{
- bArmature *arm;
-
- arm=get_armature (OBACT);
-
- if (!arm)
- return;
-
- bone_looper(OBACT, arm->bonebase.first, NULL,
- hide_unselected_pose_bone);
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- BIF_undo_push("Hide Unselected Bone");
-}
-
-static int show_pose_bone(Object *ob, Bone *bone, void *ptr)
-{
- bArmature *arm= ob->data;
-
- if(arm->layer & bone->layer) {
- if (bone->flag & BONE_HIDDEN_P) {
- bone->flag &= ~BONE_HIDDEN_P;
- bone->flag |= BONE_SELECTED;
- }
- }
-
- return 0;
-}
-
-/* active object is armature in posemode */
-void show_all_pose_bones(void)
-{
- bArmature *arm;
-
- arm=get_armature (OBACT);
-
- if (!arm)
- return;
-
- bone_looper(OBACT, arm->bonebase.first, NULL,
- show_pose_bone);
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- BIF_undo_push("Reveal Bones");
-}
-
-
-/* ************* RENAMING DISASTERS ************ */
-
-/* note: there's a unique_editbone_name() too! */
-void unique_bone_name (bArmature *arm, char *name)
-{
- char tempname[64];
- int number;
- char *dot;
-
- if (get_named_bone(arm, name)) {
-
- /* Strip off the suffix, if it's a number */
- number= strlen(name);
- if(number && isdigit(name[number-1])) {
- dot= strrchr(name, '.'); // last occurrance
- if (dot)
- *dot=0;
- }
-
- for (number = 1; number <=999; number++){
- sprintf (tempname, "%s.%03d", name, number);
- if (!get_named_bone(arm, tempname)){
- BLI_strncpy (name, tempname, 32);
- return;
- }
- }
- }
-}
-
-#define MAXBONENAME 32
-/* helper call for below */
-static void constraint_bone_name_fix(Object *ob, ListBase *conlist, char *oldname, char *newname)
-{
- bConstraint *curcon;
- bConstraintTarget *ct;
-
- for (curcon = conlist->first; curcon; curcon=curcon->next) {
- bConstraintTypeInfo *cti= constraint_get_typeinfo(curcon);
- ListBase targets = {NULL, NULL};
-
- if (cti && cti->get_constraint_targets) {
- cti->get_constraint_targets(curcon, &targets);
-
- for (ct= targets.first; ct; ct= ct->next) {
- if (ct->tar == ob) {
- if (!strcmp(ct->subtarget, oldname) )
- BLI_strncpy(ct->subtarget, newname, MAXBONENAME);
- }
- }
-
- if (cti->flush_constraint_targets)
- cti->flush_constraint_targets(curcon, &targets, 0);
- }
- }
-}
-
-/* called by UI for renaming a bone */
-/* warning: make sure the original bone was not renamed yet! */
-/* seems messy, but thats what you get with not using pointers but channel names :) */
-void armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep)
-{
- Object *ob;
- char newname[MAXBONENAME];
- char oldname[MAXBONENAME];
-
- /* names better differ! */
- if(strncmp(oldnamep, newnamep, MAXBONENAME)) {
-
- /* we alter newname string... so make copy */
- BLI_strncpy(newname, newnamep, MAXBONENAME);
- /* we use oldname for search... so make copy */
- BLI_strncpy(oldname, oldnamep, MAXBONENAME);
-
- /* now check if we're in editmode, we need to find the unique name */
- if(G.obedit && G.obedit->data==arm) {
- EditBone *eBone;
-
- eBone= editbone_name_exists(&G.edbo, oldname);
- if(eBone) {
- unique_editbone_name (&G.edbo, newname);
- BLI_strncpy(eBone->name, newname, MAXBONENAME);
- }
- else return;
- }
- else {
- Bone *bone= get_named_bone (arm, oldname);
-
- if(bone) {
- unique_bone_name (arm, newname);
- BLI_strncpy(bone->name, newname, MAXBONENAME);
- }
- else return;
- }
-
- /* do entire dbase */
- for(ob= G.main->object.first; ob; ob= ob->id.next) {
- /* we have the object using the armature */
- if(arm==ob->data) {
- Object *cob;
- bAction *act;
- bActionChannel *achan;
- bActionStrip *strip;
-
- /* Rename action channel if necessary */
- act = ob->action;
- if (act && !act->id.lib) {
- /* Find the appropriate channel */
- achan= get_action_channel(act, oldname);
- if(achan) BLI_strncpy(achan->name, newname, MAXBONENAME);
- }
-
- /* Rename the pose channel, if it exists */
- if (ob->pose) {
- bPoseChannel *pchan = get_pose_channel(ob->pose, oldname);
- if (pchan) {
- BLI_strncpy (pchan->name, newname, MAXBONENAME);
- }
- }
-
- /* check all nla-strips too */
- for (strip= ob->nlastrips.first; strip; strip= strip->next) {
- /* Rename action channel if necessary */
- act = strip->act;
- if (act && !act->id.lib) {
- /* Find the appropriate channel */
- achan= get_action_channel(act, oldname);
- if(achan) BLI_strncpy(achan->name, newname, MAXBONENAME);
- }
- }
-
- /* Update any object constraints to use the new bone name */
- for(cob= G.main->object.first; cob; cob= cob->id.next) {
- if(cob->constraints.first)
- constraint_bone_name_fix(ob, &cob->constraints, oldname, newname);
- if (cob->pose) {
- bPoseChannel *pchan;
- for (pchan = cob->pose->chanbase.first; pchan; pchan=pchan->next) {
- constraint_bone_name_fix(ob, &pchan->constraints, oldname, newname);
- }
- }
- }
- }
-
- /* See if an object is parented to this armature */
- if (ob->parent && (ob->parent->data == arm)) {
- if(ob->partype==PARBONE) {
- /* bone name in object */
- if (!strcmp(ob->parsubstr, oldname))
- BLI_strncpy(ob->parsubstr, newname, MAXBONENAME);
- }
- }
-
- if(modifiers_usesArmature(ob, arm)) {
- bDeformGroup *dg;
- /* bone name in defgroup */
- for (dg=ob->defbase.first; dg; dg=dg->next) {
- if(!strcmp(dg->name, oldname))
- BLI_strncpy(dg->name, newname, MAXBONENAME);
- }
- }
- }
- }
-}
-
-/* context editmode object */
-void armature_flip_names(void)
-{
- bArmature *arm= G.obedit->data;
- EditBone *ebone;
- char newname[32];
-
- for (ebone = G.edbo.first; ebone; ebone=ebone->next) {
- if(arm->layer & ebone->layer) {
- if(ebone->flag & BONE_SELECTED) {
- BLI_strncpy(newname, ebone->name, sizeof(newname));
- bone_flip_name(newname, 1); // 1 = do strip off number extensions
- armature_bone_rename(G.obedit->data, ebone->name, newname);
- }
- }
- }
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue (REDRAWACTION, 0);
- allqueue(REDRAWOOPS, 0);
- BIF_undo_push("Flip names");
-
-}
-
-/* context; editmode armature */
-EditBone *armature_bone_get_mirrored(EditBone *ebo)
-{
- EditBone *eboflip= NULL;
- char name[32];
-
- BLI_strncpy(name, ebo->name, sizeof(name));
- bone_flip_name(name, 0); // 0 = don't strip off number extensions
-
- for (eboflip=G.edbo.first; eboflip; eboflip=eboflip->next)
- if(ebo!=eboflip)
- if (!strcmp (name, eboflip->name)) break;
-
- return eboflip;
-}
-
-/* if editbone (partial) selected, copy data */
-/* context; editmode armature, with mirror editing enabled */
-void transform_armature_mirror_update(void)
-{
- EditBone *ebo, *eboflip;
-
- for (ebo=G.edbo.first; ebo; ebo=ebo->next) {
- /* no layer check, correct mirror is more important */
- if(ebo->flag & (BONE_TIPSEL|BONE_ROOTSEL)) {
-
- eboflip= armature_bone_get_mirrored(ebo);
-
- if(eboflip) {
- /* we assume X-axis flipping for now */
- if(ebo->flag & BONE_TIPSEL) {
- eboflip->tail[0]= -ebo->tail[0];
- eboflip->tail[1]= ebo->tail[1];
- eboflip->tail[2]= ebo->tail[2];
- eboflip->rad_tail= ebo->rad_tail;
- }
- if(ebo->flag & BONE_ROOTSEL) {
- eboflip->head[0]= -ebo->head[0];
- eboflip->head[1]= ebo->head[1];
- eboflip->head[2]= ebo->head[2];
- eboflip->rad_head= ebo->rad_head;
- }
- if(ebo->flag & BONE_SELECTED) {
- eboflip->dist= ebo->dist;
- eboflip->roll= -ebo->roll;
- eboflip->xwidth= ebo->xwidth;
- eboflip->zwidth= ebo->zwidth;
- }
- }
- }
- }
-}
-
-
-/*****************************************************************************************************/
-/*************************************** SKELETON GENERATOR ******************************************/
-/*****************************************************************************************************/
-
-/**************************************** SYMMETRY HANDLING ******************************************/
-
-void markdownSymmetryArc(ReebArc *arc, ReebNode *node, int level);
-
-void mirrorAlongAxis(float v[3], float center[3], float axis[3])
-{
- float dv[3], pv[3];
-
- VecSubf(dv, v, center);
- Projf(pv, dv, axis);
- VecMulf(pv, -2);
- VecAddf(v, v, pv);
-}
-
-/* Helper structure for radial symmetry */
-typedef struct RadialArc
-{
- ReebArc *arc;
- float n[3]; /* normalized vector joining the nodes of the arc */
-} RadialArc;
-
-void reestablishRadialSymmetry(ReebNode *node, int depth, float axis[3])
-{
- RadialArc *ring = NULL;
- RadialArc *unit;
- float limit = G.scene->toolsettings->skgen_symmetry_limit;
- int symmetric = 1;
- int count = 0;
- int i;
-
- /* count the number of arcs in the symmetry ring */
- for (i = 0; node->arcs[i] != NULL; i++)
- {
- ReebArc *connectedArc = node->arcs[i];
-
- /* depth is store as a negative in flag. symmetry level is positive */
- if (connectedArc->flags == -depth)
- {
- count++;
- }
- }
-
- ring = MEM_callocN(sizeof(RadialArc) * count, "radial symmetry ring");
- unit = ring;
-
- /* fill in the ring */
- for (unit = ring, i = 0; node->arcs[i] != NULL; i++)
- {
- ReebArc *connectedArc = node->arcs[i];
-
- /* depth is store as a negative in flag. symmetry level is positive */
- if (connectedArc->flags == -depth)
- {
- ReebNode *otherNode = OTHER_NODE(connectedArc, node);
- float vec[3];
-
- unit->arc = connectedArc;
-
- /* project the node to node vector on the symmetry plane */
- VecSubf(unit->n, otherNode->p, node->p);
- Projf(vec, unit->n, axis);
- VecSubf(unit->n, unit->n, vec);
-
- Normalize(unit->n);
-
- unit++;
- }
- }
-
- /* sort ring */
- for (i = 0; i < count - 1; i++)
- {
- float minAngle = 3; /* arbitrary high value, higher than 2, at least */
- int minIndex = -1;
- int j;
-
- for (j = i + 1; j < count; j++)
- {
- float angle = Inpf(ring[i].n, ring[j].n);
-
- /* map negative values to 1..2 */
- if (angle < 0)
- {
- angle = 1 - angle;
- }
-
- if (angle < minAngle)
- {
- minIndex = j;
- minAngle = angle;
- }
- }
-
- /* swap if needed */
- if (minIndex != i + 1)
- {
- RadialArc tmp;
- tmp = ring[i + 1];
- ring[i + 1] = ring[minIndex];
- ring[minIndex] = tmp;
- }
- }
-
- for (i = 0; i < count && symmetric; i++)
- {
- ReebNode *node1, *node2;
- float tangent[3];
- float normal[3];
- float p[3];
- int j = (i + 1) % count; /* next arc in the circular list */
-
- VecAddf(tangent, ring[i].n, ring[j].n);
- Crossf(normal, tangent, axis);
-
- node1 = OTHER_NODE(ring[i].arc, node);
- node2 = OTHER_NODE(ring[j].arc, node);
-
- VECCOPY(p, node2->p);
- mirrorAlongAxis(p, node->p, normal);
-
- /* check if it's within limit before continuing */
- if (VecLenf(node1->p, p) > limit)
- {
- symmetric = 0;
- }
-
- }
-
- if (symmetric)
- {
- /* first pass, merge incrementally */
- for (i = 0; i < count - 1; i++)
- {
- ReebNode *node1, *node2;
- float tangent[3];
- float normal[3];
- int j = i + 1;
-
- VecAddf(tangent, ring[i].n, ring[j].n);
- Crossf(normal, tangent, axis);
-
- node1 = OTHER_NODE(ring[i].arc, node);
- node2 = OTHER_NODE(ring[j].arc, node);
-
- /* mirror first node and mix with the second */
- mirrorAlongAxis(node1->p, node->p, normal);
- VecLerpf(node2->p, node2->p, node1->p, 1.0f / (j + 1));
-
- /* Merge buckets
- * there shouldn't be any null arcs here, but just to be safe
- * */
- if (ring[i].arc->bcount > 0 && ring[j].arc->bcount > 0)
- {
- ReebArcIterator iter1, iter2;
- EmbedBucket *bucket1 = NULL, *bucket2 = NULL;
-
- initArcIterator(&iter1, ring[i].arc, node);
- initArcIterator(&iter2, ring[j].arc, node);
-
- bucket1 = nextBucket(&iter1);
- bucket2 = nextBucket(&iter2);
-
- /* Make sure they both start at the same value */
- while(bucket1 && bucket1->val < bucket2->val)
- {
- bucket1 = nextBucket(&iter1);
- }
-
- while(bucket2 && bucket2->val < bucket1->val)
- {
- bucket2 = nextBucket(&iter2);
- }
-
-
- for ( ;bucket1 && bucket2; bucket1 = nextBucket(&iter1), bucket2 = nextBucket(&iter2))
- {
- bucket2->nv += bucket1->nv; /* add counts */
-
- /* mirror on axis */
- mirrorAlongAxis(bucket1->p, node->p, normal);
- /* add bucket2 in bucket1 */
- VecLerpf(bucket2->p, bucket2->p, bucket1->p, (float)bucket1->nv / (float)(bucket2->nv));
- }
- }
- }
-
- /* second pass, mirror back on previous arcs */
- for (i = count - 1; i > 0; i--)
- {
- ReebNode *node1, *node2;
- float tangent[3];
- float normal[3];
- int j = i - 1;
-
- VecAddf(tangent, ring[i].n, ring[j].n);
- Crossf(normal, tangent, axis);
-
- node1 = OTHER_NODE(ring[i].arc, node);
- node2 = OTHER_NODE(ring[j].arc, node);
-
- /* copy first node than mirror */
- VECCOPY(node2->p, node1->p);
- mirrorAlongAxis(node2->p, node->p, normal);
-
- /* Copy buckets
- * there shouldn't be any null arcs here, but just to be safe
- * */
- if (ring[i].arc->bcount > 0 && ring[j].arc->bcount > 0)
- {
- ReebArcIterator iter1, iter2;
- EmbedBucket *bucket1 = NULL, *bucket2 = NULL;
-
- initArcIterator(&iter1, ring[i].arc, node);
- initArcIterator(&iter2, ring[j].arc, node);
-
- bucket1 = nextBucket(&iter1);
- bucket2 = nextBucket(&iter2);
-
- /* Make sure they both start at the same value */
- while(bucket1 && bucket1->val < bucket2->val)
- {
- bucket1 = nextBucket(&iter1);
- }
-
- while(bucket2 && bucket2->val < bucket1->val)
- {
- bucket2 = nextBucket(&iter2);
- }
-
-
- for ( ;bucket1 && bucket2; bucket1 = nextBucket(&iter1), bucket2 = nextBucket(&iter2))
- {
- /* copy and mirror back to bucket2 */
- bucket2->nv = bucket1->nv;
- VECCOPY(bucket2->p, bucket1->p);
- mirrorAlongAxis(bucket2->p, node->p, normal);
- }
- }
- }
- }
-
- MEM_freeN(ring);
-}
-
-void reestablishAxialSymmetry(ReebNode *node, int depth, float axis[3])
-{
- ReebArc *arc1 = NULL;
- ReebArc *arc2 = NULL;
- ReebNode *node1 = NULL, *node2 = NULL;
- float limit = G.scene->toolsettings->skgen_symmetry_limit;
- float nor[3], vec[3], p[3];
- int i;
-
- for (i = 0; node->arcs[i] != NULL; i++)
- {
- ReebArc *connectedArc = node->arcs[i];
-
- /* depth is store as a negative in flag. symmetry level is positive */
- if (connectedArc->flags == -depth)
- {
- if (arc1 == NULL)
- {
- arc1 = connectedArc;
- node1 = OTHER_NODE(arc1, node);
- }
- else
- {
- arc2 = connectedArc;
- node2 = OTHER_NODE(arc2, node);
- break; /* Can stop now, the two arcs have been found */
- }
- }
- }
-
- /* shouldn't happen, but just to be sure */
- if (node1 == NULL || node2 == NULL)
- {
- return;
- }
-
- VecSubf(p, node1->p, node->p);
- Crossf(vec, p, axis);
- Crossf(nor, vec, axis);
-
- /* mirror node2 along axis */
- VECCOPY(p, node2->p);
- mirrorAlongAxis(p, node->p, nor);
-
- /* check if it's within limit before continuing */
- if (VecLenf(node1->p, p) <= limit)
- {
-
- /* average with node1 */
- VecAddf(node1->p, node1->p, p);
- VecMulf(node1->p, 0.5f);
-
- /* mirror back on node2 */
- VECCOPY(node2->p, node1->p);
- mirrorAlongAxis(node2->p, node->p, nor);
-
- /* Merge buckets
- * there shouldn't be any null arcs here, but just to be safe
- * */
- if (arc1->bcount > 0 && arc2->bcount > 0)
- {
- ReebArcIterator iter1, iter2;
- EmbedBucket *bucket1 = NULL, *bucket2 = NULL;
-
- initArcIterator(&iter1, arc1, node);
- initArcIterator(&iter2, arc2, node);
-
- bucket1 = nextBucket(&iter1);
- bucket2 = nextBucket(&iter2);
-
- /* Make sure they both start at the same value */
- while(bucket1 && bucket1->val < bucket2->val)
- {
- bucket1 = nextBucket(&iter1);
- }
-
- while(bucket2 && bucket2->val < bucket1->val)
- {
- bucket2 = nextBucket(&iter2);
- }
-
-
- for ( ;bucket1 && bucket2; bucket1 = nextBucket(&iter1), bucket2 = nextBucket(&iter2))
- {
- bucket1->nv += bucket2->nv; /* add counts */
-
- /* mirror on axis */
- mirrorAlongAxis(bucket2->p, node->p, nor);
- /* add bucket2 in bucket1 */
- VecLerpf(bucket1->p, bucket1->p, bucket2->p, (float)bucket2->nv / (float)(bucket1->nv));
-
- /* copy and mirror back to bucket2 */
- bucket2->nv = bucket1->nv;
- VECCOPY(bucket2->p, bucket1->p);
- mirrorAlongAxis(bucket2->p, node->p, nor);
- }
- }
- }
-}
-
-void markdownSecondarySymmetry(ReebNode *node, int depth, int level)
-{
- float axis[3] = {0, 0, 0};
- int count = 0;
- int i;
-
- /* Only reestablish spatial symmetry if needed */
- if (G.scene->toolsettings->skgen_options & SKGEN_SYMMETRY)
- {
- /* count the number of branches in this symmetry group
- * and determinte the axis of symmetry
- * */
- for (i = 0; node->arcs[i] != NULL; i++)
- {
- ReebArc *connectedArc = node->arcs[i];
-
- /* depth is store as a negative in flag. symmetry level is positive */
- if (connectedArc->flags == -depth)
- {
- count++;
- }
- /* If arc is on the axis */
- else if (connectedArc->flags == level)
- {
- VecAddf(axis, axis, connectedArc->v1->p);
- VecSubf(axis, axis, connectedArc->v2->p);
- }
- }
-
- Normalize(axis);
-
- /* Split between axial and radial symmetry */
- if (count == 2)
- {
- reestablishAxialSymmetry(node, depth, axis);
- }
- else
- {
- reestablishRadialSymmetry(node, depth, axis);
- }
- }
-
- /* markdown secondary symetries */
- for (i = 0; node->arcs[i] != NULL; i++)
- {
- ReebArc *connectedArc = node->arcs[i];
-
- if (connectedArc->flags == -depth)
- {
- /* markdown symmetry for branches corresponding to the depth */
- markdownSymmetryArc(connectedArc, node, level + 1);
- }
- }
-}
-
-void markdownSymmetryArc(ReebArc *arc, ReebNode *node, int level)
-{
- int i;
- arc->flags = level;
-
- node = OTHER_NODE(arc, node);
-
- for (i = 0; node->arcs[i] != NULL; i++)
- {
- ReebArc *connectedArc = node->arcs[i];
-
- if (connectedArc != arc)
- {
- ReebNode *connectedNode = OTHER_NODE(connectedArc, node);
-
- /* symmetry level is positive value, negative values is subtree depth */
- connectedArc->flags = -subtreeDepth(connectedNode, connectedArc);
- }
- }
-
- arc = NULL;
-
- for (i = 0; node->arcs[i] != NULL; i++)
- {
- int issymmetryAxis = 0;
- ReebArc *connectedArc = node->arcs[i];
-
- /* only arcs not already marked as symetric */
- if (connectedArc->flags < 0)
- {
- int j;
-
- /* true by default */
- issymmetryAxis = 1;
-
- for (j = 0; node->arcs[j] != NULL && issymmetryAxis == 1; j++)
- {
- ReebArc *otherArc = node->arcs[j];
-
- /* different arc, same depth */
- if (otherArc != connectedArc && otherArc->flags == connectedArc->flags)
- {
- /* not on the symmetry axis */
- issymmetryAxis = 0;
- }
- }
- }
-
- /* arc could be on the symmetry axis */
- if (issymmetryAxis == 1)
- {
- /* no arc as been marked previously, keep this one */
- if (arc == NULL)
- {
- arc = connectedArc;
- }
- else
- {
- /* there can't be more than one symmetry arc */
- arc = NULL;
- break;
- }
- }
- }
-
- /* go down the arc continuing the symmetry axis */
- if (arc)
- {
- markdownSymmetryArc(arc, node, level);
- }
-
-
- /* secondary symmetry */
- for (i = 0; node->arcs[i] != NULL; i++)
- {
- ReebArc *connectedArc = node->arcs[i];
-
- /* only arcs not already marked as symetric and is not the next arc on the symmetry axis */
- if (connectedArc->flags < 0)
- {
- /* subtree depth is store as a negative value in the flag */
- markdownSecondarySymmetry(node, -connectedArc->flags, level);
- }
- }
-}
-
-void markdownSymmetry(ReebGraph *rg)
-{
- ReebNode *node;
- ReebArc *arc;
- /* only for Acyclic graphs */
- int cyclic = isGraphCyclic(rg);
-
- /* mark down all arcs as non-symetric */
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
- arc->flags = 0;
- }
-
- /* mark down all nodes as not on the symmetry axis */
- for (node = rg->nodes.first; node; node = node->next)
- {
- node->flags = 0;
- }
-
- /* node list is sorted, so lowest node is always the head (by design) */
- node = rg->nodes.first;
-
- /* only work on acyclic graphs and if only one arc is incident on the first node */
- if (cyclic == 0 && countConnectedArcs(rg, node) == 1)
- {
- arc = node->arcs[0];
-
- markdownSymmetryArc(arc, node, 1);
-
- /* mark down non-symetric arcs */
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
- if (arc->flags < 0)
- {
- arc->flags = 0;
- }
- else
- {
- /* mark down nodes with the lowest level symmetry axis */
- if (arc->v1->flags == 0 || arc->v1->flags > arc->flags)
- {
- arc->v1->flags = arc->flags;
- }
- if (arc->v2->flags == 0 || arc->v2->flags > arc->flags)
- {
- arc->v2->flags = arc->flags;
- }
- }
- }
- }
-}
-
-/**************************************** SUBDIVISION ALGOS ******************************************/
-
-EditBone * subdivideByAngle(ReebArc *arc, ReebNode *head, ReebNode *tail)
-{
- EditBone *lastBone = NULL;
- if (G.scene->toolsettings->skgen_options & SKGEN_CUT_ANGLE)
- {
- ReebArcIterator iter;
- EmbedBucket *current = NULL;
- EmbedBucket *previous = NULL;
- EditBone *child = NULL;
- EditBone *parent = NULL;
- EditBone *root = NULL;
- float angleLimit = (float)cos(G.scene->toolsettings->skgen_angle_limit * M_PI / 180.0f);
-
- parent = add_editbone("Bone");
- parent->flag |= BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL;
- VECCOPY(parent->head, head->p);
-
- root = parent;
-
- for (initArcIterator(&iter, arc, head), previous = nextBucket(&iter), current = nextBucket(&iter);
- current;
- previous = current, current = nextBucket(&iter))
- {
- float vec1[3], vec2[3];
- float len1, len2;
-
- VecSubf(vec1, previous->p, parent->head);
- VecSubf(vec2, current->p, previous->p);
-
- len1 = Normalize(vec1);
- len2 = Normalize(vec2);
-
- if (len1 > 0.0f && len2 > 0.0f && Inpf(vec1, vec2) < angleLimit)
- {
- VECCOPY(parent->tail, previous->p);
-
- child = add_editbone("Bone");
- VECCOPY(child->head, parent->tail);
- child->parent = parent;
- child->flag |= BONE_CONNECTED|BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL;
-
- parent = child; /* new child is next parent */
- }
- }
- VECCOPY(parent->tail, tail->p);
-
- /* If the bone wasn't subdivided, delete it and return NULL
- * to let subsequent subdivision methods do their thing.
- * */
- if (parent == root)
- {
- delete_bone(parent);
- parent = NULL;
- }
-
- lastBone = parent; /* set last bone in the chain */
- }
-
- return lastBone;
-}
-
-float calcCorrelation(ReebArc *arc, int start, int end, float v0[3], float n[3])
-{
- int len = 2 + abs(end - start);
-
- if (len > 2)
- {
- ReebArcIterator iter;
- EmbedBucket *bucket = NULL;
- float avg_t = 0.0f;
- float s_t = 0.0f;
- float s_xyz = 0.0f;
-
- /* First pass, calculate average */
- for (initArcIterator2(&iter, arc, start, end), bucket = nextBucket(&iter);
- bucket;
- bucket = nextBucket(&iter))
- {
- float v[3];
-
- VecSubf(v, bucket->p, v0);
- avg_t += Inpf(v, n);
- }
-
- avg_t /= Inpf(n, n);
- avg_t += 1.0f; /* adding start (0) and end (1) values */
- avg_t /= len;
-
- /* Second pass, calculate s_xyz and s_t */
- for (initArcIterator2(&iter, arc, start, end), bucket = nextBucket(&iter);
- bucket;
- bucket = nextBucket(&iter))
- {
- float v[3], d[3];
- float dt;
-
- VecSubf(v, bucket->p, v0);
- Projf(d, v, n);
- VecSubf(v, v, d);
-
- dt = VecLength(d) - avg_t;
-
- s_t += dt * dt;
- s_xyz += Inpf(v, v);
- }
-
- /* adding start(0) and end(1) values to s_t */
- s_t += (avg_t * avg_t) + (1 - avg_t) * (1 - avg_t);
-
- return 1.0f - s_xyz / s_t;
- }
- else
- {
- return 1.0f;
- }
-}
-
-EditBone * subdivideByCorrelation(ReebArc *arc, ReebNode *head, ReebNode *tail)
-{
- ReebArcIterator iter;
- float n[3];
- float CORRELATION_THRESHOLD = G.scene->toolsettings->skgen_correlation_limit;
- EditBone *lastBone = NULL;
-
- /* init iterator to get start and end from head */
- initArcIterator(&iter, arc, head);
-
- /* Calculate overall */
- VecSubf(n, arc->buckets[iter.end].p, head->p);
-
- if (G.scene->toolsettings->skgen_options & SKGEN_CUT_CORRELATION &&
- calcCorrelation(arc, iter.start, iter.end, head->p, n) < CORRELATION_THRESHOLD)
- {
- EmbedBucket *bucket = NULL;
- EmbedBucket *previous = NULL;
- EditBone *child = NULL;
- EditBone *parent = NULL;
- int boneStart = iter.start;
-
- parent = add_editbone("Bone");
- parent->flag = BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL;
- VECCOPY(parent->head, head->p);
-
- for (previous = nextBucket(&iter), bucket = nextBucket(&iter);
- bucket;
- previous = bucket, bucket = nextBucket(&iter))
- {
- /* Calculate normal */
- VecSubf(n, bucket->p, parent->head);
-
- if (calcCorrelation(arc, boneStart, iter.index, parent->head, n) < CORRELATION_THRESHOLD)
- {
- VECCOPY(parent->tail, previous->p);
-
- child = add_editbone("Bone");
- VECCOPY(child->head, parent->tail);
- child->parent = parent;
- child->flag |= BONE_CONNECTED|BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL;
-
- parent = child; // new child is next parent
- boneStart = iter.index; // start from end
- }
- }
-
- VECCOPY(parent->tail, tail->p);
-
- lastBone = parent; /* set last bone in the chain */
- }
-
- return lastBone;
-}
-
-float arcLengthRatio(ReebArc *arc)
-{
- float arcLength = 0.0f;
- float embedLength = 0.0f;
- int i;
-
- arcLength = VecLenf(arc->v1->p, arc->v2->p);
-
- if (arc->bcount > 0)
- {
- /* Add the embedding */
- for ( i = 1; i < arc->bcount; i++)
- {
- embedLength += VecLenf(arc->buckets[i - 1].p, arc->buckets[i].p);
- }
- /* Add head and tail -> embedding vectors */
- embedLength += VecLenf(arc->v1->p, arc->buckets[0].p);
- embedLength += VecLenf(arc->v2->p, arc->buckets[arc->bcount - 1].p);
- }
- else
- {
- embedLength = arcLength;
- }
-
- return embedLength / arcLength;
-}
-
-EditBone * subdivideByLength(ReebArc *arc, ReebNode *head, ReebNode *tail)
-{
- EditBone *lastBone = NULL;
- if ((G.scene->toolsettings->skgen_options & SKGEN_CUT_LENGTH) &&
- arcLengthRatio(arc) >= G.scene->toolsettings->skgen_length_ratio)
- {
- ReebArcIterator iter;
- EmbedBucket *bucket = NULL;
- EmbedBucket *previous = NULL;
- EditBone *child = NULL;
- EditBone *parent = NULL;
- float lengthLimit = G.scene->toolsettings->skgen_length_limit;
- int same = 0;
-
- parent = add_editbone("Bone");
- parent->flag |= BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL;
- VECCOPY(parent->head, head->p);
-
- initArcIterator(&iter, arc, head);
-
- bucket = nextBucket(&iter);
-
- while (bucket != NULL)
- {
- float *vec0 = NULL;
- float *vec1 = bucket->p;
-
- /* first bucket. Previous is head */
- if (previous == NULL)
- {
- vec0 = head->p;
- }
- /* Previous is a valid bucket */
- else
- {
- vec0 = previous->p;
- }
-
- /* If lengthLimit hits the current segment */
- if (VecLenf(vec1, parent->head) > lengthLimit)
- {
- if (same == 0)
- {
- float dv[3], off[3];
- float a, b, c, f;
-
- /* Solve quadratic distance equation */
- VecSubf(dv, vec1, vec0);
- a = Inpf(dv, dv);
-
- VecSubf(off, vec0, parent->head);
- b = 2 * Inpf(dv, off);
-
- c = Inpf(off, off) - (lengthLimit * lengthLimit);
-
- f = (-b + (float)sqrt(b * b - 4 * a * c)) / (2 * a);
-
- //printf("a %f, b %f, c %f, f %f\n", a, b, c, f);
-
- if (isnan(f) == 0 && f < 1.0f)
- {
- VECCOPY(parent->tail, dv);
- VecMulf(parent->tail, f);
- VecAddf(parent->tail, parent->tail, vec0);
- }
- else
- {
- VECCOPY(parent->tail, vec1);
- }
- }
- else
- {
- float dv[3];
-
- VecSubf(dv, vec1, vec0);
- Normalize(dv);
-
- VECCOPY(parent->tail, dv);
- VecMulf(parent->tail, lengthLimit);
- VecAddf(parent->tail, parent->tail, parent->head);
- }
-
- child = add_editbone("Bone");
- VECCOPY(child->head, parent->tail);
- child->parent = parent;
- child->flag |= BONE_CONNECTED|BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL;
-
- parent = child; // new child is next parent
-
- same = 1; // mark as same
- }
- else
- {
- previous = bucket;
- bucket = nextBucket(&iter);
- same = 0; // Reset same
- }
- }
- VECCOPY(parent->tail, tail->p);
-
- lastBone = parent; /* set last bone in the chain */
- }
-
- return lastBone;
-}
-
-/***************************************** MAIN ALGORITHM ********************************************/
-
-void generateSkeletonFromReebGraph(ReebGraph *rg)
-{
- GHash *arcBoneMap = NULL;
- ReebArc *arc = NULL;
- ReebNode *node = NULL;
- Object *src = NULL;
- Object *dst = NULL;
-
- src = BASACT->object;
-
- if (G.obedit != NULL)
- {
- exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); // freedata, and undo
- }
-
- setcursor_space(SPACE_VIEW3D, CURSOR_WAIT);
-
- dst = add_object(OB_ARMATURE);
- base_init_from_view3d(BASACT, G.vd);
- G.obedit= BASACT->object;
-
- /* Copy orientation from source */
- VECCOPY(dst->loc, src->obmat[3]);
- Mat4ToEul(src->obmat, dst->rot);
- Mat4ToSize(src->obmat, dst->size);
-
- where_is_object(G.obedit);
-
- make_editArmature();
-
- arcBoneMap = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp);
-
- markdownSymmetry(rg);
-
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
- EditBone *lastBone = NULL;
- ReebNode *head, *tail;
- int i;
-
- /* Find out the direction of the arc through simple heuristics (in order of priority) :
- *
- * 1- Arcs on primary symmetry axis (flags == 1) point up (head: high weight -> tail: low weight)
- * 2- Arcs starting on a primary axis point away from it (head: node on primary axis)
- * 3- Arcs point down (head: low weight -> tail: high weight)
- *
- * Finally, the arc direction is stored in its flags: 1 (low -> high), -1 (high -> low)
- */
-
- /* if arc is a symmetry axis, internal bones go up the tree */
- if (arc->flags == 1 && arc->v2->degree != 1)
- {
- head = arc->v2;
- tail = arc->v1;
-
- arc->flags = -1; /* mark arc direction */
- }
- /* Bones point AWAY from the symmetry axis */
- else if (arc->v1->flags == 1)
- {
- head = arc->v1;
- tail = arc->v2;
-
- arc->flags = 1; /* mark arc direction */
- }
- else if (arc->v2->flags == 1)
- {
- head = arc->v2;
- tail = arc->v1;
-
- arc->flags = -1; /* mark arc direction */
- }
- /* otherwise, always go from low weight to high weight */
- else
- {
- head = arc->v1;
- tail = arc->v2;
-
- arc->flags = 1; /* mark arc direction */
- }
-
- /* Loop over subdivision methods */
- for (i = 0; lastBone == NULL && i < SKGEN_SUB_TOTAL; i++)
- {
- switch(G.scene->toolsettings->skgen_subdivisions[i])
- {
- case SKGEN_SUB_LENGTH:
- lastBone = subdivideByLength(arc, head, tail);
- break;
- case SKGEN_SUB_ANGLE:
- lastBone = subdivideByAngle(arc, head, tail);
- break;
- case SKGEN_SUB_CORRELATION:
- lastBone = subdivideByCorrelation(arc, head, tail);
- break;
- }
- }
-
- if (lastBone == NULL)
- {
- EditBone *bone;
- bone = add_editbone("Bone");
- bone->flag |= BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL;
-
- VECCOPY(bone->head, head->p);
- VECCOPY(bone->tail, tail->p);
-
- /* set first and last bone, since there's only one */
- lastBone = bone;
- }
-
- BLI_ghash_insert(arcBoneMap, arc, lastBone);
- }
-
- /* Second pass, setup parent relationship between arcs */
- for (node = rg->nodes.first; node; node = node->next)
- {
- ReebArc *incomingArc = NULL;
- int i;
-
- for (i = 0; node->arcs[i] != NULL; i++)
- {
- arc = node->arcs[i];
-
- /* if arc is incoming into the node */
- if ((arc->v1 == node && arc->flags == -1) || (arc->v2 == node && arc->flags == 1))
- {
- if (incomingArc == NULL)
- {
- incomingArc = arc;
- /* loop further to make sure there's only one incoming arc */
- }
- else
- {
- /* skip this node if more than one incomingArc */
- incomingArc = NULL;
- break; /* No need to look further, we are skipping already */
- }
- }
- }
-
- if (incomingArc != NULL)
- {
- EditBone *parentBone = BLI_ghash_lookup(arcBoneMap, incomingArc);
-
- /* Look for outgoing arcs and parent their bones */
- for (i = 0; node->arcs[i] != NULL; i++)
- {
- arc = node->arcs[i];
-
- /* if arc is outgoing from the node */
- if ((arc->v1 == node && arc->flags == 1) || (arc->v2 == node && arc->flags == -1))
- {
- EditBone *childBone = BLI_ghash_lookup(arcBoneMap, arc);
-
- /* find the root bone */
- while(childBone->parent != NULL)
- {
- childBone = childBone->parent;
- }
-
- childBone->parent = parentBone;
- childBone->flag |= BONE_CONNECTED;
- }
- }
- }
- }
-
- BLI_ghash_free(arcBoneMap, NULL, NULL);
-
- setcursor_space(SPACE_VIEW3D, CURSOR_EDIT);
-
- BIF_undo_push("Generate Skeleton");
-}
-
-void generateSkeleton(void)
-{
- EditMesh *em = G.editMesh;
- ReebGraph *rg = NULL;
- int i;
-
- if (em == NULL)
- return;
-
- setcursor_space(SPACE_VIEW3D, CURSOR_WAIT);
-
- if (weightFromDistance(em) == 0)
- {
- error("No selected vertex\n");
- return;
- }
-
- weightToHarmonic(em);
-
- renormalizeWeight(em, 1.0f);
-
-//#ifdef DEBUG_REEB
- weightToVCol(em);
-//#endif
-
- rg = generateReebGraph(em, G.scene->toolsettings->skgen_resolution);
-
- verifyBuckets(rg);
-
- /* Remove arcs without embedding */
- filterNullReebGraph(rg);
-
- verifyBuckets(rg);
-
-
- i = 1;
- /* filter until there's nothing more to do */
- while (i == 1)
- {
- i = 0; /* no work done yet */
-
- if (G.scene->toolsettings->skgen_options & SKGEN_FILTER_EXTERNAL)
- {
- i |= filterExternalReebGraph(rg, G.scene->toolsettings->skgen_threshold_external * G.scene->toolsettings->skgen_resolution);
- }
-
- verifyBuckets(rg);
-
- if (G.scene->toolsettings->skgen_options & SKGEN_FILTER_INTERNAL)
- {
- i |= filterInternalReebGraph(rg, G.scene->toolsettings->skgen_threshold_internal * G.scene->toolsettings->skgen_resolution);
- }
- }
-
- verifyBuckets(rg);
-
- repositionNodes(rg);
-
- verifyBuckets(rg);
-
- /* Filtering might have created degree 2 nodes, so remove them */
- removeNormalNodes(rg);
-
- verifyBuckets(rg);
-
- for(i = 0; i < G.scene->toolsettings->skgen_postpro_passes; i++)
- {
- postprocessGraph(rg, G.scene->toolsettings->skgen_postpro);
- }
-
- buildAdjacencyList(rg);
-
- sortNodes(rg);
-
- sortArcs(rg);
-
- generateSkeletonFromReebGraph(rg);
-
- freeGraph(rg);
-}
diff --git a/source/blender/src/editconstraint.c b/source/blender/src/editconstraint.c
deleted file mode 100644
index e0588b4c2a0..00000000000
--- a/source/blender/src/editconstraint.c
+++ /dev/null
@@ -1,1103 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdio.h>
-#include <string.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "DNA_action_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_text_types.h"
-#include "DNA_view3d_types.h"
-
-#include "BKE_action.h"
-#include "BKE_armature.h"
-#include "BKE_constraint.h"
-#include "BKE_depsgraph.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_ipo.h"
-#include "BKE_object.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_editaction.h"
-#include "BIF_editarmature.h"
-#include "BIF_editconstraint.h"
-#include "BIF_poseobject.h"
-#include "BIF_interface.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-
-#include "BPY_extern.h"
-
-#include "blendef.h"
-#include "nla.h"
-#include "mydevice.h"
-
-
-ListBase *get_active_constraint_channels (Object *ob, int forcevalid)
-{
- char ipstr[64];
-
- if (!ob)
- return NULL;
-
- /* See if we are a bone constraint */
- if (ob->flag & OB_POSEMODE) {
- bActionChannel *achan;
- bPoseChannel *pchan;
-
- pchan = get_active_posechannel(ob);
- if (pchan) {
-
- /* Make sure we have an action */
- if (!ob->action){
- if (!forcevalid)
- return NULL;
-
- ob->action=add_empty_action("Action");
- }
-
- /* Make sure we have an actionchannel */
- achan = get_action_channel(ob->action, pchan->name);
- if (!achan){
- if (!forcevalid)
- return NULL;
-
- achan = MEM_callocN (sizeof(bActionChannel), "actionChannel");
-
- strcpy (achan->name, pchan->name);
- sprintf (ipstr, "%s.%s", ob->action->id.name+2, achan->name);
- ipstr[23]=0;
- achan->ipo= add_ipo(ipstr, ID_AC);
-
- BLI_addtail (&ob->action->chanbase, achan);
- }
-
- return &achan->constraintChannels;
- }
- else return NULL;
- }
- /* else we return object constraints */
- else {
- if(ob->ipoflag & OB_ACTION_OB) {
- bActionChannel *achan = get_action_channel(ob->action, "Object");
- if(achan)
- return &achan->constraintChannels;
- else
- return NULL;
- }
-
- return &ob->constraintChannels;
- }
-}
-
-
-/* if object in posemode, active bone constraints, else object constraints */
-ListBase *get_active_constraints(Object *ob)
-{
- if (!ob)
- return NULL;
-
- if (ob->flag & OB_POSEMODE) {
- bPoseChannel *pchan;
-
- pchan = get_active_posechannel(ob);
- if (pchan)
- return &pchan->constraints;
- }
- else
- return &ob->constraints;
-
- return NULL;
-}
-
-/* single constraint */
-bConstraint *get_active_constraint(Object *ob)
-{
- ListBase *lb= get_active_constraints(ob);
-
- if (lb) {
- bConstraint *con;
- for (con= lb->first; con; con=con->next)
- if (con->flag & CONSTRAINT_ACTIVE)
- return con;
- }
- return NULL;
-}
-
-/* single channel, for ipo */
-bConstraintChannel *get_active_constraint_channel(Object *ob)
-{
- bConstraint *con;
- bConstraintChannel *chan;
-
- if (ob->flag & OB_POSEMODE) {
- if(ob->action) {
- bPoseChannel *pchan;
-
- pchan = get_active_posechannel(ob);
- if (pchan) {
- for (con= pchan->constraints.first; con; con= con->next)
- if (con->flag & CONSTRAINT_ACTIVE)
- break;
- if (con) {
- bActionChannel *achan = get_action_channel(ob->action, pchan->name);
- if (achan) {
- for (chan= achan->constraintChannels.first; chan; chan= chan->next)
- if (!strcmp(chan->name, con->name))
- break;
- return chan;
- }
- }
- }
- }
- }
- else {
- for(con= ob->constraints.first; con; con= con->next)
- if(con->flag & CONSTRAINT_ACTIVE)
- break;
- if(con) {
- ListBase *lb= get_active_constraint_channels(ob, 0);
-
- if(lb) {
- for(chan= lb->first; chan; chan= chan->next)
- if(!strcmp(chan->name, con->name))
- break;
- return chan;
- }
- }
- }
-
- return NULL;
-}
-
-
-bConstraint *add_new_constraint(short type)
-{
- bConstraint *con;
- bConstraintTypeInfo *cti;
-
- con = MEM_callocN(sizeof(bConstraint), "constraint");
-
- /* Set up a generic constraint datablock */
- con->type = type;
- con->flag |= CONSTRAINT_EXPAND;
- con->enforce = 1.0F;
- strcpy(con->name, "Const");
-
- /* Load the data for it */
- cti = constraint_get_typeinfo(con);
- if (cti) {
- con->data = MEM_callocN(cti->size, cti->structName);
-
- /* only constraints that change any settings need this */
- if (cti->new_data)
- cti->new_data(con->data);
- }
-
- return con;
-}
-
-void add_constraint_to_object(bConstraint *con, Object *ob)
-{
- ListBase *list;
- list = &ob->constraints;
-
- if (list) {
- unique_constraint_name(con, list);
- BLI_addtail(list, con);
-
- con->flag |= CONSTRAINT_ACTIVE;
- for (con= con->prev; con; con= con->prev)
- con->flag &= ~CONSTRAINT_ACTIVE;
- }
-}
-
-/* checks validity of object pointers, and NULLs,
- * if Bone doesnt exist it sets the CONSTRAINT_DISABLE flag
- */
-static void test_constraints (Object *owner, const char substring[])
-{
-
- bConstraint *curcon;
- ListBase *conlist= NULL;
- int type;
-
- if (owner==NULL) return;
-
- /* Check parents */
- /* Get the constraint list for this object */
-
- if (strlen (substring)) {
- switch (owner->type) {
- case OB_ARMATURE:
- type = CONSTRAINT_OBTYPE_BONE;
- break;
- default:
- type = CONSTRAINT_OBTYPE_OBJECT;
- break;
- }
- }
- else
- type = CONSTRAINT_OBTYPE_OBJECT;
-
-
- switch (type) {
- case CONSTRAINT_OBTYPE_OBJECT:
- conlist = &owner->constraints;
- break;
- case CONSTRAINT_OBTYPE_BONE:
- {
- Bone *bone;
- bPoseChannel *chan;
-
- bone = get_named_bone( ((bArmature *)owner->data ), substring );
- chan = get_pose_channel(owner->pose, substring);
- if (bone && chan) {
- conlist = &chan->constraints;
- }
- }
- break;
- }
-
- /* Check all constraints - is constraint valid? */
- if (conlist) {
- for (curcon = conlist->first; curcon; curcon=curcon->next) {
- curcon->flag &= ~CONSTRAINT_DISABLE;
-
- switch (curcon->type) {
- case CONSTRAINT_TYPE_PYTHON:
- {
- bPythonConstraint *data = curcon->data;
-
- /* is there are valid script? */
- if (!data->text) {
- curcon->flag |= CONSTRAINT_DISABLE;
- break;
- }
- else if (!BPY_is_pyconstraint(data->text)) {
- curcon->flag |= CONSTRAINT_DISABLE;
- break;
- }
-
- /* does the constraint require target input... also validates targets */
- BPY_pyconstraint_update(owner, curcon);
- }
- break;
- case CONSTRAINT_TYPE_ACTION:
- {
- bActionConstraint *data = curcon->data;
-
- if (!exist_object(data->tar)) {
- data->tar = NULL;
- curcon->flag |= CONSTRAINT_DISABLE;
- break;
- }
-
- if ( (data->tar == owner) &&
- (!get_named_bone(get_armature(owner),
- data->subtarget))) {
- curcon->flag |= CONSTRAINT_DISABLE;
- break;
- }
- }
- break;
- case CONSTRAINT_TYPE_LOCLIKE:
- {
- bLocateLikeConstraint *data = curcon->data;
-
- if (!exist_object(data->tar)) {
- data->tar = NULL;
- curcon->flag |= CONSTRAINT_DISABLE;
- break;
- }
-
- if ( (data->tar == owner) &&
- (!get_named_bone(get_armature(owner),
- data->subtarget))) {
- curcon->flag |= CONSTRAINT_DISABLE;
- break;
- }
- }
- break;
- case CONSTRAINT_TYPE_MINMAX:
- {
- bMinMaxConstraint *data = curcon->data;
-
- if (!exist_object(data->tar)) {
- data->tar = NULL;
- curcon->flag |= CONSTRAINT_DISABLE;
- break;
- }
-
- if ( (data->tar == owner) &&
- (!get_named_bone(get_armature(owner),
- data->subtarget))) {
- curcon->flag |= CONSTRAINT_DISABLE;
- break;
- }
- }
- break;
- case CONSTRAINT_TYPE_ROTLIKE:
- {
- bRotateLikeConstraint *data = curcon->data;
-
- if (!exist_object(data->tar)) {
- data->tar = NULL;
- curcon->flag |= CONSTRAINT_DISABLE;
- break;
- }
-
- if ( (data->tar == owner) &&
- (!get_named_bone(get_armature(owner),
- data->subtarget))) {
- curcon->flag |= CONSTRAINT_DISABLE;
- break;
- }
- }
- break;
- case CONSTRAINT_TYPE_SIZELIKE:
- {
- bSizeLikeConstraint *data = curcon->data;
-
- if (!exist_object(data->tar)) {
- data->tar = NULL;
- curcon->flag |= CONSTRAINT_DISABLE;
- break;
- }
-
- if ( (data->tar == owner) &&
- (!get_named_bone(get_armature(owner),
- data->subtarget))) {
- curcon->flag |= CONSTRAINT_DISABLE;
- break;
- }
- }
- break;
- case CONSTRAINT_TYPE_KINEMATIC:
- {
- bKinematicConstraint *data = curcon->data;
-
- if (!exist_object(data->tar)) {
- data->tar = NULL;
- curcon->flag |= CONSTRAINT_DISABLE;
- }
- else if ( (data->tar == owner) &&
- (!get_named_bone(get_armature(owner),
- data->subtarget))) {
- curcon->flag |= CONSTRAINT_DISABLE;
- }
-
- if (data->poletar && !exist_object(data->poletar)) {
- data->poletar = NULL;
- }
- else if ( (data->poletar == owner) &&
- (!get_named_bone(get_armature(owner),
- data->polesubtarget))) {
- curcon->flag |= CONSTRAINT_DISABLE;
- }
-
- }
- break;
- case CONSTRAINT_TYPE_TRACKTO:
- {
- bTrackToConstraint *data = curcon->data;
- if (!exist_object(data->tar)) {
- data->tar = NULL;
- curcon->flag |= CONSTRAINT_DISABLE;
- break;
- }
-
- if ( (data->tar == owner) &&
- (!get_named_bone(get_armature(owner),
- data->subtarget))) {
- curcon->flag |= CONSTRAINT_DISABLE;
- break;
- }
- if (data->reserved2==data->reserved1) {
- curcon->flag |= CONSTRAINT_DISABLE;
- break;
- }
- if (data->reserved2+3==data->reserved1) {
- curcon->flag |= CONSTRAINT_DISABLE;
- break;
- }
- }
- break;
- case CONSTRAINT_TYPE_LOCKTRACK:
- {
- bLockTrackConstraint *data = curcon->data;
-
- if (!exist_object(data->tar)) {
- data->tar = NULL;
- curcon->flag |= CONSTRAINT_DISABLE;
- break;
- }
-
- if ( (data->tar == owner) &&
- (!get_named_bone(get_armature(owner),
- data->subtarget))) {
- curcon->flag |= CONSTRAINT_DISABLE;
- break;
- }
-
- if (data->lockflag==data->trackflag) {
- curcon->flag |= CONSTRAINT_DISABLE;
- break;
- }
- if (data->lockflag+3==data->trackflag) {
- curcon->flag |= CONSTRAINT_DISABLE;
- break;
- }
- }
- break;
- case CONSTRAINT_TYPE_STRETCHTO:
- {
- bStretchToConstraint *data = curcon->data;
-
- if (!exist_object(data->tar)) {
- data->tar = NULL;
- curcon->flag |= CONSTRAINT_DISABLE;
- break;
- }
-
- if ( (data->tar == owner) &&
- (!get_named_bone(get_armature(owner),
- data->subtarget))) {
- curcon->flag |= CONSTRAINT_DISABLE;
- break;
- }
- }
- break;
- case CONSTRAINT_TYPE_FOLLOWPATH:
- {
- bFollowPathConstraint *data = curcon->data;
-
- if (!exist_object(data->tar)) {
- data->tar = NULL;
- curcon->flag |= CONSTRAINT_DISABLE;
- break;
- }
- if (data->tar->type != OB_CURVE) {
- data->tar = NULL;
- curcon->flag |= CONSTRAINT_DISABLE;
- break;
- }
- if (data->upflag==data->trackflag) {
- curcon->flag |= CONSTRAINT_DISABLE;
- break;
- }
- if (data->upflag+3==data->trackflag) {
- curcon->flag |= CONSTRAINT_DISABLE;
- break;
- }
- }
- break;
- case CONSTRAINT_TYPE_CLAMPTO:
- {
- bClampToConstraint *data = curcon->data;
-
- if (!exist_object(data->tar)) {
- data->tar = NULL;
- curcon->flag |= CONSTRAINT_DISABLE;
- break;
- }
-
- if (data->tar->type != OB_CURVE) {
- data->tar = NULL;
- curcon->flag |= CONSTRAINT_DISABLE;
- break;
- }
- else {
- Curve *cu= data->tar->data;
-
- /* auto-set 'Path' setting on curve so this works */
- cu->flag |= CU_PATH;
- }
- }
- break;
- case CONSTRAINT_TYPE_TRANSFORM:
- {
- bTransformConstraint *data = curcon->data;
-
- if (!exist_object(data->tar)) {
- data->tar = NULL;
- curcon->flag |= CONSTRAINT_DISABLE;
- break;
- }
-
- if ( (data->tar == owner) &&
- (!get_named_bone(get_armature(owner),
- data->subtarget))) {
- curcon->flag |= CONSTRAINT_DISABLE;
- break;
- }
- }
- break;
- }
- }
- }
-}
-
-static void test_bonelist_constraints (Object *owner, ListBase *list)
-{
- Bone *bone;
-
- for (bone = list->first; bone; bone=bone->next) {
-
- test_constraints(owner, bone->name);
- test_bonelist_constraints (owner, &bone->childbase);
- }
-}
-
-void object_test_constraints (Object *owner)
-{
- test_constraints(owner, "");
-
- if(owner->type==OB_ARMATURE) {
- bArmature *arm;
- arm = get_armature(owner);
- if (arm)
- test_bonelist_constraints (owner, &arm->bonebase);
- }
-
-}
-
-/* helper function for add_constriant - sets the last target for the active constraint */
-static void set_constraint_nth_target(bConstraint *con, Object *target, char subtarget[], int index)
-{
- bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
- ListBase targets = {NULL, NULL};
- bConstraintTarget *ct;
- int num_targets, i;
-
- if (cti && cti->get_constraint_targets) {
- cti->get_constraint_targets(con, &targets);
- num_targets= BLI_countlist(&targets);
-
- if (index < 0) {
- if (abs(index) < num_targets)
- index= num_targets - abs(index);
- else
- index= num_targets - 1;
- }
- else if (index >= num_targets) {
- index= num_targets - 1;
- }
-
- for (ct=targets.first, i=0; ct; ct= ct->next, i++) {
- if (i == index) {
- ct->tar= target;
- strcpy(ct->subtarget, subtarget);
- break;
- }
- }
-
- if (cti->flush_constraint_targets)
- cti->flush_constraint_targets(con, &targets, 0);
- }
-}
-
-/* context: active object in posemode, active channel, optional selected channel */
-void add_constraint(int only_IK)
-{
- Object *ob= OBACT, *obsel=NULL;
- bPoseChannel *pchanact=NULL, *pchansel=NULL;
- bConstraint *con=NULL;
- Base *base;
- short nr;
-
- /* paranoia checks */
- if(ob==NULL || ob==G.obedit) return;
-
- if(ob->pose && (ob->flag & OB_POSEMODE)) {
- bArmature *arm= ob->data;
-
- /* find active channel */
- pchanact= get_active_posechannel(ob);
- if(pchanact==NULL) return;
-
- /* check protection */
- if(ob->proxy && (pchanact->bone->layer & arm->layer_protected)) {
- error("Bone is Proxy protected");
- return;
- }
-
- /* find selected bone */
- for(pchansel= ob->pose->chanbase.first; pchansel; pchansel= pchansel->next) {
- if(pchansel!=pchanact)
- if(pchansel->bone->flag & BONE_SELECTED)
- if(pchansel->bone->layer & arm->layer)
- break;
- }
- }
-
- /* find selected object */
- for(base= FIRSTBASE; base; base= base->next)
- if( TESTBASE(base) && base->object!=ob )
- obsel= base->object;
-
- /* the only_IK caller has checked for posemode! */
- if(only_IK) {
- for(con= pchanact->constraints.first; con; con= con->next) {
- if(con->type==CONSTRAINT_TYPE_KINEMATIC) break;
- }
- if(con) {
- error("Pose Channel already has IK");
- return;
- }
-
- if(pchansel)
- nr= pupmenu("Add IK Constraint%t|To Active Bone%x10");
- else if(obsel)
- nr= pupmenu("Add IK Constraint%t|To Active Object%x10");
- else
- nr= pupmenu("Add IK Constraint%t|To New Empty Object%x10|Without Target%x11");
- }
- else {
- if(pchanact) {
- if(pchansel)
- nr= pupmenu("Add Constraint to Active Bone%t|Child Of%x19|Transformation%x20|%l|Copy Location%x1|Copy Rotation%x2|Copy Scale%x8|%l|Limit Location%x13|Limit Rotation%x14|Limit Scale%x15|%l|Track To%x3|Floor%x4|Locked Track%x5|Stretch To%x7|%l|Action%x16|Script%x18");
- else if(obsel && obsel->type==OB_CURVE)
- nr= pupmenu("Add Constraint to Active Object%t|Child Of%x19|Transformation%x20|%l|Copy Location%x1|Copy Rotation%x2|Copy Scale%x8|%l|Limit Location%x13|Limit Rotation%x14|Limit Scale%x15|%l|Track To%x3|Floor%x4|Locked Track%x5|Follow Path%x6|Clamp To%x17|Stretch To%x7|%l|Action%x16|Script%x18");
- else if(obsel)
- nr= pupmenu("Add Constraint to Active Object%t|Child Of%x19|Transformation%x20|%l|Copy Location%x1|Copy Rotation%x2|Copy Scale%x8|%l|Limit Location%x13|Limit Rotation%x14|Limit Scale%x15|%l|Track To%x3|Floor%x4|Locked Track%x5|Stretch To%x7|%l|Action%x16|Script%x18");
- else
- nr= pupmenu("Add Constraint to New Empty Object%t|Child Of%x19|Transformation%x20|%l|Copy Location%x1|Copy Rotation%x2|Copy Scale%x8|%l|Limit Location%x13|Limit Rotation%x14|Limit Scale%x15|%l|Track To%x3|Floor%x4|Locked Track%x5|Stretch To%x7|%l|Action%x16|Script%x18");
- }
- else {
- if(obsel && obsel->type==OB_CURVE)
- nr= pupmenu("Add Constraint to Active Object%t|Child Of%x19|Transformation%x20|%l|Copy Location%x1|Copy Rotation%x2|Copy Scale%x8|%l|Limit Location%x13|Limit Rotation%x14|Limit Scale%x15|%l|Track To%x3|Floor%x4|Locked Track%x5|Follow Path%x6|Clamp To%x17|%l|Action%x16|Script%x18");
- else if(obsel)
- nr= pupmenu("Add Constraint to Active Object%t|Child Of%x19|Transformation%x20|%l|Copy Location%x1|Copy Rotation%x2|Copy Scale%x8|%l|Limit Location%x13|Limit Rotation%x14|Limit Scale%x15|%l|Track To%x3|Floor%x4|Locked Track%x5|%l|Action%x16|Script%x18");
- else
- nr= pupmenu("Add Constraint to New Empty Object%t|Child Of%x19|Transformation%x20|%l|Copy Location%x1|Copy Rotation%x2|Copy Scale%x8|%l|Limit Location%x13|Limit Rotation%x14|Limit Scale%x15|%l|Track To%x3|Floor%x4|Locked Track%x5|%l|Action%x16|Script%x18");
- }
- }
-
- if(nr<1) return;
-
- /* handle IK separate */
- if(nr==10 || nr==11) {
-
- /* prevent weird chains... */
- if(pchansel) {
- bPoseChannel *pchan= pchanact;
- while(pchan) {
- if(pchan==pchansel) break;
- pchan= pchan->parent;
- }
- if(pchan) {
- error("IK root cannot be linked to IK tip");
- return;
- }
- pchan= pchansel;
- while(pchan) {
- if(pchan==pchanact) break;
- pchan= pchan->parent;
- }
- if(pchan) {
- error("IK tip cannot be linked to IK root");
- return;
- }
- }
-
- con = add_new_constraint(CONSTRAINT_TYPE_KINEMATIC);
- BLI_addtail(&pchanact->constraints, con);
- unique_constraint_name(con, &pchanact->constraints);
- pchanact->constflag |= PCHAN_HAS_IK; // for draw, but also for detecting while pose solving
- if(nr==11) pchanact->constflag |= PCHAN_HAS_TARGET;
- }
- else {
-
- if (nr==1) con = add_new_constraint(CONSTRAINT_TYPE_LOCLIKE);
- else if (nr==2) con = add_new_constraint(CONSTRAINT_TYPE_ROTLIKE);
- else if (nr==3) con = add_new_constraint(CONSTRAINT_TYPE_TRACKTO);
- else if (nr==4) con = add_new_constraint(CONSTRAINT_TYPE_MINMAX);
- else if (nr==5) con = add_new_constraint(CONSTRAINT_TYPE_LOCKTRACK);
- else if (nr==6) {
- Curve *cu= obsel->data;
- cu->flag |= CU_PATH;
- con = add_new_constraint(CONSTRAINT_TYPE_FOLLOWPATH);
- }
- else if (nr==7) con = add_new_constraint(CONSTRAINT_TYPE_STRETCHTO);
- else if (nr==8) con = add_new_constraint(CONSTRAINT_TYPE_SIZELIKE);
- else if (nr==13) con = add_new_constraint(CONSTRAINT_TYPE_LOCLIMIT);
- else if (nr==14) con = add_new_constraint(CONSTRAINT_TYPE_ROTLIMIT);
- else if (nr==15) con = add_new_constraint(CONSTRAINT_TYPE_SIZELIMIT);
- else if (nr==16) {
- /* TODO: add a popup-menu to display list of available actions to use (like for pyconstraints) */
- con = add_new_constraint(CONSTRAINT_TYPE_ACTION);
- }
- else if (nr==17) {
- Curve *cu= obsel->data;
- cu->flag |= CU_PATH;
- con = add_new_constraint(CONSTRAINT_TYPE_CLAMPTO);
- }
- else if (nr==18) {
- char *menustr;
- int scriptint= 0;
-
- /* popup a list of usable scripts */
- menustr = buildmenu_pyconstraints(NULL, &scriptint);
- scriptint = pupmenu(menustr);
- MEM_freeN(menustr);
-
- /* only add constraint if a script was chosen */
- if (scriptint) {
- /* add constraint */
- con = add_new_constraint(CONSTRAINT_TYPE_PYTHON);
- validate_pyconstraint_cb(con->data, &scriptint);
-
- /* make sure target allowance is set correctly */
- BPY_pyconstraint_update(ob, con);
- }
- }
- else if (nr==19) {
- con = add_new_constraint(CONSTRAINT_TYPE_CHILDOF);
-
- /* if this constraint is being added to a posechannel, make sure
- * the constraint gets evaluated in pose-space
- */
- if (pchanact) {
- con->ownspace = CONSTRAINT_SPACE_POSE;
- con->flag |= CONSTRAINT_SPACEONCE;
- }
- }
- else if (nr==20) con = add_new_constraint(CONSTRAINT_TYPE_TRANSFORM);
-
- if (con==NULL) return; /* paranoia */
-
- if (pchanact) {
- BLI_addtail(&pchanact->constraints, con);
- unique_constraint_name(con, &pchanact->constraints);
- pchanact->constflag |= PCHAN_HAS_CONST; /* for draw */
- }
- else {
- BLI_addtail(&ob->constraints, con);
- unique_constraint_name(con, &ob->constraints);
- }
- }
-
- /* set the target */
- if (pchansel) {
- set_constraint_nth_target(con, ob, pchansel->name, 0);
- }
- else if(obsel) {
- set_constraint_nth_target(con, obsel, "", 0);
- }
- else if (ELEM4(nr, 11, 13, 14, 15)==0) { /* add new empty as target */
- Base *base= BASACT, *newbase;
- Object *obt;
-
- obt= add_object(OB_EMPTY);
- /* set layers OK */
- newbase= BASACT;
- newbase->lay= base->lay;
- obt->lay= newbase->lay;
-
- /* transform cent to global coords for loc */
- if (pchanact) {
- if(only_IK)
- VecMat4MulVecfl(obt->loc, ob->obmat, pchanact->pose_tail);
- else
- VecMat4MulVecfl(obt->loc, ob->obmat, pchanact->pose_head);
- }
- else
- VECCOPY(obt->loc, ob->obmat[3]);
-
- set_constraint_nth_target(con, obt, "", 0);
-
- /* restore, add_object sets active */
- BASACT= base;
- base->flag |= SELECT;
- }
-
- /* active flag */
- con->flag |= CONSTRAINT_ACTIVE;
- for(con= con->prev; con; con= con->prev)
- con->flag &= ~CONSTRAINT_ACTIVE;
-
- DAG_scene_sort(G.scene); // sort order of objects
-
- if (pchanact) {
- ob->pose->flag |= POSE_RECALC; // sort pose channels
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); // and all its relations
- }
- else
- DAG_object_flush_update(G.scene, ob, OB_RECALC_OB); // and all its relations
-
- allqueue (REDRAWVIEW3D, 0);
- allqueue (REDRAWBUTSOBJECT, 0);
- allqueue (REDRAWOOPS, 0);
-
- if (only_IK)
- BIF_undo_push("Add IK Constraint");
- else
- BIF_undo_push("Add Constraint");
-
-}
-
-void ob_clear_constraints(void)
-{
- Object *ob= OBACT;
-
- /* paranoia checks */
- if(!ob) return;
- if(ob==G.obedit || (ob->flag & OB_POSEMODE)) return;
-
- if(okee("Clear Constraints")==0) return;
-
- free_constraints(&ob->constraints);
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
-
- allqueue (REDRAWVIEW3D, 0);
- allqueue (REDRAWBUTSOBJECT, 0);
- allqueue (REDRAWOOPS, 0);
-
- BIF_undo_push("Clear Constraint(s)");
-
-}
-
-/* con already has the new name */
-void rename_constraint(Object *ob, bConstraint *con, char *oldname)
-{
- bConstraint *tcon;
- bConstraintChannel *conchan;
- ListBase *conlist= NULL;
- int from_object= 0;
- char *channame="";
-
- /* get context by searching for con (primitive...) */
- for(tcon= ob->constraints.first; tcon; tcon= tcon->next)
- if(tcon==con)
- break;
-
- if(tcon) {
- conlist= &ob->constraints;
- channame= "Object";
- from_object= 1;
- }
- else if(ob->pose) {
- bPoseChannel *pchan;
-
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- for(tcon= pchan->constraints.first; tcon; tcon= tcon->next) {
- if(tcon==con)
- break;
- }
- if(tcon)
- break;
- }
- if(tcon) {
- conlist= &pchan->constraints;
- channame= pchan->name;
- }
- }
-
- if(conlist==NULL) {
- printf("rename constraint failed\n"); /* should not happen in UI */
- return;
- }
-
- /* first make sure it's a unique name within context */
- unique_constraint_name (con, conlist);
-
- /* own channels */
- if(from_object) {
- for(conchan= ob->constraintChannels.first; conchan; conchan= conchan->next) {
- if( strcmp(oldname, conchan->name)==0 )
- BLI_strncpy(conchan->name, con->name, sizeof(conchan->name));
- }
- }
- /* own action */
- if(ob->action) {
- bActionChannel *achan= get_action_channel(ob->action, channame);
- if(achan) {
- conchan= get_constraint_channel(&achan->constraintChannels, oldname);
- if(conchan)
- BLI_strncpy(conchan->name, con->name, sizeof(conchan->name));
- }
- }
-
-}
-
-/* ********************** CONSTRAINT-SPECIFIC STUFF ********************* */
-/* ------------- PyConstraints ------------------ */
-
-/* this callback sets the text-file to be used for selected menu item */
-void validate_pyconstraint_cb(void *arg1, void *arg2)
-{
- bPythonConstraint *data = arg1;
- Text *text;
- int index = *((int *)arg2);
- int i;
-
- /* innovative use of a for...loop to search */
- for (text=G.main->text.first, i=1; text && index!=i; i++, text=text->id.next);
- data->text = text;
-}
-
-/* this returns a string for the list of usable pyconstraint script names */
-char *buildmenu_pyconstraints(Text *con_text, int *pyconindex)
-{
- Text *text;
- char *menustr = MEM_callocN(128, "menustr pyconstraints");
- char *name, stmp[128];
- int buf = 128;
- int used = strlen("Scripts: %t") + 1;
- int i;
-
- sprintf(menustr, "%s", "Scripts: %t");
-
- for (text=G.main->text.first, i=1; text; i++, text=text->id.next) {
- /* this is important to ensure that right script is shown as active */
- if (text == con_text) *pyconindex = i;
-
- /* menu entry is length of name + 3(len(|%X)) + 6 characters for the int.*/
- if (BPY_is_pyconstraint(text)) {
- name= text->id.name;
- if (strlen(name)+used+10 >= buf) {
- char *newbuf = MEM_callocN(buf+128, "menustr pyconstraints 2");
- memcpy(newbuf, menustr, used);
- MEM_freeN(menustr);
- menustr = newbuf;
- buf += 128;
- }
- sprintf(stmp, "|%s%%x%d", name, i);
- strcat(menustr, stmp);
- used += strlen(name)+10;
- }
- }
-
- return menustr;
-}
-
-/* this callback gets called when the 'refresh' button of a pyconstraint gets pressed */
-void update_pyconstraint_cb(void *arg1, void *arg2)
-{
- Object *owner= (Object *)arg1;
- bConstraint *con= (bConstraint *)arg2;
-
- if (owner && con)
- BPY_pyconstraint_update(owner, con);
-}
-
-/* ------------- Child-Of Constraint ------------------ */
-
-/* ChildOf Constraint - set inverse callback */
-void childof_const_setinv (void *conv, void *unused)
-{
- bChildOfConstraint *data= (bChildOfConstraint *)conv;
- Object *ob= OBACT;
- bPoseChannel *pchan= NULL;
-
- /* try to find a pose channel */
- if (ob && ob->pose)
- pchan= get_active_posechannel(ob);
-
- /* calculate/set inverse matrix */
- if (pchan) {
- bConstraintOb *cob;
- float ctime= bsystem_time(ob, (float)G.scene->r.cfra, 0.0); /* not accurate... */
- float pmat[4][4], chmat[4][4], cimat[4][4];
- float vec0[3]={0,0,0}, vec1[3]={1,1,1};
-
- /* make copies of pchan's original matrices (to be restored later) */
- Mat4CpyMat4(pmat, pchan->pose_mat);
- Mat4CpyMat4(chmat, pchan->chan_mat);
- Mat4CpyMat4(cimat, pchan->constinv);
-
-
- /* clear pchan's transform (for constraint solving) */
- LocEulSizeToMat4(pchan->chan_mat, vec0, vec0, vec1);
- Mat4MulMat4(pchan->pose_mat, pmat, cimat);
- Mat4One(pchan->constinv);
- Mat4One(data->invmat);
-
-
- /* do constraint solving on pose-matrix containing no transforms
- * N.B. code is copied from armature.c (where_is_pose_bone)
- */
- cob= constraints_make_evalob(ob, pchan, CONSTRAINT_OBTYPE_BONE);
- solve_constraints(&pchan->constraints, cob, ctime);
- constraints_clear_evalob(cob);
-
-
- /* parent-inverse matrix for this constraint is given by taking the
- * local-space (i.e. without any standard parents + restpose) pose_matrix
- * (that was calulated with no transforms applied), and inverting it.
- */
- Mat4CpyMat4(pchan->constinv, pchan->pose_mat);
-
- constraint_mat_convertspace(ob, pchan, pchan->constinv,
- CONSTRAINT_SPACE_POSE, CONSTRAINT_SPACE_LOCAL);
-
- Mat4Invert(data->invmat, pchan->constinv);
-
-
- /* restore original matrices of pchan */
- Mat4CpyMat4(pchan->pose_mat, pmat);
- Mat4CpyMat4(pchan->chan_mat, chmat);
- Mat4CpyMat4(pchan->constinv, cimat);
- }
- else if (ob) {
- /* use what_does_parent to find inverse - just like for normal parenting.
- * NOTE: what_does_parent uses a static workob defined in object.c
- */
- what_does_parent(ob);
- Mat4Invert(data->invmat, workob.obmat);
- }
- else
- Mat4One(data->invmat);
-}
-
-/* ChildOf Constraint - clear inverse callback */
-void childof_const_clearinv (void *conv, void *unused)
-{
- bChildOfConstraint *data= (bChildOfConstraint *)conv;
-
- /* simply clear the matrix */
- Mat4One(data->invmat);
-}
diff --git a/source/blender/src/editcurve.c b/source/blender/src/editcurve.c
deleted file mode 100644
index 8d845c4ba14..00000000000
--- a/source/blender/src/editcurve.c
+++ /dev/null
@@ -1,4632 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <math.h>
-#include <string.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef WIN32
-#include <unistd.h>
-#else
-#include <io.h>
-#endif
-#include <stdlib.h>
-#include "MEM_guardedalloc.h"
-
-#include "BMF_Api.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_dynstr.h"
-#include "BLI_rand.h"
-
-#include "DNA_curve_types.h"
-#include "DNA_ipo_types.h"
-#include "DNA_key_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_userdef_types.h"
-
-#include "BKE_utildefines.h"
-#include "BKE_library.h"
-#include "BKE_ipo.h"
-#include "BKE_depsgraph.h"
-#include "BKE_curve.h"
-#include "BKE_global.h"
-#include "BKE_object.h"
-#include "BKE_main.h"
-#include "BKE_key.h"
-
-#include "BIF_editmode_undo.h"
-#include "BIF_gl.h"
-#include "BIF_graphics.h"
-#include "BIF_screen.h"
-#include "BIF_toolbox.h"
-#include "BIF_space.h"
-#include "BIF_editkey.h"
-#include "BIF_mywindow.h"
-#include "BIF_interface.h"
-#include "BIF_transform.h"
-#include "BIF_retopo.h"
-
-#include "BSE_view.h" /* For persp... */
-#include "BSE_edit.h"
-
-#include "BDR_drawobject.h"
-#include "BDR_editcurve.h"
-#include "BDR_editobject.h"
-
-#include "mydevice.h"
-#include "blendef.h"
-
-#include "BDR_editcurve.h"
-/* still need to eradicate a few :( */
-#define callocstructN(x,y,name) (x*)MEM_callocN((y)* sizeof(x),name)
-
-
-ListBase editNurb;
-BPoint *lastselbp;
-Nurb *lastnu; /* for selected */
-
-
-/* void freeNurblist(ListBase *lb); already declared in the kernel */
-
-float nurbcircle[8][2]= {
- {0.0, -1.0}, {-1.0, -1.0}, {-1.0, 0.0}, {-1.0, 1.0},
- {0.0, 1.0}, { 1.0, 1.0}, { 1.0, 0.0}, { 1.0, -1.0}
-};
-
-/* ******************* SELECTION FUNCTIONS ********************* */
-
-/* returns 1 in case (de)selection was successful */
-static short select_beztriple(BezTriple *bezt, short selstatus, short flag, short hidden)
-{
- if(bezt) {
- if((bezt->hide==0) || (hidden==1)) {
- if(selstatus==1) { /* selects */
- bezt->f1 |= flag;
- bezt->f2 |= flag;
- bezt->f3 |= flag;
- return 1;
- }
- else { /* deselects */
- bezt->f1 &= ~flag;
- bezt->f2 &= ~flag;
- bezt->f3 &= ~flag;
- return 1;
- }
- }
- }
-
- return 0;
-}
-
-/* returns 1 in case (de)selection was successful */
-static short select_bpoint(BPoint *bp, short selstatus, short flag, short hidden)
-{
- if(bp) {
- if((bp->hide==0) || (hidden==1)) {
- if(selstatus==1) {
- bp->f1 |= flag;
- return 1;
- }
- else {
- bp->f1 &= ~flag;
- return 1;
- }
- }
- }
-
- return 0;
-}
-
-static short swap_selection_beztriple(BezTriple *bezt)
-{
- if(bezt->f2 & SELECT)
- return select_beztriple(bezt, DESELECT, 1, VISIBLE);
- else
- return select_beztriple(bezt, SELECT, 1, VISIBLE);
-}
-
-static short swap_selection_bpoint(BPoint *bp)
-{
- if(bp->f1 & SELECT)
- return select_bpoint(bp, DESELECT, 1, VISIBLE);
- else
- return select_bpoint(bp, SELECT, 1, VISIBLE);
-}
-
-short isNurbsel(Nurb *nu)
-{
- BezTriple *bezt;
- BPoint *bp;
- int a;
-
- if((nu->type & 7)==CU_BEZIER) {
- bezt= nu->bezt;
- a= nu->pntsu;
- while(a--) {
- if( (bezt->f1 & SELECT) || (bezt->f2 & SELECT) || (bezt->f3 & SELECT) ) return 1;
- bezt++;
- }
- }
- else {
- bp= nu->bp;
- a= nu->pntsu*nu->pntsv;
- while(a--) {
- if( (bp->f1 & SELECT) ) return 1;
- bp++;
- }
- }
- return 0;
-}
-
-int isNurbsel_count(Nurb *nu)
-{
- BezTriple *bezt;
- BPoint *bp;
- int a, sel=0;
-
- if((nu->type & 7)==CU_BEZIER) {
- bezt= nu->bezt;
- a= nu->pntsu;
- while(a--) {
- if (BEZSELECTED_HIDDENHANDLES(bezt)) sel++;
- bezt++;
- }
- }
- else {
- bp= nu->bp;
- a= nu->pntsu*nu->pntsv;
- while(a--) {
- if( (bp->f1 & SELECT) ) sel++;
- bp++;
- }
- }
- return sel;
-}
-
-/* ******************* PRINTS ********************* */
-
-void printknots()
-{
- Nurb *nu;
- int a, num;
-
- for(nu= editNurb.first; nu; nu= nu->next) {
- if(isNurbsel(nu) && (nu->type & 7)==CU_NURBS) {
- if(nu->knotsu) {
- num= KNOTSU(nu);
- for(a=0;a<num;a++) printf("knotu %d: %f\n", a, nu->knotsu[a]);
- }
- if(nu->knotsv) {
- num= KNOTSV(nu);
- for(a=0;a<num;a++) printf("knotv %d: %f\n", a, nu->knotsv[a]);
- }
- }
- }
-}
-
-#if 0
-static void printweightsNurb__doPrint(void *userData, Nurb *nurb, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y)
-{
- char str[30];
-
- if (bp && (bp->f1&1)) {
- sprintf(str,"%2.2f", bp->vec[3]);
-
- cpack(0x737373);
- glRasterPos2i(x-1, y-1);
- BMF_DrawString(G.font, str);
-
- glRasterPos2i(x+1, y+1);
- BMF_DrawString(G.font, str);
-
- cpack(0xFFFFFF);
- glRasterPos2i(x, y);
- BMF_DrawString(G.font, str);
- }
-}
-static void printweightsNurb(void)
-{
- if(G.obedit==0) return;
-
- persp(PERSP_WIN);
-
- glDrawBuffer(GL_FRONT);
- nurbs_foreachScreenVert(printweightsNurb__doPrint, NULL);
- glDrawBuffer(GL_BACK);
-
- persp(PERSP_VIEW);
-}
-#endif
-
-
-/* ********************* LOAD and MAKE *************** */
-
-void load_editNurb()
-{
- /* load editNurb in object */
- Curve *cu= 0;
- Nurb *nu, *newnu;
- KeyBlock *actkey;
-
- if(G.obedit==0) return;
-
- if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
-
- G.totvert= count_curveverts(&editNurb);
-
- cu= G.obedit->data;
-
- /* are there keys? */
- actkey = ob_get_keyblock(G.obedit);
- if(actkey) {
- /* active key: the vertices */
-
- if(G.totvert) {
- if(actkey->data) MEM_freeN(actkey->data);
-
- actkey->data= MEM_callocN(cu->key->elemsize*G.totvert, "actkey->data");
- actkey->totelem= G.totvert;
-
- curve_to_key(cu, actkey, &editNurb);
- }
- }
-
- if(cu->key && actkey!=cu->key->refkey) {
- ;
- }
- else {
- freeNurblist(&(cu->nurb));
-
- for(nu= editNurb.first; nu; nu= nu->next) {
- newnu= duplicateNurb(nu);
- BLI_addtail(&(cu->nurb), newnu);
-
- if((nu->type & 7)==CU_NURBS) {
- if(nu->pntsu < nu->orderu) nu->orderu= nu->pntsu;
- }
- }
- }
-
- }
-
- lastnu= NULL; /* for selected */
-}
-
-void make_editNurb()
-{
- /* make copy of baseNurb in editNurb */
- Curve *cu=0;
- Nurb *nu, *newnu;
- KeyBlock *actkey;
-
- if(G.obedit==NULL) return;
-
- lastselbp= NULL; /* global for select row */
-
- if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
- freeNurblist(&editNurb);
-
- cu= G.obedit->data;
- nu= cu->nurb.first;
-
- while(nu) {
- newnu= duplicateNurb(nu);
- test2DNurb(newnu); // after join, or any other creation of curve
- BLI_addtail(&editNurb, newnu);
- nu= nu->next;
- }
-
- actkey = ob_get_keyblock(G.obedit);
- if(actkey) {
- strcpy(G.editModeTitleExtra, "(Key) ");
- key_to_curve(actkey, cu, &editNurb);
- }
- }
- else G.obedit= NULL;
-
- countall();
-
- lastnu= NULL; /* for selected */
-}
-
-void remake_editNurb()
-{
-
- if(okee("Reload original data")==0) return;
-
- make_editNurb();
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
-}
-
-
-void separate_nurb()
-{
- Nurb *nu, *nu1;
- Object *oldob;
- Base *base, *oldbase;
- Curve *cu;
- ListBase editnurbo;
-
- if( G.vd==0 || (G.vd->lay & G.obedit->lay)==0 ) return;
-
- if(okee("Separate")==0) return;
-
- waitcursor(1);
-
- cu= G.obedit->data;
- if(cu->key) {
- error("Can't separate a curve with vertex keys");
- return;
- }
-
- /* we are going to trick everything as follows:
- * 1. duplicate base: this is the new one, remember old pointer
- * 2. set aside all NOT selected curves/nurbs
- * 3. load_ebaseNurb(): this will be the new base
- * 4. freelist and restore old nurbs
- */
-
- /* only edit-base selected */
- base= FIRSTBASE;
- while(base) {
- if(base->lay & G.vd->lay) {
- if(base->object==G.obedit) base->flag |= 1;
- else base->flag &= ~1;
- }
- base= base->next;
- }
-
- /* set aside: everything that is not selected */
- editnurbo.first= editnurbo.last= 0;
- nu= editNurb.first;
- while(nu) {
- nu1= nu->next;
- if(isNurbsel(nu)==0) {
- BLI_remlink(&editNurb, nu);
- BLI_addtail(&editnurbo, nu);
- }
- nu= nu1;
- }
-
- oldob= G.obedit;
- oldbase= BASACT;
-
- adduplicate(1, 0); /* no transform and zero so do get a linked dupli */
-
- G.obedit= BASACT->object; /* basact is set in adduplicate() */
-
- G.obedit->data= copy_curve(cu);
- /* because new curve is a copy: reduce user count */
- cu->id.us--;
-
- load_editNurb();
-
- BASACT->flag &= ~SELECT;
-
- if(editNurb.first) freeNurblist(&editNurb);
-
- editNurb= editnurbo;
-
- G.obedit= 0; /* displists behave different in edit mode */
- DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA); /* this is the separated one */
- DAG_object_flush_update(G.scene, oldob, OB_RECALC_DATA); /* this is the separated one */
-
- G.obedit= oldob;
- BASACT= oldbase;
- BASACT->flag |= SELECT;
-
- waitcursor(0);
-
- countall();
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
-
- lastnu= NULL; /* for selected */
-}
-
-/* ******************* FLAGS ********************* */
-
-
-short isNurbselUV(Nurb *nu, int *u, int *v, int flag)
-{
- /* return u!=-1: 1 row in u-direction selected. U has value between 0-pntsv
- * return v!=-1: 1 collumn in v-direction selected. V has value between 0-pntsu
- */
- BPoint *bp;
- int a, b, sel;
-
- *u= *v= -1;
-
- bp= nu->bp;
- for(b=0; b<nu->pntsv; b++) {
- sel= 0;
- for(a=0; a<nu->pntsu; a++, bp++) {
- if(bp->f1 & flag) sel++;
- }
- if(sel==nu->pntsu) {
- if(*u== -1) *u= b;
- else return 0;
- }
- else if(sel>1) return 0; /* because sel==1 is still ok */
- }
-
- for(a=0; a<nu->pntsu; a++) {
- sel= 0;
- bp= nu->bp+a;
- for(b=0; b<nu->pntsv; b++, bp+=nu->pntsu) {
- if(bp->f1 & flag) sel++;
- }
- if(sel==nu->pntsv) {
- if(*v== -1) *v= a;
- else return 0;
- }
- else if(sel>1) return 0;
- }
-
- if(*u==-1 && *v>-1) return 1;
- if(*v==-1 && *u>-1) return 1;
- return 0;
-}
-
-void setflagsNurb(short flag)
-{
- Nurb *nu;
- BezTriple *bezt;
- BPoint *bp;
- int a;
-
- for(nu= editNurb.first; nu; nu= nu->next) {
- if( (nu->type & 7)==CU_BEZIER) {
- a= nu->pntsu;
- bezt= nu->bezt;
- while(a--) {
- bezt->f1= bezt->f2= bezt->f3= flag;
- bezt++;
- }
- }
- else {
- a= nu->pntsu*nu->pntsv;
- bp= nu->bp;
- while(a--) {
- bp->f1= flag;
- bp++;
- }
- }
- }
-}
-
-void rotateflagNurb(short flag, float *cent, float rotmat[][3])
-{
- /* all verts with (flag & 'flag') rotate */
- Nurb *nu;
- BPoint *bp;
- int a;
-
- for(nu= editNurb.first; nu; nu= nu->next) {
- if((nu->type & 7)==CU_NURBS) {
- bp= nu->bp;
- a= nu->pntsu*nu->pntsv;
-
- while(a--) {
- if(bp->f1 & flag) {
- bp->vec[0]-=cent[0];
- bp->vec[1]-=cent[1];
- bp->vec[2]-=cent[2];
- Mat3MulVecfl(rotmat, bp->vec);
- bp->vec[0]+=cent[0];
- bp->vec[1]+=cent[1];
- bp->vec[2]+=cent[2];
- }
- bp++;
- }
- }
- }
-}
-
-
-void translateflagNurb(short flag, float *vec)
-{
- /* all verts with ('flag' & flag) translate */
- Nurb *nu;
- BezTriple *bezt;
- BPoint *bp;
- int a;
-
- for(nu= editNurb.first; nu; nu= nu->next) {
- if( (nu->type & 7)==CU_BEZIER) {
- a= nu->pntsu;
- bezt= nu->bezt;
- while(a--) {
- if(bezt->f1 & flag) VecAddf(bezt->vec[0], bezt->vec[0], vec);
- if(bezt->f2 & flag) VecAddf(bezt->vec[1], bezt->vec[1], vec);
- if(bezt->f3 & flag) VecAddf(bezt->vec[2], bezt->vec[2], vec);
- bezt++;
- }
- }
- else {
- a= nu->pntsu*nu->pntsv;
- bp= nu->bp;
- while(a--) {
- if(bp->f1 & flag) VecAddf(bp->vec, bp->vec, vec);
- bp++;
- }
- }
-
- test2DNurb(nu);
- }
-}
-
-void weightflagNurb(short flag, float w, int mode) /* mode==0: replace, mode==1: multiply */
-{
- Nurb *nu;
- BPoint *bp;
- int a;
-
- for(nu= editNurb.first; nu; nu= nu->next) {
- if((nu->type & 7)==CU_NURBS) {
- a= nu->pntsu*nu->pntsv;
- bp= nu->bp;
- while(a--) {
- if(bp->f1 & flag) {
- if(mode==1) bp->vec[3]*= w;
- else bp->vec[3]= w;
- }
- bp++;
- }
- }
- }
-}
-
-void deleteflagNurb(short flag)
-{
- Nurb *nu, *next;
- BPoint *bp, *bpn, *newbp;
- int a, b, newu, newv, sel;
-
- if(G.obedit && G.obedit->type==OB_SURF);
- else return;
-
- lastselbp= NULL;
-
- nu= editNurb.first;
- while(nu) {
- next= nu->next;
-
- /* is entire nurb selected */
- bp= nu->bp;
- a= nu->pntsu*nu->pntsv;
- while(a) {
- a--;
- if(bp->f1 & flag);
- else break;
- bp++;
- }
- if(a==0) {
- BLI_remlink(&editNurb, nu);
- freeNurb(nu);
- }
- else {
- /* is nurb in U direction selected */
- newv= nu->pntsv;
- bp= nu->bp;
- for(b=0; b<nu->pntsv; b++) {
- sel= 0;
- for(a=0; a<nu->pntsu; a++, bp++) {
- if(bp->f1 & flag) sel++;
- }
- if(sel==nu->pntsu) {
- newv--;
- }
- else if(sel>=1) {
- /* don't delete */
- break;
- }
- }
- if(newv!=nu->pntsv && b==nu->pntsv) {
- /* delete */
- bp= nu->bp;
- bpn = newbp =
- (BPoint*) MEM_mallocN(newv * nu->pntsu * sizeof(BPoint), "deleteNurb");
- for(b=0; b<nu->pntsv; b++) {
- if((bp->f1 & flag)==0) {
- memcpy(bpn, bp, nu->pntsu*sizeof(BPoint));
- bpn+= nu->pntsu;
- }
- bp+= nu->pntsu;
- }
- nu->pntsv= newv;
- MEM_freeN(nu->bp);
- nu->bp= newbp;
- if(nu->orderv>nu->pntsv) nu->orderv= nu->pntsv;
-
- makeknots(nu, 2, nu->flagv>>1);
- }
- else {
- /* is the nurb in V direction selected */
- newu= nu->pntsu;
- for(a=0; a<nu->pntsu; a++) {
- bp= nu->bp+a;
- sel= 0;
- for(b=0; b<nu->pntsv; b++, bp+=nu->pntsu) {
- if(bp->f1 & flag) sel++;
- }
- if(sel==nu->pntsv) {
- newu--;
- }
- else if(sel>=1) {
- /* don't delete */
- break;
- }
- }
- if(newu!=nu->pntsu && a==nu->pntsu) {
- /* delete */
- bp= nu->bp;
- bpn = newbp =
- (BPoint*) MEM_mallocN(newu * nu->pntsv * sizeof(BPoint), "deleteNurb");
- for(b=0; b<nu->pntsv; b++) {
- for(a=0; a<nu->pntsu; a++, bp++) {
- if((bp->f1 & flag)==0) {
- *bpn= *bp;
- bpn++;
- }
- }
- }
- MEM_freeN(nu->bp);
- nu->bp= newbp;
- if(newu==1 && nu->pntsv>1) { /* make a U spline */
- nu->pntsu= nu->pntsv;
- nu->pntsv= 1;
- SWAP(short, nu->orderu, nu->orderv);
- if(nu->orderu>nu->pntsu) nu->orderu= nu->pntsu;
- if(nu->knotsv) MEM_freeN(nu->knotsv);
- nu->knotsv= 0;
- }
- else {
- nu->pntsu= newu;
- if(nu->orderu>nu->pntsu) nu->orderu= nu->pntsu;
- }
- makeknots(nu, 1, nu->flagu>>1);
- }
- }
- }
- nu= next;
- }
-}
-
-short extrudeflagNurb(int flag)
-{
- Nurb *nu;
- BPoint *bp, *bpn, *newbp;
- int ok= 0, a, u, v, len;
-
- if(G.obedit && G.obedit->type==OB_SURF);
- else return 0;
-
- nu= editNurb.first;
- while(nu) {
-
- if(nu->pntsv==1) {
- bp= nu->bp;
- a= nu->pntsu;
- while(a) {
- if(bp->f1 & flag);
- else break;
- bp++;
- a--;
- }
- if(a==0) {
- ok= 1;
- newbp =
- (BPoint*)MEM_mallocN(2 * nu->pntsu * sizeof(BPoint), "extrudeNurb1");
- memcpy(newbp, nu->bp, nu->pntsu*sizeof(BPoint) );
- bp= newbp+ nu->pntsu;
- memcpy(bp, nu->bp, nu->pntsu*sizeof(BPoint) );
- MEM_freeN(nu->bp);
- nu->bp= newbp;
- a= nu->pntsu;
- while(a--) {
- select_bpoint(bp, SELECT, flag, HIDDEN);
- select_bpoint(newbp, DESELECT, flag, HIDDEN);
- bp++;
- newbp++;
- }
-
- nu->pntsv= 2;
- nu->orderv= 2;
- makeknots(nu, 2, nu->flagv>>1);
- }
- }
- else {
- /* which row or collumn is selected */
-
- if( isNurbselUV(nu, &u, &v, flag) ) {
-
- /* deselect all */
- bp= nu->bp;
- a= nu->pntsu*nu->pntsv;
- while(a--) {
- select_bpoint(bp, DESELECT, flag, HIDDEN);
- bp++;
- }
-
- if(u==0 || u== nu->pntsv-1) { /* row in u-direction selected */
- ok= 1;
- newbp =
- (BPoint*) MEM_mallocN(nu->pntsu*(nu->pntsv + 1)
- * sizeof(BPoint), "extrudeNurb1");
- if(u==0) {
- len= nu->pntsv*nu->pntsu;
- memcpy(newbp+nu->pntsu, nu->bp, len*sizeof(BPoint) );
- memcpy(newbp, nu->bp, nu->pntsu*sizeof(BPoint) );
- bp= newbp;
- }
- else {
- len= nu->pntsv*nu->pntsu;
- memcpy(newbp, nu->bp, len*sizeof(BPoint) );
- memcpy(newbp+len, nu->bp+len-nu->pntsu, nu->pntsu*sizeof(BPoint) );
- bp= newbp+len;
- }
-
- a= nu->pntsu;
- while(a--) {
- select_bpoint(bp, SELECT, flag, HIDDEN);
- bp++;
- }
-
- MEM_freeN(nu->bp);
- nu->bp= newbp;
- nu->pntsv++;
- if(nu->resolv<3) nu->resolv++;
- makeknots(nu, 2, nu->flagv>>1);
- }
- else if(v==0 || v== nu->pntsu-1) { /* collumn in v-direction selected */
- ok= 1;
- bpn = newbp =
- (BPoint*) MEM_mallocN((nu->pntsu + 1) * nu->pntsv * sizeof(BPoint), "extrudeNurb1");
- bp= nu->bp;
-
- for(a=0; a<nu->pntsv; a++) {
- if(v==0) {
- *bpn= *bp;
- bpn->f1 |= flag;
- bpn++;
- }
- memcpy(bpn, bp, nu->pntsu*sizeof(BPoint));
- bp+= nu->pntsu;
- bpn+= nu->pntsu;
- if(v== nu->pntsu-1) {
- *bpn= *(bp-1);
- bpn->f1 |= flag;
- bpn++;
- }
- }
-
- MEM_freeN(nu->bp);
- nu->bp= newbp;
- nu->pntsu++;
- if(nu->resolu<3) nu->resolu++;
- makeknots(nu, 1, nu->flagu>>1);
- }
- }
- }
- nu= nu->next;
- }
-
- return ok;
-}
-
-void adduplicateflagNurb(short flag)
-{
- Nurb *nu, *newnu;
- BezTriple *bezt, *bezt1;
- BPoint *bp, *bp1;
- int a, b, starta, enda, newu, newv;
- char *usel;
-
- nu= editNurb.last;
- while(nu) {
- if( (nu->type & 7)==CU_BEZIER) {
- bezt= nu->bezt;
- for(a=0; a<nu->pntsu; a++) {
- enda= -1;
- starta= a;
- while( (bezt->f1 & flag) || (bezt->f2 & flag) || (bezt->f3 & flag) ) {
- select_beztriple(bezt, DESELECT, flag, HIDDEN);
- enda=a;
- if(a>=nu->pntsu-1) break;
- a++;
- bezt++;
- }
- if(enda>=starta) {
- newnu = (Nurb*)MEM_mallocN(sizeof(Nurb), "adduplicateN");
- memcpy(newnu, nu, sizeof(Nurb));
- BLI_addtail(&editNurb, newnu);
- lastnu= newnu;
- newnu->pntsu= enda-starta+1;
- newnu->bezt=
- (BezTriple*)MEM_mallocN((enda - starta + 1) * sizeof(BezTriple), "adduplicateN");
- memcpy(newnu->bezt, nu->bezt+starta, newnu->pntsu*sizeof(BezTriple));
-
- b= newnu->pntsu;
- bezt1= newnu->bezt;
- while(b--) {
- select_beztriple(bezt1, SELECT, flag, HIDDEN);
- bezt1++;
- }
-
- if(nu->flagu & 1) {
- if(starta!=0 || enda!=nu->pntsu-1) newnu->flagu--;
- }
- }
- bezt++;
- }
- }
- else if(nu->pntsv==1) { /* because UV Nurb has a different method for dupli */
- bp= nu->bp;
- for(a=0; a<nu->pntsu; a++) {
- enda= -1;
- starta= a;
- while(bp->f1 & flag) {
- select_bpoint(bp, DESELECT, flag, HIDDEN);
- enda= a;
- if(a>=nu->pntsu-1) break;
- a++;
- bp++;
- }
- if(enda>=starta) {
- newnu = (Nurb*)MEM_mallocN(sizeof(Nurb), "adduplicateN3");
- memcpy(newnu, nu, sizeof(Nurb));
- lastnu= newnu;
- BLI_addtail(&editNurb, newnu);
- newnu->pntsu= enda-starta+1;
- newnu->bp = (BPoint*)MEM_mallocN((enda-starta+1) * sizeof(BPoint), "adduplicateN4");
- memcpy(newnu->bp, nu->bp+starta, newnu->pntsu*sizeof(BPoint));
-
- b= newnu->pntsu;
- bp1= newnu->bp;
- while(b--) {
- select_bpoint(bp1, SELECT, flag, HIDDEN);
- bp1++;
- }
-
- if(nu->flagu & 1) {
- if(starta!=0 || enda!=nu->pntsu-1) newnu->flagu--;
- }
-
- /* knots */
- newnu->knotsu= 0;
- makeknots(newnu, 1, newnu->flagu>>1);
- }
- bp++;
- }
- }
- else {
- /* a rectangular area in nurb has to be selected */
- if(isNurbsel(nu)) {
- usel= MEM_callocN(nu->pntsu, "adduplicateN4");
- bp= nu->bp;
- for(a=0; a<nu->pntsv; a++) {
- for(b=0; b<nu->pntsu; b++, bp++) {
- if(bp->f1 & flag) usel[b]++;
- }
- }
- newu= 0;
- newv= 0;
- for(a=0; a<nu->pntsu; a++) {
- if(usel[a]) {
- if(newv==0 || usel[a]==newv) {
- newv= usel[a];
- newu++;
- }
- else {
- newv= 0;
- break;
- }
- }
- }
- if(newu==0 || newv==0) {
- printf("Can't duplicate Nurb\n");
- }
- else {
-
- if(newu==1) SWAP(short, newu, newv);
-
- newnu = (Nurb*)MEM_mallocN(sizeof(Nurb), "adduplicateN5");
- memcpy(newnu, nu, sizeof(Nurb));
- BLI_addtail(&editNurb, newnu);
- lastnu= newnu;
- newnu->pntsu= newu;
- newnu->pntsv= newv;
- newnu->bp =
- (BPoint*)MEM_mallocN(newu * newv * sizeof(BPoint), "adduplicateN6");
- newnu->orderu= MIN2(nu->orderu, newu);
- newnu->orderv= MIN2(nu->orderv, newv);
-
- bp= newnu->bp;
- bp1= nu->bp;
- for(a=0; a<nu->pntsv; a++) {
- for(b=0; b<nu->pntsu; b++, bp1++) {
- if(bp1->f1 & flag) {
- memcpy(bp, bp1, sizeof(BPoint));
- select_bpoint(bp1, DESELECT, flag, HIDDEN);
- bp++;
- }
- }
- }
- if(nu->pntsu==newnu->pntsu) {
- newnu->knotsu= MEM_mallocN(sizeof(float)*KNOTSU(nu), "adduplicateN6");
- memcpy(newnu->knotsu, nu->knotsu, sizeof(float)*KNOTSU(nu));
- }
- else {
- newnu->knotsu= 0;
- makeknots(newnu, 1, newnu->flagu>>1);
- }
- if(nu->pntsv==newnu->pntsv) {
- newnu->knotsv= MEM_mallocN(sizeof(float)*KNOTSV(nu), "adduplicateN7");
- memcpy(newnu->knotsv, nu->knotsv, sizeof(float)*KNOTSV(nu));
- }
- else {
- newnu->knotsv= 0;
- makeknots(newnu, 2, newnu->flagv>>1);
- }
-
- }
- MEM_freeN(usel);
- }
- }
-
- nu= nu->prev;
- }
-
- /* lastnu changed */
- allqueue(REDRAWBUTSEDIT, 0);
-}
-
-
-void switchdirectionNurb2(void)
-{
- Nurb *nu;
-
- if(G.vd==0 || !(G.obedit->lay & G.vd->lay))
- return;
-
- for(nu= editNurb.first; nu; nu= nu->next) {
- if( isNurbsel(nu) ) switchdirectionNurb(nu);
- }
-
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-
- allqueue(REDRAWVIEW3D, 0);
- BIF_undo_push("Switch direction");
-}
-
-void switchdirection_knots(float *base, int tot)
-{
- float *fp1, *fp2, *tempf;
- int a;
-
- if(base==NULL || tot==0) return;
-
- /* reverse knots */
- a= tot;
- fp1= base;
- fp2= fp1+(a-1);
- a/= 2;
- while(fp1!=fp2 && a>0) {
- SWAP(float, *fp1, *fp2);
- a--;
- fp1++;
- fp2--;
- }
- /* and make in increasing order again */
- a= tot;
- fp1= base;
- fp2=tempf= MEM_mallocN(sizeof(float)*a, "switchdirect");
- while(a--) {
- fp2[0]= fabs(fp1[1]-fp1[0]);
- fp1++;
- fp2++;
- }
-
- a= tot-1;
- fp1= base;
- fp2= tempf;
- fp1[0]= 0.0;
- fp1++;
- while(a--) {
- fp1[0]= fp1[-1]+fp2[0];
- fp1++;
- fp2++;
- }
- MEM_freeN(tempf);
-}
-
-void setweightNurb(void)
-{
- static float weight= 1.0f;
- extern ListBase editNurb;
- Nurb *nu;
- BezTriple *bezt;
- BPoint *bp;
- int a;
-
- if(fbutton(&weight, 0.0f, 1.0f, 10, 10, "Set Weight")) {
- for(nu= editNurb.first; nu; nu= nu->next) {
- if(nu->bezt) {
- for(bezt=nu->bezt, a=0; a<nu->pntsu; a++, bezt++) {
- if(bezt->f2 & SELECT)
- bezt->weight= weight;
- }
- }
- else if(nu->bp) {
- for(bp=nu->bp, a=0; a<nu->pntsu*nu->pntsv; a++, bp++) {
- if(bp->f1 & SELECT)
- bp->weight= weight;
- }
- }
- }
- }
- BIF_undo_push("Set Curve Weight");
- DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
-}
-
-void setradiusNurb( void )
-{
- static float radius= 1.0f;
- extern ListBase editNurb;
- Nurb *nu;
- BezTriple *bezt;
- BPoint *bp;
- int a;
-
- if(fbutton(&radius, 0.0001f, 10.0f, 10, 10, "Set Radius")) {
- for(nu= editNurb.first; nu; nu= nu->next) {
- if(nu->bezt) {
- for(bezt=nu->bezt, a=0; a<nu->pntsu; a++, bezt++) {
- if(bezt->f2 & SELECT)
- bezt->radius= radius;
- }
- }
- else if(nu->bp) {
- for(bp=nu->bp, a=0; a<nu->pntsu*nu->pntsv; a++, bp++) {
- if(bp->f1 & SELECT)
- bp->radius= radius;
- }
- }
- }
- }
- BIF_undo_push("Set Curve Radius");
- DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSALL, 0);
- allqueue(REDRAWINFO, 1); /* 1, because header->win==0! */
-}
-
-
-/* TODO, make smoothing distance based */
-void smoothradiusNurb( void )
-{
- extern ListBase editNurb;
- Nurb *nu;
- BezTriple *bezt;
- BPoint *bp;
- int a;
-
- /* use for smoothing */
- int last_sel;
- int start_sel, end_sel; /* selection indicies, inclusive */
- float start_rad, end_rad, fac, range;
-
- for(nu= editNurb.first; nu; nu= nu->next) {
- if(nu->bezt) {
-
- for (last_sel=0; last_sel < nu->pntsu; last_sel++) {
- /* loop over selection segments of a curve, smooth each */
-
- /* Start BezTriple code, this is duplicated below for points, make sure these functions stay in sync */
- start_sel = end_sel = -1;
- for(bezt=nu->bezt+last_sel, a=last_sel; a<nu->pntsu; a++, bezt++) {
- if(bezt->f2 & SELECT) {
- start_sel = a;
- break;
- }
- }
- /* incase there are no other selected verts */
- end_sel = start_sel;
- for(bezt=nu->bezt+(start_sel+1), a=start_sel+1; a<nu->pntsu; a++, bezt++) {
- if((bezt->f2 & SELECT)==0) {
- break;
- }
- end_sel = a;
- }
-
- if (start_sel == -1) {
- last_sel = nu->pntsu; /* next... */
- } else {
- last_sel = end_sel; /* before we modify it */
-
- /* now blend between start and end sel */
- start_rad = end_rad = -1.0;
-
- if (start_sel == end_sel) {
- /* simple, only 1 point selected */
- if (start_sel>0) start_rad = (nu->bezt+start_sel-1)->radius;
- if (end_sel!=-1 && end_sel < nu->pntsu) end_rad = (nu->bezt+start_sel+1)->radius;
-
- if (start_rad >= 0.0 && end_rad >= 0.0) (nu->bezt+start_sel)->radius = (start_rad + end_rad)/2;
- else if (start_rad >= 0.0) (nu->bezt+start_sel)->radius = start_rad;
- else if (end_rad >= 0.0) (nu->bezt+start_sel)->radius = end_rad;
- } else {
- /* if endpoints selected, then use them */
- if (start_sel==0) {
- start_rad = (nu->bezt+start_sel)->radius;
- start_sel++; /* we dont want to edit the selected endpoint */
- } else {
- start_rad = (nu->bezt+start_sel-1)->radius;
- }
- if (end_sel==nu->pntsu-1) {
- end_rad = (nu->bezt+end_sel)->radius;
- end_sel--; /* we dont want to edit the selected endpoint */
- } else {
- end_rad = (nu->bezt+end_sel+1)->radius;
- }
-
- /* Now Blend between the points */
- range = (float)(end_sel - start_sel) + 2.0f;
- for(bezt=nu->bezt+start_sel, a=start_sel; a<=end_sel; a++, bezt++) {
- fac = (float)(1+a-start_sel) / range;
- bezt->radius = start_rad*(1.0-fac) + end_rad*fac;
- }
- }
- }
- }
- } else if (nu->bp) {
- /* Same as above, keep these the same! */
- for (last_sel=0; last_sel < nu->pntsu; last_sel++) {
- /* loop over selection segments of a curve, smooth each */
-
- /* Start BezTriple code, this is duplicated below for points, make sure these functions stay in sync */
- start_sel = end_sel = -1;
- for(bp=nu->bp+last_sel, a=last_sel; a<nu->pntsu; a++, bp++) {
- if(bp->f1 & SELECT) {
- start_sel = a;
- break;
- }
- }
- /* incase there are no other selected verts */
- end_sel = start_sel;
- for(bp=nu->bp+(start_sel+1), a=start_sel+1; a<nu->pntsu; a++, bp++) {
- if((bp->f1 & SELECT)==0) {
- break;
- }
- end_sel = a;
- }
-
- if (start_sel == -1) {
- last_sel = nu->pntsu; /* next... */
- } else {
- last_sel = end_sel; /* before we modify it */
-
- /* now blend between start and end sel */
- start_rad = end_rad = -1.0;
-
- if (start_sel == end_sel) {
- /* simple, only 1 point selected */
- if (start_sel>0) start_rad = (nu->bp+start_sel-1)->radius;
- if (end_sel!=-1 && end_sel < nu->pntsu) end_rad = (nu->bp+start_sel+1)->radius;
-
- if (start_rad >= 0.0 && end_rad >= 0.0) (nu->bp+start_sel)->radius = (start_rad + end_rad)/2;
- else if (start_rad >= 0.0) (nu->bp+start_sel)->radius = start_rad;
- else if (end_rad >= 0.0) (nu->bp+start_sel)->radius = end_rad;
- } else {
- /* if endpoints selected, then use them */
- if (start_sel==0) {
- start_rad = (nu->bp+start_sel)->radius;
- start_sel++; /* we dont want to edit the selected endpoint */
- } else {
- start_rad = (nu->bp+start_sel-1)->radius;
- }
- if (end_sel==nu->pntsu-1) {
- end_rad = (nu->bp+end_sel)->radius;
- end_sel--; /* we dont want to edit the selected endpoint */
- } else {
- end_rad = (nu->bp+end_sel+1)->radius;
- }
-
- /* Now Blend between the points */
- range = (float)(end_sel - start_sel) + 2.0f;
- for(bp=nu->bp+start_sel, a=start_sel; a<=end_sel; a++, bp++) {
- fac = (float)(1+a-start_sel) / range;
- bp->radius = start_rad*(1.0-fac) + end_rad*fac;
- }
- }
- }
- }
- }
- }
- BIF_undo_push("Smooth Curve Radius");
- DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSALL, 0);
- allqueue(REDRAWINFO, 1); /* 1, because header->win==0! */
-}
-
-
-
-/* **************** EDIT ************************ */
-
-/* next == 1 -> select next */
-/* next == -1 -> select previous */
-/* cont == 1 -> select continuously */
-/* selstatus, inverts behaviour */
-static void select_adjacent_cp(short next, short cont, short selstatus)
-{
- Nurb *nu;
- BezTriple *bezt;
- BPoint *bp;
- int a;
- short lastsel= 0, sel=0;
-
- if(next==0) return;
-
- for(nu= editNurb.first; nu; nu= nu->next) {
- lastsel=0;
- if((nu->type & 7)==CU_BEZIER) {
- a= nu->pntsu;
- bezt= nu->bezt;
- if(next < 0) bezt= (nu->bezt + (a-1));
- while(a--) {
- if(a-abs(next) < 0) break;
- sel= 0;
- if((lastsel==0) && (bezt->hide==0) && ((bezt->f2 & SELECT) || (selstatus==0))) {
- bezt+=next;
- if(!(bezt->f2 & SELECT) || (selstatus==0)) {
- sel= select_beztriple(bezt, selstatus, 1, VISIBLE);
- if((sel==1) && (cont==0)) lastsel= 1;
- }
- }
- else {
- bezt+=next;
- lastsel= 0;
- }
- /* move around in zigzag way so that we go through each */
- bezt-=(next-next/abs(next));
- }
- }
- else {
- a= nu->pntsu*nu->pntsv;
- bp= nu->bp;
- if(next < 0) bp= (nu->bp + (a-1));
- while(a--) {
- if(a-abs(next) < 0) break;
- sel=0;
- if((lastsel==0) && (bp->hide==0) && ((bp->f1 & SELECT) || (selstatus==0))) {
- bp+=next;
- if(!(bp->f1 & SELECT) || (selstatus==0)) {
- sel= select_bpoint(bp, selstatus, 1, VISIBLE);
- if((sel==1) && (cont==0)) lastsel= 1;
- }
- }
- else {
- bp+=next;
- lastsel= 0;
- }
- /* move around in zigzag way so that we go through each */
- bp-=(next-next/abs(next));
- }
- }
- }
-}
-
-static short nurb_has_selected_cps()
-{
- Nurb *nu;
- BezTriple *bezt;
- BPoint *bp;
- int a;
-
- for(nu= editNurb.first; nu; nu= nu->next) {
- if((nu->type & 7)==CU_BEZIER) {
- a= nu->pntsu;
- bezt= nu->bezt;
- while(a--) {
- if(bezt->hide==0) {
- if((bezt->f1 & SELECT)
- || (bezt->f2 & SELECT)
- || (bezt->f3 & SELECT)) return 1;
- }
- bezt++;
- }
- }
- else {
- a= nu->pntsu*nu->pntsv;
- bp= nu->bp;
- while(a--) {
- if((bp->hide==0) && (bp->f1 & SELECT)) return 1;
- bp++;
- }
- }
- }
-
- return 0;
-}
-
-void deselectall_nurb()
-{
- if(!G.vd || !(G.obedit->lay & G.vd->lay))
- return;
-
- if(nurb_has_selected_cps()) { /* deselect all */
- selectend_nurb(FIRST, 0, DESELECT); /* set first control points as unselected */
- select_adjacent_cp(1, 1, DESELECT); /* cascade selection */
- }
- else { /* select all */
- selectend_nurb(FIRST, 0, SELECT); /* set first control points as selected */
- select_adjacent_cp(1, 1, SELECT); /* cascade selection */
- }
-
- countall();
- allqueue(REDRAWVIEW3D, 0);
- BIF_undo_push("Deselect all");
-}
-
-void hideNurb(int swap)
-{
- Nurb *nu;
- BPoint *bp;
- BezTriple *bezt;
- int a, sel;
-
- if(G.obedit==0) return;
-
- BIF_undo_push("Hide");
-
- for(nu= editNurb.first; nu; nu= nu->next) {
- if((nu->type & 7)==CU_BEZIER) {
- bezt= nu->bezt;
- a= nu->pntsu;
- sel= 0;
- while(a--) {
- if(BEZSELECTED_HIDDENHANDLES(bezt)) {
- select_beztriple(bezt, DESELECT, 1, HIDDEN);
- bezt->hide= 1;
- }
- if(bezt->hide) sel++;
- bezt++;
- }
- if(sel==nu->pntsu) nu->hide= 1;
- }
- else {
- bp= nu->bp;
- a= nu->pntsu*nu->pntsv;
- sel= 0;
- while(a--) {
- if(swap==0 && (bp->f1 & SELECT)) {
- select_bpoint(bp, DESELECT, 1, HIDDEN);
- bp->hide= 1;
- }
- else if(swap && (bp->f1 & SELECT)==0) {
- select_bpoint(bp, DESELECT, 1, HIDDEN);
- bp->hide= 1;
- }
- if(bp->hide) sel++;
- bp++;
- }
- if(sel==nu->pntsu*nu->pntsv) nu->hide= 1;
- }
- }
-
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- countall();
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
-}
-
-void revealNurb()
-{
- Nurb *nu;
- BPoint *bp;
- BezTriple *bezt;
- int a;
-
- if(G.obedit==0) return;
-
- for(nu= editNurb.first; nu; nu= nu->next) {
- nu->hide= 0;
- if((nu->type & 7)==CU_BEZIER) {
- bezt= nu->bezt;
- a= nu->pntsu;
- while(a--) {
- if(bezt->hide) {
- select_beztriple(bezt, SELECT, 1, HIDDEN);
- bezt->hide= 0;
- }
- bezt++;
- }
- }
- else {
- bp= nu->bp;
- a= nu->pntsu*nu->pntsv;
- while(a--) {
- if(bp->hide) {
- select_bpoint(bp, SELECT, 1, HIDDEN);
- bp->hide= 0;
- }
- bp++;
- }
- }
- }
-
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- countall();
- allqueue(REDRAWVIEW3D, 0);
- BIF_undo_push("Reveal");
-
-}
-
-void selectswapNurb()
-{
- Nurb *nu;
- BPoint *bp;
- BezTriple *bezt;
- int a;
-
- if(G.obedit==0) return;
-
- for(nu= editNurb.first; nu; nu= nu->next) {
- if((nu->type & 7)==CU_BEZIER) {
- bezt= nu->bezt;
- a= nu->pntsu;
- while(a--) {
- if(bezt->hide==0) {
- bezt->f2 ^= SELECT; /* always do the center point */
- if ((G.f & G_HIDDENHANDLES)==0) {
- bezt->f1 ^= SELECT;
- bezt->f3 ^= SELECT;
- }
- }
- bezt++;
- }
- }
- else {
- bp= nu->bp;
- a= nu->pntsu*nu->pntsv;
- while(a--) {
- swap_selection_bpoint(bp);
- bp++;
- }
- }
- }
-
- countall();
- allqueue(REDRAWVIEW3D, 0);
- BIF_undo_push("Select swap");
-
-}
-
-/** Divide the line segments associated with the currently selected
- * curve nodes (Bezier or NURB). If there are no valid segment
- * selections within the current selection, nothing happens.
- *
- * @deffunc subdividenurb subdivideNurb(void)
- * @return Nothing
- * @param None
-*/
-void subdivideNurb()
-{
- Nurb *nu;
- BezTriple *prevbezt, *bezt, *beztnew, *beztn;
- BPoint *bp, *prevbp, *bpnew, *bpn;
- float vec[15];
- int a, b, sel, amount, *usel, *vsel;
-
- // printf("*** subdivideNurb: entering subdivide\n");
-
- for(nu= editNurb.first; nu; nu= nu->next) {
- amount= 0;
- if((nu->type & 7)==CU_BEZIER) {
- /*
- Insert a point into a 2D Bezier curve.
- Endpoints are preserved. Otherwise, all selected and inserted points are
- newly created. Old points are discarded.
- */
- /* count */
- if(nu->flagu & 1) {
- a= nu->pntsu;
- bezt= nu->bezt;
- prevbezt= bezt+(a-1);
- }
- else {
- a= nu->pntsu-1;
- prevbezt= nu->bezt;
- bezt= prevbezt+1;
- }
- while(a--) {
- if( BEZSELECTED_HIDDENHANDLES(prevbezt) && BEZSELECTED_HIDDENHANDLES(bezt) ) amount++;
- prevbezt= bezt;
- bezt++;
- }
-
- if(amount) {
- /* insert */
- beztnew =
- (BezTriple*)MEM_mallocN((amount + nu->pntsu) * sizeof(BezTriple), "subdivNurb");
- beztn= beztnew;
- if(nu->flagu & 1) {
- a= nu->pntsu;
- bezt= nu->bezt;
- prevbezt= bezt+(a-1);
- }
- else {
- a= nu->pntsu-1;
- prevbezt= nu->bezt;
- bezt= prevbezt+1;
- }
- while(a--) {
- memcpy(beztn, prevbezt, sizeof(BezTriple));
- beztn++;
-
- if( BEZSELECTED_HIDDENHANDLES(prevbezt) && BEZSELECTED_HIDDENHANDLES(bezt) ) {
- memcpy(beztn, bezt, sizeof(BezTriple));
-
- /* midpoint subdividing */
- VecMidf(vec, prevbezt->vec[1], prevbezt->vec[2]);
- VecMidf(vec+3, prevbezt->vec[2], bezt->vec[0]);
- VecMidf(vec+6, bezt->vec[0], bezt->vec[1]);
-
- VecMidf(vec+9, vec, vec+3);
- VecMidf(vec+12, vec+3, vec+6);
-
- /* change handle of prev beztn */
- VECCOPY((beztn-1)->vec[2], vec);
- /* new point */
- VECCOPY(beztn->vec[0], vec+9);
- VecMidf(beztn->vec[1], vec+9, vec+12);
- VECCOPY(beztn->vec[2], vec+12);
- /* handle of next bezt */
- if(a==0 && (nu->flagu & 1)) {VECCOPY(beztnew->vec[0], vec+6);}
- else {VECCOPY(bezt->vec[0], vec+6);}
-
- beztn->radius = (prevbezt->radius + bezt->radius)/2.0f;
- beztn->weight = (prevbezt->weight + bezt->weight)/2.0f;
-
- beztn++;
- }
-
- prevbezt= bezt;
- bezt++;
- }
- /* last point */
- if((nu->flagu & 1)==0) memcpy(beztn, prevbezt, sizeof(BezTriple));
-
- MEM_freeN(nu->bezt);
- nu->bezt= beztnew;
- nu->pntsu+= amount;
-
- calchandlesNurb(nu);
- }
- } /* End of 'if((nu->type & 7)==CU_BEZIER)' */
- else if (nu->pntsv==1) {
- /*
- All flat lines (ie. co-planar), except flat Nurbs. Flat NURB curves
- are handled together with the regular NURB plane division, as it
- should be. I split it off just now, let's see if it is
- stable... nzc 30-5-'00
- */
- /* count */
- if(nu->flagu & 1) {
- a= nu->pntsu*nu->pntsv;
- bp= nu->bp;
- prevbp= bp+(a-1);
- }
- else {
- a= nu->pntsu-1;
- prevbp= nu->bp;
- bp= prevbp+1;
- }
- while(a--) {
- if( (bp->f1 & SELECT) && (prevbp->f1 & SELECT) ) amount++;
- prevbp= bp;
- bp++;
- }
-
- if(amount) {
- /* insert */
- bpnew =
- (BPoint*)MEM_mallocN((amount + nu->pntsu) * sizeof(BPoint), "subdivNurb2");
- bpn= bpnew;
-
- if(nu->flagu & 1) {
- a= nu->pntsu;
- bp= nu->bp;
- prevbp= bp+(a-1);
- }
- else {
- a= nu->pntsu-1;
- prevbp= nu->bp;
- bp= prevbp+1;
- }
- while(a--) {
- memcpy(bpn, prevbp, sizeof(BPoint));
- bpn++;
-
- if( (bp->f1 & SELECT) && (prevbp->f1 & SELECT) ) {
- // printf("*** subdivideNurb: insert 'linear' point\n");
- memcpy(bpn, bp, sizeof(BPoint));
- bpn->vec[0]= (prevbp->vec[0]+bp->vec[0])/2.0;
- bpn->vec[1]= (prevbp->vec[1]+bp->vec[1])/2.0;
- bpn->vec[2]= (prevbp->vec[2]+bp->vec[2])/2.0;
- bpn->vec[3]= (prevbp->vec[3]+bp->vec[3])/2.0;
- bpn++;
-
- }
- prevbp= bp;
- bp++;
- }
- if((nu->flagu & 1)==0) memcpy(bpn, prevbp, sizeof(BPoint)); /* last point */
-
- MEM_freeN(nu->bp);
- nu->bp= bpnew;
- nu->pntsu+= amount;
-
- if(nu->type & 4) {
- makeknots(nu, 1, nu->flagu>>1);
- }
- }
- } /* End of 'else if(nu->pntsv==1)' */
- else if((nu->type & 7)==CU_NURBS) {
- /* This is a very strange test ... */
- /**
- Subdivide NURB surfaces - nzc 30-5-'00 -
-
- Subdivision of a NURB curve can be effected by adding a
- control point (insertion of a knot), or by raising the
- degree of the functions used to build the NURB. The
- expression
-
- degree = #knots - #controlpoints + 1 (J Walter piece)
- degree = #knots - #controlpoints (Blender
- implementation)
- ( this is confusing.... what is true? Another concern
- is that the JW piece allows the curve to become
- explicitly 1st order derivative discontinuous, while
- this is not what we want here... )
-
- is an invariant for a single NURB curve. Raising the degree
- of the NURB is done elsewhere; the degree is assumed
- constant during this opration. Degree is a property shared
- by all controlpoints in a curve (even though it is stored
- per control point - this can be misleading).
- Adding a knot is done by searching for the place in the
- knot vector where a certain knot value must be inserted, or
- by picking an appropriate knot value between two existing
- ones. The number of controlpoints that is influenced by the
- insertion depends on the order of the curve. A certain
- minimum number of knots is needed to form high-order
- curves, as can be seen from the equation above. In Blender,
- currently NURBs may be up to 6th order, so we modify at
- most 6 points. One point is added. For an n-degree curve,
- n points are discarded, and n+1 points inserted
- (so effectively, n points are modified). (that holds for
- the JW piece, but it seems not for our NURBs)
- In practice, the knot spacing is copied, but the tail
- (the points following the insertion point) need to be
- offset to keep the knot series ascending. The knot series
- is always a series of monotonically ascending integers in
- Blender. When not enough control points are available to
- fit the order, duplicates of the endpoints are added as
- needed.
- */
- /* selection-arrays */
- usel= MEM_callocN(sizeof(int)*nu->pntsu, "subivideNurb3");
- vsel= MEM_callocN(sizeof(int)*nu->pntsv, "subivideNurb3");
- sel= 0;
-
- /* Count the number of selected points. */
- bp= nu->bp;
- for(a=0; a<nu->pntsv; a++) {
- for(b=0; b<nu->pntsu; b++) {
- if(bp->f1 & SELECT) {
- usel[b]++;
- vsel[a]++;
- sel++;
- }
- bp++;
- }
- }
- if( sel == (nu->pntsu*nu->pntsv) ) { /* subdivide entire nurb */
- /* Global subdivision is a special case of partial
- subdivision. Strange it is considered separately... */
- bpn=bpnew= MEM_mallocN( (2*nu->pntsu-1)*(2*nu->pntsv-1)*sizeof(BPoint), "subdivideNurb4");
- bp= nu->bp;
- /* first subdivide rows */
- for(a=0; a<nu->pntsv; a++) {
- for(b=0; b<nu->pntsu; b++) {
- *bpn= *bp;
- bpn++;
- bp++;
- if(b<nu->pntsu-1) {
- *bpn= *bp;
- prevbp= bp-1;
- bpn->vec[0]= (prevbp->vec[0]+bp->vec[0])/2.0;
- bpn->vec[1]= (prevbp->vec[1]+bp->vec[1])/2.0;
- bpn->vec[2]= (prevbp->vec[2]+bp->vec[2])/2.0;
- bpn->vec[3]= (prevbp->vec[3]+bp->vec[3])/2.0;
- bpn++;
- }
- }
- bpn+= (2*nu->pntsu-1);
- }
- /* now insert new */
- bpn= bpnew+(2*nu->pntsu-1);
- bp= bpnew+(4*nu->pntsu-2);
- prevbp= bpnew;
- for(a=1; a<nu->pntsv; a++) {
-
- for(b=0; b<2*nu->pntsu-1; b++) {
- *bpn= *bp;
- bpn->vec[0]= (prevbp->vec[0]+bp->vec[0])/2.0;
- bpn->vec[1]= (prevbp->vec[1]+bp->vec[1])/2.0;
- bpn->vec[2]= (prevbp->vec[2]+bp->vec[2])/2.0;
- bpn->vec[3]= (prevbp->vec[3]+bp->vec[3])/2.0;
- bpn++;
- bp++;
- prevbp++;
- }
- bp+= (2*nu->pntsu-1);
- bpn+= (2*nu->pntsu-1);
- prevbp+= (2*nu->pntsu-1);
- }
- MEM_freeN(nu->bp);
- nu->bp= bpnew;
- nu->pntsu= 2*nu->pntsu-1;
- nu->pntsv= 2*nu->pntsv-1;
- makeknots(nu, 1, nu->flagu>>1);
- makeknots(nu, 2, nu->flagv>>1);
- } /* End of 'if(sel== nu->pntsu*nu->pntsv)' (subdivide entire NURB) */
- else {
- /* subdivide in v direction? */
- sel= 0;
- for(a=0; a<nu->pntsv-1; a++) {
- if(vsel[a]==nu->pntsu && vsel[a+1]==nu->pntsu) sel++;
- }
-
- if(sel) { /* V ! */
- bpn=bpnew= MEM_mallocN( (sel+nu->pntsv)*nu->pntsu*sizeof(BPoint), "subdivideNurb4");
- bp= nu->bp;
- for(a=0; a<nu->pntsv; a++) {
- for(b=0; b<nu->pntsu; b++) {
- *bpn= *bp;
- bpn++;
- bp++;
- }
- if( (a<nu->pntsv-1) && vsel[a]==nu->pntsu && vsel[a+1]==nu->pntsu ) {
- prevbp= bp- nu->pntsu;
- for(b=0; b<nu->pntsu; b++) {
- /*
- This simple bisection must be replaces by a
- subtle resampling of a number of points. Our
- task is made slightly easier because each
- point in our curve is a separate data
- node. (is it?)
- */
- *bpn= *prevbp;
- bpn->vec[0]= (prevbp->vec[0]+bp->vec[0])/2.0;
- bpn->vec[1]= (prevbp->vec[1]+bp->vec[1])/2.0;
- bpn->vec[2]= (prevbp->vec[2]+bp->vec[2])/2.0;
- bpn->vec[3]= (prevbp->vec[3]+bp->vec[3])/2.0;
- bpn++;
- prevbp++;
- bp++;
- }
- bp-= nu->pntsu;
- }
- }
- MEM_freeN(nu->bp);
- nu->bp= bpnew;
- nu->pntsv+= sel;
- makeknots(nu, 2, nu->flagv>>1);
- }
- else {
- /* or in u direction? */
- sel= 0;
- for(a=0; a<nu->pntsu-1; a++) {
- if(usel[a]==nu->pntsv && usel[a+1]==nu->pntsv) sel++;
- }
-
- if(sel) { /* U ! */
- /* Inserting U points is sort of 'default' Flat curves only get */
- /* U points inserted in them. */
- bpn=bpnew= MEM_mallocN( (sel+nu->pntsu)*nu->pntsv*sizeof(BPoint), "subdivideNurb4");
- bp= nu->bp;
- for(a=0; a<nu->pntsv; a++) {
- for(b=0; b<nu->pntsu; b++) {
- *bpn= *bp;
- bpn++;
- bp++;
- if( (b<nu->pntsu-1) && usel[b]==nu->pntsv && usel[b+1]==nu->pntsv ) {
- /*
- One thing that bugs me here is that the
- orders of things are not the same as in
- the JW piece. Also, this implies that we
- handle at most 3rd order curves? I miss
- some symmetry here...
- */
- prevbp= bp- 1;
- *bpn= *prevbp;
- bpn->vec[0]= (prevbp->vec[0]+bp->vec[0])/2.0;
- bpn->vec[1]= (prevbp->vec[1]+bp->vec[1])/2.0;
- bpn->vec[2]= (prevbp->vec[2]+bp->vec[2])/2.0;
- bpn->vec[3]= (prevbp->vec[3]+bp->vec[3])/2.0;
- bpn++;
- }
- }
- }
- MEM_freeN(nu->bp);
- nu->bp= bpnew;
- nu->pntsu+= sel;
- makeknots(nu, 1, nu->flagu>>1); /* shift knots
- forward */
- }
- }
- }
- MEM_freeN(usel);
- MEM_freeN(vsel);
-
- } /* End of 'if((nu->type & 7)==CU_NURBS)' */
- }
-
-
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-
- countall();
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- BIF_undo_push("Subdivide");
-
-}
-
-static void findnearestNurbvert__doClosest(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y)
-{
- struct { BPoint *bp; BezTriple *bezt; Nurb *nurb; short dist, hpoint, select, mval[2]; } *data = userData;
-
- short flag;
- short temp;
-
- if (bp) {
- flag = bp->f1;
- } else {
- if (beztindex==0) {
- flag = bezt->f1;
- } else if (beztindex==1) {
- flag = bezt->f2;
- } else {
- flag = bezt->f3;
- }
- }
-
- temp = abs(data->mval[0]-x) + abs(data->mval[1]-y);
- if ((flag&1)==data->select) temp += 5;
- if (bezt && beztindex==1) temp += 3; /* middle points get a small disadvantage */
-
- if (temp<data->dist) {
- data->dist = temp;
-
- data->bp = bp;
- data->bezt = bezt;
- data->nurb = nu;
- data->hpoint = bezt?beztindex:0;
- }
-}
-
-static short findnearestNurbvert(short sel, Nurb **nurb, BezTriple **bezt, BPoint **bp)
-{
- /* sel==1: selected gets a disadvantage */
- /* in nurb and bezt or bp the nearest is written */
- /* return 0 1 2: handlepunt */
- struct { BPoint *bp; BezTriple *bezt; Nurb *nurb; short dist, hpoint, select, mval[2]; } data = {0};
-
- data.dist = 100;
- data.hpoint = 0;
- data.select = sel;
- getmouseco_areawin(data.mval);
-
- nurbs_foreachScreenVert(findnearestNurbvert__doClosest, &data);
-
- *nurb = data.nurb;
- *bezt = data.bezt;
- *bp = data.bp;
-
- return data.hpoint;
-}
-
-
-static void findselectedNurbvert(Nurb **nu, BezTriple **bezt, BPoint **bp)
-{
- /* in nu and (bezt or bp) selected are written if there's 1 sel. */
- /* if more points selected in 1 spline: return only nu, bezt and bp are 0 */
- Nurb *nu1;
- BezTriple *bezt1;
- BPoint *bp1;
- int a;
-
- *nu= 0;
- *bezt= 0;
- *bp= 0;
- for(nu1= editNurb.first; nu1; nu1= nu1->next) {
- if((nu1->type & 7)==CU_BEZIER) {
- bezt1= nu1->bezt;
- a= nu1->pntsu;
- while(a--) {
- if( (bezt1->f1 & SELECT) || (bezt1->f2 & SELECT) || (bezt1->f3 & SELECT) ) {
- if(*nu!=0 && *nu!= nu1) {
- *nu= 0;
- *bp= 0;
- *bezt= 0;
- return;
- }
- else if(*bezt || *bp) {
- *bp= 0;
- *bezt= 0;
- }
- else {
- *bezt= bezt1;
- *nu= nu1;
- }
- }
- bezt1++;
- }
- }
- else {
- bp1= nu1->bp;
- a= nu1->pntsu*nu1->pntsv;
- while(a--) {
- if( bp1->f1 & 1 ) {
- if(*nu!=0 && *nu!= nu1) {
- *bp= 0;
- *bezt= 0;
- *nu= 0;
- return;
- }
- else if(*bezt || *bp) {
- *bp= 0;
- *bezt= 0;
- }
- else {
- *bp= bp1;
- *nu= nu1;
- }
- }
- bp1++;
- }
- }
- }
-}
-
-int convertspline(short type, Nurb *nu)
-{
- BezTriple *bezt;
- BPoint *bp;
- int a, c, nr;
-
- if((nu->type & 7)==0) { /* Poly */
- if(type==CU_BEZIER) { /* to Bezier with vecthandles */
- nr= nu->pntsu;
- bezt =
- (BezTriple*)MEM_callocN(nr * sizeof(BezTriple), "setsplinetype2");
- nu->bezt= bezt;
- a= nr;
- bp= nu->bp;
- while(a--) {
- VECCOPY(bezt->vec[1], bp->vec);
- bezt->f1=bezt->f2=bezt->f3= bp->f1;
- bezt->h1= bezt->h2= HD_VECT;
- bezt->weight= bp->weight;
- bezt->radius= bp->radius;
- bp++;
- bezt++;
- }
- MEM_freeN(nu->bp);
- nu->bp= 0;
- nu->pntsu= nr;
- nu->type &= ~7;
- nu->type |= 1;
- calchandlesNurb(nu);
- }
- else if(type==4) { /* to Nurb */
- nu->type &= ~7;
- nu->type+= 4;
- nu->orderu= 4;
- nu->flagu &= 1;
- nu->flagu += 4;
- makeknots(nu, 1, nu->flagu>>1);
- a= nu->pntsu*nu->pntsv;
- bp= nu->bp;
- while(a--) {
- bp->vec[3]= 1.0;
- bp++;
- }
- }
- }
- else if((nu->type & 7)==CU_BEZIER) { /* Bezier */
- if(type==0 || type==4) { /* to Poly or Nurb */
- nr= 3*nu->pntsu;
- nu->bp = MEM_callocN(nr * sizeof(BPoint), "setsplinetype");
- a= nu->pntsu;
- bezt= nu->bezt;
- bp= nu->bp;
- while(a--) {
- if(type==0 && bezt->h1==HD_VECT && bezt->h2==HD_VECT) {
- /* vector handle becomes 1 poly vertice */
- VECCOPY(bp->vec, bezt->vec[1]);
- bp->vec[3]= 1.0;
- bp->f1= bezt->f2;
- nr-= 2;
- bp->radius= bezt->radius;
- bp->weight= bezt->weight;
- bp++;
- }
- else {
- for(c=0;c<3;c++) {
- VECCOPY(bp->vec, bezt->vec[c]);
- bp->vec[3]= 1.0;
- if(c==0) bp->f1= bezt->f1;
- else if(c==1) bp->f1= bezt->f2;
- else bp->f1= bezt->f3;
- bp->radius= bezt->radius;
- bp->weight= bezt->weight;
- bp++;
- }
- }
- bezt++;
- }
- MEM_freeN(nu->bezt);
- nu->bezt= 0;
- nu->pntsu= nr;
- nu->pntsv= 1;
- nu->orderu= 4;
- nu->orderv= 1;
- nu->type &= ~7;
- nu->type+= type;
- if(nu->flagu & 1) c= nu->orderu-1;
- else c= 0;
- if(type== 4) {
- nu->flagu &= 1;
- nu->flagu += 4;
- makeknots(nu, 1, nu->flagu>>1);
- }
- }
- }
- else if( (nu->type & 7)==CU_NURBS) {
- if(type==0) { /* to Poly */
- nu->type &= ~7;
- if(nu->knotsu) MEM_freeN(nu->knotsu); /* python created nurbs have a knotsu of zero */
- nu->knotsu= 0;
- if(nu->knotsv) MEM_freeN(nu->knotsv);
- nu->knotsv= 0;
- }
- else if(type==CU_BEZIER) { /* to Bezier */
- nr= nu->pntsu/3;
-
- if(nr<2)
- return 1; /* conversion impossible */
- else {
- bezt = MEM_callocN(nr * sizeof(BezTriple), "setsplinetype2");
- nu->bezt= bezt;
- a= nr;
- bp= nu->bp;
- while(a--) {
- VECCOPY(bezt->vec[0], bp->vec);
- bezt->f1= bp->f1;
- bp++;
- VECCOPY(bezt->vec[1], bp->vec);
- bezt->f2= bp->f1;
- bp++;
- VECCOPY(bezt->vec[2], bp->vec);
- bezt->f3= bp->f1;
- bezt->radius= bp->radius;
- bezt->weight= bp->weight;
- bp++;
- bezt++;
- }
- MEM_freeN(nu->bp);
- nu->bp= 0;
- MEM_freeN(nu->knotsu);
- nu->knotsu= 0;
- nu->pntsu= nr;
- nu->type &= ~7;
- nu->type+= 1;
- }
- }
- }
- return 0;
-}
-
-void setsplinetype(short type)
-{
- Nurb *nu;
-
- if(type==CU_CARDINAL || type==CU_BSPLINE) {
- error("Not implemented yet");
- return;
- }
-
- for(nu= editNurb.first; nu; nu= nu->next) {
- if(isNurbsel(nu)) {
- if (convertspline(type, nu))
- error("no conversion possible");
- }
- }
- BIF_undo_push("Set spline type");
-
-}
-
-/* ******************** SKINNING LOFTING!!! ******************** */
-
-void rotate_direction_nurb(Nurb *nu)
-{
- BPoint *bp1, *bp2, *temp;
- int u, v;
-
- SWAP(short, nu->pntsu, nu->pntsv);
- SWAP(short, nu->orderu, nu->orderv);
- SWAP(short, nu->resolu, nu->resolv);
- SWAP(short, nu->flagu, nu->flagv);
-
- SWAP(float *, nu->knotsu, nu->knotsv);
- switchdirection_knots(nu->knotsv, KNOTSV(nu) );
-
- temp= MEM_dupallocN(nu->bp);
- bp1= nu->bp;
- for(v=0; v<nu->pntsv; v++) {
- for(u=0; u<nu->pntsu; u++, bp1++) {
- bp2= temp + (nu->pntsu-u-1)*(nu->pntsv) + v;
- *bp1= *bp2;
- }
- }
-
- MEM_freeN(temp);
-}
-
-int is_u_selected(Nurb *nu, int u)
-{
- BPoint *bp;
- int v;
-
- /* what about resolu == 2? */
- bp= nu->bp+u;
- for(v=0; v<nu->pntsv-1; v++, bp+=nu->pntsu) {
- if(v) if(bp->f1 & SELECT) return 1;
- }
-
- return 0;
-}
-
-/* ******************************** */
-
-typedef struct NurbSort {
- struct NurbSort *next, *prev;
- Nurb *nu;
- float vec[3];
-} NurbSort;
-
-static ListBase nsortbase= {0, 0};
-/* static NurbSort *nusmain; */ /* this var seems to go unused... at least in this file */
-
-void make_selection_list_nurb()
-{
- ListBase nbase= {0, 0};
- NurbSort *nus, *nustest, *headdo, *taildo;
- Nurb *nu;
- BPoint *bp;
- float dist, headdist, taildist;
- int a;
-
- for(nu= editNurb.first; nu; nu= nu->next) {
- if( isNurbsel(nu) ) {
-
- nus = (NurbSort*)MEM_callocN(sizeof(NurbSort), "sort");
- BLI_addhead(&nbase, nus);
- nus->nu= nu;
-
- bp= nu->bp;
- a= nu->pntsu;
- while(a--) {
- VecAddf(nus->vec, nus->vec, bp->vec);
- bp++;
- }
- VecMulf(nus->vec, 1.0/(float)nu->pntsu);
-
-
- }
- }
-
- /* just add the first one */
- nus= nbase.first;
- BLI_remlink(&nbase, nus);
- BLI_addtail( &nsortbase, nus);
-
- /* now add, either at head or tail, the closest one */
- while(nbase.first) {
-
- headdist= taildist= 1.0e30;
- headdo= taildo= 0;
-
- nustest= nbase.first;
- while(nustest) {
- dist= VecLenf(nustest->vec, ((NurbSort *)nsortbase.first)->vec);
-
- if(dist<headdist) {
- headdist= dist;
- headdo= nustest;
- }
- dist= VecLenf(nustest->vec, ((NurbSort *)nsortbase.last)->vec);
-
- if(dist<taildist) {
- taildist= dist;
- taildo= nustest;
- }
- nustest= nustest->next;
- }
-
- if(headdist<taildist) {
- BLI_remlink(&nbase, headdo);
- BLI_addhead(&nsortbase, headdo);
- }
- else {
- BLI_remlink(&nbase, taildo);
- BLI_addtail(&nsortbase, taildo);
- }
- }
-}
-
-void merge_2_nurb(Nurb *nu1, Nurb *nu2)
-{
- BPoint *bp, *bp1, *bp2, *temp;
- float len1, len2;
- int origu, u, v;
-
- /* first nurbs will be changed to make u = resolu-1 selected */
- /* 2nd nurbs will be changed to make u = 0 selected */
-
- /* first nurbs: u = resolu-1 selected */
-
- if( is_u_selected(nu1, nu1->pntsu-1) );
- else {
- rotate_direction_nurb(nu1);
- if( is_u_selected(nu1, nu1->pntsu-1) );
- else {
- rotate_direction_nurb(nu1);
- if( is_u_selected(nu1, nu1->pntsu-1) );
- else {
- rotate_direction_nurb(nu1);
- if( is_u_selected(nu1, nu1->pntsu-1) );
- else {
- /* rotate again, now its OK! */
- if(nu1->pntsv!=1) rotate_direction_nurb(nu1);
- return;
- }
- }
- }
- }
-
- /* 2nd nurbs: u = 0 selected */
- if( is_u_selected(nu2, 0) );
- else {
- rotate_direction_nurb(nu2);
- if( is_u_selected(nu2, 0) );
- else {
- rotate_direction_nurb(nu2);
- if( is_u_selected(nu2, 0) );
- else {
- rotate_direction_nurb(nu2);
- if( is_u_selected(nu2, 0) );
- else {
- /* rotate again, now its OK! */
- if(nu1->pntsu==1) rotate_direction_nurb(nu1);
- if(nu2->pntsv!=1) rotate_direction_nurb(nu2);
- return;
- }
- }
- }
- }
-
- if( nu1->pntsv != nu2->pntsv ) {
- error("Resolution doesn't match");
- return;
- }
-
- /* ok, now nu1 has the rightmost collumn and nu2 the leftmost collumn selected */
- /* maybe we need a 'v' flip of nu2? */
-
- bp1= nu1->bp+nu1->pntsu-1;
- bp2= nu2->bp;
- len1= 0.0;
-
- for(v=0; v<nu1->pntsv; v++, bp1+=nu1->pntsu, bp2+=nu2->pntsu) {
- len1+= VecLenf(bp1->vec, bp2->vec);
- }
-
- bp1= nu1->bp + nu1->pntsu-1;
- bp2= nu2->bp + nu2->pntsu*(nu2->pntsv-1);
- len2= 0.0;
-
- for(v=0; v<nu1->pntsv; v++, bp1+=nu1->pntsu, bp2-=nu2->pntsu) {
- len2+= VecLenf(bp1->vec, bp2->vec);
- }
-
- /* merge */
- origu= nu1->pntsu;
- nu1->pntsu+= nu2->pntsu;
- nu1->resolu+= nu2->pntsu;
- if(nu1->resolv < nu2->resolv) nu1->resolv= nu2->resolv;
- if(nu1->orderu<3) nu1->orderu++;
- if(nu1->orderv<3) nu1->orderv++;
- temp= nu1->bp;
- nu1->bp= MEM_mallocN(nu1->pntsu*nu1->pntsv*sizeof(BPoint), "mergeBP");
-
- bp= nu1->bp;
- bp1= temp;
-
- for(v=0; v<nu1->pntsv; v++) {
-
- /* switch direction? */
- if(len1<len2) bp2= nu2->bp + v*nu2->pntsu;
- else bp2= nu2->bp + (nu1->pntsv-v-1)*nu2->pntsu;
-
- for(u=0; u<nu1->pntsu; u++, bp++) {
- if(u<origu) {
- *bp= *bp1; bp1++;
- select_bpoint(bp, SELECT, 1, HIDDEN);
- }
- else {
- *bp= *bp2; bp2++;
- }
- }
- }
-
- if((nu1->type & 7)==4) {
- /* merge knots */
- makeknots(nu1, 1, nu1->flagu>>1);
-
- /* make knots, for merged curved for example */
- makeknots(nu1, 2, nu1->flagv>>1);
- }
-
- MEM_freeN(temp);
- BLI_remlink(&editNurb, nu2);
- freeNurb(nu2);
-}
-
-void merge_nurb()
-{
- NurbSort *nus1, *nus2;
- int ok= 1;
-
- make_selection_list_nurb();
-
- if(nsortbase.first == nsortbase.last) {
- BLI_freelistN(&nsortbase);
- error("Too few selections to merge");
- return;
- }
-
- nus1= nsortbase.first;
- nus2= nus1->next;
-
- /* resolution match, to avoid uv rotations */
- if(nus1->nu->pntsv==1) {
- if(nus1->nu->pntsu==nus2->nu->pntsu || nus1->nu->pntsu==nus2->nu->pntsv);
- else ok= 0;
- }
- else if(nus2->nu->pntsv==1) {
- if(nus2->nu->pntsu==nus1->nu->pntsu || nus2->nu->pntsu==nus1->nu->pntsv);
- else ok= 0;
- }
- else if( nus1->nu->pntsu==nus2->nu->pntsu || nus1->nu->pntsv==nus2->nu->pntsv);
- else if( nus1->nu->pntsu==nus2->nu->pntsv || nus1->nu->pntsv==nus2->nu->pntsu);
- else {
- ok= 0;
- }
-
- if(ok==0) {
- error("Resolution doesn't match");
- BLI_freelistN(&nsortbase);
- return;
- }
-
- while(nus2) {
- merge_2_nurb(nus1->nu, nus2->nu);
- nus2= nus2->next;
- }
-
- BLI_freelistN(&nsortbase);
-
- countall();
- lastnu= NULL;
-
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- BIF_undo_push("Merge");
-
-}
-
-
-void addsegment_nurb()
-{
- /* joins 2 curves */
- Nurb *nu, *nu1=0, *nu2=0;
- BezTriple *bezt;
- BPoint *bp;
- float *fp, offset;
- int a;
-
- /* first decide if this is a surface merge! */
- if(G.obedit->type==OB_SURF) nu= editNurb.first;
- else nu= NULL;
-
- while(nu) {
- if( isNurbsel(nu) ) {
-
- if(nu->pntsu>1 && nu->pntsv>1) break;
- if(isNurbsel_count(nu)>1) break;
- if(isNurbsel_count(nu)==1) {
- /* only 1 selected, not first or last, a little complex, but intuitive */
- if(nu->pntsv==1) {
- if( (nu->bp->f1 & SELECT) || ((nu->bp+nu->pntsu-1)->f1 & SELECT));
- else break;
- }
- }
- }
- nu= nu->next;
- }
- if(nu) {
- merge_nurb();
- return;
- }
-
- /* find both nurbs and points, nu1 will be put behind nu2 */
- for(nu= editNurb.first; nu; nu= nu->next) {
- if((nu->flagu & 1)==0) { /* not cyclic */
- if( (nu->type & 7)==CU_BEZIER ) {
- bezt= nu->bezt;
- if(nu1==0) {
- if( BEZSELECTED_HIDDENHANDLES(bezt) ) nu1= nu;
- else {
- bezt= bezt+(nu->pntsu-1);
- if( BEZSELECTED_HIDDENHANDLES(bezt) ) {
- nu1= nu;
- switchdirectionNurb(nu);
- }
- }
- }
- else if(nu2==0) {
- if( BEZSELECTED_HIDDENHANDLES(bezt) ) {
- nu2= nu;
- switchdirectionNurb(nu);
- }
- else {
- bezt= bezt+(nu->pntsu-1);
- if( BEZSELECTED_HIDDENHANDLES(bezt) ) {
- nu2= nu;
- }
- }
- }
- else break;
- }
- else if(nu->pntsv==1) {
- bp= nu->bp;
- if(nu1==0) {
- if( bp->f1 & SELECT) nu1= nu;
- else {
- bp= bp+(nu->pntsu-1);
- if( bp->f1 & SELECT ) {
- nu1= nu;
- switchdirectionNurb(nu);
- }
- }
- }
- else if(nu2==0) {
- if( bp->f1 & SELECT ) {
- nu2= nu;
- switchdirectionNurb(nu);
- }
- else {
- bp= bp+(nu->pntsu-1);
- if( bp->f1 & SELECT ) {
- nu2= nu;
- }
- }
- }
- else break;
- }
- }
- }
-
- if((nu1 && nu2) && (nu1!=nu2)) {
- if( nu1->type==nu2->type) {
- if((nu1->type & 7)==CU_BEZIER) {
- bezt =
- (BezTriple*)MEM_mallocN((nu1->pntsu+nu2->pntsu) * sizeof(BezTriple), "addsegmentN");
- memcpy(bezt, nu2->bezt, nu2->pntsu*sizeof(BezTriple));
- memcpy(bezt+nu2->pntsu, nu1->bezt, nu1->pntsu*sizeof(BezTriple));
- MEM_freeN(nu1->bezt);
- nu1->bezt= bezt;
- nu1->pntsu+= nu2->pntsu;
- BLI_remlink(&editNurb, nu2);
- freeNurb(nu2);
- calchandlesNurb(nu1);
- }
- else {
- bp =
- (BPoint*)MEM_mallocN((nu1->pntsu+nu2->pntsu) * sizeof(BPoint), "addsegmentN2");
- memcpy(bp, nu2->bp, nu2->pntsu*sizeof(BPoint) );
- memcpy(bp+nu2->pntsu, nu1->bp, nu1->pntsu*sizeof(BPoint));
- MEM_freeN(nu1->bp);
- nu1->bp= bp;
-
- a= nu1->pntsu+nu1->orderu;
-
- nu1->pntsu+= nu2->pntsu;
- BLI_remlink(&editNurb, nu2);
-
- /* now join the knots */
- if((nu1->type & 7)==4) {
- if(nu1->knotsu==NULL) {
- makeknots(nu1, 1, nu1->flagu>>1);
- }
- else {
- fp= MEM_mallocN(sizeof(float)*KNOTSU(nu1), "addsegment3");
- memcpy(fp, nu1->knotsu, sizeof(float)*a);
- MEM_freeN(nu1->knotsu);
- nu1->knotsu= fp;
-
-
- offset= nu1->knotsu[a-1] +1.0;
- fp= nu1->knotsu+a;
- for(a=0; a<nu2->pntsu; a++, fp++) {
- if(nu2->knotsu)
- *fp= offset+nu2->knotsu[a+1];
- else
- *fp = offset;
- }
- }
- }
- freeNurb(nu2);
- }
- }
-
- lastnu= NULL; /* for selected */
-
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-
- countall();
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- BIF_undo_push("Add segment");
-
- }
- else error("Can't make segment");
-}
-
-void mouse_nurb()
-{
- Nurb *nu;
- BezTriple *bezt=0;
- BPoint *bp=0;
- short hand;
-
- hand= findnearestNurbvert(1, &nu, &bezt, &bp);
-
- if(bezt || bp) {
- if((G.qual & LR_SHIFTKEY)==0) {
-
- setflagsNurb(0);
-
- if(bezt) {
-
- if(hand==1) select_beztriple(bezt, SELECT, 1, HIDDEN);
- else if(hand==0) bezt->f1|= SELECT;
- else bezt->f3|= SELECT;
- }
- else {
- lastselbp= bp;
- select_bpoint(bp, SELECT, 1, HIDDEN);
- }
-
- allqueue(REDRAWVIEW3D, 0);
- }
- else {
- if(bezt) {
- if(hand==1) {
- if(bezt->f2 & SELECT) select_beztriple(bezt, DESELECT, 1, HIDDEN);
- else select_beztriple(bezt, SELECT, 1, HIDDEN);
- } else if(hand==0) {
- bezt->f1 ^= SELECT;
- } else {
- bezt->f3 ^= SELECT;
- }
- }
- else {
- if(bp->f1 & SELECT) select_bpoint(bp, DESELECT, 1, HIDDEN);
- else {
- select_bpoint(bp, SELECT, 1, HIDDEN);
- lastselbp= bp;
- }
- }
-
- allqueue(REDRAWVIEW3D, 0);
-
- }
-
- countall();
- }
-
- rightmouse_transform();
-
- if(nu!=lastnu) {
- lastnu= nu;
- allqueue(REDRAWBUTSEDIT, 0);
- }
-
-}
-
-/* from what I can gather, the mode==0 magic number spins and bridges the nurbs based on the
- * orientation of the global 3d view (yuck yuck!) mode==1 does the same, but doesn't bridge up
- * up the new geometry, mode==2 now does the same as 0, but aligned to world axes, not the view.
-*/
-static void spin_nurb(float *dvec, short mode)
-{
- Nurb *nu;
- float *curs, si,phi,n[3],q[4],cmat[3][3],tmat[3][3],imat[3][3];
- float cent[3],bmat[3][3], rotmat[3][3], scalemat1[3][3], scalemat2[3][3];
- float persmat[3][3], persinv[3][3];
- short a,ok;
-
- if(G.vd==0 || G.obedit==0 || G.obedit->type!=OB_SURF) return;
- if( (G.vd->lay & G.obedit->lay)==0 ) return;
-
- if (mode != 2) Mat3CpyMat4(persmat, G.vd->viewmat);
- else Mat3One(persmat);
- Mat3Inv(persinv, persmat);
-
- /* imat and center and size */
- Mat3CpyMat4(bmat, G.obedit->obmat);
- Mat3Inv(imat, bmat);
-
- curs= give_cursor();
- VECCOPY(cent, curs);
- VecSubf(cent, cent, G.obedit->obmat[3]);
- Mat3MulVecfl(imat,cent);
-
- if(dvec || mode==2) {
- n[0]=n[1]= 0.0;
- n[2]= 1.0;
- } else {
- n[0]= G.vd->viewinv[2][0];
- n[1]= G.vd->viewinv[2][1];
- n[2]= G.vd->viewinv[2][2];
- Normalize(n);
- }
-
- phi= M_PI/8.0;
- q[0]= cos(phi);
- si= sin(phi);
- q[1]= n[0]*si;
- q[2]= n[1]*si;
- q[3]= n[2]*si;
- QuatToMat3(q, cmat);
- Mat3MulMat3(tmat, cmat, bmat);
- Mat3MulMat3(rotmat, imat, tmat);
-
- Mat3One(scalemat1);
- scalemat1[0][0]= sqrt(2.0);
- scalemat1[1][1]= sqrt(2.0);
-
- Mat3MulMat3(tmat,persmat,bmat);
- Mat3MulMat3(cmat,scalemat1,tmat);
- Mat3MulMat3(tmat,persinv,cmat);
- Mat3MulMat3(scalemat1,imat,tmat);
-
- Mat3One(scalemat2);
- scalemat2[0][0]/= sqrt(2.0);
- scalemat2[1][1]/= sqrt(2.0);
-
- Mat3MulMat3(tmat,persmat,bmat);
- Mat3MulMat3(cmat,scalemat2,tmat);
- Mat3MulMat3(tmat,persinv,cmat);
- Mat3MulMat3(scalemat2,imat,tmat);
-
- ok= 1;
-
- for(a=0;a<7;a++) {
- if(mode==0 || mode==2) ok= extrudeflagNurb(1);
- else adduplicateflagNurb(1);
- if(ok==0) {
- error("Can't spin");
- break;
- }
- rotateflagNurb(1,cent,rotmat);
-
- if(mode==0 || mode==2) {
- if( (a & 1)==0 ) {
- rotateflagNurb(1,cent,scalemat1);
- weightflagNurb(1, 0.25*sqrt(2.0), 1);
- }
- else {
- rotateflagNurb(1,cent,scalemat2);
- weightflagNurb(1, 4.0/sqrt(2.0), 1);
- }
- }
- if(dvec) {
- Mat3MulVecfl(bmat,dvec);
- translateflagNurb(1,dvec);
- }
- }
-
- if(ok) {
- for(nu= editNurb.first; nu; nu= nu->next) {
- if(isNurbsel(nu)) {
- nu->orderv= 4;
- nu->flagv |= 1;
- makeknots(nu, 2, nu->flagv>>1);
- }
- }
- }
-
-}
-
-/* external one, for undo */
-void spinNurb(float *dvec, short mode)
-{
- spin_nurb(dvec, mode);
- BIF_undo_push("Spin");
-}
-
-void addvert_Nurb(int mode)
-{
- Nurb *nu;
- BezTriple *bezt, *newbezt = NULL;
- BPoint *bp, *newbp = NULL;
- float *curs, mat[3][3],imat[3][3], temp[3];
-
- if(G.obedit==0 || G.vd == 0) return;
- if( (G.vd->lay & G.obedit->lay)==0 ) return;
-
- Mat3CpyMat4(mat, G.obedit->obmat);
- Mat3Inv(imat,mat);
-
- findselectedNurbvert(&nu, &bezt, &bp);
- if(bezt==0 && bp==0) return;
-
- if((nu->type & 7)==CU_BEZIER) {
- /* which bezpoint? */
- if(bezt== nu->bezt) { /* first */
- bezt->f1= bezt->f2= bezt->f3= 0;
- newbezt =
- (BezTriple*)MEM_callocN((nu->pntsu+1) * sizeof(BezTriple), "addvert_Nurb");
- memcpy(newbezt+1, bezt, nu->pntsu*sizeof(BezTriple));
- *newbezt= *bezt;
- newbezt->f1= newbezt->f2= newbezt->f3= SELECT;
- if(newbezt->h1 >= 0) newbezt->h2= newbezt->h1;
- else newbezt->h2= newbezt->h1= HD_ALIGN; /* does this ever happen? */
- VECCOPY(temp, bezt->vec[1]);
- MEM_freeN(nu->bezt);
- nu->bezt= newbezt;
- bezt= newbezt+1;
- }
- else if(bezt== (nu->bezt+nu->pntsu-1)) { /* last */
- bezt->f1= bezt->f2= bezt->f3= 0;
- newbezt =
- (BezTriple*)MEM_callocN((nu->pntsu+1) * sizeof(BezTriple), "addvert_Nurb");
- memcpy(newbezt, nu->bezt, nu->pntsu*sizeof(BezTriple));
- *(newbezt+nu->pntsu)= *bezt;
- VECCOPY(temp, bezt->vec[1]);
- MEM_freeN(nu->bezt);
- nu->bezt= newbezt;
- newbezt+= nu->pntsu;
- newbezt->f1= newbezt->f2= newbezt->f3= SELECT;
- if(newbezt->h1 >= 0) newbezt->h2= newbezt->h1;
- else newbezt->h2= newbezt->h1= HD_ALIGN; /* does this ever happen? */
- bezt= nu->bezt+nu->pntsu-1;
- }
- else bezt= 0;
-
- if(bezt) {
- nu->pntsu++;
-
- if(mode=='e') {
- VECCOPY(newbezt->vec[0], bezt->vec[0]);
- VECCOPY(newbezt->vec[1], bezt->vec[1]);
- VECCOPY(newbezt->vec[2], bezt->vec[2]);
- }
- else {
- curs= give_cursor();
-
- VECCOPY(newbezt->vec[1], curs);
- VecSubf(newbezt->vec[1],newbezt->vec[1],G.obedit->obmat[3]);
- Mat3MulVecfl(imat,newbezt->vec[1]);
- VecSubf(temp, newbezt->vec[1],temp);
- VecAddf(newbezt->vec[0], bezt->vec[0],temp);
- VecAddf(newbezt->vec[2], bezt->vec[2],temp);
- calchandlesNurb(nu);
- }
- }
- }
- else if(nu->pntsv==1) {
- /* which b-point? */
- if(bp== nu->bp) { /* first */
- bp->f1= 0;
- newbp =
- (BPoint*)MEM_callocN((nu->pntsu+1) * sizeof(BPoint), "addvert_Nurb3");
- memcpy(newbp+1, bp, nu->pntsu*sizeof(BPoint));
- *newbp= *bp;
- newbp->f1= 1;
- MEM_freeN(nu->bp);
- nu->bp= newbp;
- bp= newbp + 1;
- }
- else if(bp== (nu->bp+nu->pntsu-1)) { /* last */
- bp->f1= 0;
- newbp =
- (BPoint*)MEM_callocN((nu->pntsu+1) * sizeof(BPoint), "addvert_Nurb4");
- memcpy(newbp, nu->bp, nu->pntsu*sizeof(BPoint));
- *(newbp+nu->pntsu)= *bp;
- MEM_freeN(nu->bp);
- nu->bp= newbp;
- newbp+= nu->pntsu;
- newbp->f1= 1;
- bp= newbp - 1;
- }
- else bp= 0;
-
- if(bp) {
- nu->pntsu++;
-
- if(nu->resolu<3) nu->resolu++;
- makeknots(nu, 1, nu->flagu>>1);
-
- if(mode=='e') {
- VECCOPY(newbp->vec, bp->vec);
- }
- else {
- curs= give_cursor();
-
- VECCOPY(newbp->vec, curs);
- VecSubf(newbp->vec, newbp->vec, G.obedit->obmat[3]);
- Mat3MulVecfl(imat,newbp->vec);
- newbp->vec[3]= 1.0;
- }
- }
- }
-
- retopo_do_all();
-
- test2DNurb(nu);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- countall();
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
-
- if(mode=='e') {
- BIF_TransformSetUndo("Extrude");
- initTransform(TFM_TRANSLATION, CTX_NO_PET);
- Transform();
- }
- else while(get_mbut()&R_MOUSE) BIF_wait_for_statechange();
-
- if(mode!='e') {
- /* dependencies with other objects, should become event */
- BIF_undo_push("Add vertex");
-
- }
-}
-
-void extrude_nurb()
-{
- Nurb *nu;
- int ok= 0;
-
- if(G.obedit && G.obedit->type==OB_SURF) {
-
- /* first test: curve? */
- for(nu= editNurb.first; nu; nu= nu->next) {
- if(nu->pntsv==1 && isNurbsel_count(nu)==1 ) break;
- }
- if(nu) {
- addvert_Nurb('e');
- } else {
- ok= extrudeflagNurb(1); /* '1'= flag */
-
- if(ok) {
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- countall();
- BIF_TransformSetUndo("Extrude");
- initTransform(TFM_TRANSLATION, CTX_NO_PET);
- Transform();
- }
- }
- }
-}
-
-
-
-void makecyclicNurb()
-{
- Nurb *nu;
- BezTriple *bezt;
- BPoint *bp;
- float *fp;
- int a, b, cyclmode=0;
-
- for(nu= editNurb.first; nu; nu= nu->next) {
- if( nu->pntsu>1 || nu->pntsv>1) {
- if( (nu->type & 7)==0 ) {
- a= nu->pntsu;
- bp= nu->bp;
- while(a--) {
- if( bp->f1 & SELECT ) {
- if(nu->flagu & CU_CYCLIC) nu->flagu--;
- else nu->flagu++;
- break;
- }
- bp++;
- }
- }
- else if( (nu->type & 7)==CU_BEZIER ) {
- a= nu->pntsu;
- bezt= nu->bezt;
- while(a--) {
- if( BEZSELECTED_HIDDENHANDLES(bezt) ) {
- if(nu->flagu & CU_CYCLIC) nu->flagu--;
- else nu->flagu++;
- break;
- }
- bezt++;
- }
- calchandlesNurb(nu);
- }
- else if(nu->pntsv==1 && (nu->type & 7)==CU_NURBS) {
- a= nu->pntsu;
- bp= nu->bp;
- while(a--) {
- if( bp->f1 & SELECT ) {
- if(nu->flagu & CU_CYCLIC) nu->flagu--;
- else {
- nu->flagu++;
- nu->flagu &= ~2; /* endpoint flag, fixme */
- fp= MEM_mallocN(sizeof(float)*KNOTSU(nu), "makecyclicN");
- b= (nu->orderu+nu->pntsu);
- memcpy(fp, nu->knotsu, sizeof(float)*b);
- MEM_freeN(nu->knotsu);
- nu->knotsu= fp;
-
- makeknots(nu, 1, 0); /* 1==u 0==uniform */
-
- }
- break;
- }
- bp++;
- }
- }
- else if(nu->type==CU_NURBS) {
- if(cyclmode==0) {
- cyclmode= pupmenu("Toggle %t|cyclic U%x1|cyclic V%x2");
- if(cyclmode < 1) return;
- }
- a= nu->pntsu*nu->pntsv;
- bp= nu->bp;
- while(a--) {
-
- if( bp->f1 & SELECT) {
- if(cyclmode==1 && nu->pntsu>1) {
- if(nu->flagu & CU_CYCLIC) nu->flagu--;
- else {
- nu->flagu++;
- fp= MEM_mallocN(sizeof(float)*KNOTSU(nu), "makecyclicN");
- b= (nu->orderu+nu->pntsu);
- memcpy(fp, nu->knotsu, sizeof(float)*b);
- MEM_freeN(nu->knotsu);
- nu->knotsu= fp;
-
- makeknots(nu, 1, 0); /* 1==u 0==uniform */
- }
- }
- if(cyclmode==2 && nu->pntsv>1) {
- if(nu->flagv & 1) nu->flagv--;
- else {
- nu->flagv++;
- fp= MEM_mallocN(sizeof(float)*KNOTSV(nu), "makecyclicN");
- b= (nu->orderv+nu->pntsv);
- memcpy(fp, nu->knotsv, sizeof(float)*b);
- MEM_freeN(nu->knotsv);
- nu->knotsv= fp;
-
- makeknots(nu, 2, 0); /* 2==v 0==uniform */
- }
- }
- break;
- }
- bp++;
- }
-
- }
- }
- }
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- BIF_undo_push("Cyclic");
-}
-
-void selectconnected_nurb()
-{
- Nurb *nu;
- BezTriple *bezt;
- BPoint *bp;
- int a;
-
- findnearestNurbvert(1, &nu, &bezt, &bp);
- if(bezt) {
- a= nu->pntsu;
- bezt= nu->bezt;
- while(a--) {
- if(G.qual & LR_SHIFTKEY) select_beztriple(bezt, DESELECT, 1, VISIBLE);
- else select_beztriple(bezt, SELECT, 1, VISIBLE);
- bezt++;
- }
- }
- else if(bp) {
- a= nu->pntsu*nu->pntsv;
- bp= nu->bp;
- while(a--) {
- if(G.qual & LR_SHIFTKEY) select_bpoint(bp, DESELECT, 1, VISIBLE);
- else select_bpoint(bp, SELECT, 1, VISIBLE);
- bp++;
- }
- }
-
- countall();
- allqueue(REDRAWVIEW3D, 0);
- BIF_undo_push("Select connected");
-
-}
-
-void selectrow_nurb()
-{
- static BPoint *last=0;
- static int direction=0;
- Nurb *nu;
- BPoint *bp;
- int u = 0, v = 0, a, b, ok=0;
-
- if(editNurb.first==0) return;
- if(G.obedit==NULL || G.obedit->type!=OB_SURF) return;
- if(lastselbp==NULL) return;
-
- /* find the correct nurb and toggle with u of v */
- for(nu= editNurb.first; nu; nu= nu->next) {
- bp= nu->bp;
- for(v=0; v<nu->pntsv; v++) {
- for(u=0; u<nu->pntsu; u++, bp++) {
- if(bp==lastselbp) {
- if(bp->f1 & SELECT) {
- ok= 1;
- break;
- }
- }
- }
- if(ok) break;
- }
- if(ok) {
- if(last==lastselbp) {
- direction= 1-direction;
- setflagsNurb(0);
- }
- last= lastselbp;
-
- bp= nu->bp;
- for(a=0; a<nu->pntsv; a++) {
- for(b=0; b<nu->pntsu; b++, bp++) {
- if(direction) {
- if(a==v) select_bpoint(bp, SELECT, 1, VISIBLE);
- }
- else {
- if(b==u) select_bpoint(bp, SELECT, 1, VISIBLE);
- }
- }
- }
- countall();
- allqueue(REDRAWVIEW3D, 0);
- return;
- }
- }
- BIF_undo_push("Select Row");
-
-}
-
-/* (de)selects first or last of visible part of each Nurb depending on selFirst */
-/* selFirst: defines the end of which to select */
-/* doswap: defines if selection state of each first/last control point is swapped */
-/* selstatus: selection status in case doswap is false */
-void selectend_nurb(short selfirst, short doswap, short selstatus)
-{
- Nurb *nu;
- BPoint *bp;
- BezTriple *bezt;
- int a;
- short sel;
-
- if(G.obedit==0) return;
-
- for(nu= editNurb.first; nu; nu= nu->next) {
- sel= 0;
- if((nu->type & 7)==CU_BEZIER) {
- a= nu->pntsu;
-
- /* which point? */
- if(selfirst==0) { /* select last */
- bezt= (nu->bezt + (a-1));
- }
- else { /* select first */
- bezt= nu->bezt;
- }
-
- while(a--) {
- if(doswap) sel= swap_selection_beztriple(bezt);
- else sel= select_beztriple(bezt, selstatus, 1, VISIBLE);
-
- if(sel==1) break;
- }
- }
- else {
- a= nu->pntsu*nu->pntsv;
-
- /* which point? */
- if(selfirst==0) { /* select last */
- bp= (nu->bp + (a-1));
- }
- else{ /* select first */
- bp= nu->bp;
- }
-
- while(a--) {
- if (bp->hide == 0) {
- if(doswap) sel= swap_selection_bpoint(bp);
- else sel= select_bpoint(bp, selstatus, 1, VISIBLE);
-
- if(sel==1) break;
- }
- }
- }
- }
-
- countall();
- allqueue(REDRAWVIEW3D, 0);
- BIF_undo_push("Select/Deselect End");
-}
-
-void select_next_nurb()
-{
- if(G.obedit==0) return;
-
- select_adjacent_cp(1, 0, SELECT);
-
- countall();
- allqueue(REDRAWVIEW3D, 0);
- BIF_undo_push("Select Next");
-}
-
-void select_prev_nurb()
-{
- if(G.obedit==0) return;
-
- select_adjacent_cp(-1, 0, SELECT);
-
- countall();
- allqueue(REDRAWVIEW3D, 0);
- BIF_undo_push("Select Previous");
-}
-
-void select_more_nurb()
-{
- Nurb *nu;
- BPoint *bp, *tempbp;
- int a;
- short sel= 0;
- short *selbpoints;
-
- if(G.obedit==0) return;
-
- /* note that NURBS surface is a special case because we mimic */
- /* the behaviour of "select more" of mesh tools. */
- /* The algorithm is designed to work in planar cases so it */
- /* may not be optimal always (example: end of NURBS sphere) */
- if(G.obedit->type==OB_SURF) {
- for(nu= editNurb.first; nu; nu= nu->next) {
- a= nu->pntsu*nu->pntsv;
- bp= nu->bp;
- selbpoints= MEM_callocN(sizeof(short)*a-nu->pntsu, "selectlist");
- while(a > 0) {
- if((selbpoints[a]!=1) && (bp->hide==0) && (bp->f1 & SELECT)) {
- /* upper control point */
- if(a%nu->pntsu != 0) {
- tempbp= bp-1;
- if(!(tempbp->f1 & SELECT)) select_bpoint(tempbp, SELECT, 1, VISIBLE);
- }
-
- /* left control point. select only if it is not selected already */
- if(a-nu->pntsu > 0) {
- sel= 0;
- tempbp= bp+nu->pntsu;
- if(!(tempbp->f1 & SELECT)) sel= select_bpoint(tempbp, SELECT, 1, VISIBLE);
- /* make sure selected bpoint is discarded */
- if(sel == 1) selbpoints[a-nu->pntsu]= 1;
- }
-
- /* right control point */
- if(a+nu->pntsu < nu->pntsu*nu->pntsv) {
- tempbp= bp-nu->pntsu;
- if(!(tempbp->f1 & SELECT)) select_bpoint(tempbp, SELECT, 1, VISIBLE);
- }
-
- /* lower control point. skip next bp in case selection was made */
- if(a%nu->pntsu != 1) {
- sel= 0;
- tempbp= bp+1;
- if(!(tempbp->f1 & 1)) sel= select_bpoint(tempbp, SELECT, 1, VISIBLE);
- if(sel) {
- bp++;
- a--;
- }
- }
- }
-
- bp++;
- a--;
- }
-
- MEM_freeN(selbpoints);
- }
- }
- else {
- select_adjacent_cp(1, 0, SELECT);
- select_adjacent_cp(-1, 0, SELECT);
- }
-
- countall();
- allqueue(REDRAWVIEW3D, 0);
- BIF_undo_push("Select More");
-}
-
-/* basic method: deselect if control point doesn't have all neighbours selected */
-void select_less_nurb()
-{
- Nurb *nu;
- BPoint *bp;
- BezTriple *bezt;
- int a;
- short sel= 0, lastsel= 0;
- short *selbpoints;
-
- if(G.obedit==0) return;
-
- if(G.obedit->type==OB_SURF) {
- for(nu= editNurb.first; nu; nu= nu->next) {
- a= nu->pntsu*nu->pntsv;
- bp= nu->bp;
- selbpoints= MEM_callocN(sizeof(short)*a, "selectlist");
- while(a--) {
- if((bp->hide==0) && (bp->f1 & SELECT)) {
- sel= 0;
-
- /* check if neighbours have been selected */
- /* edges of surface are an exception */
- if((a+1)%nu->pntsu==0) sel++;
- else {
- bp--;
- if((selbpoints[a+1]==1) || ((bp->hide==0) && (bp->f1 & SELECT))) sel++;
- bp++;
- }
-
- if((a+1)%nu->pntsu==1) sel++;
- else {
- bp++;
- if((bp->hide==0) && (bp->f1 & SELECT)) sel++;
- bp--;
- }
-
- if(a+1 > nu->pntsu*nu->pntsv-nu->pntsu) sel++;
- else {
- bp-=nu->pntsu;
- if((selbpoints[a+nu->pntsu]==1) || ((bp->hide==0) && (bp->f1 & SELECT))) sel++;
- bp+=nu->pntsu;
- }
-
- if(a < nu->pntsu) sel++;
- else {
- bp+=nu->pntsu;
- if((bp->hide==0) && (bp->f1 & SELECT)) sel++;
- bp-=nu->pntsu;
- }
-
- if(sel!=4) {
- select_bpoint(bp, DESELECT, 1, VISIBLE);
- selbpoints[a]= 1;
- }
- }
- else lastsel= 0;
-
- bp++;
- }
-
- MEM_freeN(selbpoints);
- }
- }
- else {
- for(nu= editNurb.first; nu; nu= nu->next) {
- lastsel=0;
- /* check what type of curve/nurb it is */
- if((nu->type & 7)==CU_BEZIER) {
- a= nu->pntsu;
- bezt= nu->bezt;
- while(a--) {
- if((bezt->hide==0) && (bezt->f2 & SELECT)) {
- if(lastsel==1) sel= 1;
- else sel= 0;
-
- /* check if neighbours have been selected */
- /* first and last are exceptions */
- if(a==nu->pntsu-1) sel++;
- else {
- bezt--;
- if((bezt->hide==0) && (bezt->f2 & SELECT)) sel++;
- bezt++;
- }
-
- if(a==0) sel++;
- else {
- bezt++;
- if((bezt->hide==0) && (bezt->f2 & SELECT)) sel++;
- bezt--;
- }
-
- if(sel!=2) {
- select_beztriple(bezt, DESELECT, 1, VISIBLE);
- lastsel= 1;
- }
- else lastsel= 0;
- }
- else lastsel= 0;
-
- bezt++;
- }
- }
- else {
- a= nu->pntsu*nu->pntsv;
- bp= nu->bp;
- while(a--) {
- if((lastsel==0) && (bp->hide==0) && (bp->f1 & SELECT)) {
- if(lastsel!=0) sel= 1;
- else sel= 0;
-
- /* first and last are exceptions */
- if(a==nu->pntsu*nu->pntsv-1) sel++;
- else {
- bp--;
- if((bp->hide==0) && (bp->f1 & SELECT)) sel++;
- bp++;
- }
-
- if(a==0) sel++;
- else {
- bp++;
- if((bp->hide==0) && (bp->f1 & SELECT)) sel++;
- bp--;
- }
-
- if(sel!=2) {
- select_bpoint(bp, DESELECT, 1, VISIBLE);
- lastsel= 1;
- }
- else lastsel= 0;
- }
- else lastsel= 0;
-
- bp++;
- }
- }
- }
- }
-
- countall();
- allqueue(REDRAWVIEW3D, 0);
- BIF_undo_push("Select Less");
-}
-
-/* this function could be moved elsewhere as it can be reused in other parts of the source needing randomized list */
-/* returns list containing -1 in indices that have been left out of the list. otherwise index contains reference */
-/* to next index. basically *list contains a linked list */
-static void generate_pickable_list(int *list, int size, int pickamount)
-{
- int i, j, removable;
-
- BLI_srand( BLI_rand() ); /* random seed */
-
- /* generate list in form 0->1, 1->2, 2->3, ... i-2->i-1, i->0 */
- for(i=0; i<size; i++) {
- if(i == size-1) list[i]= 0;
- else list[i]= i+1;
- }
-
- for(i=0; i<size-pickamount; i++) {
- removable= floor(BLI_frand()*(size-1)+0.5); /* with rounding. frand returns [0,1] */
-
- /* seek proper item as the one randomly selected might not be appropriate */
- for(j=0; j<size; j++, removable++) {
- if(list[removable] != -1) break;
- if(removable == size-1) removable= -1;
- }
-
- /* pick unwanted item out of the list */
- list[list[removable]]= -1; /* mark former last as invalid */
-
- if(list[removable] == size-1) list[removable]= 0;
- else list[removable]= list[removable]+1;
- }
-}
-
-void select_random_nurb()
-{
- Nurb *nu;
- BezTriple *bezt;
- BPoint *bp;
- static short randfac= 50;
- int amounttoselect, amountofcps, a, i, k= 0;
- int *itemstobeselected;
-
- if(!G.obedit) return;
-
- if(!button(&randfac,0, 100,"Percentage:")) return;
-
- if(randfac == 0) return;
-
- amountofcps= count_curveverts_without_handles(&editNurb);
- itemstobeselected= MEM_callocN(sizeof(int) * amountofcps, "selectitems");
- amounttoselect= floor(randfac * amountofcps / 100 + 0.5);
- generate_pickable_list(itemstobeselected, amountofcps, amounttoselect);
-
- /* select elements */
- for(i=1, nu= editNurb.first; nu; nu= nu->next) {
- if((nu->type & 7)==CU_BEZIER) {
- bezt= nu->bezt;
- a= nu->pntsu;
- while(a--) {
- if(itemstobeselected[k] != -1) select_beztriple(bezt, SELECT, 1, VISIBLE);
- k++;
- bezt++;
- }
- }
- else {
- bp= nu->bp;
- a= nu->pntsu*nu->pntsv;
- while(a--) {
- if(itemstobeselected[k] != -1) select_bpoint(bp, SELECT, 1, VISIBLE);
- k++;
- bp++;
- }
- }
- }
-
- MEM_freeN(itemstobeselected);
-
- countall();
- allqueue(REDRAWVIEW3D, 0);
- BIF_undo_push("Select Random");
-}
-
-void select_every_nth_nurb()
-{
- static short nfac= 2;
-
- if(!G.obedit) return;
-
- if(!button(&nfac, 2, 25,"N:")) return;
-
- select_adjacent_cp(nfac, 1, SELECT);
- select_adjacent_cp(-nfac, 1, SELECT);
-
- countall();
- allqueue(REDRAWVIEW3D, 0);
- BIF_undo_push("Select Every Nth");
-}
-
-void adduplicate_nurb()
-{
-
- if(G.vd==0 || (G.vd->lay & G.obedit->lay)==0 ) return;
-
- adduplicateflagNurb(1);
-
- countall();
- BIF_TransformSetUndo("Add Duplicate");
- initTransform(TFM_TRANSLATION, CTX_NO_PET);
- Transform();
-}
-
-void delNurb()
-{
- Nurb *nu, *next, *nu1;
- BezTriple *bezt, *bezt1, *bezt2;
- BPoint *bp, *bp1, *bp2;
- int a;
- short event, cut = 0;
-
- if(G.obedit==0 ) return;
- if(G.vd==0 || (G.vd->lay & G.obedit->lay)==0 ) return;
-
- if(G.obedit->type==OB_SURF) event= pupmenu("Erase %t|Selected%x0|All%x2");
- else event= pupmenu("Erase %t|Selected%x0|Segment%x1|All%x2");
-
- if(event== -1) return;
-
- if(G.obedit->type==OB_SURF) {
- if(event==0) deleteflagNurb(1);
- else freeNurblist(&editNurb);
-
- countall();
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- BIF_undo_push("Delete");
-
- return;
- }
-
- if(event==0) {
- /* first loop, can we remove entire pieces? */
- nu= editNurb.first;
- while(nu) {
- next= nu->next;
- if( (nu->type & 7)==CU_BEZIER ) {
- bezt= nu->bezt;
- a= nu->pntsu;
- if(a) {
- while(a) {
- if( BEZSELECTED_HIDDENHANDLES(bezt) );
- else break;
- a--;
- bezt++;
- }
- if(a==0) {
- BLI_remlink(&editNurb, nu);
- freeNurb(nu);
- }
- }
- }
- else {
- bp= nu->bp;
- a= nu->pntsu*nu->pntsv;
- if(a) {
- while(a) {
- if(bp->f1 & SELECT);
- else break;
- a--;
- bp++;
- }
- if(a==0) {
- BLI_remlink(&editNurb, nu);
- freeNurb(nu);
- }
- }
- }
- nu= next;
- }
- /* 2nd loop, delete small pieces: just for curves */
- nu= editNurb.first;
- while(nu) {
- next= nu->next;
- event= 0;
- if( (nu->type & 7)==CU_BEZIER ) {
- bezt= nu->bezt;
- for(a=0;a<nu->pntsu;a++) {
- if( BEZSELECTED_HIDDENHANDLES(bezt) ) {
- memcpy(bezt, bezt+1, (nu->pntsu-a-1)*sizeof(BezTriple));
- nu->pntsu--;
- a--;
- event= 1;
- }
- else bezt++;
- }
- if(event) {
- bezt1 =
- (BezTriple*)MEM_mallocN((nu->pntsu) * sizeof(BezTriple), "delNurb");
- memcpy(bezt1, nu->bezt, (nu->pntsu)*sizeof(BezTriple) );
- MEM_freeN(nu->bezt);
- nu->bezt= bezt1;
- calchandlesNurb(nu);
- }
- }
- else if(nu->pntsv==1) {
- bp= nu->bp;
-
- for(a=0;a<nu->pntsu;a++) {
- if( bp->f1 & SELECT ) {
- memcpy(bp, bp+1, (nu->pntsu-a-1)*sizeof(BPoint));
- nu->pntsu--;
- a--;
- event= 1;
- }
- else {
- bp++;
- }
- }
- if(event) {
- bp1 = (BPoint*)MEM_mallocN(nu->pntsu * sizeof(BPoint), "delNurb2");
- memcpy(bp1, nu->bp, (nu->pntsu)*sizeof(BPoint) );
- MEM_freeN(nu->bp);
- nu->bp= bp1;
- }
- makeknots(nu, 1, nu->flagu>>1);
- }
- nu= next;
- }
- }
- else if(event==1) { /* erase segment */
- /* find the 2 selected points */
- bezt1= bezt2= 0;
- bp1= bp2= 0;
- nu= editNurb.first;
- nu1= 0;
- while(nu) {
- next= nu->next;
- if( (nu->type & 7)==CU_BEZIER ) {
- bezt= nu->bezt;
- for(a=0; a<nu->pntsu-1; a++) {
- if( BEZSELECTED_HIDDENHANDLES(bezt) ) {
- bezt1= bezt;
- bezt2= bezt+1;
- if( (bezt2->f1 & SELECT) || (bezt2->f2 & SELECT) || (bezt2->f3 & SELECT) ) ;
- else { /* maybe do not make cyclic */
- if(a==0 && (nu->flagu & 1) ) {
- bezt2= bezt+(nu->pntsu-1);
- if( (bezt2->f1 & SELECT) || (bezt2->f2 & SELECT) || (bezt2->f3 & SELECT) ) {
- nu->flagu--;
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- BIF_undo_push("Delete");
- }
- }
- return;
- }
- cut= a;
- nu1= nu;
- break;
- }
- bezt++;
- }
- }
- else if(nu->pntsv==1) {
- bp= nu->bp;
- for(a=0; a<nu->pntsu-1; a++) {
- if( bp->f1 & SELECT ) {
- bp1= bp;
- bp2= bp+1;
- if( bp2->f1 & 1 ) ;
- else { /* maybe do not make cyclic */
- if(a==0 && (nu->flagu & 1) ) {
- bp2= bp+(nu->pntsu-1);
- if( bp2->f1 & 1 ) {
- nu->flagu--;
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- BIF_undo_push("Delete");
- }
- }
- return;
- }
- cut= a;
- nu1= nu;
- break;
- }
- bp++;
- }
- }
- if(nu1) break;
-
- nu= nu->next;
- }
- if(nu1) {
- if(bezt1) {
- if(nu1->pntsu==2) { /* remove completely */
- BLI_remlink(&editNurb, nu);
- freeNurb(nu);
- }
- else if(nu1->flagu & 1) { /* cyclic */
- bezt =
- (BezTriple*)MEM_mallocN((cut+1) * sizeof(BezTriple), "delNurb1");
- memcpy(bezt, nu1->bezt,(cut+1)*sizeof(BezTriple));
- a= nu1->pntsu-cut-1;
- memcpy(nu1->bezt, bezt2, a*sizeof(BezTriple));
- memcpy(nu1->bezt+a, bezt, (cut+1)*sizeof(BezTriple));
- nu1->flagu--;
- MEM_freeN(bezt);
- calchandlesNurb(nu);
- }
- else { /* add new curve */
-
-/* seems to be an error here... but where? (a can become zero) */
-
- nu =
- (Nurb*)MEM_mallocN(sizeof(Nurb), "delNurb2");
- memcpy(nu, nu1, sizeof(Nurb));
- BLI_addtail(&editNurb, nu);
- nu->bezt =
- (BezTriple*)MEM_mallocN((cut+1) * sizeof(BezTriple), "delNurb3");
- memcpy(nu->bezt, nu1->bezt,(cut+1)*sizeof(BezTriple));
- a= nu1->pntsu-cut-1;
-
- bezt =
- (BezTriple*)MEM_mallocN(a * sizeof(BezTriple), "delNurb4");
- memcpy(bezt, nu1->bezt+cut+1,a*sizeof(BezTriple));
- MEM_freeN(nu1->bezt);
- nu1->bezt= bezt;
- nu1->pntsu= a;
- nu->pntsu= cut+1;
-
-
- calchandlesNurb(nu);
- calchandlesNurb(nu1);
- }
- }
- else if(bp1) {
- if(nu1->pntsu==2) { /* remove completely */
- BLI_remlink(&editNurb, nu);
- freeNurb(nu);
- }
- else if(nu1->flagu & 1) { /* cyclic */
- bp =
- (BPoint*)MEM_mallocN((cut+1) * sizeof(BPoint), "delNurb5");
- memcpy(bp, nu1->bp,(cut+1)*sizeof(BPoint));
- a= nu1->pntsu-cut-1;
- memcpy(nu1->bp, bp2, a*sizeof(BPoint));
- memcpy(nu1->bp+a, bp, (cut+1)*sizeof(BPoint));
- nu1->flagu--;
- MEM_freeN(bp);
- }
- else { /* add new curve */
- nu = (Nurb*)MEM_mallocN(sizeof(Nurb), "delNurb6");
- memcpy(nu, nu1, sizeof(Nurb));
- BLI_addtail(&editNurb, nu);
- nu->bp =
- (BPoint*)MEM_mallocN((cut+1) * sizeof(BPoint), "delNurb7");
- memcpy(nu->bp, nu1->bp,(cut+1)*sizeof(BPoint));
- a= nu1->pntsu-cut-1;
- bp =
- (BPoint*)MEM_mallocN(a * sizeof(BPoint), "delNurb8");
- memcpy(bp, nu1->bp+cut+1,a*sizeof(BPoint));
- MEM_freeN(nu1->bp);
- nu1->bp= bp;
- nu1->pntsu= a;
- nu->pntsu= cut+1;
- }
- }
- }
- }
- else if(event==2) {
- freeNurblist(&editNurb);
- }
-
- countall();
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- BIF_undo_push("Delete");
-
-}
-
-void nurb_set_smooth(short event)
-{
- Nurb *nu;
-
- if(G.obedit==0) return;
-
- if(G.obedit->type != OB_CURVE) return;
-
- for(nu= editNurb.first; nu; nu= nu->next) {
- if(isNurbsel(nu)) {
- if(event==1) nu->flag |= CU_SMOOTH;
- else if(event==0) nu->flag &= ~CU_SMOOTH;
- }
- }
-
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
-
- if(event==1) BIF_undo_push("Set Smooth");
- else if(event==0) BIF_undo_push("Set Solid");
-}
-
-int join_curve(int type)
-{
- Base *base, *nextb;
- Object *ob;
- Curve *cu;
- Nurb *nu, *newnu;
- BezTriple *bezt;
- BPoint *bp;
- ListBase tempbase;
- float imat[4][4], cmat[4][4];
- int a;
-
- ob= OBACT;
- if (object_data_is_libdata(ob)) {
- error_libdata();
- return 0;
- }
-
- if(!G.vd || ob->type!=type) return 0;
- if(ob->lay & G.vd->lay); else return 0;
- tempbase.first= tempbase.last= 0;
-
- /* trasnform all selected curves inverse in obact */
- Mat4Invert(imat, ob->obmat);
-
- base= FIRSTBASE;
- while(base) {
- nextb= base->next;
- if TESTBASE(base) {
- if(base->object->type==type) {
- if(base->object != ob) {
-
- cu= base->object->data;
-
- if(cu->nurb.first) {
- /* watch it: switch order here really goes wrong */
- Mat4MulMat4(cmat, base->object->obmat, imat);
-
- nu= cu->nurb.first;
- while(nu) {
- newnu= duplicateNurb(nu);
- BLI_addtail(&tempbase, newnu);
-
- if( (bezt= newnu->bezt) ) {
- a= newnu->pntsu;
- while(a--) {
- Mat4MulVecfl(cmat, bezt->vec[0]);
- Mat4MulVecfl(cmat, bezt->vec[1]);
- Mat4MulVecfl(cmat, bezt->vec[2]);
- bezt++;
- }
- }
- if( (bp= newnu->bp) ) {
- a= newnu->pntsu*nu->pntsv;
- while(a--) {
- Mat4MulVecfl(cmat, bp->vec);
- bp++;
- }
- }
- nu= nu->next;
- }
- }
-
- free_and_unlink_base(base);
- }
- }
- }
- base= nextb;
- }
-
- cu= ob->data;
- addlisttolist(&cu->nurb, &tempbase);
-
- DAG_scene_sort(G.scene); // because we removed object(s), call before editmode!
-
- enter_editmode(EM_WAITCURSOR);
- exit_editmode(EM_FREEDATA|EM_WAITCURSOR);
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- BIF_undo_push("Join");
- return 1;
-}
-
-
-
-Nurb *addNurbprim(int type, int stype, int newname)
-/* type: &8= 2D; 0=poly,1 bez, 4 nurb
- * stype: 0: 2/4 points curve
- * 1: 8 points circle
- * 2: 4x4 patch Nurb
- * 3: tube 4:sphere 5:donut
- * 6: 5 points, 5th order straight line (for anim path)
- */
-{
- static int xzproj= 0;
- Nurb *nu = NULL;
- BezTriple *bezt;
- BPoint *bp;
- float *curs, cent[3],vec[3],imat[3][3],mat[3][3];
- float fac,cmat[3][3], grid;
- int a, b;
-
- if (G.vd) grid = G.vd->grid;
- else grid = 1.0;
-
- /* imat and center and size */
- if(G.obedit) {
-
- Mat3CpyMat4(mat, G.obedit->obmat);
- curs= give_cursor();
- VECCOPY(cent, curs);
- cent[0]-= G.obedit->obmat[3][0];
- cent[1]-= G.obedit->obmat[3][1];
- cent[2]-= G.obedit->obmat[3][2];
-
- if (G.vd) {
- if ( !(newname) || U.flag & USER_ADD_VIEWALIGNED) Mat3CpyMat4(imat, G.vd->viewmat);
- else Mat3One(imat);
- Mat3MulVecfl(imat, cent);
- Mat3MulMat3(cmat, imat, mat);
- Mat3Inv(imat, cmat);
- }
- setflagsNurb(0);
- }
- else {
- Mat3One(imat);
- cent[0]= cent[1]= cent[2]= 0.0;
- }
-
- if ELEM5(stype, 0, 1, 2, 4, 6) {
- nu = (Nurb*)MEM_callocN(sizeof(Nurb), "addNurbprim");
- nu->type= type;
- nu->resolu= 12;
- nu->resolv= 12;
- }
-
- switch(stype) {
- case 0: /* curve */
- if(newname) {
- rename_id((ID *)G.obedit, "Curve");
- rename_id((ID *)G.obedit->data, "Curve");
- }
- if((type & 7)==CU_BEZIER) {
- nu->pntsu= 2;
- nu->bezt =
- (BezTriple*)MEM_callocN(2 * sizeof(BezTriple), "addNurbprim1");
- bezt= nu->bezt;
- bezt->h1= bezt->h2= HD_ALIGN;
- bezt->f1= bezt->f2= bezt->f3= SELECT;
- bezt->radius = 1.0;
-
- for(a=0;a<3;a++) {
- VECCOPY(bezt->vec[a], cent);
- }
- bezt->vec[1][0]+= -grid;
- bezt->vec[0][0]+= -1.5*grid;
- bezt->vec[0][1]+= -0.5*grid;
- bezt->vec[2][0]+= -0.5*grid;
- bezt->vec[2][1]+= 0.5*grid;
- for(a=0;a<3;a++) Mat3MulVecfl(imat, bezt->vec[a]);
-
- bezt++;
- bezt->h1= bezt->h2= HD_ALIGN;
- bezt->f1= bezt->f2= bezt->f3= SELECT;
- bezt->radius = bezt->weight = 1.0;
-
- for(a=0;a<3;a++) {
- VECCOPY(bezt->vec[a], cent);
- }
- bezt->vec[1][0]+= grid;
- for(a=0;a<3;a++) Mat3MulVecfl(imat, bezt->vec[a]);
-
- calchandlesNurb(nu);
- }
- else {
-
- nu->pntsu= 4;
- nu->pntsv= 1;
- nu->orderu= 4;
- nu->bp= callocstructN(BPoint, 4, "addNurbprim3");
-
- bp= nu->bp;
- for(a=0;a<4;a++, bp++) {
- VECCOPY(bp->vec, cent);
- bp->vec[3]= 1.0;
- bp->f1= SELECT;
- bp->radius = bp->weight = 1.0;
- }
-
- bp= nu->bp;
- bp->vec[0]+= -1.5*grid;
- bp++;
- bp->vec[0]+= -grid;
- bp->vec[1]+= grid;
- bp++;
- bp->vec[0]+= grid;
- bp->vec[1]+= grid;
- bp++;
- bp->vec[0]+= 1.5*grid;
-
- bp= nu->bp;
- for(a=0;a<4;a++, bp++) Mat3MulVecfl(imat,bp->vec);
-
- if((type & 7)==4) {
- nu->knotsu= 0; /* makeknots allocates */
- makeknots(nu, 1, nu->flagu>>1);
- }
-
- }
- break;
- case 6: /* 5 point path */
- nu->pntsu= 5;
- nu->pntsv= 1;
- nu->orderu= 5;
- nu->flagu= 2; /* endpoint */
- nu->resolu= 32;
- nu->bp= callocstructN(BPoint, 5, "addNurbprim3");
-
- bp= nu->bp;
- for(a=0;a<5;a++, bp++) {
- VECCOPY(bp->vec, cent);
- bp->vec[3]= 1.0;
- bp->f1= SELECT;
- bp->radius = bp->weight = 1.0;
- }
-
- bp= nu->bp;
- bp->vec[0]+= -2.0*grid;
- bp++;
- bp->vec[0]+= -grid;
- bp++; bp++;
- bp->vec[0]+= grid;
- bp++;
- bp->vec[0]+= 2.0*grid;
-
- bp= nu->bp;
- for(a=0;a<5;a++, bp++) Mat3MulVecfl(imat,bp->vec);
-
- if((type & 7)==4) {
- nu->knotsu= 0; /* makeknots allocates */
- makeknots(nu, 1, nu->flagu>>1);
- }
-
- break;
- case 1: /* circle */
- if(newname) {
- rename_id((ID *)G.obedit, "CurveCircle");
- rename_id((ID *)G.obedit->data, "CurveCircle");
- }
- if((type & 7)==CU_BEZIER) {
- nu->pntsu= 4;
- nu->bezt= callocstructN(BezTriple, 4, "addNurbprim1");
- nu->flagu= 1;
- bezt= nu->bezt;
-
- for(a=0;a<3;a++) {
- VECCOPY(bezt->vec[a], cent);
- }
- bezt->h1= bezt->h2= HD_AUTO;
- bezt->f1= bezt->f2= bezt->f3= SELECT;
- bezt->vec[1][0]+= -grid;
- for(a=0;a<3;a++) Mat3MulVecfl(imat,bezt->vec[a]);
- bezt->radius = bezt->weight = 1.0;
-
- bezt++;
- for(a=0;a<3;a++) {
- VECCOPY(bezt->vec[a], cent);
- }
- bezt->h1= bezt->h2= HD_AUTO;
- bezt->f1= bezt->f2= bezt->f3= SELECT;
- bezt->vec[1][1]+= grid;
- for(a=0;a<3;a++) Mat3MulVecfl(imat,bezt->vec[a]);
- bezt->radius = bezt->weight = 1.0;
-
- bezt++;
- for(a=0;a<3;a++) {
- VECCOPY(bezt->vec[a], cent);
- }
- bezt->h1= bezt->h2= HD_AUTO;
- bezt->f1= bezt->f2= bezt->f3= SELECT;
- bezt->vec[1][0]+= grid;
- for(a=0;a<3;a++) Mat3MulVecfl(imat,bezt->vec[a]);
- bezt->radius = bezt->weight = 1.0;
-
- bezt++;
- for(a=0;a<3;a++) {
- VECCOPY(bezt->vec[a], cent);
- }
- bezt->h1= bezt->h2= HD_AUTO;
- bezt->f1= bezt->f2= bezt->f3= SELECT;
- bezt->vec[1][1]+= -grid;
- for(a=0;a<3;a++) Mat3MulVecfl(imat,bezt->vec[a]);
- bezt->radius = bezt->weight = 1.0;
-
- calchandlesNurb(nu);
- }
- else if( (type & 7)==CU_NURBS ) { /* nurb */
- nu->pntsu= 8;
- nu->pntsv= 1;
- nu->orderu= 4;
- nu->bp= callocstructN(BPoint, 8, "addNurbprim6");
- nu->flagu= 1;
- bp= nu->bp;
-
- for(a=0; a<8; a++) {
- bp->f1= SELECT;
- VECCOPY(bp->vec, cent);
-
- if(xzproj==0) {
- bp->vec[0]+= nurbcircle[a][0]*grid;
- bp->vec[1]+= nurbcircle[a][1]*grid;
- }
- else {
- bp->vec[0]+= 0.25*nurbcircle[a][0]*grid-.75*grid;
- bp->vec[2]+= 0.25*nurbcircle[a][1]*grid;
- }
- if(a & 1) bp->vec[3]= 0.25*sqrt(2.0);
- else bp->vec[3]= 1.0;
- Mat3MulVecfl(imat,bp->vec);
- bp->radius = bp->weight = 1.0;
-
- bp++;
- }
-
- makeknots(nu, 1, nu->flagu>>1);
- }
- break;
- case 2: /* 4x4 patch */
- if( (type & 7)==CU_NURBS ) { /* nurb */
- if(newname) {
- rename_id((ID *)G.obedit, "Surf");
- rename_id((ID *)G.obedit->data, "Surf");
- }
-
- nu->pntsu= 4;
- nu->pntsv= 4;
- nu->orderu= 4;
- nu->orderv= 4;
- nu->flag= CU_SMOOTH;
- nu->bp= callocstructN(BPoint, 4*4, "addNurbprim6");
- nu->flagu= 0;
- nu->flagv= 0;
- bp= nu->bp;
-
- for(a=0; a<4; a++) {
- for(b=0; b<4; b++) {
- VECCOPY(bp->vec, cent);
- bp->f1= SELECT;
- fac= (float)a -1.5;
- bp->vec[0]+= fac*grid;
- fac= (float)b -1.5;
- bp->vec[1]+= fac*grid;
- if(a==1 || a==2) if(b==1 || b==2) {
- bp->vec[2]+= grid;
- }
- Mat3MulVecfl(imat,bp->vec);
- bp->vec[3]= 1.0;
- bp++;
- }
- }
-
- makeknots(nu, 1, nu->flagu>>1);
- makeknots(nu, 2, nu->flagv>>1);
- }
- break;
- case 3: /* tube */
- if( (type & 7)==CU_NURBS ) {
- if(newname) {
- rename_id((ID *)G.obedit, "SurfTube");
- rename_id((ID *)G.obedit->data, "SurfTube");
- }
-
- nu= addNurbprim(4, 1, newname); /* circle */
- nu->resolu= 32;
- nu->flag= CU_SMOOTH;
- BLI_addtail(&editNurb, nu); /* temporal for extrude and translate */
- vec[0]=vec[1]= 0.0;
- vec[2]= -grid;
- Mat3MulVecfl(imat, vec);
- translateflagNurb(1, vec);
- extrudeflagNurb(1);
- vec[0]= -2*vec[0];
- vec[1]= -2*vec[1];
- vec[2]= -2*vec[2];
- translateflagNurb(1, vec);
-
- BLI_remlink(&editNurb, nu);
-
- a= nu->pntsu*nu->pntsv;
- bp= nu->bp;
- while(a-- >0) {
- bp->f1 |= SELECT;
- bp++;
- }
- }
- break;
- case 4: /* sphere */
- if( (type & 7)==CU_NURBS ) {
- if(newname) {
- rename_id((ID *)G.obedit, "SurfSphere");
- rename_id((ID *)G.obedit->data, "SurfSphere");
- }
-
- nu->pntsu= 5;
- nu->pntsv= 1;
- nu->orderu= 3;
- nu->resolu= 24;
- nu->resolv= 32;
- nu->flag= CU_SMOOTH;
- nu->bp= callocstructN(BPoint, 5, "addNurbprim6");
- nu->flagu= 0;
- bp= nu->bp;
-
- for(a=0; a<5; a++) {
- bp->f1= SELECT;
- VECCOPY(bp->vec, cent);
- bp->vec[0]+= nurbcircle[a][0]*grid;
- bp->vec[2]+= nurbcircle[a][1]*grid;
- if(a & 1) bp->vec[3]= 0.5*sqrt(2.0);
- else bp->vec[3]= 1.0;
- Mat3MulVecfl(imat,bp->vec);
- bp++;
- }
- nu->flagu= 4;
- makeknots(nu, 1, nu->flagu>>1);
-
- BLI_addtail(&editNurb, nu); /* temporal for spin */
- if(newname) spin_nurb(0, 2);
- else spin_nurb(0, 0);
-
- makeknots(nu, 2, nu->flagv>>1);
-
- a= nu->pntsu*nu->pntsv;
- bp= nu->bp;
- while(a-- >0) {
- bp->f1 |= SELECT;
- bp++;
- }
- BLI_remlink(&editNurb, nu);
- }
- break;
- case 5: /* donut */
- if( (type & 7)==CU_NURBS ) {
- if(newname) {
- rename_id((ID *)G.obedit, "SurfDonut");
- rename_id((ID *)G.obedit->data, "SurfDonut");
- }
-
- xzproj= 1;
- nu= addNurbprim(4, 1, newname); /* circle */
- xzproj= 0;
- nu->resolu= 24;
- nu->resolv= 32;
- nu->flag= CU_SMOOTH;
- BLI_addtail(&editNurb, nu); /* temporal for extrude and translate */
- if(newname) spin_nurb(0, 2);
- else spin_nurb(0, 0);
-
- BLI_remlink(&editNurb, nu);
-
- a= nu->pntsu*nu->pntsv;
- bp= nu->bp;
- while(a-- >0) {
- bp->f1 |= SELECT;
- bp++;
- }
-
- }
- break;
- }
-
- /* always do: */
- nu->flag= CU_SMOOTH;
-
- test2DNurb(nu);
-
- return nu;
-}
-
-void default_curve_ipo(Curve *cu)
-{
- IpoCurve *icu;
- BezTriple *bezt;
-
- if(cu->ipo) return;
-
- cu->ipo= add_ipo("CurveIpo", ID_CU);
-
- icu= MEM_callocN(sizeof(IpoCurve), "ipocurve");
-
- icu->blocktype= ID_CU;
- icu->adrcode= CU_SPEED;
- icu->flag= IPO_VISIBLE|IPO_SELECT|IPO_AUTO_HORIZ;
- set_icu_vars(icu);
-
- BLI_addtail( &(cu->ipo->curve), icu);
-
- icu->bezt= bezt= MEM_callocN(2*sizeof(BezTriple), "defaultipo");
- icu->totvert= 2;
-
- bezt->hide= IPO_BEZ;
- bezt->f1=bezt->f2= bezt->f3= SELECT;
- bezt->h1= bezt->h2= HD_AUTO;
- bezt++;
- bezt->vec[1][0]= 100.0;
- bezt->vec[1][1]= 1.0;
- bezt->hide= IPO_BEZ;
- bezt->f1=bezt->f2= bezt->f3= SELECT;
- bezt->h1= bezt->h2= HD_AUTO;
-
- calchandles_ipocurve(icu);
-}
-
-void add_primitiveCurve(int stype)
-{
- Nurb *nu;
- Curve *cu;
- int type, newname= 0;
-
- if(G.vd==0) return;
- if(G.scene->id.lib) return;
-
- /* this function also comes from an info window */
- if ELEM(curarea->spacetype, SPACE_VIEW3D, SPACE_INFO); else return;
-
- if(stype>=10 && stype<20) type= CU_2D+1;
- else if(stype>=20 && stype<30) type= CU_2D+2;
- else if(stype>=30 && stype<40) type= CU_2D+3;
- else if(stype>=40 && stype<50) {
- if(stype==46) type= 4;
- else type= CU_2D+4;
- }
- else type= CU_2D;
-
- check_editmode(OB_CURVE);
-
- /* if no obedit: new object and enter editmode */
- if(G.obedit==NULL) {
- add_object_draw(OB_CURVE);
- base_init_from_view3d(BASACT, G.vd);
- G.obedit= BASACT->object;
-
- where_is_object(G.obedit);
-
- make_editNurb();
- setcursor_space(SPACE_VIEW3D, CURSOR_EDIT);
- newname= 1;
-
- cu= G.obedit->data;
- if(stype==46) {
- cu->flag |= (CU_3D+CU_PATH);
-
- default_curve_ipo(cu);
- }
- }
- else {
- cu= G.obedit->data;
- }
-
- if(cu->flag & CU_3D) type &= ~CU_2D;
-
- stype= (stype % 10);
-
- nu= addNurbprim(type, stype, newname); /* 2D */
-
- BLI_addtail(&editNurb, nu);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-
- countall();
-
- /* if a new object was created, it stores it in Curve, for reload original data and undo */
- if ( !(newname) || U.flag & USER_ADD_EDITMODE) {
- if(newname) load_editNurb();
- } else {
- exit_editmode(2);
- }
-
- allqueue(REDRAWALL, 0);
-
- BIF_undo_push("Add Curve");
-}
-
-void add_primitiveNurb(int type)
-{
- Nurb *nu;
- int newname= 0;
-
- if(G.scene->id.lib) return;
- if ELEM(curarea->spacetype, SPACE_VIEW3D, SPACE_INFO); else return;
-
- check_editmode(OB_SURF);
-
- /* if no obedit: new object and enter editmode */
- if(G.obedit==0) {
- add_object_draw(OB_SURF);
- base_init_from_view3d(BASACT, G.vd);
- G.obedit= BASACT->object;
-
- where_is_object(G.obedit);
-
- make_editNurb();
- setcursor_space(SPACE_VIEW3D, CURSOR_EDIT);
- newname= 1;
- }
-
- nu= addNurbprim(4, type, newname);
- BLI_addtail(&editNurb,nu);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-
- countall();
-
- /* if a new object was created, it stores it in Curve, for reload original data and undo */
- if ( !(newname) || U.flag & USER_ADD_EDITMODE) {
- if(newname) load_editNurb();
- } else {
- exit_editmode(2);
- }
- allqueue(REDRAWALL, 0);
-
- BIF_undo_push("Add Surface");
-}
-
-
-
-void clear_tilt()
-{
- Nurb *nu;
- BezTriple *bezt;
- BPoint *bp;
- int a;
-
- if(okee("Clear tilt")==0) return;
-
- for(nu= editNurb.first; nu; nu= nu->next) {
- if( nu->bezt ) {
- bezt= nu->bezt;
- a= nu->pntsu;
- while(a--) {
- if(BEZSELECTED_HIDDENHANDLES(bezt)) bezt->alfa= 0.0;
- bezt++;
- }
- }
- else if(nu->bp) {
- bp= nu->bp;
- a= nu->pntsu*nu->pntsv;
- while(a--) {
- if(bp->f1 & SELECT) bp->alfa= 0.0;
- bp++;
- }
- }
- }
-
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- BIF_undo_push("Clear tilt");
-
-}
-
-int bezt_compare (const void *e1, const void *e2)
-{
- BezTriple *b1 = *((BezTriple**)e1);
- BezTriple *b2 = *((BezTriple**)e2);
-
- /* Check numerical values */
- float val = b1->vec[1][0] - b2->vec[1][0];
-
- if (val<0)
- return -1;
-
- if (val>0)
- return 1;
-
- /* Check selected flags : Ensures that selected keys will be listed first */
-
- if ((b1->f2 & SELECT) && !(b2->f2 & SELECT))
- return -1;
- if (!(b1->f2 & SELECT) && (b2->f2 & SELECT))
- return 1;
-
- return 0;
-}
-
-
-/* **************** undo for curves ************** */
-
-static void undoCurve_to_editCurve(void *lbv)
-{
- ListBase *lb= lbv;
- Nurb *nu, *newnu;
- int nr, lastnunr= 0;
-
- /* we try to restore lastnu too, for buttons */
- for(nu= editNurb.first; nu; nu = nu->next, lastnunr++) if(nu==lastnu) break;
-
- freeNurblist(&editNurb);
-
- /* copy */
- for(nu= lb->first; nu; nu= nu->next) {
- newnu= duplicateNurb(nu);
- BLI_addtail(&editNurb, newnu);
- }
- /* restore */
- for(nr=0, lastnu= editNurb.first; lastnu; lastnu = lastnu->next, nr++) if(nr==lastnunr) break;
-
-}
-
-static void *editCurve_to_undoCurve(void)
-{
- ListBase *lb;
- Nurb *nu, *newnu;
-
- lb= MEM_callocN(sizeof(ListBase), "listbase undo");
-
- /* copy */
- for(nu= editNurb.first; nu; nu= nu->next) {
- newnu= duplicateNurb(nu);
- BLI_addtail(lb, newnu);
- }
- return lb;
-}
-
-static void free_undoCurve(void *lbv)
-{
- ListBase *lb= lbv;
-
- freeNurblist(lb);
- MEM_freeN(lb);
-}
-
-/* and this is all the undo system needs to know */
-void undo_push_curve(char *name)
-{
- undo_editmode_push(name, free_undoCurve, undoCurve_to_editCurve, editCurve_to_undoCurve);
-}
-
-
-
-/***/
diff --git a/source/blender/src/editdeform.c b/source/blender/src/editdeform.c
deleted file mode 100644
index b4206a510aa..00000000000
--- a/source/blender/src/editdeform.c
+++ /dev/null
@@ -1,944 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * Creator-specific support for vertex deformation groups
- * Added: apply deform function (ton)
- */
-
-#include <string.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_curve_types.h"
-#include "DNA_lattice_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_object_types.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_editVert.h"
-
-#include "BKE_customdata.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_depsgraph.h"
-#include "BKE_deform.h"
-#include "BKE_displist.h"
-#include "BKE_global.h"
-#include "BKE_lattice.h"
-#include "BKE_mesh.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_interface.h"
-#include "BIF_editdeform.h"
-#include "BIF_editmesh.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-
-#include "BSE_edit.h"
-
-#include "butspace.h"
-#include "mydevice.h"
-#include "editmesh.h"
-#include "multires.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-/* only in editmode */
-void sel_verts_defgroup (int select)
-{
- EditVert *eve;
- Object *ob;
- int i;
- MDeformVert *dvert;
-
- ob= G.obedit;
-
- if (!ob)
- return;
-
- switch (ob->type){
- case OB_MESH:
- for (eve=G.editMesh->verts.first; eve; eve=eve->next){
- dvert= CustomData_em_get(&G.editMesh->vdata, eve->data, CD_MDEFORMVERT);
-
- if (dvert && dvert->totweight){
- for (i=0; i<dvert->totweight; i++){
- if (dvert->dw[i].def_nr == (ob->actdef-1)){
- if (select) eve->f |= SELECT;
- else eve->f &= ~SELECT;
-
- break;
- }
- }
- }
- }
- /* this has to be called, because this function operates on vertices only */
- if(select) EM_select_flush(); // vertices to edges/faces
- else EM_deselect_flush();
-
- break;
- case OB_LATTICE:
- if(editLatt->dvert) {
- BPoint *bp;
- int a, tot;
-
- dvert= editLatt->dvert;
-
- tot= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw;
- for(a=0, bp= editLatt->def; a<tot; a++, bp++, dvert++) {
- for (i=0; i<dvert->totweight; i++){
- if (dvert->dw[i].def_nr == (ob->actdef-1)) {
- if(select) bp->f1 |= SELECT;
- else bp->f1 &= ~SELECT;
-
- break;
- }
- }
- }
- }
- break;
-
- default:
- break;
- }
-
- countall();
-
-}
-
-/* check if deform vertex has defgroup index */
-MDeformWeight *get_defweight (MDeformVert *dv, int defgroup)
-{
- int i;
-
- if (!dv || defgroup<0)
- return NULL;
-
- for (i=0; i<dv->totweight; i++){
- if (dv->dw[i].def_nr == defgroup)
- return dv->dw+i;
- }
- return NULL;
-}
-
-/* Ensures that mv has a deform weight entry for
- the specified defweight group */
-/* Note this function is mirrored in editmesh_tools.c, for use for editvertices */
-MDeformWeight *verify_defweight (MDeformVert *dv, int defgroup)
-{
- MDeformWeight *newdw;
-
- /* do this check always, this function is used to check for it */
- if (!dv || defgroup<0)
- return NULL;
-
- newdw = get_defweight (dv, defgroup);
- if (newdw)
- return newdw;
-
- newdw = MEM_callocN (sizeof(MDeformWeight)*(dv->totweight+1), "deformWeight");
- if (dv->dw){
- memcpy (newdw, dv->dw, sizeof(MDeformWeight)*dv->totweight);
- MEM_freeN (dv->dw);
- }
- dv->dw=newdw;
-
- dv->dw[dv->totweight].weight=0.0f;
- dv->dw[dv->totweight].def_nr=defgroup;
- /* Group index */
-
- dv->totweight++;
-
- return dv->dw+(dv->totweight-1);
-}
-
-void add_defgroup (Object *ob)
-{
- add_defgroup_name (ob, "Group");
-}
-
-bDeformGroup *add_defgroup_name (Object *ob, char *name)
-{
- bDeformGroup *defgroup;
-
- if (!ob)
- return NULL;
-
- defgroup = MEM_callocN (sizeof(bDeformGroup), "add deformGroup");
-
- BLI_strncpy (defgroup->name, name, 32);
-
- BLI_addtail(&ob->defbase, defgroup);
- unique_vertexgroup_name(defgroup, ob);
-
- ob->actdef = BLI_countlist(&ob->defbase);
-
- return defgroup;
-}
-
-void duplicate_defgroup ( Object *ob )
-{
- bDeformGroup *dg, *cdg;
- char name[32], s[32];
- MDeformWeight *org, *cpy;
- MDeformVert *dvert;
- Mesh *me;
- int i, idg, icdg;
-
- if (ob->type != OB_MESH)
- return;
-
- dg = BLI_findlink (&ob->defbase, (ob->actdef-1));
- if (!dg)
- return;
-
- BLI_snprintf (name, 32, "%s_copy", dg->name);
- while (get_named_vertexgroup (ob, name)) {
- if ((strlen (name) + 6) > 32) {
- error ("Error: the name for the new group is > 32 characters");
- return;
- }
- strcpy (s, name);
- BLI_snprintf (name, 32, "%s_copy", s);
- }
-
- cdg = copy_defgroup (dg);
- strcpy (cdg->name, name);
- BLI_addtail (&ob->defbase, cdg);
-
- idg = (ob->actdef-1);
- ob->actdef = BLI_countlist (&ob->defbase);
- icdg = (ob->actdef-1);
-
- me = get_mesh (ob);
- if (!me->dvert)
- return;
-
- for (i = 0; i < me->totvert; i++) {
- dvert = me->dvert+i;
- org = get_defweight (dvert, idg);
- if (org) {
- cpy = verify_defweight (dvert, icdg);
- cpy->weight = org->weight;
- }
- }
-}
-
-void del_defgroup_in_object_mode ( Object *ob )
-{
- bDeformGroup *dg;
- MDeformVert *dvert;
- Mesh *me;
- int i, e;
-
- if ((!ob) || (ob->type != OB_MESH))
- return;
-
- dg = BLI_findlink (&ob->defbase, (ob->actdef-1));
- if (!dg)
- return;
-
- me = get_mesh (ob);
- if (me->dvert) {
- for (i = 0; i < me->totvert; i++) {
- dvert = me->dvert + i;
- if (dvert) {
- if (get_defweight (dvert, (ob->actdef-1)))
- remove_vert_defgroup (ob, dg, i);
- }
- }
-
- for (i = 0; i < me->totvert; i++) {
- dvert = me->dvert+i;
- if (dvert) {
- for (e = 0; e < dvert->totweight; e++) {
- if (dvert->dw[e].def_nr > (ob->actdef-1))
- dvert->dw[e].def_nr--;
- }
- }
- }
- }
-
- /* Update the active deform index if necessary */
- if (ob->actdef == BLI_countlist(&ob->defbase))
- ob->actdef--;
-
- /* Remove the group */
- BLI_freelinkN (&ob->defbase, dg);
-}
-
-void del_defgroup (Object *ob)
-{
- bDeformGroup *defgroup;
- int i;
-
- if (!ob)
- return;
-
- if (!ob->actdef)
- return;
-
- defgroup = BLI_findlink(&ob->defbase, ob->actdef-1);
- if (!defgroup)
- return;
-
- /* Make sure that no verts are using this group */
- remove_verts_defgroup(1);
-
- /* Make sure that any verts with higher indices are adjusted accordingly */
- if(ob->type==OB_MESH) {
- EditMesh *em = G.editMesh;
- EditVert *eve;
- MDeformVert *dvert;
-
- for (eve=em->verts.first; eve; eve=eve->next){
- dvert= CustomData_em_get(&G.editMesh->vdata, eve->data, CD_MDEFORMVERT);
-
- if (dvert)
- for (i=0; i<dvert->totweight; i++)
- if (dvert->dw[i].def_nr > (ob->actdef-1))
- dvert->dw[i].def_nr--;
- }
- }
- else {
- BPoint *bp;
- MDeformVert *dvert= editLatt->dvert;
- int a, tot;
-
- if (dvert) {
- tot= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw;
- for(a=0, bp= editLatt->def; a<tot; a++, bp++, dvert++) {
- for (i=0; i<dvert->totweight; i++){
- if (dvert->dw[i].def_nr > (ob->actdef-1))
- dvert->dw[i].def_nr--;
- }
- }
- }
- }
-
- /* Update the active deform index if necessary */
- if (ob->actdef==BLI_countlist(&ob->defbase))
- ob->actdef--;
-
- /* Remove the group */
- BLI_freelinkN (&ob->defbase, defgroup);
-
- /* remove all dverts */
- if(ob->actdef==0) {
- if(ob->type==OB_MESH) {
- Mesh *me= ob->data;
- CustomData_free_layer_active(&me->vdata, CD_MDEFORMVERT, me->totvert);
- me->dvert= NULL;
- }
- else {
- if (editLatt->dvert) {
- MEM_freeN(editLatt->dvert);
- editLatt->dvert= NULL;
- }
- }
- }
-}
-
-void create_dverts(ID *id)
-{
- /* create deform verts
- */
-
- if( GS(id->name)==ID_ME) {
- Mesh *me= (Mesh *)id;
- me->dvert= CustomData_add_layer(&me->vdata, CD_MDEFORMVERT, CD_CALLOC, NULL, me->totvert);
- }
- else if( GS(id->name)==ID_LT) {
- Lattice *lt= (Lattice *)id;
- lt->dvert= MEM_callocN(sizeof(MDeformVert)*lt->pntsu*lt->pntsv*lt->pntsw, "lattice deformVert");
- }
-}
-
-/* for mesh in object mode
- lattice can be in editmode */
-void remove_vert_def_nr (Object *ob, int def_nr, int vertnum)
-{
- /* This routine removes the vertex from the deform
- * group with number def_nr.
- *
- * This routine is meant to be fast, so it is the
- * responsibility of the calling routine to:
- * a) test whether ob is non-NULL
- * b) test whether ob is a mesh
- * c) calculate def_nr
- */
-
- MDeformWeight *newdw;
- MDeformVert *dvert= NULL;
- int i;
-
- /* get the deform vertices corresponding to the
- * vertnum
- */
- if(ob->type==OB_MESH) {
- if( ((Mesh*)ob->data)->dvert )
- dvert = ((Mesh*)ob->data)->dvert + vertnum;
- }
- else if(ob->type==OB_LATTICE) {
- Lattice *lt= ob->data;
-
- if(ob==G.obedit)
- lt= editLatt;
-
- if(lt->dvert)
- dvert = lt->dvert + vertnum;
- }
-
- if(dvert==NULL)
- return;
-
- /* for all of the deform weights in the
- * deform vert
- */
- for (i=dvert->totweight - 1 ; i>=0 ; i--){
-
- /* if the def_nr is the same as the one
- * for our weight group then remove it
- * from this deform vert.
- */
- if (dvert->dw[i].def_nr == def_nr) {
- dvert->totweight--;
-
- /* if there are still other deform weights
- * attached to this vert then remove this
- * deform weight, and reshuffle the others
- */
- if (dvert->totweight) {
- newdw = MEM_mallocN (sizeof(MDeformWeight)*(dvert->totweight),
- "deformWeight");
- if (dvert->dw){
- memcpy (newdw, dvert->dw, sizeof(MDeformWeight)*i);
- memcpy (newdw+i, dvert->dw+i+1,
- sizeof(MDeformWeight)*(dvert->totweight-i));
- MEM_freeN (dvert->dw);
- }
- dvert->dw=newdw;
- }
- /* if there are no other deform weights
- * left then just remove the deform weight
- */
- else {
- MEM_freeN (dvert->dw);
- dvert->dw = NULL;
- break;
- }
- }
- }
-
-}
-
-/* for Mesh in Object mode */
-/* allows editmode for Lattice */
-void add_vert_defnr (Object *ob, int def_nr, int vertnum,
- float weight, int assignmode)
-{
- /* add the vert to the deform group with the
- * specified number
- */
- MDeformVert *dv= NULL;
- MDeformWeight *newdw;
- int i;
-
- /* get the vert */
- if(ob->type==OB_MESH) {
- if(((Mesh*)ob->data)->dvert)
- dv = ((Mesh*)ob->data)->dvert + vertnum;
- }
- else if(ob->type==OB_LATTICE) {
- Lattice *lt;
-
- if(ob==G.obedit)
- lt= editLatt;
- else
- lt= ob->data;
-
- if(lt->dvert)
- dv = lt->dvert + vertnum;
- }
-
- if(dv==NULL)
- return;
-
- /* Lets first check to see if this vert is
- * already in the weight group -- if so
- * lets update it
- */
- for (i=0; i<dv->totweight; i++){
-
- /* if this weight cooresponds to the
- * deform group, then add it using
- * the assign mode provided
- */
- if (dv->dw[i].def_nr == def_nr){
-
- switch (assignmode) {
- case WEIGHT_REPLACE:
- dv->dw[i].weight=weight;
- break;
- case WEIGHT_ADD:
- dv->dw[i].weight+=weight;
- if (dv->dw[i].weight >= 1.0)
- dv->dw[i].weight = 1.0;
- break;
- case WEIGHT_SUBTRACT:
- dv->dw[i].weight-=weight;
- /* if the weight is zero or less then
- * remove the vert from the deform group
- */
- if (dv->dw[i].weight <= 0.0)
- remove_vert_def_nr(ob, def_nr, vertnum);
- break;
- }
- return;
- }
- }
-
- /* if the vert wasn't in the deform group then
- * we must take a different form of action ...
- */
-
- switch (assignmode) {
- case WEIGHT_SUBTRACT:
- /* if we are subtracting then we don't
- * need to do anything
- */
- return;
-
- case WEIGHT_REPLACE:
- case WEIGHT_ADD:
- /* if we are doing an additive assignment, then
- * we need to create the deform weight
- */
- newdw = MEM_callocN (sizeof(MDeformWeight)*(dv->totweight+1),
- "deformWeight");
- if (dv->dw){
- memcpy (newdw, dv->dw, sizeof(MDeformWeight)*dv->totweight);
- MEM_freeN (dv->dw);
- }
- dv->dw=newdw;
-
- dv->dw[dv->totweight].weight=weight;
- dv->dw[dv->totweight].def_nr=def_nr;
-
- dv->totweight++;
- break;
- }
-}
-
-/* called while not in editmode */
-void add_vert_to_defgroup (Object *ob, bDeformGroup *dg, int vertnum,
- float weight, int assignmode)
-{
- /* add the vert to the deform group with the
- * specified assign mode
- */
- int def_nr;
-
- /* get the deform group number, exit if
- * it can't be found
- */
- def_nr = get_defgroup_num(ob, dg);
- if (def_nr < 0) return;
-
- /* if there's no deform verts then
- * create some
- */
- if(ob->type==OB_MESH) {
- if (!((Mesh*)ob->data)->dvert)
- create_dverts(ob->data);
- }
- else if(ob->type==OB_LATTICE) {
- if (!((Lattice*)ob->data)->dvert)
- create_dverts(ob->data);
- }
-
- /* call another function to do the work
- */
- add_vert_defnr (ob, def_nr, vertnum, weight, assignmode);
-}
-
-/* Only available in editmode */
-void assign_verts_defgroup (void)
-{
- extern float editbutvweight; /* buttons.c */
- Object *ob;
- EditVert *eve;
- bDeformGroup *dg, *eg;
- MDeformWeight *newdw;
- MDeformVert *dvert;
- int i, done;
-
- if(multires_level1_test()) return;
-
- ob= G.obedit;
-
- if (!ob)
- return;
-
- dg=BLI_findlink(&ob->defbase, ob->actdef-1);
- if (!dg){
- error ("No vertex group is active");
- return;
- }
-
- switch (ob->type){
- case OB_MESH:
- if (!CustomData_has_layer(&G.editMesh->vdata, CD_MDEFORMVERT))
- EM_add_data_layer(&G.editMesh->vdata, CD_MDEFORMVERT);
-
- /* Go through the list of editverts and assign them */
- for (eve=G.editMesh->verts.first; eve; eve=eve->next){
- dvert= CustomData_em_get(&G.editMesh->vdata, eve->data, CD_MDEFORMVERT);
-
- if (dvert && (eve->f & 1)){
- done=0;
- /* See if this vert already has a reference to this group */
- /* If so: Change its weight */
- done=0;
- for (i=0; i<dvert->totweight; i++){
- eg = BLI_findlink (&ob->defbase, dvert->dw[i].def_nr);
- /* Find the actual group */
- if (eg==dg){
- dvert->dw[i].weight=editbutvweight;
- done=1;
- break;
- }
- }
- /* If not: Add the group and set its weight */
- if (!done){
- newdw = MEM_callocN (sizeof(MDeformWeight)*(dvert->totweight+1), "deformWeight");
- if (dvert->dw){
- memcpy (newdw, dvert->dw, sizeof(MDeformWeight)*dvert->totweight);
- MEM_freeN (dvert->dw);
- }
- dvert->dw=newdw;
-
- dvert->dw[dvert->totweight].weight= editbutvweight;
- dvert->dw[dvert->totweight].def_nr= ob->actdef-1;
-
- dvert->totweight++;
-
- }
- }
- }
- break;
- case OB_LATTICE:
- {
- BPoint *bp;
- int a, tot;
-
- if(editLatt->dvert==NULL)
- create_dverts(&editLatt->id);
-
- tot= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw;
- for(a=0, bp= editLatt->def; a<tot; a++, bp++) {
- if(bp->f1 & SELECT)
- add_vert_defnr (ob, ob->actdef-1, a, editbutvweight, WEIGHT_REPLACE);
- }
- }
- break;
- default:
- printf ("Assigning deformation groups to unknown object type\n");
- break;
- }
-
-}
-
-/* mesh object mode, lattice can be in editmode */
-void remove_vert_defgroup (Object *ob, bDeformGroup *dg, int vertnum)
-{
- /* This routine removes the vertex from the specified
- * deform group.
- */
-
- int def_nr;
-
- /* if the object is NULL abort
- */
- if (!ob)
- return;
-
- /* get the deform number that cooresponds
- * to this deform group, and abort if it
- * can not be found.
- */
- def_nr = get_defgroup_num(ob, dg);
- if (def_nr < 0) return;
-
- /* call another routine to do the work
- */
- remove_vert_def_nr (ob, def_nr, vertnum);
-}
-
-/* for mesh in object mode lattice can be in editmode */
-static float get_vert_def_nr (Object *ob, int def_nr, int vertnum)
-{
- MDeformVert *dvert= NULL;
- int i;
-
- /* get the deform vertices corresponding to the
- * vertnum
- */
- if(ob->type==OB_MESH) {
- if( ((Mesh*)ob->data)->dvert )
- dvert = ((Mesh*)ob->data)->dvert + vertnum;
- }
- else if(ob->type==OB_LATTICE) {
- Lattice *lt= ob->data;
-
- if(ob==G.obedit)
- lt= editLatt;
-
- if(lt->dvert)
- dvert = lt->dvert + vertnum;
- }
-
- if(dvert==NULL)
- return 0.0f;
-
- for(i=dvert->totweight-1 ; i>=0 ; i--)
- if(dvert->dw[i].def_nr == def_nr)
- return dvert->dw[i].weight;
-
- return 0.0f;
-}
-
-/* mesh object mode, lattice can be in editmode */
-float get_vert_defgroup (Object *ob, bDeformGroup *dg, int vertnum)
-{
- int def_nr;
-
- if(!ob)
- return 0.0f;
-
- def_nr = get_defgroup_num(ob, dg);
- if(def_nr < 0) return 0.0f;
-
- return get_vert_def_nr (ob, def_nr, vertnum);
-}
-
-/* Only available in editmode */
-/* removes from active defgroup, if allverts==0 only selected vertices */
-void remove_verts_defgroup (int allverts)
-{
- Object *ob;
- EditVert *eve;
- MDeformVert *dvert;
- MDeformWeight *newdw;
- bDeformGroup *dg, *eg;
- int i;
-
- if(multires_level1_test()) return;
-
- ob= G.obedit;
-
- if (!ob)
- return;
-
- dg=BLI_findlink(&ob->defbase, ob->actdef-1);
- if (!dg){
- error ("No vertex group is active");
- return;
- }
-
- switch (ob->type){
- case OB_MESH:
- for (eve=G.editMesh->verts.first; eve; eve=eve->next){
- dvert= CustomData_em_get(&G.editMesh->vdata, eve->data, CD_MDEFORMVERT);
-
- if (dvert && dvert->dw && ((eve->f & 1) || allverts)){
- for (i=0; i<dvert->totweight; i++){
- /* Find group */
- eg = BLI_findlink (&ob->defbase, dvert->dw[i].def_nr);
- if (eg == dg){
- dvert->totweight--;
- if (dvert->totweight){
- newdw = MEM_mallocN (sizeof(MDeformWeight)*(dvert->totweight), "deformWeight");
-
- if (dvert->dw){
- memcpy (newdw, dvert->dw, sizeof(MDeformWeight)*i);
- memcpy (newdw+i, dvert->dw+i+1, sizeof(MDeformWeight)*(dvert->totweight-i));
- MEM_freeN (dvert->dw);
- }
- dvert->dw=newdw;
- }
- else{
- MEM_freeN (dvert->dw);
- dvert->dw=NULL;
- break;
- }
- }
- }
- }
- }
- break;
- case OB_LATTICE:
-
- if(editLatt->dvert) {
- BPoint *bp;
- int a, tot= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw;
-
- for(a=0, bp= editLatt->def; a<tot; a++, bp++) {
- if(allverts || (bp->f1 & SELECT))
- remove_vert_defgroup (ob, dg, a);
- }
- }
- break;
-
- default:
- printf ("Removing deformation groups from unknown object type\n");
- break;
- }
-}
-
-void vertexgroup_select_by_name(Object *ob, char *name)
-{
- bDeformGroup *curdef;
- int actdef= 1;
-
- if(ob==NULL) return;
-
- for (curdef = ob->defbase.first; curdef; curdef=curdef->next, actdef++){
- if (!strcmp(curdef->name, name)) {
- ob->actdef= actdef;
- return;
- }
- }
- ob->actdef=0; // this signals on painting to create a new one, if a bone in posemode is selected */
-}
-
-/* This function provides a shortcut for adding/removing verts from
- * vertex groups. It is called by the Ctrl-G hotkey in EditMode for Meshes
- * and Lattices. (currently only restricted to those two)
- * It is only responsible for
- */
-void vgroup_assign_with_menu(void)
-{
- Object *ob= G.obedit;
- int defCount;
- int mode;
-
- /* prevent crashes */
- if (ob==NULL) return;
-
- defCount= BLI_countlist(&ob->defbase);
-
- /* give user choices of adding to current/new or removing from current */
- if (defCount && ob->actdef)
- mode = pupmenu("Vertex Groups %t|Add Selected to New Group %x1|Add Selected to Active Group %x2|Remove Selected from Active Group %x3");
- else
- mode= pupmenu("Vertex Groups %t|Add Selected to New Group %x1");
-
- /* handle choices */
- switch (mode) {
- case 1: /* add to new group */
- add_defgroup(ob);
- assign_verts_defgroup();
- allqueue(REDRAWVIEW3D, 1);
- BIF_undo_push("Assign to vertex group");
- break;
- case 2: /* add to current group */
- assign_verts_defgroup();
- allqueue(REDRAWVIEW3D, 1);
- BIF_undo_push("Assign to vertex group");
- break;
- case 3: /* remove from current group */
- remove_verts_defgroup(0);
- allqueue(REDRAWVIEW3D, 1);
- BIF_undo_push("Remove from vertex group");
- break;
- }
-}
-
-/* This function provides a shortcut for commonly used vertex group
- * functions - change weight (not implemented), change active group, delete active group,
- * when Ctrl-Shift-G is used in EditMode, for Meshes and Lattices (only for now).
- */
-void vgroup_operation_with_menu(void)
-{
- Object *ob= G.obedit;
- int defCount;
- int mode;
-
- /* prevent crashes and useless cases */
- if (ob==NULL) return;
-
- defCount= BLI_countlist(&ob->defbase);
- if (defCount == 0) return;
-
- /* give user choices of adding to current/new or removing from current */
- if (ob->actdef)
- mode = pupmenu("Vertex Groups %t|Change Active Group%x1|Delete Active Group%x2");
- else
- mode= pupmenu("Vertex Groups %t|Change Active Group%x1");
-
- /* handle choices */
- switch (mode) {
- case 1: /* change active group*/
- {
- char *menustr= get_vertexgroup_menustr(ob);
- short nr;
-
- if (menustr) {
- nr= pupmenu(menustr);
-
- if ((nr >= 1) && (nr <= defCount))
- ob->actdef= nr;
-
- MEM_freeN(menustr);
- }
- allqueue(REDRAWBUTSALL, 0);
- }
- break;
- case 2: /* delete active group */
- {
- del_defgroup(ob);
- allqueue (REDRAWVIEW3D, 1);
- allqueue(REDRAWOOPS, 0);
- BIF_undo_push("Delete vertex group");
- }
- break;
- }
-}
-
-/* ******************* other deform edit stuff ********** */
-
-void object_apply_deform(Object *ob)
-{
- notice("Apply Deformation now only availble in Modifier buttons");
-}
-
diff --git a/source/blender/src/editface.c b/source/blender/src/editface.c
deleted file mode 100644
index be3d9429d31..00000000000
--- a/source/blender/src/editface.c
+++ /dev/null
@@ -1,1437 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-
-#include <math.h>
-#include <string.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_heap.h"
-#include "BLI_edgehash.h"
-#include "BLI_editVert.h"
-
-#include "MTC_matrixops.h"
-
-#include "IMB_imbuf_types.h"
-#include "IMB_imbuf.h"
-
-#include "DNA_image_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_object_types.h"
-#include "DNA_space_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_view3d_types.h"
-
-#include "BKE_brush.h"
-#include "BKE_customdata.h"
-#include "BKE_depsgraph.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_displist.h"
-#include "BKE_global.h"
-#include "BKE_mesh.h"
-#include "BKE_object.h"
-#include "BKE_texture.h"
-#include "BKE_utildefines.h"
-#include "BKE_customdata.h"
-
-#include "BSE_view.h"
-#include "BSE_edit.h"
-#include "BSE_drawview.h" /* for backdrawview3d */
-
-#include "BIF_editsima.h"
-#include "BIF_editmesh.h"
-#include "BIF_interface.h"
-#include "BIF_mywindow.h"
-#include "BIF_toolbox.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_gl.h"
-#include "BIF_graphics.h"
-#include "BIF_space.h" /* for allqueue */
-
-#include "BDR_drawmesh.h"
-#include "BDR_editface.h"
-#include "BDR_vpaint.h"
-
-#include "BDR_editface.h"
-#include "BDR_vpaint.h"
-
-#include "mydevice.h"
-#include "blendef.h"
-#include "butspace.h"
-#include "multires.h"
-
-#include "BSE_trans_types.h"
-
-#include "BDR_unwrapper.h"
-#include "BDR_editobject.h"
-
-#include "BPY_extern.h"
-#include "BPY_menus.h"
-
-/* Pupmenu codes: */
-#define UV_CUBE_MAPPING 2
-#define UV_CYL_MAPPING 3
-#define UV_SPHERE_MAPPING 4
-#define UV_BOUNDS_MAPPING 5
-#define UV_RESET_MAPPING 6
-#define UV_WINDOW_MAPPING 7
-#define UV_UNWRAP_MAPPING 8
-#define UV_CYL_EX 32
-#define UV_SPHERE_EX 34
-
-/* Some macro tricks to make pupmenu construction look nicer :-)
- Sorry, just did it for fun. */
-
-#define _STR(x) " " #x
-#define STRING(x) _STR(x)
-
-#define MENUSTRING(string, code) string " %x" STRING(code)
-#define MENUTITLE(string) string " %t|"
-
-
-/* returns 0 if not found, otherwise 1 */
-int facesel_face_pick(Mesh *me, short *mval, unsigned int *index, short rect)
-{
- if (!me || me->totface==0)
- return 0;
-
- if (G.vd->flag & V3D_NEEDBACKBUFDRAW) {
- check_backbuf();
- persp(PERSP_VIEW);
- }
-
- if (rect) {
- /* sample rect to increase changes of selecting, so that when clicking
- on an edge in the backbuf, we can still select a face */
- int dist;
- *index = sample_backbuf_rect(mval, 3, 1, me->totface+1, &dist,0,NULL);
- }
- else
- /* sample only on the exact position */
- *index = sample_backbuf(mval[0], mval[1]);
-
- if ((*index)<=0 || (*index)>(unsigned int)me->totface)
- return 0;
-
- (*index)--;
-
- return 1;
-}
-
-/* returns 0 if not found, otherwise 1 */
-static int facesel_edge_pick(Mesh *me, short *mval, unsigned int *index)
-{
- int dist;
- unsigned int min = me->totface + 1;
- unsigned int max = me->totface + me->totedge + 1;
-
- if (me->totedge == 0)
- return 0;
-
- if (G.vd->flag & V3D_NEEDBACKBUFDRAW) {
- check_backbuf();
- persp(PERSP_VIEW);
- }
-
- *index = sample_backbuf_rect(mval, 50, min, max, &dist,0,NULL);
-
- if (*index == 0)
- return 0;
-
- (*index)--;
-
- return 1;
-}
-
-/* only operates on the edit object - this is all thats needed at the moment */
-static void uv_calc_center_vector(float *result, Object *ob, EditMesh *em)
-{
- float min[3], max[3], *cursx;
-
- EditFace *efa;
- switch (G.vd->around)
- {
- case V3D_CENTER: /* bounding box center */
- min[0]= min[1]= min[2]= 1e20f;
- max[0]= max[1]= max[2]= -1e20f;
-
- for (efa= em->faces.first; efa; efa= efa->next) {
- if (efa->f & SELECT) {
- DO_MINMAX(efa->v1->co, min, max);
- DO_MINMAX(efa->v2->co, min, max);
- DO_MINMAX(efa->v3->co, min, max);
- if(efa->v4) DO_MINMAX(efa->v4->co, min, max);
- }
- }
- VecMidf(result, min, max);
- break;
- case V3D_CURSOR: /*cursor center*/
- cursx= give_cursor();
- /* shift to objects world */
- result[0]= cursx[0]-ob->obmat[3][0];
- result[1]= cursx[1]-ob->obmat[3][1];
- result[2]= cursx[2]-ob->obmat[3][2];
- break;
- case V3D_LOCAL: /*object center*/
- case V3D_CENTROID: /* multiple objects centers, only one object here*/
- default:
- result[0]= result[1]= result[2]= 0.0;
- break;
- }
-}
-
-static void uv_calc_map_matrix(float result[][4], Object *ob, float upangledeg, float sideangledeg, float radius)
-{
- float rotup[4][4], rotside[4][4], viewmatrix[4][4], rotobj[4][4];
- float sideangle= 0.0, upangle= 0.0;
- int k;
-
- /* get rotation of the current view matrix */
- Mat4CpyMat4(viewmatrix,G.vd->viewmat);
- /* but shifting */
- for( k= 0; k< 4; k++) viewmatrix[3][k] =0.0;
-
- /* get rotation of the current object matrix */
- Mat4CpyMat4(rotobj,ob->obmat);
- /* but shifting */
- for( k= 0; k< 4; k++) rotobj[3][k] =0.0;
-
- Mat4Clr(*rotup);
- Mat4Clr(*rotside);
-
- /* compensate front/side.. against opengl x,y,z world definition */
- /* this is "kanonen gegen spatzen", a few plus minus 1 will do here */
- /* i wanted to keep the reason here, so we're rotating*/
- sideangle= M_PI * (sideangledeg + 180.0) /180.0;
- rotside[0][0]= (float)cos(sideangle);
- rotside[0][1]= -(float)sin(sideangle);
- rotside[1][0]= (float)sin(sideangle);
- rotside[1][1]= (float)cos(sideangle);
- rotside[2][2]= 1.0f;
-
- upangle= M_PI * upangledeg /180.0;
- rotup[1][1]= (float)cos(upangle)/radius;
- rotup[1][2]= -(float)sin(upangle)/radius;
- rotup[2][1]= (float)sin(upangle)/radius;
- rotup[2][2]= (float)cos(upangle)/radius;
- rotup[0][0]= (float)1.0/radius;
-
- /* calculate transforms*/
- Mat4MulSerie(result,rotup,rotside,viewmatrix,rotobj,NULL,NULL,NULL,NULL);
-}
-
-static void uv_calc_shift_project(float *target, float *shift, float rotmat[][4], int projectionmode, float *source, float *min, float *max)
-{
- float pv[3];
-
- VecSubf(pv, source, shift);
- Mat4MulVecfl(rotmat, pv);
-
- switch(projectionmode) {
- case B_UVAUTO_CYLINDER:
- tubemap(pv[0], pv[1], pv[2], &target[0],&target[1]);
- /* split line is always zero */
- if (target[0] >= 1.0f) target[0] -= 1.0f;
- break;
-
- case B_UVAUTO_SPHERE:
- spheremap(pv[0], pv[1], pv[2], &target[0],&target[1]);
- /* split line is always zero */
- if (target[0] >= 1.0f) target[0] -= 1.0f;
- break;
-
- case 3: /* ortho special case for BOUNDS */
- target[0] = -pv[0];
- target[1] = pv[2];
- break;
-
- case 4:
- {
- /* very special case for FROM WINDOW */
- float pv4[4], dx, dy, x= 0.0, y= 0.0;
-
- dx= G.vd->area->winx;
- dy= G.vd->area->winy;
-
- VecCopyf(pv4, source);
- pv4[3] = 1.0;
-
- /* rotmat is the object matrix in this case */
- Mat4MulVec4fl(rotmat,pv4);
-
- /* almost project_short */
- Mat4MulVec4fl(G.vd->persmat,pv4);
- if (fabs(pv4[3]) > 0.00001) { /* avoid division by zero */
- target[0] = dx/2.0 + (dx/2.0)*pv4[0]/pv4[3];
- target[1] = dy/2.0 + (dy/2.0)*pv4[1]/pv4[3];
- }
- else {
- /* scaling is lost but give a valid result */
- target[0] = dx/2.0 + (dx/2.0)*pv4[0];
- target[1] = dy/2.0 + (dy/2.0)*pv4[1];
- }
-
- /* G.vd->persmat seems to do this funky scaling */
- if(dx > dy) {
- y= (dx-dy)/2.0;
- dy = dx;
- }
- else {
- x= (dy-dx)/2.0;
- dx = dy;
- }
- target[0]= (x + target[0])/dx;
- target[1]= (y + target[1])/dy;
-
- }
- break;
-
- default:
- target[0] = 0.0;
- target[1] = 1.0;
- }
-
- /* we know the values here and may need min_max later */
- /* max requests independand from min; not fastest but safest */
- if(min) {
- min[0] = MIN2(target[0], min[0]);
- min[1] = MIN2(target[1], min[1]);
- }
- if(max) {
- max[0] = MAX2(target[0], max[0]);
- max[1] = MAX2(target[1], max[1]);
- }
-}
-
-void calculate_uv_map(unsigned short mapmode)
-{
- MTFace *tface;
- Object *ob;
- float dx, dy, rotatematrix[4][4], radius= 1.0, min[3], cent[3], max[3];
- float fac= 1.0, upangledeg= 0.0, sideangledeg= 90.0;
- int i, b, mi, n;
-
- EditMesh *em = G.editMesh;
- EditFace *efa;
-
- if(G.scene->toolsettings->uvcalc_mapdir==1) {
- upangledeg= 90.0;
- sideangledeg= 0.0;
- } else {
- upangledeg= 0.0;
- if(G.scene->toolsettings->uvcalc_mapalign==1) sideangledeg= 0.0;
- else sideangledeg= 90.0;
- }
-
- /* add uvs if there not here */
- if (!EM_texFaceCheck()) {
- if (em && em->faces.first)
- EM_add_data_layer(&em->fdata, CD_MTFACE);
-
- if (!EM_texFaceCheck())
- return;
-
- /* select new UV's */
- if ((G.sima && G.sima->flag & SI_SYNC_UVSEL)==0) {
- for(efa=em->faces.first; efa; efa=efa->next) {
- MTFace *tf= (MTFace *)CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- simaFaceSel_Set(efa, tf);
- }
- }
- }
-
- ob=OBACT;
-
- switch(mapmode) {
- case B_UVAUTO_BOUNDS:
- min[0]= min[1]= 10000000.0;
- max[0]= max[1]= -10000000.0;
-
- cent[0] = cent[1] = cent[2] = 0.0;
- uv_calc_map_matrix(rotatematrix, ob, upangledeg, sideangledeg, 1.0f);
-
- for (efa= em->faces.first; efa; efa= efa->next) {
- if (efa->f & SELECT) {
- tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- uv_calc_shift_project(tface->uv[0],cent,rotatematrix,3, efa->v1->co, min,max);
- uv_calc_shift_project(tface->uv[1],cent,rotatematrix,3, efa->v2->co, min,max);
- uv_calc_shift_project(tface->uv[2],cent,rotatematrix,3, efa->v3->co,min,max);
- if(efa->v4)
- uv_calc_shift_project(tface->uv[3],cent,rotatematrix,3, efa->v4->co,min,max);
- }
- }
-
- /* rescale UV to be in 1/1 */
- dx= (max[0]-min[0]);
- dy= (max[1]-min[1]);
-
- for (efa= em->faces.first; efa; efa= efa->next) {
- if (efa->f & SELECT) {
- tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if(efa->v4) b= 3; else b= 2;
- for(; b>=0; b--) {
- tface->uv[b][0]= ((tface->uv[b][0]-min[0])*fac)/dx;
- tface->uv[b][1]= 1.0-fac+((tface->uv[b][1]-min[1])/* *fac */)/dy;
- }
- }
- }
- break;
-
- case B_UVAUTO_WINDOW:
- cent[0] = cent[1] = cent[2] = 0.0;
- Mat4CpyMat4(rotatematrix,ob->obmat);
- for (efa= em->faces.first; efa; efa= efa->next) {
- if (efa->f & SELECT) {
- tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- uv_calc_shift_project(tface->uv[0],cent,rotatematrix,4, efa->v1->co, NULL,NULL);
- uv_calc_shift_project(tface->uv[1],cent,rotatematrix,4, efa->v2->co, NULL,NULL);
- uv_calc_shift_project(tface->uv[2],cent,rotatematrix,4, efa->v3->co, NULL,NULL);
- if(efa->v4)
- uv_calc_shift_project(tface->uv[3],cent,rotatematrix,4, efa->v4->co, NULL,NULL);
- }
- }
- break;
-
- case B_UVAUTO_RESET:
- for (efa= em->faces.first; efa; efa= efa->next) {
- if (efa->f & SELECT) {
- tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- default_uv(tface->uv, 1.0);
- }
- }
- break;
-
- case B_UVAUTO_CYLINDER:
- case B_UVAUTO_SPHERE:
- uv_calc_center_vector(cent, ob, em);
-
- if(mapmode==B_UVAUTO_CYLINDER) radius = G.scene->toolsettings->uvcalc_radius;
-
- /* be compatible to the "old" sphere/cylinder mode */
- if (G.scene->toolsettings->uvcalc_mapdir== 2)
- Mat4One(rotatematrix);
- else
- uv_calc_map_matrix(rotatematrix,ob,upangledeg,sideangledeg,radius);
- for (efa= em->faces.first; efa; efa= efa->next) {
- if (efa->f & SELECT) {
- tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- uv_calc_shift_project(tface->uv[0],cent,rotatematrix,mapmode, efa->v1->co, NULL,NULL);
- uv_calc_shift_project(tface->uv[1],cent,rotatematrix,mapmode, efa->v2->co, NULL,NULL);
- uv_calc_shift_project(tface->uv[2],cent,rotatematrix,mapmode, efa->v3->co, NULL,NULL);
- n = 3;
- if(efa->v4) {
- uv_calc_shift_project(tface->uv[3],cent,rotatematrix,mapmode, efa->v4->co, NULL,NULL);
- n=4;
- }
-
- mi = 0;
- for (i = 1; i < n; i++)
- if (tface->uv[i][0] > tface->uv[mi][0]) mi = i;
-
- for (i = 0; i < n; i++) {
- if (i != mi) {
- dx = tface->uv[mi][0] - tface->uv[i][0];
- if (dx > 0.5) tface->uv[i][0] += 1.0;
- }
- }
- }
- }
-
- break;
-
- case B_UVAUTO_CUBE:
- {
- /* choose x,y,z axis for projetion depending on the largest normal */
- /* component, but clusters all together around the center of map */
- float no[3];
- short cox, coy;
- float *loc= ob->obmat[3];
- /*MVert *mv= me->mvert;*/
- float cubesize = G.scene->toolsettings->uvcalc_cubesize;
-
- for (efa= em->faces.first; efa; efa= efa->next) {
- if (efa->f & SELECT) {
- tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- CalcNormFloat(efa->v1->co, efa->v2->co, efa->v3->co, no);
-
- no[0]= fabs(no[0]);
- no[1]= fabs(no[1]);
- no[2]= fabs(no[2]);
-
- cox=0; coy= 1;
- if(no[2]>=no[0] && no[2]>=no[1]);
- else if(no[1]>=no[0] && no[1]>=no[2]) coy= 2;
- else { cox= 1; coy= 2; }
-
- tface->uv[0][0]= 0.5+0.5*cubesize*(loc[cox] + efa->v1->co[cox]);
- tface->uv[0][1]= 0.5+0.5*cubesize*(loc[coy] + efa->v1->co[coy]);
- dx = floor(tface->uv[0][0]);
- dy = floor(tface->uv[0][1]);
- tface->uv[0][0] -= dx;
- tface->uv[0][1] -= dy;
- tface->uv[1][0]= 0.5+0.5*cubesize*(loc[cox] + efa->v2->co[cox]);
- tface->uv[1][1]= 0.5+0.5*cubesize*(loc[coy] + efa->v2->co[coy]);
- tface->uv[1][0] -= dx;
- tface->uv[1][1] -= dy;
- tface->uv[2][0]= 0.5+0.5*cubesize*(loc[cox] + efa->v3->co[cox]);
- tface->uv[2][1]= 0.5+0.5*cubesize*(loc[coy] + efa->v3->co[coy]);
- tface->uv[2][0] -= dx;
- tface->uv[2][1] -= dy;
- if(efa->v4) {
- tface->uv[3][0]= 0.5+0.5*cubesize*(loc[cox] + efa->v4->co[cox]);
- tface->uv[3][1]= 0.5+0.5*cubesize*(loc[coy] + efa->v4->co[coy]);
- tface->uv[3][0] -= dx;
- tface->uv[3][1] -= dy;
- }
- }
- }
- break;
- }
- default:
- return;
- } /* end switch mapmode */
-
- /* clipping and wrapping */
- if(G.sima && G.sima->flag & SI_CLIP_UV) {
- for (efa= em->faces.first; efa; efa= efa->next) {
- if (!(efa->f & SELECT)) continue;
- tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-
- dx= dy= 0;
- if(efa->v4) b= 3; else b= 2;
- for(; b>=0; b--) {
- while(tface->uv[b][0] + dx < 0.0) dx+= 0.5;
- while(tface->uv[b][0] + dx > 1.0) dx-= 0.5;
- while(tface->uv[b][1] + dy < 0.0) dy+= 0.5;
- while(tface->uv[b][1] + dy > 1.0) dy-= 0.5;
- }
-
- if(efa->v4) b= 3; else b= 2;
- for(; b>=0; b--) {
- tface->uv[b][0]+= dx;
- CLAMP(tface->uv[b][0], 0.0, 1.0);
-
- tface->uv[b][1]+= dy;
- CLAMP(tface->uv[b][1], 0.0, 1.0);
- }
- }
- }
-
- BIF_undo_push("UV calculation");
-
- object_uvs_changed(OBACT);
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIMAGE, 0);
-}
-
-/* last_sel, use em->act_face otherwise get the last selected face in the editselections
- * at the moment, last_sel is mainly useful for gaking sure the space image dosnt flicker */
-MTFace *get_active_mtface(EditFace **act_efa, MCol **mcol, short sloppy)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa = NULL;
- EditSelection *ese;
-
- if(!EM_texFaceCheck())
- return NULL;
-
- /* first check the active face */
- if (sloppy && em->act_face) {
- efa = em->act_face;
- } else {
- ese = em->selected.last;
- for (; ese; ese=ese->prev){
- if(ese->type == EDITFACE) {
- efa = (EditFace *)ese->data;
-
- if (efa->h) efa= NULL;
- else break;
- }
- }
- }
-
- if (sloppy && !efa) {
- for (efa= em->faces.first; efa; efa= efa->next) {
- if (efa->f & SELECT)
- break;
- }
- }
-
- if (efa) {
- if (mcol) {
- if (CustomData_has_layer(&em->fdata, CD_MCOL))
- *mcol = CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
- else
- *mcol = NULL;
- }
- if (act_efa) *act_efa = efa;
- return CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- }
- if (act_efa) *act_efa= NULL;
- if(mcol) *mcol = NULL;
- return NULL;
-}
-
-void default_uv(float uv[][2], float size)
-{
- int dy;
-
- if(size>1.0) size= 1.0;
-
- dy= 1.0-size;
-
- uv[0][0]= 0;
- uv[0][1]= size+dy;
-
- uv[1][0]= 0;
- uv[1][1]= dy;
-
- uv[2][0]= size;
- uv[2][1]= dy;
-
- uv[3][0]= size;
- uv[3][1]= size+dy;
-}
-
-void make_tfaces(Mesh *me)
-{
- if(!me->mtface) {
- if(me->mr) {
- multires_add_layer(me, &me->mr->fdata, CD_MTFACE,
- CustomData_number_of_layers(&me->fdata, CD_MTFACE));
- }
- else {
- me->mtface= CustomData_add_layer(&me->fdata, CD_MTFACE, CD_DEFAULT,
- NULL, me->totface);
- }
- }
-}
-
-void reveal_tface()
-{
- Mesh *me;
- MFace *mface;
- int a;
-
- me= get_mesh(OBACT);
- if(me==0 || me->totface==0) return;
-
- mface= me->mface;
- a= me->totface;
- while(a--) {
- if(mface->flag & ME_HIDE) {
- mface->flag |= ME_FACE_SEL;
- mface->flag -= ME_HIDE;
- }
- mface++;
- }
-
- BIF_undo_push("Reveal face");
-
- object_tface_flags_changed(OBACT, 0);
-}
-
-void hide_tface()
-{
- Mesh *me;
- MFace *mface;
- int a;
-
- me= get_mesh(OBACT);
- if(me==0 || me->totface==0) return;
-
- if(G.qual & LR_ALTKEY) {
- reveal_tface();
- return;
- }
-
- mface= me->mface;
- a= me->totface;
- while(a--) {
- if(mface->flag & ME_HIDE);
- else {
- if(G.qual & LR_SHIFTKEY) {
- if( (mface->flag & ME_FACE_SEL)==0) mface->flag |= ME_HIDE;
- }
- else {
- if( (mface->flag & ME_FACE_SEL)) mface->flag |= ME_HIDE;
- }
- }
- if(mface->flag & ME_HIDE) mface->flag &= ~ME_FACE_SEL;
-
- mface++;
- }
-
- BIF_undo_push("Hide face");
-
- object_tface_flags_changed(OBACT, 0);
-}
-
-void select_linked_tfaces(int mode)
-{
- Object *ob;
- Mesh *me;
- short mval[2];
- unsigned int index=0;
-
- ob = OBACT;
- me = get_mesh(ob);
- if(me==0 || me->totface==0) return;
-
- if (mode==0 || mode==1) {
- if (!(ob->lay & G.vd->lay))
- error("The active object is not in this layer");
-
- getmouseco_areawin(mval);
- if (!facesel_face_pick(me, mval, &index, 1)) return;
- }
-
- select_linked_tfaces_with_seams(mode, me, index);
-}
-
-void deselectall_tface()
-{
- Mesh *me;
- MFace *mface;
- int a, sel;
-
- me= get_mesh(OBACT);
- if(me==0) return;
-
- mface= me->mface;
- a= me->totface;
- sel= 0;
- while(a--) {
- if(mface->flag & ME_HIDE);
- else if(mface->flag & ME_FACE_SEL) sel= 1;
- mface++;
- }
-
- mface= me->mface;
- a= me->totface;
- while(a--) {
- if(mface->flag & ME_HIDE);
- else {
- if(sel) mface->flag &= ~ME_FACE_SEL;
- else mface->flag |= ME_FACE_SEL;
- }
- mface++;
- }
-
- BIF_undo_push("(De)select all faces");
-
- object_tface_flags_changed(OBACT, 0);
-}
-
-void selectswap_tface(void)
-{
- Mesh *me;
- MFace *mface;
- int a;
-
- me= get_mesh(OBACT);
- if(me==0) return;
-
- mface= me->mface;
- a= me->totface;
- while(a--) {
- if(mface->flag & ME_HIDE);
- else {
- if(mface->flag & ME_FACE_SEL) mface->flag &= ~ME_FACE_SEL;
- else mface->flag |= ME_FACE_SEL;
- }
- mface++;
- }
-
- BIF_undo_push("Select inverse face");
-
- object_tface_flags_changed(OBACT, 0);
-}
-
-int minmax_tface(float *min, float *max)
-{
- Object *ob;
- Mesh *me;
- MFace *mf;
- MTFace *tf;
- MVert *mv;
- int a, ok=0;
- float vec[3], bmat[3][3];
-
- ob = OBACT;
- if (ob==0) return ok;
- me= get_mesh(ob);
- if(me==0 || me->mtface==0) return ok;
-
- Mat3CpyMat4(bmat, ob->obmat);
-
- mv= me->mvert;
- mf= me->mface;
- tf= me->mtface;
- for (a=me->totface; a>0; a--, mf++, tf++) {
- if (mf->flag & ME_HIDE || !(mf->flag & ME_FACE_SEL))
- continue;
-
- VECCOPY(vec, (mv+mf->v1)->co);
- Mat3MulVecfl(bmat, vec);
- VecAddf(vec, vec, ob->obmat[3]);
- DO_MINMAX(vec, min, max);
-
- VECCOPY(vec, (mv+mf->v2)->co);
- Mat3MulVecfl(bmat, vec);
- VecAddf(vec, vec, ob->obmat[3]);
- DO_MINMAX(vec, min, max);
-
- VECCOPY(vec, (mv+mf->v3)->co);
- Mat3MulVecfl(bmat, vec);
- VecAddf(vec, vec, ob->obmat[3]);
- DO_MINMAX(vec, min, max);
-
- if (mf->v4) {
- VECCOPY(vec, (mv+mf->v4)->co);
- Mat3MulVecfl(bmat, vec);
- VecAddf(vec, vec, ob->obmat[3]);
- DO_MINMAX(vec, min, max);
- }
- ok= 1;
- }
- return ok;
-}
-
-#define ME_SEAM_DONE ME_SEAM_LAST /* reuse this flag */
-
-static float seam_cut_cost(Mesh *me, int e1, int e2, int vert)
-{
- MVert *v = me->mvert + vert;
- MEdge *med1 = me->medge + e1, *med2 = me->medge + e2;
- MVert *v1 = me->mvert + ((med1->v1 == vert)? med1->v2: med1->v1);
- MVert *v2 = me->mvert + ((med2->v1 == vert)? med2->v2: med2->v1);
- float cost, d1[3], d2[3];
-
- cost = VecLenf(v1->co, v->co);
- cost += VecLenf(v->co, v2->co);
-
- VecSubf(d1, v->co, v1->co);
- VecSubf(d2, v2->co, v->co);
-
- cost = cost + 0.5f*cost*(2.0f - fabs(d1[0]*d2[0] + d1[1]*d2[1] + d1[2]*d2[2]));
-
- return cost;
-}
-
-static void seam_add_adjacent(Mesh *me, Heap *heap, int mednum, int vertnum, int *nedges, int *edges, int *prevedge, float *cost)
-{
- int startadj, endadj = nedges[vertnum+1];
-
- for (startadj = nedges[vertnum]; startadj < endadj; startadj++) {
- int adjnum = edges[startadj];
- MEdge *medadj = me->medge + adjnum;
- float newcost;
-
- if (medadj->flag & ME_SEAM_DONE)
- continue;
-
- newcost = cost[mednum] + seam_cut_cost(me, mednum, adjnum, vertnum);
-
- if (cost[adjnum] > newcost) {
- cost[adjnum] = newcost;
- prevedge[adjnum] = mednum;
- BLI_heap_insert(heap, newcost, (void*)adjnum);
- }
- }
-}
-
-static int seam_shortest_path(Mesh *me, int source, int target)
-{
- Heap *heap;
- EdgeHash *ehash;
- float *cost;
- MEdge *med;
- int a, *nedges, *edges, *prevedge, mednum = -1, nedgeswap = 0;
- MFace *mf;
-
- /* mark hidden edges as done, so we don't use them */
- ehash = BLI_edgehash_new();
-
- for (a=0, mf=me->mface; a<me->totface; a++, mf++) {
- if (!(mf->flag & ME_HIDE)) {
- BLI_edgehash_insert(ehash, mf->v1, mf->v2, NULL);
- BLI_edgehash_insert(ehash, mf->v2, mf->v3, NULL);
- if (mf->v4) {
- BLI_edgehash_insert(ehash, mf->v3, mf->v4, NULL);
- BLI_edgehash_insert(ehash, mf->v4, mf->v1, NULL);
- }
- else
- BLI_edgehash_insert(ehash, mf->v3, mf->v1, NULL);
- }
- }
-
- for (a=0, med=me->medge; a<me->totedge; a++, med++)
- if (!BLI_edgehash_haskey(ehash, med->v1, med->v2))
- med->flag |= ME_SEAM_DONE;
-
- BLI_edgehash_free(ehash, NULL);
-
- /* alloc */
- nedges = MEM_callocN(sizeof(*nedges)*me->totvert+1, "SeamPathNEdges");
- edges = MEM_mallocN(sizeof(*edges)*me->totedge*2, "SeamPathEdges");
- prevedge = MEM_mallocN(sizeof(*prevedge)*me->totedge, "SeamPathPrevious");
- cost = MEM_mallocN(sizeof(*cost)*me->totedge, "SeamPathCost");
-
- /* count edges, compute adjacent edges offsets and fill adjacent edges */
- for (a=0, med=me->medge; a<me->totedge; a++, med++) {
- nedges[med->v1+1]++;
- nedges[med->v2+1]++;
- }
-
- for (a=1; a<me->totvert; a++) {
- int newswap = nedges[a+1];
- nedges[a+1] = nedgeswap + nedges[a];
- nedgeswap = newswap;
- }
- nedges[0] = nedges[1] = 0;
-
- for (a=0, med=me->medge; a<me->totedge; a++, med++) {
- edges[nedges[med->v1+1]++] = a;
- edges[nedges[med->v2+1]++] = a;
-
- cost[a] = 1e20f;
- prevedge[a] = -1;
- }
-
- /* regular dijkstra shortest path, but over edges instead of vertices */
- heap = BLI_heap_new();
- BLI_heap_insert(heap, 0.0f, (void*)source);
- cost[source] = 0.0f;
-
- while (!BLI_heap_empty(heap)) {
- mednum = (int)BLI_heap_popmin(heap);
- med = me->medge + mednum;
-
- if (mednum == target)
- break;
-
- if (med->flag & ME_SEAM_DONE)
- continue;
-
- med->flag |= ME_SEAM_DONE;
-
- seam_add_adjacent(me, heap, mednum, med->v1, nedges, edges, prevedge, cost);
- seam_add_adjacent(me, heap, mednum, med->v2, nedges, edges, prevedge, cost);
- }
-
- MEM_freeN(nedges);
- MEM_freeN(edges);
- MEM_freeN(cost);
- BLI_heap_free(heap, NULL);
-
- for (a=0, med=me->medge; a<me->totedge; a++, med++)
- med->flag &= ~ME_SEAM_DONE;
-
- if (mednum != target) {
- MEM_freeN(prevedge);
- return 0;
- }
-
- /* follow path back to source and mark as seam */
- if (mednum == target) {
- short allseams = 1;
-
- mednum = target;
- do {
- med = me->medge + mednum;
- if (!(med->flag & ME_SEAM)) {
- allseams = 0;
- break;
- }
- mednum = prevedge[mednum];
- } while (mednum != source);
-
- mednum = target;
- do {
- med = me->medge + mednum;
- if (allseams)
- med->flag &= ~ME_SEAM;
- else
- med->flag |= ME_SEAM;
- mednum = prevedge[mednum];
- } while (mednum != -1);
- }
-
- MEM_freeN(prevedge);
- return 1;
-}
-
-static void seam_select(Mesh *me, short *mval, short path)
-{
- unsigned int index = 0;
- MEdge *medge, *med;
- int a, lastindex = -1;
-
- if (!facesel_edge_pick(me, mval, &index))
- return;
-
- for (a=0, med=me->medge; a<me->totedge; a++, med++) {
- if (med->flag & ME_SEAM_LAST) {
- lastindex = a;
- med->flag &= ~ME_SEAM_LAST;
- break;
- }
- }
-
- medge = me->medge + index;
- if (!path || (lastindex == -1) || (index == lastindex) ||
- !seam_shortest_path(me, lastindex, index))
- medge->flag ^= ME_SEAM;
- medge->flag |= ME_SEAM_LAST;
-
- G.f |= G_DRAWSEAMS;
-
- if (G.rt == 8)
- unwrap_lscm(1);
-
- BIF_undo_push("Mark Seam");
-
- object_tface_flags_changed(OBACT, 1);
-}
-
-void seam_edgehash_insert_face(EdgeHash *ehash, MFace *mf)
-{
- BLI_edgehash_insert(ehash, mf->v1, mf->v2, NULL);
- BLI_edgehash_insert(ehash, mf->v2, mf->v3, NULL);
- if (mf->v4) {
- BLI_edgehash_insert(ehash, mf->v3, mf->v4, NULL);
- BLI_edgehash_insert(ehash, mf->v4, mf->v1, NULL);
- }
- else
- BLI_edgehash_insert(ehash, mf->v3, mf->v1, NULL);
-}
-
-void seam_mark_clear_tface(short mode)
-{
- Mesh *me;
- MFace *mf;
- MEdge *med;
- int a;
-
- me= get_mesh(OBACT);
- if(me==0 || me->totface==0) return;
-
- if (mode == 0)
- mode = pupmenu("Seams%t|Mark Border Seam %x1|Clear Seam %x2");
-
- if (mode != 1 && mode != 2)
- return;
-
- if (mode == 2) {
- EdgeHash *ehash = BLI_edgehash_new();
-
- for (a=0, mf=me->mface; a<me->totface; a++, mf++)
- if (!(mf->flag & ME_HIDE) && (mf->flag & ME_FACE_SEL))
- seam_edgehash_insert_face(ehash, mf);
-
- for (a=0, med=me->medge; a<me->totedge; a++, med++)
- if (BLI_edgehash_haskey(ehash, med->v1, med->v2))
- med->flag &= ~ME_SEAM;
-
- BLI_edgehash_free(ehash, NULL);
- }
- else {
- /* mark edges that are on both selected and deselected faces */
- EdgeHash *ehash1 = BLI_edgehash_new();
- EdgeHash *ehash2 = BLI_edgehash_new();
-
- for (a=0, mf=me->mface; a<me->totface; a++, mf++) {
- if ((mf->flag & ME_HIDE) || !(mf->flag & ME_FACE_SEL))
- seam_edgehash_insert_face(ehash1, mf);
- else
- seam_edgehash_insert_face(ehash2, mf);
- }
-
- for (a=0, med=me->medge; a<me->totedge; a++, med++)
- if (BLI_edgehash_haskey(ehash1, med->v1, med->v2) &&
- BLI_edgehash_haskey(ehash2, med->v1, med->v2))
- med->flag |= ME_SEAM;
-
- BLI_edgehash_free(ehash1, NULL);
- BLI_edgehash_free(ehash2, NULL);
- }
-
- if (G.rt == 8)
- unwrap_lscm(1);
-
- G.f |= G_DRAWSEAMS;
- BIF_undo_push("Mark Seam");
-
- object_tface_flags_changed(OBACT, 1);
-}
-
-void face_select()
-{
- Object *ob;
- Mesh *me;
- MFace *mface, *msel;
- short mval[2];
- unsigned int a, index;
-
- /* Get the face under the cursor */
- ob = OBACT;
- if (!(ob->lay & G.vd->lay)) {
- error("The active object is not in this layer");
- }
- me = get_mesh(ob);
- getmouseco_areawin(mval);
-
- if (G.qual & LR_ALTKEY) {
- seam_select(me, mval, (G.qual & LR_SHIFTKEY) != 0);
- return;
- }
-
- if (!facesel_face_pick(me, mval, &index, 1)) return;
-
- msel= (((MFace*)me->mface)+index);
- if (msel->flag & ME_HIDE) return;
-
- /* clear flags */
- mface = me->mface;
- a = me->totface;
- if ((G.qual & LR_SHIFTKEY)==0) {
- while (a--) {
- mface->flag &= ~ME_FACE_SEL;
- mface++;
- }
- }
-
- me->act_face = (int)index;
-
- if (G.qual & LR_SHIFTKEY) {
- if (msel->flag & ME_FACE_SEL)
- msel->flag &= ~ME_FACE_SEL;
- else
- msel->flag |= ME_FACE_SEL;
- }
- else msel->flag |= ME_FACE_SEL;
-
- /* image window redraw */
-
- BIF_undo_push("Select UV face");
-
- object_tface_flags_changed(OBACT, 1);
-}
-
-void face_borderselect()
-{
- Mesh *me;
- MFace *mface;
- rcti rect;
- struct ImBuf *ibuf;
- unsigned int *rt;
- int a, sx, sy, index, val;
- char *selar;
-
- me= get_mesh(OBACT);
- if(me==0) return;
- if(me->totface==0) return;
-
- val= get_border(&rect, 3);
-
- /* why readbuffer here? shouldn't be necessary (maybe a flush or so) */
- glReadBuffer(GL_BACK);
-#ifdef __APPLE__
- glReadBuffer(GL_AUX0); /* apple only */
-#endif
-
- if(val) {
- selar= MEM_callocN(me->totface+1, "selar");
-
- sx= (rect.xmax-rect.xmin+1);
- sy= (rect.ymax-rect.ymin+1);
- if(sx*sy<=0) return;
-
- ibuf = IMB_allocImBuf(sx,sy,32,IB_rect,0);
- rt = ibuf->rect;
- glReadPixels(rect.xmin+curarea->winrct.xmin, rect.ymin+curarea->winrct.ymin, sx, sy, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
- if(G.order==B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf);
-
- a= sx*sy;
- while(a--) {
- if(*rt) {
- index= framebuffer_to_index(*rt);
- if(index<=me->totface) selar[index]= 1;
- }
- rt++;
- }
-
- mface= me->mface;
- for(a=1; a<=me->totface; a++, mface++) {
- if(selar[a]) {
- if(mface->flag & ME_HIDE);
- else {
- if(val==LEFTMOUSE) mface->flag |= ME_FACE_SEL;
- else mface->flag &= ~ME_FACE_SEL;
- }
- }
- }
-
- IMB_freeImBuf(ibuf);
- MEM_freeN(selar);
-
- BIF_undo_push("Border Select UV face");
-
- object_tface_flags_changed(OBACT, 0);
- }
-#ifdef __APPLE__
- glReadBuffer(GL_BACK);
-#endif
-}
-
-void uv_autocalc_tface()
-{
- short mode, i=0, has_pymenu=0; /* pymenu must be bigger then UV_*_MAPPING */
- BPyMenu *pym;
- char menu_number[3];
-
- /* uvmenu, will add python items */
- char uvmenu[4096]=MENUTITLE("UV Calculation")
- MENUSTRING("Unwrap", UV_UNWRAP_MAPPING) "|%l|"
-
- MENUSTRING("Cube Projection", UV_CUBE_MAPPING) "|"
- MENUSTRING("Cylinder from View", UV_CYL_MAPPING) "|"
- MENUSTRING("Sphere from View", UV_SPHERE_MAPPING) "|%l|"
-
- MENUSTRING("Project From View", UV_WINDOW_MAPPING) "|"
- MENUSTRING("Project from View (Bounds)",UV_BOUNDS_MAPPING) "|%l|"
-
- MENUSTRING("Reset", UV_RESET_MAPPING);
-
- /* note that we account for the 10 previous entries with i+10: */
- for (pym = BPyMenuTable[PYMENU_UVCALCULATION]; pym; pym = pym->next, i++) {
-
- if (!has_pymenu) {
- strcat(uvmenu, "|%l");
- has_pymenu = 1;
- }
-
- strcat(uvmenu, "|");
- strcat(uvmenu, pym->name);
- strcat(uvmenu, " %x");
- sprintf(menu_number, "%d", i+10);
- strcat(uvmenu, menu_number);
- }
-
- mode= pupmenu(uvmenu);
-
- if (mode >= 10) {
- BPY_menu_do_python(PYMENU_UVCALCULATION, mode - 10);
- return;
- }
-
- switch(mode) {
- case UV_CUBE_MAPPING:
- calculate_uv_map(B_UVAUTO_CUBE); break;
- case UV_CYL_MAPPING:
- calculate_uv_map(B_UVAUTO_CYLINDER); break;
- case UV_SPHERE_MAPPING:
- calculate_uv_map(B_UVAUTO_SPHERE); break;
- case UV_BOUNDS_MAPPING:
- calculate_uv_map(B_UVAUTO_BOUNDS); break;
- case UV_RESET_MAPPING:
- calculate_uv_map(B_UVAUTO_RESET); break;
- case UV_WINDOW_MAPPING:
- calculate_uv_map(B_UVAUTO_WINDOW); break;
- case UV_UNWRAP_MAPPING:
- unwrap_lscm(0); break;
- }
-}
-
-/* Texture Paint */
-
-void set_texturepaint() /* toggle */
-{
- Object *ob = OBACT;
- Mesh *me = 0;
-
- scrarea_queue_headredraw(curarea);
- if(ob==NULL) return;
-
- if (object_data_is_libdata(ob)) {
- error_libdata();
- return;
- }
-
- me= get_mesh(ob);
-
- if(me)
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
-
- if(G.f & G_TEXTUREPAINT) {
- G.f &= ~G_TEXTUREPAINT;
- texpaint_enable_mipmap();
- }
- else if (me) {
- G.f |= G_TEXTUREPAINT;
-
- if(me->mtface==NULL)
- make_tfaces(me);
-
- brush_check_exists(&G.scene->toolsettings->imapaint.brush);
- texpaint_disable_mipmap();
- }
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
-}
-
-static void texpaint_project(Object *ob, float *model, float *proj, float *co, float *pco)
-{
- VECCOPY(pco, co);
- pco[3]= 1.0f;
-
- Mat4MulVecfl(ob->obmat, pco);
- Mat4MulVecfl((float(*)[4])model, pco);
- Mat4MulVec4fl((float(*)[4])proj, pco);
-}
-
-static void texpaint_tri_weights(Object *ob, float *v1, float *v2, float *v3, float *co, float *w)
-{
- float pv1[4], pv2[4], pv3[4], h[3], divw;
- float model[16], proj[16], wmat[3][3], invwmat[3][3];
- GLint view[4];
-
- /* compute barycentric coordinates */
-
- /* get the needed opengl matrices */
- glGetIntegerv(GL_VIEWPORT, view);
- glGetFloatv(GL_MODELVIEW_MATRIX, model);
- glGetFloatv(GL_PROJECTION_MATRIX, proj);
- view[0] = view[1] = 0;
-
- /* project the verts */
- texpaint_project(ob, model, proj, v1, pv1);
- texpaint_project(ob, model, proj, v2, pv2);
- texpaint_project(ob, model, proj, v3, pv3);
-
- /* do inverse view mapping, see gluProject man page */
- h[0]= (co[0] - view[0])*2.0f/view[2] - 1;
- h[1]= (co[1] - view[1])*2.0f/view[3] - 1;
- h[2]= 1.0f;
-
- /* solve for (w1,w2,w3)/perspdiv in:
- h*perspdiv = Project*Model*(w1*v1 + w2*v2 + w3*v3) */
-
- wmat[0][0]= pv1[0]; wmat[1][0]= pv2[0]; wmat[2][0]= pv3[0];
- wmat[0][1]= pv1[1]; wmat[1][1]= pv2[1]; wmat[2][1]= pv3[1];
- wmat[0][2]= pv1[3]; wmat[1][2]= pv2[3]; wmat[2][2]= pv3[3];
-
- Mat3Inv(invwmat, wmat);
- Mat3MulVecfl(invwmat, h);
-
- VECCOPY(w, h);
-
- /* w is still divided by perspdiv, make it sum to one */
- divw= w[0] + w[1] + w[2];
- if(divw != 0.0f)
- VecMulf(w, 1.0f/divw);
-}
-
-/* compute uv coordinates of mouse in face */
-void texpaint_pick_uv(Object *ob, Mesh *mesh, unsigned int faceindex, short *xy, float *uv)
-{
- DerivedMesh *dm = mesh_get_derived_final(ob, CD_MASK_BAREMESH);
- int *index = dm->getFaceDataArray(dm, CD_ORIGINDEX);
- MTFace *tface = dm->getFaceDataArray(dm, CD_MTFACE), *tf;
- int numfaces = dm->getNumFaces(dm), a;
- float p[2], w[3], absw, minabsw;
- MFace mf;
- MVert mv[4];
-
- minabsw = 1e10;
- uv[0] = uv[1] = 0.0;
-
- persp(PERSP_VIEW);
-
- /* test all faces in the derivedmesh with the original index of the picked face */
- for (a = 0; a < numfaces; a++) {
- if (index[a] == faceindex) {
- dm->getFace(dm, a, &mf);
-
- dm->getVert(dm, mf.v1, &mv[0]);
- dm->getVert(dm, mf.v2, &mv[1]);
- dm->getVert(dm, mf.v3, &mv[2]);
- if (mf.v4)
- dm->getVert(dm, mf.v4, &mv[3]);
-
- tf= &tface[a];
-
- p[0]= xy[0];
- p[1]= xy[1];
-
- if (mf.v4) {
- /* the triangle with the largest absolute values is the one
- with the most negative weights */
- texpaint_tri_weights(ob, mv[0].co, mv[1].co, mv[3].co, p, w);
- absw= fabs(w[0]) + fabs(w[1]) + fabs(w[2]);
- if(absw < minabsw) {
- uv[0]= tf->uv[0][0]*w[0] + tf->uv[1][0]*w[1] + tf->uv[3][0]*w[2];
- uv[1]= tf->uv[0][1]*w[0] + tf->uv[1][1]*w[1] + tf->uv[3][1]*w[2];
- minabsw = absw;
- }
-
- texpaint_tri_weights(ob, mv[1].co, mv[2].co, mv[3].co, p, w);
- absw= fabs(w[0]) + fabs(w[1]) + fabs(w[2]);
- if (absw < minabsw) {
- uv[0]= tf->uv[1][0]*w[0] + tf->uv[2][0]*w[1] + tf->uv[3][0]*w[2];
- uv[1]= tf->uv[1][1]*w[0] + tf->uv[2][1]*w[1] + tf->uv[3][1]*w[2];
- minabsw = absw;
- }
- }
- else {
- texpaint_tri_weights(ob, mv[0].co, mv[1].co, mv[2].co, p, w);
- absw= fabs(w[0]) + fabs(w[1]) + fabs(w[2]);
- if (absw < minabsw) {
- uv[0]= tf->uv[0][0]*w[0] + tf->uv[1][0]*w[1] + tf->uv[2][0]*w[2];
- uv[1]= tf->uv[0][1]*w[0] + tf->uv[1][1]*w[1] + tf->uv[2][1]*w[2];
- minabsw = absw;
- }
- }
- }
- }
-
- dm->release(dm);
-}
diff --git a/source/blender/src/editfont.c b/source/blender/src/editfont.c
deleted file mode 100644
index 70365c9b234..00000000000
--- a/source/blender/src/editfont.c
+++ /dev/null
@@ -1,1291 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-#include <wchar.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef WIN32
-#include <unistd.h>
-#else
-#include <io.h>
-#endif
-
-#include "MTC_matrixops.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "DNA_curve_types.h"
-#include "DNA_object_types.h"
-#include "DNA_vfont_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_text_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_userdef_types.h"
-
-#include "BKE_depsgraph.h"
-#include "BKE_font.h"
-#include "BKE_object.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_editfont.h"
-#include "BIF_editmode_undo.h"
-#include "BIF_toolbox.h"
-#include "BIF_space.h"
-#include "BIF_mywindow.h"
-
-#include "BDR_editobject.h"
-
-#include "mydevice.h"
-
-#include "blendef.h"
-
-#define MAXTEXT 32766
-
-/* -- prototypes --------*/
-VFont *get_builtin_font(void);
-
-int textediting=0;
-
-extern struct SelBox *selboxes; /* from blenkernel/font.c */
-
-static char findaccent(char char1, unsigned int code)
-{
- char new= 0;
-
- if(char1=='a') {
- if(code=='`') new= 224;
- else if(code==39) new= 225;
- else if(code=='^') new= 226;
- else if(code=='~') new= 227;
- else if(code=='"') new= 228;
- else if(code=='o') new= 229;
- else if(code=='e') new= 230;
- else if(code=='-') new= 170;
- }
- else if(char1=='c') {
- if(code==',') new= 231;
- if(code=='|') new= 162;
- }
- else if(char1=='e') {
- if(code=='`') new= 232;
- else if(code==39) new= 233;
- else if(code=='^') new= 234;
- else if(code=='"') new= 235;
- }
- else if(char1=='i') {
- if(code=='`') new= 236;
- else if(code==39) new= 237;
- else if(code=='^') new= 238;
- else if(code=='"') new= 239;
- }
- else if(char1=='n') {
- if(code=='~') new= 241;
- }
- else if(char1=='o') {
- if(code=='`') new= 242;
- else if(code==39) new= 243;
- else if(code=='^') new= 244;
- else if(code=='~') new= 245;
- else if(code=='"') new= 246;
- else if(code=='/') new= 248;
- else if(code=='-') new= 186;
- else if(code=='e') new= 143;
- }
- else if(char1=='s') {
- if(code=='s') new= 167;
- }
- else if(char1=='u') {
- if(code=='`') new= 249;
- else if(code==39) new= 250;
- else if(code=='^') new= 251;
- else if(code=='"') new= 252;
- }
- else if(char1=='y') {
- if(code==39) new= 253;
- else if(code=='"') new= 255;
- }
- else if(char1=='A') {
- if(code=='`') new= 192;
- else if(code==39) new= 193;
- else if(code=='^') new= 194;
- else if(code=='~') new= 195;
- else if(code=='"') new= 196;
- else if(code=='o') new= 197;
- else if(code=='e') new= 198;
- }
- else if(char1=='C') {
- if(code==',') new= 199;
- }
- else if(char1=='E') {
- if(code=='`') new= 200;
- else if(code==39) new= 201;
- else if(code=='^') new= 202;
- else if(code=='"') new= 203;
- }
- else if(char1=='I') {
- if(code=='`') new= 204;
- else if(code==39) new= 205;
- else if(code=='^') new= 206;
- else if(code=='"') new= 207;
- }
- else if(char1=='N') {
- if(code=='~') new= 209;
- }
- else if(char1=='O') {
- if(code=='`') new= 210;
- else if(code==39) new= 211;
- else if(code=='^') new= 212;
- else if(code=='~') new= 213;
- else if(code=='"') new= 214;
- else if(code=='/') new= 216;
- else if(code=='e') new= 141;
- }
- else if(char1=='U') {
- if(code=='`') new= 217;
- else if(code==39) new= 218;
- else if(code=='^') new= 219;
- else if(code=='"') new= 220;
- }
- else if(char1=='Y') {
- if(code==39) new= 221;
- }
- else if(char1=='1') {
- if(code=='4') new= 188;
- if(code=='2') new= 189;
- }
- else if(char1=='3') {
- if(code=='4') new= 190;
- }
- else if(char1==':') {
- if(code=='-') new= 247;
- }
- else if(char1=='-') {
- if(code==':') new= 247;
- if(code=='|') new= 135;
- if(code=='+') new= 177;
- }
- else if(char1=='|') {
- if(code=='-') new= 135;
- if(code=='=') new= 136;
- }
- else if(char1=='=') {
- if(code=='|') new= 136;
- }
- else if(char1=='+') {
- if(code=='-') new= 177;
- }
-
- if(new) return new;
- else return char1;
-}
-
-wchar_t *copybuf=NULL;
-wchar_t *copybufinfo=NULL;
-
-static wchar_t *textbuf=NULL;
-static CharInfo *textbufinfo=NULL;
-static wchar_t *oldstr=NULL;
-static CharInfo *oldstrinfo=NULL;
-
-void update_string(Curve *cu)
-{
- int len;
-
- // Free the old curve string
- MEM_freeN(cu->str);
-
- // Calculate the actual string length in UTF-8 variable characters
- len = wcsleninu8(textbuf);
-
- // Alloc memory for UTF-8 variable char length string
- cu->str = MEM_callocN(len + sizeof(wchar_t), "str");
-
- // Copy the wchar to UTF-8
- wcs2utf8s(cu->str, textbuf);
-}
-
-static int insert_into_textbuf(Curve *cu, unsigned long c)
-{
- if (cu->len<MAXTEXT-1) {
- int x;
-
- for(x= cu->len; x>cu->pos; x--) textbuf[x]= textbuf[x-1];
- for(x= cu->len; x>cu->pos; x--) textbufinfo[x]= textbufinfo[x-1];
- textbuf[cu->pos]= c;
- textbufinfo[cu->pos] = cu->curinfo;
- textbufinfo[cu->pos].kern = 0;
- if (G.obedit->actcol>0)
- textbufinfo[cu->pos].mat_nr = G.obedit->actcol;
- else
- textbufinfo[cu->pos].mat_nr = 0;
-
- cu->pos++;
- cu->len++;
- textbuf[cu->len]='\0';
-
- update_string(cu);
-
- return 1;
- } else {
- return 0;
- }
-}
-
-void add_lorem(void)
-{
- char *p, *p2;
- int i;
- Curve *cu=G.obedit->data;
- static char* lastlorem;
-
- if (lastlorem)
- p= lastlorem;
- else
- p= BIF_lorem;
-
- i= rand()/(RAND_MAX/6)+4;
-
- for (p2=p; *p2 && i; p2++) {
- insert_into_textbuf(cu, *p2);
- if (*p2=='.') i--;
- }
- lastlorem = p2+1;
- if (strlen(lastlorem)<5) lastlorem = BIF_lorem;
-
- insert_into_textbuf(cu, '\n');
- insert_into_textbuf(cu, '\n');
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
-}
-
-void load_3dtext_fs(char *file)
-{
- FILE *fp;
- int filelen;
- char *strp;
- Curve *cu=G.obedit->data;
-
- fp= fopen(file, "r");
- if (!fp) return;
-
- fseek(fp, 0L, SEEK_END);
- filelen = ftell(fp);
- fseek(fp, 0L, SEEK_SET);
-
- strp = MEM_callocN(filelen+4, "tempstr");
-
- filelen = fread(strp, 1, filelen, fp);
- fclose(fp);
- strp[filelen]= 0;
-
- if(cu->len+filelen<MAXTEXT)
- {
- int tmplen;
- wchar_t *mem = MEM_callocN((sizeof(wchar_t)*filelen)+(4*sizeof(wchar_t)), "temporary");
- tmplen = utf8towchar_(mem, strp);
- wcscat(textbuf, mem);
- MEM_freeN(mem);
- cu->len += tmplen;
- cu->pos= cu->len;
- }
- MEM_freeN(strp);
-
- update_string(cu);
-
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
-}
-
-VFont *get_builtin_font(void)
-{
- VFont *vf;
-
- for (vf= G.main->vfont.first; vf; vf= vf->id.next)
- if (BLI_streq(vf->name, "<builtin>"))
- return vf;
-
- return load_vfont("<builtin>");
-}
-
-
-void txt_export_to_object(struct Text *text)
-{
- ID *id;
- Curve *cu;
- struct TextLine *tmp;
- int nchars = 0;
-// char sdir[FILE_MAXDIR];
-// char sfile[FILE_MAXFILE];
-
- if(!text) return;
-
- id = (ID *)text;
-
- if (G.obedit && G.obedit->type==OB_FONT) return;
- check_editmode(OB_FONT);
-
- add_object(OB_FONT);
-
- base_init_from_view3d(BASACT, G.vd);
- G.obedit= BASACT->object;
- where_is_object(G.obedit);
-
- cu= G.obedit->data;
-
-/*
-// renames object, careful with long filenames.
-
- if (text->name) {
- //ID *find_id(char *type, char *name)
- BLI_split_dirfile(text->name, sdir, sfile);
-// rename_id((ID *)G.obedit, sfile);
- rename_id((ID *)cu, sfile);
- id->us++;
- }
-*/
- cu->vfont= get_builtin_font();
- cu->vfont->id.us++;
-
- tmp= text->lines.first;
- while(cu->len<MAXTEXT && tmp) {
- nchars += strlen(tmp->line) + 1;
- tmp = tmp->next;
- }
-
- if(cu->str) MEM_freeN(cu->str);
- if(cu->strinfo) MEM_freeN(cu->strinfo);
-
- cu->str= MEM_mallocN(nchars+4, "str");
- cu->strinfo= MEM_callocN((nchars+4)*sizeof(CharInfo), "strinfo");
- cu->totbox= cu->actbox= 1;
- cu->tb= MEM_callocN(MAXTEXTBOX*sizeof(TextBox), "textbox");
- cu->tb[0].w = cu->tb[0].h = 0.0;
-
- tmp= text->lines.first;
- strcpy(cu->str, tmp->line);
- cu->len= strlen(tmp->line);
- cu->pos= cu->len;
-
- tmp= tmp->next;
-
- while(cu->len<MAXTEXT && tmp) {
- strcat(cu->str, "\n");
- strcat(cu->str, tmp->line);
- cu->len+= strlen(tmp->line) + 1;
- cu->pos= cu->len;
- tmp= tmp->next;
- }
-
- make_editText();
- exit_editmode(EM_FREEDATA|EM_WAITCURSOR);
-
- allqueue(REDRAWVIEW3D, 0);
-}
-
-
-void txt_export_to_objects(struct Text *text)
-{
- ID *id;
- Curve *cu;
- struct TextLine *curline;
- int nchars;
- int linenum = 0;
- float offset[3] = {0.0,0.0,0.0};
-
- if(!text) return;
-
- id = (ID *)text;
-
- if (G.obedit && G.obedit->type==OB_FONT) return;
- check_editmode(OB_FONT);
-
- curline = text->lines.first;
- while(curline){
- /*skip lines with no text, but still make space for them*/
- if(curline->line[0] == '\0'){
- linenum++;
- curline = curline->next;
- continue;
- }
-
- nchars = 0;
- add_object(OB_FONT);
-
- base_init_from_view3d(BASACT, G.vd);
- G.obedit= BASACT->object;
- where_is_object(G.obedit);
-
- /* Do the translation */
- offset[0] = 0;
- offset[1] = -linenum;
- offset[2] = 0;
-
- Mat4Mul3Vecfl(G.vd->viewinv,offset);
-
- G.obedit->loc[0] += offset[0];
- G.obedit->loc[1] += offset[1];
- G.obedit->loc[2] += offset[2];
- /* End Translation */
-
- cu= G.obedit->data;
-
- cu->vfont= get_builtin_font();
- cu->vfont->id.us++;
-
- nchars = strlen(curline->line) + 1;
-
- if(cu->str) MEM_freeN(cu->str);
- if(cu->strinfo) MEM_freeN(cu->strinfo);
-
- cu->str= MEM_mallocN(nchars+4, "str");
- cu->strinfo= MEM_callocN((nchars+4)*sizeof(CharInfo), "strinfo");
- cu->totbox= cu->actbox= 1;
- cu->tb= MEM_callocN(MAXTEXTBOX*sizeof(TextBox), "textbox");
- cu->tb[0].w = cu->tb[0].h = 0.0;
-
- strcpy(cu->str, curline->line);
- cu->len= strlen(curline->line);
- cu->pos= cu->len;
-
- make_editText();
- exit_editmode(EM_FREEDATA|EM_WAITCURSOR);
-
- linenum++;
- curline = curline->next;
- }
- BIF_undo_push("Add Text as Objects");
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static short next_word(Curve *cu)
-{
- short s;
- for (s=cu->pos; (cu->str[s]) && (cu->str[s]!=' ') && (cu->str[s]!='\n') &&
- (cu->str[s]!=1) && (cu->str[s]!='\r'); s++);
- if (cu->str[s]) return(s+1); else return(s);
-}
-
-static short prev_word(Curve *cu)
-{
- short s;
-
- if (cu->pos==0) return(0);
- for (s=cu->pos-2; (cu->str[s]) && (cu->str[s]!=' ') && (cu->str[s]!='\n') &&
- (cu->str[s]!=1) && (cu->str[s]!='\r'); s--);
- if (cu->str[s]) return(s+1); else return(s);
-}
-
-
-
-static int killselection(int ins) /* 1 == new character */
-{
- int selend, selstart, direction;
- Curve *cu= G.obedit->data;
- int offset = 0;
- int getfrom;
-
- direction = getselection(&selstart, &selend);
- if (direction) {
- int size;
- if (ins) offset = 1;
- if (cu->pos >= selstart) cu->pos = selstart+offset;
- if ((direction == -1) && ins) {
- selstart++;
- selend++;
- }
- getfrom = selend+offset;
- if (ins==0) getfrom++;
- size = (cu->len * sizeof(wchar_t)) - (selstart * sizeof(wchar_t)) + (offset*sizeof(wchar_t));
- memmove(textbuf+selstart, textbuf+getfrom, size);
- memmove(textbufinfo+selstart, textbufinfo+getfrom, ((cu->len-selstart)+offset)*sizeof(CharInfo));
- cu->len -= (selend-selstart)+offset;
- cu->selstart = cu->selend = 0;
- }
- return(direction);
-}
-
-static void copyselection(void)
-{
- int selstart, selend;
-
- if (getselection(&selstart, &selend)) {
- memcpy(copybuf, textbuf+selstart, ((selend-selstart)+1)*sizeof(wchar_t));
- copybuf[(selend-selstart)+1]=0;
- memcpy(copybufinfo, textbufinfo+selstart, ((selend-selstart)+1)*sizeof(CharInfo));
- }
-}
-
-static void pasteselection(void)
-{
- Curve *cu= G.obedit->data;
-
- int len= wcslen(copybuf);
-
- // Verify that the copy buffer => [copy buffer len] + cu->len < MAXTEXT
- if(cu->len + len <= MAXTEXT)
- {
- if (len) {
- int size = (cu->len * sizeof(wchar_t)) - (cu->pos*sizeof(wchar_t)) + sizeof(wchar_t);
- memmove(textbuf+cu->pos+len, textbuf+cu->pos, size);
- memcpy(textbuf+cu->pos, copybuf, len * sizeof(wchar_t));
-
- memmove(textbufinfo+cu->pos+len, textbufinfo+cu->pos, (cu->len-cu->pos+1)*sizeof(CharInfo));
- memcpy(textbufinfo+cu->pos, copybufinfo, len*sizeof(CharInfo));
-
- cu->len += len;
- cu->pos += len;
- }
- }
- else
- {
- error("Text too long");
- }
-}
-
-int style_to_sel(int style, int toggle)
-{
- int selstart, selend;
- int i;
- Curve *cu;
-
- if (G.obedit && (G.obedit->type == OB_FONT)) {
- cu= G.obedit->data;
-
- if (getselection(&selstart, &selend)) {
- for (i=selstart; i<=selend; i++) {
- if (toggle==0) {
- textbufinfo[i].flag &= ~style;
- } else {
- textbufinfo[i].flag |= style;
- }
- }
- return 1;
- }
- }
- return 0;
-}
-
-int mat_to_sel(void) {
- int selstart, selend;
- int i;
- Curve *cu;
-
- if (G.obedit && (G.obedit->type == OB_FONT)) {
- cu= G.obedit->data;
-
- if (getselection(&selstart, &selend)) {
- for (i=selstart; i<=selend; i++) {
- textbufinfo[i].mat_nr = G.obedit->actcol;
- }
- return 1;
- }
- }
- return 0;
-}
-
-void do_textedit(unsigned short event, short val, unsigned long _ascii)
-{
- Curve *cu;
- static int accentcode= 0;
- int x, doit=0, cursmove=0;
- unsigned long ascii = _ascii;
- short kern;
-
- cu= G.obedit->data;
-
- if(ascii) {
-
- /* handle case like TAB (TAB==9) */
- if( (ascii > 31 && ascii < 254 && ascii != 127) || (ascii==13) || (ascii==10) || (ascii==8)) {
-
- if(accentcode) {
- if(cu->pos>0) textbuf[cu->pos-1]= findaccent(textbuf[cu->pos-1], ascii);
- accentcode= 0;
- }
- else if(cu->len<MAXTEXT-1) {
- if(G.qual & LR_ALTKEY ) {
-
- /* might become obsolete, apple has default values for this, other OS's too? */
-
- if(ascii=='t') ascii= 137;
- else if(ascii=='c') ascii= 169;
- else if(ascii=='f') ascii= 164;
- else if(ascii=='g') ascii= 176;
- else if(ascii=='l') ascii= 163;
- else if(ascii=='r') ascii= 174;
- else if(ascii=='s') ascii= 223;
- else if(ascii=='v') ascii= 1001;
- else if(ascii=='y') ascii= 165;
- else if(ascii=='.') ascii= 138;
- else if(ascii=='1') ascii= 185;
- else if(ascii=='2') ascii= 178;
- else if(ascii=='3') ascii= 179;
- else if(ascii=='%') ascii= 139;
- else if(ascii=='?') ascii= 191;
- else if(ascii=='!') ascii= 161;
- else if(ascii=='x') ascii= 215;
- else if(ascii=='>') ascii= 187;
- else if(ascii=='<') ascii= 171;
- }
- if(ascii==1001) {
- int file, filelen;
- char *strp;
-
-/* this should be solved by clipboard support */
-#ifdef __WIN32_DISABLED
- file= open("C:\\windows\\temp\\cutbuf", O_BINARY|O_RDONLY);
-#else
- file= open("/tmp/.cutbuffer", O_BINARY|O_RDONLY);
-#endif
- if(file>0) {
-
- filelen = BLI_filesize(file);
-
- strp= MEM_mallocN(filelen+4, "tempstr");
- read(file, strp, filelen);
- close(file);
- strp[filelen]= 0;
-
- if(cu->len+filelen<MAXTEXT) {
- int tmplen;
- wchar_t *mem = MEM_callocN((sizeof(wchar_t)*filelen)+(4*sizeof(wchar_t)), "temporary");
- tmplen = utf8towchar_(mem, strp);
- wcscat(textbuf, mem);
- MEM_freeN(mem);
- cu->len += tmplen;
- cu->pos= cu->len;
- }
- MEM_freeN(strp);
- }
- }
- else {
- insert_into_textbuf(cu, ascii);
- }
- }
-
- killselection(1);
-
- doit= 1;
- }
- else
- {
- insert_into_textbuf(cu, ascii);
- doit = 1;
- }
- }
- else if(val) {
- cursmove= 0;
-
- switch(event) {
- case ENDKEY:
- if ((G.qual & LR_SHIFTKEY) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
- while(cu->pos<cu->len) {
- if( textbuf[cu->pos]==0) break;
- if( textbuf[cu->pos]=='\n') break;
- if( textbufinfo[cu->pos].flag & CU_WRAP ) break;
- cu->pos++;
- }
- cursmove=FO_CURS;
- break;
-
- case HOMEKEY:
- if ((G.qual & LR_SHIFTKEY) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
- while(cu->pos>0) {
- if( textbuf[cu->pos-1]=='\n') break;
- if( textbufinfo[cu->pos-1].flag & CU_WRAP ) break;
- cu->pos--;
- }
- cursmove=FO_CURS;
- break;
-
- case RETKEY:
- if(G.qual & LR_CTRLKEY) {
- insert_into_textbuf(cu, 1);
- if (textbuf[cu->pos]!='\n') insert_into_textbuf(cu, '\n');
- }
- else {
- insert_into_textbuf(cu, '\n');
- }
- cu->selstart = cu->selend = 0;
- doit= 1;
- break;
-
- case RIGHTARROWKEY:
- if ((G.qual & LR_SHIFTKEY) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
- if (G.qual & LR_CTRLKEY) {
- cu->pos= next_word(cu);
- cursmove= FO_CURS;
- }
- else if (G.qual & LR_ALTKEY) {
- kern = textbufinfo[cu->pos-1].kern;
- kern += 1;
- if (kern>20) kern = 20;
- textbufinfo[cu->pos-1].kern = kern;
- doit = 1;
- }
- else {
- cu->pos++;
- cursmove= FO_CURS;
- }
-
- break;
-
- case LEFTARROWKEY:
- if ((G.qual & LR_SHIFTKEY) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
- if (G.qual & LR_CTRLKEY) {
- cu->pos= prev_word(cu);
- cursmove= FO_CURS;
- }
- else if (G.qual & LR_ALTKEY) {
- kern = textbufinfo[cu->pos-1].kern;
- kern -= 1;
- if (kern<-20) kern = -20;
- textbufinfo[cu->pos-1].kern = kern;
- doit = 1;
- }
- else {
- cu->pos--;
- cursmove=FO_CURS;
- }
- break;
-
- case UPARROWKEY:
- if ((G.qual & LR_SHIFTKEY) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
- if(G.qual & LR_ALTKEY) {
- if (cu->pos && textbuf[cu->pos - 1] < 255) {
- textbuf[cu->pos - 1]++;
- doit= 1;
- }
- }
- else cursmove=FO_CURSUP;
- break;
-
- case PAGEUPKEY:
- if ((G.qual & LR_SHIFTKEY) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
- cursmove=FO_PAGEUP;
- break;
-
- case DOWNARROWKEY:
- if ((G.qual & LR_SHIFTKEY) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
- if(G.qual & LR_ALTKEY) {
- if (cu->pos && textbuf[cu->pos - 1] > 1) {
- textbuf[cu->pos - 1]--;
- doit= 1;
- }
- }
- else cursmove= FO_CURSDOWN;
- break;
-
- case PAGEDOWNKEY:
- if ((G.qual & LR_SHIFTKEY) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
- cursmove=FO_PAGEDOWN;
- break;
-
- case BACKSPACEKEY:
- if(cu->len!=0) {
- if(G.qual & LR_ALTKEY) {
- if(cu->pos>0) accentcode= 1;
- }
- else if (G.qual & LR_CTRLKEY) {
- cu->len = cu->pos = 0;
- textbuf[0]= 0;
- doit= 1;
- }
- else {
- if (killselection(0)==0) {
- if (cu->pos>0) {
- for(x=cu->pos;x<=cu->len;x++) textbuf[x-1]= textbuf[x];
- for(x=cu->pos;x<=cu->len;x++) textbufinfo[x-1]= textbufinfo[x];
- cu->pos--;
- textbuf[--cu->len]='\0';
- doit=1;
- }
- } else doit=1;
- }
- }
- break;
-
- case DELKEY:
- if(cu->len!=0) {
- if (killselection(0)==0) {
- if(cu->pos<cu->len) {
- for(x=cu->pos;x<cu->len;x++) textbuf[x]= textbuf[x+1];
- for(x=cu->pos;x<cu->len;x++) textbufinfo[x]= textbufinfo[x+1];
- textbuf[--cu->len]='\0';
- doit=1;
- }
- } else doit=1;
- }
- break;
-
- case IKEY:
- if (G.qual & LR_CTRLKEY) {
- cu->curinfo.flag ^= CU_ITALIC;
- if (style_to_sel(CU_ITALIC, cu->curinfo.flag & CU_ITALIC)) doit= 1;
- allqueue(REDRAWBUTSEDIT, 0);
- }
- break;
-
- case BKEY:
- if (G.qual & LR_CTRLKEY) {
- cu->curinfo.flag ^= CU_BOLD;
- if (style_to_sel(CU_BOLD, cu->curinfo.flag & CU_BOLD)) doit= 1;
- allqueue(REDRAWBUTSEDIT, 0);
- }
- break;
-
- case UKEY:
- if (G.qual & LR_CTRLKEY) {
- cu->curinfo.flag ^= CU_UNDERLINE;
- if (style_to_sel(CU_UNDERLINE, cu->curinfo.flag & CU_UNDERLINE)) doit= 1;
- allqueue(REDRAWBUTSEDIT, 0);
- }
- break;
-
- case XKEY:
- if (G.qual & LR_CTRLKEY) {
- copyselection();
- killselection(0);
- doit= 1;
- }
- break;
-
- case CKEY:
- if (G.qual & LR_CTRLKEY) {
- copyselection();
- }
- break;
-
- case VKEY:
- if (G.qual & LR_CTRLKEY) {
- pasteselection();
- doit= 1;
- }
- break;
-
- }
-
- if(cursmove) {
- if ((G.qual & LR_SHIFTKEY)==0) {
- if (cu->selstart) {
- cu->selstart = cu->selend = 0;
- update_string(cu);
- text_to_curve(G.obedit, FO_SELCHANGE);
- allqueue(REDRAWVIEW3D, 0);
- }
- }
- if(cu->pos>cu->len) cu->pos= cu->len;
- else if(cu->pos>=MAXTEXT) cu->pos= MAXTEXT;
- else if(cu->pos<0) cu->pos= 0;
- }
- }
- if(doit || cursmove) {
-
- if (cu->pos) {
- cu->curinfo = textbufinfo[cu->pos-1];
- } else cu->curinfo = textbufinfo[0];
-
- if (G.obedit->totcol>0) {
- G.obedit->actcol = textbufinfo[cu->pos-1].mat_nr;
- }
- allqueue(REDRAWBUTSEDIT, 0);
- update_string(cu);
- text_to_curve(G.obedit, cursmove);
- if (cursmove && (G.qual & LR_SHIFTKEY)) {
- cu->selend = cu->pos;
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- }
- if(cursmove==0) {
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- }
-
- BIF_undo_push("Textedit");
- allqueue(REDRAWVIEW3D, 0);
- }
-}
-
-void paste_unicodeText(char *filename)
-{
- Curve *cu= G.obedit->data;
- int filelen, doit= 0;
- char *strp;
- FILE *fp = NULL;
-
- fp= fopen(filename, "r");
-
- if(fp) {
-
- fseek( fp, 0L, SEEK_END );
- filelen = ftell( fp );
- fseek( fp, 0L, SEEK_SET );
-
- strp= MEM_mallocN(filelen+4, "tempstr");
- //fread() instead of read(),
- //because windows read() converts text to DOS \r\n linebreaks
- //causing double linebreaks in the 3d text
- filelen = fread(strp, 1, filelen, fp);
- fclose(fp);
- strp[filelen]= 0;
-
-
- if(cu->len+filelen<MAXTEXT)
- {
- int tmplen;
- wchar_t *mem = MEM_callocN((sizeof(wchar_t)*filelen)+(4*sizeof(wchar_t)), "temporary");
- tmplen = utf8towchar_(mem, strp);
-// mem =utf8s2wc(strp);
- wcscat(textbuf, mem);
- MEM_freeN(mem);
- cu->len += tmplen;
- cu->pos= cu->len;
- }
- MEM_freeN(strp);
- doit = 1;
- }
- if(doit) {
- update_string(cu);
- text_to_curve(G.obedit, 0);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- BIF_undo_push("Paste text");
- }
-}
-
-void paste_editText(void)
-{
- Curve *cu= G.obedit->data;
- int filelen, doit= 0;
- char *strp;
- FILE *fp = NULL;
-
-#ifdef WIN32
- fp= fopen("C:\\windows\\temp\\cutbuf.txt", "r");
-
-// The following is more likely to work on all Win32 installations.
-// suggested by Douglas Toltzman. Needs windows include files...
-/*
- char tempFileName[MAX_PATH];
- DWORD pathlen;
- static const char cutbufname[]="cutbuf.txt";
-
- if ((pathlen=GetTempPath(sizeof(tempFileName),tempFileName)) > 0 &&
- pathlen + sizeof(cutbufname) <= sizeof(tempFileName))
- {
- strcat(tempFileName,cutbufname);
- file= open(tempFileName, O_BINARY|O_RDONLY);
- }
-*/
-#else
- fp= fopen("/tmp/.cutbuffer", "r");
-#endif
-
- if(fp) {
-
- fseek(fp, 0L, SEEK_END);
- filelen = ftell( fp );
- fseek(fp, 0L, SEEK_SET);
-
- strp= MEM_mallocN(filelen+4, "tempstr");
- // fread() instead of read(),
- // because windows read() converts text to DOS \r\n linebreaks
- // causing double linebreaks in the 3d text
- filelen = fread(strp, 1, filelen, fp);
- fclose(fp);
- strp[filelen]= 0;
-
- if(cu->len+filelen<MAXTEXT) {
- int tmplen;
- wchar_t *mem = MEM_callocN((sizeof(wchar_t) * filelen) + (4 * sizeof(wchar_t)), "temporary");
- tmplen = utf8towchar_(mem, strp);
- wcscat(textbuf, mem);
- MEM_freeN(mem);
- cu->len += tmplen;
- cu->pos= cu->len;
- }
- MEM_freeN(strp);
- doit = 1;
- }
- if(doit) {
- update_string(cu);
- text_to_curve(G.obedit, 0);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- BIF_undo_push("Paste text");
- }
-}
-
-
-void make_editText(void)
-{
- Curve *cu;
- cu= G.obedit->data;
-
- if(textbuf==NULL) textbuf= MEM_callocN((MAXTEXT+4)*sizeof(wchar_t), "texteditbuf");
- if(textbufinfo==NULL) textbufinfo= MEM_callocN((MAXTEXT+4)*sizeof(CharInfo), "texteditbufinfo");
- if(copybuf==NULL) copybuf= MEM_callocN((MAXTEXT+4)*sizeof(wchar_t), "texteditcopybuf");
- if(copybufinfo==NULL) copybufinfo= MEM_callocN((MAXTEXT+4)*sizeof(CharInfo), "texteditcopybufinfo");
- if(oldstr==NULL) oldstr= MEM_callocN((MAXTEXT+4)*sizeof(wchar_t), "oldstrbuf");
-
- // Convert the original text to wchar_t
- utf8towchar_(textbuf, cu->str);
- wcscpy(oldstr, textbuf);
-
- cu->len= wcslen(textbuf);
-
- memcpy(textbufinfo, cu->strinfo, (cu->len)*sizeof(CharInfo));
-
- oldstrinfo= cu->strinfo;
- cu->strinfo= textbufinfo;
-
- if(cu->pos>cu->len) cu->pos= cu->len;
-
- if (cu->pos) {
- cu->curinfo = textbufinfo[cu->pos-1];
- } else cu->curinfo = textbufinfo[0];
-
- // Convert to UTF-8
- update_string(cu);
-
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-
- textediting= 1;
- BIF_undo_push("Original");
-}
-
-
-void load_editText(void)
-{
- Curve *cu;
-
- cu= G.obedit->data;
-
- MEM_freeN(oldstr);
- oldstr= NULL;
- MEM_freeN(oldstrinfo);
- oldstrinfo= NULL;
-
- update_string(cu);
-
- cu->strinfo= MEM_callocN((cu->len+4)*sizeof(CharInfo), "texteditinfo");
- memcpy(cu->strinfo, textbufinfo, (cu->len)*sizeof(CharInfo));
-
- cu->len= strlen(cu->str);
-
- /* this memory system is weak... */
- MEM_freeN(textbuf);
- MEM_freeN(textbufinfo);
- textbuf= NULL;
- textbufinfo= NULL;
-
- if (selboxes) {
- MEM_freeN(selboxes);
- selboxes= NULL;
- }
-
- textediting= 0;
-
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-
-}
-
-
-void remake_editText(void)
-{
- Curve *cu;
-
- if(okee("Reload original text")==0) return;
-
- // Copy the oldstr to textbuf temporary global variable
- wcscpy(textbuf, oldstr);
-
- // Set the object length and position
- cu= G.obedit->data;
- cu->len= wcslen(textbuf);
- if(cu->pos>cu->len) cu->pos= cu->len;
-
- update_string(cu);
-
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
-
- BIF_undo_push("Reload");
-}
-
-
-void free_editText(void)
-{
- if(oldstr) MEM_freeN(oldstr);
- if(oldstrinfo) MEM_freeN(oldstrinfo);
- if(textbuf) MEM_freeN(textbuf);
- textbuf = oldstr = NULL;
- textbufinfo = oldstrinfo = NULL;
- textediting= 0;
-}
-
-
-void add_primitiveFont(int dummy_argument)
-{
- Curve *cu;
-
- if (G.obedit && G.obedit->type==OB_FONT) return;
- check_editmode(OB_FONT);
-
- add_object_draw(OB_FONT);
- base_init_from_view3d(BASACT, G.vd);
-
- where_is_object(BASACT->object);
-
- cu= BASACT->object->data;
-
- cu->vfont= cu->vfontb= cu->vfonti= cu->vfontbi= get_builtin_font();
- cu->vfont->id.us+=4;
- cu->str= MEM_mallocN(12, "str");
- strcpy(cu->str, "Text");
- cu->pos= 4;
- cu->strinfo= MEM_callocN(12*sizeof(CharInfo), "strinfo");
- cu->totbox= cu->actbox= 1;
- cu->tb= MEM_callocN(MAXTEXTBOX*sizeof(TextBox), "textbox");
- cu->tb[0].w = cu->tb[0].h = 0.0;
-
- if (U.flag & USER_ADD_EDITMODE)
- enter_editmode(EM_WAITCURSOR);
-
- allqueue(REDRAWALL, 0);
-}
-
-void to_upper(void)
-{
- Curve *cu;
- int len, ok;
- wchar_t *str;
-
- if(G.obedit==0) {
- return;
- }
-
- ok= 0;
- cu= G.obedit->data;
-
- len= wcslen(textbuf);
- str= textbuf;
- while(len) {
- if( *str>=97 && *str<=122) {
- ok= 1;
- *str-= 32;
- }
- len--;
- str++;
- }
-
- if(ok==0) {
- len= wcslen(textbuf);
- str= textbuf;
- while(len) {
- if( *str>=65 && *str<=90) {
- *str+= 32;
- }
- len--;
- str++;
- }
- }
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- BIF_undo_push("To upper");
-
- update_string(cu);
-}
-
-
-/* **************** undo for font object ************** */
-
-static void undoFont_to_editFont(void *strv)
-{
- Curve *cu= G.obedit->data;
- char *str= strv;
-
- cu->pos= *((short *)str);
- cu->len= *((short *)(str+2));
-
- memcpy(textbuf, str+4, (cu->len+1)*sizeof(wchar_t));
- memcpy(textbufinfo, str+4 + (cu->len+1)*sizeof(wchar_t), cu->len*sizeof(CharInfo));
-
- cu->selstart = cu->selend = 0;
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-
- update_string(cu);
-
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static void *editFont_to_undoFont(void)
-{
- Curve *cu= G.obedit->data;
- char *str;
-
- // The undo buffer includes [MAXTEXT+6]=actual string and [MAXTEXT+4]*sizeof(CharInfo)=charinfo
- str= MEM_callocN((MAXTEXT+6)*sizeof(wchar_t) + (MAXTEXT+4)*sizeof(CharInfo), "string undo");
-
- // Copy the string and string information
- memcpy(str+4, textbuf, (cu->len+1)*sizeof(wchar_t));
- memcpy(str+4 + (cu->len+1)*sizeof(wchar_t), textbufinfo, cu->len*sizeof(CharInfo));
-
- *((short *)str)= cu->pos;
- *((short *)(str+2))= cu->len;
-
- return str;
-}
-
-static void free_undoFont(void *strv)
-{
- MEM_freeN(strv);
-}
-
-/* and this is all the undo system needs to know */
-void undo_push_font(char *name)
-{
- undo_editmode_push(name, free_undoFont, undoFont_to_editFont, editFont_to_undoFont);
-}
-
-
-
-/***/
diff --git a/source/blender/src/editgroup.c b/source/blender/src/editgroup.c
deleted file mode 100644
index b17e6efee1b..00000000000
--- a/source/blender/src/editgroup.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <string.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "DNA_group_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_view3d_types.h"
-
-#include "BKE_depsgraph.h"
-#include "BKE_group.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-
-#include "BIF_interface.h"
-#include "BIF_editgroup.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-
-#include "blendef.h"
-#include "mydevice.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-void add_selected_to_group(Group *group)
-{
- Base *base;
-
- for(base=FIRSTBASE; base; base= base->next) {
- if TESTBASE(base) {
- add_to_group(group, base->object);
- base->object->flag |= OB_FROMGROUP;
- base->flag |= OB_FROMGROUP;
- }
- }
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- DAG_scene_sort(G.scene);
- BIF_undo_push("Add to Group");
-}
-
-void add_selected_to_act_ob_groups(void)
-{
- Object *ob= OBACT, *obt;
- Base *base;
- Group *group;
-
- if (!ob) return;
-
- /* linking to same group requires its own loop so we can avoid
- looking up the active objects groups each time */
-
- group= G.main->group.first;
- while(group) {
- if(object_in_group(ob, group)) {
- /* Assign groups to selected objects */
- base= FIRSTBASE;
- while(base) {
- if(TESTBASE(base)) {
- obt= base->object;
- add_to_group(group, obt);
- obt->flag |= OB_FROMGROUP;
- base->flag |= OB_FROMGROUP;
- }
- base= base->next;
- }
- }
- group= group->id.next;
- }
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- DAG_scene_sort(G.scene);
- BIF_undo_push("Add to Active Objects Group");
-}
-
-
-void rem_selected_from_group(void)
-{
- Base *base;
- Group *group;
-
- for(base=FIRSTBASE; base; base= base->next) {
- if TESTBASE(base) {
-
- while( (group = find_group(base->object)) ) {
- rem_from_group(group, base->object);
- }
- base->object->flag &= ~OB_FROMGROUP;
- base->flag &= ~OB_FROMGROUP;
- }
- }
-
- DAG_scene_sort(G.scene);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- BIF_undo_push("Remove from Group");
-}
-
-void group_operation_with_menu(void)
-{
- Group *group= NULL;
- int mode;
-
- /* are there existing groups? */
- for(group= G.main->group.first; group; group= group->id.next)
- if(group->id.lib==NULL)
- break;
-
- if(group)
- mode= pupmenu("Groups %t|Add to Existing Group %x3|Add to Active Objects Groups %x4|Add to New Group %x1|Remove from All Groups %x2");
- else
- mode= pupmenu("Groups %t|Add to New Group %x1|Remove from All Groups %x2");
-
- group_operation(mode);
-}
-
-void group_operation(int mode)
-{
- Group *group= NULL;
-
- /* are there existing groups? */
- for(group= G.main->group.first; group; group= group->id.next)
- if(group->id.lib==NULL)
- break;
-
- if(mode>0) {
- if(group==NULL || mode==1) group= add_group( "Group" );
- if(mode==3) {
- int tot= BLI_countlist(&G.main->group);
- char *strp= MEM_callocN(tot*32 + 32, "group menu"), *strp1;
-
- strp1= strp;
- for(tot=1, group= G.main->group.first; group; group= group->id.next, tot++) {
- if(group->id.lib==NULL) {
- strp1 += sprintf(strp1, "%s %%x%d|", group->id.name+2, tot);
- }
- }
- tot= pupmenu(strp);
- MEM_freeN(strp);
- if(tot>0) group= BLI_findlink(&G.main->group, tot-1);
- else return;
- }
-
- if(mode==4) add_selected_to_act_ob_groups();
- else if(mode==1 || mode==3) add_selected_to_group(group);
- else if(mode==2) rem_selected_from_group();
- }
-}
diff --git a/source/blender/src/editimasel.c b/source/blender/src/editimasel.c
deleted file mode 100644
index cf6a86917b7..00000000000
--- a/source/blender/src/editimasel.c
+++ /dev/null
@@ -1,1156 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <math.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef WIN32
-#include <sys/times.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "BKE_global.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
-#include "BKE_depsgraph.h"
-#include "BKE_utildefines.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_storage_types.h"
-
-#ifdef WIN32
-#include "BLI_winstuff.h"
-#endif
-
-#include "DNA_armature_types.h"
-#include "DNA_action_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_image_types.h"
-#include "DNA_ipo_types.h"
-#include "DNA_material_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_object_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_space_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_vfont_types.h"
-#include "DNA_view3d_types.h"
-
-
-#include "BIF_filelist.h"
-#include "BIF_space.h"
-#include "BIF_screen.h"
-#include "BIF_interface.h"
-#include "BIF_mywindow.h"
-#include "BIF_imasel.h"
-#include "BIF_gl.h"
-#include "BIF_fsmenu.h"
-#include "BIF_editview.h"
-#include "BIF_toolbox.h"
-
-#include "BLO_readfile.h"
-
-#include "BPI_script.h"
-
-#include "BSE_drawipo.h"
-#include "BSE_drawimasel.h"
-#include "BSE_edit.h"
-
-#include "IMB_imbuf.h"
-#include "IMB_imbuf_types.h"
-
-#include "blendef.h"
-#include "mydevice.h"
-
-/* for events */
-#define NOTACTIVE 0
-#define ACTIVATE 1
-#define INACTIVATE 2
-/* for state of file */
-#define ACTIVE 2
-
-static void imasel_select_objects(SpaceImaSel *simasel);
-
-static int imasel_has_func(SpaceImaSel *simasel)
-{
- if(simasel->returnfunc || simasel->returnfunc_event || simasel->returnfunc_args)
- return 1;
- return 0;
-}
-
-#if defined __BeOS
-static int fnmatch(const char *pattern, const char *string, int flags)
-{
- return 0;
-}
-#elif defined WIN32 && !defined _LIBC
- /* use fnmatch included in blenlib */
- #include "BLI_fnmatch.h"
-#else
- #include <fnmatch.h>
-#endif
-
-static void imasel_split_file(SpaceImaSel *simasel, char *s1)
-{
- char string[FILE_MAX], dir[FILE_MAX], file[FILE_MAX];
-
- BLI_strncpy(string, s1, sizeof(string));
-
- BLI_split_dirfile(string, dir, file);
-
- if(simasel->files) {
- BIF_filelist_free(simasel->files);
- }
- BLI_strncpy(simasel->file, file, sizeof(simasel->file));
- BLI_strncpy(simasel->dir, dir, sizeof(simasel->dir));
-
- BIF_filelist_setdir(simasel->files, dir);
-
- BLI_make_file_string(G.sce, simasel->dir, dir, "");
-}
-
-/**************** IMAGESELECT ******************************/
-
-/* the complete call; pulldown menu, and three callback types */
-static void activate_imageselect_(int type, char *title, char *file, short *menup, char *pupmenu,
- void (*func)(char *),
- void (*func_event)(unsigned short),
- void (*func_args)(char *, void *arg1, void *arg2),
- void *arg1, void *arg2)
-{
- SpaceImaSel *simasel;
- char group[24], name[FILE_MAX], temp[FILE_MAX];
-
- if(curarea==0) return;
- if(curarea->win==0) return;
-
- newspace(curarea, SPACE_IMASEL);
- scrarea_queue_winredraw(curarea);
-
- /* sometime double, when area already is SPACE_IMASEL with a different file name */
- if(curarea->headwin) addqueue(curarea->headwin, CHANGED, 1);
-
- name[2]= 0;
- BLI_strncpy(name, file, sizeof(name));
-
- simasel= curarea->spacedata.first;
-
- simasel->returnfunc= func;
- simasel->returnfunc_event= func_event;
- simasel->returnfunc_args= func_args;
- simasel->arg1= arg1;
- simasel->arg2= arg2;
-
- simasel->type= type;
- simasel->scrollpos = 0.0f;
-
- if(simasel->pupmenu)
- MEM_freeN(simasel->pupmenu);
- simasel->pupmenu= pupmenu;
- simasel->menup= menup;
-
- /* sfile->act is used for databrowse: double names of library objects */
- simasel->active_file= -1;
-
- if(!simasel->files) {
- simasel->files = BIF_filelist_new();
- }
-
- if(G.relbase_valid && BLI_convertstringcode(name, G.sce, G.scene->r.cfra))
- simasel->flag |= FILE_STRINGCODE;
- else
- simasel->flag &= ~FILE_STRINGCODE;
-
- if (U.uiflag & USER_HIDE_DOT)
- simasel->flag |= FILE_HIDE_DOT;
-
- if(type==FILE_MAIN) {
- char *groupname;
-
- BLI_strncpy(simasel->file, name+2, sizeof(simasel->file));
-
- groupname = BLO_idcode_to_name( GS(name) );
- if (groupname) {
- BLI_strncpy(simasel->dir, groupname, sizeof(simasel->dir) - 1);
- strcat(simasel->dir, "/");
- }
-
- /* free all */
- if (simasel->files) {
- BIF_filelist_freelib(simasel->files);
- BIF_filelist_free(simasel->files);
- BIF_filelist_setdir(simasel->files, simasel->dir);
- BIF_filelist_settype(simasel->files, type);
- }
- }
- else if(type==FILE_LOADLIB) {
-
- if( BIF_filelist_islibrary(simasel->files, temp, group) ) {
- /* force a reload of the library-filelist */
- BIF_filelist_free(simasel->files);
- BIF_filelist_freelib(simasel->files);
- BLI_strncpy(simasel->dir, name, sizeof(simasel->dir));
- BIF_filelist_setdir(simasel->files, simasel->dir);
- BIF_filelist_settype(simasel->files, type);
- }
- else {
- imasel_split_file(simasel, name);
- BIF_filelist_freelib(simasel->files);
- BIF_filelist_settype(simasel->files, type);
- }
- }
- else { /* FILE_BLENDER */
- imasel_split_file(simasel, name);
- BIF_filelist_settype(simasel->files, type);
-
- BLI_cleanup_dir(G.sce, simasel->dir);
-
- /* free: filelist and libfiledata became incorrect */
- BIF_filelist_freelib(simasel->files);
- }
- BLI_strncpy(simasel->title, title, sizeof(simasel->title));
- /* filetoname= 1; */ /* TODO: elubie - check what this means */
-}
-
-void activate_imageselect(int type, char *title, char *file, void (*func)(char *))
-{
- activate_imageselect_(type, title, file, NULL, NULL, func, NULL, NULL, NULL, NULL);
-}
-
-void activate_imageselect_menu(int type, char *title, char *file, char *pupmenu, short *menup, void (*func)(char *))
-{
- activate_imageselect_(type, title, file, menup, pupmenu, func, NULL, NULL, NULL, NULL);
-}
-
-void activate_imageselect_args(int type, char *title, char *file, void (*func)(char *, void *, void *), void *arg1, void *arg2)
-{
- activate_imageselect_(type, title, file, NULL, NULL, NULL, NULL, func, arg1, arg2);
-}
-
-void activate_databrowse_imasel(ID *id, int idcode, int fromcode, int retval, short *menup, void (*func)(unsigned short))
-{
- ListBase *lb;
- SpaceImaSel *simasel;
- char str[32];
-
- if(id==NULL) {
- lb= wich_libbase(G.main, idcode);
- id= lb->first;
- }
-
- if(id) BLI_strncpy(str, id->name, sizeof(str));
- else return;
-
- activate_imageselect_(FILE_MAIN, "SELECT DATABLOCK", str, menup, NULL, NULL, func, NULL, NULL, NULL);
-
- simasel= curarea->spacedata.first;
- simasel->retval= retval;
- simasel->menup= menup;
-
- BIF_filelist_setipotype(simasel->files, fromcode);
- BIF_filelist_hasfunc(simasel->files, imasel_has_func(simasel));
-}
-
-
-static void set_active_file(SpaceImaSel *simasel, short x, short y)
-{
- short tilex, tiley;
- int active_tile;
- int active_file;
- int stridex;
- struct direntry* file;
- rcti viewrect = simasel->viewrect;
- int fileoffset;
- int rowoffset;
- int rowleftover;
- float scrollofs;
- int numfiles;
- int tilewidth = simasel->prv_w + TILE_BORDER_X*4;
- int tileheight = simasel->prv_h + TILE_BORDER_Y*4 + U.fontsize;
-
- numfiles = BIF_filelist_numfiles(simasel->files);
-
- if (simasel->numtilesx > 0) {
- fileoffset = numfiles*(simasel->scrollpos / simasel->scrollarea) + 0.5;
- rowoffset = (fileoffset / simasel->numtilesx)*simasel->numtilesx;
- rowleftover = fileoffset % simasel->numtilesx;
- scrollofs = (float)tileheight*(float)rowleftover/(float)simasel->numtilesx;
-
- stridex = (viewrect.xmax - viewrect.xmin) / (tilewidth);
- tilex = ( (x-viewrect.xmin)) / (tilewidth);
- tiley = (viewrect.ymax - viewrect.ymin + scrollofs - y) / (tileheight);
- if (tilex >= simasel->numtilesx) tilex = simasel->numtilesx-1;
- if (tiley >= simasel->numtilesy+1) tiley = simasel->numtilesy;
- if (tilex < 0) tilex=0;
- if (tiley < 0) tiley = 0;
- active_tile = tilex + stridex*tiley;
- active_file = rowoffset + active_tile;
-
- if (active_file >= 0 && active_file < BIF_filelist_numfiles(simasel->files) )
- {
- simasel->active_file = active_file;
- if (simasel->selstate & ACTIVATE) {
- file = BIF_filelist_file(simasel->files, simasel->active_file);
- file->flags |= ACTIVE;
- }
- } else {
- simasel->active_file = -1;
- }
- } else {
- simasel->active_file = -1;
- }
-}
-
-static void set_active_bookmark(SpaceImaSel *simasel, short y)
-{
- int nentries = fsmenu_get_nentries();
- short posy = simasel->bookmarkrect.ymax - TILE_BORDER_Y - y;
- simasel->active_bookmark = ((float)posy / (U.fontsize*3.0f/2.0f));
- if (simasel->active_bookmark < 0 || simasel->active_bookmark > nentries) {
- simasel->active_bookmark = -1;
- }
-}
-
-static void imasel_prevspace()
-{
- SpaceImaSel *simasel;
-
- simasel= curarea->spacedata.first;
-
- /* cleanup */
- if(simasel->spacetype==SPACE_IMASEL) {
- if(simasel->pupmenu) {
- MEM_freeN(simasel->pupmenu);
- simasel->pupmenu= NULL;
- }
- }
-
- if(simasel->next) {
-
- BLI_remlink(&curarea->spacedata, simasel);
- BLI_addtail(&curarea->spacedata, simasel);
-
- simasel= curarea->spacedata.first;
-
- if (simasel->spacetype == SPACE_SCRIPT) {
- SpaceScript *sc = (SpaceScript *)simasel;
- if (sc->script) sc->script->flags &=~SCRIPT_FILESEL;
- }
-
- newspace(curarea, simasel->spacetype);
- }
- else newspace(curarea, SPACE_INFO);
-}
-
-static void free_imasel_spec(char *dir)
-{
- /* all filesels with 'dir' are freed */
- bScreen *sc;
-
- sc= G.main->screen.first;
- while(sc) {
- ScrArea *sa= sc->areabase.first;
- while(sa) {
- SpaceLink *sl= sa->spacedata.first;
- while(sl) {
- if(sl->spacetype==SPACE_FILE) {
- SpaceImaSel *simasel= (SpaceImaSel*) sl;
- if (BLI_streq(simasel->dir, dir)) {
- BIF_filelist_free(simasel->files);
- }
- }
- sl= sl->next;
- }
- sa= sa->next;
- }
- sc= sc->id.next;
- }
-}
-
-static void do_library_append(SpaceImaSel *simasel)
-{
- Library *lib;
- char dir[FILE_MAXDIR], group[32];
-
- if ( BIF_filelist_islibrary(simasel->files, dir, group)==0 ) {
- error("Not a library");
- } else if (!BIF_filelist_lib(simasel->files) ) {
- error("Library not loaded");
- } else if (group[0]==0) {
- error("Nothing indicated");
- } else if (BLI_streq(G.main->name, dir)) {
- error("Cannot use current file as library");
- } else {
- Object *ob;
- int idcode = BIF_groupname_to_code(group);
-
- if((simasel->flag & FILE_LINK)==0) {
- /* tag everything, all untagged data can be made local */
- ID *id;
- ListBase *lbarray[MAX_LIBARRAY];
- int a;
-
- a= set_listbasepointers(G.main, lbarray);
- while(a--) {
- for(id= lbarray[a]->first; id; id= id->next) id->flag |= LIB_APPEND_TAG;
- }
- }
-
- BIF_filelist_append_library(simasel->files, dir, simasel->file, simasel->flag, idcode);
-
- /* DISPLISTS? */
- ob= G.main->object.first;
- while(ob) {
- if(ob->id.lib) {
- ob->recalc |= OB_RECALC;
- }
- ob= ob->id.next;
- }
-
- /* and now find the latest append lib file */
- lib= G.main->library.first;
- while(lib) {
- if (BLI_streq(dir, lib->filename)) break;
- lib= lib->id.next;
- }
-
- /* make local */
- if(lib) {
- if((simasel->flag & FILE_LINK)==0)
- all_local(lib,1);
- }
-
- DAG_scene_sort(G.scene);
-
- /* in sfile->dir is the whole lib name */
- BLI_strncpy(G.lib, simasel->dir, sizeof(G.lib) );
-
- }
-}
-
-/* NOTE: this is called for file read, after the execfunc no UI memory is valid! */
-static void imasel_execute(SpaceImaSel *simasel)
-{
- struct direntry *file;
- char name[FILE_MAX];
- int a;
- int n;
-
- imasel_prevspace();
-
- if(simasel->type==FILE_LOADLIB) {
- if(simasel->flag & FILE_STRINGCODE) {
- if (!G.relbase_valid) {
- okee("You have to save the .blend file before using relative paths! Using absolute path instead.");
- simasel->flag &= ~FILE_STRINGCODE;
- }
- }
-
- do_library_append(simasel);
- BIF_undo_push("Append from file");
- allqueue(REDRAWALL, 1);
- }
- else if(imasel_has_func(simasel)) {
- fsmenu_insert_entry(simasel->dir, 1, 0);
-
- if(simasel->type==FILE_MAIN) { /* DATABROWSE */
- if (simasel->menup) { /* with value pointing to ID block index */
- int notfound = 1;
-
- /* Need special handling since hiding .* datablocks means that
- simasel->active_file is no longer the same as files->nr.
-
- Also, toggle HIDE_DOT on and off can make simasel->active_file not longer
- correct (meaning it doesn't point to the correct item in the filelist.
-
- simasel->file is always correct, so first with check if, for the item
- corresponding to simasel->active_file, the name is the same.
-
- If it isn't (or if simasel->active_file is not good), go over filelist and take
- the correct one.
-
- This means that selecting a datablock than hiding it makes it
- unselectable. Not really a problem.
-
- - theeth
- */
-
- *simasel->menup= -1;
- n = BIF_filelist_numfiles(simasel->files);
- if(simasel->files) {
- if( (simasel->active_file>=0) && (simasel->active_file < n) ) {
- file = BIF_filelist_file(simasel->files, simasel->active_file);
- if ( strcmp(file->relname, simasel->file)==0) {
- notfound = 0;
- *simasel->menup= file->nr;
- }
- }
- if (notfound) {
- for(a=0; a<n; a++) {
- file = BIF_filelist_file(simasel->files, a);
- if( strcmp(file->relname, simasel->file)==0) {
- *simasel->menup= file->nr;
- break;
- }
- }
- }
- }
- }
- if(simasel->returnfunc_event)
- simasel->returnfunc_event(simasel->retval);
- else if(simasel->returnfunc_args)
- simasel->returnfunc_args(NULL, simasel->arg1, simasel->arg2);
- }
- else {
- if(strncmp(simasel->title, "Save", 4)==0) free_imasel_spec(simasel->dir);
- if(strncmp(simasel->title, "Export", 6)==0) free_imasel_spec(simasel->dir);
-
- BLI_strncpy(name, simasel->dir, sizeof(name));
- strcat(name, simasel->file);
-
- if(simasel->flag & FILE_STRINGCODE) {
- /* still weak, but we don't want saving files to make relative paths */
- if(G.relbase_valid && strncmp(simasel->title, "Save", 4)) {
- BLI_makestringcode(G.sce, name);
- } else {
- /* if we don't have a valid relative base (.blend file hasn't been saved yet)
- then we don't save the path as relative (for texture images, background image).
- Warning message not shown when saving files (doesn't make sense there)
- */
- if (strncmp(simasel->title, "Save", 4)) {
- printf("Relative path setting has been ignored because .blend file hasn't been saved yet.\n");
- }
- simasel->flag &= ~FILE_STRINGCODE;
- }
- }
- if(simasel->returnfunc)
- simasel->returnfunc(name);
- else if(simasel->returnfunc_args)
- simasel->returnfunc_args(name, simasel->arg1, simasel->arg2);
- }
- }
-}
-
-static void do_imasel_buttons(short event, SpaceImaSel *simasel)
-{
- char butname[FILE_MAX];
-
- if (event == B_FS_FILENAME) {
- if (strchr(simasel->file, '*') || strchr(simasel->file, '?') || strchr(simasel->file, '[')) {
- int i, match = FALSE;
- struct direntry *file;
- int n = BIF_filelist_numfiles(simasel->files);
- for (i = 2; i < n; i++) {
- file = BIF_filelist_file(simasel->files, i);
- if (fnmatch(simasel->file, file->relname, 0) == 0) {
- file->flags |= ACTIVE;
- match = TRUE;
- }
- }
- if (match) simasel->file[0] = '\0';
- if(simasel->type==FILE_MAIN) imasel_select_objects(simasel);
- scrarea_queue_winredraw(curarea);
- }
- }
- else if(event== B_FS_DIRNAME) {
- /* reuse the butname variable */
- BLI_cleanup_dir(G.sce, simasel->dir);
-
- BLI_make_file_string(G.sce, butname, simasel->dir, "");
- BLI_strncpy(simasel->dir, butname, sizeof(simasel->dir));
-
- /* strip the trailing slash if its a real dir */
- if (strlen(butname)!=1)
- butname[strlen(butname)-1]=0;
-
- /* updating the directory in the filelist */
- BIF_filelist_setdir(simasel->files, simasel->dir);
-
- if(simasel->type & FILE_UNIX) {
- if (!BLI_exists(butname)) {
- if (okee("Makedir")) {
- BLI_recurdir_fileops(butname);
- if (!BLI_exists(butname)) {
- BIF_filelist_free(simasel->files);
- BIF_filelist_parent(simasel->files);
- BLI_strncpy(simasel->dir, BIF_filelist_dir(simasel->files), 80);
- }
- } else {
- BIF_filelist_free(simasel->files);
- BIF_filelist_parent(simasel->files);
- BLI_strncpy(simasel->dir, BIF_filelist_dir(simasel->files), 80);
- }
- }
- }
- BIF_filelist_free(simasel->files);
- simasel->file[0] = '\0';
- simasel->scrollpos = 0;
- simasel->active_file = -1;
- scrarea_queue_winredraw(curarea);
- }
- else if(event== B_FS_DIR_MENU) {
- char *selected= fsmenu_get_entry(simasel->menu-1);
-
- /* which string */
- if (selected) {
- BLI_strncpy(simasel->dir, selected, sizeof(simasel->dir));
- BLI_make_exist(simasel->dir);
- BLI_cleanup_dir(G.sce, simasel->dir);
- BIF_filelist_free(simasel->files);
- BIF_filelist_setdir(simasel->files, simasel->dir);
- simasel->file[0] = '\0';
- simasel->scrollpos = 0;
- simasel->active_file = -1;
- scrarea_queue_redraw(curarea);
- }
-
- simasel->active_file = -1;
-
- }
- else if(event== B_FS_PARDIR) {
- BIF_filelist_free(simasel->files);
- BIF_filelist_parent(simasel->files);
- BLI_strncpy(simasel->dir, BIF_filelist_dir(simasel->files), 80);
- simasel->file[0] = '\0';
- simasel->active_file = -1;
- simasel->scrollpos = 0;
- scrarea_queue_redraw(curarea);
- }
- else if(event== B_FS_LOAD) {
- if(simasel->type)
- imasel_execute(simasel);
- }
- else if(event== B_FS_CANCEL)
- imasel_prevspace();
- else if(event== B_FS_LIBNAME) {
- Library *lib= BLI_findlink(&G.main->library, simasel->menu);
- if(lib) {
- BLI_strncpy(simasel->dir, lib->filename, sizeof(simasel->dir));
- BLI_make_exist(simasel->dir);
- BLI_cleanup_dir(G.sce, simasel->dir);
- BIF_filelist_free(simasel->files);
- BIF_filelist_setdir(simasel->files, simasel->dir);
- simasel->file[0] = '\0';
- simasel->scrollpos = 0;
- simasel->active_file = -1;
- scrarea_queue_winredraw(curarea);
- }
- } else if(event== B_FS_BOOKMARK) {
- char name[FILE_MAX];
- BLI_make_file_string(G.sce, name, BLI_gethome(), ".Bfs");
- fsmenu_insert_entry(simasel->dir, 1, 1);
- scrarea_queue_winredraw(curarea);
- fsmenu_write_file(name);
- }
-
-}
-
-static void imasel_home(ScrArea *sa, SpaceImaSel *simasel)
-{
- simasel->v2d.cur.xmin= simasel->v2d.cur.ymin= 0.0f;
- simasel->v2d.cur.xmax= sa->winx;
- simasel->v2d.cur.ymax= sa->winy;
-
- simasel->v2d.tot= simasel->v2d.cur;
- test_view2d(G.v2d, sa->winx, sa->winy);
-
-}
-
-static struct direntry* get_hilited_entry(SpaceImaSel *simasel)
-{
- struct direntry *file;
- file = BIF_filelist_file(simasel->files, simasel->active_file);
- return file;
-}
-
-static void do_filescroll(SpaceImaSel *simasel)
-{
- short mval[2], oldy, yo;
- float scrollarea, scrollstep;
-
- /* for beauty */
- scrarea_do_windraw(curarea);
- screen_swapbuffers();
-
- getmouseco_areawin(mval);
- oldy= yo= mval[1];
-
- while(get_mbut()&L_MOUSE) {
- getmouseco_areawin(mval);
-
- if(yo!=mval[1]) {
- scrollarea = ((float)simasel->v2d.vert.ymax - (float)simasel->v2d.vert.ymin);
- scrollstep = yo - mval[1];
- simasel->scrollpos += scrollstep;
-
- if (simasel->scrollpos<0)
- simasel->scrollpos=0;
- if (simasel->scrollpos > scrollarea - simasel->scrollheight)
- simasel->scrollpos = scrollarea - simasel->scrollheight;
- scrarea_do_windraw(curarea);
- screen_swapbuffers();
-
- yo= mval[1];
- }
- else BIF_wait_for_statechange();
- }
-
- /* for beauty */
- scrarea_do_windraw(curarea);
- screen_swapbuffers();
-
-}
-
-/* ******************* DATA SELECT ********************* */
-
-static void imasel_select_objects(SpaceImaSel *simasel)
-{
- Object *ob;
- Base *base;
- Scene *sce;
- struct direntry* file;
- int a;
- int totfile;
-
- /* only when F4 DATABROWSE */
- if(imasel_has_func(simasel)) return;
-
- totfile = BIF_filelist_numfiles(simasel->files);
-
- if( strcmp(simasel->dir, "Object/")==0 ) {
- for(a=0; a<totfile; a++) {
- file = BIF_filelist_file(simasel->files, a);
- ob= (Object *)file->poin;
-
- if(ob) {
- if(file->flags & ACTIVE) ob->flag |= SELECT;
- else ob->flag &= ~SELECT;
- }
-
- }
- base= FIRSTBASE;
- while(base) {
- base->flag= base->object->flag;
- base= base->next;
- }
- countall();
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWOOPS, 0);
- }
- else if( strcmp(simasel->dir, "Scene/")==0 ) {
-
- for(a=0; a<totfile; a++) {
- file = BIF_filelist_file(simasel->files, a);
- sce= (Scene *)file->poin;
- if(sce) {
- if(file->flags & ACTIVE) sce->r.scemode |= R_BG_RENDER;
- else sce->r.scemode &= ~R_BG_RENDER;
- }
-
- }
- allqueue(REDRAWBUTSSCENE, 0);
- }
-}
-
-static void active_imasel_object(SpaceImaSel *simasel)
-{
- Object *ob;
- struct direntry* file;
-
- /* only when F4 DATABROWSE */
- if(imasel_has_func(simasel)) return;
-
- if( strcmp(simasel->dir, "Object/")==0 ) {
- int n = BIF_filelist_numfiles(simasel->files);
- if(simasel->active_file >= 0 && simasel->active_file < n) {
- file = BIF_filelist_file(simasel->files, simasel->active_file);
- ob= (Object *)file->poin;
-
- if(ob) {
- set_active_object(ob);
- if(BASACT && BASACT->object==ob) {
- BASACT->flag |= SELECT;
- file->flags |= ACTIVE;
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWOOPS, 0);
- scrarea_queue_winredraw(curarea);
- }
- }
- }
- }
-}
-
-
-
-void winqreadimaselspace(ScrArea *, void *, BWinEvent *);
-
-
-void winqreadimaselspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
-{
- unsigned short event= evt->event;
- short val= evt->val;
- SpaceImaSel *simasel;
-
- char str[FILE_MAXDIR+FILE_MAXFILE+12];
- short mval[2];
- short do_draw = 0;
- short do_headdraw = 0;
- int numfiles;
- struct direntry *file;
- float scrollstep = 0;
- float scrollarea;
-
- // if(val==0) return;
- simasel= curarea->spacedata.first;
-
- if (!simasel->files)
- return;
-
- if (BIF_filelist_empty(simasel->files))
- return;
-
- numfiles = BIF_filelist_numfiles(simasel->files);
-
- /* calc_scrollrcts(sa, &(simasel->v2d), sa->winx, sa->winy); */
- calc_imasel_rcts(simasel, sa->winx, sa->winy);
-
- /* prevent looping */
- if(simasel->selstate && !(get_mbut() & R_MOUSE)) simasel->selstate= 0;
-
- if(val) {
-
- if( event!=RETKEY && event!=PADENTER)
- if( uiDoBlocks(&curarea->uiblocks, event, 1)!=UI_NOTHING ) event= 0;
-
- switch(event) {
-
- case UI_BUT_EVENT:
- do_imasel_buttons(val, simasel);
- break;
- case RENDERPREVIEW:
- do_draw= 1;
- /* draw_imasel_previews(sa, simasel); */
- break;
- case REDRAWIMASEL:
- do_draw= 1;
- break;
- case WHEELDOWNMOUSE:
- numfiles = BIF_filelist_numfiles(simasel->files);
- scrollarea = ((float)simasel->v2d.vert.ymax - (float)simasel->v2d.vert.ymin);
- scrollstep = ((scrollarea-simasel->scrollheight)/numfiles)*simasel->numtilesx;
- simasel->scrollpos += scrollstep;
- if (simasel->scrollpos > scrollarea - simasel->scrollheight)
- simasel->scrollpos = scrollarea - simasel->scrollheight;
- do_draw= 1;
- break;
- case WHEELUPMOUSE:
- numfiles = BIF_filelist_numfiles(simasel->files);
- scrollarea = ((float)simasel->v2d.vert.ymax - (float)simasel->v2d.vert.ymin);
- scrollstep = ((scrollarea-simasel->scrollheight)/numfiles)*simasel->numtilesx;
- simasel->scrollpos -= scrollstep;
- if (simasel->scrollpos<0)
- simasel->scrollpos=0;
- do_draw= 1;
- break;
- case PAGEUPKEY:
- numfiles = BIF_filelist_numfiles(simasel->files);
- scrollarea = ((float)simasel->v2d.vert.ymax - (float)simasel->v2d.vert.ymin);
- scrollstep = ((scrollarea-simasel->scrollheight)/numfiles)
- *simasel->numtilesx*simasel->numtilesy;
- simasel->scrollpos -= scrollstep;
- if (simasel->scrollpos<0)
- simasel->scrollpos=0;
- do_draw= 1;
- break;
- case PAGEDOWNKEY:
- numfiles = BIF_filelist_numfiles(simasel->files);
- scrollarea = ((float)simasel->v2d.vert.ymax - (float)simasel->v2d.vert.ymin);
- scrollstep = ((scrollarea-simasel->scrollheight)/numfiles)
- * simasel->numtilesx*simasel->numtilesy;
- simasel->scrollpos += scrollstep;
- if (simasel->scrollpos > scrollarea - simasel->scrollheight)
- simasel->scrollpos = scrollarea - simasel->scrollheight;
- do_draw= 1;
- break;
- case HOMEKEY:
- simasel->scrollpos=0;
- imasel_home(sa, simasel);
- do_draw= 1;
- break;
- case ENDKEY:
- simasel->scrollpos = simasel->scrollarea;
- do_draw= 1;
- break;
-
- case ESCKEY:
- BIF_filelist_free(simasel->files);
- imasel_prevspace();
- break;
- case PERIODKEY:
- BIF_filelist_free(simasel->files);
- simasel->active_file = -1;
- do_draw = 1;
- break;
- case LEFTMOUSE:
- case MIDDLEMOUSE:
- getmouseco_areawin(mval);
- if(mval[0]>simasel->v2d.vert.xmin && mval[0]<simasel->v2d.vert.xmax && mval[1]>simasel->v2d.vert.ymin && mval[1]<simasel->v2d.vert.ymax) {
- do_filescroll(simasel);
- }
- else if(mval[0]>simasel->viewrect.xmin && mval[0]<simasel->viewrect.xmax
- && mval[1]>simasel->viewrect.ymin && mval[1]<simasel->viewrect.ymax) {
- set_active_file(simasel, mval[0], mval[1]);
- if (simasel->active_file >= 0 && simasel->active_file < numfiles) {
- file = BIF_filelist_file(simasel->files, simasel->active_file);
-
- if(file && S_ISDIR(file->type)) {
- strcat(simasel->dir, file->relname);
- strcat(simasel->dir,"/");
- simasel->file[0] = '\0';
- BLI_cleanup_dir(G.sce, simasel->dir);
- BIF_filelist_setdir(simasel->files, simasel->dir);
- BIF_filelist_free(simasel->files);
- simasel->active_file = -1;
- simasel->scrollpos = 0;
- do_draw = 1;
- do_headdraw = 1;
- }
- else if (file)
- {
- if (file->relname) {
- if (simasel->img) {
- IMB_freeImBuf(simasel->img);
- simasel->img = NULL;
- }
- BLI_strncpy(simasel->file, file->relname, FILE_MAXFILE);
- if(event==MIDDLEMOUSE && BIF_filelist_gettype(simasel->files))
- imasel_execute(simasel);
- }
-
- }
- if(BIF_filelist_gettype(simasel->files)==FILE_MAIN) {
- active_imasel_object(simasel);
- }
-
- do_draw = 1;
- }
- }
- else {
- simasel->active_file = -1;
- if (simasel->flag & FILE_BOOKMARKS) {
- if(mval[0]>simasel->bookmarkrect.xmin && mval[0]<simasel->bookmarkrect.xmax && mval[1]>simasel->bookmarkrect.ymin && mval[1]<simasel->bookmarkrect.ymax) {
- int nentries = fsmenu_get_nentries();
-
- set_active_bookmark(simasel, mval[1]);
- if (simasel->active_bookmark >= 0 && simasel->active_bookmark < nentries) {
- char *selected= fsmenu_get_entry(simasel->active_bookmark);
- /* which string */
- if (selected) {
- BLI_strncpy(simasel->dir, selected, sizeof(simasel->dir));
- BLI_make_exist(simasel->dir);
- BLI_cleanup_dir(G.sce, simasel->dir);
- BIF_filelist_free(simasel->files);
- BIF_filelist_setdir(simasel->files, simasel->dir);
- simasel->file[0] = '\0';
- simasel->scrollpos = 0;
- simasel->active_file = -1;
- do_headdraw = 1;
- }
- }
- } else {
- simasel->active_bookmark = -1;
- }
- do_draw= 1;
- }
- }
- break;
- case RIGHTMOUSE:
- getmouseco_areawin(mval);
- if(mval[0]>simasel->viewrect.xmin && mval[0]<simasel->viewrect.xmax
- && mval[1]>simasel->viewrect.ymin && mval[1]<simasel->viewrect.ymax) {
- set_active_file(simasel, mval[0], mval[1]);
- if(simasel->active_file >=0 && simasel->active_file<numfiles) {
- simasel->selstate = NOTACTIVE;
- file = BIF_filelist_file(simasel->files, simasel->active_file);
- if (file->flags & ACTIVE) {
- file->flags &= ~ACTIVE;
- simasel->selstate = INACTIVATE;
- }
- else {
- file->flags |= ACTIVE;
- simasel->selstate = ACTIVATE;
- }
- do_draw= 1;
- }
- }
- break;
- case MOUSEY:
- case MOUSEX:
- getmouseco_areawin(mval);
- if(mval[0]>simasel->viewrect.xmin && mval[0]<simasel->viewrect.xmax && mval[1]>simasel->viewrect.ymin && mval[1]<simasel->viewrect.ymax) {
- set_active_file(simasel, mval[0], mval[1]);
- simasel->active_bookmark = -1;
- if(simasel->active_file >=0 && simasel->active_file<numfiles) {
- file = BIF_filelist_file(simasel->files, simasel->active_file);
- if (simasel->selstate == INACTIVATE) {
- file->flags &= ~ACTIVE;
- }
- else if (simasel->selstate == ACTIVATE) {
- file->flags |= ACTIVE;
- }
- do_draw= 1;
- }
- } else {
- simasel->active_file = -1;
- if (simasel->flag & FILE_BOOKMARKS) {
- if(mval[0]>simasel->bookmarkrect.xmin && mval[0]<simasel->bookmarkrect.xmax && mval[1]>simasel->bookmarkrect.ymin && mval[1]<simasel->bookmarkrect.ymax) {
- set_active_bookmark(simasel, mval[1]);
- } else {
- simasel->active_bookmark = -1;
- }
- do_draw= 1;
- }
- }
- break;
- case AKEY:
- BIF_filelist_swapselect(simasel->files);
- if(simasel->type==FILE_MAIN) imasel_select_objects(simasel);
- do_draw= 1;
- break;
- case BKEY:
- toggle_blockhandler(sa, IMASEL_HANDLER_IMAGE, UI_PNL_UNSTOW);
- scrarea_queue_winredraw(sa);
- break;
- case PKEY:
- if(G.qual & LR_SHIFTKEY) {
- extern char bprogname[]; /* usiblender.c */
-
- sprintf(str, "%s -a \"%s%s\"", bprogname, simasel->dir, simasel->file);
- system(str);
- }
- else
- {
- BIF_filelist_free(simasel->files);
- BIF_filelist_parent(simasel->files);
- BLI_strncpy(simasel->dir, BIF_filelist_dir(simasel->files), 80);
- simasel->file[0] = '\0';
- simasel->active_file = -1;
- simasel->scrollpos = 0;
- do_headdraw = 1;
- }
- do_draw = 1;
- break;
- case XKEY:
- getmouseco_areawin(mval);
- if (simasel->flag & FILE_BOOKMARKS) {
- if(mval[0]>simasel->bookmarkrect.xmin && mval[0]<simasel->bookmarkrect.xmax && mval[1]>simasel->bookmarkrect.ymin && mval[1]<simasel->bookmarkrect.ymax) {
- int nentries = fsmenu_get_nentries();
- set_active_bookmark(simasel, mval[1]);
- if (simasel->active_bookmark >= 0 && simasel->active_bookmark < nentries) {
- char name[FILE_MAX];
- BLI_make_file_string(G.sce, name, BLI_gethome(), ".Bfs");
- fsmenu_remove_entry(simasel->active_bookmark);
- fsmenu_write_file(name);
- simasel->active_bookmark = -1;
- do_draw = 1;
- }
- }
- }
- break;
- }
- }
- else if(event==RIGHTMOUSE) {
- simasel->selstate = NOTACTIVE;
- if(simasel->type==FILE_MAIN) imasel_select_objects(simasel);
- }
- else if(event==LEFTMOUSE) {
- if(simasel->type==FILE_MAIN) {
- getmouseco_areawin(mval);
- set_active_file(simasel, mval[0], mval[1]);
- }
- }
- /* XXX, stupid patch, curarea can become undone
- * because of file loading... fixme zr
- */
- if(curarea) {
- if(do_draw) scrarea_queue_winredraw(curarea);
- if(do_headdraw) scrarea_queue_headredraw(curarea);
- }
-}
-
-
-/* copied from filesel.c */
-void clever_numbuts_imasel()
-{
- SpaceImaSel *simasel;
- char orgname[FILE_MAXDIR+FILE_MAXFILE+12];
- char filename[FILE_MAXDIR+FILE_MAXFILE+12];
- char newname[FILE_MAXDIR+FILE_MAXFILE+12];
- struct direntry *file;
- int len;
-
- simasel= curarea->spacedata.first;
-
- if(BIF_filelist_gettype(simasel->files)==FILE_MAIN) return;
-
- len = 110;
- file = get_hilited_entry(simasel);
-
- if (file != NULL && !(S_ISDIR(file->type))){
-
- BLI_make_file_string(G.sce, orgname, simasel->dir, file->relname);
- BLI_strncpy(filename, file->relname, sizeof(filename));
-
- add_numbut(0, TEX, "", 0, len, filename, "Rename File");
-
- if( do_clever_numbuts("Rename File", 1, REDRAW) ) {
- BLI_make_file_string(G.sce, newname, simasel->dir, filename);
-
- if( strcmp(orgname, newname) != 0 ) {
- BLI_rename(orgname, newname);
- BIF_filelist_free(simasel->files);
- }
- }
-
- scrarea_queue_winredraw(curarea);
- }
-}
diff --git a/source/blender/src/editipo.c b/source/blender/src/editipo.c
deleted file mode 100644
index 54aea493e88..00000000000
--- a/source/blender/src/editipo.c
+++ /dev/null
@@ -1,5790 +0,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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2005. Full recode.
- * Roland Hess, 2007. Visual Key refactor.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-
-/* this code feels over-complex, mostly because I choose in the past to devise a system
- that converts the Ipo blocks (linked to Object, Material, etc), into a copy of that
- data which is being worked on; the 'editipo'.
- The editipo then can have 'ipokey' data, which is optimized for editing curves as if
- it were key positions. This is still a great feature to work with, which makes ipo editing
- in Blender still valuable. However, getting this beast under control was hard, even
- for me... (ton) */
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#ifndef WIN32
-#include <unistd.h>
-#else
-#include <io.h>
-#endif
-#include "MEM_guardedalloc.h"
-#include "PIL_time.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "DNA_constraint_types.h"
-#include "DNA_action_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_group_types.h"
-#include "DNA_ipo_types.h"
-#include "DNA_key_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_material_types.h"
-#include "DNA_object_types.h"
-#include "DNA_object_fluidsim.h"
-#include "DNA_particle_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_space_types.h"
-#include "DNA_sequence_types.h"
-#include "DNA_sound_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_world_types.h"
-
-#include "BKE_action.h"
-#include "BKE_armature.h"
-#include "BKE_anim.h"
-#include "BKE_constraint.h"
-#include "BKE_depsgraph.h"
-#include "BKE_global.h"
-#include "BKE_group.h"
-#include "BKE_ipo.h"
-#include "BKE_key.h"
-#include "BKE_material.h"
-#include "BKE_particle.h"
-#include "BKE_texture.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_butspace.h"
-#include "BIF_editaction.h"
-#include "BIF_editconstraint.h"
-#include "BIF_editkey.h"
-#include "BIF_editnla.h"
-#include "BIF_editseq.h"
-#include "BIF_editview.h"
-#include "BIF_interface.h"
-#include "BIF_mywindow.h"
-#include "BIF_poseobject.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-#include "BIF_poseobject.h"
-
-#include "BDR_drawobject.h"
-#include "BDR_editobject.h"
-#include "BDR_editcurve.h" // for bezt_compare
-
-#include "BSE_trans_types.h"
-#include "BSE_editipo_types.h"
-#include "BSE_drawipo.h"
-#include "BSE_editipo.h"
-#include "BSE_edit.h"
-#include "BSE_drawview.h"
-#include "BSE_headerbuttons.h"
-#include "BSE_node.h"
-#include "BSE_sequence.h"
-#include "BSE_time.h"
-
-#include "blendef.h"
-#include "mydevice.h"
-#include "transform.h"
-
-extern int ob_ar[];
-extern int ma_ar[];
-extern int seq_ar[];
-extern int cu_ar[];
-extern int wo_ar[];
-extern int la_ar[];
-extern int cam_ar[];
-extern int snd_ar[];
-extern int ac_ar[];
-extern int co_ar[];
-extern int te_ar[];
-extern int fluidsim_ar[]; // NT
-extern int part_ar[];
-
-/* forwards */
-#define IPOTHRESH 0.9
-
-/* tests if only one editipo is active */
-static void check_active_editipo(void)
-{
- EditIpo *ei, *actei;
- int a;
-
- actei= G.sipo->editipo;
- if(actei) {
- for(a=0; a<G.sipo->totipo; a++, actei++) {
- if(actei->flag & IPO_ACTIVE)
- break;
- }
- if(actei==NULL) {
- /* set visible active */
- for(a=0, ei=G.sipo->editipo; a<G.sipo->totipo; a++, ei++) {
- if(ei->flag & IPO_VISIBLE)
- break;
- }
- if(ei==NULL) ei=G.sipo->editipo;
- ei->flag |= IPO_ACTIVE;
- if(ei->icu) ei->icu->flag |= IPO_ACTIVE;
- }
- else {
- /* make sure no others are active */
- for(a=0, ei=G.sipo->editipo; a<G.sipo->totipo; a++, ei++) {
- if(ei!=actei) {
- ei->flag &= ~IPO_ACTIVE;
- if(ei->icu) ei->icu->flag &= ~IPO_ACTIVE;
- }
- }
- }
- }
-}
-
-/* sets this ei channel active */
-static void set_active_editipo(EditIpo *actei)
-{
- EditIpo *ei;
- int a;
-
- for(a=0, ei=G.sipo->editipo; a<G.sipo->totipo; a++, ei++) {
- ei->flag &= ~IPO_ACTIVE;
- if(ei->icu) ei->icu->flag &= ~IPO_ACTIVE;
- }
- actei->flag |= IPO_ACTIVE;
- if(actei->icu) actei->icu->flag |= IPO_ACTIVE;
-}
-
-EditIpo *get_active_editipo(void)
-{
- EditIpo *ei;
- int a;
-
- if(G.sipo==NULL)
- return NULL;
-
- /* prevent confusing situations, like for sequencer */
- if(G.sipo->totipo==1) {
- ei= G.sipo->editipo;
- ei->flag |= IPO_ACTIVE;
- return ei;
- }
- for(a=0, ei=G.sipo->editipo; a<G.sipo->totipo; a++, ei++)
- if(ei->flag & IPO_ACTIVE)
- return ei;
-
- return NULL;
-}
-
-static void set_active_key(int index)
-{
- if(G.sipo->blocktype==ID_KE && G.sipo->from) {
- Object *ob= (Object *)G.sipo->from;
- Key *key= ob_get_key(ob);
-
- if(key) {
- KeyBlock *curkb;
-
- curkb= BLI_findlink(&key->block, index-1);
- if(curkb) {
- ob->shapenr= index;
- ob->shapeflag |= OB_SHAPE_TEMPLOCK;
-
- /* calc keypos */
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- }
- }
- }
-}
-
-void editipo_changed(SpaceIpo *si, int doredraw)
-{
- EditIpo *ei;
- View2D *v2d;
- Key *key;
- KeyBlock *kb;
- int a, first=1;
-
- ei= si->editipo;
- if(ei==0)
- return;
-
- for(a=0; a<si->totipo; a++, ei++) {
-
- if(ei->icu) {
-
- /* twice because of ittererating new autohandle */
- calchandles_ipocurve(ei->icu);
- calchandles_ipocurve(ei->icu);
-
- if(ei->flag & IPO_VISIBLE) {
-
- boundbox_ipocurve(ei->icu, 0);
- sort_time_ipocurve(ei->icu);
- if(first) {
- si->v2d.tot= ei->icu->totrct;
- first= 0;
- }
- else BLI_union_rctf(&(si->v2d.tot), &(ei->icu->totrct));
- }
- }
- }
-
-
- v2d= &(si->v2d);
-
- /* keylines? */
- if(si->blocktype==ID_KE) {
- key= ob_get_key((Object *)G.sipo->from);
- if(key && key->block.first) {
- kb= key->block.first;
- if(kb->pos < v2d->tot.ymin) v2d->tot.ymin= kb->pos;
- kb= key->block.last;
- if(kb->pos > v2d->tot.ymax) v2d->tot.ymax= kb->pos;
- }
- }
-
- /* is there no curve? */
- if(first) {
- v2d->tot.xmin= 0.0;
- v2d->tot.xmax= EFRA;
- v2d->tot.ymin= (float)-0.1;
- v2d->tot.ymax= (float)1.1;
-
- if(si->blocktype==ID_SEQ) {
- v2d->tot.xmin= -5.0;
- v2d->tot.xmax= 105.0;
- v2d->tot.ymin= (float)-0.1;
- v2d->tot.ymax= (float)1.1;
- }
- }
-
- si->tot= v2d->tot;
-
- if(doredraw) {
- /* if you always call do_ipo: you get problems with insertkey, for example
- * when inserting only a 'loc' the 'ob->rot' value then is changed.
- */
-
- if(si->blocktype==ID_OB) {
- /* clear delta loc,rot,size (when free/delete ipo) */
- clear_delta_obipo(si->ipo);
-
- }
-
- do_ipo(si->ipo);
-
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWTIME, 0);
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
-
- if(si->blocktype==ID_OB) {
- Object *ob= (Object *)si->from;
- if(ob) DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWNLA, 0);
- }
-
- else if(si->blocktype==ID_MA) allqueue(REDRAWBUTSSHADING, 0);
- else if(si->blocktype==ID_TE) allqueue(REDRAWBUTSSHADING, 0);
- else if(si->blocktype==ID_WO) allqueue(REDRAWBUTSSHADING, 0);
- else if(si->blocktype==ID_LA) allqueue(REDRAWBUTSSHADING, 0);
-// else if(si->blocktype==ID_SO) allqueue(REDRAWBUTSSOUND, 0);
- else if(si->blocktype==ID_CA) {
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWVIEW3D, 0);
- }
- else if(si->blocktype==ID_SEQ) free_imbuf_seq_with_ipo(si->ipo);
- else if(si->blocktype==ID_PO) {
- Object *ob= OBACT;
- if(ob && ob->pose) {
- DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
- }
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- }
- else if(si->blocktype==ID_KE) {
- DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- }
- else if(si->blocktype==ID_CU) {
- DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- }
- else if(si->blocktype==ID_PA){
- Object *ob=OBACT;
- ParticleSystem *psys = ob->particlesystem.first;
-
- /* find out if we need to initialize particles */
- for(; psys; psys=psys->next) {
- if(psys->part->ipo==si->ipo) {
- ei= si->editipo;
- for(a=0; a<si->totipo; a++, ei++)
- if(ei->icu && ELEM3(ei->icu->adrcode,PART_EMIT_FREQ,PART_EMIT_LIFE,PART_EMIT_SIZE))
- psys_flush_settings(psys->part,PSYS_INIT,1);
- }
- }
- DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- }
- }
-
- if(si->showkey) make_ipokey();
-
- if(si->actname[0])
- synchronize_action_strips();
-}
-
-void scale_editipo(void)
-{
- /* comes from buttons, scale with G.sipo->tot rect */
-
- EditIpo *ei;
- BezTriple *bezt;
- float facx, facy;
- int a, b;
-
- facx= (G.sipo->tot.xmax-G.sipo->tot.xmin)/(G.sipo->v2d.tot.xmax-G.sipo->v2d.tot.xmin);
- facy= (G.sipo->tot.ymax-G.sipo->tot.ymin)/(G.sipo->v2d.tot.ymax-G.sipo->v2d.tot.ymin);
-
- ei= G.sipo->editipo;
- if(ei==0) return;
- for(a=0; a<G.sipo->totipo; a++, ei++) {
- if (ISPOIN(ei, flag & IPO_VISIBLE, icu)) {
- bezt= ei->icu->bezt;
- b= ei->icu->totvert;
- while(b--) {
-
- bezt->vec[0][0]= facx*(bezt->vec[0][0] - G.sipo->v2d.tot.xmin) + G.sipo->tot.xmin;
- bezt->vec[1][0]= facx*(bezt->vec[1][0] - G.sipo->v2d.tot.xmin) + G.sipo->tot.xmin;
- bezt->vec[2][0]= facx*(bezt->vec[2][0] - G.sipo->v2d.tot.xmin) + G.sipo->tot.xmin;
-
- bezt->vec[0][1]= facy*(bezt->vec[0][1] - G.sipo->v2d.tot.ymin) + G.sipo->tot.ymin;
- bezt->vec[1][1]= facy*(bezt->vec[1][1] - G.sipo->v2d.tot.ymin) + G.sipo->tot.ymin;
- bezt->vec[2][1]= facy*(bezt->vec[2][1] - G.sipo->v2d.tot.ymin) + G.sipo->tot.ymin;
-
- bezt++;
- }
- }
- }
-
- editipo_changed(G.sipo, 1);
-
- BIF_undo_push("Scale Edit Ipo");
- allqueue(REDRAWNLA, 0);
- allqueue (REDRAWACTION, 0);
- allqueue(REDRAWIPO, 0);
-}
-
-static void make_ob_editipo(Object *ob, SpaceIpo *si)
-{
- EditIpo *ei;
- int a, len, colipo=0;
- char *name;
-
- if(ob->type==OB_MESH) colipo= 1;
-
- ei= si->editipo= MEM_callocN(OB_TOTIPO*sizeof(EditIpo), "editipo");
-
- si->totipo= OB_TOTIPO;
-
- for(a=0; a<OB_TOTIPO; a++) {
- name = getname_ob_ei(ob_ar[a], colipo);
- strcpy(ei->name, name);
- ei->adrcode= ob_ar[a];
-
- if ELEM6(ei->adrcode, OB_ROT_X, OB_ROT_Y, OB_ROT_Z, OB_DROT_X, OB_DROT_Y, OB_DROT_Z) ei->disptype= IPO_DISPDEGR;
- else if(ei->adrcode==OB_LAY) ei->disptype= IPO_DISPBITS;
- else if(ei->adrcode==OB_TIME) ei->disptype= IPO_DISPTIME;
-
- ei->col= ipo_rainbow(a, OB_TOTIPO);
-
- if(colipo) {
- len= strlen(ei->name);
- if(len) {
- if( ei->name[ len-1 ]=='R') ei->col= 0x5050FF;
- else if( ei->name[ len-1 ]=='G') ei->col= 0x50FF50;
- else if( ei->name[ len-1 ]=='B') ei->col= 0xFF7050;
- }
- }
-
- ei->icu= find_ipocurve(si->ipo, ei->adrcode);
- if(ei->icu) {
- ei->flag= ei->icu->flag;
- }
-
-
- ei++;
- }
- //fprintf(stderr,"FSIMAKE_OPBJ call %d \n", si->totipo);
-}
-
-static void make_part_editipo(SpaceIpo *si)
-{
- EditIpo *ei;
- int a;
- char *name;
-
- if(si->from==0) return;
-
- ei= si->editipo= MEM_callocN(PART_TOTIPO*sizeof(EditIpo), "editipo");
-
- si->totipo= PART_TOTIPO;
-
- for(a=0; a<PART_TOTIPO; a++) {
- name = getname_part_ei(part_ar[a]);
- strcpy(ei->name, name);
- ei->adrcode= part_ar[a];
-
- //if(ei->adrcode & MA_MAP1) {
- // ei->adrcode-= MA_MAP1;
- // ei->adrcode |= texchannel_to_adrcode(si->channel);
- //}
- //else {
- // if(ei->adrcode==MA_MODE) ei->disptype= IPO_DISPBITS;
- //}
-
- ei->col= ipo_rainbow(a, PART_TOTIPO);
-
- //len= strlen(ei->name);
- //if(len) {
- // if( ei->name[ len-1 ]=='R') ei->col= 0x5050FF;
- // else if( ei->name[ len-1 ]=='G') ei->col= 0x50FF50;
- // else if( ei->name[ len-1 ]=='B') ei->col= 0xFF7050;
- //}
-
- ei->icu= find_ipocurve(si->ipo, ei->adrcode);
- if(ei->icu) {
- ei->flag= ei->icu->flag;
- }
-
- ei++;
- }
-}
-
-// copied from make_seq_editipo
-static void make_fluidsim_editipo(SpaceIpo *si) // NT
-{
- EditIpo *ei;
- int a;
- char *name;
- ei= si->editipo= MEM_callocN(FLUIDSIM_TOTIPO*sizeof(EditIpo), "fluidsim_editipo");
- si->totipo = FLUIDSIM_TOTIPO;
- for(a=0; a<FLUIDSIM_TOTIPO; a++) {
- //fprintf(stderr,"FSINAME %d %d \n",a,fluidsim_ar[a], (int)(getname_fluidsim_ei(fluidsim_ar[a])) );
- name = getname_fluidsim_ei(fluidsim_ar[a]);
- strcpy(ei->name, name);
- ei->adrcode= fluidsim_ar[a];
- ei->col= ipo_rainbow(a, FLUIDSIM_TOTIPO);
- ei->icu= find_ipocurve(si->ipo, ei->adrcode);
- if(ei->icu) {
- ei->flag = ei->icu->flag;
- }
- //else { ei->flag |= IPO_VISIBLE; }
- //fprintf(stderr,"FSIMAKE eif%d,icuf%d icu%d %d|%d\n", ei->flag,ei->icu->flag, (int)ei->icu, IPO_VISIBLE,IPO_SELECT);
- //fprintf(stderr,"FSIMAKE eif%d icu%d %d|%d\n", ei->flag, (int)ei->icu, IPO_VISIBLE,IPO_SELECT);
- ei++;
- }
-}
-
-static void make_seq_editipo(SpaceIpo *si)
-{
- EditIpo *ei;
- int a;
- char *name;
-
- ei= si->editipo= MEM_callocN(SEQ_TOTIPO*sizeof(EditIpo), "editipo");
-
- si->totipo= SEQ_TOTIPO;
-
-
- for(a=0; a<SEQ_TOTIPO; a++) {
- name = getname_seq_ei(seq_ar[a]);
- strcpy(ei->name, name);
- ei->adrcode= seq_ar[a];
-
- ei->col= ipo_rainbow(a, SEQ_TOTIPO);
-
- ei->icu= find_ipocurve(si->ipo, ei->adrcode);
- if(ei->icu) {
- ei->flag= ei->icu->flag;
- }
- else ei->flag |= IPO_VISIBLE;
-
- ei++;
- }
-}
-
-static void make_cu_editipo(SpaceIpo *si)
-{
- EditIpo *ei;
- int a;
- char *name;
-
- ei= si->editipo= MEM_callocN(CU_TOTIPO*sizeof(EditIpo), "editipo");
-
- si->totipo= CU_TOTIPO;
-
-
- for(a=0; a<CU_TOTIPO; a++) {
- name = getname_cu_ei(cu_ar[a]);
- strcpy(ei->name, name);
- ei->adrcode= cu_ar[a];
-
- ei->col= ipo_rainbow(a, CU_TOTIPO);
-
- ei->icu= find_ipocurve(si->ipo, ei->adrcode);
- if(ei->icu) {
- ei->flag= ei->icu->flag;
- }
- else ei->flag |= IPO_VISIBLE;
-
- ei++;
- }
-}
-
-static void make_key_editipo(SpaceIpo *si)
-{
- Key *key;
- KeyBlock *kb=NULL;
- EditIpo *ei;
- int a;
-
- key= ob_get_key((Object *)G.sipo->from);
- if(key==NULL) return;
-
- si->totipo= BLI_countlist(&key->block);
- ei= si->editipo= MEM_callocN(si->totipo*sizeof(EditIpo), "editipo");
-
- for(a=0, kb= key->block.first; a<si->totipo; a++, ei++, kb= kb->next) {
-
- if(kb->name[0] != 0) strncpy(ei->name, kb->name, 31); // length both same
- ei->adrcode= kb->adrcode;
-
- ei->col= ipo_rainbow(a, KEY_TOTIPO);
-
- ei->icu= find_ipocurve(si->ipo, ei->adrcode);
- if(ei->icu) {
- ei->flag= ei->icu->flag;
- }
- else if(a==0)
- if(key && key->type==KEY_NORMAL)
- ei->flag |= IPO_VISIBLE;
-
- /* active ipo is tied to active shape */
- {
- Object *ob= OBACT;
- if(a==ob->shapenr-1)
- set_active_editipo(ei);
- }
- }
-
- ei= si->editipo;
- if(key && key->type==KEY_RELATIVE) {
- strcpy(ei->name, "----");
- }
- else {
- ei->flag |= IPO_VISIBLE;
- }
-}
-
-static void make_mat_editipo(SpaceIpo *si)
-{
- EditIpo *ei;
- int a, len;
- char *name;
-
- if(si->from==0) return;
-
- ei= si->editipo= MEM_callocN(MA_TOTIPO*sizeof(EditIpo), "editipo");
-
- si->totipo= MA_TOTIPO;
-
- for(a=0; a<MA_TOTIPO; a++) {
- name = getname_mat_ei(ma_ar[a]);
- strcpy(ei->name, name);
- ei->adrcode= ma_ar[a];
-
- if(ei->adrcode & MA_MAP1) {
- ei->adrcode-= MA_MAP1;
- ei->adrcode |= texchannel_to_adrcode(si->channel);
- }
- else {
- if(ei->adrcode==MA_MODE) ei->disptype= IPO_DISPBITS;
- }
-
- ei->col= ipo_rainbow(a, MA_TOTIPO);
-
- len= strlen(ei->name);
- if(len) {
- if( ei->name[ len-1 ]=='R') ei->col= 0x5050FF;
- else if( ei->name[ len-1 ]=='G') ei->col= 0x50FF50;
- else if( ei->name[ len-1 ]=='B') ei->col= 0xFF7050;
- }
-
- ei->icu= find_ipocurve(si->ipo, ei->adrcode);
- if(ei->icu) {
- ei->flag= ei->icu->flag;
- }
-
- ei++;
- }
-}
-
-static void make_texture_editipo(SpaceIpo *si)
-{
- EditIpo *ei;
- int a, len;
- char *name;
-
- if(si->from==0) return;
-
- ei= si->editipo= MEM_callocN(TE_TOTIPO*sizeof(EditIpo), "editipo");
-
- si->totipo= TE_TOTIPO;
-
- for(a=0; a<TE_TOTIPO; a++) {
- name = getname_tex_ei(te_ar[a]);
- strcpy(ei->name, name);
- ei->adrcode= te_ar[a];
-
- ei->col= ipo_rainbow(a, TE_TOTIPO);
-
- len= strlen(ei->name);
- if(len) {
- if( ei->name[ len-1 ]=='R') ei->col= 0x5050FF;
- else if( ei->name[ len-1 ]=='G') ei->col= 0x50FF50;
- else if( ei->name[ len-1 ]=='B') ei->col= 0xFF7050;
- }
- ei->icu= find_ipocurve(si->ipo, ei->adrcode);
- if(ei->icu) {
- ei->flag= ei->icu->flag;
- }
-
- ei++;
- }
-}
-
-static void make_world_editipo(SpaceIpo *si)
-{
- EditIpo *ei;
- int a, len;
- char *name;
-
- if(si->from==0) return;
-
- ei= si->editipo= MEM_callocN(WO_TOTIPO*sizeof(EditIpo), "editipo");
-
- si->totipo= WO_TOTIPO;
-
- for(a=0; a<WO_TOTIPO; a++) {
- name = getname_world_ei(wo_ar[a]);
-
- strcpy(ei->name, name);
- ei->adrcode= wo_ar[a];
-
- if(ei->adrcode & MA_MAP1) {
- ei->adrcode-= MA_MAP1;
- ei->adrcode |= texchannel_to_adrcode(si->channel);
- }
- else {
- if(ei->adrcode==MA_MODE) ei->disptype= IPO_DISPBITS;
- }
-
- ei->col= ipo_rainbow(a, WO_TOTIPO);
-
- len= strlen(ei->name);
- if(len) {
- if( ei->name[ len-1 ]=='R') ei->col= 0x5050FF;
- else if( ei->name[ len-1 ]=='G') ei->col= 0x50FF50;
- else if( ei->name[ len-1 ]=='B') ei->col= 0xFF7050;
- }
-
- ei->icu= find_ipocurve(si->ipo, ei->adrcode);
- if(ei->icu) {
- ei->flag= ei->icu->flag;
- }
-
- ei++;
- }
-}
-
-static void make_lamp_editipo(SpaceIpo *si)
-{
- EditIpo *ei;
- int a;
- char *name;
-
- ei= si->editipo= MEM_callocN(LA_TOTIPO*sizeof(EditIpo), "editipo");
-
- si->totipo= LA_TOTIPO;
-
- for(a=0; a<LA_TOTIPO; a++) {
- name = getname_la_ei(la_ar[a]);
- strcpy(ei->name, name);
- ei->adrcode= la_ar[a];
-
- if(ei->adrcode & MA_MAP1) {
- ei->adrcode-= MA_MAP1;
- ei->adrcode |= texchannel_to_adrcode(si->channel);
- }
-
- ei->col= ipo_rainbow(a, LA_TOTIPO);
-
- ei->icu= find_ipocurve(si->ipo, ei->adrcode);
- if(ei->icu) {
- ei->flag= ei->icu->flag;
- }
-
- ei++;
- }
-}
-
-static void make_camera_editipo(SpaceIpo *si)
-{
- EditIpo *ei;
- int a;
- char *name;
-
- ei= si->editipo= MEM_callocN(CAM_TOTIPO*sizeof(EditIpo), "editipo");
-
- si->totipo= CAM_TOTIPO;
-
-
- for(a=0; a<CAM_TOTIPO; a++) {
- name = getname_cam_ei(cam_ar[a]);
- strcpy(ei->name, name);
- ei->adrcode= cam_ar[a];
-
- ei->col= ipo_rainbow(a, CAM_TOTIPO);
-
- ei->icu= find_ipocurve(si->ipo, ei->adrcode);
- if(ei->icu) {
- ei->flag= ei->icu->flag;
- }
-
- ei++;
- }
-}
-
-static int make_constraint_editipo(Ipo *ipo, EditIpo **si)
-{
- EditIpo *ei;
- int a;
- char *name;
-
- ei= *si= MEM_callocN(CO_TOTIPO*sizeof(EditIpo), "editipo");
-
- for(a=0; a<CO_TOTIPO; a++) {
- name = getname_co_ei(co_ar[a]);
- strcpy(ei->name, name);
- ei->adrcode= co_ar[a];
-
- ei->col= ipo_rainbow(a, CO_TOTIPO);
-
- ei->icu= find_ipocurve(ipo, ei->adrcode);
- if(ei->icu) {
- ei->flag= ei->icu->flag;
- }
-
- ei++;
- }
-
- return CO_TOTIPO;
-}
-
-static int make_bone_editipo(Ipo *ipo, EditIpo **si)
-{
- EditIpo *ei;
- int a;
- char *name;
-
- ei= *si= MEM_callocN(AC_TOTIPO*sizeof(EditIpo), "editipo");
-
- for(a=0; a<AC_TOTIPO; a++) {
- name = getname_ac_ei(ac_ar[a]);
- strcpy(ei->name, name);
- ei->adrcode= ac_ar[a];
-
- ei->col= ipo_rainbow(a, AC_TOTIPO);
-
- ei->icu= find_ipocurve(ipo, ei->adrcode);
- if(ei->icu) {
- ei->flag= ei->icu->flag;
- }
-
- ei++;
- }
-
- return AC_TOTIPO;
-}
-
-static void make_sound_editipo(SpaceIpo *si)
-{
- EditIpo *ei;
- int a;
- char *name;
-
- ei= si->editipo= MEM_callocN(SND_TOTIPO*sizeof(EditIpo), "editipo");
-
- si->totipo= SND_TOTIPO;
-
-
- for(a=0; a<SND_TOTIPO; a++) {
- name = getname_snd_ei(snd_ar[a]);
- strcpy(ei->name, name);
- ei->adrcode= snd_ar[a];
-
- ei->col= ipo_rainbow(a, SND_TOTIPO);
-
- ei->icu= find_ipocurve(si->ipo, ei->adrcode);
- if(ei->icu) {
- ei->flag= ei->icu->flag;
- }
-
- ei++;
- }
-}
-
-/* only called in test_editipo() below */
-static void make_editipo(void)
-{
- EditIpo *ei;
- Object *ob;
- rctf *rf;
- int a;
-
- if(G.sipo->editipo)
- MEM_freeN(G.sipo->editipo);
-
- G.sipo->editipo= NULL;
- G.sipo->totipo= 0;
-
- if(G.sipo->from==NULL) return;
-
- ob= OBACT;
-
- if(G.sipo->ipo) G.sipo->showkey= G.sipo->ipo->showkey;
-
- if(G.sipo->blocktype==ID_SEQ) {
- make_seq_editipo(G.sipo);
- }
- else if(G.sipo->blocktype==ID_WO) {
- make_world_editipo(G.sipo);
- }
- else if(G.sipo->blocktype==ID_OB) {
- if (ob) {
- ob->ipowin= ID_OB;
- make_ob_editipo(ob, G.sipo);
- }
- }
- else if(G.sipo->blocktype==ID_MA) {
- if (ob) {
- ob->ipowin= ID_MA;
- make_mat_editipo(G.sipo);
- }
- }
- else if(G.sipo->blocktype==ID_CU) {
- if (ob) {
- ob->ipowin= ID_CU;
- make_cu_editipo(G.sipo);
- }
- }
- else if(G.sipo->blocktype==ID_KE) {
- if (ob) {
- ob->ipowin= ID_KE;
- make_key_editipo(G.sipo);
- }
- }
- else if(G.sipo->blocktype==ID_LA) {
- if (ob) {
- ob->ipowin= ID_LA;
- make_lamp_editipo(G.sipo);
- }
- }
- else if(G.sipo->blocktype==ID_TE) {
- if (ob) {
- ob->ipowin= ID_TE;
- make_texture_editipo(G.sipo);
- }
- }
- else if(G.sipo->blocktype==ID_CA) {
- if (ob) {
- ob->ipowin= ID_CA;
- make_camera_editipo(G.sipo);
- }
- }
- else if(G.sipo->blocktype==ID_SO) {
- if (ob) {
- ob->ipowin= ID_SO;
- make_sound_editipo(G.sipo);
- }
- }
- else if(G.sipo->blocktype==ID_CO){
- G.sipo->totipo = make_constraint_editipo(G.sipo->ipo, (EditIpo**)&G.sipo->editipo);
- if (ob) {
- ob->ipowin= ID_CO;
- }
- }
- else if(G.sipo->blocktype==ID_PO) {
-
- G.sipo->totipo = make_bone_editipo(G.sipo->ipo, (EditIpo**)&G.sipo->editipo);
- if (ob) {
- ob->ipowin= ID_PO;
- }
- }
- else if(G.sipo->blocktype==ID_FLUIDSIM) {
- if (ob) { // NT
- ob->ipowin= ID_FLUIDSIM;
- make_fluidsim_editipo(G.sipo);
- }
- }
- else if(G.sipo->blocktype==ID_PA) {
- if (ob) {
- ob->ipowin= ID_PA;
- make_part_editipo(G.sipo);
- }
- }
-
- if(G.sipo->editipo==0) return;
-
- ei= G.sipo->editipo;
- for(a=0; a<G.sipo->totipo; a++, ei++) {
- if(ei->icu) ei->icu->flag= ei->flag;
- }
- editipo_changed(G.sipo, 0);
-
- /* sets globals, bad stuff but we need these variables in other parts of code */
- get_status_editipo();
-
- if(G.sipo->ipo) {
-
- if (G.sipo->pin)
- rf= &(G.sipo->v2d.cur);
- else
- rf= &(G.sipo->ipo->cur);
-
- if(rf->xmin<rf->xmax && rf->ymin<rf->ymax) G.v2d->cur= *rf;
- else ipo_default_v2d_cur(G.sipo->blocktype, &G.v2d->cur);
- }
- else {
- ipo_default_v2d_cur(G.sipo->blocktype, &G.v2d->cur);
- }
-
- view2d_do_locks(curarea, V2D_LOCK_COPY);
-}
-
-/* evaluates context in the current UI */
-/* blocktype is type of ipo */
-/* from is the base pointer to find data to change (ob in case of action or pose) */
-/* bonename is for local bone ipos (constraint only now) */
-static void get_ipo_context(short blocktype, ID **from, Ipo **ipo, char *actname, char *constname, char *bonename)
-{
- Object *ob= OBACT;
-
- *from= NULL;
- *ipo= NULL;
-
- if(blocktype==ID_CO) {
- if (ob) {
- bConstraintChannel *chan;
- bConstraint *con= get_active_constraint(ob);
-
- if(con) {
- *from= &ob->id;
-
- BLI_strncpy(constname, con->name, 32);
-
- /* a bit hackish, but we want con->ipo to work */
- if(con->flag & CONSTRAINT_OWN_IPO) {
- if(ob->flag & OB_POSEMODE) {
- bPoseChannel *pchan= get_active_posechannel(ob);
- if(pchan) {
- BLI_strncpy(bonename, pchan->name, 32);
- *ipo= con->ipo;
- }
- }
- }
- else {
- chan= get_active_constraint_channel(ob);
- if(chan) {
- *ipo= chan->ipo;
- BLI_strncpy(constname, con->name, 32);
- }
-
- /* set actname if in posemode */
- if(ob->action) {
- if(ob->flag & OB_POSEMODE) {
- bPoseChannel *pchan= get_active_posechannel(ob);
- if(pchan)
- BLI_strncpy(actname, pchan->name, 32);
- }
- else if(ob->ipoflag & OB_ACTION_OB)
- strcpy(actname, "Object");
- }
- }
- }
- }
- }
- else if(blocktype==ID_PO) {
- if (ob && ob->action && ob->type==OB_ARMATURE) {
- bPoseChannel *pchan= get_active_posechannel(ob);
-
- *from= (ID *)ob;
- if (pchan) {
- bActionChannel *achan;
-
- BLI_strncpy(actname, pchan->name, 32); /* also set when no channel yet */
-
- achan= get_action_channel(ob->action, pchan->name);
- if(achan)
- *ipo= achan->ipo;
- }
- }
-
- }
- else if(blocktype==ID_OB) {
- if(ob) {
- *from= (ID *)ob;
- if(ob->ipoflag & OB_ACTION_OB) {
- if (ob->action) {
- bActionChannel *achan= get_action_channel(ob->action, "Object");
- if(achan) {
- *ipo= achan->ipo;
- BLI_strncpy(actname, achan->name, 32);
- }
- }
- }
- else {
- *ipo= ob->ipo;
- }
- }
- }
- else if(blocktype==ID_SEQ) {
- Sequence *last_seq = get_last_seq();
-
- if(last_seq && ((last_seq->type & SEQ_EFFECT)||(last_seq->type == SEQ_HD_SOUND)||(last_seq->type == SEQ_RAM_SOUND))) {
- *from= (ID *)last_seq;
- *ipo= last_seq->ipo;
- }
- }
- else if(blocktype==ID_WO) {
- World *wo= G.scene->world;
- *from= (ID *)wo;
- if(wo) *ipo= wo->ipo;
- }
- else if(blocktype==ID_TE) {
- if(ob) {
- Tex *tex= give_current_texture(ob, ob->actcol);
- *from= (ID *)tex;
- if(tex) *ipo= tex->ipo;
- }
- }
- else if(blocktype==ID_MA) {
- if(ob) {
- Material *ma= give_current_material(ob, ob->actcol);
- ma= editnode_get_active_material(ma);
- *from= (ID *)ma;
- if(ma) *ipo= ma->ipo;
- }
- }
- else if(blocktype==ID_KE) {
- if(ob) {
- Key *key= ob_get_key(ob);
-
- if(ob->ipoflag & OB_ACTION_KEY) {
- if (ob->action) {
- bActionChannel *achan= get_action_channel(ob->action, "Shape");
- if(achan) {
- *ipo= achan->ipo;
- BLI_strncpy(actname, achan->name, 32);
- }
- }
- }
- else if(key) *ipo= key->ipo;
-
- *from= (ID *)ob;
- }
- }
- else if(blocktype==ID_CU) {
- if(ob && ob->type==OB_CURVE) {
- Curve *cu= ob->data;
- *from= (ID *)cu;
- *ipo= cu->ipo;
- }
- }
- else if(blocktype==ID_LA) {
- if(ob && ob->type==OB_LAMP) {
- Lamp *la= ob->data;
- *from= (ID *)la;
- *ipo= la->ipo;
- }
- }
- else if(blocktype==ID_CA) {
- if(ob && ob->type==OB_CAMERA) {
- Camera *ca= ob->data;
- *from= (ID *)ca;
- if(ca) *ipo= ca->ipo;
- }
- }
- else if(blocktype==ID_SO) {
-
- // if (G.buts && G.buts->mainb == BUTS_SOUND) {
- // bSound *sound = G.buts->lockpoin;
- // *from= (ID *)sound;
- // if(sound) *ipo= sound->ipo;
- // }
- }
- else if(blocktype==ID_FLUIDSIM) {
- if(ob && ( ob->fluidsimFlag & OB_FLUIDSIM_ENABLE)) {
- FluidsimSettings *fss= ob->fluidsimSettings;
- *from= (ID *)ob;
- if(fss) *ipo= fss->ipo;
- }
- }
- else if(blocktype==ID_PA) {
- ParticleSystem *psys = psys_get_current(ob);
- if(psys){
- *from= (ID *)ob;
- *ipo= psys->part->ipo;
- }
- }
-}
-
-/* called on each redraw, check if editipo data has to be remade */
-/* if doit already set, it always makes (in case no ipo exists, we need to see the channels */
-void test_editipo(int doit)
-{
-
- if(G.sipo->pin==0) {
- Ipo *ipo;
- ID *from;
- char actname[32]="", constname[32]="", bonename[32]="";
-
- get_ipo_context(G.sipo->blocktype, &from, &ipo, actname, constname, bonename);
-
- if(G.sipo->ipo != ipo) {
- G.sipo->ipo= ipo;
- if(ipo) G.v2d->cur= ipo->cur;
- doit= 1;
- }
- if(G.sipo->from != from) {
- G.sipo->from= from;
- doit= 1;
- }
- if( strcmp(G.sipo->actname, actname)) {
- BLI_strncpy(G.sipo->actname, actname, 32);
- doit= 1;
- }
- if( strcmp(G.sipo->constname, constname)) {
- BLI_strncpy(G.sipo->constname, constname, 32);
- doit= 1;
- }
- if( strcmp(G.sipo->bonename, bonename)) {
- BLI_strncpy(G.sipo->bonename, bonename, 32);
- /* urmf; if bonename, then no action */
- if(bonename[0]) G.sipo->actname[0]= 0;
- doit= 1;
- }
-
- if(G.sipo->ipo)
- G.sipo->ipo->cur = G.v2d->cur;
-
- }
-
- if(G.sipo->editipo==NULL || doit) {
- make_editipo();
- }
-}
-
-/* ****************** EditIpo ************************ */
-
-int totipo_edit=0, totipo_sel=0, totipo_curve=0, totipo_vis=0, totipo_vert=0, totipo_vertsel=0, totipo_key=0, totipo_keysel=0;
-
-void get_status_editipo(void)
-{
- EditIpo *ei;
- IpoKey *ik;
- BezTriple *bezt;
- int a, b;
-
- totipo_vis= 0;
- totipo_curve= 0;
- totipo_sel= 0;
- totipo_edit= 0;
- totipo_vert= 0;
- totipo_vertsel= 0;
- totipo_key= 0;
- totipo_keysel= 0;
-
- if(G.sipo->ipo && G.sipo->ipo->id.lib) return;
-
- ei= G.sipo->editipo;
- if(ei==0) return;
- for(a=0; a<G.sipo->totipo; a++) {
- if( ei->flag & IPO_VISIBLE ) {
- totipo_vis++;
- if(ei->flag & IPO_SELECT) totipo_sel++;
- if(ei->icu && ei->icu->totvert) totipo_curve++;
- if(G.sipo->showkey || (ei->flag & IPO_EDIT)) {
-
- /* if showkey: do count the vertices (for grab) */
- if(G.sipo->showkey==0) totipo_edit++;
-
- if(ei->icu) {
- if(ei->icu->bezt) {
- bezt= ei->icu->bezt;
- b= ei->icu->totvert;
- while(b--) {
- if(ei->icu->ipo==IPO_BEZ) {
- if(bezt->f1 & SELECT) totipo_vertsel++;
- if(bezt->f3 & SELECT) totipo_vertsel++;
- totipo_vert+= 2;
- }
- if(bezt->f2 & SELECT) totipo_vertsel++;
-
- totipo_vert++;
- bezt++;
- }
- }
- }
- }
- }
- ei++;
- }
-
- if(G.sipo->showkey) {
- ik= G.sipo->ipokey.first;
- while(ik) {
- totipo_key++;
- if(ik->flag & 1) totipo_keysel++;
- ik= ik->next;
- }
- }
-}
-
-/* synchronize editipo flag with icu flag and ipokey flags */
-void update_editipo_flags(void)
-{
- EditIpo *ei;
- IpoKey *ik;
- int a;
-
- ei= G.sipo->editipo;
- if(ei) {
- for(a=0; a<G.sipo->totipo; a++, ei++) {
- if(ei->icu) ei->icu->flag= ei->flag;
- }
- }
- if(G.sipo->showkey) {
- ik= G.sipo->ipokey.first;
- while(ik) {
- for(a=0; a<G.sipo->totipo; a++) {
- if(ik->data[a]) {
- if(ik->flag & 1) {
- ik->data[a]->f1 |= SELECT;
- ik->data[a]->f2 |= SELECT;
- ik->data[a]->f3 |= SELECT;
- }
- else {
- ik->data[a]->f1 &= ~SELECT;
- ik->data[a]->f2 &= ~SELECT;
- ik->data[a]->f3 &= ~SELECT;
- }
- }
- }
- ik= ik->next;
- }
- }
-}
-
-/* sort of enter/leave editmode for curves */
-void set_editflag_editipo(void)
-{
- EditIpo *ei;
- int a; /* , tot= 0, ok= 0; */
-
- /* after showkey immediately go to editing of selected points */
- if(G.sipo->showkey) {
- G.sipo->showkey= 0;
- if(G.sipo->ipo) G.sipo->ipo->showkey= 0;
- ei= G.sipo->editipo;
- for(a=0; a<G.sipo->totipo; a++, ei++) ei->flag |= IPO_SELECT;
- scrarea_queue_headredraw(curarea);
- allqueue(REDRAWVIEW3D, 0);
- }
-
- get_status_editipo();
-
- if(G.sipo->ipo && G.sipo->ipo->id.lib) return;
-
- ei= G.sipo->editipo;
- for(a=0; a<G.sipo->totipo; a++, ei++) {
- if(ei->icu) {
- if(ei->flag & IPO_VISIBLE) {
-
- if(totipo_edit==0 && (ei->flag & IPO_SELECT)) {
- ei->flag |= IPO_EDIT;
- ei->icu->flag= ei->flag;
- }
- else if(totipo_edit && (ei->flag & IPO_EDIT)) {
- ei->flag -= IPO_EDIT;
- ei->icu->flag= ei->flag;
- }
- else if(totipo_vis==1) {
- if(ei->flag & IPO_EDIT) ei->flag -= IPO_EDIT;
- else ei->flag |= IPO_EDIT;
- ei->icu->flag= ei->flag;
- }
- }
- }
- }
- scrarea_queue_headredraw(curarea);
- scrarea_queue_winredraw(curarea);
-}
-
-static short findnearest_ipovert(IpoCurve **icu, BezTriple **bezt)
-{
- /* selected verts get a disadvantage */
- /* in icu and (bezt or bp) the nearest is written */
- /* return 0 1 2: handlepunt */
- EditIpo *ei;
- BezTriple *bezt1;
- int dist= 100, temp, a, b;
- short mval[2], hpoint=0, sco[3][2];
-
- *icu= 0;
- *bezt= 0;
-
- getmouseco_areawin(mval);
-
- ei= G.sipo->editipo;
- for(a=0; a<G.sipo->totipo; a++, ei++) {
- if (ISPOIN3(ei, flag & IPO_VISIBLE, flag & IPO_EDIT, icu)) {
-
- if(ei->icu->bezt) {
- bezt1= ei->icu->bezt;
- b= ei->icu->totvert;
- while(b--) {
-
- ipoco_to_areaco_noclip(G.v2d, bezt1->vec[0], sco[0]);
- ipoco_to_areaco_noclip(G.v2d, bezt1->vec[1], sco[1]);
- ipoco_to_areaco_noclip(G.v2d, bezt1->vec[2], sco[2]);
-
- if(ei->disptype==IPO_DISPBITS) {
- temp= abs(mval[0]- sco[1][0]);
- }
- else temp= abs(mval[0]- sco[1][0])+ abs(mval[1]- sco[1][1]);
-
- if( bezt1->f2 & SELECT) temp+=5;
- if(temp<dist) {
- hpoint= 1;
- *bezt= bezt1;
- dist= temp;
- *icu= ei->icu;
- }
-
- if(ei->disptype!=IPO_DISPBITS && ei->icu->ipo==IPO_BEZ) {
- /* middle points get an advantage */
- temp= -3+abs(mval[0]- sco[0][0])+ abs(mval[1]- sco[0][1]);
- if( bezt1->f1 & 1) temp+=5;
- if(temp<dist) {
- hpoint= 0;
- *bezt= bezt1;
- dist= temp;
- *icu= ei->icu;
- }
-
- temp= abs(mval[0]- sco[2][0])+ abs(mval[1]- sco[2][1]);
- if( bezt1->f3 & 1) temp+=5;
- if(temp<dist) {
- hpoint= 2;
- *bezt=bezt1;
- dist= temp;
- *icu= ei->icu;
- }
- }
- bezt1++;
- }
- }
- }
- }
-
- return hpoint;
-}
-
-void mouse_select_ipo(void)
-{
- Object *ob;
- KeyBlock *actkb=NULL;
- EditIpo *ei, *actei= 0;
- IpoCurve *icu;
- IpoKey *ik, *actik;
- BezTriple *bezt;
- TimeMarker *marker;
- float x, y, dist, mindist;
- int a, oldflag = 0, hand, ok;
- short mval[2], xo, yo;
-
- if(G.sipo->editipo==0) return;
-
- get_status_editipo();
- marker=find_nearest_marker(1);
-
- /* map ipo-points for editing if scaled ipo */
- if (NLA_IPO_SCALED) {
- actstrip_map_ipo_keys(OBACT, G.sipo->ipo, 0, 0);
- }
-
- if(G.sipo->showkey) {
- getmouseco_areawin(mval);
-
- areamouseco_to_ipoco(G.v2d, mval, &x, &y);
- actik= 0;
- mindist= 1000.0;
- ik= G.sipo->ipokey.first;
- while(ik) {
- dist= (float)(fabs(ik->val-x));
- if(ik->flag & 1) dist+= 1.0;
- if(dist < mindist) {
- actik= ik;
- mindist= dist;
- }
- ik= ik->next;
- }
- if(actik) {
- oldflag= actik->flag;
-
- if(G.qual & LR_SHIFTKEY);
- else deselectall_editipo();
-
- if(G.qual & LR_SHIFTKEY) {
- if(oldflag & 1) actik->flag &= ~1;
- else actik->flag |= 1;
- }
- else {
- actik->flag |= 1;
- }
- }
- }
- else if(totipo_edit) {
-
- hand= findnearest_ipovert(&icu, &bezt);
-
- if(G.qual & LR_SHIFTKEY) {
- if(bezt) {
- if(hand==1) {
- if(BEZSELECTED(bezt)) {
- bezt->f1= bezt->f2= bezt->f3= 0;
- }
- else {
- bezt->f1= bezt->f2= bezt->f3= SELECT;
- }
- }
- else if(hand==0) {
- if(bezt->f1 & SELECT) bezt->f1= 0;
- else bezt->f1= SELECT;
- }
- else {
- if(bezt->f3 & SELECT) bezt->f3= 0;
- else bezt->f3= SELECT;
- }
- }
- }
- else {
- deselectall_editipo();
-
- if(bezt) {
- if(hand==1) {
- bezt->f1|= SELECT; bezt->f2|= SELECT; bezt->f3|= SELECT;
- }
- else if(hand==0) bezt->f1 |= SELECT;
- else bezt->f3 |= SELECT;
- }
- }
- }
- else if (marker) {
- /* select timeline marker */
- if ((G.qual & LR_SHIFTKEY)==0) {
- oldflag= marker->flag;
- deselect_markers(0, 0);
-
- if (oldflag & SELECT)
- marker->flag &= ~SELECT;
- else
- marker->flag |= SELECT;
- }
- else {
- marker->flag |= SELECT;
- }
- }
- else {
-
- /* vertex keys ? */
- if(G.sipo->blocktype==ID_KE && G.sipo->from) {
- Key *key;
- KeyBlock *kb, *curkb;
- int i, index= 1;
-
- ob= (Object *)G.sipo->from;
- key= ob_get_key(ob);
- curkb= BLI_findlink(&key->block, ob->shapenr-1);
-
- ei= G.sipo->editipo;
- if(key->type==KEY_NORMAL || (ei->flag & IPO_VISIBLE)) {
- getmouseco_areawin(mval);
-
- areamouseco_to_ipoco(G.v2d, mval, &x, &y);
- /* how much is 20 pixels? */
- mindist= (float)(20.0*(G.v2d->cur.ymax-G.v2d->cur.ymin)/(float)curarea->winy);
-
- for(i=1, kb= key->block.first; kb; kb= kb->next, i++) {
- dist= (float)(fabs(kb->pos-y));
- if(kb==curkb) dist+= (float)0.01;
- if(dist < mindist) {
- actkb= kb;
- mindist= dist;
- index= i;
- }
- }
- if(actkb) {
- ok= TRUE;
- if(G.obedit && actkb!=curkb) {
- ok= okee("Copy key after leaving Edit Mode");
- }
- if(ok) {
- /* also does all keypos */
- deselectall_editipo();
- set_active_key(index);
- set_active_editipo(ei+index-1);
- }
- }
- }
- }
-
- /* select curve */
- if(actkb==NULL) {
- if(totipo_vis==1) {
- ei= G.sipo->editipo;
- for(a=0; a<G.sipo->totipo; a++, ei++) {
- if(ei->icu) {
- if(ei->flag & IPO_VISIBLE) actei= ei;
- }
- }
- }
- else if(totipo_vis>1) {
- actei= select_proj_ipo(0, 0);
- }
-
- if(actei) oldflag= actei->flag;
-
- if(G.qual & LR_SHIFTKEY);
- else deselectall_editipo();
-
- if(actei) {
- if(G.qual & LR_SHIFTKEY) {
- if(oldflag & IPO_SELECT) actei->flag &= ~IPO_SELECT;
- else actei->flag |= IPO_SELECT;
- }
- else {
- actei->flag |= IPO_SELECT;
- }
- set_active_editipo(actei);
- }
- }
- }
-
- /* undo mapping of ipo-points for editing if scaled ipo */
- if (NLA_IPO_SCALED) {
- actstrip_map_ipo_keys(OBACT, G.sipo->ipo, 1, 0);
- }
-
- update_editipo_flags();
-
- force_draw(0);
- BIF_undo_push("Select Ipo");
-
- if(G.sipo->showkey && G.sipo->blocktype==ID_OB) {
- ob= OBACT;
- if(ob && (ob->ipoflag & OB_DRAWKEY)) allqueue(REDRAWVIEW3D, 0);
- }
- /* points inside of curve are drawn selected too */
- if(G.sipo->blocktype==ID_CU)
- allqueue(REDRAWVIEW3D, 0);
-
- getmouseco_areawin(mval);
- xo= mval[0];
- yo= mval[1];
-
- while(get_mbut()&R_MOUSE) {
- getmouseco_areawin(mval);
- if(abs(mval[0]-xo)+abs(mval[1]-yo) > 4) {
-
- if (marker) {
- transform_markers('g', 0);
- }
- else {
- if(actkb) move_keys(OBACT);
- else transform_ipo('g');
- }
-
- return;
- }
- BIF_wait_for_statechange();
- }
-}
-
-
-/* *********************************** */
-
-/* handling of right-hand channel/curve buttons in ipo window */
-void do_ipowin_buts(short event)
-{
- EditIpo *ei = NULL;
- int a;
-
- /* without shift, all other channels are made invisible */
- if((G.qual & LR_SHIFTKEY)==0) {
- if(event>G.sipo->totipo) return;
- ei = G.sipo->editipo;
- for(a=0; a<G.sipo->totipo; a++) {
- if(a!=event) ei->flag &= ~IPO_VISIBLE;
- else ei->flag |= IPO_VISIBLE;
- ei++;
- }
- }
-
- /* set active */
- if(event>=0 && event<G.sipo->totipo) {
- ei= G.sipo->editipo; // void pointer...
- set_active_editipo(ei+event);
- set_active_key(event+1); // only if there's a key, of course
- }
- scrarea_queue_winredraw(curarea);
-
- update_editipo_flags();
- get_status_editipo();
-
- if(G.sipo->showkey) {
- make_ipokey();
- if(G.sipo->blocktype==ID_OB) allqueue(REDRAWVIEW3D, 0);
- }
-
-}
-
-/* the fake buttons to the left of channel names, for select/deselect curves */
-void do_ipo_selectbuttons(void)
-{
- EditIpo *ei, *ei1;
- int a, nr;
- short mval[2];
-
- if(G.sipo->showkey) return;
-
- /* do not allow editipo here: convert editipos to selected */
- get_status_editipo();
- if(totipo_edit) {
- set_editflag_editipo();
- }
-
- /* which */
- getmouseco_areawin(mval);
-
- nr= -(mval[1]-curarea->winy+30-G.sipo->butofs-IPOBUTY)/IPOBUTY;
- if(G.sipo->blocktype==ID_KE) nr--; /* keys show something else in first channel */
-
- if(nr>=0 && nr<G.sipo->totipo) {
- ei= G.sipo->editipo;
- ei+= nr;
-
- set_active_editipo(ei);
- set_active_key(nr+1);
-
- if(ei->icu) {
- if((ei->flag & IPO_VISIBLE)==0) {
- ei->flag |= IPO_VISIBLE|IPO_SELECT;
- }
-
- if((G.qual & LR_SHIFTKEY)==0) {
- ei1= G.sipo->editipo;
- for(a=0; a<G.sipo->totipo; a++) {
- ei1->flag &= ~IPO_SELECT;
- ei1++;
- }
- }
-
- if(ei->flag & IPO_SELECT) {
- ei->flag &= ~IPO_SELECT;
- }
- else {
- ei->flag |= IPO_SELECT;
- }
-
- update_editipo_flags();
- scrarea_queue_winredraw(curarea);
- }
- }
- BIF_undo_push("Select Ipo curve");
-}
-
-/* ********************************* Inserting keys ********************************************* */
-
-/* depending type, it returns ipo, if needed it creates one */
-/* returns either action ipo or "real" ipo */
-/* arguments define full context;
- - *from has to be set always, to Object in case of Actions
- - blocktype defines available channels of Ipo struct (blocktype ID_OB can be in action too)
- - if actname, use this to locate actionchannel, and optional constname
- - if bonename, the constname is the ipo to the constraint
-*/
-
-/* note; check header_ipo.c, spaceipo_assign_ipo() too */
-Ipo *verify_ipo(ID *from, short blocktype, char *actname, char *constname, char *bonename)
-{
-
- if(from==NULL || from->lib) return NULL;
-
- /* first check action ipos */
- if(actname && actname[0]) {
- Object *ob= (Object *)from;
- bActionChannel *achan;
-
- if(GS(from->name)!=ID_OB) {
- printf("called ipo system for action with wrong base pointer\n");
- return NULL;
- }
-
- if(ob->action==NULL)
- ob->action= add_empty_action("Action");
-
- achan= verify_action_channel(ob->action, actname);
-
- if(achan) {
- /* constraint exception */
- if(blocktype==ID_CO) {
- bConstraintChannel *conchan= verify_constraint_channel(&achan->constraintChannels, constname);
- if(conchan->ipo==NULL) {
- conchan->ipo= add_ipo("CoIpo", ID_CO);
- }
- return conchan->ipo;
- }
- else {
- if(achan->ipo==NULL) {
- achan->ipo= add_ipo("ActIpo", blocktype);
- }
-
- return achan->ipo;
- }
- }
- }
- else {
-
- switch(GS(from->name)) {
- case ID_OB:
- {
- Object *ob= (Object *)from;
-
- /* constraint exception */
- if(blocktype==ID_CO) {
- /* check the local constraint ipo */
- if(bonename && bonename[0] && ob->pose) {
- bPoseChannel *pchan= get_pose_channel(ob->pose, bonename);
- bConstraint *con;
- for(con= pchan->constraints.first; con; con= con->next)
- if(strcmp(con->name, constname)==0)
- break;
- if(con) {
- if(con->ipo==NULL) {
- con->ipo= add_ipo("CoIpo", ID_CO);
- }
- return con->ipo;
- }
- }
- else { /* the actionchannel */
- bConstraintChannel *conchan= verify_constraint_channel(&ob->constraintChannels, constname);
- if(conchan->ipo==NULL) {
- conchan->ipo= add_ipo("CoIpo", ID_CO);
- }
- return conchan->ipo;
- }
- }
- else if(blocktype==ID_OB) {
- if(ob->ipo==NULL) {
- ob->ipo= add_ipo("ObIpo", ID_OB);
- }
- return ob->ipo;
- }
- else if(blocktype==ID_KE) {
- Key *key= ob_get_key((Object *)from);
-
- if(key) {
- if(key->ipo==NULL) {
- key->ipo= add_ipo("KeyIpo", ID_KE);
- }
- return key->ipo;
- }
- return NULL;
- }
- else if(blocktype== ID_FLUIDSIM) {
- Object *ob= (Object *)from;
- if(ob->fluidsimFlag & OB_FLUIDSIM_ENABLE) {
- FluidsimSettings *fss= ob->fluidsimSettings;
- if(fss->ipo==NULL) {
- fss->ipo= add_ipo("FluidsimIpo", ID_FLUIDSIM);
- //fprintf(stderr,"FSIPO NEW!\n");
- }
- return fss->ipo;
- }
- }
- else if(blocktype== ID_PA){
- Object *ob= (Object *)from;
- ParticleSystem *psys= psys_get_current(ob);
- if(psys){
- if(psys->part->ipo==0)
- psys->part->ipo= add_ipo("ParticleIpo", ID_PA);
- return psys->part->ipo;
- }
- return NULL;
- }
- }
- break;
- case ID_MA:
- {
- Material *ma= (Material *)from;
-
- if(ma->ipo==NULL) {
- ma->ipo= add_ipo("MatIpo", ID_MA);
- }
- return ma->ipo;
- }
- break;
- case ID_TE:
- {
- Tex *tex= (Tex *)from;
-
- if(tex->ipo==NULL) {
- tex->ipo= add_ipo("TexIpo", ID_TE);
- }
- return tex->ipo;
- }
- break;
- case ID_SEQ:
- {
- Sequence *seq= (Sequence *)from; /* note, sequence is mimicing Id */
-
- if((seq->type & SEQ_EFFECT)||
- (seq->type == SEQ_RAM_SOUND)||
- (seq->type == SEQ_HD_SOUND)) {
- if(seq->ipo==NULL) {
- seq->ipo= add_ipo("SeqIpo", ID_SEQ);
- }
- update_seq_ipo_rect(seq);
- return seq->ipo;
- }
- }
- break;
- case ID_CU:
- {
- Curve *cu= (Curve *)from;
-
- if(cu->ipo==NULL) {
- cu->ipo= add_ipo("CuIpo", ID_CU);
- }
- return cu->ipo;
- }
- break;
- case ID_WO:
- {
- World *wo= (World *)from;
-
- if(wo->ipo==NULL) {
- wo->ipo= add_ipo("WoIpo", ID_WO);
- }
- return wo->ipo;
- }
- break;
- case ID_LA:
- {
- Lamp *la= (Lamp *)from;
-
- if(la->ipo==NULL) {
- la->ipo= add_ipo("LaIpo", ID_LA);
- }
- return la->ipo;
- }
- break;
- case ID_CA:
- {
- Camera *ca= (Camera *)from;
-
- if(ca->ipo==NULL) {
- ca->ipo= add_ipo("CaIpo", ID_CA);
- }
- return ca->ipo;
- }
- break;
- case ID_SO:
- {
- bSound *snd= (bSound *)from;
-
- if(snd->ipo==NULL) {
- snd->ipo= add_ipo("SndIpo", ID_SO);
- }
- return snd->ipo;
- }
- }
- }
-
- return NULL;
-}
-
-/* returns and creates
- * Make sure functions check for NULL or they will crash!
- * */
-IpoCurve *verify_ipocurve(ID *from, short blocktype, char *actname, char *constname, char *bonename, int adrcode)
-{
- Ipo *ipo;
- IpoCurve *icu= NULL;
-
- /* return 0 if lib */
- /* creates ipo too */
- ipo= verify_ipo(from, blocktype, actname, constname, bonename);
-
- if(ipo && ipo->id.lib==NULL && from->lib==NULL) {
-
- for(icu= ipo->curve.first; icu; icu= icu->next) {
- if(icu->adrcode==adrcode) break;
- }
- if(icu==NULL) {
- icu= MEM_callocN(sizeof(IpoCurve), "ipocurve");
-
- icu->flag |= IPO_VISIBLE|IPO_AUTO_HORIZ;
- if(ipo->curve.first==NULL) icu->flag |= IPO_ACTIVE; /* first one added active */
-
- icu->blocktype= blocktype;
- icu->adrcode= adrcode;
-
- set_icu_vars(icu);
-
- BLI_addtail( &(ipo->curve), icu);
-
- switch (GS(from->name)) {
- case ID_SEQ: {
- Sequence *seq= (Sequence *)from;
-
- update_seq_icu_rects(seq);
- break;
- }
- }
- }
- }
-
- return icu;
-}
-
-/* This function adds a given BezTriple to an IPO-Curve. It will allocate
- * memory for the array if needed, and will insert the BezTriple into a
- * suitable place in chronological order.
- *
- * NOTE: any recalculate of the IPO-Curve that needs to be done will need to
- * be done by the caller.
- */
-int insert_bezt_icu (IpoCurve *icu, BezTriple *bezt)
-{
- BezTriple *newb, *beztd;
- int i= 0;
-
- if (icu->bezt == NULL) {
- icu->bezt= MEM_callocN(sizeof(BezTriple), "beztriple");
- *(icu->bezt)= *bezt;
- icu->totvert= 1;
- }
- else {
- beztd= icu->bezt;
- for (i = 0; i <= icu->totvert; i++, beztd++) {
- /* no double points - threshold to determine this should be good enough */
- if ((i < icu->totvert) && IS_EQT(beztd->vec[1][0], bezt->vec[1][0], 0.00001)) {
- *(beztd)= *bezt;
- break;
- }
- /* if we've reached the end of the icu array, or bezt is to be pasted before current */
- if (i==icu->totvert || beztd->vec[1][0] > bezt->vec[1][0]) {
- newb= MEM_callocN( (icu->totvert+1)*sizeof(BezTriple), "beztriple");
-
- /* add the beztriples that should occur before the beztriple to be pasted (originally in ei->icu) */
- if (i > 0)
- memcpy(newb, icu->bezt, i*sizeof(BezTriple));
-
- /* add beztriple to paste at index j */
- *(newb+i)= *bezt;
-
- /* add the beztriples that occur after the beztriple to be pasted (originally in icu) */
- if (i < icu->totvert)
- memcpy(newb+i+1, icu->bezt+i, (icu->totvert-i)*sizeof(BezTriple));
-
- MEM_freeN(icu->bezt);
- icu->bezt= newb;
-
- icu->totvert++;
- break;
- }
- }
- }
-
- /* we need to return the index, so that some tools which do post-processing can
- * detect where we added the BezTriple in the array
- */
- return i;
-}
-
-/* This function is a wrapper for insert_bezt_icu, and should be used when
- * adding a new keyframe to a curve, when the keyframe doesn't exist anywhere
- * else yet.
- *
- * 'fast' - is only for the python API where importing BVH's would take an extreamly long time.
- */
-void insert_vert_icu (IpoCurve *icu, float x, float y, short fast)
-{
- BezTriple beztr;
- int a, h1, h2;
-
- /* set all three points, for nicer start position */
- memset(&beztr, 0, sizeof(BezTriple));
- beztr.vec[0][0]= x;
- beztr.vec[0][1]= y;
- beztr.vec[1][0]= x;
- beztr.vec[1][1]= y;
- beztr.vec[2][0]= x;
- beztr.vec[2][1]= y;
- beztr.hide= IPO_BEZ;
- beztr.f1= beztr.f2= beztr.f3= SELECT;
- beztr.h1= beztr.h2= HD_AUTO;
-
- /* add temp beztriple to keyframes */
- a= insert_bezt_icu(icu, &beztr);
- if (!fast) calchandles_ipocurve(icu);
-
- /* set handletype */
- if (icu->totvert > 2) {
- BezTriple *bezt;
-
- h1= h2= HD_AUTO;
- bezt= (icu->bezt + a);
-
- if (a > 0) h1= (bezt-1)->h2;
- if (a < icu->totvert-1) h2= (bezt+1)->h1;
-
- bezt->h1= h1;
- bezt->h2= h2;
-
- if (!fast) calchandles_ipocurve(icu);
- }
-}
-
-void add_vert_ipo(void)
-{
- EditIpo *ei;
- float x, y;
- int val;
- short mval[2];
-
- if(G.sipo->ipo && G.sipo->ipo->id.lib) return;
- if(G.sipo->showkey) {
- G.sipo->showkey= 0;
- free_ipokey(&G.sipo->ipokey);
- }
-
- getmouseco_areawin(mval);
-
- if(mval[0]>G.v2d->mask.xmax) return;
-
- ei= get_active_editipo();
- if(ei==NULL) {
- error("No active Ipo curve");
- return;
- }
- ei->flag |= IPO_VISIBLE; /* can happen it is active but not visible */
-
- areamouseco_to_ipoco(G.v2d, mval, &x, &y);
-
- /* convert click-time to ipo-time */
- if (NLA_IPO_SCALED) {
- x= get_action_frame(OBACT, x);
- }
-
- if(ei->icu==NULL) {
- if(G.sipo->from) {
- ei->icu= verify_ipocurve(G.sipo->from, G.sipo->blocktype, G.sipo->actname, G.sipo->constname, G.sipo->bonename, ei->adrcode);
- if (ei->icu)
- ei->flag |= ei->icu->flag & IPO_AUTO_HORIZ; /* new curve could have been added, weak... */
- else
- error("Cannot create an IPO curve, you may be using libdata");
- }
- }
- if(ei->icu==NULL) return;
-
- if(ei->disptype==IPO_DISPBITS) {
- ei->icu->vartype= IPO_BITS;
- val= (int)floor(y-0.5);
- if(val<0) val= 0;
- y= (float)(1 << val);
- }
-
- insert_vert_icu(ei->icu, x, y, 0);
-
- /* to be sure: if icu was 0, or only 1 curve visible */
- ei->flag |= IPO_SELECT;
- ei->icu->flag= ei->flag;
-
- editipo_changed(G.sipo, 1);
- BIF_undo_push("Add Ipo vertex");
-}
-
-static void *get_context_ipo_poin(ID *id, int blocktype, char *actname, IpoCurve *icu, int *vartype)
-{
- if(blocktype==ID_PO) {
- if(GS(id->name)==ID_OB) {
- Object *ob= (Object *)id;
- bPoseChannel *pchan= get_pose_channel(ob->pose, actname);
-
- *vartype= IPO_FLOAT;
- return get_pchan_ipo_poin(pchan, icu->adrcode);
- }
- return NULL;
- }
- else
- return get_ipo_poin(id, icu, vartype);
-
-}
-
-#define KEYNEEDED_DONTADD 0
-#define KEYNEEDED_JUSTADD 1
-#define KEYNEEDED_DELPREV 2
-#define KEYNEEDED_DELNEXT 3
-
-static int new_key_needed(IpoCurve *icu, float cFrame, float nValue)
-{
- /* This function determines whether a new keyframe is needed */
- /* Cases where keyframes should not be added:
- * 1. Keyframe to be added bewteen two keyframes with similar values
- * 2. Keyframe to be added on frame where two keyframes are already situated
- * 3. Keyframe lies at point that intersects the linear line between two keyframes
- */
-
- BezTriple *bezt=NULL, *prev=NULL;
- int totCount, i;
- float valA = 0.0f, valB = 0.0f;
-
- /* safety checking */
- if (!icu) return KEYNEEDED_JUSTADD;
- totCount= icu->totvert;
- if (totCount==0) return KEYNEEDED_JUSTADD;
-
- /* loop through checking if any are the same */
- bezt= icu->bezt;
- for (i=0; i<totCount; i++) {
- float prevPosi=0.0f, prevVal=0.0f;
- float beztPosi=0.0f, beztVal=0.0f;
-
- /* get current time+value */
- beztPosi= bezt->vec[1][0];
- beztVal= bezt->vec[1][1];
-
- if (prev) {
- /* there is a keyframe before the one currently being examined */
-
- /* get previous time+value */
- prevPosi= prev->vec[1][0];
- prevVal= prev->vec[1][1];
-
- /* keyframe to be added at point where there are already two similar points? */
- if (IS_EQ(prevPosi, cFrame) && IS_EQ(beztPosi, cFrame) && IS_EQ(beztPosi, prevPosi)) {
- return KEYNEEDED_DONTADD;
- }
-
- /* keyframe between prev+current points ? */
- if ((prevPosi <= cFrame) && (cFrame <= beztPosi)) {
- /* is the value of keyframe to be added the same as keyframes on either side ? */
- if (IS_EQ(prevVal, nValue) && IS_EQ(beztVal, nValue) && IS_EQ(prevVal, beztVal)) {
- return KEYNEEDED_DONTADD;
- }
- else {
- float realVal;
-
- /* get real value of curve at that point */
- realVal= eval_icu(icu, cFrame);
-
- /* compare whether it's the same as proposed */
- if (IS_EQ(realVal, nValue))
- return KEYNEEDED_DONTADD;
- else
- return KEYNEEDED_JUSTADD;
- }
- }
-
- /* new keyframe before prev beztriple? */
- if (cFrame < prevPosi) {
- /* A new keyframe will be added. However, whether the previous beztriple
- * stays around or not depends on whether the values of previous/current
- * beztriples and new keyframe are the same.
- */
- if (IS_EQ(prevVal, nValue) && IS_EQ(beztVal, nValue) && IS_EQ(prevVal, beztVal))
- return KEYNEEDED_DELNEXT;
- else
- return KEYNEEDED_JUSTADD;
- }
- }
- else {
- /* just add a keyframe if there's only one keyframe
- * and the new one occurs before the exisiting one does.
- */
- if ((cFrame < beztPosi) && (totCount==1))
- return KEYNEEDED_JUSTADD;
- }
-
- /* continue. frame to do not yet passed (or other conditions not met) */
- if (i < (totCount-1)) {
- prev= bezt;
- bezt++;
- }
- else
- break;
- }
-
- /* Frame in which to add a new-keyframe occurs after all other keys
- * -> If there are at least two existing keyframes, then if the values of the
- * last two keyframes and the new-keyframe match, the last existing keyframe
- * gets deleted as it is no longer required.
- * -> Otherwise, a keyframe is just added. 1.0 is added so that fake-2nd-to-last
- * keyframe is not equal to last keyframe.
- */
- bezt= (icu->bezt + (icu->totvert - 1));
- valA= bezt->vec[1][1];
-
- if (prev)
- valB= prev->vec[1][1];
- else
- valB= bezt->vec[1][1] + 1.0f;
-
- if (IS_EQ(valA, nValue) && IS_EQ(valA, valB))
- return KEYNEEDED_DELPREV;
- else
- return KEYNEEDED_JUSTADD;
-}
-
-/* a duplicate of insertkey that does not check for routing to insertmatrixkey
- to avoid recursion problems */
-static void insertkey_nonrecurs(ID *id, int blocktype, char *actname, char *constname, int adrcode)
-{
- IpoCurve *icu;
- Object *ob;
- void *poin= NULL;
- float curval, cfra;
- int vartype;
- int matset=0;
-
- if (matset==0) {
- icu= verify_ipocurve(id, blocktype, actname, constname, NULL, adrcode);
-
- if(icu) {
-
- poin= get_context_ipo_poin(id, blocktype, actname, icu, &vartype);
-
- if(poin) {
- curval= read_ipo_poin(poin, vartype);
-
- cfra= frame_to_float(CFRA);
-
- /* if action is mapped in NLA, it returns a correction */
- if(actname && actname[0] && GS(id->name)==ID_OB)
- cfra= get_action_frame((Object *)id, cfra);
-
- if( GS(id->name)==ID_OB ) {
- ob= (Object *)id;
- if(ob->sf!=0.0 && (ob->ipoflag & OB_OFFS_OB) ) {
- /* actually frametofloat calc again! */
- cfra-= ob->sf*G.scene->r.framelen;
- }
- }
-
- insert_vert_icu(icu, cfra, curval, 0);
- }
- }
- }
-}
-
-int insertmatrixkey(ID *id, int blocktype, char *actname, char *constname, int adrcode)
-{
- int matindex=0;
- /* branch on adrcode and blocktype, generating the proper matrix-based
- values to send to insertfloatkey */
- if (GS(id->name)==ID_OB) {
- Object *ob= (Object *)id;
-
- if ( blocktype==ID_OB ){ //working with an object
- if ((ob)&&!(ob->parent)) {
- if ((adrcode==OB_ROT_X)||(adrcode==OB_ROT_Y)||(adrcode==OB_ROT_Z)) { //get a rotation
- float eul[3];
- switch (adrcode) {
- case OB_ROT_X:
- matindex=0;
- break;
- case OB_ROT_Y:
- matindex=1;
- break;
- case OB_ROT_Z:
- matindex=2;
- break;
- }
- Mat4ToEul(ob->obmat, eul);
- insertfloatkey(id, ID_OB, actname, NULL, adrcode, eul[matindex]*(5.72958));
- return 1;
- } else if ((adrcode==OB_LOC_X)||(adrcode==OB_LOC_Y)||(adrcode==OB_LOC_Z)) {//get a translation
- switch (adrcode) {
- case OB_LOC_X:
- matindex=0;
- break;
- case OB_LOC_Y:
- matindex=1;
- break;
- case OB_LOC_Z:
- matindex=2;
- break;
- }
- insertfloatkey(id, ID_OB, actname, NULL, adrcode, ob->obmat[3][matindex]);
- return 1;
- }
- }
- } else if ( blocktype==ID_PO) { //working with a pose channel
- bPoseChannel *pchan= get_pose_channel(ob->pose, actname);
- if (pchan) {
- if ((adrcode==AC_LOC_X)||(adrcode==AC_LOC_Y)||(adrcode==AC_LOC_Z)) {
- switch (adrcode) {
- case AC_LOC_X:
- matindex=0;
- break;
- case AC_LOC_Y:
- matindex=1;
- break;
- case AC_LOC_Z:
- matindex=2;
- break;
- }
- if (!(pchan->bone->parent)||((pchan->bone->parent)&&!(pchan->bone->flag&BONE_CONNECTED))) { /* don't use for non-connected child bones */
- float delta_mat[4][4];
- armature_mat_pose_to_delta(delta_mat, pchan->pose_mat, pchan->bone->arm_mat);
- insertfloatkey(id, ID_PO, pchan->name, NULL, adrcode, delta_mat[3][matindex]);
- return 1;
- }
- } else if ((adrcode==AC_QUAT_W)||(adrcode==AC_QUAT_X)||(adrcode==AC_QUAT_Y)||(adrcode==AC_QUAT_Z)) {
- float tmat[4][4], trimat[3][3], localQuat[4];
-
- switch (adrcode) {
- case AC_QUAT_W:
- matindex=0;
- break;
- case AC_QUAT_X:
- matindex=1;
- break;
- case AC_QUAT_Y:
- matindex=2;
- break;
- case AC_QUAT_Z:
- matindex=3;
- break;
- }
-
- /* it should be reasonable to assume that we are keyframing on the active object, although it is not
- * strictly required for this particular space conversion, arg1 must not be null for this to work
- */
- Mat4CpyMat4(tmat, pchan->pose_mat);
- constraint_mat_convertspace(OBACT, pchan, tmat, CONSTRAINT_SPACE_POSE, CONSTRAINT_SPACE_LOCAL);
-
- Mat3CpyMat4(trimat, tmat);
- Mat3ToQuat_is_ok(trimat, localQuat);
- insertfloatkey(id, ID_PO, pchan->name, NULL, adrcode, localQuat[matindex]);
-
- return 1;
- }
- }
- }
- }
- /* failed to set a matrix key -- use traditional, but the non-recursing version */
- insertkey_nonrecurs(id,blocktype,actname,constname,adrcode);
- return 0;
-}
-
-static int match_adr_constraint(ID * id, int blocktype, char *actname, int adrcode)
-{ /* This function matches constraint blocks with adrcodes to see if the
- visual keying method should be used. For example, an object looking to key
- location and having a CopyLoc constraint would return true. */
-
- Object *ob=NULL;
- int foundmatch=0;
- int searchtype=0;
- bConstraint *conref=NULL, *con=NULL;
-
- /*Retrieve constraint list*/
- if( GS(id->name)==ID_OB )
- ob= (Object *)id;
- if (ob) {
- if (blocktype==ID_PO) {
- bPoseChannel *pchan= get_pose_channel(ob->pose, actname);
- conref=pchan->constraints.first;
- } else if (blocktype==ID_OB) {
- conref=ob->constraints.first;
- }
-
- if (conref) {
- /*Set search type: 1 is for translation contraints, 2 is for rotation*/
- if ((adrcode==OB_LOC_X)||(adrcode==OB_LOC_Y)||(adrcode==OB_LOC_Z)||(adrcode==AC_LOC_X)||(adrcode==AC_LOC_Y)||(adrcode==AC_LOC_Z)) {
- searchtype=1;
- } else if ((adrcode==OB_ROT_X)||(adrcode==OB_ROT_Y)||(adrcode==OB_ROT_Z)||(adrcode==AC_QUAT_W)||(adrcode==AC_QUAT_X)||(adrcode==AC_QUAT_Y)||(adrcode==AC_QUAT_Z)) {
- searchtype=2;
- }
-
- if (searchtype>0) {
- for (con=conref; (con)&&(foundmatch==0); con=con->next) {
- switch (con->type) {
- /* match constraint types to which kinds of keying they would affect */
- case CONSTRAINT_TYPE_CHILDOF:
- foundmatch=1;
- break;
- case CONSTRAINT_TYPE_TRACKTO:
- if (searchtype==2) foundmatch=1;
- break;
- case CONSTRAINT_TYPE_FOLLOWPATH:
- foundmatch=1;
- break;
- case CONSTRAINT_TYPE_ROTLIMIT:
- if (searchtype==2) foundmatch=1;
- break;
- case CONSTRAINT_TYPE_LOCLIMIT:
- if (searchtype==1) foundmatch=1;
- break;
- case CONSTRAINT_TYPE_ROTLIKE:
- if (searchtype==2) foundmatch=1;
- break;
- case CONSTRAINT_TYPE_LOCLIKE:
- if (searchtype==1) foundmatch=1;
- break;
- case CONSTRAINT_TYPE_LOCKTRACK:
- if (searchtype==2) foundmatch=1;
- break;
- case CONSTRAINT_TYPE_DISTANCELIMIT:
- if (searchtype==1) foundmatch=1;
- break;
- case CONSTRAINT_TYPE_MINMAX:
- if (searchtype==1) foundmatch=1;
- break;
- case CONSTRAINT_TYPE_TRANSFORM:
- foundmatch=1;
- break;
- default:
- break;
- }
- }
- }
- }
- }
-
- return foundmatch;
-
-}
-
-void insertkey(ID *id, int blocktype, char *actname, char *constname, int adrcode, short fast)
-{
- IpoCurve *icu;
- Object *ob;
- void *poin= NULL;
- float curval, cfra;
- int vartype;
- int matset=0;
-
- if ((G.flags&G_AUTOMATKEYS)&&(match_adr_constraint(id, blocktype, actname, adrcode))) {
- matset=insertmatrixkey(id, blocktype, actname, constname, adrcode);
- }
- if (matset==0) {
- icu= verify_ipocurve(id, blocktype, actname, constname, NULL, adrcode);
-
- if(icu) {
-
- poin= get_context_ipo_poin(id, blocktype, actname, icu, &vartype);
-
- if(poin) {
- curval= read_ipo_poin(poin, vartype);
-
- cfra= frame_to_float(CFRA);
-
- /* if action is mapped in NLA, it returns a correction */
- if(actname && actname[0] && GS(id->name)==ID_OB)
- cfra= get_action_frame((Object *)id, cfra);
-
- if( GS(id->name)==ID_OB ) {
- ob= (Object *)id;
- if(ob->sf!=0.0 && (ob->ipoflag & OB_OFFS_OB) ) {
- /* actually frametofloat calc again! */
- cfra-= ob->sf*G.scene->r.framelen;
- }
- }
-
- insert_vert_icu(icu, cfra, curval, fast);
- }
- }
- }
-}
-
-
-
-/* This function is a 'smarter' version of the insert key code.
- * It uses an auxilliary function to check whether a keyframe is really needed */
-void insertkey_smarter(ID *id, int blocktype, char *actname, char *constname, int adrcode)
-{
- IpoCurve *icu;
- Object *ob;
- void *poin= NULL;
- float curval, cfra;
- int vartype;
- int insert_mode;
-
- icu= verify_ipocurve(id, blocktype, actname, constname, NULL, adrcode);
-
- if(icu) {
-
- poin= get_context_ipo_poin(id, blocktype, actname, icu, &vartype);
-
- if(poin) {
- curval= read_ipo_poin(poin, vartype);
-
- cfra= frame_to_float(CFRA);
-
- /* if action is mapped in NLA, it returns a correction */
- if(actname && actname[0] && GS(id->name)==ID_OB)
- cfra= get_action_frame((Object *)id, cfra);
-
- if( GS(id->name)==ID_OB ) {
- ob= (Object *)id;
- if(ob->sf!=0.0 && (ob->ipoflag & OB_OFFS_OB) ) {
- /* actually frametofloat calc again! */
- cfra-= ob->sf*G.scene->r.framelen;
- }
- }
-
- /* check whether this curve really needs a new keyframe */
- insert_mode= new_key_needed(icu, cfra, curval);
-
- /* insert new keyframe at current frame */
- if (insert_mode)
- insert_vert_icu(icu, cfra, curval, 0);
-
- /* delete keyframe immediately before/after newly added */
- switch (insert_mode) {
- case KEYNEEDED_DELPREV:
- delete_icu_key(icu, icu->totvert-2);
- break;
- case KEYNEEDED_DELNEXT:
- delete_icu_key(icu, 1);
- break;
- }
- }
- }
-}
-
-/* For inserting keys based on an arbitrary float value */
-void insertfloatkey(ID *id, int blocktype, char *actname, char *constname, int adrcode, float floatkey)
-{
- IpoCurve *icu;
- Object *ob;
- void *poin= NULL;
- float cfra;
- int vartype;
-
- icu= verify_ipocurve(id, blocktype, actname, constname, NULL, adrcode);
-
- if(icu) {
-
- poin= get_context_ipo_poin(id, blocktype, actname, icu, &vartype);
-
- if(poin) {
-
- cfra= frame_to_float(CFRA);
-
- /* if action is mapped in NLA, it returns a correction */
- if(actname && actname[0] && GS(id->name)==ID_OB)
- cfra= get_action_frame((Object *)id, cfra);
-
- if( GS(id->name)==ID_OB ) {
- ob= (Object *)id;
- if(ob->sf!=0.0 && (ob->ipoflag & OB_OFFS_OB) ) {
- /* actually frametofloat calc again! */
- cfra-= ob->sf*G.scene->r.framelen;
- }
- }
-
- /* insert new keyframe at current frame */
- insert_vert_icu(icu, cfra, floatkey, 0);
- }
- }
-}
-
-void insertkey_editipo(void)
-{
- EditIpo *ei;
- IpoKey *ik;
- ID *id;
- float *fp, cfra, *insertvals;
- int a, nr, ok, tot;
- short event;
-
- ei= get_active_editipo();
- if(ei && ei->icu && ei->icu->driver)
- event= pupmenu("Insert Curve %t|Default one-to-one mapping %x3");
- else if(G.sipo->showkey)
- event= pupmenu("Insert Key Vertices %t|Current Frame %x1|Selected Keys %x2");
- else
- event= pupmenu("Insert Key Vertices %t|Current Frame %x1");
-
- if(event<1) return;
-
- if(event==3) {
- IpoDriver *driver= ei->icu->driver;
-
- if(ei->icu->bezt) MEM_freeN(ei->icu->bezt);
- ei->icu->totvert= 0;
- ei->icu->bezt= NULL;
-
- insert_vert_icu(ei->icu, 0.0f, 0.0f, 0);
-
- if(ELEM3(driver->adrcode, OB_ROT_X, OB_ROT_Y, OB_ROT_Z)) {
- if(ei->disptype==IPO_DISPDEGR)
- insert_vert_icu(ei->icu, 18.0f, 18.0f, 0);
- else
- insert_vert_icu(ei->icu, 18.0f, 1.0f, 0);
- }
- else
- insert_vert_icu(ei->icu, 1.0f, 1.0f, 0);
-
- ei->flag |= IPO_SELECT|IPO_VISIBLE;
- ei->icu->flag= ei->flag;
- ei->icu->extrap= IPO_DIR;
-
- do_ipo_buttons(B_IPOHOME);
- }
- else {
- ei= G.sipo->editipo;
- for(nr=0; nr<G.sipo->totipo; nr++, ei++) {
- if (ISPOIN(ei, flag & IPO_VISIBLE, icu)) {
-
- ok= 0;
- if(G.sipo->showkey) ok= 1;
- else if(ei->flag & IPO_SELECT) ok= 1;
-
- if(ok) {
- /* count amount */
- if(event==1) tot= 1;
- else {
- ik= G.sipo->ipokey.first;
- tot= 0;
- while(ik) {
- if(ik->flag & 1) tot++;
- ik= ik->next;
- }
- }
- if(tot) {
-
- /* correction for ob timeoffs */
- cfra= frame_to_float(CFRA);
- id= G.sipo->from;
- if(id && GS(id->name)==ID_OB ) {
- Object *ob= (Object *)id;
- if(ob->sf!=0.0 && (ob->ipoflag & OB_OFFS_OB) ) {
- cfra-= ob->sf*G.scene->r.framelen;
- }
- }
- else if(id && GS(id->name)==ID_SEQ) {
- Sequence *last_seq = get_last_seq(); /* editsequence.c */
-
- if(last_seq && (last_seq->flag & SEQ_IPO_FRAME_LOCKED) == 0) {
- cfra= (float)(100.0*(cfra-last_seq->startdisp)/((float)(last_seq->enddisp-last_seq->startdisp)));
- }
- }
-
- /* convert cfra to ipo-time */
- if (NLA_IPO_SCALED) {
- cfra= get_action_frame(OBACT, cfra);
- }
-
- insertvals= MEM_mallocN(sizeof(float)*2*tot, "insertkey_editipo");
- /* make sure icu->curval is correct */
- calc_ipo(G.sipo->ipo, cfra);
-
- if(event==1) {
- insertvals[0]= cfra;
-
- insertvals[1]= ei->icu->curval;
- }
- else {
- fp= insertvals;
- ik= G.sipo->ipokey.first;
- while(ik) {
- if(ik->flag & 1) {
- calc_ipo(G.sipo->ipo, ik->val);
-
- fp[0]= ik->val;
- fp[1]= ei->icu->curval;
- fp+= 2;
- }
- ik= ik->next;
- }
- }
- fp= insertvals;
- for(a=0; a<tot; a++, fp+=2) {
- insert_vert_icu(ei->icu, fp[0], fp[1], 0);
- }
-
- MEM_freeN(insertvals);
- calc_ipo(G.sipo->ipo, (float)CFRA);
- }
- }
- }
- }
- }
- BIF_undo_push("Insert Key Ipo");
- allqueue (REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWIPO, 0);
- allspace(REMAKEIPO, 0);
-}
-
-
-void common_insertkey(void)
-{
- Base *base;
- Object *ob;
- Material *ma;
- ID *id;
- IpoCurve *icu;
- World *wo;
- Lamp *la;
- Tex *te;
- int tlay, map, event;
- char menustr[256];
-
- if(curarea->spacetype==SPACE_IPO) {
- insertkey_editipo();
- }
- else if(curarea->spacetype==SPACE_ACTION) {
- insertkey_action();
- }
- else if(curarea->spacetype==SPACE_BUTS) {
- if(G.buts->mainb==CONTEXT_SHADING) {
- int tab= G.buts->tab[CONTEXT_SHADING];
-
- if(tab==TAB_SHADING_MAT) {
- ma = G.buts->lockpoin;
- ma = editnode_get_active_material(ma);
- id = (ID *)ma;
-
- if(id) {
- event= pupmenu("Insert Key %t|RGB%x0|Alpha%x1|Halo Size%x2|Mode %x3|All Color%x10|All Mirror%x14|Ofs%x12|Size%x13|All Mapping%x11");
- if(event== -1) return;
-
- map= texchannel_to_adrcode(ma->texact);
-
- if(event==0 || event==10) {
- insertkey(id, ID_MA, NULL, NULL, MA_COL_R, 0);
- insertkey(id, ID_MA, NULL, NULL, MA_COL_G, 0);
- insertkey(id, ID_MA, NULL, NULL, MA_COL_B, 0);
- }
- if(event==1 || event==10) {
- insertkey(id, ID_MA, NULL, NULL, MA_ALPHA, 0);
- }
- if(event==2 || event==10) {
- insertkey(id, ID_MA, NULL, NULL, MA_HASIZE, 0);
- }
- if(event==3 || event==10) {
- insertkey(id, ID_MA, NULL, NULL, MA_MODE, 0);
- }
- if(event==10) {
- insertkey(id, ID_MA, NULL, NULL, MA_SPEC_R, 0);
- insertkey(id, ID_MA, NULL, NULL, MA_SPEC_G, 0);
- insertkey(id, ID_MA, NULL, NULL, MA_SPEC_B, 0);
- insertkey(id, ID_MA, NULL, NULL, MA_REF, 0);
- insertkey(id, ID_MA, NULL, NULL, MA_EMIT, 0);
- insertkey(id, ID_MA, NULL, NULL, MA_AMB, 0);
- insertkey(id, ID_MA, NULL, NULL, MA_SPEC, 0);
- insertkey(id, ID_MA, NULL, NULL, MA_HARD, 0);
- insertkey(id, ID_MA, NULL, NULL, MA_MODE, 0);
- insertkey(id, ID_MA, NULL, NULL, MA_TRANSLU, 0);
- insertkey(id, ID_MA, NULL, NULL, MA_ADD, 0);
- }
- if(event==14) {
- insertkey(id, ID_MA, NULL, NULL, MA_RAYM, 0);
- insertkey(id, ID_MA, NULL, NULL, MA_FRESMIR, 0);
- insertkey(id, ID_MA, NULL, NULL, MA_FRESMIRI, 0);
- insertkey(id, ID_MA, NULL, NULL, MA_FRESTRA, 0);
- insertkey(id, ID_MA, NULL, NULL, MA_FRESTRAI, 0);
- }
- if(event==12 || event==11) {
- insertkey(id, ID_MA, NULL, NULL, map+MAP_OFS_X, 0);
- insertkey(id, ID_MA, NULL, NULL, map+MAP_OFS_Y, 0);
- insertkey(id, ID_MA, NULL, NULL, map+MAP_OFS_Z, 0);
- }
- if(event==13 || event==11) {
- insertkey(id, ID_MA, NULL, NULL, map+MAP_SIZE_X, 0);
- insertkey(id, ID_MA, NULL, NULL, map+MAP_SIZE_Y, 0);
- insertkey(id, ID_MA, NULL, NULL, map+MAP_SIZE_Z, 0);
- }
- if(event==11) {
- insertkey(id, ID_MA, NULL, NULL, map+MAP_R, 0);
- insertkey(id, ID_MA, NULL, NULL, map+MAP_G, 0);
- insertkey(id, ID_MA, NULL, NULL, map+MAP_B, 0);
- insertkey(id, ID_MA, NULL, NULL, map+MAP_DVAR, 0);
- insertkey(id, ID_MA, NULL, NULL, map+MAP_COLF, 0);
- insertkey(id, ID_MA, NULL, NULL, map+MAP_NORF, 0);
- insertkey(id, ID_MA, NULL, NULL, map+MAP_VARF, 0);
- insertkey(id, ID_MA, NULL, NULL, map+MAP_DISP, 0);
- }
- }
- }
- else if(tab==TAB_SHADING_WORLD) {
- id= G.buts->lockpoin;
- wo= G.buts->lockpoin;
- if(id) {
- event= pupmenu("Insert Key %t|Zenith RGB%x0|Horizon RGB%x1|Mist%x2|Stars %x3|Offset%x12|Size%x13");
- if(event== -1) return;
-
- map= texchannel_to_adrcode(wo->texact);
-
- if(event==0) {
- insertkey(id, ID_WO, NULL, NULL, WO_ZEN_R, 0);
- insertkey(id, ID_WO, NULL, NULL, WO_ZEN_G, 0);
- insertkey(id, ID_WO, NULL, NULL, WO_ZEN_B, 0);
- }
- if(event==1) {
- insertkey(id, ID_WO, NULL, NULL, WO_HOR_R, 0);
- insertkey(id, ID_WO, NULL, NULL, WO_HOR_G, 0);
- insertkey(id, ID_WO, NULL, NULL, WO_HOR_B, 0);
- }
- if(event==2) {
- insertkey(id, ID_WO, NULL, NULL, WO_MISI, 0);
- insertkey(id, ID_WO, NULL, NULL, WO_MISTDI, 0);
- insertkey(id, ID_WO, NULL, NULL, WO_MISTSTA, 0);
- insertkey(id, ID_WO, NULL, NULL, WO_MISTHI, 0);
- }
- if(event==3) {
- insertkey(id, ID_WO, NULL, NULL, WO_STAR_R, 0);
- insertkey(id, ID_WO, NULL, NULL, WO_STAR_G, 0);
- insertkey(id, ID_WO, NULL, NULL, WO_STAR_B, 0);
- insertkey(id, ID_WO, NULL, NULL, WO_STARDIST, 0);
- insertkey(id, ID_WO, NULL, NULL, WO_STARSIZE, 0);
- }
- if(event==12) {
- insertkey(id, ID_WO, NULL, NULL, map+MAP_OFS_X, 0);
- insertkey(id, ID_WO, NULL, NULL, map+MAP_OFS_Y, 0);
- insertkey(id, ID_WO, NULL, NULL, map+MAP_OFS_Z, 0);
- }
- if(event==13) {
- insertkey(id, ID_WO, NULL, NULL, map+MAP_SIZE_X, 0);
- insertkey(id, ID_WO, NULL, NULL, map+MAP_SIZE_Y, 0);
- insertkey(id, ID_WO, NULL, NULL, map+MAP_SIZE_Z, 0);
- }
- }
- }
- else if(tab==TAB_SHADING_LAMP) {
- id= G.buts->lockpoin;
- la= G.buts->lockpoin;
- if(id) {
- event= pupmenu("Insert Key %t|RGB%x0|Energy%x1|Spot Size%x2|Offset%x12|Size%x13");
- if(event== -1) return;
-
- map= texchannel_to_adrcode(la->texact);
-
- if(event==0) {
- insertkey(id, ID_LA, NULL, NULL, LA_COL_R, 0);
- insertkey(id, ID_LA, NULL, NULL, LA_COL_G, 0);
- insertkey(id, ID_LA, NULL, NULL, LA_COL_B, 0);
- }
- if(event==1) {
- insertkey(id, ID_LA, NULL, NULL, LA_ENERGY, 0);
- }
- if(event==2) {
- insertkey(id, ID_LA, NULL, NULL, LA_SPOTSI, 0);
- }
- if(event==12) {
- insertkey(id, ID_LA, NULL, NULL, map+MAP_OFS_X, 0);
- insertkey(id, ID_LA, NULL, NULL, map+MAP_OFS_Y, 0);
- insertkey(id, ID_LA, NULL, NULL, map+MAP_OFS_Z, 0);
- }
- if(event==13) {
- insertkey(id, ID_LA, NULL, NULL, map+MAP_SIZE_X, 0);
- insertkey(id, ID_LA, NULL, NULL, map+MAP_SIZE_Y, 0);
- insertkey(id, ID_LA, NULL, NULL, map+MAP_SIZE_Z, 0);
- }
-
- }
- }
- else if(tab==TAB_SHADING_TEX) {
- id= G.buts->lockpoin;
- te= G.buts->lockpoin;
- if(id) {
- event= pupmenu("Insert Key %t|Clouds%x0|Marble%x1|Stucci%x2|Wood%x3|Magic%x4|Blend%x5|Musgrave%x6|Voronoi%x7|DistortedNoise%x8|ColorFilter%x9");
- if(event== -1) return;
-
- if(event==0) {
- insertkey(id, ID_TE, NULL, NULL, TE_NSIZE, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_NDEPTH, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_NTYPE, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_MG_TYP, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_N_BAS1, 0);
- }
- if(event==1) {
- insertkey(id, ID_TE, NULL, NULL, TE_NSIZE, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_NDEPTH, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_NTYPE, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_TURB, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_MG_TYP, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_N_BAS1, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_N_BAS2, 0);
- }
- if(event==2) {
- insertkey(id, ID_TE, NULL, NULL, TE_NSIZE, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_NTYPE, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_TURB, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_MG_TYP, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_N_BAS1, 0);
- }
- if(event==3) {
- insertkey(id, ID_TE, NULL, NULL, TE_NSIZE, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_NTYPE, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_TURB, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_MG_TYP, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_N_BAS1, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_N_BAS2, 0);
- }
- if(event==4) {
- insertkey(id, ID_TE, NULL, NULL, TE_NDEPTH, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_TURB, 0);
- }
- if(event==5) {
- insertkey(id, ID_TE, NULL, NULL, TE_MG_TYP, 0);
- }
- if(event==6) {
- insertkey(id, ID_TE, NULL, NULL, TE_MG_TYP, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_MGH, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_MG_LAC, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_MG_OCT, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_MG_OFF, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_MG_GAIN, 0);
- }
- if(event==7) {
- insertkey(id, ID_TE, NULL, NULL, TE_VNW1, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_VNW2, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_VNW3, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_VNW4, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_VNMEXP, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_VN_DISTM, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_VN_COLT, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_ISCA, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_NSIZE, 0);
- }
- if(event==8) {
- insertkey(id, ID_TE, NULL, NULL, TE_MG_OCT, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_MG_OFF, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_MG_GAIN, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_DISTA, 0);
- }
- if(event==9) {
- insertkey(id, ID_TE, NULL, NULL, TE_COL_R, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_COL_G, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_COL_B, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_BRIGHT, 0);
- insertkey(id, ID_TE, NULL, NULL, TE_CONTRA, 0);
- }
- }
- }
- }
- else if(G.buts->mainb==CONTEXT_OBJECT) {
- ob= OBACT;
- if(ob) {
- id= (ID *) (ob);
- if(id) {
- if(ob->type==OB_MESH)
- event= pupmenu("Insert Key %t|Surface Damping%x0|Random Damping%x1|Permeability%x2|Force Strength%x3|Force Falloff%x4");
- else
- event= pupmenu("Insert Key %t|Force Strength%x3|Force Falloff%x4");
- if(event == -1) return;
-
- if(event==0) {
- insertkey(id, ID_OB, NULL, NULL, OB_PD_SDAMP, 0);
- }
- if(event==1) {
- insertkey(id, ID_OB, NULL, NULL, OB_PD_RDAMP, 0);
- }
- if(event==2) {
- insertkey(id, ID_OB, NULL, NULL, OB_PD_PERM, 0);
- }
- if(event==3) {
- insertkey(id, ID_OB, NULL, NULL, OB_PD_FSTR, 0);
- }
- if(event==4) {
- insertkey(id, ID_OB, NULL, NULL, OB_PD_FFALL, 0);
- }
- if(event==5) {
- insertkey(id, ID_OB, NULL, NULL, OB_PD_FMAXD, 0);
- }
- }
- }
- }
- else if(G.buts->mainb==CONTEXT_EDITING) {
- ob= OBACT;
- if(ob && ob->type==OB_CAMERA) {
- id= G.buts->lockpoin;
- if(id) {
- /* yafray: insert key extended with aperture and focal distance */
- /* qdn: FocalDistance now enabled for Blender as wel, for use with defocus node */
- if (G.scene->r.renderer==R_INTERN)
- event= pupmenu("Insert Key %t|Lens%x0|Clipping%x1|FocalDistance%x3|Viewplane Shift%x4");
- else
- event= pupmenu("Insert Key %t|Lens%x0|Clipping%x1|Aperture%x2|FocalDistance%x3");
- if(event== -1) return;
-
- if(event==0) {
- insertkey(id, ID_CA, NULL, NULL, CAM_LENS, 0);
- }
- else if(event==1) {
- insertkey(id, ID_CA, NULL, NULL, CAM_STA, 0);
- insertkey(id, ID_CA, NULL, NULL, CAM_END, 0);
- }
- else if(event==2) {
- insertkey(id, ID_CA, NULL, NULL, CAM_YF_APERT, 0);
- }
- else if(event==3) {
- insertkey(id, ID_CA, NULL, NULL, CAM_YF_FDIST, 0);
- }
- else if(event==4) {
- insertkey(id, ID_CA, NULL, NULL, CAM_SHIFT_X, 0);
- insertkey(id, ID_CA, NULL, NULL, CAM_SHIFT_Y, 0);
- }
- }
- }
- }
- else if(FALSE /* && G.buts->mainb==BUTS_SOUND */) {
- if(G.ssound) {
- id= G.buts->lockpoin;
- if(id) {
- event= pupmenu("Insert Key %t|Volume%x0|Pitch%x1|Panning%x2|Attennuation%x3");
- if(event== -1) return;
-
- if(event==0) {
- insertkey(id, ID_SO, NULL, NULL, SND_VOLUME, 0);
- }
- if(event==1) {
- insertkey(id, ID_SO, NULL, NULL, SND_PITCH, 0);
- }
- if(event==2) {
- insertkey(id, ID_SO, NULL, NULL, SND_PANNING, 0);
- }
- if(event==3) {
- insertkey(id, ID_SO, NULL, NULL, SND_ATTEN, 0);
- }
- }
- }
- }
-
- BIF_undo_push("Insert Key Buttons");
-
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWIPO, 0);
- allspace(REMAKEIPO, 0);
-
- }
- else if(curarea->spacetype==SPACE_VIEW3D) {
- ob= OBACT;
-
- if (ob && (ob->flag & OB_POSEMODE)) {
- bPoseChannel *pchan;
-
- set_pose_keys(ob); /* sets pchan->flag to POSE_KEY if bone selected, and clears if not */
- for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next)
- if (pchan->flag & POSE_KEY)
- break;
- if(pchan==NULL) return;
- strcpy(menustr, "Insert Key%t|Loc%x0|Rot%x1|Scale%x2|LocRot%x3|LocRotScale%x4|Avail%x9|Needed%x15|VisualLoc%x11|VisualRot%x12|VisualLocRot%x13");
- }
- else {
- base= FIRSTBASE;
- while(base) {
- if (TESTBASELIB(base)) break;
- base= base->next;
- }
- if(base==NULL) return;
- strcpy(menustr, "Insert Key%t|Loc%x0|Rot%x1|Scale%x2|LocRot%x3|LocRotScale%x4|Layer%x5|Avail%x9|Needed%x15|VisualLoc%x11|VisualRot%x12|VisualLocRot%x13");
- }
-
- if(ob) {
- if(ob->type==OB_MESH) strcat(menustr, "| %x6|Mesh%x7");
- else if(ob->type==OB_LATTICE) strcat(menustr, "| %x6|Lattice%x7");
- else if(ob->type==OB_CURVE) strcat(menustr, "| %x6|Curve%x7");
- else if(ob->type==OB_SURF) strcat(menustr, "| %x6|Surface%x7");
- }
-
- event= pupmenu(menustr);
- if(event== -1) return;
-
- if(event==7) { // ob != NULL
- insert_shapekey(ob);
- return;
- }
-
- if (ob && (ob->flag & OB_POSEMODE)){
- bPoseChannel *pchan;
- short recalc_bonepaths= 0;
-
- if (ob->action && ob->action->id.lib) {
- error ("Can't key libactions");
- return;
- }
-
- id= &ob->id;
- for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next) {
- if (pchan->flag & POSE_KEY) {
- /* insert relevant keyframes */
- if(event==0 || event==3 ||event==4) {
- insertkey(id, ID_PO, pchan->name, NULL, AC_LOC_X, 0);
- insertkey(id, ID_PO, pchan->name, NULL, AC_LOC_Y, 0);
- insertkey(id, ID_PO, pchan->name, NULL, AC_LOC_Z, 0);
- }
- if(event==1 || event==3 || event==4) {
- insertkey(id, ID_PO, pchan->name, NULL, AC_QUAT_X, 0);
- insertkey(id, ID_PO, pchan->name, NULL, AC_QUAT_Y, 0);
- insertkey(id, ID_PO, pchan->name, NULL, AC_QUAT_Z, 0);
- insertkey(id, ID_PO, pchan->name, NULL, AC_QUAT_W, 0);
- }
- if(event==2 || event==4) {
- insertkey(id, ID_PO, pchan->name, NULL, AC_SIZE_X, 0);
- insertkey(id, ID_PO, pchan->name, NULL, AC_SIZE_Y, 0);
- insertkey(id, ID_PO, pchan->name, NULL, AC_SIZE_Z, 0);
- }
- if (event==9 && ob->action) {
- bActionChannel *achan;
-
- for (achan = ob->action->chanbase.first; achan; achan=achan->next){
- if (achan->ipo && !strcmp (achan->name, pchan->name)){
- for (icu = achan->ipo->curve.first; icu; icu=icu->next){
- insertkey(id, ID_PO, achan->name, NULL, icu->adrcode, 0);
- }
- break;
- }
- }
- }
- if(event==11 || event==13) {
- int matok=0;
- /* check one to make sure we're not trying to set visual loc keys on
- bones inside of a chain, which only leads to tears. */
- matok= insertmatrixkey(id, ID_PO, pchan->name, NULL, AC_LOC_X);
- insertmatrixkey(id, ID_PO, pchan->name, NULL, AC_LOC_Y);
- insertmatrixkey(id, ID_PO, pchan->name, NULL, AC_LOC_Z);
-
- if (matok == 0) {
- insertkey(id, ID_PO, pchan->name, NULL, AC_LOC_X, 0);
- insertkey(id, ID_PO, pchan->name, NULL, AC_LOC_Y, 0);
- insertkey(id, ID_PO, pchan->name, NULL, AC_LOC_Z, 0);
- }
- }
- if(event==12 || event==13) {
- int matok=0;
- /* check one to make sure we're not trying to set visual rot keys on
- bones inside of a chain, which only leads to tears. */
- matok= insertmatrixkey(id, ID_PO, pchan->name, NULL, AC_QUAT_W);
- insertmatrixkey(id, ID_PO, pchan->name, NULL, AC_QUAT_X);
- insertmatrixkey(id, ID_PO, pchan->name, NULL, AC_QUAT_Y);
- insertmatrixkey(id, ID_PO, pchan->name, NULL, AC_QUAT_Z);
-
- if (matok == 0) {
- insertkey(id, ID_PO, pchan->name, NULL, AC_QUAT_W, 0);
- insertkey(id, ID_PO, pchan->name, NULL, AC_QUAT_X, 0);
- insertkey(id, ID_PO, pchan->name, NULL, AC_QUAT_Y, 0);
- insertkey(id, ID_PO, pchan->name, NULL, AC_QUAT_Z, 0);
- }
- }
- if (event==15 && ob->action) {
- bActionChannel *achan;
-
- for (achan = ob->action->chanbase.first; achan; achan=achan->next){
- if (achan->ipo && !strcmp (achan->name, pchan->name)){
- for (icu = achan->ipo->curve.first; icu; icu=icu->next){
- insertkey_smarter(id, ID_PO, achan->name, NULL, icu->adrcode);
- }
- break;
- }
- }
- }
-
- /* clear unkeyed flag (it doesn't matter if it's set or not) */
- if (pchan->bone)
- pchan->bone->flag &= ~BONE_UNKEYED;
-
- /* check if bone has a path */
- if (pchan->path)
- recalc_bonepaths = 1;
- }
- }
-
- /* recalculate ipo handles, etc. */
- if(ob->action)
- remake_action_ipos(ob->action);
-
- /* recalculate bone-paths on adding new keyframe? */
- // TODO: currently, there is no setting to turn this on/off globally
- if (recalc_bonepaths)
- pose_recalculate_paths(ob);
-
-
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- }
- else {
- base= FIRSTBASE;
- while(base) {
- if (TESTBASELIB(base)) {
- char *actname= NULL;
-
- id= (ID *)(base->object);
-
- if(base->object->ipoflag & OB_ACTION_OB)
- actname= "Object";
-
- /* all curves in ipo deselect */
- if(base->object->ipo || base->object->action) {
- if (base->object->ipo) {
- icu= base->object->ipo->curve.first;
- }
- else {
- bActionChannel *achan;
- achan= get_action_channel(base->object->action, actname);
-
- if (achan && achan->ipo)
- icu= achan->ipo->curve.first;
- else
- icu= NULL;
- }
-
- while(icu) {
- icu->flag &= ~IPO_SELECT;
-
- switch (event) {
- case 9:
- insertkey(id, ID_OB, actname, NULL, icu->adrcode, 0);
- break;
- case 15:
- insertkey_smarter(id, ID_OB, actname, NULL, icu->adrcode);
- break;
- }
- icu= icu->next;
- }
- }
-
- if(event==0 || event==3 ||event==4) {
- insertkey(id, ID_OB, actname, NULL, OB_LOC_X, 0);
- insertkey(id, ID_OB, actname, NULL, OB_LOC_Y, 0);
- insertkey(id, ID_OB, actname, NULL, OB_LOC_Z, 0);
- }
- if(event==1 || event==3 ||event==4) {
- insertkey(id, ID_OB, actname, NULL, OB_ROT_X, 0);
- insertkey(id, ID_OB, actname, NULL, OB_ROT_Y, 0);
- insertkey(id, ID_OB, actname, NULL, OB_ROT_Z, 0);
- }
- if(event==2 || event==4) {
- insertkey(id, ID_OB, actname, NULL, OB_SIZE_X, 0);
- insertkey(id, ID_OB, actname, NULL, OB_SIZE_Y, 0);
- insertkey(id, ID_OB, actname, NULL, OB_SIZE_Z, 0);
- }
- if(event==5) {
- /* remove localview */
- tlay= base->object->lay;
- base->object->lay &= 0xFFFFFF;
- insertkey(id, ID_OB, actname, NULL, OB_LAY, 0);
- base->object->lay= tlay;
- }
- if(event==11 || event==13) {
- insertmatrixkey(id, ID_OB, actname, NULL, OB_LOC_X);
- insertmatrixkey(id, ID_OB, actname, NULL, OB_LOC_Y);
- insertmatrixkey(id, ID_OB, actname, NULL, OB_LOC_Z);
- }
- if(event==12 || event==13) {
- insertmatrixkey(id, ID_OB, actname, NULL, OB_ROT_X);
- insertmatrixkey(id, ID_OB, actname, NULL, OB_ROT_Y);
- insertmatrixkey(id, ID_OB, actname, NULL, OB_ROT_Z);
- }
- base->object->recalc |= OB_RECALC_OB;
- }
- base= base->next;
- }
- }
-
- if(event==0) BIF_undo_push("Insert Loc Key");
- else if(event==1) BIF_undo_push("Insert Rot Key");
- else if(event==2) BIF_undo_push("Insert Scale Key");
- else if(event==3) BIF_undo_push("Insert LocRot Key");
- else if(event==4) BIF_undo_push("Insert LocRotScale Key");
- else if(event==5) BIF_undo_push("Insert Layer Key");
- else if(event==7) BIF_undo_push("Insert Vertex Key");
- else if(event==9) BIF_undo_push("Insert Avail Key");
- else if(event==11) BIF_undo_push("Insert VisualLoc Key");
- else if(event==12) BIF_undo_push("Insert VisualRot Key");
- else if(event==13) BIF_undo_push("Insert VisualLocRot Key");
- else if(event==15) BIF_undo_push("Insert Needed Key");
-
- DAG_scene_flush_update(G.scene, screen_view3d_layers());
-
- allspace(REMAKEIPO, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- }
-
-}
-
-/* ****************************************************************************** */
-
-void add_duplicate_editipo(void)
-{
- Object *ob;
- EditIpo *ei;
- IpoCurve *icu;
- BezTriple *bezt, *beztn, *newb;
- int tot, a, b;
-
- get_status_editipo();
- if(totipo_vertsel==0) return;
-
- ei= G.sipo->editipo;
- for(a=0; a<G.sipo->totipo; a++, ei++) {
- if (ISPOIN3(ei, flag & IPO_VISIBLE, icu, icu->bezt)) {
- if(G.sipo->showkey || (ei->flag & IPO_EDIT)) {
- icu= ei->icu;
-
- /* how many points */
- tot= 0;
- b= icu->totvert;
- bezt= icu->bezt;
- while(b--) {
- if(bezt->f2 & SELECT) tot++;
- bezt++;
- }
-
- if(tot) {
- icu->totvert+= tot;
- newb= beztn= MEM_mallocN(icu->totvert*sizeof(BezTriple), "bezt");
- bezt= icu->bezt;
- b= icu->totvert-tot;
- while(b--) {
- *beztn= *bezt;
- if(bezt->f2 & SELECT) {
- beztn->f1= beztn->f2= beztn->f3= 0;
- beztn++;
- *beztn= *bezt;
- }
- beztn++;
- bezt++;
- }
- MEM_freeN(icu->bezt);
- icu->bezt= newb;
-
- calchandles_ipocurve(icu);
- }
- }
- }
- }
-
- if(G.sipo->showkey) {
- make_ipokey();
- if(G.sipo->blocktype==ID_OB) {
- ob= OBACT;
- if(ob && (ob->ipoflag & OB_DRAWKEY)) allqueue(REDRAWVIEW3D, 0);
- }
- }
- BIF_undo_push("Duplicate Ipo");
- transform_ipo('g');
-}
-
-void remove_doubles_ipo(void)
-{
- EditIpo *ei;
- IpoKey *ik, *ikn;
- BezTriple *bezt, *newb, *new1;
- float val;
- int mode, a, b;
-
- ei= G.sipo->editipo;
- for(a=0; a<G.sipo->totipo; a++, ei++) {
- if (ISPOIN3(ei, flag & IPO_VISIBLE, icu, icu->bezt)) {
-
- /* OR the curve is selected OR in editmode OR in keymode */
- mode= 0;
- if(G.sipo->showkey || (ei->flag & IPO_EDIT)) mode= 1;
- else if(ei->flag & IPO_SELECT) mode= 2;
-
- if(mode) {
- bezt= ei->icu->bezt;
- newb= new1= MEM_mallocN(ei->icu->totvert*sizeof(BezTriple), "newbezt");
- *newb= *bezt;
- b= ei->icu->totvert-1;
- bezt++;
- while(b--) {
-
- /* can we remove? */
- if(mode==2 || (bezt->f2 & SELECT)) {
-
- /* are the points different? */
- if( fabs( bezt->vec[1][0]-newb->vec[1][0] ) > 0.9 ) {
- newb++;
- *newb= *bezt;
- }
- else {
- /* median */
- VecMidf(newb->vec[0], newb->vec[0], bezt->vec[0]);
- VecMidf(newb->vec[1], newb->vec[1], bezt->vec[1]);
- VecMidf(newb->vec[2], newb->vec[2], bezt->vec[2]);
-
- newb->h1= newb->h2= HD_FREE;
-
- ei->icu->totvert--;
- }
-
- }
- else {
- newb++;
- *newb= *bezt;
- }
- bezt++;
- }
-
- MEM_freeN(ei->icu->bezt);
- ei->icu->bezt= new1;
-
- calchandles_ipocurve(ei->icu);
- }
- }
- }
-
- editipo_changed(G.sipo, 1); /* makes ipokeys again! */
-
- /* remove double keys */
- if(G.sipo->showkey) {
- ik= G.sipo->ipokey.first;
- ikn= ik->next;
-
- while(ik && ikn) {
- if( (ik->flag & 1) && (ikn->flag & 1) ) {
- if( fabs(ik->val-ikn->val) < 0.9 ) {
- val= (float)((ik->val + ikn->val)/2.0);
-
- for(a=0; a<G.sipo->totipo; a++) {
- if(ik->data[a]) ik->data[a]->vec[1][0]= val;
- if(ikn->data[a]) ikn->data[a]->vec[1][0]= val;
- }
- }
- }
- ik= ikn;
- ikn= ikn->next;
-
- }
-
- editipo_changed(G.sipo, 1); /* makes ipokeys agian! */
-
- }
- deselectall_editipo();
-}
-
-
-void clean_ipo(void)
-{
- EditIpo *ei;
- short ok;
- int b;
-
- ok= fbutton(&G.scene->toolsettings->clean_thresh,
- 0.0000001f, 1.0, 0.001, 0.1,
- "Threshold");
- if (!ok) return;
-
- get_status_editipo();
-
- ei= G.sipo->editipo;
- for(b=0; b<G.sipo->totipo; b++, ei++) {
- if (ISPOIN3(ei, flag & IPO_VISIBLE, icu, icu->bezt)) {
-
- ok= 0;
- if(G.sipo->showkey) ok= 1;
- else if(totipo_vert && (ei->flag & IPO_EDIT)) ok= 2;
- else if(totipo_vert==0 && (ei->flag & IPO_SELECT)) ok= 3;
-
- if(ok) {
- /* only clean if ok */
- clean_ipo_curve(ei->icu);
- }
- }
- }
-
- editipo_changed(G.sipo, 1);
- BIF_undo_push("Clean IPO");
-}
-
-void clean_ipo_curve(IpoCurve *icu)
-{
- BezTriple *old_bezts, *bezt, *beztn;
- BezTriple *lastb;
- int totCount, i;
- float thresh;
-
- /* check if any points */
- if (icu == NULL || icu->totvert <= 1)
- return;
-
- /* get threshold for match-testing */
- thresh= G.scene->toolsettings->clean_thresh;
-
- /* make a copy of the old BezTriples, and clear IPO curve */
- old_bezts = icu->bezt;
- totCount = icu->totvert;
- icu->bezt = NULL;
- icu->totvert = 0;
-
- /* now insert first keyframe, as it should be ok */
- bezt = old_bezts;
- insert_vert_icu(icu, bezt->vec[1][0], bezt->vec[1][1], 0);
-
- /* Loop through BezTriples, comparing them. Skip any that do
- * not fit the criteria for "ok" points.
- */
- for (i=1; i<totCount; i++) {
- float prev[2], cur[2], next[2];
-
- /* get BezTriples and their values */
- if (i < (totCount - 1)) {
- beztn = (old_bezts + (i+1));
- next[0]= beztn->vec[1][0]; next[1]= beztn->vec[1][1];
- }
- else {
- beztn = NULL;
- next[0] = next[1] = 0.0f;
- }
- lastb= (icu->bezt + (icu->totvert - 1));
- bezt= (old_bezts + i);
-
- /* get references for quicker access */
- prev[0] = lastb->vec[1][0]; prev[1] = lastb->vec[1][1];
- cur[0] = bezt->vec[1][0]; cur[1] = bezt->vec[1][1];
-
- /* check if current bezt occurs at same time as last ok */
- if (IS_EQT(cur[0], prev[0], thresh)) {
- /* If there is a next beztriple, and if occurs at the same time, only insert
- * if there is a considerable distance between the points, and also if the
- * current is further away than the next one is to the previous.
- */
- if (beztn && (IS_EQT(cur[0], next[0], thresh)) &&
- (IS_EQT(next[1], prev[1], thresh)==0))
- {
- /* only add if current is further away from previous */
- if (cur[1] > next[1]) {
- if (IS_EQT(cur[1], prev[1], thresh) == 0) {
- /* add new keyframe */
- insert_vert_icu(icu, cur[0], cur[1], 0);
- }
- }
- }
- else {
- /* only add if values are a considerable distance apart */
- if (IS_EQT(cur[1], prev[1], thresh) == 0) {
- /* add new keyframe */
- insert_vert_icu(icu, cur[0], cur[1], 0);
- }
- }
- }
- else {
- /* checks required are dependent on whether this is last keyframe or not */
- if (beztn) {
- /* does current have same value as previous and next? */
- if (IS_EQT(cur[1], prev[1], thresh) == 0) {
- /* add new keyframe*/
- insert_vert_icu(icu, cur[0], cur[1], 0);
- }
- else if (IS_EQT(cur[1], next[1], thresh) == 0) {
- /* add new keyframe */
- insert_vert_icu(icu, cur[0], cur[1], 0);
- }
- }
- else {
- /* add if value doesn't equal that of previous */
- if (IS_EQT(cur[1], prev[1], thresh) == 0) {
- /* add new keyframe */
- insert_vert_icu(icu, cur[0], cur[1], 0);
- }
- }
- }
- }
-
- /* now free the memory used by the old BezTriples */
- if (old_bezts)
- MEM_freeN(old_bezts);
-}
-
-void smooth_ipo(void)
-{
- EditIpo *ei;
- short ok;
- int b;
-
- get_status_editipo();
-
- ei= G.sipo->editipo;
- for(b=0; b<G.sipo->totipo; b++, ei++) {
- if (ISPOIN3(ei, flag & IPO_VISIBLE, icu, icu->bezt)) {
-
- ok= 0;
- if(G.sipo->showkey) ok= 1;
- else if(totipo_vert && (ei->flag & IPO_EDIT)) ok= 2;
- else if(totipo_vert==0 && (ei->flag & IPO_SELECT)) ok= 3;
-
- if(ok) {
- IpoCurve *icu= ei->icu;
- BezTriple *bezt;
- float meanValSum = 0.0f, meanVal;
- float valDiff;
- int i, totSel = 0;
-
- /* check if enough points */
- if (icu->totvert >= 3) {
- /* first loop through - obtain average value */
- bezt= icu->bezt;
- for (i=1; i < icu->totvert; i++, bezt++) {
- if (BEZSELECTED(bezt)) {
- /* line point's handles up with point's vertical position */
- bezt->vec[0][1]= bezt->vec[2][1]= bezt->vec[1][1];
- if(bezt->h1==HD_AUTO || bezt->h1==HD_VECT) bezt->h1= HD_ALIGN;
- if(bezt->h2==HD_AUTO || bezt->h2==HD_VECT) bezt->h2= HD_ALIGN;
-
- /* add value to total */
- meanValSum += bezt->vec[1][1];
- totSel++;
- }
- }
-
- /* calculate mean value */
- meanVal= meanValSum / totSel;
-
- /* second loop through - update point positions */
- bezt= icu->bezt;
- for (i=0; i < icu->totvert; i++, bezt++) {
- if (BEZSELECTED(bezt)) {
- /* 1. calculate difference between the points
- * 2. move point half-way along that distance
- */
- if (bezt->vec[1][1] > meanVal) {
- /* bezt val above mean */
- valDiff= bezt->vec[1][1] - meanVal;
- bezt->vec[1][1]= meanVal + (valDiff / 2);
- }
- else {
- /* bezt val below mean */
- valDiff= meanVal - bezt->vec[1][1];
- bezt->vec[1][1] = bezt->vec[1][1] + (valDiff / 2);
- }
- }
- }
- }
-
- /* recalc handles */
- calchandles_ipocurve(icu);
- }
- }
- }
-
- editipo_changed(G.sipo, 1);
- BIF_undo_push("Smooth IPO");
-}
-
-void join_ipo_menu(void)
-{
- int mode = 0;
- mode= pupmenu("Join %t|All Selected %x1|Selected Doubles %x2");
-
- if (mode == -1) return;
-
- join_ipo(mode);
-}
-
-void join_ipo(int mode)
-{
- EditIpo *ei;
- IpoKey *ik;
- IpoCurve *icu;
- BezTriple *bezt, *beztn, *newb;
- float val;
- int tot, a, b;
-
- get_status_editipo();
-
- /* Mode events:
- * All Selected: 1
- * Selected Doubles: 2
- */
-
- if( mode==2 ) {
- remove_doubles_ipo();
- return;
- }
-
- /* first: multiple selected verts in 1 curve */
- ei= G.sipo->editipo;
- for(a=0; a<G.sipo->totipo; a++, ei++) {
- if (ISPOIN3(ei, flag & IPO_VISIBLE, icu, icu->bezt)) {
- if(G.sipo->showkey || (ei->flag & IPO_EDIT)) {
- icu= ei->icu;
-
- /* how many points */
- tot= 0;
- b= icu->totvert;
- bezt= icu->bezt;
- while(b--) {
- if(bezt->f2 & SELECT) tot++;
- bezt++;
- }
-
- if(tot>1) {
- tot--;
- icu->totvert-= tot;
-
- newb= MEM_mallocN(icu->totvert*sizeof(BezTriple), "bezt");
- /* the first point is the new one */
- beztn= newb+1;
- tot= 0;
-
- bezt= icu->bezt;
- b= icu->totvert+tot+1;
- while(b--) {
-
- if(bezt->f2 & SELECT) {
- if(tot==0) *newb= *bezt;
- else {
- VecAddf(newb->vec[0], newb->vec[0], bezt->vec[0]);
- VecAddf(newb->vec[1], newb->vec[1], bezt->vec[1]);
- VecAddf(newb->vec[2], newb->vec[2], bezt->vec[2]);
- }
- tot++;
- }
- else {
- *beztn= *bezt;
- beztn++;
- }
- bezt++;
- }
-
- VecMulf(newb->vec[0], (float)(1.0/((float)tot)));
- VecMulf(newb->vec[1], (float)(1.0/((float)tot)));
- VecMulf(newb->vec[2], (float)(1.0/((float)tot)));
-
- MEM_freeN(icu->bezt);
- icu->bezt= newb;
-
- sort_time_ipocurve(icu);
- calchandles_ipocurve(icu);
- }
- }
- }
- }
-
- /* next: in keymode: join multiple selected keys */
-
- editipo_changed(G.sipo, 1); /* makes ipokeys again! */
-
- if(G.sipo->showkey) {
- ik= G.sipo->ipokey.first;
- val= 0.0;
- tot= 0;
- while(ik) {
- if(ik->flag & 1) {
- for(a=0; a<G.sipo->totipo; a++) {
- if(ik->data[a]) {
- val+= ik->data[a]->vec[1][0];
- break;
- }
- }
- tot++;
- }
- ik= ik->next;
- }
- if(tot>1) {
- val/= (float)tot;
-
- ik= G.sipo->ipokey.first;
- while(ik) {
- if(ik->flag & 1) {
- for(a=0; a<G.sipo->totipo; a++) {
- if(ik->data[a]) {
- ik->data[a]->vec[1][0]= val;
- }
- }
- }
- ik= ik->next;
- }
- editipo_changed(G.sipo, 0);
- }
- }
- deselectall_editipo();
- BIF_undo_push("Join Ipo");
-}
-
-void ipo_snap_menu(void)
-{
- short event;
-
- event= pupmenu("Snap %t|Horizontal %x1|To Next %x2|To Frame %x3|To Current Frame%x4");
- if(event < 1) return;
-
- ipo_snap(event);
-}
-
-void ipo_snap(short event)
-{
- EditIpo *ei;
- BezTriple *bezt;
- float dx = 0.0;
- int a, b;
- short ok, ok2;
-
- /* events:
- * Horizontal : 1
- * To Next: 2
- * To Frame: 3
- * To Current Frame: 4
- */
-
- get_status_editipo();
-
- /* map ipo-points for editing if scaled ipo */
- if (NLA_IPO_SCALED) {
- actstrip_map_ipo_keys(OBACT, G.sipo->ipo, 0, 0);
- }
-
- ei= G.sipo->editipo;
- for(b=0; b<G.sipo->totipo; b++, ei++) {
- if (ISPOIN3(ei, flag & IPO_VISIBLE, icu, icu->bezt)) {
-
- ok2= 0;
- if(G.sipo->showkey) ok2= 1;
- else if(totipo_vert && (ei->flag & IPO_EDIT)) ok2= 2;
- else if(totipo_vert==0 && (ei->flag & IPO_SELECT)) ok2= 3;
-
- if(ok2) {
- bezt= ei->icu->bezt;
- a= ei->icu->totvert;
- while(a--) {
- ok= 0;
- if(totipo_vert) {
- if(bezt->f2 & SELECT) ok= 1;
- }
- else ok= 1;
-
- if(ok) {
- if(event==1) {
- bezt->vec[0][1]= bezt->vec[2][1]= bezt->vec[1][1];
- if(bezt->h1==HD_AUTO || bezt->h1==HD_VECT) bezt->h1= HD_ALIGN;
- if(bezt->h2==HD_AUTO || bezt->h2==HD_VECT) bezt->h2= HD_ALIGN;
- }
- else if(event==2) {
- if(a) {
- bezt->vec[0][1]= bezt->vec[1][1]= bezt->vec[2][1]= (bezt+1)->vec[1][1];
- if(bezt->h1==HD_AUTO || bezt->h1==HD_VECT) bezt->h1= HD_ALIGN;
- if(bezt->h2==HD_AUTO || bezt->h2==HD_VECT) bezt->h2= HD_ALIGN;
- }
- }
- else if(event==3) {
- bezt->vec[1][0]= (float)(floor(bezt->vec[1][0]+0.5));
- }
- else if(event==4) { /* to current frame */
-
- if(ok2==1 || ok2==2) {
-
- if(G.sipo->blocktype==ID_SEQ) {
- Sequence *seq;
-
- seq= (Sequence *)G.sipo->from;
- if(seq && (seq->flag & SEQ_IPO_FRAME_LOCKED) == 0) {
- dx= (float)(CFRA-seq->startdisp);
- dx= (float)(100.0*dx/((float)(seq->enddisp-seq->startdisp)));
-
- dx-= bezt->vec[1][0];
- } else {
- dx= G.scene->r.framelen*CFRA - bezt->vec[1][0];
- }
- }
- else dx= G.scene->r.framelen*CFRA - bezt->vec[1][0];
-
- bezt->vec[0][0]+= dx;
- bezt->vec[1][0]+= dx;
- bezt->vec[2][0]+= dx;
- }
- }
- }
-
- bezt++;
- }
- calchandles_ipocurve(ei->icu);
- }
- }
- }
-
- /* undo mapping of ipo-points for editing if scaled ipo */
- if (NLA_IPO_SCALED) {
- actstrip_map_ipo_keys(OBACT, G.sipo->ipo, 1, 0);
- }
-
- editipo_changed(G.sipo, 1);
- BIF_undo_push("Snap Ipo");
-}
-
-void ipo_mirror_menu(void)
-{
- int mode = 0;
- mode= pupmenu("Mirror Over%t|Current Frame%x1|Vertical Axis%x2|Horizontal Axis%x3");
-
- if (mode == -1) return;
-
- ipo_mirror(mode);
-}
-
-void ipo_mirror(short mode)
-{
- EditIpo *ei;
- BezTriple *bezt;
-
- int a, b;
- short ok, ok2, i;
- float diff;
-
- /* what's this for? */
- get_status_editipo();
-
- /* get edit ipo */
- ei= G.sipo->editipo;
- if (!ei) return;
-
- /* map ipo-points for editing if scaled ipo */
- if (NLA_IPO_SCALED) {
- actstrip_map_ipo_keys(OBACT, G.sipo->ipo, 0, 0);
- }
-
- /* look throught ipo curves */
- for(b=0; b<G.sipo->totipo; b++, ei++) {
- if (ISPOIN3(ei, flag & IPO_VISIBLE, icu, icu->bezt)) {
-
- ok2= 0;
- if(G.sipo->showkey) ok2= 1;
- else if(totipo_vert && (ei->flag & IPO_EDIT)) ok2= 2;
- else if(totipo_vert==0 && (ei->flag & IPO_SELECT)) ok2= 3;
-
- if(ok2) {
- bezt= ei->icu->bezt;
- a= ei->icu->totvert;
-
- /* loop through beztriples, mirroring them */
- while(a--) {
- ok= 0;
- if(totipo_vert) {
- if(bezt->f2 & SELECT) ok= 1;
- }
- else ok= 1;
-
- if(ok) {
- switch (mode) {
- case 1: /* mirror over current frame */
- {
- for (i=0; i<3; i++) {
- diff= ((float)CFRA - bezt->vec[i][0]);
- bezt->vec[i][0]= ((float)CFRA + diff);
- }
- }
- break;
- case 2: /* mirror over vertical axis (frame 0) */
- {
- for (i=0; i<3; i++) {
- diff= (0.0f - bezt->vec[i][0]);
- bezt->vec[i][0]= (0.0f + diff);
- }
- }
- break;
- case 3: /* mirror over horizontal axis */
- {
- for (i=0; i<3; i++) {
- diff= (0.0f - bezt->vec[i][1]);
- bezt->vec[i][1]= (0.0f + diff);
- }
- }
- break;
- }
- }
-
- bezt++;
- }
-
- /* sort out order and handles */
- sort_time_ipocurve(ei->icu);
- calchandles_ipocurve(ei->icu);
- }
- }
- }
-
- /* undo mapping of ipo-points for editing if scaled ipo */
- if (NLA_IPO_SCALED) {
- actstrip_map_ipo_keys(OBACT, G.sipo->ipo, 1, 0);
- }
-
- /* cleanup and undo push */
- editipo_changed(G.sipo, 1);
- BIF_undo_push("Mirror Ipo");
-}
-
-/*
- * When deleting an IPO curve from Python, check if the Ipo is being
- * edited and if so clear the pointer to the old curve.
- */
-
-void del_ipoCurve ( IpoCurve * icu )
-{
- int i;
- EditIpo *ei= G.sipo->editipo;
- if (!ei) return;
-
- for(i=0; i<G.sipo->totipo; i++, ei++) {
- if ( ei->icu == icu ) {
- ei->flag &= ~(IPO_SELECT | IPO_EDIT);
- ei->icu= NULL;
- return;
- }
- }
-}
-
-void del_ipo(int need_check)
-{
- EditIpo *ei;
- BezTriple *bezt, *bezt1;
- int a, b;
- int del, event;
-
- get_status_editipo();
- if(G.sipo->ipo && G.sipo->ipo->id.lib) return;
-
- if(totipo_edit==0 && totipo_sel==0 && totipo_vertsel==0) {
- if (need_check) {
- if(okee("Erase selected keys"))
- delete_key(OBACT);
- }
- else
- delete_key(OBACT);
- return;
- }
-
- if (need_check)
- if( okee("Erase selected")==0 ) return;
-
- // first round, can we delete entire parts?
- ei= G.sipo->editipo;
- for(a=0; a<G.sipo->totipo; a++, ei++) {
-
- del= 0;
-
- if(G.sipo->showkey==0 && totipo_edit==0) {
- if (ISPOIN3(ei, flag & IPO_VISIBLE, flag & IPO_SELECT, icu)) {
- del= 1;
- }
- }
- else {
- if (ISPOIN(ei, flag & IPO_VISIBLE, icu)) {
- if(G.sipo->showkey || (ei->flag & IPO_EDIT)) {
- if(ei->icu->bezt) {
- bezt= ei->icu->bezt;
- b= ei->icu->totvert;
- if(b) {
- while(b) {
- if( BEZSELECTED(bezt) );
- else break;
- b--;
- bezt++;
- }
- if(b==0) del= 1;
- }
- }
- }
- }
- }
-
- if(del) {
- if(ei->icu->driver==NULL) {
- BLI_remlink( &(G.sipo->ipo->curve), ei->icu);
-
- free_ipo_curve(ei->icu);
-
- ei->flag &= ~IPO_SELECT;
- ei->flag &= ~IPO_EDIT;
- ei->icu= NULL;
- }
- else {
- if(ei->icu->bezt) MEM_freeN(ei->icu->bezt);
- ei->icu->bezt= NULL;
- ei->icu->totvert= 0;
- ei->flag &= ~IPO_EDIT;
- }
- }
- }
-
- // 2nd round, small parts: just curves
- ei= G.sipo->editipo;
- for(b=0; b<G.sipo->totipo; b++, ei++) {
- if (ISPOIN(ei, flag & IPO_VISIBLE, icu)) {
- if(G.sipo->showkey || (ei->flag & IPO_EDIT)) {
-
- event= 0;
- if(ei->icu->bezt) {
-
- bezt= ei->icu->bezt;
- for(a=0; a<ei->icu->totvert; a++) {
- if( BEZSELECTED(bezt) ) {
- memcpy(bezt, bezt+1, (ei->icu->totvert-a-1)*sizeof(BezTriple));
- ei->icu->totvert--;
- a--;
- event= 1;
- }
- else bezt++;
- }
- if(event) {
- if(ei->icu->totvert) {
- bezt1 = (BezTriple*) MEM_mallocN(ei->icu->totvert * sizeof(BezTriple), "delNurb");
- memcpy(bezt1, ei->icu->bezt, (ei->icu->totvert)*sizeof(BezTriple) );
- MEM_freeN(ei->icu->bezt);
- ei->icu->bezt= bezt1;
- }
- else {
- MEM_freeN(ei->icu->bezt);
- ei->icu->bezt= NULL;
- }
- }
- }
- }
- }
- }
-
- get_status_editipo(); /* count again */
- check_active_editipo();
-
- BIF_undo_push("Delete Ipo");
- allqueue(REDRAWNLA, 0);
- allqueue (REDRAWACTION, 0);
- allqueue(REDRAWIPO, 0);
- allspace(REMAKEIPO, 0);
-}
-
-/* ******************** copy paste buffer ******************** */
-ListBase ipocopybuf={0, 0};
-int totipocopybuf=0;
-
-void free_ipocopybuf(void)
-{
- IpoCurve *icu;
-
- while( (icu= ipocopybuf.first) ) {
- BLI_remlink(&ipocopybuf, icu);
- free_ipo_curve(icu);
- }
- totipocopybuf= 0;
-}
-
-void copy_editipo(void)
-{
- EditIpo *ei;
- IpoCurve *icu;
- int a;
-
- if(G.sipo->showkey) {
- error("cannot copy\n");
- return;
- }
-
- free_ipocopybuf();
-
- ei= G.sipo->editipo;
- for(a=0; a<G.sipo->totipo; a++, ei++) {
- if (ISPOIN(ei, flag & IPO_VISIBLE, icu)) {
- if( (ei->flag & IPO_EDIT) || (ei->flag & IPO_SELECT) ) {
- icu= MEM_callocN(sizeof(IpoCurve), "ipocopybuf");
- *icu= *(ei->icu);
- BLI_addtail(&ipocopybuf, icu);
- icu->bezt= MEM_dupallocN(icu->bezt);
- icu->driver= MEM_dupallocN(icu->driver);
-
- totipocopybuf++;
- }
- }
- }
-
- if(totipocopybuf==0) error("Copy buffer is empty");
-}
-
-void paste_editipo(void)
-{
- EditIpo *ei;
- IpoCurve *icu;
- int a;
-
- if (G.sipo->showkey) return;
-
- if (totipocopybuf==0) return;
- if (G.sipo->ipo==0) return;
- if (G.sipo->ipo && G.sipo->ipo->id.lib) return;
-
- get_status_editipo();
-
- if (totipo_vis==0) {
- error("No visible channels");
- return;
- }
- else if (totipo_vis!=totipocopybuf && totipo_sel!=totipocopybuf) {
- error("Incompatible paste");
- return;
- }
-
- icu= ipocopybuf.first;
-
- for (a=0, ei=G.sipo->editipo; a<G.sipo->totipo; a++, ei++) {
- if (ei->flag & IPO_VISIBLE) {
- /* don't attempt pasting if no valid buffer-curve to paste from anymore */
- if (icu == 0) return;
-
- /* if in editmode, paste keyframes */
- if (ei->flag & IPO_EDIT) {
- BezTriple *bezt;
- float offset= 0.0f;
- short offsetInit= 0;
- int i;
-
- /* make sure an ipo-curve exists (it may not, as this is an editipo) */
- ei->icu= verify_ipocurve(G.sipo->from, G.sipo->blocktype, G.sipo->actname, G.sipo->constname, G.sipo->bonename, ei->adrcode);
- if (ei->icu == NULL) return;
-
- /* Copy selected beztriples from source icu onto this edit-icu,
- * with all added keyframes being offsetted by the difference between
- * the first source keyframe and the current frame.
- */
- for (i=0, bezt=icu->bezt; i < icu->totvert; i++, bezt++) {
- /* skip if not selected */
- if (BEZSELECTED(bezt) == 0) continue;
-
- /* initialise offset (if not already done) */
- if (offsetInit==0) {
- offset= CFRA - bezt->vec[1][0];
- offsetInit= 1;
- }
- /* temporarily apply offset to src beztriple while copying */
- bezt->vec[0][0] += offset;
- bezt->vec[1][0] += offset;
- bezt->vec[2][0] += offset;
-
- /* insert the keyframe */
- insert_bezt_icu(ei->icu, bezt);
-
- /* un-apply offset from src beztriple after copying */
- bezt->vec[0][0] -= offset;
- bezt->vec[1][0] -= offset;
- bezt->vec[2][0] -= offset;
- }
-
- /* recalculate handles of curve that data was pasted into */
- calchandles_ipocurve(ei->icu);
-
- /* advance to next copy/paste buffer ipo-curve */
- icu= icu->next;
- }
-
- /* otherwise paste entire curve data */
- else {
-
- /* make sure an ipo-curve exists (it may not, as this is an editipo) */
- ei->icu= verify_ipocurve(G.sipo->from, G.sipo->blocktype, G.sipo->actname, G.sipo->constname, G.sipo->bonename, ei->adrcode);
- if (ei->icu==NULL) return;
-
- /* clear exisiting dynamic memory (keyframes, driver) */
- if (ei->icu->bezt) MEM_freeN(ei->icu->bezt);
- ei->icu->bezt= NULL;
- if (ei->icu->driver) MEM_freeN(ei->icu->driver);
- ei->icu->driver= NULL;
-
- ei->icu->totvert= icu->totvert;
- ei->icu->flag= ei->flag= icu->flag;
- ei->icu->extrap= icu->extrap;
- ei->icu->ipo= icu->ipo;
-
- /* make a copy of the source icu's data */
- if (icu->bezt)
- ei->icu->bezt= MEM_dupallocN(icu->bezt);
- if (icu->driver)
- ei->icu->driver= MEM_dupallocN(icu->driver);
-
- /* advance to next copy/paste buffer ipo-curve */
- icu= icu->next;
- }
- }
- }
-
- editipo_changed(G.sipo, 1);
- BIF_undo_push("Paste Ipo curves");
-}
-
-/* *********************** */
-
-
-static int find_other_handles(EditIpo *eicur, float ctime, BezTriple **beztar)
-{
- EditIpo *ei;
- BezTriple *bezt;
- int a, b, c= 1, totvert;
-
- ei= G.sipo->editipo;
- for(a=0; a<G.sipo->totipo; a++, ei++) {
- if(ei!=eicur && ei->icu && (ei->flag & IPO_VISIBLE)) {
-
- bezt= ei->icu->bezt;
- totvert= ei->icu->totvert;
-
- for(b=0; b<totvert; b++, bezt++) {
- if( bezt->vec[1][0] < ctime+IPOTHRESH && bezt->vec[1][0] > ctime-IPOTHRESH) {
- if(c>2) return 0;
- beztar[c]= bezt;
- c++;
- }
- }
- }
- }
-
- if(c==3) return 1;
- return 0;
-}
-
-void set_speed_editipo(float speed)
-{
- EditIpo *ei;
- BezTriple *bezt, *beztar[3];
- float vec1[3], vec2[3];
- int a, b, totvert, didit=0, done_error = 0;
-
- if(G.sipo->ipo && G.sipo->ipo->id.lib) return;
-
- /* starting with 1 visible curve, selected point, associated points: do lencorr! */
-
- ei= G.sipo->editipo;
- for(a=0; a<G.sipo->totipo; a++, ei++) {
- if (ISPOIN(ei, flag & IPO_VISIBLE, icu)) {
- bezt= ei->icu->bezt;
- totvert= ei->icu->totvert;
-
- for(b=0; b<totvert; b++, bezt++) {
- if(BEZSELECTED(bezt)) {
-
- beztar[0]= bezt;
-
- if( find_other_handles(ei, bezt->vec[1][0], beztar) ) {
- beztar[0]->h1= beztar[0]->h2= HD_ALIGN;
- beztar[1]->h1= beztar[1]->h2= HD_ALIGN;
- beztar[2]->h1= beztar[2]->h2= HD_ALIGN;
-
- vec1[0]= (beztar[0]->vec[1][1] - beztar[0]->vec[0][1]) / (beztar[0]->vec[1][0] - beztar[0]->vec[0][0]) ;
- vec2[0]= (beztar[0]->vec[1][1] - beztar[0]->vec[2][1]) / (beztar[0]->vec[2][0] - beztar[0]->vec[1][0]) ;
-
- vec1[1]= (beztar[1]->vec[1][1] - beztar[1]->vec[0][1]) / (beztar[1]->vec[1][0] - beztar[1]->vec[0][0]) ;
- vec2[1]= (beztar[1]->vec[1][1] - beztar[1]->vec[2][1]) / (beztar[1]->vec[2][0] - beztar[1]->vec[1][0]) ;
-
- vec1[2]= (beztar[2]->vec[1][1] - beztar[2]->vec[0][1]) / (beztar[2]->vec[1][0] - beztar[2]->vec[0][0]) ;
- vec2[2]= (beztar[2]->vec[1][1] - beztar[2]->vec[2][1]) / (beztar[2]->vec[2][0] - beztar[2]->vec[1][0]) ;
-
- Normalize(vec1);
- Normalize(vec2);
-
- VecMulf(vec1, speed);
- VecMulf(vec2, speed);
-
- beztar[0]->vec[0][1]= beztar[0]->vec[1][1] - vec1[0]*(beztar[0]->vec[1][0] - beztar[0]->vec[0][0]) ;
- beztar[0]->vec[2][1]= beztar[0]->vec[1][1] - vec2[0]*(beztar[0]->vec[2][0] - beztar[0]->vec[1][0]) ;
-
- beztar[1]->vec[0][1]= beztar[1]->vec[1][1] - vec1[1]*(beztar[1]->vec[1][0] - beztar[1]->vec[0][0]) ;
- beztar[1]->vec[2][1]= beztar[1]->vec[1][1] - vec2[1]*(beztar[1]->vec[2][0] - beztar[1]->vec[1][0]) ;
-
- beztar[2]->vec[0][1]= beztar[2]->vec[1][1] - vec1[2]*(beztar[2]->vec[1][0] - beztar[2]->vec[0][0]) ;
- beztar[2]->vec[2][1]= beztar[2]->vec[1][1] - vec2[2]*(beztar[2]->vec[2][0] - beztar[2]->vec[1][0]) ;
-
- didit= 1;
- }
- else {
- if (done_error==0) {
- error("Only works for 3 visible curves with handles");
- }
- done_error = 1;
- }
- }
- }
- break;
- }
- }
-
- if(didit==0) error("Did not set speed");
-
- editipo_changed(G.sipo, 1);
- BIF_undo_push("Set speed IPO");
- allqueue(REDRAWNLA, 0);
- allqueue (REDRAWACTION, 0);
- allqueue(REDRAWIPO, 0);
-
-}
-
-
-/* **************************************************** */
-
-/* IPOKEY:
- *
- * there are three ways to use this system:
- * 1. below: for drawing and editing in Ipo window
- * 2. for drawing key positions in View3D (see ipo.c and drawobject.c)
- * 3. editing keys in View3D (below and in editobject.c)
- *
- */
-
-
-void free_ipokey(ListBase *lb)
-{
- IpoKey *ik;
-
- ik= lb->first;
- while(ik) {
- if(ik->data) MEM_freeN(ik->data);
- ik= ik->next;
- }
- BLI_freelistN(lb);
-}
-
-
-void add_to_ipokey(ListBase *lb, BezTriple *bezt, int nr, int len)
-{
- IpoKey *ik, *ikn;
-
- ik= lb->first;
- while(ik) {
-
- if( ik->val==bezt->vec[1][0] ) {
- if(ik->data[nr]==0) { /* double points! */
- ik->data[nr]= bezt;
- if(bezt->f2 & SELECT) ik->flag= 1;
- return;
- }
- }
- else if(ik->val > bezt->vec[1][0]) break;
-
- ik= ik->next;
- }
-
- ikn= MEM_callocN(sizeof(IpoKey), "add_to_ipokey");
- if(ik) BLI_insertlinkbefore(lb, ik, ikn);
- else BLI_addtail(lb, ikn);
-
- ikn->data= MEM_callocN(sizeof(float *)*len, "add_to_ipokey");
- ikn->data[nr]= bezt;
- ikn->val= bezt->vec[1][0];
-
- if(bezt->f2 & SELECT) ikn->flag= 1;
-}
-
-void make_ipokey(void)
-{
- EditIpo *ei;
- IpoKey *ik;
- ListBase *lb;
- BezTriple *bezt;
- int a, b, sel, desel, totvert;
-
- lb= &G.sipo->ipokey;
- free_ipokey(lb);
-
- ei= G.sipo->editipo;
- if(ei==0) return;
- for(a=0; a<G.sipo->totipo; a++, ei++) {
- if (ISPOIN(ei, flag & IPO_VISIBLE, icu)) {
- bezt= ei->icu->bezt;
- totvert= ei->icu->totvert;
-
- for(b=0; b<totvert; b++, bezt++) {
- add_to_ipokey(lb, bezt, a, G.sipo->totipo);
- }
-
- ei->flag &= ~IPO_SELECT;
- ei->flag &= ~IPO_EDIT;
- ei->icu->flag= ei->flag;
- }
- }
-
- /* test selectflags & scaling */
- ik= lb->first;
- while(ik) {
- sel= desel= 0;
- for(a=0; a<G.sipo->totipo; a++) {
- if(ik->data[a]) {
- bezt= ik->data[a];
- if(bezt->f2 & SELECT) sel++;
- else desel++;
- }
- }
- if(sel && desel) sel= 0;
- for(a=0; a<G.sipo->totipo; a++) {
- if(ik->data[a]) {
- bezt= ik->data[a];
- if(sel) {
- bezt->f1 |= SELECT;
- bezt->f2 |= SELECT;
- bezt->f3 |= SELECT;
- }
- else {
- bezt->f1 &= ~SELECT;
- bezt->f2 &= ~SELECT;
- bezt->f3 &= ~SELECT;
- }
- }
- }
- if(sel) ik->flag = 1;
- else ik->flag= 0;
-
- /* map ipo-keys for drawing/editing if scaled ipo */
- if (NLA_IPO_SCALED) {
- ik->val= get_action_frame_inv(OBACT, ik->val);
- }
-
- ik= ik->next;
- }
-
- get_status_editipo();
-}
-
-void make_ipokey_transform(Object *ob, ListBase *lb, int sel)
-{
- IpoCurve *icu;
- BezTriple *bezt;
- IpoKey *ik;
- int a, adrcode = 0, ok, dloc=0, drot=0, dsize=0;
-
- if(ob->ipo==NULL) return;
- if(ob->ipo->showkey==0) return;
-
- /* test: are there delta curves? */
- icu= ob->ipo->curve.first;
- while(icu) {
- if(icu->flag & IPO_VISIBLE) {
- switch(icu->adrcode) {
- case OB_DLOC_X:
- case OB_DLOC_Y:
- case OB_DLOC_Z:
- dloc= 1;
- break;
- case OB_DROT_X:
- case OB_DROT_Y:
- case OB_DROT_Z:
- drot= 1;
- break;
- case OB_DSIZE_X:
- case OB_DSIZE_Y:
- case OB_DSIZE_Z:
- dsize= 1;
- break;
- }
- }
- icu= icu->next;
- }
-
- icu= ob->ipo->curve.first;
- while(icu) {
- if(icu->flag & IPO_VISIBLE) {
- ok= 0;
-
- switch(icu->adrcode) {
- case OB_DLOC_X:
- case OB_DLOC_Y:
- case OB_DLOC_Z:
- case OB_DROT_X:
- case OB_DROT_Y:
- case OB_DROT_Z:
- case OB_DSIZE_X:
- case OB_DSIZE_Y:
- case OB_DSIZE_Z:
- ok= 1;
- break;
-
- case OB_LOC_X:
- case OB_LOC_Y:
- case OB_LOC_Z:
- if(dloc==0) ok= 1;
- break;
- case OB_ROT_X:
- case OB_ROT_Y:
- case OB_ROT_Z:
- if(drot==0) ok= 1;
- break;
- case OB_SIZE_X:
- case OB_SIZE_Y:
- case OB_SIZE_Z:
- if(dsize==0) ok= 1;
- break;
- }
- if(ok) {
- for(a=0; a<OB_TOTIPO; a++) {
- if(icu->adrcode==ob_ar[a]) {
- adrcode= a;
- break;
- }
- }
-
- bezt= icu->bezt;
- a= icu->totvert;
- while(a--) {
- if(sel==0 || (bezt->f2 & SELECT)) {
- add_to_ipokey(lb, bezt, adrcode, OB_TOTIPO);
- }
- bezt++;
- }
- }
- }
- icu= icu->next;
- }
-
-
- ik= lb->first;
- while(ik) {
- /* map ipo-keys for drawing/editing if scaled ipo */
- if (NLA_IPO_SCALED) {
- ik->val= get_action_frame_inv(OBACT, ik->val);
- }
-
- ik= ik->next;
- }
-}
-
-void update_ipokey_val(void) /* after moving vertices */
-{
- IpoKey *ik;
- int a;
-
- ik= G.sipo->ipokey.first;
- while(ik) {
- for(a=0; a<G.sipo->totipo; a++) {
- if(ik->data[a]) {
- ik->val= ik->data[a]->vec[1][0];
-
- /* map ipo-keys for drawing/editing if scaled ipo */
- if (NLA_IPO_SCALED) {
- ik->val= get_action_frame_inv(OBACT, ik->val);
- }
- break;
- }
- }
- ik= ik->next;
- }
-}
-
-void set_tob_old(float *old, float *poin)
-{
- old[0]= *(poin);
- old[3]= *(poin-3);
- old[6]= *(poin+3);
-}
-
-void set_ipo_pointers_transob(IpoKey *ik, TransOb *tob)
-{
- BezTriple *bezt;
- int a, delta= 0;
-
- tob->locx= tob->locy= tob->locz= 0;
- tob->rotx= tob->roty= tob->rotz= 0;
- tob->sizex= tob->sizey= tob->sizez= 0;
-
- for(a=0; a<OB_TOTIPO; a++) {
- if(ik->data[a]) {
- bezt= ik->data[a];
-
- switch( ob_ar[a] ) {
- case OB_LOC_X:
- case OB_DLOC_X:
- tob->locx= &(bezt->vec[1][1]); break;
- case OB_LOC_Y:
- case OB_DLOC_Y:
- tob->locy= &(bezt->vec[1][1]); break;
- case OB_LOC_Z:
- case OB_DLOC_Z:
- tob->locz= &(bezt->vec[1][1]); break;
-
- case OB_DROT_X:
- delta= 1;
- case OB_ROT_X:
- tob->rotx= &(bezt->vec[1][1]); break;
- case OB_DROT_Y:
- delta= 1;
- case OB_ROT_Y:
- tob->roty= &(bezt->vec[1][1]); break;
- case OB_DROT_Z:
- delta= 1;
- case OB_ROT_Z:
- tob->rotz= &(bezt->vec[1][1]); break;
-
- case OB_SIZE_X:
- case OB_DSIZE_X:
- tob->sizex= &(bezt->vec[1][1]); break;
- case OB_SIZE_Y:
- case OB_DSIZE_Y:
- tob->sizey= &(bezt->vec[1][1]); break;
- case OB_SIZE_Z:
- case OB_DSIZE_Z:
- tob->sizez= &(bezt->vec[1][1]); break;
- }
- }
- }
-
- /* oldvals for e.g. undo */
- if(tob->locx) set_tob_old(tob->oldloc, tob->locx);
- if(tob->locy) set_tob_old(tob->oldloc+1, tob->locy);
- if(tob->locz) set_tob_old(tob->oldloc+2, tob->locz);
-
- /* store first oldrot, for mapping curves ('1'=10 degrees) and correct calculation */
- if(tob->rotx) set_tob_old(tob->oldrot+3, tob->rotx);
- if(tob->roty) set_tob_old(tob->oldrot+4, tob->roty);
- if(tob->rotz) set_tob_old(tob->oldrot+5, tob->rotz);
-
- /* store the first oldsize, this is not allowed to be dsize! */
- if(tob->sizex) set_tob_old(tob->oldsize+3, tob->sizex);
- if(tob->sizey) set_tob_old(tob->oldsize+4, tob->sizey);
- if(tob->sizez) set_tob_old(tob->oldsize+5, tob->sizez);
-
- tob->flag= TOB_IPO;
- if(delta) tob->flag |= TOB_IPODROT;
-}
-
-
-
-static int float_to_frame (float frame)
-{
- int to= (int) floor(0.5 + frame/G.scene->r.framelen );
-
- return to;
-}
-
-void movekey_ipo(int dir) /* only call external from view3d queue */
-{
- IpoKey *ik;
- float toframe = 0.0;
- int a;
-
- if(G.sipo->showkey==0) return;
-
- ik= G.sipo->ipokey.first;
- if (dir==-1) {
- while (ik && float_to_frame(ik->val)<CFRA) {
- toframe= ik->val;
- ik= ik->next;
- }
- } else {
- while (ik && float_to_frame(ik->val)<=CFRA) {
- ik= ik->next;
- }
- if (ik) toframe= ik->val;
- }
-
- a= float_to_frame(toframe);
-
- if (a!=CFRA && a>0) {
- CFRA= a;
-
- update_for_newframe();
- }
-
- BIF_undo_push("Move Key");
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIPO, 0);
- allspace(REMAKEIPO, 0);
-
-}
-
-void movekey_obipo(int dir) /* only call external from view3d queue */
-{
- Base *base;
- Object *ob;
- ListBase elems;
- IpoKey *ik;
- int a;
- float toframe= CFRA;
-
- if (!G.vd)
- return;
-
- base= FIRSTBASE;
- while(base) {
- if TESTBASELIB(base) {
- ob= base->object;
- if(ob->ipo && ob->ipo->showkey) {
- elems.first= elems.last= 0;
- make_ipokey_transform(ob, &elems, 0);
-
- if(elems.first) {
- ik= elems.first;
- if (dir==-1) {
- while (ik && float_to_frame(ik->val)<CFRA) {
- toframe= ik->val;
- ik= ik->next;
- }
- } else {
- while (ik && float_to_frame(ik->val)<=CFRA) {
- ik= ik->next;
- }
- if (ik) toframe= ik->val;
- }
-
- free_ipokey(&elems);
- }
- }
- }
-
- base= base->next;
- }
-
- a= float_to_frame(toframe);
-
- if (a!=CFRA && a>0) {
- CFRA= a;
-
- update_for_newframe();
- }
-
- BIF_undo_push("Move Key");
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIPO, 0);
- allspace(REMAKEIPO, 0);
-
-}
-/* **************************************************** */
-/* IPO TRANSFORM TOOLS
- *
- * Only the helper functions are stored here these days. They are here as
- * there are heaps of ugly globals which the IPO editor relies on.
- * However, the actual transforms go through the transform system these days.
- */
-
-/* Helper function for make_ipo_transdata, which is reponsible for associating
- * source data with transform data
- */
-static void bezt_to_transdata (TransData *td, TransData2D *td2d, float *loc, float *cent, short selected, short onlytime)
-{
- /* New location from td gets dumped onto the old-location of td2d, which then
- * gets copied to the actual data at td2d->loc2d (bezt->vec[n])
- *
- * Due to NLA scaling, we apply NLA scaling to some of the verts here,
- * and then that scaling will be undone after transform is done.
- */
-
- if (NLA_IPO_SCALED) {
- td2d->loc[0] = get_action_frame_inv(OBACT, loc[0]);
- td2d->loc[1] = loc[1];
- td2d->loc[2] = 0.0f;
- td2d->loc2d = loc;
-
- td->flag = 0;
- td->loc = td2d->loc;
- VECCOPY(td->center, cent);
- VECCOPY(td->iloc, td->loc);
- }
- else {
- td2d->loc[0] = loc[0];
- td2d->loc[1] = loc[1];
- td2d->loc[2] = 0.0f;
- td2d->loc2d = loc;
-
- td->flag = 0;
- td->loc = td2d->loc;
- VECCOPY(td->center, cent);
- VECCOPY(td->iloc, td->loc);
- }
-
- memset(td->axismtx, 0, sizeof(td->axismtx));
- td->axismtx[2][2] = 1.0f;
-
- td->ext= NULL; td->tdi= NULL; td->val= NULL;
-
- if (selected) {
- td->flag |= TD_SELECTED;
- td->dist= 0.0;
- }
- else
- td->dist= MAXFLOAT;
-
- if (onlytime)
- td->flag |= TD_TIMEONLY;
-
- Mat3One(td->mtx);
- Mat3One(td->smtx);
-}
-
-/* This function is called by createTransIpoData and remake_ipo_transdata to
- * create the TransData and TransData2D arrays for transform. The costly counting
- * stage is only performed for createTransIpoData case, and is indicated by t->total==-1;
- */
-void make_ipo_transdata (TransInfo *t)
-{
- TransData *td = NULL;
- TransData2D *td2d = NULL;
-
- EditIpo *ei;
- BezTriple *bezt;
- int a, b;
-
- /* countsel and propmode are used for proportional edit, which is not yet available */
- int count=0/*, countsel=0*/;
- /*int propmode = t->flag & T_PROP_EDIT;*/
-
- /* count data and allocate memory (if needed) */
- if (t->total == 0) {
- /* count data first */
- if (totipo_vertsel) {
- /* we're probably in editmode, so only selected verts */
- count= totipo_vertsel;
- }
- else if (totipo_edit==0 && totipo_sel!=0) {
- /* we're not in editmode, so entire curves get moved */
- ei= G.sipo->editipo;
- for (a=0; a<G.sipo->totipo; a++, ei++) {
- if (ISPOIN3(ei, flag & IPO_VISIBLE, flag & IPO_SELECT, icu)) {
- if (ei->icu->bezt && ei->icu->ipo==IPO_BEZ)
- count+= 3*ei->icu->totvert;
- else
- count+= ei->icu->totvert;
- }
- }
- if (count==0) return;
- }
- else {
- /* this case should not happen */
- return;
- }
-
- /* memory allocation */
- /*t->total= (propmode)? count: countsel;*/
- t->total= count;
- t->data= MEM_callocN(t->total*sizeof(TransData), "TransData (IPO Editor)");
- /* for each 2d vert a 3d vector is allocated, so that they can be treated just as if they were 3d verts */
- t->data2d= MEM_callocN(t->total*sizeof(TransData2D), "TransData2D (IPO Editor)");
- }
-
- td= t->data;
- td2d= t->data2d;
-
- /* add verts */
- if (totipo_vertsel) {
- /* we're probably in editmode, so only selected verts */
- ei= G.sipo->editipo;
- for (a=0; a<G.sipo->totipo; a++, ei++) {
- /* only consider those curves that are visible and are being edited/used for showkeys */
- if (ISPOIN(ei, flag & IPO_VISIBLE, icu)) {
- if ( (ei->flag & IPO_EDIT) || G.sipo->showkey) {
- if (ei->icu->bezt) {
- short onlytime= (ei->disptype==IPO_DISPBITS) ? 1 : (G.sipo->showkey) ? 1 : 0;
- bezt= ei->icu->bezt;
-
- for (b=0; b < ei->icu->totvert; b++, bezt++) {
- /* only include handles if selected, and interpolaton mode uses beztriples */
- if (ei->icu->ipo==IPO_BEZ) {
- if (bezt->f1 & SELECT)
- bezt_to_transdata(td++, td2d++, bezt->vec[0], bezt->vec[1], 1, onlytime);
- if (bezt->f3 & SELECT)
- bezt_to_transdata(td++, td2d++, bezt->vec[2], bezt->vec[1], 1, onlytime);
- }
-
- /* only include main vert if selected */
- if (bezt->f2 & SELECT) {
- bezt_to_transdata(td++, td2d++, bezt->vec[1], bezt->vec[1], 1, onlytime);
- }
- }
- }
- }
- }
- }
- }
- else if (totipo_edit==0 && totipo_sel!=0) {
- /* we're not in editmode, so entire curves get moved */
- ei= G.sipo->editipo;
- for (a=0; a<G.sipo->totipo; a++, ei++) {
- /* only include curves that are visible and selected */
- if (ISPOIN3(ei, flag & IPO_VISIBLE, flag & IPO_SELECT, icu)) {
- if (ei->icu->bezt) {
- short onlytime= (ei->disptype==IPO_DISPBITS) ? 1 : (G.sipo->showkey) ? 1 : 0;
- bezt= ei->icu->bezt;
- b= ei->icu->totvert;
-
- for (b=0; b < ei->icu->totvert; b++, bezt++) {
- /* only include handles if interpolation mode is bezier not bpoint */
- if (ei->icu->ipo==IPO_BEZ) {
- bezt_to_transdata(td++, td2d++, bezt->vec[0], bezt->vec[1], 1, onlytime);
- bezt_to_transdata(td++, td2d++, bezt->vec[2], bezt->vec[1], 1, onlytime);
- }
-
- /* always include the main handle */
- bezt_to_transdata(td++, td2d++, bezt->vec[1], bezt->vec[1], 1, onlytime);
- }
- }
- }
- }
- }
-}
-
-/* ------------------------ */
-
-/* struct for use in re-sorting BezTriples during IPO transform */
-typedef struct BeztMap {
- BezTriple *bezt;
- int oldIndex; /* index of bezt in icu->bezt array before sorting */
- int newIndex; /* index of bezt in icu->bezt array after sorting */
- short swapHs; /* swap order of handles (-1=clear; 0=not checked, 1=swap) */
-} BeztMap;
-
-
-/* This function converts an IpoCurve's BezTriple array to a BeztMap array
- * NOTE: this allocates memory that will need to get freed later
- */
-static BeztMap *bezt_to_beztmaps (BezTriple *bezts, int totvert)
-{
- BezTriple *bezt= bezts;
- BeztMap *bezm, *bezms;
- int i;
-
- /* allocate memory for this array */
- if (totvert==0 || bezts==NULL)
- return NULL;
- bezm= bezms= MEM_callocN(sizeof(BeztMap)*totvert, "BeztMaps");
-
- /* assign beztriples to beztmaps */
- for (i=0; i < totvert; i++, bezm++, bezt++) {
- bezm->bezt= bezt;
- bezm->oldIndex= i;
- bezm->newIndex= i;
- }
-
- return bezms;
-}
-
-/* This function copies the code of sort_time_ipocurve, but acts on BeztMap structs instead */
-static void sort_time_beztmaps (BeztMap *bezms, int totvert)
-{
- BeztMap *bezm;
- int i, ok= 1;
-
- /* keep repeating the process until nothing is out of place anymore */
- while (ok) {
- ok= 0;
-
- bezm= bezms;
- i= totvert;
- while (i--) {
- /* is current bezm out of order (i.e. occurs later than next)? */
- if (i > 0) {
- if (bezm->bezt->vec[1][0] > (bezm+1)->bezt->vec[1][0]) {
- bezm->newIndex++;
- (bezm+1)->newIndex--;
-
- SWAP(BeztMap, *bezm, *(bezm+1));
-
- ok= 1;
- }
- }
-
- /* do we need to check if the handles need to be swapped?
- * optimisation: this only needs to be performed in the first loop
- */
- if (bezm->swapHs == 0) {
- if ( (bezm->bezt->vec[0][0] > bezm->bezt->vec[1][0]) &&
- (bezm->bezt->vec[2][0] < bezm->bezt->vec[1][0]) )
- {
- /* handles need to be swapped */
- bezm->swapHs = 1;
- }
- else {
- /* handles need to be cleared */
- bezm->swapHs = -1;
- }
- }
-
- bezm++;
- }
- }
-}
-
-/* This function firstly adjusts the pointers that the transdata has to each BezTriple*/
-static void beztmap_to_data (TransInfo *t, EditIpo *ei, BeztMap *bezms, int totvert)
-{
- BezTriple *bezts = ei->icu->bezt;
- BeztMap *bezm;
- TransData2D *td;
- int i, j;
- char *adjusted;
-
- /* dynamically allocate an array of chars to mark whether an TransData's
- * pointers have been fixed already, so that we don't override ones that are
- * already done
- */
- adjusted= MEM_callocN(t->total, "beztmap_adjusted_map");
-
- /* for each beztmap item, find if it is used anywhere */
- bezm= bezms;
- for (i= 0; i < totvert; i++, bezm++) {
- /* loop through transdata, testing if we have a hit
- * for the handles (vec[0]/vec[2]), we must also check if they need to be swapped...
- */
- td= t->data2d;
- for (j= 0; j < t->total; j++, td++) {
- /* skip item if already marked */
- if (adjusted[j] != 0) continue;
-
- if (totipo_vertsel) {
- /* only selected verts */
- if (ei->icu->ipo==IPO_BEZ) {
- if (bezm->bezt->f1 & SELECT) {
- if (td->loc2d == bezm->bezt->vec[0]) {
- if (bezm->swapHs == 1)
- td->loc2d= (bezts + bezm->newIndex)->vec[2];
- else
- td->loc2d= (bezts + bezm->newIndex)->vec[0];
- adjusted[j] = 1;
- }
- }
- if (bezm->bezt->f3 & SELECT) {
- if (td->loc2d == bezm->bezt->vec[2]) {
- if (bezm->swapHs == 1)
- td->loc2d= (bezts + bezm->newIndex)->vec[0];
- else
- td->loc2d= (bezts + bezm->newIndex)->vec[2];
- adjusted[j] = 1;
- }
- }
- }
- if (bezm->bezt->f2 & SELECT) {
- if (td->loc2d == bezm->bezt->vec[1]) {
- td->loc2d= (bezts + bezm->newIndex)->vec[1];
- adjusted[j] = 1;
- }
- }
- }
- else {
- /* whole curve */
- if (ei->icu->ipo==IPO_BEZ) {
- if (td->loc2d == bezm->bezt->vec[0]) {
- if (bezm->swapHs == 1)
- td->loc2d= (bezts + bezm->newIndex)->vec[2];
- else
- td->loc2d= (bezts + bezm->newIndex)->vec[0];
- adjusted[j] = 1;
- }
-
- if (td->loc2d == bezm->bezt->vec[2]) {
- if (bezm->swapHs == 1)
- td->loc2d= (bezts + bezm->newIndex)->vec[0];
- else
- td->loc2d= (bezts + bezm->newIndex)->vec[2];
- adjusted[j] = 1;
- }
- }
- if (td->loc2d == bezm->bezt->vec[1]) {
- td->loc2d= (bezts + bezm->newIndex)->vec[1];
- adjusted[j] = 1;
- }
- }
- }
-
- }
-
- /* free temp memory used for 'adjusted' array */
- MEM_freeN(adjusted);
-}
-
-/* This function is called by recalcData during the Transform loop to recalculate
- * the handles of curves and sort the keyframes so that the curves draw correctly.
- * It is only called if some keyframes have moved out of order.
- */
-void remake_ipo_transdata (TransInfo *t)
-{
- EditIpo *ei;
- int a;
-
- /* sort and reassign verts */
- ei= G.sipo->editipo;
- for (a=0; a<G.sipo->totipo; a++, ei++) {
- if (ISPOIN(ei, flag & IPO_VISIBLE, icu)) {
- if (ei->icu->bezt) {
- BeztMap *bezm;
-
- /* adjust transform-data pointers */
- bezm= bezt_to_beztmaps(ei->icu->bezt, ei->icu->totvert);
- sort_time_beztmaps(bezm, ei->icu->totvert);
- beztmap_to_data(t, ei, bezm, ei->icu->totvert);
-
- /* re-sort actual beztriples (perhaps this could be done using the beztmaps to save time?) */
- sort_time_ipocurve(ei->icu);
-
- /* free mapping stuff */
- MEM_freeN(bezm);
-
- /* make sure handles are all set correctly */
- testhandles_ipocurve(ei->icu);
- }
- }
- }
-
- /* remake ipokeys */
- if (G.sipo->showkey) make_ipokey();
-}
-
-/* This function acts as the entrypoint for transforms in the IPO editor (as for
- * the Action and NLA editors). The actual transform loop is not here anymore.
- */
-void transform_ipo (int mode)
-{
- short tmode;
-
- /* data-validation */
- if (G.sipo->ipo && G.sipo->ipo->id.lib) return;
- if (G.sipo->editipo==0) return;
-
- /* convert ascii-based mode to transform system constants (mode) */
- switch (mode) {
- case 'g':
- tmode= TFM_TRANSLATION;
- break;
- case 'r':
- tmode= TFM_ROTATION;
- break;
- case 's':
- tmode= TFM_RESIZE;
- break;
- default:
- tmode= 0;
- return;
- }
-
- /* the transform system method involved depends on the selection */
- get_status_editipo();
- if (totipo_vertsel) {
- /* we're probably in editmode, so only selected verts - transform system */
- initTransform(tmode, CTX_NONE);
- Transform();
- }
- else if (totipo_edit==0 && totipo_sel!=0) {
- /* we're not in editmode, so entire curves get moved - transform system*/
- initTransform(tmode, CTX_NONE);
- Transform();
- }
- else {
- /* shapekey mode? special transform code */
- if (totipo_edit==0)
- move_keys(OBACT);
- return;
- }
-
- /* cleanup */
- editipo_changed(G.sipo, 1);
-}
-
-/**************************************************/
-
-void filter_sampledata(float *data, int sfra, int efra)
-{
- float *da;
- int a;
-
- da= data+1;
- for(a=sfra+1; a<efra; a++, da++) {
- da[0]=(float)( 0.25*da[-1] + 0.5*da[0] + 0.25*da[1]);
- }
-
-}
-
-void sampledata_to_ipocurve(float *data, int sfra, int efra, IpoCurve *icu)
-{
- BezTriple *bezt;
- float *da;
- int a, tot;
-
- filter_sampledata(data, sfra, efra);
- filter_sampledata(data, sfra, efra);
-
- icu->ipo= IPO_LIN;
-
- if(icu->bezt) MEM_freeN(icu->bezt);
- icu->bezt= NULL;
-
- tot= 1; /* first point */
- da= data+1;
- for(a=sfra+1; a<efra; a++, da++) {
- if( IS_EQ(da[0], da[1])==0 && IS_EQ(da[1], da[2])==0 ) tot++;
- }
-
- icu->totvert= tot;
- bezt= icu->bezt= MEM_callocN(tot*sizeof(BezTriple), "samplebezt");
- bezt->vec[1][0]= (float)sfra;
- bezt->vec[1][1]= data[0];
- bezt++;
- da= data+1;
- for(a=sfra+1; a<efra; a++, da++) {
- if( IS_EQ(da[0], da[1])==0 && IS_EQ(da[1], da[2])==0 ) {
- bezt->vec[1][0]= (float)a;
- bezt->vec[1][1]= da[0];
- bezt++;
- }
- }
-}
-
-void ipo_record(void)
-{
- /* only 1 or 2 active curves
- * make a copy (ESC)
- *
- * reference point is the current situation (or 0)
- * dx (dy) is the height correction factor
- * CTRL: start record
- */
- extern double tottime;
- EditIpo *ei, *ei1=0, *ei2=0;
- ScrArea *sa, *oldarea;
-// Ipo *ipo;
- Object *ob;
- void *poin;
- double swaptime;
- float or1, or2 = 0.0, fac, *data1, *data2;
- int type, a, afbreek=0, firsttime=1, cfrao, cfra, sfra, efra;
- unsigned short event = 0;
- short anim, val, xn, yn, mvalo[2], mval[2];
- char str[128];
-
- if(G.sipo->from==NULL) return;
- if(SFRA>=EFRA) return;
-
- anim= pupmenu("Record Mouse %t|Still %x1|Play Animation %x2");
- if(anim < 1) return;
- if(anim!=2) anim= 0;
-
- ob= OBACT;
- /* find the curves... */
-
- ei= G.sipo->editipo;
- for(a=0; a<G.sipo->totipo; a++) {
- if(ei->flag & IPO_VISIBLE) {
-
- if(ei1==0) ei1= ei;
- else if(ei2==0) ei2= ei;
- else {
- error("Maximum 2 visible curves");
- return;
- }
- }
- ei++;
- }
-
- if(ei1==0) {
- error("Select 1 or 2 channels");
- return;
- }
-
- /* make curves ready, start values */
- if(ei1->icu==NULL)
- ei1->icu= verify_ipocurve(G.sipo->from, G.sipo->blocktype, G.sipo->actname, G.sipo->constname, G.sipo->bonename, ei1->adrcode);
- if(ei1->icu==NULL) return;
-
- poin= get_ipo_poin(G.sipo->from, ei1->icu, &type);
- if(poin) ei1->icu->curval= read_ipo_poin(poin, type);
- or1= ei1->icu->curval;
- ei1->icu->flag |= IPO_LOCK;
-
- if(ei2) {
- if(ei2->icu==NULL)
- ei2->icu= verify_ipocurve(G.sipo->from, G.sipo->blocktype, G.sipo->actname, G.sipo->constname, G.sipo->bonename, ei2->adrcode);
- if(ei2->icu==NULL) return;
-
- poin= get_ipo_poin(G.sipo->from, ei2->icu, &type);
- if(poin) ei2->icu->curval= read_ipo_poin(poin, type);
- or2= ei2->icu->curval;
- ei2->icu->flag |= IPO_LOCK;
- }
- fac= G.v2d->cur.ymax - G.v2d->cur.ymin;
- fac/= (float)curarea->winy;
-
- /* which area */
- oldarea= curarea;
- sa= G.curscreen->areabase.first;
- while(sa) {
- if(sa->win) {
- if(G.sipo->blocktype==ID_MA || G.sipo->blocktype==ID_LA) {
- if(sa->spacetype==SPACE_BUTS) break;
- }
- else {
- if(sa->spacetype==SPACE_VIEW3D) break;
- }
- }
- sa= sa->next;
- }
- if(sa) areawinset(sa->win);
-
- /* can we? */
- while(get_mbut()&L_MOUSE) BIF_wait_for_statechange();
- data1= MEM_callocN(sizeof(float)*(EFRA-SFRA+1), "data1");
- data2= MEM_callocN(sizeof(float)*(EFRA-SFRA+1), "data2");
-
- getmouseco_areawin(mvalo);
- xn= mvalo[0]; yn= mvalo[1];
- waitcursor(1);
-
- tottime= 0.0;
- swaptime= 1.0/FPS;
-
- cfrao= CFRA;
- cfra=efra= SFRA;
- sfra= EFRA;
-
- while(afbreek==0) {
-
- getmouseco_areawin(mval);
-
- if(mval[0]!= mvalo[0] || mval[1]!=mvalo[1] || firsttime || (G.qual & LR_CTRLKEY)) {
- if(anim) CFRA= cfra;
- else firsttime= 0;
-
- set_timecursor(cfra);
-
- /* do ipo: first all, then the specific ones */
- if(anim==2) {
- do_ob_ipo(ob);
- do_ob_key(ob);
- }
-
- ei1->icu->curval= or1 + fac*(mval[0]-xn);
- if(ei2) ei2->icu->curval= or2 + fac*(mval[1]-yn);
-
- do_ipo_nocalc(G.sipo->ipo);
-
- if(G.qual & LR_CTRLKEY) {
- sprintf(str, "Recording... %d\n", cfra);
- data1[ cfra-SFRA ]= ei1->icu->curval;
- if(ei2) data2[ cfra-SFRA ]= ei2->icu->curval;
-
- sfra= MIN2(sfra, cfra);
- efra= MAX2(efra, cfra);
- }
- else sprintf(str, "Mouse Recording. Use Ctrl to start. LeftMouse or Space to end");
-
- do_ob_key(ob);
- ob->recalc |= OB_RECALC;
-
- headerprint(str);
-
- if(sa) scrarea_do_windraw(sa);
-
- /* minimal wait swaptime */
- tottime -= swaptime;
- while (update_time()) PIL_sleep_ms(1);
-
- screen_swapbuffers();
-
- tottime= 0.0;
-
- mvalo[0]= mval[0];
- mvalo[1]= mval[1];
-
- if(anim || (G.qual & LR_CTRLKEY)) {
- cfra++;
- if(cfra>EFRA) cfra= SFRA;
- }
- }
-
- while(qtest()) {
- event= extern_qread(&val);
- if(val) {
- switch(event) {
- case LEFTMOUSE: case ESCKEY: case SPACEKEY: case RETKEY:
- afbreek= 1;
- break;
- }
- }
- if(afbreek) break;
- }
- }
-
- if(event!=ESCKEY) {
- sampledata_to_ipocurve(data1+sfra-SFRA, sfra, efra, ei1->icu);
- if(ei2) sampledata_to_ipocurve(data2+sfra-SFRA, sfra, efra, ei2->icu);
-
- /* not nice when this is on */
- if(G.sipo->showkey) {
- G.sipo->showkey= 0;
- free_ipokey(&G.sipo->ipokey);
- }
- }
- else {
- /* undo: start values */
- poin= get_ipo_poin(G.sipo->from, ei1->icu, &type);
- if(poin) write_ipo_poin(poin, type, or1);
- if(ei1->icu->bezt==NULL) {
- BLI_remlink( &(G.sipo->ipo->curve), ei1->icu);
- MEM_freeN(ei1->icu);
- ei1->icu= NULL;
- }
- if(ei2) {
- poin= get_ipo_poin(G.sipo->from, ei2->icu, &type);
- if(poin) write_ipo_poin(poin, type, or2);
- if(ei2->icu->bezt==NULL) {
- BLI_remlink( &(G.sipo->ipo->curve), ei2->icu);
- MEM_freeN(ei2->icu);
- ei2->icu= NULL;
- }
- }
- }
-
- if(ei1->icu) ei1->icu->flag &= ~IPO_LOCK;
- if(ei2 && ei2->icu) ei2->icu->flag &= ~IPO_LOCK;
-
- editipo_changed(G.sipo, 0);
- do_ipo(G.sipo->ipo);
- waitcursor(0);
-
- allqueue(REDRAWVIEW3D, 0);
- if(sa) scrarea_queue_headredraw(sa); /* headerprint */
- scrarea_queue_redraw(oldarea);
- CFRA= cfrao;
-
- /* for the time being? */
- update_for_newframe();
- BIF_undo_push("Ipo Record");
-
- MEM_freeN(data1);
- MEM_freeN(data2);
-}
-
-/* while transform, update for curves */
-void remake_object_ipos(Object *ob)
-{
- IpoCurve *icu;
-
- if (!ob)
- return;
- if (!ob->ipo)
- return;
-
- for (icu = ob->ipo->curve.first; icu; icu=icu->next){
- sort_time_ipocurve(icu);
- testhandles_ipocurve(icu);
- }
-}
-
-/* Only delete the nominated keyframe from provided ipo-curve.
- * Not recommended to be used many times successively. For that
- * there is delete_ipo_keys(). */
-void delete_icu_key(IpoCurve *icu, int index)
-{
- /* firstly check that index is valid */
- if (index < 0)
- index *= -1;
- if (index >= icu->totvert)
- return;
- if (!icu) return;
-
- /* Delete this key */
- memcpy (&icu->bezt[index], &icu->bezt[index+1], sizeof (BezTriple)*(icu->totvert-index-1));
- icu->totvert--;
-
- /* recalc handles */
- calchandles_ipocurve(icu);
-}
-
-void delete_ipo_keys(Ipo *ipo)
-{
- IpoCurve *icu, *next;
- int i;
-
- if (!ipo)
- return;
-
- for (icu=ipo->curve.first; icu; icu=next){
- next = icu->next;
- for (i=0; i<icu->totvert; i++){
- if (icu->bezt[i].f2 & 1){
- // Delete the item
- memcpy (&icu->bezt[i], &icu->bezt[i+1], sizeof (BezTriple)*(icu->totvert-i-1));
- icu->totvert--;
- i--;
- }
- }
- if (!icu->totvert){
- /* Delete the curve */
- BLI_remlink( &(ipo->curve), icu);
- free_ipo_curve(icu);
- }
- }
-}
-
-
-int add_trans_ipo_keys(Ipo *ipo, TransVert *tv, int tvtot)
-{
- int i;
- IpoCurve *icu;
-
- if (!ipo)
- return tvtot;
-
- for (icu=ipo->curve.first; icu; icu=icu->next){
- for (i=0; i<icu->totvert; i++){
- if (icu->bezt[i].f2 & 1){
- tv[tvtot+0].loc=icu->bezt[i].vec[0];
- tv[tvtot+1].loc=icu->bezt[i].vec[1];
- tv[tvtot+2].loc=icu->bezt[i].vec[2];
-
- memcpy (&tv[tvtot+0].oldloc, icu->bezt[i].vec[0], sizeof (float)*3);
- memcpy (&tv[tvtot+1].oldloc, icu->bezt[i].vec[1], sizeof (float)*3);
- memcpy (&tv[tvtot+2].oldloc, icu->bezt[i].vec[2], sizeof (float)*3);
- tvtot+=3;
- }
- }
- }
-
- return tvtot;
-}
-
-void duplicate_ipo_keys(Ipo *ipo)
-{
- IpoCurve *icu;
- int i;
- BezTriple *newbezt;
-
- if (!ipo)
- return;
-
- for (icu=ipo->curve.first; icu; icu=icu->next){
- for (i=0; i<icu->totvert; i++){
- /* If a key is selected */
- if (icu->bezt[i].f2 & 1){
- /* Expand the list */
- newbezt = MEM_callocN(sizeof(BezTriple) * (icu->totvert+1), "beztriple");
- memcpy (newbezt, icu->bezt, sizeof(BezTriple) * (i+1));
- memcpy (newbezt+i+1, icu->bezt+i, sizeof(BezTriple));
- memcpy (newbezt+i+2, icu->bezt+i+1, sizeof (BezTriple) *(icu->totvert-(i+1)));
- icu->totvert++;
- MEM_freeN (icu->bezt);
- icu->bezt=newbezt;
- /* Unselect the current key*/
- icu->bezt[i].f1 &= ~ 1;
- icu->bezt[i].f2 &= ~ 1;
- icu->bezt[i].f3 &= ~ 1;
- i++;
- /* Select the copied key */
- icu->bezt[i].f1 |= 1;
- icu->bezt[i].f2 |= 1;
- icu->bezt[i].f3 |= 1;
-
- }
- }
- }
-}
-
-void move_to_frame(void)
-{
- EditIpo *ei;
- BezTriple *bezt;
- ID *id;
- float cfra;
- int a, b;
-
- if(G.sipo->editipo==0) return;
-
- ei= G.sipo->editipo;
-
- for(a=0; a<G.sipo->totipo; a++, ei++) {
- if (ISPOIN(ei, flag & IPO_VISIBLE, icu)) {
- if(G.sipo->showkey || (ei->flag & IPO_EDIT)) {
-
- if(ei->icu->bezt) {
-
- b= ei->icu->totvert;
- bezt= ei->icu->bezt;
- while(b--) {
- if(BEZSELECTED(bezt)) {
-
- cfra= bezt->vec[1][0]/G.scene->r.framelen;
-
- id= G.sipo->from;
- if(id && GS(id->name)==ID_OB ) {
- Object *ob= (Object *)id;
- if(ob->sf!=0.0 && (ob->ipoflag & OB_OFFS_OB) ) {
- cfra+= ob->sf/G.scene->r.framelen;
- }
- }
- CFRA= (int)floor(cfra+0.5);
-
- if(CFRA < 1) CFRA= 1;
- update_for_newframe();
-
- break;
- }
- bezt++;
- }
- }
- }
- }
- }
- BIF_undo_push("Set frame to selected Ipo vertex");
-}
diff --git a/source/blender/src/editipo_lib.c b/source/blender/src/editipo_lib.c
deleted file mode 100644
index 41044ad13d7..00000000000
--- a/source/blender/src/editipo_lib.c
+++ /dev/null
@@ -1,401 +0,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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2005. Full recode
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/* ********** General calls (minimal dependencies) for editing Ipos in Blender ************* */
-
-#include <stdio.h>
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "DNA_curve_types.h"
-#include "DNA_ipo_types.h"
-#include "DNA_key_types.h"
-#include "DNA_object_types.h"
-#include "DNA_space_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_view3d_types.h"
-
-#include "BKE_global.h"
-#include "BKE_ipo.h"
-#include "BKE_key.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_resources.h"
-
-#include "BSE_edit.h"
-#include "BSE_editipo_types.h"
-#include "BSE_editipo.h"
-#include "BSE_drawipo.h"
-
-#include "blendef.h"
-#include "mydevice.h"
-
-char *ob_ic_names[OB_TOTNAM] = { "LocX", "LocY", "LocZ", "dLocX", "dLocY", "dLocZ",
- "RotX", "RotY", "RotZ", "dRotX", "dRotY", "dRotZ",
- "ScaleX", "ScaleY", "ScaleZ", "dScaleX", "dScaleY", "dScaleZ",
- "Layer", "Time", "ColR", "ColG", "ColB", "ColA",
- "FStreng", "FFall", "RDamp", "Damping", "Perm", "FMaxD" };
-
-char *co_ic_names[CO_TOTNAM] = { "Inf", "HeadTail" };
-char *mtex_ic_names[TEX_TOTNAM] = { "OfsX", "OfsY", "OfsZ", "SizeX", "SizeY", "SizeZ",
- "texR", "texG", "texB", "DefVar", "Col", "Nor", "Var",
- "Disp" };
-char *tex_ic_names[TE_TOTNAM] = { "NSize", "NDepth", "NType", "Turb", "Vnw1", "Vnw2",
- "Vnw3", "Vnw4", "MinkMExp", "DistM", "ColT", "iScale",
- "DistA", "MgType", "MgH", "Lacu", "Oct", "MgOff",
- "MgGain", "NBase1", "NBase2", "ColR", "ColG", "ColB", "Bright", "Contras"};
-char *ma_ic_names[MA_TOTNAM] = { "R", "G", "B", "SpecR", "SpecG", "SpecB", "MirR",
- "MirG", "MirB", "Ref", "Alpha", "Emit", "Amb", "Spec",
- "Hard", "SpTra", "Ior", "Mode", "HaSize", "Translu",
- "RayMir", "FresMir", "FresMirI", "FresTra", "FresTraI",
- "TraGlow" };
-char *seq_ic_names[SEQ_TOTNAM] = { "Fac" };
-char *cu_ic_names[CU_TOTNAM] = { "Speed" };
-char *key_ic_names[KEY_TOTNAM] = { "Speed", "Key 1", "Key 2", "Key 3", "Key 4", "Key 5",
- "Key 6", "Key 7", "Key 8", "Key 9", "Key 10",
- "Key 11", "Key 12", "Key 13", "Key 14", "Key 15",
- "Key 16", "Key 17", "Key 18", "Key 19", "Key 20",
- "Key 21", "Key 22", "Key 23", "Key 24", "Key 25",
- "Key 26", "Key 27", "Key 28", "Key 29", "Key 30",
- "Key 31", "Key 32", "Key 33", "Key 34", "Key 35",
- "Key 36", "Key 37", "Key 38", "Key 39", "Key 40",
- "Key 41", "Key 42", "Key 43", "Key 44", "Key 45",
- "Key 46", "Key 47", "Key 48", "Key 49", "Key 50",
- "Key 51", "Key 52", "Key 53", "Key 54", "Key 55",
- "Key 56", "Key 57", "Key 58", "Key 59", "Key 60",
- "Key 61", "Key 62", "Key 63"};
-char *wo_ic_names[WO_TOTNAM] = { "HorR", "HorG", "HorB", "ZenR", "ZenG", "ZenB", "Expos",
- "Misi", "MisDi", "MisSta", "MisHi", "StarR", "StarB",
- "StarG", "StarDi", "StarSi" };
-char *la_ic_names[LA_TOTNAM] = { "Energ", "R", "G", "B", "Dist", "SpoSi", "SpoBl",
- "Quad1", "Quad2", "HaInt" };
-/* yafray: two curve names added, 'Apert' for aperture, and 'FDist' for focal distance */
-char *cam_ic_names[CAM_TOTNAM] = { "Lens", "ClSta", "ClEnd", "Apert", "FDist", "ShiftX", "ShiftY" };
-char *snd_ic_names[SND_TOTNAM] = { "Vol", "Pitch", "Pan", "Atten" };
-char *ac_ic_names[AC_TOTNAM] = {"LocX", "LocY", "LocZ", "ScaleX", "ScaleY",
- "ScaleZ", "QuatW", "QuatX", "QuatY", "QuatZ"};
-char *ic_name_empty[1] ={ "" };
-char *fluidsim_ic_names[FLUIDSIM_TOTNAM] = { "Fac-Visc", "Fac-Time", "GravX","GravY","GravZ", "VelX","VelY","VelZ", "Active" };
-char *part_ic_names[PART_TOTNAM] = { "E_Freq", "E_Life", "E_Speed", "E_Angular", "E_Size",
-"Angular", "Size", "Drag", "Brown", "Damp", "Length", "Clump",
-"GravX", "GravY", "GravZ", "KinkAmp", "KinkFreq", "KinkShape", "BBTilt"};
-
-/* gets the appropriate icon for the given blocktype */
-int geticon_ipo_blocktype(short blocktype)
-{
- switch (blocktype) {
- case ID_OB:
- return ICON_OBJECT;
- case ID_PO:
- return ICON_POSE_HLT;
- case ID_KE:
- return ICON_EDIT;
- case ID_MA:
- return ICON_MATERIAL;
- case ID_WO:
- return ICON_WORLD;
- case ID_CU:
- return ICON_CURVE;
- case ID_CA:
- return ICON_CAMERA;
- case ID_LA:
- return ICON_LAMP;
- case ID_TE:
- return ICON_TEXTURE;
- case ID_CO:
- return ICON_CONSTRAINT;
- case ID_FLUIDSIM:
- return ICON_WORLD; // uggh
- default:
- return 0; // what about blank icon?
- }
-}
-
-/* get name of ipo-curve
- * - icu should be valid pointer
- * - ob is only needed for a shapekey-related hack
- */
-char *getname_ipocurve(IpoCurve *icu, Object *ob)
-{
- switch (icu->blocktype) {
- case ID_OB:
- return getname_ob_ei(icu->adrcode, 0); /* dummy 2nd arg */
- case ID_PO:
- return getname_ac_ei(icu->adrcode);
- case ID_KE:
- {
- static char name[32];
- Key *key= ob_get_key(ob);
- KeyBlock *kb= key_get_keyblock(key, icu->adrcode);
-
- /* only return name if it has been set, otherwise use
- * default method using static string (Key #)
- */
- if ((kb) && (kb->name[0] != '\0'))
- return kb->name; /* return keyblock's name */
-
- /* in case keyblock is not named or no key/keyblock was found */
- sprintf(name, "Key %d", icu->adrcode);
- return name;
- }
-
- default: /* fixme - add all of the other types! */
- return NULL;
- }
-}
-
-char *getname_ac_ei(int nr)
-{
- switch(nr) {
- case AC_LOC_X:
- case AC_LOC_Y:
- case AC_LOC_Z:
- return ac_ic_names[nr-1];
- case AC_SIZE_X:
- case AC_SIZE_Y:
- case AC_SIZE_Z:
- return ac_ic_names[nr-10];
- case AC_QUAT_X:
- case AC_QUAT_Y:
- case AC_QUAT_Z:
- case AC_QUAT_W:
- return ac_ic_names[nr-19];
- default:
- return ic_name_empty[0]; /* empty */
- }
-}
-
-char *getname_co_ei(int nr)
-{
- switch(nr){
- case CO_ENFORCE:
- case CO_HEADTAIL:
- return co_ic_names[nr-1];
- }
- return ic_name_empty[0];
-}
-
-char *getname_ob_ei(int nr, int colipo)
-{
- if(nr>=OB_LOC_X && nr <= OB_PD_FMAXD) return ob_ic_names[nr-1];
-
- return ic_name_empty[0];
-}
-
-char *getname_tex_ei(int nr)
-{
- if(nr>=TE_NSIZE && nr<=TE_CONTRA) return tex_ic_names[nr-1];
-
- return ic_name_empty[0];
-}
-
-char *getname_mtex_ei(int nr)
-{
- if(nr>=MAP_OFS_X && nr<=MAP_DISP) return mtex_ic_names[nr-1];
-
- return ic_name_empty[0];
-}
-
-char *getname_mat_ei(int nr)
-{
- if(nr>=MA_MAP1) return getname_mtex_ei((nr & (MA_MAP1-1)));
- else {
- if(nr>=MA_COL_R && nr<=MA_ADD) return ma_ic_names[nr-1];
- }
- return ic_name_empty[0];
-}
-
-char *getname_world_ei(int nr)
-{
- if(nr>=MA_MAP1) return getname_mtex_ei((nr & (MA_MAP1-1)));
- else {
- if(nr>=WO_HOR_R && nr<=WO_STARSIZE) return wo_ic_names[nr-1];
- }
- return ic_name_empty[0];
-}
-
-char *getname_seq_ei(int nr)
-{
- if(nr == SEQ_FAC1) return seq_ic_names[nr-1];
- return ic_name_empty[0];
-}
-
-char *getname_cu_ei(int nr)
-{
- if(nr==CU_SPEED) return cu_ic_names[nr-1];
- return ic_name_empty[0];
-}
-
-char *getname_la_ei(int nr)
-{
- if(nr>=MA_MAP1) return getname_mtex_ei((nr & (MA_MAP1-1)));
- else {
- if(nr>=LA_ENERGY && nr<=LA_HALOINT) return la_ic_names[nr-1];
- }
- return ic_name_empty[0];
-}
-
-char *getname_cam_ei(int nr)
-{
- if(nr>=CAM_LENS && nr<=CAM_SHIFT_Y) return cam_ic_names[nr-1];
- return ic_name_empty[0];
-}
-
-char *getname_snd_ei(int nr)
-{
- if(nr>=SND_VOLUME && nr<=SND_ATTEN) return snd_ic_names[nr-1];
- return ic_name_empty[0];
-}
-
-char *getname_fluidsim_ei(int nr)
-{
- if(nr <= FLUIDSIM_TOTIPO) return fluidsim_ic_names[nr-1];
- return ic_name_empty[0];
-}
-char *getname_part_ei(int nr)
-{
- if(nr <= PART_TOTIPO) return part_ic_names[nr-1];
- return ic_name_empty[0];
-}
-
-
-void boundbox_ipocurve(IpoCurve *icu, int selectedonly)
-{
- BezTriple *bezt;
- float vec[3]={0.0,0.0,0.0};
- float min[3], max[3];
- int a;
-
- if(icu->totvert) {
- INIT_MINMAX(min, max);
-
- if(icu->bezt ) {
- a= icu->totvert;
- bezt= icu->bezt;
- while(a--) {
- if(icu->vartype & IPO_BITS) {
- if((bezt->f2 & SELECT) || !selectedonly) {
- vec[0]= bezt->vec[1][0];
- vec[1]= 0.0;
- DO_MINMAX(vec, min, max);
-
- vec[1]= 16.0;
- DO_MINMAX(vec, min, max);
- }
- }
- else {
- if((bezt->f1 & SELECT) || !selectedonly) {
- if(icu->ipo==IPO_BEZ && a!=icu->totvert-1)
- DO_MINMAX(bezt->vec[0], min, max);
- }
- if((bezt->f2 & SELECT) || !selectedonly)
- DO_MINMAX(bezt->vec[1], min, max);
- if((bezt->f3 & SELECT) || !selectedonly) {
- if(icu->ipo==IPO_BEZ && a!=0)
- DO_MINMAX(bezt->vec[2], min, max);
- }
- }
-
- bezt++;
- }
- }
- if(min[0]==max[0]) max[0]= (float)(min[0]+1.0);
- if(min[1]==max[1]) max[1]= (float)(min[1]+0.1);
-
- icu->totrct.xmin= min[0];
- icu->totrct.ymin= min[1];
- icu->totrct.xmax= max[0];
- icu->totrct.ymax= max[1];
- }
- else {
- icu->totrct.xmin= icu->totrct.ymin= 0.0;
- icu->totrct.xmax= EFRA;
- icu->totrct.ymax= 1.0;
- }
-}
-
-void boundbox_ipo(Ipo *ipo, rctf *bb, int selectedonly)
-{
- IpoCurve *icu;
- int first= 1;
-
- icu= ipo->curve.first;
- while(icu) {
-
- boundbox_ipocurve(icu, selectedonly);
-
- if(first) {
- *bb= icu->totrct;
- first= 0;
- }
- else BLI_union_rctf(bb, &(icu->totrct));
-
- icu= icu->next;
- }
-}
-
-
-unsigned int ipo_rainbow(int cur, int tot)
-{
- float dfac, fac, sat;
-
- dfac= (float)(1.0/( (float)tot+1.0));
-
- /* this calculation makes 2 or 4 different cycles of rainbow colors */
- if(cur< tot/2) fac= (float)(cur*2.0f*dfac);
- else fac= (float)((cur-tot/2)*2.0f*dfac +dfac);
- if(tot > 32) fac= fac*1.95f;
- if(fac>1.0f) fac-= 1.0f;
-
- if(fac>0.5f && fac<0.8f) sat= 0.4f;
- else sat= 0.5f;
-
- return hsv_to_cpack(fac, sat, 1.0f);
-}
-
-/* exported to python, hrms... (ton) */
-int texchannel_to_adrcode(int channel)
-{
- switch(channel) {
- case 0: return MA_MAP1;
- case 1: return MA_MAP2;
- case 2: return MA_MAP3;
- case 3: return MA_MAP4;
- case 4: return MA_MAP5;
- case 5: return MA_MAP6;
- case 6: return MA_MAP7;
- case 7: return MA_MAP8;
- case 8: return MA_MAP9;
- case 9: return MA_MAP10;
- default: return 0;
- }
-}
-
-
-
-
diff --git a/source/blender/src/editipo_mods.c b/source/blender/src/editipo_mods.c
deleted file mode 100644
index ae283ce8c0b..00000000000
--- a/source/blender/src/editipo_mods.c
+++ /dev/null
@@ -1,1403 +0,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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2005. Full recode
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-
-/* ********** Selection and set Handle code for editing Ipos in Blender ************* */
-/*
- mouse_select_ipo() is in editipo.c
-*/
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#ifndef WIN32
-#include <unistd.h>
-#else
-#include <io.h>
-#endif
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "DNA_curve_types.h"
-#include "DNA_ipo_types.h"
-#include "DNA_key_types.h"
-#include "DNA_object_types.h"
-#include "DNA_space_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_view3d_types.h"
-
-#include "BKE_global.h"
-#include "BKE_action.h"
-#include "BKE_ipo.h"
-#include "BKE_key.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_editaction.h"
-#include "BIF_interface.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-
-#include "BSE_edit.h"
-#include "BSE_editipo_types.h"
-#include "BSE_editipo.h"
-#include "BSE_drawipo.h"
-#include "BSE_trans_types.h"
-#include "BSE_time.h"
-
-#include "BDR_drawobject.h"
-
-#include "blendef.h"
-#include "mydevice.h"
-
-extern int totipo_edit, totipo_sel, totipo_vertsel, totipo_vis;
-
-void ipo_toggle_showkey(void)
-{
- if(G.sipo->showkey) G.sipo->showkey= 0;
- else G.sipo->showkey= 1;
-
- free_ipokey(&G.sipo->ipokey);
- if(G.sipo->ipo) G.sipo->ipo->showkey= G.sipo->showkey;
-
- BIF_undo_push("Toggle Show Key Ipo");
-}
-
-void swap_selectall_editipo(void)
-{
- Object *ob;
- EditIpo *ei;
- IpoKey *ik;
- BezTriple *bezt;
- int a, b; /* , sel=0; */
-
- get_status_editipo();
-
- if(G.sipo->showkey) {
- ik= G.sipo->ipokey.first;
- while(ik) {
- if(totipo_vertsel) ik->flag &= ~1;
- else ik->flag |= 1;
- ik= ik->next;
- }
- update_editipo_flags();
-
- if(G.sipo->showkey && G.sipo->blocktype==ID_OB ) {
- ob= OBACT;
- if(ob && (ob->ipoflag & OB_DRAWKEY)) draw_object_ext(BASACT);
- }
- }
- else if(totipo_edit==0) {
- ei= G.sipo->editipo;
- if (ei){
- for(a=0; a<G.sipo->totipo; a++) {
- if( ei->flag & IPO_VISIBLE ) {
- if(totipo_sel) ei->flag &= ~IPO_SELECT;
- else ei->flag |= IPO_SELECT;
- }
- ei++;
- }
- update_editipo_flags();
- }
- get_status_editipo();
- }
- else {
- ei= G.sipo->editipo;
- for(a=0; a<G.sipo->totipo; a++) {
- if (ISPOIN3(ei, flag & IPO_VISIBLE, flag & IPO_EDIT, icu )) {
- bezt= ei->icu->bezt;
- if(bezt) {
- b= ei->icu->totvert;
- while(b--) {
- if(totipo_vertsel) {
- bezt->f1= bezt->f2= bezt->f3= 0;
- }
- else {
- bezt->f1= bezt->f2= bezt->f3= SELECT;
- }
- bezt++;
- }
- }
- }
- ei++;
- }
-
- }
-
- BIF_undo_push("Swap Select All Ipo");
- scrarea_queue_winredraw(curarea);
-
-}
-
-void swap_visible_editipo(void)
-{
- EditIpo *ei;
- Object *ob;
- int a; /* , sel=0; */
-
- get_status_editipo();
-
-
- ei= G.sipo->editipo;
- for(a=0; a<G.sipo->totipo; a++) {
- if(totipo_vis==0) {
- if(ei->icu) {
- ei->flag |= IPO_VISIBLE;
- ei->flag |= IPO_SELECT;
- }
- }
- else
- ei->flag &= ~IPO_VISIBLE;
- ei++;
- }
-
- update_editipo_flags();
-
- if(G.sipo->showkey) {
-
- make_ipokey();
-
- ob= OBACT;
- if(ob && (ob->ipoflag & OB_DRAWKEY)) allqueue(REDRAWVIEW3D, 0);
- }
-
- scrarea_queue_winredraw(curarea);
- BIF_undo_push("Swap Visible Ipo");
-}
-
-void deselectall_editipo(void)
-{
- EditIpo *ei;
- IpoKey *ik;
- BezTriple *bezt;
- int a, b; /* , sel=0; */
-
- get_status_editipo();
-
- if(G.sipo->showkey) {
- ik= G.sipo->ipokey.first;
- while(ik) {
- ik->flag &= ~1;
- ik= ik->next;
- }
- update_editipo_flags();
-
- }
- else if(totipo_edit==0) {
-
- ei= G.sipo->editipo;
- for(a=0; a<G.sipo->totipo; a++) {
- if( ei->flag & IPO_VISIBLE ) {
- ei->flag &= ~IPO_SELECT;
- }
- ei++;
- }
- update_editipo_flags();
- }
- else {
- ei= G.sipo->editipo;
- for(a=0; a<G.sipo->totipo; a++) {
- if (ISPOIN3(ei, flag & IPO_VISIBLE, flag & IPO_EDIT, icu )) {
- if(ei->icu->bezt) {
- bezt= ei->icu->bezt;
- b= ei->icu->totvert;
- while(b--) {
- bezt->f1= bezt->f2= bezt->f3= 0;
- bezt++;
- }
- }
- }
- ei++;
- }
- }
-
- BIF_undo_push("(De)select all Ipo");
- scrarea_queue_winredraw(curarea);
-}
-
-
-static int icu_keys_bezier_loop(IpoCurve *icu,
- int (*bezier_function)(BezTriple *),
- void (ipocurve_function)(struct IpoCurve *icu))
-{
- /* This loops through the beziers in the Ipocurve, and executes
- * the generic user provided 'bezier_function' on each one.
- * Optionally executes the generic function ipocurve_function on the
- * IPO curve after looping (eg. calchandles_ipocurve)
- */
-
- int b;
- BezTriple *bezt;
-
- b = icu->totvert;
- bezt = icu->bezt;
-
- /* if bezier_function has been specified
- * then loop through each bezier executing
- * it.
- */
-
- if (bezier_function != NULL) {
- while(b--) {
- /* exit with return code 1 if the bezier function
- * returns 1 (good for when you are only interested
- * in finding the first bezier that
- * satisfies a condition).
- */
- if (bezier_function(bezt)) return 1;
- bezt++;
- }
- }
-
- /* if ipocurve_function has been specified
- * then execute it
- */
- if (ipocurve_function != NULL)
- ipocurve_function(icu);
-
- return 0;
-
-}
-
-static int ipo_keys_bezier_loop(Ipo *ipo,
- int (*bezier_function)(BezTriple *),
- void (ipocurve_function)(struct IpoCurve *icu))
-{
- /* This loops through the beziers that are attached to
- * the selected keys on the Ipocurves of the Ipo, and executes
- * the generic user provided 'bezier_function' on each one.
- * Optionally executes the generic function ipocurve_function on a
- * IPO curve after looping (eg. calchandles_ipocurve)
- */
-
- IpoCurve *icu;
-
- if(ipo==NULL) return 0;
-
- /* Loop through each curve in the Ipo
- */
- for (icu=ipo->curve.first; icu; icu=icu->next){
- if (icu_keys_bezier_loop(icu,bezier_function, ipocurve_function))
- return 1;
- }
-
- return 0;
-}
-
-static int selected_bezier_loop(int (*looptest)(EditIpo *),
- int (*bezier_function)(BezTriple *),
- void (ipocurve_function)(struct IpoCurve *icu))
-{
- /* This loops through the beziers that are attached to
- * selected keys in editmode in the IPO window, and executes
- * the generic user-provided 'bezier_function' on each one
- * that satisfies the 'looptest' function. Optionally executes
- * the generic function ipocurve_function on a IPO curve
- * after looping (eg. calchandles_ipocurve)
- */
-
- EditIpo *ei;
- BezTriple *bezt;
- int a, b;
-
- /* Get the first Edit Ipo from the selected Ipos
- */
- ei= G.sipo->editipo;
-
- /* Loop throught all of the selected Ipo's
- */
- for(a=0; a<G.sipo->totipo; a++, ei++) {
- /* Do a user provided test on the Edit Ipo
- * to determine whether we want to process it
- */
- if (looptest(ei)) {
- /* Loop through the selected
- * beziers on the Edit Ipo
- */
- bezt = ei->icu->bezt;
- b = ei->icu->totvert;
-
- /* if bezier_function has been specified
- * then loop through each bezier executing
- * it.
- */
- if (bezier_function != NULL) {
- while(b--) {
- /* exit with return code 1 if the bezier function
- * returns 1 (good for when you are only interested
- * in finding the first bezier that
- * satisfies a condition).
- */
- if (bezier_function(bezt)) return 1;
- bezt++;
- }
- }
-
- /* if ipocurve_function has been specified
- * then execute it
- */
- if (ipocurve_function != NULL)
- ipocurve_function(ei->icu);
- }
- /* nufte flourdje zim ploopydu <-- random dutch looking comment ;) */
- /* looks more like russian to me! (ton) */
- }
-
- return 0;
-}
-
-int select_bezier_add(BezTriple *bezt)
-{
- /* Select the bezier triple */
- bezt->f1 |= SELECT;
- bezt->f2 |= SELECT;
- bezt->f3 |= SELECT;
- return 0;
-}
-
-int select_bezier_subtract(BezTriple *bezt)
-{
- /* Deselect the bezier triple */
- bezt->f1 &= ~SELECT;
- bezt->f2 &= ~SELECT;
- bezt->f3 &= ~SELECT;
- return 0;
-}
-
-int select_bezier_invert(BezTriple *bezt)
-{
- /* Invert the selection for the bezier triple */
- bezt->f2 ^= SELECT;
- if ( bezt->f2 & SELECT ) {
- bezt->f1 |= SELECT;
- bezt->f3 |= SELECT;
- }
- else {
- bezt->f1 &= ~SELECT;
- bezt->f3 &= ~SELECT;
- }
- return 0;
-}
-
-static int set_bezier_auto(BezTriple *bezt)
-{
- /* Sets the selected bezier handles to type 'auto'
- */
-
- /* is a handle selected? If so
- * set it to type auto
- */
- if(bezt->f1 || bezt->f3) {
- if(bezt->f1) bezt->h1= 1; /* the secret code for auto */
- if(bezt->f3) bezt->h2= 1;
-
- /* if the handles are not of the same type, set them
- * to type free
- */
- if(bezt->h1!=bezt->h2) {
- if ELEM(bezt->h1, HD_ALIGN, HD_AUTO) bezt->h1= HD_FREE;
- if ELEM(bezt->h2, HD_ALIGN, HD_AUTO) bezt->h2= HD_FREE;
- }
- }
- return 0;
-}
-
-static int set_bezier_vector(BezTriple *bezt)
-{
- /* Sets the selected bezier handles to type 'vector'
- */
-
- /* is a handle selected? If so
- * set it to type vector
- */
- if(bezt->f1 || bezt->f3) {
- if(bezt->f1) bezt->h1= 2; /* the code for vector */
- if(bezt->f3) bezt->h2= 2;
-
- /* if the handles are not of the same type, set them
- * to type free
- */
- if(bezt->h1!=bezt->h2) {
- if ELEM(bezt->h1, HD_ALIGN, HD_AUTO) bezt->h1= HD_FREE;
- if ELEM(bezt->h2, HD_ALIGN, HD_AUTO) bezt->h2= HD_FREE;
- }
- }
- return 0;
-}
-
-static int bezier_isfree(BezTriple *bezt)
-{
- /* queries whether the handle should be set
- * to type 'free' (I think)
- */
- if(bezt->f1 && bezt->h1) return 1;
- if(bezt->f3 && bezt->h2) return 1;
- return 0;
-}
-
-static int set_bezier_free(BezTriple *bezt)
-{
- /* Sets selected bezier handles to type 'free'
- */
- if(bezt->f1) bezt->h1= HD_FREE;
- if(bezt->f3) bezt->h2= HD_FREE;
- return 0;
-}
-
-static int set_bezier_align(BezTriple *bezt)
-{
- /* Sets selected bezier handles to type 'align'
- */
- if(bezt->f1) bezt->h1= HD_ALIGN;
- if(bezt->f3) bezt->h2= HD_ALIGN;
- return 0;
-}
-
-static int vis_edit_icu_bez(EditIpo *ei)
-{
- /* A 4 part test for an EditIpo :
- * is it a) visible
- * b) in edit mode
- * c) does it contain an Ipo Curve
- * d) does that ipo curve have a bezier
- *
- * (The reason why I don't just use the macro
- * is I need a pointer to a function.)
- */
- return (ISPOIN4(ei, flag & IPO_VISIBLE, flag & IPO_EDIT, icu, icu->bezt));
-}
-
-void select_ipo_bezier_keys(Ipo *ipo, int selectmode)
-{
- /* Select all of the beziers in all
- * of the Ipo curves belonging to the
- * Ipo, using the selection mode.
- */
- switch (selectmode) {
- case SELECT_ADD:
- ipo_keys_bezier_loop(ipo, select_bezier_add, NULL);
- break;
- case SELECT_SUBTRACT:
- ipo_keys_bezier_loop(ipo, select_bezier_subtract, NULL);
- break;
- case SELECT_INVERT:
- ipo_keys_bezier_loop(ipo, select_bezier_invert, NULL);
- break;
- }
-}
-
-void select_icu_bezier_keys(IpoCurve *icu, int selectmode)
-{
- /* Select all of the beziers in all
- * of the Ipo curves belonging to the
- * Ipo, using the selection mode.
- */
- switch (selectmode) {
- case SELECT_ADD:
- icu_keys_bezier_loop(icu, select_bezier_add, NULL);
- break;
- case SELECT_SUBTRACT:
- icu_keys_bezier_loop(icu, select_bezier_subtract, NULL);
- break;
- case SELECT_INVERT:
- icu_keys_bezier_loop(icu, select_bezier_invert, NULL);
- break;
- }
-}
-
-void sethandles_ipo_keys(Ipo *ipo, int code)
-{
- /* this function lets you set bezier handles all to
- * one type for some Ipo's (e.g. with hotkeys through
- * the action window).
- */
-
- /* code==1: set autohandle */
- /* code==2: set vectorhandle */
- /* als code==3 (HD_ALIGN) toggelt het, vectorhandles worden HD_FREE */
-
- switch(code) {
- case 1:
- /*** Set to auto ***/
- ipo_keys_bezier_loop(ipo, set_bezier_auto,
- calchandles_ipocurve);
- break;
- case 2:
- /*** Set to vector ***/
- ipo_keys_bezier_loop(ipo, set_bezier_vector,
- calchandles_ipocurve);
- break;
- default:
- if ( ipo_keys_bezier_loop(ipo, bezier_isfree, NULL) ) {
- /*** Set to free ***/
- ipo_keys_bezier_loop(ipo, set_bezier_free,
- calchandles_ipocurve);
- }
- else {
- /*** Set to align ***/
- ipo_keys_bezier_loop(ipo, set_bezier_align,
- calchandles_ipocurve);
- }
- break;
- }
-}
-
-static int snap_bezier_nearest(BezTriple *bezt)
-{
- if(bezt->f2 & SELECT)
- bezt->vec[1][0]= (float)(floor(bezt->vec[1][0]+0.5));
- return 0;
-}
-
-static int snap_bezier_nearestsec(BezTriple *bezt)
-{
- float secf = FPS;
- if(bezt->f2 & SELECT)
- bezt->vec[1][0]= (float)(floor(bezt->vec[1][0]/secf + 0.5f) * secf);
- return 0;
-}
-
-static int snap_bezier_cframe(BezTriple *bezt)
-{
- if(bezt->f2 & SELECT)
- bezt->vec[1][0]= (float)CFRA;
- return 0;
-}
-
-static int snap_bezier_nearmarker(BezTriple *bezt)
-{
- if(bezt->f2 & SELECT)
- bezt->vec[1][0]= (float)find_nearest_marker_time(bezt->vec[1][0]);
-
- return 0;
-}
-
-void snap_ipo_keys(Ipo *ipo, short snaptype)
-{
- switch (snaptype) {
- case 1: /* snap to nearest frame */
- ipo_keys_bezier_loop(ipo, snap_bezier_nearest, calchandles_ipocurve);
- break;
- case 2: /* snap to current frame */
- ipo_keys_bezier_loop(ipo, snap_bezier_cframe, calchandles_ipocurve);
- break;
- case 3: /* snap to nearest marker */
- ipo_keys_bezier_loop(ipo, snap_bezier_nearmarker, calchandles_ipocurve);
- break;
- case 4: /* snap to nearest second */
- ipo_keys_bezier_loop(ipo, snap_bezier_nearestsec, calchandles_ipocurve);
- break;
- default: /* just in case */
- ipo_keys_bezier_loop(ipo, snap_bezier_nearest, calchandles_ipocurve);
- break;
- }
-}
-
-static int mirror_bezier_cframe(BezTriple *bezt)
-{
- float diff;
-
- if(bezt->f2 & SELECT) {
- diff= ((float)CFRA - bezt->vec[1][0]);
- bezt->vec[1][0]= ((float)CFRA + diff);
- }
-
- return 0;
-}
-
-static int mirror_bezier_yaxis(BezTriple *bezt)
-{
- float diff;
-
- if(bezt->f2 & SELECT) {
- diff= (0.0f - bezt->vec[1][0]);
- bezt->vec[1][0]= (0.0f + diff);
- }
-
- return 0;
-}
-
-static int mirror_bezier_xaxis(BezTriple *bezt)
-{
- float diff;
-
- if(bezt->f2 & SELECT) {
- diff= (0.0f - bezt->vec[1][1]);
- bezt->vec[1][1]= (0.0f + diff);
- }
-
- return 0;
-}
-
-static int mirror_bezier_marker(BezTriple *bezt)
-{
- static TimeMarker *marker;
- static short initialised = 0;
- float diff;
-
- /* In order for this mirror function to work without
- * any extra arguments being added, we use the case
- * of bezt==NULL to denote that we should find the
- * marker to mirror over. The static pointer is safe
- * to use this way, as it will be set to null after
- * each cycle in which this is called.
- */
-
- if (bezt) {
- /* mirroring time */
- if((bezt->f2 & SELECT) && (marker)) {
- diff= (marker->frame - bezt->vec[1][0]);
- bezt->vec[1][0]= (marker->frame + diff);
- }
- }
- else {
- /* initialisation time */
- if (initialised) {
- /* reset everything for safety */
- marker = NULL;
- initialised = 0;
- }
- else {
- /* try to find a marker */
- for (marker= G.scene->markers.first; marker; marker=marker->next) {
- if (marker->flag & SELECT) {
- initialised = 1;
- break;
- }
- }
-
- if (initialised == 0)
- marker = NULL;
- }
- }
-
- return 0;
-}
-
-void mirror_ipo_keys(Ipo *ipo, short mirror_type)
-{
- switch (mirror_type) {
- case 1: /* mirror over current frame */
- ipo_keys_bezier_loop(ipo, mirror_bezier_cframe, calchandles_ipocurve);
- break;
- case 2: /* mirror over frame 0 */
- ipo_keys_bezier_loop(ipo, mirror_bezier_yaxis, calchandles_ipocurve);
- break;
- case 3: /* mirror over value 0 */
- ipo_keys_bezier_loop(ipo, mirror_bezier_xaxis, calchandles_ipocurve);
- break;
- case 4: /* mirror over marker */
- mirror_bezier_marker(NULL);
- ipo_keys_bezier_loop(ipo, mirror_bezier_marker, calchandles_ipocurve);
- mirror_bezier_marker(NULL);
- break;
- default: /* just in case */
- ipo_keys_bezier_loop(ipo, mirror_bezier_yaxis, calchandles_ipocurve);
- break;
- }
-}
-
-/* This function is called to calculate the average location of the
- * selected keyframes, and place the current frame at that location.
- *
- * It must be called like so:
- * snap_cfra_ipo_keys(NULL, -1); // initialise the static vars first
- * for (ipo...) snap_cfra_ipo_keys(ipo, 0); // sum up keyframe times
- * snap_cfra_ipo_keys(NULL, 1); // set current frame after taking average
- */
-void snap_cfra_ipo_keys(Ipo *ipo, short mode)
-{
- static int cfra;
- static int tot;
-
- IpoCurve *icu;
- BezTriple *bezt;
- int a;
-
-
- if (mode == -1) {
- /* initialise a new snap-operation */
- cfra= 0;
- tot= 0;
- }
- else if (mode == 1) {
- /* set current frame - using average frame */
- if (tot != 0)
- CFRA = cfra / tot;
- }
- else {
- /* loop through keys in ipo, summing the frame
- * numbers of those that are selected
- */
- if (ipo == NULL)
- return;
-
- for (icu= ipo->curve.first; icu; icu= icu->next) {
- for (a=0, bezt=icu->bezt; a < icu->totvert; a++, bezt++) {
- if (BEZSELECTED(bezt)) {
- cfra += bezt->vec[1][0];
- tot++;
- }
- }
- }
- }
-}
-
-
-/* currently only used by some action editor tools, but may soon get used by ipo editor */
-/* restore = whether to map points back to ipo-time
- * only_keys = whether to only adjust the location of the center point of beztriples
- */
-void actstrip_map_ipo_keys(Object *ob, Ipo *ipo, short restore, short only_keys)
-{
- IpoCurve *icu;
- BezTriple *bezt;
- int a;
-
- if (ipo==NULL) return;
-
- /* loop through all ipo curves, adjusting the times of the selected keys */
- for (icu= ipo->curve.first; icu; icu= icu->next) {
- for (a=0, bezt=icu->bezt; a<icu->totvert; a++, bezt++) {
- /* are the times being adjusted for editing, or has editing finished */
- if (restore) {
- if (only_keys == 0) {
- bezt->vec[0][0]= get_action_frame(ob, bezt->vec[0][0]);
- bezt->vec[2][0]= get_action_frame(ob, bezt->vec[2][0]);
- }
- bezt->vec[1][0]= get_action_frame(ob, bezt->vec[1][0]);
- }
- else {
- if (only_keys == 0) {
- bezt->vec[0][0]= get_action_frame_inv(ob, bezt->vec[0][0]);
- bezt->vec[2][0]= get_action_frame_inv(ob, bezt->vec[2][0]);
- }
- bezt->vec[1][0]= get_action_frame_inv(ob, bezt->vec[1][0]);
- }
- }
- }
-}
-
-static void ipo_curves_auto_horiz(void)
-{
- EditIpo *ei;
- int a, set= 1;
-
- ei= G.sipo->editipo;
- for(a=0; a<G.sipo->totipo; a++, ei++) {
- if (ISPOIN3(ei, flag & IPO_VISIBLE, flag & IPO_SELECT, icu))
- if(ei->flag & IPO_AUTO_HORIZ) set= 0;
- }
-
- ei= G.sipo->editipo;
- for(a=0; a<G.sipo->totipo; a++, ei++) {
- if (ISPOIN3(ei, flag & IPO_VISIBLE, flag & IPO_SELECT, icu)) {
- if(set) ei->flag |= IPO_AUTO_HORIZ;
- else ei->flag &= ~IPO_AUTO_HORIZ;
- }
- }
- update_editipo_flags();
-}
-
-void sethandles_ipo(int code)
-{
- /* this function lets you set bezier handles all to
- * one type for some selected keys in edit mode in the
- * IPO window (e.g. with hotkeys)
- */
-
- /* code==1: set autohandle */
- /* code==2: set vectorhandle */
- /* als code==3 (HD_ALIGN) toggelt het, vectorhandles worden HD_FREE */
-
- if(G.sipo->ipo && G.sipo->ipo->id.lib) return;
-
- switch(code) {
- case HD_AUTO:
- /*** Set to auto ***/
- selected_bezier_loop(vis_edit_icu_bez, set_bezier_auto,
- calchandles_ipocurve);
- break;
- case HD_VECT:
- /*** Set to vector ***/
- selected_bezier_loop(vis_edit_icu_bez, set_bezier_vector,
- calchandles_ipocurve);
- break;
- case HD_AUTO_ANIM:
- /* set to enforce autohandles to be horizontal on extremes */
- ipo_curves_auto_horiz();
-
- break;
- default:
- if (selected_bezier_loop(vis_edit_icu_bez, bezier_isfree, NULL) ) {
- /*** Set to free ***/
- selected_bezier_loop(vis_edit_icu_bez, set_bezier_free,
- calchandles_ipocurve);
- }
- else {
- /*** Set to align ***/
- selected_bezier_loop(vis_edit_icu_bez, set_bezier_align,
- calchandles_ipocurve);
- }
- break;
- }
-
- editipo_changed(G.sipo, 1);
- BIF_undo_push("Set handles Ipo");
-}
-
-
-static void set_ipocurve_constant(struct IpoCurve *icu) {
- /* Sets the type of the IPO curve to constant
- */
- icu->ipo= IPO_CONST;
-}
-
-static void set_ipocurve_linear(struct IpoCurve *icu) {
- /* Sets the type of the IPO curve to linear
- */
- icu->ipo= IPO_LIN;
-}
-
-static void set_ipocurve_bezier(struct IpoCurve *icu) {
- /* Sets the type of the IPO curve to bezier
- */
-
- /* dont regenerate hendels for bezier ipo curves */
- if (icu->ipo==IPO_BEZ) return;
-
- /* curve handels aren't generated for non bezier curve types */
- icu->ipo= IPO_BEZ;
- calchandles_ipocurve(icu);
-}
-
-
-void setipotype_ipo(Ipo *ipo, int code)
-{
- /* Sets the type of the each ipo curve in the
- * Ipo to a value based on the code
- */
- switch (code) {
- case 1:
- ipo_keys_bezier_loop(ipo, NULL, set_ipocurve_constant);
- break;
- case 2:
- ipo_keys_bezier_loop(ipo, NULL, set_ipocurve_linear);
- break;
- case 3:
- ipo_keys_bezier_loop(ipo, NULL, set_ipocurve_bezier);
- break;
- }
-}
-
-void setexprap_ipoloop(Ipo *ipo, int code)
-{
- IpoCurve *icu;
-
- /* Loop through each curve in the Ipo */
- for (icu=ipo->curve.first; icu; icu=icu->next)
- icu->extrap= code;
-}
-
-void set_ipotype(void)
-{
- EditIpo *ei;
- int a;
- short event;
-
- if(G.sipo->ipo && G.sipo->ipo->id.lib) return;
- if(G.sipo->showkey) return;
- get_status_editipo();
-
- if(G.sipo->blocktype==ID_KE && totipo_edit==0 && totipo_sel==0) {
- Key *key= ob_get_key((Object *)G.sipo->from);
- Object *ob= OBACT;
- KeyBlock *kb;
-
- if(key==NULL) return;
- kb= BLI_findlink(&key->block, ob->shapenr-1);
- if(kb==NULL) return;
-
- event= pupmenu("Key Type %t|Linear %x1|Cardinal %x2|B Spline %x3");
- if(event < 1) return;
-
- kb->type= 0;
- if(event==1) kb->type= KEY_LINEAR;
- if(event==2) kb->type= KEY_CARDINAL;
- if(event==3) kb->type= KEY_BSPLINE;
- }
- else {
- event= pupmenu("Ipo Type %t|Constant %x1|Linear %x2|Bezier %x3");
- if(event < 1) return;
-
- ei= G.sipo->editipo;
- for(a=0; a<G.sipo->totipo; a++, ei++) {
- if (ISPOIN3(ei, flag & IPO_VISIBLE, flag & IPO_SELECT, icu)) {
- if(event==1) ei->icu->ipo= IPO_CONST;
- else if(event==2) ei->icu->ipo= IPO_LIN;
- else ei->icu->ipo= IPO_BEZ;
- }
- }
- }
- BIF_undo_push("Set ipo type");
- scrarea_queue_winredraw(curarea);
-}
-
-void borderselect_ipo(void)
-{
- EditIpo *ei;
- IpoKey *ik;
- BezTriple *bezt;
- rcti rect;
- rctf rectf;
- int a, b, val;
- short mval[2];
-
- get_status_editipo();
-
- val= get_border(&rect, 3);
-
- if(val) {
- /* map ipo-points for editing if scaled ipo */
- if (NLA_IPO_SCALED) {
- actstrip_map_ipo_keys(OBACT, G.sipo->ipo, 0, 0);
- }
-
- mval[0]= rect.xmin;
- mval[1]= rect.ymin;
- areamouseco_to_ipoco(G.v2d, mval, &rectf.xmin, &rectf.ymin);
- mval[0]= rect.xmax;
- mval[1]= rect.ymax;
- areamouseco_to_ipoco(G.v2d, mval, &rectf.xmax, &rectf.ymax);
-
- if(G.sipo->showkey) {
- ik= G.sipo->ipokey.first;
- while(ik) {
- if(rectf.xmin<ik->val && rectf.xmax>ik->val) {
- if(val==LEFTMOUSE) ik->flag |= 1;
- else ik->flag &= ~1;
- }
- ik= ik->next;
- }
- update_editipo_flags();
- }
- else if(totipo_edit==0) {
- if(rect.xmin<rect.xmax && rect.ymin<rect.ymax)
- select_proj_ipo(&rectf, val);
- }
- else {
-
- ei= G.sipo->editipo;
- for(a=0; a<G.sipo->totipo; a++, ei++) {
- if (ISPOIN3(ei, flag & IPO_VISIBLE, flag & IPO_EDIT, icu)) {
- if(ei->icu->bezt) {
- b= ei->icu->totvert;
- bezt= ei->icu->bezt;
- while(b--) {
- int bit= (val==LEFTMOUSE);
-
- if(BLI_in_rctf(&rectf, bezt->vec[0][0], bezt->vec[0][1]))
- bezt->f1 = (bezt->f1&~SELECT) | bit;
- if(BLI_in_rctf(&rectf, bezt->vec[1][0], bezt->vec[1][1]))
- bezt->f2 = (bezt->f2&~SELECT) | bit;
- if(BLI_in_rctf(&rectf, bezt->vec[2][0], bezt->vec[2][1]))
- bezt->f3 = (bezt->f3&~SELECT) | bit;
-
- bezt++;
- }
- }
- }
- }
- }
-
- /* undo mapping of ipo-points for drawing if scaled ipo */
- if (NLA_IPO_SCALED) {
- actstrip_map_ipo_keys(OBACT, G.sipo->ipo, 1, 0);
- }
-
- BIF_undo_push("Border select Ipo");
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- }
-}
-
-
-
-void nextkey(ListBase *elems, int dir)
-{
- IpoKey *ik, *previk;
- int totsel;
-
- if(dir==1) ik= elems->last;
- else ik= elems->first;
- previk= 0;
- totsel= 0;
-
- while(ik) {
-
- if(ik->flag) totsel++;
-
- if(previk) {
- if(G.qual & LR_SHIFTKEY) {
- if(ik->flag) previk->flag= 1;
- }
- else previk->flag= ik->flag;
- }
-
- previk= ik;
- if(dir==1) ik= ik->prev;
- else ik= ik->next;
-
- if(G.qual & LR_SHIFTKEY);
- else if(ik==0) previk->flag= 0;
- }
-
- /* when no key select: */
- if(totsel==0) {
- if(dir==1) ik= elems->first;
- else ik= elems->last;
-
- if(ik) ik->flag= 1;
- }
-}
-
-
-void nextkey_ipo(int dir) /* call from ipo queue */
-{
- IpoKey *ik;
- int a;
-
- if(G.sipo->showkey==0) return;
-
- nextkey(&G.sipo->ipokey, dir);
-
- /* copy to beziers */
- ik= G.sipo->ipokey.first;
- while(ik) {
- for(a=0; a<G.sipo->totipo; a++) {
- if(ik->data[a]) ik->data[a]->f1= ik->data[a]->f2= ik->data[a]->f3= ik->flag;
- }
- ik= ik->next;
- }
-
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWIPO, 0);
- if(G.sipo->blocktype == ID_OB) allqueue(REDRAWVIEW3D, 0);
-}
-
-void nextkey_obipo(int dir) /* only call external from view3d queue */
-{
- Base *base;
- Object *ob;
- ListBase elems;
- IpoKey *ik;
- int a;
-
- if (!G.vd) {
- error("Can't do this! Open a 3D window");
- return;
- }
-
- /* problem: this doesnt work when you mix dLoc keys with Loc keys */
-
- base= FIRSTBASE;
- while(base) {
- if TESTBASE(base) {
- ob= base->object;
- if( (ob->ipoflag & OB_DRAWKEY) && ob->ipo && ob->ipo->showkey) {
- elems.first= elems.last= 0;
- make_ipokey_transform(ob, &elems, 0);
-
- if(elems.first) {
-
- nextkey(&elems, dir);
-
- /* copy to beziers */
- ik= elems.first;
- while(ik) {
- for(a=0; a<OB_TOTIPO; a++) {
- if(ik->data[a]) ik->data[a]->f1= ik->data[a]->f2= ik->data[a]->f3= ik->flag;
- }
- ik= ik->next;
- }
-
- free_ipokey(&elems);
- }
- }
- }
-
- base= base->next;
- }
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWVIEW3D, 0);
- allspace(REMAKEIPO, 0);
- allqueue(REDRAWIPO, 0);
-}
-
-int is_ipo_key_selected(Ipo *ipo)
-{
- int i;
- IpoCurve *icu;
-
- if (!ipo)
- return 0;
-
- for (icu=ipo->curve.first; icu; icu=icu->next){
- for (i=0; i<icu->totvert; i++)
- if (BEZSELECTED(&icu->bezt[i]))
- return 1;
- }
-
- return 0;
-}
-
-void set_ipo_key_selection(Ipo *ipo, int sel)
-{
- int i;
- IpoCurve *icu;
-
- if (!ipo)
- return;
-
- for (icu=ipo->curve.first; icu; icu=icu->next){
- for (i=0; i<icu->totvert; i++){
- if (sel == 2) {
- icu->bezt[i].f1^=1;
- icu->bezt[i].f2^=1;
- icu->bezt[i].f3^=1;
- }
- else if (sel == 1){
- icu->bezt[i].f1|=1;
- icu->bezt[i].f2|=1;
- icu->bezt[i].f3|=1;
- }
- else{
- icu->bezt[i].f1&=~1;
- icu->bezt[i].f2&=~1;
- icu->bezt[i].f3&=~1;
- }
- }
- }
-}
-
-int fullselect_ipo_keys(Ipo *ipo)
-{
- int i;
- IpoCurve *icu;
- int tvtot = 0;
-
- if (!ipo)
- return tvtot;
-
- for (icu=ipo->curve.first; icu; icu=icu->next) {
- for (i=0; i<icu->totvert; i++){
- if (icu->bezt[i].f2 & 1){
- tvtot+=3;
- icu->bezt[i].f1 |= 1;
- icu->bezt[i].f3 |= 1;
- }
- }
- }
-
- return tvtot;
-}
-
-
-void borderselect_icu_key(IpoCurve *icu, float xmin, float xmax,
- int (*select_function)(BezTriple *))
-{
- /* Selects all bezier triples in the Ipocurve
- * between times xmin and xmax, using the selection
- * function.
- */
-
- int i;
-
- /* loop through all of the bezier triples in
- * the Ipocurve -- if the triple occurs between
- * times xmin and xmax then select it using the selection
- * function
- */
- for (i=0; i<icu->totvert; i++){
- if (icu->bezt[i].vec[1][0] > xmin && icu->bezt[i].vec[1][0] < xmax ){
- select_function(&(icu->bezt[i]));
- }
- }
-}
-
-void borderselect_ipo_key(Ipo *ipo, float xmin, float xmax, int selectmode)
-{
- /* Selects all bezier triples in each Ipocurve of the
- * Ipo between times xmin and xmax, using the selection mode.
- */
-
- IpoCurve *icu;
- int (*select_function)(BezTriple *);
-
- /* If the ipo is no good then return */
- if (!ipo)
- return;
-
- /* Set the selection function based on the
- * selection mode.
- */
- switch(selectmode) {
- case SELECT_ADD:
- select_function = select_bezier_add;
- break;
- case SELECT_SUBTRACT:
- select_function = select_bezier_subtract;
- break;
- case SELECT_INVERT:
- select_function = select_bezier_invert;
- break;
- default:
- return;
- }
-
- /* loop through all of the bezier triples in all
- * of the Ipocurves -- if the triple occurs between
- * times xmin and xmax then select it using the selection
- * function
- */
- for (icu=ipo->curve.first; icu; icu=icu->next){
- borderselect_icu_key(icu, xmin, xmax, select_function);
- }
-}
-
-void select_ipo_key(Ipo *ipo, float selx, int selectmode)
-{
- /* Selects all bezier triples in each Ipocurve of the
- * Ipo at time selx, using the selection mode.
- */
- int i;
- IpoCurve *icu;
- int (*select_function)(BezTriple *);
-
- /* If the ipo is no good then return */
- if (!ipo)
- return;
-
- /* Set the selection function based on the
- * selection mode.
- */
- switch(selectmode) {
- case SELECT_ADD:
- select_function = select_bezier_add;
- break;
- case SELECT_SUBTRACT:
- select_function = select_bezier_subtract;
- break;
- case SELECT_INVERT:
- select_function = select_bezier_invert;
- break;
- default:
- return;
- }
-
- /* loop through all of the bezier triples in all
- * of the Ipocurves -- if the triple occurs at
- * time selx then select it using the selection
- * function
- */
- for (icu=ipo->curve.first; icu; icu=icu->next){
- for (i=0; i<icu->totvert; i++){
- if (icu->bezt[i].vec[1][0]==selx){
- select_function(&(icu->bezt[i]));
- }
- }
- }
-}
-
-void select_icu_key(IpoCurve *icu, float selx, int selectmode)
-{
- /* Selects all bezier triples in the Ipocurve
- * at time selx, using the selection mode.
- * This is kind of sloppy the obvious similarities
- * with the above function, forgive me ...
- */
- int i;
- int (*select_function)(BezTriple *);
-
- /* If the icu is no good then return */
- if (!icu)
- return;
-
- /* Set the selection function based on the
- * selection mode.
- */
- switch(selectmode) {
- case SELECT_ADD:
- select_function = select_bezier_add;
- break;
- case SELECT_SUBTRACT:
- select_function = select_bezier_subtract;
- break;
- case SELECT_INVERT:
- select_function = select_bezier_invert;
- break;
- default:
- return;
- }
-
- /* loop through all of the bezier triples in
- * the Ipocurve -- if the triple occurs at
- * time selx then select it using the selection
- * function
- */
- for (i=0; i<icu->totvert; i++){
- if (icu->bezt[i].vec[1][0]==selx){
- select_function(&(icu->bezt[i]));
- }
- }
-}
-
-void set_exprap_ipo(int mode)
-{
- EditIpo *ei;
- int a;
-
- if(G.sipo->ipo && G.sipo->ipo->id.lib) return;
- /* in case of keys: always ok */
-
- ei= G.sipo->editipo;
- for(a=0; a<G.sipo->totipo; a++, ei++) {
- if (ISPOIN(ei, flag & IPO_VISIBLE, icu)) {
- if( (ei->flag & IPO_EDIT) || (ei->flag & IPO_SELECT) || (G.sipo->showkey) ) {
- ei->icu->extrap= mode;
- }
- }
- }
-
- editipo_changed(G.sipo, 1);
- BIF_undo_push("Set extrapolation Ipo");
-}
diff --git a/source/blender/src/editkey.c b/source/blender/src/editkey.c
deleted file mode 100644
index 5cc193f8844..00000000000
--- a/source/blender/src/editkey.c
+++ /dev/null
@@ -1,777 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <math.h>
-#include <string.h>
-
-#ifndef WIN32
-#include <unistd.h>
-#else
-#include <io.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "DNA_action_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_ipo_types.h"
-#include "DNA_key_types.h"
-#include "DNA_lattice_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_view2d_types.h"
-
-#include "BKE_action.h"
-#include "BKE_anim.h"
-#include "BKE_curve.h"
-#include "BKE_depsgraph.h"
-#include "BKE_global.h"
-#include "BKE_ipo.h"
-#include "BKE_key.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
-#include "BKE_mesh.h"
-#include "BKE_object.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_editkey.h"
-#include "BIF_editview.h"
-#include "BIF_mywindow.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-#include "BIF_interface.h"
-
-#include "BSE_editipo.h"
-#include "BSE_trans_types.h"
-
-#include "BDR_editobject.h"
-
-#include "blendef.h"
-#include "mydevice.h"
-
-extern ListBase editNurb; /* in editcurve.c */
-
-/* temporary storage for slider values */
-/* pretty bad static stuff... is secured in drawaction.c though */
-float meshslidervals[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,
- 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,
- 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};
-
-static IpoCurve *get_key_icu(Ipo *ipo, int keynum)
-{
- /* return the Ipocurve that has the specified
- * keynum as ardcode -- return NULL if no such
- * curve exists.
- */
- IpoCurve *icu;
-
- if (!ipo)
- return NULL;
-
- for (icu = ipo->curve.first; icu ; icu = icu->next) {
- if (!icu->adrcode) continue;
- if (icu->adrcode == keynum) return icu;
- }
-
- return NULL;
-}
-
-BezTriple *get_bezt_icu_time(IpoCurve *icu, float *frame, float *val)
-{
- /* this function tries to find a bezier that is within
- * 0.25 time units from the specified frame. If there
- * are more than one such beziers, it returns the
- * closest one.
- */
- int i;
- float d, dmin = 0.25, newframe;
- BezTriple *bezt = NULL;
-
- newframe = *frame;
-
- for (i=0; i<icu->totvert; i++){
- d = fabs(icu->bezt[i].vec[1][0] - *frame);
- if (d < dmin) {
- dmin = d;
- newframe = icu->bezt[i].vec[1][0];
- *val = icu->bezt[i].vec[1][1];
- bezt = icu->bezt + i;
- }
- }
-
- *frame = newframe;
- return bezt;
-}
-
-static void rvk_slider_func(void *voidob, void *voidkeynum)
-{
- /* the callback for the rvk sliders ... copies the
- * value from the temporary array into a bezier at the
- * right frame on the right ipo curve (creating both the
- * ipo curve and the bezier if needed).
- */
- Object *ob= voidob;
- IpoCurve *icu=NULL;
- BezTriple *bezt=NULL;
- float cfra, rvkval;
- int keynum = (long) voidkeynum;
-
- cfra = frame_to_float(CFRA);
-
- /* ipo on action or ob? */
- if(ob->ipoflag & OB_ACTION_KEY)
- icu = verify_ipocurve(&ob->id, ID_KE, "Shape", NULL, NULL, keynum);
- else
- icu = verify_ipocurve(&ob->id, ID_KE, NULL, NULL, NULL, keynum);
-
- if (icu) {
- /* if the ipocurve exists, try to get a bezier
- * for this frame
- */
- bezt = get_bezt_icu_time(icu, &cfra, &rvkval);
-
- /* create the bezier triple if one doesn't exist,
- * otherwise modify it's value
- */
- if (bezt == NULL) {
- insert_vert_icu(icu, cfra, meshslidervals[keynum], 0);
- }
- else {
- bezt->vec[1][1] = meshslidervals[keynum];
- }
-
- /* make sure the Ipo's are properly process and
- * redraw as necessary
- */
- sort_time_ipocurve(icu);
- testhandles_ipocurve(icu);
-
- ob->shapeflag &= ~OB_SHAPE_TEMPLOCK;
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- }
- else error("Cannot edit this Shape Key");
-
- allqueue (REDRAWVIEW3D, 0);
- allqueue (REDRAWACTION, 0);
- allqueue (REDRAWNLA, 0);
- allqueue (REDRAWIPO, 0);
- allspace(REMAKEIPO, 0);
-}
-
-static float getrvkval(Ipo *ipo, int keynum)
-{
- /* get the value of the rvk from the
- * ipo curve at the current time -- return 0
- * if no ipo curve exists
- */
- IpoCurve *icu=NULL;
- BezTriple *bezt=NULL;
- float rvkval = 0.0;
- float cfra;
-
- cfra = frame_to_float(CFRA);
- icu = get_key_icu(ipo, keynum);
- if (icu) {
- bezt = get_bezt_icu_time(icu, &cfra, &rvkval);
- if (!bezt) {
- rvkval = eval_icu(icu, cfra);
- }
- }
-
- return rvkval;
-
-}
-
-void make_rvk_slider(uiBlock *block, Object *ob, int keynum,
- int x, int y, int w, int h, char *tip)
-{
- /* create a slider for the rvk */
- uiBut *but;
- Ipo *ipo= NULL;
- Key *key= ob_get_key(ob);
- KeyBlock *kb;
- float min, max;
- int i;
-
- if(key==NULL) return;
-
- /* ipo on action or ob? */
- if(ob->ipoflag & OB_ACTION_KEY) {
- if(ob->action) {
- bActionChannel *achan;
-
- achan= get_action_channel(ob->action, "Shape");
- if(achan) ipo= achan->ipo;
- }
- }
- else ipo= key->ipo;
-
- /* global array */
- meshslidervals[keynum] = getrvkval(ipo, keynum);
-
- kb= key->block.first;
- for (i=0; i<keynum; ++i) kb = kb->next;
-
- if ( (kb->slidermin >= kb->slidermax) ) {
- kb->slidermin = 0.0;
- kb->slidermax = 1.0;
- }
-
- min = (kb->slidermin < meshslidervals[keynum]) ?
- kb->slidermin: meshslidervals[keynum];
-
- max = (kb->slidermax > meshslidervals[keynum]) ?
- kb->slidermax: meshslidervals[keynum];
-
- but=uiDefButF(block, NUMSLI, REDRAWVIEW3D, "",
- x, y , w, h,
- meshslidervals+keynum, min, max, 10, 2, tip);
-
- uiButSetFunc(but, rvk_slider_func, ob, (void *)(long)keynum);
- // no hilite, the winmatrix is not correct later on...
- uiButSetFlag(but, UI_NO_HILITE);
-
-}
-
-static void default_key_ipo(Key *key)
-{
- IpoCurve *icu;
- BezTriple *bezt;
-
- key->ipo= add_ipo("KeyIpo", ID_KE);
-
- icu= MEM_callocN(sizeof(IpoCurve), "ipocurve");
-
- icu->blocktype= ID_KE;
- icu->adrcode= KEY_SPEED;
- icu->flag= IPO_VISIBLE|IPO_SELECT|IPO_AUTO_HORIZ;
- set_icu_vars(icu);
-
- BLI_addtail( &(key->ipo->curve), icu);
-
- icu->bezt= bezt= MEM_callocN(2*sizeof(BezTriple), "defaultipo");
- icu->totvert= 2;
-
- bezt->hide= IPO_BEZ;
- bezt->f1=bezt->f2= bezt->f3= SELECT;
- bezt->h1= bezt->h2= HD_AUTO;
- bezt++;
- bezt->vec[1][0]= 100.0;
- bezt->vec[1][1]= 1.0;
- bezt->hide= IPO_BEZ;
- bezt->f1=bezt->f2= bezt->f3= SELECT;
- bezt->h1= bezt->h2= HD_AUTO;
-
- calchandles_ipocurve(icu);
-}
-
-
-
-/* **************************************** */
-
-void mesh_to_key(Mesh *me, KeyBlock *kb)
-{
- MVert *mvert;
- float *fp;
- int a;
-
- if(me->totvert==0) return;
-
- if(kb->data) MEM_freeN(kb->data);
-
- kb->data= MEM_callocN(me->key->elemsize*me->totvert, "kb->data");
- kb->totelem= me->totvert;
-
- mvert= me->mvert;
- fp= kb->data;
- for(a=0; a<kb->totelem; a++, fp+=3, mvert++) {
- VECCOPY(fp, mvert->co);
-
- }
-}
-
-void key_to_mesh(KeyBlock *kb, Mesh *me)
-{
- MVert *mvert;
- float *fp;
- int a, tot;
-
- mvert= me->mvert;
- fp= kb->data;
-
- tot= MIN2(kb->totelem, me->totvert);
-
- for(a=0; a<tot; a++, fp+=3, mvert++) {
- VECCOPY(mvert->co, fp);
- }
-}
-
-static KeyBlock *add_keyblock(Key *key)
-{
- KeyBlock *kb;
- float curpos= -0.1;
- int tot;
-
- kb= key->block.last;
- if(kb) curpos= kb->pos;
-
- kb= MEM_callocN(sizeof(KeyBlock), "Keyblock");
- BLI_addtail(&key->block, kb);
- kb->type= KEY_CARDINAL;
- tot= BLI_countlist(&key->block);
- if(tot==1) strcpy(kb->name, "Basis");
- else sprintf(kb->name, "Key %d", tot-1);
- kb->adrcode= tot-1;
-
- key->totkey++;
- if(key->totkey==1) key->refkey= kb;
-
-
- if(key->type == KEY_RELATIVE)
- kb->pos= curpos+0.1;
- else {
- curpos= bsystem_time(0, (float)CFRA, 0.0);
- if(calc_ipo_spec(key->ipo, KEY_SPEED, &curpos)==0) {
- curpos /= 100.0;
- }
- kb->pos= curpos;
-
- sort_keys(key);
- }
- return kb;
-}
-
-void insert_meshkey(Mesh *me, short rel)
-{
- Key *key;
- KeyBlock *kb;
-
- if(me->key==NULL) {
- me->key= add_key( (ID *)me);
-
- if(rel)
- me->key->type = KEY_RELATIVE;
- else
- default_key_ipo(me->key);
- }
- key= me->key;
-
- kb= add_keyblock(key);
-
- mesh_to_key(me, kb);
-}
-
-/* ******************** */
-
-void latt_to_key(Lattice *lt, KeyBlock *kb)
-{
- BPoint *bp;
- float *fp;
- int a, tot;
-
- tot= lt->pntsu*lt->pntsv*lt->pntsw;
- if(tot==0) return;
-
- if(kb->data) MEM_freeN(kb->data);
-
- kb->data= MEM_callocN(lt->key->elemsize*tot, "kb->data");
- kb->totelem= tot;
-
- bp= lt->def;
- fp= kb->data;
- for(a=0; a<kb->totelem; a++, fp+=3, bp++) {
- VECCOPY(fp, bp->vec);
- }
-}
-
-void key_to_latt(KeyBlock *kb, Lattice *lt)
-{
- BPoint *bp;
- float *fp;
- int a, tot;
-
- bp= lt->def;
- fp= kb->data;
-
- tot= lt->pntsu*lt->pntsv*lt->pntsw;
- tot= MIN2(kb->totelem, tot);
-
- for(a=0; a<tot; a++, fp+=3, bp++) {
- VECCOPY(bp->vec, fp);
- }
-
-}
-
-/* exported to python... hrms, should not, use object levels! (ton) */
-void insert_lattkey(Lattice *lt, short rel)
-{
- Key *key;
- KeyBlock *kb;
-
- if(lt->key==NULL) {
- lt->key= add_key( (ID *)lt);
- default_key_ipo(lt->key);
- }
- key= lt->key;
-
- kb= add_keyblock(key);
-
- latt_to_key(lt, kb);
-}
-
-/* ******************************** */
-
-void curve_to_key(Curve *cu, KeyBlock *kb, ListBase *nurb)
-{
- Nurb *nu;
- BezTriple *bezt;
- BPoint *bp;
- float *fp;
- int a, tot;
-
- /* count */
- tot= count_curveverts(nurb);
- if(tot==0) return;
-
- if(kb->data) MEM_freeN(kb->data);
-
- kb->data= MEM_callocN(cu->key->elemsize*tot, "kb->data");
- kb->totelem= tot;
-
- nu= nurb->first;
- fp= kb->data;
- while(nu) {
-
- if(nu->bezt) {
- bezt= nu->bezt;
- a= nu->pntsu;
- while(a--) {
- VECCOPY(fp, bezt->vec[0]);
- fp+= 3;
- VECCOPY(fp, bezt->vec[1]);
- fp+= 3;
- VECCOPY(fp, bezt->vec[2]);
- fp+= 3;
- fp[0]= bezt->alfa;
- fp+= 3; /* alphas */
- bezt++;
- }
- }
- else {
- bp= nu->bp;
- a= nu->pntsu*nu->pntsv;
- while(a--) {
- VECCOPY(fp, bp->vec);
- fp[3]= bp->alfa;
-
- fp+= 4;
- bp++;
- }
- }
- nu= nu->next;
- }
-}
-
-void key_to_curve(KeyBlock *kb, Curve *cu, ListBase *nurb)
-{
- Nurb *nu;
- BezTriple *bezt;
- BPoint *bp;
- float *fp;
- int a, tot;
-
- nu= nurb->first;
- fp= kb->data;
-
- tot= count_curveverts(nurb);
-
- tot= MIN2(kb->totelem, tot);
-
- while(nu && tot>0) {
-
- if(nu->bezt) {
- bezt= nu->bezt;
- a= nu->pntsu;
- while(a-- && tot>0) {
- VECCOPY(bezt->vec[0], fp);
- fp+= 3;
- VECCOPY(bezt->vec[1], fp);
- fp+= 3;
- VECCOPY(bezt->vec[2], fp);
- fp+= 3;
- bezt->alfa= fp[0];
- fp+= 3; /* alphas */
-
- tot-= 3;
- bezt++;
- }
- }
- else {
- bp= nu->bp;
- a= nu->pntsu*nu->pntsv;
- while(a-- && tot>0) {
- VECCOPY(bp->vec, fp);
- bp->alfa= fp[3];
-
- fp+= 4;
- tot--;
- bp++;
- }
- }
- nu= nu->next;
- }
-}
-
-
-void insert_curvekey(Curve *cu, short rel)
-{
- Key *key;
- KeyBlock *kb;
-
- if(cu->key==NULL) {
- cu->key= add_key( (ID *)cu);
-
- if (rel)
- cu->key->type = KEY_RELATIVE;
- else
- default_key_ipo(cu->key);
- }
- key= cu->key;
-
- kb= add_keyblock(key);
-
- if(editNurb.first) curve_to_key(cu, kb, &editNurb);
- else curve_to_key(cu, kb, &cu->nurb);
-}
-
-
-/* ******************** */
-
-void insert_shapekey(Object *ob)
-{
- if(get_mesh(ob) && get_mesh(ob)->mr) {
- error("Cannot create shape keys on a multires mesh.");
- }
- else {
- Key *key;
-
- if(ob->type==OB_MESH) insert_meshkey(ob->data, 1);
- else if ELEM(ob->type, OB_CURVE, OB_SURF) insert_curvekey(ob->data, 1);
- else if(ob->type==OB_LATTICE) insert_lattkey(ob->data, 1);
-
- key= ob_get_key(ob);
- ob->shapenr= BLI_countlist(&key->block);
-
- BIF_undo_push("Add Shapekey");
- allspace(REMAKEIPO, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- }
-}
-
-void delete_key(Object *ob)
-{
- KeyBlock *kb, *rkb;
- Key *key;
- IpoCurve *icu;
-
- key= ob_get_key(ob);
- if(key==NULL) return;
-
- kb= BLI_findlink(&key->block, ob->shapenr-1);
-
- if(kb) {
- for(rkb= key->block.first; rkb; rkb= rkb->next)
- if(rkb->relative == ob->shapenr-1)
- rkb->relative= 0;
-
- BLI_remlink(&key->block, kb);
- key->totkey--;
- if(key->refkey== kb) key->refkey= key->block.first;
-
- if(kb->data) MEM_freeN(kb->data);
- MEM_freeN(kb);
-
- for(kb= key->block.first; kb; kb= kb->next) {
- if(kb->adrcode>=ob->shapenr)
- kb->adrcode--;
- }
-
- if(key->ipo) {
-
- for(icu= key->ipo->curve.first; icu; icu= icu->next) {
- if(icu->adrcode==ob->shapenr-1) {
- BLI_remlink(&key->ipo->curve, icu);
- free_ipo_curve(icu);
- break;
- }
- }
- for(icu= key->ipo->curve.first; icu; icu= icu->next)
- if(icu->adrcode>=ob->shapenr)
- icu->adrcode--;
- }
-
- if(ob->shapenr>1) ob->shapenr--;
- }
-
- if(key->totkey==0) {
- if(GS(key->from->name)==ID_ME) ((Mesh *)key->from)->key= NULL;
- else if(GS(key->from->name)==ID_CU) ((Curve *)key->from)->key= NULL;
- else if(GS(key->from->name)==ID_LT) ((Lattice *)key->from)->key= NULL;
-
- free_libblock_us(&(G.main->key), key);
- scrarea_queue_headredraw(curarea); /* ipo remove too */
- }
-
- DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
-
- BIF_undo_push("Delete Shapekey");
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- allspace(REMAKEIPO, 0);
- allqueue(REDRAWIPO, 0);
-}
-
-void move_keys(Object *ob)
-{
- Key *key;
- KeyBlock *kb;
- float div, dy, oldpos, vec[3], dvec[3];
- int afbreek=0, firsttime= 1;
- unsigned short event = 0;
- short mval[2], val, xo, yo;
- char str[32];
-
- if(G.sipo->blocktype!=ID_KE) return;
-
- if(G.sipo->ipo && G.sipo->ipo->id.lib) return;
- if(G.sipo->editipo==NULL) return;
-
- key= ob_get_key(ob);
- if(key==NULL) return;
-
- /* which kb is involved */
- kb= BLI_findlink(&key->block, ob->shapenr-1);
- if(kb==NULL) return;
-
- oldpos= kb->pos;
-
- getmouseco_areawin(mval);
- xo= mval[0];
- yo= mval[1];
- dvec[0]=dvec[1]=dvec[2]= 0.0;
-
- while(afbreek==0) {
- getmouseco_areawin(mval);
- if(mval[0]!=xo || mval[1]!=yo || firsttime) {
- firsttime= 0;
-
- dy= (float)(mval[1]- yo);
-
- div= (float)(G.v2d->mask.ymax-G.v2d->mask.ymin);
- dvec[1]+= (G.v2d->cur.ymax-G.v2d->cur.ymin)*(dy)/div;
-
- VECCOPY(vec, dvec);
-
- apply_keyb_grid(vec, 0.0, 1.0, 0.1, U.flag & USER_AUTOGRABGRID);
- apply_keyb_grid(vec+1, 0.0, 1.0, 0.1, U.flag & USER_AUTOGRABGRID);
-
- kb->pos= oldpos+vec[1];
-
- sprintf(str, "Y: %.3f ", vec[1]);
- headerprint(str);
-
- xo= mval[0];
- yo= mval[1];
-
- force_draw(0);
- }
- else BIF_wait_for_statechange();
-
- while(qtest()) {
- event= extern_qread(&val);
- if(val) {
- switch(event) {
- case ESCKEY:
- case LEFTMOUSE:
- case SPACEKEY:
- afbreek= 1;
- break;
- default:
- arrows_move_cursor(event);
- }
- }
- }
- }
-
- if(event==ESCKEY) {
- kb->pos= oldpos;
- }
-
- sort_keys(key);
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
-
- /* for boundbox */
- editipo_changed(G.sipo, 0);
-
- BIF_undo_push("Move Shapekey(s)");
- allspace(REMAKEIPO, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- scrarea_queue_redraw(curarea);
-}
diff --git a/source/blender/src/editlattice.c b/source/blender/src/editlattice.c
deleted file mode 100644
index f3073cf886a..00000000000
--- a/source/blender/src/editlattice.c
+++ /dev/null
@@ -1,323 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * i.t.t. wat de naam doet vermoeden: ook algemene lattice (calc) functies
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "DNA_curve_types.h"
-#include "DNA_key_types.h"
-#include "DNA_lattice_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_view3d_types.h"
-
-#include "BKE_depsgraph.h"
-#include "BKE_global.h"
-#include "BKE_key.h"
-#include "BKE_lattice.h"
-#include "BKE_mesh.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_editlattice.h"
-#include "BIF_editmode_undo.h"
-#include "BIF_editkey.h"
-#include "BIF_space.h"
-#include "BIF_screen.h"
-#include "BIF_toolbox.h"
-
-#include "BSE_edit.h"
-
-#include "BDR_editobject.h"
-#include "BDR_drawobject.h"
-
-#include "blendef.h"
-#include "mydevice.h"
-
-#include "BKE_armature.h"
-
-/* ***************************** */
-
-void free_editLatt(void)
-{
- if(editLatt) {
- if(editLatt->def) MEM_freeN(editLatt->def);
- if(editLatt->dvert)
- free_dverts(editLatt->dvert, editLatt->pntsu*editLatt->pntsv*editLatt->pntsw);
-
- MEM_freeN(editLatt);
- editLatt= NULL;
- }
-}
-
-
-static void setflagsLatt(int flag)
-{
- BPoint *bp;
- int a;
-
- bp= editLatt->def;
-
- a= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw;
-
- while(a--) {
- if(bp->hide==0) {
- bp->f1= flag;
- }
- bp++;
- }
-}
-
-
-
-void make_editLatt(void)
-{
- Lattice *lt;
- KeyBlock *actkey;
-
- free_editLatt();
-
- lt= G.obedit->data;
-
- actkey = ob_get_keyblock(G.obedit);
- if(actkey) {
- strcpy(G.editModeTitleExtra, "(Key) ");
- key_to_latt(actkey, lt);
- }
-
- editLatt= MEM_dupallocN(lt);
- editLatt->def= MEM_dupallocN(lt->def);
-
- if(lt->dvert) {
- int tot= lt->pntsu*lt->pntsv*lt->pntsw;
- editLatt->dvert = MEM_mallocN (sizeof (MDeformVert)*tot, "Lattice MDeformVert");
- copy_dverts(editLatt->dvert, lt->dvert, tot);
- }
-
- BIF_undo_push("original");
-}
-
-
-void load_editLatt(void)
-{
- Lattice *lt;
- KeyBlock *actkey;
- BPoint *bp;
- float *fp;
- int tot;
-
- lt= G.obedit->data;
-
- actkey = ob_get_keyblock(G.obedit);
- if(actkey) {
- /* active key: vertices */
- tot= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw;
-
- if(actkey->data) MEM_freeN(actkey->data);
-
- fp=actkey->data= MEM_callocN(lt->key->elemsize*tot, "actkey->data");
- actkey->totelem= tot;
-
- bp= editLatt->def;
- while(tot--) {
- VECCOPY(fp, bp->vec);
- fp+= 3;
- bp++;
- }
- }
- else {
-
- MEM_freeN(lt->def);
-
- lt->def= MEM_dupallocN(editLatt->def);
-
- lt->flag= editLatt->flag;
-
- lt->pntsu= editLatt->pntsu;
- lt->pntsv= editLatt->pntsv;
- lt->pntsw= editLatt->pntsw;
-
- lt->typeu= editLatt->typeu;
- lt->typev= editLatt->typev;
- lt->typew= editLatt->typew;
- }
-
- if(lt->dvert) {
- free_dverts(lt->dvert, lt->pntsu*lt->pntsv*lt->pntsw);
- lt->dvert= NULL;
- }
-
- if(editLatt->dvert) {
- int tot= lt->pntsu*lt->pntsv*lt->pntsw;
-
- lt->dvert = MEM_mallocN (sizeof (MDeformVert)*tot, "Lattice MDeformVert");
- copy_dverts(lt->dvert, editLatt->dvert, tot);
- }
-
-}
-
-void remake_editLatt(void)
-{
- if(okee("Reload original data")==0) return;
-
- make_editLatt();
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
-
- BIF_undo_push("Reload original");
-}
-
-
-void deselectall_Latt(void)
-{
- BPoint *bp;
- int a;
-
- bp= editLatt->def;
-
- a= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw;
-
- allqueue(REDRAWVIEW3D, 0);
-
- while(a--) {
- if(bp->hide==0) {
- if(bp->f1) {
- setflagsLatt(0);
- countall();
- BIF_undo_push("(De)select all");
- return;
- }
- }
- bp++;
- }
- setflagsLatt(1);
- countall();
- BIF_undo_push("(De)select all");
-}
-
-static void findnearestLattvert__doClosest(void *userData, BPoint *bp, int x, int y)
-{
- struct { BPoint *bp; short dist, select, mval[2]; } *data = userData;
- float temp = abs(data->mval[0]-x) + abs(data->mval[1]-y);
-
- if ((bp->f1 & SELECT)==data->select) temp += 5;
- if (temp<data->dist) {
- data->dist = temp;
-
- data->bp = bp;
- }
-}
-static BPoint *findnearestLattvert(int sel)
-{
- /* sel==1: selected gets a disadvantage */
- /* in nurb and bezt or bp the nearest is written */
- /* return 0 1 2: handlepunt */
- struct { BPoint *bp; short dist, select, mval[2]; } data = {0};
-
- data.dist = 100;
- data.select = sel;
- getmouseco_areawin(data.mval);
-
- lattice_foreachScreenVert(findnearestLattvert__doClosest, &data);
-
- return data.bp;
-}
-
-
-void mouse_lattice(void)
-{
- BPoint *bp=0;
-
- bp= findnearestLattvert(1);
-
- if(bp) {
- if((G.qual & LR_SHIFTKEY)==0) {
-
- setflagsLatt(0);
- bp->f1 |= SELECT;
-
- allqueue(REDRAWVIEW3D, 0);
- }
- else {
- bp->f1 ^= SELECT; /* swap */
- allqueue(REDRAWVIEW3D, 0);
- }
-
- countall();
- BIF_undo_push("Select");
- }
-
- rightmouse_transform();
-
-}
-
-
-/* **************** undo for lattice object ************** */
-
-static void undoLatt_to_editLatt(void *defv)
-{
- int a= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw;
-
- memcpy(editLatt->def, defv, a*sizeof(BPoint));
-}
-
-static void *editLatt_to_undoLatt(void)
-{
-
- return MEM_dupallocN(editLatt->def);
-}
-
-static void free_undoLatt(void *defv)
-{
- MEM_freeN(defv);
-}
-
-/* and this is all the undo system needs to know */
-void undo_push_lattice(char *name)
-{
- undo_editmode_push(name, free_undoLatt, undoLatt_to_editLatt, editLatt_to_undoLatt);
-}
-
-
-
-/***/
diff --git a/source/blender/src/editmball.c b/source/blender/src/editmball.c
deleted file mode 100644
index 71fbf834c17..00000000000
--- a/source/blender/src/editmball.c
+++ /dev/null
@@ -1,544 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <math.h>
-#include <string.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_rand.h"
-
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_meta_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_userdef_types.h"
-
-#include "BKE_utildefines.h"
-#include "BKE_depsgraph.h"
-#include "BKE_global.h"
-#include "BKE_object.h"
-
-#include "BIF_gl.h"
-#include "BIF_graphics.h"
-#include "BIF_screen.h"
-#include "BIF_toolbox.h"
-#include "BIF_space.h"
-#include "BIF_editmode_undo.h"
-#include "BIF_transform.h"
-
-#include "BDR_editobject.h"
-#include "BDR_editmball.h"
-
-#include "BSE_edit.h"
-#include "BSE_view.h"
-
-#include "blendef.h"
-#include "mydevice.h"
-
-extern short editbutflag;
-
-ListBase editelems= {0, 0};
-MetaElem *lastelem;
-
-/* this function is called, when MetaBall Object is
- * switched from object mode to edit mode */
-void make_editMball()
-{
- MetaBall *mb;
- MetaElem *ml, *newmb;
-
- BLI_freelistN(&editelems);
- lastelem= 0;
-
- mb= G.obedit->data;
- ml= mb->elems.first;
-
- while(ml) {
- newmb= MEM_dupallocN(ml);
- BLI_addtail(&editelems, newmb);
- if(ml->flag & SELECT) lastelem= newmb;
-
- ml= ml->next;
- }
-
- allqueue(REDRAWBUTSEDIT, 0);
-
- countall();
-}
-
-/* this function is called, when MetaBall Object switched from
- * edit mode to object mode. List od MetaElements is copied
- * from editelems to to object->data structure (mb->elems) */
-void load_editMball()
-{
- /* load mball in object */
- MetaBall *mb;
- MetaElem *ml, *newml;
-
- if(G.obedit==NULL) return;
-
- mb= G.obedit->data;
- BLI_freelistN(&(mb->elems));
-
-
- ml= editelems.first;
- while(ml) {
- newml= MEM_dupallocN(ml);
- BLI_addtail(&(mb->elems), newml);
-
- ml= ml->next;
- }
-}
-
-/* add new MetaElement primitive */
-void add_primitiveMball(int dummy_argument)
-{
- MetaElem *ml;
- float *curs, mat[3][3], cent[3], imat[3][3], cmat[3][3];
- short newob= 0;
-
- if(G.scene->id.lib) return;
-
- /* this function also comes from an info window */
- if ELEM(curarea->spacetype, SPACE_VIEW3D, SPACE_INFO); else return;
-
- check_editmode(OB_MBALL);
-
- /* if no obedit: new object and enter editmode */
- if(G.obedit==NULL) {
- add_object_draw(OB_MBALL);
- base_init_from_view3d(BASACT, G.vd);
- G.obedit= BASACT->object;
-
- where_is_object(G.obedit); // need now, for imat
-
- make_editMball();
- setcursor_space(SPACE_VIEW3D, CURSOR_EDIT);
- newob= 1;
- }
-
- /* deselect */
- ml= editelems.first;
- while(ml) {
- ml->flag &= ~SELECT;
- ml= ml->next;
- }
-
- /* imat and center and size */
- Mat3CpyMat4(mat, G.obedit->obmat);
-
- curs= give_cursor();
- VECCOPY(cent, curs);
- cent[0]-= G.obedit->obmat[3][0];
- cent[1]-= G.obedit->obmat[3][1];
- cent[2]-= G.obedit->obmat[3][2];
-
- if (G.vd) {
- Mat3CpyMat4(imat, G.vd->viewmat);
- Mat3MulVecfl(imat, cent);
- Mat3MulMat3(cmat, imat, mat);
- Mat3Inv(imat,cmat);
-
- Mat3MulVecfl(imat, cent);
- }
-
- ml= MEM_callocN(sizeof(MetaElem), "metaelem");
- BLI_addtail(&editelems, ml);
-
- ml->x= cent[0];
- ml->y= cent[1];
- ml->z= cent[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(dummy_argument) {
- case 1:
- ml->type = MB_BALL;
- ml->expx= ml->expy= ml->expz= 1.0;
- break;
- case 2:
- ml->type = MB_TUBE;
- ml->expx= ml->expy= ml->expz= 1.0;
- break;
- case 3:
- ml->type = MB_PLANE;
- ml->expx= ml->expy= ml->expz= 1.0;
- break;
- case 4:
- ml->type = MB_ELIPSOID;
- ml->expx= 1.2f;
- ml->expy= 0.8f;
- ml->expz= 1.0;
- break;
- case 5:
- ml->type = MB_CUBE;
- ml->expx= ml->expy= ml->expz= 1.0;
- break;
- default:
- break;
- }
-
- lastelem= ml;
-
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA); // added ball can influence others
-
- countall();
-
- /* if a new object was created, it stores it in Mball, for reload original data and undo */
- if ( !(newob) || (U.flag & USER_ADD_EDITMODE)) {
- if(newob) load_editMball();
- } else {
- exit_editmode(2);
- }
-
- allqueue(REDRAWALL, 0);
- BIF_undo_push("Add MetaElem");
-}
-
-/* deselect all MetaElements */
-void deselectall_mball()
-{
- MetaElem *ml;
- int sel= 0;
-
- ml= editelems.first;
- while(ml) {
- if(ml->flag & SELECT) break;
- ml= ml->next;
- }
-
- if(ml) sel= 1;
-
- ml= editelems.first;
- while(ml) {
- if(sel) ml->flag &= ~SELECT;
- else ml->flag |= SELECT;
- ml= ml->next;
- }
-
- allqueue(REDRAWVIEW3D, 0);
- countall();
- BIF_undo_push("Deselect MetaElem");
-}
-
-/* inverts metaball selection */
-void selectinverse_mball()
-{
- MetaElem *ml;
-
- ml= editelems.first;
- while(ml) {
- if(ml->flag & SELECT) ml->flag &= ~SELECT;
- else ml->flag |= SELECT;
- ml= ml->next;
- }
-
- allqueue(REDRAWVIEW3D, 0);
- countall();
- BIF_undo_push("Invert MetaElem");
-}
-
-/* select random metaball selection */
-void selectrandom_mball()
-{
- MetaElem *ml;
- static short randfac= 50;
-
- if(!button(&randfac,0, 100,"Percentage:")) return;
-
- ml= editelems.first;
- BLI_srand( BLI_rand() ); /* random seed */
- while(ml) {
- if((BLI_frand() * 100) < randfac) ml->flag |= SELECT;
- ml= ml->next;
- }
-
- allqueue(REDRAWVIEW3D, 0);
- countall();
- BIF_undo_push("Random MetaElem");
-}
-
-/* select MetaElement with mouse click (user can select radius circle or
- * stiffness circle) */
-void mouse_mball()
-{
- static MetaElem *startelem=0;
- MetaElem *ml, *act=0;
- int a, hits;
- unsigned int buffer[MAXPICKBUF];
-
- hits= view3d_opengl_select(buffer, MAXPICKBUF, 0, 0, 0, 0);
-
- /* does startelem exist? */
- ml= editelems.first;
- while(ml) {
- if(ml==startelem) break;
- ml= ml->next;
- }
- if(ml==NULL) startelem= editelems.first;
-
- if(hits>0) {
- ml= startelem;
- while(ml) {
-
- for(a=0; a<hits; a++) {
- /* index converted for gl stuff */
- if(ml->selcol1==buffer[ 4 * a + 3 ]){
- ml->flag |= MB_SCALE_RAD;
- act= ml;
- }
- if(ml->selcol2==buffer[ 4 * a + 3 ]){
- ml->flag &= ~MB_SCALE_RAD;
- act= ml;
- }
-
- }
-
- if(act) break;
-
- ml= ml->next;
- if(ml==NULL) ml= editelems.first;
- if(ml==startelem) break;
- }
- if(act) {
- if((G.qual & LR_SHIFTKEY)==0) {
- deselectall_mball();
- if(act->flag & SELECT) deselectall_mball();
- act->flag |= SELECT;
- }
- else {
- if(act->flag & SELECT) {
- act->flag &= ~SELECT;
- }
- else act->flag |= SELECT;
- }
- lastelem= act;
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- }
- }
-
- allqueue(REDRAWBUTSOBJECT, 0);
- countall();
- rightmouse_transform();
-}
-
-/* duplicate selected MetaElements */
-void adduplicate_mball()
-{
- MetaElem *ml, *newml;
-
- ml= editelems.last;
- while(ml) {
- if(ml->flag & SELECT) {
- newml= MEM_dupallocN(ml);
- BLI_addtail(&editelems, newml);
- lastelem= newml;
- ml->flag &= ~SELECT;
- }
- ml= ml->prev;
- }
-
- BIF_TransformSetUndo("Add Duplicate");
- countall();
- initTransform(TFM_TRANSLATION, CTX_NO_PET);
- Transform();
- allqueue(REDRAWBUTSEDIT, 0);
-}
-
-/* Delete all selected MetaElems (not MetaBall) */
-void delete_mball()
-{
- MetaElem *ml, *next;
-
- if(okee("Erase selected")==0) return;
-
- ml= editelems.first;
- while(ml) {
- next= ml->next;
- if(ml->flag & SELECT) {
- if(lastelem==ml) lastelem= 0;
- BLI_remlink(&editelems, ml);
- MEM_freeN(ml);
- }
- ml= next;
- }
-
- DAG_scene_sort(G.scene);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- countall();
- BIF_undo_push("Delete MetaElem");
-}
-
-/* free all MetaElems from ListBase */
-void freeMetaElemlist(ListBase *lb)
-{
- MetaElem *ml, *next;
-
- if(lb==NULL) return;
-
- ml= lb->first;
- while(ml){
- next= ml->next;
- BLI_remlink(lb, ml);
- MEM_freeN(ml);
- ml= next;
- }
-
- lb->first= lb->last= NULL;
-
-}
-
-/* ************* undo for MetaBalls ************* */
-
-static void undoMball_to_editMball(void *lbv)
-{
- ListBase *lb= lbv;
- MetaElem *ml, *newml;
- unsigned int nr, lastmlnr= 0;
-
- /* we try to restore lastelem, which used in for example in button window */
- for(ml= editelems.first; ml; ml= ml->next, lastmlnr++)
- if(lastelem==ml) break;
-
- freeMetaElemlist(&editelems);
-
- /* copy 'undo' MetaElems to 'edit' MetaElems */
- ml= lb->first;
- while(ml){
- newml= MEM_dupallocN(ml);
- BLI_addtail(&editelems, newml);
- ml= ml->next;
- }
-
- for(nr=0, lastelem= editelems.first; lastelem; lastelem= lastelem->next, nr++)
- if(nr==lastmlnr) break;
-
- countall();
-}
-
-static void *editMball_to_undoMball(void)
-{
- ListBase *lb;
- MetaElem *ml, *newml;
-
- /* allocate memory for undo ListBase */
- lb= MEM_callocN(sizeof(ListBase), "listbase undo");
- lb->first= lb->last= NULL;
-
- /* copy contents of current ListBase to the undo ListBase */
- ml= editelems.first;
- while(ml){
- newml= MEM_dupallocN(ml);
- BLI_addtail(lb, newml);
- ml= ml->next;
- }
-
- return lb;
-}
-
-/* free undo ListBase of MetaElems */
-static void free_undoMball(void *lbv)
-{
- ListBase *lb= lbv;
-
- freeMetaElemlist(lb);
- MEM_freeN(lb);
-}
-
-/* this is undo system for MetaBalls */
-void undo_push_mball(char *name)
-{
- undo_editmode_push(name, free_undoMball, undoMball_to_editMball, editMball_to_undoMball);
-}
-
-/* Hide selected/unselected MetaElems */
-void hide_mball(char hide)
-{
- MetaElem *ml;
-
- ml= editelems.first;
-
- while(ml){
- if(hide){
- if(!(ml->flag & SELECT))
- ml->flag |= MB_HIDE;
- }
- else{
- if(ml->flag & SELECT)
- ml->flag |= MB_HIDE;
- }
- ml= ml->next;
- }
-
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- countall();
- BIF_undo_push("Hide MetaElems");
-}
-
-/* Unhide all edited MetaElems */
-void reveal_mball(void)
-{
- MetaElem *ml;
-
- ml= editelems.first;
-
- while(ml){
- ml->flag &= ~MB_HIDE;
- ml= ml->next;
- }
-
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- countall();
- BIF_undo_push("Unhide MetaElems");
-}
-
diff --git a/source/blender/src/editmesh.c b/source/blender/src/editmesh.c
deleted file mode 100644
index 15f4e652490..00000000000
--- a/source/blender/src/editmesh.c
+++ /dev/null
@@ -1,2205 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "PIL_time.h"
-
-#include "DNA_customdata_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_object_types.h"
-#include "DNA_object_force.h"
-#include "DNA_screen_types.h"
-#include "DNA_key_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_material_types.h"
-#include "DNA_modifier_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_userdef_types.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_editVert.h"
-#include "BLI_dynstr.h"
-#include "BLI_rand.h"
-
-#include "BKE_DerivedMesh.h"
-#include "BKE_depsgraph.h"
-#include "BKE_customdata.h"
-#include "BKE_global.h"
-#include "BKE_key.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
-#include "BKE_material.h"
-#include "BKE_mesh.h"
-#include "BKE_object.h"
-#include "BKE_texture.h"
-#include "BKE_utildefines.h"
-
-#ifdef WITH_VERSE
-#include "BKE_verse.h"
-#endif
-
-#include "BIF_editkey.h"
-#include "BIF_editmesh.h"
-#include "BIF_editmode_undo.h"
-#include "BIF_interface.h"
-#include "BIF_meshtools.h"
-#include "BIF_mywindow.h"
-#include "BIF_retopo.h"
-#include "BIF_space.h"
-#include "BIF_screen.h"
-#include "BIF_toolbox.h"
-
-#ifdef WITH_VERSE
-#include "BIF_verse.h"
-#endif
-
-#include "BSE_view.h"
-#include "BSE_edit.h"
-#include "BSE_trans_types.h"
-
-#include "BDR_drawobject.h"
-#include "BDR_editobject.h"
-#include "BDR_editface.h"
-#include "BDR_vpaint.h"
-
-#include "LBM_fluidsim.h"
-
-#include "multires.h"
-#include "mydevice.h"
-#include "blendef.h"
-
-/* own include */
-#include "editmesh.h"
-
-/*
-
-editmesh.c:
-- add/alloc/free data
-- hashtables
-- enter/exit editmode
-
-*/
-
-
-/* ***************** HASH ********************* */
-
-
-#define EDHASHSIZE (512*512)
-#define EDHASH(a, b) (a % EDHASHSIZE)
-
-
-/* ************ ADD / REMOVE / FIND ****************** */
-
-/* used to bypass normal calloc with fast one */
-static void *(*callocvert)(size_t, size_t) = calloc;
-static void *(*callocedge)(size_t, size_t) = calloc;
-static void *(*callocface)(size_t, size_t) = calloc;
-
-EditVert *addvertlist(float *vec, EditVert *example)
-{
- EditMesh *em = G.editMesh;
- EditVert *eve;
- static int hashnr= 0;
-
- eve= callocvert(sizeof(EditVert), 1);
- BLI_addtail(&em->verts, eve);
-
- if(vec) VECCOPY(eve->co, vec);
-
- eve->hash= hashnr++;
- if( hashnr>=EDHASHSIZE) hashnr= 0;
-
- /* new verts get keyindex of -1 since they did not
- * have a pre-editmode vertex order
- */
- eve->keyindex = -1;
-#ifdef WITH_VERSE
- createVerseVert(eve);
-#endif
-
- if(example)
- CustomData_em_copy_data(&em->vdata, &em->vdata, example->data, &eve->data);
- else
- CustomData_em_set_default(&em->vdata, &eve->data);
-
- return eve;
-}
-
-void free_editvert (EditVert *eve)
-{
-#ifdef WITH_VERSE
- if(eve->vvert) {
- /* it prevents from removing all verse vertexes
- * during entering edit mode ... messy solution */
- if(G.editMesh->vnode)
- b_verse_send_vertex_delete(eve);
- else
- ((VerseVert*)eve->vvert)->vertex = NULL;
- }
-#endif
-
- EM_remove_selection(eve, EDITVERT);
- CustomData_em_free_block(&G.editMesh->vdata, &eve->data);
- if(eve->fast==0)
- free(eve);
-}
-
-
-EditEdge *findedgelist(EditVert *v1, EditVert *v2)
-{
- EditVert *v3;
- struct HashEdge *he;
-
- /* swap ? */
- if( v1 > v2) {
- v3= v2;
- v2= v1;
- v1= v3;
- }
-
- if(G.editMesh->hashedgetab==NULL)
- G.editMesh->hashedgetab= MEM_callocN(EDHASHSIZE*sizeof(struct HashEdge), "hashedgetab");
-
- he= G.editMesh->hashedgetab + EDHASH(v1->hash, v2->hash);
-
- while(he) {
-
- if(he->eed && he->eed->v1==v1 && he->eed->v2==v2) return he->eed;
-
- he= he->next;
- }
- return 0;
-}
-
-static void insert_hashedge(EditEdge *eed)
-{
- /* assuming that eed is not in the list yet, and that a find has been done before */
-
- struct HashEdge *first, *he;
-
- first= G.editMesh->hashedgetab + EDHASH(eed->v1->hash, eed->v2->hash);
-
- if( first->eed==0 ) {
- first->eed= eed;
- }
- else {
- he= &eed->hash;
- he->eed= eed;
- he->next= first->next;
- first->next= he;
- }
-}
-
-static void remove_hashedge(EditEdge *eed)
-{
- /* assuming eed is in the list */
-
- struct HashEdge *first, *he, *prev=NULL;
-
- he=first= G.editMesh->hashedgetab + EDHASH(eed->v1->hash, eed->v2->hash);
-
- while(he) {
- if(he->eed == eed) {
- /* remove from list */
- if(he==first) {
- if(first->next) {
- he= first->next;
- first->eed= he->eed;
- first->next= he->next;
- }
- else he->eed= 0;
- }
- else {
- prev->next= he->next;
- }
- return;
- }
- prev= he;
- he= he->next;
- }
-}
-
-EditEdge *addedgelist(EditVert *v1, EditVert *v2, EditEdge *example)
-{
- EditMesh *em = G.editMesh;
- EditVert *v3;
- EditEdge *eed;
- int swap= 0;
-
- if(v1==v2) return NULL;
- if(v1==NULL || v2==NULL) return NULL;
-
- /* swap ? */
- if(v1>v2) {
- v3= v2;
- v2= v1;
- v1= v3;
- swap= 1;
- }
-
- /* find in hashlist */
- eed= findedgelist(v1, v2);
-
- if(eed==NULL) {
-
- eed= (EditEdge *)callocedge(sizeof(EditEdge), 1);
- eed->v1= v1;
- eed->v2= v2;
- BLI_addtail(&em->edges, eed);
- eed->dir= swap;
- insert_hashedge(eed);
-
- /* copy edge data:
- rule is to do this with addedgelist call, before addfacelist */
- if(example) {
- eed->crease= example->crease;
- eed->sharp = example->sharp;
- eed->seam = example->seam;
- eed->h |= (example->h & EM_FGON);
- }
- }
-
- return eed;
-}
-
-void remedge(EditEdge *eed)
-{
- EditMesh *em = G.editMesh;
-
- BLI_remlink(&em->edges, eed);
- remove_hashedge(eed);
-}
-
-void free_editedge(EditEdge *eed)
-{
- EM_remove_selection(eed, EDITEDGE);
- if(eed->fast==0){
- free(eed);
- }
-}
-
-void free_editface(EditFace *efa)
-{
-#ifdef WITH_VERSE
- if(efa->vface) {
- /* it prevents from removing all verse faces
- * during entering edit mode ... messy solution */
- if(G.editMesh->vnode)
- b_verse_send_face_delete(efa);
- else
- ((VerseFace*)efa->vface)->face = NULL;
- }
-#endif
- EM_remove_selection(efa, EDITFACE);
-
- if (G.editMesh->act_face==efa)
- EM_set_actFace(NULL);
-
- CustomData_em_free_block(&G.editMesh->fdata, &efa->data);
- if(efa->fast==0)
- free(efa);
-}
-
-void free_vertlist(ListBase *edve)
-{
- EditVert *eve, *next;
-
- if (!edve) return;
-
- eve= edve->first;
- while(eve) {
- next= eve->next;
- free_editvert(eve);
- eve= next;
- }
- edve->first= edve->last= NULL;
-}
-
-void free_edgelist(ListBase *lb)
-{
- EditEdge *eed, *next;
-
- eed= lb->first;
- while(eed) {
- next= eed->next;
- free_editedge(eed);
- eed= next;
- }
- lb->first= lb->last= NULL;
-}
-
-void free_facelist(ListBase *lb)
-{
- EditFace *efa, *next;
-
- efa= lb->first;
- while(efa) {
- next= efa->next;
- free_editface(efa);
- efa= next;
- }
- lb->first= lb->last= NULL;
-}
-
-EditFace *addfacelist(EditVert *v1, EditVert *v2, EditVert *v3, EditVert *v4, EditFace *example, EditFace *exampleEdges)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
- EditEdge *e1, *e2=0, *e3=0, *e4=0;
-
- /* added sanity check... seems to happen for some tools, or for enter editmode for corrupted meshes */
- if(v1==v4 || v2==v4 || v3==v4) v4= NULL;
-
- /* add face to list and do the edges */
- if(exampleEdges) {
- e1= addedgelist(v1, v2, exampleEdges->e1);
- e2= addedgelist(v2, v3, exampleEdges->e2);
- if(v4) e3= addedgelist(v3, v4, exampleEdges->e3);
- else e3= addedgelist(v3, v1, exampleEdges->e3);
- if(v4) e4= addedgelist(v4, v1, exampleEdges->e4);
- }
- else {
- e1= addedgelist(v1, v2, NULL);
- e2= addedgelist(v2, v3, NULL);
- if(v4) e3= addedgelist(v3, v4, NULL);
- else e3= addedgelist(v3, v1, NULL);
- if(v4) e4= addedgelist(v4, v1, NULL);
- }
-
- if(v1==v2 || v2==v3 || v1==v3) return NULL;
- if(e2==0) return NULL;
-
- efa= (EditFace *)callocface(sizeof(EditFace), 1);
- efa->v1= v1;
- efa->v2= v2;
- efa->v3= v3;
- efa->v4= v4;
-
- efa->e1= e1;
- efa->e2= e2;
- efa->e3= e3;
- efa->e4= e4;
-
- if(example) {
- efa->mat_nr= example->mat_nr;
- efa->flag= example->flag;
- CustomData_em_copy_data(&em->fdata, &em->fdata, example->data, &efa->data);
- }
- else {
- if (G.obedit && G.obedit->actcol)
- efa->mat_nr= G.obedit->actcol-1;
-
- CustomData_em_set_default(&em->fdata, &efa->data);
- }
-
- BLI_addtail(&em->faces, efa);
-
- if(efa->v4) {
- CalcNormFloat4(efa->v1->co, efa->v2->co, efa->v3->co, efa->v4->co, efa->n);
- CalcCent4f(efa->cent, efa->v1->co, efa->v2->co, efa->v3->co, efa->v4->co);
- }
- else {
- CalcNormFloat(efa->v1->co, efa->v2->co, efa->v3->co, efa->n);
- CalcCent3f(efa->cent, efa->v1->co, efa->v2->co, efa->v3->co);
- }
-
-#ifdef WITH_VERSE
- createVerseFace(efa);
-#endif
-
- return efa;
-}
-
-/* ************************ end add/new/find ************ */
-
-/* ************************ Edit{Vert,Edge,Face} utilss ***************************** */
-
-/* some nice utility functions */
-
-EditVert *editedge_getOtherVert(EditEdge *eed, EditVert *eve)
-{
- if (eve==eed->v1) {
- return eed->v2;
- } else if (eve==eed->v2) {
- return eed->v1;
- } else {
- return NULL;
- }
-}
-
-EditVert *editedge_getSharedVert(EditEdge *eed, EditEdge *eed2)
-{
- if (eed->v1==eed2->v1 || eed->v1==eed2->v2) {
- return eed->v1;
- } else if (eed->v2==eed2->v1 || eed->v2==eed2->v2) {
- return eed->v2;
- } else {
- return NULL;
- }
-}
-
-int editedge_containsVert(EditEdge *eed, EditVert *eve)
-{
- return (eed->v1==eve || eed->v2==eve);
-}
-
-int editface_containsVert(EditFace *efa, EditVert *eve)
-{
- return (efa->v1==eve || efa->v2==eve || efa->v3==eve || (efa->v4 && efa->v4==eve));
-}
-
-int editface_containsEdge(EditFace *efa, EditEdge *eed)
-{
- return (efa->e1==eed || efa->e2==eed || efa->e3==eed || (efa->e4 && efa->e4==eed));
-}
-
-
-/* ************************ stuct EditMesh manipulation ***************************** */
-
-/* fake callocs for fastmalloc below */
-static void *calloc_fastvert(size_t size, size_t nr)
-{
- EditVert *eve= G.editMesh->curvert++;
- eve->fast= 1;
- return eve;
-}
-static void *calloc_fastedge(size_t size, size_t nr)
-{
- EditEdge *eed= G.editMesh->curedge++;
- eed->fast= 1;
- return eed;
-}
-static void *calloc_fastface(size_t size, size_t nr)
-{
- EditFace *efa= G.editMesh->curface++;
- efa->fast= 1;
- return efa;
-}
-
-/* allocate 1 chunk for all vertices, edges, faces. These get tagged to
- prevent it from being freed
-*/
-static void init_editmesh_fastmalloc(EditMesh *em, int totvert, int totedge, int totface)
-{
- if(totvert) em->allverts= MEM_callocN(totvert*sizeof(EditVert), "allverts");
- else em->allverts= NULL;
- em->curvert= em->allverts;
-
- if(totedge==0) totedge= 4*totface; // max possible
-
- if(totedge) em->alledges= MEM_callocN(totedge*sizeof(EditEdge), "alledges");
- else em->alledges= NULL;
- em->curedge= em->alledges;
-
- if(totface) em->allfaces= MEM_callocN(totface*sizeof(EditFace), "allfaces");
- else em->allfaces= NULL;
- em->curface= em->allfaces;
-
- callocvert= calloc_fastvert;
- callocedge= calloc_fastedge;
- callocface= calloc_fastface;
-}
-
-static void end_editmesh_fastmalloc(void)
-{
- callocvert= calloc;
- callocedge= calloc;
- callocface= calloc;
-}
-
-void free_editMesh(EditMesh *em)
-{
-#ifdef WITH_VERSE
- struct VNode *vnode=NULL;
-#endif
- if(em==NULL) return;
-
-#ifdef WITH_VERSE
- if(em->vnode) {
- vnode = (VNode*)em->vnode;
- em->vnode = NULL;
- }
-#endif
-
- if(em->verts.first) free_vertlist(&em->verts);
- if(em->edges.first) free_edgelist(&em->edges);
- if(em->faces.first) free_facelist(&em->faces);
- if(em->selected.first) BLI_freelistN(&(em->selected));
-
- CustomData_free(&em->vdata, 0);
- CustomData_free(&em->fdata, 0);
-
- if(em->derivedFinal) {
- if (em->derivedFinal!=em->derivedCage) {
- em->derivedFinal->needsFree= 1;
- em->derivedFinal->release(em->derivedFinal);
- }
- em->derivedFinal= NULL;
- }
- if(em->derivedCage) {
- em->derivedCage->needsFree= 1;
- em->derivedCage->release(em->derivedCage);
- em->derivedCage= NULL;
- }
-
-#ifdef WITH_VERSE
- if(vnode) {
- em->vnode = (void*)vnode;
- }
-#endif
-
- /* DEBUG: hashtabs are slowest part of enter/exit editmode. here a testprint */
-#if 0
- if(em->hashedgetab) {
- HashEdge *he, *hen;
- int a, used=0, max=0, nr;
- he= em->hashedgetab;
- for(a=0; a<EDHASHSIZE; a++, he++) {
- if(he->eed) used++;
- hen= he->next;
- nr= 0;
- while(hen) {
- nr++;
- hen= hen->next;
- }
- if(max<nr) max= nr;
- }
- printf("hastab used %d max %d\n", used, max);
- }
-#endif
- if(em->hashedgetab) MEM_freeN(em->hashedgetab);
- em->hashedgetab= NULL;
-
- if(em->allverts) MEM_freeN(em->allverts);
- if(em->alledges) MEM_freeN(em->alledges);
- if(em->allfaces) MEM_freeN(em->allfaces);
-
- em->allverts= em->curvert= NULL;
- em->alledges= em->curedge= NULL;
- em->allfaces= em->curface= NULL;
-
- mesh_octree_table(NULL, NULL, 'e');
-
- G.totvert= G.totface= 0;
-
- if(em->retopo_paint_data) retopo_free_paint_data(em->retopo_paint_data);
- em->retopo_paint_data= NULL;
-}
-
-/* on G.editMesh */
-static void editMesh_set_hash(void)
-{
- EditEdge *eed;
-
- G.editMesh->hashedgetab= NULL;
-
- for(eed=G.editMesh->edges.first; eed; eed= eed->next) {
- if( findedgelist(eed->v1, eed->v2)==NULL )
- insert_hashedge(eed);
- }
-
-}
-
-
-/* ************************ IN & OUT EDITMODE ***************************** */
-
-
-static void edge_normal_compare(EditEdge *eed, EditFace *efa1)
-{
- EditFace *efa2;
- float cent1[3], cent2[3];
- float inp;
-
- efa2 = eed->tmp.f;
- if(efa1==efa2) return;
-
- inp= efa1->n[0]*efa2->n[0] + efa1->n[1]*efa2->n[1] + efa1->n[2]*efa2->n[2];
- if(inp<0.999 && inp >-0.999) eed->f2= 1;
-
- if(efa1->v4) CalcCent4f(cent1, efa1->v1->co, efa1->v2->co, efa1->v3->co, efa1->v4->co);
- else CalcCent3f(cent1, efa1->v1->co, efa1->v2->co, efa1->v3->co);
- if(efa2->v4) CalcCent4f(cent2, efa2->v1->co, efa2->v2->co, efa2->v3->co, efa2->v4->co);
- else CalcCent3f(cent2, efa2->v1->co, efa2->v2->co, efa2->v3->co);
-
- VecSubf(cent1, cent2, cent1);
- Normalize(cent1);
- inp= cent1[0]*efa1->n[0] + cent1[1]*efa1->n[1] + cent1[2]*efa1->n[2];
-
- if(inp < -0.001 ) eed->f1= 1;
-}
-
-#if 0
-typedef struct {
- EditEdge *eed;
- float noLen,no[3];
- int adjCount;
-} EdgeDrawFlagInfo;
-
-static int edgeDrawFlagInfo_cmp(const void *av, const void *bv)
-{
- const EdgeDrawFlagInfo *a = av;
- const EdgeDrawFlagInfo *b = bv;
-
- if (a->noLen<b->noLen) return -1;
- else if (a->noLen>b->noLen) return 1;
- else return 0;
-}
-#endif
-
-static void edge_drawflags(void)
-{
- EditMesh *em = G.editMesh;
- EditVert *eve;
- EditEdge *eed, *e1, *e2, *e3, *e4;
- EditFace *efa;
-
- /* - count number of times edges are used in faces: 0 en 1 time means draw edge
- * - edges more than 1 time used: in *tmp.f is pointer to first face
- * - check all faces, when normal differs to much: draw (flag becomes 1)
- */
-
- /* later on: added flags for 'cylinder' and 'sphere' intersection tests in old
- game engine (2.04)
- */
-
- recalc_editnormals();
-
- /* init */
- eve= em->verts.first;
- while(eve) {
- eve->f1= 1; /* during test it's set at zero */
- eve= eve->next;
- }
- eed= em->edges.first;
- while(eed) {
- eed->f2= eed->f1= 0;
- eed->tmp.f = 0;
- eed= eed->next;
- }
-
- efa= em->faces.first;
- while(efa) {
- e1= efa->e1;
- e2= efa->e2;
- e3= efa->e3;
- e4= efa->e4;
- if(e1->f2<4) e1->f2+= 1;
- if(e2->f2<4) e2->f2+= 1;
- if(e3->f2<4) e3->f2+= 1;
- if(e4 && e4->f2<4) e4->f2+= 1;
-
- if(e1->tmp.f == 0) e1->tmp.f = (void *) efa;
- if(e2->tmp.f == 0) e2->tmp.f = (void *) efa;
- if(e3->tmp.f ==0) e3->tmp.f = (void *) efa;
- if(e4 && (e4->tmp.f == 0)) e4->tmp.f = (void *) efa;
-
- efa= efa->next;
- }
-
- if(G.f & G_ALLEDGES) {
- efa= em->faces.first;
- while(efa) {
- if(efa->e1->f2>=2) efa->e1->f2= 1;
- if(efa->e2->f2>=2) efa->e2->f2= 1;
- if(efa->e3->f2>=2) efa->e3->f2= 1;
- if(efa->e4 && efa->e4->f2>=2) efa->e4->f2= 1;
-
- efa= efa->next;
- }
- }
- else {
-
- /* handle single-edges for 'test cylinder flag' (old engine) */
-
- eed= em->edges.first;
- while(eed) {
- if(eed->f2==1) eed->f1= 1;
- eed= eed->next;
- }
-
- /* all faces, all edges with flag==2: compare normal */
- efa= em->faces.first;
- while(efa) {
- if(efa->e1->f2==2) edge_normal_compare(efa->e1, efa);
- else efa->e1->f2= 1;
- if(efa->e2->f2==2) edge_normal_compare(efa->e2, efa);
- else efa->e2->f2= 1;
- if(efa->e3->f2==2) edge_normal_compare(efa->e3, efa);
- else efa->e3->f2= 1;
- if(efa->e4) {
- if(efa->e4->f2==2) edge_normal_compare(efa->e4, efa);
- else efa->e4->f2= 1;
- }
- efa= efa->next;
- }
-
- /* sphere collision flag */
-
- eed= em->edges.first;
- while(eed) {
- if(eed->f1!=1) {
- eed->v1->f1= eed->v2->f1= 0;
- }
- eed= eed->next;
- }
-
- }
-}
-
-/* turns Mesh into editmesh */
-void make_editMesh()
-{
- Mesh *me= G.obedit->data;
- EditMesh *em= G.editMesh;
- MFace *mface;
- MVert *mvert;
- MSelect *mselect;
- KeyBlock *actkey;
- EditVert *eve, **evlist, *eve1, *eve2, *eve3, *eve4;
- EditFace *efa;
- EditEdge *eed;
- EditSelection *ese;
- int tot, a, eekadoodle= 0;
-
-#ifdef WITH_VERSE
- if(me->vnode){
- create_edit_mesh_from_geom_node(me->vnode);
- return;
- }
-#endif
-
- /* because of reload */
- free_editMesh(em);
-
- em->act_face = NULL;
- G.totvert= tot= me->totvert;
- G.totedge= me->totedge;
- G.totface= me->totface;
-
- if(tot==0) {
- countall();
- return;
- }
-
- /* initialize fastmalloc for editmesh */
- init_editmesh_fastmalloc(em, me->totvert, me->totedge, me->totface);
-
- actkey = ob_get_keyblock(G.obedit);
- if(actkey) {
- strcpy(G.editModeTitleExtra, "(Key) ");
- key_to_mesh(actkey, me);
- tot= actkey->totelem;
- }
-
- /* make editverts */
- CustomData_copy(&me->vdata, &em->vdata, CD_MASK_EDITMESH, CD_CALLOC, 0);
- mvert= me->mvert;
-
- evlist= (EditVert **)MEM_mallocN(tot*sizeof(void *),"evlist");
- for(a=0; a<tot; a++, mvert++) {
- eve= addvertlist(mvert->co, NULL);
- evlist[a]= eve;
-
- // face select sets selection in next loop
- if( (FACESEL_PAINT_TEST)==0 )
- eve->f |= (mvert->flag & 1);
-
- if (mvert->flag & ME_HIDE) eve->h= 1;
- eve->no[0]= mvert->no[0]/32767.0;
- eve->no[1]= mvert->no[1]/32767.0;
- eve->no[2]= mvert->no[2]/32767.0;
-
- /* lets overwrite the keyindex of the editvert
- * with the order it used to be in before
- * editmode
- */
- eve->keyindex = a;
-
- CustomData_to_em_block(&me->vdata, &em->vdata, a, &eve->data);
- }
-
- if(actkey && actkey->totelem!=me->totvert);
- else {
- MEdge *medge= me->medge;
-
- CustomData_copy(&me->edata, &em->edata, CD_MASK_EDITMESH, CD_CALLOC, 0);
- /* make edges */
- for(a=0; a<me->totedge; a++, medge++) {
- eed= addedgelist(evlist[medge->v1], evlist[medge->v2], NULL);
- /* eed can be zero when v1 and v2 are identical, dxf import does this... */
- if(eed) {
- eed->crease= ((float)medge->crease)/255.0;
-
- if(medge->flag & ME_SEAM) eed->seam= 1;
- if(medge->flag & ME_SHARP) eed->sharp = 1;
- if(medge->flag & SELECT) eed->f |= SELECT;
- if(medge->flag & ME_FGON) eed->h= EM_FGON; // 2 different defines!
- if(medge->flag & ME_HIDE) eed->h |= 1;
- if(G.scene->selectmode==SCE_SELECT_EDGE)
- EM_select_edge(eed, eed->f & SELECT); // force edge selection to vertices, seems to be needed ...
- CustomData_to_em_block(&me->edata,&em->edata, a, &eed->data);
- }
- }
-
- CustomData_copy(&me->fdata, &em->fdata, CD_MASK_EDITMESH, CD_CALLOC, 0);
-
- /* make faces */
- mface= me->mface;
-
- for(a=0; a<me->totface; a++, mface++) {
- eve1= evlist[mface->v1];
- eve2= evlist[mface->v2];
- if(!mface->v3) eekadoodle= 1;
- eve3= evlist[mface->v3];
- if(mface->v4) eve4= evlist[mface->v4]; else eve4= NULL;
-
- efa= addfacelist(eve1, eve2, eve3, eve4, NULL, NULL);
-
- if(efa) {
- CustomData_to_em_block(&me->fdata, &em->fdata, a, &efa->data);
-
- efa->mat_nr= mface->mat_nr;
- efa->flag= mface->flag & ~ME_HIDE;
-
- /* select and hide face flag */
- if(mface->flag & ME_FACE_SEL) {
- efa->f |= SELECT;
- }
- if(mface->flag & ME_HIDE) efa->h= 1;
-
- if((FACESEL_PAINT_TEST) && (efa->f & SELECT))
- EM_select_face(efa, 1); /* flush down */
-
- if (a==me->act_face)
- em->act_face = efa;
- }
- }
- }
-
- if(eekadoodle)
- error("This Mesh has old style edgecodes, please put it in the bugtracker!");
-
- MEM_freeN(evlist);
-
- end_editmesh_fastmalloc(); // resets global function pointers
-
- if(me->mselect){
- //restore editselections
- EM_init_index_arrays(1,1,1);
- mselect = me->mselect;
-
- for(a=0; a<me->totselect; a++, mselect++){
- /*check if recorded selection is still valid, if so copy into editmesh*/
- if( (mselect->type == EDITVERT && me->mvert[mselect->index].flag & SELECT) || (mselect->type == EDITEDGE && me->medge[mselect->index].flag & SELECT) || (mselect->type == EDITFACE && me->mface[mselect->index].flag & ME_FACE_SEL) ){
- ese = MEM_callocN(sizeof(EditSelection), "Edit Selection");
- ese->type = mselect->type;
- if(ese->type == EDITVERT) ese->data = EM_get_vert_for_index(mselect->index); else
- if(ese->type == EDITEDGE) ese->data = EM_get_edge_for_index(mselect->index); else
- if(ese->type == EDITFACE) ese->data = EM_get_face_for_index(mselect->index);
- BLI_addtail(&(em->selected),ese);
- }
- }
- EM_free_index_arrays();
- }
- /* this creates coherent selections. also needed for older files */
- EM_selectmode_set();
- /* paranoia check to enforce hide rules */
- EM_hide_reset();
- /* sets helper flags which arent saved */
- EM_fgon_flags();
-
- countall();
-
-}
-
-/* makes Mesh out of editmesh */
-void load_editMesh(void)
-{
- EditMesh *em = G.editMesh;
- Mesh *me= G.obedit->data;
- MVert *mvert, *oldverts;
- MEdge *medge;
- MFace *mface;
- MSelect *mselect;
- EditVert *eve;
- EditFace *efa;
- EditEdge *eed;
- EditSelection *ese;
- float *fp, *newkey, *oldkey, nor[3];
- int i, a, ototvert, totedge=0;
-
-#ifdef WITH_VERSE
- if(em->vnode) {
- struct VNode *vnode = (VNode*)em->vnode;
- ((VGeomData*)vnode->data)->editmesh = NULL;
- em->vnode = NULL;
- }
-#endif
-
- countall();
-
- /* this one also tests of edges are not in faces: */
- /* eed->f2==0: not in face, f2==1: draw it */
- /* eed->f1 : flag for dynaface (cylindertest, old engine) */
- /* eve->f1 : flag for dynaface (sphere test, old engine) */
- /* eve->f2 : being used in vertexnormals */
- edge_drawflags();
-
- eed= em->edges.first;
- while(eed) {
- totedge++;
- eed= eed->next;
- }
-
- /* new Vertex block */
- if(G.totvert==0) mvert= NULL;
- else mvert= MEM_callocN(G.totvert*sizeof(MVert), "loadeditMesh vert");
-
- /* new Edge block */
- if(totedge==0) medge= NULL;
- else medge= MEM_callocN(totedge*sizeof(MEdge), "loadeditMesh edge");
-
- /* new Face block */
- if(G.totface==0) mface= NULL;
- else mface= MEM_callocN(G.totface*sizeof(MFace), "loadeditMesh face");
-
- /* lets save the old verts just in case we are actually working on
- * a key ... we now do processing of the keys at the end */
- oldverts= me->mvert;
- ototvert= me->totvert;
-
- /* don't free this yet */
- CustomData_set_layer(&me->vdata, CD_MVERT, NULL);
-
- /* free custom data */
- CustomData_free(&me->vdata, me->totvert);
- CustomData_free(&me->edata, me->totedge);
- CustomData_free(&me->fdata, me->totface);
-
- /* add new custom data */
- me->totvert= G.totvert;
- me->totedge= totedge;
- me->totface= G.totface;
-
- CustomData_copy(&em->vdata, &me->vdata, CD_MASK_MESH, CD_CALLOC, me->totvert);
- CustomData_copy(&em->edata, &me->edata, CD_MASK_MESH, CD_CALLOC, me->totedge);
- CustomData_copy(&em->fdata, &me->fdata, CD_MASK_MESH, CD_CALLOC, me->totface);
-
- CustomData_add_layer(&me->vdata, CD_MVERT, CD_ASSIGN, mvert, me->totvert);
- CustomData_add_layer(&me->edata, CD_MEDGE, CD_ASSIGN, medge, me->totedge);
- CustomData_add_layer(&me->fdata, CD_MFACE, CD_ASSIGN, mface, me->totface);
- mesh_update_customdata_pointers(me);
-
- /* the vertices, use ->tmp.l as counter */
- eve= em->verts.first;
- a= 0;
-
- while(eve) {
- VECCOPY(mvert->co, eve->co);
- mvert->mat_nr= 255; /* what was this for, halos? */
-
- /* vertex normal */
- VECCOPY(nor, eve->no);
- VecMulf(nor, 32767.0);
- VECCOPY(mvert->no, nor);
-
- /* note: it used to remove me->dvert when it was not in use, cancelled
- that... annoying when you have a fresh vgroup */
- CustomData_from_em_block(&em->vdata, &me->vdata, eve->data, a);
-
- eve->tmp.l = a++; /* counter */
-
- mvert->flag= 0;
- if(eve->f1==1) mvert->flag |= ME_SPHERETEST;
- mvert->flag |= (eve->f & SELECT);
- if (eve->h) mvert->flag |= ME_HIDE;
-
-#ifdef WITH_VERSE
- if(eve->vvert) {
- ((VerseVert*)eve->vvert)->vertex = NULL;
- eve->vvert = NULL;
- }
-#endif
- eve= eve->next;
- mvert++;
- }
-
- /* the edges */
- a= 0;
- eed= em->edges.first;
- while(eed) {
- medge->v1= (unsigned int) eed->v1->tmp.l;
- medge->v2= (unsigned int) eed->v2->tmp.l;
-
- medge->flag= (eed->f & SELECT) | ME_EDGERENDER;
- if(eed->f2<2) medge->flag |= ME_EDGEDRAW;
- if(eed->f2==0) medge->flag |= ME_LOOSEEDGE;
- if(eed->sharp) medge->flag |= ME_SHARP;
- if(eed->seam) medge->flag |= ME_SEAM;
- if(eed->h & EM_FGON) medge->flag |= ME_FGON; // different defines yes
- if(eed->h & 1) medge->flag |= ME_HIDE;
-
- medge->crease= (char)(255.0*eed->crease);
- CustomData_from_em_block(&em->edata, &me->edata, eed->data, a);
-
- eed->tmp.l = a++;
-
- medge++;
- eed= eed->next;
- }
-
- /* the faces */
- a = 0;
- efa= em->faces.first;
- i = 0;
- me->act_face = -1;
- while(efa) {
- mface= &((MFace *) me->mface)[i];
-
- mface->v1= (unsigned int) efa->v1->tmp.l;
- mface->v2= (unsigned int) efa->v2->tmp.l;
- mface->v3= (unsigned int) efa->v3->tmp.l;
- if (efa->v4) mface->v4 = (unsigned int) efa->v4->tmp.l;
-
- mface->mat_nr= efa->mat_nr;
-
- mface->flag= efa->flag;
- /* bit 0 of flag is already taken for smooth... */
-
- if(efa->h) {
- mface->flag |= ME_HIDE;
- mface->flag &= ~ME_FACE_SEL;
- } else {
- if(efa->f & 1) mface->flag |= ME_FACE_SEL;
- else mface->flag &= ~ME_FACE_SEL;
- }
-
- /* mat_nr in vertex */
- if(me->totcol>1) {
- mvert= me->mvert+mface->v1;
- if(mvert->mat_nr == (char)255) mvert->mat_nr= mface->mat_nr;
- mvert= me->mvert+mface->v2;
- if(mvert->mat_nr == (char)255) mvert->mat_nr= mface->mat_nr;
- mvert= me->mvert+mface->v3;
- if(mvert->mat_nr == (char)255) mvert->mat_nr= mface->mat_nr;
- if(mface->v4) {
- mvert= me->mvert+mface->v4;
- if(mvert->mat_nr == (char)255) mvert->mat_nr= mface->mat_nr;
- }
- }
-
- /* watch: efa->e1->f2==0 means loose edge */
-
- if(efa->e1->f2==1) {
- efa->e1->f2= 2;
- }
- if(efa->e2->f2==1) {
- efa->e2->f2= 2;
- }
- if(efa->e3->f2==1) {
- efa->e3->f2= 2;
- }
- if(efa->e4 && efa->e4->f2==1) {
- efa->e4->f2= 2;
- }
-
- CustomData_from_em_block(&em->fdata, &me->fdata, efa->data, i);
-
- /* no index '0' at location 3 or 4 */
- test_index_face(mface, &me->fdata, i, efa->v4?4:3);
-
- if (EM_get_actFace() == efa)
- me->act_face = a;
-
-#ifdef WITH_VERSE
- if(efa->vface) {
- ((VerseFace*)efa->vface)->face = NULL;
- efa->vface = NULL;
- }
-#endif
- efa->tmp.l = a++;
- i++;
- efa= efa->next;
- }
-
- /* patch hook indices and vertex parents */
- {
- Object *ob;
- ModifierData *md;
- EditVert *eve, **vertMap = NULL;
- int i,j;
-
- for (ob=G.main->object.first; ob; ob=ob->id.next) {
- if (ob->parent==G.obedit && ELEM(ob->partype, PARVERT1,PARVERT3)) {
-
- /* duplicate code from below, make it function later...? */
- if (!vertMap) {
- vertMap = MEM_callocN(sizeof(*vertMap)*ototvert, "vertMap");
-
- for (eve=em->verts.first; eve; eve=eve->next) {
- if (eve->keyindex!=-1)
- vertMap[eve->keyindex] = eve;
- }
- }
- if(ob->par1 < ototvert) {
- eve = vertMap[ob->par1];
- if(eve) ob->par1= eve->tmp.l;
- }
- if(ob->par2 < ototvert) {
- eve = vertMap[ob->par2];
- if(eve) ob->par2= eve->tmp.l;
- }
- if(ob->par3 < ototvert) {
- eve = vertMap[ob->par3];
- if(eve) ob->par3= eve->tmp.l;
- }
-
- }
- if (ob->data==me) {
- for (md=ob->modifiers.first; md; md=md->next) {
- if (md->type==eModifierType_Hook) {
- HookModifierData *hmd = (HookModifierData*) md;
-
- if (!vertMap) {
- vertMap = MEM_callocN(sizeof(*vertMap)*ototvert, "vertMap");
-
- for (eve=em->verts.first; eve; eve=eve->next) {
- if (eve->keyindex!=-1)
- vertMap[eve->keyindex] = eve;
- }
- }
-
- for (i=j=0; i<hmd->totindex; i++) {
- if(hmd->indexar[i] < ototvert) {
- eve = vertMap[hmd->indexar[i]];
-
- if (eve) {
- hmd->indexar[j++] = eve->tmp.l;
- }
- }
- else j++;
- }
-
- hmd->totindex = j;
- }
- }
- }
- }
-
- if (vertMap) MEM_freeN(vertMap);
- }
-
- /* are there keys? */
- if(me->key) {
- KeyBlock *currkey, *actkey = ob_get_keyblock(G.obedit);
-
- /* Lets reorder the key data so that things line up roughly
- * with the way things were before editmode */
- currkey = me->key->block.first;
- while(currkey) {
-
- fp= newkey= MEM_callocN(me->key->elemsize*G.totvert, "currkey->data");
- oldkey = currkey->data;
-
- eve= em->verts.first;
-
- i = 0;
- mvert = me->mvert;
- while(eve) {
- if (eve->keyindex >= 0 && eve->keyindex < currkey->totelem) { // valid old vertex
- if(currkey == actkey) {
- if (actkey == me->key->refkey) {
- VECCOPY(fp, mvert->co);
- }
- else {
- VECCOPY(fp, mvert->co);
- if(oldverts) {
- VECCOPY(mvert->co, oldverts[eve->keyindex].co);
- }
- }
- }
- else {
- if(oldkey) {
- VECCOPY(fp, oldkey + 3 * eve->keyindex);
- }
- }
- }
- else {
- VECCOPY(fp, mvert->co);
- }
- fp+= 3;
- ++i;
- ++mvert;
- eve= eve->next;
- }
- currkey->totelem= G.totvert;
- if(currkey->data) MEM_freeN(currkey->data);
- currkey->data = newkey;
-
- currkey= currkey->next;
- }
- }
-
- if(oldverts) MEM_freeN(oldverts);
-
- i = 0;
- for(ese=em->selected.first; ese; ese=ese->next) i++;
- me->totselect = i;
- if(i==0) mselect= NULL;
- else mselect= MEM_callocN(i*sizeof(MSelect), "loadeditMesh selections");
-
- if(me->mselect) MEM_freeN(me->mselect);
- me->mselect= mselect;
-
- for(ese=em->selected.first; ese; ese=ese->next){
- mselect->type = ese->type;
- if(ese->type == EDITVERT) mselect->index = ((EditVert*)ese->data)->tmp.l;
- else if(ese->type == EDITEDGE) mselect->index = ((EditEdge*)ese->data)->tmp.l;
- else if(ese->type == EDITFACE) mselect->index = ((EditFace*)ese->data)->tmp.l;
- mselect++;
- }
-
- /* to be sure: clear ->tmp.l pointers */
- eve= em->verts.first;
- while(eve) {
- eve->tmp.l = 0;
- eve= eve->next;
- }
-
- eed= em->edges.first;
- while(eed) {
- eed->tmp.l = 0;
- eed= eed->next;
- }
-
- efa= em->faces.first;
- while(efa) {
- efa->tmp.l = 0;
- efa= efa->next;
- }
-
- /* remake softbody of all users */
- if(me->id.us>1) {
- Base *base;
- for(base= G.scene->base.first; base; base= base->next) {
- if(base->object->data==me) {
- base->object->softflag |= OB_SB_REDO;
- base->object->recalc |= OB_RECALC_DATA;
- }
- }
- }
-
- mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL);
-}
-
-void remake_editMesh(void)
-{
- make_editMesh();
- allqueue(REDRAWVIEW3D, 0);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- BIF_undo_push("Undo all changes");
-}
-
-/* *************** (partial exit editmode) *************/
-
-
-void separatemenu(void)
-{
- short event;
-
- if(G.editMesh->verts.first==NULL) return;
-
- event = pupmenu("Separate %t|Selected%x1|All Loose Parts%x2|By Material%x3");
-
- if (event==0) return;
- waitcursor(1);
-
- switch (event) {
- case 1:
- separate_mesh();
- break;
- case 2:
- separate_mesh_loose();
- break;
- case 3:
- separate_material();
- break;
- }
- waitcursor(0);
-}
-
-void separate_material(void)
-{
- EditMesh *em = G.editMesh;
- unsigned char curr_mat;
- Mesh *me;
-
- if(multires_test()) return;
-
- me= get_mesh(G.obedit);
- if(me->key) {
- error("Can't separate with vertex keys");
- return;
- }
-
- if(G.obedit && em) {
- if(G.obedit->type == OB_MESH) {
- for (curr_mat = 1; curr_mat < G.obedit->totcol; ++curr_mat) {
- /* clear selection, we're going to use that to select material group */
- EM_clear_flag_all(SELECT);
- /* select the material */
- editmesh_select_by_material(curr_mat);
- /* and now separate */
- separate_mesh();
- }
- }
- }
-
- countall();
- allqueue(REDRAWVIEW3D, 0);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-
-}
-
-void separate_mesh(void)
-{
- EditMesh *em = G.editMesh;
- EditMesh emcopy;
- EditVert *eve, *v1;
- EditEdge *eed, *e1;
- EditFace *efa, *vl1;
- Object *oldob;
- Mesh *me, *men;
- Base *base, *oldbase;
- ListBase edve, eded, edvl;
-#ifdef WITH_VERSE
- struct VNode *vnode = NULL;
-#endif
-
- TEST_EDITMESH
- if(multires_test()) return;
-
- waitcursor(1);
-
- me= get_mesh(G.obedit);
- if(me->key) {
- error("Can't separate with vertex keys");
- return;
- }
-
- /* blender crashes in derivedmesh drawing if I don't do this... but why?
- Anyhoo, this function is horrible anyway (ton)
- the fluidsimFlag also has to be reset btw. (n_t) */
- if(G.obedit->fluidsimSettings) {
- fluidsimSettingsFree(G.obedit->fluidsimSettings);
- G.obedit->fluidsimSettings = NULL;
- G.obedit->fluidsimFlag = 0;
- }
-
- if(em->selected.first) BLI_freelistN(&(em->selected)); /* clear the selection order */
-
- EM_selectmode_set(); // enforce full consistant selection flags
-
- /* we are going to abuse the system as follows:
- * 1. add a duplicate object: this will be the new one, we remember old pointer
- * 2: then do a split if needed.
- * 3. put apart: all NOT selected verts, edges, faces
- * 4. call load_editMesh(): this will be the new object
- * 5. freelist and get back old verts, edges, facs
- */
-
- /* make only obedit selected */
- base= FIRSTBASE;
- while(base) {
- if(base->lay & G.vd->lay) {
- if(base->object==G.obedit) base->flag |= SELECT;
- else base->flag &= ~SELECT;
- }
- base= base->next;
- }
-
-#ifdef WITH_VERSE
- if(G.editMesh->vnode) {
- vnode = G.editMesh->vnode;
- G.editMesh->vnode = NULL;
- }
-#endif
- /* no test for split, split doesn't split when a loose part is selected */
- /* SPLIT: first make duplicate */
- adduplicateflag(SELECT);
-
-#ifdef WITH_VERSE
- if(vnode) {
- G.editMesh->vnode = vnode;
- }
-#endif
- /* SPLIT: old faces have 3x flag 128 set, delete these ones */
- delfaceflag(128);
-
- /* since we do tricky things with verts/edges/faces, this makes sure all is selected coherent */
- EM_selectmode_set();
-
- /* set apart: everything that is not selected */
- edve.first= edve.last= eded.first= eded.last= edvl.first= edvl.last= 0;
- eve= em->verts.first;
- while(eve) {
- v1= eve->next;
- if((eve->f & SELECT)==0) {
- BLI_remlink(&em->verts, eve);
- BLI_addtail(&edve, eve);
-#ifdef WITH_VERSE
- if(eve->vvert) {
- ((VerseVert*)eve->vvert)->vertex = NULL;
- eve->vvert = NULL;
- }
-#endif
- }
-
- eve= v1;
- }
- eed= em->edges.first;
- while(eed) {
- e1= eed->next;
- if((eed->f & SELECT)==0) {
- BLI_remlink(&em->edges, eed);
- BLI_addtail(&eded, eed);
- }
- eed= e1;
- }
- efa= em->faces.first;
- while(efa) {
- vl1= efa->next;
- if((efa->f & SELECT)==0) {
- BLI_remlink(&em->faces, efa);
- BLI_addtail(&edvl, efa);
-#ifdef WITH_VERSE
- if(efa->vface) {
- ((VerseFace*)efa->vface)->face = NULL;
- efa->vface = NULL;
- }
-#endif
- }
- efa= vl1;
- }
-
- oldob= G.obedit;
- oldbase= BASACT;
-
-#ifdef WITH_VERSE
- if(G.obedit->vnode) {
- vnode = G.obedit->vnode;
- G.obedit->vnode = NULL;
- }
-#endif
- adduplicate(1, 0); /* notrans and a linked duplicate */
-
-#ifdef WITH_VERSE
- if(vnode) {
- G.obedit->vnode = vnode;
- }
-#endif
-
- G.obedit= BASACT->object; /* basact was set in adduplicate() */
-
- men= copy_mesh(me);
- set_mesh(G.obedit, men);
- /* because new mesh is a copy: reduce user count */
- men->id.us--;
-
- load_editMesh();
-
- BASACT->flag &= ~SELECT;
-
- /* we cannot free the original buffer... */
- emcopy= *G.editMesh;
- emcopy.allverts= NULL;
- emcopy.alledges= NULL;
- emcopy.allfaces= NULL;
- emcopy.derivedFinal= emcopy.derivedCage= NULL;
- memset(&emcopy.vdata, 0, sizeof(emcopy.vdata));
- memset(&emcopy.fdata, 0, sizeof(emcopy.fdata));
- free_editMesh(&emcopy);
-
- em->verts= edve;
- em->edges= eded;
- em->faces= edvl;
-
- /* hashedges are freed now, make new! */
- editMesh_set_hash();
-
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- G.obedit= oldob;
- BASACT= oldbase;
- BASACT->flag |= SELECT;
-
- waitcursor(0);
-
- countall();
- allqueue(REDRAWVIEW3D, 0);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-
-}
-
-void separate_mesh_loose(void)
-{
- EditMesh *em = G.editMesh;
- EditMesh emcopy;
- EditVert *eve, *v1;
- EditEdge *eed, *e1;
- EditFace *efa, *vl1;
- Object *oldob=NULL;
- Mesh *me, *men;
- Base *base, *oldbase;
- ListBase edve, eded, edvl;
- int vertsep=0;
- short done=0, check=1;
-#ifdef WITH_VERSE
- struct VNode *vnode = NULL;
-#endif
-
- me= get_mesh(G.obedit);
-#ifdef WITH_VERSE
- if(me->vnode) {
- error("Can't separate a mesh shared at verse server");
- return;
- }
-#endif
- if(me->key) {
- error("Can't separate a mesh with vertex keys");
- return;
- }
-
- /* same problem as in separate_mesh above (n_t) */
- if(G.obedit->fluidsimSettings) {
- fluidsimSettingsFree(G.obedit->fluidsimSettings);
- G.obedit->fluidsimSettings = NULL;
- G.obedit->fluidsimFlag = 0;
- }
-
- TEST_EDITMESH
- if(multires_test()) return;
- waitcursor(1);
-
- /* we are going to abuse the system as follows:
- * 1. add a duplicate object: this will be the new one, we remember old pointer
- * 2: then do a split if needed.
- * 3. put apart: all NOT selected verts, edges, faces
- * 4. call load_editMesh(): this will be the new object
- * 5. freelist and get back old verts, edges, facs
- */
-
- while(!done){
- vertsep=check=1;
-
- countall();
-
- /* make only obedit selected */
- base= FIRSTBASE;
- while(base) {
- if(base->lay & G.vd->lay) {
- if(base->object==G.obedit) base->flag |= SELECT;
- else base->flag &= ~SELECT;
- }
- base= base->next;
- }
-
- /*--------- Select connected-----------*/
-
- EM_clear_flag_all(SELECT);
-
- /* Select a random vert to start with */
- eve= em->verts.first;
- eve->f |= SELECT;
-
- while(check==1) {
- check= 0;
- eed= em->edges.first;
- while(eed) {
- if(eed->h==0) {
- if(eed->v1->f & SELECT) {
- if( (eed->v2->f & SELECT)==0 ) {
- eed->v2->f |= SELECT;
- vertsep++;
- check= 1;
- }
- }
- else if(eed->v2->f & SELECT) {
- if( (eed->v1->f & SELECT)==0 ) {
- eed->v1->f |= SELECT;
- vertsep++;
- check= SELECT;
- }
- }
- }
- eed= eed->next;
- }
- }
- /*----------End of select connected--------*/
-
-
- /* If the amount of vertices that is about to be split == the total amount
- of verts in the mesh, it means that there is only 1 unconnected object, so we don't have to separate
- */
- if(G.totvert==vertsep) done=1;
- else{
- /* No splitting: select connected goes fine */
-
- EM_select_flush(); // from verts->edges->faces
-
- /* set apart: everything that is not selected */
- edve.first= edve.last= eded.first= eded.last= edvl.first= edvl.last= 0;
- eve= em->verts.first;
- while(eve) {
- v1= eve->next;
- if((eve->f & SELECT)==0) {
- BLI_remlink(&em->verts, eve);
- BLI_addtail(&edve, eve);
-#ifdef WITH_VERSE
- if(eve->vvert) {
- b_verse_send_vertex_delete(eve);
- }
-#endif
- }
- eve= v1;
- }
- eed= em->edges.first;
- while(eed) {
- e1= eed->next;
- if( (eed->f & SELECT)==0 ) {
- BLI_remlink(&em->edges, eed);
- BLI_addtail(&eded, eed);
- }
- eed= e1;
- }
- efa= em->faces.first;
- while(efa) {
- vl1= efa->next;
- if( (efa->f & SELECT)==0 ) {
- BLI_remlink(&em->faces, efa);
- BLI_addtail(&edvl, efa);
-#ifdef WITH_VERSE
- if(efa->vface) {
- b_verse_send_face_delete(efa);
- }
-#endif
- }
- efa= vl1;
- }
-
- oldob= G.obedit;
- oldbase= BASACT;
-
-#ifdef WITH_VERSE
- if(G.obedit->vnode) {
- vnode = G.obedit->vnode;
- G.obedit->vnode = NULL;
- }
-#endif
- adduplicate(1, 0); /* notrans and a linked duplicate*/
-#ifdef WITH_VERSE
- if(vnode) {
- G.obedit->vnode = vnode;
- }
-#endif
-
- G.obedit= BASACT->object; /* basact was set in adduplicate() */
-
- men= copy_mesh(me);
- set_mesh(G.obedit, men);
- /* because new mesh is a copy: reduce user count */
- men->id.us--;
-
- load_editMesh();
-
- BASACT->flag &= ~SELECT;
-
- /* we cannot free the original buffer... */
- emcopy= *G.editMesh;
- emcopy.allverts= NULL;
- emcopy.alledges= NULL;
- emcopy.allfaces= NULL;
- emcopy.derivedFinal= emcopy.derivedCage= NULL;
- memset(&emcopy.vdata, 0, sizeof(emcopy.vdata));
- memset(&emcopy.fdata, 0, sizeof(emcopy.fdata));
- free_editMesh(&emcopy);
-
- em->verts= edve;
- em->edges= eded;
- em->faces= edvl;
-
- /* hashedges are freed now, make new! */
- editMesh_set_hash();
-
- G.obedit= oldob;
- BASACT= oldbase;
- BASACT->flag |= SELECT;
-
- }
- }
-
- /* unselect the vertices that we (ab)used for the separation*/
- EM_clear_flag_all(SELECT);
-
- waitcursor(0);
- countall();
- allqueue(REDRAWVIEW3D, 0);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-}
-
-/* ******************************************** */
-
-/* *************** UNDO ***************************** */
-/* new mesh undo, based on pushing editmesh data itself */
-/* reuses same code as for global and curve undo... unify that (ton) */
-
-/* only one 'hack', to save memory it doesn't store the first push, but does a remake editmesh */
-
-/* a compressed version of editmesh data */
-
-typedef struct EditVertC
-{
- float no[3];
- float co[3];
- unsigned char f, h;
- int keyindex;
-} EditVertC;
-
-typedef struct EditEdgeC
-{
- int v1, v2;
- unsigned char f, h, seam, sharp, pad;
- short crease, fgoni;
-} EditEdgeC;
-
-typedef struct EditFaceC
-{
- int v1, v2, v3, v4;
- unsigned char mat_nr, flag, f, h, fgonf;
- short pad1;
-} EditFaceC;
-
-typedef struct EditSelectionC{
- short type;
- int index;
-}EditSelectionC;
-
-typedef struct EM_MultiresUndo {
- int users;
- Multires *mr;
-} EM_MultiresUndo;
-
-typedef struct UndoMesh {
- EditVertC *verts;
- EditEdgeC *edges;
- EditFaceC *faces;
- EditSelectionC *selected;
- int totvert, totedge, totface, totsel;
- short selectmode;
- RetopoPaintData *retopo_paint_data;
- char retopo_mode;
- CustomData vdata, edata, fdata;
- EM_MultiresUndo *mru;
-} UndoMesh;
-
-/* for callbacks */
-
-static void free_undoMesh(void *umv)
-{
- UndoMesh *um= umv;
-
- if(um->verts) MEM_freeN(um->verts);
- if(um->edges) MEM_freeN(um->edges);
- if(um->faces) MEM_freeN(um->faces);
- if(um->selected) MEM_freeN(um->selected);
- if(um->retopo_paint_data) retopo_free_paint_data(um->retopo_paint_data);
- CustomData_free(&um->vdata, um->totvert);
- CustomData_free(&um->edata, um->totedge);
- CustomData_free(&um->fdata, um->totface);
- if(um->mru) {
- --um->mru->users;
- if(um->mru->users==0) {
- multires_free(um->mru->mr);
- um->mru->mr= NULL;
- MEM_freeN(um->mru);
- }
- }
- MEM_freeN(um);
-}
-
-static void *editMesh_to_undoMesh(void)
-{
- EditMesh *em= G.editMesh;
- UndoMesh *um;
- EditVert *eve;
- EditEdge *eed;
- EditFace *efa;
- EditSelection *ese;
- EditVertC *evec=NULL;
- EditEdgeC *eedc=NULL;
- EditFaceC *efac=NULL;
- EditSelectionC *esec=NULL;
- int a;
-
- um= MEM_callocN(sizeof(UndoMesh), "undomesh");
-
- um->selectmode = G.scene->selectmode;
-
- for(eve=em->verts.first; eve; eve= eve->next) um->totvert++;
- for(eed=em->edges.first; eed; eed= eed->next) um->totedge++;
- for(efa=em->faces.first; efa; efa= efa->next) um->totface++;
- for(ese=em->selected.first; ese; ese=ese->next) um->totsel++;
- /* malloc blocks */
-
- if(um->totvert) evec= um->verts= MEM_callocN(um->totvert*sizeof(EditVertC), "allvertsC");
- if(um->totedge) eedc= um->edges= MEM_callocN(um->totedge*sizeof(EditEdgeC), "alledgesC");
- if(um->totface) efac= um->faces= MEM_callocN(um->totface*sizeof(EditFaceC), "allfacesC");
- if(um->totsel) esec= um->selected= MEM_callocN(um->totsel*sizeof(EditSelectionC), "allselections");
-
- if(um->totvert) CustomData_copy(&em->vdata, &um->vdata, CD_MASK_EDITMESH, CD_CALLOC, um->totvert);
- if(um->totedge) CustomData_copy(&em->edata, &um->edata, CD_MASK_EDITMESH, CD_CALLOC, um->totedge);
- if(um->totface) CustomData_copy(&em->fdata, &um->fdata, CD_MASK_EDITMESH, CD_CALLOC, um->totface);
-
- /* now copy vertices */
- a = 0;
- for(eve=em->verts.first; eve; eve= eve->next, evec++, a++) {
- VECCOPY(evec->co, eve->co);
- VECCOPY(evec->no, eve->no);
-
- evec->f= eve->f;
- evec->h= eve->h;
- evec->keyindex= eve->keyindex;
- eve->tmp.l = a; /*store index*/
-
- CustomData_from_em_block(&em->vdata, &um->vdata, eve->data, a);
- }
-
- /* copy edges */
- a = 0;
- for(eed=em->edges.first; eed; eed= eed->next, eedc++, a++) {
- eedc->v1= (int)eed->v1->tmp.l;
- eedc->v2= (int)eed->v2->tmp.l;
- eedc->f= eed->f;
- eedc->h= eed->h;
- eedc->seam= eed->seam;
- eedc->sharp= eed->sharp;
- eedc->crease= (short)(eed->crease*255.0);
- eedc->fgoni= eed->fgoni;
- eed->tmp.l = a; /*store index*/
- CustomData_from_em_block(&em->edata, &um->edata, eed->data, a);
-
- }
-
- /* copy faces */
- a = 0;
- for(efa=em->faces.first; efa; efa= efa->next, efac++, a++) {
- efac->v1= (int)efa->v1->tmp.l;
- efac->v2= (int)efa->v2->tmp.l;
- efac->v3= (int)efa->v3->tmp.l;
- if(efa->v4) efac->v4= (int)efa->v4->tmp.l;
- else efac->v4= -1;
-
- efac->mat_nr= efa->mat_nr;
- efac->flag= efa->flag;
- efac->f= efa->f;
- efac->h= efa->h;
- efac->fgonf= efa->fgonf;
-
- efa->tmp.l = a; /*store index*/
-
- CustomData_from_em_block(&em->fdata, &um->fdata, efa->data, a);
- }
-
- a = 0;
- for(ese=em->selected.first; ese; ese=ese->next, esec++){
- esec->type = ese->type;
- if(ese->type == EDITVERT) a = esec->index = ((EditVert*)ese->data)->tmp.l;
- else if(ese->type == EDITEDGE) a = esec->index = ((EditEdge*)ese->data)->tmp.l;
- else if(ese->type == EDITFACE) a = esec->index = ((EditFace*)ese->data)->tmp.l;
- }
-
- um->retopo_paint_data= retopo_paint_data_copy(em->retopo_paint_data);
- um->retopo_mode= G.scene->toolsettings->retopo_mode;
-
- {
- Multires *mr= get_mesh(G.obedit)->mr;
- UndoMesh *prev= undo_editmode_get_prev(G.obedit);
-
- um->mru= NULL;
-
- if(mr) {
- if(prev && prev->mru && prev->mru->mr && prev->mru->mr->current == mr->current) {
- um->mru= prev->mru;
- ++um->mru->users;
- }
- else {
- um->mru= MEM_callocN(sizeof(EM_MultiresUndo), "EM_MultiresUndo");
- um->mru->users= 1;
- um->mru->mr= multires_copy(mr);
- }
- }
- }
-
- return um;
-}
-
-static void undoMesh_to_editMesh(void *umv)
-{
- UndoMesh *um= (UndoMesh*)umv;
- EditMesh *em= G.editMesh;
- EditVert *eve, **evar=NULL;
- EditEdge *eed;
- EditFace *efa;
- EditSelection *ese;
- EditVertC *evec;
- EditEdgeC *eedc;
- EditFaceC *efac;
- EditSelectionC *esec;
- int a=0;
-
-#ifdef WITH_VERSE
- struct VNode *vnode = G.editMesh->vnode;
- if(vnode) {
- /* send delete command to all verse vertexes and verse face ...
- * verse mesh will be recreated from new edit mesh */
- destroy_versemesh(vnode);
- }
-#endif
- G.scene->selectmode = um->selectmode;
-
- free_editMesh(G.editMesh);
-
- /* malloc blocks */
- memset(em, 0, sizeof(EditMesh));
-
- init_editmesh_fastmalloc(em, um->totvert, um->totedge, um->totface);
-
-#ifdef WITH_VERSE
- G.editMesh->vnode = vnode;
-#endif
-
- CustomData_free(&em->vdata, 0);
- CustomData_free(&em->edata, 0);
- CustomData_free(&em->fdata, 0);
-
- CustomData_copy(&um->vdata, &em->vdata, CD_MASK_EDITMESH, CD_CALLOC, 0);
- CustomData_copy(&um->edata, &em->edata, CD_MASK_EDITMESH, CD_CALLOC, 0);
- CustomData_copy(&um->fdata, &em->fdata, CD_MASK_EDITMESH, CD_CALLOC, 0);
-
- /* now copy vertices */
-
- if(um->totvert) evar= MEM_mallocN(um->totvert*sizeof(EditVert *), "vertex ar");
- for(a=0, evec= um->verts; a<um->totvert; a++, evec++) {
- eve= addvertlist(evec->co, NULL);
- evar[a]= eve;
-
- VECCOPY(eve->no, evec->no);
- eve->f= evec->f;
- eve->h= evec->h;
- eve->keyindex= evec->keyindex;
-
- CustomData_to_em_block(&um->vdata, &em->vdata, a, &eve->data);
- }
-
- /* copy edges */
- for(a=0, eedc= um->edges; a<um->totedge; a++, eedc++) {
- eed= addedgelist(evar[eedc->v1], evar[eedc->v2], NULL);
-
- eed->f= eedc->f;
- eed->h= eedc->h;
- eed->seam= eedc->seam;
- eed->sharp= eedc->sharp;
- eed->fgoni= eedc->fgoni;
- eed->crease= ((float)eedc->crease)/255.0;
- CustomData_to_em_block(&um->edata, &em->edata, a, &eed->data);
- }
-
- /* copy faces */
- for(a=0, efac= um->faces; a<um->totface; a++, efac++) {
- if(efac->v4 != -1)
- efa= addfacelist(evar[efac->v1], evar[efac->v2], evar[efac->v3], evar[efac->v4], NULL, NULL);
- else
- efa= addfacelist(evar[efac->v1], evar[efac->v2], evar[efac->v3], NULL, NULL ,NULL);
-
- efa->mat_nr= efac->mat_nr;
- efa->flag= efac->flag;
- efa->f= efac->f;
- efa->h= efac->h;
- efa->fgonf= efac->fgonf;
-
- CustomData_to_em_block(&um->fdata, &em->fdata, a, &efa->data);
- }
-
- end_editmesh_fastmalloc();
- if(evar) MEM_freeN(evar);
-
- G.totvert = um->totvert;
- G.totedge = um->totedge;
- G.totface = um->totface;
- /*restore stored editselections*/
- if(um->totsel){
- EM_init_index_arrays(1,1,1);
- for(a=0, esec= um->selected; a<um->totsel; a++, esec++){
- ese = MEM_callocN(sizeof(EditSelection), "Edit Selection");
- ese->type = esec->type;
- if(ese->type == EDITVERT) ese->data = EM_get_vert_for_index(esec->index); else
- if(ese->type == EDITEDGE) ese->data = EM_get_edge_for_index(esec->index); else
- if(ese->type == EDITFACE) ese->data = EM_get_face_for_index(esec->index);
- BLI_addtail(&(em->selected),ese);
- }
- EM_free_index_arrays();
- }
-
- retopo_free_paint();
- em->retopo_paint_data= retopo_paint_data_copy(um->retopo_paint_data);
- G.scene->toolsettings->retopo_mode= um->retopo_mode;
- if(G.scene->toolsettings->retopo_mode) {
- if(G.vd->depths) G.vd->depths->damaged= 1;
- retopo_queue_updates(G.vd);
- retopo_paint_view_update(G.vd);
- }
-
- {
- Mesh *me= get_mesh(G.obedit);
- multires_free(me->mr);
- me->mr= NULL;
- if(um->mru && um->mru->mr) me->mr= multires_copy(um->mru->mr);
- }
-}
-
-
-/* and this is all the undo system needs to know */
-void undo_push_mesh(char *name)
-{
- undo_editmode_push(name, free_undoMesh, undoMesh_to_editMesh, editMesh_to_undoMesh);
-}
-
-
-
-/* *************** END UNDO *************/
-
-static EditVert **g_em_vert_array = NULL;
-static EditEdge **g_em_edge_array = NULL;
-static EditFace **g_em_face_array = NULL;
-
-void EM_init_index_arrays(int forVert, int forEdge, int forFace)
-{
- EditVert *eve;
- EditEdge *eed;
- EditFace *efa;
- int i;
-
- if (forVert) {
- g_em_vert_array = MEM_mallocN(sizeof(*g_em_vert_array)*G.totvert, "em_v_arr");
-
- for (i=0,eve=G.editMesh->verts.first; eve; i++,eve=eve->next)
- g_em_vert_array[i] = eve;
- }
-
- if (forEdge) {
- g_em_edge_array = MEM_mallocN(sizeof(*g_em_edge_array)*G.totedge, "em_e_arr");
-
- for (i=0,eed=G.editMesh->edges.first; eed; i++,eed=eed->next)
- g_em_edge_array[i] = eed;
- }
-
- if (forFace) {
- g_em_face_array = MEM_mallocN(sizeof(*g_em_face_array)*G.totface, "em_f_arr");
-
- for (i=0,efa=G.editMesh->faces.first; efa; i++,efa=efa->next)
- g_em_face_array[i] = efa;
- }
-}
-
-void EM_free_index_arrays(void)
-{
- if (g_em_vert_array) MEM_freeN(g_em_vert_array);
- if (g_em_edge_array) MEM_freeN(g_em_edge_array);
- if (g_em_face_array) MEM_freeN(g_em_face_array);
- g_em_vert_array = NULL;
- g_em_edge_array = NULL;
- g_em_face_array = NULL;
-}
-
-EditVert *EM_get_vert_for_index(int index)
-{
- return g_em_vert_array?g_em_vert_array[index]:NULL;
-}
-
-EditEdge *EM_get_edge_for_index(int index)
-{
- return g_em_edge_array?g_em_edge_array[index]:NULL;
-}
-
-EditFace *EM_get_face_for_index(int index)
-{
- return g_em_face_array?g_em_face_array[index]:NULL;
-}
-
-/* can we edit UV's for this mesh?*/
-int EM_texFaceCheck(void)
-{
- /* some of these checks could be a touch overkill */
- if ( (G.obedit) &&
- (G.obedit->type == OB_MESH) &&
- (G.editMesh) &&
- (G.editMesh->faces.first) &&
- (CustomData_has_layer(&G.editMesh->fdata, CD_MTFACE)))
- return 1;
- return 0;
-}
-
-/* can we edit colors for this mesh?*/
-int EM_vertColorCheck(void)
-{
- /* some of these checks could be a touch overkill */
- if ( (G.obedit) &&
- (G.obedit->type == OB_MESH) &&
- (G.editMesh) &&
- (G.editMesh->faces.first) &&
- (CustomData_has_layer(&G.editMesh->fdata, CD_MCOL)))
- return 1;
- return 0;
-}
-
diff --git a/source/blender/src/editmesh_add.c b/source/blender/src/editmesh_add.c
deleted file mode 100644
index 8fb21549172..00000000000
--- a/source/blender/src/editmesh_add.c
+++ /dev/null
@@ -1,1349 +0,0 @@
-/**
- * $Id:
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2004 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_space_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_view3d_types.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_editVert.h"
-
-#include "BKE_depsgraph.h"
-#include "BKE_global.h"
-#include "BKE_library.h"
-#include "BKE_mesh.h"
-#include "BKE_object.h"
-#include "BKE_utildefines.h"
-
-#ifdef WITH_VERSE
-#include "BKE_verse.h"
-#endif
-
-
-#include "BIF_editmesh.h"
-#include "BIF_graphics.h"
-#include "BIF_interface.h"
-#include "BIF_mywindow.h"
-#include "BIF_retopo.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-#include "BIF_transform.h"
-
-#ifdef WITH_VERSE
-#include "BIF_verse.h"
-#endif
-
-#include "BDR_editobject.h"
-
-#include "BSE_view.h"
-#include "BSE_edit.h"
-
-#include "blendef.h"
-#include "multires.h"
-#include "mydevice.h"
-
-#include "editmesh.h"
-
-/* bpymenu */
-#include "BPY_extern.h"
-#include "BPY_menus.h"
-
-static float icovert[12][3] = {
- {0,0,-200},
- {144.72, -105.144,-89.443},
- {-55.277, -170.128,-89.443},
- {-178.885,0,-89.443},
- {-55.277,170.128,-89.443},
- {144.72,105.144,-89.443},
- {55.277,-170.128,89.443},
- {-144.72,-105.144,89.443},
- {-144.72,105.144,89.443},
- {55.277,170.128,89.443},
- {178.885,0,89.443},
- {0,0,200}
-};
-static short icoface[20][3] = {
- {1,0,2},
- {1,0,5},
- {2,0,3},
- {3,0,4},
- {4,0,5},
- {1,5,10},
- {2,1,6},
- {3,2,7},
- {4,3,8},
- {5,4,9},
- {10,1,6},
- {6,2,7},
- {7,3,8},
- {8,4,9},
- {9,5,10},
- {6,10,11},
- {7,6,11},
- {8,7,11},
- {9,8,11},
- {10,9,11}
-};
-
-static void get_view_aligned_coordinate(float *fp)
-{
- float dvec[3];
- short mx, my, mval[2];
-
- getmouseco_areawin(mval);
- mx= mval[0];
- my= mval[1];
-
- project_short_noclip(fp, mval);
-
- initgrabz(fp[0], fp[1], fp[2]);
-
- if(mval[0]!=IS_CLIPPED) {
- window_to_3d(dvec, mval[0]-mx, mval[1]-my);
- VecSubf(fp, fp, dvec);
- }
-}
-
-void add_click_mesh(void)
-{
- EditMesh *em = G.editMesh;
- EditVert *eve, *v1;
- float min[3], max[3];
- int done= 0;
-
- TEST_EDITMESH
- if(multires_test()) return;
-
- INIT_MINMAX(min, max);
-
- for(v1= em->verts.first;v1; v1=v1->next) {
- if(v1->f & SELECT) {
- DO_MINMAX(v1->co, min, max);
- done= 1;
- }
- }
-
- /* call extrude? */
- if(done) {
- EditEdge *eed;
- float vec[3], cent[3], mat[3][3];
- float nor[3]= {0.0, 0.0, 0.0};
-
- /* check for edges that are half selected, use for rotation */
- done= 0;
- for(eed= em->edges.first; eed; eed= eed->next) {
- if( (eed->v1->f & SELECT)+(eed->v2->f & SELECT) == SELECT ) {
- if(eed->v1->f & SELECT) VecSubf(vec, eed->v1->co, eed->v2->co);
- else VecSubf(vec, eed->v2->co, eed->v1->co);
- VecAddf(nor, nor, vec);
- done= 1;
- }
- }
- if(done) Normalize(nor);
-
- /* center */
- VecAddf(cent, min, max);
- VecMulf(cent, 0.5f);
- VECCOPY(min, cent);
-
- Mat4MulVecfl(G.obedit->obmat, min); // view space
- get_view_aligned_coordinate(min);
- Mat4Invert(G.obedit->imat, G.obedit->obmat);
- Mat4MulVecfl(G.obedit->imat, min); // back in object space
-
- VecSubf(min, min, cent);
-
- /* calculate rotation */
- Mat3One(mat);
- if(done) {
- float dot;
-
- VECCOPY(vec, min);
- Normalize(vec);
- dot= INPR(vec, nor);
-
- if( fabs(dot)<0.999) {
- float cross[3], si, q1[4];
-
- Crossf(cross, nor, vec);
- Normalize(cross);
- dot= 0.5f*saacos(dot);
- si= (float)sin(dot);
- q1[0]= (float)cos(dot);
- q1[1]= cross[0]*si;
- q1[2]= cross[1]*si;
- q1[3]= cross[2]*si;
-
- QuatToMat3(q1, mat);
- }
- }
-
- extrudeflag(SELECT, nor);
- rotateflag(SELECT, cent, mat);
- translateflag(SELECT, min);
-
- recalc_editnormals();
- }
- else {
- float mat[3][3],imat[3][3];
- float *curs= give_cursor();
-
- eve= addvertlist(0, NULL);
-
- Mat3CpyMat4(mat, G.obedit->obmat);
- Mat3Inv(imat, mat);
-
- VECCOPY(eve->co, curs);
- VecSubf(eve->co, eve->co, G.obedit->obmat[3]);
-
- Mat3MulVecfl(imat, eve->co);
-
- eve->f= SELECT;
- }
-
- retopo_do_all();
-
- countall();
-
-#ifdef WITH_VERSE
- if(G.editMesh->vnode) {
- sync_all_verseverts_with_editverts((VNode*)G.editMesh->vnode);
- }
-#endif
-
- BIF_undo_push("Add vertex/edge/face");
- allqueue(REDRAWVIEW3D, 0);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-
- while(get_mbut()&R_MOUSE);
-
-}
-
-/* selected faces get hidden edges */
-static void make_fgon(int make)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
- EditEdge *eed;
- EditVert *eve;
- float *nor=NULL; // reference
- int done=0;
-
- if(!make) {
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->f & SELECT) {
- efa->fgonf= 0;
- efa->e1->h &= ~EM_FGON;
- efa->e2->h &= ~EM_FGON;
- efa->e3->h &= ~EM_FGON;
- if(efa->e4) efa->e4->h &= ~EM_FGON;
- }
- }
- allqueue(REDRAWVIEW3D, 0);
- EM_fgon_flags(); // redo flags and indices for fgons
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- BIF_undo_push("Clear FGon");
- return;
- }
-
- /* tagging edges. rule is:
- - edge used by exactly 2 selected faces
- - no vertices allowed with only tagged edges (return)
- - face normals are allowed to difffer
-
- */
- for(eed= em->edges.first; eed; eed= eed->next) {
- eed->f1= 0; // amount of selected
- eed->f2= 0; // amount of unselected
- }
-
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->f & SELECT) {
- if(nor==NULL) nor= efa->n;
- if(efa->e1->f1 < 3) efa->e1->f1++;
- if(efa->e2->f1 < 3) efa->e2->f1++;
- if(efa->e3->f1 < 3) efa->e3->f1++;
- if(efa->e4 && efa->e4->f1 < 3) efa->e4->f1++;
- }
- else {
- if(efa->e1->f2 < 3) efa->e1->f2++;
- if(efa->e2->f2 < 3) efa->e2->f2++;
- if(efa->e3->f2 < 3) efa->e3->f2++;
- if(efa->e4 && efa->e4->f2 < 3) efa->e4->f2++;
- }
- }
- // now eed->f1 becomes tagged edge
- for(eed= em->edges.first; eed; eed= eed->next) {
- if(eed->f1==2 && eed->f2==0) eed->f1= 1;
- else eed->f1= 0;
- }
-
- // no vertices allowed with only tagged edges
- for(eve= em->verts.first; eve; eve= eve->next) eve->f1= 0;
- for(eed= em->edges.first; eed; eed= eed->next) {
- if(eed->f1) {
- eed->v1->f1 |= 1;
- eed->v2->f1 |= 1;
- }
- else {
- eed->v1->f1 |= 2;
- eed->v2->f1 |= 2;
- }
- }
- for(eve= em->verts.first; eve; eve= eve->next) {
- if(eve->f1==1) break;
- }
- if(eve) {
- error("Cannot make polygon with interior vertices");
- return;
- }
-
- // check for faces
- if(nor==NULL) {
- error("No faces selected to make FGon");
- return;
- }
-
- // and there we go
- for(eed= em->edges.first; eed; eed= eed->next) {
- if(eed->f1) {
- eed->h |= EM_FGON;
- done= 1;
- }
- }
-
- if(done==0) {
- error("Didn't find FGon to create");
- }
- else {
- EM_fgon_flags(); // redo flags and indices for fgons
-
- allqueue(REDRAWVIEW3D, 0);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- BIF_undo_push("Make FGon");
- }
-}
-
-/* precondition; 4 vertices selected, check for 4 edges and create face */
-static EditFace *addface_from_edges(void)
-{
- EditMesh *em = G.editMesh;
- EditEdge *eed, *eedar[4]={NULL, NULL, NULL, NULL};
- EditVert *v1=NULL, *v2=NULL, *v3=NULL, *v4=NULL;
- int a;
-
- /* find the 4 edges */
- for(eed= em->edges.first; eed; eed= eed->next) {
- if(eed->f & SELECT) {
- if(eedar[0]==NULL) eedar[0]= eed;
- else if(eedar[1]==NULL) eedar[1]= eed;
- else if(eedar[2]==NULL) eedar[2]= eed;
- else eedar[3]= eed;
-
- }
- }
-
-
- if(eedar[3]) {
- /* first 2 points */
- v1= eedar[0]->v1;
- v2= eedar[0]->v2;
-
- /* find the 2 edges connected to first edge */
- for(a=1; a<4; a++) {
- if( eedar[a]->v1 == v2) v3= eedar[a]->v2;
- else if(eedar[a]->v2 == v2) v3= eedar[a]->v1;
- else if( eedar[a]->v1 == v1) v4= eedar[a]->v2;
- else if(eedar[a]->v2 == v1) v4= eedar[a]->v1;
- }
-
- /* verify if last edge exists */
- if(v3 && v4) {
- for(a=1; a<4; a++) {
- if( eedar[a]->v1==v3 && eedar[a]->v2==v4) break;
- if( eedar[a]->v2==v3 && eedar[a]->v1==v4) break;
- }
- if(a!=4) {
- return addfacelist(v1, v2, v3, v4, NULL, NULL);
- }
- }
- }
- return NULL;
-}
-
-/* this also allows to prevent triangles being made in quads */
-static int compareface_overlaps(EditFace *vl1, EditFace *vl2)
-{
- EditVert *v1, *v2, *v3, *v4;
- int equal= 0;
-
- v1= vl2->v1;
- v2= vl2->v2;
- v3= vl2->v3;
- v4= vl2->v4;
-
- if(vl1==vl2) return 0;
-
- if(v4==NULL && vl1->v4==NULL) {
- if(vl1->v1==v1 || vl1->v2==v1 || vl1->v3==v1) equal++;
- if(vl1->v1==v2 || vl1->v2==v2 || vl1->v3==v2) equal++;
- if(vl1->v1==v3 || vl1->v2==v3 || vl1->v3==v3) equal++;
- }
- else {
- if(vl1->v1==v1 || vl1->v2==v1 || vl1->v3==v1 || vl1->v4==v1) equal++;
- if(vl1->v1==v2 || vl1->v2==v2 || vl1->v3==v2 || vl1->v4==v2) equal++;
- if(vl1->v1==v3 || vl1->v2==v3 || vl1->v3==v3 || vl1->v4==v3) equal++;
- if(vl1->v1==v4 || vl1->v2==v4 || vl1->v3==v4 || vl1->v4==v4) equal++;
- }
-
- if(v4 && vl1->v4) {
- if(equal==4) return 1;
- }
- else
- if(equal>=3) return 1;
-
- return 0;
-}
-
-/* checks for existance, and for tria overlapping inside quad */
-static EditFace *exist_face_overlaps(EditVert *v1, EditVert *v2, EditVert *v3, EditVert *v4)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa, efatest;
-
- efatest.v1= v1;
- efatest.v2= v2;
- efatest.v3= v3;
- efatest.v4= v4;
-
- efa= em->faces.first;
- while(efa) {
- if(compareface_overlaps(&efatest, efa)) return efa;
- efa= efa->next;
- }
- return NULL;
-}
-
-/* will be new face smooth or solid? depends on smoothness of face neighbours
- * of new face, if function return 1, then new face will be smooth, when functio
- * will return zero, then new face will be solid */
-static void fix_new_face(EditFace *eface)
-{
- struct EditMesh *em = G.editMesh;
- struct EditFace *efa;
- struct EditEdge *eed=NULL;
- struct EditVert *v1 = eface->v1, *v2 = eface->v2, *v3 = eface->v3, *v4 = eface->v4;
- struct EditVert *ev1=NULL, *ev2=NULL;
- short smooth=0; /* "total smoothnes" of faces in neighbourhood */
- short coef; /* "weight" of smoothness */
- short count=0; /* number of edges with same direction as eface */
- short vi00=0, vi01=0, vi10=0, vi11=0; /* vertex indexes */
-
- efa = em->faces.first;
-
- while(efa) {
-
- if(efa==eface) {
- efa = efa->next;
- continue;
- }
-
- coef = 0;
- ev1 = ev2 = NULL;
- eed = NULL;
-
- if(efa->v1==v1 || efa->v2==v1 || efa->v3==v1 || efa->v4==v1) {
- ev1 = v1;
- coef++;
- }
- if(efa->v1==v2 || efa->v2==v2 || efa->v3==v2 || efa->v4==v2) {
- if(ev1) ev2 = v2;
- else ev1 = v2;
- coef++;
- }
- if(efa->v1==v3 || efa->v2==v3 || efa->v3==v3 || efa->v4==v3) {
- if(coef<2) {
- if(ev1) ev2 = v3;
- else ev1 = v3;
- }
- coef++;
- }
- if((v4) && (efa->v1==v4 || efa->v2==v4 || efa->v3==v4 || efa->v4==v4)) {
- if(ev1 && coef<2) ev2 = v4;
- coef++;
- }
-
- /* "democracy" of smoothness */
- if(efa->flag & ME_SMOOTH)
- smooth += coef;
- else
- smooth -= coef;
-
- /* try to find edge using vertexes ev1 and ev2 */
- if((ev1) && (ev2) && (ev1!=ev2)) eed = findedgelist(ev1, ev2);
-
- /* has bordering edge of efa same direction as edge of eface ? */
- if(eed) {
- if(eed->v1==v1) vi00 = 1;
- else if(eed->v1==v2) vi00 = 2;
- else if(eed->v1==v3) vi00 = 3;
- else if(v4 && eed->v1==v4) vi00 = 4;
-
- if(eed->v2==v1) vi01 = 1;
- else if(eed->v2==v2) vi01 = 2;
- else if(eed->v2==v3) vi01 = 3;
- else if(v4 && eed->v2==v4) vi01 = 4;
-
- if(v4) {
- if(vi01==1 && vi00==4) vi00 = 0;
- if(vi01==4 && vi00==1) vi01 = 0;
- }
- else {
- if(vi01==1 && vi00==3) vi00 = 0;
- if(vi01==3 && vi00==1) vi01 = 0;
- }
-
- if(eed->v1==efa->v1) vi10 = 1;
- else if(eed->v1==efa->v2) vi10 = 2;
- else if(eed->v1==efa->v3) vi10 = 3;
- else if(efa->v4 && eed->v1==efa->v4) vi10 = 4;
-
- if(eed->v2==efa->v1) vi11 = 1;
- else if(eed->v2==efa->v2) vi11 = 2;
- else if(eed->v2==efa->v3) vi11 = 3;
- else if(efa->v4 && eed->v2==efa->v4) vi11 = 4;
-
- if(efa->v4) {
- if(vi11==1 && vi10==4) vi10 = 0;
- if(vi11==4 && vi10==1) vi11 = 0;
- }
- else {
- if(vi11==1 && vi10==3) vi10 = 0;
- if(vi11==3 && vi10==1) vi11 = 0;
- }
-
- if(((vi00>vi01) && (vi10>vi11)) ||
- ((vi00<vi01) && (vi10<vi11)))
- count++;
- else
- count--;
- }
-
- efa = efa->next;
- }
-
- /* set up smoothness according voting of face in neighbourhood */
- if(smooth >= 0)
- eface->flag |= ME_SMOOTH;
- else
- eface->flag &= ~ME_SMOOTH;
-
- /* flip face, when too much "face normals" in neighbourhood is different */
- if(count > 0) {
- flipface(eface);
-#ifdef WITH_VERSE
- if(eface->vface) {
- struct VNode *vnode;
- struct VLayer *vlayer;
- vnode = (VNode*)((Mesh*)G.obedit->data)->vnode;
- vlayer = find_verse_layer_type((VGeomData*)vnode->data, POLYGON_LAYER);
- add_item_to_send_queue(&(vlayer->queue), (void*)eface->vface, VERSE_FACE);
- }
-#endif
- }
-}
-
-void addfaces_from_edgenet()
-{
- EditVert *eve1, *eve2, *eve3, *eve4;
- EditMesh *em= G.editMesh;
-
- for(eve1= em->verts.first; eve1; eve1= eve1->next) {
- for(eve2= em->verts.first; (eve1->f & 1) && eve2; eve2= eve2->next) {
- if(findedgelist(eve1,eve2)) {
- for(eve3= em->verts.first; (eve2->f & 1) && eve3; eve3= eve3->next) {
- if((eve2!=eve3 && (eve3->f & 1) && findedgelist(eve1,eve3))) {
- EditEdge *sh_edge= NULL;
- EditVert *sh_vert= NULL;
-
- sh_edge= findedgelist(eve2,eve3);
-
- if(sh_edge) { /* Add a triangle */
- if(!exist_face_overlaps(eve1,eve2,eve3,NULL))
- fix_new_face(addfacelist(eve1,eve2,eve3,NULL,NULL,NULL));
- }
- else { /* Check for a shared vertex */
- for(eve4= em->verts.first; eve4; eve4= eve4->next) {
- if(eve4!=eve1 && eve4!=eve2 && eve4!=eve3 && (eve4->f & 1) &&
- !findedgelist(eve1,eve4) && findedgelist(eve2,eve4) &&
- findedgelist(eve3,eve4)) {
- sh_vert= eve4;
- break;
- }
- }
-
- if(sh_vert) {
- if(sh_vert) {
- if(!exist_face_overlaps(eve1,eve2,eve4,eve3))
- fix_new_face(addfacelist(eve1,eve2,eve4,eve3,NULL,NULL));
- }
- }
- }
- }
- }
- }
- }
- }
-
- countall();
-
- EM_select_flush();
-
- BIF_undo_push("Add faces");
- allqueue(REDRAWVIEW3D, 0);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-}
-
-void addedgeface_mesh(void)
-{
- EditMesh *em = G.editMesh;
- EditVert *eve, *neweve[4];
- EditEdge *eed;
- EditFace *efa;
- short amount=0;
-
- if( (G.vd->lay & G.obedit->lay)==0 ) return;
- if(multires_test()) return;
-
- /* how many selected ? */
- if(G.scene->selectmode & SCE_SELECT_EDGE) {
- /* in edge mode finding selected vertices means flushing down edge codes... */
- /* can't make face with only edge selection info... */
- EM_selectmode_set();
- }
-
- for(eve= em->verts.first; eve; eve= eve->next) {
- if(eve->f & SELECT) {
- amount++;
- if(amount>4) break;
- neweve[amount-1]= eve;
- }
- }
-
- if(amount==2) {
- eed= addedgelist(neweve[0], neweve[1], NULL);
- EM_select_edge(eed, 1);
- BIF_undo_push("Add edge");
- allqueue(REDRAWVIEW3D, 0);
- countall();
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- return;
- }
- else if(amount > 4) {
-
- /* Python Menu */
- BPyMenu *pym;
- char menu_number[3];
- int i=0, has_pymenu=0, ret;
-
- /* facemenu, will add python items */
- char facemenu[4096]= "Make Faces%t|Auto%x1|Make FGon%x2|Clear FGon%x3";
-
- /* note that we account for the 10 previous entries with i+4: */
- for (pym = BPyMenuTable[PYMENU_MESHFACEKEY]; pym; pym = pym->next, i++) {
-
- if (!has_pymenu) {
- strcat(facemenu, "|%l");
- has_pymenu = 1;
- }
-
- strcat(facemenu, "|");
- strcat(facemenu, pym->name);
- strcat(facemenu, " %x");
- sprintf(menu_number, "%d", i+4);
- strcat(facemenu, menu_number);
- }
-
- ret= pupmenu(facemenu);
-
- if(ret==1) addfaces_from_edgenet();
- else if(ret==2) make_fgon(1);
- else if(ret==3) make_fgon(0);
- else if (ret >= 4) {
- BPY_menu_do_python(PYMENU_MESHFACEKEY, ret - 4);
- return;
- }
- return;
- }
- else if(amount<2) {
- error("Incorrect number of vertices to make edge/face");
- return;
- }
-
- efa= NULL; // check later
-
- if(amount==3) {
-
- if(exist_face_overlaps(neweve[0], neweve[1], neweve[2], NULL)==0) {
- efa= addfacelist(neweve[0], neweve[1], neweve[2], 0, NULL, NULL);
- EM_select_face(efa, 1);
- }
- else error("The selected vertices already form a face");
- }
- else if(amount==4) {
- /* this test survives when theres 2 triangles */
- if(exist_face(neweve[0], neweve[1], neweve[2], neweve[3])==0) {
- int tria= 0;
-
- /* remove trias if they exist, 4 cases.... */
- if(exist_face(neweve[0], neweve[1], neweve[2], NULL)) tria++;
- if(exist_face(neweve[0], neweve[1], neweve[3], NULL)) tria++;
- if(exist_face(neweve[0], neweve[2], neweve[3], NULL)) tria++;
- if(exist_face(neweve[1], neweve[2], neweve[3], NULL)) tria++;
-
- if(tria==2) join_triangles();
- else if(exist_face_overlaps(neweve[0], neweve[1], neweve[2], neweve[3])==0) {
- /* If there are 4 Verts, But more selected edges, we need to call addfaces_from_edgenet */
- EditEdge *eedcheck;
- int count;
- count = 0;
- for(eedcheck= em->edges.first; eedcheck; eedcheck= eedcheck->next) {
- if(eedcheck->f & SELECT) {
- count++;
- }
- }
-
- if(count++ > 4){
- addfaces_from_edgenet();
- return;
- } else {
- /* if 4 edges exist, we just create the face, convex or not */
- efa= addface_from_edges();
- if(efa==NULL) {
- /* the order of vertices can be anything, 6 cases to check */
- if( convex(neweve[0]->co, neweve[1]->co, neweve[2]->co, neweve[3]->co) ) {
- efa= addfacelist(neweve[0], neweve[1], neweve[2], neweve[3], NULL, NULL);
- }
- else if( convex(neweve[0]->co, neweve[2]->co, neweve[3]->co, neweve[1]->co) ) {
- efa= addfacelist(neweve[0], neweve[2], neweve[3], neweve[1], NULL, NULL);
- }
- else if( convex(neweve[0]->co, neweve[2]->co, neweve[1]->co, neweve[3]->co) ) {
- efa= addfacelist(neweve[0], neweve[2], neweve[1], neweve[3], NULL, NULL);
- }
-
- else if( convex(neweve[1]->co, neweve[2]->co, neweve[3]->co, neweve[0]->co) ) {
- efa= addfacelist(neweve[1], neweve[2], neweve[3], neweve[0], NULL, NULL);
- }
- else if( convex(neweve[1]->co, neweve[3]->co, neweve[0]->co, neweve[2]->co) ) {
- efa= addfacelist(neweve[1], neweve[3], neweve[0], neweve[2], NULL, NULL);
- }
- else if( convex(neweve[1]->co, neweve[3]->co, neweve[2]->co, neweve[0]->co) ) {
- efa= addfacelist(neweve[1], neweve[3], neweve[2], neweve[0], NULL, NULL);
- }
- else error("The selected vertices form a concave quad");
- }
- }
- }
- else error("The selected vertices already form a face");
- }
- else error("The selected vertices already form a face");
- }
-
- if(efa) {
- EM_select_face(efa, 1);
-
- fix_new_face(efa);
-
- recalc_editnormals();
- BIF_undo_push("Add face");
- }
-
- countall();
- allqueue(REDRAWVIEW3D, 0);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-}
-
-
-void adduplicate_mesh(void)
-{
-
- TEST_EDITMESH
- if(multires_test()) return;
-
- waitcursor(1);
-
- adduplicateflag(SELECT);
-
- waitcursor(0);
- countall();
-
- /* We need to force immediate calculation here because
- * transform may use derived objects (which are now stale).
- *
- * This shouldn't be necessary, derived queries should be
- * automatically building this data if invalid. Or something.
- */
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- object_handle_update(G.obedit);
-
- BIF_TransformSetUndo("Add Duplicate");
- initTransform(TFM_TRANSLATION, CTX_NO_PET);
- Transform();
-}
-
-/* check whether an object to add mesh to exists, if not, create one
-* returns 1 if new object created, else 0 */
-int confirm_objectExists( Mesh **me, float mat[][3] )
-{
- int newob = 0;
-
- /* deselectall */
- EM_clear_flag_all(SELECT);
-
- /* if no obedit: new object and enter editmode */
- if(G.obedit==NULL) {
- /* add_object actually returns an object ! :-)
- But it also stores the added object struct in
- G.scene->basact->object (BASACT->object) */
-
- add_object_draw(OB_MESH);
-
- G.obedit= BASACT->object;
-
- where_is_object(G.obedit);
-
- make_editMesh();
- setcursor_space(SPACE_VIEW3D, CURSOR_EDIT);
- newob= 1;
- }
- *me = G.obedit->data;
-
- /* imat and center and size */
- Mat3CpyMat4(mat, G.obedit->obmat);
-
- return newob;
-}
-
-void make_prim(int type, float imat[3][3], int tot, int seg,
- int subdiv, float dia, float d, int ext, int fill,
- float cent[3])
-{
- /*
- * type - for the type of shape
- * dia - the radius for cone,sphere cylinder etc.
- * d - depth for the cone
- * ext - ?
- * fill - end capping, and option to fill in circle
- * cent[3] - center of the data.
- * */
-
- EditMesh *em = G.editMesh;
- EditVert *eve, *v1=NULL, *v2, *v3, *v4=NULL, *vtop, *vdown;
- float phi, phid, vec[3];
- float q[4], cmat[3][3], nor[3]= {0.0, 0.0, 0.0};
- short a, b;
-
- phid= 2*M_PI/tot;
- phi= .25*M_PI;
-
- switch(type) {
- case 10: /* grid */
- /* clear flags */
- eve= em->verts.first;
- while(eve) {
- eve->f= 0;
- eve= eve->next;
- }
- /* one segment first: the X axis */
- phi= 1.0;
- phid= 2.0/((float)tot-1);
- for(a=0;a<tot;a++) {
- vec[0]= cent[0]+dia*phi;
- vec[1]= cent[1]- dia;
- vec[2]= cent[2];
- Mat3MulVecfl(imat,vec);
- eve= addvertlist(vec, NULL);
- eve->f= 1+2+4;
- if (a) {
- addedgelist(eve->prev, eve, NULL);
- }
- phi-=phid;
- }
- /* extrude and translate */
- vec[0]= vec[2]= 0.0;
- vec[1]= dia*phid;
- Mat3MulVecfl(imat, vec);
- for(a=0;a<seg-1;a++) {
- extrudeflag_vert(2, nor); // nor unused
- translateflag(2, vec);
- }
- break;
- case 11: /* UVsphere */
-
- /* clear all flags */
- eve= em->verts.first;
- while(eve) {
- eve->f= 0;
- eve= eve->next;
- }
-
- /* one segment first */
- phi= 0;
- phid/=2;
- for(a=0; a<=tot; a++) {
- vec[0]= dia*sin(phi);
- vec[1]= 0.0;
- vec[2]= dia*cos(phi);
- eve= addvertlist(vec, NULL);
- eve->f= 1+2+4;
- if(a==0) v1= eve;
- else addedgelist(eve->prev, eve, NULL);
- phi+= phid;
- }
-
- /* extrude and rotate */
- phi= M_PI/seg;
- q[0]= cos(phi);
- q[3]= sin(phi);
- q[1]=q[2]= 0;
- QuatToMat3(q, cmat);
-
- for(a=0; a<seg; a++) {
- extrudeflag_vert(2, nor); // nor unused
- rotateflag(2, v1->co, cmat);
- }
-
- removedoublesflag(4, 0, 0.0001);
-
- /* and now do imat */
- eve= em->verts.first;
- while(eve) {
- if(eve->f & SELECT) {
- VecAddf(eve->co,eve->co,cent);
- Mat3MulVecfl(imat,eve->co);
- }
- eve= eve->next;
- }
- break;
- case 12: /* Icosphere */
- {
- EditVert *eva[12];
- EditEdge *eed;
-
- /* clear all flags */
- eve= em->verts.first;
- while(eve) {
- eve->f= 0;
- eve= eve->next;
- }
- dia/=200;
- for(a=0;a<12;a++) {
- vec[0]= dia*icovert[a][0];
- vec[1]= dia*icovert[a][1];
- vec[2]= dia*icovert[a][2];
- eva[a]= addvertlist(vec, NULL);
- eva[a]->f= 1+2;
- }
- for(a=0;a<20;a++) {
- EditFace *evtemp;
- v1= eva[ icoface[a][0] ];
- v2= eva[ icoface[a][1] ];
- v3= eva[ icoface[a][2] ];
- evtemp = addfacelist(v1, v2, v3, 0, NULL, NULL);
- evtemp->e1->f = 1+2;
- evtemp->e2->f = 1+2;
- evtemp->e3->f = 1+2;
- }
-
- dia*=200;
- for(a=1; a<subdiv; a++) esubdivideflag(2, dia, 0,1,0);
- /* and now do imat */
- eve= em->verts.first;
- while(eve) {
- if(eve->f & 2) {
- VecAddf(eve->co,eve->co,cent);
- Mat3MulVecfl(imat,eve->co);
- }
- eve= eve->next;
- }
-
- // Clear the flag 2 from the edges
- for(eed=em->edges.first;eed;eed=eed->next){
- if(eed->f & 2){
- eed->f &= !2;
- }
- }
- }
- break;
- case 13: /* Monkey */
- {
- extern int monkeyo, monkeynv, monkeynf;
- extern signed char monkeyf[][4];
- extern signed char monkeyv[][3];
- EditVert **tv= MEM_mallocN(sizeof(*tv)*monkeynv*2, "tv");
- EditFace *efa;
- int i;
-
- for (i=0; i<monkeynv; i++) {
- float v[3];
- v[0]= (monkeyv[i][0]+127)/128.0, v[1]= monkeyv[i][1]/128.0, v[2]= monkeyv[i][2]/128.0;
- tv[i]= addvertlist(v, NULL);
- tv[i]->f |= SELECT;
- tv[monkeynv+i]= (fabs(v[0]= -v[0])<0.001)?tv[i]:addvertlist(v, NULL);
- tv[monkeynv+i]->f |= SELECT;
- }
- for (i=0; i<monkeynf; i++) {
- efa= addfacelist(tv[monkeyf[i][0]+i-monkeyo], tv[monkeyf[i][1]+i-monkeyo], tv[monkeyf[i][2]+i-monkeyo], (monkeyf[i][3]!=monkeyf[i][2])?tv[monkeyf[i][3]+i-monkeyo]:NULL, NULL, NULL);
- efa= addfacelist(tv[monkeynv+monkeyf[i][2]+i-monkeyo], tv[monkeynv+monkeyf[i][1]+i-monkeyo], tv[monkeynv+monkeyf[i][0]+i-monkeyo], (monkeyf[i][3]!=monkeyf[i][2])?tv[monkeynv+monkeyf[i][3]+i-monkeyo]:NULL, NULL, NULL);
- }
-
- MEM_freeN(tv);
-
- /* and now do imat */
- for(eve= em->verts.first; eve; eve= eve->next) {
- if(eve->f & SELECT) {
- VecAddf(eve->co,eve->co,cent);
- Mat3MulVecfl(imat,eve->co);
- }
- }
- recalc_editnormals();
- }
- break;
- default: /* all types except grid, sphere... */
- if(ext==0 && type!=7) d= 0;
-
- /* vertices */
- vtop= vdown= v1= v2= 0;
- for(b=0; b<=ext; b++) {
- for(a=0; a<tot; a++) {
-
- vec[0]= cent[0]+dia*sin(phi);
- vec[1]= cent[1]+dia*cos(phi);
- vec[2]= cent[2]+d;
-
- Mat3MulVecfl(imat, vec);
- eve= addvertlist(vec, NULL);
- eve->f= SELECT;
- if(a==0) {
- if(b==0) v1= eve;
- else v2= eve;
- }
- phi+=phid;
- }
- d= -d;
- }
- /* center vertices */
- /* type 7, a cone can only have 1 one side filled
- * if the cone has no capping, dont add vtop */
- if((fill && type>1) || type == 7) {
- VECCOPY(vec,cent);
- vec[2]-= -d;
- Mat3MulVecfl(imat,vec);
- vdown= addvertlist(vec, NULL);
- if((ext || type==7) && fill) {
- VECCOPY(vec,cent);
- vec[2]-= d;
- Mat3MulVecfl(imat,vec);
- vtop= addvertlist(vec, NULL);
- }
- } else {
- vdown= v1;
- vtop= v2;
- }
- if(vtop) vtop->f= SELECT;
- if(vdown) vdown->f= SELECT;
-
- /* top and bottom face */
- if(fill || type==7) {
- if(tot==4 && (type==0 || type==1)) {
- v3= v1->next->next;
- if(ext) v4= v2->next->next;
-
- addfacelist(v3, v1->next, v1, v3->next, NULL, NULL);
- if(ext) addfacelist(v2, v2->next, v4, v4->next, NULL, NULL);
-
- }
- else {
- v3= v1;
- v4= v2;
- for(a=1; a<tot; a++) {
- addfacelist(vdown, v3, v3->next, 0, NULL, NULL);
- v3= v3->next;
- if(ext && fill) {
- addfacelist(vtop, v4, v4->next, 0, NULL, NULL);
- v4= v4->next;
- }
- }
- if(type>1) {
- addfacelist(vdown, v3, v1, 0, NULL, NULL);
- if(ext) addfacelist(vtop, v4, v2, 0, NULL, NULL);
- }
- }
- }
- else if(type==4) { /* we need edges for a circle */
- v3= v1;
- for(a=1;a<tot;a++) {
- addedgelist(v3, v3->next, NULL);
- v3= v3->next;
- }
- addedgelist(v3, v1, NULL);
- }
- /* side faces */
- if(ext) {
- v3= v1;
- v4= v2;
- for(a=1; a<tot; a++) {
- addfacelist(v3, v3->next, v4->next, v4, NULL, NULL);
- v3= v3->next;
- v4= v4->next;
- }
- addfacelist(v3, v1, v2, v4, NULL, NULL);
- }
- else if(type==7 && fill) {
- /* add the bottom flat area of the cone
- * if capping is disabled dont bother */
- v3= v1;
- for(a=1; a<tot; a++) {
- addfacelist(vtop, v3->next, v3, 0, NULL, NULL);
- v3= v3->next;
- }
- addfacelist(vtop, v1, v3, 0, NULL, NULL);
- }
- }
- /* simple selection flush OK, based on fact it's a single model */
- EM_select_flush(); /* flushes vertex -> edge -> face selection */
-
- if(type!=0 && type!=13)
- righthandfaces(1); /* otherwise monkey has eyes in wrong direction */
-}
-
-void add_primitiveMesh(int type)
-{
- Mesh *me;
- float *curs, d, dia, phi, phid, cent[3], imat[3][3], mat[3][3];
- float cmat[3][3];
- static int tot=32, seg=32, subdiv=2,
- /* so each type remembers its fill setting */
- fill_circle=0, fill_cone=1, fill_cylinder=1;
-
- int ext=0, fill=0, totoud, newob=0;
- char *undostr="Add Primitive";
- char *name=NULL;
-
- if(G.scene->id.lib) return;
-
- /* this function also comes from an info window */
- if ELEM(curarea->spacetype, SPACE_VIEW3D, SPACE_INFO); else return;
- if(G.vd==0) return;
-
- if (G.obedit && G.obedit->type==OB_MESH && multires_test()) return;
-
- /* if editmode exists for other type, it exits */
- check_editmode(OB_MESH);
-
- if(G.f & (G_VERTEXPAINT+G_TEXTUREPAINT)) {
- G.f &= ~(G_VERTEXPAINT+G_TEXTUREPAINT);
- setcursor_space(SPACE_VIEW3D, CURSOR_EDIT);
- }
-
- totoud= tot; /* store, and restore when cube/plane */
-
- dia= G.vd->grid;
- d= G.vd->grid;
-
- /* ext==extrudeflag, tot==amount of vertices in basis */
- switch(type) {
- case 0: /* plane */
- tot= 4;
- ext= 0;
- fill= 1;
- newob = confirm_objectExists( &me, mat );
- if(newob) name = "Plane";
- undostr="Add Plane";
- break;
- case 1: /* cube */
- tot= 4;
- ext= 1;
- fill= 1;
- newob = confirm_objectExists( &me, mat );
- if(newob) name = "Cube";
- undostr="Add Cube";
- break;
- case 4: /* circle */
- add_numbut(0, NUM|INT, "Vertices:", 3, 500, &tot, NULL);
- add_numbut(1, NUM|FLO, "Radius:", 0.001*G.vd->grid, 100*G.vd->grid, &dia, NULL);
- add_numbut(2, TOG|INT, "Fill", 0, 0, &(fill_circle), NULL);
- if (!(do_clever_numbuts("Add Circle", 3, REDRAW))) return;
- ext= 0;
- fill = fill_circle;
- newob = confirm_objectExists( &me, mat );
- if(newob) name = "Circle";
- undostr="Add Circle";
- break;
- case 5: /* cylinder */
- d*=2;
- add_numbut(0, NUM|INT, "Vertices:", 2, 500, &tot, NULL);
- add_numbut(1, NUM|FLO, "Radius:", 0.001*G.vd->grid, 100*G.vd->grid, &dia, NULL);
- add_numbut(2, NUM|FLO, "Depth:", 0.001*G.vd->grid, 100*G.vd->grid, &d, NULL);
- add_numbut(3, TOG|INT, "Cap Ends", 0, 0, &(fill_cylinder), NULL);
- if (!(do_clever_numbuts("Add Cylinder", 4, REDRAW))) return;
- ext= 1;
- fill = fill_cylinder;
- d/=2;
- newob = confirm_objectExists( &me, mat );
- if(newob) {
- if (fill) name = "Cylinder";
- else name = "Tube";
- }
- undostr="Add Cylinder";
- break;
- case 7: /* cone */
- d*=2;
- add_numbut(0, NUM|INT, "Vertices:", 2, 500, &tot, NULL);
- add_numbut(1, NUM|FLO, "Radius:", 0.001*G.vd->grid, 100*G.vd->grid, &dia, NULL);
- add_numbut(2, NUM|FLO, "Depth:", 0.001*G.vd->grid, 100*G.vd->grid, &d, NULL);
- add_numbut(3, TOG|INT, "Cap End", 0, 0, &(fill_cone), NULL);
- if (!(do_clever_numbuts("Add Cone", 4, REDRAW))) return;
- d/=2;
- ext= 0;
- fill = fill_cone;
- newob = confirm_objectExists( &me, mat );
- if(newob) name = "Cone";
- undostr="Add Cone";
- break;
- case 10: /* grid */
- add_numbut(0, NUM|INT, "X res:", 3, 1000, &tot, NULL);
- add_numbut(1, NUM|INT, "Y res:", 3, 1000, &seg, NULL);
- if (!(do_clever_numbuts("Add Grid", 2, REDRAW))) return;
- newob = confirm_objectExists( &me, mat );
- if(newob) name = "Grid";
- undostr="Add Grid";
- break;
- case 11: /* UVsphere */
- add_numbut(0, NUM|INT, "Segments:", 3, 500, &seg, NULL);
- add_numbut(1, NUM|INT, "Rings:", 3, 500, &tot, NULL);
- add_numbut(2, NUM|FLO, "Radius:", 0.001*G.vd->grid, 100*G.vd->grid, &dia, NULL);
-
- if (!(do_clever_numbuts("Add UV Sphere", 3, REDRAW))) return;
-
- newob = confirm_objectExists( &me, mat );
- if(newob) name = "Sphere";
- undostr="Add UV Sphere";
- break;
- case 12: /* Icosphere */
- add_numbut(0, NUM|INT, "Subdivision:", 1, 8, &subdiv, NULL);
- add_numbut(1, NUM|FLO, "Radius:", 0.001*G.vd->grid, 100*G.vd->grid, &dia, NULL);
- if (!(do_clever_numbuts("Add Ico Sphere", 2, REDRAW))) return;
-
- newob = confirm_objectExists( &me, mat );
- if(newob) name = "Sphere";
- undostr="Add Ico Sphere";
- break;
- case 13: /* Monkey */
- newob = confirm_objectExists( &me, mat );
- if(newob) name = "Suzanne";
- undostr="Add Monkey";
- break;
- default:
- newob = confirm_objectExists( &me, mat );
- break;
- }
-
- if( name!=NULL ) {
- rename_id((ID *)G.obedit, name );
- rename_id((ID *)me, name );
- }
-
- d = -d;
- curs= give_cursor();
- VECCOPY(cent, curs);
- cent[0]-= G.obedit->obmat[3][0];
- cent[1]-= G.obedit->obmat[3][1];
- cent[2]-= G.obedit->obmat[3][2];
-
- if ( !(newob) || U.flag & USER_ADD_VIEWALIGNED) Mat3CpyMat4(imat, G.vd->viewmat);
- else Mat3One(imat);
- Mat3MulVecfl(imat, cent);
- Mat3MulMat3(cmat, imat, mat);
- Mat3Inv(imat,cmat);
-
-
- if(type == 0 || type == 1) /* plane, cube (diameter of 1.41 makes it unit size) */
- dia *= sqrt(2.0);
-
- phid= 2*M_PI/tot;
- phi= .25*M_PI;
-
- make_prim(type, imat, tot, seg, subdiv, dia, d, ext, fill, cent);
-
- if(type<2) tot = totoud;
-
- /* simple selection flush OK, based on fact it's a single model */
- EM_select_flush(); // flushes vertex -> edge -> face selection
-
- if(type!=0 && type!=13) righthandfaces(1); /* otherwise monkey has eyes in wrong direction... */
- countall();
-
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-
- /* if a new object was created, it stores it in Mesh, for reload original data and undo */
- if ( !(newob) || U.flag & USER_ADD_EDITMODE) {
- if(newob) load_editMesh();
- } else {
- exit_editmode(2);
- }
-
- allqueue(REDRAWINFO, 1); /* 1, because header->win==0! */
- allqueue(REDRAWALL, 0);
-
- BIF_undo_push(undostr);
-}
-
diff --git a/source/blender/src/editmesh_lib.c b/source/blender/src/editmesh_lib.c
deleted file mode 100644
index d9b8fa93eb9..00000000000
--- a/source/blender/src/editmesh_lib.c
+++ /dev/null
@@ -1,2239 +0,0 @@
-/**
- * $Id:
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2004 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-/*
-
-editmesh_lib: generic (no UI, no menus) operations/evaluators for editmesh data
-
-*/
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_modifier_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_editVert.h"
-
-#include "BKE_customdata.h"
-#include "BKE_global.h"
-#include "BKE_mesh.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_editmesh.h"
-
-#ifdef WITH_VERSE
-#include "BIF_verse.h"
-#endif
-
-#include "BSE_edit.h"
-
-#include "editmesh.h"
-
-/* this replaces the active flag used in uv/face mode */
-void EM_set_actFace(EditFace *efa)
-{
- G.editMesh->act_face = efa;
-}
-
-EditFace * EM_get_actFace(void)
-{
- return G.editMesh->act_face;
-}
-
-/* ********* Selection History ************ */
-static int EM_check_selection(void *data)
-{
- EditSelection *ese;
-
- for(ese = G.editMesh->selected.first; ese; ese = ese->next){
- if(ese->data == data) return 1;
- }
-
- return 0;
-}
-
-void EM_remove_selection(void *data, int type)
-{
- EditSelection *ese;
- for(ese=G.editMesh->selected.first; ese; ese = ese->next){
- if(ese->data == data){
- BLI_freelinkN(&(G.editMesh->selected),ese);
- break;
- }
- }
-}
-
-void EM_store_selection(void *data, int type)
-{
- EditSelection *ese;
- if(!EM_check_selection(data)){
- ese = (EditSelection*) MEM_callocN( sizeof(EditSelection), "Edit Selection");
- ese->type = type;
- ese->data = data;
- BLI_addtail(&(G.editMesh->selected),ese);
- }
-}
-
-void EM_validate_selections(void)
-{
- EditSelection *ese, *nextese;
- EditMesh *em = G.editMesh;
- ese = em->selected.first;
- while(ese){
- nextese = ese->next;
- if(ese->type == EDITVERT && !(((EditVert*)ese->data)->f & SELECT)) BLI_freelinkN(&(em->selected), ese);
- else if(ese->type == EDITEDGE && !(((EditEdge*)ese->data)->f & SELECT)) BLI_freelinkN(&(em->selected), ese);
- else if(ese->type == EDITFACE && !(((EditFace*)ese->data)->f & SELECT)) BLI_freelinkN(&(em->selected), ese);
- ese = nextese;
- }
-}
-
-static void EM_strip_selections(void)
-{
- EditSelection *ese, *nextese;
- if(!(G.scene->selectmode & SCE_SELECT_VERTEX)){
- ese = G.editMesh->selected.first;
- while(ese){
- nextese = ese->next;
- if(ese->type == EDITVERT) BLI_freelinkN(&(G.editMesh->selected),ese);
- ese = nextese;
- }
- }
- if(!(G.scene->selectmode & SCE_SELECT_EDGE)){
- ese=G.editMesh->selected.first;
- while(ese){
- nextese = ese->next;
- if(ese->type == EDITEDGE) BLI_freelinkN(&(G.editMesh->selected), ese);
- ese = nextese;
- }
- }
- if(!(G.scene->selectmode & SCE_SELECT_FACE)){
- ese=G.editMesh->selected.first;
- while(ese){
- nextese = ese->next;
- if(ese->type == EDITFACE) BLI_freelinkN(&(G.editMesh->selected), ese);
- ese = nextese;
- }
- }
-}
-
-/* generic way to get data from an EditSelection type
-These functions were written to be used by the Modifier widget when in Rotate about active mode,
-but can be used anywhere.
-EM_editselection_center
-EM_editselection_normal
-EM_editselection_plane
-*/
-void EM_editselection_center(float *center, EditSelection *ese)
-{
- if (ese->type==EDITVERT) {
- EditVert *eve= ese->data;
- VecCopyf(center, eve->co);
- } else if (ese->type==EDITEDGE) {
- EditEdge *eed= ese->data;
- VecAddf(center, eed->v1->co, eed->v2->co);
- VecMulf(center, 0.5);
- } else if (ese->type==EDITFACE) {
- EditFace *efa= ese->data;
- VecCopyf(center, efa->cent);
- }
-}
-
-void EM_editselection_normal(float *normal, EditSelection *ese)
-{
- if (ese->type==EDITVERT) {
- EditVert *eve= ese->data;
- VecCopyf(normal, eve->no);
- } else if (ese->type==EDITEDGE) {
- EditEdge *eed= ese->data;
- float plane[3]; /* need a plane to correct the normal */
- float vec[3]; /* temp vec storage */
-
- VecAddf(normal, eed->v1->no, eed->v2->no);
- VecSubf(plane, eed->v2->co, eed->v1->co);
-
- /* the 2 vertex normals will be close but not at rightangles to the edge
- for rotate about edge we want them to be at right angles, so we need to
- do some extra colculation to correct the vert normals,
- we need the plane for this */
- Crossf(vec, normal, plane);
- Crossf(normal, plane, vec);
- Normalize(normal);
-
- } else if (ese->type==EDITFACE) {
- EditFace *efa= ese->data;
- VecCopyf(normal, efa->n);
- }
-}
-
-/* Calculate a plane that is rightangles to the edge/vert/faces normal
-also make the plane run allong an axis that is related to the geometry,
-because this is used for the manipulators Y axis.*/
-void EM_editselection_plane(float *plane, EditSelection *ese)
-{
- if (ese->type==EDITVERT) {
- EditVert *eve= ese->data;
- float vec[3]={0,0,0};
-
- if (ese->prev) { /*use previously selected data to make a usefull vertex plane */
- EM_editselection_center(vec, ese->prev);
- VecSubf(plane, vec, eve->co);
- } else {
- /* make a fake plane thats at rightangles to the normal
- we cant make a crossvec from a vec thats the same as the vec
- unlikely but possible, so make sure if the normal is (0,0,1)
- that vec isnt the same or in the same direction even.*/
- if (eve->no[0]<0.5) vec[0]=1;
- else if (eve->no[1]<0.5) vec[1]=1;
- else vec[2]=1;
- Crossf(plane, eve->no, vec);
- }
- } else if (ese->type==EDITEDGE) {
- EditEdge *eed= ese->data;
-
- /*the plane is simple, it runs allong the edge
- however selecting different edges can swap the direction of the y axis.
- this makes it less likely for the y axis of the manipulator
- (running along the edge).. to flip less often.
- at least its more pradictable */
- if (eed->v2->co[1] > eed->v1->co[1]) /*check which to do first */
- VecSubf(plane, eed->v2->co, eed->v1->co);
- else
- VecSubf(plane, eed->v1->co, eed->v2->co);
-
- } else if (ese->type==EDITFACE) {
- EditFace *efa= ese->data;
- float vec[3];
- if (efa->v4) { /*if its a quad- set the plane along the 2 longest edges.*/
- float vecA[3], vecB[3];
- VecSubf(vecA, efa->v4->co, efa->v3->co);
- VecSubf(vecB, efa->v1->co, efa->v2->co);
- VecAddf(plane, vecA, vecB);
-
- VecSubf(vecA, efa->v1->co, efa->v4->co);
- VecSubf(vecB, efa->v2->co, efa->v3->co);
- VecAddf(vec, vecA, vecB);
- /*use the biggest edge length*/
- if (plane[0]*plane[0]+plane[1]*plane[1]+plane[2]*plane[2] < vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2])
- VecCopyf(plane, vec);
- } else {
- /*start with v1-2 */
- VecSubf(plane, efa->v1->co, efa->v2->co);
-
- /*test the edge between v2-3, use if longer */
- VecSubf(vec, efa->v2->co, efa->v3->co);
- if (plane[0]*plane[0]+plane[1]*plane[1]+plane[2]*plane[2] < vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2])
- VecCopyf(plane, vec);
-
- /*test the edge between v1-3, use if longer */
- VecSubf(vec, efa->v3->co, efa->v1->co);
- if (plane[0]*plane[0]+plane[1]*plane[1]+plane[2]*plane[2] < vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2])
- VecCopyf(plane, vec);
- }
- }
- Normalize(plane);
-}
-
-
-
-void EM_select_face(EditFace *efa, int sel)
-{
- if(sel) {
- efa->f |= SELECT;
- efa->e1->f |= SELECT;
- efa->e2->f |= SELECT;
- efa->e3->f |= SELECT;
- if(efa->e4) efa->e4->f |= SELECT;
- efa->v1->f |= SELECT;
- efa->v2->f |= SELECT;
- efa->v3->f |= SELECT;
- if(efa->v4) efa->v4->f |= SELECT;
- }
- else {
- efa->f &= ~SELECT;
- efa->e1->f &= ~SELECT;
- efa->e2->f &= ~SELECT;
- efa->e3->f &= ~SELECT;
- if(efa->e4) efa->e4->f &= ~SELECT;
- efa->v1->f &= ~SELECT;
- efa->v2->f &= ~SELECT;
- efa->v3->f &= ~SELECT;
- if(efa->v4) efa->v4->f &= ~SELECT;
- }
-}
-
-void EM_select_edge(EditEdge *eed, int sel)
-{
- if(sel) {
- eed->f |= SELECT;
- eed->v1->f |= SELECT;
- eed->v2->f |= SELECT;
- }
- else {
- eed->f &= ~SELECT;
- eed->v1->f &= ~SELECT;
- eed->v2->f &= ~SELECT;
- }
-}
-
-void EM_select_face_fgon(EditFace *efa, int val)
-{
- EditMesh *em = G.editMesh;
- short index=0;
-
- if(efa->fgonf==0) EM_select_face(efa, val);
- else {
- if(efa->e1->fgoni) index= efa->e1->fgoni;
- if(efa->e2->fgoni) index= efa->e2->fgoni;
- if(efa->e3->fgoni) index= efa->e3->fgoni;
- if(efa->v4 && efa->e4->fgoni) index= efa->e4->fgoni;
-
- if(index==0) printf("wrong fgon select\n");
-
- // select all ngon faces with index
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->fgonf) {
- if(efa->e1->fgoni==index || efa->e2->fgoni==index ||
- efa->e3->fgoni==index || (efa->e4 && efa->e4->fgoni==index) ) {
- EM_select_face(efa, val);
- }
- }
- }
- }
-}
-
-
-/* only vertices */
-int faceselectedOR(EditFace *efa, int flag)
-{
- if ((efa->v1->f | efa->v2->f | efa->v3->f | (efa->v4?efa->v4->f:0))&flag) {
- return 1;
- } else {
- return 0;
- }
-}
-
-// replace with (efa->f & SELECT)
-int faceselectedAND(EditFace *efa, int flag)
-{
- if ((efa->v1->f & efa->v2->f & efa->v3->f & (efa->v4?efa->v4->f:flag))&flag) {
- return 1;
- } else {
- return 0;
- }
-}
-
-int EM_nfaces_selected(void)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
- int count= 0;
-
- for (efa= em->faces.first; efa; efa= efa->next)
- if (efa->f & SELECT)
- count++;
-
- return count;
-}
-
-#if 0
-static int EM_nedges(void)
-{
- EditMesh *em = G.editMesh;
- EditEdge *eed;
- int count= 0;
-
- for (eed= em->edges.first; eed; eed= eed->next) count++;
- return count;
-}
-#endif
-
-int EM_nvertices_selected(void)
-{
- EditMesh *em = G.editMesh;
- EditVert *eve;
- int count= 0;
-
- for (eve= em->verts.first; eve; eve= eve->next)
- if (eve->f & SELECT)
- count++;
-
- return count;
-}
-
-void EM_clear_flag_all(int flag)
-{
- EditMesh *em = G.editMesh;
- EditVert *eve;
- EditEdge *eed;
- EditFace *efa;
-
- for (eve= em->verts.first; eve; eve= eve->next) eve->f &= ~flag;
- for (eed= em->edges.first; eed; eed= eed->next) eed->f &= ~flag;
- for (efa= em->faces.first; efa; efa= efa->next) efa->f &= ~flag;
-
- if(flag & SELECT) BLI_freelistN(&(G.editMesh->selected));
-}
-
-void EM_set_flag_all(int flag)
-{
- EditMesh *em = G.editMesh;
- EditVert *eve;
- EditEdge *eed;
- EditFace *efa;
-
- for (eve= em->verts.first; eve; eve= eve->next) if(eve->h==0) eve->f |= flag;
- for (eed= em->edges.first; eed; eed= eed->next) if(eed->h==0) eed->f |= flag;
- for (efa= em->faces.first; efa; efa= efa->next) if(efa->h==0) efa->f |= flag;
-
-}
-
-/* flush for changes in vertices only */
-void EM_deselect_flush(void)
-{
- EditMesh *em = G.editMesh;
- EditEdge *eed;
- EditFace *efa;
-
- for(eed= em->edges.first; eed; eed= eed->next) {
- if(eed->v1->f & eed->v2->f & SELECT);
- else eed->f &= ~SELECT;
- }
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->v4) {
- if(efa->v1->f & efa->v2->f & efa->v3->f & efa->v4->f & SELECT );
- else efa->f &= ~SELECT;
- }
- else {
- if(efa->v1->f & efa->v2->f & efa->v3->f & SELECT );
- else efa->f &= ~SELECT;
- }
- }
-}
-
-
-/* flush selection to edges & faces */
-
-/* this only based on coherent selected vertices, for example when adding new
- objects. call clear_flag_all() before you select vertices to be sure it ends OK!
-
-*/
-
-void EM_select_flush(void)
-{
- EditMesh *em = G.editMesh;
- EditEdge *eed;
- EditFace *efa;
-
- for(eed= em->edges.first; eed; eed= eed->next) {
- if(eed->v1->f & eed->v2->f & SELECT) eed->f |= SELECT;
- }
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->v4) {
- if(efa->v1->f & efa->v2->f & efa->v3->f & efa->v4->f & SELECT ) efa->f |= SELECT;
- }
- else {
- if(efa->v1->f & efa->v2->f & efa->v3->f & SELECT ) efa->f |= SELECT;
- }
- }
-}
-
-/* when vertices or edges can be selected, also make fgon consistant */
-static void check_fgons_selection()
-{
- EditMesh *em = G.editMesh;
- EditFace *efa, *efan;
- EditEdge *eed;
- ListBase *lbar;
- int sel, desel, index, totfgon= 0;
-
- /* count amount of fgons */
- for(eed= em->edges.first; eed; eed= eed->next)
- if(eed->fgoni>totfgon) totfgon= eed->fgoni;
-
- if(totfgon==0) return;
-
- lbar= MEM_callocN((totfgon+1)*sizeof(ListBase), "listbase array");
-
- /* put all fgons in lbar */
- for(efa= em->faces.first; efa; efa= efan) {
- efan= efa->next;
- index= efa->e1->fgoni;
- if(index==0) index= efa->e2->fgoni;
- if(index==0) index= efa->e3->fgoni;
- if(index==0 && efa->e4) index= efa->e4->fgoni;
- if(index) {
- BLI_remlink(&em->faces, efa);
- BLI_addtail(&lbar[index], efa);
- }
- }
-
- /* now check the fgons */
- for(index=1; index<=totfgon; index++) {
- /* we count on vertices/faces/edges being set OK, so we only have to set ngon itself */
- sel= desel= 0;
- for(efa= lbar[index].first; efa; efa= efa->next) {
- if(efa->e1->fgoni==0) {
- if(efa->e1->f & SELECT) sel++;
- else desel++;
- }
- if(efa->e2->fgoni==0) {
- if(efa->e2->f & SELECT) sel++;
- else desel++;
- }
- if(efa->e3->fgoni==0) {
- if(efa->e3->f & SELECT) sel++;
- else desel++;
- }
- if(efa->e4 && efa->e4->fgoni==0) {
- if(efa->e4->f & SELECT) sel++;
- else desel++;
- }
-
- if(sel && desel) break;
- }
-
- if(sel && desel) sel= 0;
- else if(sel) sel= 1;
- else sel= 0;
-
- /* select/deselect and put back */
- for(efa= lbar[index].first; efa; efa= efa->next) {
- if(sel) efa->f |= SELECT;
- else efa->f &= ~SELECT;
- }
- addlisttolist(&em->faces, &lbar[index]);
- }
-
- MEM_freeN(lbar);
-}
-
-
-/* flush to edges & faces */
-
-/* based on select mode it selects edges/faces
- assumed is that verts/edges/faces were properly selected themselves
- with the calls above
-*/
-
-void EM_selectmode_flush(void)
-{
- EditMesh *em = G.editMesh;
- EditEdge *eed;
- EditFace *efa;
-
- // flush to edges & faces
- if(G.scene->selectmode & SCE_SELECT_VERTEX) {
- for(eed= em->edges.first; eed; eed= eed->next) {
- if(eed->v1->f & eed->v2->f & SELECT) eed->f |= SELECT;
- else eed->f &= ~SELECT;
- }
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->v4) {
- if(efa->v1->f & efa->v2->f & efa->v3->f & efa->v4->f & SELECT) efa->f |= SELECT;
- else efa->f &= ~SELECT;
- }
- else {
- if(efa->v1->f & efa->v2->f & efa->v3->f & SELECT) efa->f |= SELECT;
- else efa->f &= ~SELECT;
- }
- }
- }
- // flush to faces
- else if(G.scene->selectmode & SCE_SELECT_EDGE) {
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->e4) {
- if(efa->e1->f & efa->e2->f & efa->e3->f & efa->e4->f & SELECT) efa->f |= SELECT;
- else efa->f &= ~SELECT;
- }
- else {
- if(efa->e1->f & efa->e2->f & efa->e3->f & SELECT) efa->f |= SELECT;
- else efa->f &= ~SELECT;
- }
- }
- }
- // make sure selected faces have selected edges too, for extrude (hack?)
- else if(G.scene->selectmode & SCE_SELECT_FACE) {
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->f & SELECT) EM_select_face(efa, 1);
- }
- }
- check_fgons_selection();
-
-}
-
-void EM_convertsel(short oldmode, short selectmode)
-{
- EditMesh *em = G.editMesh;
- EditVert *eve;
- EditEdge *eed;
- EditFace *efa;
- /*clear flags*/
- for(eve= em->verts.first; eve; eve= eve->next) eve->f1 = 0;
- for(eed= em->edges.first; eed; eed= eed->next) eed->f1 = 0;
- for(efa= em->faces.first; efa; efa= efa->next) efa->f1 = 0;
-
- /*have to find out what the selectionmode was previously*/
- if(oldmode == SCE_SELECT_VERTEX) {
- if(selectmode == SCE_SELECT_EDGE){
- /*select all edges associated with every selected vertex*/
- for(eed= em->edges.first; eed; eed= eed->next){
- if(eed->v1->f&SELECT) eed->f1 = 1;
- else if(eed->v2->f&SELECT) eed->f1 = 1;
- }
-
- for(eed= em->edges.first; eed; eed= eed->next){
- if(eed->f1 == 1) EM_select_edge(eed,1);
- }
- }
- else if(selectmode == SCE_SELECT_FACE){
- /*select all faces associated with every selected vertex*/
- for(efa= em->faces.first; efa; efa= efa->next){
- if(efa->v1->f&SELECT) efa->f1 = 1;
- else if(efa->v2->f&SELECT) efa->f1 = 1;
- else if(efa->v3->f&SELECT) efa->f1 = 1;
- else{
- if(efa->v4){
- if(efa->v4->f&SELECT) efa->f1 =1;
- }
- }
- }
- for(efa= em->faces.first; efa; efa= efa->next){
- if(efa->f1 == 1) EM_select_face(efa,1);
- }
- }
- }
-
- if(oldmode == SCE_SELECT_EDGE){
- if(selectmode == SCE_SELECT_FACE){
- for(efa= em->faces.first; efa; efa= efa->next){
- if(efa->e1->f&SELECT) efa->f1 = 1;
- else if(efa->e2->f&SELECT) efa->f1 = 1;
- else if(efa->e3->f&SELECT) efa->f1 = 1;
- else if(efa->e4){
- if(efa->e4->f&SELECT) efa->f1 = 1;
- }
- }
- for(efa= em->faces.first; efa; efa= efa->next){
- if(efa->f1 == 1) EM_select_face(efa,1);
- }
- }
- }
-
- check_fgons_selection();
-}
-
-/* when switching select mode, makes sure selection is consistant for editing */
-/* also for paranoia checks to make sure edge or face mode works */
-void EM_selectmode_set(void)
-{
- EditMesh *em = G.editMesh;
- EditVert *eve;
- EditEdge *eed;
- EditFace *efa;
-
- EM_strip_selections(); /*strip EditSelections from em->selected that are not relevant to new mode*/
- if(G.scene->selectmode & SCE_SELECT_VERTEX) {
- /* vertices -> edges -> faces */
- for (eed= em->edges.first; eed; eed= eed->next) eed->f &= ~SELECT;
- for (efa= em->faces.first; efa; efa= efa->next) efa->f &= ~SELECT;
-
- EM_select_flush();
- }
- else if(G.scene->selectmode & SCE_SELECT_EDGE) {
- /* deselect vertices, and select again based on edge select */
- for(eve= em->verts.first; eve; eve= eve->next) eve->f &= ~SELECT;
- for(eed= em->edges.first; eed; eed= eed->next)
- if(eed->f & SELECT) EM_select_edge(eed, 1);
- /* selects faces based on edge status */
- EM_selectmode_flush();
- }
- else if(G.scene->selectmode & SCE_SELECT_FACE) {
- /* deselect eges, and select again based on face select */
- for(eed= em->edges.first; eed; eed= eed->next) EM_select_edge(eed, 0);
-
- for(efa= em->faces.first; efa; efa= efa->next)
- if(efa->f & SELECT) EM_select_face(efa, 1);
- }
-}
-
-/* paranoia check, actually only for entering editmode. rule:
-- vertex hidden, always means edge is hidden too
-- edge hidden, always means face is hidden too
-- face hidden, dont change anything
-*/
-void EM_hide_reset(void)
-{
- EditMesh *em = G.editMesh;
- EditEdge *eed;
- EditFace *efa;
-
- for(eed= em->edges.first; eed; eed= eed->next)
- if(eed->v1->h || eed->v2->h) eed->h |= 1;
-
- for(efa= em->faces.first; efa; efa= efa->next)
- if((efa->e1->h & 1) || (efa->e2->h & 1) || (efa->e3->h & 1) || (efa->e4 && (efa->e4->h & 1)))
- efa->h= 1;
-
-}
-
-void EM_data_interp_from_verts(EditVert *v1, EditVert *v2, EditVert *eve, float fac)
-{
- EditMesh *em= G.editMesh;
- void *src[2];
- float w[2];
-
- if (v1->data && v2->data) {
- src[0]= v1->data;
- src[1]= v2->data;
- w[0] = 1.0f-fac;
- w[1] = fac;
-
- CustomData_em_interp(&em->vdata, src, w, NULL, 2, eve->data);
- }
-}
-
-void EM_data_interp_from_faces(EditFace *efa1, EditFace *efa2, EditFace *efan, int i1, int i2, int i3, int i4)
-{
- EditMesh *em= G.editMesh;
- float w[2][4][4];
- void *src[2];
- int count = (efa2)? 2: 1;
-
- if (efa1->data) {
- /* set weights for copying from corners directly to other corners */
- memset(w, 0, sizeof(w));
-
- w[i1/4][0][i1%4]= 1.0f;
- w[i2/4][1][i2%4]= 1.0f;
- w[i3/4][2][i3%4]= 1.0f;
- if (i4 != -1)
- w[i4/4][3][i4%4]= 1.0f;
-
- src[0]= efa1->data;
- src[1]= (efa2)? efa2->data: NULL;
-
- CustomData_em_interp(&em->fdata, src, NULL, (float*)w, count, efan->data);
- }
-}
-
-EditFace *EM_face_from_faces(EditFace *efa1, EditFace *efa2, int i1, int i2, int i3, int i4)
-{
- EditFace *efan;
- EditVert **v[2];
-
- v[0]= &efa1->v1;
- v[1]= (efa2)? &efa2->v1: NULL;
-
- efan= addfacelist(v[i1/4][i1%4], v[i2/4][i2%4], v[i3/4][i3%4],
- (i4 == -1)? 0: v[i4/4][i4%4], efa1, NULL);
-
- EM_data_interp_from_faces(efa1, efa2, efan, i1, i2, i3, i4);
-
- return efan;
-}
-
-static void update_data_blocks(CustomData *olddata, CustomData *data)
-{
- EditMesh *em= G.editMesh;
- EditFace *efa;
- EditVert *eve;
- void *block;
-
- if (data == &G.editMesh->vdata) {
- for(eve= em->verts.first; eve; eve= eve->next) {
- block = NULL;
- CustomData_em_set_default(data, &block);
- CustomData_em_copy_data(olddata, data, eve->data, &block);
- CustomData_em_free_block(olddata, &eve->data);
- eve->data= block;
- }
- }
- else if (data == &G.editMesh->fdata) {
- for(efa= em->faces.first; efa; efa= efa->next) {
- block = NULL;
- CustomData_em_set_default(data, &block);
- CustomData_em_copy_data(olddata, data, efa->data, &block);
- CustomData_em_free_block(olddata, &efa->data);
- efa->data= block;
- }
- }
-}
-
-void EM_add_data_layer(CustomData *data, int type)
-{
- CustomData olddata;
-
- olddata= *data;
- olddata.layers= (olddata.layers)? MEM_dupallocN(olddata.layers): NULL;
- CustomData_add_layer(data, type, CD_CALLOC, NULL, 0);
-
- update_data_blocks(&olddata, data);
- if (olddata.layers) MEM_freeN(olddata.layers);
-}
-
-void EM_free_data_layer(CustomData *data, int type)
-{
- CustomData olddata;
-
- olddata= *data;
- olddata.layers= (olddata.layers)? MEM_dupallocN(olddata.layers): NULL;
- CustomData_free_layer_active(data, type, 0);
-
- update_data_blocks(&olddata, data);
- if (olddata.layers) MEM_freeN(olddata.layers);
-}
-
-/* ******** EXTRUDE ********* */
-
-static void add_normal_aligned(float *nor, float *add)
-{
- if( INPR(nor, add) < 0.0 )
- VecSubf(nor, nor, add);
- else
- VecAddf(nor, nor, add);
-}
-
-static void set_edge_directions_f2(int val)
-{
- EditMesh *em= G.editMesh;
- EditFace *efa;
- int do_all= 1;
-
- /* edge directions are used for extrude, to detect direction of edges that make new faces */
- /* we have set 'f2' flags in edges that need to get a direction set (e.g. get new face) */
- /* the val argument differs... so we need it as arg */
-
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->f & SELECT) {
- do_all= 0;
- if(efa->e1->f2<val) {
- if(efa->e1->v1 == efa->v1) efa->e1->dir= 0;
- else efa->e1->dir= 1;
- }
- if(efa->e2->f2<val) {
- if(efa->e2->v1 == efa->v2) efa->e2->dir= 0;
- else efa->e2->dir= 1;
- }
- if(efa->e3->f2<val) {
- if(efa->e3->v1 == efa->v3) efa->e3->dir= 0;
- else efa->e3->dir= 1;
- }
- if(efa->e4 && efa->e4->f2<val) {
- if(efa->e4->v1 == efa->v4) efa->e4->dir= 0;
- else efa->e4->dir= 1;
- }
- }
- }
- /* ok, no faces done... then we at least set it for exterior edges */
- if(do_all) {
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->e1->v1 == efa->v1) efa->e1->dir= 0;
- else efa->e1->dir= 1;
- if(efa->e2->v1 == efa->v2) efa->e2->dir= 0;
- else efa->e2->dir= 1;
- if(efa->e3->v1 == efa->v3) efa->e3->dir= 0;
- else efa->e3->dir= 1;
- if(efa->e4) {
- if(efa->e4->v1 == efa->v4) efa->e4->dir= 0;
- else efa->e4->dir= 1;
- }
- }
- }
-}
-
-/* individual face extrude */
-/* will use vertex normals for extrusion directions, so *nor is unaffected */
-short extrudeflag_face_indiv(short flag, float *nor)
-{
- EditMesh *em = G.editMesh;
- EditVert *eve, *v1, *v2, *v3, *v4;
- EditEdge *eed;
- EditFace *efa, *nextfa;
-
- if(G.obedit==0 || get_mesh(G.obedit)==0) return 0;
-
- /* selected edges with 1 or more selected face become faces */
- /* selected faces each makes new faces */
- /* always remove old faces, keeps volumes manifold */
- /* select the new extrusion, deselect old */
-
- /* step 1; init, count faces in edges */
- recalc_editnormals();
-
- for(eve= em->verts.first; eve; eve= eve->next) eve->f1= 0; // new select flag
-
- for(eed= em->edges.first; eed; eed= eed->next) {
- eed->f2= 0; // amount of unselected faces
- }
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->f & SELECT);
- else {
- efa->e1->f2++;
- efa->e2->f2++;
- efa->e3->f2++;
- if(efa->e4) efa->e4->f2++;
- }
- }
-
- /* step 2: make new faces from faces */
- for(efa= em->faces.last; efa; efa= efa->prev) {
- if(efa->f & SELECT) {
- v1= addvertlist(efa->v1->co, efa->v1);
- v2= addvertlist(efa->v2->co, efa->v2);
- v3= addvertlist(efa->v3->co, efa->v3);
-
- v1->f1= v2->f1= v3->f1= 1;
- VECCOPY(v1->no, efa->n);
- VECCOPY(v2->no, efa->n);
- VECCOPY(v3->no, efa->n);
- if(efa->v4) {
- v4= addvertlist(efa->v4->co, efa->v4);
- v4->f1= 1;
- VECCOPY(v4->no, efa->n);
- }
- else v4= NULL;
-
- /* side faces, clockwise */
- addfacelist(efa->v2, v2, v1, efa->v1, efa, NULL);
- addfacelist(efa->v3, v3, v2, efa->v2, efa, NULL);
- if(efa->v4) {
- addfacelist(efa->v4, v4, v3, efa->v3, efa, NULL);
- addfacelist(efa->v1, v1, v4, efa->v4, efa, NULL);
- }
- else {
- addfacelist(efa->v1, v1, v3, efa->v3, efa, NULL);
- }
- /* top face */
- addfacelist(v1, v2, v3, v4, efa, NULL);
- }
- }
-
- /* step 3: remove old faces */
- efa= em->faces.first;
- while(efa) {
- nextfa= efa->next;
- if(efa->f & SELECT) {
- BLI_remlink(&em->faces, efa);
- free_editface(efa);
- }
- efa= nextfa;
- }
-
- /* step 4: redo selection */
- EM_clear_flag_all(SELECT);
-
- for(eve= em->verts.first; eve; eve= eve->next) {
- if(eve->f1) eve->f |= SELECT;
- }
-
- EM_select_flush();
-
- return 'n';
-}
-
-
-/* extrudes individual edges */
-/* nor is filled with constraint vector */
-short extrudeflag_edges_indiv(short flag, float *nor)
-{
- EditMesh *em = G.editMesh;
- EditVert *eve;
- EditEdge *eed;
- EditFace *efa;
-
- for(eve= em->verts.first; eve; eve= eve->next) eve->tmp.v = NULL;
- for(eed= em->edges.first; eed; eed= eed->next) {
- eed->tmp.f = NULL;
- eed->f2= ((eed->f & flag)!=0);
- }
-
- set_edge_directions_f2(2);
-
- /* sample for next loop */
- for(efa= em->faces.first; efa; efa= efa->next) {
- efa->e1->tmp.f = efa;
- efa->e2->tmp.f = efa;
- efa->e3->tmp.f = efa;
- if(efa->e4) efa->e4->tmp.f = efa;
- }
- /* make the faces */
- for(eed= em->edges.first; eed; eed= eed->next) {
- if(eed->f & flag) {
- if(eed->v1->tmp.v == NULL)
- eed->v1->tmp.v = addvertlist(eed->v1->co, eed->v1);
- if(eed->v2->tmp.v == NULL)
- eed->v2->tmp.v = addvertlist(eed->v2->co, eed->v2);
-
- if(eed->dir==1)
- addfacelist(eed->v1, eed->v2,
- eed->v2->tmp.v, eed->v1->tmp.v,
- eed->tmp.f, NULL);
- else
- addfacelist(eed->v2, eed->v1,
- eed->v1->tmp.v, eed->v2->tmp.v,
- eed->tmp.f, NULL);
-
- /* for transform */
- if(eed->tmp.f) {
- efa = eed->tmp.f;
- if (efa->f & SELECT) add_normal_aligned(nor, efa->n);
- }
- }
- }
- Normalize(nor);
-
- /* set correct selection */
- EM_clear_flag_all(SELECT);
- for(eve= em->verts.last; eve; eve= eve->prev) {
- if(eve->tmp.v) {
- eve->tmp.v->f |= flag;
- }
- }
-
- for(eed= em->edges.first; eed; eed= eed->next) {
- if(eed->v1->f & eed->v2->f & flag) eed->f |= flag;
- }
-
- if(nor[0]==0.0 && nor[1]==0.0 && nor[2]==0.0) return 'g'; // g is grab
- return 'n'; // n is for normal constraint
-}
-
-/* extrudes individual vertices */
-short extrudeflag_verts_indiv(short flag, float *nor)
-{
- EditMesh *em = G.editMesh;
- EditVert *eve;
-
- /* make the edges */
- for(eve= em->verts.first; eve; eve= eve->next) {
- if(eve->f & flag) {
- eve->tmp.v = addvertlist(eve->co, eve);
- addedgelist(eve, eve->tmp.v, NULL);
- }
- else eve->tmp.v = NULL;
- }
-
- /* set correct selection */
- EM_clear_flag_all(SELECT);
-
- for(eve= em->verts.last; eve; eve= eve->prev)
- if (eve->tmp.v)
- eve->tmp.v->f |= flag;
-
- return 'g'; // g is grab
-}
-
-
-/* this is actually a recode of extrudeflag(), using proper edge/face select */
-/* hurms, doesnt use 'flag' yet, but its not called by primitive making stuff anyway */
-static short extrudeflag_edge(short flag, float *nor)
-{
- /* all select edges/faces: extrude */
- /* old select is cleared, in new ones it is set */
- EditMesh *em = G.editMesh;
- EditVert *eve, *nextve;
- EditEdge *eed, *nexted;
- EditFace *efa, *nextfa;
- short del_old= 0;
- ModifierData *md;
-
- if(G.obedit==0 || get_mesh(G.obedit)==0) return 0;
-
- md = G.obedit->modifiers.first;
-
- /* selected edges with 0 or 1 selected face become faces */
- /* selected faces generate new faces */
-
- /* if *one* selected face has edge with unselected face; remove old selected faces */
-
- /* if selected edge is not used anymore; remove */
- /* if selected vertex is not used anymore: remove */
-
- /* select the new extrusion, deselect old */
-
-
- /* step 1; init, count faces in edges */
- recalc_editnormals();
-
- for(eve= em->verts.first; eve; eve= eve->next) {
- eve->tmp.v = NULL;
- eve->f1= 0;
- }
-
- for(eed= em->edges.first; eed; eed= eed->next) {
- eed->f1= 0; // amount of unselected faces
- eed->f2= 0; // amount of selected faces
- if(eed->f & SELECT) {
- eed->v1->f1= 1; // we call this 'selected vertex' now
- eed->v2->f1= 1;
- }
- eed->tmp.f = NULL; // here we tuck face pointer, as sample
- }
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->f & SELECT) {
- efa->e1->f2++;
- efa->e2->f2++;
- efa->e3->f2++;
- if(efa->e4) efa->e4->f2++;
-
- // sample for next loop
- efa->e1->tmp.f = efa;
- efa->e2->tmp.f = efa;
- efa->e3->tmp.f = efa;
- if(efa->e4) efa->e4->tmp.f = efa;
- }
- else {
- efa->e1->f1++;
- efa->e2->f1++;
- efa->e3->f1++;
- if(efa->e4) efa->e4->f1++;
- }
- }
-
- /* If a mirror modifier with clipping is on, we need to adjust some
- * of the cases above to handle edges on the line of symmetry.
- */
- for (; md; md=md->next) {
- if (md->type==eModifierType_Mirror) {
- MirrorModifierData *mmd = (MirrorModifierData*) md;
-
- if(mmd->flag & MOD_MIR_CLIPPING) {
- float mtx[4][4];
- if (mmd->mirror_ob) {
- float imtx[4][4];
- Mat4Invert(imtx, mmd->mirror_ob->obmat);
- Mat4MulMat4(mtx, G.obedit->obmat, imtx);
- }
-
- for (eed= em->edges.first; eed; eed= eed->next) {
- if(eed->f2 == 1) {
- float co1[3], co2[3];
-
- VecCopyf(co1, eed->v1->co);
- VecCopyf(co2, eed->v2->co);
-
- if (mmd->mirror_ob) {
- VecMat4MulVecfl(co1, mtx, co1);
- VecMat4MulVecfl(co2, mtx, co2);
- }
-
- if (mmd->flag & MOD_MIR_AXIS_X)
- if ( (fabs(co1[0]) < mmd->tolerance) &&
- (fabs(co2[0]) < mmd->tolerance) )
- ++eed->f2;
-
- if (mmd->flag & MOD_MIR_AXIS_Y)
- if ( (fabs(co1[1]) < mmd->tolerance) &&
- (fabs(co2[1]) < mmd->tolerance) )
- ++eed->f2;
-
- if (mmd->flag & MOD_MIR_AXIS_Z)
- if ( (fabs(co1[2]) < mmd->tolerance) &&
- (fabs(co2[2]) < mmd->tolerance) )
- ++eed->f2;
- }
- }
- }
- }
- }
-
- set_edge_directions_f2(2);
-
- /* step 1.5: if *one* selected face has edge with unselected face; remove old selected faces */
- for(efa= em->faces.last; efa; efa= efa->prev) {
- if(efa->f & SELECT) {
- if(efa->e1->f1 || efa->e2->f1 || efa->e3->f1 || (efa->e4 && efa->e4->f1)) {
- del_old= 1;
- break;
- }
- }
- }
-
- /* step 2: make new faces from edges */
- for(eed= em->edges.last; eed; eed= eed->prev) {
- if(eed->f & SELECT) {
- if(eed->f2<2) {
- if(eed->v1->tmp.v == NULL)
- eed->v1->tmp.v = addvertlist(eed->v1->co, eed->v1);
- if(eed->v2->tmp.v == NULL)
- eed->v2->tmp.v = addvertlist(eed->v2->co, eed->v2);
-
- /* if del_old, the preferred normal direction is exact
- * opposite as for keep old faces
- */
- if(eed->dir!=del_old)
- addfacelist(eed->v1, eed->v2,
- eed->v2->tmp.v, eed->v1->tmp.v,
- eed->tmp.f, NULL);
- else
- addfacelist(eed->v2, eed->v1,
- eed->v1->tmp.v, eed->v2->tmp.v,
- eed->tmp.f, NULL);
- }
- }
- }
-
- /* step 3: make new faces from faces */
- for(efa= em->faces.last; efa; efa= efa->prev) {
- if(efa->f & SELECT) {
- if (efa->v1->tmp.v == NULL)
- efa->v1->tmp.v = addvertlist(efa->v1->co, efa->v1);
- if (efa->v2->tmp.v ==NULL)
- efa->v2->tmp.v = addvertlist(efa->v2->co, efa->v2);
- if (efa->v3->tmp.v ==NULL)
- efa->v3->tmp.v = addvertlist(efa->v3->co, efa->v3);
- if (efa->v4 && (efa->v4->tmp.v == NULL))
- efa->v4->tmp.v = addvertlist(efa->v4->co, efa->v4);
-
- if(del_old==0) { // keep old faces means flipping normal
- if(efa->v4)
- addfacelist(efa->v4->tmp.v, efa->v3->tmp.v,
- efa->v2->tmp.v, efa->v1->tmp.v, efa, efa);
- else
- addfacelist(efa->v3->tmp.v, efa->v2->tmp.v,
- efa->v1->tmp.v, NULL, efa, efa);
- }
- else {
- if(efa->v4)
- addfacelist(efa->v1->tmp.v, efa->v2->tmp.v,
- efa->v3->tmp.v, efa->v4->tmp.v, efa, efa);
- else
- addfacelist(efa->v1->tmp.v, efa->v2->tmp.v,
- efa->v3->tmp.v, NULL, efa, efa);
- }
-
- /* for transform */
- add_normal_aligned(nor, efa->n);
- }
- }
-
- if(del_old) {
- /* step 4: remove old faces, if del_old */
- efa= em->faces.first;
- while(efa) {
- nextfa= efa->next;
- if(efa->f & SELECT) {
- BLI_remlink(&em->faces, efa);
- free_editface(efa);
- }
- efa= nextfa;
- }
-
- /* step 5: remove selected unused edges */
- /* start tagging again */
- for(eed= em->edges.first; eed; eed= eed->next) eed->f1=0;
- for(efa= em->faces.first; efa; efa= efa->next) {
- efa->e1->f1= 1;
- efa->e2->f1= 1;
- efa->e3->f1= 1;
- if(efa->e4) efa->e4->f1= 1;
- }
- /* remove */
- eed= em->edges.first;
- while(eed) {
- nexted= eed->next;
- if(eed->f & SELECT) {
- if(eed->f1==0) {
- remedge(eed);
- free_editedge(eed);
- }
- }
- eed= nexted;
- }
-
- /* step 6: remove selected unused vertices */
- for(eed= em->edges.first; eed; eed= eed->next)
- eed->v1->f1= eed->v2->f1= 0;
-
- eve= em->verts.first;
- while(eve) {
- nextve= eve->next;
- if(eve->f1) {
- // hack... but we need it for step 7, redoing selection
- if(eve->tmp.v) eve->tmp.v->tmp.v= eve->tmp.v;
-
- BLI_remlink(&em->verts, eve);
- free_editvert(eve);
- }
- eve= nextve;
- }
- }
-
- Normalize(nor); // translation normal grab
-
- /* step 7: redo selection */
- EM_clear_flag_all(SELECT);
-
- for(eve= em->verts.first; eve; eve= eve->next) {
- if(eve->tmp.v) {
- eve->tmp.v->f |= SELECT;
- }
- }
-
- EM_select_flush();
-
- if(nor[0]==0.0 && nor[1]==0.0 && nor[2]==0.0) return 'g'; // grab
- return 'n'; // normal constraint
-}
-
-short extrudeflag_vert(short flag, float *nor)
-{
- /* all verts/edges/faces with (f & 'flag'): extrude */
- /* from old verts, 'flag' is cleared, in new ones it is set */
- EditMesh *em = G.editMesh;
- EditVert *eve, *v1, *v2, *v3, *v4, *nextve;
- EditEdge *eed, *e1, *e2, *e3, *e4, *nexted;
- EditFace *efa, *efa2, *nextvl;
- short sel=0, del_old= 0, is_face_sel=0;
- ModifierData *md;
-
- if(G.obedit==0 || get_mesh(G.obedit)==0) return 0;
-
- md = G.obedit->modifiers.first;
-
- /* clear vert flag f1, we use this to detect a loose selected vertice */
- eve= em->verts.first;
- while(eve) {
- if(eve->f & flag) eve->f1= 1;
- else eve->f1= 0;
- eve= eve->next;
- }
- /* clear edges counter flag, if selected we set it at 1 */
- eed= em->edges.first;
- while(eed) {
- if( (eed->v1->f & flag) && (eed->v2->f & flag) ) {
- eed->f2= 1;
- eed->v1->f1= 0;
- eed->v2->f1= 0;
- }
- else eed->f2= 0;
-
- eed->f1= 1; /* this indicates it is an 'old' edge (in this routine we make new ones) */
- eed->tmp.f = NULL; /* used as sample */
-
- eed= eed->next;
- }
-
- /* we set a flag in all selected faces, and increase the associated edge counters */
-
- efa= em->faces.first;
- while(efa) {
- efa->f1= 0;
-
- if(faceselectedAND(efa, flag)) {
- e1= efa->e1;
- e2= efa->e2;
- e3= efa->e3;
- e4= efa->e4;
-
- if(e1->f2 < 3) e1->f2++;
- if(e2->f2 < 3) e2->f2++;
- if(e3->f2 < 3) e3->f2++;
- if(e4 && e4->f2 < 3) e4->f2++;
-
- efa->f1= 1;
- is_face_sel= 1; // for del_old
- }
- else if(faceselectedOR(efa, flag)) {
- e1= efa->e1;
- e2= efa->e2;
- e3= efa->e3;
- e4= efa->e4;
-
- if( (e1->v1->f & flag) && (e1->v2->f & flag) ) e1->f1= 2;
- if( (e2->v1->f & flag) && (e2->v2->f & flag) ) e2->f1= 2;
- if( (e3->v1->f & flag) && (e3->v2->f & flag) ) e3->f1= 2;
- if( e4 && (e4->v1->f & flag) && (e4->v2->f & flag) ) e4->f1= 2;
- }
-
- // sample for next loop
- efa->e1->tmp.f = efa;
- efa->e2->tmp.f = efa;
- efa->e3->tmp.f = efa;
- if(efa->e4) efa->e4->tmp.f = efa;
-
- efa= efa->next;
- }
-
- set_edge_directions_f2(3);
-
- /* the current state now is:
- eve->f1==1: loose selected vertex
-
- eed->f2==0 : edge is not selected, no extrude
- eed->f2==1 : edge selected, is not part of a face, extrude
- eed->f2==2 : edge selected, is part of 1 face, extrude
- eed->f2==3 : edge selected, is part of more faces, no extrude
-
- eed->f1==0: new edge
- eed->f1==1: edge selected, is part of selected face, when eed->f==3: remove
- eed->f1==2: edge selected, part of a partially selected face
-
- efa->f1==1 : duplicate this face
- */
-
- /* If a mirror modifier with clipping is on, we need to adjust some
- * of the cases above to handle edges on the line of symmetry.
- */
- for (; md; md=md->next) {
- if (md->type==eModifierType_Mirror) {
- MirrorModifierData *mmd = (MirrorModifierData*) md;
-
- if(mmd->flag & MOD_MIR_CLIPPING) {
- float mtx[4][4];
- if (mmd->mirror_ob) {
- float imtx[4][4];
- Mat4Invert(imtx, mmd->mirror_ob->obmat);
- Mat4MulMat4(mtx, G.obedit->obmat, imtx);
- }
-
- for (eed= em->edges.first; eed; eed= eed->next) {
- if(eed->f2 == 2) {
- float co1[3], co2[3];
-
- VecCopyf(co1, eed->v1->co);
- VecCopyf(co2, eed->v2->co);
-
- if (mmd->mirror_ob) {
- VecMat4MulVecfl(co1, mtx, co1);
- VecMat4MulVecfl(co2, mtx, co2);
- }
-
- if (mmd->flag & MOD_MIR_AXIS_X)
- if ( (fabs(co1[0]) < mmd->tolerance) &&
- (fabs(co2[0]) < mmd->tolerance) )
- ++eed->f2;
-
- if (mmd->flag & MOD_MIR_AXIS_Y)
- if ( (fabs(co1[1]) < mmd->tolerance) &&
- (fabs(co2[1]) < mmd->tolerance) )
- ++eed->f2;
- if (mmd->flag & MOD_MIR_AXIS_Z)
- if ( (fabs(co1[2]) < mmd->tolerance) &&
- (fabs(co2[2]) < mmd->tolerance) )
- ++eed->f2;
- }
- }
- }
- }
- }
-
- /* copy all selected vertices, */
- /* write pointer to new vert in old struct at eve->tmp.v */
- eve= em->verts.last;
- while(eve) {
- eve->f &= ~128; /* clear, for later test for loose verts */
- if(eve->f & flag) {
- sel= 1;
- v1= addvertlist(0, NULL);
-
- VECCOPY(v1->co, eve->co);
- v1->f= eve->f;
- eve->f-= flag;
- eve->tmp.v = v1;
- }
- else eve->tmp.v = 0;
- eve= eve->prev;
- }
-
- if(sel==0) return 0;
-
- /* all edges with eed->f2==1 or eed->f2==2 become faces */
-
- /* if del_old==1 then extrude is in partial geometry, to keep it manifold.
- verts with f1==0 and (eve->f & 128)==0) are removed
- edges with eed->f2>2 are removed
- faces with efa->f1 are removed
- if del_old==0 the extrude creates a volume.
- */
-
- /* find if we delete old faces */
- if(is_face_sel) {
- for(eed= em->edges.first; eed; eed= eed->next) {
- if( (eed->f2==1 || eed->f2==2) ) {
- if(eed->f1==2) {
- del_old= 1;
- break;
- }
- }
- }
- }
-
- eed= em->edges.last;
- while(eed) {
- nexted= eed->prev;
- if( eed->f2<3) {
- eed->v1->f |= 128; /* = no loose vert! */
- eed->v2->f |= 128;
- }
- if( (eed->f2==1 || eed->f2==2) ) {
-
- /* if del_old, the preferred normal direction is exact opposite as for keep old faces */
- if(eed->dir != del_old)
- efa2 = addfacelist(eed->v1, eed->v2,
- eed->v2->tmp.v, eed->v1->tmp.v,
- eed->tmp.f, NULL);
- else
- efa2 = addfacelist(eed->v2, eed->v1,
- eed->v1->tmp.v, eed->v2->tmp.v,
- eed->tmp.f, NULL);
-
- /* Needs smarter adaption of existing creases.
- * If addedgelist is used, make sure seams are set to 0 on these
- * new edges, since we do not want to add any seams on extrusion.
- */
- efa2->e1->crease= eed->crease;
- efa2->e2->crease= eed->crease;
- efa2->e3->crease= eed->crease;
- if(efa2->e4) efa2->e4->crease= eed->crease;
- }
-
- eed= nexted;
- }
- if(del_old) {
- eed= em->edges.first;
- while(eed) {
- nexted= eed->next;
- if(eed->f2==3 && eed->f1==1) {
- remedge(eed);
- free_editedge(eed);
- }
- eed= nexted;
- }
- }
- /* duplicate faces, if necessary remove old ones */
- efa= em->faces.first;
- while(efa) {
- nextvl= efa->next;
- if(efa->f1 & 1) {
-
- v1 = efa->v1->tmp.v;
- v2 = efa->v2->tmp.v;
- v3 = efa->v3->tmp.v;
- if(efa->v4)
- v4 = efa->v4->tmp.v;
- else
- v4= 0;
-
- /* hmm .. not sure about edges here */
- if(del_old==0) // if we keep old, we flip normal
- efa2= addfacelist(v3, v2, v1, v4, efa, efa);
- else
- efa2= addfacelist(v1, v2, v3, v4, efa, efa);
-
- /* for transform */
- add_normal_aligned(nor, efa->n);
-
- if(del_old) {
- BLI_remlink(&em->faces, efa);
- free_editface(efa);
- }
- }
- efa= nextvl;
- }
-
- Normalize(nor); // for grab
-
- /* for all vertices with eve->tmp.v!=0
- if eve->f1==1: make edge
- if flag!=128 : if del_old==1: remove
- */
- eve= em->verts.last;
- while(eve) {
- nextve= eve->prev;
- if(eve->tmp.v) {
- if(eve->f1==1) addedgelist(eve, eve->tmp.v, NULL);
- else if( (eve->f & 128)==0) {
- if(del_old) {
- BLI_remlink(&em->verts,eve);
- free_editvert(eve);
- eve= NULL;
- }
- }
- }
- if(eve) {
- eve->f &= ~128;
- }
- eve= nextve;
- }
- // since its vertex select mode now, it also deselects higher order
- EM_selectmode_flush();
-
- if(nor[0]==0.0 && nor[1]==0.0 && nor[2]==0.0) return 'g'; // g is grab, for correct undo print
- return 'n';
-}
-
-/* generic extrude */
-short extrudeflag(short flag, float *nor)
-{
- if(G.scene->selectmode & SCE_SELECT_VERTEX)
- return extrudeflag_vert(flag, nor);
- else
- return extrudeflag_edge(flag, nor);
-
-}
-
-void rotateflag(short flag, float *cent, float rotmat[][3])
-{
- /* all verts with (flag & 'flag') rotate */
- EditMesh *em = G.editMesh;
- EditVert *eve;
-
- eve= em->verts.first;
- while(eve) {
- if(eve->f & flag) {
- eve->co[0]-=cent[0];
- eve->co[1]-=cent[1];
- eve->co[2]-=cent[2];
- Mat3MulVecfl(rotmat,eve->co);
- eve->co[0]+=cent[0];
- eve->co[1]+=cent[1];
- eve->co[2]+=cent[2];
- }
- eve= eve->next;
- }
-}
-
-void translateflag(short flag, float *vec)
-{
- /* all verts with (flag & 'flag') translate */
- EditMesh *em = G.editMesh;
- EditVert *eve;
-
- eve= em->verts.first;
- while(eve) {
- if(eve->f & flag) {
- eve->co[0]+=vec[0];
- eve->co[1]+=vec[1];
- eve->co[2]+=vec[2];
- }
- eve= eve->next;
- }
-}
-
-/* helper call for below */
-static EditVert *adduplicate_vertex(EditVert *eve, int flag)
-{
- /* FIXME: copy deformation weight from eve ok here? */
- EditVert *v1= addvertlist(eve->co, eve);
-
- v1->f= eve->f;
- eve->f-= flag;
- eve->f|= 128;
-
- eve->tmp.v = v1;
-
- return v1;
-}
-
-/* old selection has flag 128 set, and flag 'flag' cleared
-new selection has flag 'flag' set */
-void adduplicateflag(int flag)
-{
- EditMesh *em = G.editMesh;
- EditVert *eve, *v1, *v2, *v3, *v4;
- EditEdge *eed, *newed;
- EditFace *efa, *newfa;
-
- EM_clear_flag_all(128);
- EM_selectmode_set(); // paranoia check, selection now is consistant
-
- /* vertices first */
- for(eve= em->verts.last; eve; eve= eve->prev) {
-
- if(eve->f & flag)
- adduplicate_vertex(eve, flag);
- else
- eve->tmp.v = NULL;
- }
-
- /* copy edges, note that vertex selection can be independent of edge */
- for(eed= em->edges.last; eed; eed= eed->prev) {
- if( eed->f & flag ) {
- v1 = eed->v1->tmp.v;
- if(v1==NULL) v1= adduplicate_vertex(eed->v1, flag);
- v2 = eed->v2->tmp.v;
- if(v2==NULL) v2= adduplicate_vertex(eed->v2, flag);
-
- newed= addedgelist(v1, v2, eed);
-
- newed->f= eed->f;
- eed->f -= flag;
- eed->f |= 128;
- }
- }
-
- /* then duplicate faces, again create new vertices if needed */
- for(efa= em->faces.last; efa; efa= efa->prev) {
- if(efa->f & flag) {
- v1 = efa->v1->tmp.v;
- if(v1==NULL) v1= adduplicate_vertex(efa->v1, flag);
- v2 = efa->v2->tmp.v;
- if(v2==NULL) v2= adduplicate_vertex(efa->v2, flag);
- v3 = efa->v3->tmp.v;
- if(v3==NULL) v3= adduplicate_vertex(efa->v3, flag);
- if(efa->v4) {
- v4 = efa->v4->tmp.v;
- if(v4==NULL) v4= adduplicate_vertex(efa->v4, flag);
- }
- else v4= NULL;
-
- newfa= addfacelist(v1, v2, v3, v4, efa, efa);
-
- newfa->f= efa->f;
- efa->f -= flag;
- efa->f |= 128;
- }
- }
-
- EM_fgon_flags(); // redo flags and indices for fgons
-}
-
-void delfaceflag(int flag)
-{
- EditMesh *em = G.editMesh;
- /* delete all faces with 'flag', including loose edges and loose vertices */
- /* this is maybe a bit weird, but this function is used for 'split' and 'separate' */
- /* in remaining vertices/edges 'flag' is cleared */
- EditVert *eve,*nextve;
- EditEdge *eed, *nexted;
- EditFace *efa,*nextvl;
-
- /* to detect loose edges, we put f2 flag on 1 */
- for(eed= em->edges.first; eed; eed= eed->next) {
- if(eed->f & flag) eed->f2= 1;
- else eed->f2= 0;
- }
-
- /* delete faces */
- efa= em->faces.first;
- while(efa) {
- nextvl= efa->next;
- if(efa->f & flag) {
-
- efa->e1->f2= 1;
- efa->e2->f2= 1;
- efa->e3->f2= 1;
- if(efa->e4) {
- efa->e4->f2= 1;
- }
-
- BLI_remlink(&em->faces, efa);
- free_editface(efa);
- }
- efa= nextvl;
- }
-
- /* all remaining faces: make sure we keep the edges */
- for(efa= em->faces.first; efa; efa= efa->next) {
- efa->e1->f2= 0;
- efa->e2->f2= 0;
- efa->e3->f2= 0;
- if(efa->e4) {
- efa->e4->f2= 0;
- }
- }
-
- /* remove tagged edges, and clear remaining ones */
- eed= em->edges.first;
- while(eed) {
- nexted= eed->next;
-
- if(eed->f2==1) {
- remedge(eed);
- free_editedge(eed);
- }
- else {
- eed->f &= ~flag;
- eed->v1->f &= ~flag;
- eed->v2->f &= ~flag;
- }
- eed= nexted;
- }
-
- /* vertices with 'flag' now are the loose ones, and will be removed */
- eve= em->verts.first;
- while(eve) {
- nextve= eve->next;
- if(eve->f & flag) {
- BLI_remlink(&em->verts, eve);
- free_editvert(eve);
- }
- eve= nextve;
- }
-
-}
-
-/* ********************* */
-#if 0
-static int check_vnormal_flip(float *n, float *vnorm)
-{
- float inp;
-
- inp= n[0]*vnorm[0]+n[1]*vnorm[1]+n[2]*vnorm[2];
-
- /* angles 90 degrees: dont flip */
- if(inp> -0.000001) return 0;
-
- return 1;
-}
-#endif
-
-void flipface(EditFace *efa)
-{
- if(efa->v4) {
- SWAP(EditVert *, efa->v2, efa->v4);
- SWAP(EditEdge *, efa->e1, efa->e4);
- SWAP(EditEdge *, efa->e2, efa->e3);
- EM_data_interp_from_faces(efa, NULL, efa, 0, 3, 2, 1);
- }
- else {
- SWAP(EditVert *, efa->v2, efa->v3);
- SWAP(EditEdge *, efa->e1, efa->e3);
- efa->e2->dir= 1-efa->e2->dir;
- EM_data_interp_from_faces(efa, NULL, efa, 0, 2, 1, 3);
- }
-
- if(efa->v4) CalcNormFloat4(efa->v1->co, efa->v2->co, efa->v3->co, efa->v4->co, efa->n);
- else CalcNormFloat(efa->v1->co, efa->v2->co, efa->v3->co, efa->n);
-}
-
-
-void flip_editnormals(void)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
-
- efa= em->faces.first;
- while(efa) {
- if( efa->f & SELECT ){
- flipface(efa);
- }
- efa= efa->next;
- }
-#ifdef WITH_VERSE
- if(G.editMesh->vnode)
- sync_all_versefaces_with_editfaces((VNode*)G.editMesh->vnode);
-#endif
-}
-
-/* does face centers too */
-void recalc_editnormals(void)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
- EditVert *eve;
-
- for(eve= em->verts.first; eve; eve=eve->next) {
- eve->no[0] = eve->no[1] = eve->no[2] = 0.0;
- }
-
- for(efa= em->faces.first; efa; efa=efa->next) {
- if(efa->v4) {
- CalcNormFloat4(efa->v1->co, efa->v2->co, efa->v3->co, efa->v4->co, efa->n);
- CalcCent4f(efa->cent, efa->v1->co, efa->v2->co, efa->v3->co, efa->v4->co);
- VecAddf(efa->v4->no, efa->v4->no, efa->n);
- }
- else {
- CalcNormFloat(efa->v1->co, efa->v2->co, efa->v3->co, efa->n);
- CalcCent3f(efa->cent, efa->v1->co, efa->v2->co, efa->v3->co);
- }
- VecAddf(efa->v1->no, efa->v1->no, efa->n);
- VecAddf(efa->v2->no, efa->v2->no, efa->n);
- VecAddf(efa->v3->no, efa->v3->no, efa->n);
- }
-
- /* following Mesh convention; we use vertex coordinate itself for normal in this case */
- for(eve= em->verts.first; eve; eve=eve->next) {
- if (Normalize(eve->no)==0.0) {
- VECCOPY(eve->no, eve->co);
- Normalize(eve->no);
- }
- }
-}
-
-int compareface(EditFace *vl1, EditFace *vl2)
-{
- EditVert *v1, *v2, *v3, *v4;
-
- if(vl1->v4 && vl2->v4) {
- v1= vl2->v1;
- v2= vl2->v2;
- v3= vl2->v3;
- v4= vl2->v4;
-
- if(vl1->v1==v1 || vl1->v2==v1 || vl1->v3==v1 || vl1->v4==v1) {
- if(vl1->v1==v2 || vl1->v2==v2 || vl1->v3==v2 || vl1->v4==v2) {
- if(vl1->v1==v3 || vl1->v2==v3 || vl1->v3==v3 || vl1->v4==v3) {
- if(vl1->v1==v4 || vl1->v2==v4 || vl1->v3==v4 || vl1->v4==v4) {
- return 1;
- }
- }
- }
- }
- }
- else if(vl1->v4==0 && vl2->v4==0) {
- v1= vl2->v1;
- v2= vl2->v2;
- v3= vl2->v3;
-
- if(vl1->v1==v1 || vl1->v2==v1 || vl1->v3==v1) {
- if(vl1->v1==v2 || vl1->v2==v2 || vl1->v3==v2) {
- if(vl1->v1==v3 || vl1->v2==v3 || vl1->v3==v3) {
- return 1;
- }
- }
- }
- }
-
- return 0;
-}
-
-/* checks for existance, not tria overlapping inside quad */
-EditFace *exist_face(EditVert *v1, EditVert *v2, EditVert *v3, EditVert *v4)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa, efatest;
-
- efatest.v1= v1;
- efatest.v2= v2;
- efatest.v3= v3;
- efatest.v4= v4;
-
- efa= em->faces.first;
- while(efa) {
- if(compareface(&efatest, efa)) return efa;
- efa= efa->next;
- }
- return NULL;
-}
-
-/* evaluate if entire quad is a proper convex quad */
-int convex(float *v1, float *v2, float *v3, float *v4)
-{
- float nor[3], nor1[3], nor2[3], vec[4][2];
-
- /* define projection, do both trias apart, quad is undefined! */
- CalcNormFloat(v1, v2, v3, nor1);
- CalcNormFloat(v1, v3, v4, nor2);
- nor[0]= ABS(nor1[0]) + ABS(nor2[0]);
- nor[1]= ABS(nor1[1]) + ABS(nor2[1]);
- nor[2]= ABS(nor1[2]) + ABS(nor2[2]);
-
- if(nor[2] >= nor[0] && nor[2] >= nor[1]) {
- vec[0][0]= v1[0]; vec[0][1]= v1[1];
- vec[1][0]= v2[0]; vec[1][1]= v2[1];
- vec[2][0]= v3[0]; vec[2][1]= v3[1];
- vec[3][0]= v4[0]; vec[3][1]= v4[1];
- }
- else if(nor[1] >= nor[0] && nor[1]>= nor[2]) {
- vec[0][0]= v1[0]; vec[0][1]= v1[2];
- vec[1][0]= v2[0]; vec[1][1]= v2[2];
- vec[2][0]= v3[0]; vec[2][1]= v3[2];
- vec[3][0]= v4[0]; vec[3][1]= v4[2];
- }
- else {
- vec[0][0]= v1[1]; vec[0][1]= v1[2];
- vec[1][0]= v2[1]; vec[1][1]= v2[2];
- vec[2][0]= v3[1]; vec[2][1]= v3[2];
- vec[3][0]= v4[1]; vec[3][1]= v4[2];
- }
-
- /* linetests, the 2 diagonals have to instersect to be convex */
- if( IsectLL2Df(vec[0], vec[2], vec[1], vec[3]) > 0 ) return 1;
- return 0;
-}
-
-
-/* ********************* Fake Polgon support (FGon) ***************** */
-
-
-/* results in:
- - faces having ->fgonf flag set (also for draw)
- - edges having ->fgoni index set (for select)
-*/
-
-float EM_face_area(EditFace *efa)
-{
- if(efa->v4) return AreaQ3Dfl(efa->v1->co, efa->v2->co, efa->v3->co, efa->v4->co);
- else return AreaT3Dfl(efa->v1->co, efa->v2->co, efa->v3->co);
-}
-
-float EM_face_perimeter(EditFace *efa)
-{
- if(efa->v4) return
- VecLenf(efa->v1->co, efa->v2->co)+
- VecLenf(efa->v2->co, efa->v3->co)+
- VecLenf(efa->v3->co, efa->v4->co)+
- VecLenf(efa->v4->co, efa->v1->co);
-
- else return
- VecLenf(efa->v1->co, efa->v2->co)+
- VecLenf(efa->v2->co, efa->v3->co)+
- VecLenf(efa->v3->co, efa->v1->co);
-}
-
-void EM_fgon_flags(void)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa, *efan, *efamax;
- EditEdge *eed;
- ListBase listb={NULL, NULL};
- float size, maxsize;
- short done, curindex= 1;
-
- // for each face with fgon edge AND not fgon flag set
- for(eed= em->edges.first; eed; eed= eed->next) eed->fgoni= 0; // index
- for(efa= em->faces.first; efa; efa= efa->next) efa->fgonf= 0; // flag
-
- // for speed & simplicity, put fgon face candidates in new listbase
- efa= em->faces.first;
- while(efa) {
- efan= efa->next;
- if( (efa->e1->h & EM_FGON) || (efa->e2->h & EM_FGON) ||
- (efa->e3->h & EM_FGON) || (efa->e4 && (efa->e4->h & EM_FGON)) ) {
- BLI_remlink(&em->faces, efa);
- BLI_addtail(&listb, efa);
- }
- efa= efan;
- }
-
- // find an undone face with fgon edge
- for(efa= listb.first; efa; efa= efa->next) {
- if(efa->fgonf==0) {
-
- // init this face
- efa->fgonf= EM_FGON;
- if(efa->e1->h & EM_FGON) efa->e1->fgoni= curindex;
- if(efa->e2->h & EM_FGON) efa->e2->fgoni= curindex;
- if(efa->e3->h & EM_FGON) efa->e3->fgoni= curindex;
- if(efa->e4 && (efa->e4->h & EM_FGON)) efa->e4->fgoni= curindex;
-
- // we search for largest face, to give facedot drawing rights
- maxsize= EM_face_area(efa);
- efamax= efa;
-
- // now flush curendex over edges and set faceflags
- done= 1;
- while(done==1) {
- done= 0;
-
- for(efan= listb.first; efan; efan= efan->next) {
- if(efan->fgonf==0) {
- // if one if its edges has index set, do other too
- if( (efan->e1->fgoni==curindex) || (efan->e2->fgoni==curindex) ||
- (efan->e3->fgoni==curindex) || (efan->e4 && (efan->e4->fgoni==curindex)) ) {
-
- efan->fgonf= EM_FGON;
- if(efan->e1->h & EM_FGON) efan->e1->fgoni= curindex;
- if(efan->e2->h & EM_FGON) efan->e2->fgoni= curindex;
- if(efan->e3->h & EM_FGON) efan->e3->fgoni= curindex;
- if(efan->e4 && (efan->e4->h & EM_FGON)) efan->e4->fgoni= curindex;
-
- size= EM_face_area(efan);
- if(size>maxsize) {
- efamax= efan;
- maxsize= size;
- }
- done= 1;
- }
- }
- }
- }
-
- efamax->fgonf |= EM_FGON_DRAW;
- curindex++;
-
- }
- }
-
- // put fgon face candidates back in listbase
- efa= listb.first;
- while(efa) {
- efan= efa->next;
- BLI_remlink(&listb, efa);
- BLI_addtail(&em->faces, efa);
- efa= efan;
- }
-
- // remove fgon flags when edge not in fgon (anymore)
- for(eed= em->edges.first; eed; eed= eed->next) {
- if(eed->fgoni==0) eed->h &= ~EM_FGON;
- }
-
-}
-
-/* editmesh vertmap, copied from intern.mesh.c
- * if do_face_idx_array is 0 it means we need to run it as well as freeing
- * */
-
-UvVertMap *make_uv_vert_map_EM(int selected, int do_face_idx_array, float *limit)
-{
- EditMesh *em = G.editMesh;
- EditVert *ev;
- EditFace *efa;
- int totverts;
-
- /* vars from original func */
- UvVertMap *vmap;
- UvMapVert *buf;
- MTFace *tf;
- unsigned int a;
- int i, totuv, nverts;
-
- if (do_face_idx_array)
- EM_init_index_arrays(0, 0, 1);
-
- /* we need the vert */
- for (ev= em->verts.first, totverts=0; ev; ev= ev->next, totverts++) {
- ev->tmp.l = totverts;
- }
-
- totuv = 0;
-
- /* generate UvMapVert array */
- for (efa= em->faces.first; efa; efa= efa->next)
- if(!selected || ((!efa->h) && (efa->f & SELECT)))
- totuv += (efa->v4)? 4: 3;
-
- if(totuv==0)
- return NULL;
-
- vmap= (UvVertMap*)MEM_mallocN(sizeof(*vmap), "UvVertMap");
- if (!vmap)
- return NULL;
-
- vmap->vert= (UvMapVert**)MEM_callocN(sizeof(*vmap->vert)*totverts, "UvMapVert*");
- buf= vmap->buf= (UvMapVert*)MEM_mallocN(sizeof(*vmap->buf)*totuv, "UvMapVert");
-
- if (!vmap->vert || !vmap->buf) {
- free_uv_vert_map(vmap);
- return NULL;
- }
-
- for (a=0, efa= em->faces.first; efa; a++, efa= efa->next) {
- if(!selected || ((!efa->h) && (efa->f & SELECT))) {
- nverts= (efa->v4)? 4: 3;
-
- for(i=0; i<nverts; i++) {
- buf->tfindex= i;
- buf->f= a;
- buf->separate = 0;
-
- buf->next= vmap->vert[(*(&efa->v1 + i))->tmp.l];
- vmap->vert[(*(&efa->v1 + i))->tmp.l]= buf;
-
- buf++;
- }
- }
- }
-
- /* sort individual uvs for each vert */
- for(a=0, ev=em->verts.first; ev; a++, ev= ev->next) {
- UvMapVert *newvlist= NULL, *vlist=vmap->vert[a];
- UvMapVert *iterv, *v, *lastv, *next;
- float *uv, *uv2, uvdiff[2];
-
- while(vlist) {
- v= vlist;
- vlist= vlist->next;
- v->next= newvlist;
- newvlist= v;
-
- efa = EM_get_face_for_index(v->f);
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- uv = tf->uv[v->tfindex];
-
- lastv= NULL;
- iterv= vlist;
-
- while(iterv) {
- next= iterv->next;
- efa = EM_get_face_for_index(iterv->f);
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- uv2 = tf->uv[iterv->tfindex];
-
- Vec2Subf(uvdiff, uv2, uv);
-
- if(fabs(uv[0]-uv2[0]) < limit[0] && fabs(uv[1]-uv2[1]) < limit[1]) {
- if(lastv) lastv->next= next;
- else vlist= next;
- iterv->next= newvlist;
- newvlist= iterv;
- }
- else
- lastv=iterv;
-
- iterv= next;
- }
-
- newvlist->separate = 1;
- }
-
- vmap->vert[a]= newvlist;
- }
-
- if (do_face_idx_array)
- EM_free_index_arrays();
-
- return vmap;
-}
-
-UvMapVert *get_uv_map_vert_EM(UvVertMap *vmap, unsigned int v)
-{
- return vmap->vert[v];
-}
-
-void free_uv_vert_map_EM(UvVertMap *vmap)
-{
- if (vmap) {
- if (vmap->vert) MEM_freeN(vmap->vert);
- if (vmap->buf) MEM_freeN(vmap->buf);
- MEM_freeN(vmap);
- }
-}
-
diff --git a/source/blender/src/editmesh_loop.c b/source/blender/src/editmesh_loop.c
deleted file mode 100644
index c44a0607464..00000000000
--- a/source/blender/src/editmesh_loop.c
+++ /dev/null
@@ -1,954 +0,0 @@
-/**
- * $Id:
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2004 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-/*
-
-editmesh_loop: tools with own drawing subloops, select, knife, subdiv
-
-*/
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#include "MEM_guardedalloc.h"
-
-
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_view3d_types.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_editVert.h"
-#include "BLI_ghash.h"
-
-#include "BKE_depsgraph.h"
-#include "BKE_displist.h"
-#include "BKE_global.h"
-#include "BKE_library.h"
-#include "BKE_mesh.h"
-#include "BKE_object.h"
-#include "BKE_utildefines.h"
-
-#ifdef WITH_VERSE
-#include "BKE_verse.h"
-#endif
-
-#include "BIF_cursors.h"
-#include "BIF_editmesh.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-#include "BIF_graphics.h"
-#include "BIF_interface.h"
-#include "BIF_mywindow.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-
-#ifdef WITH_VERSE
-#include "BIF_verse.h"
-#endif
-
-#include "BSE_view.h"
-#include "BSE_edit.h"
-#include "BSE_drawview.h"
-
-#include "BDR_drawobject.h"
-#include "BDR_editobject.h"
-#include "PIL_time.h"
-
-#include "mydevice.h"
-#include "blendef.h"
-
-#include "editmesh.h"
-
-/* next 2 includes for knife tool... shouldnt be! (ton) */
-#include "GHOST_C-api.h"
-#include "winlay.h"
-
-
-/* New LoopCut */
-static void edgering_sel(EditEdge *startedge, int select, int previewlines)
-{
- EditMesh *em = G.editMesh;
- EditEdge *eed;
- EditFace *efa;
- EditVert *v[2][2];
- float co[2][3];
- int looking= 1,i;
-
- /* in eed->f1 we put the valence (amount of faces in edge) */
- /* in eed->f2 we put tagged flag as correct loop */
- /* in efa->f1 we put tagged flag as correct to select */
-
- for(eed= em->edges.first; eed; eed= eed->next) {
- eed->f1= 0;
- eed->f2= 0;
- }
- for(efa= em->faces.first; efa; efa= efa->next) {
- efa->f1= 0;
- if(efa->h==0) {
- efa->e1->f1++;
- efa->e2->f1++;
- efa->e3->f1++;
- if(efa->e4) efa->e4->f1++;
- }
- }
-
- // tag startedge OK
- startedge->f2= 1;
-
- while(looking) {
- looking= 0;
-
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->e4 && efa->f1==0 && efa->h == 0) { // not done quad
- if(efa->e1->f1<=2 && efa->e2->f1<=2 && efa->e3->f1<=2 && efa->e4->f1<=2) { // valence ok
-
- // if edge tagged, select opposing edge and mark face ok
- if(efa->e1->f2) {
- efa->e3->f2= 1;
- efa->f1= 1;
- looking= 1;
- }
- else if(efa->e2->f2) {
- efa->e4->f2= 1;
- efa->f1= 1;
- looking= 1;
- }
- if(efa->e3->f2) {
- efa->e1->f2= 1;
- efa->f1= 1;
- looking= 1;
- }
- if(efa->e4->f2) {
- efa->e2->f2= 1;
- efa->f1= 1;
- looking= 1;
- }
- }
- }
- }
- }
-
- if(previewlines > 0 && select == 0){
- persp(PERSP_VIEW);
- glPushMatrix();
- mymultmatrix(G.obedit->obmat);
- //glColor3ub(0, 255, 255);
- //glBegin(GL_LINES);
- //glVertex3f(nearest->v1->co[0],nearest->v1->co[1],nearest->v1->co[2]);
- //glVertex3f(nearest->v2->co[0],nearest->v2->co[1],nearest->v2->co[2]);
- //glEnd();
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->v4 == NULL) { continue; }
- if(efa->h == 0){
- if(efa->e1->f2 == 1){
- if(efa->e1->h == 1 || efa->e3->h == 1 )
- continue;
-
- v[0][0] = efa->v1;
- v[0][1] = efa->v2;
- v[1][0] = efa->v4;
- v[1][1] = efa->v3;
- } else if(efa->e2->f2 == 1){
- if(efa->e2->h == 1 || efa->e4->h == 1)
- continue;
- v[0][0] = efa->v2;
- v[0][1] = efa->v3;
- v[1][0] = efa->v1;
- v[1][1] = efa->v4;
- } else { continue; }
-
- for(i=1;i<=previewlines;i++){
- co[0][0] = (v[0][1]->co[0] - v[0][0]->co[0])*(i/((float)previewlines+1))+v[0][0]->co[0];
- co[0][1] = (v[0][1]->co[1] - v[0][0]->co[1])*(i/((float)previewlines+1))+v[0][0]->co[1];
- co[0][2] = (v[0][1]->co[2] - v[0][0]->co[2])*(i/((float)previewlines+1))+v[0][0]->co[2];
-
- co[1][0] = (v[1][1]->co[0] - v[1][0]->co[0])*(i/((float)previewlines+1))+v[1][0]->co[0];
- co[1][1] = (v[1][1]->co[1] - v[1][0]->co[1])*(i/((float)previewlines+1))+v[1][0]->co[1];
- co[1][2] = (v[1][1]->co[2] - v[1][0]->co[2])*(i/((float)previewlines+1))+v[1][0]->co[2];
- glColor3ub(255, 0, 255);
- glBegin(GL_LINES);
- glVertex3f(co[0][0],co[0][1],co[0][2]);
- glVertex3f(co[1][0],co[1][1],co[1][2]);
- glEnd();
- }
- }
- }
- glPopMatrix();
- } else {
-
- /* (de)select the edges */
- for(eed= em->edges.first; eed; eed= eed->next) {
- if(eed->f2) EM_select_edge(eed, select);
- }
- }
-}
-void CutEdgeloop(int numcuts)
-{
- EditMesh *em = G.editMesh;
- EditEdge *nearest=NULL, *eed;
- float fac;
- int keys = 0, holdnum=0, selectmode, dist;
- short mvalo[2] = {0,0}, mval[2];
- short event, val, choosing=1, cancel=0, cuthalf = 0, smooth=0;
- short hasHidden = 0;
- char msg[128];
-
- selectmode = G.scene->selectmode;
-
- if(G.scene->selectmode & SCE_SELECT_FACE){
- G.scene->selectmode = SCE_SELECT_EDGE;
- EM_selectmode_set();
- }
-
-
- BIF_undo_push("Loopcut Begin");
- while(choosing && !cancel){
- getmouseco_areawin(mval);
- if (mval[0] != mvalo[0] || mval[1] != mvalo[1]) {
- mvalo[0] = mval[0];
- mvalo[1] = mval[1];
- dist= 50;
- nearest = findnearestedge(&dist); // returns actual distance in dist
- scrarea_do_windraw(curarea); // after findnearestedge, backbuf!
-
- sprintf(msg,"Number of Cuts: %d",numcuts);
- if(smooth){
- sprintf(msg,"%s (S)mooth: on",msg);
- } else {
- sprintf(msg,"%s (S)mooth: off",msg);
- }
-
- headerprint(msg);
- /* Need to figure preview */
- if(nearest){
- edgering_sel(nearest, 0, numcuts);
- }
- screen_swapbuffers();
-
- /* backbuffer refresh for non-apples (no aux) */
-#ifndef __APPLE__
- if(G.vd->drawtype>OB_WIRE && (G.vd->flag & V3D_ZBUF_SELECT)) {
- backdrawview3d(0);
- }
-#endif
- }
- else PIL_sleep_ms(10); // idle
-
-
- while(qtest())
- {
- val=0;
- event= extern_qread(&val);
- if(val && (event == MOUSEX || event == MOUSEY)){ ; }
- else if(val && ((event==LEFTMOUSE || event==RETKEY) || (event == MIDDLEMOUSE || event==PADENTER)))
- {
- if(event == MIDDLEMOUSE){
- cuthalf = 1;
- }
- if (nearest==NULL)
- cancel = 1;
- choosing=0;
- mvalo[0] = -1;
- }
- else if(val && (event==ESCKEY || event==RIGHTMOUSE ))
- {
- choosing=0;
- cancel = 1;
- mvalo[0] = -1;
- }
- else if(val && (event==PADPLUSKEY || event==WHEELUPMOUSE))
- {
- numcuts++;
- mvalo[0] = -1;
- }
- else if(val && (event==PADMINUS || event==WHEELDOWNMOUSE))
- {
- if(numcuts > 1){
- numcuts--;
- mvalo[0] = -1;
- }
- }
- else if(val && event==SKEY)
- {
- if(smooth){smooth=0;}
- else { smooth=1; }
- mvalo[0] = -1;
- }
-
- else if(val){
- holdnum = -1;
- switch(event){
- case PAD9:
- case NINEKEY:
- holdnum = 9; break;
- case PAD8:
- case EIGHTKEY:
- holdnum = 8;break;
- case PAD7:
- case SEVENKEY:
- holdnum = 7;break;
- case PAD6:
- case SIXKEY:
- holdnum = 6;break;
- case PAD5:
- case FIVEKEY:
- holdnum = 5;break;
- case PAD4:
- case FOURKEY:
- holdnum = 4;break;
- case PAD3:
- case THREEKEY:
- holdnum = 3; break;
- case PAD2:
- case TWOKEY:
- holdnum = 2;break;
- case PAD1:
- case ONEKEY:
- holdnum = 1; break;
- case PAD0:
- case ZEROKEY:
- holdnum = 0;break;
- case BACKSPACEKEY:
- holdnum = -2;break;
- }
- if(holdnum >= 0 && numcuts*10 < 130){
- if(keys == 0){ // first level numeric entry
- if(holdnum > 0){
- numcuts = holdnum;
- keys++;
- }
- } else if(keys > 0){//highrt level numeric entry
- numcuts *= 10;
- numcuts += holdnum;
- keys++;
- }
- } else if (holdnum == -2){// backspace
- if (keys > 1){
- numcuts /= 10;
- keys--;
- } else {
- numcuts=1;
- keys = 0;
- }
- }
- mvalo[0] = -1;
- break;
- } // End Numeric Entry
- } //End while(qtest())
- } // End Choosing
- scrarea_queue_winredraw(curarea);
-
- if(cancel){
- return;
- }
- /* clean selection */
- for(eed=em->edges.first; eed; eed = eed->next){
- EM_select_edge(eed,0);
- }
- /* select edge ring */
- edgering_sel(nearest, 1, 0);
-
- /* now cut the loops */
- if(smooth){
- fac= 1.0f;
- if(fbutton(&fac, 0.0f, 5.0f, 10, 10, "Smooth:")==0) return;
- fac= 0.292f*fac;
- esubdivideflag(SELECT,fac,B_SMOOTH,numcuts,SUBDIV_SELECT_LOOPCUT);
- } else {
- esubdivideflag(SELECT,0,0,numcuts,SUBDIV_SELECT_LOOPCUT);
- }
- /* if this was a single cut, enter edgeslide mode */
- if(numcuts == 1 && hasHidden == 0){
- if(cuthalf)
- EdgeSlide(1,0.0);
- else {
- if(EdgeSlide(0,0.0) == -1){
- BIF_undo();
- }
- }
- }
-
- if(G.scene->selectmode != selectmode){
- G.scene->selectmode = selectmode;
- EM_selectmode_set();
- }
-
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-#ifdef WITH_VERSE
- if(G.editMesh->vnode)
- sync_all_verseverts_with_editverts((VNode*)G.editMesh->vnode);
-#endif
- scrarea_queue_headredraw(curarea);
- scrarea_queue_winredraw(curarea);
- return;
-}
-
-
-/* *************** LOOP SELECT ************* */
-#if 0
-static short edgeFaces(EditEdge *e)
-{
- EditMesh *em = G.editMesh;
- EditFace *search=NULL;
- short count = 0;
-
- search = em->faces.first;
- while(search){
- if((search->e1 == e || search->e2 == e) || (search->e3 == e || search->e4 == e))
- count++;
- search = search->next;
- }
- return count;
-}
-#endif
-
-/* this utility function checks to see if 2 edit edges share a face,
- returns 1 if they do
- returns 0 if they do not, or if the function is passed the same edge 2 times
-*/
-short sharesFace(EditEdge* e1, EditEdge* e2)
-{
- EditMesh *em = G.editMesh;
- EditFace *search=NULL;
-
- search = em->faces.first;
- if (e1 == e2){
- return 0 ;
- }
- while(search){
- if(
- ((search->e1 == e1 || search->e2 == e1) || (search->e3 == e1 || search->e4 == e1)) &&
- ((search->e1 == e2 || search->e2 == e2) || (search->e3 == e2 || search->e4 == e2))
- ) {
- return 1;
- }
- search = search->next;
- }
- return 0;
-}
-
-
-/* ***************** TRAIL ************************
-
-Read a trail of mouse coords and return them as an array of CutCurve structs
-len returns number of mouse coords read before commiting with RETKEY
-It is up to the caller to free the block when done with it,
-
-XXX Is only used here, so local inside this file (ton)
- */
-
-#define TRAIL_POLYLINE 1 /* For future use, They don't do anything yet */
-#define TRAIL_FREEHAND 2
-#define TRAIL_MIXED 3 /* (1|2) */
-#define TRAIL_AUTO 4
-#define TRAIL_MIDPOINTS 8
-
-typedef struct CutCurve {
- float x;
- float y;
-} CutCurve;
-
-static CutCurve *get_mouse_trail(int *len, char mode, char cutmode, struct GHash *gh)
-{
- CutCurve *curve,*temp;
- EditVert *snapvert;
- float *scr, mval[2], lastx=0, lasty=0;
- int i=0, j, blocks=1, lasti=0;
- int dist, tolerance;
- short event, val, qual, vsnap=0, ldown=0, restart=0, rubberband=0;
- short mval1[2], lockaxis=0, lockx=0, locky=0, oldmode;
-
- *len=0;
- tolerance = 75;
-
- curve=(CutCurve *)MEM_callocN(1024*sizeof(CutCurve), "MouseTrail");
-
- if (!curve) {
- printf("failed to allocate memory in get_mouse_trail()\n");
- return(NULL);
- }
- mywinset(curarea->win);
-
-
- if(cutmode != KNIFE_MULTICUT){
- /*redraw backbuffer if in zbuffered selection mode but not vertex selection*/
- if(G.vd->drawtype>OB_WIRE && (G.vd->flag & V3D_ZBUF_SELECT)) {
- oldmode = G.scene->selectmode;
- G.scene->selectmode = SCE_SELECT_VERTEX;
- backdrawview3d(0);
- G.scene->selectmode = oldmode;
- }
- glDrawBuffer(GL_FRONT);
- headerprint("(LMB) draw, (Ctrl held while drawing) snap to vertex, (MMB) constrain to x/y screen axis, (Enter) cut "
- "(with Ctrl to select cut line), (Esc) cancel");
- }
- else{
- glDrawBuffer(GL_FRONT);
- headerprint("(LMB) draw, (MMB) constrain to x/y screen axis, (Enter) cut (with Ctrl to select cut line), (Esc) cancel");
- }
-
- persp(PERSP_WIN);
-
- glColor3ub(255, 0, 255);
-
- while(TRUE) {
-
- event=extern_qread(&val); /* Enter or RMB indicates finish */
- if(val) {
- if(event==RETKEY || event==PADENTER) break;
- }
-
- if( event==ESCKEY || event==RIGHTMOUSE ) {
- if (curve) MEM_freeN(curve);
- *len=0;
- bglFlush();
- glDrawBuffer(GL_BACK);
- return(NULL);
- break;
- }
-
- if (rubberband) { /* rubberband mode, undraw last rubberband */
- glLineWidth(2.0);
- sdrawXORline((int)curve[i-1].x, (int)curve[i-1].y,(int)mval[0],(int) mval[1]);
- glLineWidth(1.0);
- glFlush();
- rubberband=0;
- }
-
- /*handle vsnap*/
- vsnap = 0;
- if(cutmode != KNIFE_MULTICUT){
- qual = get_qual();
- if(qual & LR_CTRLKEY) vsnap = 1;
- }
-
- if(vsnap){
- persp(PERSP_VIEW);
- dist = tolerance;
- snapvert = findnearestvert(&dist, SELECT, 0);
- glColor3ub(255, 0, 255);
- glDrawBuffer(GL_FRONT);
- persp(PERSP_WIN);
- if(snapvert && (dist < tolerance)){
- scr = BLI_ghash_lookup(gh, snapvert);
- mval[0] = scr[0];
- mval[1] = scr[1];
- }
- else{
- getmouseco_areawin(mval1);
- mval[0] = (float)mval1[0];
- mval[1] = (float)mval1[1];
- }
- }
-
- else{
- getmouseco_areawin(mval1);
- mval[0] = (float)mval1[0];
- mval[1] = (float)mval1[1];
- }
-
-
- if (lockaxis==1) mval[1]=locky;
- if (lockaxis==2) mval[0]=lockx;
-
- if ( ((i==0) || (mval[0]!=curve[i-1].x) || (mval[1]!=curve[i-1].y))
- && (get_mbut() & L_MOUSE) ){ /* record changes only, if LMB down */
-
- lastx=curve[i].x=mval[0];
- lasty=curve[i].y=mval[1];
-
- lockaxis=0;
-
- i++;
-
- ldown=1;
- if (restart) {
- for(j=1;j<i;j++) sdrawXORline((int)curve[j-1].x, (int)curve[j-1].y, (int)curve[j].x, (int)curve[j].y);
- if (rubberband) sdrawXORline((int)curve[j].x, (int)curve[j].y, (int)mval[0], (int)mval[1]);
- glFlush();
- rubberband=0;
- lasti=i=0;
- restart=0;
- ldown=0;
- }
- }
-
- if ((event==MIDDLEMOUSE)&&(get_mbut()&M_MOUSE)&&(i)){/*MMB Down*/
- /*determine which axis to lock to, or clear if locked */
- if (lockaxis) lockaxis=0;
- else if (abs(curve[i-1].x-mval[0]) > abs(curve[i-1].y-mval[1])) lockaxis=1;
- else lockaxis=2;
-
- if (lockaxis) {
- lockx=lastx;
- locky=lasty;
- }
- }
-
- if ((i>1)&&(i!=lasti)) { /*Draw recorded part of curve */
- sdrawline((int)curve[i-2].x, (int)curve[i-2].y, (int)curve[i-1].x, (int)curve[i-1].y);
- glFlush();
- }
-
- if ((i==lasti)&&(i>0)) { /*Draw rubberband */
- glLineWidth(2.0);
- sdrawXORline((int)curve[i-1].x, (int)curve[i-1].y,(int)mval[0], (int)mval[1]);
- glLineWidth(1.0);
- glFlush();
- rubberband=1;
- }
- lasti=i;
-
- if (i>=blocks*1024) { /* reallocate data if out of room */
- temp=curve;
- curve=(CutCurve *)MEM_callocN((blocks+1)*1024*sizeof(CutCurve), "MouseTrail");
- if (!curve) {
- printf("failed to re-allocate memory in get_mouse_trail()\n");
- return(NULL);
- }
- memcpy(curve, temp, blocks*1024*sizeof(CutCurve));
- blocks++;
- MEM_freeN(temp);
- }
- }
-
- bglFlush();
- glDrawBuffer(GL_BACK);
- persp(PERSP_VIEW);
-
- *len=i;
-
- return(curve);
-}
-
-
-
-
-/* ******************************************************************** */
-/* Knife Subdivide Tool. Subdivides edges intersected by a mouse trail
- drawn by user.
-
- Currently mapped to KKey when in MeshEdit mode.
- Usage:
- Hit Shift K, Select Centers or Exact
- Hold LMB down to draw path, hit RETKEY.
- ESC cancels as expected.
-
- Contributed by Robert Wenzlaff (Det. Thorn).
-*/
-
-/* prototype */
-static float seg_intersect(struct EditEdge * e, CutCurve *c, int len, char mode, struct GHash *gh);
-
-void KnifeSubdivide(char mode)
-{
- EditMesh *em = G.editMesh;
- EditEdge *eed;
- EditVert *eve;
- CutCurve *curve;
- Window *win;
-
- struct GHash *gh;
- int oldcursor, len=0;
- float isect=0.0;
- short numcuts=1;
- float *scr, co[4];
-
- if (G.obedit==0) return;
-
- if (EM_nvertices_selected() < 2) {
- error("No edges are selected to operate on");
- return;
- }
-
- if (mode==KNIFE_PROMPT) {
- short val= pupmenu("Cut Type %t|Exact Line%x1|Midpoints%x2|Multicut%x3");
- if(val<1) return;
- mode = val; // warning, mode is char, pupmenu returns -1 with ESC
- }
-
- if(mode == KNIFE_MULTICUT) {
- if(button(&numcuts, 2, 128, "Number of Cuts:")==0) return;
- }
-
- /* Set a knife cursor here */
- oldcursor=get_cursor();
-
- win=winlay_get_active_window();
-
- SetBlenderCursor(BC_KNIFECURSOR);
-
- for(eed=em->edges.first; eed; eed= eed->next) eed->tmp.fp = 0.0; /*store percentage of edge cut for KNIFE_EXACT here.*/
-
- /*the floating point coordinates of verts in screen space will be stored in a hash table according to the vertices pointer*/
- gh = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp);
- for(eve=em->verts.first; eve; eve=eve->next){
- scr = MEM_mallocN(sizeof(float)*2, "Vertex Screen Coordinates");
- VECCOPY(co, eve->co);
- co[3]= 1.0;
- Mat4MulVec4fl(G.obedit->obmat, co);
- project_float(co,scr);
- BLI_ghash_insert(gh, eve, scr);
- eve->f1 = 0; /*store vertex intersection flag here*/
-
- }
-
- curve=get_mouse_trail(&len, TRAIL_MIXED, mode, gh);
-
- if (curve && len && mode){
- eed= em->edges.first;
- while(eed) {
- if( eed->v1->f & eed->v2->f & SELECT ){ // NOTE: uses vertex select, subdiv doesnt do edges yet
- isect=seg_intersect(eed, curve, len, mode, gh);
- if (isect) eed->f2= 1;
- else eed->f2=0;
- eed->tmp.fp= isect;
- //printf("isect=%i\n", isect);
- }
- else {
- eed->f2=0;
- eed->f1=0;
- }
- eed= eed->next;
- }
-
- if (mode==KNIFE_EXACT) esubdivideflag(1, 0, B_KNIFE|B_PERCENTSUBD,1,SUBDIV_SELECT_ORIG);
- else if (mode==KNIFE_MIDPOINT) esubdivideflag(1, 0, B_KNIFE,1,SUBDIV_SELECT_ORIG);
- else if (mode==KNIFE_MULTICUT) esubdivideflag(1, 0, B_KNIFE,numcuts,SUBDIV_SELECT_ORIG);
-
- eed=em->edges.first;
- while(eed){
- eed->f2=0;
- eed->f1=0;
- eed=eed->next;
- }
- }
- /* Return to old cursor and flags...*/
-
- addqueue(curarea->win, REDRAW, 0);
- window_set_cursor(win, oldcursor);
- BLI_ghash_free(gh, NULL, (GHashValFreeFP)MEM_freeN);
- if (curve) MEM_freeN(curve);
-
-#ifdef WITH_VERSE
- if(G.editMesh->vnode)
- sync_all_versefaces_with_editfaces((VNode*)G.editMesh->vnode);
-#endif
-
- BIF_undo_push("Knife");
-}
-
-/* seg_intersect() Determines if and where a mouse trail intersects an EditEdge */
-
-static float seg_intersect(EditEdge *e, CutCurve *c, int len, char mode, struct GHash *gh)
-{
-#define MAXSLOPE 100000
- float x11, y11, x12=0, y12=0, x2max, x2min, y2max;
- float y2min, dist, lastdist=0, xdiff2, xdiff1;
- float m1, b1, m2, b2, x21, x22, y21, y22, xi;
- float yi, x1min, x1max, y1max, y1min, perc=0;
- float *scr;
- float threshold;
- int i;
-
- //threshold = 0.000001; /*tolerance for vertex intersection*/
- threshold = G.scene->toolsettings->select_thresh / 100;
-
- /* Get screen coords of verts */
- scr = BLI_ghash_lookup(gh, e->v1);
- x21=scr[0];
- y21=scr[1];
-
- scr = BLI_ghash_lookup(gh, e->v2);
- x22=scr[0];
- y22=scr[1];
-
- xdiff2=(x22-x21);
- if (xdiff2) {
- m2=(y22-y21)/xdiff2;
- b2= ((x22*y21)-(x21*y22))/xdiff2;
- }
- else {
- m2=MAXSLOPE; /* Verticle slope */
- b2=x22;
- }
-
- /*check for *exact* vertex intersection first*/
- if(mode!=KNIFE_MULTICUT){
- for (i=0; i<len; i++){
- if (i>0){
- x11=x12;
- y11=y12;
- }
- else {
- x11=c[i].x;
- y11=c[i].y;
- }
- x12=c[i].x;
- y12=c[i].y;
-
- /*test e->v1*/
- if((x11 == x21 && y11 == y21) || (x12 == x21 && y12 == y21)){
- e->v1->f1 = 1;
- perc = 0;
- return(perc);
- }
- /*test e->v2*/
- else if((x11 == x22 && y11 == y22) || (x12 == x22 && y12 == y22)){
- e->v2->f1 = 1;
- perc = 0;
- return(perc);
- }
- }
- }
-
- /*now check for edge interesect (may produce vertex intersection as well)*/
- for (i=0; i<len; i++){
- if (i>0){
- x11=x12;
- y11=y12;
- }
- else {
- x11=c[i].x;
- y11=c[i].y;
- }
- x12=c[i].x;
- y12=c[i].y;
-
- /* Perp. Distance from point to line */
- if (m2!=MAXSLOPE) dist=(y12-m2*x12-b2);/* /sqrt(m2*m2+1); Only looking for */
- /* change in sign. Skip extra math */
- else dist=x22-x12;
-
- if (i==0) lastdist=dist;
-
- /* if dist changes sign, and intersect point in edge's Bound Box*/
- if ((lastdist*dist)<=0){
- xdiff1=(x12-x11); /* Equation of line between last 2 points */
- if (xdiff1){
- m1=(y12-y11)/xdiff1;
- b1= ((x12*y11)-(x11*y12))/xdiff1;
- }
- else{
- m1=MAXSLOPE;
- b1=x12;
- }
- x2max=MAX2(x21,x22)+0.001; /* prevent missed edges */
- x2min=MIN2(x21,x22)-0.001; /* due to round off error */
- y2max=MAX2(y21,y22)+0.001;
- y2min=MIN2(y21,y22)-0.001;
-
- /* Found an intersect, calc intersect point */
- if (m1==m2){ /* co-incident lines */
- /* cut at 50% of overlap area*/
- x1max=MAX2(x11, x12);
- x1min=MIN2(x11, x12);
- xi= (MIN2(x2max,x1max)+MAX2(x2min,x1min))/2.0;
-
- y1max=MAX2(y11, y12);
- y1min=MIN2(y11, y12);
- yi= (MIN2(y2max,y1max)+MAX2(y2min,y1min))/2.0;
- }
- else if (m2==MAXSLOPE){
- xi=x22;
- yi=m1*x22+b1;
- }
- else if (m1==MAXSLOPE){
- xi=x12;
- yi=m2*x12+b2;
- }
- else {
- xi=(b1-b2)/(m2-m1);
- yi=(b1*m2-m1*b2)/(m2-m1);
- }
-
- /* Intersect inside bounding box of edge?*/
- if ((xi>=x2min)&&(xi<=x2max)&&(yi<=y2max)&&(yi>=y2min)){
- /*test for vertex intersect that may be 'close enough'*/
- if(mode!=KNIFE_MULTICUT){
- if(xi <= (x21 + threshold) && xi >= (x21 - threshold)){
- if(yi <= (y21 + threshold) && yi >= (y21 - threshold)){
- e->v1->f1 = 1;
- perc = 0;
- break;
- }
- }
- if(xi <= (x22 + threshold) && xi >= (x22 - threshold)){
- if(yi <= (y22 + threshold) && yi >= (y22 - threshold)){
- e->v2->f1 = 1;
- perc = 0;
- break;
- }
- }
- }
- if ((m2<=1.0)&&(m2>=-1.0)) perc = (xi-x21)/(x22-x21);
- else perc=(yi-y21)/(y22-y21); /*lower slope more accurate*/
- //isect=32768.0*(perc+0.0000153); /* Percentage in 1/32768ths */
- break;
- }
- }
- lastdist=dist;
- }
- return(perc);
-}
-
-void LoopMenu() /* Called by KKey */
-{
- short ret;
-
- ret=pupmenu("Loop/Cut Menu %t|Loop Cut (CTRL-R)%x2|"
- "Knife (Exact) %x3|Knife (Midpoints)%x4|Knife (Multicut)%x5");
-
- switch (ret){
- case 2:
- CutEdgeloop(1);
- break;
- case 3:
- KnifeSubdivide(KNIFE_EXACT);
- break;
- case 4:
- KnifeSubdivide(KNIFE_MIDPOINT);
- break;
- case 5:
- KnifeSubdivide(KNIFE_MULTICUT);
- break;
- }
-
-}
-
diff --git a/source/blender/src/editmesh_mods.c b/source/blender/src/editmesh_mods.c
deleted file mode 100644
index b165a141daa..00000000000
--- a/source/blender/src/editmesh_mods.c
+++ /dev/null
@@ -1,4139 +0,0 @@
-/**
- * $Id:
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2004 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-/*
-
-editmesh_mods.c, UI level access, no geometry changes
-
-*/
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "MTC_matrixops.h"
-
-#include "DNA_mesh_types.h"
-#include "DNA_material_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_modifier_types.h"
-#include "DNA_object_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_view3d_types.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_editVert.h"
-#include "BLI_rand.h"
-
-#include "BKE_displist.h"
-#include "BKE_depsgraph.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_customdata.h"
-#include "BKE_global.h"
-#include "BKE_mesh.h"
-#include "BKE_material.h"
-#include "BKE_texture.h"
-#include "BKE_utildefines.h"
-
-#ifdef WITH_VERSE
-#include "BKE_verse.h"
-#endif
-
-#include "BIF_editmesh.h"
-#include "BIF_resources.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-#include "BIF_graphics.h"
-#include "BIF_interface.h"
-#include "BIF_meshtools.h"
-#include "BIF_mywindow.h"
-#include "BIF_previewrender.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-#include "BIF_editsima.h"
-
-#ifdef WITH_VERSE
-#include "BIF_verse.h"
-#endif
-
-#include "BDR_drawobject.h"
-#include "BDR_editobject.h"
-
-#include "BSE_drawview.h"
-#include "BSE_edit.h"
-#include "BSE_view.h"
-
-#include "IMB_imbuf_types.h"
-#include "IMB_imbuf.h"
-
-#include "RE_render_ext.h" /* externtex */
-
-#include "multires.h"
-#include "mydevice.h"
-#include "blendef.h"
-
-#include "editmesh.h"
-
-
-/* ****************************** MIRROR **************** */
-
-void EM_select_mirrored(void)
-{
- if(G.scene->selectmode & SCE_SELECT_VERTEX) {
- EditMesh *em = G.editMesh;
- EditVert *eve, *v1;
-
- for(eve= em->verts.first; eve; eve= eve->next) {
- if(eve->f & SELECT) {
- v1= editmesh_get_x_mirror_vert(G.obedit, eve->co);
- if(v1) {
- eve->f &= ~SELECT;
- v1->f |= SELECT;
- }
- }
- }
- }
-}
-
-void EM_automerge(int update) {
- int len;
- if (G.scene->automerge) {
- if (G.obedit && G.obedit->type==OB_MESH) {
- len = removedoublesflag(1, 1, G.scene->toolsettings->doublimit);
- if (len) {
- G.totvert -= len; /* saves doing a countall */
- if (update) {
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- }
- }
- }
- }
-}
-
-/* ****************************** SELECTION ROUTINES **************** */
-
-unsigned int em_solidoffs=0, em_wireoffs=0, em_vertoffs=0; /* set in drawobject.c ... for colorindices */
-
-/* facilities for border select and circle select */
-static char *selbuf= NULL;
-
-/* opengl doesn't support concave... */
-static void draw_triangulated(short mcords[][2], short tot)
-{
- ListBase lb={NULL, NULL};
- DispList *dl;
- float *fp;
- int a;
-
- /* make displist */
- dl= MEM_callocN(sizeof(DispList), "poly disp");
- dl->type= DL_POLY;
- dl->parts= 1;
- dl->nr= tot;
- dl->verts= fp= MEM_callocN(tot*3*sizeof(float), "poly verts");
- BLI_addtail(&lb, dl);
-
- for(a=0; a<tot; a++, fp+=3) {
- fp[0]= (float)mcords[a][0];
- fp[1]= (float)mcords[a][1];
- }
-
- /* do the fill */
- filldisplist(&lb, &lb);
-
- /* do the draw */
- dl= lb.first; /* filldisplist adds in head of list */
- if(dl->type==DL_INDEX3) {
- int *index;
-
- a= dl->parts;
- fp= dl->verts;
- index= dl->index;
- glBegin(GL_TRIANGLES);
- while(a--) {
- glVertex3fv(fp+3*index[0]);
- glVertex3fv(fp+3*index[1]);
- glVertex3fv(fp+3*index[2]);
- index+= 3;
- }
- glEnd();
- }
-
- freedisplist(&lb);
-}
-
-
-/* reads rect, and builds selection array for quick lookup */
-/* returns if all is OK */
-int EM_init_backbuf_border(short xmin, short ymin, short xmax, short ymax)
-{
- struct ImBuf *buf;
- unsigned int *dr;
- int a;
-
- if(G.obedit==NULL || G.vd->drawtype<OB_SOLID || (G.vd->flag & V3D_ZBUF_SELECT)==0) return 0;
- if(em_vertoffs==0) return 0;
-
- buf= read_backbuf(xmin, ymin, xmax, ymax);
- if(buf==NULL) return 0;
-
- dr = buf->rect;
-
- /* build selection lookup */
- selbuf= MEM_callocN(em_vertoffs+1, "selbuf");
-
- a= (xmax-xmin+1)*(ymax-ymin+1);
- while(a--) {
- if(*dr>0 && *dr<=em_vertoffs)
- selbuf[*dr]= 1;
- dr++;
- }
- IMB_freeImBuf(buf);
- return 1;
-}
-
-int EM_check_backbuf(unsigned int index)
-{
- if(selbuf==NULL) return 1;
- if(index>0 && index<=em_vertoffs)
- return selbuf[index];
- return 0;
-}
-
-void EM_free_backbuf(void)
-{
- if(selbuf) MEM_freeN(selbuf);
- selbuf= NULL;
-}
-
-/* mcords is a polygon mask
- - grab backbuffer,
- - draw with black in backbuffer,
- - grab again and compare
- returns 'OK'
-*/
-int EM_mask_init_backbuf_border(short mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax)
-{
- unsigned int *dr, *drm;
- struct ImBuf *buf, *bufmask;
- int a;
-
- /* method in use for face selecting too */
- if(G.obedit==NULL) {
- if(FACESEL_PAINT_TEST);
- else return 0;
- }
- else if(G.vd->drawtype<OB_SOLID || (G.vd->flag & V3D_ZBUF_SELECT)==0) return 0;
-
- if(em_vertoffs==0) return 0;
-
- buf= read_backbuf(xmin, ymin, xmax, ymax);
- if(buf==NULL) return 0;
-
- dr = buf->rect;
-
- /* draw the mask */
-#ifdef __APPLE__
- glDrawBuffer(GL_AUX0);
-#endif
- glDisable(GL_DEPTH_TEST);
-
- persp(PERSP_WIN);
- glColor3ub(0, 0, 0);
-
- /* yah, opengl doesn't do concave... tsk! */
- draw_triangulated(mcords, tot);
-
- glBegin(GL_LINE_LOOP); /* for zero sized masks, lines */
- for(a=0; a<tot; a++) glVertex2s(mcords[a][0], mcords[a][1]);
- glEnd();
-
- persp(PERSP_VIEW);
- glFinish(); /* to be sure readpixels sees mask */
-
- glDrawBuffer(GL_BACK);
-
- /* grab mask */
- bufmask= read_backbuf(xmin, ymin, xmax, ymax);
- drm = bufmask->rect;
- if(bufmask==NULL) return 0; /* only when mem alloc fails, go crash somewhere else! */
-
- /* build selection lookup */
- selbuf= MEM_callocN(em_vertoffs+1, "selbuf");
-
- a= (xmax-xmin+1)*(ymax-ymin+1);
- while(a--) {
- if(*dr>0 && *dr<=em_vertoffs && *drm==0) selbuf[*dr]= 1;
- dr++; drm++;
- }
- IMB_freeImBuf(buf);
- IMB_freeImBuf(bufmask);
- return 1;
-
-}
-
-/* circle shaped sample area */
-int EM_init_backbuf_circle(short xs, short ys, short rads)
-{
- struct ImBuf *buf;
- unsigned int *dr;
- short xmin, ymin, xmax, ymax, xc, yc;
- int radsq;
-
- /* method in use for face selecting too */
- if(G.obedit==NULL) {
- if(FACESEL_PAINT_TEST);
- else return 0;
- }
- else if(G.vd->drawtype<OB_SOLID || (G.vd->flag & V3D_ZBUF_SELECT)==0) return 0;
- if(em_vertoffs==0) return 0;
-
- xmin= xs-rads; xmax= xs+rads;
- ymin= ys-rads; ymax= ys+rads;
- buf= read_backbuf(xmin, ymin, xmax, ymax);
- if(buf==NULL) return 0;
-
- dr = buf->rect;
-
- /* build selection lookup */
- selbuf= MEM_callocN(em_vertoffs+1, "selbuf");
- radsq= rads*rads;
- for(yc= -rads; yc<=rads; yc++) {
- for(xc= -rads; xc<=rads; xc++, dr++) {
- if(xc*xc + yc*yc < radsq) {
- if(*dr>0 && *dr<=em_vertoffs) selbuf[*dr]= 1;
- }
- }
- }
-
- IMB_freeImBuf(buf);
- return 1;
-
-}
-
-static void findnearestvert__doClosest(void *userData, EditVert *eve, int x, int y, int index)
-{
- struct { short mval[2], pass, select, strict; int dist, lastIndex, closestIndex; EditVert *closest; } *data = userData;
-
- if (data->pass==0) {
- if (index<=data->lastIndex)
- return;
- } else {
- if (index>data->lastIndex)
- return;
- }
-
- if (data->dist>3) {
- int temp = abs(data->mval[0] - x) + abs(data->mval[1]- y);
- if ((eve->f&1) == data->select) {
- if (data->strict == 1)
- return;
- else
- temp += 5;
- }
-
- if (temp<data->dist) {
- data->dist = temp;
- data->closest = eve;
- data->closestIndex = index;
- }
- }
-}
-
-
-
-
-static unsigned int findnearestvert__backbufIndextest(unsigned int index){
- EditVert *eve = BLI_findlink(&G.editMesh->verts, index-1);
- if(eve && (eve->f & SELECT)) return 0;
- return 1;
-}
-/**
- * findnearestvert
- *
- * dist (in/out): minimal distance to the nearest and at the end, actual distance
- * sel: selection bias
- * if SELECT, selected vertice are given a 5 pixel bias to make them farter than unselect verts
- * if 0, unselected vertice are given the bias
- * strict: if 1, the vertice corresponding to the sel parameter are ignored and not just biased
- */
-EditVert *findnearestvert(int *dist, short sel, short strict)
-{
- short mval[2];
-
- getmouseco_areawin(mval);
- if(G.vd->drawtype>OB_WIRE && (G.vd->flag & V3D_ZBUF_SELECT)){
- int distance;
- unsigned int index;
- EditVert *eve;
-
- if(strict) index = sample_backbuf_rect(mval, 50, em_wireoffs, 0xFFFFFF, &distance, strict, findnearestvert__backbufIndextest);
- else index = sample_backbuf_rect(mval, 50, em_wireoffs, 0xFFFFFF, &distance, 0, NULL);
-
- eve = BLI_findlink(&G.editMesh->verts, index-1);
-
- if(eve && distance < *dist) {
- *dist = distance;
- return eve;
- } else {
- return NULL;
- }
-
- }
- else {
- struct { short mval[2], pass, select, strict; int dist, lastIndex, closestIndex; EditVert *closest; } data;
- static int lastSelectedIndex=0;
- static EditVert *lastSelected=NULL;
-
- if (lastSelected && BLI_findlink(&G.editMesh->verts, lastSelectedIndex)!=lastSelected) {
- lastSelectedIndex = 0;
- lastSelected = NULL;
- }
-
- data.lastIndex = lastSelectedIndex;
- data.mval[0] = mval[0];
- data.mval[1] = mval[1];
- data.select = sel;
- data.dist = *dist;
- data.strict = strict;
- data.closest = NULL;
- data.closestIndex = 0;
-
- data.pass = 0;
- mesh_foreachScreenVert(findnearestvert__doClosest, &data, 1);
-
- if (data.dist>3) {
- data.pass = 1;
- mesh_foreachScreenVert(findnearestvert__doClosest, &data, 1);
- }
-
- *dist = data.dist;
- lastSelected = data.closest;
- lastSelectedIndex = data.closestIndex;
-
- return data.closest;
- }
-}
-
-/* returns labda for closest distance v1 to line-piece v2-v3 */
-static float labda_PdistVL2Dfl( float *v1, float *v2, float *v3)
-{
- float rc[2], len;
-
- rc[0]= v3[0]-v2[0];
- rc[1]= v3[1]-v2[1];
- len= rc[0]*rc[0]+ rc[1]*rc[1];
- if(len==0.0f)
- return 0.0f;
-
- return ( rc[0]*(v1[0]-v2[0]) + rc[1]*(v1[1]-v2[1]) )/len;
-}
-
-/* note; uses G.vd, so needs active 3d window */
-static void findnearestedge__doClosest(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index)
-{
- struct { float mval[2]; int dist; EditEdge *closest; } *data = userData;
- float v1[2], v2[2];
- int distance;
-
- v1[0] = x0;
- v1[1] = y0;
- v2[0] = x1;
- v2[1] = y1;
-
- distance= PdistVL2Dfl(data->mval, v1, v2);
-
- if(eed->f & SELECT) distance+=5;
- if(distance < data->dist) {
- if(G.vd->flag & V3D_CLIPPING) {
- float labda= labda_PdistVL2Dfl(data->mval, v1, v2);
- float vec[3];
-
- vec[0]= eed->v1->co[0] + labda*(eed->v2->co[0] - eed->v1->co[0]);
- vec[1]= eed->v1->co[1] + labda*(eed->v2->co[1] - eed->v1->co[1]);
- vec[2]= eed->v1->co[2] + labda*(eed->v2->co[2] - eed->v1->co[2]);
- Mat4MulVecfl(G.obedit->obmat, vec);
-
- if(view3d_test_clipping(G.vd, vec)==0) {
- data->dist = distance;
- data->closest = eed;
- }
- }
- else {
- data->dist = distance;
- data->closest = eed;
- }
- }
-}
-EditEdge *findnearestedge(int *dist)
-{
- short mval[2];
-
- getmouseco_areawin(mval);
-
- if(G.vd->drawtype>OB_WIRE && (G.vd->flag & V3D_ZBUF_SELECT)) {
- int distance;
- unsigned int index = sample_backbuf_rect(mval, 50, em_solidoffs, em_wireoffs, &distance,0, NULL);
- EditEdge *eed = BLI_findlink(&G.editMesh->edges, index-1);
-
- if (eed && distance<*dist) {
- *dist = distance;
- return eed;
- } else {
- return NULL;
- }
- }
- else {
- struct { float mval[2]; int dist; EditEdge *closest; } data;
-
- data.mval[0] = mval[0];
- data.mval[1] = mval[1];
- data.dist = *dist;
- data.closest = NULL;
-
- mesh_foreachScreenEdge(findnearestedge__doClosest, &data, 2);
-
- *dist = data.dist;
- return data.closest;
- }
-}
-
-static void findnearestface__getDistance(void *userData, EditFace *efa, int x, int y, int index)
-{
- struct { short mval[2]; int dist; EditFace *toFace; } *data = userData;
-
- if (efa==data->toFace) {
- int temp = abs(data->mval[0]-x) + abs(data->mval[1]-y);
-
- if (temp<data->dist)
- data->dist = temp;
- }
-}
-static void findnearestface__doClosest(void *userData, EditFace *efa, int x, int y, int index)
-{
- struct { short mval[2], pass; int dist, lastIndex, closestIndex; EditFace *closest; } *data = userData;
-
- if (data->pass==0) {
- if (index<=data->lastIndex)
- return;
- } else {
- if (index>data->lastIndex)
- return;
- }
-
- if (data->dist>3) {
- int temp = abs(data->mval[0]-x) + abs(data->mval[1]-y);
-
- if (temp<data->dist) {
- data->dist = temp;
- data->closest = efa;
- data->closestIndex = index;
- }
- }
-}
-static EditFace *findnearestface(int *dist)
-{
- short mval[2];
-
- getmouseco_areawin(mval);
-
- if(G.vd->drawtype>OB_WIRE && (G.vd->flag & V3D_ZBUF_SELECT)) {
- unsigned int index = sample_backbuf(mval[0], mval[1]);
- EditFace *efa = BLI_findlink(&G.editMesh->faces, index-1);
-
- if (efa) {
- struct { short mval[2]; int dist; EditFace *toFace; } data;
-
- data.mval[0] = mval[0];
- data.mval[1] = mval[1];
- data.dist = 0x7FFF; /* largest short */
- data.toFace = efa;
-
- mesh_foreachScreenFace(findnearestface__getDistance, &data);
-
- if(G.scene->selectmode == SCE_SELECT_FACE || data.dist<*dist) { /* only faces, no dist check */
- *dist= data.dist;
- return efa;
- }
- }
-
- return NULL;
- }
- else {
- struct { short mval[2], pass; int dist, lastIndex, closestIndex; EditFace *closest; } data;
- static int lastSelectedIndex=0;
- static EditFace *lastSelected=NULL;
-
- if (lastSelected && BLI_findlink(&G.editMesh->faces, lastSelectedIndex)!=lastSelected) {
- lastSelectedIndex = 0;
- lastSelected = NULL;
- }
-
- data.lastIndex = lastSelectedIndex;
- data.mval[0] = mval[0];
- data.mval[1] = mval[1];
- data.dist = *dist;
- data.closest = NULL;
- data.closestIndex = 0;
-
- data.pass = 0;
- mesh_foreachScreenFace(findnearestface__doClosest, &data);
-
- if (data.dist>3) {
- data.pass = 1;
- mesh_foreachScreenFace(findnearestface__doClosest, &data);
- }
-
- *dist = data.dist;
- lastSelected = data.closest;
- lastSelectedIndex = data.closestIndex;
-
- return data.closest;
- }
-}
-
-/* for interactivity, frontbuffer draw in current window */
-static void draw_dm_mapped_vert__mapFunc(void *theVert, int index, float *co, float *no_f, short *no_s)
-{
- if (EM_get_vert_for_index(index)==theVert) {
- bglVertex3fv(co);
- }
-}
-static void draw_dm_mapped_vert(DerivedMesh *dm, EditVert *eve)
-{
- EM_init_index_arrays(1, 0, 0);
- bglBegin(GL_POINTS);
- dm->foreachMappedVert(dm, draw_dm_mapped_vert__mapFunc, eve);
- bglEnd();
- EM_free_index_arrays();
-}
-
-static int draw_dm_mapped_edge__setDrawOptions(void *theEdge, int index)
-{
- return EM_get_edge_for_index(index)==theEdge;
-}
-static void draw_dm_mapped_edge(DerivedMesh *dm, EditEdge *eed)
-{
- EM_init_index_arrays(0, 1, 0);
- dm->drawMappedEdges(dm, draw_dm_mapped_edge__setDrawOptions, eed);
- EM_free_index_arrays();
-}
-
-static void draw_dm_mapped_face_center__mapFunc(void *theFace, int index, float *cent, float *no)
-{
- if (EM_get_face_for_index(index)==theFace) {
- bglVertex3fv(cent);
- }
-}
-static void draw_dm_mapped_face_center(DerivedMesh *dm, EditFace *efa)
-{
- EM_init_index_arrays(0, 0, 1);
- bglBegin(GL_POINTS);
- dm->foreachMappedFaceCenter(dm, draw_dm_mapped_face_center__mapFunc, efa);
- bglEnd();
- EM_free_index_arrays();
-}
-
-static void unified_select_draw(EditVert *eve, EditEdge *eed, EditFace *efa)
-{
- DerivedMesh *dm = editmesh_get_derived_cage(CD_MASK_BAREMESH);
-
- glDrawBuffer(GL_FRONT);
-
- persp(PERSP_VIEW);
-
- if(G.vd->flag & V3D_CLIPPING)
- view3d_set_clipping(G.vd);
-
- glPushMatrix();
- mymultmatrix(G.obedit->obmat);
-
- /* face selected */
- if(efa) {
- if(G.scene->selectmode & SCE_SELECT_VERTEX) {
- glPointSize(BIF_GetThemeValuef(TH_VERTEX_SIZE));
-
- if(efa->f & SELECT) BIF_ThemeColor(TH_VERTEX_SELECT);
- else BIF_ThemeColor(TH_VERTEX);
-
- bglBegin(GL_POINTS);
- bglVertex3fv(efa->v1->co);
- bglVertex3fv(efa->v2->co);
- bglVertex3fv(efa->v3->co);
- if(efa->v4) bglVertex3fv(efa->v4->co);
- bglEnd();
- }
-
- if(G.scene->selectmode & (SCE_SELECT_EDGE|SCE_SELECT_FACE)) {
- if(efa->fgonf==0) {
- BIF_ThemeColor((efa->f & SELECT)?TH_EDGE_SELECT:TH_WIRE);
-
- draw_dm_mapped_edge(dm, efa->e1);
- draw_dm_mapped_edge(dm, efa->e2);
- draw_dm_mapped_edge(dm, efa->e3);
- if (efa->e4) {
- draw_dm_mapped_edge(dm, efa->e4);
- }
- }
- }
-
- if( CHECK_OB_DRAWFACEDOT(G.scene, G.vd, G.obedit->dt) ) {
- if(efa->fgonf==0) {
- glPointSize(BIF_GetThemeValuef(TH_FACEDOT_SIZE));
- BIF_ThemeColor((efa->f & SELECT)?TH_FACE_DOT:TH_WIRE);
-
- draw_dm_mapped_face_center(dm, efa);
- }
- }
- }
- /* edge selected */
- if(eed) {
- if(G.scene->selectmode & (SCE_SELECT_EDGE|SCE_SELECT_FACE)) {
- BIF_ThemeColor((eed->f & SELECT)?TH_EDGE_SELECT:TH_WIRE);
-
- draw_dm_mapped_edge(dm, eed);
- }
- if(G.scene->selectmode & SCE_SELECT_VERTEX) {
- glPointSize(BIF_GetThemeValuef(TH_VERTEX_SIZE));
-
- BIF_ThemeColor((eed->f & SELECT)?TH_VERTEX_SELECT:TH_VERTEX);
-
- draw_dm_mapped_vert(dm, eed->v1);
- draw_dm_mapped_vert(dm, eed->v2);
- }
- }
- if(eve) {
- if(G.scene->selectmode & SCE_SELECT_VERTEX) {
- glPointSize(BIF_GetThemeValuef(TH_VERTEX_SIZE));
-
- BIF_ThemeColor((eve->f & SELECT)?TH_VERTEX_SELECT:TH_VERTEX);
-
- draw_dm_mapped_vert(dm, eve);
- }
- }
-
- glPointSize(1.0);
- glPopMatrix();
-
- bglFlush();
- glDrawBuffer(GL_BACK);
-
- if(G.vd->flag & V3D_CLIPPING)
- view3d_clr_clipping();
-
- /* signal that frontbuf differs from back */
- curarea->win_swap= WIN_FRONT_OK;
-
- dm->release(dm);
-}
-
-
-/* best distance based on screen coords.
- use g.scene->selectmode to define how to use
- selected vertices and edges get disadvantage
- return 1 if found one
-*/
-static int unified_findnearest(EditVert **eve, EditEdge **eed, EditFace **efa)
-{
- int dist= 75;
-
- *eve= NULL;
- *eed= NULL;
- *efa= NULL;
-
- if(G.scene->selectmode & SCE_SELECT_VERTEX)
- *eve= findnearestvert(&dist, SELECT, 0);
- if(G.scene->selectmode & SCE_SELECT_FACE)
- *efa= findnearestface(&dist);
-
- dist-= 20; /* since edges select lines, we give dots advantage of 20 pix */
- if(G.scene->selectmode & SCE_SELECT_EDGE)
- *eed= findnearestedge(&dist);
-
- /* return only one of 3 pointers, for frontbuffer redraws */
- if(*eed) {
- *efa= NULL; *eve= NULL;
- }
- else if(*efa) {
- *eve= NULL;
- }
-
- return (*eve || *eed || *efa);
-}
-
-/* this as a way to compare the ares, perim of 2 faces thay will scale to different sizes
- *0.5 so smaller faces arnt ALWAYS selected with a thresh of 1.0 */
-#define SCALE_CMP(a,b) ((a+a*thresh >= b) && (a-(a*thresh*0.5) <= b))
-
-/* **************** GROUP SELECTS ************** */
-/* selects new faces/edges/verts based on the
- existing selection
-
-FACES GROUP
- mode 1: same material
- mode 2: same image
- mode 3: same area
- mode 4: same perimeter
- mode 5: same normal
- mode 6: same co-planer
-*/
-int facegroup_select(short mode)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa, *base_efa=NULL;
- unsigned int selcount=0; /*count how many new faces we select*/
-
- /*deselcount, count how many deselected faces are left, so we can bail out early
- also means that if there are no deselected faces, we can avoid a lot of looping */
- unsigned int deselcount=0;
-
- short ok=0;
- float thresh=G.scene->toolsettings->select_thresh;
-
- for(efa= em->faces.first; efa; efa= efa->next) {
- if (!efa->h) {
- if (efa->f & SELECT) {
- efa->f1=1;
- ok=1;
- } else {
- efa->f1=0;
- deselcount++; /* a deselected face we may select later */
- }
- }
- }
-
- if (!ok || !deselcount) /* no data selected OR no more data to select */
- return 0;
-
- /*if mode is 3 then record face areas, 4 record perimeter */
- if (mode==3) {
- for(efa= em->faces.first; efa; efa= efa->next) {
- efa->tmp.fp= EM_face_area(efa);
- }
- } else if (mode==4) {
- for(efa= em->faces.first; efa; efa= efa->next) {
- efa->tmp.fp= EM_face_perimeter(efa);
- }
- }
-
- for(base_efa= em->faces.first; base_efa; base_efa= base_efa->next) {
- if (base_efa->f1) { /* This was one of the faces originaly selected */
- if (mode==1) { /* same material */
- for(efa= em->faces.first; efa; efa= efa->next) {
- if (
- !(efa->f & SELECT) &&
- !efa->h &&
- base_efa->mat_nr == efa->mat_nr
- ) {
- EM_select_face(efa, 1);
- selcount++;
- deselcount--;
- if (!deselcount) /*have we selected all posible faces?, if so return*/
- return selcount;
- }
- }
- } else if (mode==2) { /* same image */
- MTFace *tf, *base_tf;
-
- base_tf = (MTFace*)CustomData_em_get(&em->fdata, base_efa->data,
- CD_MTFACE);
-
- if(!base_tf)
- return selcount;
-
- for(efa= em->faces.first; efa; efa= efa->next) {
- if (!(efa->f & SELECT) && !efa->h) {
- tf = (MTFace*)CustomData_em_get(&em->fdata, efa->data,
- CD_MTFACE);
-
- if(base_tf->tpage == tf->tpage) {
- EM_select_face(efa, 1);
- selcount++;
- deselcount--;
- if (!deselcount) /*have we selected all posible faces?, if so return*/
- return selcount;
- }
- }
- }
- } else if (mode==3 || mode==4) { /* same area OR same perimeter, both use the same temp var */
- for(efa= em->faces.first; efa; efa= efa->next) {
- if (
- (!(efa->f & SELECT) && !efa->h) &&
- SCALE_CMP(base_efa->tmp.fp, efa->tmp.fp)
- ) {
- EM_select_face(efa, 1);
- selcount++;
- deselcount--;
- if (!deselcount) /*have we selected all posible faces?, if so return*/
- return selcount;
- }
- }
- } else if (mode==5) { /* same normal */
- float angle;
- for(efa= em->faces.first; efa; efa= efa->next) {
- if (!(efa->f & SELECT) && !efa->h) {
- angle= VecAngle2(base_efa->n, efa->n);
- if (angle/180.0<=thresh) {
- EM_select_face(efa, 1);
- selcount++;
- deselcount--;
- if (!deselcount) /*have we selected all posible faces?, if so return*/
- return selcount;
- }
- }
- }
- } else if (mode==6) { /* same planer */
- float angle, base_dot, dot;
- base_dot= Inpf(base_efa->cent, base_efa->n);
- for(efa= em->faces.first; efa; efa= efa->next) {
- if (!(efa->f & SELECT) && !efa->h) {
- angle= VecAngle2(base_efa->n, efa->n);
- if (angle/180.0<=thresh) {
- dot=Inpf(efa->cent, base_efa->n);
- if (fabs(base_dot-dot) <= thresh) {
- EM_select_face(efa, 1);
- selcount++;
- deselcount--;
- if (!deselcount) /*have we selected all posible faces?, if so return*/
- return selcount;
- }
- }
- }
- }
- }
- }
- } /* end base_efa loop */
- return selcount;
-}
-
-
-/*
-EDGE GROUP
- mode 1: same length
- mode 2: same direction
- mode 3: same number of face users
- mode 4: similar face angles.
- mode 5: similar crease
- mode 6: similar seam
- mode 7: similar sharp
-*/
-
-/* this function is only used by edgegroup_select's edge angle */
-
-
-
-int edgegroup_select(short mode)
-{
- EditMesh *em = G.editMesh;
- EditEdge *eed, *base_eed=NULL;
- unsigned int selcount=0; /* count how many new edges we select*/
-
- /*count how many visible selected edges there are,
- so we can return when there are none left */
- unsigned int deselcount=0;
-
- short ok=0;
- float thresh=G.scene->toolsettings->select_thresh;
-
- for(eed= em->edges.first; eed; eed= eed->next) {
- if (!eed->h) {
- if (eed->f & SELECT) {
- eed->f1=1;
- ok=1;
- } else {
- eed->f1=0;
- deselcount++;
- }
- /* set all eed->tmp.l to 0 we use it later.
- for counting face users*/
- eed->tmp.l=0;
- eed->f2=0; /* only for mode 4, edge animations */
- }
- }
-
- if (!ok || !deselcount) /* no data selected OR no more data to select*/
- return 0;
-
- if (mode==1) { /*store length*/
- for(eed= em->edges.first; eed; eed= eed->next) {
- if (!eed->h) /* dont calc data for hidden edges*/
- eed->tmp.fp= VecLenf(eed->v1->co, eed->v2->co);
- }
- } else if (mode==3) { /*store face users*/
- EditFace *efa;
- /* cound how many faces each edge uses use tmp->l */
- for(efa= em->faces.first; efa; efa= efa->next) {
- efa->e1->tmp.l++;
- efa->e2->tmp.l++;
- efa->e3->tmp.l++;
- if (efa->e4) efa->e4->tmp.l++;
- }
- } else if (mode==4) { /*store edge angles */
- EditFace *efa;
- int j;
- /* cound how many faces each edge uses use tmp.l */
- for(efa= em->faces.first; efa; efa= efa->next) {
- /* here we use the edges temp data to assign a face
- if a face has alredy been assigned (eed->f2==1)
- we calculate the angle between the current face and
- the edges previously found face.
- store the angle in eed->tmp.fp (loosing the face eed->tmp.f)
- but tagging eed->f2==2, so we know not to look at it again.
- This only works for edges that connect to 2 faces. but its good enough
- */
-
- /* se we can loop through face edges*/
- j=0;
- eed= efa->e1;
- while (j<4) {
- if (j==1) eed= efa->e2;
- else if (j==2) eed= efa->e3;
- else if (j==3) {
- eed= efa->e4;
- if (!eed)
- break;
- } /* done looping */
-
- if (!eed->h) { /* dont calc data for hidden edges*/
- if (eed->f2==2)
- break;
- else if (eed->f2==0) /* first access, assign the face */
- eed->tmp.f= efa;
- else if (eed->f2==1) /* second, we assign the angle*/
- eed->tmp.fp= VecAngle2(eed->tmp.f->n, efa->n)/180;
- eed->f2++; /* f2==0 no face assigned. f2==1 one face found. f2==2 angle calculated.*/
- }
- j++;
- }
- }
- }
-
- for(base_eed= em->edges.first; base_eed; base_eed= base_eed->next) {
- if (base_eed->f1) {
- if (mode==1) { /* same length */
- for(eed= em->edges.first; eed; eed= eed->next) {
- if (
- !(eed->f & SELECT) &&
- !eed->h &&
- SCALE_CMP(base_eed->tmp.fp, eed->tmp.fp)
- ) {
- EM_select_edge(eed, 1);
- selcount++;
- deselcount--;
- if (!deselcount) /*have we selected all posible faces?, if so return*/
- return selcount;
- }
- }
- } else if (mode==2) { /* same direction */
- float base_dir[3], dir[3], angle;
- VecSubf(base_dir, base_eed->v1->co, base_eed->v2->co);
- for(eed= em->edges.first; eed; eed= eed->next) {
- if (!(eed->f & SELECT) && !eed->h) {
- VecSubf(dir, eed->v1->co, eed->v2->co);
- angle= VecAngle2(base_dir, dir);
-
- if (angle>90) /* use the smallest angle between the edges */
- angle= fabs(angle-180.0f);
-
- if (angle/90.0<=thresh) {
- EM_select_edge(eed, 1);
- selcount++;
- deselcount--;
- if (!deselcount) /*have we selected all posible faces?, if so return*/
- return selcount;
- }
- }
- }
- } else if (mode==3) { /* face users */
- for(eed= em->edges.first; eed; eed= eed->next) {
- if (
- !(eed->f & SELECT) &&
- !eed->h &&
- base_eed->tmp.l==eed->tmp.l
- ) {
- EM_select_edge(eed, 1);
- selcount++;
- deselcount--;
- if (!deselcount) /*have we selected all posible faces?, if so return*/
- return selcount;
- }
- }
- } else if (mode==4 && base_eed->f2==2) { /* edge angles, f2==2 means the edge has an angle. */
- for(eed= em->edges.first; eed; eed= eed->next) {
- if (
- !(eed->f & SELECT) &&
- !eed->h &&
- eed->f2==2 &&
- (fabs(base_eed->tmp.fp-eed->tmp.fp)<=thresh)
- ) {
- EM_select_edge(eed, 1);
- selcount++;
- deselcount--;
- if (!deselcount) /*have we selected all posible faces?, if so return*/
- return selcount;
- }
- }
- } else if (mode==5) { /* edge crease */
- for(eed= em->edges.first; eed; eed= eed->next) {
- if (
- !(eed->f & SELECT) &&
- !eed->h &&
- (fabs(base_eed->crease-eed->crease) <= thresh)
- ) {
- EM_select_edge(eed, 1);
- selcount++;
- deselcount--;
- if (!deselcount) /*have we selected all posible faces?, if so return*/
- return selcount;
- }
- }
- } else if (mode==6) { /* edge seam */
- for(eed= em->edges.first; eed; eed= eed->next) {
- if (
- !(eed->f & SELECT) &&
- !eed->h &&
- (eed->seam == base_eed->seam)
- ) {
- EM_select_edge(eed, 1);
- selcount++;
- deselcount--;
- if (!deselcount) /*have we selected all posible faces?, if so return*/
- return selcount;
- }
- }
- } else if (mode==7) { /* edge sharp */
- for(eed= em->edges.first; eed; eed= eed->next) {
- if (
- !(eed->f & SELECT) &&
- !eed->h &&
- (eed->sharp == base_eed->sharp)
- ) {
- EM_select_edge(eed, 1);
- selcount++;
- deselcount--;
- if (!deselcount) /*have we selected all posible faces?, if so return*/
- return selcount;
- }
- }
- }
- }
- }
- return selcount;
-}
-
-
-/*
-VERT GROUP
- mode 1: same normal
- mode 2: same number of face users
- mode 3: same vertex groups
-*/
-int vertgroup_select(short mode)
-{
- EditMesh *em = G.editMesh;
- EditVert *eve, *base_eve=NULL;
-
- unsigned int selcount=0; /* count how many new edges we select*/
-
- /*count how many visible selected edges there are,
- so we can return when there are none left */
- unsigned int deselcount=0;
-
- short ok=0;
- float thresh=G.scene->toolsettings->select_thresh;
-
- for(eve= em->verts.first; eve; eve= eve->next) {
- if (!eve->h) {
- if (eve->f & SELECT) {
- eve->f1=1;
- ok=1;
- } else {
- eve->f1=0;
- deselcount++;
- }
- /* set all eve->tmp.l to 0 we use them later.*/
- eve->tmp.l=0;
- }
-
- }
-
- if (!ok || !deselcount) /* no data selected OR no more data to select*/
- return 0;
-
-
- if (mode==2) { /* store face users */
- EditFace *efa;
-
- /* count how many faces each edge uses use tmp->l */
- for(efa= em->faces.first; efa; efa= efa->next) {
- efa->v1->tmp.l++;
- efa->v2->tmp.l++;
- efa->v3->tmp.l++;
- if (efa->v4) efa->v4->tmp.l++;
- }
- }
-
-
- for(base_eve= em->verts.first; base_eve; base_eve= base_eve->next) {
- if (base_eve->f1) {
-
- if (mode==1) { /* same normal */
- float angle;
- for(eve= em->verts.first; eve; eve= eve->next) {
- if (!(eve->f & SELECT) && !eve->h) {
- angle= VecAngle2(base_eve->no, eve->no);
- if (angle/180.0<=thresh) {
- eve->f |= SELECT;
- selcount++;
- deselcount--;
- if (!deselcount) /*have we selected all posible faces?, if so return*/
- return selcount;
- }
- }
- }
- } else if (mode==2) { /* face users */
- for(eve= em->verts.first; eve; eve= eve->next) {
- if (
- !(eve->f & SELECT) &&
- !eve->h &&
- base_eve->tmp.l==eve->tmp.l
- ) {
- eve->f |= SELECT;
- selcount++;
- deselcount--;
- if (!deselcount) /*have we selected all posible faces?, if so return*/
- return selcount;
- }
- }
- } else if (mode==3) { /* vertex groups */
- MDeformVert *dvert, *base_dvert;
- short i, j; /* weight index */
-
- base_dvert= CustomData_em_get(&em->vdata, base_eve->data,
- CD_MDEFORMVERT);
-
- if (!base_dvert || base_dvert->totweight == 0)
- return selcount;
-
- for(eve= em->verts.first; eve; eve= eve->next) {
- dvert= CustomData_em_get(&em->vdata, eve->data,
- CD_MDEFORMVERT);
-
- if (dvert && !(eve->f & SELECT) && !eve->h && dvert->totweight) {
- /* do the extra check for selection in the following if, so were not
- checking verts that may be alredy selected */
- for (i=0; base_dvert->totweight >i && !(eve->f & SELECT); i++) {
- for (j=0; dvert->totweight >j; j++) {
- if (base_dvert->dw[i].def_nr==dvert->dw[j].def_nr) {
- eve->f |= SELECT;
- selcount++;
- deselcount--;
- if (!deselcount) /*have we selected all posible faces?, if so return*/
- return selcount;
- break;
- }
- }
- }
- }
- }
- }
- }
- } /* end basevert loop */
- return selcount;
-}
-
-/* EditMode menu triggered from space.c by pressing Shift+G
-handles face/edge vert context and
-facegroup_select/edgegroup_select/vertgroup_select do all the work
-*/
-
-void select_mesh_group_menu()
-{
- short ret;
- int selcount, first_item=1, multi=0;
- char str[512] = "Select Similar "; /* total max length is 404 at the moment */
-
- if (!ELEM3(G.scene->selectmode, SCE_SELECT_VERTEX, SCE_SELECT_EDGE, SCE_SELECT_FACE)) {
- multi=1;
- }
-
- if(G.scene->selectmode & SCE_SELECT_VERTEX) {
- if (multi) strcat(str, "%t|Vertices%x-1|");
- else strcat(str, "Vertices %t|");
- strcat(str, " Normal %x1| Face Users %x2| Shared Vertex Groups%x3");
- first_item=0;
- }
-
- if(G.scene->selectmode & SCE_SELECT_EDGE) {
- if (multi) {
- if (first_item) strcat(str, "%t|Edges%x-1|");
- else strcat(str, "|%l|Edges%x-1|");
- } else strcat(str, "Edges %t|");
-
- strcat(str, " Length %x10| Direction %x20| Face Users%x30| Face Angle%x40| Crease%x50| Seam%x60| Sharp%x70");
- first_item=0;
- }
-
- if(G.scene->selectmode & SCE_SELECT_FACE) {
- if (multi) {
- strcat(str, "|%l|Faces%x-1|");
- } else strcat(str, "Faces %t|");
- strcat(str, " Material %x100| Image %x200| Area %x300| Perimeter %x400| Normal %x500| Co-Planar %x600");
-
- }
-
- ret= pupmenu(str);
- if (ret<1) return;
-
- if (ret<10) {
- selcount= vertgroup_select(ret);
- if (selcount) { /* update if data was selected */
- EM_select_flush(); /* so that selected verts, go onto select faces */
- G.totvertsel += selcount;
- allqueue(REDRAWVIEW3D, 0);
- if (EM_texFaceCheck())
- allqueue(REDRAWIMAGE, 0);
- BIF_undo_push("Select Similar Vertices");
- }
- return;
- }
-
- if (ret<100) {
- selcount= edgegroup_select(ret/10);
-
- if (selcount) { /* update if data was selected */
- /*EM_select_flush();*/ /* dont use because it can end up selecting more edges and is not usefull*/
- G.totedgesel+=selcount;
- allqueue(REDRAWVIEW3D, 0);
- if (EM_texFaceCheck())
- allqueue(REDRAWIMAGE, 0);
- BIF_undo_push("Select Similar Edges");
- }
- return;
- }
-
- if (ret<1000) {
- selcount= facegroup_select(ret/100);
- if (selcount) { /* update if data was selected */
- G.totfacesel+=selcount;
- allqueue(REDRAWVIEW3D, 0);
- if (EM_texFaceCheck())
- allqueue(REDRAWIMAGE, 0);
- BIF_undo_push("Select Similar Faces");
- }
- return;
- }
-}
-
-int mesh_layers_menu_charlen(CustomData *data, int type)
-{
- int i, len = 0;
- /* see if there is a duplicate */
- for(i=0; i<data->totlayer; i++) {
- if((&data->layers[i])->type == type) {
- /* we could count the chars here but we'll just assumeme each
- * is 32 chars with some room for the menu text - 40 should be fine */
- len+=40;
- }
- }
- return len;
-}
-
-/* this function adds menu text into an existing string.
- * this string's size should be allocated with mesh_layers_menu_charlen */
-void mesh_layers_menu_concat(CustomData *data, int type, char *str) {
- int i, count = 0;
- char *str_pt = str;
- CustomDataLayer *layer;
-
- /* see if there is a duplicate */
- for(i=0; i<data->totlayer; i++) {
- layer = &data->layers[i];
- if(layer->type == type) {
- str_pt += sprintf(str_pt, "%s%%x%d|", layer->name, count);
- count++;
- }
- }
-}
-
-int mesh_layers_menu(CustomData *data, int type) {
- int ret;
- char *str_pt, *str;
-
- str_pt = str = MEM_mallocN(mesh_layers_menu_charlen(data, type) + 18, "layer menu");
- str[0] = '\0';
-
- str_pt += sprintf(str_pt, "Layers%%t|");
-
- mesh_layers_menu_concat(data, type, str_pt);
-
- ret = pupmenu(str);
- MEM_freeN(str);
- return ret;
-}
-
-/* ctrl+c in mesh editmode */
-void mesh_copy_menu(void)
-{
- EditMesh *em = G.editMesh;
- EditSelection *ese;
- short ret, change=0;
-
- if (!em) return;
-
- ese = em->selected.last;
-
- if (!ese) return;
-
- if(ese->type == EDITVERT) {
- /*EditVert *ev, *ev_act = (EditVert*)ese->data;
- ret= pupmenu("");*/
- } else if(ese->type == EDITEDGE) {
- EditEdge *eed, *eed_act = (EditEdge*)ese->data;
- float vec[3], vec_mid[3], eed_len, eed_len_act;
-
- ret= pupmenu("Copy Active Edge to Selected%t|Crease%x1|Length%x2");
- if (ret<1) return;
-
- eed_len_act = VecLenf(eed_act->v1->co, eed_act->v2->co);
-
- switch (ret) {
- case 1: /* copy crease */
- for(eed=em->edges.first; eed; eed=eed->next) {
- if (eed->f & SELECT && eed != eed_act && eed->crease != eed_act->crease) {
- eed->crease = eed_act->crease;
- change = 1;
- }
- }
- break;
-
- case 2: /* copy length */
-
- for(eed=em->edges.first; eed; eed=eed->next) {
- if (eed->f & SELECT && eed != eed_act) {
-
- eed_len = VecLenf(eed->v1->co, eed->v2->co);
-
- if (eed_len == eed_len_act) continue;
- /* if this edge is zero length we cont do anything with it*/
- if (eed_len == 0.0f) continue;
- if (eed_len_act == 0.0f) {
- VecAddf(vec_mid, eed->v1->co, eed->v2->co);
- VecMulf(vec_mid, 0.5);
- VECCOPY(eed->v1->co, vec_mid);
- VECCOPY(eed->v2->co, vec_mid);
- } else {
- /* copy the edge length */
- VecAddf(vec_mid, eed->v1->co, eed->v2->co);
- VecMulf(vec_mid, 0.5);
-
- /* SCALE 1 */
- VecSubf(vec, eed->v1->co, vec_mid);
- VecMulf(vec, eed_len_act/eed_len);
- VecAddf(eed->v1->co, vec, vec_mid);
-
- /* SCALE 2 */
- VecSubf(vec, eed->v2->co, vec_mid);
- VecMulf(vec, eed_len_act/eed_len);
- VecAddf(eed->v2->co, vec, vec_mid);
- }
- change = 1;
- }
- }
-
- if (change)
- recalc_editnormals();
-
-
- break;
- }
-
- } else if(ese->type == EDITFACE) {
- EditFace *efa, *efa_act = (EditFace*)ese->data;
- MTFace *tf, *tf_act;
- MCol *mcol, *mcol_act;
-
- ret= pupmenu(
- "Copy Face Selected%t|"
- "Active Material%x1|Active Image%x2|Active UV Coords%x3|"
- "Active Mode%x4|Active Transp%x5|Active Vertex Colors%x6|%l|"
-
- "TexFace UVs from layer%x7|"
- "TexFace Images from layer%x8|"
- "TexFace All from layer%x9|"
- "Vertex Colors from layer%x10");
-
- if (ret<1) return;
-
- tf_act = CustomData_em_get(&em->fdata, efa_act->data, CD_MTFACE);
- mcol_act = CustomData_em_get(&em->fdata, efa_act->data, CD_MCOL);
-
- switch (ret) {
- case 1: /* copy material */
- for(efa=em->faces.first; efa; efa=efa->next) {
- if (efa->f & SELECT && efa->mat_nr != efa_act->mat_nr) {
- efa->mat_nr = efa_act->mat_nr;
- change = 1;
- }
- }
- break;
- case 2: /* copy image */
- if (!tf_act) {
- error("mesh has no uv/image layers");
- return;
- }
- for(efa=em->faces.first; efa; efa=efa->next) {
- if (efa->f & SELECT && efa != efa_act) {
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (tf_act->tpage) {
- tf->tpage = tf_act->tpage;
- tf->mode |= TF_TEX;
- } else {
- tf->tpage = NULL;
- tf->mode &= ~TF_TEX;
- }
- tf->tile= tf_act->tile;
- change = 1;
- }
- }
- break;
-
- case 3: /* copy UV's */
- if (!tf_act) {
- error("mesh has no uv/image layers");
- return;
- }
- for(efa=em->faces.first; efa; efa=efa->next) {
- if (efa->f & SELECT && efa != efa_act) {
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- memcpy(tf->uv, tf_act->uv, sizeof(tf->uv));
- change = 1;
- }
- }
- break;
- case 4: /* mode's */
- if (!tf_act) {
- error("mesh has no uv/image layers");
- return;
- }
- for(efa=em->faces.first; efa; efa=efa->next) {
- if (efa->f & SELECT && efa != efa_act) {
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- tf->mode= tf_act->mode;
- change = 1;
- }
- }
- break;
- case 5: /* copy transp's */
- if (!tf_act) {
- error("mesh has no uv/image layers");
- return;
- }
- for(efa=em->faces.first; efa; efa=efa->next) {
- if (efa->f & SELECT && efa != efa_act) {
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- tf->transp= tf_act->transp;
- change = 1;
- }
- }
- break;
-
- case 6: /* copy vcols's */
- if (!mcol_act) {
- error("mesh has no color layers");
- return;
- } else {
- /* guess the 4th color if needs be */
- float val =- 1;
-
- if (!efa_act->v4) {
- /* guess the othe vale, we may need to use it
- *
- * Modifying the 4th value of the mcol is ok here since its not seen
- * on a triangle
- * */
- val = ((float)(mcol_act->r + (mcol_act+1)->r + (mcol_act+2)->r)) / 3; CLAMP(val, 0, 255);
- (mcol_act+3)->r = (char)val;
-
- val = ((float)(mcol_act->g + (mcol_act+1)->g + (mcol_act+2)->g)) / 3; CLAMP(val, 0, 255);
- (mcol_act+3)->g = (char)val;
-
- val = ((float)(mcol_act->b + (mcol_act+1)->b + (mcol_act+2)->b)) / 3; CLAMP(val, 0, 255);
- (mcol_act+3)->b = (char)val;
- }
-
-
- for(efa=em->faces.first; efa; efa=efa->next) {
- if (efa->f & SELECT && efa != efa_act) {
- /* TODO - make copy from tri to quad guess the 4th vert */
- mcol = CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
- memcpy(mcol, mcol_act, sizeof(MCol)*4);
- change = 1;
- }
- }
- }
-
- break;
-
-
- /* copy from layer */
- case 7:
- case 8:
- case 9:
- if (!tf_act) {
- error("mesh has no uv/image layers");
- return;
- } else if (CustomData_number_of_layers(&em->fdata, CD_MTFACE)<2) {
- error("mesh does not have multiple uv/image layers");
- return;
- } else {
- int layer_orig_idx, layer_idx;
-
- layer_idx = mesh_layers_menu(&em->fdata, CD_MTFACE);
- if (layer_idx<0) return;
-
- /* warning, have not updated mesh pointers however this is not needed since we swicth back */
- layer_orig_idx = CustomData_get_active_layer(&em->fdata, CD_MTFACE);
- if (layer_idx==layer_orig_idx)
- return;
-
- /* get the tfaces */
- CustomData_set_layer_active(&em->fdata, CD_MTFACE, (int)layer_idx);
- /* store the tfaces in our temp */
- for(efa=em->faces.first; efa; efa=efa->next) {
- if (efa->f & SELECT) {
- efa->tmp.p = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- }
- }
- CustomData_set_layer_active(&em->fdata, CD_MTFACE, layer_orig_idx);
- }
- break;
-
- case 10: /* select vcol layers - make sure this stays in sync with above code */
- if (!mcol_act) {
- error("mesh has no color layers");
- return;
- } else if (CustomData_number_of_layers(&em->fdata, CD_MCOL)<2) {
- error("mesh does not have multiple color layers");
- return;
- } else {
- int layer_orig_idx, layer_idx;
-
- layer_idx = mesh_layers_menu(&em->fdata, CD_MCOL);
- if (layer_idx<0) return;
-
- /* warning, have not updated mesh pointers however this is not needed since we swicth back */
- layer_orig_idx = CustomData_get_active_layer(&em->fdata, CD_MCOL);
- if (layer_idx==layer_orig_idx)
- return;
-
- /* get the tfaces */
- CustomData_set_layer_active(&em->fdata, CD_MCOL, (int)layer_idx);
- /* store the tfaces in our temp */
- for(efa=em->faces.first; efa; efa=efa->next) {
- if (efa->f & SELECT) {
- efa->tmp.p = CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
- }
- }
- CustomData_set_layer_active(&em->fdata, CD_MCOL, layer_orig_idx);
-
- }
- break;
- }
-
- /* layer copy only - sanity checks done above */
- switch (ret) {
- case 7: /* copy UV's only */
- for(efa=em->faces.first; efa; efa=efa->next) {
- if (efa->f & SELECT) {
- tf_act = (MTFace *)efa->tmp.p; /* not active but easier to use this way */
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- memcpy(tf->uv, tf_act->uv, sizeof(tf->uv));
- change = 1;
- }
- }
- break;
- case 8: /* copy image settings only */
- for(efa=em->faces.first; efa; efa=efa->next) {
- if (efa->f & SELECT) {
- tf_act = (MTFace *)efa->tmp.p; /* not active but easier to use this way */
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (tf_act->tpage) {
- tf->tpage = tf_act->tpage;
- tf->mode |= TF_TEX;
- } else {
- tf->tpage = NULL;
- tf->mode &= ~TF_TEX;
- }
- tf->tile= tf_act->tile;
- change = 1;
- }
- }
- break;
- case 9: /* copy all tface info */
- for(efa=em->faces.first; efa; efa=efa->next) {
- if (efa->f & SELECT) {
- tf_act = (MTFace *)efa->tmp.p; /* not active but easier to use this way */
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- memcpy(tf->uv, ((MTFace *)efa->tmp.p)->uv, sizeof(tf->uv));
- tf->tpage = tf_act->tpage;
- tf->mode = tf_act->mode;
- tf->transp = tf_act->transp;
- change = 1;
- }
- }
- break;
- case 10:
- for(efa=em->faces.first; efa; efa=efa->next) {
- if (efa->f & SELECT) {
- mcol_act = (MCol *)efa->tmp.p;
- mcol = CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
- memcpy(mcol, mcol_act, sizeof(MCol)*4);
- change = 1;
- }
- }
- break;
- }
-
- }
-
- if (change) {
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
-
- if(ese->type == EDITVERT) BIF_undo_push("Copy Vert Attribute");
- else if (ese->type == EDITEDGE) BIF_undo_push("Copy Edge Attribute");
- else if (ese->type == EDITFACE) BIF_undo_push("Copy Face Attribute");
- }
-
-}
-
-
-/* **************** LOOP SELECTS *************** */
-
-/* selects quads in loop direction of indicated edge */
-/* only flush over edges with valence <= 2 */
-void faceloop_select(EditEdge *startedge, int select)
-{
- EditMesh *em = G.editMesh;
- EditEdge *eed;
- EditFace *efa;
- int looking= 1;
-
- /* in eed->f1 we put the valence (amount of faces in edge) */
- /* in eed->f2 we put tagged flag as correct loop */
- /* in efa->f1 we put tagged flag as correct to select */
-
- for(eed= em->edges.first; eed; eed= eed->next) {
- eed->f1= 0;
- eed->f2= 0;
- }
- for(efa= em->faces.first; efa; efa= efa->next) {
- efa->f1= 0;
- if(efa->h==0) {
- efa->e1->f1++;
- efa->e2->f1++;
- efa->e3->f1++;
- if(efa->e4) efa->e4->f1++;
- }
- }
-
- /* tag startedge OK*/
- startedge->f2= 1;
-
- while(looking) {
- looking= 0;
-
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->e4 && efa->f1==0) { /* not done quad */
- if(efa->e1->f1<=2 && efa->e2->f1<=2 && efa->e3->f1<=2 && efa->e4->f1<=2) { /* valence ok */
-
- /* if edge tagged, select opposing edge and mark face ok */
- if(efa->e1->f2) {
- efa->e3->f2= 1;
- efa->f1= 1;
- looking= 1;
- }
- else if(efa->e2->f2) {
- efa->e4->f2= 1;
- efa->f1= 1;
- looking= 1;
- }
- if(efa->e3->f2) {
- efa->e1->f2= 1;
- efa->f1= 1;
- looking= 1;
- }
- if(efa->e4->f2) {
- efa->e2->f2= 1;
- efa->f1= 1;
- looking= 1;
- }
- }
- }
- }
- }
-
- /* (de)select the faces */
- if(select!=2) {
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->f1) EM_select_face(efa, select);
- }
- }
-}
-
-
-/* helper for edgeloop_select, checks for eed->f2 tag in faces */
-static int edge_not_in_tagged_face(EditEdge *eed)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
-
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->h==0) {
- if(efa->e1==eed || efa->e2==eed || efa->e3==eed || efa->e4==eed) { /* edge is in face */
- if(efa->e1->f2 || efa->e2->f2 || efa->e3->f2 || (efa->e4 && efa->e4->f2)) { /* face is tagged */
- return 0;
- }
- }
- }
- }
- return 1;
-}
-
-/* selects or deselects edges that:
-- if edges has 2 faces:
- - has vertices with valence of 4
- - not shares face with previous edge
-- if edge has 1 face:
- - has vertices with valence 4
- - not shares face with previous edge
- - but also only 1 face
-- if edge no face:
- - has vertices with valence 2
-*/
-static void edgeloop_select(EditEdge *starteed, int select)
-{
- EditMesh *em = G.editMesh;
- EditVert *eve;
- EditEdge *eed;
- EditFace *efa;
- int looking= 1;
-
- /* in f1 we put the valence (amount of edges in a vertex, or faces in edge) */
- /* in eed->f2 and efa->f1 we put tagged flag as correct loop */
- for(eve= em->verts.first; eve; eve= eve->next) {
- eve->f1= 0;
- eve->f2= 0;
- }
- for(eed= em->edges.first; eed; eed= eed->next) {
- eed->f1= 0;
- eed->f2= 0;
- if((eed->h & 1)==0) { /* fgon edges add to valence too */
- eed->v1->f1++; eed->v2->f1++;
- }
- }
- for(efa= em->faces.first; efa; efa= efa->next) {
- efa->f1= 0;
- if(efa->h==0) {
- efa->e1->f1++;
- efa->e2->f1++;
- efa->e3->f1++;
- if(efa->e4) efa->e4->f1++;
- }
- }
-
- /* looped edges & vertices get tagged f2 */
- starteed->f2= 1;
- if(starteed->v1->f1<5) starteed->v1->f2= 1;
- if(starteed->v2->f1<5) starteed->v2->f2= 1;
- /* sorry, first edge isnt even ok */
- if(starteed->v1->f2==0 && starteed->v2->f2==0) looking= 0;
-
- while(looking) {
- looking= 0;
-
- /* find correct valence edges which are not tagged yet, but connect to tagged one */
- for(eed= em->edges.first; eed; eed= eed->next) {
- if(eed->h==0 && eed->f2==0) { /* edge not hidden, not tagged */
- if( (eed->v1->f1<5 && eed->v1->f2) || (eed->v2->f1<5 && eed->v2->f2)) { /* valence of vertex OK, and is tagged */
- /* new edge is not allowed to be in face with tagged edge */
- if(edge_not_in_tagged_face(eed)) {
- if(eed->f1==starteed->f1) { /* same amount of faces */
- looking= 1;
- eed->f2= 1;
- if(eed->v2->f1<5) eed->v2->f2= 1;
- if(eed->v1->f1<5) eed->v1->f2= 1;
- }
- }
- }
- }
- }
- }
- /* and we do the select */
- for(eed= em->edges.first; eed; eed= eed->next) {
- if(eed->f2) EM_select_edge(eed, select);
- }
-}
-
-/*
- Almostly exactly the same code as faceloop select
-*/
-static void edgering_select(EditEdge *startedge, int select){
- EditMesh *em = G.editMesh;
- EditEdge *eed;
- EditFace *efa;
- int looking= 1;
-
- /* in eed->f1 we put the valence (amount of faces in edge) */
- /* in eed->f2 we put tagged flag as correct loop */
- /* in efa->f1 we put tagged flag as correct to select */
-
- for(eed= em->edges.first; eed; eed= eed->next) {
- eed->f1= 0;
- eed->f2= 0;
- }
- for(efa= em->faces.first; efa; efa= efa->next) {
- efa->f1= 0;
- if(efa->h==0) {
- efa->e1->f1++;
- efa->e2->f1++;
- efa->e3->f1++;
- if(efa->e4) efa->e4->f1++;
- }
- }
-
- /* tag startedge OK */
- startedge->f2= 1;
-
- while(looking) {
- looking= 0;
-
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->e4 && efa->f1==0 && !efa->h) { /* not done quad */
- if(efa->e1->f1<=2 && efa->e2->f1<=2 && efa->e3->f1<=2 && efa->e4->f1<=2) { /* valence ok */
-
- /* if edge tagged, select opposing edge and mark face ok */
- if(efa->e1->f2) {
- efa->e3->f2= 1;
- efa->f1= 1;
- looking= 1;
- }
- else if(efa->e2->f2) {
- efa->e4->f2= 1;
- efa->f1= 1;
- looking= 1;
- }
- if(efa->e3->f2) {
- efa->e1->f2= 1;
- efa->f1= 1;
- looking= 1;
- }
- if(efa->e4->f2) {
- efa->e2->f2= 1;
- efa->f1= 1;
- looking= 1;
- }
- }
- }
- }
- }
-
- /* (de)select the edges */
- for(eed= em->edges.first; eed; eed= eed->next) {
- if(eed->f2) EM_select_edge(eed, select);
- }
-}
-
-void loop_multiselect(int looptype)
-{
- EditEdge *eed;
- EditEdge **edarray;
- int edindex, edfirstcount;
-
- /*edarray = MEM_mallocN(sizeof(*edarray)*G.totedgesel,"edge array");*/
- edarray = MEM_mallocN(sizeof(EditEdge*)*G.totedgesel,"edge array");
- edindex = 0;
- edfirstcount = G.totedgesel;
-
- for(eed=G.editMesh->edges.first; eed; eed=eed->next){
- if(eed->f&SELECT){
- edarray[edindex] = eed;
- edindex += 1;
- }
- }
-
- if(looptype){
- for(edindex = 0; edindex < edfirstcount; edindex +=1){
- eed = edarray[edindex];
- edgering_select(eed,SELECT);
- }
- countall();
- EM_selectmode_flush();
- BIF_undo_push("Edge Ring Multi-Select");
- }
- else{
- for(edindex = 0; edindex < edfirstcount; edindex +=1){
- eed = edarray[edindex];
- edgeloop_select(eed,SELECT);
- }
- countall();
- EM_selectmode_flush();
- BIF_undo_push("Edge Loop Multi-Select");
- }
- MEM_freeN(edarray);
- allqueue(REDRAWVIEW3D,0);
- if (EM_texFaceCheck())
- allqueue(REDRAWIMAGE, 0);
-}
-
-/* ***************** MAIN MOUSE SELECTION ************** */
-
-/* just to have the functions nice together */
-static void mouse_mesh_loop(void)
-{
- EditEdge *eed;
- int select= 1;
- int dist= 50;
-
- eed= findnearestedge(&dist);
- if(eed) {
-
- if((G.qual & LR_SHIFTKEY)==0) EM_clear_flag_all(SELECT);
-
- if((eed->f & SELECT)==0) select=1;
- else if(G.qual & LR_SHIFTKEY) select=0;
-
- if(G.scene->selectmode & SCE_SELECT_FACE) {
- faceloop_select(eed, select);
- }
- else if(G.scene->selectmode & SCE_SELECT_EDGE) {
- if(G.qual == (LR_CTRLKEY | LR_ALTKEY) || G.qual == (LR_CTRLKEY | LR_ALTKEY |LR_SHIFTKEY))
- edgering_select(eed, select);
- else if(G.qual & LR_ALTKEY)
- edgeloop_select(eed, select);
- }
- else if(G.scene->selectmode & SCE_SELECT_VERTEX) {
- if(G.qual == (LR_CTRLKEY | LR_ALTKEY) || G.qual == (LR_CTRLKEY | LR_ALTKEY |LR_SHIFTKEY))
- edgering_select(eed, select);
- else if(G.qual & LR_ALTKEY)
- edgeloop_select(eed, select);
- }
-
- /* frontbuffer draw of last selected only */
- unified_select_draw(NULL, eed, NULL);
-
- EM_selectmode_flush();
- countall();
- allqueue(REDRAWVIEW3D, 0);
- if (EM_texFaceCheck())
- allqueue(REDRAWIMAGE, 0);
- }
-}
-
-
-/* here actual select happens */
-void mouse_mesh(void)
-{
- EditVert *eve;
- EditEdge *eed;
- EditFace *efa;
-
- if(G.qual & LR_ALTKEY) mouse_mesh_loop();
- else if(unified_findnearest(&eve, &eed, &efa)) {
-
- if((G.qual & LR_SHIFTKEY)==0) EM_clear_flag_all(SELECT);
-
- if(efa) {
- /* set the last selected face */
- EM_set_actFace(efa);
-
- if( (efa->f & SELECT)==0 ) {
- EM_store_selection(efa, EDITFACE);
- EM_select_face_fgon(efa, 1);
- }
- else if(G.qual & LR_SHIFTKEY) {
- EM_remove_selection(efa, EDITFACE);
- EM_select_face_fgon(efa, 0);
- }
- }
- else if(eed) {
- if((eed->f & SELECT)==0) {
- EM_store_selection(eed, EDITEDGE);
- EM_select_edge(eed, 1);
- }
- else if(G.qual & LR_SHIFTKEY) {
- EM_remove_selection(eed, EDITEDGE);
- EM_select_edge(eed, 0);
- }
- }
- else if(eve) {
- if((eve->f & SELECT)==0) {
- eve->f |= SELECT;
- EM_store_selection(eve, EDITVERT);
- }
- else if(G.qual & LR_SHIFTKEY){
- EM_remove_selection(eve, EDITVERT);
- eve->f &= ~SELECT;
- }
- }
-
- /* frontbuffer draw of last selected only */
- unified_select_draw(eve, eed, efa);
-
- EM_selectmode_flush();
- countall();
-
- allqueue(REDRAWVIEW3D, 0);
- if (EM_texFaceCheck()) {
- allqueue(REDRAWIMAGE, 0);
- allqueue(REDRAWBUTSEDIT, 0); /* for the texture face panel */
- }
- if (efa && efa->mat_nr != G.obedit->actcol-1) {
- G.obedit->actcol= efa->mat_nr+1;
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWBUTSSHADING, 0);
- BIF_preview_changed(ID_MA);
- }
- }
-
- rightmouse_transform();
-}
-
-
-void selectconnected_mesh_all(void)
-{
- EditMesh *em = G.editMesh;
- EditVert *v1,*v2;
- EditEdge *eed;
- short done=1, toggle=0;
-
- if(em->edges.first==0) return;
-
- while(done==1) {
- done= 0;
-
- toggle++;
- if(toggle & 1) eed= em->edges.first;
- else eed= em->edges.last;
-
- while(eed) {
- v1= eed->v1;
- v2= eed->v2;
- if(eed->h==0) {
- if(v1->f & SELECT) {
- if( (v2->f & SELECT)==0 ) {
- v2->f |= SELECT;
- done= 1;
- }
- }
- else if(v2->f & SELECT) {
- if( (v1->f & SELECT)==0 ) {
- v1->f |= SELECT;
- done= 1;
- }
- }
- }
- if(toggle & 1) eed= eed->next;
- else eed= eed->prev;
- }
- }
-
- /* now use vertex select flag to select rest */
- EM_select_flush();
-
- countall();
-
- allqueue(REDRAWVIEW3D, 0);
- if (EM_texFaceCheck())
- allqueue(REDRAWIMAGE, 0);
- BIF_undo_push("Select Connected (All)");
-}
-
-void selectconnected_mesh(void)
-{
- EditMesh *em = G.editMesh;
- EditVert *eve, *v1, *v2;
- EditEdge *eed;
- EditFace *efa;
- short done=1, sel, toggle=0;
-
- if(em->edges.first==0) return;
-
- if( unified_findnearest(&eve, &eed, &efa)==0 ) {
- error("Nothing indicated ");
- return;
- }
-
- sel= 1;
- if(G.qual & LR_SHIFTKEY) sel=0;
-
- /* clear test flags */
- for(v1= em->verts.first; v1; v1= v1->next) v1->f1= 0;
-
- /* start vertex/face/edge */
- if(eve) eve->f1= 1;
- else if(eed) eed->v1->f1= eed->v2->f1= 1;
- else efa->v1->f1= efa->v2->f1= efa->v3->f1= 1;
-
- /* set flag f1 if affected */
- while(done==1) {
- done= 0;
- toggle++;
-
- if(toggle & 1) eed= em->edges.first;
- else eed= em->edges.last;
-
- while(eed) {
- v1= eed->v1;
- v2= eed->v2;
-
- if(eed->h==0) {
- if(v1->f1 && v2->f1==0) {
- v2->f1= 1;
- done= 1;
- }
- else if(v1->f1==0 && v2->f1) {
- v1->f1= 1;
- done= 1;
- }
- }
-
- if(toggle & 1) eed= eed->next;
- else eed= eed->prev;
- }
- }
-
- /* now use vertex f1 flag to select/deselect */
- for(eed= em->edges.first; eed; eed= eed->next) {
- if(eed->v1->f1 && eed->v2->f1)
- EM_select_edge(eed, sel);
- }
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->v1->f1 && efa->v2->f1 && efa->v3->f1 && (efa->v4==NULL || efa->v4->f1))
- EM_select_face(efa, sel);
- }
- /* no flush needed, connected geometry is done */
-
- countall();
-
- allqueue(REDRAWVIEW3D, 0);
- if (EM_texFaceCheck())
- allqueue(REDRAWIMAGE, 0);
-
- BIF_undo_push("Select Linked");
-
-}
-
-/* for use with selectconnected_delimit_mesh only! */
-#define is_edge_delimit_ok(eed) ((eed->tmp.l == 1) && (eed->seam==0))
-#define is_face_tag(efa) is_edge_delimit_ok(efa->e1) || is_edge_delimit_ok(efa->e2) || is_edge_delimit_ok(efa->e3) || (efa->v4 && is_edge_delimit_ok(efa->e4))
-
-#define face_tag(efa)\
- if(efa->v4) efa->tmp.l= efa->e1->tmp.l= efa->e2->tmp.l= efa->e3->tmp.l= efa->e4->tmp.l= 1;\
- else efa->tmp.l= efa->e1->tmp.l= efa->e2->tmp.l= efa->e3->tmp.l= 1;
-
-/* all - 1) use all faces for extending the selection 2) only use the mouse face
- * sel - 1) select 0) deselect
- * */
-static void selectconnected_delimit_mesh__internal(short all, short sel)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
- short done=1, change=0;
- int dist = 75;
- EditEdge *eed;
- if(em->faces.first==0) return;
-
- /* flag all edges as off*/
- for(eed= em->edges.first; eed; eed= eed->next)
- eed->tmp.l=0;
-
- if (all) {
- for(efa= em->faces.first; efa; efa= efa->next) {
- if (efa->f & SELECT) {
- face_tag(efa);
- } else {
- efa->tmp.l = 0;
- }
- }
- } else {
- EditFace *efa_mouse = findnearestface(&dist);
-
- if( !efa_mouse ) {
- error("Nothing indicated ");
- return;
- }
-
- for(efa= em->faces.first; efa; efa= efa->next) {
- efa->tmp.l = 0;
- }
- efa_mouse->tmp.l = 1;
- face_tag(efa_mouse);
- }
-
- while(done==1) {
- done= 0;
- /* simple algo - select all faces that have a selected edge
- * this intern selects the edge, repeat until nothing is left to do */
- for(efa= em->faces.first; efa; efa= efa->next) {
- if ((efa->tmp.l == 0) && (!efa->h)) {
- if (is_face_tag(efa)) {
- face_tag(efa);
- done= 1;
- }
- }
- }
- }
-
- for(efa= em->faces.first; efa; efa= efa->next) {
- if (efa->tmp.l) {
- if (sel) {
- if (!(efa->f & SELECT)) {
- EM_select_face(efa, 1);
- change = 1;
- }
- } else {
- if (efa->f & SELECT) {
- EM_select_face(efa, 0);
- change = 1;
- }
- }
- }
- }
-
- if (!change)
- return;
-
- if (!sel) /* make sure de-selecting faces didnt de-select the verts/edges connected to selected faces, this is common with boundries */
- for(efa= em->faces.first; efa; efa= efa->next)
- if (efa->f & SELECT)
- EM_select_face(efa, 1);
-
- countall();
-
- allqueue(REDRAWVIEW3D, 0);
- if (EM_texFaceCheck())
- allqueue(REDRAWIMAGE, 0);
-
- BIF_undo_push("Select Linked Delimeted");
-
-}
-
-#undef is_edge_delimit_ok
-#undef is_face_tag
-#undef face_tag
-
-void selectconnected_delimit_mesh(void)
-{
- selectconnected_delimit_mesh__internal(0, ((G.qual & LR_SHIFTKEY)==0));
-}
-void selectconnected_delimit_mesh_all(void)
-{
- selectconnected_delimit_mesh__internal(1, 1);
-}
-
-
-/* swap is 0 or 1, if 1 it hides not selected */
-void hide_mesh(int swap)
-{
- EditMesh *em = G.editMesh;
- EditVert *eve;
- EditEdge *eed;
- EditFace *efa;
- int a;
-
- if(G.obedit==0) return;
-
- /* hide happens on least dominant select mode, and flushes up, not down! (helps preventing errors in subsurf) */
- /* - vertex hidden, always means edge is hidden too
- - edge hidden, always means face is hidden too
- - face hidden, only set face hide
- - then only flush back down what's absolute hidden
- */
- if(G.scene->selectmode & SCE_SELECT_VERTEX) {
- for(eve= em->verts.first; eve; eve= eve->next) {
- if((eve->f & SELECT)!=swap) {
- eve->f &= ~SELECT;
- eve->h= 1;
- }
- }
-
- for(eed= em->edges.first; eed; eed= eed->next) {
- if(eed->v1->h || eed->v2->h) {
- eed->h |= 1;
- eed->f &= ~SELECT;
- }
- }
-
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->e1->h & 1 || efa->e2->h & 1 || efa->e3->h & 1 || (efa->e4 && efa->e4->h & 1)) {
- efa->h= 1;
- efa->f &= ~SELECT;
- }
- }
- }
- else if(G.scene->selectmode & SCE_SELECT_EDGE) {
-
- for(eed= em->edges.first; eed; eed= eed->next) {
- if((eed->f & SELECT)!=swap) {
- eed->h |= 1;
- EM_select_edge(eed, 0);
- }
- }
-
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->e1->h & 1 || efa->e2->h & 1 || efa->e3->h & 1 || (efa->e4 && efa->e4->h & 1)) {
- efa->h= 1;
- efa->f &= ~SELECT;
- }
- }
- }
- else {
-
- for(efa= em->faces.first; efa; efa= efa->next) {
- if((efa->f & SELECT)!=swap) {
- efa->h= 1;
- EM_select_face(efa, 0);
- }
- }
- }
-
- /* flush down, only whats 100% hidden */
- for(eve= em->verts.first; eve; eve= eve->next) eve->f1= 0;
- for(eed= em->edges.first; eed; eed= eed->next) eed->f1= 0;
-
- if(G.scene->selectmode & SCE_SELECT_FACE) {
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->h) a= 1; else a= 2;
- efa->e1->f1 |= a;
- efa->e2->f1 |= a;
- efa->e3->f1 |= a;
- if(efa->e4) efa->e4->f1 |= a;
- }
- }
-
- if(G.scene->selectmode >= SCE_SELECT_EDGE) {
- for(eed= em->edges.first; eed; eed= eed->next) {
- if(eed->f1==1) eed->h |= 1;
- if(eed->h & 1) a= 1; else a= 2;
- eed->v1->f1 |= a;
- eed->v2->f1 |= a;
- }
- }
-
- if(G.scene->selectmode >= SCE_SELECT_VERTEX) {
- for(eve= em->verts.first; eve; eve= eve->next) {
- if(eve->f1==1) eve->h= 1;
- }
- }
-
- G.totedgesel= G.totfacesel= G.totvertsel= 0;
- allqueue(REDRAWVIEW3D, 0);
- if(EM_texFaceCheck())
- allqueue(REDRAWIMAGE, 0);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- BIF_undo_push("Hide");
-}
-
-
-void reveal_mesh(void)
-{
- EditMesh *em = G.editMesh;
- EditVert *eve;
- EditEdge *eed;
- EditFace *efa;
-
- if(G.obedit==0) return;
-
- for(eve= em->verts.first; eve; eve= eve->next) {
- if(eve->h) {
- eve->h= 0;
- eve->f |= SELECT;
- }
- }
- for(eed= em->edges.first; eed; eed= eed->next) {
- if(eed->h & 1) {
- eed->h &= ~1;
- if(G.scene->selectmode & SCE_SELECT_VERTEX);
- else EM_select_edge(eed, 1);
- }
- }
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->h) {
- efa->h= 0;
- if(G.scene->selectmode & (SCE_SELECT_EDGE|SCE_SELECT_VERTEX));
- else EM_select_face(efa, 1);
- }
- }
-
- EM_fgon_flags(); /* redo flags and indices for fgons */
- EM_selectmode_flush();
- countall();
-
- allqueue(REDRAWVIEW3D, 0);
- if (EM_texFaceCheck())
- allqueue(REDRAWIMAGE, 0);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- BIF_undo_push("Reveal");
-}
-
-/* TODO - improve this with sync sel and selection flushing */
-void hide_tface_uv(int swap)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
- MTFace *tface;
-
- if( is_uv_tface_editing_allowed()==0 ) return;
-
- /* call the mesh function if we are in mesh sync sel */
- if (G.sima->flag & SI_SYNC_UVSEL) {
- hide_mesh(swap);
- return;
- }
-
- if(swap) {
- for (efa= em->faces.first; efa; efa= efa->next) {
- if(efa->f & SELECT) {
- tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if((tface->flag & (TF_SEL1|TF_SEL2|TF_SEL3))==0) {
- if(!efa->v4)
- EM_select_face(efa, 0);
- else if(!(tface->flag & TF_SEL4))
- EM_select_face(efa, 0);
- }
- }
- }
- } else {
- for (efa= em->faces.first; efa; efa= efa->next) {
- if(efa->f & SELECT) {
- tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if(tface->flag & (TF_SEL1|TF_SEL2|TF_SEL3))
- EM_select_face(efa, 0);
- else if(efa->v4 && tface->flag & TF_SEL4)
- EM_select_face(efa, 0);
- }
- }
- }
-
- /*deselects too many but ok for now*/
- EM_deselect_flush();
- EM_validate_selections();
-
- BIF_undo_push("Hide UV");
-
- object_tface_flags_changed(OBACT, 0);
-}
-
-void reveal_tface_uv(void)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
- MTFace *tface;
-
- if( is_uv_tface_editing_allowed()==0 ) return;
-
- /* call the mesh function if we are in mesh sync sel */
- if (G.sima->flag & SI_SYNC_UVSEL) {
- reveal_mesh();
- return;
- }
-
- for (efa= em->faces.first; efa; efa= efa->next) {
- if (!(efa->h)) {
- if (!(efa->f & SELECT)) {
- EM_select_face(efa, 1);
- tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- tface->flag |= (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
- }
- }
- }
-
- EM_selectmode_flush();
-
- BIF_undo_push("Reveal UV");
-
- object_tface_flags_changed(OBACT, 0);
-}
-
-void select_faces_by_numverts(int numverts)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
-
- /* Selects trias/qiads or isolated verts, and edges that do not have 2 neighboring
- * faces
- */
-
- /* for loose vertices/edges, we first select all, loop below will deselect */
- if(numverts==5)
- EM_set_flag_all(SELECT);
- else if(G.scene->selectmode!=SCE_SELECT_FACE) {
- error("Only works in face selection mode");
- return;
- }
-
- for(efa= em->faces.first; efa; efa= efa->next) {
- if (efa->e4) {
- EM_select_face(efa, (numverts==4) );
- }
- else {
- EM_select_face(efa, (numverts==3) );
- }
- }
-
- countall();
- addqueue(curarea->win, REDRAW, 0);
- if (EM_texFaceCheck())
- allqueue(REDRAWIMAGE, 0);
-
- if (numverts==3)
- BIF_undo_push("Select Triangles");
- else if (numverts==4)
- BIF_undo_push("Select Quads");
- else
- BIF_undo_push("Select non-Triangles/Quads");
-}
-
-void select_sharp_edges(void)
-{
- /* Find edges that have exactly two neighboring faces,
- * check the angle between those faces, and if angle is
- * small enough, select the edge
- */
- EditMesh *em = G.editMesh;
- EditEdge *eed;
- EditFace *efa;
- EditFace **efa1;
- EditFace **efa2;
- long edgecount = 0, i;
- static short sharpness = 135;
- float fsharpness;
-
- if(G.scene->selectmode==SCE_SELECT_FACE) {
- error("Doesn't work in face selection mode");
- return;
- }
-
- if(button(&sharpness,0, 180,"Max Angle:")==0) return;
- /* if faces are at angle 'sharpness', then the face normals
- * are at angle 180.0 - 'sharpness' (convert to radians too)
- */
- fsharpness = ((180.0 - sharpness) * M_PI) / 180.0;
-
- i=0;
- /* count edges, use tmp.l */
- eed= em->edges.first;
- while(eed) {
- edgecount++;
- eed->tmp.l = i;
- eed= eed->next;
- ++i;
- }
-
- /* for each edge, we want a pointer to two adjacent faces */
- efa1 = MEM_callocN(edgecount*sizeof(EditFace *),
- "pairs of edit face pointers");
- efa2 = MEM_callocN(edgecount*sizeof(EditFace *),
- "pairs of edit face pointers");
-
-#define face_table_edge(eed) { \
- i = eed->tmp.l; \
- if (i != -1) { \
- if (efa1[i]) { \
- if (efa2[i]) { \
- /* invalidate, edge has more than two neighbors */ \
- eed->tmp.l = -1; \
- } \
- else { \
- efa2[i] = efa; \
- } \
- } \
- else { \
- efa1[i] = efa; \
- } \
- } \
- }
-
- /* find the adjacent faces of each edge, we want only two */
- efa= em->faces.first;
- while(efa) {
- face_table_edge(efa->e1);
- face_table_edge(efa->e2);
- face_table_edge(efa->e3);
- if (efa->e4) {
- face_table_edge(efa->e4);
- }
- efa= efa->next;
- }
-
-#undef face_table_edge
-
- eed = em->edges.first;
- while(eed) {
- i = eed->tmp.l;
- if (i != -1) {
- /* edge has two or less neighboring faces */
- if ( (efa1[i]) && (efa2[i]) ) {
- /* edge has exactly two neighboring faces, check angle */
- float angle;
- angle = saacos(efa1[i]->n[0]*efa2[i]->n[0] +
- efa1[i]->n[1]*efa2[i]->n[1] +
- efa1[i]->n[2]*efa2[i]->n[2]);
- if (fabs(angle) >= fsharpness)
- EM_select_edge(eed, 1);
- }
- }
-
- eed= eed->next;
- }
-
- MEM_freeN(efa1);
- MEM_freeN(efa2);
-
- countall();
- addqueue(curarea->win, REDRAW, 0);
- if (EM_texFaceCheck())
- allqueue(REDRAWIMAGE, 0);
-
- BIF_undo_push("Select Sharp Edges");
-}
-
-void select_linked_flat_faces(void)
-{
- /* Find faces that are linked to selected faces that are
- * relatively flat (angle between faces is higher than
- * specified angle)
- */
- EditMesh *em = G.editMesh;
- EditEdge *eed;
- EditFace *efa;
- EditFace **efa1;
- EditFace **efa2;
- long edgecount = 0, i, faceselcount=0, faceselcountold=0;
- static short sharpness = 135;
- float fsharpness;
-
- if(G.scene->selectmode!=SCE_SELECT_FACE) {
- error("Only works in face selection mode");
- return;
- }
-
- if(button(&sharpness,0, 180,"Min Angle:")==0) return;
- /* if faces are at angle 'sharpness', then the face normals
- * are at angle 180.0 - 'sharpness' (convert to radians too)
- */
- fsharpness = ((180.0 - sharpness) * M_PI) / 180.0;
-
- i=0;
- /* count edges, use tmp.l */
- eed= em->edges.first;
- while(eed) {
- edgecount++;
- eed->tmp.l = i;
- eed= eed->next;
- ++i;
- }
-
- /* for each edge, we want a pointer to two adjacent faces */
- efa1 = MEM_callocN(edgecount*sizeof(EditFace *),
- "pairs of edit face pointers");
- efa2 = MEM_callocN(edgecount*sizeof(EditFace *),
- "pairs of edit face pointers");
-
-#define face_table_edge(eed) { \
- i = eed->tmp.l; \
- if (i != -1) { \
- if (efa1[i]) { \
- if (efa2[i]) { \
- /* invalidate, edge has more than two neighbors */ \
- eed->tmp.l = -1; \
- } \
- else { \
- efa2[i] = efa; \
- } \
- } \
- else { \
- efa1[i] = efa; \
- } \
- } \
- }
-
- /* find the adjacent faces of each edge, we want only two */
- efa= em->faces.first;
- while(efa) {
- face_table_edge(efa->e1);
- face_table_edge(efa->e2);
- face_table_edge(efa->e3);
- if (efa->e4) {
- face_table_edge(efa->e4);
- }
-
- /* while were at it, count the selected faces */
- if (efa->f & SELECT) ++faceselcount;
-
- efa= efa->next;
- }
-
-#undef face_table_edge
-
- eed= em->edges.first;
- while(eed) {
- i = eed->tmp.l;
- if (i != -1) {
- /* edge has two or less neighboring faces */
- if ( (efa1[i]) && (efa2[i]) ) {
- /* edge has exactly two neighboring faces, check angle */
- float angle;
- angle = saacos(efa1[i]->n[0]*efa2[i]->n[0] +
- efa1[i]->n[1]*efa2[i]->n[1] +
- efa1[i]->n[2]*efa2[i]->n[2]);
- /* invalidate: edge too sharp */
- if (fabs(angle) >= fsharpness)
- eed->tmp.l = -1;
- }
- else {
- /* invalidate: less than two neighbors */
- eed->tmp.l = -1;
- }
- }
-
- eed= eed->next;
- }
-
-#define select_flat_neighbor(eed) { \
- i = eed->tmp.l; \
- if (i!=-1) { \
- if (! (efa1[i]->f & SELECT) ) { \
- EM_select_face(efa1[i], 1); \
- ++faceselcount; \
- } \
- if (! (efa2[i]->f & SELECT) ) { \
- EM_select_face(efa2[i], 1); \
- ++faceselcount; \
- } \
- } \
- }
-
- while (faceselcount != faceselcountold) {
- faceselcountold = faceselcount;
-
- efa= em->faces.first;
- while(efa) {
- if (efa->f & SELECT) {
- select_flat_neighbor(efa->e1);
- select_flat_neighbor(efa->e2);
- select_flat_neighbor(efa->e3);
- if (efa->e4) {
- select_flat_neighbor(efa->e4);
- }
- }
- efa= efa->next;
- }
- }
-
-#undef select_flat_neighbor
-
- MEM_freeN(efa1);
- MEM_freeN(efa2);
-
- countall();
- addqueue(curarea->win, REDRAW, 0);
- if (EM_texFaceCheck())
- allqueue(REDRAWIMAGE, 0);
- BIF_undo_push("Select Linked Flat Faces");
-}
-
-void select_non_manifold(void)
-{
- EditMesh *em = G.editMesh;
- EditVert *eve;
- EditEdge *eed;
- EditFace *efa;
-
- /* Selects isolated verts, and edges that do not have 2 neighboring
- * faces
- */
-
- if(G.scene->selectmode==SCE_SELECT_FACE) {
- error("Doesn't work in face selection mode");
- return;
- }
-
- eve= em->verts.first;
- while(eve) {
- /* this will count how many edges are connected
- * to this vert */
- eve->f1= 0;
- eve= eve->next;
- }
-
- eed= em->edges.first;
- while(eed) {
- /* this will count how many faces are connected to
- * this edge */
- eed->f1= 0;
- /* increase edge count for verts */
- ++eed->v1->f1;
- ++eed->v2->f1;
- eed= eed->next;
- }
-
- efa= em->faces.first;
- while(efa) {
- /* increase face count for edges */
- ++efa->e1->f1;
- ++efa->e2->f1;
- ++efa->e3->f1;
- if (efa->e4)
- ++efa->e4->f1;
- efa= efa->next;
- }
-
- /* select verts that are attached to an edge that does not
- * have 2 neighboring faces */
- eed= em->edges.first;
- while(eed) {
- if (eed->h==0 && eed->f1 != 2) {
- EM_select_edge(eed, 1);
- }
- eed= eed->next;
- }
-
- /* select isolated verts */
- eve= em->verts.first;
- while(eve) {
- if (eve->f1 == 0) {
- if (!eve->h) eve->f |= SELECT;
- }
- eve= eve->next;
- }
-
- countall();
- addqueue(curarea->win, REDRAW, 0);
- if (EM_texFaceCheck())
- allqueue(REDRAWIMAGE, 0);
- BIF_undo_push("Select Non Manifold");
-}
-
-void selectswap_mesh(void) /* UI level */
-{
- EditMesh *em = G.editMesh;
- EditVert *eve;
- EditEdge *eed;
- EditFace *efa;
-
- if(G.scene->selectmode & SCE_SELECT_VERTEX) {
-
- for(eve= em->verts.first; eve; eve= eve->next) {
- if(eve->h==0) {
- if(eve->f & SELECT) eve->f &= ~SELECT;
- else eve->f|= SELECT;
- }
- }
- }
- else if(G.scene->selectmode & SCE_SELECT_EDGE) {
- for(eed= em->edges.first; eed; eed= eed->next) {
- if(eed->h==0) {
- EM_select_edge(eed, !(eed->f & SELECT));
- }
- }
- }
- else {
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->h==0) {
- EM_select_face(efa, !(efa->f & SELECT));
- }
- }
- }
-
- EM_selectmode_flush();
-
- countall();
- allqueue(REDRAWVIEW3D, 0);
- if (EM_texFaceCheck())
- allqueue(REDRAWIMAGE, 0);
-
- BIF_undo_push("Select Swap");
-
-}
-
-void deselectall_mesh(void) /* this toggles!!!, UI level */
-{
-
- if(G.obedit->lay & G.vd->lay) {
-
- if( EM_nvertices_selected() ) {
- EM_clear_flag_all(SELECT);
- BIF_undo_push("Deselect All");
- }
- else {
- EM_set_flag_all(SELECT);
- BIF_undo_push("Select All");
- }
-
- countall();
-
- if (EM_texFaceCheck())
- allqueue(REDRAWIMAGE, 0);
-
- allqueue(REDRAWVIEW3D, 0);
- }
-}
-
-void select_more(void)
-{
- EditMesh *em = G.editMesh;
- EditVert *eve;
- EditEdge *eed;
- EditFace *efa;
-
- for(eve= em->verts.first; eve; eve= eve->next) {
- if(eve->f & SELECT) eve->f1= 1;
- else eve->f1 = 0;
- }
-
- /* set f1 flags in vertices to select 'more' */
- for(eed= em->edges.first; eed; eed= eed->next) {
- if(eed->h==0) {
- if (eed->v1->f & SELECT)
- eed->v2->f1 = 1;
- if (eed->v2->f & SELECT)
- eed->v1->f1 = 1;
- }
- }
-
- /* new selected edges, but not in facemode */
- if(G.scene->selectmode <= SCE_SELECT_EDGE) {
-
- for(eed= em->edges.first; eed; eed= eed->next) {
- if(eed->h==0) {
- if(eed->v1->f1 && eed->v2->f1) EM_select_edge(eed, 1);
- }
- }
- }
- /* new selected faces */
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->h==0) {
- if(efa->v1->f1 && efa->v2->f1 && efa->v3->f1 && (efa->v4==NULL || efa->v4->f1))
- EM_select_face(efa, 1);
- }
- }
-
- countall();
- addqueue(curarea->win, REDRAW, 0);
- if (EM_texFaceCheck())
- allqueue(REDRAWIMAGE, 0);
- BIF_undo_push("Select More");
-}
-
-void select_less(void)
-{
- EditMesh *em = G.editMesh;
- EditEdge *eed;
- EditFace *efa;
-
- if(G.scene->selectmode <= SCE_SELECT_EDGE) {
- /* eed->f1 == 1: edge with a selected and deselected vert */
-
- for(eed= em->edges.first; eed; eed= eed->next) {
- eed->f1= 0;
- if(eed->h==0) {
-
- if ( !(eed->v1->f & SELECT) && (eed->v2->f & SELECT) )
- eed->f1= 1;
- if ( (eed->v1->f & SELECT) && !(eed->v2->f & SELECT) )
- eed->f1= 1;
- }
- }
-
- /* deselect edges with flag set */
- for(eed= em->edges.first; eed; eed= eed->next) {
- if (eed->h==0 && eed->f1 == 1) {
- EM_select_edge(eed, 0);
- }
- }
- EM_deselect_flush();
-
- }
- else {
- /* deselect faces with 1 or more deselect edges */
- /* eed->f1 == mixed selection edge */
- for(eed= em->edges.first; eed; eed= eed->next) eed->f1= 0;
-
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->h==0) {
- if(efa->f & SELECT) {
- efa->e1->f1 |= 1;
- efa->e2->f1 |= 1;
- efa->e3->f1 |= 1;
- if(efa->e4) efa->e4->f1 |= 1;
- }
- else {
- efa->e1->f1 |= 2;
- efa->e2->f1 |= 2;
- efa->e3->f1 |= 2;
- if(efa->e4) efa->e4->f1 |= 2;
- }
- }
- }
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->h==0) {
- if(efa->e1->f1==3 || efa->e2->f1==3 || efa->e3->f1==3 || (efa->e4 && efa->e4->f1==3)) {
- EM_select_face(efa, 0);
- }
- }
- }
- EM_selectmode_flush();
-
- }
-
- countall();
- BIF_undo_push("Select Less");
- allqueue(REDRAWVIEW3D, 0);
- if (EM_texFaceCheck())
- allqueue(REDRAWIMAGE, 0);
-}
-
-
-void selectrandom_mesh(void) /* randomly selects a user-set % of vertices/edges/faces */
-{
- EditMesh *em = G.editMesh;
- EditVert *eve;
- EditEdge *eed;
- EditFace *efa;
- static short randfac = 50;
-
- if(G.obedit==NULL || (G.obedit->lay & G.vd->lay)==0) return;
-
- /* Get the percentage of vertices to randomly select as 'randfac' */
- if(button(&randfac,0, 100,"Percentage:")==0) return;
-
- BLI_srand( BLI_rand() ); /* random seed */
-
- if(G.scene->selectmode & SCE_SELECT_VERTEX) {
- for(eve= em->verts.first; eve; eve= eve->next) {
- if(eve->h==0) {
- if ( (BLI_frand() * 100) < randfac)
- eve->f |= SELECT;
- }
- }
- EM_selectmode_flush();
- countall();
- BIF_undo_push("Select Random: Vertices");
- }
- else if(G.scene->selectmode & SCE_SELECT_EDGE) {
- for(eed= em->edges.first; eed; eed= eed->next) {
- if(eed->h==0) {
- if ( (BLI_frand() * 100) < randfac)
- EM_select_edge(eed, 1);
- }
- }
- EM_selectmode_flush();
- countall();
- BIF_undo_push("Select Random:Edges");
- }
- else {
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->h==0) {
- if ( (BLI_frand() * 100) < randfac)
- EM_select_face(efa, 1);
- }
- }
-
- EM_selectmode_flush();
- countall();
- BIF_undo_push("Select Random:Faces");
- }
- allqueue(REDRAWVIEW3D, 0);
- if (EM_texFaceCheck())
- allqueue(REDRAWIMAGE, 0);
-}
-
-void editmesh_select_by_material(int index)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
-
- for (efa=em->faces.first; efa; efa= efa->next) {
- if (efa->mat_nr==index) {
- EM_select_face(efa, 1);
- }
- }
-
- EM_selectmode_flush();
-}
-
-void editmesh_deselect_by_material(int index)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
-
- for (efa=em->faces.first; efa; efa= efa->next) {
- if (efa->mat_nr==index) {
- EM_select_face(efa, 0);
- }
- }
-
- EM_selectmode_flush();
-}
-
-void EM_selectmode_menu(void)
-{
- int val;
-
- if(G.scene->selectmode & SCE_SELECT_VERTEX) pupmenu_set_active(1);
- else if(G.scene->selectmode & SCE_SELECT_EDGE) pupmenu_set_active(2);
- else pupmenu_set_active(3);
-
- val= pupmenu("Select Mode%t|Vertices|Edges|Faces");
-
-
- if(val>0) {
- if(val==1){
- G.scene->selectmode= SCE_SELECT_VERTEX;
- EM_selectmode_set();
- countall();
- BIF_undo_push("Selectmode Set: Vertex");
- }
- else if(val==2){
- if((G.qual==LR_CTRLKEY)) EM_convertsel(G.scene->selectmode, SCE_SELECT_EDGE);
- G.scene->selectmode= SCE_SELECT_EDGE;
- EM_selectmode_set();
- countall();
- BIF_undo_push("Selectmode Set: Edge");
- }
-
- else{
- if((G.qual==LR_CTRLKEY)) EM_convertsel(G.scene->selectmode, SCE_SELECT_FACE);
- G.scene->selectmode= SCE_SELECT_FACE;
- EM_selectmode_set();
- countall();
- BIF_undo_push("Selectmode Set: Vertex");
- }
-
- allqueue(REDRAWVIEW3D, 1);
- if (EM_texFaceCheck())
- allqueue(REDRAWIMAGE, 0);
- }
-}
-
-/* ************************* SEAMS AND EDGES **************** */
-
-void editmesh_mark_seam(int clear)
-{
- EditMesh *em= G.editMesh;
- EditEdge *eed;
-
- if(multires_level1_test()) return;
-
- /* auto-enable seams drawing */
- if(clear==0) {
- if(!(G.f & G_DRAWSEAMS)) {
- G.f |= G_DRAWSEAMS;
- allqueue(REDRAWBUTSEDIT, 0);
- }
- }
-
- if(clear) {
- eed= em->edges.first;
- while(eed) {
- if((eed->h==0) && (eed->f & SELECT)) {
- eed->seam = 0;
- }
- eed= eed->next;
- }
- BIF_undo_push("Mark Seam");
- }
- else {
- eed= em->edges.first;
- while(eed) {
- if((eed->h==0) && (eed->f & SELECT)) {
- eed->seam = 1;
- }
- eed= eed->next;
- }
- BIF_undo_push("Clear Seam");
- }
-
- allqueue(REDRAWVIEW3D, 0);
-}
-
-void editmesh_mark_sharp(int set)
-{
- EditMesh *em= G.editMesh;
- EditEdge *eed;
-
-#if 0
- /* auto-enable sharp edge drawing */
- if(set) {
- if(!(G.f & G_DRAWSEAMS)) {
- G.f |= G_DRAWSEAMS;
- allqueue(REDRAWBUTSEDIT, 0);
- }
- }
-#endif
-
- if(multires_level1_test()) return;
-
- if(set) {
- eed= em->edges.first;
- while(eed) {
- if(!eed->h && (eed->f & SELECT)) eed->sharp = 1;
- eed = eed->next;
- }
- } else {
- eed= em->edges.first;
- while(eed) {
- if(!eed->h && (eed->f & SELECT)) eed->sharp = 0;
- eed = eed->next;
- }
- }
-
- allqueue(REDRAWVIEW3D, 0);
-}
-
-void BME_Menu() {
- short ret;
- ret= pupmenu("BME modeller%t|Select Edges of Vert%x1");
-
- switch(ret)
- {
- case 1:
- //BME_edges_of_vert();
- break;
- }
-}
-
-
-
-void Vertex_Menu() {
- short ret;
- ret= pupmenu("Vertex Specials%t|Remove Doubles%x1|Merge%x2|Smooth %x3|Select Vertex Path%x4|Blend From Shape%x5|Propagate To All Shapes%x6");
-
- switch(ret)
- {
- case 1:
- notice("Removed %d Vertices", removedoublesflag(1, 0, G.scene->toolsettings->doublimit));
- BIF_undo_push("Remove Doubles");
- break;
- case 2:
- mergemenu();
- break;
- case 3:
- vertexsmooth();
- break;
- case 4:
- pathselect();
- BIF_undo_push("Select Vertex Path");
- break;
- case 5:
- shape_copy_select_from();
- break;
- case 6:
- shape_propagate();
- break;
- }
- /* some items crashed because this is in the original W menu but not here. should really manage this better */
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-}
-
-
-void Edge_Menu() {
- short ret;
-
- ret= pupmenu("Edge Specials%t|Mark Seam %x1|Clear Seam %x2|Rotate Edge CW%x3|Rotate Edge CCW%x4|Loopcut%x6|Edge Slide%x5|Edge Loop Select%x7|Edge Ring Select%x8|Loop to Region%x9|Region to Loop%x10|Mark Sharp%x11|Clear Sharp%x12");
-
- switch(ret)
- {
- case 1:
- editmesh_mark_seam(0);
- break;
- case 2:
- editmesh_mark_seam(1);
- break;
- case 3:
- edge_rotate_selected(2);
- break;
- case 4:
- edge_rotate_selected(1);
- break;
- case 5:
- EdgeSlide(0,0.0);
- BIF_undo_push("EdgeSlide");
- break;
- case 6:
- CutEdgeloop(1);
- BIF_undo_push("Loopcut New");
- break;
- case 7:
- loop_multiselect(0);
- break;
- case 8:
- loop_multiselect(1);
- break;
- case 9:
- loop_to_region();
- break;
- case 10:
- region_to_loop();
- break;
- case 11:
- editmesh_mark_sharp(1);
- BIF_undo_push("Mark Sharp");
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- break;
- case 12:
- editmesh_mark_sharp(0);
- BIF_undo_push("Clear Sharp");
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- break;
- }
- /* some items crashed because this is in the original W menu but not here. should really manage this better */
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-}
-
-void Face_Menu() {
- short ret;
- ret= pupmenu(
- "Face Specials%t|Flip Normals%x1|Bevel%x2|Shade Smooth%x3|Shade Flat%x4|"
- "Triangulate (Ctrl T)%x5|Quads from Triangles (Alt J)%x6|Flip Triangle Edges (Ctrl Shift F)%x7|%l|"
- "Face Mode Set%x8|Face Mode Clear%x9|%l|"
- "UV Rotate (Shift - CCW)%x10|UV Mirror (Shift - Switch Axis)%x11|"
- "Color Rotate (Shift - CCW)%x12|Color Mirror (Shift - Switch Axis)%x13");
-
- switch(ret)
- {
- case 1:
- flip_editnormals();
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- BIF_undo_push("Flip Normals");
- allqueue(REDRAWVIEW3D, 0);
- break;
- case 2:
- bevel_menu();
- break;
- case 3:
- mesh_set_smooth_faces(1);
- break;
- case 4:
- mesh_set_smooth_faces(0);
- break;
-
- case 5: /* Quads to Tris */
- convert_to_triface(0);
- allqueue(REDRAWVIEW3D, 0);
- countall();
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- break;
- case 6: /* Tris to Quads */
- join_triangles();
- break;
- case 7: /* Flip triangle edges */
- edge_flip();
- break;
- case 8:
- mesh_set_face_flags(1);
- break;
- case 9:
- mesh_set_face_flags(0);
- break;
-
- /* uv texface options */
- case 10:
- mesh_rotate_uvs();
- break;
- case 11:
- mesh_mirror_uvs();
- break;
- case 12:
- mesh_rotate_colors();
- break;
- case 13:
- mesh_mirror_colors();
- break;
- }
- /* some items crashed because this is in the original W menu but not here. should really manage this better */
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-}
-
-
-/* **************** NORMALS ************** */
-
-void righthandfaces(int select) /* makes faces righthand turning */
-{
- EditMesh *em = G.editMesh;
- EditEdge *eed, *ed1, *ed2, *ed3, *ed4;
- EditFace *efa, *startvl;
- float maxx, nor[3], cent[3];
- int totsel, found, foundone, direct, turn, tria_nr;
-
- /* based at a select-connected to witness loose objects */
-
- /* count per edge the amount of faces */
-
- /* find the ultimate left, front, upper face (not manhattan dist!!) */
- /* also evaluate both triangle cases in quad, since these can be non-flat */
-
- /* put normal to the outside, and set the first direction flags in edges */
-
- /* then check the object, and set directions / direction-flags: but only for edges with 1 or 2 faces */
- /* this is in fact the 'select connected' */
-
- /* in case (selected) faces were not done: start over with 'find the ultimate ...' */
-
- waitcursor(1);
-
- eed= em->edges.first;
- while(eed) {
- eed->f2= 0; /* edge direction */
- eed->f1= 0; /* counter */
- eed= eed->next;
- }
-
- /* count faces and edges */
- totsel= 0;
- efa= em->faces.first;
- while(efa) {
- if(select==0 || (efa->f & SELECT) ) {
- efa->f1= 1;
- totsel++;
- efa->e1->f1++;
- efa->e2->f1++;
- efa->e3->f1++;
- if(efa->v4) efa->e4->f1++;
- }
- else efa->f1= 0;
-
- efa= efa->next;
- }
-
- while(totsel>0) {
- /* from the outside to the inside */
-
- efa= em->faces.first;
- startvl= NULL;
- maxx= -1.0e10;
- tria_nr= 0;
-
- while(efa) {
- if(efa->f1) {
- CalcCent3f(cent, efa->v1->co, efa->v2->co, efa->v3->co);
- cent[0]= cent[0]*cent[0] + cent[1]*cent[1] + cent[2]*cent[2];
-
- if(cent[0]>maxx) {
- maxx= cent[0];
- startvl= efa;
- tria_nr= 0;
- }
- if(efa->v4) {
- CalcCent3f(cent, efa->v1->co, efa->v3->co, efa->v4->co);
- cent[0]= cent[0]*cent[0] + cent[1]*cent[1] + cent[2]*cent[2];
-
- if(cent[0]>maxx) {
- maxx= cent[0];
- startvl= efa;
- tria_nr= 1;
- }
- }
- }
- efa= efa->next;
- }
-
- if (startvl==NULL)
- startvl= em->faces.first;
-
- /* set first face correct: calc normal */
-
- if(tria_nr==1) {
- CalcNormFloat(startvl->v1->co, startvl->v3->co, startvl->v4->co, nor);
- CalcCent3f(cent, startvl->v1->co, startvl->v3->co, startvl->v4->co);
- } else {
- CalcNormFloat(startvl->v1->co, startvl->v2->co, startvl->v3->co, nor);
- CalcCent3f(cent, startvl->v1->co, startvl->v2->co, startvl->v3->co);
- }
- /* first normal is oriented this way or the other */
- if(select) {
- if(select==2) {
- if(cent[0]*nor[0]+cent[1]*nor[1]+cent[2]*nor[2] > 0.0) flipface(startvl);
- }
- else {
- if(cent[0]*nor[0]+cent[1]*nor[1]+cent[2]*nor[2] < 0.0) flipface(startvl);
- }
- }
- else if(cent[0]*nor[0]+cent[1]*nor[1]+cent[2]*nor[2] < 0.0) flipface(startvl);
-
-
- eed= startvl->e1;
- if(eed->v1==startvl->v1) eed->f2= 1;
- else eed->f2= 2;
-
- eed= startvl->e2;
- if(eed->v1==startvl->v2) eed->f2= 1;
- else eed->f2= 2;
-
- eed= startvl->e3;
- if(eed->v1==startvl->v3) eed->f2= 1;
- else eed->f2= 2;
-
- eed= startvl->e4;
- if(eed) {
- if(eed->v1==startvl->v4) eed->f2= 1;
- else eed->f2= 2;
- }
-
- startvl->f1= 0;
- totsel--;
-
- /* test normals */
- found= 1;
- direct= 1;
- while(found) {
- found= 0;
- if(direct) efa= em->faces.first;
- else efa= em->faces.last;
- while(efa) {
- if(efa->f1) {
- turn= 0;
- foundone= 0;
-
- ed1= efa->e1;
- ed2= efa->e2;
- ed3= efa->e3;
- ed4= efa->e4;
-
- if(ed1->f2) {
- if(ed1->v1==efa->v1 && ed1->f2==1) turn= 1;
- if(ed1->v2==efa->v1 && ed1->f2==2) turn= 1;
- foundone= 1;
- }
- else if(ed2->f2) {
- if(ed2->v1==efa->v2 && ed2->f2==1) turn= 1;
- if(ed2->v2==efa->v2 && ed2->f2==2) turn= 1;
- foundone= 1;
- }
- else if(ed3->f2) {
- if(ed3->v1==efa->v3 && ed3->f2==1) turn= 1;
- if(ed3->v2==efa->v3 && ed3->f2==2) turn= 1;
- foundone= 1;
- }
- else if(ed4 && ed4->f2) {
- if(ed4->v1==efa->v4 && ed4->f2==1) turn= 1;
- if(ed4->v2==efa->v4 && ed4->f2==2) turn= 1;
- foundone= 1;
- }
-
- if(foundone) {
- found= 1;
- totsel--;
- efa->f1= 0;
-
- if(turn) {
- if(ed1->v1==efa->v1) ed1->f2= 2;
- else ed1->f2= 1;
- if(ed2->v1==efa->v2) ed2->f2= 2;
- else ed2->f2= 1;
- if(ed3->v1==efa->v3) ed3->f2= 2;
- else ed3->f2= 1;
- if(ed4) {
- if(ed4->v1==efa->v4) ed4->f2= 2;
- else ed4->f2= 1;
- }
-
- flipface(efa);
-
- }
- else {
- if(ed1->v1== efa->v1) ed1->f2= 1;
- else ed1->f2= 2;
- if(ed2->v1==efa->v2) ed2->f2= 1;
- else ed2->f2= 2;
- if(ed3->v1==efa->v3) ed3->f2= 1;
- else ed3->f2= 2;
- if(ed4) {
- if(ed4->v1==efa->v4) ed4->f2= 1;
- else ed4->f2= 2;
- }
- }
- }
- }
- if(direct) efa= efa->next;
- else efa= efa->prev;
- }
- direct= 1-direct;
- }
- }
-
- recalc_editnormals();
-
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-
-#ifdef WITH_VERSE
- if(G.editMesh->vnode)
- sync_all_versefaces_with_editfaces((VNode*)G.editMesh->vnode);
-#endif
-
- waitcursor(0);
-}
-
-
-/* ********** ALIGN WITH VIEW **************** */
-
-
-static void editmesh_calc_selvert_center(float cent_r[3])
-{
- EditMesh *em = G.editMesh;
- EditVert *eve;
- int nsel= 0;
-
- cent_r[0]= cent_r[1]= cent_r[0]= 0.0;
-
- for (eve= em->verts.first; eve; eve= eve->next) {
- if (eve->f & SELECT) {
- cent_r[0]+= eve->co[0];
- cent_r[1]+= eve->co[1];
- cent_r[2]+= eve->co[2];
- nsel++;
- }
- }
-
- if (nsel) {
- cent_r[0]/= nsel;
- cent_r[1]/= nsel;
- cent_r[2]/= nsel;
- }
-}
-
-static int mface_is_selected(MFace *mf)
-{
- return (!(mf->flag & ME_HIDE) && (mf->flag & ME_FACE_SEL));
-}
-
- /* XXX, code for both these functions should be abstract,
- * then unified, then written for other things (like objects,
- * which would use same as vertices method), then added
- * to interface! Hoera! - zr
- */
-void faceselect_align_view_to_selected(View3D *v3d, Mesh *me, int axis)
-{
- float norm[3];
- int i, totselected = 0;
-
- norm[0]= norm[1]= norm[2]= 0.0;
- for (i=0; i<me->totface; i++) {
- MFace *mf= ((MFace*) me->mface) + i;
-
- if (mface_is_selected(mf)) {
- float *v1, *v2, *v3, fno[3];
-
- v1= me->mvert[mf->v1].co;
- v2= me->mvert[mf->v2].co;
- v3= me->mvert[mf->v3].co;
- if (mf->v4) {
- float *v4= me->mvert[mf->v4].co;
- CalcNormFloat4(v1, v2, v3, v4, fno);
- } else {
- CalcNormFloat(v1, v2, v3, fno);
- }
-
- norm[0]+= fno[0];
- norm[1]+= fno[1];
- norm[2]+= fno[2];
-
- totselected++;
- }
- }
-
- if (totselected == 0)
- error("No faces selected.");
- else
- view3d_align_axis_to_vector(v3d, axis, norm);
-}
-
-/* helper for below, to survive non-uniform scaled objects */
-static void face_getnormal_obspace(EditFace *efa, float *fno)
-{
- float vec[4][3];
-
- VECCOPY(vec[0], efa->v1->co);
- Mat4Mul3Vecfl(G.obedit->obmat, vec[0]);
- VECCOPY(vec[1], efa->v2->co);
- Mat4Mul3Vecfl(G.obedit->obmat, vec[1]);
- VECCOPY(vec[2], efa->v3->co);
- Mat4Mul3Vecfl(G.obedit->obmat, vec[2]);
- if(efa->v4) {
- VECCOPY(vec[3], efa->v4->co);
- Mat4Mul3Vecfl(G.obedit->obmat, vec[3]);
-
- CalcNormFloat4(vec[0], vec[1], vec[2], vec[3], fno);
- }
- else CalcNormFloat(vec[0], vec[1], vec[2], fno);
-}
-
-
-void editmesh_align_view_to_selected(View3D *v3d, int axis)
-{
- EditMesh *em = G.editMesh;
- int nselverts= EM_nvertices_selected();
- float norm[3]={0.0, 0.0, 0.0}; /* used for storing the mesh normal */
-
- if (nselverts==0) {
- error("No faces or vertices selected.");
- }
- else if (EM_nfaces_selected()) {
- EditFace *efa;
- for (efa= em->faces.first; efa; efa= efa->next) {
- if (faceselectedAND(efa, SELECT)) {
- float fno[3];
-
- face_getnormal_obspace(efa, fno);
- norm[0]+= fno[0];
- norm[1]+= fno[1];
- norm[2]+= fno[2];
- }
- }
-
- view3d_align_axis_to_vector(v3d, axis, norm);
- }
- else if (nselverts>2) {
- float cent[3];
- EditVert *eve, *leve= NULL;
-
- editmesh_calc_selvert_center(cent);
- for (eve= em->verts.first; eve; eve= eve->next) {
- if (eve->f & SELECT) {
- if (leve) {
- float tno[3];
- CalcNormFloat(cent, leve->co, eve->co, tno);
-
- /* XXX, fixme, should be flipped intp a
- * consistent direction. -zr
- */
- norm[0]+= tno[0];
- norm[1]+= tno[1];
- norm[2]+= tno[2];
- }
- leve= eve;
- }
- }
-
- Mat4Mul3Vecfl(G.obedit->obmat, norm);
- view3d_align_axis_to_vector(v3d, axis, norm);
- }
- else if (nselverts==2) { /* Align view to edge (or 2 verts) */
- EditVert *eve, *leve= NULL;
-
- for (eve= em->verts.first; eve; eve= eve->next) {
- if (eve->f & SELECT) {
- if (leve) {
- norm[0]= leve->co[0] - eve->co[0];
- norm[1]= leve->co[1] - eve->co[1];
- norm[2]= leve->co[2] - eve->co[2];
- break; /* we know there are only 2 verts so no need to keep looking */
- }
- leve= eve;
- }
- }
- Mat4Mul3Vecfl(G.obedit->obmat, norm);
- view3d_align_axis_to_vector(v3d, axis, norm);
- }
- else if (nselverts==1) { /* Align view to vert normal */
- EditVert *eve;
-
- for (eve= em->verts.first; eve; eve= eve->next) {
- if (eve->f & SELECT) {
- norm[0]= eve->no[0];
- norm[1]= eve->no[1];
- norm[2]= eve->no[2];
- break; /* we know this is the only selected vert, so no need to keep looking */
- }
- }
- Mat4Mul3Vecfl(G.obedit->obmat, norm);
- view3d_align_axis_to_vector(v3d, axis, norm);
- }
-}
-
-/* **************** VERTEX DEFORMS *************** */
-
-void vertexsmooth(void)
-{
- EditMesh *em = G.editMesh;
- EditVert *eve;
- EditEdge *eed;
- float *adror, *adr, fac;
- float fvec[3];
- int teller=0;
- ModifierData *md= G.obedit->modifiers.first;
-
- if(G.obedit==0) return;
-
- /* count */
- eve= em->verts.first;
- while(eve) {
- if(eve->f & SELECT) teller++;
- eve= eve->next;
- }
- if(teller==0) return;
-
- adr=adror= (float *)MEM_callocN(3*sizeof(float *)*teller, "vertsmooth");
- eve= em->verts.first;
- while(eve) {
- if(eve->f & SELECT) {
- eve->tmp.p = (void*)adr;
- eve->f1= 0;
- eve->f2= 0;
- adr+= 3;
- }
- eve= eve->next;
- }
-
- /* if there is a mirror modifier with clipping, flag the verts that
- * are within tolerance of the plane(s) of reflection
- */
- for (; md; md=md->next) {
- if (md->type==eModifierType_Mirror) {
- MirrorModifierData *mmd = (MirrorModifierData*) md;
-
- if(mmd->flag & MOD_MIR_CLIPPING) {
- for (eve= em->verts.first; eve; eve= eve->next) {
- if(eve->f & SELECT) {
-
- switch(mmd->axis){
- case 0:
- if (fabs(eve->co[0]) < mmd->tolerance)
- eve->f2 |= 1;
- break;
- case 1:
- if (fabs(eve->co[1]) < mmd->tolerance)
- eve->f2 |= 2;
- break;
- case 2:
- if (fabs(eve->co[2]) < mmd->tolerance)
- eve->f2 |= 4;
- break;
- }
- }
- }
- }
- }
- }
-
- eed= em->edges.first;
- while(eed) {
- if( (eed->v1->f & SELECT) || (eed->v2->f & SELECT) ) {
- fvec[0]= (eed->v1->co[0]+eed->v2->co[0])/2.0;
- fvec[1]= (eed->v1->co[1]+eed->v2->co[1])/2.0;
- fvec[2]= (eed->v1->co[2]+eed->v2->co[2])/2.0;
-
- if((eed->v1->f & SELECT) && eed->v1->f1<255) {
- eed->v1->f1++;
- VecAddf(eed->v1->tmp.p, eed->v1->tmp.p, fvec);
- }
- if((eed->v2->f & SELECT) && eed->v2->f1<255) {
- eed->v2->f1++;
- VecAddf(eed->v2->tmp.p, eed->v2->tmp.p, fvec);
- }
- }
- eed= eed->next;
- }
-
- eve= em->verts.first;
- while(eve) {
- if(eve->f & SELECT) {
- if(eve->f1) {
- adr = eve->tmp.p;
- fac= 0.5/(float)eve->f1;
-
- eve->co[0]= 0.5*eve->co[0]+fac*adr[0];
- eve->co[1]= 0.5*eve->co[1]+fac*adr[1];
- eve->co[2]= 0.5*eve->co[2]+fac*adr[2];
-
- /* clip if needed by mirror modifier */
- if (eve->f2) {
- if (eve->f2 & 1) {
- eve->co[0]= 0.0f;
- }
- if (eve->f2 & 2) {
- eve->co[1]= 0.0f;
- }
- if (eve->f2 & 4) {
- eve->co[2]= 0.0f;
- }
- }
- }
- eve->tmp.p= NULL;
- }
- eve= eve->next;
- }
- MEM_freeN(adror);
-
- recalc_editnormals();
-
- allqueue(REDRAWVIEW3D, 0);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-
-#ifdef WITH_VERSE
- if(G.editMesh->vnode)
- sync_all_verseverts_with_editverts(G.editMesh->vnode);
-#endif
- BIF_undo_push("Vertex Smooth");
-}
-
-void vertexnoise(void)
-{
- EditMesh *em = G.editMesh;
- Material *ma;
- Tex *tex;
- EditVert *eve;
- float b2, ofs, vec[3];
-
- if(G.obedit==0) return;
-
- ma= give_current_material(G.obedit, G.obedit->actcol);
- if(ma==0 || ma->mtex[0]==0 || ma->mtex[0]->tex==0) {
- return;
- }
- tex= ma->mtex[0]->tex;
-
- ofs= tex->turbul/200.0;
-
- eve= (struct EditVert *)em->verts.first;
- while(eve) {
- if(eve->f & SELECT) {
-
- if(tex->type==TEX_STUCCI) {
-
- b2= BLI_hnoise(tex->noisesize, eve->co[0], eve->co[1], eve->co[2]);
- if(tex->stype) ofs*=(b2*b2);
- vec[0]= 0.2*(b2-BLI_hnoise(tex->noisesize, eve->co[0]+ofs, eve->co[1], eve->co[2]));
- vec[1]= 0.2*(b2-BLI_hnoise(tex->noisesize, eve->co[0], eve->co[1]+ofs, eve->co[2]));
- vec[2]= 0.2*(b2-BLI_hnoise(tex->noisesize, eve->co[0], eve->co[1], eve->co[2]+ofs));
-
- VecAddf(eve->co, eve->co, vec);
- }
- else {
- float tin, dum;
- externtex(ma->mtex[0], eve->co, &tin, &dum, &dum, &dum, &dum);
- eve->co[2]+= 0.05*tin;
- }
- }
- eve= eve->next;
- }
-
- recalc_editnormals();
- allqueue(REDRAWVIEW3D, 0);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-#ifdef WITH_VERSE
- if(G.editMesh->vnode)
- sync_all_verseverts_with_editverts(G.editMesh->vnode);
-#endif
- BIF_undo_push("Vertex Noise");
-}
-
-void vertices_to_sphere(void)
-{
- EditMesh *em = G.editMesh;
- EditVert *eve;
- Object *ob= OBACT;
- float *curs, len, vec[3], cent[3], fac, facm, imat[3][3], bmat[3][3];
- int tot;
- short perc=100;
-
- if(ob==0) return;
- TEST_EDITMESH
-
- if(button(&perc, 1, 100, "Percentage:")==0) return;
-
- fac= perc/100.0;
- facm= 1.0-fac;
-
- Mat3CpyMat4(bmat, ob->obmat);
- Mat3Inv(imat, bmat);
-
- /* center */
- curs= give_cursor();
- cent[0]= curs[0]-ob->obmat[3][0];
- cent[1]= curs[1]-ob->obmat[3][1];
- cent[2]= curs[2]-ob->obmat[3][2];
- Mat3MulVecfl(imat, cent);
-
- len= 0.0;
- tot= 0;
- eve= em->verts.first;
- while(eve) {
- if(eve->f & SELECT) {
- tot++;
- len+= VecLenf(cent, eve->co);
- }
- eve= eve->next;
- }
- len/=tot;
-
- if(len==0.0) len= 10.0;
-
- eve= em->verts.first;
- while(eve) {
- if(eve->f & SELECT) {
- vec[0]= eve->co[0]-cent[0];
- vec[1]= eve->co[1]-cent[1];
- vec[2]= eve->co[2]-cent[2];
-
- Normalize(vec);
-
- eve->co[0]= fac*(cent[0]+vec[0]*len) + facm*eve->co[0];
- eve->co[1]= fac*(cent[1]+vec[1]*len) + facm*eve->co[1];
- eve->co[2]= fac*(cent[2]+vec[2]*len) + facm*eve->co[2];
-
- }
- eve= eve->next;
- }
-
- recalc_editnormals();
- allqueue(REDRAWVIEW3D, 0);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-#ifdef WITH_VERSE
- if(G.editMesh->vnode)
- sync_all_verseverts_with_editverts(G.editMesh->vnode);
-#endif
- BIF_undo_push("To Sphere");
-}
-
diff --git a/source/blender/src/editmesh_tools.c b/source/blender/src/editmesh_tools.c
deleted file mode 100644
index 1992ea8468a..00000000000
--- a/source/blender/src/editmesh_tools.c
+++ /dev/null
@@ -1,6800 +0,0 @@
-/**
- * $Id:
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2004 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Johnny Matthews, Geoffrey Bantle.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-/*
-
-editmesh_tool.c: UI called tools for editmesh, geometry changes here, otherwise in mods.c
-
-*/
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "BMF_Api.h"
-#include "DNA_mesh_types.h"
-#include "DNA_material_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_key_types.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_editVert.h"
-#include "BLI_rand.h"
-#include "BLI_ghash.h"
-#include "BLI_linklist.h"
-#include "BLI_heap.h"
-
-#include "BKE_depsgraph.h"
-#include "BKE_customdata.h"
-#include "BKE_global.h"
-#include "BKE_library.h"
-#include "BKE_mesh.h"
-#include "BKE_object.h"
-#include "BKE_utildefines.h"
-
-#ifdef WITH_VERSE
-#include "BKE_verse.h"
-#endif
-
-#include "BIF_cursors.h"
-#include "BIF_editmesh.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-#include "BIF_graphics.h"
-#include "BIF_interface.h"
-#include "BIF_mywindow.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_resources.h"
-#include "BIF_toolbox.h"
-#include "BIF_transform.h"
-
-#ifdef WITH_VERSE
-#include "BIF_verse.h"
-#endif
-
-#include "BDR_drawobject.h"
-#include "BDR_editobject.h"
-
-#include "BSE_view.h"
-#include "BSE_edit.h"
-
-#include "blendef.h"
-#include "multires.h"
-#include "mydevice.h"
-
-#include "editmesh.h"
-
-#include "MTC_vectorops.h"
-
-#include "PIL_time.h"
-
-/* local prototypes ---------------*/
-void bevel_menu(void);
-static void free_tagged_edges_faces(EditEdge *eed, EditFace *efa);
-
-/********* qsort routines *********/
-
-
-typedef struct xvertsort {
- float x;
- EditVert *v1;
-} xvertsort;
-
-static int vergxco(const void *v1, const void *v2)
-{
- const xvertsort *x1=v1, *x2=v2;
-
- if( x1->x > x2->x ) return 1;
- else if( x1->x < x2->x) return -1;
- return 0;
-}
-
-struct facesort {
- unsigned long x;
- struct EditFace *efa;
-};
-
-
-static int vergface(const void *v1, const void *v2)
-{
- const struct facesort *x1=v1, *x2=v2;
-
- if( x1->x > x2->x ) return 1;
- else if( x1->x < x2->x) return -1;
- return 0;
-}
-
-
-/* *********************************** */
-
-void convert_to_triface(int direction)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa, *efan, *next;
- float fac;
-
- if(multires_test()) return;
-
- efa= em->faces.last;
- while(efa) {
- next= efa->prev;
- if(efa->v4) {
- if(efa->f & SELECT) {
- /* choose shortest diagonal for split */
- fac= VecLenf(efa->v1->co, efa->v3->co) - VecLenf(efa->v2->co, efa->v4->co);
- /* this makes sure exact squares get split different in both cases */
- if( (direction==0 && fac<FLT_EPSILON) || (direction && fac>0.0f) ) {
- efan= EM_face_from_faces(efa, NULL, 0, 1, 2, -1);
- if(efa->f & SELECT) EM_select_face(efan, 1);
- efan= EM_face_from_faces(efa, NULL, 0, 2, 3, -1);
- if(efa->f & SELECT) EM_select_face(efan, 1);
- }
- else {
- efan= EM_face_from_faces(efa, NULL, 0, 1, 3, -1);
- if(efa->f & SELECT) EM_select_face(efan, 1);
- efan= EM_face_from_faces(efa, NULL, 1, 2, 3, -1);
- if(efa->f & SELECT) EM_select_face(efan, 1);
- }
-
- BLI_remlink(&em->faces, efa);
- free_editface(efa);
- }
- }
- efa= next;
- }
-
- EM_fgon_flags(); // redo flags and indices for fgons
-
-#ifdef WITH_VERSE
- if(G.editMesh->vnode)
- sync_all_versefaces_with_editfaces((VNode*)G.editMesh->vnode);
-#endif
- BIF_undo_push("Convert Quads to Triangles");
-
-}
-
-int removedoublesflag(short flag, short automerge, float limit) /* return amount */
-{
- /*
- flag - Test with vert->flags
- automerge - Alternative operation, merge unselected into selected.
- Used for "Auto Weld" mode. warning.
- limit - Quick manhattan distance between verts.
- */
-
- EditMesh *em = G.editMesh;
- /* all verts with (flag & 'flag') are being evaluated */
- EditVert *eve, *v1, *nextve;
- EditEdge *eed, *e1, *nexted;
- EditFace *efa, *nextvl;
- xvertsort *sortblock, *sb, *sb1;
- struct facesort *vlsortblock, *vsb, *vsb1;
- int a, b, test, amount;
-
- if(multires_test()) return 0;
-
-
- /* flag 128 is cleared, count */
-
- /* Normal non weld operation */
- eve= em->verts.first;
- amount= 0;
- while(eve) {
- eve->f &= ~128;
- if(eve->h==0 && (automerge || (eve->f & flag))) amount++;
- eve= eve->next;
- }
- if(amount==0) return 0;
-
- /* allocate memory and qsort */
- sb= sortblock= MEM_mallocN(sizeof(xvertsort)*amount,"sortremovedoub");
- eve= em->verts.first;
- while(eve) {
- if(eve->h==0 && (automerge || (eve->f & flag))) {
- sb->x= eve->co[0]+eve->co[1]+eve->co[2];
- sb->v1= eve;
- sb++;
- }
- eve= eve->next;
- }
- qsort(sortblock, amount, sizeof(xvertsort), vergxco);
-
-
- /* test for doubles */
- sb= sortblock;
- if (automerge) {
- for(a=0; a<amount; a++, sb++) {
- eve= sb->v1;
- if( (eve->f & 128)==0 ) {
- sb1= sb+1;
- for(b=a+1; b<amount && (eve->f & 128)==0; b++, sb1++) {
- if(sb1->x - sb->x > limit) break;
-
- /* when automarge, only allow unselected->selected */
- v1= sb1->v1;
- if( (v1->f & 128)==0 ) {
- if ((eve->f & flag)==0 && (v1->f & flag)==1) {
- if( (float)fabs(v1->co[0]-eve->co[0])<=limit &&
- (float)fabs(v1->co[1]-eve->co[1])<=limit &&
- (float)fabs(v1->co[2]-eve->co[2])<=limit)
- { /* unique bit */
- eve->f|= 128;
- eve->tmp.v = v1;
- }
- } else if( (eve->f & flag)==1 && (v1->f & flag)==0 ) {
- if( (float)fabs(v1->co[0]-eve->co[0])<=limit &&
- (float)fabs(v1->co[1]-eve->co[1])<=limit &&
- (float)fabs(v1->co[2]-eve->co[2])<=limit)
- { /* unique bit */
- v1->f|= 128;
- v1->tmp.v = eve;
- }
- }
- }
- }
- }
- }
- } else {
- for(a=0; a<amount; a++, sb++) {
- eve= sb->v1;
- if( (eve->f & 128)==0 ) {
- sb1= sb+1;
- for(b=a+1; b<amount; b++, sb1++) {
- /* first test: simpel dist */
- if(sb1->x - sb->x > limit) break;
- v1= sb1->v1;
-
- /* second test: is vertex allowed */
- if( (v1->f & 128)==0 ) {
- if( (float)fabs(v1->co[0]-eve->co[0])<=limit &&
- (float)fabs(v1->co[1]-eve->co[1])<=limit &&
- (float)fabs(v1->co[2]-eve->co[2])<=limit)
- {
- v1->f|= 128;
- v1->tmp.v = eve;
- }
- }
- }
- }
- }
- }
- MEM_freeN(sortblock);
-
- if (!automerge)
- for(eve = em->verts.first; eve; eve=eve->next)
- if((eve->f & flag) && (eve->f & 128))
- EM_data_interp_from_verts(eve, eve->tmp.v, eve->tmp.v, 0.5f);
-
- /* test edges and insert again */
- eed= em->edges.first;
- while(eed) {
- eed->f2= 0;
- eed= eed->next;
- }
- eed= em->edges.last;
- while(eed) {
- nexted= eed->prev;
-
- if(eed->f2==0) {
- if( (eed->v1->f & 128) || (eed->v2->f & 128) ) {
- remedge(eed);
-
- if(eed->v1->f & 128) eed->v1 = eed->v1->tmp.v;
- if(eed->v2->f & 128) eed->v2 = eed->v2->tmp.v;
- e1= addedgelist(eed->v1, eed->v2, eed);
-
- if(e1) e1->f2= 1;
- if(e1!=eed) free_editedge(eed);
- }
- }
- eed= nexted;
- }
-
- /* first count amount of test faces */
- efa= (struct EditFace *)em->faces.first;
- amount= 0;
- while(efa) {
- efa->f1= 0;
- if(efa->v1->f & 128) efa->f1= 1;
- else if(efa->v2->f & 128) efa->f1= 1;
- else if(efa->v3->f & 128) efa->f1= 1;
- else if(efa->v4 && (efa->v4->f & 128)) efa->f1= 1;
-
- if(efa->f1==1) amount++;
- efa= efa->next;
- }
-
- /* test faces for double vertices, and if needed remove them */
- efa= (struct EditFace *)em->faces.first;
- while(efa) {
- nextvl= efa->next;
- if(efa->f1==1) {
-
- if(efa->v1->f & 128) efa->v1= efa->v1->tmp.v;
- if(efa->v2->f & 128) efa->v2= efa->v2->tmp.v;
- if(efa->v3->f & 128) efa->v3= efa->v3->tmp.v;
- if(efa->v4 && (efa->v4->f & 128)) efa->v4= efa->v4->tmp.v;
-
- test= 0;
- if(efa->v1==efa->v2) test+=1;
- if(efa->v2==efa->v3) test+=2;
- if(efa->v3==efa->v1) test+=4;
- if(efa->v4==efa->v1) test+=8;
- if(efa->v3==efa->v4) test+=16;
- if(efa->v2==efa->v4) test+=32;
-
- if(test) {
- if(efa->v4) {
- if(test==1 || test==2) {
- efa->v2= efa->v3;
- efa->v3= efa->v4;
- efa->v4= 0;
-
- EM_data_interp_from_faces(efa, NULL, efa, 0, 2, 3, 3);
-
- test= 0;
- }
- else if(test==8 || test==16) {
- efa->v4= 0;
- test= 0;
- }
- else {
- BLI_remlink(&em->faces, efa);
- free_editface(efa);
- amount--;
- }
- }
- else {
- BLI_remlink(&em->faces, efa);
- free_editface(efa);
- amount--;
- }
- }
-
- if(test==0) {
- /* set edge pointers */
- efa->e1= findedgelist(efa->v1, efa->v2);
- efa->e2= findedgelist(efa->v2, efa->v3);
- if(efa->v4==0) {
- efa->e3= findedgelist(efa->v3, efa->v1);
- efa->e4= 0;
- }
- else {
- efa->e3= findedgelist(efa->v3, efa->v4);
- efa->e4= findedgelist(efa->v4, efa->v1);
- }
- }
- }
- efa= nextvl;
- }
-
- /* double faces: sort block */
- /* count again, now all selected faces */
- amount= 0;
- efa= em->faces.first;
- while(efa) {
- efa->f1= 0;
- if(faceselectedOR(efa, 1)) {
- efa->f1= 1;
- amount++;
- }
- efa= efa->next;
- }
-
- if(amount) {
- /* double faces: sort block */
- vsb= vlsortblock= MEM_mallocN(sizeof(struct facesort)*amount, "sortremovedoub");
- efa= em->faces.first;
- while(efa) {
- if(efa->f1 & 1) {
- if(efa->v4) vsb->x= (unsigned long) MIN4( (unsigned long)efa->v1, (unsigned long)efa->v2, (unsigned long)efa->v3, (unsigned long)efa->v4);
- else vsb->x= (unsigned long) MIN3( (unsigned long)efa->v1, (unsigned long)efa->v2, (unsigned long)efa->v3);
-
- vsb->efa= efa;
- vsb++;
- }
- efa= efa->next;
- }
-
- qsort(vlsortblock, amount, sizeof(struct facesort), vergface);
-
- vsb= vlsortblock;
- for(a=0; a<amount; a++) {
- efa= vsb->efa;
- if( (efa->f1 & 128)==0 ) {
- vsb1= vsb+1;
-
- for(b=a+1; b<amount; b++) {
-
- /* first test: same pointer? */
- if(vsb->x != vsb1->x) break;
-
- /* second test: is test permitted? */
- efa= vsb1->efa;
- if( (efa->f1 & 128)==0 ) {
- if( compareface(efa, vsb->efa)) efa->f1 |= 128;
-
- }
- vsb1++;
- }
- }
- vsb++;
- }
-
- MEM_freeN(vlsortblock);
-
- /* remove double faces */
- efa= (struct EditFace *)em->faces.first;
- while(efa) {
- nextvl= efa->next;
- if(efa->f1 & 128) {
- BLI_remlink(&em->faces, efa);
- free_editface(efa);
- }
- efa= nextvl;
- }
- }
-
- /* remove double vertices */
- a= 0;
- eve= (struct EditVert *)em->verts.first;
- while(eve) {
- nextve= eve->next;
- if(automerge || eve->f & flag) {
- if(eve->f & 128) {
- a++;
- BLI_remlink(&em->verts, eve);
- free_editvert(eve);
- }
- }
- eve= nextve;
- }
-
-#ifdef WITH_VERSE
- if((a>0) && (G.editMesh->vnode)) {
- sync_all_verseverts_with_editverts((VNode*)G.editMesh->vnode);
- sync_all_versefaces_with_editfaces((VNode*)G.editMesh->vnode);
- }
-#endif
-
- return a; /* amount */
-}
-
-/* called from buttons */
-static void xsortvert_flag__doSetX(void *userData, EditVert *eve, int x, int y, int index)
-{
- xvertsort *sortblock = userData;
-
- sortblock[index].x = x;
-}
-void xsortvert_flag(int flag)
-{
- EditMesh *em = G.editMesh;
- /* all verts with (flag & 'flag') are sorted */
- EditVert *eve;
- xvertsort *sortblock;
- ListBase tbase;
- int i, amount = BLI_countlist(&em->verts);
-
- if(multires_test()) return;
-
- sortblock = MEM_callocN(sizeof(xvertsort)*amount,"xsort");
- for (i=0,eve=em->verts.first; eve; i++,eve=eve->next)
- if(eve->f & flag)
- sortblock[i].v1 = eve;
- mesh_foreachScreenVert(xsortvert_flag__doSetX, sortblock, 0);
- qsort(sortblock, amount, sizeof(xvertsort), vergxco);
-
- /* make temporal listbase */
- tbase.first= tbase.last= 0;
- for (i=0; i<amount; i++) {
- eve = sortblock[i].v1;
-
- if (eve) {
- BLI_remlink(&em->verts, eve);
- BLI_addtail(&tbase, eve);
- }
- }
-
- addlisttolist(&em->verts, &tbase);
-
- MEM_freeN(sortblock);
-
-#ifdef WITH_VERSE
- if(G.editMesh->vnode)
- sync_all_versefaces_with_editfaces((VNode*)G.editMesh->vnode);
-#endif
-
- BIF_undo_push("Xsort");
-
-}
-
-/* called from buttons */
-void hashvert_flag(int flag)
-{
- /* switch vertex order using hash table */
- EditMesh *em = G.editMesh;
- EditVert *eve;
- struct xvertsort *sortblock, *sb, onth, *newsort;
- ListBase tbase;
- int amount, a, b;
-
- if(multires_test()) return;
-
- /* count */
- eve= em->verts.first;
- amount= 0;
- while(eve) {
- if(eve->f & flag) amount++;
- eve= eve->next;
- }
- if(amount==0) return;
-
- /* allocate memory */
- sb= sortblock= (struct xvertsort *)MEM_mallocN(sizeof(struct xvertsort)*amount,"sortremovedoub");
- eve= em->verts.first;
- while(eve) {
- if(eve->f & flag) {
- sb->v1= eve;
- sb++;
- }
- eve= eve->next;
- }
-
- BLI_srand(1);
-
- sb= sortblock;
- for(a=0; a<amount; a++, sb++) {
- b= (int)(amount*BLI_drand());
- if(b>=0 && b<amount) {
- newsort= sortblock+b;
- onth= *sb;
- *sb= *newsort;
- *newsort= onth;
- }
- }
-
- /* make temporal listbase */
- tbase.first= tbase.last= 0;
- sb= sortblock;
- while(amount--) {
- eve= sb->v1;
- BLI_remlink(&em->verts, eve);
- BLI_addtail(&tbase, eve);
- sb++;
- }
-
- addlisttolist(&em->verts, &tbase);
-
- MEM_freeN(sortblock);
-#ifdef WITH_VERSE
- if(G.editMesh->vnode)
- sync_all_versefaces_with_editfaces((VNode*)G.editMesh->vnode);
-#endif
- BIF_undo_push("Hash");
-
-}
-
-/* generic extern called extruder */
-void extrude_mesh(void)
-{
- float nor[3]= {0.0, 0.0, 0.0};
- short nr, transmode= 0;
-
- TEST_EDITMESH
- if(multires_test()) return;
-
- if(G.scene->selectmode & SCE_SELECT_VERTEX) {
- if(G.totvertsel==0) nr= 0;
- else if(G.totvertsel==1) nr= 4;
- else if(G.totedgesel==0) nr= 4;
- else if(G.totfacesel==0)
- nr= pupmenu("Extrude %t|Only Edges%x3|Only Vertices%x4");
- else if(G.totfacesel==1)
- nr= pupmenu("Extrude %t|Region %x1|Only Edges%x3|Only Vertices%x4");
- else
- nr= pupmenu("Extrude %t|Region %x1||Individual Faces %x2|Only Edges%x3|Only Vertices%x4");
- }
- else if(G.scene->selectmode & SCE_SELECT_EDGE) {
- if (G.totedgesel==0) nr = 0;
- else if (G.totedgesel==1) nr = 3;
- else if(G.totfacesel==0) nr = 3;
- else if(G.totfacesel==1)
- nr= pupmenu("Extrude %t|Region %x1|Only Edges%x3");
- else
- nr= pupmenu("Extrude %t|Region %x1||Individual Faces %x2|Only Edges%x3");
- }
- else {
- if (G.totfacesel == 0) nr = 0;
- else if (G.totfacesel == 1) nr = 1;
- else
- nr= pupmenu("Extrude %t|Region %x1||Individual Faces %x2");
- }
-
- if(nr<1) return;
-
- if(nr==1) transmode= extrudeflag(SELECT, nor);
- else if(nr==4) transmode= extrudeflag_verts_indiv(SELECT, nor);
- else if(nr==3) transmode= extrudeflag_edges_indiv(SELECT, nor);
- else transmode= extrudeflag_face_indiv(SELECT, nor);
-
- if(transmode==0) {
- error("No valid selection");
- }
- else {
- EM_fgon_flags();
- countall();
-
- /* We need to force immediate calculation here because
- * transform may use derived objects (which are now stale).
- *
- * This shouldn't be necessary, derived queries should be
- * automatically building this data if invalid. Or something.
- */
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- object_handle_update(G.obedit);
-
- /* individual faces? */
- BIF_TransformSetUndo("Extrude");
- if(nr==2) {
- initTransform(TFM_SHRINKFATTEN, CTX_NO_PET|CTX_NO_MIRROR);
- Transform();
- }
- else {
- initTransform(TFM_TRANSLATION, CTX_NO_PET|CTX_NO_MIRROR);
- if(transmode=='n') {
- Mat4MulVecfl(G.obedit->obmat, nor);
- VecSubf(nor, nor, G.obedit->obmat[3]);
- BIF_setSingleAxisConstraint(nor, "along normal");
- }
- Transform();
- }
- }
-
-}
-
-void split_mesh(void)
-{
-
- TEST_EDITMESH
- if(multires_test()) return;
-
- if(okee(" Split ")==0) return;
-
- waitcursor(1);
-
- /* make duplicate first */
- adduplicateflag(SELECT);
- /* old faces have flag 128 set, delete them */
- delfaceflag(128);
- recalc_editnormals();
-
- waitcursor(0);
-
- countall();
- allqueue(REDRAWVIEW3D, 0);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-
-#ifdef WITH_VERSE
- if(G.editMesh->vnode)
- sync_all_versefaces_with_editfaces((VNode*)G.editMesh->vnode);
-#endif
-
- BIF_undo_push("Split");
-
-}
-
-void extrude_repeat_mesh(int steps, float offs)
-{
- float dvec[3], tmat[3][3], bmat[3][3], nor[3]= {0.0, 0.0, 0.0};
- short a;
-
- TEST_EDITMESH
- if(multires_test()) return;
-
- /* dvec */
- dvec[0]= G.vd->persinv[2][0];
- dvec[1]= G.vd->persinv[2][1];
- dvec[2]= G.vd->persinv[2][2];
- Normalize(dvec);
- dvec[0]*= offs;
- dvec[1]*= offs;
- dvec[2]*= offs;
-
- /* base correction */
- Mat3CpyMat4(bmat, G.obedit->obmat);
- Mat3Inv(tmat, bmat);
- Mat3MulVecfl(tmat, dvec);
-
- for(a=0; a<steps; a++) {
- extrudeflag(SELECT, nor);
- translateflag(SELECT, dvec);
- }
-
- recalc_editnormals();
-
- EM_fgon_flags();
- countall();
-
- allqueue(REDRAWVIEW3D, 0);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-
- BIF_undo_push("Extrude Repeat");
-}
-
-void spin_mesh(int steps, float degr, float *dvec, int mode)
-{
- EditMesh *em = G.editMesh;
- EditVert *eve,*nextve;
- float nor[3]= {0.0, 0.0, 0.0};
- float *curs, si,n[3],q[4],cmat[3][3],imat[3][3], tmat[3][3];
- float cent[3],bmat[3][3];
- float phi;
- short a,ok;
-
- TEST_EDITMESH
- if(multires_test()) return;
-
- /* imat and center and size */
- Mat3CpyMat4(bmat, G.obedit->obmat);
- Mat3Inv(imat,bmat);
-
- curs= give_cursor();
- VECCOPY(cent, curs);
- cent[0]-= G.obedit->obmat[3][0];
- cent[1]-= G.obedit->obmat[3][1];
- cent[2]-= G.obedit->obmat[3][2];
- Mat3MulVecfl(imat, cent);
-
- phi= degr*M_PI/360.0;
- phi/= steps;
- if(G.scene->toolsettings->editbutflag & B_CLOCKWISE) phi= -phi;
-
- if(dvec) {
- n[0]= G.vd->viewinv[1][0];
- n[1]= G.vd->viewinv[1][1];
- n[2]= G.vd->viewinv[1][2];
- } else {
- n[0]= G.vd->viewinv[2][0];
- n[1]= G.vd->viewinv[2][1];
- n[2]= G.vd->viewinv[2][2];
- }
- Normalize(n);
-
- q[0]= (float)cos(phi);
- si= (float)sin(phi);
- q[1]= n[0]*si;
- q[2]= n[1]*si;
- q[3]= n[2]*si;
- QuatToMat3(q, cmat);
-
- Mat3MulMat3(tmat,cmat,bmat);
- Mat3MulMat3(bmat,imat,tmat);
-
- if(mode==0) if(G.scene->toolsettings->editbutflag & B_KEEPORIG) adduplicateflag(1);
- ok= 1;
-
- for(a=0;a<steps;a++) {
- if(mode==0) ok= extrudeflag(SELECT, nor);
- else adduplicateflag(SELECT);
- if(ok==0) {
- error("No valid vertices are selected");
- break;
- }
- rotateflag(SELECT, cent, bmat);
- if(dvec) {
- Mat3MulVecfl(bmat,dvec);
- translateflag(SELECT, dvec);
- }
- }
-
- if(ok==0) {
- /* no vertices or only loose ones selected, remove duplicates */
- eve= em->verts.first;
- while(eve) {
- nextve= eve->next;
- if(eve->f & SELECT) {
- BLI_remlink(&em->verts,eve);
- free_editvert(eve);
- }
- eve= nextve;
- }
- }
- recalc_editnormals();
-
- EM_fgon_flags();
- countall();
- allqueue(REDRAWVIEW3D, 0);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-
-
- if(dvec==NULL) BIF_undo_push("Spin");
-}
-
-void screw_mesh(int steps, int turns)
-{
- EditMesh *em = G.editMesh;
- EditVert *eve,*v1=0,*v2=0;
- EditEdge *eed;
- float dvec[3], nor[3];
-
- TEST_EDITMESH
- if(multires_test()) return;
-
- /* clear flags */
- eve= em->verts.first;
- while(eve) {
- eve->f1= 0;
- eve= eve->next;
- }
- /* edges set flags in verts */
- eed= em->edges.first;
- while(eed) {
- if(eed->v1->f & SELECT) {
- if(eed->v2->f & SELECT) {
- /* watch: f1 is a byte */
- if(eed->v1->f1<2) eed->v1->f1++;
- if(eed->v2->f1<2) eed->v2->f1++;
- }
- }
- eed= eed->next;
- }
- /* find two vertices with eve->f1==1, more or less is wrong */
- eve= em->verts.first;
- while(eve) {
- if(eve->f1==1) {
- if(v1==0) v1= eve;
- else if(v2==0) v2= eve;
- else {
- v1=0;
- break;
- }
- }
- eve= eve->next;
- }
- if(v1==0 || v2==0) {
- error("You have to select a string of connected vertices too");
- return;
- }
-
- /* calculate dvec */
- dvec[0]= ( (v1->co[0]- v2->co[0]) )/(steps);
- dvec[1]= ( (v1->co[1]- v2->co[1]) )/(steps);
- dvec[2]= ( (v1->co[2]- v2->co[2]) )/(steps);
-
- VECCOPY(nor, G.obedit->obmat[2]);
-
- if(nor[0]*dvec[0]+nor[1]*dvec[1]+nor[2]*dvec[2]>0.000) {
- dvec[0]= -dvec[0];
- dvec[1]= -dvec[1];
- dvec[2]= -dvec[2];
- }
-
- spin_mesh(turns*steps, turns*360, dvec, 0);
-
- BIF_undo_push("Spin");
-}
-
-
-static void erase_edges(ListBase *l)
-{
- EditEdge *ed, *nexted;
-
- ed = (EditEdge *) l->first;
- while(ed) {
- nexted= ed->next;
- if( (ed->v1->f & SELECT) || (ed->v2->f & SELECT) ) {
- remedge(ed);
- free_editedge(ed);
- }
- ed= nexted;
- }
-}
-
-static void erase_faces(ListBase *l)
-{
- EditFace *f, *nextf;
-
- f = (EditFace *) l->first;
-
- while(f) {
- nextf= f->next;
- if( faceselectedOR(f, SELECT) ) {
- BLI_remlink(l, f);
- free_editface(f);
- }
- f = nextf;
- }
-}
-
-static void erase_vertices(ListBase *l)
-{
- EditVert *v, *nextv;
-
- v = (EditVert *) l->first;
- while(v) {
- nextv= v->next;
- if(v->f & 1) {
- BLI_remlink(l, v);
- free_editvert(v);
- }
- v = nextv;
- }
-}
-
-void delete_mesh(void)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa, *nextvl;
- EditVert *eve,*nextve;
- EditEdge *eed,*nexted;
- short event;
- int count;
- char *str="Erase";
-
- TEST_EDITMESH
- if(multires_test()) return;
-
- event= pupmenu("Erase %t|Vertices%x10|Edges%x1|Faces%x2|All%x3|Edges & Faces%x4|Only Faces%x5|Edge Loop%x6");
- if(event<1) return;
-
- if(event==10 ) {
- str= "Erase Vertices";
- erase_edges(&em->edges);
- erase_faces(&em->faces);
- erase_vertices(&em->verts);
- }
- else if(event==6) {
- if(!EdgeLoopDelete()) {
- BIF_undo();
- }
- }
- else if(event==4) {
- str= "Erase Edges & Faces";
- efa= em->faces.first;
- while(efa) {
- nextvl= efa->next;
- /* delete only faces with 1 or more edges selected */
- count= 0;
- if(efa->e1->f & SELECT) count++;
- if(efa->e2->f & SELECT) count++;
- if(efa->e3->f & SELECT) count++;
- if(efa->e4 && (efa->e4->f & SELECT)) count++;
- if(count) {
- BLI_remlink(&em->faces, efa);
- free_editface(efa);
- }
- efa= nextvl;
- }
- eed= em->edges.first;
- while(eed) {
- nexted= eed->next;
- if(eed->f & SELECT) {
- remedge(eed);
- free_editedge(eed);
- }
- eed= nexted;
- }
- efa= em->faces.first;
- while(efa) {
- nextvl= efa->next;
- event=0;
- if( efa->v1->f & SELECT) event++;
- if( efa->v2->f & SELECT) event++;
- if( efa->v3->f & SELECT) event++;
- if(efa->v4 && (efa->v4->f & SELECT)) event++;
-
- if(event>1) {
- BLI_remlink(&em->faces, efa);
- free_editface(efa);
- }
- efa= nextvl;
- }
- }
- else if(event==1) {
- str= "Erase Edges";
- // faces first
- efa= em->faces.first;
- while(efa) {
- nextvl= efa->next;
- event=0;
- if( efa->e1->f & SELECT) event++;
- if( efa->e2->f & SELECT) event++;
- if( efa->e3->f & SELECT) event++;
- if(efa->e4 && (efa->e4->f & SELECT)) event++;
-
- if(event) {
- BLI_remlink(&em->faces, efa);
- free_editface(efa);
- }
- efa= nextvl;
- }
- eed= em->edges.first;
- while(eed) {
- nexted= eed->next;
- if(eed->f & SELECT) {
- remedge(eed);
- free_editedge(eed);
- }
- eed= nexted;
- }
- /* to remove loose vertices: */
- eed= em->edges.first;
- while(eed) {
- if( eed->v1->f & SELECT) eed->v1->f-=SELECT;
- if( eed->v2->f & SELECT) eed->v2->f-=SELECT;
- eed= eed->next;
- }
- eve= em->verts.first;
- while(eve) {
- nextve= eve->next;
- if(eve->f & SELECT) {
- BLI_remlink(&em->verts,eve);
- free_editvert(eve);
- }
- eve= nextve;
- }
-
- }
- else if(event==2) {
- str="Erase Faces";
- delfaceflag(SELECT);
- }
- else if(event==3) {
- str= "Erase All";
- if(em->verts.first) free_vertlist(&em->verts);
- if(em->edges.first) free_edgelist(&em->edges);
- if(em->faces.first) free_facelist(&em->faces);
- if(em->selected.first) BLI_freelistN(&(em->selected));
- }
- else if(event==5) {
- str= "Erase Only Faces";
- efa= em->faces.first;
- while(efa) {
- nextvl= efa->next;
- if(efa->f & SELECT) {
- BLI_remlink(&em->faces, efa);
- free_editface(efa);
- }
- efa= nextvl;
- }
- }
-
- EM_fgon_flags(); // redo flags and indices for fgons
-
- countall();
- allqueue(REDRAWVIEW3D, 0);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- BIF_undo_push(str);
-}
-
-
-/* Got this from scanfill.c. You will need to juggle around the
- * callbacks for the scanfill.c code a bit for this to work. */
-void fill_mesh(void)
-{
- EditMesh *em = G.editMesh;
- EditVert *eve,*v1;
- EditEdge *eed,*e1,*nexted;
- EditFace *efa,*nextvl, *efan;
- short ok;
-
- if(G.obedit==0 || (G.obedit->type!=OB_MESH)) return;
- if(multires_test()) return;
-
- waitcursor(1);
-
- /* copy all selected vertices */
- eve= em->verts.first;
- while(eve) {
- if(eve->f & SELECT) {
- v1= BLI_addfillvert(eve->co);
- eve->tmp.v= v1;
- v1->tmp.v= eve;
- v1->xs= 0; // used for counting edges
- }
- eve= eve->next;
- }
- /* copy all selected edges */
- eed= em->edges.first;
- while(eed) {
- if( (eed->v1->f & SELECT) && (eed->v2->f & SELECT) ) {
- e1= BLI_addfilledge(eed->v1->tmp.v, eed->v2->tmp.v);
- e1->v1->xs++;
- e1->v2->xs++;
- }
- eed= eed->next;
- }
- /* from all selected faces: remove vertices and edges to prevent doubles */
- /* all edges add values, faces subtract,
- then remove edges with vertices ->xs<2 */
- efa= em->faces.first;
- ok= 0;
- while(efa) {
- nextvl= efa->next;
- if( faceselectedAND(efa, 1) ) {
- efa->v1->tmp.v->xs--;
- efa->v2->tmp.v->xs--;
- efa->v3->tmp.v->xs--;
- if(efa->v4) efa->v4->tmp.v->xs--;
- ok= 1;
-
- }
- efa= nextvl;
- }
- if(ok) { /* there are faces selected */
- eed= filledgebase.first;
- while(eed) {
- nexted= eed->next;
- if(eed->v1->xs<2 || eed->v2->xs<2) {
- BLI_remlink(&filledgebase,eed);
- }
- eed= nexted;
- }
- }
-
- if(BLI_edgefill(0, (G.obedit && G.obedit->actcol)?(G.obedit->actcol-1):0)) {
- efa= fillfacebase.first;
- while(efa) {
- /* normals default pointing up */
- efan= addfacelist(efa->v3->tmp.v, efa->v2->tmp.v,
- efa->v1->tmp.v, 0, NULL, NULL);
- if(efan) EM_select_face(efan, 1);
- efa= efa->next;
- }
- }
-
- BLI_end_edgefill();
-
- waitcursor(0);
- EM_select_flush();
- countall();
- allqueue(REDRAWVIEW3D, 0);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-
-#ifdef WITH_VERSE
- if(G.editMesh->vnode)
- sync_all_versefaces_with_editfaces((VNode*)G.editMesh->vnode);
-#endif
-
- BIF_undo_push("Fill");
-}
-/*GB*/
-/*-------------------------------------------------------------------------------*/
-/*--------------------------- Edge Based Subdivide ------------------------------*/
-
-#define EDGENEW 2
-#define FACENEW 2
-#define EDGEINNER 4
-#define EDGEOLD 8
-
-/*used by faceloop cut to select only edges valid for edge slide*/
-#define DOUBLEOPFILL 16
-
-/* calculates offset for co, based on fractal, sphere or smooth settings */
-static void alter_co(float *co, EditEdge *edge, float rad, int beauty, float perc)
-{
- float vec1[3], fac;
-
- if(beauty & B_SMOOTH) {
- /* we calculate an offset vector vec1[], to be added to *co */
- float len, fac, nor[3], nor1[3], nor2[3];
-
- VecSubf(nor, edge->v1->co, edge->v2->co);
- len= 0.5f*Normalize(nor);
-
- VECCOPY(nor1, edge->v1->no);
- VECCOPY(nor2, edge->v2->no);
-
- /* cosine angle */
- fac= nor[0]*nor1[0] + nor[1]*nor1[1] + nor[2]*nor1[2] ;
-
- vec1[0]= fac*nor1[0];
- vec1[1]= fac*nor1[1];
- vec1[2]= fac*nor1[2];
-
- /* cosine angle */
- fac= -nor[0]*nor2[0] - nor[1]*nor2[1] - nor[2]*nor2[2] ;
-
- vec1[0]+= fac*nor2[0];
- vec1[1]+= fac*nor2[1];
- vec1[2]+= fac*nor2[2];
-
- vec1[0]*= rad*len;
- vec1[1]*= rad*len;
- vec1[2]*= rad*len;
-
- co[0] += vec1[0];
- co[1] += vec1[1];
- co[2] += vec1[2];
- }
- else {
- if(rad > 0.0) { /* subdivide sphere */
- Normalize(co);
- co[0]*= rad;
- co[1]*= rad;
- co[2]*= rad;
- }
- else if(rad< 0.0) { /* fractal subdivide */
- fac= rad* VecLenf(edge->v1->co, edge->v2->co);
- vec1[0]= fac*(float)(0.5-BLI_drand());
- vec1[1]= fac*(float)(0.5-BLI_drand());
- vec1[2]= fac*(float)(0.5-BLI_drand());
- VecAddf(co, co, vec1);
- }
-
- }
-}
-
-/* assumes in the edge is the correct interpolated vertices already */
-/* percent defines the interpolation, rad and beauty are for special options */
-/* results in new vertex with correct coordinate, vertex normal and weight group info */
-static EditVert *subdivide_edge_addvert(EditEdge *edge, float rad, int beauty, float percent)
-{
- EditVert *ev;
- float co[3];
-
- co[0] = (edge->v2->co[0]-edge->v1->co[0])*percent + edge->v1->co[0];
- co[1] = (edge->v2->co[1]-edge->v1->co[1])*percent + edge->v1->co[1];
- co[2] = (edge->v2->co[2]-edge->v1->co[2])*percent + edge->v1->co[2];
-
- /* offset for smooth or sphere or fractal */
- alter_co(co, edge, rad, beauty, percent);
-
- ev = addvertlist(co, NULL);
-
- /* vert data (vgroups, ..) */
- EM_data_interp_from_verts(edge->v1, edge->v2, ev, percent);
-
- /* normal */
- ev->no[0] = (edge->v2->no[0]-edge->v1->no[0])*percent + edge->v1->no[0];
- ev->no[1] = (edge->v2->no[1]-edge->v1->no[1])*percent + edge->v1->no[1];
- ev->no[2] = (edge->v2->no[2]-edge->v1->no[2])*percent + edge->v1->no[2];
- Normalize(ev->no);
-
- return ev;
-}
-
-static void flipvertarray(EditVert** arr, short size)
-{
- EditVert *hold;
- int i;
-
- for(i=0; i<size/2; i++) {
- hold = arr[i];
- arr[i] = arr[size-i-1];
- arr[size-i-1] = hold;
- }
-}
-
-static void facecopy(EditFace *source, EditFace *target)
-{
- EditMesh *em= G.editMesh;
- float *v1 = source->v1->co, *v2 = source->v2->co, *v3 = source->v3->co;
- float *v4 = source->v4? source->v4->co: NULL;
- float w[4][4];
-
- CustomData_em_copy_data(&em->fdata, &em->fdata, source->data, &target->data);
-
- target->mat_nr = source->mat_nr;
- target->flag = source->flag;
- target->h = source->h;
-
- InterpWeightsQ3Dfl(v1, v2, v3, v4, target->v1->co, w[0]);
- InterpWeightsQ3Dfl(v1, v2, v3, v4, target->v2->co, w[1]);
- InterpWeightsQ3Dfl(v1, v2, v3, v4, target->v3->co, w[2]);
- if (target->v4)
- InterpWeightsQ3Dfl(v1, v2, v3, v4, target->v4->co, w[3]);
-
- CustomData_em_interp(&em->fdata, &source->data, NULL, (float*)w, 1, target->data);
-}
-
-static void fill_quad_single(EditFace *efa, struct GHash *gh, int numcuts, int seltype)
-{
- EditEdge *cedge=NULL;
- EditVert *v[4], **verts;
- EditFace *hold;
- short start=0, end, left, right, vertsize,i;
-
- v[0] = efa->v1;
- v[1] = efa->v2;
- v[2] = efa->v3;
- v[3] = efa->v4;
-
- if(efa->e1->f & SELECT) { cedge = efa->e1; start = 0;}
- else if(efa->e2->f & SELECT) { cedge = efa->e2; start = 1;}
- else if(efa->e3->f & SELECT) { cedge = efa->e3; start = 2;}
- else if(efa->e4->f & SELECT) { cedge = efa->e4; start = 3;}
-
- // Point verts to the array of new verts for cedge
- verts = BLI_ghash_lookup(gh, cedge);
- //This is the index size of the verts array
- vertsize = numcuts+2;
-
- // Is the original v1 the same as the first vert on the selected edge?
- // if not, the edge is running the opposite direction in this face so flip
- // the array to the correct direction
-
- if(verts[0] != v[start]) {flipvertarray(verts,numcuts+2);}
- end = (start+1)%4;
- left = (start+2)%4;
- right = (start+3)%4;
-
- /*
- We should have something like this now
-
- end start
- 3 2 1 0
- |---*---*---|
- | |
- | |
- | |
- -------------
- left right
-
- where start,end,left, right are indexes of EditFace->v1, etc (stored in v)
- and 0,1,2... are the indexes of the new verts stored in verts
-
- We will fill this case like this or this depending on even or odd cuts
-
- |---*---*---| |---*---|
- | / \ | | / \ |
- | / \ | | / \ |
- |/ \| |/ \|
- ------------- ---------
- */
-
- // Make center face
- if(vertsize % 2 == 0) {
- hold = addfacelist(verts[(vertsize-1)/2],verts[((vertsize-1)/2)+1],v[left],v[right], NULL,NULL);
- hold->e2->f2 |= EDGEINNER;
- hold->e4->f2 |= EDGEINNER;
- }else{
- hold = addfacelist(verts[(vertsize-1)/2],v[left],v[right],NULL, NULL,NULL);
- hold->e1->f2 |= EDGEINNER;
- hold->e3->f2 |= EDGEINNER;
- }
- facecopy(efa,hold);
-
- // Make side faces
- for(i=0;i<(vertsize-1)/2;i++) {
- hold = addfacelist(verts[i],verts[i+1],v[right],NULL,NULL,NULL);
- facecopy(efa,hold);
- if(i+1 != (vertsize-1)/2) {
- if(seltype == SUBDIV_SELECT_INNER) {
- hold->e2->f2 |= EDGEINNER;
- }
- }
- hold = addfacelist(verts[vertsize-2-i],verts[vertsize-1-i],v[left],NULL,NULL,NULL);
- facecopy(efa,hold);
- if(i+1 != (vertsize-1)/2) {
- if(seltype == SUBDIV_SELECT_INNER) {
- hold->e3->f2 |= EDGEINNER;
- }
- }
- }
-}
-
-static void fill_tri_single(EditFace *efa, struct GHash *gh, int numcuts, int seltype)
-{
- EditEdge *cedge=NULL;
- EditVert *v[3], **verts;
- EditFace *hold;
- short start=0, end, op, vertsize,i;
-
- v[0] = efa->v1;
- v[1] = efa->v2;
- v[2] = efa->v3;
-
- if(efa->e1->f & SELECT) { cedge = efa->e1; start = 0;}
- else if(efa->e2->f & SELECT) { cedge = efa->e2; start = 1;}
- else if(efa->e3->f & SELECT) { cedge = efa->e3; start = 2;}
-
- // Point verts to the array of new verts for cedge
- verts = BLI_ghash_lookup(gh, cedge);
- //This is the index size of the verts array
- vertsize = numcuts+2;
-
- // Is the original v1 the same as the first vert on the selected edge?
- // if not, the edge is running the opposite direction in this face so flip
- // the array to the correct direction
-
- if(verts[0] != v[start]) {flipvertarray(verts,numcuts+2);}
- end = (start+1)%3;
- op = (start+2)%3;
-
- /*
- We should have something like this now
-
- end start
- 3 2 1 0
- |---*---*---|
- \ |
- \ |
- \ |
- \ |
- \ |
- \ |
- |op
-
- where start,end,op are indexes of EditFace->v1, etc (stored in v)
- and 0,1,2... are the indexes of the new verts stored in verts
-
- We will fill this case like this or this depending on even or odd cuts
-
- 3 2 1 0
- |---*---*---|
- \ \ \ |
- \ \ \ |
- \ \ \ |
- \ \ \|
- \ \\|
- \ |
- |op
- */
-
- // Make side faces
- for(i=0;i<(vertsize-1);i++) {
- hold = addfacelist(verts[i],verts[i+1],v[op],NULL,NULL,NULL);
- if(i+1 != vertsize-1) {
- if(seltype == SUBDIV_SELECT_INNER) {
- hold->e2->f2 |= EDGEINNER;
- }
- }
- facecopy(efa,hold);
- }
-}
-
-static void fill_quad_double_op(EditFace *efa, struct GHash *gh, int numcuts)
-{
- EditEdge *cedge[2]={NULL, NULL};
- EditVert *v[4], **verts[2];
- EditFace *hold;
- short start=0, end, left, right, vertsize,i;
-
- v[0] = efa->v1;
- v[1] = efa->v2;
- v[2] = efa->v3;
- v[3] = efa->v4;
-
- if(efa->e1->f & SELECT) { cedge[0] = efa->e1; cedge[1] = efa->e3; start = 0;}
- else if(efa->e2->f & SELECT) { cedge[0] = efa->e2; cedge[1] = efa->e4; start = 1;}
-
- // Point verts[0] and [1] to the array of new verts for cedge[0] and cedge[1]
- verts[0] = BLI_ghash_lookup(gh, cedge[0]);
- verts[1] = BLI_ghash_lookup(gh, cedge[1]);
- //This is the index size of the verts array
- vertsize = numcuts+2;
-
- // Is the original v1 the same as the first vert on the selected edge?
- // if not, the edge is running the opposite direction in this face so flip
- // the array to the correct direction
-
- if(verts[0][0] != v[start]) {flipvertarray(verts[0],numcuts+2);}
- end = (start+1)%4;
- left = (start+2)%4;
- right = (start+3)%4;
- if(verts[1][0] != v[left]) {flipvertarray(verts[1],numcuts+2);}
- /*
- We should have something like this now
-
- end start
- 3 2 1 0
- |---*---*---|
- | |
- | |
- | |
- |---*---*---|
- 0 1 2 3
- left right
-
- We will fill this case like this or this depending on even or odd cuts
-
- |---*---*---|
- | | | |
- | | | |
- | | | |
- |---*---*---|
- */
-
- // Make side faces
- for(i=0;i<vertsize-1;i++) {
- hold = addfacelist(verts[0][i],verts[0][i+1],verts[1][vertsize-2-i],verts[1][vertsize-1-i],NULL,NULL);
- if(i < vertsize-2) {
- hold->e2->f2 |= EDGEINNER;
- hold->e2->f2 |= DOUBLEOPFILL;
- }
- facecopy(efa,hold);
- }
-}
-
-static void fill_quad_double_adj_path(EditFace *efa, struct GHash *gh, int numcuts)
-{
- EditEdge *cedge[2]={NULL, NULL};
- EditVert *v[4], **verts[2];
- EditFace *hold;
- short start=0, start2=0, vertsize,i;
-
- v[0] = efa->v1;
- v[1] = efa->v2;
- v[2] = efa->v3;
- v[3] = efa->v4;
-
- if(efa->e1->f & SELECT && efa->e2->f & SELECT) {cedge[0] = efa->e1; cedge[1] = efa->e2; start = 0; start2 = 1;}
- if(efa->e2->f & SELECT && efa->e3->f & SELECT) {cedge[0] = efa->e2; cedge[1] = efa->e3; start = 1; start2 = 2;}
- if(efa->e3->f & SELECT && efa->e4->f & SELECT) {cedge[0] = efa->e3; cedge[1] = efa->e4; start = 2; start2 = 3;}
- if(efa->e4->f & SELECT && efa->e1->f & SELECT) {cedge[0] = efa->e4; cedge[1] = efa->e1; start = 3; start2 = 0;}
-
- // Point verts[0] and [1] to the array of new verts for cedge[0] and cedge[1]
- verts[0] = BLI_ghash_lookup(gh, cedge[0]);
- verts[1] = BLI_ghash_lookup(gh, cedge[1]);
- //This is the index size of the verts array
- vertsize = numcuts+2;
-
- // Is the original v1 the same as the first vert on the selected edge?
- // if not, the edge is running the opposite direction in this face so flip
- // the array to the correct direction
-
- if(verts[0][0] != v[start]) {flipvertarray(verts[0],numcuts+2);}
- if(verts[1][0] != v[start2]) {flipvertarray(verts[1],numcuts+2);}
- /*
- We should have something like this now
-
- end start
- 3 2 1 0
- start2 0|---*---*---|
- | |
- 1* |
- | |
- 2* |
- | |
- end2 3|-----------|
-
- We will fill this case like this or this depending on even or odd cuts
- |---*---*---|
- | / / / |
- * / / |
- | / / |
- * / |
- | / |
- |-----------|
- */
-
- // Make outside tris
- hold = addfacelist(verts[0][vertsize-2],verts[0][vertsize-1],verts[1][1],NULL,NULL,NULL);
- /* when ctrl is depressed, only want verts on the cutline selected */
- if (G.qual != LR_CTRLKEY)
- hold->e3->f2 |= EDGEINNER;
- facecopy(efa,hold);
- hold = addfacelist(verts[0][0],verts[1][vertsize-1],v[(start2+2)%4],NULL,NULL,NULL);
- /* when ctrl is depressed, only want verts on the cutline selected */
- if (G.qual != LR_CTRLKEY)
- hold->e1->f2 |= EDGEINNER;
- facecopy(efa,hold);
- //if(G.scene->toolsettings->editbutflag & B_AUTOFGON) {
- // hold->e1->h |= EM_FGON;
- //}
- // Make side faces
-
- for(i=0;i<numcuts;i++) {
- hold = addfacelist(verts[0][i],verts[0][i+1],verts[1][vertsize-1-(i+1)],verts[1][vertsize-1-i],NULL,NULL);
- hold->e2->f2 |= EDGEINNER;
- facecopy(efa,hold);
- }
- //EM_fgon_flags();
-
-}
-
-static void fill_quad_double_adj_fan(EditFace *efa, struct GHash *gh, int numcuts)
-{
- EditEdge *cedge[2]={NULL, NULL};
- EditVert *v[4], *op=NULL, **verts[2];
- EditFace *hold;
- short start=0, start2=0, vertsize,i;
-
- v[0] = efa->v1;
- v[1] = efa->v2;
- v[2] = efa->v3;
- v[3] = efa->v4;
-
- if(efa->e1->f & SELECT && efa->e2->f & SELECT) {cedge[0] = efa->e1; cedge[1] = efa->e2; start = 0; start2 = 1; op = efa->v4;}
- if(efa->e2->f & SELECT && efa->e3->f & SELECT) {cedge[0] = efa->e2; cedge[1] = efa->e3; start = 1; start2 = 2; op = efa->v1;}
- if(efa->e3->f & SELECT && efa->e4->f & SELECT) {cedge[0] = efa->e3; cedge[1] = efa->e4; start = 2; start2 = 3; op = efa->v2;}
- if(efa->e4->f & SELECT && efa->e1->f & SELECT) {cedge[0] = efa->e4; cedge[1] = efa->e1; start = 3; start2 = 0; op = efa->v3;}
-
-
- // Point verts[0] and [1] to the array of new verts for cedge[0] and cedge[1]
- verts[0] = BLI_ghash_lookup(gh, cedge[0]);
- verts[1] = BLI_ghash_lookup(gh, cedge[1]);
- //This is the index size of the verts array
- vertsize = numcuts+2;
-
- // Is the original v1 the same as the first vert on the selected edge?
- // if not, the edge is running the opposite direction in this face so flip
- // the array to the correct direction
-
- if(verts[0][0] != v[start]) {flipvertarray(verts[0],numcuts+2);}
- if(verts[1][0] != v[start2]) {flipvertarray(verts[1],numcuts+2);}
- /*
- We should have something like this now
-
- end start
- 3 2 1 0
- start2 0|---*---*---|
- | |
- 1* |
- | |
- 2* |
- | |
- end2 3|-----------|op
-
- We will fill this case like this or this (warning horrible ascii art follows)
- |---*---*---|
- | \ \ \ |
- *---\ \ \ |
- | \ \ \ \|
- *---- \ \ \ |
- | --- \\\|
- |-----------|
- */
-
- for(i=0;i<=numcuts;i++) {
- hold = addfacelist(op,verts[1][numcuts-i],verts[1][numcuts-i+1],NULL,NULL,NULL);
- hold->e1->f2 |= EDGEINNER;
- facecopy(efa,hold);
-
- hold = addfacelist(op,verts[0][i],verts[0][i+1],NULL,NULL,NULL);
- hold->e3->f2 |= EDGEINNER;
- facecopy(efa,hold);
- }
-}
-
-static void fill_quad_double_adj_inner(EditFace *efa, struct GHash *gh, int numcuts)
-{
- EditEdge *cedge[2]={NULL, NULL};
- EditVert *v[4], *op=NULL, **verts[2],**inner;
- EditFace *hold;
- short start=0, start2=0, vertsize,i;
- float co[3];
-
- v[0] = efa->v1;
- v[1] = efa->v2;
- v[2] = efa->v3;
- v[3] = efa->v4;
-
- if(efa->e1->f & SELECT && efa->e2->f & SELECT) {cedge[0] = efa->e1; cedge[1] = efa->e2; start = 0; start2 = 1; op = efa->v4;}
- if(efa->e2->f & SELECT && efa->e3->f & SELECT) {cedge[0] = efa->e2; cedge[1] = efa->e3; start = 1; start2 = 2; op = efa->v1;}
- if(efa->e3->f & SELECT && efa->e4->f & SELECT) {cedge[0] = efa->e3; cedge[1] = efa->e4; start = 2; start2 = 3; op = efa->v2;}
- if(efa->e4->f & SELECT && efa->e1->f & SELECT) {cedge[0] = efa->e4; cedge[1] = efa->e1; start = 3; start2 = 0; op = efa->v3;}
-
-
- // Point verts[0] and [1] to the array of new verts for cedge[0] and cedge[1]
- verts[0] = BLI_ghash_lookup(gh, cedge[0]);
- verts[1] = BLI_ghash_lookup(gh, cedge[1]);
- //This is the index size of the verts array
- vertsize = numcuts+2;
-
- // Is the original v1 the same as the first vert on the selected edge?
- // if not, the edge is running the opposite direction in this face so flip
- // the array to the correct direction
-
- if(verts[0][0] != v[start]) {flipvertarray(verts[0],numcuts+2);}
- if(verts[1][0] != v[start2]) {flipvertarray(verts[1],numcuts+2);}
- /*
- We should have something like this now
-
- end start
- 3 2 1 0
- start2 0|---*---*---|
- | |
- 1* |
- | |
- 2* |
- | |
- end2 3|-----------|op
-
- We will fill this case like this or this (warning horrible ascii art follows)
- |---*-----*---|
- | * / |
- * \ / |
- | * |
- | / \ |
- * \ |
- | \ |
- |-------------|
- */
-
- // Add Inner Vert(s)
- inner = MEM_mallocN(sizeof(EditVert*)*numcuts,"New inner verts");
-
- for(i=0;i<numcuts;i++) {
- co[0] = (verts[0][numcuts-i]->co[0] + verts[1][i+1]->co[0] ) / 2 ;
- co[1] = (verts[0][numcuts-i]->co[1] + verts[1][i+1]->co[1] ) / 2 ;
- co[2] = (verts[0][numcuts-i]->co[2] + verts[1][i+1]->co[2] ) / 2 ;
- inner[i] = addvertlist(co, NULL);
- inner[i]->f2 |= EDGEINNER;
-
- EM_data_interp_from_verts(verts[0][numcuts-i], verts[1][i+1], inner[i], 0.5f);
- }
-
- // Add Corner Quad
- hold = addfacelist(verts[0][numcuts+1],verts[1][1],inner[0],verts[0][numcuts],NULL,NULL);
- hold->e2->f2 |= EDGEINNER;
- hold->e3->f2 |= EDGEINNER;
- facecopy(efa,hold);
- // Add Bottom Quads
- hold = addfacelist(verts[0][0],verts[0][1],inner[numcuts-1],op,NULL,NULL);
- hold->e2->f2 |= EDGEINNER;
- facecopy(efa,hold);
-
- hold = addfacelist(op,inner[numcuts-1],verts[1][numcuts],verts[1][numcuts+1],NULL,NULL);
- hold->e2->f2 |= EDGEINNER;
- facecopy(efa,hold);
-
- //if(G.scene->toolsettings->editbutflag & B_AUTOFGON) {
- // hold->e1->h |= EM_FGON;
- //}
- // Add Fill Quads (if # cuts > 1)
-
- for(i=0;i<numcuts-1;i++) {
- hold = addfacelist(inner[i],verts[1][i+1],verts[1][i+2],inner[i+1],NULL,NULL);
- hold->e1->f2 |= EDGEINNER;
- hold->e3->f2 |= EDGEINNER;
- facecopy(efa,hold);
-
- hold = addfacelist(inner[i],inner[i+1],verts[0][numcuts-1-i],verts[0][numcuts-i],NULL,NULL);
- hold->e2->f2 |= EDGEINNER;
- hold->e4->f2 |= EDGEINNER;
- facecopy(efa,hold);
-
- //if(G.scene->toolsettings->editbutflag & B_AUTOFGON) {
- // hold->e1->h |= EM_FGON;
- //}
- }
-
- //EM_fgon_flags();
-
- MEM_freeN(inner);
-}
-
-static void fill_tri_double(EditFace *efa, struct GHash *gh, int numcuts)
-{
- EditEdge *cedge[2]={NULL, NULL};
- EditVert *v[3], **verts[2];
- EditFace *hold;
- short start=0, start2=0, vertsize,i;
-
- v[0] = efa->v1;
- v[1] = efa->v2;
- v[2] = efa->v3;
-
- if(efa->e1->f & SELECT && efa->e2->f & SELECT) {cedge[0] = efa->e1; cedge[1] = efa->e2; start = 0; start2 = 1;}
- if(efa->e2->f & SELECT && efa->e3->f & SELECT) {cedge[0] = efa->e2; cedge[1] = efa->e3; start = 1; start2 = 2;}
- if(efa->e3->f & SELECT && efa->e1->f & SELECT) {cedge[0] = efa->e3; cedge[1] = efa->e1; start = 2; start2 = 0;}
-
- // Point verts[0] and [1] to the array of new verts for cedge[0] and cedge[1]
- verts[0] = BLI_ghash_lookup(gh, cedge[0]);
- verts[1] = BLI_ghash_lookup(gh, cedge[1]);
- //This is the index size of the verts array
- vertsize = numcuts+2;
-
- // Is the original v1 the same as the first vert on the selected edge?
- // if not, the edge is running the opposite direction in this face so flip
- // the array to the correct direction
-
- if(verts[0][0] != v[start]) {flipvertarray(verts[0],numcuts+2);}
- if(verts[1][0] != v[start2]) {flipvertarray(verts[1],numcuts+2);}
- /*
- We should have something like this now
-
- end start
- 3 2 1 0
- start2 0|---*---*---|
- | /
- 1* /
- | /
- 2* /
- | /
- end2 3|
-
- We will fill this case like this or this depending on even or odd cuts
- |---*---*---|
- | / / /
- * / /
- | / /
- * /
- | /
- |
- */
-
- // Make outside tri
- hold = addfacelist(verts[0][vertsize-2],verts[0][vertsize-1],verts[1][1],NULL,NULL,NULL);
- hold->e3->f2 |= EDGEINNER;
- facecopy(efa,hold);
- // Make side faces
-
- for(i=0;i<numcuts;i++) {
- hold = addfacelist(verts[0][i],verts[0][i+1],verts[1][vertsize-1-(i+1)],verts[1][vertsize-1-i],NULL,NULL);
- hold->e2->f2 |= EDGEINNER;
- facecopy(efa,hold);
- }
-}
-
-static void fill_quad_triple(EditFace *efa, struct GHash *gh, int numcuts)
-{
- EditEdge *cedge[3]={0};
- EditVert *v[4], **verts[3];
- EditFace *hold;
- short start=0, start2=0, start3=0, vertsize, i, repeats;
-
- v[0] = efa->v1;
- v[1] = efa->v2;
- v[2] = efa->v3;
- v[3] = efa->v4;
-
- if(!(efa->e1->f & SELECT)) {
- cedge[0] = efa->e2;
- cedge[1] = efa->e3;
- cedge[2] = efa->e4;
- start = 1;start2 = 2;start3 = 3;
- }
- if(!(efa->e2->f & SELECT)) {
- cedge[0] = efa->e3;
- cedge[1] = efa->e4;
- cedge[2] = efa->e1;
- start = 2;start2 = 3;start3 = 0;
- }
- if(!(efa->e3->f & SELECT)) {
- cedge[0] = efa->e4;
- cedge[1] = efa->e1;
- cedge[2] = efa->e2;
- start = 3;start2 = 0;start3 = 1;
- }
- if(!(efa->e4->f & SELECT)) {
- cedge[0] = efa->e1;
- cedge[1] = efa->e2;
- cedge[2] = efa->e3;
- start = 0;start2 = 1;start3 = 2;
- }
- // Point verts[0] and [1] to the array of new verts for cedge[0] and cedge[1]
- verts[0] = BLI_ghash_lookup(gh, cedge[0]);
- verts[1] = BLI_ghash_lookup(gh, cedge[1]);
- verts[2] = BLI_ghash_lookup(gh, cedge[2]);
- //This is the index size of the verts array
- vertsize = numcuts+2;
-
- // Is the original v1 the same as the first vert on the selected edge?
- // if not, the edge is running the opposite direction in this face so flip
- // the array to the correct direction
-
- if(verts[0][0] != v[start]) {flipvertarray(verts[0],numcuts+2);}
- if(verts[1][0] != v[start2]) {flipvertarray(verts[1],numcuts+2);}
- if(verts[2][0] != v[start3]) {flipvertarray(verts[2],numcuts+2);}
- /*
- We should have something like this now
-
- start2
- 3 2 1 0
- start3 0|---*---*---|3
- | |
- 1* *2
- | |
- 2* *1
- | |
- 3|-----------|0 start
-
- We will fill this case like this or this depending on even or odd cuts
- there are a couple of differences. For odd cuts, there is a tri in the
- middle as well as 1 quad at the bottom (not including the extra quads
- for odd cuts > 1
-
- For even cuts, there is a quad in the middle and 2 quads on the bottom
-
- they are numbered here for clarity
-
- 1 outer tris and bottom quads
- 2 inner tri or quad
- 3 repeating quads
-
- |---*---*---*---|
- |1/ / \ \ 1|
- |/ 3 / \ 3 \|
- * / 2 \ *
- | / \ |
- |/ \ |
- *---------------*
- | 3 |
- | |
- *---------------*
- | |
- | 1 |
- | |
- |---------------|
-
- |---*---*---*---*---|
- | 1/ / \ \ 1|
- | / / \ \ |
- |/ 3 / \ 3 \|
- * / \ *
- | / \ |
- | / 2 \ |
- |/ \|
- *-------------------*
- | |
- | 3 |
- | |
- *-------------------*
- | |
- | 1 |
- | |
- *-------------------*
- | |
- | 1 |
- | |
- |-------------------|
-
- */
-
- // Make outside tris
- hold = addfacelist(verts[0][vertsize-2],verts[0][vertsize-1],verts[1][1],NULL,NULL,NULL);
- hold->e3->f2 |= EDGEINNER;
- facecopy(efa,hold);
- hold = addfacelist(verts[1][vertsize-2],verts[1][vertsize-1],verts[2][1],NULL,NULL,NULL);
- hold->e3->f2 |= EDGEINNER;
- facecopy(efa,hold);
- // Make bottom quad
- hold = addfacelist(verts[0][0],verts[0][1],verts[2][vertsize-2],verts[2][vertsize-1],NULL,NULL);
- hold->e2->f2 |= EDGEINNER;
- facecopy(efa,hold);
- //If it is even cuts, add the 2nd lower quad
- if(numcuts % 2 == 0) {
- hold = addfacelist(verts[0][1],verts[0][2],verts[2][vertsize-3],verts[2][vertsize-2],NULL,NULL);
- hold->e2->f2 |= EDGEINNER;
- facecopy(efa,hold);
- // Also Make inner quad
- hold = addfacelist(verts[1][numcuts/2],verts[1][(numcuts/2)+1],verts[2][numcuts/2],verts[0][(numcuts/2)+1],NULL,NULL);
- hold->e3->f2 |= EDGEINNER;
- //if(G.scene->toolsettings->editbutflag & B_AUTOFGON) {
- // hold->e3->h |= EM_FGON;
- //}
- facecopy(efa,hold);
- repeats = (numcuts / 2) -1;
- } else {
- // Make inner tri
- hold = addfacelist(verts[1][(numcuts/2)+1],verts[2][(numcuts/2)+1],verts[0][(numcuts/2)+1],NULL,NULL,NULL);
- hold->e2->f2 |= EDGEINNER;
- //if(G.scene->toolsettings->editbutflag & B_AUTOFGON) {
- // hold->e2->h |= EM_FGON;
- //}
- facecopy(efa,hold);
- repeats = ((numcuts+1) / 2)-1;
- }
-
- // cuts for 1 and 2 do not have the repeating quads
- if(numcuts < 3) {repeats = 0;}
- for(i=0;i<repeats;i++) {
- //Make side repeating Quads
- hold = addfacelist(verts[1][i+1],verts[1][i+2],verts[0][vertsize-i-3],verts[0][vertsize-i-2],NULL,NULL);
- hold->e2->f2 |= EDGEINNER;
- facecopy(efa,hold);
- hold = addfacelist(verts[1][vertsize-i-3],verts[1][vertsize-i-2],verts[2][i+1],verts[2][i+2],NULL,NULL);
- hold->e4->f2 |= EDGEINNER;
- facecopy(efa,hold);
- }
- // Do repeating bottom quads
- for(i=0;i<repeats;i++) {
- if(numcuts % 2 == 1) {
- hold = addfacelist(verts[0][1+i],verts[0][2+i],verts[2][vertsize-3-i],verts[2][vertsize-2-i],NULL,NULL);
- } else {
- hold = addfacelist(verts[0][2+i],verts[0][3+i],verts[2][vertsize-4-i],verts[2][vertsize-3-i],NULL,NULL);
- }
- hold->e2->f2 |= EDGEINNER;
- facecopy(efa,hold);
- }
- //EM_fgon_flags();
-}
-
-static void fill_quad_quadruple(EditFace *efa, struct GHash *gh, int numcuts, float rad, int beauty)
-{
- EditVert **verts[4], ***innerverts;
- EditFace *hold;
- EditEdge temp;
- short vertsize, i, j;
-
- // Point verts[0] and [1] to the array of new verts for cedge[0] and cedge[1]
- verts[0] = BLI_ghash_lookup(gh, efa->e1);
- verts[1] = BLI_ghash_lookup(gh, efa->e2);
- verts[2] = BLI_ghash_lookup(gh, efa->e3);
- verts[3] = BLI_ghash_lookup(gh, efa->e4);
-
- //This is the index size of the verts array
- vertsize = numcuts+2;
-
- // Is the original v1 the same as the first vert on the selected edge?
- // if not, the edge is running the opposite direction in this face so flip
- // the array to the correct direction
-
- if(verts[0][0] != efa->v1) {flipvertarray(verts[0],numcuts+2);}
- if(verts[1][0] != efa->v2) {flipvertarray(verts[1],numcuts+2);}
- if(verts[2][0] == efa->v3) {flipvertarray(verts[2],numcuts+2);}
- if(verts[3][0] == efa->v4) {flipvertarray(verts[3],numcuts+2);}
- /*
- We should have something like this now
- 1
-
- 3 2 1 0
- 0|---*---*---|0
- | |
- 1* *1
- 2 | | 4
- 2* *2
- | |
- 3|---*---*---|3
- 3 2 1 0
-
- 3
- // we will fill a 2 dim array of editvert*s to make filling easier
- // the innervert order is shown
-
- 0 0---1---2---3
- | | | |
- 1 0---1---2---3
- | | | |
- 2 0---1---2---3
- | | | |
- 3 0---1---2---3
-
- */
- innerverts = MEM_mallocN(sizeof(EditVert*)*(numcuts+2),"quad-quad subdiv inner verts outer array");
- for(i=0;i<numcuts+2;i++) {
- innerverts[i] = MEM_mallocN(sizeof(EditVert*)*(numcuts+2),"quad-quad subdiv inner verts inner array");
- }
-
- // first row is e1 last row is e3
- for(i=0;i<numcuts+2;i++) {
- innerverts[0][i] = verts[0][(numcuts+1)-i];
- innerverts[numcuts+1][i] = verts[2][(numcuts+1)-i];
- }
-
- for(i=1;i<=numcuts;i++) {
- /* we create a fake edge for the next loop */
- temp.v2 = innerverts[i][0] = verts[1][i];
- temp.v1 = innerverts[i][numcuts+1] = verts[3][i];
-
- for(j=1;j<=numcuts;j++) {
- float percent= (float)j/(float)(numcuts+1);
-
- innerverts[i][(numcuts+1)-j]= subdivide_edge_addvert(&temp, rad, beauty, percent);
- }
- }
- // Fill with faces
- for(i=0;i<numcuts+1;i++) {
- for(j=0;j<numcuts+1;j++) {
- hold = addfacelist(innerverts[i][j+1],innerverts[i][j],innerverts[i+1][j],innerverts[i+1][j+1],NULL,NULL);
- hold->e1->f2 = EDGENEW;
- hold->e2->f2 = EDGENEW;
- hold->e3->f2 = EDGENEW;
- hold->e4->f2 = EDGENEW;
-
- if(i != 0) { hold->e1->f2 |= EDGEINNER; }
- if(j != 0) { hold->e2->f2 |= EDGEINNER; }
- if(i != numcuts) { hold->e3->f2 |= EDGEINNER; }
- if(j != numcuts) { hold->e4->f2 |= EDGEINNER; }
-
- facecopy(efa,hold);
- }
- }
- // Clean up our dynamic multi-dim array
- for(i=0;i<numcuts+2;i++) {
- MEM_freeN(innerverts[i]);
- }
- MEM_freeN(innerverts);
-}
-
-static void fill_tri_triple(EditFace *efa, struct GHash *gh, int numcuts, float rad, int beauty)
-{
- EditVert **verts[3], ***innerverts;
- short vertsize, i, j;
- EditFace *hold;
- EditEdge temp;
-
- // Point verts[0] and [1] to the array of new verts for cedge[0] and cedge[1]
- verts[0] = BLI_ghash_lookup(gh, efa->e1);
- verts[1] = BLI_ghash_lookup(gh, efa->e2);
- verts[2] = BLI_ghash_lookup(gh, efa->e3);
-
- //This is the index size of the verts array
- vertsize = numcuts+2;
-
- // Is the original v1 the same as the first vert on the selected edge?
- // if not, the edge is running the opposite direction in this face so flip
- // the array to the correct direction
-
- if(verts[0][0] != efa->v1) {flipvertarray(verts[0],numcuts+2);}
- if(verts[1][0] != efa->v2) {flipvertarray(verts[1],numcuts+2);}
- if(verts[2][0] != efa->v3) {flipvertarray(verts[2],numcuts+2);}
- /*
- We should have something like this now
- 3
-
- 3 2 1 0
- 0|---*---*---|3
- | /
- 1 1* *2
- | /
- 2* *1 2
- | /
- 3|/
- 0
-
- we will fill a 2 dim array of editvert*s to make filling easier
-
- 3
-
- 0 0---1---2---3---4
- | / | / |/ | /
- 1 0---1----2---3
- 1 | / | / | /
- 2 0----1---2 2
- | / | /
- |/ |/
- 3 0---1
- | /
- |/
- 4 0
-
- */
-
- innerverts = MEM_mallocN(sizeof(EditVert*)*(numcuts+2),"tri-tri subdiv inner verts outer array");
- for(i=0;i<numcuts+2;i++) {
- innerverts[i] = MEM_mallocN(sizeof(EditVert*)*((numcuts+2)-i),"tri-tri subdiv inner verts inner array");
- }
- //top row is e3 backwards
- for(i=0;i<numcuts+2;i++) {
- innerverts[0][i] = verts[2][(numcuts+1)-i];
- }
-
- for(i=1;i<=numcuts+1;i++) {
- //fake edge, first vert is from e1, last is from e2
- temp.v1= innerverts[i][0] = verts[0][i];
- temp.v2= innerverts[i][(numcuts+1)-i] = verts[1][(numcuts+1)-i];
-
- for(j=1;j<(numcuts+1)-i;j++) {
- float percent= (float)j/(float)((numcuts+1)-i);
-
- innerverts[i][((numcuts+1)-i)-j]= subdivide_edge_addvert(&temp, rad, beauty, 1-percent);
- }
- }
-
- // Now fill the verts with happy little tris :)
- for(i=0;i<=numcuts+1;i++) {
- for(j=0;j<(numcuts+1)-i;j++) {
- //We always do the first tri
- hold = addfacelist(innerverts[i][j+1],innerverts[i][j],innerverts[i+1][j],NULL,NULL,NULL);
- hold->e1->f2 |= EDGENEW;
- hold->e2->f2 |= EDGENEW;
- hold->e3->f2 |= EDGENEW;
- if(i != 0) { hold->e1->f2 |= EDGEINNER; }
- if(j != 0) { hold->e2->f2 |= EDGEINNER; }
- if(j+1 != (numcuts+1)-i) {hold->e3->f2 |= EDGEINNER;}
-
- facecopy(efa,hold);
- //if there are more to come, we do the 2nd
- if(j+1 <= numcuts-i) {
- hold = addfacelist(innerverts[i+1][j],innerverts[i+1][j+1],innerverts[i][j+1],NULL,NULL,NULL);
- facecopy(efa,hold);
- hold->e1->f2 |= EDGENEW;
- hold->e2->f2 |= EDGENEW;
- hold->e3->f2 |= EDGENEW;
- }
- }
- }
-
- // Clean up our dynamic multi-dim array
- for(i=0;i<numcuts+2;i++) {
- MEM_freeN(innerverts[i]);
- }
- MEM_freeN(innerverts);
-}
-
-//Next two fill types are for knife exact only and are provided to allow for knifing through vertices
-//This means there is no multicut!
-static void fill_quad_doublevert(EditFace *efa, int v1, int v2){
- EditFace *hold;
- /*
- Depending on which two vertices have been knifed through (v1 and v2), we
- triangulate like the patterns below.
- X-------| |-------X
- | \ | | / |
- | \ | | / |
- | \ | | / |
- --------X X--------
- */
-
- if(v1 == 1 && v2 == 3){
- hold= addfacelist(efa->v1, efa->v2, efa->v3, 0, efa, NULL);
- hold->e1->f2 |= EDGENEW;
- hold->e2->f2 |= EDGENEW;
- hold->e3->f2 |= EDGENEW;
- hold->e3->f2 |= EDGEINNER;
- facecopy(efa, hold);
-
- hold= addfacelist(efa->v1, efa->v3, efa->v4, 0, efa, NULL);
- hold->e1->f2 |= EDGENEW;
- hold->e2->f2 |= EDGENEW;
- hold->e3->f2 |= EDGENEW;
- hold->e1->f2 |= EDGEINNER;
- facecopy(efa, hold);
- }
- else{
- hold= addfacelist(efa->v1, efa->v2, efa->v4, 0, efa, NULL);
- hold->e1->f2 |= EDGENEW;
- hold->e2->f2 |= EDGENEW;
- hold->e3->f2 |= EDGENEW;
- hold->e2->f2 |= EDGEINNER;
- facecopy(efa, hold);
-
- hold= addfacelist(efa->v2, efa->v3, efa->v4, 0, efa, NULL);
- hold->e1->f2 |= EDGENEW;
- hold->e2->f2 |= EDGENEW;
- hold->e3->f2 |= EDGENEW;
- hold->e3->f2 |= EDGEINNER;
- facecopy(efa, hold);
- }
-}
-
-static void fill_quad_singlevert(EditFace *efa, struct GHash *gh)
-{
- EditEdge *cedge=NULL;
- EditVert *v[4], **verts;
- EditFace *hold;
- short start=0, end, left, right, vertsize;
-
- v[0] = efa->v1;
- v[1] = efa->v2;
- v[2] = efa->v3;
- v[3] = efa->v4;
-
- if(efa->e1->f & SELECT) { cedge = efa->e1; start = 0;}
- else if(efa->e2->f & SELECT) { cedge = efa->e2; start = 1;}
- else if(efa->e3->f & SELECT) { cedge = efa->e3; start = 2;}
- else if(efa->e4->f & SELECT) { cedge = efa->e4; start = 3;}
-
- // Point verts to the array of new verts for cedge
- verts = BLI_ghash_lookup(gh, cedge);
- //This is the index size of the verts array
- vertsize = 3;
-
- // Is the original v1 the same as the first vert on the selected edge?
- // if not, the edge is running the opposite direction in this face so flip
- // the array to the correct direction
-
- if(verts[0] != v[start]) {flipvertarray(verts,3);}
- end = (start+1)%4;
- left = (start+2)%4;
- right = (start+3)%4;
-
-/*
- We should have something like this now
-
- end start
- 2 1 0
- |-----*-----|
- | |
- | |
- | |
- -------------
- left right
-
- where start,end,left, right are indexes of EditFace->v1, etc (stored in v)
- and 0,1,2 are the indexes of the new verts stored in verts. We fill like
- this, depending on whether its vertex 'left' or vertex 'right' thats
- been knifed through...
-
- |---*---| |---*---|
- | / | | \ |
- | / | | \ |
- |/ | | \|
- X-------- --------X
-*/
-
- if(v[left]->f1){
- //triangle is composed of cutvert, end and left
- hold = addfacelist(verts[1],v[end],v[left],NULL, NULL,NULL);
- hold->e1->f2 |= EDGENEW;
- hold->e2->f2 |= EDGENEW;
- hold->e3->f2 |= EDGENEW;
- hold->e3->f2 |= EDGEINNER;
- facecopy(efa, hold);
-
- //quad is composed of cutvert, left, right and start
- hold = addfacelist(verts[1],v[left],v[right],v[start], NULL, NULL);
- hold->e1->f2 |= EDGENEW;
- hold->e2->f2 |= EDGENEW;
- hold->e3->f2 |= EDGENEW;
- hold->e4->f2 |= EDGENEW;
- hold->e1->f2 |= EDGEINNER;
- facecopy(efa, hold);
- }
- else if(v[right]->f1){
- //triangle is composed of cutvert, right and start
- hold = addfacelist(verts[1],v[right],v[start], NULL, NULL, NULL);
- hold->e1->f2 |= EDGENEW;
- hold->e2->f2 |= EDGENEW;
- hold->e3->f2 |= EDGENEW;
- hold->e1->f2 |= EDGEINNER;
- facecopy(efa, hold);
- //quad is composed of cutvert, end, left, right
- hold = addfacelist(verts[1],v[end], v[left], v[right], NULL, NULL);
- hold->e1->f2 |= EDGENEW;
- hold->e2->f2 |= EDGENEW;
- hold->e3->f2 |= EDGENEW;
- hold->e4->f2 |= EDGENEW;
- hold->e4->f2 |= EDGEINNER;
- facecopy(efa, hold);
- }
-
-}
-
-// This function takes an example edge, the current point to create and
-// the total # of points to create, then creates the point and return the
-// editvert pointer to it.
-static EditVert *subdivideedgenum(EditEdge *edge, int curpoint, int totpoint, float rad, int beauty)
-{
- EditVert *ev;
- float percent;
-
- if (beauty & (B_PERCENTSUBD) && totpoint == 1)
- //percent=(float)(edge->tmp.l)/32768.0f;
- percent= edge->tmp.fp;
- else
- percent= (float)curpoint/(float)(totpoint+1);
-
- ev= subdivide_edge_addvert(edge, rad, beauty, percent);
- ev->f = edge->v1->f;
-
- return ev;
-}
-
-void esubdivideflag(int flag, float rad, int beauty, int numcuts, int seltype)
-{
- EditMesh *em = G.editMesh;
- EditFace *ef;
- EditEdge *eed, *cedge, *sort[4];
- EditVert **templist;
- struct GHash *gh;
- float length[4], v1mat[3], v2mat[3], v3mat[3], v4mat[3];
- int i, j, edgecount, touchcount, facetype,hold;
-
- if(multires_test()) return;
-
- //Set faces f1 to 0 cause we need it later
- for(ef=em->faces.first;ef;ef = ef->next) {
- ef->f1 = 0;
- }
-
- //Flush vertex flags upward to the edges
- for(eed = em->edges.first;eed;eed = eed->next) {
- //if(eed->f & flag && eed->v1->f == eed->v2->f) {
- // eed->f |= eed->v1->f;
- // }
- eed->f2 = 0;
- if(eed->f & flag) {
- eed->f2 |= EDGEOLD;
- }
- }
-
-
- // We store an array of verts for each edge that is subdivided,
- // we put this array as a value in a ghash which is keyed by the EditEdge*
-
- // Now for beauty subdivide deselect edges based on length
- if(beauty & B_BEAUTY) {
- for(ef = em->faces.first;ef;ef = ef->next) {
- if(!ef->v4) {
- continue;
- }
- if(ef->f & SELECT) {
- VECCOPY(v1mat, ef->v1->co);
- VECCOPY(v2mat, ef->v2->co);
- VECCOPY(v3mat, ef->v3->co);
- VECCOPY(v4mat, ef->v4->co);
- Mat4Mul3Vecfl(G.obedit->obmat, v1mat);
- Mat4Mul3Vecfl(G.obedit->obmat, v2mat);
- Mat4Mul3Vecfl(G.obedit->obmat, v3mat);
- Mat4Mul3Vecfl(G.obedit->obmat, v4mat);
-
- length[0] = VecLenf(v1mat, v2mat);
- length[1] = VecLenf(v2mat, v3mat);
- length[2] = VecLenf(v3mat, v4mat);
- length[3] = VecLenf(v4mat, v1mat);
- sort[0] = ef->e1;
- sort[1] = ef->e2;
- sort[2] = ef->e3;
- sort[3] = ef->e4;
-
-
- // Beauty Short Edges
- if(beauty & B_BEAUTY_SHORT) {
- for(j=0;j<2;j++) {
- hold = -1;
- for(i=0;i<4;i++) {
- if(length[i] < 0) {
- continue;
- } else if(hold == -1) {
- hold = i;
- } else {
- if(length[hold] < length[i]) {
- hold = i;
- }
- }
- }
- sort[hold]->f &= ~SELECT;
- sort[hold]->f2 |= EDGENEW;
- length[hold] = -1;
- }
- }
-
- // Beauty Long Edges
- else {
- for(j=0;j<2;j++) {
- hold = -1;
- for(i=0;i<4;i++) {
- if(length[i] < 0) {
- continue;
- } else if(hold == -1) {
- hold = i;
- } else {
- if(length[hold] > length[i]) {
- hold = i;
- }
- }
- }
- sort[hold]->f &= ~SELECT;
- sort[hold]->f2 |= EDGENEW;
- length[hold] = -1;
- }
- }
- }
- }
- }
-
- gh = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp);
-
- // If we are knifing, We only need the selected edges that were cut, so deselect if it was not cut
- if(beauty & B_KNIFE) {
- for(eed= em->edges.first;eed;eed=eed->next) {
- if( eed->tmp.fp == 0 ) {
- EM_select_edge(eed,0);
- }
- }
- }
- // So for each edge, if it is selected, we allocate an array of size cuts+2
- // so we can have a place for the v1, the new verts and v2
- for(eed=em->edges.first;eed;eed = eed->next) {
- if(eed->f & flag) {
- templist = MEM_mallocN(sizeof(EditVert*)*(numcuts+2),"vertlist");
- templist[0] = eed->v1;
- for(i=0;i<numcuts;i++) {
- // This function creates the new vert and returns it back
- // to the array
- templist[i+1] = subdivideedgenum(eed, i+1, numcuts, rad, beauty);
- //while we are here, we can copy edge info from the original edge
- cedge = addedgelist(templist[i],templist[i+1],eed);
- // Also set the edge f2 to EDGENEW so that we can use this info later
- cedge->f2 = EDGENEW;
- }
- templist[i+1] = eed->v2;
- //Do the last edge too
- cedge = addedgelist(templist[i],templist[i+1],eed);
- cedge->f2 = EDGENEW;
- // Now that the edge is subdivided, we can put its verts in the ghash
- BLI_ghash_insert(gh, eed, templist);
- }
- }
-
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- // Now for each face in the mesh we need to figure out How many edges were cut
- // and which filling method to use for that face
- for(ef = em->faces.first;ef;ef = ef->next) {
- edgecount = 0;
- facetype = 3;
- if(ef->e1->f & flag) {edgecount++;}
- if(ef->e2->f & flag) {edgecount++;}
- if(ef->e3->f & flag) {edgecount++;}
- if(ef->v4) {
- facetype = 4;
- if(ef->e4->f & flag) {edgecount++;}
- }
- if(facetype == 4) {
- switch(edgecount) {
- case 0:
- if(beauty & B_KNIFE && numcuts == 1){
- /*Test for when knifing through two opposite verts but no edges*/
- touchcount = 0;
- if(ef->v1->f1) touchcount++;
- if(ef->v2->f1) touchcount++;
- if(ef->v3->f1) touchcount++;
- if(ef->v4->f1) touchcount++;
- if(touchcount == 2){
- if(ef->v1->f1 && ef->v3->f1){
- ef->f1 = SELECT;
- fill_quad_doublevert(ef, 1, 3);
- }
- else if(ef->v2->f1 && ef->v4->f1){
- ef->f1 = SELECT;
- fill_quad_doublevert(ef, 2, 4);
- }
- }
- }
- break;
-
- case 1:
- if(beauty & B_KNIFE && numcuts == 1){
- /*Test for when knifing through an edge and one vert*/
- touchcount = 0;
- if(ef->v1->f1) touchcount++;
- if(ef->v2->f1) touchcount++;
- if(ef->v3->f1) touchcount++;
- if(ef->v4->f1) touchcount++;
-
- if(touchcount == 1){
- if( (ef->e1->f & flag && ( !ef->e1->v1->f1 && !ef->e1->v2->f1 )) ||
- (ef->e2->f & flag && ( !ef->e2->v1->f1 && !ef->e2->v2->f1 )) ||
- (ef->e3->f & flag && ( !ef->e3->v1->f1 && !ef->e3->v2->f1 )) ||
- (ef->e4->f & flag && ( !ef->e4->v1->f1 && !ef->e4->v2->f1 )) ){
-
- ef->f1 = SELECT;
- fill_quad_singlevert(ef, gh);
- }
- else{
- ef->f1 = SELECT;
- fill_quad_single(ef, gh, numcuts, seltype);
- }
- }
- else{
- ef->f1 = SELECT;
- fill_quad_single(ef, gh, numcuts, seltype);
- }
- }
- else{
- ef->f1 = SELECT;
- fill_quad_single(ef, gh, numcuts, seltype);
- }
- break;
- case 2: ef->f1 = SELECT;
- // if there are 2, we check if edge 1 and 3 are either both on or off that way
- // we can tell if the selected pair is Adjacent or Opposite of each other
- if((ef->e1->f & flag && ef->e3->f & flag) ||
- (ef->e2->f & flag && ef->e4->f & flag)) {
- fill_quad_double_op(ef, gh, numcuts);
- }else{
- switch(G.scene->toolsettings->cornertype) {
- case 0: fill_quad_double_adj_path(ef, gh, numcuts); break;
- case 1: fill_quad_double_adj_inner(ef, gh, numcuts); break;
- case 2: fill_quad_double_adj_fan(ef, gh, numcuts); break;
- }
-
- }
- break;
- case 3: ef->f1 = SELECT;
- fill_quad_triple(ef, gh, numcuts);
- break;
- case 4: ef->f1 = SELECT;
- fill_quad_quadruple(ef, gh, numcuts, rad, beauty);
- break;
- }
- } else {
- switch(edgecount) {
- case 0: break;
- case 1: ef->f1 = SELECT;
- fill_tri_single(ef, gh, numcuts, seltype);
- break;
- case 2: ef->f1 = SELECT;
- fill_tri_double(ef, gh, numcuts);
- break;
- case 3: ef->f1 = SELECT;
- fill_tri_triple(ef, gh, numcuts, rad, beauty);
- break;
- }
- }
- }
-
- // Delete Old Edges and Faces
- for(eed = em->edges.first;eed;eed = eed->next) {
- if(BLI_ghash_haskey(gh,eed)) {
- eed->f1 = SELECT;
- } else {
- eed->f1 = 0;
- }
- }
- free_tagged_edges_faces(em->edges.first, em->faces.first);
-
- if(seltype == SUBDIV_SELECT_ORIG && G.qual != LR_CTRLKEY) {
- for(eed = em->edges.first;eed;eed = eed->next) {
- if(eed->f2 & EDGENEW || eed->f2 & EDGEOLD) {
- eed->f |= flag;
- EM_select_edge(eed,1);
-
- }else{
- eed->f &= !flag;
- EM_select_edge(eed,0);
- }
- }
- } else if ((seltype == SUBDIV_SELECT_INNER || seltype == SUBDIV_SELECT_INNER_SEL)|| G.qual == LR_CTRLKEY) {
- for(eed = em->edges.first;eed;eed = eed->next) {
- if(eed->f2 & EDGEINNER) {
- eed->f |= flag;
- EM_select_edge(eed,1);
- if(eed->v1->f & EDGEINNER) eed->v1->f |= SELECT;
- if(eed->v2->f & EDGEINNER) eed->v2->f |= SELECT;
- }else{
- eed->f &= !flag;
- EM_select_edge(eed,0);
- }
- }
- } else if(seltype == SUBDIV_SELECT_LOOPCUT){
- for(eed = em->edges.first;eed;eed = eed->next) {
- if(eed->f2 & DOUBLEOPFILL){
- eed->f |= flag;
- EM_select_edge(eed,1);
- }else{
- eed->f &= !flag;
- EM_select_edge(eed,0);
- }
- }
- }
- if(G.scene->selectmode & SCE_SELECT_VERTEX) {
- for(eed = em->edges.first;eed;eed = eed->next) {
- if(eed->f & SELECT) {
- eed->v1->f |= SELECT;
- eed->v2->f |= SELECT;
- }
- }
- }
-
- //fix hide flags for edges. First pass, hide edges of hidden faces
- for(ef=em->faces.first; ef; ef=ef->next){
- if(ef->h){
- ef->e1->h |= 1;
- ef->e2->h |= 1;
- ef->e3->h |= 1;
- if(ef->e4) ef->e4->h |= 1;
- }
- }
- //second pass: unhide edges of visible faces adjacent to hidden faces
- for(ef=em->faces.first; ef; ef=ef->next){
- if(ef->h == 0){
- ef->e1->h &= ~1;
- ef->e2->h &= ~1;
- ef->e3->h &= ~1;
- if(ef->e4) ef->e4->h &= ~1;
- }
- }
-
- // Free the ghash and call MEM_freeN on all the value entries to return
- // that memory
- BLI_ghash_free(gh, NULL, (GHashValFreeFP)MEM_freeN);
-
- EM_selectmode_flush();
- for(ef=em->faces.first;ef;ef = ef->next) {
- if(ef->e4) {
- if( (ef->e1->f & SELECT && ef->e2->f & SELECT) &&
- (ef->e3->f & SELECT && ef->e4->f & SELECT) ) {
- ef->f |= SELECT;
- }
- } else {
- if( (ef->e1->f & SELECT && ef->e2->f & SELECT) && ef->e3->f & SELECT) {
- ef->f |= SELECT;
- }
- }
- }
-
- recalc_editnormals();
- countall();
- allqueue(REDRAWVIEW3D, 0);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-}
-
-static int count_selected_edges(EditEdge *ed)
-{
- int totedge = 0;
- while(ed) {
- ed->tmp.p = 0;
- if( ed->f & SELECT ) totedge++;
- ed= ed->next;
- }
- return totedge;
-}
-
-/* hurms, as if this makes code readable! It's pointerpointer hiding... (ton) */
-typedef EditFace *EVPtr;
-typedef EVPtr EVPTuple[2];
-
-/** builds EVPTuple array efaa of face tuples (in fact pointers to EditFaces)
- sharing one edge.
- arguments: selected edge list, face list.
- Edges will also be tagged accordingly (see eed->f2) */
-
-static int collect_quadedges(EVPTuple *efaa, EditEdge *eed, EditFace *efa)
-{
- EditEdge *e1, *e2, *e3;
- EVPtr *evp;
- int i = 0;
-
- /* run through edges, if selected, set pointer edge-> facearray */
- while(eed) {
- eed->f2= 0;
- eed->f1= 0;
- if( eed->f & SELECT ) {
- eed->tmp.p = (EditVert *) (&efaa[i]);
- i++;
- }
- else eed->tmp.p = NULL;
-
- eed= eed->next;
- }
-
-
- /* find edges pointing to 2 faces by procedure:
-
- - run through faces and their edges, increase
- face counter e->f1 for each face
- */
-
- while(efa) {
- efa->f1= 0;
- if(efa->v4==0 && (efa->f & SELECT)) { /* if selected triangle */
- e1= efa->e1;
- e2= efa->e2;
- e3= efa->e3;
- if(e1->f2<3 && e1->tmp.p) {
- if(e1->f2<2) {
- evp= (EVPtr *) e1->tmp.p;
- evp[(int)e1->f2] = efa;
- }
- e1->f2+= 1;
- }
- if(e2->f2<3 && e2->tmp.p) {
- if(e2->f2<2) {
- evp= (EVPtr *) e2->tmp.p;
- evp[(int)e2->f2]= efa;
- }
- e2->f2+= 1;
- }
- if(e3->f2<3 && e3->tmp.p) {
- if(e3->f2<2) {
- evp= (EVPtr *) e3->tmp.p;
- evp[(int)e3->f2]= efa;
- }
- e3->f2+= 1;
- }
- }
- else {
- /* set to 3 to make sure these are not flipped or joined */
- efa->e1->f2= 3;
- efa->e2->f2= 3;
- efa->e3->f2= 3;
- if (efa->e4) efa->e4->f2= 3;
- }
-
- efa= efa->next;
- }
- return i;
-}
-
-
-/* returns vertices of two adjacent triangles forming a quad
- - can be righthand or lefthand
-
- 4-----3
- |\ |
- | \ 2 | <- efa1
- | \ |
- efa-> | 1 \ |
- | \|
- 1-----2
-
-*/
-#define VTEST(face, num, other) \
- (face->v##num != other->v1 && face->v##num != other->v2 && face->v##num != other->v3)
-
-static void givequadverts(EditFace *efa, EditFace *efa1, EditVert **v1, EditVert **v2, EditVert **v3, EditVert **v4, int *vindex)
-{
- if VTEST(efa, 1, efa1) {
- *v1= efa->v1;
- *v2= efa->v2;
- vindex[0]= 0;
- vindex[1]= 1;
- }
- else if VTEST(efa, 2, efa1) {
- *v1= efa->v2;
- *v2= efa->v3;
- vindex[0]= 1;
- vindex[1]= 2;
- }
- else if VTEST(efa, 3, efa1) {
- *v1= efa->v3;
- *v2= efa->v1;
- vindex[0]= 2;
- vindex[1]= 0;
- }
-
- if VTEST(efa1, 1, efa) {
- *v3= efa1->v1;
- *v4= efa1->v2;
- vindex[2]= 0;
- vindex[3]= 1;
- }
- else if VTEST(efa1, 2, efa) {
- *v3= efa1->v2;
- *v4= efa1->v3;
- vindex[2]= 1;
- vindex[3]= 2;
- }
- else if VTEST(efa1, 3, efa) {
- *v3= efa1->v3;
- *v4= efa1->v1;
- vindex[2]= 2;
- vindex[3]= 0;
- }
- else
- *v3= *v4= NULL;
-}
-
-/* Helper functions for edge/quad edit features*/
-static void untag_edges(EditFace *f)
-{
- f->e1->f1 = 0;
- f->e2->f1 = 0;
- f->e3->f1 = 0;
- if (f->e4) f->e4->f1 = 0;
-}
-
-/** remove and free list of tagged edges and faces */
-static void free_tagged_edges_faces(EditEdge *eed, EditFace *efa)
-{
- EditMesh *em= G.editMesh;
- EditEdge *nexted;
- EditFace *nextvl;
-
- while(efa) {
- nextvl= efa->next;
- if(efa->f1) {
- BLI_remlink(&em->faces, efa);
- free_editface(efa);
- }
- else
- /* avoid deleting edges that are still in use */
- untag_edges(efa);
- efa= nextvl;
- }
-
- while(eed) {
- nexted= eed->next;
- if(eed->f1) {
- remedge(eed);
- free_editedge(eed);
- }
- eed= nexted;
- }
-}
-
-/* note; the EM_selectmode_set() calls here illustrate how badly constructed it all is... from before the
- edge/face flags, with very mixed results.... */
-void beauty_fill(void)
-{
- EditMesh *em = G.editMesh;
- EditVert *v1, *v2, *v3, *v4;
- EditEdge *eed, *nexted;
- EditEdge dia1, dia2;
- EditFace *efa, *w;
- // void **efaar, **efaa;
- EVPTuple *efaar;
- EVPtr *efaa;
- float len1, len2, len3, len4, len5, len6, opp1, opp2, fac1, fac2;
- int totedge, ok, notbeauty=8, onedone, vindex[4];
-
- if(multires_test()) return;
-
- /* - all selected edges with two faces
- * - find the faces: store them in edges (using datablock)
- * - per edge: - test convex
- * - test edge: flip?
- * - if true: remedge, addedge, all edges at the edge get new face pointers
- */
-
- EM_selectmode_set(); // makes sure in selectmode 'face' the edges of selected faces are selected too
-
- totedge = count_selected_edges(em->edges.first);
- if(totedge==0) return;
-
- /* temp block with face pointers */
- efaar= (EVPTuple *) MEM_callocN(totedge * sizeof(EVPTuple), "beautyfill");
-
- while (notbeauty) {
- notbeauty--;
-
- ok = collect_quadedges(efaar, em->edges.first, em->faces.first);
-
- /* there we go */
- onedone= 0;
-
- eed= em->edges.first;
- while(eed) {
- nexted= eed->next;
-
- /* f2 is set in collect_quadedges() */
- if(eed->f2==2 && eed->h==0) {
-
- efaa = (EVPtr *) eed->tmp.p;
-
- /* none of the faces should be treated before, nor be part of fgon */
- ok= 1;
- efa= efaa[0];
- if(efa->e1->f1 || efa->e2->f1 || efa->e3->f1) ok= 0;
- if(efa->fgonf) ok= 0;
- efa= efaa[1];
- if(efa->e1->f1 || efa->e2->f1 || efa->e3->f1) ok= 0;
- if(efa->fgonf) ok= 0;
-
- if(ok) {
- /* test convex */
- givequadverts(efaa[0], efaa[1], &v1, &v2, &v3, &v4, vindex);
- if(v1 && v2 && v3 && v4) {
- if( convex(v1->co, v2->co, v3->co, v4->co) ) {
-
- /* test edges */
- if( (v1) > (v3) ) {
- dia1.v1= v3;
- dia1.v2= v1;
- }
- else {
- dia1.v1= v1;
- dia1.v2= v3;
- }
-
- if( (v2) > (v4) ) {
- dia2.v1= v4;
- dia2.v2= v2;
- }
- else {
- dia2.v1= v2;
- dia2.v2= v4;
- }
-
- /* testing rule:
- * the area divided by the total edge lengths
- */
-
- len1= VecLenf(v1->co, v2->co);
- len2= VecLenf(v2->co, v3->co);
- len3= VecLenf(v3->co, v4->co);
- len4= VecLenf(v4->co, v1->co);
- len5= VecLenf(v1->co, v3->co);
- len6= VecLenf(v2->co, v4->co);
-
- opp1= AreaT3Dfl(v1->co, v2->co, v3->co);
- opp2= AreaT3Dfl(v1->co, v3->co, v4->co);
-
- fac1= opp1/(len1+len2+len5) + opp2/(len3+len4+len5);
-
- opp1= AreaT3Dfl(v2->co, v3->co, v4->co);
- opp2= AreaT3Dfl(v2->co, v4->co, v1->co);
-
- fac2= opp1/(len2+len3+len6) + opp2/(len4+len1+len6);
-
- ok= 0;
- if(fac1 > fac2) {
- if(dia2.v1==eed->v1 && dia2.v2==eed->v2) {
- eed->f1= 1;
- efa= efaa[0];
- efa->f1= 1;
- efa= efaa[1];
- efa->f1= 1;
-
- w= EM_face_from_faces(efaa[0], efaa[1],
- vindex[0], vindex[1], 4+vindex[2], -1);
- w->f |= SELECT;
-
-
- w= EM_face_from_faces(efaa[0], efaa[1],
- vindex[0], 4+vindex[2], 4+vindex[3], -1);
- w->f |= SELECT;
-
- onedone= 1;
- }
- }
- else if(fac1 < fac2) {
- if(dia1.v1==eed->v1 && dia1.v2==eed->v2) {
- eed->f1= 1;
- efa= efaa[0];
- efa->f1= 1;
- efa= efaa[1];
- efa->f1= 1;
-
-
- w= EM_face_from_faces(efaa[0], efaa[1],
- vindex[1], 4+vindex[2], 4+vindex[3], -1);
- w->f |= SELECT;
-
-
- w= EM_face_from_faces(efaa[0], efaa[1],
- vindex[0], 4+vindex[1], 4+vindex[3], -1);
- w->f |= SELECT;
-
- onedone= 1;
- }
- }
- }
- }
- }
-
- }
- eed= nexted;
- }
-
- free_tagged_edges_faces(em->edges.first, em->faces.first);
-
- if(onedone==0) break;
-
- EM_selectmode_set(); // new edges/faces were added
- }
-
- MEM_freeN(efaar);
-
- EM_select_flush();
-
- allqueue(REDRAWVIEW3D, 0);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-#ifdef WITH_VERSE
- if(G.editMesh->vnode)
- sync_all_versefaces_with_editfaces((VNode*)G.editMesh->vnode);
-#endif
- BIF_undo_push("Beauty Fill");
-}
-
-
-/* ******************** BEGIN TRIANGLE TO QUAD ************************************* */
-static float measure_facepair(EditVert *v1, EditVert *v2, EditVert *v3, EditVert *v4, float limit){
-
- /*gives a 'weight' to a pair of triangles that join an edge to decide how good a join they would make*/
- /*Note: this is more complicated than it needs to be and should be cleaned up...*/
- float measure = 0.0, noA1[3], noA2[3], noB1[3], noB2[3], normalADiff, normalBDiff,
- edgeVec1[3], edgeVec2[3], edgeVec3[3], edgeVec4[3], diff,
- minarea, maxarea, areaA, areaB;
-
- /*First Test: Normal difference*/
- CalcNormFloat(v1->co, v2->co, v3->co, noA1);
- CalcNormFloat(v1->co, v3->co, v4->co, noA2);
-
- if(noA1[0] == noA2[0] && noA1[1] == noA2[1] && noA1[2] == noA2[2]) normalADiff = 0.0;
- else normalADiff = VecAngle2(noA1, noA2);
- //if(!normalADiff) normalADiff = 179;
- CalcNormFloat(v2->co, v3->co, v4->co, noB1);
- CalcNormFloat(v4->co, v1->co, v2->co, noB2);
-
- if(noB1[0] == noB2[0] && noB1[1] == noB2[1] && noB1[2] == noB2[2]) normalBDiff = 0.0;
- else normalBDiff = VecAngle2(noB1, noB2);
- //if(!normalBDiff) normalBDiff = 179;
-
- measure += (normalADiff/360) + (normalBDiff/360);
- if(measure > limit) return measure;
-
- /*Second test: Colinearity*/
- VecSubf(edgeVec1, v1->co, v2->co);
- VecSubf(edgeVec2, v2->co, v3->co);
- VecSubf(edgeVec3, v3->co, v4->co);
- VecSubf(edgeVec4, v4->co, v1->co);
-
- diff = 0.0;
-
- diff = (
- fabs(VecAngle2(edgeVec1, edgeVec2) - 90) +
- fabs(VecAngle2(edgeVec2, edgeVec3) - 90) +
- fabs(VecAngle2(edgeVec3, edgeVec4) - 90) +
- fabs(VecAngle2(edgeVec4, edgeVec1) - 90)) / 360;
- if(!diff) return 0.0;
-
- measure += diff;
- if(measure > limit) return measure;
-
- /*Third test: Concavity*/
- areaA = AreaT3Dfl(v1->co, v2->co, v3->co) + AreaT3Dfl(v1->co, v3->co, v4->co);
- areaB = AreaT3Dfl(v2->co, v3->co, v4->co) + AreaT3Dfl(v4->co, v1->co, v2->co);
-
- if(areaA <= areaB) minarea = areaA;
- else minarea = areaB;
-
- if(areaA >= areaB) maxarea = areaA;
- else maxarea = areaB;
-
- if(!maxarea) measure += 1;
- else measure += (1 - (minarea / maxarea));
-
- return measure;
-}
-
-#define T2QUV_LIMIT 0.005
-#define T2QCOL_LIMIT 3
-static int compareFaceAttribs(EditFace *f1, EditFace *f2, EditEdge *eed)
-{
- /*Test to see if the per-face attributes for the joining edge match within limit*/
- MTFace *tf1, *tf2;
- unsigned int *col1, *col2;
- short i,attrok=0, flag = G.scene->toolsettings->editbutflag, fe1[2], fe2[2];
-
- tf1 = CustomData_em_get(&G.editMesh->fdata, f1->data, CD_MTFACE);
- tf2 = CustomData_em_get(&G.editMesh->fdata, f2->data, CD_MTFACE);
-
- col1 = CustomData_em_get(&G.editMesh->fdata, f1->data, CD_MCOL);
- col2 = CustomData_em_get(&G.editMesh->fdata, f2->data, CD_MCOL);
-
- /*store indices for faceedges*/
- f1->v1->f1 = 0;
- f1->v2->f1 = 1;
- f1->v3->f1 = 2;
-
- fe1[0] = eed->v1->f1;
- fe1[1] = eed->v2->f1;
-
- f2->v1->f1 = 0;
- f2->v2->f1 = 1;
- f2->v3->f1 = 2;
-
- fe2[0] = eed->v1->f1;
- fe2[1] = eed->v2->f1;
-
- /*compare faceedges for each face attribute. Additional per face attributes can be added later*/
- /*do UVs*/
- if(flag & B_JOINTRIA_UV){
-
- if(tf1 == NULL || tf2 == NULL) attrok |= B_JOINTRIA_UV;
- else if(tf1->tpage != tf2->tpage); /*do nothing*/
- else{
- for(i = 0; i < 2; i++){
- if(tf1->uv[fe1[i]][0] + T2QUV_LIMIT > tf2->uv[fe2[i]][0] && tf1->uv[fe1[i]][0] - T2QUV_LIMIT < tf2->uv[fe2[i]][0] &&
- tf1->uv[fe1[i]][1] + T2QUV_LIMIT > tf2->uv[fe2[i]][1] && tf1->uv[fe1[i]][1] - T2QUV_LIMIT < tf2->uv[fe2[i]][1]) attrok |= B_JOINTRIA_UV;
- }
- }
- }
-
- /*do VCOLs*/
- if(flag & B_JOINTRIA_VCOL){
- if(!col1 || !col2) attrok |= B_JOINTRIA_VCOL;
- else{
- char *f1vcol, *f2vcol;
- for(i = 0; i < 2; i++){
- f1vcol = (char *)&(col1[fe1[i]]);
- f2vcol = (char *)&(col2[fe2[i]]);
-
- /*compare f1vcol with f2vcol*/
- if( f1vcol[1] + T2QCOL_LIMIT > f2vcol[1] && f1vcol[1] - T2QCOL_LIMIT < f2vcol[1] &&
- f1vcol[2] + T2QCOL_LIMIT > f2vcol[2] && f1vcol[2] - T2QCOL_LIMIT < f2vcol[2] &&
- f1vcol[3] + T2QCOL_LIMIT > f2vcol[3] && f1vcol[3] - T2QCOL_LIMIT < f2vcol[3]) attrok |= B_JOINTRIA_VCOL;
- }
- }
- }
-
- if( ((attrok & B_JOINTRIA_UV) == (flag & B_JOINTRIA_UV)) && ((attrok & B_JOINTRIA_VCOL) == (flag & B_JOINTRIA_VCOL)) ) return 1;
- return 0;
-}
-
-static int fplcmp(const void *v1, const void *v2)
-{
- const EditEdge *e1= *((EditEdge**)v1), *e2=*((EditEdge**)v2);
-
- if( e1->crease > e2->crease) return 1;
- else if( e1->crease < e2->crease) return -1;
-
- return 0;
-}
-
-/*Bitflags for edges.*/
-#define T2QDELETE 1
-#define T2QCOMPLEX 2
-#define T2QJOIN 4
-void join_triangles(void)
-{
- EditMesh *em=G.editMesh;
- EditVert *v1, *v2, *v3, *v4, *eve;
- EditEdge *eed, **edsortblock = NULL, **edb = NULL;
- EditFace *efa;
- EVPTuple *efaar = NULL;
- EVPtr *efaa = NULL;
- float *creases = NULL;
- float measure; /*Used to set tolerance*/
- float limit = G.scene->toolsettings->jointrilimit;
- int i, ok, totedge=0, totseledge=0, complexedges, vindex[4];
-
- /*test for multi-resolution data*/
- if(multires_test()) return;
-
- /*if we take a long time on very dense meshes we want waitcursor to display*/
- waitcursor(1);
-
- totseledge = count_selected_edges(em->edges.first);
- if(totseledge==0) return;
-
- /*abusing crease value to store weights for edge pairs. Nasty*/
- for(eed=em->edges.first; eed; eed=eed->next) totedge++;
- if(totedge) creases = MEM_callocN(sizeof(float) * totedge, "Join Triangles Crease Array");
- for(eed=em->edges.first, i = 0; eed; eed=eed->next, i++){
- creases[i] = eed->crease;
- eed->crease = 0.0;
- }
-
- /*clear temp flags*/
- for(eve=em->verts.first; eve; eve=eve->next) eve->f1 = eve->f2 = 0;
- for(eed=em->edges.first; eed; eed=eed->next) eed->f2 = eed->f1 = 0;
- for(efa=em->faces.first; efa; efa=efa->next) efa->f1 = efa->tmp.l = 0;
-
- /*For every selected 2 manifold edge, create pointers to its two faces.*/
- efaar= (EVPTuple *) MEM_callocN(totseledge * sizeof(EVPTuple), "Tri2Quad");
- ok = collect_quadedges(efaar, em->edges.first, em->faces.first);
- complexedges = 0;
-
- if(ok){
-
-
- /*clear tmp.l flag and store number of faces that are selected and coincident to current face here.*/
- for(eed=em->edges.first; eed; eed=eed->next){
- /* eed->f2 is 2 only if this edge is part of exactly two
- triangles, and both are selected, and it has EVPTuple assigned */
- if(eed->f2 == 2){
- efaa= (EVPtr *) eed->tmp.p;
- efaa[0]->tmp.l++;
- efaa[1]->tmp.l++;
- }
- }
-
- for(eed=em->edges.first; eed; eed=eed->next){
- if(eed->f2 == 2){
- efaa= (EVPtr *) eed->tmp.p;
- v1 = v2 = v3 = v4 = NULL;
- givequadverts(efaa[0], efaa[1], &v1, &v2, &v3, &v4, vindex);
- if(v1 && v2 && v3 && v4){
- /*test if simple island first. This mimics 2.42 behaviour and the tests are less restrictive.*/
- if(efaa[0]->tmp.l == 1 && efaa[1]->tmp.l == 1){
- if( convex(v1->co, v2->co, v3->co, v4->co) ){
- eed->f1 |= T2QJOIN;
- efaa[0]->f1 = 1; //mark for join
- efaa[1]->f1 = 1; //mark for join
- }
- }
- else{
-
- /* The face pair is part of a 'complex' island, so the rules for dealing with it are more involved.
- Depending on what options the user has chosen, this face pair can be 'thrown out' based upon the following criteria:
-
- 1: the two faces do not share the same material
- 2: the edge joining the two faces is marked as sharp.
- 3: the two faces UV's do not make a good match
- 4: the two faces Vertex colors do not make a good match
-
- If the face pair passes all the applicable tests, it is then given a 'weight' with the measure_facepair() function.
- This measures things like concavity, colinearity ect. If this weight is below the threshold set by the user
- the edge joining them is marked as being 'complex' and will be compared against other possible pairs which contain one of the
- same faces in the current pair later.
-
- This technique is based upon an algorithm that Campbell Barton developed for his Tri2Quad script that was previously part of
- the python scripts bundled with Blender releases.
- */
-
- if(G.scene->toolsettings->editbutflag & B_JOINTRIA_SHARP && eed->sharp); /*do nothing*/
- else if(G.scene->toolsettings->editbutflag & B_JOINTRIA_MAT && efaa[0]->mat_nr != efaa[1]->mat_nr); /*do nothing*/
- else if(((G.scene->toolsettings->editbutflag & B_JOINTRIA_UV) || (G.scene->toolsettings->editbutflag & B_JOINTRIA_VCOL)) &&
- compareFaceAttribs(efaa[0], efaa[1], eed) == 0); /*do nothing*/
- else{
- measure = measure_facepair(v1, v2, v3, v4, limit);
- if(measure < limit){
- complexedges++;
- eed->f1 |= T2QCOMPLEX;
- eed->crease = measure; /*we dont mark edges for join yet*/
- }
- }
- }
- }
- }
- }
-
- /*Quicksort the complex edges according to their weighting*/
- if(complexedges){
- edsortblock = edb = MEM_callocN(sizeof(EditEdge*) * complexedges, "Face Pairs quicksort Array");
- for(eed = em->edges.first; eed; eed=eed->next){
- if(eed->f1 & T2QCOMPLEX){
- *edb = eed;
- edb++;
- }
- }
- qsort(edsortblock, complexedges, sizeof(EditEdge*), fplcmp);
- /*now go through and mark the edges who get the highest weighting*/
- for(edb=edsortblock, i=0; i < complexedges; edb++, i++){
- efaa = (EVPtr *)((*edb)->tmp.p); /*suspect!*/
- if( !efaa[0]->f1 && !efaa[1]->f1){
- efaa[0]->f1 = 1; //mark for join
- efaa[1]->f1 = 1; //mark for join
- (*edb)->f1 |= T2QJOIN;
- }
- }
- }
-
- /*finally go through all edges marked for join (simple and complex) and create new faces*/
- for(eed=em->edges.first; eed; eed=eed->next){
- if(eed->f1 & T2QJOIN){
- efaa= (EVPtr *)eed->tmp.p;
- v1 = v2 = v3 = v4 = NULL;
- givequadverts(efaa[0], efaa[1], &v1, &v2, &v3, &v4, vindex);
- if((v1 && v2 && v3 && v4) && (exist_face(v1, v2, v3, v4)==0)){ /*exist_face is very slow! Needs to be adressed.*/
- /*flag for delete*/
- eed->f1 |= T2QDELETE;
- /*create new quad and select*/
- efa = EM_face_from_faces(efaa[0], efaa[1], vindex[0], vindex[1], 4+vindex[2], 4+vindex[3]);
- EM_select_face(efa,1);
- }
- else{
- efaa[0]->f1 = 0;
- efaa[1]->f1 = 0;
- }
- }
- }
- }
-
- /*free data and cleanup*/
- if(creases){
- for(eed=em->edges.first, i = 0; eed; eed=eed->next, i++) eed->crease = creases[i];
- MEM_freeN(creases);
- }
- for(eed=em->edges.first; eed; eed=eed->next){
- if(eed->f1 & T2QDELETE) eed->f1 = 1;
- else eed->f1 = 0;
- }
- free_tagged_edges_faces(em->edges.first, em->faces.first);
- if(efaar) MEM_freeN(efaar);
- if(edsortblock) MEM_freeN(edsortblock);
-
- EM_selectmode_flush();
- countall();
- allqueue(REDRAWVIEW3D, 0);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- #ifdef WITH_VERSE
- if(G.editMesh->vnode)
- sync_all_versefaces_with_editfaces((VNode*)G.editMesh->vnode);
- #endif
- waitcursor(0);
- BIF_undo_push("Convert Triangles to Quads");
-}
-/* ******************** END TRIANGLE TO QUAD ************************************* */
-
-#define FACE_MARKCLEAR(f) (f->f1 = 1)
-
-/* quick hack, basically a copy of beauty_fill */
-void edge_flip(void)
-{
- EditMesh *em = G.editMesh;
- EditVert *v1, *v2, *v3, *v4;
- EditEdge *eed, *nexted;
- EditFace *efa, *w;
- //void **efaar, **efaa;
- EVPTuple *efaar;
- EVPtr *efaa;
- int totedge, ok, vindex[4];
-
- /* - all selected edges with two faces
- * - find the faces: store them in edges (using datablock)
- * - per edge: - test convex
- * - test edge: flip?
- - if true: remedge, addedge, all edges at the edge get new face pointers
- */
-
- EM_selectmode_flush(); // makes sure in selectmode 'face' the edges of selected faces are selected too
-
- totedge = count_selected_edges(em->edges.first);
- if(totedge==0) return;
-
- /* temporary array for : edge -> face[1], face[2] */
- efaar= (EVPTuple *) MEM_callocN(totedge * sizeof(EVPTuple), "edgeflip");
-
- ok = collect_quadedges(efaar, em->edges.first, em->faces.first);
-
- eed= em->edges.first;
- while(eed) {
- nexted= eed->next;
-
- if(eed->f2==2) { /* points to 2 faces */
-
- efaa= (EVPtr *) eed->tmp.p;
-
- /* don't do it if flagged */
-
- ok= 1;
- efa= efaa[0];
- if(efa->e1->f1 || efa->e2->f1 || efa->e3->f1) ok= 0;
- efa= efaa[1];
- if(efa->e1->f1 || efa->e2->f1 || efa->e3->f1) ok= 0;
-
- if(ok) {
- /* test convex */
- givequadverts(efaa[0], efaa[1], &v1, &v2, &v3, &v4, vindex);
-
-/*
- 4-----3 4-----3
- |\ | | /|
- | \ 1 | | 1 / |
- | \ | -> | / |
- | 0 \ | | / 0 |
- | \| |/ |
- 1-----2 1-----2
-*/
- /* make new faces */
- if (v1 && v2 && v3) {
- if( convex(v1->co, v2->co, v3->co, v4->co) ) {
- if(exist_face(v1, v2, v3, v4)==0) {
- /* outch this may break seams */
- w= EM_face_from_faces(efaa[0], efaa[1], vindex[0],
- vindex[1], 4+vindex[2], -1);
-
- EM_select_face(w, 1);
-
- /* outch this may break seams */
- w= EM_face_from_faces(efaa[0], efaa[1], vindex[0],
- 4+vindex[2], 4+vindex[3], -1);
-
- EM_select_face(w, 1);
- }
- /* tag as to-be-removed */
- FACE_MARKCLEAR(efaa[1]);
- FACE_MARKCLEAR(efaa[0]);
- eed->f1 = 1;
-
- } /* endif test convex */
- }
- }
- }
- eed= nexted;
- }
-
- /* clear tagged edges and faces: */
- free_tagged_edges_faces(em->edges.first, em->faces.first);
-
- MEM_freeN(efaar);
-
- allqueue(REDRAWVIEW3D, 0);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-#ifdef WITH_VERSE
- if(G.editMesh->vnode)
- sync_all_versefaces_with_editfaces((VNode*)G.editMesh->vnode);
-#endif
- BIF_undo_push("Flip Triangle Edges");
-
-}
-
-static void edge_rotate(EditEdge *eed,int dir)
-{
- EditMesh *em = G.editMesh;
- EditVert **verts[2];
- EditFace *face[2], *efa, *newFace[2];
- EditEdge **edges[2], **hiddenedges, *srchedge;
- int facecount, p1, p2, p3, p4, fac1, fac2, i, j;
- int numhidden, numshared, p[2][4];
-
- /* check to make sure that the edge is only part of 2 faces */
- facecount = 0;
- for(efa = em->faces.first;efa;efa = efa->next) {
- if((efa->e1 == eed || efa->e2 == eed) || (efa->e3 == eed || efa->e4 == eed)) {
- if(facecount >= 2) {
- /* more than two faces with this edge */
- return;
- }
- else {
- face[facecount] = efa;
- facecount++;
- }
- }
- }
-
- if(facecount < 2)
- return;
-
- /* how many edges does each face have */
- if(face[0]->e4) fac1= 4;
- else fac1= 3;
-
- if(face[1]->e4) fac2= 4;
- else fac2= 3;
-
- /* make a handy array for verts and edges */
- verts[0]= &face[0]->v1;
- edges[0]= &face[0]->e1;
- verts[1]= &face[1]->v1;
- edges[1]= &face[1]->e1;
-
- /* we don't want to rotate edges between faces that share more than one edge */
- numshared= 0;
- for(i=0; i<fac1; i++)
- for(j=0; j<fac2; j++)
- if (edges[0][i] == edges[1][j])
- numshared++;
-
- if(numshared > 1)
- return;
-
- /* coplaner faces only please */
- if(Inpf(face[0]->n,face[1]->n) <= 0.000001)
- return;
-
- /* we want to construct an array of vertex indicis in both faces, starting at
- the last vertex of the edge being rotated.
- - first we find the two vertices that lie on the rotating edge
- - then we make sure they are ordered according to the face vertex order
- - and then we construct the array */
- p1= p2= p3= p4= 0;
-
- for(i=0; i<4; i++) {
- if(eed->v1 == verts[0][i]) p1 = i;
- if(eed->v2 == verts[0][i]) p2 = i;
- if(eed->v1 == verts[1][i]) p3 = i;
- if(eed->v2 == verts[1][i]) p4 = i;
- }
-
- if((p1+1)%fac1 == p2)
- SWAP(int, p1, p2);
- if((p3+1)%fac2 == p4)
- SWAP(int, p3, p4);
-
- for (i = 0; i < 4; i++) {
- p[0][i]= (p1 + i)%fac1;
- p[1][i]= (p3 + i)%fac2;
- }
-
- /* create an Array of the Edges who have h set prior to rotate */
- numhidden = 0;
- for(srchedge = em->edges.first;srchedge;srchedge = srchedge->next)
- if(srchedge->h && ((srchedge->v1->f & SELECT) || (srchedge->v2->f & SELECT)))
- numhidden++;
-
- hiddenedges = MEM_mallocN(sizeof(EditVert*)*numhidden+1, "RotateEdgeHiddenVerts");
- if(!hiddenedges) {
- error("Malloc Was not happy!");
- return;
- }
-
- numhidden = 0;
- for(srchedge=em->edges.first; srchedge; srchedge=srchedge->next)
- if(srchedge->h && (srchedge->v1->f & SELECT || srchedge->v2->f & SELECT))
- hiddenedges[numhidden++] = srchedge;
-
- /* create the 2 new faces */
- if(fac1 == 3 && fac2 == 3) {
- /* no need of reverse setup */
-
- newFace[0]= EM_face_from_faces(face[0], face[1], p[0][1], p[0][2], 4+p[1][1], -1);
- newFace[1]= EM_face_from_faces(face[1], face[0], p[1][1], p[1][2], 4+p[0][1], -1);
- }
- else if(fac1 == 4 && fac2 == 3) {
- if(dir == 1) {
- newFace[0]= EM_face_from_faces(face[0], face[1], p[0][1], p[0][2], p[0][3], 4+p[1][1]);
- newFace[1]= EM_face_from_faces(face[1], face[0], p[1][1], p[1][2], 4+p[0][1], -1);
- } else if (dir == 2) {
- newFace[0]= EM_face_from_faces(face[0], face[1], p[0][2], 4+p[1][1], p[0][0], p[0][1]);
- newFace[1]= EM_face_from_faces(face[1], face[0], 4+p[0][2], p[1][0], p[1][1], -1);
-
- verts[0][p[0][2]]->f |= SELECT;
- verts[1][p[1][1]]->f |= SELECT;
- }
- }
- else if(fac1 == 3 && fac2 == 4) {
- if(dir == 1) {
- newFace[0]= EM_face_from_faces(face[0], face[1], p[0][1], p[0][2], 4+p[1][1], -1);
- newFace[1]= EM_face_from_faces(face[1], face[0], p[1][1], p[1][2], p[1][3], 4+p[0][1]);
- } else if (dir == 2) {
- newFace[0]= EM_face_from_faces(face[0], face[1], p[0][0], p[0][1], 4+p[1][2], -1);
- newFace[1]= EM_face_from_faces(face[1], face[0], p[1][1], p[1][2], 4+p[0][1], 4+p[0][2]);
-
- verts[0][p[0][1]]->f |= SELECT;
- verts[1][p[1][2]]->f |= SELECT;
- }
-
- }
- else if(fac1 == 4 && fac2 == 4) {
- if(dir == 1) {
- newFace[0]= EM_face_from_faces(face[0], face[1], p[0][1], p[0][2], p[0][3], 4+p[1][1]);
- newFace[1]= EM_face_from_faces(face[1], face[0], p[1][1], p[1][2], p[1][3], 4+p[0][1]);
- } else if (dir == 2) {
- newFace[0]= EM_face_from_faces(face[0], face[1], p[0][2], p[0][3], 4+p[1][1], 4+p[1][2]);
- newFace[1]= EM_face_from_faces(face[1], face[0], p[1][2], p[1][3], 4+p[0][1], 4+p[0][2]);
-
- verts[0][p[0][2]]->f |= SELECT;
- verts[1][p[1][2]]->f |= SELECT;
- }
- }
- else
- return; /* This should never happen */
-
- if(dir == 1 || (fac1 == 3 && fac2 == 3)) {
- verts[0][p[0][1]]->f |= SELECT;
- verts[1][p[1][1]]->f |= SELECT;
- }
-
- /* copy old edge's flags to new center edge*/
- for(srchedge=em->edges.first;srchedge;srchedge=srchedge->next) {
- if((srchedge->v1->f & SELECT) && (srchedge->v2->f & SELECT)) {
- srchedge->f = eed->f;
- srchedge->h = eed->h;
- srchedge->dir = eed->dir;
- srchedge->seam = eed->seam;
- srchedge->crease = eed->crease;
- }
- }
-
- /* resetting hidden flag */
- for(numhidden--; numhidden>=0; numhidden--)
- hiddenedges[numhidden]->h= 1;
-
- /* check for orhphan edges */
- for(srchedge=em->edges.first; srchedge; srchedge=srchedge->next)
- srchedge->f1= -1;
-
- /* cleanup */
- MEM_freeN(hiddenedges);
-
- /* get rid of the old edge and faces*/
- remedge(eed);
- free_editedge(eed);
- BLI_remlink(&em->faces, face[0]);
- free_editface(face[0]);
- BLI_remlink(&em->faces, face[1]);
- free_editface(face[1]);
-}
-
-/* only accepts 1 selected edge, or 2 selected faces */
-void edge_rotate_selected(int dir)
-{
- EditEdge *eed;
- EditFace *efa;
- short edgeCount = 0;
-
- /*clear new flag for new edges, count selected edges */
- for(eed= G.editMesh->edges.first; eed; eed= eed->next) {
- eed->f1= 0;
- eed->f2 &= ~2;
- if(eed->f & SELECT) edgeCount++;
- }
-
- if(edgeCount>1) {
- /* more selected edges, check faces */
- for(efa= G.editMesh->faces.first; efa; efa= efa->next) {
- if(efa->f & SELECT) {
- efa->e1->f1++;
- efa->e2->f1++;
- efa->e3->f1++;
- if(efa->e4) efa->e4->f1++;
- }
- }
- edgeCount= 0;
- for(eed= G.editMesh->edges.first; eed; eed= eed->next) {
- if(eed->f1==2) edgeCount++;
- }
- if(edgeCount==1) {
- for(eed= G.editMesh->edges.first; eed; eed= eed->next) {
- if(eed->f1==2) {
- edge_rotate(eed,dir);
- break;
- }
- }
- }
- else error("Select one edge or two adjacent faces");
- }
- else if(edgeCount==1) {
- for(eed= G.editMesh->edges.first; eed; eed= eed->next) {
- if(eed->f & SELECT) {
- EM_select_edge(eed, 0);
- edge_rotate(eed,dir);
- break;
- }
- }
- }
- else error("Select one edge or two adjacent faces");
-
-
- /* flush selected vertices (again) to edges/faces */
- EM_select_flush();
-
- allqueue(REDRAWVIEW3D, 0);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-
-#ifdef WITH_VERSE
- if(G.editMesh->vnode)
- sync_all_versefaces_with_editfaces((VNode*)G.editMesh->vnode);
-#endif
-
- BIF_undo_push("Rotate Edge");
-}
-
-/******************* BEVEL CODE STARTS HERE ********************/
-
-static void bevel_displace_vec(float *midvec, float *v1, float *v2, float *v3, float d, float no[3])
-{
- float a[3], c[3], n_a[3], n_c[3], mid[3], ac, ac2, fac;
-
- VecSubf(a, v1, v2);
- VecSubf(c, v3, v2);
-
- Crossf(n_a, a, no);
- Normalize(n_a);
- Crossf(n_c, no, c);
- Normalize(n_c);
-
- Normalize(a);
- Normalize(c);
- ac = Inpf(a, c);
-
- if (ac == 1 || ac == -1) {
- midvec[0] = midvec[1] = midvec[2] = 0;
- return;
- }
- ac2 = ac * ac;
- fac = (float)sqrt((ac2 + 2*ac + 1)/(1 - ac2) + 1);
- VecAddf(mid, n_c, n_a);
- Normalize(mid);
- VecMulf(mid, d * fac);
- VecAddf(mid, mid, v2);
- VecCopyf(midvec, mid);
-}
-
-/* Finds the new point using the sinus law to extrapolate a triangle
- Lots of sqrts which would not be good for a real time algo
- Using the mid point of the extrapolation of both sides
- Useless for coplanar quads, but that doesn't happen too often */
-static void fix_bevel_wrap(float *midvec, float *v1, float *v2, float *v3, float *v4, float d, float no[3])
-{
- float a[3], b[3], c[3], l_a, l_b, l_c, s_a, s_b, s_c, Pos1[3], Pos2[3], Dir[3];
-
- VecSubf(a, v3, v2);
- l_a = Normalize(a);
- VecSubf(b, v4, v3);
- Normalize(b);
- VecSubf(c, v1, v2);
- Normalize(c);
-
- s_b = Inpf(a, c);
- s_b = (float)sqrt(1 - (s_b * s_b));
- s_a = Inpf(b, c);
- s_a = (float)sqrt(1 - (s_a * s_a));
- VecMulf(a, -1);
- s_c = Inpf(a, b);
- s_c = (float)sqrt(1 - (s_c * s_c));
-
- l_b = s_b * l_a / s_a;
- l_c = s_c * l_a / s_a;
-
- VecMulf(b, l_b);
- VecMulf(c, l_c);
-
- VecAddf(Pos1, v2, c);
- VecAddf(Pos2, v3, b);
-
- VecAddf(Dir, Pos1, Pos2);
- VecMulf(Dir, 0.5);
-
- bevel_displace_vec(midvec, v3, Dir, v2, d, no);
-
-}
-
-
-static char detect_wrap(float *o_v1, float *o_v2, float *v1, float *v2, float *no)
-{
- float o_a[3], a[3], o_c[3], c[3];
-
- VecSubf(o_a, o_v1, o_v2);
- VecSubf(a, v1, v2);
-
- Crossf(o_c, o_a, no);
- Crossf(c, a, no);
-
- if (Inpf(c, o_c) <= 0)
- return 1;
- else
- return 0;
-}
-
-// Detects and fix a quad wrapping after the resize
-// Arguments are the orginal verts followed by the final verts and then the bevel size and the normal
-static void fix_bevel_quad_wrap(float *o_v1, float *o_v2, float *o_v3, float *o_v4, float *v1, float *v2, float *v3, float *v4, float d, float *no)
-{
- float vec[3];
- char wrap[4];
-
- // Quads can wrap partially. Watch out
- wrap[0] = detect_wrap(o_v1, o_v2, v1, v2, no); // Edge 1-2
- wrap[1] = detect_wrap(o_v2, o_v3, v2, v3, no); // Edge 2-3
- wrap[2] = detect_wrap(o_v3, o_v4, v3, v4, no); // Edge 3-4
- wrap[3] = detect_wrap(o_v4, o_v1, v4, v1, no); // Edge 4-1
-
- // Edge 1 inverted
- if (wrap[0] == 1 && wrap[1] == 0 && wrap[2] == 0 && wrap[3] == 0) {
- fix_bevel_wrap(vec, o_v2, o_v3, o_v4, o_v1, d, no);
- VECCOPY(v1, vec);
- VECCOPY(v2, vec);
- }
- // Edge 2 inverted
- else if (wrap[0] == 0 && wrap[1] == 1 && wrap[2] == 0 && wrap[3] == 0) {
- fix_bevel_wrap(vec, o_v3, o_v4, o_v1, o_v2, d, no);
- VECCOPY(v2, vec);
- VECCOPY(v3, vec);
- }
- // Edge 3 inverted
- else if (wrap[0] == 0 && wrap[1] == 0 && wrap[2] == 1 && wrap[3] == 0) {
- fix_bevel_wrap(vec, o_v4, o_v1, o_v2, o_v3, d, no);
- VECCOPY(v3, vec);
- VECCOPY(v4, vec);
- }
- // Edge 4 inverted
- else if (wrap[0] == 0 && wrap[1] == 0 && wrap[2] == 0 && wrap[3] == 1) {
- fix_bevel_wrap(vec, o_v1, o_v2, o_v3, o_v4, d, no);
- VECCOPY(v4, vec);
- VECCOPY(v1, vec);
- }
- // Edge 2 and 4 inverted
- else if (wrap[0] == 0 && wrap[1] == 1 && wrap[2] == 0 && wrap[3] == 1) {
- VecAddf(vec, v2, v3);
- VecMulf(vec, 0.5);
- VECCOPY(v2, vec);
- VECCOPY(v3, vec);
- VecAddf(vec, v1, v4);
- VecMulf(vec, 0.5);
- VECCOPY(v1, vec);
- VECCOPY(v4, vec);
- }
- // Edge 1 and 3 inverted
- else if (wrap[0] == 1 && wrap[1] == 0 && wrap[2] == 1 && wrap[3] == 0) {
- VecAddf(vec, v1, v2);
- VecMulf(vec, 0.5);
- VECCOPY(v1, vec);
- VECCOPY(v2, vec);
- VecAddf(vec, v3, v4);
- VecMulf(vec, 0.5);
- VECCOPY(v3, vec);
- VECCOPY(v4, vec);
- }
- // Totally inverted
- else if (wrap[0] == 1 && wrap[1] == 1 && wrap[2] == 1 && wrap[3] == 1) {
- VecAddf(vec, v1, v2);
- VecAddf(vec, vec, v3);
- VecAddf(vec, vec, v4);
- VecMulf(vec, 0.25);
- VECCOPY(v1, vec);
- VECCOPY(v2, vec);
- VECCOPY(v3, vec);
- VECCOPY(v4, vec);
- }
-
-}
-
-// Detects and fix a tri wrapping after the resize
-// Arguments are the orginal verts followed by the final verts and the normal
-// Triangles cannot wrap partially (not in this situation
-static void fix_bevel_tri_wrap(float *o_v1, float *o_v2, float *o_v3, float *v1, float *v2, float *v3, float *no)
-{
- if (detect_wrap(o_v1, o_v2, v1, v2, no)) {
- float vec[3];
- VecAddf(vec, o_v1, o_v2);
- VecAddf(vec, vec, o_v3);
- VecMulf(vec, 1.0f/3.0f);
- VECCOPY(v1, vec);
- VECCOPY(v2, vec);
- VECCOPY(v3, vec);
- }
-}
-
-static void bevel_shrink_faces(float d, int flag)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
- float vec[3], no[3], v1[3], v2[3], v3[3], v4[3];
-
- /* move edges of all faces with efa->f1 & flag closer towards their centers */
- efa= em->faces.first;
- while (efa) {
- if (efa->f1 & flag) {
- VECCOPY(v1, efa->v1->co);
- VECCOPY(v2, efa->v2->co);
- VECCOPY(v3, efa->v3->co);
- VECCOPY(no, efa->n);
- if (efa->v4 == NULL) {
- bevel_displace_vec(vec, v1, v2, v3, d, no);
- VECCOPY(efa->v2->co, vec);
- bevel_displace_vec(vec, v2, v3, v1, d, no);
- VECCOPY(efa->v3->co, vec);
- bevel_displace_vec(vec, v3, v1, v2, d, no);
- VECCOPY(efa->v1->co, vec);
-
- fix_bevel_tri_wrap(v1, v2, v3, efa->v1->co, efa->v2->co, efa->v3->co, no);
- } else {
- VECCOPY(v4, efa->v4->co);
- bevel_displace_vec(vec, v1, v2, v3, d, no);
- VECCOPY(efa->v2->co, vec);
- bevel_displace_vec(vec, v2, v3, v4, d, no);
- VECCOPY(efa->v3->co, vec);
- bevel_displace_vec(vec, v3, v4, v1, d, no);
- VECCOPY(efa->v4->co, vec);
- bevel_displace_vec(vec, v4, v1, v2, d, no);
- VECCOPY(efa->v1->co, vec);
-
- fix_bevel_quad_wrap(v1, v2, v3, v4, efa->v1->co, efa->v2->co, efa->v3->co, efa->v4->co, d, no);
- }
- }
- efa= efa->next;
- }
-}
-
-static void bevel_shrink_draw(float d, int flag)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
- float vec[3], no[3], v1[3], v2[3], v3[3], v4[3], fv1[3], fv2[3], fv3[3], fv4[3];
-
- /* move edges of all faces with efa->f1 & flag closer towards their centers */
- efa= em->faces.first;
- while (efa) {
- VECCOPY(v1, efa->v1->co);
- VECCOPY(v2, efa->v2->co);
- VECCOPY(v3, efa->v3->co);
- VECCOPY(no, efa->n);
- if (efa->v4 == NULL) {
- bevel_displace_vec(vec, v1, v2, v3, d, no);
- VECCOPY(fv2, vec);
- bevel_displace_vec(vec, v2, v3, v1, d, no);
- VECCOPY(fv3, vec);
- bevel_displace_vec(vec, v3, v1, v2, d, no);
- VECCOPY(fv1, vec);
-
- fix_bevel_tri_wrap(v1, v2, v3, fv1, fv2, fv3, no);
-
- glBegin(GL_LINES);
- glVertex3fv(fv1);
- glVertex3fv(fv2);
- glEnd();
- glBegin(GL_LINES);
- glVertex3fv(fv2);
- glVertex3fv(fv3);
- glEnd();
- glBegin(GL_LINES);
- glVertex3fv(fv1);
- glVertex3fv(fv3);
- glEnd();
- } else {
- VECCOPY(v4, efa->v4->co);
- bevel_displace_vec(vec, v4, v1, v2, d, no);
- VECCOPY(fv1, vec);
- bevel_displace_vec(vec, v1, v2, v3, d, no);
- VECCOPY(fv2, vec);
- bevel_displace_vec(vec, v2, v3, v4, d, no);
- VECCOPY(fv3, vec);
- bevel_displace_vec(vec, v3, v4, v1, d, no);
- VECCOPY(fv4, vec);
-
- fix_bevel_quad_wrap(v1, v2, v3, v4, fv1, fv2, fv3, fv4, d, no);
-
- glBegin(GL_LINES);
- glVertex3fv(fv1);
- glVertex3fv(fv2);
- glEnd();
- glBegin(GL_LINES);
- glVertex3fv(fv2);
- glVertex3fv(fv3);
- glEnd();
- glBegin(GL_LINES);
- glVertex3fv(fv3);
- glVertex3fv(fv4);
- glEnd();
- glBegin(GL_LINES);
- glVertex3fv(fv1);
- glVertex3fv(fv4);
- glEnd();
- }
- efa= efa->next;
- }
-}
-
-static void bevel_mesh(float bsize, int allfaces)
-{
- EditMesh *em = G.editMesh;
-//#define BEV_DEBUG
-/* Enables debug printfs and assigns material indices: */
-/* 2 = edge quad */
-/* 3 = fill polygon (vertex clusters) */
-
- EditFace *efa, *example; //, *nextvl;
- EditEdge *eed, *eed2;
- EditVert *neweve[1024], *eve, *eve2, *eve3, *v1, *v2, *v3, *v4; //, *eve4;
- //short found4, search;
- //float f1, f2, f3, f4;
- float cent[3], min[3], max[3];
- int a, b, c;
- float limit= 0.001f;
-
- if(multires_test()) return;
-
- waitcursor(1);
-
- removedoublesflag(1, 0, limit);
-
- /* tag all original faces */
- efa= em->faces.first;
- while (efa) {
- efa->f1= 0;
- if (faceselectedAND(efa, 1)||allfaces) {
- efa->f1= 1;
- efa->v1->f |= 128;
- efa->v2->f |= 128;
- efa->v3->f |= 128;
- if (efa->v4) efa->v4->f |= 128;
- }
- efa->v1->f &= ~64;
- efa->v2->f &= ~64;
- efa->v3->f &= ~64;
- if (efa->v4) efa->v4->f &= ~64;
-
- efa= efa->next;
- }
-
-#ifdef BEV_DEBUG
- fprintf(stderr,"bevel_mesh: split\n");
-#endif
-
- efa= em->faces.first;
- while (efa) {
- if (efa->f1 & 1) {
- efa->f1-= 1;
- v1= addvertlist(efa->v1->co, efa->v1);
- v1->f= efa->v1->f & ~128;
- efa->v1->tmp.v = v1;
-
- v1= addvertlist(efa->v2->co, efa->v2);
- v1->f= efa->v2->f & ~128;
- efa->v2->tmp.v = v1;
-
- v1= addvertlist(efa->v3->co, efa->v3);
- v1->f= efa->v3->f & ~128;
- efa->v3->tmp.v = v1;
-
- if (efa->v4) {
- v1= addvertlist(efa->v4->co, efa->v4);
- v1->f= efa->v4->f & ~128;
- efa->v4->tmp.v = v1;
- }
-
- /* Needs better adaption of creases? */
- addedgelist(efa->e1->v1->tmp.v,
- efa->e1->v2->tmp.v,
- efa->e1);
- addedgelist(efa->e2->v1->tmp.v,
- efa->e2->v2->tmp.v,
- efa->e2);
- addedgelist(efa->e3->v1->tmp.v,
- efa->e3->v2->tmp.v,
- efa->e3);
- if (efa->e4) addedgelist(efa->e4->v1->tmp.v,
- efa->e4->v2->tmp.v,
- efa->e4);
-
- if(efa->v4) {
- v1 = efa->v1->tmp.v;
- v2 = efa->v2->tmp.v;
- v3 = efa->v3->tmp.v;
- v4 = efa->v4->tmp.v;
- addfacelist(v1, v2, v3, v4, efa,NULL);
- } else {
- v1= efa->v1->tmp.v;
- v2= efa->v2->tmp.v;
- v3= efa->v3->tmp.v;
- addfacelist(v1, v2, v3, 0, efa,NULL);
- }
-
- efa= efa-> next;
- } else {
- efa= efa->next;
- }
- }
-
- for(efa= em->faces.first; efa; efa= efa->next) {
- if( (efa->v1->f & 128) && (efa->v2->f & 128) && (efa->v3->f & 128) ) {
- if(efa->v4==NULL || (efa->v4->f & 128)) efa->f |= 128;
- }
- }
-
- delfaceflag(128); // works with face flag now
-
- /* tag all faces for shrink*/
- efa= em->faces.first;
- while (efa) {
- if (faceselectedAND(efa, 1)||allfaces) {
- efa->f1= 2;
- }
- efa= efa->next;
- }
-
-#ifdef BEV_DEBUG
- fprintf(stderr,"bevel_mesh: make edge quads\n");
-#endif
-
- /* find edges that are on each other and make quads between them */
-
- eed= em->edges.first;
- while(eed) {
- eed->f2= eed->f1= 0;
- if ( ((eed->v1->f & eed->v2->f) & 1) || allfaces)
- eed->f1 |= 4; /* original edges */
- eed->tmp.v = 0;
- eed= eed->next;
- }
-
- eed= em->edges.first;
- while (eed) {
- if ( ((eed->f1 & 2)==0) && (eed->f1 & 4) ) {
- eed2= em->edges.first;
- while (eed2) {
- if ( (eed2 != eed) && ((eed2->f1 & 2)==0) && (eed->f1 & 4) ) {
- if (
- (eed->v1 != eed2->v1) &&
- (eed->v1 != eed2->v2) &&
- (eed->v2 != eed2->v1) &&
- (eed->v2 != eed2->v2) && (
- ( VecCompare(eed->v1->co, eed2->v1->co, limit) &&
- VecCompare(eed->v2->co, eed2->v2->co, limit) ) ||
- ( VecCompare(eed->v1->co, eed2->v2->co, limit) &&
- VecCompare(eed->v2->co, eed2->v1->co, limit) ) ) )
- {
-
-#ifdef BEV_DEBUG
- fprintf(stderr, "bevel_mesh: edge quad\n");
-#endif
-
- eed->f1 |= 2; /* these edges are finished */
- eed2->f1 |= 2;
-
- example= NULL;
- efa= em->faces.first; /* search example face (for mat_nr, ME_SMOOTH, ...) */
- while (efa) {
- if ( (efa->e1 == eed) ||
- (efa->e2 == eed) ||
- (efa->e3 == eed) ||
- (efa->e4 && (efa->e4 == eed)) ) {
- example= efa;
- efa= NULL;
- }
- if (efa) efa= efa->next;
- }
-
- neweve[0]= eed->v1; neweve[1]= eed->v2;
- neweve[2]= eed2->v1; neweve[3]= eed2->v2;
-
- if(exist_face(neweve[0], neweve[1], neweve[2], neweve[3])==0) {
- efa= NULL;
-
- if (VecCompare(eed->v1->co, eed2->v2->co, limit)) {
- efa= addfacelist(neweve[0], neweve[1], neweve[2], neweve[3], example,NULL);
- } else {
- efa= addfacelist(neweve[0], neweve[2], neweve[3], neweve[1], example,NULL);
- }
-
- if(efa) {
- float inp;
- CalcNormFloat(efa->v1->co, efa->v2->co, efa->v3->co, efa->n);
- inp= efa->n[0]*G.vd->viewmat[0][2] + efa->n[1]*G.vd->viewmat[1][2] + efa->n[2]*G.vd->viewmat[2][2];
- if(inp < 0.0) flipface(efa);
-#ifdef BEV_DEBUG
- efa->mat_nr= 1;
-#endif
- } else fprintf(stderr,"bevel_mesh: error creating face\n");
- }
- eed2= NULL;
- }
- }
- if (eed2) eed2= eed2->next;
- }
- }
- eed= eed->next;
- }
-
- eed= em->edges.first;
- while(eed) {
- eed->f2= eed->f1= 0;
- eed->f1= 0;
- eed->v1->f1 &= ~1;
- eed->v2->f1 &= ~1;
- eed->tmp.v = 0;
- eed= eed->next;
- }
-
-#ifdef BEV_DEBUG
- fprintf(stderr,"bevel_mesh: find clusters\n");
-#endif
-
- /* Look for vertex clusters */
-
- eve= em->verts.first;
- while (eve) {
- eve->f &= ~(64|128);
- eve->tmp.v = NULL;
- eve= eve->next;
- }
-
- /* eve->f: 128: first vertex in a list (->tmp.v) */
- /* 64: vertex is in a list */
-
- eve= em->verts.first;
- while (eve) {
- eve2= em->verts.first;
- eve3= NULL;
- while (eve2) {
- if ((eve2 != eve) && ((eve2->f & (64|128))==0)) {
- if (VecCompare(eve->co, eve2->co, limit)) {
- if ((eve->f & (128|64)) == 0) {
- /* fprintf(stderr,"Found vertex cluster:\n *\n *\n"); */
- eve->f |= 128;
- eve->tmp.v = eve2;
- eve3= eve2;
- } else if ((eve->f & 64) == 0) {
- /* fprintf(stderr," *\n"); */
- if (eve3) eve3->tmp.v = eve2;
- eve2->f |= 64;
- eve3= eve2;
- }
- }
- }
- eve2= eve2->next;
- if (!eve2) {
- if (eve3) eve3->tmp.v = NULL;
- }
- }
- eve= eve->next;
- }
-
-#ifdef BEV_DEBUG
- fprintf(stderr,"bevel_mesh: shrink faces\n");
-#endif
-
- bevel_shrink_faces(bsize, 2);
-
-#ifdef BEV_DEBUG
- fprintf(stderr,"bevel_mesh: fill clusters\n");
-#endif
-
- /* Make former vertex clusters faces */
-
- eve= em->verts.first;
- while (eve) {
- eve->f &= ~64;
- eve= eve->next;
- }
-
- eve= em->verts.first;
- while (eve) {
- if (eve->f & 128) {
- eve->f &= ~128;
- a= 0;
- neweve[a]= eve;
- eve2 = eve->tmp.v;
- while (eve2) {
- a++;
- neweve[a]= eve2;
- eve2 = eve2->tmp.v;
- }
- a++;
- efa= NULL;
- if (a>=3) {
- example= NULL;
- efa= em->faces.first; /* search example face */
- while (efa) {
- if ( (efa->v1 == neweve[0]) ||
- (efa->v2 == neweve[0]) ||
- (efa->v3 == neweve[0]) ||
- (efa->v4 && (efa->v4 == neweve[0])) ) {
- example= efa;
- efa= NULL;
- }
- if (efa) efa= efa->next;
- }
-#ifdef BEV_DEBUG
- fprintf(stderr,"bevel_mesh: Making %d-gon\n", a);
-#endif
- if (a>4) {
- cent[0]= cent[1]= cent[2]= 0.0;
- INIT_MINMAX(min, max);
- for (b=0; b<a; b++) {
- VecAddf(cent, cent, neweve[b]->co);
- DO_MINMAX(neweve[b]->co, min, max);
- }
- cent[0]= (min[0]+max[0])/2;
- cent[1]= (min[1]+max[1])/2;
- cent[2]= (min[2]+max[2])/2;
- eve2= addvertlist(cent, NULL);
- eve2->f |= 1;
- eed= em->edges.first;
- while (eed) {
- c= 0;
- for (b=0; b<a; b++)
- if ((neweve[b]==eed->v1) || (neweve[b]==eed->v2)) c++;
- if (c==2) {
- if(exist_face(eed->v1, eed->v2, eve2, 0)==0) {
- efa= addfacelist(eed->v1, eed->v2, eve2, 0, example,NULL);
-#ifdef BEV_DEBUG
- efa->mat_nr= 2;
-#endif
- }
- }
- eed= eed->next;
- }
- } else if (a==4) {
- if(exist_face(neweve[0], neweve[1], neweve[2], neweve[3])==0) {
- /* the order of vertices can be anything, three cases to check */
- if( convex(neweve[0]->co, neweve[1]->co, neweve[2]->co, neweve[3]->co) ) {
- efa= addfacelist(neweve[0], neweve[1], neweve[2], neweve[3], NULL, NULL);
- }
- else if( convex(neweve[0]->co, neweve[2]->co, neweve[3]->co, neweve[1]->co) ) {
- efa= addfacelist(neweve[0], neweve[2], neweve[3], neweve[1], NULL, NULL);
- }
- else if( convex(neweve[0]->co, neweve[2]->co, neweve[1]->co, neweve[3]->co) ) {
- efa= addfacelist(neweve[0], neweve[2], neweve[1], neweve[3], NULL, NULL);
- }
- }
- }
- else if (a==3) {
- if(exist_face(neweve[0], neweve[1], neweve[2], 0)==0)
- efa= addfacelist(neweve[0], neweve[1], neweve[2], 0, example, NULL);
- }
- if(efa) {
- float inp;
- CalcNormFloat(neweve[0]->co, neweve[1]->co, neweve[2]->co, efa->n);
- inp= efa->n[0]*G.vd->viewmat[0][2] + efa->n[1]*G.vd->viewmat[1][2] + efa->n[2]*G.vd->viewmat[2][2];
- if(inp < 0.0) flipface(efa);
-#ifdef BEV_DEBUG
- efa->mat_nr= 2;
-#endif
- }
- }
- }
- eve= eve->next;
- }
-
- eve= em->verts.first;
- while (eve) {
- eve->f1= 0;
- eve->f &= ~(128|64);
- eve->tmp.v= NULL;
- eve= eve->next;
- }
-
- recalc_editnormals();
- waitcursor(0);
- countall();
- allqueue(REDRAWVIEW3D, 0);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-
- removedoublesflag(1, 0, limit);
-
- /* flush selected vertices to edges/faces */
- EM_select_flush();
-
-#undef BEV_DEBUG
-}
-
-static void bevel_mesh_recurs(float bsize, short recurs, int allfaces)
-{
- float d;
- short nr;
-
- d= bsize;
- for (nr=0; nr<recurs; nr++) {
- bevel_mesh(d, allfaces);
- if (nr==0) d /= 3; else d /= 2;
- }
-}
-
-void bevel_menu()
-{
- char Finished = 0, Canceled = 0, str[100], Recalc = 0;
- short mval[2], oval[2], curval[2], event = 0, recurs = 1, nr;
- float vec[3], d, drawd=0.0, center[3], fac = 1;
-
- getmouseco_areawin(mval);
- oval[0] = mval[0]; oval[1] = mval[1];
-
- // Silly hackish code to initialise the variable (warning if not done)
- // while still drawing in the first iteration (and without using another variable)
- curval[0] = mval[0] + 1; curval[1] = mval[1] + 1;
-
- // Init grabz for window to vec conversions
- initgrabz(-G.vd->ofs[0], -G.vd->ofs[1], -G.vd->ofs[2]);
- window_to_3d(center, mval[0], mval[1]);
-
- if(button(&recurs, 1, 4, "Recursion:")==0) return;
-
- for (nr=0; nr<recurs-1; nr++) {
- if (nr==0) fac += 1.0f/3.0f; else fac += 1.0f/(3 * nr * 2.0f);
- }
-
- EM_set_flag_all(SELECT);
-
- SetBlenderCursor(SYSCURSOR);
-
- while (Finished == 0)
- {
- getmouseco_areawin(mval);
- if (mval[0] != curval[0] || mval[1] != curval[1] || (Recalc == 1))
- {
- Recalc = 0;
- curval[0] = mval[0];
- curval[1] = mval[1];
-
- window_to_3d(vec, mval[0]-oval[0], mval[1]-oval[1]);
- d = Normalize(vec) / 10;
-
-
- drawd = d * fac;
- if (G.qual & LR_CTRLKEY)
- drawd = (float) floor(drawd * 10.0f)/10.0f;
- if (G.qual & LR_SHIFTKEY)
- drawd /= 10;
-
- /*------------- Preview lines--------------- */
-
- /* uses callback mechanism to draw it all in current area */
- scrarea_do_windraw(curarea);
-
- /* set window matrix to perspective, default an area returns with buttons transform */
- persp(PERSP_VIEW);
- /* make a copy, for safety */
- glPushMatrix();
- /* multiply with the object transformation */
- mymultmatrix(G.obedit->obmat);
-
- glColor3ub(255, 255, 0);
-
- // PREVIEW CODE GOES HERE
- bevel_shrink_draw(drawd, 2);
-
- /* restore matrix transform */
- glPopMatrix();
-
- sprintf(str, "Bevel Size: %.4f LMB to confirm, RMB to cancel, SPACE to input directly.", drawd);
- headerprint(str);
-
- /* this also verifies other area/windows for clean swap */
- screen_swapbuffers();
-
- persp(PERSP_WIN);
-
- glDrawBuffer(GL_FRONT);
-
- BIF_ThemeColor(TH_WIRE);
-
- setlinestyle(3);
- glBegin(GL_LINE_STRIP);
- glVertex2sv(mval);
- glVertex2sv(oval);
- glEnd();
- setlinestyle(0);
-
- persp(PERSP_VIEW);
- bglFlush(); // flush display for frontbuffer
- glDrawBuffer(GL_BACK);
- }
- while(qtest()) {
- short val=0;
- event= extern_qread(&val); // extern_qread stores important events for the mainloop to handle
-
- /* val==0 on key-release event */
- if(val && (event==ESCKEY || event==RIGHTMOUSE || event==LEFTMOUSE || event==RETKEY || event==ESCKEY)) {
- if (event==RIGHTMOUSE || event==ESCKEY)
- Canceled = 1;
- Finished = 1;
- }
- else if (val && event==SPACEKEY) {
- if (fbutton(&d, 0.000, 10.000, 10, 0, "Width:")!=0) {
- drawd = d * fac;
- Finished = 1;
- }
- }
- else if (val) {
- /* On any other keyboard event, recalc */
- Recalc = 1;
- }
-
- }
- }
- if (Canceled==0) {
- SetBlenderCursor(BC_WAITCURSOR);
- bevel_mesh_recurs(drawd/fac, recurs, 1);
- righthandfaces(1);
- SetBlenderCursor(SYSCURSOR);
- BIF_undo_push("Bevel");
- }
-}
-
-/* *********** END BEVEL *********/
-
-typedef struct SlideVert {
- EditEdge *up,*down;
- EditVert origvert;
-} SlideVert;
-
-int EdgeLoopDelete(void) {
- if(!EdgeSlide(1, 1)) {
- return 0;
- }
- select_more();
- removedoublesflag(1,0, 0.001);
- EM_select_flush();
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- return 1;
-}
-
-int EdgeSlide(short immediate, float imperc)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
- EditEdge *eed,*first=NULL,*last=NULL, *temp = NULL;
- EditVert *ev, *nearest;
- LinkNode *edgelist = NULL, *vertlist=NULL, *look;
- GHash *vertgh;
- SlideVert *tempsv;
- float perc = 0, percp = 0,vertdist, projectMat[4][4], viewMat[4][4];
- float shiftlabda= 0.0f,len = 0.0f;
- int i = 0,j, numsel, numadded=0, timesthrough = 0, vertsel=0, prop=1, cancel = 0,flip=0;
- int wasshift = 0;
- short event, draw=1;
- short mval[2], mvalo[2];
- char str[128];
- float labda = 0.0f;
-
- view3d_get_object_project_mat(curarea, G.obedit, projectMat, viewMat);
-
- mvalo[0] = -1; mvalo[1] = -1;
- numsel =0;
-
- // Get number of selected edges and clear some flags
- for(eed=em->edges.first;eed;eed=eed->next) {
- eed->f1 = 0;
- eed->f2 = 0;
- if(eed->f & SELECT) numsel++;
- }
-
- for(ev=em->verts.first;ev;ev=ev->next) {
- ev->f1 = 0;
- }
-
- //Make sure each edge only has 2 faces
- // make sure loop doesn't cross face
- for(efa=em->faces.first;efa;efa=efa->next) {
- int ct = 0;
- if(efa->e1->f & SELECT) {
- ct++;
- efa->e1->f1++;
- if(efa->e1->f1 > 2) {
- error("3+ face edge");
- return 0;
- }
- }
- if(efa->e2->f & SELECT) {
- ct++;
- efa->e2->f1++;
- if(efa->e2->f1 > 2) {
- error("3+ face edge");
- return 0;
- }
- }
- if(efa->e3->f & SELECT) {
- ct++;
- efa->e3->f1++;
- if(efa->e3->f1 > 2) {
- error("3+ face edge");
- return 0;
- }
- }
- if(efa->e4 && efa->e4->f & SELECT) {
- ct++;
- efa->e4->f1++;
- if(efa->e4->f1 > 2) {
- error("3+ face edge");
- return 0;
- }
- }
- // Make sure loop is not 2 edges of same face
- if(ct > 1) {
- error("loop crosses itself");
- return 0;
- }
- }
- // Get # of selected verts
- for(ev=em->verts.first;ev;ev=ev->next) {
- if(ev->f & SELECT) vertsel++;
- }
-
- // Test for multiple segments
- if(vertsel > numsel+1) {
- error("Was not a single edge loop");
- return 0;
- }
-
- // Get the edgeloop in order - mark f1 with SELECT once added
- for(eed=em->edges.first;eed;eed=eed->next) {
- if((eed->f & SELECT) && !(eed->f1 & SELECT)) {
- // If this is the first edge added, just put it in
- if(!edgelist) {
- BLI_linklist_prepend(&edgelist,eed);
- numadded++;
- first = eed;
- last = eed;
- eed->f1 = SELECT;
- } else {
- if(editedge_getSharedVert(eed, last)) {
- BLI_linklist_append(&edgelist,eed);
- eed->f1 = SELECT;
- numadded++;
- last = eed;
- } else if(editedge_getSharedVert(eed, first)) {
- BLI_linklist_prepend(&edgelist,eed);
- eed->f1 = SELECT;
- numadded++;
- first = eed;
- }
- }
- }
- if(eed->next == NULL && numadded != numsel) {
- eed=em->edges.first;
- timesthrough++;
- }
-
- // It looks like there was an unexpected case - Hopefully should not happen
- if(timesthrough >= numsel*2) {
- BLI_linklist_free(edgelist,NULL);
- error("could not order loop");
- return 0;
- }
- }
-
- // Put the verts in order in a linklist
- look = edgelist;
- while(look) {
- eed = look->link;
- if(!vertlist) {
- if(look->next) {
- temp = look->next->link;
-
- //This is the first entry takes care of extra vert
- if(eed->v1 != temp->v1 && eed->v1 != temp->v2) {
- BLI_linklist_append(&vertlist,eed->v1);
- eed->v1->f1 = 1;
- } else {
- BLI_linklist_append(&vertlist,eed->v2);
- eed->v2->f1 = 1;
- }
- } else {
- //This is the case that we only have 1 edge
- BLI_linklist_append(&vertlist,eed->v1);
- eed->v1->f1 = 1;
- }
- }
- // for all the entries
- if(eed->v1->f1 != 1) {
- BLI_linklist_append(&vertlist,eed->v1);
- eed->v1->f1 = 1;
- } else if(eed->v2->f1 != 1) {
- BLI_linklist_append(&vertlist,eed->v2);
- eed->v2->f1 = 1;
- }
- look = look->next;
- }
-
- // populate the SlideVerts
-
- vertgh = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp);
- look = vertlist;
- while(look) {
- i=0;
- j=0;
- ev = look->link;
- tempsv = (struct SlideVert*)MEM_mallocN(sizeof(struct SlideVert),"SlideVert");
- tempsv->up = NULL;
- tempsv->down = NULL;
- tempsv->origvert.co[0] = ev->co[0];
- tempsv->origvert.co[1] = ev->co[1];
- tempsv->origvert.co[2] = ev->co[2];
- tempsv->origvert.no[0] = ev->no[0];
- tempsv->origvert.no[1] = ev->no[1];
- tempsv->origvert.no[2] = ev->no[2];
- // i is total edges that vert is on
- // j is total selected edges that vert is on
-
- for(eed=em->edges.first;eed;eed=eed->next) {
- if(eed->v1 == ev || eed->v2 == ev) {
- i++;
- if(eed->f & SELECT) {
- j++;
- }
- }
- }
- // If the vert is in the middle of an edge loop, it touches 2 selected edges and 2 unselected edges
- if(i == 4 && j == 2) {
- for(eed=em->edges.first;eed;eed=eed->next) {
- if(editedge_containsVert(eed, ev)) {
- if(!(eed->f & SELECT)) {
- if(!tempsv->up) {
- tempsv->up = eed;
- } else if (!(tempsv->down)) {
- tempsv->down = eed;
- }
- }
- }
- }
- }
- // If it is on the end of the loop, it touches 1 selected and as least 2 more unselected
- if(i >= 3 && j == 1) {
- for(eed=em->edges.first;eed;eed=eed->next) {
- if(editedge_containsVert(eed, ev) && eed->f & SELECT) {
- for(efa = em->faces.first;efa;efa=efa->next) {
- if(editface_containsEdge(efa, eed)) {
- if(editedge_containsVert(efa->e1, ev) && efa->e1 != eed) {
- if(!tempsv->up) {
- tempsv->up = efa->e1;
- } else if (!(tempsv->down)) {
- tempsv->down = efa->e1;
- }
- }
- if(editedge_containsVert(efa->e2, ev) && efa->e2 != eed) {
- if(!tempsv->up) {
- tempsv->up = efa->e2;
- } else if (!(tempsv->down)) {
- tempsv->down = efa->e2;
- }
- }
- if(editedge_containsVert(efa->e3, ev) && efa->e3 != eed) {
- if(!tempsv->up) {
- tempsv->up = efa->e3;
- } else if (!(tempsv->down)) {
- tempsv->down = efa->e3;
- }
- }
- if(efa->e4) {
- if(editedge_containsVert(efa->e4, ev) && efa->e4 != eed) {
- if(!tempsv->up) {
- tempsv->up = efa->e4;
- } else if (!(tempsv->down)) {
- tempsv->down = efa->e4;
- }
- }
- }
-
- }
- }
- }
- }
- }
- if(i > 4 && j == 2) {
- BLI_ghash_free(vertgh, NULL, (GHashValFreeFP)MEM_freeN);
- BLI_linklist_free(vertlist,NULL);
- BLI_linklist_free(edgelist,NULL);
- return 0;
- }
- BLI_ghash_insert(vertgh,ev,tempsv);
-
- look = look->next;
- }
-
- // make sure the UPs nad DOWNs are 'faceloops'
- // Also find the nearest slidevert to the cursor
- getmouseco_areawin(mval);
- look = vertlist;
- nearest = NULL;
- vertdist = -1;
- while(look) {
- if(look->next != NULL) {
- SlideVert *sv;
-
- tempsv = BLI_ghash_lookup(vertgh,(EditVert*)look->link);
- sv = BLI_ghash_lookup(vertgh,(EditVert*)look->next->link);
-
- if(!tempsv->up || !tempsv->down) {
- error("Missing rails");
- BLI_ghash_free(vertgh, NULL, (GHashValFreeFP)MEM_freeN);
- BLI_linklist_free(vertlist,NULL);
- BLI_linklist_free(edgelist,NULL);
- return 0;
- }
-
- if(G.f & G_DRAW_EDGELEN) {
- if(!(tempsv->up->f & SELECT)) {
- tempsv->up->f |= SELECT;
- tempsv->up->f2 |= 16;
- } else {
- tempsv->up->f2 |= ~16;
- }
- if(!(tempsv->down->f & SELECT)) {
- tempsv->down->f |= SELECT;
- tempsv->down->f2 |= 16;
- } else {
- tempsv->down->f2 |= ~16;
- }
- }
-
- if(sv) {
- float tempdist, co[2];
-
- if(!sharesFace(tempsv->up,sv->up)) {
- EditEdge *swap;
- swap = sv->up;
- sv->up = sv->down;
- sv->down = swap;
- }
-
- view3d_project_float(curarea, tempsv->origvert.co, co, projectMat);
-
- tempdist = sqrt(pow(co[0] - mval[0],2)+pow(co[1] - mval[1],2));
-
- if(vertdist < 0) {
- vertdist = tempdist;
- nearest = (EditVert*)look->link;
- } else if ( tempdist < vertdist ) {
- vertdist = tempdist;
- nearest = (EditVert*)look->link;
- }
- }
- }
-
-
-
- look = look->next;
- }
- // we should have enough info now to slide
-
- len = 0.0f;
-
- percp = -1;
- while(draw) {
- /* For the % calculation */
- short mval[2];
- float rc[2];
- float v2[2], v3[2];
- EditVert *centerVert, *upVert, *downVert;
-
-
-
- getmouseco_areawin(mval);
-
- if (!immediate && (mval[0] == mvalo[0] && mval[1] == mvalo[1])) {
- PIL_sleep_ms(10);
- } else {
-
- mvalo[0] = mval[0];
- mvalo[1] = mval[1];
-
- //Adjust Edgeloop
- if(immediate) {
- perc = imperc;
- }
- percp = perc;
- if(prop) {
- look = vertlist;
- while(look) {
- EditVert *tempev;
- ev = look->link;
- tempsv = BLI_ghash_lookup(vertgh,ev);
-
- tempev = editedge_getOtherVert((perc>=0)?tempsv->up:tempsv->down, ev);
- VecLerpf(ev->co, tempsv->origvert.co, tempev->co, fabs(perc));
-
- look = look->next;
- }
- }
- else {
- //Non prop code
- look = vertlist;
- while(look) {
- float newlen;
- ev = look->link;
- tempsv = BLI_ghash_lookup(vertgh,ev);
- newlen = (len / VecLenf(editedge_getOtherVert(tempsv->up,ev)->co,editedge_getOtherVert(tempsv->down,ev)->co));
- if(newlen > 1.0) {newlen = 1.0;}
- if(newlen < 0.0) {newlen = 0.0;}
- if(flip == 0) {
- VecLerpf(ev->co, editedge_getOtherVert(tempsv->down,ev)->co, editedge_getOtherVert(tempsv->up,ev)->co, fabs(newlen));
- } else{
- VecLerpf(ev->co, editedge_getOtherVert(tempsv->up,ev)->co, editedge_getOtherVert(tempsv->down,ev)->co, fabs(newlen));
- }
- look = look->next;
- }
-
- }
-
- tempsv = BLI_ghash_lookup(vertgh,nearest);
-
- centerVert = editedge_getSharedVert(tempsv->up, tempsv->down);
- upVert = editedge_getOtherVert(tempsv->up, centerVert);
- downVert = editedge_getOtherVert(tempsv->down, centerVert);
- // Highlight the Control Edges
-
- scrarea_do_windraw(curarea);
- persp(PERSP_VIEW);
- glPushMatrix();
- mymultmatrix(G.obedit->obmat);
-
- glColor3ub(0, 255, 0);
- glBegin(GL_LINES);
- glVertex3fv(upVert->co);
- glVertex3fv(downVert->co);
- glEnd();
-
- if(prop == 0) {
- // draw start edge for non-prop
- glPointSize(5);
- glBegin(GL_POINTS);
- glColor3ub(255,0,255);
- if(flip) {
- glVertex3fv(upVert->co);
- } else {
- glVertex3fv(downVert->co);
- }
- glEnd();
- }
-
-
- glPopMatrix();
-
- view3d_project_float(curarea, upVert->co, v2, projectMat);
- view3d_project_float(curarea, downVert->co, v3, projectMat);
-
- /* Determine the % on which the loop should be cut */
-
- rc[0]= v3[0]-v2[0];
- rc[1]= v3[1]-v2[1];
- len= rc[0]*rc[0]+ rc[1]*rc[1];
- if (len==0) {len = 0.0001;}
-
- if ((G.qual & LR_SHIFTKEY)==0) {
- wasshift = 0;
- labda= ( rc[0]*((mval[0]-v2[0])) + rc[1]*((mval[1]-v2[1])) )/len;
- }
- else {
- if (wasshift==0) {
- wasshift = 1;
- shiftlabda = labda;
- }
- labda= ( rc[0]*((mval[0]-v2[0])) + rc[1]*((mval[1]-v2[1])) )/len / 10.0 + shiftlabda;
- }
-
-
- if(labda<=0.0) labda=0.0;
- else if(labda>=1.0)labda=1.0;
-
- perc=((1-labda)*2)-1;
-
- if(G.qual == 0) {
- perc *= 100;
- perc = floor(perc);
- perc /= 100;
- } else if (G.qual == LR_CTRLKEY) {
- perc *= 10;
- perc = floor(perc);
- perc /= 10;
- }
- if(prop) {
- sprintf(str, "(P)ercentage: %f", perc);
- } else {
- len = VecLenf(upVert->co,downVert->co)*((perc+1)/2);
- if(flip == 1) {
- len = VecLenf(upVert->co,downVert->co) - len;
- }
- sprintf(str, "Non (P)rop Length: %f, Press (F) to flip control side", len);
- }
-
-
-
- headerprint(str);
- screen_swapbuffers();
- }
- if(!immediate) {
- while(qtest()) {
- short val=0;
- event= extern_qread(&val); // extern_qread stores important events for the mainloop to handle
-
- /* val==0 on key-release event */
- if (val) {
- if(ELEM(event, ESCKEY, RIGHTMOUSE)) {
- prop = 1; // Go back to prop mode
- imperc = 0; // This is the % that gets set for immediate
- immediate = 1; //Run through eval code 1 more time
- cancel = 1; // Return -1
- mvalo[0] = -1;
- } else if(ELEM3(event, PADENTER, LEFTMOUSE, RETKEY)) {
- draw = 0; // End looping now
- } else if(event==MIDDLEMOUSE) {
- perc = 0;
- immediate = 1;
- } else if(event==PKEY) {
- (prop == 1) ? (prop = 0):(prop = 1);
- mvalo[0] = -1;
- } else if(event==FKEY) {
- (flip == 1) ? (flip = 0):(flip = 1);
- mvalo[0] = -1;
- } else if(ELEM(event, RIGHTARROWKEY, WHEELUPMOUSE)) { // Scroll through Control Edges
- look = vertlist;
- while(look) {
- if(nearest == (EditVert*)look->link) {
- if(look->next == NULL) {
- nearest = (EditVert*)vertlist->link;
- } else {
- nearest = (EditVert*)look->next->link;
- }
- mvalo[0] = -1;
- break;
- }
- look = look->next;
- }
- } else if(ELEM(event, LEFTARROWKEY, WHEELDOWNMOUSE)) { // Scroll through Control Edges
- look = vertlist;
- while(look) {
- if(look->next) {
- if(look->next->link == nearest) {
- nearest = (EditVert*)look->link;
- mvalo[0] = -1;
- break;
- }
- } else {
- if((EditVert*)vertlist->link == nearest) {
- nearest = look->link;
- mvalo[0] = -1;
- break;
- }
- }
- look = look->next;
- }
- }
- }
- }
- } else {
- draw = 0;
- }
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- }
-
-
- if(G.f & G_DRAW_EDGELEN) {
- look = vertlist;
- while(look) {
- tempsv = BLI_ghash_lookup(vertgh,(EditVert*)look->link);
- if(tempsv != NULL) {
- tempsv->up->f &= !SELECT;
- tempsv->down->f &= !SELECT;
- }
- look = look->next;
- }
- }
-
- force_draw(0);
-
- EM_automerge(0);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- scrarea_queue_winredraw(curarea);
-
- //BLI_ghash_free(edgesgh, freeGHash, NULL);
- BLI_ghash_free(vertgh, NULL, (GHashValFreeFP)MEM_freeN);
- BLI_linklist_free(vertlist,NULL);
- BLI_linklist_free(edgelist,NULL);
-
- if(cancel == 1) {
- return -1;
- }
- else {
-#ifdef WITH_VERSE
- if(G.editMesh->vnode) {
- sync_all_verseverts_with_editverts((VNode*)G.editMesh->vnode);
- sync_all_versefaces_with_editfaces((VNode*)G.editMesh->vnode);
- }
-#endif
- }
- return 1;
-}
-
-/* -------------------- More tools ------------------ */
-
-void mesh_set_face_flags(short mode)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
- MTFace *tface;
- short m_tex=0, m_tiles=0, m_shared=0, m_light=0, m_invis=0, m_collision=0, m_twoside=0, m_obcolor=0;
- short flag = 0, change = 0;
-
- if (!EM_texFaceCheck()) {
- error("not a mesh with uv/image layers");
- return;
- }
-
- add_numbut(0, TOG|SHO, "Texture", 0, 0, &m_tex, NULL);
- add_numbut(1, TOG|SHO, "Tiles", 0, 0, &m_tiles, NULL);
- add_numbut(2, TOG|SHO, "Shared", 0, 0, &m_shared, NULL);
- add_numbut(3, TOG|SHO, "Light", 0, 0, &m_light, NULL);
- add_numbut(4, TOG|SHO, "Invisible", 0, 0, &m_invis, NULL);
- add_numbut(5, TOG|SHO, "Collision", 0, 0, &m_collision, NULL);
- add_numbut(6, TOG|SHO, "Twoside", 0, 0, &m_twoside, NULL);
- add_numbut(7, TOG|SHO, "ObColor", 0, 0, &m_obcolor, NULL);
-
- if (!do_clever_numbuts((mode ? "Set Flags" : "Clear Flags"), 8, REDRAW))
- return;
-
- if (m_tex) flag |= TF_TEX;
- if (m_tiles) flag |= TF_TILES;
- if (m_shared) flag |= TF_SHAREDCOL;
- if (m_light) flag |= TF_LIGHT;
- if (m_invis) flag |= TF_INVISIBLE;
- if (m_collision) flag |= TF_DYNAMIC;
- if (m_twoside) flag |= TF_TWOSIDE;
- if (m_obcolor) flag |= TF_OBCOL;
-
- efa= em->faces.first;
- while(efa) {
- if(efa->f & SELECT) {
- tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (mode) tface->mode |= flag;
- else tface->mode &= ~flag;
- }
- efa= efa->next;
- }
-
- if (change) {
- BIF_undo_push((mode ? "Set Flags" : "Clear Flags"));
-
- allqueue(REDRAWIMAGE, 0);
- allqueue(REDRAWVIEW3D, 0);
- }
-}
-
-void mesh_set_smooth_faces(short event)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
-
- if(G.obedit==0) return;
-
- if(G.obedit->type != OB_MESH) return;
-
- efa= em->faces.first;
- while(efa) {
- if(efa->f & SELECT) {
- if(event==1) efa->flag |= ME_SMOOTH;
- else if(event==0) efa->flag &= ~ME_SMOOTH;
- }
- efa= efa->next;
- }
-
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
-
- if(event==1) BIF_undo_push("Set Smooth");
- else if(event==0) BIF_undo_push("Set Solid");
-}
-
-/* helper to find edge for edge_rip */
-static float mesh_rip_edgedist(float mat[][4], float *co1, float *co2, short *mval)
-{
- float vec1[3], vec2[3], mvalf[2];
-
- view3d_project_float(curarea, co1, vec1, mat);
- view3d_project_float(curarea, co2, vec2, mat);
- mvalf[0]= (float)mval[0];
- mvalf[1]= (float)mval[1];
-
- return PdistVL2Dfl(mvalf, vec1, vec2);
-}
-
-/* helper for below */
-static void mesh_rip_setface(EditFace *sefa)
-{
- /* put new vertices & edges in best face */
- if(sefa->v1->tmp.v) sefa->v1= sefa->v1->tmp.v;
- if(sefa->v2->tmp.v) sefa->v2= sefa->v2->tmp.v;
- if(sefa->v3->tmp.v) sefa->v3= sefa->v3->tmp.v;
- if(sefa->v4 && sefa->v4->tmp.v) sefa->v4= sefa->v4->tmp.v;
-
- sefa->e1= addedgelist(sefa->v1, sefa->v2, sefa->e1);
- sefa->e2= addedgelist(sefa->v2, sefa->v3, sefa->e2);
- if(sefa->v4) {
- sefa->e3= addedgelist(sefa->v3, sefa->v4, sefa->e3);
- sefa->e4= addedgelist(sefa->v4, sefa->v1, sefa->e4);
- }
- else
- sefa->e3= addedgelist(sefa->v3, sefa->v1, sefa->e3);
-
-}
-
-/* based on mouse cursor position, it defines how is being ripped */
-void mesh_rip(void)
-{
- extern void faceloop_select(EditEdge *startedge, int select);
- EditMesh *em = G.editMesh;
- EditVert *eve, *nextve;
- EditEdge *eed, *seed= NULL;
- EditFace *efa, *sefa= NULL;
- float projectMat[4][4], viewMat[4][4], vec[3], dist, mindist;
- short doit= 1, mval[2],propmode,prop;
-
- propmode = G.scene->prop_mode;
- G.scene->prop_mode = 0;
- prop = G.scene->proportional;
- G.scene->proportional = 0;
-
- /* select flush... vertices are important */
- EM_selectmode_set();
-
- getmouseco_areawin(mval);
- view3d_get_object_project_mat(curarea, G.obedit, projectMat, viewMat);
-
- /* find best face, exclude triangles and break on face select or faces with 2 edges select */
- mindist= 1000000.0f;
- for(efa= em->faces.first; efa; efa=efa->next) {
- if( efa->f & 1)
- break;
- if(efa->v4 && faceselectedOR(efa, SELECT) ) {
- int totsel=0;
-
- if(efa->e1->f & SELECT) totsel++;
- if(efa->e2->f & SELECT) totsel++;
- if(efa->e3->f & SELECT) totsel++;
- if(efa->e4->f & SELECT) totsel++;
-
- if(totsel>1)
- break;
- view3d_project_float(curarea, efa->cent, vec, projectMat);
- dist= sqrt( (vec[0]-mval[0])*(vec[0]-mval[0]) + (vec[1]-mval[1])*(vec[1]-mval[1]) );
- if(dist<mindist) {
- mindist= dist;
- sefa= efa;
- }
- }
- }
-
- if(efa) {
- error("Can't perform ripping with faces selected this way");
- return;
- }
- if(sefa==NULL) {
- error("No proper selection or faces included");
- return;
- }
-
-
- /* duplicate vertices, new vertices get selected */
- for(eve = em->verts.last; eve; eve= eve->prev) {
- eve->tmp.v = NULL;
- if(eve->f & SELECT) {
- eve->tmp.v = addvertlist(eve->co, eve);
- eve->f &= ~SELECT;
- eve->tmp.v->f |= SELECT;
- }
- }
-
- /* find the best candidate edge */
- /* or one of sefa edges is selected... */
- if(sefa->e1->f & SELECT) seed= sefa->e2;
- if(sefa->e2->f & SELECT) seed= sefa->e1;
- if(sefa->e3->f & SELECT) seed= sefa->e2;
- if(sefa->e4 && sefa->e4->f & SELECT) seed= sefa->e3;
-
- /* or we do the distance trick */
- if(seed==NULL) {
- mindist= 1000000.0f;
- if(sefa->e1->v1->tmp.v || sefa->e1->v2->tmp.v) {
- dist = mesh_rip_edgedist(projectMat,
- sefa->e1->v1->co,
- sefa->e1->v2->co, mval);
- if(dist<mindist) {
- seed= sefa->e1;
- mindist= dist;
- }
- }
- if(sefa->e2->v1->tmp.v || sefa->e2->v2->tmp.v) {
- dist = mesh_rip_edgedist(projectMat,
- sefa->e2->v1->co,
- sefa->e2->v2->co, mval);
- if(dist<mindist) {
- seed= sefa->e2;
- mindist= dist;
- }
- }
- if(sefa->e3->v1->tmp.v || sefa->e3->v2->tmp.v) {
- dist= mesh_rip_edgedist(projectMat,
- sefa->e3->v1->co,
- sefa->e3->v2->co, mval);
- if(dist<mindist) {
- seed= sefa->e3;
- mindist= dist;
- }
- }
- if(sefa->e4 && (sefa->e4->v1->tmp.v || sefa->e4->v2->tmp.v)) {
- dist= mesh_rip_edgedist(projectMat,
- sefa->e4->v1->co,
- sefa->e4->v2->co, mval);
- if(dist<mindist) {
- seed= sefa->e4;
- mindist= dist;
- }
- }
- }
-
- if(seed==NULL) { // never happens?
- error("No proper edge found to start");
- return;
- }
-
- faceloop_select(seed, 2); // tmp abuse for finding all edges that need duplicated, returns OK faces with f1
-
- /* duplicate edges in the loop, with at least 1 vertex selected, needed for selection flip */
- for(eed = em->edges.last; eed; eed= eed->prev) {
- eed->tmp.v = NULL;
- if((eed->v1->tmp.v) || (eed->v2->tmp.v)) {
- EditEdge *newed;
-
- newed= addedgelist(eed->v1->tmp.v?eed->v1->tmp.v:eed->v1,
- eed->v2->tmp.v?eed->v2->tmp.v:eed->v2, eed);
- if(eed->f & SELECT) {
- eed->f &= ~SELECT;
- newed->f |= SELECT;
- }
- eed->tmp.v = (EditVert *)newed;
- }
- }
-
- /* first clear edges to help finding neighbours */
- for(eed = em->edges.last; eed; eed= eed->prev) eed->f1= 0;
-
- /* put new vertices & edges && flag in best face */
- mesh_rip_setface(sefa);
-
- /* starting with neighbours of best face, we loop over the seam */
- sefa->f1= 2;
- doit= 1;
- while(doit) {
- doit= 0;
-
- for(efa= em->faces.first; efa; efa=efa->next) {
- /* new vert in face */
- if (efa->v1->tmp.v || efa->v2->tmp.v ||
- efa->v3->tmp.v || (efa->v4 && efa->v4->tmp.v)) {
- /* face is tagged with loop */
- if(efa->f1==1) {
- mesh_rip_setface(efa);
- efa->f1= 2;
- doit= 1;
- }
- }
- }
- }
-
- /* remove loose edges, that were part of a ripped face */
- for(eve = em->verts.first; eve; eve= eve->next) eve->f1= 0;
- for(eed = em->edges.last; eed; eed= eed->prev) eed->f1= 0;
- for(efa= em->faces.first; efa; efa=efa->next) {
- efa->e1->f1= 1;
- efa->e2->f1= 1;
- efa->e3->f1= 1;
- if(efa->e4) efa->e4->f1= 1;
- }
-
- for(eed = em->edges.last; eed; eed= seed) {
- seed= eed->prev;
- if(eed->f1==0) {
- if(eed->v1->tmp.v || eed->v2->tmp.v ||
- (eed->v1->f & SELECT) || (eed->v2->f & SELECT)) {
- remedge(eed);
- free_editedge(eed);
- eed= NULL;
- }
- }
- if(eed) {
- eed->v1->f1= 1;
- eed->v2->f1= 1;
- }
- }
-
- /* and remove loose selected vertices, that got duplicated accidentally */
- for(eve = em->verts.first; eve; eve= nextve) {
- nextve= eve->next;
- if(eve->f1==0 && (eve->tmp.v || (eve->f & SELECT))) {
- BLI_remlink(&em->verts,eve);
- free_editvert(eve);
- }
- }
-
- countall(); // apparently always needed when adding stuff, derived mesh
-
-#ifdef WITH_VERSE
- if(G.editMesh->vnode) {
- sync_all_verseverts_with_editverts((VNode*)G.editMesh->vnode);
- sync_all_versefaces_with_editfaces((VNode*)G.editMesh->vnode);
- }
-#endif
-
- BIF_TransformSetUndo("Rip");
- initTransform(TFM_TRANSLATION, 0);
- Transform();
-
- G.scene->prop_mode = propmode;
- G.scene->proportional = prop;
-}
-
-void shape_propagate(){
- EditMesh *em = G.editMesh;
- EditVert *ev = NULL;
- Mesh* me = (Mesh*)G.obedit->data;
- Key* ky = NULL;
- KeyBlock* kb = NULL;
- Base* base=NULL;
-
-
- if(me->key){
- ky = me->key;
- } else {
- error("Object Has No Key");
- return;
- }
-
- if(ky->block.first){
- for(ev = em->verts.first; ev ; ev = ev->next){
- if(ev->f & SELECT){
- for(kb=ky->block.first;kb;kb = kb->next){
- float *data;
- data = kb->data;
- VECCOPY(data+(ev->keyindex*3),ev->co);
- }
- }
- }
- } else {
- error("Object Has No Blendshapes");
- return;
- }
-
- //TAG Mesh Objects that share this data
- for(base = G.scene->base.first; base; base = base->next){
- if(base->object && base->object->data == me){
- base->object->recalc = OB_RECALC_DATA;
- }
- }
-
- BIF_undo_push("Propagate Blendshape Verts");
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- return;
-}
-
-void shape_copy_from_lerp(KeyBlock* thisBlock, KeyBlock* fromBlock)
-{
- EditMesh *em = G.editMesh;
- EditVert *ev = NULL;
- short mval[2], curval[2], event = 0, finished = 0, canceled = 0, fullcopy=0 ;
- float perc = 0;
- char str[64];
- float *data, *odata;
-
- data = fromBlock->data;
- odata = thisBlock->data;
-
- getmouseco_areawin(mval);
- curval[0] = mval[0] + 1; curval[1] = mval[1] + 1;
-
- while (finished == 0)
- {
- getmouseco_areawin(mval);
- if (mval[0] != curval[0] || mval[1] != curval[1])
- {
-
- if(mval[0] > curval[0])
- perc += 0.1;
- else if(mval[0] < curval[0])
- perc -= 0.1;
-
- if(perc < 0) perc = 0;
- if(perc > 1) perc = 1;
-
- curval[0] = mval[0];
- curval[1] = mval[1];
-
- if(fullcopy == 1){
- perc = 1;
- }
-
- for(ev = em->verts.first; ev ; ev = ev->next){
- if(ev->f & SELECT){
- VecLerpf(ev->co,odata+(ev->keyindex*3),data+(ev->keyindex*3),perc);
- }
- }
- sprintf(str,"Blending at %d%c MMB to Copy at 100%c",(int)(perc*100),'%','%');
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- headerprint(str);
- force_draw(0);
-
- if(fullcopy == 1){
- break;
- }
-
- } else {
- PIL_sleep_ms(10);
- }
-
- while(qtest()) {
- short val=0;
- event= extern_qread(&val);
- if(val){
- if(ELEM3(event, PADENTER, LEFTMOUSE, RETKEY)){
- finished = 1;
- }
- else if (event == MIDDLEMOUSE){
- fullcopy = 1;
- }
- else if (ELEM3(event,ESCKEY,RIGHTMOUSE,RIGHTMOUSE)){
- canceled = 1;
- finished = 1;
- }
- }
- }
- }
- if(!canceled)
- BIF_undo_push("Copy Blendshape Verts");
- else
- for(ev = em->verts.first; ev ; ev = ev->next){
- if(ev->f & SELECT){
- VECCOPY(ev->co, odata+(ev->keyindex*3));
- }
- }
- return;
-}
-
-
-
-void shape_copy_select_from()
-{
- Mesh* me = (Mesh*)G.obedit->data;
- EditMesh *em = G.editMesh;
- EditVert *ev = NULL;
- int totverts = 0,curshape = G.obedit->shapenr;
-
- Key* ky = NULL;
- KeyBlock *kb = NULL,*thisBlock = NULL;
- int maxlen=32, nr=0, a=0;
- char *menu;
-
- if(me->key){
- ky = me->key;
- } else {
- error("Object Has No Key");
- return;
- }
-
- if(ky->block.first){
- for(kb=ky->block.first;kb;kb = kb->next){
- maxlen += 40; // Size of a block name
- if(a == curshape-1){
- thisBlock = kb;
- }
-
- a++;
- }
- a=0;
- menu = MEM_callocN(maxlen, "Copy Shape Menu Text");
- strcpy(menu, "Copy Vert Positions from Shape %t|");
- for(kb=ky->block.first;kb;kb = kb->next){
- if(a != curshape-1){
- sprintf(menu,"%s %s %cx%d|",menu,kb->name,'%',a);
- }
- a++;
- }
- nr = pupmenu_col(menu, 20);
- MEM_freeN(menu);
- } else {
- error("Object Has No Blendshapes");
- return;
- }
-
- a = 0;
-
- for(kb=ky->block.first;kb;kb = kb->next){
- if(a == nr){
-
- for(ev = em->verts.first;ev;ev = ev->next){
- totverts++;
- }
-
- if(me->totvert != totverts){
- error("Shape Has had Verts Added/Removed, please cycle editmode before copying");
- return;
- }
- shape_copy_from_lerp(thisBlock,kb);
-
- return;
- }
- a++;
- }
- return;
-}
-
-/* Collection Routines|Currently used by the improved merge code*/
-/* buildEdge_collection() creates a list of lists*/
-/* these lists are filled with edges that are topologically connected.*/
-/* This whole tool needs to be redone, its rather poorly implemented...*/
-
-typedef struct Collection{
- struct Collection *next, *prev;
- int index;
- ListBase collectionbase;
-} Collection;
-
-typedef struct CollectedEdge{
- struct CollectedEdge *next, *prev;
- EditEdge *eed;
-} CollectedEdge;
-
-#define MERGELIMIT 0.000001
-
-static void build_edgecollection(ListBase *allcollections)
-{
- EditEdge *eed;
- Collection *edgecollection, *newcollection;
- CollectedEdge *newedge;
-
- int currtag = 1;
- short ebalanced = 0;
- short collectionfound = 0;
-
- for (eed=G.editMesh->edges.first; eed; eed = eed->next){
- eed->tmp.l = 0;
- eed->v1->tmp.l = 0;
- eed->v2->tmp.l = 0;
- }
-
- /*1st pass*/
- for(eed=G.editMesh->edges.first; eed; eed=eed->next){
- if(eed->f&SELECT){
- eed->v1->tmp.l = currtag;
- eed->v2->tmp.l = currtag;
- currtag +=1;
- }
- }
-
- /*2nd pass - Brute force. Loop through selected faces until there are no 'unbalanced' edges left (those with both vertices 'tmp.l' tag matching */
- while(ebalanced == 0){
- ebalanced = 1;
- for(eed=G.editMesh->edges.first; eed; eed = eed->next){
- if(eed->f&SELECT){
- if(eed->v1->tmp.l != eed->v2->tmp.l) /*unbalanced*/{
- if(eed->v1->tmp.l > eed->v2->tmp.l && eed->v2->tmp.l !=0) eed->v1->tmp.l = eed->v2->tmp.l;
- else if(eed->v1 != 0) eed->v2->tmp.l = eed->v1->tmp.l;
- ebalanced = 0;
- }
- }
- }
- }
-
- /*3rd pass, set all the edge flags (unnessecary?)*/
- for(eed=G.editMesh->edges.first; eed; eed = eed->next){
- if(eed->f&SELECT) eed->tmp.l = eed->v1->tmp.l;
- }
-
- for(eed=G.editMesh->edges.first; eed; eed=eed->next){
- if(eed->f&SELECT){
- if(allcollections->first){
- for(edgecollection = allcollections->first; edgecollection; edgecollection=edgecollection->next){
- if(edgecollection->index == eed->tmp.l){
- newedge = MEM_mallocN(sizeof(CollectedEdge), "collected edge");
- newedge->eed = eed;
- BLI_addtail(&(edgecollection->collectionbase), newedge);
- collectionfound = 1;
- break;
- }
- else collectionfound = 0;
- }
- }
- if(allcollections->first == NULL || collectionfound == 0){
- newcollection = MEM_mallocN(sizeof(Collection), "element collection");
- newcollection->index = eed->tmp.l;
- newcollection->collectionbase.first = 0;
- newcollection->collectionbase.last = 0;
-
- newedge = MEM_mallocN(sizeof(CollectedEdge), "collected edge");
- newedge->eed = eed;
-
- BLI_addtail(&(newcollection->collectionbase), newedge);
- BLI_addtail(allcollections, newcollection);
- }
- }
-
- }
-}
-
-static void freecollections(ListBase *allcollections)
-{
- struct Collection *curcollection;
-
- for(curcollection = allcollections->first; curcollection; curcollection = curcollection->next)
- BLI_freelistN(&(curcollection->collectionbase));
- BLI_freelistN(allcollections);
-}
-
-/*Begin UV Edge Collapse Code
- Like Edge subdivide, Edge Collapse should handle UV's intelligently, but since UV's are a per-face attribute, normal edge collapse will fail
- in areas such as the boundries of 'UV islands'. So for each edge collection we need to build a set of 'welded' UV vertices and edges for it.
- The welded UV edges can then be sorted and collapsed.
-*/
-typedef struct wUV{
- struct wUV *next, *prev;
- ListBase nodes;
- float u, v; /*cached copy of UV coordinates pointed to by nodes*/
- EditVert *eve;
- int f;
-} wUV;
-
-typedef struct wUVNode{
- struct wUVNode *next, *prev;
- float *u; /*pointer to original tface data*/
- float *v; /*pointer to original tface data*/
-} wUVNode;
-
-typedef struct wUVEdge{
- struct wUVEdge *next, *prev;
- float v1uv[2], v2uv[2]; /*nasty.*/
- struct wUV *v1, *v2; /*oriented same as editedge*/
- EditEdge *eed;
- int f;
-} wUVEdge;
-
-typedef struct wUVEdgeCollect{ /*used for grouping*/
- struct wUVEdgeCollect *next, *prev;
- wUVEdge *uved;
- int id;
-} wUVEdgeCollect;
-
-static void append_weldedUV(EditFace *efa, EditVert *eve, int tfindex, ListBase *uvverts)
-{
- wUV *curwvert, *newwvert;
- wUVNode *newnode;
- int found;
- MTFace *tf = CustomData_em_get(&G.editMesh->fdata, efa->data, CD_MTFACE);
-
- found = 0;
-
- for(curwvert=uvverts->first; curwvert; curwvert=curwvert->next){
- if(curwvert->eve == eve && curwvert->u == tf->uv[tfindex][0] && curwvert->v == tf->uv[tfindex][1]){
- newnode = MEM_callocN(sizeof(wUVNode), "Welded UV Vert Node");
- newnode->u = &(tf->uv[tfindex][0]);
- newnode->v = &(tf->uv[tfindex][1]);
- BLI_addtail(&(curwvert->nodes), newnode);
- found = 1;
- break;
- }
- }
-
- if(!found){
- newnode = MEM_callocN(sizeof(wUVNode), "Welded UV Vert Node");
- newnode->u = &(tf->uv[tfindex][0]);
- newnode->v = &(tf->uv[tfindex][1]);
-
- newwvert = MEM_callocN(sizeof(wUV), "Welded UV Vert");
- newwvert->u = *(newnode->u);
- newwvert->v = *(newnode->v);
- newwvert->eve = eve;
-
- BLI_addtail(&(newwvert->nodes), newnode);
- BLI_addtail(uvverts, newwvert);
-
- }
-}
-
-static void build_weldedUVs(ListBase *uvverts)
-{
- EditFace *efa;
- for(efa=G.editMesh->faces.first; efa; efa=efa->next){
- if(efa->v1->f1) append_weldedUV(efa, efa->v1, 0, uvverts);
- if(efa->v2->f1) append_weldedUV(efa, efa->v2, 1, uvverts);
- if(efa->v3->f1) append_weldedUV(efa, efa->v3, 2, uvverts);
- if(efa->v4 && efa->v4->f1) append_weldedUV(efa, efa->v4, 3, uvverts);
- }
-}
-
-static void append_weldedUVEdge(EditFace *efa, EditEdge *eed, ListBase *uvedges)
-{
- wUVEdge *curwedge, *newwedge;
- int v1tfindex, v2tfindex, found;
- MTFace *tf = CustomData_em_get(&G.editMesh->fdata, efa->data, CD_MTFACE);
-
- found = 0;
-
- if(eed->v1 == efa->v1) v1tfindex = 0;
- else if(eed->v1 == efa->v2) v1tfindex = 1;
- else if(eed->v1 == efa->v3) v1tfindex = 2;
- else /* if(eed->v1 == efa->v4) */ v1tfindex = 3;
-
- if(eed->v2 == efa->v1) v2tfindex = 0;
- else if(eed->v2 == efa->v2) v2tfindex = 1;
- else if(eed->v2 == efa->v3) v2tfindex = 2;
- else /* if(eed->v2 == efa->v4) */ v2tfindex = 3;
-
- for(curwedge=uvedges->first; curwedge; curwedge=curwedge->next){
- if(curwedge->eed == eed && curwedge->v1uv[0] == tf->uv[v1tfindex][0] && curwedge->v1uv[1] == tf->uv[v1tfindex][1] && curwedge->v2uv[0] == tf->uv[v2tfindex][0] && curwedge->v2uv[1] == tf->uv[v2tfindex][1]){
- found = 1;
- break; //do nothing, we don't need another welded uv edge
- }
- }
-
- if(!found){
- newwedge = MEM_callocN(sizeof(wUVEdge), "Welded UV Edge");
- newwedge->v1uv[0] = tf->uv[v1tfindex][0];
- newwedge->v1uv[1] = tf->uv[v1tfindex][1];
- newwedge->v2uv[0] = tf->uv[v2tfindex][0];
- newwedge->v2uv[1] = tf->uv[v2tfindex][1];
- newwedge->eed = eed;
-
- BLI_addtail(uvedges, newwedge);
- }
-}
-
-static void build_weldedUVEdges(ListBase *uvedges, ListBase *uvverts)
-{
- wUV *curwvert;
- wUVEdge *curwedge;
- EditFace *efa;
-
- for(efa=G.editMesh->faces.first; efa; efa=efa->next){
- if(efa->e1->f1) append_weldedUVEdge(efa, efa->e1, uvedges);
- if(efa->e2->f1) append_weldedUVEdge(efa, efa->e2, uvedges);
- if(efa->e3->f1) append_weldedUVEdge(efa, efa->e3, uvedges);
- if(efa->e4 && efa->e4->f1) append_weldedUVEdge(efa, efa->e4, uvedges);
- }
-
-
- //link vertices: for each uvedge, search uvverts to populate v1 and v2 pointers
- for(curwedge=uvedges->first; curwedge; curwedge=curwedge->next){
- for(curwvert=uvverts->first; curwvert; curwvert=curwvert->next){
- if(curwedge->eed->v1 == curwvert->eve && curwedge->v1uv[0] == curwvert->u && curwedge->v1uv[1] == curwvert->v){
- curwedge->v1 = curwvert;
- break;
- }
- }
- for(curwvert=uvverts->first; curwvert; curwvert=curwvert->next){
- if(curwedge->eed->v2 == curwvert->eve && curwedge->v2uv[0] == curwvert->u && curwedge->v2uv[1] == curwvert->v){
- curwedge->v2 = curwvert;
- break;
- }
- }
- }
-}
-
-static void free_weldedUVs(ListBase *uvverts)
-{
- wUV *curwvert;
- for(curwvert = uvverts->first; curwvert; curwvert=curwvert->next) BLI_freelistN(&(curwvert->nodes));
- BLI_freelistN(uvverts);
-}
-
-static void collapse_edgeuvs(void)
-{
- ListBase uvedges, uvverts, allcollections;
- wUVEdge *curwedge;
- wUVNode *curwnode;
- wUVEdgeCollect *collectedwuve, *newcollectedwuve;
- Collection *wuvecollection, *newcollection;
- int curtag, balanced, collectionfound= 0, vcount;
- float avg[2];
-
- if (!EM_texFaceCheck())
- return;
-
- uvverts.first = uvverts.last = uvedges.first = uvedges.last = allcollections.first = allcollections.last = NULL;
-
- build_weldedUVs(&uvverts);
- build_weldedUVEdges(&uvedges, &uvverts);
-
- curtag = 0;
-
- for(curwedge=uvedges.first; curwedge; curwedge=curwedge->next){
- curwedge->v1->f = curtag;
- curwedge->v2->f = curtag;
- curtag +=1;
- }
-
- balanced = 0;
- while(!balanced){
- balanced = 1;
- for(curwedge=uvedges.first; curwedge; curwedge=curwedge->next){
- if(curwedge->v1->f != curwedge->v2->f){
- if(curwedge->v1->f > curwedge->v2->f) curwedge->v1->f = curwedge->v2->f;
- else curwedge->v2->f = curwedge->v1->f;
- balanced = 0;
- }
- }
- }
-
- for(curwedge=uvedges.first; curwedge; curwedge=curwedge->next) curwedge->f = curwedge->v1->f;
-
-
- for(curwedge=uvedges.first; curwedge; curwedge=curwedge->next){
- if(allcollections.first){
- for(wuvecollection = allcollections.first; wuvecollection; wuvecollection=wuvecollection->next){
- if(wuvecollection->index == curwedge->f){
- newcollectedwuve = MEM_callocN(sizeof(wUVEdgeCollect), "Collected Welded UV Edge");
- newcollectedwuve->uved = curwedge;
- BLI_addtail(&(wuvecollection->collectionbase), newcollectedwuve);
- collectionfound = 1;
- break;
- }
-
- else collectionfound = 0;
- }
- }
- if(allcollections.first == NULL || collectionfound == 0){
- newcollection = MEM_callocN(sizeof(Collection), "element collection");
- newcollection->index = curwedge->f;
- newcollection->collectionbase.first = 0;
- newcollection->collectionbase.last = 0;
-
- newcollectedwuve = MEM_callocN(sizeof(wUVEdgeCollect), "Collected Welded UV Edge");
- newcollectedwuve->uved = curwedge;
-
- BLI_addtail(&(newcollection->collectionbase), newcollectedwuve);
- BLI_addtail(&allcollections, newcollection);
- }
- }
-
- for(wuvecollection=allcollections.first; wuvecollection; wuvecollection=wuvecollection->next){
-
- vcount = avg[0] = avg[1] = 0;
-
- for(collectedwuve= wuvecollection->collectionbase.first; collectedwuve; collectedwuve = collectedwuve->next){
- avg[0] += collectedwuve->uved->v1uv[0];
- avg[1] += collectedwuve->uved->v1uv[1];
-
- avg[0] += collectedwuve->uved->v2uv[0];
- avg[1] += collectedwuve->uved->v2uv[1];
-
- vcount +=2;
-
- }
-
- avg[0] /= vcount; avg[1] /= vcount;
-
- for(collectedwuve= wuvecollection->collectionbase.first; collectedwuve; collectedwuve = collectedwuve->next){
- for(curwnode=collectedwuve->uved->v1->nodes.first; curwnode; curwnode=curwnode->next){
- *(curwnode->u) = avg[0];
- *(curwnode->v) = avg[1];
- }
- for(curwnode=collectedwuve->uved->v2->nodes.first; curwnode; curwnode=curwnode->next){
- *(curwnode->u) = avg[0];
- *(curwnode->v) = avg[1];
- }
- }
- }
-
- free_weldedUVs(&uvverts);
- BLI_freelistN(&uvedges);
- freecollections(&allcollections);
-}
-
-/*End UV Edge collapse code*/
-
-static void collapseuvs(void)
-{
- EditFace *efa;
- MTFace *tf;
- int uvcount;
- float uvav[2];
-
- if (!EM_texFaceCheck())
- return;
-
- uvcount = 0;
- uvav[0] = 0;
- uvav[1] = 0;
-
- for(efa = G.editMesh->faces.first; efa; efa=efa->next){
- tf = CustomData_em_get(&G.editMesh->fdata, efa->data, CD_MTFACE);
-
- if(efa->v1->f1){
- uvav[0] += tf->uv[0][0];
- uvav[1] += tf->uv[0][1];
- uvcount += 1;
- }
- if(efa->v2->f1){
- uvav[0] += tf->uv[1][0];
- uvav[1] += tf->uv[1][1];
- uvcount += 1;
- }
- if(efa->v3->f1){
- uvav[0] += tf->uv[2][0];
- uvav[1] += tf->uv[2][1];
- uvcount += 1;
- }
- if(efa->v4 && efa->v4->f1){
- uvav[0] += tf->uv[3][0];
- uvav[1] += tf->uv[3][1];
- uvcount += 1;
- }
- }
-
- if(uvcount > 0) {
- uvav[0] /= uvcount;
- uvav[1] /= uvcount;
-
- for(efa = G.editMesh->faces.first; efa; efa=efa->next){
- tf = CustomData_em_get(&G.editMesh->fdata, efa->data, CD_MTFACE);
-
- if(efa->v1->f1){
- tf->uv[0][0] = uvav[0];
- tf->uv[0][1] = uvav[1];
- }
- if(efa->v2->f1){
- tf->uv[1][0] = uvav[0];
- tf->uv[1][1] = uvav[1];
- }
- if(efa->v3->f1){
- tf->uv[2][0] = uvav[0];
- tf->uv[2][1] = uvav[1];
- }
- if(efa->v4 && efa->v4->f1){
- tf->uv[3][0] = uvav[0];
- tf->uv[3][1] = uvav[1];
- }
- }
- }
-}
-
-int collapseEdges(void)
-{
- EditVert *eve;
- EditEdge *eed;
-
- ListBase allcollections;
- CollectedEdge *curredge;
- Collection *edgecollection;
-
- int totedges, groupcount, mergecount,vcount;
- float avgcount[3];
-
- allcollections.first = 0;
- allcollections.last = 0;
-
- mergecount = 0;
-
- if(multires_test()) return 0;
-
- build_edgecollection(&allcollections);
- groupcount = BLI_countlist(&allcollections);
-
-
- for(edgecollection = allcollections.first; edgecollection; edgecollection = edgecollection->next){
- totedges = BLI_countlist(&(edgecollection->collectionbase));
- mergecount += totedges;
- avgcount[0] = 0; avgcount[1] = 0; avgcount[2] = 0;
-
- vcount = 0;
-
- for(curredge = edgecollection->collectionbase.first; curredge; curredge = curredge->next){
- avgcount[0] += ((EditEdge*)curredge->eed)->v1->co[0];
- avgcount[1] += ((EditEdge*)curredge->eed)->v1->co[1];
- avgcount[2] += ((EditEdge*)curredge->eed)->v1->co[2];
-
- avgcount[0] += ((EditEdge*)curredge->eed)->v2->co[0];
- avgcount[1] += ((EditEdge*)curredge->eed)->v2->co[1];
- avgcount[2] += ((EditEdge*)curredge->eed)->v2->co[2];
-
- vcount +=2;
- }
-
- avgcount[0] /= vcount; avgcount[1] /=vcount; avgcount[2] /= vcount;
-
- for(curredge = edgecollection->collectionbase.first; curredge; curredge = curredge->next){
- VECCOPY(((EditEdge*)curredge->eed)->v1->co,avgcount);
- VECCOPY(((EditEdge*)curredge->eed)->v2->co,avgcount);
- }
-
- if (EM_texFaceCheck()) {
- /*uv collapse*/
- for(eve=G.editMesh->verts.first; eve; eve=eve->next) eve->f1 = 0;
- for(eed=G.editMesh->edges.first; eed; eed=eed->next) eed->f1 = 0;
- for(curredge = edgecollection->collectionbase.first; curredge; curredge = curredge->next){
- curredge->eed->v1->f1 = 1;
- curredge->eed->v2->f1 = 1;
- curredge->eed->f1 = 1;
- }
- collapse_edgeuvs();
- }
-
- }
- freecollections(&allcollections);
- removedoublesflag(1, 0, MERGELIMIT);
- /*get rid of this!*/
- countall();
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- if (EM_texFaceCheck())
- allqueue(REDRAWIMAGE, 0);
- return mergecount;
-}
-
-int merge_firstlast(int first, int uvmerge)
-{
- EditVert *eve,*mergevert;
- EditSelection *ese;
-
- if(multires_test()) return 0;
-
- /* do sanity check in mergemenu in edit.c ?*/
- if(first == 0){
- ese = G.editMesh->selected.last;
- mergevert= (EditVert*)ese->data;
- }
- else{
- ese = G.editMesh->selected.first;
- mergevert = (EditVert*)ese->data;
- }
-
- if(mergevert->f&SELECT){
- for (eve=G.editMesh->verts.first; eve; eve=eve->next){
- if (eve->f&SELECT)
- VECCOPY(eve->co,mergevert->co);
- }
- }
-
- if(uvmerge && CustomData_has_layer(&G.editMesh->fdata, CD_MTFACE)){
-
- for(eve=G.editMesh->verts.first; eve; eve=eve->next) eve->f1 = 0;
- for(eve=G.editMesh->verts.first; eve; eve=eve->next){
- if(eve->f&SELECT) eve->f1 = 1;
- }
- collapseuvs();
- }
-
- countall();
- return removedoublesflag(1, 0, MERGELIMIT);
-}
-
-int merge_target(int target, int uvmerge)
-{
- EditVert *eve;
-
- if(multires_test()) return 0;
-
- if(target) snap_sel_to_curs();
- else snap_to_center();
-
- if(uvmerge && CustomData_has_layer(&G.editMesh->fdata, CD_MTFACE)){
- for(eve=G.editMesh->verts.first; eve; eve=eve->next) eve->f1 = 0;
- for(eve=G.editMesh->verts.first; eve; eve=eve->next){
- if(eve->f&SELECT) eve->f1 = 1;
- }
- collapseuvs();
- }
-
- countall();
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- return removedoublesflag(1, 0, MERGELIMIT);
-
-}
-#undef MERGELIMIT
-
-typedef struct PathNode{
- int u;
- int visited;
- ListBase edges;
-} PathNode;
-
-typedef struct PathEdge{
- struct PathEdge *next, *prev;
- int v;
- float w;
-} PathEdge;
-
-void pathselect(void)
-{
- EditVert *eve, *s, *t;
- EditEdge *eed;
- EditSelection *ese;
- PathEdge *newpe, *currpe;
- PathNode *currpn;
- PathNode *Q;
- int v, *previous, pathvert, pnindex; /*pnindex redundant?*/
- int unbalanced, totnodes;
- short physical;
- float *cost;
- Heap *heap; /*binary heap for sorting pointers to PathNodes based upon a 'cost'*/
-
- s = t = NULL;
-
- countall(); /*paranoid?*/
-
- ese = ((EditSelection*)G.editMesh->selected.last);
- if(ese && ese->type == EDITVERT && ese->prev && ese->prev->type == EDITVERT){
- physical= pupmenu("Distance Method? %t|Edge Length%x1|Topological%x0");
-
- t = (EditVert*)ese->data;
- s = (EditVert*)ese->prev->data;
-
- /*need to find out if t is actually reachable by s....*/
- for(eve=G.editMesh->verts.first; eve; eve=eve->next){
- eve->f1 = 0;
- }
-
- s->f1 = 1;
-
- unbalanced = 1;
- totnodes = 1;
- while(unbalanced){
- unbalanced = 0;
- for(eed=G.editMesh->edges.first; eed; eed=eed->next){
- if(!eed->h){
- if(eed->v1->f1 && !eed->v2->f1){
- eed->v2->f1 = 1;
- totnodes++;
- unbalanced = 1;
- }
- else if(eed->v2->f1 && !eed->v1->f1){
- eed->v1->f1 = 1;
- totnodes++;
- unbalanced = 1;
- }
- }
- }
- }
-
-
-
- if(s->f1 && t->f1){ /*t can be reached by s*/
- Q = MEM_callocN(sizeof(PathNode)*totnodes, "Path Select Nodes");
- totnodes = 0;
- for(eve=G.editMesh->verts.first; eve; eve=eve->next){
- if(eve->f1){
- Q[totnodes].u = totnodes;
- Q[totnodes].edges.first = 0;
- Q[totnodes].edges.last = 0;
- Q[totnodes].visited = 0;
- eve->tmp.p = &(Q[totnodes]);
- totnodes++;
- }
- else eve->tmp.p = NULL;
- }
-
- for(eed=G.editMesh->edges.first; eed; eed=eed->next){
- if(!eed->h){
- if(eed->v1->f1){
- currpn = ((PathNode*)eed->v1->tmp.p);
-
- newpe = MEM_mallocN(sizeof(PathEdge), "Path Edge");
- newpe->v = ((PathNode*)eed->v2->tmp.p)->u;
- if(physical){
- newpe->w = VecLenf(eed->v1->co, eed->v2->co);
- }
- else newpe->w = 1;
- newpe->next = 0;
- newpe->prev = 0;
- BLI_addtail(&(currpn->edges), newpe);
- }
- if(eed->v2->f1){
- currpn = ((PathNode*)eed->v2->tmp.p);
- newpe = MEM_mallocN(sizeof(PathEdge), "Path Edge");
- newpe->v = ((PathNode*)eed->v1->tmp.p)->u;
- if(physical){
- newpe->w = VecLenf(eed->v1->co, eed->v2->co);
- }
- else newpe->w = 1;
- newpe->next = 0;
- newpe->prev = 0;
- BLI_addtail(&(currpn->edges), newpe);
- }
- }
- }
-
- heap = BLI_heap_new();
- cost = MEM_callocN(sizeof(float)*totnodes, "Path Select Costs");
- previous = MEM_callocN(sizeof(int)*totnodes, "PathNode indices");
-
- for(v=0; v < totnodes; v++){
- cost[v] = 1000000;
- previous[v] = -1; /*array of indices*/
- }
-
- pnindex = ((PathNode*)s->tmp.p)->u;
- cost[pnindex] = 0;
- BLI_heap_insert(heap, 0.0f, (void*)pnindex);
-
- while( !BLI_heap_empty(heap) ){
-
- pnindex = (int)BLI_heap_popmin(heap);
- currpn = &(Q[pnindex]);
-
- if(currpn == (PathNode*)t->tmp.p) /*target has been reached....*/
- break;
-
- for(currpe=currpn->edges.first; currpe; currpe=currpe->next){
- if(!Q[currpe->v].visited){
- if( cost[currpe->v] > (cost[currpn->u ] + currpe->w) ){
- cost[currpe->v] = cost[currpn->u] + currpe->w;
- previous[currpe->v] = currpn->u;
- Q[currpe->v].visited = 1;
- BLI_heap_insert(heap, cost[currpe->v], (void*)currpe->v);
- }
- }
- }
- }
-
- pathvert = ((PathNode*)t->tmp.p)->u;
- while(pathvert != -1){
- for(eve=G.editMesh->verts.first; eve; eve=eve->next){
- if(eve->f1){
- if( ((PathNode*)eve->tmp.p)->u == pathvert) eve->f |= SELECT;
- }
- }
- pathvert = previous[pathvert];
- }
-
- for(v=0; v < totnodes; v++) BLI_freelistN(&(Q[v].edges));
- MEM_freeN(Q);
- MEM_freeN(cost);
- MEM_freeN(previous);
- BLI_heap_free(heap, NULL);
- EM_select_flush();
- countall();
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- if (EM_texFaceCheck())
- allqueue(REDRAWIMAGE, 0);
- }
- }
- else{
- error("Path Selection requires that exactly two vertices be selected");
- return;
- }
-}
-
-void region_to_loop(void)
-{
- EditEdge *eed;
- EditFace *efa;
-
- if(G.totfacesel){
- for(eed=G.editMesh->edges.first; eed; eed=eed->next) eed->f1 = 0;
-
- for(efa=G.editMesh->faces.first; efa; efa=efa->next){
- if(efa->f&SELECT){
- efa->e1->f1++;
- efa->e2->f1++;
- efa->e3->f1++;
- if(efa->e4)
- efa->e4->f1++;
- }
- }
-
- EM_clear_flag_all(SELECT);
-
- for(eed=G.editMesh->edges.first; eed; eed=eed->next){
- if(eed->f1 == 1) EM_select_edge(eed, 1);
- }
-
- G.scene->selectmode = SCE_SELECT_EDGE;
- EM_selectmode_set();
- countall();
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- if (EM_texFaceCheck())
- allqueue(REDRAWIMAGE, 0);
- BIF_undo_push("Face Region to Edge Loop");
-
- }
-}
-
-static int validate_loop(Collection *edgecollection)
-{
- EditEdge *eed;
- EditFace *efa;
- CollectedEdge *curredge;
-
- /*1st test*/
- for(curredge = (CollectedEdge*)edgecollection->collectionbase.first; curredge; curredge=curredge->next){
- curredge->eed->v1->f1 = 0;
- curredge->eed->v2->f1 = 0;
- }
- for(curredge = (CollectedEdge*)edgecollection->collectionbase.first; curredge; curredge=curredge->next){
- curredge->eed->v1->f1++;
- curredge->eed->v2->f1++;
- }
- for(curredge = (CollectedEdge*)edgecollection->collectionbase.first; curredge; curredge=curredge->next){
- if(curredge->eed->v1->f1 > 2) return(0); else
- if(curredge->eed->v2->f1 > 2) return(0);
- }
-
- /*2nd test*/
- for(eed = G.editMesh->edges.first; eed; eed=eed->next) eed->f1 = 0;
- for(efa=G.editMesh->faces.first; efa; efa=efa->next){
- efa->e1->f1++;
- efa->e2->f1++;
- efa->e3->f1++;
- if(efa->e4) efa->e4->f1++;
- }
- for(curredge = (CollectedEdge*)edgecollection->collectionbase.first; curredge; curredge=curredge->next){
- if(curredge->eed->f1 > 2) return(0);
- }
- return(1);
-}
-
-static int loop_bisect(Collection *edgecollection){
-
- EditFace *efa, *sf1, *sf2;
- EditEdge *eed, *sed;
- CollectedEdge *curredge;
- int totsf1, totsf2, unbalanced,balancededges;
-
- for(eed=G.editMesh->edges.first; eed; eed=eed->next) eed->f1 = eed->f2 = 0;
- for(efa=G.editMesh->faces.first; efa; efa=efa->next) efa->f1 = 0;
-
- for(curredge = (CollectedEdge*)edgecollection->collectionbase.first; curredge; curredge=curredge->next) curredge->eed->f1 = 1;
-
- sf1 = sf2 = NULL;
- sed = ((CollectedEdge*)edgecollection->collectionbase.first)->eed;
-
- for(efa=G.editMesh->faces.first; efa; efa=efa->next){
- if(sf2) break;
- else if(sf1){
- if(efa->e1 == sed || efa->e2 == sed || efa->e3 == sed || ( (efa->e4) ? efa->e4 == sed : 0) ) sf2 = efa;
- }
- else{
- if(efa->e1 == sed || efa->e2 == sed || efa->e3 == sed || ( (efa->e4) ? efa->e4 == sed : 0) ) sf1 = efa;
- }
- }
-
- if(sf1==NULL || sf2==NULL)
- return(-1);
-
- if(!(sf1->e1->f1)) sf1->e1->f2 = 1;
- if(!(sf1->e2->f1)) sf1->e2->f2 = 1;
- if(!(sf1->e3->f1)) sf1->e3->f2 = 1;
- if(sf1->e4 && !(sf1->e4->f1)) sf1->e4->f2 = 1;
- sf1->f1 = 1;
- totsf1 = 1;
-
- if(!(sf2->e1->f1)) sf2->e1->f2 = 2;
- if(!(sf2->e2->f1)) sf2->e2->f2 = 2;
- if(!(sf2->e3->f1)) sf2->e3->f2 = 2;
- if(sf2->e4 && !(sf2->e4->f1)) sf2->e4->f2 = 2;
- sf2->f1 = 2;
- totsf2 = 1;
-
- /*do sf1*/
- unbalanced = 1;
- while(unbalanced){
- unbalanced = 0;
- for(efa=G.editMesh->faces.first; efa; efa=efa->next){
- balancededges = 0;
- if(efa->f1 == 0){
- if(efa->e1->f2 == 1 || efa->e2->f2 == 1 || efa->e3->f2 == 1 || ( (efa->e4) ? efa->e4->f2 == 1 : 0) ){
- balancededges += efa->e1->f2 = (efa->e1->f1) ? 0 : 1;
- balancededges += efa->e2->f2 = (efa->e2->f1) ? 0 : 1;
- balancededges += efa->e3->f2 = (efa->e3->f1) ? 0 : 1;
- if(efa->e4) balancededges += efa->e4->f2 = (efa->e4->f1) ? 0 : 1;
- if(balancededges){
- unbalanced = 1;
- efa->f1 = 1;
- totsf1++;
- }
- }
- }
- }
- }
-
- /*do sf2*/
- unbalanced = 1;
- while(unbalanced){
- unbalanced = 0;
- for(efa=G.editMesh->faces.first; efa; efa=efa->next){
- balancededges = 0;
- if(efa->f1 == 0){
- if(efa->e1->f2 == 2 || efa->e2->f2 == 2 || efa->e3->f2 == 2 || ( (efa->e4) ? efa->e4->f2 == 2 : 0) ){
- balancededges += efa->e1->f2 = (efa->e1->f1) ? 0 : 2;
- balancededges += efa->e2->f2 = (efa->e2->f1) ? 0 : 2;
- balancededges += efa->e3->f2 = (efa->e3->f1) ? 0 : 2;
- if(efa->e4) balancededges += efa->e4->f2 = (efa->e4->f1) ? 0 : 2;
- if(balancededges){
- unbalanced = 1;
- efa->f1 = 2;
- totsf2++;
- }
- }
- }
- }
- }
-
- if(totsf1 < totsf2) return(1);
- else return(2);
-}
-
-void loop_to_region(void)
-{
- EditFace *efa;
- ListBase allcollections={NULL,NULL};
- Collection *edgecollection;
- int testflag;
-
- build_edgecollection(&allcollections);
-
- for(edgecollection = (Collection *)allcollections.first; edgecollection; edgecollection=edgecollection->next){
- if(validate_loop(edgecollection)){
- testflag = loop_bisect(edgecollection);
- for(efa=G.editMesh->faces.first; efa; efa=efa->next){
- if(efa->f1 == testflag){
- if(efa->f&SELECT) EM_select_face(efa, 0);
- else EM_select_face(efa,1);
- }
- }
- }
- }
-
- for(efa=G.editMesh->faces.first; efa; efa=efa->next){ /*fix this*/
- if(efa->f&SELECT) EM_select_face(efa,1);
- }
-
- countall();
- freecollections(&allcollections);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- if (EM_texFaceCheck())
- allqueue(REDRAWIMAGE, 0);
- BIF_undo_push("Edge Loop to Face Region");
-}
-
-
-/* texface and vertex color editmode tools for the face menu */
-
-void mesh_rotate_uvs(void)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
- short change = 0, ccw;
- MTFace *tf;
- float u1, v1;
-
- if (!EM_texFaceCheck()) {
- error("mesh has no uv/image layers");
- return;
- }
-
- ccw = (G.qual == LR_SHIFTKEY);
-
- for(efa=em->faces.first; efa; efa=efa->next) {
- if (efa->f & SELECT) {
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- u1= tf->uv[0][0];
- v1= tf->uv[0][1];
-
- if (ccw) {
- if(efa->v4) {
- tf->uv[0][0]= tf->uv[3][0];
- tf->uv[0][1]= tf->uv[3][1];
-
- tf->uv[3][0]= tf->uv[2][0];
- tf->uv[3][1]= tf->uv[2][1];
- } else {
- tf->uv[0][0]= tf->uv[2][0];
- tf->uv[0][1]= tf->uv[2][1];
- }
-
- tf->uv[2][0]= tf->uv[1][0];
- tf->uv[2][1]= tf->uv[1][1];
-
- tf->uv[1][0]= u1;
- tf->uv[1][1]= v1;
- } else {
- tf->uv[0][0]= tf->uv[1][0];
- tf->uv[0][1]= tf->uv[1][1];
-
- tf->uv[1][0]= tf->uv[2][0];
- tf->uv[1][1]= tf->uv[2][1];
-
- if(efa->v4) {
- tf->uv[2][0]= tf->uv[3][0];
- tf->uv[2][1]= tf->uv[3][1];
-
- tf->uv[3][0]= u1;
- tf->uv[3][1]= v1;
- }
- else {
- tf->uv[2][0]= u1;
- tf->uv[2][1]= v1;
- }
- }
- change = 1;
- }
- }
-
- if (change) {
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- BIF_undo_push("Rotate UV face");
- }
-}
-
-void mesh_mirror_uvs(void)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
- short change = 0;
- MTFace *tf;
- float u1, v1;
-
- if (!EM_texFaceCheck()) {
- error("mesh has no uv/image layers");
- return;
- }
-
- for(efa=em->faces.first; efa; efa=efa->next) {
- if (efa->f & SELECT) {
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- u1= tf->uv[0][0];
- v1= tf->uv[0][1];
- if(efa->v4) {
- tf->uv[0][0]= tf->uv[3][0];
- tf->uv[0][1]= tf->uv[3][1];
-
- tf->uv[3][0]= u1;
- tf->uv[3][1]= v1;
-
- u1= tf->uv[1][0];
- v1= tf->uv[1][1];
-
- tf->uv[1][0]= tf->uv[2][0];
- tf->uv[1][1]= tf->uv[2][1];
-
- tf->uv[2][0]= u1;
- tf->uv[2][1]= v1;
- }
- else {
- tf->uv[0][0]= tf->uv[2][0];
- tf->uv[0][1]= tf->uv[2][1];
- tf->uv[2][0]= u1;
- tf->uv[2][1]= v1;
- }
- change = 1;
- }
- }
-
- if (change) {
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- BIF_undo_push("Mirror UV face");
- }
-}
-
-void mesh_rotate_colors(void)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
- short change = 0, ccw;
- MCol tmpcol, *mcol;
- if (!EM_vertColorCheck()) {
- error("mesh has no color layers");
- return;
- }
-
- ccw = (G.qual == LR_SHIFTKEY);
-
- for(efa=em->faces.first; efa; efa=efa->next) {
- if (efa->f & SELECT) {
- mcol = CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
- tmpcol= mcol[0];
-
- if (ccw) {
- if(efa->v4) {
- mcol[0]= mcol[3];
- mcol[3]= mcol[2];
- } else {
- mcol[0]= mcol[2];
- }
- mcol[2]= mcol[1];
- mcol[1]= tmpcol;
- } else {
- mcol[0]= mcol[1];
- mcol[1]= mcol[2];
-
- if(efa->v4) {
- mcol[2]= mcol[3];
- mcol[3]= tmpcol;
- }
- else
- mcol[2]= tmpcol;
- }
- change = 1;
- }
- }
-
- if (change) {
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- BIF_undo_push("Rotate Color face");
- }
-}
-
-void mesh_mirror_colors(void)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
- short change = 0;
- MCol tmpcol, *mcol;
- if (!EM_vertColorCheck()) {
- error("mesh has no color layers");
- return;
- }
-
- for(efa=em->faces.first; efa; efa=efa->next) {
- if (efa->f & SELECT) {
- mcol = CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
- tmpcol= mcol[0];
-
- mcol[0]= mcol[1];
- mcol[1]= mcol[2];
-
- if(efa->v4) {
- mcol[2]= mcol[3];
- mcol[3]= tmpcol;
- }
- else {
- mcol[2]= tmpcol;
- }
- change = 1;
- }
- }
-
- if (change) {
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- BIF_undo_push("Mirror Color face");
- }
-}
diff --git a/source/blender/src/editmode_undo.c b/source/blender/src/editmode_undo.c
deleted file mode 100644
index 22a399ae1e2..00000000000
--- a/source/blender/src/editmode_undo.c
+++ /dev/null
@@ -1,348 +0,0 @@
-/**
- * $Id:
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_object_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_userdef_types.h"
-
-#include "BKE_depsgraph.h"
-#include "BKE_global.h"
-#include "BKE_object.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_dynstr.h"
-
-#include "BKE_utildefines.h"
-
-#include "BIF_editmesh.h"
-#include "BIF_interface.h"
-#include "BIF_screen.h"
-#include "BIF_resources.h"
-#include "BIF_toolbox.h"
-#include "BIF_space.h"
-
-#include "BDR_editcurve.h"
-
-#include "BSE_edit.h"
-
-#include "mydevice.h"
-
-/* ***************** generic editmode undo system ********************* */
-/*
-
-Add this in your local code:
-
-void undo_editmode_push(char *name,
- void (*freedata)(void *), // pointer to function freeing data
- void (*to_editmode)(void *), // data to editmode conversion
- void * (*from_editmode)(void)) // editmode to data conversion
-
-
-Further exported for UI is:
-
-void undo_editmode_step(int step); // undo and redo
-void undo_editmode_clear(void) // free & clear all data
-void undo_editmode_menu(void) // history menu
-
-
-*/
-/* ********************************************************************* */
-
-/* local prototypes --------------- */
- void undo_editmode_step(int step); // undo and redo
- void undo_editmode_clear(void); // free & clear all data
- void undo_editmode_menu(void); // history menu
- void undo_editmode_push(char *name, void (*freedata)(void *),
- void (*to_editmode)(void *), void *(*from_editmode)(void));
- struct uiBlock *editmode_undohistorymenu(void *arg_unused);
-
-
-
-#define MAXUNDONAME 64
-typedef struct UndoElem {
- struct UndoElem *next, *prev;
- ID id; // copy of editmode object ID
- Object *ob; // pointer to edited object
- int type; // type of edited object
- void *undodata;
- char name[MAXUNDONAME];
- void (*freedata)(void *);
- void (*to_editmode)(void *);
- void * (*from_editmode)(void);
-} UndoElem;
-
-static ListBase undobase={NULL, NULL};
-static UndoElem *curundo= NULL;
-
-
-/* ********************* xtern api calls ************* */
-
-static void undo_restore(UndoElem *undo)
-{
- if(undo) {
- waitcursor(1);
- undo->to_editmode(undo->undodata);
- waitcursor(0);
-
- countall();
- }
-}
-
-/* name can be a dynamic string */
-void undo_editmode_push(char *name, void (*freedata)(void *),
- void (*to_editmode)(void *), void *(*from_editmode)(void))
-{
- UndoElem *uel;
- int nr;
-
- /* at first here was code to prevent an "original" key to be insterted twice
- this was giving conflicts for example when mesh changed due to keys or apply */
-
- /* remove all undos after (also when curundo==NULL) */
- while(undobase.last != curundo) {
- uel= undobase.last;
- BLI_remlink(&undobase, uel);
- uel->freedata(uel->undodata);
- MEM_freeN(uel);
- }
-
- /* make new */
- curundo= uel= MEM_callocN(sizeof(UndoElem), "undo file");
- strncpy(uel->name, name, MAXUNDONAME-1);
- BLI_addtail(&undobase, uel);
-
- uel->freedata= freedata;
- uel->to_editmode= to_editmode;
- uel->from_editmode= from_editmode;
-
- /* and limit amount to the maximum */
- nr= 0;
- uel= undobase.last;
- while(uel) {
- nr++;
- if(nr==U.undosteps) break;
- uel= uel->prev;
- }
- if(uel) {
- while(undobase.first!=uel) {
- UndoElem *first= undobase.first;
- BLI_remlink(&undobase, first);
- first->freedata(first->undodata);
- MEM_freeN(first);
- }
- }
-
- /* copy */
- curundo->undodata= curundo->from_editmode();
- curundo->ob= G.obedit;
- curundo->id= G.obedit->id;
- curundo->type= G.obedit->type;
-}
-
-
-/* helper to remove clean other objects from undo stack */
-static void undo_clean_stack(void)
-{
- UndoElem *uel, *next;
- int mixed= 0;
-
- /* global undo changes pointers, so we also allow identical names */
- /* side effect: when deleting/renaming object and start editing new one with same name */
-
- uel= undobase.first;
- while(uel) {
- next= uel->next;
-
- /* for when objects are converted, renamed, or global undo changes pointers... */
- if(uel->type==G.obedit->type && strcmp(uel->id.name, G.obedit->id.name)==0) {
- uel->ob= G.obedit;
- }
- else {
- mixed= 1;
- BLI_remlink(&undobase, uel);
- uel->freedata(uel->undodata);
- MEM_freeN(uel);
- }
-
- uel= next;
- }
-
- if(mixed) curundo= undobase.last;
-}
-
-/* 1= an undo, -1 is a redo. we have to make sure 'curundo' remains at current situation */
-void undo_editmode_step(int step)
-{
-
- /* prevent undo to happen on wrong object, stack can be a mix */
- undo_clean_stack();
-
- if(step==0) {
- undo_restore(curundo);
- }
- else if(step==1) {
-
- if(curundo==NULL || curundo->prev==NULL) error("No more steps to undo");
- else {
- if(G.f & G_DEBUG) printf("undo %s\n", curundo->name);
- curundo= curundo->prev;
- undo_restore(curundo);
- }
- }
- else {
- /* curundo has to remain current situation! */
-
- if(curundo==NULL || curundo->next==NULL) error("No more steps to redo");
- else {
- undo_restore(curundo->next);
- curundo= curundo->next;
- if(G.f & G_DEBUG) printf("redo %s\n", curundo->name);
- }
- }
-
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 1);
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWIMAGE, 0);
-}
-
-void undo_editmode_clear(void)
-{
- UndoElem *uel;
-
- uel= undobase.first;
- while(uel) {
- uel->freedata(uel->undodata);
- uel= uel->next;
- }
- BLI_freelistN(&undobase);
- curundo= NULL;
-}
-
-/* based on index nr it does a restore */
-static void undo_number(int nr)
-{
- UndoElem *uel;
- int a=1;
-
- for(uel= undobase.first; uel; uel= uel->next, a++) {
- if(a==nr) break;
- }
- curundo= uel;
- undo_editmode_step(0);
-}
-
-/* ************** for interaction with menu/pullown */
-
-void undo_editmode_menu(void)
-{
- UndoElem *uel;
- DynStr *ds= BLI_dynstr_new();
- short event;
- char *menu;
-
- undo_clean_stack(); // removes other objects from it
-
- BLI_dynstr_append(ds, "Editmode Undo History %t");
-
- for(uel= undobase.first; uel; uel= uel->next) {
- BLI_dynstr_append(ds, "|");
- BLI_dynstr_append(ds, uel->name);
- }
-
- menu= BLI_dynstr_get_cstring(ds);
- BLI_dynstr_free(ds);
-
- event= pupmenu_col(menu, 20);
- MEM_freeN(menu);
-
- if(event>0) undo_number(event);
-}
-
-static void do_editmode_undohistorymenu(void *arg, int event)
-{
-
- if(G.obedit==NULL || event<1) return;
-
- if (event==1) {
- if(G.obedit->type==OB_MESH) remake_editMesh();
- }
- else undo_number(event-1);
-
- allqueue(REDRAWVIEW3D, 0);
-}
-
-uiBlock *editmode_undohistorymenu(void *arg_unused)
-{
- uiBlock *block;
- UndoElem *uel;
- short yco = 20, menuwidth = 120;
- short item=2;
-
- undo_clean_stack(); // removes other objects from it
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_mesh_undohistorymenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_editmode_undohistorymenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo All Changes", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
-
- for(uel= undobase.first; uel; uel= uel->next, item++) {
- if (uel==curundo) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, uel->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, (float)item, "");
- if (uel==curundo) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- }
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-void *undo_editmode_get_prev(Object *ob)
-{
- UndoElem *ue= undobase.last;
- if(ue && ue->prev && ue->prev->ob==ob) return ue->prev->undodata;
- return NULL;
-}
diff --git a/source/blender/src/editnla.c b/source/blender/src/editnla.c
deleted file mode 100644
index fc79c265f8d..00000000000
--- a/source/blender/src/editnla.c
+++ /dev/null
@@ -1,2054 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL *****
- *
- * This file is a horrible mess: An attmept to cram some
- * final functionality into blender before it is too late.
- *
- * Hopefully it can be tidied up at a later date...
-*/
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#include "PIL_time.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-
-#include "DNA_action_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_ipo_types.h"
-#include "DNA_object_types.h"
-#include "DNA_nla_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_userdef_types.h"
-
-#include "BKE_action.h"
-#include "BKE_blender.h"
-#include "BKE_depsgraph.h"
-#include "BKE_group.h"
-#include "BKE_global.h"
-#include "BKE_ipo.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
-#include "BKE_nla.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_screen.h"
-#include "BIF_interface.h"
-#include "BIF_butspace.h"
-#include "BIF_space.h"
-#include "BIF_mywindow.h"
-#include "BIF_editview.h"
-#include "BIF_toolbox.h"
-#include "BIF_editnla.h"
-#include "BIF_editaction.h"
-#include "BIF_transform.h"
-
-#include "BSE_editipo.h"
-#include "BSE_editnla_types.h"
-#include "BSE_headerbuttons.h"
-#include "BSE_drawipo.h"
-#include "BSE_editaction_types.h"
-#include "BSE_trans_types.h"
-#include "BSE_edit.h"
-#include "BSE_filesel.h"
-#include "BDR_editobject.h"
-#include "BSE_drawnla.h"
-#include "BSE_time.h"
-
-#include "blendef.h"
-#include "mydevice.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-/* Note: A lot of these pretty much duplicate the behaviour of the
-action windows. The functions should be shared, not copy-pasted */
-
-static void mouse_nla(int selectmode);
-static Base *get_nearest_nlachannel_ob_key (float *index, short *sel);
-static bAction *get_nearest_nlachannel_ac_key (float *index, short *sel);
-static Base *get_nearest_nlastrip (bActionStrip **rstrip, short *sel);
-static void mouse_nlachannels(short mval[2]);
-
-/* ******************** SPACE: NLA ********************** */
-
-void shift_nlastrips_up(void) {
-
- Base *base;
- bActionStrip *strip, *prevstrip;
-
- for (base=G.scene->base.first; base; base=base->next) {
- if (base->object->nlaflag & OB_NLA_COLLAPSED)
- continue;
-
- for (strip = base->object->nlastrips.first;
- strip; strip=strip->next){
- if (strip->flag & ACTSTRIP_SELECT) {
- if ( (prevstrip = strip->prev) ) {
- if (prevstrip->prev)
- prevstrip->prev->next = strip;
- if (strip->next)
- strip->next->prev = prevstrip;
- strip->prev = prevstrip->prev;
- prevstrip->next = strip->next;
- strip->next = prevstrip;
- prevstrip->prev = strip;
-
- if (prevstrip == base->object->nlastrips.first)
- base->object->nlastrips.first = strip;
- if (strip == base->object->nlastrips.last)
- base->object->nlastrips.last = prevstrip;
-
- strip = prevstrip;
- }
- else {
- break;
- }
- }
- }
- }
- BIF_undo_push("Shift NLA strip");
- allqueue (REDRAWNLA, 0);
-
-}
-
-void shift_nlastrips_down(void) {
-
- Base *base;
- bActionStrip *strip, *nextstrip;
-
- for (base=G.scene->base.first; base; base=base->next) {
- if (base->object->nlaflag & OB_NLA_COLLAPSED)
- continue;
-
- for (strip = base->object->nlastrips.last;
- strip; strip=strip->prev){
- if (strip->flag & ACTSTRIP_SELECT) {
- if ( (nextstrip = strip->next) ) {
- if (nextstrip->next)
- nextstrip->next->prev = strip;
- if (strip->prev)
- strip->prev->next = nextstrip;
- strip->next = nextstrip->next;
- nextstrip->prev = strip->prev;
- strip->prev = nextstrip;
- nextstrip->next = strip;
-
- if (nextstrip == base->object->nlastrips.last)
- base->object->nlastrips.last = strip;
- if (strip == base->object->nlastrips.first)
- base->object->nlastrips.first = nextstrip;
-
- strip = nextstrip;
- }
- else {
- break;
- }
- }
- }
- }
-
- BIF_undo_push("Shift NLA strips");
- allqueue (REDRAWNLA, 0);
-}
-
-void synchronize_action_strips(void)
-{
- Base *base;
- bActionStrip *strip;
-
- for (base=G.scene->base.first; base; base=base->next) {
- /* step 1: adjust strip-lengths */
- for (strip = base->object->nlastrips.last; strip; strip=strip->prev) {
- if (strip->flag & ACTSTRIP_LOCK_ACTION) {
- float actstart, actend;
-
- calc_action_range(strip->act, &actstart, &actend, 1);
-
- if ((strip->actstart!=actstart) || (strip->actend!=actend)) {
- float offset = strip->scale * (actstart - strip->actstart);
- float actlen = actend - actstart;
-
- strip->start += offset;
- strip->end = (strip->scale * strip->repeat * actlen) + strip->start;
-
- strip->actstart= actstart;
- strip->actend= actend;
- }
- }
- }
-
- /* step 2: adjust blendin/out values for each strip if option is turned on */
- for (strip= base->object->nlastrips.first; strip; strip=strip->next) {
- if (strip->flag & ACTSTRIP_AUTO_BLENDS) {
- bActionStrip *prev= strip->prev;
- bActionStrip *next= strip->next;
- float pr[2], nr[2];
-
- strip->blendin = 0.0f;
- strip->blendout = 0.0f;
-
- /* setup test ranges */
- if (prev && next) {
- /* init range for previous strip */
- pr[0]= prev->start;
- pr[1]= prev->end;
-
- /* init range for next strip */
- nr[0]= next->start;
- nr[1]= next->end;
- }
- else if (prev) {
- /* next strip's range is same as previous strip's range */
- pr[0] = nr[0] = prev->start;
- pr[1] = nr[1] = prev->end;
- }
- else if (next) {
- /* previous strip's range is same as next strip's range */
- pr[0] = nr[0] = next->start;
- pr[1] = nr[1] = next->end;
- }
- else {
- /* there shouldn't be any more strips to loop through for this operation */
- break;
- }
-
- /* test various cases */
- if ( IN_RANGE(pr[1], strip->start, strip->end) &&
- (IN_RANGE(pr[0], strip->start, strip->end)==0) )
- {
- /* previous strip intersects start of current */
-
- if ( IN_RANGE(nr[1], strip->start, strip->end) &&
- (IN_RANGE(nr[0], strip->start, strip->end)==0) )
- {
- /* next strip also intersects start of current */
- if (nr[1] < pr[1])
- strip->blendin= nr[1] - strip->start;
- else
- strip->blendin= pr[1] - strip->start;
- }
- else if (IN_RANGE(nr[0], strip->start, strip->end) &&
- (IN_RANGE(nr[1], strip->start, strip->end)==0))
- {
- /* next strip intersects end of current */
- strip->blendout= strip->end - nr[0];
- strip->blendin= pr[1] - strip->start;
- }
- else {
- /* only previous strip intersects current */
- strip->blendin= pr[1] - strip->start;
- }
- }
- else if (IN_RANGE(pr[0], strip->start, strip->end) &&
- (IN_RANGE(pr[1], strip->start, strip->end)==0) )
- {
- /* previous strip intersects end of current */
-
- if ( IN_RANGE(nr[0], strip->start, strip->end) &&
- (IN_RANGE(nr[1], strip->start, strip->end)==0) )
- {
- /* next strip also intersects end of current */
- if (nr[1] > pr[1])
- strip->blendout= strip->end - nr[0];
- else
- strip->blendout= strip->end - pr[0];
- }
- else if (IN_RANGE(nr[1], strip->start, strip->end) &&
- (IN_RANGE(nr[0], strip->start, strip->end)==0))
- {
- /* next strip intersects start of current */
- strip->blendin= nr[1] - strip->start;
- strip->blendout= strip->end - pr[0];
- }
- else {
- /* only previous strip intersects current */
- strip->blendout= strip->end - pr[0];
- }
- }
- else if (IN_RANGE(nr[1], strip->start, strip->end) &&
- (IN_RANGE(nr[0], strip->start, strip->end)==0) )
- {
- /* next strip intersects start of current */
-
- if ( IN_RANGE(pr[1], strip->start, strip->end) &&
- (IN_RANGE(pr[0], strip->start, strip->end)==0) )
- {
- /* previous strip also intersects start of current */
- if (pr[1] < nr[1])
- strip->blendin= pr[1] - strip->start;
- else
- strip->blendin= nr[1] - strip->start;
- }
- else if (IN_RANGE(pr[0], strip->start, strip->end) &&
- (IN_RANGE(pr[1], strip->start, strip->end)==0))
- {
- /* previous strip intersects end of current */
- strip->blendout= strip->end - pr[0];
- strip->blendin= nr[1] - strip->start;
- }
- else {
- /* only next strip intersects current */
- strip->blendin= nr[1] - strip->start;
- }
- }
- else if (IN_RANGE(nr[0], strip->start, strip->end) &&
- (IN_RANGE(nr[1], strip->start, strip->end)==0) )
- {
- /* next strip intersects end of current */
-
- if ( IN_RANGE(pr[0], strip->start, strip->end) &&
- (IN_RANGE(pr[1], strip->start, strip->end)==0) )
- {
- /* previous strip also intersects end of current */
- if (pr[1] > nr[1])
- strip->blendout= strip->end - pr[0];
- else
- strip->blendout= strip->end - nr[0];
- }
- else if (IN_RANGE(pr[1], strip->start, strip->end) &&
- (IN_RANGE(pr[0], strip->start, strip->end)==0))
- {
- /* previous strip intersects start of current */
- strip->blendin= pr[1] - strip->start;
- strip->blendout= strip->end - nr[0];
- }
- else {
- /* only next strip intersects current */
- strip->blendout= strip->end - nr[0];
- }
- }
-
- /* make sure blending stays in ranges */
- CLAMP(strip->blendin, 0, (strip->end-strip->start));
- CLAMP(strip->blendout, 0, (strip->end-strip->start));
- }
- }
- }
-
-}
-
-void reset_action_strips(int val)
-{
- Base *base;
- bActionStrip *strip;
-
- for (base=G.scene->base.first; base; base=base->next) {
- if (base->object->nlaflag & OB_NLA_COLLAPSED)
- continue;
-
- for (strip = base->object->nlastrips.last; strip; strip=strip->prev) {
- if (strip->flag & ACTSTRIP_SELECT) {
- switch (val) {
- case 1:
- {
- /* clear scaling - reset to 1.0 without touching keys */
- float actlen= (strip->actend - strip->actstart);
-
- strip->scale= 1.0f;
- strip->end= (strip->repeat * actlen) + strip->start;
- }
- break;
- case 2:
- {
- /* reset action-range */
- calc_action_range(strip->act, &strip->actstart, &strip->actend, 1);
- }
- break;
- case 3:
- {
- /* apply scale to keys - scale is reset to 1.0f, but keys stay at the same times */
- bActionChannel *achan;
-
- if (strip->act) {
- for (achan= strip->act->chanbase.first; achan; achan= achan->next) {
- actstrip_map_ipo_keys(base->object, achan->ipo, 0, 0);
- }
-
- /* now we can reset scale */
- calc_action_range(strip->act, &strip->actstart, &strip->actend, 1);
- strip->scale= 1.0f;
- strip->end = (strip->repeat * (strip->actend - strip->actstart)) + strip->start;
- }
- }
- break;
- }
- base->object->ctime= -1234567.0f; // evil!
- DAG_object_flush_update(G.scene, base->object, OB_RECALC_OB|OB_RECALC_DATA);
- }
- }
- }
- BIF_undo_push("Reset NLA strips");
- allqueue (REDRAWVIEW3D, 0);
- allqueue (REDRAWACTION, 0);
- allqueue (REDRAWNLA, 0);
-}
-
-void snap_action_strips(int snap_mode)
-{
- Base *base;
- bActionStrip *strip;
-
- for (base=G.scene->base.first; base; base=base->next) {
- /* object has ipo - these keyframes should be able to be snapped, even if strips are collapsed */
- if (base->object->ipo) {
- snap_ipo_keys(base->object->ipo, snap_mode);
- }
-
- /* object is collapsed - action and nla strips not shown/editable */
- if (base->object->nlaflag & OB_NLA_COLLAPSED)
- continue;
-
- /* snap action strips */
- for (strip = base->object->nlastrips.last; strip; strip=strip->prev) {
- if (strip->flag & ACTSTRIP_SELECT) {
- if (snap_mode==1) {
- /* nearest frame */
- strip->start= floor(strip->start+0.5);
- strip->end= floor(strip->end+0.5);
- }
- else if (snap_mode==2) {
- /* current frame */
- float diff;
- if (CFRA < strip->start) {
- diff = (strip->start - CFRA);
- strip->start -= diff;
- strip->end -= diff;
- }
- else {
- diff = (CFRA - strip->start);
- strip->start += diff;
- strip->end += diff;
- }
- }
- else if (snap_mode==3) {
- /* nearest second */
- float secf = FPS;
- strip->start= (float)(floor(strip->start/secf + 0.5f) * secf);
- strip->end= (float)(floor(strip->end/secf + 0.5f) * secf);
- }
- }
- }
-
- /* object has action */
- if (base->object->action) {
- ListBase act_data = {NULL, NULL};
- bActListElem *ale;
- int filter;
-
- /* filter action data */
- filter= (ACTFILTER_VISIBLE | ACTFILTER_FOREDIT | ACTFILTER_IPOKEYS);
- actdata_filter(&act_data, filter, base->object->action, ACTCONT_ACTION);
-
- /* snap to frame */
- for (ale= act_data.first; ale; ale= ale->next) {
- actstrip_map_ipo_keys(base->object, ale->key_data, 0, 1);
- snap_ipo_keys(ale->key_data, snap_mode);
- actstrip_map_ipo_keys(base->object, ale->key_data, 1, 1);
- }
- BLI_freelistN(&act_data);
-
- remake_action_ipos(base->object->action);
- }
- }
- BIF_undo_push("Snap NLA strips");
- allqueue (REDRAWVIEW3D, 0);
- allqueue (REMAKEIPO, 0);
- allqueue (REDRAWIPO, 0);
- allqueue (REDRAWACTION, 0);
- allqueue (REDRAWNLA, 0);
-}
-
-static void set_active_strip(Object *ob, bActionStrip *act)
-{
- bActionStrip *strip;
-
- for (strip = ob->nlastrips.first; strip; strip=strip->next)
- strip->flag &= ~ACTSTRIP_ACTIVE;
-
- if(act) {
- act->flag |= ACTSTRIP_ACTIVE;
-
- if(ob->action!=act->act) {
- if(ob->action) ob->action->id.us--;
- if(act->act->id.lib) {
- ob->action= NULL;
- }
- else {
- ob->action= act->act;
- id_us_plus(&ob->action->id);
- }
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- ob->ctime= -1234567.0f; // eveil!
- DAG_object_flush_update(G.scene, ob, OB_RECALC_OB|OB_RECALC_DATA);
- }
- }
-}
-
-void convert_nla(void)
-{
- bActionStrip *strip;
- Object *ob= OBACT;
- char str[128];
- short event;
-
- if ((ob==NULL)||(ob->action==NULL)) {
- error("Need active Object to convert Action to NLA Strip");
- return;
- }
-
- sprintf(str, "Convert Action%%t|%s to NLA Strip%%x1", ob->action->id.name+2);
- event = pupmenu(str);
-
- if (event==1) {
- if (ob->action) {
- deselect_nlachannel_keys(0);
- strip = convert_action_to_strip(ob); //creates a new NLA strip from the action in given object
- set_active_strip(ob, strip);
- BIF_undo_push("Convert NLA");
- allqueue (REDRAWNLA, 0);
- }
- }
-}
-
-static void add_nla_block(short event)
-{
- Object *ob= OBACT;
- bAction *act=NULL;
- bActionStrip *strip;
- int cur;
-
- if (event!=-1){
- for (cur = 1, act=G.main->action.first; act; act=act->id.next, cur++){
- if (cur==event){
- break;
- }
- }
- }
-
- /* Bail out if no action was chosen */
- if (!act){
- return;
- }
-
- /* Initialize the new action block */
- strip = MEM_callocN(sizeof(bActionStrip), "bActionStrip");
-
- deselect_nlachannel_keys(0);
-
- /* Link the action to the strip */
- strip->act = act;
- id_us_plus(&act->id);
- calc_action_range(strip->act, &strip->actstart, &strip->actend, 1);
- strip->start = G.scene->r.cfra; /* could be mval[0] another time... */
- strip->end = strip->start + (strip->actend-strip->actstart);
- /* simple prevention of zero strips */
- if(strip->start>strip->end-2)
- strip->end= strip->start+100;
- strip->repeat = 1.0;
-
- strip->flag = ACTSTRIP_SELECT|ACTSTRIP_LOCK_ACTION;
-
- find_stridechannel(ob, strip);
- set_active_strip(ob, strip);
- strip->object= group_get_member_with_action(ob->dup_group, act);
- if(strip->object)
- id_lib_extern(&strip->object->id); /* checks lib data, sets correct flag for saving then */
-
- if(ob->nlastrips.first == NULL)
- ob->nlaflag |= OB_NLA_OVERRIDE;
-
- BLI_addtail(&ob->nlastrips, strip);
-
- BIF_undo_push("Add NLA strip");
-}
-
-static void add_nla_block_by_name(char name[32], Object *ob, short hold, short add, float repeat)
-{
- bAction *act=NULL;
- bActionStrip *strip;
- int cur;
-
- if (name){
- for (cur = 1, act=G.main->action.first; act; act=act->id.next, cur++){
- if (strcmp(name,act->id.name)==0) {
- break;
- }
- }
- }
-
- /* Bail out if no action was chosen */
- if (!act){
- return;
- }
-
- /* Initialize the new action block */
- strip = MEM_callocN(sizeof(bActionStrip), "bActionStrip");
-
- deselect_nlachannel_keys(0);
-
- /* Link the action to the strip */
- strip->act = act;
- calc_action_range(strip->act, &strip->actstart, &strip->actend, 1);
- strip->start = G.scene->r.cfra; /* could be mval[0] another time... */
- strip->end = strip->start + (strip->actend-strip->actstart);
- /* simple prevention of zero strips */
- if(strip->start>strip->end-2)
- strip->end= strip->start+100;
-
- strip->flag = ACTSTRIP_SELECT|ACTSTRIP_LOCK_ACTION; //|ACTSTRIP_USEMATCH;
-
- if (hold==1)
- strip->flag = strip->flag|ACTSTRIP_HOLDLASTFRAME;
-
- if (add==1)
- strip->mode = ACTSTRIPMODE_ADD;
-
- find_stridechannel(ob, strip);
-
- set_active_strip(ob, strip);
-
- strip->repeat = repeat;
-
- act->id.us++;
-
- if(ob->nlastrips.first == NULL)
- ob->nlaflag |= OB_NLA_OVERRIDE;
-
- BLI_addtail(&ob->nlastrips, strip);
-}
-
-static void add_nla_databrowse_callback(unsigned short val)
-{
- /* val is not used, databrowse needs it to optional pass an event */
- short event;
-
- if(OBACT==NULL) return;
-
- event= G.snla->menunr; /* set by databrowse or pupmenu */
-
- add_nla_block(event);
-}
-
-/* Adds strip to to active Object */
-void add_nlablock(void)
-{
- Object *ob= OBACT;
- short event;
- short nr=0;
- char *str, title[64];
-
- if(ob==NULL) {
- error("Need active Object to add NLA strips");
- return;
- }
-
- sprintf(title, "Add Action strip to: %s", ob->id.name+2);
-
- /* Popup action menu */
- IDnames_to_pupstring(&str, title, NULL, &G.main->action, (ID *)G.scene, &nr);
-
- if(nr==-2) {
- MEM_freeN(str);
-
- activate_databrowse((ID *)NULL, ID_AC, 0, 0, &G.snla->menunr,
- add_nla_databrowse_callback );
-
- return;
- }
- else {
- event = pupmenu_col(str, 20);
- MEM_freeN(str);
- add_nla_block(event);
- }
-}
-
-/* Creates a new action, and makes a new actionstrip of that */
-void add_empty_nlablock(void)
-{
- Object *ob= OBACT;
- bAction *act= NULL;
- bActionStrip *strip;
-
- /* check for active object first - will add strip to active object */
- if (ob == NULL)
- return;
-
- /* make new action */
- if ((ob->type == OB_ARMATURE) && (ob->flag & OB_POSEMODE))
- act= add_empty_action("ObAction");
- else
- act= add_empty_action("Action");
-
- /* make a new strip for it */
- add_nla_block_by_name(act->id.name, ob, 0, 1, 1.0f);
- strip= ob->nlastrips.last;
-
- /* change some settings of the strip - try to avoid bad scaling */
- if ((EFRA-CFRA) < 100) {
- strip->flag |= ACTSTRIP_AUTO_BLENDS;
- strip->flag &= ~ACTSTRIP_LOCK_ACTION;
- strip->actstart = CFRA;
- strip->actend = CFRA + 100;
-
- strip->start = CFRA;
- strip->end = CFRA + 100;
- }
- else {
- strip->flag |= ACTSTRIP_AUTO_BLENDS;
- strip->flag &= ~ACTSTRIP_LOCK_ACTION;
- strip->actstart = CFRA;
- strip->actend = EFRA;
-
- strip->start = CFRA;
- strip->end = EFRA;
- }
-
- BIF_undo_push("Add NLA strip");
-}
-
-/* Adds strip to to active Object */
-static void relink_active_strip(void)
-{
- Object *ob= OBACT;
- bActionStrip *strip;
- bAction *act;
- short event;
- short cur;
- char *str;
-
- if(ob==NULL) return;
- if(ob->nlaflag & OB_NLA_COLLAPSED) return;
-
- for (strip = ob->nlastrips.first; strip; strip=strip->next)
- if(strip->flag & ACTSTRIP_ACTIVE)
- break;
-
- if(strip==NULL) return;
-
- /* Popup action menu */
- IDnames_to_pupstring(&str, "Relink Action strip", NULL, &G.main->action, (ID *)G.scene, NULL);
- if(str) {
- event = pupmenu_col(str, 20);
- MEM_freeN(str);
-
- for (cur = 1, act=G.main->action.first; act; act=act->id.next, cur++){
- if (cur==event){
- break;
- }
- }
-
- if(act) {
- if(strip->act) strip->act->id.us--;
- strip->act = act;
- id_us_plus(&act->id);
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- }
- }
-}
-
-
-
-/* Left hand side of channels display, selects objects */
-static void mouse_nlachannels(short mval[2])
-{
- bActionStrip *strip= NULL;
- Base *base;
- Object *ob=NULL;
- float x,y;
- int click, obclick=0, actclick=0;
- int wsize;
-
- wsize = (count_nla_levels ()*(NLACHANNELHEIGHT+NLACHANNELSKIP));
- wsize+= NLACHANNELHEIGHT/2;
-
- areamouseco_to_ipoco(G.v2d, mval, &x, &y);
- click = (int)floor( ((float)wsize - y) / (NLACHANNELHEIGHT+NLACHANNELSKIP));
-
- if (click<0)
- return;
-
- for (base = G.scene->base.first; base; base=base->next){
- if (nla_filter(base)) {
- ob= base->object;
-
- /* See if this is a base selected */
- if (click==0) {
- obclick= 1;
- break;
- }
- click--;
-
- /* see if any strips under object */
- if ((ob->nlaflag & OB_NLA_COLLAPSED)==0) {
- /* See if this is an action */
- if (ob->action){
- if (click==0) {
- actclick= 1;
- break;
- }
- click--;
- }
-
- /* See if this is an nla strip */
- if(ob->nlastrips.first) {
- for (strip = ob->nlastrips.first; strip; strip=strip->next){
- if (click==0) break;
- click--;
- }
- if (strip && click==0) break;
- }
- }
- }
- }
-
- if (!base)
- return;
-
- /* Handle object strip selection */
- if (G.qual & LR_SHIFTKEY) {
- if (base->flag & SELECT) base->flag &= ~SELECT;
- else base->flag |= SELECT;
- }
- else {
- deselect_nlachannels (0); // Auto clear
- base->flag |= SELECT;
- }
- ob->flag= base->flag;
-
- if(base!=BASACT) set_active_base(base);
-
- if(actclick) /* de-activate all strips */
- set_active_strip(ob, NULL);
- else if(strip) {
- if(mval[0] >= (NLAWIDTH-16)) /* toggle strip muting */
- strip->flag ^= ACTSTRIP_MUTE;
- else /* set action */
- set_active_strip(ob, strip);
- }
-
- /* icon toggles beside strip */
- if (obclick && mval[0]<20) {
- /* collapse option for NLA object strip */
- ob->nlaflag ^= OB_NLA_COLLAPSED;
- }
- else if(obclick && mval[0]<36) {
- /* override option for NLA */
- ob->nlaflag ^= OB_NLA_OVERRIDE;
- }
- else if((obclick) && (ob->ipo) && (mval[0] >= (NLAWIDTH-16))) {
- /* mute Object IPO-block */
- ob->ipo->muteipo = (ob->ipo->muteipo)? 0: 1;
- }
-
- ob->ctime= -1234567.0f; // eveil!
- DAG_object_flush_update(G.scene, ob, OB_RECALC_OB|OB_RECALC_DATA);
-
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
-
-}
-
-void deselect_nlachannel_keys (int test)
-{
- Base *base;
- int sel=1;
- bActionChannel *chan;
- bActionStrip *strip;
- bConstraintChannel *conchan;
-
- /* Determine if this is selection or deselection */
- if (test){
- for (base=G.scene->base.first; base && sel; base=base->next){
- /* Test object ipos */
- if (is_ipo_key_selected(base->object->ipo)){
- sel = 0;
- break;
- }
-
- /* Test object constraint ipos */
- if (sel){
- for (conchan=base->object->constraintChannels.first; conchan; conchan=conchan->next){
- if (is_ipo_key_selected(conchan->ipo)){
- sel=0;
- break;
- }
- }
- }
-
- /* check if collapsed */
- if (base->object->nlaflag & OB_NLA_COLLAPSED)
- continue;
-
- /* Test action ipos */
- if (sel){
- if (base->object->action){
- for (chan=base->object->action->chanbase.first; chan; chan=chan->next){
- if (is_ipo_key_selected(chan->ipo)){
- sel=0;
- break;
- }
-
- /* Test action constraints */
- if (sel){
- for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next){
- if (is_ipo_key_selected(conchan->ipo)){
- sel=0;
- break;
- }
- }
- }
- }
- }
- }
-
- /* Test NLA strips */
- if (sel){
- for (strip=base->object->nlastrips.first; strip; strip=strip->next){
- if (strip->flag & ACTSTRIP_SELECT){
- sel = 0;
- break;
- }
- }
- }
- }
- }
- else
- sel=0;
-
-
- /* Set the flags */
- for (base=G.scene->base.first; base; base=base->next){
- /* Set the object ipos */
- set_ipo_key_selection(base->object->ipo, sel);
-
- /* Set the object constraint ipos */
- for (conchan=base->object->constraintChannels.first; conchan; conchan=conchan->next){
- set_ipo_key_selection(conchan->ipo, sel);
- }
-
- /* check if collapsed */
- if (base->object->nlaflag & OB_NLA_COLLAPSED)
- continue;
-
- /* Set the action ipos */
- if (base->object->action){
- for (chan=base->object->action->chanbase.first; chan; chan=chan->next){
- set_ipo_key_selection(chan->ipo, sel);
- /* Set the action constraint ipos */
- for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next)
- set_ipo_key_selection(conchan->ipo, sel);
- }
- }
-
- /* Set the nlastrips */
- for (strip=base->object->nlastrips.first; strip; strip=strip->next){
- if (sel)
- strip->flag |= ACTSTRIP_SELECT;
- else
- strip->flag &= ~ACTSTRIP_SELECT;
- }
- }
-}
-
-/* very bad call! */
-static void recalc_all_ipos(void)
-{
- Ipo *ipo;
- IpoCurve *icu;
-
- /* Go to each ipo */
- for (ipo=G.main->ipo.first; ipo; ipo=ipo->id.next){
- for (icu = ipo->curve.first; icu; icu=icu->next){
- sort_time_ipocurve(icu);
- testhandles_ipocurve(icu);
- }
- }
-}
-
-void transform_nlachannel_keys(int mode, int dummy)
-{
- switch (mode) {
- case 'g':
- {
- initTransform(TFM_TIME_TRANSLATE, CTX_NONE);
- Transform();
- }
- break;
- case 's':
- {
- initTransform(TFM_TIME_SCALE, CTX_NONE);
- Transform();
- }
- break;
- case 'e':
- {
- initTransform(TFM_TIME_EXTEND, CTX_NONE);
- Transform();
- }
- break;
- }
-}
-
-void delete_nlachannel_keys(void)
-{
- Base *base;
- bActionChannel *chan;
- bConstraintChannel *conchan;
- bActionStrip *strip, *nextstrip;
-
- for (base = G.scene->base.first; base; base=base->next){
- /* Delete object ipos */
- delete_ipo_keys(base->object->ipo);
-
- /* Delete object constraint keys */
- for(conchan=base->object->constraintChannels.first; conchan; conchan=conchan->next)
- delete_ipo_keys(conchan->ipo);
-
- /* skip actions and nlastrips if object collapsed */
- if (base->object->nlaflag & OB_NLA_COLLAPSED)
- continue;
-
- /* Delete NLA strips */
- for (strip = base->object->nlastrips.first; strip; strip=nextstrip){
- nextstrip=strip->next;
- if (strip->flag & ACTSTRIP_SELECT){
- free_actionstrip(strip);
- BLI_remlink(&base->object->nlastrips, strip);
- MEM_freeN(strip);
- }
- }
-
- /* Delete action ipos */
- if (base->object->action){
- for (chan=base->object->action->chanbase.first; chan; chan=chan->next){
- if (EDITABLE_ACHAN(chan))
- delete_ipo_keys(chan->ipo);
-
- /* Delete action constraint keys */
- for(conchan=chan->constraintChannels.first; conchan; conchan=conchan->next){
- if (EDITABLE_CONCHAN(conchan))
- delete_ipo_keys(conchan->ipo);
- }
- }
- }
- }
-
- recalc_all_ipos(); // bad
- synchronize_action_strips();
-
- BIF_undo_push("Delete NLA keys");
- allspace(REMAKEIPO,0);
- allqueue (REDRAWVIEW3D, 0);
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWIPO, 0);
-}
-
-void duplicate_nlachannel_keys(void)
-{
- Base *base;
- bActionChannel *chan;
- bConstraintChannel *conchan;
- bActionStrip *strip, *laststrip;
-
- /* Find selected items */
- for (base = G.scene->base.first; base; base=base->next){
- /* Duplicate object keys */
- duplicate_ipo_keys(base->object->ipo);
-
- /* Duplicate object constraint keys */
- for(conchan=base->object->constraintChannels.first; conchan; conchan=conchan->next)
- duplicate_ipo_keys(conchan->ipo);
-
- /* skip actions and nlastrips if object collapsed */
- if (base->object->nlaflag & OB_NLA_COLLAPSED)
- continue;
-
- /* Duplicate nla strips */
- laststrip = base->object->nlastrips.last;
- for (strip=base->object->nlastrips.first; strip; strip=strip->next){
- if (strip->flag & ACTSTRIP_SELECT){
- bActionStrip *newstrip;
-
- copy_actionstrip(&newstrip, &strip);
-
- BLI_addtail(&base->object->nlastrips, newstrip);
-
- strip->flag &= ~ACTSTRIP_SELECT;
- newstrip->flag |= ACTSTRIP_SELECT;
- set_active_strip(base->object, newstrip);
-
- }
- if (strip==laststrip)
- break;
- }
-
- /* Duplicate actionchannel keys */
- if (base->object->action){
- for (chan=base->object->action->chanbase.first; chan; chan=chan->next){
- if (EDITABLE_ACHAN(chan))
- duplicate_ipo_keys(chan->ipo);
-
- /* Duplicate action constraint keys */
- for(conchan=chan->constraintChannels.first; conchan; conchan=conchan->next) {
- if (EDITABLE_CONCHAN(conchan))
- duplicate_ipo_keys(conchan->ipo);
- }
- }
- }
- }
-
- BIF_undo_push("Duplicate NLA");
- transform_nlachannel_keys ('g', 0);
-}
-
-void borderselect_nla(void)
-{
- Base *base;
- rcti rect;
- rctf rectf;
- int val, selectmode;
- short mval[2];
- float ymin, ymax;
- bActionStrip *strip;
- bConstraintChannel *conchan;
-
- if ( (val = get_border (&rect, 3)) ){
- if (val == LEFTMOUSE)
- selectmode = SELECT_ADD;
- else
- selectmode = SELECT_SUBTRACT;
-
- mval[0]= rect.xmin;
- mval[1]= rect.ymin+2;
- areamouseco_to_ipoco(G.v2d, mval, &rectf.xmin, &rectf.ymin);
- mval[0]= rect.xmax;
- mval[1]= rect.ymax-2;
- areamouseco_to_ipoco(G.v2d, mval, &rectf.xmax, &rectf.ymax);
-
- ymax = count_nla_levels();
- ymax*= (NLACHANNELHEIGHT+NLACHANNELSKIP);
- ymax+= (NLACHANNELHEIGHT+NLACHANNELSKIP)/2;
-
- for (base=G.scene->base.first; base; base=base->next){
- if (nla_filter(base)) {
-
- ymin=ymax-(NLACHANNELHEIGHT+NLACHANNELSKIP);
-
- /* Check object ipos */
- if (base->object->ipo){
- if (!((ymax < rectf.ymin) || (ymin > rectf.ymax)))
- borderselect_ipo_key(base->object->ipo, rectf.xmin, rectf.xmax,
- selectmode);
- }
- /* Check object constraint ipos */
- for (conchan=base->object->constraintChannels.first; conchan; conchan=conchan->next){
- if (!((ymax < rectf.ymin) || (ymin > rectf.ymax)))
- borderselect_ipo_key(conchan->ipo, rectf.xmin, rectf.xmax,
- selectmode);
- }
-
- ymax=ymin;
-
- /* skip actions and nlastrips if object collapsed */
- if (base->object->nlaflag & OB_NLA_COLLAPSED)
- continue;
-
- /* Check action ipos */
- if (base->object->action){
- bActionChannel *chan;
- float xmin, xmax;
-
- ymin=ymax-(NLACHANNELHEIGHT+NLACHANNELSKIP);
-
- /* if action is mapped in NLA, it returns a correction */
- xmin= get_action_frame(base->object, rectf.xmin);
- xmax= get_action_frame(base->object, rectf.xmax);
-
- if (!((ymax < rectf.ymin) || (ymin > rectf.ymax))){
- for (chan=base->object->action->chanbase.first; chan; chan=chan->next){
- borderselect_ipo_key(chan->ipo, xmin, xmax, selectmode);
- /* Check action constraint ipos */
- for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next)
- borderselect_ipo_key(conchan->ipo, xmin, xmax, selectmode);
- }
- }
-
- ymax=ymin;
- } /* End of if action */
-
- /* Skip nlastrips */
- for (strip=base->object->nlastrips.first; strip; strip=strip->next){
- ymin=ymax-(NLACHANNELHEIGHT+NLACHANNELSKIP);
- //
- if (!((ymax < rectf.ymin) || (ymin > rectf.ymax))){
- if (!((rectf.xmax<strip->start) || (rectf.xmin>strip->end))){
- if (val==1)
- strip->flag |= ACTSTRIP_SELECT;
- else
- strip->flag &= ~ACTSTRIP_SELECT;
- }
- }
-
- ymax=ymin;
- }
- }
- }
- BIF_undo_push("Border select NLA");
- allqueue(REDRAWMARKER, 0);
- }
-}
-
-/* right hand side of window, does ipokeys, actionkeys or strips */
-static void mouse_nla(int selectmode)
-{
- Base *base;
- bAction *act;
- bActionChannel *chan;
- bActionStrip *rstrip;
- bConstraintChannel *conchan;
- TimeMarker *marker;
- float selx;
- short mval[2];
- short sel, isdone=0;
-
- getmouseco_areawin (mval);
-
- /* Try object ipo or ob-constraint ipo selection */
- base= get_nearest_nlachannel_ob_key(&selx, &sel);
- marker=find_nearest_marker(1);
- if (base) {
- isdone= 1;
-
- if (selectmode == SELECT_REPLACE){
- deselect_nlachannel_keys(0);
- selectmode = SELECT_ADD;
- }
-
- select_ipo_key(base->object->ipo, selx, selectmode);
-
- /* Try object constraint selection */
- for (conchan=base->object->constraintChannels.first; conchan; conchan=conchan->next)
- select_ipo_key(conchan->ipo, selx, selectmode);
- }
- else if (marker) {
- /* marker */
- if (selectmode == SELECT_REPLACE) {
- deselect_markers(0, 0);
- marker->flag |= SELECT;
- }
- else if (selectmode == SELECT_INVERT) {
- if (marker->flag & SELECT)
- marker->flag &= ~SELECT;
- else
- marker->flag |= SELECT;
- }
- else if (selectmode == SELECT_ADD)
- marker->flag |= SELECT;
- else if (selectmode == SELECT_SUBTRACT)
- marker->flag &= ~SELECT;
-
- std_rmouse_transform(transform_markers);
-
- allqueue(REDRAWMARKER, 0);
- }
- else {
- /* Try action ipo selection */
- act= get_nearest_nlachannel_ac_key(&selx, &sel);
- if (act) {
- isdone= 1;
-
- if (selectmode == SELECT_REPLACE){
- deselect_nlachannel_keys(0);
- selectmode = SELECT_ADD;
- }
-
- for (chan=act->chanbase.first; chan; chan=chan->next) {
- select_ipo_key(chan->ipo, selx, selectmode);
- /* Try action constraint selection */
- for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next)
- select_ipo_key(conchan->ipo, selx, selectmode);
- }
- }
- else {
-
- /* Try nla strip selection */
- base= get_nearest_nlastrip(&rstrip, &sel);
- if (base){
- isdone= 1;
-
- if (!(G.qual & LR_SHIFTKEY)){
- deselect_nlachannel_keys(0);
- sel = 0;
- }
-
- if (sel)
- rstrip->flag &= ~ACTSTRIP_SELECT;
- else
- rstrip->flag |= ACTSTRIP_SELECT;
-
- set_active_strip(base->object, rstrip);
-
- if(base!=BASACT) set_active_base(base);
- }
- }
- }
-
- if(isdone) {
- std_rmouse_transform(transform_nlachannel_keys);
-
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWNLA, 0);
- }
-}
-
-/* This function is currently more complicated than it seems like it should be.
-* However, this will be needed once the nla strip timeline is more complex */
-static Base *get_nearest_nlastrip (bActionStrip **rstrip, short *sel)
-{
- Base *base, *firstbase=NULL;
- bActionStrip *strip, *firststrip=NULL, *foundstrip=NULL;
- rctf rectf;
- float ymin, ymax;
- short mval[2];
- short foundsel = 0;
-
- getmouseco_areawin (mval);
-
- mval[0]-=7;
- areamouseco_to_ipoco(G.v2d, mval, &rectf.xmin, &rectf.ymin);
-
- mval[0]+=14;
- areamouseco_to_ipoco(G.v2d, mval, &rectf.xmax, &rectf.ymax);
-
- ymax = count_nla_levels();
- ymax*=(NLACHANNELHEIGHT + NLACHANNELSKIP);
- ymax+= NLACHANNELHEIGHT/2;
-
- for (base = G.scene->base.first; base; base=base->next){
- if (nla_filter(base)) {
-
- /* Skip object ipos */
- ymax-=(NLACHANNELHEIGHT+NLACHANNELSKIP);
-
- /* check if skip strips if collapsed */
- if (base->object->nlaflag & OB_NLA_COLLAPSED)
- continue;
-
- /* Skip action ipos */
- if (base->object->action)
- ymax-=(NLACHANNELHEIGHT+NLACHANNELSKIP);
-
- /* the strips */
- for (strip=base->object->nlastrips.first; strip; strip=strip->next){
- ymin=ymax-(NLACHANNELHEIGHT+NLACHANNELSKIP);
- /* Do Ytest */
- if (!((ymax < rectf.ymin) || (ymin > rectf.ymax))){
- /* Do XTest */
- if (!((rectf.xmax<strip->start) || (rectf.xmin>strip->end))){
- if (!firstbase){
- firstbase=base;
- firststrip=strip;
- *sel = strip->flag & ACTSTRIP_SELECT;
- }
-
- if (strip->flag & ACTSTRIP_SELECT){
- if (!foundsel){
- foundsel=1;
- foundstrip = strip;
- }
- }
- else if (foundsel && strip != foundstrip){
- *rstrip=strip;
- *sel = 0;
- return base;
- }
- }
- }
- ymax=ymin;
- }
- }
- }
- *rstrip=firststrip;
- return firstbase;
-}
-
-static Base *get_nearest_nlachannel_ob_key (float *index, short *sel)
-{
- Base *base;
- IpoCurve *icu;
- Base *firstbase=NULL;
- bConstraintChannel *conchan;
- int foundsel=0;
- float firstvertx=-1, foundx=-1;
- int i;
- short mval[2];
- float ymin, ymax;
- rctf rectf;
-
- *index=0;
-
- getmouseco_areawin (mval);
-
- mval[0]-=7;
- areamouseco_to_ipoco(G.v2d, mval, &rectf.xmin, &rectf.ymin);
-
- mval[0]+=14;
- areamouseco_to_ipoco(G.v2d, mval, &rectf.xmax, &rectf.ymax);
-
- ymax = count_nla_levels();
-
- ymax*= (NLACHANNELHEIGHT + NLACHANNELSKIP);
- ymax+= NLACHANNELHEIGHT/2;
-
- *sel=0;
-
- for (base=G.scene->base.first; base; base=base->next){
- if (nla_filter(base)) {
-
- ymin=ymax-(NLACHANNELHEIGHT+NLACHANNELSKIP);
-
- /* Handle object ipo selection */
- if (base->object->ipo){
- if (!((ymax < rectf.ymin) || (ymin > rectf.ymax))){
- for (icu=base->object->ipo->curve.first; icu; icu=icu->next){
- for (i=0; i<icu->totvert; i++){
- if (icu->bezt[i].vec[1][0] > rectf.xmin && icu->bezt[i].vec[1][0] <= rectf.xmax ){
- if (!firstbase){
- firstbase=base;
- firstvertx=icu->bezt[i].vec[1][0];
- *sel = icu->bezt[i].f2 & 1;
- }
-
- if (icu->bezt[i].f2 & 1){
- if (!foundsel){
- foundsel=1;
- foundx = icu->bezt[i].vec[1][0];
- }
- }
- else if (foundsel && icu->bezt[i].vec[1][0] != foundx){
- *index=icu->bezt[i].vec[1][0];
- *sel = 0;
- return base;
- }
- }
- }
- }
- }
- }
- /* Handle object constraint ipos */
- for (conchan=base->object->constraintChannels.first; conchan; conchan=conchan->next){
- if ( !((ymax < rectf.ymin) || (ymin > rectf.ymax)) && conchan->ipo){
- for (icu=conchan->ipo->curve.first; icu; icu=icu->next){
- for (i=0; i<icu->totvert; i++){
- if (icu->bezt[i].vec[1][0] > rectf.xmin && icu->bezt[i].vec[1][0] <= rectf.xmax ){
- if (!firstbase){
- firstbase=base;
- firstvertx=icu->bezt[i].vec[1][0];
- *sel = icu->bezt[i].f2 & 1;
- }
-
- if (icu->bezt[i].f2 & 1){
- if (!foundsel){
- foundsel=1;
- foundx = icu->bezt[i].vec[1][0];
- }
- }
- else if (foundsel && icu->bezt[i].vec[1][0] != foundx){
- *index=icu->bezt[i].vec[1][0];
- *sel = 0;
- return base;
- }
- }
- }
- }
- }
- }
-
- ymax=ymin;
-
- /* Skip actions and nlastrips if object is collapsed */
- if (base->object->nlaflag & OB_NLA_COLLAPSED)
- continue;
-
- /* Skip action ipos */
- if (base->object->action){
- ymax-=(NLACHANNELHEIGHT+NLACHANNELSKIP);
- }
- /* Skip nlastrips */
- ymax-=(NLACHANNELHEIGHT+NLACHANNELSKIP)*BLI_countlist(&base->object->nlastrips);
- }
- }
-
- *index=firstvertx;
- return firstbase;
-}
-
-static bAction *get_nearest_nlachannel_ac_key (float *index, short *sel)
-{
- Base *base;
- IpoCurve *icu;
- bAction *firstact=NULL;
- bActionChannel *chan;
- bConstraintChannel *conchan;
- rctf rectf;
- float firstvert=-1, foundx=-1;
- float ymin, ymax, xmin, xmax;
- int i;
- int foundsel=0;
- short mval[2];
-
- *index=0;
-
- getmouseco_areawin (mval);
-
- mval[0]-=7;
- areamouseco_to_ipoco(G.v2d, mval, &rectf.xmin, &rectf.ymin);
-
- mval[0]+=14;
- areamouseco_to_ipoco(G.v2d, mval, &rectf.xmax, &rectf.ymax);
-
- ymax = count_nla_levels();
-
- ymax*= (NLACHANNELHEIGHT + NLACHANNELSKIP);
- ymax+= NLACHANNELHEIGHT/2;
-
- *sel=0;
-
- for (base=G.scene->base.first; base; base=base->next){
- /* Handle object ipo selection */
- if (nla_filter(base)) {
-
- /* Skip object ipo and ob-constraint ipo */
- ymin=ymax-(NLACHANNELHEIGHT+NLACHANNELSKIP);
-
- /* skip this object if it is collapsed */
- if (base->object->nlaflag & OB_NLA_COLLAPSED)
- continue;
-
- ymax=ymin;
-
- /* Handle action ipos */
- if (base->object->action){
- bAction *act= base->object->action;
-
- /* if action is mapped in NLA, it returns a correction */
- xmin= get_action_frame(base->object, rectf.xmin);
- xmax= get_action_frame(base->object, rectf.xmax);
-
- ymin=ymax-(NLACHANNELHEIGHT+NLACHANNELSKIP);
- if (!((ymax < rectf.ymin) || (ymin > rectf.ymax))){
- for (chan=act->chanbase.first; chan; chan=chan->next){
- if(chan->ipo) {
- for (icu=chan->ipo->curve.first; icu; icu=icu->next){
- for (i=0; i<icu->totvert; i++){
- if (icu->bezt[i].vec[1][0] > xmin && icu->bezt[i].vec[1][0] <= xmax ){
- if (!firstact){
- firstact= act;
- firstvert=icu->bezt[i].vec[1][0];
- *sel = icu->bezt[i].f2 & 1;
- }
-
- if (icu->bezt[i].f2 & 1){
- if (!foundsel){
- foundsel=1;
- foundx = icu->bezt[i].vec[1][0];
- }
- }
- else if (foundsel && icu->bezt[i].vec[1][0] != foundx){
- *index=icu->bezt[i].vec[1][0];
- *sel = 0;
- return act;
- }
- }
- }
- }
- }
-
- for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next){
- ymin=ymax-(NLACHANNELHEIGHT+NLACHANNELSKIP);
- if ( !((ymax < rectf.ymin) || (ymin > rectf.ymax)) && conchan->ipo){
- for (icu=conchan->ipo->curve.first; icu; icu=icu->next){
- for (i=0; i<icu->totvert; i++){
- if (icu->bezt[i].vec[1][0] > xmin && icu->bezt[i].vec[1][0] <= xmax ){
- if (!firstact){
- firstact=base->object->action;
- firstvert=icu->bezt[i].vec[1][0];
- *sel = icu->bezt[i].f2 & 1;
- }
-
- if (icu->bezt[i].f2 & 1){
- if (!foundsel){
- foundsel=1;
- foundx = icu->bezt[i].vec[1][0];
- }
- }
- else if (foundsel && icu->bezt[i].vec[1][0] != foundx){
- *index=icu->bezt[i].vec[1][0];
- *sel = 0;
- return base->object->action;
- }
- }
- }
- }
- }
- ymax=ymin;
- }
-
-
- }
- }
- ymax=ymin;
- }
-
- /* Skip nlastrips */
- ymax-=(NLACHANNELHEIGHT+NLACHANNELSKIP)*BLI_countlist(&base->object->nlastrips);
- }
- }
-
- *index=firstvert;
- return firstact;
-}
-
-void deselect_nlachannels(int test)
-{
- Base *base;
- int sel = 1;
-
- if (test){
- for (base=G.scene->base.first; base; base=base->next){
- /* Check base flags for previous selection */
- if (base->flag & SELECT){
- sel=0;
- break;
- }
- }
- }
- else
- sel = 0;
-
- /* Select objects */
- for (base=G.scene->base.first; base; base=base->next){
- if (sel){
- if (nla_filter(base))
- base->flag |= SELECT;
- }
- else
- base->flag &= ~SELECT;
-
- base->object->flag= base->flag;
- }
-}
-
-static Object *get_object_from_active_strip(void) {
-
- Base *base;
- bActionStrip *strip;
-
- for (base=G.scene->base.first; base; base=base->next) {
- if ((base->object->nlaflag & OB_NLA_COLLAPSED)==0) {
- for (strip = base->object->nlastrips.first;
- strip; strip=strip->next){
- if (strip->flag & ACTSTRIP_SELECT) {
- return base->object;
- }
- }
- }
- }
- return NULL;
-}
-
-
-void winqreadnlaspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
-{
- unsigned short event= evt->event;
- short val= evt->val;
- SpaceNla *snla = curarea->spacedata.first;
- int doredraw= 0;
- short mval[2];
- float dx,dy;
- int cfra;
- short mousebut = L_MOUSE;
- Object *ob; //in shift-B / bake
-
- if (curarea->win==0) return;
- if (!snla) return;
-
- if(val) {
- if( uiDoBlocks(&curarea->uiblocks, event, 1)!=UI_NOTHING ) event= 0;
-
- /* swap mouse buttons based on user preference */
- if (U.flag & USER_LMOUSESELECT) {
- if (event == LEFTMOUSE) {
- event = RIGHTMOUSE;
- mousebut = L_MOUSE;
- } else if (event == RIGHTMOUSE) {
- event = LEFTMOUSE;
- mousebut = R_MOUSE;
- }
- }
-
- getmouseco_areawin(mval);
-
- switch(event) {
- case UI_BUT_EVENT:
- do_nlabuts(val); // in drawnla.c
- break;
-
- case HOMEKEY:
- do_nla_buttons(B_NLAHOME);
- break;
-
- case EQUALKEY:
- shift_nlastrips_up();
- break;
-
- case PAGEUPKEY:
- if (G.qual & LR_CTRLKEY)
- shift_nlastrips_up();
- else {
- nextprev_marker(1);
- allqueue(REDRAWMARKER, 0);
- }
- break;
-
- case MINUSKEY:
- shift_nlastrips_down();
- break;
-
- case PAGEDOWNKEY:
- if (G.qual & LR_CTRLKEY)
- shift_nlastrips_down();
- else {
- nextprev_marker(-1);
- allqueue(REDRAWMARKER, 0);
- }
- break;
-
- case AKEY:
- if (G.qual & LR_SHIFTKEY){
- add_nlablock();
- allqueue (REDRAWNLA, 0);
- allqueue (REDRAWVIEW3D, 0);
- }
- else if (G.qual & LR_CTRLKEY) {
- deselect_markers(1, 0);
- allqueue(REDRAWMARKER, 0);
- }
- else{
- if (mval[0]>=NLAWIDTH)
- deselect_nlachannel_keys(1);
- else{
- deselect_nlachannels(1);
- allqueue (REDRAWVIEW3D, 0);
- }
- allqueue (REDRAWNLA, 0);
- allqueue (REDRAWIPO, 0);
- BIF_undo_push("(De)select all NLA");
- }
- break;
-
- case BKEY:
- if (G.qual & LR_SHIFTKEY){
- bake_all_to_action();
- allqueue (REDRAWNLA, 0);
- allqueue (REDRAWVIEW3D, 0);
- BIF_undo_push("Bake All To Action");
- ob = get_object_from_active_strip();
- //build_match_caches(ob);
- }
- else if (G.qual & LR_CTRLKEY)
- borderselect_markers();
- else
- borderselect_nla();
- break;
-
- case CKEY:
- if(G.qual==LR_CTRLKEY) {
- if(okee("Copy Modifiers"))
- copy_action_modifiers();
- }
- else convert_nla();
- break;
-
- case DKEY:
- if (G.qual == (LR_CTRLKEY|LR_SHIFTKEY) && mval[0]>=NLAWIDTH) {
- duplicate_marker();
- }
- else if (G.qual & LR_SHIFTKEY && mval[0]>=NLAWIDTH){
- duplicate_nlachannel_keys();
- update_for_newframe_muted();
- }
-
- break;
-
- case EKEY:
- if (mval[0] >= NLAWIDTH) {
- transform_nlachannel_keys ('e', 0);
- update_for_newframe_muted();
- }
- break;
-
- case GKEY:
- if (mval[0]>=NLAWIDTH) {
- if (G.qual & LR_CTRLKEY) {
- transform_markers('g', 0);
- }
- else {
- transform_nlachannel_keys ('g', 0);
- update_for_newframe_muted();
- }
- }
- break;
-
- case MKEY:
- /* marker operations */
- if (G.qual == 0)
- add_marker(CFRA);
- else if (G.qual == LR_CTRLKEY)
- rename_marker();
- else
- break;
- allqueue(REDRAWMARKER, 0);
- break;
-
- case NKEY:
- if(G.qual==0) {
- toggle_blockhandler(curarea, NLA_HANDLER_PROPERTIES, UI_PNL_TO_MOUSE);
- scrarea_queue_winredraw(curarea);
- }
- else if (G.qual & LR_SHIFTKEY) {
- add_empty_nlablock();
- }
- break;
- case LKEY:
- relink_active_strip();
- break;
-
- case PKEY:
- if (G.qual & LR_CTRLKEY) /* set preview range */
- anim_previewrange_set();
- else if (G.qual & LR_ALTKEY) /* clear preview range */
- anim_previewrange_clear();
- allqueue(REDRAWMARKER, 0);
- break;
-
- case SKEY:
- if (G.qual==LR_ALTKEY) {
- val= pupmenu("Action Strip Scale%t|Reset Strip Scale%x1|Remap Action Start/End%x2|Apply Scale%x3");
- if (val > 0)
- reset_action_strips(val);
- }
- else if (G.qual & LR_SHIFTKEY) {
- if (snla->flag & SNLA_DRAWTIME)
- val= pupmenu("Snap To%t|Nearest Second%x3|Current Time%x2");
- else
- val= pupmenu("Snap To%t|Nearest Frame%x1|Current Frame%x2");
- if (ELEM3(val, 1, 2, 3))
- snap_action_strips(val);
- }
- else {
- if (mval[0]>=NLAWIDTH)
- transform_nlachannel_keys ('s', 0);
- update_for_newframe_muted();
- }
- break;
-
- case TKEY:
- if (G.qual & LR_CTRLKEY) {
- val= pupmenu("Time value%t|Frames %x1|Seconds%x2");
-
- if (val > 0) {
- if (val == 2) snla->flag |= SNLA_DRAWTIME;
- else snla->flag &= ~SNLA_DRAWTIME;
-
- doredraw= 1;
- }
- }
- break;
-
- case DELKEY:
- case XKEY:
- if (mval[0]>=NLAWIDTH) {
- if (okee("Erase selected?")) {
- delete_nlachannel_keys();
- update_for_newframe_muted();
-
- remove_marker();
-
- allqueue(REDRAWMARKER, 0);
- }
- }
- break;
-
- /* LEFTMOUSE and RIGHTMOUSE event codes can be swapped above,
- * based on user preference USER_LMOUSESELECT
- */
- case LEFTMOUSE:
- if(view2dmove(LEFTMOUSE))
- break; // only checks for sliders
- else if (mval[0]>=snla->v2d.mask.xmin) {
- do {
- getmouseco_areawin(mval);
-
- areamouseco_to_ipoco(G.v2d, mval, &dx, &dy);
-
- cfra= (int)dx;
- if(cfra< 1) cfra= 1;
-
- if( cfra!=CFRA ) {
- CFRA= cfra;
- update_for_newframe();
- force_draw_all(0);
- }
- else PIL_sleep_ms(30);
-
- } while(get_mbut() & mousebut);
- break;
- }
- /* else pass on! */
- case RIGHTMOUSE:
- if (mval[0]>=snla->v2d.mask.xmin) {
- if(G.qual & LR_SHIFTKEY)
- mouse_nla(SELECT_INVERT);
- else
- mouse_nla(SELECT_REPLACE);
- }
- else
- mouse_nlachannels(mval);
- break;
-
- case PADPLUSKEY:
- view2d_zoom(G.v2d, 0.1154, sa->winx, sa->winy);
- test_view2d(G.v2d, sa->winx, sa->winy);
- view2d_do_locks(curarea, V2D_LOCK_COPY);
- doredraw= 1;
- break;
- case PADMINUS:
- view2d_zoom(G.v2d, -0.15, sa->winx, sa->winy);
- test_view2d(G.v2d, sa->winx, sa->winy);
- view2d_do_locks(curarea, V2D_LOCK_COPY);
- doredraw= 1;
- break;
- case MIDDLEMOUSE:
- case WHEELUPMOUSE:
- case WHEELDOWNMOUSE:
- view2dmove(event); /* in drawipo.c */
- break;
- }
- }
-
- if(doredraw) scrarea_queue_winredraw(curarea);
-}
-
-void bake_all_to_action(void)
-{
- Object *ob;
- bAction *newAction;
- Ipo *ipo;
- ID *id;
- short hold, add;
- float repeat;
-
- /* burn object-level motion into a new action */
- ob = get_object_from_active_strip();
- if (ob) {
- if (ob->flag&OB_ARMATURE) {
- //newAction = bake_obIPO_to_action(ob);
- newAction = NULL;
- if (newAction) {
- /* unlink the object's IPO */
- ipo=ob->ipo;
- if (ipo) {
- id = &ipo->id;
- if (id->us > 0)
- id->us--;
- ob->ipo = NULL;
- }
-
- /* add the new Action to NLA as a strip */
- hold=1;
- add=1;
- repeat=1.0;
- printf("about to add nla block...\n");
- add_nla_block_by_name(newAction->id.name, ob, hold, add, repeat);
- BIF_undo_push("Add NLA strip");
- }
- }
- }
-}
-
-void copy_action_modifiers(void)
-{
- bActionStrip *strip, *actstrip;
- Object *ob= OBACT;
-
- if(ob==NULL)
- return;
-
- /* active strip */
- for (actstrip=ob->nlastrips.first; actstrip; actstrip=actstrip->next)
- if(actstrip->flag & ACTSTRIP_ACTIVE)
- break;
- if(actstrip==NULL)
- return;
-
- /* copy to selected items */
- for (strip=ob->nlastrips.first; strip; strip=strip->next){
- if (strip->flag & ACTSTRIP_SELECT) {
- if(strip!=actstrip) {
- if (strip->modifiers.first)
- BLI_freelistN(&strip->modifiers);
- if (actstrip->modifiers.first)
- duplicatelist (&strip->modifiers, &actstrip->modifiers);
- }
- }
- }
-
- BIF_undo_push("Copy Action Modifiers");
- allqueue(REDRAWNLA, 0);
- DAG_scene_flush_update(G.scene, screen_view3d_layers());
-}
-
diff --git a/source/blender/src/editnode.c b/source/blender/src/editnode.c
deleted file mode 100644
index a14b0ccc389..00000000000
--- a/source/blender/src/editnode.c
+++ /dev/null
@@ -1,2244 +0,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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2005 Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <string.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_action_types.h"
-#include "DNA_color_types.h"
-#include "DNA_image_types.h"
-#include "DNA_ipo_types.h"
-#include "DNA_object_types.h"
-#include "DNA_material_types.h"
-#include "DNA_node_types.h"
-#include "DNA_space_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_userdef_types.h"
-
-#include "BKE_colortools.h"
-#include "BKE_global.h"
-#include "BKE_image.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
-#include "BKE_node.h"
-#include "BKE_material.h"
-#include "BKE_scene.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_cursors.h"
-#include "BIF_editview.h"
-#include "BIF_gl.h"
-#include "BIF_graphics.h"
-#include "BIF_imasel.h"
-#include "BIF_interface.h"
-#include "BIF_mywindow.h"
-#include "BIF_previewrender.h"
-#include "BIF_resources.h"
-#include "BIF_renderwin.h"
-#include "BIF_space.h"
-#include "BIF_screen.h"
-#include "BIF_toolbox.h"
-
-#include "BSE_drawipo.h"
-#include "BSE_edit.h"
-#include "BSE_filesel.h"
-#include "BSE_headerbuttons.h"
-#include "BSE_node.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "BDR_editobject.h"
-
-#include "RE_pipeline.h"
-#include "IMB_imbuf_types.h"
-
-#include "blendef.h"
-#include "butspace.h"
-#include "PIL_time.h"
-#include "mydevice.h"
-#include "winlay.h"
-
-
-/* currently called from BIF_preview_changed */
-void snode_tag_dirty(SpaceNode *snode)
-{
- bNode *node;
-
- if(snode->treetype==NTREE_SHADER) {
- if(snode->nodetree) {
- for(node= snode->nodetree->nodes.first; node; node= node->next) {
- if(node->type==SH_NODE_OUTPUT)
- node->lasty= 0;
- }
- snode->flag |= SNODE_DO_PREVIEW; /* this adds an afterqueue on a redraw, to allow button previews to work first */
- }
- }
- allqueue(REDRAWNODE, 1);
-}
-
-static void shader_node_previewrender(ScrArea *sa, SpaceNode *snode)
-{
- bNode *node;
-
- if(snode->id==NULL) return;
- if( ((Material *)snode->id )->use_nodes==0 ) return;
-
- for(node= snode->nodetree->nodes.first; node; node= node->next) {
- if(node->type==SH_NODE_OUTPUT) {
- if(node->flag & NODE_DO_OUTPUT) {
- if(node->lasty<PREVIEW_RENDERSIZE-2) {
- RenderInfo ri;
-// int test= node->lasty;
-
- ri.curtile = 0;
- ri.tottile = 0;
- ri.rect = NULL;
- ri.pr_rectx = PREVIEW_RENDERSIZE;
- ri.pr_recty = PREVIEW_RENDERSIZE;
-
- BIF_previewrender(snode->id, &ri, NULL, PR_DO_RENDER); /* sends redraw event */
- if(ri.rect) MEM_freeN(ri.rect);
-
- /* when not finished... */
- if(ri.curtile<ri.tottile)
- addafterqueue(sa->win, RENDERPREVIEW, 1);
-// if(test!=node->lasty)
-// printf("node rendered to %d\n", node->lasty);
-
- break;
- }
- }
- }
- }
-}
-
-
-static void snode_handle_recalc(SpaceNode *snode)
-{
- if(snode->treetype==NTREE_SHADER) {
- BIF_preview_changed(ID_MA); /* signals buttons windows and node editors */
- }
- else if(snode->treetype==NTREE_COMPOSIT) {
- if(G.scene->use_nodes) {
- snode->nodetree->timecursor= set_timecursor;
- G.afbreek= 0;
- snode->nodetree->test_break= blender_test_break;
-
- BIF_store_spare();
-
- ntreeCompositExecTree(snode->nodetree, &G.scene->r, 1); /* 1 is do_previews */
-
- snode->nodetree->timecursor= NULL;
- snode->nodetree->test_break= NULL;
- waitcursor(0);
-
- allqueue(REDRAWNODE, 1);
- allqueue(REDRAWIMAGE, 1);
- if(G.scene->r.scemode & R_DOCOMP) {
- BIF_redraw_render_rect(); /* seems to screwup display? */
- mywinset(curarea->win);
- }
- }
- }
-}
-
-static void shader_node_event(SpaceNode *snode, short event)
-{
- switch(event) {
- case B_REDR:
- allqueue(REDRAWNODE, 1);
- break;
- default:
- /* B_NODE_EXEC */
- snode_handle_recalc(snode);
- break;
-
- }
-}
-
-static void load_node_image(char *str) /* called from fileselect */
-{
- SpaceNode *snode= curarea->spacedata.first;
- bNode *node= nodeGetActive(snode->edittree);
- Image *ima= NULL;
-
- ima= BKE_add_image_file(str);
- if(ima) {
- if(node->id)
- node->id->us--;
-
- node->id= &ima->id;
- id_us_plus(node->id);
-
- BLI_strncpy(node->name, node->id->name+2, 21);
-
- BKE_image_signal(ima, node->storage, IMA_SIGNAL_RELOAD);
-
- NodeTagChanged(snode->edittree, node);
- snode_handle_recalc(snode);
- allqueue(REDRAWNODE, 0);
- }
-}
-
-static bNode *snode_get_editgroup(SpaceNode *snode)
-{
- bNode *gnode;
-
- /* get the groupnode */
- for(gnode= snode->nodetree->nodes.first; gnode; gnode= gnode->next)
- if(gnode->flag & NODE_GROUP_EDIT)
- break;
- return gnode;
-}
-
-/* node has to be of type 'render layers' */
-/* is a bit clumsy copying renderdata here... scene nodes use render size of current render */
-static void composite_node_render(SpaceNode *snode, bNode *node)
-{
- RenderData rd;
- Scene *scene= NULL;
- int scemode, actlay;
-
- /* the button press won't show up otherwise, button hilites disabled */
- force_draw(0);
-
- if(node->id && node->id!=(ID *)G.scene) {
- scene= G.scene;
- set_scene_bg((Scene *)node->id);
- rd= G.scene->r;
- G.scene->r.xsch= scene->r.xsch;
- G.scene->r.ysch= scene->r.ysch;
- G.scene->r.size= scene->r.size;
- G.scene->r.mode &= ~(R_BORDER|R_DOCOMP);
- G.scene->r.mode |= scene->r.mode & R_BORDER;
- G.scene->r.border= scene->r.border;
- }
-
- scemode= G.scene->r.scemode;
- actlay= G.scene->r.actlay;
-
- G.scene->r.scemode |= R_SINGLE_LAYER;
- G.scene->r.actlay= node->custom1;
-
- BIF_do_render(0);
-
- G.scene->r.scemode= scemode;
- G.scene->r.actlay= actlay;
-
- node->custom2= 0;
-
- if(scene) {
- G.scene->r= rd;
- set_scene_bg(scene);
- }
-}
-
-static void composit_node_event(SpaceNode *snode, short event)
-{
-
- switch(event) {
- case B_REDR:
- allqueue(REDRAWNODE, 1);
- break;
- case B_NODE_LOADIMAGE:
- {
- bNode *node= nodeGetActive(snode->edittree);
- char name[FILE_MAXDIR+FILE_MAXFILE];
-
- if(node->id)
- strcpy(name, ((Image *)node->id)->name);
- else strcpy(name, U.textudir);
- if (G.qual & LR_CTRLKEY) {
- activate_imageselect(FILE_SPECIAL, "SELECT IMAGE", name, load_node_image);
- } else {
- activate_fileselect(FILE_SPECIAL, "SELECT IMAGE", name, load_node_image);
- }
- break;
- }
- case B_NODE_TREE_EXEC:
- snode_handle_recalc(snode);
- break;
- default:
- /* B_NODE_EXEC */
- {
- bNode *node= BLI_findlink(&snode->edittree->nodes, event-B_NODE_EXEC);
- if(node) {
- NodeTagChanged(snode->edittree, node);
- NodeTagIDChanged(snode->nodetree, node->id); /* Scene-layer nodes, texture nodes, image nodes, all can be used many times */
-
- /* not the best implementation of the world... but we need it to work now :) */
- if(node->type==CMP_NODE_R_LAYERS && node->custom2) {
- composite_node_render(snode, node);
- /* new event, a render can go fullscreen and open new window */
- addqueue(curarea->win, UI_BUT_EVENT, B_NODE_TREE_EXEC);
- }
- else {
- node= snode_get_editgroup(snode);
- if(node)
- NodeTagIDChanged(snode->nodetree, node->id);
-
- snode_handle_recalc(snode);
- }
- }
- }
- }
-}
-
-
-/* assumes nothing being done in ntree yet, sets the default in/out node */
-/* called from shading buttons or header */
-void node_shader_default(Material *ma)
-{
- bNode *in, *out;
- bNodeSocket *fromsock, *tosock;
-
- /* but lets check it anyway */
- if(ma->nodetree) {
- printf("error in shader initialize\n");
- return;
- }
-
- ma->nodetree= ntreeAddTree(NTREE_SHADER);
-
- out= nodeAddNodeType(ma->nodetree, SH_NODE_OUTPUT, NULL);
- out->locx= 300.0f; out->locy= 300.0f;
-
- in= nodeAddNodeType(ma->nodetree, SH_NODE_MATERIAL, NULL);
- in->locx= 10.0f; in->locy= 300.0f;
- nodeSetActive(ma->nodetree, in);
-
- /* only a link from color to color */
- fromsock= in->outputs.first;
- tosock= out->inputs.first;
- nodeAddLink(ma->nodetree, in, fromsock, out, tosock);
-
- ntreeSolveOrder(ma->nodetree); /* needed for pointers */
-}
-
-/* assumes nothing being done in ntree yet, sets the default in/out node */
-/* called from shading buttons or header */
-void node_composit_default(Scene *sce)
-{
- bNode *in, *out;
- bNodeSocket *fromsock, *tosock;
-
- /* but lets check it anyway */
- if(sce->nodetree) {
- printf("error in composit initialize\n");
- return;
- }
-
- sce->nodetree= ntreeAddTree(NTREE_COMPOSIT);
-
- out= nodeAddNodeType(sce->nodetree, CMP_NODE_COMPOSITE, NULL);
- out->locx= 300.0f; out->locy= 400.0f;
-
- in= nodeAddNodeType(sce->nodetree, CMP_NODE_R_LAYERS, NULL);
- in->locx= 10.0f; in->locy= 400.0f;
- nodeSetActive(sce->nodetree, in);
-
- /* links from color to color */
- fromsock= in->outputs.first;
- tosock= out->inputs.first;
- nodeAddLink(sce->nodetree, in, fromsock, out, tosock);
-
- ntreeSolveOrder(sce->nodetree); /* needed for pointers */
-
- ntreeCompositForceHidden(sce->nodetree);
-}
-
-/* Here we set the active tree(s), even called for each redraw now, so keep it fast :) */
-void snode_set_context(SpaceNode *snode)
-{
- Object *ob= OBACT;
- bNode *node= NULL;
-
- snode->nodetree= NULL;
- snode->id= snode->from= NULL;
-
- if(snode->treetype==NTREE_SHADER) {
- /* need active object, or we allow pinning... */
- if(ob) {
- Material *ma= give_current_material(ob, ob->actcol);
- if(ma) {
- snode->from= material_from(ob, ob->actcol);
- snode->id= &ma->id;
- snode->nodetree= ma->nodetree;
- }
- }
- }
- else if(snode->treetype==NTREE_COMPOSIT) {
- snode->from= NULL;
- snode->id= &G.scene->id;
-
- /* bit clumsy but reliable way to see if we draw first time */
- if(snode->nodetree==NULL)
- ntreeCompositForceHidden(G.scene->nodetree);
-
- snode->nodetree= G.scene->nodetree;
- }
-
- /* find editable group */
- if(snode->nodetree)
- for(node= snode->nodetree->nodes.first; node; node= node->next)
- if(node->flag & NODE_GROUP_EDIT)
- break;
-
- if(node && node->id)
- snode->edittree= (bNodeTree *)node->id;
- else
- snode->edittree= snode->nodetree;
-}
-
-/* on activate image viewer, check if we show it */
-static void node_active_image(Image *ima)
-{
- ScrArea *sa;
- SpaceImage *sima= NULL;
-
- /* find an imagewindow showing render result */
- for(sa=G.curscreen->areabase.first; sa; sa= sa->next) {
- if(sa->spacetype==SPACE_IMAGE) {
- sima= sa->spacedata.first;
- if(sima->image && sima->image->source!=IMA_SRC_VIEWER)
- break;
- }
- }
- if(sa && sima) {
- sima->image= ima;
- scrarea_queue_winredraw(sa);
- scrarea_queue_headredraw(sa);
- }
-}
-
-
-static void node_set_active(SpaceNode *snode, bNode *node)
-{
-
- nodeSetActive(snode->edittree, node);
-
- if(node->type!=NODE_GROUP) {
-
- /* tree specific activate calls */
- if(snode->treetype==NTREE_SHADER) {
-
- /* when we select a material, active texture is cleared, for buttons */
- if(node->id && GS(node->id->name)==ID_MA)
- nodeClearActiveID(snode->edittree, ID_TE);
- if(node->id)
- BIF_preview_changed(-1); /* temp hack to force texture preview to update */
-
- allqueue(REDRAWBUTSSHADING, 1);
- allqueue(REDRAWIPO, 0);
- }
- else if(snode->treetype==NTREE_COMPOSIT) {
- /* make active viewer, currently only 1 supported... */
- if( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
- bNode *tnode;
- int was_output= node->flag & NODE_DO_OUTPUT;
-
- for(tnode= snode->edittree->nodes.first; tnode; tnode= tnode->next)
- if( ELEM(tnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
- tnode->flag &= ~NODE_DO_OUTPUT;
-
- node->flag |= NODE_DO_OUTPUT;
- if(was_output==0) {
- bNode *gnode;
-
- NodeTagChanged(snode->edittree, node);
-
- /* if inside group, tag entire group */
- gnode= snode_get_editgroup(snode);
- if(gnode)
- NodeTagIDChanged(snode->nodetree, gnode->id);
-
- snode_handle_recalc(snode);
- }
-
- /* addnode() doesnt link this yet... */
- node->id= (ID *)BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node");
- }
- else if(node->type==CMP_NODE_IMAGE) {
- if(node->id)
- node_active_image((Image *)node->id);
- }
- else if(node->type==CMP_NODE_R_LAYERS) {
- if(node->id==NULL || node->id==(ID *)G.scene) {
- G.scene->r.actlay= node->custom1;
- allqueue(REDRAWBUTSSCENE, 0);
- }
- }
- }
- }
-}
-
-void snode_make_group_editable(SpaceNode *snode, bNode *gnode)
-{
- bNode *node;
-
- /* make sure nothing has group editing on */
- for(node= snode->nodetree->nodes.first; node; node= node->next)
- node->flag &= ~NODE_GROUP_EDIT;
-
- if(gnode==NULL) {
- /* with NULL argument we do a toggle */
- if(snode->edittree==snode->nodetree)
- gnode= nodeGetActive(snode->nodetree);
- }
-
- if(gnode && gnode->type==NODE_GROUP && gnode->id) {
- if(gnode->id->lib) {
- if(okee("Make Group Local"))
- ntreeMakeLocal((bNodeTree *)gnode->id);
- else
- return;
- }
- gnode->flag |= NODE_GROUP_EDIT;
- snode->edittree= (bNodeTree *)gnode->id;
-
- /* deselect all other nodes, so we can also do grabbing of entire subtree */
- for(node= snode->nodetree->nodes.first; node; node= node->next)
- node->flag &= ~SELECT;
- gnode->flag |= SELECT;
-
- }
- else
- snode->edittree= snode->nodetree;
-
- ntreeSolveOrder(snode->nodetree);
-
- /* finally send out events for new active node */
- if(snode->treetype==NTREE_SHADER) {
- allqueue(REDRAWBUTSSHADING, 0);
-
- BIF_preview_changed(-1); /* temp hack to force texture preview to update */
- }
-
- allqueue(REDRAWNODE, 0);
-}
-
-void node_ungroup(SpaceNode *snode)
-{
- bNode *gnode;
-
- /* are we inside of a group? */
- gnode= snode_get_editgroup(snode);
- if(gnode)
- snode_make_group_editable(snode, NULL);
-
- gnode= nodeGetActive(snode->edittree);
- if(gnode==NULL) return;
-
- if(gnode->type!=NODE_GROUP)
- error("Not a group");
- else {
- if(nodeGroupUnGroup(snode->edittree, gnode)) {
-
- BIF_undo_push("Deselect all nodes");
- allqueue(REDRAWNODE, 0);
- }
- else
- error("Can't ungroup");
- }
-}
-
-/* when links in groups change, inputs/outputs change, nodes added/deleted... */
-static void snode_verify_groups(SpaceNode *snode)
-{
- bNode *gnode;
-
- gnode= snode_get_editgroup(snode);
-
- /* does all materials */
- if(gnode)
- nodeVerifyGroup((bNodeTree *)gnode->id);
-
-}
-
-static void node_addgroup(SpaceNode *snode)
-{
- bNodeTree *ngroup;
- int tot= 0, offs, val;
- char *strp;
-
- if(snode->edittree!=snode->nodetree) {
- error("Can not add a Group in a Group");
- return;
- }
-
- /* construct menu with choices */
- for(ngroup= G.main->nodetree.first; ngroup; ngroup= ngroup->id.next) {
- if(ngroup->type==snode->treetype)
- tot++;
- }
- if(tot==0) {
- error("No groups available in database");
- return;
- }
- strp= MEM_mallocN(32*tot+32, "menu");
- strcpy(strp, "Add Group %t");
- offs= strlen(strp);
-
- for(tot=0, ngroup= G.main->nodetree.first; ngroup; ngroup= ngroup->id.next, tot++) {
- if(ngroup->type==snode->treetype)
- offs+= sprintf(strp+offs, "|%s %%x%d", ngroup->id.name+2, tot);
- }
-
- val= pupmenu(strp);
- if(val>=0) {
- ngroup= BLI_findlink(&G.main->nodetree, val);
- if(ngroup) {
- bNode *node= nodeAddNodeType(snode->edittree, NODE_GROUP, ngroup);
-
- /* generics */
- if(node) {
- float locx, locy;
- short mval[2];
-
- node_deselectall(snode, 0);
-
- getmouseco_areawin(mval);
- areamouseco_to_ipoco(G.v2d, mval, &locx, &locy);
-
- node->locx= locx;
- node->locy= locy + 60.0f; // arbitrary.. so its visible
- node->flag |= SELECT;
-
- id_us_plus(node->id);
-
- node_set_active(snode, node);
- BIF_undo_push("Add Node");
- }
- }
- }
- MEM_freeN(strp);
-}
-
-
-/* ************************** Node generic ************** */
-
-/* allows to walk the list in order of visibility */
-static bNode *next_node(bNodeTree *ntree)
-{
- static bNode *current=NULL, *last= NULL;
-
- if(ntree) {
- /* set current to the first selected node */
- for(current= ntree->nodes.last; current; current= current->prev)
- if(current->flag & NODE_SELECT)
- break;
-
- /* set last to the first unselected node */
- for(last= ntree->nodes.last; last; last= last->prev)
- if((last->flag & NODE_SELECT)==0)
- break;
-
- if(current==NULL)
- current= last;
-
- return NULL;
- }
- /* no nodes, or we are ready */
- if(current==NULL)
- return NULL;
-
- /* now we walk the list backwards, but we always return current */
- if(current->flag & NODE_SELECT) {
- bNode *node= current;
-
- /* find previous selected */
- current= current->prev;
- while(current && (current->flag & NODE_SELECT)==0)
- current= current->prev;
-
- /* find first unselected */
- if(current==NULL)
- current= last;
-
- return node;
- }
- else {
- bNode *node= current;
-
- /* find previous unselected */
- current= current->prev;
- while(current && (current->flag & NODE_SELECT))
- current= current->prev;
-
- return node;
- }
-
- return NULL;
-}
-
-/* is rct in visible part of node? */
-static bNode *visible_node(SpaceNode *snode, rctf *rct)
-{
- bNode *tnode;
-
- for(next_node(snode->edittree); (tnode=next_node(NULL));) {
- if(BLI_isect_rctf(&tnode->totr, rct, NULL))
- break;
- }
- return tnode;
-}
-
-void snode_home(ScrArea *sa, SpaceNode *snode)
-{
- bNode *node;
- int first= 1;
-
- snode->v2d.cur.xmin= snode->v2d.cur.ymin= 0.0f;
- snode->v2d.cur.xmax= sa->winx;
- snode->v2d.cur.xmax= sa->winy;
-
- if(snode->edittree) {
- for(node= snode->edittree->nodes.first; node; node= node->next) {
- if(first) {
- first= 0;
- snode->v2d.cur= node->totr;
- }
- else {
- BLI_union_rctf(&snode->v2d.cur, &node->totr);
- }
- }
- }
- snode->v2d.tot= snode->v2d.cur;
-
- snode->xof = snode->yof = 0.0;
-
- test_view2d(G.v2d, sa->winx, sa->winy);
-
-}
-
-void snode_zoom_out(ScrArea *sa)
-{
- float dx;
-
- dx= (float)(0.15*(G.v2d->cur.xmax-G.v2d->cur.xmin));
- G.v2d->cur.xmin-= dx;
- G.v2d->cur.xmax+= dx;
- dx= (float)(0.15*(G.v2d->cur.ymax-G.v2d->cur.ymin));
- G.v2d->cur.ymin-= dx;
- G.v2d->cur.ymax+= dx;
- test_view2d(G.v2d, sa->winx, sa->winy);
-}
-
-void snode_zoom_in(ScrArea *sa)
-{
- float dx;
-
- dx= (float)(0.1154*(G.v2d->cur.xmax-G.v2d->cur.xmin));
- G.v2d->cur.xmin+= dx;
- G.v2d->cur.xmax-= dx;
- dx= (float)(0.1154*(G.v2d->cur.ymax-G.v2d->cur.ymin));
- G.v2d->cur.ymin+= dx;
- G.v2d->cur.ymax-= dx;
- test_view2d(G.v2d, sa->winx, sa->winy);
-}
-
-static void snode_bg_viewmove(SpaceNode *snode)
-{
- ScrArea *sa;
- Image *ima;
- ImBuf *ibuf;
- Window *win;
- short mval[2], mvalo[2];
- short rectx, recty, xmin, xmax, ymin, ymax, pad;
- int oldcursor;
-
- ima= BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node");
- ibuf= BKE_image_get_ibuf(ima, NULL);
-
- sa = snode->area;
-
- if(ibuf) {
- rectx = ibuf->x;
- recty = ibuf->y;
- } else {
- rectx = recty = 1;
- }
-
- pad = 10;
- xmin = -(sa->winx/2) - rectx/2 + pad;
- xmax = sa->winx/2 + rectx/2 - pad;
- ymin = -(sa->winy/2) - recty/2 + pad;
- ymax = sa->winy/2 + recty/2 - pad;
-
- getmouseco_sc(mvalo);
-
- /* store the old cursor to temporarily change it */
- oldcursor=get_cursor();
- win=winlay_get_active_window();
-
- SetBlenderCursor(BC_NSEW_SCROLLCURSOR);
-
- while(get_mbut()&(L_MOUSE|M_MOUSE)) {
-
- getmouseco_sc(mval);
-
- if(mvalo[0]!=mval[0] || mvalo[1]!=mval[1]) {
-
- snode->xof -= (mvalo[0]-mval[0]);
- snode->yof -= (mvalo[1]-mval[1]);
-
- /* prevent dragging image outside of the window and losing it! */
- CLAMP(snode->xof, xmin, xmax);
- CLAMP(snode->yof, ymin, ymax);
-
- mvalo[0]= mval[0];
- mvalo[1]= mval[1];
-
- scrarea_do_windraw(curarea);
- screen_swapbuffers();
- }
- else BIF_wait_for_statechange();
- }
-
- window_set_cursor(win, oldcursor);
-}
-
-/* checks mouse position, and returns found node/socket */
-/* type is SOCK_IN and/or SOCK_OUT */
-static int find_indicated_socket(SpaceNode *snode, bNode **nodep, bNodeSocket **sockp, int in_out)
-{
- bNode *node;
- bNodeSocket *sock;
- rctf rect;
- short mval[2];
-
- getmouseco_areawin(mval);
-
- /* check if we click in a socket */
- for(node= snode->edittree->nodes.first; node; node= node->next) {
-
- areamouseco_to_ipoco(G.v2d, mval, &rect.xmin, &rect.ymin);
-
- rect.xmin -= NODE_SOCKSIZE+3;
- rect.ymin -= NODE_SOCKSIZE+3;
- rect.xmax = rect.xmin + 2*NODE_SOCKSIZE+6;
- rect.ymax = rect.ymin + 2*NODE_SOCKSIZE+6;
-
- if (!(node->flag & NODE_HIDDEN)) {
- /* extra padding inside and out - allow dragging on the text areas too */
- if (in_out == SOCK_IN) {
- rect.xmax += NODE_SOCKSIZE;
- rect.xmin -= NODE_SOCKSIZE*4;
- } else if (in_out == SOCK_OUT) {
- rect.xmax += NODE_SOCKSIZE*4;
- rect.xmin -= NODE_SOCKSIZE;
- }
- }
-
- if(in_out & SOCK_IN) {
- for(sock= node->inputs.first; sock; sock= sock->next) {
- if(!(sock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL))) {
- if(BLI_in_rctf(&rect, sock->locx, sock->locy)) {
- if(node == visible_node(snode, &rect)) {
- *nodep= node;
- *sockp= sock;
- return 1;
- }
- }
- }
- }
- }
- if(in_out & SOCK_OUT) {
- for(sock= node->outputs.first; sock; sock= sock->next) {
- if(!(sock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL))) {
- if(BLI_in_rctf(&rect, sock->locx, sock->locy)) {
- if(node == visible_node(snode, &rect)) {
- *nodep= node;
- *sockp= sock;
- return 1;
- }
- }
- }
- }
- }
- }
- return 0;
-}
-
-/* ********************* transform ****************** */
-
-/* releases on event, only intern (for extern see below) */
-/* we need argument ntree to allow operations on edittree or nodetree */
-static void transform_nodes(bNodeTree *ntree, char mode, char *undostr)
-{
- bNode *node;
- float mxstart, mystart, mx, my, *oldlocs, *ol;
- int cont=1, tot=0, cancel=0, firsttime=1;
- short mval[2], mvalo[2];
-
- /* count total */
- for(node= ntree->nodes.first; node; node= node->next)
- if(node->flag & SELECT) tot++;
-
- if(tot==0) return;
-
- /* store oldlocs */
- ol= oldlocs= MEM_mallocN(sizeof(float)*2*tot, "oldlocs transform");
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->flag & SELECT) {
- ol[0]= node->locx; ol[1]= node->locy;
- ol+= 2;
- }
- }
-
- getmouseco_areawin(mvalo);
- areamouseco_to_ipoco(G.v2d, mvalo, &mxstart, &mystart);
-
- while(cont) {
-
- getmouseco_areawin(mval);
- if(mval[0]!=mvalo[0] || mval[1]!=mvalo[1] || firsttime) {
-
- firsttime= 0;
-
- areamouseco_to_ipoco(G.v2d, mval, &mx, &my);
- mvalo[0]= mval[0];
- mvalo[1]= mval[1];
-
- for(ol= oldlocs, node= ntree->nodes.first; node; node= node->next) {
- if(node->flag & SELECT) {
- node->locx= ol[0] + mx-mxstart;
- node->locy= ol[1] + my-mystart;
- ol+= 2;
- }
- }
-
- force_draw(0);
- }
- else
- PIL_sleep_ms(10);
-
- while (qtest()) {
- short val;
- unsigned short event= extern_qread(&val);
-
- switch (event) {
- case LEFTMOUSE:
- case SPACEKEY:
- case RETKEY:
- cont=0;
- break;
- case ESCKEY:
- case RIGHTMOUSE:
- if(val) {
- cancel=1;
- cont=0;
- }
- break;
- default:
- if(val) arrows_move_cursor(event);
- break;
- }
- }
-
- }
-
- if(cancel) {
- for(ol= oldlocs, node= ntree->nodes.first; node; node= node->next) {
- if(node->flag & SELECT) {
- node->locx= ol[0];
- node->locy= ol[1];
- ol+= 2;
- }
- }
-
- }
- else
- BIF_undo_push(undostr);
-
- allqueue(REDRAWNODE, 1);
- MEM_freeN(oldlocs);
-}
-
-/* external call, also for callback */
-void node_transform_ext(int mode, int unused)
-{
- SpaceNode *snode= curarea->spacedata.first;
-
- transform_nodes(snode->edittree, 'g', "Move Node");
-}
-
-
-/* releases on event, only 1 node */
-static void scale_node(SpaceNode *snode, bNode *node)
-{
- float mxstart, mystart, mx, my, oldwidth;
- int cont=1, cancel=0;
- short mval[2], mvalo[2];
-
- /* store old */
- if(node->flag & NODE_HIDDEN)
- oldwidth= node->miniwidth;
- else
- oldwidth= node->width;
-
- getmouseco_areawin(mvalo);
- areamouseco_to_ipoco(G.v2d, mvalo, &mxstart, &mystart);
-
- while(cont) {
-
- getmouseco_areawin(mval);
- if(mval[0]!=mvalo[0] || mval[1]!=mvalo[1]) {
-
- areamouseco_to_ipoco(G.v2d, mval, &mx, &my);
- mvalo[0]= mval[0];
- mvalo[1]= mval[1];
-
- if(node->flag & NODE_HIDDEN) {
- node->miniwidth= oldwidth + mx-mxstart;
- CLAMP(node->miniwidth, 0.0f, 100.0f);
- }
- else {
- node->width= oldwidth + mx-mxstart;
- CLAMP(node->width, node->typeinfo->minwidth, node->typeinfo->maxwidth);
- }
-
- force_draw(0);
- }
- else
- PIL_sleep_ms(10);
-
- while (qtest()) {
- short val;
- unsigned short event= extern_qread(&val);
-
- switch (event) {
- case LEFTMOUSE:
- case SPACEKEY:
- case RETKEY:
- cont=0;
- break;
- case ESCKEY:
- case RIGHTMOUSE:
- if(val) {
- cancel=1;
- cont=0;
- }
- break;
- }
- }
-
- }
-
- if(cancel) {
- node->width= oldwidth;
- }
- else
- BIF_undo_push("Scale Node");
-
- allqueue(REDRAWNODE, 1);
-}
-
-
-
-/* ********************** select ******************** */
-
-/* used in buttons to check context, also checks for edited groups */
-bNode *editnode_get_active_idnode(bNodeTree *ntree, short id_code)
-{
- bNode *node;
-
- /* check for edited group */
- for(node= ntree->nodes.first; node; node= node->next)
- if(node->flag & NODE_GROUP_EDIT)
- break;
- if(node)
- return nodeGetActiveID((bNodeTree *)node->id, id_code);
- else
- return nodeGetActiveID(ntree, id_code);
-}
-
-/* used in buttons to check context, also checks for edited groups */
-Material *editnode_get_active_material(Material *ma)
-{
- if(ma && ma->use_nodes && ma->nodetree) {
- bNode *node= editnode_get_active_idnode(ma->nodetree, ID_MA);
- if(node)
- return (Material *)node->id;
- else
- return NULL;
- }
- return ma;
-}
-
-/* used in buttons to check context, also checks for edited groups */
-bNode *editnode_get_active(bNodeTree *ntree)
-{
- bNode *node;
-
- /* check for edited group */
- for(node= ntree->nodes.first; node; node= node->next)
- if(node->flag & NODE_GROUP_EDIT)
- break;
- if(node)
- return nodeGetActive((bNodeTree *)node->id);
- else
- return nodeGetActive(ntree);
-}
-
-
-/* no undo here! */
-void node_deselectall(SpaceNode *snode, int swap)
-{
- bNode *node;
-
- if(swap) {
- for(node= snode->edittree->nodes.first; node; node= node->next)
- if(node->flag & SELECT)
- break;
- if(node==NULL) {
- for(node= snode->edittree->nodes.first; node; node= node->next)
- node->flag |= SELECT;
- allqueue(REDRAWNODE, 0);
- return;
- }
- /* else pass on to deselect */
- }
-
- for(node= snode->edittree->nodes.first; node; node= node->next)
- node->flag &= ~SELECT;
-
- allqueue(REDRAWNODE, 0);
-}
-
-int node_has_hidden_sockets(bNode *node)
-{
- bNodeSocket *sock;
-
- for(sock= node->inputs.first; sock; sock= sock->next)
- if(sock->flag & SOCK_HIDDEN)
- return 1;
- for(sock= node->outputs.first; sock; sock= sock->next)
- if(sock->flag & SOCK_HIDDEN)
- return 1;
- return 0;
-}
-
-
-static void node_hide_unhide_sockets(SpaceNode *snode, bNode *node)
-{
- bNodeSocket *sock;
-
- /* unhide all */
- if( node_has_hidden_sockets(node) ) {
- for(sock= node->inputs.first; sock; sock= sock->next)
- sock->flag &= ~SOCK_HIDDEN;
- for(sock= node->outputs.first; sock; sock= sock->next)
- sock->flag &= ~SOCK_HIDDEN;
- }
- else {
- bNode *gnode= snode_get_editgroup(snode);
-
- /* hiding inside group should not break links in other group users */
- if(gnode) {
- nodeGroupSocketUseFlags((bNodeTree *)gnode->id);
- for(sock= node->inputs.first; sock; sock= sock->next)
- if(!(sock->flag & SOCK_IN_USE))
- if(sock->link==NULL)
- sock->flag |= SOCK_HIDDEN;
- for(sock= node->outputs.first; sock; sock= sock->next)
- if(!(sock->flag & SOCK_IN_USE))
- if(nodeCountSocketLinks(snode->edittree, sock)==0)
- sock->flag |= SOCK_HIDDEN;
- }
- else {
- /* hide unused sockets */
- for(sock= node->inputs.first; sock; sock= sock->next) {
- if(sock->link==NULL)
- sock->flag |= SOCK_HIDDEN;
- }
- for(sock= node->outputs.first; sock; sock= sock->next) {
- if(nodeCountSocketLinks(snode->edittree, sock)==0)
- sock->flag |= SOCK_HIDDEN;
- }
- }
- }
-
- allqueue(REDRAWNODE, 1);
- snode_verify_groups(snode);
- BIF_undo_push("Hide/Unhide sockets");
-
-}
-
-static int do_header_node(SpaceNode *snode, bNode *node, float mx, float my)
-{
- rctf totr= node->totr;
-
- totr.ymin= totr.ymax-20.0f;
-
- totr.xmax= totr.xmin+15.0f;
- if(BLI_in_rctf(&totr, mx, my)) {
- node->flag |= NODE_HIDDEN;
- allqueue(REDRAWNODE, 0);
- return 1;
- }
-
- totr.xmax= node->totr.xmax;
- totr.xmin= totr.xmax-18.0f;
- if(node->typeinfo->flag & NODE_PREVIEW) {
- if(BLI_in_rctf(&totr, mx, my)) {
- node->flag ^= NODE_PREVIEW;
- allqueue(REDRAWNODE, 0);
- return 1;
- }
- totr.xmin-=18.0f;
- }
- if(node->type == NODE_GROUP) {
- if(BLI_in_rctf(&totr, mx, my)) {
- snode_make_group_editable(snode, node);
- return 1;
- }
- totr.xmin-=18.0f;
- }
- if(node->typeinfo->flag & NODE_OPTIONS) {
- if(BLI_in_rctf(&totr, mx, my)) {
- node->flag ^= NODE_OPTIONS;
- allqueue(REDRAWNODE, 0);
- return 1;
- }
- totr.xmin-=18.0f;
- }
- /* hide unused sockets */
- if(BLI_in_rctf(&totr, mx, my)) {
- node_hide_unhide_sockets(snode, node);
- }
-
-
- totr= node->totr;
- totr.xmin= totr.xmax-10.0f;
- totr.ymax= totr.ymin+10.0f;
- if(BLI_in_rctf(&totr, mx, my)) {
- scale_node(snode, node);
- return 1;
- }
- return 0;
-}
-
-static int do_header_hidden_node(SpaceNode *snode, bNode *node, float mx, float my)
-{
- rctf totr= node->totr;
-
- totr.xmax= totr.xmin+15.0f;
- if(BLI_in_rctf(&totr, mx, my)) {
- node->flag &= ~NODE_HIDDEN;
- allqueue(REDRAWNODE, 0);
- return 1;
- }
-
- totr.xmax= node->totr.xmax;
- totr.xmin= node->totr.xmax-15.0f;
- if(BLI_in_rctf(&totr, mx, my)) {
- scale_node(snode, node);
- return 1;
- }
- return 0;
-}
-
-
-/* return 0: nothing done */
-static int node_mouse_select(SpaceNode *snode, unsigned short event)
-{
- bNode *node;
- float mx, my;
- short mval[2];
-
- getmouseco_areawin(mval);
- areamouseco_to_ipoco(G.v2d, mval, &mx, &my);
-
- for(next_node(snode->edittree); (node=next_node(NULL));) {
-
- /* first check for the headers or scaling widget */
- if(node->flag & NODE_HIDDEN) {
- if(do_header_hidden_node(snode, node, mx, my))
- return 1;
- }
- else {
- if(do_header_node(snode, node, mx, my))
- return 1;
- }
-
- /* node body */
- if(BLI_in_rctf(&node->totr, mx, my))
- break;
- }
- if(node) {
- if((G.qual & LR_SHIFTKEY)==0)
- node_deselectall(snode, 0);
-
- if(G.qual & LR_SHIFTKEY) {
- if(node->flag & SELECT)
- node->flag &= ~SELECT;
- else
- node->flag |= SELECT;
- }
- else
- node->flag |= SELECT;
-
- node_set_active(snode, node);
-
- /* not so nice (no event), but function below delays redraw otherwise */
- force_draw(0);
-
- std_rmouse_transform(node_transform_ext); /* does undo push for select */
-
- return 1;
- }
- return 0;
-}
-
-/* return 0, nothing done */
-static int node_mouse_groupheader(SpaceNode *snode)
-{
- bNode *gnode;
- float mx, my;
- short mval[2];
-
- gnode= snode_get_editgroup(snode);
- if(gnode==NULL) return 0;
-
- getmouseco_areawin(mval);
- areamouseco_to_ipoco(G.v2d, mval, &mx, &my);
-
- /* click in header or outside? */
- if(BLI_in_rctf(&gnode->totr, mx, my)==0) {
- rctf rect= gnode->totr;
-
- rect.ymax += NODE_DY;
- if(BLI_in_rctf(&rect, mx, my)==0)
- snode_make_group_editable(snode, NULL); /* toggles, so exits editmode */
- else
- transform_nodes(snode->nodetree, 'g', "Move group");
-
- return 1;
- }
- return 0;
-}
-
-static int node_socket_hilights(SpaceNode *snode, int in_out)
-{
- bNode *node;
- bNodeSocket *sock, *tsock, *socksel= NULL;
- float mx, my;
- short mval[2], redraw= 0;
-
- if(snode->edittree==NULL) return 0;
-
- getmouseco_areawin(mval);
- areamouseco_to_ipoco(G.v2d, mval, &mx, &my);
-
- /* deselect socks */
- for(node= snode->edittree->nodes.first; node; node= node->next) {
- for(sock= node->inputs.first; sock; sock= sock->next) {
- if(sock->flag & SELECT) {
- sock->flag &= ~SELECT;
- redraw++;
- socksel= sock;
- }
- }
- for(sock= node->outputs.first; sock; sock= sock->next) {
- if(sock->flag & SELECT) {
- sock->flag &= ~SELECT;
- redraw++;
- socksel= sock;
- }
- }
- }
-
- if(find_indicated_socket(snode, &node, &tsock, in_out)) {
- tsock->flag |= SELECT;
- if(redraw==1 && tsock==socksel) redraw= 0;
- else redraw= 1;
- }
-
- return redraw;
-}
-
-void node_border_select(SpaceNode *snode)
-{
- bNode *node;
- rcti rect;
- rctf rectf;
- short val, mval[2];
-
- if ( (val = get_border(&rect, 3)) ) {
-
- mval[0]= rect.xmin;
- mval[1]= rect.ymin;
- areamouseco_to_ipoco(G.v2d, mval, &rectf.xmin, &rectf.ymin);
- mval[0]= rect.xmax;
- mval[1]= rect.ymax;
- areamouseco_to_ipoco(G.v2d, mval, &rectf.xmax, &rectf.ymax);
-
- for(node= snode->edittree->nodes.first; node; node= node->next) {
- if(BLI_isect_rctf(&rectf, &node->totr, NULL)) {
- if(val==LEFTMOUSE)
- node->flag |= SELECT;
- else
- node->flag &= ~SELECT;
- }
- }
- allqueue(REDRAWNODE, 1);
- BIF_undo_push("Border select nodes");
- }
-}
-
-/* ****************** Add *********************** */
-
-void snode_autoconnect(SpaceNode *snode, bNode *node_to, int flag)
-{
- bNodeSocket *sock, *sockfrom[8];
- bNode *node, *nodefrom[8];
- int totsock= 0, socktype=0;
-
- if(node_to==NULL || node_to->inputs.first==NULL)
- return;
-
- /* no inputs for node allowed (code it) */
-
- /* connect first 1 socket type now */
- for(sock= node_to->inputs.first; sock; sock= sock->next)
- if(socktype<sock->type)
- socktype= sock->type;
-
-
- /* find potential sockets, max 8 should work */
- for(node= snode->edittree->nodes.first; node; node= node->next) {
- if((node->flag & flag) && node!=node_to) {
- for(sock= node->outputs.first; sock; sock= sock->next) {
- if(!(sock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL))) {
- sockfrom[totsock]= sock;
- nodefrom[totsock]= node;
- totsock++;
- if(totsock>7)
- break;
- }
- }
- }
- if(totsock>7)
- break;
- }
-
- /* now just get matching socket types and create links */
- for(sock= node_to->inputs.first; sock; sock= sock->next) {
- int a;
-
- for(a=0; a<totsock; a++) {
- if(sockfrom[a]) {
- if(sock->type==sockfrom[a]->type && sock->type==socktype) {
- nodeAddLink(snode->edittree, nodefrom[a], sockfrom[a], node_to, sock);
- sockfrom[a]= NULL;
- break;
- }
- }
- }
- }
-
- ntreeSolveOrder(snode->edittree);
-}
-
-/* can be called from menus too, but they should do own undopush and redraws */
-bNode *node_add_node(SpaceNode *snode, int type, float locx, float locy)
-{
- bNode *node= NULL, *gnode;
-
- node_deselectall(snode, 0);
-
- if(type>=NODE_GROUP_MENU) {
- if(snode->edittree!=snode->nodetree) {
- error("Can not add a Group in a Group");
- return NULL;
- }
- else {
- bNodeTree *ngroup= BLI_findlink(&G.main->nodetree, type-NODE_GROUP_MENU);
- if(ngroup)
- node= nodeAddNodeType(snode->edittree, NODE_GROUP, ngroup);
- }
- }
- else
- node= nodeAddNodeType(snode->edittree, type, NULL);
-
- /* generics */
- if(node) {
- node->locx= locx;
- node->locy= locy + 60.0f; // arbitrary.. so its visible
- node->flag |= SELECT;
-
- gnode= snode_get_editgroup(snode);
- if(gnode) {
- node->locx -= gnode->locx;
- node->locy -= gnode->locy;
- }
-
- snode_verify_groups(snode);
- node_set_active(snode, node);
-
- if(node->id)
- id_us_plus(node->id);
-
- if(snode->nodetree->type==NTREE_COMPOSIT)
- ntreeCompositForceHidden(snode->edittree);
-
- NodeTagChanged(snode->edittree, node);
- }
- return node;
-}
-
-void node_adduplicate(SpaceNode *snode)
-{
-
- ntreeCopyTree(snode->edittree, 1); /* 1 == internally selected nodes */
-
- ntreeSolveOrder(snode->edittree);
- snode_verify_groups(snode);
- snode_handle_recalc(snode);
-
- transform_nodes(snode->edittree, 'g', "Duplicate");
-}
-
-#if 0
-static void node_insert_convertor(SpaceNode *snode, bNodeLink *link)
-{
- bNode *newnode= NULL;
-
- if(link->fromsock->type==SOCK_RGBA && link->tosock->type==SOCK_VALUE) {
- if(snode->edittree->type==NTREE_SHADER)
- newnode= node_add_node(snode, SH_NODE_RGBTOBW, 0.0f, 0.0f);
- else if(snode->edittree->type==NTREE_COMPOSIT)
- newnode= node_add_node(snode, CMP_NODE_RGBTOBW, 0.0f, 0.0f);
- else
- newnode= NULL;
- }
- else if(link->fromsock->type==SOCK_VALUE && link->tosock->type==SOCK_RGBA) {
- if(snode->edittree->type==NTREE_SHADER)
- newnode= node_add_node(snode, SH_NODE_VALTORGB, 0.0f, 0.0f);
- else if(snode->edittree->type==NTREE_COMPOSIT)
- newnode= node_add_node(snode, CMP_NODE_VALTORGB, 0.0f, 0.0f);
- else
- newnode= NULL;
- }
-
- if(newnode) {
- /* dangerous assumption to use first in/out socks, but thats fine for now */
- newnode->flag |= NODE_HIDDEN;
- newnode->locx= 0.5f*(link->fromsock->locx + link->tosock->locx);
- newnode->locy= 0.5f*(link->fromsock->locy + link->tosock->locy) + HIDDEN_RAD;
-
- nodeAddLink(snode->edittree, newnode, newnode->outputs.first, link->tonode, link->tosock);
- link->tonode= newnode;
- link->tosock= newnode->inputs.first;
- }
-}
-
-#endif
-
-/* loop that adds a nodelink, called by function below */
-/* in_out = starting socket */
-static int node_add_link_drag(SpaceNode *snode, bNode *node, bNodeSocket *sock, int in_out)
-{
- bNode *tnode;
- bNodeSocket *tsock= NULL;
- bNodeLink *link= NULL;
- short mval[2], mvalo[2], firsttime=1; /* firsttime reconnects a link broken by caller */
-
- /* we make a temporal link */
- if(in_out==SOCK_OUT)
- link= nodeAddLink(snode->edittree, node, sock, NULL, NULL);
- else
- link= nodeAddLink(snode->edittree, NULL, NULL, node, sock);
-
- getmouseco_areawin(mvalo);
- while (get_mbut() & L_MOUSE) {
-
- getmouseco_areawin(mval);
- if(mval[0]!=mvalo[0] || mval[1]!=mvalo[1] || firsttime) {
- firsttime= 0;
-
- mvalo[0]= mval[0];
- mvalo[1]= mval[1];
-
- if(in_out==SOCK_OUT) {
- if(find_indicated_socket(snode, &tnode, &tsock, SOCK_IN)) {
- if(nodeFindLink(snode->edittree, sock, tsock)==NULL) {
- if(tnode!=node && link->tonode!=tnode && link->tosock!= tsock) {
- link->tonode= tnode;
- link->tosock= tsock;
- ntreeSolveOrder(snode->edittree); /* for interactive red line warning */
- }
- }
- }
- else {
- link->tonode= NULL;
- link->tosock= NULL;
- }
- }
- else {
- if(find_indicated_socket(snode, &tnode, &tsock, SOCK_OUT)) {
- if(nodeFindLink(snode->edittree, sock, tsock)==NULL) {
- if(nodeCountSocketLinks(snode->edittree, tsock) < tsock->limit) {
- if(tnode!=node && link->fromnode!=tnode && link->fromsock!= tsock) {
- link->fromnode= tnode;
- link->fromsock= tsock;
- ntreeSolveOrder(snode->edittree); /* for interactive red line warning */
- }
- }
- }
- }
- else {
- link->fromnode= NULL;
- link->fromsock= NULL;
- }
- }
- /* hilight target sockets only */
- node_socket_hilights(snode, in_out==SOCK_OUT?SOCK_IN:SOCK_OUT);
-
- force_draw(0);
- }
- else BIF_wait_for_statechange();
- }
-
- /* remove link? */
- if(link->tonode==NULL || link->fromnode==NULL) {
- nodeRemLink(snode->edittree, link);
- }
- else {
- bNodeLink *tlink;
-
- /* send changed events for original tonode and new */
- if(link->tonode)
- NodeTagChanged(snode->edittree, link->tonode);
-
- /* we might need to remove a link */
- if(in_out==SOCK_OUT) {
- if(tsock && nodeCountSocketLinks(snode->edittree, link->tosock) > tsock->limit) {
-
- for(tlink= snode->edittree->links.first; tlink; tlink= tlink->next) {
- if(link!=tlink && tlink->tosock==link->tosock)
- break;
- }
- if(tlink) {
- /* is there a free input socket with same type? */
- for(tsock= tlink->tonode->inputs.first; tsock; tsock= tsock->next) {
- if(tsock->type==tlink->fromsock->type)
- if(nodeCountSocketLinks(snode->edittree, tsock) < tsock->limit)
- break;
- }
- if(tsock)
- tlink->tosock= tsock;
- else {
- nodeRemLink(snode->edittree, tlink);
- }
- }
- }
- }
- }
-
- ntreeSolveOrder(snode->edittree);
- snode_verify_groups(snode);
- snode_handle_recalc(snode);
-
- allqueue(REDRAWNODE, 0);
- BIF_undo_push("Add link");
-
- return 1;
-}
-
-/* return 1 when socket clicked */
-static int node_add_link(SpaceNode *snode)
-{
- bNode *node;
- bNodeLink *link;
- bNodeSocket *sock;
-
- /* output indicated? */
- if(find_indicated_socket(snode, &node, &sock, SOCK_OUT)) {
- if(nodeCountSocketLinks(snode->edittree, sock)<sock->limit)
- return node_add_link_drag(snode, node, sock, SOCK_OUT);
- else {
- /* find if we break a link */
- for(link= snode->edittree->links.first; link; link= link->next) {
- if(link->fromsock==sock)
- break;
- }
- if(link) {
- node= link->tonode;
- sock= link->tosock;
- nodeRemLink(snode->edittree, link);
- return node_add_link_drag(snode, node, sock, SOCK_IN);
- }
- }
- }
- /* or an input? */
- else if(find_indicated_socket(snode, &node, &sock, SOCK_IN)) {
- if(nodeCountSocketLinks(snode->edittree, sock)<sock->limit)
- return node_add_link_drag(snode, node, sock, SOCK_IN);
- else {
- /* find if we break a link */
- for(link= snode->edittree->links.first; link; link= link->next) {
- if(link->tosock==sock)
- break;
- }
- if(link) {
- /* send changed event to original tonode */
- if(link->tonode)
- NodeTagChanged(snode->edittree, link->tonode);
-
- node= link->fromnode;
- sock= link->fromsock;
- nodeRemLink(snode->edittree, link);
- return node_add_link_drag(snode, node, sock, SOCK_OUT);
- }
- }
- }
-
- return 0;
-}
-
-void node_delete(SpaceNode *snode)
-{
- bNode *node, *next;
-
- for(node= snode->edittree->nodes.first; node; node= next) {
- next= node->next;
- if(node->flag & SELECT) {
- /* check id user here, nodeFreeNode is called for free dbase too */
- if(node->id)
- node->id->us--;
- nodeFreeNode(snode->edittree, node);
- }
- }
-
- snode_verify_groups(snode);
- snode_handle_recalc(snode);
- BIF_undo_push("Delete nodes");
- allqueue(REDRAWNODE, 1);
-}
-
-void node_hide(SpaceNode *snode)
-{
- bNode *node;
- int nothidden=0, ishidden=0;
-
- for(node= snode->edittree->nodes.first; node; node= node->next) {
- if(node->flag & SELECT) {
- if(node->flag & NODE_HIDDEN)
- ishidden++;
- else
- nothidden++;
- }
- }
- for(node= snode->edittree->nodes.first; node; node= node->next) {
- if(node->flag & SELECT) {
- if( (ishidden && nothidden) || ishidden==0)
- node->flag |= NODE_HIDDEN;
- else
- node->flag &= ~NODE_HIDDEN;
- }
- }
- BIF_undo_push("Hide nodes");
- allqueue(REDRAWNODE, 1);
-}
-
-void node_insert_key(SpaceNode *snode)
-{
- bNode *node= editnode_get_active(snode->edittree);
-
- if(node->type==CMP_NODE_TIME) {
- if(node->custom1<node->custom2) {
-
- CurveMapping *cumap= node->storage;
- float fval, curval;
-
- curval= (float)(CFRA - node->custom1)/(float)(node->custom2-node->custom1);
- fval= curvemapping_evaluateF(cumap, 0, curval);
-
- if(fbutton(&fval, 0.0f, 1.0f, 10, 10, "Insert Value")) {
- curvemap_insert(cumap->cm, curval, fval);
-
- BIF_undo_push("Insert key in Time node");
- allqueue(REDRAWNODE, 1);
- }
- }
- }
-}
-
-void node_select_linked(SpaceNode *snode, int out)
-{
- bNodeLink *link;
- bNode *node;
-
- /* NODE_TEST is the free flag */
- for(node= snode->edittree->nodes.first; node; node= node->next)
- node->flag &= ~NODE_TEST;
-
- for(link= snode->edittree->links.first; link; link= link->next) {
- if(out) {
- if(link->fromnode->flag & NODE_SELECT)
- link->tonode->flag |= NODE_TEST;
- }
- else {
- if(link->tonode->flag & NODE_SELECT)
- link->fromnode->flag |= NODE_TEST;
- }
- }
-
- for(node= snode->edittree->nodes.first; node; node= node->next)
- if(node->flag & NODE_TEST)
- node->flag |= NODE_SELECT;
-
- BIF_undo_push("Select Linked nodes");
- allqueue(REDRAWNODE, 1);
-}
-
-static void node_border_link_delete(SpaceNode *snode)
-{
- rcti rect;
- short val, mval[2], mvalo[2];
-
- /* to make this work more friendly, we first wait for a mouse move */
- getmouseco_areawin(mvalo);
- while (get_mbut() & L_MOUSE) {
- getmouseco_areawin(mval);
- if(mval[0]!=mvalo[0] || mval[1]!=mvalo[1])
- break;
- else BIF_wait_for_statechange();
- }
- if((get_mbut() & L_MOUSE)==0)
- return;
-
- /* now change cursor and draw border */
- setcursor_space(SPACE_NODE, CURSOR_VPAINT);
-
- if ( (val = get_border(&rect, 2)) ) {
- if(rect.xmin<rect.xmax && rect.ymin<rect.ymax) {
- //#define NODE_MAXPICKBUF 256
- bNodeLink *link, *next;
- GLuint buffer[256];
- rctf rectf;
- int code=0, hits;
-
- mval[0]= rect.xmin;
- mval[1]= rect.ymin;
- areamouseco_to_ipoco(&snode->v2d, mval, &rectf.xmin, &rectf.ymin);
- mval[0]= rect.xmax;
- mval[1]= rect.ymax;
- areamouseco_to_ipoco(&snode->v2d, mval, &rectf.xmax, &rectf.ymax);
-
- myortho2(rectf.xmin, rectf.xmax, rectf.ymin, rectf.ymax);
-
- glSelectBuffer(256, buffer);
- glRenderMode(GL_SELECT);
- glInitNames();
- glPushName(-1);
-
- /* draw links */
- for(link= snode->edittree->links.first; link; link= link->next) {
- glLoadName(code++);
- node_draw_link(snode, link);
- }
-
- hits= glRenderMode(GL_RENDER);
- glPopName();
- if(hits>0) {
- int a;
- for(a=0; a<hits; a++) {
- bNodeLink *link= BLI_findlink(&snode->edittree->links, buffer[ (4 * a) + 3]);
- if(link)
- link->fromnode= NULL; /* first tag for delete, otherwise indices are wrong */
- }
- for(link= snode->edittree->links.first; link; link= next) {
- next= link->next;
- if(link->fromnode==NULL) {
- NodeTagChanged(snode->edittree, link->tonode);
- nodeRemLink(snode->edittree, link);
- }
- }
- ntreeSolveOrder(snode->edittree);
- snode_verify_groups(snode);
- snode_handle_recalc(snode);
- }
- allqueue(REDRAWNODE, 0);
- BIF_undo_push("Erase links");
- }
- }
-
- setcursor_space(SPACE_NODE, CURSOR_STD);
-}
-
-/* goes over all scenes, reads render layerss */
-void node_read_renderlayers(SpaceNode *snode)
-{
- Scene *scene;
- bNode *node;
-
- /* first tag scenes unread */
- for(scene= G.main->scene.first; scene; scene= scene->id.next)
- scene->id.flag |= LIB_DOIT;
-
- for(node= snode->edittree->nodes.first; node; node= node->next) {
- if(node->type==CMP_NODE_R_LAYERS) {
- ID *id= node->id;
- if(id==NULL) id= (ID *)G.scene;
- if(id->flag & LIB_DOIT) {
- RE_ReadRenderResult(G.scene, (Scene *)id);
- ntreeCompositTagRender((Scene *)id);
- id->flag &= ~LIB_DOIT;
- }
- }
- }
-
- snode_handle_recalc(snode);
-}
-
-/* called from header_info, when deleting a scene
- * goes over all scenes other than the input, checks if they have
- * render layer nodes referencing the to-be-deleted scene, and
- * resets them to NULL. */
-void clear_scene_in_nodes(Scene *sce)
-{
- Scene *sce1;
- bNode *node;
-
- sce1= G.main->scene.first;
- while(sce1) {
- if(sce1!=sce) {
- if (sce1->nodetree) {
- for(node= sce1->nodetree->nodes.first; node; node= node->next) {
- if(node->type==CMP_NODE_R_LAYERS) {
- Scene *nodesce= (Scene *)node->id;
-
- if (nodesce==sce) node->id = NULL;
- }
- }
- }
- }
- sce1= sce1->id.next;
- }
-}
-
-
-/* gets active viewer user */
-struct ImageUser *ntree_get_active_iuser(bNodeTree *ntree)
-{
- bNode *node;
-
- if(ntree)
- for(node= ntree->nodes.first; node; node= node->next)
- if( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
- if(node->flag & NODE_DO_OUTPUT)
- return node->storage;
- return NULL;
-}
-
-void imagepaint_composite_tags(bNodeTree *ntree, Image *image, ImageUser *iuser)
-{
- bNode *node;
-
- if(ntree==NULL)
- return;
-
- /* search for renderresults */
- if(image->type==IMA_TYPE_R_RESULT) {
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->type==CMP_NODE_R_LAYERS && node->id==NULL) {
- /* imageuser comes from ImageWin, so indexes are offset 1 */
- if(node->custom1==iuser->layer-1)
- NodeTagChanged(ntree, node);
- }
- }
- }
- else {
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->id== &image->id)
- NodeTagChanged(ntree, node);
- }
- }
-}
-
-/* ********************** */
-
-void node_make_group(SpaceNode *snode)
-{
- bNode *gnode;
-
- if(snode->edittree!=snode->nodetree) {
- error("Can not add a new Group in a Group");
- return;
- }
-
- /* for time being... is too complex to handle */
- if(snode->treetype==NTREE_COMPOSIT) {
- for(gnode=snode->nodetree->nodes.first; gnode; gnode= gnode->next) {
- if(gnode->flag & SELECT)
- if(gnode->type==CMP_NODE_R_LAYERS)
- break;
- }
- if(gnode) {
- error("Can not add RenderLayer in a Group");
- return;
- }
- }
-
- gnode= nodeMakeGroupFromSelected(snode->nodetree);
- if(gnode==NULL) {
- error("Can not make Group");
- }
- else {
- nodeSetActive(snode->nodetree, gnode);
- ntreeSolveOrder(snode->nodetree);
- allqueue(REDRAWNODE, 0);
- BIF_undo_push("Make Node Group");
- }
-}
-
-/* ******************** main event loop ****************** */
-
-/* special version to prevent overlapping buttons, has a bit of hack... */
-/* yes, check for example composit_node_event(), file window use... */
-static int node_uiDoBlocks(ScrArea *sa, short event)
-{
- SpaceNode *snode= sa->spacedata.first;
- ListBase *lb= &sa->uiblocks;
- ListBase listb= *lb;
- bNode *node;
- rctf rect;
- void *prev, *next;
- int retval= UI_NOTHING;
- short mval[2];
-
- getmouseco_areawin(mval);
- areamouseco_to_ipoco(G.v2d, mval, &rect.xmin, &rect.ymin);
-
- /* this happens after filesel usage... */
- if(lb->first==NULL) {
- return UI_NOTHING;
- }
-
- rect.xmin -= 2.0f;
- rect.ymin -= 2.0f;
- rect.xmax = rect.xmin + 4.0f;
- rect.ymax = rect.ymin + 4.0f;
-
- for(node= snode->edittree->nodes.first; node; node= node->next) {
- uiBlock *block;
- char str[32];
-
- /* retreive unique block name, see also drawnode.c */
- sprintf(str, "node buttons %p", node);
- block= uiGetBlock(str, sa);
-
- if(block) {
- if(node == visible_node(snode, &rect)) {
-
- /* when there's menus, the prev pointer becomes zero! */
- prev= ((struct Link *)block)->prev;
- next= ((struct Link *)block)->next;
- ((struct Link *)block)->prev= NULL;
- ((struct Link *)block)->next= NULL;
-
- lb->first= lb->last= block;
- retval= uiDoBlocks(lb, event, 1);
-
- ((struct Link *)block)->prev= prev;
- ((struct Link *)block)->next= next;
-
- break;
- }
- }
- }
-
- *lb= listb;
-
- return retval;
-}
-
-void winqreadnodespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
-{
- SpaceNode *snode= spacedata;
- unsigned short event= evt->event;
- short val= evt->val, doredraw=0, fromlib= 0;
-
- if(sa->win==0) return;
- if(snode->nodetree==NULL) return;
-
- if(val) {
-
- if( node_uiDoBlocks(sa, event)!=UI_NOTHING ) event= 0;
-
- fromlib= (snode->id && snode->id->lib);
-
- switch(event) {
- case LEFTMOUSE:
- if(fromlib) {
- if(node_mouse_groupheader(snode)==0)
- node_mouse_select(snode, event);
- }
- else {
- if(node_add_link(snode)==0)
- if(node_mouse_groupheader(snode)==0)
- if(node_mouse_select(snode, event)==0)
- node_border_link_delete(snode);
- }
- break;
-
- case RIGHTMOUSE:
- if(!node_mouse_select(snode, event))
- toolbox_n();
-
- break;
- case MIDDLEMOUSE:
- if (G.qual==LR_SHIFTKEY) {
- snode_bg_viewmove(snode);
- } else {
- view2dmove(event);
- }
- case WHEELUPMOUSE:
- case WHEELDOWNMOUSE:
- view2dmove(event); /* in drawipo.c */
- break;
-
- case MOUSEY:
- doredraw= node_socket_hilights(snode, SOCK_IN|SOCK_OUT);
- break;
-
- case UI_BUT_EVENT:
- /* future: handlerize this! */
- if(snode->treetype==NTREE_SHADER)
- shader_node_event(snode, val);
- else if(snode->treetype==NTREE_COMPOSIT)
- composit_node_event(snode, val);
- break;
-
- case RENDERPREVIEW:
- if(snode->treetype==NTREE_SHADER)
- shader_node_previewrender(sa, snode);
- break;
-
- case PADPLUSKEY:
- snode_zoom_in(sa);
- doredraw= 1;
- break;
- case PADMINUS:
- snode_zoom_out(sa);
- doredraw= 1;
- break;
- case HOMEKEY:
- snode_home(sa, snode);
- doredraw= 1;
- break;
- case TABKEY:
- if(fromlib) fromlib= -1;
- else snode_make_group_editable(snode, NULL);
- break;
-
- case AKEY:
- if(G.qual==LR_SHIFTKEY) {
- if(fromlib) fromlib= -1;
- else toolbox_n_add();
- }
- else if(G.qual==0) {
- node_deselectall(snode, 1);
- BIF_undo_push("Deselect all nodes");
- }
- break;
- case BKEY:
- if(G.qual==0)
- node_border_select(snode);
- break;
- case CKEY: /* sort again, showing cyclics */
- ntreeSolveOrder(snode->edittree);
- doredraw= 1;
- break;
- case DKEY:
- if(G.qual==LR_SHIFTKEY) {
- if(fromlib) fromlib= -1;
- else node_adduplicate(snode);
- }
- break;
- case EKEY:
- snode_handle_recalc(snode);
- break;
- case GKEY:
- if(fromlib) fromlib= -1;
- else {
- if(G.qual==LR_CTRLKEY) {
- if(okee("Make Group"))
- node_make_group(snode);
- }
- else if(G.qual==LR_ALTKEY) {
- if(okee("Ungroup"))
- node_ungroup(snode);
- }
- else if(G.qual==LR_SHIFTKEY) {
- node_addgroup(snode);
- }
- else
- transform_nodes(snode->edittree, 'g', "Move Node");
- }
- break;
- case HKEY:
- node_hide(snode);
- break;
- case IKEY:
- node_insert_key(snode);
- break;
- case LKEY:
- node_select_linked(snode, G.qual==LR_SHIFTKEY);
- break;
- case RKEY:
- if(okee("Read saved Render Layers"))
- node_read_renderlayers(snode);
- break;
- case DELKEY:
- case XKEY:
- if(fromlib) fromlib= -1;
- else node_delete(snode);
- break;
- }
- }
-
- if(fromlib==-1)
- error_libdata();
- if(doredraw)
- scrarea_queue_winredraw(sa);
- if(doredraw==2)
- scrarea_queue_headredraw(sa);
-}
-
-
diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c
deleted file mode 100644
index c563548759c..00000000000
--- a/source/blender/src/editobject.c
+++ /dev/null
@@ -1,5620 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-/**
- * Theorie: (matrices) A x B x C == A x ( B x C x Binv) x B
- * ofwel: OB x PAR x EDIT = OB x (PAR x EDIT x PARinv) x PAR
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef WIN32
-#include <unistd.h>
-#else
-#include <io.h>
-#endif
-#include "MEM_guardedalloc.h"
-#include "PIL_time.h"
-
-#include "BMF_Api.h"
-
-
-#include "IMB_imbuf_types.h"
-
-#include "DNA_action_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_effect_types.h"
-#include "DNA_group_types.h"
-#include "DNA_image_types.h"
-#include "DNA_ipo_types.h"
-#include "DNA_key_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_lattice_types.h"
-#include "DNA_material_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_meta_types.h"
-#include "DNA_nla_types.h"
-#include "DNA_object_types.h"
-#include "DNA_object_fluidsim.h"
-#include "DNA_object_force.h"
-#include "DNA_scene_types.h"
-#include "DNA_space_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_particle_types.h"
-#include "DNA_property_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_vfont_types.h"
-#include "DNA_world_types.h"
-#include "DNA_modifier_types.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_editVert.h"
-#include "BLI_ghash.h"
-
-#include "BKE_action.h"
-#include "BKE_anim.h"
-#include "BKE_armature.h"
-#include "BKE_constraint.h"
-#include "BKE_customdata.h"
-#include "BKE_blender.h"
-#include "BKE_booleanops.h"
-#include "BKE_curve.h"
-#include "BKE_displist.h"
-#include "BKE_depsgraph.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_effect.h"
-#include "BKE_font.h"
-#include "BKE_global.h"
-#include "BKE_group.h"
-#include "BKE_ipo.h"
-#include "BKE_image.h"
-#include "BKE_key.h"
-#include "BKE_lattice.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
-#include "BKE_material.h"
-#include "BKE_mball.h"
-#include "BKE_mesh.h"
-#include "BKE_nla.h"
-#include "BKE_object.h"
-#include "BKE_particle.h"
-#include "BKE_property.h"
-#include "BKE_sca.h"
-#include "BKE_scene.h"
-#include "BKE_softbody.h"
-#include "BKE_subsurf.h"
-#include "BKE_texture.h"
-#include "BKE_utildefines.h"
-#include "BKE_modifier.h"
-
-#include "BIF_butspace.h"
-#include "BIF_editconstraint.h"
-#include "BIF_editdeform.h"
-#include "BIF_editfont.h"
-#include "BIF_editlattice.h"
-#include "BIF_editmesh.h"
-#include "BIF_editoops.h"
-#include "BIF_editparticle.h"
-#include "BIF_editview.h"
-#include "BIF_editarmature.h"
-#include "BIF_gl.h"
-#include "BIF_graphics.h"
-#include "BIF_interface.h"
-#include "BIF_meshtools.h"
-#include "BIF_mywindow.h"
-#include "BIF_resources.h"
-#include "BIF_retopo.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-#include "BIF_toets.h"
-
-#ifdef WITH_VERSE
-#include "BIF_verse.h"
-#endif
-
-#include "BSE_edit.h"
-#include "BSE_editipo.h"
-#include "BSE_filesel.h" /* For activate_databrowse() */
-#include "BSE_view.h"
-#include "BSE_drawview.h"
-#include "BSE_trans_types.h"
-#include "BSE_editipo_types.h"
-
-#include "BDR_vpaint.h"
-#include "BDR_sculptmode.h"
-#include "BDR_editface.h"
-#include "BDR_editmball.h"
-#include "BDR_editobject.h"
-#include "BDR_drawobject.h"
-#include "BDR_editcurve.h"
-#include "BDR_unwrapper.h"
-
-#include <time.h>
-#include "mydevice.h"
-#include "nla.h"
-
-#include "blendef.h"
-#include "butspace.h"
-#include "multires.h"
-#include "BIF_transform.h"
-
-#include "BIF_poseobject.h"
-
-
-/* --------------------------------- */
-
-void exit_paint_modes(void)
-{
- if(G.f & G_VERTEXPAINT) set_vpaint();
- if(G.f & G_TEXTUREPAINT) set_texturepaint();
- if(G.f & G_WEIGHTPAINT) set_wpaint();
- if(G.f & G_SCULPTMODE) set_sculptmode();
- if(G.f & G_PARTICLEEDIT) PE_set_particle_edit();
-
- G.f &= ~(G_VERTEXPAINT+G_TEXTUREPAINT+G_WEIGHTPAINT+G_SCULPTMODE+G_PARTICLEEDIT);
-}
-
-void add_object_draw(int type) /* for toolbox or menus, only non-editmode stuff */
-{
- Object *ob;
-
- exit_paint_modes();
- setcursor_space(SPACE_VIEW3D, CURSOR_STD);
-
- if ELEM3(curarea->spacetype, SPACE_VIEW3D, SPACE_BUTS, SPACE_INFO) {
- if (G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* freedata, and undo */
- ob= add_object(type);
- set_active_base(BASACT);
- base_init_from_view3d(BASACT, G.vd);
-
- /* only undo pushes on objects without editmode... */
- if(type==OB_EMPTY) BIF_undo_push("Add Empty");
- else if(type==OB_LAMP) {
- BIF_undo_push("Add Lamp");
- reshadeall_displist(); /* only frees */
- }
- else if(type==OB_LATTICE) BIF_undo_push("Add Lattice");
- else if(type==OB_CAMERA) BIF_undo_push("Add Camera");
-
- allqueue(REDRAWVIEW3D, 0);
- }
-
- redraw_test_buttons(OBACT);
-
- allqueue(REDRAWALL, 0);
-
- deselect_all_area_oops();
- set_select_flag_oops();
-
- DAG_scene_sort(G.scene);
- allqueue(REDRAWINFO, 1); /* 1, because header->win==0! */
-}
-
-void add_objectLamp(short type)
-{
- Lamp *la;
-
- /* this function also comes from an info window */
- if ELEM(curarea->spacetype, SPACE_VIEW3D, SPACE_INFO); else return;
-
- if(G.obedit==0) {
- add_object_draw(OB_LAMP);
- base_init_from_view3d(BASACT, G.vd);
- }
-
- la = BASACT->object->data;
- la->type = type;
-
- allqueue(REDRAWALL, 0);
-}
-
-/* remove base from a specific scene */
-/* note: now unlinks constraints as well */
-void free_and_unlink_base_from_scene(Scene *scene, Base *base)
-{
- BLI_remlink(&scene->base, base);
- free_libblock_us(&G.main->object, base->object);
- MEM_freeN(base);
-}
-
-/* remove base from the current scene */
-void free_and_unlink_base(Base *base)
-{
- if (base==BASACT)
- BASACT= NULL;
- free_and_unlink_base_from_scene(G.scene, base);
-}
-
-void delete_obj(int ok)
-{
- Base *base;
- int islamp= 0;
-
- if(G.obedit) return;
- if(G.scene->id.lib) return;
-
- base= FIRSTBASE;
- while(base) {
- Base *nbase= base->next;
-
- if TESTBASE(base) {
- if(ok==0) {
- /* Shift Del is global delete */
- if (G.qual & LR_SHIFTKEY) {
- if(!okee("Erase selected Object(s) Globally")) return;
- ok= 2;
- } else {
- if(!okee("Erase selected Object(s)")) return;
- ok= 1;
- }
- }
-
- exit_paint_modes();
-
- if(base->object->type==OB_LAMP) islamp= 1;
-#ifdef WITH_VERSE
- if(base->object->vnode) b_verse_delete_object(base->object);
-#endif
- if (ok==2) {
- Scene *scene;
- Base *base_other;
-
- for (scene= G.main->scene.first; scene; scene= scene->id.next) {
- if (scene != G.scene && !(scene->id.lib)) {
- base_other= object_in_scene( base->object, scene );
- if (base_other) {
- if (base_other == scene->basact) scene->basact= NULL; /* in case the object was active */
- free_and_unlink_base_from_scene( scene, base_other );
- }
- }
- }
- }
-
- /* remove from current scene only */
- free_and_unlink_base(base);
- }
-
- base= nbase;
- }
- countall();
-
- setcursor_space(SPACE_VIEW3D, CURSOR_STD);
-
- if(islamp) reshadeall_displist(); /* only frees displist */
-
- redraw_test_buttons(OBACT);
- allqueue(REDRAWVIEW3D, 0);
- allqueue (REDRAWACTION, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWDATASELECT, 0);
- allspace(OOPS_TEST, 0);
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
-
- DAG_scene_sort(G.scene);
-
- BIF_undo_push("Delete object(s)");
-}
-
-static int return_editmesh_indexar(int *tot, int **indexar, float *cent)
-{
- EditMesh *em = G.editMesh;
- EditVert *eve;
- int *index, nr, totvert=0;
-
- for(eve= em->verts.first; eve; eve= eve->next) {
- if(eve->f & SELECT) totvert++;
- }
- if(totvert==0) return 0;
-
- *indexar= index= MEM_mallocN(4*totvert, "hook indexar");
- *tot= totvert;
- nr= 0;
- cent[0]= cent[1]= cent[2]= 0.0;
-
- for(eve= em->verts.first; eve; eve= eve->next) {
- if(eve->f & SELECT) {
- *index= nr; index++;
- VecAddf(cent, cent, eve->co);
- }
- nr++;
- }
-
- VecMulf(cent, 1.0f/(float)totvert);
-
- return totvert;
-}
-
-static int return_editmesh_vgroup(char *name, float *cent)
-{
- EditMesh *em = G.editMesh;
- MDeformVert *dvert;
- EditVert *eve;
- int i, totvert=0;
-
- cent[0]= cent[1]= cent[2]= 0.0;
-
- if(G.obedit->actdef) {
-
- /* find the vertices */
- for(eve= em->verts.first; eve; eve= eve->next) {
- dvert= CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT);
-
- if(dvert) {
- for(i=0; i<dvert->totweight; i++){
- if(dvert->dw[i].def_nr == (G.obedit->actdef-1)) {
- totvert++;
- VecAddf(cent, cent, eve->co);
- }
- }
- }
- }
- if(totvert) {
- bDeformGroup *defGroup = BLI_findlink(&G.obedit->defbase, G.obedit->actdef-1);
- strcpy(name, defGroup->name);
- VecMulf(cent, 1.0f/(float)totvert);
- return 1;
- }
- }
-
- return 0;
-}
-
-static void select_editmesh_hook(HookModifierData *hmd)
-{
- EditMesh *em = G.editMesh;
- EditVert *eve;
- int index=0, nr=0;
-
- for(eve= em->verts.first; eve; eve= eve->next, nr++) {
- if(nr==hmd->indexar[index]) {
- eve->f |= SELECT;
- if(index < hmd->totindex-1) index++;
- }
- }
- EM_select_flush();
-}
-
-static int return_editlattice_indexar(int *tot, int **indexar, float *cent)
-{
- BPoint *bp;
- int *index, nr, totvert=0, a;
-
- /* count */
- a= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw;
- bp= editLatt->def;
- while(a--) {
- if(bp->f1 & SELECT) {
- if(bp->hide==0) totvert++;
- }
- bp++;
- }
-
- if(totvert==0) return 0;
-
- *indexar= index= MEM_mallocN(4*totvert, "hook indexar");
- *tot= totvert;
- nr= 0;
- cent[0]= cent[1]= cent[2]= 0.0;
-
- a= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw;
- bp= editLatt->def;
- while(a--) {
- if(bp->f1 & SELECT) {
- if(bp->hide==0) {
- *index= nr; index++;
- VecAddf(cent, cent, bp->vec);
- }
- }
- bp++;
- nr++;
- }
-
- VecMulf(cent, 1.0f/(float)totvert);
-
- return totvert;
-}
-
-static void select_editlattice_hook(HookModifierData *hmd)
-{
- BPoint *bp;
- int index=0, nr=0, a;
-
- /* count */
- a= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw;
- bp= editLatt->def;
- while(a--) {
- if(hmd->indexar[index]==nr) {
- bp->f1 |= SELECT;
- if(index < hmd->totindex-1) index++;
- }
- nr++;
- bp++;
- }
-}
-
-static int return_editcurve_indexar(int *tot, int **indexar, float *cent)
-{
- extern ListBase editNurb;
- Nurb *nu;
- BPoint *bp;
- BezTriple *bezt;
- int *index, a, nr, totvert=0;
-
- for(nu= editNurb.first; nu; nu= nu->next) {
- if((nu->type & 7)==CU_BEZIER) {
- bezt= nu->bezt;
- a= nu->pntsu;
- while(a--) {
- if(bezt->f1 & SELECT) totvert++;
- if(bezt->f2 & SELECT) totvert++;
- if(bezt->f3 & SELECT) totvert++;
- bezt++;
- }
- }
- else {
- bp= nu->bp;
- a= nu->pntsu*nu->pntsv;
- while(a--) {
- if(bp->f1 & SELECT) totvert++;
- bp++;
- }
- }
- }
- if(totvert==0) return 0;
-
- *indexar= index= MEM_mallocN(4*totvert, "hook indexar");
- *tot= totvert;
- nr= 0;
- cent[0]= cent[1]= cent[2]= 0.0;
-
- for(nu= editNurb.first; nu; nu= nu->next) {
- if((nu->type & 7)==CU_BEZIER) {
- bezt= nu->bezt;
- a= nu->pntsu;
- while(a--) {
- if(bezt->f1 & SELECT) {
- *index= nr; index++;
- VecAddf(cent, cent, bezt->vec[0]);
- }
- nr++;
- if(bezt->f2 & SELECT) {
- *index= nr; index++;
- VecAddf(cent, cent, bezt->vec[1]);
- }
- nr++;
- if(bezt->f3 & SELECT) {
- *index= nr; index++;
- VecAddf(cent, cent, bezt->vec[2]);
- }
- nr++;
- bezt++;
- }
- }
- else {
- bp= nu->bp;
- a= nu->pntsu*nu->pntsv;
- while(a--) {
- if(bp->f1 & SELECT) {
- *index= nr; index++;
- VecAddf(cent, cent, bp->vec);
- }
- nr++;
- bp++;
- }
- }
- }
-
- VecMulf(cent, 1.0f/(float)totvert);
-
- return totvert;
-}
-
-static void select_editcurve_hook(HookModifierData *hmd)
-{
- extern ListBase editNurb;
- Nurb *nu;
- BPoint *bp;
- BezTriple *bezt;
- int index=0, a, nr=0;
-
- for(nu= editNurb.first; nu; nu= nu->next) {
- if((nu->type & 7)==CU_BEZIER) {
- bezt= nu->bezt;
- a= nu->pntsu;
- while(a--) {
- if(nr == hmd->indexar[index]) {
- bezt->f1 |= SELECT;
- if(index<hmd->totindex-1) index++;
- }
- nr++;
- if(nr == hmd->indexar[index]) {
- bezt->f2 |= SELECT;
- if(index<hmd->totindex-1) index++;
- }
- nr++;
- if(nr == hmd->indexar[index]) {
- bezt->f3 |= SELECT;
- if(index<hmd->totindex-1) index++;
- }
- nr++;
-
- bezt++;
- }
- }
- else {
- bp= nu->bp;
- a= nu->pntsu*nu->pntsv;
- while(a--) {
- if(nr == hmd->indexar[index]) {
- bp->f1 |= SELECT;
- if(index<hmd->totindex-1) index++;
- }
- nr++;
- bp++;
- }
- }
- }
-}
-
-void hook_select(HookModifierData *hmd)
-{
- if(G.obedit->type==OB_MESH) select_editmesh_hook(hmd);
- else if(G.obedit->type==OB_LATTICE) select_editlattice_hook(hmd);
- else if(G.obedit->type==OB_CURVE) select_editcurve_hook(hmd);
- else if(G.obedit->type==OB_SURF) select_editcurve_hook(hmd);
-}
-
-int hook_getIndexArray(int *tot, int **indexar, char *name, float *cent_r)
-{
- *indexar= NULL;
- *tot= 0;
- name[0]= 0;
-
- switch(G.obedit->type) {
- case OB_MESH:
- /* check selected vertices first */
- if( return_editmesh_indexar(tot, indexar, cent_r)) return 1;
- else return return_editmesh_vgroup(name, cent_r);
- case OB_CURVE:
- case OB_SURF:
- return return_editcurve_indexar(tot, indexar, cent_r);
- case OB_LATTICE:
- return return_editlattice_indexar(tot, indexar, cent_r);
- default:
- return 0;
- }
-}
-
-void add_hook(void)
-{
- ModifierData *md = NULL;
- HookModifierData *hmd = NULL;
- Object *ob=NULL;
- int mode;
-
- if(G.obedit==NULL) return;
-
- if(modifiers_findByType(G.obedit, eModifierType_Hook))
- mode= pupmenu("Hooks %t|Add, To New Empty %x1|Add, To Selected Object %x2|Remove... %x3|Reassign... %x4|Select... %x5|Clear Offset...%x6");
- else
- mode= pupmenu("Hooks %t|Add, New Empty %x1|Add, To Selected Object %x2");
-
- if(mode<1) return;
-
- /* preconditions */
-
- if(mode==2) { /* selected object */
- Base *base= FIRSTBASE;
- while(base) {
- if TESTBASELIB(base) {
- if(base!=BASACT) {
- ob= base->object;
- break;
- }
- }
- base= base->next;
- }
- if(ob==NULL) {
- error("Requires selected Object");
- return;
- }
- }
- else if(mode!=1) {
- int maxlen=0, a, nr;
- char *cp;
-
- /* make pupmenu with hooks */
- for(md=G.obedit->modifiers.first; md; md= md->next) {
- if (md->type==eModifierType_Hook)
- maxlen+=32;
- }
-
- if(maxlen==0) {
- error("Object has no hooks yet");
- return;
- }
-
- cp= MEM_callocN(maxlen+32, "temp string");
- if(mode==3) strcpy(cp, "Remove %t|");
- else if(mode==4) strcpy(cp, "Reassign %t|");
- else if(mode==5) strcpy(cp, "Select %t|");
- else if(mode==6) strcpy(cp, "Clear Offset %t|");
-
- for(md=G.obedit->modifiers.first; md; md= md->next) {
- if (md->type==eModifierType_Hook) {
- strcat(cp, md->name);
- strcat(cp, " |");
- }
- }
-
- nr= pupmenu(cp);
- MEM_freeN(cp);
-
- if(nr<1) return;
-
- a= 1;
- for(md=G.obedit->modifiers.first; md; md=md->next) {
- if (md->type==eModifierType_Hook) {
- if(a==nr) break;
- a++;
- }
- }
-
- hmd = (HookModifierData*) md;
- ob= hmd->object;
- }
-
- /* do it, new hooks or reassign */
- if(mode==1 || mode==2 || mode==4) {
- float cent[3];
- int tot, ok, *indexar;
- char name[32];
-
- ok = hook_getIndexArray(&tot, &indexar, name, cent);
-
- if(ok==0) {
- error("Requires selected vertices or active Vertex Group");
- }
- else {
-
- if(mode==1) {
- Base *base= BASACT, *newbase;
-
- ob= add_object(OB_EMPTY);
- /* set layers OK */
- newbase= BASACT;
- newbase->lay= base->lay;
- ob->lay= newbase->lay;
-
- /* transform cent to global coords for loc */
- VecMat4MulVecfl(ob->loc, G.obedit->obmat, cent);
-
- /* restore, add_object sets active */
- BASACT= base;
- }
- /* if mode is 2 or 4, ob has been set */
-
- /* new hook */
- if(mode==1 || mode==2) {
- ModifierData *md = G.obedit->modifiers.first;
-
- while (md && modifierType_getInfo(md->type)->type==eModifierTypeType_OnlyDeform) {
- md = md->next;
- }
-
- hmd = (HookModifierData*) modifier_new(eModifierType_Hook);
- BLI_insertlinkbefore(&G.obedit->modifiers, md, hmd);
- sprintf(hmd->modifier.name, "Hook-%s", ob->id.name+2);
- }
- else if (hmd->indexar) MEM_freeN(hmd->indexar); /* reassign, hook was set */
-
- hmd->object= ob;
- hmd->indexar= indexar;
- VECCOPY(hmd->cent, cent);
- hmd->totindex= tot;
- BLI_strncpy(hmd->name, name, 32);
-
- if(mode==1 || mode==2) {
- /* matrix calculus */
- /* vert x (obmat x hook->imat) x hook->obmat x ob->imat */
- /* (parentinv ) */
-
- where_is_object(ob);
-
- Mat4Invert(ob->imat, ob->obmat);
- /* apparently this call goes from right to left... */
- Mat4MulSerie(hmd->parentinv, ob->imat, G.obedit->obmat, NULL,
- NULL, NULL, NULL, NULL, NULL);
- }
- }
- }
- else if(mode==3) { /* remove */
- BLI_remlink(&G.obedit->modifiers, md);
- modifier_free(md);
- }
- else if(mode==5) { /* select */
- hook_select(hmd);
- }
- else if(mode==6) { /* clear offset */
- where_is_object(ob); /* ob is hook->parent */
-
- Mat4Invert(ob->imat, ob->obmat);
- /* this call goes from right to left... */
- Mat4MulSerie(hmd->parentinv, ob->imat, G.obedit->obmat, NULL,
- NULL, NULL, NULL, NULL, NULL);
- }
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- DAG_scene_sort(G.scene);
-
- BIF_undo_push("Add hook");
-}
-
-void make_track(void)
-{
- Base *base;
- short mode=0;
-
- if(G.scene->id.lib) return;
- if(G.obedit) {
- return;
- }
- if(BASACT==0) return;
-
- mode= pupmenu("Make Track %t|TrackTo Constraint %x1|LockTrack Constraint %x2|Old Track %x3");
- if (mode == 0){
- return;
- }
- else if (mode == 1){
- bConstraint *con;
- bTrackToConstraint *data;
-
- base= FIRSTBASE;
- while(base) {
- if TESTBASELIB(base) {
- if(base!=BASACT) {
- con = add_new_constraint(CONSTRAINT_TYPE_TRACKTO);
- strcpy (con->name, "AutoTrack");
-
- data = con->data;
- data->tar = BASACT->object;
- base->object->recalc |= OB_RECALC;
-
- /* Lamp and Camera track differently by default */
- if (base->object->type == OB_LAMP || base->object->type == OB_CAMERA) {
- data->reserved1 = TRACK_nZ;
- data->reserved2 = UP_Y;
- }
-
- add_constraint_to_object(con, base->object);
- }
- }
- base= base->next;
- }
-
- }
- else if (mode == 2){
- bConstraint *con;
- bLockTrackConstraint *data;
-
- base= FIRSTBASE;
- while(base) {
- if TESTBASELIB(base) {
- if(base!=BASACT) {
- con = add_new_constraint(CONSTRAINT_TYPE_LOCKTRACK);
- strcpy (con->name, "AutoTrack");
-
- data = con->data;
- data->tar = BASACT->object;
- base->object->recalc |= OB_RECALC;
-
- /* Lamp and Camera track differently by default */
- if (base->object->type == OB_LAMP || base->object->type == OB_CAMERA) {
- data->trackflag = TRACK_nZ;
- data->lockflag = LOCK_Y;
- }
-
- add_constraint_to_object(con, base->object);
- }
- }
- base= base->next;
- }
-
- }
- else if (mode == 3){
- base= FIRSTBASE;
- while(base) {
- if TESTBASELIB(base) {
- if(base!=BASACT) {
- base->object->track= BASACT->object;
- base->object->recalc |= OB_RECALC;
- }
- }
- base= base->next;
- }
- }
-
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWVIEW3D, 0);
- DAG_scene_sort(G.scene);
-
- BIF_undo_push("Make Track");
-}
-
-void apply_obmat(Object *ob)
-{
- float mat[3][3], imat[3][3], tmat[3][3];
-
- /* from obmat to loc rot size */
-
- if(ob==0) return;
- Mat3CpyMat4(mat, ob->obmat);
-
- VECCOPY(ob->loc, ob->obmat[3]);
-
- if(ob->transflag & OB_QUAT) {
- Mat3ToQuat(mat, ob->quat);
- QuatToMat3(ob->quat, tmat);
- }
- else {
- Mat3ToEul(mat, ob->rot);
- EulToMat3(ob->rot, tmat);
- }
- Mat3Inv(imat, tmat);
-
- Mat3MulMat3(tmat, imat, mat);
-
- ob->size[0]= tmat[0][0];
- ob->size[1]= tmat[1][1];
- ob->size[2]= tmat[2][2];
-
-}
-
-void clear_parent(void)
-{
- Object *par;
- Base *base;
- int mode;
-
- if(G.obedit) return;
- if(G.scene->id.lib) return;
-
- mode= pupmenu("OK? %t|Clear Parent %x1|Clear and Keep Transformation (Clear Track) %x2|Clear Parent Inverse %x3");
-
- if(mode<1) return;
-
- base= FIRSTBASE;
- while(base) {
- if TESTBASELIB(base) {
- par= NULL;
- if(mode==1 || mode==2) {
- par= base->object->parent;
- base->object->parent= NULL;
- base->object->recalc |= OB_RECALC;
-
- if(mode==2) {
- base->object->track= NULL;
- apply_obmat(base->object);
- }
- }
- else if(mode==3) {
- Mat4One(base->object->parentinv);
- base->object->recalc |= OB_RECALC;
- }
- }
- base= base->next;
- }
-
- DAG_scene_sort(G.scene);
- DAG_scene_flush_update(G.scene, screen_view3d_layers());
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWOOPS, 0);
-
- BIF_undo_push("Clear Parent");
-}
-
-void clear_track(void)
-{
- Base *base;
- int mode;
-
- if(G.obedit) return;
- if(G.scene->id.lib) return;
-
- mode= pupmenu("OK? %t|Clear Track %x1| Clear Track and Keep Transform %x2");
-
- if(mode<1) return;
-
- base= FIRSTBASE;
- while(base) {
- if TESTBASELIB(base) {
- base->object->track= NULL;
- base->object->recalc |= OB_RECALC;
-
- if(mode==2) {
- apply_obmat(base->object);
- }
- }
- base= base->next;
- }
-
- DAG_scene_sort(G.scene);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWOOPS, 0);
-
- BIF_undo_push("Clear Track");
-}
-
-void clear_object(char mode)
-{
- Base *base;
- Object *ob;
- float *v1, *v3, mat[3][3];
- int armature_clear= 0;
- char *str=NULL;
-
- if(G.obedit) return;
- if(G.scene->id.lib) return;
-
- if(mode=='r') str= "Clear rotation";
- else if(mode=='g') str= "Clear location";
- else if(mode=='s') str= "Clear scale";
- else if(mode=='o') str= "Clear origin";
- else return;
-
- base= FIRSTBASE;
- while(base) {
- if TESTBASELIB(base) {
- ob= base->object;
-
- if ((ob->flag & OB_POSEMODE)) {
- /* only clear pose transforms if:
- * - with a mesh in weightpaint mode, it's related armature needs to be cleared
- * - with clearing transform of object being edited at the time
- */
- if ((G.f & G_WEIGHTPAINT) || ob==OBACT) {
- clear_armature(ob, mode);
- armature_clear= 1; /* silly system to prevent another dag update, so no action applied */
- }
- }
- else if((G.f & G_WEIGHTPAINT)==0) {
-
- if(mode=='r') {
- memset(ob->rot, 0, 3*sizeof(float));
- memset(ob->drot, 0, 3*sizeof(float));
- QuatOne(ob->quat);
- QuatOne(ob->dquat);
-#ifdef WITH_VERSE
- if(ob->vnode) {
- struct VNode *vnode = (VNode*)ob->vnode;
- ((VObjectData*)vnode->data)->flag |= ROT_SEND_READY;
- b_verse_send_transformation(ob);
- }
-#endif
-
- }
- else if(mode=='g') {
- memset(ob->loc, 0, 3*sizeof(float));
- memset(ob->dloc, 0, 3*sizeof(float));
-#ifdef WITH_VERSE
- if(ob->vnode) {
- struct VNode *vnode = (VNode*)ob->vnode;
- ((VObjectData*)vnode->data)->flag |= POS_SEND_READY;
- b_verse_send_transformation(ob);
- }
-#endif
-
- }
- else if(mode=='s') {
- memset(ob->dsize, 0, 3*sizeof(float));
- ob->size[0]= 1.0;
- ob->size[1]= 1.0;
- ob->size[2]= 1.0;
-#ifdef WITH_VERSE
- if(ob->vnode) {
- struct VNode *vnode = (VNode*)ob->vnode;
- ((VObjectData*)vnode->data)->flag |= SCALE_SEND_READY;
- b_verse_send_transformation(ob);
- }
-#endif
-
- }
- else if(mode=='o') {
- if(ob->parent) {
- v1= ob->loc;
- v3= ob->parentinv[3];
-
- Mat3CpyMat4(mat, ob->parentinv);
- VECCOPY(v3, v1);
- v3[0]= -v3[0];
- v3[1]= -v3[1];
- v3[2]= -v3[2];
- Mat3MulVecfl(mat, v3);
- }
- }
-
- ob->recalc |= OB_RECALC_OB;
- }
- }
- base= base->next;
- }
-
- allqueue(REDRAWVIEW3D, 0);
- if(armature_clear==0) /* in this case flush was done */
- DAG_scene_flush_update(G.scene, screen_view3d_layers());
- BIF_undo_push(str);
-}
-
-void reset_slowparents(void)
-{
- /* back to original locations */
- Base *base;
-
- base= FIRSTBASE;
- while(base) {
- if(base->object->parent) {
- if(base->object->partype & PARSLOW) {
- base->object->partype -= PARSLOW;
- where_is_object(base->object);
- base->object->partype |= PARSLOW;
- }
- }
- base= base->next;
- }
-}
-
-void set_slowparent(void)
-{
- Base *base;
-
- if( okee("Set slow parent")==0 ) return;
-
- base= FIRSTBASE;
- while(base) {
- if TESTBASELIB(base) {
- if(base->object->parent) base->object->partype |= PARSLOW;
- }
- base= base->next;
- }
- BIF_undo_push("Slow parent");
-}
-
-void make_vertex_parent(void)
-{
- EditMesh *em = G.editMesh;
- EditVert *eve;
- Base *base;
- Nurb *nu;
- BezTriple *bezt;
- BPoint *bp;
- Object *par, *ob;
- int a, v1=0, v2=0, v3=0, v4=0, nr=1;
-
- /* we need 1 to 3 selected vertices */
-
- if(G.obedit->type==OB_MESH) {
- eve= em->verts.first;
- while(eve) {
- if(eve->f & 1) {
- if(v1==0) v1= nr;
- else if(v2==0) v2= nr;
- else if(v3==0) v3= nr;
- else if(v4==0) v4= nr;
- else break;
- }
- nr++;
- eve= eve->next;
- }
- }
- else if ELEM(G.obedit->type, OB_SURF, OB_CURVE) {
- extern ListBase editNurb;
- nu= editNurb.first;
- while(nu) {
- if((nu->type & 7)==CU_BEZIER) {
- bezt= nu->bezt;
- a= nu->pntsu;
- while(a--) {
- if(BEZSELECTED_HIDDENHANDLES(bezt)) {
- if(v1==0) v1= nr;
- else if(v2==0) v2= nr;
- else if(v3==0) v3= nr;
- else if(v4==0) v4= nr;
- else break;
- }
- nr++;
- bezt++;
- }
- }
- else {
- bp= nu->bp;
- a= nu->pntsu*nu->pntsv;
- while(a--) {
- if(bp->f1 & SELECT) {
- if(v1==0) v1= nr;
- else if(v2==0) v2= nr;
- else if(v3==0) v3= nr;
- else if(v4==0) v4= nr;
- else break;
- }
- nr++;
- bp++;
- }
- }
- nu= nu->next;
- }
- }
- else if(G.obedit->type==OB_LATTICE) {
-
- a= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw;
- bp= editLatt->def;
- while(a--) {
- if(bp->f1 & SELECT) {
- if(v1==0) v1= nr;
- else if(v2==0) v2= nr;
- else if(v3==0) v3= nr;
- else if(v4==0) v4= nr;
- else break;
- }
- nr++;
- bp++;
- }
- }
-
- if(v4 || !((v1 && v2==0 && v3==0) || (v1 && v2 && v3)) ) {
- error("Select either 1 or 3 vertices to parent to");
- return;
- }
-
- if(okee("Make vertex parent")==0) return;
-
- base= FIRSTBASE;
- while(base) {
- if TESTBASELIB(base) {
- if(base!=BASACT) {
-
- ob= base->object;
- ob->recalc |= OB_RECALC;
- par= BASACT->object->parent;
-
- while(par) {
- if(par==ob) break;
- par= par->parent;
- }
- if(par) {
- error("Loop in parents");
- }
- else {
- ob->parent= BASACT->object;
- if(v3) {
- ob->partype= PARVERT3;
- ob->par1= v1-1;
- ob->par2= v2-1;
- ob->par3= v3-1;
-
- /* inverse parent matrix */
- what_does_parent(ob);
- Mat4Invert(ob->parentinv, workob.obmat);
- clear_workob();
- }
- else {
- ob->partype= PARVERT1;
- ob->par1= v1-1;
-
- /* inverse parent matrix */
- what_does_parent(ob);
- Mat4Invert(ob->parentinv, workob.obmat);
- clear_workob();
- }
- }
- }
- }
- base= base->next;
- }
- allqueue(REDRAWVIEW3D, 0);
-
- DAG_scene_sort(G.scene);
- /* BIF_undo_push(str); not, conflicts with editmode undo... */
-}
-
-static Object *group_objects_menu(Group *group)
-{
- GroupObject *go;
- int len= 0;
- short a, nr;
- char *str;
-
- for(go= group->gobject.first; go; go= go->next) {
- if(go->ob)
- len++;
- }
- if(len==0) return NULL;
-
- str= MEM_callocN(40+32*len, "menu");
-
- strcpy(str, "Make Proxy for: %t");
- a= strlen(str);
- for(nr=1, go= group->gobject.first; go; go= go->next, nr++) {
- a+= sprintf(str+a, "|%s %%x%d", go->ob->id.name+2, nr);
- }
-
- a= pupmenu_col(str, 20);
- MEM_freeN(str);
- if(a>0) {
- go= BLI_findlink(&group->gobject, a-1);
- return go->ob;
- }
- return NULL;
-}
-
-
-/* adds empty object to become local replacement data of a library-linked object */
-void make_proxy(void)
-{
- Object *ob= OBACT;
- Object *gob= NULL;
-
- if(G.scene->id.lib) return;
- if(ob==NULL) return;
-
-
- if(ob->dup_group && ob->dup_group->id.lib) {
- gob= ob;
- /* gives menu with list of objects in group */
- ob= group_objects_menu(ob->dup_group);
- }
- else if(ob->id.lib) {
- if(okee("Make Proxy Object")==0)
- return;
- }
- else {
- error("Can only make proxy for a referenced object or group");
- return;
- }
-
- if(ob) {
- Object *newob;
- Base *newbase, *oldbase= BASACT;
- char name[32];
-
- newob= add_object(OB_EMPTY);
- if(gob)
- strcpy(name, gob->id.name+2);
- else
- strcpy(name, ob->id.name+2);
- strcat(name, "_proxy");
- rename_id(&newob->id, name);
-
- /* set layers OK */
- newbase= BASACT; /* add_object sets active... */
- newbase->lay= oldbase->lay;
- newob->lay= newbase->lay;
-
- /* remove base, leave user count of object, it gets linked in object_make_proxy */
- if(gob==NULL) {
- BLI_remlink(&G.scene->base, oldbase);
- MEM_freeN(oldbase);
- }
- object_make_proxy(newob, ob, gob);
-
- DAG_scene_sort(G.scene);
- DAG_object_flush_update(G.scene, newob, OB_RECALC);
- allqueue(REDRAWALL, 0);
- BIF_undo_push("Make Proxy Object");
- }
-}
-
-int test_parent_loop(Object *par, Object *ob)
-{
- /* test if 'ob' is a parent somewhere in par's parents */
-
- if(par==0) return 0;
- if(ob == par) return 1;
-
- return test_parent_loop(par->parent, ob);
-
-}
-
-void make_parent(void)
-{
- Base *base;
- Object *par;
- bPoseChannel *pchan= NULL;
- short qual, mode=0;
-
- if(G.scene->id.lib) return;
- if(G.obedit) {
- if ELEM4(G.obedit->type, OB_MESH, OB_CURVE, OB_SURF, OB_LATTICE) make_vertex_parent();
- else if (G.obedit->type==OB_ARMATURE) make_bone_parent();
- return;
- }
- if(BASACT==0) return;
-
- qual= G.qual;
- par= BASACT->object;
-
- if(par->type == OB_LATTICE){
- mode= pupmenu("Make Parent %t|Normal Parent %x1|Lattice Deform %x2");
- if(mode<=0){
- return;
- }
- else if(mode==1) {
- mode= PAROBJECT;
- }
- else if(mode==2) {
- mode= PARSKEL;
- }
- }
- else if(par->type == OB_CURVE){
- mode= pupmenu("Make Parent %t|Normal Parent %x1|Follow Path %x2|Curve Deform %x3|Path Constraint %x4");
- if(mode<=0){
- return;
- }
- else if(mode==1) {
- mode= PAROBJECT;
- }
- else if(mode==2) {
- Curve *cu= par->data;
-
- mode= PAROBJECT;
- if((cu->flag & CU_PATH)==0) {
- cu->flag |= CU_PATH|CU_FOLLOW;
- makeDispListCurveTypes(par, 0); /* force creation of path data */
- }
- else cu->flag |= CU_FOLLOW;
- }
- else if(mode==3) {
- mode= PARSKEL;
- }
- else if(mode==4) {
- bConstraint *con;
- bFollowPathConstraint *data;
-
- base= FIRSTBASE;
- while(base) {
- if TESTBASELIB(base) {
- if(base!=BASACT) {
- float cmat[4][4], vec[3];
-
- con = add_new_constraint(CONSTRAINT_TYPE_FOLLOWPATH);
- strcpy (con->name, "AutoPath");
-
- data = con->data;
- data->tar = BASACT->object;
-
- add_constraint_to_object(con, base->object);
-
- get_constraint_target_matrix(con, 0, CONSTRAINT_OBTYPE_OBJECT, NULL, cmat, G.scene->r.cfra - base->object->sf);
- VecSubf(vec, base->object->obmat[3], cmat[3]);
-
- base->object->loc[0] = vec[0];
- base->object->loc[1] = vec[1];
- base->object->loc[2] = vec[2];
- }
- }
- base= base->next;
- }
-
- allqueue(REDRAWVIEW3D, 0);
- DAG_scene_sort(G.scene);
- BIF_undo_push("Make Parent");
- return;
- }
- }
- else if(par->type == OB_ARMATURE){
-
- base= FIRSTBASE;
- while(base) {
- if TESTBASELIB(base) {
- if(base!=BASACT) {
- if(ELEM(base->object->type, OB_MESH, OB_LATTICE)) {
- if(par->flag & OB_POSEMODE)
- mode= pupmenu("Make Parent To%t|Bone %x1|Armature %x2|Object %x3");
- else
- mode= pupmenu("Make Parent To%t|Armature %x2|Object %x3");
- break;
- }
- else {
- if(par->flag & OB_POSEMODE)
- mode= pupmenu("Make Parent To %t|Bone %x1|Object %x3");
- else
- mode= pupmenu("Make Parent To %t|Object %x3");
- break;
- }
- }
- }
- base= base->next;
- }
-
- switch (mode){
- case 1:
- mode=PARBONE;
- pchan= get_active_posechannel(par);
-
- if(pchan==NULL) {
- error("No active Bone");
- allqueue(REDRAWVIEW3D, 0);
- return;
- }
-
- break;
- case 2:
- mode=PARSKEL;
- break;
- case 3:
- mode=PAROBJECT;
- break;
- default:
- return;
- }
- }
- else {
- if(qual & LR_SHIFTKEY) {
- if(okee("Make parent without inverse")==0) return;
- }
- else {
- if(qual & LR_ALTKEY) {
- if(okee("Make vertex parent")==0) return;
- }
- else if(okee("Make parent")==0) return;
-
- /* now we'll clearparentandkeeptransform all objects */
- base= FIRSTBASE;
- while(base) {
- if TESTBASELIB(base) {
- if(base!=BASACT && base->object->parent) {
- base->object->parent= NULL;
- apply_obmat(base->object);
- }
- }
- base= base->next;
- }
- }
- }
-
- par->recalc |= OB_RECALC_OB;
-
- base= FIRSTBASE;
- while(base) {
- if TESTBASELIB(base) {
- if(base!=BASACT) {
-
- if( test_parent_loop(par, base->object) ) {
- error("Loop in parents");
- }
- else {
-
- base->object->recalc |= OB_RECALC_OB|OB_RECALC_DATA;
-
- /* the ifs below are horrible code (ton) */
-
- if (par->type==OB_ARMATURE) {
- base->object->partype= mode;
- if (pchan)
- strcpy (base->object->parsubstr, pchan->name);
- else
- base->object->parsubstr[0]=0;
- }
- else {
- if(qual & LR_ALTKEY) {
- base->object->partype= PARVERT1;
- }
- else if(ELEM(par->type, OB_CURVE, OB_LATTICE)) {
- base->object->partype= mode;
- }
- else {
- base->object->partype= PAROBJECT;
- }
- }
-
- base->object->parent= par;
-
- /* calculate inverse parent matrix? */
- if( (qual & LR_SHIFTKEY) ) {
- /* not... */
- Mat4One(base->object->parentinv);
- memset(base->object->loc, 0, 3*sizeof(float));
- }
- else {
- if(mode==PARSKEL && base->object->type==OB_MESH && par->type == OB_ARMATURE) {
- /* Prompt the user as to whether he wants to
- * add some vertex groups based on the bones
- * in the parent armature.
- */
- create_vgroups_from_armature(base->object,
- par);
-
- base->object->partype= PAROBJECT;
- what_does_parent(base->object);
- Mat4One (base->object->parentinv);
- base->object->partype= mode;
- }
- else
- what_does_parent(base->object);
- Mat4Invert(base->object->parentinv, workob.obmat);
- }
- }
- }
- }
- base= base->next;
- }
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWOOPS, 0);
-
- DAG_scene_sort(G.scene);
- DAG_scene_flush_update(G.scene, screen_view3d_layers());
-
- BIF_undo_push("make Parent");
-}
-
-
-void enter_editmode(int wc)
-{
- Base *base;
- Object *ob;
- Mesh *me;
- bArmature *arm;
- int ok= 0;
-
- if(G.scene->id.lib) return;
- base= BASACT;
- if(base==0) return;
- if((G.vd==NULL || (base->lay & G.vd->lay))==0) return;
-
- strcpy(G.editModeTitleExtra, "");
-
- ob= base->object;
- if(ob->data==0) return;
-
- if (object_data_is_libdata(ob)) {
- error_libdata();
- return;
- }
-
- if(wc) waitcursor(1);
-
- if(ob->type==OB_MESH) {
- me= get_mesh(ob);
- if( me==0 ) return;
- if(me->pv) sculptmode_pmv_off(me);
- ok= 1;
- G.obedit= ob;
- make_editMesh();
- allqueue(REDRAWBUTSLOGIC, 0);
- /*if(G.f & G_FACESELECT) allqueue(REDRAWIMAGE, 0);*/
- if (EM_texFaceCheck())
- allqueue(REDRAWIMAGE, 0);
-
- }
- if (ob->type==OB_ARMATURE){
- arm= base->object->data;
- if (!arm) return;
- /*
- * The function object_data_is_libdata make a problem here, the
- * check for ob->proxy return 0 and let blender enter to edit mode
- * this causa a crash when you try leave the edit mode.
- * The problem is that i can't remove the ob->proxy check from
- * object_data_is_libdata that prevent the bugfix #6614, so
- * i add this little hack here.
- */
- if(arm->id.lib) {
- error_libdata();
- return;
- }
- ok=1;
- G.obedit=ob;
- make_editArmature();
- /* to ensure all goes in restposition and without striding */
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC);
-
- allqueue (REDRAWVIEW3D,0);
- }
- else if(ob->type==OB_FONT) {
- G.obedit= ob;
- ok= 1;
- make_editText();
- }
- else if(ob->type==OB_MBALL) {
- G.obedit= ob;
- ok= 1;
- make_editMball();
- }
- else if(ob->type==OB_LATTICE) {
- G.obedit= ob;
- ok= 1;
- make_editLatt();
- }
- else if(ob->type==OB_SURF || ob->type==OB_CURVE) {
- ok= 1;
- G.obedit= ob;
- make_editNurb();
- }
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWOOPS, 0);
- countall();
-
- if(ok) {
- setcursor_space(SPACE_VIEW3D, CURSOR_EDIT);
-
- allqueue(REDRAWVIEW3D, 1);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-
- }
- else G.obedit= NULL;
-
- if(wc) waitcursor(0);
-
- scrarea_queue_headredraw(curarea);
-}
-
-void exit_editmode(int flag) /* freedata==0 at render, 1= freedata, 2= do undo buffer too */
-{
- Object *ob;
- int freedata = flag & EM_FREEDATA;
-
- if(G.obedit==NULL) return;
-
- if(flag & EM_WAITCURSOR) waitcursor(1);
- if(G.obedit->type==OB_MESH) {
-
- /* temporal */
- countall();
-
- if(EM_texFaceCheck())
- allqueue(REDRAWIMAGE, 0);
-
- if(retopo_mesh_paint_check())
- retopo_end_okee();
-
- if(G.totvert>MESH_MAX_VERTS) {
- error("Too many vertices");
- return;
- }
- load_editMesh();
-
- if(freedata) free_editMesh(G.editMesh);
-
- if(G.f & G_WEIGHTPAINT)
- mesh_octree_table(G.obedit, NULL, 'e');
- }
- else if (G.obedit->type==OB_ARMATURE){
- load_editArmature();
- if (freedata) free_editArmature();
- }
- else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
- extern ListBase editNurb;
- load_editNurb();
- if(freedata) freeNurblist(&editNurb);
- }
- else if(G.obedit->type==OB_FONT && freedata) {
- load_editText();
- }
- else if(G.obedit->type==OB_LATTICE) {
- load_editLatt();
- if(freedata) free_editLatt();
- }
- else if(G.obedit->type==OB_MBALL) {
- extern ListBase editelems;
- load_editMball();
- if(freedata) BLI_freelistN(&editelems);
- }
-
- ob= G.obedit;
-
- /* for example; displist make is different in editmode */
- if(freedata) G.obedit= NULL;
-
- /* total remake of softbody data */
- if(modifiers_isSoftbodyEnabled(ob)) {
- if (ob->soft && ob->soft->keys) {
- notice("Erase Baked SoftBody");
- }
-
- sbObjectToSoftbody(ob);
- }
-
- if(ob->type==OB_MESH && get_mesh(ob)->mr)
- multires_edge_level_update(ob, get_mesh(ob));
-
- /* also flush ob recalc, doesn't take much overhead, but used for particles */
- DAG_object_flush_update(G.scene, ob, OB_RECALC_OB|OB_RECALC_DATA);
-
- if(freedata) {
- setcursor_space(SPACE_VIEW3D, CURSOR_STD);
- }
-
- countall();
- allqueue(REDRAWVIEW3D, 1);
- allqueue(REDRAWBUTSALL, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWOOPS, 0);
-
- scrarea_queue_headredraw(curarea);
-
- if(G.obedit==NULL && (flag & EM_FREEUNDO))
- BIF_undo_push("Editmode");
-
- if(flag & EM_WAITCURSOR) waitcursor(0);
-}
-
-void check_editmode(int type)
-{
-
- if (G.obedit==0 || G.obedit->type==type) return;
-
- exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* freedata, and undo */
-}
-
-/* 0 == do center, 1 == center new, 2 == center cursor */
-
-void docenter(int centermode)
-{
- EditMesh *em = G.editMesh;
- Base *base;
- Object *ob;
- Mesh *me, *tme;
- Curve *cu;
-/* BezTriple *bezt;
- BPoint *bp; */
- Nurb *nu, *nu1;
- EditVert *eve;
- float cent[3], centn[3], min[3], max[3], omat[3][3];
- int a, total= 0;
-
- /* keep track of what is changed */
- int tot_change=0, tot_lib_error=0, tot_key_error=0, tot_multiuser_arm_error=0;
- MVert *mvert;
-
- if(G.scene->id.lib || G.vd==NULL) return;
-
- cent[0]= cent[1]= cent[2]= 0.0;
-
- if(G.obedit) {
-
- INIT_MINMAX(min, max);
-
- if(G.obedit->type==OB_MESH) {
- for(eve= em->verts.first; eve; eve= eve->next) {
- if(G.vd->around==V3D_CENTROID) {
- total++;
- VECADD(cent, cent, eve->co);
- }
- else {
- DO_MINMAX(eve->co, min, max);
- }
- }
-
- if(G.vd->around==V3D_CENTROID) {
- VecMulf(cent, 1.0f/(float)total);
- }
- else {
- cent[0]= (min[0]+max[0])/2.0f;
- cent[1]= (min[1]+max[1])/2.0f;
- cent[2]= (min[2]+max[2])/2.0f;
- }
-
- for(eve= em->verts.first; eve; eve= eve->next) {
- VecSubf(eve->co, eve->co, cent);
- }
-
- recalc_editnormals();
- tot_change++;
- }
- }
-
- /* reset flags */
- for (base=FIRSTBASE; base; base= base->next) {
- if TESTBASELIB(base)
- base->object->flag &= ~OB_DONE;
- }
-
- for (me= G.main->mesh.first; me; me= me->id.next) {
- me->flag &= ~ME_ISDONE;
- }
-
- base= FIRSTBASE;
- while(base) {
-
- if TESTBASELIB(base) {
- if((base->object->flag & OB_DONE)==0) {
- base->object->flag |= OB_DONE;
-
- if(base->object->id.lib) {
- tot_lib_error++;
- }
- else if(G.obedit==0 && (me=get_mesh(base->object)) ) {
-
- if(me->key) {
- /*error("Can't change the center of a mesh with vertex keys");
- return;*/
- tot_key_error++;
- } else if (me->id.lib) {
- tot_lib_error++;
- } else {
- if(centermode==2) {
- VECCOPY(cent, give_cursor());
- Mat4Invert(base->object->imat, base->object->obmat);
- Mat4MulVecfl(base->object->imat, cent);
- } else {
- INIT_MINMAX(min, max);
- mvert= me->mvert;
- for(a=0; a<me->totvert; a++, mvert++) {
- DO_MINMAX(mvert->co, min, max);
- }
-
- cent[0]= (min[0]+max[0])/2.0f;
- cent[1]= (min[1]+max[1])/2.0f;
- cent[2]= (min[2]+max[2])/2.0f;
- }
-
- mvert= me->mvert;
- for(a=0; a<me->totvert; a++, mvert++) {
- VecSubf(mvert->co, mvert->co, cent);
- }
- me->flag |= ME_ISDONE;
-
- if(centermode) {
- Mat3CpyMat4(omat, base->object->obmat);
-
- VECCOPY(centn, cent);
- Mat3MulVecfl(omat, centn);
- base->object->loc[0]+= centn[0];
- base->object->loc[1]+= centn[1];
- base->object->loc[2]+= centn[2];
-
- /* other users? */
- ob= G.main->object.first;
- while(ob) {
- if((ob->flag & OB_DONE)==0) {
- tme= get_mesh(ob);
-
- if(tme==me) {
-
- ob->flag |= OB_DONE;
- ob->recalc= OB_RECALC_OB|OB_RECALC_DATA;
-
- Mat3CpyMat4(omat, ob->obmat);
- VECCOPY(centn, cent);
- Mat3MulVecfl(omat, centn);
- ob->loc[0]+= centn[0];
- ob->loc[1]+= centn[1];
- ob->loc[2]+= centn[2];
-
- if(tme && (tme->flag & ME_ISDONE)==0) {
- mvert= tme->mvert;
- for(a=0; a<tme->totvert; a++, mvert++) {
- VecSubf(mvert->co, mvert->co, cent);
- }
- tme->flag |= ME_ISDONE;
- }
- }
- }
-
- ob= ob->id.next;
- }
- }
- tot_change++;
- }
- }
- else if ELEM(base->object->type, OB_CURVE, OB_SURF) {
-
- /* totally weak code here... (ton) */
- if(G.obedit==base->object) {
- extern ListBase editNurb;
- nu1= editNurb.first;
- cu= G.obedit->data;
- }
- else {
- cu= base->object->data;
- nu1= cu->nurb.first;
- }
-
- if (cu->id.lib) {
- tot_lib_error++;
- } else {
- if(centermode==2) {
- VECCOPY(cent, give_cursor());
- Mat4Invert(base->object->imat, base->object->obmat);
- Mat4MulVecfl(base->object->imat, cent);
-
- /* don't allow Z change if curve is 2D */
- if( !( cu->flag & CU_3D ) )
- cent[2] = 0.0;
- } else {
- INIT_MINMAX(min, max);
-
- nu= nu1;
- while(nu) {
- minmaxNurb(nu, min, max);
- nu= nu->next;
- }
-
- cent[0]= (min[0]+max[0])/2.0f;
- cent[1]= (min[1]+max[1])/2.0f;
- cent[2]= (min[2]+max[2])/2.0f;
- }
-
- nu= nu1;
- while(nu) {
- if( (nu->type & 7)==1) {
- a= nu->pntsu;
- while (a--) {
- VecSubf(nu->bezt[a].vec[0], nu->bezt[a].vec[0], cent);
- VecSubf(nu->bezt[a].vec[1], nu->bezt[a].vec[1], cent);
- VecSubf(nu->bezt[a].vec[2], nu->bezt[a].vec[2], cent);
- }
- }
- else {
- a= nu->pntsu*nu->pntsv;
- while (a--)
- VecSubf(nu->bp[a].vec, nu->bp[a].vec, cent);
- }
- nu= nu->next;
- }
-
- if(centermode && G.obedit==0) {
- Mat3CpyMat4(omat, base->object->obmat);
-
- Mat3MulVecfl(omat, cent);
- base->object->loc[0]+= cent[0];
- base->object->loc[1]+= cent[1];
- base->object->loc[2]+= cent[2];
- }
-
- tot_change++;
- if(G.obedit) {
- if (centermode==0) {
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- }
- break;
- }
- }
- }
- else if(base->object->type==OB_FONT) {
- /* get from bb */
-
- cu= base->object->data;
-
- if(cu->bb==0) {
- /* do nothing*/
- } else if (cu->id.lib) {
- tot_lib_error++;
- } else {
- cu->xof= -0.5f*( cu->bb->vec[4][0] - cu->bb->vec[0][0]);
- cu->yof= -0.5f -0.5f*( cu->bb->vec[0][1] - cu->bb->vec[2][1]); /* extra 0.5 is the height of above line */
-
- /* not really ok, do this better once! */
- cu->xof /= cu->fsize;
- cu->yof /= cu->fsize;
-
- allqueue(REDRAWBUTSEDIT, 0);
- tot_change++;
- }
- }
- else if(base->object->type==OB_ARMATURE) {
- bArmature *arm = base->object->data;
-
- if (arm->id.lib) {
- tot_lib_error++;
- } else if(arm->id.us>1) {
- /*error("Can't apply to a multi user armature");
- return;*/
- tot_multiuser_arm_error++;
- } else {
- /* Function to recenter armatures in editarmature.c
- * Bone + object locations are handled there.
- */
- docenter_armature(base->object, centermode);
- tot_change++;
- if(G.obedit)
- break;
- }
- }
- base->object->recalc= OB_RECALC_OB|OB_RECALC_DATA;
- }
- }
- base= base->next;
- }
- if (tot_change) {
- DAG_scene_flush_update(G.scene, screen_view3d_layers());
- allqueue(REDRAWVIEW3D, 0);
- BIF_undo_push("Do Center");
- }
-
- /* Warn if any errors occured */
- if (tot_lib_error+tot_key_error+tot_multiuser_arm_error) {
- char err[512];
- sprintf(err, "Warning %i Object(s) Not Centered, %i Changed:", tot_lib_error+tot_key_error+tot_multiuser_arm_error, tot_change);
-
- if (tot_lib_error)
- sprintf(err+strlen(err), "|%i linked library objects", tot_lib_error);
- if (tot_key_error)
- sprintf(err+strlen(err), "|%i mesh key object(s)", tot_key_error);
- if (tot_multiuser_arm_error)
- sprintf(err+strlen(err), "|%i multiuser armature object(s)", tot_multiuser_arm_error);
-
- error(err);
- }
-}
-
-void docenter_new(void)
-{
- if(G.scene->id.lib) return;
-
- if(G.obedit) {
- error("Unable to center new in Edit Mode");
- }
- else {
- docenter(1);
- }
-}
-
-void docenter_cursor(void)
-{
- if(G.scene->id.lib) return;
-
- if(G.obedit) {
- error("Unable to center cursor in Edit Mode");
- }
- else {
- docenter(2);
- }
-}
-
-void movetolayer(void)
-{
- Base *base;
- unsigned int lay= 0, local;
- int islamp= 0;
-
- if(G.scene->id.lib) return;
-
- base= FIRSTBASE;
- while(base) {
- if TESTBASE(base) lay |= base->lay;
- base= base->next;
- }
- if(lay==0) return;
- lay &= 0xFFFFFF;
-
- if(lay==0) return;
-
- if(G.vd->localview) {
- /* now we can move out of localview. */
- if (!okee("Move from localview")) return;
- base= FIRSTBASE;
- while(base) {
- if TESTBASE(base) {
- lay= base->lay & ~G.vd->lay;
- base->lay= lay;
- base->object->lay= lay;
- base->object->flag &= ~SELECT;
- base->flag &= ~SELECT;
- if(base->object->type==OB_LAMP) islamp= 1;
- }
- base= base->next;
- }
- } else {
- if( movetolayer_buts(&lay, NULL)==0 ) return;
-
- /* normal non localview operation */
- base= FIRSTBASE;
- while(base) {
- if TESTBASE(base) {
- /* upper byte is used for local view */
- local= base->lay & 0xFF000000;
- base->lay= lay + local;
- base->object->lay= lay;
- if(base->object->type==OB_LAMP) islamp= 1;
- }
- base= base->next;
- }
- }
- if(islamp) reshadeall_displist(); /* only frees */
-
- /* warning, active object may be hidden now */
-
- countall();
- DAG_scene_sort(G.scene);
-
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWINFO, 0);
-
- BIF_undo_push("Move to layer");
-}
-
-/* THIS IS BAD CODE! do not bring back before it has a real implementation (ton) */
-void split_font()
-{
- Object *ob = OBACT;
- Base *oldbase = BASACT;
- Curve *cu= ob->data;
- char *p= cu->str;
- int slen= strlen(p);
- int i;
-
- for (i = 0; i<=slen; p++, i++) {
- adduplicate(1, U.dupflag);
- cu= OBACT->data;
- cu->sepchar = i+1;
- text_to_curve(OBACT, 0); /* pass 1: only one letter, adapt position */
- text_to_curve(OBACT, 0); /* pass 2: remake */
- freedisplist(&OBACT->disp);
- makeDispListCurveTypes(OBACT, 0);
-
- OBACT->flag &= ~SELECT;
- BASACT->flag &= ~SELECT;
- oldbase->flag |= SELECT;
- oldbase->object->flag |= SELECT;
- set_active_base(oldbase);
- }
-}
-
-void special_editmenu(void)
-{
- static short numcuts= 2;
- Object *ob= OBACT;
- float fac;
- int nr,ret;
- short randfac;
-
- if(ob==NULL) return;
-
- if(G.obedit==NULL) {
-
- if(ob->flag & OB_POSEMODE) {
- pose_special_editmenu();
- }
- else if(FACESEL_PAINT_TEST) {
- Mesh *me= get_mesh(ob);
- MTFace *tface;
- MFace *mface;
- int a;
-
- if(me==0 || me->mtface==0) return;
-
- nr= pupmenu("Specials%t|Set Tex%x1| Shared%x2| Light%x3| Invisible%x4| Collision%x5| TwoSide%x6|Clr Tex%x7| Shared%x8| Light%x9| Invisible%x10| Collision%x11| TwoSide%x12");
-
- tface= me->mtface;
- mface= me->mface;
- for(a=me->totface; a>0; a--, tface++, mface++) {
- if(mface->flag & ME_FACE_SEL) {
- switch(nr) {
- case 1:
- tface->mode |= TF_TEX; break;
- case 2:
- tface->mode |= TF_SHAREDCOL; break;
- case 3:
- tface->mode |= TF_LIGHT; break;
- case 4:
- tface->mode |= TF_INVISIBLE; break;
- case 5:
- tface->mode |= TF_DYNAMIC; break;
- case 6:
- tface->mode |= TF_TWOSIDE; break;
- case 7:
- tface->mode &= ~TF_TEX;
- tface->tpage= 0;
- break;
- case 8:
- tface->mode &= ~TF_SHAREDCOL; break;
- case 9:
- tface->mode &= ~TF_LIGHT; break;
- case 10:
- tface->mode &= ~TF_INVISIBLE; break;
- case 11:
- tface->mode &= ~TF_DYNAMIC; break;
- case 12:
- tface->mode &= ~TF_TWOSIDE; break;
- }
- }
- }
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- BIF_undo_push("Change texture face");
- }
- else if(G.f & G_VERTEXPAINT) {
- Mesh *me= get_mesh(ob);
-
- if(me==0 || (me->mcol==NULL && me->mtface==NULL) ) return;
-
- nr= pupmenu("Specials%t|Shared VertexCol%x1");
- if(nr==1) {
-
- do_shared_vertexcol(me);
-
- BIF_undo_push("Shared VertexCol");
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- }
- }
- else if(G.f & G_WEIGHTPAINT) {
- Object *par= modifiers_isDeformedByArmature(ob);
-
- if(par && (par->flag & OB_POSEMODE)) {
- nr= pupmenu("Specials%t|Apply Bone Envelopes to Vertex Groups %x1|Apply Bone Heat Weights to Vertex Groups %x2");
-
- if(nr==1 || nr==2)
- pose_adds_vgroups(ob, (nr == 2));
- }
- }
- else if(G.f & G_PARTICLEEDIT) {
- ParticleSystem *psys = PE_get_current(ob);
- ParticleEditSettings *pset = PE_settings();
-
- if(!psys)
- return;
-
- if(G.scene->selectmode & SCE_SELECT_POINT)
- nr= pupmenu("Specials%t|Rekey%x1|Subdivide%x2|Select First%x3|Select Last%x4|Remove Doubles%x5");
- else
- nr= pupmenu("Specials%t|Rekey%x1|Remove Doubles%x5");
-
- switch(nr) {
- case 1:
- if(button(&pset->totrekey, 2, 100, "Number of Keys:")==0) return;
- waitcursor(1);
- PE_rekey();
- break;
- case 2:
- PE_subdivide();
- break;
- case 3:
- PE_select_root();
- break;
- case 4:
- PE_select_tip();
- break;
- case 5:
- PE_remove_doubles();
- break;
- }
-
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-
- if(nr>0) waitcursor(0);
- }
- else {
- Base *base, *base_select= NULL;
-
- /* Get the active object mesh. */
- Mesh *me= get_mesh(ob);
-
- /* Booleans, if the active object is a mesh... */
- if (me && ob->id.lib==NULL) {
-
- /* Bring up a little menu with the boolean operation choices on. */
- nr= pupmenu("Boolean Tools%t|Intersect%x1|Union%x2|Difference%x3|Add Intersect Modifier%x4|Add Union Modifier%x5|Add Difference Modifier%x6");
-
- if (nr > 0) {
- /* user has made a choice of a menu element.
- All of the boolean functions require 2 mesh objects
- we search through the object list to find the other
- selected item and make sure it is distinct and a mesh. */
-
- for(base= FIRSTBASE; base; base= base->next) {
- if TESTBASELIB(base) {
- if(base->object != ob) base_select= base;
- }
- }
-
- if (base_select) {
- if (get_mesh(base_select->object)) {
- if(nr <= 3){
- waitcursor(1);
- ret = NewBooleanMesh(BASACT,base_select,nr);
- if (ret==0) {
- error("An internal error occurred");
- } else if(ret==-1) {
- error("Selected meshes must have faces to perform boolean operations");
- } else if (ret==-2) {
- error("Both meshes must be a closed mesh");
- }
- else BIF_undo_push("Boolean");
- waitcursor(0);
- } else {
- BooleanModifierData *bmd = NULL;
- bmd = (BooleanModifierData *)modifier_new(eModifierType_Boolean);
- BLI_addtail(&ob->modifiers, bmd);
- bmd->object = base_select->object;
- bmd->modifier.mode |= eModifierMode_Realtime;
- switch(nr){
- case 4: bmd->operation = eBooleanModifierOp_Intersect; break;
- case 5: bmd->operation = eBooleanModifierOp_Union; break;
- case 6: bmd->operation = eBooleanModifierOp_Difference; break;
- }
- do_common_editbuts(B_CHANGEDEP);
- BIF_undo_push("Add Boolean modifier");
- }
- } else {
- error("Please select 2 meshes");
- }
- } else {
- error("Please select 2 meshes");
- }
- }
-
- allqueue(REDRAWVIEW3D, 0);
- }
- else if (ob->type == OB_FONT) {
- /* removed until this gets a decent implementation (ton) */
-/* nr= pupmenu("Split %t|Characters%x1");
- if (nr > 0) {
- switch(nr) {
- case 1: split_font();
- }
- }
-*/
- }
- }
- }
- else if(G.obedit->type==OB_MESH) {
- /* This is all that is needed, since all other functionality is in Ctrl+ V/E/F but some users didnt like, so for now have the old/big menu */
- /*
- nr= pupmenu("Subdivide Mesh%t|Subdivide%x1|Subdivide Multi%x2|Subdivide Multi Fractal%x3|Subdivide Smooth%x4");
- switch(nr) {
- case 1:
- waitcursor(1);
- esubdivideflag(1, 0.0, G.scene->toolsettings->editbutflag, 1, 0);
-
- BIF_undo_push("ESubdivide Single");
- break;
- case 2:
- if(button(&numcuts, 1, 128, "Number of Cuts:")==0) return;
- waitcursor(1);
- esubdivideflag(1, 0.0, G.scene->toolsettings->editbutflag, numcuts, 0);
- BIF_undo_push("ESubdivide");
- break;
- case 3:
- if(button(&numcuts, 1, 128, "Number of Cuts:")==0) return;
- randfac= 10;
- if(button(&randfac, 1, 100, "Rand fac:")==0) return;
- waitcursor(1);
- fac= -( (float)randfac )/100;
- esubdivideflag(1, fac, G.scene->toolsettings->editbutflag, numcuts, 0);
- BIF_undo_push("Subdivide Fractal");
- break;
-
- case 4:
- fac= 1.0f;
- if(fbutton(&fac, 0.0f, 5.0f, 10, 10, "Smooth:")==0) return;
- fac= 0.292f*fac;
-
- waitcursor(1);
- esubdivideflag(1, fac, G.scene->toolsettings->editbutflag | B_SMOOTH, 1, 0);
- BIF_undo_push("Subdivide Smooth");
- break;
- }
- */
-
- nr= pupmenu("Specials%t|Subdivide%x1|Subdivide Multi%x2|Subdivide Multi Fractal%x3|Subdivide Smooth%x12|Merge%x4|Remove Doubles%x5|Hide%x6|Reveal%x7|Select Swap%x8|Flip Normals %x9|Smooth %x10|Bevel %x11|Set Smooth %x14|Set Solid %x15|Blend From Shape%x16|Propagate To All Shapes%x17|Select Vertex Path%x18");
-
- switch(nr) {
- case 1:
- waitcursor(1);
- esubdivideflag(1, 0.0, G.scene->toolsettings->editbutflag, 1, 0);
-
- BIF_undo_push("ESubdivide Single");
- break;
- case 2:
- if(button(&numcuts, 1, 128, "Number of Cuts:")==0) return;
- waitcursor(1);
- esubdivideflag(1, 0.0, G.scene->toolsettings->editbutflag, numcuts, 0);
- BIF_undo_push("ESubdivide");
- break;
- case 3:
- if(button(&numcuts, 1, 128, "Number of Cuts:")==0) return;
- randfac= 10;
- if(button(&randfac, 1, 100, "Rand fac:")==0) return;
- waitcursor(1);
- fac= -( (float)randfac )/100;
- esubdivideflag(1, fac, G.scene->toolsettings->editbutflag, numcuts, 0);
- BIF_undo_push("Subdivide Fractal");
- break;
-
- case 12: /* smooth */
- /* if(button(&numcuts, 1, 128, "Number of Cuts:")==0) return; */
- fac= 1.0f;
- if(fbutton(&fac, 0.0f, 5.0f, 10, 10, "Smooth:")==0) return;
- fac= 0.292f*fac;
-
- waitcursor(1);
- esubdivideflag(1, fac, G.scene->toolsettings->editbutflag | B_SMOOTH, 1, 0);
- BIF_undo_push("Subdivide Smooth");
- break;
-
- case 4:
- mergemenu();
- break;
- case 5:
- notice("Removed %d Vertices", removedoublesflag(1, 0, G.scene->toolsettings->doublimit));
- BIF_undo_push("Remove Doubles");
- break;
- case 6:
- hide_mesh(0);
- break;
- case 7:
- reveal_mesh();
- break;
- case 8:
- selectswap_mesh();
- break;
- case 9:
- flip_editnormals();
- BIF_undo_push("Flip Normals");
- break;
- case 10:
- vertexsmooth();
- break;
- case 11:
- bevel_menu();
- break;
- case 14:
- mesh_set_smooth_faces(1);
- break;
- case 15:
- mesh_set_smooth_faces(0);
- break;
- case 16:
- shape_copy_select_from();
- break;
- case 17:
- shape_propagate();
- break;
- case 18:
- pathselect();
- BIF_undo_push("Select Vertex Path");
- break;
- }
-
-
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
-
- if(nr>0) waitcursor(0);
-
- }
- else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
-
- nr= pupmenu("Specials%t|Subdivide%x1|Switch Direction%x2|Set Goal Weight %x3|Set Radius %x4|Smooth Radius %x5");
-
- switch(nr) {
- case 1:
- subdivideNurb();
- break;
- case 2:
- switchdirectionNurb2();
- break;
- case 3:
- setweightNurb();
- break;
- case 4:
- setradiusNurb();
- break;
- case 5:
- smoothradiusNurb();
- break;
- }
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- }
- else if(G.obedit->type==OB_ARMATURE) {
- nr= pupmenu("Specials%t|Subdivide %x1|Subdivide Multi%x2|Flip Left-Right Names%x3");
- if(nr==1)
- subdivide_armature(1);
- if(nr==2) {
- if(button(&numcuts, 1, 128, "Number of Cuts:")==0) return;
- waitcursor(1);
- subdivide_armature(numcuts);
- }
- else if(nr==3)
- armature_flip_names();
- }
- else if(G.obedit->type==OB_LATTICE) {
- static float weight= 1.0f;
- if(fbutton(&weight, 0.0f, 1.0f, 10, 10, "Set Weight")) {
- int a= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw;
- BPoint *bp= editLatt->def;
-
- while(a--) {
- if(bp->f1 & SELECT)
- bp->weight= weight;
- bp++;
- }
- }
- }
-
- countall();
- allqueue(REDRAWVIEW3D, 0);
-
-}
-
-static void curvetomesh(Object *ob)
-{
- Curve *cu;
- DispList *dl;
-
- ob->flag |= OB_DONE;
- cu= ob->data;
-
- dl= cu->disp.first;
- if(dl==0) makeDispListCurveTypes(ob, 0); /* force creation */
-
- nurbs_to_mesh(ob); /* also does users */
- if (ob->type != OB_MESH) {
- error("can't convert curve to mesh");
- } else {
- object_free_modifiers(ob);
- }
-}
-
-void convertmenu(void)
-{
- Base *base, *basen=NULL, *basact, *basedel=NULL;
- Object *obact, *ob, *ob1;
- Curve *cu;
- Nurb *nu;
- MetaBall *mb;
- Mesh *me;
- int ok=0, nr = 0, a;
-
- if(G.scene->id.lib) return;
-
- obact= OBACT;
- if(obact==0) return;
- if(!obact->flag & SELECT) return;
- if(G.obedit) return;
-
- basact= BASACT; /* will be restored */
-
- if(obact->type==OB_FONT) {
- nr= pupmenu("Convert Font to%t|Curve%x1|Curve (Single filling group)%x2|Mesh%x3");
- if(nr>0) ok= 1;
- }
- else if(obact->type==OB_MBALL) {
- nr= pupmenu("Convert Metaball to%t|Mesh (keep original)%x1|Mesh (Delete Original)%x2");
- if(nr>0) ok= 1;
- }
- else if(obact->type==OB_CURVE) {
- nr= pupmenu("Convert Curve to%t|Mesh");
- if(nr>0) ok= 1;
- }
- else if(obact->type==OB_SURF) {
- nr= pupmenu("Convert Nurbs Surface to%t|Mesh");
- if(nr>0) ok= 1;
- }
- else if(obact->type==OB_MESH) {
- nr= pupmenu("Convert Modifiers to%t|Mesh (Keep Original)%x1|Mesh (Delete Original)%x2");
- if(nr>0) ok= 1;
- }
- if(ok==0) return;
-
- /* don't forget multiple users! */
-
- /* reset flags */
- base= FIRSTBASE;
- while(base) {
- if TESTBASELIB(base) {
- base->object->flag &= ~OB_DONE;
- }
- base= base->next;
- }
-
- base= FIRSTBASE;
- while(base) {
- if TESTBASELIB(base) {
-
- ob= base->object;
-
- if(ob->flag & OB_DONE);
- else if(ob->type==OB_MESH && ob->modifiers.first) { /* converting a mesh with no modifiers causes a segfault */
- DerivedMesh *dm;
-
- basedel = base;
-
- ob->flag |= OB_DONE;
-
- ob1= copy_object(ob);
- ob1->recalc |= OB_RECALC;
-
- basen= MEM_mallocN(sizeof(Base), "duplibase");
- *basen= *base;
- BLI_addhead(&G.scene->base, basen); /* addhead: otherwise eternal loop */
- basen->object= ob1;
- basen->flag |= SELECT;
- base->flag &= ~SELECT;
- ob->flag &= ~SELECT;
-
- /* decrement original mesh's usage count */
- me= ob1->data;
- me->id.us--;
-
- /* make a new copy of the mesh */
- ob1->data= copy_mesh(me);
- G.totmesh++;
-
- /* make new mesh data from the original copy */
- dm= mesh_get_derived_final(ob1, CD_MASK_MESH);
- /* dm= mesh_create_derived_no_deform(ob1, NULL); this was called original (instead of get_derived). man o man why! (ton) */
-
- DM_to_mesh(dm, ob1->data);
-
- dm->release(dm);
- object_free_modifiers(ob1); /* after derivedmesh calls! */
-
- /* If the original object is active then make this object active */
- if (ob == obact) {
- set_active_base( basen );
- basact = basen;
- }
- }
- else if(ob->type==OB_FONT) {
- ob->flag |= OB_DONE;
-
- ob->type= OB_CURVE;
- cu= ob->data;
-
- if(cu->vfont) {
- cu->vfont->id.us--;
- cu->vfont= 0;
- }
- if(cu->vfontb) {
- cu->vfontb->id.us--;
- cu->vfontb= 0;
- }
- if(cu->vfonti) {
- cu->vfonti->id.us--;
- cu->vfonti= 0;
- }
- if(cu->vfontbi) {
- cu->vfontbi->id.us--;
- cu->vfontbi= 0;
- }
- /* other users */
- if(cu->id.us>1) {
- ob1= G.main->object.first;
- while(ob1) {
- if(ob1->data==cu) {
- ob1->type= OB_CURVE;
- ob1->recalc |= OB_RECALC;
- }
- ob1= ob1->id.next;
- }
- }
- if (nr==2 || nr==3) {
- nu= cu->nurb.first;
- while(nu) {
- nu->charidx= 0;
- nu= nu->next;
- }
- }
- if (nr==3) {
- curvetomesh(ob);
- }
- }
- else if ELEM(ob->type, OB_CURVE, OB_SURF) {
- if(nr==1) {
- curvetomesh(ob);
- }
- }
- else if(ob->type==OB_MBALL) {
-
- if(nr==1 || nr == 2) {
- ob= find_basis_mball(ob);
-
- if(ob->disp.first && !(ob->flag&OB_DONE)) {
- basedel = base;
-
- ob->flag |= OB_DONE;
-
- ob1= copy_object(ob);
- ob1->recalc |= OB_RECALC;
-
- basen= MEM_mallocN(sizeof(Base), "duplibase");
- *basen= *base;
- BLI_addhead(&G.scene->base, basen); /* addhead: othwise eternal loop */
- basen->object= ob1;
- basen->flag |= SELECT;
- basedel->flag &= ~SELECT;
- ob->flag &= ~SELECT;
-
- mb= ob1->data;
- mb->id.us--;
-
- ob1->data= add_mesh("Mesh");
- G.totmesh++;
- ob1->type= OB_MESH;
-
- me= ob1->data;
- me->totcol= mb->totcol;
- if(ob1->totcol) {
- me->mat= MEM_dupallocN(mb->mat);
- for(a=0; a<ob1->totcol; a++) id_us_plus((ID *)me->mat[a]);
- }
-
- mball_to_mesh(&ob->disp, ob1->data);
-
- /* So we can see the wireframe */
- BASACT= basen;
-
- /* If the original object is active then make this object active */
- if (ob == obact) {
- set_active_base( basen );
- basact = basen;
- }
-
- }
- }
- }
- }
- base= base->next;
- if(basedel != NULL && nr == 2) {
- if(basedel==basact)
- basact= NULL;
- free_and_unlink_base(basedel);
- }
- basedel = NULL;
- }
-
- /* texspace and normals */
- if(!basen) BASACT= base;
-
- enter_editmode(EM_WAITCURSOR);
- exit_editmode(EM_FREEDATA|EM_WAITCURSOR); /* freedata, but no undo */
- BASACT= basact;
-
- countall();
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWOOPS, 0);
- allspace(OOPS_TEST, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- BIF_undo_push("Convert Object");
-
- DAG_scene_sort(G.scene);
-}
-
-/* Change subdivision or particle properties of mesh object ob, if level==-1
- * then toggle subsurf, else set to level set allows to toggle multiple
- * selections */
-
-static void object_has_subdivision_particles(Object *ob, int *havesubdiv, int *havepart, int depth)
-{
- if(ob->type==OB_MESH) {
- if(modifiers_findByType(ob, eModifierType_Subsurf))
- *havesubdiv= 1;
- if(modifiers_findByType(ob, eModifierType_ParticleSystem))
- *havepart= 1;
- }
-
- if(ob->dup_group && depth <= 4) {
- GroupObject *go;
-
- for(go= ob->dup_group->gobject.first; go; go= go->next)
- object_has_subdivision_particles(go->ob, havesubdiv, havepart, depth+1);
- }
-}
-
-static void object_flip_subdivison_particles(Object *ob, int *set, int level, int mode, int particles, int depth)
-{
- ModifierData *md;
-
- if(ob->type==OB_MESH) {
- if(particles) {
- for(md=ob->modifiers.first; md; md=md->next) {
- if(md->type == eModifierType_ParticleSystem) {
- ParticleSystemModifierData *psmd = (ParticleSystemModifierData*)md;
-
- if(*set == -1)
- *set= psmd->modifier.mode&(mode);
-
- if (*set)
- psmd->modifier.mode &= ~(mode);
- else
- psmd->modifier.mode |= (mode);
- }
- }
- }
- else {
- md = modifiers_findByType(ob, eModifierType_Subsurf);
-
- if (md) {
- SubsurfModifierData *smd = (SubsurfModifierData*) md;
-
- if (level == -1) {
- if(*set == -1)
- *set= smd->modifier.mode&(mode);
-
- if (*set)
- smd->modifier.mode &= ~(mode);
- else
- smd->modifier.mode |= (mode);
- } else {
- smd->levels = level;
- }
- }
- else if(depth == 0 && *set != 0) {
- SubsurfModifierData *smd = (SubsurfModifierData*) modifier_new(eModifierType_Subsurf);
-
- BLI_addtail(&ob->modifiers, smd);
-
- if (level!=-1) {
- smd->levels = level;
- }
-
- if(*set == -1)
- *set= 1;
- }
- }
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- }
-
- if(ob->dup_group && depth<=4) {
- GroupObject *go;
-
- for(go= ob->dup_group->gobject.first; go; go= go->next)
- object_flip_subdivison_particles(go->ob, set, level, mode, particles, depth+1);
- }
-}
-
-/* Change subdivision properties of mesh object ob, if
-* level==-1 then toggle subsurf, else set to level.
-*/
-
-void flip_subdivison(int level)
-{
- Base *base;
- int set= -1;
- int mode, pupmode, particles= 0, havesubdiv= 0, havepart= 0;
-
- if(G.qual & LR_ALTKEY)
- mode= eModifierMode_Realtime;
- else
- mode= eModifierMode_Render|eModifierMode_Realtime;
-
- if(level == -1) {
- for(base= G.scene->base.first; base; base= base->next)
- if(((level==-1) && (TESTBASE(base))) || (TESTBASELIB(base)))
- object_has_subdivision_particles(base->object, &havesubdiv, &havepart, 0);
- }
- else
- havesubdiv= 1;
-
- if(havesubdiv && havepart) {
- pupmode= pupmenu("Switch%t|Subsurf %x1|Particle Systems %x2");
- if(pupmode <= 0)
- return;
- else if(pupmode == 2)
- particles= 1;
- }
- else if(havepart)
- particles= 1;
-
- for(base= G.scene->base.first; base; base= base->next)
- if(((level==-1) && (TESTBASE(base))) || (TESTBASELIB(base)))
- object_flip_subdivison_particles(base->object, &set, level, mode, particles, 0);
-
- countall();
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- DAG_scene_flush_update(G.scene, screen_view3d_layers());
-
- if(particles)
- BIF_undo_push("Switch particles on/off");
- else
- BIF_undo_push("Switch subsurf on/off");
-}
-
-static void copymenu_properties(Object *ob)
-{
- bProperty *prop, *propn, *propc;
- Base *base;
- int nr, tot=0;
- char *str;
-
- prop= ob->prop.first;
- while(prop) {
- tot++;
- prop= prop->next;
- }
-
- if(tot==0) {
- error("No properties in the active object to copy");
- return;
- }
-
- str= MEM_callocN(24+32*tot, "copymenu prop");
-
- strcpy(str, "Copy Property %t");
-
- tot= 0;
- prop= ob->prop.first;
- while(prop) {
- tot++;
- strcat(str, " |");
- strcat(str, prop->name);
- prop= prop->next;
- }
-
- nr= pupmenu(str);
- if(nr>0) {
- tot= 0;
- prop= ob->prop.first;
- while(prop) {
- tot++;
- if(tot==nr) break;
- prop= prop->next;
- }
- if(prop) {
- propc= prop;
-
- base= FIRSTBASE;
- while(base) {
- if(base != BASACT) {
- if(TESTBASELIB(base)) {
- prop= get_property(base->object, propc->name);
- if(prop) {
- free_property(prop);
- BLI_remlink(&base->object->prop, prop);
- }
- propn= copy_property(propc);
- BLI_addtail(&base->object->prop, propn);
- }
- }
- base= base->next;
- }
- }
- }
- MEM_freeN(str);
- allqueue(REDRAWVIEW3D, 0);
-
- BIF_undo_push("Copy properties");
-}
-
-static void copymenu_logicbricks(Object *ob)
-{
- Base *base;
-
- base= FIRSTBASE;
- while(base) {
- if(base->object != ob) {
- if(TESTBASELIB(base)) {
-
- /* first: free all logic */
- free_sensors(&base->object->sensors);
- unlink_controllers(&base->object->controllers);
- free_controllers(&base->object->controllers);
- unlink_actuators(&base->object->actuators);
- free_actuators(&base->object->actuators);
-
- /* now copy it, this also works without logicbricks! */
- clear_sca_new_poins_ob(ob);
- copy_sensors(&base->object->sensors, &ob->sensors);
- copy_controllers(&base->object->controllers, &ob->controllers);
- copy_actuators(&base->object->actuators, &ob->actuators);
- set_sca_new_poins_ob(base->object);
-
- /* some menu settings */
- base->object->scavisflag= ob->scavisflag;
- base->object->scaflag= ob->scaflag;
-
- }
- }
- base= base->next;
- }
- BIF_undo_push("Copy logic");
-}
-
-static void copymenu_modifiers(Object *ob)
-{
- Base *base;
- int i, event;
- char str[512];
- char *errorstr= NULL;
-
- strcpy(str, "Copy Modifiers %t");
-
- sprintf(str+strlen(str), "|All%%x%d|%%l", NUM_MODIFIER_TYPES);
-
- for (i=eModifierType_None+1; i<NUM_MODIFIER_TYPES; i++) {
- ModifierTypeInfo *mti = modifierType_getInfo(i);
-
- if (ELEM(i, eModifierType_Hook, eModifierType_Softbody)) continue;
-
- if ( (mti->flags&eModifierTypeFlag_AcceptsCVs) ||
- (ob->type==OB_MESH && (mti->flags&eModifierTypeFlag_AcceptsMesh))) {
- sprintf(str+strlen(str), "|%s%%x%d", mti->name, i);
- }
- }
-
- event = pupmenu(str);
- if(event<=0) return;
-
- for (base= FIRSTBASE; base; base= base->next) {
- if(base->object != ob) {
- if(TESTBASELIB(base)) {
- ModifierData *md;
-
- base->object->recalc |= OB_RECALC_OB|OB_RECALC_DATA;
-
- if (base->object->type==ob->type) {
- /* copy all */
- if (event==NUM_MODIFIER_TYPES) {
- object_free_modifiers(base->object);
-
- for (md=ob->modifiers.first; md; md=md->next) {
- if (md->type!=eModifierType_Hook) {
- ModifierData *nmd = modifier_new(md->type);
- modifier_copyData(md, nmd);
- BLI_addtail(&base->object->modifiers, nmd);
- }
- }
- } else {
- /* copy specific types */
- ModifierData *md, *mdn;
-
- /* remove all with type 'event' */
- for (md=base->object->modifiers.first; md; md=mdn) {
- mdn= md->next;
- if(md->type==event) {
- BLI_remlink(&base->object->modifiers, md);
- modifier_free(md);
- }
- }
-
- /* copy all with type 'event' */
- for (md=ob->modifiers.first; md; md=md->next) {
- if (md->type==event) {
-
- mdn = modifier_new(event);
- BLI_addtail(&base->object->modifiers, mdn);
-
- modifier_copyData(md, mdn);
- }
- }
- }
- }
- else
- errorstr= "Did not copy modifiers to other Object types";
- }
- }
- }
-
- if(errorstr) notice(errorstr);
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- DAG_scene_sort(G.scene);
-
- BIF_undo_push("Copy modifiers");
-}
-
-/* both pointers should exist */
-static void copy_texture_space(Object *to, Object *ob)
-{
- float *poin1= NULL, *poin2= NULL;
- int texflag= 0;
-
- if(ob->type==OB_MESH) {
- texflag= ((Mesh *)ob->data)->texflag;
- poin2= ((Mesh *)ob->data)->loc;
- }
- else if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
- texflag= ((Curve *)ob->data)->texflag;
- poin2= ((Curve *)ob->data)->loc;
- }
- else if(ob->type==OB_MBALL) {
- texflag= ((MetaBall *)ob->data)->texflag;
- poin2= ((MetaBall *)ob->data)->loc;
- }
- else
- return;
-
- if(to->type==OB_MESH) {
- ((Mesh *)to->data)->texflag= texflag;
- poin1= ((Mesh *)to->data)->loc;
- }
- else if (ELEM3(to->type, OB_CURVE, OB_SURF, OB_FONT)) {
- ((Curve *)to->data)->texflag= texflag;
- poin1= ((Curve *)to->data)->loc;
- }
- else if(to->type==OB_MBALL) {
- ((MetaBall *)to->data)->texflag= texflag;
- poin1= ((MetaBall *)to->data)->loc;
- }
- else
- return;
-
- memcpy(poin1, poin2, 9*sizeof(float)); /* this was noted in DNA_mesh, curve, mball */
-
- if(to->type==OB_MESH) ;
- else if(to->type==OB_MBALL) tex_space_mball(to);
- else tex_space_curve(to->data);
-
-}
-
-void copy_attr(short event)
-{
- Object *ob;
- Base *base;
- Curve *cu, *cu1;
- Nurb *nu;
- int do_scene_sort= 0;
-
- if(G.scene->id.lib) return;
-
- if(!(ob=OBACT)) return;
-
- if(G.obedit) {
- /* obedit_copymenu(); */
- return;
- }
- if(event==9) {
- copymenu_properties(ob);
- return;
- }
- else if(event==10) {
- copymenu_logicbricks(ob);
- return;
- }
- else if(event==24) {
- copymenu_modifiers(ob);
- return;
- }
-
- base= FIRSTBASE;
- while(base) {
- if(base != BASACT) {
- if(TESTBASELIB(base)) {
- base->object->recalc |= OB_RECALC_OB;
-
- if(event==1) { /* loc */
- VECCOPY(base->object->loc, ob->loc);
- VECCOPY(base->object->dloc, ob->dloc);
- }
- else if(event==2) { /* rot */
- VECCOPY(base->object->rot, ob->rot);
- VECCOPY(base->object->drot, ob->drot);
- VECCOPY(base->object->quat, ob->quat);
- VECCOPY(base->object->dquat, ob->dquat);
- }
- else if(event==3) { /* size */
- VECCOPY(base->object->size, ob->size);
- VECCOPY(base->object->dsize, ob->dsize);
- }
- else if(event==4) { /* drawtype */
- base->object->dt= ob->dt;
- base->object->dtx= ob->dtx;
- base->object->empty_drawtype= ob->empty_drawtype;
- base->object->empty_drawsize= ob->empty_drawsize;
- }
- else if(event==5) { /* time offs */
- base->object->sf= ob->sf;
- }
- else if(event==6) { /* dupli */
- base->object->dupon= ob->dupon;
- base->object->dupoff= ob->dupoff;
- base->object->dupsta= ob->dupsta;
- base->object->dupend= ob->dupend;
-
- base->object->transflag &= ~OB_DUPLI;
- base->object->transflag |= (ob->transflag & OB_DUPLI);
-
- base->object->dup_group= ob->dup_group;
- if(ob->dup_group)
- id_us_plus((ID *)ob->dup_group);
- }
- else if(event==7) { /* mass */
- base->object->mass= ob->mass;
- }
- else if(event==8) { /* damping */
- base->object->damping= ob->damping;
- base->object->rdamping= ob->rdamping;
- }
- else if(event==17) { /* tex space */
- copy_texture_space(base->object, ob);
- }
- else if(event==18) { /* font settings */
-
- if(base->object->type==ob->type) {
- cu= ob->data;
- cu1= base->object->data;
-
- cu1->spacemode= cu->spacemode;
- cu1->spacing= cu->spacing;
- cu1->linedist= cu->linedist;
- cu1->shear= cu->shear;
- cu1->fsize= cu->fsize;
- cu1->xof= cu->xof;
- cu1->yof= cu->yof;
- cu1->textoncurve= cu->textoncurve;
- cu1->wordspace= cu->wordspace;
- cu1->ulpos= cu->ulpos;
- cu1->ulheight= cu->ulheight;
- if(cu1->vfont) cu1->vfont->id.us--;
- cu1->vfont= cu->vfont;
- id_us_plus((ID *)cu1->vfont);
- if(cu1->vfontb) cu1->vfontb->id.us--;
- cu1->vfontb= cu->vfontb;
- id_us_plus((ID *)cu1->vfontb);
- if(cu1->vfonti) cu1->vfonti->id.us--;
- cu1->vfonti= cu->vfonti;
- id_us_plus((ID *)cu1->vfonti);
- if(cu1->vfontbi) cu1->vfontbi->id.us--;
- cu1->vfontbi= cu->vfontbi;
- id_us_plus((ID *)cu1->vfontbi);
-
- text_to_curve(base->object, 0); /* needed? */
-
-
- strcpy(cu1->family, cu->family);
-
- base->object->recalc |= OB_RECALC_DATA;
- }
- }
- else if(event==19) { /* bevel settings */
-
- if ELEM(base->object->type, OB_CURVE, OB_FONT) {
- cu= ob->data;
- cu1= base->object->data;
-
- cu1->bevobj= cu->bevobj;
- cu1->taperobj= cu->taperobj;
- cu1->width= cu->width;
- cu1->bevresol= cu->bevresol;
- cu1->ext1= cu->ext1;
- cu1->ext2= cu->ext2;
-
- base->object->recalc |= OB_RECALC_DATA;
- }
- }
- else if(event==25) { /* curve resolution */
-
- if ELEM(base->object->type, OB_CURVE, OB_FONT) {
- cu= ob->data;
- cu1= base->object->data;
-
- cu1->resolu= cu->resolu;
- cu1->resolu_ren= cu->resolu_ren;
-
- nu= cu1->nurb.first;
-
- while(nu) {
- nu->resolu= cu1->resolu;
- nu= nu->next;
- }
-
- base->object->recalc |= OB_RECALC_DATA;
- }
- }
- else if(event==20) { /* particle settings */
- PartEff *pa1, *pa2;
- char *p1, *p2;
-
- pa1= give_parteff(ob);
- pa2= give_parteff(base->object);
-
- if(pa1==0 && pa2) {
- BLI_remlink( &(base->object->effect), pa2);
- free_effect( (Effect *) pa2);
- }
- else if(pa1 && pa2==0) {
- free_effects(&(base->object->effect));
- copy_effects(&(base->object->effect), &ob->effect);
- build_particle_system(base->object);
- }
- else if(pa1 && pa2) {
- if(pa2->keys) MEM_freeN(pa2->keys);
-
- p1= (char *)pa1; p2= (char *)pa2;
- memcpy( p2+8, p1+8, sizeof(PartEff) - 8);
- pa2->keys= 0;
-
- build_particle_system(base->object);
- }
- }
- else if(event==21){
- if (base->object->type==OB_MESH) {
- ModifierData *md = modifiers_findByType(ob, eModifierType_Subsurf);
-
- if (md) {
- ModifierData *tmd = modifiers_findByType(base->object, eModifierType_Subsurf);
-
- if (!tmd) {
- tmd = modifier_new(eModifierType_Subsurf);
- BLI_addtail(&base->object->modifiers, tmd);
- }
-
- modifier_copyData(md, tmd);
- base->object->recalc |= OB_RECALC_DATA;
- }
- }
- }
- else if(event==22) {
- /* Clear the constraints on the target */
- free_constraints(&base->object->constraints);
- free_constraint_channels(&base->object->constraintChannels);
-
- /* Copy the constraint channels over */
- copy_constraints(&base->object->constraints, &ob->constraints);
- if (U.dupflag& USER_DUP_IPO)
- copy_constraint_channels(&base->object->constraintChannels, &ob->constraintChannels);
- else
- clone_constraint_channels (&base->object->constraintChannels, &ob->constraintChannels);
-
- do_scene_sort= 1;
- }
- else if(event==23) {
- base->object->softflag= ob->softflag;
- if(base->object->soft) sbFree(base->object->soft);
-
- base->object->soft= copy_softbody(ob->soft);
-
- if (!modifiers_findByType(base->object, eModifierType_Softbody)) {
- BLI_addhead(&base->object->modifiers, modifier_new(eModifierType_Softbody));
- }
- }
- else if(event==26) {
- copy_nlastrips(&base->object->nlastrips, &ob->nlastrips);
- }
- else if(event==27) { /* autosmooth */
- if (base->object->type==OB_MESH) {
- Mesh *me= ob->data;
- Mesh *cme= base->object->data;
- cme->smoothresh= me->smoothresh;
- if(me->flag & ME_AUTOSMOOTH)
- cme->flag |= ME_AUTOSMOOTH;
- else
- cme->flag &= ~ME_AUTOSMOOTH;
- }
- }
- else if(event==28) { /* UV orco */
- if ELEM(base->object->type, OB_CURVE, OB_SURF) {
- cu= ob->data;
- cu1= base->object->data;
-
- if(cu->flag & CU_UV_ORCO)
- cu1->flag |= CU_UV_ORCO;
- else
- cu1->flag &= ~CU_UV_ORCO;
- }
- }
- else if(event==29) { /* protected bits */
- base->object->protectflag= ob->protectflag;
- }
- else if(event==30) { /* index object */
- base->object->index= ob->index;
- }
- }
- }
- base= base->next;
- }
-
- allqueue(REDRAWVIEW3D, 0);
- if(do_scene_sort)
- DAG_scene_sort(G.scene);
-
- DAG_scene_flush_update(G.scene, screen_view3d_layers());
-
- if(event==20) {
- allqueue(REDRAWBUTSOBJECT, 0);
- }
-
- BIF_undo_push("Copy Attributes");
-}
-
-void copy_attr_menu()
-{
- Object *ob;
- short event;
- char str[512];
-
- if(!(ob=OBACT)) return;
-
- if (G.obedit) {
- if (ob->type == OB_MESH)
- mesh_copy_menu();
- return;
- }
-
- /* Object Mode */
-
- /* If you change this menu, don't forget to update the menu in header_view3d.c
- * view3d_edit_object_copyattrmenu() and in toolbox.c
- */
-
- strcpy(str, "Copy Attributes %t|Location%x1|Rotation%x2|Size%x3|Draw Options%x4|Time Offset%x5|Dupli%x6|%l|Mass%x7|Damping%x8|Properties%x9|Logic Bricks%x10|Protected Transform%x29|%l");
-
- strcat (str, "|Object Constraints%x22");
- strcat (str, "|NLA Strips%x26");
-
- if ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL) {
- strcat(str, "|Texture Space%x17");
- }
-
- if(ob->type == OB_FONT) strcat(str, "|Font Settings%x18|Bevel Settings%x19");
- if(ob->type == OB_CURVE) strcat(str, "|Bevel Settings%x19|UV Orco%x28");
-
- if((ob->type == OB_FONT) || (ob->type == OB_CURVE)) {
- strcat(str, "|Curve Resolution%x25");
- }
-
- if(ob->type==OB_MESH){
- strcat(str, "|Subsurf Settings%x21|AutoSmooth%x27");
- }
-
- if( give_parteff(ob) ) strcat(str, "|Particle Settings%x20");
-
- if(ob->soft) strcat(str, "|Soft Body Settings%x23");
-
- strcat(str, "|Pass Index%x30");
-
- if(ob->type==OB_MESH || ob->type==OB_CURVE || ob->type==OB_LATTICE || ob->type==OB_SURF){
- strcat(str, "|Modifiers ...%x24");
- }
-
- event= pupmenu(str);
- if(event<= 0) return;
-
- copy_attr(event);
-}
-
-
-void link_to_scene(unsigned short nr)
-{
- Scene *sce= (Scene*) BLI_findlink(&G.main->scene, G.curscreen->scenenr-1);
- Base *base, *nbase;
-
- if(sce==0) return;
- if(sce->id.lib) return;
-
- base= FIRSTBASE;
- while(base) {
- if(TESTBASE(base)) {
-
- nbase= MEM_mallocN( sizeof(Base), "newbase");
- *nbase= *base;
- BLI_addhead( &(sce->base), nbase);
- id_us_plus((ID *)base->object);
- }
- base= base->next;
- }
-}
-
-void make_links_menu()
-{
- Object *ob;
- short event=0;
- char str[140];
-
- if(!(ob=OBACT)) return;
-
- strcpy(str, "Make Links %t|To Scene...%x1|%l|Object Ipo%x4");
-
- if(ob->type==OB_MESH)
- strcat(str, "|Mesh Data%x2|Materials%x3");
- else if(ob->type==OB_CURVE)
- strcat(str, "|Curve Data%x2|Materials%x3");
- else if(ob->type==OB_FONT)
- strcat(str, "|Text Data%x2|Materials%x3");
- else if(ob->type==OB_SURF)
- strcat(str, "|Surface Data%x2|Materials%x3");
- else if(ob->type==OB_MBALL)
- strcat(str, "|Materials%x3");
- else if(ob->type==OB_CAMERA)
- strcat(str, "|Camera Data%x2");
- else if(ob->type==OB_LAMP)
- strcat(str, "|Lamp Data%x2");
- else if(ob->type==OB_LATTICE)
- strcat(str, "|Lattice Data%x2");
- else if(ob->type==OB_ARMATURE)
- strcat(str, "|Armature Data%x2");
-
- event= pupmenu(str);
-
- if(event<= 0) return;
-
- make_links(event);
-}
-
-void make_links(short event)
-{
- Object *ob, *obt;
- Base *base, *nbase, *sbase;
- Scene *sce = NULL;
- ID *id;
- int a;
- short nr=0;
- char *strp;
-
- if(!(ob=OBACT)) return;
-
- if(event==1) {
- IDnames_to_pupstring(&strp, NULL, NULL, &(G.main->scene), 0, &nr);
-
- if(nr == -2) {
- MEM_freeN(strp);
-
- activate_databrowse((ID *)G.scene, ID_SCE, 0, B_INFOSCE, &(G.curscreen->scenenr), link_to_scene );
-
- return;
- }
- else {
- event= pupmenu_col(strp, 20);
- MEM_freeN(strp);
-
- if(event<= 0) return;
-
- nr= 1;
- sce= G.main->scene.first;
- while(sce) {
- if(nr==event) break;
- nr++;
- sce= sce->id.next;
- }
- if(sce==G.scene) {
- error("This is the current scene");
- return;
- }
- if(sce==0 || sce->id.lib) return;
-
- /* remember: is needed below */
- event= 1;
- }
- }
-
- /* All non group linking */
- base= FIRSTBASE;
- while(base) {
- if(event==1 || base != BASACT) {
-
- obt= base->object;
-
- if(TESTBASE(base)) {
-
- if(event==1) { /* to scene */
-
- /* test if already linked */
- sbase= sce->base.first;
- while(sbase) {
- if(sbase->object==base->object) break;
- sbase= sbase->next;
- }
- if(sbase) { /* remove */
- base= base->next;
- continue;
- }
-
- nbase= MEM_mallocN( sizeof(Base), "newbase");
- *nbase= *base;
- BLI_addhead( &(sce->base), nbase);
- id_us_plus((ID *)base->object);
- }
- }
- if(TESTBASELIB(base)) {
- if(event==2 || event==5) { /* obdata */
- if(ob->type==obt->type) {
-
- id= obt->data;
- id->us--;
-
- id= ob->data;
- id_us_plus(id);
- obt->data= id;
-
- /* if amount of material indices changed: */
- test_object_materials(obt->data);
-
- obt->recalc |= OB_RECALC_DATA;
- }
- }
- else if(event==4) { /* ob ipo */
- if(obt->ipo) obt->ipo->id.us--;
- obt->ipo= ob->ipo;
- if(obt->ipo) {
- id_us_plus((ID *)obt->ipo);
- do_ob_ipo(obt);
- }
- }
- else if(event==6) {
- if(ob->dup_group) ob->dup_group->id.us--;
- obt->dup_group= ob->dup_group;
- if(obt->dup_group) {
- id_us_plus((ID *)obt->dup_group);
- obt->transflag |= OB_DUPLIGROUP;
- }
- }
- else if(event==3) { /* materials */
-
- /* new approach, using functions from kernel */
- for(a=0; a<ob->totcol; a++) {
- Material *ma= give_current_material(ob, a+1);
- assign_material(obt, ma, a+1); /* also works with ma==NULL */
- }
- }
- }
- }
- base= base->next;
- }
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWBUTSHEAD, 0);
-
- DAG_scene_flush_update(G.scene, screen_view3d_layers());
-
- BIF_undo_push("Create links");
-}
-
-void apply_object()
-{
- Base *base, *basact;
- Object *ob;
- Mesh *me;
- Curve *cu;
- Nurb *nu;
- BPoint *bp;
- BezTriple *bezt;
- MVert *mvert;
- float mat[3][3];
- int a;
-
- if(G.scene->id.lib) return;
- if(G.obedit) return;
- basact= BASACT;
-
- if(G.qual & LR_SHIFTKEY) {
- ob= OBACT;
- if(ob==0) return;
-
- if(ob->transflag & OB_DUPLI) {
- make_duplilist_real();
- }
- else {
- if(okee("Apply deformation")) {
- object_apply_deform(ob);
- BIF_undo_push("Apply deformation");
- }
- }
- allqueue(REDRAWVIEW3D, 0);
-
- return;
- }
-
- if(okee("Apply scale and rotation")==0) return;
-
- base= FIRSTBASE;
- while(base) {
- if TESTBASELIB(base) {
- ob= base->object;
-
- if(ob->type==OB_MESH) {
- object_to_mat3(ob, mat);
- me= ob->data;
-
- if(me->id.us>1) {
- error("Can't apply to a multi user mesh");
- return;
- }
- if(me->key) {
- error("Can't apply to a mesh with vertex keys");
- return;
- }
-
- mvert= me->mvert;
- for(a=0; a<me->totvert; a++, mvert++) {
- Mat3MulVecfl(mat, mvert->co);
- }
- ob->size[0]= ob->size[1]= ob->size[2]= 1.0;
- ob->rot[0]= ob->rot[1]= ob->rot[2]= 0.0;
- QuatOne(ob->quat);
-
- where_is_object(ob);
-
- /* texspace and normals */
- BASACT= base;
- enter_editmode(EM_WAITCURSOR);
- BIF_undo_push("Applied object"); /* editmode undo itself */
- exit_editmode(EM_FREEDATA|EM_WAITCURSOR); /* freedata, but no undo */
- BASACT= basact;
-
- }
- else if (ob->type==OB_ARMATURE){
- bArmature *arm;
-
- object_to_mat3(ob, mat);
- arm= ob->data;
- if(arm->id.us>1) {
- error("Can't apply to a multi user armature");
- return;
- }
-
- apply_rot_armature (ob, mat);
- /* Reset the object's transforms */
- ob->size[0]= ob->size[1]= ob->size[2]= 1.0;
- ob->rot[0]= ob->rot[1]= ob->rot[2]= 0.0;
- QuatOne(ob->quat);
-
- where_is_object(ob);
- }
- else if ELEM(ob->type, OB_CURVE, OB_SURF) {
- float scale;
- object_to_mat3(ob, mat);
- scale = Mat3ToScalef(mat);
- cu= ob->data;
-
- if(cu->id.us>1) {
- error("Can't apply to a multi user curve");
- return;
- }
- if(cu->key) {
- error("Can't apply to a curve with vertex keys");
- return;
- }
-
- nu= cu->nurb.first;
- while(nu) {
- if( (nu->type & 7)==1) {
- a= nu->pntsu;
- bezt= nu->bezt;
- while(a--) {
- Mat3MulVecfl(mat, bezt->vec[0]);
- Mat3MulVecfl(mat, bezt->vec[1]);
- Mat3MulVecfl(mat, bezt->vec[2]);
- bezt->radius *= scale;
- bezt++;
- }
- }
- else {
- a= nu->pntsu*nu->pntsv;
- bp= nu->bp;
- while(a--) {
- Mat3MulVecfl(mat, bp->vec);
- bp++;
- }
- }
- nu= nu->next;
- }
-
- ob->size[0]= ob->size[1]= ob->size[2]= 1.0;
- ob->rot[0]= ob->rot[1]= ob->rot[2]= 0.0;
- QuatOne(ob->quat);
-
- where_is_object(ob);
-
- /* texspace and normals */
- BASACT= base;
- enter_editmode(EM_WAITCURSOR);
- BIF_undo_push("Applied object"); /* editmode undo itself */
- exit_editmode(EM_FREEDATA|EM_WAITCURSOR); /* freedata, but no undo */
- BASACT= basact;
- }
- }
- base= base->next;
- }
-
- allqueue(REDRAWVIEW3D, 0);
- BIF_undo_push("Apply object");
-}
-
-
-
-/* ************ GENERAL *************** */
-
-
-/* now only used in 2d spaces, like ipo, nla, sima... */
-void apply_keyb_grid(float *val, float fac1, float fac2, float fac3, int invert)
-{
- /* fac1 is for 'nothing', fac2 for CTRL, fac3 for SHIFT */
- int ctrl;
-
- if(invert) {
- if(G.qual & LR_CTRLKEY) ctrl= 0;
- else ctrl= 1;
- }
- else ctrl= (G.qual & LR_CTRLKEY);
-
- if(ctrl && (G.qual & LR_SHIFTKEY)) {
- if(fac3!= 0.0) *val= fac3*floor(*val/fac3 +.5);
- }
- else if(ctrl) {
- if(fac2!= 0.0) *val= fac2*floor(*val/fac2 +.5);
- }
- else {
- if(fac1!= 0.0) *val= fac1*floor(*val/fac1 +.5);
- }
-}
-
-int cylinder_intersect_test(void)
-{
- EditMesh *em = G.editMesh;
- float *oldloc, speed[3], s, t, labda, labdacor, dist, len, len2, axis[3], *base, rc[3], n[3], o[3];
- EditVert *v1;
-
- v1= em->verts.first;
-
- base= v1->co;
- v1= v1->next;
- VecSubf(axis, v1->co, base);
-
- v1= v1->next;
- oldloc= v1->co;
- v1= v1->next;
- VecSubf(speed, v1->co, oldloc);
-
- VecSubf(rc, oldloc, base);
-
- /* the axis */
- len2= Normalize(axis);
-
- Crossf(n, speed, axis);
- len= Normalize(n);
- if(len==0.0) return 0;
-
- dist= fabs( rc[0]*n[0] + rc[1]*n[1] + rc[2]*n[2] );
-
- if( dist>=G.scene->editbutsize ) return 0;
-
- Crossf(o, rc, axis);
- t= -(o[0]*n[0] + o[1]*n[1] + o[2]*n[2])/len;
-
- Crossf(o, n, axis);
- s= fabs(sqrt(G.scene->editbutsize*G.scene->editbutsize-dist*dist) / (o[0]*speed[0] + o[1]*speed[1] + o[2]*speed[2]));
-
- labdacor= t-s;
- labda= t+s;
-
- /* two cases with no intersection point */
- if(labdacor>=1.0 && labda>=1.0) return 0;
- if(labdacor<=0.0 && labda<=0.0) return 0;
-
- /* calc normal */
- /* intersection: */
-
- rc[0]= oldloc[0] + labdacor*speed[0] - base[0];
- rc[1]= oldloc[1] + labdacor*speed[1] - base[1];
- rc[2]= oldloc[2] + labdacor*speed[2] - base[2];
-
- s= (rc[0]*axis[0] + rc[1]*axis[1] + rc[2]*axis[2]) ;
-
- if(s<0.0 || s>len2) return 0;
-
- n[0]= (rc[0] - s*axis[0]);
- n[1]= (rc[1] - s*axis[1]);
- n[2]= (rc[2] - s*axis[2]);
-
- printf("var1: %f, var2: %f, var3: %f\n", labdacor, len2, s);
- printf("var1: %f, var2: %f, var3: %f\n", rc[0], rc[1], rc[2]);
- printf("var1: %f, var2: %f, var3: %f\n", n[0], n[1], n[2]);
-
- return 1;
-}
-
-int sphere_intersect_test(void)
-{
- EditMesh *em = G.editMesh;
- float *oldloc, speed[3], labda, labdacor, len, bsq, u, disc, *base, rc[3];
- EditVert *v1;
-
- v1= em->verts.first;
- base= v1->co;
-
- v1= v1->next;
- oldloc= v1->co;
-
- v1= v1->next;
- VecSubf(speed, v1->co, oldloc);
- len= Normalize(speed);
- if(len==0.0) return 0;
-
- VecSubf(rc, oldloc, base);
- bsq= rc[0]*speed[0] + rc[1]*speed[1] + rc[2]*speed[2];
- u= rc[0]*rc[0] + rc[1]*rc[1] + rc[2]*rc[2] - G.scene->editbutsize*G.scene->editbutsize;
-
- disc= bsq*bsq - u;
-
- if(disc>=0.0) {
- disc= sqrt(disc);
- labdacor= (-bsq - disc)/len; /* entry point */
- labda= (-bsq + disc)/len;
-
- printf("var1: %f, var2: %f, var3: %f\n", labdacor, labda, G.scene->editbutsize);
- }
- else return 0;
-
- /* intersection and normal */
- rc[0]= oldloc[0] + labdacor*speed[0] - base[0];
- rc[1]= oldloc[1] + labdacor*speed[1] - base[1];
- rc[2]= oldloc[2] + labdacor*speed[2] - base[2];
-
-
- return 1;
-}
-
-
-void std_rmouse_transform(void (*xf_func)(int, int))
-{
- short mval[2];
- short xo, yo;
- short timer=0;
- short mousebut;
-
- /* check for left mouse select/right mouse select */
-
- if(curarea->spacetype==SPACE_NODE)
- mousebut = L_MOUSE|R_MOUSE;
- else if (U.flag & USER_LMOUSESELECT)
- mousebut = L_MOUSE;
- else
- mousebut = R_MOUSE;
-
- getmouseco_areawin(mval);
- xo= mval[0];
- yo= mval[1];
-
- while(get_mbut() & mousebut) {
- getmouseco_areawin(mval);
- if(abs(mval[0]-xo)+abs(mval[1]-yo) > 10) {
- if(curarea->spacetype==SPACE_VIEW3D) {
-#ifdef TWEAK_MODE
- initTransform(TFM_TRANSLATION, CTX_TWEAK);
-#else
- initTransform(TFM_TRANSLATION, CTX_NONE);
-#endif
- Transform();
- }
- else if(curarea->spacetype==SPACE_IMAGE) {
- initTransform(TFM_TRANSLATION, CTX_NONE);
- Transform();
- }
- else if(xf_func)
- xf_func('g', 0);
-
- while(get_mbut() & mousebut) BIF_wait_for_statechange();
- return;
- }
- else {
- PIL_sleep_ms(10);
- timer++;
- if(timer>=10*U.tb_rightmouse) {
- if(curarea->spacetype==SPACE_VIEW3D) {
- toolbox_n();
- return;
- }
- }
- }
- }
- /* if gets here it's a select */
- BIF_undo_push("Select");
-}
-
-void rightmouse_transform(void)
-{
- std_rmouse_transform(NULL);
-}
-
-
-/* ************************************** */
-
-
-static void single_object_users__forwardModifierLinks(void *userData, Object *ob, Object **obpoin)
-{
- ID_NEW(*obpoin);
-}
-void single_object_users(int flag)
-{
- Base *base;
- Object *ob, *obn;
-
- clear_sca_new_poins(); /* sensor/contr/act */
-
- /* duplicate */
- base= FIRSTBASE;
- while(base) {
- ob= base->object;
-
- if( (base->flag & flag)==flag) {
-
- if(ob->id.lib==NULL && ob->id.us>1) {
-
- obn= copy_object(ob);
- ob->id.us--;
- base->object= obn;
- }
- }
- base= base->next;
- }
-
- ID_NEW(G.scene->camera);
- if(G.vd) ID_NEW(G.vd->camera);
-
- /* object pointers */
- base= FIRSTBASE;
- while(base) {
- ob= base->object;
- if(ob->id.lib==NULL) {
- if( (base->flag & flag)==flag) {
-
- relink_constraints(&base->object->constraints);
- if (base->object->pose){
- bPoseChannel *chan;
- for (chan = base->object->pose->chanbase.first; chan; chan=chan->next){
- relink_constraints(&chan->constraints);
- }
- }
- modifiers_foreachObjectLink(base->object, single_object_users__forwardModifierLinks, NULL);
-
- ID_NEW(ob->parent);
- ID_NEW(ob->track);
- }
- }
- base= base->next;
- }
-
- set_sca_new_poins();
-}
-
-void new_id_matar(Material **matar, int totcol)
-{
- ID *id;
- int a;
-
- for(a=0; a<totcol; a++) {
- id= (ID *)matar[a];
- if(id && id->lib==0) {
- if(id->newid) {
- matar[a]= (Material *)id->newid;
- id_us_plus(id->newid);
- id->us--;
- }
- else if(id->us>1) {
- matar[a]= copy_material(matar[a]);
- id->us--;
- id->newid= (ID *)matar[a];
- }
- }
- }
-}
-
-void single_obdata_users(int flag)
-{
- Object *ob;
- Lamp *la;
- Curve *cu;
- Camera *cam;
- Base *base;
- Mesh *me;
- ID *id;
- int a;
-
-#ifdef WITH_VERSE
- base= FIRSTBASE;
- while(base) {
- ob= base->object;
- if(ob->vnode) {
- error("Can't make data single user, when data are shared at verse server");
- return;
- }
- base = base->next;
- }
-#endif
-
- base= FIRSTBASE;
- while(base) {
- ob= base->object;
- if(ob->id.lib==NULL && (base->flag & flag)==flag ) {
- id= ob->data;
-
- if(id && id->us>1 && id->lib==0) {
- ob->recalc= OB_RECALC_DATA;
-
- switch(ob->type) {
- case OB_LAMP:
- if(id && id->us>1 && id->lib==NULL) {
- ob->data= la= copy_lamp(ob->data);
- for(a=0; a<MAX_MTEX; a++) {
- if(la->mtex[a]) {
- ID_NEW(la->mtex[a]->object);
- }
- }
- }
- break;
- case OB_CAMERA:
- ob->data= copy_camera(ob->data);
- break;
- case OB_MESH:
- me= ob->data= copy_mesh(ob->data);
- if(me && me->key)
- ipo_idnew(me->key->ipo); /* drivers */
- break;
- case OB_MBALL:
- ob->data= copy_mball(ob->data);
- break;
- case OB_CURVE:
- case OB_SURF:
- case OB_FONT:
- ob->data= cu= copy_curve(ob->data);
- ID_NEW(cu->bevobj);
- ID_NEW(cu->taperobj);
- break;
- case OB_LATTICE:
- ob->data= copy_lattice(ob->data);
- break;
- case OB_ARMATURE:
- ob->recalc |= OB_RECALC_DATA;
- ob->data= copy_armature(ob->data);
- armature_rebuild_pose(ob, ob->data);
- break;
- default:
- printf("ERROR single_obdata_users: %s\n", id->name);
- error("Read console");
- return;
- }
-
- id->us--;
- id->newid= ob->data;
-
- }
-
- id= (ID *)ob->action;
- if (id && id->us>1 && id->lib==NULL){
- if(id->newid){
- ob->action= (bAction *)id->newid;
- id_us_plus(id->newid);
- }
- else {
- ob->action= copy_action(ob->action);
- id->us--;
- id->newid=(ID *)ob->action;
- }
- }
- id= (ID *)ob->ipo;
- if(id && id->us>1 && id->lib==NULL) {
- if(id->newid) {
- ob->ipo= (Ipo *)id->newid;
- id_us_plus(id->newid);
- }
- else {
- ob->ipo= copy_ipo(ob->ipo);
- id->us--;
- id->newid= (ID *)ob->ipo;
- }
- ipo_idnew(ob->ipo); /* drivers */
- }
- /* other ipos */
- switch(ob->type) {
- case OB_LAMP:
- la= ob->data;
- if(la->ipo && la->ipo->id.us>1) {
- la->ipo->id.us--;
- la->ipo= copy_ipo(la->ipo);
- ipo_idnew(la->ipo); /* drivers */
- }
- break;
- case OB_CAMERA:
- cam= ob->data;
- if(cam->ipo && cam->ipo->id.us>1) {
- cam->ipo->id.us--;
- cam->ipo= copy_ipo(cam->ipo);
- ipo_idnew(cam->ipo); /* drivers */
- }
- break;
- }
-
- }
- base= base->next;
- }
-
- me= G.main->mesh.first;
- while(me) {
- ID_NEW(me->texcomesh);
- me= me->id.next;
- }
-}
-
-
-void single_mat_users(int flag)
-{
- Object *ob;
- Base *base;
- Material *ma, *man;
- Tex *tex;
- int a, b;
-
-
- base= FIRSTBASE;
- while(base) {
- ob= base->object;
- if(ob->id.lib==NULL && (flag==0 || (base->flag & SELECT)) ) {
-
- for(a=1; a<=ob->totcol; a++) {
- ma= give_current_material(ob, a);
- if(ma) {
- /* do not test for LIB_NEW: this functions guaranteed delivers single_users! */
-
- if(ma->id.us>1) {
- man= copy_material(ma);
-
- man->id.us= 0;
- assign_material(ob, man, a);
-
- if(ma->ipo) {
- man->ipo= copy_ipo(ma->ipo);
- ma->ipo->id.us--;
- ipo_idnew(ma->ipo); /* drivers */
- }
-
- for(b=0; b<MAX_MTEX; b++) {
- if(ma->mtex[b] && ma->mtex[b]->tex) {
- tex= ma->mtex[b]->tex;
- if(tex->id.us>1) {
- ma->mtex[b]->tex= copy_texture(tex);
- tex->id.us--;
- }
- }
- }
-
- }
- }
- }
- }
- base= base->next;
- }
-}
-
-void do_single_tex_user(Tex **from)
-{
- Tex *tex, *texn;
-
- tex= *from;
- if(tex==0) return;
-
- if(tex->id.newid) {
- *from= (Tex *)tex->id.newid;
- id_us_plus(tex->id.newid);
- tex->id.us--;
- }
- else if(tex->id.us>1) {
- texn= copy_texture(tex);
- tex->id.newid= (ID *)texn;
- tex->id.us--;
- *from= texn;
- }
-
-}
-
-void single_tex_users_expand()
-{
- /* only when 'parent' blocks are LIB_NEW */
- Material *ma;
- Lamp *la;
- World *wo;
- int b;
-
- ma= G.main->mat.first;
- while(ma) {
- if(ma->id.flag & LIB_NEW) {
- for(b=0; b<MAX_MTEX; b++) {
- if(ma->mtex[b] && ma->mtex[b]->tex) {
- do_single_tex_user( &(ma->mtex[b]->tex) );
- }
- }
- }
- ma= ma->id.next;
- }
-
- la= G.main->lamp.first;
- while(la) {
- if(la->id.flag & LIB_NEW) {
- for(b=0; b<MAX_MTEX; b++) {
- if(la->mtex[b] && la->mtex[b]->tex) {
- do_single_tex_user( &(la->mtex[b]->tex) );
- }
- }
- }
- la= la->id.next;
- }
- wo= G.main->world.first;
- while(wo) {
- if(wo->id.flag & LIB_NEW) {
- for(b=0; b<MAX_MTEX; b++) {
- if(wo->mtex[b] && wo->mtex[b]->tex) {
- do_single_tex_user( &(wo->mtex[b]->tex) );
- }
- }
- }
- wo= wo->id.next;
- }
-}
-
-void single_mat_users_expand(void)
-{
- /* only when 'parent' blocks are LIB_NEW */
-
- Object *ob;
- Mesh *me;
- Curve *cu;
- MetaBall *mb;
- Material *ma;
- int a;
-
- ob= G.main->object.first;
- while(ob) {
- if(ob->id.flag & LIB_NEW) {
- new_id_matar(ob->mat, ob->totcol);
- }
- ob= ob->id.next;
- }
-
- me= G.main->mesh.first;
- while(me) {
- if(me->id.flag & LIB_NEW) {
- new_id_matar(me->mat, me->totcol);
- }
- me= me->id.next;
- }
-
- cu= G.main->curve.first;
- while(cu) {
- if(cu->id.flag & LIB_NEW) {
- new_id_matar(cu->mat, cu->totcol);
- }
- cu= cu->id.next;
- }
-
- mb= G.main->mball.first;
- while(mb) {
- if(mb->id.flag & LIB_NEW) {
- new_id_matar(mb->mat, mb->totcol);
- }
- mb= mb->id.next;
- }
-
- /* material imats */
- ma= G.main->mat.first;
- while(ma) {
- if(ma->id.flag & LIB_NEW) {
- for(a=0; a<MAX_MTEX; a++) {
- if(ma->mtex[a]) {
- ID_NEW(ma->mtex[a]->object);
- }
- }
- }
- ma= ma->id.next;
- }
-}
-
-void single_user(void)
-{
- int nr;
-
- if(G.scene->id.lib) return;
-
- clear_id_newpoins();
-
- nr= pupmenu("Make Single User%t|Object|Object & ObData|Object & ObData & Materials+Tex|Materials+Tex");
- if(nr>0) {
-
- if(nr==1) single_object_users(1);
-
- else if(nr==2) {
- single_object_users(1);
- single_obdata_users(1);
- }
- else if(nr==3) {
- single_object_users(1);
- single_obdata_users(1);
- single_mat_users(1); /* also tex */
-
- }
- else if(nr==4) {
- single_mat_users(1);
- }
-
- clear_id_newpoins();
-
- countall();
- allqueue(REDRAWALL, 0);
- BIF_undo_push("Single user");
- }
-}
-
-/* ************************************************************* */
-
-/* helper for below, ma was checked to be not NULL */
-static void make_local_makelocalmaterial(Material *ma)
-{
- ID *id;
- int b;
-
- make_local_material(ma);
-
- for(b=0; b<MAX_MTEX; b++) {
- if(ma->mtex[b] && ma->mtex[b]->tex) {
- make_local_texture(ma->mtex[b]->tex);
- }
- }
-
- id= (ID *)ma->ipo;
- if(id && id->lib) make_local_ipo(ma->ipo);
-
- /* nodetree? XXX */
-}
-
-void make_local_menu(void)
-{
- int mode;
-
- /* If you modify this menu, please remember to update view3d_edit_object_makelocalmenu
- * in header_view3d.c and the menu in toolbox.c
- */
-
- if(G.scene->id.lib) return;
-
- mode = pupmenu("Make Local%t|Selected Objects %x1|Selected Objects and Data %x2|All %x3");
-
- if (mode <= 0) return;
-
- make_local(mode);
-}
-
-void make_local(int mode)
-{
- Base *base;
- Object *ob;
- bActionStrip *strip;
- Material *ma, ***matarar;
- Lamp *la;
- Curve *cu;
- ID *id;
- int a, b;
-
- /* WATCH: the function new_id(..) re-inserts the id block!!! */
- if(G.scene->id.lib) return;
-
- if(mode==3) {
- all_local(NULL, 0); /* NULL is all libs */
- allqueue(REDRAWALL, 0);
- return;
- }
- else if(mode<1) return;
-
- clear_id_newpoins();
-
- base= FIRSTBASE;
- while(base) {
- ob= base->object;
- if( (base->flag & SELECT)) {
- if(ob->id.lib) {
- make_local_object(ob);
- }
- }
- base= base->next;
- }
-
- /* maybe object pointers */
- base= FIRSTBASE;
- while(base) {
- ob= base->object;
- if( (base->flag & SELECT)) {
- if(ob->id.lib==NULL) {
- ID_NEW(ob->parent);
- ID_NEW(ob->track);
- }
- }
- base= base->next;
- }
-
- base= FIRSTBASE;
- while(base) {
- ob= base->object;
- if( (base->flag & SELECT) ) {
-
- id= ob->data;
-
- if(id && mode>1) {
-
- switch(ob->type) {
- case OB_LAMP:
- make_local_lamp((Lamp *)id);
-
- la= ob->data;
- id= (ID *)la->ipo;
- if(id && id->lib) make_local_ipo(la->ipo);
-
- break;
- case OB_CAMERA:
- make_local_camera((Camera *)id);
- break;
- case OB_MESH:
- make_local_mesh((Mesh *)id);
- make_local_key( ((Mesh *)id)->key );
- break;
- case OB_MBALL:
- make_local_mball((MetaBall *)id);
- break;
- case OB_CURVE:
- case OB_SURF:
- case OB_FONT:
- cu= (Curve *)id;
- make_local_curve(cu);
- id= (ID *)cu->ipo;
- if(id && id->lib) make_local_ipo(cu->ipo);
- make_local_key( cu->key );
- break;
- case OB_LATTICE:
- make_local_lattice((Lattice *)id);
- make_local_key( ((Lattice *)id)->key );
- break;
- case OB_ARMATURE:
- make_local_armature ((bArmature *)id);
- break;
- }
- }
- id= (ID *)ob->ipo;
- if(id && id->lib) make_local_ipo(ob->ipo);
-
- id= (ID *)ob->action;
- if(id && id->lib) make_local_action(ob->action);
-
- for (strip=ob->nlastrips.first; strip; strip=strip->next) {
- if(strip->act && strip->act->id.lib)
- make_local_action(strip->act);
- }
-
- }
- base= base->next;
- }
-
- if(mode>1) {
- base= FIRSTBASE;
- while(base) {
- ob= base->object;
- if(base->flag & SELECT ) {
-
- if(ob->type==OB_LAMP) {
- la= ob->data;
- for(b=0; b<MAX_MTEX; b++) {
- if(la->mtex[b] && la->mtex[b]->tex) {
- make_local_texture(la->mtex[b]->tex);
- }
- }
- }
- else {
-
- for(a=0; a<ob->totcol; a++) {
- ma= ob->mat[a];
- if(ma)
- make_local_makelocalmaterial(ma);
- }
-
- matarar= (Material ***)give_matarar(ob);
- if (matarar) {
- for(a=0; a<ob->totcol; a++) {
- ma= (*matarar)[a];
- if(ma)
- make_local_makelocalmaterial(ma);
- }
- }
- }
- }
- base= base->next;
- }
- }
-
- allqueue(REDRAWALL, 0);
- BIF_undo_push("Make local");
-}
-
-static void copy_object__forwardModifierLinks(void *userData, Object *ob,
- ID **idpoin)
-{
- /* this is copied from ID_NEW; it might be better to have a macro */
- if(*idpoin && (*idpoin)->newid) *idpoin = (*idpoin)->newid;
-}
-
-
-/* after copying objects, copied data should get new pointers */
-static void copy_object_set_idnew(int dupflag)
-{
- Base *base;
- Object *ob;
- Material *ma, *mao;
- ID *id;
- Ipo *ipo;
- bActionStrip *strip;
- int a;
-
- /* check object pointers */
- for(base= FIRSTBASE; base; base= base->next) {
- if TESTBASELIB(base) {
- ob= base->object;
- relink_constraints(&ob->constraints);
- if (ob->pose){
- bPoseChannel *chan;
- for (chan = ob->pose->chanbase.first; chan; chan=chan->next){
- relink_constraints(&chan->constraints);
- }
- }
- modifiers_foreachIDLink(ob, copy_object__forwardModifierLinks, NULL);
- ID_NEW(ob->parent);
- ID_NEW(ob->track);
- ID_NEW(ob->proxy);
- ID_NEW(ob->proxy_group);
-
- for(strip= ob->nlastrips.first; strip; strip= strip->next) {
- bActionModifier *amod;
- for(amod= strip->modifiers.first; amod; amod= amod->next)
- ID_NEW(amod->ob);
- }
- }
- }
-
- /* materials */
- if( dupflag & USER_DUP_MAT) {
- mao= G.main->mat.first;
- while(mao) {
- if(mao->id.newid) {
-
- ma= (Material *)mao->id.newid;
-
- if(dupflag & USER_DUP_TEX) {
- for(a=0; a<MAX_MTEX; a++) {
- if(ma->mtex[a]) {
- id= (ID *)ma->mtex[a]->tex;
- if(id) {
- ID_NEW_US(ma->mtex[a]->tex)
- else ma->mtex[a]->tex= copy_texture(ma->mtex[a]->tex);
- id->us--;
- }
- }
- }
- }
- id= (ID *)ma->ipo;
- if(id) {
- ID_NEW_US(ma->ipo)
- else ma->ipo= copy_ipo(ma->ipo);
- id->us--;
- }
- }
- mao= mao->id.next;
- }
- }
-
- /* lamps */
- if( dupflag & USER_DUP_IPO) {
- Lamp *la= G.main->lamp.first;
- while(la) {
- if(la->id.newid) {
- Lamp *lan= (Lamp *)la->id.newid;
- id= (ID *)lan->ipo;
- if(id) {
- ID_NEW_US(lan->ipo)
- else lan->ipo= copy_ipo(lan->ipo);
- id->us--;
- }
- }
- la= la->id.next;
- }
- }
-
- /* ipos */
- ipo= G.main->ipo.first;
- while(ipo) {
- if(ipo->id.lib==NULL && ipo->id.newid) {
- Ipo *ipon= (Ipo *)ipo->id.newid;
- IpoCurve *icu;
- for(icu= ipon->curve.first; icu; icu= icu->next) {
- if(icu->driver) {
- ID_NEW(icu->driver->ob);
- }
- }
- }
- ipo= ipo->id.next;
- }
-
- set_sca_new_poins();
-
- clear_id_newpoins();
-
-}
-
-/* This function duplicated the current visible selection, its used by Duplicate and Linked Duplicate
-Alt+D/Shift+D as well as Pythons Object.Duplicate(), it takes
-mode:
- 0: Duplicate with transform, Redraw.
- 1: Duplicate, no transform, Redraw
- 2: Duplicate, no transform, no redraw (Only used by python)
-if true the user will not be dropped into grab mode directly after and..
-dupflag: a flag made from constants declared in DNA_userdef_types.h
- The flag tells adduplicate() weather to copy data linked to the object, or to reference the existing data.
- U.dupflag for default operations or you can construct a flag as python does
- if the dupflag is 0 then no data will be copied (linked duplicate) */
-
-void adduplicate(int mode, int dupflag)
-{
- Base *base, *basen;
- Material ***matarar;
- Object *ob, *obn;
- ID *id;
- int a, didit;
-
- if(G.scene->id.lib) return;
- clear_id_newpoins();
- clear_sca_new_poins(); /* sensor/contr/act */
-
- base= FIRSTBASE;
- while(base) {
- if TESTBASE(base) {
-
- ob= base->object;
- if(ob->flag & OB_POSEMODE) {
- ; /* nothing? */
- }
- else {
- obn= copy_object(ob);
- obn->recalc |= OB_RECALC;
-
- basen= MEM_mallocN(sizeof(Base), "duplibase");
- *basen= *base;
- BLI_addhead(&G.scene->base, basen); /* addhead: prevent eternal loop */
- basen->object= obn;
- base->flag &= ~SELECT;
-
- if(basen->flag & OB_FROMGROUP) {
- Group *group;
- for(group= G.main->group.first; group; group= group->id.next) {
- if(object_in_group(ob, group))
- add_to_group(group, obn);
- }
- obn->flag |= OB_FROMGROUP; /* this flag is unset with copy_object() */
- }
-
- if(BASACT==base) BASACT= basen;
-
- /* duplicates using userflags */
-
- if(dupflag & USER_DUP_IPO) {
- bConstraintChannel *chan;
- id= (ID *)obn->ipo;
-
- if(id) {
- ID_NEW_US( obn->ipo)
- else obn->ipo= copy_ipo(obn->ipo);
- id->us--;
- }
- /* Handle constraint ipos */
- for (chan=obn->constraintChannels.first; chan; chan=chan->next){
- id= (ID *)chan->ipo;
- if(id) {
- ID_NEW_US( chan->ipo)
- else chan->ipo= copy_ipo(chan->ipo);
- id->us--;
- }
- }
- }
- if(dupflag & USER_DUP_ACT){ /* Not buttons in the UI to modify this, add later? */
- id= (ID *)obn->action;
- if (id){
- ID_NEW_US(obn->action)
- else{
- obn->action= copy_action(obn->action);
- }
- id->us--;
- }
- }
- if(dupflag & USER_DUP_MAT) {
- for(a=0; a<obn->totcol; a++) {
- id= (ID *)obn->mat[a];
- if(id) {
- ID_NEW_US(obn->mat[a])
- else obn->mat[a]= copy_material(obn->mat[a]);
- id->us--;
- }
- }
- }
-
- id= obn->data;
- didit= 0;
-
- switch(obn->type) {
- case OB_MESH:
- if(dupflag & USER_DUP_MESH) {
- ID_NEW_US2( obn->data )
- else {
- obn->data= copy_mesh(obn->data);
-
- if(obn->fluidsimSettings) {
- obn->fluidsimSettings->orgMesh = (Mesh *)obn->data;
- }
-
- didit= 1;
- }
- id->us--;
- }
- break;
- case OB_CURVE:
- if(dupflag & USER_DUP_CURVE) {
- ID_NEW_US2(obn->data )
- else {
- obn->data= copy_curve(obn->data);
- didit= 1;
- }
- id->us--;
- }
- break;
- case OB_SURF:
- if(dupflag & USER_DUP_SURF) {
- ID_NEW_US2( obn->data )
- else {
- obn->data= copy_curve(obn->data);
- didit= 1;
- }
- id->us--;
- }
- break;
- case OB_FONT:
- if(dupflag & USER_DUP_FONT) {
- ID_NEW_US2( obn->data )
- else {
- obn->data= copy_curve(obn->data);
- didit= 1;
- }
- id->us--;
- }
- break;
- case OB_MBALL:
- if(dupflag & USER_DUP_MBALL) {
- ID_NEW_US2(obn->data )
- else {
- obn->data= copy_mball(obn->data);
- didit= 1;
- }
- id->us--;
- }
- break;
- case OB_LAMP:
- if(dupflag & USER_DUP_LAMP) {
- ID_NEW_US2(obn->data )
- else obn->data= copy_lamp(obn->data);
- id->us--;
- }
- break;
-
- case OB_ARMATURE:
- obn->recalc |= OB_RECALC_DATA;
- if(obn->pose) obn->pose->flag |= POSE_RECALC;
-
- if(dupflag & USER_DUP_ARM) {
- ID_NEW_US2(obn->data )
- else {
- obn->data= copy_armature(obn->data);
- armature_rebuild_pose(obn, obn->data);
- didit= 1;
- }
- id->us--;
- }
-
- break;
-
- case OB_LATTICE:
- if(dupflag!=0) {
- ID_NEW_US2(obn->data )
- else obn->data= copy_lattice(obn->data);
- id->us--;
- }
- break;
- case OB_CAMERA:
- if(dupflag!=0) {
- ID_NEW_US2(obn->data )
- else obn->data= copy_camera(obn->data);
- id->us--;
- }
- break;
- }
-
- if(dupflag & USER_DUP_MAT) {
- matarar= give_matarar(obn);
- if(didit && matarar) {
- for(a=0; a<obn->totcol; a++) {
- id= (ID *)(*matarar)[a];
- if(id) {
- ID_NEW_US( (*matarar)[a] )
- else (*matarar)[a]= copy_material((*matarar)[a]);
-
- id->us--;
- }
- }
- }
- }
-#ifdef WITH_VERSE
- /* send new created object to verse server,
- * when original object was linked with object node */
- if(ob->vnode) {
- b_verse_duplicate_object(((VNode*)ob->vnode)->session, ob, obn);
- }
-#endif
- }
-
- }
- base= base->next;
- }
-
- copy_object_set_idnew(dupflag);
-
- DAG_scene_sort(G.scene);
- DAG_scene_flush_update(G.scene, screen_view3d_layers());
-
- countall();
- if(mode==0) {
- BIF_TransformSetUndo("Add Duplicate");
- initTransform(TFM_TRANSLATION, CTX_NONE);
- Transform();
- }
- set_active_base(BASACT);
- if(mode!=2) { /* mode of 2 is used by python to avoid unrequested redraws */
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWACTION, 0); /* also oops */
- allqueue(REDRAWIPO, 0); /* also oops */
- }
-}
-
-void make_duplilist_real()
-{
- Base *base, *basen;
- Object *ob;
- /* extern ListBase duplilist; */
-
- if(okee("Make dupli objects real")==0) return;
-
- clear_id_newpoins();
-
- base= FIRSTBASE;
- while(base) {
- if TESTBASE(base) {
-
- if(base->object->transflag & OB_DUPLI) {
- ListBase *lb= object_duplilist(G.scene, base->object);
- DupliObject *dob;
-
- for(dob= lb->first; dob; dob= dob->next) {
- ob= copy_object(dob->ob);
- /* font duplis can have a totcol without material, we get them from parent
- * should be implemented better...
- */
- if(ob->mat==NULL) ob->totcol= 0;
-
- basen= MEM_dupallocN(base);
- basen->flag &= ~OB_FROMDUPLI;
- BLI_addhead(&G.scene->base, basen); /* addhead: othwise eternal loop */
- basen->object= ob;
- ob->ipo= NULL; /* make sure apply works */
- ob->parent= ob->track= NULL;
- ob->disp.first= ob->disp.last= NULL;
- ob->transflag &= ~OB_DUPLI;
-
- Mat4CpyMat4(ob->obmat, dob->mat);
- apply_obmat(ob);
- }
-
- copy_object_set_idnew(0);
-
- free_object_duplilist(lb);
-
- base->object->transflag &= ~OB_DUPLI;
- }
- }
- base= base->next;
- }
-
- DAG_scene_sort(G.scene);
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWOOPS, 0);
-
- BIF_undo_push("Make duplicates real");
-}
-
-void selectlinks_menu(void)
-{
- Object *ob;
- int nr;
-
- ob= OBACT;
- if(ob==0) return;
-
- /* If you modify this menu, please remember to update view3d_select_linksmenu
- * in header_view3d.c and the menu in toolbox.c
- */
- nr= pupmenu("Select Linked%t|Object Ipo%x1|ObData%x2|Material%x3|Texture%x4|DupliGroup%x5");
-
- if (nr <= 0) return;
-
- selectlinks(nr);
-}
-
-void selectlinks(int nr)
-{
- Object *ob;
- Base *base;
- void *obdata = NULL;
- Ipo *ipo = NULL;
- Material *mat = NULL, *mat1;
- Tex *tex=0;
- int a, b;
- short changed = 0;
- /* events (nr):
- * Object Ipo: 1
- * ObData: 2
- * Current Material: 3
- * Current Texture: 4
- * DupliGroup: 5
- */
-
-
- ob= OBACT;
- if(ob==0) return;
-
- if(nr==1) {
- ipo= ob->ipo;
- if(ipo==0) return;
- }
- else if(nr==2) {
- if(ob->data==0) return;
- obdata= ob->data;
- }
- else if(nr==3 || nr==4) {
- mat= give_current_material(ob, ob->actcol);
- if(mat==0) return;
- if(nr==4) {
- if(mat->mtex[ (int)mat->texact ]) tex= mat->mtex[ (int)mat->texact ]->tex;
- if(tex==0) return;
- }
- }
- else if(nr==5) {
- if(ob->dup_group==NULL) return;
- }
- else return;
-
- base= FIRSTBASE;
- while(base) {
- if (BASE_SELECTABLE(base) && !(base->flag & SELECT)) {
- if(nr==1) {
- if(base->object->ipo==ipo) base->flag |= SELECT;
- changed = 1;
- }
- else if(nr==2) {
- if(base->object->data==obdata) base->flag |= SELECT;
- changed = 1;
- }
- else if(nr==3 || nr==4) {
- ob= base->object;
-
- for(a=1; a<=ob->totcol; a++) {
- mat1= give_current_material(ob, a);
- if(nr==3) {
- if(mat1==mat) base->flag |= SELECT;
- changed = 1;
- }
- else if(mat1 && nr==4) {
- for(b=0; b<MAX_MTEX; b++) {
- if(mat1->mtex[b]) {
- if(tex==mat1->mtex[b]->tex) {
- base->flag |= SELECT;
- changed = 1;
- }
- }
- }
- }
- }
- }
- else if(nr==5) {
- if(base->object->dup_group==ob->dup_group) {
- base->flag |= SELECT;
- changed = 1;
- }
- }
- base->object->flag= base->flag;
- }
- base= base->next;
- }
-
- if (changed) {
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWDATASELECT, 0);
- allqueue(REDRAWOOPS, 0);
- BIF_undo_push("Select linked");
- }
-}
-
-void image_aspect(void)
-{
- /* all selected objects with an image map: scale in image aspect */
- Base *base;
- Object *ob;
- Material *ma;
- Tex *tex;
- float x, y, space;
- int a, b, done;
-
- if(G.obedit) return;
- if(G.scene->id.lib) return;
-
- base= FIRSTBASE;
- while(base) {
- if TESTBASELIB(base) {
- ob= base->object;
- done= 0;
-
- for(a=1; a<=ob->totcol; a++) {
- ma= give_current_material(ob, a);
- if(ma) {
- for(b=0; b<MAX_MTEX; b++) {
- if(ma->mtex[b] && ma->mtex[b]->tex) {
- tex= ma->mtex[b]->tex;
- if(tex->type==TEX_IMAGE && tex->ima) {
- ImBuf *ibuf= BKE_image_get_ibuf(tex->ima, NULL);
-
- /* texturespace */
- space= 1.0;
- if(ob->type==OB_MESH) {
- float size[3];
- mesh_get_texspace(ob->data, NULL, NULL, size);
- space= size[0]/size[1];
- }
- else if ELEM3(ob->type, OB_CURVE, OB_FONT, OB_SURF) {
- Curve *cu= ob->data;
- space= cu->size[0]/cu->size[1];
- }
-
- x= ibuf->x/space;
- y= ibuf->y;
-
- if(x>y) ob->size[0]= ob->size[1]*x/y;
- else ob->size[1]= ob->size[0]*y/x;
-
- done= 1;
- DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
- }
- }
- if(done) break;
- }
- }
- if(done) break;
- }
- }
- base= base->next;
- }
-
- allqueue(REDRAWVIEW3D, 0);
- BIF_undo_push("Image aspect");
-}
-
-void set_ob_ipoflags(void)
-{
- Base *base;
- int set= 1;
-
- if (!G.vd) {
- error("Can't do this! Open a 3D window");
- return;
- }
-
- base= FIRSTBASE;
- while(base) {
- if TESTBASELIB(base) {
- if(base->object->ipoflag & OB_DRAWKEY) {
- set= 0;
- break;
- }
- }
- base= base->next;
- }
-
- base= FIRSTBASE;
- while(base) {
- if TESTBASELIB(base) {
- if(set) {
- base->object->ipoflag |= OB_DRAWKEY;
- if(base->object->ipo) base->object->ipo->showkey= 1;
- }
- else {
- base->object->ipoflag &= ~OB_DRAWKEY;
- if(base->object->ipo) base->object->ipo->showkey= 0;
- }
- }
- base= base->next;
- }
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWNLA, 0);
- allqueue (REDRAWACTION, 0);
- allspace(REMAKEIPO, 0);
- allqueue(REDRAWIPO, 0);
-}
-
-void select_select_keys(void)
-{
- Base *base;
- IpoCurve *icu;
- BezTriple *bezt;
- int a;
-
- if (!G.vd) {
- error("Can't do this! Open a 3D window");
- return;
- }
-
- if(G.scene->id.lib) return;
-
- if(okee("Show and select all keys")==0) return;
-
- base= FIRSTBASE;
- while(base) {
- if TESTBASELIB(base) {
- if(base->object->ipo) {
- base->object->ipoflag |= OB_DRAWKEY;
- base->object->ipo->showkey= 1;
- icu= base->object->ipo->curve.first;
- while(icu) {
- a= icu->totvert;
- bezt= icu->bezt;
- while(a--) {
- bezt->f1 |= SELECT;
- bezt->f2 |= SELECT;
- bezt->f3 |= SELECT;
- bezt++;
- }
- icu= icu->next;
- }
- }
- }
- base= base->next;
- }
-
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWVIEW3D, 0);
- allspace(REMAKEIPO, 0);
- allqueue(REDRAWIPO, 0);
-
- BIF_undo_push("Select keys");
-
-}
-
-
-int vergbaseco(const void *a1, const void *a2)
-{
- Base **x1, **x2;
-
- x1= (Base **) a1;
- x2= (Base **) a2;
-
- if( (*x1)->sy > (*x2)->sy ) return 1;
- else if( (*x1)->sy < (*x2)->sy) return -1;
- else if( (*x1)->sx > (*x2)->sx ) return 1;
- else if( (*x1)->sx < (*x2)->sx ) return -1;
-
- return 0;
-}
-
-
-void auto_timeoffs(void)
-{
- Base *base, **basesort, **bs;
- float start, delta;
- int tot=0, a;
- short offset=25;
-
- if(BASACT==0 || G.vd==NULL) return;
- if(button(&offset, 0, 1000,"Total time")==0) return;
-
- /* make array of all bases, xco yco (screen) */
- base= FIRSTBASE;
- while(base) {
- if(TESTBASELIB(base)) {
- tot++;
- }
- base= base->next;
- }
-
- delta= (float)offset/(float)tot;
- start= OBACT->sf;
-
- bs= basesort= MEM_mallocN(sizeof(void *)*tot,"autotimeoffs");
- base= FIRSTBASE;
-
- while(base) {
- if(TESTBASELIB(base)) {
- *bs= base;
- bs++;
- }
- base= base->next;
- }
- qsort(basesort, tot, sizeof(void *), vergbaseco);
-
- bs= basesort;
- for(a=0; a<tot; a++) {
-
- (*bs)->object->sf= start;
- start+= delta;
-
- bs++;
- }
- MEM_freeN(basesort);
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
-}
-
-void texspace_edit(void)
-{
- Base *base;
- int nr=0;
-
- /* first test if from visible and selected objects
- * texspacedraw is set:
- */
-
- if(G.obedit) return;
-
- base= FIRSTBASE;
- while(base) {
- if TESTBASELIB(base) {
- break;
- }
- base= base->next;
- }
-
- if(base==0) {
- return;
- }
-
- nr= pupmenu("Texture Space %t|Grab/Move%x1|Size%x2");
- if(nr<1) return;
-
- base= FIRSTBASE;
- while(base) {
- if TESTBASELIB(base) {
- base->object->dtx |= OB_TEXSPACE;
- }
- base= base->next;
- }
-
-
- if(nr==1) {
- initTransform(TFM_TRANSLATION, CTX_TEXTURE);
- Transform();
- }
- else if(nr==2) {
- initTransform(TFM_RESIZE, CTX_TEXTURE);
- Transform();
- }
- else if(nr==3) {
- initTransform(TFM_ROTATION, CTX_TEXTURE);
- Transform();
- }
-}
-
-/* ******************************************************************** */
-/* Mirror function in Edit Mode */
-
-void mirrormenu(void)
-{
- short mode = 0;
-
-
- if(G.f & G_PARTICLEEDIT) {
- PE_mirror_x(0);
- }
- else if (G.obedit==0) {
- mode=pupmenu("Mirror Axis %t|X Local%x4|Y Local%x5|Z Local%x6|");
-
- if (mode==-1) return; /* return */
- Mirror(mode); /* separating functionality from interface | call*/
- }
- else {
- mode=pupmenu("Mirror Axis %t|X Global%x1|Y Global%x2|Z Global%x3|%l|X Local%x4|Y Local%x5|Z Local%x6|%l|X View%x7|Y View%x8|Z View%x9|");
-
- if (mode==-1) return; /* return */
- Mirror(mode); /* separating functionality from interface | call*/
- }
-}
-
-void hookmenu(void)
-{
- /* only called in object mode */
- short event, changed=0;
- Object *ob;
- Base *base;
- ModifierData *md;
- HookModifierData *hmd;
-
- event= pupmenu("Modify Hooks for Selected...%t|Reset Offset%x1|Recenter at Cursor%x2");
- if (event==-1) return;
- if (event==2 && !(G.vd)) {
- error("Cannot perform this operation without a 3d view");
- return;
- }
-
- for (base= FIRSTBASE; base; base= base->next) {
- if TESTBASELIB(base) {
- for (md = base->object->modifiers.first; md; md=md->next) {
- if (md->type==eModifierType_Hook) {
- ob = base->object;
- hmd = (HookModifierData*) md;
-
- /*
- * Copied from modifiers_cursorHookCenter and
- * modifiers_clearHookOffset, should consolidate
- * */
-
- if (event==1) {
- if(hmd->object) {
- Mat4Invert(hmd->object->imat, hmd->object->obmat);
- Mat4MulSerie(hmd->parentinv, hmd->object->imat, ob->obmat, NULL, NULL, NULL, NULL, NULL, NULL);
-
- changed= 1;
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- }
- } else {
- float *curs = give_cursor();
- float bmat[3][3], imat[3][3];
-
- where_is_object(ob);
-
- Mat3CpyMat4(bmat, ob->obmat);
- Mat3Inv(imat, bmat);
-
- curs= give_cursor();
- hmd->cent[0]= curs[0]-ob->obmat[3][0];
- hmd->cent[1]= curs[1]-ob->obmat[3][1];
- hmd->cent[2]= curs[2]-ob->obmat[3][2];
- Mat3MulVecfl(imat, hmd->cent);
-
- changed= 1;
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- }
- }
- }
- }
- }
-
- if (changed) {
- if (event==1)
- BIF_undo_push("Clear hook offset for selected");
- else if (event==2)
- BIF_undo_push("Hook cursor center for selected");
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- }
-}
-
-/*
- * Returns true if the Object is a from an external blend file (libdata)
- */
-int object_is_libdata(Object *ob)
-{
- if (!ob) return 0;
- if (ob->proxy) return 0;
- if (ob->id.lib) return 1;
- return 0;
-}
-
-
-/*
- * Returns true if the Object data is a from an external blend file (libdata)
- */
-int object_data_is_libdata(Object *ob)
-{
- if (!ob) return 0;
- if (ob->proxy) return 0;
- if (ob->id.lib) return 1;
- if (!ob->data) return 0;
- if (((ID *)ob->data)->lib) return 1;
- return 0;
-}
-
-void hide_objects(int select)
-{
- Base *base;
- short changed = 0, changed_act = 0;
- for(base = FIRSTBASE; base; base=base->next){
- if(TESTBASELIB(base)==select){
- base->flag &= ~SELECT;
- base->object->flag = base->flag;
- base->object->restrictflag |= OB_RESTRICT_VIEW;
- changed = 1;
- if (base==BASACT) {
- BASACT= NULL;
- changed_act = 1;
- }
- }
- }
- if (changed) {
- if(select) BIF_undo_push("Hide Selected Objects");
- else if(select) BIF_undo_push("Hide Unselected Objects");
- DAG_scene_sort(G.scene);
- allqueue(REDRAWVIEW3D,0);
- allqueue(REDRAWOOPS,0);
- allqueue(REDRAWDATASELECT,0);
- if (changed_act) { /* these spaces depend on the active object */
- allqueue(REDRAWBUTSALL,0);
- allqueue(REDRAWIPO,0);
- allqueue(REDRAWACTION,0);
- }
- countall();
- }
-}
-
-void show_objects(void)
-{
- Base *base;
- int changed = 0;
- for(base = FIRSTBASE; base; base=base->next){
- if((base->lay & G.vd->lay) && base->object->restrictflag & OB_RESTRICT_VIEW) {
- base->flag |= SELECT;
- base->object->flag = base->flag;
- base->object->restrictflag &= ~OB_RESTRICT_VIEW;
- changed = 1;
- }
- }
- if (changed) {
- BIF_undo_push("Unhide Objects");
- DAG_scene_sort(G.scene);
- allqueue(REDRAWVIEW3D,0);
- allqueue(REDRAWOOPS,0);
- countall();
- }
-}
diff --git a/source/blender/src/editoops.c b/source/blender/src/editoops.c
deleted file mode 100644
index cb654646d0f..00000000000
--- a/source/blender/src/editoops.c
+++ /dev/null
@@ -1,675 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <math.h>
-#include <string.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef WIN32
-#include <unistd.h>
-#else
-#include <io.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "DNA_material_types.h"
-#include "DNA_object_types.h"
-#include "DNA_oops_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_image_types.h"
-#include "DNA_ipo_types.h"
-
-#include "BKE_global.h"
-#include "BKE_scene.h"
-#include "BKE_library.h"
-#include "BKE_material.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_space.h"
-#include "BIF_screen.h"
-#include "BIF_editoops.h"
-#include "BIF_editview.h"
-#include "BIF_drawscene.h"
-#include "BIF_mywindow.h"
-#include "BIF_toolbox.h"
-#include "BIF_interface.h"
-
-#include "BDR_editobject.h"
-
-#include "BSE_edit.h"
-#include "BSE_drawipo.h"
-
-#include "blendef.h"
-#include "mydevice.h"
-
-
-typedef struct TransOops {
- float *loc;
- float oldloc[2];
-} TransOops;
-
-struct ID *idt;
-
-
-static void oops_to_select_objects(void)
-{
- Oops *oops;
- Base *base;
- Object *ob;
-
- if(G.soops==0) return;
-
- oops= G.soops->oops.first;
- while(oops) {
- if(oops->hide==0) {
- if(oops->type==ID_OB) {
- ob= (Object *)oops->id;
- if ((ob->restrictflag & OB_RESTRICT_VIEW)==0) {
- if(oops->flag & SELECT) ob->flag |= SELECT;
- else ob->flag &= ~SELECT;
- }
- }
- }
- oops= oops->next;
- }
- base= FIRSTBASE;
- while(base) {
- if(base->flag != base->object->flag) {
- base->flag= base->object->flag;
- }
- base= base->next;
- }
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWOOPS, 0);
-}
-
-void swap_select_all_oops(void)
-{
- Oops *oops;
- int sel= 0;
-
- if(G.soops==0) return;
-
- oops= G.soops->oops.first;
- while(oops) {
- if(oops->hide==0) {
- if(oops->flag & SELECT) {
- sel= 1;
- break;
- }
- }
- oops= oops->next;
- }
-
- oops= G.soops->oops.first;
- while(oops) {
- if(oops->hide==0) {
- if(sel) oops->flag &= ~SELECT;
- else oops->flag |= SELECT;
- }
- oops= oops->next;
- }
-
- oops_to_select_objects(); /* also redraw */
-
- G.soops->lockpoin= NULL;
-}
-
-/* never used... check CVS 1.12 for the code */
-/* static void select_swap_oops(void) */
-
-static void deselect_all_oops(void)
-{
- Oops *oops;
-
- if(G.soops==0) return;
-
- oops= G.soops->oops.first;
- while(oops) {
- if(oops->hide==0) {
- oops->flag &= ~SELECT;
- }
- oops= oops->next;
- }
- G.soops->lockpoin= NULL;
-}
-
-void set_select_flag_oops(void) /* all areas */
-{
- SpaceOops *so;
- ScrArea *sa;
-
- sa= G.curscreen->areabase.first;
- while(sa) {
- if(sa->spacetype==SPACE_OOPS) {
- so= sa->spacedata.first;
- so->flag |= SO_NEWSELECTED;
- }
- sa= sa->next;
- }
- if(G.soops) G.soops->lockpoin= NULL;
-}
-
-void deselect_all_area_oops(void) /* all areas */
-{
- SpaceOops *so;
- Oops *oops;
- ScrArea *sa;
-
- sa= G.curscreen->areabase.first;
- while(sa) {
- if(sa->spacetype==SPACE_OOPS) {
- so= sa->spacedata.first;
-
- oops= so->oops.first;
- while(oops) {
- oops->flag &= ~SELECT;
- oops= oops->next;
- }
- }
- sa= sa->next;
- }
-
- if(G.soops) G.soops->lockpoin= NULL;
-}
-
-void transform_oops(int mode, int context)
-{
- TransOops *transmain, *tv;
- Oops *oops;
- float dx, dy, div, dvec[3], cent[3], min[3], max[3];
- float sizefac, size[2], xref=1.0, yref=1.0;
- int a, tot= 0, midtog= 0;
- unsigned short event = 0;
- short firsttime= 1, proj = 0, afbreek=0, xc, yc, xo, yo, xn, yn, mval[2];
- short val;
- char str[32];
-
- if(G.soops==0) return;
-
- /* which oopses... */
- oops= G.soops->oops.first;
- while(oops) {
- if(oops->hide==0) {
- if(oops->flag & SELECT) {
- tot++;
- }
- }
- oops= oops->next;
- }
-
- if(tot==0) return;
-
- G.moving= 1;
-
- INIT_MINMAX(min, max);
-
- tv=transmain= MEM_callocN(tot*sizeof(TransOops), "transmain");
- oops= G.soops->oops.first;
- while(oops) {
- if(oops->hide==0) {
- if(oops->flag & SELECT) {
- tv->loc= &oops->x;
- tv->oldloc[0]= tv->loc[0];
- tv->oldloc[1]= tv->loc[1];
- DO_MINMAX2(tv->loc, min, max);
- tv++;
- }
- }
- oops= oops->next;
- }
-
- cent[0]= (min[0]+max[0])/2.0;
- cent[1]= (min[1]+max[1])/2.0;
-
- ipoco_to_areaco_noclip(G.v2d, cent, mval);
- xc= mval[0];
- yc= mval[1];
-
- getmouseco_areawin(mval);
- xo= xn= mval[0];
- yo= yn= mval[1];
- dvec[0]= dvec[1]= 0.0;
-
- sizefac= sqrt( (float)((yc-yn)*(yc-yn)+(xn-xc)*(xn-xc)) );
- if(sizefac<2.0) sizefac= 2.0;
-
- while(afbreek==0) {
- getmouseco_areawin(mval);
- if(mval[0]!=xo || mval[1]!=yo || firsttime) {
-
- if(mode=='g') {
-
- dx= mval[0]- xo;
- dy= mval[1]- yo;
-
- div= G.v2d->mask.xmax-G.v2d->mask.xmin;
- dvec[0]+= (G.v2d->cur.xmax-G.v2d->cur.xmin)*(dx)/div;
-
- div= G.v2d->mask.ymax-G.v2d->mask.ymin;
- dvec[1]+= (G.v2d->cur.ymax-G.v2d->cur.ymin)*(dy)/div;
-
- if(midtog) dvec[proj]= 0.0;
-
- tv= transmain;
- for(a=0; a<tot; a++, tv++) {
-
- tv->loc[0]= tv->oldloc[0]+dvec[0];
- tv->loc[1]= tv->oldloc[1]+dvec[1];
-
- }
-
- sprintf(str, "X: %.2f Y: %.2f ", dvec[0], dvec[1]);
- headerprint(str);
- }
- else if(mode=='s') {
- size[0]=size[1]= (sqrt( (float)((yc-mval[1])*(yc-mval[1])+(mval[0]-xc)*(mval[0]-xc)) ))/sizefac;
-
- if(midtog) size[proj]= 1.0;
- size[0]*= xref;
- size[1]*= yref;
-
- tv= transmain;
- for(a=0; a<tot; a++, tv++) {
-
- tv->loc[0]= size[0]*(tv->oldloc[0]-cent[0])+ cent[0];
- tv->loc[1]= size[1]*(tv->oldloc[1]-cent[1])+ cent[1];
-
- }
-
- sprintf(str, "sizeX: %.3f sizeY: %.3f ", size[0], size[1]);
- headerprint(str);
- }
-
-
- xo= mval[0];
- yo= mval[1];
-
- force_draw(0);
-
- firsttime= 0;
-
- }
- else BIF_wait_for_statechange();
-
- while(qtest()) {
- event= extern_qread(&val);
- if(val) {
- switch(event) {
- case ESCKEY:
- case RIGHTMOUSE:
- case LEFTMOUSE:
- case SPACEKEY:
- case RETKEY:
- afbreek= 1;
- break;
- case MIDDLEMOUSE:
-
- midtog= ~midtog;
- if(midtog) {
- if( abs(mval[0]-xn) > abs(mval[1]-yn)) proj= 1;
- else proj= 0;
- firsttime= 1;
- }
-
- break;
- default:
- arrows_move_cursor(event);
- }
- }
- if(afbreek) break;
- }
- }
-
- if(event==ESCKEY || event==RIGHTMOUSE) {
- tv= transmain;
- for(a=0; a<tot; a++, tv++) {
- tv->loc[0]= tv->oldloc[0];
- tv->loc[1]= tv->oldloc[1];
- }
- }
- MEM_freeN(transmain);
-
- G.moving= 0;
-
- scrarea_queue_redraw(curarea);
-}
-
-static Oops *find_nearest_oops(void)
-{
- Oops *oops;
- float x, y;
- short mval[2];
-
- getmouseco_areawin(mval);
- areamouseco_to_ipoco(G.v2d, mval, &x, &y);
-
- oops= G.soops->oops.first;
- while(oops) {
- if(oops->hide == 0) {
- if(oops->x <=x && oops->x+OOPSX >= x) {
- if(oops->y <=y && oops->y+OOPSY >= y) {
- return oops;
- }
- }
- }
- oops= oops->next;
- }
- return 0;
-}
-
-static void do_activate_oops(Oops *oops)
-{
- Base *base;
- Object *ob;
-
- switch(oops->type) {
- case ID_SCE:
- if(oops->id) set_scene((Scene *)oops->id);
- break;
- case ID_OB:
- base= FIRSTBASE;
- while(base) {
- if(base->object == (Object *)oops->id) break;
- base= base->next;
- }
- if(base) {
- if(G.obedit==NULL) set_active_base(base); /* editview.c */
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWINFO, 1);
- }
- break;
- case ID_MA:
- ob= OBACT;
- if(ob && oops->id) {
- assign_material(ob, (Material *)oops->id, ob->actcol);
- allqueue(REDRAWBUTSSHADING, 0);
- scrarea_queue_winredraw(curarea);
- }
- break;
-
- case ID_IM:
- if(oops->id && G.sima) {
- /* only set if the new image isnt alredy active */
- if ((ID *)G.sima->image != oops->id) {
- G.sima->image = (Image *)oops->id;
- allqueue(REDRAWIMAGE, 0);
- scrarea_queue_winredraw(curarea);
- }
- }
- break;
- /*
- case ID_IP:
- if(oops->id && G.sipo) {
- *//* only set if the new ipo isnt alredy active *//*
- if ((ID *)G.sipo->ipo != oops->id) {
- G.sipo->ipo = (Ipo *)oops->id;
- allqueue(REDRAWIPO, 0);
- scrarea_queue_winredraw(curarea);
- }
- }
- break;
- */
- }
-}
-
-void mouse_select_oops(void)
-{
- Oops *oops;
- extern float oopslastx, oopslasty; /* oops.c */
-
- if(G.soops==0) return;
-
- /* which oopses... */
- oops= G.soops->oops.first;
-
- oops= find_nearest_oops();
- if(oops==0) return;
-
- if((G.qual & LR_SHIFTKEY)==0) deselect_all_oops();
-
- if(oops) {
- /* last_seq= seq; */
-
- if(G.qual==0) {
- oops->flag |= SELECT;
- }
- else {
- if(oops->flag & SELECT) {
- oops->flag &= ~SELECT;
- }
- else {
- oops->flag |= SELECT;
- }
- }
-
- oopslastx= oops->x;
- oopslasty= oops->y;
-
- if(G.qual & LR_CTRLKEY) do_activate_oops(oops);
- G.soops->lockpoin= oops;
- }
-
- oops_to_select_objects(); /* also redraw */
- scrarea_queue_headredraw(curarea);
-
- force_draw(1);
-
- std_rmouse_transform(transform_oops);
-}
-
-void borderselect_oops(void)
-{
- Oops *oops;
- rcti rect;
- rctf rectf, rq;
- int val;
- short mval[2];
-
- if(G.soops==0) return;
-
- val= get_border(&rect, 3);
-
- if(val) {
- mval[0]= rect.xmin;
- mval[1]= rect.ymin;
- areamouseco_to_ipoco(G.v2d, mval, &rectf.xmin, &rectf.ymin);
- mval[0]= rect.xmax;
- mval[1]= rect.ymax;
- areamouseco_to_ipoco(G.v2d, mval, &rectf.xmax, &rectf.ymax);
-
- oops= G.soops->oops.first;
- while(oops) {
- if(oops->hide == 0) {
-
- rq.xmin= oops->x;
- rq.xmax= oops->x+OOPSX;
- rq.ymin= oops->y;
- rq.ymax= oops->y+OOPSY;
-
- if(BLI_isect_rctf(&rq, &rectf, 0)) {
- if(val==LEFTMOUSE) {
- oops->flag |= SELECT;
- }
- else {
- oops->flag &= ~SELECT;
- }
- }
- }
- oops= oops->next;
- }
-
- oops_to_select_objects(); /* also redraw */
- }
-}
-
-static void select_oops_lib(ID *id)
-{
- Oops *oops;
-
- oops= G.soops->oops.first;
- while(oops) {
- if(oops->hide==0) {
- if(oops->id->lib== (Library *)id) oops->flag |= OOPS_DOSELECT;
- }
- oops= oops->next;
- }
-}
-
-void select_linked_oops(void)
-{
- Oops *oops;
- OopsLink *ol;
-
- if(G.soops==0) return;
-
- oops= G.soops->oops.first;
- while(oops) {
- if(oops->hide==0) {
- if(oops->flag & SELECT) {
- if(oops->type==ID_LI) select_oops_lib(oops->id);
- ol= oops->link.first;
- while(ol) {
- if(ol->to && ol->to->hide==0) ol->to->flag |= OOPS_DOSELECT;
- ol= ol->next;
- }
- }
- }
- oops= oops->next;
- }
-
- oops= G.soops->oops.first;
- while(oops) {
- if(oops->hide==0) {
- if(oops->flag & OOPS_DOSELECT) {
- oops->flag |= SELECT;
- oops->flag &= ~OOPS_DOSELECT;
- }
- }
- oops= oops->next;
- }
-
- oops_to_select_objects(); /* also redraw */
-
-}
-
-void select_backlinked_oops(void)
-{
- Oops *oops;
- OopsLink *ol;
-
- if(G.soops==0) return;
-
- oops= G.soops->oops.first;
- while(oops) {
- if(oops->hide==0) {
- if( (oops->flag & SELECT)==0) {
- ol= oops->link.first;
- while(ol) {
- if(ol->to && ol->to->hide==0) {
- if(ol->to->flag & SELECT) oops->flag |= OOPS_DOSELECT;
- }
- ol= ol->next;
- }
- }
- }
- oops= oops->next;
- }
-
- oops= G.soops->oops.first;
- while(oops) {
- if(oops->hide==0) {
- if(oops->flag & OOPS_DOSELECT) {
- oops->flag |= SELECT;
- oops->flag &= ~OOPS_DOSELECT;
- }
- }
- oops= oops->next;
- }
-
- oops_to_select_objects(); /* also redraw */
-
-}
-
-
-void clever_numbuts_oops()
-{
- Oops *oops;
- Object *ob;
- char str1[10];
- static char naam[256];
- static char naam2[256];
- static short doit;
- int len;
-
- if(G.soops->lockpoin) {
- oops= G.soops->lockpoin;
- ob = (Object *)oops->id;
- if(oops->type==ID_LI) strcpy(naam, ((Library *)oops->id)->name);
- else strcpy(naam, oops->id->name);
-
- strcpy(naam2, naam+2);
- str1[0]= oops->id->name[0];
- str1[1]= oops->id->name[1];
- str1[2]= ':';
- str1[3]= 0;
- if(strcmp(str1, "SC:")==0) strcpy(str1, "SCE:");
- else if(strcmp(str1, "SR:")==0) strcpy(str1, "SCR:");
-
-// if( GS(id->name)==ID_IP) len= 110;
-// else len= 120;
- len = 110;
-
- add_numbut(0, TEX, str1, 0, len, naam2, "Rename Object");
- if((oops->type==ID_OB || oops->type==ID_ME) && ob->type != OB_EMPTY) {
- // add_numbut(1, TEX, str1, 0, len, naam2, "Name Object");
- add_numbut(1, TOG|SHO, "Rename Linked Data", 0, 0, &doit, "Rename corresponding Datablock as well");
- do_clever_numbuts("Rename Datablock", 2, REDRAW);
- } else {
- do_clever_numbuts("Rename Datablock", 1, REDRAW);
- }
-
- rename_id((ID *)oops->id, naam2);
- }
-}
diff --git a/source/blender/src/editparticle.c b/source/blender/src/editparticle.c
deleted file mode 100644
index f07012c463d..00000000000
--- a/source/blender/src/editparticle.c
+++ /dev/null
@@ -1,3141 +0,0 @@
-/* editparticle.c
- *
- *
- * $Id: editparticle.c $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2007 by Janne Karhu.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <math.h>
-#include <string.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_scene_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_modifier_types.h"
-#include "DNA_object_force.h"
-#include "DNA_object_types.h"
-#include "DNA_vec_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-
-#include "BKE_bad_level_calls.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_depsgraph.h"
-
-#include "BKE_global.h"
-#include "BKE_object.h"
-#include "BKE_mesh.h"
-#include "BKE_modifier.h"
-#include "BKE_particle.h"
-#include "BKE_scene.h"
-#include "BKE_utildefines.h"
-
-#include "BSE_edit.h"
-
-#include "BLI_arithb.h"
-#include "BLI_blenlib.h"
-#include "BLI_dynstr.h"
-#include "BLI_kdtree.h"
-#include "BLI_rand.h"
-
-#include "PIL_time.h"
-
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-#include "BIF_graphics.h"
-#include "BIF_editparticle.h"
-#include "BIF_editview.h"
-#include "BIF_interface.h"
-#include "BIF_meshtools.h"
-#include "BIF_mywindow.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-
-#include "BSE_view.h"
-
-#include "BDR_editobject.h" //rightmouse_transform()
-#include "BDR_drawobject.h"
-
-#include "blendef.h"
-#include "mydevice.h"
-
-static void ParticleUndo_clear(ParticleSystem *psys);
-
-#define LOOP_PARTICLES(i,pa) for(i=0, pa=psys->particles; i<totpart; i++, pa++)
-#define LOOP_KEYS(k,key) if(psys->edit)for(k=0, key=psys->edit->keys[i]; k<pa->totkey; k++, key++)
-
-void PE_free_particle_edit(ParticleSystem *psys)
-{
- ParticleEdit *edit=psys->edit;
- int i, totpart=psys->totpart;
-
- if(edit==0) return;
-
- ParticleUndo_clear(psys);
-
- if(edit->keys){
- for(i=0; i<totpart; i++){
- if(edit->keys[i])
- MEM_freeN(edit->keys[i]);
- }
- MEM_freeN(edit->keys);
- }
-
- if(edit->mirror_cache)
- MEM_freeN(edit->mirror_cache);
-
- if(edit->emitter_cosnos){
- MEM_freeN(edit->emitter_cosnos);
- edit->emitter_cosnos=0;
- }
-
- if(edit->emitter_field){
- BLI_kdtree_free(edit->emitter_field);
- edit->emitter_field=0;
- }
-
- MEM_freeN(edit);
-
- psys->edit=NULL;
-}
-/************************************************/
-/* Edit Mode Helpers */
-/************************************************/
-int PE_can_edit(ParticleSystem *psys)
-{
- return (psys && psys->edit && (G.f & G_PARTICLEEDIT));
-}
-
-ParticleEditSettings *PE_settings()
-{
- return &G.scene->toolsettings->particle;
-}
-
-void PE_change_act(void *ob_v, void *act_v)
-{
- Object *ob = ob_v;
- ParticleSystem *psys;
- short act = *((short*)act_v) - 1;
-
- if((psys=psys_get_current(ob)))
- psys->flag &= ~PSYS_CURRENT;
-
- if(act>=0){
- if((psys=BLI_findlink(&ob->particlesystem,act))) {
- psys->flag |= PSYS_CURRENT;
-
- if(psys_check_enabled(ob, psys)) {
- if(G.f & G_PARTICLEEDIT && !psys->edit)
- PE_create_particle_edit(ob, psys);
- PE_recalc_world_cos(ob, psys);
- }
- }
- }
-}
-
-/* always gets atleast the first particlesystem even if PSYS_CURRENT flag is not set */
-ParticleSystem *PE_get_current(Object *ob)
-{
- ParticleSystem *psys;
-
- if(ob==NULL)
- return NULL;
-
- psys= ob->particlesystem.first;
- while(psys){
- if(psys->flag & PSYS_CURRENT)
- break;
- psys=psys->next;
- }
-
- if(psys==NULL && ob->particlesystem.first){
- psys=ob->particlesystem.first;
- psys->flag |= PSYS_CURRENT;
- }
-
- if(psys && psys_check_enabled(ob, psys) && ob == OBACT && (G.f & G_PARTICLEEDIT))
- if(psys->part->type == PART_HAIR && psys->flag & PSYS_EDITED)
- if(psys->edit == NULL)
- PE_create_particle_edit(ob, psys);
-
- return psys;
-}
-/* returns -1 if no system has PSYS_CURRENT flag */
-short PE_get_current_num(Object *ob)
-{
- short num=0;
- ParticleSystem *psys = ob->particlesystem.first;
-
- while(psys){
- if(psys->flag & PSYS_CURRENT)
- return num;
- num++;
- psys=psys->next;
- }
-
- return -1;
-}
-
-void PE_hide_keys_time(ParticleSystem *psys, float cfra)
-{
- ParticleData *pa;
- ParticleEditKey *key;
- ParticleEditSettings *pset=PE_settings();
- int i,k,totpart=psys->totpart;
-
- if(pset->draw_timed && G.scene->selectmode==SCE_SELECT_POINT){
- LOOP_PARTICLES(i,pa){
- LOOP_KEYS(k,key){
- if(fabs(cfra-*key->time) < pset->draw_timed)
- key->flag &= ~PEK_HIDE;
- else{
- key->flag |= PEK_HIDE;
- key->flag &= ~PEK_SELECT;
- }
- }
- }
- }
- else{
- LOOP_PARTICLES(i,pa){
- LOOP_KEYS(k,key){
- key->flag &= ~PEK_HIDE;
- }
- }
- }
-}
-
-static int key_inside_circle(short mco[2], float rad, float co[3], float *distance)
-{
- float dx,dy,dist;
- short vertco[2];
-
- project_short(co,vertco);
- dx=(float)(mco[0]-vertco[0]);
- dy=(float)(mco[1]-vertco[1]);
- dist=(float)sqrt((double)(dx*dx + dy*dy));
-
- if(dist<=rad){
- if(distance) *distance=dist;
- return 1;
- }
- else
- return 0;
-}
-static int key_inside_rect(rcti *rect, float co[3])
-{
- short vertco[2];
-
- project_short(co,vertco);
-
- if(vertco[0] > rect->xmin && vertco[0] < rect->xmax &&
- vertco[1] > rect->ymin && vertco[1] < rect->ymax)
- return 1;
- else
- return 0;
-}
-static int test_key_depth(float *co, bglMats *mats){
- double ux, uy, uz;
- float depth;
- short wco[3], x,y;
-
- if((G.vd->flag & V3D_ZBUF_SELECT)==0) return 1;
-
- gluProject(co[0],co[1],co[2], mats->modelview, mats->projection,
- (GLint *)mats->viewport, &ux, &uy, &uz );
-
- project_short(co,wco);
-
- x=wco[0];
- y=wco[1];
-
- if(G.vd->depths && x<G.vd->depths->w && y<G.vd->depths->h){
- if((float)uz>G.vd->depths->depths[y*G.vd->depths->w+x])
- return 0;
- else
- return 1;
- }
- else{
- x+= (short)curarea->winrct.xmin;
- y+= (short)curarea->winrct.ymin;
-
- glReadPixels(x, y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth);
-
- if((float)uz>depth)
- return 0;
- else
- return 1;
- }
-}
-
-static int particle_is_selected(ParticleSystem *psys, ParticleData *pa)
-{
- ParticleEditKey *key;
- int sel, i, k;
-
- if(pa->flag&PARS_HIDE) return 0;
-
- sel=0;
- i= pa - psys->particles;
- LOOP_KEYS(k,key)
- if(key->flag&PEK_SELECT)
- return 1;
-
- return 0;
-}
-
-/*-----iterators over editable particles-----*/
-static void for_mouse_hit_keys(int nearest, ParticleSystem *psys, void (*func)(ParticleSystem *psys, int pa_index, int key_index, void *userData), void *userData){
- /* these are allways the first in this userData */
- struct { short *mval; float rad; rcti *rect;} *data = userData;
- ParticleData *pa;
- ParticleEditKey *key;
- bglMats mats;
- int i,k, totpart, nearest_pa=-1, nearest_key=-1;
- float dist=data->rad;
-
- if(psys==0 || G.scene->selectmode==SCE_SELECT_PATH) return;
-
- totpart=psys->totpart;
-
- bgl_get_mats(&mats);
-
- LOOP_PARTICLES(i,pa){
- if(pa->flag & PARS_HIDE) continue;
-
- if(G.scene->selectmode==SCE_SELECT_END){
- key=psys->edit->keys[i]+pa->totkey-1;
-
- if(nearest){
- if(key_inside_circle(data->mval,dist,key->world_co,&dist) && test_key_depth(key->world_co,&mats)){
- nearest_pa=i;
- nearest_key=pa->totkey-1;
- }
- }
- else if(((data->mval)?
- key_inside_circle(data->mval,data->rad,key->world_co,0):
- key_inside_rect(data->rect,key->world_co)) && test_key_depth(key->world_co,&mats))
- func(psys,i,pa->totkey-1,userData);
- }
- else{
- key=psys->edit->keys[i];
-
- LOOP_KEYS(k,key){
- if(key->flag&PEK_HIDE) continue;
-
- if(nearest){
- if(key_inside_circle(data->mval,dist,key->world_co,&dist) && test_key_depth(key->world_co,&mats)){
- nearest_pa=i;
- nearest_key=k;
- }
- }
- else if(((data->mval)?
- key_inside_circle(data->mval,data->rad,key->world_co,0):
- key_inside_rect(data->rect,key->world_co)) && test_key_depth(key->world_co,&mats))
- func(psys,i,k,userData);
- }
- }
- }
- if(nearest && nearest_pa>-1){
- func(psys,nearest_pa,nearest_key,userData);
- }
-}
-static void foreach_mouse_hit_element(int selected, ParticleSystem *psys,void (*func)(ParticleSystem *psys, int index, void *userData), void *userData){
- /* these are allways the first in this userData */
- struct { short *mval; float rad; rcti* rect; float dist;} *data = userData;
- ParticleData *pa;
- ParticleEditKey *key;
- bglMats mats;
- int i,k, totpart;
-
- if(psys==0) return;
-
- totpart=psys->totpart;
-
- bgl_get_mats(&mats);
-
- if(G.scene->selectmode==SCE_SELECT_PATH)
- selected=0;
-
- LOOP_PARTICLES(i,pa){
- if(pa->flag & PARS_HIDE) continue;
-
- if(G.scene->selectmode==SCE_SELECT_END){
- key=psys->edit->keys[i]+pa->totkey-1;
- if(key_inside_circle(data->mval,data->rad,key->world_co,&data->dist) && (selected==0 || key->flag&PEK_SELECT) && test_key_depth(key->world_co,&mats))
- func(psys,i,userData);
- }
- else{
- LOOP_KEYS(k,key){
- if(key->flag&PEK_HIDE) continue;
-
- if(key_inside_circle(data->mval,data->rad,key->world_co,&data->dist) && (selected==0 || key->flag&PEK_SELECT) && test_key_depth(key->world_co,&mats)){
- func(psys,i,userData);
- break;
- }
- }
- }
- }
-}
-static void foreach_mouse_hit_key(int selected, ParticleSystem *psys,void (*func)(ParticleSystem *psys, float mat[][4], float imat[][4], int bel_index, int key_index, void *userData), void *userData){
- /* these are allways the first in this userData */
- struct { Object *ob; short *mval; float rad; rcti* rect; float dist;} *data = userData;
- ParticleData *pa;
- ParticleEditKey *key;
- ParticleSystemModifierData *psmd=0;
- bglMats mats;
- int i,k, totpart;
- float mat[4][4], imat[4][4];
-
- if(psys==0) return;
-
- psmd=psys_get_modifier(data->ob,psys);
-
- totpart=psys->totpart;
-
- bgl_get_mats(&mats);
-
- if(G.scene->selectmode==SCE_SELECT_PATH)
- selected=0;
-
- Mat4One(imat);
- Mat4One(mat);
-
- LOOP_PARTICLES(i,pa){
- if(pa->flag & PARS_HIDE) continue;
-
- psys_mat_hair_to_global(data->ob, psmd->dm, psys->part->from, pa, mat);
- //psys_geometry_mat(psmd->dm,pa,tmat);
- //Mat4MulMat4(mat,tmat,data->ob->obmat);
- Mat4Invert(imat,mat);
-
- if(G.scene->selectmode==SCE_SELECT_END){
- key=psys->edit->keys[i]+pa->totkey-1;
- if(key_inside_circle(data->mval,data->rad,key->world_co,&data->dist) && (selected==0 || key->flag&PEK_SELECT) && test_key_depth(key->world_co,&mats))
- func(psys,mat,imat,i,pa->totkey-1,userData);
- }
- else{
- LOOP_KEYS(k,key){
- if(key->flag&PEK_HIDE) continue;
-
- if(key_inside_circle(data->mval,data->rad,key->world_co,&data->dist) && (selected==0 || key->flag&PEK_SELECT) && test_key_depth(key->world_co,&mats)){
- func(psys,mat,imat,i,k,userData);
- }
- }
- }
- }
-}
-static void foreach_selected_element(ParticleSystem *psys, void (*func)(ParticleSystem *psys, int index, void *userData), void *userData){
- ParticleData *pa;
- int i,totpart;
-
- if(psys==0) return;
-
- totpart=psys->totpart;
-
- LOOP_PARTICLES(i,pa)
- if(particle_is_selected(psys, pa))
- func(psys,i,userData);
-}
-static void foreach_selected_key(ParticleSystem *psys, void (*func)(ParticleSystem *psys, int pa_index, int key_index, void *userData), void *userData){
- ParticleData *pa;
- ParticleEditKey *key;
- int i,k,totpart;
-
- if(psys==0) return;
-
- totpart=psys->totpart;
-
- LOOP_PARTICLES(i,pa){
- if(pa->flag&PARS_HIDE) continue;
-
- key=psys->edit->keys[i];
- LOOP_KEYS(k,key){
- if(key->flag&PEK_SELECT)
- func(psys,i,k,userData);
- }
- }
-}
-void PE_foreach_element(ParticleSystem *psys, void (*func)(ParticleSystem *psys, int index, void *userData), void *userData)
-{
- int i,totpart;
-
- if(psys==0) return;
-
- totpart=psys->totpart;
-
- for(i=0; i<totpart; i++)
- func(psys,i,userData);
-}
-static int count_selected_keys(ParticleSystem *psys)
-{
- ParticleData *pa;
- ParticleEditKey *key;
- int i,k,totpart,sel=0;
-
- if(psys==0) return 0;
-
- totpart=psys->totpart;
-
- LOOP_PARTICLES(i,pa){
- if(pa->flag&PARS_HIDE) continue;
-
- key=psys->edit->keys[i];
- if(G.scene->selectmode==SCE_SELECT_POINT){
- for(k=0; k<pa->totkey; k++,key++){
- if(key->flag&PEK_SELECT)
- sel++;
- }
- }
- else if(G.scene->selectmode==SCE_SELECT_END){
- key+=pa->totkey-1;
- if(key->flag&PEK_SELECT)
- sel++;
- }
- }
- return sel;
-}
-
-/************************************************/
-/* Particle Edit Mirroring */
-/************************************************/
-
-static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys)
-{
- ParticleEdit *edit;
- ParticleData *pa;
- ParticleSystemModifierData *psmd;
- KDTree *tree;
- KDTreeNearest nearest;
- float mat[4][4], co[3];
- int i, index, totpart;
-
- edit= psys->edit;
- psmd= psys_get_modifier(ob, psys);
- totpart= psys->totpart;
-
- tree= BLI_kdtree_new(totpart);
-
- /* insert particles into kd tree */
- LOOP_PARTICLES(i,pa) {
- psys_mat_hair_to_orco(ob, psmd->dm, psys->part->from, pa, mat);
- VECCOPY(co, pa->hair[0].co);
- Mat4MulVecfl(mat, co);
- BLI_kdtree_insert(tree, i, co, NULL);
- }
-
- BLI_kdtree_balance(tree);
-
- /* lookup particles and set in mirror cache */
- if(!edit->mirror_cache)
- edit->mirror_cache= MEM_callocN(sizeof(int)*totpart, "PE mirror cache");
-
- LOOP_PARTICLES(i,pa) {
- psys_mat_hair_to_orco(ob, psmd->dm, psys->part->from, pa, mat);
- VECCOPY(co, pa->hair[0].co);
- Mat4MulVecfl(mat, co);
- co[0]= -co[0];
-
- index= BLI_kdtree_find_nearest(tree, co, NULL, &nearest);
-
- /* this needs a custom threshold still, duplicated for editmode mirror */
- if(index != -1 && index != i && (nearest.dist <= 0.0002f))
- edit->mirror_cache[i]= index;
- else
- edit->mirror_cache[i]= -1;
- }
-
- /* make sure mirrors are in two directions */
- LOOP_PARTICLES(i,pa) {
- if(edit->mirror_cache[i]) {
- index= edit->mirror_cache[i];
- if(edit->mirror_cache[index] != i)
- edit->mirror_cache[i]= -1;
- }
- }
-
- BLI_kdtree_free(tree);
-}
-
-static void PE_mirror_particle(Object *ob, DerivedMesh *dm, ParticleSystem *psys, ParticleData *pa, ParticleData *mpa)
-{
- HairKey *hkey, *mhkey;
- ParticleEditKey *key, *mkey;
- ParticleEdit *edit;
- float mat[4][4], mmat[4][4], immat[4][4];
- int i, mi, k;
-
- edit= psys->edit;
- i= pa - psys->particles;
-
- /* find mirrored particle if needed */
- if(!mpa) {
- if(!edit->mirror_cache)
- PE_update_mirror_cache(ob, psys);
-
- mi= edit->mirror_cache[i];
- if(mi == -1)
- return;
- mpa= psys->particles + mi;
- }
- else
- mi= mpa - psys->particles;
-
- /* make sure they have the same amount of keys */
- if(pa->totkey != mpa->totkey) {
- if(mpa->hair) MEM_freeN(mpa->hair);
- if(edit->keys[mi]) MEM_freeN(edit->keys[mi]);
-
- mpa->hair= MEM_dupallocN(pa->hair);
- edit->keys[mi]= MEM_dupallocN(edit->keys[i]);
- mpa->totkey= pa->totkey;
-
- mhkey= mpa->hair;
- mkey= edit->keys[mi];
- for(k=0; k<mpa->totkey; k++, mkey++, mhkey++) {
- mkey->co= mhkey->co;
- mkey->time= &mhkey->time;
- mkey->flag &= PEK_SELECT;
- }
- }
-
- /* mirror positions and tags */
- psys_mat_hair_to_orco(ob, dm, psys->part->from, pa, mat);
- psys_mat_hair_to_orco(ob, dm, psys->part->from, mpa, mmat);
- Mat4Invert(immat, mmat);
-
- hkey=pa->hair;
- mhkey=mpa->hair;
- key= edit->keys[i];
- mkey= edit->keys[mi];
- for(k=0; k<pa->totkey; k++, hkey++, mhkey++, key++, mkey++) {
- VECCOPY(mhkey->co, hkey->co);
- Mat4MulVecfl(mat, mhkey->co);
- mhkey->co[0]= -mhkey->co[0];
- Mat4MulVecfl(immat, mhkey->co);
-
- if(key->flag & PEK_TAG)
- mkey->flag |= PEK_TAG;
- }
-
- if(pa->flag & PARS_TAG)
- mpa->flag |= PARS_TAG;
- if(pa->flag & PARS_EDIT_RECALC)
- mpa->flag |= PARS_EDIT_RECALC;
-}
-
-static void PE_apply_mirror(Object *ob, ParticleSystem *psys)
-{
- ParticleEdit *edit;
- ParticleData *pa;
- ParticleSystemModifierData *psmd;
- int i, totpart;
-
- edit= psys->edit;
- psmd= psys_get_modifier(ob, psys);
- totpart= psys->totpart;
-
- /* we delay settings the PARS_EDIT_RECALC for mirrored particles
- * to avoid doing mirror twice */
- LOOP_PARTICLES(i,pa) {
- if(pa->flag & PARS_EDIT_RECALC) {
- PE_mirror_particle(ob, psmd->dm, psys, pa, NULL);
-
- if(edit->mirror_cache[i] != -1)
- psys->particles[edit->mirror_cache[i]].flag &= ~PARS_EDIT_RECALC;
- }
- }
-
- LOOP_PARTICLES(i,pa)
- if(pa->flag & PARS_EDIT_RECALC)
- if(edit->mirror_cache[i] != -1)
- psys->particles[edit->mirror_cache[i]].flag |= PARS_EDIT_RECALC;
-
- edit->totkeys= psys_count_keys(psys);
-}
-
-/************************************************/
-/* Edit Calculation */
-/************************************************/
-/* tries to stop edited particles from going through the emitter's surface */
-static void PE_deflect_emitter(Object *ob, ParticleSystem *psys)
-{
- ParticleEdit *edit;
- ParticleData *pa;
- ParticleEditKey *key;
- ParticleEditSettings *pset = PE_settings();
- ParticleSystemModifierData *psmd = psys_get_modifier(ob,psys);
- int i,k,totpart,index;
- float *vec, *nor, dvec[3], dot, dist_1st;
- float hairimat[4][4], hairmat[4][4];
-
- if(psys==0)
- return;
-
- if((pset->flag & PE_DEFLECT_EMITTER)==0)
- return;
-
- edit=psys->edit;
- totpart=psys->totpart;
-
- LOOP_PARTICLES(i,pa){
- if(!(pa->flag & PARS_EDIT_RECALC))
- continue;
-
- psys_mat_hair_to_object(ob, psmd->dm, psys->part->from, pa, hairmat);
-
- LOOP_KEYS(k,key){
- Mat4MulVecfl(hairmat, key->co);
- }
- //}
-
- //LOOP_PARTICLES(i,pa){
- key=psys->edit->keys[i]+1;
-
- dist_1st=VecLenf((key-1)->co,key->co);
- dist_1st*=0.75f*pset->emitterdist;
-
- for(k=1; k<pa->totkey; k++, key++){
- index= BLI_kdtree_find_nearest(edit->emitter_field,key->co,NULL,NULL);
-
- vec=edit->emitter_cosnos +index*6;
- nor=vec+3;
-
- VecSubf(dvec, key->co, vec);
-
- dot=Inpf(dvec,nor);
- VECCOPY(dvec,nor);
-
- if(dot>0.0f){
- if(dot<dist_1st){
- Normalize(dvec);
- VecMulf(dvec,dist_1st-dot);
- VecAddf(key->co,key->co,dvec);
- }
- }
- else{
- Normalize(dvec);
- VecMulf(dvec,dist_1st-dot);
- VecAddf(key->co,key->co,dvec);
- }
- if(k==1)
- dist_1st*=1.3333f;
- }
- //}
-
- //LOOP_PARTICLES(i,pa){
-
- Mat4Invert(hairimat,hairmat);
-
- LOOP_KEYS(k,key){
- Mat4MulVecfl(hairimat, key->co);
- }
- }
-}
-/* force set distances between neighbouring keys */
-void PE_apply_lengths(ParticleSystem *psys)
-{
- ParticleEdit *edit;
- ParticleData *pa;
- ParticleEditKey *key;
- ParticleEditSettings *pset=PE_settings();
- int i,k,totpart;
- float dv1[3];
-
- if(psys==0)
- return;
-
- if((pset->flag & PE_KEEP_LENGTHS)==0)
- return;
-
- edit=psys->edit;
- totpart=psys->totpart;
-
- LOOP_PARTICLES(i,pa){
- if(!(pa->flag & PARS_EDIT_RECALC))
- continue;
-
- for(k=1, key=edit->keys[i] + 1; k<pa->totkey; k++, key++){
- VecSubf(dv1, key->co, (key - 1)->co);
- Normalize(dv1);
- VecMulf(dv1, (key - 1)->length);
- VecAddf(key->co, (key - 1)->co, dv1);
- }
- }
-}
-/* try to find a nice solution to keep distances between neighbouring keys */
-static void PE_iterate_lengths(ParticleSystem *psys)
-{
- ParticleEdit *edit;
- ParticleData *pa;
- ParticleEditKey *key;
- ParticleEditSettings *pset=PE_settings();
- int i, j, k,totpart;
- float tlen;
- float dv0[3] = {0.0f, 0.0f, 0.0f};
- float dv1[3] = {0.0f, 0.0f, 0.0f};
- float dv2[3] = {0.0f, 0.0f, 0.0f};
-
- if(psys==0)
- return;
-
- if((pset->flag & PE_KEEP_LENGTHS)==0)
- return;
-
- edit=psys->edit;
- totpart=psys->totpart;
-
- LOOP_PARTICLES(i,pa){
- if(!(pa->flag & PARS_EDIT_RECALC))
- continue;
-
- for(j=1; j<pa->totkey; j++){
- float mul = 1.0f / (float)pa->totkey;
-
- if(pset->flag & PE_LOCK_FIRST){
- key = edit->keys[i] + 1;
- k = 1;
- dv1[0] = dv1[1] = dv1[2] = 0.0;
- }
- else{
- key = edit->keys[i];
- k = 0;
- dv0[0] = dv0[1] = dv0[2] = 0.0;
- }
-
- for(; k<pa->totkey; k++, key++){
- if(k){
- VecSubf(dv0, (key - 1)->co, key->co);
- tlen = Normalize(dv0);
- VecMulf(dv0, (mul * (tlen - (key - 1)->length)));
- }
-
- if(k < pa->totkey - 1){
- VecSubf(dv2, (key + 1)->co, key->co);
- tlen = Normalize(dv2);
- VecMulf(dv2, mul * (tlen - key->length));
- }
-
- if(k){
- VecAddf((key-1)->co,(key-1)->co,dv1);
- }
-
- VECADD(dv1,dv0,dv2);
- }
- }
- }
-}
-/* set current distances to be kept between neighbouting keys */
-static void recalc_lengths(ParticleSystem *psys)
-{
- ParticleData *pa;
- ParticleEditKey *key;
- int i, k, totpart;
-
- if(psys==0)
- return;
-
- totpart = psys->totpart;
-
- LOOP_PARTICLES(i,pa){
- key = psys->edit->keys[i];
- for(k=0; k<pa->totkey-1; k++, key++){
- key->length = VecLenf(key->co, (key + 1)->co);
- }
- }
-}
-/* calculate and store key locations in world coordinates */
-void PE_recalc_world_cos(Object *ob, ParticleSystem *psys)
-{
- ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys);
- ParticleData *pa;
- ParticleEditKey *key;
- int i, k, totpart;
- float hairmat[4][4];
-
- if(psys==0)
- return;
-
- totpart = psys->totpart;
-
- LOOP_PARTICLES(i,pa){
- psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, pa, hairmat);
-
- LOOP_KEYS(k,key){
- VECCOPY(key->world_co,key->co);
- Mat4MulVecfl(hairmat, key->world_co);
- }
- }
-}
-/* calculate a tree for finding nearest emitter's vertice */
-static void recalc_emitter_field(Object *ob, ParticleSystem *psys)
-{
- DerivedMesh *dm=psys_get_modifier(ob,psys)->dm;
- ParticleEdit *edit = psys->edit;
- MFace *mface;
- MVert *mvert;
- float *vec, *nor;
- int i, totface, totvert;
-
- if(edit->emitter_cosnos)
- MEM_freeN(edit->emitter_cosnos);
-
- BLI_kdtree_free(edit->emitter_field);
-
- totface=dm->getNumFaces(dm);
- totvert=dm->getNumVerts(dm);
-
- edit->emitter_cosnos=MEM_callocN(totface*6*sizeof(float),"emitter cosnos");
-
- edit->emitter_field= BLI_kdtree_new(totface);
-
- vec=edit->emitter_cosnos;
- nor=vec+3;
-
- mvert=dm->getVertDataArray(dm,CD_MVERT);
- for(i=0; i<totface; i++, vec+=6, nor+=6){
- mface=dm->getFaceData(dm,i,CD_MFACE);
-
- mvert=dm->getVertData(dm,mface->v1,CD_MVERT);
- VECCOPY(vec,mvert->co);
- VECCOPY(nor,mvert->no);
-
- mvert=dm->getVertData(dm,mface->v2,CD_MVERT);
- VECADD(vec,vec,mvert->co);
- VECADD(nor,nor,mvert->no);
-
- mvert=dm->getVertData(dm,mface->v3,CD_MVERT);
- VECADD(vec,vec,mvert->co);
- VECADD(nor,nor,mvert->no);
-
- if (mface->v4){
- mvert=dm->getVertData(dm,mface->v4,CD_MVERT);
- VECADD(vec,vec,mvert->co);
- VECADD(nor,nor,mvert->no);
-
- VecMulf(vec,0.25);
- }
- else
- VecMulf(vec,0.3333f);
-
- Normalize(nor);
-
- BLI_kdtree_insert(edit->emitter_field, i, vec, NULL);
- }
-
- BLI_kdtree_balance(edit->emitter_field);
-}
-
-void PE_update_selection(Object *ob, int useflag)
-{
- ParticleSystem *psys= PE_get_current(ob);
- ParticleEdit *edit= psys->edit;
- ParticleEditSettings *pset= PE_settings();
- ParticleSettings *part= psys->part;
- ParticleData *pa;
- HairKey *hkey;
- ParticleEditKey *key;
- float cfra= CFRA;
- int i, k, totpart;
-
- totpart= psys->totpart;
-
- /* flag all particles to be updated if not using flag */
- if(!useflag)
- LOOP_PARTICLES(i,pa)
- pa->flag |= PARS_EDIT_RECALC;
-
- /* flush edit key flag to hair key flag to preserve selection
- * on save */
- LOOP_PARTICLES(i,pa) {
- key = edit->keys[i];
-
- for(k=0, hkey=pa->hair; k<pa->totkey; k++, hkey++, key++)
- hkey->editflag= key->flag;
- }
-
- psys_cache_paths(ob, psys, CFRA, 1);
-
- if(part->childtype && (pset->flag & PE_SHOW_CHILD))
- psys_cache_child_paths(ob, psys, cfra, 1);
-
- /* disable update flag */
- LOOP_PARTICLES(i,pa)
- pa->flag &= ~PARS_EDIT_RECALC;
-}
-
-void PE_update_object(Object *ob, int useflag)
-{
- ParticleSystem *psys= PE_get_current(ob);
- ParticleEditSettings *pset= PE_settings();
- ParticleSettings *part= psys->part;
- ParticleData *pa;
- float cfra= CFRA;
- int i, totpart= psys->totpart;
-
- /* flag all particles to be updated if not using flag */
- if(!useflag)
- LOOP_PARTICLES(i,pa)
- pa->flag |= PARS_EDIT_RECALC;
-
- /* do post process on particle edit keys */
- PE_iterate_lengths(psys);
- PE_deflect_emitter(ob,psys);
- PE_apply_lengths(psys);
- if(pset->flag & PE_X_MIRROR)
- PE_apply_mirror(ob,psys);
- PE_recalc_world_cos(ob,psys);
- PE_hide_keys_time(psys,cfra);
-
- /* regenerate path caches */
- psys_cache_paths(ob, psys, cfra, 1);
-
- if(part->childtype && (pset->flag & PE_SHOW_CHILD))
- psys_cache_child_paths(ob, psys, cfra, 1);
-
- /* disable update flag */
- LOOP_PARTICLES(i,pa)
- pa->flag &= ~PARS_EDIT_RECALC;
-}
-
-/* initialize needed data for bake edit */
-void PE_create_particle_edit(Object *ob, ParticleSystem *psys)
-{
- ParticleEdit *edit=psys->edit;
- ParticleData *pa;
- ParticleEditKey *key;
- HairKey *hkey;
- int i,k, totpart=psys->totpart, alloc=1;
-
- if((psys->flag & PSYS_EDITED)==0)
- return;
-
- if(edit){
- int newtotkeys = psys_count_keys(psys);
- if(newtotkeys == edit->totkeys)
- alloc=0;
- }
-
- if(alloc){
- if(edit){
- error("ParticleEdit exists allready! Poke jahka!");
- PE_free_particle_edit(psys);
- }
-
- edit=psys->edit=MEM_callocN(sizeof(ParticleEdit), "PE_create_particle_edit");
-
- edit->keys=MEM_callocN(totpart*sizeof(ParticleEditKey*),"ParticleEditKey array");
-
- LOOP_PARTICLES(i,pa){
- key = edit->keys[i] = MEM_callocN(pa->totkey*sizeof(ParticleEditKey),"ParticleEditKeys");
- for(k=0, hkey=pa->hair; k<pa->totkey; k++, hkey++, key++){
- key->co = hkey->co;
- key->time = &hkey->time;
- key->flag= hkey->editflag;
- }
- }
-
- edit->totkeys = psys_count_keys(psys);
- }
-
- recalc_lengths(psys);
- recalc_emitter_field(ob, psys);
- PE_recalc_world_cos(ob, psys);
-
- if(alloc) {
- ParticleUndo_clear(psys);
- PE_undo_push("Original");
- }
-}
-
-/* toggle particle mode on & off */
-void PE_set_particle_edit(void)
-{
- Object *ob= OBACT;
- ParticleSystem *psys = PE_get_current(ob);
-
- scrarea_queue_headredraw(curarea);
-
- //if(!ob || ob->id.lib) return; /* is the id.lib test needed? -jahka*/
- if(ob==0 || psys==0) return;
-
- if(psys==0){
- if(ob->particlesystem.first){
- psys=ob->particlesystem.first;
- psys->flag |= PSYS_CURRENT;
- }
- else
- return;
- }
-
- if((G.f & G_PARTICLEEDIT)==0){
- if(psys && psys->part->type == PART_HAIR && psys->flag & PSYS_EDITED) {
- if(psys_check_enabled(ob, psys)) {
- if(psys->edit==0)
- PE_create_particle_edit(ob, psys);
- PE_recalc_world_cos(ob, psys);
- }
- }
-
- G.f |= G_PARTICLEEDIT;
- }
- else{
- G.f &= ~G_PARTICLEEDIT;
-
- if(psys->soft)
- psys->softflag |= OB_SB_REDO;
- }
-
- DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
-
- allqueue(REDRAWVIEW3D, 1); /* including header */
- allqueue(REDRAWBUTSOBJECT, 0);
-}
-/************************************************/
-/* Edit Selections */
-/************************************************/
-/*-----selection callbacks-----*/
-static void select_key(ParticleSystem *psys, int pa_index, int key_index, void *userData)
-{
- struct { short *mval; float rad; rcti* rect; int select; } *data = userData;
- ParticleData *pa = psys->particles + pa_index;
- ParticleEditKey *key = psys->edit->keys[pa_index] + key_index;
-
- if(data->select)
- key->flag|=PEK_SELECT;
- else
- key->flag&=~PEK_SELECT;
-
- pa->flag |= PARS_EDIT_RECALC;
-}
-static void select_keys(ParticleSystem *psys, int pa_index, int key_index, void *userData)
-{
- struct { short *mval; float rad; rcti* rect; int select; } *data = userData;
- ParticleData *pa = psys->particles + pa_index;
- ParticleEditKey *key = psys->edit->keys[pa_index];
- int k;
-
- for(k=0; k<pa->totkey; k++,key++){
- if(data->select)
- key->flag|=PEK_SELECT;
- else
- key->flag&=~PEK_SELECT;
- }
-
- pa->flag |= PARS_EDIT_RECALC;
-}
-static void toggle_key_select(ParticleSystem *psys, int pa_index, int key_index, void *userData)
-{
- ParticleData *pa = psys->particles + pa_index;
-
- if(psys->edit->keys[pa_index][key_index].flag&PEK_SELECT)
- psys->edit->keys[pa_index][key_index].flag&=~PEK_SELECT;
- else
- psys->edit->keys[pa_index][key_index].flag|=PEK_SELECT;
-
- pa->flag |= PARS_EDIT_RECALC;
-}
-static void select_root(ParticleSystem *psys, int index, void *userData)
-{
- psys->edit->keys[index]->flag |= PEK_SELECT;
-}
-
-static void select_tip(ParticleSystem *psys, int index, void *userData)
-{
- ParticleData *pa = psys->particles + index;
- ParticleEditKey *key = psys->edit->keys[index] + pa->totkey-1;
-
- key->flag |= PEK_SELECT;
-}
-static void select_more_keys(ParticleSystem *psys, int index, void *userData)
-{
- ParticleEdit *edit = psys->edit;
- ParticleData *pa = psys->particles+index;
- ParticleEditKey *key;
- int k;
-
- for(k=0,key=edit->keys[index]; k<pa->totkey; k++,key++){
- if(key->flag&PEK_SELECT) continue;
-
- if(k==0){
- if((key+1)->flag&PEK_SELECT)
- key->flag |= PEK_TO_SELECT;
- }
- else if(k==pa->totkey-1){
- if((key-1)->flag&PEK_SELECT)
- key->flag |= PEK_TO_SELECT;
- }
- else{
- if(((key-1)->flag | (key+1)->flag) & PEK_SELECT)
- key->flag |= PEK_TO_SELECT;
- }
- }
-
- for(k=0,key=edit->keys[index]; k<pa->totkey; k++,key++){
- if(key->flag&PEK_TO_SELECT){
- key->flag &= ~PEK_TO_SELECT;
- key->flag |= PEK_SELECT;
- }
- }
-}
-
-static void select_less_keys(ParticleSystem *psys, int index, void *userData)
-{
- ParticleEdit *edit = psys->edit;
- ParticleData *pa = psys->particles+index;
- ParticleEditKey *key;
- int k;
-
- for(k=0,key=edit->keys[index]; k<pa->totkey; k++,key++){
- if((key->flag&PEK_SELECT)==0) continue;
-
- if(k==0){
- if(((key+1)->flag&PEK_SELECT)==0)
- key->flag |= PEK_TO_SELECT;
- }
- else if(k==pa->totkey-1){
- if(((key-1)->flag&PEK_SELECT)==0)
- key->flag |= PEK_TO_SELECT;
- }
- else{
- if((((key-1)->flag & (key+1)->flag) & PEK_SELECT)==0)
- key->flag |= PEK_TO_SELECT;
- }
- }
-
- for(k=0,key=edit->keys[index]; k<pa->totkey; k++,key++){
- if(key->flag&PEK_TO_SELECT)
- key->flag &= ~(PEK_TO_SELECT|PEK_SELECT);
- }
-}
-
-/*-----using above callbacks-----*/
-void PE_deselectall(void)
-{
- Object *ob = OBACT;
- ParticleSystem *psys = PE_get_current(ob);
- ParticleEdit *edit = 0;
- ParticleData *pa;
- ParticleEditKey *key;
- int i,k,totpart, sel = 0;
-
- if(!PE_can_edit(psys)) return;
-
- edit = psys->edit;
-
- totpart = psys->totpart;
-
- LOOP_PARTICLES(i,pa){
- if(pa->flag & PARS_HIDE) continue;
- LOOP_KEYS(k,key){
- if(key->flag&PEK_SELECT){
- sel = 1;
- key->flag &= ~PEK_SELECT;
- pa->flag |= PARS_EDIT_RECALC;
- }
- }
- }
-
- if(sel==0){
- LOOP_PARTICLES(i,pa){
- if(pa->flag & PARS_HIDE) continue;
- LOOP_KEYS(k,key){
- if(!(key->flag & PEK_SELECT)) {
- key->flag |= PEK_SELECT;
- pa->flag |= PARS_EDIT_RECALC;
- }
- }
- }
- }
-
- PE_update_selection(ob, 1);
-
- BIF_undo_push("(De)select all keys");
- allqueue(REDRAWVIEW3D, 1);
-}
-void PE_mouse_particles(void)
-{
- struct { short *mval; float rad; rcti* rect; int select; } data;
- Object *ob = OBACT;
- ParticleSystem *psys = PE_get_current(ob);
- ParticleEdit *edit = 0;
- ParticleData *pa;
- ParticleEditKey *key;
- short mval[2];
- int i,k,totpart;
-
- if(!PE_can_edit(psys)) return;
-
- edit = psys->edit;
-
- totpart = psys->totpart;
-
- bglFlush();
- glReadBuffer(GL_BACK);
- glDrawBuffer(GL_BACK);
- persp(PERSP_VIEW);
-
- if(G.qual != LR_SHIFTKEY)
- LOOP_PARTICLES(i,pa){
- if(pa->flag & PARS_HIDE) continue;
- LOOP_KEYS(k,key){
- if(key->flag & PEK_SELECT) {
- key->flag &= ~PEK_SELECT;
- pa->flag |= PARS_EDIT_RECALC;
- }
- }
- }
-
- getmouseco_areawin(mval);
-
- data.mval=mval;
- data.rad=75.0f;
- data.rect=0;
- data.select=0;
-
- for_mouse_hit_keys(1,psys,toggle_key_select,&data);
-
- PE_update_selection(ob, 1);
-
- rightmouse_transform();
-
- allqueue(REDRAWVIEW3D, 1);
-}
-void PE_select_root()
-{
- Object *ob=OBACT;
- ParticleSystem *psys = PE_get_current(ob);
-
- if(!PE_can_edit(psys)) return;
-
- PE_foreach_element(psys,select_root,NULL);
- BIF_undo_push("Select first");
-}
-void PE_select_tip()
-{
- Object *ob=OBACT;
- ParticleSystem *psys = PE_get_current(ob);
-
- if(!PE_can_edit(psys)) return;
-
- PE_foreach_element(psys,select_tip,NULL);
- BIF_undo_push("Select last");
-}
-void PE_select_linked(void)
-{
- struct { short *mval; float rad; rcti* rect; int select; } data;
- Object *ob = OBACT;
- ParticleSystem *psys = PE_get_current(ob);
- short mval[2];
-
- if(!PE_can_edit(psys)) return;
-
- getmouseco_areawin(mval);
-
- data.mval=mval;
- data.rad=75.0f;
- data.rect=0;
- data.select=(G.qual != LR_SHIFTKEY);
-
- for_mouse_hit_keys(1,psys,select_keys,&data);
-
- PE_update_selection(ob, 1);
-
- BIF_undo_push("Select linked keys");
-
- allqueue(REDRAWVIEW3D, 1);
- return;
-}
-void PE_borderselect(void)
-{
- struct { short *mval; float rad; rcti* rect; int select; } data;
- Object *ob = OBACT;
- ParticleSystem *psys = PE_get_current(ob);
- rcti rect;
- int val;
-
- if(!PE_can_edit(psys)) return;
-
- setlinestyle(2);
- val= get_border(&rect, 3);
- setlinestyle(0);
-
- if(val==0) return;
-
- data.mval=0;
- data.rect=&rect;
- data.select=(val==LEFTMOUSE);
-
- for_mouse_hit_keys(0,psys,select_key,&data);
-
- PE_update_selection(ob, 1);
-
- BIF_undo_push("Select keys");
-
- allqueue(REDRAWVIEW3D, 1);
- return;
-}
-void PE_selectionCB(short selecting, Object *editobj, short *mval, float rad)
-{
- struct { short *mval; float rad; rcti* rect; int select; } data;
- ParticleSystem *psys = PE_get_current(OBACT);
-
- if(!PE_can_edit(psys)) return;
-
- data.mval=mval;
- data.rad=rad;
- data.rect=0;
- data.select=(selecting==LEFTMOUSE);
-
- for_mouse_hit_keys(0,psys,select_key,&data);
-
- draw_sel_circle(0, 0, 0, 0, 0); /* signal */
- force_draw(0);
-}
-void PE_do_lasso_select(short mcords[][2], short moves, short select)
-{
- Object *ob = OBACT;
- ParticleSystem *psys = PE_get_current(ob);
- ParticleSystemModifierData *psmd;
- ParticleEdit *edit;
- ParticleData *pa;
- ParticleEditKey *key;
- float co[3], mat[4][4];
- short vertco[2];
- int i, k, totpart;
-
- if(!PE_can_edit(psys)) return;
-
- psmd= psys_get_modifier(ob, psys);
- edit=psys->edit;
- totpart=psys->totpart;
-
- LOOP_PARTICLES(i,pa){
- if(pa->flag & PARS_HIDE) continue;
-
- psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, pa, mat);
-
- if(G.scene->selectmode==SCE_SELECT_POINT){
- LOOP_KEYS(k,key){
- VECCOPY(co, key->co);
- Mat4MulVecfl(mat, co);
- project_short(co,vertco);
- if(lasso_inside(mcords,moves,vertco[0],vertco[1])){
- if(select && !(key->flag & PEK_SELECT)) {
- key->flag|=PEK_SELECT;
- pa->flag |= PARS_EDIT_RECALC;
- }
- else if(key->flag & PEK_SELECT) {
- key->flag&=~PEK_SELECT;
- pa->flag |= PARS_EDIT_RECALC;
- }
- }
- }
- }
- else if(G.scene->selectmode==SCE_SELECT_END){
- key = edit->keys[i] + pa->totkey - 1;
-
- VECCOPY(co, key->co);
- Mat4MulVecfl(mat, co);
- project_short(co,vertco);
- if(lasso_inside(mcords,moves,vertco[0],vertco[1])){
- if(select && !(key->flag & PEK_SELECT)) {
- key->flag|=PEK_SELECT;
- pa->flag |= PARS_EDIT_RECALC;
- }
- else if(key->flag & PEK_SELECT) {
- key->flag&=~PEK_SELECT;
- pa->flag |= PARS_EDIT_RECALC;
- }
- }
- }
- }
-
- PE_update_selection(ob, 1);
-
- BIF_undo_push("Lasso select particles");
-
- allqueue(REDRAWVIEW3D, 1);
-}
-void PE_hide(int mode)
-{
- ParticleSystem *psys = PE_get_current(OBACT);
- ParticleEdit *edit;
- ParticleData *pa;
- int i,totpart;
-
- if(!PE_can_edit(psys)) return;
-
- edit = psys->edit;
- totpart = psys->totpart;
-
- if(mode == 0){ /* reveal all particles */
- LOOP_PARTICLES(i,pa){
- pa->flag &= ~PARS_HIDE;
- }
- }
- else if(mode == 1){ /* hide unselected particles */
- LOOP_PARTICLES(i,pa)
- if(particle_is_selected(psys, pa))
- pa->flag |= PARS_HIDE;
- }
- else{ /* hide selected particles */
- LOOP_PARTICLES(i,pa)
- if(particle_is_selected(psys, pa))
- pa->flag |= PARS_HIDE;
- }
-
- BIF_undo_push("(Un)hide elements");
-
- allqueue(REDRAWVIEW3D, 1);
-}
-void PE_select_less(void)
-{
- ParticleSystem *psys = PE_get_current(OBACT);
-
- if(!PE_can_edit(psys)) return;
-
- PE_foreach_element(psys,select_less_keys,NULL);
-
- BIF_undo_push("Select less");
- allqueue(REDRAWVIEW3D, 1);
-}
-void PE_select_more(void)
-{
- ParticleSystem *psys = PE_get_current(OBACT);
-
- if(!PE_can_edit(psys)) return;
-
- PE_foreach_element(psys,select_more_keys,NULL);
-
- BIF_undo_push("Select more");
- allqueue(REDRAWVIEW3D, 1);
-}
-/************************************************/
-/* Edit Rekey */
-/************************************************/
-static void rekey_element(ParticleSystem *psys, int index, void *userData)
-{
- struct { Object *ob; float dval; } *data = userData;
- ParticleData *pa = psys->particles + index;
- ParticleEdit *edit = psys->edit;
- ParticleEditSettings *pset = PE_settings();
- ParticleKey state;
- HairKey *key, *new_keys;
- ParticleEditKey *ekey;
- float dval, sta, end;
- int k;
-
- pa->flag |= PARS_REKEY;
-
- key = new_keys = MEM_callocN(pset->totrekey * sizeof(HairKey),"Hair re-key keys");
-
- /* root and tip stay the same */
- VECCOPY(key->co, pa->hair->co);
- VECCOPY((key + pset->totrekey - 1)->co, (pa->hair + pa->totkey - 1)->co);
-
- sta = key->time = pa->hair->time;
- end = (key + pset->totrekey - 1)->time = (pa->hair + pa->totkey - 1)->time;
- dval = (end - sta) / (float)(pset->totrekey - 1);
-
- /* interpolate new keys from old ones */
- for(k=1,key++; k<pset->totrekey-1; k++,key++) {
- state.time = (float)k / (float)(pset->totrekey-1);
- psys_get_particle_on_path(data->ob, psys, index, &state, 0);
- VECCOPY(key->co, state.co);
- key->time = sta + k * dval;
- }
-
- /* replace keys */
- if(pa->hair)
- MEM_freeN(pa->hair);
- pa->hair = new_keys;
-
- pa->totkey=pset->totrekey;
-
- if(edit->keys[index])
- MEM_freeN(edit->keys[index]);
- ekey = edit->keys[index] = MEM_callocN(pa->totkey * sizeof(ParticleEditKey),"Hair re-key edit keys");
-
- for(k=0, key=pa->hair; k<pa->totkey; k++, key++, ekey++) {
- ekey->co = key->co;
- ekey->time = &key->time;
- }
-
- pa->flag &= ~PARS_REKEY;
- pa->flag |= PARS_EDIT_RECALC;
-}
-void PE_rekey(void)
-{
- Object *ob=OBACT;
- ParticleSystem *psys = PE_get_current(ob);
- ParticleEditSettings *pset = PE_settings();
- struct { Object *ob; float dval; } data;
-
- if(!PE_can_edit(psys)) return;
-
- data.ob = ob;
- data.dval = 1.0f / (float)(pset->totrekey-1);
-
- foreach_selected_element(psys,rekey_element,&data);
-
- psys->edit->totkeys = psys_count_keys(psys);
-
- recalc_lengths(psys);
-
- PE_update_object(ob, 1);
-
- BIF_undo_push("Re-key particles");
-}
-static void rekey_element_to_time(int index, float path_time)
-{
- Object *ob = OBACT;
- ParticleSystem *psys = PE_get_current(ob);
- ParticleEdit *edit=0;
- ParticleData *pa;
- ParticleKey state;
- HairKey *new_keys, *key;
- ParticleEditKey *ekey;
- int k;
-
- if(psys==0) return;
-
- edit = psys->edit;
-
- pa = psys->particles + index;
-
- pa->flag |= PARS_REKEY;
-
- key = new_keys = MEM_dupallocN(pa->hair);
-
- /* interpolate new keys from old ones (roots stay the same) */
- for(k=1, key++; k < pa->totkey; k++, key++) {
- state.time = path_time * (float)k / (float)(pa->totkey-1);
- psys_get_particle_on_path(ob, psys, index, &state, 0);
- VECCOPY(key->co, state.co);
- }
-
- /* replace hair keys */
- if(pa->hair)
- MEM_freeN(pa->hair);
- pa->hair = new_keys;
-
- /* update edit pointers */
- for(k=0, key=pa->hair, ekey=edit->keys[index]; k<pa->totkey; k++, key++, ekey++) {
- ekey->co = key->co;
- ekey->time = &key->time;
- }
-
- pa->flag &= ~PARS_REKEY;
-}
-static int remove_tagged_elements(Object *ob, ParticleSystem *psys)
-{
- ParticleEdit *edit = psys->edit;
- ParticleEditSettings *pset = PE_settings();
- ParticleData *pa, *npa=0, *new_pars=0;
- ParticleEditKey **key, **nkey=0, **new_keys=0;
- ParticleSystemModifierData *psmd;
- int i, totpart, new_totpart = psys->totpart, removed = 0;
-
- if(pset->flag & PE_X_MIRROR) {
- /* mirror tags */
- psmd = psys_get_modifier(ob, psys);
- totpart = psys->totpart;
-
- LOOP_PARTICLES(i,pa)
- if(pa->flag & PARS_TAG)
- PE_mirror_particle(ob, psmd->dm, psys, pa, NULL);
- }
-
- for(i=0, pa=psys->particles; i<psys->totpart; i++, pa++) {
- if(pa->flag & PARS_TAG) {
- new_totpart--;
- removed++;
- }
- }
-
- if(new_totpart != psys->totpart) {
- if(new_totpart) {
- npa = new_pars = MEM_callocN(new_totpart * sizeof(ParticleData), "ParticleData array");
- nkey = new_keys = MEM_callocN(new_totpart * sizeof(ParticleEditKey *), "ParticleEditKey array");
- }
-
- pa = psys->particles;
- key = edit->keys;
- for(i=0; i<psys->totpart; i++, pa++, key++) {
- if(pa->flag & PARS_TAG) {
- if(*key)
- MEM_freeN(*key);
- if(pa->hair)
- MEM_freeN(pa->hair);
- }
- else {
- memcpy(npa, pa, sizeof(ParticleData));
- memcpy(nkey, key, sizeof(ParticleEditKey*));
- npa++;
- nkey++;
- }
- }
-
- if(psys->particles) MEM_freeN(psys->particles);
- psys->particles = new_pars;
-
- if(edit->keys) MEM_freeN(edit->keys);
- edit->keys = new_keys;
-
- if(edit->mirror_cache) {
- MEM_freeN(edit->mirror_cache);
- edit->mirror_cache = NULL;
- }
-
- psys->totpart = new_totpart;
-
- edit->totkeys = psys_count_keys(psys);
- }
-
- return removed;
-}
-static void remove_tagged_keys(Object *ob, ParticleSystem *psys)
-{
- ParticleEdit *edit = psys->edit;
- ParticleEditSettings *pset = PE_settings();
- ParticleData *pa;
- HairKey *key, *nkey, *new_keys=0;
- ParticleEditKey *ekey;
- ParticleSystemModifierData *psmd;
- int i, k, totpart = psys->totpart;
- short new_totkey;
-
- if(pset->flag & PE_X_MIRROR) {
- /* mirror key tags */
- psmd = psys_get_modifier(ob, psys);
-
- LOOP_PARTICLES(i,pa) {
- LOOP_KEYS(k,ekey) {
- if(ekey->flag & PEK_TAG) {
- PE_mirror_particle(ob, psmd->dm, psys, pa, NULL);
- break;
- }
- }
- }
- }
-
- LOOP_PARTICLES(i,pa) {
- new_totkey = pa->totkey;
- LOOP_KEYS(k,ekey) {
- if(ekey->flag & PEK_TAG)
- new_totkey--;
- }
- /* we can't have elements with less than two keys*/
- if(new_totkey < 2)
- pa->flag |= PARS_TAG;
- }
- remove_tagged_elements(ob, psys);
-
- totpart = psys->totpart;
-
- LOOP_PARTICLES(i,pa) {
- new_totkey = pa->totkey;
- LOOP_KEYS(k,ekey) {
- if(ekey->flag & PEK_TAG)
- new_totkey--;
- }
- if(new_totkey != pa->totkey) {
- key = pa->hair;
- nkey = new_keys = MEM_callocN(new_totkey*sizeof(HairKey), "HairKeys");
-
- for(k=0, ekey=edit->keys[i]; k<new_totkey; k++, key++, nkey++, ekey++) {
- while(ekey->flag & PEK_TAG && key < pa->hair + pa->totkey) {
- key++;
- ekey++;
- }
-
- if(key < pa->hair + pa->totkey) {
- VECCOPY(nkey->co, key->co);
- nkey->time = key->time;
- nkey->weight = key->weight;
- }
- }
- if(pa->hair)
- MEM_freeN(pa->hair);
-
- pa->hair = new_keys;
-
- pa->totkey=new_totkey;
-
- if(edit->keys[i])
- MEM_freeN(edit->keys[i]);
- ekey = edit->keys[i] = MEM_callocN(new_totkey*sizeof(ParticleEditKey), "particle edit keys");
-
- for(k=0, key=pa->hair; k<pa->totkey; k++, key++, ekey++) {
- ekey->co = key->co;
- ekey->time = &key->time;
- }
- }
- }
-
- edit->totkeys = psys_count_keys(psys);
-}
-/* works like normal edit mode subdivide, inserts keys between neighbouring selected keys */
-static void subdivide_element(ParticleSystem *psys, int index, void *userData)
-{
- struct { Object *ob; } *data = userData;
- ParticleEdit *edit = psys->edit;
- ParticleData *pa = psys->particles + index;
-
- ParticleKey state;
- HairKey *key, *nkey, *new_keys;
- ParticleEditKey *ekey, *nekey, *new_ekeys;
-
- int k;
- short totnewkey=0;
- float endtime;
-
- for(k=0, ekey=edit->keys[index]; k<pa->totkey-1; k++,ekey++){
- if(ekey->flag&PEK_SELECT && (ekey+1)->flag&PEK_SELECT)
- totnewkey++;
- }
-
- if(totnewkey==0) return;
-
- pa->flag |= PARS_REKEY;
-
- nkey = new_keys = MEM_callocN((pa->totkey+totnewkey)*(sizeof(HairKey)),"Hair subdivide keys");
- nekey = new_ekeys = MEM_callocN((pa->totkey+totnewkey)*(sizeof(ParticleEditKey)),"Hair subdivide edit keys");
- endtime = pa->hair[pa->totkey-1].time;
-
- for(k=0, key=pa->hair, ekey=edit->keys[index]; k<pa->totkey-1; k++, key++, ekey++){
-
- memcpy(nkey,key,sizeof(HairKey));
- memcpy(nekey,ekey,sizeof(ParticleEditKey));
-
- nekey->co = nkey->co;
- nekey->time = &nkey->time;
-
- nkey++;
- nekey++;
-
- if(ekey->flag & PEK_SELECT && (ekey+1)->flag & PEK_SELECT){
- nkey->time= (key->time + (key+1)->time)*0.5f;
- state.time = (endtime != 0.0f)? nkey->time/endtime: 0.0f;
- psys_get_particle_on_path(data->ob, psys, index, &state, 0);
- VECCOPY(nkey->co, state.co);
-
- nekey->co= nkey->co;
- nekey->time= &nkey->time;
- nekey->flag |= PEK_SELECT;
-
- nekey++;
- nkey++;
- }
- }
- /*tip still not copied*/
- memcpy(nkey,key,sizeof(HairKey));
- memcpy(nekey,ekey,sizeof(ParticleEditKey));
-
- nekey->co = nkey->co;
- nekey->time = &nkey->time;
-
- if(pa->hair)
- MEM_freeN(pa->hair);
- pa->hair = new_keys;
-
- if(edit->keys[index])
- MEM_freeN(edit->keys[index]);
-
- edit->keys[index] = new_ekeys;
-
- pa->totkey += totnewkey;
- pa->flag |= PARS_EDIT_RECALC;
- pa->flag &= ~PARS_REKEY;
-}
-void PE_subdivide(void)
-{
- Object *ob = OBACT;
- ParticleSystem *psys = PE_get_current(ob);
- struct { Object *ob; } data;
-
- if(!PE_can_edit(psys)) return;
-
- data.ob= ob;
- PE_foreach_element(psys,subdivide_element,&data);
-
- psys->edit->totkeys = psys_count_keys(psys);
-
- recalc_lengths(psys);
- PE_recalc_world_cos(ob, psys);
-
- PE_update_object(ob, 1);
-
- BIF_undo_push("Subdivide hair(s)");
-}
-void PE_remove_doubles(void)
-{
- Object *ob=OBACT;
- ParticleSystem *psys=PE_get_current(ob);
- ParticleEditSettings *pset=PE_settings();
- ParticleData *pa;
- ParticleEdit *edit;
- ParticleSystemModifierData *psmd;
- KDTree *tree;
- KDTreeNearest nearest[10];
- float mat[4][4], co[3];
- int i, n, totn, removed, totpart, flag, totremoved;
-
- if(!PE_can_edit(psys)) return;
-
- edit= psys->edit;
- psmd= psys_get_modifier(ob, psys);
- totremoved= 0;
-
- do {
- removed= 0;
-
- totpart= psys->totpart;
- tree=BLI_kdtree_new(totpart);
-
- /* insert particles into kd tree */
- LOOP_PARTICLES(i,pa) {
- if(particle_is_selected(psys, pa)) {
- psys_mat_hair_to_object(ob, psmd->dm, psys->part->from, pa, mat);
- VECCOPY(co, pa->hair[0].co);
- Mat4MulVecfl(mat, co);
- BLI_kdtree_insert(tree, i, co, NULL);
- }
- }
-
- BLI_kdtree_balance(tree);
-
- /* tag particles to be removed */
- LOOP_PARTICLES(i,pa) {
- if(particle_is_selected(psys, pa)) {
- psys_mat_hair_to_object(ob, psmd->dm, psys->part->from, pa, mat);
- VECCOPY(co, pa->hair[0].co);
- Mat4MulVecfl(mat, co);
-
- totn= BLI_kdtree_find_n_nearest(tree,10,co,NULL,nearest);
-
- for(n=0; n<totn; n++) {
- /* this needs a custom threshold still */
- if(nearest[n].index > i && nearest[n].dist < 0.0002f) {
- if(!(pa->flag & PARS_TAG)) {
- pa->flag |= PARS_TAG;
- removed++;
- }
- }
- }
- }
- }
-
- BLI_kdtree_free(tree);
-
- /* remove tagged particles - don't do mirror here! */
- flag= pset->flag;
- pset->flag &= ~PE_X_MIRROR;
- remove_tagged_elements(ob, psys);
- pset->flag= flag;
- totremoved += removed;
- } while(removed);
-
- if(totremoved)
- notice("Removed: %d", totremoved);
-
- PE_recalc_world_cos(ob, psys);
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 1);
- BIF_undo_push("Remove double particles");
-}
-
-/************************************************/
-/* Edit Brushes */
-/************************************************/
-static void brush_comb(ParticleSystem *psys, float mat[][4], float imat[][4], int pa_index, int key_index, void *userData)
-{
- struct {Object *ob; short *mval; float rad; rcti* rect; float dist; float *dvec; float combfac;} *data = userData;
- ParticleData *pa= &psys->particles[pa_index];
- ParticleEditSettings *pset= PE_settings();
- HairKey *key = pa->hair + key_index;
- float cvec[3], fac;
-
- if(pset->flag & PE_LOCK_FIRST && key_index == 0) return;
-
- fac = (float)pow((double)(1.0f - data->dist / data->rad), (double)data->combfac);
-
- VECCOPY(cvec,data->dvec);
- Mat4Mul3Vecfl(imat,cvec);
- VecMulf(cvec, fac);
- VECADD(key->co, key->co, cvec);
-
- pa->flag |= PARS_EDIT_RECALC;
-}
-static void brush_cut(ParticleSystem *psys, int index, void *userData)
-{
- struct { short *mval; float rad; rcti* rect; int selected; float cutfac;} *data = userData;
- ParticleData *pa= &psys->particles[index];
- ParticleCacheKey *key = psys->pathcache[index];
- float rad2, cut_time = 1.0;
- float x0, x1, v0, v1, o0, o1, xo0, xo1, d, dv;
- int k, cut, keys = (int)pow(2.0, (double)psys->part->draw_step);
- short vertco[2];
-
- /* blunt scissors */
- if(BLI_frand() > data->cutfac) return;
-
- rad2 = data->rad * data->rad;
-
- cut=0;
-
- project_short(key->co, vertco);
- x0 = (float)vertco[0];
- x1 = (float)vertco[1];
-
- o0 = (float)data->mval[0];
- o1 = (float)data->mval[1];
-
- xo0 = x0 - o0;
- xo1 = x1 - o1;
-
- /* check if root is inside circle */
- if(xo0*xo0 + xo1*xo1 < rad2) {
- cut_time = -1.0f;
- cut = 1;
- }
- else {
- /* calculate path time closest to root that was inside the circle */
- for(k=1, key++; k<=keys; k++, key++){
- project_short(key->co, vertco);
-
- v0 = (float)vertco[0] - x0;
- v1 = (float)vertco[1] - x1;
-
- dv = v0*v0 + v1*v1;
-
- d = (v0*xo1 - v1*xo0);
-
- d = dv * rad2 - d*d;
-
- if(d > 0.0f) {
- d = sqrt(d);
-
- cut_time = -(v0*xo0 + v1*xo1 + d);
-
- if(cut_time > 0.0f) {
- cut_time /= dv;
-
- if(cut_time < 1.0f) {
- cut_time += (float)(k-1);
- cut_time /= (float)keys;
- cut = 1;
- break;
- }
- }
- }
-
- x0 = (float)vertco[0];
- x1 = (float)vertco[1];
-
- xo0 = x0 - o0;
- xo1 = x1 - o1;
- }
- }
-
- if(cut) {
- if(cut_time < 0.0f) {
- pa->flag |= PARS_TAG;
- }
- else {
- rekey_element_to_time(index, cut_time);
- pa->flag |= PARS_EDIT_RECALC;
- }
- }
-}
-static void brush_length(ParticleSystem *psys, int index, void *userData)
-{
- struct { short *mval; float rad; rcti* rect; float dist; float growfac; } *data = userData;
- ParticleData *pa = &psys->particles[index];
- HairKey *key;
- float dvec[3],pvec[3];
- int k;
-
- key = pa->hair;
- VECCOPY(pvec,key->co);
-
- for(k=1, key++; k<pa->totkey; k++,key++){
- VECSUB(dvec,key->co,pvec);
- VECCOPY(pvec,key->co);
- VecMulf(dvec,data->growfac);
- VECADD(key->co,(key-1)->co,dvec);
- }
-
- pa->flag |= PARS_EDIT_RECALC;
-}
-static void brush_puff(ParticleSystem *psys, int index, void *userData)
-{
- struct { short *mval; float rad; rcti* rect; float dist;
- Object *ob; DerivedMesh *dm; float pufffac; int invert; } *data = userData;
- ParticleData *pa = &psys->particles[index];
- ParticleEdit *edit = psys->edit;
- HairKey *key;
- float mat[4][4], imat[4][4];
- float lastco[3], rootco[3], co[3], nor[3], kco[3], dco[3], fac, length;
- int k;
-
- psys_mat_hair_to_global(data->ob, data->dm, psys->part->from, pa, mat);
- Mat4Invert(imat,mat);
-
- /* find root coordinate and normal on emitter */
- key = pa->hair;
- VECCOPY(co, key->co);
- Mat4MulVecfl(mat, co);
-
- index= BLI_kdtree_find_nearest(edit->emitter_field, co, NULL, NULL);
- if(index == -1) return;
-
- VECCOPY(rootco, co);
- VecCopyf(nor, &psys->edit->emitter_cosnos[index*6+3]);
- Normalize(nor);
- length= 0.0f;
-
- fac= (float)pow((double)(1.0f - data->dist / data->rad), (double)data->pufffac);
- fac *= 0.025f;
- if(data->invert)
- fac= -fac;
-
- for(k=1, key++; k<pa->totkey; k++, key++){
- /* compute position as if hair was standing up straight */
- VECCOPY(lastco, co);
- VECCOPY(co, key->co);
- Mat4MulVecfl(mat, co);
- length += VecLenf(lastco, co);
-
- VECADDFAC(kco, rootco, nor, length);
-
- /* blend between the current and straight position */
- VECSUB(dco, kco, co);
- VECADDFAC(co, co, dco, fac);
-
- VECCOPY(key->co, co);
- Mat4MulVecfl(imat, key->co);
- }
-
- pa->flag |= PARS_EDIT_RECALC;
-}
-static void brush_smooth_get(ParticleSystem *psys, float mat[][4], float imat[][4], int pa_index, int key_index, void *userData)
-{
- struct { Object *ob; short *mval; float rad; rcti* rect; float dist; float vec[3]; int tot; float smoothfac;} *data = userData;
- ParticleData *pa= &psys->particles[pa_index];
- HairKey *key = pa->hair + key_index;
-
- if(key_index){
- float dvec[3];
-
- VecSubf(dvec,key->co,(key-1)->co);
- Mat4Mul3Vecfl(mat,dvec);
- VECADD(data->vec,data->vec,dvec);
- data->tot++;
- }
-}
-static void brush_smooth_do(ParticleSystem *psys, float mat[][4], float imat[][4], int pa_index, int key_index, void *userData)
-{
- struct { Object *ob; short *mval; float rad; rcti* rect; float dist; float vec[3]; int tot; float smoothfac;} *data = userData;
- ParticleData *pa= &psys->particles[pa_index];
- HairKey *key = pa->hair + key_index;
- float vec[3], dvec[3];
-
- if(key_index){
- VECCOPY(vec,data->vec);
- Mat4Mul3Vecfl(imat,vec);
-
- VecSubf(dvec,key->co,(key-1)->co);
-
- VECSUB(dvec,vec,dvec);
- VecMulf(dvec,data->smoothfac);
-
- VECADD(key->co,key->co,dvec);
- }
-
- pa->flag |= PARS_EDIT_RECALC;
-}
-#define EXPERIMENTAL_DEFORM_ONLY_PAINTING 1
-static void brush_add(Object *ob, ParticleSystem *psys, short *mval, short number)
-{
- ParticleData *add_pars = MEM_callocN(number*sizeof(ParticleData),"ParticleData add");
- ParticleSystemModifierData *psmd = psys_get_modifier(ob,psys);
- ParticleEditSettings *pset= PE_settings();
- ParticleEdit *edit = psys->edit;
- int i, k, n = 0, totpart = psys->totpart;
- short dmx = 0, dmy = 0;
- short mx = mval[0] - curarea->winx / 2, my = mval[1] - curarea->winy / 2;
- float co1[3], co2[3], vec[4], min_d, imat[4][4];
- float framestep, timestep = psys_get_timestep(psys->part);
- short size = pset->brush[PE_BRUSH_ADD].size;
- short size2 = size*size;
-#if EXPERIMENTAL_DEFORM_ONLY_PAINTING
- DerivedMesh *dm=0;
-#endif
- Mat4Invert(imat,ob->obmat);
-
- BLI_srandom(psys->seed+mval[0]+mval[1]);
-
- /* painting onto the deformed mesh, could be an option? */
-#if EXPERIMENTAL_DEFORM_ONLY_PAINTING
- if (psmd->dm->deformedOnly)
- dm = psmd->dm;
- else
- dm = mesh_get_derived_deform(ob, CD_MASK_BAREMESH);
-#endif
- for(i=0; i<number; i++){
- if(number>1){
- dmx=dmy=size;
- while(dmx*dmx+dmy*dmy>size2){
- dmx=(short)((2.0f*BLI_frand()-1.0f)*size);
- dmy=(short)((2.0f*BLI_frand()-1.0f)*size);
- }
- }
-
- /* create intersection coordinates in view Z direction at mouse coordinates */
- /* Thanks to who ever wrote the "Mouse Location 3D Space" tutorial in "Blender 3D: Blending Into Python/Cookbook". */
- if(G.vd->persp){
- vec[0]= (2.0f*(mx+dmx)/curarea->winx);
- vec[1]= (2.0f*(my+dmy)/curarea->winy);
- vec[2]= -1.0f;
- vec[3]= 1.0f;
-
- Mat4MulVec4fl(G.vd->persinv, vec);
- VecMulf(vec, 1.0f/vec[3]);
-
- VECCOPY(co1, G.vd->viewinv[3]);
- VECSUB(vec, vec, co1);
- Normalize(vec);
-
- VECADDFAC(co1, G.vd->viewinv[3], vec, G.vd->near);
- VECADDFAC(co2, G.vd->viewinv[3], vec, G.vd->far);
- }
- else {
- vec[0] = 2.0f*(mx+dmx)/curarea->winx;
- vec[1] = 2.0f*(my+dmy)/curarea->winy;
- vec[2] = 0.0f;
- vec[3] = 1.0f;
-
- Mat4MulVec4fl(G.vd->persinv,vec);
-
- VECADDFAC(co1,vec,G.vd->viewinv[2],1000.0f);
- VECADDFAC(co2,vec,G.vd->viewinv[2],-1000.0f);
- }
-
- Mat4MulVecfl(imat,co1);
- Mat4MulVecfl(imat,co2);
- min_d=2.0;
-
- /* warning, returns the derived mesh face */
-#if EXPERIMENTAL_DEFORM_ONLY_PAINTING
- if(psys_intersect_dm(ob,dm,0,co1,co2,&min_d,&add_pars[n].num,add_pars[n].fuv,0,0,0,0)) {
- add_pars[n].num_dmcache= psys_particle_dm_face_lookup(ob,psmd->dm,add_pars[n].num,add_pars[n].fuv,NULL);
- n++;
- }
-#else
-#if 0
- if (psmd->dm->deformedOnly) {
- if(psys_intersect_dm(ob,psmd->dm,0,co1,co2,&min_d,&add_pars[n].num,add_pars[n].fuv,0,0,0,0)){
- n++;
- }
- } else {
- /* we need to test against the cage mesh, because 1) its faster and 2) then we can avoid converting the fuv back which is not simple */
- if(psys_intersect_dm(ob,psmd->dm,0,co1,co2,&min_d,&add_pars[n].num,add_pars[n].fuv,0,0,0,0)){
- MFace *mface;
- float fuv_mod[3] = {0.0, 0.0, 0.0};
- OrigSpaceFace *osface;
-
- mface= psmd->dm->getFaceData(psmd->dm,add_pars[n].num,CD_MFACE);
- osface= psmd->dm->getFaceData(psmd->dm, add_pars[n].num, CD_ORIGSPACE);
-
- add_pars[n].fuv[2]=0.0;
-
- /* use the original index for num and the derived index for num_dmcache */
- add_pars[n].num_dmcache = add_pars[n].num;
- add_pars[n].num = *(int *)psmd->dm->getFaceData(psmd->dm, add_pars[n].num, CD_ORIGINDEX);
-
- /* This is totally unaceptable code (fakeing mesh dara) but changing the target function isnt really nice either, do this temporarily */
- if (1) { /* Evilness*/
- MFace mface_fake;
- MVert mvert_fake[4];
- //int test1,test2;
- //test1 = add_pars[n].num_dmcache;
- //test2 = add_pars[n].num;
-
- mvert_fake[0].co[2] = mvert_fake[1].co[2] = mvert_fake[2].co[2] = mvert_fake[3].co[2] = 0.0;
-
- mface_fake.v1 = 0;
- mface_fake.v2 = 1;
- mface_fake.v3 = 2;
-
- if (mface->v4) {
- mface_fake.v4 = 3;
- } else {
- mface_fake.v4 = 0;
- }
-
- Vec2Copyf(mvert_fake[0].co, osface->uv[0]);
- Vec2Copyf(mvert_fake[1].co, osface->uv[1]);
- Vec2Copyf(mvert_fake[2].co, osface->uv[2]);
- Vec2Copyf(mvert_fake[3].co, osface->uv[3]);
- //printf("before %f %f %i %i\n", add_pars[n].fuv[0], add_pars[n].fuv[1], test1, test2);
- psys_interpolate_face(&mvert_fake, &mface_fake, NULL, &add_pars[n].fuv, &fuv_mod, NULL, NULL, NULL);
-
- /* Apply as the UV */
- Vec2Copyf(add_pars[n].fuv, fuv_mod);
- //printf("after %f %f\n", add_pars[n].fuv[0], add_pars[n].fuv[1]);
- }
- /* Make a fake face, for calculating the derived face's fuv on the original face */
- //PointInFace2DUV(mface->v4, osface->uv[0], osface->uv[1], osface->uv[2], osface->uv[3], add_pars[n].fuv, fuv_mod);
- //Vec2Copyf(add_pars[n].fuv, fuv_mod);
-
- n++;
- }
- }
-#endif
-#endif
- }
- if(n){
- int newtotpart=totpart+n;
- float hairmat[4][4], cur_co[3];
- KDTree *tree=0;
- ParticleData *pa, *new_pars = MEM_callocN(newtotpart*sizeof(ParticleData),"ParticleData new");
- ParticleEditKey *ekey, **key, **new_keys = MEM_callocN(newtotpart*sizeof(ParticleEditKey *),"ParticleEditKey array new");
- HairKey *hkey;
-
- /* save existing elements */
- memcpy(new_pars, psys->particles, totpart * sizeof(ParticleData));
- memcpy(new_keys, edit->keys, totpart * sizeof(ParticleEditKey*));
-
- /* change old arrays to new ones */
- if(psys->particles) MEM_freeN(psys->particles);
- psys->particles = new_pars;
-
- if(edit->keys) MEM_freeN(edit->keys);
- edit->keys = new_keys;
-
- if(edit->mirror_cache) {
- MEM_freeN(edit->mirror_cache);
- edit->mirror_cache = NULL;
- }
-
- /* create tree for interpolation */
- if(pset->flag & PE_INTERPOLATE_ADDED && psys->totpart){
- tree=BLI_kdtree_new(psys->totpart);
-
- for(i=0, pa=psys->particles; i<totpart; i++, pa++) {
- psys_particle_on_dm(ob,psmd->dm,psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,cur_co,0,0,0,0,0);
- BLI_kdtree_insert(tree, i, cur_co, NULL);
- }
-
- BLI_kdtree_balance(tree);
- }
-
- psys->totpart = newtotpart;
-
- /* create new elements */
- pa = psys->particles + totpart;
- key = edit->keys + totpart;
-
- for(i=totpart; i<newtotpart; i++, pa++, key++){
- memcpy(pa, add_pars + i - totpart, sizeof(ParticleData));
- pa->hair = MEM_callocN(pset->totaddkey * sizeof(HairKey), "BakeKey key add");
- ekey = *key = MEM_callocN(pset->totaddkey * sizeof(ParticleEditKey), "ParticleEditKey add");
- pa->totkey = pset->totaddkey;
-
- for(k=0, hkey=pa->hair; k<pa->totkey; k++, hkey++, ekey++) {
- ekey->co = hkey->co;
- ekey->time = &hkey->time;
- }
-
- initialize_particle(pa,i,ob,psys,psmd);
- reset_particle(pa,psys,psmd,ob,0.0,1.0,0,0,0);
- pa->flag |= PARS_EDIT_RECALC;
- if(pset->flag & PE_X_MIRROR)
- pa->flag |= PARS_TAG; /* signal for duplicate */
-
- framestep = pa->lifetime/(float)(pset->totaddkey-1);
-
- if(tree){
- HairKey *hkey;
- ParticleKey key[3];
- KDTreeNearest ptn[3];
- int w, maxw;
- float maxd, mind, dd, totw=0.0, weight[3];
-
- psys_particle_on_dm(ob,psmd->dm,psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co1,0,0,0,0,0);
- maxw = BLI_kdtree_find_n_nearest(tree,3,co1,NULL,ptn);
-
- maxd = ptn[maxw-1].dist;
- mind = ptn[0].dist;
- dd = maxd - mind;
-
- for(w=0; w<maxw; w++){
- weight[w] = (float)pow(2.0, (double)(-6.0f * ptn[w].dist / maxd));
- totw += weight[w];
- }
- for(;w<3; w++){
- weight[w] = 0.0f;
- }
-
- for(w=0; w<maxw; w++)
- weight[w] /= totw;
-
- for(k=0; k<pset->totaddkey; k++) {
- hkey = pa->hair + k;
- hkey->time = pa->time + k * framestep;
-
- key[0].time = hkey->time/ 100.0f;
- psys_get_particle_on_path(ob, psys, ptn[0].index, key, 0);
- VecMulf(key[0].co, weight[0]);
-
- if(maxw>1) {
- key[1].time = key[0].time;
- psys_get_particle_on_path(ob, psys, ptn[1].index, key + 1, 0);
- VecMulf(key[1].co, weight[1]);
- VECADD(key[0].co, key[0].co, key[1].co);
-
- if(maxw>2) {
- key[2].time = key[0].time;
- psys_get_particle_on_path(ob, psys, ptn[2].index, key + 2, 0);
- VecMulf(key[2].co, weight[2]);
- VECADD(key[0].co, key[0].co, key[2].co);
- }
- }
-
- if(k==0)
- VECSUB(co1, pa->state.co, key[0].co);
-
- VECADD(pa->hair[k].co, key[0].co, co1);
-
- pa->hair[k].time = key[0].time;
- }
- }
- else{
- for(k=0, hkey=pa->hair; k<pset->totaddkey; k++, hkey++) {
- VECADDFAC(hkey->co, pa->state.co, pa->state.vel, k * framestep * timestep);
- pa->hair[k].time += k * framestep;
- }
- }
- for(k=0, hkey=pa->hair; k<pset->totaddkey; k++, hkey++) {
- psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, pa, hairmat);
- Mat4Invert(imat,hairmat);
- Mat4MulVecfl(imat, hkey->co);
- }
- }
- edit->totkeys = psys_count_keys(psys);
-
- if(tree)
- BLI_kdtree_free(tree);
- }
- if(add_pars)
- MEM_freeN(add_pars);
-
-/* painting onto the deformed mesh, could be an option? */
-#if EXPERIMENTAL_DEFORM_ONLY_PAINTING
- if (!psmd->dm->deformedOnly)
- dm->release(dm);
-#endif
-}
-static void brush_weight(ParticleSystem *psys, float mat[][4], float imat[][4], int pa_index, int key_index, void *userData)
-{
- struct { Object *ob; short *mval; float rad; rcti* rect; float dist; float weightfac;} *data = userData;
- ParticleData *pa;
-
- /* roots have full weight allways */
- if(key_index) {
- pa= &psys->particles[pa_index];
- pa->hair[key_index].weight = data->weightfac;
- pa->flag |= PARS_EDIT_RECALC;
- }
-}
-
-/* returns 0 if no brush was used */
-int PE_brush_particles(void)
-{
- Object *ob = OBACT;
- ParticleSystem *psys = PE_get_current(ob);
- ParticleEdit *edit;
- ParticleEditSettings *pset = PE_settings();
- ParticleSystemModifierData *psmd;
- ParticleBrushData *brush;
- float vec1[3], vec2[3];
- short mval[2], mvalo[2], firsttime = 1, dx, dy;
- int selected = 0, flip, removed = 0;
-
- if(!PE_can_edit(psys)) return 0;
-
- edit = psys->edit;
- psmd= psys_get_modifier(ob, psys);
-
- flip= (get_qual() == LR_SHIFTKEY);
-
- if(pset->brushtype<0) return 0;
- brush= &pset->brush[pset->brushtype];
-
- initgrabz(ob->obmat[3][0], ob->obmat[3][1], ob->obmat[3][2]);
-
- getmouseco_areawin(mvalo);
-
- mval[0] = mvalo[0]; mval[1] = mvalo[1];
-
- while(get_mbut() & L_MOUSE){
- bglFlush();
- glReadBuffer(GL_BACK);
- glDrawBuffer(GL_BACK);
- persp(PERSP_VIEW);
-
- dx=mval[0]-mvalo[0];
- dy=mval[1]-mvalo[1];
- if(((pset->brushtype == PE_BRUSH_ADD) ?
- (sqrt(dx * dx + dy * dy) > pset->brush[PE_BRUSH_ADD].step) : (dx != 0 || dy != 0))
- || firsttime){
- firsttime = 0;
-
- selected = (short)count_selected_keys(psys);
-
- switch(pset->brushtype){
- case PE_BRUSH_COMB:
- {
- struct { Object *ob; short *mval; float rad; rcti* rect; float dist; float *dvec; float combfac;} data;
-
- data.ob = ob;
- data.mval = mval;
- data.rad = (float)brush->size;
-
- data.combfac = (float)(brush->strength - 50) / 50.0f;
- if(data.combfac < 0.0f)
- data.combfac = 1.0f - 9.0f * data.combfac;
- else
- data.combfac = 1.0f - data.combfac;
-
- Mat4Invert(ob->imat, ob->obmat);
-
- window_to_3d(vec1, mvalo[0], mvalo[1]);
- window_to_3d(vec2, mval[0], mval[1]);
- VECSUB(vec1, vec2, vec1);
- data.dvec = vec1;
-
- foreach_mouse_hit_key(selected, psys,brush_comb, &data);
- break;
- }
- case PE_BRUSH_CUT:
- {
- struct { short *mval; float rad; rcti* rect; int selected; float cutfac;} data;
-
- data.mval = mval;
- data.rad = (float)brush->size;
-
- data.selected = selected;
-
- data.cutfac = (float)(brush->strength / 100.0f);
-
- if(selected)
- foreach_selected_element(psys, brush_cut, &data);
- else
- PE_foreach_element(psys, brush_cut, &data);
-
- removed= remove_tagged_elements(ob, psys);
- if(pset->flag & PE_KEEP_LENGTHS)
- recalc_lengths(psys);
- break;
- }
- case PE_BRUSH_LENGTH:
- {
- struct { short *mval; float rad; rcti* rect; float dist; float growfac; } data;
-
- data.mval = mval;
-
- data.rad = (float)brush->size;
- data.growfac = (float)brush->strength / 5000.0f;
-
- if(brush->invert ^ flip)
- data.growfac = 1.0f - data.growfac;
- else
- data.growfac = 1.0f + data.growfac;
-
- foreach_mouse_hit_element(selected, psys, brush_length, &data);
-
- if(pset->flag & PE_KEEP_LENGTHS)
- recalc_lengths(psys);
- break;
- }
- case PE_BRUSH_PUFF:
- {
- struct { short *mval; float rad; rcti* rect; float dist;
- Object *ob; DerivedMesh *dm; float pufffac; int invert; } data;
-
- data.ob = ob;
- data.dm = psmd->dm;
- data.mval = mval;
- data.rad = (float)brush->size;
-
- data.pufffac = (float)(brush->strength - 50) / 50.0f;
- if(data.pufffac < 0.0f)
- data.pufffac = 1.0f - 9.0f * data.pufffac;
- else
- data.pufffac = 1.0f - data.pufffac;
-
- data.invert= (brush->invert ^ flip);
- Mat4Invert(ob->imat, ob->obmat);
-
- foreach_mouse_hit_element(selected, psys, brush_puff, &data);
- break;
- }
- case PE_BRUSH_ADD:
- if(psys->part->from==PART_FROM_FACE){
- brush_add(ob, psys, mval, brush->strength);
- if(pset->flag & PE_KEEP_LENGTHS)
- recalc_lengths(psys);
- }
- break;
- case PE_BRUSH_WEIGHT:
- {
- struct { Object *ob; short *mval; float rad; rcti* rect; float dist; float weightfac;} data;
-
- data.ob = ob;
- data.mval = mval;
- data.rad = (float)brush->size;
-
- data.weightfac = (float)(brush->strength / 100.0f);
-
- foreach_mouse_hit_key(selected, psys, brush_weight, &data);
- break;
- }
- case PE_BRUSH_SMOOTH:
- {
- struct { Object *ob; short *mval; float rad; rcti* rect; float dist; float vec[3]; int tot; float smoothfac;} data;
-
- data.ob = ob;
- data.mval = mval;
- data.rad = (float)brush->size;
-
- data.vec[0] = data.vec[1] = data.vec[2] = 0.0f;
- data.tot = 0;
-
- data.smoothfac = (float)(brush->strength / 100.0f);
-
- Mat4Invert(ob->imat, ob->obmat);
-
- foreach_mouse_hit_key(selected, psys, brush_smooth_get, &data);
-
- if(data.tot){
- VecMulf(data.vec, 1.0f / (float)data.tot);
- foreach_mouse_hit_key(selected, psys, brush_smooth_do, &data);
- }
-
- break;
- }
- }
- if((pset->flag & PE_KEEP_LENGTHS)==0)
- recalc_lengths(psys);
-
- if(pset->brushtype == PE_BRUSH_ADD || removed) {
- if(pset->brushtype == PE_BRUSH_ADD && (pset->flag & PE_X_MIRROR))
- PE_mirror_x(1);
- PE_recalc_world_cos(ob,psys);
- psys_free_path_cache(psys);
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- }
- else
- PE_update_object(ob, 1);
-
- mvalo[0] = mval[0];
- mvalo[1] = mval[1];
- }
-
- force_draw(0);
-
- PIL_sleep_ms(10);
-
- getmouseco_areawin(mval);
- }
- allqueue(REDRAWVIEW3D, 1);
-
- BIF_undo_push("Brush edit particles");
-
- return 1;
-}
-static void set_delete_particle(ParticleSystem *psys, int index, void *userData)
-{
- psys->particles[index].flag |= PARS_TAG;
-}
-static void set_delete_particle_key(ParticleSystem *psys, int pa_index, int key_index, void *userData)
-{
- psys->edit->keys[pa_index][key_index].flag |= PEK_TAG;
-}
-void PE_delete_particle(void)
-{
- Object *ob=OBACT;
- ParticleSystem *psys = PE_get_current(ob);
- short event=0;
-
- if(!PE_can_edit(psys)) return;
-
- event= pupmenu("Erase %t|Particle%x2|Key%x1");
-
- if(event<1) return;
-
- if(event==1){
- foreach_selected_key(psys, set_delete_particle_key, 0);
- remove_tagged_keys(ob, psys);
- recalc_lengths(psys);
- }
- else if(event==2){
- foreach_selected_element(psys, set_delete_particle, 0);
- remove_tagged_elements(ob, psys);
- recalc_lengths(psys);
- }
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 1);
- BIF_undo_push("Delete particles/keys");
-}
-
-void PE_mirror_x(int tagged)
-{
- Object *ob=OBACT;
- Mesh *me= (Mesh*)(ob->data);
- ParticleSystemModifierData *psmd;
- ParticleSystem *psys = PE_get_current(ob);
- ParticleEdit *edit;
- ParticleData *pa, *newpa, *new_pars;
- ParticleEditKey *ekey, **newkey, **key, **new_keys;
- HairKey *hkey;
- int *mirrorfaces;
- int i, k, rotation, totpart, newtotpart;
-
- if(!PE_can_edit(psys)) return;
-
- edit= psys->edit;
- psmd= psys_get_modifier(ob, psys);
-
- mirrorfaces= mesh_get_x_mirror_faces(ob);
-
- if(!edit->mirror_cache)
- PE_update_mirror_cache(ob, psys);
-
- totpart= psys->totpart;
- newtotpart= psys->totpart;
- LOOP_PARTICLES(i,pa) {
- if(pa->flag&PARS_HIDE) continue;
-
- if(!tagged) {
- if(particle_is_selected(psys, pa)) {
- if(edit->mirror_cache[i] != -1) {
- /* already has a mirror, don't need to duplicate */
- PE_mirror_particle(ob, psmd->dm, psys, pa, NULL);
- continue;
- }
- else
- pa->flag |= PARS_TAG;
- }
- }
-
- if((pa->flag & PARS_TAG) && mirrorfaces[pa->num*2] != -1)
- newtotpart++;
- }
-
- if(newtotpart != psys->totpart) {
- /* allocate new arrays and copy existing */
- new_pars= MEM_callocN(newtotpart*sizeof(ParticleData), "ParticleData new");
- new_keys= MEM_callocN(newtotpart*sizeof(ParticleEditKey*), "ParticleEditKey new");
-
- memcpy(new_pars, psys->particles, totpart*sizeof(ParticleData));
- memcpy(new_keys, edit->keys, totpart*sizeof(ParticleEditKey*));
-
- if(psys->particles) MEM_freeN(psys->particles);
- psys->particles= new_pars;
-
- if(edit->keys) MEM_freeN(edit->keys);
- edit->keys= new_keys;
-
- if(edit->mirror_cache) {
- MEM_freeN(edit->mirror_cache);
- edit->mirror_cache= NULL;
- }
-
- psys->totpart= newtotpart;
-
- /* create new elements */
- pa= psys->particles;
- newpa= psys->particles + totpart;
- key= edit->keys;
- newkey= edit->keys + totpart;
-
- for(i=0; i<totpart; i++, pa++, key++) {
- if(pa->flag&PARS_HIDE) continue;
-
- if(!(pa->flag & PARS_TAG) || mirrorfaces[pa->num*2] == -1)
- continue;
-
- /* duplicate */
- *newpa= *pa;
- if(pa->hair) newpa->hair= MEM_dupallocN(pa->hair);
- if(pa->keys) newpa->keys= MEM_dupallocN(pa->keys);
- if(*key) *newkey= MEM_dupallocN(*key);
-
- /* rotate weights according to vertex index rotation */
- rotation= mirrorfaces[pa->num*2+1];
- newpa->fuv[0]= pa->fuv[2];
- newpa->fuv[1]= pa->fuv[1];
- newpa->fuv[2]= pa->fuv[0];
- newpa->fuv[3]= pa->fuv[3];
- while(rotation-- > 0)
- if(me->mface[pa->num].v4)
- SHIFT4(float, newpa->fuv[0], newpa->fuv[1], newpa->fuv[2], newpa->fuv[3])
- else
- SHIFT3(float, newpa->fuv[0], newpa->fuv[1], newpa->fuv[2])
-
- /* assign face inddex */
- newpa->num= mirrorfaces[pa->num*2];
- newpa->num_dmcache= psys_particle_dm_face_lookup(ob,psmd->dm,newpa->num,newpa->fuv, NULL);
-
- /* update edit key pointers */
- ekey= *newkey;
- for(k=0, hkey=newpa->hair; k<newpa->totkey; k++, hkey++, ekey++) {
- ekey->co= hkey->co;
- ekey->time= &hkey->time;
- }
-
- /* map key positions as mirror over x axis */
- PE_mirror_particle(ob, psmd->dm, psys, pa, newpa);
-
- newpa++;
- newkey++;
- }
-
- edit->totkeys = psys_count_keys(psys);
- }
-
- for(pa=psys->particles, i=0; i<psys->totpart; i++, pa++)
- pa->flag &= ~PARS_TAG;
-
- MEM_freeN(mirrorfaces);
-
- if(!tagged) {
- PE_recalc_world_cos(ob,psys);
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 1);
- BIF_undo_push("Mirror particles");
- }
-}
-
-void PE_selectbrush_menu(void)
-{
- ParticleEditSettings *pset= PE_settings();
- int val;
-
- pupmenu_set_active(pset->brushtype);
-
- val= pupmenu("Select Brush%t|None %x0|Comb %x1|Smooth %x7|Weight %x6|Add %x5|Length %x3|Puff %x4|Cut %x2");
-
- if(val>=0) {
- pset->brushtype= val-1;
- allqueue(REDRAWVIEW3D, 1);
- }
-}
-
-/************************************************/
-/* Particle Edit Undo */
-/************************************************/
-static void free_ParticleUndo(ParticleUndo *undo)
-{
- ParticleData *pa;
- int i;
-
- for(i=0, pa=undo->particles; i<undo->totpart; i++, pa++) {
- if(pa->hair)
- MEM_freeN(pa->hair);
- if(undo->keys[i])
- MEM_freeN(undo->keys[i]);
- }
- if(undo->keys)
- MEM_freeN(undo->keys);
-
- if(undo->particles)
- MEM_freeN(undo->particles);
-
- //if(undo->emitter_cosnos)
- // MEM_freeN(undo->emitter_cosnos);
-}
-static void make_ParticleUndo(ParticleSystem *psys, ParticleUndo *undo)
-{
- ParticleData *pa,*upa;
- int i;
-
- undo->totpart = psys->totpart;
- undo->totkeys = psys->edit->totkeys;
-
- upa = undo->particles = MEM_dupallocN(psys->particles);
- undo->keys = MEM_dupallocN(psys->edit->keys);
-
- for(i=0, pa=psys->particles; i<undo->totpart; i++, pa++, upa++) {
- upa->hair = MEM_dupallocN(pa->hair);
- undo->keys[i] = MEM_dupallocN(psys->edit->keys[i]);
- /* no need to update edit key->co & key->time pointers here */
- }
-}
-static void get_ParticleUndo(ParticleSystem *psys, ParticleUndo *undo)
-{
- ParticleData *pa, *upa;
- ParticleEditKey *key;
- HairKey *hkey;
- int i, k, totpart = psys->totpart;
-
- LOOP_PARTICLES(i,pa) {
- if(pa->hair)
- MEM_freeN(pa->hair);
-
- if(psys->edit->keys[i])
- MEM_freeN(psys->edit->keys[i]);
- }
- if(psys->particles)
- MEM_freeN(psys->particles);
- if(psys->edit->keys)
- MEM_freeN(psys->edit->keys);
- if(psys->edit->mirror_cache) {
- MEM_freeN(psys->edit->mirror_cache);
- psys->edit->mirror_cache= NULL;
- }
-
- pa = psys->particles = MEM_dupallocN(undo->particles);
- psys->edit->keys = MEM_dupallocN(undo->keys);
-
- for(i=0,upa=undo->particles; i<undo->totpart; i++, upa++, pa++){
- hkey = pa->hair = MEM_dupallocN(upa->hair);
- key = psys->edit->keys[i] = MEM_dupallocN(undo->keys[i]);
- for(k=0; k<pa->totkey; k++, hkey++, key++) {
- key->co = hkey->co;
- key->time = &hkey->time;
- }
- }
-
- psys->totpart = undo->totpart;
- psys->edit->totkeys = undo->totkeys;
-}
-void PE_undo_push(char *str)
-{
- ParticleSystem *psys = PE_get_current(OBACT);
- ParticleEdit *edit = 0;
- ParticleUndo *undo;
- int nr;
-
- if(!PE_can_edit(psys)) return;
- edit = psys->edit;
-
- /* remove all undos after (also when curundo==NULL) */
- while(edit->undo.last != edit->curundo) {
- undo= edit->undo.last;
- BLI_remlink(&edit->undo, undo);
- free_ParticleUndo(undo);
- MEM_freeN(undo);
- }
-
- /* make new */
- edit->curundo= undo= MEM_callocN(sizeof(ParticleUndo), "particle undo file");
- strncpy(undo->name, str, 64-1);
- BLI_addtail(&edit->undo, undo);
-
- /* and limit amount to the maximum */
- nr= 0;
- undo= edit->undo.last;
- while(undo) {
- nr++;
- if(nr==U.undosteps) break;
- undo= undo->prev;
- }
- if(undo) {
- while(edit->undo.first!=undo) {
- ParticleUndo *first= edit->undo.first;
- BLI_remlink(&edit->undo, first);
- free_ParticleUndo(first);
- MEM_freeN(first);
- }
- }
-
- /* copy */
- make_ParticleUndo(psys,edit->curundo);
-}
-void PE_undo_step(int step)
-{
- ParticleSystem *psys = PE_get_current(OBACT);
- ParticleEdit *edit = 0;
-
- if(!PE_can_edit(psys)) return;
- edit=psys->edit;
-
- if(step==0) {
- get_ParticleUndo(psys,edit->curundo);
- }
- else if(step==1) {
-
- if(edit->curundo==NULL || edit->curundo->prev==NULL) error("No more steps to undo");
- else {
- if(G.f & G_DEBUG) printf("undo %s\n", edit->curundo->name);
- edit->curundo= edit->curundo->prev;
- get_ParticleUndo(psys, edit->curundo);
- }
- }
- else {
- /* curundo has to remain current situation! */
-
- if(edit->curundo==NULL || edit->curundo->next==NULL) error("No more steps to redo");
- else {
- get_ParticleUndo(psys, edit->curundo->next);
- edit->curundo= edit->curundo->next;
- if(G.f & G_DEBUG) printf("redo %s\n", edit->curundo->name);
- }
- }
-
- DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 1);
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWIMAGE, 0);
-}
-static void ParticleUndo_number(ParticleEdit *edit, int nr)
-{
- ParticleUndo *undo;
- int a=1;
-
- for(undo= edit->undo.first; undo; undo= undo->next, a++) {
- if(a==nr) break;
- }
- edit->curundo= undo;
- PE_undo_step(0);
-}
-static void ParticleUndo_clear(ParticleSystem *psys)
-{
- ParticleUndo *undo;
- ParticleEdit *edit;
-
- if(psys==0) return;
-
- edit = psys->edit;
-
- if(edit==0) return;
-
- undo= edit->undo.first;
- while(undo) {
- free_ParticleUndo(undo);
- undo= undo->next;
- }
- BLI_freelistN(&edit->undo);
- edit->curundo= NULL;
-}
-void PE_undo(void)
-{
- PE_undo_step(1);
-}
-void PE_redo(void)
-{
- PE_undo_step(-1);
-}
-void PE_undo_menu(void)
-{
- ParticleSystem *psys = PE_get_current(OBACT);
- ParticleEdit *edit = 0;
- ParticleUndo *undo;
- DynStr *ds;
- short event;
- char *menu;
-
- if(!PE_can_edit(psys)) return;
- edit = psys->edit;
-
- ds= BLI_dynstr_new();
-
- BLI_dynstr_append(ds, "Particlemode Undo History %t");
-
- for(undo= edit->undo.first; undo; undo= undo->next) {
- BLI_dynstr_append(ds, "|");
- BLI_dynstr_append(ds, undo->name);
- }
-
- menu= BLI_dynstr_get_cstring(ds);
- BLI_dynstr_free(ds);
-
- event= pupmenu_col(menu, 20);
- MEM_freeN(menu);
-
- if(event>0) ParticleUndo_number(edit,event);
-}
-
-void PE_get_colors(char sel[4], char nosel[4])
-{
- BIF_GetThemeColor3ubv(TH_EDGE_SELECT, sel);
- BIF_GetThemeColor3ubv(TH_WIRE, nosel);
-}
-
-int PE_minmax(float *min, float *max)
-{
- Object *ob = OBACT;
- ParticleSystem *psys = PE_get_current(ob);
- ParticleSystemModifierData *psmd;
- ParticleData *pa;
- ParticleEditKey *key;
- float co[3], mat[4][4];
- int i, k, totpart, ok = 0;
-
- if(!PE_can_edit(psys)) return ok;
-
- psmd= psys_get_modifier(ob, psys);
- totpart= psys->totpart;
-
- LOOP_PARTICLES(i,pa){
- if(pa->flag&PARS_HIDE) continue;
-
- psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, pa, mat);
-
- LOOP_KEYS(k,key){
- if(key->flag&PEK_SELECT) {
- VECCOPY(co, key->co);
- Mat4MulVecfl(mat, co);
- DO_MINMAX(co, min, max);
- ok= 1;
- }
- }
- }
-
- if(!ok) {
- minmax_object(ob, min, max);
- ok= 1;
- }
-
- return ok;
-}
-
diff --git a/source/blender/src/editscreen.c b/source/blender/src/editscreen.c
deleted file mode 100644
index 35c0692510d..00000000000
--- a/source/blender/src/editscreen.c
+++ /dev/null
@@ -1,3818 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * All screen functions that are related to the interface
- * handling and drawing. Might be split up as well later...
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "nla.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h> /* isprint */
-#include <stdio.h>
-#include <math.h>
-
-#include "GHOST_Types.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "PIL_time.h"
-
-#include "BMF_Api.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "IMB_imbuf_types.h"
-#include "IMB_imbuf.h"
-
-#include "DNA_action_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_sound_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_userdef_types.h"
-
-#include "BLO_writefile.h"
-
-#include "BKE_utildefines.h"
-#include "BKE_global.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
-#include "BKE_blender.h"
-#include "BKE_screen.h"
-
-#ifdef WITH_VERSE
-#include "BKE_verse.h"
-#endif
-
-#include "BIF_cursors.h"
-#include "BIF_drawscene.h"
-#include "BIF_editsound.h"
-#include "BIF_glutil.h"
-#include "BIF_gl.h"
-#include "BIF_graphics.h"
-#include "BIF_interface.h"
-#include "BIF_interface_icons.h"
-#include "BIF_mainqueue.h"
-#include "BIF_mywindow.h"
-#include "BIF_previewrender.h"
-#include "BIF_renderwin.h"
-#include "BIF_retopo.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toets.h"
-#include "BIF_toolbox.h"
-#include "BIF_usiblender.h"
-#include "BIF_keyval.h"
-#include "BIF_resources.h"
-
-#include "BSE_edit.h"
-#include "BSE_filesel.h"
-#include "BSE_headerbuttons.h"
-#include "BSE_seqaudio.h"
-#include "BSE_view.h"
-
-#include "BPY_extern.h"
-#include "mydevice.h"
-#include "blendef.h"
-
-#include "winlay.h"
-
-/* TIPS:
- *
- * - WATCH THE EDGES, VERTICES HAVE TO BE IN ORDER...
- (lowest pointer first). Otherwise unpredictable effects!
- * - problem: flags here are not nicely implemented. After usage
- always reset to zero.
- */
-
-/* comment added to test orange branch */
-
-static void testareas(void);
-static void area_autoplayscreen(void);
-static void wait_for_event(void);
-
-
-/* ********* Globals *********** */
-
-static Window *mainwin= NULL;
-static int prefsizx= 0, prefsizy= 0, prefstax= 0, prefstay= 0, start_maximized= 1;
-static short dodrawscreen= 1;
-static ScrArea *areawinar[MAXWIN];
-static ScrArea *g_activearea= NULL;
-short winqueue_break= 0;
-ScrArea *curarea= 0;
-
-/* prototypes -------------------*/
-int afterqtest(short win, unsigned short evt);
-unsigned short screen_qread(short *val, char *ascii);
-void add_to_mainqueue(Window *win, void *user_data, short evt, short val, char ascii);
-static void drawscredge_area(ScrArea *sa);
-
-/**********************************************************************/
-
-extern int textediting;
-
-static void screen_set_cursor(bScreen *sc)
-{
- if (sc->winakt>3) {
- ScrArea *sa= areawinar[sc->winakt];
-
- set_cursor(sa->cursor);
- } else {
- set_cursor(CURSOR_STD);
- }
-}
-
-void waitcursor(int val)
-{
- if(G.curscreen) {
- if(val) {
- set_cursor(CURSOR_WAIT);
- } else {
- screen_set_cursor(G.curscreen);
- }
- }
-}
-
-static int choose_cursor(ScrArea *sa)
-{
- if (sa->spacetype==SPACE_VIEW3D) {
- if(G.obedit) return CURSOR_EDIT;
- else if(G.f & (G_VERTEXPAINT|G_WEIGHTPAINT|G_TEXTUREPAINT))
- return CURSOR_VPAINT;
- else if(FACESEL_PAINT_TEST) return CURSOR_FACESEL;
- else if(G.f & G_SCULPTMODE) return CURSOR_EDIT;
- else if(G.f & G_PARTICLEEDIT) return CURSOR_EDIT;
- else return CURSOR_STD;
- }
- else if (sa->spacetype==SPACE_TEXT) {
- return CURSOR_TEXTEDIT;
- }
- else {
- return CURSOR_STD;
- }
-}
-
-void wich_cursor(ScrArea *sa)
-{
- sa->cursor= choose_cursor(sa);
-
- /* well... the waitcursor() is not a state, so this call will cancel it out */
- if(get_cursor()!=CURSOR_WAIT)
- screen_set_cursor(G.curscreen);
-}
-
-
-void setcursor_space(int spacetype, short cur)
-{
- bScreen *sc;
- ScrArea *sa;
-
- for (sc= G.main->screen.first; sc; sc= sc->id.next)
- for (sa= sc->areabase.first; sa; sa= sa->next)
- if(sa->spacetype==spacetype)
- sa->cursor= cur;
-
- screen_set_cursor(G.curscreen);
-}
-
-
-/* ********* IN/OUT ************* */
-
-void getmouseco_sc(short *mval) /* screen coordinates */
-{
- getmouse(mval);
-}
-
-/* mouse_cursor called during a script (via Window.QHandle) need
- * this function for getmouseco_areawin to work: */
-void set_g_activearea(ScrArea *sa)
-{
- if (sa) g_activearea = sa;
-}
-
-void getmouseco_areawin(short *mval) /* internal area coordinates */
-{
- getmouseco_sc(mval);
-
- if(g_activearea && g_activearea->win) {
- mval[0]-= g_activearea->winrct.xmin;
- mval[1]-= g_activearea->winrct.ymin;
- }
-}
-
-void getmouseco_headwin(short *mval) /* internal area coordinates */
-{
- getmouseco_sc(mval);
-
- if(g_activearea && g_activearea->headwin) {
- mval[0]-= g_activearea->headrct.xmin;
- mval[1]-= g_activearea->headrct.ymin;
- }
-}
-
-void headerprint(char *str)
-{
- if(curarea->headertype) {
- areawinset(curarea->headwin);
-
- headerbox(curarea);
-
- BIF_ThemeColor(TH_MENU_TEXT); /* better than cpack(0x0) color no? (desoto) */
- glRasterPos2i(20+curarea->headbutofs, 6);
- BMF_DrawString(G.font, str);
-
- curarea->head_swap= WIN_BACK_OK;
- areawinset(curarea->win);
- }
- else {
- // dunno... thats for later (ton)
- }
-}
-
-/* *********** STUFF ************** */
-
-static int scredge_is_horizontal(ScrEdge *se)
-{
- return (se->v1->vec.y == se->v2->vec.y);
-}
-
-static ScrEdge *screen_find_active_scredge(bScreen *sc, short *mval)
-{
- ScrEdge *se;
-
- for (se= sc->edgebase.first; se; se= se->next) {
- if (scredge_is_horizontal(se)) {
- short min, max;
- min= MIN2(se->v1->vec.x, se->v2->vec.x);
- max= MAX2(se->v1->vec.x, se->v2->vec.x);
-
- if (abs(mval[1]-se->v1->vec.y)<=2 && mval[0] >= min && mval[0]<=max)
- return se;
- }
- else {
- short min, max;
- min= MIN2(se->v1->vec.y, se->v2->vec.y);
- max= MAX2(se->v1->vec.y, se->v2->vec.y);
-
- if (abs(mval[0]-se->v1->vec.x)<=2 && mval[1] >= min && mval[1]<=max)
- return se;
- }
- }
-
- return NULL;
-}
-
-void areawinset(short win)
-{
- if(win>3) {
- curarea= areawinar[win];
- if(curarea==0) {
- printf("error in areawinar %d ,areawinset\n", win);
- return;
- }
-
- BIF_SetTheme(curarea);
-
- switch(curarea->spacetype) {
- case SPACE_VIEW3D:
- G.vd= curarea->spacedata.first;
- break;
- case SPACE_IPO:
- G.sipo= curarea->spacedata.first;
- G.v2d= &G.sipo->v2d;
- break;
- case SPACE_BUTS:
- G.buts= curarea->spacedata.first;
- G.v2d= &G.buts->v2d;
- break;
- case SPACE_SEQ: {
- SpaceSeq *sseq= curarea->spacedata.first;
- G.v2d= &sseq->v2d;
- break;
- }
- case SPACE_OOPS:
- G.soops= curarea->spacedata.first;
- G.v2d= &G.soops->v2d;
- break;
- case SPACE_IMAGE:
- G.sima= curarea->spacedata.first;
- G.v2d= &G.sima->v2d;
- break;
- case SPACE_SOUND:
- G.ssound= curarea->spacedata.first;
- G.v2d= &G.ssound->v2d;
- break;
- case SPACE_ACTION:
- G.saction= curarea->spacedata.first;
- G.v2d= &G.saction->v2d;
- break;
- case SPACE_NLA:
- G.snla= curarea->spacedata.first;
- G.v2d= &G.snla->v2d;
- break;
- case SPACE_TIME:
- {
- SpaceTime *stime= curarea->spacedata.first;
- G.v2d= &stime->v2d;
- }
- break;
- case SPACE_NODE:
- {
- SpaceNode *snode= curarea->spacedata.first;
- G.v2d= &snode->v2d;
- }
- break;
- case SPACE_IMASEL:
- {
- SpaceImaSel *simasel= curarea->spacedata.first;
- G.v2d= &simasel->v2d;
- }
- default:
- break;
- }
- }
-
- if(win) mywinset(win);
-}
-
-#define SCR_BACK 0.55
-#define SCR_ROUND 12
-
-void headerbox(ScrArea *area)
-{
- float width= area->winx;
- int active=0;
-
- glClearColor(SCR_BACK, SCR_BACK, SCR_BACK, 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- active= area_is_active_area(area);
-
- if(active) BIF_ThemeColor(TH_HEADER);
- else BIF_ThemeColor(TH_HEADERDESEL);
-
- /* weird values here... is because of window matrix that centers buttons */
- if(area->headertype==HEADERTOP) {
- uiSetRoundBox(3);
- uiRoundBoxEmboss(-0.5+area->headbutofs, -10.0, width-1.5+area->headbutofs, HEADERY-2.0, SCR_ROUND, active);
- }
- else {
- uiSetRoundBox(12);
- uiRoundBoxEmboss(-0.5+area->headbutofs, -3.5, width-1.5+area->headbutofs, HEADERY+10, SCR_ROUND, active);
- }
-
- uiSetRoundBox(15);
-}
-
-int area_is_active_area(ScrArea *area)
-{
- return (g_activearea && area==g_activearea);
-}
-
-void scrarea_do_headdraw(ScrArea *area)
-{
- if (area->headertype) {
- areawinset(area->headwin);
-
- headerbox(area);
-
- /* we make scissor test slightly smaller not to destroy rounded headers */
- glScissor(area->headrct.xmin+5, area->headrct.ymin, area->winx-10, HEADERY);
-
- switch(area->spacetype) {
- case SPACE_FILE: file_buttons(); break;
- case SPACE_INFO: info_buttons(); break;
- case SPACE_VIEW3D: view3d_buttons(); break;
- case SPACE_IPO: ipo_buttons(); break;
- case SPACE_BUTS: buts_buttons(); break;
- case SPACE_SEQ: seq_buttons(); break;
- case SPACE_IMAGE: image_buttons(); break;
- case SPACE_IMASEL: imasel_buttons(); break;
- case SPACE_OOPS: oops_buttons(); break;
- case SPACE_TEXT: text_buttons(); break;
- case SPACE_SCRIPT:script_buttons(); break;
- case SPACE_SOUND: sound_buttons(); break;
- case SPACE_ACTION: action_buttons(); break;
- case SPACE_NLA: nla_buttons(); break;
- case SPACE_TIME: time_buttons(area); break;
- case SPACE_NODE: node_buttons(area); break;
- }
- uiClearButLock();
-
- //glScissor(area->winrct.xmin, area->winrct.xmax, area->winx, area->winy);
- area->head_swap= WIN_BACK_OK;
- }
-}
-void scrarea_do_headchange(ScrArea *area)
-{
- float ofs= area->headbutofs;
-
- if (area->headertype==HEADERDOWN) {
- bwin_ortho2(area->headwin, -0.375+ofs, area->headrct.xmax-area->headrct.xmin-0.375+ofs, -3.375, area->headrct.ymax-area->headrct.ymin-3.375+1.0);
- } else if (area->headertype==HEADERTOP) {
- bwin_ortho2(area->headwin, -0.375+ofs, area->headrct.xmax-area->headrct.xmin-0.375+ofs, -2.375-1.0, area->headrct.ymax-area->headrct.ymin-2.375);
- }
-}
-
-
-static void openheadwin(ScrArea *sa);
-static void closeheadwin(ScrArea *sa);
-
-static void scrarea_change_headertype(ScrArea *sa, int newtype)
-{
- sa->headertype= newtype;
-
- if (!newtype) {
- if (sa->headwin) {
- uiFreeBlocksWin(&sa->uiblocks, sa->headwin);
- closeheadwin(sa);
- }
- } else {
- if (!sa->headwin) {
- openheadwin(sa);
- }
- }
-
- testareas();
- mainqenter(DRAWEDGES, 1);
- winqueue_break= 1;
-}
-
-static void headmenu(ScrArea *sa)
-{
- short val= pupmenu("Header %t|Top%x2|Bottom %x1|No Header %x0");
-
- if(val> -1) {
- scrarea_change_headertype(sa, val);
- }
-}
-
-static void addqueue_ext(short win, unsigned short event, short val, char ascii)
-{
- if (win<4 || !areawinar[win]) {
- /* other win ids are for mainwin & renderwin */
- }
- else {
- BWinEvent evt;
-
- memset(&evt, 0, sizeof(evt));
- evt.event= event;
- evt.val= val;
- evt.ascii= ascii;
-
- bwin_qadd(win, &evt);
- }
-}
-
-void addqueue(short win, unsigned short event, short val)
-{
- addqueue_ext(win, event, val, 0);
-}
-
-void scrarea_queue_winredraw(ScrArea *area)
-{
- addqueue(area->win, REDRAW, 1);
-}
-void scrarea_queue_headredraw(ScrArea *area)
-{
- if (area->headwin) addqueue(area->headwin, REDRAW, 1);
-}
-void scrarea_queue_redraw(ScrArea *area)
-{
- scrarea_queue_winredraw(area);
- scrarea_queue_headredraw(area);
-}
-
-static void scrollheader(ScrArea *area);
-static void scrarea_dispatch_header_events(ScrArea *sa)
-{
- ScrArea *tempsa;
- BWinEvent evt;
- short do_redraw=0, do_change=0;
-
- areawinset(sa->headwin);
-
- while(bwin_qread(sa->headwin, &evt)) {
- if(evt.val) {
- if( uiDoBlocks(&curarea->uiblocks, evt.event, 1)!=UI_NOTHING ) evt.event= 0;
-
- switch(evt.event) {
- case UI_BUT_EVENT:
- do_headerbuttons(evt.val);
- break;
-
- case LEFTMOUSE:
- if (G.qual & LR_CTRLKEY) {
- window_lower(mainwin);
- } else {
- window_raise(mainwin);
- }
- break;
-
- case MIDDLEMOUSE:
- scrollheader(sa);
- break;
- case RIGHTMOUSE:
- headmenu(sa);
- break;
- case REDRAW:
- do_redraw= 1;
- break;
- case CHANGED:
- sa->head_swap= 0;
- do_change= 1;
- do_redraw= 1;
- break;
- default:
- if (winqueue_break == 0) {
- scrarea_do_winhandle(sa, &evt);
- if (winqueue_break == 0) areawinset(sa->headwin);
- }
- }
-
- if(winqueue_break) return;
- }
- }
-
- /* test: does window still exist? */
- tempsa= areawinar[sa->headwin];
- if(tempsa==0) return;
-
- /* this functional separation does not work as well as i expected... */
- if(do_change) scrarea_do_headchange(sa);
- if(do_redraw) scrarea_do_headdraw(sa);
-}
-
-static void scrarea_dispatch_events(ScrArea *sa)
-{
- ScrArea *tempsa;
- BWinEvent evt;
- short do_redraw=0, do_change=0;
-
- if(sa!=curarea || sa->win!=mywinget()) areawinset(sa->win);
-
- while(bwin_qread(sa->win, &evt)) {
- if(evt.event==REDRAW) {
- do_redraw= 1;
- }
- else if(evt.event==CHANGED) {
- sa->win_swap= 0;
- do_change= 1;
- do_redraw= 1;
- }
- else {
- scrarea_do_winhandle(sa, &evt);
- }
-
- if(winqueue_break) return;
- }
-
- /* test: does window still exist */
- tempsa= areawinar[sa->win];
- if(tempsa==0) return;
-
- if (do_change || do_redraw) {
- areawinset(sa->win);
- if(do_change)
- scrarea_do_winchange(curarea);
- if(do_redraw)
- scrarea_do_windraw(curarea);
- }
-}
-
-/***/
-
-
-void markdirty_all()
-{
- ScrArea *sa;
- for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- if(sa->win) {
- scrarea_queue_winredraw(sa);
- sa->win_swap &= ~WIN_FRONT_OK;
- }
- if(sa->headwin) {
- scrarea_queue_headredraw(sa);
- sa->head_swap &= ~WIN_FRONT_OK;
- }
- }
-}
-
-/* but no redraw! */
-void markdirty_all_back(void)
-{
- ScrArea *sa;
-
- for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- if(sa->win) {
- sa->win_swap &= ~WIN_BACK_OK;
- }
- if(sa->headwin) {
- sa->head_swap &= ~WIN_BACK_OK;
- }
- }
-
- /* if needed; backbuffer selection redraw */
- if(G.vd) G.vd->flag |= V3D_NEEDBACKBUFDRAW;
-
-}
-
-void markdirty_win_back(short winid)
-{
- ScrArea *sa= areawinar[winid];
- if(sa) {
- if(sa->win==winid) sa->win_swap &= ~WIN_BACK_OK;
- else sa->head_swap &= ~WIN_BACK_OK;
- }
-}
-
-
-int is_allowed_to_change_screen(bScreen *new)
-{
- /* not when curscreen is full
- * not when obedit && old->scene!=new->scene
- */
-
- if(new==0) return 0;
- if(G.curscreen->full != SCREENNORMAL) return 0;
- if(curarea->full) return 0;
- if(G.obedit) {
- if(G.curscreen->scene!=new->scene) return 0;
- }
- return 1;
-}
-
-void splash(void *data, int datasize, char *string)
-{
- ImBuf *bbuf;
- int oldwin;
- short val;
-
- bbuf= IMB_ibImageFromMemory((int *)data, datasize, IB_rect);
-
- if (bbuf) {
- oldwin = mywinget();
- mywinset(G.curscreen->mainwin);
-
- if (string) {
- int x, y, maxy;
- unsigned int *rect;
-
- rect = bbuf->rect;
- maxy = MIN2(bbuf->y, 18);
-
- for (y = 0; y < maxy; y++) {
- for (x = 0; x < bbuf->x; x++) {
- *rect = 0xffffffff;
- rect++;
- }
- }
- }
- glDrawBuffer(GL_FRONT);
-
- uiDrawBoxShadow(200, (prefsizx-bbuf->x)/2, (prefsizy-bbuf->y)/2, (prefsizx+bbuf->x)/2, (prefsizy+bbuf->y)/2);
-
- glRasterPos2i((prefsizx-bbuf->x)/2, (prefsizy-bbuf->y)/2);
- glDrawPixels(bbuf->x, bbuf->y, GL_RGBA, GL_UNSIGNED_BYTE, bbuf->rect);
-
- if (string) {
- void *font;
- int width;
-
- if (BMF_GetStringWidth(font= G.font, string) > bbuf->x)
- if (BMF_GetStringWidth(font= G.fonts, string) > bbuf->x)
- font= G.fontss;
-
- width= BMF_GetStringWidth(font, string);
-
- glColor3ub(0, 0, 0);
- glRasterPos2i((prefsizx-width)/2, (prefsizy-bbuf->y)/2 + 6);
- BMF_DrawString(font, string);
- }
-
- bglFlush();
- glDrawBuffer(GL_BACK);
-
- IMB_freeImBuf(bbuf);
-
- // flush input buffers ....
- // this might break some things
-
- while (get_mbut()) {
- BIF_wait_for_statechange();
- }
- while(qtest()) {
- extern_qread(&val);
- }
-
- wait_for_event();
-
- mywinset(oldwin);
- markdirty_all();
- mainqenter(DRAWEDGES, 1);
- }
-}
-
-static void moveareas(ScrEdge *edge);
-static void joinarea_interactive(ScrArea *area, ScrEdge *onedge);
-static void splitarea_interactive(ScrArea *area, ScrEdge *onedge);
-static ScrArea *test_edge_area(ScrArea *sa, ScrEdge *se);
-static ScrEdge *screen_findedge(bScreen *sc, ScrVert *v1, ScrVert *v2);
-
-static int isjoinable(ScrArea *area, ScrEdge *onedge)
-{
- struct ScrArea *sa1 = area, *sa2;
- struct ScrEdge *se;
-
- sa1 = test_edge_area(sa1, onedge);
- if(sa1==0) return 0;
-
- /* find directions with same edge */
- sa2= G.curscreen->areabase.first;
- while(sa2) {
- if(sa2 != sa1) {
- se= screen_findedge(G.curscreen, sa2->v1, sa2->v2);
- if(onedge==se) return 1;
- se= screen_findedge(G.curscreen, sa2->v2, sa2->v3);
- if(onedge==se) return 1;
- se= screen_findedge(G.curscreen, sa2->v3, sa2->v4);
- if(onedge==se) return 1;
- se= screen_findedge(G.curscreen, sa2->v4, sa2->v1);
- if(onedge==se) return 1;
- }
- sa2= sa2->next;
- }
-
- return 0;
-}
-
-static void screen_edge_edit_event(ScrArea *actarea, ScrEdge *actedge, short evt, short val)
-{
- if (val) {
- // don't allow users to edit full screens
- if (actarea && actarea->full)
- return;
-
- if (evt==LEFTMOUSE) {
- moveareas(actedge);
- } else if (evt==MIDDLEMOUSE || evt==RIGHTMOUSE) {
- int edgeop;
- char str[64] = "Split Area%x1|";
-
- if(isjoinable(actarea, actedge)) strcat(str, "Join Areas%x2|");
- if (actarea->headertype) strcat(str, "No Header%x3");
- else strcat(str, "Add Header%x3");
-
- edgeop= pupmenu(str);
- if (edgeop==1) splitarea_interactive(actarea, actedge);
- else if (edgeop==2) joinarea_interactive(actarea, actedge);
- else if (edgeop==3) scrarea_change_headertype(actarea,
- actarea->headertype?0:HEADERDOWN);
- }
- else blenderqread(evt, val); // global hotkeys
- }
-}
-
-/***/
-
-extern void mywindow_init_mainwin(Window *win, int orx, int ory, int sizex, int sizey);
-void test_scale_screen(bScreen *);
-
-static void resize_screens(int x, int y, int w, int h) {
- prefstax= x;
- prefstay= y;
- prefsizx= w;
- prefsizy= h;
-
- test_scale_screen(G.curscreen);
- testareas();
-}
-
-static void init_mainwin(void)
-{
- int orx, ory, sizex, sizey;
-
- glEnable(GL_SCISSOR_TEST);
-
- window_get_position(mainwin, &orx, &ory);
- window_get_size(mainwin, &sizex, &sizey);
-
- /* XXX, temporary stupid fix for minimize at windows */
- if (!sizex && !sizey) {
- return;
- }
-
- mywindow_init_mainwin(mainwin, orx, ory, sizex, sizey);
- resize_screens(orx, ory, sizex, sizey);
-}
-
-/***/
-
-static short afterqueue[MAXQUEUE][3];
-static int nafterqitems= 0;
-
-void addafterqueue(short win, unsigned short evt, short val)
-{
- if (nafterqitems<MAXQUEUE) {
- int a;
-
- /* only one afterqueue event of each type */
- for(a=0; a<nafterqitems; a++) {
- if(afterqueue[a][0]==win && afterqueue[a][1]==evt) {
- afterqueue[a][2]= val;
- return;
- }
- }
- afterqueue[nafterqitems][0]= win;
- afterqueue[nafterqitems][1]= evt;
- afterqueue[nafterqitems][2]= val;
- nafterqitems++;
- }
-}
-
-static void append_afterqueue(void)
-{
- while (nafterqitems) {
- short win= afterqueue[nafterqitems-1][0];
- unsigned short evt= afterqueue[nafterqitems-1][1];
- short val= afterqueue[nafterqitems-1][2];
-
- addqueue(win, evt, val);
-
- nafterqitems--;
- }
-}
-
-/* check for event in afterqueue, used in force_draw in space.c */
-int afterqtest(short win, unsigned short evt)
-{
- int a;
-
- for(a=0; a<nafterqitems; a++) {
- if(afterqueue[a][0]==win && afterqueue[a][1]==evt) return 1;
- }
- return 0;
-}
-
-
-static char ext_load_str[256]= {0, 0};
-void add_readfile_event(char *filename)
-{
- mainqenter(LOAD_FILE, 1);
- strcpy(ext_load_str, filename);
- BLI_convertstringcode(ext_load_str, G.sce, G.scene->r.cfra);
-}
-
-static short ext_reshape= 0, ext_redraw=0, ext_inputchange=0, ext_mousemove=0, ext_undopush=0;
-
-static void flush_extqd_events(void) {
- if (ext_inputchange) {
- mainqenter(INPUTCHANGE, ext_inputchange);
- } else if (ext_reshape) {
- mainqenter(RESHAPE, ext_redraw);
- } else if (ext_redraw) {
- mainqenter(REDRAW, ext_redraw);
- } else if (ext_undopush) {
- mainqenter(UNDOPUSH, ext_undopush);
- } else if (ext_mousemove) {
- short mouse[2];
-
- getmouseco_sc(mouse);
-
- mainqenter(MOUSEX, mouse[0]);
- mainqenter(MOUSEY, mouse[1]);
- }
-
- ext_inputchange= ext_reshape= ext_redraw= ext_mousemove= ext_undopush= 0;
-}
-
-int qtest(void)
-{
- if (!mainqtest()) {
- winlay_process_events(0);
- }
-
- return mainqtest();
-}
-
- /* return true if events are waiting anywhere */
-int anyqtest(void)
-{
- ScrArea *sa;
-
- if (nafterqitems || qtest()) return 1;
-
- for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- if (bwin_qtest(sa->win)) return 1;
- if (sa->headwin && bwin_qtest(sa->headwin)) return 1;
- }
-
- return 0;
-}
-
-static void wait_for_event(void)
-{
- while (!mainqtest()) {
- winlay_process_events(1);
- }
-}
-
-unsigned short screen_qread(short *val, char *ascii)
-{
- unsigned short event;
-
- wait_for_event();
-
- event= mainqread(val, ascii);
-
- if(event==RIGHTSHIFTKEY || event==LEFTSHIFTKEY) {
- if(*val) G.qual |= LR_SHIFTKEY;
- else G.qual &= ~LR_SHIFTKEY;
- }
- else if(event==RIGHTALTKEY || event==LEFTALTKEY) {
- if(*val) G.qual |= LR_ALTKEY;
- else G.qual &= ~LR_ALTKEY;
- }
- else if(event==RIGHTCTRLKEY || event==LEFTCTRLKEY) {
- if(*val) G.qual |= LR_CTRLKEY;
- else G.qual &= ~LR_CTRLKEY;
- }
- else if(event==COMMANDKEY) { // OSX
- if(*val) G.qual |= LR_COMMANDKEY;
- else G.qual &= ~LR_COMMANDKEY;
- }
-
- return event;
-}
-
-unsigned short extern_qread_ext(short *val, char *ascii)
-{
- /* stores last INPUTCHANGE and last REDRAW */
- unsigned short event;
-
- event= screen_qread(val, ascii);
- if(event==RESHAPE) ext_reshape= *val;
- else if(event==REDRAW) ext_redraw= *val;
- else if(event==UNDOPUSH) ext_undopush= *val;
- else if(event==INPUTCHANGE) ext_inputchange= *val;
- else if(event==MOUSEY || event==MOUSEX) ext_mousemove= 1;
- else if((G.qual & (LR_CTRLKEY|LR_ALTKEY)) && event==F3KEY) {
- if(*val) {
- BIF_screendump(0);
- return ESCKEY; /* go out of menu, if that was set */
- }
- }
-
- return event;
-}
-unsigned short extern_qread(short *val)
-{
- char ascii;
- return extern_qread_ext(val, &ascii);
-}
-
-int blender_test_break(void)
-{
- if (!G.background) {
- static double ltime= 0;
- double curtime= PIL_check_seconds_timer();
-
- /* only check for breaks every 10 milliseconds
- * if we get called more often.
- */
- if ((curtime-ltime)>.001) {
- ltime= curtime;
-
- while(qtest()) {
- short val;
- if (extern_qread(&val) == ESCKEY) {
- G.afbreek= 1;
- }
- }
- }
- }
-
- return (G.afbreek==1);
-}
-
-void reset_autosave(void) {
- window_set_timer(mainwin, U.savetime*60*1000, AUTOSAVE_FILE);
-}
-
-/* ************ handlers ************** */
-
-/* don't know yet how the handlers will evolve, for simplicity
-i choose for an array with eventcodes, this saves in a file!
-*/
-void add_screenhandler(bScreen *sc, short eventcode, short val)
-{
- short a;
-
- // find empty spot
- for(a=0; a<SCREEN_MAXHANDLER; a+=2) {
- if( sc->handler[a]==eventcode ) {
- sc->handler[a+1]= val;
- break;
- }
- else if( sc->handler[a]==0) {
- sc->handler[a]= eventcode;
- sc->handler[a+1]= val;
- break;
- }
- }
- if(a==SCREEN_MAXHANDLER) printf("error; max (4) screen handlers reached!\n");
-}
-
-void rem_screenhandler(bScreen *sc, short eventcode)
-{
- short a;
-
- for(a=0; a<SCREEN_MAXHANDLER; a+=2) {
- if( sc->handler[a]==eventcode) {
- sc->handler[a]= 0;
- break;
- }
- }
-}
-
-int has_screenhandler(bScreen *sc, short eventcode)
-{
- short a;
-
- for(a=0; a<SCREEN_MAXHANDLER; a+=2) {
- if( sc->handler[a]==eventcode) {
- return 1;
- }
- }
- return 0;
-}
-
-static void animated_screen(bScreen *sc, short val)
-{
- if ((val & TIME_WITH_SEQ_AUDIO)) {
- if(CFRA>=PEFRA) {
- CFRA= PSFRA;
- audiostream_stop();
- audiostream_start( CFRA );
- }
- else {
- int cfra = audiostream_pos();
- if(cfra <= CFRA) CFRA++;
- else CFRA= cfra;
- }
- }
- else {
- CFRA++;
- if(CFRA > PEFRA) CFRA= PSFRA;
- }
-
- update_for_newframe_nodraw(1);
-
- if(val & TIME_ALL_3D_WIN)
- allqueue(REDRAWVIEW3D, 0);
- else if(val & TIME_LEFTMOST_3D_WIN) {
- ScrArea *sa= sc->areabase.first, *samin=NULL;
- int min= 10000;
- for(; sa; sa= sa->next) {
- if(sa->spacetype==SPACE_VIEW3D) {
- if(sa->winrct.xmin - sa->winrct.ymin < min) {
- samin= sa;
- min= sa->winrct.xmin - sa->winrct.ymin;
- }
- }
- }
- if(samin) scrarea_queue_winredraw(samin);
- }
- if(val & TIME_ALL_ANIM_WIN) allqueue(REDRAWANIM, 0);
- if(val & TIME_ALL_BUTS_WIN) allqueue(REDRAWBUTSALL, 0);
- if(val & TIME_SEQ) {
- allqueue(REDRAWSEQ, 0);
- }
-
- allqueue(REDRAWTIME, 0);
-}
-
-/* because we still have to cope with subloops, this function is called
-in viewmove() for example too */
-
-/* returns 1 if something was handled */
-/* restricts to frames-per-second setting for frequency of updates */
-int do_screenhandlers(bScreen *sc)
-{
- static double ltime=0.0;
- double swaptime, time;
- short a, done= 0;
-
- time = PIL_check_seconds_timer();
- swaptime= 1.0/FPS;
-
- /* only now do the handlers */
- if(swaptime < time-ltime || ltime==0.0) {
-
- ltime= time;
-
- for(a=0; a<SCREEN_MAXHANDLER; a+=2) {
- switch(sc->handler[a]) {
- case SCREEN_HANDLER_ANIM:
- animated_screen(sc, sc->handler[a+1]);
- done= 1;
- break;
- case SCREEN_HANDLER_PYTHON:
- done= 1;
- break;
- case SCREEN_HANDLER_VERSE:
-#ifdef WITH_VERSE
- b_verse_update();
-#endif
-
- done= 1;
- break;
- }
- }
- }
- else if( qtest()==0) PIL_sleep_ms(5); // 5 milliseconds pause, for idle
-
- /* separate check for if we need to add to afterqueue */
- /* is only to keep mainqueue awqke */
- for(a=0; a<SCREEN_MAXHANDLER; a+=2) {
- if(sc->handler[a]) {
- ScrArea *sa= sc->areabase.first;
- if(sa->headwin) addafterqueue(sa->headwin, SCREEN_HANDLER, 1);
- else addafterqueue(sa->win, SCREEN_HANDLER, 1);
- }
- }
-
- return done;
-}
-
-/* ****** end screen handlers ************ */
-
-static void drawscreen(void)
-{
- ScrArea *sa;
-
- mywinset(G.curscreen->mainwin);
- myortho2(-0.375, (float)G.curscreen->sizex-0.375, -0.375, (float)G.curscreen->sizey-0.375);
-
- sa= G.curscreen->areabase.first;
- while(sa) {
- drawscredge_area(sa);
- sa= sa->next;
- }
-
- /* this double draw patch seems to be needed for certain sgi's (octane, indigo2) */
-#if defined(__sgi) || defined(__sun__) || defined( __sun ) || defined (__sparc) || defined (__sparc__)
- glDrawBuffer(GL_FRONT);
-
- sa= G.curscreen->areabase.first;
- while(sa) {
- drawscredge_area(sa);
- sa= sa->next;
- }
-
- glDrawBuffer(GL_BACK);
-#endif
-}
-
-static void screen_dispatch_events(void) {
- int events_remaining= 1;
- ScrArea *sa;
-
- window_make_active(mainwin); // added it here instead of screenmain (ton)
-
- while (events_remaining) {
- events_remaining= 0;
-
- winqueue_break= 0;
- for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- /* first check header, then rest. Header sometimes has initialization code */
- if (sa->headwin && bwin_qtest(sa->headwin)) {
- scrarea_dispatch_header_events(sa);
- events_remaining= 1;
- }
- if (winqueue_break) break;
-
- if (bwin_qtest(sa->win)) {
- scrarea_dispatch_events(sa);
- events_remaining= 1;
- }
- if (winqueue_break) break;
- }
-
- if (winqueue_break) break;
- }
-
- /* winqueue_break isnt the best of all solutions... but it is called on switching screens,
- so drawing should wait for all redraw/init events to be handled */
- if (winqueue_break==0) {
- if (dodrawscreen) {
- drawscreen();
- dodrawscreen= 0;
- }
-
- screen_swapbuffers();
- do_screenhandlers(G.curscreen);
- }
-}
-
-static ScrArea *screen_find_area_for_pt(bScreen *sc, short *mval)
-{
- ScrArea *sa;
-
- /* hotspot area of 1 pixel extra */
-
- for (sa= sc->areabase.first; sa; sa= sa->next) {
- if( sa->totrct.xmin + 1 < mval[0] )
- if( sa->totrct.ymin + 1 < mval[1] )
- if( sa->totrct.xmax - 1 > mval[0] )
- if( sa->totrct.ymax - 1 > mval[1] )
- return sa;
- }
- return NULL;
-}
-
-/* ugly yah, will disappear on better event system */
-/* is called from interface.c after button events */
-static char delayed_undo_name[64];
-void screen_delayed_undo_push(char *name)
-{
- strncpy(delayed_undo_name, name, 63);
- mainqenter(UNDOPUSH, 1);
-}
-
-void screenmain(void)
-{
- int has_input= 1;
- int firsttime = 1;
- int onload_script = 0;
-
- window_make_active(mainwin);
-
- while (1) {
- unsigned short event;
- short val, towin;
- char ascii;
-
- flush_extqd_events();
- if (nafterqitems && !qtest()) {
- append_afterqueue();
- event= val= ascii= 0;
- } else {
- event= screen_qread(&val, &ascii);
- }
-
- // window_make_active(mainwin); // (only for inputchange, removed, (ton))
-
- if (event==INPUTCHANGE) {
- window_make_active(mainwin);
- G.qual= get_qual();
- }
-
- /* If the main window is active, find the current active ScrArea
- * underneath the mouse cursor, updating the headers & cursor for
- * the appropriate internal window if things have changed.
- *
- * If the main window is not active, deactivate the internal
- * window.
- */
- if (has_input || g_activearea==NULL || G.curscreen->winakt) {
- ScrArea *newactarea;
- int newactwin;
- short mval[2];
-
- getmouseco_sc(mval);
- newactarea= screen_find_area_for_pt(G.curscreen, mval);
-
- if (newactarea) {
- if (BLI_in_rcti(&newactarea->headrct, mval[0], mval[1])) {
- newactwin= newactarea->headwin;
- set_cursor(CURSOR_STD);
- } else {
- newactwin= newactarea->win;
- }
- } else {
- newactwin= 0;
- }
-
- if (newactarea && (newactarea != g_activearea)) {
- if (g_activearea) scrarea_queue_headredraw(g_activearea);
- scrarea_queue_headredraw(newactarea);
- if (!(BLI_in_rcti(&newactarea->headrct, mval[0], mval[1]))) /* header always gets std cursor */
- set_cursor(newactarea->cursor);
- g_activearea= newactarea;
- }
- /* when you move mouse from header to window, buttons can remain hilited otherwise */
- if(newactwin != G.curscreen->winakt) {
- if (g_activearea) scrarea_queue_headredraw(g_activearea);
- }
- G.curscreen->winakt= newactwin;
-
- if (G.curscreen->winakt) {
- areawinset(G.curscreen->winakt);
- if (!(BLI_in_rcti(&newactarea->headrct, mval[0], mval[1]))) /* header always gets std cursor */
- set_cursor(choose_cursor(g_activearea));
- }
- }
- else {
- if (g_activearea) {
- scrarea_queue_headredraw(g_activearea);
- }
- g_activearea= NULL;
- G.curscreen->winakt= 0;
- }
-
- towin= 0;
- if (event==WINCLOSE) {
- exit_usiblender();
- }
- else if (event==DRAWEDGES) {
- dodrawscreen= 1;
- }
- else if (event==RESHAPE) {
- init_mainwin();
- markdirty_all();
- dodrawscreen= 1;
- }
- else if (event==REDRAW) {
- markdirty_all();
- dodrawscreen= 1;
- }
- else if( event==UNDOPUSH) {
- BIF_undo_push(delayed_undo_name);
- }
- else if (event==AUTOSAVE_FILE) {
- BIF_write_autosave();
- }
- else if (event==LOAD_FILE) {
- BIF_read_file(ext_load_str);
- sound_initialize_sounds();
- }
- else if ((event==ONLOAD_SCRIPT) && BPY_has_onload_script()) {
- /* event queued in setup_app_data() in blender.c, where G.f is checked */
- onload_script = 1;
- firsttime = 1; /* see last 'if' in this function */
- }
- else {
- towin= 1;
- }
-
- if (!g_activearea) {
- towin= 0;
- }
- else if (event==QKEY) {
- if((G.obedit && G.obedit->type==OB_FONT && g_activearea->spacetype==SPACE_VIEW3D)||g_activearea->spacetype==SPACE_TEXT||g_activearea->spacetype==SPACE_SCRIPT);
- else {
- if(val && (G.qual & LR_CTRLKEY)) {
- if(okee("Quit Blender")) exit_usiblender();
- }
- towin= 0;
- }
- }
- else if (event==RIGHTARROWKEY) {
- if(textediting==0 && val && (G.qual & LR_CTRLKEY)) {
- bScreen *sc= G.curscreen->id.next;
-
- /* if screen is last, set it to first */
- if(sc == NULL)
- sc= G.main->screen.first;
-
- if(is_allowed_to_change_screen(sc)) setscreen(sc);
- g_activearea= NULL;
- towin= 0;
- }
- }
- else if (event==LEFTARROWKEY) {
- if(textediting==0 && val && (G.qual & LR_CTRLKEY)) {
- bScreen *sc= G.curscreen->id.prev;
-
- /* if screen is first, set it to last */
- if(sc == NULL)
- sc= G.main->screen.last;
-
- if(is_allowed_to_change_screen(sc)) setscreen(sc);
- g_activearea= NULL;
- towin= 0;
- }
- }
- else if (!G.curscreen->winakt) {
- ScrEdge *actedge;
- short mval[2];
-
- getmouseco_sc(mval);
- actedge= screen_find_active_scredge(G.curscreen, mval);
-
- if (actedge) {
- if (scredge_is_horizontal(actedge)) {
- set_cursor(CURSOR_Y_MOVE);
- } else {
- set_cursor(CURSOR_X_MOVE);
- }
- // this does global hotkeys too
- screen_edge_edit_event(g_activearea, actedge, event, val);
- } else {
- set_cursor(CURSOR_STD);
- }
-
- towin= 0;
- }
- else if (event==ZKEY) {
- if(val && G.qual==(LR_ALTKEY|LR_SHIFTKEY|LR_CTRLKEY)) {
- extern void set_debug_swapbuffers_ovveride(bScreen *sc, int mode);
-
- int which= pupmenu("Swapbuffers%t|Simple|Debug|DebugSwap|Redraw|Default|KillSwap");
-
- switch (which) {
- case 1: set_debug_swapbuffers_ovveride(G.curscreen, 's'); break;
- case 2: set_debug_swapbuffers_ovveride(G.curscreen, 'd'); break;
- case 3: set_debug_swapbuffers_ovveride(G.curscreen, 'f'); break;
- case 4: set_debug_swapbuffers_ovveride(G.curscreen, 'r'); break;
- case 5: set_debug_swapbuffers_ovveride(G.curscreen, 0); break;
- case 6:
- if (g_activearea) {
- g_activearea->head_swap= 0;
- g_activearea->win_swap= 0;
- }
- break;
- }
- towin= 0;
- }
- }
- else if (event==SPACEKEY) {
- if ((g_activearea->spacetype!=SPACE_TEXT) &&
- ( !((g_activearea->spacetype==SPACE_VIEW3D) && ((G.obedit) && G.obedit->type==OB_FONT)) ) &&
- val &&
- (G.qual & LR_SHIFTKEY)) {
- area_fullscreen();
- g_activearea= NULL;
- towin= 0;
- }
- else {
- if((G.obedit && G.obedit->type==OB_FONT && g_activearea->spacetype==SPACE_VIEW3D)||g_activearea->spacetype==SPACE_TEXT||g_activearea->spacetype==SPACE_SCRIPT||g_activearea->spacetype==SPACE_SEQ);
- else if(G.qual==0) {
- if(val) toolbox_n();
- towin= 0;
- }
- }
- }
- else if(ELEM(event, UPARROWKEY, DOWNARROWKEY)) {
- if(val && (G.qual & LR_CTRLKEY)) {
- area_fullscreen();
- g_activearea= NULL;
- towin= 0;
- }
- }
-
- if (towin && event) {
- if (blenderqread(event, val)) // the global keys
- addqueue_ext(G.curscreen->winakt, event, val, ascii);
- }
-
- /* only process subwindow queue's once the
- * main queue has been emptyied.
- */
- event= qtest();
- if (event==0 || event==EXECUTE) {
- screen_dispatch_events();
- }
-
- if(G.f & G_DEBUG) {
- GLenum error = glGetError();
- if (error)
- printf("GL error: %s\n", gluErrorString(error));
- }
- /* Bizar hack. The event queue has mutated... */
- if ( (firsttime) && (event == 0) ) {
-
- if (onload_script) {
- /* OnLoad scriptlink */
- BPY_do_pyscript(&G.scene->id, SCRIPT_ONLOAD);
- onload_script = 0;
- }
- else if (G.fileflags & G_FILE_AUTOPLAY) {
- // SET AUTOPLAY in G.flags for
- // other fileloads
-
- G.flags |= G_FILE_AUTOPLAY;
- area_autoplayscreen();
-
- // Let The Games Begin
- // fake a 'p' keypress
-
- mainqenter(PKEY, 1);
- } else {
- extern char datatoc_splash_jpg[];
- extern int datatoc_splash_jpg_size;
-
- //if (! ((G.main->versionfile >= G.version)
- // || G.save_over)) {
- splash((void *)datatoc_splash_jpg,
- datatoc_splash_jpg_size, NULL);
- //}
- }
- firsttime = 0;
- }
- }
-}
-
-#if 0
-//#ifdef _WIN32 // FULLSCREEN
-void mainwindow_toggle_fullscreen(int fullscreen)
-{
- if (fullscreen) U.uiflag |= USER_FLIPFULLSCREEN;
- else U.uiflag &= ~USER_FLIPFULLSCREEN;
-
- window_toggle_fullscreen(mainwin, fullscreen);
-}
-#endif
-
-void mainwindow_raise(void)
-{
- if(mainwin)
- window_raise(mainwin);
-}
-
-void mainwindow_make_active(void)
-{
- if(mainwin)
- window_make_active(mainwin);
-}
-
-void mainwindow_close(void)
-{
- if(mainwin)
- window_destroy(mainwin);
- mainwin= NULL;
-}
-
-void mainwindow_set_filename_to_title(char *filename)
-{
- char str[FILE_MAXDIR + FILE_MAXFILE];
- char dir[FILE_MAXDIR];
- char file[FILE_MAXFILE];
-
- BLI_split_dirfile(filename, dir, file);
-
- if(BLI_streq(file, ".B.blend") || filename[0] =='\0')
- sprintf(str, "Blender");
- else
- sprintf(str, "Blender [%s]", filename);
-
- window_set_title(mainwin, str);
-}
-
-/* ********* AREAS ************* */
-
-void setprefsize(int stax, int stay, int sizx, int sizy, int maximized)
-{
- int scrwidth, scrheight;
-
- winlay_get_screensize(&scrwidth, &scrheight);
-
- if(sizx<320) sizx= 320;
- if(sizy<256) sizy= 256;
-
- if(stay+sizy>scrheight) {
- fprintf(stderr," height prob \n");
- sizy= scrheight-stay;
- }
-
- if(sizx<320 || sizy<256) {
- printf("ERROR: illegal prefsize\n");
- return;
- }
-
- prefstax= stax;
- prefstay= stay;
- prefsizx= sizx;
- prefsizy= sizy;
-
- start_maximized= maximized;
-}
-
-
-static ScrVert *screen_addvert(bScreen *sc, short x, short y)
-{
- ScrVert *sv= MEM_callocN(sizeof(ScrVert), "addscrvert");
- sv->vec.x= x;
- sv->vec.y= y;
-
- BLI_addtail(&sc->vertbase, sv);
- return sv;
-}
-
-static void sortscrvert(ScrVert **v1, ScrVert **v2)
-{
- ScrVert *tmp;
-
- if (*v1 > *v2) {
- tmp= *v1;
- *v1= *v2;
- *v2= tmp;
- }
-}
-
-static ScrEdge *screen_addedge(bScreen *sc, ScrVert *v1, ScrVert *v2)
-{
- ScrEdge *se= MEM_callocN(sizeof(ScrEdge), "addscredge");
-
- sortscrvert(&v1, &v2);
- se->v1= v1;
- se->v2= v2;
-
- BLI_addtail(&sc->edgebase, se);
- return se;
-}
-
-static ScrEdge *screen_findedge(bScreen *sc, ScrVert *v1, ScrVert *v2)
-{
- ScrEdge *se;
-
- sortscrvert(&v1, &v2);
- for (se= sc->edgebase.first; se; se= se->next)
- if(se->v1==v1 && se->v2==v2)
- return se;
-
- return NULL;
-}
-
-static void removedouble_scrverts(void)
-{
- ScrVert *v1, *verg;
- ScrEdge *se;
- ScrArea *sa;
-
- verg= G.curscreen->vertbase.first;
- while(verg) {
- if(verg->newv==0) { /* !!! */
- v1= verg->next;
- while(v1) {
- if(v1->newv==0) { /* !?! */
- if(v1->vec.x==verg->vec.x && v1->vec.y==verg->vec.y) {
- /* printf("doublevert\n"); */
- v1->newv= verg;
- }
- }
- v1= v1->next;
- }
- }
- verg= verg->next;
- }
-
- /* replace pointers in edges and faces */
- se= G.curscreen->edgebase.first;
- while(se) {
- if(se->v1->newv) se->v1= se->v1->newv;
- if(se->v2->newv) se->v2= se->v2->newv;
- /* edges changed: so.... */
- sortscrvert(&(se->v1), &(se->v2));
- se= se->next;
- }
- sa= G.curscreen->areabase.first;
- while(sa) {
- if(sa->v1->newv) sa->v1= sa->v1->newv;
- if(sa->v2->newv) sa->v2= sa->v2->newv;
- if(sa->v3->newv) sa->v3= sa->v3->newv;
- if(sa->v4->newv) sa->v4= sa->v4->newv;
- sa= sa->next;
- }
-
- /* remove */
- verg= G.curscreen->vertbase.first;
- while(verg) {
- v1= verg->next;
- if(verg->newv) {
- BLI_remlink(&G.curscreen->vertbase, verg);
- MEM_freeN(verg);
- }
- verg= v1;
- }
-
-}
-
-static void removenotused_scrverts(void)
-{
- ScrVert *sv, *svn;
- ScrEdge *se;
-
- /* we assume edges are ok */
-
- se= G.curscreen->edgebase.first;
- while(se) {
- se->v1->flag= 1;
- se->v2->flag= 1;
- se= se->next;
- }
-
- sv= G.curscreen->vertbase.first;
- while(sv) {
- svn= sv->next;
- if(sv->flag==0) {
- BLI_remlink(&G.curscreen->vertbase, sv);
- MEM_freeN(sv);
- }
- else sv->flag= 0;
- sv= svn;
- }
-}
-
-static void removedouble_scredges(void)
-{
- ScrEdge *verg, *se, *sn;
-
- /* compare */
- verg= G.curscreen->edgebase.first;
- while(verg) {
- se= verg->next;
- while(se) {
- sn= se->next;
- if(verg->v1==se->v1 && verg->v2==se->v2) {
- BLI_remlink(&G.curscreen->edgebase, se);
- MEM_freeN(se);
- }
- se= sn;
- }
- verg= verg->next;
- }
-}
-
-static void removenotused_scredges(void)
-{
- ScrEdge *se, *sen;
- ScrArea *sa;
- int a=0;
-
- /* sets flags when edge is used in area */
- sa= G.curscreen->areabase.first;
- while(sa) {
- se= screen_findedge(G.curscreen, sa->v1, sa->v2);
- if(se==0) printf("error: area %d edge 1 bestaat niet\n", a);
- else se->flag= 1;
- se= screen_findedge(G.curscreen, sa->v2, sa->v3);
- if(se==0) printf("error: area %d edge 2 bestaat niet\n", a);
- else se->flag= 1;
- se= screen_findedge(G.curscreen, sa->v3, sa->v4);
- if(se==0) printf("error: area %d edge 3 bestaat niet\n", a);
- else se->flag= 1;
- se= screen_findedge(G.curscreen, sa->v4, sa->v1);
- if(se==0) printf("error: area %d edge 4 bestaat niet\n", a);
- else se->flag= 1;
- sa= sa->next;
- a++;
- }
- se= G.curscreen->edgebase.first;
- while(se) {
- sen= se->next;
- if(se->flag==0) {
- BLI_remlink(&G.curscreen->edgebase, se);
- MEM_freeN(se);
- }
- else se->flag= 0;
- se= sen;
- }
-}
-
-void calc_arearcts(ScrArea *sa)
-{
-
- if(sa->v1->vec.x>0) sa->totrct.xmin= sa->v1->vec.x+1;
- else sa->totrct.xmin= sa->v1->vec.x;
- if(sa->v4->vec.x<G.curscreen->sizex-1) sa->totrct.xmax= sa->v4->vec.x-1;
- else sa->totrct.xmax= sa->v4->vec.x;
-
- if(sa->v1->vec.y>0) sa->totrct.ymin= sa->v1->vec.y+1;
- else sa->totrct.ymin= sa->v1->vec.y;
- if(sa->v2->vec.y<G.curscreen->sizey-1) sa->totrct.ymax= sa->v2->vec.y-1;
- else sa->totrct.ymax= sa->v2->vec.y;
-
- sa->winrct= sa->totrct;
- sa->headrct= sa->totrct;
- if(sa->headertype) {
- if(sa->headertype==HEADERDOWN) {
- sa->headrct.ymax= sa->headrct.ymin+HEADERY;
- sa->winrct.ymin= sa->headrct.ymax+1;
- }
- else if(sa->headertype==HEADERTOP) {
- sa->headrct.ymin= sa->headrct.ymax-HEADERY;
- sa->winrct.ymax= sa->headrct.ymin-1;
- }
- }
- else {
- sa->headrct.ymax= sa->headrct.ymin;
- }
- if(sa->winrct.ymin>sa->winrct.ymax) sa->winrct.ymin= sa->winrct.ymax;
-
- /* for speedup */
- sa->winx= sa->winrct.xmax-sa->winrct.xmin+1;
- sa->winy= sa->winrct.ymax-sa->winrct.ymin+1;
-}
-
-static void openheadwin(ScrArea *sa)
-{
- sa->headwin= myswinopen(G.curscreen->mainwin,
- sa->headrct.xmin, sa->headrct.xmax, sa->headrct.ymin, sa->headrct.ymax);
-
- glMatrixMode(GL_MODELVIEW);
-
- areawinar[sa->headwin]= sa; /* otherwise addqueue does not work */
-
- scrarea_do_headchange(sa); /* headchange is no callback, apply right away. this is for render-to-imagewindow... this can be called on startup by sequencer, which invokes redraw before all events are handled. bad stuff... */
- addqueue(sa->headwin, CHANGED, 1);
-}
-
-static void openareawin(ScrArea *sa)
-{
- sa->win= myswinopen(G.curscreen->mainwin,
- sa->winrct.xmin, sa->winrct.xmax, sa->winrct.ymin, sa->winrct.ymax);
-
- areawinar[sa->win]= sa; /* otherwise addqueue does not work */
- addqueue(sa->win, CHANGED, 1);
-}
-
-static void closeheadwin(ScrArea *sa)
-{
- if(sa->headwin) mywinclose(sa->headwin);
- sa->headwin= 0;
-}
-
-static void closeareawin(ScrArea *sa)
-{
- uiFreeBlocksWin(&sa->uiblocks, sa->win);
-
- if(sa->win) mywinclose(sa->win);
- sa->win= 0;
-}
-
-static void del_area(ScrArea *sa)
-{
- closeareawin(sa);
- closeheadwin(sa);
-
- freespacelist(sa);
-
- uiFreeBlocks(&sa->uiblocks);
- uiFreePanels(&sa->panels);
-
- BPY_free_scriptlink(&sa->scriptlink);
-
- if(sa==curarea) curarea= NULL;
- if(sa==g_activearea) g_activearea= NULL;
-}
-
-/* sa2 to sa1, we swap spaces for fullscreen to keep all allocated data */
-static void copy_areadata(ScrArea *sa1, ScrArea *sa2, int swap_space)
-{
- Panel *pa1, *pa2, *patab;
- ScriptLink *slink1 = &sa1->scriptlink, *slink2 = &sa2->scriptlink;
-
- sa1->headertype= sa2->headertype;
- sa1->spacetype= sa2->spacetype;
- Mat4CpyMat4(sa1->winmat, sa2->winmat);
-
- if(swap_space) {
- SWAP(ListBase, sa1->spacedata, sa2->spacedata);
- /* exception: ensure preview is reset */
- if(sa1->spacetype==SPACE_VIEW3D)
- BIF_view3d_previewrender_free(sa1->spacedata.first);
- }
- else {
- freespacelist(sa1);
- duplicatespacelist(sa1, &sa1->spacedata, &sa2->spacedata);
- }
-
- BLI_freelistN(&sa1->panels);
- duplicatelist(&sa1->panels, &sa2->panels);
-
- /* space handler script links */
- if (slink1->totscript) {
- MEM_freeN(slink1->scripts);
- MEM_freeN(slink1->flag);
- slink1->totscript = 0;
- }
- if (slink2->totscript) {
- slink1->scripts = MEM_dupallocN(slink2->scripts);
- slink1->flag = MEM_dupallocN(slink2->flag);
- slink1->totscript = slink2->totscript;
- }
-
- /* copy pointers */
- pa1= sa1->panels.first;
- while(pa1) {
-
- patab= sa1->panels.first;
- pa2= sa2->panels.first;
- while(patab) {
- if( pa1->paneltab == pa2) {
- pa1->paneltab = patab;
- break;
- }
- patab= patab->next;
- pa2= pa2->next;
- }
- pa1= pa1->next;
- }
-}
-
-static ScrArea *screen_addarea(bScreen *sc, ScrVert *v1, ScrVert *v2, ScrVert *v3, ScrVert *v4, short headertype, short spacetype)
-{
- ScrArea *sa= MEM_callocN(sizeof(ScrArea), "addscrarea");
- sa->cursor= CURSOR_STD;
- sa->v1= v1;
- sa->v2= v2;
- sa->v3= v3;
- sa->v4= v4;
- sa->headertype= headertype;
- sa->spacetype= spacetype;
-
- calc_arearcts(sa);
-
- if (sa->headertype) openheadwin(sa);
- openareawin(sa);
-
- BLI_addtail(&sc->areabase, sa);
- return sa;
-}
-
-static int rcti_eq(rcti *a, rcti *b) {
- return ((a->xmin==b->xmin && a->xmax==b->xmax) &&
- (a->ymin==b->ymin && a->ymax==b->ymax));
-}
-
-static void testareas(void)
-{
- ScrArea *sa, *next;
-
- /* test for header, if removed, or moved */
- /* test for window, if removed, or moved */
-
- for(sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- rcti oldhr= sa->headrct;
- rcti oldwr= sa->winrct;
-
- next= sa->next;
-
- calc_arearcts(sa);
-
- /* ilegally scaled down area.... */
- if(sa->totrct.xmin>=sa->totrct.xmax || sa->totrct.ymin>=sa->totrct.ymax) {
- del_area(sa);
- BLI_remlink(&G.curscreen->areabase, sa);
- MEM_freeN(sa);
- printf("Warning, removed zero sized window from screen %s\n", G.curscreen->id.name+2);
- }
- else {
- /* test header */
- if (sa->headwin) {
- if (!rcti_eq(&oldhr, &sa->headrct)) {
- mywinposition(sa->headwin, sa->headrct.xmin, sa->headrct.xmax, sa->headrct.ymin, sa->headrct.ymax);
- addqueue(sa->headwin, CHANGED, 1);
- }
-
- if(sa->headbutlen<sa->winx) {
- sa->headbutofs= 0;
- addqueue(sa->headwin, CHANGED, 1);
- }
- else if(sa->headbutofs+sa->winx > sa->headbutlen) {
- sa->headbutofs= sa->headbutlen-sa->winx;
- addqueue(sa->headwin, CHANGED, 1);
- }
- }
-
- if (!rcti_eq(&oldwr, &sa->winrct)) {
- SpaceLink *sl= sa->spacedata.first;
-
- mywinposition(sa->win, sa->winrct.xmin, sa->winrct.xmax, sa->winrct.ymin, sa->winrct.ymax);
- addqueue(sa->win, CHANGED, 1);
-
- /* exception handling... probably we need generic event */
- for(; sl; sl= sl->next)
- if(sl->spacetype==SPACE_VIEW3D)
- BIF_view3d_previewrender_free((View3D *)sl);
- }
- }
- }
-
- /* remake global windowarray */
- memset(areawinar, 0, sizeof(void *)*MAXWIN);
- for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- areawinar[sa->headwin]= sa;
- areawinar[sa->win]= sa;
- }
-
- /* test if winakt is OK */
- if( areawinar[G.curscreen->winakt]==0) G.curscreen->winakt= 0;
-}
-
-static ScrArea *test_edge_area(ScrArea *sa, ScrEdge *se)
-{
- /* test if edge is in area, if not,
- then find an area that has it */
-
- ScrEdge *se1=0, *se2=0, *se3=0, *se4=0;
-
- if(sa) {
- se1= screen_findedge(G.curscreen, sa->v1, sa->v2);
- se2= screen_findedge(G.curscreen, sa->v2, sa->v3);
- se3= screen_findedge(G.curscreen, sa->v3, sa->v4);
- se4= screen_findedge(G.curscreen, sa->v4, sa->v1);
- }
- if(se1!=se && se2!=se && se3!=se && se4!=se) {
-
- sa= G.curscreen->areabase.first;
- while(sa) {
- /* a bit optimise? */
- if(se->v1==sa->v1 || se->v1==sa->v2 || se->v1==sa->v3 || se->v1==sa->v4) {
- se1= screen_findedge(G.curscreen, sa->v1, sa->v2);
- se2= screen_findedge(G.curscreen, sa->v2, sa->v3);
- se3= screen_findedge(G.curscreen, sa->v3, sa->v4);
- se4= screen_findedge(G.curscreen, sa->v4, sa->v1);
- if(se1==se || se2==se || se3==se || se4==se) return sa;
- }
- sa= sa->next;
- }
- }
-
- return sa; /* is null when not find */
-}
-
-ScrArea *closest_bigger_area(void)
-{
- ScrArea *sa, *big=0;
- float cent[3], vec[3],len, len1, len2, len3, dist=1000;
- short mval[2];
-
- getmouseco_sc(mval);
-
- cent[0]= mval[0];
- cent[1]= mval[1];
- cent[2]= vec[2]= 0;
-
- sa= G.curscreen->areabase.first;
- while(sa) {
- if(sa!=curarea) {
- if(sa->winy>=curarea->winy) {
-
- /* mimimum of the 4 corners */
- vec[0]= sa->v1->vec.x; vec[1]= sa->v1->vec.y;
- len= VecLenf(vec, cent);
- vec[0]= sa->v2->vec.x; vec[1]= sa->v2->vec.y;
- len1= VecLenf(vec, cent);
- vec[0]= sa->v3->vec.x; vec[1]= sa->v3->vec.y;
- len2= VecLenf(vec, cent);
- vec[0]= sa->v4->vec.x; vec[1]= sa->v4->vec.y;
- len3= VecLenf(vec, cent);
-
- len= MIN4(len, len1, len2, len3);
-
- /* plus center */
- vec[0]= (sa->v2->vec.x+sa->v3->vec.x)/2;
- vec[1]= (sa->v1->vec.y+sa->v2->vec.y)/2;
-
- len+= 0.5*VecLenf(vec, cent);
-
- /* min size */
- len-= sa->winy+sa->winx;
-
- if(len<dist) {
- dist= len;
- big= sa;
- }
- }
- }
- sa= sa->next;
- }
-
- if(big) return big;
- else return curarea;
-}
-
-/* ************ SCREEN MANAGEMENT ************** */
-
-static int statechanged= 0;
-void BIF_wait_for_statechange(void)
-{
- if (!statechanged) {
- /* Safety, don't wait more than 0.1 seconds */
- double stime= PIL_check_seconds_timer();
- while (!statechanged) {
- winlay_process_events(1);
- if ((PIL_check_seconds_timer()-stime)>0.1) break;
- }
- statechanged= 0;
- }
- else PIL_sleep_ms(3); /* statechanged can be set '1' while holding mousebutton, causing locks */
-
-}
-void getmouse(short *mval)
-{
- winlay_process_events(0);
- window_get_mouse(mainwin, mval);
-}
-short get_qual(void)
-{
- winlay_process_events(0);
- return window_get_qual(mainwin);
-}
-short get_mbut(void)
-{
- winlay_process_events(0);
- return window_get_mbut(mainwin);
-}
-
-/* return values of tablet data related functions are documented
- * in the Window struct, ghostwinlay.c */
-float get_pressure(void)
-{
- winlay_process_events(0);
- return window_get_pressure(mainwin);
-}
-void get_tilt(float *xtilt, float *ytilt)
-{
- winlay_process_events(0);
- window_get_tilt(mainwin, xtilt, ytilt);
-}
-short get_activedevice(void)
-{
- winlay_process_events(0);
- return window_get_activedevice(mainwin);
-}
-
-void add_to_mainqueue(Window *win, void *user_data, short evt, short val, char ascii)
-{
-
- statechanged= 1;
-
- /* accept the extended ascii set (ton) */
- if( !val || ascii<32 ) {
- ascii= '\0';
- }
-
- mainqenter_ext(evt, val, ascii);
-}
-
-/* ScrVert ordering in a ScrArea:
-
-2---------3
-| |
-| |
-1---------4
-
-*/
-
-static bScreen *addscreen(char *name) /* use setprefsize() if you want something else than a full windpw */
-{
- /* this function sets variabele G.curscreen,
- * that global is about used everywhere!
- */
- bScreen *sc;
- ScrVert *sv1, *sv2, *sv3, *sv4;
- short startx, starty, endx, endy;
-
- sc= G.curscreen= alloc_libblock(&G.main->screen, ID_SCR, name);
-
- if (!prefsizx) {
- prefstax= 0;
- prefstay= 0;
-
- winlay_get_screensize(&prefsizx, &prefsizy);
- }
-
- startx= prefstax;
- starty= prefstay;
- endx= prefstax+prefsizx-1;
- endy= prefstay+prefsizy-1;
-
- sc->startx= startx; sc->starty= starty;
- sc->endx= endx; sc->endy= endy;
- sc->sizex= sc->endx-sc->startx+1;
- sc->sizey= sc->endy-sc->starty+1;
-
- sc->scene= G.scene;
-
- if (!mainwin) {
- if (G.windowstate == G_WINDOWSTATE_FULLSCREEN)
- mainwin= window_open("Blender", sc->startx, sc->starty, sc->sizex, sc->sizey, G_WINDOWSTATE_FULLSCREEN);
- else
- mainwin= window_open("Blender", sc->startx, sc->starty, sc->sizex, sc->sizey, start_maximized);
-
- if (!mainwin) {
- printf("ERROR: Unable to open Blender window\n");
- exit(1);
- }
-
- window_set_handler(mainwin, add_to_mainqueue, NULL);
- init_mainwin();
- mywinset(1);
-
- /* for visual speed, but still needed? */
- glClearColor(.55, .55, .55, 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
- window_swap_buffers(mainwin);
-
- /* this is unneeded and with large monitors can be a
- * pain so commenting out */
- /* warp_pointer(sc->sizex/2, sc->sizey/2); */
-
- mainqenter(REDRAW, 1);
- }
-
- sc->mainwin= 1;
-
- sv1= screen_addvert(sc, 0, 0);
- sv2= screen_addvert(sc, 0, sc->endy-sc->starty);
- sv3= screen_addvert(sc, sc->sizex-1, sc->sizey-1);
- sv4= screen_addvert(sc, sc->sizex-1, 0);
-
- screen_addedge(sc, sv1, sv2);
- screen_addedge(sc, sv2, sv3);
- screen_addedge(sc, sv3, sv4);
- screen_addedge(sc, sv4, sv1);
-
- screen_addarea(sc, sv1, sv2, sv3, sv4, HEADERDOWN, SPACE_INFO);
-
- G.curscreen= sc;
-
- return sc;
-}
-
-void setscreen(bScreen *sc)
-{
- bScreen *sc1;
- ScrArea *sa;
- short mval[2];
-
- if(sc->full) { /* find associated full */
- sc1= G.main->screen.first;
- while(sc1) {
- sa= sc1->areabase.first;
- if(sa->full==sc) {
- sc= sc1;
- break;
- }
- sc1= sc1->id.next;
- }
- if(sc1==0) printf("setscreen error\n");
- }
-
- /* de-activate G.curscreen */
- if (G.curscreen && G.curscreen != sc) {
- sa= G.curscreen->areabase.first;
- while(sa) {
- if(sa->win) mywinclose(sa->win);
- sa->win= 0;
- if(sa->headwin) mywinclose(sa->headwin);
- sa->headwin= 0;
-
- uiFreeBlocks(&sa->uiblocks);
-
- sa= sa->next;
- }
- }
- else if(G.curscreen) markdirty_all(); /* at least redraw */
-
- if (G.curscreen != sc) {
- mywinset(sc->mainwin);
- }
-
- G.curscreen= sc;
-
- for (sa= sc->areabase.first; sa; sa= sa->next) {
- /* XXX, fixme zr */
-/* if (sa->win || sa->headwin) */
-/* printf("error in setscreen (win): %d, %d\n", sa->win, sa->headwin); */
- if (!sa->win)
- openareawin(sa);
- if (!sa->headwin && sa->headertype)
- openheadwin(sa);
- }
-
- /* recalculate winakt */
- getmouseco_sc(mval);
-
- test_scale_screen(sc);
- testareas();
-
- for(sa= sc->areabase.first; sa; sa= sa->next) {
- SpaceLink *sl;
-
- for(sl= sa->spacedata.first; sl; sl= sl->next) {
- sl->area= sa;
-
- if(sl->spacetype==SPACE_OOPS) {
- SpaceOops *soops= (SpaceOops *) sl;
-
- /* patch for old files */
- if(soops->v2d.cur.xmin==soops->v2d.cur.xmax) {
- init_v2d_oops(sa, soops);
- }
- }
- else if(sl->spacetype==SPACE_BUTS) {
- SpaceButs *sbuts= (SpaceButs *)sl;
- sbuts->re_align= 1; // force an align call, maybe new panels were added, also for after file reading
- }
- }
-
- sa->cursor= CURSOR_STD;
- }
-
- if(G.scene!=sc->scene)
- set_scene(sc->scene);
-
- countall();
-
- G.curscreen->winakt= 0;
- curarea= sc->areabase.first;
-
- mainqenter(DRAWEDGES, 1);
- dodrawscreen= 1; /* patch! even gets lost,,,? */
-
- winqueue_break= 1; /* means leave queue everywhere */
-}
-
-static void splitarea(ScrArea *sa, char dir, float fac);
-
-void area_fullscreen(void) /* with curarea */
-{
- /* this function toggles: if area is full then the parent will be restored */
- bScreen *sc, *oldscreen;
- ScrArea *sa, *newa, *old;
- short headertype, fulltype;
-
- if(curarea->full) {
- sc= curarea->full; /* the old screen */
- fulltype = sc->full;
-
- // refuse to go out of SCREENAUTOPLAY as long as G_FLAGS_AUTOPLAY
- // is set
-
- if (fulltype != SCREENAUTOPLAY || (G.flags & G_FILE_AUTOPLAY) == 0) {
- sc->full= 0;
-
- /* find old area */
- old= sc->areabase.first;
- while(old) {
- if(old->full) break;
- old= old->next;
- }
- if(old==0) {error("something wrong in areafullscreen"); return;}
-
- if (fulltype == SCREENAUTOPLAY) {
- // in autoplay screens the headers are disabled by
- // default. So use the old headertype instead
- headertype = old->headertype;
- } else {
- // normal fullscreen. Use current headertype
- headertype = curarea->headertype;
- }
-
- copy_areadata(old, curarea, 1); /* 1 = swap spacelist */
- old->headertype = headertype;
-
- old->full= 0;
-
- unlink_screen(G.curscreen);
- free_libblock(&G.main->screen, G.curscreen);
- G.curscreen= NULL;
-
- setscreen(sc);
- }
-
- }
- else {
- /* is there only 1 area? */
- if(G.curscreen->areabase.first==G.curscreen->areabase.last) return;
- if(curarea->spacetype==SPACE_INFO) return;
-
- G.curscreen->full = SCREENFULL;
-
- old= curarea;
- oldscreen= G.curscreen;
- sc= addscreen("temp"); /* this sets G.curscreen */
-
- splitarea( (ScrArea *)sc->areabase.first, 'h', 0.99);
- newa= sc->areabase.first;
- newspace(newa->next, SPACE_INFO);
-
- curarea= old;
- G.curscreen= oldscreen; /* needed because of setscreen */
-
- /* copy area */
- copy_areadata(newa, curarea, 1); /* 1 = swap spacelist */
-
- curarea->full= oldscreen;
- newa->full= oldscreen;
- newa->next->full= oldscreen;
-
- setscreen(sc);
- wich_cursor(newa);
- }
-
- /* there's also events in queue for this, but we call fullscreen for render output
- now, and that doesn't go back to queue. Bad code, but doesn't hurt... (ton) */
- for(sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- scrarea_do_headchange(sa);
- scrarea_do_winchange(sa);
- }
- /* bad code #2: setscreen() ends with first area active. fullscreen render assumes this too */
- curarea= sc->areabase.first;
-
- retopo_force_update();
-}
-
-static void area_autoplayscreen(void)
-{
- bScreen *sc, *oldscreen;
- ScrArea *newa, *old, *sa;
-
- if (curarea->full) {
- area_fullscreen();
- }
-
- if (curarea->full == NULL) {
- sa = G.curscreen->areabase.first;
- while (sa) {
- if (sa->spacetype == SPACE_VIEW3D) {
- break;
- }
- sa= sa->next;
- }
-
- if (sa) {
- areawinset(sa->win);
- G.curscreen->full = SCREENAUTOPLAY;
-
- old= curarea;
- oldscreen= G.curscreen;
- sc= addscreen("temp"); /* this sets G.curscreen */
-
- newa= sc->areabase.first;
-
- curarea= old;
- G.curscreen= oldscreen; /* because of setscreen */
-
- /* copy area settings */
- copy_areadata(newa, curarea, 1); /* swap spacedata */
- newa->headertype= 0;
-
- curarea->full= oldscreen;
- newa->full= oldscreen;
-
- setscreen(sc);
- wich_cursor(newa);
- }
- }
-}
-
-static void copy_screen(bScreen *to, bScreen *from)
-{
- ScrVert *s1, *s2;
- ScrEdge *se;
- ScrArea *sa, *saf;
-
- /* free 'to' */
- free_screen(to);
- winqueue_break= 1; /* leave queues everywhere */
-
- duplicatelist(&to->vertbase, &from->vertbase);
- duplicatelist(&to->edgebase, &from->edgebase);
- duplicatelist(&to->areabase, &from->areabase);
-
- s1= from->vertbase.first;
- s2= to->vertbase.first;
- while(s1) {
- s1->newv= s2;
- s2= s2->next;
- s1= s1->next;
- }
- se= to->edgebase.first;
- while(se) {
- se->v1= se->v1->newv;
- se->v2= se->v2->newv;
- sortscrvert(&(se->v1), &(se->v2));
- se= se->next;
- }
-
- sa= to->areabase.first;
- saf= from->areabase.first;
- while(sa) {
- sa->v1= sa->v1->newv;
- sa->v2= sa->v2->newv;
- sa->v3= sa->v3->newv;
- sa->v4= sa->v4->newv;
- sa->win= 0;
- sa->headwin= 0;
-
- sa->spacedata.first= sa->spacedata.last= NULL;
- sa->uiblocks.first= sa->uiblocks.last= NULL;
- sa->panels.first= sa->panels.last= NULL;
- sa->scriptlink.totscript= 0;
-
- copy_areadata(sa, saf, 0);
-
- sa= sa->next;
- saf= saf->next;
- }
-
- /* put at zero (needed?) */
- s1= from->vertbase.first;
- while(s1) {
- s1->newv= 0;
- s1= s1->next;
- }
-}
-
-void duplicate_screen(void)
-{
- bScreen *sc, *oldscreen;
-
- if(G.curscreen->full != SCREENNORMAL) return;
-
- /* make new screen: */
-
- oldscreen= G.curscreen;
- sc= addscreen(oldscreen->id.name+2); /* this sets G.curscreen */
- copy_screen(sc, oldscreen);
-
- G.curscreen= oldscreen;
- setscreen(sc);
-
-}
-
-
-/* ************ END SCREEN MANAGEMENT ************** */
-/* ************ JOIN/SPLIT/MOVE ************** */
-
-typedef struct point{
- float x,y;
-}_point;
-
-/* draw vertical shape visualising future joining (left as well
- * right direction of future joining) */
-static void draw_horizontal_join_shape(ScrArea *sa, char dir)
-{
- _point points[10];
- short i;
- float w, h;
- float width = sa->v3->vec.x - sa->v1->vec.x;
- float height = sa->v3->vec.y - sa->v1->vec.y;
-
- if(height<width) {
- h = height/8;
- w = height/4;
- }
- else {
- h = width/8;
- w = width/4;
- }
-
- points[0].x = sa->v1->vec.x;
- points[0].y = sa->v1->vec.y + height/2;
-
- points[1].x = sa->v1->vec.x;
- points[1].y = sa->v1->vec.y;
-
- points[2].x = sa->v4->vec.x - w;
- points[2].y = sa->v4->vec.y;
-
- points[3].x = sa->v4->vec.x - w;
- points[3].y = sa->v4->vec.y + height/2 - 2*h;
-
- points[4].x = sa->v4->vec.x - 2*w;
- points[4].y = sa->v4->vec.y + height/2;
-
- points[5].x = sa->v4->vec.x - w;
- points[5].y = sa->v4->vec.y + height/2 + 2*h;
-
- points[6].x = sa->v3->vec.x - w;
- points[6].y = sa->v3->vec.y;
-
- points[7].x = sa->v2->vec.x;
- points[7].y = sa->v2->vec.y;
-
- points[8].x = sa->v4->vec.x;
- points[8].y = sa->v4->vec.y + height/2 - h;
-
- points[9].x = sa->v4->vec.x;
- points[9].y = sa->v4->vec.y + height/2 + h;
-
- if(dir=='l') {
- /* when direction is left, then we flip direction of arrow */
- float cx = sa->v1->vec.x + width;
- for(i=0;i<10;i++) {
- points[i].x -= cx;
- points[i].x = -points[i].x;
- points[i].x += sa->v1->vec.x;
- }
- }
-
- glBegin(GL_POLYGON);
- for(i=0;i<5;i++)
- glVertex2f(points[i].x, points[i].y);
- glEnd();
- glBegin(GL_POLYGON);
- for(i=4;i<8;i++)
- glVertex2f(points[i].x, points[i].y);
- glVertex2f(points[0].x, points[0].y);
- glEnd();
-
- glRectf(points[2].x, points[2].y, points[8].x, points[8].y);
- glRectf(points[6].x, points[6].y, points[9].x, points[9].y);
-}
-
-/* draw vertical shape visualising future joining (up/down direction) */
-static void draw_vertical_join_shape(ScrArea *sa, char dir)
-{
- _point points[10];
- short i;
- float w, h;
- float width = sa->v3->vec.x - sa->v1->vec.x;
- float height = sa->v3->vec.y - sa->v1->vec.y;
-
- if(height<width) {
- h = height/4;
- w = height/8;
- }
- else {
- h = width/4;
- w = width/8;
- }
-
- points[0].x = sa->v1->vec.x + width/2;
- points[0].y = sa->v3->vec.y;
-
- points[1].x = sa->v2->vec.x;
- points[1].y = sa->v2->vec.y;
-
- points[2].x = sa->v1->vec.x;
- points[2].y = sa->v1->vec.y + h;
-
- points[3].x = sa->v1->vec.x + width/2 - 2*w;
- points[3].y = sa->v1->vec.y + h;
-
- points[4].x = sa->v1->vec.x + width/2;
- points[4].y = sa->v1->vec.y + 2*h;
-
- points[5].x = sa->v1->vec.x + width/2 + 2*w;
- points[5].y = sa->v1->vec.y + h;
-
- points[6].x = sa->v4->vec.x;
- points[6].y = sa->v4->vec.y + h;
-
- points[7].x = sa->v3->vec.x;
- points[7].y = sa->v3->vec.y;
-
- points[8].x = sa->v1->vec.x + width/2 - w;
- points[8].y = sa->v1->vec.y;
-
- points[9].x = sa->v1->vec.x + width/2 + w;
- points[9].y = sa->v1->vec.y;
-
- if(dir=='u') {
- /* when direction is up, then we flip direction of arrow */
- float cy = sa->v1->vec.y + height;
- for(i=0;i<10;i++) {
- points[i].y -= cy;
- points[i].y = -points[i].y;
- points[i].y += sa->v1->vec.y;
- }
- }
-
- glBegin(GL_POLYGON);
- for(i=0;i<5;i++)
- glVertex2f(points[i].x, points[i].y);
- glEnd();
- glBegin(GL_POLYGON);
- for(i=4;i<8;i++)
- glVertex2f(points[i].x, points[i].y);
- glVertex2f(points[0].x, points[0].y);
- glEnd();
-
- glRectf(points[2].x, points[2].y, points[8].x, points[8].y);
- glRectf(points[6].x, points[6].y, points[9].x, points[9].y);
-}
-
-/* draw join shape due to direction of joining */
-static void draw_join_shape(ScrArea *sa, char dir)
-{
- if(dir=='u' || dir=='d')
- draw_vertical_join_shape(sa, dir);
- else
- draw_horizontal_join_shape(sa, dir);
-}
-
-/* draw screen area darker with arrow (visualisation of future joining) */
-static void scrarea_draw_shape_dark(ScrArea *sa, char dir)
-{
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
- glColor4ub(0, 0, 0, 105);
- draw_join_shape(sa, dir);
- glDisable(GL_BLEND);
-}
-
-/* draw screen area ligher with arrow shape ("eraser" of previous dark shape) */
-static void scrarea_draw_shape_light(ScrArea *sa, char dir)
-{
- glBlendFunc(GL_DST_COLOR, GL_SRC_ALPHA);
- glEnable(GL_BLEND);
- /* value 181 was hardly computed: 181~105 */
- glColor4ub(255, 255, 255, 181);
- draw_join_shape(sa, dir);
- glDisable(GL_BLEND);
-}
-
-static void joinarea_interactive(ScrArea *area, ScrEdge *onedge)
-{
- struct ScrArea *sa1 = area, *sa2, *scr;
- struct ScrArea *up=0, *down=0, *right=0, *left=0;
- struct ScrEdge *se;
- unsigned short event;
- short ok=0, val=0, mval[2];
- char dir=0;
-
- sa1 = test_edge_area(sa1, onedge);
- if(sa1==0) return;
-
- /* find directions with same edge */
- sa2= G.curscreen->areabase.first;
- while(sa2) {
- if(sa2 != sa1) {
- se= screen_findedge(G.curscreen, sa2->v1, sa2->v2);
- if(onedge==se) right= sa2;
- se= screen_findedge(G.curscreen, sa2->v2, sa2->v3);
- if(onedge==se) down= sa2;
- se= screen_findedge(G.curscreen, sa2->v3, sa2->v4);
- if(onedge==se) left= sa2;
- se= screen_findedge(G.curscreen, sa2->v4, sa2->v1);
- if(onedge==se) up= sa2;
- }
- sa2= sa2->next;
- }
-
- if(left) val++;
- if(up) val++;
- if(right) val++;
- if(down) val++;
-
- if(val==0) return;
- else if(val==1) {
- if(left) {
- right = sa1;
- sa2 = left;
- dir = 'h';
- }
- else if(right) {
- left = sa1;
- sa2 = right;
- dir = 'h';
- }
- else if(up) {
- down = sa1;
- sa2= up;
- dir = 'v';
- }
- else if(down) {
- up = sa1;
- sa2 = down;
- dir = 'v';
- }
- }
-
- mywinset(G.curscreen->mainwin);
-
- /* initial set up screen area asigned for destroying */
- scr = sa2;
-
- /* set up standard cursor */
- set_cursor(CURSOR_STD);
-
- /* should already have a good matrix */
- glReadBuffer(GL_FRONT);
- glDrawBuffer(GL_FRONT);
-
- /* to prevent flickering after clicking at "Join Areas " */
- getmouseco_sc(mval);
- if(dir=='h') {
- if(scr==left && mval[0]>=onedge->v1->vec.x) scr = right;
- else if(scr==right && mval[0]<onedge->v1->vec.x) scr = left;
- }
- else if(dir=='v') {
- if(scr==down && mval[1]>=onedge->v1->vec.y) scr = up;
- else if(scr==up && mval[1]<onedge->v1->vec.y) scr = down;
- }
-
- /* draw scr screen area with dark shape */
- if(scr==left)
- scrarea_draw_shape_dark(scr,'r');
- else if(scr==right)
- scrarea_draw_shape_dark(scr,'l');
- else if(scr==up)
- scrarea_draw_shape_dark(scr,'d');
- else if(scr==down)
- scrarea_draw_shape_dark(scr,'u');
- bglFlush();
-
- /* "never ending loop" of interactive selection */
- while(!ok) {
- getmouseco_sc(mval);
-
- /* test if position of mouse is on the "different side" of
- * "joining edge" */
- if(dir=='h') {
- if(scr==left && mval[0]>=onedge->v1->vec.x) {
- scrarea_draw_shape_light(scr,'r');
- scr = right;
- scrarea_draw_shape_dark(scr,'l');
- }
- else if(scr==right && mval[0]<onedge->v1->vec.x) {
- scrarea_draw_shape_light(scr,'l');
- scr = left;
- scrarea_draw_shape_dark(scr,'r');
- }
- }
- else if(dir=='v') {
- if(scr==down && mval[1]>=onedge->v1->vec.y) {
- scrarea_draw_shape_light(scr,'u');
- scr = up;
- scrarea_draw_shape_dark(scr,'d');
- }
- else if(scr==up && mval[1]<onedge->v1->vec.y){
- scrarea_draw_shape_light(scr,'d');
- scr = down;
- scrarea_draw_shape_dark(scr,'u');
- }
- }
-
-
- /* get pressed keys and mouse buttons */
- event = extern_qread(&val);
-
- /* confirm joining of two screen areas */
- if(val && event==LEFTMOUSE) ok= 1;
-
- /* cancel joining of joining */
- if(val && (event==ESCKEY || event==RIGHTMOUSE)) ok= -1;
-
- bglFlush();
- }
-
- glReadBuffer(GL_BACK);
- glDrawBuffer(GL_BACK);
-
- /* joining af screen areas was confirmed ... proceed joining */
- if(ok==1) {
- if(sa2!=scr) {
- sa1 = sa2;
- sa2 = scr;
- }
-
- if(sa2==left) {
- sa1->v1= sa2->v1;
- sa1->v2= sa2->v2;
- screen_addedge(G.curscreen, sa1->v2, sa1->v3);
- screen_addedge(G.curscreen, sa1->v1, sa1->v4);
- }
- else if(sa2==up) {
- sa1->v2= sa2->v2;
- sa1->v3= sa2->v3;
- screen_addedge(G.curscreen, sa1->v1, sa1->v2);
- screen_addedge(G.curscreen, sa1->v3, sa1->v4);
- }
- else if(sa2==right) {
- sa1->v3= sa2->v3;
- sa1->v4= sa2->v4;
- screen_addedge(G.curscreen, sa1->v2, sa1->v3);
- screen_addedge(G.curscreen, sa1->v1, sa1->v4);
- }
- else if(sa2==down) {
- sa1->v1= sa2->v1;
- sa1->v4= sa2->v4;
- screen_addedge(G.curscreen, sa1->v1, sa1->v2);
- screen_addedge(G.curscreen, sa1->v3, sa1->v4);
- }
-
- del_area(sa2);
- BLI_remlink(&G.curscreen->areabase, sa2);
- MEM_freeN(sa2);
-
- removedouble_scredges();
- removenotused_scredges();
- removenotused_scrverts();
-
- testareas();
- mainqenter(DRAWEDGES, 1);
-
- /* test cursor en inputwindow */
- mainqenter(MOUSEY, -1);
- }
-}
-
-static short testsplitpoint(ScrArea *sa, char dir, float fac)
-/* return 0: no split possible */
-/* else return (integer) screencoordinate split point */
-{
- short x, y;
-
- /* area big enough? */
- if(sa->v4->vec.x- sa->v1->vec.x <= 2*AREAMINX) return 0;
- if(sa->v2->vec.y- sa->v1->vec.y <= 2*AREAMINY) return 0;
-
- /* to be sure */
- if(fac<0.0) fac= 0.0;
- if(fac>1.0) fac= 1.0;
-
- if(dir=='h') {
- y= sa->v1->vec.y+ fac*(sa->v2->vec.y- sa->v1->vec.y);
-
- if(sa->v2->vec.y==G.curscreen->sizey-1 && sa->v2->vec.y- y < HEADERY)
- y= sa->v2->vec.y- HEADERY;
-
- else if(sa->v1->vec.y==0 && y- sa->v1->vec.y < HEADERY)
- y= sa->v1->vec.y+ HEADERY;
-
- else if(y- sa->v1->vec.y < AREAMINY) y= sa->v1->vec.y+ AREAMINY;
- else if(sa->v2->vec.y- y < AREAMINY) y= sa->v2->vec.y- AREAMINY;
- else y-= (y % AREAGRID);
-
- return y;
- }
- else {
- x= sa->v1->vec.x+ fac*(sa->v4->vec.x- sa->v1->vec.x);
- if(x- sa->v1->vec.x < AREAMINX) x= sa->v1->vec.x+ AREAMINX;
- else if(sa->v4->vec.x- x < AREAMINX) x= sa->v4->vec.x- AREAMINX;
- else x-= (x % AREAGRID);
-
- return x;
- }
-}
-
-static void splitarea(ScrArea *sa, char dir, float fac)
-{
- bScreen *sc;
- ScrArea *newa=NULL;
- ScrVert *sv1, *sv2;
- short split;
-
- if(sa==0) return;
-
- split= testsplitpoint(sa, dir, fac);
- if(split==0) return;
-
- sc= G.curscreen;
-
- areawinset(sa->win);
-
- if(dir=='h') {
- /* new vertices */
- sv1= screen_addvert(sc, sa->v1->vec.x, split);
- sv2= screen_addvert(sc, sa->v4->vec.x, split);
-
- /* new edges */
- screen_addedge(sc, sa->v1, sv1);
- screen_addedge(sc, sv1, sa->v2);
- screen_addedge(sc, sa->v3, sv2);
- screen_addedge(sc, sv2, sa->v4);
- screen_addedge(sc, sv1, sv2);
-
- /* new areas: top */
- newa= screen_addarea(sc, sv1, sa->v2, sa->v3, sv2, sa->headertype, sa->spacetype);
- copy_areadata(newa, sa, 0);
-
- /* area below */
- sa->v2= sv1;
- sa->v3= sv2;
-
- }
- else {
- /* new vertices */
- sv1= screen_addvert(sc, split, sa->v1->vec.y);
- sv2= screen_addvert(sc, split, sa->v2->vec.y);
-
- /* new edges */
- screen_addedge(sc, sa->v1, sv1);
- screen_addedge(sc, sv1, sa->v4);
- screen_addedge(sc, sa->v2, sv2);
- screen_addedge(sc, sv2, sa->v3);
- screen_addedge(sc, sv1, sv2);
-
- /* new areas: left */
- newa= screen_addarea(sc, sa->v1, sa->v2, sv2, sv1, sa->headertype, sa->spacetype);
- copy_areadata(newa, sa, 0);
-
- /* area right */
- sa->v1= sv1;
- sa->v2= sv2;
- }
-
- if(sa->spacetype==SPACE_BUTS) {
- addqueue(sa->win, UI_BUT_EVENT, B_BUTSHOME);
- addqueue(newa->win, UI_BUT_EVENT, B_BUTSHOME);
- }
-
- /* remove double vertices en edges */
- removedouble_scrverts();
- removedouble_scredges();
- removenotused_scredges();
-
- mainqenter(DRAWEDGES, 1);
- dodrawscreen= 1; /* patch! event gets lost,,,? */
- testareas();
-}
-
-static void scrarea_draw_splitpoint(ScrArea *sa, char dir, float fac)
-{
- int split= testsplitpoint(sa, dir, fac);
-
- if (split) {
- if(dir=='h') {
- sdrawXORline(sa->totrct.xmin, split, sa->totrct.xmax, split);
- sdrawXORline(sa->totrct.xmin, split-1, sa->totrct.xmax, split-1);
- } else {
- sdrawXORline(split, sa->totrct.ymin, split, sa->totrct.ymax);
- sdrawXORline(split-1, sa->totrct.ymin, split-1, sa->totrct.ymax);
- }
- }
-}
-
-static void splitarea_interactive(ScrArea *area, ScrEdge *onedge)
-{
- ScrArea *scr, *sa= area;
- float fac= 0.0;
- unsigned short event;
- short ok= 0, val, split = 0, mval[2], mvalo[2]= {-1, -1}, first= 1;
- char dir;
-
- if(sa->win==0) return;
- if(sa->full) return;
- if(myswinopen_allowed()==0) {
- error("Max amount of subwindows reached");
- return;
- }
-
- dir= scredge_is_horizontal(onedge)?'v':'h';
-
- mywinset(G.curscreen->mainwin);
- /* should already have a good matrix */
- glReadBuffer(GL_FRONT);
- glDrawBuffer(GL_FRONT);
-
- /* keep track of grid and minsize */
- while(ok==0) {
- getmouseco_sc(mval);
-
- /* this part of code allows to choose, what window will be splited */
- /* cursor is out of the current ScreenArea */
- if((mval[0] < sa->v1->vec.x) || (mval[0] > sa->v3->vec.x) ||
- (mval[1] < sa->v1->vec.y) || (mval[1] > sa->v3->vec.y)){
- scr= (ScrArea*)G.curscreen->areabase.first;
- while(scr){
- if((mval[0] > scr->v1->vec.x) && (mval[0] < scr->v4->vec.x) &&
- (mval[1] < scr->v2->vec.y) && (mval[1] > scr->v1->vec.y)){
- /* test: is ScreenArea enough big for splitting */
- short tsplit= testsplitpoint(scr, dir, fac);
- if(tsplit){
- split = tsplit;
- /* delete old line from previous ScreenArea */
- if(!first) scrarea_draw_splitpoint(sa, dir, fac);
- sa= scr;
- first= 1;
- break;
- }
- }
- scr= scr->next;
- }
- }
-
- if (first || (dir=='v' && mval[0]!=mvalo[0]) || (dir=='h' && mval[1]!=mvalo[1])) {
- if (!first) {
- scrarea_draw_splitpoint(sa, dir, fac);
- }
-
- if(dir=='h') {
- fac= mval[1]- (sa->v1->vec.y);
- fac/= sa->v2->vec.y- sa->v1->vec.y;
- } else {
- fac= mval[0]- sa->v1->vec.x;
- fac/= sa->v4->vec.x- sa->v1->vec.x;
- }
-
- split= testsplitpoint(sa, dir, fac);
- if (split) {
- scrarea_draw_splitpoint(sa, dir, fac);
- } else {
- ok= -1;
- }
-
- mvalo[0]= mval[0];
- mvalo[1]= mval[1];
- first= 0;
- }
-
- event= extern_qread(&val);
-
- /* change direction of splitting between horizontal and vertical
- * patch was offered by Guillaume */
- if(val && (event==TABKEY || event==MIDDLEMOUSE)) {
- scrarea_draw_splitpoint(sa, dir, fac);
- if(dir=='h') {
- dir='v';
- set_cursor(CURSOR_Y_MOVE);
- } else {
- dir='h';
- set_cursor(CURSOR_X_MOVE);
- }
- first= 1;
- }
-
- if(val && event==LEFTMOUSE) {
- if(dir=='h') {
- fac= split- (sa->v1->vec.y);
- fac/= sa->v2->vec.y- sa->v1->vec.y;
- }
- else {
- fac= split- sa->v1->vec.x;
- fac/= sa->v4->vec.x- sa->v1->vec.x;
- }
- ok= 1;
- }
- if(val && (event==ESCKEY || event==RIGHTMOUSE)) {
- ok= -1;
- }
- bglFlush();
- }
-
- if (!first) {
- scrarea_draw_splitpoint(sa, dir, fac);
- bglFlush();
- }
- glReadBuffer(GL_BACK);
- glDrawBuffer(GL_BACK);
-
- if(ok==1) {
- splitarea(sa, dir, fac);
- mainqenter(DRAWEDGES, 1);
- dodrawscreen= 1; /* patch! event gets lost,,,? */
- }
-}
-
-View3D *find_biggest_view3d(void)
-{
- ScrArea *sa= find_biggest_area_of_type(SPACE_VIEW3D);
-
- if (sa) {
- return (View3D*) sa->spacedata.first;
- } else {
- return NULL;
- }
-}
-
-ScrArea *find_biggest_area_of_type(int spacecode)
-{
- ScrArea *sa, *biggest= NULL;
- int bigsize= 0;
-
- for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- if (spacecode==0 || sa->spacetype==spacecode) {
- int x= sa->v3->vec.x - sa->v1->vec.x;
- int y= sa->v3->vec.y - sa->v1->vec.y;
- int size= x*x + y*y;
-
- if (!biggest || size>bigsize) {
- biggest= sa;
- bigsize= size;
- }
- }
- }
-
- return biggest;
-}
-
-ScrArea *find_biggest_area(void)
-{
- return find_biggest_area_of_type(0);
-}
-
-static void select_connected_scredge(bScreen *sc, ScrEdge *edge)
-{
- ScrEdge *se;
- ScrVert *sv;
- int oneselected;
- char dir;
-
- /* select connected, only in the right direction */
- /* 'dir' is the direction of EDGE */
-
- if(edge->v1->vec.x==edge->v2->vec.x) dir= 'v';
- else dir= 'h';
-
- sv= sc->vertbase.first;
- while(sv) {
- sv->flag= 0;
- sv= sv->next;
- }
-
- edge->v1->flag= 1;
- edge->v2->flag= 1;
-
- oneselected= 1;
- while(oneselected) {
- se= sc->edgebase.first;
- oneselected= 0;
- while(se) {
- if(se->v1->flag + se->v2->flag==1) {
- if(dir=='h') if(se->v1->vec.y==se->v2->vec.y) {
- se->v1->flag= se->v2->flag= 1;
- oneselected= 1;
- }
- if(dir=='v') if(se->v1->vec.x==se->v2->vec.x) {
- se->v1->flag= se->v2->flag= 1;
- oneselected= 1;
- }
- }
- se= se->next;
- }
- }
-}
-
-void test_scale_screen(bScreen *sc)
-/* test if screen vertices should be scaled */
-/* also check offset */
-{
- ScrVert *sv=0;
- ScrEdge *se;
- ScrArea *sa, *san;
- int yval;
- float facx, facy, tempf, min[2], max[2];
-
- sc->startx= prefstax;
- sc->starty= prefstay;
- sc->endx= prefstax+prefsizx-1;
- sc->endy= prefstay+prefsizy-1;
-
- /* calculate size */
- sv= sc->vertbase.first;
- min[0]= min[1]= 0.0;
- max[0]= sc->sizex;
- max[1]= sc->sizey;
- while(sv) {
- min[0]= MIN2(min[0], sv->vec.x);
- min[1]= MIN2(min[1], sv->vec.y);
- max[0]= MAX2(max[0], sv->vec.x);
- max[1]= MAX2(max[1], sv->vec.y);
- sv= sv->next;
- }
-
- /* always make 0.0 left under */
- sv= sc->vertbase.first;
- while(sv) {
- sv->vec.x -= min[0];
- sv->vec.y -= min[1];
- sv= sv->next;
- }
-
-
- sc->sizex= max[0]-min[0];
- sc->sizey= max[1]-min[1];
-
- if(sc->sizex!= prefsizx || sc->sizey!= prefsizy) {
- facx= prefsizx;
- facx/= (float)sc->sizex;
- facy= prefsizy;
- facy/= (float)sc->sizey;
-
- /* make sure it fits! */
- sv= sc->vertbase.first;
- while(sv) {
- tempf= ((float)sv->vec.x)*facx;
- sv->vec.x= (short)(tempf+0.5);
- sv->vec.x+= AREAGRID-1;
- sv->vec.x-= (sv->vec.x % AREAGRID);
-
- CLAMP(sv->vec.x, 0, prefsizx);
-
- tempf= ((float)sv->vec.y )*facy;
- sv->vec.y= (short)(tempf+0.5);
- sv->vec.y+= AREAGRID-1;
- sv->vec.y-= (sv->vec.y % AREAGRID);
-
- CLAMP(sv->vec.y, 0, prefsizy);
-
- sv= sv->next;
- }
-
- sc->sizex= prefsizx;
- sc->sizey= prefsizy;
- }
-
- /* test for collapsed areas. This could happen in some blender version... */
- sa= sc->areabase.first;
- while(sa) {
- san= sa->next;
- if(sa->v1==sa->v2 || sa->v3==sa->v4 || sa->v2==sa->v3) {
- del_area(sa);
- BLI_remlink(&sc->areabase, sa);
- MEM_freeN(sa);
- }
- sa= san;
- }
-
- /* make each window at least HEADERY high */
- sa= sc->areabase.first;
- while(sa) {
-
- if(sa->v1->vec.y+HEADERY > sa->v2->vec.y) {
- /* lower edge */
- se= screen_findedge(sc, sa->v4, sa->v1);
- if(se && sa->v1!=sa->v2 ) {
- select_connected_scredge(sc, se);
-
- /* all selected vertices get the right offset */
- yval= sa->v2->vec.y-HEADERY;
- sv= sc->vertbase.first;
- while(sv) {
- /* if is a collapsed area */
- if(sv!=sa->v2 && sv!=sa->v3) {
- if(sv->flag) sv->vec.y= yval;
- }
- sv= sv->next;
- }
- }
- }
-
- sa= sa->next;
- }
-
-}
-
-static void draw_front_xor_dirdist_line(char dir, int dist, int start, int end)
-{
- if (dir=='h') {
- sdrawXORline(start, dist, end, dist);
- sdrawXORline(start, dist+1, end, dist+1);
- } else {
- sdrawXORline(dist, start, dist, end);
- sdrawXORline(dist+1, start, dist+1, end);
- }
-}
-
-static void moveareas(ScrEdge *edge)
-{
- ScrVert *v1;
- ScrArea *sa;
- short mvalo[2], mval_prev=-1;
- short edge_start, edge_end, edge_position;
- short bigger, smaller, headery, areaminy;
- int delta, doit;
- char dir;
-
- if(edge->border) return;
-
- dir= scredge_is_horizontal(edge)?'h':'v';
-
- select_connected_scredge(G.curscreen, edge);
-
- edge_position= (dir=='h')?edge->v1->vec.y:edge->v1->vec.x;
- edge_start= 10000;
- edge_end= -10000;
- for (v1= G.curscreen->vertbase.first; v1; v1= v1->next) {
- if (v1->flag) {
- if (dir=='h') {
- edge_start= MIN2(edge_start, v1->vec.x);
- edge_end= MAX2(edge_end, v1->vec.x);
- } else {
- edge_start= MIN2(edge_start, v1->vec.y);
- edge_end= MAX2(edge_end, v1->vec.y);
- }
- }
- }
-
- /* now all verices with 'flag==1' are the ones that can be moved. */
- /* we check all areas and test for free space with MINSIZE */
- bigger= smaller= 10000;
- sa= G.curscreen->areabase.first;
- while(sa) {
- if(dir=='h') { /* if top or down edge selected, test height */
- if(sa->headertype) {
- headery= HEADERY;
- areaminy= AREAMINY;
- }
- else {
- headery= 0;
- areaminy= AREAMINY; /*areaminy= EDGEWIDTH;*/
- }
-
- if(sa->v1->flag && sa->v4->flag) {
- int y1;
- if(sa->v2->vec.y==G.curscreen->sizey-1) /* top edge */
- y1= sa->v2->vec.y - sa->v1->vec.y-headery-EDGEWIDTH;
- else
- y1= sa->v2->vec.y - sa->v1->vec.y-areaminy;
- bigger= MIN2(bigger, y1);
- }
- else if(sa->v2->flag && sa->v3->flag) {
- int y1;
- if(sa->v1->vec.y==0) /* bottom edge */
- y1= sa->v2->vec.y - sa->v1->vec.y-headery-EDGEWIDTH;
- else
- y1= sa->v2->vec.y - sa->v1->vec.y-areaminy;
- smaller= MIN2(smaller, y1);
- }
- }
- else { /* if left or right edge selected, test width */
- if(sa->v1->flag && sa->v2->flag) {
- int x1= sa->v4->vec.x - sa->v1->vec.x-AREAMINX;
- bigger= MIN2(bigger, x1);
- }
- else if(sa->v3->flag && sa->v4->flag) {
- int x1= sa->v4->vec.x - sa->v1->vec.x-AREAMINX;
- smaller= MIN2(smaller, x1);
- }
- }
- sa= sa->next;
- }
-
- mywinset(G.curscreen->mainwin);
-
- glReadBuffer(GL_FRONT);
- glDrawBuffer(GL_FRONT);
-
- doit= delta= 0;
- getmouseco_sc(mvalo);
- draw_front_xor_dirdist_line(dir, edge_position+delta, edge_start, edge_end);
-
- while (!doit) {
- short val;
- unsigned short event= extern_qread(&val);
-
- if (event==MOUSEY) {
- short mval[2];
-
- getmouseco_sc(mval);
- if ((dir=='h' && mval_prev != mval[1]) || (dir=='v' && mval_prev != mval[0])) {
- /* update the previous val with this one for comparison next loop */
- if (dir=='h') mval_prev = mval[1];
- else mval_prev = mval[0];
-
- draw_front_xor_dirdist_line(dir, edge_position+delta, edge_start, edge_end);
-
- delta= (dir=='h')?(mval[1]-mvalo[1]):(mval[0]-mvalo[0]);
- delta= CLAMPIS(delta, -smaller, bigger);
- draw_front_xor_dirdist_line(dir, edge_position+delta, edge_start, edge_end);
- bglFlush();
- }
- }
- else if (event==LEFTMOUSE) {
- doit= 1;
- }
- else if (val) {
- if (ELEM(event, ESCKEY, RIGHTMOUSE))
- doit= -1;
- else if (ELEM(event, SPACEKEY, RETKEY))
- doit= 1;
- }
- else BIF_wait_for_statechange();
-
- }
- draw_front_xor_dirdist_line(dir, edge_position+delta, edge_start, edge_end);
- bglFlush();
- glReadBuffer(GL_BACK);
- glDrawBuffer(GL_BACK);
-
- if (doit==1) {
- for (v1= G.curscreen->vertbase.first; v1; v1= v1->next) {
- if (v1->flag) {
- /* that way a nice AREAGRID */
- if((dir=='v') && v1->vec.x>0 && v1->vec.x<G.curscreen->sizex-1) {
- v1->vec.x+= delta;
- if(delta != bigger && delta != -smaller) v1->vec.x-= (v1->vec.x % AREAGRID);
- }
- if((dir=='h') && v1->vec.y>0 && v1->vec.y<G.curscreen->sizey-1) {
- v1->vec.y+= delta;
-
- v1->vec.y+= AREAGRID-1;
- v1->vec.y-= (v1->vec.y % AREAGRID);
-
- /* prevent too small top header */
- if(v1->vec.y > G.curscreen->sizey-HEADERY)
- v1->vec.y= G.curscreen->sizey-HEADERY;
- }
- }
- v1->flag= 0;
- }
-
- removedouble_scrverts();
- removedouble_scredges();
- testareas();
- }
-
- mainqenter(DRAWEDGES, 1);
- dodrawscreen= 1; /* patch! event gets lost,,,? */
-}
-
-static void scrollheader(ScrArea *area)
-{
- short mval[2], mvalo[2];
-
- if(area->headbutlen<area->winx) {
- area->headbutofs= 0;
- }
- else if(area->headbutofs+area->winx > area->headbutlen) {
- area->headbutofs= area->headbutlen-area->winx;
- }
-
- getmouseco_sc(mvalo);
-
- while(get_mbut() & M_MOUSE) {
- getmouseco_sc(mval);
- if(mval[0]!=mvalo[0]) {
- area->headbutofs-= (mval[0]-mvalo[0]);
-
- if(area->headbutlen-area->winx < area->headbutofs) area->headbutofs= area->headbutlen-area->winx;
- if(area->headbutofs<0) area->headbutofs= 0;
-
- scrarea_do_headchange(area);
- scrarea_do_headdraw(area);
-
- screen_swapbuffers();
-
- mvalo[0]= mval[0];
- } else {
- BIF_wait_for_statechange();
- }
- }
-}
-
-int select_area(int spacetype)
-{
- /* call from edit routines, when there are more areas
- * of type 'spacetype', you can indicate an area manually
- */
- ScrArea *sa, *sact = NULL;
- int tot=0;
- unsigned short event = 0;
- short val, mval[2];
-
- sa= G.curscreen->areabase.first;
- while(sa) {
- if(sa->spacetype==spacetype) {
- sact= sa;
- tot++;
- }
- sa= sa->next;
- }
-
- if(tot==0) {
- error("Can't do this! Open correct window");
- return 0;
- }
-
- if(tot==1) {
- if(curarea!=sact) areawinset(sact->win);
- return 1;
- }
- else if(tot>1) {
- set_cursor(CURSOR_HELP);
- while(1) {
- event= extern_qread(&val);
-
- if (val) {
- if(event==ESCKEY) break;
- if(event==LEFTMOUSE) break;
- if(event==SPACEKEY) break;
- } else {
- BIF_wait_for_statechange();
- }
- }
- screen_set_cursor(G.curscreen);
-
- /* recalculate winakt */
- getmouseco_sc(mval);
-
- if(event==LEFTMOUSE) {
- ScrArea *sa= screen_find_area_for_pt(G.curscreen, mval);
-
- if (sa &&sa->spacetype==spacetype) {
- G.curscreen->winakt= sa->win;
- areawinset(G.curscreen->winakt);
- } else {
- error("Wrong window");
- return 0;
- }
- }
- }
-
- if(event==LEFTMOUSE) return 1;
- else return 0;
-}
-
-/* ************ END JOIN/SPLIT/MOVE ************** */
-/* **************** DRAW SCREENEDGES ***************** */
-
-
-void draw_area_emboss(ScrArea *sa)
-{
-
- /* set transp line */
- glEnable( GL_BLEND );
- glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
-
- /* right */
- glColor4ub(0,0,0, 50);
- sdrawline(sa->winx-1, 0, sa->winx-1, sa->winy-1);
-
- /* bottom */
- if(sa->headertype!=HEADERDOWN) {
- glColor4ub(0,0,0, 80);
- sdrawline(0, 0, sa->winx-1, 0);
- }
-
- /* top */
- if(sa->headertype!=HEADERTOP) {
- glColor4ub(255,255,255, 60);
- sdrawline(0, sa->winy-1, sa->winx-1, sa->winy-1);
- }
- /* left */
- glColor4ub(255,255,255, 50);
- sdrawline(0, 0, 0, sa->winy);
-
- glDisable( GL_BLEND );
-}
-
-
-void drawscredge_area(ScrArea *sa)
-{
- short x1= sa->v1->vec.x;
- short y1= sa->v1->vec.y;
- short x2= sa->v3->vec.x;
- short y2= sa->v3->vec.y;
-
- /* this to fill the (undrawn) edge area with back color first */
- glColor3f(SCR_BACK,SCR_BACK,SCR_BACK);
- sdrawline(x2, y1, x2, y2);
- sdrawline(x1, y1, x2, y1);
-
- cpack(0x0);
-
- /* Simple hack to make sure round corners arntdrawn with the minimal theme,
- * Nothing wrong with it IMHO, but just be aware its used so the following
- * if's never compare true with HEADERTOP or HEADERDOWN */
- if (BIF_GetThemeValue(TH_BUT_DRAWTYPE) == TH_MINIMAL)
- sa->headertype = -sa->headertype;
-
- /* right border area */
- if(sa->headertype==HEADERTOP) sdrawline(x2, y1, x2, y2-SCR_ROUND+1);
- else if(sa->headertype==HEADERDOWN) sdrawline(x2, y1+SCR_ROUND-1, x2, y2);
- else sdrawline(x2, y1, x2, y2);
-
- /* left border area */
- if(x1>0) { // otherwise it draws the emboss of window over
- if(sa->headertype==HEADERTOP) sdrawline(x1, y1, x1, y2-SCR_ROUND+1);
- else if(sa->headertype==HEADERDOWN) sdrawline(x1, y1+SCR_ROUND-1, x1, y2);
- else sdrawline(x1, y1, x1, y2);
- }
- /* top border area */
- if(sa->headertype==HEADERTOP) sdrawline(x1+SCR_ROUND-3, y2, x2-SCR_ROUND+3, y2);
- else sdrawline(x1, y2, x2, y2);
-
- /* bottom border area */
- if(sa->headertype==HEADERDOWN) sdrawline(x1+SCR_ROUND-3, y1, x2-SCR_ROUND+3, y1);
- else sdrawline(x1, y1, x2, y1);
-
- /* restore real header type */
- if (BIF_GetThemeValue(TH_BUT_DRAWTYPE) == TH_MINIMAL)
- sa->headertype = -sa->headertype;
-}
-
-/* ********************************* */
-
-/* for depgraph updating, all layers visible in a screen */
-unsigned int screen_view3d_layers(void)
-{
- ScrArea *sa;
- int layer= G.scene->lay; /* as minimum this */
-
- for(sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- if(sa->spacetype==SPACE_VIEW3D)
- layer |= ((View3D *)sa->spacedata.first)->lay;
- }
- return layer;
-}
-
-bScreen *default_twosplit()
-{
- bScreen *sc= addscreen("screen");
- ScrArea *sa;
-
- splitarea( (ScrArea *)sc->areabase.first, 'h', 0.99);
- sa= sc->areabase.first;
- newspace(sa, SPACE_VIEW3D);
- newspace(sa->next, SPACE_INFO);
-
- return sc;
-}
-
-void initscreen(void)
-{
- default_twosplit();
-}
-
-static int curcursor;
-
-int get_cursor(void) {
- return curcursor;
-}
-
-void set_cursor(int curs) {
- if (G.background == 0) {
- if (curs!=curcursor) {
- curcursor= curs;
- window_set_cursor(mainwin, curs);
- }
- }
-}
-
-void unlink_screen(bScreen *sc) {
- ScrArea *sa;
-
- for (sa= sc->areabase.first; sa; sa= sa->next)
- del_area(sa);
-}
-
-void warp_pointer(int x, int y)
-{
- window_warp_pointer(mainwin, x, y);
-}
-
-void set_timecursor(int nr)
-{
- /* 10 8x8 digits */
- static char number_bitmaps[10][8]= {
- {0, 56, 68, 68, 68, 68, 68, 56},
- {0, 24, 16, 16, 16, 16, 16, 56},
- {0, 60, 66, 32, 16, 8, 4, 126},
- {0, 124, 32, 16, 56, 64, 66, 60},
- {0, 32, 48, 40, 36, 126, 32, 32},
- {0, 124, 4, 60, 64, 64, 68, 56},
- {0, 56, 4, 4, 60, 68, 68, 56},
- {0, 124, 64, 32, 16, 8, 8, 8},
- {0, 60, 66, 66, 60, 66, 66, 60},
- {0, 56, 68, 68, 120, 64, 68, 56}
- };
- unsigned char mask[16][2];
- unsigned char bitmap[16][2];
- int i, idx;
-
- memset(&bitmap, 0x00, sizeof(bitmap));
- memset(&mask, 0xFF, sizeof(mask));
-
- /* print number bottom right justified */
- for (idx= 3; nr && idx>=0; idx--) {
- char *digit= number_bitmaps[nr%10];
- int x = idx%2;
- int y = idx/2;
-
- for (i=0; i<8; i++)
- bitmap[i + y*8][x]= digit[i];
- nr/= 10;
- }
-
- curcursor= CURSOR_NONE;
- window_set_custom_cursor(mainwin, mask, bitmap, 7, 7);
- BIF_renderwin_set_custom_cursor(mask, bitmap);
-}
diff --git a/source/blender/src/editseq.c b/source/blender/src/editseq.c
deleted file mode 100644
index c3264812c4b..00000000000
--- a/source/blender/src/editseq.c
+++ /dev/null
@@ -1,3705 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <math.h>
-#include <string.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef WIN32
-#include <unistd.h>
-#else
-#include <io.h>
-#endif
-#include <sys/types.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_storage_types.h"
-
-#include "IMB_imbuf_types.h"
-#include "IMB_imbuf.h"
-
-#include "DNA_ipo_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_sequence_types.h"
-#include "DNA_view2d_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_sound_types.h"
-
-#include "BKE_utildefines.h"
-#include "BKE_plugin_types.h"
-#include "BKE_global.h"
-#include "BKE_image.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
-#include "BKE_scene.h"
-
-#include "BIF_space.h"
-#include "BIF_interface.h"
-#include "BIF_screen.h"
-#include "BIF_drawseq.h"
-#include "BIF_editseq.h"
-#include "BIF_mywindow.h"
-#include "BIF_toolbox.h"
-#include "BIF_writemovie.h"
-#include "BIF_editview.h"
-#include "BIF_scrarea.h"
-#include "BIF_editsound.h"
-#include "BIF_imasel.h"
-
-#include "BSE_edit.h"
-#include "BSE_sequence.h"
-#include "BSE_seqeffects.h"
-#include "BSE_filesel.h"
-#include "BSE_drawipo.h"
-#include "BSE_seqaudio.h"
-#include "BSE_time.h"
-
-#include "BDR_editobject.h"
-
-#include "blendef.h"
-#include "mydevice.h"
-
-static Sequence *_last_seq=0;
-static int _last_seq_init=0;
-
-#ifdef WIN32
-char last_imagename[FILE_MAXDIR+FILE_MAXFILE]= "c:\\";
-#else
-char last_imagename[FILE_MAXDIR+FILE_MAXFILE]= "/";
-#endif
-
-char last_sounddir[FILE_MAXDIR+FILE_MAXFILE]= "";
-
-#define SEQ_DESEL ~(SELECT+SEQ_LEFTSEL+SEQ_RIGHTSEL)
-
-static int test_overlap_seq(Sequence *);
-static void shuffle_seq(Sequence *);
-
-typedef struct TransSeq {
- int start, machine;
- int startstill, endstill;
- int startdisp, enddisp;
- int startofs, endofs;
- int final_left, final_right;
- int len;
-} TransSeq;
-
-Sequence *get_last_seq()
-{
- if(!_last_seq_init) {
- Editing *ed;
- Sequence *seq;
-
- ed= G.scene->ed;
- if(!ed) return NULL;
-
- for(seq= ed->seqbasep->first; seq; seq=seq->next)
- if(seq->flag & SELECT)
- _last_seq= seq;
-
- _last_seq_init = 1;
- }
-
- return _last_seq;
-}
-
-void set_last_seq(Sequence *seq)
-{
- _last_seq = seq;
- _last_seq_init = 1;
-}
-
-void clear_last_seq(Sequence *seq)
-{
- _last_seq = NULL;
- _last_seq_init = 0;
-}
-
-Sequence *get_forground_frame_seq(int frame)
-{
- Editing *ed;
- Sequence *seq, *best_seq=NULL;
- int best_machine = -1;
- ed= G.scene->ed;
- if(!ed) return NULL;
-
- for (seq=ed->seqbasep->first; seq; seq= seq->next) {
- if(seq->startdisp > frame || seq->enddisp <= frame)
- continue;
- /* only use elements you can see - not */
- if (ELEM6(seq->type, SEQ_IMAGE, SEQ_META, SEQ_SCENE, SEQ_MOVIE, SEQ_MOVIE_AND_HD_SOUND, SEQ_COLOR)) {
- if (seq->machine > best_machine) {
- best_seq = seq;
- best_machine = seq->machine;
- }
- }
- }
- return best_seq;
-}
-
-/* seq funcs's for transforming internally
- notice the difference between start/end and left/right.
-
- left and right are the bounds at which the setuence is rendered,
-start and end are from the start and fixed length of the sequence.
-*/
-int seq_tx_get_start(Sequence *seq) {
- return seq->start;
-}
-int seq_tx_get_end(Sequence *seq)
-{
- return seq->start+seq->len;
-}
-
-int seq_tx_get_final_left(Sequence *seq)
-{
- return (seq->start - seq->startstill) + seq->startofs;
-}
-int seq_tx_get_final_right(Sequence *seq)
-{
- return ((seq->start+seq->len) + seq->endstill) - seq->endofs;
-}
-
-void seq_tx_set_final_left(Sequence *seq, int val)
-{
- if (val < (seq)->start) {
- seq->startstill = abs(val - (seq)->start);
- (seq)->startofs = 0;
- } else {
- seq->startofs = abs(val - (seq)->start);
- seq->startstill = 0;
- }
-}
-
-void seq_tx_set_final_right(Sequence *seq, int val)
-{
- if (val > (seq)->start + (seq)->len) {
- seq->endstill = abs(val - (seq->start + (seq)->len));
- (seq)->endofs = 0;
- } else {
- seq->endofs = abs(val - ((seq)->start + (seq)->len));
- seq->endstill = 0;
- }
-}
-
-/* check if one side can be transformed */
-int seq_tx_check_left(Sequence *seq)
-{
- if (seq->flag & SELECT) {
- if (seq->flag & SEQ_LEFTSEL)
- return 1;
- else if (seq->flag & SEQ_RIGHTSEL)
- return 0;
-
- return 1; /* selected and neither left or right handles are, so let us move both */
- }
- return 0;
-}
-
-int seq_tx_check_right(Sequence *seq)
-{
- if (seq->flag & SELECT) {
- if (seq->flag & SEQ_RIGHTSEL)
- return 1;
- else if (seq->flag & SEQ_LEFTSEL)
- return 0;
-
- return 1; /* selected and neither left or right handles are, so let us move both */
- }
- return 0;
-}
-
-/* used so we can do a quick check for single image seq
- since they work a bit differently to normal image seq's (during transform) */
-int check_single_seq(Sequence *seq)
-{
- if ( seq->len==1 && (seq->type == SEQ_IMAGE || seq->type == SEQ_COLOR))
- return 1;
- else
- return 0;
-}
-
-static void fix_single_image_seq(Sequence *seq)
-{
- int left, start, offset;
- if (!check_single_seq(seq))
- return;
-
- /* make sure the image is always at the start since there is only one,
- adjusting its start should be ok */
- left = seq_tx_get_final_left(seq);
- start = seq->start;
- if (start != left) {
- offset = left - start;
- seq_tx_set_final_left( seq, seq_tx_get_final_left(seq) - offset );
- seq_tx_set_final_right( seq, seq_tx_get_final_right(seq) - offset );
- seq->start += offset;
- }
-}
-
-static void change_plugin_seq(char *str) /* called from fileselect */
-{
- struct SeqEffectHandle sh;
- Sequence *last_seq= get_last_seq();
-
- if(last_seq && last_seq->type != SEQ_PLUGIN) return;
-
- sh = get_sequence_effect(last_seq);
- sh.free(last_seq);
- sh.init_plugin(last_seq, str);
-
- last_seq->machine = MAX3(last_seq->seq1->machine,
- last_seq->seq2->machine,
- last_seq->seq3->machine);
-
- if( test_overlap_seq(last_seq) ) shuffle_seq(last_seq);
-
- BIF_undo_push("Load/Change Plugin, Sequencer");
-}
-
-
-void boundbox_seq(void)
-{
- Sequence *seq;
- Editing *ed;
- float min[2], max[2];
-
- ed= G.scene->ed;
- if(ed==0) return;
-
- min[0]= 0.0;
- max[0]= EFRA+1;
- min[1]= 0.0;
- max[1]= 8.0;
-
- seq= ed->seqbasep->first;
- while(seq) {
-
- if( min[0] > seq->startdisp-1) min[0]= seq->startdisp-1;
- if( max[0] < seq->enddisp+1) max[0]= seq->enddisp+1;
- if( max[1] < seq->machine+2.0) max[1]= seq->machine+2.0;
-
- seq= seq->next;
- }
-
- G.v2d->tot.xmin= min[0];
- G.v2d->tot.xmax= max[0];
- G.v2d->tot.ymin= min[1];
- G.v2d->tot.ymax= max[1];
-
-}
-
-int sequence_is_free_transformable(Sequence * seq)
-{
- return seq->type < SEQ_EFFECT
- || (get_sequence_effect_num_inputs(seq->type) == 0);
-}
-
-char mouse_cfra_side( int frame ) {
- short mval[2];
- float xmouse, ymouse;
- getmouseco_areawin(mval);
-
- /* choose the side based on which side of the playhead the mouse is on */
- areamouseco_to_ipoco(G.v2d, mval, &xmouse, &ymouse);
- return (xmouse > frame) ? 'R' : 'L';
-}
-
-Sequence *find_neighboring_sequence(Sequence *test, int lr, int sel) {
-/* looks to the left on lr==1, to the right on lr==2
- sel - 0==unselected, 1==selected, -1==done care*/
- Sequence *seq;
- Editing *ed;
-
- ed= G.scene->ed;
- if(ed==0) return 0;
-
- if (sel>0) sel = SELECT;
-
- seq= ed->seqbasep->first;
- while(seq) {
- if( (seq!=test) &&
- (test->machine==seq->machine) &&
- (test->depth==seq->depth) &&
- ((sel == -1) || (sel && (seq->flag & SELECT)) || (sel==0 && (seq->flag & SELECT)==0) ))
- {
- switch (lr) {
- case 1:
- if (test->startdisp == (seq->enddisp)) {
- return seq;
- }
- break;
- case 2:
- if (test->enddisp == (seq->startdisp)) {
- return seq;
- }
- break;
- }
- }
- seq= seq->next;
- }
- return NULL;
-}
-
-Sequence *find_next_prev_sequence(Sequence *test, int lr, int sel) {
-/* looks to the left on lr==1, to the right on lr==2
- sel - 0==unselected, 1==selected, -1==done care*/
- Sequence *seq,*best_seq = NULL;
- Editing *ed;
-
- int dist, best_dist;
- best_dist = MAXFRAME*2;
-
- ed= G.scene->ed;
- if(ed==0) return 0;
-
- if (sel) sel = SELECT;
-
- seq= ed->seqbasep->first;
- while(seq) {
- if( (seq!=test) &&
- (test->machine==seq->machine) &&
- (test->depth==seq->depth) &&
- ((sel == -1) || (sel==(seq->flag & SELECT))))
- {
- dist = MAXFRAME*2;
-
- switch (lr) {
- case 1:
- if (seq->enddisp <= test->startdisp) {
- dist = test->enddisp - seq->startdisp;
- }
- break;
- case 2:
- if (seq->startdisp >= test->enddisp) {
- dist = seq->startdisp - test->enddisp;
- }
- break;
- }
-
- if (dist==0) {
- best_seq = seq;
- break;
- } else if (dist < best_dist) {
- best_dist = dist;
- best_seq = seq;
- }
- }
- seq= seq->next;
- }
- return best_seq; /* can be null */
-}
-
-
-Sequence *find_nearest_seq(int *hand)
-{
- Sequence *seq;
- Editing *ed;
- float x, y;
- short mval[2];
- float pixelx;
- float handsize;
- float displen;
- View2D *v2d = G.v2d;
- *hand= 0;
-
- ed= G.scene->ed;
- if(ed==0) return 0;
-
- pixelx = (v2d->cur.xmax - v2d->cur.xmin)/(v2d->mask.xmax - v2d->mask.xmin);
-
- getmouseco_areawin(mval);
- areamouseco_to_ipoco(G.v2d, mval, &x, &y);
-
- seq= ed->seqbasep->first;
-
- while(seq) {
- if(seq->machine == (int)y) {
- /* check for both normal strips, and strips that have been flipped horizontally */
- if( ((seq->startdisp < seq->enddisp) && (seq->startdisp<=x && seq->enddisp>=x)) ||
- ((seq->startdisp > seq->enddisp) && (seq->startdisp>=x && seq->enddisp<=x)) )
- {
- if(sequence_is_free_transformable(seq)) {
-
- /* clamp handles to defined size in pixel space */
-
- handsize = seq->handsize;
- displen = (float)abs(seq->startdisp - seq->enddisp);
-
- if (displen / pixelx > 16) { /* dont even try to grab the handles of small strips */
- /* Set the max value to handle to 1/3 of the total len when its less then 28.
- * This is important because otherwise selecting handles happens even when you click in the middle */
-
- if ((displen/3) < 30*pixelx) {
- handsize = displen/3;
- } else {
- CLAMP(handsize, 7*pixelx, 30*pixelx);
- }
-
- if( handsize+seq->startdisp >=x )
- *hand= 1;
- else if( -handsize+seq->enddisp <=x )
- *hand= 2;
- }
- }
- return seq;
- }
- }
- seq= seq->next;
- }
- return 0;
-}
-
-void update_seq_ipo_rect(Sequence * seq)
-{
- float start;
- float end;
-
- if (!seq || !seq->ipo) {
- return;
- }
- start = -5.0;
- end = 105.0;
-
- /* Adjust IPO window to sequence and
- avoid annoying snap-back to startframe
- when Lock Time is on */
- if (G.v2d->flag & V2D_VIEWLOCK) {
- if ((seq->flag & SEQ_IPO_FRAME_LOCKED) != 0) {
- start = -5.0 + seq->startdisp;
- end = 5.0 + seq->enddisp;
- } else {
- start = (float)G.scene->r.sfra - 0.1;
- end = G.scene->r.efra;
- }
- }
-
- seq->ipo->cur.xmin= start;
- seq->ipo->cur.xmax= end;
-}
-
-void update_seq_icu_rects(Sequence * seq)
-{
- IpoCurve *icu= NULL;
- struct SeqEffectHandle sh;
-
- if (!seq || !seq->ipo) {
- return;
- }
-
- if(!(seq->type & SEQ_EFFECT)) {
- return;
- }
-
- sh = get_sequence_effect(seq);
-
- for(icu= seq->ipo->curve.first; icu; icu= icu->next) {
- sh.store_icu_yrange(seq, icu->adrcode, &icu->ymin, &icu->ymax);
- }
-}
-
-static int test_overlap_seq(Sequence *test)
-{
- Sequence *seq;
- Editing *ed;
-
- ed= G.scene->ed;
- if(ed==0) return 0;
-
- seq= ed->seqbasep->first;
- while(seq) {
- if(seq!=test) {
- if(test->machine==seq->machine) {
- if(test->depth==seq->depth) {
- if( (test->enddisp <= seq->startdisp) || (test->startdisp >= seq->enddisp) );
- else return 1;
- }
- }
- }
- seq= seq->next;
- }
- return 0;
-}
-
-static void shuffle_seq(Sequence *test)
-{
- Editing *ed;
- Sequence *seq;
- int a, start;
-
- ed= G.scene->ed;
- if(ed==0) return;
-
- /* is there more than 1 select: only shuffle y */
- a=0;
- seq= ed->seqbasep->first;
- while(seq) {
- if(seq->flag & SELECT) a++;
- seq= seq->next;
- }
-
- if(a<2 && test->type==SEQ_IMAGE) {
- start= test->start;
-
- for(a= 1; a<50; a++) {
- test->start= start+a;
- calc_sequence(test);
- if( test_overlap_seq(test)==0) return;
- test->start= start-a;
- calc_sequence(test);
- if( test_overlap_seq(test)==0) return;
- }
- test->start= start;
- }
-
- test->machine++;
- calc_sequence(test);
- while( test_overlap_seq(test) ) {
- if(test->machine >= MAXSEQ) {
- error("There is no more space to add a sequence strip");
-
- BLI_remlink(ed->seqbasep, test);
- free_sequence(test);
- return;
- }
- test->machine++;
- calc_sequence(test);
- }
-}
-
-static int seq_is_parent(Sequence *par, Sequence *seq)
-{
- return ((par->seq1 == seq) || (par->seq2 == seq) || (par->seq3 == seq));
-}
-
-static int seq_is_predecessor(Sequence *pred, Sequence *seq)
-{
- if(pred == seq) return 0;
- else if(seq_is_parent(pred, seq)) return 1;
- else if(pred->seq1 && seq_is_predecessor(pred->seq1, seq)) return 1;
- else if(pred->seq2 && seq_is_predecessor(pred->seq2, seq)) return 1;
- else if(pred->seq3 && seq_is_predecessor(pred->seq3, seq)) return 1;
-
- return 0;
-}
-
-static void deselect_all_seq(void)
-{
- Sequence *seq;
- Editing *ed;
-
- ed= G.scene->ed;
- if(ed==0) return;
-
- WHILE_SEQ(ed->seqbasep) {
- seq->flag &= SEQ_DESEL;
- }
- END_SEQ
-
- BIF_undo_push("(De)select all Strips, Sequencer");
-}
-
-static void recurs_sel_seq(Sequence *seqm)
-{
- Sequence *seq;
-
- seq= seqm->seqbase.first;
- while(seq) {
-
- if(seqm->flag & (SEQ_LEFTSEL+SEQ_RIGHTSEL)) seq->flag &= SEQ_DESEL;
- else if(seqm->flag & SELECT) seq->flag |= SELECT;
- else seq->flag &= SEQ_DESEL;
-
- if(seq->seqbase.first) recurs_sel_seq(seq);
-
- seq= seq->next;
- }
-}
-
-void swap_select_seq(void)
-{
- Sequence *seq;
- Editing *ed;
- int sel=0;
-
- ed= G.scene->ed;
- if(ed==0) return;
-
- WHILE_SEQ(ed->seqbasep) {
- if(seq->flag & SELECT) sel= 1;
- }
- END_SEQ
-
- WHILE_SEQ(ed->seqbasep) {
- /* always deselect all to be sure */
- seq->flag &= SEQ_DESEL;
- if(sel==0) seq->flag |= SELECT;
- }
- END_SEQ
-
- allqueue(REDRAWSEQ, 0);
- BIF_undo_push("Swap Selected Strips, Sequencer");
-
-}
-
-void select_channel_direction(Sequence *test,int lr) {
-/* selects all strips in a channel to one direction of the passed strip */
- Sequence *seq;
- Editing *ed;
-
- ed= G.scene->ed;
- if(ed==0) return;
-
- seq= ed->seqbasep->first;
- while(seq) {
- if(seq!=test) {
- if (test->machine==seq->machine) {
- if(test->depth==seq->depth) {
- if (((lr==1)&&(test->startdisp > (seq->startdisp)))||((lr==2)&&(test->startdisp < (seq->startdisp)))) {
- seq->flag |= SELECT;
- recurs_sel_seq(seq);
- }
- }
- }
- }
- seq= seq->next;
- }
- test->flag |= SELECT;
- recurs_sel_seq(test);
-}
-
-void select_dir_from_last(int lr)
-{
- Sequence *seq=get_last_seq();
- if (seq==NULL)
- return;
-
- select_channel_direction(seq,lr);
- allqueue(REDRAWSEQ, 0);
-
- if (lr==1) BIF_undo_push("Select Strips to the Left, Sequencer");
- else BIF_undo_push("Select Strips to the Right, Sequencer");
-}
-
-void select_surrounding_handles(Sequence *test)
-{
- Sequence *neighbor;
-
- neighbor=find_neighboring_sequence(test, 1, -1);
- if (neighbor) {
- neighbor->flag |= SELECT;
- recurs_sel_seq(neighbor);
- neighbor->flag |= SEQ_RIGHTSEL;
- }
- neighbor=find_neighboring_sequence(test, 2, -1);
- if (neighbor) {
- neighbor->flag |= SELECT;
- recurs_sel_seq(neighbor);
- neighbor->flag |= SEQ_LEFTSEL;
- }
- test->flag |= SELECT;
-}
-
-void select_surround_from_last()
-{
- Sequence *seq=get_last_seq();
-
- if (seq==NULL)
- return;
-
- select_surrounding_handles(seq);
- allqueue(REDRAWSEQ, 0);
- BIF_undo_push("Select Surrounding Handles, Sequencer");
-}
-
-void select_neighbor_from_last(int lr)
-{
- Sequence *seq=get_last_seq();
- Sequence *neighbor;
- int change = 0;
- if (seq) {
- neighbor=find_neighboring_sequence(seq, lr, -1);
- if (neighbor) {
- switch (lr) {
- case 1:
- neighbor->flag |= SELECT;
- recurs_sel_seq(neighbor);
- neighbor->flag |= SEQ_RIGHTSEL;
- seq->flag |= SEQ_LEFTSEL;
- break;
- case 2:
- neighbor->flag |= SELECT;
- recurs_sel_seq(neighbor);
- neighbor->flag |= SEQ_LEFTSEL;
- seq->flag |= SEQ_RIGHTSEL;
- break;
- }
- seq->flag |= SELECT;
- change = 1;
- }
- }
- if (change) {
- allqueue(REDRAWSEQ, 0);
-
- if (lr==1) BIF_undo_push("Select Left Handles, Sequencer");
- else BIF_undo_push("Select Right Handles, Sequencer");
- }
-}
-
-void mouse_select_seq(void)
-{
- Sequence *seq,*neighbor;
- int hand,seldir;
- TimeMarker *marker;
-
- marker=find_nearest_marker(1);
-
- if (marker) {
- int oldflag;
- /* select timeline marker */
- if (G.qual & LR_SHIFTKEY) {
- oldflag= marker->flag;
- deselect_markers(0, 0);
-
- if (oldflag & SELECT)
- marker->flag &= ~SELECT;
- else
- marker->flag |= SELECT;
- }
- else {
- marker->flag |= SELECT;
- }
- allqueue(REDRAWMARKER, 0);
- force_draw(0);
-
- BIF_undo_push("Select Strips, Sequencer");
-
- } else {
-
- seq= find_nearest_seq(&hand);
- if(!(G.qual & LR_SHIFTKEY)&&!(G.qual & LR_ALTKEY)&&!(G.qual & LR_CTRLKEY)) deselect_all_seq();
-
- if(seq) {
- set_last_seq(seq);
-
- if ((seq->type == SEQ_IMAGE) || (seq->type == SEQ_MOVIE)) {
- if(seq->strip) {
- strncpy(last_imagename, seq->strip->dir, FILE_MAXDIR-1);
- }
- } else
- if (seq->type == SEQ_HD_SOUND || seq->type == SEQ_RAM_SOUND) {
- if(seq->strip) {
- strncpy(last_sounddir, seq->strip->dir, FILE_MAXDIR-1);
- }
- }
-
- if((G.qual & LR_SHIFTKEY) && (seq->flag & SELECT)) {
- if(hand==0) seq->flag &= SEQ_DESEL;
- else if(hand==1) {
- if(seq->flag & SEQ_LEFTSEL)
- seq->flag &= ~SEQ_LEFTSEL;
- else seq->flag |= SEQ_LEFTSEL;
- }
- else if(hand==2) {
- if(seq->flag & SEQ_RIGHTSEL)
- seq->flag &= ~SEQ_RIGHTSEL;
- else seq->flag |= SEQ_RIGHTSEL;
- }
- }
- else {
- seq->flag |= SELECT;
- if(hand==1) seq->flag |= SEQ_LEFTSEL;
- if(hand==2) seq->flag |= SEQ_RIGHTSEL;
- }
-
- /* On Ctrl-Alt selection, select the strip and bordering handles */
- if ((G.qual & LR_CTRLKEY) && (G.qual & LR_ALTKEY)) {
- if (!(G.qual & LR_SHIFTKEY)) deselect_all_seq();
- seq->flag |= SELECT;
- select_surrounding_handles(seq);
-
- /* Ctrl signals Left, Alt signals Right
- First click selects adjacent handles on that side.
- Second click selects all strips in that direction.
- If there are no adjacent strips, it just selects all in that direction. */
- } else if (((G.qual & LR_CTRLKEY) || (G.qual & LR_ALTKEY)) && (seq->flag & SELECT)) {
-
- if (G.qual & LR_CTRLKEY) seldir=1;
- else seldir=2;
- neighbor=find_neighboring_sequence(seq, seldir, -1);
- if (neighbor) {
- switch (seldir) {
- case 1:
- if ((seq->flag & SEQ_LEFTSEL)&&(neighbor->flag & SEQ_RIGHTSEL)) {
- if (!(G.qual & LR_SHIFTKEY)) deselect_all_seq();
- select_channel_direction(seq,1);
- } else {
- neighbor->flag |= SELECT;
- recurs_sel_seq(neighbor);
- neighbor->flag |= SEQ_RIGHTSEL;
- seq->flag |= SEQ_LEFTSEL;
- }
- break;
- case 2:
- if ((seq->flag & SEQ_RIGHTSEL)&&(neighbor->flag & SEQ_LEFTSEL)) {
- if (!(G.qual & LR_SHIFTKEY)) deselect_all_seq();
- select_channel_direction(seq,2);
- } else {
- neighbor->flag |= SELECT;
- recurs_sel_seq(neighbor);
- neighbor->flag |= SEQ_LEFTSEL;
- seq->flag |= SEQ_RIGHTSEL;
- }
- break;
- }
- } else {
- if (!(G.qual & LR_SHIFTKEY)) deselect_all_seq();
- select_channel_direction(seq,seldir);
- }
- }
-
- recurs_sel_seq(seq);
- }
- force_draw(0);
-
- if(get_last_seq()) allqueue(REDRAWIPO, 0);
- BIF_undo_push("Select Strips, Sequencer");
-
- std_rmouse_transform(transform_seq_nomarker);
- }
-
- /* marker transform */
- if (marker) {
- short mval[2], xo, yo;
- getmouseco_areawin(mval);
- xo= mval[0];
- yo= mval[1];
-
- while(get_mbut()&R_MOUSE) {
- getmouseco_areawin(mval);
- if(abs(mval[0]-xo)+abs(mval[1]-yo) > 4) {
- transform_markers('g', 0);
- allqueue(REDRAWMARKER, 0);
- return;
- }
- BIF_wait_for_statechange();
- }
- }
-}
-
-
-Sequence *alloc_sequence(ListBase *lb, int cfra, int machine)
-{
- Sequence *seq;
-
- /*ed= G.scene->ed;*/
-
- seq= MEM_callocN( sizeof(Sequence), "addseq");
- BLI_addtail(lb, seq);
-
- set_last_seq(seq);
-
- *( (short *)seq->name )= ID_SEQ;
- seq->name[2]= 0;
-
- seq->flag= SELECT;
- seq->start= cfra;
- seq->machine= machine;
- seq->mul= 1.0;
-
- return seq;
-}
-
-static Sequence *sfile_to_sequence(SpaceFile *sfile, int cfra, int machine, int last)
-{
- Sequence *seq;
- Strip *strip;
- StripElem *se;
- int totsel, a;
- char name[160];
-
- /* are there selected files? */
- totsel= 0;
- for(a=0; a<sfile->totfile; a++) {
- if(sfile->filelist[a].flags & ACTIVE) {
- if( (sfile->filelist[a].type & S_IFDIR)==0 ) {
- totsel++;
- }
- }
- }
-
- if(last) {
- /* if not, a file handed to us? */
- if(totsel==0 && sfile->file[0]) totsel= 1;
- }
-
- if(totsel==0) return 0;
-
- /* make seq */
- seq= alloc_sequence(((Editing *)G.scene->ed)->seqbasep, cfra, machine);
- seq->len= totsel;
-
- if(totsel==1) {
- seq->startstill= 25;
- seq->endstill= 24;
- }
-
- calc_sequence(seq);
-
- if(sfile->flag & FILE_STRINGCODE) {
- strcpy(name, sfile->dir);
- BLI_makestringcode(G.sce, name);
- } else {
- strcpy(name, sfile->dir);
- }
-
- /* strip and stripdata */
- seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
- strip->len= totsel;
- strip->us= 1;
- strncpy(strip->dir, name, FILE_MAXDIR-1);
- strip->stripdata= se= MEM_callocN(totsel*sizeof(StripElem), "stripelem");
-
- for(a=0; a<sfile->totfile; a++) {
- if(sfile->filelist[a].flags & ACTIVE) {
- if( (sfile->filelist[a].type & S_IFDIR)==0 ) {
- strncpy(se->name, sfile->filelist[a].relname, FILE_MAXFILE-1);
- se++;
- }
- }
- }
- /* no selected file: */
- if(totsel==1 && se==strip->stripdata) {
- strncpy(se->name, sfile->file, FILE_MAXFILE-1);
- }
-
- /* last active name */
- strncpy(last_imagename, seq->strip->dir, FILE_MAXDIR-1);
-
- return seq;
-}
-
-
-static int sfile_to_mv_sequence_load(SpaceFile *sfile, int cfra,
- int machine, int index )
-{
- Sequence *seq;
- struct anim *anim;
- Strip *strip;
- StripElem *se;
- int totframe;
- char name[160];
- char str[FILE_MAXDIR+FILE_MAXFILE];
-
- totframe= 0;
-
- strncpy(str, sfile->dir, FILE_MAXDIR-1);
- if(index<0)
- strncat(str, sfile->file, FILE_MAXDIR-1);
- else
- strncat(str, sfile->filelist[index].relname, FILE_MAXDIR-1);
-
- /* is it a movie? */
- anim = openanim(str, IB_rect);
- if(anim==0) {
- error("The selected file is not a movie or "
- "FFMPEG-support not compiled in!");
- return(cfra);
- }
-
- totframe= IMB_anim_get_duration(anim);
-
- /* make seq */
- seq= alloc_sequence(((Editing *)G.scene->ed)->seqbasep, cfra, machine);
- seq->len= totframe;
- seq->type= SEQ_MOVIE;
- seq->anim= anim;
- seq->anim_preseek = IMB_anim_get_preseek(anim);
-
- calc_sequence(seq);
-
- if(sfile->flag & FILE_STRINGCODE) {
- strcpy(name, sfile->dir);
- BLI_makestringcode(G.sce, name);
- } else {
- strcpy(name, sfile->dir);
- }
-
- /* strip and stripdata */
- seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
- strip->len= totframe;
- strip->us= 1;
- strncpy(strip->dir, name, FILE_MAXDIR-1);
- strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem");
-
- /* name movie in first strip */
- if(index<0)
- strncpy(se->name, sfile->file, FILE_MAXFILE-1);
- else
- strncpy(se->name, sfile->filelist[index].relname, FILE_MAXFILE-1);
-
- /* last active name */
- strncpy(last_imagename, seq->strip->dir, FILE_MAXDIR-1);
- return(cfra+totframe);
-}
-
-static void sfile_to_mv_sequence(SpaceFile *sfile, int cfra, int machine)
-{
- int a, totsel;
-
- totsel= 0;
- for(a= 0; a<sfile->totfile; a++) {
- if(sfile->filelist[a].flags & ACTIVE) {
- if ((sfile->filelist[a].type & S_IFDIR)==0) {
- totsel++;
- }
- }
- }
-
- if((totsel==0) && (sfile->file[0])) {
- cfra= sfile_to_mv_sequence_load(sfile, cfra, machine, -1);
- return;
- }
-
- if(totsel==0) return;
-
- /* ok. check all the select file, and load it. */
- for(a= 0; a<sfile->totfile; a++) {
- if(sfile->filelist[a].flags & ACTIVE) {
- if ((sfile->filelist[a].type & S_IFDIR)==0) {
- /* load and update current frame. */
- cfra= sfile_to_mv_sequence_load(sfile, cfra, machine, a);
- }
- }
- }
-}
-
-static Sequence *sfile_to_ramsnd_sequence(SpaceFile *sfile,
- int cfra, int machine)
-{
- Sequence *seq;
- bSound *sound;
- Strip *strip;
- StripElem *se;
- double totframe;
- char name[160];
- char str[256];
-
- totframe= 0.0;
-
- strncpy(str, sfile->dir, FILE_MAXDIR-1);
- strncat(str, sfile->file, FILE_MAXFILE-1);
-
- sound= sound_new_sound(str);
- if (!sound || sound->sample->type == SAMPLE_INVALID) {
- error("Unsupported audio format");
- return 0;
- }
- if (sound->sample->bits != 16) {
- error("Only 16 bit audio is supported");
- return 0;
- }
- sound->id.us=1;
- sound->flags |= SOUND_FLAGS_SEQUENCE;
- audio_makestream(sound);
-
- totframe= (int) ( ((float)(sound->streamlen-1)/
- ( (float)G.scene->audio.mixrate*4.0 ))* FPS);
-
- /* make seq */
- seq= alloc_sequence(((Editing *)G.scene->ed)->seqbasep, cfra, machine);
- seq->len= totframe;
- seq->type= SEQ_RAM_SOUND;
- seq->sound = sound;
-
- calc_sequence(seq);
-
- if(sfile->flag & FILE_STRINGCODE) {
- strcpy(name, sfile->dir);
- BLI_makestringcode(G.sce, name);
- } else {
- strcpy(name, sfile->dir);
- }
-
- /* strip and stripdata */
- seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
- strip->len= totframe;
- strip->us= 1;
- strncpy(strip->dir, name, FILE_MAXDIR-1);
- strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem");
-
- /* name sound in first strip */
- strncpy(se->name, sfile->file, FILE_MAXFILE-1);
-
- /* last active name */
- strncpy(last_sounddir, seq->strip->dir, FILE_MAXDIR-1);
-
- return seq;
-}
-
-static int sfile_to_hdsnd_sequence_load(SpaceFile *sfile, int cfra,
- int machine, int index)
-{
- Sequence *seq;
- struct hdaudio *hdaudio;
- Strip *strip;
- StripElem *se;
- int totframe;
- char name[160];
- char str[FILE_MAXDIR+FILE_MAXFILE];
-
- totframe= 0;
-
- strncpy(str, sfile->dir, FILE_MAXDIR-1);
- if(index<0)
- strncat(str, sfile->file, FILE_MAXDIR-1);
- else
- strncat(str, sfile->filelist[index].relname, FILE_MAXDIR-1);
-
- /* is it a sound file? */
- hdaudio = sound_open_hdaudio(str);
- if(hdaudio==0) {
- error("The selected file is not a sound file or "
- "FFMPEG-support not compiled in!");
- return(cfra);
- }
-
- totframe= sound_hdaudio_get_duration(hdaudio, FPS);
-
- /* make seq */
- seq= alloc_sequence(((Editing *)G.scene->ed)->seqbasep, cfra, machine);
- seq->len= totframe;
- seq->type= SEQ_HD_SOUND;
- seq->hdaudio= hdaudio;
-
- calc_sequence(seq);
-
- if(sfile->flag & FILE_STRINGCODE) {
- strcpy(name, sfile->dir);
- BLI_makestringcode(G.sce, name);
- } else {
- strcpy(name, sfile->dir);
- }
-
- /* strip and stripdata */
- seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
- strip->len= totframe;
- strip->us= 1;
- strncpy(strip->dir, name, FILE_MAXDIR-1);
- strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem");
-
- /* name movie in first strip */
- if(index<0)
- strncpy(se->name, sfile->file, FILE_MAXFILE-1);
- else
- strncpy(se->name, sfile->filelist[index].relname, FILE_MAXFILE-1);
-
- /* last active name */
- strncpy(last_sounddir, seq->strip->dir, FILE_MAXDIR-1);
- return(cfra+totframe);
-}
-
-static void sfile_to_hdsnd_sequence(SpaceFile *sfile, int cfra, int machine)
-{
- int totsel, a;
-
- totsel= 0;
- for(a= 0; a<sfile->totfile; a++) {
- if(sfile->filelist[a].flags & ACTIVE) {
- if((sfile->filelist[a].type & S_IFDIR)==0) {
- totsel++;
- }
- }
- }
-
- if((totsel==0) && (sfile->file[0])) {
- cfra= sfile_to_hdsnd_sequence_load(sfile, cfra, machine, -1);
- return;
- }
-
- if(totsel==0) return;
-
- /* ok, check all the select file, and load it. */
- for(a= 0; a<sfile->totfile; a++) {
- if(sfile->filelist[a].flags & ACTIVE) {
- if((sfile->filelist[a].type & S_IFDIR)==0) {
- /* load and update current frame. */
- cfra= sfile_to_hdsnd_sequence_load(sfile, cfra, machine, a);
- }
- }
- }
-}
-
-
-static void add_image_strips(char *name)
-{
- SpaceFile *sfile;
- struct direntry *files;
- float x, y;
- int a, totfile, cfra, machine;
- short mval[2];
-
- deselect_all_seq();
-
- /* restore windowmatrices */
- areawinset(curarea->win);
- drawseqspace(curarea, curarea->spacedata.first);
-
- /* search sfile */
- sfile= scrarea_find_space_of_type(curarea, SPACE_FILE);
- if(sfile==0) return;
-
- /* where will it be */
- getmouseco_areawin(mval);
- areamouseco_to_ipoco(G.v2d, mval, &x, &y);
- cfra= (int)(x+0.5);
- machine= (int)(y+0.5);
-
- waitcursor(1);
-
- /* also read contents of directories */
- files= sfile->filelist;
- totfile= sfile->totfile;
- sfile->filelist= 0;
- sfile->totfile= 0;
-
- for(a=0; a<totfile; a++) {
- if(files[a].flags & ACTIVE) {
- if( (files[a].type & S_IFDIR) ) {
- strncat(sfile->dir, files[a].relname, FILE_MAXFILE-1);
- strcat(sfile->dir,"/");
- read_dir(sfile);
-
- /* select all */
- swapselect_file(sfile);
-
- if ( sfile_to_sequence(sfile, cfra, machine, 0) ) machine++;
-
- parent(sfile);
- }
- }
- }
-
- sfile->filelist= files;
- sfile->totfile= totfile;
-
- /* read directory itself */
- sfile_to_sequence(sfile, cfra, machine, 1);
-
- waitcursor(0);
-
- BIF_undo_push("Add Image Strip, Sequencer");
- transform_seq_nomarker('g', 0);
-
-}
-
-static void add_movie_strip(char *name)
-{
- SpaceFile *sfile;
- float x, y;
- int cfra, machine;
- short mval[2];
-
- deselect_all_seq();
-
- /* restore windowmatrices */
- areawinset(curarea->win);
- drawseqspace(curarea, curarea->spacedata.first);
-
- /* search sfile */
- sfile= scrarea_find_space_of_type(curarea, SPACE_FILE);
- if(sfile==0) return;
-
- /* where will it be */
- getmouseco_areawin(mval);
- areamouseco_to_ipoco(G.v2d, mval, &x, &y);
- cfra= (int)(x+0.5);
- machine= (int)(y+0.5);
-
- waitcursor(1);
-
- /* read directory itself */
- sfile_to_mv_sequence(sfile, cfra, machine);
-
- waitcursor(0);
-
- BIF_undo_push("Add Movie Strip, Sequencer");
- transform_seq_nomarker('g', 0);
-
-}
-
-static void add_movie_and_hdaudio_strip(char *name)
-{
- SpaceFile *sfile;
- float x, y;
- int cfra, machine;
- short mval[2];
-
- deselect_all_seq();
-
- /* restore windowmatrices */
- areawinset(curarea->win);
- drawseqspace(curarea, curarea->spacedata.first);
-
- /* search sfile */
- sfile= scrarea_find_space_of_type(curarea, SPACE_FILE);
- if(sfile==0) return;
-
- /* where will it be */
- getmouseco_areawin(mval);
- areamouseco_to_ipoco(G.v2d, mval, &x, &y);
- cfra= (int)(x+0.5);
- machine= (int)(y+0.5);
-
- waitcursor(1);
-
- /* read directory itself */
- sfile_to_hdsnd_sequence(sfile, cfra, machine);
- sfile_to_mv_sequence(sfile, cfra, machine);
-
- waitcursor(0);
-
- BIF_undo_push("Add Movie and HD-Audio Strip, Sequencer");
- transform_seq_nomarker('g', 0);
-
-}
-
-static void add_sound_strip_ram(char *name)
-{
- SpaceFile *sfile;
- float x, y;
- int cfra, machine;
- short mval[2];
-
- deselect_all_seq();
-
- sfile= scrarea_find_space_of_type(curarea, SPACE_FILE);
- if (sfile==0) return;
-
- /* where will it be */
- getmouseco_areawin(mval);
- areamouseco_to_ipoco(G.v2d, mval, &x, &y);
- cfra= (int)(x+0.5);
- machine= (int)(y+0.5);
-
- waitcursor(1);
-
- sfile_to_ramsnd_sequence(sfile, cfra, machine);
-
- waitcursor(0);
-
- BIF_undo_push("Add Sound (RAM) Strip, Sequencer");
- transform_seq_nomarker('g', 0);
-}
-
-static void add_sound_strip_hd(char *name)
-{
- SpaceFile *sfile;
- float x, y;
- int cfra, machine;
- short mval[2];
-
- deselect_all_seq();
-
- sfile= scrarea_find_space_of_type(curarea, SPACE_FILE);
- if (sfile==0) return;
-
- /* where will it be */
- getmouseco_areawin(mval);
- areamouseco_to_ipoco(G.v2d, mval, &x, &y);
- cfra= (int)(x+0.5);
- machine= (int)(y+0.5);
-
- waitcursor(1);
-
- sfile_to_hdsnd_sequence(sfile, cfra, machine);
-
- waitcursor(0);
-
- BIF_undo_push("Add Sound (HD) Strip, Sequencer");
- transform_seq_nomarker('g', 0);
-}
-
-#if 0
-static void reload_sound_strip(char *name)
-{
- Editing *ed;
- Sequence *seq, *seqact;
- SpaceFile *sfile;
- Sequence *last_seq= get_last_seq();
-
- ed= G.scene->ed;
-
- if(last_seq==0 || last_seq->type!=SEQ_SOUND) return;
- seqact= last_seq; /* last_seq changes in alloc_sequence */
-
- /* search sfile */
- sfile= scrarea_find_space_of_type(curarea, SPACE_FILE);
- if(sfile==0) return;
-
- waitcursor(1);
-
- seq = sfile_to_snd_sequence(sfile, seqact->start, seqact->machine);
- printf("seq->type: %i\n", seq->type);
- if(seq && seq!=seqact) {
- /* i'm not sure about this one, seems to work without it -- sgefant */
- free_strip(seqact->strip);
-
- seqact->strip= seq->strip;
-
- seqact->len= seq->len;
- calc_sequence(seqact);
-
- seq->strip= 0;
- free_sequence(seq);
- BLI_remlink(ed->seqbasep, seq);
-
- seq= ed->seqbasep->first;
-
- }
-
- waitcursor(0);
-
- allqueue(REDRAWSEQ, 0);
-}
-#endif
-
-static void reload_image_strip(char *name)
-{
- Editing *ed;
- Sequence *seq, *seqact;
- SpaceFile *sfile;
- Sequence *last_seq= get_last_seq();
-
- ed= G.scene->ed;
-
- if(last_seq==0 || last_seq->type!=SEQ_IMAGE) return;
- seqact= last_seq; /* last_seq changes in alloc_sequence */
-
- /* search sfile */
- sfile= scrarea_find_space_of_type(curarea, SPACE_FILE);
- if(sfile==0) return;
-
- waitcursor(1);
-
- seq= sfile_to_sequence(sfile, seqact->start, seqact->machine, 1);
- if(seq && seq!=seqact) {
- free_strip(seqact->strip);
-
- seqact->strip= seq->strip;
-
- seqact->len= seq->len;
- calc_sequence(seqact);
-
- seq->strip= 0;
- free_sequence(seq);
- BLI_remlink(ed->seqbasep, seq);
-
- update_changed_seq_and_deps(seqact, 1, 1);
- }
- waitcursor(0);
-
- allqueue(REDRAWSEQ, 0);
-}
-
-static int event_to_efftype(int event)
-{
- if(event==2) return SEQ_CROSS;
- if(event==3) return SEQ_GAMCROSS;
- if(event==4) return SEQ_ADD;
- if(event==5) return SEQ_SUB;
- if(event==6) return SEQ_MUL;
- if(event==7) return SEQ_ALPHAOVER;
- if(event==8) return SEQ_ALPHAUNDER;
- if(event==9) return SEQ_OVERDROP;
- if(event==10) return SEQ_PLUGIN;
- if(event==13) return SEQ_WIPE;
- if(event==14) return SEQ_GLOW;
- if(event==15) return SEQ_TRANSFORM;
- if(event==16) return SEQ_COLOR;
- if(event==17) return SEQ_SPEED;
- return 0;
-}
-
-static int seq_effect_find_selected(Editing *ed, Sequence *activeseq, int type, Sequence **selseq1, Sequence **selseq2, Sequence **selseq3)
-{
- Sequence *seq1= 0, *seq2= 0, *seq3= 0, *seq;
-
- if (!activeseq)
- seq2= get_last_seq();
-
- for(seq=ed->seqbasep->first; seq; seq=seq->next) {
- if(seq->flag & SELECT) {
- if (seq->type == SEQ_RAM_SOUND
- || seq->type == SEQ_HD_SOUND) {
- error("Can't apply effects to "
- "audio sequence strips");
- return 0;
- }
- if((seq != activeseq) && (seq != seq2)) {
- if(seq2==0) seq2= seq;
- else if(seq1==0) seq1= seq;
- else if(seq3==0) seq3= seq;
- else {
- error("Can't apply effect to more than 3 sequence strips");
- return 0;
- }
- }
- }
- }
-
- /* make sequence selection a little bit more intuitive
- for 3 strips: the last-strip should be sequence3 */
- if (seq3 != 0 && seq2 != 0) {
- Sequence *tmp = seq2;
- seq2 = seq3;
- seq3 = tmp;
- }
-
-
- switch(get_sequence_effect_num_inputs(type)) {
- case 0:
- seq1 = seq2 = seq3 = 0;
- break;
- case 1:
- if(seq2==0) {
- error("Need at least one selected sequence strip");
- return 0;
- }
- if(seq1==0) seq1= seq2;
- if(seq3==0) seq3= seq2;
- case 2:
- if(seq1==0 || seq2==0) {
- error("Need 2 selected sequence strips");
- return 0;
- }
- if(seq3==0) seq3= seq2;
- }
-
- *selseq1= seq1;
- *selseq2= seq2;
- *selseq3= seq3;
-
- return 1;
-}
-
-static int add_seq_effect(int type, char *str)
-{
- Editing *ed;
- Sequence *newseq, *seq1, *seq2, *seq3;
- Strip *strip;
- float x, y;
- int cfra, machine;
- short mval[2];
- struct SeqEffectHandle sh;
-
- if(G.scene->ed==0) return 0;
- ed= G.scene->ed;
-
- if(!seq_effect_find_selected(ed, NULL, event_to_efftype(type), &seq1, &seq2, &seq3))
- return 0;
-
- deselect_all_seq();
-
- /* where will it be (cfra is not realy needed) */
- getmouseco_areawin(mval);
- areamouseco_to_ipoco(G.v2d, mval, &x, &y);
- cfra= (int)(x+0.5);
- machine= (int)(y+0.5);
-
- /* allocate and initialize */
- newseq= alloc_sequence(((Editing *)G.scene->ed)->seqbasep, cfra, machine);
- newseq->type= event_to_efftype(type);
-
- sh = get_sequence_effect(newseq);
-
- newseq->seq1= seq1;
- newseq->seq2= seq2;
- newseq->seq3= seq3;
-
- sh.init(newseq);
-
- if (!seq1) {
- newseq->len= 1;
- newseq->startstill= 25;
- newseq->endstill= 24;
- }
-
- calc_sequence(newseq);
-
- newseq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
- strip->len= newseq->len;
- strip->us= 1;
- if(newseq->len>0)
- strip->stripdata= MEM_callocN(newseq->len*sizeof(StripElem), "stripelem");
-
- /* initialize plugin */
- if(newseq->type == SEQ_PLUGIN) {
- sh.init_plugin(newseq, str);
-
- if(newseq->plugin==0) {
- BLI_remlink(ed->seqbasep, newseq);
- free_sequence(newseq);
- set_last_seq(NULL);
- return 0;
- }
- }
-
- /* set find a free spot to but the strip */
- if (newseq->seq1) {
- newseq->machine= MAX3(newseq->seq1->machine,
- newseq->seq2->machine,
- newseq->seq3->machine);
- }
- if(test_overlap_seq(newseq)) shuffle_seq(newseq);
-
- update_changed_seq_and_deps(newseq, 1, 1);
-
- /* push undo and go into grab mode */
- if(newseq->type == SEQ_PLUGIN) {
- BIF_undo_push("Add Plugin Strip, Sequencer");
- } else {
- BIF_undo_push("Add Effect Strip, Sequencer");
- }
-
- transform_seq_nomarker('g', 0);
-
- return 1;
-}
-
-static void load_plugin_seq(char *str) /* called from fileselect */
-{
- add_seq_effect(10, str);
-}
-
-void add_sequence(int type)
-{
- Editing *ed;
- Sequence *seq;
- Strip *strip;
- Scene *sce;
- float x, y;
- int cfra, machine;
- short nr, event, mval[2];
- char *str;
-
- if (type >= 0){
- /* bypass pupmenu for calls from menus (aphex) */
- switch(type){
- case SEQ_SCENE:
- event = 101;
- break;
- case SEQ_IMAGE:
- event = 1;
- break;
- case SEQ_MOVIE:
- event = 102;
- break;
- case SEQ_RAM_SOUND:
- event = 103;
- break;
- case SEQ_HD_SOUND:
- event = 104;
- break;
- case SEQ_MOVIE_AND_HD_SOUND:
- event = 105;
- break;
- case SEQ_PLUGIN:
- event = 10;
- break;
- case SEQ_CROSS:
- event = 2;
- break;
- case SEQ_ADD:
- event = 4;
- break;
- case SEQ_SUB:
- event = 5;
- break;
- case SEQ_ALPHAOVER:
- event = 7;
- break;
- case SEQ_ALPHAUNDER:
- event = 8;
- break;
- case SEQ_GAMCROSS:
- event = 3;
- break;
- case SEQ_MUL:
- event = 6;
- break;
- case SEQ_OVERDROP:
- event = 9;
- break;
- case SEQ_WIPE:
- event = 13;
- break;
- case SEQ_GLOW:
- event = 14;
- break;
- case SEQ_TRANSFORM:
- event = 15;
- break;
- case SEQ_COLOR:
- event = 16;
- break;
- case SEQ_SPEED:
- event = 17;
- break;
- default:
- event = 0;
- break;
- }
- }
- else {
- event= pupmenu("Add Sequence Strip%t"
- "|Image Sequence%x1"
- "|Movie%x102"
-#ifdef WITH_FFMPEG
- "|Movie + Audio (HD)%x105"
- "|Audio (RAM)%x103"
- "|Audio (HD)%x104"
-#else
- "|Audio (Wav)%x103"
-#endif
- "|Scene%x101"
- "|Plugin%x10"
- "|Cross%x2"
- "|Gamma Cross%x3"
- "|Add%x4"
- "|Sub%x5"
- "|Mul%x6"
- "|Alpha Over%x7"
- "|Alpha Under%x8"
- "|Alpha Over Drop%x9"
- "|Wipe%x13"
- "|Glow%x14"
- "|Transforms%x15"
- "|Color Generator%x16"
- "|Speed Control%x17");
- }
-
- if(event<1) return;
-
- if(G.scene->ed==0) {
- ed= G.scene->ed= MEM_callocN( sizeof(Editing), "addseq");
- ed->seqbasep= &ed->seqbase;
- }
- else ed= G.scene->ed;
-
- switch(event) {
- case 1:
- /* Image Dosnt work at the moment - TODO */
- //if(G.qual & LR_CTRLKEY)
- // activate_imageselect(FILE_SPECIAL, "Select Images", last_imagename, add_image_strips);
- //else
- activate_fileselect(FILE_SPECIAL, "Select Images", last_imagename, add_image_strips);
- break;
- case 105:
- activate_fileselect(FILE_SPECIAL, "Select Movie+Audio", last_imagename, add_movie_and_hdaudio_strip);
- break;
- case 102:
-
- activate_fileselect(FILE_SPECIAL, "Select Movie", last_imagename, add_movie_strip);
- break;
- case 101:
- /* new menu: */
- IDnames_to_pupstring(&str, NULL, NULL, &G.main->scene, (ID *)G.scene, NULL);
-
- event= pupmenu_col(str, 20);
-
- if(event> -1) {
- nr= 1;
- sce= G.main->scene.first;
- while(sce) {
- if( event==nr) break;
- nr++;
- sce= sce->id.next;
- }
- if(sce) {
-
- deselect_all_seq();
-
- /* where ? */
- getmouseco_areawin(mval);
- areamouseco_to_ipoco(G.v2d, mval, &x, &y);
- cfra= (int)(x+0.5);
- machine= (int)(y+0.5);
-
- seq= alloc_sequence(((Editing *)G.scene->ed)->seqbasep, cfra, machine);
- seq->type= SEQ_SCENE;
- seq->scene= sce;
- seq->sfra= sce->r.sfra;
- seq->len= sce->r.efra - sce->r.sfra + 1;
-
- seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
- strncpy(seq->name + 2, sce->id.name + 2,
- sizeof(seq->name) - 2);
- strip->len= seq->len;
- strip->us= 1;
- if(seq->len>0) strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
-
- BIF_undo_push("Add Scene Strip, Sequencer");
- transform_seq_nomarker('g', 0);
- }
- }
- MEM_freeN(str);
-
- break;
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- case 8:
- case 9:
- case 10:
- case 13:
- case 14:
- case 15:
- case 16:
- case 17:
- if(get_last_seq()==0 &&
- get_sequence_effect_num_inputs( event_to_efftype(event))> 0)
- error("Need at least one active sequence strip");
- else if(event==10)
- activate_fileselect(FILE_SPECIAL, "Select Plugin", U.plugseqdir, load_plugin_seq);
- else
- add_seq_effect(event, NULL);
-
- break;
- case 103:
- if (!last_sounddir[0]) strncpy(last_sounddir, U.sounddir, FILE_MAXDIR-1);
- activate_fileselect(FILE_SPECIAL, "Select Audio (RAM)", last_sounddir, add_sound_strip_ram);
- break;
- case 104:
- if (!last_sounddir[0]) strncpy(last_sounddir, U.sounddir, FILE_MAXDIR-1);
- activate_fileselect(FILE_SPECIAL, "Select Audio (HD)", last_sounddir, add_sound_strip_hd);
- break;
- }
-}
-
-void change_sequence(void)
-{
- Sequence *last_seq= get_last_seq();
- Scene *sce;
- short event;
-
- if(last_seq==0) return;
-
- if(last_seq->type & SEQ_EFFECT) {
- event = pupmenu("Change Effect%t"
- "|Switch A <-> B %x1"
- "|Switch B <-> C %x10"
- "|Plugin%x11"
- "|Recalculate%x12"
- "|Cross%x2"
- "|Gamma Cross%x3"
- "|Add%x4"
- "|Sub%x5"
- "|Mul%x6"
- "|Alpha Over%x7"
- "|Alpha Under%x8"
- "|Alpha Over Drop%x9"
- "|Wipe%x13"
- "|Glow%x14"
- "|Transform%x15"
- "|Color Generator%x16"
- "|Speed Control%x17");
- if(event > 0) {
- if(event==1) {
- SWAP(Sequence *,last_seq->seq1,last_seq->seq2);
- }
- else if(event==10) {
- SWAP(Sequence *,last_seq->seq2,last_seq->seq3);
- }
- else if(event==11) {
- activate_fileselect(
- FILE_SPECIAL, "Select Plugin",
- U.plugseqdir, change_plugin_seq);
- }
- else if(event==12);
- /* recalculate: only new_stripdata */
- else {
- /* free previous effect and init new effect */
- struct SeqEffectHandle sh;
-
- if (get_sequence_effect_num_inputs(
- last_seq->type)
- < get_sequence_effect_num_inputs(
- event_to_efftype(event))) {
- error("New effect needs more "
- "input strips!");
- } else {
- sh = get_sequence_effect(last_seq);
- sh.free(last_seq);
-
- last_seq->type
- = event_to_efftype(event);
-
- sh = get_sequence_effect(last_seq);
- sh.init(last_seq);
- }
- }
-
- update_changed_seq_and_deps(last_seq, 0, 1);
- allqueue(REDRAWSEQ, 0);
- BIF_undo_push("Change Strip Effect, Sequencer");
- }
- }
- else if(last_seq->type == SEQ_IMAGE) {
- if(okee("Change images")) {
- activate_fileselect(FILE_SPECIAL,
- "Select Images",
- last_imagename,
- reload_image_strip);
- }
- }
- else if(last_seq->type == SEQ_MOVIE) {
- ;
- }
- else if(last_seq->type == SEQ_SCENE) {
- event= pupmenu("Change Scene%t|Update Start and End");
-
- if(event==1) {
- sce= last_seq->scene;
-
- last_seq->len= sce->r.efra - sce->r.sfra + 1;
- last_seq->sfra= sce->r.sfra;
-
- /* bad code to change seq->len? update_changed_seq_and_deps() expects the strip->len to be OK */
- new_tstripdata(last_seq);
-
- update_changed_seq_and_deps(last_seq, 1, 1);
-
- allqueue(REDRAWSEQ, 0);
- }
- }
-
-}
-
-void reload_sequence(void)
-{
- Editing *ed= G.scene->ed;
- Sequence *seq;
- WHILE_SEQ(ed->seqbasep) {
- if(seq->flag & SELECT) {
- update_changed_seq_and_deps(seq, 0, 1);
- }
- }
- END_SEQ
- allqueue(REDRAWSEQ, 0);
-}
-
-void reassign_inputs_seq_effect()
-{
- Editing *ed= G.scene->ed;
- Sequence *seq1, *seq2, *seq3, *last_seq = get_last_seq();
-
- if(last_seq==0 || !(last_seq->type & SEQ_EFFECT)) return;
- if(ed==0) return;
-
- if(!seq_effect_find_selected(ed, last_seq, last_seq->type, &seq1, &seq2, &seq3))
- return;
-
- /* see reassigning would create a cycle */
- if(seq_is_predecessor(seq1, last_seq) || seq_is_predecessor(seq2, last_seq) ||
- seq_is_predecessor(seq3, last_seq)) {
- error("Can't reassign inputs: no cycles allowed");
- return;
- }
-
- last_seq->seq1 = seq1;
- last_seq->seq2 = seq2;
- last_seq->seq3 = seq3;
-
- update_changed_seq_and_deps(last_seq, 1, 1);
-
- allqueue(REDRAWSEQ, 0);
-}
-
-static Sequence *del_seq_find_replace_recurs(Sequence *seq)
-{
- Sequence *seq1, *seq2, *seq3;
-
- /* try to find a replacement input sequence, and flag for later deletion if
- no replacement can be found */
-
- if(!seq)
- return NULL;
- else if(!(seq->type & SEQ_EFFECT))
- return ((seq->flag & SELECT)? NULL: seq);
- else if(!(seq->flag & SELECT)) {
- /* try to find replacement for effect inputs */
- seq1= del_seq_find_replace_recurs(seq->seq1);
- seq2= del_seq_find_replace_recurs(seq->seq2);
- seq3= del_seq_find_replace_recurs(seq->seq3);
-
- if(seq1==seq->seq1 && seq2==seq->seq2 && seq3==seq->seq3);
- else if(seq1 || seq2 || seq3) {
- seq->seq1= (seq1)? seq1: (seq2)? seq2: seq3;
- seq->seq2= (seq2)? seq2: (seq1)? seq1: seq3;
- seq->seq3= (seq3)? seq3: (seq1)? seq1: seq2;
-
- update_changed_seq_and_deps(seq, 1, 1);
- }
- else
- seq->flag |= SELECT; /* mark for delete */
- }
-
- if (seq->flag & SELECT) {
- if((seq1 = del_seq_find_replace_recurs(seq->seq1))) return seq1;
- if((seq2 = del_seq_find_replace_recurs(seq->seq2))) return seq2;
- if((seq3 = del_seq_find_replace_recurs(seq->seq3))) return seq3;
- else return NULL;
- }
- else
- return seq;
-}
-
-static void recurs_del_seq_flag(ListBase *lb, short flag, short deleteall)
-{
- Sequence *seq, *seqn;
- Sequence *last_seq = get_last_seq();
-
- seq= lb->first;
- while(seq) {
- seqn= seq->next;
- if((seq->flag & flag) || deleteall) {
- if(seq->type==SEQ_RAM_SOUND && seq->sound)
- seq->sound->id.us--;
-
- BLI_remlink(lb, seq);
- if(seq==last_seq) set_last_seq(0);
- if(seq->type==SEQ_META) recurs_del_seq_flag(&seq->seqbase, flag, 1);
- if(seq->ipo) seq->ipo->id.us--;
- free_sequence(seq);
- }
- seq= seqn;
- }
-}
-
-void del_seq(void)
-{
- Sequence *seq;
- MetaStack *ms;
- Editing *ed;
-
- if(okee("Erase selected")==0) return;
-
- ed= G.scene->ed;
- if(ed==0) return;
-
- /* free imbufs of all dependent strips */
- for(seq=ed->seqbasep->first; seq; seq=seq->next)
- if(seq->flag & SELECT)
- update_changed_seq_and_deps(seq, 1, 0);
-
- /* for effects, try to find a replacement input */
- for(seq=ed->seqbasep->first; seq; seq=seq->next)
- if((seq->type & SEQ_EFFECT) && !(seq->flag & SELECT))
- del_seq_find_replace_recurs(seq);
-
- /* delete all selected strips */
- recurs_del_seq_flag(ed->seqbasep, SELECT, 0);
-
- /* updates lengths etc */
- seq= ed->seqbasep->first;
- while(seq) {
- calc_sequence(seq);
- seq= seq->next;
- }
-
- /* free parent metas */
- ms= ed->metastack.last;
- while(ms) {
- ms->parseq->strip->len= 0; /* force new alloc */
- calc_sequence(ms->parseq);
- ms= ms->prev;
- }
-
- BIF_undo_push("Delete Strip(s), Sequencer");
- allqueue(REDRAWSEQ, 0);
-}
-
-static Sequence *dupli_seq(Sequence *seq) {
- Sequence *seqn = NULL;
-
- if(seq->type==SEQ_META) {
- seqn= MEM_dupallocN(seq);
- seq->tmp= seqn;
-
- seqn->strip= MEM_dupallocN(seq->strip);
- seqn->strip->stripdata = 0;
- seqn->strip->tstripdata = 0;
-
- seqn->seqbase.first= seqn->seqbase.last= 0;
- /* WATCH OUT!!! - This metastrip is not recursively duplicated here - do this after!!! */
- /* - recurs_dupli_seq(&seq->seqbase,&seqn->seqbase);*/
- }
- else if(seq->type == SEQ_SCENE) {
- seqn= MEM_dupallocN(seq);
- seq->tmp= seqn;
-
- seqn->strip= MEM_dupallocN(seq->strip);
- seqn->strip->stripdata = 0;
- seqn->strip->tstripdata = 0;
- }
- else if(seq->type == SEQ_MOVIE) {
- seqn= MEM_dupallocN(seq);
- seq->tmp= seqn;
-
- seqn->strip= MEM_dupallocN(seq->strip);
- seqn->strip->stripdata =
- MEM_dupallocN(seq->strip->stripdata);
- seqn->strip->tstripdata = 0;
- seqn->anim= 0;
- }
- else if(seq->type == SEQ_RAM_SOUND) {
- seqn= MEM_dupallocN(seq);
- seq->tmp= seqn;
-
- seqn->strip= MEM_dupallocN(seq->strip);
- seqn->strip->stripdata =
- MEM_dupallocN(seq->strip->stripdata);
- seqn->strip->tstripdata = 0;
-
- seqn->anim= 0;
- seqn->sound->id.us++;
- if(seqn->ipo) seqn->ipo->id.us++;
- }
- else if(seq->type == SEQ_HD_SOUND) {
- seqn= MEM_dupallocN(seq);
- seq->tmp= seqn;
-
- seqn->strip= MEM_dupallocN(seq->strip);
- seqn->strip->stripdata =
- MEM_dupallocN(seq->strip->stripdata);
- seqn->strip->tstripdata = 0;
- seqn->anim= 0;
- seqn->hdaudio = 0;
- if(seqn->ipo) seqn->ipo->id.us++;
- } else if(seq->type == SEQ_IMAGE) {
- seqn= MEM_dupallocN(seq);
- seq->tmp= seqn;
-
- seqn->strip= MEM_dupallocN(seq->strip);
- seqn->strip->stripdata =
- MEM_dupallocN(seq->strip->stripdata);
- seqn->strip->tstripdata = 0;
- } else if(seq->type >= SEQ_EFFECT) {
- seqn= MEM_dupallocN(seq);
- seq->tmp= seqn;
-
- if(seq->seq1 && seq->seq1->tmp) seqn->seq1= seq->seq1->tmp;
- if(seq->seq2 && seq->seq2->tmp) seqn->seq2= seq->seq2->tmp;
- if(seq->seq3 && seq->seq3->tmp) seqn->seq3= seq->seq3->tmp;
-
- if(seqn->ipo) seqn->ipo->id.us++;
-
- if (seq->type & SEQ_EFFECT) {
- struct SeqEffectHandle sh;
- sh = get_sequence_effect(seq);
- if(sh.copy)
- sh.copy(seq, seqn);
- }
-
- seqn->strip= MEM_dupallocN(seq->strip);
- seqn->strip->stripdata = 0;
- seqn->strip->tstripdata = 0;
-
- } else {
- fprintf(stderr, "Aiiiiekkk! sequence type not "
- "handled in duplicate!\nExpect a crash"
- " now...\n");
- }
-
- return seqn;
-}
-
-static void recurs_dupli_seq(ListBase *old, ListBase *new)
-{
- Sequence *seq;
- Sequence *seqn = 0;
- Sequence *last_seq = get_last_seq();
-
- for(seq= old->first; seq; seq= seq->next) {
- seq->tmp= NULL;
- if(seq->flag & SELECT) {
- seqn = dupli_seq(seq);
- if (seqn) { /*should never fail */
- seq->flag &= SEQ_DESEL;
- seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL);
-
- BLI_addtail(new, seqn);
- if(seq->type==SEQ_META)
- recurs_dupli_seq(&seq->seqbase,&seqn->seqbase);
-
- if (seq == last_seq) {
- set_last_seq(seqn);
- }
- }
- }
- }
-}
-
-/* like duplicate, but only duplicate and cut overlapping strips,
- * strips to the left of the cutframe are ignored and strips to the right are moved into the new list */
-static void recurs_cut_seq(ListBase *old, ListBase *new, int cutframe)
-{
- Sequence *seq, *seq_next;
- Sequence *seqn = 0;
-
- TransSeq ts;
-
- seq= old->first;
-
- while(seq) {
- seq_next = seq->next; /* we need this because we may remove seq */
-
- seq->tmp= NULL;
- if(seq->flag & SELECT) {
- if(cutframe > seq->startdisp && cutframe < seq->enddisp) {
-
- /* backup values */
- ts.start= seq->start;
- ts.machine= seq->machine;
- ts.startstill= seq->startstill;
- ts.endstill= seq->endstill;
- ts.startdisp= seq->startdisp;
- ts.enddisp= seq->enddisp;
- ts.startofs= seq->startofs;
- ts.endofs= seq->endofs;
- ts.len= seq->len;
-
- /* First Strip! */
- /* strips with extended stillfames before */
- if(seq->type!=SEQ_META) {
-
- if ((seq->startstill) && (cutframe <seq->start)) {
- seq->start= cutframe -1;
- seq->startstill= cutframe -seq->startdisp -1;
- seq->len= 1;
- seq->endstill= 0;
- }
-
- /* normal strip */
- else if ((cutframe >=seq->start)&&(cutframe <=(seq->start+seq->len))) {
- seq->endofs = (seq->start+seq->len) - cutframe;
- }
-
- /* strips with extended stillframes after */
- else if (((seq->start+seq->len) < cutframe) && (seq->endstill)) {
- seq->endstill -= seq->enddisp - cutframe;
- }
-
- calc_sequence(seq);
- }
-
- /* Duplicate AFTER the first change */
- seqn = dupli_seq(seq);
-
- if (seqn) { /* should never fail */
- seqn->flag |= SELECT;
-
-
- BLI_addtail(new, seqn);
-
- /* dont transform meta's - just do their children then recalc */
- if(seq->type==SEQ_META) {
- recurs_cut_seq(&seq->seqbase,&seqn->seqbase, cutframe);
- } else {
- /* Second Strip! */
- /* strips with extended stillframes before */
- if ((seqn->startstill) && (cutframe == seqn->start + 1)) {
- seqn->start = ts.start;
- seqn->startstill= ts.start- cutframe;
- seqn->len = ts.len;
- seqn->endstill = ts.endstill;
- }
-
- /* normal strip */
- else if ((cutframe>=seqn->start)&&(cutframe<=(seqn->start+seqn->len))) {
- seqn->startstill = 0;
- seqn->startofs = cutframe - ts.start;
- seqn->endofs = ts.endofs;
- seqn->endstill = ts.endstill;
- }
-
- /* strips with extended stillframes after */
- else if (((seqn->start+seqn->len) < cutframe) && (seqn->endstill)) {
- seqn->start = cutframe - ts.len +1;
- seqn->startofs = ts.len-1;
- seqn->endstill = ts.enddisp - cutframe -1;
- seqn->startstill = 0;
- }
- }
-
- if(seq->type==SEQ_META) /* account for strips within changing */
- calc_sequence(seq);
-
- calc_sequence(seqn);
- }
- } else if (seq->enddisp <= cutframe) {
- /* do nothing */
- } else if (seq->startdisp >= cutframe) {
- /* move into new list */
- BLI_remlink(old, seq);
- BLI_addtail(new, seq);
- }
- }
- seq = seq_next;
- }
-}
-
-void seq_cut(int cutframe)
-{
- Editing *ed;
- ListBase newlist;
- char side;
- ed= G.scene->ed;
- if(ed==0) return;
-
- newlist.first= newlist.last= NULL;
-
- recurs_cut_seq(ed->seqbasep, &newlist, cutframe);
-
- if (newlist.first) { /* simple check to see if anything was done */
- Sequence *seq;
- addlisttolist(ed->seqbasep, &newlist);
-
-
- /* change the selection, not strictly needed but nice */
- side = mouse_cfra_side(cutframe);
-
- WHILE_SEQ(ed->seqbasep) {
- if (side=='L') {
- if ( seq->startdisp >= cutframe ) {
- seq->flag &= ~SELECT;
- }
- } else {
- if ( seq->enddisp <= cutframe ) {
- seq->flag &= ~SELECT;
- }
- }
- }
- END_SEQ;
-
- /* as last: */
- sort_seq();
-
- allqueue(REDRAWSEQ, 0);
- BIF_undo_push("Cut Strips, Sequencer");
- }
-}
-
-void add_duplicate_seq(void)
-{
- Editing *ed;
- ListBase new;
-
- ed= G.scene->ed;
- if(ed==0) return;
-
- new.first= new.last= 0;
-
- recurs_dupli_seq(ed->seqbasep, &new);
- addlisttolist(ed->seqbasep, &new);
-
- BIF_undo_push("Add Duplicate, Sequencer");
- transform_seq_nomarker('g', 0);
-}
-
-int insert_gap(int gap, int cfra)
-{
- Sequence *seq;
- Editing *ed;
- int done=0;
-
- /* all strips >= cfra are shifted */
- ed= G.scene->ed;
- if(ed==0) return 0;
-
- WHILE_SEQ(ed->seqbasep) {
- if(seq->startdisp >= cfra) {
- seq->start+= gap;
- calc_sequence(seq);
- done= 1;
- }
- }
- END_SEQ
-
- return done;
-}
-
-void touch_seq_files(void)
-{
- Sequence *seq;
- Editing *ed;
- char str[256];
-
- /* touch all strips with movies */
- ed= G.scene->ed;
- if(ed==0) return;
-
- if(okee("Touch and print selected movies")==0) return;
-
- waitcursor(1);
-
- WHILE_SEQ(ed->seqbasep) {
- if(seq->flag & SELECT) {
- if(seq->type==SEQ_MOVIE) {
- if(seq->strip && seq->strip->stripdata) {
- BLI_make_file_string(G.sce, str, seq->strip->dir, seq->strip->stripdata->name);
- BLI_touch(seq->name);
- }
- }
-
- }
- }
- END_SEQ
-
- waitcursor(0);
-}
-
-void set_filter_seq(void)
-{
- Sequence *seq;
- Editing *ed;
-
- ed= G.scene->ed;
- if(ed==0) return;
-
- if(okee("Set FilterY")==0) return;
-
- WHILE_SEQ(ed->seqbasep) {
- if(seq->flag & SELECT) {
- if(seq->type==SEQ_MOVIE) {
- seq->flag |= SEQ_FILTERY;
- }
-
- }
- }
- END_SEQ
-
-}
-
-void seq_remap_paths(void)
-{
- Sequence *seq, *last_seq = get_last_seq();
- Editing *ed;
- char from[FILE_MAX], to[FILE_MAX], stripped[FILE_MAX];
-
- ed= G.scene->ed;
- if(ed==NULL || last_seq==NULL)
- return;
-
- BLI_strncpy(from, last_seq->strip->dir, FILE_MAX);
- if (0==sbutton(from, 0, sizeof(from)-1, "From: "))
- return;
-
- strcpy(to, from);
- if (0==sbutton(to, 0, sizeof(to)-1, "To: "))
- return;
-
- if (strcmp(to, from)==0)
- return;
-
- WHILE_SEQ(ed->seqbasep) {
- if(seq->flag & SELECT) {
- if(strncmp(seq->strip->dir, from, strlen(from))==0) {
- printf("found %s\n", seq->strip->dir);
-
- /* strip off the beginning */
- stripped[0]= 0;
- BLI_strncpy(stripped, seq->strip->dir + strlen(from), FILE_MAX);
-
- /* new path */
- BLI_strncpy(seq->strip->dir, to, FILE_MAX);
- strcat(seq->strip->dir, stripped);
- printf("new %s\n", seq->strip->dir);
- }
- }
- }
- END_SEQ
-
- BIF_undo_push("Remap Paths, Sequencer");
- allqueue(REDRAWSEQ, 0);
-}
-
-
-void no_gaps(void)
-{
- Editing *ed;
- int cfra, first= 0, done;
-
- ed= G.scene->ed;
- if(ed==0) return;
-
- for(cfra= CFRA; cfra<=EFRA; cfra++) {
- if(first==0) {
- if( evaluate_seq_frame(cfra) ) first= 1;
- }
- else {
- done= 1;
- while( evaluate_seq_frame(cfra) == 0) {
- done= insert_gap(-1, cfra);
- if(done==0) break;
- }
- if(done==0) break;
- }
- }
-
- BIF_undo_push("No Gaps, Sequencer");
- allqueue(REDRAWSEQ, 0);
-}
-
-
-/* ****************** META ************************* */
-
-void make_meta(void)
-{
- Sequence *seq, *seqm, *next;
- Editing *ed;
- int tot;
-
- ed= G.scene->ed;
- if(ed==0) return;
-
- /* is there more than 1 select */
- tot= 0;
- seq= ed->seqbasep->first;
- while(seq) {
- if(seq->flag & SELECT) {
- tot++;
- if (seq->type == SEQ_RAM_SOUND) {
- error("Can't make Meta Strip from audio");
- return;
- }
- }
- seq= seq->next;
- }
- if(tot < 2) return;
-
- if(okee("Make Meta Strip")==0) return;
-
- /* test relationships */
- seq= ed->seqbasep->first;
- while(seq) {
- if(seq->flag & SELECT) {
- if(seq->type & SEQ_EFFECT) {
- if(seq->seq1 &&
- (seq->seq1->flag & SELECT)==0) tot= 0;
- if(seq->seq2 &&
- (seq->seq2->flag & SELECT)==0) tot= 0;
- if(seq->seq3 &&
- (seq->seq3->flag & SELECT)==0) tot= 0;
- }
- }
- else if(seq->type & SEQ_EFFECT) {
- if(seq->seq1 &&
- (seq->seq1->flag & SELECT)) tot= 0;
- if(seq->seq2 &&
- (seq->seq2->flag & SELECT)) tot= 0;
- if(seq->seq3 &&
- (seq->seq3->flag & SELECT)) tot= 0;
- }
- if(tot==0) break;
- seq= seq->next;
- }
- if(tot==0) {
- error("Please select all related strips");
- return;
- }
-
- /* remove all selected from main list, and put in meta */
-
- seqm= alloc_sequence(((Editing *)G.scene->ed)->seqbasep, 1, 1);
- seqm->type= SEQ_META;
- seqm->flag= SELECT;
-
- seq= ed->seqbasep->first;
- while(seq) {
- next= seq->next;
- if(seq!=seqm && (seq->flag & SELECT)) {
- BLI_remlink(ed->seqbasep, seq);
- BLI_addtail(&seqm->seqbase, seq);
- }
- seq= next;
- }
- calc_sequence(seqm);
-
- seqm->strip= MEM_callocN(sizeof(Strip), "metastrip");
- seqm->strip->len= seqm->len;
- seqm->strip->us= 1;
-
- set_meta_stripdata(seqm);
-
- if( test_overlap_seq(seqm) ) shuffle_seq(seqm);
-
- BIF_undo_push("Make Meta Strip, Sequencer");
- allqueue(REDRAWSEQ, 0);
-}
-
-static int seq_depends_on_meta(Sequence *seq, Sequence *seqm)
-{
- if (seq == seqm) return 1;
- else if (seq->seq1 && seq_depends_on_meta(seq->seq1, seqm)) return 1;
- else if (seq->seq2 && seq_depends_on_meta(seq->seq2, seqm)) return 1;
- else if (seq->seq3 && seq_depends_on_meta(seq->seq3, seqm)) return 1;
- else return 0;
-}
-
-void un_meta(void)
-{
- Editing *ed;
- Sequence *seq, *last_seq = get_last_seq();
-
- ed= G.scene->ed;
- if(ed==0) return;
-
- if(last_seq==0 || last_seq->type!=SEQ_META) return;
-
- if(okee("Un Meta Strip")==0) return;
-
- addlisttolist(ed->seqbasep, &last_seq->seqbase);
-
- last_seq->seqbase.first= 0;
- last_seq->seqbase.last= 0;
-
- BLI_remlink(ed->seqbasep, last_seq);
- free_sequence(last_seq);
-
- /* emtpy meta strip, delete all effects depending on it */
- for(seq=ed->seqbasep->first; seq; seq=seq->next)
- if((seq->type & SEQ_EFFECT) && seq_depends_on_meta(seq, last_seq))
- seq->flag |= SEQ_FLAG_DELETE;
-
- recurs_del_seq_flag(ed->seqbasep, SEQ_FLAG_DELETE, 0);
-
- /* test for effects and overlap */
- WHILE_SEQ(ed->seqbasep) {
- if(seq->flag & SELECT) {
- seq->flag &= ~SEQ_OVERLAP;
- if( test_overlap_seq(seq) ) {
- shuffle_seq(seq);
- }
- }
- }
- END_SEQ;
-
- sort_seq();
-
- BIF_undo_push("Un-Make Meta Strip, Sequencer");
- allqueue(REDRAWSEQ, 0);
-
-}
-
-void exit_meta(void)
-{
- Sequence *seq;
- MetaStack *ms;
- Editing *ed;
-
- ed= G.scene->ed;
- if(ed==0) return;
-
- if(ed->metastack.first==0) return;
-
- ms= ed->metastack.last;
- BLI_remlink(&ed->metastack, ms);
-
- ed->seqbasep= ms->oldbasep;
-
- /* recalc entire meta */
- set_meta_stripdata(ms->parseq);
-
- /* recalc all: the meta can have effects connected to it */
- seq= ed->seqbasep->first;
- while(seq) {
- calc_sequence(seq);
- seq= seq->next;
- }
-
- set_last_seq(ms->parseq);
-
- ms->parseq->flag= SELECT;
- recurs_sel_seq(ms->parseq);
-
- MEM_freeN(ms);
- allqueue(REDRAWSEQ, 0);
-
- BIF_undo_push("Exit Meta Strip, Sequence");
-}
-
-
-void enter_meta(void)
-{
- MetaStack *ms;
- Editing *ed;
- Sequence *last_seq= get_last_seq();
-
- ed= G.scene->ed;
- if(ed==0) return;
-
- if(last_seq==0 || last_seq->type!=SEQ_META || last_seq->flag==0) {
- exit_meta();
- return;
- }
-
- ms= MEM_mallocN(sizeof(MetaStack), "metastack");
- BLI_addtail(&ed->metastack, ms);
- ms->parseq= last_seq;
- ms->oldbasep= ed->seqbasep;
-
- ed->seqbasep= &last_seq->seqbase;
-
- set_last_seq(NULL);
- allqueue(REDRAWSEQ, 0);
- BIF_undo_push("Enter Meta Strip, Sequence");
-}
-
-
-/* ****************** END META ************************* */
-
-static int seq_get_snaplimit(void)
-{
- /* fake mouse coords to get the snap value
- a bit lazy but its only done once pre transform */
- float xmouse, ymouse, x;
- short mval[2] = {24, 0}; /* 24 screen px snap */
- areamouseco_to_ipoco(G.v2d, mval, &xmouse, &ymouse);
- x = xmouse;
- mval[0] = 0;
- areamouseco_to_ipoco(G.v2d, mval, &xmouse, &ymouse);
- return (int)(x - xmouse);
-}
-
-/* use to impose limits when dragging/extending - so impossible situations dont happen */
-static void transform_grab_xlimits(Sequence *seq, int leftflag, int rightflag)
-{
- if(leftflag) {
- if (seq_tx_get_final_left(seq) >= seq_tx_get_final_right(seq)) {
- seq_tx_set_final_left(seq, seq_tx_get_final_right(seq)-1);
- }
-
- if (check_single_seq(seq)==0) {
- if (seq_tx_get_final_left(seq) >= seq_tx_get_end(seq)) {
- seq_tx_set_final_left(seq, seq_tx_get_end(seq)-1);
- }
-
- /* dosnt work now - TODO */
- /*
- if (seq_tx_get_start(seq) >= seq_tx_get_final_right(seq)) {
- int ofs;
- ofs = seq_tx_get_start(seq) - seq_tx_get_final_right(seq);
- seq->start -= ofs;
- seq_tx_set_final_left(seq, seq_tx_get_final_left(seq) + ofs );
- }*/
-
- }
- }
-
- if(rightflag) {
- if (seq_tx_get_final_right(seq) <= seq_tx_get_final_left(seq)) {
- seq_tx_set_final_right(seq, seq_tx_get_final_left(seq)+1);
- }
-
- if (check_single_seq(seq)==0) {
- if (seq_tx_get_final_right(seq) <= seq_tx_get_start(seq)) {
- seq_tx_set_final_right(seq, seq_tx_get_start(seq)+1);
- }
- }
- }
-
- /* sounds cannot be extended past their endpoints */
- if (seq->type == SEQ_RAM_SOUND || seq->type == SEQ_HD_SOUND) {
- seq->startstill= 0;
- seq->endstill= 0;
- }
-}
-
-void transform_seq(int mode, int context)
-{
- SpaceSeq *sseq= curarea->spacedata.first;
- Sequence *seq, *last_seq;
- Editing *ed;
- float dx, dy, dvec[2], div;
- TransSeq *transmain, *ts;
- int totstrip=0, firsttime=1, afbreek=0, midtog= 0, proj= 0;
- int ix, iy; /* these values are used for storing the mouses offset from its original location */
- int ix_old = 0;
- unsigned short event = 0;
- short mval[2], val, xo, yo, xn, yn;
- char str[32];
- char side= 'L'; /* for extend mode only - use to know which side to extend on */
- char marker_moved=0; /* if we mvoed a marker, redraw all marker views */
- /* used for extend in a number of places */
- int cfra = CFRA;
-
- /* for snapping */
- char snapskip = 0, snap, snap_old= 0;
- int snapdist_max = seq_get_snaplimit();
- /* at the moment there are only 4 possible snap points,
- - last_seq (start,end)
- - selected bounds (start/end)
- - last_seq (next/prev)
- - current frame */
- int snap_points[4], snap_point_num = 0;
- int j; /* loop on snap_points */
-
- /* for markers */
- int *oldframe = NULL, totmark=0, a;
- TimeMarker *marker;
-
- /* looping on sequences, WHILE_SEQ macro allocates memory each time */
- int totseq_index, seq_index;
- Sequence **seqar = 0;
-
- if(mode!='g' && mode!='e') return; /* from gesture */
-
- /* which seqs are involved */
- ed= G.scene->ed;
- if(ed==0) return;
-
- /* Build the sequence array once, be sure to free it */
- build_seqar( ed->seqbasep, &seqar, &totseq_index );
-
- if (seqar) {
- for(seq_index=0, seq=seqar[0]; seq_index < totseq_index; seq=seqar[++seq_index]) {
- if(seq->flag & SELECT) totstrip++;
- }
- }
-
- if (sseq->flag & SEQ_MARKER_TRANS) {
- for(marker= G.scene->markers.first; marker; marker= marker->next) {
- if(marker->flag & SELECT) totmark++;
- }
- }
-
- if(totstrip==0 && totmark==0) {
- if(seqar) MEM_freeN(seqar);
- return;
- }
-
- G.moving= 1;
-
- last_seq = get_last_seq();
-
- ts=transmain= MEM_callocN(totstrip*sizeof(TransSeq), "transseq");
-
- for(seq_index=0, seq=seqar[0]; seq_index < totseq_index; seq=seqar[++seq_index]) {
- if(seq->flag & SELECT) {
- ts->start= seq->start;
- ts->machine= seq->machine;
- ts->startstill= seq->startstill;
- ts->endstill= seq->endstill;
- ts->startofs= seq->startofs;
- ts->endofs= seq->endofs;
-
- /* for extend only */
- if (mode=='e') {
- ts->final_left = seq_tx_get_final_left(seq);
- ts->final_right = seq_tx_get_final_right(seq);
- }
- ts++;
- }
- }
-
- getmouseco_areawin(mval);
-
- /* choose the side based on which side of the playhead the mouse is on */
- if (mode=='e')
- side = mouse_cfra_side(cfra);
-
- /* Markers */
- if (sseq->flag & SEQ_MARKER_TRANS && totmark) {
- oldframe= MEM_mallocN(totmark*sizeof(int), "marker array");
- for(a=0, marker= G.scene->markers.first; marker; marker= marker->next) {
- if(marker->flag & SELECT) {
- if (mode=='e') {
-
- /* when extending, invalidate markers on the other side by using an invalid frame value */
- if ((side == 'L' && marker->frame > cfra) || (side == 'R' && marker->frame < cfra)) {
- oldframe[a] = MAXFRAME+1;
- } else {
- oldframe[a]= marker->frame;
- }
- } else {
- oldframe[a]= marker->frame;
- }
- a++;
- }
- }
- }
-
- xo=xn= mval[0];
- yo=yn= mval[1];
- dvec[0]= dvec[1]= 0.0;
-
- while(afbreek==0) {
- getmouseco_areawin(mval);
- G.qual = get_qual();
- snap = (G.qual & LR_CTRLKEY) ? 1 : 0;
-
- if(mval[0]!=xo || mval[1]!=yo || firsttime || snap != snap_old) {
- if (firsttime) {
- snap_old = snap;
- firsttime= 0;
- }
-
- /* run for either grab or extend */
- dx= mval[0]- xo;
- dy= mval[1]- yo;
-
- div= G.v2d->mask.xmax-G.v2d->mask.xmin;
- dx= (G.v2d->cur.xmax-G.v2d->cur.xmin)*(dx)/div;
-
- div= G.v2d->mask.ymax-G.v2d->mask.ymin;
- dy= (G.v2d->cur.ymax-G.v2d->cur.ymin)*(dy)/div;
-
- if(G.qual & LR_SHIFTKEY) {
- if(dx>1.0) dx= 1.0; else if(dx<-1.0) dx= -1.0;
- }
-
- dvec[0]+= dx;
- dvec[1]+= dy;
-
- if(midtog) dvec[proj]= 0.0;
- ix= floor(dvec[0]+0.5);
- iy= floor(dvec[1]+0.5);
-
- ts= transmain;
-
- /* SNAP! use the active Seq */
- snap = G.qual & LR_CTRLKEY ? 1 : 0;
-
- if (!snap) {
- snapskip = 0;
- } else {
- int dist;
- int snap_ofs= 0;
- int snap_dist= snapdist_max;
-
- /* Get sequence points to snap to the markers */
-
- snap_point_num=0;
- if (last_seq && (last_seq->flag & SELECT)) { /* active seq bounds */
- if(seq_tx_check_left(last_seq))
- snap_points[snap_point_num++] = seq_tx_get_final_left(last_seq);
- if(seq_tx_check_right(last_seq))
- snap_points[snap_point_num++] = seq_tx_get_final_right(last_seq);
-
- }
- if (totstrip > 1) { /* selection bounds */
- int bounds_left = MAXFRAME*2;
- int bounds_right = -(MAXFRAME*2);
-
- for(seq_index=0, seq=seqar[0]; seq_index < totseq_index; seq=seqar[++seq_index]) {
- if(seq->flag & SELECT) {
- if(seq_tx_check_left(seq))
- bounds_left = MIN2(bounds_left, seq_tx_get_final_left(seq));
- if(seq_tx_check_right(seq))
- bounds_right = MAX2(bounds_right,seq_tx_get_final_right(seq));
- }
- }
-
- /* its possible there were no points to set on either side */
- if (bounds_left != MAXFRAME*2)
- snap_points[snap_point_num++] = bounds_left;
- if (bounds_right != -(MAXFRAME*2))
- snap_points[snap_point_num++] = bounds_right;
- }
-
-
- /* Define so we can snap to other points without hassle */
-
-#define TESTSNAP(test_frame)\
- for(j=0; j<snap_point_num; j++) {\
- /* see if this beats the current best snap point */\
- dist = abs(snap_points[j] - test_frame);\
- if (dist < snap_dist) {\
- snap_ofs = test_frame - snap_points[j];\
- snap_dist = dist;\
- }\
- }
-
-
- /* Detect the best marker to snap to! */
- for(a=0, marker= G.scene->markers.first; marker; a++, marker= marker->next) {
-
- /* dont snap to a marker on the wrong extend side */
- if (mode=='e' && ((side == 'L' && marker->frame > cfra) || (side == 'R' && marker->frame < cfra)))
- continue;
-
- /* when we are moving markers, dont snap to selected markers, durr */
- if ((sseq->flag & SEQ_MARKER_TRANS)==0 || (marker->flag & SELECT)==0) {
-
- /* loop over the sticky points - max 4 */
- TESTSNAP(marker->frame);
- if (snap_dist == 0) break; /* alredy snapped? - stop looking */
- }
- }
-
- if (snap_dist) {
- TESTSNAP(cfra);
- }
-
- /* check seq's next to the active also - nice for quick snapping */
- if (snap_dist && last_seq && seq_tx_check_left(last_seq)) {
- seq = find_next_prev_sequence(last_seq, 1, 0); /* left */
- if(seq && !seq_tx_check_right(seq))
- TESTSNAP(seq_tx_get_final_right(seq));
- }
-
- if (snap_dist && last_seq && seq_tx_check_right(last_seq)) {
- seq = find_next_prev_sequence(last_seq, 2, 0); /* right */
- if(seq && !seq_tx_check_left(seq))
- TESTSNAP(seq_tx_get_final_left(seq));
- }
-
-#undef TESTSNAP
-
- if (abs(ix_old-ix) >= snapdist_max) {
- /* mouse has moved out of snap range */
- snapskip = 0;
- } else if (snap_dist==0) {
- /* nowhere to move, dont do anything */
- snapskip = 1;
- } else if (snap_dist < snapdist_max) {
- /* do the snapping by adjusting the mouse offset value */
- ix = ix_old + snap_ofs;
- }
- }
-
- if (mode=='g' && !snapskip) {
- /* Grab */
- for(seq_index=0, seq=seqar[0]; seq_index < totseq_index; seq=seqar[++seq_index]) {
- if(seq->flag & SELECT) {
- int myofs;
- // SEQ_DEBUG_INFO(seq);
-
- /* X Transformation */
- if(seq->flag & SEQ_LEFTSEL) {
- myofs = (ts->startofs - ts->startstill);
- seq_tx_set_final_left(seq, ts->start + (myofs + ix));
- }
- if(seq->flag & SEQ_RIGHTSEL) {
- myofs = (ts->endstill - ts->endofs);
- seq_tx_set_final_right(seq, ts->start + seq->len + (myofs + ix));
- }
- transform_grab_xlimits(seq, seq->flag & SEQ_LEFTSEL, seq->flag & SEQ_RIGHTSEL);
-
- if( (seq->flag & (SEQ_LEFTSEL+SEQ_RIGHTSEL))==0 ) {
- if(sequence_is_free_transformable(seq)) seq->start= ts->start+ ix;
-
- /* Y Transformation */
- if(seq->depth==0) seq->machine= ts->machine+ iy;
-
- if(seq->machine<1) seq->machine= 1;
- else if(seq->machine>= MAXSEQ) seq->machine= MAXSEQ;
- }
- calc_sequence(seq);
- ts++;
- }
- }
-
- /* Markers */
- if (sseq->flag & SEQ_MARKER_TRANS) {
- for(a=0, marker= G.scene->markers.first; marker; marker= marker->next) {
- if(marker->flag & SELECT) {
- marker->frame= oldframe[a] + ix;
- marker_moved=1;
- a++;
- }
- }
- }
-
- /* Extend, grabs one side of the current frame */
- } else if (mode=='e' && !snapskip) {
- int myofs; /* offset from start of the seq clip */
- int xnew, final_left, final_right; /* just to store results from seq_tx_get_final_left/right */
-
- /* we dont use seq side selection flags for this,
- instead we need to calculate which sides to move
- based on its initial position from the cursor */
- int move_left, move_right;
-
- /* Extend, Similar to grab but operate on one side of the cursor */
- for(seq_index=0, seq=seqar[0]; seq_index < totseq_index; seq=seqar[++seq_index]) {
- if(seq->flag & SELECT) {
- /* only move the contents of the metastrip otherwise the transformation is applied twice */
- if (sequence_is_free_transformable(seq) && seq->type != SEQ_META) {
-
- move_left = move_right = 0;
-
- //SEQ_DEBUG_INFO(seq);
-
- final_left = seq_tx_get_final_left(seq);
- final_right = seq_tx_get_final_right(seq);
-
- /* Only X Axis moving */
-
- /* work out which sides to move first */
- if (side=='L') {
- if (final_left <= cfra || ts->final_left <= cfra) move_left = 1;
- if (final_right <= cfra || ts->final_right <= cfra) move_right = 1;
- } else {
- if (final_left >= cfra || ts->final_left >= cfra) move_left = 1;
- if (final_right >= cfra || ts->final_right >= cfra) move_right = 1;
- }
-
- if (move_left && move_right) {
- /* simple move - dont need to do anything complicated */
- seq->start= ts->start+ ix;
- } else {
- if (side=='L') {
- if (move_left) {
-
- /* Similar to other funcs */
- myofs = (ts->startofs - ts->startstill);
- xnew = ts->start + (ix + myofs);
-
- /* make sure the we dont resize down to 0 or less in size
- also include the startstill so the contense dosnt go outside the bounds,
- if the seq->startofs is 0 then its ignored */
-
- /* TODO remove, add check to transform_grab_xlimits, works ok for now */
- if (xnew + seq->startstill > final_right-1) {
- xnew = (final_right-1) - seq->startstill;
- }
- /* Note, this is the only case where the start needs to be adjusted
- since its not needed when modifying the end or when moving the entire sequence */
- //seq->start = ts->start+ix; // This works when xnew is not clamped, line below takes clamping into account
- seq->start= xnew - myofs; /* TODO see above */
- /* done with unique stuff */
-
- seq_tx_set_final_left(seq, xnew);
- transform_grab_xlimits(seq, 1, 0);
-
- /* Special case again - setting the end back to what it was */
- seq_tx_set_final_right(seq, final_right);
- }
- if (move_right) {
- myofs = (ts->endstill - ts->endofs);
- xnew = ts->start + seq->len + (myofs + ix);
- seq_tx_set_final_right(seq, xnew);
- transform_grab_xlimits(seq, 0, 1);
- }
- } else { /* R */
- if (move_left) {
- myofs = (ts->startofs - ts->startstill);
- xnew = ts->start + (myofs + ix);
- seq_tx_set_final_left(seq, xnew);
- transform_grab_xlimits(seq, 1, 0);
- }
- if (move_right) {
- myofs = (ts->endstill - ts->endofs);
- xnew = ts->start + seq->len + (myofs + ix);
- seq_tx_set_final_right(seq, xnew);
- transform_grab_xlimits(seq, 0, 1);
- }
- }
- }
- }
- calc_sequence(seq);
- ts++;
- }
- }
-
- /* markers */
- if (sseq->flag & SEQ_MARKER_TRANS) {
- for(a=0, marker= G.scene->markers.first; marker; marker= marker->next) {\
- if (marker->flag & SELECT) {
- if(oldframe[a] != MAXFRAME+1) {
- marker->frame= oldframe[a] + ix;
- marker_moved=1;
- }
- a++;
- }
- }
- }
- }
-
- sprintf(str, "X: %d Y: %d ", ix, iy);
- headerprint(str);
-
- /* remember the last value for snapping,
- only set if we are not currently snapped,
- prevents locking on a keyframe */
- if (!snapskip)
- ix_old = ix;
-
- /* just to tell if ctrl was pressed, this means we get a recalc when pressing ctrl */
- snap_old = snap;
-
- /* rememver last mouse values so we can skip transform when nothing happens */
- xo= mval[0];
- yo= mval[1];
-
- /* test for effect and overlap */
- for(seq_index=0, seq=seqar[0]; seq_index < totseq_index; seq=seqar[++seq_index]) {
- if(seq->flag & SELECT) {
- seq->flag &= ~SEQ_OVERLAP;
- if( test_overlap_seq(seq) ) {
- seq->flag |= SEQ_OVERLAP;
- }
- }
- else if(seq->type & SEQ_EFFECT) {
- if(seq->seq1 && seq->seq1->flag & SELECT) calc_sequence(seq);
- else if(seq->seq2 && seq->seq2->flag & SELECT) calc_sequence(seq);
- else if(seq->seq3 && seq->seq3->flag & SELECT) calc_sequence(seq);
- }
- }
-
- force_draw(0);
-
- }
- else BIF_wait_for_statechange();
-
- while(qtest()) {
- event= extern_qread(&val);
- if(val) {
- switch(event) {
- case ESCKEY:
- case LEFTMOUSE:
- case RIGHTMOUSE:
- case SPACEKEY:
- case RETKEY:
- afbreek= 1;
- break;
- case MIDDLEMOUSE:
- midtog= ~midtog;
- if(midtog) {
- if( abs(mval[0]-xn) > abs(mval[1]-yn)) proj= 1;
- else proj= 0;
- firsttime= 1;
- }
- break;
- default:
- arrows_move_cursor(event);
- }
- }
- if(afbreek) break;
- }
- }
-
- if((event==ESCKEY) || (event==RIGHTMOUSE)) {
-
- ts= transmain;
- for(seq_index=0, seq=seqar[0]; seq_index < totseq_index; seq=seqar[++seq_index]) {
- if(seq->flag & SELECT) {
- seq->start= ts->start;
- seq->machine= ts->machine;
- seq->startstill= ts->startstill;
- seq->endstill= ts->endstill;
- seq->startofs= ts->startofs;
- seq->endofs= ts->endofs;
-
- calc_sequence(seq);
- seq->flag &= ~SEQ_OVERLAP;
-
- ts++;
- } else if(seq->type & SEQ_EFFECT) {
- if(seq->seq1 && seq->seq1->flag & SELECT) calc_sequence(seq);
- else if(seq->seq2 && seq->seq2->flag & SELECT) calc_sequence(seq);
- else if(seq->seq3 && seq->seq3->flag & SELECT) calc_sequence(seq);
- }
- }
-
- /* Markers */
- if (sseq->flag & SEQ_MARKER_TRANS) {
- for(a=0, marker= G.scene->markers.first; marker; marker= marker->next) {
- if (marker->flag & SELECT) {
- if(oldframe[a] != MAXFRAME+1) {
- marker->frame= oldframe[a];
- }
- a++;
- }
- }
- marker_moved = 0;
- }
- } else {
-
- /* images, effects and overlap */
- for(seq_index=0, seq=seqar[0]; seq_index < totseq_index; seq=seqar[++seq_index]) {
-
- /* fixes single image strips - makes sure their start is not out of bounds
- ideally this would be done during transform since data is rendered at that time
- however it ends up being a lot messier! - Campbell */
- fix_single_image_seq(seq);
-
- if(seq->type == SEQ_META) {
- calc_sequence(seq);
- seq->flag &= ~SEQ_OVERLAP;
- if( test_overlap_seq(seq) ) shuffle_seq(seq);
- }
- else if(seq->flag & SELECT) {
- calc_sequence(seq);
- seq->flag &= ~SEQ_OVERLAP;
- if( test_overlap_seq(seq) ) shuffle_seq(seq);
- }
- else if(seq->type & SEQ_EFFECT) calc_sequence(seq);
- }
-
- /* as last: */
- sort_seq();
- }
-
- /* free sequence array */
- if(seqar) MEM_freeN(seqar);
-
- G.moving= 0;
- MEM_freeN(transmain);
-
- if (sseq->flag & SEQ_MARKER_TRANS && totmark)
- MEM_freeN(oldframe);
-
- if (mode=='g')
- BIF_undo_push("Transform Grab, Sequencer");
- else if (mode=='e')
- BIF_undo_push("Transform Extend, Sequencer");
-
- if (marker_moved)
- allqueue(REDRAWMARKER, 0);
- else
- allqueue(REDRAWSEQ, 0);
-}
-
-/* since grab can move markers, we must turn this off before adding a new sequence
- I am not so happy with this, but the baddness in contained here - Campbell */
-void transform_seq_nomarker(int mode, int context) {
- SpaceSeq *sseq= curarea->spacedata.first;
- int flag_back;
- if (!sseq) return; /* should never happen */
- flag_back = sseq->flag;
- sseq->flag &= ~SEQ_MARKER_TRANS;
-
- transform_seq(mode, context);
-
- sseq->flag = flag_back;
-}
-
-void seq_separate_images(void)
-{
- Editing *ed;
- Sequence *seq, *seq_new, *seq_next;
- Strip *strip_new;
- StripElem *se, *se_new;
- int start_ofs, cfra, frame_end;
- static int step= 1;
-
- add_numbut(0, NUM|INT, "Image Duration:", 1, 256, &step, NULL);
- if (!do_clever_numbuts("Separate Images", 1, REDRAW))
- return;
-
- ed= G.scene->ed;
- if(ed==0) return;
-
- seq= ed->seqbasep->first;
-
- while (seq) {
- if((seq->flag & SELECT) && (seq->type == SEQ_IMAGE) && (seq->len > 1)) {
- /* remove seq so overlap tests dont conflict,
- see free_sequence below for the real free'ing */
- seq_next = seq->next;
- BLI_remlink(ed->seqbasep, seq);
- if(seq->ipo) seq->ipo->id.us--;
-
- start_ofs = cfra = seq_tx_get_final_left(seq);
- frame_end = seq_tx_get_final_right(seq);
-
- while (cfra < frame_end) {
- /* new seq */
- se = give_stripelem(seq, cfra);
-
- seq_new= alloc_sequence(((Editing *)G.scene->ed)->seqbasep, start_ofs, seq->machine);
- seq_new->type= SEQ_IMAGE;
- seq_new->len = 1;
- seq_new->endstill = step-1;
-
- /* new strip */
- seq_new->strip= strip_new= MEM_callocN(sizeof(Strip)*1, "strip");
- strip_new->len= 1;
- strip_new->us= 1;
- strncpy(strip_new->dir, seq->strip->dir, FILE_MAXDIR-1);
-
- /* new stripdata */
- strip_new->stripdata= se_new= MEM_callocN(sizeof(StripElem)*1, "stripelem");
- strncpy(se_new->name, se->name, FILE_MAXFILE-1);
- calc_sequence(seq_new);
- seq_new->flag &= ~SEQ_OVERLAP;
- if (test_overlap_seq(seq_new)) {
- shuffle_seq(seq_new);
- }
-
- cfra++;
- start_ofs += step;
- }
-
- free_sequence(seq);
- seq = seq->next;
- } else {
- seq = seq->next;
- }
- }
-
- /* as last: */
- sort_seq();
- BIF_undo_push("Separate Image Strips, Sequencer");
- allqueue(REDRAWSEQ, 0);
-}
-
-/* run recursivly to select linked */
-static int select_more_less_seq__internal(int sel, int linked) {
- Editing *ed;
- Sequence *seq, *neighbor;
- int change=0;
- int isel;
-
- ed= G.scene->ed;
- if(ed==0) return 0;
-
- if (sel) {
- sel = SELECT;
- isel = 0;
- } else {
- sel = 0;
- isel = SELECT;
- }
-
- if (!linked) {
- /* if not linked we only want to touch each seq once, newseq */
- for(seq= ed->seqbasep->first; seq; seq= seq->next) {
- seq->tmp = NULL;
- }
- }
-
- for(seq= ed->seqbasep->first; seq; seq= seq->next) {
- if((int)(seq->flag & SELECT) == sel) {
- if ((linked==0 && seq->tmp)==0) {
- /* only get unselected nabours */
- neighbor = find_neighboring_sequence(seq, 1, isel);
- if (neighbor) {
- if (sel) {neighbor->flag |= SELECT; recurs_sel_seq(neighbor);}
- else neighbor->flag &= ~SELECT;
- if (linked==0) neighbor->tmp = (Sequence *)1;
- change = 1;
- }
- neighbor = find_neighboring_sequence(seq, 2, isel);
- if (neighbor) {
- if (sel) {neighbor->flag |= SELECT; recurs_sel_seq(neighbor);}
- else neighbor->flag &= ~SELECT;
- if (linked==0) neighbor->tmp = (void *)1;
- change = 1;
- }
- }
- }
- }
-
- return change;
-}
-
-void select_less_seq(void)
-{
- if (select_more_less_seq__internal(0, 0)) {
- BIF_undo_push("Select Less, Sequencer");
- allqueue(REDRAWSEQ, 0);
- }
-}
-
-void select_more_seq(void)
-{
- if (select_more_less_seq__internal(1, 0)) {
- BIF_undo_push("Select More, Sequencer");
- allqueue(REDRAWSEQ, 0);
- }
-}
-
-/* TODO not all modes supported - if you feel like being picky, add them! ;) */
-void select_linked_seq(int mode) {
- Editing *ed;
- Sequence *seq, *mouse_seq;
- int selected, hand;
-
- ed= G.scene->ed;
- if(ed==0) return;
-
- /* replace current selection */
- if (mode==0 || mode==2) {
- /* this works like UV, not mesh */
- if (mode==0) {
- mouse_seq= find_nearest_seq(&hand);
- if (!mouse_seq)
- return; /* user error as with mesh?? */
-
- for(seq= ed->seqbasep->first; seq; seq= seq->next) {
- seq->flag &= ~SELECT;
- }
- mouse_seq->flag |= SELECT;
- recurs_sel_seq(mouse_seq);
- }
-
- selected = 1;
- while (selected) {
- selected = select_more_less_seq__internal(1, 1);
- }
- BIF_undo_push("Select Linked, Sequencer");
- allqueue(REDRAWSEQ, 0);
- }
- /* TODO - more modes... */
-}
-
-void seq_snap_menu(void)
-{
- short event;
-
- event= pupmenu("Snap %t|To Current Frame%x1");
- if(event < 1) return;
-
- seq_snap(event);
-}
-
-void seq_snap(short event)
-{
- Editing *ed;
- Sequence *seq;
-
- ed= G.scene->ed;
- if(ed==0) return;
-
- /* problem: contents of meta's are all shifted to the same position... */
-
- /* also check metas */
- WHILE_SEQ(ed->seqbasep) {
- if (seq->flag & SELECT && sequence_is_free_transformable(seq)) {
- if((seq->flag & (SEQ_LEFTSEL+SEQ_RIGHTSEL))==0) {
- seq->start= CFRA-seq->startofs+seq->startstill;
- } else {
- if(seq->flag & SEQ_LEFTSEL) {
- seq_tx_set_final_left(seq, CFRA);
- } else { /* SEQ_RIGHTSEL */
- seq_tx_set_final_right(seq, CFRA);
- }
- transform_grab_xlimits(seq, seq->flag & SEQ_LEFTSEL, seq->flag & SEQ_RIGHTSEL);
- }
- calc_sequence(seq);
- }
- }
- END_SEQ
-
- /* test for effects and overlap */
- WHILE_SEQ(ed->seqbasep) {
- if(seq->flag & SELECT) {
- seq->flag &= ~SEQ_OVERLAP;
- if( test_overlap_seq(seq) ) {
- shuffle_seq(seq);
- }
- }
- else if(seq->type & SEQ_EFFECT) {
- if(seq->seq1 && (seq->seq1->flag & SELECT))
- calc_sequence(seq);
- else if(seq->seq2 && (seq->seq2->flag & SELECT))
- calc_sequence(seq);
- else if(seq->seq3 && (seq->seq3->flag & SELECT))
- calc_sequence(seq);
- }
- }
- END_SEQ;
-
- /* as last: */
- sort_seq();
-
- BIF_undo_push("Snap Strips, Sequencer");
- allqueue(REDRAWSEQ, 0);
-}
-
-void borderselect_seq(void)
-{
- Sequence *seq;
- Editing *ed;
- rcti rect;
- rctf rectf, rq;
- int val;
- short mval[2];
-
- ed= G.scene->ed;
- if(ed==0) return;
-
- val= get_border(&rect, 3);
-
- if(val) {
- mval[0]= rect.xmin;
- mval[1]= rect.ymin;
- areamouseco_to_ipoco(G.v2d, mval, &rectf.xmin, &rectf.ymin);
- mval[0]= rect.xmax;
- mval[1]= rect.ymax;
- areamouseco_to_ipoco(G.v2d, mval, &rectf.xmax, &rectf.ymax);
-
- seq= ed->seqbasep->first;
- while(seq) {
-
- if(seq->startstill) rq.xmin= seq->start;
- else rq.xmin= seq->startdisp;
- rq.ymin= seq->machine+0.2;
- if(seq->endstill) rq.xmax= seq->start+seq->len;
- else rq.xmax= seq->enddisp;
- rq.ymax= seq->machine+0.8;
-
- if(BLI_isect_rctf(&rq, &rectf, 0)) {
- if(val==LEFTMOUSE) {
- seq->flag |= SELECT;
- }
- else {
- seq->flag &= ~SELECT;
- }
- recurs_sel_seq(seq);
- }
-
- seq= seq->next;
- }
-
- BIF_undo_push("Border Select, Sequencer");
- addqueue(curarea->win, REDRAW, 1);
- }
-}
diff --git a/source/blender/src/editsima.c b/source/blender/src/editsima.c
deleted file mode 100644
index eb70a32b5a9..00000000000
--- a/source/blender/src/editsima.c
+++ /dev/null
@@ -1,2436 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef WIN32
-#include <unistd.h>
-#else
-#include <io.h>
-#endif
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_editVert.h"
-
-#include "IMB_imbuf_types.h"
-#include "IMB_imbuf.h"
-
-#include "DNA_image_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_node_types.h"
-#include "DNA_object_types.h" // only for uvedit_selectionCB() (struct Object)
-#include "DNA_packedFile_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_space_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_view3d_types.h"
-
-#include "BKE_colortools.h"
-#include "BKE_depsgraph.h"
-#include "BKE_displist.h"
-#include "BKE_image.h"
-#include "BKE_global.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
-#include "BKE_mesh.h"
-#include "BKE_node.h"
-#include "BKE_object.h"
-#include "BKE_packedFile.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-#include "BIF_imasel.h"
-#include "BIF_interface.h"
-#include "BIF_drawimage.h"
-#include "BIF_editview.h"
-#include "BIF_editsima.h"
-#include "BIF_mywindow.h"
-#include "BIF_previewrender.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-#include "BIF_transform.h"
-#include "BIF_writeimage.h"
-#include "BIF_editmesh.h"
-
-#include "BSE_drawipo.h"
-#include "BSE_edit.h"
-#include "BSE_filesel.h"
-#include "BSE_trans_types.h"
-
-#include "BDR_editobject.h"
-#include "BDR_unwrapper.h"
-
-#include "BMF_Api.h"
-
-#include "RE_pipeline.h"
-
-#include "blendef.h"
-#include "multires.h"
-#include "mydevice.h"
-#include "editmesh.h"
-
-/* local prototypes */
-void sel_uvco_inside_radius(short , EditFace *efa, MTFace *, int , float *, float *, short);
-void uvedit_selectionCB(short , Object *, short *, float ); /* used in edit.c*/
-
-void object_uvs_changed(Object *ob)
-{
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIMAGE, 0);
-}
-
-void object_tface_flags_changed(Object *ob, int updateButtons)
-{
- if (updateButtons) allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIMAGE, 0);
-}
-
-int is_uv_tface_editing_allowed_silent(void)
-{
- if(!EM_texFaceCheck()) return 0;
- if(G.sima->mode!=SI_TEXTURE) return 0;
- if(multires_level1_test()) return 0;
- return 1;
-}
-
-int is_uv_tface_editing_allowed(void)
-{
- if(!G.obedit) error("Enter Edit Mode to perform this action");
-
- return is_uv_tface_editing_allowed_silent();
-}
-
-void get_connected_limit_tface_uv(float *limit)
-{
- ImBuf *ibuf= BKE_image_get_ibuf(G.sima->image, &G.sima->iuser);
- if(ibuf && ibuf->x > 0 && ibuf->y > 0) {
- limit[0]= 0.05/(float)ibuf->x;
- limit[1]= 0.05/(float)ibuf->y;
- }
- else
- limit[0]= limit[1]= 0.05/256.0;
-}
-
-void be_square_tface_uv(EditMesh *em)
-{
- EditFace *efa;
- MTFace *tface;
- /* if 1 vertex selected: doit (with the selected vertex) */
- for (efa= em->faces.first; efa; efa= efa->next) {
- if (efa->v4) {
- tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tface)) {
- if (simaUVSel_Check(efa, tface, 0)) {
- if( tface->uv[1][0] == tface->uv[2][0] ) {
- tface->uv[1][1]= tface->uv[0][1];
- tface->uv[3][0]= tface->uv[0][0];
- }
- else {
- tface->uv[1][0]= tface->uv[0][0];
- tface->uv[3][1]= tface->uv[0][1];
- }
-
- }
- if (simaUVSel_Check(efa, tface, 1)) {
- if( tface->uv[2][1] == tface->uv[3][1] ) {
- tface->uv[2][0]= tface->uv[1][0];
- tface->uv[0][1]= tface->uv[1][1];
- }
- else {
- tface->uv[2][1]= tface->uv[1][1];
- tface->uv[0][0]= tface->uv[1][0];
- }
-
- }
- if (simaUVSel_Check(efa, tface, 2)) {
- if( tface->uv[3][0] == tface->uv[0][0] ) {
- tface->uv[3][1]= tface->uv[2][1];
- tface->uv[1][0]= tface->uv[2][0];
- }
- else {
- tface->uv[3][0]= tface->uv[2][0];
- tface->uv[1][1]= tface->uv[2][1];
- }
- }
- if (simaUVSel_Check(efa, tface, 3)) {
- if( tface->uv[0][1] == tface->uv[1][1] ) {
- tface->uv[0][0]= tface->uv[3][0];
- tface->uv[2][1]= tface->uv[3][1];
- }
- else {
- tface->uv[0][1]= tface->uv[3][1];
- tface->uv[2][0]= tface->uv[3][0];
- }
-
- }
- }
- }
- }
-}
-
-void transform_aspect_ratio_tface_uv(float *aspx, float *aspy)
-{
- int w, h;
- float xuser_asp, yuser_asp;
-
- aspect_sima(G.sima, &xuser_asp, &yuser_asp);
-
- transform_width_height_tface_uv(&w, &h);
- *aspx= (float)w/256.0f * xuser_asp;
- *aspy= (float)h/256.0f * yuser_asp;
-}
-
-void transform_width_height_tface_uv(int *width, int *height)
-{
- ImBuf *ibuf= BKE_image_get_ibuf(G.sima->image, &G.sima->iuser);
-
- if(ibuf) {
- *width= ibuf->x;
- *height= ibuf->y;
- }
- else {
- *width= 256;
- *height= 256;
- }
-}
-
-void mirror_tface_uv(char mirroraxis)
-{
- if (mirroraxis == 'x')
- Mirror(1); /* global x */
- else if (mirroraxis == 'y')
- Mirror(2); /* global y */
-}
-
-void mirrormenu_tface_uv(void)
-{
- short mode= 0;
-
- if( is_uv_tface_editing_allowed()==0 ) return;
-
- mode= pupmenu("Mirror%t|X Axis%x1|Y Axis%x2|");
-
- if(mode==-1) return;
-
- if(mode==1) mirror_tface_uv('x');
- else if(mode==2) mirror_tface_uv('y');
-
- BIF_undo_push("Mirror UV");
-}
-
-void weld_align_tface_uv(char tool)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
- MTFace *tface;
- float cent[2];
-
- if( is_uv_tface_editing_allowed()==0 ) return;
- cent_tface_uv(cent, 0);
-
- if(tool == 'x' || tool == 'w') {
- for (efa= em->faces.first; efa; efa= efa->next) {
- tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tface)) {
- if (simaUVSel_Check(efa, tface, 0))
- tface->uv[0][0]= cent[0];
- if (simaUVSel_Check(efa, tface, 1))
- tface->uv[1][0]= cent[0];
- if (simaUVSel_Check(efa, tface, 2))
- tface->uv[2][0]= cent[0];
- if (efa->v4 && simaUVSel_Check(efa, tface, 3))
- tface->uv[3][0]= cent[0];
- }
- }
- }
-
- if(tool == 'y' || tool == 'w') {
- for (efa= em->faces.first; efa; efa= efa->next) {
- tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tface)) {
- if (simaUVSel_Check(efa, tface, 0))
- tface->uv[0][1]= cent[1];
- if (simaUVSel_Check(efa, tface, 1))
- tface->uv[1][1]= cent[1];
- if (simaUVSel_Check(efa, tface, 2))
- tface->uv[2][1]= cent[1];
- if (efa->v4 && simaUVSel_Check(efa, tface, 3))
- tface->uv[3][1]= cent[1];
- }
- }
- }
-
- object_uvs_changed(OBACT);
-}
-
-// just for averaging UV's
-typedef struct UVVertAverage {
- float uv[2];
- int count;
-} UVVertAverage;
-
-void stitch_vert_uv_tface(void)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
- EditVert *eve;
- MTFace *tface;
- int count;
- UVVertAverage *uv_average, *uvav;
-
- if( is_uv_tface_editing_allowed()==0 ) return;
-
- // index and count verts
- for (count=0, eve=em->verts.first; eve; count++, eve= eve->next) {
- eve->tmp.l = count;
- }
-
- uv_average = MEM_callocN(sizeof(UVVertAverage) * count, "Stitch");
-
- // gather uv averages per vert
- for (efa= em->faces.first; efa; efa= efa->next) {
- tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tface)) {
- if (simaUVSel_Check(efa, tface, 0)) {
- uvav = uv_average + efa->v1->tmp.l;
- uvav->count++;
- uvav->uv[0] += tface->uv[0][0];
- uvav->uv[1] += tface->uv[0][1];
- }
- if (simaUVSel_Check(efa, tface, 1)) {
- uvav = uv_average + efa->v2->tmp.l;
- uvav->count++;
- uvav->uv[0] += tface->uv[1][0];
- uvav->uv[1] += tface->uv[1][1];
- }
- if (simaUVSel_Check(efa, tface, 2)) {
- uvav = uv_average + efa->v3->tmp.l;
- uvav->count++;
- uvav->uv[0] += tface->uv[2][0];
- uvav->uv[1] += tface->uv[2][1];
- }
- if (efa->v4 && simaUVSel_Check(efa, tface, 3)) {
- uvav = uv_average + efa->v4->tmp.l;
- uvav->count++;
- uvav->uv[0] += tface->uv[3][0];
- uvav->uv[1] += tface->uv[3][1];
- }
- }
- }
-
- // apply uv welding
- for (efa= em->faces.first; efa; efa= efa->next) {
- tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tface)) {
- if (simaUVSel_Check(efa, tface, 0)) {
- uvav = uv_average + efa->v1->tmp.l;
- tface->uv[0][0] = uvav->uv[0]/uvav->count;
- tface->uv[0][1] = uvav->uv[1]/uvav->count;
- }
- if (simaUVSel_Check(efa, tface, 1)) {
- uvav = uv_average + efa->v2->tmp.l;
- tface->uv[1][0] = uvav->uv[0]/uvav->count;
- tface->uv[1][1] = uvav->uv[1]/uvav->count;
- }
- if (simaUVSel_Check(efa, tface, 2)) {
- uvav = uv_average + efa->v3->tmp.l;
- tface->uv[2][0] = uvav->uv[0]/uvav->count;
- tface->uv[2][1] = uvav->uv[1]/uvav->count;
- }
- if (efa->v4 && simaUVSel_Check(efa, tface, 3)) {
- uvav = uv_average + efa->v4->tmp.l;
- tface->uv[3][0] = uvav->uv[0]/uvav->count;
- tface->uv[3][1] = uvav->uv[1]/uvav->count;
- }
- }
- }
- MEM_freeN(uv_average);
- object_uvs_changed(OBACT);
-}
-
-void weld_align_menu_tface_uv(void)
-{
- short mode= 0;
-
- if( is_uv_tface_editing_allowed()==0 ) return;
-
- mode= pupmenu("Weld/Align%t|Weld%x1|Align X%x2|Align Y%x3");
-
- if(mode==-1) return;
- if(mode==1) weld_align_tface_uv('w');
- else if(mode==2) weld_align_tface_uv('x');
- else if(mode==3) weld_align_tface_uv('y');
-
- if(mode==1) BIF_undo_push("Weld UV");
- else if(mode==2 || mode==3) BIF_undo_push("Align UV");
-}
-
-void select_invert_tface_uv(void)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
- MTFace *tface;
-
- if( is_uv_tface_editing_allowed()==0 ) return;
-
- if (G.sima->flag & SI_SYNC_UVSEL) {
- /* Warning, this is not that good (calling editmode stuff from UV),
- TODO look into changing it */
- selectswap_mesh();
- return;
- } else {
- for (efa= em->faces.first; efa; efa= efa->next) {
- tface = CustomData_em_get(&G.editMesh->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tface)) {
- tface->flag ^= TF_SEL1;
- tface->flag ^= TF_SEL2;
- tface->flag ^= TF_SEL3;
- if(efa->v4) tface->flag ^= TF_SEL4;
- }
- }
- }
- BIF_undo_push("Select Inverse UV");
-
- allqueue(REDRAWIMAGE, 0);
-}
-
-void select_swap_tface_uv(void)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
- MTFace *tface;
- int sel=0;
-
- if( is_uv_tface_editing_allowed()==0 ) return;
-
- if (G.sima->flag & SI_SYNC_UVSEL) {
- deselectall_mesh();
- return;
- } else {
-
- for (efa= em->faces.first; efa; efa= efa->next) {
- tface = CustomData_em_get(&G.editMesh->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tface)) {
- if(tface->flag & (TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4)) {
- sel= 1;
- break;
- }
- }
- }
-
- for (efa= em->faces.first; efa; efa= efa->next) {
- tface = CustomData_em_get(&G.editMesh->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tface)) {
- if(efa->v4) {
- if(sel) tface->flag &= ~(TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4);
- else tface->flag |= (TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4);
- }
- else {
- if(sel) tface->flag &= ~(TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4);
- else tface->flag |= (TF_SEL1+TF_SEL2+TF_SEL3);
- }
- }
- }
- }
- BIF_undo_push("Select swap");
-
- allqueue(REDRAWIMAGE, 0);
-}
-
-static int msel_hit(float *limit, unsigned int *hitarray, unsigned int vertexid, float **uv, float *uv2, int sticky)
-{
- int i;
- for(i=0; i< 4; i++) {
- if(hitarray[i] == vertexid) {
- if(sticky == 2) {
- if(fabs(uv[i][0]-uv2[0]) < limit[0] &&
- fabs(uv[i][1]-uv2[1]) < limit[1])
- return 1;
- }
- else return 1;
- }
- }
- return 0;
-}
-
-static void find_nearest_tface(MTFace **nearesttf, EditFace **nearestefa)
-{
- EditMesh *em= G.editMesh;
- MTFace *tf;
- EditFace *efa;
- int i, nverts, mindist, dist, fcenter[2], uval[2];
- short mval[2];
-
- getmouseco_areawin(mval);
-
- mindist= 0x7FFFFFF;
- *nearesttf= NULL;
- *nearestefa= NULL;
-
- for (efa= em->faces.first; efa; efa= efa->next) {
- tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tf)) {
- fcenter[0]= fcenter[1]= 0;
- nverts= efa->v4? 4: 3;
- for(i=0; i<nverts; i++) {
- uvco_to_areaco_noclip(tf->uv[i], uval);
- fcenter[0] += uval[0];
- fcenter[1] += uval[1];
- }
-
- fcenter[0] /= nverts;
- fcenter[1] /= nverts;
-
- dist= abs(mval[0]- fcenter[0])+ abs(mval[1]- fcenter[1]);
- if (dist < mindist) {
- *nearesttf= tf;
- *nearestefa= efa;
- mindist= dist;
- }
- }
- }
-}
-
-static int nearest_uv_between(MTFace *tf, int nverts, int id, short *mval, int *uval)
-{
- float m[3], v1[3], v2[3], c1, c2;
- int id1, id2;
-
- id1= (id+nverts-1)%nverts;
- id2= (id+nverts+1)%nverts;
-
- m[0] = (float)(mval[0]-uval[0]);
- m[1] = (float)(mval[1]-uval[1]);
- Vec2Subf(v1, tf->uv[id1], tf->uv[id]);
- Vec2Subf(v2, tf->uv[id2], tf->uv[id]);
-
- /* m and v2 on same side of v-v1? */
- c1= v1[0]*m[1] - v1[1]*m[0];
- c2= v1[0]*v2[1] - v1[1]*v2[0];
-
- if (c1*c2 < 0.0f)
- return 0;
-
- /* m and v1 on same side of v-v2? */
- c1= v2[0]*m[1] - v2[1]*m[0];
- c2= v2[0]*v1[1] - v2[1]*v1[0];
-
- return (c1*c2 >= 0.0f);
-}
-
-void find_nearest_uv(MTFace **nearesttf, EditFace **nearestefa, unsigned int *nearestv, int *nearestuv)
-{
- EditMesh *em= G.editMesh;
- EditFace *efa;
- MTFace *tf;
- int i, nverts, mindist, dist, uval[2];
- short mval[2];
-
- getmouseco_areawin(mval);
-
- mindist= 0x7FFFFFF;
- if (nearesttf) *nearesttf= NULL;
- if (nearestefa) *nearestefa= NULL;
-
- if (nearestv) {
- EditVert *ev;
- for (i=0, ev=em->verts.first; ev; ev = ev->next, i++)
- ev->tmp.l = i;
- }
-
- for (efa= em->faces.first; efa; efa= efa->next) {
- tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tf)) {
- nverts= efa->v4? 4: 3;
- for(i=0; i<nverts; i++) {
- uvco_to_areaco_noclip(tf->uv[i], uval);
- dist= abs(mval[0]-uval[0]) + abs(mval[1]-uval[1]);
-
- if (simaUVSel_Check(efa, tf, i))
- dist += 5;
-
- if(dist<=mindist) {
- if(dist==mindist)
- if (!nearest_uv_between(tf, nverts, i, mval, uval))
- continue;
-
- mindist= dist;
- *nearestuv= i;
-
- if (nearesttf) *nearesttf= tf;
- if (nearestefa) *nearestefa= efa;
- if (nearestv) {
- if (i==0) *nearestv= efa->v1->tmp.l;
- else if (i==1) *nearestv= efa->v2->tmp.l;
- else if (i==2) *nearestv= efa->v3->tmp.l;
- else *nearestv= efa->v4->tmp.l;
- }
- }
- }
- }
- }
-}
-
-void mouse_select_sima(void)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
- MTFace *tf, *nearesttf;
- EditFace *nearestefa=NULL;
- int a, selectsticky, actface, nearestuv, i;
- char sticky= 0;
- short flush = 0; /* 0 == dont flush, 1 == sel, -1 == desel; only use when selection sync is enabled */
- unsigned int hitv[4], nearestv;
- float *hituv[4], limit[2];
-
- if( is_uv_tface_editing_allowed()==0 ) return;
-
- get_connected_limit_tface_uv(limit);
-
- if (G.sima->flag & SI_SYNC_UVSEL) {
- /* copy from mesh */
- if (G.scene->selectmode == SCE_SELECT_FACE) {
- actface= 1;
- sticky= 0;
- } else {
- actface= (G.qual & LR_ALTKEY || G.sima->flag & SI_SELACTFACE);
- sticky= 2;
- }
- } else {
- /* normal operation */
- actface= (G.qual & LR_ALTKEY || G.sima->flag & SI_SELACTFACE);
-
- switch(G.sima->sticky) {
- case SI_STICKY_LOC:
- sticky=2;
- break;
- case SI_STICKY_DISABLE:
- sticky=0;
- break;
- case SI_STICKY_VERTEX:
- if(G.qual & LR_CTRLKEY) {
- sticky=0;
- } else {
- sticky=1;
- }
- break;
- }
- }
-
- if(actface) {
- find_nearest_tface(&nearesttf, &nearestefa);
- if(nearesttf==NULL)
- return;
-
- EM_set_actFace(nearestefa);
-
- for (i=0; i<4; i++)
- hituv[i]= nearesttf->uv[i];
-
- hitv[0]= nearestefa->v1->tmp.l;
- hitv[1]= nearestefa->v2->tmp.l;
- hitv[2]= nearestefa->v3->tmp.l;
-
- if (nearestefa->v4) hitv[3]= nearestefa->v4->tmp.l;
- else hitv[3]= 0xFFFFFFFF;
- }
- else {
- find_nearest_uv(&nearesttf, &nearestefa, &nearestv, &nearestuv);
- if(nearesttf==NULL)
- return;
-
- if(sticky) {
- for(i=0; i<4; i++)
- hitv[i]= 0xFFFFFFFF;
- hitv[nearestuv]= nearestv;
- hituv[nearestuv]= nearesttf->uv[nearestuv];
- }
- }
-
- if(G.qual & LR_SHIFTKEY) {
- /* (de)select face */
- if(actface) {
- if(simaFaceSel_Check(nearestefa, nearesttf)) {
- simaFaceSel_UnSet(nearestefa, nearesttf);
- selectsticky= 0;
- }
- else {
- simaFaceSel_Set(nearestefa, nearesttf);
- selectsticky= 1;
- }
- flush = -1;
- }
- /* (de)select uv node */
- else {
- if (simaUVSel_Check(nearestefa, nearesttf, nearestuv)) {
- simaUVSel_UnSet(nearestefa, nearesttf, nearestuv);
- selectsticky= 0;
- }
- else {
- simaUVSel_Set(nearestefa, nearesttf, nearestuv);
- selectsticky= 1;
- }
- flush = 1;
- }
-
- /* (de)select sticky uv nodes */
- if(sticky || actface) {
- EditVert *ev;
-
- for (a=0, ev=em->verts.first; ev; ev = ev->next, a++)
- ev->tmp.l = a;
-
- /* deselect */
- if(selectsticky==0) {
- for (efa= em->faces.first; efa; efa= efa->next) {
- tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tf)) {
- /*if(nearesttf && tf!=nearesttf) tf->flag &=~ TF_ACTIVE;*/ /* TODO - deal with editmesh active face */
- if (!sticky) continue;
-
- if(msel_hit(limit, hitv, efa->v1->tmp.l, hituv, tf->uv[0], sticky))
- simaUVSel_UnSet(efa, tf, 0);
- if(msel_hit(limit, hitv, efa->v2->tmp.l, hituv, tf->uv[1], sticky))
- simaUVSel_UnSet(efa, tf, 1);
- if(msel_hit(limit, hitv, efa->v3->tmp.l, hituv, tf->uv[2], sticky))
- simaUVSel_UnSet(efa, tf, 2);
- if (efa->v4)
- if(msel_hit(limit, hitv, efa->v4->tmp.l, hituv, tf->uv[3], sticky))
- simaUVSel_UnSet(efa, tf, 3);
- }
- }
- flush = -1;
- }
- /* select */
- else {
- for (efa= em->faces.first; efa; efa= efa->next) {
- tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tf)) {
- if (!sticky) continue;
- if(msel_hit(limit, hitv, efa->v1->tmp.l, hituv, tf->uv[0], sticky))
- simaUVSel_Set(efa, tf, 0);
- if(msel_hit(limit, hitv, efa->v2->tmp.l, hituv, tf->uv[1], sticky))
- simaUVSel_Set(efa, tf, 1);
- if(msel_hit(limit, hitv, efa->v3->tmp.l, hituv, tf->uv[2], sticky))
- simaUVSel_Set(efa, tf, 2);
- if (efa->v4)
- if(msel_hit(limit, hitv, efa->v4->tmp.l, hituv, tf->uv[3], sticky))
- simaUVSel_Set(efa, tf, 3);
- }
- }
- EM_set_actFace(nearestefa);
- flush = 1;
- }
- }
- }
- else {
- /* select face and deselect other faces */
- if(actface) {
- for (efa= em->faces.first; efa; efa= efa->next) {
- tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- simaFaceSel_UnSet(efa, tf);
- }
- if(nearesttf) {
- simaFaceSel_Set(nearestefa, nearesttf);
- EM_set_actFace(nearestefa);
- }
-
- }
-
- /* deselect uvs, and select sticky uvs */
- for (efa= em->faces.first; efa; efa= efa->next) {
- tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tf)) {
- if(!actface) simaFaceSel_UnSet(efa, tf);
- if(!sticky) continue;
-
- if(msel_hit(limit, hitv, efa->v1->tmp.l, hituv, tf->uv[0], sticky))
- simaUVSel_Set(efa, tf, 0);
- if(msel_hit(limit, hitv, efa->v2->tmp.l, hituv, tf->uv[1], sticky))
- simaUVSel_Set(efa, tf, 1);
- if(msel_hit(limit, hitv, efa->v3->tmp.l, hituv, tf->uv[2], sticky))
- simaUVSel_Set(efa, tf, 2);
- if(efa->v4)
- if(msel_hit(limit, hitv, efa->v4->tmp.l, hituv, tf->uv[3], sticky))
- simaUVSel_Set(efa, tf, 3);
- flush= 1;
- }
- }
-
- if(!actface) {
- simaUVSel_Set(nearestefa, nearesttf, nearestuv);
- flush= 1;
- }
- }
-
- force_draw(1);
-
- if (G.sima->flag & SI_SYNC_UVSEL) {
- /* flush for mesh selection */
- if (G.scene->selectmode != SCE_SELECT_FACE) {
- if (flush==1) EM_select_flush();
- else if (flush==-1) EM_deselect_flush();
- }
- allqueue(REDRAWVIEW3D, 0); /* mesh selection has changed */
- }
-
- BIF_undo_push("Select UV");
- rightmouse_transform();
-}
-
-void borderselect_sima(short whichuvs)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
- MTFace *tface;
- rcti rect;
- rctf rectf;
- int val, ok = 1;
- short mval[2], select;
-
- if( is_uv_tface_editing_allowed()==0) return;
-
- val= get_border(&rect, 3);
- select = (val==LEFTMOUSE) ? 1 : 0;
-
- if(val) {
- mval[0]= rect.xmin;
- mval[1]= rect.ymin;
- areamouseco_to_ipoco(G.v2d, mval, &rectf.xmin, &rectf.ymin);
- mval[0]= rect.xmax;
- mval[1]= rect.ymax;
- areamouseco_to_ipoco(G.v2d, mval, &rectf.xmax, &rectf.ymax);
-
- if (draw_uvs_face_check() && whichuvs != UV_SELECT_PINNED) {
- float cent[2];
- ok = 0;
- for (efa= em->faces.first; efa; efa= efa->next) {
- /* assume not touched */
- efa->tmp.l = 0;
- tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tface)) {
- tface_center(tface, cent, (void *)efa->v4);
- if(BLI_in_rctf(&rectf, cent[0], cent[1])) {
- efa->tmp.l = ok = 1;
- }
- }
- }
- /* (de)selects all tagged faces and deals with sticky modes */
- if (ok)
- uvface_setsel__internal(select);
- } else {
- for (efa= em->faces.first; efa; efa= efa->next) {
- tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tface)) {
- if (whichuvs == UV_SELECT_ALL || (G.sima->flag & SI_SYNC_UVSEL) ) {
- /* SI_SYNC_UVSEL - cant do pinned selection */
- if(BLI_in_rctf(&rectf, tface->uv[0][0], tface->uv[0][1])) {
- if(select) simaUVSel_Set(efa, tface, 0);
- else simaUVSel_UnSet(efa, tface, 0);
- }
- if(BLI_in_rctf(&rectf, tface->uv[1][0], tface->uv[1][1])) {
- if(select) simaUVSel_Set(efa, tface, 1);
- else simaUVSel_UnSet(efa, tface, 1);
- }
- if(BLI_in_rctf(&rectf, tface->uv[2][0], tface->uv[2][1])) {
- if(select) simaUVSel_Set(efa, tface, 2);
- else simaUVSel_UnSet(efa, tface, 2);
- }
- if(efa->v4 && BLI_in_rctf(&rectf, tface->uv[3][0], tface->uv[3][1])) {
- if(select) simaUVSel_Set(efa, tface, 3);
- else simaUVSel_UnSet(efa, tface, 3);
- }
- } else if (whichuvs == UV_SELECT_PINNED) {
- if ((tface->unwrap & TF_PIN1) &&
- BLI_in_rctf(&rectf, tface->uv[0][0], tface->uv[0][1])) {
-
- if(select) simaUVSel_Set(efa, tface, 0);
- else simaUVSel_UnSet(efa, tface, 0);
- }
- if ((tface->unwrap & TF_PIN2) &&
- BLI_in_rctf(&rectf, tface->uv[1][0], tface->uv[1][1])) {
-
- if(select) simaUVSel_Set(efa, tface, 1);
- else simaUVSel_UnSet(efa, tface, 1);
- }
- if ((tface->unwrap & TF_PIN3) &&
- BLI_in_rctf(&rectf, tface->uv[2][0], tface->uv[2][1])) {
-
- if(select) simaUVSel_Set(efa, tface, 2);
- else simaUVSel_UnSet(efa, tface, 2);
- }
- if ((efa->v4) && (tface->unwrap & TF_PIN4) && BLI_in_rctf(&rectf, tface->uv[3][0], tface->uv[3][1])) {
- if(select) simaUVSel_Set(efa, tface, 3);
- else simaUVSel_UnSet(efa, tface, 3);
- }
- }
- }
- }
- }
- if (ok) {
- /* make sure newly selected vert selection is updated*/
- if (G.sima->flag & SI_SYNC_UVSEL) {
- if (G.scene->selectmode != SCE_SELECT_FACE) {
- if (select) EM_select_flush();
- else EM_deselect_flush();
- }
- }
- allqueue(REDRAWVIEW3D, 0); /* mesh selection has changed */
-
- BIF_undo_push("Border select UV");
- scrarea_queue_winredraw(curarea);
- }
- }
-}
-
-int snap_uv_sel_to_curs(void)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
- MTFace *tface;
- short change = 0;
-
- for (efa= em->faces.first; efa; efa= efa->next) {
- tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tface)) {
- if (simaUVSel_Check(efa, tface, 0)) VECCOPY2D(tface->uv[0], G.v2d->cursor);
- if (simaUVSel_Check(efa, tface, 1)) VECCOPY2D(tface->uv[1], G.v2d->cursor);
- if (simaUVSel_Check(efa, tface, 2)) VECCOPY2D(tface->uv[2], G.v2d->cursor);
- if (efa->v4)
- if (simaUVSel_Check(efa, tface, 3)) VECCOPY2D(tface->uv[3], G.v2d->cursor);
- change = 1;
- }
- }
- return change;
-}
-
-int snap_uv_sel_to_adj_unsel(void)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
- EditVert *eve;
- MTFace *tface;
- short change = 0;
- int count = 0;
- float *coords;
- short *usercount, users;
-
- /* set all verts to -1 : an unused index*/
- for (eve= em->verts.first; eve; eve= eve->next)
- eve->tmp.l=-1;
-
- /* index every vert that has a selected UV using it, but only once so as to
- * get unique indicies and to count how much to malloc */
- for (efa= em->faces.first; efa; efa= efa->next) {
- tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tface)) {
- if (simaUVSel_Check(efa, tface, 0) && efa->v1->tmp.l==-1) efa->v1->tmp.l= count++;
- if (simaUVSel_Check(efa, tface, 1) && efa->v2->tmp.l==-1) efa->v2->tmp.l= count++;
- if (simaUVSel_Check(efa, tface, 2) && efa->v3->tmp.l==-1) efa->v3->tmp.l= count++;
- if (efa->v4)
- if (simaUVSel_Check(efa, tface, 3) && efa->v4->tmp.l==-1) efa->v4->tmp.l= count++;
- change = 1;
-
- /* optional speedup */
- efa->tmp.p = tface;
- } else {
- efa->tmp.p = NULL;
- }
- }
-
- coords = MEM_callocN(sizeof(float)*count*2, "snap to adjacent coords");
- usercount = MEM_callocN(sizeof(short)*count, "snap to adjacent counts");
-
- /* add all UV coords from visible, unselected UV coords as well as counting them to average later */
- for (efa= em->faces.first; efa; efa= efa->next) {
-// tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-// if (simaFaceDraw_Check(efa, tface)) {
- if ((tface=(MTFace *)efa->tmp.p)) {
-
- /* is this an unselected UV we can snap to? */
- if (efa->v1->tmp.l >= 0 && (!simaUVSel_Check(efa, tface, 0))) {
- coords[efa->v1->tmp.l*2] += tface->uv[0][0];
- coords[(efa->v1->tmp.l*2)+1] += tface->uv[0][1];
- usercount[efa->v1->tmp.l]++;
- change = 1;
- }
- if (efa->v2->tmp.l >= 0 && (!simaUVSel_Check(efa, tface, 1))) {
- coords[efa->v2->tmp.l*2] += tface->uv[1][0];
- coords[(efa->v2->tmp.l*2)+1] += tface->uv[1][1];
- usercount[efa->v2->tmp.l]++;
- change = 1;
- }
- if (efa->v3->tmp.l >= 0 && (!simaUVSel_Check(efa, tface, 2))) {
- coords[efa->v3->tmp.l*2] += tface->uv[2][0];
- coords[(efa->v3->tmp.l*2)+1] += tface->uv[2][1];
- usercount[efa->v3->tmp.l]++;
- change = 1;
- }
-
- if (efa->v4) {
- if (efa->v4->tmp.l >= 0 && (!simaUVSel_Check(efa, tface, 3))) {
- coords[efa->v4->tmp.l*2] += tface->uv[3][0];
- coords[(efa->v4->tmp.l*2)+1] += tface->uv[3][1];
- usercount[efa->v4->tmp.l]++;
- change = 1;
- }
- }
- }
- }
-
- /* no other verts selected, bail out */
- if (!change) {
- MEM_freeN(coords);
- MEM_freeN(usercount);
- return change;
- }
-
- /* copy the averaged unselected UVs back to the selected UVs */
- for (efa= em->faces.first; efa; efa= efa->next) {
-// tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-// if (simaFaceDraw_Check(efa, tface)) {
- if ((tface=(MTFace *)efa->tmp.p)) {
-
- if ( simaUVSel_Check(efa, tface, 0) &&
- efa->v1->tmp.l >= 0 &&
- (users = usercount[efa->v1->tmp.l])
- ) {
- tface->uv[0][0] = coords[efa->v1->tmp.l*2] / users;
- tface->uv[0][1] = coords[(efa->v1->tmp.l*2)+1] / users;
- }
-
- if ( simaUVSel_Check(efa, tface, 1) &&
- efa->v2->tmp.l >= 0 &&
- (users = usercount[efa->v2->tmp.l])
- ) {
- tface->uv[1][0] = coords[efa->v2->tmp.l*2] / users;
- tface->uv[1][1] = coords[(efa->v2->tmp.l*2)+1] / users;
- }
-
- if ( simaUVSel_Check(efa, tface, 2) &&
- efa->v3->tmp.l >= 0 &&
- (users = usercount[efa->v3->tmp.l])
- ) {
- tface->uv[2][0] = coords[efa->v3->tmp.l*2] / users;
- tface->uv[2][1] = coords[(efa->v3->tmp.l*2)+1] / users;
- }
-
- if (efa->v4) {
- if ( simaUVSel_Check(efa, tface, 3) &&
- efa->v4->tmp.l >= 0 &&
- (users = usercount[efa->v4->tmp.l])
- ) {
- tface->uv[3][0] = coords[efa->v4->tmp.l*2] / users;
- tface->uv[3][1] = coords[(efa->v4->tmp.l*2)+1] / users;
- }
- }
- }
- }
-
- MEM_freeN(coords);
- MEM_freeN(usercount);
- return change;
-}
-
-void snap_coord_to_pixel(float *uvco, float w, float h)
-{
- uvco[0] = ((float) ((int)((uvco[0]*w) + 0.5))) / w;
- uvco[1] = ((float) ((int)((uvco[1]*h) + 0.5))) / h;
-}
-
-int snap_uv_sel_to_pixels(void) /* warning, sanity checks must alredy be done */
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
- MTFace *tface;
- int wi, hi;
- float w, h;
- short change = 0;
-
- transform_width_height_tface_uv(&wi, &hi);
- w = (float)wi;
- h = (float)hi;
-
- for (efa= em->faces.first; efa; efa= efa->next) {
- tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tface)) {
- if (simaUVSel_Check(efa, tface, 0)) snap_coord_to_pixel(tface->uv[0], w, h);
- if (simaUVSel_Check(efa, tface, 1)) snap_coord_to_pixel(tface->uv[1], w, h);
- if (simaUVSel_Check(efa, tface, 2)) snap_coord_to_pixel(tface->uv[2], w, h);
- if (efa->v4)
- if (simaUVSel_Check(efa, tface, 3)) snap_coord_to_pixel(tface->uv[3], w, h);
- change = 1;
- }
- }
- return change;
-}
-
-void snap_uv_curs_to_pixels(void)
-{
- int wi, hi;
- float w, h;
-
- transform_width_height_tface_uv(&wi, &hi);
- w = (float)wi;
- h = (float)hi;
- snap_coord_to_pixel(G.v2d->cursor, w, h);
-}
-
-int snap_uv_curs_to_sel(void)
-{
- if( is_uv_tface_editing_allowed()==0 ) return 0;
- return cent_tface_uv(G.v2d->cursor, 0);
-}
-
-void snap_menu_sima(void)
-{
- short event;
- if( is_uv_tface_editing_allowed()==0 || !G.v2d) return; /* !G.v2d should never happen */
-
- event = pupmenu("Snap %t|Selection -> Pixels%x1|Selection -> Cursor%x2|Selection -> Adjacent Unselected%x3|Cursor -> Pixel%x4|Cursor -> Selection%x5");
- switch (event) {
- case 1:
- if (snap_uv_sel_to_pixels()) {
- BIF_undo_push("Snap UV Selection to Pixels");
- object_uvs_changed(OBACT);
- }
- break;
- case 2:
- if (snap_uv_sel_to_curs()) {
- BIF_undo_push("Snap UV Selection to Cursor");
- object_uvs_changed(OBACT);
- }
- break;
- case 3:
- if (snap_uv_sel_to_adj_unsel()) {
- BIF_undo_push("Snap UV Selection to Cursor");
- object_uvs_changed(OBACT);
- }
- break;
- case 4:
- snap_uv_curs_to_pixels();
- scrarea_queue_winredraw(curarea);
- break;
- case 5:
- if (snap_uv_curs_to_sel())
- allqueue(REDRAWIMAGE, 0);
- break;
- }
-}
-
-
-/** This is an ugly function to set the Tface selection flags depending
- * on whether its UV coordinates are inside the normalized
- * area with radius rad and offset offset. These coordinates must be
- * normalized to 1.0
- * Just for readability...
- */
-
-void sel_uvco_inside_radius(short sel, EditFace *efa, MTFace *tface, int index, float *offset, float *ell, short select_index)
-{
- // normalized ellipse: ell[0] = scaleX,
- // [1] = scaleY
-
- float *uv = tface->uv[index];
- float x, y, r2;
-
- x = (uv[0] - offset[0]) * ell[0];
- y = (uv[1] - offset[1]) * ell[1];
-
- r2 = x * x + y * y;
- if (r2 < 1.0) {
- if (sel == LEFTMOUSE) simaUVSel_Set(efa, tface, select_index);
- else simaUVSel_UnSet(efa, tface, select_index);
- }
-}
-
-// see below:
-/** gets image dimensions of the 2D view 'v' */
-static void getSpaceImageDimension(SpaceImage *sima, float *xy)
-{
- ImBuf *ibuf= BKE_image_get_ibuf(sima->image, &sima->iuser);
-
- if (ibuf) {
- xy[0] = ibuf->x * sima->zoom;
- xy[1] = ibuf->y * sima->zoom;
- } else {
- xy[0] = 256 * sima->zoom;
- xy[1] = 256 * sima->zoom;
- }
-}
-
-/** Callback function called by circle_selectCB to enable
- * brush select in UV editor.
- */
-
-void uvedit_selectionCB(short selecting, Object *editobj, short *mval, float rad)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
- float offset[2];
- MTFace *tface;
- float ellipse[2]; // we need to deal with ellipses, as
- // non square textures require for circle
- // selection. this ellipse is normalized; r = 1.0
-
- getSpaceImageDimension(curarea->spacedata.first, ellipse);
- ellipse[0] /= rad;
- ellipse[1] /= rad;
-
- areamouseco_to_ipoco(G.v2d, mval, &offset[0], &offset[1]);
-
- if (selecting) {
- for (efa= em->faces.first; efa; efa= efa->next) {
- tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- sel_uvco_inside_radius(selecting, efa, tface, 0, offset, ellipse, 0);
- sel_uvco_inside_radius(selecting, efa, tface, 1, offset, ellipse, 1);
- sel_uvco_inside_radius(selecting, efa, tface, 2, offset, ellipse, 2);
- if (efa->v4)
- sel_uvco_inside_radius(selecting, efa, tface, 3, offset, ellipse, 3);
- }
-
- if(G.f & G_DRAWFACES) { /* full redraw only if necessary */
- draw_sel_circle(0, 0, 0, 0, 0); /* signal */
- force_draw(0);
- }
- else { /* force_draw() is no good here... */
- glDrawBuffer(GL_FRONT);
- draw_uvs_sima();
- bglFlush();
- glDrawBuffer(GL_BACK);
- }
-
-
- if (selecting == LEFTMOUSE) EM_select_flush();
- else EM_deselect_flush();
-
- if (G.sima->lock && (G.sima->flag & SI_SYNC_UVSEL))
- force_draw_plus(SPACE_VIEW3D, 0);
- }
-}
-
-
-void mouseco_to_curtile(void)
-{
- float fx, fy;
- short mval[2];
-
- if( is_uv_tface_editing_allowed()==0) return;
-
- if(G.sima->image && G.sima->image->tpageflag & IMA_TILES) {
-
- G.sima->flag |= SI_EDITTILE;
-
- while(get_mbut()&L_MOUSE) {
-
- calc_image_view(G.sima, 'f');
-
- getmouseco_areawin(mval);
- areamouseco_to_ipoco(G.v2d, mval, &fx, &fy);
-
- if(fx>=0.0 && fy>=0.0 && fx<1.0 && fy<1.0) {
-
- fx= (fx)*G.sima->image->xrep;
- fy= (fy)*G.sima->image->yrep;
-
- mval[0]= fx;
- mval[1]= fy;
-
- G.sima->curtile= mval[1]*G.sima->image->xrep + mval[0];
- }
-
- scrarea_do_windraw(curarea);
- screen_swapbuffers();
- }
-
- G.sima->flag &= ~SI_EDITTILE;
-
- image_set_tile(G.sima, 2);
-
- allqueue(REDRAWVIEW3D, 0);
- scrarea_queue_winredraw(curarea);
- }
-}
-
-/* Could be used for other 2D views also */
-void mouseco_to_cursor_sima(void)
-{
- short mval[2];
- getmouseco_areawin(mval);
- areamouseco_to_ipoco(G.v2d, mval, &G.v2d->cursor[0], &G.v2d->cursor[1]);
- scrarea_queue_winredraw(curarea);
-}
-
-void stitch_limit_uv_tface(void)
-{
- MTFace *tf;
- int a, vtot;
- float newuv[2], limit[2];
- UvMapVert *vlist, *iterv;
- EditMesh *em = G.editMesh;
- EditVert *ev;
- EditFace *efa;
-
- struct UvVertMap *vmap;
-
-
- if(is_uv_tface_editing_allowed()==0)
- return;
- if(G.sima->flag & SI_SYNC_UVSEL) {
- error("Can't stitch when Sync Mesh Selection is enabled");
- return;
- }
-
- limit[0]= limit[1]= 20.0;
- add_numbut(0, NUM|FLO, "Limit:", 0.1, 1000.0, &limit[0], NULL);
- if (!do_clever_numbuts("Stitch UVs", 1, REDRAW))
- return;
-
- limit[0]= limit[1]= limit[0]/256.0;
- if(G.sima->image) {
- ImBuf *ibuf= BKE_image_get_ibuf(G.sima->image, &G.sima->iuser);
-
- if(ibuf && ibuf->x > 0 && ibuf->y > 0) {
- limit[1]= limit[0]/(float)ibuf->y;
- limit[0]= limit[0]/(float)ibuf->x;
- }
- }
-
- /*vmap= make_uv_vert_map(me->mface, tf, me->totface, me->totvert, 1, limit);*/
- EM_init_index_arrays(0, 0, 1);
- vmap= make_uv_vert_map_EM(1, 0, limit);
- if(vmap == NULL)
- return;
-
- for(a=0, ev= em->verts.first; ev; a++, ev= ev->next) {
- vlist= get_uv_map_vert_EM(vmap, a);
-
- while(vlist) {
- newuv[0]= 0; newuv[1]= 0;
- vtot= 0;
-
- for(iterv=vlist; iterv; iterv=iterv->next) {
- if((iterv != vlist) && iterv->separate)
- break;
- efa = EM_get_face_for_index(iterv->f);
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-
- if (tf[iterv->f].flag & TF_SEL_MASK(iterv->tfindex)) {
- newuv[0] += tf->uv[iterv->tfindex][0];
- newuv[1] += tf->uv[iterv->tfindex][1];
- vtot++;
- }
- }
-
- if (vtot > 1) {
- newuv[0] /= vtot; newuv[1] /= vtot;
-
- for(iterv=vlist; iterv; iterv=iterv->next) {
- if((iterv != vlist) && iterv->separate)
- break;
- efa = EM_get_face_for_index(iterv->f);
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (tf->flag & TF_SEL_MASK(iterv->tfindex)) {
- tf->uv[iterv->tfindex][0]= newuv[0];
- tf->uv[iterv->tfindex][1]= newuv[1];
- }
- }
- }
- vlist= iterv;
- }
- }
-
- free_uv_vert_map_EM(vmap);
- EM_free_index_arrays();
-
- if(G.sima->flag & SI_BE_SQUARE) be_square_tface_uv(em);
-
- BIF_undo_push("Stitch UV");
-
- object_uvs_changed(OBACT);
-}
-
-void select_linked_tface_uv(int mode) /* TODO */
-{
- EditMesh *em= G.editMesh;
- EditFace *efa, *nearestefa=NULL;
- MTFace *tf, *nearesttf=NULL;
- UvVertMap *vmap;
- UvMapVert *vlist, *iterv, *startv;
- unsigned int *stack, stacksize= 0, nearestv;
- char *flag;
- int a, nearestuv, i, nverts, j;
- float limit[2];
- if(is_uv_tface_editing_allowed()==0)
- return;
-
- if(G.sima->flag & SI_SYNC_UVSEL) {
- error("Can't select linked when Sync Mesh Selection is enabled");
- return;
- }
-
- if (mode == 2) {
- nearesttf= NULL;
- nearestuv= 0;
- }
- if (mode!=2) {
- find_nearest_uv(&nearesttf, &nearestefa, &nearestv, &nearestuv);
- if(nearesttf==NULL)
- return;
- }
-
- get_connected_limit_tface_uv(limit);
- vmap= make_uv_vert_map_EM(1, 1, limit);
- if(vmap == NULL)
- return;
-
- stack= MEM_mallocN(sizeof(*stack)* BLI_countlist(&em->faces), "UvLinkStack");
- flag= MEM_callocN(sizeof(*flag)*BLI_countlist(&em->faces), "UvLinkFlag");
-
- if (mode == 2) {
- for (a=0, efa= em->faces.first; efa; efa= efa->next, a++) {
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tf)) {
- if(tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4)) {
- stack[stacksize]= a;
- stacksize++;
- flag[a]= 1;
- }
- }
- }
- } else {
- for (a=0, efa= em->faces.first; efa; efa= efa->next, a++) {
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if(tf == nearesttf) {
- stack[stacksize]= a;
- stacksize++;
- flag[a]= 1;
- break;
- }
- }
- }
-
- while(stacksize > 0) {
- stacksize--;
- a= stack[stacksize];
-
- for (j=0, efa= em->faces.first; efa; efa= efa->next, j++) {
- if (j==a) {
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- break;
- }
- }
-
- nverts= efa->v4? 4: 3;
-
- for(i=0; i<nverts; i++) {
- /* make_uv_vert_map_EM sets verts tmp.l to the indicies */
- vlist= get_uv_map_vert_EM(vmap, (*(&efa->v1 + i))->tmp.l);
-
- startv= vlist;
-
- for(iterv=vlist; iterv; iterv=iterv->next) {
- if(iterv->separate)
- startv= iterv;
- if(iterv->f == a)
- break;
- }
-
- for(iterv=startv; iterv; iterv=iterv->next) {
- if((startv != iterv) && (iterv->separate))
- break;
- else if(!flag[iterv->f]) {
- flag[iterv->f]= 1;
- stack[stacksize]= iterv->f;;
- stacksize++;
- }
- }
- }
- }
-
- if(mode==0 || mode==2) {
- for (a=0, efa= em->faces.first; efa; efa= efa->next, a++) {
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if(flag[a])
- tf->flag |= (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
- else
- tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
- }
- }
- else if(mode==1) {
- for (a=0, efa= em->faces.first; efa; efa= efa->next, a++) {
- if(flag[a]) {
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (efa->v4) {
- if((tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4)))
- break;
- }
- else if(tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3))
- break;
- }
- }
-
- if (efa) {
- for (a=0, efa= em->faces.first; efa; efa= efa->next, a++) {
- if(flag[a]) {
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
- }
- }
- }
- else {
- for (a=0, efa= em->faces.first; efa; efa= efa->next, a++) {
- if(flag[a]) {
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- tf->flag |= (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
- }
- }
- }
- }
-
- MEM_freeN(stack);
- MEM_freeN(flag);
- free_uv_vert_map_EM(vmap);
-
- BIF_undo_push("Select linked UV");
- scrarea_queue_winredraw(curarea);
-}
-
-void unlink_selection(void)
-{
- EditMesh *em= G.editMesh;
- EditFace *efa;
- MTFace *tface;
-
- if( is_uv_tface_editing_allowed()==0 ) return;
-
- if(G.sima->flag & SI_SYNC_UVSEL) {
- error("Can't select unlinked when Sync Mesh Selection is enabled");
- return;
- }
-
- for (efa= em->faces.first; efa; efa= efa->next) {
- tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tface)) {
- if(efa->v4) {
- if(~tface->flag & (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4))
- tface->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
- } else {
- if(~tface->flag & (TF_SEL1|TF_SEL2|TF_SEL3))
- tface->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3);
- }
- }
- }
-
- BIF_undo_push("Unlink UV selection");
- scrarea_queue_winredraw(curarea);
-}
-
-/* this function sets the selection on tagged faces
- * This is needed because setting the selection on a face is done in
- * a number of places but it also needs to respect the sticky modes
- * for the UV verts - dealing with the sticky modes is best done in a seperate function
- *
- * de-selects faces that have been tagged on efa->tmp.l
- */
-void uvface_setsel__internal(short select)
-{
-
- /* All functions calling this should call
- * draw_uvs_face_check()
- */
-
-
- /* selecting UV Faces with some modes requires us to change
- * the selection in other faces (depending on the stickt mode)
- *
- * This only needs to be done when the Mesh is not used for selection
- * (So for sticky modes - vertex or location based)
- * */
-
- EditMesh *em = G.editMesh;
- EditFace *efa;
- MTFace *tf;
- int nverts, i;
-
- if ((G.sima->flag & SI_SYNC_UVSEL)==0 && G.sima->sticky == SI_STICKY_VERTEX) {
- /* tag all verts as untouched,
- * then touch the ones that have a face center in the loop
- * and select all MTFace UV's that use a touched vert */
-
- EditVert *eve;
-
- for (eve= em->verts.first; eve; eve= eve->next)
- eve->tmp.l = 0;
-
- for (efa= em->faces.first; efa; efa= efa->next) {
- if (efa->tmp.l) {
- if (efa->v4) {
- efa->v1->tmp.l= efa->v2->tmp.l= efa->v3->tmp.l= efa->v4->tmp.l=1;
- } else {
- efa->v1->tmp.l= efa->v2->tmp.l= efa->v3->tmp.l= 1;
- }
- }
- }
- /* now select tagged verts */
- for (efa= em->faces.first; efa; efa= efa->next) {
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- nverts= efa->v4? 4: 3;
- for(i=0; i<nverts; i++) {
- if ((*(&efa->v1 + i))->tmp.l) {
- if (select) {
- simaUVSel_Set(efa, tf, i);
- } else {
- simaUVSel_UnSet(efa, tf, i);
- }
- }
- }
- }
- } else if ((G.sima->flag & SI_SYNC_UVSEL)==0 && G.sima->sticky == SI_STICKY_LOC) {
- EditFace *efa_vlist;
- MTFace *tf_vlist;
- UvMapVert *vlist, *start_vlist=NULL, *vlist_iter;
- struct UvVertMap *vmap;
- float limit[2];
- int efa_index;
- //EditVert *eve; /* removed vert counting for now */
- //int a;
-
- get_connected_limit_tface_uv(limit);
-
- EM_init_index_arrays(0, 0, 1);
- vmap= make_uv_vert_map_EM(0, 0, limit);
-
- /* verts are numbered above in make_uv_vert_map_EM, make sure this stays true! */
- /*for (a=0, eve= em->verts.first; eve; a++, eve= eve->next)
- eve->tmp.l = a; */
-
- if(vmap == NULL)
- return;
-
- for (efa_index=0, efa= em->faces.first; efa; efa_index++, efa= efa->next) {
- if (efa->tmp.l) {
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- nverts= efa->v4? 4: 3;
- for(i=0; i<nverts; i++) {
- if (select) {
- simaUVSel_Set(efa, tf, i);
- } else {
- simaUVSel_UnSet(efa, tf, i);
- }
-
- vlist= vlist_iter= get_uv_map_vert_EM(vmap, (*(&efa->v1 + i))->tmp.l);
-
- while (vlist_iter) {
- if (vlist_iter->separate)
- start_vlist = vlist_iter;
-
- if (efa_index == vlist_iter->f) {
- break;
- }
- vlist_iter = vlist_iter->next;
- }
-
- vlist_iter = start_vlist;
- while (vlist_iter) {
-
- if (vlist_iter != start_vlist && vlist_iter->separate)
- break;
-
- if (efa_index != vlist_iter->f) {
- efa_vlist = EM_get_face_for_index(vlist_iter->f);
- tf_vlist = CustomData_em_get(&em->fdata, efa_vlist->data, CD_MTFACE);
-
- if (select) {
- simaUVSel_Set(efa_vlist, tf_vlist, vlist_iter->tfindex);
- } else {
- simaUVSel_UnSet(efa_vlist, tf_vlist, vlist_iter->tfindex);
- }
- }
- vlist_iter = vlist_iter->next;
- }
- }
- }
- }
- EM_free_index_arrays();
- free_uv_vert_map_EM(vmap);
-
- } else { /* SI_STICKY_DISABLE or G.sima->flag & SI_SYNC_UVSEL */
- for (efa= em->faces.first; efa; efa= efa->next) {
- if (efa->tmp.l) {
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (select) {
- simaFaceSel_Set(efa, tf);
- } else {
- simaFaceSel_UnSet(efa, tf);
- }
- }
- }
- }
-}
-
-void pin_tface_uv(int mode)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
- MTFace *tface;
-
- if( is_uv_tface_editing_allowed()==0 ) return;
-
- for (efa= em->faces.first; efa; efa= efa->next) {
- tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tface)) {
- if(mode ==1) {
- if(simaUVSel_Check(efa, tface, 0)) tface->unwrap |= TF_PIN1;
- if(simaUVSel_Check(efa, tface, 1)) tface->unwrap |= TF_PIN2;
- if(simaUVSel_Check(efa, tface, 2)) tface->unwrap |= TF_PIN3;
- if(efa->v4)
- if(simaUVSel_Check(efa, tface, 3)) tface->unwrap |= TF_PIN4;
- }
- else if (mode ==0) {
- if(simaUVSel_Check(efa, tface, 0)) tface->unwrap &= ~TF_PIN1;
- if(simaUVSel_Check(efa, tface, 1)) tface->unwrap &= ~TF_PIN2;
- if(simaUVSel_Check(efa, tface, 2)) tface->unwrap &= ~TF_PIN3;
- if(efa->v4)
- if(simaUVSel_Check(efa, tface, 3)) tface->unwrap &= ~TF_PIN4;
- }
- }
- }
-
- BIF_undo_push("Pin UV");
- scrarea_queue_winredraw(curarea);
-}
-
-void select_pinned_tface_uv(void)
-{
- EditMesh *em= G.editMesh;
- EditFace *efa;
- MTFace *tface;
-
- if( is_uv_tface_editing_allowed()==0 ) return;
-
- for (efa= em->faces.first; efa; efa= efa->next) {
- tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tface)) {
- if (tface->unwrap & TF_PIN1) simaUVSel_Set(efa, tface, 0);
- if (tface->unwrap & TF_PIN2) simaUVSel_Set(efa, tface, 1);
- if (tface->unwrap & TF_PIN3) simaUVSel_Set(efa, tface, 2);
- if(efa->v4) {
- if (tface->unwrap & TF_PIN4) simaUVSel_Set(efa, tface, 3);
- }
-
- }
- }
-
- if (G.sima->flag & SI_SYNC_UVSEL) {
- allqueue(REDRAWVIEW3D, 0); /* mesh selection has changed */
- }
-
- BIF_undo_push("Select Pinned UVs");
- scrarea_queue_winredraw(curarea);
-}
-
-int minmax_tface_uv(float *min, float *max)
-{
- EditMesh *em= G.editMesh;
- EditFace *efa;
- MTFace *tf;
- int sel;
-
- if( is_uv_tface_editing_allowed()==0 ) return 0;
-
- INIT_MINMAX2(min, max);
-
- sel= 0;
- for (efa= em->faces.first; efa; efa= efa->next) {
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tf)) {
- if (simaUVSel_Check(efa, tf, 0)) DO_MINMAX2(tf->uv[0], min, max);
- if (simaUVSel_Check(efa, tf, 1)) DO_MINMAX2(tf->uv[1], min, max);
- if (simaUVSel_Check(efa, tf, 2)) DO_MINMAX2(tf->uv[2], min, max);
- if (efa->v4 && (simaUVSel_Check(efa, tf, 3))) DO_MINMAX2(tf->uv[3], min, max);
- sel = 1;
- }
- }
- return sel;
-}
-
-int cent_tface_uv(float *cent, int mode)
-{
- float min[2], max[2];
- short change= 0;
-
- if (mode==0) {
- if (minmax_tface_uv(min, max))
- change = 1;
-
- } else if (mode==1) {
- EditFace *efa;
- MTFace *tf;
- INIT_MINMAX2(min, max);
-
- for (efa= G.editMesh->faces.first; efa; efa= efa->next) {
- tf = CustomData_em_get(&G.editMesh->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tf)) {
- if (simaUVSel_Check(efa, tf, 0)) { DO_MINMAX2(tf->uv[0], min, max); change= 1;}
- if (simaUVSel_Check(efa, tf, 1)) { DO_MINMAX2(tf->uv[1], min, max); change= 1;}
- if (simaUVSel_Check(efa, tf, 2)) { DO_MINMAX2(tf->uv[2], min, max); change= 1;}
- if (efa->v4 && (simaUVSel_Check(efa, tf, 3))) { DO_MINMAX2(tf->uv[3], min, max); change= 1;}
- }
- }
- }
-
- if (change) {
- cent[0]= (min[0]+max[0])/2.0;
- cent[1]= (min[1]+max[1])/2.0;
- return 1;
- }
- return 0;
-}
-
-static void sima_show_info(int channels, int x, int y, char *cp, float *fp, int *zp, float *zpf)
-{
- short ofs;
- char str[256];
-
- ofs= sprintf(str, "X: %d Y: %d ", x, y);
- if(cp)
- ofs+= sprintf(str+ofs, "| R: %d G: %d B: %d A: %d ", cp[0], cp[1], cp[2], cp[3]);
- if(fp) {
- if(channels==4)
- ofs+= sprintf(str+ofs, "| R: %.3f G: %.3f B: %.3f A: %.3f ", fp[0], fp[1], fp[2], fp[3]);
- else if(channels==1)
- ofs+= sprintf(str+ofs, "| Val: %.3f ", fp[0]);
- else if(channels==3)
- ofs+= sprintf(str+ofs, "| R: %.3f G: %.3f B: %.3f ", fp[0], fp[1], fp[2]);
- }
- if(zp)
- ofs+= sprintf(str+ofs, "| Z: %.4f ", 0.5+0.5*( ((float)*zp)/(float)0x7fffffff));
- if(zpf)
- ofs+= sprintf(str+ofs, "| Z: %.3f ", *zpf);
-
- glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
-
- glColor4f(.0,.0,.0,.25);
- glRectf(0.0, 0.0, curarea->winx, 30.0);
- glDisable(GL_BLEND);
-
- glColor3ub(255, 255, 255);
- glRasterPos2i(10, 10);
-
- BMF_DrawString(G.fonts, str);
-
-}
-
-void sima_sample_color(void)
-{
- ImBuf *ibuf= BKE_image_get_ibuf(G.sima->image, &G.sima->iuser);
- float fx, fy;
- short mval[2], mvalo[2], firsttime=1;
-
- if(ibuf==NULL)
- return;
-
- calc_image_view(G.sima, 'f');
- getmouseco_areawin(mvalo);
-
- while(get_mbut() & L_MOUSE) {
-
- getmouseco_areawin(mval);
- if(mval[0]!=mvalo[0] || mval[1]!=mvalo[1] || firsttime) {
- firsttime= 0;
- areamouseco_to_ipoco(G.v2d, mval, &fx, &fy);
-
- if(fx>=0.0 && fy>=0.0 && fx<1.0 && fy<1.0) {
- float *fp= NULL, *zpf= NULL;
- int *zp= NULL;
- char *cp= NULL;
-
- int x= (int) (fx*ibuf->x);
- int y= (int) (fy*ibuf->y);
-
- if(x>=ibuf->x) x= ibuf->x-1;
- if(y>=ibuf->y) y= ibuf->y-1;
-
- if(ibuf->rect)
- cp= (char *)(ibuf->rect + y*ibuf->x + x);
- if(ibuf->zbuf)
- zp= ibuf->zbuf + y*ibuf->x + x;
- if(ibuf->zbuf_float)
- zpf= ibuf->zbuf_float + y*ibuf->x + x;
- if(ibuf->rect_float)
- fp= (ibuf->rect_float + (ibuf->channels)*(y*ibuf->x + x));
-
- if(G.sima->cumap) {
- float vec[3];
- if(fp==NULL) {
- fp= vec;
- vec[0]= (float)cp[0]/255.0f;
- vec[1]= (float)cp[1]/255.0f;
- vec[2]= (float)cp[2]/255.0f;
- }
-
- if(ibuf->channels==4) {
- if(G.qual & LR_CTRLKEY) {
- curvemapping_set_black_white(G.sima->cumap, NULL, fp);
- curvemapping_do_ibuf(G.sima->cumap, ibuf);
- }
- else if(G.qual & LR_SHIFTKEY) {
- curvemapping_set_black_white(G.sima->cumap, fp, NULL);
- curvemapping_do_ibuf(G.sima->cumap, ibuf);
- }
- }
- }
-
- scrarea_do_windraw(curarea);
- myortho2(-0.375, curarea->winx-0.375, -0.375, curarea->winy-0.375);
- glLoadIdentity();
- sima_show_info(ibuf->channels, x, y, cp, fp, zp, zpf);
- screen_swapbuffers();
- }
-
- }
- BIF_wait_for_statechange();
- }
-
- scrarea_queue_winredraw(curarea);
-}
-
-/* Image functions */
-
-static void load_image_filesel(char *str) /* called from fileselect */
-{
- Image *ima= NULL;
-
- ima= BKE_add_image_file(str);
- if(ima) {
- BKE_image_signal(ima, &G.sima->iuser, IMA_SIGNAL_RELOAD);
- image_changed(G.sima, ima);
- }
- BIF_undo_push("Load image UV");
- allqueue(REDRAWIMAGE, 0);
-}
-
-static void replace_image_filesel(char *str) /* called from fileselect */
-{
- if (!G.sima->image)
- return;
-
- strncpy(G.sima->image->name, str, sizeof(G.sima->image->name)-1); /* we cant do much if the str is longer then 240 :/ */
- BKE_image_signal(G.sima->image, &G.sima->iuser, IMA_SIGNAL_RELOAD);
- BIF_undo_push("Replace image UV");
- allqueue(REDRAWIMAGE, 0);
- allqueue(REDRAWVIEW3D, 0);
-}
-
-
-static void save_image_doit(char *name)
-{
- Image *ima= G.sima->image;
- ImBuf *ibuf= BKE_image_get_ibuf(ima, &G.sima->iuser);
- int len;
- char str[FILE_MAXDIR+FILE_MAXFILE];
-
- if (ibuf) {
- BLI_strncpy(str, name, sizeof(str));
-
- BLI_convertstringcode(str, G.sce, G.scene->r.cfra);
-
- if(G.scene->r.scemode & R_EXTENSION)
- BKE_add_image_extension(str, G.sima->imtypenr);
-
- if (saveover(str)) {
-
- /* enforce user setting for RGB or RGBA, but skip BW */
- if(G.scene->r.planes==32)
- ibuf->depth= 32;
- else if(G.scene->r.planes==24)
- ibuf->depth= 24;
-
- waitcursor(1);
- if(G.sima->imtypenr==R_MULTILAYER) {
- RenderResult *rr= BKE_image_get_renderresult(ima);
- if(rr) {
- RE_WriteRenderResult(rr, str, G.scene->r.quality);
-
- BLI_strncpy(ima->name, name, sizeof(ima->name));
- BLI_strncpy(ibuf->name, str, sizeof(ibuf->name));
-
- /* should be function? nevertheless, saving only happens here */
- for(ibuf= ima->ibufs.first; ibuf; ibuf= ibuf->next)
- ibuf->userflags &= ~IB_BITMAPDIRTY;
-
- }
- else error("Did not write, no Multilayer Image");
- }
- else if (BKE_write_ibuf(ibuf, str, G.sima->imtypenr, G.scene->r.subimtype, G.scene->r.quality)) {
- BLI_strncpy(ima->name, name, sizeof(ima->name));
- BLI_strncpy(ibuf->name, str, sizeof(ibuf->name));
-
- ibuf->userflags &= ~IB_BITMAPDIRTY;
-
- /* change type? */
- if( ELEM(ima->source, IMA_SRC_GENERATED, IMA_SRC_VIEWER)) {
- ima->source= IMA_SRC_FILE;
- ima->type= IMA_TYPE_IMAGE;
- }
- if(ima->type==IMA_TYPE_R_RESULT)
- ima->type= IMA_TYPE_IMAGE;
-
- /* name image as how we saved it */
- len= strlen(str);
- while (len > 0 && str[len - 1] != '/' && str[len - 1] != '\\') len--;
- rename_id(&ima->id, str+len);
- }
- else {
- error("Couldn't write image: %s", str);
- }
-
- allqueue(REDRAWHEADERS, 0);
- allqueue(REDRAWBUTSSHADING, 0);
-
- waitcursor(0);
- }
- }
-}
-
-void open_image_sima(short imageselect)
-{
- char name[FILE_MAXDIR+FILE_MAXFILE];
-
- if(G.sima->image)
- strcpy(name, G.sima->image->name);
- else
- strcpy(name, U.textudir);
-
- if(imageselect)
- activate_imageselect(FILE_SPECIAL, "Open Image", name, load_image_filesel);
- else
- activate_fileselect(FILE_SPECIAL, "Open Image", name, load_image_filesel);
-}
-
-void replace_image_sima(short imageselect)
-{
- char name[FILE_MAXDIR+FILE_MAXFILE];
-
- if(G.sima->image)
- strcpy(name, G.sima->image->name);
- else
- strcpy(name, U.textudir);
-
- if(imageselect)
- activate_imageselect(FILE_SPECIAL, "Replace Image", name, replace_image_filesel);
- else
- activate_fileselect(FILE_SPECIAL, "Replace Image", name, replace_image_filesel);
-}
-
-
-static char *filesel_imagetype_string(Image *ima)
-{
- char *strp, *str= MEM_callocN(14*32, "menu for filesel");
-
- strp= str;
- str += sprintf(str, "Save Image as: %%t|");
- str += sprintf(str, "Targa %%x%d|", R_TARGA);
- str += sprintf(str, "Targa Raw %%x%d|", R_RAWTGA);
- str += sprintf(str, "PNG %%x%d|", R_PNG);
- str += sprintf(str, "BMP %%x%d|", R_BMP);
- str += sprintf(str, "Jpeg %%x%d|", R_JPEG90);
- str += sprintf(str, "Iris %%x%d|", R_IRIS);
- if(G.have_libtiff)
- str += sprintf(str, "Tiff %%x%d|", R_TIFF);
- str += sprintf(str, "Radiance HDR %%x%d|", R_RADHDR);
- str += sprintf(str, "Cineon %%x%d|", R_CINEON);
- str += sprintf(str, "DPX %%x%d|", R_DPX);
-#ifdef WITH_OPENEXR
- str += sprintf(str, "OpenEXR %%x%d|", R_OPENEXR);
- /* saving sequences of multilayer won't work, they copy buffers */
- if(ima->source==IMA_SRC_SEQUENCE && ima->type==IMA_TYPE_MULTILAYER);
- else str += sprintf(str, "MultiLayer %%x%d|", R_MULTILAYER);
-#endif
- return strp;
-}
-
-/* always opens fileselect */
-void save_as_image_sima(void)
-{
- Image *ima = G.sima->image;
- ImBuf *ibuf= BKE_image_get_ibuf(ima, &G.sima->iuser);
- char name[FILE_MAXDIR+FILE_MAXFILE];
-
- if (ima) {
- strcpy(name, ima->name);
-
- if (ibuf) {
- char *strp;
-
- strp= filesel_imagetype_string(ima);
-
- /* cant save multilayer sequence, ima->rr isn't valid for a specific frame */
- if(ima->rr && !(ima->source==IMA_SRC_SEQUENCE && ima->type==IMA_TYPE_MULTILAYER))
- G.sima->imtypenr= R_MULTILAYER;
- else if(ima->type==IMA_TYPE_R_RESULT)
- G.sima->imtypenr= G.scene->r.imtype;
- else G.sima->imtypenr= BKE_ftype_to_imtype(ibuf->ftype);
-
- activate_fileselect_menu(FILE_SPECIAL, "Save Image", name, strp, &G.sima->imtypenr, save_image_doit);
- }
- }
-}
-
-/* if exists, saves over without fileselect */
-void save_image_sima(void)
-{
- Image *ima = G.sima->image;
- ImBuf *ibuf= BKE_image_get_ibuf(ima, &G.sima->iuser);
- char name[FILE_MAXDIR+FILE_MAXFILE];
-
- if (ima) {
- strcpy(name, ima->name);
-
- if (ibuf) {
- if (BLI_exists(ibuf->name)) {
- if(BKE_image_get_renderresult(ima))
- G.sima->imtypenr= R_MULTILAYER;
- else
- G.sima->imtypenr= BKE_ftype_to_imtype(ibuf->ftype);
-
- save_image_doit(ibuf->name);
- }
- else
- save_as_image_sima();
- }
- }
-}
-
-void save_image_sequence_sima(void)
-{
- ImBuf *ibuf;
- int tot= 0;
- char di[FILE_MAX], fi[FILE_MAX];
-
- if(G.sima->image==NULL)
- return;
- if(G.sima->image->source!=IMA_SRC_SEQUENCE)
- return;
- if(G.sima->image->type==IMA_TYPE_MULTILAYER) {
- error("Cannot save Multilayer Sequences");
- return;
- }
-
- /* get total */
- for(ibuf= G.sima->image->ibufs.first; ibuf; ibuf= ibuf->next)
- if(ibuf->userflags & IB_BITMAPDIRTY)
- tot++;
-
- if(tot==0) {
- notice("No Images have been changed");
- return;
- }
- /* get a filename for menu */
- for(ibuf= G.sima->image->ibufs.first; ibuf; ibuf= ibuf->next)
- if(ibuf->userflags & IB_BITMAPDIRTY)
- break;
-
- BLI_strncpy(di, ibuf->name, FILE_MAX);
- BLI_splitdirstring(di, fi);
-
- sprintf(fi, "%d Image(s) will be saved in %s", tot, di);
- if(okee(fi)) {
-
- for(ibuf= G.sima->image->ibufs.first; ibuf; ibuf= ibuf->next) {
- if(ibuf->userflags & IB_BITMAPDIRTY) {
- char name[FILE_MAX];
- BLI_strncpy(name, ibuf->name, sizeof(name));
-
- BLI_convertstringcode(name, G.sce, 0);
-
- if(0 == IMB_saveiff(ibuf, name, IB_rect | IB_zbuf | IB_zbuffloat)) {
- error("Could not write image", name);
- break;
- }
- printf("Saved: %s\n", ibuf->name);
- ibuf->userflags &= ~IB_BITMAPDIRTY;
- }
- }
- }
-}
-
-void reload_image_sima(void)
-{
- if (G.sima ) {
- BKE_image_signal(G.sima->image, &G.sima->iuser, IMA_SIGNAL_RELOAD);
- /* image_changed(G.sima, 0); - do we really need this? */
- }
-
- allqueue(REDRAWIMAGE, 0);
- allqueue(REDRAWVIEW3D, 0);
- BIF_preview_changed(ID_TE);
-}
-
-void new_image_sima(void)
-{
- static int width= 1024, height= 1024;
- static short uvtestgrid= 0;
- static float color[] = {0, 0, 0, 1};
- char name[22];
- Image *ima;
-
- strcpy(name, "Untitled");
-
- add_numbut(0, TEX, "Name:", 0, 21, name, NULL);
- add_numbut(1, NUM|INT, "Width:", 1, 16384, &width, NULL);
- add_numbut(2, NUM|INT, "Height:", 1, 16384, &height, NULL);
- add_numbut(3, COL, "", 0, 0, &color, NULL);
- add_numbut(4, NUM|FLO, "Alpha:", 0.0, 1.0, &color[3], NULL);
- add_numbut(5, TOG|SHO, "UV Test Grid", 0, 0, &uvtestgrid, NULL);
- if (!do_clever_numbuts("New Image", 6, REDRAW))
- return;
-
- ima = BKE_add_image_size(width, height, name, uvtestgrid, color);
- image_changed(G.sima, ima);
- BKE_image_signal(G.sima->image, &G.sima->iuser, IMA_SIGNAL_USER_NEW_IMAGE);
- BIF_undo_push("Add image");
-
- allqueue(REDRAWIMAGE, 0);
- allqueue(REDRAWVIEW3D, 0);
-}
-
-void pack_image_sima()
-{
- Image *ima = G.sima->image;
-
- if (ima) {
- if(ima->source!=IMA_SRC_SEQUENCE && ima->source!=IMA_SRC_MOVIE) {
- if (ima->packedfile) {
- if (G.fileflags & G_AUTOPACK)
- if (okee("Disable AutoPack?"))
- G.fileflags &= ~G_AUTOPACK;
-
- if ((G.fileflags & G_AUTOPACK) == 0) {
- unpackImage(ima, PF_ASK);
- BIF_undo_push("Unpack image");
- }
- }
- else {
- ImBuf *ibuf= BKE_image_get_ibuf(ima, &G.sima->iuser);
- if (ibuf && (ibuf->userflags & IB_BITMAPDIRTY)) {
- if(okee("Can't pack painted image. Use Repack as PNG?"))
- BKE_image_memorypack(ima);
- }
- else {
- ima->packedfile = newPackedFile(ima->name);
- BIF_undo_push("Pack image");
- }
- }
-
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWHEADERS, 0);
- }
- }
-}
-
-
-
-/* goes over all ImageUsers, and sets frame numbers if auto-refresh is set */
-void BIF_image_update_frame(void)
-{
- Tex *tex;
-
- /* texture users */
- for(tex= G.main->tex.first; tex; tex= tex->id.next) {
- if(tex->type==TEX_IMAGE && tex->ima)
- if(ELEM(tex->ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE))
- if(tex->iuser.flag & IMA_ANIM_ALWAYS)
- BKE_image_user_calc_imanr(&tex->iuser, G.scene->r.cfra, 0);
-
- }
- /* image window, compo node users */
- if(G.curscreen) {
- ScrArea *sa;
- for(sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- if(sa->spacetype==SPACE_VIEW3D) {
- View3D *v3d= sa->spacedata.first;
- if(v3d->bgpic)
- if(v3d->bgpic->iuser.flag & IMA_ANIM_ALWAYS)
- BKE_image_user_calc_imanr(&v3d->bgpic->iuser, G.scene->r.cfra, 0);
- }
- else if(sa->spacetype==SPACE_IMAGE) {
- SpaceImage *sima= sa->spacedata.first;
- if(sima->iuser.flag & IMA_ANIM_ALWAYS)
- BKE_image_user_calc_imanr(&sima->iuser, G.scene->r.cfra, 0);
- }
- else if(sa->spacetype==SPACE_NODE) {
- SpaceNode *snode= sa->spacedata.first;
- if((snode->treetype==NTREE_COMPOSIT) && (snode->nodetree)) {
- bNode *node;
- for(node= snode->nodetree->nodes.first; node; node= node->next) {
- if(node->id && node->type==CMP_NODE_IMAGE) {
- Image *ima= (Image *)node->id;
- ImageUser *iuser= node->storage;
- if(ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE))
- if(iuser->flag & IMA_ANIM_ALWAYS)
- BKE_image_user_calc_imanr(iuser, G.scene->r.cfra, 0);
- }
- }
- }
- }
- }
- }
-}
-
-void aspect_sima(SpaceImage *sima, float *x, float *y)
-{
- *x = *y = 1.0;
-
- if( (sima->image == 0) ||
- (sima->image->type == IMA_TYPE_R_RESULT) ||
- (sima->image->type == IMA_TYPE_COMPOSITE) ||
- (sima->image->tpageflag & IMA_TILES) ||
- (sima->image->aspx==0.0 || sima->image->aspy==0.0)
- ) {
- return;
- }
-
- /* x is always 1 */
- *y = sima->image->aspy / sima->image->aspx;
-}
-
-
-/* Face selection tests - Keep these together */
-
-/* this checks weather a face is drarn without the local image check */
-int simaFaceDraw_Check_nolocal( EditFace *efa )
-{
- if (G.sima && G.sima->flag & SI_SYNC_UVSEL) {
- return (efa->h==0);
- } else {
- return (efa->h==0 && efa->f & SELECT);
- }
- return 0;
-}
-
-int simaFaceDraw_Check( EditFace *efa, MTFace *tf )
-{
- if (G.sima && G.sima->flag & SI_LOCAL_UV) {
- if (tf->tpage==G.sima->image) {
- return simaFaceDraw_Check_nolocal(efa);
- } else {
- return 0;
- }
- } else {
- return simaFaceDraw_Check_nolocal(efa);
- }
-}
-
-int simaFaceSel_Check( struct EditFace *efa, struct MTFace *tf )
-{
- if (G.sima && G.sima->flag & SI_SYNC_UVSEL) {
- return (efa->f & SELECT);
- } else {
- return (!(~tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3)) &&(!efa->v4 || tf->flag & TF_SEL4));
- }
-}
-
-void simaFaceSel_Set( struct EditFace *efa, struct MTFace *tf )
-{
- if (G.sima && G.sima->flag & SI_SYNC_UVSEL) {
- EM_select_face(efa, 1);
- } else {
- tf->flag |= (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
- }
-}
-
-void simaFaceSel_UnSet( struct EditFace *efa, struct MTFace *tf )
-{
- if (G.sima && G.sima->flag & SI_SYNC_UVSEL) {
- EM_select_face(efa, 0);
- } else {
- tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
- }
-}
-
-int simaUVSel_Check( struct EditFace *efa, struct MTFace *tf, int i)
-{
- if (G.sima && G.sima->flag & SI_SYNC_UVSEL) {
- if (G.scene->selectmode == SCE_SELECT_FACE) {
- return efa->f & SELECT;
- } else {
- return (*(&efa->v1 + i))->f & SELECT;
- }
- } else {
- return tf->flag & TF_SEL_MASK(i);
- }
-}
-
-void simaUVSel_Set( struct EditFace *efa, struct MTFace *tf, int i)
-{
- if (G.sima && G.sima->flag & SI_SYNC_UVSEL) {
- if (G.scene->selectmode == SCE_SELECT_FACE) {
- EM_select_face(efa, 1);
- } else {
- (*(&efa->v1 + i))->f |= SELECT;
- }
- } else {
- tf->flag |= TF_SEL_MASK(i);
- }
-}
-
-void simaUVSel_UnSet( struct EditFace *efa, struct MTFace *tf, int i)
-{
- if (G.sima && G.sima->flag & SI_SYNC_UVSEL) {
- if (G.scene->selectmode == SCE_SELECT_FACE) {
- EM_select_face(efa, 0);
- } else {
- (*(&efa->v1 + i))->f &= ~SELECT;
- }
- } else {
- tf->flag &= ~TF_SEL_MASK(i);
- }
-}
diff --git a/source/blender/src/editsound.c b/source/blender/src/editsound.c
deleted file mode 100644
index befcd574ac4..00000000000
--- a/source/blender/src/editsound.c
+++ /dev/null
@@ -1,1063 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <string.h>
-#include <fcntl.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef WIN32
-#define __USE_XOPEN /* Needed for swab on linux */
-#include <unistd.h>
-#undef __USE_XOPEN
-#else
-
-#include <io.h>
-#endif
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "DNA_object_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_sound_types.h"
-#include "DNA_packedFile_types.h"
-#include "DNA_userdef_types.h"
-
-#include "BKE_utildefines.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_sound.h"
-#include "BKE_library.h"
-#include "BKE_packedFile.h"
-
-#include "BIF_space.h"
-#include "BIF_screen.h"
-#include "BIF_interface.h"
-#include "BIF_editsound.h"
-#include "BIF_mywindow.h"
-#include "BIF_toolbox.h"
-
-#include "BSE_drawipo.h"
-#include "BSE_headerbuttons.h"
-#include "BSE_time.h"
-
-#include "BDR_editobject.h"
-
-#include "blendef.h"
-
-#include "mydevice.h"
-
-#include "SND_C-api.h"
-#include "SND_DependKludge.h"
-
-#include "SYS_System.h"
-
-#include "PIL_time.h"
-
-
-/* this might move to the external header */
-void* sound_get_libraryinterface(void);
-
-static SND_SceneHandle ghSoundScene=NULL;
-static SND_AudioDeviceInterfaceHandle ghAudioDeviceInterface=NULL;
-
-/* que? why only here? because of the type define? */
-bSound *sound_find_sound(char *id_name);
-void sound_read_wav_data(bSound * sound, PackedFile * pf);
-void sound_stop_sound(void *object, bSound *sound);
-void winqreadsoundspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
-/* void sound_stop_all_sounds(void); already in BIF_editsound.h */
-
-
-
-/* Right. Now for some implementation: */
-void winqreadsoundspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
-{
- SpaceSound *ssound= spacedata;
- unsigned short event= evt->event;
- short val= evt->val;
- float dx, dy;
- int doredraw= 0, cfra, first = 0;
- short mval[2], nr;
- short mousebut = L_MOUSE;
-
- if(curarea->win==0) return;
-
- if(val) {
-
- if( uiDoBlocks(&curarea->uiblocks, event, 1)!=UI_NOTHING ) event= 0;
-
- /* swap mouse buttons based on user preference */
- if (U.flag & USER_LMOUSESELECT) {
- if (event == LEFTMOUSE) {
- event = RIGHTMOUSE;
- mousebut = L_MOUSE;
- } else if (event == RIGHTMOUSE) {
- event = LEFTMOUSE;
- mousebut = R_MOUSE;
- }
- }
-
- switch(event) {
- case LEFTMOUSE:
- ssound->flag |= SND_CFRA_NUM;
- do {
- getmouseco_areawin(mval);
- areamouseco_to_ipoco(G.v2d, mval, &dx, &dy);
-
- cfra = (int)dx;
- if(cfra< 1) cfra= 1;
-
- if( cfra!=CFRA || first )
- {
- first= 0;
- CFRA= cfra;
- update_for_newframe();
- force_draw_plus(SPACE_VIEW3D, 1);
- }
- else PIL_sleep_ms(30);
-
- } while(get_mbut() & mousebut);
- ssound->flag &= ~SND_CFRA_NUM;
-
- doredraw= 1;
-
- break;
- case MIDDLEMOUSE:
- case WHEELUPMOUSE:
- case WHEELDOWNMOUSE:
- view2dmove(event); /* in drawipo.c */
- break;
- case RIGHTMOUSE:
- {
- TimeMarker *marker;
-
- getmouseco_areawin(mval);
- areamouseco_to_ipoco(G.v2d, mval, &dx, &dy);
-
- marker = find_nearest_marker(0);
- if (marker) {
- if ((G.qual & LR_SHIFTKEY)==0)
- deselect_markers(0, 0);
-
- if (marker->flag & SELECT)
- marker->flag &= ~SELECT;
- else
- marker->flag |= SELECT;
- }
-
- force_draw(0);
- std_rmouse_transform(transform_markers);
- }
- break;
-
- case PADPLUSKEY:
- dx= (float)(0.1154*(G.v2d->cur.xmax-G.v2d->cur.xmin));
- G.v2d->cur.xmin+= dx;
- G.v2d->cur.xmax-= dx;
- test_view2d(G.v2d, curarea->winx, curarea->winy);
- view2d_do_locks(curarea, V2D_LOCK_COPY);
- doredraw= 1;
- break;
- case PADMINUS:
- dx= (float)(0.15*(G.v2d->cur.xmax-G.v2d->cur.xmin));
- G.v2d->cur.xmin-= dx;
- G.v2d->cur.xmax+= dx;
- test_view2d(G.v2d, curarea->winx, curarea->winy);
- view2d_do_locks(curarea, V2D_LOCK_COPY);
- doredraw= 1;
- break;
- case HOMEKEY:
- do_sound_buttons(B_SOUNDHOME);
- break;
-
- case PAGEUPKEY: /* cfra to next marker */
- nextprev_marker(1);
- break;
- case PAGEDOWNKEY: /* cfra to prev marker */
- nextprev_marker(-1);
- break;
-
- case AKEY: /* select/deselect all */
- deselect_markers(1, 0);
-
- allqueue(REDRAWMARKER, 0);
- break;
-
- case BKEY: /* borderselect markers */
- borderselect_markers();
- break;
-
- case DKEY: /* duplicate selected marker(s) */
- if (G.qual & LR_SHIFTKEY) {
- duplicate_marker();
-
- allqueue(REDRAWMARKER, 0);
- }
- break;
-
- case GKEY:
- transform_markers('g', 0);
- break;
-
- case MKEY: /* add marker or rename first selected */
- if (G.qual & LR_CTRLKEY)
- rename_marker();
- else
- add_marker(CFRA);
-
- allqueue(REDRAWMARKER, 0);
- break;
-
- case TKEY: /* toggle time display */
- nr= pupmenu("Time value%t|Frames %x1|Seconds%x2");
- if (nr>0) {
- if(nr==1) ssound->flag |= SND_DRAWFRAMES;
- else ssound->flag &= ~SND_DRAWFRAMES;
- doredraw= 1;
- }
-
- break;
-
- case DELKEY: /* delete selected markers */
- case XKEY:
- if (okee("Erase selected")) {
- remove_marker();
- allqueue(REDRAWMARKER, 0);
- }
- break;
- }
- }
-
- if(doredraw)
- scrarea_queue_winredraw(curarea);
-}
-
-
-
-void sound_initialize_sounds(void)
-{
- bSound *sound;
-
- if(ghSoundScene) {
-
- /* clear the soundscene */
- SND_RemoveAllSounds(ghSoundScene);
- SND_RemoveAllSamples(ghSoundScene);
- }
-
- /* initialize sample blocks (doesnt call audio system, needs to be done once after load */
- sound = G.main->sound.first;
- while (sound) {
- sound_sample_is_null(sound);
- sound = (bSound *) sound->id.next;
- }
-}
-
-
-
-bSound *sound_make_copy(bSound *originalsound)
-{
- bSound *sound = NULL;
- char name[160];
- int len;
-
- if(ghSoundScene==NULL) sound_init_audio();
-
- /* only copy sounds that are sounds */
- if (originalsound)
- {
- /* do some name magic */
- strcpy(name, originalsound->name);
- len = strlen(name);
- while ((len > 0) && (name[len - 1] != '/') && (name[len - 1] != '\\'))
- len--;
-
- /* allocate the needed memory */
- sound = alloc_libblock(&G.main->sound, ID_SO, name + len);
-
- /* create a soundobject */
- sound->snd_sound = SND_CreateSound();
-
- /* set the samplename */
- strcpy(sound->name, name);
- SND_SetSampleName(sound->snd_sound, sound->name);
-
- /* add the new object to the soundscene */
- SND_AddSound(ghSoundScene, sound->snd_sound);
-
- /* and copy the data from the original */
- sound->attenuation = originalsound->attenuation;
- sound->distance = originalsound->distance;
- sound->max_gain = originalsound->max_gain;
- sound->min_gain = originalsound->min_gain;
- sound->newpackedfile = originalsound->newpackedfile;
- sound->panning = originalsound->panning;
- sound->pitch = originalsound->pitch;
- sound->sample = originalsound->sample;
- sound->volume = originalsound->volume;
-
- if (originalsound->flags & SOUND_FLAGS_3D)
- sound->flags |= SOUND_FLAGS_3D;
- else
- sound->flags &= ~SOUND_FLAGS_3D;
- }
-
- return sound;
-}
-
-
-
-void sound_initialize_sample(bSound *sound)
-{
- if(ghSoundScene==NULL) sound_init_audio();
-
- if (sound && sound->sample == NULL)
- sound_sample_is_null(sound);
-}
-
-
-void sound_read_wav_data(bSound *sound, PackedFile *pf)
-{
- int i, temp;
- short shortbuf, *temps;
- int longbuf;
- char buffer[25];
- char *data = NULL;
- char *tempc;
- bSample *sample = NULL;
- int channels, rate, bits, len;
-
- /* prepare for the worst... */
- sound->sample->type = SAMPLE_INVALID;
-
- rewindPackedFile(pf);
-
- /* check to see if it is a file in "RIFF WAVE fmt" format */
- if (readPackedFile(pf, buffer, 16) != 16) {
- if (G.f & G_DEBUG) printf("File too short\n");
- return;
- }
-
- if(!(memcmp(buffer, "RIFF", 4) && memcmp(&(buffer[8]), "WAVEfmt ", 8))) {
- readPackedFile(pf, &i, 4);// start of data
- if(G.order==B_ENDIAN)
- SWITCH_INT(i);
-
- /* read the sampleformat */
- readPackedFile(pf, &shortbuf, 2);
- if(G.order==B_ENDIAN) {
- SWITCH_SHORT(shortbuf);
- }
-
- /* read the number of channels */
- readPackedFile(pf, &shortbuf, 2);
-
- if(G.order==B_ENDIAN) {
- SWITCH_SHORT(shortbuf);
- }
-
- /* check the number of channels */
- if(shortbuf != 1 && shortbuf != 2) {
- if (G.f & G_DEBUG) printf("Unsupported number of channels\n");
- return;
- }
- channels = shortbuf;
-
- /* read the samplerate */
- readPackedFile(pf, &longbuf, 4);
-
-
- if(G.order==B_ENDIAN)
- SWITCH_INT(longbuf);
- rate = longbuf;
-
- /* read the bitrate */
- // Ton's way
- readPackedFile(pf, &temp, 4);
-
- if(G.order==B_ENDIAN)
- SWITCH_INT(temp);
-
- if(channels && rate)
- bits= 8*temp/(rate * channels);
-
- // Frank's way
-
- readPackedFile(pf, &shortbuf, 2);
- readPackedFile(pf, &shortbuf, 2);
- if(G.order==B_ENDIAN) {
- SWITCH_SHORT(shortbuf);
- }
- bits = shortbuf;
-
- seekPackedFile(pf, i-16, SEEK_CUR);
- readPackedFile(pf, buffer, 4);
- /* check if we have a 'data' chunk */
- while(memcmp(buffer, "data", 4)!=0) {
- if (readPackedFile(pf, &i, 4) != 4)
- break;
-
- if(G.order==B_ENDIAN)
- SWITCH_INT(i);
-
- seekPackedFile(pf, i, SEEK_CUR);
- if (readPackedFile(pf, buffer, 4) != 4)
- break;
- }
-
- /* guess not */
- if (memcmp(buffer, "data", 4) !=0) {
- if (G.f & G_DEBUG) printf("No data found\n");
- }
- /* or maybe we do! */
- else {
- readPackedFile(pf, &longbuf, 4);
- if(G.order==B_ENDIAN) SWITCH_INT(longbuf);
-
- /* handle 8 and 16 bit samples differently */
- /* intrr: removed, longbuf is length in bytes, not samples */
- if (bits == 16)
- data = (char *)MEM_mallocN(longbuf, "sample data");
- else
- data = (char *)MEM_mallocN(longbuf*2, "sample data");
-
- len = longbuf /*/ 4.0*/; /* for some strange reason the sample length is off by a factor of 4... */
- /* intrr's comment: Funny eh, how one 16-bit stereo sample is 4 bytes? :-) */
-
- if(data) {
- readPackedFile(pf, data, len);
- /* data is only used to draw! */
- if (bits == 8) {
- temps = (short *) data;
- tempc = (char *) data;
- for (i = len - 1; i >= 0; i--)
- temps[i] = tempc[i] << 8;
- }
- else {
- if(G.order==B_ENDIAN) {
- swab(data, data, len);
- }
- }
- /* fill the sound with the found data */
- sample = sound->sample;
- sample->channels = channels;
- sample->rate = rate;
- sample->bits = bits;
- sample->len = len;
- sample->data = data;
- sample->type = SAMPLE_WAV;
- }
- }
- }
- else {
- sound->sample->type = SAMPLE_INVALID;
- if (G.f & G_DEBUG) printf("Unsupported sound format: %s\n", sound->name);
- }
-}
-
-
-
-/* ugly, but it works (for now) */
-static int sound_get_filetype_from_header(bSound *sound, PackedFile *pf)
-{
- int filetype = SAMPLE_INVALID;
- int i;
- char buffer[25];
- short shortbuf;
-
- rewindPackedFile(pf);
-
- if (readPackedFile(pf, buffer, 16) != 16) {
- if (G.f & G_DEBUG) printf("File too short\n");
- return filetype;
- }
-
- if(!(memcmp(buffer, "RIFF", 4) && memcmp(&(buffer[8]), "WAVEfmt ", 8))) {
- readPackedFile(pf, &i, 4);
- if(G.order==B_ENDIAN)
- SWITCH_INT(i);
-
- /* read the sampleformat */
- readPackedFile(pf, &shortbuf, 2);
- if(G.order==B_ENDIAN) {
- char s_i, *p_i;
- p_i= (char *)&(shortbuf);
- s_i= p_i[0];
- p_i[0]= p_i[1];
- p_i[1]= s_i;
- }
-
- if (shortbuf == SND_WAVE_FORMAT_PCM) {
- filetype = SAMPLE_WAV;
- }
- else
- /* only fmod supports compressed wav */
-#ifdef USE_FMOD
- {
- /* and only valid publishers may use compressed wav */
- switch (shortbuf)
- {
- case SND_WAVE_FORMAT_ADPCM:
- case SND_WAVE_FORMAT_ALAW:
- case SND_WAVE_FORMAT_MULAW:
- case SND_WAVE_FORMAT_DIALOGIC_OKI_ADPCM:
- case SND_WAVE_FORMAT_CONTROL_RES_VQLPC:
- case SND_WAVE_FORMAT_GSM_610:
- case SND_WAVE_FORMAT_MPEG3:
- filetype = SAMPLE_WAV;
- break;
- default:
-#endif
- {
- filetype = SAMPLE_INVALID;
- if (G.f & G_DEBUG) printf("Unsupported wav compression\n");
- }
- }
-#ifdef USE_FMOD
- }
- }
- else if (!memcmp(buffer, "OggS", 4)) {
- filetype = SAMPLE_OGG_VORBIS;
- }
- else if ((!memcmp(buffer, "ID3", 3)) || (!memcmp(buffer, "", 2))) {
- filetype = SAMPLE_MP3;
- }
-#endif
- else {
- filetype = SAMPLE_INVALID;
- if (G.f & G_DEBUG) printf("Unsupported sound format: %s\n", sound->name);
- }
-
- return filetype;
-}
-
-
-
-static int check_filetype(bSound *sound, PackedFile *pf)
-{
-// char* pdest;
- sound->sample->type = SAMPLE_INVALID;
-/*
- // parse the name for the extension to see what kind of sample it is
- pdest = strrchr(sound->sample->name, '.');
-
- // a simple check to see what kind of sample we're dealing with
- if (stricmp(pdest, ".wav") == 0)
- sound->sample->type = SAMPLE_WAV;
-
-#ifdef USE_FMOD
- if (stricmp(pdest, ".mp2") == 0)
- sound->sample->type = SAMPLE_MP2;
- if (stricmp(pdest, ".mp3") == 0)
- sound->sample->type = SAMPLE_MP3;
- if (stricmp(pdest, ".ogg") == 0)
- sound->sample->type = SAMPLE_OGG_VORBIS;
- if (stricmp(pdest, ".raw") == 0)
- sound->sample->type = SAMPLE_RAW;
- if (stricmp(pdest, ".wma") == 0)
- sound->sample->type = SAMPLE_WMA;
- if (stricmp(pdest, ".asf") == 0)
- sound->sample->type = SAMPLE_ASF;
-#endif
-*/
- sound->sample->type = sound_get_filetype_from_header(sound, pf);
-
- /* get some info from the sample */
- switch (sound->sample->type) {
- case SAMPLE_WAV:
- {
- sound_read_wav_data(sound, pf);
- break;
- }
- case SAMPLE_OGG_VORBIS:
- case SAMPLE_MP3:
- case SAMPLE_MP2:
- case SAMPLE_RAW:
- case SAMPLE_WMA:
- case SAMPLE_ASF:
- break;
- default:
- {
- if (G.f & G_DEBUG) printf("No valid sample: %s\n", sound->name);
- break;
- }
- }
-
- return sound->sample->type;
-}
-
-
-
-int sound_load_sample(bSound *sound)
-{
- int result = FALSE;
- PackedFile *pf;
- int freePF = FALSE;
- int buffer = -1;
-
- if(ghSoundScene==NULL) sound_init_audio();
-
- /* check the sample (valid?) */
- if (sound->sample->type == SAMPLE_UNKNOWN || sound->snd_sound == NULL) {
- /* find... */
- pf = sound_find_packedfile(sound);
-
- /* ...or create a (temp)packedfile */
- if (pf == NULL) {
- pf = newPackedFile(sound->name);
-
- /* if autopack is off, free the pf afterwards */
- if ((G.fileflags & G_AUTOPACK) == 0)
- freePF = TRUE;
- }
-
- /* if we have a valid pf... */
- if (pf) {
- /* check the content of the pf */
- check_filetype(sound, pf);
-
- /* check if the sampletype is supported */
- if (sound->sample->type != SAMPLE_INVALID && sound->sample->type != SAMPLE_UNKNOWN) {
- /* register the sample at the audiodevice */
- buffer = SND_AddSample(ghSoundScene, sound->sample->name, pf->data, pf->size);
-
- /* create a soundobject */
- sound->snd_sound = SND_CreateSound();
- SND_SetSampleName(sound->snd_sound, sound->sample->name);
-
- /* add the soundobject to the soundscene */
- if (SND_CheckBuffer(ghSoundScene, sound->snd_sound))
- SND_AddSound(ghSoundScene, sound->snd_sound);
- else
- if (G.f & G_DEBUG) printf("error: sample didn't load properly\n");
-
- /* if it was places in buffer[0] or higher, it succeeded */
- if (buffer >= 0)
- result = TRUE;
- }
- /* if not, free the pf */
- else {
- freePF = TRUE;
- }
-
- /* if you want it freed, make it so */
- if (freePF) {
- freePackedFile(pf);
- pf = NULL;
- }
- /* or else connect the pf to the sound and sample */
-// else {
- sound->newpackedfile = pf;
- sound->sample->packedfile = pf;
-// }
- }
- else {
- if (G.f & G_DEBUG) printf("%s: File not found!\n", sound->name);
- sound->sample->type = SAMPLE_INVALID;
- }
- }
- /* if the sample ain't invalid, we're ready to go! */
- else if (sound->sample->type != SAMPLE_INVALID) {
- result = TRUE;
- }
-
- return result;
-}
-
-
-
-bSound *sound_new_sound(char *name)
-{
- bSound *sound = NULL;
- int len, file;
- char str[FILE_MAXDIR+FILE_MAXFILE];
-
- if(ghSoundScene==NULL) sound_init_audio();
-
- if (!G.scene->audio.mixrate) G.scene->audio.mixrate = 44100;
- /* convert the name to absolute path */
- strcpy(str, name);
- BLI_convertstringcode(str, G.sce, G.scene->r.cfra);
-
- /* check if the sample on disk can be opened */
- file = open(str, O_BINARY|O_RDONLY);
-
- if (file != -1) {
- close(file);
-
-
- /* do some name magic */
- len = strlen(name);
- while (len > 0 && name[len - 1] != '/' && name[len - 1] != '\\')
- len--;
-
- /* allocate some memory for the sound */
- sound = alloc_libblock(&G.main->sound, ID_SO, name + len);
- strcpy(sound->name, name);
-
- /* intialize and check the sample */
- sound_initialize_sample(sound);
-
- /* load the sample & check if this blender supports the sound format */
-// sound_load_sample(sound);
-
- if (sound->sample->type == SAMPLE_INVALID) {
- free_libblock(&G.main->sound, sound);
- sound = NULL;
- }
- else
- {
- sound->volume = 1.0;
- sound->attenuation = 1.0;
- sound->distance = 1.0;
- sound->min_gain = 0.0;
- sound->max_gain = 1.0;
- }
- }
-
- return (sound);
-}
-
-
-
-int sound_set_sample(bSound *sound, bSample *sample)
-{
- int result = TRUE;
-
- if(ghSoundScene==NULL) sound_init_audio();
-
- /* delete the soundobject */
- if (sound->snd_sound) {
- SND_RemoveSound(ghSoundScene, sound->snd_sound);
- sound->snd_sound = NULL;
- }
-
- /* connect the sample to the sound */
- sound->sample = sample;
- sound->newpackedfile = NULL;
-
- if (sound->sample) {
-
- /* and set the right pf */
- sound->newpackedfile = sample->packedfile;
-
- /* if the sampletype is unknown initialize it */
- if (sound->sample->type == SAMPLE_UNKNOWN) {
- sound_initialize_sample(sound);
-
- /* load the sample & check if this blender supports the sound format */
- if (!sound_load_sample(sound)) {
- result = FALSE;
- }
- }
- }
-
- return result;
-}
-
-
-
-bSample *sound_new_sample(bSound *sound)
-{
- bSample *sample = NULL;
- int len;
- char *name;
-
- if (sound != NULL) {
- name = sound->name;
- len = strlen(name);
- /* do some name magic */
- while (len > 0 && name[len - 1] != '/' && name[len - 1] != '\\')
- len--;
-
- /* allocate the memory for the sample */
- sample = MEM_callocN(sizeof(bSample), "sample");
- BLI_strncpy(sample->id.name+2, name+len, 20);
- BLI_addtail(samples, sample); /* samples is ugly global */
-
- sample->data = &sample->fakedata[0];
- sample->type = SAMPLE_UNKNOWN;
-
- /* some default settings. We get divide by zero if these values are not set */
- sample->channels = 1;
- sample->rate = 44100;
- sample->bits = 16;
- sample->alindex = SAMPLE_INVALID;
-
- /* convert sound->name to abolute filename */
- strcpy(sample->name, sound->name);
- BLI_convertstringcode(sample->name, G.sce, G.scene->r.cfra);
-
- /* connect the pf to the sample */
- if (sound->newpackedfile)
- sample->packedfile = sound->newpackedfile;
- else
- sample->packedfile = sound_find_packedfile(sound);
- }
-
- return(sample);
-}
-
-
-
-/* find a sample that might already be loaded */
-bSample *sound_find_sample(bSound *sound)
-{
- bSample *sample;
- char name[FILE_MAXDIR + FILE_MAXFILE];
- char samplename[FILE_MAXDIR + FILE_MAXFILE];
-
- // convert sound->name to abolute filename
- strcpy(name, sound->name);
- BLI_convertstringcode(name, G.sce, G.scene->r.cfra);
-
- /* search through the list of loaded samples */
- sample = samples->first;
- while (sample) {
- strcpy(samplename, sample->name);
- BLI_convertstringcode(samplename, G.sce, G.scene->r.cfra);
-
- if (strcmp(name, samplename) == 0) {
- break;
- }
- sample = sample->id.next;
- }
-
- return (sample);
-}
-
-
-
-int sound_sample_is_null(bSound *sound)
-{
- int result = FALSE;
- bSample *sample;
-
- if(ghSoundScene==NULL) sound_init_audio();
-
- /* find the right sample or else create one */
- if (sound->sample == NULL) {
- /* find... */
- sample = sound_find_sample(sound);
-
- /* or a new one? */
- if (sample == NULL)
- sample = sound_new_sample(sound);
-
- if (sound_set_sample(sound, sample))
- result = TRUE;
- }
-
- return result;
-}
-
-
-
-void sound_stop_all_sounds(void)
-{
-#if GAMEBLENDER == 1
- if(ghSoundScene) {
- SND_StopAllSounds(ghSoundScene);
- SND_Proceed(ghAudioDeviceInterface, ghSoundScene);
- }
-#endif
-}
-
-
-
-void sound_end_all_sounds(void)
-{
-#if GAMEBLENDER == 1
- if(ghSoundScene) {
- sound_stop_all_sounds();
- SND_RemoveAllSounds(ghSoundScene);
- }
-#endif
-}
-
-
-
-void sound_play_sound(bSound *sound)
-{
-#if GAMEBLENDER == 1
- if(ghSoundScene==NULL) sound_init_audio();
-
- /* first check if we want sound or not */
- SND_IsPlaybackWanted(ghSoundScene);
-
- /* stop all previous sounds */
- SND_StopAllSounds(ghSoundScene);
-
- if (sound != NULL && sound->sample != NULL)
- {
- /* load the sample if needed */
- if (sound_load_sample(sound))
- {
- /* set all kinds of parameters */
- SND_SetListenerGain(ghSoundScene, G.listener->gain);
- SND_SetDopplerFactor(ghSoundScene, G.listener->dopplerfactor);
- SND_SetDopplerVelocity(ghSoundScene, G.listener->dopplervelocity);
-
- SND_SetGain((SND_ObjectHandle)sound->snd_sound, (sound->volume));
- SND_SetPitch((SND_ObjectHandle)sound->snd_sound, (exp((sound->pitch / 12.0) * log(2.0))));
-
- if (sound->flags & SOUND_FLAGS_LOOP)
- {
- SND_SetLoopMode((SND_ObjectHandle)sound->snd_sound, SND_LOOP_NORMAL);
-#ifdef SOUND_UNDER_DEVELOPMENT
-/* SND_SetLoopPoints((SND_ObjectHandle)sound->snd_sound, sound->loopstart, sound->loopend);
-*/
-#endif
- if (sound->flags & SOUND_FLAGS_BIDIRECTIONAL_LOOP)
- SND_SetLoopMode((SND_ObjectHandle)sound->snd_sound, SND_LOOP_BIDIRECTIONAL);
- else
- SND_SetLoopMode((SND_ObjectHandle)sound->snd_sound, SND_LOOP_NORMAL);
-
- }
- else
- {
- SND_SetLoopMode((SND_ObjectHandle)sound->snd_sound, SND_LOOP_OFF);
- }
-
- if (sound->flags & SOUND_FLAGS_3D)
- {
- SND_SetRollOffFactor((SND_ObjectHandle)sound->snd_sound, sound->attenuation);
- SND_SetReferenceDistance((SND_ObjectHandle)sound->snd_sound, sound->distance);
- SND_SetMinimumGain((SND_ObjectHandle)sound->snd_sound, sound->min_gain);
- SND_SetMaximumGain((SND_ObjectHandle)sound->snd_sound, sound->max_gain);
- }
- else
- {
- SND_SetRollOffFactor((SND_ObjectHandle)sound->snd_sound, 0);
- SND_SetReferenceDistance((SND_ObjectHandle)sound->snd_sound, 1);
- SND_SetMinimumGain((SND_ObjectHandle)sound->snd_sound, 1);
- SND_SetMaximumGain((SND_ObjectHandle)sound->snd_sound, 1);
- }
-
- if (G.f & G_DEBUG) printf("Set pitch to: %f\n", SND_GetPitch((SND_ObjectHandle)sound->snd_sound));
- if (G.f & G_DEBUG) printf("Set gain to: %f\n", SND_GetGain((SND_ObjectHandle)sound->snd_sound));
- if (G.f & G_DEBUG) printf("Set looping to: %d\n", SND_GetLoopMode((SND_ObjectHandle)sound->snd_sound));
-
- /* play the sound */
- SND_StartSound(ghSoundScene, (SND_ObjectHandle)sound->snd_sound);
-
- /* update the device */
- SND_Proceed(ghAudioDeviceInterface, ghSoundScene);
- }
- }
- else
- {
- if (G.f & G_DEBUG)
- {
- printf("uninitialized sound !\n");
- if (sound)
- {
- printf("sound: %p\n", sound);
- if (sound->sample)
- {
- printf("sample: %p\n", sound->sample);
- if (sound->snd_sound)
- printf("hSoundObject: %p\n", sound->snd_sound);
- }
- }
- else
- {
- printf("sound == NULL\n");
- }
- }
- }
-#endif
-}
-
-
-
-bSound *sound_find_sound(char *id_name)
-{
- bSound *sound;
-
- // look for sound with same *id* name
- sound = G.main->sound.first;
- while (sound)
- {
- if (strcmp(sound->id.name + 2, id_name) == 0)
- break;
-
- sound = sound->id.next;
- }
-
- return sound;
-}
-
-void sound_init_audio(void)
-{
- int noaudio;
- SYS_SystemHandle hSystem = NULL;
-
- if(ghSoundScene==NULL) {
- hSystem = SYS_GetSystem();
- noaudio = SYS_GetCommandLineInt(hSystem,"noaudio",0);
-
- if (noaudio)/*(noaudio) intrr: disable game engine audio (openal) */
- SND_SetDeviceType(snd_e_dummydevice);
-
- ghAudioDeviceInterface = SND_GetAudioDevice();
- ghSoundScene = SND_CreateScene(ghAudioDeviceInterface);
- // also called after read new file, but doesnt work when no audio initialized
- sound_initialize_sounds();
- }
-}
-
-
-int sound_get_mixrate(void)
-{
- return MIXRATE;
-}
-
-
-void sound_exit_audio(void)
-{
- if(ghSoundScene) {
- SND_DeleteScene(ghSoundScene);
- SND_ReleaseDevice();
- ghSoundScene = NULL;
- }
-}
diff --git a/source/blender/src/edittime.c b/source/blender/src/edittime.c
deleted file mode 100644
index f5c6fe5a95e..00000000000
--- a/source/blender/src/edittime.c
+++ /dev/null
@@ -1,1008 +0,0 @@
-/**
- * $Id: BIF_edittime.c
- *
- * ***** 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <string.h>
-#include <math.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "DNA_action_types.h"
-#include "DNA_ipo_types.h"
-#include "DNA_object_types.h"
-#include "DNA_material_types.h"
-#include "DNA_space_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_userdef_types.h"
-
-#include "BKE_ipo.h"
-#include "BKE_utildefines.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_material.h"
-#include "BKE_library.h"
-
-#include "BIF_space.h"
-#include "BIF_screen.h"
-#include "BIF_interface.h"
-#include "BIF_toolbox.h"
-#include "BIF_mywindow.h"
-#include "BIF_editaction.h"
-
-#include "BSE_drawipo.h"
-#include "BSE_edit.h"
-#include "BSE_headerbuttons.h"
-#include "BSE_time.h"
-
-#include "BDR_editobject.h"
-
-#include "blendef.h"
-
-#include "mydevice.h"
-
-#include "PIL_time.h"
-
-/* declarations */
-void winqreadtimespace(ScrArea *, void *, BWinEvent *);
-
-/* ************* Marker API **************** */
-
-/* add TimeMarker at curent frame */
-void add_marker(int frame)
-{
- TimeMarker *marker;
-
- /* two markers can't be at the same place */
- for(marker= G.scene->markers.first; marker; marker= marker->next)
- if(marker->frame == frame) return;
- /* deselect all */
- for(marker= G.scene->markers.first; marker; marker= marker->next)
- marker->flag &= ~SELECT;
-
- marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
- marker->flag= SELECT;
- marker->frame= frame;
- BLI_addtail(&(G.scene->markers), marker);
-
- BIF_undo_push("Add Marker");
-}
-
-
-
-/* remove selected TimeMarkers */
-void remove_marker(void)
-{
- TimeMarker *marker, *nmarker;
- short changed= 0;
-
- for(marker= G.scene->markers.first; marker; marker= nmarker) {
- nmarker= marker->next;
- if(marker->flag & SELECT) {
- BLI_freelinkN(&(G.scene->markers), marker);
- changed= 1;
- }
- }
-
- if (changed)
- BIF_undo_push("Remove Marker");
-}
-
-/* rename first selected TimeMarker */
-void rename_marker(void)
-{
- TimeMarker *marker;
- char name[64];
-
- for(marker= G.scene->markers.first; marker; marker= marker->next) {
- if(marker->flag & SELECT) {
- strcpy(name, marker->name);
- if (sbutton(name, 0, sizeof(name)-1, "Name: "))
- BLI_strncpy(marker->name, name, sizeof(marker->name));
- break;
- }
- }
-
-// BIF_undo_push("Rename Marker");
-}
-
-/* duplicate selected TimeMarkers */
-void duplicate_marker(void)
-{
- TimeMarker *marker, *newmarker;
-
- /* go through the list of markers, duplicate selected markers and add duplicated copies
- * to the begining of the list (unselect original markers) */
- for(marker= G.scene->markers.first; marker; marker= marker->next) {
- if(marker->flag & SELECT){
- /* unselect selected marker */
- marker->flag &= ~SELECT;
- /* create and set up new marker */
- newmarker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
- newmarker->flag= SELECT;
- newmarker->frame= marker->frame;
- BLI_strncpy(newmarker->name, marker->name, sizeof(marker->name));
- /* new marker is added to the begining of list */
- BLI_addhead(&(G.scene->markers), newmarker);
- }
- }
-
- transform_markers('g', 0);
-}
-
-void transform_markers(int mode, int smode) // mode and smode unused here, for callback
-{
- SpaceLink *slink= curarea->spacedata.first;
- SpaceTime *stime= curarea->spacedata.first;
- SpaceAction *saction = curarea->spacedata.first;
- TimeMarker *marker, *selmarker=NULL;
- float dx, fac;
- int a, ret_val= 0, totmark=0, *oldframe, offs, firsttime=1;
- unsigned short event;
- short val, pmval[2], mval[2], mvalo[2];
- char str[32];
-
- for(marker= G.scene->markers.first; marker; marker= marker->next) {
- if(marker->flag & SELECT) totmark++;
- }
- if(totmark==0) return;
-
- oldframe= MEM_mallocN(totmark*sizeof(int), "marker array");
- for(a=0, marker= G.scene->markers.first; marker; marker= marker->next) {
- if(marker->flag & SELECT) {
- oldframe[a]= marker->frame;
- selmarker= marker; // used for hederprint
- a++;
- }
- }
-
- dx= G.v2d->mask.xmax-G.v2d->mask.xmin;
- dx= (G.v2d->cur.xmax-G.v2d->cur.xmin)/dx;
-
- getmouseco_areawin(pmval);
- mvalo[0]= pmval[0];
-
- while(ret_val == 0) {
-
- getmouseco_areawin(mval);
-
- if (mval[0] != mvalo[0] || firsttime) {
- mvalo[0]= mval[0];
- firsttime= 0;
-
- fac= (((float)(mval[0] - pmval[0]))*dx);
-
- if (ELEM(slink->spacetype, SPACE_TIME, SPACE_SOUND))
- apply_keyb_grid(&fac, 0.0, FPS, 0.1*FPS, 0);
- else
- apply_keyb_grid(&fac, 0.0, 1.0, 0.1, U.flag & USER_AUTOGRABGRID);
- offs= (int)fac;
-
- for(a=0, marker= G.scene->markers.first; marker; marker= marker->next) {
- if(marker->flag & SELECT) {
- marker->frame= oldframe[a] + offs;
- a++;
- }
- }
-
- if(totmark==1) { // we print current marker value
- if (ELEM(slink->spacetype, SPACE_TIME, SPACE_SOUND)) {
- if (stime->flag & TIME_DRAWFRAMES)
- sprintf(str, "Marker %d offset %d", selmarker->frame, offs);
- else
- sprintf(str, "Marker %.2f offset %.2f", FRA2TIME(selmarker->frame), FRA2TIME(offs));
- }
- else if (slink->spacetype == SPACE_ACTION) {
- if (saction->flag & SACTION_DRAWTIME)
- sprintf(str, "Marker %.2f offset %.2f", FRA2TIME(selmarker->frame), FRA2TIME(offs));
- else
- sprintf(str, "Marker %.2f offset %.2f", (double)(selmarker->frame), (double)(offs));
- }
- else {
- sprintf(str, "Marker %.2f offset %.2f", (double)(selmarker->frame), (double)(offs));
- }
- }
- else {
- if (ELEM(slink->spacetype, SPACE_TIME, SPACE_SOUND)) {
- if (stime->flag & TIME_DRAWFRAMES)
- sprintf(str, "Marker offset %d ", offs);
- else
- sprintf(str, "Marker offset %.2f ", FRA2TIME(offs));
- }
- else if (slink->spacetype == SPACE_ACTION) {
- if (saction->flag & SACTION_DRAWTIME)
- sprintf(str, "Marker offset %.2f ", FRA2TIME(offs));
- else
- sprintf(str, "Marker offset %.2f ", (double)(offs));
- }
- else {
- sprintf(str, "Marker offset %.2f ", (double)(offs));
- }
- }
- headerprint(str);
-
- force_draw(0); // areas identical to this, 0 = no header
- }
- else PIL_sleep_ms(10); // idle
-
- /* emptying queue and reading events */
- while( qtest() ) {
- event= extern_qread(&val);
-
- if(val) {
- if(event==ESCKEY || event==RIGHTMOUSE) ret_val= 2;
- else if(event==LEFTMOUSE || event==RETKEY || event==SPACEKEY) ret_val= 1;
- }
- }
- }
-
- /* restore? */
- if(ret_val==2) {
- for(a=0, marker= G.scene->markers.first; marker; marker= marker->next) {
- if(marker->flag & SELECT) {
- marker->frame= oldframe[a];
- a++;
- }
- }
- }
- else {
- BIF_undo_push("Move Markers");
- }
- MEM_freeN(oldframe);
- allqueue(REDRAWMARKER, 0);
-}
-
-/* select/deselect all TimeMarkers
- * test - based on current selections?
- * sel - selection status to set all markers to if blanket apply status
- */
-void deselect_markers(short test, short sel)
-{
- TimeMarker *marker;
-
- /* check if need to find out whether to how to select markers */
- if (test) {
- /* dependant on existing selection */
- /* determine if select all or deselect all */
- sel = 1;
- for (marker= G.scene->markers.first; marker; marker= marker->next) {
- if (marker->flag & SELECT) {
- sel = 0;
- break;
- }
- }
-
- /* do selection */
- for (marker= G.scene->markers.first; marker; marker= marker->next) {
- if (sel == 2) {
- marker->flag ^= SELECT;
- }
- else if (sel == 1) {
- if ((marker->flag & SELECT)==0)
- marker->flag |= SELECT;
- }
- else {
- if (marker->flag & SELECT)
- marker->flag &= ~SELECT;
- }
- }
- }
- else {
- /* not dependant on existing selection */
- for (marker= G.scene->markers.first; marker; marker= marker->next) {
- if (sel==2) {
- marker->flag ^= SELECT;
- }
- else if (sel==1) {
- if ((marker->flag & SELECT)==0)
- marker->flag |= SELECT;
- }
- else {
- if (marker->flag & SELECT)
- marker->flag &= ~SELECT;
- }
- }
- }
-}
-
-static void borderselect_markers_func(float xmin, float xmax, int selectmode)
-{
- TimeMarker *marker;
-
- for(marker= G.scene->markers.first; marker; marker= marker->next) {
- if ((marker->frame > xmin) && (marker->frame <= xmax)) {
- switch (selectmode) {
- case SELECT_ADD:
- if ((marker->flag & SELECT) == 0)
- marker->flag |= SELECT;
- break;
- case SELECT_SUBTRACT:
- if (marker->flag & SELECT)
- marker->flag &= ~SELECT;
- break;
- }
- }
- }
-}
-
-/* border-select markers */
-void borderselect_markers(void)
-{
- rcti rect;
- rctf rectf;
- int val, selectmode;
- short mval[2];
-
- if ( (val = get_border(&rect, 3)) ){
- if (val == LEFTMOUSE)
- selectmode = SELECT_ADD;
- else
- selectmode = SELECT_SUBTRACT;
-
- mval[0]= rect.xmin;
- mval[1]= rect.ymin+2;
- areamouseco_to_ipoco(G.v2d, mval, &rectf.xmin, &rectf.ymin);
- mval[0]= rect.xmax;
- mval[1]= rect.ymax-2;
- areamouseco_to_ipoco(G.v2d, mval, &rectf.xmax, &rectf.ymax);
-
- /* do markers */
- borderselect_markers_func(rectf.xmin, rectf.xmax, selectmode);
-
- BIF_undo_push("Border Select Markers");
- allqueue(REDRAWMARKER, 0);
- }
-}
-
-void nextprev_marker(short dir)
-{
- TimeMarker *marker, *cur=NULL, *first, *last;
- int mindist= MAXFRAME, dist;
-
- first= last= G.scene->markers.first;
- for(marker= G.scene->markers.first; marker; marker= marker->next) {
- /* find closest to current frame first */
- dist= (marker->frame/G.scene->r.framelen) - CFRA;
- if(dir==1 && dist>0 && dist<mindist) {
- mindist= dist;
- cur= marker;
- }
- else if(dir==-1 && dist<0 && -dist<mindist) {
- mindist= -dist;
- cur= marker;
- }
- /* find first/last */
- if(marker->frame > last->frame) last= marker;
- if(marker->frame < first->frame) first= marker;
- }
-
- if(cur==NULL) {
- if(dir==1) cur= first;
- else cur= last;
- }
- if(cur) {
- CFRA= cur->frame/G.scene->r.framelen;
- update_for_newframe();
- allqueue(REDRAWALL, 0);
- }
-}
-
-void get_minmax_markers(short sel, float *first, float *last)
-{
- TimeMarker *marker;
- ListBase *markers;
- float min, max;
- int selcount = 0;
-
- markers= &(G.scene->markers);
-
- if (sel)
- for (marker= markers->first; marker; marker= marker->next) {
- if (marker->flag & SELECT)
- selcount++;
- }
- else {
- selcount= BLI_countlist(markers);
- }
-
- if (markers->first && markers->last) {
- min= ((TimeMarker *)markers->first)->frame;
- max= ((TimeMarker *)markers->last)->frame;
- }
- else {
- *first = 0.0f;
- *last = 0.0f;
- return;
- }
-
- if (selcount > 1) {
- for (marker= markers->first; marker; marker= marker->next) {
- if (sel) {
- if (marker->flag & SELECT) {
- if (marker->frame < min)
- min= marker->frame;
- else if (marker->frame > max)
- max= marker->frame;
- }
- }
- else {
- if (marker->frame < min)
- min= marker->frame;
- else if (marker->frame > max)
- max= marker->frame;
- }
- }
- }
-
- *first= min;
- *last= max;
-}
-
-TimeMarker *find_nearest_marker(int clip_y)
-{
- TimeMarker *marker;
- float xmin, xmax;
- rctf rectf;
- short mval[2];
-
- getmouseco_areawin (mval);
-
- /* first clip selection in Y */
- if((clip_y) && (mval[1] > 30))
- return NULL;
-
- mval[0]-=7;
- areamouseco_to_ipoco(G.v2d, mval, &rectf.xmin, &rectf.ymin);
- mval[0]+=14;
- areamouseco_to_ipoco(G.v2d, mval, &rectf.xmax, &rectf.ymax);
-
- xmin= rectf.xmin;
- xmax= rectf.xmax;
-
- for(marker= G.scene->markers.first; marker; marker= marker->next) {
- if ((marker->frame > xmin) && (marker->frame <= xmax)) {
- return marker;
- }
- }
-
- return NULL;
-}
-
-/* Adds a marker to list of cfra elems */
-void add_marker_to_cfra_elem(ListBase *lb, TimeMarker *marker, short only_sel)
-{
- CfraElem *ce, *cen;
-
- /* should this one only be considered if it is selected? */
- if ((only_sel) && ((marker->flag & SELECT)==0))
- return;
-
- /* try to find a previous cfra elem */
- ce= lb->first;
- while(ce) {
-
- if( ce->cfra==marker->frame ) {
- /* do because of double keys */
- if(marker->flag & SELECT) ce->sel= marker->flag;
- return;
- }
- else if(ce->cfra > marker->frame) break;
-
- ce= ce->next;
- }
-
- cen= MEM_callocN(sizeof(CfraElem), "add_to_cfra_elem");
- if(ce) BLI_insertlinkbefore(lb, ce, cen);
- else BLI_addtail(lb, cen);
-
- cen->cfra= marker->frame;
- cen->sel= marker->flag;
-}
-
-/* This function makes a list of all the markers. The only_sel
- * argument is used to specify whether only the selected markers
- * are added.
- */
-void make_marker_cfra_list(ListBase *lb, short only_sel)
-{
- TimeMarker *marker;
-
- for (marker= G.scene->markers.first; marker; marker= marker->next) {
- add_marker_to_cfra_elem(lb, marker, only_sel);
- }
-}
-
-int find_nearest_marker_time(float dx)
-{
- TimeMarker *marker, *nearest= NULL;
- float dist, min_dist= 1000000;
-
- for(marker= G.scene->markers.first; marker; marker= marker->next) {
- dist = ABS((float)marker->frame - dx);
- if(dist < min_dist){
- min_dist= dist;
- nearest= marker;
- }
- }
-
- if(nearest) return nearest->frame;
- else return (int)floor(dx);
-}
-
-/* *********** End Markers - Markers API *************** */
-/* select/deselect TimeMarker at current frame */
-static void select_timeline_marker_frame(int frame, unsigned char shift)
-{
- TimeMarker *marker;
- int select=0;
-
- for(marker= G.scene->markers.first; marker; marker= marker->next) {
- /* if Shift is not set, then deselect Markers */
- if(!shift) marker->flag &= ~SELECT;
- /* this way a not-shift select will allways give 1 selected marker */
- if((marker->frame == frame) && (!select)) {
- if(marker->flag & SELECT)
- marker->flag &= ~SELECT;
- else
- marker->flag |= SELECT;
- select = 1;
- }
- }
-}
-
-/* *********** end Markers - TimeLine *************** */
-
-/* set the animation preview range of scene */
-void anim_previewrange_set()
-{
- extern float get_action_frame(Object *ob, float cframe);
- rcti rect;
- rctf rectf;
- short val, mval[2];
-
- /* set range by drawing border-select rectangle */
- if ( (val = get_border(&rect, 5)) ) {
- /* get frame numbers */
- mval[0]= rect.xmin;
- mval[1]= rect.ymin+2;
- areamouseco_to_ipoco(G.v2d, mval, &rectf.xmin, &rectf.ymin);
- mval[0]= rect.xmax;
- mval[1]= rect.ymax-2;
- areamouseco_to_ipoco(G.v2d, mval, &rectf.xmax, &rectf.ymax);
-
- /* set preview-range */
- if (rectf.xmin < 1) rectf.xmin = 1.0f;
- if (rectf.xmax < 1) rectf.xmax = 1.0f;
- G.scene->r.psfra= rectf.xmin;
- G.scene->r.pefra= rectf.xmax;
-
- BIF_undo_push("Set anim-preview range");
- allqueue(REDRAWTIME, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWBUTSALL, 0);
- }
-}
-
-/* clear the animation preview range for scene */
-void anim_previewrange_clear()
-{
- G.scene->r.psfra = 0;
- G.scene->r.pefra = 0;
-
- BIF_undo_push("Clear anim-preview range");
- allqueue(REDRAWTIME, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWBUTSALL, 0);
-}
-
-/* ************ end Animation Preview Range ********** */
-
-
-static int float_to_frame(float frame)
-{
- int to= (int) floor(0.5 + frame/G.scene->r.framelen );
-
- return to;
-}
-
-static float find_closest_cfra_elem(ListBase elems, int dir, float closest)
-{
- CfraElem *ce;
-
- for(ce= elems.first; ce; ce= ce->next) {
- if (dir==-1) {
- if( float_to_frame(ce->cfra)<CFRA) {
- if ((ce->cfra > closest) || (closest == CFRA)) {
- closest= ce->cfra;
- }
- }
- }
- else {
- if(float_to_frame(ce->cfra)>CFRA) {
- if ((ce->cfra < closest) || (closest == CFRA)) {
- closest= ce->cfra;
- }
- }
- }
- }
- return closest;
-}
-
-void nextprev_timeline_key(short dir)
-{
- /*mostly copied from drawobject.c, draw_object() AND editipo.c, movekey_obipo() */
- Object *ob;
- bActionChannel *achan;
- bAction *act;
- ListBase elems;
- float closest= CFRA;
- int a;
-
- if (OBACT) {
- ob = OBACT;
-
- if(ob) {
- if(ob!=G.obedit) {
- if(ob->ipo) {
- /* convert the ipo to a list of 'current frame elements' */
-
- elems.first= elems.last= NULL;
- make_cfra_list(ob->ipo, &elems);
-
- closest= find_closest_cfra_elem(elems, dir, closest);
-
- BLI_freelistN(&elems);
- }
-
- if(ob->action) {
- act = ob->action;
- /* go through each channel in the action */
- for (achan=act->chanbase.first; achan; achan=achan->next){
- /* convert the ipo to a list of 'current frame elements' */
-
- if(achan->ipo) {
- elems.first= elems.last= NULL;
- make_cfra_list(achan->ipo, &elems);
-
- closest= find_closest_cfra_elem(elems, dir, closest);
-
- BLI_freelistN(&elems);
- }
- }
- }
-
- for(a=0; a<ob->totcol; a++) {
- Material *ma= give_current_material(ob, a+1);
- if(ma && ma->ipo) {
- elems.first= elems.last= NULL;
- make_cfra_list(ma->ipo, &elems);
-
- closest= find_closest_cfra_elem(elems, dir, closest);
-
- BLI_freelistN(&elems);
- }
- }
- }
- }
-
- a= float_to_frame(closest);
-
- if (a!=CFRA) {
- CFRA= a;
- update_for_newframe();
- }
-
- BIF_undo_push("Next/Prev Key");
- allqueue(REDRAWALL, 0);
- }
-}
-
-/* return the current marker for this frame,
-we can have more then 1 marker per frame, this just returns the first :/ */
-TimeMarker *get_frame_marker(int frame)
-{
- TimeMarker *marker, *best_marker = NULL;
- int best_frame = -MAXFRAME*2;
- for (marker= G.scene->markers.first; marker; marker= marker->next) {
- if (marker->frame==frame) {
- return marker;
- }
-
- if ( marker->frame > best_frame && marker->frame < frame) {
- best_marker = marker;
- best_frame = marker->frame;
- }
- }
-
- return best_marker;
-}
-
-
-void timeline_frame_to_center(void)
-{
- float dtime;
-
- dtime= CFRA*(G.scene->r.framelen) - (G.v2d->cur.xmin + G.v2d->cur.xmax)/2.0;
- G.v2d->cur.xmin += dtime;
- G.v2d->cur.xmax += dtime;
- scrarea_queue_winredraw(curarea);
-}
-
-/* copy of this is actually in editscreen.c, but event based */
-static void timeline_force_draw(short val)
-{
- ScrArea *sa, *tempsa, *samin= NULL;
- int dodraw;
-
- if(val & TIME_LEFTMOST_3D_WIN) {
- ScrArea *sa= G.curscreen->areabase.first;
- int min= 10000;
- for(; sa; sa= sa->next) {
- if(sa->spacetype==SPACE_VIEW3D) {
- if(sa->winrct.xmin - sa->winrct.ymin < min) {
- samin= sa;
- min= sa->winrct.xmin - sa->winrct.ymin;
- }
- }
- }
- }
-
- tempsa= curarea;
- sa= G.curscreen->areabase.first;
- while(sa) {
- dodraw= 0;
- if(sa->spacetype==SPACE_VIEW3D) {
- if(sa==samin || (val & TIME_ALL_3D_WIN)) dodraw= 1;
- }
- else if(ELEM6(sa->spacetype, SPACE_NLA, SPACE_IPO, SPACE_SEQ, SPACE_BUTS, SPACE_ACTION, SPACE_SOUND)) {
- if(val & TIME_ALL_ANIM_WIN) dodraw= 1;
- }
- else if(sa->spacetype==SPACE_BUTS) {
- if(val & TIME_ALL_BUTS_WIN) dodraw= 1;
- }
- else if(sa->spacetype==SPACE_IMAGE) {
- if (val & TIME_ALL_IMAGE_WIN) dodraw = 1;
- }
- else if(sa->spacetype==SPACE_SEQ) {
- if (val & TIME_SEQ) dodraw = 1;
- }
- else if(sa->spacetype==SPACE_TIME) dodraw= 2;
-
- if(dodraw) {
- areawinset(sa->win);
- scrarea_do_windraw(sa);
- if(dodraw==2) scrarea_do_headdraw(sa);
- }
- sa= sa->next;
- }
- areawinset(tempsa->win);
-
- screen_swapbuffers();
-
-}
-
-/* ***************************** */
-
-/* Right. Now for some implementation: */
-void winqreadtimespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
-{
- SpaceTime *stime= spacedata;
- unsigned short event= evt->event;
- short val= evt->val;
- float dx, dy;
- int doredraw= 0, cfra, first = 0;
- short mval[2], nr;
- short mousebut = L_MOUSE;
-
- if(sa->win==0) return;
-
- if(val) {
-
- if( uiDoBlocks(&sa->uiblocks, event, 1)!=UI_NOTHING ) event= 0;
-
- /* swap mouse buttons based on user preference */
- if (U.flag & USER_LMOUSESELECT) {
- if (event == LEFTMOUSE) {
- event = RIGHTMOUSE;
- mousebut = L_MOUSE;
- } else if (event == RIGHTMOUSE) {
- event = LEFTMOUSE;
- mousebut = R_MOUSE;
- }
- }
-
- switch(event) {
- case LEFTMOUSE:
- stime->flag |= TIME_CFRA_NUM;
- do {
- getmouseco_areawin(mval);
- areamouseco_to_ipoco(G.v2d, mval, &dx, &dy);
-
- cfra = (int)dx;
- if(cfra< MINFRAME) cfra= MINFRAME;
-
- if( cfra!=CFRA || first )
- {
- first= 0;
- CFRA= cfra;
- update_for_newframe_nodraw(0); // 1= nosound
- timeline_force_draw(stime->redraws);
- }
- else PIL_sleep_ms(30);
-
- } while(get_mbut() & mousebut);
-
- stime->flag &= ~TIME_CFRA_NUM;
- allqueue(REDRAWALL, 0);
- break;
-
- case RIGHTMOUSE: /* select/deselect marker */
- getmouseco_areawin(mval);
- areamouseco_to_ipoco(G.v2d, mval, &dx, &dy);
-
- cfra= find_nearest_marker_time(dx);
-
- if (G.qual && LR_SHIFTKEY)
- select_timeline_marker_frame(cfra, 1);
- else
- select_timeline_marker_frame(cfra, 0);
-
- force_draw(0);
- std_rmouse_transform(transform_markers);
-
- break;
- case MIDDLEMOUSE:
- case WHEELUPMOUSE:
- case WHEELDOWNMOUSE:
- view2dmove(event); /* in drawipo.c */
- break;
- case PADPLUSKEY:
- dx= (float)(0.1154*(G.v2d->cur.xmax-G.v2d->cur.xmin));
- G.v2d->cur.xmin+= dx;
- G.v2d->cur.xmax-= dx;
- test_view2d(G.v2d, sa->winx, sa->winy);
- view2d_do_locks(curarea, V2D_LOCK_COPY);
- doredraw= 1;
- break;
- case PADMINUS:
- dx= (float)(0.15*(G.v2d->cur.xmax-G.v2d->cur.xmin));
- G.v2d->cur.xmin-= dx;
- G.v2d->cur.xmax+= dx;
- test_view2d(G.v2d, sa->winx, sa->winy);
- view2d_do_locks(curarea, V2D_LOCK_COPY);
- doredraw= 1;
- break;
- case HOMEKEY:
- first= G.scene->r.sfra;
- if(first >= G.scene->r.efra) first= G.scene->r.efra;
- G.v2d->cur.xmin=G.v2d->tot.xmin= (float)first-2;
- G.v2d->cur.xmax=G.v2d->tot.xmax= (float)G.scene->r.efra+2;
- doredraw= 1;
- break;
-
- case PAGEUPKEY: /* next keyframe */
- if(G.qual==LR_CTRLKEY)
- nextprev_timeline_key(1);
- else
- nextprev_marker(1);
- break;
- case PAGEDOWNKEY: /* prev keyframe */
- if(G.qual==LR_CTRLKEY)
- nextprev_timeline_key(-1);
- else
- nextprev_marker(-1);
- break;
-
- case AKEY:
- /* deselect all TimeMarkers */
- deselect_markers(1, 0);
- allqueue(REDRAWMARKER, 0);
- break;
- case BKEY:
- /* borderselect markers */
- borderselect_markers();
- break;
- case DKEY:
- if(G.qual==LR_SHIFTKEY)
- duplicate_marker();
- break;
- case CKEY:
- timeline_frame_to_center();
- break;
- case GKEY: /* move marker */
- transform_markers('g', 0);
- break;
- case EKEY: /* set end frame */
- if (G.scene->r.psfra) {
- if (CFRA < G.scene->r.psfra)
- G.scene->r.psfra= CFRA;
- G.scene->r.pefra= CFRA;
- }
- else
- G.scene->r.efra = CFRA;
- allqueue(REDRAWALL, 1);
- break;
- case MKEY: /* add, rename marker */
- if (G.qual & LR_CTRLKEY)
- rename_marker();
- else
- add_marker(CFRA);
- allqueue(REDRAWMARKER, 0);
- break;
- case PKEY: /* preview-range stuff */
- if (G.qual & LR_CTRLKEY) /* set preview range */
- anim_previewrange_set();
- else if (G.qual & LR_ALTKEY) /* clear preview range */
- anim_previewrange_clear();
- break;
- case SKEY: /* set start frame */
- if (G.scene->r.psfra) {
- if (G.scene->r.pefra < CFRA)
- G.scene->r.pefra= CFRA;
- G.scene->r.psfra= CFRA;
- }
- else
- G.scene->r.sfra = CFRA;
- allqueue(REDRAWALL, 1);
- break;
- case TKEY: /* popup menu */
- nr= pupmenu("Time value%t|Frames %x1|Seconds%x2");
- if (nr>0) {
- if(nr==1) stime->flag |= TIME_DRAWFRAMES;
- else stime->flag &= ~TIME_DRAWFRAMES;
- doredraw= 1;
- }
- break;
- case DELKEY:
- case XKEY:
- if( okee("Erase selected")==0 ) break;
-
- remove_marker();
- allqueue(REDRAWMARKER, 0);
- break;
- }
- }
-
- if(doredraw)
- scrarea_queue_winredraw(sa);
-}
-
-
diff --git a/source/blender/src/editview.c b/source/blender/src/editview.c
deleted file mode 100644
index b3252487fa6..00000000000
--- a/source/blender/src/editview.c
+++ /dev/null
@@ -1,2777 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * cursor/gestures/selecteren
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "MEM_guardedalloc.h"
-
-#include "IMB_imbuf.h"
-#include "PIL_time.h"
-
-#include "DNA_action_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_group_types.h"
-#include "DNA_lattice_types.h"
-#include "DNA_meta_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_ipo_types.h" /* for fly mode recording */
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_editVert.h"
-
-#include "BKE_armature.h"
-#include "BKE_depsgraph.h"
-#include "BKE_global.h"
-#include "BKE_group.h"
-#include "BKE_lattice.h"
-#include "BKE_main.h"
-#include "BKE_mesh.h"
-#include "BKE_object.h" /* fly mode where_is_object to get camera location */
-#include "BKE_particle.h"
-#include "BKE_utildefines.h"
-#include "BKE_customdata.h"
-
-#include "BIF_drawimage.h"
-#include "BIF_butspace.h"
-#include "BIF_editaction.h"
-#include "BIF_editarmature.h"
-#include "BIF_editparticle.h"
-#include "BIF_editgroup.h"
-#include "BIF_editmesh.h"
-#include "BIF_editoops.h"
-#include "BIF_editsima.h"
-#include "BIF_editview.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-#include "BIF_interface.h"
-#include "BIF_mywindow.h"
-#include "BIF_previewrender.h" /* use only so fly mode can preview when its done */
-#include "BIF_space.h"
-#include "BIF_screen.h"
-#include "BIF_toolbox.h"
-
-#include "BDR_editobject.h" /* For headerprint */
-#include "BDR_sculptmode.h"
-#include "BDR_vpaint.h"
-#include "BDR_editface.h"
-#include "BDR_drawobject.h"
-#include "BDR_editcurve.h"
-
-#include "BSE_edit.h"
-#include "BSE_view.h" /* give_cursor() */
-#include "BSE_editipo.h"
-#include "BSE_drawview.h"
-
-#include "editmesh.h" /* borderselect uses it... */
-#include "blendef.h"
-#include "mydevice.h"
-
-#include "BIF_transform.h"
-#include "BIF_toets.h" /* persptoetsen */
-
-extern ListBase editNurb; /* originally from exports.h, memory from editcurve.c*/
-/* editmball.c */
-extern ListBase editelems;
-
-/* fly mode uses this */
-extern void setcameratoview3d(void);
-
-/* local prototypes */
-
-void EM_backbuf_checkAndSelectVerts(EditMesh *em, int select)
-{
- EditVert *eve;
- int index= em_wireoffs;
-
- for(eve= em->verts.first; eve; eve= eve->next, index++) {
- if(eve->h==0) {
- if(EM_check_backbuf(index)) {
- eve->f = select?(eve->f|1):(eve->f&~1);
- }
- }
- }
-}
-
-void EM_backbuf_checkAndSelectEdges(EditMesh *em, int select)
-{
- EditEdge *eed;
- int index= em_solidoffs;
-
- for(eed= em->edges.first; eed; eed= eed->next, index++) {
- if(eed->h==0) {
- if(EM_check_backbuf(index)) {
- EM_select_edge(eed, select);
- }
- }
- }
-}
-
-void EM_backbuf_checkAndSelectFaces(EditMesh *em, int select)
-{
- EditFace *efa;
- int index= 1;
-
- for(efa= em->faces.first; efa; efa= efa->next, index++) {
- if(efa->h==0) {
- if(EM_check_backbuf(index)) {
- EM_select_face_fgon(efa, select);
- }
- }
- }
-}
-
-void EM_backbuf_checkAndSelectTFaces(Mesh *me, int select)
-{
- MFace *mface = me->mface;
- int a;
-
- if (mface) {
- for(a=1; a<=me->totface; a++, mface++) {
- if(EM_check_backbuf(a)) {
- mface->flag = select?(mface->flag|ME_FACE_SEL):(mface->flag&~ME_FACE_SEL);
- }
- }
- }
-}
-
-void arrows_move_cursor(unsigned short event)
-{
- short mval[2];
-
- getmouseco_sc(mval);
-
- if(event==UPARROWKEY) {
- warp_pointer(mval[0], mval[1]+1);
- } else if(event==DOWNARROWKEY) {
- warp_pointer(mval[0], mval[1]-1);
- } else if(event==LEFTARROWKEY) {
- warp_pointer(mval[0]-1, mval[1]);
- } else if(event==RIGHTARROWKEY) {
- warp_pointer(mval[0]+1, mval[1]);
- }
-}
-
-/* simple API for object selection, rather than just using the flag
- * this takes into account the 'restrict selection in 3d view' flag.
- * deselect works always, the restriction just prevents selection */
-void select_base_v3d(Base *base, short mode)
-{
- if (base) {
- if (mode==BA_SELECT) {
- if (!(base->object->restrictflag & OB_RESTRICT_SELECT))
- if (mode==BA_SELECT) base->flag |= SELECT;
- }
- else if (mode==BA_DESELECT) {
- base->flag &= ~SELECT;
- }
- }
-}
-
-/* *********************** GESTURE AND LASSO ******************* */
-
-/* helper also for borderselect */
-static int edge_fully_inside_rect(rcti *rect, short x1, short y1, short x2, short y2)
-{
- return BLI_in_rcti(rect, x1, y1) && BLI_in_rcti(rect, x2, y2);
-}
-
-static int edge_inside_rect(rcti *rect, short x1, short y1, short x2, short y2)
-{
- int d1, d2, d3, d4;
-
- /* check points in rect */
- if(edge_fully_inside_rect(rect, x1, y1, x2, y2)) return 1;
-
- /* check points completely out rect */
- if(x1<rect->xmin && x2<rect->xmin) return 0;
- if(x1>rect->xmax && x2>rect->xmax) return 0;
- if(y1<rect->ymin && y2<rect->ymin) return 0;
- if(y1>rect->ymax && y2>rect->ymax) return 0;
-
- /* simple check lines intersecting. */
- d1= (y1-y2)*(x1- rect->xmin ) + (x2-x1)*(y1- rect->ymin );
- d2= (y1-y2)*(x1- rect->xmin ) + (x2-x1)*(y1- rect->ymax );
- d3= (y1-y2)*(x1- rect->xmax ) + (x2-x1)*(y1- rect->ymax );
- d4= (y1-y2)*(x1- rect->xmax ) + (x2-x1)*(y1- rect->ymin );
-
- if(d1<0 && d2<0 && d3<0 && d4<0) return 0;
- if(d1>0 && d2>0 && d3>0 && d4>0) return 0;
-
- return 1;
-}
-
-
-#define MOVES_GESTURE 50
-#define MOVES_LASSO 500
-
-int lasso_inside(short mcords[][2], short moves, short sx, short sy)
-{
- /* we do the angle rule, define that all added angles should be about zero or 2*PI */
- float angletot=0.0, len, dot, ang, cross, fp1[2], fp2[2];
- int a;
- short *p1, *p2;
-
- if(sx==IS_CLIPPED)
- return 0;
-
- p1= mcords[moves-1];
- p2= mcords[0];
-
- /* first vector */
- fp1[0]= (float)(p1[0]-sx);
- fp1[1]= (float)(p1[1]-sy);
- len= sqrt(fp1[0]*fp1[0] + fp1[1]*fp1[1]);
- fp1[0]/= len;
- fp1[1]/= len;
-
- for(a=0; a<moves; a++) {
- /* second vector */
- fp2[0]= (float)(p2[0]-sx);
- fp2[1]= (float)(p2[1]-sy);
- len= sqrt(fp2[0]*fp2[0] + fp2[1]*fp2[1]);
- fp2[0]/= len;
- fp2[1]/= len;
-
- /* dot and angle and cross */
- dot= fp1[0]*fp2[0] + fp1[1]*fp2[1];
- ang= fabs(saacos(dot));
-
- cross= (float)((p1[1]-p2[1])*(p1[0]-sx) + (p2[0]-p1[0])*(p1[1]-sy));
-
- if(cross<0.0) angletot-= ang;
- else angletot+= ang;
-
- /* circulate */
- fp1[0]= fp2[0]; fp1[1]= fp2[1];
- p1= p2;
- p2= mcords[a+1];
- }
-
- if( fabs(angletot) > 4.0 ) return 1;
- return 0;
-}
-
-/* edge version for lasso select. we assume boundbox check was done */
-static int lasso_inside_edge(short mcords[][2], short moves, int x0, int y0, int x1, int y1)
-{
- short v1[2], v2[2];
- int a;
-
- if(x0==IS_CLIPPED || x1==IS_CLIPPED)
- return 0;
-
- v1[0] = x0, v1[1] = y0;
- v2[0] = x1, v2[1] = y1;
-
- /* check points in lasso */
- if(lasso_inside(mcords, moves, v1[0], v1[1])) return 1;
- if(lasso_inside(mcords, moves, v2[0], v2[1])) return 1;
-
- /* no points in lasso, so we have to intersect with lasso edge */
-
- if( IsectLL2Ds(mcords[0], mcords[moves-1], v1, v2) > 0) return 1;
- for(a=0; a<moves-1; a++) {
- if( IsectLL2Ds(mcords[a], mcords[a+1], v1, v2) > 0) return 1;
- }
-
- return 0;
-}
-
-
-/* warning; lasso select with backbuffer-check draws in backbuf with persp(PERSP_WIN)
- and returns with persp(PERSP_VIEW). After lasso select backbuf is not OK
-*/
-static void do_lasso_select_pose(Object *ob, short mcords[][2], short moves, short select)
-{
- bPoseChannel *pchan;
- float vec[3];
- short sco1[2], sco2[2];
-
- if(ob->type!=OB_ARMATURE || ob->pose==NULL) return;
-
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- VECCOPY(vec, pchan->pose_head);
- Mat4MulVecfl(ob->obmat, vec);
- project_short(vec, sco1);
- VECCOPY(vec, pchan->pose_tail);
- Mat4MulVecfl(ob->obmat, vec);
- project_short(vec, sco2);
-
- if(lasso_inside_edge(mcords, moves, sco1[0], sco1[1], sco2[0], sco2[1])) {
- if(select) pchan->bone->flag |= BONE_SELECTED;
- else pchan->bone->flag &= ~(BONE_ACTIVE|BONE_SELECTED);
- }
- }
-}
-
-
-static void do_lasso_select_objects(short mcords[][2], short moves, short select)
-{
- Base *base;
-
- for(base= G.scene->base.first; base; base= base->next) {
- if(base->lay & G.vd->lay) {
- project_short(base->object->obmat[3], &base->sx);
- if(lasso_inside(mcords, moves, base->sx, base->sy)) {
-
- if(select) select_base_v3d(base, BA_SELECT);
- else select_base_v3d(base, BA_DESELECT);
- base->object->flag= base->flag;
- }
- if(base->object->flag & OB_POSEMODE) {
- do_lasso_select_pose(base->object, mcords, moves, select);
- }
- }
- }
-}
-
-static void lasso_select_boundbox(rcti *rect, short mcords[][2], short moves)
-{
- short a;
-
- rect->xmin= rect->xmax= mcords[0][0];
- rect->ymin= rect->ymax= mcords[0][1];
-
- for(a=1; a<moves; a++) {
- if(mcords[a][0]<rect->xmin) rect->xmin= mcords[a][0];
- else if(mcords[a][0]>rect->xmax) rect->xmax= mcords[a][0];
- if(mcords[a][1]<rect->ymin) rect->ymin= mcords[a][1];
- else if(mcords[a][1]>rect->ymax) rect->ymax= mcords[a][1];
- }
-}
-
-static void do_lasso_select_mesh__doSelectVert(void *userData, EditVert *eve, int x, int y, int index)
-{
- struct { rcti *rect; short (*mcords)[2], moves, select, pass, done; } *data = userData;
-
- if (BLI_in_rcti(data->rect, x, y) && lasso_inside(data->mcords, data->moves, x, y)) {
- eve->f = data->select?(eve->f|1):(eve->f&~1);
- }
-}
-static void do_lasso_select_mesh__doSelectEdge(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index)
-{
- struct { rcti *rect; short (*mcords)[2], moves, select, pass, done; } *data = userData;
-
- if (EM_check_backbuf(em_solidoffs+index)) {
- if (data->pass==0) {
- if ( edge_fully_inside_rect(data->rect, x0, y0, x1, y1) &&
- lasso_inside(data->mcords, data->moves, x0, y0) &&
- lasso_inside(data->mcords, data->moves, x1, y1)) {
- EM_select_edge(eed, data->select);
- data->done = 1;
- }
- } else {
- if (lasso_inside_edge(data->mcords, data->moves, x0, y0, x1, y1)) {
- EM_select_edge(eed, data->select);
- }
- }
- }
-}
-static void do_lasso_select_mesh__doSelectFace(void *userData, EditFace *efa, int x, int y, int index)
-{
- struct { rcti *rect; short (*mcords)[2], moves, select, pass, done; } *data = userData;
-
- if (BLI_in_rcti(data->rect, x, y) && lasso_inside(data->mcords, data->moves, x, y)) {
- EM_select_face_fgon(efa, data->select);
- }
-}
-
-static void do_lasso_select_mesh(short mcords[][2], short moves, short select)
-{
- struct { rcti *rect; short (*mcords)[2], moves, select, pass, done; } data;
- EditMesh *em = G.editMesh;
- rcti rect;
- int bbsel;
-
- lasso_select_boundbox(&rect, mcords, moves);
-
- data.rect = &rect;
- data.mcords = mcords;
- data.moves = moves;
- data.select = select;
- data.done = 0;
- data.pass = 0;
-
- bbsel= EM_mask_init_backbuf_border(mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
-
- if(G.scene->selectmode & SCE_SELECT_VERTEX) {
- if (bbsel) {
- EM_backbuf_checkAndSelectVerts(em, select);
- } else {
- mesh_foreachScreenVert(do_lasso_select_mesh__doSelectVert, &data, 1);
- }
- }
- if(G.scene->selectmode & SCE_SELECT_EDGE) {
- /* Does both bbsel and non-bbsel versions (need screen cos for both) */
-
- data.pass = 0;
- mesh_foreachScreenEdge(do_lasso_select_mesh__doSelectEdge, &data, 0);
-
- if (data.done==0) {
- data.pass = 1;
- mesh_foreachScreenEdge(do_lasso_select_mesh__doSelectEdge, &data, 0);
- }
- }
-
- if(G.scene->selectmode & SCE_SELECT_FACE) {
- if (bbsel) {
- EM_backbuf_checkAndSelectFaces(em, select);
- } else {
- mesh_foreachScreenFace(do_lasso_select_mesh__doSelectFace, &data);
- }
- }
-
- EM_free_backbuf();
- EM_selectmode_flush();
-}
-
-/* this is an exception in that its the only lasso that dosnt use the 3d view (uses space image view) */
-static void do_lasso_select_mesh_uv(short mcords[][2], short moves, short select)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
- MTFace *tf;
- int screenUV[2], nverts, i, ok = 1;
- rcti rect;
-
- lasso_select_boundbox(&rect, mcords, moves);
-
- if (draw_uvs_face_check()) { /* Face Center Sel */
- float cent[2];
- ok = 0;
- for (efa= em->faces.first; efa; efa= efa->next) {
- /* assume not touched */
- efa->tmp.l = 0;
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if ((select) != (simaFaceSel_Check(efa, tf))) {
- tface_center(tf, cent, (void *)efa->v4);
- uvco_to_areaco_noclip(cent, screenUV);
- if (BLI_in_rcti(&rect, screenUV[0], screenUV[1]) && lasso_inside(mcords, moves, screenUV[0], screenUV[1])) {
- efa->tmp.l = ok = 1;
- }
- }
- }
- /* (de)selects all tagged faces and deals with sticky modes */
- if (ok)
- uvface_setsel__internal(select);
-
- } else { /* Vert Sel*/
- for (efa= em->faces.first; efa; efa= efa->next) {
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tf)) {
- nverts= efa->v4? 4: 3;
- for(i=0; i<nverts; i++) {
- if ((select) != (simaUVSel_Check(efa, tf, i))) {
- uvco_to_areaco_noclip(tf->uv[i], screenUV);
- if (BLI_in_rcti(&rect, screenUV[0], screenUV[1]) && lasso_inside(mcords, moves, screenUV[0], screenUV[1])) {
- if (select) {
- simaUVSel_Set(efa, tf, i);
- } else {
- simaUVSel_UnSet(efa, tf, i);
- }
- }
- }
- }
- }
- }
- }
- if (ok && G.sima->flag & SI_SYNC_UVSEL) {
- if (select) EM_select_flush();
- else EM_deselect_flush();
- }
-}
-
-static void do_lasso_select_curve__doSelect(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y)
-{
- struct { short (*mcords)[2]; short moves; short select; } *data = userData;
-
- if (lasso_inside(data->mcords, data->moves, x, y)) {
- if (bp) {
- bp->f1 = data->select?(bp->f1|SELECT):(bp->f1&~SELECT);
- } else {
- if (G.f & G_HIDDENHANDLES) {
- /* can only be beztindex==0 here since handles are hidden */
- bezt->f1 = bezt->f2 = bezt->f3 = data->select?(bezt->f2|SELECT):(bezt->f2&~SELECT);
- } else {
- if (beztindex==0) {
- bezt->f1 = data->select?(bezt->f1|SELECT):(bezt->f1&~SELECT);
- } else if (beztindex==1) {
- bezt->f2 = data->select?(bezt->f2|SELECT):(bezt->f2&~SELECT);
- } else {
- bezt->f3 = data->select?(bezt->f3|SELECT):(bezt->f3&~SELECT);
- }
- }
- }
- }
-}
-static void do_lasso_select_curve(short mcords[][2], short moves, short select)
-{
- struct { short (*mcords)[2]; short moves; short select; } data;
-
- data.mcords = mcords;
- data.moves = moves;
- data.select = select;
-
- nurbs_foreachScreenVert(do_lasso_select_curve__doSelect, &data);
-}
-
-static void do_lasso_select_lattice__doSelect(void *userData, BPoint *bp, int x, int y)
-{
- struct { short (*mcords)[2]; short moves; short select; } *data = userData;
-
- if (lasso_inside(data->mcords, data->moves, x, y)) {
- bp->f1 = data->select?(bp->f1|SELECT):(bp->f1&~SELECT);
- }
-}
-static void do_lasso_select_lattice(short mcords[][2], short moves, short select)
-{
- struct { short (*mcords)[2]; short moves; short select; } data;
-
- data.mcords = mcords;
- data.moves = moves;
- data.select = select;
-
- lattice_foreachScreenVert(do_lasso_select_lattice__doSelect, &data);
-}
-
-static void do_lasso_select_armature(short mcords[][2], short moves, short select)
-{
- EditBone *ebone;
- float vec[3];
- short sco1[2], sco2[2], didpoint;
-
- for (ebone=G.edbo.first; ebone; ebone=ebone->next) {
-
- VECCOPY(vec, ebone->head);
- Mat4MulVecfl(G.obedit->obmat, vec);
- project_short(vec, sco1);
- VECCOPY(vec, ebone->tail);
- Mat4MulVecfl(G.obedit->obmat, vec);
- project_short(vec, sco2);
-
- didpoint= 0;
- if(lasso_inside(mcords, moves, sco1[0], sco1[1])) {
- if(select) ebone->flag |= BONE_ROOTSEL;
- else ebone->flag &= ~BONE_ROOTSEL;
- didpoint= 1;
- }
- if(lasso_inside(mcords, moves, sco2[0], sco2[1])) {
- if(select) ebone->flag |= BONE_TIPSEL;
- else ebone->flag &= ~BONE_TIPSEL;
- didpoint= 1;
- }
- /* if one of points selected, we skip the bone itself */
- if(didpoint==0 && lasso_inside_edge(mcords, moves, sco1[0], sco1[1], sco2[0], sco2[1])) {
- if(select) ebone->flag |= BONE_TIPSEL|BONE_ROOTSEL|BONE_SELECTED;
- else ebone->flag &= ~(BONE_ACTIVE|BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
- }
- }
- countall(); /* abused for flushing selection */
-}
-
-static void do_lasso_select_facemode(short mcords[][2], short moves, short select)
-{
- Mesh *me;
- rcti rect;
-
- me= get_mesh(OBACT);
- if(me==NULL || me->mtface==NULL) return;
- if(me->totface==0) return;
-
- em_vertoffs= me->totface+1; /* max index array */
-
- lasso_select_boundbox(&rect, mcords, moves);
- EM_mask_init_backbuf_border(mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
-
- EM_backbuf_checkAndSelectTFaces(me, select);
-
- EM_free_backbuf();
-
- object_tface_flags_changed(OBACT, 0);
-}
-
-static void do_lasso_select(short mcords[][2], short moves, short select)
-{
- if(G.obedit==NULL) {
- if(FACESEL_PAINT_TEST)
- do_lasso_select_facemode(mcords, moves, select);
- else if(G.f & (G_VERTEXPAINT|G_TEXTUREPAINT|G_WEIGHTPAINT))
- ;
- else if(G.f & G_PARTICLEEDIT)
- PE_do_lasso_select(mcords, moves, select);
- else
- do_lasso_select_objects(mcords, moves, select);
- }
- else if(G.obedit->type==OB_MESH) {
- if(curarea->spacetype==SPACE_VIEW3D) {
- do_lasso_select_mesh(mcords, moves, select);
- } else if (EM_texFaceCheck()){
- do_lasso_select_mesh_uv(mcords, moves, select);
- }
- } else if(G.obedit->type==OB_CURVE || G.obedit->type==OB_SURF)
- do_lasso_select_curve(mcords, moves, select);
- else if(G.obedit->type==OB_LATTICE)
- do_lasso_select_lattice(mcords, moves, select);
- else if(G.obedit->type==OB_ARMATURE)
- do_lasso_select_armature(mcords, moves, select);
-
- BIF_undo_push("Lasso select");
-
- if (EM_texFaceCheck())
- allqueue(REDRAWIMAGE, 0);
-
- allqueue(REDRAWVIEW3D, 0);
- countall();
-}
-
-/* un-draws and draws again */
-static void draw_lasso_select(short mcords[][2], short moves, short end)
-{
- int a;
-
- setlinestyle(2);
- /* clear draw */
- if(moves>1) {
- for(a=1; a<=moves-1; a++) {
- sdrawXORline(mcords[a-1][0], mcords[a-1][1], mcords[a][0], mcords[a][1]);
- }
- sdrawXORline(mcords[moves-1][0], mcords[moves-1][1], mcords[0][0], mcords[0][1]);
- }
- if(!end) {
- /* new draw */
- for(a=1; a<=moves; a++) {
- sdrawXORline(mcords[a-1][0], mcords[a-1][1], mcords[a][0], mcords[a][1]);
- }
- sdrawXORline(mcords[moves][0], mcords[moves][1], mcords[0][0], mcords[0][1]);
- }
- setlinestyle(0);
-}
-
-
-static char interpret_move(short mcord[][2], int count)
-{
- float x1, x2, y1, y2, d1, d2, inp, sq, mouse[MOVES_GESTURE][2];
- int i, j, dir = 0;
-
- if (count <= 10) return ('g');
-
- /* from short to float (drawing is with shorts) */
- for(j=0; j<count; j++) {
- mouse[j][0]= mcord[j][0];
- mouse[j][1]= mcord[j][1];
- }
-
- /* new method:
- *
- * starting from end points, calculate center with maximum distance
- * dependant at the angle s / g / r is defined
- */
-
-
- /* filter */
-
- for( j = 3 ; j > 0; j--){
- x1 = mouse[1][0];
- y1 = mouse[1][1];
- for (i = 2; i < count; i++){
- x2 = mouse[i-1][0];
- y2 = mouse[i-1][1];
- mouse[i-1][0] = ((x1 + mouse[i][0]) /4.0) + (x2 / 2.0);
- mouse[i-1][1] = ((y1 + mouse[i][1]) /4.0) + (y2 / 2.0);
- x1 = x2;
- y1 = y2;
- }
- }
-
- /* make overview of directions */
- for (i = 0; i <= count - 2; i++){
- x1 = mouse[i][0] - mouse[i + 1][0];
- y1 = mouse[i][1] - mouse[i + 1][1];
-
- if (x1 < -0.5){
- if (y1 < -0.5) dir |= 32;
- else if (y1 > 0.5) dir |= 128;
- else dir |= 64;
- } else if (x1 > 0.5){
- if (y1 < -0.5) dir |= 8;
- else if (y1 > 0.5) dir |= 2;
- else dir |= 4;
- } else{
- if (y1 < -0.5) dir |= 16;
- else if (y1 > 0.5) dir |= 1;
- else dir |= 0;
- }
- }
-
- /* move all crosses to the right */
- for (i = 7; i>=0 ; i--){
- if (dir & 128) dir = (dir << 1) + 1;
- else break;
- }
- dir &= 255;
- for (i = 7; i>=0 ; i--){
- if ((dir & 1) == 0) dir >>= 1;
- else break;
- }
-
- /* in theory: 1 direction: straight line
- * multiple sequential directions: circle
- * non-sequential, and 1 bit set in upper 4 bits: size
- */
- switch(dir){
- case 1:
- return ('g');
- break;
- case 3:
- case 7:
- x1 = mouse[0][0] - mouse[count >> 1][0];
- y1 = mouse[0][1] - mouse[count >> 1][1];
- x2 = mouse[count >> 1][0] - mouse[count - 1][0];
- y2 = mouse[count >> 1][1] - mouse[count - 1][1];
- d1 = (x1 * x1) + (y1 * y1);
- d2 = (x2 * x2) + (y2 * y2);
- sq = sqrt(d1);
- x1 /= sq;
- y1 /= sq;
- sq = sqrt(d2);
- x2 /= sq;
- y2 /= sq;
- inp = (x1 * x2) + (y1 * y2);
- /*printf("%f\n", inp);*/
- if (inp > 0.9) return ('g');
- else return ('r');
- break;
- case 15:
- case 31:
- case 63:
- case 127:
- case 255:
- return ('r');
- break;
- default:
- /* for size at least one of the higher bits has to be set */
- if (dir < 16) return ('r');
- else return ('s');
- }
-
- return (0);
-}
-
-
-/* return 1 to denote gesture did something, also does lasso */
-int gesture(void)
-{
- unsigned short event=0;
- int i= 1, end= 0, a;
- short mcords[MOVES_LASSO][2]; /* the larger size */
- short mval[2], val, timer=0, mousebut, lasso=0, maxmoves;
-
- if (U.flag & USER_LMOUSESELECT) mousebut = R_MOUSE;
- else mousebut = L_MOUSE;
-
- /* check for lasso */
- if(G.qual & LR_CTRLKEY) {
- if(curarea->spacetype==SPACE_VIEW3D) {
- if(G.obedit==NULL) {
- if(G.f & (G_VERTEXPAINT|G_TEXTUREPAINT|G_WEIGHTPAINT)) return 0;
- }
- lasso= 1;
- } else if (curarea->spacetype==SPACE_IMAGE) {
- if(G.obedit) {
- lasso= 1;
- }
- }
- }
-
- glDrawBuffer(GL_FRONT);
- persp(PERSP_WIN); /* ortho at pixel level */
-
- getmouseco_areawin(mval);
-
- mcords[0][0] = mval[0];
- mcords[0][1] = mval[1];
-
- if(lasso) maxmoves= MOVES_LASSO;
- else maxmoves= MOVES_GESTURE;
-
- while(get_mbut() & mousebut) {
-
- if(qtest()) event= extern_qread(&val);
- else if(i==1) {
- /* not drawing yet... check for toolbox */
- PIL_sleep_ms(10);
- timer++;
- if(timer>=10*U.tb_leftmouse) {
- glDrawBuffer(GL_BACK); /* !! */
- toolbox_n();
- return 1;
- }
- }
-
- switch (event) {
- case MOUSEY:
- getmouseco_areawin(mval);
- if( abs(mval[0]-mcords[i-1][0])>3 || abs(mval[1]-mcords[i-1][1])>3 ) {
- mcords[i][0] = mval[0];
- mcords[i][1] = mval[1];
-
- if(i) {
- if(lasso) draw_lasso_select(mcords, i, 0);
- else sdrawXORline(mcords[i-1][0], mcords[i-1][1], mcords[i][0], mcords[i][1]);
- bglFlush();
- }
- i++;
- }
- break;
- case MOUSEX:
- break;
- case LEFTMOUSE:
- break;
- default:
- if(event) end= 1; /* blender returns 0 */
- break;
- }
- if (i == maxmoves || end == 1) break;
- }
-
- /* clear */
- if(lasso) draw_lasso_select(mcords, i, 1);
- else for(a=1; a<i; a++) {
- sdrawXORline(mcords[a-1][0], mcords[a-1][1], mcords[a][0], mcords[a][1]);
- }
-
- persp(PERSP_VIEW);
- glDrawBuffer(GL_BACK);
-
- if (i > 2) {
- if(lasso) do_lasso_select(mcords, i, (G.qual & LR_SHIFTKEY)==0);
- else {
- i = interpret_move(mcords, i);
-
- if(i) {
- if(curarea->spacetype==SPACE_IPO) transform_ipo(i);
- else if(curarea->spacetype==SPACE_OOPS) transform_oops('g', 0);
- else {
- int context;
-
- if(curarea->spacetype==SPACE_IMAGE) context= CTX_NONE;
- else context= CTX_NONE;
-
- if(i=='g') {
- initTransform(TFM_TRANSLATION, context);
- Transform();
- }
- else if(i=='r') {
- initTransform(TFM_ROTATION, context);
- Transform();
- }
- else {
- initTransform(TFM_RESIZE, context);
- Transform();
- }
- }
- }
- }
- return 1;
- }
- return 0;
-}
-
-void mouse_cursor(void)
-{
- float dx, dy, fz, *fp = NULL, dvec[3], oldcurs[3];
- short mval[2], mx, my, lr_click=0;
-
- if(gesture()) return;
-
- getmouseco_areawin(mval);
-
- mx= mval[0];
- my= mval[1];
-
- fp= give_cursor();
-
- if(G.obedit && ((G.qual & LR_CTRLKEY) || get_mbut()&R_MOUSE )) lr_click= 1;
- VECCOPY(oldcurs, fp);
-
- project_short_noclip(fp, mval);
-
- initgrabz(fp[0], fp[1], fp[2]);
-
- if(mval[0]!=IS_CLIPPED) {
-
- window_to_3d(dvec, mval[0]-mx, mval[1]-my);
- VecSubf(fp, fp, dvec);
-
- }
- else {
-
- dx= ((float)(mx-(curarea->winx/2)))*G.vd->zfac/(curarea->winx/2);
- dy= ((float)(my-(curarea->winy/2)))*G.vd->zfac/(curarea->winy/2);
-
- fz= G.vd->persmat[0][3]*fp[0]+ G.vd->persmat[1][3]*fp[1]+ G.vd->persmat[2][3]*fp[2]+ G.vd->persmat[3][3];
- fz= fz/G.vd->zfac;
-
- fp[0]= (G.vd->persinv[0][0]*dx + G.vd->persinv[1][0]*dy+ G.vd->persinv[2][0]*fz)-G.vd->ofs[0];
- fp[1]= (G.vd->persinv[0][1]*dx + G.vd->persinv[1][1]*dy+ G.vd->persinv[2][1]*fz)-G.vd->ofs[1];
- fp[2]= (G.vd->persinv[0][2]*dx + G.vd->persinv[1][2]*dy+ G.vd->persinv[2][2]*fz)-G.vd->ofs[2];
- }
-
- allqueue(REDRAWVIEW3D, 1);
-
- if(lr_click) {
- if(G.obedit->type==OB_MESH) add_click_mesh();
- else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) addvert_Nurb(0);
- else if (G.obedit->type==OB_ARMATURE) addvert_armature();
- VECCOPY(fp, oldcurs);
- }
-
-}
-
-void deselectall(void) /* is toggle */
-{
- Base *base;
- int a=0, ok=0;
-
- base= FIRSTBASE;
- while(base) {
- /* is there a visible selected object */
- if(base->lay & G.vd->lay &&
- (base->object->restrictflag & OB_RESTRICT_VIEW)==0 &&
- (base->object->restrictflag & OB_RESTRICT_SELECT)==0
- ) {
- if (base->flag & SELECT) {
- ok= a= 1;
- break;
- } else {
- ok=1;
- }
- }
- base= base->next;
- }
-
- if (!ok) return;
-
- base= FIRSTBASE;
- while(base) {
- if(base->lay & G.vd->lay &&
- (base->object->restrictflag & OB_RESTRICT_VIEW)==0 &&
- (base->object->restrictflag & OB_RESTRICT_SELECT)==0
- ) {
- if(a)
- select_base_v3d(base, BA_DESELECT);
- else
- select_base_v3d(base, BA_SELECT);
- base->object->flag= base->flag;
- }
- base= base->next;
- }
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWDATASELECT, 0);
- allqueue(REDRAWNLA, 0);
-
- countall();
- BIF_undo_push("(De)select all");
-}
-
-/* inverts object selection */
-void selectswap(void)
-{
- Base *base;
-
- for(base= FIRSTBASE; base; base= base->next) {
- if(base->lay & G.vd->lay &&
- (base->object->restrictflag & OB_RESTRICT_VIEW)==0
- ) {
- if TESTBASE(base)
- select_base_v3d(base, BA_DESELECT);
- else
- select_base_v3d(base, BA_SELECT);
- base->object->flag= base->flag;
- }
- }
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWDATASELECT, 0);
- allqueue(REDRAWNLA, 0);
-
- countall();
- BIF_undo_push("Select Inverse");
-}
-
-
-/* selects all objects of a particular type, on currently visible layers */
-void selectall_type(short obtype)
-{
- Base *base;
-
- base= FIRSTBASE;
- while(base) {
- if((base->lay & G.vd->lay) &&
- (base->object->type == obtype) &&
- (base->object->restrictflag & OB_RESTRICT_VIEW)==0
- ) {
- select_base_v3d(base, BA_SELECT);
- base->object->flag= base->flag;
- }
- base= base->next;
- }
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWDATASELECT, 0);
- allqueue(REDRAWNLA, 0);
-
- countall();
- BIF_undo_push("Select all per type");
-}
-/* selects all objects on a particular layer */
-void selectall_layer(unsigned int layernum)
-{
- Base *base;
-
- base= FIRSTBASE;
- while(base) {
- if(base->lay == (1<< (layernum -1)) &&
- (base->object->restrictflag & OB_RESTRICT_VIEW)==0
- ) {
- select_base_v3d(base, BA_SELECT);
- base->object->flag= base->flag;
- }
- base= base->next;
- }
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWDATASELECT, 0);
- allqueue(REDRAWNLA, 0);
-
- countall();
- BIF_undo_push("Select all per layer");
-}
-
-static void deselectall_except(Base *b) /* deselect all except b */
-{
- Base *base;
-
- base= FIRSTBASE;
- while(base) {
- if (base->flag & SELECT) {
- if(b!=base) {
- select_base_v3d(base, BA_DESELECT);
- base->object->flag= base->flag;
- }
- }
- base= base->next;
- }
-}
-
-#if 0
-/* smart function to sample a rect spiralling outside, nice for backbuf selection */
-static unsigned int samplerect(unsigned int *buf, int size, unsigned int dontdo)
-{
- Base *base;
- unsigned int *bufmin,*bufmax;
- int a,b,rc,tel,aantal,dirvec[4][2],maxob;
- unsigned int retval=0;
-
- base= LASTBASE;
- if(base==0) return 0;
- maxob= base->selcol;
-
- aantal= (size-1)/2;
- rc= 0;
-
- dirvec[0][0]= 1;
- dirvec[0][1]= 0;
- dirvec[1][0]= 0;
- dirvec[1][1]= -size;
- dirvec[2][0]= -1;
- dirvec[2][1]= 0;
- dirvec[3][0]= 0;
- dirvec[3][1]= size;
-
- bufmin= buf;
- bufmax= buf+ size*size;
- buf+= aantal*size+ aantal;
-
- for(tel=1;tel<=size;tel++) {
-
- for(a=0;a<2;a++) {
- for(b=0;b<tel;b++) {
-
- if(*buf && *buf<=maxob && *buf!=dontdo) return *buf;
- if( *buf==dontdo ) retval= dontdo; /* if only color dontdo is available, still return dontdo */
-
- buf+= (dirvec[rc][0]+dirvec[rc][1]);
-
- if(buf<bufmin || buf>=bufmax) return retval;
- }
- rc++;
- rc &= 3;
- }
- }
- return retval;
-}
-#endif
-
-void set_active_base(Base *base)
-{
- Base *tbase;
-
- /* activating a non-mesh, should end a couple of modes... */
- if(base && base->object->type!=OB_MESH)
- exit_paint_modes();
-
- /* sets scene->basact */
- BASACT= base;
-
- if(base) {
-
- /* signals to buttons */
- redraw_test_buttons(base->object);
-
- /* signal to ipo */
- allqueue(REDRAWIPO, base->object->ipowin);
-
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWNODE, 0);
-
- /* signal to action */
- select_actionchannel_by_name(base->object->action, "Object", 1);
-
- /* disable temporal locks */
- for(tbase=FIRSTBASE; tbase; tbase= tbase->next) {
- if(base!=tbase && (tbase->object->shapeflag & OB_SHAPE_TEMPLOCK)) {
- tbase->object->shapeflag &= ~OB_SHAPE_TEMPLOCK;
- DAG_object_flush_update(G.scene, tbase->object, OB_RECALC_DATA);
- }
- }
- }
-}
-
-void set_active_object(Object *ob)
-{
- Base *base;
-
- for(base= FIRSTBASE; base; base= base->next) {
- if(base->object==ob) {
- set_active_base(base);
- return;
- }
- }
-}
-
-static void select_all_from_groups(Base *basact)
-{
- Group *group;
- GroupObject *go;
- int deselect= basact->flag & SELECT;
-
- for(group= G.main->group.first; group; group= group->id.next) {
- if(object_in_group(basact->object, group)) {
- for(go= group->gobject.first; go; go= go->next) {
- if(deselect) go->ob->flag &= ~SELECT;
- else {
- if ((go->ob->restrictflag & OB_RESTRICT_SELECT)==0 &&
- (go->ob->restrictflag & OB_RESTRICT_VIEW)==0)
- go->ob->flag |= SELECT;
- }
- }
- }
- }
- /* sync bases */
- for(basact= G.scene->base.first; basact; basact= basact->next) {
- if(basact->object->flag & SELECT)
- select_base_v3d(basact, BA_SELECT);
- else
- select_base_v3d(basact, BA_DESELECT);
- }
-}
-
-/* The max number of menu items in an object select menu */
-#define SEL_MENU_SIZE 22
-
-static Base *mouse_select_menu(unsigned int *buffer, int hits, short *mval)
-{
- Base *baseList[SEL_MENU_SIZE]={NULL}; /*baseList is used to store all possible bases to bring up a menu */
- Base *base;
- short baseCount = 0;
- char menuText[20 + SEL_MENU_SIZE*32] = "Select Object%t"; /* max ob name = 22 */
- char str[32];
-
- for(base=FIRSTBASE; base; base= base->next) {
- if BASE_SELECTABLE(base) {
- baseList[baseCount] = NULL;
-
- /* two selection methods, the CTRL select uses max dist of 15 */
- if(buffer) {
- int a;
- for(a=0; a<hits; a++) {
- /* index was converted */
- if(base->selcol==buffer[ (4 * a) + 3 ]) baseList[baseCount] = base;
- }
- }
- else {
- int temp, dist=15;
-
- project_short(base->object->obmat[3], &base->sx);
-
- temp= abs(base->sx -mval[0]) + abs(base->sy -mval[1]);
- if(temp<dist ) baseList[baseCount] = base;
- }
-
- if(baseList[baseCount]) {
- if (baseCount < SEL_MENU_SIZE) {
- baseList[baseCount] = base;
- sprintf(str, "|%s %%x%d", base->object->id.name+2, baseCount+1); /* max ob name == 22 */
- strcat(menuText, str);
- baseCount++;
- }
- }
- }
- }
-
- if(baseCount<=1) return baseList[0];
- else {
- baseCount = pupmenu(menuText);
-
- if (baseCount != -1) { /* If nothing is selected then dont do anything */
- return baseList[baseCount-1];
- }
- else return NULL;
- }
-}
-
-/* we want a select buffer with bones, if there are... */
-/* so check three selection levels and compare */
-static short mixed_bones_object_selectbuffer(unsigned int *buffer, short *mval)
-{
- int offs;
- short a, hits15, hits9=0, hits5=0;
- short has_bones15=0, has_bones9=0, has_bones5=0;
-
- hits15= view3d_opengl_select(buffer, MAXPICKBUF, mval[0]-14, mval[1]-14, mval[0]+14, mval[1]+14);
- if(hits15>0) {
- for(a=0; a<hits15; a++) if(buffer[4*a+3] & 0xFFFF0000) has_bones15= 1;
-
- offs= 4*hits15;
- hits9= view3d_opengl_select(buffer+offs, MAXPICKBUF-offs, mval[0]-9, mval[1]-9, mval[0]+9, mval[1]+9);
- if(hits9>0) {
- for(a=0; a<hits9; a++) if(buffer[offs+4*a+3] & 0xFFFF0000) has_bones9= 1;
-
- offs+= 4*hits9;
- hits5= view3d_opengl_select(buffer+offs, MAXPICKBUF-offs, mval[0]-5, mval[1]-5, mval[0]+5, mval[1]+5);
- if(hits5>0) {
- for(a=0; a<hits5; a++) if(buffer[offs+4*a+3] & 0xFFFF0000) has_bones5= 1;
- }
- }
-
- if(has_bones5) {
- offs= 4*hits15 + 4*hits9;
- memcpy(buffer, buffer+offs, 4*offs);
- return hits5;
- }
- if(has_bones9) {
- offs= 4*hits15;
- memcpy(buffer, buffer+offs, 4*offs);
- return hits9;
- }
- if(has_bones15) {
- return hits15;
- }
-
- if(hits5>0) {
- offs= 4*hits15 + 4*hits9;
- memcpy(buffer, buffer+offs, 4*offs);
- return hits5;
- }
- if(hits9>0) {
- offs= 4*hits15;
- memcpy(buffer, buffer+offs, 4*offs);
- return hits9;
- }
- return hits15;
- }
-
- return 0;
-}
-
-void mouse_select(void)
-{
- Base *base, *startbase=NULL, *basact=NULL, *oldbasact=NULL;
- unsigned int buffer[MAXPICKBUF];
- int temp, a, dist=100;
- short hits, mval[2];
-
- /* always start list from basact in wire mode */
- startbase= FIRSTBASE;
- if(BASACT && BASACT->next) startbase= BASACT->next;
-
- getmouseco_areawin(mval);
-
- /* This block uses the control key to make the object selected by its center point rather then its contents */
- if(G.obedit==0 && (G.qual & LR_CTRLKEY)) {
-
- /* note; shift+alt goes to group-flush-selecting */
- if(G.qual == (LR_ALTKEY|LR_CTRLKEY))
- basact= mouse_select_menu(NULL, 0, mval);
- else {
- base= startbase;
- while(base) {
- if BASE_SELECTABLE(base) {
- project_short(base->object->obmat[3], &base->sx);
-
- temp= abs(base->sx -mval[0]) + abs(base->sy -mval[1]);
- if(base==BASACT) temp+=10;
- if(temp<dist ) {
-
- dist= temp;
- basact= base;
- }
- }
- base= base->next;
-
- if(base==0) base= FIRSTBASE;
- if(base==startbase) break;
- }
- }
- }
- else {
- /* if objects have posemode set, the bones are in the same selection buffer */
-
- hits= mixed_bones_object_selectbuffer(buffer, mval);
-
- if(hits>0) {
- int has_bones= 0;
-
- for(a=0; a<hits; a++) if(buffer[4*a+3] & 0xFFFF0000) has_bones= 1;
-
- /* note; shift+alt goes to group-flush-selecting */
- if(has_bones==0 && (G.qual == LR_ALTKEY))
- basact= mouse_select_menu(buffer, hits, mval);
- else {
- static short lastmval[2]={-100, -100};
- int donearest= 0;
-
- /* define if we use solid nearest select or not */
- if(G.vd->drawtype>OB_WIRE) {
- donearest= 1;
- if( ABS(mval[0]-lastmval[0])<3 && ABS(mval[1]-lastmval[1])<3) {
- if(!has_bones) /* hrms, if theres bones we always do nearest */
- donearest= 0;
- }
- }
- lastmval[0]= mval[0]; lastmval[1]= mval[1];
-
- if(donearest) {
- unsigned int min= 0xFFFFFFFF;
- int selcol= 0, notcol=0;
-
-
- if(has_bones) {
- /* we skip non-bone hits */
- for(a=0; a<hits; a++) {
- if( min > buffer[4*a+1] && (buffer[4*a+3] & 0xFFFF0000) ) {
- min= buffer[4*a+1];
- selcol= buffer[4*a+3] & 0xFFFF;
- }
- }
- }
- else {
- /* only exclude active object when it is selected... */
- if(BASACT && (BASACT->flag & SELECT) && hits>1) notcol= BASACT->selcol;
-
- for(a=0; a<hits; a++) {
- if( min > buffer[4*a+1] && notcol!=(buffer[4*a+3] & 0xFFFF)) {
- min= buffer[4*a+1];
- selcol= buffer[4*a+3] & 0xFFFF;
- }
- }
- }
-
- base= FIRSTBASE;
- while(base) {
- if(base->lay & G.vd->lay) {
- if(base->selcol==selcol) break;
- }
- base= base->next;
- }
- if(base) basact= base;
- }
- else {
-
- base= startbase;
- while(base) {
- /* skip objects with select restriction, to prevent prematurely ending this loop
- * with an un-selectable choice */
- if (base->object->restrictflag & OB_RESTRICT_SELECT) {
- base=base->next;
- if(base==NULL) base= FIRSTBASE;
- if(base==startbase) break;
- }
-
- if(base->lay & G.vd->lay) {
- for(a=0; a<hits; a++) {
- if(has_bones) {
- /* skip non-bone objects */
- if((buffer[4*a+3] & 0xFFFF0000)) {
- if(base->selcol== (buffer[(4*a)+3] & 0xFFFF))
- basact= base;
- }
- }
- else {
- if(base->selcol== (buffer[(4*a)+3] & 0xFFFF))
- basact= base;
- }
- }
- }
-
- if(basact) break;
-
- base= base->next;
- if(base==NULL) base= FIRSTBASE;
- if(base==startbase) break;
- }
- }
- }
-
- if(has_bones && basact) {
- if( do_pose_selectbuffer(basact, buffer, hits) ) { /* then bone is found */
-
- /* we make the armature selected:
- not-selected active object in posemode won't work well for tools */
- basact->flag|= SELECT;
- basact->object->flag= basact->flag;
-
- /* in weightpaint, we use selected bone to select vertexgroup, so no switch to new active object */
- if(G.f & G_WEIGHTPAINT) {
- /* prevent activating */
- basact= NULL;
- }
- }
- /* prevent bone selecting to pass on to object selecting */
- if(basact==BASACT)
- basact= NULL;
- }
- }
- }
-
- /* so, do we have something selected? */
- if(basact) {
-
- if(G.obedit) {
- /* only do select */
- deselectall_except(basact);
- select_base_v3d(basact, BA_SELECT);
- }
- /* also prevent making it active on mouse selection */
- else if BASE_SELECTABLE(basact) {
-
- oldbasact= BASACT;
- BASACT= basact;
-
- if((G.qual & LR_SHIFTKEY)==0) {
- deselectall_except(basact);
- select_base_v3d(basact, BA_SELECT);
- }
- else if(G.qual==(LR_SHIFTKEY|LR_ALTKEY)) {
- select_all_from_groups(basact);
- }
- else {
- if(basact->flag & SELECT) {
- if(basact==oldbasact)
- select_base_v3d(basact, BA_DESELECT);
- }
- else select_base_v3d(basact, BA_SELECT);
- }
-
- /* copy */
- basact->object->flag= basact->flag;
-
- if(oldbasact != basact) {
- set_active_base(basact);
- }
-
- /* for visual speed, only in wire mode */
- if(G.vd->drawtype==OB_WIRE) {
- /* however, not for posemodes */
- if(basact->object->flag & OB_POSEMODE);
- else if(oldbasact && (oldbasact->object->flag & OB_POSEMODE));
- else {
- if(oldbasact && oldbasact != basact && (oldbasact->lay & G.vd->lay))
- draw_object_ext(oldbasact);
- draw_object_ext(basact);
- }
- }
-
- allqueue(REDRAWBUTSLOGIC, 0);
- allqueue(REDRAWDATASELECT, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWTIME, 0);
- allqueue(REDRAWHEADERS, 0); /* To force display update for the posebutton */
- }
- /* also because multiple 3d windows can be open */
- allqueue(REDRAWVIEW3D, 0);
-
- }
-
- countall();
-
- rightmouse_transform(); /* does undo push! */
-}
-
-/* ------------------------------------------------------------------------- */
-
-static int edge_inside_circle(short centx, short centy, short rad, short x1, short y1, short x2, short y2)
-{
- int radsq= rad*rad;
- float v1[2], v2[2], v3[2];
-
- /* check points in circle itself */
- if( (x1-centx)*(x1-centx) + (y1-centy)*(y1-centy) <= radsq ) return 1;
- if( (x2-centx)*(x2-centx) + (y2-centy)*(y2-centy) <= radsq ) return 1;
-
- /* pointdistline */
- v3[0]= centx;
- v3[1]= centy;
- v1[0]= x1;
- v1[1]= y1;
- v2[0]= x2;
- v2[1]= y2;
-
- if( PdistVL2Dfl(v3, v1, v2) < (float)rad ) return 1;
-
- return 0;
-}
-
-static void do_nurbs_box_select__doSelect(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y)
-{
- struct { rcti *rect; int select; } *data = userData;
-
- if (BLI_in_rcti(data->rect, x, y)) {
- if (bp) {
- bp->f1 = data->select?(bp->f1|SELECT):(bp->f1&~SELECT);
- } else {
- if (G.f & G_HIDDENHANDLES) {
- /* can only be beztindex==0 here since handles are hidden */
- bezt->f1 = bezt->f2 = bezt->f3 = data->select?(bezt->f2|SELECT):(bezt->f2&~SELECT);
- } else {
- if (beztindex==0) {
- bezt->f1 = data->select?(bezt->f1|SELECT):(bezt->f1&~SELECT);
- } else if (beztindex==1) {
- bezt->f2 = data->select?(bezt->f2|SELECT):(bezt->f2&~SELECT);
- } else {
- bezt->f3 = data->select?(bezt->f3|SELECT):(bezt->f3&~SELECT);
- }
- }
- }
- }
-}
-static void do_nurbs_box_select(rcti *rect, int select)
-{
- struct { rcti *rect; int select; } data;
-
- data.rect = rect;
- data.select = select;
-
- nurbs_foreachScreenVert(do_nurbs_box_select__doSelect, &data);
-}
-
-static void do_lattice_box_select__doSelect(void *userData, BPoint *bp, int x, int y)
-{
- struct { rcti *rect; int select; } *data = userData;
-
- if (BLI_in_rcti(data->rect, x, y)) {
- bp->f1 = data->select?(bp->f1|SELECT):(bp->f1&~SELECT);
- }
-}
-static void do_lattice_box_select(rcti *rect, int select)
-{
- struct { rcti *rect; int select, pass, done; } data;
-
- data.rect = rect;
- data.select = select;
-
- lattice_foreachScreenVert(do_lattice_box_select__doSelect, &data);
-}
-
-static void do_mesh_box_select__doSelectVert(void *userData, EditVert *eve, int x, int y, int index)
-{
- struct { rcti *rect; short select, pass, done; } *data = userData;
-
- if (BLI_in_rcti(data->rect, x, y)) {
- eve->f = data->select?(eve->f|1):(eve->f&~1);
- }
-}
-static void do_mesh_box_select__doSelectEdge(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index)
-{
- struct { rcti *rect; short select, pass, done; } *data = userData;
-
- if(EM_check_backbuf(em_solidoffs+index)) {
- if (data->pass==0) {
- if (edge_fully_inside_rect(data->rect, x0, y0, x1, y1)) {
- EM_select_edge(eed, data->select);
- data->done = 1;
- }
- } else {
- if (edge_inside_rect(data->rect, x0, y0, x1, y1)) {
- EM_select_edge(eed, data->select);
- }
- }
- }
-}
-static void do_mesh_box_select__doSelectFace(void *userData, EditFace *efa, int x, int y, int index)
-{
- struct { rcti *rect; short select, pass, done; } *data = userData;
-
- if (BLI_in_rcti(data->rect, x, y)) {
- EM_select_face_fgon(efa, data->select);
- }
-}
-static void do_mesh_box_select(rcti *rect, int select)
-{
- struct { rcti *rect; short select, pass, done; } data;
- EditMesh *em = G.editMesh;
- int bbsel;
-
- data.rect = rect;
- data.select = select;
- data.pass = 0;
- data.done = 0;
-
- bbsel= EM_init_backbuf_border(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
-
- if(G.scene->selectmode & SCE_SELECT_VERTEX) {
- if (bbsel) {
- EM_backbuf_checkAndSelectVerts(em, select);
- } else {
- mesh_foreachScreenVert(do_mesh_box_select__doSelectVert, &data, 1);
- }
- }
- if(G.scene->selectmode & SCE_SELECT_EDGE) {
- /* Does both bbsel and non-bbsel versions (need screen cos for both) */
-
- data.pass = 0;
- mesh_foreachScreenEdge(do_mesh_box_select__doSelectEdge, &data, 0);
-
- if (data.done==0) {
- data.pass = 1;
- mesh_foreachScreenEdge(do_mesh_box_select__doSelectEdge, &data, 0);
- }
- }
-
- if(G.scene->selectmode & SCE_SELECT_FACE) {
- if(bbsel) {
- EM_backbuf_checkAndSelectFaces(em, select);
- } else {
- mesh_foreachScreenFace(do_mesh_box_select__doSelectFace, &data);
- }
- }
-
- EM_free_backbuf();
-
- EM_selectmode_flush();
-}
-
-/**
- * Does the 'borderselect' command. (Select verts based on selecting with a
- * border: key 'b'). All selecting seems to be done in the get_border part.
- */
-void borderselect(void)
-{
- rcti rect;
- Base *base;
- MetaElem *ml;
- unsigned int buffer[MAXPICKBUF];
- int a, index;
- short hits, val;
-
- if(G.obedit==NULL && (FACESEL_PAINT_TEST)) {
- face_borderselect();
- return;
- }
- else if(G.obedit==NULL && (G.f & G_PARTICLEEDIT)) {
- PE_borderselect();
- return;
- }
-
- a = 0;
-#ifdef __APPLE__
- a = is_a_really_crappy_intel_card();
-#endif
- if (!a) setlinestyle(2);
- val= get_border(&rect, 3);
- if (!a) setlinestyle(0);
-
- if(val==0) {
- if (EM_texFaceCheck())
- allqueue(REDRAWIMAGE, 0);
- return;
- }
-
- if(G.obedit) {
- if(G.obedit->type==OB_MESH) {
- do_mesh_box_select(&rect, (val==LEFTMOUSE));
- allqueue(REDRAWVIEW3D, 0);
- if (EM_texFaceCheck())
- allqueue(REDRAWIMAGE, 0);
-
- }
- else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
- do_nurbs_box_select(&rect, val==LEFTMOUSE);
- allqueue(REDRAWVIEW3D, 0);
- }
- else if(G.obedit->type==OB_MBALL) {
- hits= view3d_opengl_select(buffer, MAXPICKBUF, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
-
- ml= editelems.first;
-
- while(ml) {
- for(a=0; a<hits; a++) {
- if(ml->selcol1==buffer[ (4 * a) + 3 ]) {
- ml->flag |= MB_SCALE_RAD;
- if(val==LEFTMOUSE) ml->flag |= SELECT;
- else ml->flag &= ~SELECT;
- break;
- }
- if(ml->selcol2==buffer[ (4 * a) + 3 ]) {
- ml->flag &= ~MB_SCALE_RAD;
- if(val==LEFTMOUSE) ml->flag |= SELECT;
- else ml->flag &= ~SELECT;
- break;
- }
- }
- ml= ml->next;
- }
- allqueue(REDRAWVIEW3D, 0);
- }
- else if(G.obedit->type==OB_ARMATURE) {
- EditBone *ebone;
-
- /* clear flag we use to detect point was affected */
- for(ebone= G.edbo.first; ebone; ebone= ebone->next)
- ebone->flag &= ~BONE_DONE;
-
- hits= view3d_opengl_select(buffer, MAXPICKBUF, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
-
- /* first we only check points inside the border */
- for (a=0; a<hits; a++){
- index = buffer[(4*a)+3];
- if (index!=-1) {
- ebone = BLI_findlink(&G.edbo, index & ~(BONESEL_ANY));
- if (index & BONESEL_TIP) {
- ebone->flag |= BONE_DONE;
- if (val==LEFTMOUSE) ebone->flag |= BONE_TIPSEL;
- else ebone->flag &= ~BONE_TIPSEL;
- }
-
- if (index & BONESEL_ROOT) {
- ebone->flag |= BONE_DONE;
- if (val==LEFTMOUSE) ebone->flag |= BONE_ROOTSEL;
- else ebone->flag &= ~BONE_ROOTSEL;
- }
- }
- }
-
- /* now we have to flush tag from parents... */
- for(ebone= G.edbo.first; ebone; ebone= ebone->next) {
- if(ebone->parent && (ebone->flag & BONE_CONNECTED)) {
- if(ebone->parent->flag & BONE_DONE)
- ebone->flag |= BONE_DONE;
- }
- }
-
- /* only select/deselect entire bones when no points where in the rect */
- for (a=0; a<hits; a++){
- index = buffer[(4*a)+3];
- if (index!=-1) {
- ebone = BLI_findlink(&G.edbo, index & ~(BONESEL_ANY));
- if (index & BONESEL_BONE) {
- if(!(ebone->flag & BONE_DONE)) {
- if (val==LEFTMOUSE)
- ebone->flag |= (BONE_ROOTSEL|BONE_TIPSEL|BONE_SELECTED);
- else
- ebone->flag &= ~(BONE_ROOTSEL|BONE_TIPSEL|BONE_SELECTED);
- }
- }
- }
- }
-
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWVIEW3D, 0);
- }
- else if(G.obedit->type==OB_LATTICE) {
- do_lattice_box_select(&rect, val==LEFTMOUSE);
- allqueue(REDRAWVIEW3D, 0);
- }
- }
- else { /* no editmode, unified for bones and objects */
- Bone *bone;
- unsigned int *vbuffer=NULL; /* selection buffer */
- unsigned int *col; /* color in buffer */
- short selecting = 0;
- Object *ob= OBACT;
- int bone_only;
-
- if((ob) && (ob->flag & OB_POSEMODE))
- bone_only= 1;
- else
- bone_only= 0;
-
- if (val==LEFTMOUSE)
- selecting = 1;
-
- /* selection buffer now has bones potentially too, so we add MAXPICKBUF */
- vbuffer = MEM_mallocN(4 * (G.totobj+MAXPICKBUF) * sizeof(unsigned int), "selection buffer");
- hits= view3d_opengl_select(vbuffer, 4*(G.totobj+MAXPICKBUF), rect.xmin, rect.ymin, rect.xmax, rect.ymax);
- /*
- LOGIC NOTES (theeth):
- The buffer and ListBase have the same relative order, which makes the selection
- very simple. Loop through both data sets at the same time, if the color
- is the same as the object, we have a hit and can move to the next color
- and object pair, if not, just move to the next object,
- keeping the same color until we have a hit.
-
- The buffer order is defined by OGL standard, hopefully no stupid GFX card
- does it incorrectly.
- */
-
- if (hits>0) { /* no need to loop if there's no hit */
- base= FIRSTBASE;
- col = vbuffer + 3;
- while(base && hits) {
- Base *next = base->next;
- if(base->lay & G.vd->lay) {
- while (base->selcol == (*col & 0xFFFF)) { /* we got an object */
-
- if(*col & 0xFFFF0000) { /* we got a bone */
- bone = get_indexed_bone(base->object, *col & ~(BONESEL_ANY));
- if(bone) {
- if(selecting) {
- bone->flag |= BONE_SELECTED;
- select_actionchannel_by_name(base->object->action, bone->name, 1);
- }
- else {
- bone->flag &= ~(BONE_ACTIVE|BONE_SELECTED);
- select_actionchannel_by_name(base->object->action, bone->name, 0);
- }
- }
- }
- else if(!bone_only) {
- if (selecting)
- select_base_v3d(base, BA_SELECT);
- else
- select_base_v3d(base, BA_DESELECT);
-
- base->object->flag= base->flag;
- }
-
- col+=4; /* next color */
- hits--;
- if(hits==0) break;
- }
- }
-
- base= next;
- }
- }
- /* frontbuffer flush */
- bglFlush();
-
- MEM_freeN(vbuffer);
-
- allqueue(REDRAWDATASELECT, 0);
- allqueue(REDRAWBUTSLOGIC, 0);
- allqueue(REDRAWNLA, 0);
- }
-
- countall();
-
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWINFO, 0);
-
- BIF_undo_push("Border select");
-
-} /* end of borderselect() */
-
-/* ------------------------------------------------------------------------- */
-
-/** The following functions are quick & dirty callback functions called
- * on the Circle select function (press B twice in Editmode)
- * They were torn out of the circle_select to make the latter more reusable
- * The callback version of circle_select (called circle_selectCB) was moved
- * to edit.c because of it's (wanted) generality.
-
- XXX These callback functions are still dirty, because they call globals...
- */
-
-static void mesh_selectionCB__doSelectVert(void *userData, EditVert *eve, int x, int y, int index)
-{
- struct { short select, mval[2]; float radius; } *data = userData;
- int mx = x - data->mval[0], my = y - data->mval[1];
- float r = sqrt(mx*mx + my*my);
-
- if (r<=data->radius) {
- eve->f = data->select?(eve->f|1):(eve->f&~1);
- }
-}
-static void mesh_selectionCB__doSelectEdge(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index)
-{
- struct { short select, mval[2]; float radius; } *data = userData;
-
- if (edge_inside_circle(data->mval[0], data->mval[1], (short) data->radius, x0, y0, x1, y1)) {
- EM_select_edge(eed, data->select);
- }
-}
-static void mesh_selectionCB__doSelectFace(void *userData, EditFace *efa, int x, int y, int index)
-{
- struct { short select, mval[2]; float radius; } *data = userData;
- int mx = x - data->mval[0], my = y - data->mval[1];
- float r = sqrt(mx*mx + my*my);
-
- if (r<=data->radius) {
- EM_select_face_fgon(efa, data->select);
- }
-}
-static void mesh_selectionCB(int selecting, Object *editobj, short *mval, float rad)
-{
- struct { short select, mval[2]; float radius; } data;
- EditMesh *em = G.editMesh;
- int bbsel;
-
- if(!G.obedit && (FACESEL_PAINT_TEST)) {
- Mesh *me = get_mesh(OBACT);
-
- if (me) {
- em_vertoffs= me->totface+1; /* max index array */
-
- bbsel= EM_init_backbuf_circle(mval[0], mval[1], (short)(rad+1.0));
- EM_backbuf_checkAndSelectTFaces(me, selecting==LEFTMOUSE);
- EM_free_backbuf();
-
- object_tface_flags_changed(OBACT, 0);
- }
-
- return;
- }
-
- bbsel= EM_init_backbuf_circle(mval[0], mval[1], (short)(rad+1.0));
-
- data.select = (selecting==LEFTMOUSE);
- data.mval[0] = mval[0];
- data.mval[1] = mval[1];
- data.radius = rad;
-
- if(G.scene->selectmode & SCE_SELECT_VERTEX) {
- if(bbsel) {
- EM_backbuf_checkAndSelectVerts(em, selecting==LEFTMOUSE);
- } else {
- mesh_foreachScreenVert(mesh_selectionCB__doSelectVert, &data, 1);
- }
- }
-
- if(G.scene->selectmode & SCE_SELECT_EDGE) {
- if (bbsel) {
- EM_backbuf_checkAndSelectEdges(em, selecting==LEFTMOUSE);
- } else {
- mesh_foreachScreenEdge(mesh_selectionCB__doSelectEdge, &data, 0);
- }
- }
-
- if(G.scene->selectmode & SCE_SELECT_FACE) {
- if(bbsel) {
- EM_backbuf_checkAndSelectFaces(em, selecting==LEFTMOUSE);
- } else {
- mesh_foreachScreenFace(mesh_selectionCB__doSelectFace, &data);
- }
- }
-
- EM_free_backbuf();
- EM_selectmode_flush();
-}
-
-
-static void nurbscurve_selectionCB__doSelect(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y)
-{
- struct { short select, mval[2]; float radius; } *data = userData;
- int mx = x - data->mval[0], my = y - data->mval[1];
- float r = sqrt(mx*mx + my*my);
-
- if (r<=data->radius) {
- if (bp) {
- bp->f1 = data->select?(bp->f1|SELECT):(bp->f1&~SELECT);
- } else {
- if (beztindex==0) {
- bezt->f1 = data->select?(bezt->f1|SELECT):(bezt->f1&~SELECT);
- } else if (beztindex==1) {
- bezt->f2 = data->select?(bezt->f2|SELECT):(bezt->f2&~SELECT);
- } else {
- bezt->f3 = data->select?(bezt->f3|SELECT):(bezt->f3&~SELECT);
- }
- }
- }
-}
-static void nurbscurve_selectionCB(int selecting, Object *editobj, short *mval, float rad)
-{
- struct { short select, mval[2]; float radius; } data;
-
- data.select = (selecting==LEFTMOUSE);
- data.mval[0] = mval[0];
- data.mval[1] = mval[1];
- data.radius = rad;
-
- nurbs_foreachScreenVert(nurbscurve_selectionCB__doSelect, &data);
-}
-
-
-static void latticecurve_selectionCB__doSelect(void *userData, BPoint *bp, int x, int y)
-{
- struct { short select, mval[2]; float radius; } *data = userData;
- int mx = x - data->mval[0], my = y - data->mval[1];
- float r = sqrt(mx*mx + my*my);
-
- if (r<=data->radius) {
- bp->f1 = data->select?(bp->f1|SELECT):(bp->f1&~SELECT);
- }
-}
-static void lattice_selectionCB(int selecting, Object *editobj, short *mval, float rad)
-{
- struct { short select, mval[2]; float radius; } data;
-
- data.select = (selecting==LEFTMOUSE);
- data.mval[0] = mval[0];
- data.mval[1] = mval[1];
- data.radius = rad;
-
- lattice_foreachScreenVert(latticecurve_selectionCB__doSelect, &data);
-}
-
-/** Callbacks for selection in Editmode */
-
-void obedit_selectionCB(short selecting, Object *editobj, short *mval, float rad)
-{
- switch(editobj->type) {
- case OB_MESH:
- mesh_selectionCB(selecting, editobj, mval, rad);
- break;
- case OB_CURVE:
- case OB_SURF:
- nurbscurve_selectionCB(selecting, editobj, mval, rad);
- break;
- case OB_LATTICE:
- lattice_selectionCB(selecting, editobj, mval, rad);
- break;
- default:
- return;
- }
-
- draw_sel_circle(0, 0, 0, 0, 0); /* signal */
- force_draw(0);
-}
-
-void set_render_border(void)
-{
- rcti rect;
- short val;
-
- val= get_border(&rect, 3);
- if(val) {
- rctf vb;
-
- calc_viewborder(G.vd, &vb);
-
- G.scene->r.border.xmin= ((float)rect.xmin-vb.xmin)/(vb.xmax-vb.xmin);
- G.scene->r.border.ymin= ((float)rect.ymin-vb.ymin)/(vb.ymax-vb.ymin);
- G.scene->r.border.xmax= ((float)rect.xmax-vb.xmin)/(vb.xmax-vb.xmin);
- G.scene->r.border.ymax= ((float)rect.ymax-vb.ymin)/(vb.ymax-vb.ymin);
-
- CLAMP(G.scene->r.border.xmin, 0.0, 1.0);
- CLAMP(G.scene->r.border.ymin, 0.0, 1.0);
- CLAMP(G.scene->r.border.xmax, 0.0, 1.0);
- CLAMP(G.scene->r.border.ymax, 0.0, 1.0);
-
- allqueue(REDRAWVIEWCAM, 1);
-
- /* drawing a border surrounding the entire camera view switches off border rendering
- * or the border covers no pixels */
- if ((G.scene->r.border.xmin <= 0.0 && G.scene->r.border.xmax >= 1.0 &&
- G.scene->r.border.ymin <= 0.0 && G.scene->r.border.ymax >= 1.0) ||
- (G.scene->r.border.xmin == G.scene->r.border.xmax ||
- G.scene->r.border.ymin == G.scene->r.border.ymax ))
- {
- G.scene->r.mode &= ~R_BORDER;
- } else {
- G.scene->r.mode |= R_BORDER;
- }
-
- allqueue(REDRAWBUTSSCENE, 1);
- }
-}
-
-void view3d_border_zoom(void)
-{
- /* Zooms in on a border drawn by the user */
- rcti rect;
- short val;
- float dvec[3], vb[2], xscale, yscale, scale;
-
- /* SMOOTHVIEW */
- float new_dist;
- float new_ofs[3];
-
- /* doesn't work fine for perspective */
- if(G.vd->persp==1)
- return;
-
- val = get_border(&rect, 3); //box select input
- if(val)
- {
- /* find the current window width and height */
- vb[0] = G.vd->area->winx;
- vb[1] = G.vd->area->winy;
-
- new_dist = G.vd->dist;
- new_ofs[0] = G.vd->ofs[0];
- new_ofs[1] = G.vd->ofs[1];
- new_ofs[2] = G.vd->ofs[2];
-
- /* convert the drawn rectangle into 3d space */
- initgrabz(-new_ofs[0], -new_ofs[1], -new_ofs[2]);
-
- window_to_3d(dvec, (rect.xmin+rect.xmax-vb[0])/2, (rect.ymin+rect.ymax-vb[1])/2);
-
- /* center the view to the center of the rectangle */
- VecSubf(new_ofs, new_ofs, dvec);
-
- /* work out the ratios, so that everything selected fits when we zoom */
- xscale = ((rect.xmax-rect.xmin)/vb[0]);
- yscale = ((rect.ymax-rect.ymin)/vb[1]);
- scale = (xscale >= yscale)?xscale:yscale;
-
- /* zoom in as required, or as far as we can go */
- new_dist = ((new_dist*scale) >= 0.001*G.vd->grid)? new_dist*scale:0.001*G.vd->grid;
-
- smooth_view(G.vd, new_ofs, NULL, &new_dist, NULL);
-
- }
-}
-
-void fly(void)
-{
- /*
- fly mode - Shift+F
- a fly loop where the user can move move the view as if they are flying
- */
- float speed=0.0, /* the speed the view is moving per redraw */
- mat[3][3], /* 3x3 copy of the view matrix so we can move allong the view axis */
- dvec[3]={0,0,0}, /* this is the direction thast added to the view offset per redraw */
- dvec_old[3]={0,0,0}, /* old for some lag */
- dvec_tmp[3]={0,0,0}, /* old for some lag */
- dvec_lag=0.0, /* old for some lag */
-
- /* Camera Uprighting variables */
- roll, /* similar to the angle between the camera's up and the Z-up, but its very rough so just roll*/
- upvec[3]={0,0,0}, /* stores the view's up vector */
-
- dist_backup, /* backup the views distance since we use a zero dist for fly mode */
- rot_backup[4], /* backup the views quat incase the user cancels flying in non camera mode */
- ofs_backup[3], /* backup the views offset incase the user cancels flying in non camera mode */
- moffset[2], /* mouse offset from the views center */
- tmp_quat[4], /* used for rotating the view */
- winxf, winyf, /* scale the mouse movement by this value - scales mouse movement to the view size */
- time_redraw, time_redraw_clamped, time_wheel; /*time how fast it takes for us to redraw, this is so simple scenes dont fly too fast */
-
- /* time_lastwheel is used to accelerate when using the mousewheel a lot */
- double time_current, time_lastdraw, time_currwheel, time_lastwheel;
-
- short val, /* used for toets to see if a buttons pressed */
- cent_orig[2], /* view center */
- cent[2], /* view center modified */
- mval[2], /* mouse location */
- action=0, /* while zero stay in fly mode and wait for action, also used to see if we accepted or canceled 1:ok 2:Cancel */
- xmargin, ymargin; /* x and y margin are define the safe area where the mouses movement wont rotate the view */
- unsigned short
- toets; /* for reading the event */
- unsigned char
- apply_rotation= 1, /* if the user presses shift they can look about without movinf the direction there looking*/
- axis= 2, /* Axis index to move allong by default Z to move allong the view */
- persp_backup, /* remember if were ortho or not, only used for restoring the view if it was a ortho view */
- pan_view=0; /* if true, pan the view instead of rotating */
-
- /* relative view axis locking - xlock, zlock
- 0; disabled
- 1; enabled but not checking because mouse hasnt moved outside the margin since locking was checked an not needed
- when the mouse moves, locking is set to 2 so checks are done.
- 2; mouse moved and checking needed, if no view altering is donem its changed back to 1 */
- short xlock=0, zlock=0;
- float xlock_momentum=0.0f, zlock_momentum=0.0f; /* nicer dynamics */
-
- /* for recording */
- int playing_anim = has_screenhandler(G.curscreen, SCREEN_HANDLER_ANIM);
- int cfra = -1; /*so the first frame always has a key added */
- char *actname="";
-
- if(curarea->spacetype!=SPACE_VIEW3D) return;
-
- if(G.vd->persp==2 && G.vd->camera->id.lib) {
- error("Cannot fly a camera from an external library");
- return;
- }
-
- if(G.vd->ob_centre) {
- error("Cannot fly when the view is locked to an object");
- return;
- }
-
-
- /* detect weather to start with Z locking */
- upvec[0]=1; upvec[1]=0; upvec[2]=0;
- Mat3CpyMat4(mat, G.vd->viewinv);
- Mat3MulVecfl(mat, upvec);
- if (fabs(upvec[2]) < 0.1)
- zlock = 1;
- upvec[0]=0; upvec[1]=0; upvec[2]=0;
-
- persp_backup= G.vd->persp;
- dist_backup= G.vd->dist;
- if (G.vd->persp==2) { /* Camera */
- if(G.vd->camera->constraints.first) {
- error("Cannot fly an object with constraints");
- return;
- }
-
- /* store the origoinal camera loc and rot */
- VECCOPY(ofs_backup, G.vd->camera->loc);
- VECCOPY(rot_backup, G.vd->camera->rot);
-
- where_is_object(G.vd->camera);
- VECCOPY(G.vd->ofs, G.vd->camera->obmat[3]);
- VecMulf(G.vd->ofs, -1.0f); /*flip the vector*/
-
- G.vd->dist=0.0;
- G.vd->viewbut=0;
-
- /* used for recording */
- if(G.vd->camera->ipoflag & OB_ACTION_OB)
- actname= "Object";
-
- } else {
- /* perspective or ortho */
- if (G.vd->persp==0)
- G.vd->persp= 1; /*if ortho projection, make perspective */
- QUATCOPY(rot_backup, G.vd->viewquat);
- VECCOPY(ofs_backup, G.vd->ofs);
- G.vd->dist= 0.0;
-
- upvec[2]=dist_backup; /*x and y are 0*/
- Mat3MulVecfl(mat, upvec);
- VecSubf(G.vd->ofs, G.vd->ofs, upvec);
- /*Done with correcting for the dist*/
- }
-
- /* the dist defines a vector that is infront of the offset
- to rotate the view about.
- this is no good for fly mode because we
- want to rotate about the viewers center.
- but to correct the dist removal we must
- alter offset so the view dosent jump. */
-
- xmargin= (short)((float)(curarea->winx)/20.0);
- ymargin= (short)((float)(curarea->winy)/20.0);
-
- cent_orig[0]= curarea->winrct.xmin+(curarea->winx)/2;
- cent_orig[1]= curarea->winrct.ymin+(curarea->winy)/2;
-
- warp_pointer(cent_orig[0], cent_orig[1]);
-
- /* we have to rely on events to give proper mousecoords after a warp_pointer */
- mval[0]= cent[0]= (curarea->winx)/2;
- mval[1]= cent[1]= (curarea->winy)/2;
- /* window size minus margin - use this to get the mouse range for rotation */
- winxf= (float)(curarea->winx)-(xmargin*2);
- winyf= (float)(curarea->winy)-(ymargin*2);
-
-
- time_lastdraw= time_lastwheel= PIL_check_seconds_timer();
-
- G.vd->flag2 |= V3D_FLYMODE; /* so we draw the corner margins */
- scrarea_do_windraw(curarea);
- screen_swapbuffers();
-
- while(action==0) { /* keep flying, no acton taken */
- while(qtest()) {
- toets= extern_qread(&val);
-
- if(val) {
- if(toets==MOUSEY) getmouseco_areawin(mval);
- else if(toets==ESCKEY || toets==RIGHTMOUSE) {
- action= 2; /* Canceled */
- break;
- } else if(toets==SPACEKEY || toets==LEFTMOUSE) {
- action= 1; /* Accepted */
- break;
- } else if(toets==PADPLUSKEY || toets==EQUALKEY || toets==WHEELUPMOUSE) {
- time_currwheel= PIL_check_seconds_timer();
- time_wheel = (float)(time_currwheel - time_lastwheel);
- time_lastwheel = time_currwheel;
- /*printf("Wheel %f\n", time_wheel);*/
- /*Mouse wheel delays range from 0.5==slow to 0.01==fast*/
- time_wheel = 1+ (10 - (20*MIN2(time_wheel, 0.5))); /* 0-0.5 -> 0-5.0 */
-
- if (speed<0) speed=0;
- else {
- if (G.qual & LR_SHIFTKEY)
- speed+= G.vd->grid*time_wheel*0.1;
- else
- speed+= G.vd->grid*time_wheel;
- }
-
- } else if(toets==PADMINUS || toets==MINUSKEY || toets==WHEELDOWNMOUSE) {
- time_currwheel= PIL_check_seconds_timer();
- time_wheel = (float)(time_currwheel - time_lastwheel);
- time_lastwheel = time_currwheel;
- time_wheel = 1+ (10 - (20*MIN2(time_wheel, 0.5))); /* 0-0.5 -> 0-5.0 */
-
- if (speed>0) speed=0;
- else {
- if (G.qual & LR_SHIFTKEY)
- speed-= G.vd->grid*time_wheel*0.1;
- else
- speed-= G.vd->grid*time_wheel;
- }
-
- } else if (toets==MIDDLEMOUSE) {
- /* make it so the camera direction dosent follow the view
- good for flying backwards! - Only when MMB is held */
-
- /*apply_rotation=0;*/
- pan_view= 1;
-
- /* impliment WASD keys */
- } else if(toets==WKEY) {
- if (speed<0) speed=-speed; /* flip speed rather then stopping, game like motion */
- else speed+= G.vd->grid; /* increse like mousewheel if were alredy moving in that difection*/
- axis= 2;
- } else if(toets==SKEY) { /*SAME as above but flipped */
- if (speed>0) speed=-speed;
- else speed-= G.vd->grid;
- axis= 2;
-
- } else if(toets==AKEY) {
- if (speed<0) speed=-speed;
- axis= 0;
- } else if(toets==DKEY) {
- if (speed>0) speed=-speed;
- axis= 0;
- } else if(toets==FKEY) {
- if (speed<0) speed=-speed;
- axis= 1;
- } else if(toets==RKEY) {
- if (speed>0) speed=-speed;
- axis= 1;
-
- /* axis locking */
- } else if(toets==XKEY) {
- if (xlock) xlock=0;
- else {
- xlock = 2;
- xlock_momentum = 0.0;
- }
- } else if(toets==ZKEY) {
- if (zlock) zlock=0;
- else {
- zlock = 2;
- zlock_momentum = 0.0;
- }
- }
-
- } else {
- /* mouse buttons lifted */
- if (toets==MIDDLEMOUSE && pan_view) {
- /*apply_rotation=1;*/
- warp_pointer(cent_orig[0], cent_orig[1]);
- pan_view= 0;
- }
- }
- }
- if(action != 0) break;
-
- moffset[0]= mval[0]-cent[0];
- moffset[1]= mval[1]-cent[1];
-
- /* enforce a view margin */
- if (moffset[0]>xmargin) moffset[0]-=xmargin;
- else if (moffset[0]<-xmargin)moffset[0]+=xmargin;
- else moffset[0]=0;
-
- if (moffset[1]>ymargin) moffset[1]-=ymargin;
- else if (moffset[1]<-ymargin)moffset[1]+=ymargin;
- else moffset[1]=0;
-
- /* scale the mouse offset so the distance the mouse moves isnt linear */
- if (moffset[0]) {
- moffset[0]= moffset[0]/winxf;
- moffset[0]= moffset[0]*fabs(moffset[0]);
- }
-
- if (moffset[1]) {
- moffset[1]= moffset[1]/winyf;
- moffset[1]= moffset[1]*fabs(moffset[1]);
- }
-
- /* Should we redraw? */
- if(speed!=0.0 || moffset[0] || moffset[1] || zlock || xlock || dvec[0] || dvec[1] || dvec[2] ) {
-
- time_current= PIL_check_seconds_timer();
- time_redraw= (float)(time_current-time_lastdraw);
- time_redraw_clamped= MIN2(0.05, time_redraw); /* clamt the redraw time to avoid jitter in roll correction */
- time_lastdraw= time_current;
- /*fprintf(stderr, "%f\n", time_redraw);*/ /* 0.002 is a small redraw 0.02 is larger */
-
- /* Scale the time to use shift to scale the speed down- just like
- shift slows many other areas of blender down */
- if (G.qual & LR_SHIFTKEY)
- speed= speed * (1-time_redraw_clamped);
-
- Mat3CpyMat4(mat, G.vd->viewinv);
-
- if (pan_view) {
- /* pan only */
- dvec_tmp[0]= -moffset[0];
- dvec_tmp[1]= -moffset[1];
- dvec_tmp[2]= 0;
-
- if (G.qual & LR_SHIFTKEY) {
- dvec_tmp[0] *= 0.1;
- dvec_tmp[1] *= 0.1;
- }
-
- Mat3MulVecfl(mat, dvec_tmp);
- VecMulf(dvec_tmp, time_redraw*200.0 * G.vd->grid);
-
- } else {
- /* rotate about the X axis- look up/down */
- if (moffset[1]) {
- upvec[0]=1;
- upvec[1]=0;
- upvec[2]=0;
- Mat3MulVecfl(mat, upvec);
- VecRotToQuat( upvec, (float)moffset[1]*-time_redraw*20, tmp_quat); /* Rotate about the relative up vec */
- QuatMul(G.vd->viewquat, G.vd->viewquat, tmp_quat);
-
- if (xlock) xlock = 2; /*check for rotation*/
- if (zlock) zlock = 2;
- xlock_momentum= 0.0;
- }
-
- /* rotate about the Y axis- look left/right */
- if (moffset[0]) {
-
- if (zlock) {
- upvec[0]=0;
- upvec[1]=0;
- upvec[2]=1;
- } else {
- upvec[0]=0;
- upvec[1]=1;
- upvec[2]=0;
- Mat3MulVecfl(mat, upvec);
- }
-
- VecRotToQuat( upvec, (float)moffset[0]*time_redraw*20, tmp_quat); /* Rotate about the relative up vec */
- QuatMul(G.vd->viewquat, G.vd->viewquat, tmp_quat);
-
- if (xlock) xlock = 2;/*check for rotation*/
- if (zlock) zlock = 2;
- }
-
- if (zlock==2) {
- upvec[0]=1;
- upvec[1]=0;
- upvec[2]=0;
- Mat3MulVecfl(mat, upvec);
-
- /*make sure we have some z rolling*/
- if (fabs(upvec[2]) > 0.00001) {
- roll= upvec[2]*5;
- upvec[0]=0; /*rotate the view about this axis*/
- upvec[1]=0;
- upvec[2]=1;
-
- Mat3MulVecfl(mat, upvec);
- VecRotToQuat( upvec, roll*time_redraw_clamped*zlock_momentum*0.1, tmp_quat); /* Rotate about the relative up vec */
- QuatMul(G.vd->viewquat, G.vd->viewquat, tmp_quat);
-
- zlock_momentum += 0.05;
- } else {
- zlock=1; /* dont check until the view rotates again */
- zlock_momentum= 0.0;
- }
- }
-
- if (xlock==2 && moffset[1]==0) { /*only apply xcorrect when mouse isnt applying x rot*/
- upvec[0]=0;
- upvec[1]=0;
- upvec[2]=1;
- Mat3MulVecfl(mat, upvec);
- /*make sure we have some z rolling*/
- if (fabs(upvec[2]) > 0.00001) {
- roll= upvec[2]*-5;
-
- upvec[0]=1; /*rotate the view about this axis*/
- upvec[1]=0;
- upvec[2]=0;
-
- Mat3MulVecfl(mat, upvec);
-
- VecRotToQuat( upvec, roll*time_redraw_clamped*xlock_momentum*0.1, tmp_quat); /* Rotate about the relative up vec */
- QuatMul(G.vd->viewquat, G.vd->viewquat, tmp_quat);
-
- xlock_momentum += 0.05;
- } else {
- xlock=1; /* see above */
- xlock_momentum= 0.0;
- }
- }
-
-
- if (apply_rotation) {
- /* Normal operation */
- /* define dvec, view direction vector */
- dvec_tmp[0]= dvec_tmp[1]= dvec_tmp[2]= 0;
- /* move along the current axis */
- dvec_tmp[axis]= 1.0f;
-
- Mat3MulVecfl(mat, dvec_tmp);
-
- VecMulf(dvec_tmp, speed*time_redraw*0.25);
- }
- }
-
- /* impose a directional lag */
- dvec_lag = 1.0/(1+(time_redraw*5));
- dvec[0] = dvec_tmp[0]*(1-dvec_lag) + dvec_old[0]*dvec_lag;
- dvec[1] = dvec_tmp[1]*(1-dvec_lag) + dvec_old[1]*dvec_lag;
- dvec[2] = dvec_tmp[2]*(1-dvec_lag) + dvec_old[2]*dvec_lag;
-
-
- if (G.vd->persp==2) {
- if (G.vd->camera->protectflag & OB_LOCK_LOCX)
- dvec[0] = 0.0;
- if (G.vd->camera->protectflag & OB_LOCK_LOCY)
- dvec[1] = 0.0;
- if (G.vd->camera->protectflag & OB_LOCK_LOCZ)
- dvec[2] = 0.0;
- }
-
- VecAddf(G.vd->ofs, G.vd->ofs, dvec);
- if (zlock && xlock)
- headerprint("FlyKeys Speed:(+/- | Wheel), Upright Axis:X on/Z on, Slow:Shift, Direction:WASDRF, Ok:LMB, Pan:MMB, Cancel:RMB");
- else if (zlock)
- headerprint("FlyKeys Speed:(+/- | Wheel), Upright Axis:X off/Z on, Slow:Shift, Direction:WASDRF, Ok:LMB, Pan:MMB, Cancel:RMB");
- else if (xlock)
- headerprint("FlyKeys Speed:(+/- | Wheel), Upright Axis:X on/Z off, Slow:Shift, Direction:WASDRF, Ok:LMB, Pan:MMB, Cancel:RMB");
- else
- headerprint("FlyKeys Speed:(+/- | Wheel), Upright Axis:X off/Z off, Slow:Shift, Direction:WASDRF, Ok:LMB, Pan:MMB, Cancel:RMB");
-
- do_screenhandlers(G.curscreen); /* advance the next frame */
-
- /* we are in camera view so apply the view ofs and quat to the view matrix and set the camera to teh view */
- if (G.vd->persp==2) {
- G.vd->persp= 1; /*set this so setviewmatrixview3d uses the ofs and quat instead of the camera */
- setviewmatrixview3d();
- setcameratoview3d();
- G.vd->persp= 2;
-
- /* record the motion */
- if (G.flags & G_RECORDKEYS && (!playing_anim || cfra != G.scene->r.cfra)) {
- cfra = G.scene->r.cfra;
-
- if (xlock || zlock || moffset[0] || moffset[1]) {
- insertkey(&G.vd->camera->id, ID_OB, actname, NULL, OB_ROT_X, 0);
- insertkey(&G.vd->camera->id, ID_OB, actname, NULL, OB_ROT_Y, 0);
- insertkey(&G.vd->camera->id, ID_OB, actname, NULL, OB_ROT_Z, 0);
- }
- if (speed) {
- insertkey(&G.vd->camera->id, ID_OB, actname, NULL, OB_LOC_X, 0);
- insertkey(&G.vd->camera->id, ID_OB, actname, NULL, OB_LOC_Y, 0);
- insertkey(&G.vd->camera->id, ID_OB, actname, NULL, OB_LOC_Z, 0);
- }
- }
- }
- scrarea_do_windraw(curarea);
- screen_swapbuffers();
- } else
- /*were not redrawing but we need to update the time else the view will jump */
- time_lastdraw= PIL_check_seconds_timer();
- /* end drawing */
- VECCOPY(dvec_old, dvec);
- }
-
- G.vd->dist= dist_backup;
-
- /* Revert to original view? */
- if (action == 2) { /* action == 2 means the user pressed Esc of RMB, and not to apply view to camera */
- if (persp_backup==2) { /* a camera view */
- G.vd->viewbut=1;
- VECCOPY(G.vd->camera->loc, ofs_backup);
- VECCOPY(G.vd->camera->rot, rot_backup);
- DAG_object_flush_update(G.scene, G.vd->camera, OB_RECALC_OB);
- } else {
- /* Non Camera we need to reset the view back to the original location bacause the user canceled*/
- QUATCOPY(G.vd->viewquat, rot_backup);
- VECCOPY(G.vd->ofs, ofs_backup);
- G.vd->persp= persp_backup;
- }
- }
- else if (persp_backup==2) { /* camera */
- float mat3[3][3];
- Mat3CpyMat4(mat3, G.vd->camera->obmat);
- Mat3ToCompatibleEul(mat3, G.vd->camera->rot, rot_backup);
-
- DAG_object_flush_update(G.scene, G.vd->camera, OB_RECALC_OB);
-
- if (G.flags & G_RECORDKEYS) {
- allqueue(REDRAWIPO, 0);
- allspace(REMAKEIPO, 0);
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWTIME, 0);
- }
- }
- else { /* not camera */
- /* Apply the fly mode view */
- /*restore the dist*/
- upvec[0]= upvec[1]= 0;
- upvec[2]=dist_backup; /*x and y are 0*/
- Mat3CpyMat4(mat, G.vd->viewinv);
- Mat3MulVecfl(mat, upvec);
- VecAddf(G.vd->ofs, G.vd->ofs, upvec);
- /*Done with correcting for the dist */
- }
-
- G.vd->flag2 &= ~V3D_FLYMODE;
- allqueue(REDRAWVIEW3D, 0);
- BIF_view3d_previewrender_signal(curarea, PR_DBASE|PR_DISPRECT); /* not working at the moment not sure why */
-}
-
-void view3d_edit_clipping(View3D *v3d)
-{
-
- if(v3d->flag & V3D_CLIPPING) {
- v3d->flag &= ~V3D_CLIPPING;
- scrarea_queue_winredraw(curarea);
- if(v3d->clipbb) MEM_freeN(v3d->clipbb);
- v3d->clipbb= NULL;
- }
- else {
- rcti rect;
- double mvmatrix[16];
- double projmatrix[16];
- double xs, ys, p[3];
- GLint viewport[4];
- short val;
-
- /* get border in window coords */
- setlinestyle(2);
- val= get_border(&rect, 3);
- setlinestyle(0);
- if(val==0) return;
-
- v3d->flag |= V3D_CLIPPING;
- v3d->clipbb= MEM_mallocN(sizeof(BoundBox), "clipbb");
-
- /* convert border to 3d coordinates */
-
- /* Get the matrices needed for gluUnProject */
- glGetIntegerv(GL_VIEWPORT, viewport);
- glGetDoublev(GL_MODELVIEW_MATRIX, mvmatrix);
- glGetDoublev(GL_PROJECTION_MATRIX, projmatrix);
-
- /* near zero floating point values can give issues with gluUnProject
- in side view on some implementations */
- if(fabs(mvmatrix[0]) < 1e-6) mvmatrix[0]= 0.0;
- if(fabs(mvmatrix[5]) < 1e-6) mvmatrix[5]= 0.0;
-
- /* Set up viewport so that gluUnProject will give correct values */
- viewport[0] = 0;
- viewport[1] = 0;
-
- /* four clipping planes and bounding volume */
- /* first do the bounding volume */
- for(val=0; val<4; val++) {
-
- xs= (val==0||val==3)?rect.xmin:rect.xmax;
- ys= (val==0||val==1)?rect.ymin:rect.ymax;
-
- gluUnProject(xs, ys, 0.0, mvmatrix, projmatrix, viewport, &p[0], &p[1], &p[2]);
- VECCOPY(v3d->clipbb->vec[val], p);
-
- gluUnProject(xs, ys, 1.0, mvmatrix, projmatrix, viewport, &p[0], &p[1], &p[2]);
- VECCOPY(v3d->clipbb->vec[4+val], p);
- }
-
- /* then plane equations */
- for(val=0; val<4; val++) {
-
- CalcNormFloat(v3d->clipbb->vec[val], v3d->clipbb->vec[val==3?0:val+1], v3d->clipbb->vec[val+4],
- v3d->clip[val]);
-
- v3d->clip[val][3]= - v3d->clip[val][0]*v3d->clipbb->vec[val][0]
- - v3d->clip[val][1]*v3d->clipbb->vec[val][1]
- - v3d->clip[val][2]*v3d->clipbb->vec[val][2];
- }
- }
-}
-
diff --git a/source/blender/src/eventdebug.c b/source/blender/src/eventdebug.c
deleted file mode 100644
index 6c6a137a789..00000000000
--- a/source/blender/src/eventdebug.c
+++ /dev/null
@@ -1,195 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-#include "mydevice.h"
-#include "blendef.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-char *event_to_string(short);
-
-char *event_to_string(short evt) {
-#define smap(evt) case evt: return #evt
- switch (evt) {
- default: return "<unknown>";
- smap(CHANGED);
- smap(DRAWEDGES);
- smap(BACKBUFDRAW);
- smap(EXECUTE);
- smap(LOAD_FILE);
- smap(RESHAPE);
- smap(UI_BUT_EVENT);
- smap(REDRAWVIEW3D);
- smap(REDRAWVIEWCAM);
- smap(REDRAWHEADERS);
- smap(REDRAWVIEW3D_Z);
- smap(REDRAWALL);
- smap(REDRAWINFO);
- smap(RENDERPREVIEW);
- smap(REDRAWIPO);
- smap(REDRAWDATASELECT);
- smap(REDRAWSEQ);
- smap(REDRAWIMAGE);
- smap(REDRAWOOPS);
- smap(REDRAWIMASEL);
- smap(AFTERIMASELIMA);
- smap(AFTERIMASELGET);
- smap(AFTERIMAWRITE);
- smap(IMALEFTMOUSE);
- smap(AFTERPIBREAD);
- smap(REDRAWTEXT);
- smap(REDRAWSCRIPT);
- smap(REDRAWACTION);
- smap(LEFTMOUSE);
- smap(MIDDLEMOUSE);
- smap(RIGHTMOUSE);
- smap(MOUSEX);
- smap(MOUSEY);
- smap(TIMER0);
- smap(TIMER1);
- smap(TIMER2);
- smap(TIMER3);
- smap(KEYBD);
- smap(RAWKEYBD);
- smap(REDRAW);
- smap(INPUTCHANGE);
- smap(QFULL);
- smap(WINFREEZE);
- smap(WINTHAW);
- smap(WINCLOSE);
- smap(WINQUIT);
- smap(Q_FIRSTTIME);
- smap(AKEY);
- smap(BKEY);
- smap(CKEY);
- smap(DKEY);
- smap(EKEY);
- smap(FKEY);
- smap(GKEY);
- smap(HKEY);
- smap(IKEY);
- smap(JKEY);
- smap(KKEY);
- smap(LKEY);
- smap(MKEY);
- smap(NKEY);
- smap(OKEY);
- smap(PKEY);
- smap(QKEY);
- smap(RKEY);
- smap(SKEY);
- smap(TKEY);
- smap(UKEY);
- smap(VKEY);
- smap(WKEY);
- smap(XKEY);
- smap(YKEY);
- smap(ZKEY);
- smap(ZEROKEY);
- smap(ONEKEY);
- smap(TWOKEY);
- smap(THREEKEY);
- smap(FOURKEY);
- smap(FIVEKEY);
- smap(SIXKEY);
- smap(SEVENKEY);
- smap(EIGHTKEY);
- smap(NINEKEY);
- smap(CAPSLOCKKEY);
- smap(LEFTCTRLKEY);
- smap(LEFTALTKEY);
- smap(RIGHTALTKEY);
- smap(RIGHTCTRLKEY);
- smap(RIGHTSHIFTKEY);
- smap(LEFTSHIFTKEY);
- smap(ESCKEY);
- smap(TABKEY);
- smap(RETKEY);
- smap(SPACEKEY);
- smap(LINEFEEDKEY);
- smap(BACKSPACEKEY);
- smap(DELKEY);
- smap(SEMICOLONKEY);
- smap(PERIODKEY);
- smap(COMMAKEY);
- smap(QUOTEKEY);
- smap(ACCENTGRAVEKEY);
- smap(MINUSKEY);
- smap(SLASHKEY);
- smap(BACKSLASHKEY);
- smap(EQUALKEY);
- smap(LEFTBRACKETKEY);
- smap(RIGHTBRACKETKEY);
- smap(LEFTARROWKEY);
- smap(DOWNARROWKEY);
- smap(RIGHTARROWKEY);
- smap(UPARROWKEY);
- smap(PAD0);
- smap(PAD1);
- smap(PAD2);
- smap(PAD3);
- smap(PAD4);
- smap(PAD5);
- smap(PAD6);
- smap(PAD7);
- smap(PAD8);
- smap(PAD9);
- smap(PADPERIOD);
- smap(PADSLASHKEY);
- smap(PADASTERKEY);
- smap(PADMINUS);
- smap(PADENTER);
- smap(PADPLUSKEY);
- smap(F1KEY);
- smap(F2KEY);
- smap(F3KEY);
- smap(F4KEY);
- smap(F5KEY);
- smap(F6KEY);
- smap(F7KEY);
- smap(F8KEY);
- smap(F9KEY);
- smap(F10KEY);
- smap(F11KEY);
- smap(F12KEY);
- smap(PAUSEKEY);
- smap(INSERTKEY);
- smap(HOMEKEY);
- smap(PAGEUPKEY);
- smap(PAGEDOWNKEY);
- smap(ENDKEY);
- smap(REDRAWNLA);
- smap(ONLOAD_SCRIPT);
- }
- #undef smap
-}
diff --git a/source/blender/src/filelist.c b/source/blender/src/filelist.c
deleted file mode 100644
index 59430ef8778..00000000000
--- a/source/blender/src/filelist.c
+++ /dev/null
@@ -1,1135 +0,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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2007 Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-
-/* global includes */
-
-#include <stdlib.h>
-#include <math.h>
-#include <string.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef WIN32
-#include <unistd.h>
-#else
-#include <io.h>
-#include <direct.h>
-#endif
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_linklist.h"
-#include "BLI_storage_types.h"
-
-#ifdef WIN32
-#include "BLI_winstuff.h"
-#endif
-
-#include "BKE_utildefines.h"
-#include "BKE_global.h"
-#include "BIF_filelist.h"
-#include "BKE_library.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BLO_readfile.h"
-
-#include "DNA_space_types.h"
-#include "DNA_ipo_types.h"
-#include "DNA_ID.h"
-#include "DNA_object_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_material_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_world_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_userdef_types.h"
-
-#include "IMB_imbuf.h"
-#include "IMB_imbuf_types.h"
-#include "IMB_thumbs.h"
-
-#include "PIL_time.h"
-
-#include "datatoc.h"
-
-/* Elubie: VERY, really very ugly and evil! Remove asap!!! */
-/* for state of file */
-#define ACTIVE 2
-
-/* max length of library group name within filesel */
-#define GROUP_MAX 32
-
-typedef struct FileList
-{
- struct direntry *filelist;
- int *fidx;
-
- int numfiles;
- int numfiltered;
- char dir[FILE_MAXDIR];
- short type;
- short ipotype;
- struct BlendHandle *libfiledata;
- int has_func;
- short prv_w;
- short prv_h;
- short hide_dot;
- unsigned int filter;
-} FileList;
-
-int BIF_groupname_to_code(char *group)
-{
- char buf[32];
- char *lslash;
-
- BLI_strncpy(buf, group, 31);
- lslash= BLI_last_slash(buf);
- if (lslash)
- lslash[0]= '\0';
-
- return BLO_idcode_from_name(buf);
-}
-
-
-#define SPECIAL_IMG_SIZE 48
-#define SPECIAL_IMG_ROWS 4
-#define SPECIAL_IMG_COLS 4
-
-#define SPECIAL_IMG_FOLDER 0
-#define SPECIAL_IMG_PARENT 1
-#define SPECIAL_IMG_REFRESH 2
-#define SPECIAL_IMG_BLENDFILE 3
-#define SPECIAL_IMG_SOUNDFILE 4
-#define SPECIAL_IMG_MOVIEFILE 5
-#define SPECIAL_IMG_PYTHONFILE 6
-#define SPECIAL_IMG_TEXTFILE 7
-#define SPECIAL_IMG_FONTFILE 8
-#define SPECIAL_IMG_UNKNOWNFILE 9
-#define SPECIAL_IMG_MAX SPECIAL_IMG_UNKNOWNFILE + 1
-
-static ImBuf* gSpecialFileImages[SPECIAL_IMG_MAX];
-
-
-/* ******************* SORT ******************* */
-
-static int compare_name(const void *a1, const void *a2)
-{
- const struct direntry *entry1=a1, *entry2=a2;
-
- /* type is is equal to stat.st_mode */
-
- if (S_ISDIR(entry1->type)){
- if (S_ISDIR(entry2->type)==0) return (-1);
- } else{
- if (S_ISDIR(entry2->type)) return (1);
- }
- if (S_ISREG(entry1->type)){
- if (S_ISREG(entry2->type)==0) return (-1);
- } else{
- if (S_ISREG(entry2->type)) return (1);
- }
- if ((entry1->type & S_IFMT) < (entry2->type & S_IFMT)) return (-1);
- if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1);
-
- /* make sure "." and ".." are always first */
- if( strcmp(entry1->relname, ".")==0 ) return (-1);
- if( strcmp(entry2->relname, ".")==0 ) return (1);
- if( strcmp(entry1->relname, "..")==0 ) return (-1);
-
- return (BLI_strcasecmp(entry1->relname,entry2->relname));
-}
-
-static int compare_date(const void *a1, const void *a2)
-{
- const struct direntry *entry1=a1, *entry2=a2;
-
- /* type is equal to stat.st_mode */
-
- if (S_ISDIR(entry1->type)){
- if (S_ISDIR(entry2->type)==0) return (-1);
- } else{
- if (S_ISDIR(entry2->type)) return (1);
- }
- if (S_ISREG(entry1->type)){
- if (S_ISREG(entry2->type)==0) return (-1);
- } else{
- if (S_ISREG(entry2->type)) return (1);
- }
- if ((entry1->type & S_IFMT) < (entry2->type & S_IFMT)) return (-1);
- if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1);
-
- /* make sure "." and ".." are always first */
- if( strcmp(entry1->relname, ".")==0 ) return (-1);
- if( strcmp(entry2->relname, ".")==0 ) return (1);
- if( strcmp(entry1->relname, "..")==0 ) return (-1);
-
- if ( entry1->s.st_mtime < entry2->s.st_mtime) return 1;
- if ( entry1->s.st_mtime > entry2->s.st_mtime) return -1;
-
- else return BLI_strcasecmp(entry1->relname,entry2->relname);
-}
-
-static int compare_size(const void *a1, const void *a2)
-{
- const struct direntry *entry1=a1, *entry2=a2;
-
- /* type is equal to stat.st_mode */
-
- if (S_ISDIR(entry1->type)){
- if (S_ISDIR(entry2->type)==0) return (-1);
- } else{
- if (S_ISDIR(entry2->type)) return (1);
- }
- if (S_ISREG(entry1->type)){
- if (S_ISREG(entry2->type)==0) return (-1);
- } else{
- if (S_ISREG(entry2->type)) return (1);
- }
- if ((entry1->type & S_IFMT) < (entry2->type & S_IFMT)) return (-1);
- if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1);
-
- /* make sure "." and ".." are always first */
- if( strcmp(entry1->relname, ".")==0 ) return (-1);
- if( strcmp(entry2->relname, ".")==0 ) return (1);
- if( strcmp(entry1->relname, "..")==0 ) return (-1);
-
- if ( entry1->s.st_size < entry2->s.st_size) return 1;
- if ( entry1->s.st_size > entry2->s.st_size) return -1;
- else return BLI_strcasecmp(entry1->relname,entry2->relname);
-}
-
-static int compare_extension(const void *a1, const void *a2) {
- const struct direntry *entry1=a1, *entry2=a2;
- char *sufix1, *sufix2;
- char *nil="";
-
- if (!(sufix1= strstr (entry1->relname, ".blend.gz")))
- sufix1= strrchr (entry1->relname, '.');
- if (!(sufix2= strstr (entry2->relname, ".blend.gz")))
- sufix2= strrchr (entry2->relname, '.');
- if (!sufix1) sufix1= nil;
- if (!sufix2) sufix2= nil;
-
- /* type is is equal to stat.st_mode */
-
- if (S_ISDIR(entry1->type)){
- if (S_ISDIR(entry2->type)==0) return (-1);
- } else{
- if (S_ISDIR(entry2->type)) return (1);
- }
- if (S_ISREG(entry1->type)){
- if (S_ISREG(entry2->type)==0) return (-1);
- } else{
- if (S_ISREG(entry2->type)) return (1);
- }
- if ((entry1->type & S_IFMT) < (entry2->type & S_IFMT)) return (-1);
- if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1);
-
- /* make sure "." and ".." are always first */
- if( strcmp(entry1->relname, ".")==0 ) return (-1);
- if( strcmp(entry2->relname, ".")==0 ) return (1);
- if( strcmp(entry1->relname, "..")==0 ) return (-1);
- if( strcmp(entry2->relname, "..")==0 ) return (-1);
-
- return (BLI_strcasecmp(sufix1, sufix2));
-}
-
-void BIF_filelist_filter(FileList* filelist)
-{
- char dir[FILE_MAX], group[GROUP_MAX];
- int num_filtered = 0;
- int i, j;
-
- if (!filelist->filelist)
- return;
-
- if ( ( (filelist->type == FILE_LOADLIB) && BIF_filelist_islibrary(filelist, dir, group))
- || (filelist->type == FILE_MAIN) ) {
- filelist->filter = 0;
- }
-
- if (!filelist->filter) {
- if (filelist->fidx) {
- MEM_freeN(filelist->fidx);
- filelist->fidx = NULL;
- }
- filelist->fidx = (int *)MEM_callocN(filelist->numfiles*sizeof(int), "filteridx");
- for (i = 0; i < filelist->numfiles; ++i) {
- filelist->fidx[i] = i;
- }
- filelist->numfiltered = filelist->numfiles;
- return;
- }
-
- // How many files are left after filter ?
- for (i = 0; i < filelist->numfiles; ++i) {
- if (filelist->filelist[i].flags & filelist->filter) {
- num_filtered++;
- }
- else if (filelist->filelist[i].type & S_IFDIR) {
- if (filelist->filter & FOLDERFILE) {
- num_filtered++;
- }
- }
- }
-
- if (filelist->fidx) {
- MEM_freeN(filelist->fidx);
- filelist->fidx = NULL;
- }
- filelist->fidx = (int *)MEM_callocN(num_filtered*sizeof(int), "filteridx");
- filelist->numfiltered = num_filtered;
-
- for (i = 0, j=0; i < filelist->numfiles; ++i) {
- if (filelist->filelist[i].flags & filelist->filter) {
- filelist->fidx[j++] = i;
- }
- else if (filelist->filelist[i].type & S_IFDIR) {
- if (filelist->filter & FOLDERFILE) {
- filelist->fidx[j++] = i;
- }
- }
- }
-}
-
-void BIF_filelist_init_icons()
-{
- short x, y, k;
- ImBuf *bbuf;
- ImBuf *ibuf;
- bbuf = IMB_ibImageFromMemory((int *)datatoc_prvicons, datatoc_prvicons_size, IB_rect);
- if (bbuf) {
- for (y=0; y<SPECIAL_IMG_ROWS; y++) {
- for (x=0; x<SPECIAL_IMG_COLS; x++) {
- int tile = SPECIAL_IMG_COLS*y + x;
- if (tile < SPECIAL_IMG_MAX) {
- ibuf = IMB_allocImBuf(SPECIAL_IMG_SIZE, SPECIAL_IMG_SIZE, 32, IB_rect, 0);
- for (k=0; k<SPECIAL_IMG_SIZE; k++) {
- memcpy(&ibuf->rect[k*SPECIAL_IMG_SIZE], &bbuf->rect[(k+y*SPECIAL_IMG_SIZE)*SPECIAL_IMG_SIZE*SPECIAL_IMG_COLS+x*SPECIAL_IMG_SIZE], SPECIAL_IMG_SIZE*sizeof(int));
- }
- gSpecialFileImages[tile] = ibuf;
- }
- }
- }
- IMB_freeImBuf(bbuf);
- }
-
-}
-
-void BIF_filelist_free_icons()
-{
- int i;
- for (i=0; i < SPECIAL_IMG_MAX; ++i) {
- IMB_freeImBuf(gSpecialFileImages[i]);
- gSpecialFileImages[i] = NULL;
- }
-}
-
-struct FileList* BIF_filelist_new()
-{
- FileList* p = MEM_callocN( sizeof(FileList), "filelist" );
- p->filelist = 0;
- p->numfiles = 0;
- p->dir[0] = '\0';
- p->libfiledata = 0;
- p->type = 0;
- p->has_func = 0;
- p->filter = 0;
- return p;
-}
-
-struct FileList* BIF_filelist_copy(struct FileList* filelist)
-{
- FileList* p = BIF_filelist_new();
- BLI_strncpy(p->dir, filelist->dir, FILE_MAXDIR);
- p->filelist = NULL;
- p->fidx = NULL;
- p->type = filelist->type;
- p->ipotype = filelist->ipotype;
- p->has_func = filelist->has_func;
-
- return p;
-}
-
-void BIF_filelist_free(struct FileList* filelist)
-{
- int i;
-
- if (!filelist) {
- printf("Attemtping to delete empty filelist.\n");
- return;
- }
-
- if (filelist->fidx) {
- MEM_freeN(filelist->fidx);
- filelist->fidx = NULL;
- }
-
- for (i = 0; i < filelist->numfiles; ++i) {
- if (filelist->filelist[i].image) {
- IMB_freeImBuf(filelist->filelist[i].image);
- }
- filelist->filelist[i].image = 0;
- if (filelist->filelist[i].relname)
- MEM_freeN(filelist->filelist[i].relname);
- filelist->filelist[i].relname = 0;
- if (filelist->filelist[i].string)
- MEM_freeN(filelist->filelist[i].string);
- filelist->filelist[i].string = 0;
- }
-
- filelist->numfiles = 0;
- free(filelist->filelist);
- filelist->filelist = 0;
- filelist->filter = 0;
- filelist->numfiltered =0;
-}
-
-void BIF_filelist_freelib(struct FileList* filelist)
-{
- if(filelist->libfiledata)
- BLO_blendhandle_close(filelist->libfiledata);
- filelist->libfiledata= 0;
-}
-
-struct BlendHandle *BIF_filelist_lib(struct FileList* filelist)
-{
- return filelist->libfiledata;
-}
-
-int BIF_filelist_numfiles(struct FileList* filelist)
-{
- return filelist->numfiltered;
-}
-
-const char * BIF_filelist_dir(struct FileList* filelist)
-{
- return filelist->dir;
-}
-
-void BIF_filelist_setdir(struct FileList* filelist, const char *dir)
-{
- BLI_strncpy(filelist->dir, dir, FILE_MAXDIR);
-}
-
-void BIF_filelist_imgsize(struct FileList* filelist, short w, short h)
-{
- filelist->prv_w = w;
- filelist->prv_h = h;
-}
-
-void BIF_filelist_loadimage(struct FileList* filelist, int index)
-{
- ImBuf *imb = NULL;
- int imgwidth = filelist->prv_w;
- int imgheight = filelist->prv_h;
- short ex, ey, dx, dy;
- float scaledx, scaledy;
- int fidx = 0;
-
- if ( (index < 0) || (index >= filelist->numfiltered) ) {
- return;
- }
- fidx = filelist->fidx[index];
-
- if (!filelist->filelist[fidx].image)
- {
- if (filelist->type != FILE_MAIN)
- {
- if ( filelist->filelist[fidx].flags & IMAGEFILE ) {
- imb = IMB_thumb_manage(filelist->dir, filelist->filelist[fidx].relname, THB_NORMAL, THB_SOURCE_IMAGE);
- } else if ( filelist->filelist[fidx].flags & MOVIEFILE ) {
- imb = IMB_thumb_manage(filelist->dir, filelist->filelist[fidx].relname, THB_NORMAL, THB_SOURCE_MOVIE);
- if (!imb) {
- /* remember that file can't be loaded via IMB_open_anim */
- filelist->filelist[fidx].flags &= ~MOVIEFILE;
- filelist->filelist[fidx].flags |= MOVIEFILE_ICON;
- }
- }
- if (imb) {
- if (imb->x > imb->y) {
- scaledx = (float)imgwidth;
- scaledy = ( (float)imb->y/(float)imb->x )*imgwidth;
- }
- else {
- scaledy = (float)imgheight;
- scaledx = ( (float)imb->x/(float)imb->y )*imgheight;
- }
- ex = (short)scaledx;
- ey = (short)scaledy;
-
- dx = imgwidth - ex;
- dy = imgheight - ey;
-
- IMB_scaleImBuf(imb, ex, ey);
-
- }
- filelist->filelist[fidx].image = imb;
-
- }
- }
-}
-
-struct ImBuf * BIF_filelist_getimage(struct FileList* filelist, int index)
-{
- ImBuf* ibuf = NULL;
- int fidx = 0;
- if ( (index < 0) || (index >= filelist->numfiltered) ) {
- return NULL;
- }
- fidx = filelist->fidx[index];
- ibuf = filelist->filelist[fidx].image;
-
- if (ibuf == NULL) {
- struct direntry *file = &filelist->filelist[fidx];
- if (file->type & S_IFDIR) {
- if ( strcmp(filelist->filelist[fidx].relname, "..") == 0) {
- ibuf = gSpecialFileImages[SPECIAL_IMG_PARENT];
- } else if ( strcmp(filelist->filelist[fidx].relname, ".") == 0) {
- ibuf = gSpecialFileImages[SPECIAL_IMG_REFRESH];
- } else {
- ibuf = gSpecialFileImages[SPECIAL_IMG_FOLDER];
- }
- } else {
- ibuf = gSpecialFileImages[SPECIAL_IMG_UNKNOWNFILE];
- }
-
- if (file->flags & BLENDERFILE) {
- ibuf = gSpecialFileImages[SPECIAL_IMG_BLENDFILE];
- } else if ( (file->flags & MOVIEFILE) || (file->flags & MOVIEFILE_ICON) ) {
- ibuf = gSpecialFileImages[SPECIAL_IMG_MOVIEFILE];
- } else if (file->flags & SOUNDFILE) {
- ibuf = gSpecialFileImages[SPECIAL_IMG_SOUNDFILE];
- } else if (file->flags & PYSCRIPTFILE) {
- ibuf = gSpecialFileImages[SPECIAL_IMG_PYTHONFILE];
- } else if (file->flags & FTFONTFILE) {
- ibuf = gSpecialFileImages[SPECIAL_IMG_FONTFILE];
- } else if (file->flags & TEXTFILE) {
- ibuf = gSpecialFileImages[SPECIAL_IMG_TEXTFILE];
- }
- }
- return ibuf;
-}
-
-struct direntry * BIF_filelist_file(struct FileList* filelist, int index)
-{
- int fidx = 0;
-
- if ( (index < 0) || (index >= filelist->numfiltered) ) {
- return NULL;
- }
- fidx = filelist->fidx[index];
-
- return &filelist->filelist[fidx];
-}
-
-int BIF_filelist_find(struct FileList* filelist, char *file)
-{
- int index = -1;
- int i;
- int fidx = -1;
-
- if (!filelist->fidx)
- return fidx;
-
-
- for (i = 0; i < filelist->numfiles; ++i) {
- if ( strcmp(filelist->filelist[i].relname, file) == 0) {
- index = i;
- break;
- }
- }
-
- for (i = 0; i < filelist->numfiltered; ++i) {
- if (filelist->fidx[i] == index) {
- fidx = i;
- break;
- }
- }
- return fidx;
-}
-
-void BIF_filelist_hidedot(struct FileList* filelist, short hide)
-{
- filelist->hide_dot = hide;
-}
-
-void BIF_filelist_setfilter(struct FileList* filelist, unsigned int filter)
-{
- filelist->filter = filter;
-}
-
-void BIF_filelist_readdir(struct FileList* filelist)
-{
- char wdir[FILE_MAXDIR];
- int finished = 0;
-
- if (!filelist) return;
- filelist->fidx = 0;
- filelist->filelist = 0;
-
- if(filelist->type==FILE_MAIN) {
- BIF_filelist_from_main(filelist);
- finished = 1;
- } else if(filelist->type==FILE_LOADLIB) {
- BLI_cleanup_dir(G.sce, filelist->dir);
- BIF_filelist_from_library(filelist);
- if(filelist->libfiledata) {
- finished = 1;
- }
- }
-
- if (!finished) {
- BLI_getwdN(wdir);
-
- BLI_cleanup_dir(G.sce, filelist->dir);
- BLI_hide_dot_files(filelist->hide_dot);
- filelist->numfiles = BLI_getdir(filelist->dir, &(filelist->filelist));
-
- chdir(wdir);
- BIF_filelist_setfiletypes(filelist, G.have_quicktime);
- BIF_filelist_filter(filelist);
-
- }
-}
-
-int BIF_filelist_empty(struct FileList* filelist)
-{
- return filelist->filelist == 0;
-}
-
-void BIF_filelist_parent(struct FileList* filelist)
-{
-#ifdef WIN32
- char c = '\\';
-#else
- char c = '/';
-#endif
- char *dir = filelist->dir;
- size_t len = strlen(dir);
-
- while( (len > 0) && (dir[len-1] == c) )
- {
- --len;
- dir[len] = '\0';
- }
- while ( (len > 0) && (dir[len-1] != c) )
- {
- --len;
- dir[len] = '\0';
- }
- if (len == 0)
- {
- dir[0] = c; dir[1] = '\0';
- }
-#ifdef WIN32
- strcat(filelist->dir, "\\");
-#else
- strcat(filelist->dir, "/");
-#endif
-
- BLI_cleanup_dir(G.sce, filelist->dir);
- BLI_make_exist(filelist->dir);
- BIF_filelist_readdir(filelist);
-}
-
-void BIF_filelist_setfiletypes(struct FileList* filelist, short has_quicktime)
-{
- struct direntry *file;
- int num;
-
- file= filelist->filelist;
-
- for(num=0; num<filelist->numfiles; num++, file++) {
- file->flags= 0;
- file->type= file->s.st_mode; /* restore the mess below */
-
- /* Don't check extensions for directories */
- if (file->type & S_IFDIR)
- continue;
-
-
-
- if(BLO_has_bfile_extension(file->relname)) {
- file->flags |= BLENDERFILE;
- if(filelist->type==FILE_LOADLIB) {
- char name[FILE_MAXDIR+FILE_MAXFILE];
- BLI_strncpy(name, filelist->dir, sizeof(name));
- strcat(name, file->relname);
-
- /* prevent current file being used as acceptable dir */
- if (BLI_streq(G.main->name, name)==0) {
- file->type &= ~S_IFMT;
- file->type |= S_IFDIR;
- }
- }
- } else if(BLI_testextensie(file->relname, ".py")) {
- file->flags |= PYSCRIPTFILE;
- } else if(BLI_testextensie(file->relname, ".txt")) {
- file->flags |= TEXTFILE;
- } else if( BLI_testextensie(file->relname, ".ttf")
- || BLI_testextensie(file->relname, ".ttc")
- || BLI_testextensie(file->relname, ".pfb")
- || BLI_testextensie(file->relname, ".otf")
- || BLI_testextensie(file->relname, ".otc")) {
- file->flags |= FTFONTFILE;
- } else if (has_quicktime){
- if( BLI_testextensie(file->relname, ".int")
- || BLI_testextensie(file->relname, ".inta")
- || BLI_testextensie(file->relname, ".jpg")
- || BLI_testextensie(file->relname, ".jpeg")
- || BLI_testextensie(file->relname, ".tga")
- || BLI_testextensie(file->relname, ".rgb")
- || BLI_testextensie(file->relname, ".rgba")
- || BLI_testextensie(file->relname, ".bmp")
- || BLI_testextensie(file->relname, ".png")
- || BLI_testextensie(file->relname, ".iff")
- || BLI_testextensie(file->relname, ".lbm")
- || BLI_testextensie(file->relname, ".gif")
- || BLI_testextensie(file->relname, ".psd")
- || BLI_testextensie(file->relname, ".tif")
- || BLI_testextensie(file->relname, ".tiff")
- || BLI_testextensie(file->relname, ".pct")
- || BLI_testextensie(file->relname, ".pict")
- || BLI_testextensie(file->relname, ".pntg") //macpaint
- || BLI_testextensie(file->relname, ".qtif")
- || BLI_testextensie(file->relname, ".sgi")
-#ifdef WITH_DDS
- || BLI_testextensie(file->relname, ".dds")
-#endif
-#ifdef WITH_OPENEXR
- || BLI_testextensie(file->relname, ".exr")
-#endif
- ) {
- file->flags |= IMAGEFILE;
- }
- else if(BLI_testextensie(file->relname, ".avi")
- || BLI_testextensie(file->relname, ".flc")
- || BLI_testextensie(file->relname, ".mov")
- || BLI_testextensie(file->relname, ".movie")
- || BLI_testextensie(file->relname, ".mp4")
- || BLI_testextensie(file->relname, ".m4v")
- || BLI_testextensie(file->relname, ".mv")) {
- file->flags |= MOVIEFILE;
- }
- else if(BLI_testextensie(file->relname, ".wav")) {
- file->flags |= SOUNDFILE;
- }
- } else { // no quicktime
- if(BLI_testextensie(file->relname, ".int")
- || BLI_testextensie(file->relname, ".inta")
- || BLI_testextensie(file->relname, ".jpg")
- || BLI_testextensie(file->relname, ".tga")
- || BLI_testextensie(file->relname, ".rgb")
- || BLI_testextensie(file->relname, ".rgba")
- || BLI_testextensie(file->relname, ".bmp")
- || BLI_testextensie(file->relname, ".png")
- || BLI_testextensie(file->relname, ".iff")
- || BLI_testextensie(file->relname, ".tif")
- || BLI_testextensie(file->relname, ".tiff")
-#ifdef WITH_DDS
- || BLI_testextensie(file->relname, ".dds")
-#endif
-#ifdef WITH_OPENEXR
- || BLI_testextensie(file->relname, ".exr")
-#endif
- || BLI_testextensie(file->relname, ".lbm")
- || BLI_testextensie(file->relname, ".sgi")) {
- file->flags |= IMAGEFILE;
- }
- else if(BLI_testextensie(file->relname, ".avi")
- || BLI_testextensie(file->relname, ".mp4")
- || BLI_testextensie(file->relname, ".mv")) {
- file->flags |= MOVIEFILE;
- }
- else if(BLI_testextensie(file->relname, ".wav")) {
- file->flags |= SOUNDFILE;
- }
- }
- }
-}
-
-void BIF_filelist_swapselect(struct FileList* filelist)
-{
- struct direntry *file;
- int num, act= 0;
-
- file= filelist->filelist;
- for(num=0; num<filelist->numfiles; num++, file++) {
- if(file->flags & ACTIVE) {
- act= 1;
- break;
- }
- }
- file= filelist->filelist+2;
- for(num=2; num<filelist->numfiles; num++, file++) {
- if(act) file->flags &= ~ACTIVE;
- else file->flags |= ACTIVE;
- }
-}
-
-int BIF_filelist_islibrary(struct FileList* filelist, char* dir, char* group)
-{
- /* return ok when a blenderfile, in dir is the filename,
- * in group the type of libdata
- */
- int len;
- char *fd;
-
- strcpy(dir, filelist->dir);
- len= strlen(dir);
- if(len<7) return 0;
- if( dir[len-1] != '/' && dir[len-1] != '\\') return 0;
-
- group[0]= 0;
- dir[len-1]= 0;
-
- /* Find the last slash */
- fd= (strrchr(dir, '/')>strrchr(dir, '\\'))?strrchr(dir, '/'):strrchr(dir, '\\');
-
- if(fd==0) return 0;
- *fd= 0;
- if(BLO_has_bfile_extension(fd+1)) {
- *fd= '/';
- }
- else {
- char *gp = fd+1; // in case we have a .blend file, gp points to the group
-
- /* Find the last slash */
- fd= (strrchr(dir, '/')>strrchr(dir, '\\'))?strrchr(dir, '/'):strrchr(dir, '\\');
- if (!fd || !BLO_has_bfile_extension(fd+1)) return 0;
-
- /* now we know that we are in a blend file and it is safe to
- assume that gp actually points to a group */
- BLI_strncpy(group, gp, GROUP_MAX);
- }
- return 1;
-}
-
-void BIF_filelist_from_library(struct FileList* filelist)
-{
- LinkNode *l, *names, *previews;
- struct ImBuf* ima;
- int ok, i, nnames, idcode;
- char filename[FILE_MAXDIR+FILE_MAXFILE];
- char dir[FILE_MAXDIR], group[GROUP_MAX];
-
- filelist->type = FILE_LOADLIB;
-
- /* name test */
- ok= BIF_filelist_islibrary(filelist, dir, group);
- if (!ok) {
- /* free */
- if(filelist->libfiledata) BLO_blendhandle_close(filelist->libfiledata);
- filelist->libfiledata= 0;
- return;
- }
-
- BLI_strncpy(filename, G.sce, sizeof(filename)); // G.sce = last file loaded, for UI
-
- /* there we go */
- /* for the time being only read filedata when libfiledata==0 */
- if (filelist->libfiledata==0) {
- filelist->libfiledata= BLO_blendhandle_from_file(dir);
- if(filelist->libfiledata==0) return;
- }
-
- idcode= BIF_groupname_to_code(group);
-
- // memory for strings is passed into filelist[i].relname
- // and free'd in freefilelist
- previews = NULL;
- if (idcode) {
- previews= BLO_blendhandle_get_previews(filelist->libfiledata, idcode);
- names= BLO_blendhandle_get_datablock_names(filelist->libfiledata, idcode);
- /* ugh, no rewind, need to reopen */
- BLO_blendhandle_close(filelist->libfiledata);
- filelist->libfiledata= BLO_blendhandle_from_file(dir);
-
- } else {
- names= BLO_blendhandle_get_linkable_groups(filelist->libfiledata);
- }
-
- nnames= BLI_linklist_length(names);
-
- filelist->numfiles= nnames + 2;
- filelist->filelist= malloc(filelist->numfiles * sizeof(*filelist->filelist));
- memset(filelist->filelist, 0, filelist->numfiles * sizeof(*filelist->filelist));
-
- filelist->filelist[0].relname= BLI_strdup(".");
- filelist->filelist[0].type |= S_IFDIR;
- filelist->filelist[1].relname= BLI_strdup("..");
- filelist->filelist[1].type |= S_IFDIR;
-
- for (i=0, l= names; i<nnames; i++, l= l->next) {
- char *blockname= l->link;
-
- filelist->filelist[i + 2].relname= BLI_strdup(blockname);
- if (!idcode)
- filelist->filelist[i + 2].type |= S_IFDIR;
- }
-
- if(previews) {
- for (i=0, l= previews; i<nnames; i++, l= l->next) {
- PreviewImage *img= l->link;
-
- if (img) {
- unsigned int w = img->w[PREVIEW_MIPMAP_LARGE];
- unsigned int h = img->h[PREVIEW_MIPMAP_LARGE];
- unsigned int *rect = img->rect[PREVIEW_MIPMAP_LARGE];
-
- /* first allocate imbuf for copying preview into it */
- if (w > 0 && h > 0 && rect) {
- ima = IMB_allocImBuf(w, h, 32, IB_rect, 0);
- memcpy(ima->rect, rect, w*h*sizeof(unsigned int));
- filelist->filelist[i + 2].image = ima;
- filelist->filelist[i + 2].flags = IMAGEFILE;
- }
- }
- }
- }
-
- BLI_linklist_free(names, free);
- if (previews) BLI_linklist_free(previews, (void(*)(void*)) MEM_freeN);
-
- BIF_filelist_sort(filelist, FILE_SORTALPHA);
-
- BLI_strncpy(G.sce, filename, sizeof(filename)); // prevent G.sce to change
-
- filelist->filter = 0;
- BIF_filelist_filter(filelist);
-}
-
-void BIF_filelist_append_library(struct FileList *filelist, char *dir, char *file, short flag, int idcode)
-{
- BLO_library_append_(&filelist->libfiledata, filelist->filelist, filelist->numfiles, dir, file, flag, idcode);
-}
-
-void BIF_filelist_from_main(struct FileList *filelist)
-{
- ID *id;
- struct direntry *files, *firstlib = NULL;
- ListBase *lb;
- int a, fake, idcode, ok, totlib, totbl;
-
- filelist->type = FILE_MAIN;
-
- if(filelist->dir[0]=='/') filelist->dir[0]= 0;
-
- if(filelist->dir[0]) {
- idcode= BIF_groupname_to_code(filelist->dir);
- if(idcode==0) filelist->dir[0]= 0;
- }
-
- if( filelist->dir[0]==0) {
-
- /* make directories */
- filelist->numfiles= 23;
- filelist->filelist= (struct direntry *)malloc(filelist->numfiles * sizeof(struct direntry));
-
- for(a=0; a<filelist->numfiles; a++) {
- memset( &(filelist->filelist[a]), 0 , sizeof(struct direntry));
- filelist->filelist[a].type |= S_IFDIR;
- }
-
- filelist->filelist[0].relname= BLI_strdup("..");
- filelist->filelist[1].relname= BLI_strdup(".");
- filelist->filelist[2].relname= BLI_strdup("Scene");
- filelist->filelist[3].relname= BLI_strdup("Object");
- filelist->filelist[4].relname= BLI_strdup("Mesh");
- filelist->filelist[5].relname= BLI_strdup("Curve");
- filelist->filelist[6].relname= BLI_strdup("Metaball");
- filelist->filelist[7].relname= BLI_strdup("Material");
- filelist->filelist[8].relname= BLI_strdup("Texture");
- filelist->filelist[9].relname= BLI_strdup("Image");
- filelist->filelist[10].relname= BLI_strdup("Ika");
- filelist->filelist[11].relname= BLI_strdup("Wave");
- filelist->filelist[12].relname= BLI_strdup("Lattice");
- filelist->filelist[13].relname= BLI_strdup("Lamp");
- filelist->filelist[14].relname= BLI_strdup("Camera");
- filelist->filelist[15].relname= BLI_strdup("Ipo");
- filelist->filelist[16].relname= BLI_strdup("World");
- filelist->filelist[17].relname= BLI_strdup("Screen");
- filelist->filelist[18].relname= BLI_strdup("VFont");
- filelist->filelist[19].relname= BLI_strdup("Text");
- filelist->filelist[20].relname= BLI_strdup("Armature");
- filelist->filelist[21].relname= BLI_strdup("Action");
- filelist->filelist[22].relname= BLI_strdup("NodeTree");
- BIF_filelist_sort(filelist, FILE_SORTALPHA);
- }
- else {
-
- /* make files */
- idcode= BIF_groupname_to_code(filelist->dir);
-
- lb= wich_libbase(G.main, idcode );
- if(lb==0) return;
-
- id= lb->first;
- filelist->numfiles= 0;
- while(id) {
-
- if(filelist->has_func && idcode==ID_IP) {
- if(filelist->ipotype== ((Ipo *)id)->blocktype) filelist->numfiles++;
- }
- else if (!filelist->hide_dot || id->name[2] != '.') {
- filelist->numfiles++;
- }
-
- id= id->next;
- }
-
- if(!filelist->has_func) filelist->numfiles+= 2;
- filelist->filelist= (struct direntry *)malloc(filelist->numfiles * sizeof(struct direntry));
-
- files = filelist->filelist;
-
- if(!filelist->has_func) {
- memset( &(filelist->filelist[0]), 0 , sizeof(struct direntry));
- filelist->filelist[0].relname= BLI_strdup(".");
- filelist->filelist[0].type |= S_IFDIR;
- memset( &(filelist->filelist[1]), 0 , sizeof(struct direntry));
- filelist->filelist[1].relname= BLI_strdup("..");
- filelist->filelist[1].type |= S_IFDIR;
-
- files+= 2;
- }
-
- id= lb->first;
- totlib= totbl= 0;
-
- while(id) {
-
- ok= 0;
- if(filelist->has_func && idcode==ID_IP) {
- if(filelist->ipotype== ((Ipo *)id)->blocktype) ok= 1;
- }
- else ok= 1;
-
- if(ok) {
- /* TODO: hide dot files - elubie */
- memset( files, 0 , sizeof(struct direntry));
- if(id->lib==NULL)
- files->relname= BLI_strdup(id->name+2);
- else {
- files->relname= MEM_mallocN(FILE_MAXDIR+FILE_MAXFILE+32, "filename for lib");
- sprintf(files->relname, "%s | %s", id->lib->name, id->name+2);
- }
- /* files->type |= S_IFDIR; */
- if(!filelist->has_func) { /* F4 DATA BROWSE */
- if(idcode==ID_OB) {
- if( ((Object *)id)->flag & SELECT) files->flags |= ACTIVE;
- }
- else if(idcode==ID_SCE) {
- if( ((Scene *)id)->r.scemode & R_BG_RENDER) files->flags |= ACTIVE;
- }
- }
- files->nr= totbl+1;
- files->poin= id;
- fake= id->flag & LIB_FAKEUSER;
- if(idcode == ID_MA || idcode == ID_TE || idcode == ID_LA || idcode == ID_WO || idcode == ID_IM) {
- files->flags |= IMAGEFILE;
- }
- if(id->lib && fake) sprintf(files->extra, "LF %d", id->us);
- else if(id->lib) sprintf(files->extra, "L %d", id->us);
- else if(fake) sprintf(files->extra, "F %d", id->us);
- else sprintf(files->extra, " %d", id->us);
-
- if(id->lib) {
- if(totlib==0) firstlib= files;
- totlib++;
- }
-
- files++;
- totbl++;
- }
-
- id= id->next;
- }
-
- /* only qsort of library blocks */
- if(totlib>1) {
- qsort(firstlib, totlib, sizeof(struct direntry), compare_name);
- }
- }
- filelist->filter = 0;
- BIF_filelist_filter(filelist);
-}
-
-
-void BIF_filelist_settype(struct FileList* filelist, int type)
-{
- filelist->type = type;
-}
-
-short BIF_filelist_gettype(struct FileList* filelist)
-{
- return filelist->type;
-}
-
-void BIF_filelist_sort(struct FileList* filelist, short sort)
-{
- struct direntry *file;
- int num;/* , act= 0; */
-
- switch(sort) {
- case FILE_SORTALPHA:
- qsort(filelist->filelist, filelist->numfiles, sizeof(struct direntry), compare_name);
- break;
- case FILE_SORTDATE:
- qsort(filelist->filelist, filelist->numfiles, sizeof(struct direntry), compare_date);
- break;
- case FILE_SORTSIZE:
- qsort(filelist->filelist, filelist->numfiles, sizeof(struct direntry), compare_size);
- break;
- case FILE_SORTEXTENS:
- qsort(filelist->filelist, filelist->numfiles, sizeof(struct direntry), compare_extension);
- }
-
- file= filelist->filelist;
- for(num=0; num<filelist->numfiles; num++, file++) {
- file->flags &= ~HILITE;
- }
- BIF_filelist_filter(filelist);
-}
-
-
-void BIF_filelist_setipotype(struct FileList* filelist, short ipotype)
-{
- filelist->ipotype = ipotype;
-}
-
-void BIF_filelist_hasfunc(struct FileList* filelist, int has_func)
-{
- filelist->has_func = has_func;
-}
-
diff --git a/source/blender/src/filesel.c b/source/blender/src/filesel.c
deleted file mode 100644
index d4e41e56e75..00000000000
--- a/source/blender/src/filesel.c
+++ /dev/null
@@ -1,2611 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#include <sys/stat.h>
-#include <sys/types.h>
-#include "MEM_guardedalloc.h"
-
-#include "BMF_Api.h"
-
-#ifdef WIN32
-#include <io.h>
-#include <direct.h>
-#include "BLI_winstuff.h"
-#else
-#include <unistd.h>
-#include <sys/times.h>
-#endif
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_linklist.h"
-#include "BLI_storage_types.h"
-#include "BLI_dynstr.h"
-
-#include "IMB_imbuf.h"
-
-#include "DNA_armature_types.h"
-#include "DNA_action_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_image_types.h"
-#include "DNA_ipo_types.h"
-#include "DNA_material_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_object_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_space_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_vfont_types.h"
-#include "DNA_view3d_types.h"
-
-#include "BKE_action.h"
-#include "BKE_constraint.h"
-#include "BKE_curve.h"
-#include "BKE_depsgraph.h"
-#include "BKE_font.h"
-#include "BKE_global.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
-#include "BKE_material.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_editview.h"
-#include "BIF_filelist.h"
-#include "BIF_gl.h"
-#include "BIF_interface.h"
-#include "BIF_language.h"
-#include "BIF_mywindow.h"
-#include "BIF_resources.h"
-#include "BIF_space.h"
-#include "BIF_screen.h"
-#include "BIF_toolbox.h"
-#include "BIF_usiblender.h"
-
-#include "BLO_readfile.h"
-
-#include "BDR_editcurve.h"
-#include "BDR_editobject.h"
-
-#include "BPI_script.h"
-#include "BSE_filesel.h"
-#include "BSE_view.h"
-
-#include "mydevice.h"
-#include "blendef.h"
-#include "nla.h"
-
-#include "BIF_fsmenu.h" /* include ourselves */
-
-#ifdef INTERNATIONAL
-#include "FTF_Api.h"
-#endif
-
-#if defined __BeOS
-static int fnmatch(const char *pattern, const char *string, int flags)
-{
- return 0;
-}
-#elif defined WIN32 && !defined _LIBC
- /* use fnmatch included in blenlib */
- #include "BLI_fnmatch.h"
-#else
- #include <fnmatch.h>
-#endif
-
-#ifndef WIN32
-#include <sys/param.h>
-#endif
-
-#define FILESELHEAD 60
-#define FILESEL_DY 16
-
-/* for events */
-#define NOTACTIVE 0
-#define ACTIVATE 1
-#define INACTIVATE 2
-/* for state of file */
-#define ACTIVE 2
-
-#define STARTSWITH(x, y) (strncmp(x, y, sizeof(x) - 1) == 0)
-
-/* button events */
-#define B_FS_FILENAME 1
-#define B_FS_DIRNAME 2
-#define B_FS_DIR_MENU 3
-#define B_FS_PARDIR 4
-#define B_FS_LOAD 5
-#define B_FS_CANCEL 6
-#define B_FS_LIBNAME 7
-
-/* max length of library group name within filesel */
-#define GROUP_MAX 32
-
-static int is_a_library(SpaceFile *sfile, char *dir, char *group);
-static void do_library_append(SpaceFile *sfile);
-static void library_to_filelist(SpaceFile *sfile);
-static void filesel_select_objects(struct SpaceFile *sfile);
-static void active_file_object(struct SpaceFile *sfile);
-static int groupname_to_code(char *group);
-
-extern void countall(void);
-
-/* very bad local globals */
-
-static rcti scrollrct, textrct, bar;
-static int filebuty1, filebuty2, page_ofs, collumwidth, selecting=0;
-static int filetoname= 0;
-static float pixels_to_ofs;
-static char otherdir[FILE_MAX];
-static ScrArea *otherarea;
-
-/* ******************* SORT ******************* */
-
-static int compare_name(const void *a1, const void *a2)
-{
- const struct direntry *entry1=a1, *entry2=a2;
-
- /* type is is equal to stat.st_mode */
-
- if (S_ISDIR(entry1->type)){
- if (S_ISDIR(entry2->type)==0) return (-1);
- } else{
- if (S_ISDIR(entry2->type)) return (1);
- }
- if (S_ISREG(entry1->type)){
- if (S_ISREG(entry2->type)==0) return (-1);
- } else{
- if (S_ISREG(entry2->type)) return (1);
- }
- if ((entry1->type & S_IFMT) < (entry2->type & S_IFMT)) return (-1);
- if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1);
-
- /* make sure "." and ".." are always first */
- if( strcmp(entry1->relname, ".")==0 ) return (-1);
- if( strcmp(entry2->relname, ".")==0 ) return (1);
- if( strcmp(entry1->relname, "..")==0 ) return (-1);
-
- return (BLI_strcasecmp(entry1->relname,entry2->relname));
-}
-
-static int compare_date(const void *a1, const void *a2)
-{
- const struct direntry *entry1=a1, *entry2=a2;
-
- /* type is equal to stat.st_mode */
-
- if (S_ISDIR(entry1->type)){
- if (S_ISDIR(entry2->type)==0) return (-1);
- } else{
- if (S_ISDIR(entry2->type)) return (1);
- }
- if (S_ISREG(entry1->type)){
- if (S_ISREG(entry2->type)==0) return (-1);
- } else{
- if (S_ISREG(entry2->type)) return (1);
- }
- if ((entry1->type & S_IFMT) < (entry2->type & S_IFMT)) return (-1);
- if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1);
-
- /* make sure "." and ".." are always first */
- if( strcmp(entry1->relname, ".")==0 ) return (-1);
- if( strcmp(entry2->relname, ".")==0 ) return (1);
- if( strcmp(entry1->relname, "..")==0 ) return (-1);
-
- if ( entry1->s.st_mtime < entry2->s.st_mtime) return 1;
- if ( entry1->s.st_mtime > entry2->s.st_mtime) return -1;
-
- else return BLI_strcasecmp(entry1->relname,entry2->relname);
-}
-
-static int compare_size(const void *a1, const void *a2)
-{
- const struct direntry *entry1=a1, *entry2=a2;
-
- /* type is equal to stat.st_mode */
-
- if (S_ISDIR(entry1->type)){
- if (S_ISDIR(entry2->type)==0) return (-1);
- } else{
- if (S_ISDIR(entry2->type)) return (1);
- }
- if (S_ISREG(entry1->type)){
- if (S_ISREG(entry2->type)==0) return (-1);
- } else{
- if (S_ISREG(entry2->type)) return (1);
- }
- if ((entry1->type & S_IFMT) < (entry2->type & S_IFMT)) return (-1);
- if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1);
-
- /* make sure "." and ".." are always first */
- if( strcmp(entry1->relname, ".")==0 ) return (-1);
- if( strcmp(entry2->relname, ".")==0 ) return (1);
- if( strcmp(entry1->relname, "..")==0 ) return (-1);
-
- if ( entry1->s.st_size < entry2->s.st_size) return 1;
- if ( entry1->s.st_size > entry2->s.st_size) return -1;
- else return BLI_strcasecmp(entry1->relname,entry2->relname);
-}
-
-static int compare_extension(const void *a1, const void *a2) {
- const struct direntry *entry1=a1, *entry2=a2;
- char *sufix1, *sufix2;
- char *nil="";
-
- if (!(sufix1= strstr (entry1->relname, ".blend.gz")))
- sufix1= strrchr (entry1->relname, '.');
- if (!(sufix2= strstr (entry2->relname, ".blend.gz")))
- sufix2= strrchr (entry2->relname, '.');
- if (!sufix1) sufix1= nil;
- if (!sufix2) sufix2= nil;
-
- /* type is is equal to stat.st_mode */
-
- if (S_ISDIR(entry1->type)){
- if (S_ISDIR(entry2->type)==0) return (-1);
- } else{
- if (S_ISDIR(entry2->type)) return (1);
- }
- if (S_ISREG(entry1->type)){
- if (S_ISREG(entry2->type)==0) return (-1);
- } else{
- if (S_ISREG(entry2->type)) return (1);
- }
- if ((entry1->type & S_IFMT) < (entry2->type & S_IFMT)) return (-1);
- if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1);
-
- /* make sure "." and ".." are always first */
- if( strcmp(entry1->relname, ".")==0 ) return (-1);
- if( strcmp(entry2->relname, ".")==0 ) return (1);
- if( strcmp(entry1->relname, "..")==0 ) return (-1);
- if( strcmp(entry2->relname, "..")==0 ) return (-1);
-
- return (BLI_strcasecmp(sufix1, sufix2));
-}
-
-/* **************************************** */
-static int filesel_has_func(SpaceFile *sfile)
-{
- if(sfile->returnfunc || sfile->returnfunc_event || sfile->returnfunc_args)
- return 1;
- return 0;
-}
-
-void filesel_statistics(SpaceFile *sfile, int *totfile, int *selfile, float *totlen, float *sellen)
-{
- double len;
- int a;
-
- *totfile= *selfile= 0;
- *totlen= *sellen= 0;
-
- if(sfile->filelist==0) return;
-
- for(a=0; a<sfile->totfile; a++) {
- if( (sfile->filelist[a].type & S_IFDIR)==0 ) {
- (*totfile) ++;
-
- len = sfile->filelist[a].s.st_size;
- (*totlen) += (float)(len/1048576.0);
-
- if(sfile->filelist[a].flags & ACTIVE) {
- (*selfile) ++;
- (*sellen) += (float)(len/1048576.0);
- }
- }
- }
-}
-
-/* *************** HELP FUNCTIONS ******************* */
-
-
-/* not called when browsing .blend itself */
-void test_flags_file(SpaceFile *sfile)
-{
- struct direntry *file;
- int num;
-
- file= sfile->filelist;
-
- for(num=0; num<sfile->totfile; num++, file++) {
- file->flags= 0;
- file->type= file->s.st_mode; /* restore the mess below */
-
- /* Don't check extensions for directories */
- if (file->type & S_IFDIR)
- continue;
-
- if(sfile->type==FILE_BLENDER || sfile->type==FILE_LOADLIB) {
- if(BLO_has_bfile_extension(file->relname)) {
- file->flags |= BLENDERFILE;
-
- if(sfile->type==FILE_LOADLIB) {
- char name[FILE_MAX];
- BLI_strncpy(name, sfile->dir, sizeof(name));
- strcat(name, file->relname);
-
- /* prevent current file being used as acceptable dir */
- if (BLI_streq(G.main->name, name)==0) {
- file->type &= ~S_IFMT;
- file->type |= S_IFDIR;
- }
- }
- }
- } else if (sfile->type==FILE_SPECIAL || sfile->type==FILE_LOADFONT){
- if(BLI_testextensie(file->relname, ".py")) {
- file->flags |= PYSCRIPTFILE;
- } else if( BLI_testextensie(file->relname, ".ttf")
- || BLI_testextensie(file->relname, ".ttc")
- || BLI_testextensie(file->relname, ".pfb")
- || BLI_testextensie(file->relname, ".otf")
- || BLI_testextensie(file->relname, ".otc")) {
- file->flags |= FTFONTFILE;
- } else if (G.have_libtiff &&
- (BLI_testextensie(file->relname, ".tif")
- || BLI_testextensie(file->relname, ".tiff"))) {
- file->flags |= IMAGEFILE;
- } else if (BLI_testextensie(file->relname, ".exr")) {
- file->flags |= IMAGEFILE;
- } else if (G.have_quicktime){
- if( BLI_testextensie(file->relname, ".jpg")
- || BLI_testextensie(file->relname, ".jpeg")
- || BLI_testextensie(file->relname, ".hdr")
- || BLI_testextensie(file->relname, ".exr")
- || BLI_testextensie(file->relname, ".tga")
- || BLI_testextensie(file->relname, ".rgb")
- || BLI_testextensie(file->relname, ".bmp")
- || BLI_testextensie(file->relname, ".png")
-#ifdef WITH_DDS
- || BLI_testextensie(file->relname, ".dds")
-#endif
- || BLI_testextensie(file->relname, ".iff")
- || BLI_testextensie(file->relname, ".lbm")
- || BLI_testextensie(file->relname, ".gif")
- || BLI_testextensie(file->relname, ".psd")
- || BLI_testextensie(file->relname, ".tif")
- || BLI_testextensie(file->relname, ".tiff")
- || BLI_testextensie(file->relname, ".pct")
- || BLI_testextensie(file->relname, ".pict")
- || BLI_testextensie(file->relname, ".pntg") //macpaint
- || BLI_testextensie(file->relname, ".qtif")
- || BLI_testextensie(file->relname, ".cin")
- || BLI_testextensie(file->relname, ".dpx")
- || BLI_testextensie(file->relname, ".sgi")) {
- file->flags |= IMAGEFILE;
- }
- else if(BLI_testextensie(file->relname, ".avi")
- || BLI_testextensie(file->relname, ".flc")
- || BLI_testextensie(file->relname, ".dv")
- || BLI_testextensie(file->relname, ".mov")
- || BLI_testextensie(file->relname, ".movie")
- || BLI_testextensie(file->relname, ".mv")) {
- file->flags |= MOVIEFILE;
- }
- } else { // no quicktime
- if(BLI_testextensie(file->relname, ".jpg")
- || BLI_testextensie(file->relname, ".hdr")
- || BLI_testextensie(file->relname, ".exr")
- || BLI_testextensie(file->relname, ".tga")
- || BLI_testextensie(file->relname, ".rgb")
- || BLI_testextensie(file->relname, ".bmp")
- || BLI_testextensie(file->relname, ".png")
-#ifdef WITH_DDS
- || BLI_testextensie(file->relname, ".dds")
-#endif
- || BLI_testextensie(file->relname, ".iff")
- || BLI_testextensie(file->relname, ".lbm")
- || BLI_testextensie(file->relname, ".cin")
- || BLI_testextensie(file->relname, ".dpx")
- || BLI_testextensie(file->relname, ".sgi")) {
- file->flags |= IMAGEFILE;
- }
- else if(BLI_testextensie(file->relname, ".avi")
- || BLI_testextensie(file->relname, ".mv")) {
- file->flags |= MOVIEFILE;
- }
- else if(BLI_testextensie(file->relname, ".wav")) {
- file->flags |= SOUNDFILE;
- }
- }
- }
- }
-}
-
-
-void sort_filelist(SpaceFile *sfile)
-{
- struct direntry *file;
- int num;/* , act= 0; */
-
- switch(sfile->sort) {
- case FILE_SORTALPHA:
- qsort(sfile->filelist, sfile->totfile, sizeof(struct direntry), compare_name);
- break;
- case FILE_SORTDATE:
- qsort(sfile->filelist, sfile->totfile, sizeof(struct direntry), compare_date);
- break;
- case FILE_SORTSIZE:
- qsort(sfile->filelist, sfile->totfile, sizeof(struct direntry), compare_size);
- break;
- case FILE_SORTEXTENS:
- qsort(sfile->filelist, sfile->totfile, sizeof(struct direntry), compare_extension);
- }
-
- sfile->act= -1;
-
- file= sfile->filelist;
- for(num=0; num<sfile->totfile; num++, file++) {
- file->flags &= ~HILITE;
- }
-
-}
-
-void read_dir(SpaceFile *sfile)
-{
- int num, len;
- char wdir[FILE_MAX];
-
- /* sfile->act is used for example in databrowse: double names of library objects */
- sfile->act= -1;
-
- if(sfile->type==FILE_MAIN) {
- main_to_filelist(sfile);
- return;
- }
- else if(sfile->type==FILE_LOADLIB) {
- library_to_filelist(sfile);
- if(sfile->libfiledata) return;
- }
-
- BLI_hide_dot_files(sfile->flag & FILE_HIDE_DOT);
-
- BLI_getwdN(wdir);
- sfile->totfile= BLI_getdir(sfile->dir, &(sfile->filelist));
- chdir(wdir);
-
- if(sfile->sort!=FILE_SORTALPHA) sort_filelist(sfile);
-
- sfile->maxnamelen= 0;
-
- for (num=0; num<sfile->totfile; num++) {
-
- len = BMF_GetStringWidth(G.font, sfile->filelist[num].relname);
- if (len > sfile->maxnamelen) sfile->maxnamelen = len;
-
- if(filetoname) {
- if(strcmp(sfile->file, sfile->filelist[num].relname)==0) {
-
- sfile->ofs= num-( sfile->collums*(curarea->winy-FILESELHEAD-20)/(2*FILESEL_DY));
- filetoname= 0;
- }
- }
- }
- test_flags_file(sfile);
-
- filetoname= 0;
-}
-
-void freefilelist(SpaceFile *sfile)
-{
- int num;
-
- num= sfile->totfile-1;
-
- if (sfile->filelist==0) return;
-
- for(; num>=0; num--){
- MEM_freeN(sfile->filelist[num].relname);
-
- if (sfile->filelist[num].string) MEM_freeN(sfile->filelist[num].string);
- }
- free(sfile->filelist);
- sfile->filelist= 0;
-}
-
-static void split_sfile(SpaceFile *sfile, char *s1)
-{
- char string[FILE_MAX], dir[FILE_MAX], file[FILE_MAX];
-
- BLI_strncpy(string, s1, sizeof(string));
-
- BLI_split_dirfile(string, dir, file);
-
- if(sfile->filelist) {
- if(strcmp(dir, sfile->dir)!=0) {
- freefilelist(sfile);
- }
- else test_flags_file(sfile);
- }
- BLI_strncpy(sfile->file, file, sizeof(sfile->file));
-
- BLI_make_file_string(G.sce, sfile->dir, dir, "");
-}
-
-
-void parent(SpaceFile *sfile)
-{
- short a;
- char *dir;
-
- /* if databrowse: no parent */
- if(sfile->type==FILE_MAIN && filesel_has_func(sfile)) return;
-
- dir= sfile->dir;
-
-#ifdef WIN32
- if( (a = strlen(dir)) ) { /* remove all '/' at the end */
- while(dir[a-1] == '\\') {
- a--;
- dir[a] = 0;
- if (a<=0) break;
- }
- }
- if( (a = strlen(dir)) ) { /* then remove all until '/' */
- while(dir[a-1] != '\\') {
- a--;
- dir[a] = 0;
- if (a<=0) break;
- }
- }
- if( (a = strlen(dir)) ) {
- if (dir[a-1] != '\\') strcat(dir,"\\");
- }
- else if(sfile->type!=FILE_MAIN) {
- get_default_root(dir);
- }
-#else
- if( (a = strlen(dir)) ) { /* remove all '/' at the end */
- while(dir[a-1] == '/') {
- a--;
- dir[a] = 0;
- if (a<=0) break;
- }
- }
- if( (a = strlen(dir)) ) { /* then remove until '/' */
- while(dir[a-1] != '/') {
- a--;
- dir[a] = 0;
- if (a<=0) break;
- }
- }
- if ( (a = strlen(dir)) ) {
- if (dir[a-1] != '/') strcat(dir,"/");
- }
- else if(sfile->type!=FILE_MAIN) strcpy(dir,"/");
-#endif
-
- /* to be sure */
- BLI_make_exist(sfile->dir);
-
- freefilelist(sfile);
- sfile->ofs= 0;
- scrarea_queue_winredraw(curarea);
-}
-
-void swapselect_file(SpaceFile *sfile)
-{
- struct direntry *file;
- int num, act= 0;
-
- file= sfile->filelist;
- for(num=0; num<sfile->totfile; num++, file++) {
- if(file->flags & ACTIVE) {
- act= 1;
- break;
- }
- }
- file= sfile->filelist+2;
- for(num=2; num<sfile->totfile; num++, file++) {
- if(act) file->flags &= ~ACTIVE;
- else file->flags |= ACTIVE;
- }
-}
-
-static int find_active_file(SpaceFile *sfile, short x, short y)
-{
- int ofs;
-
- if(y > textrct.ymax) y= textrct.ymax;
- if(y <= textrct.ymin) y= textrct.ymin+1;
-
- ofs= (x-textrct.xmin)/collumwidth;
- if(ofs<0) ofs= 0;
- ofs*= (textrct.ymax-textrct.ymin);
-
- return sfile->ofs+ (ofs+textrct.ymax-y)/FILESEL_DY;
-
-}
-
-
-/* ********************** DRAW ******************************* */
-
-static void calc_file_rcts(SpaceFile *sfile)
-{
- int tot, h, len;
- float fac, start, totfile;
-
- scrollrct.xmin= 15;
- scrollrct.xmax= 35;
- scrollrct.ymin= 10;
- scrollrct.ymax= curarea->winy-10-FILESELHEAD;
-
- textrct.xmin= scrollrct.xmax+10;
- textrct.xmax= curarea->winx-10;
- textrct.ymin= scrollrct.ymin;
- textrct.ymax= scrollrct.ymax;
-
- if(textrct.xmax-textrct.xmin <60) textrct.xmax= textrct.xmin+60;
-
- len= (textrct.ymax-textrct.ymin) % FILESEL_DY;
- textrct.ymin+= len;
- scrollrct.ymin+= len;
-
- filebuty1= curarea->winy-FILESELHEAD;
- filebuty2= filebuty1+FILESELHEAD/2 -6;
-
-
- /* amount of collums */
- len= sfile->maxnamelen+25;
-
- if(sfile->type==FILE_MAIN) len+= 100;
- else if(sfile->flag & FILE_SHOWSHORT) len+= 100;
- else len+= 380;
-
- sfile->collums= (textrct.xmax-textrct.xmin)/len;
-
- if(sfile->collums<1) sfile->collums= 1;
- else if(sfile->collums>8) sfile->collums= 8;
-
- /* this flag aint yet defined in user menu, needed? */
-// if((U.flag & USER_FSCOLLUM)==0) sfile->collums= 1;
-
- collumwidth= (textrct.xmax-textrct.xmin)/sfile->collums;
-
-
- totfile= sfile->totfile + 0.5f;
-
- tot= (int)(FILESEL_DY*totfile);
- if(tot) fac= ((float)sfile->collums*(scrollrct.ymax-scrollrct.ymin))/( (float)tot);
- else fac= 1.0;
-
- if(sfile->ofs<0) sfile->ofs= 0;
-
- if(tot) start= ( (float)sfile->ofs)/(totfile);
- else start= 0.0;
- if(fac>1.0) fac= 1.0f;
-
- if(start+fac>1.0) {
- sfile->ofs= (short)ceil((1.0-fac)*totfile);
- start= ( (float)sfile->ofs)/(totfile);
- fac= 1.0f-start;
- }
-
- bar.xmin= scrollrct.xmin+2;
- bar.xmax= scrollrct.xmax-2;
- h= (scrollrct.ymax-scrollrct.ymin)-4;
- bar.ymax= (int)(scrollrct.ymax-2- start*h);
- bar.ymin= (int)(bar.ymax- fac*h);
-
- pixels_to_ofs= (totfile)/(float)(h+3);
- page_ofs= (int)(fac*totfile);
-}
-
-int filescrollselect= 0;
-
-static void draw_filescroll(SpaceFile *sfile)
-{
-
- if(scrollrct.ymin+10 >= scrollrct.ymax) return;
-
- BIF_ThemeColor(TH_BACK);
- glRecti(scrollrct.xmin, scrollrct.ymin, scrollrct.xmax, scrollrct.ymax);
-
- uiEmboss(scrollrct.xmin, scrollrct.ymin, scrollrct.xmax, scrollrct.ymax, 1);
-
- BIF_ThemeColor(TH_HEADER);
- glRecti(bar.xmin+2, bar.ymin+2, bar.xmax-2, bar.ymax-2);
-
- uiEmboss(bar.xmin+2, bar.ymin+2, bar.xmax-2, bar.ymax-2, filescrollselect);
-
-}
-
-static void linerect(int id, int x, int y)
-{
- if(id & ACTIVE) {
- if(id & HILITE) BIF_ThemeColorShade(TH_HILITE, 20);
- else BIF_ThemeColor(TH_HILITE);
- }
- else if(id & HILITE) BIF_ThemeColorShade(TH_BACK, 20);
- else BIF_ThemeColor(TH_BACK);
-
- glRects(x-17, y-3, x+collumwidth-21, y+11);
-
-}
-
-static void print_line(SpaceFile *sfile, struct direntry *files, int x, int y)
-{
- int boxcol=0;
- char *s;
-
- boxcol= files->flags & (HILITE + ACTIVE);
-
- if(boxcol) {
- linerect(boxcol, x, y);
- }
-
- // this is where the little boxes in the file view are being drawn according to the file type
- if(files->flags & BLENDERFILE) {
- cpack(0xA0A0);
- glRects(x-14, y, x-8, y+7);
- }
- else if(files->flags & PSXFILE) {
- cpack(0xA060B0);
- glRects(x-14, y, x-8, y+7);
- }
- else if(files->flags & IMAGEFILE) {
- cpack(0xF08040);
- glRects(x-14, y, x-8, y+7);
- }
- else if(files->flags & MOVIEFILE) {
- cpack(0x70A070);
- glRects(x-14, y, x-8, y+7);
- }
- else if(files->flags & PYSCRIPTFILE) {
- cpack(0x4477dd);
- glRects(x-14, y, x-8, y+7);
- }
- else if(files->flags & SOUNDFILE) {
- cpack(0xa0a000);
- glRects(x-14, y, x-8, y+7);
- }
- else if(files->flags & FTFONTFILE) {
- cpack(0xff2371);
- glRects(x-14, y, x-8, y+7);
- }
-
- if(S_ISDIR(files->type)) BIF_ThemeColor(TH_TEXT_HI);
- else BIF_ThemeColor(TH_TEXT);
-
- s = files->string;
- if(s) {
- glRasterPos2i(x, y);
-#ifdef WITH_ICONV
- {
- struct LANGMenuEntry *lme;
- lme = find_language(U.language);
-
- if ((lme !=NULL) && (!strcmp(lme->code, "ja_JP") ||
- !strcmp(lme->code, "zh_CN")))
- {
- BIF_RasterPos((float)x, (float)y);
-#ifdef WIN32
- BIF_DrawString(G.font, files->relname, ((U.transopts & USER_TR_MENUS) | CONVERT_TO_UTF8));
-#else
- BIF_DrawString(G.font, files->relname, (U.transopts & USER_TR_MENUS));
-#endif
- } else {
- BMF_DrawString(G.font, files->relname);
- }
- }
-#else
- BMF_DrawString(G.font, files->relname);
-#endif /* WITH_ICONV */
-
- x += sfile->maxnamelen + 100;
-
- glRasterPos2i(x - BMF_GetStringWidth(G.font, files->size), y);
- BMF_DrawString(G.font, files->size);
-
- if(sfile->flag & FILE_SHOWSHORT) return;
-
-#ifndef WIN32
- /* rwx rwx rwx */
- x += 20; glRasterPos2i(x, y);
- BMF_DrawString(G.font, files->mode1);
-
- x += 30; glRasterPos2i(x, y);
- BMF_DrawString(G.font, files->mode2);
-
- x += 30; glRasterPos2i(x, y);
- BMF_DrawString(G.font, files->mode3);
-
- /* owner time date */
- x += 30; glRasterPos2i(x, y);
- BMF_DrawString(G.font, files->owner);
-#endif
-
- x += 60; glRasterPos2i(x, y);
- BMF_DrawString(G.font, files->time);
-
- x += 50; glRasterPos2i(x, y);
- BMF_DrawString(G.font, files->date);
- }
- else {
- glRasterPos2i(x, y);
- BMF_DrawString(G.font, files->relname);
-
- if(files->nr) { /* extra info */
- x+= sfile->maxnamelen+20;
- glRasterPos2i(x, y);
- BMF_DrawString(G.font, files->extra);
- }
- }
-}
-
-
-static int calc_filesel_line(SpaceFile *sfile, int nr, int *valx, int *valy)
-{
- /* get screen coordinate of a line */
- int val, coll;
-
- nr-= sfile->ofs;
-
- /* amount of lines */
- val= (textrct.ymax-textrct.ymin)/FILESEL_DY;
- if (val == 0) coll = 0;
- else coll= nr/val;
- nr -= coll*val;
-
- *valy= textrct.ymax-FILESEL_DY+3 - nr*FILESEL_DY;
- *valx= coll*collumwidth + textrct.xmin+20;
-
- if(nr<0 || coll > sfile->collums) return 0;
- return 1;
-}
-
-static void set_active_file(SpaceFile *sfile, int act)
-{
- struct direntry *file;
- int num, redraw= 0;
- unsigned int newflag;
- int old=0, newi=0;
-
- file= sfile->filelist;
- if(file==0) return;
-
- for(num=0; num<sfile->totfile; num++, file++) {
- if(num==act) {
-
- if(selecting && num>1) {
- newflag= HILITE | (file->flags & ~ACTIVE);
- if(selecting==ACTIVATE) newflag |= ACTIVE;
-
- if(file->flags != newflag) redraw|= 1;
- file->flags= newflag;
- }
- else {
- if(file->flags & HILITE);
- else {
- file->flags |= HILITE;
- redraw|= 2;
- newi= num;
- }
- }
- }
- else {
- if(file->flags & HILITE) {
- file->flags &= ~HILITE;
- redraw|= 2;
- old= num;
- }
- }
-
- }
- // removed frontbuffer draw here
- if(redraw) {
- scrarea_queue_winredraw(curarea);
- }
-}
-
-
-static void draw_filetext(SpaceFile *sfile)
-{
- struct direntry *files;
- int a, x, y;
- short mval[2];
-
- if(textrct.ymin+10 >= textrct.ymax) return;
-
-
- /* box */
- BIF_ThemeColor(TH_BACK);
- glRecti(textrct.xmin, textrct.ymin, textrct.xmax, textrct.ymax);
-
- /* collums */
- x= textrct.xmin+collumwidth;
- for(a=1; a<sfile->collums; a++, x+= collumwidth) {
- cpack(0x303030);
- sdrawline(x, textrct.ymin, x, textrct.ymax);
- cpack(0xB0B0B0);
- sdrawline(x+1, textrct.ymin, x+1, textrct.ymax);
- }
-
- if(sfile->filelist==0) return;
-
- /* test: if mouse is not in area: clear HILITE */
- getmouseco_areawin(mval);
-
- if(mval[0]<0 || mval[0]>curarea->winx) {
- files= sfile->filelist+sfile->ofs;
- for(a= sfile->ofs; a<sfile->totfile; a++, files++) files->flags &= ~HILITE;
- }
-
- files= sfile->filelist+sfile->ofs;
- for(a= sfile->ofs; a<sfile->totfile; a++, files++) {
-
- if( calc_filesel_line(sfile, a, &x, &y)==0 ) break;
- print_line(sfile, files, x, y);
- }
-
- /* clear drawing errors, with text at the right hand side: */
- BIF_ThemeColor(TH_HEADER);
- glRecti(textrct.xmax, textrct.ymin, textrct.xmax+10, textrct.ymax);
- uiEmboss(textrct.xmin, textrct.ymin, textrct.xmax, textrct.ymax, 1);
-}
-
-static char *library_string(void)
-{
- Library *lib;
- char *str;
- int nr=0, tot= BLI_countlist(&G.main->library);
-
- if(tot==0) return NULL;
- str= MEM_callocN(tot*(FILE_MAXDIR+FILE_MAX), "filesel lib menu");
-
- for(tot=0, lib= G.main->library.first; lib; lib= lib->id.next, nr++) {
- tot+= sprintf(str+tot, "%s %%x%d|", lib->name, nr);
- }
- return str;
-}
-
-void drawfilespace(ScrArea *sa, void *spacedata)
-{
- SpaceFile *sfile;
- uiBlock *block;
- float col[3];
- int act, loadbutton;
- short mval[2];
- char name[20];
- char *menu, *strp= NULL;
-
- myortho2(-0.375, sa->winx-0.375, -0.375, sa->winy-0.375);
-
- BIF_GetThemeColor3fv(TH_HEADER, col); // basic undrawn color is border
- glClearColor(col[0], col[1], col[2], 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- sfile= sa->spacedata.first;
- if(sfile->filelist==NULL) {
- read_dir(sfile);
-
- calc_file_rcts(sfile);
-
- /* calculate act */
- getmouseco_areawin(mval);
- act= find_active_file(sfile, mval[0], mval[1]);
- if(act>=0 && act<sfile->totfile)
- sfile->filelist[act].flags |= HILITE;
- }
- else calc_file_rcts(sfile);
-
- /* check if we load library, extra button */
- if(sfile->type==FILE_LOADLIB)
- strp= library_string();
-
- /* HEADER */
- sprintf(name, "win %d", sa->win);
- block= uiNewBlock(&sa->uiblocks, name, UI_EMBOSS, UI_HELV, sa->win);
-
- /* browse 1 datablock */
- uiSetButLock( sfile->type==FILE_MAIN && filesel_has_func(sfile), NULL);
-
- /* space available for load/save buttons? */
- loadbutton= MAX2(80, 20+BMF_GetStringWidth(G.font, sfile->title));
- if(textrct.xmax-textrct.xmin > loadbutton+20) {
- if(sfile->title[0]==0) loadbutton= 0;
- }
- else loadbutton= 0;
-
- uiBlockBeginAlign(block);
- uiDefBut(block, TEX, B_FS_DIRNAME,"", textrct.xmin + (strp?20:0), filebuty2, textrct.xmax-textrct.xmin-loadbutton - (strp?20:0), 21, sfile->dir, 0.0, (float)FILE_MAXDIR-1, 0, 0, "Directory, enter a directory and press enter to create it"); /* Directory input */
- if(loadbutton) {
- uiSetCurFont(block, UI_HELV);
- uiDefBut(block, BUT, B_FS_LOAD, sfile->title, textrct.xmax-loadbutton, filebuty2, loadbutton, 21, sfile->dir, 0.0, (float)FILE_MAXFILE-1, 0, 0, "");
- }
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefBut(block, TEX, B_FS_FILENAME,"", textrct.xmin, filebuty1, textrct.xmax-textrct.xmin-loadbutton, 21, sfile->file, 0.0, (float)FILE_MAXFILE-1, 0, 0, "File, increment version number with (+/-)"); /* File input */
- if(loadbutton) {
- uiSetCurFont(block, UI_HELV);
- uiDefBut(block, BUT, B_FS_CANCEL, "Cancel", textrct.xmax-loadbutton, filebuty1, loadbutton, 21, sfile->file, 0.0, (float)FILE_MAXFILE-1, 0, 0, "");
- }
- uiBlockEndAlign(block);
-
- menu= fsmenu_build_menu();
- if(menu[0]) /* happens when no .Bfs is there, and first time browse */
- uiDefButS(block, MENU, B_FS_DIR_MENU, menu, scrollrct.xmin, filebuty1, scrollrct.xmax-scrollrct.xmin, 21, &sfile->menu, 0, 0, 0, 0, "");
- MEM_freeN(menu);
-
- uiBlockBeginAlign(block);
- uiDefBut(block, BUT, B_FS_PARDIR, "P", scrollrct.xmin, filebuty2, scrollrct.xmax-scrollrct.xmin, 21, 0, 0, 0, 0, 0, "Move to the parent directory (PKEY)");
- if(strp) {
- uiDefIconTextButS(block, MENU, B_FS_LIBNAME, ICON_LIBRARY_DEHLT, strp, scrollrct.xmin+20, filebuty2, scrollrct.xmax-scrollrct.xmin, 21, &sfile->menu, 0, 0, 0, 0, "");
- MEM_freeN(strp);
- }
-
- uiDrawBlock(block);
-
- draw_filescroll(sfile);
- draw_filetext(sfile);
-
- /* others diskfree etc ? */
- scrarea_queue_headredraw(sa);
-
- myortho2(-0.375, (float)(sa->winx)-0.375, -0.375, (float)(sa->winy)-0.375);
- draw_area_emboss(sa);
-
- sa->win_swap= WIN_BACK_OK;
-}
-
-
-static void do_filescroll(SpaceFile *sfile)
-{
- short mval[2], oldy, yo;
-
- calc_file_rcts(sfile);
-
- filescrollselect= 1;
-
- /* for beauty */
- scrarea_do_windraw(curarea);
- screen_swapbuffers();
-
- getmouseco_areawin(mval);
- oldy= yo= mval[1];
-
- while(get_mbut()&L_MOUSE) {
- getmouseco_areawin(mval);
-
- if(yo!=mval[1]) {
- int dy= floor(0.5+((float)(oldy-mval[1]))*pixels_to_ofs);
-
- if(dy) {
- sfile->ofs+= dy;
- if(sfile->ofs<0) {
- sfile->ofs= 0;
- oldy= mval[1];
- }
- else oldy= floor(0.5+ (float)oldy - (float)dy/pixels_to_ofs);
-
- scrarea_do_windraw(curarea);
- screen_swapbuffers();
-
- }
-
- yo= mval[1];
- }
- else BIF_wait_for_statechange();
- }
- filescrollselect= 0;
-
- /* for beauty */
- scrarea_do_windraw(curarea);
- screen_swapbuffers();
-
-}
-
-static void do_filescrollwheel(SpaceFile *sfile, int move)
-{
- // by phase
- int lines, rt;
-
- calc_file_rcts(sfile);
-
- lines = (int)(textrct.ymax-textrct.ymin)/FILESEL_DY;
- rt = lines * sfile->collums;
-
- if(sfile->totfile > rt) {
- sfile->ofs+= move;
- if( sfile->ofs + rt > sfile->totfile + 1)
- sfile->ofs = sfile->totfile - rt + 1;
- }
-
- if(sfile->ofs<0) {
- sfile->ofs= 0;
- }
-}
-
-/* the complete call; pulldown menu, and three callback types */
-static void activate_fileselect_(int type, char *title, char *file, short *menup, char *pupmenu,
- void (*func)(char *),
- void (*func_event)(unsigned short),
- void (*func_args)(char *, void *arg1, void *arg2),
- void *arg1, void *arg2)
-{
- SpaceFile *sfile;
- char group[GROUP_MAX], name[FILE_MAX], temp[FILE_MAX];
-
- if(curarea==0) return;
- if(curarea->win==0) return;
-
- newspace(curarea, SPACE_FILE);
- scrarea_queue_winredraw(curarea);
-
- /* sometime double, when area already is SPACE_FILE with a different file name */
- if(curarea->headwin) addqueue(curarea->headwin, CHANGED, 1);
-
- name[2]= 0;
- BLI_strncpy(name, file, sizeof(name));
-
- sfile= curarea->spacedata.first;
-
- sfile->returnfunc= func;
- sfile->returnfunc_event= func_event;
- sfile->returnfunc_args= func_args;
- sfile->arg1= arg1;
- sfile->arg2= arg2;
-
- sfile->type= type;
- sfile->ofs= 0;
-
- if(sfile->pupmenu)
- MEM_freeN(sfile->pupmenu);
- sfile->pupmenu= pupmenu;
- sfile->menup= menup;
-
- /* sfile->act is used for databrowse: double names of library objects */
- sfile->act= -1;
-
- if(G.relbase_valid && BLI_convertstringcode(name, G.sce, G.scene->r.cfra))
- sfile->flag |= FILE_STRINGCODE;
- else
- sfile->flag &= ~FILE_STRINGCODE;
-
- if (U.uiflag & USER_HIDE_DOT)
- sfile->flag |= FILE_HIDE_DOT;
-
- if(type==FILE_MAIN) {
- char *groupname;
-
- BLI_strncpy(sfile->file, name+2, sizeof(sfile->file));
-
- groupname = BLO_idcode_to_name( GS(name) );
- if (groupname) {
- BLI_strncpy(sfile->dir, groupname, sizeof(sfile->dir) - 1);
- strcat(sfile->dir, "/");
- }
-
- /* free all */
- if(sfile->libfiledata) BLO_blendhandle_close(sfile->libfiledata);
- sfile->libfiledata= 0;
-
- freefilelist(sfile);
- }
- else if(type==FILE_LOADLIB) {
- BLI_strncpy(sfile->dir, name, sizeof(sfile->dir));
- if( is_a_library(sfile, temp, group) ) {
- /* force a reload of the library-filelist */
- freefilelist(sfile);
- }
- else {
- split_sfile(sfile, name);
- if(sfile->libfiledata) BLO_blendhandle_close(sfile->libfiledata);
- sfile->libfiledata= NULL;
- }
- }
- else { /* FILE_BLENDER or FILE_LOADFONT */
- split_sfile(sfile, name); /* test filelist too */
- BLI_cleanup_dir(G.sce, sfile->dir);
-
- /* free: filelist and libfiledata became incorrect */
- if(sfile->libfiledata) BLO_blendhandle_close(sfile->libfiledata);
- sfile->libfiledata= 0;
- }
- BLI_strncpy(sfile->title, title, sizeof(sfile->title));
- filetoname= 1;
-}
-
-void activate_fileselect(int type, char *title, char *file, void (*func)(char *))
-{
- activate_fileselect_(type, title, file, NULL, NULL, func, NULL, NULL, NULL, NULL);
-}
-
-void activate_fileselect_menu(int type, char *title, char *file, char *pupmenu, short *menup, void (*func)(char *))
-{
- activate_fileselect_(type, title, file, menup, pupmenu, func, NULL, NULL, NULL, NULL);
-}
-
-void activate_fileselect_args(int type, char *title, char *file, void (*func)(char *, void *, void *), void *arg1, void *arg2)
-{
- activate_fileselect_(type, title, file, NULL, NULL, NULL, NULL, func, arg1, arg2);
-}
-
-void activate_databrowse(ID *id, int idcode, int fromcode, int retval, short *menup, void (*func)(unsigned short))
-{
- ListBase *lb;
- SpaceFile *sfile;
- char str[32];
-
- if(id==NULL) {
- lb= wich_libbase(G.main, idcode);
- id= lb->first;
- }
-
- if(id) BLI_strncpy(str, id->name, sizeof(str));
- else return;
-
- activate_fileselect_(FILE_MAIN, "SELECT DATABLOCK", str, menup, NULL, NULL, func, NULL, NULL, NULL);
-
- sfile= curarea->spacedata.first;
- sfile->retval= retval;
- sfile->ipotype= fromcode;
-}
-
-void activate_databrowse_args(struct ID *id, int idcode, int fromcode, short *menup, void (*func)(char *, void *, void *), void *arg1, void *arg2)
-{
- ListBase *lb;
- SpaceFile *sfile;
- char str[32];
-
- if(id==NULL) {
- lb= wich_libbase(G.main, idcode);
- id= lb->first;
- }
-
- if(id) BLI_strncpy(str, id->name, sizeof(str));
- else return;
-
- activate_fileselect_(FILE_MAIN, "SELECT DATABLOCK", str, menup, NULL, NULL, NULL, func, arg1, arg2);
-
- sfile= curarea->spacedata.first;
- sfile->ipotype= fromcode;
-}
-
-void filesel_prevspace()
-{
- SpaceFile *sfile= curarea->spacedata.first;
-
- /* cleanup */
- if(sfile->spacetype==SPACE_FILE) {
- if(sfile->pupmenu) {
- MEM_freeN(sfile->pupmenu);
- sfile->pupmenu= NULL;
- }
- }
-
- if(sfile->next) {
-
- BLI_remlink(&curarea->spacedata, sfile);
- BLI_addtail(&curarea->spacedata, sfile);
-
- sfile= curarea->spacedata.first;
-
- if (sfile->spacetype == SPACE_SCRIPT) {
- SpaceScript *sc = (SpaceScript *)sfile;
- if (sc->script) sc->script->flags &=~SCRIPT_FILESEL;
- }
-
- newspace(curarea, sfile->spacetype);
- }
- else newspace(curarea, SPACE_INFO);
-}
-
-static int countselect(SpaceFile *sfile)
-{
- int a, count=0;
-
- for(a=0; a<sfile->totfile; a++) {
- if(sfile->filelist[a].flags & ACTIVE) {
- count++;
- }
- }
- return count;
-}
-
-static int getotherdir(void)
-{
- ScrArea *sa;
- SpaceFile *sfile=0;
-
- sa= G.curscreen->areabase.first;
- while(sa) {
- if(sa!=curarea) {
- if(sa->spacetype==SPACE_FILE) {
-
- /* already found one */
- if(sfile) return 0;
-
- sfile= sa->spacedata.first;
-
- if(sfile->type & FILE_UNIX) {
- otherarea= sa;
- BLI_make_file_string(G.sce, otherdir, sfile->dir, "");
- }
- else sfile= 0;
- }
- }
- sa= sa->next;
- }
- if(sfile) return 1;
- return 0;
-}
-
-static void reread_other_fs(void)
-{
- SpaceFile *sfile;
-
- /* watch it: only call when getotherdir returned OK */
-
- sfile= otherarea->spacedata.first;
- freefilelist(sfile);
- scrarea_queue_winredraw(otherarea);
-}
-
-
-void free_filesel_spec(char *dir)
-{
- /* all filesels with 'dir' are freed */
- bScreen *sc;
-
- sc= G.main->screen.first;
- while(sc) {
- ScrArea *sa= sc->areabase.first;
- while(sa) {
- SpaceLink *sl= sa->spacedata.first;
- while(sl) {
- if(sl->spacetype==SPACE_FILE) {
- SpaceFile *sfile= (SpaceFile*) sl;
- if (BLI_streq(sfile->dir, dir)) {
- freefilelist(sfile);
- }
- }
- sl= sl->next;
- }
- sa= sa->next;
- }
- sc= sc->id.next;
- }
-}
-
-/* NOTE: this is called for file read, after the execfunc no UI memory is valid! */
-static void filesel_execute(SpaceFile *sfile)
-{
- struct direntry *files;
- char name[FILE_MAX];
- int a;
-
- filesel_prevspace();
-
- if(sfile->type==FILE_LOADLIB) {
- if(sfile->flag & FILE_STRINGCODE) {
- if (!G.relbase_valid) {
- okee("You have to save the .blend file before using relative paths! Using absolute path instead.");
- sfile->flag &= ~FILE_STRINGCODE;
- }
- }
-
- do_library_append(sfile);
- BIF_undo_push("Append from file");
- allqueue(REDRAWALL, 1);
- }
- else if(filesel_has_func(sfile)) {
- fsmenu_insert_entry(sfile->dir, 1, 0);
-
- if(sfile->type==FILE_MAIN) { /* DATABROWSE */
- if (sfile->menup) { /* with value pointing to ID block index */
- int notfound = 1;
-
- /* Need special handling since hiding .* datablocks means that
- sfile->act is no longer the same as files->nr.
-
- Also, toggle HIDE_DOT on and off can make sfile->act not longer
- correct (meaning it doesn't point to the correct item in the filelist.
-
- sfile->file is always correct, so first with check if, for the item
- corresponding to sfile->act, the name is the same.
-
- If it isn't (or if sfile->act is not good), go over filelist and take
- the correct one.
-
- This means that selecting a datablock than hiding it makes it
- unselectable. Not really a problem.
-
- - theeth
- */
-
- *sfile->menup= -1;
-
- if(sfile->act>=0) {
- if(sfile->filelist) {
- files= sfile->filelist+sfile->act;
- if ( strcmp(files->relname, sfile->file)==0) {
- notfound = 0;
- *sfile->menup= files->nr;
- }
- }
- }
- if (notfound) {
- for(a=0; a<sfile->totfile; a++) {
- if( strcmp(sfile->filelist[a].relname, sfile->file)==0) {
- *sfile->menup= sfile->filelist[a].nr;
- break;
- }
- }
- }
- }
- if(sfile->returnfunc_event)
- sfile->returnfunc_event(sfile->retval);
- else if(sfile->returnfunc_args)
- sfile->returnfunc_args(NULL, sfile->arg1, sfile->arg2);
- }
- else {
- if(strncmp(sfile->title, "Save", 4)==0) free_filesel_spec(sfile->dir);
- if(strncmp(sfile->title, "Export", 6)==0) free_filesel_spec(sfile->dir);
-
- BLI_strncpy(name, sfile->dir, sizeof(name));
- strcat(name, sfile->file);
-
- if(sfile->flag & FILE_STRINGCODE) {
- /* still weak, but we don't want saving files to make relative paths */
- if(G.relbase_valid && strncmp(sfile->title, "Save", 4)) {
- BLI_makestringcode(G.sce, name);
- } else {
- /* if we don't have a valid relative base (.blend file hasn't been saved yet)
- then we don't save the path as relative (for texture images, background image).
- Warning message not shown when saving files (doesn't make sense there)
- */
- if (strncmp(sfile->title, "Save", 4)) {
- printf("Relative path setting has been ignored because .blend file hasn't been saved yet.\n");
- }
- sfile->flag &= ~FILE_STRINGCODE;
- }
- }
- if(sfile->returnfunc)
- sfile->returnfunc(name);
- else if(sfile->returnfunc_args)
- sfile->returnfunc_args(name, sfile->arg1, sfile->arg2);
- }
- }
-}
-
-static void do_filesel_buttons(short event, SpaceFile *sfile)
-{
- char butname[FILE_MAX];
-
- if (event == B_FS_FILENAME) {
- if (strchr(sfile->file, '*') || strchr(sfile->file, '?') || strchr(sfile->file, '[')) {
- int i, match = FALSE;
-
- for (i = 2; i < sfile->totfile; i++) {
- if (fnmatch(sfile->file, sfile->filelist[i].relname, 0) == 0) {
- sfile->filelist[i].flags |= ACTIVE;
- match = TRUE;
- }
- }
- if (match) sfile->file[0] = '\0';
- if(sfile->type==FILE_MAIN) filesel_select_objects(sfile);
- scrarea_queue_winredraw(curarea);
- }
- }
- else if(event== B_FS_DIRNAME) {
- /* reuse the butname variable */
- BLI_cleanup_dir(G.sce, sfile->dir);
-
- BLI_make_file_string(G.sce, butname, sfile->dir, "");
- BLI_strncpy(sfile->dir, butname, sizeof(sfile->dir));
-
- /* strip the trailing slash if its a real dir */
- if (strlen(butname)!=1)
- butname[strlen(butname)-1]=0;
-
- if(sfile->type & FILE_UNIX) {
- if (!BLI_exists(butname)) {
- if (okee("Makedir")) {
- BLI_recurdir_fileops(butname);
- if (!BLI_exists(butname)) parent(sfile);
- } else parent(sfile);
- }
- }
- freefilelist(sfile);
- sfile->ofs= 0;
- scrarea_queue_winredraw(curarea);
- }
- else if(event== B_FS_DIR_MENU) {
- char *selected= fsmenu_get_entry(sfile->menu-1);
-
- /* which string */
- if (selected) {
- BLI_strncpy(sfile->dir, selected, sizeof(sfile->dir));
- BLI_make_exist(sfile->dir);
- BLI_cleanup_dir(G.sce, sfile->dir);
- freefilelist(sfile);
- sfile->ofs= 0;
- scrarea_queue_winredraw(curarea);
- }
-
- sfile->act= -1;
-
- }
- else if(event== B_FS_PARDIR)
- parent(sfile);
- else if(event== B_FS_LOAD) {
- if(sfile->type)
- filesel_execute(sfile);
- }
- else if(event== B_FS_CANCEL)
- filesel_prevspace();
- else if(event== B_FS_LIBNAME) {
- Library *lib= BLI_findlink(&G.main->library, sfile->menu);
- if(lib) {
- BLI_strncpy(sfile->dir, lib->filename, sizeof(sfile->dir));
- BLI_make_exist(sfile->dir);
- BLI_cleanup_dir(G.sce, sfile->dir);
- freefilelist(sfile);
- sfile->ofs= 0;
- scrarea_queue_winredraw(curarea);
- sfile->act= -1;
- }
- }
-
-}
-
-/****/
-
-typedef void (*ReplaceFP)(ID *oldblock, ID *newblock);
-
-static void change_id_link(void *linkpv, void *newlinkv) {
- ID **linkp= (ID**) linkpv;
- ID *newlink= newlinkv;
-
- if (*linkp) {
- (*linkp)->us--;
- }
- (*linkp)= newlink;
- if (newlink) {
- id_us_plus(newlink);
- }
-}
-
-static void replace_image(ID *oldblock, ID *newblock) {
- Image *oldima= (Image*) oldblock;
- Image *newima= (Image*) newblock;
- bScreen *sc;
- Scene *sce;
- Tex *tex;
- Mesh *me;
-
- for (tex= G.main->tex.first; tex; tex= tex->id.next) {
- if (tex->env && tex->env->type == ENV_LOAD && tex->env->ima == oldima)
- change_id_link(&tex->env->ima, newima);
- if (tex->ima == oldima)
- change_id_link(&tex->ima, newima);
- }
-
- for (sce= G.main->scene.first; sce; sce= sce->id.next) {
- if (sce->ima == oldima)
- change_id_link(&sce->ima, newima);
- }
-
- for (sc= G.main->screen.first; sc; sc= sc->id.next) {
- ScrArea *sa;
-
- for (sa= sc->areabase.first; sa; sa= sa->next) {
- SpaceLink *sl;
-
- for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if (sl->spacetype == SPACE_VIEW3D) {
- View3D *v3d= (View3D*) sl;
- BGpic *bgp= v3d->bgpic;
-
- if (bgp && bgp->ima == oldima)
- change_id_link(&bgp->ima, newima);
- } else if (sl->spacetype == SPACE_IMAGE) {
- SpaceImage *sima= (SpaceImage*) sl;
-
- if (sima->image == oldima)
- change_id_link(&sima->image, newima);
- }
- }
- }
- }
-
- for (me= G.main->mesh.first; me; me= me->id.next) {
- int i, a;
- MTFace *tface;
-
- for(i=0; i<me->fdata.totlayer; i++) {
- if(me->fdata.layers[i].type == CD_MTFACE) {
- tface= (MTFace*)me->fdata.layers[i].data;
-
- for (a=0; a<me->totface; a++, tface++) {
- if (tface->tpage == oldima) {
- /* not change_id_link, tpage's aren't owners :(
- * see hack below.
- */
- tface->tpage= newima;
- }
- }
- }
- }
- }
-
- /* Nasty hack, necessary because tpages don't act
- * as a user, so there lots of image user count
- * munging occurs... this will ensure the image
- * really dies.
- */
- oldima->id.us= 0;
-}
-
-static void replace_material(ID *oldblock, ID *newblock)
-{
- Material *old= (Material*) oldblock;
- Material *new= (Material*) newblock;
- Material ***matarar;
- ID *id;
- Object *ob;
- int a;
-
- ob= G.main->object.first;
- while(ob) {
- if(ob->totcol && ob->id.lib==0) {
- matarar= give_matarar(ob);
- for(a=1; a<=ob->totcol; a++) {
- if(ob->mat[a-1] == old) {
- if(old) old->id.us--;
- id_us_plus((ID *)new);
- ob->mat[a-1]= new;
- }
- id= ob->data;
- if( (*matarar)[a-1] == old && id->lib==0) {
- if(old) old->id.us--;
- id_us_plus((ID *)new);
- (*matarar)[a-1]= new;
- }
- }
- }
- ob= ob->id.next;
- }
-}
-
-static ReplaceFP get_id_replace_function(int idcode) {
- switch (idcode) {
- case ID_MA:
- return &replace_material;
- case ID_IM:
- return &replace_image;
- default:
- return NULL;
- }
-}
-
-static void databrowse_replace(SpaceFile *sfile, int idcode)
-{
- ReplaceFP replace_func= get_id_replace_function(idcode);
-
- if (!replace_func) {
- error("Replacing %s blocks is unsupported", BLO_idcode_to_name(idcode));
- } else if (sfile->act==-1) {
- error("Select target with leftmouse");
- } else {
- ID *target= (ID*) sfile->filelist[sfile->act].poin;
-
- if (target) {
- char buf[128];
-
- sprintf(buf, "Replace with %s: %s", BLO_idcode_to_name(idcode), target->name+2);
-
- if (okee(buf)) {
- int i;
-
- for (i = 0; i <sfile->totfile; i++)
- if ((sfile->filelist[i].flags&ACTIVE) && sfile->filelist[i].poin!=target)
- replace_func(sfile->filelist[i].poin, target);
- }
- }
- }
-
- freefilelist(sfile);
- scrarea_queue_winredraw(curarea);
-}
-
-static void fs_fake_users(SpaceFile *sfile)
-{
- ID *id;
- int a;
-
- /* only for F4 DATABROWSE */
- if(filesel_has_func(sfile)) return;
-
- for(a=0; a<sfile->totfile; a++) {
- if(sfile->filelist[a].flags & ACTIVE) {
- id= (ID *)sfile->filelist[a].poin;
- if(id) {
- if( id->flag & LIB_FAKEUSER) {
- id->flag -= LIB_FAKEUSER;
- id->us--;
- }
- else {
- id->flag |= LIB_FAKEUSER;
- id->us++;
- }
- }
- }
- }
- freefilelist(sfile);
- scrarea_queue_winredraw(curarea);
-}
-
-
-static int get_hilited_entry(SpaceFile *sfile)
-{
- int a;
-
- for(a=0; a<sfile->totfile; a++) {
- if(sfile->filelist[a].flags & HILITE) {
- return a;
- }
- }
- return -1;
-}
-
-
-void winqreadfilespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
-{
- unsigned short event= evt->event;
- short val= evt->val;
- static int acto=0;
- SpaceFile *sfile;
- int act, do_draw= 0, i, test, ret = 0;
- short qual, mval[2];
- char str[FILE_MAX+12];
-
- sfile= curarea->spacedata.first;
- if(sfile==0) return;
- if(sfile->filelist==0) {
- return;
- }
-
- if(curarea->win==0) return;
- calc_file_rcts(sfile);
- getmouseco_areawin(mval);
-
- /* prevent looping */
- if(selecting && !(get_mbut() & R_MOUSE)) selecting= 0;
-
- if(val) {
-
- if( event!=RETKEY && event!=PADENTER)
- if( uiDoBlocks(&curarea->uiblocks, event, 1)!=UI_NOTHING ) event= 0;
-
- switch(event) {
-
- case UI_BUT_EVENT:
- do_filesel_buttons(val, sfile);
- break;
-
- case WHEELDOWNMOUSE:
- do_filescrollwheel(sfile, U.wheellinescroll);
- act= find_active_file(sfile, mval[0], mval[1]);
- set_active_file(sfile, act);
- do_draw= 1;
- break;
- case WHEELUPMOUSE:
- do_filescrollwheel(sfile, -U.wheellinescroll);
- act= find_active_file(sfile, mval[0], mval[1]);
- set_active_file(sfile, act);
- do_draw= 1;
- break;
-
- case LEFTMOUSE:
- case MIDDLEMOUSE:
- if(mval[0]>scrollrct.xmin && mval[0]<scrollrct.xmax && mval[1]>scrollrct.ymin && mval[1]<scrollrct.ymax) {
- do_filescroll(sfile);
- }
- else if(mval[0]>textrct.xmin && mval[0]<textrct.xmax && mval[1]>textrct.ymin && mval[1]<textrct.ymax) {
-
- /* sfile->act is used in databrowse: double names of library objects */
-
- sfile->act= act= find_active_file(sfile, mval[0], mval[1]);
-
- if(act>=0 && act<sfile->totfile) {
- if(S_ISDIR(sfile->filelist[act].type)) {
- /* the path is too long and we are not going up! */
- if (strcmp(sfile->filelist[act].relname, ".") &&
- strcmp(sfile->filelist[act].relname, "..") &&
- strlen(sfile->dir) + strlen(sfile->filelist[act].relname) >= FILE_MAXDIR )
- {
- error("Path too long, cannot enter this directory");
- } else {
- strcat(sfile->dir, sfile->filelist[act].relname);
- strcat(sfile->dir,"/");
- BLI_cleanup_dir(G.sce, sfile->dir);
- freefilelist(sfile);
- sfile->ofs= 0;
- do_draw= 1;
- }
- }
- else {
- if( strcmp(sfile->file, sfile->filelist[act].relname)) {
- char tmpstr[240];
- do_draw= 1;
- BLI_strncpy(sfile->file, sfile->filelist[act].relname, sizeof(sfile->file));
- if (sfile->f_fp) {
- sprintf (tmpstr, "%s%s", sfile->dir, sfile->file);
- /* printf ("%s\n", tmpstr); */
- #ifdef INTERNATIONAL
- if (!FTF_GetNewFont ((const unsigned char *)tmpstr, 0, U.fontsize))
- error ("No font file");
- #endif
- }
- }
- if(event==MIDDLEMOUSE && sfile->type) filesel_execute(sfile);
- }
- }
- }
- break;
- case RIGHTMOUSE:
- act= find_active_file(sfile, mval[0], mval[1]);
- acto= act;
- if(act>=0 && act<sfile->totfile) {
-
- if (sfile->filelist[act].flags & ACTIVE) {
- sfile->filelist[act].flags &= ~ACTIVE;
- selecting = INACTIVATE;
- }
- else {
- test= sfile->filelist[act].relname[0];
- if (act>=2 || test!='.') sfile->filelist[act].flags |= ACTIVE;
-
- selecting = ACTIVATE;
- }
- do_draw= 1;
- }
- break;
- case MOUSEY:
- act= find_active_file(sfile, mval[0], mval[1]);
- if (act!=acto) {
- set_active_file(sfile, act);
- }
- if(selecting && act!=acto) {
-
- while(1) {
- if (acto >= 2 && acto < sfile->totfile) {
- if (selecting == ACTIVATE) sfile->filelist[acto].flags |= ACTIVE;
- else if (selecting == INACTIVATE) sfile->filelist[acto].flags &= ~ACTIVE;
- }
- if (acto < act) acto++;
- else if (acto > act) acto--;
- else break;
-
- }
-
- }
- acto= act;
- break;
-
- case PAGEUPKEY:
- sfile->ofs-= page_ofs;
- do_draw= 1;
- break;
- case PAGEDOWNKEY:
- sfile->ofs+= page_ofs;
- do_draw= 1;
- break;
- case HOMEKEY:
- sfile->ofs= 0;
- do_draw= 1;
- break;
- case ENDKEY:
- sfile->ofs= sfile->totfile;
- do_draw= 1;
- break;
-
- case AKEY:
- swapselect_file(sfile);
- if(sfile->type==FILE_MAIN) filesel_select_objects(sfile);
- do_draw= 1;
- break;
-
- case BKEY:
- case CKEY:
- case LKEY:
- if(event==LKEY && sfile->type==FILE_MAIN && (G.qual & LR_CTRLKEY)) {
- databrowse_replace(sfile, groupname_to_code(sfile->dir));
- break;
- }
- /* pass */
- case MKEY:
- if(sfile->type==FILE_MAIN) break;
-
- if(!countselect(sfile)) {
- error("No files selected");
- break;
- }
-
- if(!getotherdir()) {
- error("No second fileselect");
- break;
- }
-
- if (!strcmp(sfile->dir, otherdir)) {
- error("Same directories");
- break;
- }
-
- if(event==BKEY) sprintf(str, "Backup to %s", otherdir);
- else if(event==CKEY) sprintf(str, "Copy to %s", otherdir);
- else if(event==LKEY) sprintf(str, "Linked copy to %s", otherdir);
- else if(event==MKEY) sprintf(str, "Move to %s", otherdir);
-
- if (!okee(str)) break;
-
- for (i = 0; i<sfile->totfile; i++){
- if (sfile->filelist[i].flags & ACTIVE) {
- BLI_make_file_string(G.sce, str, sfile->dir, sfile->filelist[i].relname);
-
- if(event==BKEY) ret= BLI_backup(sfile->filelist[i].relname, sfile->dir, otherdir);
- else if(event==CKEY) ret= BLI_copy_fileops(str, otherdir);
- else if(event==LKEY) ret= BLI_link(str, otherdir);
- else if(event==MKEY) ret= BLI_move(str, otherdir);
-
- if (ret) {error("Command failed, see console"); break;}
- else sfile->filelist[i].flags &= ~ACTIVE;
- }
- }
- do_draw= 1;
- if(event==BKEY || event==MKEY)
- freefilelist(sfile);
-
- reread_other_fs();
-
- break;
-
- case XKEY:
- test = get_hilited_entry(sfile);
-
- if (test != -1 && !(S_ISDIR(sfile->filelist[test].type))){
- BLI_make_file_string(G.sce, str, sfile->dir, sfile->filelist[test].relname);
-
- if( okee("Remove %s", str) ) {
- ret = BLI_delete(str, 0, 0);
- if (ret) {
- error("Command failed, see console");
- } else {
- freefilelist(sfile);
- do_draw= 1;
- }
- }
- }
- break;
-
- case RKEY:
- if(sfile->type==FILE_MAIN) {
- databrowse_replace(sfile, groupname_to_code(sfile->dir));
- break;
- }
- /* pass to TKEY! */
-
- case TKEY:
- if(sfile->type==FILE_MAIN) break;
-
- if(!countselect(sfile)) {
- error("No files selected");
- break;
- }
-
- if(event==TKEY) sprintf(str, "Touch");
- else if(event==RKEY) sprintf(str, "Remove from %s", sfile->dir);
-
- qual= G.qual; /* because after okee() you released the SHIFT */
- if (!okee(str)) break;
-
- for (i = 0; i <sfile->totfile; i++) {
- if (sfile->filelist[i].flags & ACTIVE) {
- BLI_make_file_string(G.sce, str, sfile->dir, sfile->filelist[i].relname);
-
- if(event==TKEY) ret= BLI_touch(str);
- else if(event==RKEY) {
- if(qual & LR_SHIFTKEY) ret= BLI_delete(str, 0, 1);
- else if(S_ISDIR(sfile->filelist[i].type)) ret= BLI_delete(str, 1, 0);
- else ret= BLI_delete(str, 0, 0);
- }
-
- if (ret) {error("Command failed, see console"); break;}
- else sfile->filelist[i].flags &= ~ACTIVE;
- }
- }
- do_draw= 1;
- freefilelist(sfile);
-
- break;
-
- case PKEY:
- if(G.qual & LR_SHIFTKEY) {
- extern char bprogname[]; /* usiblender.c */
-#ifdef WIN32
- sprintf(str, "%s -a \"%s%s\"", bprogname, sfile->dir, sfile->file);
-#else
- sprintf(str, "\"%s\" -a \"%s%s\"", bprogname, sfile->dir, sfile->file);
-#endif
- system(str);
- }
- else
- parent(sfile);
-
- break;
-
- case IKEY:
- if(sfile->type==FILE_MAIN) break;
-
- sprintf(str, "$IMAGEEDITOR %s%s", sfile->dir, sfile->file);
- system(str);
- break;
-
- case EKEY:
- if(sfile->type==FILE_MAIN) break;
-
- sprintf(str, "$WINEDITOR %s%s", sfile->dir, sfile->file);
- system(str);
- break;
-
- case FKEY:
- if(sfile->type==FILE_MAIN) {
- fs_fake_users(sfile);
- }
- break;
-
- case PADPLUSKEY:
- case EQUALKEY:
- if (G.qual & LR_CTRLKEY) BLI_newname(sfile->file, +100);
- else if (G.qual & LR_SHIFTKEY) BLI_newname(sfile->file, +10);
- else BLI_newname(sfile->file, +1);
-
- do_draw= 1;
- break;
-
- case PADMINUS:
- case MINUSKEY:
- if (G.qual & LR_CTRLKEY) BLI_newname(sfile->file, -100);
- else if (G.qual & LR_SHIFTKEY) BLI_newname(sfile->file, -10);
- else BLI_newname(sfile->file, -1);
-
- do_draw= 1;
- break;
-
- case BACKSLASHKEY:
- case SLASHKEY:
- if(sfile->type==FILE_MAIN) break;
-
-#ifdef WIN32
- BLI_strncpy(sfile->dir, "\\", sizeof(sfile->dir));
-#else
- BLI_strncpy(sfile->dir, "/", sizeof(sfile->dir));
-#endif
- freefilelist(sfile);
- sfile->ofs= 0;
- do_draw= 1;
- break;
- case PERIODKEY:
- freefilelist(sfile);
- do_draw= 1;
- break;
- case ESCKEY:
- filesel_prevspace();
- break;
- case PADENTER:
- case RETKEY:
- if(sfile->type) filesel_execute(sfile);
- break;
- }
- }
- else if(event==RIGHTMOUSE) {
- selecting = NOTACTIVE;
- if(sfile->type==FILE_MAIN) filesel_select_objects(sfile);
- }
- else if(event==LEFTMOUSE) {
- if(sfile->type==FILE_MAIN) active_file_object(sfile);
- }
-
- /* XXX, stupid patch, curarea can become undone
- * because of file loading... fixme zr
- */
- if(do_draw && curarea) scrarea_queue_winredraw(curarea);
-}
-
-
-
-
-/* ************* LIBRARY FILESEL ******************* */
-
-static int groupname_to_code(char *group)
-{
- char buf[GROUP_MAX];
- char *lslash;
-
- BLI_strncpy(buf, group, GROUP_MAX);
- lslash= BLI_last_slash(buf);
- if (lslash)
- lslash[0]= '\0';
-
- return BLO_idcode_from_name(buf);
-}
-
-static int is_a_library(SpaceFile *sfile, char *dir, char *group)
-{
- /* return ok when a blenderfile, in dir is the filename,
- * in group the type of libdata
- */
- int len;
- char *fd;
-
- strcpy(dir, sfile->dir);
- len= strlen(dir);
- if(len<7) return 0;
- if( dir[len-1] != '/' && dir[len-1] != '\\') return 0;
-
- group[0]= 0;
- dir[len-1]= 0;
-
- /* Find the last slash */
- fd= (strrchr(dir, '/')>strrchr(dir, '\\'))?strrchr(dir, '/'):strrchr(dir, '\\');
-
- if(fd==0) return 0;
- *fd= 0;
- if(BLO_has_bfile_extension(fd+1)) {
- /* the last part of the dir is a .blend file, no group follows */
- *fd= '/'; /* put back the removed slash separating the dir and the .blend file name */
- }
- else {
- char *gp = fd+1; // in case we have a .blend file, gp points to the group
-
- /* Find the last slash */
- fd= (strrchr(dir, '/')>strrchr(dir, '\\'))?strrchr(dir, '/'):strrchr(dir, '\\');
- if (!fd || !BLO_has_bfile_extension(fd+1)) return 0;
-
- /* now we know that we are in a blend file and it is safe to
- assume that gp actually points to a group */
- if (BLI_streq("Screen", gp)==0)
- BLI_strncpy(group, gp, GROUP_MAX);
- }
- return 1;
-}
-
-static void do_library_append(SpaceFile *sfile)
-{
- Library *lib;
- char dir[FILE_MAX], group[GROUP_MAX];
-
- if ( is_a_library(sfile, dir, group)==0 ) {
- error("Not a library");
- } else if (!sfile->libfiledata) {
- error("Library not loaded");
- } else if (group[0]==0) {
- error("Nothing indicated");
- } else if (BLI_streq(G.main->name, dir)) {
- error("Cannot use current file as library");
- } else {
- Object *ob;
- int idcode = groupname_to_code(group);
-
- if((sfile->flag & FILE_LINK)==0)
- /* tag everything, all untagged data can be made local */
- flag_all_listbases_ids(LIB_APPEND_TAG, 1);
-
- BLO_library_append(sfile, dir, idcode);
-
- /* DISPLISTS? */
- ob= G.main->object.first;
- while(ob) {
- if(ob->id.lib) {
- ob->recalc |= OB_RECALC;
- }
- ob= ob->id.next;
- }
-
- /* and now find the latest append lib file */
- lib= G.main->library.first;
- while(lib) {
- if (BLI_streq(dir, lib->filename)) break;
- lib= lib->id.next;
- }
-
- /* make local */
- if(lib && (sfile->flag & FILE_LINK)==0) {
- all_local(lib, 1);
- /* important we unset, otherwise these object wont
- * link into other scenes from this blend file */
- flag_all_listbases_ids(LIB_APPEND_TAG, 0);
- }
-
- DAG_scene_sort(G.scene);
-
- /* in sfile->dir is the whole lib name */
- BLI_strncpy(G.lib, sfile->dir, sizeof(G.lib) );
- }
-}
-
-static void library_to_filelist(SpaceFile *sfile)
-{
- LinkNode *l, *names;
- int ok, i, nnames, idcode;
- char filename[FILE_MAX];
- char dir[FILE_MAX], group[GROUP_MAX];
-
- /* name test */
- ok= is_a_library(sfile, dir, group);
- if (!ok) {
- /* free */
- if(sfile->libfiledata) BLO_blendhandle_close(sfile->libfiledata);
- sfile->libfiledata= 0;
- return;
- }
-
- BLI_strncpy(filename, G.sce, sizeof(filename)); // G.sce = last file loaded, for UI
-
- /* there we go */
- /* for the time being only read filedata when libfiledata==0 */
- if (sfile->libfiledata==0) {
- sfile->libfiledata= BLO_blendhandle_from_file(dir); // this sets G.sce, we dont want it
-
- if(sfile->libfiledata==0) return;
- }
-
- idcode= groupname_to_code(group);
-
- // memory for strings is passed into filelist[i].relname
- // and free'd in freefilelist
- if (idcode) {
- names= BLO_blendhandle_get_datablock_names(sfile->libfiledata, idcode);
- } else {
- names= BLO_blendhandle_get_linkable_groups(sfile->libfiledata);
- }
-
- nnames= BLI_linklist_length(names);
-
- sfile->totfile= nnames + 2;
- sfile->filelist= malloc(sfile->totfile * sizeof(*sfile->filelist));
- memset(sfile->filelist, 0, sfile->totfile * sizeof(*sfile->filelist));
-
- sfile->filelist[0].relname= BLI_strdup(".");
- sfile->filelist[0].type |= S_IFDIR;
- sfile->filelist[1].relname= BLI_strdup("..");
- sfile->filelist[1].type |= S_IFDIR;
-
- for (i=0, l= names; i<nnames; i++, l= l->next) {
- char *blockname= BLI_strdup(l->link);
-
- sfile->filelist[i + 2].relname= blockname;
- if (!idcode)
- sfile->filelist[i + 2].type |= S_IFDIR;
- }
-
- BLI_linklist_free(names, free);
-
- qsort(sfile->filelist, sfile->totfile, sizeof(struct direntry), compare_name);
-
- sfile->maxnamelen= 0;
- for(i=0; i<sfile->totfile; i++) {
- int len = BMF_GetStringWidth(G.font, sfile->filelist[i].relname);
- if (len > sfile->maxnamelen)
- sfile->maxnamelen = len;
- }
-
- BLI_strncpy(G.sce, filename, sizeof(filename)); // prevent G.sce to change
-
-}
-
-/* ******************* DATA SELECT ********************* */
-
-static void filesel_select_objects(SpaceFile *sfile)
-{
- Object *ob;
- Base *base;
- Scene *sce;
- int a;
-
- /* only when F4 DATABROWSE */
- if(filesel_has_func(sfile)) return;
-
- if( strcmp(sfile->dir, "Object/")==0 ) {
- for(a=0; a<sfile->totfile; a++) {
-
- ob= (Object *)sfile->filelist[a].poin;
-
- if(ob && (ob->flag & OB_RESTRICT_VIEW)==0) {
- if(sfile->filelist[a].flags & ACTIVE) ob->flag |= SELECT;
- else ob->flag &= ~SELECT;
- }
-
- }
- base= FIRSTBASE;
- while(base) {
- base->flag= base->object->flag;
- base= base->next;
- }
- countall();
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWOOPS, 0);
- }
- else if( strcmp(sfile->dir, "Scene/")==0 ) {
-
- for(a=0; a<sfile->totfile; a++) {
-
- sce= (Scene *)sfile->filelist[a].poin;
- if(sce) {
- if(sfile->filelist[a].flags & ACTIVE) sce->r.scemode |= R_BG_RENDER;
- else sce->r.scemode &= ~R_BG_RENDER;
- }
-
- }
- allqueue(REDRAWBUTSSCENE, 0);
- }
-}
-
-static void active_file_object(SpaceFile *sfile)
-{
- Object *ob;
-
- /* only when F4 DATABROWSE */
- if(filesel_has_func(sfile)) return;
-
- if( strcmp(sfile->dir, "Object/")==0 ) {
- if(sfile->act >= 0) {
-
- ob= (Object *)sfile->filelist[sfile->act].poin;
-
- if(ob && (ob->flag & OB_RESTRICT_VIEW)==0) {
- set_active_object(ob);
- if(BASACT && BASACT->object==ob) {
- BASACT->flag |= SELECT;
- sfile->filelist[sfile->act].flags |= ACTIVE;
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWOOPS, 0);
- scrarea_queue_winredraw(curarea);
- }
- }
- }
- }
-}
-
-
-void main_to_filelist(SpaceFile *sfile)
-{
- ID *id;
- struct direntry *files, *firstlib = NULL;
- ListBase *lb;
- int a, fake, idcode, len, ok, totlib, totbl;
- short hide = 0;
-
- if (sfile->flag & FILE_HIDE_DOT)
- hide = 1;
-
- if(sfile->dir[0]=='/') sfile->dir[0]= 0;
-
- if(sfile->dir[0]) {
- idcode= groupname_to_code(sfile->dir);
- if(idcode==0) sfile->dir[0]= 0;
- }
-
- if( sfile->dir[0]==0) {
-
- /* make directories */
- sfile->totfile= 24;
- sfile->filelist= (struct direntry *)malloc(sfile->totfile * sizeof(struct direntry));
-
- for(a=0; a<sfile->totfile; a++) {
- memset( &(sfile->filelist[a]), 0 , sizeof(struct direntry));
- sfile->filelist[a].type |= S_IFDIR;
- }
-
- sfile->filelist[0].relname= BLI_strdup("..");
- sfile->filelist[1].relname= BLI_strdup(".");
- sfile->filelist[2].relname= BLI_strdup("Scene");
- sfile->filelist[3].relname= BLI_strdup("Group");
- sfile->filelist[4].relname= BLI_strdup("Object");
- sfile->filelist[5].relname= BLI_strdup("Mesh");
- sfile->filelist[6].relname= BLI_strdup("Curve");
- sfile->filelist[7].relname= BLI_strdup("Metaball");
- sfile->filelist[8].relname= BLI_strdup("Material");
- sfile->filelist[9].relname= BLI_strdup("Texture");
- sfile->filelist[10].relname= BLI_strdup("Image");
- sfile->filelist[11].relname= BLI_strdup("Wave");
- sfile->filelist[12].relname= BLI_strdup("Lattice");
- sfile->filelist[13].relname= BLI_strdup("Lamp");
- sfile->filelist[14].relname= BLI_strdup("Camera");
- sfile->filelist[15].relname= BLI_strdup("Ipo");
- sfile->filelist[16].relname= BLI_strdup("World");
- sfile->filelist[17].relname= BLI_strdup("Screen");
- sfile->filelist[18].relname= BLI_strdup("VFont");
- sfile->filelist[19].relname= BLI_strdup("Text");
- sfile->filelist[20].relname= BLI_strdup("Armature");
- sfile->filelist[21].relname= BLI_strdup("Action");
- sfile->filelist[22].relname= BLI_strdup("NodeTree");
- sfile->filelist[23].relname= BLI_strdup("Brush");
-
- qsort(sfile->filelist, sfile->totfile, sizeof(struct direntry), compare_name);
- }
- else {
-
- /* make files */
- idcode= groupname_to_code(sfile->dir);
-
- lb= wich_libbase(G.main, idcode );
- if(lb==0) return;
-
- id= lb->first;
- sfile->totfile= 0;
- while(id) {
- if(filesel_has_func(sfile) && idcode==ID_IP) {
- if(sfile->ipotype== ((Ipo *)id)->blocktype) sfile->totfile++;
- }
- else if (hide==0 || id->name[2] != '.')
- sfile->totfile++;
-
- id= id->next;
- }
-
- if(!filesel_has_func(sfile)) sfile->totfile+= 2;
- sfile->filelist= (struct direntry *)malloc(sfile->totfile * sizeof(struct direntry));
-
- files= sfile->filelist;
-
- if(!filesel_has_func(sfile)) {
- memset( &(sfile->filelist[0]), 0 , sizeof(struct direntry));
- sfile->filelist[0].relname= BLI_strdup(".");
- sfile->filelist[0].type |= S_IFDIR;
- memset( &(sfile->filelist[1]), 0 , sizeof(struct direntry));
- sfile->filelist[1].relname= BLI_strdup("..");
- sfile->filelist[1].type |= S_IFDIR;
-
- files+= 2;
- }
-
- id= lb->first;
- totlib= totbl= 0;
-
- while(id) {
-
- ok= 0;
- if(filesel_has_func(sfile) && idcode==ID_IP) {
- if(sfile->ipotype== ((Ipo *)id)->blocktype) ok= 1;
- }
- else ok= 1;
-
- if(ok) {
-
- if (hide==0 || id->name[2] != '.') {
- memset( files, 0 , sizeof(struct direntry));
- if(id->lib==NULL)
- files->relname= BLI_strdup(id->name+2);
- else {
- char tmp[FILE_MAX], fi[FILE_MAXFILE];
- BLI_strncpy(tmp, id->lib->name, FILE_MAX);
- BLI_splitdirstring(tmp, fi);
- files->relname= MEM_mallocN(FILE_MAXFILE+32, "filename for lib");
- sprintf(files->relname, "%s / %s", fi, id->name+2);
- }
-
- if(!filesel_has_func(sfile)) { /* F4 DATA BROWSE */
- if(idcode==ID_OB) {
- if( ((Object *)id)->flag & SELECT) files->flags |= ACTIVE;
- }
- else if(idcode==ID_SCE) {
- if( ((Scene *)id)->r.scemode & R_BG_RENDER) files->flags |= ACTIVE;
- }
- }
- files->nr= totbl+1;
- files->poin= id;
- fake= id->flag & LIB_FAKEUSER;
-
- if(id->lib && fake) sprintf(files->extra, "LF %d", id->us);
- else if(id->lib) sprintf(files->extra, "L %d", id->us);
- else if(fake) sprintf(files->extra, "F %d", id->us);
- else sprintf(files->extra, " %d", id->us);
-
- if(id->lib) {
- if(totlib==0) firstlib= files;
- totlib++;
- }
-
- files++;
- }
- totbl++;
- }
-
- id= id->next;
- }
-
- /* only qsort of libraryblokken */
- if(totlib>1) {
- qsort(firstlib, totlib, sizeof(struct direntry), compare_name);
- }
- }
-
- sfile->maxnamelen= 0;
- for(a=0; a<sfile->totfile; a++) {
- len = BMF_GetStringWidth(G.font, sfile->filelist[a].relname);
- if (len > sfile->maxnamelen) sfile->maxnamelen = len;
-
- if(filetoname) {
- if( strcmp(sfile->file, sfile->filelist[a].relname)==0) {
- sfile->ofs= a-( sfile->collums*(curarea->winy-FILESELHEAD-10)/(2*FILESEL_DY));
- filetoname= 0;
- if(filesel_has_func(sfile)) sfile->filelist[a].flags |= ACTIVE;
- }
- }
- }
-}
-
-
-void clever_numbuts_filesel()
-{
- SpaceFile *sfile;
- char orgname[FILE_MAX+12];
- char filename[FILE_MAX+12];
- char newname[FILE_MAX+12];
- int test;
- int len;
-
- sfile= curarea->spacedata.first;
-
- if(sfile->type==FILE_MAIN) return;
-
- len = 110;
- test = get_hilited_entry(sfile);
-
- if (test != -1 && !(S_ISDIR(sfile->filelist[test].type))){
- BLI_make_file_string(G.sce, orgname, sfile->dir, sfile->filelist[test].relname);
- BLI_strncpy(filename, sfile->filelist[test].relname, sizeof(filename));
-
- add_numbut(0, TEX, "", 0, len, filename, "Rename File");
-
- if( do_clever_numbuts("Rename File", 1, REDRAW) ) {
- BLI_make_file_string(G.sce, newname, sfile->dir, filename);
-
- if( strcmp(orgname, newname) != 0 ) {
- BLI_rename(orgname, newname);
- freefilelist(sfile);
- }
- }
-
- scrarea_queue_winredraw(curarea);
- }
-}
-
diff --git a/source/blender/src/fluidsim.c b/source/blender/src/fluidsim.c
deleted file mode 100644
index e9609d40570..00000000000
--- a/source/blender/src/fluidsim.c
+++ /dev/null
@@ -1,1147 +0,0 @@
-/**
- * fluidsim.c
- *
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) Blender Foundation
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-
-
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-
-
-#include "MEM_guardedalloc.h"
-
-/* types */
-#include "DNA_curve_types.h"
-#include "DNA_object_types.h"
-#include "DNA_object_fluidsim.h"
-#include "DNA_key_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_lattice_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_ipo_types.h"
-#include "DNA_key_types.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "MTC_matrixops.h"
-
-#include "BKE_customdata.h"
-#include "BKE_displist.h"
-#include "BKE_effect.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_key.h"
-#include "BKE_scene.h"
-#include "BKE_object.h"
-#include "BKE_softbody.h"
-#include "BKE_utildefines.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_ipo.h"
-#include "LBM_fluidsim.h"
-// warning - double elbeem.h in intern/extern...
-#include "elbeem.h"
-
-#include "BLI_editVert.h"
-#include "BIF_editdeform.h"
-#include "BIF_gl.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_cursors.h"
-#include "BIF_interface.h"
-#include "BSE_headerbuttons.h"
-
-#include "mydevice.h"
-#include "blendef.h"
-#include "SDL.h"
-#include "SDL_thread.h"
-#include "SDL_mutex.h"
-#include <sys/stat.h>
-
-#ifdef WIN32 /* Windos */
-//#include "BLI_winstuff.h"
-#ifndef snprintf
-#define snprintf _snprintf
-#endif
-#endif
-// SDL redefines main for SDL_main, not needed here...
-#undef main
-
-#ifdef __APPLE__ /* MacOS X */
-#undef main
-#endif
-
-// from DerivedMesh.c
-void initElbeemMesh(struct Object *ob, int *numVertices, float **vertices, int *numTriangles, int **triangles, int useGlobalCoords);
-
-/* from header info.c */
-extern int start_progress_bar(void);
-extern void end_progress_bar(void);
-extern int progress_bar(float done, char *busy_info);
-
-double fluidsimViscosityPreset[6] = {
- -1.0, /* unused */
- -1.0, /* manual */
- 1.0e-6, /* water */
- 5.0e-5, /* some (thick) oil */
- 2.0e-3, /* ca. honey */
- -1.0 /* end */
-};
-
-char* fluidsimViscosityPresetString[6] = {
- "UNUSED", /* unused */
- "UNUSED", /* manual */
- " = 1.0 * 10^-6", /* water */
- " = 5.0 * 10^-5", /* some (thick) oil */
- " = 2.0 * 10^-3", /* ca. honey */
- "INVALID" /* end */
-};
-
-typedef struct {
- DerivedMesh dm;
-
- // similar to MeshDerivedMesh
- struct Object *ob; // pointer to parent object
- float *extverts, *nors; // face normals, colors?
- Mesh *fsmesh; // mesh struct to display (either surface, or original one)
- char meshFree; // free the mesh afterwards? (boolean)
-} fluidsimDerivedMesh;
-
-
-
-/* enable/disable overall compilation */
-#ifndef DISABLE_ELBEEM
-
-
-/* ********************** fluid sim settings struct functions ********************** */
-
-/* allocates and initializes general main data */
-FluidsimSettings *fluidsimSettingsNew(struct Object *srcob)
-{
- //char blendDir[FILE_MAXDIR], blendFile[FILE_MAXFILE];
- FluidsimSettings *fss;
-
- /* this call uses derivedMesh methods... */
- if(srcob->type!=OB_MESH) return NULL;
-
- fss= MEM_callocN( sizeof(FluidsimSettings), "fluidsimsettings memory");
-
- fss->type = 0;
- fss->show_advancedoptions = 0;
-
- fss->resolutionxyz = 50;
- fss->previewresxyz = 25;
- fss->realsize = 0.03;
- fss->guiDisplayMode = 2; // preview
- fss->renderDisplayMode = 3; // render
-
- fss->viscosityMode = 2; // default to water
- fss->viscosityValue = 1.0;
- fss->viscosityExponent = 6;
- fss->gravx = 0.0;
- fss->gravy = 0.0;
- fss->gravz = -9.81;
- fss->animStart = 0.0;
- fss->animEnd = 0.30;
- fss->gstar = 0.005; // used as normgstar
- fss->maxRefine = -1;
- // maxRefine is set according to resolutionxyz during bake
-
- // fluid/inflow settings
- fss->iniVelx =
- fss->iniVely =
- fss->iniVelz = 0.0;
-
- /* elubie: changed this to default to the same dir as the render output
- to prevent saving to C:\ on Windows */
- BLI_strncpy(fss->surfdataPath, U.tempdir, FILE_MAX);
- fss->orgMesh = (Mesh *)srcob->data;
- fss->meshSurface = NULL;
- fss->meshBB = NULL;
- fss->meshSurfNormals = NULL;
-
- // first init of bounding box
- fss->bbStart[0] = 0.0;
- fss->bbStart[1] = 0.0;
- fss->bbStart[2] = 0.0;
- fss->bbSize[0] = 1.0;
- fss->bbSize[1] = 1.0;
- fss->bbSize[2] = 1.0;
- fluidsimGetAxisAlignedBB(srcob->data, srcob->obmat, fss->bbStart, fss->bbSize, &fss->meshBB);
-
- // todo - reuse default init from elbeem!
- fss->typeFlags = 0;
- fss->domainNovecgen = 0;
- fss->volumeInitType = 1; // volume
- fss->partSlipValue = 0.0;
-
- fss->generateTracers = 0;
- fss->generateParticles = 0.0;
- fss->surfaceSmoothing = 1.0;
- fss->surfaceSubdivs = 1.0;
- fss->particleInfSize = 0.0;
- fss->particleInfAlpha = 0.0;
-
- return fss;
-}
-
-/* duplicate struct, analogous to free */
-static Mesh *fluidsimCopyMesh(Mesh *me)
-{
- Mesh *dup = MEM_dupallocN(me);
-
- CustomData_copy(&me->vdata, &dup->vdata, CD_MASK_MESH, CD_DUPLICATE, me->totvert);
- CustomData_copy(&me->edata, &dup->edata, CD_MASK_MESH, CD_DUPLICATE, me->totedge);
- CustomData_copy(&me->fdata, &dup->fdata, CD_MASK_MESH, CD_DUPLICATE, me->totface);
-
- return dup;
-}
-
-FluidsimSettings* fluidsimSettingsCopy(FluidsimSettings *fss)
-{
- FluidsimSettings *dupfss;
-
- if(!fss) return NULL;
- dupfss = MEM_dupallocN(fss);
-
- if(fss->meshSurface)
- dupfss->meshSurface = fluidsimCopyMesh(fss->meshSurface);
- if(fss->meshBB)
- dupfss->meshBB = fluidsimCopyMesh(fss->meshBB);
-
- if(fss->meshSurfNormals) dupfss->meshSurfNormals = MEM_dupallocN(fss->meshSurfNormals);
-
- return dupfss;
-}
-
-/* free struct */
-static void fluidsimFreeMesh(Mesh *me)
-{
- CustomData_free(&me->vdata, me->totvert);
- CustomData_free(&me->edata, me->totedge);
- CustomData_free(&me->fdata, me->totface);
-
- MEM_freeN(me);
-}
-
-void fluidsimSettingsFree(FluidsimSettings *fss)
-{
- if(fss->meshSurface) {
- fluidsimFreeMesh(fss->meshSurface);
- fss->meshSurface = NULL;
- }
- if(fss->meshBB) {
- fluidsimFreeMesh(fss->meshBB);
- fss->meshBB = NULL;
- }
-
- if(fss->meshSurfNormals){ MEM_freeN(fss->meshSurfNormals); fss->meshSurfNormals=NULL; }
-
- MEM_freeN(fss);
-}
-
-
-/* helper function */
-void fluidsimGetGeometryObjFilename(struct Object *ob, char *dst) { //, char *srcname) {
- //snprintf(dst,FILE_MAXFILE, "%s_cfgdata_%s.bobj.gz", srcname, ob->id.name);
- snprintf(dst,FILE_MAXFILE, "fluidcfgdata_%s.bobj.gz", ob->id.name);
-}
-
-
-
-
-/* ******************************************************************************** */
-/* ********************** fluid sim channel helper functions ********************** */
-/* ******************************************************************************** */
-
-// no. of entries for the two channel sizes
-#define CHANNEL_FLOAT 1
-#define CHANNEL_VEC 3
-
-#define FS_FREE_ONECHANNEL(c,str) { \
- if(c){ MEM_freeN(c); c=NULL; } \
-} // end ONE CHANN, debug: fprintf(stderr,"freeing " str " \n");
-
-#define FS_FREE_CHANNELS { \
- FS_FREE_ONECHANNEL(timeAtIndex,"timeAtIndex");\
- FS_FREE_ONECHANNEL(timeAtFrame,"timeAtFrame");\
- FS_FREE_ONECHANNEL(channelDomainTime,"channelDomainTime"); \
- FS_FREE_ONECHANNEL(channelDomainGravity,"channelDomainGravity");\
- FS_FREE_ONECHANNEL(channelDomainViscosity,"channelDomainViscosity");\
- for(i=0;i<256;i++) { \
- FS_FREE_ONECHANNEL(channelObjMove[i][0],"channelObjMove0"); \
- FS_FREE_ONECHANNEL(channelObjMove[i][1],"channelObjMove1"); \
- FS_FREE_ONECHANNEL(channelObjMove[i][2],"channelObjMove2"); \
- FS_FREE_ONECHANNEL(channelObjInivel[i],"channelObjInivel"); \
- FS_FREE_ONECHANNEL(channelObjActive[i],"channelObjActive"); \
- } \
-} // end FS FREE CHANNELS
-
-
-// simplify channels before printing
-// for API this is done anyway upon init
-#if 0
-static void fluidsimPrintChannel(FILE *file, float *channel, int paramsize, char *str, int entries)
-{
- int i,j;
- int channelSize = paramsize;
-
- if(entries==3) {
- elbeemSimplifyChannelVec3( channel, &channelSize);
- } else if(entries==1) {
- elbeemSimplifyChannelFloat( channel, &channelSize);
- } else {
- // invalid, cant happen?
- }
-
- fprintf(file, " CHANNEL %s = \n", str);
- for(i=0; i<channelSize;i++) {
- fprintf(file," ");
- for(j=0;j<=entries;j++) { // also print time value
- fprintf(file," %f ", channel[i*(entries+1)+j] );
- if(j==entries-1){ fprintf(file," "); }
- }
- fprintf(file," \n");
- }
-
- fprintf(file, " ; \n" );
-}
-#endif
-
-static void fluidsimInitChannel(float **setchannel, int size, float *time,
- int *icuIds, float *defaults, Ipo* ipo, int entries) {
- int i,j;
- IpoCurve* icus[3];
- char *cstr = NULL;
- float *channel = NULL;
- float aniFrlen = G.scene->r.framelen;
- if((entries<1) || (entries>3)) {
- printf("fluidsimInitChannel::Error - invalid no. of entries: %d\n",entries);
- entries = 1;
- }
-
- cstr = "fluidsiminit_channelfloat";
- if(entries>1) cstr = "fluidsiminit_channelvec";
- channel = MEM_callocN( size* (entries+1)* sizeof(float), cstr );
-
- if(ipo) {
- for(j=0; j<entries; j++) icus[j] = find_ipocurve(ipo, icuIds[j] );
- } else {
- for(j=0; j<entries; j++) icus[j] = NULL;
- }
-
- for(j=0; j<entries; j++) {
- if(icus[j]) {
- for(i=1; i<=size; i++) {
- calc_icu(icus[j], aniFrlen*((float)i) );
- channel[(i-1)*(entries+1) + j] = icus[j]->curval;
- }
- } else {
- for(i=1; i<=size; i++) { channel[(i-1)*(entries+1) + j] = defaults[j]; }
- }
- //printf("fluidsimInitChannel entry:%d , ",j); for(i=1; i<=size; i++) { printf(" val%d:%f ",i, channel[(i-1)*(entries+1) + j] ); } printf(" \n"); // DEBUG
- }
- // set time values
- for(i=1; i<=size; i++) {
- channel[(i-1)*(entries+1) + entries] = time[i];
- }
-
- *setchannel = channel;
-}
-
-static void fluidsimInitMeshChannel(float **setchannel, int size, Object *obm, int vertices, float *time) {
- float *channel = NULL;
- int mallsize = size* (3*vertices+1);
- int frame,i;
- int numVerts=0, numTris=0;
- int setsize = 3*vertices+1;
-
- channel = MEM_callocN( mallsize* sizeof(float), "fluidsim_meshchannel" );
-
- //fprintf(stderr,"\n\nfluidsimInitMeshChannel size%d verts%d mallsize%d \n\n\n",size,vertices,mallsize);
- for(frame=1; frame<=size; frame++) {
- float *verts=NULL;
- int *tris=NULL;
- G.scene->r.cfra = frame;
- scene_update_for_newframe(G.scene, G.scene->lay);
-
- initElbeemMesh(obm, &numVerts, &verts, &numTris, &tris, 1);
- //fprintf(stderr,"\nfluidsimInitMeshChannel frame%d verts%d/%d \n\n",frame,vertices,numVerts);
- for(i=0; i<3*vertices;i++) {
- channel[(frame-1)*setsize + i] = verts[i];
- //fprintf(stdout," frame%d vert%d=%f \n",frame,i,verts[i]);
- //if(i%3==2) fprintf(stdout,"\n");
- }
- channel[(frame-1)*setsize + setsize-1] = time[frame];
-
- MEM_freeN(verts);
- MEM_freeN(tris);
- }
- *setchannel = channel;
-}
-
-
-/* ******************************************************************************** */
-/* ********************** simulation thread ************************* */
-/* ******************************************************************************** */
-
-SDL_mutex *globalBakeLock=NULL;
-int globalBakeState = 0; // 0 everything ok, -1 abort simulation, -2 sim error, 1 sim done
-int globalBakeFrame = 0;
-
-// run simulation in seperate thread
-static int fluidsimSimulateThread(void *unused) { // *ptr) {
- //char* fnameCfgPath = (char*)(ptr);
- int ret=0;
-
- ret = elbeemSimulate();
- SDL_mutexP(globalBakeLock);
- if(globalBakeState==0) {
- if(ret==0) {
- // if no error, set to normal exit
- globalBakeState = 1;
- } else {
- // simulation failed, display error
- globalBakeState = -2;
- }
- }
- SDL_mutexV(globalBakeLock);
- return ret;
-}
-
-
-int runSimulationCallback(void *data, int status, int frame) {
- //elbeemSimulationSettings *settings = (elbeemSimulationSettings*)data;
- //printf("elbeem blender cb s%d, f%d, domainid:%d \n", status,frame, settings->domainId ); // DEBUG
-
- if(!globalBakeLock) return FLUIDSIM_CBRET_ABORT;
- if(status==FLUIDSIM_CBSTATUS_NEWFRAME) {
- SDL_mutexP(globalBakeLock);
- globalBakeFrame = frame-1;
- SDL_mutexV(globalBakeLock);
- }
-
- //if((frameCounter==3) && (!frameStop)) { frameStop=1; return 1; }
-
- SDL_mutexP(globalBakeLock);
- if(globalBakeState!=0) {
- return FLUIDSIM_CBRET_ABORT;
- }
- SDL_mutexV(globalBakeLock);
- return FLUIDSIM_CBRET_CONTINUE;
-}
-
-
-/* ******************************************************************************** */
-/* ********************** write fluidsim config to file ************************* */
-/* ******************************************************************************** */
-
-void fluidsimBake(struct Object *ob)
-{
- FILE *fileCfg;
- int i;
- struct Object *fsDomain = NULL;
- FluidsimSettings *domainSettings;
- struct Object *obit = NULL; /* object iterator */
- int origFrame = G.scene->r.cfra;
- char debugStrBuffer[256];
- int dirExist = 0;
- int gridlevels = 0;
- int simAborted = 0; // was the simulation aborted by user?
- int doExportOnly = 0;
- char *exportEnvStr = "BLENDER_ELBEEMEXPORTONLY";
- const char *strEnvName = "BLENDER_ELBEEMDEBUG"; // from blendercall.cpp
- //char *channelNames[3] = { "translation","rotation","scale" };
-
- char *suffixConfig = "fluidsim.cfg";
- char *suffixSurface = "fluidsurface";
- char newSurfdataPath[FILE_MAXDIR+FILE_MAXFILE]; // modified output settings
- char targetDir[FILE_MAXDIR+FILE_MAXFILE]; // store & modify output settings
- char targetFile[FILE_MAXDIR+FILE_MAXFILE]; // temp. store filename from targetDir for access
- int outStringsChanged = 0; // modified? copy back before baking
- int haveSomeFluid = 0; // check if any fluid objects are set
-
- // config vars, inited before either export or run...
- double calcViscosity = 0.0;
- int noFrames;
- double aniFrameTime;
- float aniFrlen;
- int channelObjCount;
- float *bbStart = NULL;
- float *bbSize = NULL;
- float domainMat[4][4];
- float invDomMat[4][4];
- // channel data
- int allchannelSize; // fixed by no. of frames
- int startFrame = 1; // dont use G.scene->r.sfra here, always start with frame 1
- // easy frame -> sim time calc
- float *timeAtFrame=NULL, *timeAtIndex=NULL;
- // domain
- float *channelDomainTime = NULL;
- float *channelDomainViscosity = NULL;
- float *channelDomainGravity = NULL;
- // objects (currently max. 256 objs)
- float *channelObjMove[256][3]; // object movments , 0=trans, 1=rot, 2=scale
- float *channelObjInivel[256]; // initial velocities
- float *channelObjActive[256]; // obj active channel
-
- if(getenv(strEnvName)) {
- int dlevel = atoi(getenv(strEnvName));
- elbeemSetDebugLevel(dlevel);
- snprintf(debugStrBuffer,256,"fluidsimBake::msg: Debug messages activated due to envvar '%s'\n",strEnvName);
- elbeemDebugOut(debugStrBuffer);
- }
- if(getenv(exportEnvStr)) {
- doExportOnly = atoi(getenv(exportEnvStr));
- snprintf(debugStrBuffer,256,"fluidsimBake::msg: Exporting mode set to '%d' due to envvar '%s'\n",doExportOnly, exportEnvStr);
- elbeemDebugOut(debugStrBuffer);
- }
-
- // make sure it corresponds to startFrame setting
- // old: noFrames = G.scene->r.efra - G.scene->r.sfra +1;
- noFrames = G.scene->r.efra - 0;
- if(noFrames<=0) {
- pupmenu("Fluidsim Bake Error%t|No frames to export - check your animation range settings. Aborted%x0");
- return;
- }
-
- /* no object pointer, find in selected ones.. */
- if(!ob) {
- Base *base;
- for(base=G.scene->base.first; base; base= base->next) {
- if ( ((base)->flag & SELECT)
- // ignore layer setting for now? && ((base)->lay & G.vd->lay)
- ) {
- if((!ob)&&(base->object->fluidsimFlag & OB_FLUIDSIM_ENABLE)&&(base->object->type==OB_MESH)) {
- if(base->object->fluidsimSettings->type == OB_FLUIDSIM_DOMAIN) {
- ob = base->object;
- }
- }
- }
- }
- // no domains found?
- if(!ob) return;
- }
-
- /* check if there's another domain... */
- for(obit= G.main->object.first; obit; obit= obit->id.next) {
- if((obit->fluidsimFlag & OB_FLUIDSIM_ENABLE)&&(obit->type==OB_MESH)) {
- if(obit->fluidsimSettings->type == OB_FLUIDSIM_DOMAIN) {
- if(obit != ob) {
- //snprintf(debugStrBuffer,256,"fluidsimBake::warning - More than one domain!\n"); elbeemDebugOut(debugStrBuffer);
- pupmenu("Fluidsim Bake Error%t|There should be only one domain object! Aborted%x0");
- return;
- }
- }
- }
- }
- /* these both have to be valid, otherwise we wouldnt be here */
- /* dont use ob here after...*/
- fsDomain = ob;
- domainSettings = ob->fluidsimSettings;
- ob = NULL;
- /* rough check of settings... */
- if(domainSettings->previewresxyz > domainSettings->resolutionxyz) {
- snprintf(debugStrBuffer,256,"fluidsimBake::warning - Preview (%d) >= Resolution (%d)... setting equal.\n", domainSettings->previewresxyz , domainSettings->resolutionxyz);
- elbeemDebugOut(debugStrBuffer);
- domainSettings->previewresxyz = domainSettings->resolutionxyz;
- }
- // set adaptive coarsening according to resolutionxyz
- // this should do as an approximation, with in/outflow
- // doing this more accurate would be overkill
- // perhaps add manual setting?
- if(domainSettings->maxRefine <0) {
- if(domainSettings->resolutionxyz>128) {
- gridlevels = 2;
- } else
- if(domainSettings->resolutionxyz>64) {
- gridlevels = 1;
- } else {
- gridlevels = 0;
- }
- } else {
- gridlevels = domainSettings->maxRefine;
- }
- snprintf(debugStrBuffer,256,"fluidsimBake::msg: Baking %s, refine: %d\n", fsDomain->id.name , gridlevels );
- elbeemDebugOut(debugStrBuffer);
-
- // check if theres any fluid
- // abort baking if not...
- for(obit= G.main->object.first; obit; obit= obit->id.next) {
- if( (obit->fluidsimFlag & OB_FLUIDSIM_ENABLE) &&
- (obit->type==OB_MESH) && (
- (obit->fluidsimSettings->type == OB_FLUIDSIM_FLUID) ||
- (obit->fluidsimSettings->type == OB_FLUIDSIM_INFLOW) )
- ) {
- haveSomeFluid = 1;
- }
- }
- if(!haveSomeFluid) {
- pupmenu("Fluidsim Bake Error%t|No fluid objects in scene... Aborted%x0");
- return;
- }
-
- // prepare names...
- strncpy(targetDir, domainSettings->surfdataPath, FILE_MAXDIR);
- strncpy(newSurfdataPath, domainSettings->surfdataPath, FILE_MAXDIR);
- BLI_convertstringcode(targetDir, G.sce, 0); // fixed #frame-no
-
- strcpy(targetFile, targetDir);
- strcat(targetFile, suffixConfig);
- if(!doExportOnly) { strcat(targetFile,".tmp"); } // dont overwrite/delete original file
- // make sure all directories exist
- // as the bobjs use the same dir, this only needs to be checked
- // for the cfg output
- BLI_make_existing_file(targetFile);
-
- // check selected directory
- // simply try to open cfg file for writing to test validity of settings
- fileCfg = fopen(targetFile, "w");
- if(fileCfg) {
- dirExist = 1; fclose(fileCfg);
- // remove cfg dummy from directory test
- if(!doExportOnly) { BLI_delete(targetFile, 0,0); }
- }
-
- if((strlen(targetDir)<1) || (!dirExist)) {
- char blendDir[FILE_MAXDIR+FILE_MAXFILE], blendFile[FILE_MAXDIR+FILE_MAXFILE];
- // invalid dir, reset to current/previous
- strcpy(blendDir, G.sce);
- BLI_splitdirstring(blendDir, blendFile);
- if(strlen(blendFile)>6){
- int len = strlen(blendFile);
- if( (blendFile[len-6]=='.')&& (blendFile[len-5]=='b')&& (blendFile[len-4]=='l')&&
- (blendFile[len-3]=='e')&& (blendFile[len-2]=='n')&& (blendFile[len-1]=='d') ){
- blendFile[len-6] = '\0';
- }
- }
- // todo... strip .blend ?
- snprintf(newSurfdataPath,FILE_MAXFILE+FILE_MAXDIR,"//fluidsimdata/%s_%s_", blendFile, fsDomain->id.name);
-
- snprintf(debugStrBuffer,256,"fluidsimBake::error - warning resetting output dir to '%s'\n", newSurfdataPath);
- elbeemDebugOut(debugStrBuffer);
- outStringsChanged=1;
- }
-
- // check if modified output dir is ok
- if(outStringsChanged) {
- char dispmsg[FILE_MAXDIR+FILE_MAXFILE+256];
- int selection=0;
- strcpy(dispmsg,"Output settings set to: '");
- strcat(dispmsg, newSurfdataPath);
- strcat(dispmsg, "'%t|Continue with changed settings%x1|Discard and abort%x0");
-
- // ask user if thats what he/she wants...
- selection = pupmenu(dispmsg);
- if(selection<1) return; // 0 from menu, or -1 aborted
- strcpy(targetDir, newSurfdataPath);
- strncpy(domainSettings->surfdataPath, newSurfdataPath, FILE_MAXDIR);
- BLI_convertstringcode(targetDir, G.sce, 0); // fixed #frame-no
- }
-
- // --------------------------------------------------------------------------------------------
- // dump data for start frame
- // CHECK more reasonable to number frames according to blender?
- // dump data for frame 0
- G.scene->r.cfra = startFrame;
- scene_update_for_newframe(G.scene, G.scene->lay);
-
- // init common export vars for both file export and run
- for(i=0; i<256; i++) {
- channelObjMove[i][0] = channelObjMove[i][1] = channelObjMove[i][2] = NULL;
- channelObjInivel[i] = NULL;
- channelObjActive[i] = NULL;
- }
- allchannelSize = G.scene->r.efra; // always use till last frame
- aniFrameTime = (domainSettings->animEnd - domainSettings->animStart)/(double)noFrames;
- // blender specific - scale according to map old/new settings in anim panel:
- aniFrlen = G.scene->r.framelen;
- if(domainSettings->viscosityMode==1) {
- /* manual mode, visc=value/(10^-vexp) */
- calcViscosity = (1.0/pow(10.0,domainSettings->viscosityExponent)) * domainSettings->viscosityValue;
- } else {
- calcViscosity = fluidsimViscosityPreset[ domainSettings->viscosityMode ];
- }
-
- bbStart = fsDomain->fluidsimSettings->bbStart;
- bbSize = fsDomain->fluidsimSettings->bbSize;
- fluidsimGetAxisAlignedBB(fsDomain->data, fsDomain->obmat, bbStart, bbSize, &domainSettings->meshBB);
-
- // always init
- { int timeIcu[1] = { FLUIDSIM_TIME };
- float timeDef[1] = { 1. };
- int gravIcu[3] = { FLUIDSIM_GRAV_X, FLUIDSIM_GRAV_Y, FLUIDSIM_GRAV_Z };
- float gravDef[3];
- int viscIcu[1] = { FLUIDSIM_VISC };
- float viscDef[1] = { 1. };
-
- gravDef[0] = domainSettings->gravx;
- gravDef[1] = domainSettings->gravy;
- gravDef[2] = domainSettings->gravz;
-
- // time channel is a bit special, init by hand...
- timeAtIndex = MEM_callocN( (allchannelSize+1)*1*sizeof(float), "fluidsiminit_timeatindex");
- for(i=0; i<=G.scene->r.efra; i++) {
- timeAtIndex[i] = (float)(i-startFrame);
- }
- fluidsimInitChannel( &channelDomainTime, allchannelSize, timeAtIndex, timeIcu,timeDef, domainSettings->ipo, CHANNEL_FLOAT ); // NDEB
- // time channel is a multiplicator for aniFrameTime
- if(channelDomainTime) {
- for(i=0; i<allchannelSize; i++) {
- channelDomainTime[i*2+0] = aniFrameTime * channelDomainTime[i*2+0];
- if(channelDomainTime[i*2+0]<0.) channelDomainTime[i*2+0] = 0.;
- }
- }
- timeAtFrame = MEM_callocN( (allchannelSize+1)*1*sizeof(float), "fluidsiminit_timeatframe");
- timeAtFrame[0] = timeAtFrame[1] = domainSettings->animStart; // start at index 1
- if(channelDomainTime) {
- for(i=2; i<=allchannelSize; i++) {
- timeAtFrame[i] = timeAtFrame[i-1]+channelDomainTime[(i-1)*2+0];
- }
- } else {
- for(i=2; i<=allchannelSize; i++) { timeAtFrame[i] = timeAtFrame[i-1]+aniFrameTime; }
- }
-
- fluidsimInitChannel( &channelDomainViscosity, allchannelSize, timeAtFrame, viscIcu,viscDef, domainSettings->ipo, CHANNEL_FLOAT ); // NDEB
- if(channelDomainViscosity) {
- for(i=0; i<allchannelSize; i++) { channelDomainViscosity[i*2+0] = calcViscosity * channelDomainViscosity[i*2+0]; }
- }
- fluidsimInitChannel( &channelDomainGravity, allchannelSize, timeAtFrame, gravIcu,gravDef, domainSettings->ipo, CHANNEL_VEC );
- } // domain channel init
-
- // init obj movement channels
- channelObjCount=0;
- for(obit= G.main->object.first; obit; obit= obit->id.next) {
- //{ snprintf(debugStrBuffer,256,"DEBUG object name=%s, type=%d ...\n", obit->id.name, obit->type); elbeemDebugOut(debugStrBuffer); } // DEBUG
- if( (obit->fluidsimFlag & OB_FLUIDSIM_ENABLE) &&
- (obit->type==OB_MESH) &&
- (obit->fluidsimSettings->type != OB_FLUIDSIM_DOMAIN) && // if has to match 3 places! // CHECKMATCH
- (obit->fluidsimSettings->type != OB_FLUIDSIM_PARTICLE) ) {
-
- // cant use fluidsimInitChannel for obj channels right now, due
- // to the special DXXX channels, and the rotation specialities
- IpoCurve *icuex[3][3];
- //IpoCurve *par_icuex[3][3];
- int icuIds[3][3] = {
- {OB_LOC_X, OB_LOC_Y, OB_LOC_Z},
- {OB_ROT_X, OB_ROT_Y, OB_ROT_Z},
- {OB_SIZE_X, OB_SIZE_Y, OB_SIZE_Z}
- };
- // relative ipos
- IpoCurve *icudex[3][3];
- //IpoCurve *par_icudex[3][3];
- int icudIds[3][3] = {
- {OB_DLOC_X, OB_DLOC_Y, OB_DLOC_Z},
- {OB_DROT_X, OB_DROT_Y, OB_DROT_Z},
- {OB_DSIZE_X, OB_DSIZE_Y, OB_DSIZE_Z}
- };
- int j,k;
- float vals[3] = {0.0,0.0,0.0};
- int o = channelObjCount;
- int inivelIcu[3] = { FLUIDSIM_VEL_X, FLUIDSIM_VEL_Y, FLUIDSIM_VEL_Z };
- float inivelDefs[3];
- int activeIcu[1] = { FLUIDSIM_ACTIVE };
- float activeDefs[1] = { 1 }; // default to on
-
- inivelDefs[0] = obit->fluidsimSettings->iniVelx;
- inivelDefs[1] = obit->fluidsimSettings->iniVely;
- inivelDefs[2] = obit->fluidsimSettings->iniVelz;
-
- // check & init loc,rot,size
- for(j=0; j<3; j++) {
- for(k=0; k<3; k++) {
- icuex[j][k] = find_ipocurve(obit->ipo, icuIds[j][k] );
- icudex[j][k] = find_ipocurve(obit->ipo, icudIds[j][k] );
- //if(obit->parent) {
- //par_icuex[j][k] = find_ipocurve(obit->parent->ipo, icuIds[j][k] );
- //par_icudex[j][k] = find_ipocurve(obit->parent->ipo, icudIds[j][k] );
- //}
- }
- }
-
- for(j=0; j<3; j++) {
- channelObjMove[o][j] = MEM_callocN( allchannelSize*4*sizeof(float), "fluidsiminit_objmovchannel");
- for(i=1; i<=allchannelSize; i++) {
-
- for(k=0; k<3; k++) {
- if(icuex[j][k]) {
- // IPO exists, use it ...
- calc_icu(icuex[j][k], aniFrlen*((float)i) );
- vals[k] = icuex[j][k]->curval;
- if(obit->parent) {
- // add parent transform, multiply scaling, add trafo&rot
- //calc_icu(par_icuex[j][k], aniFrlen*((float)i) );
- //if(j==2) { vals[k] *= par_icuex[j][k]->curval; }
- //else { vals[k] += par_icuex[j][k]->curval; }
- }
- } else {
- // use defaults from static values
- float setval=0.0;
- if(j==0) {
- setval = obit->loc[k];
- if(obit->parent){ setval += obit->parent->loc[k]; }
- } else if(j==1) {
- setval = ( 180.0*obit->rot[k] )/( 10.0*M_PI );
- if(obit->parent){ setval = ( 180.0*(obit->rot[k]+obit->parent->rot[k]) )/( 10.0*M_PI ); }
- } else {
- setval = obit->size[k];
- if(obit->parent){ setval *= obit->parent->size[k]; }
- }
- vals[k] = setval;
- }
- if(icudex[j][k]) {
- calc_icu(icudex[j][k], aniFrlen*((float)i) );
- //vals[k] += icudex[j][k]->curval;
- // add transform, multiply scaling, add trafo&rot
- if(j==2) { vals[k] *= icudex[j][k]->curval; }
- else { vals[k] += icudex[j][k]->curval; }
- if(obit->parent) {
- // add parent transform, multiply scaling, add trafo&rot
- //calc_icu(par_icuex[j][k], aniFrlen*((float)i) );
- //if(j==2) { vals[k] *= par_icudex[j][k]->curval; }
- //else { vals[k] += par_icudex[j][k]->curval; }
- }
- }
- } // k
-
- for(k=0; k<3; k++) {
- float set = vals[k];
- if(j==1) { // rot is downscaled by 10 for ipo !?
- set = 360.0 - (10.0*set);
- }
- channelObjMove[o][j][(i-1)*4 + k] = set;
- } // k
- channelObjMove[o][j][(i-1)*4 + 3] = timeAtFrame[i];
- }
- }
-
- fluidsimInitChannel( &channelObjInivel[o], allchannelSize, timeAtFrame, inivelIcu,inivelDefs, obit->fluidsimSettings->ipo, CHANNEL_VEC );
- fluidsimInitChannel( &channelObjActive[o], allchannelSize, timeAtFrame, activeIcu,activeDefs, obit->fluidsimSettings->ipo, CHANNEL_FLOAT );
-
- channelObjCount++;
-
- }
- }
-
- // init trafo matrix
- MTC_Mat4CpyMat4(domainMat, fsDomain->obmat);
- if(!Mat4Invert(invDomMat, domainMat)) {
- snprintf(debugStrBuffer,256,"fluidsimBake::error - Invalid obj matrix?\n");
- elbeemDebugOut(debugStrBuffer);
- // FIXME add fatal msg
- FS_FREE_CHANNELS;
- return;
- }
-
-
- // --------------------------------------------------------------------------------------------
- // start writing / exporting
- strcpy(targetFile, targetDir);
- strcat(targetFile, suffixConfig);
- if(!doExportOnly) { strcat(targetFile,".tmp"); } // dont overwrite/delete original file
- // make sure these directories exist as well
- if(outStringsChanged) {
- BLI_make_existing_file(targetFile);
- }
-
- if(!doExportOnly) {
- SDL_Thread *simthr = NULL;
-
- // perform simulation with El'Beem api and SDL threads
- elbeemSimulationSettings fsset;
- elbeemResetSettings(&fsset);
- fsset.version = 1;
-
- // setup global settings
- for(i=0 ; i<3; i++) fsset.geoStart[i] = bbStart[i];
- for(i=0 ; i<3; i++) fsset.geoSize[i] = bbSize[i];
- // simulate with 50^3
- fsset.resolutionxyz = (int)domainSettings->resolutionxyz;
- fsset.previewresxyz = (int)domainSettings->previewresxyz;
- // 10cm water domain
- fsset.realsize = domainSettings->realsize;
- fsset.viscosity = calcViscosity;
- // earth gravity
- fsset.gravity[0] = domainSettings->gravx;
- fsset.gravity[1] = domainSettings->gravy;
- fsset.gravity[2] = domainSettings->gravz;
- // simulate 5 frames, each 0.03 seconds, output to ./apitest_XXX.bobj.gz
- fsset.animStart = domainSettings->animStart;
- fsset.aniFrameTime = aniFrameTime;
- fsset.noOfFrames = noFrames - 1; // is otherwise subtracted in parser
- strcpy(targetFile, targetDir);
- strcat(targetFile, suffixSurface);
- // defaults for compressibility and adaptive grids
- fsset.gstar = domainSettings->gstar;
- fsset.maxRefine = domainSettings->maxRefine; // check <-> gridlevels
- fsset.generateParticles = domainSettings->generateParticles;
- fsset.numTracerParticles = domainSettings->generateTracers;
- fsset.surfaceSmoothing = domainSettings->surfaceSmoothing;
- fsset.surfaceSubdivs = domainSettings->surfaceSubdivs;
- fsset.farFieldSize = domainSettings->farFieldSize;
- strcpy( fsset.outputPath, targetFile);
-
- // domain channels
- fsset.channelSizeFrameTime =
- fsset.channelSizeViscosity =
- fsset.channelSizeGravity = allchannelSize;
- fsset.channelFrameTime = channelDomainTime;
- fsset.channelViscosity = channelDomainViscosity;
- fsset.channelGravity = channelDomainGravity;
-
- fsset.runsimCallback = &runSimulationCallback;
- fsset.runsimUserData = &fsset;
-
- if( (domainSettings->typeFlags&OB_FSBND_NOSLIP)) fsset.domainobsType = FLUIDSIM_OBSTACLE_NOSLIP;
- else if((domainSettings->typeFlags&OB_FSBND_PARTSLIP)) fsset.domainobsType = FLUIDSIM_OBSTACLE_PARTSLIP;
- else if((domainSettings->typeFlags&OB_FSBND_FREESLIP)) fsset.domainobsType = FLUIDSIM_OBSTACLE_FREESLIP;
- fsset.domainobsPartslip = domainSettings->partSlipValue;
- fsset.generateVertexVectors = (domainSettings->domainNovecgen==0);
-
- // init blender trafo matrix
- // fprintf(stderr,"elbeemInit - mpTrafo:\n");
- { int j;
- for(i=0; i<4; i++) {
- for(j=0; j<4; j++) {
- fsset.surfaceTrafo[i*4+j] = invDomMat[j][i];
- // fprintf(stderr,"elbeemInit - mpTrafo %d %d = %f (%d) \n", i,j, fsset.surfaceTrafo[i*4+j] , (i*4+j) );
- }
- } }
-
- // init solver with settings
- elbeemInit();
- elbeemAddDomain(&fsset);
-
- // init objects
- channelObjCount = 0;
- for(obit= G.main->object.first; obit; obit= obit->id.next) {
- //{ snprintf(debugStrBuffer,256,"DEBUG object name=%s, type=%d ...\n", obit->id.name, obit->type); elbeemDebugOut(debugStrBuffer); } // DEBUG
- if( (obit->fluidsimFlag & OB_FLUIDSIM_ENABLE) && // if has to match 3 places! // CHECKMATCH
- (obit->type==OB_MESH) &&
- (obit->fluidsimSettings->type != OB_FLUIDSIM_DOMAIN) &&
- (obit->fluidsimSettings->type != OB_FLUIDSIM_PARTICLE)
- ) {
- float *verts=NULL;
- int *tris=NULL;
- int numVerts=0, numTris=0;
- int o = channelObjCount;
- int deform = (obit->fluidsimSettings->domainNovecgen); // misused value
- // todo - use blenderInitElbeemMesh
- elbeemMesh fsmesh;
- elbeemResetMesh( &fsmesh );
- fsmesh.type = obit->fluidsimSettings->type;;
- // get name of object for debugging solver
- fsmesh.name = obit->id.name;
-
- initElbeemMesh(obit, &numVerts, &verts, &numTris, &tris, 0);
- fsmesh.numVertices = numVerts;
- fsmesh.numTriangles = numTris;
- fsmesh.vertices = verts;
- fsmesh.triangles = tris;
-
- fsmesh.channelSizeTranslation =
- fsmesh.channelSizeRotation =
- fsmesh.channelSizeScale =
- fsmesh.channelSizeInitialVel =
- fsmesh.channelSizeActive = allchannelSize;
-
- fsmesh.channelTranslation = channelObjMove[o][0];
- fsmesh.channelRotation = channelObjMove[o][1];
- fsmesh.channelScale = channelObjMove[o][2];
- fsmesh.channelActive = channelObjActive[o];
- if( (fsmesh.type == OB_FLUIDSIM_FLUID) ||
- (fsmesh.type == OB_FLUIDSIM_INFLOW) ) {
- fsmesh.channelInitialVel = channelObjInivel[o];
- fsmesh.localInivelCoords = ((obit->fluidsimSettings->typeFlags&OB_FSINFLOW_LOCALCOORD)?1:0);
- }
-
- if( (obit->fluidsimSettings->typeFlags&OB_FSBND_NOSLIP)) fsmesh.obstacleType = FLUIDSIM_OBSTACLE_NOSLIP;
- else if((obit->fluidsimSettings->typeFlags&OB_FSBND_PARTSLIP)) fsmesh.obstacleType = FLUIDSIM_OBSTACLE_PARTSLIP;
- else if((obit->fluidsimSettings->typeFlags&OB_FSBND_FREESLIP)) fsmesh.obstacleType = FLUIDSIM_OBSTACLE_FREESLIP;
- fsmesh.obstaclePartslip = obit->fluidsimSettings->partSlipValue;
- fsmesh.volumeInitType = obit->fluidsimSettings->volumeInitType;
- fsmesh.obstacleImpactFactor = obit->fluidsimSettings->surfaceSmoothing; // misused value
-
- // animated meshes
- if(deform) {
- fsmesh.channelSizeVertices = allchannelSize;
- fluidsimInitMeshChannel( &fsmesh.channelVertices, allchannelSize, obit, numVerts, timeAtFrame);
- G.scene->r.cfra = startFrame;
- scene_update_for_newframe(G.scene, G.scene->lay);
- // remove channels
- fsmesh.channelTranslation =
- fsmesh.channelRotation =
- fsmesh.channelScale = NULL;
- }
-
- elbeemAddMesh(&fsmesh);
-
- if(verts) MEM_freeN(verts);
- if(tris) MEM_freeN(tris);
- if(fsmesh.channelVertices) MEM_freeN(fsmesh.channelVertices);
- channelObjCount++;
- } // valid mesh
- } // objects
- //domainSettings->type = OB_FLUIDSIM_DOMAIN; // enable for bake display again
- //fsDomain->fluidsimFlag = OB_FLUIDSIM_ENABLE; // disable during bake
-
- globalBakeLock = SDL_CreateMutex();
- // set to neutral, -1 means user abort, -2 means init error
- globalBakeState = 0;
- globalBakeFrame = 0;
- simthr = SDL_CreateThread(fluidsimSimulateThread, targetFile);
-
- if(!simthr) {
- snprintf(debugStrBuffer,256,"fluidsimBake::error: Unable to create thread... running without one.\n");
- elbeemDebugOut(debugStrBuffer);
- set_timecursor(0);
- elbeemSimulate();
- } else {
- int done = 0;
- unsigned short event=0;
- short val;
- float noFramesf = (float)noFrames;
- float percentdone = 0.0;
- int lastRedraw = -1;
-
- start_progress_bar();
-
- while(done==0) {
- char busy_mess[80];
-
- waitcursor(1);
-
- // lukep we add progress bar as an interim mesure
- percentdone = globalBakeFrame / noFramesf;
- sprintf(busy_mess, "baking fluids %d / %d |||", globalBakeFrame, (int) noFramesf);
- progress_bar(percentdone, busy_mess );
-
- SDL_Delay(2000); // longer delay to prevent frequent redrawing
- SDL_mutexP(globalBakeLock);
- if(globalBakeState != 0) done = 1; // 1=ok, <0=error/abort
- SDL_mutexV(globalBakeLock);
-
- while(qtest()) {
- event = extern_qread(&val);
- if(event == ESCKEY) {
- // abort...
- SDL_mutexP(globalBakeLock);
- done = -1;
- globalBakeFrame = 0;
- globalBakeState = -1;
- simAborted = 1;
- SDL_mutexV(globalBakeLock);
- break;
- }
- }
-
- // redraw the 3D for showing progress once in a while...
- if(lastRedraw!=globalBakeFrame) {
- ScrArea *sa;
- G.scene->r.cfra = startFrame+globalBakeFrame;
- lastRedraw = globalBakeFrame;
- update_for_newframe_muted();
- sa= G.curscreen->areabase.first;
- while(sa) {
- if(sa->spacetype == SPACE_VIEW3D) { scrarea_do_windraw(sa); }
- sa= sa->next;
- }
- screen_swapbuffers();
- } // redraw
- }
- SDL_WaitThread(simthr,NULL);
- end_progress_bar();
- }
- SDL_DestroyMutex(globalBakeLock);
- globalBakeLock = NULL;
- } // El'Beem API init, thread creation
- // --------------------------------------------------------------------------------------------
- else
- { // write config file to be run with command line simulator
- pupmenu("Fluidsim Bake Message%t|Config file export not supported.%x0");
- } // config file export done!
-
- // --------------------------------------------------------------------------------------------
- FS_FREE_CHANNELS;
-
- // go back to "current" blender time
- waitcursor(0);
- G.scene->r.cfra = origFrame;
- scene_update_for_newframe(G.scene, G.scene->lay);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
-
- if(!simAborted) {
- char fsmessage[512];
- char elbeemerr[256];
- strcpy(fsmessage,"Fluidsim Bake Error: ");
- // check if some error occurred
- if(globalBakeState==-2) {
- strcat(fsmessage,"Failed to initialize [Msg: ");
-
- elbeemGetErrorString(elbeemerr);
- strcat(fsmessage,elbeemerr);
-
- strcat(fsmessage,"] |OK%x0");
- pupmenu(fsmessage);
- } // init error
- }
-}
-
-
-#else /* DISABLE_ELBEEM */
-
-/* compile dummy functions for disabled fluid sim */
-
-FluidsimSettings *fluidsimSettingsNew(struct Object *srcob) {
- return NULL;
-}
-
-void fluidsimSettingsFree(FluidsimSettings *fss) {
-}
-
-FluidsimSettings* fluidsimSettingsCopy(FluidsimSettings *fss) {
- return NULL;
-}
-
-/* only compile dummy functions */
-void fluidsimBake(struct Object *ob) {
-}
-
-#endif /* DISABLE_ELBEEM */
-
diff --git a/source/blender/src/fsmenu.c b/source/blender/src/fsmenu.c
deleted file mode 100644
index 319fb8de48f..00000000000
--- a/source/blender/src/fsmenu.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "BMF_Api.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_linklist.h"
-#include "BLI_dynstr.h"
-#include "BIF_usiblender.h"
-
-
-#include "BIF_fsmenu.h" /* include ourselves */
-
-
-/* FSMENU HANDLING */
-
- /* FSMenuEntry's without paths indicate seperators */
-typedef struct _FSMenuEntry FSMenuEntry;
-struct _FSMenuEntry {
- FSMenuEntry *next;
-
- char *path;
- short save;
-};
-
-static FSMenuEntry *fsmenu= 0;
-
-int fsmenu_get_nentries(void)
-{
- FSMenuEntry *fsme;
- int count= 0;
-
- for (fsme= fsmenu; fsme; fsme= fsme->next)
- count++;
-
- return count;
-}
-int fsmenu_is_entry_a_seperator(int idx)
-{
- FSMenuEntry *fsme;
-
- for (fsme= fsmenu; fsme && idx; fsme= fsme->next)
- idx--;
-
- return (fsme && !fsme->path)?1:0;
-}
-char *fsmenu_get_entry(int idx)
-{
- FSMenuEntry *fsme;
-
- for (fsme= fsmenu; fsme && idx; fsme= fsme->next)
- idx--;
-
- return fsme?fsme->path:NULL;
-}
-char *fsmenu_build_menu(void)
-{
- DynStr *ds= BLI_dynstr_new();
- FSMenuEntry *fsme;
- char *menustr;
-
- for (fsme= fsmenu; fsme; fsme= fsme->next) {
- if (!fsme->path) {
- /* clean consecutive seperators and ignore trailing ones */
- if (fsme->next) {
- if (fsme->next->path) {
- BLI_dynstr_append(ds, "%l|");
- } else {
- FSMenuEntry *next= fsme->next;
- fsme->next= next->next;
- MEM_freeN(next);
- }
- }
- } else {
- if (fsme->save) {
- BLI_dynstr_append(ds, "o ");
- } else {
- BLI_dynstr_append(ds, " ");
- }
- BLI_dynstr_append(ds, fsme->path);
- if (fsme->next) BLI_dynstr_append(ds, "|");
- }
- }
-
- menustr= BLI_dynstr_get_cstring(ds);
- BLI_dynstr_free(ds);
- return menustr;
-}
-static FSMenuEntry *fsmenu_get_last_separator(void)
-{
- FSMenuEntry *fsme, *lsep=NULL;
-
- for (fsme= fsmenu; fsme; fsme= fsme->next)
- if (!fsme->path)
- lsep= fsme;
-
- return lsep;
-}
-
-static FSMenuEntry *fsmenu_get_first_separator(void)
-{
- FSMenuEntry *fsme, *lsep=NULL;
-
- for (fsme= fsmenu; fsme; fsme= fsme->next)
- if (!fsme->path) {
- lsep= fsme;
- break;
- }
-
- return lsep;
-}
-
-void fsmenu_insert_entry(char *path, int sorted, short save)
-{
- FSMenuEntry *prev;
- FSMenuEntry *fsme;
-
- if (save) {
- prev = fsmenu_get_first_separator();
- } else {
- prev = fsmenu_get_last_separator();
- }
- fsme= prev?prev->next:fsmenu;
-
- for (; fsme; prev= fsme, fsme= fsme->next) {
- if (fsme->path) {
- if (BLI_streq(path, fsme->path)) {
- return;
- } else if (sorted && strcmp(path, fsme->path)<0) {
- break;
- }
- } else {
- // if we're bookmarking this, file should come
- // before the last separator, only automatically added
- // current dir go after the last sep.
- if (save) {
- break;
- }
- }
- }
-
- fsme= MEM_mallocN(sizeof(*fsme), "fsme");
- fsme->path= BLI_strdup(path);
- fsme->save = save;
-
- if (prev) {
- fsme->next= prev->next;
- prev->next= fsme;
- } else {
- fsme->next= fsmenu;
- fsmenu= fsme;
- }
-}
-void fsmenu_append_separator(void)
-{
- if (fsmenu) {
- FSMenuEntry *fsme= fsmenu;
-
- while (fsme->next) fsme= fsme->next;
-
- fsme->next= MEM_mallocN(sizeof(*fsme), "fsme");
- fsme->next->next= NULL;
- fsme->next->path= NULL;
- }
-}
-void fsmenu_remove_entry(int idx)
-{
- FSMenuEntry *prev= NULL, *fsme= fsmenu;
-
- for (fsme= fsmenu; fsme && idx; prev= fsme, fsme= fsme->next)
- idx--;
-
- if (fsme) {
- /* you should only be able to remove entries that were
- not added by default, like windows drives.
- also separators (where path == NULL) shouldn't be removed */
- if (fsme->save && fsme->path) {
-
- /* remove fsme from list */
- if (prev) {
- prev->next= fsme->next;
- } else {
- fsmenu= fsme->next;
- }
- /* free entry */
- MEM_freeN(fsme->path);
- MEM_freeN(fsme);
- }
- }
-}
-
-void fsmenu_write_file(const char *filename)
-{
- FSMenuEntry *fsme= fsmenu;
-
- FILE *fp = fopen(filename, "w");
- if (!fp) return;
-
- for (fsme= fsmenu; fsme; fsme= fsme->next) {
- if (fsme->path && fsme->save) {
- fprintf(fp, "%s\n", fsme->path);
- }
- }
- fclose(fp);
-}
-
-void fsmenu_free(void)
-{
- FSMenuEntry *fsme= fsmenu;
-
- while (fsme) {
- FSMenuEntry *n= fsme->next;
-
- if (fsme->path) MEM_freeN(fsme->path);
- MEM_freeN(fsme);
-
- fsme= n;
- }
-}
-
-
-
diff --git a/source/blender/src/ghostwinlay.c b/source/blender/src/ghostwinlay.c
deleted file mode 100644
index 597a23a20d7..00000000000
--- a/source/blender/src/ghostwinlay.c
+++ /dev/null
@@ -1,835 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-#include <stdlib.h>
-#include <stdio.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_listBase.h"
-#include "DNA_userdef_types.h" /* U.flag & TWOBUTTONMOUSE */
-
-#include "BLI_blenlib.h"
-
-#include "GHOST_C-api.h"
-
-#include "BKE_utildefines.h"
-#include "BKE_global.h"
-
-#include "BIF_gl.h"
-#include "BIF_graphics.h"
-#include "BIF_mywindow.h"
-#include "BIF_screen.h"
-#include "BIF_usiblender.h"
-#include "BIF_cursors.h"
-
-#include "mydevice.h"
-#include "blendef.h"
-
-#include "winlay.h"
-
-#ifdef __APPLE__
-#include <OpenGL/OpenGL.h>
-#define __CARBONSOUND__
- /* XXX BIG WARNING: carbon.h should not be included in blender/src code, it conflicts with struct ID */
-#define ID ID_
-#include <Carbon/Carbon.h>
-
-/*declarations*/
-int checkAppleVideoCard(void);
-void getMacAvailableBounds(short *, short *, short *, short *);
-
-#endif
-///
-
-struct _Window {
- GHOST_WindowHandle ghostwin;
-
- /* Handler and private data for handler */
- WindowHandlerFP handler;
- void *user_data;
-
- /* Window state */
- int size[2], position[2];
- int active, visible;
-
- /* Last known mouse/button/qualifier state */
- int lmouse[2];
- int lqual; /* (LR_SHFTKEY, LR_CTRLKEY, LR_ALTKEY, LR_COMMANDKEY) */
- int lmbut; /* (L_MOUSE, M_MOUSE, R_MOUSE) */
-
- /* xtilt and ytilt represent how much the pen is tilted away from
- * vertically upright in either the X or Y direction, with X and Y the
- * axes of the tablet surface.
- * In other words, Xtilt and Ytilt are components of a vector created by projecting
- * the pen's angle in 3D space vertically downwards on to the XY plane
- * --Matt
- */
- float pressure; /* tablet pressure - 0.0 (no pressure) to 1.0 (full pressure) */
- /* mouse clicks and non-contacting stylus buttons generate pressure of 0.0. */
- float xtilt, ytilt; /* tablet tilt value - x and y components of 3D angle
- * ranging from 0.0 (pen upright) to 1.0 (pen fully leaning over) */
- short activedevice; /* Active input device currently in use (DEV_MOUSE, DEV_STYLUS, DEV_ERASER) */
-
-
- /* Tracks the faked mouse button, if non-zero it is
- * the event number of the last faked button.
- */
- int faked_mbut;
-
- GHOST_TimerTaskHandle timer;
- int timer_event;
-};
-
-///
-
-#ifdef __APPLE__
-
-/* to avoid killing small end comps, we want to allow
- blender to start maximised if all the followings are true :
- - Renderer is OpenGL capable
- - Hardware acceleration
- - VRAM > 16 Mo
-
- we will bail out if VRAM is less than 8Mo
- */
-
-static int macPrefState = 0;
-
-int checkAppleVideoCard(void) {
- long theErr;
- unsigned long display_mask;
- CGLRendererInfoObj rend;
- long nrend;
- int j;
- long value;
- long maxvram = 0; /* we get always more than 1 renderer, check one, at least, has 8 Mo */
-
- display_mask = CGDisplayIDToOpenGLDisplayMask (CGMainDisplayID() );
-
- theErr = CGLQueryRendererInfo( display_mask, &rend, &nrend);
- if (theErr == 0) {
- theErr = CGLDescribeRenderer (rend, 0, kCGLRPRendererCount, &nrend);
- if (theErr == 0) {
- for (j = 0; j < nrend; j++) {
- theErr = CGLDescribeRenderer (rend, j, kCGLRPVideoMemory, &value);
- if (value > maxvram)
- maxvram = value;
- if ((theErr == 0) && (value >= 20000000)) {
- theErr = CGLDescribeRenderer (rend, j, kCGLRPAccelerated, &value);
- if ((theErr == 0) && (value != 0)) {
- theErr = CGLDescribeRenderer (rend, j, kCGLRPCompliant, &value);
- if ((theErr == 0) && (value != 0)) {
- /*fprintf(stderr,"make it big\n");*/
- CGLDestroyRendererInfo (rend);
- macPrefState = 8;
- return 1;
- }
- }
- }
- }
- }
- }
- if (maxvram < 7500000 ) { /* put a standard alert and quit*/
- SInt16 junkHit;
- char inError[] = "* Not enough VRAM ";
- char inText[] = "* blender needs at least 8Mb ";
- inError[0] = 16;
- inText[0] = 28;
-
- fprintf(stderr, " vram is %li . not enough, aborting\n", maxvram);
- StandardAlert ( kAlertStopAlert, (ConstStr255Param) &inError, (ConstStr255Param)&inText,NULL,&junkHit);
- abort();
- }
- CGLDestroyRendererInfo (rend);
- return 0;
-}
-
-void getMacAvailableBounds(short *top, short *left, short *bottom, short *right) {
- Rect outAvailableRect;
-
- GetAvailableWindowPositioningBounds ( GetMainDevice(), &outAvailableRect);
-
- *top = outAvailableRect.top;
- *left = outAvailableRect.left;
- *bottom = outAvailableRect.bottom;
- *right = outAvailableRect.right;
-}
-
-#endif
-
-
-static GHOST_SystemHandle g_system= 0;
-
- /* Some simple ghost <-> blender conversions */
-
-static GHOST_TStandardCursor convert_cursor(int curs) {
- switch(curs) {
- default:
- case CURSOR_STD: return GHOST_kStandardCursorDefault;
- case CURSOR_VPAINT: return GHOST_kStandardCursorRightArrow;
- case CURSOR_FACESEL: return GHOST_kStandardCursorRightArrow;
- case CURSOR_WAIT: return GHOST_kStandardCursorWait;
- case CURSOR_EDIT: return GHOST_kStandardCursorCrosshair;
- case CURSOR_HELP: return GHOST_kStandardCursorHelp;
- case CURSOR_X_MOVE: return GHOST_kStandardCursorLeftRight;
- case CURSOR_Y_MOVE: return GHOST_kStandardCursorUpDown;
- case CURSOR_PENCIL: return GHOST_kStandardCursorPencil;
- }
-}
-
-static int convert_mbut(GHOST_TButtonMask but) {
- if (but == GHOST_kButtonMaskLeft) {
- return LEFTMOUSE;
- } else if (but == GHOST_kButtonMaskRight) {
- return RIGHTMOUSE;
- } else {
- return MIDDLEMOUSE;
- }
-}
-
-static int convert_key(GHOST_TKey key) {
- if (key>=GHOST_kKeyA && key<=GHOST_kKeyZ) {
- return (AKEY + ((int) key - GHOST_kKeyA));
- } else if (key>=GHOST_kKey0 && key<=GHOST_kKey9) {
- return (ZEROKEY + ((int) key - GHOST_kKey0));
- } else if (key>=GHOST_kKeyNumpad0 && key<=GHOST_kKeyNumpad9) {
- return (PAD0 + ((int) key - GHOST_kKeyNumpad0));
- } else if (key>=GHOST_kKeyF1 && key<=GHOST_kKeyF12) {
- return (F1KEY + ((int) key - GHOST_kKeyF1));
- } else {
- switch (key) {
- case GHOST_kKeyBackSpace: return BACKSPACEKEY;
- case GHOST_kKeyTab: return TABKEY;
- case GHOST_kKeyLinefeed: return LINEFEEDKEY;
- case GHOST_kKeyClear: return 0;
- case GHOST_kKeyEnter: return RETKEY;
-
- case GHOST_kKeyEsc: return ESCKEY;
- case GHOST_kKeySpace: return SPACEKEY;
- case GHOST_kKeyQuote: return QUOTEKEY;
- case GHOST_kKeyComma: return COMMAKEY;
- case GHOST_kKeyMinus: return MINUSKEY;
- case GHOST_kKeyPeriod: return PERIODKEY;
- case GHOST_kKeySlash: return SLASHKEY;
-
- case GHOST_kKeySemicolon: return SEMICOLONKEY;
- case GHOST_kKeyEqual: return EQUALKEY;
-
- case GHOST_kKeyLeftBracket: return LEFTBRACKETKEY;
- case GHOST_kKeyRightBracket: return RIGHTBRACKETKEY;
- case GHOST_kKeyBackslash: return BACKSLASHKEY;
- case GHOST_kKeyAccentGrave: return ACCENTGRAVEKEY;
-
- case GHOST_kKeyLeftShift: return LEFTSHIFTKEY;
- case GHOST_kKeyRightShift: return RIGHTSHIFTKEY;
- case GHOST_kKeyLeftControl: return LEFTCTRLKEY;
- case GHOST_kKeyRightControl: return RIGHTCTRLKEY;
- case GHOST_kKeyCommand: return COMMANDKEY;
- case GHOST_kKeyLeftAlt: return LEFTALTKEY;
- case GHOST_kKeyRightAlt: return RIGHTALTKEY;
-
- case GHOST_kKeyCapsLock: return CAPSLOCKKEY;
- case GHOST_kKeyNumLock: return 0;
- case GHOST_kKeyScrollLock: return 0;
-
- case GHOST_kKeyLeftArrow: return LEFTARROWKEY;
- case GHOST_kKeyRightArrow: return RIGHTARROWKEY;
- case GHOST_kKeyUpArrow: return UPARROWKEY;
- case GHOST_kKeyDownArrow: return DOWNARROWKEY;
-
- case GHOST_kKeyPrintScreen: return 0;
- case GHOST_kKeyPause: return PAUSEKEY;
-
- case GHOST_kKeyInsert: return INSERTKEY;
- case GHOST_kKeyDelete: return DELKEY;
- case GHOST_kKeyHome: return HOMEKEY;
- case GHOST_kKeyEnd: return ENDKEY;
- case GHOST_kKeyUpPage: return PAGEUPKEY;
- case GHOST_kKeyDownPage: return PAGEDOWNKEY;
-
- case GHOST_kKeyNumpadPeriod: return PADPERIOD;
- case GHOST_kKeyNumpadEnter: return PADENTER;
- case GHOST_kKeyNumpadPlus: return PADPLUSKEY;
- case GHOST_kKeyNumpadMinus: return PADMINUS;
- case GHOST_kKeyNumpadAsterisk: return PADASTERKEY;
- case GHOST_kKeyNumpadSlash: return PADSLASHKEY;
-
- case GHOST_kKeyGrLess: return GRLESSKEY;
-
- case GHOST_kKeyUnknown: return UNKNOWNKEY;
-
- default:
- return 0;
- }
- }
-}
-
- /***/
-
-
-static Window *window_new(GHOST_WindowHandle ghostwin)
-{
- Window *win= MEM_callocN(sizeof(*win), "Window");
- win->ghostwin= ghostwin;
-
- return win;
-}
-
-static void window_handle(Window *win, short event, short val)
-{
- if (win->handler) {
- win->handler(win, win->user_data, event, val, 0);
- }
-}
-
-static void window_handle_ext(Window *win, short event, short val, short extra)
-{
- if (win->handler) {
- win->handler(win, win->user_data, event, val, extra);
- }
-}
-
-static void window_free(Window *win)
-{
- MEM_freeN(win);
-}
-
- /***/
-
-static Window *active_gl_window= NULL;
-
-Window *window_open(char *title, int posx, int posy, int sizex, int sizey, int start_maximized)
-{
- GHOST_WindowHandle ghostwin;
- GHOST_TWindowState inital_state;
- int scr_w, scr_h;
-
- winlay_get_screensize(&scr_w, &scr_h);
- posy= (scr_h-posy-sizey);
-
- if (start_maximized == G_WINDOWSTATE_FULLSCREEN)
- inital_state = start_maximized?GHOST_kWindowStateFullScreen:GHOST_kWindowStateNormal;
- else
- inital_state = start_maximized?GHOST_kWindowStateMaximized:GHOST_kWindowStateNormal;
-#ifdef __APPLE__
- inital_state += macPrefState;
-#endif
-
- ghostwin= GHOST_CreateWindow(g_system,
- title,
- posx, posy, sizex, sizey,
- inital_state,
- GHOST_kDrawingContextTypeOpenGL,
- 0 /* no stereo */);
-
- if (ghostwin) {
- Window *win= window_new(ghostwin);
-
- if (win) {
- GHOST_SetWindowUserData(ghostwin, win);
-
- win->position[0]= posx;
- win->position[1]= posy;
- win->size[0]= sizex;
- win->size[1]= sizey;
-
- win->lmouse[0]= win->size[0]/2;
- win->lmouse[1]= win->size[1]/2;
-
-
- } else {
- GHOST_DisposeWindow(g_system, ghostwin);
- }
-
- return win;
- } else {
- return NULL;
- }
-}
-
-void window_set_handler(Window *win, WindowHandlerFP handler, void *user_data)
-{
- win->handler= handler;
- win->user_data= user_data;
-}
-
-static void window_timer_proc(GHOST_TimerTaskHandle timer, GHOST_TUns64 time)
-{
- Window *win= GHOST_GetTimerTaskUserData(timer);
-
- win->handler(win, win->user_data, win->timer_event, 0, 0);
-}
-
-void window_set_timer(Window *win, int delay_ms, int event)
-{
- if (win->timer) GHOST_RemoveTimer(g_system, win->timer);
-
- win->timer_event= event;
- win->timer= GHOST_InstallTimer(g_system, delay_ms, delay_ms, window_timer_proc, win);
-}
-
-void window_destroy(Window *win) {
- if (active_gl_window==win) {
- active_gl_window= NULL;
- }
-
- if (win->timer) {
- GHOST_RemoveTimer(g_system, win->timer);
- win->timer= NULL;
- }
-
- GHOST_DisposeWindow(g_system, win->ghostwin);
- window_free(win);
-}
-
-void window_set_cursor(Window *win, int curs) {
- if (curs==CURSOR_NONE) {
- GHOST_SetCursorVisibility(win->ghostwin, 0);
- } else {
- GHOST_SetCursorVisibility(win->ghostwin, 1);
-
- /* detect if we use system cursor or Blender cursor */
- switch(curs) {
- case CURSOR_TEXTEDIT:
- SetBlenderCursor(BC_TEXTEDITCURSOR);
- break;
- case CURSOR_VPAINT:
- SetBlenderCursor(BC_PAINTBRUSHCURSOR);
- break;
- default:
- GHOST_SetCursorShape(win->ghostwin, convert_cursor(curs));
- }
- }
-}
-
-void window_set_custom_cursor(Window *win, unsigned char mask[16][2],
- unsigned char bitmap[16][2], int hotx, int hoty) {
- GHOST_SetCustomCursorShape(win->ghostwin, bitmap, mask, hotx, hoty);
-}
-
-void window_set_custom_cursor_ex(Window *win, BCursor *cursor, int useBig) {
- if (useBig) {
- GHOST_SetCustomCursorShapeEx(win->ghostwin,
- (GHOST_TUns8 *)cursor->big_bm, (GHOST_TUns8 *)cursor->big_mask,
- cursor->big_sizex,cursor->big_sizey,
- cursor->big_hotx,cursor->big_hoty,
- cursor->fg_color, cursor->bg_color);
- } else {
- GHOST_SetCustomCursorShapeEx(win->ghostwin,
- (GHOST_TUns8 *)cursor->small_bm, (GHOST_TUns8 *)cursor->small_mask,
- cursor->small_sizex,cursor->small_sizey,
- cursor->small_hotx,cursor->small_hoty,
- cursor->fg_color, cursor->bg_color);
- }
-}
-
-void window_make_active(Window *win) {
- if (win != active_gl_window) {
- win->lmbut= 0; /* keeps hanging when mousepressed while other window opened */
- active_gl_window= win;
- GHOST_ActivateWindowDrawingContext(win->ghostwin);
- }
-}
-
-void window_swap_buffers(Window *win) {
- GHOST_SwapWindowBuffers(win->ghostwin);
-}
-
-static int query_qual(char qual) {
- GHOST_TModifierKeyMask left, right;
- int val= 0;
-
- if (qual=='s') {
- left= GHOST_kModifierKeyLeftShift;
- right= GHOST_kModifierKeyRightShift;
- } else if (qual=='c') {
- left= GHOST_kModifierKeyLeftControl;
- right= GHOST_kModifierKeyRightControl;
- } else if (qual=='C') {
- left= right= GHOST_kModifierKeyCommand;
- } else {
- left= GHOST_kModifierKeyLeftAlt;
- right= GHOST_kModifierKeyRightAlt;
- }
-
- GHOST_GetModifierKeyState(g_system, left, &val);
- if (!val)
- GHOST_GetModifierKeyState(g_system, right, &val);
-
- return val;
-}
-
-static int change_bit(int val, int bit, int to_on) {
- return to_on?(val|bit):(val&~bit);
-}
-
-static void update_tablet_data(Window *win, Window *ghostwin) {
- const GHOST_TabletData *td= GHOST_GetTabletData(ghostwin);
-
- /* if there's tablet data from an active tablet device then use it,
- * otherwise set all tablet related data to default */
- if ((td != NULL) && ELEM(td->Active, DEV_STYLUS, DEV_ERASER)) {
- win->activedevice = (short)td->Active;
- win->pressure = td->Pressure;
- win->xtilt = td->Xtilt;
- win->ytilt = td->Ytilt;
- } else {
- win->activedevice = DEV_MOUSE;
- win->pressure = 0.0;
- win->xtilt = win->ytilt = 0.0;
- }
-}
-
-
-static int event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
-{
- GHOST_TEventType type= GHOST_GetEventType(evt);
-
- if (type == GHOST_kEventQuit) {
- exit_usiblender();
- } else {
- GHOST_WindowHandle ghostwin= GHOST_GetEventWindow(evt);
- GHOST_TEventDataPtr data= GHOST_GetEventData(evt);
- Window *win;
-
- if (!ghostwin) {
- // XXX - should be checked, why are we getting an event here, and
- // what is it?
-
- return 1;
- } else if (!GHOST_ValidWindow(g_system, ghostwin)) {
- // XXX - should be checked, why are we getting an event here, and
- // what is it?
-
- return 1;
- } else {
- win= GHOST_GetWindowUserData(ghostwin);
- }
-
- switch (type) {
- case GHOST_kEventCursorMove: {
- if(win->active == 1) {
- GHOST_TEventCursorData *cd= data;
-
- int cx, cy;
-
- GHOST_ScreenToClient(win->ghostwin, cd->x, cd->y, &cx, &cy);
- win->lmouse[0]= cx;
- win->lmouse[1]= (win->size[1]-1) - cy;
-
- update_tablet_data(win, ghostwin);
- window_handle(win, MOUSEX, win->lmouse[0]);
- window_handle(win, MOUSEY, win->lmouse[1]);
- }
- break;
- }
- case GHOST_kEventButtonDown:
- case GHOST_kEventButtonUp: {
- GHOST_TEventButtonData *bd= data;
- int val= (type==GHOST_kEventButtonDown);
- int bbut= convert_mbut(bd->button);
-
- if (bbut==LEFTMOUSE) {
- if (val) {
- if (win->lqual & LR_COMMANDKEY) {
- bbut= win->faked_mbut= RIGHTMOUSE;
- } else if ((win->lqual & LR_ALTKEY) && (U.flag & USER_TWOBUTTONMOUSE)) {
- /* finally, it actually USES the userpref! :) -intrr */
- bbut= win->faked_mbut= MIDDLEMOUSE;
- }
- } else {
- if (win->faked_mbut) {
- bbut= win->faked_mbut;
- win->faked_mbut= 0;
- }
- }
- }
-
- if (bbut==LEFTMOUSE) {
- win->lmbut= change_bit(win->lmbut, L_MOUSE, val);
- } else if (bbut==MIDDLEMOUSE) {
- win->lmbut= change_bit(win->lmbut, M_MOUSE, val);
- } else {
- win->lmbut= change_bit(win->lmbut, R_MOUSE, val);
- }
-
- update_tablet_data(win, ghostwin);
- window_handle(win, bbut, val);
-
- break;
- }
-
- case GHOST_kEventKeyDown:
- case GHOST_kEventKeyUp: {
- GHOST_TEventKeyData *kd= data;
- int val= (type==GHOST_kEventKeyDown);
- int bkey= convert_key(kd->key);
-
- if (bkey) {
- if (bkey==LEFTSHIFTKEY || bkey==RIGHTSHIFTKEY) {
- win->lqual= change_bit(win->lqual, LR_SHIFTKEY, val);
- } else if (bkey==LEFTCTRLKEY || bkey==RIGHTCTRLKEY) {
- win->lqual= change_bit(win->lqual, LR_CTRLKEY, val);
- } else if (bkey==LEFTALTKEY || bkey==RIGHTALTKEY) {
- win->lqual= change_bit(win->lqual, LR_ALTKEY, val);
- } else if (bkey==COMMANDKEY) {
- win->lqual= change_bit(win->lqual, LR_COMMANDKEY, val);
- }
-
- window_handle_ext(win, bkey, val, kd->ascii);
- }
-
- break;
- }
-
- case GHOST_kEventWheel: {
- GHOST_TEventWheelData* wheelData = (GHOST_TEventWheelData*) data;
- if (wheelData->z > 0) {
- window_handle(win, WHEELUPMOUSE, 1);
- } else {
- window_handle(win, WHEELDOWNMOUSE, 1);
- }
- break;
- }
-
- case GHOST_kEventWindowDeactivate:
- case GHOST_kEventWindowActivate: {
- win->active= (type==GHOST_kEventWindowActivate);
- window_handle(win, INPUTCHANGE, win->active);
-
- if (win->active) {
- if ((win->lqual & LR_SHIFTKEY) && !query_qual('s')) {
- win->lqual= change_bit(win->lqual, LR_SHIFTKEY, 0);
- window_handle(win, LEFTSHIFTKEY, 0);
- }
- if ((win->lqual & LR_CTRLKEY) && !query_qual('c')) {
- win->lqual= change_bit(win->lqual, LR_CTRLKEY, 0);
- window_handle(win, LEFTCTRLKEY, 0);
- }
- if ((win->lqual & LR_ALTKEY) && !query_qual('a')) {
- win->lqual= change_bit(win->lqual, LR_ALTKEY, 0);
- window_handle(win, LEFTALTKEY, 0);
- }
- if ((win->lqual & LR_COMMANDKEY) && !query_qual('C')) {
- win->lqual= change_bit(win->lqual, LR_COMMANDKEY, 0);
- window_handle(win, LR_COMMANDKEY, 0);
- }
-
- /*
- * XXX quick hack so OSX version works better
- * when the window is clicked on (focused).
- *
- * it used to pass on the old win->lmouse value,
- * which causes a wrong click in Blender.
- * Actually, a 'focus' click should not be passed
- * on to blender... (ton)
- */
- if(1) { /* enables me to add locals */
- int cx, cy, wx, wy;
- GHOST_GetCursorPosition(g_system, &wx, &wy);
-
- GHOST_ScreenToClient(win->ghostwin, wx, wy, &cx, &cy);
- win->lmouse[0]= cx;
- win->lmouse[1]= (win->size[1]-1) - cy;
- window_handle(win, MOUSEX, win->lmouse[0]);
- window_handle(win, MOUSEY, win->lmouse[1]);
- }
- }
-
- break;
- }
- case GHOST_kEventWindowClose: {
- window_handle(win, WINCLOSE, 1);
- break;
- }
- case GHOST_kEventWindowUpdate: {
- window_handle(win, REDRAW, 1);
- break;
- }
- case GHOST_kEventWindowSize: {
- GHOST_RectangleHandle client_rect;
- int l, t, r, b, scr_w, scr_h;
-
- client_rect= GHOST_GetClientBounds(win->ghostwin);
- GHOST_GetRectangle(client_rect, &l, &t, &r, &b);
-
- GHOST_DisposeRectangle(client_rect);
-
- winlay_get_screensize(&scr_w, &scr_h);
- win->position[0]= l;
- win->position[1]= scr_h - b - 1;
- win->size[0]= r-l;
- win->size[1]= b-t;
-
- window_handle(win, RESHAPE, 1);
- break;
- }
- case GHOST_kEventUnknown:
- case GHOST_kEventQuit:
- case GHOST_kNumEventTypes:
- break;
- }
- }
-
- return 1;
-}
-
-char *window_get_title(Window *win) {
- char *title= GHOST_GetTitle(win->ghostwin);
- char *mem_title= BLI_strdup(title);
- free(title);
-
- return mem_title;
-}
-
-void window_set_title(Window *win, char *title) {
- GHOST_SetTitle(win->ghostwin, title);
-}
-
-short window_get_qual(Window *win)
-{
- int qual= 0;
-
- if( query_qual('s')) qual |= LR_SHIFTKEY;
- if( query_qual('a')) qual |= LR_ALTKEY;
- if( query_qual('c')) qual |= LR_CTRLKEY;
- return qual;
-// return win->lqual;
-}
-
-short window_get_mbut(Window *win) {
- return win->lmbut;
-}
-
-void window_get_mouse(Window *win, short *mval) {
- mval[0]= win->lmouse[0];
- mval[1]= win->lmouse[1];
-}
-
-float window_get_pressure(Window *win) {
- return win->pressure;
-}
-
-void window_get_tilt(Window *win, float *xtilt, float *ytilt) {
- *xtilt= win->xtilt;
- *ytilt= win->ytilt;
-}
-
-short window_get_activedevice(Window *win) {
- return win->activedevice;
-}
-
-void window_get_position(Window *win, int *posx_r, int *posy_r) {
- *posx_r= win->position[0];
- *posy_r= win->position[1];
-}
-
-void window_get_size(Window *win, int *width_r, int *height_r) {
- *width_r= win->size[0];
- *height_r= win->size[1];
-}
-
-void window_set_size(Window *win, int width, int height) {
- GHOST_SetClientSize(win->ghostwin, width, height);
-}
-
-void window_lower(Window *win) {
- GHOST_SetWindowOrder(win->ghostwin, GHOST_kWindowOrderBottom);
-}
-
-void window_raise(Window *win) {
- GHOST_SetWindowOrder(win->ghostwin, GHOST_kWindowOrderTop);
-#ifdef _WIN32
- markdirty_all(); /* to avoid redraw errors in fullscreen mode (aphex) */
-#endif
-}
-
-#if 0
-//#ifdef _WIN32 //FULLSCREEN
-void window_toggle_fullscreen(Window *win, int fullscreen) {
- /* these two lines make sure front and backbuffer are equal. for swapbuffers */
- markdirty_all();
- screen_swapbuffers();
-
- if(fullscreen)
- GHOST_SetWindowState(win->ghostwin, GHOST_kWindowStateFullScreen);
- else
- GHOST_SetWindowState(win->ghostwin, GHOST_kWindowStateMaximized);
-}
-#endif
-
-void window_warp_pointer(Window *win, int x, int y) {
- int oldx=x, oldy=y;
-
- y= win->size[1] - y - 1;
- GHOST_ClientToScreen(win->ghostwin, x, y, &x, &y);
- GHOST_SetCursorPosition(g_system, x, y);
-
- /* on OSX (for example) the setcursor doesnt create event */
- win->lmouse[0]= oldx;
- win->lmouse[1]= oldy;
-}
-
-void window_queue_redraw(Window *win) {
- GHOST_InvalidateWindow(win->ghostwin); // ghost will send back a redraw to blender
-}
-
-/***/
-
-void winlay_process_events(int wait_for_event) {
- GHOST_ProcessEvents(g_system, wait_for_event);
- GHOST_DispatchEvents(g_system);
-}
-
-void winlay_get_screensize(int *width_r, int *height_r) {
- unsigned int uiwidth;
- unsigned int uiheight;
-
- if (!g_system) {
- GHOST_EventConsumerHandle consumer= GHOST_CreateEventConsumer(event_proc, NULL);
-
- g_system= GHOST_CreateSystem();
- GHOST_AddEventConsumer(g_system, consumer);
- }
-
- GHOST_GetMainDisplayDimensions(g_system, &uiwidth, &uiheight);
- *width_r= uiwidth;
- *height_r= uiheight;
-}
-
-Window *winlay_get_active_window(void) {
- return active_gl_window;
-}
diff --git a/source/blender/src/glutil.c b/source/blender/src/glutil.c
deleted file mode 100644
index 13922bb7eef..00000000000
--- a/source/blender/src/glutil.c
+++ /dev/null
@@ -1,695 +0,0 @@
-
-
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_vec_types.h"
-#include "DNA_listBase.h"
-
-#include "BKE_utildefines.h"
-
-#include "BLI_arithb.h"
-#include "BLI_threads.h"
-
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-#include "BIF_mywindow.h"
-
-#ifndef GL_CLAMP_TO_EDGE
-#define GL_CLAMP_TO_EDGE 0x812F
-#endif
-
-
- /* Invert line handling */
-
-#define glToggle(mode, onoff) (((onoff)?glEnable:glDisable)(mode))
-
-void set_inverted_drawing(int enable)
-{
- glLogicOp(enable?GL_INVERT:GL_COPY);
-
- /* Use GL_BLEND_EQUATION_EXT on sgi (if we have it),
- * apparently GL_COLOR_LOGIC_OP doesn't work on O2?
- * Is this an sgi bug or our bug?
- */
-#if defined(__sgi) && defined(GL_BLEND_EQUATION_EXT)
- glBlendEquationEXT(enable?GL_LOGIC_OP:GL_FUNC_ADD_EXT);
- glToggle(GL_BLEND, enable);
-#else
- glToggle(GL_COLOR_LOGIC_OP, enable);
-#endif
-
- glToggle(GL_DITHER, !enable);
-}
-
-void sdrawXORline(int x0, int y0, int x1, int y1)
-{
- if(x0==x1 && y0==y1) return;
-
- set_inverted_drawing(1);
-
- glBegin(GL_LINES);
- glVertex2i(x0, y0);
- glVertex2i(x1, y1);
- glEnd();
-
- set_inverted_drawing(0);
-}
-
-void glutil_draw_front_xor_line(int x0, int y0, int x1, int y1)
-{
- glReadBuffer(GL_FRONT);
- glDrawBuffer(GL_FRONT);
- sdrawXORline(x0, y0, x1, y1);
- glFlush();
- glReadBuffer(GL_BACK);
- glDrawBuffer(GL_BACK);
-
-}
-
-void sdrawXORline4(int nr, int x0, int y0, int x1, int y1)
-{
- static short old[4][2][2];
- static char flags[4]= {0, 0, 0, 0};
-
- /* with builtin memory, max 4 lines */
-
- set_inverted_drawing(1);
-
- glBegin(GL_LINES);
- if(nr== -1) { /* flush */
- for (nr=0; nr<4; nr++) {
- if (flags[nr]) {
- glVertex2sv(old[nr][0]);
- glVertex2sv(old[nr][1]);
- flags[nr]= 0;
- }
- }
- } else {
- if(nr>=0 && nr<4) {
- if(flags[nr]) {
- glVertex2sv(old[nr][0]);
- glVertex2sv(old[nr][1]);
- }
-
- old[nr][0][0]= x0;
- old[nr][0][1]= y0;
- old[nr][1][0]= x1;
- old[nr][1][1]= y1;
-
- flags[nr]= 1;
- }
-
- glVertex2i(x0, y0);
- glVertex2i(x1, y1);
- }
- glEnd();
-
- set_inverted_drawing(0);
-}
-
-void fdrawXORellipse(float xofs, float yofs, float hw, float hh)
-{
- if(hw==0) return;
-
- set_inverted_drawing(1);
-
- glPushMatrix();
- glTranslatef(xofs, yofs, 0.0);
- glScalef(1,hh/hw,1);
- glutil_draw_lined_arc(0.0, M_PI*2.0, hw, 20);
- glPopMatrix();
-
- set_inverted_drawing(0);
-}
-void fdrawXORcirc(float xofs, float yofs, float rad)
-{
- set_inverted_drawing(1);
-
- glPushMatrix();
- glTranslatef(xofs, yofs, 0.0);
- glutil_draw_lined_arc(0.0, M_PI*2.0, rad, 20);
- glPopMatrix();
-
- set_inverted_drawing(0);
-}
-
-void glutil_draw_filled_arc(float start, float angle, float radius, int nsegments) {
- int i;
-
- glBegin(GL_TRIANGLE_FAN);
- glVertex2f(0.0, 0.0);
- for (i=0; i<nsegments; i++) {
- float t= (float) i/(nsegments-1);
- float cur= start + t*angle;
-
- glVertex2f(cos(cur)*radius, sin(cur)*radius);
- }
- glEnd();
-}
-
-void glutil_draw_lined_arc(float start, float angle, float radius, int nsegments) {
- int i;
-
- glBegin(GL_LINE_STRIP);
- for (i=0; i<nsegments; i++) {
- float t= (float) i/(nsegments-1);
- float cur= start + t*angle;
-
- glVertex2f(cos(cur)*radius, sin(cur)*radius);
- }
- glEnd();
-}
-
-int glaGetOneInteger(int param)
-{
- GLint i;
- glGetIntegerv(param, &i);
- return i;
-}
-
-float glaGetOneFloat(int param)
-{
- GLfloat v;
- glGetFloatv(param, &v);
- return v;
-}
-
-void glaRasterPosSafe2f(float x, float y, float known_good_x, float known_good_y)
-{
- GLubyte dummy= 0;
-
- /* As long as known good coordinates are correct
- * this is guarenteed to generate an ok raster
- * position (ignoring potential (real) overflow
- * issues).
- */
- glRasterPos2f(known_good_x, known_good_y);
-
- /* Now shift the raster position to where we wanted
- * it in the first place using the glBitmap trick.
- */
- glBitmap(0, 0, 0, 0, x - known_good_x, y - known_good_y, &dummy);
-}
-
-static int get_cached_work_texture(int *w_r, int *h_r)
-{
- static GLint texid= -1;
- static int tex_w= 256;
- static int tex_h= 256;
-
- if (texid==-1) {
- GLint ltexid= glaGetOneInteger(GL_TEXTURE_2D);
- unsigned char *tbuf;
-
- glGenTextures(1, (GLuint *)&texid);
-
- glBindTexture(GL_TEXTURE_2D, texid);
-
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-
- tbuf= MEM_callocN(tex_w*tex_h*4, "tbuf");
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, tex_w, tex_h, 0, GL_RGBA, GL_UNSIGNED_BYTE, tbuf);
- MEM_freeN(tbuf);
-
- glBindTexture(GL_TEXTURE_2D, ltexid);
- }
-
- *w_r= tex_w;
- *h_r= tex_h;
- return texid;
-}
-
-void glaDrawPixelsTex(float x, float y, int img_w, int img_h, int format, void *rect)
-{
- unsigned char *uc_rect= (unsigned char*) rect;
- float *f_rect= (float *)rect;
- float xzoom= glaGetOneFloat(GL_ZOOM_X), yzoom= glaGetOneFloat(GL_ZOOM_Y);
- int ltexid= glaGetOneInteger(GL_TEXTURE_2D);
- int lrowlength= glaGetOneInteger(GL_UNPACK_ROW_LENGTH);
- int subpart_x, subpart_y, tex_w, tex_h;
- int texid= get_cached_work_texture(&tex_w, &tex_h);
- int nsubparts_x= (img_w+(tex_w-1))/tex_w;
- int nsubparts_y= (img_h+(tex_h-1))/tex_h;
-
- /* Specify the color outside this function, and tex will modulate it.
- * This is useful for changing alpha without using glPixelTransferf()
- */
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
- glPixelStorei(GL_UNPACK_ROW_LENGTH, img_w);
- glBindTexture(GL_TEXTURE_2D, texid);
-
- /* don't want nasty border artifacts */
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
- for (subpart_y=0; subpart_y<nsubparts_y; subpart_y++) {
- for (subpart_x=0; subpart_x<nsubparts_x; subpart_x++) {
- int subpart_w= (subpart_x==nsubparts_x-1)?(img_w-subpart_x*tex_w):tex_w;
- int subpart_h= (subpart_y==nsubparts_y-1)?(img_h-subpart_y*tex_h):tex_h;
- float rast_x= x+subpart_x*tex_w*xzoom;
- float rast_y= y+subpart_y*tex_h*yzoom;
-
- if(format==GL_FLOAT)
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, subpart_w, subpart_h, GL_RGBA, GL_FLOAT, &f_rect[(subpart_y*tex_w)*img_w*4 + (subpart_x*tex_w)*4]);
- else
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, subpart_w, subpart_h, GL_RGBA, GL_UNSIGNED_BYTE, &uc_rect[(subpart_y*tex_w)*img_w*4 + (subpart_x*tex_w)*4]);
-
- glEnable(GL_TEXTURE_2D);
- glBegin(GL_QUADS);
- glTexCoord2f(0, 0);
- glVertex2f(rast_x, rast_y);
-
- glTexCoord2f((float) (subpart_w-1)/tex_w, 0);
- glVertex2f(rast_x+subpart_w*xzoom, rast_y);
-
- glTexCoord2f((float) (subpart_w-1)/tex_w, (float) subpart_h/tex_h);
- glVertex2f(rast_x+subpart_w*xzoom, rast_y+subpart_h*yzoom);
-
- glTexCoord2f(0, (float) subpart_h/tex_h);
- glVertex2f(rast_x, rast_y+subpart_h*yzoom);
- glEnd();
- glDisable(GL_TEXTURE_2D);
- }
- }
-
- glBindTexture(GL_TEXTURE_2D, ltexid);
- glPixelStorei(GL_UNPACK_ROW_LENGTH, lrowlength);
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-}
-
-#define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255: (char)(255.0f*val))
-void glaDrawPixelsSafe_to32(float fx, float fy, int img_w, int img_h, int row_w, float *rectf)
-{
- float *rf;
- int x, y;
- char *rect32, *rc;
-
- /* copy imgw-imgh to a temporal 32 bits rect */
- if(img_w<1 || img_h<1) return;
-
- rc= rect32= MEM_mallocN(img_w*img_h*sizeof(int), "temp 32 bits");
-
- for(y=0; y<img_h; y++) {
- rf= rectf;
- for(x=0; x<img_w; x++, rf+=4, rc+=4) {
- rc[0]= FTOCHAR(rf[0]);
- rc[1]= FTOCHAR(rf[1]);
- rc[2]= FTOCHAR(rf[2]);
- rc[3]= FTOCHAR(rf[3]);
- }
- rectf+= 4*row_w;
- }
-
- glaDrawPixelsSafe(fx, fy, img_w, img_h, img_w, GL_RGBA, GL_UNSIGNED_BYTE, rect32);
-
- MEM_freeN(rect32);
-}
-
-void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int format, int type, void *rect)
-{
- float xzoom= glaGetOneFloat(GL_ZOOM_X);
- float yzoom= glaGetOneFloat(GL_ZOOM_Y);
-
- /* The pixel space coordinate of the intersection of
- * the [zoomed] image with the origin.
- */
- float ix= -x/xzoom;
- float iy= -y/yzoom;
-
- /* The maximum pixel amounts the image can be cropped
- * at the lower left without exceeding the origin.
- */
- int off_x= floor(MAX2(ix, 0));
- int off_y= floor(MAX2(iy, 0));
-
- /* The zoomed space coordinate of the raster position
- * (starting at the lower left most unclipped pixel).
- */
- float rast_x= x + off_x*xzoom;
- float rast_y= y + off_y*yzoom;
-
- GLfloat scissor[4];
- int draw_w, draw_h;
-
- /* Determine the smallest number of pixels we need to draw
- * before the image would go off the upper right corner.
- *
- * It may seem this is just an optimization but some graphics
- * cards (ATI) freak out if there is a large zoom factor and
- * a large number of pixels off the screen (probably at some
- * level the number of image pixels to draw is getting multiplied
- * by the zoom and then clamped). Making sure we draw the
- * fewest pixels possible keeps everyone mostly happy (still
- * fails if we zoom in on one really huge pixel so that it
- * covers the entire screen).
- */
- glGetFloatv(GL_SCISSOR_BOX, scissor);
- draw_w = MIN2(img_w-off_x, ceil((scissor[2]-rast_x)/xzoom));
- draw_h = MIN2(img_h-off_y, ceil((scissor[3]-rast_y)/yzoom));
-
- if (draw_w>0 && draw_h>0) {
- int old_row_length = glaGetOneInteger(GL_UNPACK_ROW_LENGTH);
-
- /* Don't use safe RasterPos (slower) if we can avoid it. */
- if (rast_x>=0 && rast_y>=0) {
- glRasterPos2f(rast_x, rast_y);
- } else {
- glaRasterPosSafe2f(rast_x, rast_y, 0, 0);
- }
-
- glPixelStorei(GL_UNPACK_ROW_LENGTH, row_w);
- if(format==GL_LUMINANCE || format==GL_RED) {
- if(type==GL_FLOAT) {
- float *f_rect= (float *)rect;
- glDrawPixels(draw_w, draw_h, format, type, f_rect + (off_y*row_w + off_x));
- }
- else if(type==GL_INT || type==GL_UNSIGNED_INT) {
- int *i_rect= (int *)rect;
- glDrawPixels(draw_w, draw_h, format, type, i_rect + (off_y*row_w + off_x));
- }
- }
- else { /* RGBA */
- if(type==GL_FLOAT) {
- float *f_rect= (float *)rect;
- glDrawPixels(draw_w, draw_h, format, type, f_rect + (off_y*row_w + off_x)*4);
- }
- else if(type==GL_UNSIGNED_BYTE) {
- unsigned char *uc_rect= (unsigned char *) rect;
- glDrawPixels(draw_w, draw_h, format, type, uc_rect + (off_y*row_w + off_x)*4);
- }
- }
-
- glPixelStorei(GL_UNPACK_ROW_LENGTH, old_row_length);
- }
-}
-
-/* 2D Drawing Assistance */
-
-void glaDefine2DArea(rcti *screen_rect)
-{
- int sc_w= screen_rect->xmax - screen_rect->xmin;
- int sc_h= screen_rect->ymax - screen_rect->ymin;
-
- glViewport(screen_rect->xmin, screen_rect->ymin, sc_w, sc_h);
- glScissor(screen_rect->xmin, screen_rect->ymin, sc_w, sc_h);
-
- /* The 0.375 magic number is to shift the matrix so that
- * both raster and vertex integer coordinates fall at pixel
- * centers properly. For a longer discussion see the OpenGL
- * Programming Guide, Appendix H, Correctness Tips.
- */
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(0.0, sc_w, 0.0, sc_h, -1, 1);
- glTranslatef(0.375, 0.375, 0.0);
-
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-}
-
-struct gla2DDrawInfo {
- int orig_vp[4], orig_sc[4];
- float orig_projmat[16], orig_viewmat[16];
-
- rcti screen_rect;
- rctf world_rect;
-
- float wo_to_sc[2];
-};
-
-void gla2DGetMap(gla2DDrawInfo *di, rctf *rect)
-{
- *rect= di->world_rect;
-}
-
-void gla2DSetMap(gla2DDrawInfo *di, rctf *rect)
-{
- int sc_w, sc_h;
- float wo_w, wo_h;
-
- di->world_rect= *rect;
-
- sc_w= (di->screen_rect.xmax-di->screen_rect.xmin);
- sc_h= (di->screen_rect.ymax-di->screen_rect.ymin);
- wo_w= (di->world_rect.xmax-di->world_rect.xmin);
- wo_h= (di->world_rect.ymax-di->world_rect.ymin);
-
- di->wo_to_sc[0]= sc_w/wo_w;
- di->wo_to_sc[1]= sc_h/wo_h;
-}
-
-
-gla2DDrawInfo *glaBegin2DDraw(rcti *screen_rect, rctf *world_rect)
-{
- gla2DDrawInfo *di= MEM_mallocN(sizeof(*di), "gla2DDrawInfo");
- int sc_w, sc_h;
- float wo_w, wo_h;
-
- glGetIntegerv(GL_VIEWPORT, (GLint *)di->orig_vp);
- glGetIntegerv(GL_SCISSOR_BOX, (GLint *)di->orig_sc);
- glGetFloatv(GL_PROJECTION_MATRIX, (GLfloat *)di->orig_projmat);
- glGetFloatv(GL_MODELVIEW_MATRIX, (GLfloat *)di->orig_viewmat);
-
- di->screen_rect= *screen_rect;
- if (world_rect) {
- di->world_rect= *world_rect;
- } else {
- di->world_rect.xmin= di->screen_rect.xmin;
- di->world_rect.ymin= di->screen_rect.ymin;
- di->world_rect.xmax= di->screen_rect.xmax;
- di->world_rect.ymax= di->screen_rect.ymax;
- }
-
- sc_w= (di->screen_rect.xmax-di->screen_rect.xmin);
- sc_h= (di->screen_rect.ymax-di->screen_rect.ymin);
- wo_w= (di->world_rect.xmax-di->world_rect.xmin);
- wo_h= (di->world_rect.ymax-di->world_rect.ymin);
-
- di->wo_to_sc[0]= sc_w/wo_w;
- di->wo_to_sc[1]= sc_h/wo_h;
-
- glaDefine2DArea(&di->screen_rect);
-
- return di;
-}
-
-void gla2DDrawTranslatePt(gla2DDrawInfo *di, float wo_x, float wo_y, int *sc_x_r, int *sc_y_r)
-{
- *sc_x_r= (wo_x - di->world_rect.xmin)*di->wo_to_sc[0];
- *sc_y_r= (wo_y - di->world_rect.ymin)*di->wo_to_sc[1];
-}
-void gla2DDrawTranslatePtv(gla2DDrawInfo *di, float world[2], int screen_r[2])
-{
- screen_r[0]= (world[0] - di->world_rect.xmin)*di->wo_to_sc[0];
- screen_r[1]= (world[1] - di->world_rect.ymin)*di->wo_to_sc[1];
-}
-
-void glaEnd2DDraw(gla2DDrawInfo *di)
-{
- glViewport(di->orig_vp[0], di->orig_vp[1], di->orig_vp[2], di->orig_vp[3]);
- glScissor(di->orig_vp[0], di->orig_vp[1], di->orig_vp[2], di->orig_vp[3]);
- glMatrixMode(GL_PROJECTION);
- glLoadMatrixf(di->orig_projmat);
- glMatrixMode(GL_MODELVIEW);
- glLoadMatrixf(di->orig_viewmat);
-
- MEM_freeN(di);
-}
-
-/* **************** glPoint hack ************************ */
-
-static int curmode=0;
-static int pointhack=0;
-static GLubyte Squaredot[16] = { 0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff};
-
-void bglBegin(int mode)
-{
- curmode= mode;
-
- if(mode==GL_POINTS) {
- float value[4];
- glGetFloatv(GL_POINT_SIZE_RANGE, value);
- if(value[1]<2.0) {
- glGetFloatv(GL_POINT_SIZE, value);
- pointhack= floor(value[0]+0.5);
- if(pointhack>4) pointhack= 4;
- }
- else glBegin(mode);
- }
-}
-
-
-void bglVertex3fv(float *vec)
-{
- switch(curmode) {
- case GL_POINTS:
- if(pointhack) {
- glRasterPos3fv(vec);
- glBitmap(pointhack, pointhack, (float)pointhack/2.0, (float)pointhack/2.0, 0.0, 0.0, Squaredot);
- }
- else glVertex3fv(vec);
- break;
- }
-}
-
-void bglVertex3f(float x, float y, float z)
-{
- switch(curmode) {
- case GL_POINTS:
- if(pointhack) {
- glRasterPos3f(x, y, z);
- glBitmap(pointhack, pointhack, (float)pointhack/2.0, (float)pointhack/2.0, 0.0, 0.0, Squaredot);
- }
- else glVertex3f(x, y, z);
- break;
- }
-}
-
-void bglVertex2fv(float *vec)
-{
- switch(curmode) {
- case GL_POINTS:
- if(pointhack) {
- glRasterPos2fv(vec);
- glBitmap(pointhack, pointhack, (float)pointhack/2, pointhack/2, 0.0, 0.0, Squaredot);
- }
- else glVertex2fv(vec);
- break;
- }
-}
-
-
-void bglEnd(void)
-{
- if(pointhack) pointhack= 0;
- else glEnd();
-
-}
-
-/* Uses current OpenGL state to get view matrices for gluProject/gluUnProject */
-void bgl_get_mats(bglMats *mats)
-{
- const double badvalue= 1.0e-6;
-
- glGetDoublev(GL_MODELVIEW_MATRIX, mats->modelview);
- glGetDoublev(GL_PROJECTION_MATRIX, mats->projection);
- glGetIntegerv(GL_VIEWPORT, (GLint *)mats->viewport);
-
- /* Very strange code here - it seems that certain bad values in the
- modelview matrix can cause gluUnProject to give bad results. */
- if(mats->modelview[0] < badvalue &&
- mats->modelview[0] > -badvalue)
- mats->modelview[0]= 0;
- if(mats->modelview[5] < badvalue &&
- mats->modelview[5] > -badvalue)
- mats->modelview[5]= 0;
-
- /* Set up viewport so that gluUnProject will give correct values */
- mats->viewport[0] = 0;
- mats->viewport[1] = 0;
-}
-
-/* *************** glPolygonOffset hack ************* */
-
-// both temporal, so here for now (ton)
-#include "BKE_global.h"
-#include "DNA_view3d_types.h"
-
-/* dist is only for ortho now... */
-void bglPolygonOffset(float dist)
-{
- static float winmat[16], offset=0.0;
-
- if(dist!=0.0) {
- float offs;
-
- // glEnable(GL_POLYGON_OFFSET_FILL);
- // glPolygonOffset(-1.0, -1.0);
-
- /* hack below is to mimic polygon offset */
- glMatrixMode(GL_PROJECTION);
- glGetFloatv(GL_PROJECTION_MATRIX, (float *)winmat);
-
- /* dist is from camera to center point */
-
- if(winmat[15]>0.5) offs= 0.00001*dist*G.vd->dist; // ortho tweaking
- else offs= 0.0005*dist; // should be clipping value or so...
-
- winmat[14]-= offs;
- offset+= offs;
-
- glLoadMatrixf(winmat);
- glMatrixMode(GL_MODELVIEW);
- }
- else {
-
- glMatrixMode(GL_PROJECTION);
- winmat[14]+= offset;
- offset= 0.0;
- glLoadMatrixf(winmat);
- glMatrixMode(GL_MODELVIEW);
- }
-}
-
-int is_a_really_crappy_intel_card(void)
-{
- static int well_is_it= -1;
-
- /* Do you understand the implication? Do you? */
- if (well_is_it==-1)
- well_is_it= (strcmp((char*) glGetString(GL_VENDOR), "Intel Inc.") == 0);
-
- return well_is_it;
-}
-
-void bglFlush(void)
-{
- glFlush();
-#ifdef __APPLE__
- if(is_a_really_crappy_intel_card())
- myswapbuffers(); //hack to get mac intel graphics to show frontbuffer
-#endif
-}
-
-
diff --git a/source/blender/src/hddaudio.c b/source/blender/src/hddaudio.c
deleted file mode 100644
index b655671a051..00000000000
--- a/source/blender/src/hddaudio.c
+++ /dev/null
@@ -1,577 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Contributor(s): Peter Schlaile <peter [at] schlaile [dot] de> 2005
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <string.h>
-#include <fcntl.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef WITH_FFMPEG
-#include <ffmpeg/avformat.h>
-#include <ffmpeg/avcodec.h>
-#include <ffmpeg/rational.h>
-#if LIBAVFORMAT_VERSION_INT < (49 << 16)
-#define FFMPEG_OLD_FRAME_RATE 1
-#else
-#define FFMPEG_CODEC_IS_POINTER 1
-#endif
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "BIF_editsound.h"
-
-#include "blendef.h"
-
-#ifdef WITH_FFMPEG
-extern void do_init_ffmpeg();
-#endif
-
-struct hdaudio {
- int sample_rate;
- int channels;
- int audioStream;
-
-#ifdef WITH_FFMPEG
- char * filename;
- AVCodec *pCodec;
- AVFormatContext *pFormatCtx;
- AVCodecContext *pCodecCtx;
- int frame_position;
- int frame_duration;
- int frame_alloc_duration;
- int decode_pos;
- int frame_size;
- short * decode_cache;
- short * decode_cache_zero;
- short * resample_cache;
- int decode_cache_size;
- int target_channels;
- int target_rate;
- int resample_samples_written;
- int resample_samples_in;
- ReSampleContext *resampler;
-#else
-
-
-#endif
-};
-
-#ifdef WITH_FFMPEG
-#ifdef FFMPEG_CODEC_IS_POINTER
-static AVCodecContext* get_codec_from_stream(AVStream* stream)
-{
- return stream->codec;
-}
-#else
-static AVCodecContext* get_codec_from_stream(AVStream* stream)
-{
- return &stream->codec;
-}
-#endif
-#endif
-
-struct hdaudio * sound_open_hdaudio(char * filename)
-{
-#ifdef WITH_FFMPEG
- struct hdaudio * rval;
- int i, audioStream;
-
- AVCodec *pCodec;
- AVFormatContext *pFormatCtx;
- AVCodecContext *pCodecCtx;
-
- do_init_ffmpeg();
-
- if(av_open_input_file(&pFormatCtx, filename, NULL, 0, NULL)!=0) {
- return 0;
- }
-
- if(av_find_stream_info(pFormatCtx)<0) {
- av_close_input_file(pFormatCtx);
- return 0;
- }
-
- dump_format(pFormatCtx, 0, filename, 0);
-
-
- /* Find the first audio stream */
- audioStream=-1;
- for(i=0; i<pFormatCtx->nb_streams; i++)
- if(get_codec_from_stream(pFormatCtx->streams[i])
- ->codec_type == CODEC_TYPE_AUDIO)
- {
- audioStream=i;
- break;
- }
-
- if(audioStream == -1) {
- av_close_input_file(pFormatCtx);
- return 0;
- }
-
- pCodecCtx = get_codec_from_stream(pFormatCtx->streams[audioStream]);
-
- /* Find the decoder for the audio stream */
- pCodec = avcodec_find_decoder(pCodecCtx->codec_id);
- if(pCodec == NULL) {
- av_close_input_file(pFormatCtx);
- return 0;
- }
-
- if(avcodec_open(pCodecCtx, pCodec)<0) {
- av_close_input_file(pFormatCtx);
- return 0;
- }
-
- rval = (struct hdaudio *)MEM_mallocN(sizeof(struct hdaudio),
- "hdaudio struct");
-
- rval->filename = strdup(filename);
- rval->sample_rate = pCodecCtx->sample_rate;
- rval->channels = pCodecCtx->channels;
-
- rval->pFormatCtx = pFormatCtx;
- rval->pCodecCtx = pCodecCtx;
- rval->pCodec = pCodec;
- rval->audioStream = audioStream;
- rval->frame_position = -10;
-
- rval->frame_duration = AV_TIME_BASE / 10;
- rval->frame_alloc_duration = AV_TIME_BASE;
- rval->decode_cache_size =
- (long long) rval->sample_rate * rval->channels
- * rval->frame_alloc_duration / AV_TIME_BASE
- * 2;
-
- rval->decode_cache = (short*) MEM_mallocN(
- rval->decode_cache_size * sizeof(short)
- + AVCODEC_MAX_AUDIO_FRAME_SIZE,
- "hdaudio decode cache");
- rval->decode_cache_zero = rval->decode_cache;
- rval->decode_pos = 0;
- rval->target_channels = -1;
- rval->target_rate = -1;
- rval->resampler = 0;
- rval->resample_cache = 0;
- rval->resample_samples_written = 0;
- rval->resample_samples_in = 0;
- return rval;
-#else
- return 0;
-#endif
-}
-
-struct hdaudio * sound_copy_hdaudio(struct hdaudio * c)
-{
-#ifdef WITH_FFMPEG
- return sound_open_hdaudio(c->filename);
-#else
- return 0;
-#endif
-}
-
-long sound_hdaudio_get_duration(struct hdaudio * hdaudio, double frame_rate)
-{
-#ifdef WITH_FFMPEG
- return hdaudio->pFormatCtx->duration * frame_rate / AV_TIME_BASE;
-#else
- return 0;
-#endif
-}
-
-#ifdef WITH_FFMPEG
-static void sound_hdaudio_extract_small_block(
- struct hdaudio * hdaudio,
- short * target_buffer,
- int sample_position /* units of target_rate */,
- int target_rate,
- int target_channels,
- int nb_samples /* in target */)
-{
- AVPacket packet;
- int frame_position;
- int frame_size = (long long) target_rate
- * hdaudio->frame_duration / AV_TIME_BASE;
- int in_frame_size = (long long) hdaudio->sample_rate
- * hdaudio->frame_duration / AV_TIME_BASE;
- int rate_conversion =
- (target_rate != hdaudio->sample_rate)
- || (target_channels != hdaudio->channels);
- int sample_ofs = target_channels * (sample_position % frame_size);
-
- frame_position = sample_position / frame_size;
-
- if (hdaudio == 0) return;
-
- if (rate_conversion) {
- if (hdaudio->resampler &&
- (hdaudio->target_rate != target_rate
- || hdaudio->target_channels != target_channels)) {
- audio_resample_close(hdaudio->resampler);
- hdaudio->resampler = 0;
- }
- if (!hdaudio->resampler) {
- hdaudio->resampler = audio_resample_init(
- target_channels, hdaudio->channels,
- target_rate, hdaudio->sample_rate);
- hdaudio->target_rate = target_rate;
- hdaudio->target_channels = target_channels;
- if (hdaudio->resample_cache) {
- MEM_freeN(hdaudio->resample_cache);
- }
-
-
- hdaudio->resample_cache = (short*) MEM_mallocN(
- (long long)
- hdaudio->target_channels
- * frame_size * 2
- * sizeof(short),
- "hdaudio resample cache");
- if (frame_position == hdaudio->frame_position) {
- hdaudio->resample_samples_in =
- in_frame_size * 7 / 4;
- hdaudio->resample_samples_written
- = audio_resample(
- hdaudio->resampler,
- hdaudio->resample_cache,
- hdaudio->decode_cache_zero,
- in_frame_size * 7 / 4);
- }
- }
- }
-
- if (frame_position == hdaudio->frame_position + 1
- && in_frame_size * hdaudio->channels <= hdaudio->decode_pos) {
- int bl_size = in_frame_size * hdaudio->channels;
- int decode_pos = hdaudio->decode_pos;
-
- hdaudio->frame_position = frame_position;
-
- memmove(hdaudio->decode_cache,
- hdaudio->decode_cache + bl_size,
- (decode_pos - bl_size) * sizeof(short));
-
- decode_pos -= bl_size;
-
- memset(hdaudio->decode_cache + decode_pos, 0,
- (hdaudio->decode_cache_size - decode_pos)
- * sizeof(short));
-
-
- while(av_read_frame(hdaudio->pFormatCtx, &packet) >= 0) {
- int data_size;
- int len;
- uint8_t *audio_pkt_data;
- int audio_pkt_size;
-
- if(packet.stream_index != hdaudio->audioStream) {
- av_free_packet(&packet);
- continue;
- }
-
- audio_pkt_data = packet.data;
- audio_pkt_size = packet.size;
-
- while (audio_pkt_size > 0) {
- len = avcodec_decode_audio(
- hdaudio->pCodecCtx,
- hdaudio->decode_cache
- + decode_pos,
- &data_size,
- audio_pkt_data,
- audio_pkt_size);
- if (len <= 0) {
- audio_pkt_size = 0;
- break;
- }
-
- audio_pkt_size -= len;
- audio_pkt_data += len;
-
- if (data_size <= 0) {
- continue;
- }
-
- decode_pos += data_size / sizeof(short);
- if (decode_pos + data_size
- / sizeof(short)
- > hdaudio->decode_cache_size) {
- break;
- }
- }
- av_free_packet(&packet);
-
- if (decode_pos + data_size / sizeof(short)
- > hdaudio->decode_cache_size) {
- break;
- }
- }
-
- if (rate_conversion) {
- int written = hdaudio->resample_samples_written
- * target_channels;
- int ofs = target_channels * frame_size;
- int recycle = written - ofs;
- int next_in = in_frame_size
- + (3.0/4.0
- - (double) recycle / (double)
- (frame_size * target_channels)
- ) * in_frame_size;
-
- memmove(hdaudio->resample_cache,
- hdaudio->resample_cache + ofs,
- recycle * sizeof(short));
-
- hdaudio->resample_samples_written
- = audio_resample(
- hdaudio->resampler,
- hdaudio->resample_cache + recycle,
- hdaudio->decode_cache_zero
- + hdaudio->resample_samples_in
- * hdaudio->channels
- - bl_size,
- next_in)
- + recycle / target_channels;
-
- hdaudio->resample_samples_in = next_in;
- }
-
- hdaudio->decode_pos = decode_pos;
- }
-
- if (frame_position != hdaudio->frame_position) {
- long decode_pos = 0;
- long long st_time = hdaudio->pFormatCtx
- ->streams[hdaudio->audioStream]->start_time;
- double time_base =
- av_q2d(hdaudio->pFormatCtx
- ->streams[hdaudio->audioStream]->time_base);
- long long pos = (long long) frame_position * AV_TIME_BASE
- * hdaudio->frame_duration / AV_TIME_BASE;
-
- long long seek_pos;
-
- hdaudio->frame_position = frame_position;
-
- if (st_time == AV_NOPTS_VALUE) {
- st_time = 0;
- }
-
- pos += st_time * AV_TIME_BASE * time_base;
-
- /* seek a little bit before the target position,
- (ffmpeg seek algorithm doesn't seem to work always as
- specified...)
- */
-
- seek_pos = pos - (AV_TIME_BASE
- * hdaudio->frame_duration
- / AV_TIME_BASE / 10);
- if (seek_pos < 0) {
- seek_pos = pos;
- }
-
- av_seek_frame(hdaudio->pFormatCtx, -1,
- seek_pos,
- AVSEEK_FLAG_ANY | AVSEEK_FLAG_BACKWARD);
- avcodec_flush_buffers(hdaudio->pCodecCtx);
-
- memset(hdaudio->decode_cache, 0,
- hdaudio->decode_cache_size * sizeof(short));
-
- hdaudio->decode_cache_zero = hdaudio->decode_cache;
-
- while(av_read_frame(hdaudio->pFormatCtx, &packet) >= 0) {
- int data_size;
- int len;
- uint8_t *audio_pkt_data;
- int audio_pkt_size;
-
- if(packet.stream_index != hdaudio->audioStream) {
- av_free_packet(&packet);
- continue;
- }
-
- audio_pkt_data = packet.data;
- audio_pkt_size = packet.size;
-
- if (!hdaudio->decode_cache_zero
- && audio_pkt_size > 0) {
- long long diff;
-
- if (packet.pts == AV_NOPTS_VALUE) {
- fprintf(stderr,
- "hdaudio: audio "
- "pts=NULL audio "
- "distortion!\n");
- diff = 0;
- } else {
- long long pts = packet.pts;
- long long spts = (long long) (
- pos / time_base / AV_TIME_BASE
- + 0.5);
- diff = spts - pts;
- if (diff < 0) {
- fprintf(stderr,
- "hdaudio: "
- "negative seek: "
- "%lld < %lld "
- "(pos=%lld) "
- "audio distortion!!\n",
- spts, pts, pos);
- diff = 0;
- }
- }
-
-
- diff *= hdaudio->sample_rate * time_base;
- diff *= hdaudio->channels;
-
- if (diff > hdaudio->decode_cache_size / 2) {
- fprintf(stderr,
- "hdaudio: audio "
- "diff too large!!\n");
- diff = 0;
- }
-
- hdaudio->decode_cache_zero
- = hdaudio->decode_cache + diff;
- }
-
- while (audio_pkt_size > 0) {
- len = avcodec_decode_audio(
- hdaudio->pCodecCtx,
- hdaudio->decode_cache
- + decode_pos,
- &data_size,
- audio_pkt_data,
- audio_pkt_size);
- if (len <= 0) {
- audio_pkt_size = 0;
- break;
- }
-
- audio_pkt_size -= len;
- audio_pkt_data += len;
-
- if (data_size <= 0) {
- continue;
- }
-
- decode_pos += data_size / sizeof(short);
- if (decode_pos + data_size
- / sizeof(short)
- > hdaudio->decode_cache_size) {
- break;
- }
- }
-
- av_free_packet(&packet);
-
- if (decode_pos + data_size / sizeof(short)
- > hdaudio->decode_cache_size) {
- break;
- }
- }
- if (rate_conversion) {
- hdaudio->resample_samples_written
- = audio_resample(hdaudio->resampler,
- hdaudio->resample_cache,
- hdaudio->decode_cache_zero,
- in_frame_size * 7 / 4);
- hdaudio->resample_samples_in =
- in_frame_size * 7 / 4;
- }
- hdaudio->decode_pos = decode_pos;
- }
-
- memcpy(target_buffer, (rate_conversion
- ? hdaudio->resample_cache
- : hdaudio->decode_cache_zero) + sample_ofs,
- nb_samples * target_channels * sizeof(short));
-}
-#endif
-
-
-void sound_hdaudio_extract(struct hdaudio * hdaudio,
- short * target_buffer,
- int sample_position /* units of target_rate */,
- int target_rate,
- int target_channels,
- int nb_samples /* in target */)
-{
-#ifdef WITH_FFMPEG
- long long max_samples = (long long) target_rate
- * hdaudio->frame_duration / AV_TIME_BASE / 4;
-
- while (nb_samples > max_samples) {
- sound_hdaudio_extract_small_block(hdaudio, target_buffer,
- sample_position,
- target_rate,
- target_channels,
- max_samples);
- target_buffer += max_samples * target_channels;
- sample_position += max_samples;
- nb_samples -= max_samples;
- }
- if (nb_samples > 0) {
- sound_hdaudio_extract_small_block(hdaudio, target_buffer,
- sample_position,
- target_rate,
- target_channels,
- nb_samples);
- }
-#else
-
-#endif
-}
-
-void sound_close_hdaudio(struct hdaudio * hdaudio)
-{
-#ifdef WITH_FFMPEG
-
- if (hdaudio) {
- avcodec_close(hdaudio->pCodecCtx);
- av_close_input_file(hdaudio->pFormatCtx);
- MEM_freeN (hdaudio->decode_cache);
- if (hdaudio->resample_cache) {
- MEM_freeN(hdaudio->resample_cache);
- }
- free(hdaudio->filename);
- MEM_freeN (hdaudio);
- }
-#else
-
-#endif
-}
-
diff --git a/source/blender/src/header_action.c b/source/blender/src/header_action.c
deleted file mode 100644
index 9e858cb8307..00000000000
--- a/source/blender/src/header_action.c
+++ /dev/null
@@ -1,1285 +0,0 @@
-/**
- * header_action.c oct-2003
- *
- * Functions to draw the "Action Editor" window header
- * and handle user events sent to it.
- *
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): 2007, Joshua Leung (Action Editor recode)
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "DNA_action_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_ID.h"
-#include "DNA_ipo_types.h"
-#include "DNA_key_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-
-#include "BIF_editaction.h"
-#include "BIF_interface.h"
-#include "BIF_poseobject.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-
-#include "BKE_action.h"
-#include "BKE_armature.h"
-#include "BKE_constraint.h"
-#include "BKE_depsgraph.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_utildefines.h"
-
-#include "BDR_drawaction.h"
-#include "BSE_drawipo.h"
-#include "BSE_headerbuttons.h"
-#include "BSE_time.h"
-
-#include "nla.h"
-
-#include "blendef.h"
-#include "mydevice.h"
-
-/* enums declaring constants that are used as menu event codes */
-
-enum {
- ACTMENU_VIEW_CENTERVIEW= 0,
- ACTMENU_VIEW_AUTOUPDATE,
- ACTMENU_VIEW_PLAY3D,
- ACTMENU_VIEW_PLAYALL,
- ACTMENU_VIEW_ALL,
- ACTMENU_VIEW_MAXIMIZE,
- ACTMENU_VIEW_LOCK,
- ACTMENU_VIEW_SLIDERS,
- ACTMENU_VIEW_NEXTMARKER,
- ACTMENU_VIEW_PREVMARKER,
- ACTMENU_VIEW_TIME,
- ACTMENU_VIEW_NOHIDE
-};
-
-enum {
- ACTMENU_SEL_BORDER = 0,
- ACTMENU_SEL_BORDERM,
- ACTMENU_SEL_ALL_KEYS,
- ACTMENU_SEL_ALL_CHAN,
- ACTMENU_SEL_ALL_MARKERS,
- ACTMENU_SEL_INVERSE_KEYS,
- ACTMENU_SEL_INVERSE_MARKERS,
- ACTMENU_SEL_LEFTKEYS,
- ACTMENU_SEL_RIGHTKEYS
-};
-
-enum {
- ACTMENU_SEL_COLUMN_KEYS = 1,
- ACTMENU_SEL_COLUMN_MARKERSCOLUMN,
- ACTMENU_SEL_COLUMN_MARKERSBETWEEN
-};
-
-enum {
- ACTMENU_KEY_DUPLICATE = 0,
- ACTMENU_KEY_DELETE,
- ACTMENU_KEY_CLEAN
-};
-
-enum {
- ACTMENU_KEY_CHANPOS_MOVE_CHANNEL_UP = 0,
- ACTMENU_KEY_CHANPOS_MOVE_CHANNEL_DOWN,
- ACTMENU_KEY_CHANPOS_MOVE_CHANNEL_TOP,
- ACTMENU_KEY_CHANPOS_MOVE_CHANNEL_BOTTOM
-};
-
-enum {
- ACTMENU_KEY_TRANSFORM_MOVE = 0,
- ACTMENU_KEY_TRANSFORM_SCALE,
- ACTMENU_KEY_TRANSFORM_SLIDE,
- ACTMENU_KEY_TRANSFORM_EXTEND
-};
-
-enum {
- ACTMENU_KEY_HANDLE_AUTO = 0,
- ACTMENU_KEY_HANDLE_ALIGN,
- ACTMENU_KEY_HANDLE_FREE,
- ACTMENU_KEY_HANDLE_VECTOR
-};
-
-enum {
- ACTMENU_KEY_INTERP_CONST = 0,
- ACTMENU_KEY_INTERP_LINEAR,
- ACTMENU_KEY_INTERP_BEZIER
-};
-
-enum {
- ACTMENU_KEY_EXTEND_CONST = 0,
- ACTMENU_KEY_EXTEND_EXTRAPOLATION,
- ACTMENU_KEY_EXTEND_CYCLIC,
- ACTMENU_KEY_EXTEND_CYCLICEXTRAPOLATION
-};
-
-enum {
- ACTMENU_KEY_SNAP_NEARFRAME = 1,
- ACTMENU_KEY_SNAP_CURFRAME,
- ACTMENU_KEY_SNAP_NEARMARK,
- ACTMENU_KEY_SNAP_NEARTIME,
- ACTMENU_KEY_SNAP_CFRA2KEY,
-};
-
-enum {
- ACTMENU_KEY_MIRROR_CURFRAME = 1,
- ACTMENU_KEY_MIRROR_YAXIS,
- ACTMENU_KEY_MIRROR_XAXIS,
- ACTMENU_KEY_MIRROR_MARKER
-};
-
-enum {
- ACTMENU_MARKERS_ADD = 0,
- ACTMENU_MARKERS_DUPLICATE,
- ACTMENU_MARKERS_DELETE,
- ACTMENU_MARKERS_NAME,
- ACTMENU_MARKERS_MOVE
-};
-
-void do_action_buttons(unsigned short event)
-{
- Object *ob= OBACT;
-
- switch(event) {
- case B_ACTHOME: /* HOMEKEY in Action Editor */
- /* Find X extents */
- G.v2d->cur.xmin = 0;
- G.v2d->cur.ymin=-SCROLLB;
-
- if (G.saction->action) {
- float extra;
-
- calc_action_range(G.saction->action, &G.v2d->cur.xmin, &G.v2d->cur.xmax, 0);
- if (G.saction->pin==0 && ob) {
- G.v2d->cur.xmin= get_action_frame_inv(ob, G.v2d->cur.xmin);
- G.v2d->cur.xmax= get_action_frame_inv(ob, G.v2d->cur.xmax);
- }
- extra= 0.05*(G.v2d->cur.xmax - G.v2d->cur.xmin);
- G.v2d->cur.xmin-= extra;
- G.v2d->cur.xmax+= extra;
-
- if (G.v2d->cur.xmin==G.v2d->cur.xmax) {
- G.v2d->cur.xmax= -5;
- G.v2d->cur.xmax= 100;
- }
- }
- else { /* shapekeys and/or no action */
- G.v2d->cur.xmin= -5.0;
- G.v2d->cur.xmax= 65.0;
- }
-
- G.v2d->cur.ymin= -75.0;
- G.v2d->cur.ymax= 5.0;
-
- G.v2d->tot= G.v2d->cur;
- test_view2d(G.v2d, curarea->winx, curarea->winy);
- view2d_do_locks(curarea, V2D_LOCK_COPY);
-
- addqueue (curarea->win, REDRAW, 1);
-
- break;
-
- /* copy/paste/paste-flip buttons in 3d-view header in PoseMode */
- case B_ACTCOPY:
- copy_posebuf();
- allqueue(REDRAWVIEW3D, 1);
- break;
- case B_ACTPASTE:
- paste_posebuf(0);
- allqueue(REDRAWVIEW3D, 1);
- break;
- case B_ACTPASTEFLIP:
- paste_posebuf(1);
- allqueue(REDRAWVIEW3D, 1);
- break;
-
- /* copy/paste buttons in Action Editor header */
- case B_ACTCOPYKEYS:
- copy_actdata();
- break;
- case B_ACTPASTEKEYS:
- paste_actdata();
- break;
-
- case B_ACTPIN: /* __PINFAKE */
-/* if (G.saction->flag & SACTION_PIN) {
- if (G.saction->action)
- G.saction->action->id.us ++;
- }
- else {
- if (G.saction->action)
- G.saction->action->id.us --;
- }
-*/ /* end PINFAKE */
- allqueue(REDRAWACTION, 1);
- break;
- }
-}
-
-static void do_action_viewmenu(void *arg, int event)
-{
- extern int play_anim(int mode);
-
- switch(event) {
- case ACTMENU_VIEW_CENTERVIEW: /* Center View to Current Frame */
- center_currframe();
- break;
- case ACTMENU_VIEW_AUTOUPDATE: /* Update Automatically */
- if (BTST(G.saction->lock, 0))
- G.saction->lock = BCLR(G.saction->lock, 0);
- else
- G.saction->lock = BSET(G.saction->lock, 0);
- break;
- case ACTMENU_VIEW_PLAY3D: /* Play Back Animation */
- play_anim(0);
- break;
- case ACTMENU_VIEW_PLAYALL: /* Play Back Animation in All */
- play_anim(1);
- break;
- case ACTMENU_VIEW_ALL: /* View All */
- do_action_buttons(B_ACTHOME);
- break;
- case ACTMENU_VIEW_LOCK:
- G.v2d->flag ^= V2D_VIEWLOCK;
- if(G.v2d->flag & V2D_VIEWLOCK)
- view2d_do_locks(curarea, 0);
- break;
- case ACTMENU_VIEW_SLIDERS: /* Show sliders (when applicable) */
- G.saction->flag ^= SACTION_SLIDERS;
- break;
- case ACTMENU_VIEW_MAXIMIZE: /* Maximize Window */
- /* using event B_FULL */
- break;
- case ACTMENU_VIEW_NEXTMARKER: /* jump to next marker */
- nextprev_marker(1);
- break;
- case ACTMENU_VIEW_PREVMARKER: /* jump to previous marker */
- nextprev_marker(-1);
- break;
- case ACTMENU_VIEW_TIME: /* switch between frames and seconds display */
- G.saction->flag ^= SACTION_DRAWTIME;
- break;
- case ACTMENU_VIEW_NOHIDE: /* Show hidden channels */
- G.saction->flag ^= SACTION_NOHIDE;
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *action_viewmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "action_viewmenu",
- UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_action_viewmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Center View to Current Frame|C", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1,
- ACTMENU_VIEW_CENTERVIEW, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6,
- menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- if (G.saction->flag & SACTION_DRAWTIME) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Show Frames|Ctrl T", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1,
- ACTMENU_VIEW_TIME, "");
- }
- else {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Show Seconds|Ctrl T", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1,
- ACTMENU_VIEW_TIME, "");
- }
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, (G.saction->flag & SACTION_SLIDERS)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT,
- "Show Sliders|", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1,
- ACTMENU_VIEW_SLIDERS, "");
-
- uiDefIconTextBut(block, BUTM, 1, (G.saction->flag & SACTION_NOHIDE)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT,
- "Show Hidden Channels|", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1,
- ACTMENU_VIEW_NOHIDE, "");
-
- uiDefIconTextBut(block, BUTM, 1, (G.v2d->flag & V2D_VIEWLOCK)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT,
- "Lock Time to Other Windows|", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1,
- ACTMENU_VIEW_LOCK, "");
-
- uiDefIconTextBut(block, BUTM, 1, BTST(G.saction->lock, 0)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT,
- "Update Automatically|", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1,
- ACTMENU_VIEW_AUTOUPDATE, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6,
- menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Jump To Next Marker|PageUp", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0, ACTMENU_VIEW_NEXTMARKER, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Jump To Prev Marker|PageDown", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0, ACTMENU_VIEW_PREVMARKER, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6,
- menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Play Back Animation|Alt A", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1,
- ACTMENU_VIEW_PLAY3D, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Play Back Animation in 3D View|Alt Shift A", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1,
- ACTMENU_VIEW_PLAYALL, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6,
- menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "View All|Home", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1,
- ACTMENU_VIEW_ALL, "");
-
- if (!curarea->full)
- uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1,
- "Maximize Window|Ctrl UpArrow", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_VIEW_MAXIMIZE, "");
- else
- uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1,
- "Tile Window|Ctrl DownArrow", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_VIEW_MAXIMIZE, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-static void do_action_selectmenu_columnmenu(void *arg, int event)
-{
- SpaceAction *saction;
- bAction *act;
- Key *key;
-
- saction = curarea->spacedata.first;
- if (!saction) return;
-
- act = saction->action;
- key = get_action_mesh_key();
-
-#if 0 // actionrewite
- if (event == ACTMENU_SEL_COLUMN_MARKERSBETWEEN) {
- markers_selectkeys_between();
- }
- else if (ELEM(event, ACTMENU_SEL_COLUMN_KEYS, ACTMENU_SEL_COLUMN_MARKERSCOLUMN)) {
- if (act)
- column_select_actionkeys(act, event);
- else if (key)
- column_select_shapekeys(key, event);
- }
- else
- return;
-#endif // actionrewite
-
- allqueue(REDRAWTIME, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWSOUND, 0);
-}
-
-static uiBlock *action_selectmenu_columnmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "action_selectmenu_columnmenu",
- UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_action_selectmenu_columnmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "On Selected Keys|K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_SEL_COLUMN_KEYS, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "On Selected Markers|Shift K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_SEL_COLUMN_MARKERSCOLUMN, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Between Selected Markers|Ctrl K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_SEL_COLUMN_MARKERSBETWEEN, "");
-
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-
-static void do_action_selectmenu(void *arg, int event)
-{
- SpaceAction *saction;
- bAction *act;
- Key *key;
-
- saction = curarea->spacedata.first;
- if (!saction) return;
-
- act = saction->action;
- key = get_action_mesh_key();
-
- switch(event)
- {
- case ACTMENU_SEL_BORDER: /* Border Select */
- borderselect_action();
- break;
-
- case ACTMENU_SEL_BORDERM: /* Border Select */
- borderselect_markers();
- break;
-
- case ACTMENU_SEL_ALL_KEYS: /* Select/Deselect All Keys */
- deselect_action_keys(1, 1);
- allqueue (REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- allqueue (REDRAWIPO, 0);
- break;
-
- case ACTMENU_SEL_ALL_CHAN: /* Select/Deselect All Channels */
- deselect_action_channels(1);
- allqueue (REDRAWVIEW3D, 0);
- allqueue (REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- allqueue (REDRAWIPO, 0);
- break;
-
- case ACTMENU_SEL_ALL_MARKERS: /* select/deselect all markers */
- deselect_markers(1, 0);
- allqueue(REDRAWMARKER, 0);
- break;
-
- case ACTMENU_SEL_INVERSE_KEYS: /* invert selection status of keys */
- deselect_action_keys(0, 2);
- allqueue (REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- allqueue (REDRAWIPO, 0);
- break;
-
- case ACTMENU_SEL_INVERSE_MARKERS: /* invert selection of markers */
- deselect_markers(0, 2);
- allqueue(REDRAWMARKER, 0);
- break;
-
- case ACTMENU_SEL_LEFTKEYS:
- selectkeys_leftright(1, SELECT_REPLACE);
- break;
-
- case ACTMENU_SEL_RIGHTKEYS:
- selectkeys_leftright(0, SELECT_REPLACE);
- break;
- }
-}
-
-static uiBlock *action_selectmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "action_selectmenu",
- UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_action_selectmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Border Select Keys|B", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_SEL_BORDER, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Border Select Markers|Ctrl B", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_SEL_BORDERM, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6,
- menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Select/Deselect All Keys|A", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_SEL_ALL_KEYS, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Select/Deselect All Markers|Ctrl A", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_SEL_ALL_MARKERS, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Select/Deselect All Channels", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_SEL_ALL_CHAN, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6,
- menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Inverse Keys", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_SEL_INVERSE_KEYS, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Inverse Markers", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_SEL_INVERSE_MARKERS, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6,
- menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Back In Time|Alt RMB", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_SEL_LEFTKEYS, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Ahead In Time|Alt RMB", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_SEL_RIGHTKEYS, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6,
- menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, action_selectmenu_columnmenu,
- NULL, ICON_RIGHTARROW_THIN, "Column Select Keys", 0, yco-=20, 120, 20, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-static void do_action_keymenu_transformmenu(void *arg, int event)
-{
- switch (event)
- {
- case ACTMENU_KEY_TRANSFORM_MOVE:
- transform_action_keys('g', 0);
- break;
- case ACTMENU_KEY_TRANSFORM_SCALE:
- transform_action_keys('s', 0);
- break;
- case ACTMENU_KEY_TRANSFORM_SLIDE:
- transform_action_keys('t', 0);
- break;
- case ACTMENU_KEY_TRANSFORM_EXTEND:
- transform_action_keys('e', 0);
- break;
- }
-
- scrarea_queue_winredraw(curarea);
-}
-
-static uiBlock *action_keymenu_transformmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "action_keymenu_transformmenu",
- UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_action_keymenu_transformmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Grab/Move|G", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_KEY_TRANSFORM_MOVE, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Grab/Extend from Frame|E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_KEY_TRANSFORM_EXTEND, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Scale|S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_KEY_TRANSFORM_SCALE, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Time Slide|T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_KEY_TRANSFORM_SLIDE, "");
-
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-
-static void do_action_keymenu_handlemenu(void *arg, int event)
-{
- switch (event) {
- case ACTMENU_KEY_HANDLE_AUTO:
- sethandles_action_keys(HD_AUTO);
- break;
-
- case ACTMENU_KEY_HANDLE_ALIGN:
- case ACTMENU_KEY_HANDLE_FREE:
- /* OK, this is kinda dumb, need to fix the
- * toggle crap in sethandles_ipo_keys()
- */
- sethandles_action_keys(HD_ALIGN);
- break;
-
- case ACTMENU_KEY_HANDLE_VECTOR:
- sethandles_action_keys(HD_VECT);
- break;
- }
-}
-
-static uiBlock *action_keymenu_handlemenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "action_keymenu_handlemenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_action_keymenu_handlemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Auto|Shift H", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_KEY_HANDLE_AUTO, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Aligned|H", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_KEY_HANDLE_ALIGN, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Free|H", 0, yco-=20, menuwidth,
- 19, NULL, 0.0, 0.0, 0,
- ACTMENU_KEY_HANDLE_FREE, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Vector|V", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_KEY_HANDLE_VECTOR, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-
-static void do_action_keymenu_intpolmenu(void *arg, int event)
-{
- switch(event)
- {
- case ACTMENU_KEY_INTERP_CONST:
- action_set_ipo_flags(SET_IPO_MENU, SET_IPO_CONSTANT);
- break;
- case ACTMENU_KEY_INTERP_LINEAR:
- action_set_ipo_flags(SET_IPO_MENU, SET_IPO_LINEAR);
- break;
- case ACTMENU_KEY_INTERP_BEZIER:
- action_set_ipo_flags(SET_IPO_MENU, SET_IPO_BEZIER);
- break;
- }
-
- scrarea_queue_winredraw(curarea);
-}
-
-static uiBlock *action_keymenu_intpolmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "action_keymenu_intpolmenu",
- UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_action_keymenu_intpolmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Constant|Shift T, 1", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_KEY_INTERP_CONST, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Linear|Shift T, 2", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_KEY_INTERP_LINEAR, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Bezier|Shift T, 3", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_KEY_INTERP_BEZIER, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-
-static void do_action_keymenu_extendmenu(void *arg, int event)
-{
- switch(event)
- {
- case ACTMENU_KEY_EXTEND_CONST:
- action_set_ipo_flags(SET_EXTEND_MENU, SET_EXTEND_CONSTANT);
- break;
- case ACTMENU_KEY_EXTEND_EXTRAPOLATION:
- action_set_ipo_flags(SET_EXTEND_MENU, SET_EXTEND_EXTRAPOLATION);
- break;
- case ACTMENU_KEY_EXTEND_CYCLIC:
- action_set_ipo_flags(SET_EXTEND_MENU, SET_EXTEND_CYCLIC);
- break;
- case ACTMENU_KEY_EXTEND_CYCLICEXTRAPOLATION:
- action_set_ipo_flags(SET_EXTEND_MENU, SET_EXTEND_CYCLICEXTRAPOLATION);
- break;
- }
-
- scrarea_queue_winredraw(curarea);
-}
-
-static uiBlock *action_keymenu_extendmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "action_keymenu_extendmenu",
- UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_action_keymenu_extendmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Constant", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_KEY_EXTEND_CONST, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Extrapolation", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_KEY_EXTEND_EXTRAPOLATION, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Cyclic", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_KEY_EXTEND_CYCLIC, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Cyclic Extrapolation", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_KEY_EXTEND_CYCLICEXTRAPOLATION, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-
-static void do_action_keymenu_chanposmenu(void *arg, int event)
-{
- switch(event)
- {
- case ACTMENU_KEY_CHANPOS_MOVE_CHANNEL_DOWN:
- down_sel_action();
- break;
- case ACTMENU_KEY_CHANPOS_MOVE_CHANNEL_UP:
- up_sel_action();
- break;
- case ACTMENU_KEY_CHANPOS_MOVE_CHANNEL_TOP:
- top_sel_action();
- break;
- case ACTMENU_KEY_CHANPOS_MOVE_CHANNEL_BOTTOM:
- bottom_sel_action();
- break;
- }
-
- scrarea_queue_winredraw(curarea);
-}
-
-static uiBlock *action_keymenu_chanposmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "action_keymenu_chanposmenu",
- UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_action_keymenu_chanposmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Move Up|Ctrl Page Up", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_KEY_CHANPOS_MOVE_CHANNEL_UP, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Move Down|Ctrl Page Down", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_KEY_CHANPOS_MOVE_CHANNEL_DOWN, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6,
- menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Move to Top|Shift Page Up", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_KEY_CHANPOS_MOVE_CHANNEL_TOP, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Move to Bottom|Shift Page Down", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_KEY_CHANPOS_MOVE_CHANNEL_BOTTOM, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-
-static void do_action_keymenu_snapmenu(void *arg, int event)
-{
- switch(event)
- {
- case ACTMENU_KEY_SNAP_NEARFRAME:
- case ACTMENU_KEY_SNAP_CURFRAME:
- case ACTMENU_KEY_SNAP_NEARMARK:
- case ACTMENU_KEY_SNAP_NEARTIME:
- snap_action_keys(event);
- break;
-
- case ACTMENU_KEY_SNAP_CFRA2KEY:
- snap_cfra_action();
- break;
- }
-
- scrarea_queue_winredraw(curarea);
-}
-
-static uiBlock *action_keymenu_snapmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "action_keymenu_snapmenu",
- UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_action_keymenu_snapmenu, NULL);
-
- if (G.saction->flag & SACTION_DRAWTIME) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Key -> Nearest Second|Shift S, 1", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_KEY_SNAP_NEARTIME, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Key -> Current Time|Shift S, 2", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_KEY_SNAP_CURFRAME, "");
-
- }
- else {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Key -> Nearest Frame|Shift S, 1", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_KEY_SNAP_NEARFRAME, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Key -> Current Frame|Shift S, 2", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_KEY_SNAP_CURFRAME, "");
- }
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Key -> Nearest Marker|Shift S, 3", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_KEY_SNAP_NEARMARK, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6,
- menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Current Frame -> Key|Ctrl Shift S", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_KEY_SNAP_NEARMARK, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-
-static void do_action_keymenu_mirrormenu(void *arg, int event)
-{
- switch(event)
- {
- case ACTMENU_KEY_MIRROR_CURFRAME:
- case ACTMENU_KEY_MIRROR_YAXIS:
- mirror_action_keys(event);
- break;
- }
-
- scrarea_queue_winredraw(curarea);
-}
-
-static uiBlock *action_keymenu_mirrormenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "action_keymenu_mirrormenu",
- UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_action_keymenu_mirrormenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Current Frame|Shift M, 1", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_KEY_MIRROR_CURFRAME, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Vertical Axis|Shift M, 2", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_KEY_MIRROR_YAXIS, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Horizontal Axis|Shift M, 3", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_KEY_MIRROR_XAXIS, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Selected Marker|Shift M, 4", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_KEY_MIRROR_MARKER, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-
-static void do_action_keymenu(void *arg, int event)
-{
- SpaceAction *saction;
- bAction *act;
- Key *key;
-
- saction = curarea->spacedata.first;
- if (!saction) return;
-
- act = saction->action;
- key = get_action_mesh_key();
-
- switch(event)
- {
- case ACTMENU_KEY_DUPLICATE:
- duplicate_action_keys();
- break;
- case ACTMENU_KEY_DELETE:
- delete_action_keys ();
- break;
- case ACTMENU_KEY_CLEAN:
- clean_action();
- break;
- }
-}
-
-static uiBlock *action_keymenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "action_keymenu",
- UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_action_keymenu, NULL);
-
- uiDefIconTextBlockBut(block, action_keymenu_transformmenu,
- NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 20, "");
-
- uiDefIconTextBlockBut(block, action_keymenu_snapmenu,
- NULL, ICON_RIGHTARROW_THIN, "Snap", 0, yco-=20, 120, 20, "");
-
- uiDefIconTextBlockBut(block, action_keymenu_mirrormenu,
- NULL, ICON_RIGHTARROW_THIN, "Mirror", 0, yco-=20, 120, 20, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6,
- menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Duplicate|Shift D", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_KEY_DUPLICATE, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Delete|X", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_KEY_DELETE, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6,
- menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Clean Action|O", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_KEY_CLEAN, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6,
- menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, action_keymenu_handlemenu,
- NULL, ICON_RIGHTARROW_THIN,
- "Handle Type", 0, yco-=20, 120, 20, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6,
- menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, action_keymenu_extendmenu,
- NULL, ICON_RIGHTARROW_THIN,
- "Extend Mode", 0, yco-=20, 120, 20, "");
- uiDefIconTextBlockBut(block, action_keymenu_intpolmenu,
- NULL, ICON_RIGHTARROW_THIN,
- "Interpolation Mode", 0, yco-=20, 120, 20, "");
- uiDefIconTextBlockBut(block, action_keymenu_chanposmenu,
- NULL, ICON_RIGHTARROW_THIN,
- "Channel Ordering", 0, yco-=20, 120, 20, "");
-
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-static void do_action_markermenu(void *arg, int event)
-{
- switch(event)
- {
- case ACTMENU_MARKERS_ADD:
- add_marker(CFRA);
- break;
- case ACTMENU_MARKERS_DUPLICATE:
- duplicate_marker();
- break;
- case ACTMENU_MARKERS_DELETE:
- remove_marker();
- break;
- case ACTMENU_MARKERS_NAME:
- rename_marker();
- break;
- case ACTMENU_MARKERS_MOVE:
- transform_markers('g', 0);
- break;
- }
-
- allqueue(REDRAWMARKER, 0);
-}
-
-static uiBlock *action_markermenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "action_markermenu",
- UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_action_markermenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Marker|M", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, ACTMENU_MARKERS_ADD, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate Marker|Ctrl Shift D", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, ACTMENU_MARKERS_DUPLICATE, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Marker|X", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, ACTMENU_MARKERS_DELETE, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "(Re)Name Marker|Ctrl M", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, ACTMENU_MARKERS_NAME, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Grab/Move Marker|Ctrl G", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, ACTMENU_MARKERS_MOVE, "");
-
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-void action_buttons(void)
-{
- uiBlock *block;
- short xco, xmax;
- char name[256];
- Object *ob;
- ID *from;
-
- if (G.saction == NULL)
- return;
-
- /* copied from drawactionspace.... */
- if (!G.saction->pin) {
- if (OBACT)
- G.saction->action = OBACT->action;
- else
- G.saction->action= NULL;
- }
-
- sprintf(name, "header %d", curarea->headwin);
- block= uiNewBlock(&curarea->uiblocks, name,
- UI_EMBOSS, UI_HELV, curarea->headwin);
-
- if (area_is_active_area(curarea))
- uiBlockSetCol(block, TH_HEADER);
- else
- uiBlockSetCol(block, TH_HEADERDESEL);
-
- curarea->butspacetype= SPACE_ACTION;
-
- xco = 8;
-
- uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D,
- windowtype_pup(), xco, 0, XIC+10, YIC,
- &(curarea->butspacetype), 1.0, SPACEICONMAX, 0, 0,
- "Displays Current Window Type. "
- "Click for menu of available types.");
-
- xco += XIC + 14;
-
- uiBlockSetEmboss(block, UI_EMBOSSN);
- if (curarea->flag & HEADER_NO_PULLDOWN) {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, B_FLIPINFOMENU,
- ICON_DISCLOSURE_TRI_RIGHT,
- xco,2,XIC,YIC-2,
- &(curarea->flag), 0, 0, 0, 0,
- "Show pulldown menus");
- }
- else {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, B_FLIPINFOMENU,
- ICON_DISCLOSURE_TRI_DOWN,
- xco,2,XIC,YIC-2,
- &(curarea->flag), 0, 0, 0, 0,
- "Hide pulldown menus");
- }
- uiBlockSetEmboss(block, UI_EMBOSS);
- xco+=XIC;
-
- if ((curarea->flag & HEADER_NO_PULLDOWN)==0) {
- /* pull down menus */
- uiBlockSetEmboss(block, UI_EMBOSSP);
-
- xmax= GetButStringLength("View");
- uiDefPulldownBut(block, action_viewmenu, NULL,
- "View", xco, -2, xmax-3, 24, "");
- xco+= xmax;
-
- xmax= GetButStringLength("Select");
- uiDefPulldownBut(block, action_selectmenu, NULL,
- "Select", xco, -2, xmax-3, 24, "");
- xco+= xmax;
-
- xmax= GetButStringLength("Marker");
- uiDefPulldownBut(block, action_markermenu, NULL,
- "Marker", xco, -2, xmax-3, 24, "");
- xco+= xmax;
-
- xmax= GetButStringLength("Key");
- uiDefPulldownBut(block, action_keymenu, NULL,
- "Key", xco, -2, xmax-3, 24, "");
- xco+= xmax;
- }
-
- uiBlockSetEmboss(block, UI_EMBOSS);
-
- /* NAME ETC */
- ob= OBACT;
- from = (ID *)ob;
-
- xco= std_libbuttons(block, xco, 0, B_ACTPIN, &G.saction->pin,
- B_ACTIONBROWSE, ID_AC, 0, (ID*)G.saction->action,
- from, &(G.saction->actnr), B_ACTALONE,
- B_ACTLOCAL, B_ACTIONDELETE, 0, 0);
-
- uiClearButLock();
-
- /* draw AUTOSNAP */
- xco += 8;
-
- if (G.saction->flag & SACTION_DRAWTIME) {
- uiDefButS(block, MENU, B_REDR,
- "Auto-Snap Keyframes %t|Off %x0|Second Step %x1|Nearest Second %x2|Nearest Marker %x3",
- xco,0,70,YIC, &(G.saction->autosnap), 0, 1, 0, 0,
- "Auto-snapping mode for keyframes when transforming");
- }
- else {
- uiDefButS(block, MENU, B_REDR,
- "Auto-Snap Keyframes %t|Off %x0|Frame Step %x1|Nearest Frame %x2|Nearest Marker %x3",
- xco,0,70,YIC, &(G.saction->autosnap), 0, 1, 0, 0,
- "Auto-snapping mode for keyframes when transforming");
- }
-
- xco += (70 + 8);
-
- /* COPY PASTE */
- uiBlockBeginAlign(block);
- if (curarea->headertype==HEADERTOP) {
- uiDefIconBut(block, BUT, B_ACTCOPYKEYS, ICON_COPYUP, xco,0,XIC,YIC, 0, 0, 0, 0, 0, "Copies the selected keyframes from the selected channel(s) to the buffer");
- uiDefIconBut(block, BUT, B_ACTPASTEKEYS, ICON_PASTEUP, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Pastes the keyframes from the buffer");
- }
- else {
- uiDefIconBut(block, BUT, B_ACTCOPYKEYS, ICON_COPYDOWN, xco,0,XIC,YIC, 0, 0, 0, 0, 0, "Copies the selected keyframes from the selected channel(s) to the buffer");
- uiDefIconBut(block, BUT, B_ACTPASTEKEYS, ICON_PASTEDOWN, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Pastes the keyframes from the buffer");
- }
- uiBlockEndAlign(block);
- xco += (XIC + 8);
-
- /* draw LOCK */
- uiDefIconButS(block, ICONTOG, 1, ICON_UNLOCKED, xco, 0, XIC, YIC,
- &(G.saction->lock), 0, 0, 0, 0,
- "Updates other affected window spaces automatically "
- "to reflect changes in real time");
-
- /* always as last */
- curarea->headbutlen = xco + 2*XIC;
-
- uiDrawBlock(block);
-}
diff --git a/source/blender/src/header_buttonswin.c b/source/blender/src/header_buttonswin.c
deleted file mode 100644
index 07a63a46903..00000000000
--- a/source/blender/src/header_buttonswin.c
+++ /dev/null
@@ -1,729 +0,0 @@
-/**
- * header_buttonswin.c oct-2003
- *
- * Functions to draw the "Buttons Window" window header
- * and handle user events sent to it.
- *
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "DNA_ID.h"
-#include "DNA_armature_types.h"
-#include "DNA_brush_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_material_types.h"
-#include "DNA_node_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_world_types.h"
-
-#include "BIF_editconstraint.h"
-#include "BIF_interface.h"
-#include "BIF_previewrender.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_butspace.h"
-
-#include "BKE_armature.h"
-#include "BKE_blender.h"
-#include "BKE_global.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
-#include "BKE_material.h"
-#include "BKE_node.h"
-#include "BKE_texture.h"
-#include "BKE_utildefines.h"
-
-#include "BSE_drawipo.h"
-#include "BSE_node.h"
-#include "BSE_headerbuttons.h"
-
-#include "MEM_guardedalloc.h"
-#include "BLI_blenlib.h"
-
-#include "blendef.h"
-#include "mydevice.h"
-#include "butspace.h"
-
-Material matcopybuf;
-
-void clear_matcopybuf(void)
-{
- memset(&matcopybuf, 0, sizeof(Material));
-}
-
-void free_matcopybuf(void)
-{
- extern MTex mtexcopybuf; /* buttons.c */
- int a;
-
- for(a=0; a<MAX_MTEX; a++) {
- if(matcopybuf.mtex[a]) {
- MEM_freeN(matcopybuf.mtex[a]);
- matcopybuf.mtex[a]= NULL;
- }
- }
-
- if(matcopybuf.ramp_col) MEM_freeN(matcopybuf.ramp_col);
- if(matcopybuf.ramp_spec) MEM_freeN(matcopybuf.ramp_spec);
-
- matcopybuf.ramp_col= NULL;
- matcopybuf.ramp_spec= NULL;
-
- if(matcopybuf.nodetree) {
- ntreeFreeTree(matcopybuf.nodetree);
- MEM_freeN(matcopybuf.nodetree);
- matcopybuf.nodetree= NULL;
- }
- default_mtex(&mtexcopybuf);
-}
-
-void do_buts_buttons(short event)
-{
- static short matcopied=0;
- MTex *mtex;
- Material *ma;
- ID id;
- int a;
- float dx, dy;
- if(curarea->win==0) return;
-
- switch(event) {
- case B_BUTSHOME:
- uiSetPanel_view2d(curarea);
- G.v2d->cur= G.v2d->tot;
- test_view2d(G.v2d, curarea->winx, curarea->winy);
-
- /* we always put in left/top */
- dy= G.v2d->tot.ymax - G.v2d->cur.ymax;
- G.v2d->cur.ymin += dy;
- G.v2d->cur.ymax += dy;
- dx= G.v2d->tot.xmin - G.v2d->cur.xmin;
- G.v2d->cur.xmin += dx;
- G.v2d->cur.xmax += dx;
-
- scrarea_queue_winredraw(curarea);
- break;
- case B_BUTSPREVIEW:
- BIF_preview_changed(ID_TE);
- G.buts->oldkeypress = 0;
- scrarea_queue_headredraw(curarea);
- scrarea_queue_winredraw(curarea);
- break;
- case B_CONTEXT_SWITCH:
- G.buts->oldkeypress = 0;
- scrarea_queue_headredraw(curarea);
- scrarea_queue_winredraw(curarea);
- break;
- case B_MATCOPY:
- if(G.buts->lockpoin) {
- ma= G.buts->lockpoin;
- if(matcopied) free_matcopybuf();
-
- memcpy(&matcopybuf, ma, sizeof(Material));
- if(matcopybuf.ramp_col) matcopybuf.ramp_col= MEM_dupallocN(matcopybuf.ramp_col);
- if(matcopybuf.ramp_spec) matcopybuf.ramp_spec= MEM_dupallocN(matcopybuf.ramp_spec);
-
- for(a=0; a<MAX_MTEX; a++) {
- mtex= matcopybuf.mtex[a];
- if(mtex) {
- matcopybuf.mtex[a]= MEM_dupallocN(mtex);
- }
- }
- matcopybuf.nodetree= ntreeCopyTree(ma->nodetree, 0);
- matcopied= 1;
- }
- break;
- case B_MATPASTE:
- if(matcopied && G.buts->lockpoin) {
- ma= G.buts->lockpoin;
-
- /* free current mat */
- if(ma->ramp_col) MEM_freeN(ma->ramp_col);
- if(ma->ramp_spec) MEM_freeN(ma->ramp_spec);
- for(a=0; a<MAX_MTEX; a++) {
- mtex= ma->mtex[a];
- if(mtex && mtex->tex) mtex->tex->id.us--;
- if(mtex) MEM_freeN(mtex);
- }
-
- if(ma->nodetree) {
- ntreeFreeTree(ma->nodetree);
- MEM_freeN(ma->nodetree);
- }
-
- id= (ma->id);
- memcpy(ma, &matcopybuf, sizeof(Material));
- (ma->id)= id;
-
- if(matcopybuf.ramp_col) ma->ramp_col= MEM_dupallocN(matcopybuf.ramp_col);
- if(matcopybuf.ramp_spec) ma->ramp_spec= MEM_dupallocN(matcopybuf.ramp_spec);
-
- for(a=0; a<MAX_MTEX; a++) {
- mtex= ma->mtex[a];
- if(mtex) {
- ma->mtex[a]= MEM_dupallocN(mtex);
- if(mtex->tex) id_us_plus((ID *)mtex->tex);
- }
- }
-
- ma->nodetree= ntreeCopyTree(matcopybuf.nodetree, 0);
-
- BIF_preview_changed(ID_MA);
- BIF_undo_push("Paste material settings");
- scrarea_queue_winredraw(curarea);
- }
- break;
- case B_MESHTYPE:
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWVIEW3D, 0);
- break;
- }
-}
-
-void buttons_active_id(ID **id, ID **idfrom)
-{
- Object *ob= OBACT;
- Material *ma;
-
- *id= NULL;
- *idfrom= (ID *)ob;
-
- if(G.buts->mainb==CONTEXT_SCENE) {
- int tab= G.buts->tab[CONTEXT_SCENE];
-
- if(tab==TAB_SCENE_RENDER) *id= (ID *)G.scene;
- else if(tab==TAB_SCENE_SOUND) {
- ID *search;
-
- // validate lockpoin, maybe its not a sound
- if (G.buts->lockpoin) {
- search = G.main->sound.first;
- while (search) {
- if (search == G.buts->lockpoin) {
- break;
- }
- search = search->next;
- }
- if (search == NULL) {
- *id = G.main->sound.first;
- } else {
- *id = search;
- }
- }
- else {
- *id = G.main->sound.first;
- }
-
- }
- }
- else if(G.buts->mainb==CONTEXT_SHADING) {
- int tab= G.buts->tab[CONTEXT_SHADING];
-
- if(tab==TAB_SHADING_LAMP) {
- if(ob && ob->type==OB_LAMP) {
- *id= ob->data;
- }
- }
- else if(tab==TAB_SHADING_MAT) {
- if(ob && (ob->type<OB_LAMP) && ob->type) {
- *id= (ID *)give_current_material(ob, ob->actcol);
- *idfrom= material_from(ob, ob->actcol);
- }
- }
- else if(tab==TAB_SHADING_WORLD) {
- *id= (ID *)G.scene->world;
- *idfrom= (ID *)G.scene;
- }
- else if(tab==TAB_SHADING_TEX) {
- MTex *mtex;
-
- if(G.buts->mainbo==G.buts->mainb && G.buts->tabo!=tab) {
- if(G.buts->tabo==TAB_SHADING_LAMP) G.buts->texfrom= 2;
- else if(G.buts->tabo==TAB_SHADING_WORLD) G.buts->texfrom= 1;
- else if(G.buts->tabo==TAB_SHADING_MAT) G.buts->texfrom= 0;
- }
-
- if(G.buts->texfrom==0) {
- if(ob && ob->type<OB_LAMP && ob->type) {
- bNode *node= NULL;
-
- ma= give_current_material(ob, ob->actcol);
- if(ma && ma->use_nodes)
- node= editnode_get_active_idnode(ma->nodetree, ID_TE);
-
- if(node) {
- *idfrom= NULL;
- *id= node->id;
- }
- else {
- ma= editnode_get_active_material(ma);
- *idfrom= (ID *)ma;
- if(ma) {
- mtex= ma->mtex[ ma->texact ];
- if(mtex) *id= (ID *)mtex->tex;
- }
- }
- }
- }
- else if(G.buts->texfrom==1) {
- World *wrld= G.scene->world;
- *idfrom= (ID *)wrld;
- if(wrld) {
- mtex= wrld->mtex[ wrld->texact];
- if(mtex) *id= (ID *)mtex->tex;
- }
- }
- else if(G.buts->texfrom==2) {
- Lamp *la;
- if(ob && ob->type==OB_LAMP) {
- la= ob->data;
- *idfrom= (ID *)la;
- mtex= la->mtex[ la->texact];
- if(mtex) *id= (ID *)mtex->tex;
- }
- }
- else if(G.buts->texfrom==3) {
- if(G.f & G_SCULPTMODE) {
- if(G.scene->sculptdata.texact != -1) {
- mtex= G.scene->sculptdata.mtex[G.scene->sculptdata.texact];
- if(mtex) *id= (ID*)mtex->tex;
- }
- } else {
- Brush *brush= G.scene->toolsettings->imapaint.brush;
- if (brush) {
- mtex= brush->mtex[brush->texact];
- if(mtex) *id= (ID*)mtex->tex;
- }
- }
- }
- }
- }
- else if(G.buts->mainb==CONTEXT_OBJECT || G.buts->mainb==CONTEXT_LOGIC) {
- if(ob) {
- *idfrom= (ID *)G.scene;
- *id= (ID *)ob;
- }
- }
- else if(G.buts->mainb==CONTEXT_EDITING) {
- if(ob && ob->data) {
- *id= ob->data;
- }
- }
-}
-
-static void do_buts_view_shadingmenu(void *arg, int event)
-{
- G.buts->mainb = CONTEXT_SHADING;
-
- allqueue(REDRAWBUTSALL, 0);
-}
-
-
-static uiBlock *buts_view_shadingmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "buts_view_shadingmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_buts_view_shadingmenu, NULL);
-
- if((G.buts->mainb == CONTEXT_SHADING) && (G.buts->tab[CONTEXT_SHADING]==TAB_SHADING_LAMP)) {
- uiDefIconTextButC(block, BUTM, B_REDR, ICON_CHECKBOX_HLT, "Lamp|F5",
- 0, yco-=20, menuwidth, 19, &(G.buts->tab[CONTEXT_SHADING]), (float)TAB_SHADING_LAMP, 0.0, 0, 10, "");
- } else {
- uiDefIconTextButC(block, BUTM, B_REDR, ICON_CHECKBOX_DEHLT, "Lamp|F5",
- 0, yco-=20, menuwidth, 19, &(G.buts->tab[CONTEXT_SHADING]), (float)TAB_SHADING_LAMP, 0.0, 0, 10, "");
- }
-
- if((G.buts->mainb == CONTEXT_SHADING) && (G.buts->tab[CONTEXT_SHADING]==TAB_SHADING_MAT)) {
- uiDefIconTextButC(block, BUTM, B_REDR, ICON_CHECKBOX_HLT, "Material|F5",
- 0, yco-=20, menuwidth, 19, &(G.buts->tab[CONTEXT_SHADING]), (float)TAB_SHADING_MAT, 0.0, 0, 10, "");
- } else {
- uiDefIconTextButC(block, BUTM, B_REDR, ICON_CHECKBOX_DEHLT, "Material|F5",
- 0, yco-=20, menuwidth, 19, &(G.buts->tab[CONTEXT_SHADING]), (float)TAB_SHADING_MAT, 0.0, 0, 10, "");
- }
-
- if((G.buts->mainb == CONTEXT_SHADING) && (G.buts->tab[CONTEXT_SHADING]==TAB_SHADING_TEX)) {
- uiDefIconTextButC(block, BUTM, B_REDR, ICON_CHECKBOX_HLT, "Texture|F6",
- 0, yco-=20, menuwidth, 19, &(G.buts->tab[CONTEXT_SHADING]), (float)TAB_SHADING_TEX, 0.0, 0, 10, "");
- } else {
- uiDefIconTextButC(block, BUTM, B_REDR, ICON_CHECKBOX_DEHLT, "Texture|F6",
- 0, yco-=20, menuwidth, 19, &(G.buts->tab[CONTEXT_SHADING]), (float)TAB_SHADING_TEX, 0.0, 0, 10, "");
- }
-
- if((G.buts->mainb == CONTEXT_SHADING) && (G.buts->tab[CONTEXT_SHADING]==TAB_SHADING_RAD)) {
- uiDefIconTextButC(block, BUTM, B_REDR, ICON_CHECKBOX_HLT, "Radiosity",
- 0, yco-=20, menuwidth, 19, &(G.buts->tab[CONTEXT_SHADING]), (float)TAB_SHADING_RAD, 0.0, 0, 10, "");
- } else {
- uiDefIconTextButC(block, BUTM, B_REDR, ICON_CHECKBOX_DEHLT, "Radiosity",
- 0, yco-=20, menuwidth, 19, &(G.buts->tab[CONTEXT_SHADING]), (float)TAB_SHADING_RAD, 0.0, 0, 10, "");
- }
-
- if((G.buts->mainb == CONTEXT_SHADING) && (G.buts->tab[CONTEXT_SHADING]==TAB_SHADING_WORLD)) {
- uiDefIconTextButC(block, BUTM, B_REDR, ICON_CHECKBOX_HLT, "World|F8",
- 0, yco-=20, menuwidth, 19, &(G.buts->tab[CONTEXT_SHADING]), (float)TAB_SHADING_WORLD, 1.0, 0, 10, "");
- } else {
- uiDefIconTextButC(block, BUTM, B_REDR, ICON_CHECKBOX_DEHLT, "World|F8",
- 0, yco-=20, menuwidth, 19, &(G.buts->tab[CONTEXT_SHADING]), (float)TAB_SHADING_WORLD, 1.0, 0, 10, "");
- }
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-
-static void do_buts_view_scenemenu(void *arg, int event)
-{
- G.buts->mainb = CONTEXT_SCENE;
-
- allqueue(REDRAWBUTSALL, 0);
-}
-
-
-static uiBlock *buts_view_scenemenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "buts_view_scenemenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_buts_view_scenemenu, NULL);
-
- if((G.buts->mainb == CONTEXT_SCENE) && (G.buts->tab[CONTEXT_SCENE]==TAB_SCENE_RENDER)) {
- uiDefIconTextButC(block, BUTM, B_REDR, ICON_CHECKBOX_HLT, "Render|F10",
- 0, yco-=20, menuwidth, 19, &(G.buts->tab[CONTEXT_SCENE]), (float)TAB_SCENE_RENDER, 0.0, 0, 10, "");
- } else {
- uiDefIconTextButC(block, BUTM, B_REDR, ICON_CHECKBOX_DEHLT, "Render|F10",
- 0, yco-=20, menuwidth, 19, &(G.buts->tab[CONTEXT_SCENE]), (float)TAB_SCENE_RENDER, 0.0, 0, 10, "");
- }
-
- if((G.buts->mainb == CONTEXT_SCENE) && (G.buts->tab[CONTEXT_SCENE]==TAB_SCENE_ANIM)) {
- uiDefIconTextButC(block, BUTM, B_REDR, ICON_CHECKBOX_HLT, "Animation",
- 0, yco-=20, menuwidth, 19, &(G.buts->tab[CONTEXT_SCENE]), (float)TAB_SCENE_ANIM, 0.0, 0, 10, "");
- } else {
- uiDefIconTextButC(block, BUTM, B_REDR, ICON_CHECKBOX_DEHLT, "Animation",
- 0, yco-=20, menuwidth, 19, &(G.buts->tab[CONTEXT_SCENE]), (float)TAB_SCENE_ANIM, 0.0, 0, 10, "");
- }
-
- if((G.buts->mainb == CONTEXT_SCENE) && (G.buts->tab[CONTEXT_SCENE]==TAB_SCENE_SOUND)) {
- uiDefIconTextButC(block, BUTM, B_REDR, ICON_CHECKBOX_HLT, "Sound",
- 0, yco-=20, menuwidth, 19, &(G.buts->tab[CONTEXT_SCENE]), (float)TAB_SCENE_SOUND, 0.0, 0, 10, "");
- } else {
- uiDefIconTextButC(block, BUTM, B_REDR, ICON_CHECKBOX_DEHLT, "Sound",
- 0, yco-=20, menuwidth, 19, &(G.buts->tab[CONTEXT_SCENE]), (float)TAB_SCENE_SOUND, 0.0, 0, 10, "");
- }
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-
-static void do_buts_view_alignmenu(void *arg, int event)
-{
- SpaceButs *sbuts= curarea->spacedata.first;
-
- switch(event) {
- case 0: /* panel alignment */
- case 1:
- case 2:
- sbuts->align= event;
- if(event) {
- uiAlignPanelStep(curarea, 1.0);
- do_buts_buttons(B_BUTSHOME);
- }
- break;
- }
-
- allqueue(REDRAWBUTSALL, 0);
-}
-
-
-static uiBlock *buts_view_alignmenu(void *arg_unused)
-{
- SpaceButs *sbuts= curarea->spacedata.first;
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "buts_view_alignmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_buts_view_alignmenu, NULL);
-
- if (sbuts->align == 1) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Horizontal", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Horizontal", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
-
- if (sbuts->align == 2) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Vertical", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Vertical", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- if (sbuts->align == 0) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Free", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Free", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-
-static void do_buts_viewmenu(void *arg, int event)
-{
- SpaceButs *sbuts= curarea->spacedata.first;
-
- switch(event) {
- case 1: /* zoom in */
- view2d_zoom(&sbuts->v2d, 0.06f, curarea->winx, curarea->winy);
- break;
- case 2: /* zoom out */
- view2d_zoom(&sbuts->v2d, -0.075f, curarea->winx, curarea->winy);
- break;
- case 3: /* View All */
- do_buts_buttons(B_BUTSHOME);
- break;
- case 4: /* Maximize Window */
- /* using event B_FULL */
- break;
- case 10: /* empty for the context events */
- break;
- }
- allqueue(REDRAWBUTSALL, 0);
-}
-
-static uiBlock *buts_viewmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "buts_viewmenu",
- UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_buts_viewmenu, NULL);
-
- if(G.buts->mainb==CONTEXT_LOGIC) {
- uiDefIconTextButS(block, BUTM, B_REDR, ICON_CHECKBOX_HLT, "Logic|F4",
- 0, yco-=20, menuwidth, 19, &(G.buts->mainb), CONTEXT_LOGIC, 0.0, 0, 10, "");
- } else {
- uiDefIconTextButS(block, BUTM, B_REDR, ICON_CHECKBOX_DEHLT, "Logic|F4",
- 0, yco-=20, menuwidth, 19, &(G.buts->mainb), CONTEXT_LOGIC, 0.0, 0, 10, "");
- }
-
- if(G.buts->mainb==CONTEXT_SCRIPT) {
- uiDefIconTextButS(block, BUTM, B_REDR, ICON_CHECKBOX_HLT, "Script",
- 0, yco-=20, menuwidth, 19, &(G.buts->mainb), (float)CONTEXT_SCRIPT, 0.0, 0, 10, "");
- } else {
- uiDefIconTextButS(block, BUTM, B_REDR, ICON_CHECKBOX_DEHLT, "Script",
- 0, yco-=20, menuwidth, 19, &(G.buts->mainb), (float)CONTEXT_SCRIPT, 0.0, 0, 10, "");
- }
-
- uiDefIconTextBlockBut(block, buts_view_shadingmenu, NULL, ICON_RIGHTARROW_THIN, "Shading", 0, yco-=20, 120, 19, "");
-
- if(G.buts->mainb==CONTEXT_OBJECT) {
- uiDefIconTextButS(block, BUTM, B_REDR, ICON_CHECKBOX_HLT, "Object|F7",
- 0, yco-=20, menuwidth, 19, &(G.buts->mainb), (float)CONTEXT_OBJECT, 0.0, 0, 10, "");
- } else {
- uiDefIconTextButS(block, BUTM, B_REDR, ICON_CHECKBOX_DEHLT, "Object|F7",
- 0, yco-=20, menuwidth, 19, &(G.buts->mainb), (float)CONTEXT_OBJECT, 0.0, 0, 10, "");
- }
-
- if(G.buts->mainb==CONTEXT_EDITING) {
- uiDefIconTextButS(block, BUTM, B_REDR, ICON_CHECKBOX_HLT, "Editing|F9",
- 0, yco-=20, menuwidth, 19, &(G.buts->mainb), (float)CONTEXT_EDITING, 0.0, 0, 10, "");
- } else {
- uiDefIconTextButS(block, BUTM, B_REDR, ICON_CHECKBOX_DEHLT, "Editing|F9",
- 0, yco-=20, menuwidth, 19, &(G.buts->mainb), (float)CONTEXT_EDITING, 0.0, 0, 10, "");
- }
-
- uiDefIconTextBlockBut(block, buts_view_scenemenu, NULL, ICON_RIGHTARROW_THIN, "Scene", 0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, buts_view_alignmenu, NULL, ICON_RIGHTARROW_THIN, "Align", 0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Zoom In|NumPad +", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Zoom Out|NumPad -", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "View All|Home", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-
- if (!curarea->full)
- uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Maximize Window|Ctrl UpArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
- else
- uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Tile Window|Ctrl DownArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-void buts_buttons(void)
-{
- uiBlock *block;
- ID *id, *idfrom;
- short xco, xmax, t_base= 0;
- char naam[20];
-
- sprintf(naam, "header %d", curarea->headwin);
- block= uiNewBlock(&curarea->uiblocks, naam, UI_EMBOSS, UI_HELV, curarea->headwin);
-
- if(area_is_active_area(curarea)) uiBlockSetCol(block, TH_HEADER);
- else uiBlockSetCol(block, TH_HEADERDESEL);
-
- curarea->butspacetype= SPACE_BUTS;
-
- xco = 8;
-
- uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D,
- windowtype_pup(), xco, 0, XIC+10, YIC,
- &(curarea->butspacetype), 1.0, SPACEICONMAX, 0, 0,
- "Displays Current Window Type. "
- "Click for menu of available types.");
-
- xco += XIC + 14;
-
- uiBlockSetEmboss(block, UI_EMBOSSN);
- if (curarea->flag & HEADER_NO_PULLDOWN) {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, B_FLIPINFOMENU,
- ICON_DISCLOSURE_TRI_RIGHT,
- xco,2,XIC,YIC-2,
- &(curarea->flag), 0, 0, 0, 0,
- "Show pulldown menus");
- }
- else {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, B_FLIPINFOMENU,
- ICON_DISCLOSURE_TRI_DOWN,
- xco,2,XIC,YIC-2,
- &(curarea->flag), 0, 0, 0, 0,
- "Hide pulldown menus");
- }
- uiBlockSetEmboss(block, UI_EMBOSS);
- xco+=XIC;
-
- if((curarea->flag & HEADER_NO_PULLDOWN)==0) {
- /* pull down menus */
- uiBlockSetEmboss(block, UI_EMBOSSP);
-
- xmax= GetButStringLength("Panels");
- uiDefPulldownBut(block, buts_viewmenu, NULL,
- "Panels", xco, -2, xmax-3, 24, "");
- xco+= xmax;
-
- }
-
- uiBlockSetEmboss(block, UI_EMBOSS);
-
-
- /* FULL WINDOW */
-// if(curarea->full) uiDefIconBut(block, BUT,B_FULL, ICON_SPLITSCREEN, xco,0,XIC,YIC, 0, 0, 0, 0, 0, "Returns to multiple views window (CTRL+Up arrow)");
-// else uiDefIconBut(block, BUT,B_FULL, ICON_FULLSCREEN, xco,0,XIC,YIC, 0, 0, 0, 0, 0, "Makes current window full screen (CTRL+Down arrow)");
-
- /* HOME */
-// uiDefIconBut(block, BUT, B_BUTSHOME, ICON_HOME, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Zooms window to home view showing all items (HOMEKEY)");
-// xco+=XIC;
-
- uiBlockBeginAlign(block);
- uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_GAME, xco, 0, XIC, YIC, &(G.buts->mainb), 0.0, (float)CONTEXT_LOGIC, 0, 0, "Logic (F4) ");
- uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_SCRIPT, xco+=XIC, 0, XIC, YIC, &(G.buts->mainb), 0.0, (float)CONTEXT_SCRIPT, 0, 0, "Script ");
- uiDefIconButS(block, ROW, B_BUTSPREVIEW, ICON_MATERIAL_DEHLT,xco+=XIC, 0, XIC, YIC, &(G.buts->mainb), 0.0, (float)CONTEXT_SHADING, 0, 0, "Shading (F5) ");
- uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_OBJECT, xco+=XIC, 0, XIC, YIC, &(G.buts->mainb), 0.0, (float)CONTEXT_OBJECT, 0, 0, "Object (F7) ");
- uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_EDIT, xco+=XIC, 0, XIC, YIC, &(G.buts->mainb), 0.0, (float)CONTEXT_EDITING, 0, 0, "Editing (F9) ");
- uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_SCENE_DEHLT, xco+=XIC, 0, XIC, YIC, &(G.buts->mainb), 0.0, (float)CONTEXT_SCENE, 0, 0, "Scene (F10) ");
-
- xco+= XIC;
-
- /* select the context to be drawn, per contex/tab the actual context is tested */
- uiBlockSetEmboss(block, UI_EMBOSS); // normal
- switch(G.buts->mainb) {
- case CONTEXT_SCENE:
- uiBlockBeginAlign(block);
- uiDefIconButC(block, ROW, B_CONTEXT_SWITCH, ICON_SCENE, xco+=XIC, t_base, XIC, YIC, &(G.buts->tab[CONTEXT_SCENE]), 1.0, (float)TAB_SCENE_RENDER, 0, 0, "Render buttons ");
- uiDefIconButC(block, ROW, B_CONTEXT_SWITCH, ICON_ANIM, xco+=XIC, t_base, XIC, YIC, &(G.buts->tab[CONTEXT_SCENE]), 1.0, (float)TAB_SCENE_ANIM, 0, 0, "Anim/playback buttons");
- uiDefIconButC(block, ROW, B_CONTEXT_SWITCH, ICON_SOUND, xco+=XIC, t_base, XIC, YIC, &(G.buts->tab[CONTEXT_SCENE]), 1.0, (float)TAB_SCENE_SOUND, 0, 0, "Sound block buttons");
-
- break;
- case CONTEXT_OBJECT:
- uiBlockBeginAlign(block);
- uiDefIconButC(block, ROW, B_CONTEXT_SWITCH, ICON_OBJECT, xco+=XIC, t_base, XIC, YIC, &(G.buts->tab[CONTEXT_OBJECT]), 1.0, (float)TAB_OBJECT_OBJECT, 0, 0, "Object buttons ");
- uiDefIconButC(block, ROW, B_CONTEXT_SWITCH, ICON_PHYSICS, xco+=XIC, t_base, XIC, YIC, &(G.buts->tab[CONTEXT_OBJECT]), 1.0, (float)TAB_OBJECT_PHYSICS, 0, 0, "Physics buttons");
- uiDefIconButC(block, ROW, B_CONTEXT_SWITCH, ICON_PARTICLES, xco+=XIC, t_base, XIC, YIC, &(G.buts->tab[CONTEXT_OBJECT]), 1.0, (float)TAB_OBJECT_PARTICLE, 0, 0, "Particle buttons");
-
- break;
- case CONTEXT_SHADING:
- uiBlockBeginAlign(block);
- uiDefIconButC(block, ROW, B_BUTSPREVIEW, ICON_LAMP, xco+=XIC, t_base, XIC, YIC, &(G.buts->tab[CONTEXT_SHADING]), 1.0, (float)TAB_SHADING_LAMP, 0, 0, "Lamp buttons");
- uiDefIconButC(block, ROW, B_BUTSPREVIEW, ICON_MATERIAL, xco+=XIC, t_base, XIC, YIC, &(G.buts->tab[CONTEXT_SHADING]), 1.0, (float)TAB_SHADING_MAT, 0, 0, "Material buttons");
- uiDefIconButC(block, ROW, B_BUTSPREVIEW, ICON_TEXTURE, xco+=XIC, t_base, XIC, YIC, &(G.buts->tab[CONTEXT_SHADING]), 1.0, (float)TAB_SHADING_TEX, 0, 0, "Texture buttons(F6)");
- uiDefIconButC(block, ROW, B_CONTEXT_SWITCH, ICON_RADIO,xco+=XIC, t_base, XIC, YIC, &(G.buts->tab[CONTEXT_SHADING]), 1.0, (float)TAB_SHADING_RAD, 0, 0, "Radiosity buttons");
- uiDefIconButC(block, ROW, B_BUTSPREVIEW, ICON_WORLD, xco+=XIC, t_base, XIC, YIC, &(G.buts->tab[CONTEXT_SHADING]), 1.0, (float)TAB_SHADING_WORLD, 0, 0, "World buttons");
-
- break;
- case CONTEXT_EDITING:
-
- break;
- case CONTEXT_SCRIPT:
-
- break;
- case CONTEXT_LOGIC:
-
- break;
- }
-
- uiBlockEndAlign(block);
-
- xco+=XIC;
- uiDefButI(block, NUM, B_NEWFRAME, "", (xco+20),0,60,YIC, &(G.scene->r.cfra), 1.0, MAXFRAMEF, 0, 0, "Displays Current Frame of animation. Click to change.");
- xco+= 80;
-
- buttons_active_id(&id, &idfrom);
- G.buts->lockpoin= id;
-
- /* always do as last */
- uiDrawBlock(block);
- curarea->headbutlen= xco;
-}
diff --git a/source/blender/src/header_filesel.c b/source/blender/src/header_filesel.c
deleted file mode 100644
index 999fa2733af..00000000000
--- a/source/blender/src/header_filesel.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/**
- * header_filesel.c oct-2003
- *
- * Functions to draw the "File Browser" window header
- * and handle user events sent to it.
- *
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "DNA_ID.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_userdef_types.h"
-
-#include "BIF_gl.h"
-#include "BIF_interface.h"
-#include "BIF_language.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BLI_blenlib.h"
-#include "BSE_filesel.h"
-#include "BSE_headerbuttons.h"
-
-#include "blendef.h"
-#include "mydevice.h"
-
-void do_file_buttons(short event)
-{
- SpaceFile *sfile;
-
- if(curarea->win==0) return;
- sfile= curarea->spacedata.first;
-
- switch(event) {
- case B_SORTFILELIST:
- sort_filelist(sfile);
- scrarea_queue_winredraw(curarea);
- break;
- case B_RELOADDIR:
- freefilelist(sfile);
- scrarea_queue_winredraw(curarea);
- break;
- }
-
-}
-
-void file_buttons(void)
-{
- SpaceFile *sfile;
- uiBlock *block;
- float df, totlen, sellen;
- short xco, xcotitle;
- int totfile, selfile;
- char naam[256];
-
- sfile= curarea->spacedata.first;
-
- sprintf(naam, "header %d", curarea->headwin);
- block= uiNewBlock(&curarea->uiblocks, naam, UI_EMBOSS, UI_HELV, curarea->headwin);
-
- if(area_is_active_area(curarea)) uiBlockSetCol(block, TH_HEADER);
- else uiBlockSetCol(block, TH_HEADERDESEL);
-
- curarea->butspacetype= SPACE_FILE;
-
- xco = 8;
-
- uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D, windowtype_pup(), xco,0,XIC+10,YIC, &(curarea->butspacetype), 1.0, SPACEICONMAX, 0, 0, "Displays Current Window Type. Click for menu of available types.");
-
- xco+= XIC+22;
-
- /* FULL WINDOW */
- if(curarea->full) uiDefIconBut(block, BUT,B_FULL, ICON_SPLITSCREEN, xco,0,XIC,YIC, 0, 0, 0, 0, 0, "Returns to multiple views window (CTRL+Up arrow)");
- else uiDefIconBut(block, BUT,B_FULL, ICON_FULLSCREEN, xco,0,XIC,YIC, 0, 0, 0, 0, 0, "Makes current window full screen (CTRL+Down arrow)");
-
- /* SORT TYPE */
- xco+=XIC;
- uiBlockBeginAlign(block);
- uiDefIconButS(block, ROW, B_SORTFILELIST, ICON_SORTALPHA, xco+=XIC,0,XIC,YIC, &sfile->sort, 1.0, 0.0, 0, 0, "Sorts files alphabetically");
- uiDefIconButS(block, ROW, B_SORTFILELIST, ICON_SORTBYEXT, xco+=XIC,0,XIC,YIC, &sfile->sort, 1.0, 3.0, 0, 0, "Sorts files by extension");
- uiDefIconButS(block, ROW, B_SORTFILELIST, ICON_SORTTIME, xco+=XIC,0,XIC,YIC, &sfile->sort, 1.0, 1.0, 0, 0, "Sorts files by time");
- uiDefIconButS(block, ROW, B_SORTFILELIST, ICON_SORTSIZE, xco+=XIC,0,XIC,YIC, &sfile->sort, 1.0, 2.0, 0, 0, "Sorts files by size");
- uiBlockEndAlign(block);
-
- cpack(0x0);
- xco+=XIC+10;
-
- xcotitle= xco;
- xco+= BIF_GetStringWidth(G.font, sfile->title, (U.transopts & USER_TR_BUTTONS));
-
- if(sfile->pupmenu && sfile->menup) {
- uiDefButS(block, MENU, B_NOP, sfile->pupmenu, xco+10,0,90,20, sfile->menup, 0, 0, 0, 0, "");
- xco+= 100;
- }
- uiBlockBeginAlign(block);
- uiDefIconButBitS(block, ICONTOG, FILE_SHOWSHORT, B_SORTFILELIST, ICON_LONGDISPLAY,xco+=XIC,0,XIC,YIC, &sfile->flag, 0, 0, 0, 0, "Toggles long info");
- uiDefIconButBitS(block, TOG, FILE_HIDE_DOT, B_RELOADDIR, ICON_GHOST,xco+=XIC,0,XIC,YIC, &sfile->flag, 0, 0, 0, 0, "Hides dot files");
- uiBlockEndAlign(block);
-
- uiDefButBitS(block, TOG, FILE_STRINGCODE, 0, "Relative Paths", xco+=XIC+20,0,100,YIC, &sfile->flag, 0, 0, 0, 0, "Makes sure returned paths are relative to the current .blend file");
-
- xco+=90;
-
- if(sfile->type==FILE_LOADLIB) {
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOGN, FILE_LINK, B_REDR, "Append", xco+=XIC,0,100,YIC, &sfile->flag, 0, 0, 0, 0, "Copies selected data into current project");
- uiDefButBitS(block, TOG, FILE_LINK, B_REDR, "Link", xco+=100,0,100,YIC, &sfile->flag, 0, 0, 0, 0, "Creates a link to selected data from current project");
- uiBlockEndAlign(block);
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, FILE_AUTOSELECT, B_REDR, "Autosel", xco+=125,0,65,YIC, &sfile->flag, 0, 0, 0, 0, "Autoselect imported objects");
- uiDefButBitS(block, TOG, FILE_ACTIVELAY, B_REDR, "Active Layer", xco+=65,0,80,YIC, &sfile->flag, 0, 0, 0, 0, "Append object(s) in active layer");
- uiDefButBitS(block, TOG, FILE_ATCURSOR, B_REDR, "At Cursor", xco+=80,0,65,YIC, &sfile->flag, 0, 0, 0, 0, "Append object(s) at cursor, use centroid if more than one object is selected");
- uiBlockEndAlign(block);
-
- xco+= 100; // scroll
-
- } else if(sfile->type==FILE_BLENDER) {
- uiDefButBitI(block, TOGN, G_FILE_NO_UI, B_REDR, "Load UI", xco+=XIC,0,80,YIC, &G.fileflags, 0, 0, 0, 0, "Load the UI setup as well as the scene data");
-
- xco+= 100; // scroll
- }
- #ifdef INTERNATIONAL
- else if(sfile->type==FILE_LOADFONT) {
- uiDefIconButBitS(block, TOG, FILE_SHOWSHORT, B_SORTFILELIST, ICON_FONTPREVIEW, xco+= XIC, 0, XIC, YIC, &sfile->f_fp, 0, 0, 0, 0, "Activate font preview");
- if (sfile->f_fp)
- uiDefButC(block, FTPREVIEW, 0, "Font preview", xco+= XIC, 0, 100, YIC, sfile->fp_str, (float)0, (float)16, 0, 0, "Font preview");
-
- xco+= 100; // scroll
- }
- #endif
-
- uiDrawBlock(block);
-
- glRasterPos2f((float)xcotitle, 5.0);
- BIF_RasterPos((float)xcotitle, 5.0); // stupid texture fonts
- BIF_ThemeColor(TH_TEXT);
- BIF_DrawString(uiBlockGetCurFont(block), sfile->title, (U.transopts & USER_TR_BUTTONS));
-
- if(sfile->type==FILE_UNIX) {
- df= BLI_diskfree(sfile->dir)/(1048576.0);
-
- filesel_statistics(sfile, &totfile, &selfile, &totlen, &sellen);
-
- sprintf(naam, "Free: %.3f MB Files: (%d) %d (%.3f) %.3f MB", df, selfile,totfile, sellen, totlen);
-
- cpack(0x0);
- glRasterPos2f((float)xco, 5.0);
- BIF_RasterPos((float)xco, 5.0); // texture fonts
-
- BIF_DrawString(G.font, naam, 0);
- }
-
- /* always do as last */
- curarea->headbutlen= xco+2*XIC;
-}
diff --git a/source/blender/src/header_image.c b/source/blender/src/header_image.c
deleted file mode 100644
index 5b8c33309a0..00000000000
--- a/source/blender/src/header_image.c
+++ /dev/null
@@ -1,1305 +0,0 @@
-/**
- * header_image.c oct-2003
- *
- * Functions to draw the "UV/Image Editor" window header
- * and handle user events sent to it.
- *
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "DNA_brush_types.h"
-#include "DNA_ID.h"
-#include "DNA_image_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_customdata_types.h" /* for UV layer menu */
-
-#include "BLI_blenlib.h"
-
-#include "BDR_drawmesh.h"
-#include "BDR_unwrapper.h"
-
-#include "BKE_brush.h"
-#include "BKE_colortools.h"
-#include "BKE_global.h"
-#include "BKE_image.h"
-#include "BKE_main.h"
-#include "BKE_utildefines.h"
-#include "BLI_editVert.h" /* for UV layer menu */
-#include "BKE_customdata.h" /* ditto */
-
-#include "BIF_butspace.h"
-#include "BIF_drawimage.h"
-#include "BIF_editsima.h"
-#include "BIF_imasel.h"
-#include "BIF_interface.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_transform.h"
-#include "BIF_toolbox.h"
-#include "BIF_editmesh.h"
-
-#include "BSE_drawview.h"
-#include "BSE_filesel.h"
-#include "BSE_headerbuttons.h"
-#include "BSE_trans_types.h"
-
-#include "BPY_extern.h"
-#include "BPY_menus.h"
-
-#include "IMB_imbuf_types.h"
-
-#include "RE_pipeline.h"
-
-#include "blendef.h"
-#include "butspace.h"
-#include "mydevice.h"
-
-void do_image_buttons(unsigned short event)
-{
- ToolSettings *settings= G.scene->toolsettings;
- ID *id, *idtest;
- int nr;
-
- if(curarea->win==0) return;
-
- if(event<=100) {
- if(event<=50) do_global_buttons2(event);
- else do_global_buttons(event);
- return;
- }
-
- switch(event) {
- case B_SIMAPIN:
- allqueue (REDRAWIMAGE, 0);
- break;
- case B_SIMAGEHOME:
- image_home();
- break;
-
- case B_SIMABROWSE:
- if(G.sima->imanr== -2) {
- if(G.qual & LR_CTRLKEY) {
- activate_databrowse_imasel((ID *)G.sima->image, ID_IM, 0, B_SIMABROWSE,
- &G.sima->imanr, do_image_buttons);
- } else {
- activate_databrowse((ID *)G.sima->image, ID_IM, 0, B_SIMABROWSE,
- &G.sima->imanr, do_image_buttons);
- }
- return;
- }
- if(G.sima->imanr < 0) break;
-
- nr= 1;
- id= (ID *)G.sima->image;
-
- idtest= BLI_findlink(&G.main->image, G.sima->imanr-1);
- if(idtest==NULL) { /* no new */
- return;
- }
-
- if(idtest!=id) {
- G.sima->image= (Image *)idtest;
- if(idtest->us==0) idtest->us= 1;
- BKE_image_signal(G.sima->image, &G.sima->iuser, IMA_SIGNAL_USER_NEW_IMAGE);
- allqueue(REDRAWIMAGE, 0);
- }
- /* also when image is the same: assign! 0==no tileflag: */
- image_changed(G.sima, (Image *)idtest);
- BIF_undo_push("Assign image UV");
-
- break;
- case B_SIMAGETILE:
- image_set_tile(G.sima, 1); /* 1: only tileflag */
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIMAGE, 0);
- break;
- case B_SIMA3DVIEWDRAW:
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_SIMA_REDR_IMA_3D:
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIMAGE, 0);
- break;
- case B_SIMAGEPAINTTOOL:
- if(G.sima->flag & SI_DRAWTOOL)
- /* add new brush if none exists */
- brush_check_exists(&G.scene->toolsettings->imapaint.brush);
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWIMAGE, 0);
- allqueue(REDRAWVIEW3D, 0);
- break;
-
- case B_SIMAPACKIMA:
- pack_image_sima();
- break;
-
- case B_SIMA_REPACK:
- BKE_image_memorypack(G.sima->image);
- allqueue(REDRAWIMAGE, 0);
- break;
-
- case B_SIMA_USE_ALPHA:
- G.sima->flag &= ~(SI_SHOW_ALPHA|SI_SHOW_ZBUF);
- scrarea_queue_winredraw(curarea);
- scrarea_queue_headredraw(curarea);
- break;
- case B_SIMA_SHOW_ALPHA:
- G.sima->flag &= ~(SI_USE_ALPHA|SI_SHOW_ZBUF);
- scrarea_queue_winredraw(curarea);
- scrarea_queue_headredraw(curarea);
- break;
- case B_SIMA_SHOW_ZBUF:
- G.sima->flag &= ~(SI_SHOW_ALPHA|SI_USE_ALPHA);
- scrarea_queue_winredraw(curarea);
- scrarea_queue_headredraw(curarea);
- break;
- case B_SIMARELOAD:
- reload_image_sima();
- break;
- case B_SIMAGELOAD:
- open_image_sima(0);
- break;
- case B_SIMANAME:
- if(G.sima->image) {
- Image *ima;
- char str[FILE_MAXDIR+FILE_MAXFILE];
-
- /* name in ima has been changed by button! */
- BLI_strncpy(str, G.sima->image->name, sizeof(str));
- ima= BKE_add_image_file(str);
- if(ima) {
- BKE_image_signal(ima, &G.sima->iuser, IMA_SIGNAL_RELOAD);
- image_changed(G.sima, ima);
- }
- BIF_undo_push("Load image");
- allqueue(REDRAWIMAGE, 0);
- }
- break;
- case B_SIMAMULTI:
- if(G.sima && G.sima->image) {
- BKE_image_multilayer_index(G.sima->image->rr, &G.sima->iuser);
- allqueue(REDRAWIMAGE, 0);
- }
- break;
- case B_TRANS_IMAGE:
- image_editvertex_buts(NULL);
- break;
- case B_CURSOR_IMAGE:
- image_editcursor_buts(NULL);
- break;
-
- case B_TWINANIM:
- {
- Image *ima;
- int nr;
-
- ima = G.sima->image;
- if (ima) {
- if(ima->flag & IMA_TWINANIM) {
- nr= ima->xrep*ima->yrep;
- if(ima->twsta>=nr) ima->twsta= 1;
- if(ima->twend>=nr) ima->twend= nr-1;
- if(ima->twsta>ima->twend) ima->twsta= 1;
- allqueue(REDRAWIMAGE, 0);
- }
- }
- break;
- }
- case B_SIMACLONEBROWSE:
- if (settings->imapaint.brush)
- if (brush_clone_image_set_nr(settings->imapaint.brush, G.sima->menunr))
- allqueue(REDRAWIMAGE, 0);
- break;
-
- case B_SIMACLONEDELETE:
- if (settings->imapaint.brush)
- if (brush_clone_image_delete(settings->imapaint.brush))
- allqueue(REDRAWIMAGE, 0);
- break;
-
- case B_SIMABRUSHCHANGE:
- allqueue(REDRAWIMAGE, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- break;
-
- case B_SIMACURVES:
- curvemapping_do_ibuf(G.sima->cumap, imagewindow_get_ibuf(G.sima));
- allqueue(REDRAWIMAGE, 0);
- break;
-
- case B_SIMARANGE:
- curvemapping_set_black_white(G.sima->cumap, NULL, NULL);
- curvemapping_do_ibuf(G.sima->cumap, imagewindow_get_ibuf(G.sima));
- allqueue(REDRAWIMAGE, 0);
- break;
-
- case B_SIMABRUSHBROWSE:
- if(G.sima->menunr==-2) {
- activate_databrowse((ID*)settings->imapaint.brush, ID_BR, 0, B_SIMABRUSHBROWSE, &G.sima->menunr, do_global_buttons);
- break;
- }
- else if(G.sima->menunr < 0) break;
-
- if(brush_set_nr(&settings->imapaint.brush, G.sima->menunr)) {
- BIF_undo_push("Browse Brush");
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWIMAGE, 0);
- }
- break;
- case B_SIMABRUSHDELETE:
- if(brush_delete(&settings->imapaint.brush)) {
- BIF_undo_push("Unlink Brush");
- allqueue(REDRAWIMAGE, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- }
- break;
- case B_KEEPDATA:
- brush_toggle_fake_user(settings->imapaint.brush);
- allqueue(REDRAWIMAGE, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- break;
- case B_SIMABRUSHLOCAL:
- if(settings->imapaint.brush && settings->imapaint.brush->id.lib) {
- if(okee("Make local")) {
- make_local_brush(settings->imapaint.brush);
- allqueue(REDRAWIMAGE, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- }
- }
- break;
- case B_SIMABTEXBROWSE:
- if(settings->imapaint.brush) {
- Brush *brush= settings->imapaint.brush;
-
- if(G.sima->menunr==-2) {
- MTex *mtex= brush->mtex[brush->texact];
- ID *id= (ID*)((mtex)? mtex->tex: NULL);
- if(G.qual & LR_CTRLKEY) {
- activate_databrowse_imasel(id, ID_TE, 0, B_SIMABTEXBROWSE, &G.sima->menunr, do_image_buttons);
- } else {
- activate_databrowse(id, ID_TE, 0, B_SIMABTEXBROWSE, &G.sima->menunr, do_image_buttons);
- }
- break;
- }
- else if(G.sima->menunr < 0) break;
-
- if(brush_texture_set_nr(brush, G.sima->menunr)) {
- BIF_undo_push("Browse Brush Texture");
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWIMAGE, 0);
- }
- }
- break;
- case B_SIMABTEXDELETE:
- if(settings->imapaint.brush) {
- if (brush_texture_delete(settings->imapaint.brush)) {
- BIF_undo_push("Unlink Brush Texture");
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWIMAGE, 0);
- }
- }
- break;
- case B_SIMA_PLAY:
- play_anim(0);
- break;
- case B_SIMA_RECORD:
- imagespace_composite_flipbook(curarea);
- break;
- }
-}
-
-static void do_image_buttons_set_uvlayer_callback(void *act, void *data)
-{
- CustomData_set_layer_active(&G.editMesh->fdata, CD_MTFACE, *((int *)act));
-
- BIF_undo_push("Set Active UV Texture");
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWIMAGE, 0);
-}
-
-static void do_image_view_viewnavmenu(void *arg, int event)
-{
- switch(event) {
- case 1: /* Zoom In */
- image_viewzoom(PADPLUSKEY, 0);
- break;
- case 2: /* Zoom Out */
- image_viewzoom(PADMINUS, 0);
- break;
- case 3: /* Zoom 8:1 */
- image_viewzoom(PAD8, 0);
- break;
- case 4: /* Zoom 4:1 */
- image_viewzoom(PAD4, 0);
- break;
- case 5: /* Zoom 2:1 */
- image_viewzoom(PAD2, 0);
- break;
- case 6: /* Zoom 1:1 */
- image_viewzoom(PAD1, 0);
- break;
- case 7: /* Zoom 1:2 */
- image_viewzoom(PAD2, 1);
- break;
- case 8: /* Zoom 1:4 */
- image_viewzoom(PAD4, 1);
- break;
- case 9: /* Zoom 1:8 */
- image_viewzoom(PAD8, 1);
- break;
- }
- allqueue(REDRAWIMAGE, 0);
-}
-
-static uiBlock *image_view_viewnavmenu(void *arg_unused)
-{
-/* static short tog=0; */
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "image_view_viewnavmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_image_view_viewnavmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Zoom In|NumPad +", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Zoom Out|NumPad -", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Zoom 1:8|Shift+NumPad 8", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Zoom 1:4|Shift+NumPad 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Zoom 1:2|Shift+NumPad 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Zoom 1:1|NumPad 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Zoom 2:1|NumPad 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Zoom 4:1|NumPad 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Zoom 8:1|NumPad 8", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 9, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 50);
- return block;
-}
-
-static void do_image_viewmenu(void *arg, int event)
-{
-
- switch(event) {
- case 0: /* Update Automatically */
- if(G.sima->lock) G.sima->lock = 0;
- else G.sima->lock = 1;
- break;
- case 1: /* View All */
- do_image_buttons(B_SIMAGEHOME);
- break;
- case 2: /* Maximize Window */
- /* using event B_FULL */
- break;
- case 4: /* Realtime Panel... */
- add_blockhandler(curarea, IMAGE_HANDLER_VIEW_PROPERTIES, UI_PNL_UNSTOW);
- break;
- case 5: /* Draw Shadow Mesh */
- G.sima->flag ^= SI_DRAWSHADOW;
- allqueue(REDRAWIMAGE, 0);
- break;
- case 6: /* Draw Faces */
- G.f ^= G_DRAWFACES;
- allqueue(REDRAWIMAGE, 0);
- break;
- case 7: /* Properties Panel */
- add_blockhandler(curarea, IMAGE_HANDLER_PROPERTIES, UI_PNL_UNSTOW);
- break;
- case 8: /* Paint Panel... */
- add_blockhandler(curarea, IMAGE_HANDLER_PAINT, UI_PNL_UNSTOW);
- break;
- case 9:
- image_viewcenter();
- case 10: /* Display Normalized Coordinates */
- G.sima->flag ^= SI_COORDFLOATS;
- allqueue(REDRAWIMAGE, 0);
- break;
- case 11: /* Curves Panel... */
- add_blockhandler(curarea, IMAGE_HANDLER_CURVES, UI_PNL_UNSTOW);
- break;
- case 12: /* composite preview */
- toggle_blockhandler(curarea, IMAGE_HANDLER_PREVIEW, 0);
- scrarea_queue_winredraw(curarea);
- break;
- case 13: /* Realtime Panel... */
- add_blockhandler(curarea, IMAGE_HANDLER_GAME_PROPERTIES, UI_PNL_UNSTOW);
- break;
- case 14: /* Draw active image UV's only*/
- G.sima->flag ^= SI_LOCAL_UV;
- allqueue(REDRAWIMAGE, 0);
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *image_viewmenu(void *arg_unused)
-{
-/* static short tog=0; */
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "image_viewmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_image_viewmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "View Properties...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Image Properties...|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Real-time Properties...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 13, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Paint Tool...|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Curves Tool...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 11, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Composite Preview...|Shift P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 12, "");
-
- if(G.sima->flag & SI_COORDFLOATS) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Display Normalized Coordinates|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 10, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Display Normalized Coordinates|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 10, "");
- if(G.f & G_DRAWFACES) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Draw Faces", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Draw Faces|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
- if(G.sima->flag & SI_DRAWSHADOW) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Draw Shadow Mesh", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Draw Shadow Mesh|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- if(G.sima->flag & SI_LOCAL_UV) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "UV Local View|NumPad /", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 14, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "UV Local View|NumPad /", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 14, "");
- if(!(G.sima->flag & SI_LOCAL_UV)) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "UV Global View|NumPad /", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 14, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "UV Global View|NumPad /", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 14, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, image_view_viewnavmenu, NULL, ICON_RIGHTARROW_THIN, "View Navigation", 0, yco-=20, 120, 19, "");
-
- if(G.sima->lock) {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Update Automatically|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
- } else {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Update Automatically|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
- }
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "View Selected|NumPad .", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 9, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "View All|Home", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
-
- if(!curarea->full) uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Maximize Window|Ctrl UpArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
- else uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Tile Window|Ctrl DownArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-static void do_image_selectmenu(void *arg, int event)
-{
- switch(event)
- {
- case 0: /* Border Select */
- borderselect_sima(UV_SELECT_ALL);
- break;
- case 8: /* Border Select Pinned */
- borderselect_sima(UV_SELECT_PINNED);
- break;
- case 1: /* Select/Deselect All */
- select_swap_tface_uv();
- break;
- case 9: /* Select Inverse */
- select_invert_tface_uv();
- break;
- case 2: /* Unlink Selection */
- unlink_selection();
- break;
- case 3: /* Linked UVs */
- select_linked_tface_uv(2);
- break;
- case 6: /* Toggle Active Face Select */
- if(G.sima->flag & SI_SELACTFACE)
- G.sima->flag &= ~SI_SELACTFACE;
- else
- G.sima->flag |= SI_SELACTFACE;
- allqueue(REDRAWIMAGE, 0);
- break;
- case 7: /* Pinned UVs */
- select_pinned_tface_uv();
- break;
- }
-}
-
-static uiBlock *image_selectmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "image_selectmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_image_selectmenu, NULL);
-
-
- if ((G.sima->flag & SI_SYNC_UVSEL)==0 || (G.sima->flag & SI_SYNC_UVSEL && (G.scene->selectmode != SCE_SELECT_FACE))) {
- if(G.sima->flag & SI_SELACTFACE) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Active Face Select|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Active Face Select|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- }
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select Pinned|Shift B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Inverse", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 9, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Unlink Selection|Alt L", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Pinned UVs|Shift P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Linked UVs|Ctrl L", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-static void do_image_image_rtmappingmenu(void *arg, int event)
-{
- switch(event) {
- case 0: /* UV Co-ordinates */
- G.sima->image->flag &= ~IMA_REFLECT;
- break;
- case 1: /* Reflection */
- G.sima->image->flag |= IMA_REFLECT;
- break;
- }
-
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *image_image_rtmappingmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "image_image_rtmappingmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_image_image_rtmappingmenu, NULL);
-
- if (G.sima->image->flag & IMA_REFLECT) {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "UV Co-ordinates", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Reflection", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- } else {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "UV Co-ordinates", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Reflection", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- }
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_image_imagemenu(void *arg, int event)
-{
- /* events >=20 are registered bpython scripts */
- if (event >= 20) BPY_menu_do_python(PYMENU_IMAGE, event - 20);
-
- switch(event)
- {
- case 0:
- open_image_sima((G.qual==LR_CTRLKEY));
- break;
- case 1:
- replace_image_sima((G.qual==LR_CTRLKEY));
- break;
- case 2:
- pack_image_sima();
- break;
- case 4: /* Texture Painting */
- brush_check_exists(&G.scene->toolsettings->imapaint.brush);
- if(G.sima->flag & SI_DRAWTOOL) G.sima->flag &= ~SI_DRAWTOOL;
- else G.sima->flag |= SI_DRAWTOOL;
- allqueue(REDRAWBUTSSHADING, 0);
- break;
- case 5:
- save_as_image_sima();
- break;
- case 6:
- reload_image_sima();
- break;
- case 7:
- new_image_sima();
- break;
- case 8:
- save_image_sima();
- break;
- case 9:
- save_image_sequence_sima();
- break;
- case 10:
- BKE_image_memorypack(G.sima->image);
- allqueue(REDRAWIMAGE, 0);
- break;
- }
-}
-
-static uiBlock *image_imagemenu(void *arg_unused)
-{
- ImBuf *ibuf= BKE_image_get_ibuf(G.sima->image, &G.sima->iuser);
- uiBlock *block;
- short yco= 0, menuwidth=150;
- BPyMenu *pym;
- int i = 0;
-
- block= uiNewBlock(&curarea->uiblocks, "image_imagemenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_image_imagemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "New...|Alt N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Open...|Alt O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
-
- if (G.sima->image) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Replace...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Reload|Alt R", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Save|Alt S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Save As...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, "");
- if(G.sima->image->source==IMA_SRC_SEQUENCE)
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Save Changed Images", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 9, "");
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- if (G.sima->image->packedfile) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Unpack Image...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
- } else {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Pack Image", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
- }
-
- /* only for dirty && specific image types */
- if(ibuf && (ibuf->userflags & IB_BITMAPDIRTY))
- if( ELEM(G.sima->image->source, IMA_SRC_FILE, IMA_SRC_GENERATED))
- if(G.sima->image->type!=IMA_TYPE_MULTILAYER)
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Pack Image as PNG", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 10, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=7, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- if(G.sima->flag & SI_DRAWTOOL) {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Texture Painting", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
- } else {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Texture Painting", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
- }
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=7, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, image_image_rtmappingmenu, NULL, ICON_RIGHTARROW_THIN, "Realtime Texture Mapping", 0, yco-=20, 120, 19, "");
- // uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Realtime Texture Animation|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
- }
-
- /* note that we acount for the N previous entries with i+20: */
- for (pym = BPyMenuTable[PYMENU_IMAGE]; pym; pym = pym->next, i++) {
-
- uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20, menuwidth, 19,
- NULL, 0.0, 0.0, 1, i+20,
- pym->tooltip?pym->tooltip:pym->filename);
- }
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 80);
-
- return block;
-}
-
-static void do_image_uvs_showhidemenu(void *arg, int event)
-{
- switch(event) {
- case 4: /* show hidden faces */
- reveal_tface_uv();
- break;
- case 5: /* hide selected faces */
- hide_tface_uv(0);
- break;
- case 6: /* hide deselected faces */
- hide_tface_uv(1);
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *image_uvs_showhidemenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "image_uvs_showhidemenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_image_uvs_showhidemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hidden Faces|Alt H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Selected Faces|H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Deselected Faces|Shift H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_image_uvs_propfalloffmenu(void *arg, int event)
-{
- G.scene->prop_mode= event;
- allqueue(REDRAWVIEW3D, 1);
-}
-
-static uiBlock *image_uvs_propfalloffmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "image_uvs_propfalloffmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_image_uvs_propfalloffmenu, NULL);
-
- if (G.scene->prop_mode==PROP_SMOOTH) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Smooth|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SMOOTH, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Smooth|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SMOOTH, "");
- if (G.scene->prop_mode==PROP_SPHERE) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Sphere|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SPHERE, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Sphere|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SPHERE, "");
- if (G.scene->prop_mode==PROP_ROOT) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Root|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_ROOT, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Root|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_ROOT, "");
- if (G.scene->prop_mode==PROP_SHARP) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Sharp|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SHARP, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Sharp|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SHARP, "");
- if (G.scene->prop_mode==PROP_LIN) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Linear|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_LIN, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Linear|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_LIN, "");
- if (G.scene->prop_mode==PROP_CONST) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Constant|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_CONST, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Constant|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_CONST, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_image_uvs_transformmenu(void *arg, int event)
-{
- switch(event) {
- case 0: /* Grab */
- initTransform(TFM_TRANSLATION, CTX_NONE);
- Transform();
- break;
- case 1: /* Rotate */
- initTransform(TFM_ROTATION, CTX_NONE);
- Transform();
- break;
- case 2: /* Scale */
- initTransform(TFM_RESIZE, CTX_NONE);
- Transform();
- break;
- }
-}
-
-static uiBlock *image_uvs_transformmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "image_uvs_transformmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_image_uvs_transformmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Grab/Move|G", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Rotate|R", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Scale|S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_image_uvs_mirrormenu(void *arg, int event)
-{
- switch(event) {
- case 0: /* X axis */
- mirror_tface_uv('x');
- break;
- case 1: /* Y axis */
- mirror_tface_uv('y');
- break;
- }
-
- BIF_undo_push("Mirror UV");
-}
-
-static uiBlock *image_uvs_mirrormenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "image_uvs_mirrormenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_image_uvs_mirrormenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "X Axis|M, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Y Axis|M, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_image_uvs_weldalignmenu(void *arg, int event)
-{
- switch(event) {
- case 0: /* Weld */
- weld_align_tface_uv('w');
- break;
- case 1: /* Align X */
- weld_align_tface_uv('x');
- break;
- case 2: /* Align Y */
- weld_align_tface_uv('y');
- break;
- }
-
- if(event==0) BIF_undo_push("Weld UV");
- else if(event==1 || event==2) BIF_undo_push("Align UV");
-}
-
-static uiBlock *image_uvs_weldalignmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "image_uvs_weldalignmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_image_uvs_weldalignmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Weld|W, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Align X|W, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Align Y|W, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_image_uvs_scriptsmenu(void *arg, int event)
-{
- BPY_menu_do_python(PYMENU_UV, event);
-
- allqueue(REDRAWIMAGE, 0);
-}
-
-static uiBlock *image_uvs_scriptsmenu (void *args_unused)
-{
- uiBlock *block;
- BPyMenu *pym;
- int i= 0;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "image_uvs_scriptsmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_image_uvs_scriptsmenu, NULL);
-
- /* note that we acount for the N previous entries with i+20: */
- for (pym = BPyMenuTable[PYMENU_UV]; pym; pym = pym->next, i++) {
-
- uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20, menuwidth, 19,
- NULL, 0.0, 0.0, 1, i,
- pym->tooltip?pym->tooltip:pym->filename);
- }
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-
-static void do_image_uvsmenu(void *arg, int event)
-{
-
- switch(event) {
-// case 0: /* UV Transform Properties Panel... */
-// add_blockhandler(curarea, IMAGE_HANDLER_TRANSFORM_PROPERTIES, UI_PNL_UNSTOW);
-// break;
- case 1: /* UVs Constrained Rectangular */
- if(G.sima->flag & SI_BE_SQUARE) G.sima->flag &= ~SI_BE_SQUARE;
- else G.sima->flag |= SI_BE_SQUARE;
- break;
- case 2: /* UVs Clipped to Image Size */
- if(G.sima->flag & SI_CLIP_UV) G.sima->flag &= ~SI_CLIP_UV;
- else G.sima->flag |= SI_CLIP_UV;
- break;
- case 3: /* Limit Stitch UVs */
- stitch_limit_uv_tface();
- break;
- case 4: /* Stitch UVs */
- stitch_vert_uv_tface();
- break;
- case 5: /* Proportional Edit (toggle) */
- if(G.scene->proportional)
- G.scene->proportional= 0;
- else
- G.scene->proportional= 1;
- break;
- case 7: /* UVs Snap to Pixel */
- G.sima->flag ^= SI_PIXELSNAP;
- break;
- case 8:
- pin_tface_uv(1);
- break;
- case 9:
- pin_tface_uv(0);
- break;
- case 10:
- unwrap_lscm(0);
- break;
- case 11:
- if(G.sima->flag & SI_LIVE_UNWRAP) G.sima->flag &= ~SI_LIVE_UNWRAP;
- else G.sima->flag |= SI_LIVE_UNWRAP;
- break;
- case 12:
- minimize_stretch_tface_uv();
- break;
- case 13:
- pack_charts_tface_uv();
- break;
- }
-}
-
-static uiBlock *image_uvsmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "image_uvsmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_image_uvsmenu, NULL);
-
- //uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Transform Properties...|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- if(G.sima->flag & SI_PIXELSNAP) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Snap to Pixels|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Snap to Pixels|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
-
- if(G.sima->flag & SI_BE_SQUARE) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Quads Constrained Rectangular|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Quads Constrained Rectangular|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
-
- if(G.sima->flag & SI_CLIP_UV) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Layout Clipped to Image Size|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Layout Clipped to Image Size|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- if(G.sima->flag & SI_LIVE_UNWRAP) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Live Unwrap Transform", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 11, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Live Unwrap Transform", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 11, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Unwrap|E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 10, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Unpin|Alt P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 9, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Pin|P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Pack Charts|Ctrl P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 13, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Minimize Stretch|Ctrl V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 12, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Limit Stitch...|Shift V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Stitch|V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, image_uvs_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, image_uvs_mirrormenu, NULL, ICON_RIGHTARROW_THIN, "Mirror", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, image_uvs_weldalignmenu, NULL, ICON_RIGHTARROW_THIN, "Weld/Align", 0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- if(G.scene->proportional)
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Proportional Editing|O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
- else
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Proportional Editing|O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
-
- uiDefIconTextBlockBut(block, image_uvs_propfalloffmenu, NULL, ICON_RIGHTARROW_THIN, "Proportional Falloff", 0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, image_uvs_showhidemenu, NULL, ICON_RIGHTARROW_THIN, "Show/Hide Faces", 0, yco-=20, menuwidth, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, image_uvs_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Scripts", 0, yco-=20, 120, 19, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-void image_buttons(void)
-{
- Image *ima;
- ImBuf *ibuf;
- uiBlock *block;
- short xco, xmax;
- char naam[256], *menuname;
- char is_render; /* true if the image is a render or composite */
-
- int allow_pin= B_SIMAPIN;
-
- /* This should not be a static var */
- static int headerbuttons_packdummy;
-
-
- is_render = ((G.sima->image!=NULL) && ((G.sima->image->type == IMA_TYPE_R_RESULT) || (G.sima->image->type == IMA_TYPE_COMPOSITE)));
-
- headerbuttons_packdummy = 0;
-
- sprintf(naam, "header %d", curarea->headwin);
- block= uiNewBlock(&curarea->uiblocks, naam, UI_EMBOSS, UI_HELV, curarea->headwin);
-
- if(area_is_active_area(curarea)) uiBlockSetCol(block, TH_HEADER);
- else uiBlockSetCol(block, TH_HEADERDESEL);
-
- what_image(G.sima);
- ima= G.sima->image;
- ibuf= BKE_image_get_ibuf(ima, &G.sima->iuser);
-
- curarea->butspacetype= SPACE_IMAGE;
-
- xco = 8;
- uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D, windowtype_pup(), xco,0,XIC+10,YIC, &(curarea->butspacetype), 1.0, SPACEICONMAX, 0, 0, "Current Window Type. Click for menu of available types.");
- xco+= XIC+14;
-
- uiBlockSetEmboss(block, UI_EMBOSSN);
- if(curarea->flag & HEADER_NO_PULLDOWN) {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, B_FLIPINFOMENU, ICON_DISCLOSURE_TRI_RIGHT,
- xco,2,XIC,YIC-2,
- &(curarea->flag), 0, 0, 0, 0, "Show pulldown menus");
- } else {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, B_FLIPINFOMENU, ICON_DISCLOSURE_TRI_DOWN,
- xco,2,XIC,YIC-2,
- &(curarea->flag), 0, 0, 0, 0, "Hide pulldown menus");
- }
- uiBlockSetEmboss(block, UI_EMBOSS);
- xco+=XIC;
-
- if((curarea->flag & HEADER_NO_PULLDOWN)==0) {
-
- /* pull down menus */
- uiBlockSetEmboss(block, UI_EMBOSSP);
-
- xmax= GetButStringLength("View");
- uiDefPulldownBut(block, image_viewmenu, NULL, "View", xco, -2, xmax-3, 24, "");
- xco+= xmax;
-
- if((EM_texFaceCheck()) && !(ima && (G.sima->flag & SI_DRAWTOOL))) {
- xmax= GetButStringLength("Select");
- uiDefPulldownBut(block, image_selectmenu, NULL, "Select", xco, -2, xmax-3, 24, "");
- xco+= xmax;
- }
-
- if (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))
- menuname= "Image*";
- else
- menuname= "Image";
- xmax= GetButStringLength(menuname);
- uiDefPulldownBut(block, image_imagemenu, NULL, menuname, xco, -2, xmax-3, 24, "");
- xco+= xmax;
- if((EM_texFaceCheck()) && !(ima && (G.sima->flag & SI_DRAWTOOL))) {
- xmax= GetButStringLength("UVs");
- uiDefPulldownBut(block, image_uvsmenu, NULL, "UVs", xco, -2, xmax-3, 24, "");
- xco+= xmax;
- }
- }
-
- /* other buttons: */
- uiBlockSetEmboss(block, UI_EMBOSS);
-
- if (is_render)
- allow_pin = 0;
-
- xco= 8 + std_libbuttons(block, xco, 0, allow_pin, &G.sima->pin, B_SIMABROWSE, ID_IM, 0, (ID *)ima, 0, &(G.sima->imanr), 0, 0, B_IMAGEDELETE, 0, 0);
-
- if( ima && !ELEM3(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE, IMA_SRC_VIEWER) && ima->ok) {
-
- if (ima->packedfile) {
- headerbuttons_packdummy = 1;
- }
- if (ima->packedfile && ibuf && (ibuf->userflags & IB_BITMAPDIRTY))
- uiDefIconButBitI(block, TOG, 1, B_SIMA_REPACK, ICON_UGLYPACKAGE, xco,0,XIC,YIC, &headerbuttons_packdummy, 0, 0, 0, 0, "Re-Pack this image as PNG");
- else
- uiDefIconButBitI(block, TOG, 1, B_SIMAPACKIMA, ICON_PACKAGE, xco,0,XIC,YIC, &headerbuttons_packdummy, 0, 0, 0, 0, "Pack/Unpack this image");
-
- xco+= XIC+8;
- }
-
- /* UV EditMode buttons, not painting or rencering or compositing */
- if ( EM_texFaceCheck() && (G.sima->flag & SI_DRAWTOOL)==0 && !is_render) {
- uiBut *ubut;
- int layercount;
-
- uiDefIconTextButS(block, ICONTEXTROW, B_NOP, ICON_ROTATE,
- "Pivot: %t|Bounding Box Center %x0|Median Point %x3|2D Cursor %x1",
- xco,0,XIC+10,YIC, &(G.v2d->around), 0, 3.0, 0, 0,
- "Rotation/Scaling Pivot (Hotkeys: Comma, Shift Comma, Period)");
- xco+= XIC + 18;
-
- uiBlockBeginAlign(block);
- uiDefIconButBitI(block, TOGN, SI_SYNC_UVSEL, B_REDR, ICON_NO_GO_LEFT, xco,0,XIC,YIC, &G.sima->flag, 0, 0, 0, 0, "Mesh independant selection");
- xco+= XIC;
- if ((G.sima->flag & SI_SYNC_UVSEL)==0) {
-
- /* would use these if const's could go in strings
- * SI_STICKY_LOC SI_STICKY_DISABLE SI_STICKY_VERTEX */
- ubut = uiDefIconTextButC(block, ICONTEXTROW, B_REDR, ICON_STICKY_UVS_LOC,
- "Sticky UV Selection: %t|Disable%x1|Shared Location%x0|Shared Vertex%x2",
- xco,0,XIC+10,YIC, &(G.sima->sticky), 0, 3.0, 0, 0,
- "Sticky UV Selection (Hotkeys: Shift C, Alt C, Ctrl C)");
- xco+= XIC + 16;
-
- } else {
- xco+= 6;
- }
- uiBlockEndAlign(block);
-
- /* Snap copied right out of view3d header */
- uiBlockBeginAlign(block);
-
- if (G.scene->snap_flag & SCE_SNAP) {
- uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEO,xco,0,XIC,YIC, &G.scene->snap_flag, 0, 0, 0, 0, "Use Snap or Grid (Shift Tab)");
- xco+= XIC;
- uiDefButS(block, MENU, B_NOP, "Mode%t|Closest%x0|Center%x1|Median%x2",xco,0,70,YIC, &G.scene->snap_target, 0, 0, 0, 0, "Snap Target Mode");
- xco+= 70;
- } else {
- uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEAR,xco,0,XIC,YIC, &G.scene->snap_flag, 0, 0, 0, 0, "Snap while Ctrl is held during transform (Shift Tab)");
- xco+= XIC;
- }
-
- uiBlockEndAlign(block);
- xco+= 10;
- /* end snap */
-
- /* Layer Menu */
- layercount = CustomData_number_of_layers(&G.editMesh->fdata, CD_MTFACE);
- if (layercount>1 && layercount < 12) { /* could allow any number but limit of 11 means no malloc needed */
- static int act;
- char str_menu[384], *str_pt; /*384 allows for 11 layers */
-
-
- act = CustomData_get_active_layer(&G.editMesh->fdata, CD_MTFACE);
-
- /*str_pt = (char *)MEM_mallocN(layercount*40 , "uvmenu"); str[0]='\0';*/
- str_pt = str_menu;
- str_pt[0]='\0';
- mesh_layers_menu_concat(&G.editMesh->fdata, CD_MTFACE, str_pt);
- ubut = uiDefButI(block, MENU, B_NOP, str_menu ,xco,0,85,YIC, &act, 0, 0, 0, 0, "Active UV Layer for editing");
- uiButSetFunc(ubut, do_image_buttons_set_uvlayer_callback, &act, NULL);
-
- /*MEM_freeN(str);*/
- xco+= 90;
- }
- }
-
- if (ima) {
- RenderResult *rr= BKE_image_get_renderresult(ima);
-
- xco+= 8;
-
- if(rr) {
- uiBlockBeginAlign(block);
- uiblock_layer_pass_buttons(block, rr, &G.sima->iuser, B_REDR, xco, 0, 160);
- uiBlockEndAlign(block);
- xco+= 166;
- }
- uiDefIconButBitI(block, TOG, SI_DRAWTOOL, B_SIMAGEPAINTTOOL, ICON_TPAINT_HLT, xco,0,XIC,YIC, &G.sima->flag, 0, 0, 0, 0, "Enables painting textures on the image with left mouse button");
-
- xco+= XIC+8;
-
- uiBlockBeginAlign(block);
- if(ibuf==NULL || ibuf->channels==4) {
- uiDefIconButBitI(block, TOG, SI_USE_ALPHA, B_SIMA_USE_ALPHA, ICON_TRANSP_HLT, xco,0,XIC,YIC, &G.sima->flag, 0, 0, 0, 0, "Draws image with alpha");
- xco+= XIC;
- uiDefIconButBitI(block, TOG, SI_SHOW_ALPHA, B_SIMA_SHOW_ALPHA, ICON_DOT, xco,0,XIC,YIC, &G.sima->flag, 0, 0, 0, 0, "Draws only alpha");
- xco+= XIC;
- }
- if(ibuf) {
- if(ibuf->zbuf || ibuf->zbuf_float || (ibuf->channels==1)) {
- uiDefIconButBitI(block, TOG, SI_SHOW_ZBUF, B_SIMA_SHOW_ZBUF, ICON_SOLID, xco,0,XIC,YIC, &G.sima->flag, 0, 0, 0, 0, "Draws zbuffer values");
- xco+= XIC;
- }
- }
- xco+= 8;
-
- uiBlockBeginAlign(block);
- if(ima->type==IMA_TYPE_COMPOSITE) {
- uiDefIconBut(block, BUT, B_SIMA_RECORD, ICON_REC, xco, 0, XIC, YIC, 0, 0, 0, 0, 0, "Record Composite");
- xco+= XIC;
- }
- if((ima->type==IMA_TYPE_COMPOSITE) || ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
- uiDefIconBut(block, BUT, B_SIMA_PLAY, ICON_PLAY, xco, 0, XIC, YIC, 0, 0, 0, 0, 0, "Play");
- xco+= XIC;
- }
- uiBlockEndAlign(block);
- xco+= 8;
- }
-
- /* draw LOCK */
- uiDefIconButS(block, ICONTOG, 0, ICON_UNLOCKED, xco,0,XIC,YIC, &(G.sima->lock), 0, 0, 0, 0, "Updates other affected window spaces automatically to reflect changes in real time");
-
- /* Always do this last */
- curarea->headbutlen= xco+2*XIC;
-
- uiDrawBlock(block);
-}
-
diff --git a/source/blender/src/header_imasel.c b/source/blender/src/header_imasel.c
deleted file mode 100644
index 1402e8c244e..00000000000
--- a/source/blender/src/header_imasel.c
+++ /dev/null
@@ -1,211 +0,0 @@
-/**
- * header_imasel.c oct-2003
- *
- * Functions to draw the "Image Browser" window header
- * and handle user events sent to it.
- *
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "BMF_Api.h"
-
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_utildefines.h"
-
-#include "DNA_ID.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_userdef_types.h"
-
-#include "BIF_filelist.h"
-#include "BIF_gl.h"
-#include "BIF_imasel.h"
-#include "BIF_interface.h"
-#include "BIF_language.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BSE_headerbuttons.h"
-
-#include "blendef.h"
-
-
-void do_imasel_buttons(short event)
-{
- SpaceImaSel *simasel;
-
- simasel= curarea->spacedata.first;
-
- if(curarea->win==0) return;
-
- switch(event) {
- case B_SORTIMASELLIST:
- BIF_filelist_sort(simasel->files, simasel->sort);
- scrarea_queue_winredraw(curarea);
- break;
-
- case B_RELOADIMASELDIR:
- BIF_filelist_free(simasel->files);
- scrarea_queue_winredraw(curarea);
- break;
- case B_FILTERIMASELDIR:
- if (simasel->flag & FILE_FILTER) {
- BIF_filelist_setfilter(simasel->files,simasel->filter);
- BIF_filelist_filter(simasel->files);
- scrarea_queue_winredraw(curarea);
- } else {
- BIF_filelist_setfilter(simasel->files,0);
- BIF_filelist_filter(simasel->files);
- scrarea_queue_winredraw(curarea);
- }
- break;
- }
-}
-
-void imasel_buttons(void)
-{
- SpaceImaSel *simasel;
- uiBlock *block;
- short xco, xcotitle;
- char naam[256];
- char dir[FILE_MAXDIR], group[32];
- short type;
- int do_filter = 0;
-
- simasel= curarea->spacedata.first;
-
- sprintf(naam, "header %d", curarea->headwin);
- block= uiNewBlock(&curarea->uiblocks, naam, UI_EMBOSS, UI_HELV, curarea->headwin);
-
- if(area_is_active_area(curarea)) uiBlockSetCol(block, TH_HEADER);
- else uiBlockSetCol(block, TH_HEADERDESEL);
-
- curarea->butspacetype= SPACE_IMASEL;
-
- xco = 8;
-
- uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D, windowtype_pup(), xco,0,XIC+10,YIC, &(curarea->butspacetype), 1.0, SPACEICONMAX, 0, 0, "Displays Current Window Type. Click for menu of available types.");
-
- xco+= XIC+22;
-
- /* FULL WINDOW */
- if(curarea->full) uiDefIconBut(block, BUT,B_FULL, ICON_SPLITSCREEN, xco,0,XIC,YIC, 0, 0, 0, 0, 0, "");
- else uiDefIconBut(block, BUT,B_FULL, ICON_FULLSCREEN, xco,0,XIC,YIC, 0, 0, 0, 0, 0, "");
-
- /* SORT TYPE */
- xco+=XIC;
- uiBlockBeginAlign(block);
- uiDefIconButS(block, ROW, B_SORTIMASELLIST, ICON_SORTALPHA, xco+=XIC,0,XIC,YIC, &simasel->sort, 1.0, 0.0, 0, 0, "Sorts files alphabetically");
- uiDefIconButS(block, ROW, B_SORTIMASELLIST, ICON_SORTBYEXT, xco+=XIC,0,XIC,YIC, &simasel->sort, 1.0, 3.0, 0, 0, "Sorts files by extension");
- uiDefIconButS(block, ROW, B_SORTIMASELLIST, ICON_SORTTIME, xco+=XIC,0,XIC,YIC, &simasel->sort, 1.0, 1.0, 0, 0, "Sorts files by time");
- uiDefIconButS(block, ROW, B_SORTIMASELLIST, ICON_SORTSIZE, xco+=XIC,0,XIC,YIC, &simasel->sort, 1.0, 2.0, 0, 0, "Sorts files by size");
- uiBlockEndAlign(block);
-
- cpack(0x0);
- xco+=XIC+10;
- uiDefIconButBitS(block, TOG, FILE_BOOKMARKS, B_RELOADIMASELDIR, ICON_BOOKMARKS,xco+=XIC,0,XIC,YIC, &simasel->flag, 0, 0, 0, 0, "Toggles Bookmarks on/off");
- xco+=XIC+10;
-
- xcotitle= xco;
- xco+= BIF_GetStringWidth(G.font, simasel->title, (U.transopts & USER_TR_BUTTONS));
-
- if(simasel->pupmenu && simasel->menup) {
- uiDefButS(block, MENU, B_NOP, simasel->pupmenu, xco+10,0,90,20, simasel->menup, 0, 0, 0, 0, "");
- xco+= 100;
- }
- uiBlockBeginAlign(block);
- uiDefIconButBitS(block, TOG, FILE_HIDE_DOT, B_RELOADIMASELDIR, ICON_GHOST,xco+=XIC,0,XIC,YIC, &simasel->flag, 0, 0, 0, 0, "Hides dot files");
- uiBlockEndAlign(block);
- xco+=20;
-
- type = simasel->type;
- if (type == FILE_LOADLIB) {
- do_filter = !BIF_filelist_islibrary(simasel->files, dir, group);
- } else {
- do_filter = (type != FILE_MAIN);
- }
- if ( do_filter ) {
- uiDefIconButBitS(block, TOG, FILE_FILTER, B_FILTERIMASELDIR, ICON_SORTBYEXT,xco+=XIC,0,XIC,YIC, &simasel->flag, 0, 0, 0, 0, "Filter files");
- if (simasel->flag & FILE_FILTER) {
- xco+=4;
- uiBlockBeginAlign(block);
- uiDefIconButBitS(block, TOG, IMAGEFILE, B_FILTERIMASELDIR, ICON_IMAGE_COL,xco+=XIC,0,XIC,YIC, &simasel->filter, 0, 0, 0, 0, "Show images");
- uiDefIconButBitS(block, TOG, BLENDERFILE, B_FILTERIMASELDIR, ICON_BLENDER,xco+=XIC,0,XIC,YIC, &simasel->filter, 0, 0, 0, 0, "Show .blend files");
- uiDefIconButBitS(block, TOG, MOVIEFILE, B_FILTERIMASELDIR, ICON_SEQUENCE,xco+=XIC,0,XIC,YIC, &simasel->filter, 0, 0, 0, 0, "Show movies");
- uiDefIconButBitS(block, TOG, PYSCRIPTFILE, B_FILTERIMASELDIR, ICON_PYTHON,xco+=XIC,0,XIC,YIC, &simasel->filter, 0, 0, 0, 0, "Show python scripts");
- uiDefIconButBitS(block, TOG, FTFONTFILE, B_FILTERIMASELDIR, ICON_SYNTAX,xco+=XIC,0,XIC,YIC, &simasel->filter, 0, 0, 0, 0, "Show fonts");
- uiDefIconButBitS(block, TOG, SOUNDFILE, B_FILTERIMASELDIR, ICON_SOUND,xco+=XIC,0,XIC,YIC, &simasel->filter, 0, 0, 0, 0, "Show sound files");
- uiDefIconButBitS(block, TOG, TEXTFILE, B_FILTERIMASELDIR, ICON_TEXT,xco+=XIC,0,XIC,YIC, &simasel->filter, 0, 0, 0, 0, "Show text files");
- uiDefIconButBitS(block, TOG, FOLDERFILE, B_FILTERIMASELDIR, ICON_FILESEL,xco+=XIC,0,XIC,YIC, &simasel->filter, 0, 0, 0, 0, "Show folders");
- uiBlockEndAlign(block);
- }
- }
-
- uiDefButBitS(block, TOG, FILE_STRINGCODE, 0, "Relative Paths", xco+=XIC+20,0,100,YIC, &simasel->flag, 0, 0, 0, 0, "Makes sure returned paths are relative to the current .blend file");
- xco+=90;
-
- if(simasel->type==FILE_LOADLIB) {
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOGN, FILE_LINK, B_REDR, "Append", xco+=XIC,0,100,YIC, &simasel->flag, 0, 0, 0, 0, "Copies selected data into current project");
- uiDefButBitS(block, TOG, FILE_LINK, B_REDR, "Link", xco+=100,0,100,YIC, &simasel->flag, 0, 0, 0, 0, "Creates a link to selected data from current project");
- uiBlockEndAlign(block);
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, FILE_AUTOSELECT, B_REDR, "Autosel", xco+=125,0,65,YIC, &simasel->flag, 0, 0, 0, 0, "Autoselect imported objects");
- uiDefButBitS(block, TOG, FILE_ACTIVELAY, B_REDR, "Active Layer", xco+=65,0,80,YIC, &simasel->flag, 0, 0, 0, 0, "Append object(s) in active layer");
- uiDefButBitS(block, TOG, FILE_ATCURSOR, B_REDR, "At Cursor", xco+=80,0,65,YIC, &simasel->flag, 0, 0, 0, 0, "Append object(s) at cursor, use centroid if more than one object is selected");
- uiBlockEndAlign(block);
-
- xco+= 100; // scroll
-
- } else if(simasel->type==FILE_BLENDER) {
- uiDefButBitI(block, TOGN, G_FILE_NO_UI, B_REDR, "Load UI", xco+=XIC,0,80,YIC, &G.fileflags, 0, 0, 0, 0, "Load the UI setup as well as the scene data");
-
- xco+= 100; // scroll
- }
-
- glRasterPos2f((float)xcotitle, 5.0);
- BIF_RasterPos((float)xcotitle, 5.0); // stupid texture fonts
- BIF_ThemeColor(TH_TEXT);
- BIF_DrawString(uiBlockGetCurFont(block), simasel->title, (U.transopts & USER_TR_BUTTONS));
-
- /* always do as last */
- curarea->headbutlen= xco+2*XIC;
-
- uiDrawBlock(block);
-}
diff --git a/source/blender/src/header_info.c b/source/blender/src/header_info.c
deleted file mode 100644
index 174a5c683f0..00000000000
--- a/source/blender/src/header_info.c
+++ /dev/null
@@ -1,2181 +0,0 @@
-/**
- * header_info.c oct-2003
- *
- * Functions to draw the "User Preferences" window header
- * and handle user events sent to it.
- *
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "DNA_group_types.h"
-#include "DNA_ID.h"
-#include "DNA_image_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_object_types.h"
-#include "DNA_packedFile_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_world_types.h"
-
-#include "BDR_editcurve.h"
-#include "BDR_editmball.h"
-#include "BDR_editobject.h"
-#include "BDR_editface.h"
-#include "BDR_vpaint.h"
-
-#include "BIF_editarmature.h"
-#include "BIF_editfont.h"
-#include "BIF_editmesh.h"
-#include "BIF_gl.h"
-#include "BIF_interface.h"
-#include "BIF_language.h"
-#include "BIF_mainqueue.h"
-#include "BIF_meshtools.h"
-#include "BIF_previewrender.h"
-#include "BIF_renderwin.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toets.h"
-#include "BIF_toolbox.h"
-#include "BIF_usiblender.h"
-#include "BIF_writeimage.h"
-#include "BIF_drawscene.h"
-
-#ifdef WITH_VERSE
-#include "BIF_verse.h"
-#endif
-
-#include "BKE_blender.h"
-#include "BKE_depsgraph.h"
-#include "BKE_exotic.h"
-#include "BKE_global.h"
-#include "BKE_image.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
-#include "BKE_node.h"
-#include "BKE_packedFile.h"
-#include "BKE_scene.h"
-#include "BKE_world.h"
-
-#ifdef WITH_VERSE
-#include "BKE_verse.h"
-#endif
-
-#include "BLI_arithb.h"
-#include "BLI_blenlib.h"
-#include "BLI_bpath.h"
-#include "BLO_writefile.h"
-
-#include "BSE_editipo.h"
-#include "BSE_filesel.h"
-#include "BIF_imasel.h"
-#include "BSE_headerbuttons.h"
-#include "BSE_node.h"
-#include "BSE_sequence.h"
-#include "BSE_edit.h"
-
-#include "IMB_imbuf_types.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "BPY_extern.h"
-#include "BPY_menus.h"
-
-#include "blendef.h"
-#include "interface.h"
-#include "mydevice.h"
-
-extern char versionstr[]; /* from blender.c */
-
-/*----------------------------------*/
-/* Progress bar vars and functions: */
-
-/* strubi shamelessly abused the status line as a progress bar...
- * feel free to kill him after release */
-
-static int g_progress_bar = 0;
-static char *g_progress_info = 0;
-static float g_done;
-
-int start_progress_bar(void)
-{
- g_progress_bar = 1;
- return 1; // we never fail (yet)
-}
-
-void end_progress_bar(void)
-{
- g_progress_bar = 0;
-}
-
-static void update_progress_bar(float done, char *info)
-{
- g_done = done;
- g_progress_info = info;
-}
-
-/** Progress bar
- 'done': a value between 0.0 and 1.0, showing progress
- 'info': a info text what is currently being done
-
- Make sure that the progress bar is always called with:
- done = 0.0 first
- and
- done = 1.0 last -- or alternatively use:
-
- start_progressbar();
- do_stuff_and_callback_progress_bar();
- end_progressbar();
-*/
-
-int progress_bar(float done, char *busy_info)
-{
- ScrArea *sa;
- short val;
-
- /* User break (ESC) */
- while (qtest()) {
- if (extern_qread(&val) == ESCKEY)
- return 0;
- }
- if (done == 0.0) {
- start_progress_bar();
- } else if (done > 0.99) {
- end_progress_bar();
- }
-
- sa= G.curscreen->areabase.first;
- while(sa) {
- if (sa->spacetype == SPACE_INFO) {
- update_progress_bar(done, busy_info);
-
- curarea = sa;
-
- scrarea_do_headdraw(curarea);
- areawinset(curarea->win);
- sa->head_swap= WIN_BACK_OK;
- screen_swapbuffers();
- }
- sa = sa->next;
- }
- return 1;
-}
-/* -- End of progress bar definitions ------- */
-
-extern char temp_dir[]; /* XXXXX BAD BAD BAD from exotic.c */
-
-void write_vrml_fs()
-{
- if(G.obedit) {
- error("Can't save VRML. Press TAB to leave EditMode");
- }
- else {
- if(temp_dir[0]==0) strcpy(temp_dir, G.sce);
-
- activate_fileselect(FILE_SPECIAL, "Export VRML 1.0", temp_dir, write_vrml);
- }
-}
-
-void write_dxf_fs()
-{
- if(G.obedit) {
- error("Can't save DXF. Press TAB to leave EditMode");
- }
- else {
-
- if(temp_dir[0]==0) strcpy(temp_dir, G.sce);
-
- activate_fileselect(FILE_SPECIAL, "Export DXF", temp_dir, write_dxf);
- }
-}
-
-void write_stl_fs()
-{
- if(G.obedit) {
- error("Can't save STL. Press TAB to leave EditMode");
- }
- else {
-
- if(temp_dir[0]==0) strcpy(temp_dir, G.sce);
-
- activate_fileselect(FILE_SPECIAL, "Export STL", temp_dir, write_stl);
- }
-}
-/* ------------ */
-
-int buttons_do_unpack()
-{
- int how;
- char menu[2048];
- char *line = menu;
- int ret_value = RET_OK, count = 0;
-
- count = countPackedFiles();
-
- if(!count) {
- pupmenu("No packed files. Autopack disabled");
- return ret_value;
- }
- if (count == 1)
- line += sprintf(line, "Unpack 1 file%%t");
- else
- line += sprintf(line, "Unpack %d files%%t", count);
-
- line += sprintf(line, "|Use files in current directory (create when necessary)%%x%d", PF_USE_LOCAL);
- line += sprintf(line, "|Write files to current directory (overwrite existing files)%%x%d", PF_WRITE_LOCAL);
- line += sprintf(line, "|%%l|Use files in original location (create when necessary)%%x%d", PF_USE_ORIGINAL);
- line += sprintf(line, "|Write files to original location (overwrite existing files)%%x%d", PF_WRITE_ORIGINAL);
- line += sprintf(line, "|%%l|Disable AutoPack, keep all packed files %%x%d", PF_KEEP);
- line += sprintf(line, "|Ask for each file %%x%d", PF_ASK);
-
- how = pupmenu(menu);
-
- if(how == -1)
- ret_value = RET_CANCEL;
- else {
- if (how != PF_KEEP) unpackAll(how);
- G.fileflags &= ~G_AUTOPACK;
- }
-
- return ret_value;
-}
-
-/* here, because of all creator stuff */
-
-Scene *copy_scene(Scene *sce, int level)
-{
- /* level 0: al objects shared
- * level 1: al object-data shared
- * level 2: full copy
- */
- Scene *scen;
- Base *base, *obase;
-
- /* level 0 */
- scen= copy_libblock(sce);
- duplicatelist(&(scen->base), &(sce->base));
-
- clear_id_newpoins();
-
- id_us_plus((ID *)scen->world);
- id_us_plus((ID *)scen->set);
-
- scen->ed= NULL;
- scen->radio= NULL;
- scen->theDag= NULL;
- scen->toolsettings= MEM_dupallocN(sce->toolsettings);
-
- duplicatelist(&(scen->markers), &(sce->markers));
- duplicatelist(&(scen->r.layers), &(sce->r.layers));
-
- scen->nodetree= ntreeCopyTree(sce->nodetree, 0);
-
- obase= sce->base.first;
- base= scen->base.first;
- while(base) {
- id_us_plus(&base->object->id);
- if(obase==sce->basact) scen->basact= base;
-
- obase= obase->next;
- base= base->next;
- }
-
- if(level==0) return scen;
-
- /* level 1 */
- G.scene= scen;
-
- single_object_users(0);
-
- /* camera */
- ID_NEW(G.scene->camera);
-
- /* level 2 */
- if(level>=2) {
- if(scen->world) {
- id_us_plus(&scen->world->id);
- scen->world= copy_world(scen->world);
- }
- single_obdata_users(0);
- single_mat_users_expand();
- single_tex_users_expand();
-
- scen->radio= MEM_dupallocN(sce->radio);
-
- }
-
- clear_id_newpoins();
-
- BPY_copy_scriptlink(&sce->scriptlink);
- // make a private copy of the avicodecdata
-
- if (sce->r.avicodecdata) {
-
- scen->r.avicodecdata = MEM_dupallocN(sce->r.avicodecdata);
- scen->r.avicodecdata->lpFormat = MEM_dupallocN(scen->r.avicodecdata->lpFormat);
- scen->r.avicodecdata->lpParms = MEM_dupallocN(scen->r.avicodecdata->lpParms);
- }
-
- // make a private copy of the qtcodecdata
-
- if (sce->r.qtcodecdata) {
- scen->r.qtcodecdata = MEM_dupallocN(sce->r.qtcodecdata);
- scen->r.qtcodecdata->cdParms = MEM_dupallocN(scen->r.qtcodecdata->cdParms);
- }
-
- return scen;
-}
-
-void do_info_buttons(unsigned short event)
-{
- bScreen *sc, *oldscreen;
- Scene *sce, *sce1;
- ScrArea *sa;
- int nr;
-
- switch(event) {
- case B_INFOSCR: /* menu select screen */
-
- if( G.curscreen->screennr== -2) {
- if(curarea->winy <50) {
- sa= closest_bigger_area();
- areawinset(sa->win);
- }
- activate_databrowse((ID *)G.curscreen, ID_SCR, 0, B_INFOSCR,
- &G.curscreen->screennr, do_info_buttons);
- return;
- }
- if( G.curscreen->screennr < 0) return;
-
- sc= G.main->screen.first;
- nr= 1;
- while(sc) {
- if(nr==G.curscreen->screennr) {
- if(is_allowed_to_change_screen(sc)) setscreen(sc);
- else error("Unable to perform function in EditMode");
- break;
- }
- nr++;
- sc= sc->id.next;
- }
- /* last item: NEW SCREEN */
- if(sc==0) {
- nr= pupmenu("New Screen%t|Empty%x1|Duplicate%x2");
-
- if(nr==1) default_twosplit();
- if(nr==2) duplicate_screen();
- }
- break;
- case B_INFODELSCR:
-/*do this event only with buttons, so it can never be called with full-window*/
-
- if(G.curscreen->id.prev) sc= G.curscreen->id.prev;
- else if(G.curscreen->id.next) sc= G.curscreen->id.next;
- else return;
- if(okee("Delete current screen")) {
- /* find new G.curscreen */
-
- oldscreen= G.curscreen;
- setscreen(sc); /* this test if sc has a full */
- unlink_screen(oldscreen);
- free_libblock(&G.main->screen, oldscreen);
- }
- scrarea_queue_headredraw(curarea);
-
- break;
- case B_INFOSCE: /* menu select scene */
-
- if( G.curscreen->scenenr== -2) {
- if(curarea->winy <50) {
- sa= closest_bigger_area();
- areawinset(sa->win);
- }
- activate_databrowse((ID *)G.scene, ID_SCE, 0, B_INFOSCE,
- &G.curscreen->scenenr, do_info_buttons);
- return;
- }
- if( G.curscreen->scenenr < 0) return;
-
- sce= G.main->scene.first;
- nr= 1;
- while(sce) {
- if(nr==G.curscreen->scenenr) {
- if(sce!=G.scene) set_scene(sce);
- break;
- }
- nr++;
- sce= sce->id.next;
- }
- /* last item: NEW SCENE */
- if(sce==0) {
- nr= pupmenu("Add scene%t|Empty|Link Objects|Link ObData|Full Copy");
- if(nr<= 0) return;
- if(nr==1) {
- ListBase lb;
-
- sce= add_scene(G.scene->id.name+2);
- /* pretty bad ass copying here. we should use copy_scene to do all (ton) */
- lb= sce->r.layers;
- sce->r= G.scene->r;
- sce->r.layers= lb;
-#ifdef _WIN32
- if (sce->r.avicodecdata) {
- sce->r.avicodecdata = MEM_dupallocN(G.scene->r.avicodecdata);
- sce->r.avicodecdata->lpFormat = MEM_dupallocN(G.scene->r.avicodecdata->lpFormat);
- sce->r.avicodecdata->lpParms = MEM_dupallocN(G.scene->r.avicodecdata->lpParms);
- }
-#endif
-#ifdef WITH_QUICKTIME
- if (sce->r.qtcodecdata) {
- sce->r.qtcodecdata = MEM_dupallocN(G.scene->r.qtcodecdata);
- sce->r.qtcodecdata->cdParms = MEM_dupallocN(G.scene->r.qtcodecdata->cdParms);
- }
-#endif
- }
- else sce= copy_scene(G.scene, nr-2);
-
- set_scene(sce);
- }
- countall();
- BIF_preview_changed(ID_TE);
-
- break;
- case B_INFODELSCE:
-
- if(G.scene->id.prev) sce= G.scene->id.prev;
- else if(G.scene->id.next) sce= G.scene->id.next;
- else return;
- if(okee("Delete current scene")) {
- /* Note, anything besides free_libblock needs to be added in
- * Python Scene.c for Blender.Scene.Unlink() */
-
-
- /* exit modes... could become single call once */
- exit_editmode(EM_FREEDATA|EM_WAITCURSOR);
- exit_paint_modes();
-
- /* check all sets */
- for (sce1= G.main->scene.first; sce1; sce1= sce1->id.next) {
- if(sce1->set == G.scene) sce1->set= 0;
- }
-
- /* check all sequences */
- clear_scene_in_allseqs(G.scene);
-
- /* check render layer nodes in other scenes */
- clear_scene_in_nodes(G.scene);
-
- /* al screens */
-
- for (sc= G.main->screen.first; sc; sc= sc->id.next ) {
- if(sc->scene == G.scene) sc->scene= sce;
- }
- free_libblock(&G.main->scene, G.scene);
- set_scene(sce);
- countall();
- }
-
- break;
- }
-}
-
-static void check_packAll()
-{
- // first check for dirty images
- Image *ima;
-
- for(ima = G.main->image.first; ima; ima= ima->id.next) {
- if (ima->ibufs.first) { /* XXX FIX */
- ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
-
- if (ibuf && (ibuf->userflags &= IB_BITMAPDIRTY))
- break;
- }
- }
-
- if (ima == NULL || okee("Some images are painted on. These changes will be lost. Continue ?")) {
- packAll();
- G.fileflags |= G_AUTOPACK;
- }
-}
-
-static int write_runtime(char *str, char *exename)
-{
- char *freestr= NULL;
- char *ext = 0;
-
-#ifdef _WIN32
- ext = ".exe";
-#endif
-
-#ifdef __APPLE__
- ext = ".app";
-#endif
- if (ext && (!BLI_testextensie(str, ext))) {
- freestr= MEM_mallocN(strlen(str) + strlen(ext) + 1, "write_runtime_check");
- sprintf(freestr,"%s%s", str, ext);
- str= freestr;
- }
-
- if (!BLI_exists(str) || saveover(str))
- BLO_write_runtime(str, exename);
-
- if (freestr)
- MEM_freeN(freestr);
-
- return 0;
-}
-
-static void write_runtime_check_dynamic(char *str)
-{
- write_runtime(str, "blenderdynplayer.exe");
-}
-
-static void write_runtime_check(char *str)
-{
- char player[128];
-
- strcpy(player, "blenderplayer");
-
-#ifdef _WIN32
- strcat(player, ".exe");
-#endif
-
-#ifdef __APPLE__
- strcat(player, ".app");
-#endif
-
- write_runtime(str, player);
-}
-/* end keyed functions */
-
-/************************** MAIN MENU *****************************/
-/************************** FILE *****************************/
-
-
-static void do_info_file_importmenu(void *arg, int event)
-{
- ScrArea *sa;
-
- if(curarea->spacetype==SPACE_INFO) {
- sa= find_biggest_area_of_type(SPACE_SCRIPT);
- if (!sa) sa= closest_bigger_area();
- areawinset(sa->win);
- }
-
- /* events >=3 are registered bpython scripts */
- if (event >= 3) {
- BPY_menu_do_python(PYMENU_IMPORT, event - 3);
- BIF_undo_push("Import file");
- }
- else {
- switch(event) {
-
- case 0: /* DXF */
- activate_fileselect(FILE_BLENDER, "Import DXF", G.sce, BIF_read_file);
- break;
- case 1: /* VRML 1.0 */
- activate_fileselect(FILE_BLENDER, "Import VRML 1.0", G.sce, BIF_read_file);
- break;
- case 2: /* STL */
- activate_fileselect(FILE_BLENDER, "Import STL", G.sce, BIF_read_file);
- break;
-
- }
- }
- allqueue(REDRAWINFO, 0);
-}
-
-static uiBlock *info_file_importmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
- BPyMenu *pym;
- int i = 0;
-
- block= uiNewBlock(&curarea->uiblocks, "importmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_info_file_importmenu, NULL);
- //uiBlockSetXOfs(block, -50); // offset to parent button
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "VRML 1.0...",
- 0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "DXF...",
- 0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "STL...",
- 0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- for (pym = BPyMenuTable[PYMENU_IMPORT]; pym; pym = pym->next, i++) {
- uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i+3, pym->tooltip?pym->tooltip:pym->filename);
- }
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-
-static void do_info_file_exportmenu(void *arg, int event)
-{
- ScrArea *sa;
-
- if(curarea->spacetype==SPACE_INFO) {
- sa= find_biggest_area_of_type(SPACE_SCRIPT);
- if (!sa) sa= closest_bigger_area();
- areawinset(sa->win);
- }
-
- /* events >=3 are registered bpython scripts */
- if (event >= 3) BPY_menu_do_python(PYMENU_EXPORT, event - 3);
-
- else switch(event) {
-
- case 0:
- write_vrml_fs();
- break;
- case 1:
- write_dxf_fs();
- break;
- case 2:
- write_stl_fs();
- break;
- }
- allqueue(REDRAWINFO, 0);
-}
-
-static uiBlock *info_file_exportmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
- BPyMenu *pym;
- int i = 0;
-
- block= uiNewBlock(&curarea->uiblocks, "exportmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_info_file_exportmenu, NULL);
- //uiBlockSetXOfs(block, -50); // offset to parent button
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "VRML 1.0...|Ctrl F2",
- 0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "DXF...|Shift F2",
- 0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "STL...",
- 0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- /* note that we acount for the 3 previous entries with i+3: */
- for (pym = BPyMenuTable[PYMENU_EXPORT]; pym; pym = pym->next, i++) {
- uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20, menuwidth, 19,
- NULL, 0.0, 0.0, 1, i+3,
- pym->tooltip?pym->tooltip:pym->filename);
- }
-
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-
-#ifdef WITH_VERSE
-
-extern ListBase session_list;
-
-static void do_verse_filemenu(void *arg, int event)
-{
- char address[64]; /* lenght of domain name is 63 characters or less */
- VerseSession *session = NULL;
- ScrArea *sa;
-
- if(curarea->spacetype==SPACE_INFO) {
- sa= closest_bigger_area();
- areawinset(sa->win);
- }
-
- switch(event) {
- case 0:
- waitcursor(1);
- printf("Connecting to localhost!\n");
- b_verse_connect("localhost");
- waitcursor(0);
- break;
- case 1:
- address[0] = '\0';
- if(sbutton(address, 0, 63, "Server:")) {
- waitcursor(1);
- printf("Connecting to %s\n", address);
- b_verse_connect(address);
- waitcursor(0);
- }
- break;
- case 2:
- session = session_menu();
- if(session) {
- printf("Disconnecting session: %s!\n", session->address);
- end_verse_session(session);
- }
- break;
- case 3:
- printf("Disconnecting all sessions!\n");
- end_all_verse_sessions();
- break;
- case 4:
- printf("sending get to master server\n");
- b_verse_ms_get();
- break;
- }
-}
-
-static uiBlock *verse_filemenu(void *unusedargs)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "verse_filemenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_verse_filemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Connect to localhost", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Connect ...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- if(session_list.first != NULL) {
- if(session_list.first != session_list.last) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Disconnect ...",
- 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Disconnect all",
- 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- }
- else {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Disconnect",
- 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- }
-
- }
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Get Servers", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-#endif
-
-static void do_info_filemenu(void *arg, int event)
-{
- ScrArea *sa;
- char dir[FILE_MAXDIR];
-
- if(curarea->spacetype==SPACE_INFO) {
- sa= closest_bigger_area();
- areawinset(sa->win);
- }
-
- /* these are no defines, easier this way, the codes are in the function below */
- switch(event) {
- case 0:
- if (okee("Erase All")) {
- if (!BIF_read_homefile(0))
- error("No file ~/.B.blend");
- }
- break;
- case 1: /* open */
- activate_fileselect(FILE_BLENDER, "Open", G.sce, BIF_read_file);
- break;
- case 3: /* append */
- activate_fileselect(FILE_LOADLIB, "Load Library", G.lib, 0);
- break;
- case 4: /* save */
- strcpy(dir, G.sce);
- untitled(dir);
- activate_fileselect(FILE_BLENDER, "Save As", dir, BIF_write_file);
- break;
- case 5:
- strcpy(dir, G.sce);
- if (untitled(dir)) {
- activate_fileselect(FILE_BLENDER, "Save As", dir, BIF_write_file);
- } else {
- BIF_write_file(dir);
- free_filesel_spec(dir);
- }
- break;
- case 6: /* save image */
- BIF_save_rendered_image_fs();
- break;
- case 7:
- activate_imageselect(FILE_LOADLIB, "Load Library", G.lib, 0);
- break;
- case 22: /* save runtime */
- activate_fileselect(FILE_SPECIAL, "Save Runtime", "", write_runtime_check);
- break;
- case 23: /* save dynamic runtime */
- activate_fileselect(FILE_SPECIAL, "Save Dynamic Runtime", "", write_runtime_check_dynamic);
- break;
- case 24:
- BIF_screendump(0);
- break;
- case 25:
- BIF_screendump(1);
- break;
- case 13:
- exit_usiblender();
- break;
- case 15: /* recover previous session */
- {
- extern short winqueue_break; /* editscreen.c */
- int save_over;
- char str[FILE_MAXDIR+FILE_MAXFILE];
- char scestr[FILE_MAXDIR+FILE_MAXFILE];
-
- strcpy(scestr, G.sce); /* temporal store */
- save_over = G.save_over;
- BLI_make_file_string("/", str, U.tempdir, "quit.blend");
- BKE_read_file(str, NULL);
- G.save_over = save_over;
- strcpy(G.sce, scestr);
-
- winqueue_break= 1; /* leave queues everywhere */
-
- BKE_reset_undo();
- BKE_write_undo("original"); /* save current state */
- refresh_interface_font();
- }
- break;
- case 31: /* save default settings */
- BIF_write_homefile();
- break;
- case 32:
- if (okee("Erase All")) {
- if (!BIF_read_homefile(1))
- error("Can't read data from memory!");
- }
- break;
- case 35: /* compress toggle */
- U.flag ^= (USER_FILECOMPRESS);
- break;
- }
-
- allqueue(REDRAWINFO, 0);
-}
-
-static void do_info_operecentmenu(void *arg, int event)
-{
- struct RecentFile *recent;
-
- if(event==0 && G.sce[0]) {
- BIF_read_file(G.sce);
- }
- else { /* Global */
- recent = BLI_findlink(&(G.recent_files), event-1);
- BIF_read_file(recent->filename);
- }
-}
-
-static uiBlock *info_openrecentmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120, i;
- struct RecentFile *recent;
-
- block= uiNewBlock(&curarea->uiblocks, "info_openrecentmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_info_operecentmenu, NULL);
-
- if (G.sce[0]) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, G.sce, 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
- }
-
- for (recent = G.recent_files.first, i=0; i<U.recent_files && recent; recent = recent->next, i++) {
- if (strcmp(recent->filename, G.sce)!=0) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, recent->filename, 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, i+1, "");
- }
- }
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_info_externalfiles(void *arg, int event)
-{
- switch (event) {
-
- case 1: /* pack data */
- check_packAll();
- break;
-#if 0
- case 2: /* unpack to current dir */
- unpackAll(PF_WRITE_LOCAL);
- G.fileflags &= ~G_AUTOPACK;
- break;
-#endif
- case 3: /* unpack data */
- if (buttons_do_unpack() != RET_CANCEL) {
- /* Clear autopack bit only if user selected one of the unpack options */
- G.fileflags &= ~G_AUTOPACK;
- }
- break;
- case 10: /* make all paths relative */
- if (G.relbase_valid) {
- int tot,changed,failed,linked;
- char str[512];
- makeFilesRelative(&tot, &changed, &failed, &linked);
- sprintf(str, "Make Relative%%t|Total files %i|Changed %i|Failed %i|Linked %i", tot, changed, failed, linked);
- pupmenu(str);
- } else {
- pupmenu("Can't set relative paths with an unsaved blend file");
- }
- break;
- case 11: /* check images exist */
- {
- /* Its really text but only care about the name */
- ID *btxt = (ID *)checkMissingFiles();
-
- if (btxt) {
- char str[128];
- sprintf(str, "Missing files listed in Text \"%s\"", btxt->name+2);
- error(str);
- } else {
- okee("No external files missing");
- }
- }
- break;
- case 12: /* search for referenced files that are not available */
- activate_fileselect(FILE_SPECIAL, "Find Missing Files", "", findMissingFiles);
- break;
- }
-
- allqueue(REDRAWINFO, 0);
-}
-
-static uiBlock *info_externalfiles(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "info_externalfiles", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_info_externalfiles, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Pack into Blend", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 1, "");
-#if 0
- uiDefBut(block, BUTM, 1, "Unpack Data to current dir", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 2, "Removes all packed files from the project and saves them to the current directory");
-#endif
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Unpack into Files...", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 3, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make all Paths Relative", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 10, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Report Missing Files", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 11, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Find Missing Files", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 12, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static uiBlock *info_filemenu(void *arg_unused)
-{
- uiBlock *block;
- short yco=0;
- short menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "info_filemenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_info_filemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "New|Ctrl X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Open...|F1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
-#ifdef WITH_VERSE
- uiDefIconTextBlockBut(block, verse_filemenu, NULL, ICON_RIGHTARROW_THIN, "Verse", 0, yco-=20, menuwidth, 19, "");
-#endif
- uiDefIconTextBlockBut(block, info_openrecentmenu, NULL, ICON_RIGHTARROW_THIN, "Open Recent",0, yco-=20, 120, 19, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Recover Last Session", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 15, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Save|Ctrl W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Save As...|F2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
-
- if(U.flag & USER_FILECOMPRESS) {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Compress File", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 35, "Enable file compression");
- } else {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Compress File", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 35, "Enable file compression");
- }
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Save Image...|F3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Dump Subwindow|Ctrl F3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 24, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Dump Screen|Ctrl Shift F3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 25, "");
-#if GAMEBLENDER == 1
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Save Runtime...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 22, "");
-#ifdef _WIN32
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Save Dynamic Runtime...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 23, "");
-#endif
-#endif
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Save Default Settings|Ctrl U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 31, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Load Factory Settings", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 32, "");
-
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Append or Link|Shift F1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Append or Link (Image Browser)|Ctrl F1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
- uiDefIconTextBlockBut(block, info_file_importmenu, NULL, ICON_RIGHTARROW_THIN, "Import", 0, yco-=20, menuwidth, 19, "");
- uiDefIconTextBlockBut(block, info_file_exportmenu, NULL, ICON_RIGHTARROW_THIN, "Export", 0, yco-=20, menuwidth, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, info_externalfiles, NULL, ICON_RIGHTARROW_THIN, "External Data",0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Quit Blender|Ctrl Q", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, "");
-
- uiBlockSetDirection(block, UI_DOWN);
- uiTextBoundsBlock(block, 80);
-
- return block;
-}
-
-/**************************** ADD ******************************/
-
-void do_info_add_meshmenu(void *arg, int event)
-{
- if (event>=20) {
- BPY_menu_do_python(PYMENU_ADDMESH, event - 20);
- } else {
- switch(event) {
- case 0:
- /* Plane */
- add_primitiveMesh(0);
- break;
- case 1:
- /* Cube */
- add_primitiveMesh(1);
- break;
- case 2:
- /* Circle */
- add_primitiveMesh(4);
- break;
- case 3:
- /* UVsphere */
- add_primitiveMesh(11);
- break;
- case 4:
- /* IcoSphere */
- add_primitiveMesh(12);
- break;
- case 5:
- /* Cylinder */
- add_primitiveMesh(5);
- break;
- case 7:
- /* Cone */
- add_primitiveMesh(7);
- break;
- case 8:
- /* Grid */
- add_primitiveMesh(10);
- break;
- case 9:
- /* Monkey */
- add_primitiveMesh(13);
- break;
- default:
- break;
- }
- }
- allqueue(REDRAWINFO, 0);
-}
-
-static uiBlock *info_add_meshmenu(void *arg_unused)
-{
-/* static short tog=0; */
- uiBlock *block;
- short yco= 0;
-
- /* Python Menu */
- BPyMenu *pym;
- int i=0;
-
- block= uiNewBlock(&curarea->uiblocks, "add_meshmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_info_add_meshmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Plane|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Cube|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Circle|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "UVsphere", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "IcoSphere|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Cylinder|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Cone|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 7, "");
- uiDefIconTextBut(block, SEPR, 0, ICON_BLANK1, "", 0, yco-=6, 160, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Grid|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 8, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Monkey|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 9, "");
-
-
- pym = BPyMenuTable[PYMENU_ADDMESH];
- if (pym) {
- uiDefIconTextBut(block, SEPR, 0, ICON_BLANK1, "", 0, yco-=6, 160, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- for (; pym; pym = pym->next, i++) {
- uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, i+20, pym->tooltip?pym->tooltip:pym->filename);
- }
- }
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-void do_info_add_curvemenu(void *arg, int event)
-{
-
- switch(event) {
- case 0:
- /* Bezier Curve */
- add_primitiveCurve(10);
- break;
- case 1:
- /* Bezier Circle */
- add_primitiveCurve(11);
- break;
- case 2:
- /* NURB Curve */
- add_primitiveCurve(40);
- break;
- case 3:
- /* NURB Circle */
- add_primitiveCurve(41);
- break;
- case 4:
- /* Path */
- add_primitiveCurve(46);
- break;
- default:
- break;
- }
- allqueue(REDRAWINFO, 0);
-}
-
-static uiBlock *info_add_curvemenu(void *arg_unused)
-{
-/* static short tog=0; */
- uiBlock *block;
- short yco= 0;
-
- block= uiNewBlock(&curarea->uiblocks, "add_curvemenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_info_add_curvemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Bezier Curve|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Bezier Circle|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "NURBS Curve|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "NURBS Circle", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Path|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 4, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-
-void do_info_add_surfacemenu(void *arg, int event)
-{
-
- switch(event) {
- case 0:
- /* Curve */
- add_primitiveNurb(0);
- break;
- case 1:
- /* Circle */
- add_primitiveNurb(1);
- break;
- case 2:
- /* Surface */
- add_primitiveNurb(2);
- break;
- case 3:
- /* Tube */
- add_primitiveNurb(3);
- break;
- case 4:
- /* Sphere */
- add_primitiveNurb(4);
- break;
- case 5:
- /* Donut */
- add_primitiveNurb(5);
- break;
- default:
- break;
- }
- allqueue(REDRAWINFO, 0);
-}
-
-static uiBlock *info_add_surfacemenu(void *arg_unused)
-{
-/* static short tog=0; */
- uiBlock *block;
- short yco= 0;
-
- block= uiNewBlock(&curarea->uiblocks, "add_surfacemenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_info_add_surfacemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "NURBS Curve|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "NURBS Circle|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "NURBS Surface|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "NURBS Tube", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "NURBS Sphere|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "NURBS Donut|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 5, "");
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-void do_info_add_metamenu(void *arg, int event)
-{
-
- switch(event) {
- case 0:
- /* Ball */
- add_primitiveMball(1);
- break;
- case 1:
- /* Tube */
- add_primitiveMball(2);
- break;
- case 2:
- /* Plane */
- add_primitiveMball(3);
- break;
- case 3:
- /* Elipsoid */
- add_primitiveMball(4);
- break;
- case 4:
- /* Cube */
- add_primitiveMball(5);
- break;
- default:
- break;
- }
- allqueue(REDRAWINFO, 0);
-}
-
-
-static uiBlock *info_add_metamenu(void *arg_unused)
-{
-/* static short tog=0; */
- uiBlock *block;
- short xco= 0;
-
- block= uiNewBlock(&curarea->uiblocks, "add_metamenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_info_add_metamenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,"Meta Ball|", 0, xco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Meta Tube|", 0, xco-=20, 160, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Meta Plane|", 0, xco-=20, 160, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Meta Ellipsoid|", 0, xco-=20, 160, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Meta Cube|", 0, xco-=20, 160, 19, NULL, 0.0, 0.0, 1, 4, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-void do_info_add_lampmenu(void *arg, int event)
-{
-
- switch(event) {
- case 0: /* lamp */
- add_objectLamp(LA_LOCAL);
- break;
- case 1: /* sun */
- add_objectLamp(LA_SUN);
- break;
- case 2: /* spot */
- add_objectLamp(LA_SPOT);
- break;
- case 3: /* hemi */
- add_objectLamp(LA_HEMI);
- break;
- case 4: /* area */
- add_objectLamp(LA_AREA);
- break;
- case 5: /* YafRay photon lamp */
- if (G.scene->r.renderer==R_YAFRAY)
- add_objectLamp(LA_YF_PHOTON);
- break;
- default:
- break;
- }
- allqueue(REDRAWINFO, 0);
-}
-
-static uiBlock *info_add_lampmenu(void *arg_unused)
-{
-/* static short tog=0; */
- uiBlock *block;
- short yco= 0;
-
- block= uiNewBlock(&curarea->uiblocks, "add_lampmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_info_add_lampmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Lamp|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Sun|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Spot|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hemi|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Area|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 4, "");
- if (G.scene->r.renderer==R_YAFRAY)
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Photon|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 5, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-static void do_info_add_groupmenu(void *arg, int event)
-{
- Object *ob;
-
- add_object_draw(OB_EMPTY);
- ob= OBACT;
-
- ob->dup_group= BLI_findlink(&G.main->group, event);
- if(ob->dup_group) {
- id_us_plus((ID *)ob->dup_group);
- ob->transflag |= OB_DUPLIGROUP;
- DAG_scene_sort(G.scene);
- }
-}
-
-
-static uiBlock *info_add_groupmenu(void *arg_unused)
-{
- Group *group;
- uiBlock *block;
- short yco= 0;
- int a;
-
- block= uiNewBlock(&curarea->uiblocks, "add_groupmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_info_add_groupmenu, NULL);
-
- for(a=0, group= G.main->group.first; group; group= group->id.next, a++) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, group->id.name+2, 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, a, "");
- }
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-void do_info_addmenu(void *arg, int event)
-{
- switch(event) {
- case 0:
- /* Mesh */
- break;
- case 1:
- /* Curve */
- break;
- case 2:
- /* Surface */
- break;
- case 3:
- /* Metaball */
- break;
- case 4:
- /* Text (argument is discarded) */
- add_primitiveFont(event);
- break;
- case 5:
- /* Empty */
- add_object_draw(OB_EMPTY);
- break;
- case 6:
- /* Camera */
- add_object_draw(OB_CAMERA);
- break;
- case 8:
- /* Armature */
- add_primitiveArmature(OB_ARMATURE);
- break;
- case 9:
- /* Lattice */
- add_object_draw(OB_LATTICE);
- break;
- case 10:
- /* group instance not yet */
- break;
- default:
- break;
- }
- allqueue(REDRAWINFO, 0);
-}
-
-
-static uiBlock *info_addmenu(void *arg_unused)
-{
-/* static short tog=0; */
- uiBlock *block;
- short yco= 0;
-
- block= uiNewBlock(&curarea->uiblocks, "addmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_info_addmenu, NULL);
-
- uiDefIconTextBlockBut(block, info_add_meshmenu, NULL, ICON_RIGHTARROW_THIN, "Mesh", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, info_add_curvemenu, NULL, ICON_RIGHTARROW_THIN, "Curve", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, info_add_surfacemenu, NULL, ICON_RIGHTARROW_THIN, "Surface", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, info_add_metamenu, NULL, ICON_RIGHTARROW_THIN, "Meta", 0, yco-=20, 120, 19, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Text", 0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Empty", 0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 5, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, 120, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, info_add_groupmenu, NULL, ICON_RIGHTARROW_THIN, "Group", 0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, 120, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Camera", 0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 6, "");
- uiDefIconTextBlockBut(block, info_add_lampmenu, NULL, ICON_RIGHTARROW_THIN, "Lamp", 0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, 120, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Armature", 0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 8, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Lattice", 0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 9, "");
-
- uiBlockSetDirection(block, UI_DOWN);
- uiTextBoundsBlock(block, 80);
-
- return block;
-}
-
-/************************** GAME *****************************/
-
-
-static void do_info_gamemenu(void *arg, int event)
-{
- switch (event) {
- case G_FILE_ENABLE_ALL_FRAMES:
- case G_FILE_DIAPLAY_LISTS:
- case G_FILE_SHOW_FRAMERATE:
- case G_FILE_SHOW_DEBUG_PROPS:
- case G_FILE_AUTOPLAY:
- case G_FILE_GAME_TO_IPO:
- case G_FILE_GAME_MAT:
- case G_FILE_SHOW_PHYSICS:
- G.fileflags ^= event;
- break;
- default:
- ; /* ignore the rest */
- }
-}
-
-static uiBlock *info_gamemenu(void *arg_unused)
-{
-/* static short tog=0; */
- uiBlock *block;
- short yco= 0;
- short menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "gamemenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_info_gamemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, B_STARTGAME, ICON_BLANK1, "Start Game|P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 1, 0, "");
-
-
- if(G.fileflags & G_FILE_ENABLE_ALL_FRAMES) {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Enable All Frames", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_ENABLE_ALL_FRAMES, "");
- } else {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Enable All Frames", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_ENABLE_ALL_FRAMES, "");
- }
-
- if(G.fileflags & G_FILE_GAME_TO_IPO) {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Record Game Physics to IPO", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_GAME_TO_IPO, "");
- } else {
-
- if(G.fileflags & G_FILE_DIAPLAY_LISTS) {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Generate Display Lists", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_DIAPLAY_LISTS, "");
- } else {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Generate Display Lists", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_DIAPLAY_LISTS, "");
- }
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Record Game Physics to IPO", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_GAME_TO_IPO, "");
- }
-
- if(G.fileflags & G_FILE_GAME_MAT) {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Use Blender Materials", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_GAME_MAT, "");
- } else {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Use Blender Materials", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_GAME_MAT, "");
- }
-
-
-
- if(G.fileflags & G_FILE_SHOW_FRAMERATE) {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Show Framerate and Profile", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_SHOW_FRAMERATE, "");
- } else {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Show Framerate and Profile", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_SHOW_FRAMERATE, "");
- }
-
-
- if(G.fileflags & G_FILE_SHOW_PHYSICS) {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Show Physics Visualization", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_SHOW_PHYSICS, "");
- } else {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Show Physics Visualization", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_SHOW_PHYSICS, "");
- }
-
- if(G.fileflags & G_FILE_SHOW_DEBUG_PROPS) {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Show Debug Properties", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_SHOW_DEBUG_PROPS, "");
- } else {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Show Debug Properties", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_SHOW_DEBUG_PROPS, "");
- }
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 1, 0, "");
-
- if(G.fileflags & G_FILE_AUTOPLAY) {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Autostart", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_AUTOPLAY, "");
- } else {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Autostart", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_AUTOPLAY, "");
- }
-
- uiBlockSetDirection(block, UI_DOWN);
- uiTextBoundsBlock(block, 70);
-
- return block;
-}
-/************************** TIMELINE *****************************/
-
-static void do_info_timelinemenu(void *arg, int event)
-{
- /* needed to check for valid selected objects */
- Base *base=NULL;
- Object *ob=NULL;
- //char file[FILE_MAXDIR+FILE_MAXFILE];
-
- base= BASACT;
- if (base) ob= base->object;
-
- switch(event) {
- case 1:
- /* Show Keyframes */
- if (!ob) error("Select an object before showing its keyframes");
- else set_ob_ipoflags();
- break;
- case 2:
- /* Show and select Keyframes */
- if (!ob) error("Select an object before showing and selecting its keyframes");
- else select_select_keys();
- break;
- case 3:
- /* select next keyframe */
- if (!ob) error("Select an object before selecting its next keyframe");
- else nextkey_obipo(1);
- break;
- case 4:
- /* select previous keyframe */
- if (!ob) error("Select an object before selecting its previous keyframe");
- else nextkey_obipo(-1);
- break;
- case 5:
- /* next keyframe */
- if (!ob) error("Select an object before going to its next keyframe");
- else movekey_obipo(1);
- break;
- case 6:
- /* previous keyframe */
- if (!ob) error("Select an object before going to its previous keyframe");
- else movekey_obipo(-1);
- break;
- case 7:
- /* next frame */
- CFRA++;
- update_for_newframe();
- break;
- case 8:
- /* previous frame */
- CFRA--;
- if(CFRA<1) CFRA=1;
- update_for_newframe();
- break;
- case 9:
- /* forward 10 frames */
- CFRA+= 10;
- update_for_newframe();
- break;
- case 10:
- /* back 10 frames */
- CFRA-= 10;
- if(CFRA<1) CFRA=1;
- update_for_newframe();
- break;
- case 11:
- /* end frame */
- CFRA= EFRA;
- update_for_newframe();
- break;
- case 12:
- /* start frame */
- CFRA= SFRA;
- update_for_newframe();
- break;
- }
- allqueue(REDRAWINFO, 0);
-}
-
-static uiBlock *info_timelinemenu(void *arg_unused)
-{
-/* static short tog=0; */
- uiBlock *block;
- char str[26];
- short yco= 0;
- short menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "timelinemenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_info_timelinemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Keyframes|K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show and Select Keyframes|Shift K",0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Next Keyframe|PageUp", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Previous Keyframe|PageDown", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Next Keyframe|Ctrl PageUp", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Previous Keyframe|Ctrl PageDown", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Next Frame|RightArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Previous Frame|LeftArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
-
- sprintf(str, "Forward %d Frames|UpArrow", G.scene->jumpframe);
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, str, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
- sprintf(str, "Back %d Frames|DownArrow", G.scene->jumpframe);
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, str, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "End Frame|Shift RightArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Start Frame|Shift LeftArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
-
- uiBlockSetDirection(block, UI_DOWN);
- uiTextBoundsBlock(block, 80);
-
- return block;
-}
-
-/************************** RENDER *****************************/
-
-void do_info_render_bakemenu(void *arg, int event)
-{
-
- objects_bake_render(event);
-
- allqueue(REDRAWINFO, 0);
-}
-
-static uiBlock *info_render_bakemenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0;
-
- block= uiNewBlock(&curarea->uiblocks, "render_bakemenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_info_render_bakemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Full Render|Ctrl Alt B, 1", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Ambient Occlusion|Ctrl Alt B, 2", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Normals|Ctrl Alt B, 3", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Texture Only|Ctrl Alt B, 4", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 4, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-static void do_info_rendermenu(void *arg, int event)
-{
- ScrArea *sa;
- extern void playback_anim();
-
- /* events >=10 are registered bpython scripts */
- if (event >= 10) {
- if(curarea->spacetype==SPACE_INFO) {
- sa= find_biggest_area_of_type(SPACE_SCRIPT);
- if (!sa) sa= closest_bigger_area();
- areawinset(sa->win);
- }
-
- BPY_menu_do_python(PYMENU_RENDER, event - 10);
- BIF_undo_push("Rendering Script");
- }
- else {
- switch(event) {
-
- case 0:
- BIF_do_render(0);
- break;
- case 1:
- BIF_do_render(1);
- break;
-
- /* note: dont use select_area() for setting active areas for opengl render */
- /* its hackish and instable... code here was removed */
-
- case 4:
- BIF_toggle_render_display();
- break;
- case 5:
- playback_anim();
- break;
- case 6:
- /* dodgy hack turning on SHIFT key to do a proper render border select
- set_render_border(); only works when 3d window active
-
- This code copied from toolbox.c, only works when 3d window is cameraview */
-
- if(select_area(SPACE_VIEW3D)) {
- mainqenter(LEFTSHIFTKEY, 1);
- mainqenter(BKEY, 1);
- mainqenter(BKEY, 0);
- mainqenter(EXECUTE, 1);
- mainqenter(LEFTSHIFTKEY, 0);
- }
-
- break;
-
- case 7:
- extern_set_butspace(F10KEY, 0);
- break;
- }
- }
- allqueue(REDRAWINFO, 0);
-}
-
-static uiBlock *info_rendermenu(void *arg_unused)
-{
- uiBlock *block;
- BPyMenu *pym;
- short yco= 0;
- short menuwidth=120;
- int i=0;
-
- block= uiNewBlock(&curarea->uiblocks, "rendermenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_info_rendermenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Render Current Frame|F12", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Render Animation|Ctrl F12", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, info_render_bakemenu, NULL, ICON_RIGHTARROW_THIN, "Bake Render Meshes", 0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Render Buffer|F11", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Play Back Rendered Animation|Ctrl F11", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Render Border|Shift B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Render Settings|F10", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- for (pym = BPyMenuTable[PYMENU_RENDER]; pym; pym = pym->next, i++) {
- uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i+10, pym->tooltip?pym->tooltip:pym->filename);
- }
-
- uiBlockSetDirection(block, UI_DOWN);
- uiTextBoundsBlock(block, 80);
-
- return block;
-}
-
-/************************** HELP *****************************/
-
-static void do_info_help_websitesmenu(void *arg, int event)
-{
- BPY_menu_do_python(PYMENU_HELPWEBSITES, event);
-
- allqueue(REDRAWVIEW3D, 0);
-}
-
-
-static uiBlock *info_help_websitesmenu(void *arg_unused)
-{
- uiBlock *block;
- BPyMenu *pym;
- short yco = 20, menuwidth = 120;
- int i = 0;
-
- block= uiNewBlock(&curarea->uiblocks, "info_help_websitesmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_info_help_websitesmenu, NULL);
-
- for (pym = BPyMenuTable[PYMENU_HELPWEBSITES]; pym; pym = pym->next, i++) {
- uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i, pym->tooltip?pym->tooltip:pym->filename);
- }
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-
-static void do_info_help_systemmenu(void *arg, int event)
-{
- /* events >=10 are registered bpython scripts */
- if (event >= 10) BPY_menu_do_python(PYMENU_HELPSYSTEM, event - 10);
- else {
- switch(event) {
-
- case 1: /* Benchmark */
- /* dodgy hack turning on CTRL ALT SHIFT key to do a benchmark
- * rather than copying lines and lines of code from toets.c :(
- */
-
- if(select_area(SPACE_VIEW3D)) {
- mainqenter(LEFTSHIFTKEY, 1);
- mainqenter(LEFTCTRLKEY, 1);
- mainqenter(LEFTALTKEY, 1);
- mainqenter(TKEY, 1);
- mainqenter(TKEY, 0);
- mainqenter(EXECUTE, 1);
- mainqenter(LEFTSHIFTKEY, 0);
- mainqenter(LEFTCTRLKEY, 0);
- mainqenter(LEFTALTKEY, 0);
- }
- break;
- }
- }
-
- allqueue(REDRAWVIEW3D, 0);
-}
-
-
-static uiBlock *info_help_systemmenu(void *arg_unused)
-{
- uiBlock *block;
- BPyMenu *pym;
- short yco = 20, menuwidth = 120;
- int i = 0;
-
- block= uiNewBlock(&curarea->uiblocks, "info_help_systemmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_info_help_systemmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Benchmark", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
-
- for (pym = BPyMenuTable[PYMENU_HELPSYSTEM]; pym; pym = pym->next, i++) {
- uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i+10, pym->tooltip?pym->tooltip:pym->filename);
- }
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-
-static void do_info_helpmenu(void *arg, int event)
-{
- ScrArea *sa;
-
- if(curarea->spacetype==SPACE_INFO) {
- sa= find_biggest_area_of_type(SPACE_SCRIPT);
- if (!sa) sa= closest_bigger_area();
- areawinset(sa->win);
- }
-
- /* events >=10 are registered bpython scripts */
- if (event >= 10) BPY_menu_do_python(PYMENU_HELP, event - 10);
- else {
- switch(event) {
-
- case 0: /* About Blender */
- break;
- }
- }
-
- allqueue(REDRAWINFO, 0);
-}
-
-static uiBlock *info_helpmenu(void *arg_unused)
-{
-/* static short tog=0; */
- uiBlock *block;
- short yco= 0;
- short menuwidth=120;
- BPyMenu *pym;
- int i = 0;
-
- block= uiNewBlock(&curarea->uiblocks, "info_helpmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_info_helpmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, B_SHOWSPLASH, ICON_BLANK1, "About Blender...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- for (pym = BPyMenuTable[PYMENU_HELP]; pym; pym = pym->next, i++) {
- uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i+10, pym->tooltip?pym->tooltip:pym->filename);
- }
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, info_help_websitesmenu, NULL, ICON_RIGHTARROW_THIN, "Websites", 0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, info_help_systemmenu, NULL, ICON_RIGHTARROW_THIN, "System", 0, yco-=20, 120, 19, "");
-
- uiBlockSetDirection(block, UI_DOWN);
- uiTextBoundsBlock(block, 80);
-
- return block;
-}
-
-/************************** END MAIN MENU *****************************/
-/* ugly global yes, for renderwin.c to write to */
-char info_time_str[32]="";
-
-static void info_text(int x, int y)
-{
- Object *ob= OBACT;
- extern float hashvectf[];
- extern unsigned long mem_in_use, mmap_in_use;
- unsigned int swatch_color;
- float fac1, fac2, fac3;
- char infostr[300], memstr[64];
- char *headerstr, *s;
- int hsize;
-
- s= memstr + sprintf(memstr," | Mem:%.2fM ", ((mem_in_use-mmap_in_use)>>10)/1024.0);
- if(mmap_in_use)
- sprintf(s,"(%.2fM) ", ((mmap_in_use)>>10)/1024.0);
-
-
- if(G.obedit) {
- s = infostr;
-
- s+= sprintf(s, "%s", G.editModeTitleExtra);
- if(G.obedit->type==OB_MESH) {
- if(G.scene->selectmode & SCE_SELECT_VERTEX)
- s+= sprintf(s,"Ve:%d-%d | Ed:%d-%d | Fa:%d-%d",
- G.totvertsel, G.totvert, G.totedgesel, G.totedge, G.totfacesel, G.totface);
- else if(G.scene->selectmode & SCE_SELECT_EDGE)
- s+= sprintf(s,"Ed:%d-%d | Fa:%d-%d",
- G.totedgesel, G.totedge, G.totfacesel, G.totface);
- else
- s+= sprintf(s,"Fa:%d-%d", G.totfacesel, G.totface);
- }
- else if(G.obedit->type==OB_ARMATURE) {
- s+= sprintf(s,"Ve:%d-%d | Bo:%d-%d", G.totvertsel, G.totvert, G.totbonesel, G.totbone);
- }
- else {
- s+= sprintf(s,"Ve:%d-%d", G.totvertsel, G.totvert);
- }
-
- strcat(s, memstr);
- }
- else if(ob && (ob->flag & OB_POSEMODE)) {
- sprintf(infostr,"Bo:%d-%d %s",
- G.totbonesel, G.totbone, memstr);
- }
- else {
- sprintf(infostr,"Ve:%d | Fa:%d | Ob:%d-%d | La:%d %s | Time:%s | ",
- G.totvert, G.totface, G.totobj, G.totobjsel, G.totlamp, memstr, info_time_str);
- }
- if(ob) {
- strcat(infostr, ob->id.name+2);
- }
-
- if (g_progress_bar && g_progress_info) {
- headerstr= g_progress_info;
- } else {
- headerstr= versionstr;
- }
-
- if (g_progress_bar) {
- hsize = 4 + (138.0 * g_done);
- fac1 = 0.5 * g_done; /* do some rainbow colors on progress */
- fac2 = 1.0;
- fac3 = 0.9;
- } else {
- hsize= 30+BIF_GetStringWidth(G.font, headerstr, (U.transopts & USER_TR_BUTTONS));
-
- /* promise! Never change these lines again! (zr & ton did!) */
- fac1= fabs(hashvectf[ 2*G.version+4]);
- fac2= 0.5+0.1*hashvectf[ G.version+3];
- fac3= 0.7;
- }
-
- swatch_color= hsv_to_cpack(fac1, fac2, fac3);
-
- cpack( swatch_color );
- glRecti(x-24, y-6, x-30+hsize, y+14);
-
- glColor3ub(0, 0, 0); /* makes text black colored rect */
-
- glRasterPos2i(x, y);
- BIF_RasterPos(x, y);
-
- BIF_DrawString(G.font, headerstr, (U.transopts & USER_TR_MENUS));
- hsize= BIF_GetStringWidth(G.font, headerstr, (U.transopts & USER_TR_BUTTONS));
-
- BIF_ThemeColor(TH_MENU_TEXT); /* makes text readable on dark theme */
-
- glRasterPos2i(x+hsize+10, y);
- BIF_RasterPos(x+hsize+10, y);
-
- BIF_DrawString(G.font, infostr, (U.transopts & USER_TR_MENUS));
-}
-
-void info_buttons(void)
-{
- uiBlock *block;
- short xco= 42;
- int xmax;
-
- block= uiNewBlock(&curarea->uiblocks, "header info", UI_EMBOSSN, UI_HELV, curarea->headwin);
-
- if(area_is_active_area(curarea)) uiBlockSetCol(block, TH_HEADER);
- else uiBlockSetCol(block, TH_HEADERDESEL);
-
- if(curarea->flag & HEADER_NO_PULLDOWN) {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, B_FLIPINFOMENU, ICON_DISCLOSURE_TRI_RIGHT,
- xco,2,XIC,YIC-2,
- &(curarea->flag), 0, 0, 0, 0, "Enables display of pulldown menus");
- } else {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, B_FLIPINFOMENU, ICON_DISCLOSURE_TRI_DOWN,
- xco,2,XIC,YIC-2,
- &(curarea->flag), 0, 0, 0, 0, "Hides pulldown menus");
- }
- xco+=XIC;
-
- if((curarea->flag & HEADER_NO_PULLDOWN)==0) {
-
- uiBlockSetEmboss(block, UI_EMBOSSP);
-
- /* the 'xmax - 3' rather than xmax is to prevent some weird flickering where the highlighted
- * menu is drawn wider than it should be. The ypos of -1 is to make it properly fill the
- * height of the header */
- xmax= GetButStringLength("File");
- uiDefPulldownBut(block, info_filemenu, NULL, "File", xco, -1, xmax-3, 22, "");
- xco+= xmax;
-
- xmax= GetButStringLength("Add");
- uiDefPulldownBut(block, info_addmenu, NULL, "Add", xco, -1, xmax-3, 22, "");
- xco+= xmax;
-
- xmax= GetButStringLength("Timeline");
- uiDefPulldownBut(block, info_timelinemenu, NULL, "Timeline", xco, -1, xmax-3, 22, "");
- xco+= xmax;
-
- xmax= GetButStringLength("Game");
- uiDefPulldownBut(block, info_gamemenu, NULL, "Game", xco, -1, xmax-3, 22, "");
- xco+= xmax;
-
- xmax= GetButStringLength("Render");
- uiDefPulldownBut(block, info_rendermenu, NULL, "Render", xco, -1, xmax-3, 22, "");
- xco+= xmax;
-
- xmax= GetButStringLength("Help");
- uiDefPulldownBut(block, info_helpmenu, NULL, "Help", xco, -1, xmax-3, 22, "");
- xco+= xmax;
-
- }
-
- /* pack icon indicates a packed file */
-
- if (G.fileflags & G_AUTOPACK) {
- uiBlockSetEmboss(block, UI_EMBOSSN);
- uiDefIconBut(block, LABEL, 0, ICON_PACKAGE, xco, 0, XIC, YIC, &G.fileflags, 0.0, 0.0, 0, 0, "Indicates this is a Packed file. See File menu.");
- xco += XIC;
- }
-
- if (curarea->full == 0) {
- curarea->butspacetype= SPACE_INFO;
- uiBlockSetEmboss(block, UI_EMBOSS);
- uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D, windowtype_pup(), 8,0,XIC+10,YIC, &(curarea->butspacetype), 1.0, SPACEICONMAX, 0, 0, "Displays Current Window Type. Click for menu of available types.");
-
- /* STD SCREEN BUTTONS */
- xco= std_libbuttons(block, xco, 0, 0, NULL, B_INFOSCR, ID_SCR, 0, (ID *)G.curscreen, 0, &G.curscreen->screennr, 1, 1, B_INFODELSCR, 0, 0);
-
- xco +=8;
-
- /* STD SCENE BUTTONS */
- xco= std_libbuttons(block, xco, 0, 0, NULL, B_INFOSCE, ID_SCE, 0, (ID *)G.scene, 0, &G.curscreen->scenenr, 1, 1, B_INFODELSCE, 0, 0);
- }
- else xco= 430;
-
-BIF_SetScale(block->aspect);
- info_text(xco+24, 6);
-
- uiBlockSetEmboss(block, UI_EMBOSSN);
- uiDefIconBut(block, BUT, B_SHOWSPLASH, ICON_BLENDER, xco+2, 0,XIC,YIC, 0, 0, 0, 0, 0, "Click to display Splash Screen");
-
- /* always do as last */
- curarea->headbutlen= xco+2*XIC;
-
-#if 0
-// #ifdef _WIN32 // FULLSCREEN
- if(U.uiflag & USER_FLIPFULLSCREEN) {
- uiDefIconBut(block, BUT, B_FLIPFULLSCREEN, ICON_WINDOW_WINDOW,
- (short)(curarea->winx-XIC-5), 0,XIC,YIC,
- 0, 0, 0, 0, 0, "Toggles Blender to fullscreen mode");/* dir */
- } else {
- uiDefIconBut(block, BUT, B_FLIPFULLSCREEN, ICON_WINDOW_FULLSCREEN,
- (short)(curarea->winx-XIC-5), 0,XIC,YIC,
- 0, 0, 0, 0, 0, "Toggles Blender to fullscreen mode");/* dir */
- }
-#endif
-
- uiDrawBlock(block);
-}
diff --git a/source/blender/src/header_ipo.c b/source/blender/src/header_ipo.c
deleted file mode 100644
index 4f98e966f8c..00000000000
--- a/source/blender/src/header_ipo.c
+++ /dev/null
@@ -1,1408 +0,0 @@
-/**
- * header_ipo.c oct-2003
- *
- * Functions to draw the "Ipo Curve Editor" window header
- * and handle user events sent to it.
- *
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "DNA_action_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_ID.h"
-#include "DNA_ipo_types.h"
-#include "DNA_key_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_material_types.h"
-#include "DNA_object_types.h"
-#include "DNA_object_fluidsim.h"
-#include "DNA_particle_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_space_types.h"
-#include "DNA_sequence_types.h"
-#include "DNA_sound_types.h"
-#include "DNA_world_types.h"
-
-#include "BKE_action.h"
-#include "BKE_constraint.h"
-#include "BKE_depsgraph.h"
-#include "BKE_global.h"
-#include "BKE_ipo.h"
-#include "BKE_key.h"
-#include "BKE_main.h"
-#include "BKE_material.h"
-#include "BKE_particle.h"
-#include "BKE_texture.h"
-#include "BKE_utildefines.h"
-
-#include "BLI_blenlib.h"
-
-#include "BSE_drawipo.h"
-#include "BSE_editipo_types.h"
-#include "BSE_edit.h"
-#include "BSE_editipo.h"
-#include "BSE_headerbuttons.h"
-#include "BSE_time.h"
-
-#include "BIF_editaction.h"
-#include "BIF_editconstraint.h"
-#include "BIF_interface.h"
-#include "BIF_mainqueue.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-
-#include "nla.h"
-
-#include "blendef.h"
-#include "mydevice.h"
-
-extern int totipo_edit, totipo_sel;
-
-/* headerbutton call, assuming full context is set */
-/* it aligns with editipo.c, verify_ipo */
-void spaceipo_assign_ipo(SpaceIpo *si, Ipo *ipo)
-{
- if(si->from==NULL || si->from->lib) return;
-
- if(ipo) ipo->id.us++;
-
- /* first check action ipos */
- if(si->actname && si->actname[0]) {
- Object *ob= (Object *)si->from;
- bActionChannel *achan;
-
- if(ob->action) {
- achan= verify_action_channel(ob->action, si->actname);
-
- if(achan) {
- /* constraint exception */
- if(si->blocktype==ID_CO) {
- bConstraintChannel *conchan= get_constraint_channel(&achan->constraintChannels, si->constname);
- if(conchan) {
- if(conchan->ipo)
- conchan->ipo->id.us--;
- conchan->ipo= ipo;
- }
- }
- else {
- if(achan->ipo)
- achan->ipo->id.us--;
- achan->ipo= ipo;
- }
- }
- }
- }
- else {
- switch(GS(si->from->name)) {
- case ID_OB:
- {
- Object *ob= (Object *)si->from;
- /* constraint exception */
- if(si->blocktype==ID_CO) {
- /* check the local constraint ipo */
- if(si->bonename && si->bonename[0] && ob->pose) {
- bPoseChannel *pchan= get_pose_channel(ob->pose, si->bonename);
- bConstraint *con;
-
- for(con= pchan->constraints.first; con; con= con->next)
- if(strcmp(con->name, si->constname)==0)
- break;
- if(con) {
- if(con->ipo)
- con->ipo->id.us--;
- con->ipo= ipo;
- }
- }
- else {
- bConstraintChannel *conchan= get_constraint_channel(&ob->constraintChannels, si->constname);
- if(conchan) {
- if(conchan->ipo)
- conchan->ipo->id.us--;
- conchan->ipo= ipo;
- }
- }
- }
- else if(si->blocktype==ID_FLUIDSIM) { // NT
- if( (ob->fluidsimSettings) &&
- (ob->fluidsimSettings->ipo) ) {
- // decrement users counter
- ob->fluidsimSettings->ipo->id.us--;
- }
- ob->fluidsimSettings->ipo = ipo;
- }
- else if(si->blocktype==ID_PA) {
- ParticleSystem *psys=psys_get_current(ob);
- if(psys){
- if(psys->part->ipo){
- psys->part->ipo->id.us--;
- }
- psys->part->ipo = ipo;
- }
- }
- else if(si->blocktype==ID_OB) {
- if(ob->ipo)
- ob->ipo->id.us--;
- ob->ipo= ipo;
- }
- }
- break;
- case ID_MA:
- {
- Material *ma= (Material *)si->from;
-
- if(ma->ipo)
- ma->ipo->id.us--;
- ma->ipo= ipo;
- }
- break;
- case ID_TE:
- {
- Tex *tex= (Tex *)si->from;
-
- if(tex->ipo)
- tex->ipo->id.us--;
- tex->ipo= ipo;
- }
- break;
- case ID_SEQ:
- {
- Sequence *seq= (Sequence *)si->from; /* note, sequence is mimicing Id */
-
- if((seq->type & SEQ_EFFECT)
- || (seq->type == SEQ_RAM_SOUND)
- || (seq->type == SEQ_HD_SOUND)) {
- if(seq->ipo)
- seq->ipo->id.us--;
- seq->ipo= ipo;
- }
- }
- break;
- case ID_CU:
- {
- Curve *cu= (Curve *)si->from;
-
- if(cu->ipo)
- cu->ipo->id.us--;
- cu->ipo= ipo;
- }
- break;
- case ID_KE:
- {
- Key *key= (Key *)si->from;
-
- if(key->ipo)
- key->ipo->id.us--;
- key->ipo= ipo;
- }
- break;
- case ID_WO:
- {
- World *wo= (World *)si->from;
-
- if(wo->ipo)
- wo->ipo->id.us--;
- wo->ipo= ipo;
- }
- break;
- case ID_LA:
- {
- Lamp *la= (Lamp *)si->from;
-
- if(la->ipo)
- la->ipo->id.us--;
- la->ipo= ipo;
- }
- break;
- case ID_CA:
- {
- Camera *ca= (Camera *)si->from;
-
- if(ca->ipo)
- ca->ipo->id.us--;
- ca->ipo= ipo;
- }
- break;
- case ID_SO:
- {
- bSound *snd= (bSound *)si->from;
-
- if(snd->ipo)
- snd->ipo->id.us--;
- snd->ipo= ipo;
- }
- }
- }
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWBUTSALL, 0);
-
-}
-
-
-static void do_ipo_editmenu_transformmenu(void *arg, int event)
-{
- switch(event)
- {
- case 0: /* grab/move */
- transform_ipo('g');
- break;
- case 1: /* rotate */
- transform_ipo('r');
- break;
- case 2: /* scale */
- transform_ipo('s');
- break;
- }
-}
-
-static uiBlock *ipo_editmenu_transformmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "ipo_editmenu_transformmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_ipo_editmenu_transformmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Grab/Move|G", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Rotate|R", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Scale|S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-
-static void do_ipo_editmenu_snapmenu(void *arg, int event)
-{
- switch(event) {
- case 1: /* Horizontal */
- case 2: /* To Next */
- case 3: /* To Frame */
- case 4: /* To Current Frame */
- ipo_snap(event);
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *ipo_editmenu_snapmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "ipo_editmenu_snapmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_ipo_editmenu_snapmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Horizontal|Shift S, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "To Next|Shift S, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "To Frame|Shift S, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "To Current Frame|Shift S, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_ipo_editmenu_mirrormenu(void *arg, int event)
-{
- switch(event) {
- case 1: /* mirror over current frame */
- case 2: /* mirror over frame 0 */
- case 3: /* mirror over horizontal axis */
- ipo_mirror(event);
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *ipo_editmenu_mirrormenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "ipo_editmenu_mirrormenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_ipo_editmenu_mirrormenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Over Current Frame|Shift M, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Over Vertical Axis|Shift M, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Over Horizontal Axis|Shift M, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_ipo_editmenu_joinmenu(void *arg, int event)
-{
- switch(event) {
- case 1: /* All Selected */
- case 2: /* Selected Doubles */
- join_ipo(event);
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *ipo_editmenu_joinmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "ipo_editmenu_joinmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_ipo_editmenu_joinmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "All Selected|Ctrl J, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Selected Doubles|Ctrl J, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_ipo_editmenu_keymenu(void *arg, int event)
-{
- Key *key;
- KeyBlock *kb;
- Object *ob= OBACT;
-
- if(G.sipo->blocktype==ID_KE && totipo_edit==0 && totipo_sel==0) {
- key= ob_get_key((Object *)G.sipo->from);
- if(key==NULL) return;
-
- kb= BLI_findlink(&key->block, ob->shapenr-1);
- kb->type= 0;
- switch(event){
- case 0:
- kb->type= KEY_LINEAR;
- break;
- case 1:
- kb->type= KEY_CARDINAL;
- break;
- case 2:
- kb->type= KEY_BSPLINE;
- break;
- }
- }
-}
-
-static uiBlock *ipo_editmenu_keymenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "ipo_editmenu_keymenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_ipo_editmenu_keymenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Linear|T, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Cardinal|T, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "BSpline|T, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-
-}
-
-static void do_ipo_editmenu_handlemenu(void *arg, int event)
-{
- switch(event){
- case 0:
- sethandles_ipo(HD_AUTO);
- break;
- case 1:
- case 2:
- sethandles_ipo(HD_ALIGN);
- break;
- case 3:
- sethandles_ipo(HD_VECT);
- break;
- case 4:
- sethandles_ipo(HD_AUTO_ANIM);
- break;
- }
-}
-
-static uiBlock *ipo_editmenu_handlemenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "ipo_editmenu_handlemenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_ipo_editmenu_handlemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Auto|Shift H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Auto Clamped|Alt H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Aligned|H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Free|H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Vector|V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-
-static void do_ipo_editmenu_intpolmenu(void *arg, int event)
-{
- EditIpo *ei;
- int a;
-
- get_status_editipo();
-
- ei = G.sipo->editipo;
-
- switch(event)
- {
- case 0:
- for(a=0; a<G.sipo->totipo; a++, ei++) {
- if ISPOIN3(ei, flag & IPO_VISIBLE, flag & IPO_SELECT, icu) {
- ei->icu->ipo= IPO_CONST;
- }
- }
- break;
- case 1:
- for(a=0; a<G.sipo->totipo; a++, ei++) {
- if ISPOIN3(ei, flag & IPO_VISIBLE, flag & IPO_SELECT, icu) {
- ei->icu->ipo= IPO_LIN;
- }
- }
- break;
- case 2:
- for(a=0; a<G.sipo->totipo; a++, ei++) {
- if ISPOIN3(ei, flag & IPO_VISIBLE, flag & IPO_SELECT, icu) {
- ei->icu->ipo= IPO_BEZ;
- }
- }
- break;
- }
-
- scrarea_queue_winredraw(curarea);
-}
-
-static uiBlock *ipo_editmenu_intpolmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "ipo_editmenu_intpolmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_ipo_editmenu_intpolmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Constant|T, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Linear|T, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Bezier|T, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-
-static void do_ipo_editmenu_extendmenu(void *arg, int event)
-{
- switch(event)
- {
- case 0:
- do_ipo_buttons(B_IPOCONT);
- break;
- case 1:
- do_ipo_buttons(B_IPOEXTRAP);
- break;
- case 2:
- do_ipo_buttons(B_IPOCYCLIC);
- break;
- case 3:
- do_ipo_buttons(B_IPOCYCLICX);
- break;
- }
-}
-
-static uiBlock *ipo_editmenu_extendmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "ipo_editmenu_extendmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_ipo_editmenu_extendmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Constant", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extrapolation", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Cyclic", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Cyclic Extrapolation", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-
-
-static void do_ipo_editmenu(void *arg, int event)
-{
- switch(event)
- {
- case 0:
- del_ipo(1);
- break;
- case 1:
- add_duplicate_editipo();
- break;
- case 2:
- ipo_record();
- break;
- case 3:
- mainqenter(IKEY, 1);
- break;
- case 4 :
- add_blockhandler(curarea, IPO_HANDLER_PROPERTIES, UI_PNL_UNSTOW);
- break;
- case 5:
- //join_ipo();
- break;
- case 6:
- /*IPO Editmode*/
- set_editflag_editipo();
- break;
- case 7:
- sethandles_ipo(HD_AUTO_ANIM);
- break;
- case 8: /* clean ipo */
- clean_ipo();
- break;
- case 9: /* smooth ipo */
- smooth_ipo();
- break;
- }
-}
-
-static uiBlock *ipo_editmenu(void *arg_unused)
-{
- uiBlock *block;
- EditIpo *ei;
- short yco= 0, menuwidth=120;
- int a,isedit = 0;
-
- get_status_editipo();
-
- ei = G.sipo->editipo;
-
- block= uiNewBlock(&curarea->uiblocks, "ipo_editmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_ipo_editmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Transform Properties|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
-
- uiDefIconTextBlockBut(block, ipo_editmenu_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 19, "");
-
- uiDefIconTextBlockBut(block, ipo_editmenu_snapmenu, NULL, ICON_RIGHTARROW_THIN, "Snap", 0, yco-=20, 120, 19, "");
-
- uiDefIconTextBlockBut(block, ipo_editmenu_mirrormenu, NULL, ICON_RIGHTARROW_THIN, "Mirror", 0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- /*Look to see if any ipos are being edited, so there can be a check next to the menu option*/
- for(a=0; a<G.sipo->totipo; a++, ei++) {
- if(ei->icu) {
- if(ei->flag & IPO_VISIBLE) {
- if(totipo_edit && (ei->flag & IPO_EDIT)) {
- isedit = 1;
- break;
- }
- }
- }
- }
- if(isedit)
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Edit Selected|TAB", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
- else
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Edit Selected|TAB", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
-
- ei = get_active_editipo();
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- if(ei && ei->icu && ei->icu->driver)
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Insert 1:1 Curve...|I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
- else
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Insert Keyframe...|I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate|Shift D", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Record Mouse Movement|Ctrl R", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clean IPO Curves|O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Smooth IPO Curves|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 9, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete|X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBlockBut(block, ipo_editmenu_joinmenu, NULL, ICON_RIGHTARROW_THIN, "Join", 0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Auto Clamped Handles|Alt H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
-
- if (!G.sipo->showkey){
- uiDefIconTextBlockBut(block, ipo_editmenu_extendmenu, NULL, ICON_RIGHTARROW_THIN, "Extend Mode", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, ipo_editmenu_intpolmenu, NULL, ICON_RIGHTARROW_THIN, "Interpolation Mode ", 0, yco-=20, 120, 20, "");
- if(ei != NULL && (ei->flag & IPO_EDIT))
- uiDefIconTextBlockBut(block, ipo_editmenu_handlemenu, NULL, ICON_RIGHTARROW_THIN, "Handle Type", 0, yco-=20, 120, 19, "");
- if(G.sipo->blocktype==ID_KE && totipo_edit==0 && totipo_sel==0)
- uiDefIconTextBlockBut(block, ipo_editmenu_keymenu, NULL, ICON_RIGHTARROW_THIN, "Key Type", 0, yco-=20, 120, 19, "");
- }
-
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-static void do_ipo_viewmenu(void *arg, int event)
-{
- extern int play_anim(int mode);
-
- switch(event)
- {
- case 1:
- do_ipo_buttons(B_IPOHOME);
- break;
- case 2:
- ipo_toggle_showkey();
- scrarea_queue_headredraw(curarea);
- scrarea_queue_winredraw(curarea);
- allqueue(REDRAWVIEW3D, 0);
- break;
- case 3:
- move_to_frame();
- break;
- case 4:
- mainqenter(PADPLUSKEY,1);
- break;
- case 5:
- mainqenter(PADMINUS,1);
- break;
- case 6: /* Play Animation */
- play_anim(0);
- break;
- case 7: /* Play Animation in All */
- play_anim(1);
- break;
- case 8:
- add_blockhandler(curarea, IPO_HANDLER_PROPERTIES, UI_PNL_UNSTOW);
- break;
- case 9:
- G.v2d->flag ^= V2D_VIEWLOCK;
- if(G.v2d->flag & V2D_VIEWLOCK)
- view2d_do_locks(curarea, 0);
- break;
- case 10: /* center view to current frame */
- center_currframe();
- scrarea_queue_winredraw(curarea);
- break;
- case 11:
- do_ipo_buttons(B_IPOVIEWCENTER);
- break;
- }
-}
-
-static uiBlock *ipo_viewmenu(void *arg_unused)
-{
- uiBlock *block;
- EditIpo *ei;
- short yco= 0, menuwidth=120;
-
- ei = get_active_editipo();
-
- block= uiNewBlock(&curarea->uiblocks, "ipo_viewmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_ipo_viewmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Channel Properties|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, "");
-
- if (G.sipo->showkey)
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Show Keys|K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
- else
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Show Keys|K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Zoom Out|NumPad -", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Zoom In|NumPad +", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Play Animation|Alt A", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Play Animation in 3D View|Alt Shift A", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Center on Current Frame|Shift C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 10, "");
- uiDefIconTextBut(block, BUTM, 1, (G.v2d->flag & V2D_VIEWLOCK)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT,
- "Lock Time to Other Windows|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
-
- if (ei != NULL && (ei->flag & IPO_EDIT)) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Move Current Frame to Selected|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
- }
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "View Selected|NumPad .", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 11, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "View All|Home", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
- if(!curarea->full) uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Maximize Window|Ctrl UpArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0,20, "");
- else uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Tile Window|Ctrl DownArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 20, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-static void do_ipo_selectmenu(void *arg, int event)
-{
- switch(event)
- {
- case 0:
- borderselect_ipo();
- break;
- case 1:
- swap_selectall_editipo();
- break;
- case 2:
- borderselect_markers();
- allqueue(REDRAWMARKER, 0);
- break;
- case 3:
- deselect_markers(1, 0);
- allqueue(REDRAWMARKER, 0);
- break;
- }
-}
-
-static uiBlock *ipo_selectmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "ipo_selectmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_ipo_selectmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select Markers|Ctrl B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All Markers|Ctrl A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-static void do_ipo_markermenu(void *arg, int event)
-{
- switch(event)
- {
- case 1:
- add_marker(CFRA);
- break;
- case 2:
- duplicate_marker();
- break;
- case 3:
- remove_marker();
- break;
- case 4:
- rename_marker();
- break;
- case 5:
- transform_markers('g', 0);
- break;
- }
-
- allqueue(REDRAWMARKER, 0);
-}
-
-static uiBlock *ipo_markermenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "ipo_markermenu",
- UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_ipo_markermenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Marker|M", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate Marker|Ctrl Shift D", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Marker|X", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "(Re)Name Marker|Ctrl M", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Grab/Move Marker|Ctrl G", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-static char *ipo_modeselect_pup(void)
-{
- Object *ob= OBACT;
- static char formatstring[] = "|%s %%x%d %%i%d";
- static char string[1024];
- char *str = string;
-
- str += sprintf(str, "Ipo type: %%t");
-
- if(ob)
- str += sprintf(str,formatstring, "Object",ID_OB, ICON_OBJECT);
-
- if(ob && give_current_material(ob, ob->actcol)) // check for material
- str += sprintf(str,formatstring, "Material",ID_MA, ICON_MATERIAL);
-
- if(G.scene->world)
- str += sprintf(str,formatstring, "World",ID_WO, ICON_WORLD);
-
- if(ob && ob->type==OB_CURVE)
- str += sprintf(str,formatstring, "Path",ID_CU, ICON_CURVE);
-
- if(ob && ob->type==OB_CAMERA)
- str += sprintf(str,formatstring, "Camera",ID_CA, ICON_CAMERA);
-
- if(ob && ob->type==OB_LAMP)
- str += sprintf(str,formatstring, "Lamp",ID_LA, ICON_LAMP);
-
- if(ob && give_current_texture(ob, ob->actcol))
- str += sprintf(str,formatstring, "Texture",ID_TE, ICON_TEXTURE);
-
- if(ob){
- if ELEM4(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_LATTICE)
- str += sprintf(str,formatstring, "Shape",ID_KE, ICON_EDIT);
- if (ob->type==OB_ARMATURE)
- str += sprintf(str,formatstring, "Pose",ID_PO, ICON_POSE_HLT);
-#ifdef __CON_IPO
- str += sprintf(str,formatstring, "Constraint",ID_CO, ICON_CONSTRAINT);
-#endif
- if(ob->fluidsimFlag & OB_FLUIDSIM_ENABLE) {
- str += sprintf(str,formatstring,"Fluidsim",ID_FLUIDSIM, ICON_WORLD);
- }
-
- if(ob->particlesystem.first) {
- str += sprintf(str,formatstring,"Particles",ID_PA, ICON_PARTICLES);
- }
- }
-
- str += sprintf(str,formatstring, "Sequence",ID_SEQ, ICON_SEQUENCE);
-
- return (string);
-}
-
-void do_ipo_buttons(short event)
-{
- EditIpo *ei;
- View2D *v2d;
- rcti rect;
- Object *ob= OBACT;
- float xmin, ymin, dx, dy;
- int a, val, first;
- short mval[2];
-
- if(curarea->win==0) return;
-
- switch(event) {
- case B_IPOVIEWCENTER:
- case B_IPOHOME:
-
- /* boundbox */
-
- v2d= &(G.sipo->v2d);
- first= 1;
-
- ei= G.sipo->editipo;
- if(ei==0) return;
-
- /* map ipo-points for drawing if scaled ipo */
- if (OBACT && OBACT->action && G.sipo->pin==0 && G.sipo->actname) {
- actstrip_map_ipo_keys(OBACT, G.sipo->ipo, 0, 0);
- }
-
- for(a=0; a<G.sipo->totipo; a++, ei++) {
- if ISPOIN(ei, flag & IPO_VISIBLE, icu) {
-
- boundbox_ipocurve(ei->icu, (event==B_IPOVIEWCENTER));
-
- if(first) {
- v2d->tot= ei->icu->totrct;
- first= 0;
- }
- else BLI_union_rctf(&(v2d->tot), &(ei->icu->totrct));
- }
- }
-
- /* undo mapping of ipo-points for drawing if scaled ipo */
- if (OBACT && OBACT->action && G.sipo->pin==0 && G.sipo->actname) {
- actstrip_map_ipo_keys(OBACT, G.sipo->ipo, 1, 0);
- }
-
- /* speciale home */
- if(G.qual & LR_SHIFTKEY) {
- v2d->tot.xmin= SFRA;
- v2d->tot.xmax= EFRA;
- }
-
- /* zoom out a bit */
- dx= 0.10*(v2d->tot.xmax-v2d->tot.xmin);
- dy= 0.10*(v2d->tot.ymax-v2d->tot.ymin);
-
- if(dx<v2d->min[0]) dx= v2d->min[0];
- if(dy<v2d->min[1]) dy= v2d->min[1];
-
- v2d->cur.xmin= v2d->tot.xmin- dx;
- v2d->cur.xmax= v2d->tot.xmax+ dx;
- v2d->cur.ymin= v2d->tot.ymin- dy;
- v2d->cur.ymax= v2d->tot.ymax+ dy;
-
- test_view2d(G.v2d, curarea->winx, curarea->winy);
- view2d_do_locks(curarea, V2D_LOCK_COPY);
- if(G.sipo->ipo) G.sipo->ipo->cur = G.v2d->cur;
-
- scrarea_queue_winredraw(curarea);
- break;
- case B_IPOBORDER:
- val= get_border(&rect, 3);
- if(val) {
- mval[0]= rect.xmin;
- mval[1]= rect.ymin;
- areamouseco_to_ipoco(G.v2d, mval, &xmin, &ymin);
- mval[0]= rect.xmax;
- mval[1]= rect.ymax;
- areamouseco_to_ipoco(G.v2d, mval, &(G.v2d->cur.xmax), &(G.v2d->cur.ymax));
- G.v2d->cur.xmin= xmin;
- G.v2d->cur.ymin= ymin;
-
- test_view2d(G.v2d, curarea->winx, curarea->winy);
- view2d_do_locks(curarea, V2D_LOCK_COPY);
- scrarea_queue_winredraw(curarea);
- }
- break;
-
- case B_IPOPIN:
- allqueue (REDRAWIPO, 0);
- break;
-
- case B_IPOCOPY:
- copy_editipo();
- break;
- case B_IPOPASTE:
- paste_editipo();
- break;
- case B_IPOCONT:
- set_exprap_ipo(IPO_HORIZ);
- break;
- case B_IPOEXTRAP:
- set_exprap_ipo(IPO_DIR);
- break;
- case B_IPOCYCLIC:
- set_exprap_ipo(IPO_CYCL);
- break;
- case B_IPOCYCLICX:
- set_exprap_ipo(IPO_CYCLX);
- break;
- case B_IPOMAIN:
- /* pass 1 to enforce a refresh when there's no Ipo */
- test_editipo(1);
- scrarea_queue_winredraw(curarea);
- scrarea_queue_headredraw(curarea);
- if(ob) ob->ipowin= G.sipo->blocktype;
- break;
- case B_IPOSHOWKEY:
- /* reverse value because of winqread */
- G.sipo->showkey= 1-G.sipo->showkey;
- ipo_toggle_showkey();
- scrarea_queue_headredraw(curarea);
- scrarea_queue_winredraw(curarea);
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_VIEW2DZOOM:
- view2dzoom(event);
- scrarea_queue_headredraw(curarea);
- break;
- case B_IPO_ACTION_OB:
- if(ob && G.sipo->from && G.sipo->pin==0) {
- if(ob->ipoflag & OB_ACTION_OB) { /* check if channel exists, and flip ipo link */
- bActionChannel *achan;
-
- if(has_ipo_code(ob->ipo, OB_LAY))
- notice("Note: Layer Ipo doesn't work in Actions");
-
- if(ob->action==NULL)
- ob->action= add_empty_action("ObAction");
- achan= verify_action_channel(ob->action, "Object");
- if(achan->ipo==NULL && ob->ipo) {
- achan->ipo= ob->ipo;
- ob->ipo= NULL;
- }
-
- /* object constraints */
- if(ob->constraintChannels.first) {
- free_constraint_channels(&achan->constraintChannels);
- achan->constraintChannels= ob->constraintChannels;
- ob->constraintChannels.first= ob->constraintChannels.last= NULL;
- }
- }
- else if(ob->action) {
- bActionChannel *achan= get_action_channel(ob->action, "Object");
- if(achan) {
-
- if(achan->ipo && ob->ipo==NULL) {
- ob->ipo= achan->ipo;
- achan->ipo= NULL;
- }
-
- /* object constraints */
- if(achan->constraintChannels.first) {
- free_constraint_channels(&ob->constraintChannels);
- ob->constraintChannels= achan->constraintChannels;
- achan->constraintChannels.first= achan->constraintChannels.last= NULL;
- }
- }
- }
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWNLA, 0);
- }
- break;
-
- case B_IPO_ACTION_KEY:
- if(ob && G.sipo->from && G.sipo->pin==0) {
- Key *key= ob_get_key(ob);
- if(key) {
- if(ob->ipoflag & OB_ACTION_KEY) { /* check if channel exists, and flip ipo link */
- bActionChannel *achan;
-
- if(ob->action==NULL)
- ob->action= add_empty_action("ShapeAction");
- achan= verify_action_channel(ob->action, "Shape");
- if(achan->ipo==NULL && key->ipo) {
- achan->ipo= key->ipo;
- key->ipo= NULL;
- }
- }
- else if(ob->action) {
- bActionChannel *achan= get_action_channel(ob->action, "Shape");
- if(achan) {
- if(achan->ipo && key->ipo==NULL) {
- key->ipo= achan->ipo;
- achan->ipo= NULL;
- }
- }
- }
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWNLA, 0);
- }
- }
- break;
- case B_IPOVIEWALL:
- /* set visible active */
- for(a=0, ei=G.sipo->editipo; a<G.sipo->totipo; a++, ei++) {
- if (ei->icu) ei->flag |= IPO_VISIBLE;
- else ei->flag &= ~IPO_VISIBLE;
- }
- break;
- case B_IPOREDRAW:
- DAG_object_flush_update(G.scene, ob, OB_RECALC);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIPO, 0);
- break;
- }
-}
-
-void ipo_buttons(void)
-{
- Object *ob;
- EditIpo *ei;
- uiBlock *block;
- short xco,xmax;
- char naam[20];
- int icon=0, allow_pin= B_IPOPIN;
-
- sprintf(naam, "header %d", curarea->headwin);
- block= uiNewBlock(&curarea->uiblocks, naam, UI_EMBOSS, UI_HELV, curarea->headwin);
-
- if(area_is_active_area(curarea)) uiBlockSetCol(block, TH_HEADER);
- else uiBlockSetCol(block, TH_HEADERDESEL);
-
- curarea->butspacetype= SPACE_IPO;
-
- xco = 8;
- uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D, windowtype_pup(), xco,0,XIC+10,YIC, &(curarea->butspacetype), 1.0, SPACEICONMAX, 0, 0, "Displays Current Window Type. Click for menu of available types.");
- xco+= XIC+14;
-
- test_editipo(0); /* test if current editipo is OK, make_editipo sets v2d->cur */
-
- uiBlockSetEmboss(block, UI_EMBOSSN);
- if(curarea->flag & HEADER_NO_PULLDOWN) {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, B_FLIPINFOMENU, ICON_DISCLOSURE_TRI_RIGHT,
- xco,2,XIC,YIC-2,
- &(curarea->flag), 0, 0, 0, 0, "Enables display of pulldown menus");
- } else {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, B_FLIPINFOMENU, ICON_DISCLOSURE_TRI_DOWN,
- xco,2,XIC,YIC-2,
- &(curarea->flag), 0, 0, 0, 0, "Hides pulldown menus");
- }
- uiBlockSetEmboss(block, UI_EMBOSS);
- xco+=XIC;
-
- /* pull down menus */
- if((curarea->flag & HEADER_NO_PULLDOWN)==0) {
- uiBlockSetEmboss(block, UI_EMBOSSP);
-
- ei = get_active_editipo();
-
- xmax= GetButStringLength("View");
- uiDefPulldownBut(block,ipo_viewmenu, NULL, "View", xco, -2, xmax-3, 24, "");
- xco+=xmax;
-
- xmax= GetButStringLength("Select");
- uiDefPulldownBut(block,ipo_selectmenu, NULL, "Select", xco, -2, xmax-3, 24, "");
- xco+=xmax;
-
- xmax= GetButStringLength("Marker");
- uiDefPulldownBut(block,ipo_markermenu, NULL, "Marker", xco, -2, xmax-3, 24, "");
- xco+=xmax;
-
- if (G.sipo->showkey) {
- xmax= GetButStringLength("Key");
- uiDefPulldownBut(block,ipo_editmenu, NULL, "Key", xco, -2, xmax-3, 24, "");
- }
- else if(ei != NULL && (ei->flag & IPO_EDIT)) {
- xmax= GetButStringLength("Point");
- uiDefPulldownBut(block,ipo_editmenu, NULL, "Point", xco, -2, xmax-3, 24, "");
- }
- else {
- xmax= GetButStringLength("Curve");
- uiDefPulldownBut(block,ipo_editmenu, NULL, "Curve", xco, -2, xmax-3, 24, "");
- }
- xco+=xmax;
- }
-
- /* end of pull down menus */
- uiBlockSetEmboss(block, UI_EMBOSS);
-
- ob= OBACT;
-
- /* action switch option, only when active object is there and no pin */
- uiSetButLock(G.sipo->pin, "Can't change because of pinned data");
-
- /* define whether ipos are on Object or on action */
- if(ob) {
- static short fake1= 1;
-
- uiBlockBeginAlign(block);
-
- if(G.sipo->blocktype==ID_OB) {
- uiDefIconButBitS(block, TOG, OB_ACTION_OB, B_IPO_ACTION_OB, ICON_ACTION, xco,0,XIC,YIC, &(ob->ipoflag), 0, 0, 0, 0, "Sets Ipo to be included in an Action or not");
- xco+= XIC;
- }
- else if(G.sipo->blocktype==ID_KE) {
- uiDefIconButBitS(block, TOG, OB_ACTION_KEY, B_IPO_ACTION_KEY, ICON_ACTION, xco,0,XIC,YIC, &(ob->ipoflag), 0, 0, 0, 0, "Sets Ipo to be included in an Action or not");
- xco+= XIC;
- }
- else if(G.sipo->blocktype==ID_CO) {
-
- if(ob->pose==NULL)
- uiDefIconButBitS(block, TOG, OB_ACTION_OB, B_IPO_ACTION_OB, ICON_ACTION, xco,0,XIC,YIC, &(ob->ipoflag), 0, 0, 0, 0, "Sets Ipo to be included in an Action or not");
- else {
- bConstraint *con= get_active_constraint(ob);
- if(con)
- uiDefIconButBitS(block, TOGN, CONSTRAINT_OWN_IPO, B_IPOREDRAW, ICON_ACTION, xco,0,XIC,YIC, &con->flag, 0, 0, 0, 0,
- (con->flag & CONSTRAINT_OWN_IPO)?"Ipo is connected to Constraint itself":"Ipo is connected to Pose Action"
- );
- }
- xco+= XIC;
- }
- else if(G.sipo->blocktype==ID_PO) { /* only to indicate we have action ipos */
- uiSetButLock(1, "Pose Action Ipo cannot be switched");
- uiDefIconButS(block, TOG, 1, ICON_ACTION, xco,0,XIC,YIC, &fake1, 0, 0, 0, 0, "Ipo is connected to Pose Action");
- xco+= XIC;
- }
- uiClearButLock();
- }
-
- /* ipo muting */
- if (G.sipo->ipo) {
- uiDefIconButS(block, ICONTOG, 1, ICON_MUTE_IPO_OFF, xco,0,XIC,YIC, &(G.sipo->ipo->muteipo), 0, 0, 0, 0, "Mute IPO-block");
- xco += XIC;
- }
-
- /* mainmenu, only when data is there and no pin */
- uiSetButLock(G.sipo->pin, "Can't change because of pinned data");
-
- if (G.sipo->blocktype == ID_OB)
- icon = ICON_OBJECT;
- else if (G.sipo->blocktype == ID_MA)
- icon = ICON_MATERIAL;
- else if (G.sipo->blocktype == ID_WO)
- icon = ICON_WORLD;
- else if (G.sipo->blocktype == ID_CU)
- icon = ICON_ANIM;
- else if (G.sipo->blocktype == ID_CA)
- icon = ICON_CAMERA;
- else if (G.sipo->blocktype == ID_LA)
- icon = ICON_LAMP;
- else if (G.sipo->blocktype == ID_KE)
- icon = ICON_EDIT;
- else if (G.sipo->blocktype == ID_PO)
- icon = ICON_POSE_HLT;
- else if (G.sipo->blocktype == ID_CO)
- icon = ICON_CONSTRAINT;
- else if (G.sipo->blocktype == ID_SEQ)
- icon = ICON_SEQUENCE;
- else if(G.sipo->blocktype == ID_TE)
- icon = ICON_TEXTURE;
- else if(G.sipo->blocktype == ID_FLUIDSIM)
- icon = ICON_WORLD;
- else if(G.sipo->blocktype == ID_PA)
- icon = ICON_PARTICLES;
-
- uiDefIconTextButS(block, MENU, B_IPOMAIN, icon, ipo_modeselect_pup(), xco,0,100,20, &(G.sipo->blocktype), 0, 0, 0, 0, "Show IPO type");
-
- xco += 85;
-
- if(G.sipo->blocktype==ID_MA) {
- uiDefButS(block, NUM, B_IPOMAIN, "", xco+=XIC,0,XIC-4,YIC, &G.sipo->channel, 0.0, MAX_MTEX-1.0, 0, 0, "Channel Number of the active Material texture.");
- xco-= 4;
- }
- if(G.sipo->blocktype==ID_WO) {
- uiDefButS(block, NUM, B_IPOMAIN, "", xco+=XIC,0,XIC-4,YIC, &G.sipo->channel, 0.0, MAX_MTEX-1.0, 0, 0, "Channel Number of the active World texture.");
- xco-= 4;
- }
-
- if(G.sipo->blocktype==ID_LA) {
- uiDefButS(block, NUM, B_IPOMAIN, "", xco+=XIC,0,XIC-4,YIC, &G.sipo->channel, 0.0, MAX_MTEX-1.0, 0, 0, "Channel Number of the active Lamp texture. ");
- xco-= 4;
- }
-
- uiBlockEndAlign(block);
-
- uiClearButLock();
-
- /* if(G.sipo->blocktype==ID_SEQ)
- allow_pin= 0; */
- xco= std_libbuttons(block, (short)(xco+1.5*XIC), 0, allow_pin, &G.sipo->pin, B_IPOBROWSE, ID_IP,
- G.sipo->blocktype, (ID*)G.sipo->ipo, G.sipo->from, &(G.sipo->menunr), B_IPOALONE, B_IPOLOCAL, B_IPODELETE, 0, B_KEEPDATA);
-
- /* COPY PASTE */
- xco-= XIC/2;
- uiBlockBeginAlign(block);
- if(curarea->headertype==HEADERTOP) {
- uiDefIconBut(block, BUT, B_IPOCOPY, ICON_COPYUP, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Copies the selected curves to the buffer");
- uiSetButLock(G.sipo->ipo && G.sipo->ipo->id.lib, ERROR_LIBDATA_MESSAGE);
- uiDefIconBut(block, BUT, B_IPOPASTE, ICON_PASTEUP, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Pastes the curves from the buffer");
- }
- else {
- uiDefIconBut(block, BUT, B_IPOCOPY, ICON_COPYDOWN, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Copies the selected curves to the buffer");
- uiSetButLock(G.sipo->ipo && G.sipo->ipo->id.lib, ERROR_LIBDATA_MESSAGE);
- uiDefIconBut(block, BUT, B_IPOPASTE, ICON_PASTEDOWN, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Pastes the curves from the buffer");
- }
- uiBlockEndAlign(block);
- xco+=XIC/2;
-
- uiClearButLock();
-
- /* ZOOMBORDER */
- uiDefIconBut(block, BUT, B_IPOBORDER, ICON_BORDERMOVE, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Zooms view to area");
-
- xco+=XIC/2;
-
- /* draw LOCK */
- uiDefIconButS(block, ICONTOG, 1, ICON_UNLOCKED, xco+=XIC,0,XIC,YIC, &(G.sipo->lock), 0, 0, 0, 0, "Toggles forced redraw of other windows to reflect changes in real time");
-
- /* always do as last */
- curarea->headbutlen= xco+2*XIC;
-
- uiDrawBlock(block);
-}
diff --git a/source/blender/src/header_nla.c b/source/blender/src/header_nla.c
deleted file mode 100644
index 3b614ebfb7c..00000000000
--- a/source/blender/src/header_nla.c
+++ /dev/null
@@ -1,566 +0,0 @@
-/**
- * header_nla.c oct-2003
- *
- * Functions to draw the "NLA Editor" window header
- * and handle user events sent to it.
- *
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "DNA_ID.h"
-#include "DNA_nla_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_interface.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_editnla.h"
-#include "BIF_editaction.h"
-#include "BIF_toolbox.h"
-
-#include "BSE_drawipo.h"
-#include "BSE_headerbuttons.h"
-#include "BSE_time.h"
-
-//#include "nla.h"
-
-#include "blendef.h"
-#include "mydevice.h"
-
-void do_nla_buttons(unsigned short event)
-{
- View2D *v2d;
-
- switch(event){
- case B_NLAHOME:
- // Find X extents
- v2d= &(G.snla->v2d);
-
- /* i tried to understand nla/action drawing to reveil a 'tot' rect, impossible code! (ton) */
- v2d->cur.xmin = G.scene->r.sfra-5;
- v2d->cur.xmax = G.scene->r.efra+5;
- v2d->cur.ymin= -SCROLLB;
- v2d->cur.ymax= 5; // at least stuff is visiable then?
-
- test_view2d(G.v2d, curarea->winx, curarea->winy);
- view2d_do_locks(curarea, V2D_LOCK_COPY);
- addqueue (curarea->win, REDRAW, 1);
- break;
- }
-}
-
-
-static void do_nla_viewmenu(void *arg, int event)
-{
- extern int play_anim(int mode);
-
- switch(event) {
- case 0: /* Update Automatically */
- if(BTST(G.snla->lock, 0)) G.snla->lock = BCLR(G.snla->lock, 0);
- else G.snla->lock = BSET(G.snla->lock, 0);
- break;
- case 1: /* Play Back Animation */
- play_anim(0);
- break;
- case 2: /* Play Back Animation in 3D View */
- play_anim(1);
- break;
- case 3: /* View All */
- do_nla_buttons(B_NLAHOME);
- break;
- case 4: /* Maximize Window */
- /* using event B_FULL */
- break;
- case 5: /* Update automatically */
- G.v2d->flag ^= V2D_VIEWLOCK;
- if(G.v2d->flag & V2D_VIEWLOCK)
- view2d_do_locks(curarea, 0);
- break;
- case 6: /* Show all objects that have keyframes? */
- G.snla->flag ^= SNLA_ALLKEYED;
- break;
- case 7: /* Show timing in Frames or Seconds */
- G.snla->flag ^= SNLA_DRAWTIME;
- break;
- }
-}
-
-static uiBlock *nla_viewmenu(void *arg_unused)
-{
-/* static short tog=0; */
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "nla_viewmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_nla_viewmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, (G.snla->flag & SNLA_ALLKEYED)?ICON_CHECKBOX_DEHLT:ICON_CHECKBOX_HLT,
- "Only Objects On Visible Layers|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
-
- if (G.snla->flag & SNLA_DRAWTIME) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Frames|Ctrl T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
- } else {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Seconds|Ctrl T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
- }
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- if(BTST(G.snla->lock, 0)) {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Update Automatically|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
- } else {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Update Automatically|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
- }
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Play Back Animation|Alt A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Play Back Animation in 3D View|Alt Shift A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "View All|Home", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, (G.v2d->flag & V2D_VIEWLOCK)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT,
- "Lock Time to Other Windows|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
-
- if(!curarea->full) uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Maximize Window|Ctrl UpArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
- else uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Tile Window|Ctrl DownArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-static void do_nla_selectmenu(void *arg, int event)
-{
-
- switch(event)
- {
- case 0: /* Border Select */
- borderselect_nla();
- break;
- case 1: /* Select/Deselect All Keys */
- deselect_nlachannel_keys(1);
- allqueue (REDRAWNLA, 0);
- allqueue (REDRAWIPO, 0);
- break;
- case 2: /* Select/Deselect All Channel */
- deselect_nlachannels(1);
- allqueue (REDRAWVIEW3D, 0);
- allqueue (REDRAWNLA, 0);
- allqueue (REDRAWIPO, 0);
- break;
- case 3: /* Select/Deselect All Markers */
- deselect_markers(1, 0);
- allqueue(REDRAWMARKER, 0);
- break;
- case 4: /* Borderselect markers */
- borderselect_markers();
- break;
- }
-}
-
-static uiBlock *nla_selectmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "nla_selectmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_nla_selectmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select Markers|Ctrl B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All Keys|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All Channels", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All Markers|Ctrl A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-static void do_nla_strip_snapmenu(void *arg, int event)
-{
- snap_action_strips(event);
-
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
-}
-
-static uiBlock *nla_strip_snapmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "nla_strip_snapmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_nla_strip_snapmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nearest Frame|Shift S, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Current Frame|Shift S, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_nla_strip_transformmenu(void *arg, int event)
-{
- switch(event) {
- case 0: /* grab/move */
- transform_nlachannel_keys('g', 0);
- update_for_newframe_muted();
- break;
- case 1: /* scale */
- transform_nlachannel_keys('s', 0);
- update_for_newframe_muted();
- break;
- case 2: /* extend */
- transform_nlachannel_keys('e', 0);
- update_for_newframe_muted();
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *nla_strip_transformmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "nla_strip_transformmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_nla_strip_transformmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Grab/Move|G", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Grab/Extend from Frame|E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Scale|S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
-
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_nla_stripmenu(void *arg, int event)
-{
- switch(event)
- {
- case 0: /* Strip Properties */
- add_blockhandler(curarea, NLA_HANDLER_PROPERTIES, UI_PNL_UNSTOW);
- break;
- case 1: /* Add Action Strip */
- add_nlablock();
- break;
- case 2: /* Duplicate */
- duplicate_nlachannel_keys();
- update_for_newframe_muted();
- break;
- case 3: /* Delete Strips */
- if (okee("Erase selected strips and/or keys")) {
- delete_nlachannel_keys ();
- update_for_newframe_muted();
- }
- break;
- case 5: /* Convert Action to NLA Strip */
- convert_nla();
- break;
- case 6: /* Move Up */
- shift_nlastrips_up();
- break;
- case 7: /* Move Down */
- shift_nlastrips_down();
- break;
- case 8: /* reset scale */
- reset_action_strips(1);
- break;
- case 9: /* reset start/end of action */
- reset_action_strips(2);
- break;
- case 10: /* add new action as new action strip */
- add_empty_nlablock();
- break;
- case 11: /* apply scale */
- reset_action_strips(3);
- break;
- }
-}
-
-static uiBlock *nla_stripmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "nla_stripmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_nla_stripmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Strip Properties...|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBlockBut(block, nla_strip_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 20, "");
- uiDefIconTextBlockBut(block, nla_strip_snapmenu, NULL, ICON_RIGHTARROW_THIN, "Snap", 0, yco-=20, 120, 20, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Reset Strip Scale|Alt S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Reset Action Start/End|Alt S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 9, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Apply Strip Scaling|Alt S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 11, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Action Strip|Shift A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Blank Action Strip|Shift N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 10, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Convert Action to NLA Strip|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate|Shift D", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete|X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Move Down|Ctrl Page Down", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Move Up|Ctrl Page Up", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
-
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-static void do_nla_markermenu(void *arg, int event)
-{
- switch(event)
- {
- case 1:
- add_marker(CFRA);
- break;
- case 2:
- duplicate_marker();
- break;
- case 3:
- remove_marker();
- break;
- case 4:
- rename_marker();
- break;
- case 5:
- transform_markers('g', 0);
- break;
- }
-
- allqueue(REDRAWMARKER, 0);
-}
-
-static uiBlock *nla_markermenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "nla_markermenu",
- UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_nla_markermenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Marker|M", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate Marker|Ctrl Shift D", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Marker|X", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "(Re)Name Marker|Ctrl M", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Grab/Move Marker|Ctrl G", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-void nla_buttons(void)
-{
- SpaceNla *snla;
- short xco, xmax;
- char naam[20];
- uiBlock *block;
-
- snla= curarea->spacedata.first;
-
- sprintf(naam, "header %d", curarea->headwin);
- block= uiNewBlock(&curarea->uiblocks, naam, UI_EMBOSS, UI_HELV, curarea->headwin);
-
- if(area_is_active_area(curarea)) uiBlockSetCol(block, TH_HEADER);
- else uiBlockSetCol(block, TH_HEADERDESEL);
-
- curarea->butspacetype= SPACE_NLA;
-
- xco = 8;
-
- uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D, windowtype_pup(), xco,0,XIC+10,YIC, &(curarea->butspacetype), 1.0, SPACEICONMAX, 0, 0, "Displays Current Window Type. Click for menu of available types.");
-
- xco+= XIC+14;
-
- uiBlockSetEmboss(block, UI_EMBOSSN);
- if(curarea->flag & HEADER_NO_PULLDOWN) {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, B_FLIPINFOMENU, ICON_DISCLOSURE_TRI_RIGHT,
- xco,2,XIC,YIC-2,
- &(curarea->flag), 0, 0, 0, 0, "Show pulldown menus");
- } else {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, B_FLIPINFOMENU, ICON_DISCLOSURE_TRI_DOWN,
- xco,2,XIC,YIC-2,
- &(curarea->flag), 0, 0, 0, 0, "Hide pulldown menus");
- }
- uiBlockSetEmboss(block, UI_EMBOSS);
- xco+=XIC;
-
- if((curarea->flag & HEADER_NO_PULLDOWN)==0) {
- /* pull down menus */
- uiBlockSetEmboss(block, UI_EMBOSSP);
-
- xmax= GetButStringLength("View");
- uiDefPulldownBut(block, nla_viewmenu, NULL, "View", xco, -2, xmax-3, 24, "");
- xco+= xmax;
-
- xmax= GetButStringLength("Select");
- uiDefPulldownBut(block, nla_selectmenu, NULL, "Select", xco, -2, xmax-3, 24, "");
- xco+= xmax;
-
- xmax= GetButStringLength("Marker");
- uiDefPulldownBut(block, nla_markermenu, NULL, "Marker", xco, -2, xmax-3, 24, "");
- xco+= xmax;
-
- xmax= GetButStringLength("Strip");
- uiDefPulldownBut(block, nla_stripmenu, NULL, "Strip", xco, -2, xmax-3, 24, "");
- xco+= xmax;
-
-
- }
-
- uiBlockSetEmboss(block, UI_EMBOSS);
-
-
- /* draw AUTOSNAP */
- xco += 8;
-
- if (G.snla->flag & SNLA_DRAWTIME) {
- uiDefButS(block, MENU, B_REDR,
- "Auto-Snap Strips/Keyframes %t|Off %x0|Second Step %x1|Nearest Second %x2|Nearest Marker %x3",
- xco,0,70,YIC, &(G.snla->autosnap), 0, 1, 0, 0,
- "Auto-snapping mode for strips and keyframes when transforming");
- }
- else {
- uiDefButS(block, MENU, B_REDR,
- "Auto-Snap Strips/Keyframes %t|Off %x0|Frame Step %x1|Nearest Frame %x2|Nearest Marker %x3",
- xco,0,70,YIC, &(G.snla->autosnap), 0, 1, 0, 0,
- "Auto-snapping mode for strips and keyframes when transforming");
- }
-
- xco += (70 + 8);
-
- /* FULL WINDOW */
-
-
-// xco = 8;
-
-// uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D, windowtype_pup(), xco,0,XIC+10,YIC, &(curarea->butspacetype), 1.0, SPACEICONMAX, 0, 0, "Displays Current Window Type. Click for menu of available types.");
-
-// xco+= XIC+22;
-
- /* FULL WINDOW */
-// if(curarea->full) uiDefIconBut(block, BUT,B_FULL, ICON_SPLITSCREEN, xco,0,XIC,YIC, 0, 0, 0, 0, 0, "Returns to multiple views window (CTRL+Up arrow)");
-// else uiDefIconBut(block, BUT,B_FULL, ICON_FULLSCREEN, xco,0,XIC,YIC, 0, 0, 0, 0, 0, "Makes current window full screen (CTRL+Down arrow)");
-
- /* HOME */
-// uiDefIconBut(block, BUT, B_NLAHOME, ICON_HOME, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Zooms window to home view showing all items (HOMEKEY)");
-// xco+= XIC;
-
- /* IMAGE */
-// uiDefIconButS(block, TOG, B_REDR, ICON_IMAGE_COL, xco+=XIC,0,XIC,YIC, &sseq->mainb, 0, 0, 0, 0, "Toggles image display");
-
- /* ZOOM en BORDER */
-// xco+= XIC;
-// uiDefIconButI(block, TOG, B_VIEW2DZOOM, ICON_VIEWZOOM, xco+=XIC,0,XIC,YIC, &viewmovetemp, 0, 0, 0, 0, "Zoom view (CTRL+MiddleMouse)");
-// uiDefIconBut(block, BUT, B_NLABORDER, ICON_BORDERMOVE, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Zoom view to area");
-
- /* draw LOCK */
-// xco+= XIC/2;
-
- xco += 8;
-
- uiDefIconButS(block, ICONTOG, 1, ICON_UNLOCKED, xco,0,XIC,YIC, &(snla->lock), 0, 0, 0, 0, "Toggles forced redraw of other windows to reflect changes in real time");
-
- uiDrawBlock(block);
-}
diff --git a/source/blender/src/header_node.c b/source/blender/src/header_node.c
deleted file mode 100644
index ebdd42690f5..00000000000
--- a/source/blender/src/header_node.c
+++ /dev/null
@@ -1,673 +0,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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2005 Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-#include "DNA_ID.h"
-#include "DNA_material_types.h"
-#include "DNA_node_types.h"
-#include "DNA_object_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_space_types.h"
-#include "DNA_view2d_types.h"
-#include "DNA_userdef_types.h"
-
-#include "BIF_gl.h"
-#include "BIF_interface.h"
-#include "BIF_previewrender.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-#include "BIF_butspace.h"
-
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_material.h"
-#include "BKE_node.h"
-
-#include "BSE_drawipo.h"
-#include "BSE_headerbuttons.h"
-#include "BSE_node.h"
-
-#include "blendef.h"
-#include "butspace.h"
-#include "mydevice.h"
-
-void do_node_buttons(ScrArea *sa, unsigned short event)
-{
- SpaceNode *snode= sa->spacedata.first;
- Material *ma;
-
- switch(event) {
- case B_NODE_USEMAT:
- ma= (Material *)snode->id;
- if(ma) {
- if(ma->use_nodes && ma->nodetree==NULL) {
- node_shader_default(ma);
- snode_set_context(snode);
- }
- BIF_preview_changed(ID_MA);
- allqueue(REDRAWNODE, 0);
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWIPO, 0);
- }
- break;
-
- case B_NODE_USESCENE:
- if(G.scene->use_nodes) {
- if(G.scene->nodetree==NULL)
- node_composit_default(G.scene);
- addqueue(curarea->win, UI_BUT_EVENT, B_NODE_TREE_EXEC);
- }
- snode_set_context(snode);
- allqueue(REDRAWNODE, 0);
- break;
- }
-}
-
-static void do_node_viewmenu(void *arg, int event)
-{
- SpaceNode *snode= curarea->spacedata.first;
-
- switch(event) {
- case 1: /* Zoom in */
- snode_zoom_in(curarea);
- break;
- case 2: /* View all */
- snode_zoom_out(curarea);
- break;
- case 3: /* View all */
- snode_home(curarea, snode);
- break;
- }
- allqueue(REDRAWNODE, 0);
-}
-
-static uiBlock *node_viewmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "node_viewmenu",
- UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_node_viewmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Zoom In|NumPad +", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Zoom Out|NumPad -", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "View All|Home", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-
- if (!curarea->full)
- uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Maximize Window|Ctrl UpArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
- else
- uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Tile Window|Ctrl DownArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-static void do_node_selectmenu(void *arg, int event)
-{
- SpaceNode *snode= curarea->spacedata.first;
-
- /* functions in editnode.c assume there's a tree */
- if(snode->nodetree==NULL)
- return;
-
- switch(event) {
- case 1: /* border select */
- node_border_select(snode);
- break;
- case 2: /* select/deselect all */
- node_deselectall(snode, 1);
- break;
- case 3: /* select linked in */
- node_select_linked(snode, 0);
- break;
- case 4: /* select linked out */
- node_select_linked(snode, 1);
- break;
- }
- allqueue(REDRAWNODE, 0);
-}
-
-static uiBlock *node_selectmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "node_selectmenu",
- UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_node_selectmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Linked From|L", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Linked To|Shift L", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-void do_node_addmenu(void *arg, int event)
-{
- SpaceNode *snode= curarea->spacedata.first;
- bNode *node;
- float locx, locy;
- short mval[2];
-
- /* store selection in temp test flag */
- for(node= snode->edittree->nodes.first; node; node= node->next) {
- if(node->flag & NODE_SELECT) node->flag |= NODE_TEST;
- else node->flag &= ~NODE_TEST;
- }
-
- getmouseco_areawin(mval);
- areamouseco_to_ipoco(G.v2d, mval, &locx, &locy);
- node= node_add_node(snode, event, locx, locy);
-
- /* uses test flag */
- snode_autoconnect(snode, node, NODE_TEST);
-
- addqueue(curarea->win, UI_BUT_EVENT, B_NODE_TREE_EXEC);
-
- BIF_undo_push("Add Node");
-
-}
-
-static void node_make_addmenu(SpaceNode *snode, int nodeclass, uiBlock *block)
-{
- bNodeTree *ntree;
- int tot= 0, a;
- short yco= 0, menuwidth=120;
-
- ntree = snode->nodetree;
- if(ntree) {
- /* mostly taken from toolbox.c, node_add_sublevel() */
- if(ntree) {
- if(nodeclass==NODE_CLASS_GROUP) {
- bNodeTree *ngroup= G.main->nodetree.first;
- for(; ngroup; ngroup= ngroup->id.next)
- if(ngroup->type==ntree->type)
- tot++;
- }
- else {
- bNodeType *type = ntree->alltypes.first;
- while(type) {
- if(type->nclass == nodeclass)
- tot++;
- type= type->next;
- }
- }
- }
-
- if(tot==0) {
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- return;
- }
-
- if(nodeclass==NODE_CLASS_GROUP) {
- bNodeTree *ngroup= G.main->nodetree.first;
- for(tot=0, a=0; ngroup; ngroup= ngroup->id.next, tot++) {
- if(ngroup->type==ntree->type) {
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, (ngroup->id.name+2), 0,
- yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, NODE_GROUP_MENU+tot, "");
- a++;
- }
- }
- }
- else {
- bNodeType *type;
- for(a=0, type= ntree->alltypes.first; type; type=type->next) {
- if( type->nclass == nodeclass ) {
- printf("node %s\n", type->name);
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, type->name, 0,
- yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, type->type, "");
- a++;
- }
- }
- }
- } else {
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- return;
- }
-}
-
-static uiBlock *node_add_inputmenu(void *arg_unused)
-{
- SpaceNode *snode= curarea->spacedata.first;
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "node_add_inputmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_node_addmenu, NULL);
-
- node_make_addmenu(snode, NODE_CLASS_INPUT, block);
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-static uiBlock *node_add_outputmenu(void *arg_unused)
-{
- SpaceNode *snode= curarea->spacedata.first;
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "node_add_outputmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_node_addmenu, NULL);
-
- node_make_addmenu(snode, NODE_CLASS_OUTPUT, block);
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-static uiBlock *node_add_colormenu(void *arg_unused)
-{
- SpaceNode *snode= curarea->spacedata.first;
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "node_add_colormenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_node_addmenu, NULL);
-
- node_make_addmenu(snode, NODE_CLASS_OP_COLOR, block);
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-static uiBlock *node_add_vectormenu(void *arg_unused)
-{
- SpaceNode *snode= curarea->spacedata.first;
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "node_add_vectormenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_node_addmenu, NULL);
-
- node_make_addmenu(snode, NODE_CLASS_OP_VECTOR, block);
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-static uiBlock *node_add_filtermenu(void *arg_unused)
-{
- SpaceNode *snode= curarea->spacedata.first;
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "node_add_filtermenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_node_addmenu, NULL);
-
- node_make_addmenu(snode, NODE_CLASS_OP_FILTER, block);
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-static uiBlock *node_add_convertermenu(void *arg_unused)
-{
- SpaceNode *snode= curarea->spacedata.first;
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "node_add_convertermenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_node_addmenu, NULL);
-
- node_make_addmenu(snode, NODE_CLASS_CONVERTOR, block);
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-static uiBlock *node_add_mattemenu(void *arg_unused)
-{
- SpaceNode *snode= curarea->spacedata.first;
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "node_add_mattemenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_node_addmenu, NULL);
-
- node_make_addmenu(snode, NODE_CLASS_MATTE, block);
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-static uiBlock *node_add_distortmenu(void *arg_unused)
-{
- SpaceNode *snode= curarea->spacedata.first;
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "node_add_distortmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_node_addmenu, NULL);
-
- node_make_addmenu(snode, NODE_CLASS_DISTORT, block);
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-static uiBlock *node_add_groupmenu(void *arg_unused)
-{
- SpaceNode *snode= curarea->spacedata.first;
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "node_add_groupmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_node_addmenu, NULL);
-
- node_make_addmenu(snode, NODE_CLASS_GROUP, block);
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-
-static uiBlock *node_addmenu(void *arg_unused)
-{
- SpaceNode *snode= curarea->spacedata.first;
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "node_addmenu",
- UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_node_addmenu, NULL);
-
- if(snode->treetype==NTREE_SHADER) {
- uiDefIconTextBlockBut(block, node_add_inputmenu, NULL, ICON_RIGHTARROW_THIN, "Input", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, node_add_outputmenu, NULL, ICON_RIGHTARROW_THIN, "Output", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, node_add_colormenu, NULL, ICON_RIGHTARROW_THIN, "Color", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, node_add_vectormenu, NULL, ICON_RIGHTARROW_THIN, "Vector", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, node_add_convertermenu, NULL, ICON_RIGHTARROW_THIN, "Convertor", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, node_add_groupmenu, NULL, ICON_RIGHTARROW_THIN, "Group", 0, yco-=20, 120, 19, "");
- }
- else if(snode->treetype==NTREE_COMPOSIT) {
- uiDefIconTextBlockBut(block, node_add_inputmenu, NULL, ICON_RIGHTARROW_THIN, "Input", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, node_add_outputmenu, NULL, ICON_RIGHTARROW_THIN, "Output", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, node_add_colormenu, NULL, ICON_RIGHTARROW_THIN, "Color", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, node_add_vectormenu, NULL, ICON_RIGHTARROW_THIN, "Vector", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, node_add_filtermenu, NULL, ICON_RIGHTARROW_THIN, "Filter", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, node_add_convertermenu, NULL, ICON_RIGHTARROW_THIN, "Convertor", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, node_add_mattemenu, NULL, ICON_RIGHTARROW_THIN, "Matte", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, node_add_distortmenu, NULL, ICON_RIGHTARROW_THIN, "Distort", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, node_add_groupmenu, NULL, ICON_RIGHTARROW_THIN, "Group", 0, yco-=20, 120, 19, "");
-
- } else
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-static void do_node_nodemenu(void *arg, int event)
-{
- SpaceNode *snode= curarea->spacedata.first;
- int fromlib=0;
-
- /* functions in editnode.c assume there's a tree */
- if(snode->nodetree==NULL)
- return;
- fromlib= (snode->id && snode->id->lib);
-
- switch(event) {
- case 1: /* grab/move */
- node_transform_ext(0,0);
- break;
- case 2: /* duplicate */
- if(fromlib) fromlib= -1;
- else node_adduplicate(snode);
- break;
- case 3: /* delete */
- if(fromlib) fromlib= -1;
- else node_delete(snode);
- break;
- case 4: /* make group */
- node_make_group(snode);
- break;
- case 5: /* ungroup */
- node_ungroup(snode);
- break;
- case 6: /* edit group */
- if(fromlib) fromlib= -1;
- else snode_make_group_editable(snode, NULL);
- break;
- case 7: /* hide/unhide */
- node_hide(snode);
- break;
- case 8: /* read saved render layers */
- node_read_renderlayers(snode);
- break;
- case 9: /* show cyclic */
- ntreeSolveOrder(snode->edittree);
- break;
- case 10: /* execute */
- addqueue(curarea->win, UI_BUT_EVENT, B_NODE_TREE_EXEC);
- break;
- }
-
- if(fromlib==-1) error_libdata();
- allqueue(REDRAWNODE, 0);
-}
-
-static uiBlock *node_nodemenu(void *arg_unused)
-{
- SpaceNode *snode= curarea->spacedata.first;
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "node_nodemenu",
- UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_node_nodemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Grab/Move|G", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate|Shift D", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete|X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Group|Ctrl G", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Ungroup|Alt G", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Edit Group|Tab", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide/Unhide|H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- if(snode->treetype==NTREE_COMPOSIT) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Execute Composite|E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Read Saved Render Results|R", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
- }
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Cyclic Dependencies|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-void node_buttons(ScrArea *sa)
-{
- SpaceNode *snode= sa->spacedata.first;
- uiBlock *block;
- short xco, xmax;
- char name[256];
-
- sprintf(name, "header %d", sa->headwin);
- block= uiNewBlock(&sa->uiblocks, name, UI_EMBOSS, UI_HELV, sa->headwin);
-
- if(area_is_active_area(sa)) uiBlockSetCol(block, TH_HEADER);
- else uiBlockSetCol(block, TH_HEADERDESEL);
-
- sa->butspacetype= SPACE_NODE;
-
- xco = 8;
-
- uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D,
- windowtype_pup(), xco, 0, XIC+10, YIC,
- &(sa->butspacetype), 1.0, SPACEICONMAX, 0, 0,
- "Displays Current Window Type");
-
- xco += XIC + 14;
-
- uiBlockSetEmboss(block, UI_EMBOSSN);
- if (sa->flag & HEADER_NO_PULLDOWN) {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, B_FLIPINFOMENU,
- ICON_DISCLOSURE_TRI_RIGHT, xco,2,XIC,YIC-2,
- &(sa->flag), 0, 0, 0, 0, "Show pulldown menus");
- }
- else {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, B_FLIPINFOMENU,
- ICON_DISCLOSURE_TRI_DOWN, xco,2,XIC,YIC-2,
- &(sa->flag), 0, 0, 0, 0, "Hide pulldown menus");
- }
- xco+=XIC;
-
- if((sa->flag & HEADER_NO_PULLDOWN)==0) {
- /* pull down menus */
- uiBlockSetEmboss(block, UI_EMBOSSP);
-
- xmax= GetButStringLength("View");
- uiDefPulldownBut(block, node_viewmenu, NULL,
- "View", xco, -2, xmax-3, 24, "");
- xco+= xmax;
-
- xmax= GetButStringLength("Select");
- uiDefPulldownBut(block, node_selectmenu, NULL,
- "Select", xco, -2, xmax-3, 24, "");
- xco+= xmax;
-
- xmax= GetButStringLength("Add");
- uiDefPulldownBut(block, node_addmenu, NULL,
- "Add", xco, -2, xmax-3, 24, "");
- xco+= xmax;
-
- xmax= GetButStringLength("Node");
- uiDefPulldownBut(block, node_nodemenu, NULL,
- "Node", xco, -2, xmax-3, 24, "");
- xco+= xmax;
- }
-
- uiBlockSetEmboss(block, UI_EMBOSS);
-
- /* main type choosing */
- uiBlockBeginAlign(block);
- uiDefIconButI(block, ROW, B_REDR, ICON_MATERIAL_DEHLT, xco,2,XIC,YIC-2,
- &(snode->treetype), 2, 0, 0, 0, "Material Nodes");
- xco+= XIC;
- uiDefIconButI(block, ROW, B_REDR, ICON_IMAGE_DEHLT, xco,2,XIC,YIC-2,
- &(snode->treetype), 2, 1, 0, 0, "Composite Nodes");
- xco+= 2*XIC;
- uiBlockEndAlign(block);
-
- /* find and set the context */
- snode_set_context(snode);
-
- if(snode->treetype==NTREE_SHADER) {
- if(snode->from) {
- /* 0, NULL -> pin */
- xco= std_libbuttons(block, xco, 0, 0, NULL, B_MATBROWSE, ID_MA, 1, snode->id, snode->from, &(snode->menunr),
- B_MATALONE, B_MATLOCAL, B_MATDELETE, B_AUTOMATNAME, B_KEEPDATA);
-
- if(snode->id) {
- Material *ma= (Material *)snode->id;
- uiDefButC(block, TOG, B_NODE_USEMAT, "Use Nodes", xco+5,0,70,19, &ma->use_nodes, 0.0f, 0.0f, 0, 0, "");
- xco+=80;
- }
- }
- }
- else if(snode->treetype==NTREE_COMPOSIT) {
- uiDefButS(block, TOG, B_NODE_USESCENE, "Use Nodes", xco+5,0,70,19, &G.scene->use_nodes, 0.0f, 0.0f, 0, 0, "Indicate this Scene will use Nodes and execute them while editing");
- xco+= 80;
- uiDefButBitS(block, TOG, R_COMP_FREE, B_NOP, "Free Unused", xco+5,0,80,19, &G.scene->r.scemode, 0.0f, 0.0f, 0, 0, "Free Nodes that are not used while composite");
- xco+= 80;
- uiDefButBitS(block, TOG, SNODE_BACKDRAW, REDRAWNODE, "Backdrop", xco+5,0,80,19, &snode->flag, 0.0f, 0.0f, 0, 0, "Use active Viewer Node output as backdrop");
- xco+= 80;
- }
-
- /* always as last */
- sa->headbutlen= xco+2*XIC;
-
- uiDrawBlock(block);
-}
diff --git a/source/blender/src/header_oops.c b/source/blender/src/header_oops.c
deleted file mode 100644
index 7bfbf0ee667..00000000000
--- a/source/blender/src/header_oops.c
+++ /dev/null
@@ -1,578 +0,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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: not all of this file anymore.
- *
- * Contributor(s): Blender Foundation.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "BMF_Api.h"
-#include "BIF_language.h"
-
-#include "DNA_ID.h"
-#include "DNA_oops_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-
-#include "BKE_global.h"
-#include "BKE_main.h"
-
-#include "BIF_gl.h"
-#include "BIF_interface.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_editoops.h"
-#include "BIF_oops.h"
-#include "BIF_outliner.h"
-#include "BIF_space.h"
-
-#include "BSE_drawipo.h"
-#include "BSE_drawoops.h"
-#include "BSE_headerbuttons.h"
-
-#include "blendef.h"
-
-#include "BKE_depsgraph.h"
-
-#include "BPY_extern.h"
-#include "BPY_menus.h"
-
-static int viewmovetemp = 0;
-
-void do_oops_buttons(short event)
-{
- float dx, dy;
-
- /* used for maximize hack */
- int win_width, win_height;
- float aspect_win, aspect_oops, oops_width, oops_height, oops_x_mid, oops_y_mid;
-
-
- if(curarea->win==0) return;
-
- if (event == B_NEWOOPS) {
- scrarea_queue_winredraw(curarea);
- scrarea_queue_headredraw(curarea);
- G.soops->lockpoin= 0;
- } else { /* must be either B_OOPSHOME or B_OOPSVIEWSEL */
- init_v2d_oops(curarea, curarea->spacedata.first); // forces min/max to be reset
- if (event == B_OOPSHOME) {
- boundbox_oops(0); /* Test all oops blocks */
- } else {
- boundbox_oops(1); /* Test only selected oops blocks */
- }
-
-
- /* Hack to work with test_view2d in drawipo.c
- Modify the bounding box so it is maximized to the window aspect
- so viewing all oops blocks isnt limited to hoz/vert only.
- Cant modify drawipo.c because many other functions use this hos/vert operation - Campbell*/
-
- win_width= curarea->winrct.xmax - curarea->winrct.xmin;
- win_height= curarea->winrct.ymax - curarea->winrct.ymin;
-
- oops_width = G.v2d->tot.xmax - G.v2d->tot.xmin;
- oops_height = G.v2d->tot.ymax - G.v2d->tot.ymin;
-
- oops_x_mid = (G.v2d->tot.xmax + G.v2d->tot.xmin)*0.5;
- oops_y_mid = (G.v2d->tot.ymax + G.v2d->tot.ymin)*0.5;
- /* wide windows will be above 1, skinny below 1 */
- aspect_win= (float)win_width / (float)win_height;
- aspect_oops = (float)oops_width / (float)oops_height;
- if (aspect_win>aspect_oops) {/* the window is wider then the oops bounds, increase the oops width */
- G.v2d->tot.xmin = oops_x_mid - ((oops_x_mid-G.v2d->tot.xmin) * (aspect_win/aspect_oops) ); /* scale the min */
- G.v2d->tot.xmax = oops_x_mid + ((G.v2d->tot.xmax-oops_x_mid) * (aspect_win/aspect_oops) );/* scale the max */
- } else { /* the window is skinnier then the oops bounds, increase the oops height */
- G.v2d->tot.ymin = oops_y_mid - ((oops_y_mid-G.v2d->tot.ymin) * (aspect_oops/aspect_win) ); /* scale the min */
- G.v2d->tot.ymax = oops_y_mid + ((G.v2d->tot.ymax-oops_y_mid) * (aspect_oops/aspect_win) );/* scale the max */
- }
-
- /* maybe we should restore the correct values? - do next of its needed */
- /* end hack */
-
-
-
- G.v2d->cur= G.v2d->tot;
- dx= 0.15*(G.v2d->cur.xmax-G.v2d->cur.xmin);
- dy= 0.15*(G.v2d->cur.ymax-G.v2d->cur.ymin);
- G.v2d->cur.xmin-= dx;
- G.v2d->cur.xmax+= dx;
- G.v2d->cur.ymin-= dy;
- G.v2d->cur.ymax+= dy;
- test_view2d(G.v2d, curarea->winx, curarea->winy);
- scrarea_queue_winredraw(curarea);
- }
-}
-
-static void do_oops_viewmenu(void *arg, int event)
-{
- SpaceOops *soops= curarea->spacedata.first;
-
- switch(event) {
- case 0: /* Shuffle Selected Blocks */
- shuffle_oops();
- break;
- case 1: /* Shrink Selected Blocks */
- shrink_oops();
- break;
- case 2: /* View All */
- do_oops_buttons(B_OOPSHOME);
- break;
- case 3: /* View All */
- do_oops_buttons(B_OOPSVIEWSEL);
- break;
- case 4: /* Maximize Window */
- /* using event B_FULL */
- break;
- case 5: /* show outliner */
- if(soops->type==SO_OOPS || soops->type==SO_DEPSGRAPH) soops->type= SO_OUTLINER;
- else soops->type= SO_OOPS;
- init_v2d_oops(curarea, soops);
- test_view2d(G.v2d, curarea->winx, curarea->winy);
- scrarea_queue_winredraw(curarea);
- break;
- case 6:
- outliner_toggle_visible(curarea);
- break;
- case 7:
- outliner_show_hierarchy(curarea);
- break;
- case 8:
- outliner_show_active(curarea);
- break;
- case 9:
- outliner_one_level(curarea, 1);
- break;
- case 10:
- outliner_one_level(curarea, -1);
- break;
-#ifdef SHOWDEPGRAPH
- case 11:
- // show deps
- {
- SpaceOops *soops= curarea->spacedata.first;
- if(soops->type==SO_OOPS) {
- soops->type= SO_DEPSGRAPH;
- soops->deps_flags = DAG_RL_ALL_BUT_DATA_MASK;
- } else
- soops->type= SO_OOPS;
- init_v2d_oops(curarea, soops);
- test_view2d(G.v2d, curarea->winx, curarea->winy);
- scrarea_queue_winredraw(curarea);
- }
- break;
-#endif
- case 12:
- if (soops->flag & SO_HIDE_RESTRICTCOLS) soops->flag &= ~SO_HIDE_RESTRICTCOLS;
- else soops->flag |= SO_HIDE_RESTRICTCOLS;
- break;
- }
-}
-
-static uiBlock *oops_viewmenu(void *arg_unused)
-{
- SpaceOops *soops= curarea->spacedata.first;
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "oops_viewmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_oops_viewmenu, NULL);
-
- if(soops->type==SO_OOPS) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Outliner", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
-#ifdef SHOWDEPGRAPH
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Dependancies", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, "");
-#endif
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Shuffle Selected Blocks|Shift S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Shrink Selected Blocks|Alt S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "View All|Home", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "View Selected|NumPad .", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- }
-#ifdef SHOWDEPGRAPH
- else if(soops->type==SO_DEPSGRAPH) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Outliner", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Oops Schematic", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, "");
- }
-#endif
- else {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Oops Schematic", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- if (soops->flag & SO_HIDE_RESTRICTCOLS)
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Show Restriction Columns", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
- else
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Show Restriction Columns", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Expand One Level|NumPad +", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Collapse One Level|NumPad -", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show/Hide All", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hierarchy|Home", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Active|NumPad .", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
- }
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- if(!curarea->full) uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Maximize Window|Ctrl UpArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
- else uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Tile Window|Ctrl DownArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-
-static void do_oops_selectmenu(void *arg, int event)
-{
-
- switch(event)
- {
- case 0: /* Border Select */
- borderselect_oops();
- break;
- case 1: /* Select/Deselect All */
- swap_select_all_oops();
- break;
- case 2: /* Linked to Selected */
- select_linked_oops();
- break;
- case 3: /* Users of Selected */
- select_backlinked_oops();
- break;
- }
-}
-
-static uiBlock *oops_selectmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "oops_selectmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_oops_selectmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Linked to Selected|L", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Users of Selected|Shift L", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-static void do_oops_blockmenu(void *arg, int event)
-{
- switch(event)
- {
- case 0: /* grab/move */
- transform_oops('g', 0);
- break;
- case 1: /* scale */
- transform_oops('s', 0);
- break;
- }
-}
-
-static uiBlock *oops_blockmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "oops_blockmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_oops_blockmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Grab/Move|G", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Scale|S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-static void do_oops_searchmenu(void *arg, int event)
-{
- int search_flags = OL_FIND, again = 0;
-
- switch(event)
- {
- case 0: /* plain new find */
- search_flags = OL_FIND;
- break;
- case 1: /* case sensitive */
- search_flags = OL_FIND_CASE;
- break;
- case 2: /* full search */
- search_flags = OL_FIND_COMPLETE;
- break;
- case 3: /* full case sensitive */
- search_flags = OL_FIND_COMPLETE_CASE;
- break;
- case 4: /* again */
- again = 1;
- break;
- default: /* nothing valid */
- return;
- }
-
- /* run search */
- outliner_find_panel(curarea, again, search_flags);
-}
-
-static uiBlock *oops_searchmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "oops_searchmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_oops_searchmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Find|F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Find (Case Sensitive)|Ctrl F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Find Complete|Alt F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Find Complete (Case Sensitive)|Ctrl Alt F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Find Again|Shift F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-void oops_buttons(void)
-{
- SpaceOops *soops;
- Oops *oops;
- uiBlock *block;
- short xco, xmax;
- char naam[256];
-
- soops= curarea->spacedata.first;
-
- sprintf(naam, "header %d", curarea->headwin);
- block= uiNewBlock(&curarea->uiblocks, naam, UI_EMBOSS, UI_HELV, curarea->headwin);
-
- if(area_is_active_area(curarea)) uiBlockSetCol(block, TH_HEADER);
- else uiBlockSetCol(block, TH_HEADERDESEL);
-
- curarea->butspacetype= SPACE_OOPS;
-
- xco = 8;
-
- uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D, windowtype_pup(), xco,0,XIC+10,YIC, &(curarea->butspacetype), 1.0, SPACEICONMAX, 0, 0, "Displays Current Window Type. Click for menu of available types.");
-
- xco+= XIC+14;
-
- uiBlockSetEmboss(block, UI_EMBOSSN);
- if(curarea->flag & HEADER_NO_PULLDOWN) {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, B_FLIPINFOMENU, ICON_DISCLOSURE_TRI_RIGHT,
- xco,2,XIC,YIC-2,
- &(curarea->flag), 0, 0, 0, 0, "Show pulldown menus");
- } else {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, B_FLIPINFOMENU, ICON_DISCLOSURE_TRI_DOWN,
- xco,2,XIC,YIC-2,
- &(curarea->flag), 0, 0, 0, 0, "Hide pulldown menus");
- }
- uiBlockSetEmboss(block, UI_EMBOSS);
- xco+=XIC;
-
- if((curarea->flag & HEADER_NO_PULLDOWN)==0) {
- /* pull down menus */
- uiBlockSetEmboss(block, UI_EMBOSSP);
-
- xmax= GetButStringLength("View");
- uiDefPulldownBut(block, oops_viewmenu, NULL, "View", xco, -2, xmax-3, 24, "");
- xco+= xmax;
-
- if(soops->type==SO_OOPS) {
- xmax= GetButStringLength("Select");
- uiDefPulldownBut(block, oops_selectmenu, NULL, "Select", xco, -2, xmax-3, 24, "");
- xco+= xmax;
-
- xmax= GetButStringLength("Block");
- uiDefPulldownBut(block, oops_blockmenu, NULL, "Block", xco, -2, xmax-3, 24, "");
- xco+= xmax;
-
- }
- else {
- xmax= GetButStringLength("Search");
- uiDefPulldownBut(block, oops_searchmenu, NULL, "Search", xco, -2, xmax-3, 24, "");
- xco+= xmax;
- }
- }
-
- uiBlockSetEmboss(block, UI_EMBOSS);
-
- if(soops->type==SO_OOPS) {
- /* ZOOM and BORDER */
- uiBlockBeginAlign(block);
- uiDefIconButI(block, TOG, B_VIEW2DZOOM, ICON_VIEWZOOM, (short)(xco),0,XIC,YIC, &viewmovetemp, 0, 0, 0, 0, "Zooms view (Ctrl MiddleMouse)");
- uiDefIconBut(block, BUT, B_IPOBORDER, ICON_BORDERMOVE, (short)(xco+=XIC),0,XIC,YIC, 0, 0, 0, 0, 0, "Zooms view to area");
- uiBlockEndAlign(block);
-
- xco+= 8;
-
- /* VISIBLE */
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, OOPS_LAY, B_NEWOOPS, "Layer", (short)(xco+=XIC),0,XIC+20,YIC, &soops->visiflag, 0, 0, 0, 0, "Only show object datablocks on visible layers");
- xco+= 20;
- uiDefIconButBitS(block, TOG, OOPS_SCE, B_NEWOOPS, ICON_SCENE_HLT, (short)(xco+=XIC),0,XIC,YIC, &soops->visiflag, 0, 0, 0, 0, "Displays Scene datablocks");
- uiDefIconButBitS(block, TOG, OOPS_OB, B_NEWOOPS, ICON_OBJECT_HLT, (short)(xco+=XIC),0,XIC,YIC, &soops->visiflag, 0, 0, 0, 0, "Displays Object datablocks");
- uiDefIconButBitS(block, TOG, OOPS_ME, B_NEWOOPS, ICON_MESH_HLT, (short)(xco+=XIC),0,XIC,YIC, &soops->visiflag, 0, 0, 0, 0, "Displays Mesh datablocks");
- uiDefIconButBitS(block, TOG, OOPS_CU, B_NEWOOPS, ICON_CURVE_HLT, (short)(xco+=XIC),0,XIC,YIC, &soops->visiflag, 0, 0, 0, 0, "Displays Curve/Surface/Font datablocks");
- uiDefIconButBitS(block, TOG, OOPS_MB, B_NEWOOPS, ICON_MBALL_HLT, (short)(xco+=XIC),0,XIC,YIC, &soops->visiflag, 0, 0, 0, 0, "Displays Metaball datablocks");
- uiDefIconButBitS(block, TOG, OOPS_LT, B_NEWOOPS, ICON_LATTICE_HLT, (short)(xco+=XIC),0,XIC,YIC, &soops->visiflag, 0, 0, 0, 0, "Displays Lattice datablocks");
- uiDefIconButBitS(block, TOG, OOPS_LA, B_NEWOOPS, ICON_LAMP_HLT, (short)(xco+=XIC),0,XIC,YIC, &soops->visiflag, 0, 0, 0, 0, "Displays Lamp datablocks");
- uiDefIconButBitS(block, TOG, OOPS_MA, B_NEWOOPS, ICON_MATERIAL_HLT, (short)(xco+=XIC),0,XIC,YIC, &soops->visiflag, 0, 0, 0, 0, "Displays Material datablocks");
- uiDefIconButBitS(block, TOG, OOPS_TE, B_NEWOOPS, ICON_TEXTURE_HLT, (short)(xco+=XIC),0,XIC,YIC, &soops->visiflag, 0, 0, 0, 0, "Displays Texture datablocks");
- uiDefIconButBitS(block, TOG, OOPS_IP, B_NEWOOPS, ICON_IPO_HLT, (short)(xco+=XIC),0,XIC,YIC, &soops->visiflag, 0, 0, 0, 0, "Displays Ipo datablocks");
- uiDefIconButBitS(block, TOG, OOPS_IM, B_NEWOOPS, ICON_IMAGE_HLT, (short)(xco+=XIC),0,XIC,YIC, &soops->visiflag, 0, 0, 0, 0, "Displays Image datablocks");
- uiDefIconButBitS(block, TOG, OOPS_GR, B_NEWOOPS, ICON_CIRCLE_DEHLT, (short)(xco+=XIC),0,XIC,YIC, &soops->visiflag, 0, 0, 0, 0, "Displays Group datablocks");
- uiDefIconButBitS(block, TOG, OOPS_LI, B_NEWOOPS, ICON_LIBRARY_HLT, (short)(xco+=XIC),0,XIC,YIC, &soops->visiflag, 0, 0, 0, 0, "Displays Library datablocks");
-
-
- uiBlockEndAlign(block);
-
- /* name */
- if(G.soops->lockpoin) {
- oops= G.soops->lockpoin;
- if(oops->type==ID_LI) strcpy(naam, ((Library *)oops->id)->name);
- else strcpy(naam, oops->id->name);
-
- cpack(0x0);
- BIF_ThemeColor(TH_MENU_TEXT); /* makes text readable on dark theme */
- BIF_SetScale(1.0);
- glRasterPos2i(xco+=XIC+10, 5);
- BIF_RasterPos(xco+=XIC+10, 5);
- BIF_DrawString(G.font, naam, 0);
-
- }
- }
-#ifdef SHOWDEPGRAPH
- else if(soops->type==SO_DEPSGRAPH) {
- // cpack colors : 0x00FF00 0xFF0000 0xFFFF00 0x000000 0x0000FF 0x00FFFF
- static unsigned char colr[21] ={0x00, 0xFF, 0x00,
- 0x00, 0x00, 0xFF,
- 0x00, 0xFF, 0xFF,
- 0x00, 0x00, 0x00,
- 0xFF, 0x00, 0x00,
- 0xFF, 0xFF, 0x00,
- 0xFF, 0x00, 0x00};
-
- uiDefButC( block, COL, 0, "", (short)(xco+=10),0, 5,YIC, colr, 0, 1, 0, 0, "");
- uiDefButS( block, TOG|BIT|2, B_REDR, "parent", (short)(xco+=7),0, 50,YIC, &soops->deps_flags, 0, 1, 0, 0, "parent");
- uiDefButC( block, COL, 0, "", (short)(xco+=60),0, 5,YIC, colr+3, 0, 1, 0, 0, "");
- uiDefButS( block, TOG|BIT|1, B_REDR, "data", (short)(xco+=7),0, 50,YIC, &soops->deps_flags, 0, 1, 0, 0, "data");
- uiDefButC( block, COL, 0, "", (short)(xco+=60),0, 5,YIC, colr+6, 0, 1, 0, 0, "");
- uiDefButS( block, TOG|BIT|3, B_REDR, "track", (short)(xco+=7),0, 50,YIC, &soops->deps_flags, 0, 1, 0, 0, "track");
- uiDefButC( block, COL, 0, "", (short)(xco+=60),0, 5,YIC, colr+9, 0, 1, 0, 0, "");
- uiDefButS( block, TOG|BIT|4, B_REDR, "path", (short)(xco+=7),0, 50,YIC, &soops->deps_flags, 0, 1, 0, 0, "path");
- uiDefButC( block, COL, 0, "", (short)(xco+=60),0, 5,YIC, colr+12, 0, 1, 0, 0, "");
- uiDefButS( block, TOG|BIT|5, B_REDR, "cons.", (short)(xco+=7),0, 50,YIC, &soops->deps_flags, 0, 1, 0, 0, "constraint");
- uiDefButC( block, COL, 0, "", (short)(xco+=60),0, 5,YIC, colr+15, 0, 1, 0, 0, "");
- uiDefButS( block, TOG|BIT|6, B_REDR, "hook.", (short)(xco+=7),0, 50,YIC, &soops->deps_flags, 0, 1, 0, 0, "hook");
- uiDefButC( block, COL, 0, "", (short)(xco+=60),0, 5,YIC, colr+18, 0, 1, 0, 0, "");
- uiDefButS( block, TOG|BIT|7, B_REDR, "d cons.", (short)(xco+=7),0, 50,YIC, &soops->deps_flags, 0, 1, 0, 0, "d cons");
- }
-#endif
- else {
- if(G.main->library.first)
-#ifdef WITH_VERSE
- uiDefButS(block, MENU, B_REDR, "Outliner Display%t|Verse Servers %x9|Verse Sessions %x8|Libraries %x7|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, "");
-#else
- uiDefButS(block, MENU, B_REDR, "Outliner Display%t|Libraries %x7|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, "");
-#endif /* WITH_VERSE */
- else
-#ifdef WITH_VERSE
- uiDefButS(block, MENU, B_REDR, "Outliner Display%t|Verse Servers %x9|Verse Sessions %x8|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, "");
-#else
- uiDefButS(block, MENU, B_REDR, "Outliner Display%t|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, "");
-#endif /* WITH_VERSE */
- }
-
- /* always do as last */
- curarea->headbutlen= xco+2*XIC;
-
- uiDrawBlock(block);
-}
-
diff --git a/source/blender/src/header_script.c b/source/blender/src/header_script.c
deleted file mode 100644
index 98f18c4e2ac..00000000000
--- a/source/blender/src/header_script.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/**
- * header_script.c nov-2003
- *
- * Functions to draw the "Script Window" window header
- * and handle user events sent to it.
- *
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * Contributor(s): Willian P. Germano.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "BLI_blenlib.h"
-
-#include "BSE_headerbuttons.h"
-
-#include "DNA_ID.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-
-#include "BIF_interface.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-#include "BKE_global.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
-#include "BKE_sca.h"
-#include "BSE_filesel.h"
-
-#include "BPI_script.h"
-#include "BPY_extern.h"
-#include "BPY_menus.h"
-
-#include "blendef.h"
-#include "mydevice.h"
-
-/* ********************** SCRIPT ****************************** */
-
-/* action executed after clicking in Scripts menu */
-static void do_scripts_submenus(void *int_arg, int event)
-{
- int menutype = (long)int_arg;
-
- BPY_menu_do_python (menutype, event);
-
- //allqueue(REDRAWSCRIPT, 0);
-}
-
-static uiBlock *script_scripts_submenus(void *int_menutype)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
- BPyMenu *pym;
- int i = 0, menutype = (long)int_menutype;
-
- if ((menutype < 0) || (menutype > PYMENU_SCRIPTS_MENU_TOTAL))
- return NULL;
-
- block= uiNewBlock(&curarea->uiblocks, "scriptsscriptssubmenus", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_scripts_submenus, int_menutype);
-
- for (pym = BPyMenuTable[menutype]; pym; pym = pym->next, i++) {
- uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i, pym->tooltip?pym->tooltip:pym->filename);
- }
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-
-static void do_script_scriptsmenu(void *arg, int event)
-{
- ScrArea *sa;
-
- if(curarea->spacetype==SPACE_INFO) {
- sa= closest_bigger_area();
- areawinset(sa->win);
- }
-
- /* these are no defines, easier this way, the codes are in the function below */
- switch(event) {
- case 0: /* update menus */
- BPyMenu_RemoveAllEntries();
- if (BPyMenu_Init(1) == -1) error("Invalid scripts dir: check console");
- break;
- }
-
-// allqueue(REDRAWSCRIPT, 0);
-}
-
-/* Scripts menu */
-static uiBlock *script_scriptsmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 0, menuwidth = 120;
- int i;
-
- block= uiNewBlock(&curarea->uiblocks, "script_scriptsmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_script_scriptsmenu, NULL);
-
- for (i = 0; i < PYMENU_SCRIPTS_MENU_TOTAL; i++) {
- uiDefIconTextBlockBut(block, script_scripts_submenus, (void *)(long)i, ICON_RIGHTARROW_THIN, BPyMenu_group_itoa(i), 0, yco-=20, menuwidth, 19, "");
- }
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Update Menus", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "Use when a scripts folder or its contents are modified");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- return block;
-}
-
-void do_script_buttons(unsigned short event)
-{
- SpaceScript *sc= curarea->spacedata.first;
- ID *id, *idtest;
- int nr= 1;
- Script *script = sc->script;
-
- if (!sc) return;
- if (sc->spacetype != SPACE_SCRIPT) return;
-
- switch (event) {
- case B_SCRIPTBROWSE:
- if (sc->menunr==-2) {
- activate_databrowse((ID *)script, ID_SCR, 0, B_SCRIPTBROWSE,
- &sc->menunr, do_script_buttons);
- break;
- }
-
- if(sc->menunr < 0) break;
-
- nr = 1;
- id = (ID *)script;
-
- idtest= G.main->script.first;
- while(idtest) {
- if(nr==sc->menunr) {
- break;
- }
- nr++;
- idtest= idtest->next;
- }
- if(idtest!=id) {
- sc->script= (Script *)idtest;
-
- allqueue(REDRAWSCRIPT, 0);
- allqueue(REDRAWHEADERS, 0);
- }
- break;
- case B_SCRIPT2PREV:
- if(sc->next) {
- BLI_remlink(&curarea->spacedata, sc);
- BLI_addtail(&curarea->spacedata, sc);
- sc = curarea->spacedata.first;
- newspace(curarea, sc->spacetype);
- }
- break;
- }
-
- return;
-}
-
-void script_buttons(void)
-{
- uiBlock *block;
- SpaceScript *sc= curarea->spacedata.first;
- short xco = 8, xmax;
- char naam[256];
-
- if (!sc || sc->spacetype != SPACE_SCRIPT) return;
-
- sprintf(naam, "header %d", curarea->headwin);
- block= uiNewBlock(&curarea->uiblocks, naam, UI_EMBOSS, UI_HELV, curarea->headwin);
-
- if(area_is_active_area(curarea)) uiBlockSetCol(block, TH_HEADER);
- else uiBlockSetCol(block, TH_HEADERDESEL);
-
- curarea->butspacetype= SPACE_SCRIPT;
-
- uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D,
- windowtype_pup(), xco,0,XIC+10,YIC, &(curarea->butspacetype), 1.0,
- SPACEICONMAX, 0, 0, "Displays Current Window Type. Click for menu"
- " of available types.");
- xco += XIC+14;
-
- uiBlockSetEmboss(block, UI_EMBOSSN);
- if(curarea->flag & HEADER_NO_PULLDOWN) {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, B_FLIPINFOMENU, ICON_DISCLOSURE_TRI_RIGHT,
- xco,2,XIC,YIC-2,
- &(curarea->flag), 0, 0, 0, 0, "Enables display of pulldown menus");
- } else {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, B_FLIPINFOMENU, ICON_DISCLOSURE_TRI_DOWN,
- xco,2,XIC,YIC-2,
- &(curarea->flag), 0, 0, 0, 0, "Hides pulldown menus");
- }
- uiBlockSetEmboss(block, UI_EMBOSS);
- xco+=XIC;
-
- /* pull down menus */
- if((curarea->flag & HEADER_NO_PULLDOWN)==0) {
- uiBlockSetEmboss(block, UI_EMBOSSP);
-
- xmax= GetButStringLength("Scripts");
- uiDefPulldownBut(block,script_scriptsmenu, NULL, "Scripts", xco, 0, xmax, 20, "");
- xco+=xmax;
- }
-
- uiBlockSetEmboss(block, UI_EMBOSS);
-
- uiBlockBeginAlign(block);
- uiDefIconBut(block, BUT, B_SCRIPT2PREV, ICON_GO_LEFT, xco+=XIC, 0, XIC, YIC,
- 0, 0, 0, 0, 0, "Returns to previous window");
-
- /* FULL WINDOW */
- if(curarea->full)
- uiDefIconBut(block, BUT,B_FULL, ICON_SPLITSCREEN, xco+=XIC,0,XIC,YIC, 0, 0,
- 0, 0, 0, "Returns to multiple views window (CTRL+Up arrow)");
- else
- uiDefIconBut(block, BUT,B_FULL, ICON_FULLSCREEN, xco+=XIC,0,XIC,YIC, 0, 0,
- 0, 0, 0, "Makes current window full screen (CTRL+Down arrow)");
- uiBlockEndAlign(block);
-
- /* STD SCRIPT BUTTONS */
- xco += 2*XIC;
- xco= std_libbuttons(block, xco, 0, 0, NULL, B_SCRIPTBROWSE, ID_SCRIPT, 0, (ID*)sc->script, 0, &(sc->menunr), 0, 0, 0, 0, 0);
-
- /* always as last */
- curarea->headbutlen= xco+2*XIC;
-
- uiDrawBlock(block);
-}
-
-
-/* ********************** SCRIPT ****************************** */
-
diff --git a/source/blender/src/header_seq.c b/source/blender/src/header_seq.c
deleted file mode 100644
index e26ab4a157a..00000000000
--- a/source/blender/src/header_seq.c
+++ /dev/null
@@ -1,729 +0,0 @@
-/**
- * header_seq.c oct-2003
- *
- * Functions to draw the "Video Sequence Editor" window header
- * and handle user events sent to it.
- *
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "BMF_Api.h"
-#include "BIF_language.h"
-
-#include "DNA_ID.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_sequence_types.h"
-#include "DNA_space_types.h"
-#include "BLI_blenlib.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BIF_drawseq.h"
-#include "BIF_interface.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_editseq.h"
-#include "BSE_drawipo.h"
-#include "BSE_headerbuttons.h"
-#include "BSE_sequence.h"
-#include "BSE_time.h"
-#include "blendef.h"
-#include "mydevice.h"
-
-static int viewmovetemp = 0;
-
-static void do_seq_viewmenu(void *arg, int event)
-{
- extern int play_anim(int mode);
- Sequence * last_seq = get_last_seq();
- SpaceSeq * sseq = curarea->spacedata.first;
-
- switch(event)
- {
- case 1: /* Play Back Animation */
- play_anim(0);
- break;
- case 2: /* Play Back Animation in All */
- play_anim(1);
- break;
- case 3:
- do_seq_buttons(B_SEQHOME);
- break;
- case 4:
- if(last_seq) {
- CFRA= last_seq->startdisp;
- G.v2d->cur.xmin= last_seq->startdisp- (last_seq->len/20);
- G.v2d->cur.xmax= last_seq->enddisp+ (last_seq->len/20);
- update_for_newframe();
- }
- break;
- case 5: /* Lock time */
- G.v2d->flag ^= V2D_VIEWLOCK;
- if (G.v2d->flag & V2D_VIEWLOCK) {
- view2d_do_locks(curarea, 0);
- }
- break;
- case 6: /* Draw time/frames */
- sseq->flag ^= SEQ_DRAWFRAMES;
- break;
- }
-}
-
-static uiBlock *seq_viewmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
- SpaceSeq * sseq = curarea->spacedata.first;
-
- block= uiNewBlock(&curarea->uiblocks, "seq_viewmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_seq_viewmenu, NULL);
-
- if (sseq->mainb == 0) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Play Back Animation "
- "in all Sequence Areas|Alt A", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- } else {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Play Back Animation "
- "in this window|Alt A", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- }
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Play Back Animation in all "
- "3D Views and Sequence Areas|Alt Shift A",
- 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "View All|Home", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "View Selected|NumPad .", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
-
- /* Lock Time */
- uiDefIconTextBut(block, BUTM, 1, (G.v2d->flag & V2D_VIEWLOCK)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT,
- "Lock Time to Other Windows|", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
-
- /* Draw time or frames.*/
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- if(sseq->flag & SEQ_DRAWFRAMES)
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Seconds|T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
- else
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Frames|T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
-
-
- if(!curarea->full) uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Maximize Window|Ctrl UpArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0,0, "");
- else uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Tile Window|Ctrl DownArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-static void do_seq_selectmenu(void *arg, int event)
-{
- switch(event)
- {
- case 0:
- borderselect_seq();
- break;
- case 1:
- swap_select_seq();
- break;
- case 2:
- select_dir_from_last(1);
- break;
- case 3:
- select_dir_from_last(2);
- break;
- case 4:
- select_surround_from_last();
- break;
- case 5:
- select_neighbor_from_last(1);
- break;
- case 6:
- select_neighbor_from_last(2);
- break;
- case 7:
- select_linked_seq(2);
- break;
- }
-}
-
-static uiBlock *seq_selectmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "seq_selectmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_seq_selectmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Strips to the Left", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Strips to the Right", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Surrounding Handles", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Left Handles", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Right Handles", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Linked|Ctrl L", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-static void do_seq_addmenu_effectmenu(void *arg, int event)
-{
- switch(event)
- {
- case 0:
- add_sequence(SEQ_ADD);
- break;
- case 1:
- add_sequence(SEQ_SUB);
- break;
- case 2:
- add_sequence(SEQ_MUL);
- break;
- case 3:
- add_sequence(SEQ_CROSS);
- break;
- case 4:
- add_sequence(SEQ_GAMCROSS);
- break;
- case 5:
- add_sequence(SEQ_ALPHAOVER);
- break;
- case 6:
- add_sequence(SEQ_ALPHAUNDER);
- break;
- case 7:
- add_sequence(SEQ_OVERDROP);
- break;
- case 8:
- add_sequence(SEQ_PLUGIN);
- break;
- case 9:
- add_sequence(SEQ_WIPE);
- break;
- case 10:
- add_sequence(SEQ_GLOW);
- break;
- case 11:
- add_sequence(SEQ_TRANSFORM);
- break;
- case 12:
- add_sequence(SEQ_COLOR);
- break;
- case 13:
- add_sequence(SEQ_SPEED);
- break;
- }
-}
-
-static uiBlock *seq_addmenu_effectmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "seq_addmenu_effectmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_seq_addmenu_effectmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Subtract", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Multiply", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Cross", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Gamma Cross", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Alpha Over", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Alpha Under", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Alpha Over Drop", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Wipe", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 9, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Glow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 10, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Transform", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 11, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Color Generator", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 12, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Speed Control", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 13, "");
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Plugin...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, "");
-
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-
-
-static void do_seq_addmenu(void *arg, int event)
-{
- switch(event)
- {
- case 0:
- add_sequence(SEQ_IMAGE);
- break;
- case 1:
- add_sequence(SEQ_MOVIE);
- break;
- case 2:
- add_sequence(SEQ_RAM_SOUND);
- break;
- case 3:
- add_sequence(SEQ_HD_SOUND);
- break;
- case 4:
- add_sequence(SEQ_SCENE);
- break;
- case 5:
- add_sequence(SEQ_MOVIE_AND_HD_SOUND);
- break;
- }
-}
-
-static uiBlock *seq_addmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "seq_addmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_seq_addmenu, NULL);
-
- uiDefIconTextBlockBut(block, seq_addmenu_effectmenu, NULL, ICON_RIGHTARROW_THIN, "Effect", 0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
-#ifdef WITH_FFMPEG
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Audio (RAM)", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Audio (HD)", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
-#else
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Audio (Wav)", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
-#endif
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Scene", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Images", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Movie", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
-#ifdef WITH_FFMPEG
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Movie + Audio (HD)", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, "");
-#endif
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-static void do_seq_editmenu(void *arg, int event)
-{
- SpaceSeq *sseq;
-
- sseq= curarea->spacedata.first;
-
- switch(event)
- {
- case 1: /* Change Strip... */
- change_sequence();
- break;
- case 2: /* Make Meta Strip */
- make_meta();
- break;
- case 3: /* Separate Meta Strip */
- un_meta();
- break;
- case 4: /* Properties... */
- add_blockhandler(curarea, SEQ_HANDLER_PROPERTIES, UI_PNL_UNSTOW);
- break;
- case 5: /* Duplicate */
- add_duplicate_seq();
- break;
- case 6: /* Delete */
- del_seq();
- break;
- case 7: /* Grab/Extend */
- transform_seq('e', 0);
- break;
- case 8:
- set_filter_seq();
- break;
- case 9:
- enter_meta();
- break;
- case 10:
- exit_meta();
- break;
- case 11: /* grab/move */
- transform_seq('g', 0);
- break;
- case 12: /* Snap to Current Frame */
- seq_snap(event);
- break;
- case 13: /* Cut at Current Frame */
- seq_cut(CFRA);
- break;
- case 14:
- reassign_inputs_seq_effect();
- break;
- case 15:
- seq_remap_paths();
- break;
- case 16:
- seq_separate_images();
- break;
- case 17:
- reload_sequence();
- break;
- }
-}
-
-static uiBlock *seq_editmenu(void *arg_unused)
-{
- uiBlock *block;
- Editing *ed;
- short yco= 0, menuwidth=120;
- Sequence * last_seq = get_last_seq();
-
- ed = G.scene->ed;
-
- block= uiNewBlock(&curarea->uiblocks, "seq_editmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_seq_editmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Strip Properties...|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Grab/Move|G", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 11, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Grab/Extend from frame|E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Snap to Current Frame|Shift S, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Cut at Current Frame|K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Separate Images to Strips|Y", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate|Shift D", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete|X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
-
- if (last_seq != NULL && last_seq->type != SEQ_MOVIE) {
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- if(last_seq->type >= SEQ_EFFECT) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Change Effect...|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Reassign Inputs|R", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 14, "");
- }
- else if(last_seq->type == SEQ_IMAGE) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Change Image...|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Change Scene...|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
-
- if(last_seq->type==SEQ_IMAGE)
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Remap Paths...|Shift R", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 15, "");
-
- }
-
- if (last_seq != NULL && last_seq->type == SEQ_MOVIE) {
-/* uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Filter Y|F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, ""); */
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Remap Paths...|Shift R", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 15, "");
- }
-
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Meta Strip...|M", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Separate Meta Strip...|Alt M", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
- if ((ed != NULL) && (ed->metastack.first > 0)){
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Enter/Exit Meta Strip|Tab", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 10, "");
- }
- else {
- if (last_seq != NULL && last_seq->type == SEQ_META) {
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Enter/Exit Meta Strip|Tab", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 9, "");
- }
- }
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Reload Strip Data...|Alt R", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 17, "");
-
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-static void do_seq_markermenu(void *arg, int event)
-{
- SpaceSeq *sseq= curarea->spacedata.first;
-
- switch(event)
- {
- case 1:
- add_marker(CFRA);
- break;
- case 2:
- duplicate_marker();
- break;
- case 3:
- remove_marker();
- break;
- case 4:
- rename_marker();
- break;
- case 5:
- transform_markers('g', 0);
- break;
- case 6:
- sseq->flag ^= SEQ_MARKER_TRANS;
- break;
-
- }
-
- allqueue(REDRAWMARKER, 0);
-}
-
-static uiBlock *seq_markermenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- SpaceSeq *sseq= curarea->spacedata.first;
-
- block= uiNewBlock(&curarea->uiblocks, "ipo_markermenu",
- UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_seq_markermenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Marker|Ctrl Alt M", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate Marker|Ctrl Shift D", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Marker", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "(Re)Name Marker|Ctrl M", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Grab/Move Marker|Ctrl G", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, (sseq->flag & SEQ_MARKER_TRANS)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT,
- "Transform Markers", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- } else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-void do_seq_buttons(short event)
-{
- Editing *ed;
- SpaceSeq *sseq= curarea->spacedata.first;
-
- ed= G.scene->ed;
- if(ed==0) return;
-
- switch(event) {
- case B_SEQHOME:
- if(sseq->mainb)
- seq_reset_imageofs(sseq);
- else {
- G.v2d->cur= G.v2d->tot;
- test_view2d(G.v2d, curarea->winx, curarea->winy);
- view2d_do_locks(curarea, V2D_LOCK_COPY);
- }
- scrarea_queue_winredraw(curarea);
- break;
- case B_SEQCLEAR:
- free_imbuf_seq();
- allqueue(REDRAWSEQ, 1);
- break;
- }
-}
-
-void seq_buttons()
-{
- SpaceSeq *sseq;
- short xco;
- char naam[20];
- uiBlock *block;
- short xmax;
-
- sseq= curarea->spacedata.first;
-
- sprintf(naam, "header %d", curarea->headwin);
- block= uiNewBlock(&curarea->uiblocks, naam, UI_EMBOSS, UI_HELV, curarea->headwin);
-
- if(area_is_active_area(curarea)) uiBlockSetCol(block, TH_HEADER);
- else uiBlockSetCol(block, TH_HEADERDESEL);
-
- curarea->butspacetype= SPACE_SEQ;
-
- xco = 8;
- uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D, windowtype_pup(), xco,0,XIC+10,YIC, &(curarea->butspacetype), 1.0, SPACEICONMAX, 0, 0, "Displays Current Window Type. Click for menu of available types.");
- xco+= XIC+14;
-
- uiBlockSetEmboss(block, UI_EMBOSSN);
- if(curarea->flag & HEADER_NO_PULLDOWN) {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, B_FLIPINFOMENU, ICON_DISCLOSURE_TRI_RIGHT,
- xco,2,XIC,YIC-2,
- &(curarea->flag), 0, 0, 0, 0, "Enables display of pulldown menus");
- } else {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, B_FLIPINFOMENU, ICON_DISCLOSURE_TRI_DOWN,
- xco,2,XIC,YIC-2,
- &(curarea->flag), 0, 0, 0, 0, "Hides pulldown menus");
- }
- uiBlockSetEmboss(block, UI_EMBOSS);
- xco+=XIC;
-
-
- /* pull down menus */
- if((curarea->flag & HEADER_NO_PULLDOWN)==0) {
- uiBlockSetEmboss(block, UI_EMBOSSP);
-
- xmax= GetButStringLength("View");
- uiDefPulldownBut(block,seq_viewmenu, NULL, "View", xco, -2, xmax-3, 24, "");
- xco+=xmax;
-
- xmax= GetButStringLength("Select");
- uiDefPulldownBut(block,seq_selectmenu, NULL, "Select", xco, -2, xmax-3, 24, "");
- xco+=xmax;
-
- xmax= GetButStringLength("Marker");
- uiDefPulldownBut(block,seq_markermenu, NULL, "Marker", xco, -2, xmax-3, 24, "");
- xco+=xmax;
-
- xmax= GetButStringLength("Add");
- uiDefPulldownBut(block, seq_addmenu, NULL, "Add", xco, -2, xmax-3, 24, "");
- xco+= xmax;
-
- xmax= GetButStringLength("Strip");
- uiDefPulldownBut(block, seq_editmenu, NULL, "Strip", xco, -2, xmax-3, 24, "");
- xco+= xmax;
-
- /* end of pull down menus */
- uiBlockSetEmboss(block, UI_EMBOSS);
- }
-
- /* IMAGE */
- uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_SEQ_SEQUENCER,
- "Image Preview: %t"
- "|Sequence %x0"
- "|Image Preview %x1"
- "|Luma Waveform %x2"
- "|Chroma Vectorscope %x3",
- xco,0,XIC+10,YIC, &sseq->mainb, 0.0, 3.0,
- 0, 0,
- "Shows the sequence output image preview");
-
- xco+= 8 + XIC+10;
-
- /* CHANNEL shown in 3D preview */
- if(sseq->mainb) {
- int minchan = 0;
-
- if (G.scene->ed && ((Editing*)G.scene->ed)->metastack.first)
- minchan = -BLI_countlist(&((Editing*)G.scene->ed)->metastack);
-
- uiDefButS(block, NUM, B_REDR, "Chan:",
- xco, 0, 3.5 * XIC,YIC,
- &sseq->chanshown, minchan, MAXSEQ, 0, 0,
- "The channel number shown in the image preview. 0 is the result of all strips combined.");
-
- xco+= 8 + XIC*3.5;
- }
-
-
- /* ZOOM and BORDER */
- xco+= 8;
- uiBlockBeginAlign(block);
- uiDefIconButI(block, TOG, B_VIEW2DZOOM, ICON_VIEWZOOM, xco,0,XIC,YIC, &viewmovetemp, 0, 0, 0, 0, "Zooms view in and out (Ctrl MiddleMouse)");
- uiDefIconBut(block, BUT, B_IPOBORDER, ICON_BORDERMOVE, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Zooms view to fit area");
- uiBlockEndAlign(block);
-
- /* CLEAR MEM */
- xco+= 8;
-
- /* CLEAR MEM */
- xco+= 8;
- uiDefBut(block, BUT, B_SEQCLEAR, "Refresh", xco+=XIC,0,3*XIC,YIC, 0, 0, 0, 0, 0, "Clears all buffered images in memory");
-
- uiDrawBlock(block);
-}
diff --git a/source/blender/src/header_sound.c b/source/blender/src/header_sound.c
deleted file mode 100644
index c2fb72d7d17..00000000000
--- a/source/blender/src/header_sound.c
+++ /dev/null
@@ -1,444 +0,0 @@
-/**
- * header_sound.c oct-2003
- *
- * Functions to draw the "Audio Timeline" window header
- * and handle user events sent to it.
- *
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "BMF_Api.h"
-#include "BIF_language.h"
-
-#include "DNA_ID.h"
-#include "DNA_screen_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_sound_types.h"
-#include "DNA_space_types.h"
-#include "DNA_view2d_types.h"
-#include "DNA_userdef_types.h"
-
-#include "BIF_editsound.h"
-#include "BIF_gl.h"
-#include "BIF_interface.h"
-#include "BIF_previewrender.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-#include "BIF_butspace.h"
-
-#include "BKE_global.h"
-#include "BKE_main.h"
-
-#include "BSE_drawipo.h"
-#include "BSE_filesel.h"
-#include "BSE_headerbuttons.h"
-#include "BSE_time.h"
-
-#include "blendef.h"
-#include "mydevice.h"
-
-void do_sound_buttons(unsigned short event)
-{
- ID *id, *idtest;
- int nr;
- char name[256];
-
- switch(event) {
-
- case B_SOUNDBROWSE:
- if(G.ssound->sndnr== -2) {
- activate_databrowse((ID *)G.ssound->sound, ID_SO, 0,
- B_SOUNDBROWSE, &G.ssound->sndnr, do_sound_buttons);
- return;
- }
- if (G.ssound->sndnr < 0) break;
- if (G.ssound->sndnr == 32766) {
- if (G.ssound && G.ssound->sound) strcpy(name, G.ssound->sound->name);
- else strcpy(name, U.sounddir);
- activate_fileselect(FILE_SPECIAL, "SELECT WAV FILE", name,
- load_space_sound);
- } else {
- nr= 1;
- id= (ID *)G.ssound->sound;
-
- idtest= G.main->sound.first;
- while(idtest) {
- if(nr==G.ssound->sndnr) {
- break;
- }
- nr++;
- idtest= idtest->next;
- }
-
- if(idtest==0) { /* no new */
- return;
- }
-
- if(idtest!=id) {
- G.ssound->sound= (bSound *)idtest;
- if(idtest->us==0) idtest->us= 1;
- allqueue(REDRAWSOUND, 0);
- }
- }
-
- break;
- case B_SOUNDBROWSE2:
- id = (ID *)G.buts->lockpoin;
- if(G.buts->texnr == -2) {
- activate_databrowse(id, ID_SO, 0, B_SOUNDBROWSE2,
- &G.buts->texnr, do_sound_buttons);
- return;
- }
- if (G.buts->texnr < 0) break;
- if (G.buts->texnr == 32766) {
- if (id) strcpy(name, ((bSound *)id)->name);
- else strcpy(name, U.sounddir);
- activate_fileselect(FILE_SPECIAL, "SELECT WAV FILE", name, load_sound_buttons);
- }
- else {
- nr= 1;
-
- idtest= G.main->sound.first;
- while (idtest) {
- if(nr == G.buts->texnr) {
- break;
- }
- nr++;
- idtest = idtest->next;
- }
-
- if (idtest == 0) { /* geen new */
- return;
- }
-
- if (idtest != id) {
- G.buts->lockpoin = (bSound *)idtest;
- if(idtest->us==0) idtest->us= 1;
- allqueue(REDRAWBUTSSCENE, 0);
- }
- }
- break;
-
- case B_SOUNDHOME:
- if(G.ssound->sound==NULL) {
- G.v2d->tot.xmin= G.scene->r.sfra;
- G.v2d->tot.xmax= G.scene->r.efra;
- }
- G.v2d->cur= G.v2d->tot;
- test_view2d(G.v2d, curarea->winx, curarea->winy);
- view2d_do_locks(curarea, V2D_LOCK_COPY);
- scrarea_queue_winredraw(curarea);
- break;
- }
-}
-
-static void do_sound_viewmenu(void *arg, int event)
-{
- extern int play_anim(int mode);
-
- switch(event) {
- case 1: /* Play Back Animation */
- play_anim(0);
- break;
- case 2: /* Play Back Animation in All */
- play_anim(1);
- break;
- case 3: /* View All */
- do_sound_buttons(B_SOUNDHOME);
- break;
- case 4: /* Maximize Window */
- /* using event B_FULL */
- break;
- case 5: /* jump to next marker */
- nextprev_marker(1);
- break;
- case 6: /* jump to previous marker */
- nextprev_marker(-1);
- break;
- case 7:
- G.v2d->flag ^= V2D_VIEWLOCK;
- if(G.v2d->flag & V2D_VIEWLOCK)
- view2d_do_locks(curarea, 0);
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *sound_viewmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "sound_viewmenu",
- UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_sound_viewmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Jump To Next Marker|PageUp", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Jump To Prev Marker|PageDown", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Play Back Animation|Alt A", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Play Back Animation in 3D View|Alt Shift A", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "View All|Home", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-
- uiDefIconTextBut(block, BUTM, 1, (G.v2d->flag & V2D_VIEWLOCK)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT,
- "Lock Time to Other Windows|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
-
- if (!curarea->full)
- uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Maximize Window|Ctrl UpArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
- else
- uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Tile Window|Ctrl DownArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-static void do_sound_markermenu(void *arg, int event)
-{
- switch(event)
- {
- case 1:
- add_marker(CFRA);
- break;
- case 2:
- duplicate_marker();
- break;
- case 3:
- remove_marker();
- break;
- case 4:
- rename_marker();
- break;
- case 5:
- transform_markers('g', 0);
- break;
- }
-
- allqueue(REDRAWMARKER, 0);
-}
-
-static uiBlock *sound_markermenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "sound_markermenu",
- UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_sound_markermenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Marker|M", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate Marker|Shift D", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Marker|X", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "(Re)Name Marker|Ctrl M", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Grab/Move Marker|G", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
-
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-
-void sound_buttons(void)
-{
- uiBlock *block;
- short xco, xmax;
- char naam[256];
- char ch[20];
-
- sprintf(naam, "header %d", curarea->headwin);
- block= uiNewBlock(&curarea->uiblocks, naam, UI_EMBOSS, UI_HELV, curarea->headwin);
-
- if(area_is_active_area(curarea)) uiBlockSetCol(block, TH_HEADER);
- else uiBlockSetCol(block, TH_HEADERDESEL);
-
- curarea->butspacetype= SPACE_SOUND;
-
- xco = 8;
-
- uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D,
- windowtype_pup(), xco, 0, XIC+10, YIC,
- &(curarea->butspacetype), 1.0, SPACEICONMAX, 0, 0,
- "Displays Current Window Type. "
- "Click for menu of available types.");
-
- xco += XIC + 14;
-
- uiBlockSetEmboss(block, UI_EMBOSSN);
- if (curarea->flag & HEADER_NO_PULLDOWN) {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, B_FLIPINFOMENU,
- ICON_DISCLOSURE_TRI_RIGHT,
- xco,2,XIC,YIC-2,
- &(curarea->flag), 0, 0, 0, 0,
- "Show pulldown menus");
- }
- else {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, B_FLIPINFOMENU,
- ICON_DISCLOSURE_TRI_DOWN,
- xco,2,XIC,YIC-2,
- &(curarea->flag), 0, 0, 0, 0,
- "Hide pulldown menus");
- }
- uiBlockSetEmboss(block, UI_EMBOSS);
- xco+=XIC;
-
- if((curarea->flag & HEADER_NO_PULLDOWN)==0) {
- /* pull down menus */
- uiBlockSetEmboss(block, UI_EMBOSSP);
-
- xmax= GetButStringLength("View");
- uiDefPulldownBut(block, sound_viewmenu, NULL,
- "View", xco, -2, xmax-3, 24, "");
- xco+= xmax;
-
- xmax= GetButStringLength("Marker");
- uiDefPulldownBut(block, sound_markermenu, NULL,
- "Marker", xco, -2, xmax-3, 24, "");
- xco+= xmax;
- }
-
- uiBlockSetEmboss(block, UI_EMBOSS);
- xco= std_libbuttons(block, xco+8, 0, 0, NULL, B_SOUNDBROWSE, ID_SO, 0, (ID *)G.ssound->sound, 0, &(G.ssound->sndnr), 1, 0, 0, 0, 0);
-
- if(G.ssound->sound) {
- bSound *sound= G.ssound->sound;
-
- if (sound->sample && sound->sample->len)
- {
- if (sound->sample->channels == 1)
- strcpy(ch, "Mono");
- else if (sound->sample->channels == 2)
- strcpy(ch, "Stereo");
- else
- strcpy(ch, "Unknown");
-
- sprintf(naam, "Sample: %s, %d bit, %d Hz, %d samples", ch, sound->sample->bits, sound->sample->rate, sound->sample->len);
- cpack(0x0);
- glRasterPos2i(xco+10, 5);
- BMF_DrawString(uiBlockGetCurFont(block), naam);
- }
- else
- {
- sprintf(naam, "No sample info available.");
- cpack(0x0);
- glRasterPos2i(xco+10, 5);
- BMF_DrawString(uiBlockGetCurFont(block), naam);
- }
-
- }
-
- /* always as last */
- curarea->headbutlen= xco+2*XIC;
-
- uiDrawBlock(block);
-}
-
-/* the next two functions are also called from fileselect: */
-
-void load_space_sound(char *str)
-{
- bSound *sound;
-
- sound= sound_new_sound(str);
- if (sound) {
- if (G.ssound) {
- G.ssound->sound= sound;
- }
- } else {
- error("Not a valid sample: %s", str);
- }
-
- allqueue(REDRAWSOUND, 0);
- allqueue(REDRAWBUTSLOGIC, 0);
-}
-
-void load_sound_buttons(char *str)
-{
- bSound *sound;
-
- sound= sound_new_sound(str);
- if (sound) {
- if (curarea && curarea->spacetype==SPACE_BUTS) {
- if (G.buts->mainb == CONTEXT_SCENE) {
- if( G.buts->tab[CONTEXT_SCENE]==TAB_SCENE_SOUND )
- G.buts->lockpoin = sound;
- }
- }
- }
- else {
- error("Not a valid sample: %s", str);
- }
-
- allqueue(REDRAWBUTSSCENE, 0);
-}
diff --git a/source/blender/src/header_text.c b/source/blender/src/header_text.c
deleted file mode 100644
index 728edc76a9c..00000000000
--- a/source/blender/src/header_text.c
+++ /dev/null
@@ -1,847 +0,0 @@
-/**
- * header_text.c oct-2003
- *
- * Functions to draw the "Text Editor" window header
- * and handle user events sent to it.
- *
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "BMF_Api.h"
-#include "BIF_language.h"
-
-#include "BSE_headerbuttons.h"
-
-#include "DNA_ID.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_text_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_action_types.h"
-
-#include "BIF_drawtext.h"
-#include "BIF_interface.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-
-#include "BKE_global.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
-#include "BKE_sca.h"
-#include "BKE_text.h"
-#include "BKE_depsgraph.h"
-
-#include "BSE_filesel.h"
-
-#include "BPY_extern.h"
-#include "BPY_menus.h"
-
-#include "blendef.h"
-#include "mydevice.h"
-
-void do_text_buttons(unsigned short event)
-{
- SpaceText *st= curarea->spacedata.first; /* bad but cant pass as an arg here */
- ID *id, *idtest;
- int nr= 1;
- Text *text;
-
- if (st==NULL || st->spacetype != SPACE_TEXT) return;
-
- switch (event) {
- case B_TEXTBROWSE:
- if (st->menunr==-2) {
- activate_databrowse((ID *)st->text, ID_TXT, 0, B_TEXTBROWSE,
- &st->menunr, do_text_buttons);
- break;
- }
- if(st->menunr < 0) break;
-
- text= st->text;
-
- nr= 1;
- id= (ID *)text;
-
- if (st->menunr==32767) {
- st->text= (Text *)add_empty_text( "Text" );
-
- st->top= 0;
-
- allqueue(REDRAWTEXT, 0);
- allqueue(REDRAWHEADERS, 0);
- }
- else if (st->menunr==32766) {
- activate_fileselect(FILE_SPECIAL, "Open Text File", G.sce, add_text_fs);
- return;
- }
- else {
- idtest= G.main->text.first;
- while(idtest) {
- if(nr==st->menunr) {
- break;
- }
- nr++;
- idtest= idtest->next;
- }
- if(idtest==0) { /* new text */
- activate_fileselect(FILE_SPECIAL, "Open Text File",
- G.sce, add_text_fs);
- return;
- }
- if(idtest!=id) {
- st->text= (Text *)idtest;
- st->top= 0;
-
- pop_space_text(st);
- if (st->showsyntax) get_format_string(st);
- allqueue(REDRAWTEXT, 0);
- allqueue(REDRAWHEADERS, 0);
- }
- }
- break;
-
- case B_TEXTDELETE:
- {
- Object *obt;
- bConstraint *con;
- int update;
-
- text= st->text;
- if (!text) return;
-
- /* make the previous text active, if its not there make the next text active */
- if (st->text->id.prev) {
- st->text = st->text->id.prev;
- pop_space_text(st);
- } else if (st->text->id.next) {
- st->text = st->text->id.next;
- pop_space_text(st);
- }
-
- /*check all pyconstraints*/
- for (obt=G.main->object.first; obt; obt=obt->id.next) {
- update = 0;
- if(obt->type==OB_ARMATURE && obt->pose) {
- bPoseChannel *pchan;
- for(pchan= obt->pose->chanbase.first; pchan; pchan= pchan->next) {
- for (con = pchan->constraints.first; con; con=con->next) {
- if (con->type==CONSTRAINT_TYPE_PYTHON) {
- bPythonConstraint *data = con->data;
- if (data->text==text) data->text = NULL;
- update = 1;
-
- }
- }
- }
- }
- for (con = obt->constraints.first; con; con=con->next) {
- if (con->type==CONSTRAINT_TYPE_PYTHON) {
- bPythonConstraint *data = con->data;
- if (data->text==text) data->text = NULL;
- update = 1;
- }
- }
-
- if (update) {
- DAG_object_flush_update(G.scene, obt, OB_RECALC_DATA);
- }
- }
-
- BPY_clear_bad_scriptlinks(text);
- free_text_controllers(text);
-
- unlink_text(text);
- free_libblock(&G.main->text, text);
-
- allqueue(REDRAWTEXT, 0);
- allqueue(REDRAWHEADERS, 0);
-
- /*for if any object constraints were changed.*/
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWBUTSEDIT, 0);
-
- BIF_undo_push("Delete Text");
- }
- break;
-
-/*
- case B_TEXTSTORE:
- st->text->flags ^= TXT_ISEXT;
-
- allqueue(REDRAWHEADERS, 0);
- break;
-*/
- case B_TEXTLINENUM:
- allqueue(REDRAWTEXT, 0);
- allqueue(REDRAWHEADERS, 0);
- break;
-
- case B_TEXTFONT:
- switch(st->font_id) {
- case 0:
- st->lheight= 12; break;
- case 1:
- st->lheight= 15;
- break;
- }
-
- allqueue(REDRAWTEXT, 0);
- allqueue(REDRAWHEADERS, 0);
-
- break;
- case B_TAB_NUMBERS:
- if (st->showsyntax) get_format_string(st);
- allqueue(REDRAWTEXT, 0);
- allqueue(REDRAWHEADERS, 0);
- break;
- case B_SYNTAX:
- if (st->showsyntax) {
- get_format_string(st);
- }
- allqueue(REDRAWTEXT, 0);
- allqueue(REDRAWHEADERS, 0);
- break;
- }
-}
-
-static void do_text_template_scriptsmenu(void *arg, int event)
-{
- BPY_menu_do_python(PYMENU_SCRIPTTEMPLATE, event);
-
- allqueue(REDRAWIMAGE, 0);
-}
-
-static uiBlock *text_template_scriptsmenu (void *args_unused)
-{
- uiBlock *block;
- BPyMenu *pym;
- int i= 0;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "text_template_scriptsmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_text_template_scriptsmenu, NULL);
-
- /* note that we acount for the N previous entries with i+20: */
- for (pym = BPyMenuTable[PYMENU_SCRIPTTEMPLATE]; pym; pym = pym->next, i++) {
-
- uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20, menuwidth, 19,
- NULL, 0.0, 0.0, 1, i,
- pym->tooltip?pym->tooltip:pym->filename);
- }
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-
-/* action executed after clicking in File menu */
-static void do_text_filemenu(void *arg, int event)
-{
- SpaceText *st= curarea->spacedata.first; /* bad but cant pass as an arg here */
- Text *text;
- ScrArea *sa;
-
- if (st==NULL || st->spacetype != SPACE_TEXT) return;
-
- text= st->text;
-
- switch(event) {
- case 1:
- st->text= add_empty_text( "Text" );
- st->top=0;
-
- allqueue(REDRAWTEXT, 0);
- allqueue(REDRAWHEADERS, 0);
- break;
- case 2:
- activate_fileselect(FILE_SPECIAL, "Open Text File", G.sce, add_text_fs);
- break;
- case 3:
- if (text->compiled) BPY_free_compiled_text(text);
- text->compiled = NULL;
- if (okee("Reopen Text")) {
- if (!reopen_text(text)) {
- error("Could not reopen file");
- }
- if (st->showsyntax) get_format_string(st);
- }
- break;
- case 5:
- text->flags |= TXT_ISMEM;
- case 4:
- txt_write_file(text);
- break;
- case 6:
- run_python_script(st);
- break;
- case 7:
- {
- Object *ob;
- bConstraint *con;
- short update;
-
- /* check all pyconstraints */
- for (ob= G.main->object.first; ob; ob= ob->id.next) {
- update = 0;
- if (ob->type==OB_ARMATURE && ob->pose) {
- bPoseChannel *pchan;
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- for (con = pchan->constraints.first; con; con= con->next) {
- if (con->type==CONSTRAINT_TYPE_PYTHON) {
- bPythonConstraint *data = con->data;
- if (data->text==text) BPY_pyconstraint_update(ob, con);
- update = 1;
-
- }
- }
- }
- }
- for (con = ob->constraints.first; con; con= con->next) {
- if (con->type==CONSTRAINT_TYPE_PYTHON) {
- bPythonConstraint *data = con->data;
- if (data->text==text) BPY_pyconstraint_update(ob, con);
- update = 1;
- }
- }
-
- if (update) {
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- }
- }
- }
- break;
- default:
- break;
- }
- for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- SpaceText *st= sa->spacedata.first;
- if (st && st->spacetype==SPACE_TEXT) {
- scrarea_queue_redraw(sa);
- }
- }
-}
-
-/* action executed after clicking in Edit menu */
-static void do_text_editmenu(void *arg, int event)
-{
- SpaceText *st= curarea->spacedata.first; /* bad but cant pass as an arg here */
- Text *text;
- ScrArea *sa;
-
- if (st==NULL || st->spacetype != SPACE_TEXT) return;
-
- text= st->text;
-
- switch(event) {
- case 1:
- txt_do_undo(text);
- break;
- case 2:
- txt_do_redo(text);
- break;
- case 3:
- txt_cut_sel(text);
- pop_space_text(st);
- break;
- case 4:
- txt_copy_sel(text);
- break;
- case 5:
- txt_paste(text);
- if (st->showsyntax) get_format_string(st);
- break;
- case 6:
- txt_print_cutbuffer();
- break;
- case 7:
- jumptoline_interactive(st);
- break;
- case 8:
- txt_find_panel(st,1);
- break;
- case 9:
- txt_find_panel(st,0);
- break;
- default:
- break;
- }
-
- for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- SpaceText *st= sa->spacedata.first;
- if (st && st->spacetype==SPACE_TEXT) {
- scrarea_queue_redraw(sa);
- }
- }
-}
-
-/* action executed after clicking in View menu */
-static void do_text_editmenu_viewmenu(void *arg, int event)
-{
- SpaceText *st= curarea->spacedata.first; /* bad but cant pass as an arg here */
- Text *text;
- ScrArea *sa;
-
- if (st==NULL || st->spacetype != SPACE_TEXT) return;
-
- text = st->text;
-
- switch(event) {
- case 1:
- txt_move_bof(text, 0);
- pop_space_text(st);
- break;
- case 2:
- txt_move_eof(text, 0);
- pop_space_text(st);
- break;
- default:
- break;
- }
-
- for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- SpaceText *st= sa->spacedata.first;
- if (st && st->spacetype==SPACE_TEXT) {
- scrarea_queue_redraw(sa);
- }
- }
-}
-
-/* action executed after clicking in Select menu */
-static void do_text_editmenu_selectmenu(void *arg, int event)
-{
- SpaceText *st= curarea->spacedata.first; /* bad but cant pass as an arg here */
- Text *text;
- ScrArea *sa;
-
- if (st==NULL || st->spacetype != SPACE_TEXT) return;
-
- text = st->text;
-
- switch(event) {
- case 1:
- txt_sel_all(text);
- break;
- case 2:
- txt_sel_line(text);
- break;
- default:
- break;
- }
-
- for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- SpaceText *st= sa->spacedata.first;
- if (st && st->spacetype==SPACE_TEXT) {
- scrarea_queue_redraw(sa);
- }
- }
-}
-
-/* action executed after clicking in Format menu */
-static void do_text_formatmenu(void *arg, int event)
-{
- SpaceText *st= curarea->spacedata.first; /* bad but cant pass as an arg here */
- Text *text;
- ScrArea *sa;
-
- if (st==NULL || st->spacetype != SPACE_TEXT) return;
-
- text = st->text;
-
- switch(event) {
- case 3:
- if (txt_has_sel(text)) {
- txt_order_cursors(text);
- indent(text);
- break;
- }
- else {
- txt_add_char(text, '\t');
- break;
- }
- case 4:
- if ( txt_has_sel(text)) {
- txt_order_cursors(text);
- unindent(text);
- break;
- }
- break;
- case 5:
- if ( txt_has_sel(text)) {
- txt_order_cursors(text);
- comment(text);
- if (st->showsyntax) get_format_string(st);
- break;
- }
- break;
- case 6:
- if ( txt_has_sel(text)) {
- txt_order_cursors(text);
- uncomment(text);
- if (st->showsyntax) get_format_string(st);
- break;
- }
- break;
- default:
- break;
- }
-
- for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- SpaceText *st= sa->spacedata.first;
- if (st && st->spacetype==SPACE_TEXT) {
- scrarea_queue_redraw(sa);
- }
- }
-}
-
-/* View menu */
-static uiBlock *text_editmenu_viewmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "text_editmenu_viewmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_text_editmenu_viewmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Top of File", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Bottom of File", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-
-/* Select menu */
-static uiBlock *text_editmenu_selectmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "text_editmenu_selectmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_text_editmenu_selectmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select All|Ctrl A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Line", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-
-void do_text_formatmenu_convert(void *arg, int event)
-{
- SpaceText *st= curarea->spacedata.first; /* bad but cant pass as an arg here */
-
- if (st==NULL || st->spacetype != SPACE_TEXT) return;
-
- switch(event) {
- case 1: convert_tabs(st, 0); break;
- case 2: convert_tabs(st, 1); break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *text_formatmenu_convert(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "do_text_formatmenu_convert", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_text_formatmenu_convert, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "To Spaces", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "Converts script whitespace to spaces based on Tab:");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "To Tabs", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "Converts script whitespace to tabs based on Tab:");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-/* Format menu */
-static uiBlock *text_formatmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "text_formatmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_text_formatmenu, NULL);
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Indent|Tab", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Unindent|Shift Tab", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Comment", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Uncomment|Ctrl Shift D", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBlockBut(block, text_formatmenu_convert, NULL, ICON_RIGHTARROW_THIN, "Convert whitespace", 0, yco-=20, menuwidth, 19, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- return block;
-}
-
-
-/* action executed after clicking in Object to 3d Sub Menu */
-void do_text_editmenu_to3dmenu(void *arg, int event)
-{
- SpaceText *st= curarea->spacedata.first; /* bad but cant pass as an arg here */
- Text *text;
- if (st==NULL || st->spacetype != SPACE_TEXT) return;
-
- text = st->text;
-
- switch(event) {
- case 1: txt_export_to_object(text); break;
- case 2: txt_export_to_objects(text); break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-/* Object to 3d Sub Menu */
-static uiBlock *text_editmenu_to3dmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "do_text_editmenu_to3dmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_text_editmenu_to3dmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "One Object | Alt-M", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "One Object Per Line", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-
-/* Edit menu */
-static uiBlock *text_editmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "text_editmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_text_editmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo|Ctrl Z", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Redo|Ctrl Shift Z", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Cut|Alt X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Copy|Alt C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Paste|Alt V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Print Cut Buffer", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBlockBut(block, text_editmenu_viewmenu, NULL, ICON_RIGHTARROW_THIN, "View|Alt Shift V ", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, text_editmenu_selectmenu, NULL, ICON_RIGHTARROW_THIN, "Select|Alt Shift S ", 0, yco-=20, 120, 19, "");
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Jump...|Alt J", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Find...|Alt Ctrl F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Find Again|Alt F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 9, "");
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBlockBut(block, text_editmenu_to3dmenu, NULL, ICON_RIGHTARROW_THIN, "Text to 3d Object", 0, yco-=20, 120, 19, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- return block;
-}
-
-/* File menu */
-static uiBlock *text_filemenu(void *arg_unused)
-{
- SpaceText *st= curarea->spacedata.first; /* bad but cant pass as an arg here */
- Text *text= st->text;
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "text_filemenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_text_filemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "New|Alt N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Open...|Alt O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
-
- if(text) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Reopen|Alt R", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Save|Alt S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Save As...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Run Python Script|Alt P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
-
- if (BPY_is_pyconstraint(text))
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Refresh All PyConstraints", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- }
-
- uiDefIconTextBlockBut(block, text_template_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Script Templates", 0, yco-=20, 120, 19, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- return block;
-}
-
-/* header */
-void text_buttons(void)
-{
- uiBlock *block;
- SpaceText *st= curarea->spacedata.first;
- Text *text;
- short xco, xmax;
- char naam[256];
-
- if (st==NULL || st->spacetype != SPACE_TEXT) return;
-
- text = st->text;
-
- sprintf(naam, "header %d", curarea->headwin);
- block= uiNewBlock(&curarea->uiblocks, naam, UI_EMBOSS, UI_HELV, curarea->headwin);
-
- if(area_is_active_area(curarea)) uiBlockSetCol(block, TH_HEADER);
- else uiBlockSetCol(block, TH_HEADERDESEL);
-
- curarea->butspacetype= SPACE_TEXT;
-
- xco = 8;
- uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D, windowtype_pup(), xco,0,XIC+10,YIC, &(curarea->butspacetype), 1.0, SPACEICONMAX, 0, 0, "Displays Current Window Type. Click for menu of available types.");
- xco+= XIC+14;
-
- uiBlockSetEmboss(block, UI_EMBOSSN);
- if(curarea->flag & HEADER_NO_PULLDOWN) {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, B_FLIPINFOMENU, ICON_DISCLOSURE_TRI_RIGHT,
- xco,2,XIC,YIC-2,
- &(curarea->flag), 0, 0, 0, 0, "Enables display of pulldown menus");
- } else {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, B_FLIPINFOMENU, ICON_DISCLOSURE_TRI_DOWN,
- xco,2,XIC,YIC-2,
- &(curarea->flag), 0, 0, 0, 0, "Hides pulldown menus");
- }
- uiBlockSetEmboss(block, UI_EMBOSS);
- xco+=XIC;
-
- /* pull down menus */
- if((curarea->flag & HEADER_NO_PULLDOWN)==0) {
- uiBlockSetEmboss(block, UI_EMBOSSP);
-
- xmax= GetButStringLength("File");
- uiDefPulldownBut(block,text_filemenu, NULL, "File", xco, 0, xmax, 20, "");
- xco+=xmax;
-
- if(text) {
- xmax= GetButStringLength("Edit");
- uiDefPulldownBut(block,text_editmenu, NULL, "Edit", xco, 0, xmax, 20, "");
- xco+=xmax;
-
- xmax= GetButStringLength("Format");
- uiDefPulldownBut(block,text_formatmenu, NULL, "Format", xco, 0, xmax, 20, "");
- xco+=xmax;
- }
- }
- uiBlockSetEmboss(block, UI_EMBOSS);
- xco += 10;
-
- /* FULL WINDOW */
- uiBlockBeginAlign(block);
- if(curarea->full) uiDefIconBut(block, BUT,B_FULL, ICON_SPLITSCREEN, xco,0,XIC,YIC, 0, 0, 0, 0, 0, "Returns to multiple views window (CTRL+Up arrow)");
- else uiDefIconBut(block, BUT,B_FULL, ICON_FULLSCREEN, xco,0,XIC,YIC, 0, 0, 0, 0, 0, "Makes current window full screen (CTRL+Down arrow)");
-
- uiDefIconButI(block, ICONTOG, B_TEXTLINENUM, ICON_LONGDISPLAY, xco+=XIC,0,XIC,YIC, &st->showlinenrs, 0, 0, 0, 0, "Displays line numbers");
-
- uiDefIconButI(block, ICONTOG, B_SYNTAX, ICON_SYNTAX, xco+=XIC,0,XIC,YIC, &st->showsyntax, 0, 0, 0, 0, "Enables Syntax Highlighting");
- uiBlockEndAlign(block);
-
- /* STD TEXT BUTTONS */
- xco+= 2*XIC;
- xco= std_libbuttons(block, xco, 0, 0, NULL, B_TEXTBROWSE, ID_TXT, 0, (ID*)st->text, 0, &(st->menunr), 0, 0, B_TEXTDELETE, 0, 0);
-
- /*
- if (st->text) {
- if (st->text->flags & TXT_ISDIRTY && (st->text->flags & TXT_ISEXT || !(st->text->flags & TXT_ISMEM)))
- uiDefIconBut(block, BUT,0, ICON_ERROR, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "The text has been changed");
- if (st->text->flags & TXT_ISEXT)
- uiDefBut(block, BUT,B_TEXTSTORE, ICON(), xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Stores text in project file");
- else
- uiDefBut(block, BUT,B_TEXTSTORE, ICON(), xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Disables storing of text in project file");
- xco+=10;
- }
- */
-
- xco+=XIC;
- if(st->font_id>1) st->font_id= 0;
- uiDefButI(block, MENU, B_TEXTFONT, "Screen 12 %x0|Screen 15%x1", xco,0,100,YIC, &st->font_id, 0, 0, 0, 0, "Displays available fonts");
- xco+=110;
-
- uiDefButI(block, NUM, B_TAB_NUMBERS, "Tab:", xco, 0, XIC+50, YIC, &st->tabnumber, 2, 8, 0, 0, "Set spacing of Tab");
- xco+= XIC+50;
-
- /* always as last */
- curarea->headbutlen= xco+2*XIC;
-
- uiDrawBlock(block);
-}
diff --git a/source/blender/src/header_time.c b/source/blender/src/header_time.c
deleted file mode 100644
index 53b22fc4e39..00000000000
--- a/source/blender/src/header_time.c
+++ /dev/null
@@ -1,539 +0,0 @@
-/**
- *
- * $Id:
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2005 Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "DNA_ID.h"
-#include "DNA_screen_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_space_types.h"
-#include "DNA_view2d_types.h"
-#include "DNA_userdef_types.h"
-
-#include "BIF_gl.h"
-#include "BIF_interface.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-#include "BIF_butspace.h"
-
-#include "BKE_global.h"
-#include "BKE_main.h"
-
-#include "BSE_drawipo.h"
-#include "BSE_drawview.h"
-#include "BSE_editipo.h"
-#include "BSE_filesel.h"
-#include "BSE_headerbuttons.h"
-#include "BSE_seqaudio.h"
-#include "BSE_time.h"
-
-#include "blendef.h"
-#include "butspace.h"
-#include "mydevice.h"
-
-void do_time_buttons(ScrArea *sa, unsigned short event)
-{
- SpaceTime *stime= sa->spacedata.first;
-
- switch(event) {
-
- case B_TL_REW:
- CFRA= PSFRA;
- update_for_newframe();
- break;
- case B_TL_PLAY:
- add_screenhandler(G.curscreen, SCREEN_HANDLER_ANIM, stime->redraws);
- if(stime->redraws & TIME_WITH_SEQ_AUDIO)
- audiostream_start( CFRA );
-
- break;
- case B_TL_STOP:
- rem_screenhandler(G.curscreen, SCREEN_HANDLER_ANIM);
- if(stime->redraws & TIME_WITH_SEQ_AUDIO)
- audiostream_stop();
- allqueue(REDRAWALL, 0);
-
- break;
- case B_TL_FF:
- /* end frame */
- CFRA= PEFRA;
- update_for_newframe();
- break;
- case B_TL_PREVKEY:
- /* previous keyframe */
- nextprev_timeline_key(-1);
- break;
- case B_TL_NEXTKEY:
- /* next keyframe */
- nextprev_timeline_key(1);
- break;
-
- case B_TL_PREVIEWON:
- if (G.scene->r.psfra) {
- /* turn on preview range */
- G.scene->r.psfra= G.scene->r.sfra;
- G.scene->r.pefra= G.scene->r.efra;
- }
- else {
- /* turn off preview range */
- G.scene->r.psfra= 0;
- G.scene->r.pefra= 0;
- }
- BIF_undo_push("Set anim-preview range");
- allqueue(REDRAWALL, 0);
- break;
- }
-}
-
-static void do_time_redrawmenu(void *arg, int event)
-{
- SpaceTime *stime= curarea->spacedata.first;
-
- if(event < 1001) {
-
- stime->redraws ^= event;
- /* update handler when it's running */
- if(has_screenhandler(G.curscreen, SCREEN_HANDLER_ANIM))
- add_screenhandler(G.curscreen, SCREEN_HANDLER_ANIM, stime->redraws);
- }
- else {
- if(event==1001) {
- button(&G.scene->r.frs_sec,1,120,"FPS:");
- }
- }
-}
-
-
-static uiBlock *time_redrawmenu(void *arg_unused)
-{
- SpaceTime *stime= curarea->spacedata.first;
- uiBlock *block;
- short yco= 0, menuwidth=120, icon;
- char str[32];
-
- block= uiNewBlock(&curarea->uiblocks, "time_redrawmenu",
- UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_time_redrawmenu, NULL);
-
- if(stime->redraws & TIME_LEFTMOST_3D_WIN) icon= ICON_CHECKBOX_HLT;
- else icon= ICON_CHECKBOX_DEHLT;
- uiDefIconTextBut(block, BUTM, 1, icon, "Top-Left 3D Window", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_LEFTMOST_3D_WIN, "");
-
- if(stime->redraws & TIME_ALL_3D_WIN) icon= ICON_CHECKBOX_HLT;
- else icon= ICON_CHECKBOX_DEHLT;
- uiDefIconTextBut(block, BUTM, 1, icon, "All 3D Windows", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_ALL_3D_WIN, "");
-
- if(stime->redraws & TIME_ALL_ANIM_WIN) icon= ICON_CHECKBOX_HLT;
- else icon= ICON_CHECKBOX_DEHLT;
- uiDefIconTextBut(block, BUTM, 1, icon, "Animation Windows", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_ALL_ANIM_WIN, "");
-
- if(stime->redraws & TIME_ALL_BUTS_WIN) icon= ICON_CHECKBOX_HLT;
- else icon= ICON_CHECKBOX_DEHLT;
- uiDefIconTextBut(block, BUTM, 1, icon, "Buttons Windows", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_ALL_BUTS_WIN, "");
-
- if(stime->redraws & TIME_ALL_IMAGE_WIN) icon= ICON_CHECKBOX_HLT;
- else icon= ICON_CHECKBOX_DEHLT;
- uiDefIconTextBut(block, BUTM, 1, icon, "Image Windows", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_ALL_IMAGE_WIN, "");
-
- /* Add sequencer only redraw*/
- if(stime->redraws & TIME_SEQ) icon= ICON_CHECKBOX_HLT;
- else icon= ICON_CHECKBOX_DEHLT;
- uiDefIconTextBut(block, BUTM, 1, icon, "Sequencer Windows", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_SEQ, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- sprintf(str, "Set Frames/Sec (%d/%f)", G.scene->r.frs_sec, G.scene->r.frs_sec_base);
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, str, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1001, "");
-
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-static void do_time_viewmenu(void *arg, int event)
-{
- SpaceTime *stime= curarea->spacedata.first;
- int first;
-
- switch(event) {
- case 2: /* Play Back Animation */
- add_screenhandler(G.curscreen, SCREEN_HANDLER_ANIM, stime->redraws);
- break;
- case 3: /* View All */
- first= G.scene->r.sfra;
- if(first >= G.scene->r.efra) first= G.scene->r.efra;
- G.v2d->cur.xmin=G.v2d->tot.xmin= (float)first-2;
- G.v2d->cur.xmax=G.v2d->tot.xmax= (float)G.scene->r.efra+2;
-
- test_view2d(G.v2d, curarea->winx, curarea->winy);
- scrarea_queue_winredraw(curarea);
- break;
- case 4: /* Maximize Window */
- /* using event B_FULL */
- break;
- case 5: /* show time or frames */
- stime->flag ^= TIME_DRAWFRAMES;
- break;
- case 6:
- nextprev_marker(1);
- break;
- case 7:
- nextprev_marker(-1);
- break;
- case 8:
- nextprev_timeline_key(1);
- break;
- case 9:
- nextprev_timeline_key(-1);
- break;
- case 10:
- timeline_frame_to_center();
- break;
- case 11:
- G.v2d->flag ^= V2D_VIEWLOCK;
- if(G.v2d->flag & V2D_VIEWLOCK)
- view2d_do_locks(curarea, 0);
- break;
- case 12: /* only show keyframes from selected data */
- stime->flag ^= TIME_ONLYACTSEL;
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *time_viewmenu(void *arg_unused)
-{
- SpaceTime *stime= curarea->spacedata.first;
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "time_viewmenu",
- UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_time_viewmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Play Back Animation", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- if(stime->flag & TIME_DRAWFRAMES)
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Seconds|T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
- else
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Frames|T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
-
- uiDefIconTextBut(block, BUTM, 1, (stime->flag & TIME_ONLYACTSEL)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT,
- "Only Selected Data Keys|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Jump To Next Marker|PageUp", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Jump To Prev Marker|PageDown", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Jump To Next Key|Ctrl PageUp", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Jump To Prev Key|Ctrl PageDown", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 9, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Center View|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "View All|Home", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, (G.v2d->flag & V2D_VIEWLOCK)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT,
- "Lock Time to Other Windows|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, "");
-
- if (!curarea->full)
- uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Maximize Window|Ctrl UpArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
- else
- uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Tile Window|Ctrl DownArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-static void do_time_framemenu(void *arg, int event)
-{
- switch(event) {
- case 1: /*Set as Start */
- if (G.scene->r.psfra) {
- if (G.scene->r.pefra < CFRA)
- G.scene->r.pefra= CFRA;
- G.scene->r.psfra= CFRA;
- }
- else
- G.scene->r.sfra = CFRA;
- allqueue(REDRAWALL, 1);
- break;
- case 2: /* Set as End */
- if (G.scene->r.psfra) {
- if (CFRA < G.scene->r.psfra)
- G.scene->r.psfra= CFRA;
- G.scene->r.pefra= CFRA;
- }
- else
- G.scene->r.efra = CFRA;
- allqueue(REDRAWALL, 1);
- break;
- case 3: /* Add Marker */
- add_marker(CFRA);
- break;
- case 4: /* Remove Marker */
- remove_marker();
- break;
- case 5: /* Rename Marker */
- rename_marker();
- break;
- case 6: /* Grab Marker */
- transform_markers('g', 0);
- break;
- case 7: /* duplicate marker */
- duplicate_marker();
- break;
- }
- allqueue(REDRAWTIME, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWSOUND, 0);
-}
-
-static uiBlock *time_framemenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "time_framemenu",
- UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_time_framemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Marker|M", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate Marker|Shift D", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Marker|X", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Name Marker|Ctrl M", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Grab/Move Marker|G", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set as Start|S", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set as End|E", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-void time_buttons(ScrArea *sa)
-{
- SpaceTime *stime= sa->spacedata.first;
- uiBlock *block;
- short xco, xmax;
- char name[256];
-
- sprintf(name, "header %d", sa->headwin);
- block= uiNewBlock(&sa->uiblocks, name, UI_EMBOSS, UI_HELV, sa->headwin);
-
- if(area_is_active_area(sa)) uiBlockSetCol(block, TH_HEADER);
- else uiBlockSetCol(block, TH_HEADERDESEL);
-
- sa->butspacetype= SPACE_TIME;
-
- xco = 8;
-
- uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D,
- windowtype_pup(), xco, 0, XIC+10, YIC,
- &(sa->butspacetype), 1.0, SPACEICONMAX, 0, 0,
- "Displays Current Window Type. "
- "Click for menu of available types.");
-
- xco += XIC + 14;
-
- uiBlockSetEmboss(block, UI_EMBOSSN);
- if (sa->flag & HEADER_NO_PULLDOWN) {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, B_FLIPINFOMENU,
- ICON_DISCLOSURE_TRI_RIGHT,
- xco,2,XIC,YIC-2,
- &(sa->flag), 0, 0, 0, 0,
- "Show pulldown menus");
- }
- else {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, B_FLIPINFOMENU,
- ICON_DISCLOSURE_TRI_DOWN,
- xco,2,XIC,YIC-2,
- &(sa->flag), 0, 0, 0, 0,
- "Hide pulldown menus");
- }
- uiBlockSetEmboss(block, UI_EMBOSS);
- xco+=XIC;
-
- if((sa->flag & HEADER_NO_PULLDOWN)==0) {
- /* pull down menus */
- uiBlockSetEmboss(block, UI_EMBOSSP);
-
- xmax= GetButStringLength("View");
- uiDefPulldownBut(block, time_viewmenu, NULL,
- "View", xco, -2, xmax-3, 24, "");
- xco+= xmax;
- xmax= GetButStringLength("Frame");
- uiDefPulldownBut(block, time_framemenu, NULL,
- "Frame", xco, -2, xmax-3, 24, "");
- xco+= xmax;
-
- xmax= GetButStringLength("Playback");
- uiDefPulldownBut(block, time_redrawmenu, NULL,
- "Playback", xco, -2, xmax-3, 24, "");
- xco+= xmax;
- }
-
- uiBlockSetEmboss(block, UI_EMBOSS);
-
- uiBlockBeginAlign(block);
-
- uiDefButI(block, TOG, B_TL_PREVIEWON,"Preview",
- xco,0, XIC, YIC,
- &G.scene->r.psfra,0, 1, 0, 0,
- "Show settings for frame range of animation preview");
-
- xco += XIC;
-
- if (G.scene->r.psfra) {
- uiDefButI(block, NUM, REDRAWALL,"Start:",
- xco,0, 4.5*XIC, YIC,
- &G.scene->r.psfra,MINFRAMEF, MAXFRAMEF, 0, 0,
- "The start frame of the animation preview");
-
- xco += 4.5*XIC;
-
- uiDefButI(block, NUM, REDRAWALL,"End:",
- xco,0,4.5*XIC,YIC,
- &G.scene->r.pefra,PSFRA,MAXFRAMEF, 0, 0,
- "The end frame of the animation preview");
- }
- else {
- uiDefButI(block, NUM, REDRAWALL,"Start:",
- xco,0, 4.5*XIC, YIC,
- &G.scene->r.sfra,MINFRAMEF, MAXFRAMEF, 0, 0,
- "The start frame of the animation");
-
- xco += 4.5*XIC;
-
- uiDefButI(block, NUM, REDRAWALL,"End:",
- xco,0,4.5*XIC,YIC,
- &G.scene->r.efra,SFRA,MAXFRAMEF, 0, 0,
- "The end frame of the animation");
- }
- uiBlockEndAlign(block);
-
- xco += 4.5*XIC+16;
-
- uiDefButI(block, NUM, B_NEWFRAME, "",
- xco,0,3.5*XIC,YIC,
- &(G.scene->r.cfra), MINFRAMEF, MAXFRAMEF, 0, 0,
- "Displays Current Frame of animation. Click to change.");
-
- xco += 3.5*XIC+16;
-
- uiDefIconBut(block, BUT, B_TL_REW, ICON_REW,
- xco, 0, XIC, YIC, 0, 0, 0, 0, 0, "Skip to Start frame (Shift DownArrow)");
- xco+= XIC+4;
- uiDefIconBut(block, BUT, B_TL_PREVKEY, ICON_PREV_KEYFRAME,
- xco, 0, XIC, YIC, 0, 0, 0, 0, 0, "Skip to previous keyframe (Ctrl PageDown)");
- xco+= XIC+4;
-
- if(has_screenhandler(G.curscreen, SCREEN_HANDLER_ANIM))
- uiDefIconBut(block, BUT, B_TL_STOP, ICON_PAUSE,
- xco, 0, XIC, YIC, 0, 0, 0, 0, 0, "Stop Playing Timeline");
- else
- uiDefIconBut(block, BUT, B_TL_PLAY, ICON_PLAY,
- xco, 0, XIC, YIC, 0, 0, 0, 0, 0, "Play Timeline ");
-
- xco+= XIC+4;
- uiDefIconBut(block, BUT, B_TL_NEXTKEY, ICON_NEXT_KEYFRAME,
- xco, 0, XIC, YIC, 0, 0, 0, 0, 0, "Skip to next keyframe (Ctrl PageUp)");
- xco+= XIC+4;
- uiDefIconBut(block, BUT, B_TL_FF, ICON_FF,
- xco, 0, XIC, YIC, 0, 0, 0, 0, 0, "Skip to End frame (Shift UpArrow)");
- xco+= XIC+8;
-
- uiDefIconButBitI(block, TOG, G_RECORDKEYS, REDRAWINFO, ICON_REC,
- xco, 0, XIC, YIC, &(G.flags), 0, 0, 0, 0, "Automatically insert keyframes in Object and Action Ipo curves");
-
- xco+= XIC+16;
-
- uiDefIconButBitI(block, TOG, TIME_WITH_SEQ_AUDIO, B_DIFF, ICON_SPEAKER,
- xco, 0, XIC, YIC, &(stime->redraws), 0, 0, 0, 0, "Play back and sync with audio from Sequence Editor");
-
- /* always as last */
- sa->headbutlen= xco+XIC+80; // +80 because the last button is not an icon
-
- uiDrawBlock(block);
-}
diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c
deleted file mode 100644
index 95f24c34098..00000000000
--- a/source/blender/src/header_view3d.c
+++ /dev/null
@@ -1,5489 +0,0 @@
-/*
- * header_view3d.c oct-2003
- *
- * Functions to draw the "3D Viewport" window header
- * and handle user events sent to it.
- *
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "BMF_Api.h"
-#include "BIF_language.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_armature_types.h"
-#include "DNA_ID.h"
-#include "DNA_image_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_text_types.h" /* for space handlers */
-#include "DNA_texture_types.h"
-#include "DNA_userdef_types.h" /* U.smooth_viewtx */
-
-#include "BKE_action.h"
-#include "BKE_curve.h"
-#include "BKE_depsgraph.h"
-#include "BKE_displist.h"
-#include "BKE_effect.h"
-#include "BKE_global.h"
-#include "BKE_image.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
-#include "BKE_mesh.h"
-#include "BKE_modifier.h"
-#include "BKE_particle.h"
-#include "BKE_utildefines.h" /* for VECCOPY */
-
-#ifdef WITH_VERSE
-#include "BKE_verse.h"
-#endif
-
-#include "BLI_arithb.h"
-#include "BLI_blenlib.h"
-#include "BLI_editVert.h"
-
-#include "BSE_edit.h"
-#include "BSE_editipo.h"
-#include "BSE_headerbuttons.h"
-#include "BSE_view.h"
-#include "BSE_drawview.h"
-
-#include "BDR_editcurve.h"
-#include "BDR_editface.h"
-#include "BDR_editmball.h"
-#include "BDR_editobject.h"
-#include "BDR_sculptmode.h"
-#include "BDR_imagepaint.h"
-#include "BDR_vpaint.h"
-
-#include "BIF_editlattice.h"
-#include "BIF_editarmature.h"
-#include "BIF_editparticle.h"
-#include "BIF_editconstraint.h"
-#include "BIF_editdeform.h"
-#include "BIF_editfont.h"
-#include "BIF_editgroup.h"
-#include "BIF_editmesh.h"
-#include "BIF_editmode_undo.h"
-#include "BIF_editview.h"
-#include "BIF_gl.h"
-#include "BIF_interface.h"
-#include "BIF_mainqueue.h"
-#include "BIF_meshtools.h"
-#include "BIF_poseobject.h"
-#include "BIF_renderwin.h"
-#include "BIF_resources.h"
-#include "BIF_retopo.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toets.h"
-#include "BIF_toolbox.h"
-#include "BIF_transform.h"
-
-#ifdef WITH_VERSE
-#include "BIF_verse.h"
-#endif
-
-#include "BPY_extern.h"
-#include "BPY_menus.h"
-
-#include "blendef.h"
-#include "multires.h"
-#include "mydevice.h"
-#include "butspace.h"
-
-#include "BIF_poseobject.h"
-
-/* View3d->modeselect
- * This is a bit of a dodgy hack to enable a 'mode' menu with icons+labels
- * rather than those buttons.
- * I know the implementation's not good - it's an experiment to see if this
- * approach would work well
- *
- * This can be cleaned when I make some new 'mode' icons.
- */
-
-#define V3D_OBJECTMODE_SEL ICON_OBJECT
-#define V3D_EDITMODE_SEL ICON_EDITMODE_HLT
-#define V3D_SCULPTMODE_SEL ICON_SCULPTMODE_HLT
-#define V3D_FACESELECT_SEL ICON_FACESEL_HLT /* this is not a mode anymore - just a switch */
-#define V3D_VERTEXPAINTMODE_SEL ICON_VPAINT_HLT
-#define V3D_TEXTUREPAINTMODE_SEL ICON_TPAINT_HLT
-#define V3D_WEIGHTPAINTMODE_SEL ICON_WPAINT_HLT
-#define V3D_POSEMODE_SEL ICON_POSE_HLT
-#define V3D_PARTICLEEDITMODE_SEL ICON_ANIM
-
-#define TEST_EDITMESH if(G.obedit==0) return; \
- if( (G.vd->lay & G.obedit->lay)==0 ) return;
-
-void do_layer_buttons(short event)
-{
- static int oldlay= 1;
-
- if(G.vd==0) return;
- if(G.vd->localview) return;
-
- if(event==-1 && (G.qual & LR_CTRLKEY)) {
- G.vd->scenelock= !G.vd->scenelock;
- do_view3d_buttons(B_SCENELOCK);
- } else if (event==-1) {
- if(G.vd->lay== (1<<20)-1) {
- if(G.qual & LR_SHIFTKEY) G.vd->lay= oldlay;
- }
- else {
- oldlay= G.vd->lay;
- G.vd->lay= (1<<20)-1;
- }
-
- if(G.vd->scenelock) handle_view3d_lock();
- scrarea_queue_winredraw(curarea);
-
- /* new layers might need unflushed events events */
- DAG_scene_update_flags(G.scene, G.vd->lay); /* tags all that moves and flushes */
- }
- else {
- if(G.qual & LR_ALTKEY) {
- if(event<11) event+= 10;
- }
- if(G.qual & LR_SHIFTKEY) {
- if(G.vd->lay & (1<<event)) G.vd->lay -= (1<<event);
- else G.vd->lay += (1<<event);
- }
- do_view3d_buttons(event+B_LAY);
- }
- /* redraw seems double: but the queue nicely handles that */
- scrarea_queue_headredraw(curarea);
-
- if(curarea->spacetype==SPACE_OOPS) allqueue(REDRAWVIEW3D, 1); /* 1==also do headwin */
- if(G.vd->drawtype == OB_SHADED) reshadeall_displist();
- allqueue(REDRAWNLA, 0);
-}
-
-static void do_view3d_view_camerasmenu(void *arg, int event)
-{
- Base *base;
- int i=1;
-
- if (event == 1) {
- /* Set Active Object as Active Camera */
- /* ugly hack alert */
- G.qual |= LR_CTRLKEY;
- persptoetsen(PAD0);
- G.qual &= ~LR_CTRLKEY;
- } else {
- for( base = FIRSTBASE; base; base = base->next ) {
- if (base->object->type == OB_CAMERA) {
- i++;
-
- if (event==i) {
-
- if (G.vd->camera == base->object && G.vd->persp==2)
- return;
-
- if (U.smooth_viewtx) {
- /* move 3d view to camera view */
- float orig_ofs[3], orig_lens = G.vd->lens;
- VECCOPY(orig_ofs, G.vd->ofs);
-
- if (G.vd->camera && G.vd->persp==2)
- view_settings_from_ob(G.vd->camera, G.vd->ofs, G.vd->viewquat, &G.vd->dist, &G.vd->lens);
-
- G.vd->camera = base->object;
- handle_view3d_lock();
- G.vd->persp= 2;
- G.vd->view= 0;
-
- smooth_view_to_camera(G.vd);
-
- /* restore values */
- VECCOPY(G.vd->ofs, orig_ofs);
- G.vd->lens = orig_lens;
- } else {
- G.vd->camera= base->object;
- handle_view3d_lock();
- G.vd->persp= 2;
- G.vd->view= 0;
- }
- break;
- }
- }
- }
- }
-
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_view_camerasmenu(void *arg_unused)
-{
- Base *base;
- uiBlock *block;
- short yco= 0, menuwidth=120;
- int i=1;
- char camname[48];
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_view_camerasmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_view_camerasmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Active Object as Active Camera|Ctrl NumPad 0", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, 140, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- for( base = FIRSTBASE; base; base = base->next ) {
- if (base->object->type == OB_CAMERA) {
- i++;
-
- strcpy(camname, base->object->id.name+2);
- if (base->object == G.scene->camera) strcat(camname, " (Active)");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, camname, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, i, "");
- }
- }
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 50);
- return block;
-}
-
-static void do_view3d_view_cameracontrolsmenu(void *arg, int event)
-{
- switch(event) {
- case 0: /* Orbit Left */
- persptoetsen(PAD4);
- break;
- case 1: /* Orbit Right */
- persptoetsen(PAD6);
- break;
- case 2: /* Orbit Up */
- persptoetsen(PAD8);
- break;
- case 3: /* Orbit Down */
- persptoetsen(PAD2);
- break;
- case 4: /* Pan left */
- /* ugly hack alert */
- G.qual |= LR_CTRLKEY;
- persptoetsen(PAD4);
- G.qual &= ~LR_CTRLKEY;
- break;
- case 5: /* Pan right */
- /* ugly hack alert */
- G.qual |= LR_CTRLKEY;
- persptoetsen(PAD6);
- G.qual &= ~LR_CTRLKEY;
- break;
- case 6: /* Pan up */
- /* ugly hack alert */
- G.qual |= LR_CTRLKEY;
- persptoetsen(PAD8);
- G.qual &= ~LR_CTRLKEY;
- break;
- case 7: /* Pan down */
- /* ugly hack alert */
- G.qual |= LR_CTRLKEY;
- persptoetsen(PAD2);
- G.qual &= ~LR_CTRLKEY;
- break;
- case 8: /* Zoom In */
- persptoetsen(PADPLUSKEY);
- break;
- case 9: /* Zoom Out */
- persptoetsen(PADMINUS);
- break;
- case 10: /* Reset Zoom */
- persptoetsen(PADENTER);
- break;
- case 11: /* Camera Fly mode */
- fly();
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_view_cameracontrolsmenu(void *arg_unused)
-{
-/* static short tog=0; */
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_view_cameracontrolsmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_view_cameracontrolsmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Camera Fly Mode|Shift F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 11, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, 140, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Orbit Left|NumPad 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Orbit Right|NumPad 6", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Orbit Up|NumPad 8", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Orbit Down|NumPad 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, 140, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Pan Left|Ctrl NumPad 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Pan Right|Ctrl NumPad 6", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Pan Up|Ctrl NumPad 8", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Pan Down|Ctrl NumPad 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, 140, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Zoom In|NumPad +", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Zoom Out|NumPad -", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 9, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Reset Zoom|NumPad Enter", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 10, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 50);
- return block;
-}
-
-static void do_view3d_view_alignviewmenu(void *arg, int event)
-{
- View3D *v3d= curarea->spacedata.first;
- float *curs;
-
- switch(event) {
-
- case 0: /* Align View to Selected (edit/faceselect mode) */
- case 1:
- case 2:
- if ((G.obedit) && (G.obedit->type == OB_MESH)) {
- editmesh_align_view_to_selected(v3d, event);
- } else if (FACESEL_PAINT_TEST) {
- Object *obact= OBACT;
- if (obact && obact->type==OB_MESH) {
- Mesh *me= obact->data;
-
- if (me->mtface) {
- faceselect_align_view_to_selected(v3d, me, event);
- addqueue(v3d->area->win, REDRAW, 1);
- }
- }
- }
- break;
- case 3: /* Center View to Cursor */
- curs= give_cursor();
- G.vd->ofs[0]= -curs[0];
- G.vd->ofs[1]= -curs[1];
- G.vd->ofs[2]= -curs[2];
- scrarea_queue_winredraw(curarea);
- break;
- case 4: /* Align Active Camera to View */
- /* This ugly hack is a symptom of the nasty persptoetsen function,
- * but at least it works for now.
- */
- G.qual |= LR_CTRLKEY|LR_ALTKEY;
- persptoetsen(PAD0);
- G.qual &= ~(LR_CTRLKEY|LR_ALTKEY);
- break;
- case 5: /* Align View to Selected (object mode) */
- mainqenter(PADASTERKEY, 1);
- break;
- case 6: /* Center View and Cursor to Origin */
- view3d_home(1);
- curs= give_cursor();
- curs[0]=curs[1]=curs[2]= 0.0;
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_view_alignviewmenu(void *arg_unused)
-{
-/* static short tog=0; */
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_view_alignviewmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_view_alignviewmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Center View to Cursor|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Center Cursor and View All|Shift C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Align Active Camera to View|Ctrl Alt NumPad 0", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
-
- if (((G.obedit) && (G.obedit->type == OB_MESH)) || (FACESEL_PAINT_TEST)) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Align View to Selected (Top)|Shift V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Align View to Selected (Front)|Shift V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Align View to Selected (Side)|Shift V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
- } else {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Align View to Selected|NumPad *", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, "");
- }
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 50);
- return block;
-}
-
-static void do_view3d_view_spacehandlers(void *arg, int event)
-{
- Text *text = G.main->text.first;
- unsigned short menu_evt_num = 0;
-
- if (event > 0) {
- while (text) {
- if (++menu_evt_num == event) {
-
- if (BPY_has_spacehandler(text, curarea))
- BPY_del_spacehandler(text, curarea);
- else
- BPY_add_spacehandler(text, curarea, SPACE_VIEW3D);
-
- break;
- }
- text = text->id.next;
- }
- }
-
- allqueue(REDRAWVIEW3D, 1);
-}
-
-static uiBlock *view3d_view_spacehandlers(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
- Text *text = G.main->text.first;
- ScrArea *sa = curarea;
- unsigned short handlertype;
- int icontype, slinks_num = 0;
- unsigned short menu_evt_num = 0;
- char menustr[64];
- static char msg_tog_on[] = "Click to enable";
- static char msg_tog_off[]= "Click to disable";
- char *tip = NULL;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_view_spacehandlers", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_view_spacehandlers, NULL);
-
- while (text) {
- menu_evt_num++;
- handlertype = BPY_is_spacehandler(text, SPACE_VIEW3D);
-
- if (handlertype) {
- slinks_num++;
-
- /* mark text as script, so we can remove its link if its header
- * becomes corrupt and it's not recognized anymore */
- if (!(text->flags & TXT_ISSCRIPT)) text->flags |= TXT_ISSCRIPT;
-
- if (handlertype == SPACEHANDLER_VIEW3D_EVENT)
- BLI_strncpy(menustr, "Event: ", 8);
- else
- BLI_strncpy(menustr, "Draw: ", 8);
- BLI_strncpy(menustr+7, text->id.name+2, 22);
-
- if (BPY_has_spacehandler(text, sa)) {
- icontype = ICON_CHECKBOX_HLT;
- tip = msg_tog_off;
- }
- else {
- icontype = ICON_CHECKBOX_DEHLT;
- tip = msg_tog_on;
- }
-
- uiDefIconTextBut(block, BUTM, 1, icontype, menustr, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, menu_evt_num, tip);
- }
- else if (text->flags & TXT_ISSCRIPT) {
- /* if bit set, text was a space handler, but its header got corrupted,
- * so we need to remove the link here */
- BPY_del_spacehandler(text, sa);
- text->flags &=~TXT_ISSCRIPT;
- }
-
- text = text->id.next;
- }
-
- if (slinks_num == 0) {
- uiDefIconTextBut(block, BUTM, 1, ICON_SCRIPT, "None Available", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, -1, "None of the texts in the Text Editor is a 3D View space handler");
- }
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-static void do_view3d_viewmenu(void *arg, int event)
-{
- View3D *v3d= curarea->spacedata.first;
-
- switch(event) {
- case 0: /* User */
- G.vd->viewbut = 0;
- G.vd->persp = 1;
- break;
- case 1: /* Camera */
- persptoetsen(PAD0);
- break;
- case 2: /* Top */
- persptoetsen(PAD7);
- break;
- case 3: /* Front */
- persptoetsen(PAD1);
- break;
- case 4: /* Side */
- persptoetsen(PAD3);
- break;
- case 5: /* Perspective */
- G.vd->persp=1;
- break;
- case 6: /* Orthographic */
- G.vd->persp=0;
- break;
- case 7: /* Local View */
- G.vd->localview= 1;
- initlocalview();
- break;
- case 8: /* Global View */
- G.vd->localview= 0;
- endlocalview(curarea);
- break;
- case 9: /* View All (Home) */
- view3d_home(0);
- break;
- case 11: /* View Selected */
- centerview();
- break;
- case 13: /* Play Back Animation */
- play_anim(0);
- break;
- case 15: /* Background Image... */
- add_blockhandler(curarea, VIEW3D_HANDLER_BACKGROUND, UI_PNL_UNSTOW);
- break;
- case 16: /* View Panel */
- add_blockhandler(curarea, VIEW3D_HANDLER_PROPERTIES, UI_PNL_UNSTOW);
- break;
- case 17: /* Set Clipping Border */
- view3d_edit_clipping(v3d);
- break;
- case 18: /* render preview */
- toggle_blockhandler(curarea, VIEW3D_HANDLER_PREVIEW, 0);
- break;
- case 19: /* zoom within border */
- view3d_border_zoom();
- break;
- }
- allqueue(REDRAWVIEW3D, 1);
-}
-
-static uiBlock *view3d_viewmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
- View3D *v3d= curarea->spacedata.first;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_viewmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_view3d_viewmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Render Preview...|Shift P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 18, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "View Properties...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 16, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Background Image...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 15, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- if ((G.vd->viewbut == 0) && !(G.vd->persp == 2)) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "User", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "User", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
- if (G.vd->persp == 2) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Camera|NumPad 0", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Camera|NumPad 0", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
- if (G.vd->viewbut == 1) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Top|NumPad 7", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Top|NumPad 7", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
- if (G.vd->viewbut == 2) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Front|NumPad 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Front|NumPad 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
- if (G.vd->viewbut == 3) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Side|NumPad 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Side|NumPad 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
-
- uiDefIconTextBlockBut(block, view3d_view_camerasmenu, NULL, ICON_RIGHTARROW_THIN, "Cameras", 0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- if(G.vd->persp==1) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Perspective|NumPad 5", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Perspective|NumPad 5", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, "");
- if(G.vd->persp==0) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Orthographic|NumPad 5", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Orthographic|NumPad 5", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- if(G.vd->localview) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Local View|NumPad /", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Local View|NumPad /", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
- if(!G.vd->localview) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Global View|NumPad /", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Global View|NumPad /", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, view3d_view_cameracontrolsmenu, NULL, ICON_RIGHTARROW_THIN, "View Navigation", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, view3d_view_alignviewmenu, NULL, ICON_RIGHTARROW_THIN, "Align View", 0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- if(v3d->flag & V3D_CLIPPING)
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Clipping Border|Alt B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 17, "");
- else
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Clipping Border|Alt B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 17, "");
- if (v3d->persp==0) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Zoom Within Border...|Shift B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 19, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "View Selected|NumPad .", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 11, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "View All|Home", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 9, "");
- if(!curarea->full) uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Maximize Window|Ctrl UpArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 99, "");
- else uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Tile Window|Ctrl DownArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 99, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Play Back Animation|Alt A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 13, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBlockBut(block, view3d_view_spacehandlers, NULL, ICON_RIGHTARROW_THIN, "Space Handler Scripts", 0, yco-=20, 120, 19, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-void do_view3d_select_object_typemenu(void *arg, int event)
-{
-
- extern void selectall_type(short obtype);
-
- switch(event) {
- case 1: /* Mesh */
- selectall_type(OB_MESH);
- break;
- case 2: /* Curve */
- selectall_type(OB_CURVE);
- break;
- case 3: /* Surface */
- selectall_type(OB_SURF);
- break;
- case 4: /* Meta */
- selectall_type(OB_MBALL);
- break;
- case 5: /* Armature */
- selectall_type(OB_ARMATURE);
- break;
- case 6: /* Lattice */
- selectall_type(OB_LATTICE);
- break;
- case 7: /* Text */
- selectall_type(OB_FONT);
- break;
- case 8: /* Empty */
- selectall_type(OB_EMPTY);
- break;
- case 9: /* Camera */
- selectall_type(OB_CAMERA);
- break;
- case 10: /* Lamp */
- selectall_type(OB_LAMP);
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_select_object_typemenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_select_object_typemenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_select_object_typemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Mesh", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Curve", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Surface", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Meta", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Armature", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Lattice", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Text", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Empty", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Camera", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Lamp", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-void do_view3d_select_object_layermenu(void *arg, int event)
-{
- extern void selectall_layer(unsigned int layernum);
-
- switch(event) {
- case 0:
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- case 8:
- case 9:
- case 10:
- case 11:
- case 12:
- case 13:
- case 14:
- case 15:
- case 16:
- case 17:
- case 18:
- case 19:
- case 20:
- selectall_layer(event);
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_select_object_layermenu(void *arg_unused)
-{
- uiBlock *block;
- short xco= 0, yco = 20, menuwidth = 22;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_select_object_layermenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_select_object_layermenu, NULL);
-
- uiDefBut(block, BUTM, 1, "1", xco, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefBut(block, BUTM, 1, "2", xco+=(menuwidth+1), yco, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefBut(block, BUTM, 1, "3", xco+=(menuwidth+1), yco, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefBut(block, BUTM, 1, "4", xco+=(menuwidth+1), yco, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- uiDefBut(block, BUTM, 1, "5", xco+=(menuwidth+1), yco, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
- xco += 6;
- uiDefBut(block, BUTM, 1, "6", xco+=(menuwidth+1), yco, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
- uiDefBut(block, BUTM, 1, "7", xco+=(menuwidth+1), yco, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
- uiDefBut(block, BUTM, 1, "8", xco+=(menuwidth+1), yco, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
- uiDefBut(block, BUTM, 1, "9", xco+=(menuwidth+1), yco, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
- uiDefBut(block, BUTM, 1, "10", xco+=(menuwidth+1), yco, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
- xco = 0;
- uiDefBut(block, BUTM, 1, "11", xco, yco-=24, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, "");
- uiDefBut(block, BUTM, 1, "12", xco+=(menuwidth+1), yco, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
- uiDefBut(block, BUTM, 1, "13", xco+=(menuwidth+1), yco, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, "");
- uiDefBut(block, BUTM, 1, "14", xco+=(menuwidth+1), yco, menuwidth, 19, NULL, 0.0, 0.0, 1, 14, "");
- uiDefBut(block, BUTM, 1, "15", xco+=(menuwidth+1), yco, menuwidth, 19, NULL, 0.0, 0.0, 1, 15, "");
- xco += 6;
- uiDefBut(block, BUTM, 1, "16", xco+=(menuwidth+1), yco, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, "");
- uiDefBut(block, BUTM, 1, "17", xco+=(menuwidth+1), yco, menuwidth, 19, NULL, 0.0, 0.0, 1, 17, "");
- uiDefBut(block, BUTM, 1, "18", xco+=(menuwidth+1), yco, menuwidth, 19, NULL, 0.0, 0.0, 1, 18, "");
- uiDefBut(block, BUTM, 1, "19", xco+=(menuwidth+1), yco, menuwidth, 19, NULL, 0.0, 0.0, 1, 19, "");
- uiDefBut(block, BUTM, 1, "20", xco+=(menuwidth+1), yco, menuwidth, 19, NULL, 0.0, 0.0, 1, 20, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- /*uiTextBoundsBlock(block, 100);*/
- return block;
-}
-
-void do_view3d_select_object_linkedmenu(void *arg, int event)
-{
- switch(event) {
- case 1: /* Object Ipo */
- case 2: /* ObData */
- case 3: /* Current Material */
- case 4: /* Current Texture */
- selectlinks(event);
- break;
- }
- countall();
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_select_object_linkedmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_select_object_linkedmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_select_object_linkedmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object Ipo|Shift L, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "ObData|Shift L, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Material|Shift L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Texture|Shift L, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-void do_view3d_select_object_groupedmenu(void *arg, int event)
-{
- switch(event) {
- case 1: /* Children */
- case 2: /* Immediate Children */
- case 3: /* Parent */
- case 4: /* Siblings */
- case 5: /* Type */
- case 6: /* Objects on Shared Layers */
- case 7: /* Objects in Same Group */
- case 8: /* Object Hooks*/
- case 9: /* Object PassIndex*/
- select_object_grouped((short)event);
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_select_object_groupedmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_select_object_groupedmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_select_object_groupedmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Children|Shift G, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Immediate Children|Shift G, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Parent|Shift G, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Siblings (Shared Parent)|Shift G, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Objects of Same Type|Shift G, 5", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Objects on Shared Layers|Shift G, 6", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Objects in Same Group|Shift G, 7", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object Hooks|Shift G, 8", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object PassIndex|Shift G, 9", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-void do_view3d_select_objectmenu(void *arg, int event)
-{
- switch(event) {
-
- case 0: /* border select */
- borderselect();
- break;
- case 1: /* Select/Deselect All */
- deselectall();
- break;
- case 2: /* inverse */
- selectswap();
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_select_objectmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_select_objectmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_view3d_select_objectmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Inverse", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBlockBut(block, view3d_select_object_layermenu, NULL, ICON_RIGHTARROW_THIN, "Select All by Layer", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, view3d_select_object_typemenu, NULL, ICON_RIGHTARROW_THIN, "Select All by Type", 0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, view3d_select_object_linkedmenu, NULL, ICON_RIGHTARROW_THIN, "Linked", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, view3d_select_object_groupedmenu, NULL, ICON_RIGHTARROW_THIN, "Grouped", 0, yco-=20, 120, 19, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- return block;
-}
-
-void do_view3d_select_meshmenu(void *arg, int event)
-{
-/* extern void borderselect(void);*/
-
- switch(event) {
-
- case 0: /* border select */
- borderselect();
- break;
- case 2: /* Select/Deselect all */
- deselectall_mesh();
- break;
- case 3: /* Inverse */
- selectswap_mesh();
- break;
- case 4: /* select linked vertices */
- selectconnected_mesh_all();
- break;
- case 5: /* select random */
- selectrandom_mesh();
- break;
- case 7: /* select more */
- select_more();
- break;
- case 8: /* select less */
- select_less();
- break;
- case 9: /* select non-manifold */
- select_non_manifold();
- break;
- case 11: /* select triangles */
- select_faces_by_numverts(3);
- break;
- case 12: /* select quads */
- select_faces_by_numverts(4);
- break;
- case 13: /* select non-triangles/quads */
- select_faces_by_numverts(5);
- break;
- case 14: /* select sharp edges */
- select_sharp_edges();
- break;
- case 15: /* select linked flat faces */
- select_linked_flat_faces();
- break;
-
- case 16: /* path select */
- pathselect();
- BIF_undo_push("Path Select");
- break;
- case 17: /* edge loop select */
- loop_multiselect(0);
- break;
- case 18: /* edge ring select */
- loop_multiselect(1);
- break;
- case 19: /* loop to region */
- loop_to_region();
- break;
- case 20: /* region to loop */
- region_to_loop();
- break;
- case 21: /* Select grouped */
- select_mesh_group_menu();
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-
-static uiBlock *view3d_select_meshmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_select_meshmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_view3d_select_meshmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Inverse|Ctrl I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6,
- menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Random...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Non-Manifold|Ctrl Alt Shift M",
- 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Sharp Edges|Ctrl Alt Shift S",
- 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 14, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Linked Flat Faces|Ctrl Alt Shift F",
- 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 15, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6,
- menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Triangles|Ctrl Alt Shift 3",
- 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Quads|Ctrl Alt Shift 4",
- 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Non-Triangles/Quads|Ctrl Alt Shift 5",
- 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Similar to Selection...|Shift G",
- 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 21, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6,
- menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "More|Ctrl NumPad +",
- 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Less|Ctrl NumPad -",
- 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6,
- menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Linked Vertices|Ctrl L", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Vertex Path|W Alt 7", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Edge Loop|Ctrl E 6", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 17, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Edge Ring|Ctrl E 7", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 18, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6,
- menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Loop to Region|Ctrl E 8", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 19, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Region to Loop|Ctrl E 9", 0, yco-=20, menuwidth, 20, NULL, 0.0, 0.0, 1, 20, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- return block;
-}
-
-void do_view3d_select_curvemenu(void *arg, int event)
-{
-/* extern void borderselect(void);*/
-
- switch(event) {
- case 0: /* border select */
- borderselect();
- break;
- case 2: /* Select/Deselect all */
- deselectall_nurb();
- break;
- case 3: /* Inverse */
- selectswapNurb();
- break;
- /* select connected control points */
- /*case 4:
- G.qual |= LR_CTRLKEY;
- select_connected_nurb();
- G.qual &= ~LR_CTRLKEY;
- break;*/
- case 5: /* select row (nurb) */
- selectrow_nurb();
- break;
- case 7: /* select/deselect first */
- selectend_nurb(FIRST, 1, DESELECT);
- break;
- case 8: /* select/deselect last */
- selectend_nurb(LAST, 1, DESELECT);
- break;
- case 9: /* select more */
- select_more_nurb();
- break;
- case 10: /* select less */
- select_less_nurb();
- break;
- case 11: /* select next */
- select_next_nurb();
- break;
- case 12: /* select previous */
- select_prev_nurb();
- break;
- case 13: /* select random */
- select_random_nurb();
- break;
- case 14: /* select every nth */
- select_every_nth_nurb();
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-
-static uiBlock *view3d_select_curvemenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_select_curvemenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_view3d_select_curvemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Inverse", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Random...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Every Nth", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 14, "");
-
- if (OBACT->type == OB_SURF) {
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Control Point Row|Shift R", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
- }
- else {
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect First", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect Last", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Next", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Previous", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
- }
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "More|Ctrl NumPad +", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Less|Ctrl NumPad -", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
-
- /* commented out because it seems to only like the LKEY method - based on mouse pointer position :( */
- /*uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Connected Control Points|Ctrl L", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");*/
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- return block;
-}
-
-void do_view3d_select_metaballmenu(void *arg, int event)
-{
-
- switch(event) {
- case 0: /* border select */
- borderselect();
- break;
- case 2: /* Select/Deselect all */
- deselectall_mball();
- break;
- case 3: /* Inverse */
- selectinverse_mball();
- break;
- case 4: /* Select Random */
- selectrandom_mball();
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-
-static uiBlock *view3d_select_metaballmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_select_metaballmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_view3d_select_metaballmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Inverse", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Random...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- return block;
-}
-
-static void do_view3d_select_latticemenu(void *arg, int event)
-{
-/* extern void borderselect(void);*/
-
- switch(event) {
- case 0: /* border select */
- borderselect();
- break;
- case 2: /* Select/Deselect all */
- deselectall_Latt();
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_select_latticemenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_select_latticemenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_view3d_select_latticemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- return block;
-}
-
-static void do_view3d_select_armaturemenu(void *arg, int event)
-{
-/* extern void borderselect(void);*/
-
- switch(event) {
- case 0: /* border select */
- borderselect();
- break;
- case 2: /* Select/Deselect all */
- deselectall_armature(1, 1);
- break;
- case 3: /* Select Parent(s) */
- select_bone_parent();
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_select_armaturemenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_select_armaturemenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_view3d_select_armaturemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Parent(s)|P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- return block;
-}
-
-static void do_view3d_select_pose_armaturemenu(void *arg, int event)
-{
-/* extern void borderselect(void);*/
-
- switch(event) {
- case 0: /* border select */
- borderselect();
- break;
- case 2: /* Select/Deselect all */
- deselectall_posearmature(OBACT, 1, 1);
- break;
- case 3:
- pose_select_constraint_target();
- break;
- case 4:
- select_bone_parent();
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_select_pose_armaturemenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_select_pose_armaturemenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_view3d_select_pose_armaturemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Constraint Target|W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Parent(s)|P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- return block;
-}
-
-void do_view3d_select_faceselmenu(void *arg, int event)
-{
- /* events >= 6 are registered bpython scripts */
- if (event >= 6) BPY_menu_do_python(PYMENU_FACESELECT, event - 6);
-
- switch(event) {
- case 0: /* border select */
- borderselect();
- break;
- case 2: /* Select/Deselect all */
- deselectall_tface();
- break;
- case 3: /* Select Inverse */
- selectswap_tface();
- break;
- case 4: /* Select Linked */
- select_linked_tfaces(2);
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_select_faceselmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
- BPyMenu *pym;
- int i = 0;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_select_faceselmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_view3d_select_faceselmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Inverse", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Linked Faces|Ctrl L", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- /* note that we account for the 6 previous entries with i+6: */
- for (pym = BPyMenuTable[PYMENU_FACESELECT]; pym; pym = pym->next, i++) {
- uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, i+6,
- pym->tooltip?pym->tooltip:pym->filename);
- }
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- return block;
-}
-
-void do_view3d_edit_snapmenu(void *arg, int event)
-{
- switch(event) {
- case 1: /* Selection to grid */
- snap_sel_to_grid();
- break;
- case 2: /* Selection to cursor */
- snap_sel_to_curs();
- break;
- case 3: /* Cursor to grid */
- snap_curs_to_grid();
- break;
- case 4: /* Cursor to selection */
- snap_curs_to_sel();
- break;
- case 5: /* Selection to center of selection*/
- snap_to_center();
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_edit_snapmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_snapmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_edit_snapmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Selection -> Grid|Shift S, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Selection -> Cursor|Shift S, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Cursor -> Grid|Shift S, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Cursor -> Selection|Shift S, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Selection -> Center|Shift S, 5", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
-
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-void do_view3d_transform_moveaxismenu(void *arg, int event)
-{
- float mat[3][3];
-
- Mat3One(mat);
-
- switch(event)
- {
- case 0: /* X Global */
- initTransform(TFM_TRANSLATION, CTX_NONE);
- BIF_setSingleAxisConstraint(mat[0], " X");
- Transform();
- break;
- case 1: /* Y Global */
- initTransform(TFM_TRANSLATION, CTX_NONE);
- BIF_setSingleAxisConstraint(mat[1], " Y");
- Transform();
- break;
- case 2: /* Z Global */
- initTransform(TFM_TRANSLATION, CTX_NONE);
- BIF_setSingleAxisConstraint(mat[2], " Z");
- Transform();
- break;
- case 3: /* X Local */
- initTransform(TFM_TRANSLATION, CTX_NONE);
- BIF_setLocalAxisConstraint('X', " X");
- Transform();
- break;
- case 4: /* Y Local */
- initTransform(TFM_TRANSLATION, CTX_NONE);
- BIF_setLocalAxisConstraint('Y', " Y");
- Transform();
- break;
- case 5: /* Z Local */
- initTransform(TFM_TRANSLATION, CTX_NONE);
- BIF_setLocalAxisConstraint('Z', " Z");
- Transform();
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_transform_moveaxismenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_transform_moveaxismenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_transform_moveaxismenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "X Global|G, X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Y Global|G, Y", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Z Global|G, Z", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "X Local|G, X, X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Y Local|G, Y, Y", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Z Local|G, Z, Z", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
-
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-void do_view3d_transform_rotateaxismenu(void *arg, int event)
-{
- float mat[3][3];
-
- Mat3One(mat);
-
- switch(event)
- {
- case 0: /* X Global */
- initTransform(TFM_ROTATION, CTX_NONE);
- BIF_setSingleAxisConstraint(mat[0], " X");
- Transform();
- break;
- case 1: /* Y Global */
- initTransform(TFM_ROTATION, CTX_NONE);
- BIF_setSingleAxisConstraint(mat[1], " Y");
- Transform();
- break;
- case 2: /* Z Global */
- initTransform(TFM_ROTATION, CTX_NONE);
- BIF_setSingleAxisConstraint(mat[2], " Z");
- Transform();
- break;
- case 3: /* X Local */
- initTransform(TFM_ROTATION, CTX_NONE);
- BIF_setLocalAxisConstraint('X', " X");
- Transform();
- break;
- case 4: /* Y Local */
- initTransform(TFM_ROTATION, CTX_NONE);
- BIF_setLocalAxisConstraint('Y', " Y");
- Transform();
- break;
- case 5: /* Z Local */
- initTransform(TFM_ROTATION, CTX_NONE);
- BIF_setLocalAxisConstraint('Z', " Z");
- Transform();
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_transform_rotateaxismenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_transform_rotateaxismenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_transform_rotateaxismenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "X Global|R, X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Y Global|R, Y", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Z Global|R, Z", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "X Local|R, X, X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Y Local|R, Y, Y", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Z Local|R, Z, Z", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
-
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-void do_view3d_transform_scaleaxismenu(void *arg, int event)
-{
- float mat[3][3];
-
- Mat3One(mat);
-
- switch(event)
- {
- case 0: /* X Global */
- initTransform(TFM_RESIZE, CTX_NONE);
- BIF_setSingleAxisConstraint(mat[0], " X");
- Transform();
- break;
- case 1: /* Y Global */
- initTransform(TFM_RESIZE, CTX_NONE);
- BIF_setSingleAxisConstraint(mat[1], " Y");
- Transform();
- break;
- case 2: /* Z Global */
- initTransform(TFM_RESIZE, CTX_NONE);
- BIF_setSingleAxisConstraint(mat[2], " Z");
- Transform();
- break;
- case 3: /* X Local */
- initTransform(TFM_RESIZE, CTX_NONE);
- BIF_setLocalAxisConstraint('X', " X");
- Transform();
- break;
- case 4: /* Y Local */
- initTransform(TFM_RESIZE, CTX_NONE);
- BIF_setLocalAxisConstraint('X', " X");
- Transform();
- break;
- case 5: /* Z Local */
- initTransform(TFM_RESIZE, CTX_NONE);
- BIF_setLocalAxisConstraint('X', " X");
- Transform();
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_transform_scaleaxismenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_transform_scaleaxismenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_transform_scaleaxismenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "X Global|S, X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Y Global|S, Y", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Z Global|S, Z", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "X Local|S, X, X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Y Local|S, Y, Y", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Z Local|S, Z, Z", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
-
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_view3d_transformmenu(void *arg, int event)
-{
- switch(event) {
- case 1:
- initTransform(TFM_TRANSLATION, CTX_NONE);
- Transform();
- break;
- case 2:
- initTransform(TFM_ROTATION, CTX_NONE);
- Transform();
- break;
- case 3:
- initTransform(TFM_RESIZE, CTX_NONE);
- Transform();
- break;
- case 4:
- image_aspect();
- break;
- case 5:
- initTransform(TFM_TOSPHERE, CTX_NONE);
- Transform();
- break;
- case 6:
- initTransform(TFM_SHEAR, CTX_NONE);
- Transform();
- break;
- case 7:
- initTransform(TFM_WARP, CTX_NONE);
- Transform();
- break;
- case 8:
- initTransform(TFM_PUSHPULL, CTX_NONE);
- Transform();
- break;
- case 9:
- if (G.obedit) {
- if (G.obedit->type == OB_MESH)
- initTransform(TFM_SHRINKFATTEN, CTX_NONE);
- Transform();
- } else error("Only meshes can be shrinked/fattened");
- break;
- case 10:
- docenter(0);
- break;
- case 11:
- docenter_new();
- break;
- case 12:
- docenter_cursor();
- break;
- case 13:
- initTransform(TFM_TILT, CTX_NONE);
- Transform();
- break;
- case 14:
- initTransform(TFM_CURVE_SHRINKFATTEN, CTX_NONE);
- Transform();
- break;
- case 15:
- G.scene->snap_flag &= ~SCE_SNAP;
- break;
- case 16:
- G.scene->snap_flag |= SCE_SNAP;
- break;
- case 17:
- G.scene->snap_target = SCE_SNAP_TARGET_CLOSEST;
- break;
- case 18:
- G.scene->snap_target = SCE_SNAP_TARGET_CENTER;
- break;
- case 19:
- G.scene->snap_target = SCE_SNAP_TARGET_MEDIAN;
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_transformmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_transformmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_transformmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Grab/Move|G", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBlockBut(block, view3d_transform_moveaxismenu, NULL, ICON_RIGHTARROW_THIN, "Grab/Move on Axis", 0, yco-=20, 120, 19, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Rotate|R", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBlockBut(block, view3d_transform_rotateaxismenu, NULL, ICON_RIGHTARROW_THIN, "Rotate on Axis", 0, yco-=20, 120, 19, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Scale|S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBlockBut(block, view3d_transform_scaleaxismenu, NULL, ICON_RIGHTARROW_THIN, "Scale on Axis", 0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- if (G.obedit) {
- if (G.obedit->type == OB_MESH)
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Shrink/Fatten Along Normals|Alt S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
- else if (G.obedit->type == OB_CURVE) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Tilt|T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Shrink/Fatten Radius|Alt S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 14, "");
- }
- }
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "To Sphere|Ctrl Shift S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
- if (G.obedit) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Shear|Ctrl S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Shear|Ctrl Shift Alt S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Warp|Shift W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Push/Pull|Shift P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
-
- if (!G.obedit) {
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Scale to Image Aspect Ratio|Alt V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- }
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "ObData to Center", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
- if (!G.obedit) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Center New", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Center Cursor", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
- }
-
- if (G.obedit != NULL && G.obedit->type==OB_MESH)
- {
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- if (G.scene->snap_flag & SCE_SNAP)
- {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Grid", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 15, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Snap", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, "");
- }
- else
- {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Grid", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 15, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Snap", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, "");
- }
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- switch(G.scene->snap_target)
- {
- case SCE_SNAP_TARGET_CLOSEST:
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Snap Closest", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 17, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Snap Center", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 18, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Snap Median", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 19, "");
- break;
- case SCE_SNAP_TARGET_CENTER:
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Snap Closest", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 17, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Snap Center", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 18, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Snap Median", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 19, "");
- break;
- case SCE_SNAP_TARGET_MEDIAN:
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Snap Closest", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 17, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Snap Center", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 18, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Snap Median", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 19, "");
- break;
- }
- }
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-void do_view3d_object_mirrormenu(void *arg, int event)
-{
- switch(event) {
- case 1:
- case 2:
- case 3:
- Mirror(event + 3); /* + 3 because the first three modes are global*/
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_object_mirrormenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_object_mirrormenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_object_mirrormenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "X Local|Ctrl M, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Y Local|Ctrl M, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Z Local|Ctrl M, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_view3d_edit_object_transformmenu(void *arg, int event)
-{
- switch(event) {
- case 0: /* clear origin */
- clear_object('o');
- break;
- case 1: /* clear scale */
- clear_object('s');
- break;
- case 2: /* clear rotation */
- clear_object('r');
- break;
- case 3: /* clear location */
- clear_object('g');
- break;
- case 4:
- if(OBACT) object_apply_deform(OBACT);
- break;
- case 5: /* make duplis real */
- make_duplilist_real();
- break;
- case 6: /* apply scale/rotation or deformation */
- apply_object();
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_edit_object_transformmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_object_transformmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_edit_object_transformmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Apply Scale/Rotation|Ctrl A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Apply Deformation|Ctrl Shift A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Duplicates Real|Ctrl Shift A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Location|Alt G", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Rotation|Alt R", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Scale|Alt S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Origin|Alt O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_view3d_edit_object_makelocalmenu(void *arg, int event)
-{
- switch(event) {
- case 1:
- case 2:
- case 3:
- make_local(event);
- break;
- }
-}
-
-static uiBlock *view3d_edit_object_makelocalmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_object_makelocalmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_edit_object_makelocalmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Selected Objects|L, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Selected Objects and Data|L, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "All|L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_view3d_edit_object_makelinksmenu(void *arg, int event)
-{
- switch(event) {
- case 1:
- case 2:
- case 3:
- case 4:
- make_links((short)event);
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_edit_object_makelinksmenu(void *arg_unused)
-{
- Object *ob=NULL;
-
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_object_makelinksmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_edit_object_makelinksmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "To Scene...|Ctrl L, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object Ipo|Ctrl L, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
-
- if ((ob=OBACT)) {
-
- if(ob->type==OB_MESH) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Mesh Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Materials|Ctrl L, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- } else if(ob->type==OB_CURVE) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Curve Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Materials|Ctrl L, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- } else if(ob->type==OB_FONT) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Text Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Materials|Ctrl L, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- } else if(ob->type==OB_SURF) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Surface Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Materials|Ctrl L, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- } else if(ob->type==OB_MBALL) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Materials|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- } else if(ob->type==OB_CAMERA) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Camera Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- } else if(ob->type==OB_LAMP) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Lamp Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- } else if(ob->type==OB_LATTICE) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Lattice Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- } else if(ob->type==OB_ARMATURE) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Armature Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- }
- }
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_view3d_edit_object_singleusermenu(void *arg, int event)
-{
- switch(event) {
- case 1: /* Object */
- single_object_users(1);
- break;
- case 2: /* Object & ObData */
- single_object_users(1);
- single_obdata_users(1);
- break;
- case 3: /* Object & ObData & Materials+Tex */
- single_object_users(1);
- single_obdata_users(1);
- single_mat_users(1); /* also tex */
- break;
- case 4: /* Materials+Tex */
- single_mat_users(1);
- break;
- }
-
- clear_id_newpoins();
- countall();
-
- allqueue(REDRAWALL, 0);
-}
-
-static uiBlock *view3d_edit_object_singleusermenu(void *arg_unused)
-{
-
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_object_singleusermenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_edit_object_singleusermenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object|U, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object & ObData|U, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object & ObData & Materials+Tex|U, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Materials+Tex|U, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_view3d_edit_object_copyattrmenu(void *arg, int event)
-{
- switch(event) {
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- case 8:
- case 9:
- case 10:
- case 11:
- case 17:
- case 18:
- case 19:
- case 20:
- case 21:
- case 22:
- case 23:
- case 24:
- case 25:
- case 26:
- case 29:
- case 30:
- copy_attr((short)event);
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_edit_object_copyattrmenu(void *arg_unused)
-{
- Object *ob=NULL;
-
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_object_copyattrmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_edit_object_copyattrmenu, NULL);
-
- ob= OBACT;
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Location|Ctrl C, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Rotation|Ctrl C, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Size|Ctrl C, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Drawtype|Ctrl C, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Time Offset|Ctrl C, 5", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Dupli|Ctrl C, 6", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Mass|Ctrl C, 7", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Damping|Ctrl C, 8", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Properties|Ctrl C, 9", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Logic Bricks|Ctrl C, 10", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Protected Transform |Ctrl C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 29, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object Constraints|Ctrl C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 22, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "NLA Strips|Ctrl C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 26, "");
-
- if (ob) {
-
- if ((ob->type == OB_MESH) || (ob->type == OB_CURVE) || (ob->type == OB_SURF) ||
- (ob->type == OB_FONT) || (ob->type == OB_MBALL)) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Texture Space|Ctrl C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 17, "");
- }
-
- if(ob->type == OB_FONT) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Font Settings|Ctrl C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 18, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Bevel Settings|Ctrl C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 19, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Curve Resolution|Ctrl C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 25, "");
- }
- if(ob->type == OB_CURVE) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Bevel Settings|Ctrl C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 19, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Curve Resolution|Ctrl C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 25, "");
- }
-
- if(ob->type==OB_MESH) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Subsurf Settings|Ctrl C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 21, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Modifiers ...|Ctrl C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 24, "");
- }
-
- if( give_parteff(ob) ) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Particle Settings|Ctrl C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 20, "");
- }
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object Pass Index|Ctrl C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 30, "");
- }
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-
-static void do_view3d_edit_object_parentmenu(void *arg, int event)
-{
- switch(event) {
- case 0: /* clear parent */
- clear_parent();
- break;
- case 1: /* make parent */
- make_parent();
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_edit_object_parentmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_object_parentmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_edit_object_parentmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Parent...|Ctrl P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Parent...|Alt P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_view3d_edit_object_groupmenu(void *arg, int event)
-{
- switch(event) {
- case 1:
- case 2:
- case 3:
- group_operation(event);
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_edit_object_groupmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_object_groupmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_edit_object_groupmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add to Existing Group|Ctrl G, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add to New Group|Ctrl G, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Remove from All Groups|Ctrl G, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_view3d_edit_object_trackmenu(void *arg, int event)
-{
- switch(event) {
- case 0: /* clear track */
- clear_track();
- break;
- case 1: /* make track */
- make_track();
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_edit_object_trackmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_object_trackmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_edit_object_trackmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Track...|Ctrl T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Track...|Alt T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_view3d_edit_object_constraintsmenu(void *arg, int event)
-{
- switch(event) {
- case 1: /* add constraint */
- add_constraint(0);
- break;
- case 2: /* clear constraint */
- ob_clear_constraints();
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_edit_object_constraintsmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_object_constraintsmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_edit_object_constraintsmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Constraint...|Ctrl Alt C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Constraints", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_view3d_edit_object_showhidemenu(void *arg, int event)
-{
-
- switch(event) {
-
- case 0: /* show objects */
- show_objects();
- break;
- case 1: /* hide selected objects */
- hide_objects(1);
- break;
- case 2: /* hide deselected objects */
- hide_objects(0);
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_edit_object_showhidemenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_object_showhidemenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_edit_object_showhidemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hidden|Alt H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Selected|H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Deselected|Shift H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_view3d_edit_object_scriptsmenu(void *arg, int event)
-{
- BPY_menu_do_python(PYMENU_OBJECT, event);
-
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_edit_object_scriptsmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
- BPyMenu *pym;
- int i = 0;
-
- block= uiNewBlock(&curarea->uiblocks, "v3d_eobject_pymenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_edit_object_scriptsmenu, NULL);
-
- for (pym = BPyMenuTable[PYMENU_OBJECT]; pym; pym = pym->next, i++) {
- uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i, pym->tooltip?pym->tooltip:pym->filename);
- }
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-
-#ifdef WITH_VERSE
-extern ListBase session_list;
-#endif
-
-static void do_view3d_edit_objectmenu(void *arg, int event)
-{
- /* needed to check for valid selected objects */
- Base *base=NULL;
- Object *ob=NULL;
-#ifdef WITH_VERSE
- struct VerseSession *session=NULL;
-#endif
-
- base= BASACT;
- if (base) ob= base->object;
-
- switch(event) {
-
- case 0: /* transform properties*/
- mainqenter(NKEY, 1);
- break;
- case 1: /* delete */
- delete_context_selected();
- break;
- case 2: /* duplicate */
- duplicate_context_selected();
- break;
- case 3: /* duplicate linked */
- adduplicate(0, 0);
- break;
- case 5: /* make single user */
- single_user();
- break;
- case 7: /* boolean operation */
- special_editmenu();
- break;
- case 8: /* join objects */
- join_menu();
- break;
- case 9: /* convert object type */
- convertmenu();
- break;
- case 10: /* move to layer */
- movetolayer();
- break;
- case 11: /* insert keyframe */
- common_insertkey();
- break;
- case 15: /* Object Panel */
- add_blockhandler(curarea, VIEW3D_HANDLER_OBJECT, UI_PNL_UNSTOW);
- break;
-#ifdef WITH_VERSE
- case 16: /* Share Object at Verse server */
- if(session_list.first != session_list.last) session = session_menu();
- else session = session_list.first;
- if(session) b_verse_push_object(session, ob);
- break;
-#endif
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_edit_objectmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_objectmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_view3d_edit_objectmenu, NULL);
-
-#ifdef WITH_VERSE
- if(session_list.first != NULL) {
- Base *base = BASACT;
- Object *ob = NULL;
- if (base) ob= base->object;
-
- if(ob && (ob->type == OB_MESH) && (!ob->vnode)) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Share at Verse Server", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, "");
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- }
- }
-#endif
-
-
- uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Transform Properties|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 15, "");
- uiDefIconTextBlockBut(block, view3d_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, view3d_object_mirrormenu, NULL, ICON_RIGHTARROW_THIN, "Mirror", 0, yco-=20, menuwidth, 19, "");
-
- uiDefIconTextBlockBut(block, view3d_edit_object_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Clear/Apply", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, view3d_edit_snapmenu, NULL, ICON_RIGHTARROW_THIN, "Snap", 0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Insert Keyframe|I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate|Shift D", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate Linked|Alt D", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete|X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, view3d_edit_object_makelinksmenu, NULL, ICON_RIGHTARROW_THIN, "Make Links", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, view3d_edit_object_singleusermenu, NULL, ICON_RIGHTARROW_THIN, "Make Single User", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, view3d_edit_object_makelocalmenu, NULL, ICON_RIGHTARROW_THIN, "Make Local", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, view3d_edit_object_copyattrmenu, NULL, ICON_RIGHTARROW_THIN, "Copy Attributes", 0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, view3d_edit_object_parentmenu, NULL, ICON_RIGHTARROW_THIN, "Parent", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, view3d_edit_object_groupmenu, NULL, ICON_RIGHTARROW_THIN, "Group", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, view3d_edit_object_trackmenu, NULL, ICON_RIGHTARROW_THIN, "Track", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, view3d_edit_object_constraintsmenu, NULL, ICON_RIGHTARROW_THIN, "Constraints", 0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- if (OBACT && OBACT->type == OB_MESH) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Boolean Operation...|W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
- }
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Join Objects|Ctrl J", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Convert Object Type...|Alt C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Move to Layer...|M", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
- uiDefIconTextBlockBut(block, view3d_edit_object_showhidemenu, NULL, ICON_RIGHTARROW_THIN, "Show/Hide Objects", 0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBlockBut(block, view3d_edit_object_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Scripts", 0, yco-=20, 120, 19, "");
-
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- return block;
-}
-
-
-static void do_view3d_edit_propfalloffmenu(void *arg, int event)
-{
-
- G.scene->prop_mode= event;
-
- allqueue(REDRAWVIEW3D, 1);
-}
-
-static uiBlock *view3d_edit_propfalloffmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_propfalloffmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_edit_propfalloffmenu, NULL);
-
- if (G.scene->prop_mode==PROP_SMOOTH) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Smooth|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SMOOTH, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Smooth|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SMOOTH, "");
- if (G.scene->prop_mode==PROP_SPHERE) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Sphere|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SPHERE, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Sphere|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SPHERE, "");
- if (G.scene->prop_mode==PROP_ROOT) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Root|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_ROOT, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Root|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_ROOT, "");
- if (G.scene->prop_mode==PROP_SHARP) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Sharp|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SHARP, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Sharp|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SHARP, "");
- if (G.scene->prop_mode==PROP_LIN) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Linear|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_LIN, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Linear|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_LIN, "");
- if (G.scene->prop_mode==PROP_RANDOM) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Random|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_RANDOM, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Random|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_RANDOM, "");
- if (G.scene->prop_mode==PROP_CONST) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Constant|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_CONST, "");
- else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Constant|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_CONST, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-
-void do_view3d_edit_mesh_verticesmenu(void *arg, int event)
-{
-
- switch(event) {
- int count;
-
- case 0: /* make vertex parent */
- make_parent();
- break;
- case 1: /* remove doubles */
- count= removedoublesflag(1, 0, G.scene->toolsettings->doublimit);
- notice("Removed: %d", count);
- if (count) { /* only undo and redraw if an action is taken */
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- BIF_undo_push("Rem Doubles");
- }
- break;
- case 2: /* smooth */
- vertexsmooth();
- break;
- case 3: /* separate */
- separate_mesh();
- break;
- case 4: /*split */
- split_mesh();
- break;
- case 5: /*merge */
- mergemenu();
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- break;
- case 6: /* add hook */
- add_hook();
- break;
- case 7: /* rip */
- mesh_rip();
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_edit_mesh_verticesmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_mesh_verticesmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_edit_mesh_verticesmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Merge...|Alt M", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Rip|V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Split|Y", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Separate|P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Smooth|W, Alt 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Remove Doubles|W, 6", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Vertex Parent|Ctrl P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Hook|Ctrl H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-extern void editmesh_mark_sharp(int set); /* declared in editmesh_mods.c */
-
-void do_view3d_edit_mesh_edgesmenu(void *arg, int event)
-{
- float fac;
- short randfac;
-
- switch(event) {
-
- case 0: /* subdivide smooth */
- esubdivideflag(1, 0.0, G.scene->toolsettings->editbutflag | B_SMOOTH,1,0);
- BIF_undo_push("Subdivide Smooth");
- break;
- case 1: /*subdivide fractal */
- randfac= 10;
- if(button(&randfac, 1, 100, "Rand fac:")==0) return;
- fac= -( (float)randfac )/100;
- esubdivideflag(1, fac, G.scene->toolsettings->editbutflag,1,0);
- BIF_undo_push("Subdivide Fractal");
- break;
- case 2: /* subdivide */
- esubdivideflag(1, 0.0, G.scene->toolsettings->editbutflag,1,0);
- BIF_undo_push("Subdivide");
- break;
- case 3: /* knife subdivide */
- KnifeSubdivide(KNIFE_PROMPT);
- break;
- case 4: /* Loop subdivide */
- CutEdgeloop(1);
- break;
- case 5: /* Make Edge/Face */
- addedgeface_mesh();
- break;
- case 6:
- bevel_menu();
- break;
- case 7: /* Mark Seam */
- editmesh_mark_seam(0);
- break;
- case 8: /* Clear Seam */
- editmesh_mark_seam(1);
- break;
- case 9: /* Cease SubSurf */
- if(!multires_level1_test()) {
- initTransform(TFM_CREASE, CTX_EDGE);
- Transform();
- }
- break;
- case 10: /* Rotate Edge */
- edge_rotate_selected(2);
- break;
- case 11: /* Rotate Edge */
- edge_rotate_selected(1);
- break;
- case 12: /* Edgeslide */
- EdgeSlide(0,0.0);
- break;
- case 13: /* Edge Loop Delete */
- EdgeLoopDelete();
- break;
- case 14: /*Collapse Edges*/
- collapseEdges();
- BIF_undo_push("Collapse");
- break;
- case 15:
- editmesh_mark_sharp(1);
- BIF_undo_push("Mark Sharp");
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- break;
- case 16:
- editmesh_mark_sharp(0);
- BIF_undo_push("Clear Sharp");
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_edit_mesh_edgesmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_mesh_edgesmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_edit_mesh_edgesmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Edge/Face|F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Bevel|W, Alt 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Loop Subdivide...|Ctrl R", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Knife Subdivide...|Shift K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Subdivide|W, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Subdivide Fractal|W, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Subdivide Smooth|W, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Mark Seam|Ctrl E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Seam|Ctrl E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Mark Sharp|Ctrl E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 15, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Sharp|Ctrl E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, "");
-
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Crease SubSurf|Shift E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Rotate Edge CW|Ctrl E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Rotate Edge CCW|Ctrl E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Slide Edge |Ctrl E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Edge Loop|X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Collapse", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 14, "");
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-void do_view3d_edit_mesh_facesmenu(void *arg, int event)
-{
- switch(event) {
- case 0: /* Fill Faces */
- fill_mesh();
- break;
- case 1: /* Beauty Fill Faces */
- beauty_fill();
- break;
- case 2: /* Quads to Tris */
- convert_to_triface(0);
- allqueue(REDRAWVIEW3D, 0);
- countall();
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- break;
- case 3: /* Tris to Quads */
- join_triangles();
- break;
- case 4: /* Flip triangle edges */
- edge_flip();
- break;
- case 5: /* Make Edge/Face */
- addedgeface_mesh();
- break;
- case 6: /* Set Smooth */
- mesh_set_smooth_faces(1);
- break;
- case 7: /* Set Solid */
- mesh_set_smooth_faces(0);
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_edit_mesh_facesmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_mesh_facesmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_edit_mesh_facesmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Edge/Face|F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Fill|Shift F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Beautify Fill|Alt F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
-
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Convert Quads to Triangles|Ctrl T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Convert Triangles to Quads|Alt J", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Flip Triangle Edges|Ctrl Shift F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Smooth|W, Alt 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Solid|W, Alt 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-void do_view3d_edit_mesh_normalsmenu(void *arg, int event)
-{
- switch(event) {
- case 0: /* flip */
- flip_editnormals();
- break;
- case 1: /* recalculate inside */
- righthandfaces(2);
- break;
- case 2: /* recalculate outside */
- righthandfaces(1);
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_edit_mesh_normalsmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_mesh_normalsmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_edit_mesh_normalsmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Recalculate Outside|Ctrl N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Recalculate Inside|Ctrl Shift N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Flip|W, 0", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-void do_view3d_edit_mirrormenu(void *arg, int event)
-{
- switch(event) {
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- case 8:
- case 9:
- Mirror(event);
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_edit_mirrormenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_mirrormenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_edit_mirrormenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "X Global|Ctrl M, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Y Global|Ctrl M, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Z Global|Ctrl M, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "X Local|Ctrl M, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Y Local|Ctrl M, 5", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Z Local|Ctrl M, 6", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "X View|Ctrl M, 7", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Y View|Ctrl M, 8", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Z View|Ctrl M, 9", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_view3d_edit_mesh_showhidemenu(void *arg, int event)
-{
-
- switch(event) {
-
- case 0: /* show hidden vertices */
- reveal_mesh();
- break;
- case 1: /* hide selected vertices */
- hide_mesh(0);
- break;
- case 2: /* hide deselected vertices */
- hide_mesh(1);
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_edit_mesh_showhidemenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_mesh_showhidemenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_edit_mesh_showhidemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hidden|Alt H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Selected|H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Deselected|Shift H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_view3d_edit_mesh_scriptsmenu(void *arg, int event)
-{
- BPY_menu_do_python(PYMENU_MESH, event);
-
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_edit_mesh_scriptsmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
- BPyMenu *pym;
- int i = 0;
-
- block= uiNewBlock(&curarea->uiblocks, "v3d_emesh_pymenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_edit_mesh_scriptsmenu, NULL);
-
- for (pym = BPyMenuTable[PYMENU_MESH]; pym; pym = pym->next, i++) {
- uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i, pym->tooltip?pym->tooltip:pym->filename);
- }
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-
-static void do_view3d_edit_meshmenu(void *arg, int event)
-{
-#ifdef WITH_VERSE
- struct VerseSession *session;
-#endif
-
- switch(event) {
-
- case 0: /* Undo Editing */
- BIF_undo();
- break;
- case 1: /* Redo Editing */
- BIF_redo();
- break;
- case 2: /* transform properties */
- add_blockhandler(curarea, VIEW3D_HANDLER_OBJECT, 0);
- break;
- case 4: /* insert keyframe */
- common_insertkey();
- break;
- case 5: /* Extrude */
- extrude_mesh();
- break;
- case 6: /* duplicate */
- duplicate_context_selected();
- break;
- case 7: /* make edge face */
- addedgeface_mesh();
- break;
- case 8: /* delete */
- delete_context_selected();
- break;
- case 9: /* Shrink/Fatten Along Normals */
- initTransform(TFM_SHRINKFATTEN, CTX_NONE);
- Transform();
- break;
- case 10: /* Shear */
- initTransform(TFM_SHEAR, CTX_NONE);
- Transform();
- break;
- case 11: /* Warp */
- initTransform(TFM_WARP, CTX_NONE);
- Transform();
- break;
- case 12: /* proportional edit (toggle) */
- if(G.scene->proportional) G.scene->proportional= 0;
- else G.scene->proportional= 1;
- break;
- case 13: /* automerge edit (toggle) */
- if(G.scene->automerge) G.scene->automerge= 0;
- else G.scene->automerge= 1;
- break;
-#ifdef WITH_VERSE
- case 14:
- if(session_list.first != session_list.last) session = session_menu();
- else session = session_list.first;
- if(session) b_verse_push_object(session, G.obedit);
- break;
-#endif
- case 15:
- uv_autocalc_tface();
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_edit_meshmenu(void *arg_unused)
-{
-
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_meshmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_view3d_edit_meshmenu, NULL);
-
-#ifdef WITH_VERSE
- if((session_list.first != NULL) && (!G.obedit->vnode)) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Share at Verse Server",
- 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 14, "");
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- }
-#endif
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Editing|Ctrl Z", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Redo Editing|Ctrl Shift Z", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBlockBut(block, editmode_undohistorymenu, NULL, ICON_RIGHTARROW_THIN, "Undo History", 0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Transform Properties...|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBlockBut(block, view3d_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, view3d_edit_mirrormenu, NULL, ICON_RIGHTARROW_THIN, "Mirror", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, view3d_edit_snapmenu, NULL, ICON_RIGHTARROW_THIN, "Snap", 0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Insert Keyframe|I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "UV Unwrap|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 15, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extrude|E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate|Shift D", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Edge/Face|F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete...|X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, view3d_edit_mesh_verticesmenu, NULL, ICON_RIGHTARROW_THIN, "Vertices", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, view3d_edit_mesh_edgesmenu, NULL, ICON_RIGHTARROW_THIN, "Edges", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, view3d_edit_mesh_facesmenu, NULL, ICON_RIGHTARROW_THIN, "Faces", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, view3d_edit_mesh_normalsmenu, NULL, ICON_RIGHTARROW_THIN, "Normals", 0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
-
-
- if(G.scene->proportional) {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Proportional Editing|O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
- } else {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Proportional Editing|O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
- }
- uiDefIconTextBlockBut(block, view3d_edit_propfalloffmenu, NULL, ICON_RIGHTARROW_THIN, "Proportional Falloff", 0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- if(G.scene->automerge) {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "AutoMerge Editing", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, "");
- } else {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "AutoMerge Editing", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, "");
- }
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, view3d_edit_mesh_showhidemenu, NULL, ICON_RIGHTARROW_THIN, "Show/Hide Vertices", 0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBlockBut(block, view3d_edit_mesh_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Scripts", 0, yco-=20, 120, 19, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- return block;
-}
-
-static void do_view3d_edit_curve_controlpointsmenu(void *arg, int event)
-{
- switch(event) {
- case 0: /* tilt */
- initTransform(TFM_TILT, CTX_NONE);
- Transform();
- break;
- case 1: /* clear tilt */
- clear_tilt();
- break;
- case 2: /* Free */
- sethandlesNurb(3);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- break;
- case 3: /* vector */
- sethandlesNurb(2);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- break;
- case 4: /* smooth */
- sethandlesNurb(1);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- break;
- case 5: /* make vertex parent */
- make_parent();
- break;
- case 6: /* add hook */
- add_hook();
- break;
- case 7:
- separate_nurb();
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_edit_curve_controlpointsmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_curve_controlpointsmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_edit_curve_controlpointsmenu, NULL);
-
- if (OBACT->type == OB_CURVE) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Tilt|T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Tilt|Alt T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Separate|P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Automatic|Shift H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Toggle Free/Aligned|H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Vector|V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- }
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Vertex Parent|Ctrl P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Hook|Ctrl H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-void do_view3d_edit_curve_segmentsmenu(void *arg, int event)
-{
- switch(event) {
- case 0: /* subdivide */
- subdivideNurb();
- break;
- case 1: /* switch direction */
- switchdirectionNurb2();
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_edit_curve_segmentsmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_curve_segmentsmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_edit_curve_segmentsmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Subdivide", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Switch Direction", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-void do_view3d_edit_curve_showhidemenu(void *arg, int event)
-{
- switch(event) {
- case 10: /* show hidden control points */
- revealNurb();
- break;
- case 11: /* hide selected control points */
- hideNurb(0);
- break;
- case 12: /* hide deselected control points */
- hideNurb(1);
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_edit_curve_showhidemenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_curve_showhidemenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_edit_curve_showhidemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hidden|Alt H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Selected|Alt Ctrl H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, "");
- if (OBACT->type == OB_SURF) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Deselected Control Points|Alt Shift H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
-
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-static void do_view3d_edit_curvemenu(void *arg, int event)
-{
- switch(event) {
-
- case 0: /* Undo Editing */
- remake_editNurb();
- break;
- case 1: /* transformation properties */
- mainqenter(NKEY, 1);
- break;
- case 2: /* insert keyframe */
- common_insertkey();
- break;
- case 4: /* extrude */
- if (OBACT->type == OB_CURVE) {
- addvert_Nurb('e');
- } else if (OBACT->type == OB_SURF) {
- extrude_nurb();
- }
- break;
- case 5: /* duplicate */
- duplicate_context_selected();
- break;
- case 6: /* make segment */
- addsegment_nurb();
- break;
- case 7: /* toggle cyclic */
- makecyclicNurb();
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- break;
- case 8: /* delete */
- delete_context_selected();
- break;
- case 9: /* proportional edit (toggle) */
- if(G.scene->proportional) G.scene->proportional= 0;
- else G.scene->proportional= 1;
- break;
- case 13: /* Shear */
- initTransform(TFM_SHEAR, CTX_NONE);
- Transform();
- break;
- case 14: /* Warp */
- initTransform(TFM_WARP, CTX_NONE);
- Transform();
- break;
- case 15:
- uv_autocalc_tface();
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_edit_curvemenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_curvemenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_view3d_edit_curvemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Reload Original|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Transform Properties...|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBlockBut(block, view3d_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, view3d_edit_mirrormenu, NULL, ICON_RIGHTARROW_THIN, "Mirror", 0, yco-=20, menuwidth, 19, "");
- uiDefIconTextBlockBut(block, view3d_edit_snapmenu, NULL, ICON_RIGHTARROW_THIN, "Snap", 0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Insert Keyframe|I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "UV Unwrap|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 15, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extrude|E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate|Shift D", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Segment|F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Toggle Cyclic|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete...|X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, view3d_edit_curve_controlpointsmenu, NULL, ICON_RIGHTARROW_THIN, "Control Points", 0, yco-=20, menuwidth, 19, "");
- uiDefIconTextBlockBut(block, view3d_edit_curve_segmentsmenu, NULL, ICON_RIGHTARROW_THIN, "Segments", 0, yco-=20, menuwidth, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- if(G.scene->proportional) {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Proportional Editing|O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
- } else {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Proportional Editing|O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
- }
- uiDefIconTextBlockBut(block, view3d_edit_propfalloffmenu, NULL, ICON_RIGHTARROW_THIN, "Proportional Falloff", 0, yco-=20, menuwidth, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, view3d_edit_curve_showhidemenu, NULL, ICON_RIGHTARROW_THIN, "Show/Hide Control Points", 0, yco-=20, menuwidth, 19, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- return block;
-}
-
-static void do_view3d_edit_mball_showhidemenu(void *arg, int event)
-{
- switch(event) {
- case 10: /* show hidden control points */
- reveal_mball();
- break;
- case 11: /* hide selected control points */
- hide_mball(0);
- break;
- case 12: /* hide deselected control points */
- hide_mball(1);
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_edit_mball_showhidemenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_mball_showhidemenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_edit_mball_showhidemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hidden|Alt H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Selected|H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Deselected|Shift H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-static void do_view3d_edit_metaballmenu(void *arg, int event)
-{
- switch(event) {
- case 1: /* undo */
- BIF_undo();
- break;
- case 2: /* redo */
- BIF_redo();
- break;
- case 3: /* duplicate */
- duplicate_context_selected();
- break;
- case 4: /* delete */
- delete_context_selected();
- break;
- case 5: /* Shear */
- initTransform(TFM_SHEAR, CTX_NONE);
- Transform();
- break;
- case 6: /* Warp */
- initTransform(TFM_WARP, CTX_NONE);
- Transform();
- break;
- case 7: /* Transform Properties */
- add_blockhandler(curarea, VIEW3D_HANDLER_OBJECT, 0);
- break;
- case 8:
- uv_autocalc_tface();
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_edit_metaballmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_metaballmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_view3d_edit_metaballmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Editing|Ctrl Z", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Redo Editing|Shift Ctrl Z", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBlockBut(block, editmode_undohistorymenu, NULL, ICON_RIGHTARROW_THIN, "Undo History", 0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Transform Properties|N",0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
- uiDefIconTextBlockBut(block, view3d_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, view3d_edit_mirrormenu, NULL, ICON_RIGHTARROW_THIN, "Mirror", 0, yco-=20, menuwidth, 19, "");
- uiDefIconTextBlockBut(block, view3d_edit_snapmenu, NULL, ICON_RIGHTARROW_THIN, "Snap", 0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "UV Unwrap|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate|Shift D", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete...|X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, view3d_edit_mball_showhidemenu, NULL, ICON_RIGHTARROW_THIN, "Hide MetaElems", 0, yco-=20, 120, 19, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- return block;
-}
-
-static void do_view3d_edit_text_charsmenu(void *arg, int event)
-{
- switch(event) {
- case 0: /* copyright */
- do_textedit(0,0,169);
- break;
- case 1: /* registered trademark */
- do_textedit(0,0,174);
- break;
- case 2: /* degree sign */
- do_textedit(0,0,176);
- break;
- case 3: /* Multiplication Sign */
- do_textedit(0,0,215);
- break;
- case 4: /* Circle */
- do_textedit(0,0,138);
- break;
- case 5: /* superscript 1 */
- do_textedit(0,0,185);
- break;
- case 6: /* superscript 2 */
- do_textedit(0,0,178);
- break;
- case 7: /* superscript 3 */
- do_textedit(0,0,179);
- break;
- case 8: /* double >> */
- do_textedit(0,0,187);
- break;
- case 9: /* double << */
- do_textedit(0,0,171);
- break;
- case 10: /* Promillage */
- do_textedit(0,0,139);
- break;
- case 11: /* dutch florin */
- do_textedit(0,0,164);
- break;
- case 12: /* british pound */
- do_textedit(0,0,163);
- break;
- case 13: /* japanese yen*/
- do_textedit(0,0,165);
- break;
- case 14: /* german S */
- do_textedit(0,0,223);
- break;
- case 15: /* spanish question mark */
- do_textedit(0,0,191);
- break;
- case 16: /* spanish exclamation mark */
- do_textedit(0,0,161);
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_edit_text_charsmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_text_charsmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_edit_text_charsmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Copyright|Alt C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Registered Trademark|Alt R", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Degree Sign|Alt G", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Multiplication Sign|Alt x", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Circle|Alt .", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Superscript 1|Alt 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Superscript 2|Alt 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Superscript 3|Alt 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Double >>|Alt >", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Double <<|Alt <", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Promillage|Alt %", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Dutch Florin|Alt F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "British Pound|Alt L", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Japanese Yen|Alt Y", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "German S|Alt S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 14, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Spanish Question Mark|Alt ?", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 15, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Spanish Exclamation Mark|Alt !", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-
-static void do_view3d_edit_textmenu(void *arg, int event)
-{
- switch(event) {
-
- case 0: /* Undo Editing */
- remake_editText();
- break;
- case 1: /* paste from file buffer */
- paste_editText();
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_edit_textmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_textmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_view3d_edit_textmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Editing|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Paste From Buffer File|Alt V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, view3d_edit_text_charsmenu, NULL, ICON_RIGHTARROW_THIN, "Special Characters", 0, yco-=20, 120, 19, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- return block;
-}
-
-static void do_view3d_edit_latticemenu(void *arg, int event)
-{
- switch(event) {
-
- case 0: /* Undo Editing */
- remake_editLatt();
- break;
- case 2: /* insert keyframe */
- common_insertkey();
- break;
- case 3: /* Shear */
- initTransform(TFM_SHEAR, CTX_NONE);
- Transform();
- break;
- case 4: /* Warp */
- initTransform(TFM_WARP, CTX_NONE);
- Transform();
- break;
- case 5: /* proportional edit (toggle) */
- if(G.scene->proportional) G.scene->proportional= 0;
- else G.scene->proportional= 1;
- break;
- case 6:
- uv_autocalc_tface();
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_edit_latticemenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_latticemenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_view3d_edit_latticemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Editing|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, view3d_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, view3d_edit_mirrormenu, NULL, ICON_RIGHTARROW_THIN, "Mirror", 0, yco-=20, menuwidth, 19, "");
- uiDefIconTextBlockBut(block, view3d_edit_snapmenu, NULL, ICON_RIGHTARROW_THIN, "Snap", 0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Insert Keyframe|I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "UV Unwrap|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- if(G.scene->proportional) {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Proportional Editing|O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
- } else {
- uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Proportional Editing|O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
- }
- uiDefIconTextBlockBut(block, view3d_edit_propfalloffmenu, NULL, ICON_RIGHTARROW_THIN, "Proportional Falloff", 0, yco-=20, 120, 19, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- return block;
-}
-
-void do_view3d_edit_armature_parentmenu(void *arg, int event)
-{
- switch(event) {
- case 1:
- make_bone_parent();
- break;
- case 2:
- clear_bone_parent();
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_edit_armature_parentmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_armature_parentmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_edit_armature_parentmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Parent...|Ctrl P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Parent...|Alt P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-void do_view3d_edit_armature_rollmenu(void *arg, int event)
-{
- if (event == 1 || event == 2)
- /* set roll based on aligning z-axis */
- auto_align_armature(event);
- else if (event == 3) {
- /* interactively set bone roll */
- initTransform(TFM_BONE_ROLL, CTX_NONE);
- Transform();
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_edit_armature_rollmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_armature_rollmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_edit_armature_rollmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Roll (Z-Axis Up)|Ctrl N, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Roll to Cursor|Ctrl N, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Roll|Ctrl R", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_view3d_edit_armaturemenu(void *arg, int event)
-{
- static short numcuts= 2;
-
- switch(event) {
-
- case 0: /* Undo Editing */
- remake_editArmature();
- break;
- case 1: /* transformation properties */
- mainqenter(NKEY, 1);
- break;
- case 3: /* extrude */
- extrude_armature(0);
- break;
- case 4: /* duplicate */
- duplicate_context_selected();
- break;
- case 5: /* delete */
- delete_context_selected();
- break;
- case 6: /* Shear */
- initTransform(TFM_SHEAR, CTX_NONE);
- Transform();
- break;
- case 7: /* Warp */
- initTransform(TFM_WARP, CTX_NONE);
- Transform();
- case 10: /* forked! */
- extrude_armature(1);
- break;
- case 12: /* subdivide */
- subdivide_armature(1);
- break;
- case 13: /* flip left and right names */
- armature_flip_names();
- break;
- case 15: /* subdivide multi */
- if(button(&numcuts, 1, 128, "Number of Cuts:")==0) return;
- waitcursor(1);
- subdivide_armature(numcuts);
- break;
- case 16: /* Alt-S transform (BoneSize) */
- initTransform(TFM_BONESIZE, CTX_NONE);
- Transform();
- break;
- case 17: /* move to layer */
- pose_movetolayer();
- break;
- case 18: /* merge bones */
- merge_armature();
- break;
- }
-
- allqueue(REDRAWVIEW3D, 0);
-}
-
-
-
-static void do_view3d_scripts_armaturemenu(void *arg, int event)
-{
- BPY_menu_do_python(PYMENU_SCRIPTTEMPLATE, event);
-
- allqueue(REDRAWIMAGE, 0);
-}
-
-static uiBlock *view3d_scripts_armaturemenu(void *args_unused)
-{
- uiBlock *block;
- BPyMenu *pym;
- int i= 0;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_scripts_armaturemenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_scripts_armaturemenu, NULL);
-
- /* note that we acount for the N previous entries with i+20: */
- for (pym = BPyMenuTable[PYMENU_ARMATURE]; pym; pym = pym->next, i++) {
-
- uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20, menuwidth, 19,
- NULL, 0.0, 0.0, 1, i,
- pym->tooltip?pym->tooltip:pym->filename);
- }
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- return block;
-}
-
-
-static uiBlock *view3d_edit_armaturemenu(void *arg_unused)
-{
- bArmature *arm= G.obedit->data;
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_edit_armaturemenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_view3d_edit_armaturemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Editing|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Transform Properties|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBlockBut(block, view3d_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, view3d_edit_mirrormenu, NULL, ICON_RIGHTARROW_THIN, "Mirror", 0, yco-=20, menuwidth, 19, "");
- uiDefIconTextBlockBut(block, view3d_edit_snapmenu, NULL, ICON_RIGHTARROW_THIN, "Snap", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, view3d_edit_armature_rollmenu, NULL, ICON_RIGHTARROW_THIN, "Bone Roll", 0, yco-=20, 120, 19, "");
-
- if (arm->drawtype==ARM_ENVELOPE)
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Scale Envelope Distance|Alt S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, "");
- else if (arm->drawtype==ARM_B_BONE)
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Scale B-Bone Width|Alt S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extrude|E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- if(arm->flag & ARM_MIRROR_EDIT)
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extrude Forked|Shift E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate|Shift D", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Merge|Alt M", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 18, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Fill Between Joints|F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 18, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete|X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Subdivide|W, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Subdivide Multi|W, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 15, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Flip Left & Right Names|W, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Switch Armature Layers|Shift M", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 17, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Move Bone To Layer|M", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 17, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, view3d_edit_armature_parentmenu, NULL, ICON_RIGHTARROW_THIN, "Parent", 0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, view3d_scripts_armaturemenu, NULL, ICON_RIGHTARROW_THIN, "Scripts", 0, yco-=20, 120, 19, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-static void do_view3d_pose_armature_transformmenu(void *arg, int event)
-{
- Object *ob= OBACT;
-
- switch(event) {
- case 0: /* clear origin */
- clear_object('o');
- break;
- case 1: /* clear scale */
- clear_object('s');
- break;
- case 2: /* clear rotation */
- clear_object('r');
- break;
- case 3: /* clear location */
- clear_object('g');
- break;
- case 4: /* clear user transform */
- rest_pose(ob->pose);
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- BIF_undo_push("Pose, Clear User Transform");
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_pose_armature_transformmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_pose_armature_transformmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_pose_armature_transformmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear User Transform|W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Location|Alt G", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Rotation|Alt R", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Scale|Alt S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Origin|Alt O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_view3d_pose_armature_showhidemenu(void *arg, int event)
-{
-
- switch(event) {
-
- case 0: /* show hidden bones */
- show_all_pose_bones();
- break;
- case 1: /* hide selected bones */
- hide_selected_pose_bones();
- break;
- case 2: /* hide deselected bones */
- hide_unselected_pose_bones();
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_pose_armature_showhidemenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_pose_armature_showhidemenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_pose_armature_showhidemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hidden|Alt H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Selected|H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Deselected|Shift H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_view3d_pose_armature_ikmenu(void *arg, int event)
-{
-
- switch(event) {
-
- case 1:
- pose_add_IK();
- break;
- case 2:
- pose_clear_IK();
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_pose_armature_ikmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_pose_armature_ikmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_pose_armature_ikmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add IK to Bone...|Ctrl I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear IK...|Alt I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_view3d_pose_armature_constraintsmenu(void *arg, int event)
-{
-
- switch(event) {
-
- case 1:
- add_constraint(0);
- break;
- case 2:
- pose_clear_constraints();
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_pose_armature_constraintsmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_pose_armature_constraintsmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_pose_armature_constraintsmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Constraint to Bone...|Ctrl Alt C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Constraints...|Alt C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_view3d_pose_armature_motionpathsmenu(void *arg, int event)
-{
-
- switch(event) {
-
- case 1:
- pose_calculate_path(OBACT);
- break;
- case 2:
- pose_clear_paths(OBACT);
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_pose_armature_motionpathsmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_pose_armature_motionpathsmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_pose_armature_motionpathsmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Calculate Paths|W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear All Paths|W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_view3d_pose_armaturemenu(void *arg, int event)
-{
- Object *ob;
- ob=OBACT;
-
- switch(event) {
-
- case 0: /* transform properties */
- mainqenter(NKEY, 1);
- break;
- case 1: /* copy current pose */
- copy_posebuf();
- break;
- case 2: /* paste pose */
- paste_posebuf(0);
- break;
- case 3: /* paste flipped pose */
- paste_posebuf(1);
- break;
- case 4: /* insert keyframe */
- common_insertkey();
- break;
- case 5:
- pose_copy_menu();
- break;
- case 9:
- pose_flip_names();
- break;
- case 13:
- if(ob && (ob->flag & OB_POSEMODE)) {
- bArmature *arm= ob->data;
- if( (arm->drawtype == ARM_B_BONE) || (arm->drawtype == ARM_ENVELOPE)) {
- initTransform(TFM_BONESIZE, CTX_NONE);
- Transform();
- break;
- }
- }
- break;
- case 14: /* move bone to layer / change armature layer */
- pose_movetolayer();
- break;
- case 15:
- pose_relax();
- break;
- }
-
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_pose_armaturemenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_pose_armaturemenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_view3d_pose_armaturemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Transform Properties|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefIconTextBlockBut(block, view3d_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, view3d_pose_armature_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Clear Transform", 0, yco-=20, 120, 19, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Scale Envelope Distance|Alt S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Insert Keyframe|I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Relax Pose|W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 15, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Copy Current Pose", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Paste Pose", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Paste Flipped Pose", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, view3d_pose_armature_motionpathsmenu, NULL, ICON_RIGHTARROW_THIN, "Motion Paths", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, view3d_pose_armature_ikmenu, NULL, ICON_RIGHTARROW_THIN, "Inverse Kinematics", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, view3d_pose_armature_constraintsmenu, NULL, ICON_RIGHTARROW_THIN, "Constraints", 0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Flip L/R Names|W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Copy Attributes...|Ctrl C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Switch Armature Layers|Shift M", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 14, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Move Bone To Layer|M", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 14, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, view3d_pose_armature_showhidemenu,
- NULL, ICON_RIGHTARROW_THIN, "Show/Hide Bones", 0, yco-=20, 120, 19, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-/* vertex paint menu */
-static void do_view3d_vpaintmenu(void *arg, int event)
-{
- /* events >= 2 are registered bpython scripts */
- if (event >= 2) BPY_menu_do_python(PYMENU_VERTEXPAINT, event - 2);
-
- switch(event) {
- case 0: /* undo vertex painting */
- BIF_undo();
- break;
- case 1: /* set vertex colors/weight */
- if(FACESEL_PAINT_TEST)
- clear_vpaint_selectedfaces();
- else /* we know were in vertex paint mode */
- clear_vpaint();
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_vpaintmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
- BPyMenu *pym;
- int i=0;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_paintmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_view3d_vpaintmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Vertex Painting|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Vertex Colors|Shift K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
-
- /* note that we account for the 2 previous entries with i+2:
- even if the last item isnt displayed, it dosent matter */
- for (pym = BPyMenuTable[PYMENU_VERTEXPAINT]; pym; pym = pym->next, i++) {
- uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, i+2,
- pym->tooltip?pym->tooltip:pym->filename);
- }
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- return block;
-}
-
-
-/* texture paint menu (placeholder, no items yet??) */
-static void do_view3d_tpaintmenu(void *arg, int event)
-{
- switch(event) {
- case 0: /* undo image painting */
- imagepaint_undo();
- break;
- }
-
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_tpaintmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_paintmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_view3d_tpaintmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Texture Painting|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- return block;
-}
-
-
-static void do_view3d_wpaintmenu(void *arg, int event)
-{
- Object *ob= OBACT;
-
- /* events >= 3 are registered bpython scripts */
- if (event >= 4) BPY_menu_do_python(PYMENU_WEIGHTPAINT, event - 4);
-
- switch(event) {
- case 0: /* undo weight painting */
- BIF_undo();
- break;
- case 1: /* set vertex colors/weight */
- clear_wpaint_selectedfaces();
- break;
- case 2: /* vgroups from envelopes */
- pose_adds_vgroups(ob, 0);
- break;
- case 3: /* vgroups from bone heat */
- pose_adds_vgroups(ob, 1);
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_wpaintmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120, menunr=1;
- BPyMenu *pym;
- int i=0;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_paintmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_view3d_wpaintmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Weight Painting|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Apply Bone Heat Weights to Vertex Groups|W, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Apply Bone Envelopes to Vertex Groups|W, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- if (FACESEL_PAINT_TEST) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Weight|Shift K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- menunr++;
- }
-
- /* note that we account for the 4 previous entries with i+4:
- even if the last item isnt displayed, it dosent matter */
- for (pym = BPyMenuTable[PYMENU_WEIGHTPAINT]; pym; pym = pym->next, i++) {
- uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, i+4,
- pym->tooltip?pym->tooltip:pym->filename);
- }
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- return block;
-}
-
-void do_view3d_sculpt_inputmenu(void *arg, int event)
-{
- SculptData *sd= &G.scene->sculptdata;
- short val;
-
- switch(event) {
- case 0:
- sd->flags ^= SCULPT_INPUT_SMOOTH;
- break;
- case 1:
- val= sd->tablet_size;
- if(button(&val,0,10,"Tablet Size:")==0) return;
- sd->tablet_size= val;
- break;
- case 2:
- val= sd->tablet_strength;
- if(button(&val,0,10,"Tablet Strength:")==0) return;
- sd->tablet_strength= val;
- break;
- }
-
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWVIEW3D, 0);
-}
-
-void do_view3d_sculptmenu(void *arg, int event)
-{
- SculptData *sd= &G.scene->sculptdata;
- BrushData *br= sculptmode_brush();
- switch(event) {
- case 0:
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- sd->brush_type= event+1;
- break;
- case 7:
- br->airbrush= !br->airbrush; break;
- case 8:
- sd->symm ^= SYMM_X; break;
- case 9:
- sd->symm ^= SYMM_Y; break;
- case 10:
- sd->symm ^= SYMM_Z; break;
- case 11:
- if(G.vd)
- G.vd->pivot_last= !G.vd->pivot_last;
- break;
- case 12:
- sd->flags ^= SCULPT_DRAW_FAST;
- break;
- case 13:
- sd->flags ^= SCULPT_DRAW_BRUSH;
- break;
- case 14:
- add_blockhandler(curarea, VIEW3D_HANDLER_OBJECT, UI_PNL_UNSTOW);
- break;
- case 15:
- sculptmode_propset_init(PropsetTexRot);
- break;
- case 16:
- sculptmode_propset_init(PropsetStrength);
- break;
- case 17:
- sculptmode_propset_init(PropsetSize);
- break;
- case 18:
- br->dir= br->dir==1 ? 2 : 1; break;
- }
-
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWVIEW3D, 0);
-}
-
-uiBlock *view3d_sculpt_inputmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth= 120;
- SculptData *sd= &G.scene->sculptdata;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_sculpt_inputmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_sculpt_inputmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ((sd->flags & SCULPT_INPUT_SMOOTH) ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Smooth Stroke", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Tablet Size Adjust", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Tablet Strength Adjust", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 50);
- return block;
-}
-
-uiBlock *view3d_sculptmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth= 120;
- SculptData *sd= &G.scene->sculptdata;
- const BrushData *br= sculptmode_brush();
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_sculptmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_view3d_sculptmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Sculpt Properties|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 14, "");
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBlockBut(block, view3d_sculpt_inputmenu, NULL, ICON_RIGHTARROW_THIN, "Input Settings", 0, yco-=20, 120, 19, "");
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ((sd->flags & SCULPT_DRAW_BRUSH) ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Display Brush", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, "");
- uiDefIconTextBut(block, BUTM, 1, ((sd->flags & SCULPT_DRAW_FAST) ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Partial Redraw", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
- if(G.vd)
- uiDefIconTextBut(block, BUTM, 1, (G.vd->pivot_last ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Pivot Last", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Scale Brush|F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 17, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Strengthen Brush|Shift F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Rotate Brush|Ctrl F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 15, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, (sd->symm & SYMM_Z ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Z Symmetry|Z", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
- uiDefIconTextBut(block, BUTM, 1, (sd->symm & SYMM_Y ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Y Symmetry|Y", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
- uiDefIconTextBut(block, BUTM, 1, (sd->symm & SYMM_X ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "X Symmetry|X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
-
- if(sd->brush_type!=GRAB_BRUSH) {
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, (br->airbrush ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Airbrush|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
-
- if(sd->brush_type!=SMOOTH_BRUSH && sd->brush_type!=FLATTEN_BRUSH) {
- uiDefIconTextBut(block, BUTM, 1, (br->dir==1 ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Add|V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 18, "");
- }
- }
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, (sd->brush_type==FLATTEN_BRUSH ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Flatten|T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
- uiDefIconTextBut(block, BUTM, 1, (sd->brush_type==LAYER_BRUSH ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Layer|L", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
- uiDefIconTextBut(block, BUTM, 1, (sd->brush_type==GRAB_BRUSH ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Grab|G", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- uiDefIconTextBut(block, BUTM, 1, (sd->brush_type==INFLATE_BRUSH ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Inflate|I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, (sd->brush_type==PINCH_BRUSH ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Pinch|P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, (sd->brush_type==SMOOTH_BRUSH ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Smooth|S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, (sd->brush_type==DRAW_BRUSH ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Draw|D", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-static void do_view3d_facesel_showhidemenu(void *arg, int event)
-{
- switch(event) {
- case 4: /* show hidden faces */
- reveal_tface();
- break;
- case 5: /* hide selected faces */
- hide_tface();
- break;
- case 6: /* hide deselected faces */
- G.qual |= LR_SHIFTKEY;
- hide_tface();
- G.qual &= ~LR_SHIFTKEY;
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_facesel_showhidemenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_facesel_showhidemenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_facesel_showhidemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hidden Faces|Alt H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Selected Faces|H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Deselected Faces|Shift H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_view3d_faceselmenu(void *arg, int event)
-{
- switch(event) {
- case 0: /* set vertex colors */
- clear_vpaint_selectedfaces();
- break;
- case 1: /* mark border seam */
- seam_mark_clear_tface(1);
- break;
- case 2: /* clear seam */
- seam_mark_clear_tface(2);
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIMAGE, 0);
-}
-
-static uiBlock *view3d_faceselmenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_faceselmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_view3d_faceselmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Vertex Colors|Shift K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Seam|Ctrl E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Mark Border Seam|Ctrl E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, view3d_facesel_showhidemenu, NULL, ICON_RIGHTARROW_THIN, "Show/Hide Faces", 0, yco-=20, 120, 19, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- return block;
-}
-
-void do_view3d_select_particlemenu(void *arg, int event)
-{
- /* events >= 6 are registered bpython scripts */
- if (event >= 6) BPY_menu_do_python(PYMENU_FACESELECT, event - 6);
-
- switch(event) {
- case 0:
- PE_borderselect();
- break;
- case 1:
- PE_deselectall();
- break;
- case 2:
- PE_select_root();
- break;
- case 3:
- PE_select_tip();
- break;
- case 4:
- PE_select_more();
- break;
- case 5:
- PE_select_less();
- break;
- case 7:
- PE_select_linked();
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_select_particlemenu(void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_select_particlemenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_view3d_select_particlemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B",
- 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiDefBut(block, SEPR, 0, "",
- 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A",
- 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Linked|L",
- 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Last|W, 4",
- 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select First|W, 3",
- 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiDefBut(block, SEPR, 0, "",
- 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "More|Ctrl NumPad +",
- 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Less|Ctrl NumPad -",
- 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
-
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- return block;
-}
-
-void do_view3d_particle_showhidemenu(void *arg, int event)
-{
- switch(event) {
- case 1: /* show hidden */
- PE_hide(0);
- break;
- case 2: /* hide selected */
- PE_hide(2);
- break;
- case 3: /* hide deselected */
- PE_hide(1);
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static uiBlock *view3d_particle_showhidemenu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_particle_showhidemenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetButmFunc(block, do_view3d_particle_showhidemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hidden|Alt H",
- 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Selected|H",
- 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Deselected|Shift H",
- 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-void do_view3d_particlemenu(void *arg, int event)
-{
- ParticleEditSettings *pset= PE_settings();
-
- switch(event) {
- case 1:
- add_blockhandler(curarea, VIEW3D_HANDLER_OBJECT, UI_PNL_UNSTOW);
- break;
- case 2:
- if(button(&pset->totrekey, 2, 100, "Number of Keys:")==0) return;
- PE_rekey();
- break;
- case 3:
- PE_subdivide();
- break;
- case 4:
- PE_delete_particle();
- break;
- case 5:
- PE_mirror_x(0);
- break;
- case 6:
- pset->flag ^= PE_X_MIRROR;
- break;
- case 7:
- PE_remove_doubles();
- break;
- }
-
- allqueue(REDRAWVIEW3D, 0);
-}
-
-uiBlock *view3d_particlemenu(void *arg_unused)
-{
- uiBlock *block;
- ParticleEditSettings *pset= PE_settings();
- short yco= 0, menuwidth= 120;
-
- block= uiNewBlock(&curarea->uiblocks, "view3d_particlemenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_view3d_particlemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Particle Edit Properties|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, (pset->flag & PE_X_MIRROR)? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT, "X-Axis Mirror Editing", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Mirror|Ctrl M", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Remove Doubles|W, 5", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete...|X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- if(G.scene->selectmode & SCE_SELECT_POINT)
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Subdivide|W, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Rekey|W, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, view3d_particle_showhidemenu, NULL, ICON_RIGHTARROW_THIN, "Show/Hide Particles", 0, yco-=20, menuwidth, 19, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
-
- return block;
-}
-
-
-static char *view3d_modeselect_pup(void)
-{
- Object *ob= OBACT;
- static char string[1024];
- static char formatstr[] = "|%s %%x%d %%i%d";
- char *str = string;
-
- str += sprintf(str, "Mode: %%t");
-
- str += sprintf(str, formatstr, "Object Mode", V3D_OBJECTMODE_SEL, ICON_OBJECT);
-
- if(ob==NULL) return string;
-
- /* if active object is editable */
- if ( ((ob->type == OB_MESH) || (ob->type == OB_ARMATURE)
- || (ob->type == OB_CURVE) || (ob->type == OB_SURF) || (ob->type == OB_FONT)
- || (ob->type == OB_MBALL) || (ob->type == OB_LATTICE))) {
-
- str += sprintf(str, formatstr, "Edit Mode", V3D_EDITMODE_SEL, ICON_EDITMODE_HLT);
- }
-
- if (ob->type == OB_MESH) {
-
- str += sprintf(str, formatstr, "Sculpt Mode", V3D_SCULPTMODE_SEL, ICON_SCULPTMODE_HLT);
- /*str += sprintf(str, formatstr, "Face Select", V3D_FACESELECTMODE_SEL, ICON_FACESEL_HLT);*/
- str += sprintf(str, formatstr, "Vertex Paint", V3D_VERTEXPAINTMODE_SEL, ICON_VPAINT_HLT);
- str += sprintf(str, formatstr, "Texture Paint", V3D_TEXTUREPAINTMODE_SEL, ICON_TPAINT_HLT);
- str += sprintf(str, formatstr, "Weight Paint", V3D_WEIGHTPAINTMODE_SEL, ICON_WPAINT_HLT);
- }
-
-
- /* if active object is an armature */
- if (ob->type==OB_ARMATURE) {
- str += sprintf(str, formatstr, "Pose Mode", V3D_POSEMODE_SEL, ICON_POSE_HLT);
- }
-
- if (ob->particlesystem.first) {
- str += sprintf(str, formatstr, "Particle Mode", V3D_PARTICLEEDITMODE_SEL, ICON_PHYSICS);
- }
-
- return (string);
-}
-
-
-static char *drawtype_pup(void)
-{
- static char string[512];
- char *str = string;
-
- str += sprintf(str, "%s", "Draw type: %t");
- str += sprintf(str, "%s", "|Bounding Box %x1");
- str += sprintf(str, "%s", "|Wireframe %x2");
- str += sprintf(str, "%s", "|Solid %x3");
- str += sprintf(str, "%s", "|Shaded %x4");
- str += sprintf(str, "%s", "|Textured %x5");
- return string;
-}
-static char *around_pup(void)
-{
- static char string[512];
- char *str = string;
-
- str += sprintf(str, "%s", "Pivot: %t");
- str += sprintf(str, "%s", "|Bounding Box Center %x0");
- str += sprintf(str, "%s", "|Median Point %x3");
- str += sprintf(str, "%s", "|3D Cursor %x1");
- str += sprintf(str, "%s", "|Individual Centers %x2");
- if ((G.obedit) && (G.obedit->type == OB_MESH))
- str += sprintf(str, "%s", "|Active Vert/Edge/Face %x4");
- else
- str += sprintf(str, "%s", "|Active Object %x4");
- return string;
-}
-
-static char *propfalloff_pup(void)
-{
- static char string[512];
- char *str = string;
-
- str += sprintf(str, "%s", "Falloff: %t");
- str += sprintf(str, "%s", "|Smooth Falloff%x0");
- str += sprintf(str, "%s", "|Sphere Falloff%x1");
- str += sprintf(str, "%s", "|Root Falloff%x2");
- str += sprintf(str, "%s", "|Sharp Falloff%x3");
- str += sprintf(str, "%s", "|Linear Falloff%x4");
- str += sprintf(str, "%s", "|Random Falloff%x6");
- str += sprintf(str, "%s", "|Constant, No Falloff%x5");
- return string;
-}
-
-
-void do_view3d_buttons(short event)
-{
- Object *ob= OBACT;
- int bit;
-
- /* watch it: if curarea->win does not exist, check that when calling direct drawing routines */
-
- switch(event) {
- case B_HOME:
- view3d_home(0);
- break;
- case B_SCENELOCK:
- if(G.vd->scenelock) {
- G.vd->lay= G.scene->lay;
- /* seek for layact */
- bit= 0;
- while(bit<32) {
- if(G.vd->lay & (1<<bit)) {
- G.vd->layact= 1<<bit;
- break;
- }
- bit++;
- }
- G.vd->camera= G.scene->camera;
- scrarea_queue_winredraw(curarea);
- scrarea_queue_headredraw(curarea);
- }
- break;
-
- case B_LOCALVIEW:
- if(G.vd->localview) initlocalview();
- else {
- endlocalview(curarea);
- /* new layers might need unflushed events events */
- DAG_scene_update_flags(G.scene, G.vd->lay); /* tags all that moves and flushes*/
- }
- scrarea_queue_headredraw(curarea);
- break;
-
- case B_VIEWBUT:
-
- if(G.vd->viewbut==1) persptoetsen(PAD7);
- else if(G.vd->viewbut==2) persptoetsen(PAD1);
- else if(G.vd->viewbut==3) persptoetsen(PAD3);
- break;
-
- case B_PERSP:
-
- if(G.vd->persp==2) persptoetsen(PAD0);
- else {
- G.vd->persp= 1-G.vd->persp;
- persptoetsen(PAD5);
- }
-
- break;
- case B_PROPTOOL:
- allqueue(REDRAWHEADERS, 0);
- break;
- case B_VIEWRENDER:
- if (curarea->spacetype==SPACE_VIEW3D) {
- BIF_do_ogl_render(curarea->spacedata.first, G.qual!=0 );
- }
- break;
- case B_STARTGAME:
- if (select_area(SPACE_VIEW3D)) {
- start_game();
- }
- break;
- case B_MODESELECT:
- if (G.vd->modeselect == V3D_OBJECTMODE_SEL) {
-
- G.vd->flag &= ~V3D_MODE;
- exit_paint_modes();
- if(ob) exit_posemode(); /* exit posemode for active object */
- if(G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */
- }
- else if (G.vd->modeselect == V3D_EDITMODE_SEL) {
- if(!G.obedit) {
- G.vd->flag &= ~V3D_MODE;
- exit_paint_modes();
- enter_editmode(EM_WAITCURSOR);
- BIF_undo_push("Original"); /* here, because all over code enter_editmode is abused */
- }
- }
- else if (G.vd->modeselect == V3D_SCULPTMODE_SEL) {
- if (!(G.f & G_SCULPTMODE)) {
- G.vd->flag &= ~V3D_MODE;
- exit_paint_modes();
- if(G.obedit) exit_editmode(2); /* exit editmode and undo */
-
- set_sculptmode();
- }
- }
- else if (G.vd->modeselect == V3D_VERTEXPAINTMODE_SEL) {
- if (!(G.f & G_VERTEXPAINT)) {
- G.vd->flag &= ~V3D_MODE;
- exit_paint_modes();
- if(G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */
-
- set_vpaint();
- }
- }
- else if (G.vd->modeselect == V3D_TEXTUREPAINTMODE_SEL) {
- if (!(G.f & G_TEXTUREPAINT)) {
- G.vd->flag &= ~V3D_MODE;
- exit_paint_modes();
- if(G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */
-
- set_texturepaint();
- }
- }
- else if (G.vd->modeselect == V3D_WEIGHTPAINTMODE_SEL) {
- if (!(G.f & G_WEIGHTPAINT) && (ob && ob->type == OB_MESH) ) {
- G.vd->flag &= ~V3D_MODE;
- exit_paint_modes();
- if(G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */
-
- set_wpaint();
- }
- }
- else if (G.vd->modeselect == V3D_POSEMODE_SEL) {
-
- if (ob) {
- G.vd->flag &= ~V3D_MODE;
- if(G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */
-
- enter_posemode();
- }
- }
- else if(G.vd->modeselect == V3D_PARTICLEEDITMODE_SEL){
- if (!(G.f & G_PARTICLEEDIT)) {
- G.vd->flag &= ~V3D_MODE;
- exit_paint_modes();
- if(G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */
-
- PE_set_particle_edit();
- }
- }
- allqueue(REDRAWVIEW3D, 1);
- break;
-
- case B_AROUND:
- handle_view3d_around(); /* copies to other 3d windows */
- allqueue(REDRAWVIEW3D, 1);
- break;
-
- case B_SEL_VERT:
- if( (G.qual & LR_SHIFTKEY)==0 || G.scene->selectmode==0)
- G.scene->selectmode= SCE_SELECT_VERTEX;
- EM_selectmode_set();
- countall();
- BIF_undo_push("Selectmode Set: Vertex");
- allqueue(REDRAWVIEW3D, 1);
- allqueue(REDRAWIMAGE, 0); /* only needed in cases where mesh and UV selection are in sync */
- break;
- case B_SEL_EDGE:
- if( (G.qual & LR_SHIFTKEY)==0 || G.scene->selectmode==0){
- if( (G.scene->selectmode ^ SCE_SELECT_EDGE) == SCE_SELECT_VERTEX){
- if(G.qual==LR_CTRLKEY) EM_convertsel(SCE_SELECT_VERTEX,SCE_SELECT_EDGE);
- }
- G.scene->selectmode = SCE_SELECT_EDGE;
- }
- EM_selectmode_set();
- countall();
- BIF_undo_push("Selectmode Set: Edge");
- allqueue(REDRAWVIEW3D, 1);
- allqueue(REDRAWIMAGE, 0); /* only needed in cases where mesh and UV selection are in sync */
- break;
- case B_SEL_FACE:
- if( (G.qual & LR_SHIFTKEY)==0 || G.scene->selectmode==0){
- if( ((G.scene->selectmode ^ SCE_SELECT_FACE) == SCE_SELECT_VERTEX) || ((G.scene->selectmode ^ SCE_SELECT_FACE) == SCE_SELECT_EDGE)){
- if(G.qual==LR_CTRLKEY) EM_convertsel((G.scene->selectmode ^ SCE_SELECT_FACE),SCE_SELECT_FACE);
- }
- G.scene->selectmode = SCE_SELECT_FACE;
- }
- EM_selectmode_set();
- countall();
- BIF_undo_push("Selectmode Set: Face");
- allqueue(REDRAWVIEW3D, 1);
- allqueue(REDRAWIMAGE, 0); /* only needed in cases where mesh and UV selection are in sync */
- break;
-
- case B_SEL_PATH:
- G.scene->selectmode= SCE_SELECT_PATH;
- BIF_undo_push("Selectmode Set: Path");
- allqueue(REDRAWVIEW3D, 1);
- break;
- case B_SEL_POINT:
- G.scene->selectmode = SCE_SELECT_POINT;
- BIF_undo_push("Selectmode Set: Point");
- allqueue(REDRAWVIEW3D, 1);
- break;
- case B_SEL_END:
- G.scene->selectmode = SCE_SELECT_END;
- BIF_undo_push("Selectmode Set: End point");
- allqueue(REDRAWVIEW3D, 1);
- break;
-
- case B_MAN_TRANS:
- if( (G.qual & LR_SHIFTKEY)==0 || G.vd->twtype==0)
- G.vd->twtype= V3D_MANIP_TRANSLATE;
- allqueue(REDRAWVIEW3D, 1);
- break;
- case B_MAN_ROT:
- if( (G.qual & LR_SHIFTKEY)==0 || G.vd->twtype==0)
- G.vd->twtype= V3D_MANIP_ROTATE;
- allqueue(REDRAWVIEW3D, 1);
- break;
- case B_MAN_SCALE:
- if( (G.qual & LR_SHIFTKEY)==0 || G.vd->twtype==0)
- G.vd->twtype= V3D_MANIP_SCALE;
- allqueue(REDRAWVIEW3D, 1);
- break;
-
- default:
-
- if(event>=B_LAY && event<B_LAY+31) {
- if(G.vd->lay!=0 && (G.qual & LR_SHIFTKEY)) {
-
- /* but do find active layer */
-
- bit= event-B_LAY;
- if( G.vd->lay & (1<<bit)) G.vd->layact= 1<<bit;
- else {
- if( (G.vd->lay & G.vd->layact) == 0) {
- bit= 0;
- while(bit<32) {
- if(G.vd->lay & (1<<bit)) {
- G.vd->layact= 1<<bit;
- break;
- }
- bit++;
- }
- }
- }
- }
- else {
- bit= event-B_LAY;
- G.vd->lay= 1<<bit;
- G.vd->layact= G.vd->lay;
- scrarea_queue_headredraw(curarea);
- }
-
- if(G.vd->scenelock) handle_view3d_lock();
-
- scrarea_queue_winredraw(curarea);
- countall();
-
- /* new layers might need unflushed events events */
- DAG_scene_update_flags(G.scene, G.vd->lay); /* tags all that moves and flushes */
-
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWNLA, 0);
- }
- break;
- }
-}
-
-static void view3d_header_pulldowns(uiBlock *block, short *xcoord)
-{
- Object *ob= OBACT;
- short xmax, xco= *xcoord;
-
- /* pull down menus */
- uiBlockSetEmboss(block, UI_EMBOSSP);
-
- /* compensate for local mode when setting up the viewing menu/iconrow values */
- if(G.vd->view==7) G.vd->viewbut= 1;
- else if(G.vd->view==1) G.vd->viewbut= 2;
- else if(G.vd->view==3) G.vd->viewbut= 3;
- else G.vd->viewbut= 0;
-
-
- /* the 'xmax - 3' rather than xmax is to prevent some weird flickering where the highlighted
- * menu is drawn wider than it should be. The ypos of -2 is to make it properly fill the
- * height of the header */
-
- xmax= GetButStringLength("View");
- uiDefPulldownBut(block, view3d_viewmenu, NULL, "View", xco, -2, xmax-3, 24, "");
- xco+= xmax;
-
- xmax= GetButStringLength("Select");
- if (G.obedit) {
- if (ob && ob->type == OB_MESH) {
- uiDefPulldownBut(block, view3d_select_meshmenu, NULL, "Select", xco,-2, xmax-3, 24, "");
- } else if (ob && (ob->type == OB_CURVE || ob->type == OB_SURF)) {
- uiDefPulldownBut(block, view3d_select_curvemenu, NULL, "Select", xco,-2, xmax-3, 24, "");
- } else if (ob && ob->type == OB_FONT) {
- uiDefPulldownBut(block, view3d_select_meshmenu, NULL, "Select", xco, -2, xmax-3, 24, "");
- } else if (ob && ob->type == OB_MBALL) {
- uiDefPulldownBut(block, view3d_select_metaballmenu, NULL, "Select", xco,-2, xmax-3, 24, "");
- } else if (ob && ob->type == OB_LATTICE) {
- uiDefPulldownBut(block, view3d_select_latticemenu, NULL, "Select", xco,-2, xmax-3, 24, "");
- } else if (ob && ob->type == OB_ARMATURE) {
- uiDefPulldownBut(block, view3d_select_armaturemenu, NULL, "Select", xco,-2, xmax-3, 24, "");
- }
- } else if (FACESEL_PAINT_TEST) {
- if (ob && ob->type == OB_MESH) {
- uiDefPulldownBut(block, view3d_select_faceselmenu, NULL, "Select", xco,-2, xmax-3, 24, "");
- }
- } else if ((G.f & G_VERTEXPAINT) || (G.f & G_TEXTUREPAINT) || (G.f & G_WEIGHTPAINT)) {
- uiDefBut(block, LABEL,0,"", xco, 0, xmax, 20, 0, 0, 0, 0, 0, "");
- } else if (G.f & G_PARTICLEEDIT) {
- uiDefPulldownBut(block, view3d_select_particlemenu, NULL, "Select", xco,-2, xmax-3, 24, "");
- } else {
-
- if (ob && (ob->flag & OB_POSEMODE))
- uiDefPulldownBut(block, view3d_select_pose_armaturemenu, NULL, "Select", xco,-2, xmax-3, 24, "");
- else
- uiDefPulldownBut(block, view3d_select_objectmenu, NULL, "Select", xco,-2, xmax-3, 24, "");
- }
- xco+= xmax;
-
- if (G.obedit) {
- if (ob && ob->type == OB_MESH) {
- xmax= GetButStringLength("Mesh");
- uiDefPulldownBut(block, view3d_edit_meshmenu, NULL, "Mesh", xco,-2, xmax-3, 24, "");
- xco+= xmax;
- } else if (ob && ob->type == OB_CURVE) {
- xmax= GetButStringLength("Curve");
- uiDefPulldownBut(block, view3d_edit_curvemenu, NULL, "Curve", xco,-2, xmax-3, 24, "");
- xco+= xmax;
- } else if (ob && ob->type == OB_SURF) {
- xmax= GetButStringLength("Surface");
- uiDefPulldownBut(block, view3d_edit_curvemenu, NULL, "Surface", xco,-2, xmax-3, 24, "");
- xco+= xmax;
- } else if (ob && ob->type == OB_FONT) {
- xmax= GetButStringLength("Text");
- uiDefPulldownBut(block, view3d_edit_textmenu, NULL, "Text", xco,-2, xmax-3, 24, "");
- xco+= xmax;
- } else if (ob && ob->type == OB_MBALL) {
- xmax= GetButStringLength("Metaball");
- uiDefPulldownBut(block, view3d_edit_metaballmenu, NULL, "Metaball", xco,-2, xmax-3, 24, "");
- xco+= xmax;
- } else if (ob && ob->type == OB_LATTICE) {
- xmax= GetButStringLength("Lattice");
- uiDefPulldownBut(block, view3d_edit_latticemenu, NULL, "Lattice", xco,-2, xmax-3, 24, "");
- xco+= xmax;
- } else if (ob && ob->type == OB_ARMATURE) {
- xmax= GetButStringLength("Armature");
- uiDefPulldownBut(block, view3d_edit_armaturemenu, NULL, "Armature", xco,-2, xmax-3, 24, "");
- xco+= xmax;
- }
-
- }
- else if (G.f & G_WEIGHTPAINT) {
- xmax= GetButStringLength("Paint");
- uiDefPulldownBut(block, view3d_wpaintmenu, NULL, "Paint", xco,-2, xmax-3, 24, "");
- xco+= xmax;
- }
- else if (G.f & G_VERTEXPAINT) {
- xmax= GetButStringLength("Paint");
- uiDefPulldownBut(block, view3d_vpaintmenu, NULL, "Paint", xco,-2, xmax-3, 24, "");
- xco+= xmax;
- }
- else if (G.f & G_TEXTUREPAINT) {
- xmax= GetButStringLength("Paint");
- uiDefPulldownBut(block, view3d_tpaintmenu, NULL, "Paint", xco,-2, xmax-3, 24, "");
- xco+= xmax;
- }
- else if( G.f & G_SCULPTMODE) {
- xmax= GetButStringLength("Sculpt");
- uiDefPulldownBut(block, view3d_sculptmenu, NULL, "Sculpt", xco, -2, xmax-3, 24, "");
- xco+= xmax;
- }
- else if (FACESEL_PAINT_TEST) {
- if (ob && ob->type == OB_MESH) {
- xmax= GetButStringLength("Face");
- uiDefPulldownBut(block, view3d_faceselmenu, NULL, "Face", xco,-2, xmax-3, 24, "");
- xco+= xmax;
- }
- }
- else if(G.f & G_PARTICLEEDIT) {
- xmax= GetButStringLength("Particle");
- uiDefPulldownBut(block, view3d_particlemenu, NULL, "Particle", xco,-2, xmax-3, 24, "");
- xco+= xmax;
- }
- else {
- if (ob && (ob->flag & OB_POSEMODE)) {
- xmax= GetButStringLength("Pose");
- uiDefPulldownBut(block, view3d_pose_armaturemenu, NULL, "Pose", xco,-2, xmax-3, 24, "");
- xco+= xmax;
- }
- else {
- xmax= GetButStringLength("Object");
- uiDefPulldownBut(block, view3d_edit_objectmenu, NULL, "Object", xco,-2, xmax-3, 24, "");
- xco+= xmax;
- }
- }
-
- *xcoord= xco;
-}
-
-void view3d_buttons(void)
-{
- uiBlock *block;
- Object *ob= OBACT;
- int a;
- short xco = 0;
-
- block= uiNewBlock(&curarea->uiblocks, "header view3d", UI_EMBOSS, UI_HELV, curarea->headwin);
-
- if(area_is_active_area(curarea)) uiBlockSetCol(block, TH_HEADER);
- else uiBlockSetCol(block, TH_HEADERDESEL);
-
- curarea->butspacetype= SPACE_VIEW3D;
-
- xco = 8;
- uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D, windowtype_pup(), xco,0,XIC+10,YIC, &(curarea->butspacetype), 1.0, SPACEICONMAX, 0, 0, "Displays Current Window Type. Click for menu of available types.");
- xco+= XIC+14;
-
- uiBlockSetEmboss(block, UI_EMBOSSN);
- if(curarea->flag & HEADER_NO_PULLDOWN) {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, B_FLIPINFOMENU, ICON_DISCLOSURE_TRI_RIGHT,
- xco,2,XIC,YIC-2,
- &(curarea->flag), 0, 0, 0, 0, "Enables display of pulldown menus");
- } else {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, B_FLIPINFOMENU, ICON_DISCLOSURE_TRI_DOWN,
- xco,2,XIC,YIC-2,
- &(curarea->flag), 0, 0, 0, 0, "Hides pulldown menus");
- }
- uiBlockSetEmboss(block, UI_EMBOSS);
- xco+=XIC;
-
- if((curarea->flag & HEADER_NO_PULLDOWN)==0)
- view3d_header_pulldowns(block, &xco);
-
- /* other buttons: */
- uiBlockSetEmboss(block, UI_EMBOSS);
-
- /* mode */
- G.vd->modeselect = V3D_OBJECTMODE_SEL;
-
- if (G.obedit) G.vd->modeselect = V3D_EDITMODE_SEL;
- else if(ob && (ob->flag & OB_POSEMODE)) G.vd->modeselect = V3D_POSEMODE_SEL;
- else if (G.f & G_SCULPTMODE) G.vd->modeselect = V3D_SCULPTMODE_SEL;
- else if (G.f & G_WEIGHTPAINT) G.vd->modeselect = V3D_WEIGHTPAINTMODE_SEL;
- else if (G.f & G_VERTEXPAINT) G.vd->modeselect = V3D_VERTEXPAINTMODE_SEL;
- else if (G.f & G_TEXTUREPAINT) G.vd->modeselect = V3D_TEXTUREPAINTMODE_SEL;
- /*else if(G.f & G_FACESELECT) G.vd->modeselect = V3D_FACESELECTMODE_SEL;*/
- else if(G.f & G_PARTICLEEDIT) G.vd->modeselect = V3D_PARTICLEEDITMODE_SEL;
-
- G.vd->flag &= ~V3D_MODE;
-
- /* not sure what the G.vd->flag is useful for now... modeselect is confusing */
- if(G.obedit) G.vd->flag |= V3D_EDITMODE;
- if(ob && (ob->flag & OB_POSEMODE)) G.vd->flag |= V3D_POSEMODE;
- if(G.f & G_VERTEXPAINT) G.vd->flag |= V3D_VERTEXPAINT;
- if(G.f & G_WEIGHTPAINT) G.vd->flag |= V3D_WEIGHTPAINT;
- if (G.f & G_TEXTUREPAINT) G.vd->flag |= V3D_TEXTUREPAINT;
- if(FACESEL_PAINT_TEST) G.vd->flag |= V3D_FACESELECT;
-
- uiDefIconTextButS(block, MENU, B_MODESELECT, (G.vd->modeselect),view3d_modeselect_pup() ,
- xco,0,126,20, &(G.vd->modeselect), 0, 0, 0, 0, "Mode (Hotkeys: Tab, V, Ctrl Tab)");
-
- xco+= 126+8;
-
- /* DRAWTYPE */
- uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_BBOX, drawtype_pup(), xco,0,XIC+10,YIC, &(G.vd->drawtype), 1.0, 5.0, 0, 0, "Viewport Shading (Hotkeys: Z, Shift Z, Ctrl Z, Alt Z");
-
- /* around */
- xco+= XIC+18;
-
- uiBlockBeginAlign(block);
-
- if(retopo_mesh_paint_check()) {
- RetopoPaintData *rpd= get_retopo_paint_data();
- if(rpd) {
- ToolSettings *ts= G.scene->toolsettings;
-
- uiDefButC(block,ROW,B_REDR,"Pen",xco,0,40,20,&ts->retopo_paint_tool,6.0,RETOPO_PEN,0,0,"");
- xco+=40;
- uiDefButC(block,ROW,B_REDR,"Line",xco,0,40,20,&ts->retopo_paint_tool,6.0,RETOPO_LINE,0,0,"");
- xco+=40;
- uiDefButC(block,ROW,B_REDR,"Ellipse",xco,0,60,20,&ts->retopo_paint_tool,6.0,RETOPO_ELLIPSE,0,0,"");
- xco+=65;
-
- uiBlockBeginAlign(block);
- if(ts->retopo_paint_tool == RETOPO_PEN) {
- uiDefButC(block,TOG,B_NOP,"Hotspot",xco,0,60,20, &ts->retopo_hotspot, 0,0,0,0,"Show hotspots at line ends to allow line continuation");
- xco+=80;
- }
- else if(ts->retopo_paint_tool == RETOPO_LINE) {
- uiDefButC(block,NUM,B_NOP,"LineDiv",xco,0,80,20,&ts->line_div,1,50,0,0,"Subdivisions per retopo line");
- xco+=80;
- }
- else if(ts->retopo_paint_tool == RETOPO_ELLIPSE) {
- uiDefButC(block,NUM,B_NOP,"EllDiv",xco,0,80,20,&ts->ellipse_div,3,50,0,0,"Subdivisions per retopo ellipse");
- xco+=80;
- }
- xco+=5;
-
- uiBlockEndAlign(block);
- }
- } else {
- if (G.obedit==NULL && (G.f & (G_VERTEXPAINT|G_WEIGHTPAINT|G_TEXTUREPAINT|G_SCULPTMODE))) {
- uiDefIconButBitI(block, TOG, G_FACESELECT, B_REDR, ICON_FACESEL_HLT,xco,0,XIC,YIC, &G.f, 0, 0, 0, 0, "Painting Mask (FKey)");
- xco+= XIC+10;
- } else {
- /* Manipulators arnt used in weight paint mode */
- uiDefIconTextButS(block, ICONTEXTROW,B_AROUND, ICON_ROTATE, around_pup(), xco,0,XIC+10,YIC, &(G.vd->around), 0, 3.0, 0, 0, "Rotation/Scaling Pivot (Hotkeys: Comma, Shift Comma, Period, Ctrl Period, Alt Period)");
-
- xco+= XIC+10;
-
- uiDefIconButBitS(block, TOG, V3D_ALIGN, B_AROUND, ICON_ALIGN,
- xco,0,XIC,YIC,
- &G.vd->flag, 0, 0, 0, 0, "Move object centers only");
- uiBlockEndAlign(block);
-
- xco+= XIC+8;
-
- /* Transform widget / manipulators */
- uiBlockBeginAlign(block);
- uiDefIconButBitS(block, TOG, V3D_USE_MANIPULATOR, B_REDR, ICON_MANIPUL,xco,0,XIC,YIC, &G.vd->twflag, 0, 0, 0, 0, "Use 3d transform manipulator (Ctrl Space)");
- xco+= XIC;
-
- if(G.vd->twflag & V3D_USE_MANIPULATOR) {
- uiDefIconButBitS(block, TOG, V3D_MANIP_TRANSLATE, B_MAN_TRANS, ICON_MAN_TRANS, xco,0,XIC,YIC, &G.vd->twtype, 1.0, 0.0, 0, 0, "Translate manipulator mode (Ctrl Alt G)");
- xco+= XIC;
- uiDefIconButBitS(block, TOG, V3D_MANIP_ROTATE, B_MAN_ROT, ICON_MAN_ROT, xco,0,XIC,YIC, &G.vd->twtype, 1.0, 0.0, 0, 0, "Rotate manipulator mode (Ctrl Alt R)");
- xco+= XIC;
- uiDefIconButBitS(block, TOG, V3D_MANIP_SCALE, B_MAN_SCALE, ICON_MAN_SCALE, xco,0,XIC,YIC, &G.vd->twtype, 1.0, 0.0, 0, 0, "Scale manipulator mode (Ctrl Alt S)");
- xco+= XIC;
- }
- uiDefButS(block, MENU, B_NOP, "Orientation%t|Global%x0|Local%x1|Normal%x2|View%x3",xco,0,70,YIC, &G.vd->twmode, 0, 0, 0, 0, "Transform Orientation (Alt Space)");
- xco+= 70;
- uiBlockEndAlign(block);
- xco+= 8;
- }
-
- /* LAYERS */
- if(G.obedit==NULL && G.vd->localview==0) {
- uiBlockBeginAlign(block);
- for(a=0; a<5; a++)
- uiDefButBitI(block, TOG, 1<<a, B_LAY+a, "", (short)(xco+a*(XIC/2)), (short)(YIC/2),(short)(XIC/2),(short)(YIC/2), &(G.vd->lay), 0, 0, 0, 0, "Toggles Layer visibility (Num, Shift Num)");
- for(a=0; a<5; a++)
- uiDefButBitI(block, TOG, 1<<(a+10), B_LAY+10+a, "",(short)(xco+a*(XIC/2)), 0, XIC/2, (YIC)/2, &(G.vd->lay), 0, 0, 0, 0, "Toggles Layer visibility (Alt Num, Alt Shift Num)");
-
- xco+= 5;
- uiBlockBeginAlign(block);
- for(a=5; a<10; a++)
- uiDefButBitI(block, TOG, 1<<a, B_LAY+a, "", (short)(xco+a*(XIC/2)), (short)(YIC/2),(short)(XIC/2),(short)(YIC/2), &(G.vd->lay), 0, 0, 0, 0, "Toggles Layer visibility (Num, Shift Num)");
- for(a=5; a<10; a++)
- uiDefButBitI(block, TOG, 1<<(a+10), B_LAY+10+a, "",(short)(xco+a*(XIC/2)), 0, XIC/2, (YIC)/2, &(G.vd->lay), 0, 0, 0, 0, "Toggles Layer visibility (Alt Num, Alt Shift Num)");
-
- uiBlockEndAlign(block);
-
- xco+= (a-2)*(XIC/2)+3;
-
- /* LOCK */
- uiDefIconButS(block, ICONTOG, B_SCENELOCK, ICON_UNLOCKED, xco+=XIC,0,XIC,YIC, &(G.vd->scenelock), 0, 0, 0, 0, "Locks Active Camera and layers to Scene (Ctrl `)");
- xco+= XIC+10;
-
- }
-
- /* proportional falloff */
- if((G.obedit && (G.obedit->type == OB_MESH || G.obedit->type == OB_CURVE || G.obedit->type == OB_SURF || G.obedit->type == OB_LATTICE)) || G.f & G_PARTICLEEDIT) {
-
- uiBlockBeginAlign(block);
- uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_PROP_OFF, "Proportional %t|Off %x0|On %x1|Connected %x2", xco,0,XIC+10,YIC, &(G.scene->proportional), 0, 1.0, 0, 0, "Proportional Edit Falloff (Hotkeys: O, Alt O) ");
- xco+= XIC+10;
-
- if(G.scene->proportional) {
- uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_SMOOTHCURVE, propfalloff_pup(), xco,0,XIC+10,YIC, &(G.scene->prop_mode), 0.0, 0.0, 0, 0, "Proportional Edit Falloff (Hotkey: Shift O) ");
- xco+= XIC+10;
- }
- xco+= 10;
- }
-
- /* Snap */
- if(G.obedit && (G.obedit->type == OB_MESH)) { // Only Mesh for now
- uiBlockBeginAlign(block);
-
- if (G.scene->snap_flag & SCE_SNAP) {
- uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEO,xco,0,XIC,YIC, &G.scene->snap_flag, 0, 0, 0, 0, "Use Snap or Grid (Shift Tab)");
- xco+= XIC;
- uiDefButS(block, MENU, B_NOP, "Mode%t|Closest%x0|Center%x1|Median%x2",xco,0,70,YIC, &G.scene->snap_target, 0, 0, 0, 0, "Snap Target Mode");
- xco+= 70;
- } else {
- uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEAR,xco,0,XIC,YIC, &G.scene->snap_flag, 0, 0, 0, 0, "Snap while Ctrl is held during transform (Shift Tab)");
- xco+= XIC;
- }
-
- uiBlockEndAlign(block);
- xco+= 10;
- }
-
- /* selection modus */
- if(G.obedit && (G.obedit->type == OB_MESH)) {
- uiBlockBeginAlign(block);
- uiDefIconButBitS(block, TOG, SCE_SELECT_VERTEX, B_SEL_VERT, ICON_VERTEXSEL, xco,0,XIC,YIC, &G.scene->selectmode, 1.0, 0.0, 0, 0, "Vertex select mode (Ctrl Tab 1)");
- xco+= XIC;
- uiDefIconButBitS(block, TOG, SCE_SELECT_EDGE, B_SEL_EDGE, ICON_EDGESEL, xco,0,XIC,YIC, &G.scene->selectmode, 1.0, 0.0, 0, 0, "Edge select mode (Ctrl Tab 2)");
- xco+= XIC;
- uiDefIconButBitS(block, TOG, SCE_SELECT_FACE, B_SEL_FACE, ICON_FACESEL, xco,0,XIC,YIC, &G.scene->selectmode, 1.0, 0.0, 0, 0, "Face select mode (Ctrl Tab 3)");
- xco+= XIC;
- uiBlockEndAlign(block);
- if(G.vd->drawtype > OB_WIRE) {
- uiDefIconButBitS(block, TOG, V3D_ZBUF_SELECT, B_REDR, ICON_ORTHO, xco,0,XIC,YIC, &G.vd->flag, 1.0, 0.0, 0, 0, "Occlude background geometry");
- xco+= XIC;
- }
- xco+= 20;
- }
- else if(G.f & G_PARTICLEEDIT) {
- uiBlockBeginAlign(block);
- uiDefIconButBitS(block, TOG, SCE_SELECT_PATH, B_SEL_PATH, ICON_EDGESEL, xco,0,XIC,YIC, &G.scene->selectmode, 1.0, 0.0, 0, 0, "Path edit mode (Ctrl Tab 1)");
- xco+= XIC;
- uiDefIconButBitS(block, TOG, SCE_SELECT_POINT, B_SEL_POINT, ICON_VERTEXSEL, xco,0,XIC,YIC, &G.scene->selectmode, 1.0, 0.0, 0, 0, "Point select mode (Ctrl Tab 2)");
- xco+= XIC;
- uiDefIconButBitS(block, TOG, SCE_SELECT_END, B_SEL_END, ICON_FACESEL, xco,0,XIC,YIC, &G.scene->selectmode, 1.0, 0.0, 0, 0, "Tip select mode (Ctrl Tab 3)");
- xco+= XIC;
- uiBlockEndAlign(block);
- if(G.vd->drawtype > OB_WIRE) {
- uiDefIconButBitS(block, TOG, V3D_ZBUF_SELECT, B_REDR, ICON_ORTHO, xco,0,XIC,YIC, &G.vd->flag, 1.0, 0.0, 0, 0, "Limit selection to visible (clipped with depth buffer)");
- xco+= XIC;
- }
- xco+= 20;
- }
-
- uiDefIconBut(block, BUT, B_VIEWRENDER, ICON_SCENE_DEHLT, xco,0,XIC,YIC, NULL, 0, 1.0, 0, 0, "Render this window (hold CTRL for anim)");
-
- if (ob && (ob->flag & OB_POSEMODE)) {
- xco+= XIC/2;
- uiBlockBeginAlign(block);
- if(curarea->headertype==HEADERTOP) {
- uiDefIconBut(block, BUT, B_ACTCOPY, ICON_COPYUP,
- xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0,
- "Copies the current pose to the buffer");
- uiDefIconBut(block, BUT, B_ACTPASTE, ICON_PASTEUP,
- xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0,
- "Pastes the pose from the buffer");
- uiDefIconBut(block, BUT, B_ACTPASTEFLIP, ICON_PASTEFLIPUP,
- xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0,
- "Pastes the mirrored pose from the buffer");
- }
- else {
- uiDefIconBut(block, BUT, B_ACTCOPY, ICON_COPYDOWN,
- xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0,
- "Copies the current pose to the buffer");
- uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
- uiDefIconBut(block, BUT, B_ACTPASTE, ICON_PASTEDOWN,
- xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0,
- "Pastes the pose from the buffer");
- uiDefIconBut(block, BUT, B_ACTPASTEFLIP, ICON_PASTEFLIPDOWN,
- xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0,
- "Pastes the mirrored pose from the buffer");
- }
- uiBlockEndAlign(block);
- }
- }
-
- /* Always do this last */
- curarea->headbutlen= xco+2*XIC;
-
- uiDrawBlock(block);
-
-}
diff --git a/source/blender/src/headerbuttons.c b/source/blender/src/headerbuttons.c
deleted file mode 100644
index 505206ed6e0..00000000000
--- a/source/blender/src/headerbuttons.c
+++ /dev/null
@@ -1,2091 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#include <sys/types.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "BMF_Api.h"
-#include "BIF_language.h"
-#ifdef INTERNATIONAL
-#include "FTF_Api.h"
-#endif
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_storage_types.h"
-
-#include "IMB_imbuf_types.h"
-#include "IMB_imbuf.h"
-
-#include "DNA_ID.h"
-#include "DNA_action_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_brush_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_group_types.h"
-#include "DNA_image_types.h"
-#include "DNA_ipo_types.h"
-#include "DNA_key_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_lattice_types.h"
-#include "DNA_material_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meta_types.h"
-#include "DNA_object_types.h"
-#include "DNA_oops_types.h"
-#include "DNA_packedFile_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_sequence_types.h"
-#include "DNA_sound_types.h"
-#include "DNA_space_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_text_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_view2d_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_world_types.h"
-#include "DNA_constraint_types.h"
-
-#include "BKE_utildefines.h"
-
-#include "BKE_action.h"
-#include "BKE_armature.h"
-#include "BKE_blender.h"
-#include "BKE_brush.h"
-#include "BKE_constraint.h"
-#include "BKE_curve.h"
-#include "BKE_depsgraph.h"
-#include "BKE_exotic.h"
-#include "BKE_global.h"
-#include "BKE_image.h"
-#include "BKE_ipo.h"
-#include "BKE_key.h"
-#include "BKE_lattice.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
-#include "BKE_material.h"
-#include "BKE_mball.h"
-#include "BKE_mesh.h"
-#include "BKE_node.h"
-#include "BKE_object.h"
-#include "BKE_packedFile.h"
-#include "BKE_sca.h"
-#include "BKE_scene.h"
-#include "BKE_texture.h"
-#include "BKE_text.h"
-#include "BKE_world.h"
-
-#include "BLO_readfile.h"
-#include "BLO_writefile.h"
-
-#include "BIF_drawimage.h"
-#include "BIF_drawoops.h"
-#include "BIF_drawscene.h"
-#include "BIF_drawtext.h"
-#include "BIF_editaction.h"
-#include "BIF_editarmature.h"
-#include "BIF_editfont.h"
-#include "BIF_editlattice.h"
-#include "BIF_editconstraint.h"
-#include "BIF_editmesh.h"
-#include "BIF_editmesh.h"
-#include "BIF_editsima.h"
-#include "BIF_editsound.h"
-#include "BIF_gl.h"
-#include "BIF_imasel.h"
-#include "BIF_interface.h"
-#include "BIF_mainqueue.h"
-#include "BIF_mywindow.h"
-#include "BIF_poseobject.h"
-#include "BIF_renderwin.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toets.h"
-#include "BIF_toolbox.h"
-#include "BIF_usiblender.h"
-#include "BIF_previewrender.h"
-#include "BIF_writeimage.h"
-#include "BIF_butspace.h"
-
-#include "BPI_script.h"
-
-#include "BSE_edit.h"
-#include "BSE_filesel.h"
-#include "BSE_headerbuttons.h"
-#include "BSE_node.h"
-#include "BSE_view.h"
-#include "BSE_sequence.h"
-#include "BSE_editipo.h"
-#include "BSE_drawipo.h"
-
-#include "BDR_drawmesh.h"
-#include "BDR_vpaint.h"
-#include "BDR_editface.h"
-#include "BDR_editobject.h"
-#include "BDR_editcurve.h"
-#include "BDR_editmball.h"
-#include "BDR_sculptmode.h"
-
-#include "BPY_extern.h"
-#include "BPY_menus.h"
-
-#include "mydevice.h"
-#include "blendef.h"
-#include "interface.h"
-#include "nla.h" /* __NLA : To be removed later */
-#include "butspace.h" // test_idbutton
-
-#include "BIF_poseobject.h"
-
-#include "SYS_System.h"
-
- /* WATCH IT: always give all headerbuttons for same window the same name
- * event B_REDR is a standard redraw
- *
- */
-
-char *windowtype_pup(void)
-{
- return(
- "Window type:%t" //14
- "|3D View %x1" //30
-
- "|%l" // 33
-
- "|Ipo Curve Editor %x2" //54
- "|Action Editor %x12" //73
- "|NLA Editor %x13" //94
-
- "|%l" //97
-
- "|UV/Image Editor %x6" //117
-
- "|Video Sequence Editor %x8" //143
- "|Timeline %x15" //163
- "|Audio Window %x11" //163
- "|Text Editor %x9" //179
-
- "|%l" //192
-
-
- "|User Preferences %x7" //213
- "|Outliner %x3" //232
- "|Buttons Window %x4" //251
- "|Node Editor %x16"
- "|%l" //254
-
- "|Image Browser %x10" //273
- "|File Browser %x5" //290
-
- "|%l" //293
-
- "|Scripts Window %x14"//313
- );
-}
-
-int GetButStringLength(char *str) {
- int rt;
-
- rt= BIF_GetStringWidth(G.font, str, (U.transopts & USER_TR_BUTTONS));
-
- return rt + 15;
-}
-
-/* ********************** GLOBAL ****************************** */
-
-int std_libbuttons(uiBlock *block, short xco, short yco,
- int pin, short *pinpoin, int browse, short id_code, short special, ID *id,
- ID *parid, short *menupoin, int users, int lib,
- int del, int autobut, int keepbut)
-{
- ListBase *lb;
- uiBut *but;
- int len, oldcol, add_addbutton=0;
- char *str=NULL, str1[10];
-
- uiBlockBeginAlign(block);
- oldcol= uiBlockGetCol(block);
-
- if(id && pin) {
- uiDefIconButS(block, ICONTOG, pin, ICON_PIN_DEHLT, xco,yco,XIC,YIC, pinpoin, 0, 0, 0, 0, "Keeps this view displaying the current data regardless of what object is selected");
- xco+= XIC;
- }
- /* browse menu */
- if(browse) {
- char *extrastr= NULL;
-
- if(ELEM4(id_code, ID_MA, ID_TE, ID_BR, ID_PA)) add_addbutton= 1;
-
- lb= wich_libbase(G.main, id_code);
-
- if(id && id->us>1) uiBlockSetCol(block, TH_BUT_SETTING1);
-
- if (pin && *pinpoin) {
- uiBlockSetCol(block, TH_BUT_SETTING2);
- }
-
- if (ELEM8( id_code, ID_SCE, ID_SCR, ID_MA, ID_TE, ID_WO, ID_IP, ID_AC, ID_BR) || id_code == ID_PA) extrastr= "ADD NEW %x 32767";
- else if (id_code==ID_TXT) extrastr= "OPEN NEW %x 32766 |ADD NEW %x 32767";
- else if (id_code==ID_SO) extrastr= "OPEN NEW %x 32766";
-
- uiSetButLock(G.scene->id.lib!=0, ERROR_LIBDATA_MESSAGE);
- if( id_code==ID_SCE || id_code==ID_SCR ) uiClearButLock();
-
- if(curarea->spacetype==SPACE_BUTS)
- uiSetButLock(id_code!=ID_SCR && G.obedit!=0 && G.buts->mainb==CONTEXT_EDITING, "Cannot perform in EditMode");
-
- if(parid) uiSetButLock(parid->lib!=0, ERROR_LIBDATA_MESSAGE);
-
- if (lb) {
- if( id_code==ID_IP)
- IPOnames_to_pupstring(&str, NULL, extrastr, lb, id, menupoin, G.sipo->blocktype);
- else if(browse!=B_SIMABROWSE && id_code==ID_IM )
- IMAnames_to_pupstring(&str, NULL, extrastr, lb, id, menupoin);
- else
- IDnames_to_pupstring(&str, NULL, extrastr, lb, id, menupoin);
- }
-
- uiDefButS(block, MENU, browse, str, xco,yco,XIC,YIC, menupoin, 0, 0, 0, 0, "Browses existing choices or adds NEW");
- xco+= XIC;
-
- uiClearButLock();
-
- MEM_freeN(str);
- }
-
- uiBlockSetCol(block, oldcol);
-
- if(id) { /* text button with name */
-
- /* name */
- if(id->us>1) uiBlockSetCol(block, TH_BUT_SETTING1);
- /* Pinned data ? */
- if (pin && *pinpoin) {
- uiBlockSetCol(block, TH_BUT_SETTING2);
- }
- /* Redalert overrides pin color */
- if(id->us<=0) uiBlockSetCol(block, TH_REDALERT);
-
- uiSetButLock(id->lib!=0, ERROR_LIBDATA_MESSAGE);
-
- if(GS(id->name)==ID_SCE) strcpy(str1, "SCE:");
- else if(GS(id->name)==ID_SCE) strcpy(str1, "SCR:");
- else if(GS(id->name)==ID_MA) {
- if( ((Material *)id)->use_nodes )
- strcpy(str1, "NT:");
- else
- strcpy(str1, "MA:");
- }
- else {
- str1[0]= id->name[0];
- str1[1]= id->name[1];
- str1[2]= ':';
- str1[3]= 0;
- }
-
- if( GS(id->name)==ID_IP) len= 110;
- else if(yco) len= 140; // comes from button panel
- else len= 120;
-
- but= uiDefBut(block, TEX, B_IDNAME, str1,xco, yco, (short)len, YIC, id->name+2, 0.0, 21.0, 0, 0, "Displays current Datablock name. Click to change.");
- uiButSetFunc(but, test_idbutton_cb, id->name, NULL);
-
- uiClearButLock();
-
- xco+= len;
-
- if(id->lib) {
-
- if(id->flag & LIB_INDIRECT) uiDefIconBut(block, BUT, 0, ICON_DATALIB,xco,yco,XIC,YIC, 0, 0, 0, 0, 0, "Indirect Library Datablock. Cannot change.");
- else uiDefIconBut(block, BUT, lib, ICON_PARLIB, xco,yco,XIC,YIC, 0, 0, 0, 0, 0,
- lib?"Direct linked Library Datablock. Click to make local.":"Direct linked Library Datablock, cannot make local."
- );
-
- xco+= XIC;
- }
-
-
- if(users && id->us>1) {
- uiSetButLock (pin && *pinpoin, "Can't make pinned data single-user");
-
- sprintf(str1, "%d", id->us);
- if(id->us<10) {
-
- uiDefBut(block, BUT, users, str1, xco,yco,XIC,YIC, 0, 0, 0, 0, 0, "Displays number of users of this data. Click to make a single-user copy.");
- xco+= XIC;
- }
- else {
- uiDefBut(block, BUT, users, str1, xco, yco, XIC+10, YIC, 0, 0, 0, 0, 0, "Displays number of users of this data. Click to make a single-user copy.");
- xco+= XIC+10;
- }
-
- uiClearButLock();
-
- }
-
- if(del) {
-
- uiSetButLock (pin && *pinpoin, "Can't unlink pinned data");
- if(parid && parid->lib);
- else {
- uiDefIconBut(block, BUT, del, ICON_X, xco,yco,XIC,YIC, 0, 0, 0, 0, 0, "Deletes link to this Datablock");
- xco+= XIC;
- }
-
- uiClearButLock();
- }
-
- if(autobut) {
- if(parid && parid->lib);
- else {
- uiDefIconBut(block, BUT, autobut, ICON_AUTO,xco,yco,XIC,YIC, 0, 0, 0, 0, 0, "Generates an automatic name");
- xco+= XIC;
- }
-
-
- }
- if(keepbut) {
- uiDefBut(block, BUT, keepbut, "F", xco,yco,XIC,YIC, 0, 0, 0, 0, 0, "Saves this datablock even if it has no users");
- xco+= XIC;
- }
- }
- else if(add_addbutton) { /* "add new" button */
- uiBlockSetCol(block, oldcol);
- uiDefButS(block, TOG, browse, "Add New" ,xco, yco, 110, YIC, menupoin, (float)*menupoin, 32767.0, 0, 0, "Add new data block");
- xco+= 110;
- }
- //xco+=XIC;
-
- uiBlockSetCol(block, oldcol);
- uiBlockEndAlign(block);
-
- return xco;
-}
-
-
-/* results in fully updated anim system */
-static void do_update_for_newframe(int mute, int events)
-{
- extern void audiostream_scrub(unsigned int frame); /* seqaudio.c */
-
- if(events) {
- allqueue(REDRAWALL, 0);
- }
-
- /* this function applies the changes too */
- scene_update_for_newframe(G.scene, screen_view3d_layers()); /* BKE_scene.h */
-
- if ( (CFRA>1) && (!mute) && (G.scene->audio.flag & AUDIO_SCRUB))
- audiostream_scrub( CFRA );
-
- /* 3d window, preview */
- BIF_view3d_previewrender_signal(curarea, PR_DBASE|PR_DISPRECT);
-
- /* all movie/sequence images */
- BIF_image_update_frame();
-
- /* composite */
- if(G.scene->use_nodes && G.scene->nodetree)
- ntreeCompositTagAnimated(G.scene->nodetree);
-}
-
-void update_for_newframe(void)
-{
- do_update_for_newframe(0, 1);
-}
-
-void update_for_newframe_muted(void)
-{
- do_update_for_newframe(1, 1);
-}
-
-/* used by new animated UI playback */
-void update_for_newframe_nodraw(int nosound)
-{
- do_update_for_newframe(nosound, 0);
-}
-
-
-static void show_splash(void)
-{
- extern char datatoc_splash_jpg[];
- extern int datatoc_splash_jpg_size;
- char *string = NULL;
-
-#ifdef NAN_BUILDINFO
- char buffer[1024];
- extern char * build_date;
- extern char * build_time;
- extern char * build_rev;
- extern char * build_platform;
- extern char * build_type;
-
- string = &buffer[0];
- sprintf(string,"Built on %s %s, Rev-%s Version %s %s", build_date, build_time, build_rev, build_platform, build_type);
-#endif
-
- splash((void *)datatoc_splash_jpg, datatoc_splash_jpg_size, string);
-}
-
-
-/* Functions for user preferences fileselect windows */
-
-/* yafray: export dir select */
-static void filesel_u_yfexportdir(char *name)
-{
- char dir[FILE_MAXDIR], file[FILE_MAXFILE];
-
- BLI_cleanup_dir(G.sce, name);
- BLI_split_dirfile(name, dir, file);
-
- strcpy(U.yfexportdir, dir);
- allqueue(REDRAWALL, 0);
-}
-
-static void filesel_u_fontdir(char *name)
-{
- char dir[FILE_MAXDIR], file[FILE_MAXFILE];
-
- BLI_cleanup_dir(G.sce, name);
- BLI_split_dirfile(name, dir, file);
-
- strcpy(U.fontdir, dir);
- allqueue(REDRAWALL, 0);
-}
-
-static void filesel_u_textudir(char *name)
-{
- char dir[FILE_MAXDIR], file[FILE_MAXFILE];
-
- BLI_cleanup_dir(G.sce, name);
- BLI_split_dirfile(name, dir, file);
-
- strcpy(U.textudir, dir);
- allqueue(REDRAWALL, 0);
-}
-
-static void filesel_u_plugtexdir(char *name)
-{
- char dir[FILE_MAXDIR], file[FILE_MAXFILE];
-
- BLI_cleanup_dir(G.sce, name);
- BLI_split_dirfile(name, dir, file);
-
- strcpy(U.plugtexdir, dir);
- allqueue(REDRAWALL, 0);
-}
-
-static void filesel_u_plugseqdir(char *name)
-{
- char dir[FILE_MAXDIR], file[FILE_MAXFILE];
-
- BLI_cleanup_dir(G.sce, name);
- BLI_split_dirfile(name, dir, file);
-
- strcpy(U.plugseqdir, dir);
- allqueue(REDRAWALL, 0);
-}
-
-static void filesel_u_renderdir(char *name)
-{
- char dir[FILE_MAXDIR], file[FILE_MAXFILE];
-
- BLI_cleanup_dir(G.sce, name);
- BLI_split_dirfile(name, dir, file);
-
- strcpy(U.renderdir, dir);
- allqueue(REDRAWALL, 0);
-}
-
-static void filesel_u_pythondir(char *name)
-{
- char dir[FILE_MAXDIR], file[FILE_MAXFILE];
-
- BLI_cleanup_dir(G.sce, name);
- BLI_split_dirfile(name, dir, file);
-
- strcpy(U.pythondir, dir);
- allqueue(REDRAWALL, 0);
-}
-
-static void filesel_u_sounddir(char *name)
-{
- char dir[FILE_MAXDIR], file[FILE_MAXFILE];
-
- BLI_cleanup_dir(G.sce, name);
- BLI_split_dirfile(name, dir, file);
-
- strcpy(U.sounddir, dir);
- allqueue(REDRAWALL, 0);
-}
-
-static void filesel_u_tempdir(char *name)
-{
- char dir[FILE_MAXDIR], file[FILE_MAXFILE];
-
- BLI_cleanup_dir(G.sce, name);
- BLI_split_dirfile(name, dir, file);
-
- strcpy(U.tempdir, dir);
- allqueue(REDRAWALL, 0);
-}
-
-/* END Functions for user preferences fileselect windows */
-
-
-void do_global_buttons(unsigned short event)
-{
- ListBase *lb;
- Object *ob;
- Material *ma;
- MTex *mtex;
- Ipo *ipo;
- Lamp *la;
- World *wrld;
- bAction *act;
- ID *id, *idtest, *from=NULL;
- ScrArea *sa;
- Brush *br;
- int nr= 1;
-
-#ifdef INTERNATIONAL
- char buf[FILE_MAX];
-#endif
-
- ob= OBACT;
-
- id= NULL; /* id at null for texbrowse */
-
-
- switch(event) {
-
- case B_NEWFRAME:
- scrarea_queue_winredraw(curarea);
- scrarea_queue_headredraw(curarea);
-
- update_for_newframe();
- break;
- case B_REDR:
- scrarea_queue_winredraw(curarea);
- scrarea_queue_headredraw(curarea);
- break;
- case B_REDRCURW3D:
- allqueue(REDRAWVIEW3D, 0);
- scrarea_queue_winredraw(curarea);
- scrarea_queue_headredraw(curarea);
- break;
- case B_EDITBROWSE:
- if(ob==NULL) return;
- if(ob->id.lib) return;
- id= ob->data;
- if(id==NULL) return;
-
- if(G.buts->menunr== -2) {
- activate_databrowse((ID *)G.buts->lockpoin, GS(id->name), 0, B_EDITBROWSE, &G.buts->menunr, do_global_buttons);
- return;
- }
- if(G.buts->menunr < 0) return;
-
- lb= wich_libbase(G.main, GS(id->name));
- idtest= lb->first;
- while(idtest) {
- if(nr==G.buts->menunr) {
- if(idtest!=id) {
- id->us--;
- id_us_plus(idtest);
-
- ob->data= idtest;
-
- test_object_materials(idtest);
-
- if( GS(idtest->name)==ID_CU ) {
- test_curve_type(ob);
- }
- else if( ob->type==OB_ARMATURE) {
- armature_rebuild_pose(ob, ob->data);
- }
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
-
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWACTION,0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWNLA,0);
- }
- break;
- }
- nr++;
- idtest= idtest->next;
- }
-
- break;
- case B_MESHBROWSE:
- if(ob==0) return;
- if(ob->id.lib) return;
-
- id= ob->data;
- if(id==0) id= G.main->mesh.first;
- if(id==0) return;
-
- if(G.buts->menunr== -2) {
- activate_databrowse((ID *)G.buts->lockpoin, GS(id->name), 0, B_MESHBROWSE, &G.buts->menunr, do_global_buttons);
- return;
- }
- if(G.buts->menunr < 0) return;
-
-
- idtest= G.main->mesh.first;
- while(idtest) {
- if(nr==G.buts->menunr) {
- set_mesh(ob, (Mesh *)idtest);
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
-
- BIF_undo_push("Browse Mesh");
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWACTION,0);
- allqueue(REDRAWIPO, 0);
-
- break;
- }
- nr++;
- idtest= idtest->next;
- }
-
- break;
- case B_MATBROWSE:
- {
- void *lockpoin= NULL;
- short *menunr= 0;
-
- /* this is called now from Node editor too, buttons might not exist */
- if(curarea->spacetype==SPACE_NODE) {
- SpaceNode *snode= curarea->spacedata.first;
- menunr= &snode->menunr;
- lockpoin= snode->id;
- }
- else if(G.buts) {
- menunr= &G.buts->menunr;
- lockpoin= G.buts->lockpoin;
- }
- else return;
-
- if(*menunr== -2) {
- if(G.qual & LR_CTRLKEY) {
- activate_databrowse_imasel((ID *)lockpoin, ID_MA, 0, B_MATBROWSE, menunr, do_global_buttons);
- }
- else {
- activate_databrowse((ID *)lockpoin, ID_MA, 0, B_MATBROWSE, menunr, do_global_buttons);
- }
- return;
- }
-
- if(*menunr < 0) return;
-
- if(0) { /* future pin */
-
- }
- else {
-
- ma= give_current_material(ob, ob->actcol);
- nr= 1;
-
- id= (ID *)ma;
-
- idtest= G.main->mat.first;
- while(idtest) {
- if(nr== *menunr) {
- break;
- }
- nr++;
- idtest= idtest->next;
- }
- if(idtest==0) { /* new mat */
- if(id) idtest= (ID *)copy_material((Material *)id);
- else {
- idtest= (ID *)add_material("Material");
- }
- idtest->us--;
- }
- if(idtest!=id) {
- assign_material(ob, (Material *)idtest, ob->actcol);
-
- BIF_undo_push("Browse Material");
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWNODE, 0);
- BIF_preview_changed(ID_MA);
- }
-
- }
- }
- break;
- case B_MATDELETE:
- if(0) { /* future pin */
-
- }
- else {
- ma= give_current_material(ob, ob->actcol);
- if(ma) {
- assign_material(ob, 0, ob->actcol);
- BIF_undo_push("Unlink Material");
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWVIEW3D, 0);
- BIF_preview_changed(ID_MA);
- }
- }
- break;
- case B_TEXDELETE:
- if(G.buts->pin) {
-
- }
- else {
- if(G.buts->texfrom==0) { /* from mat */
- ma= give_current_material(ob, ob->actcol);
- ma= editnode_get_active_material(ma);
- if(ma) {
- mtex= ma->mtex[ ma->texact ];
- if(mtex) {
- if(mtex->tex) mtex->tex->id.us--;
- MEM_freeN(mtex);
- ma->mtex[ ma->texact ]= NULL;
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWIPO, 0);
- BIF_preview_changed(ID_MA);
- }
- }
- }
- else if(G.buts->texfrom==1) { /* from world */
- wrld= G.scene->world;
- if(wrld) {
- mtex= wrld->mtex[ wrld->texact ];
- if(mtex) {
- if(mtex->tex) mtex->tex->id.us--;
- MEM_freeN(mtex);
- wrld->mtex[ wrld->texact ]= NULL;
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWIPO, 0);
- BIF_preview_changed(ID_WO);
- }
- }
- }
- else if(G.buts->texfrom==2) { /* from lamp */
- la= ob->data;
- if(la && ob->type==OB_LAMP) { /* to be sure */
- mtex= la->mtex[ la->texact ];
- if(mtex) {
- if(mtex->tex) mtex->tex->id.us--;
- MEM_freeN(mtex);
- la->mtex[ la->texact ]= NULL;
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWIPO, 0);
- BIF_preview_changed(ID_LA);
- }
- }
- }
- else { /* from brush */
- br= G.scene->toolsettings->imapaint.brush;
- if(G.f & G_SCULPTMODE) {
- sculptmode_rem_tex(NULL, NULL);
- allqueue(REDRAWBUTSSHADING, 0);
- } else if(br) {
- mtex= br->mtex[ br->texact ];
- if(mtex) {
- if(mtex->tex) mtex->tex->id.us--;
- MEM_freeN(mtex);
- br->mtex[ br->texact ]= NULL;
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWIMAGE, 0);
- allqueue(REDRAWIPO, 0);
- /*BIF_preview_changed(ID_BR);*/
- }
- }
- }
- BIF_undo_push("Unlink Texture");
- }
- break;
- case B_EXTEXBROWSE:
- case B_TEXBROWSE:
-
- if(G.buts->texnr== -2) {
-
- id= G.buts->lockpoin;
- if(event==B_EXTEXBROWSE) {
- id= NULL;
- ma= give_current_material(ob, ob->actcol);
- ma= editnode_get_active_material(ma);
- if(ma) {
- mtex= ma->mtex[ ma->texact ];
- if(mtex) id= (ID *)mtex->tex;
- }
- }
- if(G.qual & LR_CTRLKEY) {
- activate_databrowse_imasel(id, ID_TE, 0, B_TEXBROWSE, &G.buts->texnr, do_global_buttons);
- }
- else {
- activate_databrowse(id, ID_TE, 0, B_TEXBROWSE, &G.buts->texnr, do_global_buttons);
- }
- return;
- }
- if(G.buts->texnr < 0) break;
-
- if(G.buts->pin) {
-
- }
- else {
- id= NULL;
-
- ma= give_current_material(ob, ob->actcol);
- ma= editnode_get_active_material(ma);
- if(ma) {
- mtex= ma->mtex[ ma->texact ];
- if(mtex) id= (ID *)mtex->tex;
- }
-
- idtest= G.main->tex.first;
- while(idtest) {
- if(nr==G.buts->texnr) {
- break;
- }
- nr++;
- idtest= idtest->next;
- }
- if(idtest==0) { /* new tex */
- if(id) idtest= (ID *)copy_texture((Tex *)id);
- else idtest= (ID *)add_texture("Tex");
- idtest->us--;
- }
- if(idtest!=id && ma) {
-
- if( ma->mtex[ma->texact]==0) ma->mtex[ma->texact]= add_mtex();
-
- ma->mtex[ ma->texact ]->tex= (Tex *)idtest;
- id_us_plus(idtest);
- if(id) id->us--;
-
- BIF_undo_push("Browse Texture");
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWOOPS, 0);
- BIF_preview_changed(ID_MA);
- }
- }
- break;
- case B_ACTIONDELETE:
- act=ob->action;
-
- if (act)
- act->id.us--;
- ob->action=NULL;
- if(ob->pose) { // clear flag, also used for draw colors
- bPoseChannel *pchan;
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next)
- pchan->flag= 0;
- }
- BIF_undo_push("Unlink Action");
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWIPO, 0);
- break;
- case B_ACTIONBROWSE:
- if (!ob)
- break;
- act=ob->action;
- id= (ID *)act;
-
- if (G.saction->actnr== -2){
- activate_databrowse((ID *)G.saction->action, ID_AC, 0, B_ACTIONBROWSE, &G.saction->actnr, do_global_buttons);
- return;
- }
-
- if(G.saction->actnr < 0) break;
-
- /* See if we have selected a valid action */
- for (idtest= G.main->action.first; idtest; idtest= idtest->next) {
- if(nr==G.saction->actnr) {
- break;
- }
- nr++;
-
- }
-
- if(G.saction->pin) {
- if (idtest == NULL) {
- /* assign new/copy of pinned action only - messy as it doesn't assign to any obj's */
- if (G.saction->action)
- G.saction->action= (bAction *)copy_action(G.saction->action);
- else
- G.saction->action= (bAction *)add_empty_action("PinnedAction");
- }
- else {
- G.saction->action= (bAction *)idtest;
- }
- allqueue(REDRAWACTION, 0);
- }
- else {
-
- /* Store current action */
- if (!idtest) {
- /* 'Add New' option:
- * - make a copy of an exisiting action
- * - or make a new empty action if no existing action
- */
- if (act) {
- idtest= (ID *)copy_action(act);
- }
- else {
- if (ID_OB==ob->type) {
- /* for empties */
- idtest=(ID *)add_empty_action("ObAction");
- }
- else if (ELEM(ob->type, OB_MESH, OB_LATTICE) && ob_get_key(ob)) {
- /* shapekey - like if B_IPO_ACTION_KEY is triggered */
- bActionChannel *achan;
- Key *key= ob_get_key(ob);
-
- ob->ipoflag |= OB_ACTION_KEY;
-
- act = add_empty_action("ShapeAction");
- idtest=(ID *)act;
-
- achan= verify_action_channel(act, "Shape");
- achan->flag = (ACHAN_HILIGHTED|ACHAN_SELECTED|ACHAN_EXPANDED|ACHAN_SHOWIPO);
-
- if(achan->ipo==NULL && key->ipo) {
- achan->ipo= key->ipo;
- key->ipo= NULL;
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWOOPS, 0);
- }
- }
- else {
- /* a plain action */
- idtest=(ID *)add_empty_action("Action");
- }
- }
- idtest->us--;
- }
-
-
- if(idtest!=id && ob) {
- act= (bAction *)idtest;
-
- ob->action= act;
- id_us_plus(idtest);
-
- if(id) id->us--;
-
- // Update everything
- BIF_undo_push("Browse Action");
- do_global_buttons (B_NEWFRAME);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWHEADERS, 0);
- }
- }
-
- break;
- case B_IPOBROWSE:
-
- ipo= G.sipo->ipo;
- from= G.sipo->from;
- id= (ID *)ipo;
- if(from==NULL) return;
-
- if(G.sipo->menunr== -2) {
- activate_databrowse((ID *)G.sipo->ipo, ID_IP, G.sipo->blocktype, B_IPOBROWSE, &G.sipo->menunr, do_global_buttons);
- return;
- }
-
- if(G.sipo->menunr < 0) break;
-
- idtest= G.main->ipo.first;
- while(idtest) {
- if( ((Ipo *)idtest)->blocktype == G.sipo->blocktype) {
- if(nr==G.sipo->menunr) {
- break;
- }
- nr++;
- }
- idtest= idtest->next;
- }
-
- if(G.sipo->pin) {
- if(idtest) {
- G.sipo->ipo= (Ipo *)idtest;
- allspace(REMAKEIPO, 0); // in fact it should only do this one, but there is no function for it
- }
- }
- else {
- // assign the ipo to ...
-
- if(idtest==0) {
- if(ipo) idtest= (ID *)copy_ipo(ipo);
- else {
- nr= G.sipo->blocktype;
- if(nr==ID_OB) idtest= (ID *)add_ipo("ObIpo", ID_OB);
- else if(nr==ID_CO) idtest= (ID *)add_ipo("CoIpo", ID_CO);
- else if(nr==ID_PO) idtest= (ID *)add_ipo("ActIpo", nr);
- else if(nr==ID_MA) idtest= (ID *)add_ipo("MatIpo", nr);
- else if(nr==ID_TE) idtest= (ID *)add_ipo("TexIpo", nr);
- else if(nr==ID_SEQ) idtest= (ID *)add_ipo("MatSeq", nr);
- else if(nr==ID_CU) idtest= (ID *)add_ipo("CuIpo", nr);
- else if(nr==ID_KE) idtest= (ID *)add_ipo("KeyIpo", nr);
- else if(nr==ID_WO) idtest= (ID *)add_ipo("WoIpo", nr);
- else if(nr==ID_LA) idtest= (ID *)add_ipo("LaIpo", nr);
- else if(nr==ID_CA) idtest= (ID *)add_ipo("CaIpo", nr);
- else if(nr==ID_SO) idtest= (ID *)add_ipo("SndIpo", nr);
- else if(nr==ID_FLUIDSIM) idtest= (ID *)add_ipo("FluidsimIpo", nr);
- else if(nr==ID_PA) idtest= (ID *)add_ipo("PaIpo", nr);
- else error("Warn bugtracker!");
- }
- idtest->us--;
- }
- if(idtest!=id && from) {
- spaceipo_assign_ipo(G.sipo, (Ipo *)idtest);
-
- BIF_undo_push("Browse Ipo");
- }
- }
- break;
- case B_IPODELETE:
- ipo= G.sipo->ipo;
- from= G.sipo->from;
-
- spaceipo_assign_ipo(G.sipo, NULL);
-
- editipo_changed(G.sipo, 1); /* doredraw */
-
- BIF_undo_push("Unlink Ipo");
-
- break;
- case B_WORLDBROWSE:
-
- if(G.buts->menunr==-2) {
- activate_databrowse((ID *)G.scene->world, ID_WO, 0, B_WORLDBROWSE, &G.buts->menunr, do_global_buttons);
- break;
- }
-
- if(G.buts->menunr < 0) break;
- /* no lock */
-
- wrld= G.scene->world;
- nr= 1;
-
- id= (ID *)wrld;
-
- idtest= G.main->world.first;
- while(idtest) {
- if(nr==G.buts->menunr) {
- break;
- }
- nr++;
- idtest= idtest->next;
- }
- if(idtest==0) { /* new world */
- if(id) idtest= (ID *)copy_world((World *)id);
- else idtest= (ID *)add_world("World");
- idtest->us--;
- }
- if(idtest!=id) {
- G.scene->world= (World *)idtest;
- id_us_plus(idtest);
- if(id) id->us--;
-
- BIF_undo_push("Browse World");
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWOOPS, 0);
- BIF_preview_changed(ID_WO);
- }
- break;
- case B_WORLDDELETE:
- if(G.scene->world) {
- G.scene->world->id.us--;
- G.scene->world= NULL;
-
- BIF_undo_push("Unlink World");
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWIPO, 0);
- }
-
- break;
- case B_WTEXBROWSE:
-
- if(G.buts->texnr== -2) {
- id= NULL;
- wrld= G.scene->world;
- if(wrld) {
- mtex= wrld->mtex[ wrld->texact ];
- if(mtex) id= (ID *)mtex->tex;
- }
-
- activate_databrowse((ID *)id, ID_TE, 0, B_WTEXBROWSE, &G.buts->texnr, do_global_buttons);
- return;
- }
- if(G.buts->texnr < 0) break;
-
- if(G.buts->pin) {
-
- }
- else {
- id= NULL;
-
- wrld= G.scene->world;
- if(wrld) {
- mtex= wrld->mtex[ wrld->texact ];
- if(mtex) id= (ID *)mtex->tex;
- }
-
- idtest= G.main->tex.first;
- while(idtest) {
- if(nr==G.buts->texnr) {
- break;
- }
- nr++;
- idtest= idtest->next;
- }
- if(idtest==0) { /* new tex */
- if(id) idtest= (ID *)copy_texture((Tex *)id);
- else idtest= (ID *)add_texture("Tex");
- idtest->us--;
- }
- if(idtest!=id && wrld) {
-
- if( wrld->mtex[wrld->texact]==0) {
- wrld->mtex[wrld->texact]= add_mtex();
- wrld->mtex[wrld->texact]->texco= TEXCO_VIEW;
- }
- wrld->mtex[ wrld->texact ]->tex= (Tex *)idtest;
- id_us_plus(idtest);
- if(id) id->us--;
-
- BIF_undo_push("Texture browse");
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWOOPS, 0);
- BIF_preview_changed(ID_WO);
- }
- }
- break;
- case B_LAMPBROWSE:
- /* no lock */
- if(ob==0) return;
- if(ob->type!=OB_LAMP) return;
-
- if(G.buts->menunr== -2) {
- activate_databrowse((ID *)G.buts->lockpoin, ID_LA, 0, B_LAMPBROWSE, &G.buts->menunr, do_global_buttons);
- return;
- }
- if(G.buts->menunr < 0) break;
-
- la= ob->data;
- nr= 1;
- id= (ID *)la;
-
- idtest= G.main->lamp.first;
- while(idtest) {
- if(nr==G.buts->menunr) {
- break;
- }
- nr++;
- idtest= idtest->next;
- }
- if(idtest==0) { /* no new lamp */
- return;
- }
- if(idtest!=id) {
- ob->data= (Lamp *)idtest;
- id_us_plus(idtest);
- if(id) id->us--;
-
- BIF_undo_push("Lamp browse");
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWOOPS, 0);
- BIF_preview_changed(ID_LA);
- }
- break;
-
- case B_LTEXBROWSE:
-
- if(ob==0) return;
- if(ob->type!=OB_LAMP) return;
-
- if(G.buts->texnr== -2) {
- id= NULL;
- la= ob->data;
- mtex= la->mtex[ la->texact ];
- if(mtex) id= (ID *)mtex->tex;
-
- activate_databrowse(id, ID_TE, 0, B_LTEXBROWSE, &G.buts->texnr, do_global_buttons);
- return;
- }
- if(G.buts->texnr < 0) break;
-
- if(G.buts->pin) {
-
- }
- else {
- id= NULL;
-
- la= ob->data;
- mtex= la->mtex[ la->texact ];
- if(mtex) id= (ID *)mtex->tex;
-
- idtest= G.main->tex.first;
- while(idtest) {
- if(nr==G.buts->texnr) {
- break;
- }
- nr++;
- idtest= idtest->next;
- }
- if(idtest==0) { /* new tex */
- if(id) idtest= (ID *)copy_texture((Tex *)id);
- else idtest= (ID *)add_texture("Tex");
- idtest->us--;
- }
- if(idtest!=id && la) {
-
- if( la->mtex[la->texact]==0) {
- la->mtex[la->texact]= add_mtex();
- la->mtex[la->texact]->texco= TEXCO_GLOB;
- }
- la->mtex[ la->texact ]->tex= (Tex *)idtest;
- id_us_plus(idtest);
- if(id) id->us--;
-
- BIF_undo_push("Texture Browse");
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWOOPS, 0);
- BIF_preview_changed(ID_LA);
- }
- }
- break;
-
- case B_IMAGEDELETE:
- if(G.sima->image && (G.sima->image->type == IMA_TYPE_R_RESULT || G.sima->image->type == IMA_TYPE_COMPOSITE)) {
- /* Run if G.sima is render, remove the render and display the meshes image if it exists */
- G.sima->image= NULL;
- what_image(G.sima);
- allqueue(REDRAWIMAGE, 0);
- } else {
- /* Run on non render images, unlink normally */
- image_changed(G.sima, NULL);
- BIF_undo_push("Unlink Image");
- allqueue(REDRAWIMAGE, 0);
- }
- break;
-
- case B_AUTOMATNAME:
- /* this is called now from Node editor too, buttons might not exist */
- if(curarea->spacetype==SPACE_NODE) {
- SpaceNode *snode= curarea->spacedata.first;
- automatname((Material *)snode->id);
- }
- else if(G.buts) {
- automatname(G.buts->lockpoin);
- }
- else return;
-
- BIF_undo_push("Auto name");
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWNODE, 0);
- allqueue(REDRAWOOPS, 0);
- break;
- case B_AUTOTEXNAME:
- if(G.buts->mainb==CONTEXT_SHADING) {
- if(G.buts->tab[CONTEXT_SHADING]==TAB_SHADING_TEX) {
- autotexname(G.buts->lockpoin);
- }
- else if(G.buts->tab[CONTEXT_SHADING]==TAB_SHADING_MAT) {
- ma= G.buts->lockpoin;
- if(ma->mtex[ ma->texact]) autotexname(ma->mtex[ma->texact]->tex);
- }
- else if(G.buts->tab[CONTEXT_SHADING]==TAB_SHADING_WORLD) {
- wrld= G.buts->lockpoin;
- if(wrld->mtex[ wrld->texact]) autotexname(wrld->mtex[wrld->texact]->tex);
- }
- else if(G.buts->tab[CONTEXT_SHADING]==TAB_SHADING_LAMP) {
- la= G.buts->lockpoin;
- if(la->mtex[ la->texact]) autotexname(la->mtex[la->texact]->tex);
- }
- BIF_undo_push("Auto name");
- allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWIMAGE, 0);
- }
- else if(G.buts->mainb==CONTEXT_EDITING) {
- SculptData *sd= &G.scene->sculptdata;
- if(sd && sd->texact != -1) {
- if(sd->mtex[sd->texact]) autotexname(sd->mtex[sd->texact]->tex);
-
- BIF_undo_push("Auto name");
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWOOPS, 0);
- }
- }
- break;
-
- case B_RESETAUTOSAVE:
- reset_autosave();
- allqueue(REDRAWINFO, 0);
- break;
- case B_SOUNDTOGGLE:
- SYS_WriteCommandLineInt(SYS_GetSystem(), "noaudio", (U.gameflags & USER_DISABLE_SOUND));
- break;
- case B_SHOWSPLASH:
- show_splash();
- break;
- case B_MIPMAPCHANGED:
- set_mipmap(!(U.gameflags & USER_DISABLE_MIPMAP));
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_GLRESLIMITCHANGED:
- free_all_realtime_images(); /* force reloading with new res limit */
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_NEWSPACE:
- newspace(curarea, curarea->butspacetype);
- break;
- case B_LOADTEMP: /* is button from space.c */
- BIF_read_autosavefile();
- break;
-
- case B_USERPREF:
- allqueue(REDRAWINFO, 0);
- break;
-
- case B_DRAWINFO: /* is button from space.c *info* */
- allqueue(REDRAWVIEW3D, 0);
- break;
-
- case B_PLAINMENUS: /* is button from space.c *info* */
- reset_toolbox();
- break;
-
- case B_FLIPINFOMENU: /* is button from space.c *info* */
- scrarea_queue_headredraw(curarea);
- break;
-
-#if 0
-//#ifdef _WIN32 // FULLSCREEN
- case B_FLIPFULLSCREEN:
- if(U.uiflag & USER_FLIPFULLSCREEN)
- U.uiflag &= ~USER_FLIPFULLSCREEN;
- else
- U.uiflag |= USER_FLIPFULLSCREEN;
- mainwindow_toggle_fullscreen((U.uiflag & USER_FLIPFULLSCREEN));
- break;
-#endif
-
- /* Fileselect windows for user preferences file paths */
-
- /* yafray: xml export dir. select */
- case B_YAFRAYDIRFILESEL: /* space.c */
- if(curarea->spacetype==SPACE_INFO) {
- sa= closest_bigger_area();
- areawinset(sa->win);
- }
-
- activate_fileselect(FILE_SPECIAL, "SELECT YFEXPORT PATH", U.yfexportdir, filesel_u_yfexportdir);
- break;
-
- case B_FONTDIRFILESEL: /* is button from space.c *info* */
- if(curarea->spacetype==SPACE_INFO) {
- sa= closest_bigger_area();
- areawinset(sa->win);
- }
-
- activate_fileselect(FILE_SPECIAL, "SELECT FONT PATH", U.fontdir, filesel_u_fontdir);
- break;
-
- case B_TEXTUDIRFILESEL: /* is button from space.c *info* */
- if(curarea->spacetype==SPACE_INFO) {
- sa= closest_bigger_area();
- areawinset(sa->win);
- }
-
- activate_fileselect(FILE_SPECIAL, "SELECT TEXTURE PATH", U.textudir, filesel_u_textudir);
- break;
-
- case B_PLUGTEXDIRFILESEL: /* is button form space.c *info* */
- if(curarea->spacetype==SPACE_INFO) {
- sa= closest_bigger_area();
- areawinset(sa->win);
- }
-
- activate_fileselect(FILE_SPECIAL, "SELECT TEX PLUGIN PATH", U.plugtexdir, filesel_u_plugtexdir);
- break;
-
- case B_PLUGSEQDIRFILESEL: /* is button from space.c *info* */
- if(curarea->spacetype==SPACE_INFO) {
- sa= closest_bigger_area();
- areawinset(sa->win);
- }
-
- activate_fileselect(FILE_SPECIAL, "SELECT SEQ PLUGIN PATH", U.plugseqdir, filesel_u_plugseqdir);
- break;
-
- case B_RENDERDIRFILESEL: /* is button from space.c *info* */
- if(curarea->spacetype==SPACE_INFO) {
- sa= closest_bigger_area();
- areawinset(sa->win);
- }
-
- activate_fileselect(FILE_SPECIAL, "SELECT RENDER PATH", U.renderdir, filesel_u_renderdir);
- break;
-
- case B_PYMENUEVAL: /* is button from space.c *info* */
- waitcursor( 1 ); /* can take some time */
- BPyMenu_RemoveAllEntries(); /* free old data */
- if (BPyMenu_Init(1) == -1) { /* re-eval scripts registration in menus */
- waitcursor( 0 );
- error("Invalid scripts dir: check console");
- }
- waitcursor( 0 );
- break;
- case B_PYTHONDIRFILESEL: /* is button from space.c *info* */
- if(curarea->spacetype==SPACE_INFO) {
- sa= closest_bigger_area();
- areawinset(sa->win);
- }
-
- activate_fileselect(FILE_SPECIAL, "SELECT SCRIPT PATH", U.pythondir, filesel_u_pythondir);
- break;
-
- case B_SOUNDDIRFILESEL: /* is button from space.c *info* */
- if(curarea->spacetype==SPACE_INFO) {
- sa= closest_bigger_area();
- areawinset(sa->win);
- }
-
- activate_fileselect(FILE_SPECIAL, "SELECT SOUND PATH", U.sounddir, filesel_u_sounddir);
- break;
-
- case B_TEMPDIRFILESEL: /* is button from space.c *info* */
- if(curarea->spacetype==SPACE_INFO) {
- sa= closest_bigger_area();
- areawinset(sa->win);
- }
-
- activate_fileselect(FILE_SPECIAL, "SELECT TEMP FILE PATH", U.tempdir, filesel_u_tempdir);
- break;
-
- /* END Fileselect windows for user preferences file paths */
-
-#ifdef INTERNATIONAL
- case B_LOADUIFONT: /* is button from space.c *info* */
- if(curarea->spacetype==SPACE_INFO) {
- sa= closest_bigger_area();
- areawinset(sa->win);
- }
- BLI_make_file_string("/", buf, U.fontdir, U.fontname);
- activate_fileselect(FILE_SPECIAL, "LOAD UI FONT", buf, set_interface_font);
- break;
-
- case B_SETLANGUAGE: /* is button from space.c *info* */
- lang_setlanguage();
- allqueue(REDRAWALL, 0);
- break;
-
- case B_SETFONTSIZE: /* is button from space.c *info* */
- refresh_interface_font();
- FTF_SetSize(U.fontsize);
- allqueue(REDRAWALL, 0);
- break;
-
- case B_SETTRANSBUTS: /* is button from space.c *info* */
- allqueue(REDRAWALL, 0);
- break;
-
- case B_RESTOREFONT: /* is button from space.c *info* */
- U.fontsize= 0;
- start_interface_font();
- allqueue(REDRAWALL, 0);
- break;
-
- case B_USETEXTUREFONT: /* is button from space.c *info* */
- refresh_interface_font();
- allqueue(REDRAWALL, 0);
- break;
-
- case B_DOLANGUIFONT: /* is button from space.c *info* */
- if(U.transopts & USER_DOTRANSLATE)
- start_interface_font();
- else
- G.ui_international = FALSE;
- allqueue(REDRAWALL, 0);
- break;
-#endif
-
- case B_FULL:
- if(curarea->spacetype!=SPACE_INFO) {
- area_fullscreen();
- }
- break;
-
- case B_IDNAME:
- /* changing a metaballs name, sadly enough,
- * can require it to be updated because its
- * basis might have changed... -zr
- */
- if (ob && ob->type==OB_MBALL) {
- DAG_scene_sort(G.scene);
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- }
- /* redraw because name has changed: new pup */
- scrarea_queue_headredraw(curarea);
- allqueue(REDRAWINFO, 1);
- allqueue(REDRAWOOPS, 1);
- allqueue(REDRAWACTION, 1);
- allqueue(REDRAWNLA, 1);
- /* name scene also in set PUPmenu */
- allqueue(REDRAWBUTSALL, 0);
- allqueue(REDRAWIMAGE, 0);
- allqueue(REDRAWHEADERS, 0);
- break;
-
- case B_KEEPDATA:
- /* keep datablock. similar to pressing FKEY in a fileselect window
- * maybe we can move that stuff to a seperate function? -- sg
- */
- if (curarea->spacetype==SPACE_BUTS) {
- id= (ID *)G.buts->lockpoin;
- } else if(curarea->spacetype==SPACE_IPO) {
- id = (ID *)G.sipo->ipo;
- } else if(curarea->spacetype==SPACE_NODE) {
- id = ((SpaceNode *)curarea->spacedata.first)->id;
- } /* similar for other spacetypes ? */
- if (id) {
- if( id->flag & LIB_FAKEUSER) {
- id->flag -= LIB_FAKEUSER;
- id->us--;
- } else {
- id->flag |= LIB_FAKEUSER;
- id->us++;
- }
- }
- allqueue(REDRAWHEADERS, 0);
-
- break;
-
- }
-}
-
-
-void do_global_buttons2(short event)
-{
- Base *base;
- Object *ob;
- Material *ma;
- MTex *mtex;
- Mesh *me;
- Curve *cu;
- MetaBall *mb;
- Ipo *ipo;
- Lamp *la;
- Lattice *lt;
- World *wrld;
- ID *idfrom;
- bAction *act;
- Brush *br;
-
- /* general: Single User is allowed when from==LOCAL
- * Make Local is allowed when (from==LOCAL && id==LIB)
- */
-
- if(event<B_LOCAL_ALONE) return;
-
- ob= OBACT;
-
- switch(event) {
-
- case B_LAMPALONE:
- if(ob && ob->id.lib==0) {
- la= ob->data;
- if(la->id.us>1) {
- if(okee("Single user")) {
- ob->data= copy_lamp(la);
- la->id.us--;
- }
- }
- }
- break;
- case B_LAMPLOCAL:
- if(ob && ob->id.lib==0) {
- la= ob->data;
- if(la->id.lib) {
- if(okee("Make local")) {
- make_local_lamp(la);
- }
- }
- }
- break;
-
- case B_ARMLOCAL:
- if (ob&&ob->id.lib==0){
- bArmature *arm=ob->data;
- if (arm->id.lib){
- if(okee("Make local")) {
- make_local_armature(arm);
- }
- }
- }
- break;
- case B_ARMALONE:
- if(ob && ob->id.lib==0) {
- bArmature *arm=ob->data;
- if(arm->id.us>1) {
- if(okee("Single user")) {
- ob->data= copy_armature(arm);
- armature_rebuild_pose(ob, ob->data);
- arm->id.us--;
- }
- }
- }
- break;
- case B_ACTLOCAL:
- if(ob && ob->id.lib==0) {
- act= ob->action;
- if(act->id.lib) {
- if(okee("Make local")) {
- make_local_action(act);
- allqueue(REDRAWACTION,0);
- }
- }
- }
- break;
- case B_ACTALONE:
- if(ob && ob->id.lib==0) {
- act= ob->action;
-
- if(act->id.us>1) {
- if(okee("Single user")) {
- ob->action=copy_action(act);
- act->id.us--;
- allqueue(REDRAWACTION, 0);
- }
- }
- }
- break;
-
- case B_CAMERAALONE:
- if(ob && ob->id.lib==0) {
- Camera *ca= ob->data;
- if(ca->id.us>1) {
- if(okee("Single user")) {
- ob->data= copy_camera(ca);
- ca->id.us--;
- }
- }
- }
- break;
- case B_CAMERALOCAL:
- if(ob && ob->id.lib==0) {
- Camera *ca= ob->data;
- if(ca->id.lib) {
- if(okee("Make local")) {
- make_local_camera(ca);
- }
- }
- }
- break;
- case B_WORLDALONE:
- wrld= G.scene->world;
- if(wrld->id.us>1) {
- if(okee("Single user")) {
- G.scene->world= copy_world(wrld);
- wrld->id.us--;
- }
- }
- break;
- case B_WORLDLOCAL:
- wrld= G.scene->world;
- if(wrld && wrld->id.lib) {
- if(okee("Make local")) {
- make_local_world(wrld);
- }
- }
- break;
-
- case B_LATTALONE:
- if(ob && ob->id.lib==0) {
- lt= ob->data;
- if(lt->id.us>1) {
- if(okee("Single user")) {
- ob->data= copy_lattice(lt);
- lt->id.us--;
- }
- }
- }
- break;
- case B_LATTLOCAL:
- if(ob && ob->id.lib==0) {
- lt= ob->data;
- if(lt->id.lib) {
- if(okee("Make local")) {
- make_local_lattice(lt);
- }
- }
- }
- break;
-
- case B_MATALONE:
- if(ob==0) return;
- ma= give_current_material(ob, ob->actcol);
- idfrom= material_from(ob, ob->actcol);
- if(idfrom && idfrom->lib==0) {
- if(ma->id.us>1) {
- if(okee("Single user")) {
- ma= copy_material(ma);
- ma->id.us= 0;
- assign_material(ob, ma, ob->actcol);
- }
- }
- }
- break;
- case B_MATLOCAL:
- if(ob==0) return;
- idfrom= material_from(ob, ob->actcol);
- if(idfrom->lib==0) {
- ma= give_current_material(ob, ob->actcol);
- if(ma && ma->id.lib) {
- if(okee("Make local")) {
- make_local_material(ma);
- }
- }
- }
- break;
-
- case B_MESHLOCAL:
- if(ob && ob->id.lib==0) {
- me= ob->data;
- if(me && me->id.lib) {
- if(okee("Make local")) {
- make_local_mesh(me);
- make_local_key( me->key );
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- }
- }
- }
- break;
-
- case B_MBALLALONE:
- if(ob && ob->id.lib==0) {
- mb= ob->data;
- if(mb->id.us>1) {
- if(okee("Single user")) {
- ob->data= copy_mball(mb);
- mb->id.us--;
- if(ob==G.obedit) allqueue(REDRAWVIEW3D, 0);
- }
- }
- }
- break;
- case B_MBALLLOCAL:
- if(ob && ob->id.lib==0) {
- mb= ob->data;
- if(mb->id.lib) {
- if(okee("Make local")) {
- make_local_mball(mb);
- }
- }
- }
- break;
-
- case B_CURVEALONE:
- if(ob && ob->id.lib==0) {
- cu= ob->data;
- if(cu->id.us>1) {
- if(okee("Single user")) {
- ob->data= copy_curve(cu);
- cu->id.us--;
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- if(ob==G.obedit) allqueue(REDRAWVIEW3D, 0);
- }
- }
- }
- break;
- case B_CURVELOCAL:
- if(ob && ob->id.lib==0) {
- cu= ob->data;
- if(cu->id.lib) {
- if(okee("Make local")) {
- make_local_curve(cu);
- make_local_key( cu->key );
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- }
- }
- }
- break;
-
- case B_TEXALONE:
- if(G.buts->texfrom==0) { /* from mat */
- if(ob==0) return;
- ma= give_current_material(ob, ob->actcol);
- ma= editnode_get_active_material(ma);
- if(ma && ma->id.lib==0) {
- mtex= ma->mtex[ ma->texact ];
- if(mtex->tex && mtex->tex->id.us>1) {
- if(okee("Single user")) {
- mtex->tex->id.us--;
- mtex->tex= copy_texture(mtex->tex);
- }
- }
- }
- }
- else if(G.buts->texfrom==1) { /* from world */
- wrld= G.scene->world;
- if(wrld->id.lib==0) {
- mtex= wrld->mtex[ wrld->texact ];
- if(mtex->tex && mtex->tex->id.us>1) {
- if(okee("Single user")) {
- mtex->tex->id.us--;
- mtex->tex= copy_texture(mtex->tex);
- }
- }
- }
- }
- else if(G.buts->texfrom==2) { /* from lamp */
- if(ob==0 || ob->type!=OB_LAMP) return;
- la= ob->data;
- if(la->id.lib==0) {
- mtex= la->mtex[ la->texact ];
- if(mtex->tex && mtex->tex->id.us>1) {
- if(okee("Single user")) {
- mtex->tex->id.us--;
- mtex->tex= copy_texture(mtex->tex);
- }
- }
- }
- }
- else if(G.buts->texfrom==3) { /* from brush */
- br= G.scene->toolsettings->imapaint.brush;
- if(br==0) return;
- if(br->id.lib==0) {
- mtex= br->mtex[ br->texact ];
- if(mtex->tex && mtex->tex->id.us>1) {
- if(okee("Single user")) {
- mtex->tex->id.us--;
- mtex->tex= copy_texture(mtex->tex);
- allqueue(REDRAWIMAGE, 0);
- }
- }
- }
- }
- break;
- case B_TEXLOCAL:
- if(G.buts->texfrom==0) { /* from mat */
- if(ob==0) return;
- ma= give_current_material(ob, ob->actcol);
- ma= editnode_get_active_material(ma);
- if(ma && ma->id.lib==0) {
- mtex= ma->mtex[ ma->texact ];
- if(mtex->tex && mtex->tex->id.lib) {
- if(okee("Make local")) {
- make_local_texture(mtex->tex);
- }
- }
- }
- }
- else if(G.buts->texfrom==1) { /* from world */
- wrld= G.scene->world;
- if(wrld->id.lib==0) {
- mtex= wrld->mtex[ wrld->texact ];
- if(mtex->tex && mtex->tex->id.lib) {
- if(okee("Make local")) {
- make_local_texture(mtex->tex);
- }
- }
- }
- }
- else if(G.buts->texfrom==2) { /* from lamp */
- if(ob==0 || ob->type!=OB_LAMP) return;
- la= ob->data;
- if(la->id.lib==0) {
- mtex= la->mtex[ la->texact ];
- if(mtex->tex && mtex->tex->id.lib) {
- if(okee("Make local")) {
- make_local_texture(mtex->tex);
- }
- }
- }
- }
- else if(G.buts->texfrom==3) { /* from brush */
- br= G.scene->toolsettings->imapaint.brush;
- if(br==0) return;
- if(br->id.lib==0) {
- mtex= br->mtex[ br->texact ];
- if(mtex->tex && mtex->tex->id.lib) {
- if(okee("Make local")) {
- make_local_texture(mtex->tex);
- allqueue(REDRAWIMAGE, 0);
- }
- }
- }
- }
- break;
-
- case B_IPOALONE:
- ipo= G.sipo->ipo;
- idfrom= G.sipo->from;
-
- if(idfrom && idfrom->lib==NULL) {
- if(ipo->id.us>1) {
- if(okee("Single user")) {
- ipo= copy_ipo(ipo);
- ipo->id.us= 0; /* assign_ipo adds users, copy_ipo sets to 1 */
- spaceipo_assign_ipo(G.sipo, ipo);
- allqueue(REDRAWIPO, 0);
- }
- }
- }
- break;
- case B_IPOLOCAL:
- ipo= G.sipo->ipo;
- idfrom= G.sipo->from;
-
- if(idfrom && idfrom->lib==0) {
- if(ipo->id.lib) {
- if(okee("Make local")) {
- make_local_ipo(ipo);
- allqueue(REDRAWIPO, 0);
- }
- }
- }
- break;
-
- case B_OBALONE:
- if(G.scene->id.lib==0) {
- if(ob->id.us>1) {
- if(okee("Single user")) {
- base= FIRSTBASE;
- while(base) {
- if(base->object==ob) {
- base->object= copy_object(ob);
- ob->id.us--;
- allqueue(REDRAWVIEW3D, 0);
- break;
- }
- base= base->next;
- }
- }
- }
- }
- break;
- case B_OBLOCAL:
- if(G.scene->id.lib==0) {
- if(ob->id.lib) {
- if(okee("Make local")) {
- make_local_object(ob);
- allqueue(REDRAWVIEW3D, 0);
- }
- }
- }
- break;
- case B_MESHALONE:
- if(ob && ob->id.lib==0) {
-
- me= ob->data;
-
- if(me && me->id.us>1) {
- if(okee("Single user")) {
- Mesh *men= copy_mesh(me);
- men->id.us= 0;
-
- set_mesh(ob, men);
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
-
- if(ob==G.obedit) allqueue(REDRAWVIEW3D, 0);
- }
- }
- }
- break;
- }
-
- BIF_undo_push("Make single user or local");
- allqueue(REDRAWBUTSALL, 0);
- allqueue(REDRAWOOPS, 0);
-}
-
-/* ******************** GENERAL ********************** */
-
-void do_headerbuttons(short event)
-{
-
- if(event<=50) do_global_buttons2(event);
- else if(event<=100) do_global_buttons(event);
- else if(event<200) do_view3d_buttons(event);
- else if(event<250) do_ipo_buttons(event);
- else if(event<300) do_oops_buttons(event);
- else if(event<350) do_info_buttons(event);
- else if(event<400) do_image_buttons(event);
- else if(event<450) do_buts_buttons(event);
- else if(event<500) do_imasel_buttons(event);
- else if(event<525) do_text_buttons(event);
- else if(event<550) do_script_buttons(event);
- else if(event<600) do_file_buttons(event);
- else if(event<650) do_seq_buttons(event);
- else if(event<700) do_sound_buttons(event);
- else if(event<750) do_action_buttons(event);
- else if(event<800) do_time_buttons(curarea, event);
- else if(event<850) do_nla_buttons(event);
- else if(event<900) do_node_buttons(curarea, event);
- else if(event>=REDRAWVIEW3D) allqueue(event, 0);
-}
-
diff --git a/source/blender/src/imagepaint.c b/source/blender/src/imagepaint.c
deleted file mode 100644
index 7b8efd0ed75..00000000000
--- a/source/blender/src/imagepaint.c
+++ /dev/null
@@ -1,790 +0,0 @@
-/**
- * $Id$
- * imagepaint.c
- *
- * Functions to paint images in 2D and 3D.
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Jens Ole Wund (bjornmose)
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <string.h>
-#include <stdio.h>
-#include <math.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#ifdef WIN32
-#include "BLI_winstuff.h"
-#endif
-#include "BLI_arithb.h"
-#include "PIL_time.h"
-
-#include "IMB_imbuf.h"
-#include "IMB_imbuf_types.h"
-
-#include "DNA_brush_types.h"
-#include "DNA_image_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_node_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_view3d_types.h"
-
-#include "BKE_brush.h"
-#include "BKE_global.h"
-#include "BKE_image.h"
-#include "BKE_mesh.h"
-#include "BKE_node.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_mywindow.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-
-#include "BSE_drawipo.h"
-#include "BSE_node.h"
-#include "BSE_trans_types.h"
-#include "BSE_view.h"
-
-#include "BDR_drawmesh.h"
-#include "BDR_imagepaint.h"
-#include "BDR_vpaint.h"
-
-#include "GHOST_Types.h"
-
-#include "blendef.h"
-#include "butspace.h"
-#include "mydevice.h"
-
-/* Defines and Structs */
-
-#define IMAPAINT_FLOAT_TO_CHAR(f) ((char)(f*255))
-#define IMAPAINT_CHAR_TO_FLOAT(c) (c/255.0f)
-
-#define IMAPAINT_FLOAT_RGB_TO_CHAR(c, f) { c[0]=IMAPAINT_FLOAT_TO_CHAR(f[0]); \
- c[1]=IMAPAINT_FLOAT_TO_CHAR(f[1]); c[2]=IMAPAINT_FLOAT_TO_CHAR(f[2]); }
-#define IMAPAINT_CHAR_RGB_TO_FLOAT(f, c) { f[0]=IMAPAINT_CHAR_TO_FLOAT(c[0]); \
- f[1]=IMAPAINT_CHAR_TO_FLOAT(c[1]); f[2]=IMAPAINT_CHAR_TO_FLOAT(c[2]); }
-#define IMAPAINT_FLOAT_RGB_COPY(a, b) VECCOPY(a, b)
-
-#define IMAPAINT_TILE_BITS 6
-#define IMAPAINT_TILE_SIZE (1 << IMAPAINT_TILE_BITS)
-#define IMAPAINT_TILE_NUMBER(size) (((size)+IMAPAINT_TILE_SIZE-1) >> IMAPAINT_TILE_BITS)
-
-typedef struct ImagePaintState {
- Brush *brush;
- short tool, blend;
- Image *image;
- ImBuf *canvas;
- ImBuf *clonecanvas;
- short clonefreefloat;
- char *warnpackedfile;
- char *warnmultifile;
-
- /* texture paint only */
- Object *ob;
- Mesh *me;
- int faceindex;
- float uv[2];
-} ImagePaintState;
-
-typedef struct ImagePaintUndo {
- Image *image;
- ImBuf *tilebuf;
- void **tiles;
- int xtiles, ytiles;
-} ImagePaintUndo;
-
-typedef struct ImagePaintPartialRedraw {
- int x1, y1, x2, y2;
- int enabled;
-} ImagePaintPartialRedraw;
-
-static ImagePaintUndo imapaintundo = {NULL, NULL, NULL, 0, 0};
-static ImagePaintPartialRedraw imapaintpartial = {0, 0, 0, 0, 0};
-
-static void init_imagapaint_undo(Image *ima, ImBuf *ibuf)
-{
- int xt, yt;
-
- imapaintundo.image = ima;
- imapaintundo.xtiles = xt = IMAPAINT_TILE_NUMBER(ibuf->x);
- imapaintundo.ytiles = yt = IMAPAINT_TILE_NUMBER(ibuf->y);
- imapaintundo.tiles = MEM_callocN(sizeof(void*)*xt*yt, "ImagePaintUndoTiles");
- imapaintundo.tilebuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE,
- ibuf->depth, (ibuf->rect_float)? IB_rectfloat: IB_rect, 0);
-}
-
-static void imapaint_copy_tile(ImBuf *ibuf, int tile, int x, int y, int swapundo)
-{
- IMB_rectcpy(imapaintundo.tilebuf, ibuf, 0, 0, x*IMAPAINT_TILE_SIZE,
- y*IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE);
-
- if (imapaintundo.tilebuf->rect_float)
- SWAP(void*, imapaintundo.tilebuf->rect_float, imapaintundo.tiles[tile])
- else
- SWAP(void*, imapaintundo.tilebuf->rect, imapaintundo.tiles[tile])
-
- if (swapundo)
- IMB_rectcpy(ibuf, imapaintundo.tilebuf, x*IMAPAINT_TILE_SIZE,
- y*IMAPAINT_TILE_SIZE, 0, 0, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE);
-}
-
-static void imapaint_clear_partial_redraw()
-{
- memset(&imapaintpartial, 0, sizeof(imapaintpartial));
-}
-
-static void imapaint_dirty_region(Image *ima, ImBuf *ibuf, int x, int y, int w, int h)
-{
- int srcx= 0, srcy= 0, origx, tile, allocsize;
-
- IMB_rectclip(ibuf, NULL, &x, &y, &srcx, &srcy, &w, &h);
-
- if (w == 0 || h == 0)
- return;
-
- if (!imapaintpartial.enabled) {
- imapaintpartial.x1 = x;
- imapaintpartial.y1 = y;
- imapaintpartial.x2 = x+w;
- imapaintpartial.y2 = y+h;
- imapaintpartial.enabled = 1;
- }
- else {
- imapaintpartial.x1 = MIN2(imapaintpartial.x1, x);
- imapaintpartial.y1 = MIN2(imapaintpartial.y1, y);
- imapaintpartial.x2 = MAX2(imapaintpartial.x2, x+w);
- imapaintpartial.y2 = MAX2(imapaintpartial.y2, y+h);
- }
-
- w = ((x + w - 1) >> IMAPAINT_TILE_BITS);
- h = ((y + h - 1) >> IMAPAINT_TILE_BITS);
- origx = (x >> IMAPAINT_TILE_BITS);
- y = (y >> IMAPAINT_TILE_BITS);
-
- for (; y <= h; y++) {
- for (x=origx; x <= w; x++) {
- if (ima != imapaintundo.image) {
- free_imagepaint();
- init_imagapaint_undo(ima, ibuf);
- }
-
- tile = y*imapaintundo.xtiles + x;
- if (!imapaintundo.tiles[tile]) {
- allocsize= (ibuf->rect_float)? sizeof(float): sizeof(char);
- imapaintundo.tiles[tile]= MEM_mapallocN(allocsize*4*
- IMAPAINT_TILE_SIZE*IMAPAINT_TILE_SIZE, "ImagePaintUndoTile");
- imapaint_copy_tile(ibuf, tile, x, y, 0);
- }
- }
- }
-
- ibuf->userflags |= IB_BITMAPDIRTY;
-}
-
-static void imapaint_image_update(Image *image, ImBuf *ibuf, short texpaint)
-{
- if(ibuf->rect_float)
- imb_freerectImBuf(ibuf); /* force recreate of char rect */
- if(ibuf->mipmap[0])
- imb_freemipmapImBuf(ibuf);
-
- /* todo: should set_tpage create ->rect? */
- if(texpaint || G.sima->lock) {
- int w = imapaintpartial.x2 - imapaintpartial.x1;
- int h = imapaintpartial.y2 - imapaintpartial.y1;
- update_realtime_image(image, imapaintpartial.x1, imapaintpartial.y1, w, h);
- }
-}
-
-/* note; gets called for both 2d image paint and 3d texture paint. in the
- latter case image may be NULL and G.sima may not exist */
-static void imapaint_redraw(int final, int texpaint, Image *image)
-{
- if(final) {
- if(texpaint)
- allqueue(REDRAWIMAGE, 0);
- else if(!G.sima->lock) {
- if(image)
- free_realtime_image(image); /* force OpenGL reload */
- allqueue(REDRAWVIEW3D, 0);
- }
- allqueue(REDRAWHEADERS, 0);
-
- if(!texpaint && image) {
- /* after paint, tag Image or RenderResult nodes changed */
- if(G.scene->nodetree) {
- imagepaint_composite_tags(G.scene->nodetree, image, &G.sima->iuser);
- }
- /* signal composite (hurmf, need an allqueue?) */
- if(G.sima->lock) {
- ScrArea *sa;
- for(sa=G.curscreen->areabase.first; sa; sa= sa->next) {
- if(sa->spacetype==SPACE_NODE) {
- if(((SpaceNode *)sa->spacedata.first)->treetype==NTREE_COMPOSIT) {
- addqueue(sa->win, UI_BUT_EVENT, B_NODE_TREE_EXEC);
- break;
- }
- }
- }
- }
- }
- }
- else if(!texpaint && G.sima->lock)
- force_draw_plus(SPACE_VIEW3D, 0);
- else
- force_draw(0);
-}
-
-void imagepaint_undo()
-{
- Image *ima= imapaintundo.image;
- ImBuf *ibuf= BKE_image_get_ibuf(ima, G.sima?&G.sima->iuser:NULL);
- int x, y, tile;
-
- if (!ima || !ibuf || !(ibuf->rect || ibuf->rect_float))
- return;
-
- for (tile = 0, y = 0; y < imapaintundo.ytiles; y++)
- for (x = 0; x < imapaintundo.xtiles; x++, tile++)
- if (imapaintundo.tiles[tile])
- imapaint_copy_tile(ibuf, tile, x, y, 1);
-
- free_realtime_image(ima); /* force OpenGL reload */
- if(ibuf->rect_float)
- imb_freerectImBuf(ibuf); /* force recreate of char rect */
-
- allqueue(REDRAWIMAGE, 0);
- allqueue(REDRAWVIEW3D, 0);
-}
-
-void free_imagepaint()
-{
- /* todo: does this need to be in the same places as editmode_undo_clear,
- vertex paint isn't? */
- int i, size = imapaintundo.xtiles*imapaintundo.ytiles;
-
- if (imapaintundo.tiles) {
- for (i = 0; i < size; i++)
- if (imapaintundo.tiles[i])
- MEM_freeN(imapaintundo.tiles[i]);
- MEM_freeN(imapaintundo.tiles);
- }
- if (imapaintundo.tilebuf)
- IMB_freeImBuf(imapaintundo.tilebuf);
-
- memset(&imapaintundo, 0, sizeof(imapaintundo));
-}
-
-/* Image Paint Operations */
-
-static void imapaint_ibuf_get_set_rgb(ImBuf *ibuf, int x, int y, short torus, short set, float *rgb)
-{
- if (torus) {
- x %= ibuf->x;
- if (x < 0) x += ibuf->x;
- y %= ibuf->y;
- if (y < 0) y += ibuf->y;
- }
-
- if (ibuf->rect_float) {
- float *rrgbf = ibuf->rect_float + (ibuf->x*y + x)*4;
-
- if (set) IMAPAINT_FLOAT_RGB_COPY(rrgbf, rgb)
- else IMAPAINT_FLOAT_RGB_COPY(rgb, rrgbf)
- }
- else {
- char *rrgb = (char*)ibuf->rect + (ibuf->x*y + x)*4;
-
- if (set) IMAPAINT_FLOAT_RGB_TO_CHAR(rrgb, rgb)
- else IMAPAINT_CHAR_RGB_TO_FLOAT(rgb, rrgb)
- }
-}
-
-static int imapaint_ibuf_add_if(ImBuf *ibuf, unsigned int x, unsigned int y, float *outrgb, short torus)
-{
- float inrgb[3];
-
- if ((x >= ibuf->x) || (y >= ibuf->y)) {
- if (torus) imapaint_ibuf_get_set_rgb(ibuf, x, y, 1, 0, inrgb);
- else return 0;
- }
- else imapaint_ibuf_get_set_rgb(ibuf, x, y, 0, 0, inrgb);
-
- outrgb[0] += inrgb[0];
- outrgb[1] += inrgb[1];
- outrgb[2] += inrgb[2];
-
- return 1;
-}
-
-static void imapaint_lift_soften(ImBuf *ibuf, ImBuf *ibufb, int *pos, short torus)
-{
- int x, y, count, xi, yi, xo, yo;
- int out_off[2], in_off[2], dim[2];
- float outrgb[3];
-
- dim[0] = ibufb->x;
- dim[1] = ibufb->y;
- in_off[0] = pos[0];
- in_off[1] = pos[1];
- out_off[0] = out_off[1] = 0;
-
- if (!torus) {
- IMB_rectclip(ibuf, ibufb, &in_off[0], &in_off[1], &out_off[0],
- &out_off[1], &dim[0], &dim[1]);
-
- if ((dim[0] == 0) || (dim[1] == 0))
- return;
- }
-
- for (y=0; y < dim[1]; y++) {
- for (x=0; x < dim[0]; x++) {
- /* get input pixel */
- xi = in_off[0] + x;
- yi = in_off[1] + y;
-
- count = 1;
- imapaint_ibuf_get_set_rgb(ibuf, xi, yi, torus, 0, outrgb);
-
- count += imapaint_ibuf_add_if(ibuf, xi-1, yi-1, outrgb, torus);
- count += imapaint_ibuf_add_if(ibuf, xi-1, yi , outrgb, torus);
- count += imapaint_ibuf_add_if(ibuf, xi-1, yi+1, outrgb, torus);
-
- count += imapaint_ibuf_add_if(ibuf, xi , yi-1, outrgb, torus);
- count += imapaint_ibuf_add_if(ibuf, xi , yi+1, outrgb, torus);
-
- count += imapaint_ibuf_add_if(ibuf, xi+1, yi-1, outrgb, torus);
- count += imapaint_ibuf_add_if(ibuf, xi+1, yi , outrgb, torus);
- count += imapaint_ibuf_add_if(ibuf, xi+1, yi+1, outrgb, torus);
-
- outrgb[0] /= count;
- outrgb[1] /= count;
- outrgb[2] /= count;
-
- /* write into brush buffer */
- xo = out_off[0] + x;
- yo = out_off[1] + y;
- imapaint_ibuf_get_set_rgb(ibufb, xo, yo, 0, 1, outrgb);
- }
- }
-}
-
-static void imapaint_lift_smear(ImBuf *ibuf, ImBuf *ibufb, int *pos)
-{
- IMB_rectblend_torus(ibufb, ibuf, 0, 0, pos[0], pos[1],
- ibufb->x, ibufb->y, IMB_BLEND_COPY_RGB);
-}
-
-static ImBuf *imapaint_lift_clone(ImBuf *ibuf, ImBuf *ibufb, int *pos)
-{
- /* note: allocImbuf returns zero'd memory, so regions outside image will
- have zero alpha, and hence not be blended onto the image */
- int w=ibufb->x, h=ibufb->y, destx=0, desty=0, srcx=pos[0], srcy=pos[1];
- ImBuf *clonebuf= IMB_allocImBuf(w, h, ibufb->depth, ibufb->flags, 0);
-
- IMB_rectclip(clonebuf, ibuf, &destx, &desty, &srcx, &srcy, &w, &h);
- IMB_rectblend(clonebuf, ibuf, destx, desty, srcx, srcy, w, h,
- IMB_BLEND_COPY_RGB);
- IMB_rectblend(clonebuf, ibufb, destx, desty, destx, desty, w, h,
- IMB_BLEND_COPY_ALPHA);
-
- return clonebuf;
-}
-
-static void imapaint_convert_brushco(ImBuf *ibufb, float *pos, int *ipos)
-{
- ipos[0]= (int)(pos[0] - ibufb->x/2);
- ipos[1]= (int)(pos[1] - ibufb->y/2);
-}
-
-static int imapaint_paint_op(void *state, ImBuf *ibufb, float *lastpos, float *pos)
-{
- ImagePaintState *s= ((ImagePaintState*)state);
- ImBuf *clonebuf= NULL;
- short torus= s->brush->flag & BRUSH_TORUS;
- short blend= s->blend;
- float *offset= s->brush->clone.offset;
- float liftpos[2];
- int bpos[2], blastpos[2], bliftpos[2];
-
- imapaint_convert_brushco(ibufb, pos, bpos);
-
- /* lift from canvas */
- if(s->tool == PAINT_TOOL_SOFTEN) {
- imapaint_lift_soften(s->canvas, ibufb, bpos, torus);
- }
- else if(s->tool == PAINT_TOOL_SMEAR) {
- if (lastpos[0]==pos[0] && lastpos[1]==pos[1])
- return 0;
-
- imapaint_convert_brushco(ibufb, lastpos, blastpos);
- imapaint_lift_smear(s->canvas, ibufb, blastpos);
- }
- else if(s->tool == PAINT_TOOL_CLONE && s->clonecanvas) {
- liftpos[0]= pos[0] - offset[0]*s->canvas->x;
- liftpos[1]= pos[1] - offset[1]*s->canvas->y;
-
- imapaint_convert_brushco(ibufb, liftpos, bliftpos);
- clonebuf= imapaint_lift_clone(s->clonecanvas, ibufb, bliftpos);
- }
-
- imapaint_dirty_region(s->image, s->canvas, bpos[0], bpos[1], ibufb->x, ibufb->y);
-
- /* blend into canvas */
- if(torus)
- IMB_rectblend_torus(s->canvas, (clonebuf)? clonebuf: ibufb,
- bpos[0], bpos[1], 0, 0, ibufb->x, ibufb->y, blend);
- else
- IMB_rectblend(s->canvas, (clonebuf)? clonebuf: ibufb,
- bpos[0], bpos[1], 0, 0, ibufb->x, ibufb->y, blend);
-
- if(clonebuf) IMB_freeImBuf(clonebuf);
-
- return 1;
-}
-
-/* 2D ImagePaint */
-
-static void imapaint_compute_uvco(short *mval, float *uv)
-{
- areamouseco_to_ipoco(G.v2d, mval, &uv[0], &uv[1]);
-}
-
-/* 3D TexturePaint */
-
-int facesel_face_pick(Mesh *me, short *mval, unsigned int *index, short rect);
-void texpaint_pick_uv(Object *ob, Mesh *mesh, unsigned int faceindex, short *xy, float *mousepos);
-
-static int texpaint_break_stroke(float *prevuv, float *fwuv, float *bkuv, float *uv)
-{
- float d1[2], d2[2];
- float mismatch = Vec2Lenf(fwuv, uv);
- float len1 = Vec2Lenf(prevuv, fwuv);
- float len2 = Vec2Lenf(bkuv, uv);
-
- Vec2Subf(d1, fwuv, prevuv);
- Vec2Subf(d2, uv, bkuv);
-
- return ((Inp2f(d1, d2) < 0.0f) || (mismatch > MAX2(len1, len2)*2));
-}
-
-/* ImagePaint Common */
-
-static int imapaint_canvas_set(ImagePaintState *s, Image *ima)
-{
- ImBuf *ibuf= BKE_image_get_ibuf(ima, G.sima?&G.sima->iuser:NULL);
-
- /* verify that we can paint and set canvas */
- if(ima->packedfile && ima->rr) {
- s->warnpackedfile = ima->id.name + 2;
- return 0;
- }
- else if(ibuf && ibuf->channels!=4) {
- s->warnmultifile = ima->id.name + 2;
- return 0;
- }
- else if(!ima || !ibuf || !(ibuf->rect || ibuf->rect_float))
- return 0;
-
- s->image= ima;
- s->canvas= ibuf;
-
- /* set clone canvas */
- if(s->tool == PAINT_TOOL_CLONE) {
- ima= s->brush->clone.image;
- ibuf= BKE_image_get_ibuf(ima, G.sima?&G.sima->iuser:NULL);
-
- if(!ima || !ibuf || !(ibuf->rect || ibuf->rect_float))
- return 0;
-
- s->clonecanvas= ibuf;
-
- if(s->canvas->rect_float && !s->clonecanvas->rect_float) {
- /* temporarily add float rect for cloning */
- IMB_float_from_rect(s->clonecanvas);
- s->clonefreefloat= 1;
- }
- else if(!s->canvas->rect_float && !s->clonecanvas->rect)
- IMB_rect_from_float(s->clonecanvas);
- }
-
- return 1;
-}
-
-static void imapaint_canvas_free(ImagePaintState *s)
-{
- if (s->clonefreefloat)
- imb_freerectfloatImBuf(s->clonecanvas);
-}
-
-static int imapaint_paint_sub_stroke(ImagePaintState *s, BrushPainter *painter, Image *image, short texpaint, float *uv, double time, int update, float pressure)
-{
- ImBuf *ibuf= BKE_image_get_ibuf(image, G.sima?&G.sima->iuser:NULL);
- float pos[2];
-
- if(!ibuf)
- return 0;
-
- pos[0] = uv[0]*ibuf->x;
- pos[1] = uv[1]*ibuf->y;
-
- brush_painter_require_imbuf(painter, ((ibuf->rect_float)? 1: 0), 0, 0);
-
- if (brush_painter_paint(painter, imapaint_paint_op, pos, time, pressure, s)) {
- if (update)
- imapaint_image_update(image, ibuf, texpaint);
- return 1;
- }
- else return 0;
-}
-
-static void imapaint_paint_stroke(ImagePaintState *s, BrushPainter *painter, short texpaint, short *prevmval, short *mval, double time, float pressure)
-{
- Image *newimage = NULL;
- float fwuv[2], bkuv[2], newuv[2];
- unsigned int newfaceindex;
- int breakstroke = 0, redraw = 0;
-
- if (texpaint) {
-
- /* pick new face and image */
- if (facesel_face_pick(s->me, mval, &newfaceindex, 0)) {
- ImBuf *ibuf;
-
- newimage = (Image*)((s->me->mtface+newfaceindex)->tpage);
- ibuf= BKE_image_get_ibuf(newimage, G.sima?&G.sima->iuser:NULL);
-
- if(ibuf && ibuf->rect)
- texpaint_pick_uv(s->ob, s->me, newfaceindex, mval, newuv);
- else
- newimage = NULL;
- }
- else
- newuv[0] = newuv[1] = 0.0f;
-
- /* see if stroke is broken, and if so finish painting in old position */
- if (s->image) {
- texpaint_pick_uv(s->ob, s->me, s->faceindex, mval, fwuv);
- texpaint_pick_uv(s->ob, s->me, newfaceindex, prevmval, bkuv);
-
- if (newimage == s->image)
- breakstroke= texpaint_break_stroke(s->uv, fwuv, bkuv, newuv);
- else
- breakstroke= 1;
- }
- else
- fwuv[0]= fwuv[1]= 0.0f;
-
- if (breakstroke) {
- texpaint_pick_uv(s->ob, s->me, s->faceindex, mval, fwuv);
- redraw |= imapaint_paint_sub_stroke(s, painter, s->image, texpaint,
- fwuv, time, 1, pressure);
- imapaint_clear_partial_redraw();
- brush_painter_break_stroke(painter);
- }
-
- /* set new canvas */
- if (newimage && (newimage != s->image))
- if (!imapaint_canvas_set(s, newimage))
- newimage = NULL;
-
- /* paint in new image */
- if (newimage) {
- if (breakstroke)
- redraw|= imapaint_paint_sub_stroke(s, painter, newimage,
- texpaint, bkuv, time, 0, pressure);
- redraw|= imapaint_paint_sub_stroke(s, painter, newimage, texpaint,
- newuv, time, 1, pressure);
- }
-
- /* update state */
- s->image = newimage;
- s->faceindex = newfaceindex;
- s->uv[0] = newuv[0];
- s->uv[1] = newuv[1];
- }
- else {
- imapaint_compute_uvco(mval, newuv);
- redraw |= imapaint_paint_sub_stroke(s, painter, s->image, texpaint, newuv,
- time, 1, pressure);
- }
-
- if (redraw) {
- imapaint_redraw(0, texpaint, NULL);
- imapaint_clear_partial_redraw();
- }
-}
-
-void imagepaint_paint(short mousebutton, short texpaint)
-{
- ImagePaintState s;
- BrushPainter *painter;
- ToolSettings *settings= G.scene->toolsettings;
- short prevmval[2], mval[2];
- double time;
- float pressure;
-
- if(!settings->imapaint.brush)
- return;
-
- /* initialize state */
- memset(&s, 0, sizeof(s));
- s.brush = settings->imapaint.brush;
- s.tool = settings->imapaint.tool;
- if(texpaint && (s.tool == PAINT_TOOL_CLONE))
- s.tool = PAINT_TOOL_DRAW;
- s.blend = s.brush->blend;
-
- if(texpaint) {
- s.ob = OBACT;
- if (!s.ob || !(s.ob->lay & G.vd->lay)) return;
- s.me = get_mesh(s.ob);
- if (!s.me) return;
-
- persp(PERSP_VIEW);
- }
- else {
- s.image = G.sima->image;
-
- if(!imapaint_canvas_set(&s, G.sima->image)) {
- if(s.warnmultifile)
- error("Image requires 4 color channels to paint");
- if(s.warnpackedfile)
- error("Packed MultiLayer files cannot be painted");
- return;
- }
- }
-
- settings->imapaint.flag |= IMAGEPAINT_DRAWING;
- free_imagepaint();
-
- /* create painter and paint once */
- painter= brush_painter_new(s.brush);
-
- getmouseco_areawin(mval);
-
- pressure = get_pressure();
- s.blend = (get_activedevice() == 2)? BRUSH_BLEND_ERASE_ALPHA: s.brush->blend;
-
- time= PIL_check_seconds_timer();
- prevmval[0]= mval[0];
- prevmval[1]= mval[1];
-
- /* special exception here for too high pressure values on first touch in
- windows for some tablets */
- if (!((s.brush->flag & (BRUSH_ALPHA_PRESSURE|BRUSH_SIZE_PRESSURE|
- BRUSH_SPACING_PRESSURE|BRUSH_RAD_PRESSURE)) && (get_activedevice() != 0) && (pressure >= 0.99f)))
- imapaint_paint_stroke(&s, painter, texpaint, prevmval, mval, time, pressure);
-
- /* paint loop */
- do {
- getmouseco_areawin(mval);
-
- pressure = get_pressure();
- s.blend = (get_activedevice() == 2)? BRUSH_BLEND_ERASE_ALPHA: s.brush->blend;
-
- time= PIL_check_seconds_timer();
-
- if((mval[0] != prevmval[0]) || (mval[1] != prevmval[1])) {
- imapaint_paint_stroke(&s, painter, texpaint, prevmval, mval, time, pressure);
- prevmval[0]= mval[0];
- prevmval[1]= mval[1];
- }
- else if (s.brush->flag & BRUSH_AIRBRUSH)
- imapaint_paint_stroke(&s, painter, texpaint, prevmval, mval, time, pressure);
- else
- BIF_wait_for_statechange();
-
- /* do mouse checking at the end, so don't check twice, and potentially
- miss a short tap */
- } while(get_mbut() & mousebutton);
-
- /* clean up */
- settings->imapaint.flag &= ~IMAGEPAINT_DRAWING;
- imapaint_canvas_free(&s);
- brush_painter_free(painter);
-
- imapaint_redraw(1, texpaint, s.image);
-
- if (texpaint) {
- if (s.warnmultifile)
- error("Image requires 4 color channels to paint: %s", s.warnmultifile);
- if(s.warnpackedfile)
- error("Packed MultiLayer files cannot be painted %s", s.warnpackedfile);
-
- persp(PERSP_WIN);
- }
-}
-
-void imagepaint_pick(short mousebutton)
-{
- ToolSettings *settings= G.scene->toolsettings;
- Brush *brush= settings->imapaint.brush;
-
- if(brush && (settings->imapaint.tool == PAINT_TOOL_CLONE)) {
- if(brush->clone.image) {
- short prevmval[2], mval[2];
- float lastmousepos[2], mousepos[2];
-
- getmouseco_areawin(prevmval);
-
- while(get_mbut() & mousebutton) {
- getmouseco_areawin(mval);
-
- if((prevmval[0] != mval[0]) || (prevmval[1] != mval[1]) ) {
- /* mouse moved, so move the clone image */
- imapaint_compute_uvco(prevmval, lastmousepos);
- imapaint_compute_uvco(mval, mousepos);
-
- brush->clone.offset[0] += mousepos[0] - lastmousepos[0];
- brush->clone.offset[1] += mousepos[1] - lastmousepos[1];
-
- force_draw(0);
-
- prevmval[0]= mval[0];
- prevmval[1]= mval[1];
- }
- }
- }
- }
- else if(brush)
- sample_vpaint();
-}
-
diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c
deleted file mode 100644
index a17e488ef13..00000000000
--- a/source/blender/src/interface.c
+++ /dev/null
@@ -1,6699 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-/*
- a full doc with API notes can be found in bf-blender/blender/doc/interface_API.txt
-
- */
-
-
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef WIN32
-#include <unistd.h>
-#else
-#include <io.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "PIL_time.h"
-
-#include "BMF_Api.h"
-#include "BIF_language.h"
-#ifdef INTERNATIONAL
-#include "FTF_Api.h"
-#endif // INTERNATIONAL
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "DNA_color_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_vec_types.h"
-#include "DNA_object_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_vfont_types.h"
-
-#include "BKE_blender.h"
-#include "BKE_colortools.h"
-#include "BKE_global.h"
-#include "BKE_library.h"
-#include "BKE_texture.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_cursors.h"
-#include "BIF_gl.h"
-#include "BIF_graphics.h"
-#include "BIF_keyval.h"
-#include "BIF_mainqueue.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_toolbox.h"
-#include "BIF_mywindow.h"
-#include "BIF_space.h"
-#include "BIF_glutil.h"
-#include "BIF_editfont.h"
-#include "BIF_interface.h"
-#include "BIF_interface_icons.h"
-#include "BIF_butspace.h"
-#include "BIF_previewrender.h"
-
-#include "BSE_view.h"
-
-#include "BPY_extern.h" /* for BPY_button_eval */
-
-#include "GHOST_Types.h" /* for tablet data */
-
-#include "mydevice.h"
-#include "interface.h"
-#include "blendef.h"
-#include "winlay.h"
-
-#define INSIDE_BLOCK 1
-#define INSIDE_PANEL_HEADER 2
-#define INSIDE_PANEL_SCALE 3
-
-/* naming conventions:
- *
- * uiBlahBlah() external function
- * ui_blah_blah() internal function
- */
-
-/***/
-/* ************ GLOBALS ************* */
-
-float UIwinmat[4][4];
-static int UIlock= 0, UIafterval;
-static char *UIlockstr=NULL;
-
-static void (*UIafterfunc_butm)(void *arg, int event);
-static void (*UIafterfunc_but)(void *arg1, void *arg2);
-static void *UIafterfunc_arg1, *UIafterfunc_arg2;
-
-static uiFont UIfont[UI_ARRAY]; // no init needed
-uiBut *UIbuttip;
-
-static char but_copypaste_str[256]="";
-static double but_copypaste_val=0.0;
-static float but_copypaste_rgb[3];
-static ColorBand but_copypaste_coba;
-
-/* ************* PROTOTYPES ***************** */
-
-static void ui_set_but_val(uiBut *but, double value);
-static void ui_do_but_tip(uiBut *buttip);
-
-/* ****************************** */
-
-static int uibut_contains_pt(uiBut *but, short *pt)
-{
- return ((but->x1<pt[0] && but->x2>=pt[0]) &&
- (but->y1<pt[1] && but->y2>=pt[1]));
-}
-
-static void uibut_do_func(uiBut *but)
-{
- if (but->func) {
- but->func(but->func_arg1, but->func_arg2);
- }
-}
-
-/* ************* window matrix ************** */
-
-
-void ui_graphics_to_window(int win, float *x, float *y) /* for rectwrite */
-{
- float gx, gy;
- int sx, sy;
- int getsizex, getsizey;
-
- bwin_getsize(win, &getsizex, &getsizey);
- bwin_getsuborigin(win, &sx, &sy);
-
- gx= *x;
- gy= *y;
- *x= ((float)sx) + ((float)getsizex)*(0.5+ 0.5*(gx*UIwinmat[0][0]+ gy*UIwinmat[1][0]+ UIwinmat[3][0]));
- *y= ((float)sy) + ((float)getsizey)*(0.5+ 0.5*(gx*UIwinmat[0][1]+ gy*UIwinmat[1][1]+ UIwinmat[3][1]));
-}
-
-void ui_graphics_to_window_rct(int win, rctf *graph, rcti *winr)
-{
- float gx, gy;
- int sx, sy;
- int getsizex, getsizey;
-
- bwin_getsize(win, &getsizex, &getsizey);
- bwin_getsuborigin(win, &sx, &sy);
-
- gx= graph->xmin;
- gy= graph->ymin;
- winr->xmin= (int)((float)sx) + ((float)getsizex)*(0.5+ 0.5*(gx*UIwinmat[0][0]+ gy*UIwinmat[1][0]+ UIwinmat[3][0]));
- winr->ymin= (int)((float)sy) + ((float)getsizey)*(0.5+ 0.5*(gx*UIwinmat[0][1]+ gy*UIwinmat[1][1]+ UIwinmat[3][1]));
- gx= graph->xmax;
- gy= graph->ymax;
- winr->xmax= (int)((float)sx) + ((float)getsizex)*(0.5+ 0.5*(gx*UIwinmat[0][0]+ gy*UIwinmat[1][0]+ UIwinmat[3][0]));
- winr->ymax= (int)((float)sy) + ((float)getsizey)*(0.5+ 0.5*(gx*UIwinmat[0][1]+ gy*UIwinmat[1][1]+ UIwinmat[3][1]));
-}
-
-
-void ui_window_to_graphics(int win, float *x, float *y) /* for mouse cursor */
-{
- float a, b, c, d, e, f, px, py;
- int getsizex, getsizey;
-
- bwin_getsize(win, &getsizex, &getsizey);
-
- a= .5*((float)getsizex)*UIwinmat[0][0];
- b= .5*((float)getsizex)*UIwinmat[1][0];
- c= .5*((float)getsizex)*(1.0+UIwinmat[3][0]);
-
- d= .5*((float)getsizey)*UIwinmat[0][1];
- e= .5*((float)getsizey)*UIwinmat[1][1];
- f= .5*((float)getsizey)*(1.0+UIwinmat[3][1]);
-
- px= *x;
- py= *y;
-
- *y= (a*(py-f) + d*(c-px))/(a*e-d*b);
- *x= (px- b*(*y)- c)/a;
-
-}
-
-
-/* ************* SAVE UNDER ************ */
-
-/* new method:
-
-OverDraw *ui_begin_overdraw(int minx, int miny, int maxx, int maxy);
-- enforces mainwindow to become active
-- grabs copy from frontbuffer, pastes in back
-
-void ui_flush_overdraw(OverDraw *od);
-- copies backbuffer to front
-
-void ui_refresh_overdraw(Overdraw *od);
-- pastes in back copy of frontbuffer again for fresh drawing
-
-void ui_end_overdraw(OverDraw *od);
-- puts back on frontbuffer saved image
-- frees copy
-- sets back active blender area
-- signals backbuffer to be corrupt (sel buffer!)
-
-*/
-
-/* frontbuffer updates now glCopyPixels too, with block->flush rect */
-
-/* new idea for frontbuffer updates:
-
-- hilites: with blended poly?
-
-- full updates... thats harder, but:
- - copy original
- - before draw, always paste to backbuf
- - flush
- - always end with redraw event for full update
-
-*/
-
-static void myglCopyPixels(int a, int b, int c, int d, int e)
-{
- if(G.rt==2) {
- unsigned int *buf= MEM_mallocN(4*c*d, "temp glcopypixels");
- glReadPixels(a, b, c, d, GL_RGBA, GL_UNSIGNED_BYTE, buf);
- glDrawPixels(c, d, GL_RGBA, GL_UNSIGNED_BYTE, buf);
- MEM_freeN(buf);
- }
- else glCopyPixels(a, b, c, d, e);
-}
-
-typedef struct {
- short x, y, sx, sy, oldwin;
- unsigned int *rect;
-} uiOverDraw;
-
-
-static uiOverDraw *ui_begin_overdraw(int minx, int miny, int maxx, int maxy)
-{
- uiOverDraw *od=NULL;
-
- // dirty patch removed for sun and sgi to mywindow.c commented out
-
- /* clip with actual window size */
- if(minx < 0) minx= 0;
- if(miny < 0) miny= 0;
- if(maxx >= G.curscreen->sizex) maxx= G.curscreen->sizex-1;
- if(maxy >= G.curscreen->sizey) maxy= G.curscreen->sizey-1;
-
- if(minx<maxx && miny<maxy) {
- od= MEM_callocN(sizeof(uiOverDraw), "overdraw");
-
- od->x= minx;
- od->y= miny;
- od->sx= maxx-minx;
- od->sy= maxy-miny;
- od->rect= MEM_mallocN(od->sx*od->sy*4, "temp_frontbuffer_image");
-
- od->oldwin= mywinget();
- mywinset(G.curscreen->mainwin);
- /* grab front */
- glReadBuffer(GL_FRONT);
- glReadPixels(od->x, od->y, od->sx, od->sy, GL_RGBA, GL_UNSIGNED_BYTE, od->rect);
- glReadBuffer(GL_BACK);
- /* paste in back */
- glDisable(GL_DITHER);
- glRasterPos2f(od->x, od->y);
- glDrawPixels(od->sx, od->sy, GL_RGBA, GL_UNSIGNED_BYTE, od->rect);
- glEnable(GL_DITHER);
- }
-
- return od;
-}
-
-static void ui_flush_overdraw(uiOverDraw *od)
-{
-
- if(od==NULL) return;
- glDisable(GL_DITHER);
- glReadBuffer(GL_BACK);
- glDrawBuffer(GL_FRONT);
- glRasterPos2s(od->x, od->y);
- myglCopyPixels(od->x, od->y, od->sx, od->sy, GL_COLOR);
- glEnable(GL_DITHER);
- bglFlush();
- glDrawBuffer(GL_BACK);
-}
-
-/* special flush version to enable transparent menus */
-static void ui_block_flush_overdraw(uiBlock *block)
-{
-
- if(block->flag & UI_BLOCK_LOOP) {
- char col[4];
-
- BIF_GetThemeColor4ubv(TH_MENU_BACK, col);
- if(col[3]!=255) {
- uiBut *bt;
- uiOverDraw *od= block->overdraw;
-
- /* completely draw all! */
- glRasterPos2s(od->x, od->y);
- glDrawPixels(od->sx, od->sy, GL_RGBA, GL_UNSIGNED_BYTE, od->rect);
-
- uiDrawMenuBox(block->minx, block->miny, block->maxx, block->maxy, block->flag);
- for (bt= block->buttons.first; bt; bt= bt->next) {
- ui_draw_but(bt);
- }
- }
- }
-
- ui_flush_overdraw(block->overdraw);
-}
-
-static void ui_end_overdraw(uiOverDraw *od)
-{
- if(od==NULL) return;
-
- glDisable(GL_DITHER);
-
- // clear in back
- glRasterPos2s(od->x, od->y);
- glDrawPixels(od->sx, od->sy, GL_RGBA, GL_UNSIGNED_BYTE, od->rect);
-
- // clear in front
- glDrawBuffer(GL_FRONT);
- glRasterPos2s(od->x, od->y);
- glDrawPixels(od->sx, od->sy, GL_RGBA, GL_UNSIGNED_BYTE, od->rect);
-
- bglFlush();
- glDrawBuffer(GL_BACK);
- glEnable(GL_DITHER);
-
- if(od->oldwin) mywinset(od->oldwin);
-
- MEM_freeN(od->rect);
- MEM_freeN(od);
-
- markdirty_all_back(); // sets flags only
-}
-
-/* ****************** live updates for hilites and button presses *********** */
-
-void ui_block_flush_back(uiBlock *block)
-{
- int minx, miny, sizex, sizey;
-
- /* note; this routine also has to work for block loop */
- if(block->needflush==0) return;
-
- /* exception, when we cannot use backbuffer for draw... */
- if(block->flag & UI_BLOCK_FRONTBUFFER) {
- bglFlush();
- glDrawBuffer(GL_BACK);
- block->needflush= 0;
- return;
- }
-
- /* copy pixels works on window coords, so we move to window space */
-
- ui_graphics_to_window(block->win, &block->flush.xmin, &block->flush.ymin);
- ui_graphics_to_window(block->win, &block->flush.xmax, &block->flush.ymax);
- minx= floor(block->flush.xmin);
- miny= floor(block->flush.ymin);
- sizex= ceil(block->flush.xmax-block->flush.xmin);
- sizey= ceil(block->flush.ymax-block->flush.ymin);
-
- if(sizex>0 && sizey>0) {
- glPushMatrix();
- mywinset(G.curscreen->mainwin);
-
- glDisable(GL_DITHER);
- glReadBuffer(GL_BACK);
- glDrawBuffer(GL_FRONT);
- glRasterPos2i(minx, miny);
-#ifdef __sun__
- myglCopyPixels(minx, miny+1, sizex, sizey, GL_COLOR);
-#else
- myglCopyPixels(minx, miny, sizex, sizey, GL_COLOR);
-#endif
- glEnable(GL_DITHER);
- bglFlush();
- glDrawBuffer(GL_BACK);
-
- mywinset(block->win);
- glPopMatrix();
-
- markdirty_win_back(block->win);
- }
-
- block->needflush= 0;
-}
-
-/* merge info for live updates in frontbuf */
-void ui_block_set_flush(uiBlock *block, uiBut *but)
-{
- /* clear signal */
- if(but==NULL) {
- block->needflush= 0;
-
- block->flush.xmin= 0.0;
- block->flush.xmax= 0.0;
- }
- else {
- /* exception, when we cannot use backbuffer for draw... */
- if(block->flag & UI_BLOCK_FRONTBUFFER) {
- glDrawBuffer(GL_FRONT);
- }
- else if(block->needflush==0) {
- /* first rect */
- block->flush.xmin= but->x1;
- block->flush.xmax= but->x2;
- block->flush.ymin= but->y1;
- block->flush.ymax= but->y2;
-
- }
- else {
- /* union of rects */
- if(block->flush.xmin > but->x1) block->flush.xmin= but->x1;
- if(block->flush.xmax < but->x2) block->flush.xmax= but->x2;
- if(block->flush.ymin > but->y1) block->flush.ymin= but->y1;
- if(block->flush.ymax < but->y2) block->flush.ymax= but->y2;
- }
-
- block->needflush= 1;
-
- }
-}
-
-/* ******************* copy and paste ******************** */
-
-/* c = copy, v = paste */
-/* return 1 when something changed */
-static int ui_but_copy_paste(uiBut *but, char mode)
-{
- void *poin;
-
- if(mode=='v' && but->lock) return 0;
- poin= but->poin;
-
- if ELEM3(but->type, NUM, NUMSLI, HSVSLI) {
-
- if(poin==NULL);
- else if(mode=='c') {
- but_copypaste_val= ui_get_but_val(but);
- }
- else {
- ui_set_but_val(but, but_copypaste_val);
- uibut_do_func(but);
- ui_check_but(but);
- return 1;
- }
- }
- else if(but->type==COL) {
-
- if(poin==NULL);
- else if(mode=='c') {
- if(but->pointype==FLO) {
- float *fp= (float *) poin;
- but_copypaste_rgb[0]= fp[0];
- but_copypaste_rgb[1]= fp[1];
- but_copypaste_rgb[2]= fp[2];
- }
- else if (but->pointype==CHA) {
- char *cp= (char *) poin;
- but_copypaste_rgb[0]= (float)(cp[0]/255.0);
- but_copypaste_rgb[1]= (float)(cp[1]/255.0);
- but_copypaste_rgb[2]= (float)(cp[2]/255.0);
- }
-
- }
- else {
- if(but->pointype==FLO) {
- float *fp= (float *) poin;
- fp[0] = but_copypaste_rgb[0];
- fp[1] = but_copypaste_rgb[1];
- fp[2] = but_copypaste_rgb[2];
- return 1;
- }
- else if (but->pointype==CHA) {
- char *cp= (char *) poin;
- cp[0] = (char)(but_copypaste_rgb[0]*255.0);
- cp[1] = (char)(but_copypaste_rgb[1]*255.0);
- cp[2] = (char)(but_copypaste_rgb[2]*255.0);
-
- return 1;
- }
-
- }
- }
- else if(but->type==TEX) {
- if(poin==NULL);
- else if(mode=='c') {
- strncpy(but_copypaste_str, but->poin, but->max);
- }
- else {
- char backstr[UI_MAX_DRAW_STR];
- /* give butfunc the original text too */
- /* feature used for bone renaming, channels, etc */
- if(but->func_arg2==NULL) {
- strncpy(backstr, but->drawstr, UI_MAX_DRAW_STR);
- but->func_arg2= backstr;
- }
- strncpy(but->poin, but_copypaste_str, but->max);
- uibut_do_func(but);
- ui_check_but(but);
- return 1;
- }
- }
- else if(but->type==IDPOIN) {
- if(mode=='c') {
- ID *id= *but->idpoin_idpp;
- if(id) strncpy(but_copypaste_str, id->name+2, 22);
- }
- else {
- but->idpoin_func(but_copypaste_str, but->idpoin_idpp);
- ui_check_but(but);
- return 1;
- }
- }
- else if(but->type==BUT_COLORBAND) {
- if(mode=='c') {
- if (!but->poin) {
- return 0;
- }
- memcpy( &but_copypaste_coba, but->poin, sizeof(ColorBand) );
- } else {
- if (but_copypaste_coba.tot==0) {
- return 0;
- }
- if (!but->poin) {
- but->poin= MEM_callocN( sizeof(ColorBand), "colorband");
- }
- memcpy( but->poin, &but_copypaste_coba, sizeof(ColorBand) );
- return 1;
- }
- }
-
- return 0;
-}
-
-/* ******************* block calc ************************* */
-
-/* only for pulldowns */
-void uiTextBoundsBlock(uiBlock *block, int addval)
-{
- uiBut *bt;
- int i = 0, j, x1addval= 0, nextcol;
-
- bt= block->buttons.first;
- while(bt) {
- if(bt->type!=SEPR) {
- int transopts= (U.transopts & USER_TR_BUTTONS);
- if(bt->type==TEX || bt->type==IDPOIN) transopts= 0;
- j= BIF_GetStringWidth(bt->font, bt->drawstr, transopts);
-
- if(j > i) i = j;
- }
- bt= bt->next;
- }
-
- /* cope with multi collumns */
- bt= block->buttons.first;
- while(bt) {
- if(bt->next && bt->x1 < bt->next->x1)
- nextcol= 1;
- else nextcol= 0;
-
- bt->x1 = x1addval;
- bt->x2 = bt->x1 + i + addval;
-
- ui_check_but(bt); // clips text again
-
- if(nextcol)
- x1addval+= i + addval;
-
- bt= bt->next;
- }
-}
-
-
-void uiBoundsBlock(uiBlock *block, int addval)
-{
- uiBut *bt;
- int xof;
-
- if(block->buttons.first==NULL) {
- if(block->panel) {
- block->minx= 0.0; block->maxx= block->panel->sizex;
- block->miny= 0.0; block->maxy= block->panel->sizey;
- }
- }
- else {
-
- block->minx= block->miny= 10000;
- block->maxx= block->maxy= -10000;
-
- bt= block->buttons.first;
- while(bt) {
- if(bt->x1 < block->minx) block->minx= bt->x1;
- if(bt->y1 < block->miny) block->miny= bt->y1;
-
- if(bt->x2 > block->maxx) block->maxx= bt->x2;
- if(bt->y2 > block->maxy) block->maxy= bt->y2;
-
- bt= bt->next;
- }
-
- block->minx -= addval;
- block->miny -= addval;
- block->maxx += addval;
- block->maxy += addval;
- }
-
- /* hardcoded exception... but that one is annoying with larger safety */
- bt= block->buttons.first;
- if(bt && strncmp(bt->str, "ERROR", 5)==0) xof= 10;
- else xof= 40;
-
- block->safety.xmin= block->minx-xof;
- block->safety.ymin= block->miny-xof;
- block->safety.xmax= block->maxx+xof;
- block->safety.ymax= block->maxy+xof;
-}
-
-static void ui_positionblock(uiBlock *block, uiBut *but)
-{
- /* position block relative to but */
- uiBut *bt;
- rctf butrct;
- float aspect;
- int xsize, ysize, xof=0, yof=0, center;
- short dir1= 0, dir2=0;
-
- /* first transform to screen coords, assuming matrix is stil OK */
- /* the UIwinmat is in panelspace */
-
- butrct.xmin= but->x1; butrct.xmax= but->x2;
- butrct.ymin= but->y1; butrct.ymax= but->y2;
-
- ui_graphics_to_window(block->win, &butrct.xmin, &butrct.ymin);
- ui_graphics_to_window(block->win, &butrct.xmax, &butrct.ymax);
- block->parentrct= butrct; // will use that for pulldowns later
-
- /* calc block rect */
- if(block->buttons.first) {
- block->minx= block->miny= 10000;
- block->maxx= block->maxy= -10000;
-
- bt= block->buttons.first;
- while(bt) {
- if(bt->x1 < block->minx) block->minx= bt->x1;
- if(bt->y1 < block->miny) block->miny= bt->y1;
-
- if(bt->x2 > block->maxx) block->maxx= bt->x2;
- if(bt->y2 > block->maxy) block->maxy= bt->y2;
-
- bt= bt->next;
- }
- }
- else {
- /* we're nice and allow empty blocks too */
- block->minx= block->miny= 0;
- block->maxx= block->maxy= 20;
- }
-
- aspect= (float)(block->maxx - block->minx + 4);
- ui_graphics_to_window(block->win, &block->minx, &block->miny);
- ui_graphics_to_window(block->win, &block->maxx, &block->maxy);
-
- //block->minx-= 2.0; block->miny-= 2.0;
- //block->maxx+= 2.0; block->maxy+= 2.0;
-
- xsize= block->maxx - block->minx+4; // 4 for shadow
- ysize= block->maxy - block->miny+4;
- aspect/= (float)xsize;
-
- if(but) {
- short left=0, right=0, top=0, down=0;
-
- if(block->direction & UI_CENTER) center= ysize/2;
- else center= 0;
-
- if( butrct.xmin-xsize > 0.0) left= 1;
- if( butrct.xmax+xsize < G.curscreen->sizex) right= 1;
- if( butrct.ymin-ysize+center > 0.0) down= 1;
- if( butrct.ymax+ysize-center < G.curscreen->sizey) top= 1;
-
- dir1= block->direction & UI_DIRECTION;
-
- /* secundary directions */
- if(dir1 & (UI_TOP|UI_DOWN)) {
- if(dir1 & UI_LEFT) dir2= UI_LEFT;
- else if(dir1 & UI_RIGHT) dir2= UI_RIGHT;
- dir1 &= (UI_TOP|UI_DOWN);
- }
-
- if(dir2==0) if(dir1==UI_LEFT || dir1==UI_RIGHT) dir2= UI_DOWN;
- if(dir2==0) if(dir1==UI_TOP || dir1==UI_DOWN) dir2= UI_LEFT;
-
- /* no space at all? dont change */
- if(left || right) {
- if(dir1==UI_LEFT && left==0) dir1= UI_RIGHT;
- if(dir1==UI_RIGHT && right==0) dir1= UI_LEFT;
- /* this is aligning, not append! */
- if(dir2==UI_LEFT && right==0) dir2= UI_RIGHT;
- if(dir2==UI_RIGHT && left==0) dir2= UI_LEFT;
- }
- if(down || top) {
- if(dir1==UI_TOP && top==0) dir1= UI_DOWN;
- if(dir1==UI_DOWN && down==0) dir1= UI_TOP;
- if(dir2==UI_TOP && top==0) dir2= UI_DOWN;
- if(dir2==UI_DOWN && down==0) dir2= UI_TOP;
- }
-
- if(dir1==UI_LEFT) {
- xof= butrct.xmin - block->maxx;
- if(dir2==UI_TOP) yof= butrct.ymin - block->miny-center;
- else yof= butrct.ymax - block->maxy+center;
- }
- else if(dir1==UI_RIGHT) {
- xof= butrct.xmax - block->minx;
- if(dir2==UI_TOP) yof= butrct.ymin - block->miny-center;
- else yof= butrct.ymax - block->maxy+center;
- }
- else if(dir1==UI_TOP) {
- yof= butrct.ymax - block->miny;
- if(dir2==UI_RIGHT) xof= butrct.xmax - block->maxx;
- else xof= butrct.xmin - block->minx;
- // changed direction?
- if((dir1 & block->direction)==0) {
- if(block->direction & UI_SHIFT_FLIPPED)
- xof+= dir2==UI_LEFT?25:-25;
- uiBlockFlipOrder(block);
- }
- }
- else if(dir1==UI_DOWN) {
- yof= butrct.ymin - block->maxy;
- if(dir2==UI_RIGHT) xof= butrct.xmax - block->maxx;
- else xof= butrct.xmin - block->minx;
- // changed direction?
- if((dir1 & block->direction)==0) {
- if(block->direction & UI_SHIFT_FLIPPED)
- xof+= dir2==UI_LEFT?25:-25;
- uiBlockFlipOrder(block);
- }
- }
-
- /* and now we handle the exception; no space below or to top */
- if(top==0 && down==0) {
- if(dir1==UI_LEFT || dir1==UI_RIGHT) {
- // align with bottom of screen
- yof= ysize;
- }
- }
-
- /* or no space left or right */
- if(left==0 && right==0) {
- if(dir1==UI_TOP || dir1==UI_DOWN) {
- // align with left size of screen
- xof= -block->minx+5;
- }
- }
-
- // apply requested offset in the block
- xof += block->xofs/block->aspect;
- yof += block->yofs/block->aspect;
-
- }
-
- /* apply */
-
- for(bt= block->buttons.first; bt; bt= bt->next) {
-
- ui_graphics_to_window(block->win, &bt->x1, &bt->y1);
- ui_graphics_to_window(block->win, &bt->x2, &bt->y2);
-
- bt->x1 += xof;
- bt->x2 += xof;
- bt->y1 += yof;
- bt->y2 += yof;
-
- bt->aspect= 1.0;
- // ui_check_but recalculates drawstring size in pixels
- ui_check_but(bt);
- }
-
- block->minx += xof;
- block->miny += yof;
- block->maxx += xof;
- block->maxy += yof;
-
- /* safety calculus */
- if(but) {
- float midx= (block->parentrct.xmin+block->parentrct.xmax)/2.0;
- float midy= (block->parentrct.ymin+block->parentrct.ymax)/2.0;
-
- /* when you are outside parent button, safety there should be smaller */
-
- // parent button to left
- if( midx < block->minx ) block->safety.xmin= block->minx-3;
- else block->safety.xmin= block->minx-40;
- // parent button to right
- if( midx > block->maxx ) block->safety.xmax= block->maxx+3;
- else block->safety.xmax= block->maxx+40;
-
- // parent button on bottom
- if( midy < block->miny ) block->safety.ymin= block->miny-3;
- else block->safety.ymin= block->miny-40;
- // parent button on top
- if( midy > block->maxy ) block->safety.ymax= block->maxy+3;
- else block->safety.ymax= block->maxy+40;
-
- // exception for switched pulldowns...
- if(dir1 && (dir1 & block->direction)==0) {
- if(dir2==UI_RIGHT) block->safety.xmax= block->maxx+3;
- if(dir2==UI_LEFT) block->safety.xmin= block->minx-3;
- }
- block->direction= dir1;
- }
- else {
- block->safety.xmin= block->minx-40;
- block->safety.ymin= block->miny-40;
- block->safety.xmax= block->maxx+40;
- block->safety.ymax= block->maxy+40;
- }
-
-}
-
-
-void ui_autofill(uiBlock *block)
-{
- uiBut *but;
- float *maxw, *maxh, startx = 0, starty, height = 0;
- float totmaxh;
- int rows=0, /* cols=0, */ i, lasti;
-
- /* first count rows */
- but= block->buttons.last;
- rows= but->x1+1;
-
- /* calculate max width / height for each row */
- maxw= MEM_callocN(sizeof(float)*rows, "maxw");
- maxh= MEM_callocN(sizeof(float)*rows, "maxh");
- but= block->buttons.first;
- while(but) {
- i= but->x1;
- if( maxh[i] < but->y2) maxh[i]= but->y2;
- maxw[i] += but->x2;
- but= but->next;
- }
-
- totmaxh= 0.0;
- for(i=0; i<rows; i++) totmaxh+= maxh[i];
-
- /* apply widths/heights */
- starty= block->maxy;
- but= block->buttons.first;
- lasti= -1;
- while(but) {
- // signal for aligning code
- but->flag |= UI_BUT_ALIGN_DOWN;
-
- i= but->x1;
-
- if(i!=lasti) {
- startx= block->minx;
- height= (maxh[i]*(block->maxy-block->miny))/totmaxh;
- starty-= height;
- lasti= i;
- }
-
- but->y1= starty+but->aspect;
- but->y2= but->y1+height-but->aspect;
-
- but->x2= (but->x2*(block->maxx-block->minx))/maxw[i];
- but->x1= startx+but->aspect;
-
- startx+= but->x2;
- but->x2+= but->x1-but->aspect;
-
- ui_check_but(but);
-
- but= but->next;
- }
-
- uiBlockEndAlign(block);
-
- MEM_freeN(maxw); MEM_freeN(maxh);
- block->autofill= 0;
-}
-
-/* ************** LINK LINE DRAWING ************* */
-
-/* link line drawing is not part of buttons or theme.. so we stick with it here */
-
-static void ui_draw_linkline(uiBut *but, uiLinkLine *line)
-{
- float vec1[2], vec2[2];
-
- if(line->from==NULL || line->to==NULL) return;
-
- vec1[0]= (line->from->x1+line->from->x2)/2.0;
- vec1[1]= (line->from->y1+line->from->y2)/2.0;
- vec2[0]= (line->to->x1+line->to->x2)/2.0;
- vec2[1]= (line->to->y1+line->to->y2)/2.0;
-
- if(line->flag & UI_SELECT) BIF_ThemeColorShade(but->themecol, 80);
- else glColor3ub(0,0,0);
- fdrawline(vec1[0], vec1[1], vec2[0], vec2[1]);
-}
-
-static void ui_draw_links(uiBlock *block)
-{
- uiBut *but;
- uiLinkLine *line;
-
- but= block->buttons.first;
- while(but) {
- if(but->type==LINK && but->link) {
- line= but->link->lines.first;
- while(line) {
- ui_draw_linkline(but, line);
- line= line->next;
- }
- }
- but= but->next;
- }
-}
-
-/* ************** BLOCK DRAWING FUNCTION ************* */
-
-
-void uiDrawBlock(uiBlock *block)
-{
- uiBut *but;
- short testmouse=0, mouse[2];
-
- /* we set this only once */
- glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
-
- /* handle pending stuff */
- if(block->autofill) ui_autofill(block);
- if(block->minx==0.0 && block->maxx==0.0) uiBoundsBlock(block, 0);
- if(block->flag & UI_BUT_ALIGN) uiBlockEndAlign(block);
-
- /* we set active flag on a redraw again */
- if((block->flag & UI_BLOCK_LOOP)==0) {
- testmouse= 1;
- Mat4CpyMat4(UIwinmat, block->winmat);
- }
-
- uiPanelPush(block); // panel matrix
-
- if(block->flag & UI_BLOCK_LOOP) {
- uiDrawMenuBox(block->minx, block->miny, block->maxx, block->maxy, block->flag);
- }
- else {
- if(block->panel) ui_draw_panel(block);
- }
-
- if(block->drawextra) block->drawextra(curarea, block);
-
- if(testmouse) /* do it after panel push, otherwise coords are wrong */
- uiGetMouse(block->win, mouse);
-
- for (but= block->buttons.first; but; but= but->next) {
-
- if(testmouse && uibut_contains_pt(but, mouse))
- but->flag |= UI_ACTIVE;
-
- ui_draw_but(but);
- }
-
- ui_draw_links(block);
-
- uiPanelPop(block); // matrix restored
-}
-
-/* ************* MENUBUTS *********** */
-
-typedef struct {
- char *str;
- int retval;
- int icon;
-} MenuEntry;
-
-typedef struct {
- char *instr;
- char *title;
- int titleicon;
-
- MenuEntry *items;
- int nitems, itemssize;
-} MenuData;
-
-static MenuData *menudata_new(char *instr) {
- MenuData *md= MEM_mallocN(sizeof(*md), "MenuData");
-
- md->instr= instr;
- md->title= NULL;
- md->titleicon= 0;
- md->items= NULL;
- md->nitems= md->itemssize= 0;
-
- return md;
-}
-
-static void menudata_set_title(MenuData *md, char *title, int titleicon) {
- if (!md->title)
- md->title= title;
- if (!md->titleicon)
- md->titleicon= titleicon;
-}
-
-static void menudata_add_item(MenuData *md, char *str, int retval, int icon) {
- if (md->nitems==md->itemssize) {
- int nsize= md->itemssize?(md->itemssize<<1):1;
- MenuEntry *oitems= md->items;
-
- md->items= MEM_mallocN(nsize*sizeof(*md->items), "md->items");
- if (oitems) {
- memcpy(md->items, oitems, md->nitems*sizeof(*md->items));
- MEM_freeN(oitems);
- }
-
- md->itemssize= nsize;
- }
-
- md->items[md->nitems].str= str;
- md->items[md->nitems].retval= retval;
- md->items[md->nitems].icon= icon;
- md->nitems++;
-}
-
-static void menudata_free(MenuData *md) {
- MEM_freeN(md->instr);
- if (md->items)
- MEM_freeN(md->items);
- MEM_freeN(md);
-}
-
- /**
- * Parse menu description strings, string is of the
- * form "[sss%t|]{(sss[%xNN]|), (%l|)}", ssss%t indicates the
- * menu title, sss or sss%xNN indicates an option,
- * if %xNN is given then NN is the return value if
- * that option is selected otherwise the return value
- * is the index of the option (starting with 1). %l
- * indicates a seperator.
- *
- * @param str String to be parsed.
- * @retval new menudata structure, free with menudata_free()
- */
-static MenuData *decompose_menu_string(char *str)
-{
- char *instr= BLI_strdup(str);
- MenuData *md= menudata_new(instr);
- char *nitem= NULL, *s= instr;
- int nicon=0, nretval= 1, nitem_is_title= 0;
-
- while (1) {
- char c= *s;
-
- if (c=='%') {
- if (s[1]=='x') {
- nretval= atoi(s+2);
-
- *s= '\0';
- s++;
- } else if (s[1]=='t') {
- nitem_is_title= 1;
-
- *s= '\0';
- s++;
- } else if (s[1]=='l') {
- nitem= "%l";
- s++;
- } else if (s[1]=='i') {
- nicon= atoi(s+2);
-
- *s= '\0';
- s++;
- }
- } else if (c=='|' || c=='\0') {
- if (nitem) {
- *s= '\0';
-
- if (nitem_is_title) {
- menudata_set_title(md, nitem, nicon);
- nitem_is_title= 0;
- } else {
- /* prevent separator to get a value */
- if(nitem[0]=='%' && nitem[1]=='l')
- menudata_add_item(md, nitem, -1, nicon);
- else
- menudata_add_item(md, nitem, nretval, nicon);
- nretval= md->nitems+1;
- }
-
- nitem= NULL;
- nicon= 0;
- }
-
- if (c=='\0')
- break;
- } else if (!nitem)
- nitem= s;
-
- s++;
- }
-
- return md;
-}
-
-static void ui_set_name_menu(uiBut *but, int value)
-{
- MenuData *md;
- int i;
-
- md= decompose_menu_string(but->str);
- for (i=0; i<md->nitems; i++)
- if (md->items[i].retval==value)
- strcpy(but->drawstr, md->items[i].str);
-
- menudata_free(md);
-}
-
-static void ui_warp_pointer(short x, short y)
-{
- /* OSX has very poor mousewarp support, it sends events;
- this causes a menu being pressed immediately ... */
- #ifndef __APPLE__
- warp_pointer(x, y);
- #endif
-}
-
-#define TBOXH 20
-static int ui_do_but_MENU(uiBut *but)
-{
- uiBlock *block;
- uiBut *bt;
- ListBase listb={NULL, NULL}, lb;
- double fvalue;
- int width, height=0, a, xmax, starty;
- short startx;
- int columns=1, rows=0, boxh, event;
- short x1, y1, active= -1;
- short mval[2];
- MenuData *md;
-
- but->flag |= UI_SELECT;
- ui_draw_but(but);
- ui_block_flush_back(but->block); // flush because this button creates own blocks loop
-
- block= uiNewBlock(&listb, "menu", UI_EMBOSSP, UI_HELV, but->win);
- block->flag= UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_NUMSELECT;
- block->themecol= TH_MENU_ITEM;
-
- md= decompose_menu_string(but->str);
-
- /* columns and row calculation */
- columns= (md->nitems+20)/20;
- if (columns<1) columns= 1;
-
- if(columns>8) columns= (md->nitems+25)/25;
-
- rows= (int) md->nitems/columns;
- if (rows<1) rows= 1;
-
- while (rows*columns<md->nitems) rows++;
-
- /* prevent scaling up of pupmenu */
- if (but->aspect < 1.0f) but->aspect = 1.0f;
-
- /* size and location */
- if(md->title)
- width= 1.5*but->aspect*strlen(md->title)+BIF_GetStringWidth(block->curfont, md->title, (U.transopts & USER_TR_MENUS));
- else
- width= 0;
-
- for(a=0; a<md->nitems; a++) {
- xmax= but->aspect*BIF_GetStringWidth(block->curfont, md->items[a].str, (U.transopts & USER_TR_MENUS));
- if ( md->items[a].icon) xmax += 20*but->aspect;
- if(xmax>width) width= xmax;
- }
-
- width+= 10;
- if (width < (but->x2 - but->x1)) width = (but->x2 - but->x1);
- if (width<50) width=50;
-
- boxh= TBOXH;
-
- height= rows*boxh;
- if (md->title) height+= boxh;
-
- getmouseco_sc(mval);
-
- /* find active item */
- fvalue= ui_get_but_val(but);
- for(active=0; active<md->nitems; active++) {
- if( md->items[active].retval== (int)fvalue ) break;
- }
- /* no active item? */
- if(active==md->nitems) {
- if(md->title) active= -1;
- else active= 0;
- }
-
- /* for now disabled... works confusing because you think it's a title or so.... */
- active= -1;
-
- /* here we go! */
- startx= but->x1;
- starty= but->y1;
-
- if(md->title) {
- uiBut *bt;
- uiSetCurFont(block, block->font+1);
- if (md->titleicon) {
- uiDefIconTextBut(block, LABEL, 0, md->titleicon, md->title, startx, (short)(starty+rows*boxh), (short)width, (short)boxh, NULL, 0.0, 0.0, 0, 0, "");
- } else {
- bt= uiDefBut(block, LABEL, 0, md->title, startx, (short)(starty+rows*boxh), (short)width, (short)boxh, NULL, 0.0, 0.0, 0, 0, "");
- bt->flag= UI_TEXT_LEFT;
- }
- uiSetCurFont(block, block->font);
-
- }
-
- for(a=0; a<md->nitems; a++) {
-
- x1= but->x1 + width*((int)(md->nitems-a-1)/rows);
- y1= but->y1 - boxh*(rows - ((md->nitems - a - 1)%rows)) + (rows*boxh);
-
- if (strcmp(md->items[md->nitems-a-1].str, "%l")==0) {
- uiDefBut(block, SEPR, B_NOP, "", x1, y1,(short)(width-(rows>1)), (short)(boxh-1), NULL, 0.0, 0.0, 0, 0, "");
- }
- else if(md->items[md->nitems-a-1].icon) {
- uiBut *bt= uiDefIconTextBut(block, BUTM|but->pointype, but->retval, md->items[md->nitems-a-1].icon ,md->items[md->nitems-a-1].str, x1, y1,(short)(width-(rows>1)), (short)(boxh-1), but->poin, (float) md->items[md->nitems-a-1].retval, 0.0, 0, 0, "");
- if(active==a) bt->flag |= UI_ACTIVE;
- }
- else {
- uiBut *bt= uiDefBut(block, BUTM|but->pointype, but->retval, md->items[md->nitems-a-1].str, x1, y1,(short)(width-(rows>1)), (short)(boxh-1), but->poin, (float) md->items[md->nitems-a-1].retval, 0.0, 0, 0, "");
- if(active==a) bt->flag |= UI_ACTIVE;
- }
- }
-
- /* the code up here has flipped locations, because of change of preferred order */
- /* thats why we have to switch list order too, to make arrowkeys work */
-
- lb.first= lb.last= NULL;
- bt= block->buttons.first;
- while(bt) {
- uiBut *next= bt->next;
- BLI_remlink(&block->buttons, bt);
- BLI_addhead(&lb, bt);
- bt= next;
- }
- block->buttons= lb;
-
- /* and lets go */
- block->direction= UI_TOP;
- ui_positionblock(block, but);
-
- /* blocks can come (and get scaled) from a normal window, now we go to screenspace */
- block->win= G.curscreen->mainwin;
- for(bt= block->buttons.first; bt; bt= bt->next) bt->win= block->win;
- bwin_getsinglematrix(block->win, block->winmat);
-
- event= uiDoBlocks(&listb, 0, 1);
-
- menudata_free(md);
-
- but->flag &= ~UI_SELECT;
- ui_check_but(but);
- /* no draw of button now, for floating panels the matrix now is invalid...
- the button still is active, and will be redrawn in main loop to de-activate it */
- /* but, if no hilites, we send redraw to queue */
- if(but->flag & UI_NO_HILITE)
- addqueue(but->block->winq, REDRAW, 1);
-
- uibut_do_func(but);
-
- /* return no existing event, because the menu sends events instead */
- return -1;
-}
-
-/* ********************** NEXT/PREV for arrowkeys etc ************** */
-
-static uiBut *ui_but_prev(uiBut *but)
-{
- while(but->prev) {
- but= but->prev;
- if(but->type!=LABEL && but->type!=SEPR && but->type!=ROUNDBOX) return but;
- }
- return NULL;
-}
-
-static uiBut *ui_but_next(uiBut *but)
-{
- while(but->next) {
- but= but->next;
- if(but->type!=LABEL && but->type!=SEPR && but->type!=ROUNDBOX) return but;
- }
- return NULL;
-}
-
-static uiBut *ui_but_first(uiBlock *block)
-{
- uiBut *but;
-
- but= block->buttons.first;
- while(but) {
- if(but->type!=LABEL && but->type!=SEPR && but->type!=ROUNDBOX) return but;
- but= but->next;
- }
- return NULL;
-}
-
-static uiBut *ui_but_last(uiBlock *block)
-{
- uiBut *but;
-
- but= block->buttons.last;
- while(but) {
- if(but->type!=LABEL && but->type!=SEPR && but->type!=ROUNDBOX) return but;
- but= but->prev;
- }
- return NULL;
-}
-
-
-/* ************* IN-BUTTON TEXT SELECTION/EDITING ************* */
-
-static short ui_delete_selection_edittext(uiBut *but)
-{
- int x;
- short deletedwidth=0;
- char *str;
-
- str= (char *)but->poin;
-
- deletedwidth = (but->selend - but->selsta);
-
- for(x=0; x< strlen(str); x++) {
- if (but->selend + x <= strlen(str) ) {
- str[but->selsta + x]= str[but->selend + x];
- } else {
- str[but->selsta + x]= '\0';
- break;
- }
- }
- but->pos = but->selend = but->selsta;
-
- return deletedwidth;
-}
-
-static void ui_set_cursor_pos_edittext(uiBut *but, short sx)
-{
- char backstr[UI_MAX_DRAW_STR];
-
- BLI_strncpy(backstr, but->drawstr, UI_MAX_DRAW_STR);
- but->pos= strlen(backstr)-but->ofs;
-
- while((but->aspect*BIF_GetStringWidth(but->font, backstr+but->ofs, 0) + but->x1) > sx) {
- if (but->pos <= 0) break;
- but->pos--;
- backstr[but->pos+but->ofs] = 0;
- }
-
- but->pos -= strlen(but->str);
- but->pos += but->ofs;
- if(but->pos<0) but->pos= 0;
-}
-
-
-/* ************* EVENTS ************* */
-
-void uiGetMouse(int win, short *adr)
-{
- int x, y;
- float xwin, ywin;
-
- getmouseco_sc(adr);
- if (win == G.curscreen->mainwin) return;
-
- bwin_getsuborigin(win, &x, &y);
-
- adr[0]-= x;
- adr[1]-= y;
-
- xwin= adr[0];
- ywin= adr[1];
-
- ui_window_to_graphics(win, &xwin, &ywin);
-
- adr[0]= (short)(xwin+0.5);
- adr[1]= (short)(ywin+0.5);
-}
-
-static void ui_is_but_sel(uiBut *but)
-{
- double value;
- int lvalue;
- short push=0, true=1;
-
- value= ui_get_but_val(but);
-
- if( but->type==TOGN || but->type==ICONTOGN) true= 0;
-
- if( but->bit ) {
- lvalue= (int)value;
- if( BTST(lvalue, (but->bitnr)) ) push= true;
- else push= !true;
- }
- else {
- switch(but->type) {
- case BUT:
- push= 0;
- break;
- case KEYEVT:
- if (value==-1) push= 1;
- break;
- case TOG:
- case TOGR:
- case TOG3:
- case BUT_TOGDUAL:
- case ICONTOG:
- if(value!=but->min) push= 1;
- break;
- case ICONTOGN:
- case TOGN:
- if(value==0.0) push= 1;
- break;
- case ROW:
- if(value == but->max) push= 1;
- break;
- case COL:
- push= 1;
- break;
- default:
- push= 2;
- break;
- }
- }
-
- if(push==2);
- else if(push==1) but->flag |= UI_SELECT;
- else but->flag &= ~UI_SELECT;
-}
-
-static int ui_do_but_BUT(uiBut *but)
-{
- int activated;
-
- do {
- int oflag= but->flag;
- short mval[2];
-
- uiGetMouse(mywinget(), mval);
-
- if (uibut_contains_pt(but, mval))
- but->flag |= UI_SELECT;
- else
- but->flag &= ~UI_SELECT;
-
- if (but->flag != oflag) {
- ui_draw_but(but);
- ui_block_flush_back(but->block);
- }
-
- PIL_sleep_ms(10);
- } while (get_mbut() & L_MOUSE);
-
- activated= (but->flag & UI_SELECT);
-
- if(activated) {
- UIafterfunc_but= but->func;
- UIafterfunc_arg1= but->func_arg1;
- UIafterfunc_arg2= but->func_arg2;
- /* no more uibut_do_func(but); this button calls fileselecting windows */
- }
-
- but->flag &= ~UI_SELECT;
- ui_draw_but(but);
-
- return activated?but->retval:0;
-}
-
-static int ui_do_but_KEYEVT(uiBut *but)
-{
- unsigned short event= 0;
- short val;
-
- /* flag for ui_check_but */
- ui_set_but_val(but, -1);
- ui_check_but(but);
- ui_draw_but(but);
- ui_block_flush_back(but->block);
-
- do {
- event= extern_qread(&val);
- } while (!event || !val || ELEM(event, MOUSEX, MOUSEY));
-
- if (!key_event_to_string(event)[0]) event= 0;
-
- ui_set_but_val(but, (double) event);
- ui_check_but(but);
- ui_draw_but(but);
-
- return (event!=0);
-}
-
-static int ui_do_but_TOG(uiBlock *block, uiBut *but, int qual)
-{
- uiBut *bt;
- double value;
- int w, lvalue, push;
-
- /* local hack... */
- if(but->type==BUT_TOGDUAL && qual==LR_CTRLKEY) {
- if(but->pointype==SHO)
- but->poin += 2;
- else if(but->pointype==INT)
- but->poin += 4;
- }
-
- value= ui_get_but_val(but);
- lvalue= (int)value;
-
- if(but->bit) {
- w= BTST(lvalue, but->bitnr);
- if(w) lvalue = BCLR(lvalue, but->bitnr);
- else lvalue = BSET(lvalue, but->bitnr);
-
- if(but->type==TOGR) {
- if( (get_qual() & LR_SHIFTKEY)==0 ) {
- lvalue= 1<<(but->bitnr);
-
- ui_set_but_val(but, (double)lvalue);
-
- bt= block->buttons.first;
- while(bt) {
- if( bt!=but && bt->poin==but->poin ) {
- ui_is_but_sel(bt);
- ui_draw_but(bt);
- }
- bt= bt->next;
- }
- }
- else {
- if(lvalue==0) lvalue= 1<<(but->bitnr);
- }
- }
-
- ui_set_but_val(but, (double)lvalue);
- if(but->type==ICONTOG || but->type==ICONTOGN) ui_check_but(but);
- // no frontbuffer draw for this one
- if(but->type==BUT_TOGDUAL);
- else if((but->flag & UI_NO_HILITE)==0) ui_draw_but(but);
- }
- else {
-
- if(value==0.0) push= 1;
- else push= 0;
-
- if(but->type==TOGN || but->type==ICONTOGN) push= !push;
- ui_set_but_val(but, (double)push);
- if(but->type==ICONTOG || but->type==ICONTOGN) ui_check_but(but);
- // no frontbuffer draw for this one
- if((but->flag & UI_NO_HILITE)==0) ui_draw_but(but);
- }
-
- /* end local hack... */
- if(but->type==BUT_TOGDUAL && qual==LR_CTRLKEY) {
- if(but->pointype==SHO)
- but->poin -= 2;
- else if(but->pointype==INT)
- but->poin -= 4;
- }
-
- /* no while loop...this button is used for viewmove */
-
- uibut_do_func(but);
-
- return but->retval;
-}
-
-static int ui_do_but_ROW(uiBlock *block, uiBut *but)
-{
- uiBut *bt;
-
- ui_set_but_val(but, but->max);
- ui_draw_but(but);
-
- bt= block->buttons.first;
- while(bt) {
- if( bt!=but && bt->type==ROW ) {
- if(bt->min==but->min) {
- ui_is_but_sel(bt);
- ui_draw_but(bt);
- }
- }
- bt= bt->next;
- }
- return but->retval;
-}
-
-/* return 1 if char ch is special character otherwise
- * it returns 0 */
-static short test_special_char(char ch)
-{
- switch(ch) {
- case '\\':
- case '/':
- case '~':
- case '!':
- case '@':
- case '#':
- case '$':
- case '%':
- case '^':
- case '&':
- case '*':
- case '(':
- case ')':
- case '+':
- case '=':
- case '{':
- case '}':
- case '[':
- case ']':
- case ':':
- case ';':
- case '\'':
- case '\"':
- case '<':
- case '>':
- case ',':
- case '.':
- case '?':
- case '_':
- case '-':
- case ' ':
- return 1;
- break;
- default:
- break;
- }
- return 0;
-}
-
-static int ui_do_but_TEX(uiBut *but)
-{
- unsigned short dev;
- short x, y, mval[2], len=0, dodraw, selextend=0;
- char *str, backstr[UI_MAX_DRAW_STR];
- short capturing, sx, sy, prevx;
-
- str= (char *)but->poin;
-
- but->flag |= UI_SELECT;
-
- uiGetMouse(mywinget(), mval);
-
- /* set cursor pos to the end of the text */
- but->pos = strlen(str);
- but->selsta = 0;
- but->selend = strlen(but->drawstr) - strlen(but->str);
-
- /* backup */
- BLI_strncpy(backstr, but->poin, UI_MAX_DRAW_STR);
-
- ui_draw_but(but);
- ui_block_flush_back(but->block);
-
- while (get_mbut() & L_MOUSE) BIF_wait_for_statechange();
- len= strlen(str);
-
- but->min= 0.0;
-
- capturing = TRUE;
- while(capturing) {
- char ascii;
- short val;
-
- dodraw= 0;
- dev = extern_qread_ext(&val, &ascii);
-
- if(dev==INPUTCHANGE) break;
- else if(get_mbut() & R_MOUSE) break;
- else if(get_mbut() & L_MOUSE) {
- uiGetMouse(mywinget(), mval);
- sx = mval[0]; sy = mval[1];
-
- if ((but->y1 <= sy) && (sy <= but->y2) && (but->x1 <= sx) && (sx <= but->x2)) {
- ui_set_cursor_pos_edittext(but, mval[0]);
-
- but->selsta = but->selend = but->pos;
-
- /* drag text select */
- prevx= mval[0];
- while (get_mbut() & L_MOUSE) {
- uiGetMouse(mywinget(), mval);
-
- if(prevx!=mval[0]) {
-
- if (mval[0] > sx) selextend = EXTEND_RIGHT;
- else if (mval[0] < sx) selextend = EXTEND_LEFT;
-
- ui_set_cursor_pos_edittext(but, mval[0]);
-
- if (selextend == EXTEND_RIGHT) but->selend = but->pos;
- if (selextend == EXTEND_LEFT) but->selsta = but->pos;
-
- ui_check_but(but);
- ui_draw_but(but);
- ui_block_flush_back(but->block);
- }
- PIL_sleep_ms(10);
- }
- dodraw= 1;
- } else break;
- }
- else if(dev==ESCKEY) break;
- else if(dev==MOUSEX) val= 0;
- else if(dev==MOUSEY) val= 0;
-
- /* cut, copy, paste selected text */
- /* mainqread discards ascii values < 32, so can't do this cleanly within the if(ascii) block*/
- else if ( (val) &&
- ((G.qual & LR_COMMANDKEY) || (G.qual & LR_CTRLKEY)) &&
- ((dev==XKEY) || (dev==CKEY) || (dev==VKEY)) ) {
-
-
- /* paste */
- if (dev==VKEY) {
- /* paste over the current selection */
- if ((but->selend - but->selsta) > 0) {
- len -= ui_delete_selection_edittext(but);
- }
-
- for (y=0; y<strlen(but_copypaste_str); y++)
- {
- /* add contents of buffer */
- if(len < but->max) {
- for(x= but->max; x>but->pos; x--)
- str[x]= str[x-1];
- str[but->pos]= but_copypaste_str[y];
- but->pos++;
- len++;
- str[len]= '\0';
- }
- }
- if (strlen(but_copypaste_str) > 0) dodraw= 1;
- }
- /* cut & copy */
- else if ( (dev==XKEY) || (dev==CKEY) ) {
- /* copy the contents to the copypaste buffer */
- for(x= but->selsta; x <= but->selend; x++) {
- if (x==but->selend)
- but_copypaste_str[x] = '\0';
- else
- but_copypaste_str[(x - but->selsta)] = str[x];
- }
-
- /* for cut only, delete the selection afterwards */
- if (dev==XKEY) {
- if ((but->selend - but->selsta) > 0) {
- len -= ui_delete_selection_edittext(but);
-
- if (len < 0) len = 0;
- dodraw=1;
- }
- }
- }
- }
- else if((ascii)){
-
- if(len-(but->selend - but->selsta)+1 <= but->max) {
-
- /* type over the current selection */
- if ((but->selend - but->selsta) > 0) {
- len -= ui_delete_selection_edittext(but);
- }
-
- if(len < but->max) {
- for(x= but->max; x>but->pos; x--)
- str[x]= str[x-1];
- str[but->pos]= ascii;
- but->pos++;
- len++;
- str[len]= '\0';
- dodraw= 1;
- }
- }
- }
- else if(val) {
-
- switch (dev) {
-
- case RIGHTARROWKEY:
- /* if there's a selection */
- if ((but->selend - but->selsta) > 0) {
- /* extend the selection based on the first direction taken */
- if(G.qual & LR_SHIFTKEY) {
- if (!selextend) {
- selextend = EXTEND_RIGHT;
- }
- if (selextend == EXTEND_RIGHT) {
- but->selend++;
- if (but->selend > len) but->selend = len;
- } else if (selextend == EXTEND_LEFT) {
- but->selsta++;
- /* if the selection start has gone past the end,
- * flip them so they're in sync again */
- if (but->selsta == but->selend) {
- but->pos = but->selsta;
- selextend = EXTEND_RIGHT;
- }
- }
- } else {
- but->selsta = but->pos = but->selend;
- selextend = 0;
- }
- } else {
- if(G.qual & LR_SHIFTKEY) {
- /* make a selection, starting from the cursor position */
- but->selsta = but->pos;
-
- but->pos++;
- if(but->pos>strlen(str)) but->pos= strlen(str);
-
- but->selend = but->pos;
- } else if(G.qual & LR_CTRLKEY) {
- /* jump betweenn special characters (/,\,_,-, etc.),
- * look at function test_special_char() for complete
- * list of special character, ctr -> */
- while(but->pos < len) {
- but->pos++;
- if(test_special_char(str[but->pos])) break;
- }
- } else {
- but->pos++;
- if(but->pos>strlen(str)) but->pos= strlen(str);
- }
- }
- dodraw= 1;
- break;
-
- case LEFTARROWKEY:
- /* if there's a selection */
- if ((but->selend - but->selsta) > 0) {
- /* extend the selection based on the first direction taken */
- if(G.qual & LR_SHIFTKEY) {
- if (!selextend) {
- selextend = EXTEND_LEFT;
- }
- if (selextend == EXTEND_LEFT) {
- but->selsta--;
- if (but->selsta < 0) but->selsta = 0;
- } else if (selextend == EXTEND_RIGHT) {
- but->selend--;
- /* if the selection start has gone past the end,
- * flip them so they're in sync again */
- if (but->selsta == but->selend) {
- but->pos = but->selsta;
- selextend = EXTEND_LEFT;
- }
- }
- } else {
- but->pos = but->selend = but->selsta;
- selextend = 0;
- }
- } else {
- if(G.qual & LR_SHIFTKEY) {
- /* make a selection, starting from the cursor position */
- but->selend = but->pos;
-
- but->pos--;
- if(but->pos<0) but->pos= 0;
-
- but->selsta = but->pos;
- } else if(G.qual & LR_CTRLKEY) {
- /* jump betweenn special characters (/,\,_,-, etc.),
- * look at function test_special_char() for complete
- * list of special character, ctr -> */
- while(but->pos > 0){
- but->pos--;
- if(test_special_char(str[but->pos])) break;
- }
- } else {
- if(but->pos>0) but->pos--;
- }
- }
- dodraw= 1;
- break;
-
- case DOWNARROWKEY:
- case ENDKEY:
- if(G.qual & LR_SHIFTKEY) {
- but->selsta = but->pos;
- but->selend = strlen(str);
- selextend = EXTEND_RIGHT;
- } else {
- but->selsta = but->selend = but->pos= strlen(str);
- }
- dodraw= 1;
- break;
-
- case UPARROWKEY:
- case HOMEKEY:
- if(G.qual & LR_SHIFTKEY) {
- but->selend = but->pos;
- but->selsta = 0;
- selextend = EXTEND_LEFT;
- } else {
- but->selsta = but->selend = but->pos= 0;
- }
- dodraw= 1;
- break;
-
- case PADENTER:
- case RETKEY:
- capturing = FALSE;
- break;
-
- case DELKEY:
- if ((but->selend - but->selsta) > 0) {
- len -= ui_delete_selection_edittext(but);
-
- if (len < 0) len = 0;
- dodraw=1;
- }
- else if(but->pos>=0 && but->pos<strlen(str)) {
- for(x=but->pos; x<=strlen(str); x++)
- str[x]= str[x+1];
- str[--len]='\0';
- dodraw= 1;
- }
- break;
-
- case BACKSPACEKEY:
- if(len!=0) {
- if ((but->selend - but->selsta) > 0) {
- len -= ui_delete_selection_edittext(but);
-
- if (len < 0) len = 0;
- dodraw=1;
- }
- else if(get_qual() & LR_SHIFTKEY) {
- str[0]= 0;
- but->pos= 0;
- len= 0;
- dodraw= 1;
- }
- else if(but->pos>0) {
- for(x=but->pos; x<=strlen(str); x++)
- str[x-1]= str[x];
- but->pos--;
- str[--len]='\0';
- dodraw= 1;
- }
- }
- break;
-
- case TABKEY:
- if(but->autocomplete_func) {
- but->autocomplete_func(str, but->autofunc_arg);
- but->pos= strlen(str);
- len= but->pos;
- dodraw= 1;
- }
- else capturing= FALSE;
-
- break;
- }
- }
-
-
- if(dodraw) {
- ui_check_but(but);
- ui_draw_but(but);
- ui_block_flush_back(but->block);
- }
- }
-
- if(dev==ESCKEY) strcpy(but->poin, backstr);
- but->pos= -1;
- but->flag &= ~UI_SELECT;
-
- if(dev!=ESCKEY) {
- /* give butfunc the original text too */
- /* feature used for bone renaming, channels, etc */
- if(but->func_arg2==NULL) but->func_arg2= backstr;
- uibut_do_func(but);
- }
-
- ui_check_but(but);
- ui_draw_but(but);
-
- if(dev==TABKEY) addqueue(but->win, G.qual?BUT_PREV:BUT_NEXT, 1);
-
- if(dev!=ESCKEY) return but->retval;
- else return B_NOP; // prevent event to be passed on
-}
-
-
-static int ui_act_as_text_but(uiBut *but)
-{
- void *but_func;
- double value;
- float min, max;
- int temp, retval, textleft;
- char str[UI_MAX_DRAW_STR], *point;
-
- /* this function is abused for tab-cycling */
- if(but->type==TEX)
- return ui_do_but_TEX(but);
-
- value= ui_get_but_val(but);
- if( but->pointype==FLO ) {
- if(but->a2) { /* amount of digits defined */
- if(but->a2==1) sprintf(str, "%.1f", value);
- else if(but->a2==2) sprintf(str, "%.2f", value);
- else if(but->a2==3) sprintf(str, "%.3f", value);
- else sprintf(str, "%.4f", value);
- }
- else sprintf(str, "%.3f", value);
- }
- else {
- sprintf(str, "%d", (int)value);
- }
- /* store values before calling as text button */
- point= but->poin;
- but->poin= str;
- but_func= but->func;
- but->func= NULL;
- min= but->min;
- max= but->max;
- but->min= 0.0;
- but->max= UI_MAX_DRAW_STR - 1; /* for py strings evaluation */
- temp= but->type;
- but->type= TEX;
- textleft= but->flag & UI_TEXT_LEFT;
- but->flag |= UI_TEXT_LEFT;
- ui_check_but(but);
-
- retval= ui_do_but_TEX(but);
-
- /* restore values */
- but->type= temp;
- but->poin= point;
- but->func= but_func;
- but->min= min;
- but->max= max;
- if(textleft==0) but->flag &= ~UI_TEXT_LEFT;
-
- if(BPY_button_eval(str, &value)) {
- /* Uncomment this if you want to see an error message (and annoy users) */
- /* error("Invalid Python expression, check console");*/
- value = 0.0f; /* Zero out value on error */
-
- if(str[0])
- retval = 0; /* invalidate return value if eval failed, except when string was null */
- }
-
- if(but->pointype!=FLO) value= (int)value;
-
- if(value<min) value= min;
- if(value>max) value= max;
-
- ui_set_but_val(but, value);
- ui_check_but(but);
- ui_draw_but(but);
-
- return retval;
-}
-
-static int ui_do_but_NUM(uiBut *but)
-{
- double value;
- float deler, fstart, f, tempf, pressure;
- int lvalue, temp, orig_x; /* , firsttime=1; */
- short retval=0, qual, sx, mval[2], pos=0;
-
- but->flag |= UI_SELECT;
- ui_draw_but(but);
- ui_block_flush_back(but->block);
-
- uiGetMouse(mywinget(), mval);
- value= ui_get_but_val(but);
-
- sx= mval[0];
- orig_x = sx; /* Store so we can scale the rate of change by the dist the mouse is from its original xlocation */
- fstart= (value - but->min)/(but->max-but->min);
- f= fstart;
-
- temp= (int)value;
- tempf= value;
-
- if(get_qual() & LR_SHIFTKEY) { /* make it textbut */
- if( ui_act_as_text_but(but) ) retval= but->retval;
- }
- else {
- retval= but->retval;
- /* firsttime: this button can be approached with enter as well */
-
- /* drag-lock - prevent unwanted scroll adjustments */
- /* change last value (now 3) to adjust threshold in pixels */
- while (get_mbut() & L_MOUSE & ( abs(mval[0]-sx) <= 3) ) {
- uiGetMouse(mywinget(), mval);
- }
- sx = mval[0]; /* ignore mouse movement within drag-lock */
-
- while (get_mbut() & L_MOUSE) {
- qual= get_qual();
- pressure = get_pressure();
-
- uiGetMouse(mywinget(), mval);
-
- deler= 500;
- if( but->pointype!=FLO ) {
-
- if( (but->max-but->min)<100 ) deler= 200.0;
- if( (but->max-but->min)<25 ) deler= 50.0;
- }
-
- if(qual & LR_SHIFTKEY) deler*= 10.0;
- if(qual & LR_ALTKEY) deler*= 20.0;
-
- /* de-sensitise based on tablet pressure */
- if (ELEM(get_activedevice(), DEV_STYLUS, DEV_ERASER)) deler /= pressure;
-
- if(mval[0] != sx) {
- if( but->pointype==FLO && but->max-but->min > 11) {
- /* non linear change in mouse input- good for high precicsion */
- f+= (((float)(mval[0]-sx))/deler) * (fabs(orig_x-mval[0])*0.002);
- } else if ( but->pointype!=FLO && but->max-but->min > 129) { /* only scale large int buttons */
- /* non linear change in mouse input- good for high precicsionm ints need less fine tuning */
- f+= (((float)(mval[0]-sx))/deler) * (fabs(orig_x-mval[0])*0.004);
- } else {
- /*no scaling */
- f+= ((float)(mval[0]-sx))/deler ;
- }
-
- if(f>1.0) f= 1.0;
- if(f<0.0) f= 0.0;
- sx= mval[0];
- tempf= ( but->min + f*(but->max-but->min));
-
- if( but->pointype!=FLO ) {
-
- temp= floor(tempf+.5);
-
- if(tempf==but->min || tempf==but->max);
- else if(qual & LR_CTRLKEY) {
- if(qual & LR_SHIFTKEY) temp= 100*(temp/100);
- else temp= 10*(temp/10);
- }
- if( temp>=but->min && temp<=but->max) {
-
- value= ui_get_but_val(but);
- lvalue= (int)value;
-
- if(temp != lvalue ) {
- pos= 1;
- ui_set_but_val(but, (double)temp);
- ui_check_but(but);
- ui_draw_but(but);
- ui_block_flush_back(but->block);
-
- uibut_do_func(but);
- }
- }
-
- }
- else {
- temp= 0;
- if(qual & LR_CTRLKEY) {
- if(qual & LR_SHIFTKEY) {
- if(tempf==but->min || tempf==but->max);
- else if(but->max-but->min < 2.10) tempf= 0.01*floor(100.0*tempf);
- else if(but->max-but->min < 21.0) tempf= 0.1*floor(10.0*tempf);
- else tempf= floor(tempf);
- }
- else {
- if(tempf==but->min || tempf==but->max);
- else if(but->max-but->min < 2.10) tempf= 0.1*floor(10*tempf);
- else if(but->max-but->min < 21.0) tempf= floor(tempf);
- else tempf= 10.0*floor(tempf/10.0);
- }
- }
-
- if( tempf>=but->min && tempf<=but->max) {
- value= ui_get_but_val(but);
-
- if(tempf != value ) {
- pos= 1;
- ui_set_but_val(but, tempf);
- ui_check_but(but);
- ui_draw_but(but);
- ui_block_flush_back(but->block);
- }
- }
-
- }
- }
- BIF_wait_for_statechange();
- }
-
- /* click on the side arrows to increment/decrement, click inside
- * to edit the value directly */
- if(pos==0) { /* plus 1 or minus 1 */
- if( but->pointype!=FLO ) {
-
- if(sx < (but->x1 + (but->x2 - but->x1)/3 - 3)) {
- temp--;
- if( temp>=but->min && temp<=but->max) ui_set_but_val(but, (double)temp);
- }
- else if(sx > (but->x1 + (2*(but->x2 - but->x1)/3) + 3)) {
- temp++;
- if( temp>=but->min && temp<=but->max) ui_set_but_val(but, (double)temp);
- }
- else {
- if( ui_act_as_text_but(but) ); else retval= 0;
- }
- }
- else {
-
- if(sx < (but->x1 + (but->x2 - but->x1)/3 - 3)) {
- tempf-= 0.01*but->a1;
- if (tempf < but->min) tempf = but->min;
- ui_set_but_val(but, tempf);
- }
- else if(sx > but->x1 + (2*((but->x2 - but->x1)/3) + 3)) {
- tempf+= 0.01*but->a1;
- if (tempf < but->min) tempf = but->min;
- ui_set_but_val(but, tempf);
- }
- else {
- if( ui_act_as_text_but(but) ); else retval= 0;
- }
- }
- }
- }
-
- but->flag &= ~UI_SELECT;
- ui_check_but(but);
- ui_draw_but(but);
- ui_block_flush_back(but->block);
-
- uibut_do_func(but);
-
- return retval;
-}
-
-static int ui_do_but_TOG3(uiBut *but)
-{
-
- if( but->pointype==SHO ) {
- short *sp= (short *)but->poin;
-
- if( BTST(sp[1], but->bitnr)) {
- sp[1]= BCLR(sp[1], but->bitnr);
- sp[0]= BCLR(sp[0], but->bitnr);
- }
- else if( BTST(sp[0], but->bitnr)) {
- sp[1]= BSET(sp[1], but->bitnr);
- } else {
- sp[0]= BSET(sp[0], but->bitnr);
- }
- }
- else {
- if( BTST(*(but->poin+2), but->bitnr)) {
- *(but->poin+2)= BCLR(*(but->poin+2), but->bitnr);
- *(but->poin)= BCLR(*(but->poin), but->bitnr);
- }
- else if( BTST(*(but->poin), but->bitnr)) {
- *(but->poin+2)= BSET(*(but->poin+2), but->bitnr);
- } else {
- *(but->poin)= BSET(*(but->poin), but->bitnr);
- }
- }
-
- ui_is_but_sel(but);
- ui_draw_but(but);
-
- return but->retval;
-}
-
-static int ui_do_but_ICONROW(uiBut *but)
-{
- ListBase listb= {NULL, NULL};
- uiBlock *block;
- int a;
-
- but->flag |= UI_SELECT;
- ui_draw_but(but);
- ui_block_flush_back(but->block); // flush because this button creates own blocks loop
-
- /* here we go! */
- block= uiNewBlock(&listb, "menu", UI_EMBOSSP, UI_HELV, but->win);
- block->flag= UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_NUMSELECT;
- block->themecol= TH_MENU_ITEM;
-
- for(a=(int)but->min; a<=(int)but->max; a++) {
- uiDefIconBut(block, BUTM|but->pointype, but->retval, but->icon+(a-but->min), 0, (short)(18*a), (short)(but->x2-but->x1-4), 18, but->poin, (float)a, 0.0, 0, 0, "");
- }
- block->direction= UI_TOP;
- ui_positionblock(block, but);
-
- /* the block is made with but-win, but is handled in mainwin space...
- this is needs better implementation */
- block->win= G.curscreen->mainwin;
-
- uiDoBlocks(&listb, 0, 1);
-
- but->flag &= ~UI_SELECT;
- ui_check_but(but);
- ui_draw_but(but);
-
- return but->retval;
-}
-
-static int ui_do_but_ICONTEXTROW(uiBut *but)
-{
- uiBlock *block;
- ListBase listb={NULL, NULL};
- int width, a, xmax, ypos;
- MenuData *md;
-
- but->flag |= UI_SELECT;
- ui_draw_but(but);
- ui_block_flush_back(but->block); // flush because this button creates own blocks loop
-
- block= uiNewBlock(&listb, "menu", UI_EMBOSSP, UI_HELV, but->win);
- block->flag= UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_NUMSELECT;
- block->themecol= TH_MENU_ITEM;
-
- md= decompose_menu_string(but->str);
-
- /* size and location */
- /* expand menu width to fit labels */
- if(md->title)
- width= 2*strlen(md->title)+BIF_GetStringWidth(block->curfont, md->title, (U.transopts & USER_TR_MENUS));
- else
- width= 0;
-
- for(a=0; a<md->nitems; a++) {
- xmax= BIF_GetStringWidth(block->curfont, md->items[a].str, (U.transopts & USER_TR_MENUS));
- if(xmax>width) width= xmax;
- }
-
- width+= 30;
- if (width<50) width=50;
-
- ypos = 1;
-
- /* loop through the menu options and draw them out with icons & text labels */
- for(a=0; a<md->nitems; a++) {
-
- /* add a space if there's a separator (%l) */
- if (strcmp(md->items[a].str, "%l")==0) {
- ypos +=3;
- }
- else {
- uiDefIconTextBut(block, BUTM|but->pointype, but->retval, (short)((but->icon)+(md->items[a].retval-but->min)), md->items[a].str, 0, ypos,(short)width, 19, but->poin, (float) md->items[a].retval, 0.0, 0, 0, "");
- ypos += 20;
- }
- }
-
- if(md->title) {
- uiBut *bt;
- uiSetCurFont(block, block->font+1);
- bt= uiDefBut(block, LABEL, 0, md->title, 0, ypos, (short)width, 19, NULL, 0.0, 0.0, 0, 0, "");
- uiSetCurFont(block, block->font);
- bt->flag= UI_TEXT_LEFT;
- }
-
- block->direction= UI_TOP;
- ui_positionblock(block, but);
-
- /* the block is made with but-win, but is handled in mainwin space...
- this is needs better implementation */
- block->win= G.curscreen->mainwin;
-
- uiBoundsBlock(block, 3);
-
- uiDoBlocks(&listb, 0, 1);
-
- menudata_free(md);
-
- but->flag &= ~UI_SELECT;
- ui_check_but(but);
- ui_draw_but(but);
-
- uibut_do_func(but);
-
- return but->retval;
-
-}
-
-static int ui_do_but_IDPOIN(uiBut *but)
-{
- char str[UI_MAX_DRAW_STR];
- ID *id;
-
- id= *but->idpoin_idpp;
- if(id) strcpy(str, id->name+2);
- else str[0]= 0;
-
- but->type= TEX;
- but->poin= str;
- but->min= 0.0;
- but->max= 22.0;
- ui_check_but(but);
- ui_do_but_TEX(but);
- but->poin= NULL;
- but->type= IDPOIN;
-
- but->idpoin_func(str, but->idpoin_idpp);
- ui_check_but(but);
- ui_draw_but(but);
-
- return but->retval;
-}
-
-static int ui_do_but_SLI(uiBut *but)
-{
- float f, fstart, tempf = 0.0, deler, value;
- int sx, h, temp, pos=0, lvalue, redraw;
- short mval[2], qual;
-
- value= ui_get_but_val(but);
- uiGetMouse(mywinget(), mval);
-
- sx= mval[0];
- h= but->y2-but->y1;
- fstart= but->max-but->min;
- fstart= (value - but->min)/fstart;
- temp= 32767;
-
- if( but->type==NUMSLI) deler= ( (but->x2-but->x1)/2 - 5.0*but->aspect);
- else if( but->type==HSVSLI) deler= ( (but->x2-but->x1)/2 - 5.0*but->aspect);
- else deler= (but->x2-but->x1- 5.0*but->aspect);
-
-
- while (get_mbut() & L_MOUSE) {
-
- qual= get_qual();
- uiGetMouse(mywinget(), mval);
-
- f= (float)(mval[0]-sx)/deler +fstart;
-
- if (qual & LR_SHIFTKEY) {
- f= (f-fstart)/10.0 + fstart;
- }
-
- CLAMP(f, 0.0, 1.0);
- tempf= but->min+f*(but->max-but->min);
- temp= floor(tempf+.5);
-
- if(qual & LR_CTRLKEY) {
- if(tempf==but->min || tempf==but->max);
- else if( but->pointype==FLO ) {
-
- if(qual & LR_SHIFTKEY) {
- if(tempf==but->min || tempf==but->max);
- else if(but->max-but->min < 2.10) tempf= 0.01*floor(100.0*tempf);
- else if(but->max-but->min < 21.0) tempf= 0.1*floor(10.0*tempf);
- else tempf= floor(tempf);
- }
- else {
- if(but->max-but->min < 2.10) tempf= 0.1*floor(10*tempf);
- else if(but->max-but->min < 21.0) tempf= floor(tempf);
- else tempf= 10.0*floor(tempf/10.0);
- }
- }
- else {
- temp= 10*(temp/10);
- tempf= temp;
- }
- }
-
- value= ui_get_but_val(but);
- lvalue= floor(value+0.5);
-
- if( but->pointype!=FLO )
- redraw= (temp != lvalue);
- else
- redraw= (tempf != value);
-
- if (redraw) {
- pos= 1;
- ui_set_but_val(but, tempf);
- ui_check_but(but);
- ui_draw_but(but);
- ui_block_flush_back(but->block);
-
- if(but->a1) { /* color number */
- uiBut *bt= but->prev;
- while(bt) {
- if(bt->a2 == but->a1) ui_draw_but(bt);
- bt= bt->prev;
- }
- bt= but->next;
- while(bt) {
- if(bt->a2 == but->a1) ui_draw_but(bt);
- bt= bt->next;
- }
- }
- /* save current window matrix (global UIwinmat)
- because button callback function MIGHT change it
- - which has until now occured through the Python API
- */
- /* This is really not possible atm... nothing in Blender
- supports such functionality even now. Calling function
- callbacks while using a button screws up the UI (ton)
- */
- /* Mat4CpyMat4(curmatrix, UIwinmat);
- uibut_do_func(but);
- Mat4CpyMat4(UIwinmat, curmatrix); */
- }
- else BIF_wait_for_statechange();
- }
-
-
- if(temp!=32767 && pos==0) { /* plus 1 or minus 1 */
-
- if( but->type==SLI) f= (float)(mval[0]-but->x1)/(but->x2-but->x1-h);
- else f= (float)(mval[0]- (but->x1+but->x2)/2)/( (but->x2-but->x1)/2 - h);
-
- f= but->min+f*(but->max-but->min);
-
- if( but->pointype!=FLO ) {
-
- if(f<temp) temp--;
- else temp++;
- if( temp>=but->min && temp<=but->max)
- ui_set_but_val(but, (float)temp);
-
- }
- else {
-
- if(f<tempf) tempf-=.01;
- else tempf+=.01;
- if( tempf>=but->min && tempf<=but->max)
- ui_set_but_val(but, tempf);
-
- }
- }
- ui_check_but(but);
- ui_draw_but(but);
- uibut_do_func(but);
- ui_block_flush_back(but->block);
-
- return but->retval;
-}
-
-static int ui_do_but_NUMSLI(uiBut *but)
-{
- short mval[2];
-
- /* first define if it's a slider or textbut */
- uiGetMouse(mywinget(), mval);
-
- if(mval[0]>= -6+(but->x1+but->x2)/2 ) { /* slider */
- but->flag |= UI_SELECT;
- ui_draw_but(but);
- ui_do_but_SLI(but);
- but->flag &= ~UI_SELECT;
- }
- else {
- ui_act_as_text_but(but);
- uibut_do_func(but); // this is done in ui_do_but_SLI() not in ui_act_as_text_but()
- }
-
- while(get_mbut() & L_MOUSE) BIF_wait_for_statechange();
-
- ui_draw_but(but);
-
- /* hsv patch */
- if(but->type==HSVSLI) {
-
- if(but->str[0]=='H') {
- ui_draw_but(but->next);
- ui_draw_but(but->next->next);
- }
- else if(but->str[0]=='S') {
- ui_draw_but(but->next);
- ui_draw_but(but->prev);
- }
- else if(but->str[0]=='V') {
- ui_draw_but(but->prev);
- ui_draw_but(but->prev->prev);
- }
- }
-
- return but->retval;
-}
-
-/* event denotes if we make first item active or not */
-static uiBlock *ui_do_but_BLOCK(uiBut *but, int event)
-{
- uiBlock *block;
- uiBut *bt;
-
- but->flag |= UI_SELECT;
- ui_draw_but(but);
-
- block= but->block_func(but->poin);
- block->parent= but->block; /* allows checking for nested pulldowns */
-
- block->xofs = -2; /* for proper alignment */
-
- /* only used for automatic toolbox, so can set the shift flag */
- if(but->flag & UI_MAKE_TOP) {
- block->direction= UI_TOP|UI_SHIFT_FLIPPED;
- uiBlockFlipOrder(block);
- }
- if(but->flag & UI_MAKE_DOWN) block->direction= UI_DOWN|UI_SHIFT_FLIPPED;
- if(but->flag & UI_MAKE_LEFT) block->direction |= UI_LEFT;
- if(but->flag & UI_MAKE_RIGHT) block->direction |= UI_RIGHT;
-
- ui_positionblock(block, but);
- block->flag |= UI_BLOCK_LOOP;
-
- /* blocks can come (and get scaled) from a normal window, now we go to screenspace */
- block->win= G.curscreen->mainwin;
- for(bt= block->buttons.first; bt; bt= bt->next) bt->win= block->win;
- bwin_getsinglematrix(block->win, block->winmat);
-
- /* postpone draw, this will cause a new window matrix, first finish all other buttons */
- block->flag |= UI_BLOCK_REDRAW;
-
- if(event!=MOUSEX && event!=MOUSEY && event!=LEFTMOUSE && but->type==BLOCK) {
- bt= ui_but_first(block);
- if(bt) bt->flag |= UI_ACTIVE;
- }
-
- but->flag &= ~UI_SELECT;
- uibut_do_func(but);
-
- if(but->retval)
- addqueue(curarea->win, UI_BUT_EVENT, (short)but->retval);
-
- return block;
-}
-
-static int ui_do_but_BUTM(uiBut *but)
-{
-
- ui_set_but_val(but, but->min);
- UIafterfunc_butm= but->butm_func;
- UIafterfunc_arg1= but->butm_func_arg;
- UIafterval= but->a2;
-
- return but->retval;
-}
-
-static int ui_do_but_LABEL(uiBut *but)
-{
- uibut_do_func(but);
- return but->retval;
-}
-
-static uiBut *ui_get_valid_link_button(uiBlock *block, uiBut *but, short *mval)
-{
- uiBut *bt;
-
- /* find button to link to */
- for (bt= block->buttons.first; bt; bt= bt->next)
- if(bt!=but && uibut_contains_pt(bt, mval))
- break;
-
- if (bt) {
- if (but->type==LINK && bt->type==INLINK) {
- if( but->link->tocode == (int)bt->min ) {
- return bt;
- }
- }
- else if(but->type==INLINK && bt->type==LINK) {
- if( bt->link->tocode == (int)but->min ) {
- return bt;
- }
- }
- }
-
- return NULL;
-}
-
-static int ui_is_a_link(uiBut *from, uiBut *to)
-{
- uiLinkLine *line;
- uiLink *link;
-
- link= from->link;
- if(link) {
- line= link->lines.first;
- while(line) {
- if(line->from==from && line->to==to) return 1;
- line= line->next;
- }
- }
- return 0;
-}
-
-static uiBut *ui_find_inlink(uiBlock *block, void *poin)
-{
- uiBut *but;
-
- but= block->buttons.first;
- while(but) {
- if(but->type==INLINK) {
- if(but->poin == poin) return but;
- }
- but= but->next;
- }
- return NULL;
-}
-
-static void ui_add_link_line(ListBase *listb, uiBut *but, uiBut *bt)
-{
- uiLinkLine *line;
-
- line= MEM_callocN(sizeof(uiLinkLine), "linkline");
- BLI_addtail(listb, line);
- line->from= but;
- line->to= bt;
-}
-
-
-void uiComposeLinks(uiBlock *block)
-{
- uiBut *but, *bt;
- uiLink *link;
- void ***ppoin;
- int a;
-
- but= block->buttons.first;
- while(but) {
- if(but->type==LINK) {
- link= but->link;
-
- /* for all pointers in the array */
- if(link) {
- if(link->ppoin) {
- ppoin= link->ppoin;
- for(a=0; a < *(link->totlink); a++) {
- bt= ui_find_inlink(block, (*ppoin)[a] );
- if(bt) {
- ui_add_link_line(&link->lines, but, bt);
- }
- }
- }
- else if(link->poin) {
- bt= ui_find_inlink(block, *(link->poin) );
- if(bt) {
- ui_add_link_line(&link->lines, but, bt);
- }
- }
- }
- }
- but= but->next;
- }
-}
-
-static void ui_add_link(uiBut *from, uiBut *to)
-{
- /* in 'from' we have to add a link to 'to' */
- uiLink *link;
- void **oldppoin;
- int a;
-
- if(ui_is_a_link(from, to)) {
- printf("already exists\n");
- return;
- }
-
- link= from->link;
-
- /* are there more pointers allowed? */
- if(link->ppoin) {
- oldppoin= *(link->ppoin);
-
- (*(link->totlink))++;
- *(link->ppoin)= MEM_callocN( *(link->totlink)*sizeof(void *), "new link");
-
- for(a=0; a< (*(link->totlink))-1; a++) {
- (*(link->ppoin))[a]= oldppoin[a];
- }
- (*(link->ppoin))[a]= to->poin;
-
- if(oldppoin) MEM_freeN(oldppoin);
- }
- else {
- *(link->poin)= to->poin;
- }
-
-}
-
-static int ui_do_but_LINK(uiBlock *block, uiBut *but)
-{
- /*
- * This button only visualizes, the dobutton mode
- * can add a new link, but then the whole system
- * should be redrawn/initialized.
- *
- */
- uiBut *bt=0, *bto=NULL;
- short sval[2], mval[2], mvalo[2], first= 1;
-
- uiGetMouse(curarea->win, sval);
- mvalo[0]= sval[0];
- mvalo[1]= sval[1];
-
- while (get_mbut() & L_MOUSE) {
- uiGetMouse(curarea->win, mval);
-
- if(mval[0]!=mvalo[0] || mval[1]!=mvalo[1] || first) {
- /* clear completely, because of drawbuttons */
- bt= ui_get_valid_link_button(block, but, mval);
- if(bt) {
- bt->flag |= UI_ACTIVE;
- ui_draw_but(bt);
- }
- if(bto && bto!=bt) {
- bto->flag &= ~UI_ACTIVE;
- ui_draw_but(bto);
- }
- bto= bt;
-
- if (!first) {
- glutil_draw_front_xor_line(sval[0], sval[1], mvalo[0], mvalo[1]);
- }
- glutil_draw_front_xor_line(sval[0], sval[1], mval[0], mval[1]);
-
- mvalo[0]= mval[0];
- mvalo[1]= mval[1];
-
- first= 0;
- }
- else BIF_wait_for_statechange();
- }
-
- if (!first) {
- glutil_draw_front_xor_line(sval[0], sval[1], mvalo[0], mvalo[1]);
- }
-
- if(bt) {
- if(but->type==LINK) ui_add_link(but, bt);
- else ui_add_link(bt, but);
-
- scrarea_queue_winredraw(curarea);
- }
-
- return 0;
-}
-
-/* picker sizes S hsize, F full size, D spacer, B button/pallette height */
-#define SPICK 110.0
-#define FPICK 180.0
-#define DPICK 6.0
-#define BPICK 24.0
-
-#define UI_PALETTE_TOT 16
-/* note; in tot+1 the old color is stored */
-static float palette[UI_PALETTE_TOT+1][3]= {
-{0.93, 0.83, 0.81}, {0.88, 0.89, 0.73}, {0.69, 0.81, 0.57}, {0.51, 0.76, 0.64},
-{0.37, 0.56, 0.61}, {0.33, 0.29, 0.55}, {0.46, 0.21, 0.51}, {0.40, 0.12, 0.18},
-{1.0, 1.0, 1.0}, {0.85, 0.85, 0.85}, {0.7, 0.7, 0.7}, {0.56, 0.56, 0.56},
-{0.42, 0.42, 0.42}, {0.28, 0.28, 0.28}, {0.14, 0.14, 0.14}, {0.0, 0.0, 0.0}
-};
-
-/* for picker, while editing hsv */
-static void ui_set_but_hsv(uiBut *but)
-{
- float col[3];
-
- hsv_to_rgb(but->hsv[0], but->hsv[1], but->hsv[2], col, col+1, col+2);
- ui_set_but_vectorf(but, col);
-}
-
-static void update_picker_hex(uiBlock *block, float *rgb)
-{
- uiBut *bt;
- char col[16];
-
- sprintf(col, "%02X%02X%02X", (unsigned int)(rgb[0]*255.0), (unsigned int)(rgb[1]*255.0), (unsigned int)(rgb[2]*255.0));
-
- // this updates button strings, is hackish... but button pointers are on stack of caller function
-
- for(bt= block->buttons.first; bt; bt= bt->next) {
- if(strcmp(bt->str, "Hex: ")==0) {
- strcpy(bt->poin, col);
- ui_check_but(bt);
- break;
- }
- }
-}
-
-static void update_picker_buts_hsv(uiBlock *block, float *hsv, char *poin)
-{
- uiBut *bt;
- float r, g, b;
- float rgb[3];
-
- // this updates button strings, is hackish... but button pointers are on stack of caller function
- hsv_to_rgb(hsv[0], hsv[1], hsv[2], &r, &g, &b);
-
- rgb[0] = r; rgb[1] = g; rgb[2] = b;
- update_picker_hex(block, rgb);
-
- for(bt= block->buttons.first; bt; bt= bt->next) {
- if(bt->type==HSVCUBE) {
- VECCOPY(bt->hsv, hsv);
- ui_set_but_hsv(bt);
- }
- else if(bt->str[1]==' ') {
- if(bt->str[0]=='R') {
- ui_set_but_val(bt, r);
- }
- else if(bt->str[0]=='G') {
- ui_set_but_val(bt, g);
- }
- else if(bt->str[0]=='B') {
- ui_set_but_val(bt, b);
- }
- else if(bt->str[0]=='H') {
- ui_set_but_val(bt, hsv[0]);
- }
- else if(bt->str[0]=='S') {
- ui_set_but_val(bt, hsv[1]);
- }
- else if(bt->str[0]=='V') {
- ui_set_but_val(bt, hsv[2]);
- }
- }
- }
-}
-
-static void update_picker_buts_hex(uiBlock *block, char *hexcol)
-{
- uiBut *bt;
- float r=0, g=0, b=0;
- float h, s, v;
-
-
- // this updates button strings, is hackish... but button pointers are on stack of caller function
- hex_to_rgb(hexcol, &r, &g, &b);
- rgb_to_hsv(r, g, b, &h, &s, &v);
-
- for(bt= block->buttons.first; bt; bt= bt->next) {
- if(bt->type==HSVCUBE) {
- bt->hsv[0] = h;
- bt->hsv[1] = s;
- bt->hsv[2] = v;
- ui_set_but_hsv(bt);
- }
- else if(bt->str[1]==' ') {
- if(bt->str[0]=='R') {
- ui_set_but_val(bt, r);
- }
- else if(bt->str[0]=='G') {
- ui_set_but_val(bt, g);
- }
- else if(bt->str[0]=='B') {
- ui_set_but_val(bt, b);
- }
- else if(bt->str[0]=='H') {
- ui_set_but_val(bt, h);
- }
- else if(bt->str[0]=='S') {
- ui_set_but_val(bt, s);
- }
- else if(bt->str[0]=='V') {
- ui_set_but_val(bt, v);
- }
- }
- }
-}
-
-
-
-/* bt1 is palette but, col1 is original color */
-/* callback to copy from/to palette */
-static void do_palette_cb(void *bt1, void *col1)
-{
- uiBut *but1= (uiBut *)bt1;
- uiBut *but;
- float *col= (float *)col1;
- float *fp, hsv[3];
-
- fp= (float *)but1->poin;
-
- if( (get_qual() & LR_CTRLKEY) ) {
- VECCOPY(fp, col);
- }
- else {
- VECCOPY(col, fp);
- }
-
- rgb_to_hsv(col[0], col[1], col[2], hsv, hsv+1, hsv+2);
- update_picker_buts_hsv(but1->block, hsv, but1->poin);
- update_picker_hex(but1->block, col);
-
- for (but= but1->block->buttons.first; but; but= but->next) {
- ui_check_but(but);
- ui_draw_but(but);
- }
- but= but1->block->buttons.first;
- ui_block_flush_back(but->block);
-}
-
-/* bt1 is num but, hsv1 is pointer to original color in hsv space*/
-/* callback to handle changes in num-buts in picker */
-static void do_palette1_cb(void *bt1, void *hsv1)
-{
- uiBut *but1= (uiBut *)bt1;
- uiBut *but;
- float *hsv= (float *)hsv1;
- float *fp= NULL;
-
- if(but1->str[1]==' ') {
- if(but1->str[0]=='R') fp= (float *)but1->poin;
- else if(but1->str[0]=='G') fp= ((float *)but1->poin)-1;
- else if(but1->str[0]=='B') fp= ((float *)but1->poin)-2;
- }
- if(fp) {
- rgb_to_hsv(fp[0], fp[1], fp[2], hsv, hsv+1, hsv+2);
- }
- update_picker_buts_hsv(but1->block, hsv, but1->poin);
-
- for (but= but1->block->buttons.first; but; but= but->next) {
- ui_check_but(but);
- ui_draw_but(but);
- }
-
- but= but1->block->buttons.first;
- ui_block_flush_back(but->block);
-
-}
-
-/* bt1 is num but, col1 is pointer to original color */
-/* callback to handle changes in num-buts in picker */
-static void do_palette2_cb(void *bt1, void *col1)
-{
- uiBut *but1= (uiBut *)bt1;
- uiBut *but;
- float *rgb= (float *)col1;
- float *fp= NULL;
-
- if(but1->str[1]==' ') {
- if(but1->str[0]=='H') fp= (float *)but1->poin;
- else if(but1->str[0]=='S') fp= ((float *)but1->poin)-1;
- else if(but1->str[0]=='V') fp= ((float *)but1->poin)-2;
- }
- if(fp) {
- hsv_to_rgb(fp[0], fp[1], fp[2], rgb, rgb+1, rgb+2);
- }
- update_picker_buts_hsv(but1->block, fp, but1->poin);
-
- for (but= but1->block->buttons.first; but; but= but->next) {
- ui_check_but(but);
- ui_draw_but(but);
- }
-
- but= but1->block->buttons.first;
- ui_block_flush_back(but->block);
-
-}
-
-static void do_palette_hex_cb(void *bt1, void *hexcl)
-{
- uiBut *but1= (uiBut *)bt1;
- uiBut *but;
- char *hexcol= (char *)hexcl;
-
- update_picker_buts_hex(but1->block, hexcol);
-
- for (but= but1->block->buttons.first; but; but= but->next) {
- ui_check_but(but);
- ui_draw_but(but);
- }
-
- but= but1->block->buttons.first;
- ui_block_flush_back(but->block);
-}
-
-
-/* used for both 3d view and image window */
-static void do_palette_sample_cb(void *bt1, void *col1) /* frontbuf */
-{
- uiBut *but1= (uiBut *)bt1;
- uiBut *but;
- float tempcol[4];
- int x=0, y=0;
- short mval[2];
- float hsv[3];
- short capturing;
- int oldcursor;
- Window *win;
- unsigned short dev;
-
- oldcursor=get_cursor();
- win=winlay_get_active_window();
-
- while (get_mbut() & L_MOUSE) BIF_wait_for_statechange();
-
- SetBlenderCursor(BC_EYEDROPPER_CURSOR);
-
- /* loop and wait for a mouse click */
- capturing = TRUE;
- while(capturing) {
- char ascii;
- short val;
-
- dev = extern_qread_ext(&val, &ascii);
-
- if(dev==INPUTCHANGE) break;
- if(get_mbut() & R_MOUSE) break;
- else if(get_mbut() & L_MOUSE) {
- uiGetMouse(mywinget(), mval);
- x= mval[0]; y= mval[1];
-
- capturing = FALSE;
- break;
- }
- else if(dev==ESCKEY) break;
- }
- window_set_cursor(win, oldcursor);
-
- if(capturing) return;
-
- if(x<0 || y<0) return;
-
- /* if we've got a glick, use OpenGL to sample the color under the mouse pointer */
- glReadBuffer(GL_FRONT);
- glReadPixels(x, y, 1, 1, GL_RGBA, GL_FLOAT, tempcol);
- glReadBuffer(GL_BACK);
-
- /* and send that color back to the picker */
- rgb_to_hsv(tempcol[0], tempcol[1], tempcol[2], hsv, hsv+1, hsv+2);
- update_picker_buts_hsv(but1->block, hsv, but1->poin);
- update_picker_hex(but1->block, tempcol);
-
- for (but= but1->block->buttons.first; but; but= but->next) {
- ui_check_but(but);
- ui_draw_but(but);
- }
-
- but= but1->block->buttons.first;
- ui_block_flush_back(but->block);
-}
-
-
-/* color picker, Gimp version. mode: 'f' = floating panel, 'p' = popup */
-/* col = read/write to, hsv/old/hexcol = memory for temporal use */
-void uiBlockPickerButtons(uiBlock *block, float *col, float *hsv, float *old, char *hexcol, char mode, short retval)
-{
- uiBut *bt;
- float h, offs;
- int a;
-
- VECCOPY(old, col); // old color stored there, for palette_cb to work
-
- // the cube intersection
- bt= uiDefButF(block, HSVCUBE, retval, "", 0,DPICK+BPICK,FPICK,FPICK, col, 0.0, 0.0, 2, 0, "");
- uiButSetFlag(bt, UI_NO_HILITE);
-
- bt= uiDefButF(block, HSVCUBE, retval, "", 0,0,FPICK,BPICK, col, 0.0, 0.0, 3, 0, "");
- uiButSetFlag(bt, UI_NO_HILITE);
-
- // palette
-
- uiBlockSetEmboss(block, UI_EMBOSSP);
-
- bt=uiDefButF(block, COL, retval, "", FPICK+DPICK, 0, BPICK,BPICK, old, 0.0, 0.0, -1, 0, "Old color, click to restore");
- uiButSetFunc(bt, do_palette_cb, bt, col);
- uiDefButF(block, COL, retval, "", FPICK+DPICK, BPICK+DPICK, BPICK,60-BPICK-DPICK, col, 0.0, 0.0, -1, 0, "Active color");
-
- h= (DPICK+BPICK+FPICK-64)/(UI_PALETTE_TOT/2.0);
- uiBlockBeginAlign(block);
- for(a= -1+UI_PALETTE_TOT/2; a>=0; a--) {
- bt= uiDefButF(block, COL, retval, "", FPICK+DPICK, 65.0+(float)a*h, BPICK/2, h, palette[a+UI_PALETTE_TOT/2], 0.0, 0.0, -1, 0, "Click to choose, hold CTRL to store in palette");
- uiButSetFunc(bt, do_palette_cb, bt, col);
- bt= uiDefButF(block, COL, retval, "", FPICK+DPICK+BPICK/2, 65.0+(float)a*h, BPICK/2, h, palette[a], 0.0, 0.0, -1, 0, "Click to choose, hold CTRL to store in palette");
- uiButSetFunc(bt, do_palette_cb, bt, col);
- }
- uiBlockEndAlign(block);
-
- uiBlockSetEmboss(block, UI_EMBOSS);
-
- // buttons
- rgb_to_hsv(col[0], col[1], col[2], hsv, hsv+1, hsv+2);
- sprintf(hexcol, "%02X%02X%02X", (unsigned int)(col[0]*255.0), (unsigned int)(col[1]*255.0), (unsigned int)(col[2]*255.0));
-
- offs= FPICK+2*DPICK+BPICK;
-
- /* note; made this a TOG now, with NULL pointer. Is because BUT now gets handled with a afterfunc */
- bt= uiDefIconTextBut(block, TOG, UI_RETURN_OK, ICON_EYEDROPPER, "Sample", offs+55, 170, 85, 20, NULL, 0, 0, 0, 0, "Sample the color underneath the following mouse click (ESC or RMB to cancel)");
- uiButSetFunc(bt, do_palette_sample_cb, bt, col);
- uiButSetFlag(bt, UI_TEXT_LEFT);
-
- bt= uiDefBut(block, TEX, retval, "Hex: ", offs, 140, 140, 20, hexcol, 0, 8, 0, 0, "Hex triplet for color (#RRGGBB)");
- uiButSetFunc(bt, do_palette_hex_cb, bt, hexcol);
-
- uiBlockBeginAlign(block);
- bt= uiDefButF(block, NUMSLI, retval, "R ", offs, 110, 140,20, col, 0.0, 1.0, 10, 3, "");
- uiButSetFunc(bt, do_palette1_cb, bt, hsv);
- bt= uiDefButF(block, NUMSLI, retval, "G ", offs, 90, 140,20, col+1, 0.0, 1.0, 10, 3, "");
- uiButSetFunc(bt, do_palette1_cb, bt, hsv);
- bt= uiDefButF(block, NUMSLI, retval, "B ", offs, 70, 140,20, col+2, 0.0, 1.0, 10, 3, "");
- uiButSetFunc(bt, do_palette1_cb, bt, hsv);
-
- uiBlockBeginAlign(block);
- bt= uiDefButF(block, NUMSLI, retval, "H ", offs, 40, 140,20, hsv, 0.0, 1.0, 10, 3, "");
- uiButSetFunc(bt, do_palette2_cb, bt, col);
- bt= uiDefButF(block, NUMSLI, retval, "S ", offs, 20, 140,20, hsv+1, 0.0, 1.0, 10, 3, "");
- uiButSetFunc(bt, do_palette2_cb, bt, col);
- bt= uiDefButF(block, NUMSLI, retval, "V ", offs, 0, 140,20, hsv+2, 0.0, 1.0, 10, 3, "");
- uiButSetFunc(bt, do_palette2_cb, bt, col);
- uiBlockEndAlign(block);
-}
-
-static int ui_do_but_COL(uiBut *but)
-{
- uiBlock *block;
- uiBut *bt;
- ListBase listb={NULL, NULL};
- float hsv[3], old[3], *poin= NULL, colstore[3];
- static char hexcol[128];
- short event;
-
- // signal to prevent calling up color picker
- if(but->a1 == -1) {
- uibut_do_func(but);
- return but->retval;
- }
-
- // enable char button too, use temporal colstore for color
- if(but->pointype!=FLO) {
- if(but->pointype==CHA) {
- ui_get_but_vectorf(but, colstore);
- poin= colstore;
- }
- else return but->retval;
- }
- else poin= (float *)but->poin;
-
- block= uiNewBlock(&listb, "colorpicker", UI_EMBOSS, UI_HELV, but->win);
- block->flag= UI_BLOCK_LOOP|UI_BLOCK_REDRAW;
- block->themecol= TH_BUT_NUM;
-
- uiBlockPickerButtons(block, poin, hsv, old, hexcol, 'p', 0);
-
- /* and lets go */
- block->direction= UI_TOP;
- ui_positionblock(block, but);
- uiBoundsBlock(block, 3);
-
- /* blocks can come from a normal window, but we go to screenspace */
- block->win= G.curscreen->mainwin;
- for(bt= block->buttons.first; bt; bt= bt->next) bt->win= block->win;
- bwin_getsinglematrix(block->win, block->winmat);
-
- event= uiDoBlocks(&listb, 0, 1);
-
- if(but->pointype==CHA) ui_set_but_vectorf(but, colstore);
-
- uibut_do_func(but);
- return but->retval;
-
-}
-
-static int ui_do_but_HSVCUBE(uiBut *but)
-{
- uiBut *bt;
- float x, y;
- short mval[2], mvalo[2];
-
- mvalo[0]= mvalo[1]= -32000;
-
- /* we work on persistant hsv, to prevent it being converted back and forth all the time */
-
- while (get_mbut() & L_MOUSE) {
-
- uiGetMouse(mywinget(), mval);
-
- if(mval[0]!=mvalo[0] || mval[1]!=mvalo[1]) {
- mvalo[0]= mval[0];
- mvalo[1]= mval[1];
-
- /* relative position within box */
- x= ((float)mval[0]-but->x1)/(but->x2-but->x1);
- y= ((float)mval[1]-but->y1)/(but->y2-but->y1);
- CLAMP(x, 0.0, 1.0);
- CLAMP(y, 0.0, 1.0);
-
- if(but->a1==0) {
- but->hsv[0]= x;
- but->hsv[2]= y;
- // hsv_to_rgb(x, s, y, col, col+1, col+2);
- }
- else if(but->a1==1) {
- but->hsv[0]= x;
- but->hsv[1]= y;
- // hsv_to_rgb(x, y, v, col, col+1, col+2);
- }
- else if(but->a1==2) {
- but->hsv[2]= x;
- but->hsv[1]= y;
- // hsv_to_rgb(h, y, x, col, col+1, col+2);
- }
- else {
- but->hsv[0]= x;
- // hsv_to_rgb(x, s, v, col, col+1, col+2);
- }
-
- ui_set_but_hsv(but); // converts to rgb
-
- // update button values and strings
- update_picker_buts_hsv(but->block, but->hsv, but->poin);
-// update_picker_buts_hex(but->block, but->hsv);
-
- /* we redraw the entire block */
- for (bt= but->block->buttons.first; bt; bt= bt->next) {
- if(but->poin == bt->poin) VECCOPY(bt->hsv, but->hsv);
- ui_draw_but(bt);
- }
- ui_block_flush_back(but->block);
- }
- else BIF_wait_for_statechange();
- }
-
- return but->retval;
-}
-
-#ifdef INTERNATIONAL
-
-static int ui_do_but_CHARTAB(uiBut *but)
-{
- /* Variables */
- short mval[2];
- float sx, sy, ex, ey;
- float width, height;
- float butw, buth;
- int x, y, cs, che;
-
- /* Check the position */
- uiGetMouse(mywinget(), mval);
-
- /* Calculate the size of the button */
- width = abs(but->x2 - but->x1);
- height = abs(but->y2 - but->y1);
-
- butw = floor(width / 12);
- buth = floor(height / 6);
-
- /* Initialize variables */
- sx = but->x1;
- ex = but->x1 + butw;
- sy = but->y1 + height - buth;
- ey = but->y1 + height;
-
- cs = G.charstart;
-
- /* And the character is */
- x = (int) ((mval[0] / butw) - 0.5);
- y = (int) (6 - ((mval[1] / buth) - 0.5));
-
- che = cs + (y*12) + x;
-
- if(che > G.charmax)
- che = 0;
-
- if(G.obedit)
- {
- do_textedit(0,0,che);
- }
-
- return but->retval;
-}
-
-#endif
-
-static int vergcband(const void *a1, const void *a2)
-{
- const CBData *x1=a1, *x2=a2;
-
- if( x1->pos > x2->pos ) return 1;
- else if( x1->pos < x2->pos) return -1;
- return 0;
-}
-
-
-static void do_colorband_evt(ColorBand *coba)
-{
- int a;
-
- if(coba==NULL) return;
-
- if(coba->tot<2) return;
-
- for(a=0; a<coba->tot; a++) coba->data[a].cur= a;
- qsort(coba->data, coba->tot, sizeof(CBData), vergcband);
- for(a=0; a<coba->tot; a++) {
- if(coba->data[a].cur==coba->cur) {
- if(coba->cur!=a) addqueue(curarea->win, REDRAW, 0); /* button cur */
- coba->cur= a;
- break;
- }
- }
-}
-
-static int ui_do_but_COLORBAND(uiBut *but)
-{
- ColorBand *coba= (ColorBand *)but->poin;
- CBData *cbd;
- float dx, width= but->x2-but->x1;
- int a;
- int mindist= 12, xco;
- short mval[2], mvalo[2];
-
- uiGetMouse(mywinget(), mvalo);
-
- if(G.qual & LR_CTRLKEY) {
- /* insert new key on mouse location */
- if(coba->tot < MAXCOLORBAND-1) {
- float pos= ((float)(mvalo[0] - but->x1))/width;
- float col[4];
-
- do_colorband(coba, pos, col); /* executes it */
-
- coba->tot++;
- coba->cur= coba->tot-1;
-
- coba->data[coba->cur].r= col[0];
- coba->data[coba->cur].g= col[1];
- coba->data[coba->cur].b= col[2];
- coba->data[coba->cur].a= col[3];
- coba->data[coba->cur].pos= pos;
-
- do_colorband_evt(coba);
- }
- }
- else {
-
- /* first, activate new key when mouse is close */
- for(a=0, cbd= coba->data; a<coba->tot; a++, cbd++) {
- xco= but->x1 + (cbd->pos*width);
- xco= ABS(xco-mvalo[0]);
- if(a==coba->cur) xco+= 5; // selected one disadvantage
- if(xco<mindist) {
- coba->cur= a;
- mindist= xco;
- }
- }
-
- cbd= coba->data + coba->cur;
-
- while(get_mbut() & L_MOUSE) {
- uiGetMouse(mywinget(), mval);
- if(mval[0]!=mvalo[0]) {
- dx= mval[0]-mvalo[0];
- dx/= width;
- cbd->pos+= dx;
- CLAMP(cbd->pos, 0.0, 1.0);
-
- ui_draw_but(but);
- ui_block_flush_back(but->block);
-
- do_colorband_evt(coba);
- cbd= coba->data + coba->cur; /* because qsort */
-
- mvalo[0]= mval[0];
- }
- BIF_wait_for_statechange();
- }
- }
-
- return but->retval;
-}
-
-/* button is presumed square */
-/* if mouse moves outside of sphere, it does negative normal */
-static int ui_do_but_NORMAL(uiBut *but)
-{
- float dx, dy, rad, radsq, mrad, *fp= (float *)but->poin;
- int firsttime=1;
- short mval[2], mvalo[2], mvals[2], mvaldx, mvaldy;
-
- rad= (but->x2 - but->x1);
- radsq= rad*rad;
-
- if(fp[2]>0.0f) {
- mvaldx= (rad*fp[0]);
- mvaldy= (rad*fp[1]);
- }
- else if(fp[2]> -1.0f) {
- mrad= rad/sqrt(fp[0]*fp[0] + fp[1]*fp[1]);
-
- mvaldx= 2.0f*mrad*fp[0] - (rad*fp[0]);
- mvaldy= 2.0f*mrad*fp[1] - (rad*fp[1]);
- }
- else mvaldx= mvaldy= 0;
-
- uiGetMouse(mywinget(), mvalo);
- mvals[0]= mvalo[0];
- mvals[1]= mvalo[1];
-
- while(get_mbut() & L_MOUSE) {
-
- uiGetMouse(mywinget(), mval);
-
- if(mval[0]!=mvalo[0] || mval[1]!=mvalo[1] || firsttime) {
- firsttime= 0;
-
- dx= (float)(mval[0]+mvaldx-mvals[0]);
- dy= (float)(mval[1]+mvaldy-mvals[1]);
-
- mrad= dx*dx+dy*dy;
- if(mrad < radsq) { /* inner circle */
- fp[0]= dx;
- fp[1]= dy;
- fp[2]= sqrt( radsq-dx*dx-dy*dy );
- }
- else { /* outer circle */
-
- mrad= rad/sqrt(mrad); // veclen
-
- dx*= (2.0f*mrad - 1.0f);
- dy*= (2.0f*mrad - 1.0f);
-
- mrad= dx*dx+dy*dy;
- if(mrad < radsq) {
- fp[0]= dx;
- fp[1]= dy;
- fp[2]= -sqrt( radsq-dx*dx-dy*dy );
- }
- }
- Normalize(fp);
-
- ui_draw_but(but);
- ui_block_flush_back(but->block);
-
- mvalo[0]= mval[0];
- mvalo[1]= mval[1];
- }
- BIF_wait_for_statechange();
- }
-
- return but->retval;
-}
-
-static int ui_do_but_CURVE(uiBut *but)
-{
- CurveMapping *cumap= (CurveMapping *)but->poin;
- CurveMap *cuma= cumap->cm+cumap->cur;
- CurveMapPoint *cmp= cuma->curve;
- float fx, fy, zoomx, zoomy, offsx, offsy;
- float dist, mindist= 200.0f; // 14 pixels radius
- int a, sel= -1, retval= but->retval;
- short mval[2], mvalo[2];
-
- uiGetMouse(mywinget(), mval);
-
- /* calculate offset and zoom */
- zoomx= (but->x2-but->x1)/(cumap->curr.xmax-cumap->curr.xmin);
- zoomy= (but->y2-but->y1)/(cumap->curr.ymax-cumap->curr.ymin);
- offsx= cumap->curr.xmin;
- offsy= cumap->curr.ymin;
-
- if(G.qual & LR_CTRLKEY) {
-
- fx= ((float)mval[0] - but->x1)/zoomx + offsx;
- fy= ((float)mval[1] - but->y1)/zoomy + offsy;
-
- curvemap_insert(cuma, fx, fy);
- curvemapping_changed(cumap, 0);
-
- ui_draw_but(but);
- ui_block_flush_back(but->block);
- }
-
-
- /* check for selecting of a point */
- cmp= cuma->curve; /* ctrl adds point, new malloc */
- for(a=0; a<cuma->totpoint; a++) {
- fx= but->x1 + zoomx*(cmp[a].x-offsx);
- fy= but->y1 + zoomy*(cmp[a].y-offsy);
- dist= (fx-mval[0])*(fx-mval[0]) + (fy-mval[1])*(fy-mval[1]);
- if(dist < mindist) {
- sel= a;
- mindist= dist;
- }
- }
-
- if (sel == -1) {
- /* if the click didn't select anything, check if it's clicked on the
- * curve itself, and if so, add a point */
- fx= ((float)mval[0] - but->x1)/zoomx + offsx;
- fy= ((float)mval[1] - but->y1)/zoomy + offsy;
-
- cmp= cuma->table;
-
- /* loop through the curve segment table and find what's near the mouse.
- * 0.05 is kinda arbitrary, but seems to be what works nicely. */
- for(a=0; a<=CM_TABLE; a++) {
- if ( ( fabs(fx - cmp[a].x) < (0.05) ) && ( fabs(fy - cmp[a].y) < (0.05) ) ) {
-
- curvemap_insert(cuma, fx, fy);
- curvemapping_changed(cumap, 0);
-
- ui_draw_but(but);
- ui_block_flush_back(but->block);
-
- /* reset cmp back to the curve points again, rather than drawing segments */
- cmp= cuma->curve;
-
- /* find newly added point and make it 'sel' */
- for(a=0; a<cuma->totpoint; a++) {
- if (cmp[a].x == fx) sel = a;
- }
-
- break;
- }
- }
- }
-
- /* ok, we move a point */
- if(sel!= -1) {
- int moved_point;
- int moved_mouse= 0;
-
- /* deselect all if this one is deselect. except if we hold shift */
- if((G.qual & LR_SHIFTKEY)==0 && (cmp[sel].flag & SELECT)==0)
- for(a=0; a<cuma->totpoint; a++)
- cmp[a].flag &= ~SELECT;
- cmp[sel].flag |= SELECT;
-
- /* draw to show select updates */
- ui_draw_but(but);
- ui_block_flush_back(but->block);
-
- /* while move mouse, do move points around */
- while(get_mbut() & L_MOUSE) {
-
- uiGetMouse(mywinget(), mvalo);
-
- if(mval[0]!=mvalo[0] || mval[1]!=mvalo[1]) {
- moved_mouse= 1; /* for selection */
- moved_point= 0; /* for ctrl grid, can't use orig coords because of sorting */
-
- fx= (mvalo[0]-mval[0])/zoomx;
- fy= (mvalo[1]-mval[1])/zoomy;
- for(a=0; a<cuma->totpoint; a++) {
- if(cmp[a].flag & SELECT) {
- float origx= cmp[a].x, origy= cmp[a].y;
- cmp[a].x+= fx;
- cmp[a].y+= fy;
- if( (get_qual() & LR_SHIFTKEY) ) {
- cmp[a].x= 0.125f*floor(0.5f + 8.0f*cmp[a].x);
- cmp[a].y= 0.125f*floor(0.5f + 8.0f*cmp[a].y);
- }
- if(cmp[a].x!=origx || cmp[a].y!=origy)
- moved_point= 1;
- }
- }
- curvemapping_changed(cumap, 0); /* no remove doubles */
-
- ui_draw_but(but);
- ui_block_flush_back(but->block);
-
- if(moved_point) {
- mval[0]= mvalo[0];
- mval[1]= mvalo[1];
- }
- }
- BIF_wait_for_statechange();
- }
-
- if(moved_mouse==0) {
- /* deselect all, select one */
- if((G.qual & LR_SHIFTKEY)==0) {
- for(a=0; a<cuma->totpoint; a++)
- cmp[a].flag &= ~SELECT;
- cmp[sel].flag |= SELECT;
- }
- }
- else
- curvemapping_changed(cumap, 1); /* remove doubles */
-
- ui_draw_but(but);
- ui_block_flush_back(but->block);
- }
- else {
- /* we move the view */
- retval= B_NOP;
-
- while(get_mbut() & L_MOUSE) {
-
- uiGetMouse(mywinget(), mvalo);
-
- if(mval[0]!=mvalo[0] || mval[1]!=mvalo[1]) {
- fx= (mvalo[0]-mval[0])/zoomx;
- fy= (mvalo[1]-mval[1])/zoomy;
-
- /* clamp for clip */
- if(cumap->flag & CUMA_DO_CLIP) {
- if(cumap->curr.xmin-fx < cumap->clipr.xmin)
- fx= cumap->curr.xmin - cumap->clipr.xmin;
- else if(cumap->curr.xmax-fx > cumap->clipr.xmax)
- fx= cumap->curr.xmax - cumap->clipr.xmax;
- if(cumap->curr.ymin-fy < cumap->clipr.ymin)
- fy= cumap->curr.ymin - cumap->clipr.ymin;
- else if(cumap->curr.ymax-fy > cumap->clipr.ymax)
- fy= cumap->curr.ymax - cumap->clipr.ymax;
- }
- cumap->curr.xmin-=fx;
- cumap->curr.ymin-=fy;
- cumap->curr.xmax-=fx;
- cumap->curr.ymax-=fy;
-
- ui_draw_but(but);
- ui_block_flush_back(but->block);
-
- mval[0]= mvalo[0];
- mval[1]= mvalo[1];
- }
- }
- BIF_wait_for_statechange();
- }
-
- return retval;
-}
-
-/* ************************************************ */
-
-void uiSetButLock(int val, char *lockstr)
-{
- UIlock |= val;
- if (val) UIlockstr= lockstr;
-}
-
-void uiClearButLock()
-{
- UIlock= 0;
- UIlockstr= NULL;
-}
-
-/* *************************************************************** */
-
-static void setup_file(uiBlock *block)
-{
- uiBut *but;
- FILE *fp;
-
- fp= fopen("butsetup","w");
- if(fp==NULL);
- else {
- but= block->buttons.first;
- while(but) {
- ui_check_but(but);
- fprintf(fp,"%d,%d,%d,%d %s %s\n", (int)but->x1, (int)but->y1, (int)( but->x2-but->x1), (int)(but->y2-but->y1), but->str, but->tip);
- but= but->next;
- }
- fclose(fp);
- }
-}
-
-
-static void edit_but(uiBlock *block, uiBut *but, uiEvent *uevent)
-{
- short dx, dy, mval[2], mvalo[2], didit=0;
-
- getmouseco_sc(mvalo);
- while(TRUE) {
- if( !(get_mbut() & L_MOUSE) ) break;
-
- getmouseco_sc(mval);
- dx= (mval[0]-mvalo[0]);
- dy= (mval[1]-mvalo[1]);
-
- if(dx!=0 || dy!=0) {
- mvalo[0]= mval[0];
- mvalo[1]= mval[1];
-
- cpack(0xc0c0c0);
- glRectf(but->x1-2, but->y1-2, but->x2+2, but->y2+2);
-
- if((uevent->qual & LR_SHIFTKEY)==0) {
- but->x1 += dx;
- but->y1 += dy;
- }
- but->x2 += dx;
- but->y2 += dy;
-
- ui_draw_but(but);
- ui_block_flush_back(but->block);
- didit= 1;
-
- }
- /* idle for this poor code */
- else PIL_sleep_ms(30);
- }
- if(didit) setup_file(block);
-}
-
-
-/* is called when LEFTMOUSE is pressed or released
- * return: butval or zero
- */
-static int ui_do_button(uiBlock *block, uiBut *but, uiEvent *uevent)
-{
- int retval= 0;
-
- if(but->lock) {
- if (but->lockstr) {
- error("%s", but->lockstr);
- return 0;
- }
- }
- else {
- if( but->pointype ) { /* there's a pointer needed */
- if(but->poin==0 ) {
- printf("DoButton pointer error: %s\n",but->str);
- return 0;
- }
- }
- }
-
- if(G.rt==1 && (uevent->qual & LR_CTRLKEY)) {
- edit_but(block, but, uevent);
- return 0;
- }
-
- block->flag |= UI_BLOCK_BUSY;
-
- switch(but->type) {
- case BUT:
- if(uevent->val) retval= ui_do_but_BUT(but);
- break;
-
- case KEYEVT:
- if(uevent->val) retval= ui_do_but_KEYEVT(but);
- break;
-
- case TOG:
- case TOGR:
- case ICONTOG:
- case ICONTOGN:
- case TOGN:
- case BUT_TOGDUAL:
- if(uevent->val) {
- retval= ui_do_but_TOG(block, but, uevent->qual);
- }
- break;
-
- case ROW:
- if(uevent->val) retval= ui_do_but_ROW(block, but);
- break;
-
- case SCROLL:
- /* DrawBut(b, 1); */
- /* do_scrollbut(b); */
- /* DrawBut(b,0); */
- break;
-
- case NUM:
- if(uevent->val) retval= ui_do_but_NUM(but);
- break;
-
- case SLI:
- case NUMSLI:
- case HSVSLI:
- if(uevent->val) retval= ui_do_but_NUMSLI(but);
- break;
-
- case ROUNDBOX:
- case LABEL:
- if(uevent->val) retval= ui_do_but_LABEL(but);
- break;
-
- case TOG3:
- if(uevent->val) retval= ui_do_but_TOG3(but);
- break;
-
- case TEX:
- if(uevent->val) retval= ui_do_but_TEX(but);
- break;
-
- case MENU:
- if(uevent->val) retval= ui_do_but_MENU(but);
- break;
-
- case ICONROW:
- if(uevent->val) retval= ui_do_but_ICONROW(but);
- break;
-
- case ICONTEXTROW:
- if(uevent->val) retval= ui_do_but_ICONTEXTROW(but);
- break;
-
- case IDPOIN:
- if(uevent->val) retval= ui_do_but_IDPOIN(but);
- break;
-
- case BLOCK:
- case PULLDOWN:
- if(uevent->val) {
- ui_do_but_BLOCK(but, uevent->event);
- retval= 0;
- if(block->auto_open==0) block->auto_open= 1;
- }
- break;
-
- case BUTM:
- retval= ui_do_but_BUTM(but);
- break;
-
- case LINK:
- case INLINK:
- retval= ui_do_but_LINK(block, but);
- break;
-
- case COL:
- if(uevent->val) retval= ui_do_but_COL(but);
- break;
-
- case HSVCUBE:
- retval= ui_do_but_HSVCUBE(but);
- break;
- case BUT_COLORBAND:
- retval= ui_do_but_COLORBAND(but);
- break;
- case BUT_NORMAL:
- retval= ui_do_but_NORMAL(but);
- break;
- case BUT_CURVE:
- retval= ui_do_but_CURVE(but);
- break;
-
-#ifdef INTERNATIONAL
- case CHARTAB:
- retval= ui_do_but_CHARTAB(but);
- break;
-#endif
- }
-
- block->flag &= ~UI_BLOCK_BUSY;
-
- return retval;
-}
-
-static void ui_delete_active_linkline(uiBlock *block)
-{
- uiBut *but;
- uiLink *link;
- uiLinkLine *line, *nline;
- int a, b;
-
- but= block->buttons.first;
- while(but) {
- if(but->type==LINK && but->link) {
- line= but->link->lines.first;
- while(line) {
-
- nline= line->next;
-
- if(line->flag & UI_SELECT) {
- BLI_remlink(&but->link->lines, line);
-
- link= line->from->link;
-
- /* are there more pointers allowed? */
- if(link->ppoin) {
-
- if(*(link->totlink)==1) {
- *(link->totlink)= 0;
- MEM_freeN(*(link->ppoin));
- *(link->ppoin)= NULL;
- }
- else {
- b= 0;
- for(a=0; a< (*(link->totlink)); a++) {
-
- if( (*(link->ppoin))[a] != line->to->poin ) {
- (*(link->ppoin))[b]= (*(link->ppoin))[a];
- b++;
- }
- }
- (*(link->totlink))--;
- }
- }
- else {
- *(link->poin)= NULL;
- }
-
- MEM_freeN(line);
- }
- line= nline;
- }
- }
- but= but->next;
- }
-
- /* temporal! these buttons can be everywhere... */
- allqueue(REDRAWBUTSLOGIC, 0);
-}
-
-static void ui_do_active_linklines(uiBlock *block, short *mval)
-{
- uiBut *but;
- uiLinkLine *line, *act= NULL;
- float mindist= 12.0, fac, v1[2], v2[2], v3[3];
- int foundone= 0;
-
- if(mval) {
- v1[0]= mval[0];
- v1[1]= mval[1];
-
- /* find a line close to the mouse */
- but= block->buttons.first;
- while(but) {
- if(but->type==LINK && but->link) {
- foundone= 1;
- line= but->link->lines.first;
- while(line) {
- v2[0]= line->from->x2;
- v2[1]= (line->from->y1+line->from->y2)/2.0;
- v3[0]= line->to->x1;
- v3[1]= (line->to->y1+line->to->y2)/2.0;
-
- fac= PdistVL2Dfl(v1, v2, v3);
- if(fac < mindist) {
- mindist= fac;
- act= line;
- }
- line= line->next;
- }
- }
- but= but->next;
- }
- }
-
- /* check for a 'found one' to prevent going to 'frontbuffer' mode.
- this slows done gfx quite some, and at OSX the 'finish' forces a swapbuffer */
- if(foundone) {
- glDrawBuffer(GL_FRONT);
-
- /* draw */
- but= block->buttons.first;
- while(but) {
- if(but->type==LINK && but->link) {
- line= but->link->lines.first;
- while(line) {
- if(line==act) {
- if((line->flag & UI_SELECT)==0) {
- line->flag |= UI_SELECT;
- ui_draw_linkline(but, line);
- }
- }
- else if(line->flag & UI_SELECT) {
- line->flag &= ~UI_SELECT;
- ui_draw_linkline(but, line);
- }
- line= line->next;
- }
- }
- but= but->next;
- }
- bglFlush();
- glDrawBuffer(GL_BACK);
- }
-}
-
-
-/* only to be used to prevent an 'outside' event when using nested pulldowns */
-/* only one checks:
- - while mouse moves in triangular area defined old mouse position and left/right side of new menu
- - only for 1 second
-
- return 0: check outside
-*/
-static int ui_mouse_motion_towards_block(uiBlock *block, uiEvent *uevent)
-{
- short mvalo[2], dx, dy, domx, domy;
- int counter=0;
-
- if((block->direction & UI_TOP) || (block->direction & UI_DOWN)) return 0;
- if(uevent->event!= MOUSEX && uevent->event!= MOUSEY) return 0;
-
- /* calculate dominant direction */
- domx= ( -uevent->mval[0] + (block->maxx+block->minx)/2 );
- domy= ( -uevent->mval[1] + (block->maxy+block->miny)/2 );
- /* we need some accuracy */
- if( abs(domx)<4 ) return 0;
-
- uiGetMouse(mywinget(), mvalo);
-
- while(TRUE) {
- uiGetMouse(mywinget(), uevent->mval);
-
- /* check inside, if so return */
- if( block->minx <= uevent->mval[0] && block->maxx >= uevent->mval[0] ) {
- if( block->miny <= uevent->mval[1] && block->maxy >= uevent->mval[1] ) {
- return 1;
- }
- }
-
- /* check direction */
- dx= uevent->mval[0] - mvalo[0];
- dy= uevent->mval[1] - mvalo[1];
-
- if( abs(dx)+abs(dy)>4 ) { // threshold
- /* menu to right */
- if(domx>0) {
- int fac= (uevent->mval[0] - mvalo[0])*(mvalo[1] - (short)(block->maxy +20)) + (uevent->mval[1] - mvalo[1])*(-mvalo[0] + (short)block->minx);
- if( (fac>0)) {
- // printf("Left outside 1, Fac %d\n", fac);
- return 0;
- }
-
- fac= (uevent->mval[0] - mvalo[0])*(mvalo[1] - (short)(block->miny-20)) + (uevent->mval[1] - mvalo[1])*(-mvalo[0] + (short)block->minx);
- if( (fac<0)) {
- //printf("Left outside 2, Fac %d\n", fac);
- return 0;
- }
- }
- else {
- int fac= (uevent->mval[0] - mvalo[0])*(mvalo[1] - (short)(block->maxy+20)) + (uevent->mval[1] - mvalo[1])*(-mvalo[0] + (short)block->maxx);
- if( (fac<0)) {
- // printf("Left outside 1, Fac %d\n", fac);
- return 0;
- }
-
- fac= (uevent->mval[0] - mvalo[0])*(mvalo[1] - (short)(block->miny-20)) + (uevent->mval[1] - mvalo[1])*(-mvalo[0] + (short)block->maxx);
- if( (fac>0)) {
- // printf("Left outside 2, Fac %d\n", fac);
- return 0;
- }
- }
- }
-
- /* idle for this poor code */
- PIL_sleep_ms(10);
- counter++;
- if(counter > 100) {
- //printf("left because of timer (1 sec)\n");
- return 0;
- }
- }
-
- return 0;
-}
-
-
-static void ui_set_ftf_font(float aspect)
-{
-
-#ifdef INTERNATIONAL
- if(aspect<1.15) {
- FTF_SetFontSize('l');
- }
- else if(aspect<1.59) {
- FTF_SetFontSize('m');
- }
- else {
- FTF_SetFontSize('s');
- }
-#endif
-}
-
-static void ui_but_next_edittext(uiBlock *block)
-{
- uiBut *but, *actbut;
-
- for(actbut= block->buttons.first; actbut; actbut= actbut->next) {
- /* label and roundbox can overlap real buttons (backdrops...) */
- if(actbut->type!=LABEL && actbut->type!=ROUNDBOX)
- if(actbut->flag & UI_ACTIVE) break;
- }
- if(actbut) {
- /* ensure all buttons are cleared, label/roundbox overlap */
- for(but= block->buttons.first; but; but= but->next)
- but->flag &= ~(UI_ACTIVE|UI_SELECT);
-
- for(but= actbut->next; but; but= but->next) {
- if(ELEM4(but->type, TEX, NUM, NUMSLI, HSVSLI)) {
- but->flag |= UI_ACTIVE;
- return;
- }
- }
- for(but= block->buttons.first; but!=actbut; but= but->next) {
- if(ELEM4(but->type, TEX, NUM, NUMSLI, HSVSLI)) {
- but->flag |= UI_ACTIVE;
- return;
- }
- }
- }
-}
-
-static void ui_but_prev_edittext(uiBlock *block)
-{
- uiBut *but, *actbut;
-
- for(actbut= block->buttons.first; actbut; actbut= actbut->next) {
- /* label and roundbox can overlap real buttons (backdrops...) */
- if(actbut->type!=LABEL && actbut->type!=ROUNDBOX)
- if(actbut->flag & UI_ACTIVE) break;
- }
- if(actbut) {
- /* ensure all buttons are cleared, label/roundbox overlap */
- for(but= block->buttons.first; but; but= but->next)
- but->flag &= ~(UI_ACTIVE|UI_SELECT);
-
- for(but= actbut->prev; but; but= but->prev) {
- if(ELEM4(but->type, TEX, NUM, NUMSLI, HSVSLI)) {
- but->flag |= UI_ACTIVE;
- return;
- }
- }
- for(but= block->buttons.last; but!=actbut; but= but->prev) {
- if(ELEM4(but->type, TEX, NUM, NUMSLI, HSVSLI)) {
- but->flag |= UI_ACTIVE;
- return;
- }
- }
- }
-}
-
-/* ******************************************************* */
-
-/* nasty but safe way to store screendump rect */
-static int scr_x=0, scr_y=0, scr_sizex=0, scr_sizey=0;
-
-static void ui_set_screendump_bbox(uiBlock *block)
-{
- if(block) {
- scr_x= block->minx;
- scr_y= block->miny;
- scr_sizex= block->maxx - block->minx;
- scr_sizey= block->maxy - block->miny;
- }
- else {
- scr_sizex= scr_sizey= 0;
- }
-}
-
-/* used for making screenshots for menus, called in screendump.c */
-int uiIsMenu(int *x, int *y, int *sizex, int *sizey)
-{
- if(scr_sizex!=0 && scr_sizey!=0) {
- *x= scr_x;
- *y= scr_y;
- *sizex= scr_sizex;
- *sizey= scr_sizey;
- return 1;
- }
-
- return 0;
-}
-/* ******************************************************* */
-
-/* return:
- * UI_NOTHING pass event to other ui's
- * UI_CONT don't pass event to other ui's
- * UI_RETURN something happened, return, swallow event
- */
-static int ui_do_block(uiBlock *block, uiEvent *uevent, int movemouse_quit)
-{
- uiBut *but, *bt;
- int butevent, event, retval=UI_NOTHING, count, act=0;
- int inside= 0, active=0;
-
- if(block->win != mywinget()) return UI_NOTHING;
-
- /* filter some unwanted events */
- /* btw: we allow event==0 for first time in menus, draws the hilited item */
- if(uevent==0 || uevent->event==LEFTSHIFTKEY || uevent->event==RIGHTSHIFTKEY) return UI_NOTHING;
- if(uevent->event==UI_BUT_EVENT) return UI_NOTHING;
-
- if(block->flag & UI_BLOCK_ENTER_OK) {
- if((uevent->event==RETKEY || uevent->event==PADENTER) && uevent->val) {
- // printf("qual: %d %d %d\n", uevent->qual, get_qual(), G.qual);
- if ((G.qual & LR_SHIFTKEY) == 0) {
- return UI_RETURN_OK;
- }
- }
- }
-
- ui_set_ftf_font(block->aspect); // sets just a pointer in ftf lib... the button dont have ftf handles
- ui_set_screendump_bbox(block);
-
- // added this for panels in windows with buttons...
- // maybe speed optimize should require test
- if((block->flag & UI_BLOCK_LOOP)==0) {
- glMatrixMode(GL_PROJECTION);
- bwin_load_winmatrix(block->win, block->winmat);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- }
-
- Mat4CpyMat4(UIwinmat, block->winmat);
- uiPanelPush(block); // push matrix; no return without pop!
-
- uiGetMouse(mywinget(), uevent->mval); /* transformed mouseco */
-
- /* check boundbox and panel events */
- if( block->minx <= uevent->mval[0] && block->maxx >= uevent->mval[0] ) {
-
- // inside block
- if( block->miny <= uevent->mval[1] && block->maxy >= uevent->mval[1] ) inside= INSIDE_BLOCK;
-
- if(block->panel && block->panel->paneltab==NULL) {
-
- /* clicked at panel header? */
- if( block->panel->flag & PNL_CLOSEDX) {
- if(block->minx <= uevent->mval[0] && block->minx+PNL_HEADER >= uevent->mval[0])
- inside= INSIDE_PANEL_HEADER;
- }
- else if( (block->maxy <= uevent->mval[1]) && (block->maxy+PNL_HEADER >= uevent->mval[1]) ) {
- inside= INSIDE_PANEL_HEADER;
- }
- else if( block->panel->control & UI_PNL_SCALE) {
- if( (block->maxx-PNL_HEADER <= uevent->mval[0]))
- if( (block->miny+PNL_HEADER >= uevent->mval[1]) && inside )
- inside= INSIDE_PANEL_SCALE;
- }
-
- if (inside) { // this stuff should move to do_panel
-
- if(uevent->event==LEFTMOUSE) {
- if(ELEM(inside, INSIDE_PANEL_HEADER, INSIDE_PANEL_SCALE)) {
- uiPanelPop(block); // pop matrix; no return without pop!
- if(inside==INSIDE_PANEL_HEADER)
- ui_do_panel(block, uevent);
- else
- ui_scale_panel(block);
- return UI_EXIT_LOOP; // exit loops because of moving panels
- }
- }
- else if(uevent->event==ESCKEY) {
- if(block->handler) {
- rem_blockhandler(curarea, block->handler);
- addqueue(curarea->win, REDRAW, 1);
- }
- }
- else if(uevent->event==PADPLUSKEY || uevent->event==PADMINUS) {
- int zoom=0;
-
- /* if panel is closed, only zoom if mouse is over the header */
- if ((block->panel->flag & PNL_CLOSEDX) || (block->panel->flag & PNL_CLOSEDY)) {
- if (inside == INSIDE_PANEL_HEADER)
- zoom=1;
- } else if (inside >= INSIDE_BLOCK)
- zoom=1;
-
- if(zoom) {
- SpaceLink *sl= curarea->spacedata.first;
- if(curarea->spacetype!=SPACE_BUTS) {
- if(!(block->panel->control & UI_PNL_SCALE)) {
- if(uevent->event==PADPLUSKEY) sl->blockscale+= 0.1;
- else sl->blockscale-= 0.1;
- CLAMP(sl->blockscale, 0.6, 1.0);
- addqueue(block->winq, REDRAW, 1);
- retval= UI_RETURN_OK;
- }
- }
- }
-
- }
- }
- }
- }
-
- /* inside menus, scrollwheel acts as arrow */
- if(block->flag & UI_BLOCK_LOOP) {
- if(uevent->event==WHEELUPMOUSE) uevent->event= UPARROWKEY;
- if(uevent->event==WHEELDOWNMOUSE) uevent->event= DOWNARROWKEY;
- }
-
- switch(uevent->event) {
- case LEFTARROWKEY: /* closing sublevels of pulldowns */
- if(uevent->val && (block->flag & UI_BLOCK_LOOP) && block->parent) {
- return UI_RETURN_OUT;
- }
- break;
-
- case RIGHTARROWKEY: /* opening sublevels of pulldowns */
- if(uevent->val && (block->flag & UI_BLOCK_LOOP)) {
- for(but= block->buttons.first; but; but= but->next) {
- if(but->flag & UI_ACTIVE) {
- if(but->type==BLOCK) {
- but->flag &= ~UI_MOUSE_OVER;
- uevent->event= BUT_ACTIVATE;
- }
- break;
- }
- }
- if(but==NULL) { /* no item active, we make first active */
- if(block->direction & UI_TOP) but= ui_but_last(block);
- else but= ui_but_first(block);
- if(but) {
- but->flag |= UI_ACTIVE;
- ui_draw_but(but);
- }
- }
- }
- break;
-
- case PAD8: case PAD2:
- case UPARROWKEY:
- case DOWNARROWKEY:
- if(inside || (block->flag & UI_BLOCK_LOOP)) {
- /* arrowkeys: only handle for block_loop blocks */
- event= 0;
- if(block->flag & UI_BLOCK_LOOP) {
- event= uevent->event;
- if(event==PAD8) event= UPARROWKEY;
- if(event==PAD2) event= DOWNARROWKEY;
- }
- else {
- if(uevent->event==PAD8) event= UPARROWKEY;
- if(uevent->event==PAD2) event= DOWNARROWKEY;
- }
- if(event && uevent->val) {
-
- for(but= block->buttons.first; but; but= but->next) {
- but->flag &= ~UI_MOUSE_OVER;
-
- if(but->flag & UI_ACTIVE) {
- but->flag &= ~UI_ACTIVE;
- ui_draw_but(but);
-
- if(event==UPARROWKEY) {
- if(block->direction & UI_TOP) bt= ui_but_next(but);
- else bt= ui_but_prev(but);
- }
- else {
- if(block->direction & UI_TOP) bt= ui_but_prev(but);
- else bt= ui_but_next(but);
- }
-
- if(bt) {
- bt->flag |= UI_ACTIVE;
- ui_draw_but(bt);
- break;
- }
- }
- }
-
- /* nothing done */
- if(but==NULL) {
-
- if(event==UPARROWKEY) {
- if(block->direction & UI_TOP) but= ui_but_first(block);
- else but= ui_but_last(block);
- }
- else {
- if(block->direction & UI_TOP) but= ui_but_last(block);
- else but= ui_but_first(block);
- }
- if(but) {
- but->flag |= UI_ACTIVE;
- ui_draw_but(but);
- }
- }
- retval= UI_CONT;
- }
- }
- break;
-
- case ONEKEY: act= 1;
- case TWOKEY: if(act==0) act= 2;
- case THREEKEY: if(act==0) act= 3;
- case FOURKEY: if(act==0) act= 4;
- case FIVEKEY: if(act==0) act= 5;
- case SIXKEY: if(act==0) act= 6;
- case SEVENKEY: if(act==0) act= 7;
- case EIGHTKEY: if(act==0) act= 8;
- case NINEKEY: if(act==0) act= 9;
- case ZEROKEY: if(act==0) act= 10;
-
- if( block->flag & UI_BLOCK_NUMSELECT ) {
-
- if(get_qual() & LR_ALTKEY) act+= 10;
-
- count= 0;
- for(but= block->buttons.first; but; but= but->next) {
- int doit= 0;
-
- if(but->type!=LABEL && but->type!=SEPR) count++;
- /* exception for menus like layer buts, with button aligning they're not drawn in order */
- if(but->type==TOGR) {
- if(but->bitnr==act-1) doit= 1;
- } else if(count==act) doit=1;
-
- if(doit) {
- but->flag |= UI_ACTIVE;
- if(uevent->val==1) ui_draw_but(but);
- else if(block->flag & UI_BLOCK_RET_1) { /* to make UI_BLOCK_RET_1 working */
- uevent->event= RETKEY;
- uevent->val= 1;
- //addqueue(block->winq, RIGHTARROWKEY, 1); (why! (ton))
- }
- else {
- uevent->event= LEFTMOUSE; /* to make sure the button is handled further on */
- uevent->val= 1;
- }
- }
- else if(but->flag & UI_ACTIVE) {
- but->flag &= ~UI_ACTIVE;
- ui_draw_but(but);
- }
- }
- }
- break;
- case BUT_NEXT:
- ui_but_next_edittext(block);
- break;
- case BUT_PREV:
- ui_but_prev_edittext(block);
- break;
- case BUT_ACTIVATE:
- for(but= block->buttons.first; but; but= but->next) {
- if(but->retval==uevent->val) but->flag |= UI_ACTIVE;
- }
- break;
- case VKEY:
- case CKEY:
- if(uevent->val && (uevent->qual & (LR_CTRLKEY|LR_COMMANDKEY))) {
- for(but= block->buttons.first; but; but= but->next) {
- if(but->type!=LABEL && but->type!=ROUNDBOX) {
- if(but->flag & UI_ACTIVE) {
- int doit=0;
-
- if(uevent->event==VKEY) doit= ui_but_copy_paste(but, 'v');
- else ui_but_copy_paste(but, 'c');
-
- if(doit) {
- ui_draw_but(but);
-
- if(but->retval) addqueue(block->winq, UI_BUT_EVENT, (short)but->retval);
- if((but->type==NUMSLI && but->a1) || (but->type==COL)) addqueue(block->winq, REDRAW, 1); // col button update
-
- BIF_undo_push(but->str);
- }
- // but we do return, to prevent passing event through other queues */
- if( (block->flag & UI_BLOCK_LOOP) && but->type==BLOCK);
- else if(but->retval) retval= UI_RETURN_OK;
- break;
- }
- }
- }
- }
- break;
-
-
-#ifdef INTERNATIONAL
- //HACK to let the chartab button react to the mousewheel and PGUP/PGDN keys
- case WHEELUPMOUSE:
- case PAGEUPKEY:
- for(but= block->buttons.first; but; but= but->next)
- {
- if(but->type == CHARTAB && (but->flag & UI_MOUSE_OVER))
- {
- G.charstart = G.charstart - (12*6);
- if(G.charstart < 0)
- G.charstart = 0;
- if(G.charstart < G.charmin)
- G.charstart = G.charmin;
- ui_draw_but(but);
-
- //Really nasty... to update the num button from the same butblock
- for(bt= block->buttons.first; bt; bt= bt->next)
- {
- if(bt->type == NUM) {
- ui_check_but(bt);
- ui_draw_but(bt);
- }
- }
- retval=UI_CONT;
- break;
- }
- }
- break;
-
- case WHEELDOWNMOUSE:
- case PAGEDOWNKEY:
- for(but= block->buttons.first; but; but= but->next)
- {
- if(but->type == CHARTAB && (but->flag & UI_MOUSE_OVER))
- {
- G.charstart = G.charstart + (12*6);
- if(G.charstart > (0xffff - 12*6))
- G.charstart = 0xffff - (12*6);
- if(G.charstart > G.charmax - 12*6)
- G.charstart = G.charmax - 12*6;
- ui_draw_but(but);
-
- for(bt= block->buttons.first; bt; bt= bt->next)
- {
- if(bt->type == NUM) {
- ui_check_but(bt);
- ui_draw_but(bt);
- }
- }
-
- but->flag |= UI_ACTIVE;
- retval=UI_RETURN_OK;
- break;
- }
- }
- break;
-#endif
-
- case PADENTER:
- case RETKEY: // prevent treating this as mousemove. for example when you enter at popup
- if(block->flag & UI_BLOCK_LOOP) break;
-
- default:
-
- for(but= block->buttons.first; but; but= but->next) {
-
- // active flag clear, it can have been set with number keys or arrows, prevents next loop from wrong selection on click
- if(uevent->event==LEFTMOUSE) but->flag &= ~UI_ACTIVE;
-
- but->flag &= ~UI_MOUSE_OVER;
-
- /* check boundbox */
- if (uibut_contains_pt(but, uevent->mval)) {
- but->flag |= UI_MOUSE_OVER;
- UIbuttip= but;
- }
- /* hilite case 1 */
- if(but->flag & UI_MOUSE_OVER) {
- if( (but->flag & UI_ACTIVE)==0) {
- but->flag |= UI_ACTIVE;
- if(but->type != LABEL && (but->flag & UI_NO_HILITE)==0) ui_draw_but(but);
- }
- }
- /* hilite case 2 */
- if(but->flag & UI_ACTIVE) {
- if( (but->flag & UI_MOUSE_OVER)==0) {
- /* we dont clear active flag until mouse move, for Menu buttons to remain showing active item when opened */
- if (uevent->event==MOUSEY) {
- but->flag &= ~UI_ACTIVE;
- if(but->type != LABEL && (but->flag & UI_NO_HILITE)==0) ui_draw_but(but);
- }
- }
- else if(but->type==BLOCK || but->type==MENU || but->type==PULLDOWN || but->type==ICONTEXTROW) { // automatic opens block button (pulldown)
- int time;
- if(uevent->event!=LEFTMOUSE ) {
- if(block->auto_open==2) time= 1; // test for toolbox
- else if(block->auto_open) time= 5*U.menuthreshold2;
- else if(U.uiflag & USER_MENUOPENAUTO) time= 5*U.menuthreshold1;
- else time= -1;
-
- for (; time>0; time--) {
- if (qtest()) break;
- else PIL_sleep_ms(20);
- }
-
- if(time==0) {
- uevent->val= 1; // otherwise buttons dont react
- ui_do_button(block, but, uevent);
- }
- }
- }
- if(but->flag & UI_ACTIVE) active= 1;
- }
- }
-
- /* if there are no active buttons... otherwise clear lines */
- if(active) ui_do_active_linklines(block, 0);
- else ui_do_active_linklines(block, uevent->mval);
-
- }
-
- /* middlemouse exception, not for regular blocks */
- if( (block->flag & UI_BLOCK_LOOP) && uevent->event==MIDDLEMOUSE) uevent->event= LEFTMOUSE;
-
- /* the final dobutton */
- for(but= block->buttons.first; but; but= but->next) {
- if(but->flag & UI_ACTIVE) {
-
- /* UI_BLOCK_RET_1: not return when val==0 */
-
- if(uevent->val || (block->flag & UI_BLOCK_RET_1)==0) {
- if ELEM6(uevent->event, LEFTMOUSE, PADENTER, RETKEY, BUT_ACTIVATE, BUT_NEXT, BUT_PREV) {
- /* when mouse outside, don't do button */
- if(inside || uevent->event!=LEFTMOUSE) {
-
- if ELEM(uevent->event, BUT_NEXT, BUT_PREV) {
- butevent= ui_act_as_text_but(but);
- uibut_do_func(but);
- }
- else
- butevent= ui_do_button(block, but, uevent);
-
- /* add undo pushes if... */
- if( !(block->flag & UI_BLOCK_LOOP)) {
- if(!G.obedit) {
- if ELEM5(but->type, BLOCK, BUT, LABEL, PULLDOWN, ROUNDBOX);
- else {
- /* define which string to use for undo */
- if ELEM(but->type, LINK, INLINK) screen_delayed_undo_push("Add button link");
- else if ELEM(but->type, MENU, ICONTEXTROW) screen_delayed_undo_push(but->drawstr);
- else if(but->drawstr[0]) screen_delayed_undo_push(but->drawstr);
- else screen_delayed_undo_push(but->tip);
- }
- }
- }
-
- if(butevent) addqueue(block->winq, UI_BUT_EVENT, (short)butevent);
-
- /* i doubt about the next line! */
- /* if(but->func) mywinset(block->win); */
-
- if( (block->flag & UI_BLOCK_LOOP) && but->type==BLOCK);
- else
- if (butevent) retval= UI_RETURN_OK;
- }
- }
- }
- }
- }
-
- /* flush to frontbuffer */
- if((block->flag & UI_BLOCK_LOOP)==0) { // no loop, might need total flush in uidoblocks()
- ui_block_flush_back(block);
- }
-
- uiPanelPop(block); // pop matrix; no return without pop!
-
-
- /* the linkines... why not make buttons from it? Speed? Memory? */
- if(uevent->val && (uevent->event==XKEY || uevent->event==DELKEY))
- ui_delete_active_linkline(block);
-
- /* here we check return conditions for menus */
- if(block->flag & UI_BLOCK_LOOP) {
-
- if(inside==0 && uevent->val==1) {
- if ELEM3(uevent->event, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE) {
- if(BLI_in_rctf(&block->parentrct, (float)uevent->mval[0], (float)uevent->mval[1]));
- else return UI_RETURN_OUT;
- }
- }
-
- if(uevent->event==ESCKEY && uevent->val==1) return UI_RETURN_CANCEL;
-
- if((uevent->event==RETKEY || uevent->event==PADENTER) && uevent->val==1) return UI_RETURN_OK;
-
- /* check outside */
- if(inside==0 && movemouse_quit) {
- uiBlock *tblock= NULL;
-
- /* check for all parent rects, enables arrowkeys to be used */
- if(uevent->event!=MOUSEX && uevent->event!=MOUSEY) {
- for(tblock=block->parent; tblock; tblock= tblock->parent) {
- if( BLI_in_rctf(&tblock->parentrct, (float)uevent->mval[0], (float)uevent->mval[1]))
- break;
- else if( BLI_in_rctf(&tblock->safety, (float)uevent->mval[0], (float)uevent->mval[1]))
- break;
- }
- }
- /* strict check, and include the parent rect */
- if(tblock);
- else if( BLI_in_rctf(&block->parentrct, (float)uevent->mval[0], (float)uevent->mval[1]));
- else if( ui_mouse_motion_towards_block(block, uevent));
- else if( BLI_in_rctf(&block->safety, (float)uevent->mval[0], (float)uevent->mval[1]));
- else return UI_RETURN_OUT;
- }
- }
-
- return retval;
-}
-
-static uiOverDraw *ui_draw_but_tip(uiBut *but)
-{
- uiOverDraw *od;
- float x1, x2, y1, y2;
- rctf tip_bbox;
-
- BIF_GetBoundingBox(but->font, but->tip, (U.transopts & USER_TR_TOOLTIPS), &tip_bbox);
-
- x1= (but->x1+but->x2)/2;
- x2= x1+but->aspect*((tip_bbox.xmax-tip_bbox.xmin) + 8);
- y2= but->y1-10;
- y1= y2-but->aspect*((tip_bbox.ymax+(tip_bbox.ymax-tip_bbox.ymin)));
-
-
- /* for pulldown menus it doesnt work */
- if(mywinget()==G.curscreen->mainwin);
- else {
- ui_graphics_to_window(mywinget(), &x1, &y1);
- ui_graphics_to_window(mywinget(), &x2, &y2);
- }
-
- if(x2 > G.curscreen->sizex) {
- x1 -= x2-G.curscreen->sizex;
- x2= G.curscreen->sizex;
- }
- if(y1 < 0) {
- y1 += 36;
- y2 += 36;
- }
-
- od= ui_begin_overdraw((int)(x1-1), (int)(y1-2), (int)(x2+4), (int)(y2+4));
-
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
-
- glColor4ub(0, 0, 0, 20);
-
- gl_round_box(GL_POLYGON, x1+3, y1-1, x2+1, y2-2, 2.0);
- gl_round_box(GL_POLYGON, x1+3, y1-2, x2+2, y2-2, 3.0);
-
- glColor4ub(0, 0, 0, 8);
-
- gl_round_box(GL_POLYGON, x1+3, y1-3, x2+3, y2-3, 4.0);
- gl_round_box(GL_POLYGON, x1+3, y1-4, x2+4, y2-3, 5.0);
-
- glDisable(GL_BLEND);
-
- glColor3ub(0xFF, 0xFF, 0xDD);
- glRectf(x1, y1, x2, y2);
-
- glColor3ub(0,0,0);
- /* set the position for drawing text +4 in from the left edge, and leaving an equal gap between the top of the background box
- * and the top of the string's tip_bbox, and the bottom of the background box, and the bottom of the string's tip_bbox
- */
- ui_rasterpos_safe(x1+4, ((y2-tip_bbox.ymax)+(y1+tip_bbox.ymin))/2 - tip_bbox.ymin, but->aspect);
- BIF_SetScale(1.0);
-
- BIF_DrawString(but->font, but->tip, (U.transopts & USER_TR_TOOLTIPS));
-
- ui_flush_overdraw(od); /* to show it in the frontbuffer */
- return od;
-}
-
-/* inside this function no global UIbuttip... qread is not safe */
-static void ui_do_but_tip(uiBut *buttip)
-{
- uiOverDraw *od;
- int time;
-
- if (buttip && buttip->tip && buttip->tip[0]) {
- /* Pause for a moment to see if we
- * should really display the tip
- * or if the user will keep moving
- * the pointer.
- */
- for (time= 0; time<25; time++) {
- if (anyqtest())
- return;
- else
- PIL_sleep_ms(20);
- }
-
- /* Display the tip, and keep it displayed
- * as long as the mouse remains on top
- * of the button that owns it.
- */
- Mat4CpyMat4(UIwinmat, buttip->block->winmat); // get rid of uiwinmat once...
- uiPanelPush(buttip->block); // panel matrix
- od= ui_draw_but_tip(buttip);
-
- if(od) {
- while (1) {
- char ascii;
- short val;
- unsigned short evt= extern_qread_ext(&val, &ascii);
-
- if (evt==MOUSEX || evt==MOUSEY) {
- short mouse[2];
- uiGetMouse(od->oldwin, mouse);
-
- if (!uibut_contains_pt(buttip, mouse))
- break;
- } else {
- mainqpushback(evt, val, ascii);
- break;
- }
- }
-
- ui_end_overdraw(od);
- }
-
- uiPanelPop(buttip->block); // panel matrix
- /* still the evil global.... */
- UIbuttip= NULL;
- }
-}
-
-/* returns UI_NOTHING, if nothing happened */
-int uiDoBlocks(ListBase *lb, int event, int movemouse_quit)
-{
- /* return when: firstblock != BLOCK_LOOP
- *
- * 'cont' is used to make sure you can press another button while a looping menu
- * is active. otherwise you have to press twice...
- */
-
- uiBlock *block, *first;
- uiEvent uevent;
- int retval= UI_NOTHING, cont= 1;
-
- if(lb->first==0) return UI_NOTHING;
-
- /* for every pixel both x and y events are generated, overloads the system! */
- if(event==MOUSEX) return UI_NOTHING;
-
- UIbuttip= NULL;
- UIafterfunc_butm= NULL; /* to prevent infinite loops, this shouldnt be a global! */
- UIafterfunc_but= NULL; /* to prevent infinite loops, this shouldnt be a global! */
- UIafterfunc_arg1= UIafterfunc_arg2= NULL;
-
- uevent.qual= G.qual;
- uevent.event= event;
- uevent.val= 1;
-
- /* this is a caching mechanism, to prevent too many calls to glFrontBuffer and glFlush, which slows down interface */
- block= lb->first;
- while(block) {
- ui_block_set_flush(block, NULL); // clears all flushing info
- block= block->next;
- }
-
- /* main loop, needed when you click outside a looping block (menu) then it uses that
- event to immediately evaluate the other uiBlocks again. */
- while(cont) {
-
- /* first loop, for the normal blocks */
- block= lb->first;
- while(block) {
-
- /* for pupmenus, the bgnpupdraw sets (and later restores) the active
- window. Then mousecoords get transformed OK.
- It looks double... but a call to ui_do_block otherwise doesnt get handled properly
- */
- if(block->flag & UI_BLOCK_REDRAW) {
- if( block->flag & UI_BLOCK_LOOP) {
- block->overdraw= ui_begin_overdraw((int)block->minx-1, (int)block->miny-10, (int)block->maxx+10, (int)block->maxy+1);
- }
- block->in_use= 1; // is always a menu
- uiDrawBlock(block);
- block->flag &= ~UI_BLOCK_REDRAW;
- }
-
- block->in_use= 1; // bit awkward, but now we can detect if frontbuf flush should be set
- retval |= ui_do_block(block, &uevent, movemouse_quit); /* we 'or' because 2nd loop can return to here, and we we want 'out' to return */
- block->in_use= 0;
- if(retval & UI_EXIT_LOOP) break;
-
- /* now a new block could be created for menus, this is
- inserted in the beginning of a list */
-
- /* is there a flush cached? */
- if(block->needflush) {
- ui_block_flush_overdraw(block);
- block->needflush= 0;
- }
-
- /* to make sure the matrix of the panel works for menus too */
- if(retval==UI_CONT || (retval & UI_RETURN)) break;
- first= lb->first; if(first->flag & UI_BLOCK_LOOP) break;
-
- block= block->next;
- }
-
- /* second loop, for menus (looping blocks). works for sub->menus too */
- block= lb->first;
- if(block==NULL || (block->flag & UI_BLOCK_LOOP)==0) cont= 0;
-
- while( (block= lb->first) && (block->flag & UI_BLOCK_LOOP)) {
- if(block->auto_open==0) block->auto_open= 1;
-
- /* this here, for menu buts */
- if(block->flag & UI_BLOCK_REDRAW) {
-
- if( block->flag & UI_BLOCK_LOOP) {
- block->overdraw= ui_begin_overdraw((int)block->minx-1, (int)block->miny-6, (int)block->maxx+6, (int)block->maxy+1);
- }
- uiDrawBlock(block);
- block->flag &= ~UI_BLOCK_REDRAW;
- ui_flush_overdraw(block->overdraw);
- block->needflush= 0;
- }
-
- uevent.event= extern_qread(&uevent.val);
- uevent.qual= G.qual;
-
- if(uevent.event) {
- block->in_use= 1; // bit awkward, but now we can detect if frontbuf flush should be set
- retval= ui_do_block(block, &uevent, movemouse_quit);
- block->in_use= 0;
-
- if(block->needflush) { // flush (old menu) now, maybe new menu was opened
- ui_block_flush_overdraw(block);
- block->needflush= 0;
- }
-
- if(retval & UI_RETURN) {
- ui_end_overdraw(block->overdraw);
- BLI_remlink(lb, block);
- uiFreeBlock(block);
- }
- if(retval & (UI_RETURN_OK|UI_RETURN_CANCEL)) {
- /* free other menus */
- while( (block= lb->first) && (block->flag & UI_BLOCK_LOOP)) {
- ui_end_overdraw(block->overdraw);
- BLI_remlink(lb, block);
- uiFreeBlock(block);
- }
- }
- }
-
- /* tooltip */
- if(retval==UI_NOTHING && (uevent.event==MOUSEX || uevent.event==MOUSEY)) {
- if(U.flag & USER_TOOLTIPS) ui_do_but_tip(UIbuttip);
- }
- }
-
- /* else it does the first part of this loop again, maybe another menu needs to be opened */
- if(retval==UI_CONT || (retval & UI_RETURN_OK)) cont= 0;
- }
-
- /* clears screendump boundbox, call before afterfunc! */
- ui_set_screendump_bbox(NULL);
-
- /* afterfunc is used for fileloading too, so after this call, the blocks pointers are invalid */
- if(retval & UI_RETURN_OK) {
- if(UIafterfunc_butm) {
- mywinset(curarea->win);
- UIafterfunc_butm(UIafterfunc_arg1, UIafterval);
- UIafterfunc_butm= NULL;
- }
- if(UIafterfunc_but) {
- mywinset(curarea->win);
- UIafterfunc_but(UIafterfunc_arg1, UIafterfunc_arg2);
- UIafterfunc_but= NULL;
- }
- }
-
- /* tooltip */
- if(retval==UI_NOTHING && (uevent.event==MOUSEX || uevent.event==MOUSEY)) {
- if(U.flag & USER_TOOLTIPS) ui_do_but_tip(UIbuttip);
- }
-
- return retval;
-}
-
-/* ************** DATA *************** */
-
-/* for buttons pointing to color for example */
-void ui_get_but_vectorf(uiBut *but, float *vec)
-{
- void *poin;
-
- poin= but->poin;
-
- if( but->pointype == CHA ) {
- char *cp= (char *)poin;
- vec[0]= ((float)cp[0])/255.0;
- vec[1]= ((float)cp[1])/255.0;
- vec[2]= ((float)cp[2])/255.0;
- }
- else if( but->pointype == FLO ) {
- float *fp= (float *)poin;
- VECCOPY(vec, fp);
- }
-}
-/* for buttons pointing to color for example */
-void ui_set_but_vectorf(uiBut *but, float *vec)
-{
- void *poin;
-
- poin= but->poin;
-
- if( but->pointype == CHA ) {
- char *cp= (char *)poin;
- cp[0]= (char)(0.5 +vec[0]*255.0);
- cp[1]= (char)(0.5 +vec[1]*255.0);
- cp[2]= (char)(0.5 +vec[2]*255.0);
- }
- else if( but->pointype == FLO ) {
- float *fp= (float *)poin;
- VECCOPY(fp, vec);
- }
-}
-
-double ui_get_but_val(uiBut *but)
-{
- void *poin;
- double value = 0.0;
-
- if(but->poin==NULL) return 0.0;
- poin= but->poin;
-
- if(but->type== HSVSLI) {
- float h, s, v, *fp= (float *) poin;
-
- rgb_to_hsv(fp[0], fp[1], fp[2], &h, &s, &v);
-
- switch(but->str[0]) {
- case 'H': value= h; break;
- case 'S': value= s; break;
- case 'V': value= v; break;
- }
-
- }
- else if( but->pointype == CHA ) {
- value= *(char *)poin;
- }
- else if( but->pointype == SHO ) {
- value= *(short *)poin;
- }
- else if( but->pointype == INT ) {
- value= *(int *)poin;
- }
- else if( but->pointype == FLO ) {
- value= *(float *)poin;
- }
-
- return value;
-}
-
-static void ui_set_but_val(uiBut *but, double value)
-{
- void *poin;
-
- if(but->pointype==0) return;
- poin= but->poin;
-
- /* value is a hsv value: convert to rgb */
- if( but->type==HSVSLI ) {
- float h, s, v, *fp= (float *)but->poin;
-
- rgb_to_hsv(fp[0], fp[1], fp[2], &h, &s, &v);
-
- switch(but->str[0]) {
- case 'H': h= value; break;
- case 'S': s= value; break;
- case 'V': v= value; break;
- }
-
- hsv_to_rgb(h, s, v, fp, fp+1, fp+2);
-
- }
- else if( but->pointype==CHA )
- *((char *)poin)= (char)floor(value+0.5);
- else if( but->pointype==SHO ) {
- /* gcc 3.2.1 seems to have problems
- * casting a double like 32772.0 to
- * a short so we cast to an int, then
- to a short */
- int gcckludge;
- gcckludge = (int) floor(value+0.5);
- *((short *)poin)= (short) gcckludge;
- }
- else if( but->pointype==INT )
- *((int *)poin)= (int)floor(value+0.5);
- else if( but->pointype==FLO ) {
- float fval= (float)value;
- if(fval>= -0.00001f && fval<= 0.00001f) fval= 0.0f; /* prevent negative zero */
- *((float *)poin)= fval;
- }
-
- /* update select flag */
- ui_is_but_sel(but);
-
-}
-
-void uiSetCurFont(uiBlock *block, int index)
-{
-
- ui_set_ftf_font(block->aspect);
-
- if(block->aspect<0.60) {
- block->curfont= UIfont[index].xl;
- }
- else if(block->aspect<1.15) {
- block->curfont= UIfont[index].large;
- }
- else if(block->aspect<1.59) {
- block->curfont= UIfont[index].medium;
- }
- else {
- block->curfont= UIfont[index].small;
- }
-
- if(block->curfont==NULL) block->curfont= UIfont[index].large;
- if(block->curfont==NULL) block->curfont= UIfont[index].medium;
- if(block->curfont==NULL) printf("error block no font %s\n", block->name);
-
-}
-
-/* called by node editor */
-void *uiSetCurFont_ext(float aspect)
-{
- void *curfont;
-
- ui_set_ftf_font(aspect);
-
- if(aspect<0.60) {
- curfont= UIfont[0].xl;
- }
- else if(aspect<1.15) {
- curfont= UIfont[0].large;
- }
- else if(aspect<1.59) {
- curfont= UIfont[0].medium;
- }
- else {
- curfont= UIfont[0].small;
- }
-
- if(curfont==NULL) curfont= UIfont[0].large;
- if(curfont==NULL) curfont= UIfont[0].medium;
-
- return curfont;
-}
-
-void uiDefFont(unsigned int index, void *xl, void *large, void *medium, void *small)
-{
- if(index>=UI_ARRAY) return;
-
- UIfont[index].xl= xl;
- UIfont[index].large= large;
- UIfont[index].medium= medium;
- UIfont[index].small= small;
-}
-
-static void ui_free_link(uiLink *link)
-{
- if(link) {
- BLI_freelistN(&link->lines);
- MEM_freeN(link);
- }
-}
-
-static void ui_free_but(uiBut *but)
-{
- if(but->str && but->str != but->strdata) MEM_freeN(but->str);
- ui_free_link(but->link);
-
- MEM_freeN(but);
-}
-
-void uiFreeBlock(uiBlock *block)
-{
- uiBut *but;
-
- if(block->flag & UI_BLOCK_BUSY) printf("attempt to free busy buttonblock: %p\n", block);
-
- while( (but= block->buttons.first) ) {
- BLI_remlink(&block->buttons, but);
- ui_free_but(but);
- }
-
- if(block->panel) block->panel->active= 0;
-
-
- MEM_freeN(block);
- UIbuttip= NULL;
-}
-
-void uiFreeBlocks(ListBase *lb)
-{
- uiBlock *block;
-
- while( (block= lb->first) ) {
- BLI_remlink(lb, block);
- uiFreeBlock(block);
- }
-}
-
-void uiFreeBlocksWin(ListBase *lb, int win)
-{
- uiBlock *block, *blockn;
-
- block= lb->first;
- while(block) {
- blockn= block->next;
- if(block->win==win) {
- BLI_remlink(lb, block);
- uiFreeBlock(block);
- }
- block= blockn;
- }
-}
-
-uiBlock *uiNewBlock(ListBase *lb, char *name, short dt, short font, short win)
-{
- uiBlock *block;
-
- /* each listbase only has one block with this name */
- if(lb) {
- for (block= lb->first; block; block= block->next)
- if (BLI_streq(block->name, name))
- break;
- if (block) {
- BLI_remlink(lb, block);
- uiFreeBlock(block);
- }
- }
-
- block= MEM_callocN(sizeof(uiBlock), "uiBlock");
- if(lb) BLI_addhead(lb, block); /* at the beginning of the list! for dynamical menus/blocks */
-
- strcpy(block->name, name);
- /* draw win */
- block->win= win;
- /* window where queue event should be added, pretty weak this way!
- this is because the 'mainwin' pup menu's */
- block->winq= mywinget();
- block->dt= dt;
- block->themecol= TH_AUTO;
-
- /* aspect */
- bwin_getsinglematrix(win, block->winmat);
-
- if (win==G.curscreen->mainwin) {
- block->aspect= 1.0;
- block->auto_open= 2;
- } else {
- int getsizex, getsizey;
-
- bwin_getsize(win, &getsizex, &getsizey);
- block->aspect= 2.0/( (getsizex)*block->winmat[0][0]);
- }
-
- uiSetCurFont(block, font);
-
- UIbuttip= NULL;
- UIlock= 0;
-
- return block;
-}
-
-uiBlock *uiGetBlock(char *name, ScrArea *sa)
-{
- uiBlock *block= sa->uiblocks.first;
-
- while(block) {
- if( strcmp(name, block->name)==0 ) return block;
- block= block->next;
- }
-
- return NULL;
-}
-
-void ui_check_but(uiBut *but)
-{
- /* if something changed in the button */
- ID *id;
- double value;
- float okwidth;
- int transopts= (U.transopts & USER_TR_BUTTONS);
- short pos;
-
- ui_is_but_sel(but);
-
- if(but->type==TEX || but->type==IDPOIN) transopts= 0;
-
- /* test for min and max, icon sliders, etc */
- switch( but->type ) {
- case NUM:
- case SLI:
- case SCROLL:
- case NUMSLI:
- case HSVSLI:
- value= ui_get_but_val(but);
- if(value < but->min) value= but->min;
- if(value > but->max) value= but->max;
- ui_set_but_val(but, value);
- break;
-
- case ICONTOG:
- case ICONTOGN:
- if(but->flag & UI_SELECT) but->iconadd= 1;
- else but->iconadd= 0;
- break;
-
- case ICONROW:
- value= ui_get_but_val(but);
- but->iconadd= (int)value- (int)(but->min);
- break;
-
- case ICONTEXTROW:
- value= ui_get_but_val(but);
- but->iconadd= (int)value- (int)(but->min);
- break;
- }
-
-
- /* safety is 4 to enable small number buttons (like 'users') */
- if(but->type==NUMSLI || but->type==HSVSLI)
- okwidth= -4 + (but->x2 - but->x1)/2.0;
- else
- okwidth= -4 + (but->x2 - but->x1);
-
- /* name: */
- switch( but->type ) {
-
- case MENU:
- case ICONTEXTROW:
-
- if(but->x2 - but->x1 > 24) {
- value= ui_get_but_val(but);
- ui_set_name_menu(but, (int)value);
- }
- break;
-
- case NUM:
- case NUMSLI:
- case HSVSLI:
-
- value= ui_get_but_val(but);
-
- if( but->pointype==FLO ) {
- if(but->a2) { /* amount of digits defined */
- if(but->a2==1) sprintf(but->drawstr, "%s%.1f", but->str, value);
- else if(but->a2==2) sprintf(but->drawstr, "%s%.2f", but->str, value);
- else if(but->a2==3) sprintf(but->drawstr, "%s%.3f", but->str, value);
- else sprintf(but->drawstr, "%s%.4f", but->str, value);
- }
- else {
- if(but->max<10.001) sprintf(but->drawstr, "%s%.3f", but->str, value);
- else sprintf(but->drawstr, "%s%.2f", but->str, value);
- }
- }
- else {
- sprintf(but->drawstr, "%s%d", but->str, (int)value);
- }
- break;
-
- case LABEL:
- if( but->pointype==FLO && but->poin) {
- value= ui_get_but_val(but);
- if(but->a2) { /* amount of digits defined */
- if(but->a2==1) sprintf(but->drawstr, "%s%.1f", but->str, value);
- else if(but->a2==2) sprintf(but->drawstr, "%s%.2f", but->str, value);
- else if(but->a2==3) sprintf(but->drawstr, "%s%.3f", but->str, value);
- else sprintf(but->drawstr, "%s%.4f", but->str, value);
- }
- else {
- sprintf(but->drawstr, "%s%.2f", but->str, value);
- }
- }
- else strcpy(but->drawstr, but->str);
-
- break;
-
- case IDPOIN:
- id= *(but->idpoin_idpp);
- strcpy(but->drawstr, but->str);
- if(id) strcat(but->drawstr, id->name+2);
- break;
-
- case TEX:
- strcpy(but->drawstr, but->str);
- strcat(but->drawstr, but->poin);
- break;
-
- case KEYEVT:
- strcpy(but->drawstr, but->str);
- if (but->flag & UI_SELECT) {
- strcat(but->drawstr, "Press a key");
- } else {
- strcat(but->drawstr, key_event_to_string((short) ui_get_but_val(but)));
- }
- break;
- case BUT_TOGDUAL:
- /* trying to get the dual-icon to left of text... not very nice */
- if(but->str[0]) {
- strcpy(but->drawstr, " ");
- strcpy(but->drawstr+2, but->str);
- }
- break;
- default:
- strcpy(but->drawstr, but->str);
-
- }
-
- if(but->drawstr[0]) {
- but->strwidth= but->aspect*BIF_GetStringWidth(but->font, but->drawstr, transopts);
- // here should be check for less space for icon offsets...
- if(but->type==MENU) okwidth -= 15;
- }
- else
- but->strwidth= 0;
-
- /* automatic width */
- if(but->x2==0.0f && but->x1 > 0.0f) {
- but->x2= (but->x1+but->strwidth+6);
- }
-
- if(but->strwidth==0) but->drawstr[0]= 0;
- else if(but->type==BUTM || but->type==BLOCK); // no clip string, uiTextBoundsBlock is used (hack!)
- else {
-
- /* calc but->ofs, to draw the string shorter if too long */
- but->ofs= 0;
- while(but->strwidth > (int)okwidth ) {
-
- if ELEM(but->type, NUM, TEX) { // only these cut off left
- but->ofs++;
- but->strwidth= but->aspect*BIF_GetStringWidth(but->font, but->drawstr+but->ofs, transopts);
-
- /* textbut exception */
- if(but->pos != -1) {
- pos= but->pos+strlen(but->str);
- if(pos-1 < but->ofs) {
- pos= but->ofs-pos+1;
- but->ofs -= pos;
- if(but->ofs<0) {
- but->ofs= 0;
- pos--;
- }
- but->drawstr[ strlen(but->drawstr)-pos ]= 0;
- }
- }
- }
- else {
- but->drawstr[ strlen(but->drawstr)-1 ]= 0;
- but->strwidth= but->aspect*BIF_GetStringWidth(but->font, but->drawstr, transopts);
- }
-
- if(but->strwidth < 10) break;
- }
- }
-}
-
-static int ui_auto_themecol(uiBut *but)
-{
-
- switch(but->type) {
- case BUT:
- return TH_BUT_ACTION;
- case ROW:
- case TOG:
- case TOG3:
- case TOGR:
- case TOGN:
- case BUT_TOGDUAL:
- return TH_BUT_SETTING;
- case SLI:
- case NUM:
- case NUMSLI:
- case HSVSLI:
- return TH_BUT_NUM;
- case TEX:
- return TH_BUT_TEXTFIELD;
- case PULLDOWN:
- case BLOCK:
- case MENU:
- case BUTM:
- // (weak!) detect if it is a blockloop
- if(but->block->dt == UI_EMBOSSP) return TH_MENU_ITEM;
- return TH_BUT_POPUP;
- default:
- return TH_BUT_NEUTRAL;
- }
-}
-
-void uiBlockBeginAlign(uiBlock *block)
-{
- /* if other align was active, end it */
- if(block->flag & UI_BUT_ALIGN) uiBlockEndAlign(block);
-
- block->flag |= UI_BUT_ALIGN_DOWN;
- /* buttons declared after this call will this align flag */
-}
-
-static int buts_are_horiz(uiBut *but1, uiBut *but2)
-{
- float dx, dy;
-
- dx= fabs( but1->x2 - but2->x1);
- dy= fabs( but1->y1 - but2->y2);
-
- if(dx > dy) return 0;
- return 1;
-}
-
-void uiBlockEndAlign(uiBlock *block)
-{
- uiBut *prev, *but=NULL, *next;
- int flag= 0, cols=0, rows=0;
- int theme= BIF_GetThemeValue(TH_BUT_DRAWTYPE);
-
- if ( !(ELEM3(theme, TH_MINIMAL, TH_SHADED, TH_ROUNDED)) ) {
- block->flag &= ~UI_BUT_ALIGN; // all 4 flags
- return;
- }
-
- /* auto align:
- - go back to first button of align start (ALIGN_DOWN)
- - compare triples, and define flags
- */
- prev= block->buttons.last;
- while(prev) {
- if( (prev->flag & UI_BUT_ALIGN_DOWN)) but= prev;
- else break;
-
- if(but && but->next) {
- if(buts_are_horiz(but, but->next)) cols++;
- else rows++;
- }
-
- prev= prev->prev;
- }
- if(but==NULL) return;
-
- /* rows==0: 1 row, cols==0: 1 collumn */
-
- /* note; how it uses 'flag' in loop below (either set it, or OR it) is confusing */
- prev= NULL;
- while(but) {
- next= but->next;
-
- /* clear old flag */
- but->flag &= ~UI_BUT_ALIGN_DOWN;
-
- if(flag==0) { /* first case */
- if(next) {
- if(buts_are_horiz(but, next)) {
- if(rows==0)
- flag= UI_BUT_ALIGN_RIGHT;
- else
- flag= UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_RIGHT;
- }
- else {
- flag= UI_BUT_ALIGN_DOWN;
- }
- }
- }
- else if(next==NULL) { /* last case */
- if(prev) {
- if(buts_are_horiz(prev, but)) {
- if(rows==0)
- flag= UI_BUT_ALIGN_LEFT;
- else
- flag= UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_LEFT;
- }
- else flag= UI_BUT_ALIGN_TOP;
- }
- }
- else if(buts_are_horiz(but, next)) {
- /* check if this is already second row */
- if( prev && buts_are_horiz(prev, but)==0) {
- flag |= UI_BUT_ALIGN_TOP;
- /* exception case: bottom row */
- if(rows>0) {
- uiBut *bt= but;
- while(bt) {
- if(bt->next && buts_are_horiz(bt, bt->next)==0 ) break;
- bt= bt->next;
- }
- if(bt==0) flag= UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_RIGHT;
- }
- }
- else flag |= UI_BUT_ALIGN_LEFT;
- }
- else {
- if(cols==0) {
- flag |= UI_BUT_ALIGN_TOP;
- }
- else { /* next button switches to new row */
- if( (flag & UI_BUT_ALIGN_TOP)==0) { /* stil top row */
- if(prev)
- flag= UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_LEFT;
- else
- flag |= UI_BUT_ALIGN_DOWN;
- }
- else
- flag |= UI_BUT_ALIGN_TOP;
- }
- }
-
- but->flag |= flag;
-
- /* merge coordinates */
- if(prev) {
- // simple cases
- if(rows==0) {
- but->x1= (prev->x2+but->x1)/2.0;
- prev->x2= but->x1;
- }
- else if(cols==0) {
- but->y2= (prev->y1+but->y2)/2.0;
- prev->y1= but->y2;
- }
- else {
- if(buts_are_horiz(prev, but)) {
- but->x1= (prev->x2+but->x1)/2.0;
- prev->x2= but->x1;
- /* copy height too */
- but->y2= prev->y2;
- }
- else if(prev->prev && buts_are_horiz(prev->prev, prev)==0) {
- /* the previous button is a single one in its row */
- but->y2= (prev->y1+but->y2)/2.0;
- prev->y1= but->y2;
- }
- else {
- /* the previous button is not a single one in its row */
- but->y2= prev->y1;
- }
- }
- }
-
- prev= but;
- but= next;
- }
-
- block->flag &= ~UI_BUT_ALIGN; // all 4 flags
-}
-
-#if 0
-static void uiBlockEndAligno(uiBlock *block)
-{
- uiBut *but;
-
- /* correct last defined button */
- but= block->buttons.last;
- if(but) {
- /* vertical align case */
- if( (block->flag & UI_BUT_ALIGN) == (UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_DOWN) ) {
- but->flag &= ~UI_BUT_ALIGN_DOWN;
- }
- /* horizontal align case */
- if( (block->flag & UI_BUT_ALIGN) == (UI_BUT_ALIGN_LEFT|UI_BUT_ALIGN_RIGHT) ) {
- but->flag &= ~UI_BUT_ALIGN_RIGHT;
- }
- /* else do nothing, manually provided flags */
- }
- block->flag &= ~UI_BUT_ALIGN; // all 4 flags
-}
-#endif
-
-/*
-ui_def_but is the function that draws many button types
-
-for float buttons:
- "a1" Click Step (how much to change the value each click)
- "a2" Number of decimal point values to display. 0 defaults to 3 (0.000) 1,2,3, and a maximum of 4,
- all greater values will be clamped to 4.
-
-*/
-static uiBut *ui_def_but(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip)
-{
- uiBut *but;
- short slen;
-
- if(type & BUTPOIN) { /* a pointer is required */
- if(poin==NULL) {
- /* if pointer is zero, button is removed and not drawn */
- BIF_ThemeColor(block->themecol);
- glRects(x1, y1, x1+x2, y1+y2);
- return NULL;
- }
- }
-
- but= MEM_callocN(sizeof(uiBut), "uiBut");
-
- but->type= type & BUTTYPE;
- but->pointype= type & BUTPOIN;
- but->bit= type & BIT;
- but->bitnr= type & 31;
- but->icon = 0;
-
- BLI_addtail(&block->buttons, but);
-
- but->retval= retval;
- if( strlen(str)>=UI_MAX_NAME_STR-1 ) {
- but->str= MEM_callocN( strlen(str)+2, "uiDefBut");
- strcpy(but->str, str);
- }
- else {
- but->str= but->strdata;
- strcpy(but->str, str);
- }
- but->x1= x1;
- but->y1= y1;
- if(block->autofill) {
- but->x2= x2;
- but->y2= y2;
- }
- else {
- but->x2= (x1+x2);
- but->y2= (y1+y2);
- }
- but->poin= poin;
- but->min= min;
- but->max= max;
- but->a1= a1;
- but->a2= a2;
- but->tip= tip;
-
- but->font= block->curfont;
-
- but->lock= UIlock;
- but->lockstr= UIlockstr;
-
- but->aspect= block->aspect;
- but->win= block->win;
- but->block= block; // pointer back, used for frontbuffer status, and picker
-
- if(block->themecol==TH_AUTO) but->themecol= ui_auto_themecol(but);
- else but->themecol= block->themecol;
-
- if (but->type==BUTM) {
- but->butm_func= block->butm_func;
- but->butm_func_arg= block->butm_func_arg;
- } else {
- but->func= block->func;
- but->func_arg1= block->func_arg1;
- but->func_arg2= block->func_arg2;
- }
-
- ui_set_embossfunc(but, block->dt);
-
- but->pos= -1; /* cursor invisible */
-
- if(but->type==NUM) { /* add a space to name */
- slen= strlen(but->str);
- if(slen>0 && slen<UI_MAX_NAME_STR-2) {
- if(but->str[slen-1]!=' ') {
- but->str[slen]= ' ';
- but->str[slen+1]= 0;
- }
- }
- }
-
- if(but->type==HSVCUBE) { /* hsv buttons temp storage */
- float rgb[3];
- ui_get_but_vectorf(but, rgb);
- rgb_to_hsv(rgb[0], rgb[1], rgb[2], but->hsv, but->hsv+1, but->hsv+2);
- }
-
- if ELEM8(but->type, HSVSLI , NUMSLI, MENU, TEX, LABEL, IDPOIN, BLOCK, BUTM) {
- but->flag |= UI_TEXT_LEFT;
- }
-
- if(but->type==BUT_TOGDUAL) {
- but->flag |= UI_ICON_LEFT;
- }
-
- if(but->type==ROUNDBOX)
- but->flag |= UI_NO_HILITE;
-
- but->flag |= (block->flag & UI_BUT_ALIGN);
- if(block->flag & UI_BLOCK_NO_HILITE)
- but->flag |= UI_NO_HILITE;
-
- return but;
-}
-
-uiBut *uiDefBut(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip)
-{
- uiBut *but= ui_def_but(block, type, retval, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
-
- ui_check_but(but);
-
- return but;
-}
-
- /* if _x_ is a power of two (only one bit) return the power,
- * otherwise return -1.
- * (1<<findBitIndex(x))==x for powers of two.
- */
-static int findBitIndex(unsigned int x) {
- if (!x || (x&(x-1))!=0) { /* x&(x-1) strips lowest bit */
- return -1;
- } else {
- int idx= 0;
-
- if (x&0xFFFF0000) idx+=16, x>>=16;
- if (x&0xFF00) idx+=8, x>>=8;
- if (x&0xF0) idx+=4, x>>=4;
- if (x&0xC) idx+=2, x>>=2;
- if (x&0x2) idx+=1;
-
- return idx;
- }
-}
-
-/* autocomplete helper functions */
-struct AutoComplete {
- int maxlen;
- char *truncate;
- char *startname;
-};
-
-AutoComplete *autocomplete_begin(char *startname, int maxlen)
-{
- AutoComplete *autocpl;
-
- autocpl= MEM_callocN(sizeof(AutoComplete), "AutoComplete");
- autocpl->maxlen= maxlen;
- autocpl->truncate= MEM_callocN(sizeof(char)*maxlen, "AutoCompleteTruncate");
- autocpl->startname= startname;
-
- return autocpl;
-}
-
-void autocomplete_do_name(AutoComplete *autocpl, const char *name)
-{
- char *truncate= autocpl->truncate;
- char *startname= autocpl->startname;
- int a;
-
- for(a=0; a<autocpl->maxlen-1; a++) {
- if(startname[a]==0 || startname[a]!=name[a])
- break;
- }
- /* found a match */
- if(startname[a]==0) {
- /* first match */
- if(truncate[0]==0)
- BLI_strncpy(truncate, name, autocpl->maxlen);
- else {
- /* remove from truncate what is not in bone->name */
- for(a=0; a<autocpl->maxlen-1; a++) {
- if(truncate[a]!=name[a])
- truncate[a]= 0;
- }
- }
- }
-}
-
-void autocomplete_end(AutoComplete *autocpl, char *autoname)
-{
- if(autocpl->truncate[0])
- BLI_strncpy(autoname, autocpl->truncate, autocpl->maxlen);
- else
- BLI_strncpy(autoname, autocpl->startname, autocpl->maxlen);
-
- MEM_freeN(autocpl->truncate);
- MEM_freeN(autocpl);
-}
-
-/* autocomplete callback for ID buttons */
-static void autocomplete_id(char *str, void *arg_v)
-{
- int blocktype= (long)arg_v;
- ListBase *listb= wich_libbase(G.main, blocktype);
-
- if(listb==NULL) return;
-
- /* search if str matches the beginning of an ID struct */
- if(str[0]) {
- AutoComplete *autocpl= autocomplete_begin(str, 22);
- ID *id;
-
- for(id= listb->first; id; id= id->next)
- autocomplete_do_name(autocpl, id->name+2);
-
- autocomplete_end(autocpl, str);
- }
-}
-
-static uiBut *uiDefButBit(uiBlock *block, int type, int bit, int retval, char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip)
-{
- int bitIdx= findBitIndex(bit);
- if (bitIdx==-1) {
- return NULL;
- } else {
- return uiDefBut(block, type|BIT|bitIdx, retval, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
- }
-}
-uiBut *uiDefButF(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip)
-{
- return uiDefBut(block, type|FLO, retval, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
-}
-uiBut *uiDefButBitF(uiBlock *block, int type, int bit, int retval, char *str, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip)
-{
- return uiDefButBit(block, type|FLO, bit, retval, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
-}
-uiBut *uiDefButI(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip)
-{
- return uiDefBut(block, type|INT, retval, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
-}
-uiBut *uiDefButBitI(uiBlock *block, int type, int bit, int retval, char *str, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip)
-{
- return uiDefButBit(block, type|INT, bit, retval, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
-}
-uiBut *uiDefButS(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip)
-{
- return uiDefBut(block, type|SHO, retval, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
-}
-uiBut *uiDefButBitS(uiBlock *block, int type, int bit, int retval, char *str, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip)
-{
- return uiDefButBit(block, type|SHO, bit, retval, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
-}
-uiBut *uiDefButC(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip)
-{
- return uiDefBut(block, type|CHA, retval, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
-}
-uiBut *uiDefButBitC(uiBlock *block, int type, int bit, int retval, char *str, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip)
-{
- return uiDefButBit(block, type|CHA, bit, retval, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
-}
-
-uiBut *uiDefIconBut(uiBlock *block, int type, int retval, int icon, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip)
-{
- uiBut *but= ui_def_but(block, type, retval, "", x1, y1, x2, y2, poin, min, max, a1, a2, tip);
-
- but->icon= (BIFIconID) icon;
- but->flag|= UI_HAS_ICON;
-
- ui_check_but(but);
-
- return but;
-}
-static uiBut *uiDefIconButBit(uiBlock *block, int type, int bit, int retval, int icon, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip)
-{
- int bitIdx= findBitIndex(bit);
- if (bitIdx==-1) {
- return NULL;
- } else {
- return uiDefIconBut(block, type|BIT|bitIdx, retval, icon, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
- }
-}
-
-uiBut *uiDefIconButF(uiBlock *block, int type, int retval, int icon, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip)
-{
- return uiDefIconBut(block, type|FLO, retval, icon, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
-}
-uiBut *uiDefIconButBitF(uiBlock *block, int type, int bit, int retval, int icon, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip)
-{
- return uiDefIconButBit(block, type|FLO, bit, retval, icon, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
-}
-uiBut *uiDefIconButI(uiBlock *block, int type, int retval, int icon, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip)
-{
- return uiDefIconBut(block, type|INT, retval, icon, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
-}
-uiBut *uiDefIconButBitI(uiBlock *block, int type, int bit, int retval, int icon, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip)
-{
- return uiDefIconButBit(block, type|INT, bit, retval, icon, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
-}
-uiBut *uiDefIconButS(uiBlock *block, int type, int retval, int icon, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip)
-{
- return uiDefIconBut(block, type|SHO, retval, icon, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
-}
-uiBut *uiDefIconButBitS(uiBlock *block, int type, int bit, int retval, int icon, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip)
-{
- return uiDefIconButBit(block, type|SHO, bit, retval, icon, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
-}
-uiBut *uiDefIconButC(uiBlock *block, int type, int retval, int icon, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip)
-{
- return uiDefIconBut(block, type|CHA, retval, icon, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
-}
-uiBut *uiDefIconButBitC(uiBlock *block, int type, int bit, int retval, int icon, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip)
-{
- return uiDefIconButBit(block, type|CHA, bit, retval, icon, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
-}
-
-/* Button containing both string label and icon */
-uiBut *uiDefIconTextBut(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip)
-{
- uiBut *but= ui_def_but(block, type, retval, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
-
- but->icon= (BIFIconID) icon;
- but->flag|= UI_HAS_ICON;
-
- but->flag|= UI_ICON_LEFT;
-
- ui_check_but(but);
-
- return but;
-}
-static uiBut *uiDefIconTextButBit(uiBlock *block, int type, int bit, int retval, int icon, char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip)
-{
- int bitIdx= findBitIndex(bit);
- if (bitIdx==-1) {
- return NULL;
- } else {
- return uiDefIconTextBut(block, type|BIT|bitIdx, retval, icon, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
- }
-}
-
-uiBut *uiDefIconTextButF(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip)
-{
- return uiDefIconTextBut(block, type|FLO, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
-}
-uiBut *uiDefIconTextButBitF(uiBlock *block, int type, int bit, int retval, int icon, char *str, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip)
-{
- return uiDefIconTextButBit(block, type|FLO, bit, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
-}
-uiBut *uiDefIconTextButI(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip)
-{
- return uiDefIconTextBut(block, type|INT, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
-}
-uiBut *uiDefIconTextButBitI(uiBlock *block, int type, int bit, int retval, int icon, char *str, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip)
-{
- return uiDefIconTextButBit(block, type|INT, bit, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
-}
-uiBut *uiDefIconTextButS(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip)
-{
- return uiDefIconTextBut(block, type|SHO, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
-}
-uiBut *uiDefIconTextButBitS(uiBlock *block, int type, int bit, int retval, int icon, char *str, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip)
-{
- return uiDefIconTextButBit(block, type|SHO, bit, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
-}
-uiBut *uiDefIconTextButC(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip)
-{
- return uiDefIconTextBut(block, type|CHA, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
-}
-uiBut *uiDefIconTextButBitC(uiBlock *block, int type, int bit, int retval, int icon, char *str, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip)
-{
- return uiDefIconTextButBit(block, type|CHA, bit, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
-}
-
-/* END Button containing both string label and icon */
-
-void uiAutoBlock(uiBlock *block, float minx, float miny, float sizex, float sizey, int flag)
-{
- block->minx= minx;
- block->maxx= minx+sizex;
- block->miny= miny;
- block->maxy= miny+sizey;
-
- block->autofill= flag; /* also check for if it has to be done */
-
-}
-
-void uiSetButLink(uiBut *but, void **poin, void ***ppoin, short *tot, int from, int to)
-{
- uiLink *link;
-
- link= but->link= MEM_callocN(sizeof(uiLink), "new uilink");
-
- link->poin= poin;
- link->ppoin= ppoin;
- link->totlink= tot;
- link->fromcode= from;
- link->tocode= to;
-}
-
-/* cruft to make uiBlock and uiBut private */
-
-int uiBlocksGetYMin(ListBase *lb)
-{
- uiBlock *block;
- int min= 0;
-
- for (block= lb->first; block; block= block->next)
- if (block==lb->first || block->miny<min)
- min= block->miny;
-
- return min;
-}
-
-int uiBlockGetCol(uiBlock *block)
-{
- return block->themecol;
-}
-void uiBlockSetCol(uiBlock *block, int col)
-{
- block->themecol= col;
-}
-void uiBlockSetEmboss(uiBlock *block, int emboss)
-{
- block->dt= emboss;
-}
-void uiBlockSetDirection(uiBlock *block, int direction)
-{
- block->direction= direction;
-}
-
-/* this call escapes if there's alignment flags */
-void uiBlockFlipOrder(uiBlock *block)
-{
- ListBase lb;
- uiBut *but, *next;
- float centy, miny=10000, maxy= -10000;
-
-// if(U.uiflag & USER_PLAINMENUS)
-// return;
-
- for(but= block->buttons.first; but; but= but->next) {
- if(but->flag & UI_BUT_ALIGN) return;
- if(but->y1 < miny) miny= but->y1;
- if(but->y2 > maxy) maxy= but->y2;
- }
- /* mirror trick */
- centy= (miny+maxy)/2.0;
- for(but= block->buttons.first; but; but= but->next) {
- but->y1 = centy-(but->y1-centy);
- but->y2 = centy-(but->y2-centy);
- SWAP(float, but->y1, but->y2);
- }
-
- /* also flip order in block itself, for example for arrowkey */
- lb.first= lb.last= NULL;
- but= block->buttons.first;
- while(but) {
- next= but->next;
- BLI_remlink(&block->buttons, but);
- BLI_addtail(&lb, but);
- but= next;
- }
- block->buttons= lb;
-}
-
-
-void uiBlockSetFlag(uiBlock *block, int flag)
-{
- block->flag= flag;
-}
-void uiBlockSetXOfs(uiBlock *block, int xofs)
-{
- block->xofs= xofs;
-}
-void* uiBlockGetCurFont(uiBlock *block)
-{
- return block->curfont;
-}
-
-void uiButSetFlag(uiBut *but, int flag)
-{
- but->flag|= flag;
-}
-void uiButClearFlag(uiBut *but, int flag)
-{
- but->flag&= ~flag;
-}
-
-int uiButGetRetVal(uiBut *but)
-{
- return but->retval;
-}
-
-
-void uiBlockSetButmFunc(uiBlock *block, void (*menufunc)(void *arg, int event), void *arg)
-{
- block->butm_func= menufunc;
- block->butm_func_arg= arg;
-}
-
-void uiBlockSetFunc(uiBlock *block, void (*func)(void *arg1, void *arg2), void *arg1, void *arg2)
-{
- block->func= func;
- block->func_arg1= arg1;
- block->func_arg2= arg2;
-}
-
-void uiBlockSetDrawExtraFunc(uiBlock *block, void (*func)())
-{
- block->drawextra= func;
-}
-
-void uiButSetFunc(uiBut *but, void (*func)(void *arg1, void *arg2), void *arg1, void *arg2)
-{
- but->func= func;
- but->func_arg1= arg1;
- but->func_arg2= arg2;
-}
-
-void uiButSetCompleteFunc(uiBut *but, void (*func)(char *str, void *arg), void *arg)
-{
- but->autocomplete_func= func;
- but->autofunc_arg= arg;
-}
-
-
-uiBut *uiDefIDPoinBut(uiBlock *block, uiIDPoinFuncFP func, short blocktype, int retval, char *str, short x1, short y1, short x2, short y2, void *idpp, char *tip)
-{
- uiBut *but= ui_def_but(block, IDPOIN, retval, str, x1, y1, x2, y2, NULL, 0.0, 0.0, 0.0, 0.0, tip);
- but->idpoin_func= func;
- but->idpoin_idpp= (ID**) idpp;
- ui_check_but(but);
-
- if(blocktype)
- uiButSetCompleteFunc(but, autocomplete_id, (void *)(long)blocktype);
-
- return but;
-}
-
-uiBut *uiDefBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, char *str, short x1, short y1, short x2, short y2, char *tip)
-{
- uiBut *but= ui_def_but(block, BLOCK, 0, str, x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
- but->block_func= func;
- ui_check_but(but);
- return but;
-}
-
-uiBut *uiDefPulldownBut(uiBlock *block, uiBlockFuncFP func, void *arg, char *str, short x1, short y1, short x2, short y2, char *tip)
-{
- uiBut *but= ui_def_but(block, PULLDOWN, 0, str, x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
- but->block_func= func;
- ui_check_but(but);
- return but;
-}
-
-/* Block button containing both string label and icon */
-uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, int icon, char *str, short x1, short y1, short x2, short y2, char *tip)
-{
- uiBut *but= ui_def_but(block, BLOCK, 0, str, x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
-
- but->icon= (BIFIconID) icon;
- but->flag|= UI_HAS_ICON;
-
- but->flag|= UI_ICON_LEFT;
- but->flag|= UI_ICON_RIGHT;
-
- but->block_func= func;
- ui_check_but(but);
-
- return but;
-}
-
-/* Block button containing icon */
-uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, int retval, int icon, short x1, short y1, short x2, short y2, char *tip)
-{
- uiBut *but= ui_def_but(block, BLOCK, retval, "", x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
-
- but->icon= (BIFIconID) icon;
- but->flag|= UI_HAS_ICON;
-
- but->flag|= UI_ICON_LEFT;
- but->flag|= UI_ICON_RIGHT;
-
- but->block_func= func;
- ui_check_but(but);
-
- return but;
-}
-
-void uiDefKeyevtButS(uiBlock *block, int retval, char *str, short x1, short y1, short x2, short y2, short *spoin, char *tip)
-{
- uiBut *but= ui_def_but(block, KEYEVT|SHO, retval, str, x1, y1, x2, y2, spoin, 0.0, 0.0, 0.0, 0.0, tip);
- ui_check_but(but);
-}
-
-/* ******************** PUPmenu ****************** */
-
-static int pupmenu_set= 0;
-
-void pupmenu_set_active(int val)
-{
- pupmenu_set= val;
-}
-
-/* value== -1 read, otherwise set */
-static int pupmenu_memory(char *str, int value)
-{
- static char mem[256], first=1;
- int val=0, nr=0;
-
- if(first) {
- memset(mem, 0, 256);
- first= 0;
- }
- while(str[nr]) {
- val+= str[nr];
- nr++;
- }
-
- if(value >= 0) mem[ val & 255 ]= value;
- else return mem[ val & 255 ];
-
- return 0;
-}
-
-#define PUP_LABELH 6
-short pupmenu(char *instr)
-{
- uiBlock *block;
- ListBase listb= {NULL, NULL};
- int event;
- short lastselected, width, height=0, mousexmove = 0, mouseymove, xmax, ymax, mval[2], val= -1;
- short a, startx, starty, endx, endy, boxh=TBOXH, x1, y1;
- MenuData *md;
-
- /* block stuff first, need to know the font */
- block= uiNewBlock(&listb, "menu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_RET_1|UI_BLOCK_NUMSELECT);
- block->themecol= TH_MENU_ITEM;
-
- md= decompose_menu_string(instr);
-
- /* size and location, title slightly bigger for bold */
- if(md->title) width= 2*strlen(md->title)+BIF_GetStringWidth(uiBlockGetCurFont(block), md->title, (U.transopts & USER_TR_BUTTONS));
- else width= 0;
- for(a=0; a<md->nitems; a++) {
- char *name= md->items[a].str;
-
- xmax= BIF_GetStringWidth(uiBlockGetCurFont(block), md->items[a].str, (U.transopts & USER_TR_BUTTONS));
- if(xmax>width) width= xmax;
-
- if( strcmp(name, "%l")==0) height+= PUP_LABELH;
- else height+= boxh;
- }
-
- width+= 10;
-
- xmax = G.curscreen->sizex;
- ymax = G.curscreen->sizey;
-
- getmouseco_sc(mval);
-
- /* set first item */
- lastselected= 0;
- if(pupmenu_set) {
- lastselected= pupmenu_set-1;
- pupmenu_set= 0;
- }
- else if(md->nitems>1) {
- lastselected= pupmenu_memory(instr, -1);
- }
-
- startx= mval[0]-(0.8*(width));
- starty= mval[1]-height+boxh/2;
- if(lastselected>=0 && lastselected<md->nitems) {
- for(a=0; a<md->nitems; a++) {
- if(a==lastselected) break;
- if( strcmp(md->items[a].str, "%l")==0) starty+= PUP_LABELH;
- else starty+=boxh;
- }
-
- //starty= mval[1]-height+boxh/2+lastselected*boxh;
- }
-
- mouseymove= 0;
-
- if(startx<10) startx= 10;
- if(starty<10) {
- mouseymove= 10-starty;
- starty= 10;
- }
-
- endx= startx+width;
- endy= starty+height;
- if(endx>xmax) {
- endx= xmax-10;
- startx= endx-width;
- }
- if(endy>ymax-20) {
- mouseymove= ymax-endy-20;
- endy= ymax-20;
- starty= endy-height;
-
- }
-
- if(mouseymove) {
- ui_warp_pointer(mval[0], mouseymove+mval[1]);
- mousexmove= mval[0];
- mouseymove= mval[1];
- }
-
- /* here we go! */
- if(md->title) {
- uiBut *bt;
- char titlestr[256];
- uiSetCurFont(block, UI_HELVB);
-
- if (md->titleicon) {
- width+= 20;
- sprintf(titlestr, " %s", md->title);
- uiDefIconTextBut(block, LABEL, 0, md->titleicon, titlestr, startx, (short)(starty+height), width, boxh, NULL, 0.0, 0.0, 0, 0, "");
- } else {
- bt= uiDefBut(block, LABEL, 0, md->title, startx, (short)(starty+height), width, boxh, NULL, 0.0, 0.0, 0, 0, "");
- bt->flag= UI_TEXT_LEFT;
- }
- uiSetCurFont(block, UI_HELV);
- }
-
- y1= starty + height - boxh;
- x1= startx;
-
- for(a=0; a<md->nitems; a++) {
- char *name= md->items[a].str;
-
- if( strcmp(name, "%l")==0) {
- uiDefBut(block, SEPR, B_NOP, "", x1, y1, width, PUP_LABELH, NULL, 0, 0.0, 0, 0, "");
- y1 -= PUP_LABELH;
- }
- else {
- uiDefButS(block, BUTM, B_NOP, name, x1, y1, width, boxh-1, &val, (float) md->items[a].retval, 0.0, 0, 0, "");
- y1 -= boxh;
- }
- }
-
- uiBoundsBlock(block, 1);
-
- event= uiDoBlocks(&listb, 0, 1);
-
- /* calculate last selected */
- if(event & UI_RETURN_OK) {
- lastselected= 0;
- for(a=0; a<md->nitems; a++) {
- if(val==md->items[a].retval) lastselected= a;
- }
-
- pupmenu_memory(instr, lastselected);
- }
- menudata_free(md);
-
- if(mouseymove && (event & UI_RETURN_OUT)==0) ui_warp_pointer(mousexmove, mouseymove);
- return val;
-}
-
-short pupmenu_col(char *instr, int maxrow)
-{
- uiBlock *block;
- ListBase listb= {NULL, NULL};
- int columns, rows;
- short mousemove[2], mval[2], event;
- int width, height, xmax, ymax, val= -1;
- int a, startx, starty, endx, endy, boxh=TBOXH, x1, y1;
- MenuData *md;
-
- block= uiNewBlock(&listb, "menu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_RET_1|UI_BLOCK_NUMSELECT);
- block->themecol= TH_MENU_ITEM;
-
- md= decompose_menu_string(instr);
-
- /* collumns and row calculation */
- columns= (md->nitems+maxrow)/maxrow;
- if (columns<1) columns= 1;
-
- if(columns > 8) {
- maxrow += 5;
- columns= (md->nitems+maxrow)/maxrow;
- }
-
- rows= (int) md->nitems/columns;
- if (rows<1) rows= 1;
-
- while (rows*columns<(md->nitems+columns) ) rows++;
-
- /* size and location */
- if(md->title) {
- width= 2*strlen(md->title)+BIF_GetStringWidth(uiBlockGetCurFont(block), md->title, (U.transopts & USER_TR_BUTTONS));
- width /= columns;
- }
- else width= 0;
-
- for(a=0; a<md->nitems; a++) {
- xmax= BIF_GetStringWidth(uiBlockGetCurFont(block), md->items[a].str, (U.transopts & USER_TR_BUTTONS));
- if(xmax>width) width= xmax;
- }
-
- width+= 10;
- if (width<50) width=50;
-
- boxh= TBOXH;
-
- height= rows*boxh;
- if (md->title) height+= boxh;
-
- xmax = G.curscreen->sizex;
- ymax = G.curscreen->sizey;
-
- getmouseco_sc(mval);
-
- /* find active item */
-#if 0
- fvalue= ui_get_but_val(but);
- for(a=0; a<md->nitems; a++) {
- if( md->items[a].retval== (int)fvalue ) break;
- }
-#endif
- /* no active item? */
- if(a==md->nitems) {
- if(md->title) a= -1;
- else a= 0;
- }
-
- if(a>0)
- startx = mval[0]-width/2 - ((int)(a)/rows)*width;
- else
- startx= mval[0]-width/2;
- starty = mval[1]-height + boxh/2 + ((a)%rows)*boxh;
-
- if (md->title) starty+= boxh;
-
- mousemove[0]= mousemove[1]= 0;
-
- if(startx<10) {
- mousemove[0]= 10-startx;
- startx= 10;
- }
- if(starty<10) {
- mousemove[1]= 10-starty;
- starty= 10;
- }
-
- endx= startx+width*columns;
- endy= starty+height;
-
- if(endx>xmax) {
- mousemove[0]= xmax-endx-10;
- endx= xmax-10;
- startx= endx-width*columns;
- }
- if(endy>ymax) {
- mousemove[1]= ymax-endy-10;
- endy= ymax-10;
- starty= endy-height;
- }
-
- ui_warp_pointer(mval[0]+mousemove[0], mval[1]+mousemove[1]);
-
- mousemove[0]= mval[0];
- mousemove[1]= mval[1];
-
- /* here we go! */
-
- if(md->title) {
- uiBut *bt;
- uiSetCurFont(block, UI_HELVB);
- bt= uiDefBut(block, LABEL, 0, md->title, startx, (short)(starty+rows*boxh), columns*(short)width, (short)boxh, NULL, 0.0, 0.0, 0, 0, "");
- uiSetCurFont(block, UI_HELV);
- bt->flag= UI_TEXT_LEFT;
- }
-
- for(a=0; a<md->nitems; a++) {
- char *name= md->items[a].str;
-
- int icon = md->items[a].icon;
-
- x1= startx + width*((int)a/rows);
- y1= starty - boxh*(a%rows) + (rows-1)*boxh;
-
- if( strcmp(name, "%l")==0){
- uiDefBut(block, SEPR, B_NOP, "", x1, y1, width, PUP_LABELH, NULL, 0, 0.0, 0, 0, "");
- y1 -= PUP_LABELH;
- }
- else if (icon) {
- uiDefIconButI(block, BUTM, B_NOP, icon, x1, y1, width+16, boxh-1, &val, (float) md->items[a].retval, 0.0, 0, 0, "");
- y1 -= boxh;
- }
- else {
- uiDefButI(block, BUTM, B_NOP, name, x1, y1, width, boxh-1, &val, (float) md->items[a].retval, 0.0, 0, 0, "");
- y1 -= boxh;
- }
- //uiDefButI(block, BUTM, B_NOP, md->items[a].str, x1, y1, (short)(width-(rows>1)), (short)(boxh-1), &val, (float)md->items[a].retval, 0.0, 0, 0, "");
- }
-
- uiBoundsBlock(block, 1);
-
- event= uiDoBlocks(&listb, 0, 1);
-
- menudata_free(md);
-
- if((event & UI_RETURN_OUT)==0) ui_warp_pointer(mousemove[0], mousemove[1]);
-
- return val;
-}
-
diff --git a/source/blender/src/interface_draw.c b/source/blender/src/interface_draw.c
deleted file mode 100644
index 4f1d5056111..00000000000
--- a/source/blender/src/interface_draw.c
+++ /dev/null
@@ -1,2467 +0,0 @@
-
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-/*
- a full doc with API notes can be found in bf-blender/blender/doc/interface_API.txt
-
- */
-
-
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-
-#ifndef WIN32
-#include <unistd.h>
-#else
-#include <io.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "PIL_time.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "DNA_color_types.h"
-#include "DNA_key_types.h"
-#include "DNA_packedFile_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_vec_types.h"
-#include "DNA_vfont_types.h"
-
-#include "BKE_blender.h"
-#include "BKE_colortools.h"
-#include "BKE_font.h"
-#include "BKE_global.h"
-#include "BKE_key.h"
-#include "BKE_utildefines.h"
-
-#include "datatoc.h" /* std font */
-
-#include "BIF_gl.h"
-#include "BIF_graphics.h"
-#include "BIF_keyval.h"
-#include "BIF_mainqueue.h"
-
-#include "BIF_screen.h"
-#include "BIF_toolbox.h"
-#include "BIF_mywindow.h"
-#include "BIF_space.h"
-#include "BIF_glutil.h"
-#include "BIF_interface.h"
-#include "BIF_interface_icons.h"
-#include "BIF_butspace.h"
-#include "BIF_language.h"
-
-#include "BSE_view.h"
-
-#ifdef INTERNATIONAL
-#include "FTF_Api.h"
-#endif
-
-#include "mydevice.h"
-#include "interface.h"
-#include "blendef.h"
-
-// globals
-extern float UIwinmat[4][4];
-
-
-/* ************** safe rasterpos for pixmap alignment with pixels ************* */
-
-void ui_rasterpos_safe(float x, float y, float aspect)
-{
- float vals[4], remainder;
- int doit=0;
-
- glRasterPos2f(x, y);
- glGetFloatv(GL_CURRENT_RASTER_POSITION, vals);
-
- remainder= vals[0] - floor(vals[0]);
- if(remainder > 0.4 && remainder < 0.6) {
- if(remainder < 0.5) x -= 0.1*aspect;
- else x += 0.1*aspect;
- doit= 1;
- }
- remainder= vals[1] - floor(vals[1]);
- if(remainder > 0.4 && remainder < 0.6) {
- if(remainder < 0.5) y -= 0.1*aspect;
- else y += 0.1*aspect;
- doit= 1;
- }
-
- if(doit) glRasterPos2f(x, y);
-
- BIF_RasterPos(x, y);
- BIF_SetScale(aspect);
-}
-
-/* ************** generic embossed rect, for window sliders etc ************* */
-
-void uiEmboss(float x1, float y1, float x2, float y2, int sel)
-{
-
- /* below */
- if(sel) glColor3ub(200,200,200);
- else glColor3ub(50,50,50);
- fdrawline(x1, y1, x2, y1);
-
- /* right */
- fdrawline(x2, y1, x2, y2);
-
- /* top */
- if(sel) glColor3ub(50,50,50);
- else glColor3ub(200,200,200);
- fdrawline(x1, y2, x2, y2);
-
- /* left */
- fdrawline(x1, y1, x1, y2);
-
-}
-
-/* ************** GENERIC ICON DRAW, NO THEME HERE ************* */
-
-/* icons have been standardized... and this call draws in untransformed coordinates */
-#define ICON_HEIGHT 16.0f
-
-static void ui_draw_icon(uiBut *but, BIFIconID icon, int blend)
-{
- float xs=0, ys=0, aspect, height;
-
- /* this icon doesn't need draw... */
- if(icon==ICON_BLANK1) return;
-
- /* we need aspect from block, for menus... these buttons are scaled in uiPositionBlock() */
- aspect= but->block->aspect;
- if(aspect != but->aspect) {
- /* prevent scaling up icon in pupmenu */
- if (aspect < 1.0f) {
- height= ICON_HEIGHT;
- aspect = 1.0f;
-
- }
- else
- height= ICON_HEIGHT/aspect;
- }
- else
- height= ICON_HEIGHT;
-
- if(but->flag & UI_ICON_LEFT) {
- if (but->type==BUT_TOGDUAL && but->drawstr[0]) {
- xs= but->x1-1.0;
- }
- else if (but->type==BUTM ) {
- xs= but->x1+1.0;
- }
- else if ((but->type==ICONROW) || (but->type==ICONTEXTROW)) {
- xs= but->x1+3.0;
- }
- else {
- xs= but->x1+4.0;
- }
- ys= (but->y1+but->y2- height)/2.0;
- }
- if(but->flag & UI_ICON_RIGHT) {
- xs= but->x2-17.0;
- ys= (but->y1+but->y2- height)/2.0;
- }
- if (!((but->flag & UI_ICON_RIGHT) || (but->flag & UI_ICON_LEFT))) {
- xs= (but->x1+but->x2- height)/2.0;
- ys= (but->y1+but->y2- height)/2.0;
- }
-
- glEnable(GL_BLEND);
-
- /* calculate blend color */
- if ELEM3(but->type, TOG, ROW, TOGN) {
- if(but->flag & UI_SELECT);
- else if(but->flag & UI_ACTIVE);
- else blend= -60;
- }
- BIF_icon_draw_aspect_blended(xs, ys, icon, aspect, blend);
-
- glDisable(GL_BLEND);
-
-}
-
-
-/* ************** DEFAULT THEME, SHADED BUTTONS ************* */
-
-
-#define M_WHITE BIF_ThemeColorShade(colorid, 80)
-
-#define M_ACT_LIGHT BIF_ThemeColorShade(colorid, 55)
-#define M_LIGHT BIF_ThemeColorShade(colorid, 45)
-#define M_HILITE BIF_ThemeColorShade(colorid, 25)
-#define M_LMEDIUM BIF_ThemeColorShade(colorid, 10)
-#define M_MEDIUM BIF_ThemeColor(colorid)
-#define M_LGREY BIF_ThemeColorShade(colorid, -20)
-#define M_GREY BIF_ThemeColorShade(colorid, -45)
-#define M_DARK BIF_ThemeColorShade(colorid, -80)
-
-#define M_NUMTEXT BIF_ThemeColorShade(colorid, 25)
-#define M_NUMTEXT_ACT_LIGHT BIF_ThemeColorShade(colorid, 35)
-
-#define MM_WHITE BIF_ThemeColorShade(TH_BUT_NEUTRAL, 120)
-
-/* Used for the subtle sunken effect around buttons.
- * One option is to hardcode to white, with alpha, however it causes a
- * weird 'building up' efect, so it's commented out for now.
- */
-
-/*
-#define MM_WHITE_OP glColor4ub(255, 255, 255, 60)
-#define MM_WHITE_TR glColor4ub(255, 255, 255, 0)
- */
-
-#define MM_WHITE_OP BIF_ThemeColorShadeAlpha(TH_BACK, 55, -100)
-#define MM_WHITE_TR BIF_ThemeColorShadeAlpha(TH_BACK, 55, -255)
-
-#define MM_LIGHT BIF_ThemeColorShade(TH_BUT_OUTLINE, 45)
-#define MM_MEDIUM BIF_ThemeColor(TH_BUT_OUTLINE)
-#define MM_GREY BIF_ThemeColorShade(TH_BUT_OUTLINE, -45)
-#define MM_DARK BIF_ThemeColorShade(TH_BUT_OUTLINE, -80)
-
-/* base shaded button */
-static void shaded_button(float x1, float y1, float x2, float y2, float asp, int colorid, int flag, int mid)
-{
- /* 'mid' arg determines whether the button is in the middle of
- * an alignment group or not. 0 = not middle, 1 = is in the middle.
- * Done to allow cleaner drawing
- */
-
- /* *** SHADED BUTTON BASE *** */
- glShadeModel(GL_SMOOTH);
- glBegin(GL_QUADS);
-
- if(flag & UI_SELECT) {
- if(flag & UI_ACTIVE) M_MEDIUM;
- else M_LGREY;
- } else {
- if(flag & UI_ACTIVE) M_LIGHT;
- else M_HILITE;
- }
-
- glVertex2f(x1,y1);
- glVertex2f(x2,y1);
-
- if(flag & UI_SELECT) {
- if(flag & UI_ACTIVE) M_LGREY;
- else M_GREY;
- } else {
- if(flag & UI_ACTIVE) M_ACT_LIGHT;
- else M_LIGHT;
- }
-
- glVertex2f(x2,(y2-(y2-y1)/3));
- glVertex2f(x1,(y2-(y2-y1)/3));
- glEnd();
-
-
- glShadeModel(GL_FLAT);
- glBegin(GL_QUADS);
-
- if(flag & UI_SELECT) {
- if(flag & UI_ACTIVE) M_LGREY;
- else M_GREY;
- } else {
- if(flag & UI_ACTIVE) M_ACT_LIGHT;
- else M_LIGHT;
- }
-
- glVertex2f(x1,(y2-(y2-y1)/3));
- glVertex2f(x2,(y2-(y2-y1)/3));
- glVertex2f(x2,y2);
- glVertex2f(x1,y2);
-
- glEnd();
- /* *** END SHADED BUTTON BASE *** */
-
- /* *** INNER OUTLINE *** */
- /* left */
- if(!(flag & UI_SELECT)) {
- glShadeModel(GL_SMOOTH);
- glBegin(GL_LINES);
- M_MEDIUM;
- glVertex2f(x1+1,y1+2);
- M_WHITE;
- glVertex2f(x1+1,y2);
- glEnd();
- }
-
- /* right */
- if(!(flag & UI_SELECT)) {
- glShadeModel(GL_SMOOTH);
- glBegin(GL_LINES);
- M_MEDIUM;
- glVertex2f(x2-1,y1+2);
- M_WHITE;
- glVertex2f(x2-1,y2);
- glEnd();
- }
-
- glShadeModel(GL_FLAT);
-
- /* top */
- if(flag & UI_SELECT) {
- if(flag & UI_ACTIVE) M_LGREY;
- else M_GREY;
- } else {
- if(flag & UI_ACTIVE) M_WHITE;
- else M_WHITE;
- }
-
- fdrawline(x1, (y2-1), x2, (y2-1));
-
- /* bottom */
- if(flag & UI_SELECT) {
- if(flag & UI_ACTIVE) M_MEDIUM;
- else M_LGREY;
- } else {
- if(flag & UI_ACTIVE) M_LMEDIUM;
- else M_MEDIUM;
- }
- fdrawline(x1, (y1+1), x2, (y1+1));
- /* *** END INNER OUTLINE *** */
-
- /* *** OUTER OUTLINE *** */
- if (mid) {
- // we draw full outline, its not AA, and it works better button mouse-over hilite
- MM_DARK;
-
- // left right
- fdrawline(x1, y1, x1, y2);
- fdrawline(x2, y1, x2, y2);
-
- // top down
- fdrawline(x1, y2, x2, y2);
- fdrawline(x1, y1, x2, y1);
- } else {
- MM_DARK;
- gl_round_box(GL_LINE_LOOP, x1, y1, x2, y2, 1.5);
- }
- /* END OUTER OUTLINE */
-}
-
-/* base flat button */
-static void flat_button(float x1, float y1, float x2, float y2, float asp, int colorid, int flag, int mid)
-{
- /* 'mid' arg determines whether the button is in the middle of
- * an alignment group or not. 0 = not middle, 1 = is in the middle.
- * Done to allow cleaner drawing
- */
-
- /* *** FLAT TEXT/NUM FIELD *** */
- glShadeModel(GL_FLAT);
- if(flag & UI_SELECT) {
- if(flag & UI_ACTIVE) M_LGREY;
- else M_GREY;
- }
- else {
- if(flag & UI_ACTIVE) M_NUMTEXT_ACT_LIGHT;
- else M_NUMTEXT;
- }
-
- glRectf(x1, y1, x2, y2);
- /* *** END FLAT TEXT/NUM FIELD *** */
-
- /* *** OUTER OUTLINE *** */
- if (mid) {
- // we draw full outline, its not AA, and it works better button mouse-over hilite
- MM_DARK;
-
- // left right
- fdrawline(x1, y1, x1, y2);
- fdrawline(x2, y1, x2, y2);
-
- // top down
- fdrawline(x1, y2, x2, y2);
- fdrawline(x1, y1, x2, y1);
- } else {
- MM_DARK;
- gl_round_box(GL_LINE_LOOP, x1, y1, x2, y2, 1.5);
- }
- /* END OUTER OUTLINE */
-}
-
-/* small side double arrow for iconrow */
-static void ui_default_iconrow_arrows(float x1, float y1, float x2, float y2)
-{
- glEnable( GL_POLYGON_SMOOTH );
- glEnable( GL_BLEND );
-
- glShadeModel(GL_FLAT);
- glBegin(GL_TRIANGLES);
- glVertex2f((short)x2-2,(short)(y2-(y2-y1)/2)+1);
- glVertex2f((short)x2-6,(short)(y2-(y2-y1)/2)+1);
- glVertex2f((short)x2-4,(short)(y2-(y2-y1)/2)+4);
- glEnd();
-
- glBegin(GL_TRIANGLES);
- glVertex2f((short)x2-2,(short)(y2-(y2-y1)/2) -1);
- glVertex2f((short)x2-6,(short)(y2-(y2-y1)/2) -1);
- glVertex2f((short)x2-4,(short)(y2-(y2-y1)/2) -4);
- glEnd();
-
- glDisable( GL_BLEND );
- glDisable( GL_POLYGON_SMOOTH );
-}
-
-/* side double arrow for menu */
-static void ui_default_menu_arrows(float x1, float y1, float x2, float y2)
-{
- glEnable( GL_POLYGON_SMOOTH );
- glEnable( GL_BLEND );
-
- glShadeModel(GL_FLAT);
- glBegin(GL_TRIANGLES);
- glVertex2f((short)x2-4,(short)(y2-(y2-y1)/2)+1);
- glVertex2f((short)x2-12,(short)(y2-(y2-y1)/2)+1);
- glVertex2f((short)x2-8,(short)(y2-(y2-y1)/2)+4);
- glEnd();
-
- glBegin(GL_TRIANGLES);
- glVertex2f((short)x2-4,(short)(y2-(y2-y1)/2) -1);
- glVertex2f((short)x2-12,(short)(y2-(y2-y1)/2) -1);
- glVertex2f((short)x2-8,(short)(y2-(y2-y1)/2) -4);
- glEnd();
-
- glDisable( GL_BLEND );
- glDisable( GL_POLYGON_SMOOTH );
-}
-
-/* left/right arrows for number fields */
-static void ui_default_num_arrows(float x1, float y1, float x2, float y2)
-{
- if( x2-x1 > 25) { // 25 is a bit arbitrary, but small buttons cant have arrows
-
- glEnable( GL_POLYGON_SMOOTH );
- glEnable( GL_BLEND );
-
- glShadeModel(GL_FLAT);
- glBegin(GL_TRIANGLES);
-
- glVertex2f((short)x1+5,(short)(y2-(y2-y1)/2));
- glVertex2f((short)x1+10,(short)(y2-(y2-y1)/2)+4);
- glVertex2f((short)x1+10,(short)(y2-(y2-y1)/2)-4);
- glEnd();
-
- /* right */
- glShadeModel(GL_FLAT);
- glBegin(GL_TRIANGLES);
-
- glVertex2f((short)x2-5,(short)(y2-(y2-y1)/2));
- glVertex2f((short)x2-10,(short)(y2-(y2-y1)/2)-4);
- glVertex2f((short)x2-10,(short)(y2-(y2-y1)/2)+4);
- glEnd();
-
- glDisable( GL_BLEND );
- glDisable( GL_POLYGON_SMOOTH );
- }
-}
-
-/* changing black/white for TOG3 buts */
-static void ui_tog3_invert(float x1, float y1, float x2, float y2, int seltype)
-{
- short alpha = 30;
-
- if (seltype == 0) {
- glEnable(GL_BLEND);
-
- glColor4ub(0, 0, 0, alpha);
- glRectf(x2-6, y1, x2, (y1+(y2-y1)/2));
-
- glColor4ub(255, 255, 255, alpha);
- glRectf(x2-6, (y1+(y2-y1)/2), x2, y2);
-
- glDisable(GL_BLEND);
- } else {
- glEnable(GL_BLEND);
-
- glColor4ub(255, 255, 255, alpha);
- glRectf(x2-6, y1, x2, (y1+(y2-y1)/2));
-
- glColor4ub(0, 0, 0, alpha);
- glRectf(x2-6, (y1+(y2-y1)/2), x2, y2);
-
- glDisable(GL_BLEND);
- }
-}
-
-/* button/popup menu/iconrow drawing code */
-static void ui_default_button(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag)
-{
- int align= (flag & UI_BUT_ALIGN);
-
- if(align) {
-
- /* *** BOTTOM OUTER SUNKEN EFFECT *** */
- if (!((align == UI_BUT_ALIGN_DOWN) ||
- (align == (UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_RIGHT)) ||
- (align == (UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_LEFT)))) {
- glEnable(GL_BLEND);
- MM_WHITE_OP;
- fdrawline(x1, y1-1, x2, y1-1);
- glDisable(GL_BLEND);
- }
- /* *** END BOTTOM OUTER SUNKEN EFFECT *** */
-
- switch(align) {
- case UI_BUT_ALIGN_TOP:
- uiSetRoundBox(12);
-
- /* last arg in shaded_button() determines whether the button is in the middle of
- * an alignment group or not. 0 = not middle, 1 = is in the middle.
- * Done to allow cleaner drawing
- */
-
- shaded_button(x1, y1, x2, y2, asp, colorid, flag, 0);
- break;
- case UI_BUT_ALIGN_DOWN:
- uiSetRoundBox(3);
- shaded_button(x1, y1, x2, y2, asp, colorid, flag, 0);
- break;
- case UI_BUT_ALIGN_LEFT:
-
- /* RIGHT OUTER SUNKEN EFFECT */
- glEnable(GL_BLEND);
- glShadeModel(GL_SMOOTH);
- glBegin(GL_LINES);
- MM_WHITE_OP;
- glVertex2f(x2+1,y1);
- MM_WHITE_TR;
- glVertex2f(x2+1,y2);
- glEnd();
- glDisable(GL_BLEND);
-
- uiSetRoundBox(6);
- shaded_button(x1, y1, x2, y2, asp, colorid, flag, 0);
- break;
- case UI_BUT_ALIGN_RIGHT:
-
- /* LEFT OUTER SUNKEN EFFECT */
- glEnable(GL_BLEND);
- glShadeModel(GL_SMOOTH);
- glBegin(GL_LINES);
- MM_WHITE_OP;
- glVertex2f(x1-1,y1);
- MM_WHITE_TR;
- glVertex2f(x1-1,y2);
- glEnd();
- glDisable(GL_BLEND);
-
- uiSetRoundBox(9);
- shaded_button(x1, y1, x2, y2, asp, colorid, flag, 0);
- break;
-
- case UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_RIGHT:
- uiSetRoundBox(1);
- shaded_button(x1, y1, x2, y2, asp, colorid, flag, 0);
- break;
- case UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_LEFT:
- uiSetRoundBox(2);
- shaded_button(x1, y1, x2, y2, asp, colorid, flag, 0);
- break;
- case UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_RIGHT:
-
- /* LEFT OUTER SUNKEN EFFECT */
- glEnable(GL_BLEND);
- glShadeModel(GL_SMOOTH);
- glBegin(GL_LINES);
- MM_WHITE_OP;
- glVertex2f(x1-1,y1);
- MM_WHITE_TR;
- glVertex2f(x1-1,y2);
- glEnd();
- glDisable(GL_BLEND);
-
- uiSetRoundBox(8);
- shaded_button(x1, y1, x2, y2, asp, colorid, flag, 0);
- break;
- case UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_LEFT:
-
- /* RIGHT OUTER SUNKEN EFFECT */
- glEnable(GL_BLEND);
- glShadeModel(GL_SMOOTH);
- glBegin(GL_LINES);
- MM_WHITE_OP;
- glVertex2f(x2+1,y1);
- MM_WHITE_TR;
- glVertex2f(x2+1,y2);
- glEnd();
- glDisable(GL_BLEND);
-
- uiSetRoundBox(4);
- shaded_button(x1, y1, x2, y2, asp, colorid, flag, 0);
- break;
-
- default:
- shaded_button(x1, y1, x2, y2, asp, colorid, flag, 1);
- break;
- }
- }
- else {
- glEnable(GL_BLEND);
- glShadeModel(GL_SMOOTH);
-
- /* BOTTOM OUTER SUNKEN EFFECT */
- MM_WHITE_OP;
- fdrawline(x1, y1-1, x2, y1-1);
-
- /* LEFT OUTER SUNKEN EFFECT */
- glBegin(GL_LINES);
- MM_WHITE_OP;
- glVertex2f(x1-1,y1);
- MM_WHITE_TR;
- glVertex2f(x1-1,y2);
- glEnd();
-
- /* RIGHT OUTER SUNKEN EFFECT */
- glBegin(GL_LINES);
- MM_WHITE_OP;
- glVertex2f(x2+1,y1);
- MM_WHITE_TR;
- glVertex2f(x2+1,y2);
- glEnd();
-
- glDisable(GL_BLEND);
-
- uiSetRoundBox(15);
- shaded_button(x1, y1, x2, y2, asp, colorid, flag, 0);
- }
-
- /* *** EXTRA DRAWING FOR SPECIFIC CONTROL TYPES *** */
- switch(type) {
- case ICONROW:
- case ICONTEXTROW:
- /* DARKENED AREA */
- glEnable(GL_BLEND);
-
- glColor4ub(0, 0, 0, 30);
- glRectf(x2-9, y1, x2, y2);
-
- glDisable(GL_BLEND);
- /* END DARKENED AREA */
-
- /* ICONROW DOUBLE-ARROW */
- M_DARK;
- ui_default_iconrow_arrows(x1, y1, x2, y2);
- /* END ICONROW DOUBLE-ARROW */
- break;
- case MENU:
- /* DARKENED AREA */
- glEnable(GL_BLEND);
-
- glColor4ub(0, 0, 0, 30);
- glRectf(x2-18, y1, x2, y2);
-
- glDisable(GL_BLEND);
- /* END DARKENED AREA */
-
- /* MENU DOUBLE-ARROW */
- M_DARK;
- ui_default_menu_arrows(x1, y1, x2, y2);
- /* MENU DOUBLE-ARROW */
- break;
- }
-}
-
-
-/* number/text field drawing code */
-static void ui_default_flat(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag)
-{
- int align= (flag & UI_BUT_ALIGN);
-
- if(align) {
-
- /* *** BOTTOM OUTER SUNKEN EFFECT *** */
- if (!((align == UI_BUT_ALIGN_DOWN) ||
- (align == (UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_RIGHT)) ||
- (align == (UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_LEFT)))) {
- glEnable(GL_BLEND);
- MM_WHITE_OP;
- fdrawline(x1, y1-1, x2, y1-1);
- glDisable(GL_BLEND);
- }
- /* *** END BOTTOM OUTER SUNKEN EFFECT *** */
-
- switch(align) {
- case UI_BUT_ALIGN_TOP:
- uiSetRoundBox(12);
-
- /* last arg in shaded_button() determines whether the button is in the middle of
- * an alignment group or not. 0 = not middle, 1 = is in the middle.
- * Done to allow cleaner drawing
- */
-
- flat_button(x1, y1, x2, y2, asp, colorid, flag, 0);
- break;
- case UI_BUT_ALIGN_DOWN:
- uiSetRoundBox(3);
- flat_button(x1, y1, x2, y2, asp, colorid, flag, 0);
- break;
- case UI_BUT_ALIGN_LEFT:
-
- /* RIGHT OUTER SUNKEN EFFECT */
- glEnable(GL_BLEND);
- glShadeModel(GL_SMOOTH);
- glBegin(GL_LINES);
- MM_WHITE_OP;
- glVertex2f(x2+1,y1);
- MM_WHITE_TR;
- glVertex2f(x2+1,y2);
- glEnd();
- glDisable(GL_BLEND);
-
- uiSetRoundBox(6);
- flat_button(x1, y1, x2, y2, asp, colorid, flag, 0);
- break;
- case UI_BUT_ALIGN_RIGHT:
-
- /* LEFT OUTER SUNKEN EFFECT */
- glEnable(GL_BLEND);
- glShadeModel(GL_SMOOTH);
- glBegin(GL_LINES);
- MM_WHITE_OP;
- glVertex2f(x1-1,y1);
- MM_WHITE_TR;
- glVertex2f(x1-1,y2);
- glEnd();
- glDisable(GL_BLEND);
-
- uiSetRoundBox(9);
- flat_button(x1, y1, x2, y2, asp, colorid, flag, 0);
- break;
-
- case UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_RIGHT:
- uiSetRoundBox(1);
- flat_button(x1, y1, x2, y2, asp, colorid, flag, 0);
- break;
- case UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_LEFT:
- uiSetRoundBox(2);
- flat_button(x1, y1, x2, y2, asp, colorid, flag, 0);
- break;
- case UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_RIGHT:
-
- /* LEFT OUTER SUNKEN EFFECT */
- glEnable(GL_BLEND);
- glShadeModel(GL_SMOOTH);
- glBegin(GL_LINES);
- MM_WHITE_OP;
- glVertex2f(x1-1,y1);
- MM_WHITE_TR;
- glVertex2f(x1-1,y2);
- glEnd();
- glDisable(GL_BLEND);
-
- uiSetRoundBox(8);
- flat_button(x1, y1, x2, y2, asp, colorid, flag, 0);
- break;
- case UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_LEFT:
-
- /* RIGHT OUTER SUNKEN EFFECT */
- glEnable(GL_BLEND);
- glShadeModel(GL_SMOOTH);
- glBegin(GL_LINES);
- MM_WHITE_OP;
- glVertex2f(x2+1,y1);
- MM_WHITE_TR;
- glVertex2f(x2+1,y2);
- glEnd();
- glDisable(GL_BLEND);
-
- uiSetRoundBox(4);
- flat_button(x1, y1, x2, y2, asp, colorid, flag, 0);
- break;
-
- default:
- flat_button(x1, y1, x2, y2, asp, colorid, flag, 1);
- break;
- }
- }
- else {
-
- glEnable(GL_BLEND);
- glShadeModel(GL_SMOOTH);
-
- /* BOTTOM OUTER SUNKEN EFFECT */
- MM_WHITE_OP;
- fdrawline(x1, y1-1, x2, y1-1);
-
- /* LEFT OUTER SUNKEN EFFECT */
- glBegin(GL_LINES);
- MM_WHITE_OP;
- glVertex2f(x1-1,y1);
- MM_WHITE_TR;
- glVertex2f(x1-1,y2);
- glEnd();
-
- /* RIGHT OUTER SUNKEN EFFECT */
- glBegin(GL_LINES);
- MM_WHITE_OP;
- glVertex2f(x2+1,y1);
- MM_WHITE_TR;
- glVertex2f(x2+1,y2);
- glEnd();
-
- glDisable(GL_BLEND);
-
- uiSetRoundBox(15);
- flat_button(x1, y1, x2, y2, asp, colorid, flag, 0);
- }
-
- /* *** EXTRA DRAWING FOR SPECIFIC CONTROL TYPES *** */
- switch(type) {
- case NUM:
- /* SIDE ARROWS */
- /* left */
- if(flag & UI_SELECT) {
- if(flag & UI_ACTIVE) M_DARK;
- else M_DARK;
- } else {
- if(flag & UI_ACTIVE) M_GREY;
- else M_LGREY;
- }
-
- ui_default_num_arrows(x1, y1, x2, y2);
- /* END SIDE ARROWS */
- }
-}
-
-static void ui_default_slider(int colorid, float fac, float aspect, float x1, float y1, float x2, float y2, int flag)
-{
- float ymid, yc;
-
- /* the slider background line */
- ymid= (y1+y2)/2.0;
- //yc= 2.5*aspect; // height of center line
- yc = 2.3; // height of center line
-
- if(flag & UI_SELECT)
- BIF_ThemeColorShade(TH_BUT_NUM, -5);
- else
- if(flag & UI_ACTIVE)
- BIF_ThemeColorShade(TH_BUT_NUM, +35);
- else
- BIF_ThemeColorShade(TH_BUT_NUM, +25);
-
- glRectf(x1, ymid-yc, x2, ymid+yc);
-
- /* top inner bevel */
- if(flag & UI_SELECT) BIF_ThemeColorShade(TH_BUT_NUM, -40);
- else BIF_ThemeColorShade(TH_BUT_NUM, -5);
- fdrawline(x1+1, ymid+yc, x2, ymid+yc);
-
- /* bottom inner bevel */
- if(flag & UI_SELECT) BIF_ThemeColorShade(TH_BUT_NUM, +15);
- else BIF_ThemeColorShade(TH_BUT_NUM, +45);
- fdrawline(x1+1, ymid-yc, x2, ymid-yc);
-
-
- /* the movable slider */
- if(flag & UI_SELECT) BIF_ThemeColorShade(TH_BUT_NUM, +80);
- else BIF_ThemeColorShade(TH_BUT_NUM, -45);
-
- glShadeModel(GL_SMOOTH);
- glBegin(GL_QUADS);
-
- BIF_ThemeColorShade(TH_BUT_NUM, -45);
-
- glVertex2f(x1, y1+2.5);
- glVertex2f(x1+fac, y1+2.5);
-
- BIF_ThemeColor(TH_BUT_NUM);
-
- glVertex2f(x1+fac, y2-2.5);
- glVertex2f(x1, y2-2.5);
-
- glEnd();
-
-
- /* slider handle center */
- glShadeModel(GL_SMOOTH);
- glBegin(GL_QUADS);
-
- BIF_ThemeColor(TH_BUT_NUM);
- glVertex2f(x1+fac-3, y1+2);
- glVertex2f(x1+fac, y1+4);
- BIF_ThemeColorShade(TH_BUT_NUM, +80);
- glVertex2f(x1+fac, y2-2);
- glVertex2f(x1+fac-3, y2-2);
-
- glEnd();
-
- /* slider handle left bevel */
- BIF_ThemeColorShade(TH_BUT_NUM, +70);
- fdrawline(x1+fac-3, y2-2, x1+fac-3, y1+2);
-
- /* slider handle right bevel */
- BIF_ThemeColorShade(TH_BUT_NUM, -35);
- fdrawline(x1+fac, y2-2, x1+fac, y1+2);
-
- glShadeModel(GL_FLAT);
-}
-
-/* default theme callback */
-static void ui_draw_default(int type, int colorid, float aspect, float x1, float y1, float x2, float y2, int flag)
-{
-
- switch(type) {
- case TEX:
- case IDPOIN:
- case NUM:
- ui_default_flat(type, colorid, aspect, x1, y1, x2, y2, flag);
- break;
- case ICONROW:
- case ICONTEXTROW:
- case MENU:
- default:
- ui_default_button(type, colorid, aspect, x1, y1, x2, y2, flag);
- }
-
-}
-
-
-/* *************** OLDSKOOL THEME ***************** */
-
-static void ui_draw_outlineX(float x1, float y1, float x2, float y2, float asp1)
-{
- float vec[2];
-
- glBegin(GL_LINE_LOOP);
- vec[0]= x1+asp1; vec[1]= y1-asp1;
- glVertex2fv(vec);
- vec[0]= x2-asp1;
- glVertex2fv(vec);
- vec[0]= x2+asp1; vec[1]= y1+asp1;
- glVertex2fv(vec);
- vec[1]= y2-asp1;
- glVertex2fv(vec);
- vec[0]= x2-asp1; vec[1]= y2+asp1;
- glVertex2fv(vec);
- vec[0]= x1+asp1;
- glVertex2fv(vec);
- vec[0]= x1-asp1; vec[1]= y2-asp1;
- glVertex2fv(vec);
- vec[1]= y1+asp1;
- glVertex2fv(vec);
- glEnd();
-
-}
-
-
-static void ui_draw_oldskool(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag)
-{
- /* paper */
- if(flag & UI_SELECT) {
- if(flag & UI_ACTIVE) BIF_ThemeColorShade(colorid, -40);
- else BIF_ThemeColorShade(colorid, -30);
- }
- else {
- if(flag & UI_ACTIVE) BIF_ThemeColorShade(colorid, +30);
- else BIF_ThemeColorShade(colorid, +20);
- }
-
- glRectf(x1+1, y1+1, x2-1, y2-1);
-
- x1+= asp;
- x2-= asp;
- y1+= asp;
- y2-= asp;
-
- /* below */
- if(flag & UI_SELECT) BIF_ThemeColorShade(colorid, 0);
- else BIF_ThemeColorShade(colorid, -30);
- fdrawline(x1, y1, x2, y1);
-
- /* right */
- fdrawline(x2, y1, x2, y2);
-
- /* top */
- if(flag & UI_SELECT) BIF_ThemeColorShade(colorid, -30);
- else BIF_ThemeColorShade(colorid, 0);
- fdrawline(x1, y2, x2, y2);
-
- /* left */
- fdrawline(x1, y1, x1, y2);
-
- /* outline */
- glColor3ub(0,0,0);
- ui_draw_outlineX(x1, y1, x2, y2, asp);
-
-
- /* special type decorations */
- switch(type) {
- case NUM:
- if(flag & UI_SELECT) BIF_ThemeColorShade(colorid, -60);
- else BIF_ThemeColorShade(colorid, -30);
- ui_default_num_arrows(x1, y1, x2, y2);
- break;
-
- case ICONROW:
- case ICONTEXTROW:
- if(flag & UI_ACTIVE) BIF_ThemeColorShade(colorid, 0);
- else BIF_ThemeColorShade(colorid, -10);
- glRectf(x2-9, y1+asp, x2-asp, y2-asp);
-
- BIF_ThemeColorShade(colorid, -50);
- ui_default_iconrow_arrows(x1, y1, x2, y2);
- break;
-
- case MENU:
- if(flag & UI_ACTIVE) BIF_ThemeColorShade(colorid, 0);
- else BIF_ThemeColorShade(colorid, -10);
- glRectf(x2-17, y1+asp, x2-asp, y2-asp);
-
- BIF_ThemeColorShade(colorid, -50);
- ui_default_menu_arrows(x1, y1, x2, y2);
- break;
- }
-
-}
-
-/* *************** BASIC ROUNDED THEME ***************** */
-
-static void round_button(float x1, float y1, float x2, float y2, float asp,
- int colorid, int round, int menudeco, int curshade)
-{
- float rad;
- char col[4];
-
- rad= (y2-y1)/2.0;
- if(rad>7.0) rad= 7.0;
-
- uiSetRoundBox(round);
- gl_round_box(GL_POLYGON, x1, y1, x2, y2, rad);
-
- if(menudeco) {
- uiSetRoundBox(round & ~9);
- BIF_ThemeColorShade(colorid, curshade-20);
- gl_round_box(GL_POLYGON, x2-menudeco, y1, x2, y2, rad);
- }
-
- /* fake AA */
- uiSetRoundBox(round);
- glEnable( GL_BLEND );
-
- BIF_GetThemeColor3ubv(colorid, col);
-
- if(col[0]<100) col[0]= 0; else col[0]-= 100;
- if(col[1]<100) col[1]= 0; else col[1]-= 100;
- if(col[2]<100) col[2]= 0; else col[2]-= 100;
- col[3]= 80;
- glColor4ubv((GLubyte *)col);
- gl_round_box(GL_LINE_LOOP, x1, y1, x2, y2, rad - asp);
- gl_round_box(GL_LINE_LOOP, x1, y1, x2, y2, rad + asp);
- col[3]= 180;
- glColor4ubv((GLubyte *)col);
- gl_round_box(GL_LINE_LOOP, x1, y1, x2, y2, rad);
-
- glDisable( GL_BLEND );
-}
-
-/* button in midst of alignment row */
-static void round_button_mid(float x1, float y1, float x2, float y2, float asp,
- int colorid, int align, int menudeco, int curshade)
-{
- glRectf(x1, y1, x2, y2);
-
- if(menudeco) {
- BIF_ThemeColorShade(colorid, curshade-20);
- glRectf(x2-menudeco, y1, x2, y2);
- }
-
- BIF_ThemeColorBlendShade(colorid, TH_BACK, 0.5, -70);
- // we draw full outline, its not AA, and it works better button mouse-over hilite
-
- // left right
- fdrawline(x1, y1, x1, y2);
- fdrawline(x2, y1, x2, y2);
-
- // top down
- fdrawline(x1, y2, x2, y2);
- fdrawline(x1, y1, x2, y1);
-}
-
-static void ui_draw_round(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag)
-{
- int align= (flag & UI_BUT_ALIGN);
- int curshade= 0, menudeco= 0;
-
- if(type==ICONROW || type==ICONTEXTROW) menudeco= 9;
- else if((type==MENU || type==BLOCK) && x2-x1>24) menudeco= 16;
-
- /* paper */
- if(flag & UI_SELECT) {
- if(flag & UI_ACTIVE) curshade= -40;
- else curshade= -30;
- }
- else {
- if(flag & UI_ACTIVE) curshade= 30;
- else curshade= +20;
- }
-
- BIF_ThemeColorShade(colorid, curshade);
-
- if(align) {
- switch(align) {
- case UI_BUT_ALIGN_TOP:
- round_button(x1, y1, x2, y2, asp, colorid, 12, menudeco, curshade);
- break;
- case UI_BUT_ALIGN_DOWN:
- round_button(x1, y1, x2, y2, asp, colorid, 3, menudeco, curshade);
- break;
- case UI_BUT_ALIGN_LEFT:
- round_button(x1, y1, x2, y2, asp, colorid, 6, menudeco, curshade);
- break;
- case UI_BUT_ALIGN_RIGHT:
- round_button(x1, y1, x2, y2, asp, colorid, 9, menudeco, curshade);
- break;
-
- case UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_RIGHT:
- round_button(x1, y1, x2, y2, asp, colorid, 1, menudeco, curshade);
- break;
- case UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_LEFT:
- round_button(x1, y1, x2, y2, asp, colorid, 2, menudeco, curshade);
- break;
- case UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_RIGHT:
- round_button(x1, y1, x2, y2, asp, colorid, 8, menudeco, curshade);
- break;
- case UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_LEFT:
- round_button(x1, y1, x2, y2, asp, colorid, 4, menudeco, curshade);
- break;
-
- default:
- round_button_mid(x1, y1, x2, y2, asp, colorid, align, menudeco, curshade);
- break;
- }
- }
- else {
- round_button(x1, y1, x2, y2, asp, colorid, 15, menudeco, curshade);
- }
-
- /* special type decorations */
- switch(type) {
- case NUM:
- BIF_ThemeColorShade(colorid, curshade-60);
- ui_default_num_arrows(x1, y1, x2, y2);
- break;
-
- case ICONROW:
- case ICONTEXTROW:
- BIF_ThemeColorShade(colorid, curshade-60);
- ui_default_iconrow_arrows(x1, y1, x2, y2);
- break;
-
- case MENU:
- case BLOCK:
- BIF_ThemeColorShade(colorid, curshade-60);
- ui_default_menu_arrows(x1, y1, x2, y2);
- break;
- }
-}
-
-/* *************** MINIMAL THEME ***************** */
-
-// theme can define an embosfunc and sliderfunc, text+icon drawing is standard, no theme.
-
-
-
-/* super minimal button as used in logic menu */
-static void ui_draw_minimal(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag)
-{
- /* too much space between buttons */
-
- if (type==TEX || type==IDPOIN) {
- x1+= asp;
- x2-= (asp*2);
- //y1+= asp;
- y2-= asp;
- } else {
- /* Less space between buttons looks nicer */
- y2-= asp;
- x2-= asp;
- }
-
- /* paper */
- if(flag & UI_SELECT) {
- if(flag & UI_ACTIVE) BIF_ThemeColorShade(colorid, -40);
- else BIF_ThemeColorShade(colorid, -30);
- }
- else {
- if(flag & UI_ACTIVE) BIF_ThemeColorShade(colorid, +20);
- else BIF_ThemeColorShade(colorid, +10);
- }
-
- glRectf(x1, y1, x2, y2);
-
- if (type==TEX || type==IDPOIN) {
- BIF_ThemeColorShade(colorid, -60);
-
- /* top */
- fdrawline(x1, y2, x2, y2);
- /* left */
- fdrawline(x1, y1, x1, y2);
-
-
- /* text underline, some */
- BIF_ThemeColorShade(colorid, +50);
- glEnable(GL_LINE_STIPPLE);
- glLineStipple(1, 0x8888);
- fdrawline(x1+(asp*2), y1+(asp*3), x2-(asp*2), y1+(asp*3));
- glDisable(GL_LINE_STIPPLE);
-
-
- BIF_ThemeColorShade(colorid, +60);
- /* below */
- fdrawline(x1, y1, x2, y1);
- /* right */
- fdrawline(x2, y1, x2, y2);
-
- } else {
- if(flag & UI_SELECT) {
- BIF_ThemeColorShade(colorid, -60);
-
- /* top */
- fdrawline(x1, y2, x2, y2);
- /* left */
- fdrawline(x1, y1, x1, y2);
- BIF_ThemeColorShade(colorid, +40);
-
- /* below */
- fdrawline(x1, y1, x2, y1);
- /* right */
- fdrawline(x2, y1, x2, y2);
- }
- else {
- BIF_ThemeColorShade(colorid, +40);
-
- /* top */
- fdrawline(x1, y2, x2, y2);
- /* left */
- fdrawline(x1, y1, x1, y2);
-
- BIF_ThemeColorShade(colorid, -60);
- /* below */
- fdrawline(x1, y1, x2, y1);
- /* right */
- fdrawline(x2, y1, x2, y2);
- }
- }
-
- /* special type decorations */
- switch(type) {
- case NUM:
- if(flag & UI_SELECT) BIF_ThemeColorShade(colorid, -60);
- else BIF_ThemeColorShade(colorid, -30);
- ui_default_num_arrows(x1, y1, x2, y2);
- break;
-
- case ICONROW:
- case ICONTEXTROW:
- if(flag & UI_ACTIVE) BIF_ThemeColorShade(colorid, 0);
- else BIF_ThemeColorShade(colorid, -10);
- glRectf(x2-9, y1+asp, x2-asp, y2-asp);
-
- BIF_ThemeColorShade(colorid, -50);
- ui_default_iconrow_arrows(x1, y1, x2, y2);
- break;
-
- case MENU:
- case BLOCK:
- if(flag & UI_ACTIVE) BIF_ThemeColorShade(colorid, 0);
- else BIF_ThemeColorShade(colorid, -10);
- glRectf(x2-17, y1+asp, x2-asp, y2-asp);
-
- BIF_ThemeColorShade(colorid, -50);
- ui_default_menu_arrows(x1, y1, x2, y2);
- break;
- }
-
-
-}
-
-
-/* fac is the slider handle position between x1 and x2 */
-static void ui_draw_slider(int colorid, float fac, float aspect, float x1, float y1, float x2, float y2, int flag)
-{
- float ymid, yc;
-
- /* the slider background line */
- ymid= (y1+y2)/2.0;
- yc= 1.7*aspect;
-
- if(flag & UI_ACTIVE)
- BIF_ThemeColorShade(colorid, -50);
- else
- BIF_ThemeColorShade(colorid, -40);
-
- /* left part */
- glRectf(x1, ymid-2.0*yc, x1+fac, ymid+2.0*yc);
- /* right part */
- glRectf(x1+fac, ymid-yc, x2, ymid+yc);
-
- /* the movable slider */
-
- BIF_ThemeColorShade(colorid, +70);
- glRectf(x1+fac-aspect, ymid-2.0*yc, x1+fac+aspect, ymid+2.0*yc);
-
-}
-
-/* ************** STANDARD MENU DRAWING FUNCTION ************* */
-
-
-static void ui_shadowbox(float minx, float miny, float maxx, float maxy, float shadsize, unsigned char alpha)
-{
- glEnable(GL_BLEND);
- glShadeModel(GL_SMOOTH);
-
- /* right quad */
- glBegin(GL_POLYGON);
- glColor4ub(0, 0, 0, alpha);
- glVertex2f(maxx, miny);
- glVertex2f(maxx, maxy-shadsize);
- glColor4ub(0, 0, 0, 0);
- glVertex2f(maxx+shadsize, maxy-shadsize-shadsize);
- glVertex2f(maxx+shadsize, miny);
- glEnd();
-
- /* corner shape */
- glBegin(GL_POLYGON);
- glColor4ub(0, 0, 0, alpha);
- glVertex2f(maxx, miny);
- glColor4ub(0, 0, 0, 0);
- glVertex2f(maxx+shadsize, miny);
- glVertex2f(maxx+0.7*shadsize, miny-0.7*shadsize);
- glVertex2f(maxx, miny-shadsize);
- glEnd();
-
- /* bottom quad */
- glBegin(GL_POLYGON);
- glColor4ub(0, 0, 0, alpha);
- glVertex2f(minx+shadsize, miny);
- glVertex2f(maxx, miny);
- glColor4ub(0, 0, 0, 0);
- glVertex2f(maxx, miny-shadsize);
- glVertex2f(minx+shadsize+shadsize, miny-shadsize);
- glEnd();
-
- glDisable(GL_BLEND);
- glShadeModel(GL_FLAT);
-}
-
-void uiDrawBoxShadow(unsigned char alpha, float minx, float miny, float maxx, float maxy)
-{
- /* accumulated outline boxes to make shade not linear, is more pleasant */
- ui_shadowbox(minx, miny, maxx, maxy, 6.0, (30*alpha)>>8);
- ui_shadowbox(minx, miny, maxx, maxy, 4.0, (70*alpha)>>8);
- ui_shadowbox(minx, miny, maxx, maxy, 2.0, (100*alpha)>>8);
-
-}
-
-// background for pulldowns, pullups, and other drawing temporal menus....
-// has to be made themable still (now only color)
-
-void uiDrawMenuBox(float minx, float miny, float maxx, float maxy, short flag)
-{
- char col[4];
- BIF_GetThemeColor4ubv(TH_MENU_BACK, col);
-
- if( (flag & UI_BLOCK_NOSHADOW)==0) {
- /* accumulated outline boxes to make shade not linear, is more pleasant */
- ui_shadowbox(minx, miny, maxx, maxy, 6.0, (30*col[3])>>8);
- ui_shadowbox(minx, miny, maxx, maxy, 4.0, (70*col[3])>>8);
- ui_shadowbox(minx, miny, maxx, maxy, 2.0, (100*col[3])>>8);
-
- glEnable(GL_BLEND);
- glColor4ubv((GLubyte *)col);
- glRectf(minx-1, miny, minx, maxy); // 1 pixel on left, to distinguish sublevel menus
- }
- glEnable(GL_BLEND);
- glColor4ubv((GLubyte *)col);
- glRectf(minx, miny, maxx, maxy);
- glDisable(GL_BLEND);
-}
-
-
-
-/* pulldown menu item */
-static void ui_draw_pulldown_item(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag)
-{
- char col[4];
-
- BIF_GetThemeColor4ubv(TH_MENU_BACK, col);
- if(col[3]!=255) {
- glEnable(GL_BLEND);
- }
-
- if((flag & UI_ACTIVE) && type!=LABEL) {
- BIF_ThemeColor4(TH_MENU_HILITE);
- glRectf(x1, y1, x2, y2);
-
-
- } else {
- BIF_ThemeColor4(colorid); // is set at TH_MENU_ITEM when pulldown opened.
- glRectf(x1, y1, x2, y2);
- }
-
- glDisable(GL_BLEND);
-}
-
-/* pulldown menu calling button */
-static void ui_draw_pulldown_round(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag)
-{
-
- if(flag & UI_ACTIVE) {
- BIF_ThemeColor(TH_MENU_HILITE);
-
- uiSetRoundBox(15);
- gl_round_box(GL_POLYGON, x1, y1+3, x2, y2-3, 7.0);
-
- glEnable( GL_LINE_SMOOTH );
- glEnable( GL_BLEND );
- gl_round_box(GL_LINE_LOOP, x1, y1+3, x2, y2-3, 7.0);
- glDisable( GL_LINE_SMOOTH );
- glDisable( GL_BLEND );
-
- } else {
- BIF_ThemeColor(colorid); // is set at TH_MENU_ITEM when pulldown opened.
- glRectf(x1-1, y1+2, x2+1, y2-2);
- }
-
-}
-
-
-/* ************** TEXT AND ICON DRAWING FUNCTIONS ************* */
-
-
-
-/* draws text and icons for buttons */
-static void ui_draw_text_icon(uiBut *but)
-{
- float x;
- int len;
- char *cpoin;
- short t, pos, ch;
- short selsta_tmp, selend_tmp, selsta_draw, selwidth_draw;
-
- /* check for button text label */
- if (but->type == ICONTEXTROW) {
- ui_draw_icon(but, (BIFIconID) (but->icon+but->iconadd), 0);
- }
- else {
-
- /* text button selection and cursor */
- if(but->pos != -1) {
-
- if ((but->selend - but->selsta) > 0) {
- /* text button selection */
- selsta_tmp = but->selsta + strlen(but->str);
- selend_tmp = but->selend + strlen(but->str);
-
- if(but->drawstr[0]!=0) {
- ch= but->drawstr[selsta_tmp];
- but->drawstr[selsta_tmp]= 0;
-
- selsta_draw = but->aspect*BIF_GetStringWidth(but->font, but->drawstr+but->ofs, (U.transopts & USER_TR_BUTTONS)) + 3;
-
- but->drawstr[selsta_tmp]= ch;
-
-
- ch= but->drawstr[selend_tmp];
- but->drawstr[selend_tmp]= 0;
-
- selwidth_draw = but->aspect*BIF_GetStringWidth(but->font, but->drawstr+but->ofs, (U.transopts & USER_TR_BUTTONS)) + 3;
-
- but->drawstr[selend_tmp]= ch;
-
- BIF_ThemeColor(TH_BUT_TEXTFIELD_HI);
- glRects(but->x1+selsta_draw+1, but->y1+2, but->x1+selwidth_draw+1, but->y2-2);
- }
- } else {
- /* text cursor */
- pos= but->pos+strlen(but->str);
- if(pos >= but->ofs) {
- if(but->drawstr[0]!=0) {
- ch= but->drawstr[pos];
- but->drawstr[pos]= 0;
-
- t= but->aspect*BIF_GetStringWidth(but->font, but->drawstr+but->ofs, (U.transopts & USER_TR_BUTTONS)) + 3;
-
- but->drawstr[pos]= ch;
- }
- else t= 3;
-
- glColor3ub(255,0,0);
- glRects(but->x1+t, but->y1+2, but->x1+t+2, but->y2-2);
- }
- }
- }
-
- if(but->type==BUT_TOGDUAL) {
- int dualset= 0;
- if(but->pointype==SHO)
- dualset= BTST( *(((short *)but->poin)+1), but->bitnr);
- else if(but->pointype==INT)
- dualset= BTST( *(((int *)but->poin)+1), but->bitnr);
-
- ui_draw_icon(but, ICON_DOT, dualset?0:-100);
- }
-
- if(but->drawstr[0]!=0) {
- int transopts;
- int tog3= 0;
-
- // cut string in 2 parts
- cpoin= strchr(but->drawstr, '|');
- if(cpoin) *cpoin= 0;
-
- /* If there's an icon too (made with uiDefIconTextBut) then draw the icon
- and offset the text label to accomodate it */
-
- if ( (but->flag & UI_HAS_ICON) && (but->flag & UI_ICON_LEFT) ) {
- ui_draw_icon(but, but->icon, 0);
-
- if(but->flag & UI_TEXT_LEFT) x= but->x1 + but->aspect*BIF_icon_get_width(but->icon)+5.0;
- else x= (but->x1+but->x2-but->strwidth+1)/2.0;
- }
- else {
- if(but->flag & UI_TEXT_LEFT) x= but->x1+4.0;
- else x= (but->x1+but->x2-but->strwidth+1)/2.0;
- }
-
- /* tog3 button exception; draws with glColor! */
- if(but->type==TOG3 && (but->flag & UI_SELECT)) {
-
- if( but->pointype==CHA ) {
- if( BTST( *(but->poin+2), but->bitnr )) tog3= 1;
- }
- else if( but->pointype ==SHO ) {
- short *sp= (short *)but->poin;
- if( BTST( sp[1], but->bitnr )) tog3= 1;
- }
-
- ui_tog3_invert(but->x1,but->y1,but->x2,but->y2, tog3);
- if (tog3) glColor3ub(255, 255, 0);
- }
-
- /* text color, with pulldown item exception */
- if(tog3); // color already set
- else if(but->dt==UI_EMBOSSP) {
- if((but->flag & (UI_SELECT|UI_ACTIVE)) && but->type!=LABEL) { // LABEL = title in pulldowns
- BIF_ThemeColor(TH_MENU_TEXT_HI);
- } else {
- BIF_ThemeColor(TH_MENU_TEXT);
- }
- }
- else {
- if(but->flag & UI_SELECT) {
- BIF_ThemeColor(TH_BUT_TEXT_HI);
- } else {
- BIF_ThemeColor(TH_BUT_TEXT);
- }
- }
-
- /* LABEL button exception */
- if(but->type==LABEL && but->min!=0.0) BIF_ThemeColor(TH_BUT_TEXT_HI);
-
- ui_rasterpos_safe(x, (but->y1+but->y2- 9.0)/2.0, but->aspect);
- if(but->type==IDPOIN) transopts= 0; // no translation, of course!
- else transopts= (U.transopts & USER_TR_BUTTONS);
-
- #ifdef INTERNATIONAL
- if (but->type == FTPREVIEW)
- FTF_DrawNewFontString (but->drawstr+but->ofs, FTF_INPUT_UTF8);
- else
- BIF_DrawString(but->font, but->drawstr+but->ofs, transopts);
- #else
- BIF_DrawString(but->font, but->drawstr+but->ofs, transopts);
- #endif
-
- /* part text right aligned */
- if(cpoin) {
- len= BIF_GetStringWidth(but->font, cpoin+1, (U.transopts & USER_TR_BUTTONS));
- ui_rasterpos_safe( but->x2 - len*but->aspect-3, (but->y1+but->y2- 9.0)/2.0, but->aspect);
- BIF_DrawString(but->font, cpoin+1, (U.transopts & USER_TR_BUTTONS));
- *cpoin= '|';
- }
- }
- /* if there's no text label, then check to see if there's an icon only and draw it */
- else if( but->flag & UI_HAS_ICON ) {
- ui_draw_icon(but, (BIFIconID) (but->icon+but->iconadd), 0);
- }
- }
-}
-
-static void ui_draw_but_COL(uiBut *but)
-{
- float *fp;
- char colr, colg, colb;
-
- if( but->pointype==FLO ) {
- fp= (float *)but->poin;
- colr= floor(255.0*fp[0]+0.5);
- colg= floor(255.0*fp[1]+0.5);
- colb= floor(255.0*fp[2]+0.5);
- }
- else {
- char *cp= (char *)but->poin;
- colr= cp[0];
- colg= cp[1];
- colb= cp[2];
- }
-
- /* exception... hrms, but can't simply use the emboss callback for this now. */
- /* this button type needs review, and nice integration with rest of API here */
- if(but->embossfunc == ui_draw_round) {
- char *cp= BIF_ThemeGetColorPtr(U.themes.first, 0, TH_CUSTOM);
- cp[0]= colr; cp[1]= colg; cp[2]= colb;
- but->flag &= ~UI_SELECT;
- but->embossfunc(but->type, TH_CUSTOM, but->aspect, but->x1, but->y1, but->x2, but->y2, but->flag);
- }
- else {
-
- glColor3ub(colr, colg, colb);
- glRectf((but->x1), (but->y1), (but->x2), (but->y2));
- glColor3ub(0, 0, 0);
- fdrawbox((but->x1), (but->y1), (but->x2), (but->y2));
- }
-}
-
-/* draws in resolution of 20x4 colors */
-static void ui_draw_but_HSVCUBE(uiBut *but)
-{
- int a;
- float h,s,v;
- float dx, dy, sx1, sx2, sy, x, y;
- float col0[4][3]; // left half, rect bottom to top
- float col1[4][3]; // right half, rect bottom to top
-
- h= but->hsv[0];
- s= but->hsv[1];
- v= but->hsv[2];
-
- /* draw series of gouraud rects */
- glShadeModel(GL_SMOOTH);
-
- if(but->a1==0) { // H and V vary
- hsv_to_rgb(0.0, s, 0.0, &col1[0][0], &col1[0][1], &col1[0][2]);
- hsv_to_rgb(0.0, s, 0.333, &col1[1][0], &col1[1][1], &col1[1][2]);
- hsv_to_rgb(0.0, s, 0.666, &col1[2][0], &col1[2][1], &col1[2][2]);
- hsv_to_rgb(0.0, s, 1.0, &col1[3][0], &col1[3][1], &col1[3][2]);
- x= h; y= v;
- }
- else if(but->a1==1) { // H and S vary
- hsv_to_rgb(0.0, 0.0, v, &col1[0][0], &col1[0][1], &col1[0][2]);
- hsv_to_rgb(0.0, 0.333, v, &col1[1][0], &col1[1][1], &col1[1][2]);
- hsv_to_rgb(0.0, 0.666, v, &col1[2][0], &col1[2][1], &col1[2][2]);
- hsv_to_rgb(0.0, 1.0, v, &col1[3][0], &col1[3][1], &col1[3][2]);
- x= h; y= s;
- }
- else if(but->a1==2) { // S and V vary
- hsv_to_rgb(h, 0.0, 0.0, &col1[0][0], &col1[0][1], &col1[0][2]);
- hsv_to_rgb(h, 0.333, 0.0, &col1[1][0], &col1[1][1], &col1[1][2]);
- hsv_to_rgb(h, 0.666, 0.0, &col1[2][0], &col1[2][1], &col1[2][2]);
- hsv_to_rgb(h, 1.0, 0.0, &col1[3][0], &col1[3][1], &col1[3][2]);
- x= v; y= s;
- }
- else { // only hue slider
- hsv_to_rgb(0.0, 1.0, 1.0, &col1[0][0], &col1[0][1], &col1[0][2]);
- VECCOPY(col1[1], col1[0]);
- VECCOPY(col1[2], col1[0]);
- VECCOPY(col1[3], col1[0]);
- x= h; y= 0.5;
- }
-
- for(dx=0.0; dx<1.0; dx+= 0.05) {
- // previous color
- VECCOPY(col0[0], col1[0]);
- VECCOPY(col0[1], col1[1]);
- VECCOPY(col0[2], col1[2]);
- VECCOPY(col0[3], col1[3]);
-
- // new color
- if(but->a1==0) { // H and V vary
- hsv_to_rgb(dx, s, 0.0, &col1[0][0], &col1[0][1], &col1[0][2]);
- hsv_to_rgb(dx, s, 0.333, &col1[1][0], &col1[1][1], &col1[1][2]);
- hsv_to_rgb(dx, s, 0.666, &col1[2][0], &col1[2][1], &col1[2][2]);
- hsv_to_rgb(dx, s, 1.0, &col1[3][0], &col1[3][1], &col1[3][2]);
- }
- else if(but->a1==1) { // H and S vary
- hsv_to_rgb(dx, 0.0, v, &col1[0][0], &col1[0][1], &col1[0][2]);
- hsv_to_rgb(dx, 0.333, v, &col1[1][0], &col1[1][1], &col1[1][2]);
- hsv_to_rgb(dx, 0.666, v, &col1[2][0], &col1[2][1], &col1[2][2]);
- hsv_to_rgb(dx, 1.0, v, &col1[3][0], &col1[3][1], &col1[3][2]);
- }
- else if(but->a1==2) { // S and V vary
- hsv_to_rgb(h, 0.0, dx, &col1[0][0], &col1[0][1], &col1[0][2]);
- hsv_to_rgb(h, 0.333, dx, &col1[1][0], &col1[1][1], &col1[1][2]);
- hsv_to_rgb(h, 0.666, dx, &col1[2][0], &col1[2][1], &col1[2][2]);
- hsv_to_rgb(h, 1.0, dx, &col1[3][0], &col1[3][1], &col1[3][2]);
- }
- else { // only H
- hsv_to_rgb(dx, 1.0, 1.0, &col1[0][0], &col1[0][1], &col1[0][2]);
- VECCOPY(col1[1], col1[0]);
- VECCOPY(col1[2], col1[0]);
- VECCOPY(col1[3], col1[0]);
- }
-
- // rect
- sx1= but->x1 + dx*(but->x2-but->x1);
- sx2= but->x1 + (dx+0.05)*(but->x2-but->x1);
- sy= but->y1;
- dy= (but->y2-but->y1)/3.0;
-
- glBegin(GL_QUADS);
- for(a=0; a<3; a++, sy+=dy) {
- glColor3fv(col0[a]);
- glVertex2f(sx1, sy);
-
- glColor3fv(col1[a]);
- glVertex2f(sx2, sy);
-
- glColor3fv(col1[a+1]);
- glVertex2f(sx2, sy+dy);
-
- glColor3fv(col0[a+1]);
- glVertex2f(sx1, sy+dy);
- }
- glEnd();
- }
-
- glShadeModel(GL_FLAT);
-
- /* cursor */
- x= but->x1 + x*(but->x2-but->x1);
- y= but->y1 + y*(but->y2-but->y1);
- CLAMP(x, but->x1+3.0, but->x2-3.0);
- CLAMP(y, but->y1+3.0, but->y2-3.0);
-
- fdrawXORcirc(x, y, 3.1);
-
- /* outline */
- glColor3ub(0, 0, 0);
- fdrawbox((but->x1), (but->y1), (but->x2), (but->y2));
-}
-
-#ifdef INTERNATIONAL
-static void ui_draw_but_CHARTAB(uiBut *but)
-{
- /* Some local variables */
- float sx, sy, ex, ey;
- float width, height;
- float butw, buth;
- int x, y, cs;
- wchar_t wstr[2];
- unsigned char ustr[16];
- PackedFile *pf;
- int result = 0;
- int charmax = G.charmax;
-
- /* <builtin> font in use. There are TTF <builtin> and non-TTF <builtin> fonts */
- if(!strcmp(G.selfont->name, "<builtin>"))
- {
- if(G.ui_international == TRUE)
- {
- charmax = 0xff;
- }
- else
- {
- charmax = 0xff;
- }
- }
-
- /* Category list exited without selecting the area */
- if(G.charmax == 0)
- charmax = G.charmax = 0xffff;
-
- /* Calculate the size of the button */
- width = abs(but->x2 - but->x1);
- height = abs(but->y2 - but->y1);
-
- butw = floor(width / 12);
- buth = floor(height / 6);
-
- /* Initialize variables */
- sx = but->x1;
- ex = but->x1 + butw;
- sy = but->y1 + height - buth;
- ey = but->y1 + height;
-
- cs = G.charstart;
-
- /* Set the font, in case it is not <builtin> font */
- if(G.selfont && strcmp(G.selfont->name, "<builtin>"))
- {
- char tmpStr[256];
-
- // Is the font file packed, if so then use the packed file
- if(G.selfont->packedfile)
- {
- pf = G.selfont->packedfile;
- FTF_SetFont(pf->data, pf->size, 14.0);
- }
- else
- {
- int err;
-
- strcpy(tmpStr, G.selfont->name);
- BLI_convertstringcode(tmpStr, G.sce, 0);
- err = FTF_SetFont((unsigned char *)tmpStr, 0, 14.0);
- }
- }
- else
- {
- if(G.ui_international == TRUE)
- {
- FTF_SetFont((unsigned char *) datatoc_bfont_ttf, datatoc_bfont_ttf_size, 14.0);
- }
- }
-
- /* Start drawing the button itself */
- glShadeModel(GL_SMOOTH);
-
- glColor3ub(200, 200, 200);
- glRectf((but->x1), (but->y1), (but->x2), (but->y2));
-
- glColor3ub(0, 0, 0);
- for(y = 0; y < 6; y++)
- {
- // Do not draw more than the category allows
- if(cs > charmax) break;
-
- for(x = 0; x < 12; x++)
- {
- // Do not draw more than the category allows
- if(cs > charmax) break;
-
- // Draw one grid cell
- glBegin(GL_LINE_LOOP);
- glVertex2f(sx, sy);
- glVertex2f(ex, sy);
- glVertex2f(ex, ey);
- glVertex2f(sx, ey);
- glEnd();
-
- // Draw character inside the cell
- memset(wstr, 0, sizeof(wchar_t)*2);
- memset(ustr, 0, 16);
-
- // Set the font to be either unicode or <builtin>
- wstr[0] = cs;
- if(strcmp(G.selfont->name, "<builtin>"))
- {
- wcs2utf8s((char *)ustr, (wchar_t *)wstr);
- }
- else
- {
- if(G.ui_international == TRUE)
- {
- wcs2utf8s((char *)ustr, (wchar_t *)wstr);
- }
- else
- {
- ustr[0] = cs;
- ustr[1] = 0;
- }
- }
-
- if((G.selfont && strcmp(G.selfont->name, "<builtin>")) || (G.selfont && !strcmp(G.selfont->name, "<builtin>") && G.ui_international == TRUE))
- {
- float wid;
- float llx, lly, llz, urx, ury, urz;
- float dx, dy;
- float px, py;
-
- // Calculate the position
- wid = FTF_GetStringWidth((char *) ustr, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
- FTF_GetBoundingBox((char *) ustr, &llx,&lly,&llz,&urx,&ury,&urz, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
- dx = urx-llx;
- dy = ury-lly;
-
- // This isn't fully functional since the but->aspect isn't working like I suspected
- px = sx + ((butw/but->aspect)-dx)/2;
- py = sy + ((buth/but->aspect)-dy)/2;
-
- // Set the position and draw the character
- ui_rasterpos_safe(px, py, but->aspect);
- FTF_DrawString((char *) ustr, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
- }
- else
- {
- ui_rasterpos_safe(sx + butw/2, sy + buth/2, but->aspect);
- BIF_DrawString(but->font, (char *) ustr, 0);
- }
-
- // Calculate the next position and character
- sx += butw; ex +=butw;
- cs++;
- }
- /* Add the y position and reset x position */
- sy -= buth;
- ey -= buth;
- sx = but->x1;
- ex = but->x1 + butw;
- }
- glShadeModel(GL_FLAT);
-
- /* Return Font Settings to original */
- if(U.fontsize && U.fontname[0])
- {
- result = FTF_SetFont((unsigned char *)U.fontname, 0, U.fontsize);
- }
- else if (U.fontsize)
- {
- result = FTF_SetFont((unsigned char *) datatoc_bfont_ttf, datatoc_bfont_ttf_size, U.fontsize);
- }
-
- if (result == 0)
- {
- result = FTF_SetFont((unsigned char *) datatoc_bfont_ttf, datatoc_bfont_ttf_size, 11);
- }
-
- /* resets the font size */
- if(G.ui_international == TRUE)
- {
- uiSetCurFont(but->block, UI_HELV);
- }
-}
-
-#endif // INTERNATIONAL
-
-static void ui_draw_but_COLORBAND(uiBut *but)
-{
- ColorBand *coba= (ColorBand *)but->poin;
- CBData *cbd;
- float x1, y1, sizex, sizey;
- float dx, v3[2], v1[2], v2[2];
- int a;
-
- if(coba==NULL) return;
-
- x1= but->x1;
- y1= but->y1;
- sizex= but->x2-x1;
- sizey= but->y2-y1;
-
- /* first background, to show tranparency */
- dx= sizex/12.0;
- v1[0]= x1;
- for(a=0; a<12; a++) {
- if(a & 1) glColor3f(0.3, 0.3, 0.3); else glColor3f(0.8, 0.8, 0.8);
- glRectf(v1[0], y1, v1[0]+dx, y1+0.5*sizey);
- if(a & 1) glColor3f(0.8, 0.8, 0.8); else glColor3f(0.3, 0.3, 0.3);
- glRectf(v1[0], y1+0.5*sizey, v1[0]+dx, y1+sizey);
- v1[0]+= dx;
- }
-
- glShadeModel(GL_SMOOTH);
- glEnable(GL_BLEND);
-
- cbd= coba->data;
-
- v1[0]= v2[0]= x1;
- v1[1]= y1;
- v2[1]= y1+sizey;
-
- glBegin(GL_QUAD_STRIP);
-
- glColor4fv( &cbd->r );
- glVertex2fv(v1); glVertex2fv(v2);
-
- for(a=0; a<coba->tot; a++, cbd++) {
-
- v1[0]=v2[0]= x1+ cbd->pos*sizex;
-
- glColor4fv( &cbd->r );
- glVertex2fv(v1); glVertex2fv(v2);
- }
-
- v1[0]=v2[0]= x1+ sizex;
- glVertex2fv(v1); glVertex2fv(v2);
-
- glEnd();
- glShadeModel(GL_FLAT);
- glDisable(GL_BLEND);
-
- /* outline */
- v1[0]= x1; v1[1]= y1;
-
- cpack(0x0);
- glBegin(GL_LINE_LOOP);
- glVertex2fv(v1);
- v1[0]+= sizex;
- glVertex2fv(v1);
- v1[1]+= sizey;
- glVertex2fv(v1);
- v1[0]-= sizex;
- glVertex2fv(v1);
- glEnd();
-
-
- /* help lines */
- v1[0]= v2[0]=v3[0]= x1;
- v1[1]= y1;
- v2[1]= y1+0.5*sizey;
- v3[1]= y1+sizey;
-
- cbd= coba->data;
- glBegin(GL_LINES);
- for(a=0; a<coba->tot; a++, cbd++) {
- v1[0]=v2[0]=v3[0]= x1+ cbd->pos*sizex;
-
- glColor3ub(0, 0, 0);
- glVertex2fv(v1);
- glVertex2fv(v2);
-
- if(a==coba->cur) {
- glVertex2f(v1[0]-1, v1[1]);
- glVertex2f(v2[0]-1, v2[1]);
- glVertex2f(v1[0]+1, v1[1]);
- glVertex2f(v2[0]+1, v2[1]);
- }
-
- glColor3ub(255, 255, 255);
- glVertex2fv(v2);
- glVertex2fv(v3);
-
- if(a==coba->cur) {
- if(cbd->pos>0.01) {
- glVertex2f(v2[0]-1, v2[1]);
- glVertex2f(v3[0]-1, v3[1]);
- }
- if(cbd->pos<0.99) {
- glVertex2f(v2[0]+1, v2[1]);
- glVertex2f(v3[0]+1, v3[1]);
- }
- }
- }
- glEnd();
-}
-
-static void ui_draw_but_NORMAL(uiBut *but)
-{
- static GLuint displist=0;
- int a, old[8];
- GLfloat diff[4], diffn[4]={1.0f, 1.0f, 1.0f, 1.0f};
- float vec0[4]={0.0f, 0.0f, 0.0f, 0.0f};
- float dir[4], size;
-
- /* store stuff */
- glGetMaterialfv(GL_FRONT, GL_DIFFUSE, diff);
-
- /* backdrop */
- BIF_ThemeColor(TH_BUT_NEUTRAL);
- uiSetRoundBox(15);
- gl_round_box(GL_POLYGON, but->x1, but->y1, but->x2, but->y2, 5.0f);
-
- /* sphere color */
- glMaterialfv(GL_FRONT, GL_DIFFUSE, diffn);
- glCullFace(GL_BACK); glEnable(GL_CULL_FACE);
-
- /* disable blender light */
- for(a=0; a<8; a++) {
- old[a]= glIsEnabled(GL_LIGHT0+a);
- glDisable(GL_LIGHT0+a);
- }
-
- /* own light */
- glEnable(GL_LIGHT7);
- glEnable(GL_LIGHTING);
-
- VECCOPY(dir, (float *)but->poin);
- dir[3]= 0.0f; /* glLight needs 4 args, 0.0 is sun */
- glLightfv(GL_LIGHT7, GL_POSITION, dir);
- glLightfv(GL_LIGHT7, GL_DIFFUSE, diffn);
- glLightfv(GL_LIGHT7, GL_SPECULAR, vec0);
- glLightf(GL_LIGHT7, GL_CONSTANT_ATTENUATION, 1.0f);
- glLightf(GL_LIGHT7, GL_LINEAR_ATTENUATION, 0.0f);
-
- /* transform to button */
- glPushMatrix();
- glTranslatef(but->x1 + 0.5f*(but->x2-but->x1), but->y1+ 0.5f*(but->y2-but->y1), 0.0f);
- size= (but->x2-but->x1)/200.f;
- glScalef(size, size, size);
-
- if(displist==0) {
- GLUquadricObj *qobj;
-
- displist= glGenLists(1);
- glNewList(displist, GL_COMPILE_AND_EXECUTE);
-
- qobj= gluNewQuadric();
- gluQuadricDrawStyle(qobj, GLU_FILL);
- glShadeModel(GL_SMOOTH);
- gluSphere( qobj, 100.0, 32, 24);
- glShadeModel(GL_FLAT);
- gluDeleteQuadric(qobj);
-
- glEndList();
- }
- else glCallList(displist);
-
- /* restore */
- glPopMatrix();
- glDisable(GL_LIGHTING);
- glDisable(GL_CULL_FACE);
- glMaterialfv(GL_FRONT, GL_DIFFUSE, diff);
-
- glDisable(GL_LIGHT7);
-
- /* enable blender light */
- for(a=0; a<8; a++) {
- if(old[a])
- glEnable(GL_LIGHT0+a);
- }
-}
-
-static void ui_draw_but_curve_grid(uiBut *but, float zoomx, float zoomy, float offsx, float offsy, float step)
-{
- float dx, dy, fx, fy;
-
- glBegin(GL_LINES);
- dx= step*zoomx;
- fx= but->x1 + zoomx*(-offsx);
- if(fx > but->x1) fx -= dx*( floor(fx-but->x1));
- while(fx < but->x2) {
- glVertex2f(fx, but->y1);
- glVertex2f(fx, but->y2);
- fx+= dx;
- }
-
- dy= step*zoomy;
- fy= but->y1 + zoomy*(-offsy);
- if(fy > but->y1) fy -= dy*( floor(fy-but->y1));
- while(fy < but->y2) {
- glVertex2f(but->x1, fy);
- glVertex2f(but->x2, fy);
- fy+= dy;
- }
- glEnd();
-
-}
-
-static void ui_draw_but_CURVE(uiBut *but)
-{
- CurveMapping *cumap= (CurveMapping *)but->poin;
- CurveMap *cuma= cumap->cm+cumap->cur;
- CurveMapPoint *cmp;
- float fx, fy, dx, dy, fac[2], zoomx, zoomy, offsx, offsy;
- GLint scissor[4];
- int a;
-
- /* need scissor test, curve can draw outside of boundary */
- glGetIntegerv(GL_VIEWPORT, scissor);
- fx= but->x1; fy= but->y1;
- ui_graphics_to_window(but->win, &fx, &fy);
- dx= but->x2; dy= but->y2;
- ui_graphics_to_window(but->win, &dx, &dy);
- glScissor((int)floor(fx), (int)floor(fy), (int)ceil(dx-fx), (int)ceil(dy-fy));
-
- /* calculate offset and zoom */
- zoomx= (but->x2-but->x1-2.0*but->aspect)/(cumap->curr.xmax - cumap->curr.xmin);
- zoomy= (but->y2-but->y1-2.0*but->aspect)/(cumap->curr.ymax - cumap->curr.ymin);
- offsx= cumap->curr.xmin-but->aspect/zoomx;
- offsy= cumap->curr.ymin-but->aspect/zoomy;
-
- /* backdrop */
- if(cumap->flag & CUMA_DO_CLIP) {
- BIF_ThemeColorShade(TH_BUT_NEUTRAL, -20);
- glRectf(but->x1, but->y1, but->x2, but->y2);
- BIF_ThemeColor(TH_BUT_NEUTRAL);
- glRectf(but->x1 + zoomx*(cumap->clipr.xmin-offsx),
- but->y1 + zoomy*(cumap->clipr.ymin-offsy),
- but->x1 + zoomx*(cumap->clipr.xmax-offsx),
- but->y1 + zoomy*(cumap->clipr.ymax-offsy));
- }
- else {
- BIF_ThemeColor(TH_BUT_NEUTRAL);
- glRectf(but->x1, but->y1, but->x2, but->y2);
- }
-
- /* grid, every .25 step */
- BIF_ThemeColorShade(TH_BUT_NEUTRAL, -16);
- ui_draw_but_curve_grid(but, zoomx, zoomy, offsx, offsy, 0.25f);
- /* grid, every 1.0 step */
- BIF_ThemeColorShade(TH_BUT_NEUTRAL, -24);
- ui_draw_but_curve_grid(but, zoomx, zoomy, offsx, offsy, 1.0f);
- /* axes */
- BIF_ThemeColorShade(TH_BUT_NEUTRAL, -50);
- glBegin(GL_LINES);
- glVertex2f(but->x1, but->y1 + zoomy*(-offsy));
- glVertex2f(but->x2, but->y1 + zoomy*(-offsy));
- glVertex2f(but->x1 + zoomx*(-offsx), but->y1);
- glVertex2f(but->x1 + zoomx*(-offsx), but->y2);
- glEnd();
-
- /* cfra option */
- if(cumap->flag & CUMA_DRAW_CFRA) {
- glColor3ub(0x60, 0xc0, 0x40);
- glBegin(GL_LINES);
- glVertex2f(but->x1 + zoomx*(cumap->black[0]-offsx), but->y1);
- glVertex2f(but->x1 + zoomx*(cumap->black[0]-offsx), but->y2);
- glEnd();
- }
-
- /* the curve */
- BIF_ThemeColorBlend(TH_TEXT, TH_BUT_NEUTRAL, 0.35);
- glEnable(GL_LINE_SMOOTH);
- glEnable(GL_BLEND);
- glBegin(GL_LINE_STRIP);
-
- if(cuma->table==NULL)
- curvemapping_changed(cumap, 0); /* 0 = no remove doubles */
- cmp= cuma->table;
-
- /* first point */
- if((cuma->flag & CUMA_EXTEND_EXTRAPOLATE)==0)
- glVertex2f(but->x1, but->y1 + zoomy*(cmp[0].y-offsy));
- else {
- fx= but->x1 + zoomx*(cmp[0].x-offsx + cuma->ext_in[0]);
- fy= but->y1 + zoomy*(cmp[0].y-offsy + cuma->ext_in[1]);
- glVertex2f(fx, fy);
- }
- for(a=0; a<=CM_TABLE; a++) {
- fx= but->x1 + zoomx*(cmp[a].x-offsx);
- fy= but->y1 + zoomy*(cmp[a].y-offsy);
- glVertex2f(fx, fy);
- }
- /* last point */
- if((cuma->flag & CUMA_EXTEND_EXTRAPOLATE)==0)
- glVertex2f(but->x2, but->y1 + zoomy*(cmp[CM_TABLE].y-offsy));
- else {
- fx= but->x1 + zoomx*(cmp[CM_TABLE].x-offsx - cuma->ext_out[0]);
- fy= but->y1 + zoomy*(cmp[CM_TABLE].y-offsy - cuma->ext_out[1]);
- glVertex2f(fx, fy);
- }
- glEnd();
- glDisable(GL_LINE_SMOOTH);
- glDisable(GL_BLEND);
-
- /* the points, use aspect to make them visible on edges */
- cmp= cuma->curve;
- glPointSize(3.0f);
- bglBegin(GL_POINTS);
- for(a=0; a<cuma->totpoint; a++) {
- if(cmp[a].flag & SELECT)
- BIF_ThemeColor(TH_TEXT_HI);
- else
- BIF_ThemeColor(TH_TEXT);
- fac[0]= but->x1 + zoomx*(cmp[a].x-offsx);
- fac[1]= but->y1 + zoomy*(cmp[a].y-offsy);
- bglVertex2fv(fac);
- }
- bglEnd();
- glPointSize(1.0f);
-
- /* restore scissortest */
- glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
-
- /* outline */
- BIF_ThemeColor(TH_BUT_OUTLINE);
- fdrawbox(but->x1, but->y1, but->x2, but->y2);
-
-}
-
-static void ui_draw_roundbox(uiBut *but)
-{
- glEnable(GL_BLEND);
-
- BIF_ThemeColorShadeAlpha(TH_PANEL, but->a2, but->a2);
-
- uiSetRoundBox(but->a1);
- gl_round_box(GL_POLYGON, but->x1, but->y1, but->x2, but->y2, but->min);
-
- glDisable(GL_BLEND);
-}
-
-
-/* nothing! */
-static void ui_draw_nothing(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag)
-{
-}
-
-
-/* ************** EXTERN, called from interface.c ************* */
-/* ************** MAIN CALLBACK FUNCTION ************* */
-
-void ui_set_embossfunc(uiBut *but, int drawtype)
-{
- // this aded for evaluating textcolor for example
- but->dt= drawtype;
-
- // not really part of standard minimal themes, just make sure it is set
- but->sliderfunc= ui_draw_slider;
-
- // standard builtin first:
- if(but->type==LABEL || but->type==ROUNDBOX) but->embossfunc= ui_draw_nothing;
- else if(but->type==PULLDOWN) but->embossfunc= ui_draw_pulldown_round;
- else if(drawtype==UI_EMBOSSM) but->embossfunc= ui_draw_minimal;
- else if(drawtype==UI_EMBOSSN) but->embossfunc= ui_draw_nothing;
- else if(drawtype==UI_EMBOSSP) but->embossfunc= ui_draw_pulldown_item;
- else if(drawtype==UI_EMBOSSR) but->embossfunc= ui_draw_round;
- else {
- int theme= BIF_GetThemeValue(TH_BUT_DRAWTYPE);
-
- switch(theme) {
-
- case TH_ROUNDED:
- but->embossfunc= ui_draw_round;
- break;
- case TH_OLDSKOOL:
- but->embossfunc= ui_draw_oldskool;
- break;
- case TH_MINIMAL:
- but->embossfunc= ui_draw_minimal;
- break;
- case TH_SHADED:
- default:
- but->embossfunc= ui_draw_default;
- but->sliderfunc= ui_default_slider;
- break;
- }
- }
-
- // note: if you want aligning, adapt the call uiBlockEndAlign in interface.c
-}
-
-void ui_draw_but(uiBut *but)
-{
- double value;
- float x1, x2, y1, y2, fac;
-
- if(but==NULL) return;
-
- /* signal for frontbuf flush buttons and menus, not when normal drawing */
- if(but->block->in_use) ui_block_set_flush(but->block, but);
-
- switch (but->type) {
-
- case NUMSLI:
- case HSVSLI:
-
- but->embossfunc(but->type, but->themecol, but->aspect, but->x1, but->y1, but->x2, but->y2, but->flag);
- ui_draw_text_icon(but);
-
- x1= (but->x1+but->x2)/2;
- x2= but->x2 - 5.0*but->aspect;
- y1= but->y1 + 2.0*but->aspect;
- y2= but->y2 - 2.0*but->aspect;
-
- value= ui_get_but_val(but);
- fac= (value-but->min)*(x2-x1)/(but->max - but->min);
-
- but->sliderfunc(but->themecol, fac, but->aspect, x1, y1, x2, y2, but->flag);
- break;
-
- case SEPR:
- // only background
- break;
-
- case COL:
- ui_draw_but_COL(but); // black box with color
- break;
-
- case HSVCUBE:
- ui_draw_but_HSVCUBE(but); // box for colorpicker, three types
- break;
-
-#ifdef INTERNATIONAL
- case CHARTAB:
- value= ui_get_but_val(but);
- ui_draw_but_CHARTAB(but);
- break;
-#endif
-
- case LINK:
- case INLINK:
- ui_draw_icon(but, but->icon, 0);
- break;
-
- case ROUNDBOX:
- ui_draw_roundbox(but);
- break;
-
- case BUT_COLORBAND:
- ui_draw_but_COLORBAND(but);
- break;
- case BUT_NORMAL:
- ui_draw_but_NORMAL(but);
- break;
- case BUT_CURVE:
- ui_draw_but_CURVE(but);
- break;
-
- default:
- but->embossfunc(but->type, but->themecol, but->aspect, but->x1, but->y1, but->x2, but->y2, but->flag);
- ui_draw_text_icon(but);
-
- }
-}
-
-void ui_dropshadow(rctf *rct, float radius, float aspect, int select)
-{
- float rad;
- float a;
- char alpha= 2;
-
- glEnable(GL_BLEND);
-
- if(radius > (rct->ymax-rct->ymin-10.0f)/2.0f)
- rad= (rct->ymax-rct->ymin-10.0f)/2.0f;
- else
- rad= radius;
-
- if(select) a= 12.0f*aspect; else a= 12.0f*aspect;
- for(; a>0.0f; a-=aspect) {
- /* alpha ranges from 2 to 20 or so */
- glColor4ub(0, 0, 0, alpha);
- alpha+= 2;
-
- gl_round_box(GL_POLYGON, rct->xmin - a, rct->ymin - a, rct->xmax + a, rct->ymax-10.0f + a, rad+a);
- }
-
- /* outline emphasis */
- glEnable( GL_LINE_SMOOTH );
- glColor4ub(0, 0, 0, 100);
- gl_round_box(GL_LINE_LOOP, rct->xmin-0.5f, rct->ymin-0.5f, rct->xmax+0.5f, rct->ymax+0.5f, radius);
- glDisable( GL_LINE_SMOOTH );
-
- glDisable(GL_BLEND);
-}
diff --git a/source/blender/src/interface_icons.c b/source/blender/src/interface_icons.c
deleted file mode 100644
index d93834d8d8a..00000000000
--- a/source/blender/src/interface_icons.c
+++ /dev/null
@@ -1,1074 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifndef WIN32
-#include <unistd.h>
-#else
-#include <io.h>
-#include <direct.h>
-#endif
-#include "MEM_guardedalloc.h"
-
-#include "BLI_arithb.h"
-#include "BLI_blenlib.h"
-#include "BLI_storage_types.h"
-
-#include "DNA_material_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_world_types.h"
-#include "DNA_object_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_image_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_world_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_image_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_userdef_types.h"
-
-#include "BKE_global.h"
-#include "BKE_material.h"
-#include "BKE_texture.h"
-#include "BKE_world.h"
-#include "BKE_image.h"
-#include "BKE_object.h"
-#include "BKE_utildefines.h"
-#include "BKE_icons.h"
-#include "BKE_packedFile.h"
-
-#include "IMB_imbuf.h"
-#include "IMB_imbuf_types.h"
-
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-#include "BIF_interface.h"
-#include "BIF_interface_icons.h"
-#include "BIF_previewrender.h"
-#include "BIF_screen.h"
-#include "BIF_resources.h" /* elubie: should be removed once the enum for the ICONS is in BIF_preview_icons.h */
-
-#include "interface.h"
-
-#include "PIL_time.h"
-
-#include "blendef.h" // CLAMP
-#include "datatoc.h"
-#include "mydevice.h"
-
-#define ICON_IMAGE_W 512
-#define ICON_IMAGE_H 256
-
-#define ICON_GRID_COLS 25
-#define ICON_GRID_ROWS 12
-
-#define ICON_GRID_MARGIN 5
-#define ICON_GRID_W 15
-#define ICON_GRID_H 16
-
-typedef struct IconImage {
- int w;
- int h;
- unsigned int *rect;
-} IconImage;
-
-typedef struct DrawInfo {
- int w;
- int h;
- float aspect;
- VectorDrawFunc drawFunc; /* If drawFunc is defined then it is a vector icon, otherwise use rect */
- IconImage* icon;
-} DrawInfo;
-
-/* ******************* STATIC LOCAL VARS ******************* */
-/* static here to cache results of icon directory scan, so it's not
- * scanning the filesystem each time the menu is drawn */
-static struct ListBase iconfilelist = {0, 0};
-
-
-static int preview_render_size(int miplevel);
-
-/* **************************************************** */
-
-static void def_internal_icon(ImBuf *bbuf, int icon_id, int xofs, int yofs)
-{
- Icon *new_icon = NULL;
- IconImage *iimg = NULL;
- DrawInfo *di;
- int y = 0;
-
- new_icon = MEM_callocN(sizeof(Icon), "texicon");
-
- new_icon->obj = 0; /* icon is not for library object */
- new_icon->type = 0;
-
- di = MEM_callocN(sizeof(DrawInfo), "drawinfo");
- di->drawFunc = 0;
- di->w = ICON_DEFAULT_HEIGHT;
- di->h = ICON_DEFAULT_HEIGHT;
- di->aspect = 1.0f;
-
- iimg = MEM_mallocN(sizeof(IconImage), "icon_img");
- iimg->rect = MEM_mallocN(ICON_DEFAULT_HEIGHT*ICON_DEFAULT_HEIGHT*sizeof(unsigned int), "icon_rect");
- iimg->w = ICON_DEFAULT_HEIGHT;
- iimg->h = ICON_DEFAULT_HEIGHT;
-
- /* Here we store the rect in the icon - same as before */
- for (y=0; y<ICON_DEFAULT_HEIGHT; y++) {
- memcpy(&iimg->rect[y*ICON_DEFAULT_HEIGHT], &bbuf->rect[(y+yofs)*512+xofs], ICON_DEFAULT_HEIGHT*sizeof(int));
- }
-
- di->icon = iimg;
-
- new_icon->drawinfo_free = BIF_icons_free_drawinfo;
- new_icon->drawinfo = di;
-
- BKE_icon_set(icon_id, new_icon);
-}
-
-static void def_internal_vicon( int icon_id, VectorDrawFunc drawFunc)
-{
- Icon *new_icon = NULL;
- DrawInfo* di;
-
- new_icon = MEM_callocN(sizeof(Icon), "texicon");
-
- new_icon->obj = 0; /* icon is not for library object */
- new_icon->type = 0;
-
- di = MEM_callocN(sizeof(DrawInfo), "drawinfo");
- di->drawFunc =drawFunc;
- di->w = ICON_DEFAULT_HEIGHT;
- di->h = ICON_DEFAULT_HEIGHT;
- di->aspect = 1.0f;
- di->icon = NULL;
-
- new_icon->drawinfo_free = 0;
- new_icon->drawinfo = di;
-
- BKE_icon_set(icon_id, new_icon);
-}
-
-/* Vector Icon Drawing Routines */
-
- /* Utilities */
-
-static void viconutil_set_point(GLint pt[2], int x, int y)
-{
- pt[0] = x;
- pt[1] = y;
-}
-
-static void viconutil_draw_tri(GLint (*pts)[2])
-{
- glBegin(GL_TRIANGLES);
- glVertex2iv(pts[0]);
- glVertex2iv(pts[1]);
- glVertex2iv(pts[2]);
- glEnd();
-}
-
-#if 0
-static void viconutil_draw_quad(GLint (*pts)[2])
-{
- glBegin(GL_QUADS);
- glVertex2iv(pts[0]);
- glVertex2iv(pts[1]);
- glVertex2iv(pts[2]);
- glVertex2iv(pts[3]);
- glEnd();
-}
-#endif
-
-static void viconutil_draw_lineloop(GLint (*pts)[2], int numPoints)
-{
- int i;
-
- glBegin(GL_LINE_LOOP);
- for (i=0; i<numPoints; i++) {
- glVertex2iv(pts[i]);
- }
- glEnd();
-}
-
-static void viconutil_draw_lineloop_smooth(GLint (*pts)[2], int numPoints)
-{
- glEnable(GL_LINE_SMOOTH);
- viconutil_draw_lineloop(pts, numPoints);
- glDisable(GL_LINE_SMOOTH);
-}
-
-static void viconutil_draw_points(GLint (*pts)[2], int numPoints, int pointSize)
-{
- int i;
-
- glBegin(GL_QUADS);
- for (i=0; i<numPoints; i++) {
- int x = pts[i][0], y = pts[i][1];
-
- glVertex2i(x-pointSize,y-pointSize);
- glVertex2i(x+pointSize,y-pointSize);
- glVertex2i(x+pointSize,y+pointSize);
- glVertex2i(x-pointSize,y+pointSize);
- }
- glEnd();
-}
-
- /* Drawing functions */
-
-static void vicon_x_draw(int x, int y, int w, int h, float alpha)
-{
- x += 3;
- y += 3;
- w -= 6;
- h -= 6;
-
- glEnable( GL_LINE_SMOOTH );
-
- glLineWidth(2.5);
-
- glColor4f(0.0, 0.0, 0.0, alpha);
- glBegin(GL_LINES);
- glVertex2i(x ,y );
- glVertex2i(x+w,y+h);
- glVertex2i(x+w,y );
- glVertex2i(x ,y+h);
- glEnd();
-
- glLineWidth(1.0);
-
- glDisable( GL_LINE_SMOOTH );
-}
-
-static void vicon_view3d_draw(int x, int y, int w, int h, float alpha)
-{
- int cx = x + w/2;
- int cy = y + h/2;
- int d = MAX2(2, h/3);
-
- glColor4f(0.5, 0.5, 0.5, alpha);
- glBegin(GL_LINES);
- glVertex2i(x , cy-d);
- glVertex2i(x+w, cy-d);
- glVertex2i(x , cy+d);
- glVertex2i(x+w, cy+d);
-
- glVertex2i(cx-d, y );
- glVertex2i(cx-d, y+h);
- glVertex2i(cx+d, y );
- glVertex2i(cx+d, y+h);
- glEnd();
-
- glColor4f(0.0, 0.0, 0.0, alpha);
- glBegin(GL_LINES);
- glVertex2i(x , cy);
- glVertex2i(x+w, cy);
- glVertex2i(cx, y );
- glVertex2i(cx, y+h);
- glEnd();
-}
-
-static void vicon_edit_draw(int x, int y, int w, int h, float alpha)
-{
- GLint pts[4][2];
-
- viconutil_set_point(pts[0], x+3 , y+3 );
- viconutil_set_point(pts[1], x+w-3, y+3 );
- viconutil_set_point(pts[2], x+w-3, y+h-3);
- viconutil_set_point(pts[3], x+3 , y+h-3);
-
- glColor4f(0.0, 0.0, 0.0, alpha);
- viconutil_draw_lineloop(pts, 4);
-
- glColor3f(1, 1, 0.0);
- viconutil_draw_points(pts, 4, 1);
-}
-
-static void vicon_editmode_hlt_draw(int x, int y, int w, int h, float alpha)
-{
- GLint pts[3][2];
-
- viconutil_set_point(pts[0], x+w/2, y+h-2);
- viconutil_set_point(pts[1], x+3, y+4);
- viconutil_set_point(pts[2], x+w-3, y+4);
-
- glColor4f(0.5, 0.5, 0.5, alpha);
- viconutil_draw_tri(pts);
-
- glColor4f(0.0, 0.0, 0.0, 1);
- viconutil_draw_lineloop_smooth(pts, 3);
-
- glColor3f(1, 1, 0.0);
- viconutil_draw_points(pts, 3, 1);
-}
-
-static void vicon_editmode_dehlt_draw(int x, int y, int w, int h, float alpha)
-{
- GLint pts[3][2];
-
- viconutil_set_point(pts[0], x+w/2, y+h-2);
- viconutil_set_point(pts[1], x+3, y+4);
- viconutil_set_point(pts[2], x+w-3, y+4);
-
- glColor4f(0.0, 0.0, 0.0, 1);
- viconutil_draw_lineloop_smooth(pts, 3);
-
- glColor3f(.9, .9, .9);
- viconutil_draw_points(pts, 3, 1);
-}
-
-static void vicon_disclosure_tri_right_draw(int x, int y, int w, int h, float alpha)
-{
- GLint pts[3][2];
- int cx = x+w/2;
- int cy = y+w/2;
- int d = w/3, d2 = w/5;
-
- viconutil_set_point(pts[0], cx-d2, cy+d);
- viconutil_set_point(pts[1], cx-d2, cy-d);
- viconutil_set_point(pts[2], cx+d2, cy);
-
- glShadeModel(GL_SMOOTH);
- glBegin(GL_TRIANGLES);
- glColor4f(0.8, 0.8, 0.8, alpha);
- glVertex2iv(pts[0]);
- glVertex2iv(pts[1]);
- glColor4f(0.3, 0.3, 0.3, alpha);
- glVertex2iv(pts[2]);
- glEnd();
- glShadeModel(GL_FLAT);
-
- glColor4f(0.0, 0.0, 0.0, 1);
- viconutil_draw_lineloop_smooth(pts, 3);
-}
-
-static void vicon_disclosure_tri_down_draw(int x, int y, int w, int h, float alpha)
-{
- GLint pts[3][2];
- int cx = x+w/2;
- int cy = y+w/2;
- int d = w/3, d2 = w/5;
-
- viconutil_set_point(pts[0], cx+d, cy+d2);
- viconutil_set_point(pts[1], cx-d, cy+d2);
- viconutil_set_point(pts[2], cx, cy-d2);
-
- glShadeModel(GL_SMOOTH);
- glBegin(GL_TRIANGLES);
- glColor4f(0.8, 0.8, 0.8, alpha);
- glVertex2iv(pts[0]);
- glVertex2iv(pts[1]);
- glColor4f(0.3, 0.3, 0.3, alpha);
- glVertex2iv(pts[2]);
- glEnd();
- glShadeModel(GL_FLAT);
-
- glColor4f(0.0, 0.0, 0.0, 1);
- viconutil_draw_lineloop_smooth(pts, 3);
-}
-
-static void vicon_move_up_draw(int x, int y, int w, int h, float alpha)
-{
- int d=-2;
-
- glEnable(GL_LINE_SMOOTH);
- glLineWidth(1);
- glColor3f(0.0, 0.0, 0.0);
-
- glBegin(GL_LINE_STRIP);
- glVertex2i(x+w/2-d*2, y+h/2+d);
- glVertex2i(x+w/2, y+h/2-d + 1);
- glVertex2i(x+w/2+d*2, y+h/2+d);
- glEnd();
-
- glLineWidth(1.0);
- glDisable(GL_LINE_SMOOTH);
-}
-
-static void vicon_move_down_draw(int x, int y, int w, int h, float alpha)
-{
- int d=2;
-
- glEnable(GL_LINE_SMOOTH);
- glLineWidth(1);
- glColor3f(0.0, 0.0, 0.0);
-
- glBegin(GL_LINE_STRIP);
- glVertex2i(x+w/2-d*2, y+h/2+d);
- glVertex2i(x+w/2, y+h/2-d - 1);
- glVertex2i(x+w/2+d*2, y+h/2+d);
- glEnd();
-
- glLineWidth(1.0);
- glDisable(GL_LINE_SMOOTH);
-}
-
-/***/
-
-
-/* this only works for the hardcoded buttons image, turning the grey AA pixels to alpha, and slight off-grey to half alpha */
-#if 0
-static void clear_transp_rect_soft(unsigned char *transp, unsigned char *rect, int w, int h, int rowstride)
-{
- int x, y, val;
-
- for (y=1; y<h-1; y++) {
- unsigned char *row0= &rect[(y-1)*rowstride];
- unsigned char *row= &rect[y*rowstride];
- unsigned char *row1= &rect[(y+1)*rowstride];
- for (x=1; x<w-1; x++) {
- unsigned char *pxl0= &row0[x*4];
- unsigned char *pxl= &row[x*4];
- unsigned char *pxl1= &row1[x*4];
-
- if(pxl[3]!=0) {
- val= (abs(pxl[0]-transp[0]) + abs(pxl[1]-transp[1]) + abs(pxl[2]-transp[2]))/3;
- if(val<20) {
- pxl[3]= 128;
- }
- else if(val<50) {
- // one of pixels surrounding has alpha null?
- if(pxl[3-4]==0 || pxl[3+4]==0 || pxl0[3]==0 || pxl1[3]==0) {
-
- if(pxl[0]>val) pxl[0]-= val; else pxl[0]= 0;
- if(pxl[1]>val) pxl[1]-= val; else pxl[1]= 0;
- if(pxl[2]>val) pxl[2]-= val; else pxl[2]= 0;
-
- pxl[3]= 128;
- }
- }
- }
- }
- }
-}
-#endif
-
-static void clear_icon_grid_margins(unsigned char *rect, int w, int h)
-{
- int x, y;
- int xoffs=ICON_GRID_W+ICON_GRID_MARGIN;
- int yoffs=ICON_GRID_H+ICON_GRID_MARGIN;
-
- for (y=0; y<h; y++) {
- unsigned char *row= &rect[y*w*4];
-
- for (x=0; x<w; x++) {
- unsigned char *pxl= &row[x*4];
-
- if ((x % xoffs < ICON_GRID_MARGIN-2) || (x % xoffs > ICON_GRID_W+2))
- pxl[3] = 0; //alpha channel == x+3
- else if ((y % yoffs < ICON_GRID_MARGIN-2) || (y % yoffs > ICON_GRID_H+2))
- pxl[3] = 0;
- }
- }
-}
-
-static void prepare_internal_icons(ImBuf *bbuf)
-{
-
- unsigned char *back= (unsigned char *)bbuf->rect;
-
- /* this sets the icon grid margin area outside of icon to zero alpha */
- clear_icon_grid_margins(back, bbuf->x, bbuf->y);
-
- /* hack! */
-#if 0
- for (y=0; y<12; y++) {
- for (x=0; x<21; x++) {
- unsigned char *start= ((unsigned char*) bbuf->rect) + (y*21 + 3)*rowstride + (x*20 + 3)*4;
- /* this sets backdrop of icon to zero alpha */
- transp[0]= start[0];
- transp[1]= start[1];
- transp[2]= start[2];
- transp[3]= start[3];
- clear_transp_rect(transp, start, 20, 21, rowstride);
- clear_transp_rect_soft(transp, start, 20, 21, rowstride);
-
- }
- }
-#endif
-}
-
-
-static void init_internal_icons()
-{
- bTheme *btheme= U.themes.first;
- ImBuf *bbuf;
- int x, y;
- char iconfilestr[FILE_MAXDIR+FILE_MAXFILE];
- char filenamestr[FILE_MAXFILE+16]; // 16 == strlen(".blender/icons/")+1
-
- if ((btheme!=NULL) && (strlen(btheme->tui.iconfile) > 0)) {
-
-#ifdef WIN32
- sprintf(filenamestr, "icons/%s", btheme->tui.iconfile);
-#else
- sprintf(filenamestr, ".blender/icons/%s", btheme->tui.iconfile);
-#endif
-
- BLI_make_file_string("/", iconfilestr, BLI_gethome(), filenamestr);
-
- if (BLI_exists(iconfilestr)) {
- bbuf = IMB_loadiffname(iconfilestr, IB_rect);
- } else {
- bbuf = IMB_ibImageFromMemory((int *)datatoc_blenderbuttons, datatoc_blenderbuttons_size, IB_rect);
- }
- } else {
- bbuf = IMB_ibImageFromMemory((int *)datatoc_blenderbuttons, datatoc_blenderbuttons_size, IB_rect);
- }
-
- prepare_internal_icons(bbuf);
-
- for (y=0; y<ICON_GRID_ROWS; y++) {
- for (x=0; x<ICON_GRID_COLS; x++) {
- def_internal_icon(bbuf, BIFICONID_FIRST + y*ICON_GRID_COLS + x,
- x*(ICON_GRID_W+ICON_GRID_MARGIN)+3,
- y*(ICON_GRID_H+ICON_GRID_MARGIN)+3);
- }
- }
-
- def_internal_vicon(VICON_VIEW3D, vicon_view3d_draw);
- def_internal_vicon(VICON_EDIT, vicon_edit_draw);
- def_internal_vicon(VICON_EDITMODE_DEHLT, vicon_editmode_dehlt_draw);
- def_internal_vicon(VICON_EDITMODE_HLT, vicon_editmode_hlt_draw);
- def_internal_vicon(VICON_DISCLOSURE_TRI_RIGHT, vicon_disclosure_tri_right_draw);
- def_internal_vicon(VICON_DISCLOSURE_TRI_DOWN, vicon_disclosure_tri_down_draw);
- def_internal_vicon(VICON_MOVE_UP, vicon_move_up_draw);
- def_internal_vicon(VICON_MOVE_DOWN, vicon_move_down_draw);
- def_internal_vicon(VICON_X, vicon_x_draw);
-
- IMB_freeImBuf(bbuf);
-}
-
-
-static void init_iconfile_list(struct ListBase *list)
-{
- IconFile *ifile;
- ImBuf *bbuf= NULL;
- struct direntry *dir;
- int restoredir = 1; /* restore to current directory */
- int totfile, i, index=1;
- int ifilex, ifiley;
- char icondirstr[FILE_MAX];
- char iconfilestr[FILE_MAX+16]; /* allow 256 chars for file+dir */
- char olddir[FILE_MAX];
-
- list->first = list->last = NULL;
-
-#ifdef WIN32
- BLI_make_file_string("/", icondirstr, BLI_gethome(), "icons");
-#else
- BLI_make_file_string("/", icondirstr, BLI_gethome(), ".blender/icons");
-#endif
-
- if(BLI_exists(icondirstr)==0)
- return;
-
- /* since BLI_getdir changes the current working directory, restore it
- back to old value afterwards */
- if(!BLI_getwdN(olddir))
- restoredir = 0;
- totfile = BLI_getdir(icondirstr, &dir);
- if (restoredir)
- chdir(olddir);
-
- for(i=0; i<totfile; i++) {
- if( (dir[i].type & S_IFREG) ) {
- char *filename = dir[i].relname;
-
- if(BLI_testextensie(filename, ".png")) {
-
- /* check to see if the image is the right size, continue if not */
- /* copying strings here should go ok, assuming that we never get back
- a complete path to file longer than 256 chars */
- sprintf(iconfilestr, "%s/%s", icondirstr, filename);
- if(BLI_exists(iconfilestr)) bbuf = IMB_loadiffname(iconfilestr, IB_rect);
-
- ifilex = bbuf->x;
- ifiley = bbuf->y;
- IMB_freeImBuf(bbuf);
-
- if ((ifilex != ICON_IMAGE_W) || (ifiley != ICON_IMAGE_H))
- continue;
-
- /* found a potential icon file, so make an entry for it in the cache list */
- ifile = MEM_callocN(sizeof(IconFile), "IconFile");
-
- BLI_strncpy(ifile->filename, filename, sizeof(ifile->filename));
- ifile->index = index;
-
- BLI_addtail(list, ifile);
-
- index++;
- }
- }
- }
-
- /* free temporary direntry structure that's been created by BLI_getdir() */
- i= totfile-1;
-
- for(; i>=0; i--){
- MEM_freeN(dir[i].relname);
- if (dir[i].string) MEM_freeN(dir[i].string);
- }
- free(dir);
- dir= 0;
-}
-
-static void free_iconfile_list(struct ListBase *list)
-{
- IconFile *ifile=NULL, *next_ifile=NULL;
-
- for(ifile=list->first; ifile; ifile=next_ifile) {
- next_ifile = ifile->next;
- BLI_freelinkN(list, ifile);
- }
-}
-
-int BIF_iconfile_get_index(char *filename)
-{
- IconFile *ifile;
- ListBase *list=&(iconfilelist);
-
- for(ifile=list->first; ifile; ifile=ifile->next) {
- if ( BLI_streq(filename, ifile->filename)) {
- return ifile->index;
- }
- }
-
- return 0;
-}
-
-ListBase *BIF_iconfile_list(void)
-{
- ListBase *list=&(iconfilelist);
-
- return list;
-}
-
-
-void BIF_icons_free()
-{
- free_iconfile_list(&iconfilelist);
- BKE_icons_free();
-}
-
-void BIF_icons_free_drawinfo(void *drawinfo)
-{
- DrawInfo *di = drawinfo;
-
- if (di)
- {
- if (di->icon) {
- MEM_freeN(di->icon->rect);
- MEM_freeN(di->icon);
- }
- MEM_freeN(di);
- }
-}
-
-static DrawInfo *icon_create_drawinfo()
-{
- DrawInfo *di = NULL;
-
- di = MEM_callocN(sizeof(DrawInfo), "di_icon");
-
- di->drawFunc = 0;
- di->w = ICON_DEFAULT_HEIGHT;
- di->h = ICON_DEFAULT_HEIGHT;
- di->icon = NULL;
- di->aspect = 1.0f;
-
- return di;
-}
-
-int BIF_icon_get_width(int icon_id)
-{
- Icon *icon = NULL;
- DrawInfo *di = NULL;
-
- icon = BKE_icon_get(icon_id);
-
- if (!icon) {
- printf("BIF_icon_get_width: Internal error, no icon for icon ID: %d\n", icon_id);
- return 0;
- }
-
- di = (DrawInfo *)icon->drawinfo;
- if (!di) {
- di = icon_create_drawinfo();
- icon->drawinfo = di;
- }
-
- if (di)
- return di->w;
-
- return 0;
-}
-
-int BIF_icon_get_height(int icon_id)
-{
- Icon *icon = NULL;
- DrawInfo *di = NULL;
-
- icon = BKE_icon_get(icon_id);
-
- if (!icon) {
- printf("BIF_icon_get_width: Internal error, no icon for icon ID: %d\n", icon_id);
- return 0;
- }
-
- di = (DrawInfo*)icon->drawinfo;
-
- if (!di) {
- di = icon_create_drawinfo();
- icon->drawinfo = di;
- }
-
- if (di)
- return di->h;
-
- return 0;
-}
-
-void BIF_icons_init(int first_dyn_id)
-{
- init_iconfile_list(&iconfilelist);
- BKE_icons_init(first_dyn_id);
- init_internal_icons();
-}
-
-static void icon_copy_rect(ImBuf *ibuf, unsigned int w, unsigned int h, unsigned int *rect)
-{
- struct ImBuf *ima;
- unsigned int *drect, *srect;
- float scaledx, scaledy;
- short ex, ey, dx, dy;
-
- /* paranoia test */
- if(ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL))
- return;
-
- /* waste of cpu cyles... but the imbuf API has no other way to scale fast (ton) */
- ima = IMB_dupImBuf(ibuf);
-
- if (!ima)
- return;
-
- if (ima->x > ima->y) {
- scaledx = (float)w;
- scaledy = ( (float)ima->y/(float)ima->x )*(float)w;
- }
- else {
- scaledx = ( (float)ima->x/(float)ima->y )*(float)h;
- scaledy = (float)h;
- }
-
- ex = (short)scaledx;
- ey = (short)scaledy;
-
- dx = (w - ex) / 2;
- dy = (h - ey) / 2;
-
- IMB_scalefastImBuf(ima, ex, ey);
-
- /* if needed, convert to 32 bits */
- if(ima->rect==NULL)
- IMB_rect_from_float(ima);
-
- srect = ima->rect;
- drect = rect;
-
- drect+= dy*w+dx;
- for (;ey > 0; ey--){
- memcpy(drect,srect, ex * sizeof(int));
- drect += w;
- srect += ima->x;
- }
- IMB_freeImBuf(ima);
-}
-
-static void icon_create_mipmap(struct PreviewImage* prv_img, int miplevel)
-{
- unsigned int size = preview_render_size(miplevel);
-
- if (!prv_img) {
- printf("Error: requested preview image does not exist");
- }
- if (!prv_img->rect[miplevel]) {
- prv_img->w[miplevel] = size;
- prv_img->h[miplevel] = size;
- prv_img->changed[miplevel] = 1;
- prv_img->rect[miplevel] = MEM_callocN(size*size*sizeof(unsigned int), "prv_rect");
- }
-}
-
-/* create single icon from jpg, png etc. */
-static void icon_from_image(Image *img, int miplevel)
-{
- unsigned int pr_size;
- short image_loaded = 0;
- struct ImBuf* ibuf=NULL;
- PreviewImage* pi;
-
- /* img->ok is zero when Image cannot load */
- if (img==NULL || img->ok==0)
- return;
-
- /* elubie: this needs to be changed: here image is always loaded if not
- already there. Very expensive for large images. Need to find a way to
- only get existing ibuf */
- ibuf = BKE_image_get_ibuf(img, NULL);
- if(ibuf==NULL || ibuf->rect==NULL) {
- return;
- }
-
- pi = BKE_previewimg_get((ID*)img);
-
- if(!pi) {
- printf("preview image could'nt be allocated");
- return;
- }
- /* we can only create the preview rect here, since loading possibly deallocated
- old preview */
- icon_create_mipmap(pi, miplevel);
-
- pr_size = img->preview->w[miplevel]*img->preview->h[miplevel]*sizeof(unsigned int);
-
- image_loaded = 1;
- icon_copy_rect(ibuf, img->preview->w[miplevel], img->preview->h[miplevel], img->preview->rect[miplevel]);
-}
-
-static void set_alpha(char* cp, int sizex, int sizey, char alpha)
-{
- int x,y;
- for(y=0; y<sizey; y++) {
- for(x=0; x<sizex; x++, cp+=4) {
- cp[3]= alpha;
- }
- }
-}
-
-/* only called when icon has changed */
-/* only call with valid pointer from BIF_icon_draw */
-static void icon_set_image(ID *id, DrawInfo *di, PreviewImage* prv_img, int miplevel)
-{
- RenderInfo ri;
- unsigned int pr_size = 0;
-
- if (!di) return;
-
- if (!prv_img) {
- printf("No preview image for this ID: %s\n", id->name);
- return;
- }
-
- /* no drawing (see last parameter doDraw, just calculate preview image
- - hopefully small enough to be fast */
- if (GS(id->name) == ID_IM)
- icon_from_image((struct Image*)id, miplevel);
- else {
- /* create the preview rect */
- icon_create_mipmap(prv_img, miplevel);
-
- ri.curtile= 0;
- ri.tottile= 0;
- ri.rect = NULL;
- ri.pr_rectx = prv_img->w[miplevel];
- ri.pr_recty = prv_img->h[miplevel];
-
- pr_size = ri.pr_rectx*ri.pr_recty*sizeof(unsigned int);
-
- BIF_previewrender(id, &ri, NULL, PR_ICON_RENDER);
-
- /* world is rendered with alpha=0, so it wasn't displayed
- this could be render option for sky to, for later */
- if (GS(id->name) == ID_WO) {
- set_alpha( (char*) ri.rect, ri.pr_rectx, ri.pr_recty, 255);
- }
- else if (GS(id->name) == ID_MA) {
- Material* mat = (Material*)id;
- if (mat->mode & MA_HALO) {
- set_alpha( (char*) ri.rect, ri.pr_rectx, ri.pr_recty, 255);
- }
- }
-
- if (ri.rect) {
- memcpy(prv_img->rect[miplevel], ri.rect, pr_size);
-
- /* and clean up */
- MEM_freeN(ri.rect);
- ri.rect = 0;
- }
- }
-}
-
-static void icon_draw_rect(float x, float y, int w, int h, float aspect, int rw, int rh, unsigned int *rect)
-{
- ui_rasterpos_safe(x, y, aspect);
-
- if(w<1 || h<1) {
- printf("what the heck!\n");
- }
- /* rect contains image in 'rendersize', we only scale if needed */
- else if(rw!=w && rh!=h) {
- ImBuf *ima;
- if(w>2000 || h>2000) { /* something has gone wrong! */
- printf("insane icon size w=%d h=%d\n",w,h);
- return;
- }
- /* first allocate imbuf for scaling and copy preview into it */
- ima = IMB_allocImBuf(rw, rh, 32, IB_rect, 0);
- memcpy(ima->rect, rect, rw*rh*sizeof(unsigned int));
-
- /* scale it */
- IMB_scaleImBuf(ima, w, h);
- glDrawPixels(w, h, GL_RGBA, GL_UNSIGNED_BYTE, ima->rect);
-
- IMB_freeImBuf(ima);
- }
- else
- glDrawPixels(w, h, GL_RGBA, GL_UNSIGNED_BYTE, rect);
-}
-
-/* Render size for preview images at level miplevel */
-static int preview_render_size(int miplevel)
-{
- switch (miplevel) {
- case 0: return 32;
- case 1: return PREVIEW_DEFAULT_HEIGHT;
- }
- return 0;
-}
-
-/* Drawing size for preview images at level miplevel */
-static int preview_size(int miplevel)
-{
- switch (miplevel) {
- case 0: return ICON_DEFAULT_HEIGHT;
- case 1: return PREVIEW_DEFAULT_HEIGHT;
- }
- return 0;
-}
-
-
-static void icon_draw_mipmap(float x, float y, int icon_id, float aspect, int miplevel, int nocreate)
-{
- Icon *icon = NULL;
- DrawInfo *di = NULL;
- int draw_size = preview_size(miplevel);
-
- icon = BKE_icon_get(icon_id);
-
- if (!icon) {
- printf("BIF_icon_set_aspect: Internal error, no icon for icon ID: %d\n", icon_id);
- return;
- }
-
- di = (DrawInfo*)icon->drawinfo;
-
- if (!di) {
- di = icon_create_drawinfo();
-
- icon->drawinfo = di;
- icon->drawinfo_free = BIF_icons_free_drawinfo;
- }
-
- di->aspect = aspect;
- /* scale width and height according to aspect */
- di->w = (int)(draw_size/di->aspect + 0.5f);
- di->h = (int)(draw_size/di->aspect + 0.5f);
-
- if (di->drawFunc) {
- /* vector icons use the uiBlock transformation, they are not drawn
- with untransformed coordinates like the other icons */
- di->drawFunc(x, y, ICON_DEFAULT_HEIGHT, ICON_DEFAULT_HEIGHT, 1.0f);
- }
- else if (di->icon) {
- /* it is a builtin icon */
- if (!di->icon->rect) return; /* something has gone wrong! */
-
- icon_draw_rect(x,y,di->w, di->h, di->aspect, di->icon->w, di->icon->h, di->icon->rect);
- }
- else {
- PreviewImage* pi = BKE_previewimg_get((ID*)icon->obj);
-
- if (pi) {
- if (!nocreate && (pi->changed[miplevel] ||!pi->rect[miplevel])) /* changed only ever set by dynamic icons */
- {
- waitcursor(1);
- /* create the preview rect if necessary */
- icon_set_image((ID*)icon->obj, icon->drawinfo, pi, miplevel);
- pi->changed[miplevel] = 0;
- waitcursor(0);
- }
-
- if (!pi->rect[miplevel]) return; /* something has gone wrong! */
-
- icon_draw_rect(x,y,di->w, di->h, di->aspect, pi->w[miplevel], pi->h[miplevel], pi->rect[miplevel]);
- }
- }
-}
-
-void BIF_icon_draw_aspect(float x, float y, int icon_id, float aspect)
-{
- icon_draw_mipmap(x,y,icon_id, aspect, PREVIEW_MIPMAP_ZERO, 0);
-}
-
-void BIF_icon_draw(float x, float y, int icon_id)
-{
- BIF_icon_draw_aspect(x, y, icon_id, 1.0f);
-}
-
-void BIF_icon_draw_preview(float x, float y, int icon_id, int nocreate)
-{
- icon_draw_mipmap(x,y,icon_id, 1.0f, PREVIEW_MIPMAP_LARGE, nocreate);
-}
-
-void BIF_icon_draw_aspect_blended(float x, float y, int icon_id, float aspect, int shade)
-{
-
- if(shade < 0) {
- float r= (128+shade)/128.0f;
- glPixelTransferf(GL_ALPHA_SCALE, r);
- }
-
- BIF_icon_draw_aspect(x, y, icon_id, aspect);
-
- if(shade < 0)
- glPixelTransferf(GL_ALPHA_SCALE, 1.0f);
-}
diff --git a/source/blender/src/interface_panel.c b/source/blender/src/interface_panel.c
deleted file mode 100644
index de7f53c2af7..00000000000
--- a/source/blender/src/interface_panel.c
+++ /dev/null
@@ -1,1957 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-/*
- a full doc with API notes can be found in bf-blender/blender/doc/interface_API.txt
-
- */
-
-
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef WIN32
-#include <unistd.h>
-#else
-#include <io.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "PIL_time.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_vec_types.h"
-
-#include "BKE_blender.h"
-#include "BKE_utildefines.h"
-#include "BKE_global.h"
-
-#include "BIF_gl.h"
-#include "BIF_graphics.h"
-#include "BIF_keyval.h"
-#include "BIF_mainqueue.h"
-
-#include "BIF_drawimage.h"
-#include "BIF_previewrender.h"
-#include "BIF_screen.h"
-#include "BIF_toolbox.h"
-#include "BIF_mywindow.h"
-#include "BIF_space.h"
-#include "BIF_glutil.h"
-#include "BIF_interface.h"
-#include "BIF_butspace.h"
-#include "BIF_language.h"
-
-#include "BSE_view.h"
-
-#include "mydevice.h"
-#include "interface.h"
-#include "blendef.h"
-
-// globals
-extern float UIwinmat[4][4];
-
-
-
-/* --------- generic helper drawng calls ---------------- */
-
-
-#define UI_RB_ALPHA 16
-static int roundboxtype= 15;
-
-void uiSetRoundBox(int type)
-{
- /* Not sure the roundbox function is the best place to change this
- * if this is undone, its not that big a deal, only makes curves edges
- * square for the */
- if (BIF_GetThemeValue(TH_BUT_DRAWTYPE) == TH_MINIMAL)
- roundboxtype= 0;
- else
- roundboxtype= type;
-
- /* flags to set which corners will become rounded:
-
- 1------2
- | |
- 8------4
- */
-
-}
-
-void gl_round_box(int mode, float minx, float miny, float maxx, float maxy, float rad)
-{
- float vec[7][2]= {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
- {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}};
- int a;
-
- /* mult */
- for(a=0; a<7; a++) {
- vec[a][0]*= rad; vec[a][1]*= rad;
- }
-
- glBegin(mode);
-
- /* start with corner right-bottom */
- if(roundboxtype & 4) {
- glVertex2f( maxx-rad, miny);
- for(a=0; a<7; a++) {
- glVertex2f( maxx-rad+vec[a][0], miny+vec[a][1]);
- }
- glVertex2f( maxx, miny+rad);
- }
- else glVertex2f( maxx, miny);
-
- /* corner right-top */
- if(roundboxtype & 2) {
- glVertex2f( maxx, maxy-rad);
- for(a=0; a<7; a++) {
- glVertex2f( maxx-vec[a][1], maxy-rad+vec[a][0]);
- }
- glVertex2f( maxx-rad, maxy);
- }
- else glVertex2f( maxx, maxy);
-
- /* corner left-top */
- if(roundboxtype & 1) {
- glVertex2f( minx+rad, maxy);
- for(a=0; a<7; a++) {
- glVertex2f( minx+rad-vec[a][0], maxy-vec[a][1]);
- }
- glVertex2f( minx, maxy-rad);
- }
- else glVertex2f( minx, maxy);
-
- /* corner left-bottom */
- if(roundboxtype & 8) {
- glVertex2f( minx, miny+rad);
- for(a=0; a<7; a++) {
- glVertex2f( minx+vec[a][1], miny+rad-vec[a][0]);
- }
- glVertex2f( minx+rad, miny);
- }
- else glVertex2f( minx, miny);
-
- glEnd();
-}
-
-static void round_box_shade_col(float *col1, float *col2, float fac)
-{
- float col[3];
-
- col[0]= (fac*col1[0] + (1.0-fac)*col2[0]);
- col[1]= (fac*col1[1] + (1.0-fac)*col2[1]);
- col[2]= (fac*col1[2] + (1.0-fac)*col2[2]);
-
- glColor3fv(col);
-}
-
-/* linear horizontal shade within button or in outline */
-void gl_round_box_shade(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadetop, float shadedown)
-{
- float vec[7][2]= {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
- {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}};
- float div= maxy-miny;
- float coltop[3], coldown[3], color[4];
- int a;
-
- /* mult */
- for(a=0; a<7; a++) {
- vec[a][0]*= rad; vec[a][1]*= rad;
- }
- /* get current color, needs to be outside of glBegin/End */
- glGetFloatv(GL_CURRENT_COLOR, color);
-
- /* 'shade' defines strength of shading */
- coltop[0]= color[0]+shadetop; if(coltop[0]>1.0) coltop[0]= 1.0;
- coltop[1]= color[1]+shadetop; if(coltop[1]>1.0) coltop[1]= 1.0;
- coltop[2]= color[2]+shadetop; if(coltop[2]>1.0) coltop[2]= 1.0;
- coldown[0]= color[0]+shadedown; if(coldown[0]<0.0) coldown[0]= 0.0;
- coldown[1]= color[1]+shadedown; if(coldown[1]<0.0) coldown[1]= 0.0;
- coldown[2]= color[2]+shadedown; if(coldown[2]<0.0) coldown[2]= 0.0;
-
- if (BIF_GetThemeValue(TH_BUT_DRAWTYPE) != TH_MINIMAL) {
- glShadeModel(GL_SMOOTH);
- glBegin(mode);
- }
-
- /* start with corner right-bottom */
- if(roundboxtype & 4) {
-
- round_box_shade_col(coltop, coldown, 0.0);
- glVertex2f( maxx-rad, miny);
-
- for(a=0; a<7; a++) {
- round_box_shade_col(coltop, coldown, vec[a][1]/div);
- glVertex2f( maxx-rad+vec[a][0], miny+vec[a][1]);
- }
-
- round_box_shade_col(coltop, coldown, rad/div);
- glVertex2f( maxx, miny+rad);
- }
- else {
- round_box_shade_col(coltop, coldown, 0.0);
- glVertex2f( maxx, miny);
- }
-
- /* corner right-top */
- if(roundboxtype & 2) {
-
- round_box_shade_col(coltop, coldown, (div-rad)/div);
- glVertex2f( maxx, maxy-rad);
-
- for(a=0; a<7; a++) {
- round_box_shade_col(coltop, coldown, (div-rad+vec[a][1])/div);
- glVertex2f( maxx-vec[a][1], maxy-rad+vec[a][0]);
- }
- round_box_shade_col(coltop, coldown, 1.0);
- glVertex2f( maxx-rad, maxy);
- }
- else {
- round_box_shade_col(coltop, coldown, 1.0);
- glVertex2f( maxx, maxy);
- }
-
- /* corner left-top */
- if(roundboxtype & 1) {
-
- round_box_shade_col(coltop, coldown, 1.0);
- glVertex2f( minx+rad, maxy);
-
- for(a=0; a<7; a++) {
- round_box_shade_col(coltop, coldown, (div-vec[a][1])/div);
- glVertex2f( minx+rad-vec[a][0], maxy-vec[a][1]);
- }
-
- round_box_shade_col(coltop, coldown, (div-rad)/div);
- glVertex2f( minx, maxy-rad);
- }
- else {
- round_box_shade_col(coltop, coldown, 1.0);
- glVertex2f( minx, maxy);
- }
-
- /* corner left-bottom */
- if(roundboxtype & 8) {
-
- round_box_shade_col(coltop, coldown, rad/div);
- glVertex2f( minx, miny+rad);
-
- for(a=0; a<7; a++) {
- round_box_shade_col(coltop, coldown, (rad-vec[a][1])/div);
- glVertex2f( minx+vec[a][1], miny+rad-vec[a][0]);
- }
-
- round_box_shade_col(coltop, coldown, 0.0);
- glVertex2f( minx+rad, miny);
- }
- else {
- round_box_shade_col(coltop, coldown, 0.0);
- glVertex2f( minx, miny);
- }
-
- glEnd();
- glShadeModel(GL_FLAT);
-}
-
-/* only for headers */
-static void gl_round_box_topshade(float minx, float miny, float maxx, float maxy, float rad)
-{
- float vec[7][2]= {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
- {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}};
- char col[7]= {140, 165, 195, 210, 230, 245, 255};
- int a;
- char alpha=255;
-
- if(roundboxtype & UI_RB_ALPHA) alpha= 128;
-
- /* mult */
- for(a=0; a<7; a++) {
- vec[a][0]*= rad; vec[a][1]*= rad;
- }
-
- /* shades from grey->white->grey */
- glBegin(GL_LINE_STRIP);
-
- if(roundboxtype & 3) {
- /* corner right-top */
- glColor4ub(140, 140, 140, alpha);
- glVertex2f( maxx, maxy-rad);
- for(a=0; a<7; a++) {
- glColor4ub(col[a], col[a], col[a], alpha);
- glVertex2f( maxx-vec[a][1], maxy-rad+vec[a][0]);
- }
- glColor4ub(225, 225, 225, alpha);
- glVertex2f( maxx-rad, maxy);
-
-
- /* corner left-top */
- glVertex2f( minx+rad, maxy);
- for(a=0; a<7; a++) {
- glColor4ub(col[6-a], col[6-a], col[6-a], alpha);
- glVertex2f( minx+rad-vec[a][0], maxy-vec[a][1]);
- }
- glVertex2f( minx, maxy-rad);
- }
- else {
- glColor4ub(225, 225, 225, alpha);
- glVertex2f( minx, maxy);
- glVertex2f( maxx, maxy);
- }
-
- glEnd();
-}
-
-/* for headers and floating panels */
-void uiRoundBoxEmboss(float minx, float miny, float maxx, float maxy, float rad, int active)
-{
- float color[4];
-
- if(roundboxtype & UI_RB_ALPHA) {
- glGetFloatv(GL_CURRENT_COLOR, color);
- color[3]= 0.5;
- glColor4fv(color);
- glEnable( GL_BLEND );
- }
-
- /* solid part */
- //if(active)
- // gl_round_box_shade(GL_POLYGON, minx, miny, maxx, maxy, rad, 0.10, -0.05);
- // else
- /* shading doesnt work for certain buttons yet (pulldown) need smarter buffer caching (ton) */
- gl_round_box(GL_POLYGON, minx, miny, maxx, maxy, rad);
-
- /* set antialias line */
- if (BIF_GetThemeValue(TH_BUT_DRAWTYPE) != TH_MINIMAL) {
- glEnable( GL_LINE_SMOOTH );
- glEnable( GL_BLEND );
- }
-
- /* top shade */
- gl_round_box_topshade(minx+1, miny+1, maxx-1, maxy-1, rad);
-
- /* total outline */
- if(roundboxtype & UI_RB_ALPHA) glColor4ub(0,0,0, 128); else glColor4ub(0,0,0, 200);
- gl_round_box(GL_LINE_LOOP, minx, miny, maxx, maxy, rad);
-
- glDisable( GL_LINE_SMOOTH );
-
- /* bottom shade for header down */
- if((roundboxtype & 12)==12) {
- glColor4ub(0,0,0, 80);
- fdrawline(minx+rad-1.0, miny+1.0, maxx-rad+1.0, miny+1.0);
- }
- glDisable( GL_BLEND );
-}
-
-
-/* plain antialiased unfilled rectangle */
-void uiRoundRect(float minx, float miny, float maxx, float maxy, float rad)
-{
- float color[4];
-
- if(roundboxtype & UI_RB_ALPHA) {
- glGetFloatv(GL_CURRENT_COLOR, color);
- color[3]= 0.5;
- glColor4fv(color);
- glEnable( GL_BLEND );
- }
-
- /* set antialias line */
- if (BIF_GetThemeValue(TH_BUT_DRAWTYPE) != TH_MINIMAL) {
- glEnable( GL_LINE_SMOOTH );
- glEnable( GL_BLEND );
- }
-
- gl_round_box(GL_LINE_LOOP, minx, miny, maxx, maxy, rad);
-
- glDisable( GL_BLEND );
- glDisable( GL_LINE_SMOOTH );
-}
-
-
-
-/* plain antialiased filled box */
-void uiRoundBox(float minx, float miny, float maxx, float maxy, float rad)
-{
- float color[4];
-
- if(roundboxtype & UI_RB_ALPHA) {
- glGetFloatv(GL_CURRENT_COLOR, color);
- color[3]= 0.5;
- glColor4fv(color);
- glEnable( GL_BLEND );
- }
-
- /* solid part */
- gl_round_box(GL_POLYGON, minx, miny, maxx, maxy, rad);
-
- /* set antialias line */
- if (BIF_GetThemeValue(TH_BUT_DRAWTYPE) != TH_MINIMAL) {
- glEnable( GL_LINE_SMOOTH );
- glEnable( GL_BLEND );
- }
-
- gl_round_box(GL_LINE_LOOP, minx, miny, maxx, maxy, rad);
-
- glDisable( GL_BLEND );
- glDisable( GL_LINE_SMOOTH );
-}
-
-
-/* ************** panels ************* */
-
-static void copy_panel_offset(Panel *pa, Panel *papar)
-{
- /* with respect to sizes... papar is parent */
-
- pa->ofsx= papar->ofsx;
- pa->ofsy= papar->ofsy + papar->sizey-pa->sizey;
-}
-
-
-
-/* global... but will be NULLed after each 'newPanel' call */
-static char *panel_tabbed=NULL, *group_tabbed=NULL;
-
-void uiNewPanelTabbed(char *panelname, char *groupname)
-{
- panel_tabbed= panelname;
- group_tabbed= groupname;
-}
-
-/* another global... */
-static int pnl_control= UI_PNL_TRANSP;
-
-void uiPanelControl(int control)
-{
- pnl_control= control;
-}
-
-/* another global... */
-static int pnl_handler= 0;
-
-void uiSetPanelHandler(int handler)
-{
- pnl_handler= handler;
-}
-
-
-/* ofsx/ofsy only used for new panel definitions */
-/* return 1 if visible (create buttons!) */
-int uiNewPanel(ScrArea *sa, uiBlock *block, char *panelname, char *tabname, int ofsx, int ofsy, int sizex, int sizey)
-{
- Panel *pa;
-
- /* check if Panel exists, then use that one */
- pa= sa->panels.first;
- while(pa) {
- if( strncmp(pa->panelname, panelname, UI_MAX_NAME_STR)==0) {
- if( strncmp(pa->tabname, tabname, UI_MAX_NAME_STR)==0) {
- break;
- }
- }
- pa= pa->next;
- }
-
- if(pa) {
- /* scale correction */
- if(pa->control & UI_PNL_SCALE);
- else {
- pa->sizex= sizex;
- if(pa->sizey != sizey) {
- pa->ofsy+= (pa->sizey - sizey); // check uiNewPanelHeight()
- pa->sizey= sizey;
- }
- }
- }
- else {
-
- /* new panel */
- pa= MEM_callocN(sizeof(Panel), "new panel");
- BLI_addtail(&sa->panels, pa);
- strncpy(pa->panelname, panelname, UI_MAX_NAME_STR);
- strncpy(pa->tabname, tabname, UI_MAX_NAME_STR);
-
- pa->ofsx= ofsx & ~(PNL_GRID-1);
- pa->ofsy= ofsy & ~(PNL_GRID-1);
- pa->sizex= sizex;
- pa->sizey= sizey;
-
- /* make new Panel tabbed? */
- if(panel_tabbed && group_tabbed) {
- Panel *papar;
- for(papar= sa->panels.first; papar; papar= papar->next) {
- if(papar->active && papar->paneltab==NULL) {
- if( strncmp(panel_tabbed, papar->panelname, UI_MAX_NAME_STR)==0) {
- if( strncmp(group_tabbed, papar->tabname, UI_MAX_NAME_STR)==0) {
- pa->paneltab= papar;
- copy_panel_offset(pa, papar);
- break;
- }
- }
- }
- }
- }
- }
-
- block->panel= pa;
- block->handler= pnl_handler;
- pa->active= 1;
- pa->control= pnl_control;
-
- /* global control over this feature; UI_PNL_TO_MOUSE only called for hotkey panels */
- if(U.uiflag & USER_PANELPINNED);
- else if(pnl_control & UI_PNL_TO_MOUSE) {
- short mval[2];
-
- Mat4CpyMat4(UIwinmat, block->winmat); // can be first event here
- uiGetMouse(block->win, mval);
- pa->ofsx= mval[0]-pa->sizex/2;
- pa->ofsy= mval[1]-pa->sizey/2;
-
- if(pa->flag & PNL_CLOSED) pa->flag &= ~PNL_CLOSED;
- }
-
- if(pnl_control & UI_PNL_UNSTOW) {
- if(pa->flag & PNL_CLOSEDY) {
- pa->flag &= ~PNL_CLOSED;
- }
- }
-
- /* clear ugly globals */
- panel_tabbed= group_tabbed= NULL;
- pnl_handler= 0;
- pnl_control= UI_PNL_TRANSP; // back to default
-
- if(block->panel->paneltab) return 0;
- if(block->panel->flag & PNL_CLOSED) return 0;
-
- /* the 'return 0' above makes this to be in end. otherwise closes panels show wrong title */
- pa->drawname[0]= 0;
-
- return 1;
-}
-
-void uiFreePanels(ListBase *lb)
-{
- Panel *panel;
-
- while( (panel= lb->first) ) {
- BLI_remlink(lb, panel);
- MEM_freeN(panel);
- }
-}
-
-void uiNewPanelHeight(uiBlock *block, int sizey)
-{
- if(sizey<64) sizey= 64;
-
- if(block->panel) {
- block->panel->ofsy+= (block->panel->sizey - sizey);
- block->panel->sizey= sizey;
- }
-}
-
-void uiNewPanelTitle(uiBlock *block, char *str)
-{
- if(block->panel)
- BLI_strncpy(block->panel->drawname, str, UI_MAX_NAME_STR);
-}
-
-static int panel_has_tabs(Panel *panel)
-{
- Panel *pa= curarea->panels.first;
-
- if(panel==NULL) return 0;
-
- while(pa) {
- if(pa->paneltab==panel) return 1;
- pa= pa->next;
- }
- return 0;
-}
-
-static void ui_scale_panel_block(uiBlock *block)
-{
- uiBut *but;
- float facx= 1.0, facy= 1.0;
- int centerx= 0, topy=0, tabsy=0;
-
- if(block->panel==NULL) return;
-
- if(block->autofill) ui_autofill(block);
- /* buttons min/max centered, offset calculated */
- uiBoundsBlock(block, 0);
-
- if( block->maxx-block->minx > block->panel->sizex - 2*PNL_SAFETY ) {
- facx= (block->panel->sizex - (2*PNL_SAFETY))/( block->maxx-block->minx );
- }
- else centerx= (block->panel->sizex-( block->maxx-block->minx ) - 2*PNL_SAFETY)/2;
-
- // tabsy= PNL_HEADER*panel_has_tabs(block->panel);
- if( (block->maxy-block->miny) > block->panel->sizey - 2*PNL_SAFETY - tabsy) {
- facy= (block->panel->sizey - (2*PNL_SAFETY) - tabsy)/( block->maxy-block->miny );
- }
- else topy= (block->panel->sizey- 2*PNL_SAFETY - tabsy) - ( block->maxy-block->miny ) ;
-
- but= block->buttons.first;
- while(but) {
- but->x1= PNL_SAFETY+centerx+ facx*(but->x1-block->minx);
- but->y1= PNL_SAFETY+topy + facy*(but->y1-block->miny);
- but->x2= PNL_SAFETY+centerx+ facx*(but->x2-block->minx);
- but->y2= PNL_SAFETY+topy + facy*(but->y2-block->miny);
- if(facx!=1.0) ui_check_but(but); /* for strlen */
- but= but->next;
- }
-
- block->maxx= block->panel->sizex;
- block->maxy= block->panel->sizey;
- block->minx= block->miny= 0.0;
-
-}
-
-// for 'home' key
-void uiSetPanel_view2d(ScrArea *sa)
-{
- Panel *pa;
- float minx=10000, maxx= -10000, miny=10000, maxy= -10000;
- int done=0;
-
- pa= sa->panels.first;
- while(pa) {
- if(pa->active && pa->paneltab==NULL) {
- done= 1;
- if(pa->ofsx < minx) minx= pa->ofsx;
- if(pa->ofsx+pa->sizex > maxx) maxx= pa->ofsx+pa->sizex;
- if(pa->ofsy < miny) miny= pa->ofsy;
- if(pa->ofsy+pa->sizey+PNL_HEADER > maxy) maxy= pa->ofsy+pa->sizey+PNL_HEADER;
- }
- pa= pa->next;
- }
- if(done) {
- G.v2d->tot.xmin= minx-PNL_DIST;
- G.v2d->tot.xmax= maxx+PNL_DIST;
- G.v2d->tot.ymin= miny-PNL_DIST;
- G.v2d->tot.ymax= maxy+PNL_DIST;
- }
- else {
- uiBlock *block;
-
- G.v2d->tot.xmin= 0;
- G.v2d->tot.xmax= 1280;
- G.v2d->tot.ymin= 0;
- G.v2d->tot.ymax= 228;
-
- /* no panels, but old 'loose' buttons, as in old logic editor */
- for(block= sa->uiblocks.first; block; block= block->next) {
- if(block->win==sa->win) {
- if(block->minx < G.v2d->tot.xmin) G.v2d->tot.xmin= block->minx;
- if(block->maxx > G.v2d->tot.xmax) G.v2d->tot.xmax= block->maxx;
- if(block->miny < G.v2d->tot.ymin) G.v2d->tot.ymin= block->miny;
- if(block->maxy > G.v2d->tot.ymax) G.v2d->tot.ymax= block->maxy;
- }
- }
- }
-
-}
-
-// make sure the panels are not outside 'tot' area
-void uiMatchPanel_view2d(ScrArea *sa)
-{
- Panel *pa;
- int done=0;
-
- pa= sa->panels.first;
- while(pa) {
- if(pa->active && pa->paneltab==NULL) {
- done= 1;
- if(pa->ofsx < G.v2d->tot.xmin) G.v2d->tot.xmin= pa->ofsx;
- if(pa->ofsx+pa->sizex > G.v2d->tot.xmax)
- G.v2d->tot.xmax= pa->ofsx+pa->sizex;
- if(pa->ofsy < G.v2d->tot.ymin) G.v2d->tot.ymin= pa->ofsy;
- if(pa->ofsy+pa->sizey+PNL_HEADER > G.v2d->tot.ymax)
- G.v2d->tot.ymax= pa->ofsy+pa->sizey+PNL_HEADER;
- }
- pa= pa->next;
- }
- if(done==0) {
- uiBlock *block;
- /* no panels, but old 'loose' buttons, as in old logic editor */
- for(block= sa->uiblocks.first; block; block= block->next) {
- if(block->win==sa->win) {
- if(block->minx < G.v2d->tot.xmin) G.v2d->tot.xmin= block->minx;
- if(block->maxx > G.v2d->tot.xmax) G.v2d->tot.xmax= block->maxx;
- if(block->miny < G.v2d->tot.ymin) G.v2d->tot.ymin= block->miny;
- if(block->maxy > G.v2d->tot.ymax) G.v2d->tot.ymax= block->maxy;
- }
- }
- }
-}
-
-/* extern used by previewrender */
-void uiPanelPush(uiBlock *block)
-{
- glPushMatrix();
- if(block->panel) {
- glTranslatef((float)block->panel->ofsx, (float)block->panel->ofsy, 0.0);
- i_translate((float)block->panel->ofsx, (float)block->panel->ofsy, 0.0, UIwinmat);
- }
-}
-
-void uiPanelPop(uiBlock *block)
-{
- glPopMatrix();
- Mat4CpyMat4(UIwinmat, block->winmat);
-}
-
-uiBlock *uiFindOpenPanelBlockName(ListBase *lb, char *name)
-{
- uiBlock *block;
-
- for(block= lb->first; block; block= block->next) {
- if(block->panel && block->panel->active && block->panel->paneltab==NULL) {
- if(block->panel->flag & PNL_CLOSED);
- else if(strncmp(name, block->panel->panelname, UI_MAX_NAME_STR)==0) break;
- }
- }
- return block;
-}
-
-static void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y3)
-{
- // we draw twice, anti polygons not widely supported...
- glBegin(GL_POLYGON);
- glVertex2f(x1, y1);
- glVertex2f(x2, y2);
- glVertex2f(x3, y3);
- glEnd();
-
- /* set antialias line */
- glEnable( GL_LINE_SMOOTH );
- glEnable( GL_BLEND );
-
- glBegin(GL_LINE_LOOP);
- glVertex2f(x1, y1);
- glVertex2f(x2, y2);
- glVertex2f(x3, y3);
- glEnd();
-
- glDisable( GL_LINE_SMOOTH );
- glDisable( GL_BLEND );
-}
-
-/* triangle 'icon' for panel header */
-void ui_draw_tria_icon(float x, float y, float aspect, char dir)
-{
- if(dir=='h') {
- ui_draw_anti_tria( x, y+1, x, y+10.0, x+8, y+6.25);
- }
- else {
- ui_draw_anti_tria( x-2, y+9, x+8-2, y+9, x+4.25-2, y+1);
- }
-}
-
-void ui_draw_anti_x(float x1, float y1, float x2, float y2)
-{
-
- /* set antialias line */
- glEnable( GL_LINE_SMOOTH );
- glEnable( GL_BLEND );
-
- glLineWidth(2.0);
-
- fdrawline(x1, y1, x2, y2);
- fdrawline(x1, y2, x2, y1);
-
- glLineWidth(1.0);
-
- glDisable( GL_LINE_SMOOTH );
- glDisable( GL_BLEND );
-
-}
-
-/* x 'icon' for panel header */
-static void ui_draw_x_icon(float x, float y)
-{
- BIF_ThemeColor(TH_TEXT_HI);
-
- ui_draw_anti_x( x, y, x+9.375, y+9.375);
-
-}
-
-#if 0
-static void ui_set_panel_pattern(char dir)
-{
- static int firsttime= 1;
- static GLubyte path[4*32], patv[4*32];
- int a,b,i=0;
-
- if(firsttime) {
- firsttime= 0;
- for(a=0; a<128; a++) patv[a]= 0x33;
- for(a=0; a<8; a++) {
- for(b=0; b<4; b++) path[i++]= 0xff; /* 1 scanlines */
- for(b=0; b<12; b++) path[i++]= 0x0; /* 3 lines */
- }
- }
- glEnable(GL_POLYGON_STIPPLE);
- if(dir=='h') glPolygonStipple(path);
- else glPolygonStipple(patv);
-}
-#endif
-
-static char *ui_block_cut_str(uiBlock *block, char *str, short okwidth)
-{
- short width, ofs=strlen(str);
- static char str1[128];
-
- if(ofs>127) return str;
-
- width= block->aspect*BIF_GetStringWidth(block->curfont, str, (U.transopts & USER_TR_BUTTONS));
-
- if(width <= okwidth) return str;
- strcpy(str1, str);
-
- while(width > okwidth && ofs>0) {
- ofs--;
- str1[ofs]= 0;
-
- width= block->aspect*BIF_GetStringWidth(block->curfont, str1, 0);
-
- if(width < 10) break;
- }
- return str1;
-}
-
-
-#define PNL_ICON 20
-#define PNL_DRAGGER 20
-
-
-static void ui_draw_panel_header(uiBlock *block)
-{
- Panel *pa, *panel= block->panel;
- float width;
- int a, nr= 1, pnl_icons;
- char *panelname= panel->drawname[0]?panel->drawname:panel->panelname;
- char *str;
-
- /* count */
- pa= curarea->panels.first;
- while(pa) {
- if(pa->active) {
- if(pa->paneltab==panel) nr++;
- }
- pa= pa->next;
- }
-
- pnl_icons= PNL_ICON+8;
- if(panel->control & UI_PNL_CLOSE) pnl_icons+= PNL_ICON;
-
- if(nr==1) {
- // full header
- BIF_ThemeColorShade(TH_HEADER, -30);
- uiSetRoundBox(3);
- uiRoundBox(block->minx, block->maxy, block->maxx, block->maxy+PNL_HEADER, 8);
-
- /* active tab */
- /* draw text label */
- BIF_ThemeColor(TH_TEXT_HI);
- ui_rasterpos_safe(4.0f+block->minx+pnl_icons, block->maxy+5.0f, block->aspect);
- BIF_DrawString(block->curfont, panelname, (U.transopts & USER_TR_BUTTONS));
- return;
- }
-
- // tabbed, full header brighter
- //BIF_ThemeColorShade(TH_HEADER, 0);
- //uiSetRoundBox(3);
- //uiRoundBox(block->minx, block->maxy, block->maxx, block->maxy+PNL_HEADER, 8);
-
- a= 0;
- width= (panel->sizex - 3 - pnl_icons - PNL_ICON)/nr;
- pa= curarea->panels.first;
- while(pa) {
- panelname= pa->drawname[0]?pa->drawname:pa->panelname;
-
- if(pa->active==0);
- else if(pa==panel) {
- /* active tab */
-
- /* draw the active tab */
- uiSetRoundBox(3);
- BIF_ThemeColorShade(TH_HEADER, -3);
- uiRoundBox(2+pnl_icons+a*width, panel->sizey-1, pnl_icons+(a+1)*width, panel->sizey+PNL_HEADER-3, 8);
-
- /* draw the active text label */
- BIF_ThemeColor(TH_TEXT);
- ui_rasterpos_safe(16+pnl_icons+a*width, panel->sizey+4, block->aspect);
- str= ui_block_cut_str(block, panelname, (short)(width-10));
- BIF_DrawString(block->curfont, str, (U.transopts & USER_TR_BUTTONS));
-
- a++;
- }
- else if(pa->paneltab==panel) {
- /* draw an inactive tab */
- uiSetRoundBox(3);
- BIF_ThemeColorShade(TH_HEADER, -60);
- uiRoundBox(2+pnl_icons+a*width, panel->sizey, pnl_icons+(a+1)*width, panel->sizey+PNL_HEADER-3, 8);
-
- /* draw an inactive tab label */
- BIF_ThemeColorShade(TH_TEXT_HI, -40);
- ui_rasterpos_safe(16+pnl_icons+a*width, panel->sizey+4, block->aspect);
- str= ui_block_cut_str(block, panelname, (short)(width-10));
- BIF_DrawString(block->curfont, str, (U.transopts & USER_TR_BUTTONS));
-
- a++;
- }
- pa= pa->next;
- }
-
- // dragger
- /*
- uiSetRoundBox(15);
- BIF_ThemeColorShade(TH_HEADER, -70);
- uiRoundBox(panel->sizex-PNL_ICON+5, panel->sizey+5, panel->sizex-5, panel->sizey+PNL_HEADER-5, 5);
- */
-
-}
-
-static void ui_draw_panel_scalewidget(uiBlock *block)
-{
- float xmin, xmax, dx;
- float ymin, ymax, dy;
-
- xmin= block->maxx-PNL_HEADER+2;
- xmax= block->maxx-3;
- ymin= block->miny+3;
- ymax= block->miny+PNL_HEADER-2;
-
- dx= 0.5f*(xmax-xmin);
- dy= 0.5f*(ymax-ymin);
-
- glEnable(GL_BLEND);
- glColor4ub(255, 255, 255, 50);
- fdrawline(xmin, ymin, xmax, ymax);
- fdrawline(xmin+dx, ymin, xmax, ymax-dy);
-
- glColor4ub(0, 0, 0, 50);
- fdrawline(xmin, ymin+block->aspect, xmax, ymax+block->aspect);
- fdrawline(xmin+dx, ymin+block->aspect, xmax, ymax-dy+block->aspect);
- glDisable(GL_BLEND);
-}
-
-void ui_draw_panel(uiBlock *block)
-{
- Panel *panel= block->panel;
- int ofsx;
- char *panelname= panel->drawname[0]?panel->drawname:panel->panelname;
-
- if(panel->paneltab) return;
-
- /* if the panel is minimized vertically:
- * (------)
- */
- if(panel->flag & PNL_CLOSEDY) {
- /* draw a little rounded box, the size of the header */
- uiSetRoundBox(15);
- BIF_ThemeColorShade(TH_HEADER, -30);
- uiRoundBox(block->minx, block->maxy, block->maxx, block->maxy+PNL_HEADER, 8);
-
- /* title */
- ofsx= PNL_ICON+8;
- if(panel->control & UI_PNL_CLOSE) ofsx+= PNL_ICON;
- BIF_ThemeColor(TH_TEXT_HI);
- ui_rasterpos_safe(4+block->minx+ofsx, block->maxy+5, block->aspect);
- BIF_DrawString(block->curfont, panelname, (U.transopts & USER_TR_BUTTONS));
-
- /* border */
- if(panel->flag & PNL_SELECT) {
- BIF_ThemeColorShade(TH_HEADER, -120);
- uiRoundRect(block->minx, block->maxy, block->maxx, block->maxy+PNL_HEADER, 8);
- }
- /* if it's being overlapped by a panel being dragged */
- if(panel->flag & PNL_OVERLAP) {
- BIF_ThemeColor(TH_TEXT_HI);
- uiRoundRect(block->minx, block->maxy, block->maxx, block->maxy+PNL_HEADER, 8);
- }
-
- }
- /* if the panel is minimized horizontally:
- * /-\
- * |
- * |
- * |
- * \_/
- */
- else if(panel->flag & PNL_CLOSEDX) {
- char str[4];
- int a, end, ofs;
-
- /* draw a little rounded box, the size of the header, rotated 90 deg */
- uiSetRoundBox(15);
- BIF_ThemeColorShade(TH_HEADER, -30);
- uiRoundBox(block->minx, block->miny, block->minx+PNL_HEADER, block->maxy+PNL_HEADER, 8);
-
- /* title, only the initial character for now */
- BIF_ThemeColor(TH_TEXT_HI);
- str[1]= 0;
- end= strlen(panelname);
- ofs= 20;
- for(a=0; a<end; a++) {
- str[0]= panelname[a];
- if( isupper(str[0]) ) {
- ui_rasterpos_safe(block->minx+5, block->maxy-ofs, block->aspect);
- BIF_DrawString(block->curfont, str, 0);
- ofs+= 15;
- }
- }
-
- /* border */
- if(panel->flag & PNL_SELECT) {
- BIF_ThemeColorShade(TH_HEADER, -120);
- uiRoundRect(block->minx, block->miny, block->minx+PNL_HEADER, block->maxy+PNL_HEADER, 8);
- }
- if(panel->flag & PNL_OVERLAP) {
- BIF_ThemeColor(TH_TEXT_HI);
- uiRoundRect(block->minx, block->miny, block->minx+PNL_HEADER, block->maxy+PNL_HEADER, 8);
- }
-
- }
- /* an open panel */
- else {
- /* all panels now... */
- if(panel->control & UI_PNL_SOLID) {
- BIF_ThemeColorShade(TH_HEADER, -30);
-
- uiSetRoundBox(3);
- uiRoundBox(block->minx, block->maxy, block->maxx, block->maxy+PNL_HEADER, 8);
-
- glEnable(GL_BLEND);
- BIF_ThemeColor4(TH_PANEL);
-
- uiSetRoundBox(12);
- /* bad code... but its late :) */
- if(strcmp(block->name, "image_panel_preview")==0)
- uiRoundRect(block->minx, block->miny, block->maxx, block->maxy, 8);
- else
- uiRoundBox(block->minx, block->miny, block->maxx, block->maxy, 8);
-
- // glRectf(block->minx, block->miny, block->maxx, block->maxy);
-
- /* shadow */
- /*
- glColor4ub(0, 0, 0, 40);
-
- fdrawline(block->minx+2, block->miny-1, block->maxx+1, block->miny-1);
- fdrawline(block->maxx+1, block->miny-1, block->maxx+1, block->maxy+7);
-
- glColor4ub(0, 0, 0, 10);
-
- fdrawline(block->minx+3, block->miny-2, block->maxx+2, block->miny-2);
- fdrawline(block->maxx+2, block->miny-2, block->maxx+2, block->maxy+6);
-
- */
-
- glDisable(GL_BLEND);
- }
- /* floating panel */
- else if(panel->control & UI_PNL_TRANSP) {
- BIF_ThemeColorShade(TH_HEADER, -30);
- uiSetRoundBox(3);
- uiRoundBox(block->minx, block->maxy, block->maxx, block->maxy+PNL_HEADER, 8);
-
- glEnable(GL_BLEND);
- BIF_ThemeColor4(TH_PANEL);
- glRectf(block->minx, block->miny, block->maxx, block->maxy);
-
- glDisable(GL_BLEND);
- }
-
- /* draw the title, tabs, etc in the header */
- ui_draw_panel_header(block);
-
- /* in some occasions, draw a border */
- if(panel->flag & PNL_SELECT) {
- if(panel->control & UI_PNL_SOLID) uiSetRoundBox(15);
- else uiSetRoundBox(3);
-
- BIF_ThemeColorShade(TH_HEADER, -120);
- uiRoundRect(block->minx, block->miny, block->maxx, block->maxy+PNL_HEADER, 8);
- }
- if(panel->flag & PNL_OVERLAP) {
- if(panel->control & UI_PNL_SOLID) uiSetRoundBox(15);
- else uiSetRoundBox(3);
-
- BIF_ThemeColor(TH_TEXT_HI);
- uiRoundRect(block->minx, block->miny, block->maxx, block->maxy+PNL_HEADER, 8);
- }
-
- if(panel->control & UI_PNL_SCALE)
- ui_draw_panel_scalewidget(block);
-
- /* and a soft shadow-line for now */
- /*
- glEnable( GL_BLEND );
- glColor4ub(0, 0, 0, 50);
- fdrawline(block->maxx, block->miny, block->maxx, block->maxy+PNL_HEADER/2);
- fdrawline(block->minx, block->miny, block->maxx, block->miny);
- glDisable(GL_BLEND);
- */
-
- }
-
- /* draw optional close icon */
-
- ofsx= 6;
- if(panel->control & UI_PNL_CLOSE) {
-
- ui_draw_x_icon(block->minx+2+ofsx, block->maxy+5);
- ofsx= 22;
- }
-
- /* draw collapse icon */
-
- BIF_ThemeColor(TH_TEXT_HI);
-
- if(panel->flag & PNL_CLOSEDY)
- ui_draw_tria_icon(block->minx+6+ofsx, block->maxy+5, block->aspect, 'h');
- else if(panel->flag & PNL_CLOSEDX)
- ui_draw_tria_icon(block->minx+7, block->maxy+2, block->aspect, 'h');
- else
- ui_draw_tria_icon(block->minx+6+ofsx, block->maxy+5, block->aspect, 'v');
-
-
-}
-
-static void ui_redraw_select_panel(ScrArea *sa)
-{
- /* only for beauty, make sure the panel thats moved is on top */
- /* better solution later? */
- uiBlock *block;
-
- for(block= sa->uiblocks.first; block; block= block->next) {
- if(block->panel && (block->panel->flag & PNL_SELECT)) {
- uiDrawBlock(block);
- }
- }
-
-}
-
-
-/* ------------ panel alignment ---------------- */
-
-
-/* this function is needed because uiBlock and Panel itself dont
-change sizey or location when closed */
-static int get_panel_real_ofsy(Panel *pa)
-{
- if(pa->flag & PNL_CLOSEDY) return pa->ofsy+pa->sizey;
- else if(pa->paneltab && (pa->paneltab->flag & PNL_CLOSEDY)) return pa->ofsy+pa->sizey;
- else return pa->ofsy;
-}
-
-static int get_panel_real_ofsx(Panel *pa)
-{
- if(pa->flag & PNL_CLOSEDX) return pa->ofsx+PNL_HEADER;
- else if(pa->paneltab && (pa->paneltab->flag & PNL_CLOSEDX)) return pa->ofsx+PNL_HEADER;
- else return pa->ofsx+pa->sizex;
-}
-
-
-typedef struct PanelSort {
- Panel *pa, *orig;
-} PanelSort;
-
-/* note about sorting;
- the sortcounter has a lower value for new panels being added.
- however, that only works to insert a single panel, when more new panels get
- added the coordinates of existing panels and the previously stored to-be-insterted
- panels do not match for sorting */
-
-static int find_leftmost_panel(const void *a1, const void *a2)
-{
- const PanelSort *ps1=a1, *ps2=a2;
-
- if( ps1->pa->ofsx > ps2->pa->ofsx) return 1;
- else if( ps1->pa->ofsx < ps2->pa->ofsx) return -1;
- else if( ps1->pa->sortcounter > ps2->pa->sortcounter) return 1;
- else if( ps1->pa->sortcounter < ps2->pa->sortcounter) return -1;
-
- return 0;
-}
-
-
-static int find_highest_panel(const void *a1, const void *a2)
-{
- const PanelSort *ps1=a1, *ps2=a2;
-
- if( ps1->pa->ofsy < ps2->pa->ofsy) return 1;
- else if( ps1->pa->ofsy > ps2->pa->ofsy) return -1;
- else if( ps1->pa->sortcounter > ps2->pa->sortcounter) return 1;
- else if( ps1->pa->sortcounter < ps2->pa->sortcounter) return -1;
-
- return 0;
-}
-
-/* this doesnt draw */
-/* returns 1 when it did something */
-int uiAlignPanelStep(ScrArea *sa, float fac)
-{
- SpaceButs *sbuts= sa->spacedata.first;
- Panel *pa;
- PanelSort *ps, *panelsort, *psnext;
- static int sortcounter= 0;
- int a, tot=0, done;
-
- if(sa->spacetype!=SPACE_BUTS) {
- return 0;
- }
-
- /* count active, not tabbed Panels */
- for(pa= sa->panels.first; pa; pa= pa->next) {
- if(pa->active && pa->paneltab==NULL) tot++;
- }
-
- if(tot==0) return 0;
-
- /* extra; change close direction? */
- for(pa= sa->panels.first; pa; pa= pa->next) {
- if(pa->active && pa->paneltab==NULL) {
- if( (pa->flag & PNL_CLOSEDX) && (sbuts->align==BUT_VERTICAL) )
- pa->flag ^= PNL_CLOSED;
-
- else if( (pa->flag & PNL_CLOSEDY) && (sbuts->align==BUT_HORIZONTAL) )
- pa->flag ^= PNL_CLOSED;
-
- }
- }
-
- panelsort= MEM_callocN( tot*sizeof(PanelSort), "panelsort");
-
- /* fill panelsort array */
- ps= panelsort;
- for(pa= sa->panels.first; pa; pa= pa->next) {
- if(pa->active && pa->paneltab==NULL) {
- ps->pa= MEM_dupallocN(pa);
- ps->orig= pa;
- ps++;
- }
- }
-
- if(sbuts->align==BUT_VERTICAL)
- qsort(panelsort, tot, sizeof(PanelSort), find_highest_panel);
- else
- qsort(panelsort, tot, sizeof(PanelSort), find_leftmost_panel);
-
-
- /* no smart other default start loc! this keeps switching f5/f6/etc compatible */
- ps= panelsort;
- ps->pa->ofsx= 0;
- ps->pa->ofsy= 0;
-
- for(a=0 ; a<tot-1; a++, ps++) {
- psnext= ps+1;
-
- if(sbuts->align==BUT_VERTICAL) {
- psnext->pa->ofsx = ps->pa->ofsx;
- psnext->pa->ofsy = get_panel_real_ofsy(ps->pa) - psnext->pa->sizey-PNL_HEADER-PNL_DIST;
- }
- else {
- psnext->pa->ofsx = get_panel_real_ofsx(ps->pa)+PNL_DIST;
- psnext->pa->ofsy = ps->pa->ofsy + ps->pa->sizey - psnext->pa->sizey;
- }
- }
-
- /* we interpolate */
- done= 0;
- ps= panelsort;
- for(a=0; a<tot; a++, ps++) {
- if( (ps->pa->flag & PNL_SELECT)==0) {
- if( (ps->orig->ofsx != ps->pa->ofsx) || (ps->orig->ofsy != ps->pa->ofsy)) {
- ps->orig->ofsx= floor(0.5 + fac*ps->pa->ofsx + (1.0-fac)*ps->orig->ofsx);
- ps->orig->ofsy= floor(0.5 + fac*ps->pa->ofsy + (1.0-fac)*ps->orig->ofsy);
- done= 1;
- }
- }
- }
-
- /* copy locations to tabs */
- for(pa= sa->panels.first; pa; pa= pa->next) {
- if(pa->paneltab && pa->active) {
- copy_panel_offset(pa, pa->paneltab);
- }
- }
-
- /* set counter, used for sorting with newly added panels */
- sortcounter++;
- for(pa= sa->panels.first; pa; pa= pa->next) {
- if(pa->active) pa->sortcounter= sortcounter;
- }
-
- /* free panelsort array */
- ps= panelsort;
- for(a=0; a<tot; a++, ps++) {
- MEM_freeN(ps->pa);
- }
- MEM_freeN(panelsort);
-
- return done;
-}
-
-
-static void ui_animate_panels(ScrArea *sa)
-{
- double time=0, ltime;
- float result= 0.0, fac= 0.2;
-
- ltime = PIL_check_seconds_timer();
-
- /* for max 1 second, interpolate positions */
- while(TRUE) {
-
- if( uiAlignPanelStep(sa, fac) ) {
- /* warn: this re-allocs uiblocks! */
- scrarea_do_windraw(curarea);
- ui_redraw_select_panel(curarea);
- screen_swapbuffers();
- }
- else {
- addqueue(curarea->win, REDRAW,1 ); // because 'Animate' is also called as redraw
- break;
- }
-
- if(result >= 1.0) break;
-
- if(result==0.0) { // firsttime
- time = PIL_check_seconds_timer()-ltime;
- if(time > 0.5) fac= 0.7;
- else if(time > 0.2) fac= 0.5;
- else if(time > 0.1) fac= 0.4;
- else if(time > 0.05) fac= 0.3; // 11 steps
- }
-
- result= fac + (1.0-fac)*result;
-
- if(result > 0.98) {
- result= 1.0;
- fac= 1.0;
- }
- }
-}
-
-/* only draws blocks with panels */
-void uiDrawBlocksPanels(ScrArea *sa, int re_align)
-{
- uiBlock *block;
- Panel *panot, *panew, *patest;
-
- /* scaling contents */
- block= sa->uiblocks.first;
- while(block) {
- if(block->panel) ui_scale_panel_block(block);
- block= block->next;
- }
-
- /* consistancy; are panels not made, whilst they have tabs */
- for(panot= sa->panels.first; panot; panot= panot->next) {
- if(panot->active==0) { // not made
-
- for(panew= sa->panels.first; panew; panew= panew->next) {
- if(panew->active) {
- if(panew->paneltab==panot) { // panew is tab in notmade pa
- break;
- }
- }
- }
- /* now panew can become the new parent, check all other tabs */
- if(panew) {
- for(patest= sa->panels.first; patest; patest= patest->next) {
- if(patest->paneltab == panot) {
- patest->paneltab= panew;
- }
- }
- panot->paneltab= panew;
- panew->paneltab= NULL;
- addqueue(sa->win, REDRAW, 1); // the buttons panew were not made
- }
- }
- }
-
- /* re-align */
- if(re_align) uiAlignPanelStep(sa, 1.0);
-
- if(sa->spacetype!=SPACE_BUTS) {
- SpaceLink *sl= sa->spacedata.first;
- for(block= sa->uiblocks.first; block; block= block->next) {
- if(block->panel && block->panel->active && block->panel->paneltab == NULL) {
- float dx=0.0, dy=0.0, minx, miny, maxx, maxy, miny_panel;
-
- minx= sl->blockscale*block->panel->ofsx;
- maxx= sl->blockscale*(block->panel->ofsx+block->panel->sizex);
- miny= sl->blockscale*(block->panel->ofsy+block->panel->sizey);
- maxy= sl->blockscale*(block->panel->ofsy+block->panel->sizey+PNL_HEADER);
- miny_panel= sl->blockscale*(block->panel->ofsy);
-
- /* check to see if snapped panels have been left out in the open by resizing a window
- * and if so, offset them back to where they belong */
- if (block->panel->snap) {
- if (((block->panel->snap) & PNL_SNAP_RIGHT) &&
- (maxx < (float)sa->winx)) {
-
- dx = sa->winx-maxx;
- block->panel->ofsx+= dx/sl->blockscale;
- }
- if (((block->panel->snap) & PNL_SNAP_TOP) &&
- (maxy < (float)sa->winy)) {
-
- dy = sa->winy-maxy;
- block->panel->ofsy+= dy/sl->blockscale;
- }
-
- /* reset these vars with updated panel offset distances */
- minx= sl->blockscale*block->panel->ofsx;
- maxx= sl->blockscale*(block->panel->ofsx+block->panel->sizex);
- miny= sl->blockscale*(block->panel->ofsy+block->panel->sizey);
- maxy= sl->blockscale*(block->panel->ofsy+block->panel->sizey+PNL_HEADER);
- miny_panel= sl->blockscale*(block->panel->ofsy);
- } else
- /* reset to no snapping */
- block->panel->snap = PNL_SNAP_NONE;
-
-
- /* clip panels (headers) for non-butspace situations (maybe make optimized event later) */
-
- /* check left and right edges */
- if (minx < PNL_SNAP_DIST) {
- dx = -minx;
- block->panel->snap |= PNL_SNAP_LEFT;
- }
- else if (maxx > ((float)sa->winx - PNL_SNAP_DIST)) {
- dx= sa->winx-maxx;
- block->panel->snap |= PNL_SNAP_RIGHT;
- }
- if( minx + dx < 0.0) dx= -minx; // when panel cant fit, put it fixed here
-
- /* check top and bottom edges */
- if ((miny_panel < PNL_SNAP_DIST) && (miny_panel > -PNL_SNAP_DIST)) {
- dy= -miny_panel;
- block->panel->snap |= PNL_SNAP_BOTTOM;
- }
- if(miny < PNL_SNAP_DIST) {
- dy= -miny;
- block->panel->snap |= PNL_SNAP_BOTTOM;
- }
- else if(maxy > ((float)sa->winy - PNL_SNAP_DIST)) {
- dy= sa->winy-maxy;
- block->panel->snap |= PNL_SNAP_TOP;
- }
- if( miny + dy < 0.0) dy= -miny; // when panel cant fit, put it fixed here
-
-
- block->panel->ofsx+= dx/sl->blockscale;
- block->panel->ofsy+= dy/sl->blockscale;
-
- /* copy locations */
- for(patest= sa->panels.first; patest; patest= patest->next) {
- if(patest->paneltab==block->panel) copy_panel_offset(patest, block->panel);
- }
-
- }
- }
- }
-
- /* draw */
- block= sa->uiblocks.first;
- while(block) {
- if(block->panel) uiDrawBlock(block);
- block= block->next;
- }
-
-}
-
-
-
-/* ------------ panel merging ---------------- */
-
-static void check_panel_overlap(ScrArea *sa, Panel *panel)
-{
- Panel *pa= sa->panels.first;
-
- /* also called with panel==NULL for clear */
-
- while(pa) {
- pa->flag &= ~PNL_OVERLAP;
- if(panel && (pa != panel)) {
- if(pa->paneltab==NULL && pa->active) {
- float safex= 0.2, safey= 0.2;
-
- if( pa->flag & PNL_CLOSEDX) safex= 0.05;
- else if(pa->flag & PNL_CLOSEDY) safey= 0.05;
- else if( panel->flag & PNL_CLOSEDX) safex= 0.05;
- else if(panel->flag & PNL_CLOSEDY) safey= 0.05;
-
- if( pa->ofsx > panel->ofsx- safex*panel->sizex)
- if( pa->ofsx+pa->sizex < panel->ofsx+ (1.0+safex)*panel->sizex)
- if( pa->ofsy > panel->ofsy- safey*panel->sizey)
- if( pa->ofsy+pa->sizey < panel->ofsy+ (1.0+safey)*panel->sizey)
- pa->flag |= PNL_OVERLAP;
- }
- }
-
- pa= pa->next;
- }
-}
-
-static void test_add_new_tabs(ScrArea *sa)
-{
- Panel *pa, *pasel=NULL, *palap=NULL;
- /* search selected and overlapped panel */
-
- pa= sa->panels.first;
- while(pa) {
- if(pa->active) {
- if(pa->flag & PNL_SELECT) pasel= pa;
- if(pa->flag & PNL_OVERLAP) palap= pa;
- }
- pa= pa->next;
- }
-
- if(pasel && palap==NULL) {
-
- /* copy locations */
- pa= sa->panels.first;
- while(pa) {
- if(pa->paneltab==pasel) {
- copy_panel_offset(pa, pasel);
- }
- pa= pa->next;
- }
- }
-
- if(pasel==NULL || palap==NULL) return;
-
- /* the overlapped panel becomes a tab */
- palap->paneltab= pasel;
-
- /* the selected panel gets coords of overlapped one */
- copy_panel_offset(pasel, palap);
-
- /* and its tabs */
- pa= sa->panels.first;
- while(pa) {
- if(pa->paneltab == pasel) {
- copy_panel_offset(pa, palap);
- }
- pa= pa->next;
- }
-
- /* but, the overlapped panel already can have tabs too! */
- pa= sa->panels.first;
- while(pa) {
- if(pa->paneltab == palap) {
- pa->paneltab = pasel;
- }
- pa= pa->next;
- }
-}
-
-/* ------------ panel drag ---------------- */
-
-
-static void ui_drag_panel(uiBlock *block, int doscale)
-{
- Panel *panel= block->panel;
- short align=0, first=1, dx=0, dy=0, dxo=0, dyo=0, mval[2], mvalo[2];
- short ofsx, ofsy, sizex, sizey;
-
- if(curarea->spacetype==SPACE_BUTS) {
- SpaceButs *sbuts= curarea->spacedata.first;
- align= sbuts->align;
- }
-
- uiGetMouse(block->win, mvalo);
- ofsx= block->panel->ofsx;
- ofsy= block->panel->ofsy;
- sizex= block->panel->sizex;
- sizey= block->panel->sizey;
-
- panel->flag |= PNL_SELECT;
-
- /* exception handling, 3d window preview panel */
- if(block->drawextra==BIF_view3d_previewdraw)
- BIF_view3d_previewrender_clear(curarea);
-
- while(TRUE) {
-
- if( !(get_mbut() & L_MOUSE) ) break;
-
- /* first clip for window, no dragging outside */
- getmouseco_areawin(mval);
- if( mval[0]>0 && mval[0]<curarea->winx && mval[1]>0 && mval[1]<curarea->winy) {
- uiGetMouse(mywinget(), mval);
- dx= (mval[0]-mvalo[0]) & ~(PNL_GRID-1);
- dy= (mval[1]-mvalo[1]) & ~(PNL_GRID-1);
- }
-
- if(dx!=dxo || dy!=dyo || first || align) {
- dxo= dx; dyo= dy;
- first= 0;
-
- if(doscale) {
- panel->sizex = MAX2(sizex+dx, UI_PANEL_MINX);
-
- if(sizey-dy < UI_PANEL_MINY) {
- dy= -UI_PANEL_MINY+sizey;
- }
- panel->sizey = sizey-dy;
-
- panel->ofsy= ofsy+dy;
-
- }
- else {
- /* reset the panel snapping, to allow dragging away from snapped edges */
- panel->snap = PNL_SNAP_NONE;
-
- panel->ofsx = ofsx+dx;
- panel->ofsy = ofsy+dy;
- check_panel_overlap(curarea, panel);
-
- if(align) uiAlignPanelStep(curarea, 0.2);
- }
-
- /* warn: this re-allocs blocks! */
- scrarea_do_windraw(curarea);
- ui_redraw_select_panel(curarea);
- screen_swapbuffers();
-
- /* so, we find the new block */
- block= curarea->uiblocks.first;
- while(block) {
- if(block->panel == panel) break;
- block= block->next;
- }
- // temporal debug
- if(block==NULL) {
- printf("block null while panel drag, should not happen\n");
- }
-
- /* restore */
- Mat4CpyMat4(UIwinmat, block->winmat);
-
- /* idle for align */
- if(dx==dxo && dy==dyo) PIL_sleep_ms(30);
- }
- /* idle for this poor code */
- else PIL_sleep_ms(30);
- }
-
- test_add_new_tabs(curarea); // also copies locations of tabs in dragged panel
-
- panel->flag &= ~PNL_SELECT;
- check_panel_overlap(curarea, NULL); // clears
-
- if(align==0) addqueue(block->win, REDRAW, 1);
- else ui_animate_panels(curarea);
-
- /* exception handling, 3d window preview panel */
- if(block->drawextra==BIF_view3d_previewdraw)
- BIF_view3d_previewrender_signal(curarea, PR_DISPRECT);
- else if(strcmp(block->name, "image_panel_preview")==0)
- image_preview_event(2);
-}
-
-
-static void ui_panel_untab(uiBlock *block)
-{
- Panel *panel= block->panel, *pa, *panew=NULL;
- short nr, mval[2], mvalo[2];
-
- /* while hold mouse, check for movement, then untab */
-
- uiGetMouse(block->win, mvalo);
- while(TRUE) {
-
- if( !(get_mbut() & L_MOUSE) ) break;
- uiGetMouse(mywinget(), mval);
-
- if( abs(mval[0]-mvalo[0]) + abs(mval[1]-mvalo[1]) > 6 ) {
- /* find new parent panel */
- nr= 0;
- pa= curarea->panels.first;
- while(pa) {
- if(pa->paneltab==panel) {
- panew= pa;
- nr++;
- }
- pa= pa->next;
- }
-
- /* make old tabs point to panew */
- if(panew==NULL) printf("panel untab: shouldnt happen\n");
- panew->paneltab= NULL;
-
- pa= curarea->panels.first;
- while(pa) {
- if(pa->paneltab==panel) {
- pa->paneltab= panew;
- }
- pa= pa->next;
- }
-
- ui_drag_panel(block, 0);
- break;
-
- }
- /* idle for this poor code */
- else PIL_sleep_ms(50);
-
- }
-
-}
-
-/* ------------ panel events ---------------- */
-
-
-static void panel_clicked_tabs(uiBlock *block, int mousex)
-{
- Panel *pa, *tabsel=NULL, *panel= block->panel;
- int nr= 1, a, width, ofsx;
-
- ofsx= PNL_ICON;
- if(block->panel->control & UI_PNL_CLOSE) ofsx+= PNL_ICON;
-
-
- /* count */
- pa= curarea->panels.first;
- while(pa) {
- if(pa!=panel) {
- if(pa->paneltab==panel) nr++;
- }
- pa= pa->next;
- }
-
- if(nr==1) return;
-
- /* find clicked tab, mouse in panel coords */
- a= 0;
- width= (int)((float)(panel->sizex - ofsx-10)/nr);
- pa= curarea->panels.first;
- while(pa) {
- if(pa==panel || pa->paneltab==panel) {
- if( (mousex > ofsx+a*width) && (mousex < ofsx+(a+1)*width) ) {
- tabsel= pa;
- break;
- }
- a++;
- }
- pa= pa->next;
- }
-
- if(tabsel) {
-
- if(tabsel == panel) {
- ui_panel_untab(block);
- }
- else {
- /* tabsel now becomes parent for all others */
- panel->paneltab= tabsel;
- tabsel->paneltab= NULL;
-
- pa= curarea->panels.first;
- while(pa) {
- if(pa->paneltab == panel) pa->paneltab = tabsel;
- pa= pa->next;
- }
-
- addqueue(curarea->win, REDRAW, 1);
-
- /* panels now differ size.. */
- if(curarea->spacetype==SPACE_BUTS) {
- SpaceButs *sbuts= curarea->spacedata.first;
- if(sbuts->align)
- uiAlignPanelStep(curarea, 1.0);
- }
- }
- }
-
-}
-
-/* disabled /deprecated now, panels minimise in place */
-#if 0
-static void stow_unstow(uiBlock *block)
-{
- SpaceLink *sl= curarea->spacedata.first;
- Panel *pa;
- int ok=0, x, y, width;
-
- if(block->panel->flag & PNL_CLOSEDY) { // flag has been set how it should become!
-
- width= (curarea->winx-320)/sl->blockscale;
- if(width<5) width= 5;
-
- /* find empty spot in bottom */
- for(y=4; y<100; y+= PNL_HEADER+4) {
- for(x=4; x<width; x+= 324) {
- ok= 1;
- /* check overlap with other panels */
- for(pa=curarea->panels.first; pa; pa=pa->next) {
- if(pa!=block->panel && pa->active && pa->paneltab==NULL) {
- if( abs(pa->ofsx-x)<320 ) {
- if( abs(pa->ofsy+pa->sizey-y)<PNL_HEADER+4) ok= 0;
- }
- }
- }
-
- if(ok) break;
- }
- if(ok) break;
- }
- if(ok==0) printf("still primitive code... fix!\n");
-
- block->panel->old_ofsx= block->panel->ofsx;
- block->panel->old_ofsy= block->panel->ofsy;
-
- block->panel->ofsx= x;
- block->panel->ofsy= y-block->panel->sizey;
-
- }
- else {
- block->panel->ofsx= block->panel->old_ofsx;
- block->panel->ofsy= block->panel->old_ofsy;
-
- }
- /* copy locations */
- for(pa= curarea->panels.first; pa; pa= pa->next) {
- if(pa->paneltab==block->panel) copy_panel_offset(pa, block->panel);
- }
-
-}
-#endif
-
-
-/* this function is supposed to call general window drawing too */
-/* also it supposes a block has panel, and isnt a menu */
-void ui_do_panel(uiBlock *block, uiEvent *uevent)
-{
- Panel *pa;
- int align= 0;
-
- if(curarea->spacetype==SPACE_BUTS) {
- SpaceButs *sbuts= curarea->spacedata.first;
- align= sbuts->align;
- }
-
- /* mouse coordinates in panel space! */
-
- if(uevent->event==LEFTMOUSE && block->panel->paneltab==NULL) {
- int button= 0;
-
- /* check open/collapsed button */
- if(block->panel->flag & PNL_CLOSEDX) {
- if(uevent->mval[1] >= block->maxy) button= 1;
- }
- else if(block->panel->control & UI_PNL_CLOSE) {
- if(uevent->mval[0] <= block->minx+PNL_ICON-2) button= 2;
- else if(uevent->mval[0] <= block->minx+2*PNL_ICON+2) button= 1;
- }
- else if(uevent->mval[0] <= block->minx+PNL_ICON+2) {
- button= 1;
- }
-
- if(button) {
-
- if(button==2) { // close
- rem_blockhandler(curarea, block->handler);
- addqueue(curarea->win, REDRAW, 1);
- }
- else { // collapse
-
- if(block->panel->flag & PNL_CLOSED) {
- block->panel->flag &= ~PNL_CLOSED;
- /* snap back up so full panel aligns with screen edge */
- if (block->panel->snap & PNL_SNAP_BOTTOM)
- block->panel->ofsy= 0;
- }
- else if(align==BUT_HORIZONTAL) block->panel->flag |= PNL_CLOSEDX;
- else {
- /* snap down to bottom screen edge*/
- block->panel->flag |= PNL_CLOSEDY;
- if (block->panel->snap & PNL_SNAP_BOTTOM)
- block->panel->ofsy= -block->panel->sizey;
- }
-
- for(pa= curarea->panels.first; pa; pa= pa->next) {
- if(pa->paneltab==block->panel) {
- if(block->panel->flag & PNL_CLOSED) pa->flag |= PNL_CLOSED;
- else pa->flag &= ~PNL_CLOSED;
- }
- }
- }
- if(align==0) addqueue(block->win, REDRAW, 1);
- else ui_animate_panels(curarea);
-
- }
- else if(block->panel->flag & PNL_CLOSED) {
- ui_drag_panel(block, 0);
- }
- /* check if clicked in tabbed area */
- else if(uevent->mval[0] < block->maxx-PNL_ICON-3 && panel_has_tabs(block->panel)) {
- panel_clicked_tabs(block, uevent->mval[0]);
- }
- else {
- ui_drag_panel(block, 0);
- }
- }
-}
-
-/* panel with scaling widget */
-void ui_scale_panel(uiBlock *block)
-{
- if(block->panel->flag & PNL_CLOSED)
- return;
-
- ui_drag_panel(block, 1);
-}
-
-
diff --git a/source/blender/src/keyval.c b/source/blender/src/keyval.c
deleted file mode 100644
index 79445fa7aa2..00000000000
--- a/source/blender/src/keyval.c
+++ /dev/null
@@ -1,354 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BIF_keyval.h"
-#include "blendef.h"
-#include "mydevice.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-char *key_event_to_string(unsigned short event)
-{
-
- switch(event) {
- case AKEY:
- return "A";
- break;
- case BKEY:
- return "B";
- break;
- case CKEY:
- return "C";
- break;
- case DKEY:
- return "D";
- break;
- case EKEY:
- return "E";
- break;
- case FKEY:
- return "F";
- break;
- case GKEY:
- return "G";
- break;
- case HKEY:
- return "H";
- break;
- case IKEY:
- return "I";
- break;
- case JKEY:
- return "J";
- break;
- case KKEY:
- return "K";
- break;
- case LKEY:
- return "L";
- break;
- case MKEY:
- return "M";
- break;
- case NKEY:
- return "N";
- break;
- case OKEY:
- return "O";
- break;
- case PKEY:
- return "P";
- break;
- case QKEY:
- return "Q";
- break;
- case RKEY:
- return "R";
- break;
- case SKEY:
- return "S";
- break;
- case TKEY:
- return "T";
- break;
- case UKEY:
- return "U";
- break;
- case VKEY:
- return "V";
- break;
- case WKEY:
- return "W";
- break;
- case XKEY:
- return "X";
- break;
- case YKEY:
- return "Y";
- break;
- case ZKEY:
- return "Z";
- break;
-
- case ZEROKEY:
- return "Zero";
- break;
- case ONEKEY:
- return "One";
- break;
- case TWOKEY:
- return "Two";
- break;
- case THREEKEY:
- return "Three";
- break;
- case FOURKEY:
- return "Four";
- break;
- case FIVEKEY:
- return "Five";
- break;
- case SIXKEY:
- return "Six";
- break;
- case SEVENKEY:
- return "Seven";
- break;
- case EIGHTKEY:
- return "Eight";
- break;
- case NINEKEY:
- return "Nine";
- break;
-
- case LEFTCTRLKEY:
- return "Leftctrl";
- break;
- case LEFTALTKEY:
- return "Leftalt";
- break;
- case RIGHTALTKEY:
- return "Rightalt";
- break;
- case RIGHTCTRLKEY:
- return "Rightctrl";
- break;
- case RIGHTSHIFTKEY:
- return "Rightshift";
- break;
- case LEFTSHIFTKEY:
- return "Leftshift";
- break;
-
- case ESCKEY:
- return "Esc";
- break;
- case TABKEY:
- return "Tab";
- break;
- case RETKEY:
- return "Ret";
- break;
- case SPACEKEY:
- return "Space";
- break;
- case LINEFEEDKEY:
- return "Linefeed";
- break;
- case BACKSPACEKEY:
- return "Backspace";
- break;
- case DELKEY:
- return "Del";
- break;
- case SEMICOLONKEY:
- return "Semicolon";
- break;
- case PERIODKEY:
- return "Period";
- break;
- case COMMAKEY:
- return "Comma";
- break;
- case QUOTEKEY:
- return "Quote";
- break;
- case ACCENTGRAVEKEY:
- return "Accentgrave";
- break;
- case MINUSKEY:
- return "Minus";
- break;
- case SLASHKEY:
- return "Slash";
- break;
- case BACKSLASHKEY:
- return "Backslash";
- break;
- case EQUALKEY:
- return "Equal";
- break;
- case LEFTBRACKETKEY:
- return "Leftbracket";
- break;
- case RIGHTBRACKETKEY:
- return "Rightbracket";
- break;
-
- case LEFTARROWKEY:
- return "Leftarrow";
- break;
- case DOWNARROWKEY:
- return "Downarrow";
- break;
- case RIGHTARROWKEY:
- return "Rightarrow";
- break;
- case UPARROWKEY:
- return "Uparrow";
- break;
-
- case PAD2:
- return "Pad2";
- break;
- case PAD4:
- return "Pad4";
- break;
- case PAD6:
- return "Pad6";
- break;
- case PAD8:
- return "Pad8";
- break;
- case PAD1:
- return "Pad1";
- break;
- case PAD3:
- return "Pad3";
- break;
- case PAD5:
- return "Pad5";
- break;
- case PAD7:
- return "Pad7";
- break;
- case PAD9:
- return "Pad9";
- break;
-
- case PADPERIOD:
- return "Padperiod";
- break;
- case PADSLASHKEY:
- return "Padslash";
- break;
- case PADASTERKEY:
- return "Padaster";
- break;
-
- case PAD0:
- return "Pad0";
- break;
- case PADMINUS:
- return "Padminus";
- break;
- case PADENTER:
- return "Padenter";
- break;
- case PADPLUSKEY:
- return "Padplus";
- break;
-
- case F1KEY:
- return "F1";
- break;
- case F2KEY:
- return "F2";
- break;
- case F3KEY:
- return "F3";
- break;
- case F4KEY:
- return "F4";
- break;
- case F5KEY:
- return "F5";
- break;
- case F6KEY:
- return "F6";
- break;
- case F7KEY:
- return "F7";
- break;
- case F8KEY:
- return "F8";
- break;
- case F9KEY:
- return "F9";
- break;
- case F10KEY:
- return "F10";
- break;
- case F11KEY:
- return "F11";
- break;
- case F12KEY:
- return "F12";
- break;
-
- case PAUSEKEY:
- return "Pause";
- break;
- case INSERTKEY:
- return "Insert";
- break;
- case HOMEKEY:
- return "Home";
- break;
- case PAGEUPKEY:
- return "Pageup";
- break;
- case PAGEDOWNKEY:
- return "Pagedown";
- break;
- case ENDKEY:
- return "End";
- break;
- }
-
- return "";
-}
diff --git a/source/blender/src/language.c b/source/blender/src/language.c
deleted file mode 100644
index 5eb4bf3dc61..00000000000
--- a/source/blender/src/language.c
+++ /dev/null
@@ -1,453 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is written by Rob Haarsma (phase)
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-
-#include <string.h>
-#include <stdlib.h>
-
-#include "DNA_listBase.h"
-#include "DNA_userdef_types.h"
-#include "DNA_vec_types.h"
-
-#include "BKE_global.h" /* G */
-#include "BKE_utildefines.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_linklist.h" /* linknode */
-
-#include "BIF_gl.h"
-#include "BIF_language.h"
-#include "BIF_space.h" /* allqueue() */
-#include "BIF_toolbox.h" /* error() */
-#include "datatoc.h" /* std font */
-
-#include "MEM_guardedalloc.h" /* vprintf, etc ??? */
-
-#include "mydevice.h" /* REDRAWALL */
-
-#include "BMF_Api.h"
-
-#ifdef WITH_ICONV
-#include "iconv.h"
-
-void string_to_utf8(char *original, char *utf_8, char *code)
-{
- size_t inbytesleft=strlen(original);
- size_t outbytesleft=512;
- size_t rv=0;
- iconv_t cd;
-
- cd=iconv_open("UTF-8", code);
-
- if (cd == (iconv_t)(-1)) {
- printf("iconv_open Error");
- *utf_8='\0';
- return ;
- }
- rv=iconv(cd, &original, &inbytesleft, &utf_8, &outbytesleft);
- if (rv == (size_t) -1) {
- printf("iconv Error\n");
- return ;
- }
- *utf_8 = '\0';
- iconv_close(cd);
-}
-#endif // WITH_ICONV
-
-#ifdef INTERNATIONAL
-#include "FTF_Api.h"
-
-static struct LANGMenuEntry *langmenu= 0;
-static int tot_lang = 0;
-
-#endif // INTERNATIONAL
-
-void BIF_RasterPos(float x, float y)
-{
-#ifdef INTERNATIONAL
- FTF_SetPosition(x, y);
-#endif // INTERNATIONAL
-}
-
-void BIF_SetScale(float aspect)
-{
-#ifdef INTERNATIONAL
- FTF_SetScale(aspect);
-#endif // INTERNATIONAL
-}
-
-void refresh_interface_font(void)
-{
-#ifdef INTERNATIONAL
- if(U.transopts & USER_DOTRANSLATE)
- start_interface_font();
- else
- G.ui_international = FALSE;
-#else // INTERNATIONAL
- G.ui_international = FALSE;
-#endif
-}
-
-int BIF_DrawString(BMF_Font* font, char *str, int translate)
-{
-
-#ifdef INTERNATIONAL
- if(G.ui_international == TRUE) {
- if(translate)
- {
-#ifdef WITH_ICONV
- if(translate & CONVERT_TO_UTF8) {
- char utf_8[512];
-
- struct LANGMenuEntry *lme;
- lme = find_language(U.language);
-
- if (lme !=NULL) {
- if (!strcmp(lme->code, "ja_JP"))
- string_to_utf8(str, utf_8, "Shift_JIS"); /* Japanese */
- else if (!strcmp(lme->code, "zh_CN"))
- string_to_utf8(str, utf_8, "GB2312"); /* Chinese */
- }
-
- return FTF_DrawString(utf_8, FTF_INPUT_UTF8);
- }
- else
-#endif // WITH_ICONV
- return FTF_DrawString(str, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
- }
- else
- return FTF_DrawString(str, FTF_NO_TRANSCONV | FTF_INPUT_UTF8);
- } else {
- return BMF_DrawString(font, str);
- }
-#else // INTERNATIONAL
- return BMF_DrawString(font, str);
-#endif
-
-}
-
-
-float BIF_GetStringWidth(BMF_Font* font, char *str, int translate)
-{
- float rt;
-
-#ifdef INTERNATIONAL
- if(G.ui_international == TRUE)
- if(translate && (U.transopts & USER_TR_BUTTONS))
- rt= FTF_GetStringWidth(str, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
- else
- rt= FTF_GetStringWidth(str, FTF_NO_TRANSCONV | FTF_INPUT_UTF8);
- else
- rt= BMF_GetStringWidth(font, str);
-#else
- rt= BMF_GetStringWidth(font, str);
-#endif
-
- return rt;
-}
-
-void BIF_GetBoundingBox(struct BMF_Font* font, char* str, int translate, rctf *bbox){
-#ifdef INTERNATIONAL
- float dummy;
- if(G.ui_international == TRUE)
- if(translate && (U.transopts & USER_TR_BUTTONS))
- FTF_GetBoundingBox(str, &bbox->xmin, &bbox->ymin, &dummy, &bbox->xmax, &bbox->ymax, &dummy, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
- else
- FTF_GetBoundingBox(str, &bbox->xmin, &bbox->ymin, &dummy, &bbox->xmax, &bbox->ymax, &dummy, FTF_NO_TRANSCONV | FTF_INPUT_UTF8);
- else
- BMF_GetStringBoundingBox(font, str, &bbox->xmin, &bbox->ymin, &bbox->xmax, &bbox->ymax);
-#else
- BMF_GetStringBoundingBox(font, str, &bbox->xmin, &bbox->ymin, &bbox->xmax, &bbox->ymax);
-#endif
-}
-
-
-#ifdef INTERNATIONAL
-
-char *fontsize_pup(void)
-{
- static char string[1024];
- char formatstring[1024];
-
- strcpy(formatstring, "Choose Font Size: %%t|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d");
-
- sprintf(string, formatstring,
- "Font Size: 8", 8,
- "Font Size: 9", 9,
- "Font Size: 10", 10,
- "Font Size: 11", 11,
- "Font Size: 12", 12,
- "Font Size: 13", 13,
- "Font Size: 14", 14,
- "Font Size: 15", 15,
- "Font Size: 16", 16
- );
-
- return (string);
-}
-
-
-char *language_pup(void)
-{
- struct LANGMenuEntry *lme = langmenu;
- static char string[1024];
- static char tmp[1024];
-
- if(tot_lang == 0)
- sprintf(string, "Choose Language: %%t|Language: English %%x0");
- else {
- sprintf(string, "Choose Language: %%t");
- while(lme) {
- sprintf(tmp, "|Language: %s %%x%d", lme->language, lme->id);
- strcat(string, tmp);
- lme= lme->next;
- }
- }
-
- return string;
-}
-
-
-struct LANGMenuEntry *find_language(short langid)
-{
- struct LANGMenuEntry *lme = langmenu;
-
- while(lme) {
- if(lme->id == langid)
- return lme;
-
- lme=lme->next;
- }
- return NULL;
-}
-
-
-void lang_setlanguage(void)
-{
- struct LANGMenuEntry *lme;
-
- lme = find_language(U.language);
- if(lme) FTF_SetLanguage(lme->code);
- else FTF_SetLanguage("en_US");
-}
-
-/* called from fileselector */
-void set_interface_font(char *str)
-{
-
- /* this test needed because fileselect callback can happen after disable AA fonts */
- if(U.transopts & USER_DOTRANSLATE) {
- if(FTF_SetFont((unsigned char*)str, 0, U.fontsize)) {
- lang_setlanguage();
-
- if(strlen(str) < FILE_MAXDIR) strcpy(U.fontname, str);
- G.ui_international = TRUE;
- }
- else {
- U.fontname[0]= 0;
- FTF_SetFont((unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size, U.fontsize);
- G.ui_international = TRUE; // this case will switch to standard font
- okee("Invalid font selection - reverting to built-in font.");
- }
- allqueue(REDRAWALL, 0);
- }
-}
-
-
-void start_interface_font(void)
-{
- int result = 0;
-
- if(U.transopts & USER_USETEXTUREFONT)
- FTF_SetMode(FTF_TEXTUREFONT);
- else
- FTF_SetMode(FTF_PIXMAPFONT);
-
- if(U.fontsize && U.fontname[0] ) { // we have saved user settings + fontpath
-
- // try loading font from U.fontname = full path to font in usersettings
- result = FTF_SetFont((unsigned char*)U.fontname, 0, U.fontsize);
- }
- else if(U.fontsize) { // user settings, default
- result = FTF_SetFont((unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size, U.fontsize);
- }
-
- if(result==0) { // use default
- U.language= 0;
- U.fontsize= 11;
- U.encoding= 0;
- U.fontname[0]= 0;
- result = FTF_SetFont((unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size, U.fontsize);
- }
-
- if(result) {
-
- lang_setlanguage();
-
- G.ui_international = TRUE;
- }
- else {
- printf("no font found for international support\n");
- G.ui_international = FALSE;
- U.transopts &= ~USER_DOTRANSLATE;
- U.fontsize = 0;
- }
-
- allqueue(REDRAWALL, 0);
-}
-
-
-static char *first_dpointchar(char *string)
-{
- char *dpointchar;
-
- dpointchar= strchr(string, ':');
-
- return dpointchar;
-}
-
-
-static void splitlangline(char *line, struct LANGMenuEntry *lme)
-{
- char *dpointchar= first_dpointchar(line);
-
- if (dpointchar) {
- lme->code= BLI_strdup(dpointchar+1);
- *(dpointchar)=0;
- lme->language= BLI_strdup(line);
- } else {
- error("Invalid language file");
- }
-}
-
-
-static void puplang_insert_entry(char *line)
-{
- struct LANGMenuEntry *lme, *prev;
- int sorted = 0;
-
- prev= NULL;
- lme= langmenu;
-
- for (; lme; prev= lme, lme= lme->next) {
- if (lme->line) {
- if (BLI_streq(line, lme->line)) {
- return;
- } else if (sorted && strcmp(line, lme->line)<0) {
- break;
- }
- }
- }
-
- lme= MEM_mallocN(sizeof(*lme), "lme");
- lme->line = BLI_strdup(line);
- splitlangline(line, lme);
- lme->id = tot_lang;
- tot_lang++;
-
- if (prev) {
- lme->next= prev->next;
- prev->next= lme;
- } else {
- lme->next= langmenu;
- langmenu= lme;
- }
-}
-
-
-int read_languagefile(void)
-{
- char name[FILE_MAXDIR+FILE_MAXFILE];
- LinkNode *l, *lines;
-
- /* .Blanguages, http://www.blender3d.org/cms/Installation_Policy.352.0.html*/
-#if defined (__APPLE__) || (WIN32)
- BLI_make_file_string("/", name, BLI_gethome(), ".Blanguages");
-#else
- BLI_make_file_string("/", name, BLI_gethome(), ".blender/.Blanguages");
-#endif
-
- lines= BLI_read_file_as_lines(name);
-
- if(lines == NULL) {
- /* If not found in home, try current dir
- * (Resources folder of app bundle on OS X) */
-#if defined (__APPLE__)
- char *bundlePath = BLI_getbundle();
- strcpy(name, bundlePath);
- strcat(name, "/Contents/Resources/.Blanguages");
-#else
- /* Check the CWD. Takes care of the case where users
- * unpack blender tarball; cd blender-dir; ./blender */
- strcpy(name, ".blender/.Blanguages");
-#endif
- lines= BLI_read_file_as_lines(name);
-
- if(lines == NULL) {
- /* If not found in .blender, try current dir */
- strcpy(name, ".Blanguages");
- lines= BLI_read_file_as_lines(name);
- if(lines == NULL) {
- if(G.f & G_DEBUG) printf("File .Blanguages not found\n");
- return 0;
- }
- }
- }
-
- for (l= lines; l; l= l->next) {
- char *line= l->link;
-
- if (!BLI_streq(line, "")) {
- puplang_insert_entry(line);
- }
- }
-
- BLI_free_file_lines(lines);
-
- return 1;
-}
-
-
-void free_languagemenu(void)
-{
- struct LANGMenuEntry *lme= langmenu;
-
- while (lme) {
- struct LANGMenuEntry *n= lme->next;
-
- if (lme->line) MEM_freeN(lme->line);
- if (lme->language) MEM_freeN(lme->language);
- if (lme->code) MEM_freeN(lme->code);
- MEM_freeN(lme);
-
- lme= n;
- }
-}
-
-#endif /* INTERNATIONAL */
diff --git a/source/blender/src/lorem.c b/source/blender/src/lorem.c
deleted file mode 100644
index 6b3a00f2cc3..00000000000
--- a/source/blender/src/lorem.c
+++ /dev/null
@@ -1,516 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include "BIF_editfont.h"
-
-char *BIF_lorem =
-"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. "
-"Aliquam tristique interdum sem. "
-"Nullam pretium, tortor non euismod varius, nulla odio sodales nulla, at bibendum lorem metus sed nulla. "
-"Vestibulum in lectus at pede blandit viverra. "
-"Fusce scelerisque ipsum nec enim. "
-"Fusce euismod nunc id enim. "
-"In venenatis cursus arcu. "
-"Aenean quis dui. "
-"Maecenas laoreet. "
-"Nulla tempor, arcu pulvinar pretium suscipit, tortor wisi dapibus libero, id ornare felis ipsum suscipit purus. "
-"Maecenas ipsum. "
-"Morbi cursus. "
-"Vestibulum diam purus, commodo et, convallis eu, posuere at, ligula. "
-"Nulla aliquam aliquet lorem. "
-"Nunc et mauris hendrerit est bibendum suscipit. "
-"Donec pellentesque libero eu nisl. "
-"Pellentesque eget libero. "
-"Donec tempus ipsum sed quam. "
-"Sed blandit nunc quis enim. "
-"Quisque lectus diam, adipiscing hendrerit, placerat non, pulvinar id, felis. "
-"In congue magna sit amet urna. "
-"Nunc non augue sed nisl dictum laoreet. "
-"Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. "
-"In venenatis dapibus massa. "
-"Nulla hendrerit sapien et quam. "
-"Nunc ac magna lobortis tellus tincidunt posuere. "
-"Cras augue mauris, mattis lobortis, fermentum at, semper ac, tellus. "
-"Cras vitae ligula sit amet sem posuere iaculis. "
-"Aliquam condimentum eleifend felis. "
-"Ut sit amet sapien. "
-"Suspendisse potenti. "
-"Mauris urna. "
-"Ut eu enim eu ante porta vestibulum. "
-"Aenean scelerisque est ac felis. "
-"Suspendisse auctor. "
-"Nunc pellentesque. "
-"Morbi laoreet ante et nibh. "
-"Donec feugiat arcu eget enim. "
-"Morbi vehicula tortor ac ipsum. "
-"Quisque lacus arcu, elementum ac, faucibus vel, posuere id, est. "
-"Proin commodo gravida sem. "
-"Vivamus tincidunt vehicula libero. "
-"Phasellus wisi. "
-"Maecenas pretium tellus eu sapien. "
-"Nunc sit amet nunc. "
-"In hac habitasse platea dictumst. "
-"Aenean dictum neque sed tortor. "
-"Donec et erat. "
-"Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed justo turpis, scelerisque ut, mattis sit amet, ornare rutrum, massa. "
-"Vestibulum bibendum enim sit amet velit. "
-"Vivamus tellus ipsum, luctus ut, consectetuer vitae, dignissim non, ligula. "
-"Phasellus lacinia wisi at est. "
-"Donec elit wisi, commodo non, placerat in, convallis id, elit. "
-"Nunc dolor dolor, vestibulum id, bibendum vitae, lacinia id, erat. "
-"Cras sit amet eros. "
-"Suspendisse suscipit lobortis lectus. "
-"Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. "
-"Cras orci. "
-"Praesent massa urna, lobortis semper, auctor a, pretium vitae, tellus. "
-"Curabitur at purus. "
-"Morbi tortor quam, imperdiet venenatis, egestas a, cursus eu, est. "
-"Nunc interdum lectus sit amet libero. "
-"Quisque dignissim placerat ligula. "
-"Nunc porttitor posuere arcu. "
-"Mauris faucibus quam at massa. "
-"Vivamus sodales aliquet mauris. "
-"In id ante. "
-"Pellentesque varius ipsum in arcu. "
-"Fusce mauris lacus, tristique ac, lobortis quis, lobortis luctus, pede. "
-"Sed wisi. "
-"Vestibulum mattis. "
-"Maecenas hendrerit sem nec purus. "
-"Proin id quam. "
-"Cras nec mauris. "
-"Integer orci. "
-"Nullam dui sem, molestie sed, egestas quis, cursus in, magna. "
-"Mauris neque lacus, consectetuer nec, sagittis eu, porttitor eget, dui. "
-"Fusce consectetuer. "
-"Donec nec tellus quis leo lobortis ullamcorper. "
-"Etiam metus urna, aliquet pretium, ultrices eu, cursus ut, turpis. "
-"Morbi bibendum vehicula lectus. "
-"Sed non ante vitae arcu pellentesque tempor. "
-"Fusce sed ligula in sem tempor imperdiet. "
-"Aliquam vel est. "
-"Phasellus sollicitudin sollicitudin nibh. "
-"Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. "
-"Sed vel leo nec eros blandit imperdiet. "
-"Nulla facilisi. "
-"Suspendisse lobortis, dui ut fringilla hendrerit, justo purus ullamcorper ligula, ultricies ultrices dolor enim in libero. "
-"Sed elementum, pede eget porta convallis, dui nulla dignissim pede, eget vehicula odio ante at sem. "
-"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. "
-"Sed ullamcorper tincidunt ipsum. "
-"Fusce risus nibh, accumsan sit amet, tempus eget, tristique ac, neque. "
-"Sed quis lorem ut tortor facilisis fermentum. "
-"Fusce pulvinar quam sit amet ipsum. "
-"Morbi ac elit quis tellus malesuada blandit. "
-"Maecenas suscipit sollicitudin sem. "
-"Nam sed eros vel lacus lobortis congue. "
-"Proin interdum nunc lobortis orci. "
-"Donec egestas enim eu odio. "
-"Vestibulum id metus. "
-"Pellentesque auctor, sem varius luctus tempus, libero magna cursus neque, et porttitor diam diam quis purus. "
-"Vestibulum sit amet dolor. "
-"Nulla in magna. "
-"Cras id diam at lectus faucibus placerat. "
-"Nunc porta posuere sapien. "
-"Etiam scelerisque. "
-"Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. "
-"Aliquam pellentesque mi sed tortor. "
-"Maecenas eleifend diam non urna. "
-"Donec luctus pharetra tellus. "
-"Proin ac ipsum eget libero bibendum volutpat. "
-"Cras id tellus. "
-"Nulla non risus. "
-"In dolor. "
-"Fusce scelerisque quam in massa ultrices porta. "
-"Morbi ut dolor eu massa egestas condimentum. "
-"Mauris vulputate. "
-"In hac habitasse platea dictumst. "
-"Suspendisse potenti. "
-"Mauris vehicula leo in tortor. "
-"Mauris vel erat a urna laoreet semper. "
-"Pellentesque ut metus ac tellus commodo eleifend. "
-"Suspendisse quis urna. "
-"Curabitur lacinia dignissim dui. "
-"Nam nec ante. "
-"In id enim. "
-"Aenean mattis enim. "
-"In ut neque porttitor risus hendrerit tincidunt. "
-"Suspendisse potenti. "
-"Ut vestibulum lectus vitae tortor. "
-"Duis velit. "
-"Nulla facilisi. "
-"Integer sit amet urna. "
-"Cras varius tortor in pede. "
-"Sed facilisis. "
-"Praesent lacinia libero nec nibh. "
-"Donec aliquam risus non nisl. "
-"Nam a nunc et felis tempor feugiat. "
-"Nunc metus. "
-"Vestibulum euismod, metus in semper laoreet, urna ipsum pharetra lorem, sed ultricies magna lorem sit amet wisi. "
-"Sed wisi. "
-"Nullam facilisis elit sed nisl. "
-"Phasellus mattis leo nec massa. "
-"Aenean malesuada. "
-"Cras wisi erat, lobortis nec, cursus eget, lobortis at, libero. "
-"In massa nisl, rutrum non, cursus nec, faucibus sed, lacus. "
-"Pellentesque malesuada. "
-"Cras euismod, neque ac suscipit tempus, velit lorem luctus elit, dapibus rhoncus wisi est ut sem. "
-"Proin vulputate enim in eros elementum accumsan. "
-"Ut lorem nisl, hendrerit et, interdum nec, lacinia in, dolor. "
-"Duis nec quam. "
-"Praesent velit felis, posuere id, luctus quis, laoreet ut, ipsum. "
-"Praesent eget arcu. "
-"Mauris massa felis, ornare non, ultrices id, tristique in, elit. "
-"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. "
-"Phasellus vulputate, mi ac bibendum facilisis, libero enim suscipit leo, non nonummy pede diam eget nibh. "
-"Sed tempus. "
-"Aenean interdum suscipit dui. "
-"Aliquam erat volutpat. "
-"Ut malesuada. "
-"Nam commodo, nulla ut fringilla rutrum, orci elit viverra diam, vitae mollis odio odio et purus. "
-"Aliquam erat volutpat. "
-"Sed aliquet lobortis ipsum. "
-"In ut est. "
-"Etiam condimentum. "
-"Vestibulum pellentesque tortor pulvinar lacus. "
-"Aenean orci. "
-"Suspendisse lacus nulla, nonummy a, dictum vitae, egestas quis, eros. "
-"Donec auctor gravida nisl. "
-"Cras ac est rutrum augue pulvinar ornare. "
-"Phasellus mauris nibh, vulputate in, rhoncus imperdiet, dapibus eget, lacus. "
-"Nam nunc mauris, suscipit at, ultricies a, facilisis at, tellus. "
-"Nam accumsan mollis libero. "
-"Vivamus condimentum mattis est. "
-"Donec lacus. "
-"Nullam ac sapien id massa lobortis molestie. "
-"Pellentesque elementum. "
-"Proin ut purus. "
-"Integer et sapien quis turpis commodo mollis. "
-"Nulla consequat. "
-"Proin a wisi ut tellus blandit elementum. "
-"Aliquam nulla lorem, bibendum ac, malesuada vel, elementum et, metus. "
-"Phasellus egestas nibh et ligula. "
-"Vivamus diam odio, lacinia quis, malesuada quis, sollicitudin ut, eros. "
-"Phasellus aliquet lorem ac ipsum. "
-"Sed cursus tellus ac orci. "
-"Phasellus at nulla. "
-"Donec porta sodales ante. "
-"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. "
-"Sed id lectus at massa ullamcorper tristique. "
-"Suspendisse porttitor lacus. "
-"In hac habitasse platea dictumst. "
-"Nunc non turpis. "
-"Sed sagittis. "
-"Morbi laoreet scelerisque dui. "
-"Nam arcu tellus, tempor vitae, vestibulum et, imperdiet ut, velit. "
-"In sit amet augue a arcu volutpat suscipit. "
-"Donec dictum ultrices lectus. "
-"Phasellus a purus et orci dictum lacinia. "
-"Ut leo. "
-"Cras semper, lorem sit amet tincidunt congue, justo eros varius pede, in bibendum turpis lectus non eros. "
-"Phasellus quam. "
-"Suspendisse mattis sollicitudin magna. "
-"Aenean facilisis diam vel nisl nonummy condimentum. "
-"Suspendisse vel dolor. "
-"Vestibulum nonummy. "
-"Mauris imperdiet semper ante. "
-"Maecenas vulputate eros. "
-"Vestibulum ac dolor. "
-"Fusce risus metus, aliquet eget, facilisis et, feugiat vel, orci. "
-"Ut at nunc id ante sodales vulputate. "
-"Duis tristique mattis ante. "
-"Vestibulum neque mauris, laoreet id, congue interdum, aliquet ut, diam. "
-"Nulla volutpat blandit magna. "
-"Donec accumsan congue diam. "
-"Etiam vel dui eget nisl tempor varius. "
-"Cras dictum massa sed enim. "
-"Cras urna tortor, fringilla ac, ullamcorper in, euismod vel, arcu. "
-"Morbi posuere luctus augue. "
-"Aliquam dui dui, adipiscing in, lobortis eu, luctus eu, nulla. "
-"Cras velit pede, ullamcorper sit amet, feugiat in, auctor vitae, ante. "
-"Suspendisse dictum fringilla mauris. "
-"In a nibh. "
-"Donec ac ligula. "
-"In quam. "
-"Praesent vitae urna ultricies sem aliquam placerat. "
-"Aliquam erat volutpat. "
-"Nam est. "
-"Donec faucibus sodales metus. "
-"Ut congue. "
-"Donec arcu tellus, pharetra ac, vulputate ac, mollis sed, lectus. "
-"Nulla facilisi. "
-"Nullam volutpat nunc et felis. "
-"Sed pede odio, tincidunt in, volutpat malesuada, feugiat gravida, nulla. "
-"Nulla aliquam pede vitae arcu. "
-"Proin velit elit, nonummy sit amet, elementum vitae, varius vitae, dolor. "
-"Donec rutrum ipsum eu mi. "
-"Aliquam et sem. "
-"In adipiscing rhoncus velit. "
-"Nam viverra scelerisque arcu. "
-"Aliquam sem. "
-"Sed tincidunt nulla quis massa. "
-"Mauris faucibus tempus nunc. "
-"Phasellus condimentum. "
-"Curabitur aliquet iaculis sapien. "
-"Nunc rhoncus, odio vitae bibendum dignissim, tellus libero commodo ipsum, ut sollicitudin nisl nisl vel justo. "
-"Nulla facilisi. "
-"Praesent blandit enim ut justo. "
-"Proin elementum, elit eget accumsan pulvinar, orci quam auctor neque, sed convallis diam purus vel felis. "
-"Sed orci leo, eleifend vel, blandit non, semper eu, purus. "
-"Proin bibendum, libero ac consectetuer commodo, eros sapien blandit nisl, eu eleifend nibh nibh vel lectus. "
-"Vivamus placerat. "
-"Integer odio dolor, pharetra non, sodales id, viverra eget, diam. "
-"Nunc mauris magna, egestas quis, feugiat id, fermentum viverra, mi. "
-"Aenean suscipit nisl non nunc. "
-"Proin quis lectus ac tellus nonummy commodo. "
-"Nunc eget diam ac elit vestibulum auctor. "
-"Etiam vulputate, odio sed lacinia consequat, justo mi vulputate purus, sit amet euismod libero metus sed tortor. "
-"Maecenas ac elit sed lorem vulputate gravida. "
-"Proin lectus eros, ullamcorper id, volutpat quis, condimentum tincidunt, sapien. "
-"Sed et massa eget lorem aliquet tempus. "
-"Duis porttitor nisl non risus. "
-"Nam id quam. "
-"Nullam est. "
-"Proin orci diam, posuere et, pharetra commodo, dictum vel, enim. "
-"Proin eget erat. "
-"Donec nisl. "
-"Maecenas auctor velit ut pede. "
-"Nunc vitae lectus nec libero tincidunt hendrerit. "
-"Quisque varius, erat ultrices ultrices euismod, purus lacus dictum eros, at condimentum enim dui nec magna. "
-"Morbi diam. "
-"Phasellus sed est. "
-"Phasellus nec libero in arcu fringilla sollicitudin. "
-"In rutrum nisl at arcu. "
-"Nulla facilisi. "
-"Mauris dignissim. "
-"Etiam est mauris, pharetra sed, viverra et, tincidunt sed, neque. "
-"Ut at lectus id nibh luctus ornare. "
-"Mauris varius porttitor risus. "
-"Ut vulputate aliquet risus. "
-"Vestibulum luctus neque sit amet nunc. "
-"Duis fermentum nibh. "
-"Pellentesque dapibus. "
-"Proin eros libero, aliquam non, condimentum a, sodales ut, turpis. "
-"Integer accumsan mi sed lorem. "
-"Vestibulum pellentesque sodales nisl. "
-"Nulla eu justo quis dui pretium rhoncus. "
-"Praesent viverra commodo mi. "
-"Maecenas dolor libero, viverra a, elementum vitae, aliquet vitae, dui. "
-"Mauris convallis lectus et mi. "
-"Mauris sagittis. "
-"Sed arcu. "
-"Pellentesque auctor. "
-"Donec pellentesque purus non tellus. "
-"Ut leo wisi, ultrices sit amet, ultrices eu, gravida ac, libero. "
-"Mauris fermentum dapibus diam. "
-"Integer quis lacus dapibus odio pellentesque varius. "
-"Fusce pede quam, vehicula ut, pulvinar et, tincidunt sed, felis. "
-"Curabitur eros enim, vulputate sed, aliquam ac, euismod ac, erat. "
-"Ut dignissim, lacus a interdum iaculis, enim orci posuere nunc, nec ultricies lectus risus in odio. "
-"Etiam et massa id dui commodo vehicula. "
-"Nunc blandit tortor quis dui. "
-"Quisque nisl. "
-"Sed venenatis blandit ligula. "
-"Fusce viverra imperdiet magna. "
-"Donec eget nunc quis est pharetra lobortis. "
-"Vestibulum quis lectus. "
-"Mauris vel orci lobortis nunc fermentum bibendum. "
-"Pellentesque eget leo. "
-"Morbi vel urna sit amet erat fermentum facilisis. "
-"Sed vulputate, libero et sollicitudin congue, wisi lectus sodales dolor, eget molestie magna orci vel tellus. "
-"Sed tempor ante et enim. "
-"Mauris elit. "
-"Curabitur ullamcorper vehicula massa. "
-"Sed viverra. "
-"Duis nulla. "
-"Nam bibendum. "
-"Nam tortor lorem, ullamcorper vitae, dictum sed, posuere eu, justo. "
-"Aliquam adipiscing arcu vitae turpis. "
-"Donec malesuada posuere libero. "
-"Ut sed tellus. "
-"Fusce sed nunc eget nisl dapibus malesuada. "
-"Suspendisse potenti. "
-"Integer tristique libero et metus. "
-"Vivamus posuere. "
-"Maecenas non sem non quam fermentum blandit. "
-"Duis risus tellus, rutrum vitae, imperdiet nec, malesuada nec, ipsum. "
-"Nunc quam dolor, luctus eget, placerat non, rhoncus at, tellus. "
-"Duis pede lectus, mattis adipiscing, tempor ut, porta at, mi. "
-"Pellentesque risus nulla, sodales sed, interdum id, nonummy vitae, ligula. "
-"Morbi pulvinar pede ut massa. "
-"Nunc risus mauris, tincidunt et, faucibus eu, suscipit vel, orci. "
-"In faucibus felis in arcu. "
-"Nulla sit amet elit. "
-"Nulla erat sapien, sagittis eget, dignissim eget, viverra eu, felis. "
-"Nam ac ipsum. "
-"Suspendisse vulputate turpis vel sem lacinia ullamcorper. "
-"Mauris ornare ipsum sed ligula. "
-"Duis facilisis neque quis orci. "
-"Nullam et erat et orci lacinia pellentesque. "
-"Donec ac ipsum. "
-"Duis molestie ipsum ac arcu. "
-"Aenean congue accumsan ante. "
-"Integer bibendum, leo ut ornare aliquam, nunc erat condimentum arcu, ut pulvinar mi augue et nulla. "
-"Quisque lacinia aliquet wisi. "
-"Vivamus nec dui. "
-"Etiam wisi leo, euismod vitae, vulputate a, dictum vitae, quam. "
-"Quisque quis tortor. "
-"Etiam interdum. "
-"In massa erat, porttitor sed, tincidunt vel, vehicula fringilla, augue. "
-"Nulla vel urna. "
-"In libero mi, pretium sed, mattis tempus, sagittis sed, massa. "
-"Suspendisse quam wisi, fermentum quis, sagittis at, consequat eget, odio. "
-"Nullam imperdiet, purus quis aliquam cursus, turpis odio egestas justo, placerat gravida turpis wisi vel tortor. "
-"Nunc ultricies porta purus. "
-"Proin elementum erat ac orci. "
-"Ut vel magna nec mi feugiat tincidunt. "
-"Ut ligula. "
-"Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec et magna in diam porta nonummy. "
-"Maecenas ut sem in turpis fermentum viverra. "
-"Suspendisse at orci. "
-"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. "
-"Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque rutrum eleifend justo. "
-"Nullam vitae pede. "
-"Donec condimentum nibh et odio. "
-"Sed et metus. "
-"Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. "
-"Nam tempus. "
-"Sed ac wisi. "
-"In hac habitasse platea dictumst. "
-"Sed sed wisi. "
-"Ut facilisis tellus non ligula. "
-"Integer metus. "
-"In lacinia dui. "
-"Curabitur ornare. "
-"Mauris vel urna. "
-"Nam consectetuer dignissim urna. "
-"Nunc elementum porttitor erat. "
-"Sed blandit, risus non commodo nonummy, ligula erat fermentum nibh, eu facilisis ante neque sed sem. "
-"Etiam scelerisque justo eget wisi. "
-"Nunc dignissim. "
-"Proin pulvinar quam non lectus. "
-"Proin ut turpis quis augue pellentesque dictum. "
-"Fusce et lorem. "
-"Aliquam urna lacus, blandit sed, vestibulum sit amet, placerat et, dolor. "
-"Curabitur auctor erat nec lorem. "
-"Phasellus urna wisi, lacinia ut, molestie tincidunt, condimentum id, odio. "
-"Curabitur convallis ullamcorper justo. "
-"Donec vestibulum est ac quam. "
-"Nullam vitae elit eu massa varius vulputate. "
-"Nulla facilisi. "
-"Suspendisse potenti. "
-"Praesent non libero. "
-"Nullam tristique massa id magna viverra commodo. "
-"Vestibulum libero tortor, luctus ac, viverra congue, consectetuer vel, libero. "
-"Aenean arcu augue, luctus id, laoreet pulvinar, dictum sed, lectus. "
-"Donec vestibulum volutpat dolor. "
-"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. "
-"Pellentesque augue turpis, laoreet nec, malesuada at, nonummy vitae, nibh. "
-"Etiam orci sapien, congue in, porttitor sit amet, rutrum vel, nibh. "
-"Integer eu lorem. "
-"Mauris pretium leo et elit. "
-"In nonummy ultricies sapien. "
-"Mauris varius. "
-"Mauris sed libero. "
-"Curabitur ullamcorper elit eu purus. "
-"Vestibulum velit pede, semper sit amet, lobortis vitae, tincidunt vel, dui. "
-"Nulla neque ante, sagittis eu, vestibulum et, lacinia a, libero. "
-"Morbi sit amet wisi. "
-"Pellentesque non felis quis arcu bibendum ornare. "
-"Aenean enim metus, commodo eu, hendrerit nonummy, euismod ut, quam. "
-"Nulla eleifend nisl quis dolor. "
-"Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. "
-"Maecenas pellentesque massa in erat molestie molestie. "
-"Mauris dignissim dapibus libero. "
-"Sed sed risus id neque dictum ornare. "
-"Sed eu ligula at felis sodales accumsan. "
-"Sed interdum, urna non pharetra hendrerit, quam mi ornare libero, id fringilla tortor orci non velit. "
-"Aliquam nec risus. "
-"Donec at nunc vitae tellus molestie vestibulum. "
-"Pellentesque vel justo. "
-"Duis ligula libero, vulputate quis, adipiscing bibendum, feugiat vitae, velit. "
-"Vivamus et arcu. "
-"Fusce eget quam. "
-"Ut ante. "
-"Suspendisse feugiat metus non ipsum. "
-"Nulla tempus leo ut mi. "
-"Curabitur vitae nisl. "
-"Vivamus elementum. "
-"Etiam a orci. "
-"Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Vivamus urna quam, tincidunt at, ultrices vel, feugiat eget, nulla. "
-"Maecenas lacus magna, nonummy eu, iaculis sed, consectetuer quis, enim. "
-"Praesent a eros. "
-"Aliquam nonummy dignissim neque. "
-"Nulla enim. "
-"Praesent molestie, orci quis tristique volutpat, lacus metus luctus sapien, et facilisis eros neque id sapien. "
-"Nunc condimentum dolor vel orci. "
-"Integer wisi diam, porttitor sit amet, feugiat in, dapibus in, lectus. "
-"Aliquam erat volutpat. "
-"Quisque mollis turpis vitae tortor. "
-"Mauris turpis mi, pretium ut, ultrices sed, porta in, justo. "
-"Suspendisse posuere. "
-"Quisque ultricies lacus vitae enim. "
-"Donec lacus. "
-"Suspendisse potenti. "
-"Donec molestie, magna sed euismod dictum, magna magna interdum diam, vitae sagittis leo lorem ac neque. "
-"Cras metus. "
-"Quisque nunc. "
-"Duis consectetuer. "
-"Vestibulum gravida sollicitudin urna. "
-"Integer volutpat, massa quis ultrices pulvinar, eros purus dignissim nunc, eget rhoncus enim lectus quis tortor. "
-"Integer lacinia quam quis erat convallis mattis. "
-"Suspendisse iaculis posuere velit. "
-"Etiam tellus enim, aliquet nec, laoreet a, molestie non, velit. "
-"Quisque lacus velit, eleifend imperdiet, fringilla id, dapibus scelerisque, lectus. "
-"Nulla quis lorem. "
-"Nulla malesuada neque et dui. "
-"Phasellus malesuada ultricies odio. "
-"Phasellus vitae ligula. "
-"Pellentesque feugiat arcu at erat. "
-"Vivamus ut eros ut lorem pulvinar iaculis. "
-"Proin lobortis ipsum id nunc. "
-"Curabitur vel massa. "
-"Suspendisse nulla ipsum, malesuada vel, posuere eget, mollis at, risus. "
-"Vestibulum sed diam id est dapibus ultrices. "
-"Proin tempus, eros a scelerisque vestibulum, ipsum arcu aliquam mi, ut feugiat libero odio in nisl. "
-"Quisque et massa a mauris luctus congue. "
-"Ut id eros. "
-"Fusce ante eros, pharetra non, molestie tristique, bibendum sit amet, wisi. "
-"Phasellus rutrum, dolor et semper elementum, eros ante malesuada massa, sed sollicitudin lectus velit et massa. "
-"In auctor. "
-"Aliquam erat volutpat. "
-"Etiam risus leo, vulputate suscipit, sollicitudin et, sodales eget, nisl. "
-"Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Curabitur lobortis, libero ac laoreet mollis, ligula leo porta wisi, ut euismod felis ligula id elit. "
-"Vivamus malesuada nulla eu enim. "
-"Donec accumsan faucibus orci. "
-"Nulla lacinia ante. "
-"Praesent at nibh. "
-"Mauris porta dignissim wisi. "
-"Ut lacinia tortor nec nunc. "
-"Phasellus et augue. "
-"Integer rhoncus, libero a pellentesque rhoncus, tortor sapien lobortis pede, eget condimentum sapien risus vitae elit. "
-"Suspendisse sed turpis ut dolor placerat dignissim. "
-"Quisque quis leo. "
-"Cras ultrices. "
-"Maecenas hendrerit auctor tortor. "
-"Etiam sit amet arcu. ";
diff --git a/source/blender/src/mainqueue.c b/source/blender/src/mainqueue.c
deleted file mode 100644
index 30ee825a23a..00000000000
--- a/source/blender/src/mainqueue.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- *
- * Just the functions to maintain a central event
- * queue.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include "BIF_mainqueue.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-typedef struct {
- unsigned short event;
- short val;
- char ascii;
-} QEvent;
-
-static QEvent mainqueue[MAXQUEUE];
-static unsigned int nevents= 0;
-
-unsigned short mainqread(short *val, char *ascii)
-{
- if (nevents) {
- nevents--;
-
- *val= mainqueue[nevents].val;
- *ascii= mainqueue[nevents].ascii;
- if((*ascii<32)||(*ascii==127)) *ascii=0;
- return mainqueue[nevents].event;
- } else
- return 0;
-}
-
-void mainqenter(unsigned short event, short val)
-{
- mainqenter_ext(event, val, 0);
-}
-
-void mainqenter_ext(unsigned short event, short val, char ascii)
-{
- if (!event)
- return;
-
- if (nevents<MAXQUEUE) {
- memmove(mainqueue+1, mainqueue, sizeof(*mainqueue)*nevents);
- mainqueue[0].event= event;
- mainqueue[0].val= val;
- mainqueue[0].ascii= ascii;
-
- nevents++;
- }
-}
-
-void mainqpushback(unsigned short event, short val, char ascii)
-{
- if (nevents<MAXQUEUE) {
- mainqueue[nevents].event= event;
- mainqueue[nevents].val= val;
- mainqueue[nevents].ascii= ascii;
- nevents++;
- }
-}
-
-unsigned short mainqtest()
-{
- if (nevents)
- return mainqueue[nevents-1].event;
- else
- return 0;
-}
diff --git a/source/blender/src/meshlaplacian.c b/source/blender/src/meshlaplacian.c
deleted file mode 100644
index 5907d3cd7c3..00000000000
--- a/source/blender/src/meshlaplacian.c
+++ /dev/null
@@ -1,1891 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * meshlaplacian.c: Algorithms using the mesh laplacian.
- */
-
-#include <math.h>
-#include <string.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_listBase.h"
-#include "DNA_object_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_modifier_types.h"
-
-#include "BLI_arithb.h"
-#include "BLI_edgehash.h"
-#include "BLI_memarena.h"
-
-#include "BKE_DerivedMesh.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_editdeform.h"
-#include "BIF_meshlaplacian.h"
-#include "BIF_meshtools.h"
-#include "BIF_screen.h"
-#include "BIF_toolbox.h"
-
-#include "BSE_headerbuttons.h"
-
-#ifdef RIGID_DEFORM
-#include "BLI_editVert.h"
-#include "BLI_polardecomp.h"
-#endif
-
-#include "RE_raytrace.h"
-
-#include "ONL_opennl.h"
-
-/************************** Laplacian System *****************************/
-
-struct LaplacianSystem {
- NLContext context; /* opennl context */
-
- int totvert, totface;
-
- float **verts; /* vertex coordinates */
- float *varea; /* vertex weights for laplacian computation */
- char *vpinned; /* vertex pinning */
- int (*faces)[3]; /* face vertex indices */
- float (*fweights)[3]; /* cotangent weights per face */
-
- int areaweights; /* use area in cotangent weights? */
- int storeweights; /* store cotangent weights in fweights */
- int nlbegun; /* nlBegin(NL_SYSTEM/NL_MATRIX) done */
-
- EdgeHash *edgehash; /* edge hash for construction */
-
- struct HeatWeighting {
- Mesh *mesh;
- float (*verts)[3]; /* vertex coordinates */
- float (*vnors)[3]; /* vertex normals */
-
- float (*root)[3]; /* bone root */
- float (*tip)[3]; /* bone tip */
- int numbones;
-
- float *H; /* diagonal H matrix */
- float *p; /* values from all p vectors */
- float *mindist; /* minimum distance to a bone for all vertices */
-
- RayTree *raytree; /* ray tracing acceleration structure */
- MFace **vface; /* a face that the vertex belongs to */
- } heat;
-
-#ifdef RIGID_DEFORM
- struct RigidDeformation {
- EditMesh *mesh;
-
- float (*R)[3][3];
- float (*rhs)[3];
- float (*origco)[3];
- int thrownerror;
- } rigid;
-#endif
-};
-
-/* Laplacian matrix construction */
-
-/* Computation of these weights for the laplacian is based on:
- "Discrete Differential-Geometry Operators for Triangulated 2-Manifolds",
- Meyer et al, 2002. Section 3.5, formula (8).
-
- We do it a bit different by going over faces instead of going over each
- vertex and adjacent faces, since we don't store this adjacency. Also, the
- formulas are tweaked a bit to work for non-manifold meshes. */
-
-static void laplacian_increase_edge_count(EdgeHash *edgehash, int v1, int v2)
-{
- void **p = BLI_edgehash_lookup_p(edgehash, v1, v2);
-
- if(p)
- *p = (void*)((long)*p + (long)1);
- else
- BLI_edgehash_insert(edgehash, v1, v2, (void*)(long)1);
-}
-
-static int laplacian_edge_count(EdgeHash *edgehash, int v1, int v2)
-{
- return (int)(long)BLI_edgehash_lookup(edgehash, v1, v2);
-}
-
-static float cotan_weight(float *v1, float *v2, float *v3)
-{
- float a[3], b[3], c[3], clen;
-
- VecSubf(a, v2, v1);
- VecSubf(b, v3, v1);
- Crossf(c, a, b);
-
- clen = VecLength(c);
-
- if (clen == 0.0f)
- return 0.0f;
-
- return Inpf(a, b)/clen;
-}
-
-static void laplacian_triangle_area(LaplacianSystem *sys, int i1, int i2, int i3)
-{
- float t1, t2, t3, len1, len2, len3, area;
- float *varea= sys->varea, *v1, *v2, *v3;
- int obtuse = 0;
-
- v1= sys->verts[i1];
- v2= sys->verts[i2];
- v3= sys->verts[i3];
-
- t1= cotan_weight(v1, v2, v3);
- t2= cotan_weight(v2, v3, v1);
- t3= cotan_weight(v3, v1, v2);
-
- if(VecAngle3(v2, v1, v3) > 90) obtuse= 1;
- else if(VecAngle3(v1, v2, v3) > 90) obtuse= 2;
- else if(VecAngle3(v1, v3, v2) > 90) obtuse= 3;
-
- if (obtuse > 0) {
- area= AreaT3Dfl(v1, v2, v3);
-
- varea[i1] += (obtuse == 1)? area: area*0.5;
- varea[i2] += (obtuse == 2)? area: area*0.5;
- varea[i3] += (obtuse == 3)? area: area*0.5;
- }
- else {
- len1= VecLenf(v2, v3);
- len2= VecLenf(v1, v3);
- len3= VecLenf(v1, v2);
-
- t1 *= len1*len1;
- t2 *= len2*len2;
- t3 *= len3*len3;
-
- varea[i1] += (t2 + t3)*0.25f;
- varea[i2] += (t1 + t3)*0.25f;
- varea[i3] += (t1 + t2)*0.25f;
- }
-}
-
-static void laplacian_triangle_weights(LaplacianSystem *sys, int f, int i1, int i2, int i3)
-{
- float t1, t2, t3;
- float *varea= sys->varea, *v1, *v2, *v3;
-
- v1= sys->verts[i1];
- v2= sys->verts[i2];
- v3= sys->verts[i3];
-
- /* instead of *0.5 we divided by the number of faces of the edge, it still
- needs to be varified that this is indeed the correct thing to do! */
- t1= cotan_weight(v1, v2, v3)/laplacian_edge_count(sys->edgehash, i2, i3);
- t2= cotan_weight(v2, v3, v1)/laplacian_edge_count(sys->edgehash, i3, i1);
- t3= cotan_weight(v3, v1, v2)/laplacian_edge_count(sys->edgehash, i1, i2);
-
- nlMatrixAdd(i1, i1, (t2+t3)*varea[i1]);
- nlMatrixAdd(i2, i2, (t1+t3)*varea[i2]);
- nlMatrixAdd(i3, i3, (t1+t2)*varea[i3]);
-
- nlMatrixAdd(i1, i2, -t3*varea[i1]);
- nlMatrixAdd(i2, i1, -t3*varea[i2]);
-
- nlMatrixAdd(i2, i3, -t1*varea[i2]);
- nlMatrixAdd(i3, i2, -t1*varea[i3]);
-
- nlMatrixAdd(i3, i1, -t2*varea[i3]);
- nlMatrixAdd(i1, i3, -t2*varea[i1]);
-
- if(sys->storeweights) {
- sys->fweights[f][0]= t1*varea[i1];
- sys->fweights[f][1]= t2*varea[i2];
- sys->fweights[f][2]= t3*varea[i3];
- }
-}
-
-LaplacianSystem *laplacian_system_construct_begin(int totvert, int totface)
-{
- LaplacianSystem *sys;
-
- sys= MEM_callocN(sizeof(LaplacianSystem), "LaplacianSystem");
-
- sys->verts= MEM_callocN(sizeof(float*)*totvert, "LaplacianSystemVerts");
- sys->vpinned= MEM_callocN(sizeof(char)*totvert, "LaplacianSystemVpinned");
- sys->faces= MEM_callocN(sizeof(int)*3*totface, "LaplacianSystemFaces");
-
- sys->totvert= 0;
- sys->totface= 0;
-
- sys->areaweights= 1;
- sys->storeweights= 0;
-
- /* create opennl context */
- nlNewContext();
- nlSolverParameteri(NL_NB_VARIABLES, totvert);
-
- sys->context= nlGetCurrent();
-
- return sys;
-}
-
-void laplacian_add_vertex(LaplacianSystem *sys, float *co, int pinned)
-{
- sys->verts[sys->totvert]= co;
- sys->vpinned[sys->totvert]= pinned;
- sys->totvert++;
-}
-
-void laplacian_add_triangle(LaplacianSystem *sys, int v1, int v2, int v3)
-{
- sys->faces[sys->totface][0]= v1;
- sys->faces[sys->totface][1]= v2;
- sys->faces[sys->totface][2]= v3;
- sys->totface++;
-}
-
-void laplacian_system_construct_end(LaplacianSystem *sys)
-{
- int (*face)[3];
- int a, totvert=sys->totvert, totface=sys->totface;
-
- laplacian_begin_solve(sys, 0);
-
- sys->varea= MEM_callocN(sizeof(float)*totvert, "LaplacianSystemVarea");
-
- sys->edgehash= BLI_edgehash_new();
- for(a=0, face=sys->faces; a<sys->totface; a++, face++) {
- laplacian_increase_edge_count(sys->edgehash, (*face)[0], (*face)[1]);
- laplacian_increase_edge_count(sys->edgehash, (*face)[1], (*face)[2]);
- laplacian_increase_edge_count(sys->edgehash, (*face)[2], (*face)[0]);
- }
-
- if(sys->areaweights)
- for(a=0, face=sys->faces; a<sys->totface; a++, face++)
- laplacian_triangle_area(sys, (*face)[0], (*face)[1], (*face)[2]);
-
- for(a=0; a<totvert; a++) {
- if(sys->areaweights) {
- if(sys->varea[a] != 0.0f)
- sys->varea[a]= 0.5f/sys->varea[a];
- }
- else
- sys->varea[a]= 1.0f;
-
- /* for heat weighting */
- if(sys->heat.H)
- nlMatrixAdd(a, a, sys->heat.H[a]);
- }
-
- if(sys->storeweights)
- sys->fweights= MEM_callocN(sizeof(float)*3*totface, "LaplacianFWeight");
-
- for(a=0, face=sys->faces; a<totface; a++, face++)
- laplacian_triangle_weights(sys, a, (*face)[0], (*face)[1], (*face)[2]);
-
- MEM_freeN(sys->faces);
- sys->faces= NULL;
-
- if(sys->varea) {
- MEM_freeN(sys->varea);
- sys->varea= NULL;
- }
-
- BLI_edgehash_free(sys->edgehash, NULL);
- sys->edgehash= NULL;
-}
-
-void laplacian_system_delete(LaplacianSystem *sys)
-{
- if(sys->verts) MEM_freeN(sys->verts);
- if(sys->varea) MEM_freeN(sys->varea);
- if(sys->vpinned) MEM_freeN(sys->vpinned);
- if(sys->faces) MEM_freeN(sys->faces);
- if(sys->fweights) MEM_freeN(sys->fweights);
-
- nlDeleteContext(sys->context);
- MEM_freeN(sys);
-}
-
-void laplacian_begin_solve(LaplacianSystem *sys, int index)
-{
- int a;
-
- if (!sys->nlbegun) {
- nlBegin(NL_SYSTEM);
-
- if(index >= 0) {
- for(a=0; a<sys->totvert; a++) {
- if(sys->vpinned[a]) {
- nlSetVariable(0, a, sys->verts[a][index]);
- nlLockVariable(a);
- }
- }
- }
-
- nlBegin(NL_MATRIX);
- sys->nlbegun = 1;
- }
-}
-
-void laplacian_add_right_hand_side(LaplacianSystem *sys, int v, float value)
-{
- nlRightHandSideAdd(0, v, value);
-}
-
-int laplacian_system_solve(LaplacianSystem *sys)
-{
- nlEnd(NL_MATRIX);
- nlEnd(NL_SYSTEM);
- sys->nlbegun = 0;
-
- //nlPrintMatrix();
-
- return nlSolveAdvanced(NULL, NL_TRUE);
-}
-
-float laplacian_system_get_solution(int v)
-{
- return nlGetVariable(0, v);
-}
-
-/************************* Heat Bone Weighting ******************************/
-/* From "Automatic Rigging and Animation of 3D Characters"
- Ilya Baran and Jovan Popovic, SIGGRAPH 2007 */
-
-#define C_WEIGHT 1.0f
-#define WEIGHT_LIMIT 0.05f
-#define DISTANCE_EPSILON 1e-4f
-
-/* Raytracing for vertex to bone visibility */
-
-static LaplacianSystem *HeatSys = NULL;
-
-static void heat_ray_coords_func(RayFace *face, float **v1, float **v2, float **v3, float **v4)
-{
- MFace *mface= (MFace*)face;
- float (*verts)[3]= HeatSys->heat.verts;
-
- *v1= verts[mface->v1];
- *v2= verts[mface->v2];
- *v3= verts[mface->v3];
- *v4= (mface->v4)? verts[mface->v4]: NULL;
-}
-
-static int heat_ray_check_func(Isect *is, RayFace *face)
-{
- float *v1, *v2, *v3, *v4, nor[3];
-
- /* don't intersect if the ray faces along the face normal */
- heat_ray_coords_func(face, &v1, &v2, &v3, &v4);
-
- if(v4) CalcNormFloat4(v1, v2, v3, v4, nor);
- else CalcNormFloat(v1, v2, v3, nor);
-
- return (INPR(nor, is->vec) < 0);
-}
-
-static void heat_ray_tree_create(LaplacianSystem *sys)
-{
- Mesh *me = sys->heat.mesh;
- RayTree *tree;
- MFace *mface;
- float min[3], max[3];
- int a;
-
- /* create a raytrace tree from the mesh */
- INIT_MINMAX(min, max);
-
- for(a=0; a<me->totvert; a++)
- DO_MINMAX(sys->heat.verts[a], min, max);
-
- tree= RE_ray_tree_create(64, me->totface, min, max,
- heat_ray_coords_func, heat_ray_check_func, NULL, NULL);
-
- sys->heat.vface= MEM_callocN(sizeof(MFace*)*me->totvert, "HeatVFaces");
-
- HeatSys= sys;
-
- for(a=0, mface=me->mface; a<me->totface; a++, mface++) {
- RE_ray_tree_add_face(tree, 0, mface);
-
- sys->heat.vface[mface->v1]= mface;
- sys->heat.vface[mface->v2]= mface;
- sys->heat.vface[mface->v3]= mface;
- if(mface->v4) sys->heat.vface[mface->v4]= mface;
- }
-
- HeatSys= NULL;
-
- RE_ray_tree_done(tree);
-
- sys->heat.raytree= tree;
-}
-
-static int heat_ray_bone_visible(LaplacianSystem *sys, int vertex, int bone)
-{
- Isect isec;
- MFace *mface;
- float dir[3];
- int visible;
-
- mface= sys->heat.vface[vertex];
- if(!mface)
- return 1;
-
- /* setup isec */
- memset(&isec, 0, sizeof(isec));
- isec.mode= RE_RAY_SHADOW;
- isec.lay= -1;
- isec.face_last= NULL;
- isec.faceorig= mface;
-
- VECCOPY(isec.start, sys->heat.verts[vertex]);
- PclosestVL3Dfl(isec.end, isec.start,
- sys->heat.root[bone], sys->heat.tip[bone]);
-
- /* add an extra offset to the start position to avoid self intersection */
- VECSUB(dir, isec.end, isec.start);
- Normalize(dir);
- VecMulf(dir, 1e-5);
- VecAddf(isec.start, isec.start, dir);
-
- HeatSys= sys;
- visible= !RE_ray_tree_intersect(sys->heat.raytree, &isec);
- HeatSys= NULL;
-
- return visible;
-}
-
-static float heat_bone_distance(LaplacianSystem *sys, int vertex, int bone)
-{
- float closest[3], d[3], dist, cosine;
-
- /* compute euclidian distance */
- PclosestVL3Dfl(closest, sys->heat.verts[vertex],
- sys->heat.root[bone], sys->heat.tip[bone]);
-
- VecSubf(d, sys->heat.verts[vertex], closest);
- dist= Normalize(d);
-
- /* if the vertex normal does not point along the bone, increase distance */
- cosine= INPR(d, sys->heat.vnors[vertex]);
-
- return dist/(0.5f*(cosine + 1.001f));
-}
-
-static int heat_bone_closest(LaplacianSystem *sys, int vertex, int bone)
-{
- float dist;
-
- dist= heat_bone_distance(sys, vertex, bone);
-
- if(dist <= sys->heat.mindist[vertex]*(1.0f + DISTANCE_EPSILON))
- if(heat_ray_bone_visible(sys, vertex, bone))
- return 1;
-
- return 0;
-}
-
-static void heat_set_H(LaplacianSystem *sys, int vertex)
-{
- float dist, mindist, h;
- int j, numclosest = 0;
-
- mindist= 1e10;
-
- /* compute minimum distance */
- for(j=0; j<sys->heat.numbones; j++) {
- dist= heat_bone_distance(sys, vertex, j);
-
- if(dist < mindist)
- mindist= dist;
- }
-
- sys->heat.mindist[vertex]= mindist;
-
- /* count number of bones with approximately this minimum distance */
- for(j=0; j<sys->heat.numbones; j++)
- if(heat_bone_closest(sys, vertex, j))
- numclosest++;
-
- sys->heat.p[vertex]= (numclosest > 0)? 1.0f/numclosest: 0.0f;
-
- /* compute H entry */
- if(numclosest > 0) {
- if(mindist > 1e-5)
- h= numclosest*C_WEIGHT/(mindist*mindist);
- else
- h= 1e10f;
- }
- else
- h= 0.0f;
-
- sys->heat.H[vertex]= h;
-}
-
-void heat_calc_vnormals(LaplacianSystem *sys)
-{
- float fnor[3];
- int a, v1, v2, v3, (*face)[3];
-
- sys->heat.vnors= MEM_callocN(sizeof(float)*3*sys->totvert, "HeatVNors");
-
- for(a=0, face=sys->faces; a<sys->totface; a++, face++) {
- v1= (*face)[0];
- v2= (*face)[1];
- v3= (*face)[2];
-
- CalcNormFloat(sys->verts[v1], sys->verts[v2], sys->verts[v3], fnor);
-
- VecAddf(sys->heat.vnors[v1], sys->heat.vnors[v1], fnor);
- VecAddf(sys->heat.vnors[v2], sys->heat.vnors[v2], fnor);
- VecAddf(sys->heat.vnors[v3], sys->heat.vnors[v3], fnor);
- }
-
- for(a=0; a<sys->totvert; a++)
- Normalize(sys->heat.vnors[a]);
-}
-
-static void heat_laplacian_create(LaplacianSystem *sys)
-{
- Mesh *me = sys->heat.mesh;
- MFace *mface;
- int a;
-
- /* heat specific definitions */
- sys->heat.mindist= MEM_callocN(sizeof(float)*me->totvert, "HeatMinDist");
- sys->heat.H= MEM_callocN(sizeof(float)*me->totvert, "HeatH");
- sys->heat.p= MEM_callocN(sizeof(float)*me->totvert, "HeatP");
-
- /* add verts and faces to laplacian */
- for(a=0; a<me->totvert; a++)
- laplacian_add_vertex(sys, sys->heat.verts[a], 0);
-
- for(a=0, mface=me->mface; a<me->totface; a++, mface++) {
- laplacian_add_triangle(sys, mface->v1, mface->v2, mface->v3);
- if(mface->v4)
- laplacian_add_triangle(sys, mface->v1, mface->v3, mface->v4);
- }
-
- /* for distance computation in set_H */
- heat_calc_vnormals(sys);
-
- for(a=0; a<me->totvert; a++)
- heat_set_H(sys, a);
-}
-
-void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numbones, bDeformGroup **dgrouplist, bDeformGroup **dgroupflip, float (*root)[3], float (*tip)[3], int *selected)
-{
- LaplacianSystem *sys;
- MFace *mface;
- float solution, weight;
- int *vertsflipped = NULL;
- int a, totface, j, bbone, firstsegment, lastsegment, thrownerror = 0;
-
- /* count triangles */
- for(totface=0, a=0, mface=me->mface; a<me->totface; a++, mface++) {
- totface++;
- if(mface->v4) totface++;
- }
-
- /* create laplacian */
- sys = laplacian_system_construct_begin(me->totvert, totface);
-
- sys->heat.mesh= me;
- sys->heat.verts= verts;
- sys->heat.root= root;
- sys->heat.tip= tip;
- sys->heat.numbones= numbones;
-
- heat_ray_tree_create(sys);
- heat_laplacian_create(sys);
-
- laplacian_system_construct_end(sys);
-
- if(dgroupflip) {
- vertsflipped = MEM_callocN(sizeof(int)*me->totvert, "vertsflipped");
- for(a=0; a<me->totvert; a++)
- vertsflipped[a] = mesh_get_x_mirror_vert(ob, a);
- }
-
- /* compute weights per bone */
- for(j=0; j<numbones; j++) {
- if(!selected[j])
- continue;
-
- firstsegment= (j == 0 || dgrouplist[j-1] != dgrouplist[j]);
- lastsegment= (j == numbones-1 || dgrouplist[j] != dgrouplist[j+1]);
- bbone= !(firstsegment && lastsegment);
-
- /* clear weights */
- if(bbone && firstsegment) {
- for(a=0; a<me->totvert; a++) {
- remove_vert_defgroup(ob, dgrouplist[j], a);
- if(vertsflipped && dgroupflip[j] && vertsflipped[a] >= 0)
- remove_vert_defgroup(ob, dgroupflip[j], vertsflipped[a]);
- }
- }
-
- /* fill right hand side */
- laplacian_begin_solve(sys, -1);
-
- for(a=0; a<me->totvert; a++)
- if(heat_bone_closest(sys, a, j))
- laplacian_add_right_hand_side(sys, a,
- sys->heat.H[a]*sys->heat.p[a]);
-
- /* solve */
- if(laplacian_system_solve(sys)) {
- /* load solution into vertex groups */
- for(a=0; a<me->totvert; a++) {
- solution= laplacian_system_get_solution(a);
-
- if(bbone) {
- if(solution > 0.0f)
- add_vert_to_defgroup(ob, dgrouplist[j], a, solution,
- WEIGHT_ADD);
- }
- else {
- if(solution > WEIGHT_LIMIT)
- add_vert_to_defgroup(ob, dgrouplist[j], a, solution,
- WEIGHT_REPLACE);
- else
- remove_vert_defgroup(ob, dgrouplist[j], a);
- }
-
- /* do same for mirror */
- if(vertsflipped && dgroupflip[j] && vertsflipped[a] >= 0) {
- if(bbone) {
- if(solution > 0.0f)
- add_vert_to_defgroup(ob, dgroupflip[j], vertsflipped[a],
- solution, WEIGHT_ADD);
- }
- else {
- if(solution > WEIGHT_LIMIT)
- add_vert_to_defgroup(ob, dgroupflip[j], vertsflipped[a],
- solution, WEIGHT_REPLACE);
- else
- remove_vert_defgroup(ob, dgroupflip[j], vertsflipped[a]);
- }
- }
- }
- }
- else if(!thrownerror) {
- error("Bone Heat Weighting:"
- " failed to find solution for one or more bones");
- thrownerror= 1;
- break;
- }
-
- /* remove too small vertex weights */
- if(bbone && lastsegment) {
- for(a=0; a<me->totvert; a++) {
- weight= get_vert_defgroup(ob, dgrouplist[j], a);
- if(weight > 0.0f && weight <= WEIGHT_LIMIT)
- remove_vert_defgroup(ob, dgrouplist[j], a);
-
- if(vertsflipped && dgroupflip[j] && vertsflipped[a] >= 0) {
- weight= get_vert_defgroup(ob, dgroupflip[j], vertsflipped[a]);
- if(weight > 0.0f && weight <= WEIGHT_LIMIT)
- remove_vert_defgroup(ob, dgroupflip[j], vertsflipped[a]);
- }
- }
- }
- }
-
- /* free */
- if(vertsflipped) MEM_freeN(vertsflipped);
-
- RE_ray_tree_free(sys->heat.raytree);
- MEM_freeN(sys->heat.vface);
-
- MEM_freeN(sys->heat.mindist);
- MEM_freeN(sys->heat.H);
- MEM_freeN(sys->heat.p);
- MEM_freeN(sys->heat.vnors);
-
- laplacian_system_delete(sys);
-}
-
-#ifdef RIGID_DEFORM
-/********************** As-Rigid-As-Possible Deformation ******************/
-/* From "As-Rigid-As-Possible Surface Modeling",
- Olga Sorkine and Marc Alexa, ESGP 2007. */
-
-/* investigate:
- - transpose R in orthogonal
- - flipped normals and per face adding
- - move cancelling to transform, make origco pointer
-*/
-
-static LaplacianSystem *RigidDeformSystem = NULL;
-
-static void rigid_add_half_edge_to_R(LaplacianSystem *sys, EditVert *v1, EditVert *v2, float w)
-{
- float e[3], e_[3];
- int i;
-
- VecSubf(e, sys->rigid.origco[v1->tmp.l], sys->rigid.origco[v2->tmp.l]);
- VecSubf(e_, v1->co, v2->co);
-
- /* formula (5) */
- for (i=0; i<3; i++) {
- sys->rigid.R[v1->tmp.l][i][0] += w*e[0]*e_[i];
- sys->rigid.R[v1->tmp.l][i][1] += w*e[1]*e_[i];
- sys->rigid.R[v1->tmp.l][i][2] += w*e[2]*e_[i];
- }
-}
-
-static void rigid_add_edge_to_R(LaplacianSystem *sys, EditVert *v1, EditVert *v2, float w)
-{
- rigid_add_half_edge_to_R(sys, v1, v2, w);
- rigid_add_half_edge_to_R(sys, v2, v1, w);
-}
-
-static void rigid_orthogonalize_R(float R[][3])
-{
- HMatrix M, Q, S;
-
- Mat4CpyMat3(M, R);
- polar_decomp(M, Q, S);
- Mat3CpyMat4(R, Q);
-}
-
-static void rigid_add_half_edge_to_rhs(LaplacianSystem *sys, EditVert *v1, EditVert *v2, float w)
-{
- /* formula (8) */
- float Rsum[3][3], rhs[3];
-
- if (sys->vpinned[v1->tmp.l])
- return;
-
- Mat3AddMat3(Rsum, sys->rigid.R[v1->tmp.l], sys->rigid.R[v2->tmp.l]);
- Mat3Transp(Rsum);
-
- VecSubf(rhs, sys->rigid.origco[v1->tmp.l], sys->rigid.origco[v2->tmp.l]);
- Mat3MulVecfl(Rsum, rhs);
- VecMulf(rhs, 0.5f);
- VecMulf(rhs, w);
-
- VecAddf(sys->rigid.rhs[v1->tmp.l], sys->rigid.rhs[v1->tmp.l], rhs);
-}
-
-static void rigid_add_edge_to_rhs(LaplacianSystem *sys, EditVert *v1, EditVert *v2, float w)
-{
- rigid_add_half_edge_to_rhs(sys, v1, v2, w);
- rigid_add_half_edge_to_rhs(sys, v2, v1, w);
-}
-
-void rigid_deform_iteration()
-{
- LaplacianSystem *sys= RigidDeformSystem;
- EditMesh *em;
- EditVert *eve;
- EditFace *efa;
- int a, i;
-
- if(!sys)
- return;
-
- nlMakeCurrent(sys->context);
- em= sys->rigid.mesh;
-
- /* compute R */
- memset(sys->rigid.R, 0, sizeof(float)*3*3*sys->totvert);
- memset(sys->rigid.rhs, 0, sizeof(float)*3*sys->totvert);
-
- for(a=0, efa=em->faces.first; efa; efa=efa->next, a++) {
- rigid_add_edge_to_R(sys, efa->v1, efa->v2, sys->fweights[a][2]);
- rigid_add_edge_to_R(sys, efa->v2, efa->v3, sys->fweights[a][0]);
- rigid_add_edge_to_R(sys, efa->v3, efa->v1, sys->fweights[a][1]);
-
- if(efa->v4) {
- a++;
- rigid_add_edge_to_R(sys, efa->v1, efa->v3, sys->fweights[a][2]);
- rigid_add_edge_to_R(sys, efa->v3, efa->v4, sys->fweights[a][0]);
- rigid_add_edge_to_R(sys, efa->v4, efa->v1, sys->fweights[a][1]);
- }
- }
-
- for(a=0, eve=em->verts.first; eve; eve=eve->next, a++) {
- rigid_orthogonalize_R(sys->rigid.R[a]);
- eve->tmp.l= a;
- }
-
- /* compute right hand sides for solving */
- for(a=0, efa=em->faces.first; efa; efa=efa->next, a++) {
- rigid_add_edge_to_rhs(sys, efa->v1, efa->v2, sys->fweights[a][2]);
- rigid_add_edge_to_rhs(sys, efa->v2, efa->v3, sys->fweights[a][0]);
- rigid_add_edge_to_rhs(sys, efa->v3, efa->v1, sys->fweights[a][1]);
-
- if(efa->v4) {
- a++;
- rigid_add_edge_to_rhs(sys, efa->v1, efa->v3, sys->fweights[a][2]);
- rigid_add_edge_to_rhs(sys, efa->v3, efa->v4, sys->fweights[a][0]);
- rigid_add_edge_to_rhs(sys, efa->v4, efa->v1, sys->fweights[a][1]);
- }
- }
-
- /* solve for positions, for X,Y and Z separately */
- for(i=0; i<3; i++) {
- laplacian_begin_solve(sys, i);
-
- for(a=0; a<sys->totvert; a++)
- if(!sys->vpinned[a])
- laplacian_add_right_hand_side(sys, a, sys->rigid.rhs[a][i]);
-
- if(laplacian_system_solve(sys)) {
- for(a=0, eve=em->verts.first; eve; eve=eve->next, a++)
- eve->co[i]= laplacian_system_get_solution(a);
- }
- else {
- if(!sys->rigid.thrownerror) {
- error("RigidDeform: failed to find solution.");
- sys->rigid.thrownerror= 1;
- }
- break;
- }
- }
-}
-
-static void rigid_laplacian_create(LaplacianSystem *sys)
-{
- EditMesh *em = sys->rigid.mesh;
- EditVert *eve;
- EditFace *efa;
- int a;
-
- /* add verts and faces to laplacian */
- for(a=0, eve=em->verts.first; eve; eve=eve->next, a++) {
- laplacian_add_vertex(sys, eve->co, eve->pinned);
- eve->tmp.l= a;
- }
-
- for(efa=em->faces.first; efa; efa=efa->next) {
- laplacian_add_triangle(sys,
- efa->v1->tmp.l, efa->v2->tmp.l, efa->v3->tmp.l);
- if(efa->v4)
- laplacian_add_triangle(sys,
- efa->v1->tmp.l, efa->v3->tmp.l, efa->v4->tmp.l);
- }
-}
-
-void rigid_deform_begin(EditMesh *em)
-{
- LaplacianSystem *sys;
- EditVert *eve;
- EditFace *efa;
- int a, totvert, totface;
-
- /* count vertices, triangles */
- for(totvert=0, eve=em->verts.first; eve; eve=eve->next)
- totvert++;
-
- for(totface=0, efa=em->faces.first; efa; efa=efa->next) {
- totface++;
- if(efa->v4) totface++;
- }
-
- /* create laplacian */
- sys = laplacian_system_construct_begin(totvert, totface);
-
- sys->rigid.mesh= em;
- sys->rigid.R = MEM_callocN(sizeof(float)*3*3*totvert, "RigidDeformR");
- sys->rigid.rhs = MEM_callocN(sizeof(float)*3*totvert, "RigidDeformRHS");
- sys->rigid.origco = MEM_callocN(sizeof(float)*3*totvert, "RigidDeformCo");
-
- for(a=0, eve=em->verts.first; eve; eve=eve->next, a++)
- VecCopyf(sys->rigid.origco[a], eve->co);
-
- sys->areaweights= 0;
- sys->storeweights= 1;
-
- rigid_laplacian_create(sys);
-
- laplacian_system_construct_end(sys);
-
- RigidDeformSystem = sys;
-}
-
-void rigid_deform_end(int cancel)
-{
- LaplacianSystem *sys = RigidDeformSystem;
-
- if(sys) {
- EditMesh *em = sys->rigid.mesh;
- EditVert *eve;
- int a;
-
- if(cancel)
- for(a=0, eve=em->verts.first; eve; eve=eve->next, a++)
- if(!eve->pinned)
- VecCopyf(eve->co, sys->rigid.origco[a]);
-
- if(sys->rigid.R) MEM_freeN(sys->rigid.R);
- if(sys->rigid.rhs) MEM_freeN(sys->rigid.rhs);
- if(sys->rigid.origco) MEM_freeN(sys->rigid.origco);
-
- /* free */
- laplacian_system_delete(sys);
- }
-
- RigidDeformSystem = NULL;
-}
-#endif
-
-/************************** Harmonic Coordinates ****************************/
-/* From "Harmonic Coordinates for Character Articulation",
- Pushkar Joshi, Mark Meyer, Tony DeRose, Brian Green and Tom Sanocki,
- SIGGRAPH 2007. */
-
-#define EPSILON 0.0001f
-
-#define MESHDEFORM_TAG_UNTYPED 0
-#define MESHDEFORM_TAG_BOUNDARY 1
-#define MESHDEFORM_TAG_INTERIOR 2
-#define MESHDEFORM_TAG_EXTERIOR 3
-
-#define MESHDEFORM_LEN_THRESHOLD 1e-6
-
-#define MESHDEFORM_MIN_INFLUENCE 0.0005
-
-static int MESHDEFORM_OFFSET[7][3] =
- {{0,0,0}, {1,0,0}, {-1,0,0}, {0,1,0}, {0,-1,0}, {0,0,1}, {0,0,-1}};
-
-typedef struct MDefBoundIsect {
- float co[3], uvw[4];
- int nvert, v[4], facing;
- float len;
-} MDefBoundIsect;
-
-typedef struct MDefBindInfluence {
- struct MDefBindInfluence *next;
- float weight;
- int vertex;
-} MDefBindInfluence;
-
-typedef struct MeshDeformBind {
- /* grid dimensions */
- float min[3], max[3];
- float width[3], halfwidth[3];
- int size, size3;
-
- /* meshes */
- DerivedMesh *cagedm;
- float (*cagecos)[3];
- float (*vertexcos)[3];
- int totvert, totcagevert;
-
- /* grids */
- MemArena *memarena;
- MDefBoundIsect *(*boundisect)[6];
- int *semibound;
- int *tag;
- float *phi, *totalphi;
-
- /* mesh stuff */
- int *inside;
- float *weights;
- MDefBindInfluence **dyngrid;
- float cagemat[4][4];
-
- /* direct solver */
- int *varidx;
-
- /* raytrace */
- RayTree *raytree;
-} MeshDeformBind;
-
-/* ray intersection */
-
-/* our own triangle intersection, so we can fully control the epsilons and
- * prevent corner case from going wrong*/
-static int meshdeform_tri_intersect(float orig[3], float end[3], float vert0[3],
- float vert1[3], float vert2[3], float *isectco, float *uvw)
-{
- float edge1[3], edge2[3], tvec[3], pvec[3], qvec[3];
- float det,inv_det, u, v, dir[3], isectdir[3];
-
- VECSUB(dir, end, orig);
-
- /* find vectors for two edges sharing vert0 */
- VECSUB(edge1, vert1, vert0);
- VECSUB(edge2, vert2, vert0);
-
- /* begin calculating determinant - also used to calculate U parameter */
- Crossf(pvec, dir, edge2);
-
- /* if determinant is near zero, ray lies in plane of triangle */
- det = INPR(edge1, pvec);
-
- if (det == 0.0f)
- return 0;
- inv_det = 1.0f / det;
-
- /* calculate distance from vert0 to ray origin */
- VECSUB(tvec, orig, vert0);
-
- /* calculate U parameter and test bounds */
- u = INPR(tvec, pvec) * inv_det;
- if (u < -EPSILON || u > 1.0f+EPSILON)
- return 0;
-
- /* prepare to test V parameter */
- Crossf(qvec, tvec, edge1);
-
- /* calculate V parameter and test bounds */
- v = INPR(dir, qvec) * inv_det;
- if (v < -EPSILON || u + v > 1.0f+EPSILON)
- return 0;
-
- isectco[0]= (1.0f - u - v)*vert0[0] + u*vert1[0] + v*vert2[0];
- isectco[1]= (1.0f - u - v)*vert0[1] + u*vert1[1] + v*vert2[1];
- isectco[2]= (1.0f - u - v)*vert0[2] + u*vert1[2] + v*vert2[2];
-
- uvw[0]= 1.0 - u - v;
- uvw[1]= u;
- uvw[2]= v;
-
- /* check if it is within the length of the line segment */
- VECSUB(isectdir, isectco, orig);
-
- if(INPR(dir, isectdir) < -EPSILON)
- return 0;
-
- if(INPR(dir, dir) + EPSILON < INPR(isectdir, isectdir))
- return 0;
-
- return 1;
-}
-
-/* blender's raytracer is not use now, even though it is much faster. it can
- * give problems with rays falling through, so we use our own intersection
- * function above with tweaked epsilons */
-
-#if 0
-static MeshDeformBind *MESHDEFORM_BIND = NULL;
-
-static void meshdeform_ray_coords_func(RayFace *face, float **v1, float **v2, float **v3, float **v4)
-{
- MFace *mface= (MFace*)face;
- float (*cagecos)[3]= MESHDEFORM_BIND->cagecos;
-
- *v1= cagecos[mface->v1];
- *v2= cagecos[mface->v2];
- *v3= cagecos[mface->v3];
- *v4= (mface->v4)? cagecos[mface->v4]: NULL;
-}
-
-static int meshdeform_ray_check_func(Isect *is, RayFace *face)
-{
- return 1;
-}
-
-static void meshdeform_ray_tree_create(MeshDeformBind *mdb)
-{
- MFace *mface;
- float min[3], max[3];
- int a, totface;
-
- /* create a raytrace tree from the mesh */
- INIT_MINMAX(min, max);
-
- for(a=0; a<mdb->totcagevert; a++)
- DO_MINMAX(mdb->cagecos[a], min, max)
-
- MESHDEFORM_BIND= mdb;
-
- mface= mdb->cagedm->getFaceArray(mdb->cagedm);
- totface= mdb->cagedm->getNumFaces(mdb->cagedm);
-
- mdb->raytree= RE_ray_tree_create(64, totface, min, max,
- meshdeform_ray_coords_func, meshdeform_ray_check_func);
-
- for(a=0; a<totface; a++, mface++)
- RE_ray_tree_add_face(mdb->raytree, mface);
-
- RE_ray_tree_done(mdb->raytree);
-}
-
-static void meshdeform_ray_tree_free(MeshDeformBind *mdb)
-{
- MESHDEFORM_BIND= NULL;
- RE_ray_tree_free(mdb->raytree);
-}
-#endif
-
-static int meshdeform_intersect(MeshDeformBind *mdb, Isect *isec)
-{
- MFace *mface;
- float face[4][3], co[3], uvw[3], len, nor[3];
- int f, hit, is= 0, totface;
-
- isec->labda= 1e10;
-
- mface= mdb->cagedm->getFaceArray(mdb->cagedm);
- totface= mdb->cagedm->getNumFaces(mdb->cagedm);
-
- for(f=0; f<totface; f++, mface++) {
- VECCOPY(face[0], mdb->cagecos[mface->v1]);
- VECCOPY(face[1], mdb->cagecos[mface->v2]);
- VECCOPY(face[2], mdb->cagecos[mface->v3]);
-
- if(mface->v4) {
- VECCOPY(face[3], mdb->cagecos[mface->v4]);
- hit= meshdeform_tri_intersect(isec->start, isec->end, face[0], face[1], face[2], co, uvw);
-
- if(hit) {
- CalcNormFloat(face[0], face[1], face[2], nor);
- }
- else {
- hit= meshdeform_tri_intersect(isec->start, isec->end, face[0], face[2], face[3], co, uvw);
- CalcNormFloat(face[0], face[2], face[3], nor);
- }
- }
- else {
- hit= meshdeform_tri_intersect(isec->start, isec->end, face[0], face[1], face[2], co, uvw);
- CalcNormFloat(face[0], face[1], face[2], nor);
- }
-
- if(hit) {
- len= VecLenf(isec->start, co)/VecLenf(isec->start, isec->end);
- if(len < isec->labda) {
- isec->labda= len;
- isec->face= mface;
- isec->isect= (INPR(isec->vec, nor) <= 0.0f);
- is= 1;
- }
- }
- }
-
- return is;
-}
-
-static MDefBoundIsect *meshdeform_ray_tree_intersect(MeshDeformBind *mdb, float *co1, float *co2)
-{
- MDefBoundIsect *isect;
- Isect isec;
- float (*cagecos)[3];
- MFace *mface;
- float vert[4][3], len;
- static float epsilon[3]= {0, 0, 0}; //1e-4, 1e-4, 1e-4};
-
- /* setup isec */
- memset(&isec, 0, sizeof(isec));
- isec.mode= RE_RAY_MIRROR; /* we want the closest intersection */
- isec.lay= -1;
- isec.face_last= NULL;
- isec.faceorig= NULL;
- isec.labda= 1e10f;
-
- VECADD(isec.start, co1, epsilon);
- VECADD(isec.end, co2, epsilon);
- VECSUB(isec.vec, isec.end, isec.start);
-
-#if 0
- /*if(RE_ray_tree_intersect(mdb->raytree, &isec)) {*/
-#endif
-
- if(meshdeform_intersect(mdb, &isec)) {
- len= isec.labda;
- mface= isec.face;
-
- /* create MDefBoundIsect */
- isect= BLI_memarena_alloc(mdb->memarena, sizeof(*isect));
-
- /* compute intersection coordinate */
- isect->co[0]= co1[0] + isec.vec[0]*len;
- isect->co[1]= co1[1] + isec.vec[1]*len;
- isect->co[2]= co1[2] + isec.vec[2]*len;
-
- isect->len= VecLenf(co1, isect->co);
- if(isect->len < MESHDEFORM_LEN_THRESHOLD)
- isect->len= MESHDEFORM_LEN_THRESHOLD;
-
- isect->v[0]= mface->v1;
- isect->v[1]= mface->v2;
- isect->v[2]= mface->v3;
- isect->v[3]= mface->v4;
- isect->nvert= (mface->v4)? 4: 3;
-
- isect->facing= isec.isect;
-
- /* compute mean value coordinates for interpolation */
- cagecos= mdb->cagecos;
- VECCOPY(vert[0], cagecos[mface->v1]);
- VECCOPY(vert[1], cagecos[mface->v2]);
- VECCOPY(vert[2], cagecos[mface->v3]);
- if(mface->v4) VECCOPY(vert[3], cagecos[mface->v4]);
- MeanValueWeights(vert, isect->nvert, isect->co, isect->uvw);
-
- return isect;
- }
-
- return NULL;
-}
-
-static int meshdeform_inside_cage(MeshDeformBind *mdb, float *co)
-{
- MDefBoundIsect *isect;
- float outside[3], start[3], dir[3];
- int i, counter;
-
- for(i=1; i<=6; i++) {
- counter = 0;
-
- outside[0] = co[0] + (mdb->max[0] - mdb->min[0] + 1.0f)*MESHDEFORM_OFFSET[i][0];
- outside[1] = co[1] + (mdb->max[1] - mdb->min[1] + 1.0f)*MESHDEFORM_OFFSET[i][1];
- outside[2] = co[2] + (mdb->max[2] - mdb->min[2] + 1.0f)*MESHDEFORM_OFFSET[i][2];
-
- VECSUB(dir, outside, start);
- Normalize(dir);
- VECCOPY(start, co);
-
- isect = meshdeform_ray_tree_intersect(mdb, start, outside);
- if(isect && !isect->facing)
- return 1;
- }
-
- return 0;
-}
-
-/* solving */
-
-static int meshdeform_index(MeshDeformBind *mdb, int x, int y, int z, int n)
-{
- int size= mdb->size;
-
- x += MESHDEFORM_OFFSET[n][0];
- y += MESHDEFORM_OFFSET[n][1];
- z += MESHDEFORM_OFFSET[n][2];
-
- if(x < 0 || x >= mdb->size)
- return -1;
- if(y < 0 || y >= mdb->size)
- return -1;
- if(z < 0 || z >= mdb->size)
- return -1;
-
- return x + y*size + z*size*size;
-}
-
-static void meshdeform_cell_center(MeshDeformBind *mdb, int x, int y, int z, int n, float *center)
-{
- x += MESHDEFORM_OFFSET[n][0];
- y += MESHDEFORM_OFFSET[n][1];
- z += MESHDEFORM_OFFSET[n][2];
-
- center[0]= mdb->min[0] + x*mdb->width[0] + mdb->halfwidth[0];
- center[1]= mdb->min[1] + y*mdb->width[1] + mdb->halfwidth[1];
- center[2]= mdb->min[2] + z*mdb->width[2] + mdb->halfwidth[2];
-}
-
-static void meshdeform_add_intersections(MeshDeformBind *mdb, int x, int y, int z)
-{
- MDefBoundIsect *isect;
- float center[3], ncenter[3];
- int i, a;
-
- a= meshdeform_index(mdb, x, y, z, 0);
- meshdeform_cell_center(mdb, x, y, z, 0, center);
-
- /* check each outgoing edge for intersection */
- for(i=1; i<=6; i++) {
- if(meshdeform_index(mdb, x, y, z, i) == -1)
- continue;
-
- meshdeform_cell_center(mdb, x, y, z, i, ncenter);
-
- isect= meshdeform_ray_tree_intersect(mdb, center, ncenter);
- if(isect) {
- mdb->boundisect[a][i-1]= isect;
- mdb->tag[a]= MESHDEFORM_TAG_BOUNDARY;
- }
- }
-}
-
-static void meshdeform_bind_floodfill(MeshDeformBind *mdb)
-{
- int *stack, *tag= mdb->tag;
- int a, b, i, xyz[3], stacksize, size= mdb->size;
-
- stack= MEM_callocN(sizeof(int)*mdb->size3, "MeshDeformBindStack");
-
- /* we know lower left corner is EXTERIOR because of padding */
- tag[0]= MESHDEFORM_TAG_EXTERIOR;
- stack[0]= 0;
- stacksize= 1;
-
- /* floodfill exterior tag */
- while(stacksize > 0) {
- a= stack[--stacksize];
-
- xyz[2]= a/(size*size);
- xyz[1]= (a - xyz[2]*size*size)/size;
- xyz[0]= a - xyz[1]*size - xyz[2]*size*size;
-
- for(i=1; i<=6; i++) {
- b= meshdeform_index(mdb, xyz[0], xyz[1], xyz[2], i);
-
- if(b != -1) {
- if(tag[b] == MESHDEFORM_TAG_UNTYPED ||
- (tag[b] == MESHDEFORM_TAG_BOUNDARY && !mdb->boundisect[a][i-1])) {
- tag[b]= MESHDEFORM_TAG_EXTERIOR;
- stack[stacksize++]= b;
- }
- }
- }
- }
-
- /* other cells are interior */
- for(a=0; a<size*size*size; a++)
- if(tag[a]==MESHDEFORM_TAG_UNTYPED)
- tag[a]= MESHDEFORM_TAG_INTERIOR;
-
-#if 0
- {
- int tb, ti, te, ts;
- tb= ti= te= ts= 0;
- for(a=0; a<size*size*size; a++)
- if(tag[a]==MESHDEFORM_TAG_BOUNDARY)
- tb++;
- else if(tag[a]==MESHDEFORM_TAG_INTERIOR)
- ti++;
- else if(tag[a]==MESHDEFORM_TAG_EXTERIOR) {
- te++;
-
- if(mdb->semibound[a])
- ts++;
- }
-
- printf("interior %d exterior %d boundary %d semi-boundary %d\n", ti, te, tb, ts);
- }
-#endif
-
- MEM_freeN(stack);
-}
-
-static float meshdeform_boundary_phi(MeshDeformBind *mdb, MDefBoundIsect *isect, int cagevert)
-{
- int a;
-
- for(a=0; a<isect->nvert; a++)
- if(isect->v[a] == cagevert)
- return isect->uvw[a];
-
- return 0.0f;
-}
-
-static float meshdeform_interp_w(MeshDeformBind *mdb, float *gridvec, float *vec, int cagevert)
-{
- float dvec[3], ivec[3], wx, wy, wz, result=0.0f;
- float weight, totweight= 0.0f;
- int i, a, x, y, z;
-
- for(i=0; i<3; i++) {
- ivec[i]= (int)gridvec[i];
- dvec[i]= gridvec[i] - ivec[i];
- }
-
- for(i=0; i<8; i++) {
- if(i & 1) { x= ivec[0]+1; wx= dvec[0]; }
- else { x= ivec[0]; wx= 1.0f-dvec[0]; }
-
- if(i & 2) { y= ivec[1]+1; wy= dvec[1]; }
- else { y= ivec[1]; wy= 1.0f-dvec[1]; }
-
- if(i & 4) { z= ivec[2]+1; wz= dvec[2]; }
- else { z= ivec[2]; wz= 1.0f-dvec[2]; }
-
- CLAMP(x, 0, mdb->size-1);
- CLAMP(y, 0, mdb->size-1);
- CLAMP(z, 0, mdb->size-1);
-
- a= meshdeform_index(mdb, x, y, z, 0);
- weight= wx*wy*wz;
- result += weight*mdb->phi[a];
- totweight += weight;
- }
-
- if(totweight > 0.0f)
- result /= totweight;
-
- return result;
-}
-
-static void meshdeform_check_semibound(MeshDeformBind *mdb, int x, int y, int z)
-{
- int i, a;
-
- a= meshdeform_index(mdb, x, y, z, 0);
- if(mdb->tag[a] != MESHDEFORM_TAG_EXTERIOR)
- return;
-
- for(i=1; i<=6; i++)
- if(mdb->boundisect[a][i-1])
- mdb->semibound[a]= 1;
-}
-
-static float meshdeform_boundary_total_weight(MeshDeformBind *mdb, int x, int y, int z)
-{
- float weight, totweight= 0.0f;
- int i, a;
-
- a= meshdeform_index(mdb, x, y, z, 0);
-
- /* count weight for neighbour cells */
- for(i=1; i<=6; i++) {
- if(meshdeform_index(mdb, x, y, z, i) == -1)
- continue;
-
- if(mdb->boundisect[a][i-1])
- weight= 1.0f/mdb->boundisect[a][i-1]->len;
- else if(!mdb->semibound[a])
- weight= 1.0f/mdb->width[0];
- else
- weight= 0.0f;
-
- totweight += weight;
- }
-
- return totweight;
-}
-
-static void meshdeform_matrix_add_cell(MeshDeformBind *mdb, int x, int y, int z)
-{
- MDefBoundIsect *isect;
- float weight, totweight;
- int i, a, acenter;
-
- acenter= meshdeform_index(mdb, x, y, z, 0);
- if(mdb->tag[acenter] == MESHDEFORM_TAG_EXTERIOR)
- return;
-
- nlMatrixAdd(mdb->varidx[acenter], mdb->varidx[acenter], 1.0f);
-
- totweight= meshdeform_boundary_total_weight(mdb, x, y, z);
- for(i=1; i<=6; i++) {
- a= meshdeform_index(mdb, x, y, z, i);
- if(a == -1 || mdb->tag[a] == MESHDEFORM_TAG_EXTERIOR)
- continue;
-
- isect= mdb->boundisect[acenter][i-1];
- if (!isect) {
- weight= (1.0f/mdb->width[0])/totweight;
- nlMatrixAdd(mdb->varidx[acenter], mdb->varidx[a], -weight);
- }
- }
-}
-
-static void meshdeform_matrix_add_rhs(MeshDeformBind *mdb, int x, int y, int z, int cagevert)
-{
- MDefBoundIsect *isect;
- float rhs, weight, totweight;
- int i, a, acenter;
-
- acenter= meshdeform_index(mdb, x, y, z, 0);
- if(mdb->tag[acenter] == MESHDEFORM_TAG_EXTERIOR)
- return;
-
- totweight= meshdeform_boundary_total_weight(mdb, x, y, z);
- for(i=1; i<=6; i++) {
- a= meshdeform_index(mdb, x, y, z, i);
- if(a == -1)
- continue;
-
- isect= mdb->boundisect[acenter][i-1];
-
- if (isect) {
- weight= (1.0f/isect->len)/totweight;
- rhs= weight*meshdeform_boundary_phi(mdb, isect, cagevert);
- nlRightHandSideAdd(0, mdb->varidx[acenter], rhs);
- }
- }
-}
-
-static void meshdeform_matrix_add_semibound_phi(MeshDeformBind *mdb, int x, int y, int z, int cagevert)
-{
- MDefBoundIsect *isect;
- float rhs, weight, totweight;
- int i, a;
-
- a= meshdeform_index(mdb, x, y, z, 0);
- if(!mdb->semibound[a])
- return;
-
- mdb->phi[a]= 0.0f;
-
- totweight= meshdeform_boundary_total_weight(mdb, x, y, z);
- for(i=1; i<=6; i++) {
- isect= mdb->boundisect[a][i-1];
-
- if (isect) {
- weight= (1.0f/isect->len)/totweight;
- rhs= weight*meshdeform_boundary_phi(mdb, isect, cagevert);
- mdb->phi[a] += rhs;
- }
- }
-}
-
-static void meshdeform_matrix_add_exterior_phi(MeshDeformBind *mdb, int x, int y, int z, int cagevert)
-{
- float phi, totweight;
- int i, a, acenter;
-
- acenter= meshdeform_index(mdb, x, y, z, 0);
- if(mdb->tag[acenter] != MESHDEFORM_TAG_EXTERIOR || mdb->semibound[acenter])
- return;
-
- phi= 0.0f;
- totweight= 0.0f;
- for(i=1; i<=6; i++) {
- a= meshdeform_index(mdb, x, y, z, i);
-
- if(a != -1 && mdb->semibound[a]) {
- phi += mdb->phi[a];
- totweight += 1.0f;
- }
- }
-
- if(totweight != 0.0f)
- mdb->phi[acenter]= phi/totweight;
-}
-
-static void meshdeform_matrix_solve(MeshDeformBind *mdb)
-{
- NLContext *context;
- float vec[3], gridvec[3];
- int a, b, x, y, z, totvar;
- char message[1024];
-
- /* setup variable indices */
- mdb->varidx= MEM_callocN(sizeof(int)*mdb->size3, "MeshDeformDSvaridx");
- for(a=0, totvar=0; a<mdb->size3; a++)
- mdb->varidx[a]= (mdb->tag[a] == MESHDEFORM_TAG_EXTERIOR)? -1: totvar++;
-
- if(totvar == 0) {
- MEM_freeN(mdb->varidx);
- return;
- }
-
- progress_bar(0, "Starting mesh deform solve");
-
- /* setup opennl solver */
- nlNewContext();
- context= nlGetCurrent();
-
- nlSolverParameteri(NL_NB_VARIABLES, totvar);
- nlSolverParameteri(NL_NB_ROWS, totvar);
- nlSolverParameteri(NL_NB_RIGHT_HAND_SIDES, 1);
-
- nlBegin(NL_SYSTEM);
- nlBegin(NL_MATRIX);
-
- /* build matrix */
- for(z=0; z<mdb->size; z++)
- for(y=0; y<mdb->size; y++)
- for(x=0; x<mdb->size; x++)
- meshdeform_matrix_add_cell(mdb, x, y, z);
-
- /* solve for each cage vert */
- for(a=0; a<mdb->totcagevert; a++) {
- if(a != 0) {
- nlBegin(NL_SYSTEM);
- nlBegin(NL_MATRIX);
- }
-
- /* fill in right hand side and solve */
- for(z=0; z<mdb->size; z++)
- for(y=0; y<mdb->size; y++)
- for(x=0; x<mdb->size; x++)
- meshdeform_matrix_add_rhs(mdb, x, y, z, a);
-
- nlEnd(NL_MATRIX);
- nlEnd(NL_SYSTEM);
-
-#if 0
- nlPrintMatrix();
-#endif
-
- if(nlSolveAdvanced(NULL, NL_TRUE)) {
- for(z=0; z<mdb->size; z++)
- for(y=0; y<mdb->size; y++)
- for(x=0; x<mdb->size; x++)
- meshdeform_matrix_add_semibound_phi(mdb, x, y, z, a);
-
- for(z=0; z<mdb->size; z++)
- for(y=0; y<mdb->size; y++)
- for(x=0; x<mdb->size; x++)
- meshdeform_matrix_add_exterior_phi(mdb, x, y, z, a);
-
- for(b=0; b<mdb->size3; b++) {
- if(mdb->tag[b] != MESHDEFORM_TAG_EXTERIOR)
- mdb->phi[b]= nlGetVariable(0, mdb->varidx[b]);
- mdb->totalphi[b] += mdb->phi[b];
- }
-
- if(mdb->weights) {
- /* static bind : compute weights for each vertex */
- for(b=0; b<mdb->totvert; b++) {
- if(mdb->inside[b]) {
- VECCOPY(vec, mdb->vertexcos[b]);
- Mat4MulVecfl(mdb->cagemat, vec);
- gridvec[0]= (vec[0] - mdb->min[0] - mdb->halfwidth[0])/mdb->width[0];
- gridvec[1]= (vec[1] - mdb->min[1] - mdb->halfwidth[1])/mdb->width[1];
- gridvec[2]= (vec[2] - mdb->min[2] - mdb->halfwidth[2])/mdb->width[2];
-
- mdb->weights[b*mdb->totcagevert + a]= meshdeform_interp_w(mdb, gridvec, vec, a);
- }
- }
- }
- else {
- MDefBindInfluence *inf;
-
- /* dynamic bind */
- for(b=0; b<mdb->size3; b++) {
- if(mdb->phi[b] >= MESHDEFORM_MIN_INFLUENCE) {
- inf= BLI_memarena_alloc(mdb->memarena, sizeof(*inf));
- inf->vertex= a;
- inf->weight= mdb->phi[b];
- inf->next= mdb->dyngrid[b];
- mdb->dyngrid[b]= inf;
- }
- }
- }
- }
- else {
- error("Mesh Deform: failed to find solution.");
- break;
- }
-
- sprintf(message, "Mesh deform solve %d / %d |||", a+1, mdb->totcagevert);
- progress_bar((float)(a+1)/(float)(mdb->totcagevert), message);
- }
-
-#if 0
- /* sanity check */
- for(b=0; b<mdb->size3; b++)
- if(mdb->tag[b] != MESHDEFORM_TAG_EXTERIOR)
- if(fabs(mdb->totalphi[b] - 1.0f) > 1e-4)
- printf("totalphi deficiency [%s|%d] %d: %.10f\n",
- (mdb->tag[b] == MESHDEFORM_TAG_INTERIOR)? "interior": "boundary", mdb->semibound[b], mdb->varidx[b], mdb->totalphi[b]);
-#endif
-
- /* free */
- MEM_freeN(mdb->varidx);
-
- nlDeleteContext(context);
-}
-
-void harmonic_coordinates_bind(MeshDeformModifierData *mmd, float (*vertexcos)[3], int totvert, float cagemat[][4])
-{
- MeshDeformBind mdb;
- MDefBindInfluence *inf;
- MDefInfluence *mdinf;
- MDefCell *cell;
- MVert *mvert;
- float center[3], vec[3], maxwidth, totweight;
- int a, b, x, y, z, totinside, offset;
-
- waitcursor(1);
- start_progress_bar();
-
- memset(&mdb, 0, sizeof(MeshDeformBind));
-
- /* get mesh and cage mesh */
- mdb.vertexcos= vertexcos;
- mdb.totvert= totvert;
-
- mdb.cagedm= mesh_create_derived_no_deform(mmd->object, NULL, CD_MASK_BAREMESH);
- mdb.totcagevert= mdb.cagedm->getNumVerts(mdb.cagedm);
- mdb.cagecos= MEM_callocN(sizeof(*mdb.cagecos)*mdb.totcagevert, "MeshDeformBindCos");
- Mat4CpyMat4(mdb.cagemat, cagemat);
-
- mvert= mdb.cagedm->getVertArray(mdb.cagedm);
- for(a=0; a<mdb.totcagevert; a++)
- VECCOPY(mdb.cagecos[a], mvert[a].co)
-
- /* compute bounding box of the cage mesh */
- INIT_MINMAX(mdb.min, mdb.max);
-
- for(a=0; a<mdb.totcagevert; a++)
- DO_MINMAX(mdb.cagecos[a], mdb.min, mdb.max);
-
- /* allocate memory */
- mdb.size= (2<<(mmd->gridsize-1)) + 2;
- mdb.size3= mdb.size*mdb.size*mdb.size;
- mdb.tag= MEM_callocN(sizeof(int)*mdb.size3, "MeshDeformBindTag");
- mdb.phi= MEM_callocN(sizeof(float)*mdb.size3, "MeshDeformBindPhi");
- mdb.totalphi= MEM_callocN(sizeof(float)*mdb.size3, "MeshDeformBindTotalPhi");
- mdb.boundisect= MEM_callocN(sizeof(*mdb.boundisect)*mdb.size3, "MDefBoundIsect");
- mdb.semibound= MEM_callocN(sizeof(int)*mdb.size3, "MDefSemiBound");
-
- mdb.inside= MEM_callocN(sizeof(int)*mdb.totvert, "MDefInside");
-
- if(mmd->flag & MOD_MDEF_DYNAMIC_BIND)
- mdb.dyngrid= MEM_callocN(sizeof(MDefBindInfluence*)*mdb.size3, "MDefDynGrid");
- else
- mdb.weights= MEM_callocN(sizeof(float)*mdb.totvert*mdb.totcagevert, "MDefWeights");
-
- mdb.memarena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE);
- BLI_memarena_use_calloc(mdb.memarena);
-
- /* make bounding box equal size in all directions, add padding, and compute
- * width of the cells */
- maxwidth = -1.0f;
- for(a=0; a<3; a++)
- if(mdb.max[a]-mdb.min[a] > maxwidth)
- maxwidth= mdb.max[a]-mdb.min[a];
-
- for(a=0; a<3; a++) {
- center[a]= (mdb.min[a]+mdb.max[a])*0.5f;
- mdb.min[a]= center[a] - maxwidth*0.5f;
- mdb.max[a]= center[a] + maxwidth*0.5f;
-
- mdb.width[a]= (mdb.max[a]-mdb.min[a])/(mdb.size-4);
- mdb.min[a] -= 2.1f*mdb.width[a];
- mdb.max[a] += 2.1f*mdb.width[a];
-
- mdb.width[a]= (mdb.max[a]-mdb.min[a])/mdb.size;
- mdb.halfwidth[a]= mdb.width[a]*0.5f;
- }
-
- progress_bar(0, "Setting up mesh deform system");
-
-#if 0
- /* create ray tree */
- meshdeform_ray_tree_create(&mdb);
-#endif
-
- totinside= 0;
- for(a=0; a<mdb.totvert; a++) {
- VECCOPY(vec, mdb.vertexcos[a]);
- Mat4MulVecfl(mdb.cagemat, vec);
- mdb.inside[a]= meshdeform_inside_cage(&mdb, vec);
- if(mdb.inside[a])
- totinside++;
- }
-
- /* free temporary MDefBoundIsects */
- BLI_memarena_free(mdb.memarena);
- mdb.memarena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE);
-
- /* start with all cells untyped */
- for(a=0; a<mdb.size3; a++)
- mdb.tag[a]= MESHDEFORM_TAG_UNTYPED;
-
- /* detect intersections and tag boundary cells */
- for(z=0; z<mdb.size; z++)
- for(y=0; y<mdb.size; y++)
- for(x=0; x<mdb.size; x++)
- meshdeform_add_intersections(&mdb, x, y, z);
-
-#if 0
- /* free ray tree */
- meshdeform_ray_tree_free(&mdb);
-#endif
-
- /* compute exterior and interior tags */
- meshdeform_bind_floodfill(&mdb);
-
- for(z=0; z<mdb.size; z++)
- for(y=0; y<mdb.size; y++)
- for(x=0; x<mdb.size; x++)
- meshdeform_check_semibound(&mdb, x, y, z);
-
- /* solve */
- meshdeform_matrix_solve(&mdb);
-
- /* assign results */
- mmd->bindcos= (float*)mdb.cagecos;
- mmd->totvert= mdb.totvert;
- mmd->totcagevert= mdb.totcagevert;
- Mat4CpyMat4(mmd->bindmat, mmd->object->obmat);
-
- if(mmd->flag & MOD_MDEF_DYNAMIC_BIND) {
- mmd->totinfluence= 0;
- for(a=0; a<mdb.size3; a++)
- for(inf=mdb.dyngrid[a]; inf; inf=inf->next)
- mmd->totinfluence++;
-
- /* convert MDefBindInfluences to smaller MDefInfluences */
- mmd->dyngrid= MEM_callocN(sizeof(MDefCell)*mdb.size3, "MDefDynGrid");
- mmd->dyninfluences= MEM_callocN(sizeof(MDefInfluence)*mmd->totinfluence, "MDefInfluence");
- offset= 0;
- for(a=0; a<mdb.size3; a++) {
- cell= &mmd->dyngrid[a];
- cell->offset= offset;
-
- totweight= 0.0f;
- mdinf= mmd->dyninfluences + cell->offset;
- for(inf=mdb.dyngrid[a]; inf; inf=inf->next, mdinf++) {
- mdinf->weight= inf->weight;
- mdinf->vertex= inf->vertex;
- totweight += mdinf->weight;
- cell->totinfluence++;
- }
-
- if(totweight > 0.0f) {
- mdinf= mmd->dyninfluences + cell->offset;
- for(b=0; b<cell->totinfluence; b++, mdinf++)
- mdinf->weight /= totweight;
- }
-
- offset += cell->totinfluence;
- }
-
- mmd->dynverts= mdb.inside;
- mmd->dyngridsize= mdb.size;
- VECCOPY(mmd->dyncellmin, mdb.min);
- mmd->dyncellwidth= mdb.width[0];
- MEM_freeN(mdb.dyngrid);
- }
- else {
- mmd->bindweights= mdb.weights;
- MEM_freeN(mdb.inside);
- }
-
- /* transform bindcos to world space */
- for(a=0; a<mdb.totcagevert; a++)
- Mat4MulVecfl(mmd->object->obmat, mmd->bindcos+a*3);
-
- /* free */
- mdb.cagedm->release(mdb.cagedm);
- MEM_freeN(mdb.tag);
- MEM_freeN(mdb.phi);
- MEM_freeN(mdb.totalphi);
- MEM_freeN(mdb.boundisect);
- MEM_freeN(mdb.semibound);
- BLI_memarena_free(mdb.memarena);
-
- end_progress_bar();
- waitcursor(0);
-}
-
diff --git a/source/blender/src/meshtools.c b/source/blender/src/meshtools.c
deleted file mode 100644
index bcf07c9b594..00000000000
--- a/source/blender/src/meshtools.c
+++ /dev/null
@@ -1,1132 +0,0 @@
-/**
- * $Id:
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2004 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-/*
-
-meshtools.c: no editmode, tools operating on meshes
-
-int join_mesh(void);
-
-void fasterdraw(void);
-void slowerdraw(void);
-
-void sort_faces(void);
-
-*/
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_image_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_object_types.h"
-#include "DNA_material_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_world_types.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "BKE_depsgraph.h"
-#include "BKE_customdata.h"
-#include "BKE_global.h"
-#include "BKE_image.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
-#include "BKE_mesh.h"
-#include "BKE_material.h"
-#include "BKE_object.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_editmesh.h"
-#include "BIF_graphics.h"
-#include "BIF_interface.h"
-#include "BIF_mywindow.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-#include "BIF_editconstraint.h"
-
-#include "BDR_drawmesh.h"
-#include "BDR_editobject.h"
-#include "BDR_editface.h"
-#include "BDR_sculptmode.h"
-
-#include "BLI_editVert.h"
-#include "BLI_ghash.h"
-#include "BLI_threads.h"
-#include "BLI_rand.h" /* for randome face sorting */
-
-#include "mydevice.h"
-#include "blendef.h"
-
-#include "BIF_meshtools.h" /* include ourself for prototypes */
-
-#include "RE_pipeline.h"
-#include "RE_shader_ext.h"
-
-#include "PIL_time.h"
-
-#include "IMB_imbuf_types.h"
-#include "IMB_imbuf.h"
-
-/* from rendercode.c */
-#define VECMUL(dest, f) dest[0]*= f; dest[1]*= f; dest[2]*= f
-
-/* * ********************** no editmode!!! *********** */
-
-/* join selected meshes into the active mesh, context sensitive
-return 0 if no join is made (error) and 1 of the join is done */
-int join_mesh(void)
-{
- Base *base, *nextb;
- Object *ob;
- Material **matar, *ma;
- Mesh *me;
- MVert *mvert, *mvertmain;
- MEdge *medge = NULL, *medgemain;
- MFace *mface = NULL, *mfacemain;
- float imat[4][4], cmat[4][4];
- int a, b, totcol, totedge=0, totvert=0, totface=0, ok=0, vertofs, map[MAXMAT];
- int i, j, index, haskey=0, hasmulti=0, edgeofs, faceofs;
- bDeformGroup *dg, *odg;
- MDeformVert *dvert;
- CustomData vdata, edata, fdata;
-
- if(G.obedit) return 0;
-
- ob= OBACT;
- if(!ob || ob->type!=OB_MESH) return 0;
-
- if (object_data_is_libdata(ob)) {
- error_libdata();
- return 0;
- }
-
-#ifdef WITH_VERSE
- /* it isn't allowed to join shared object at verse server
- * this function will be implemented as soon as possible */
- base= FIRSTBASE;
- while(base) {
- if TESTBASELIB(base) {
- if(base->object->type==OB_MESH) {
- if(base->object->vnode) {
- haskey= 1;
- break;
- }
- }
- }
- base= base->next;
- }
- if(haskey) {
- error("Can't join meshes shared at verse server");
- return 0;
- }
-#endif
-
- /* count & check */
- base= FIRSTBASE;
- while(base) {
- if TESTBASELIB(base) {
- if(base->object->type==OB_MESH) {
- me= base->object->data;
- totvert+= me->totvert;
- totface+= me->totface;
-
- if(base->object == ob) ok= 1;
-
- if(me->key) {
- haskey= 1;
- break;
- }
- if(me->mr) {
- hasmulti= 1;
- break;
- }
- }
- }
- base= base->next;
- }
-
- if(haskey) {
- error("Can't join meshes with vertex keys");
- return 0;
- }
- if(hasmulti) {
- error("Can't join meshes with Multires");
- return 0;
- }
- /* that way the active object is always selected */
- if(ok==0) return 0;
-
- if(totvert==0 || totvert>MESH_MAX_VERTS) return 0;
-
- /* if needed add edges to other meshes */
- for(base= FIRSTBASE; base; base= base->next) {
- if TESTBASELIB(base) {
- if(base->object->type==OB_MESH) {
- me= base->object->data;
- totedge += me->totedge;
- }
- }
- }
-
- /* new material indices and material array */
- matar= MEM_callocN(sizeof(void *)*MAXMAT, "join_mesh");
- totcol= ob->totcol;
-
- /* obact materials in new main array, is nicer start! */
- for(a=1; a<=ob->totcol; a++) {
- matar[a-1]= give_current_material(ob, a);
- id_us_plus((ID *)matar[a-1]);
- /* increase id->us : will be lowered later */
- }
-
- base= FIRSTBASE;
- while(base) {
- if TESTBASELIB(base) {
- if(ob!=base->object && base->object->type==OB_MESH) {
- me= base->object->data;
-
- // Join this object's vertex groups to the base one's
- for (dg=base->object->defbase.first; dg; dg=dg->next){
- /* See if this group exists in the object */
- for (odg=ob->defbase.first; odg; odg=odg->next){
- if (!strcmp(odg->name, dg->name)){
- break;
- }
- }
- if (!odg){
- odg = MEM_callocN (sizeof(bDeformGroup), "join deformGroup");
- memcpy (odg, dg, sizeof(bDeformGroup));
- BLI_addtail(&ob->defbase, odg);
- }
-
- }
- if (ob->defbase.first && ob->actdef==0)
- ob->actdef=1;
-
- if(me->totvert) {
- for(a=1; a<=base->object->totcol; a++) {
- ma= give_current_material(base->object, a);
- if(ma) {
- for(b=0; b<totcol; b++) {
- if(ma == matar[b]) break;
- }
- if(b==totcol) {
- matar[b]= ma;
- ma->id.us++;
- totcol++;
- }
- if(totcol>=MAXMAT-1) break;
- }
- }
- }
- }
- if(totcol>=MAXMAT-1) break;
- }
- base= base->next;
- }
-
- me= ob->data;
-
- memset(&vdata, 0, sizeof(vdata));
- memset(&edata, 0, sizeof(edata));
- memset(&fdata, 0, sizeof(fdata));
-
- mvert= CustomData_add_layer(&vdata, CD_MVERT, CD_CALLOC, NULL, totvert);
- medge= CustomData_add_layer(&edata, CD_MEDGE, CD_CALLOC, NULL, totedge);
- mface= CustomData_add_layer(&fdata, CD_MFACE, CD_CALLOC, NULL, totface);
-
- mvertmain= mvert;
- medgemain= medge;
- mfacemain= mface;
-
- /* inverse transorm all selected meshes in this object */
- Mat4Invert(imat, ob->obmat);
-
- vertofs= 0;
- edgeofs= 0;
- faceofs= 0;
- base= FIRSTBASE;
- while(base) {
- nextb= base->next;
- if TESTBASELIB(base) {
- if(base->object->type==OB_MESH) {
-
- me= base->object->data;
-
- if(me->totvert) {
- CustomData_merge(&me->vdata, &vdata, CD_MASK_MESH, CD_DEFAULT, totvert);
- CustomData_copy_data(&me->vdata, &vdata, 0, vertofs, me->totvert);
-
- dvert= CustomData_get(&vdata, vertofs, CD_MDEFORMVERT);
-
- /* NEW VERSION */
- if (dvert){
- for (i=0; i<me->totvert; i++){
- for (j=0; j<dvert[i].totweight; j++){
- // Find the old vertex group
- odg = BLI_findlink (&base->object->defbase, dvert[i].dw[j].def_nr);
- if(odg) {
- // Search for a match in the new object
- for (dg=ob->defbase.first, index=0; dg; dg=dg->next, index++){
- if (!strcmp(dg->name, odg->name)){
- dvert[i].dw[j].def_nr = index;
- break;
- }
- }
- }
- }
- }
- }
-
- if(base->object != ob) {
- /* watch this: switch matmul order really goes wrong */
- Mat4MulMat4(cmat, base->object->obmat, imat);
-
- a= me->totvert;
- while(a--) {
- Mat4MulVecfl(cmat, mvert->co);
- mvert++;
- }
- }
- else mvert+= me->totvert;
- }
- if(me->totface) {
-
- /* make mapping for materials */
- memset(map, 0, 4*MAXMAT);
- for(a=1; a<=base->object->totcol; a++) {
- ma= give_current_material(base->object, a);
- if(ma) {
- for(b=0; b<totcol; b++) {
- if(ma == matar[b]) {
- map[a-1]= b;
- break;
- }
- }
- }
- }
-
- CustomData_merge(&me->fdata, &fdata, CD_MASK_MESH, CD_DEFAULT, totface);
- CustomData_copy_data(&me->fdata, &fdata, 0, faceofs, me->totface);
-
- for(a=0; a<me->totface; a++, mface++) {
- mface->v1+= vertofs;
- mface->v2+= vertofs;
- mface->v3+= vertofs;
- if(mface->v4) mface->v4+= vertofs;
-
- mface->mat_nr= map[(int)mface->mat_nr];
- }
-
- faceofs += me->totface;
- }
-
- if(me->totedge) {
- CustomData_merge(&me->edata, &edata, CD_MASK_MESH, CD_DEFAULT, totedge);
- CustomData_copy_data(&me->edata, &edata, 0, edgeofs, me->totedge);
-
- for(a=0; a<me->totedge; a++, medge++) {
- medge->v1+= vertofs;
- medge->v2+= vertofs;
- }
-
- edgeofs += me->totedge;
- }
-
- vertofs += me->totvert;
-
- if(base->object!=ob)
- free_and_unlink_base(base);
- }
- }
- base= nextb;
- }
-
- me= ob->data;
-
- CustomData_free(&me->vdata, me->totvert);
- CustomData_free(&me->edata, me->totedge);
- CustomData_free(&me->fdata, me->totface);
-
- me->totvert= totvert;
- me->totedge= totedge;
- me->totface= totface;
-
- me->vdata= vdata;
- me->edata= edata;
- me->fdata= fdata;
-
- mesh_update_customdata_pointers(me);
-
- /* old material array */
- for(a=1; a<=ob->totcol; a++) {
- ma= ob->mat[a-1];
- if(ma) ma->id.us--;
- }
- for(a=1; a<=me->totcol; a++) {
- ma= me->mat[a-1];
- if(ma) ma->id.us--;
- }
- if(ob->mat) MEM_freeN(ob->mat);
- if(me->mat) MEM_freeN(me->mat);
- ob->mat= me->mat= 0;
-
- if(totcol) {
- me->mat= matar;
- ob->mat= MEM_callocN(sizeof(void *)*totcol, "join obmatar");
- }
- else MEM_freeN(matar);
-
- ob->totcol= me->totcol= totcol;
- ob->colbits= 0;
-
- /* other mesh users */
- test_object_materials((ID *)me);
-
- DAG_scene_sort(G.scene); // removed objects, need to rebuild dag before editmode call
-
- enter_editmode(EM_WAITCURSOR);
- exit_editmode(EM_FREEDATA|EM_WAITCURSOR); // freedata, but no undo
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSSHADING, 0);
-
- BIF_undo_push("Join Mesh");
- return 1;
-}
-
-
-/* ********************** SORT FACES ******************* */
-
-static void permutate(void *list, int num, int size, int *index)
-{
- void *buf;
- int len;
- int i;
-
- len = num * size;
-
- buf = MEM_mallocN(len, "permutate");
- memcpy(buf, list, len);
-
- for (i = 0; i < num; i++) {
- memcpy((char *)list + (i * size), (char *)buf + (index[i] * size), size);
- }
- MEM_freeN(buf);
-}
-
-/* sort faces on view axis */
-static float *face_sort_floats;
-static int float_sort(const void *v1, const void *v2)
-{
- float x1, x2;
-
- x1 = face_sort_floats[((int *) v1)[0]];
- x2 = face_sort_floats[((int *) v2)[0]];
-
- if( x1 > x2 ) return 1;
- else if( x1 < x2 ) return -1;
- return 0;
-}
-
-
-void sort_faces(void)
-{
- Object *ob= OBACT;
- Mesh *me;
- CustomDataLayer *layer;
- int i, *index;
- short event;
- float reverse = 1;
-
- if(!ob) return;
- if(G.obedit) return;
- if(ob->type!=OB_MESH) return;
- if (!G.vd) return;
-
- me= ob->data;
- if(me->totface==0) return;
-
- event = pupmenu(
- "Sort Faces (Ctrl to reverse)%t|"
- "View Axis%x1|"
- "Cursor Distance%x2|"
- "Material%x3|"
- "Selection%x4|"
- "Randomize%x5");
-
- if (event==-1) return;
-
- if(G.qual & LR_CTRLKEY)
- reverse = -1;
-
-/* create index list */
- index = (int *) MEM_mallocN(sizeof(int) * me->totface, "sort faces");
- for (i = 0; i < me->totface; i++) {
- index[i] = i;
- }
-
- face_sort_floats = (float *) MEM_mallocN(sizeof(float) * me->totface, "sort faces float");
-
-/* sort index list instead of faces itself
- and apply this permutation to all face layers */
-
- if (event == 5) {
- /* Random */
- for(i=0; i<me->totface; i++) {
- face_sort_floats[i] = BLI_frand();
- }
- qsort(index, me->totface, sizeof(int), float_sort);
- } else {
- MFace *mf;
- float vec[3];
- float mat[4][4];
- float cur[3];
-
- if (event == 1)
- Mat4MulMat4(mat, OBACT->obmat, G.vd->viewmat); /* apply the view matrix to the object matrix */
- else if (event == 2) { /* sort from cursor */
- if( G.vd && G.vd->localview ) {
- VECCOPY(cur, G.vd->cursor);
- } else {
- VECCOPY(cur, G.scene->cursor);
- }
- Mat4Invert(mat, OBACT->obmat);
- Mat4MulVecfl(mat, cur);
- }
-
- mf= me->mface;
- for(i=0; i<me->totface; i++, mf++) {
-
- if (event==3) {
- face_sort_floats[i] = ((float)mf->mat_nr)*reverse;
- } else if (event==4) {
- /*selected first*/
- if (mf->flag & ME_FACE_SEL) face_sort_floats[i] = 0.0;
- else face_sort_floats[i] = reverse;
- } else {
- /* find the faces center */
- VECADD(vec, (me->mvert+mf->v1)->co, (me->mvert+mf->v2)->co);
- if (mf->v4) {
- VECADD(vec, vec, (me->mvert+mf->v3)->co);
- VECADD(vec, vec, (me->mvert+mf->v4)->co);
- VECMUL(vec, 0.25f);
- } else {
- VECADD(vec, vec, (me->mvert+mf->v3)->co);
- VECMUL(vec, 1.0f/3.0f);
- } /* done */
-
- if (event == 1) { /* sort on view axis */
- Mat4MulVecfl(mat, vec);
- face_sort_floats[i] = vec[2] * reverse;
- } else { /* distance from cursor*/
- face_sort_floats[i] = VecLenf(cur, vec) * reverse; /* back to front */
- }
- }
- }
- qsort(index, me->totface, sizeof(int), float_sort);
- }
-
- MEM_freeN(face_sort_floats);
-
- for(i = 0; i < me->fdata.totlayer; i++) {
- layer = &me->fdata.layers[i];
- permutate(layer->data, me->totface, CustomData_sizeof(layer->type), index);
- }
-
- MEM_freeN(index);
-
- allqueue(REDRAWVIEW3D, 0);
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
-}
-
-
-
-/* ********************* MESH VERTEX OCTREE LOOKUP ************* */
-
-/* important note; this is unfinished, needs better API for editmode, and custom threshold */
-
-#define MOC_RES 8
-#define MOC_NODE_RES 8
-#define MOC_THRESH 0.0002f
-
-typedef struct MocNode {
- struct MocNode *next;
- long index[MOC_NODE_RES];
-} MocNode;
-
-static int mesh_octree_get_base_offs(float *co, float *offs, float *div)
-{
- int vx, vy, vz;
-
- vx= floor( (co[0]-offs[0])/div[0] );
- vy= floor( (co[1]-offs[1])/div[1] );
- vz= floor( (co[2]-offs[2])/div[2] );
-
- CLAMP(vx, 0, MOC_RES-1);
- CLAMP(vy, 0, MOC_RES-1);
- CLAMP(vz, 0, MOC_RES-1);
-
- return (vx*MOC_RES*MOC_RES) + vy*MOC_RES + vz;
-}
-
-static void mesh_octree_add_node(MocNode **bt, long index)
-{
- if(*bt==NULL) {
- *bt= MEM_callocN(sizeof(MocNode), "MocNode");
- (*bt)->index[0]= index;
- }
- else {
- int a;
- for(a=0; a<MOC_NODE_RES; a++) {
- if((*bt)->index[a]==index)
- return;
- else if((*bt)->index[a]==0) {
- (*bt)->index[a]= index;
- return;
- }
- }
- mesh_octree_add_node(&(*bt)->next, index);
- }
-}
-
-static void mesh_octree_free_node(MocNode **bt)
-{
- if( (*bt)->next ) {
- mesh_octree_free_node(&(*bt)->next);
- }
- MEM_freeN(*bt);
-}
-
-
-/* temporal define, just to make nicer code below */
-#define MOC_ADDNODE(vx, vy, vz) mesh_octree_add_node(basetable + ((vx)*MOC_RES*MOC_RES) + (vy)*MOC_RES + (vz), index)
-
-static void mesh_octree_add_nodes(MocNode **basetable, float *co, float *offs, float *div, long index)
-{
- float fx, fy, fz;
- int vx, vy, vz;
-
- fx= (co[0]-offs[0])/div[0];
- fy= (co[1]-offs[1])/div[1];
- fz= (co[2]-offs[2])/div[2];
- CLAMP(fx, 0.0f, MOC_RES-MOC_THRESH);
- CLAMP(fy, 0.0f, MOC_RES-MOC_THRESH);
- CLAMP(fz, 0.0f, MOC_RES-MOC_THRESH);
-
- vx= floor(fx);
- vy= floor(fy);
- vz= floor(fz);
-
- MOC_ADDNODE(vx, vy, vz);
-
- if( vx>0 )
- if( fx-((float)vx)-MOC_THRESH < 0.0f)
- MOC_ADDNODE(vx-1, vy, vz);
- if( vx<MOC_RES-2 )
- if( fx-((float)vx)+MOC_THRESH > 1.0f)
- MOC_ADDNODE(vx+1, vy, vz);
-
- if( vy>0 )
- if( fy-((float)vy)-MOC_THRESH < 0.0f)
- MOC_ADDNODE(vx, vy-1, vz);
- if( vy<MOC_RES-2 )
- if( fy-((float)vy)+MOC_THRESH > 1.0f)
- MOC_ADDNODE(vx, vy+1, vz);
-
- if( vz>0 )
- if( fz-((float)vz)-MOC_THRESH < 0.0f)
- MOC_ADDNODE(vx, vy, vz-1);
- if( vz<MOC_RES-2 )
- if( fz-((float)vz)+MOC_THRESH > 1.0f)
- MOC_ADDNODE(vx, vy, vz+1);
-
-}
-
-static long mesh_octree_find_index(MocNode **bt, float (*orco)[3], MVert *mvert, float *co)
-{
- float *vec;
- int a;
-
- if(*bt==NULL)
- return -1;
-
- for(a=0; a<MOC_NODE_RES; a++) {
- if((*bt)->index[a]) {
- /* does mesh verts and editmode, code looks potential dangerous, octree should really be filled OK! */
- if(orco) {
- vec= orco[(*bt)->index[a]-1];
- if(FloatCompare(vec, co, MOC_THRESH))
- return (*bt)->index[a]-1;
- }
- else if(mvert) {
- vec= (mvert+(*bt)->index[a]-1)->co;
- if(FloatCompare(vec, co, MOC_THRESH))
- return (*bt)->index[a]-1;
- }
- else {
- EditVert *eve= (EditVert *)((*bt)->index[a]);
- if(FloatCompare(eve->co, co, MOC_THRESH))
- return (*bt)->index[a];
- }
- }
- else return -1;
- }
- if( (*bt)->next)
- return mesh_octree_find_index(&(*bt)->next, orco, mvert, co);
-
- return -1;
-}
-
-static struct {
- MocNode **table;
- float offs[3], div[3];
- float (*orco)[3];
- float orcoloc[3];
-} MeshOctree = {NULL, {0, 0, 0}, {0, 0, 0}, NULL};
-
-/* mode is 's' start, or 'e' end, or 'u' use */
-/* if end, ob can be NULL */
-long mesh_octree_table(Object *ob, float *co, char mode)
-{
- MocNode **bt;
-
- if(mode=='u') { /* use table */
- if(MeshOctree.table==NULL)
- mesh_octree_table(ob, NULL, 's');
-
- if(MeshOctree.table) {
- Mesh *me= ob->data;
- bt= MeshOctree.table + mesh_octree_get_base_offs(co, MeshOctree.offs, MeshOctree.div);
- if(ob==G.obedit)
- return mesh_octree_find_index(bt, NULL, NULL, co);
- else
- return mesh_octree_find_index(bt, MeshOctree.orco, me->mvert, co);
- }
- return -1;
- }
- else if(mode=='s') { /* start table */
- Mesh *me= ob->data;
- float min[3], max[3];
-
- /* we compute own bounding box and don't reuse ob->bb because
- * we are using the undeformed coordinates*/
- INIT_MINMAX(min, max);
-
- if(ob==G.obedit) {
- EditVert *eve;
-
- for(eve= G.editMesh->verts.first; eve; eve= eve->next)
- DO_MINMAX(eve->co, min, max)
- }
- else {
- MVert *mvert;
- float *co;
- int a, totvert;
-
- MeshOctree.orco= mesh_getRefKeyCos(me, &totvert);
- mesh_get_texspace(me, MeshOctree.orcoloc, NULL, NULL);
-
- for(a=0, mvert= me->mvert; a<me->totvert; a++, mvert++) {
- co= (MeshOctree.orco)? MeshOctree.orco[a]: mvert->co;
- DO_MINMAX(co, min, max);
- }
- }
-
- /* for quick unit coordinate calculus */
- VECCOPY(MeshOctree.offs, min);
- MeshOctree.offs[0]-= MOC_THRESH; /* we offset it 1 threshold unit extra */
- MeshOctree.offs[1]-= MOC_THRESH;
- MeshOctree.offs[2]-= MOC_THRESH;
-
- VecSubf(MeshOctree.div, max, min);
- MeshOctree.div[0]+= 2*MOC_THRESH; /* and divide with 2 threshold unit more extra (try 8x8 unit grid on paint) */
- MeshOctree.div[1]+= 2*MOC_THRESH;
- MeshOctree.div[2]+= 2*MOC_THRESH;
-
- VecMulf(MeshOctree.div, 1.0f/MOC_RES);
- if(MeshOctree.div[0]==0.0f) MeshOctree.div[0]= 1.0f;
- if(MeshOctree.div[1]==0.0f) MeshOctree.div[1]= 1.0f;
- if(MeshOctree.div[2]==0.0f) MeshOctree.div[2]= 1.0f;
-
- if(MeshOctree.table) /* happens when entering this call without ending it */
- mesh_octree_table(ob, co, 'e');
-
- MeshOctree.table= MEM_callocN(MOC_RES*MOC_RES*MOC_RES*sizeof(void *), "sym table");
-
- if(ob==G.obedit) {
- EditVert *eve;
-
- for(eve= G.editMesh->verts.first; eve; eve= eve->next) {
- mesh_octree_add_nodes(MeshOctree.table, eve->co, MeshOctree.offs, MeshOctree.div, (long)(eve));
- }
- }
- else {
- MVert *mvert;
- float *co;
- int a;
-
- for(a=0, mvert= me->mvert; a<me->totvert; a++, mvert++) {
- co= (MeshOctree.orco)? MeshOctree.orco[a]: mvert->co;
- mesh_octree_add_nodes(MeshOctree.table, co, MeshOctree.offs, MeshOctree.div, a+1);
- }
- }
- }
- else if(mode=='e') { /* end table */
- if(MeshOctree.table) {
- int a;
-
- for(a=0, bt=MeshOctree.table; a<MOC_RES*MOC_RES*MOC_RES; a++, bt++) {
- if(*bt) mesh_octree_free_node(bt);
- }
- MEM_freeN(MeshOctree.table);
- MeshOctree.table= NULL;
- }
- if(MeshOctree.orco) {
- MEM_freeN(MeshOctree.orco);
- MeshOctree.orco= NULL;
- }
- }
- return 0;
-}
-
-int mesh_get_x_mirror_vert(Object *ob, int index)
-{
- Mesh *me= ob->data;
- MVert *mvert;
- float vec[3];
-
- if(MeshOctree.orco) {
- float *loc= MeshOctree.orcoloc;
-
- vec[0]= -(MeshOctree.orco[index][0] + loc[0]) - loc[0];
- vec[1]= MeshOctree.orco[index][1];
- vec[2]= MeshOctree.orco[index][2];
- }
- else {
- mvert= me->mvert+index;
- vec[0]= -mvert->co[0];
- vec[1]= mvert->co[1];
- vec[2]= mvert->co[2];
- }
-
- return mesh_octree_table(ob, vec, 'u');
-}
-
-EditVert *editmesh_get_x_mirror_vert(Object *ob, float *co)
-{
- float vec[3];
- long poinval;
-
- vec[0]= -co[0];
- vec[1]= co[1];
- vec[2]= co[2];
-
- poinval= mesh_octree_table(ob, vec, 'u');
- if(poinval != -1)
- return (EditVert *)(poinval);
- return NULL;
-}
-
-static unsigned int mirror_facehash(void *ptr)
-{
- MFace *mf= ptr;
- int v0, v1;
-
- if(mf->v4) {
- v0= MIN4(mf->v1, mf->v2, mf->v3, mf->v4);
- v1= MAX4(mf->v1, mf->v2, mf->v3, mf->v4);
- }
- else {
- v0= MIN3(mf->v1, mf->v2, mf->v3);
- v1= MAX3(mf->v1, mf->v2, mf->v3);
- }
-
- return ((v0*39)^(v1*31));
-}
-
-static int mirror_facerotation(MFace *a, MFace *b)
-{
- if(b->v4) {
- if(a->v1==b->v1 && a->v2==b->v2 && a->v3==b->v3 && a->v4==b->v4)
- return 0;
- else if(a->v4==b->v1 && a->v1==b->v2 && a->v2==b->v3 && a->v3==b->v4)
- return 1;
- else if(a->v3==b->v1 && a->v4==b->v2 && a->v1==b->v3 && a->v2==b->v4)
- return 2;
- else if(a->v2==b->v1 && a->v3==b->v2 && a->v4==b->v3 && a->v1==b->v4)
- return 3;
- }
- else {
- if(a->v1==b->v1 && a->v2==b->v2 && a->v3==b->v3)
- return 0;
- else if(a->v3==b->v1 && a->v1==b->v2 && a->v2==b->v3)
- return 1;
- else if(a->v2==b->v1 && a->v3==b->v2 && a->v1==b->v3)
- return 2;
- }
-
- return -1;
-}
-
-static int mirror_facecmp(void *a, void *b)
-{
- return (mirror_facerotation((MFace*)a, (MFace*)b) == -1);
-}
-
-int *mesh_get_x_mirror_faces(Object *ob)
-{
- Mesh *me= ob->data;
- MVert *mv, *mvert= me->mvert;
- MFace mirrormf, *mf, *hashmf, *mface= me->mface;
- GHash *fhash;
- int *mirrorverts, *mirrorfaces;
- int a;
-
- mirrorverts= MEM_callocN(sizeof(int)*me->totvert, "MirrorVerts");
- mirrorfaces= MEM_callocN(sizeof(int)*2*me->totface, "MirrorFaces");
-
- mesh_octree_table(ob, NULL, 's');
-
- for(a=0, mv=mvert; a<me->totvert; a++, mv++)
- mirrorverts[a]= mesh_get_x_mirror_vert(ob, a);
-
- mesh_octree_table(ob, NULL, 'e');
-
- fhash= BLI_ghash_new(mirror_facehash, mirror_facecmp);
- for(a=0, mf=mface; a<me->totface; a++, mf++)
- BLI_ghash_insert(fhash, mf, mf);
-
- for(a=0, mf=mface; a<me->totface; a++, mf++) {
- mirrormf.v1= mirrorverts[mf->v3];
- mirrormf.v2= mirrorverts[mf->v2];
- mirrormf.v3= mirrorverts[mf->v1];
- mirrormf.v4= (mf->v4)? mirrorverts[mf->v4]: 0;
-
- hashmf= BLI_ghash_lookup(fhash, &mirrormf);
- if(hashmf) {
- mirrorfaces[a*2]= hashmf - mface;
- mirrorfaces[a*2+1]= mirror_facerotation(&mirrormf, hashmf);
- }
- else
- mirrorfaces[a*2]= -1;
- }
-
- BLI_ghash_free(fhash, NULL, NULL);
- MEM_freeN(mirrorverts);
-
- return mirrorfaces;
-}
-
-/* ****************** render BAKING ********************** */
-
-/* threaded break test */
-static volatile int g_break= 0;
-static int thread_break(void)
-{
- return g_break;
-}
-
-static ScrArea *biggest_image_area(void)
-{
- ScrArea *sa, *big= NULL;
- int size, maxsize= 0;
-
- for(sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- if(sa->spacetype==SPACE_IMAGE) {
- size= sa->winx*sa->winy;
- if(sa->winx > 10 && sa->winy > 10 && size > maxsize) {
- maxsize= size;
- big= sa;
- }
- }
- }
- return big;
-}
-
-
-typedef struct BakeRender {
- Render *re;
- struct Object *actob;
- int event, tot, ready;
-} BakeRender;
-
-static void *do_bake_render(void *bake_v)
-{
- BakeRender *bkr= bake_v;
-
- bkr->tot= RE_bake_shade_all_selected(bkr->re, bkr->event, bkr->actob);
- bkr->ready= 1;
-
- return NULL;
-}
-
-
-void objects_bake_render_menu(void)
-{
- short event;
-
- event= pupmenu("Bake Selected Meshes %t|Full Render %x1|Ambient Occlusion %x2|Normals %x3|Texture Only %x4");
-
- objects_bake_render(event);
-}
-
-/* all selected meshes with UV maps are rendered for current scene visibility */
-void objects_bake_render(short event)
-{
- Object *actob= OBACT;
- int active= G.scene->r.bake_flag & R_BAKE_TO_ACTIVE;
- short prev_r_raytrace= 0, prev_wo_amb_occ= 0;
-
- if(event==0) event= G.scene->r.bake_mode;
-
- if(G.scene->r.renderer!=R_INTERN) {
- error("Bake only supported for Internal Renderer");
- return;
- }
-
- if(active && !actob)
- return;
-
- if(event>0) {
- Render *re= RE_NewRender("_Bake View_");
- ScrArea *area= biggest_image_area();
- ListBase threads;
- BakeRender bkr;
- int timer=0, tot, sculptmode= G.f & G_SCULPTMODE;
-
- if(sculptmode) set_sculptmode();
-
- if(event==1) event= RE_BAKE_ALL;
- else if(event==2) event= RE_BAKE_AO;
- else if(event==3) event= RE_BAKE_NORMALS;
- else event= RE_BAKE_TEXTURE;
-
- if(event==RE_BAKE_AO) {
- if(G.scene->world==NULL) {
- error("No world set up");
- return;
- }
-
- /* If raytracing or AO is disabled, switch it on temporarily for baking. */
- prev_wo_amb_occ = (G.scene->world->mode & WO_AMB_OCC) != 0;
- G.scene->world->mode |= WO_AMB_OCC;
- }
- if(event==RE_BAKE_AO || active) {
- prev_r_raytrace = (G.scene->r.mode & R_RAYTRACE) != 0;
- G.scene->r.mode |= R_RAYTRACE;
- }
-
- waitcursor(1);
- RE_test_break_cb(re, thread_break);
- g_break= 0;
- G.afbreek= 0; /* blender_test_break uses this global */
-
- RE_Database_Baking(re, G.scene, event, (active)? actob: NULL);
-
- /* baking itself is threaded, cannot use test_break in threads. we also update optional imagewindow */
-
- BLI_init_threads(&threads, do_bake_render, 1);
- bkr.re= re;
- bkr.event= event;
- bkr.ready= 0;
- bkr.actob= (active)? actob: NULL;
- BLI_insert_thread(&threads, &bkr);
-
- while(bkr.ready==0) {
- PIL_sleep_ms(50);
- if(bkr.ready)
- break;
-
- g_break= blender_test_break();
-
- timer++;
- if(area && timer==20) {
- Image *ima= RE_bake_shade_get_image();
- if(ima) ((SpaceImage *)area->spacedata.first)->image= ima;
- scrarea_do_windraw(area);
- myswapbuffers();
- timer= 0;
- }
- }
- BLI_end_threads(&threads);
- tot= bkr.tot;
-
- RE_Database_Free(re);
- waitcursor(0);
-
- if(tot==0) error("No Images found to bake to");
- else {
- Image *ima;
- /* force OpenGL reload and mipmap recalc */
- for(ima= G.main->image.first; ima; ima= ima->id.next) {
- if(ima->ok==IMA_OK_LOADED) {
- ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
- if(ibuf && (ibuf->userflags & IB_BITMAPDIRTY)) {
- free_realtime_image(ima);
- imb_freemipmapImBuf(ibuf);
- }
- }
- }
- }
-
- /* restore raytrace and AO */
- if(event==RE_BAKE_AO)
- if(prev_wo_amb_occ == 0)
- G.scene->world->mode &= ~WO_AMB_OCC;
-
- if(event==RE_BAKE_AO || active)
- if(prev_r_raytrace == 0)
- G.scene->r.mode &= ~R_RAYTRACE;
-
- allqueue(REDRAWIMAGE, 0);
- allqueue(REDRAWVIEW3D, 0);
-
- if(sculptmode) set_sculptmode();
-
- }
-}
-
diff --git a/source/blender/src/multires-firstlevel.c b/source/blender/src/multires-firstlevel.c
deleted file mode 100644
index 2be867b5db0..00000000000
--- a/source/blender/src/multires-firstlevel.c
+++ /dev/null
@@ -1,410 +0,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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2006 by Nicholas Bishop
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
- * Deals with the first-level data in multires (edge flags, weights, and UVs)
- *
- * multires.h
- *
- */
-
-#include "DNA_customdata_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-
-#include "BIF_editmesh.h"
-
-#include "BKE_customdata.h"
-#include "BKE_global.h"
-#include "BKE_mesh.h"
-
-#include "BLI_editVert.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "blendef.h"
-#include "multires.h"
-
-#include <string.h>
-
-MDeformVert *subdivide_dverts(MDeformVert *src, MultiresLevel *lvl);
-MTFace *subdivide_mtfaces(MTFace *src, MultiresLevel *lvl);
-void multires_update_edge_flags(Mesh *me, EditMesh *em);
-void eed_to_medge_flag(EditEdge *eed, short *flag, char *crease);
-
-/*********** Generic ***********/
-
-CustomDataMask cdmask(const int type)
-{
- if(type == CD_MDEFORMVERT)
- return CD_MASK_MDEFORMVERT;
- else if(type == CD_MTFACE)
- return CD_MASK_MTFACE;
- return -1;
-}
-
-char type_ok(const int type)
-{
- return (type == CD_MDEFORMVERT) || (type == CD_MTFACE);
-}
-
-/* Copy vdata or fdata from Mesh or EditMesh to Multires. */
-void multires_update_customdata(MultiresLevel *lvl1, CustomData *src, CustomData *dst, const int type)
-{
- if(src && dst && type_ok(type)) {
- const int tot= (type == CD_MDEFORMVERT ? lvl1->totvert : lvl1->totface);
- int i;
-
- CustomData_free(dst, tot);
-
- if(CustomData_has_layer(src, type)) {
- if(G.obedit) {
- EditVert *eve= G.editMesh->verts.first;
- EditFace *efa= G.editMesh->faces.first;
- CustomData_copy(src, dst, cdmask(type), CD_CALLOC, tot);
- for(i=0; i<tot; ++i) {
- if(type == CD_MDEFORMVERT) {
- CustomData_from_em_block(&G.editMesh->vdata, dst, eve->data, i);
- eve= eve->next;
- }
- else if(type == CD_MTFACE) {
- CustomData_from_em_block(&G.editMesh->fdata, dst, efa->data, i);
- efa= efa->next;
- }
- }
- }
- else
- CustomData_copy(src, dst, cdmask(type), CD_DUPLICATE, tot);
- }
- }
-}
-
-/* Uses subdivide_dverts or subdivide_mtfaces to subdivide src to match lvl_end. Does not free src. */
-void *subdivide_customdata_to_level(void *src, MultiresLevel *lvl_start,
- MultiresLevel *lvl_end, const int type)
-{
- if(src && lvl_start && lvl_end && type_ok(type)) {
- MultiresLevel *lvl;
- void *cr_data= NULL, *pr_data= NULL;
-
- pr_data= src;
- for(lvl= lvl_start; lvl && lvl != lvl_end; lvl= lvl->next) {
- if(type == CD_MDEFORMVERT)
- cr_data= subdivide_dverts(pr_data, lvl);
- else if(type == CD_MTFACE)
- cr_data= subdivide_mtfaces(pr_data, lvl);
-
- /* Free previous subdivision level's data */
- if(lvl != lvl_start) {
- if(type == CD_MDEFORMVERT)
- free_dverts(pr_data, lvl->totvert);
- else if(type == CD_MTFACE)
- MEM_freeN(pr_data);
- }
-
- pr_data= cr_data;
- cr_data= NULL;
- }
-
- return pr_data;
- }
-
- return NULL;
-}
-
-/* Directly copy src into dst (handles both Mesh and EditMesh) */
-void customdata_to_mesh(Mesh *me, EditMesh *em, CustomData *src, CustomData *dst, const int tot, const int type)
-{
- if(me && me->mr && src && dst && type_ok(type)) {
- if(em) {
- int i;
- EditVert *eve= em->verts.first;
- EditFace *efa= em->faces.first;
- CustomData_copy(src, dst, cdmask(type), CD_CALLOC, 0);
-
- for(i=0; i<tot; ++i) {
- if(type == CD_MDEFORMVERT) {
- CustomData_to_em_block(src, dst, i, &eve->data);
- eve= eve->next;
- }
- else if(type == CD_MTFACE) {
- CustomData_to_em_block(src, dst, i, &efa->data);
- efa= efa->next;
- }
- }
- } else {
- CustomData_merge(src, dst, cdmask(type), CD_DUPLICATE, tot);
- }
- }
-}
-
-/* Subdivide vdata or fdata from Multires into either Mesh or EditMesh. */
-void multires_customdata_to_mesh(Mesh *me, EditMesh *em, MultiresLevel *lvl, CustomData *src,
- CustomData *dst, const int type)
-{
- if(me && me->mr && lvl && src && dst && type_ok(type) &&
- CustomData_has_layer(src, type)) {
- const int tot= (type == CD_MDEFORMVERT ? lvl->totvert : lvl->totface);
- if(lvl == me->mr->levels.first) {
- customdata_to_mesh(me, em, src, dst, tot, type);
- }
- else {
- CustomData cdf;
- const int count = CustomData_number_of_layers(src, type);
- int i;
-
- /* Construct a new CustomData containing the subdivided data */
- CustomData_copy(src, &cdf, cdmask(type), CD_ASSIGN, tot);
- for(i=0; i<count; ++i) {
- void *layer= CustomData_get_layer_n(&cdf, type, i);
- CustomData_set_layer_n(&cdf, type, i,
- subdivide_customdata_to_level(layer, me->mr->levels.first, lvl, type));
- }
-
- customdata_to_mesh(me, em, &cdf, dst, tot, type);
- CustomData_free(&cdf, tot);
- }
- }
-}
-
-/* Subdivide the first-level customdata up to cr_lvl, then delete the original data */
-void multires_del_lower_customdata(Multires *mr, MultiresLevel *cr_lvl)
-{
- MultiresLevel *lvl1= mr->levels.first;
- MDeformVert *dverts= NULL;
- CustomData cdf;
- int i;
-
- /* dverts */
- dverts= subdivide_customdata_to_level(CustomData_get(&mr->vdata, 0, CD_MDEFORMVERT),
- lvl1, cr_lvl, CD_MDEFORMVERT);
- if(dverts) {
- CustomData_free_layers(&mr->vdata, CD_MDEFORMVERT, lvl1->totvert);
- CustomData_add_layer(&mr->vdata, CD_MDEFORMVERT, CD_ASSIGN, dverts, cr_lvl->totvert);
- }
-
- /* mtfaces */
- CustomData_copy(&mr->fdata, &cdf, CD_MASK_MTFACE, CD_ASSIGN, cr_lvl->totface);
- for(i=0; i<CustomData_number_of_layers(&mr->fdata, CD_MTFACE); ++i) {
- MTFace *mtfaces=
- subdivide_customdata_to_level(CustomData_get_layer_n(&mr->fdata, CD_MTFACE, i),
- lvl1, cr_lvl, CD_MTFACE);
- if(mtfaces)
- CustomData_set_layer_n(&cdf, CD_MTFACE, i, mtfaces);
- }
-
- CustomData_free(&mr->fdata, lvl1->totface);
- mr->fdata= cdf;
-}
-
-/* Update all special first-level data, if the first-level is active */
-void multires_update_first_level(Mesh *me, EditMesh *em)
-{
- if(me && me->mr && me->mr->current == 1) {
- multires_update_customdata(me->mr->levels.first, em ? &em->vdata : &me->vdata,
- &me->mr->vdata, CD_MDEFORMVERT);
- multires_update_customdata(me->mr->levels.first, em ? &em->fdata : &me->fdata,
- &me->mr->fdata, CD_MTFACE);
- multires_update_edge_flags(me, em);
- }
-}
-
-/*********** Multires.edge_flags ***********/
-void multires_update_edge_flags(Mesh *me, EditMesh *em)
-{
- MultiresLevel *lvl= me->mr->levels.first;
- EditEdge *eed= NULL;
- int i;
-
- if(em) eed= em->edges.first;
- for(i=0; i<lvl->totedge; ++i) {
- if(em) {
- me->mr->edge_flags[i]= 0;
- eed_to_medge_flag(eed, &me->mr->edge_flags[i], &me->mr->edge_creases[i]);
- eed= eed->next;
- }
- else {
- me->mr->edge_flags[i]= me->medge[i].flag;
- me->mr->edge_creases[i]= me->medge[i].crease;
- }
- }
-}
-
-
-
-/*********** Multires.vdata ***********/
-
-/* MDeformVert */
-
-/* Add each weight from in to out. Scale each weight by w. */
-void multires_add_dvert(MDeformVert *out, const MDeformVert *in, const float w)
-{
- if(out && in) {
- int i, j;
- char found;
-
- for(i=0; i<in->totweight; ++i) {
- found= 0;
- for(j=0; j<out->totweight; ++j) {
- if(out->dw[j].def_nr==in->dw[i].def_nr) {
- out->dw[j].weight += in->dw[i].weight * w;
- found= 1;
- }
- }
- if(!found) {
- MDeformWeight *newdw= MEM_callocN(sizeof(MDeformWeight)*(out->totweight+1),
- "multires dvert");
- if(out->dw) {
- memcpy(newdw, out->dw, sizeof(MDeformWeight)*out->totweight);
- MEM_freeN(out->dw);
- }
-
- out->dw= newdw;
- out->dw[out->totweight].weight= in->dw[i].weight * w;
- out->dw[out->totweight].def_nr= in->dw[i].def_nr;
-
- ++out->totweight;
- }
- }
- }
-}
-
-/* Takes an input array of dverts and subdivides them (linear) using the topology of lvl */
-MDeformVert *subdivide_dverts(MDeformVert *src, MultiresLevel *lvl)
-{
- if(lvl && lvl->next) {
- MDeformVert *out = MEM_callocN(sizeof(MDeformVert)*lvl->next->totvert, "dvert prop array");
- int i, j;
-
- /* Copy lower level */
- for(i=0; i<lvl->totvert; ++i)
- multires_add_dvert(&out[i], &src[i], 1);
- /* Edge verts */
- for(i=0; i<lvl->totedge; ++i) {
- for(j=0; j<2; ++j)
- multires_add_dvert(&out[lvl->totvert+i], &src[lvl->edges[i].v[j]],0.5);
- }
-
- /* Face verts */
- for(i=0; i<lvl->totface; ++i) {
- for(j=0; j<(lvl->faces[i].v[3]?4:3); ++j)
- multires_add_dvert(&out[lvl->totvert + lvl->totedge + i],
- &src[lvl->faces[i].v[j]],
- lvl->faces[i].v[3]?0.25:(1.0f/3.0f));
- }
-
- return out;
- }
-
- return NULL;
-}
-
-
-
-/*********** Multires.fdata ***********/
-
-/* MTFace */
-
-void multires_uv_avg2(float out[2], const float a[2], const float b[2])
-{
- int i;
- for(i=0; i<2; ++i)
- out[i] = (a[i] + b[i]) / 2.0f;
-}
-
-/* Takes an input array of mtfaces and subdivides them (linear) using the topology of lvl */
-MTFace *subdivide_mtfaces(MTFace *src, MultiresLevel *lvl)
-{
- if(lvl && lvl->next) {
- MTFace *out= MEM_callocN(sizeof(MultiresColFace)*lvl->next->totface,"Multirescolfaces");
- int i, j, curf;
-
- for(i=0, curf=0; i<lvl->totface; ++i) {
- const char sides= lvl->faces[i].v[3]?4:3;
- float cntr[2]= {0, 0};
-
- /* Find average uv coord of the current face */
- for(j=0; j<sides; ++j) {
- cntr[0]+= src[i].uv[j][0];
- cntr[1]+= src[i].uv[j][1];
- }
- cntr[0]/= sides;
- cntr[1]/= sides;
-
- for(j=0; j<sides; ++j, ++curf) {
- out[curf]= src[i];
-
- multires_uv_avg2(out[curf].uv[0], src[i].uv[j], src[i].uv[j==0?sides-1:j-1]);
-
- out[curf].uv[1][0]= src[i].uv[j][0];
- out[curf].uv[1][1]= src[i].uv[j][1];
-
- multires_uv_avg2(out[curf].uv[2], src[i].uv[j], src[i].uv[j==sides-1?0:j+1]);
-
- out[curf].uv[3][0]= cntr[0];
- out[curf].uv[3][1]= cntr[1];
- }
- }
-
- return out;
- }
-
- return NULL;
-}
-
-void multires_delete_layer(Mesh *me, CustomData *cd, const int type, int n)
-{
- if(me && me->mr && cd) {
- MultiresLevel *lvl1= me->mr->levels.first;
-
- multires_update_levels(me, 0);
-
- CustomData_set_layer_active(cd, type, n);
- CustomData_free_layer_active(cd, type, lvl1->totface);
-
- multires_level_to_mesh(OBACT, me, 0);
- }
-}
-
-MultiresLevel *current_level(Multires *mr);
-void multires_add_layer(Mesh *me, CustomData *cd, const int type, const int n)
-{
- if(me && me->mr && cd) {
- multires_update_levels(me, 0);
-
- if(CustomData_has_layer(cd, type))
- CustomData_add_layer(cd, type, CD_DUPLICATE, CustomData_get_layer(cd, type),
- current_level(me->mr)->totface);
- else
- CustomData_add_layer(cd, type, CD_DEFAULT, NULL, current_level(me->mr)->totface);
-
- CustomData_set_layer_active(cd, type, n);
- multires_level_to_mesh(OBACT, me, 0);
- }
-}
diff --git a/source/blender/src/multires.c b/source/blender/src/multires.c
deleted file mode 100644
index 8704f9abfa4..00000000000
--- a/source/blender/src/multires.c
+++ /dev/null
@@ -1,1650 +0,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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2006 by Nicholas Bishop
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
- * Implements the multiresolution modeling tools.
- *
- * multires.h
- *
- */
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "DNA_key_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_modifier_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_vec_types.h"
-#include "DNA_view3d_types.h"
-
-#include "BKE_customdata.h"
-#include "BKE_depsgraph.h"
-#include "BKE_global.h"
-#include "BKE_key.h"
-#include "BKE_mesh.h"
-#include "BKE_modifier.h"
-#include "BKE_object.h"
-
-#include "BIF_editmesh.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-
-#include "BDR_editobject.h"
-#include "BDR_sculptmode.h"
-
-#include "BLI_editVert.h"
-
-#include "BSE_edit.h"
-#include "BSE_view.h"
-
-#include "IMB_imbuf.h"
-#include "IMB_imbuf_types.h"
-
-#include "blendef.h"
-#include "editmesh.h"
-#include "multires.h"
-#include "mydevice.h"
-#include "parametrizer.h"
-
-#include <math.h>
-
-const CustomDataMask vdata_mask= CD_MASK_MDEFORMVERT;
-
-void multires_calc_temp_data(struct MultiresLevel *lvl);
-
-int multires_test()
-{
- Mesh *me= get_mesh(OBACT);
- if(me && me->mr) {
- error("Unable to complete action with multires enabled.");
- return 1;
- }
- return 0;
-}
-int multires_level1_test()
-{
- Mesh *me= get_mesh(OBACT);
- if(me && me->mr && me->mr->current != 1) {
- error("Operation only available for multires level 1.");
- return 1;
- }
- return 0;
-}
-
-/* Sculptmode */
-
-void multires_check_state()
-{
- if(G.f & G_SCULPTMODE && !G.obedit)
- sculptmode_correct_state();
-}
-
-typedef struct MultiresMapNode {
- struct MultiresMapNode *next, *prev;
- unsigned Index;
-} MultiresMapNode;
-
-MultiresLevel *current_level(Multires *mr)
-{
- return BLI_findlink(&mr->levels, mr->current - 1);
-}
-
-MultiresLevel *multires_level_n(Multires *mr, int n)
-{
- if(mr)
- return BLI_findlink(&mr->levels, n - 1);
- else
- return NULL;
-}
-
-void Vec3fAvg3(float *out, float *v1, float *v2, float *v3)
-{
- out[0]= (v1[0]+v2[0]+v3[0])/3;
- out[1]= (v1[1]+v2[1]+v3[1])/3;
- out[2]= (v1[2]+v2[2]+v3[2])/3;
-}
-void Vec3fAvg4(float *out, float *v1, float *v2, float *v3, float *v4)
-{
- out[0]= (v1[0]+v2[0]+v3[0]+v4[0])/4;
- out[1]= (v1[1]+v2[1]+v3[1]+v4[1])/4;
- out[2]= (v1[2]+v2[2]+v3[2]+v4[2])/4;
-}
-
-short multires_vert_is_boundary(MultiresLevel *lvl, unsigned v)
-{
- MultiresMapNode *node= lvl->vert_edge_map[v].first;
- while(node) {
- if(lvl->edge_boundary_states[node->Index])
- return 1;
- node= node->next;
- }
- return 0;
-}
-
-typedef struct MultiApplyData {
- /* Smooth faces */
- float *corner1, *corner2, *corner3, *corner4;
- char quad;
-
- /* Smooth edges */
- char boundary;
- float edge_face_neighbor_midpoints_accum[3];
- unsigned edge_face_neighbor_midpoints_total;
- float *endpoint1, *endpoint2;
-
- /* Smooth verts */
- /* uses 'char boundary' */
- float *original;
- int edge_count;
- float vert_face_neighbor_midpoints_average[3];
- float vert_edge_neighbor_midpoints_average[3];
- float boundary_edges_average[3];
-} MultiApplyData;
-
-/* CATMULL-CLARK
- ============= */
-
-/* Simply averages the four corners of a polygon. */
-float catmullclark_smooth_face(MultiApplyData *data, const unsigned i)
-{
- const float total= data->corner1[i]+data->corner2[i]+data->corner3[i];
- return data->quad ? (total+data->corner4[i])/4 : total/3;
-}
-
-float catmullclark_smooth_edge(MultiApplyData *data, const unsigned i)
-{
- float accum= 0;
- unsigned count= 2;
-
- accum+= data->endpoint1[i] + data->endpoint2[i];
-
- if(!data->boundary) {
- accum+= data->edge_face_neighbor_midpoints_accum[i];
- count+= data->edge_face_neighbor_midpoints_total;
- }
-
- return accum / count;
-}
-float catmullclark_smooth_vert(MultiApplyData *data, const unsigned i)
-{
- if(data->boundary) {
- return data->original[i]*0.75 + data->boundary_edges_average[i]*0.25;
- } else {
- return (data->vert_face_neighbor_midpoints_average[i] +
- 2*data->vert_edge_neighbor_midpoints_average[i] +
- data->original[i]*(data->edge_count-3))/data->edge_count;
- }
-}
-
-
-
-/* Call func count times, passing in[i] as the input and storing the output in out[i] */
-void multi_apply(float *out, MultiApplyData *data,
- const unsigned count, float (*func)(MultiApplyData *, const unsigned))
-{
- unsigned i;
- for(i=0; i<count; ++i)
- out[i]= func(data,i);
-}
-
-#define GET_FLOAT(array, i, j, stride) (((float*)((char*)(array)+((i)*(stride))))[(j)])
-
-void edge_face_neighbor_midpoints_accum(MultiApplyData *data, MultiresLevel *lvl,
- void *array, const char stride, const MultiresEdge *e)
-{
- ListBase *neighbors1= &lvl->vert_face_map[e->v[0]];
- ListBase *neighbors2= &lvl->vert_face_map[e->v[1]];
- MultiresMapNode *n1, *n2;
- unsigned j,count= 0;
- float *out= data->edge_face_neighbor_midpoints_accum;
-
- out[0]=out[1]=out[2]= 0;
-
- for(n1= neighbors1->first; n1; n1= n1->next) {
- for(n2= neighbors2->first; n2; n2= n2->next) {
- if(n1->Index == n2->Index) {
- for(j=0; j<3; ++j)
- out[j]+= GET_FLOAT(array,lvl->faces[n1->Index].mid,j,stride);
- ++count;
- }
- }
- }
-
- data->edge_face_neighbor_midpoints_total= count;
-}
-void vert_face_neighbor_midpoints_average(MultiApplyData *data, MultiresLevel *lvl,
- void *array, const char stride, const unsigned i)
-{
- ListBase *neighbors= &lvl->vert_face_map[i];
- MultiresMapNode *n1;
- unsigned j,count= 0;
- float *out= data->vert_face_neighbor_midpoints_average;
-
- out[0]=out[1]=out[2]= 0;
-
- for(n1= neighbors->first; n1; n1= n1->next) {
- for(j=0; j<3; ++j)
- out[j]+= GET_FLOAT(array,lvl->faces[n1->Index].mid,j,stride);
- ++count;
- }
- for(j=0; j<3; ++j) out[j]/= count;
-}
-void vert_edge_neighbor_midpoints_average(MultiApplyData *data, MultiresLevel *lvl,
- void *array, const char stride, const unsigned i)
-{
- ListBase *neighbors= &lvl->vert_edge_map[i];
- MultiresMapNode *n1;
- unsigned j,count= 0;
- float *out= data->vert_edge_neighbor_midpoints_average;
-
- out[0]=out[1]=out[2]= 0;
-
- for(n1= neighbors->first; n1; n1= n1->next) {
- for(j=0; j<3; ++j)
- out[j]+= (GET_FLOAT(array,lvl->edges[n1->Index].v[0],j,stride) +
- GET_FLOAT(array,lvl->edges[n1->Index].v[1],j,stride)) / 2;
- ++count;
- }
- for(j=0; j<3; ++j) out[j]/= count;
-}
-void boundary_edges_average(MultiApplyData *data, MultiresLevel *lvl,
- void *array, const char stride, const unsigned i)
-{
- ListBase *neighbors= &lvl->vert_edge_map[i];
- MultiresMapNode *n1;
- unsigned j,count= 0;
- float *out= data->boundary_edges_average;
-
- out[0]=out[1]=out[2]= 0;
-
- for(n1= neighbors->first; n1; n1= n1->next) {
- const MultiresEdge *e= &lvl->edges[n1->Index];
- const unsigned end= e->v[0]==i ? e->v[1] : e->v[0];
-
- if(lvl->edge_boundary_states[n1->Index]) {
- for(j=0; j<3; ++j)
- out[j]+= GET_FLOAT(array,end,j,stride);
- ++count;
- }
- }
- for(j=0; j<3; ++j) out[j]/= count;
-}
-
-/* For manipulating vertex colors / uvs */
-void mcol_to_multires(MultiresColFace *mrf, MCol *mcol)
-{
- char i;
- for(i=0; i<4; ++i) {
- mrf->col[i].a= mcol[i].a;
- mrf->col[i].r= mcol[i].r;
- mrf->col[i].g= mcol[i].g;
- mrf->col[i].b= mcol[i].b;
- }
-}
-
-float clamp_component(const float c)
-{
- if(c<0) return 0;
- else if(c>255) return 255;
- else return c;
-}
-
-void multires_to_mcol(MultiresColFace *f, MCol mcol[4])
-{
- unsigned char j;
- for(j=0; j<4; ++j) {
- mcol->a= clamp_component(f->col[j].a);
- mcol->r= clamp_component(f->col[j].r);
- mcol->g= clamp_component(f->col[j].g);
- mcol->b= clamp_component(f->col[j].b);
- ++mcol;
- }
-}
-
-/* 1 <= count <= 4 */
-void multires_col_avg(MultiresCol *avg, MultiresCol cols[4], char count)
-{
- unsigned i;
- avg->a= avg->r= avg->g= avg->b= 0;
- for(i=0; i<count; ++i) {
- avg->a+= cols[i].a;
- avg->r+= cols[i].r;
- avg->g+= cols[i].g;
- avg->b+= cols[i].b;
- }
- avg->a/= count;
- avg->r/= count;
- avg->g/= count;
- avg->b/= count;
-}
-
-void multires_col_avg2(MultiresCol *avg, MultiresCol *c1, MultiresCol *c2)
-{
- MultiresCol in[2];
- in[0]= *c1;
- in[1]= *c2;
- multires_col_avg(avg,in,2);
-}
-
-void multires_load_cols(Mesh *me)
-{
- MultiresLevel *lvl= BLI_findlink(&me->mr->levels,me->mr->current-1), *cur;
- EditMesh *em= G.obedit ? G.editMesh : NULL;
- CustomData *src= em ? &em->fdata : &me->fdata;
- EditFace *efa= NULL;
- unsigned i,j;
-
- if(!CustomData_has_layer(src, CD_MCOL) && !CustomData_has_layer(src, CD_MTFACE)) return;
-
- /* Add texcol data */
- for(cur= me->mr->levels.first; cur; cur= cur->next)
- if(!cur->colfaces)
- cur->colfaces= MEM_callocN(sizeof(MultiresColFace)*cur->totface,"ColFaces");
-
- me->mr->use_col= CustomData_has_layer(src, CD_MCOL);
-
- if(em) efa= em->faces.first;
- for(i=0; i<lvl->totface; ++i) {
- MultiresColFace *f= &lvl->colfaces[i];
-
- if(me->mr->use_col)
- mcol_to_multires(f, em ? CustomData_em_get(src, efa->data, CD_MCOL) : &me->mcol[i*4]);
-
- if(em) efa= efa->next;
- }
-
- /* Update higher levels */
- lvl= lvl->next;
- while(lvl) {
- MultiresColFace *cf= lvl->colfaces;
- for(i=0; i<lvl->prev->totface; ++i) {
- const char sides= lvl->prev->faces[i].v[3]?4:3;
- MultiresCol cntr;
-
- /* Find average color of 4 (or 3 for triangle) verts */
- multires_col_avg(&cntr,lvl->prev->colfaces[i].col,sides);
-
- for(j=0; j<sides; ++j) {
- MultiresColFace *pf= &lvl->prev->colfaces[i];
-
- multires_col_avg2(&cf->col[0],
- &pf->col[j],
- &pf->col[j==0?sides-1:j-1]);
- cf->col[1]= pf->col[j];
- multires_col_avg2(&cf->col[2],
- &pf->col[j],
- &pf->col[j==sides-1?0:j+1]);
- cf->col[3]= cntr;
-
- ++cf;
- }
- }
- lvl= lvl->next;
- }
-
- /* Update lower levels */
- lvl= me->mr->levels.last;
- lvl= lvl->prev;
- while(lvl) {
- unsigned curf= 0;
- for(i=0; i<lvl->totface; ++i) {
- MultiresFace *f= &lvl->faces[i];
- for(j=0; j<(f->v[3]?4:3); ++j) {
- lvl->colfaces[i].col[j]= lvl->next->colfaces[curf].col[1];
- ++curf;
- }
- }
- lvl= lvl->prev;
- }
-}
-
-void multires_get_vert(MVert *out, EditVert *eve, MVert *m, int i)
-{
- if(eve) {
- VecCopyf(out->co, eve->co);
- out->flag= 0;
- if(eve->f & SELECT) out->flag |= 1;
- if(eve->h) out->flag |= ME_HIDE;
- eve->tmp.l= i;
- }
- else
- *out= *m;
-}
-
-void multires_get_face(MultiresFace *f, EditFace *efa, MFace *m)
-{
- if(efa) {
- MFace tmp;
- int j;
- tmp.v1= efa->v1->tmp.l;
- tmp.v2= efa->v2->tmp.l;
- tmp.v3= efa->v3->tmp.l;
- tmp.v4= 0;
- if(efa->v4) tmp.v4= efa->v4->tmp.l;
- test_index_face(&tmp, NULL, 0, efa->v4?4:3);
- for(j=0; j<4; ++j) f->v[j]= (&tmp.v1)[j];
-
- /* Flags */
- f->flag= efa->flag;
- if(efa->f & 1) f->flag |= ME_FACE_SEL;
- else f->flag &= ~ME_FACE_SEL;
- if(efa->h) f->flag |= ME_HIDE;
- f->mat_nr= efa->mat_nr;
- } else {
- f->v[0]= m->v1;
- f->v[1]= m->v2;
- f->v[2]= m->v3;
- f->v[3]= m->v4;
- f->flag= m->flag;
- f->mat_nr= m->mat_nr;
- }
-}
-
-void eed_to_medge_flag(EditEdge *eed, short *flag, char *crease)
-{
- if(!eed || !flag) return;
-
- /* Would be nice if EditMesh edge flags could be unified with Mesh flags! */
- *flag= (eed->f & SELECT) | ME_EDGERENDER;
- if(eed->f2<2) *flag |= ME_EDGEDRAW;
- if(eed->f2==0) *flag |= ME_LOOSEEDGE;
- if(eed->sharp) *flag |= ME_SHARP;
- if(eed->seam) *flag |= ME_SEAM;
- if(eed->h & EM_FGON) *flag |= ME_FGON;
- if(eed->h & 1) *flag |= ME_HIDE;
-
- *crease= (char)(255.0*eed->crease);
-}
-
-void multires_get_edge(MultiresEdge *e, EditEdge *eed, MEdge *m, short *flag, char *crease)
-{
- if(eed) {
- e->v[0]= eed->v1->tmp.l;
- e->v[1]= eed->v2->tmp.l;
- eed_to_medge_flag(eed, flag, crease);
- } else {
- e->v[0]= m->v1;
- e->v[1]= m->v2;
- *flag= m->flag;
- *crease= m->crease;
- }
-}
-
-void multires_make(void *ob, void *me_v)
-{
- Mesh *me= me_v;
- MultiresLevel *lvl;
- EditMesh *em= G.obedit ? G.editMesh : NULL;
- EditVert *eve= NULL;
- EditFace *efa= NULL;
- EditEdge *eed= NULL;
- Key *key;
- int i;
-
- /* Check for shape keys */
- key= me->key;
- if(key) {
- int ret= okee("Adding multires will delete all shape keys, proceed?");
- if(ret) {
- free_key(key);
- me->key= NULL;
- } else
- return;
- }
-
- lvl= MEM_callocN(sizeof(MultiresLevel), "multires level");
-
- waitcursor(1);
-
- multires_check_state();
-
- if(me->pv) sculptmode_pmv_off(me);
-
- me->mr= MEM_callocN(sizeof(Multires), "multires data");
-
- BLI_addtail(&me->mr->levels,lvl);
- me->mr->current= 1;
- me->mr->level_count= 1;
- me->mr->edgelvl= 1;
- me->mr->pinlvl= 1;
- me->mr->renderlvl= 1;
-
- /* Load mesh (or editmesh) into multires data */
-
- /* Load vertices and vdata (MDeformVerts) */
- lvl->totvert= em ? BLI_countlist(&em->verts) : me->totvert;
- me->mr->verts= MEM_callocN(sizeof(MVert)*lvl->totvert,"multires verts");
- multires_update_customdata(me->mr->levels.first, em ? &em->vdata : &me->vdata,
- &me->mr->vdata, CD_MDEFORMVERT);
- if(em) eve= em->verts.first;
- for(i=0; i<lvl->totvert; ++i) {
- multires_get_vert(&me->mr->verts[i], eve, &me->mvert[i], i);
- if(em) eve= eve->next;
- }
-
- /* Load faces and fdata (MTFaces) */
- lvl->totface= em ? BLI_countlist(&em->faces) : me->totface;
- lvl->faces= MEM_callocN(sizeof(MultiresFace)*lvl->totface,"multires faces");
- multires_update_customdata(me->mr->levels.first, em ? &em->fdata : &me->fdata,
- &me->mr->fdata, CD_MTFACE);
- if(em) efa= em->faces.first;
- for(i=0; i<lvl->totface; ++i) {
- multires_get_face(&lvl->faces[i], efa, &me->mface[i]);
- if(em) efa= efa->next;
- }
-
- /* Load edges and edge_flags */
- lvl->totedge= em ? BLI_countlist(&em->edges) : me->totedge;
- lvl->edges= MEM_callocN(sizeof(MultiresEdge)*lvl->totedge,"multires edges");
- me->mr->edge_flags= MEM_callocN(sizeof(short)*lvl->totedge, "multires edge flags");
- me->mr->edge_creases= MEM_callocN(sizeof(short)*lvl->totedge, "multires edge creases");
- if(em) eed= em->edges.first;
- for(i=0; i<lvl->totedge; ++i) {
- multires_get_edge(&lvl->edges[i], eed, &me->medge[i], &me->mr->edge_flags[i], &me->mr->edge_creases[i]);
- if(em) eed= eed->next;
- }
-
- multires_load_cols(me);
-
- allqueue(REDRAWBUTSEDIT, 0);
-
- BIF_undo_push("Make multires");
-
- waitcursor(0);
-}
-
-void multires_delete(void *ob, void *me_v)
-{
- Mesh *me= me_v;
- multires_free(me->mr);
- me->mr= NULL;
-
- multires_check_state();
-
- allqueue(REDRAWBUTSEDIT, 0);
-
- BIF_undo_push("Apply multires");
-}
-
-MultiresLevel *multires_level_copy(MultiresLevel *orig)
-{
- if(orig) {
- MultiresLevel *lvl= MEM_dupallocN(orig);
-
- lvl->next= lvl->prev= NULL;
- lvl->faces= MEM_dupallocN(orig->faces);
- lvl->colfaces= MEM_dupallocN(orig->colfaces);
- lvl->edges= MEM_dupallocN(orig->edges);
- lvl->edge_boundary_states = NULL;
- lvl->vert_edge_map= lvl->vert_face_map= NULL;
- lvl->map_mem= NULL;
-
- return lvl;
- }
- return NULL;
-}
-
-Multires *multires_copy(Multires *orig)
-{
- if(orig) {
- Multires *mr= MEM_dupallocN(orig);
- MultiresLevel *lvl;
-
- mr->levels.first= mr->levels.last= NULL;
-
- for(lvl= orig->levels.first; lvl; lvl= lvl->next)
- BLI_addtail(&mr->levels, multires_level_copy(lvl));
-
- mr->verts= MEM_dupallocN(orig->verts);
-
- lvl= mr->levels.first;
- if(lvl) {
- CustomData_copy(&orig->vdata, &mr->vdata, vdata_mask, CD_DUPLICATE, lvl->totvert);
- CustomData_copy(&orig->fdata, &mr->fdata, CD_MASK_MTFACE, CD_DUPLICATE, lvl->totface);
- mr->edge_flags= MEM_dupallocN(orig->edge_flags);
- mr->edge_creases= MEM_dupallocN(orig->edge_creases);
- }
-
- return mr;
- }
- return NULL;
-}
-
-void multires_free(Multires *mr)
-{
- if(mr) {
- MultiresLevel* lvl= mr->levels.first;
-
- /* Free the first-level data */
- if(lvl) {
- CustomData_free(&mr->vdata, lvl->totvert);
- CustomData_free(&mr->fdata, lvl->totface);
- MEM_freeN(mr->edge_flags);
- MEM_freeN(mr->edge_creases);
- }
-
- while(lvl) {
- multires_free_level(lvl);
- lvl= lvl->next;
- }
-
- MEM_freeN(mr->verts);
-
- BLI_freelistN(&mr->levels);
-
- MEM_freeN(mr);
- }
-}
-
-/* Free and clear the temporary connectivity data */
-void multires_free_temp_data(MultiresLevel *lvl)
-{
- if(lvl) {
- if(lvl->edge_boundary_states) MEM_freeN(lvl->edge_boundary_states);
- if(lvl->vert_edge_map) MEM_freeN(lvl->vert_edge_map);
- if(lvl->vert_face_map) MEM_freeN(lvl->vert_face_map);
- if(lvl->map_mem) MEM_freeN(lvl->map_mem);
-
- lvl->edge_boundary_states = NULL;
- lvl->vert_edge_map = lvl->vert_face_map = NULL;
- lvl->map_mem = NULL;
- }
-}
-
-/* Does not actually free lvl itself! */
-void multires_free_level(MultiresLevel *lvl)
-{
- if(lvl) {
- if(lvl->faces) MEM_freeN(lvl->faces);
- if(lvl->edges) MEM_freeN(lvl->edges);
- if(lvl->colfaces) MEM_freeN(lvl->colfaces);
-
- multires_free_temp_data(lvl);
- }
-}
-
-/* Make sure that all level indices are clipped to [1, mr->level_count] */
-void multires_clip_levels(Multires *mr)
-{
- if(mr) {
- const int cnt = mr->level_count;
-
- if(mr->current < 1) mr->current = 1;
- if(mr->edgelvl < 1) mr->edgelvl = 1;
- if(mr->pinlvl < 1) mr->pinlvl = 1;
- if(mr->renderlvl < 1) mr->renderlvl = 1;
-
- if(mr->current > cnt) mr->current = cnt;
- if(mr->edgelvl > cnt) mr->edgelvl = cnt;
- if(mr->pinlvl > cnt) mr->pinlvl = cnt;
- if(mr->renderlvl > cnt) mr->renderlvl = cnt;
- }
-}
-
-/* Delete all multires levels beneath current level. Subdivide special
- first-level data up to the new lowest level. */
-void multires_del_lower(void *ob, void *me)
-{
- Multires *mr= ((Mesh*)me)->mr;
- MultiresLevel *lvl1= mr->levels.first, *cr_lvl= current_level(mr);
- MultiresLevel *lvl= NULL, *lvlprev= NULL;
- short *edgeflags= NULL;
- char *edgecreases= NULL;
- int i, last;
-
- if(cr_lvl == lvl1) return;
-
- multires_check_state();
-
- /* Subdivide the edge flags to the current level */
- edgeflags= MEM_callocN(sizeof(short)*current_level(mr)->totedge, "Multires Edge Flags");
- edgecreases= MEM_callocN(sizeof(char)*current_level(mr)->totedge, "Multires Edge Creases");
- last= lvl1->totedge * pow(2, mr->current-1);
- for(i=0; i<last; ++i) {
- edgeflags[i] = mr->edge_flags[(int)(i / pow(2, mr->current-1))];
- edgecreases[i] = mr->edge_creases[(int)(i / pow(2, mr->current-1))];
- }
- MEM_freeN(mr->edge_flags);
- MEM_freeN(mr->edge_creases);
- mr->edge_flags= edgeflags;
- mr->edge_creases= edgecreases;
-
- multires_del_lower_customdata(mr, cr_lvl);
-
- lvl= cr_lvl->prev;
- while(lvl) {
- lvlprev= lvl->prev;
-
- multires_free_level(lvl);
- BLI_freelinkN(&mr->levels, lvl);
-
- mr->current-= 1;
- mr->level_count-= 1;
-
- lvl= lvlprev;
- }
- mr->newlvl= mr->current;
-
- multires_clip_levels(mr);
-
- allqueue(REDRAWBUTSEDIT, 0);
-
- BIF_undo_push("Multires delete lower");
-}
-
-void multires_del_higher(void *ob, void *me)
-{
- Multires *mr= ((Mesh*)me)->mr;
- MultiresLevel *lvl= BLI_findlink(&mr->levels,mr->current-1);
- MultiresLevel *lvlnext;
-
- multires_check_state();
-
- lvl= lvl->next;
- while(lvl) {
- lvlnext= lvl->next;
-
- multires_free_level(lvl);
- BLI_freelinkN(&mr->levels,lvl);
-
- mr->level_count-= 1;
-
- lvl= lvlnext;
- }
-
- multires_clip_levels(mr);
-
- allqueue(REDRAWBUTSEDIT, 0);
-
- BIF_undo_push("Multires delete higher");
-}
-
-unsigned int find_mid_edge(ListBase *vert_edge_map,
- MultiresLevel *lvl,
- const unsigned int v1,
- const unsigned int v2 )
-{
- MultiresMapNode *n= vert_edge_map[v1].first;
- while(n) {
- if(lvl->edges[n->Index].v[0]==v2 ||
- lvl->edges[n->Index].v[1]==v2)
- return lvl->edges[n->Index].mid;
-
- n= n->next;
- }
- return -1;
-}
-
-void check_colors(Mesh *me)
-{
- CustomData *src= G.obedit ? &G.editMesh->fdata : &me->fdata;
- const char col= CustomData_has_layer(src, CD_MCOL);
-
- /* Check if vertex colors have been deleted or added */
- if(me->mr->use_col && !col)
- me->mr->use_col= 0;
- else if(!me->mr->use_col && col) {
- me->mr->use_col= 1;
- multires_load_cols(me);
- }
-}
-
-void multires_add_level(void *ob, void *me_v)
-{
- int i,j, curf, cure;
- Mesh *me= me_v;
- MultiresLevel *lvl= NULL;
- MultiApplyData data;
- MVert *oldverts= NULL;
-
- multires_check_state();
-
- if(CustomData_number_of_layers(G.obedit ? &G.editMesh->fdata : &me->fdata, CD_MCOL) > 1) {
- int ret= okee("Adding a level will delete all but the active vertex color layer, proceed?");
- if(!ret)
- return;
- }
-
- waitcursor(1);
-
- lvl= MEM_callocN(sizeof(MultiresLevel), "multireslevel");
- if(me->pv) sculptmode_pmv_off(me);
-
- check_colors(me);
- multires_update_levels(me, 0);
-
- ++me->mr->level_count;
- BLI_addtail(&me->mr->levels,lvl);
-
- /* Create vertices
- =============== */
- lvl->totvert= lvl->prev->totvert + lvl->prev->totedge + lvl->prev->totface;
- oldverts= me->mr->verts;
- me->mr->verts= MEM_callocN(sizeof(MVert)*lvl->totvert, "multitres verts");
- /* Copy old verts */
- for(i=0; i<lvl->prev->totvert; ++i)
- me->mr->verts[i]= oldverts[i];
- /* Create new edge verts */
- for(i=0; i<lvl->prev->totedge; ++i) {
- VecMidf(me->mr->verts[lvl->prev->totvert + i].co,
- oldverts[lvl->prev->edges[i].v[0]].co,
- oldverts[lvl->prev->edges[i].v[1]].co);
- lvl->prev->edges[i].mid= lvl->prev->totvert + i;
- }
- /* Create new face verts */
- for(i=0; i<lvl->prev->totface; ++i) {
- lvl->prev->faces[i].mid= lvl->prev->totvert + lvl->prev->totedge + i;
- }
-
- multires_calc_temp_data(lvl->prev);
-
- /* Create faces
- ============ */
- /* Allocate all the new faces (each triangle creates three, and
- each quad creates four */
- lvl->totface= 0;
- for(i=0; i<lvl->prev->totface; ++i)
- lvl->totface+= lvl->prev->faces[i].v[3] ? 4 : 3;
- lvl->faces= MEM_callocN(sizeof(MultiresFace)*lvl->totface,"multires faces");
-
- curf= 0;
- for(i=0; i<lvl->prev->totface; ++i) {
- const int max= lvl->prev->faces[i].v[3] ? 3 : 2;
-
- for(j=0; j<max+1; ++j) {
- lvl->faces[curf].v[0]= find_mid_edge(lvl->prev->vert_edge_map,lvl->prev,
- lvl->prev->faces[i].v[j],
- lvl->prev->faces[i].v[j==0?max:j-1]);
- lvl->faces[curf].v[1]= lvl->prev->faces[i].v[j];
- lvl->faces[curf].v[2]= find_mid_edge(lvl->prev->vert_edge_map,lvl->prev,
- lvl->prev->faces[i].v[j],
- lvl->prev->faces[i].v[j==max?0:j+1]);
- lvl->faces[curf].v[3]= lvl->prev->totvert + lvl->prev->totedge + i;
- lvl->faces[curf].flag= lvl->prev->faces[i].flag;
- lvl->faces[curf].mat_nr= lvl->prev->faces[i].mat_nr;
-
- ++curf;
- }
- }
-
- /* Create edges
- ============ */
- /* Figure out how many edges to allocate */
- lvl->totedge= lvl->prev->totedge*2;
- for(i=0; i<lvl->prev->totface; ++i)
- lvl->totedge+= lvl->prev->faces[i].v[3]?4:3;
- lvl->edges= MEM_callocN(sizeof(MultiresEdge)*lvl->totedge,"multires edges");
-
- for(i=0; i<lvl->prev->totedge; ++i) {
- lvl->edges[i*2].v[0]= lvl->prev->edges[i].v[0];
- lvl->edges[i*2].v[1]= lvl->prev->edges[i].mid;
- lvl->edges[i*2+1].v[0]= lvl->prev->edges[i].mid;
- lvl->edges[i*2+1].v[1]= lvl->prev->edges[i].v[1];
- }
- /* Add edges inside of old polygons */
- curf= 0;
- cure= lvl->prev->totedge*2;
- for(i=0; i<lvl->prev->totface; ++i) {
- for(j=0; j<(lvl->prev->faces[i].v[3]?4:3); ++j) {
- lvl->edges[cure].v[0]= lvl->faces[curf].v[2];
- lvl->edges[cure].v[1]= lvl->faces[curf].v[3];
- ++cure;
- ++curf;
- }
- }
-
- /* Smooth vertices
- =============== */
- for(i=0; i<lvl->prev->totface; ++i) {
- const MultiresFace *f= &lvl->prev->faces[i];
- data.corner1= oldverts[f->v[0]].co;
- data.corner2= oldverts[f->v[1]].co;
- data.corner3= oldverts[f->v[2]].co;
- data.corner4= oldverts[f->v[3]].co;
- data.quad= f->v[3] ? 1 : 0;
- multi_apply(me->mr->verts[f->mid].co, &data, 3, catmullclark_smooth_face);
- }
-
- if(G.scene->toolsettings->multires_subdiv_type == 0) {
- for(i=0; i<lvl->prev->totedge; ++i) {
- const MultiresEdge *e= &lvl->prev->edges[i];
- data.boundary= lvl->prev->edge_boundary_states[i];
- edge_face_neighbor_midpoints_accum(&data,lvl->prev, me->mr->verts, sizeof(MVert),e);
- data.endpoint1= oldverts[e->v[0]].co;
- data.endpoint2= oldverts[e->v[1]].co;
- multi_apply(me->mr->verts[e->mid].co, &data, 3, catmullclark_smooth_edge);
- }
-
- for(i=0; i<lvl->prev->totvert; ++i) {
- data.boundary= multires_vert_is_boundary(lvl->prev,i);
- data.original= oldverts[i].co;
- data.edge_count= BLI_countlist(&lvl->prev->vert_edge_map[i]);
- if(data.boundary)
- boundary_edges_average(&data,lvl->prev, oldverts, sizeof(MVert),i);
- else {
- vert_face_neighbor_midpoints_average(&data,lvl->prev, me->mr->verts,
- sizeof(MVert),i);
- vert_edge_neighbor_midpoints_average(&data,lvl->prev, oldverts,
- sizeof(MVert),i);
- }
- multi_apply(me->mr->verts[i].co, &data, 3, catmullclark_smooth_vert);
- }
- }
-
- multires_free_temp_data(lvl->prev);
- MEM_freeN(oldverts);
-
- /* Vertex Colors
- ============= */
- curf= 0;
- if(me->mr->use_col) {
- MultiresColFace *cf= MEM_callocN(sizeof(MultiresColFace)*lvl->totface,"Multirescolfaces");
- lvl->colfaces= cf;
- for(i=0; i<lvl->prev->totface; ++i) {
- const char sides= lvl->prev->faces[i].v[3]?4:3;
- MultiresCol cntr;
-
- /* Find average color of 4 (or 3 for triangle) verts */
- multires_col_avg(&cntr,lvl->prev->colfaces[i].col,sides);
-
- for(j=0; j<sides; ++j) {
- multires_col_avg2(&cf->col[0],
- &lvl->prev->colfaces[i].col[j],
- &lvl->prev->colfaces[i].col[j==0?sides-1:j-1]);
- cf->col[1]= lvl->prev->colfaces[i].col[j];
- multires_col_avg2(&cf->col[2],
- &lvl->prev->colfaces[i].col[j],
- &lvl->prev->colfaces[i].col[j==sides-1?0:j+1]);
- cf->col[3]= cntr;
-
- ++cf;
- }
- }
- }
-
- me->mr->newlvl= me->mr->level_count;
- me->mr->current= me->mr->newlvl;
- /* Unless the render level has been set to something other than the
- highest level (by the user), increment the render level to match
- the highest available level */
- if(me->mr->renderlvl == me->mr->level_count - 1) me->mr->renderlvl= me->mr->level_count;
-
- multires_level_to_mesh(ob, me, 0);
-
- allqueue(REDRAWBUTSEDIT, 0);
-
- BIF_undo_push("Add multires level");
-
- waitcursor(0);
-}
-
-void multires_set_level_cb(void *ob, void *me)
-{
- multires_set_level(ob, me, 0);
-}
-
-void multires_set_level(struct Object *ob, struct Mesh *me, const int render)
-{
- waitcursor(1);
-
- multires_check_state();
-
- if(me->pv) sculptmode_pmv_off(me);
-
- check_colors(me);
- multires_update_levels(me, render);
-
- me->mr->current= me->mr->newlvl;
- if(me->mr->current<1) me->mr->current= 1;
- else if(me->mr->current>me->mr->level_count) me->mr->current= me->mr->level_count;
-
- multires_level_to_mesh(ob, me, render);
-
- if(!render && (G.obedit || G.f & G_SCULPTMODE))
- BIF_undo_push("Multires set level");
-
- allqueue(REDRAWBUTSEDIT, 0);
-
- waitcursor(0);
-}
-
-
-void medge_flag_to_eed(const short flag, const char crease, EditEdge *eed)
-{
- if(!eed) return;
-
- if(flag & ME_SEAM) eed->seam= 1;
- if(flag & ME_SHARP) eed->sharp = 1;
- if(flag & SELECT) eed->f |= SELECT;
- if(flag & ME_FGON) eed->h= EM_FGON;
- if(flag & ME_HIDE) eed->h |= 1;
-
- eed->crease= ((float)crease)/255.0;
-}
-
-/* note, function is called in background render too, without UI */
-void multires_level_to_mesh(Object *ob, Mesh *me, const int render)
-{
- MultiresLevel *lvl= BLI_findlink(&me->mr->levels,me->mr->current-1);
- int i;
- EditMesh *em= (!render && G.obedit) ? G.editMesh : NULL;
- EditVert **eves= NULL;
- EditEdge *eed= NULL;
-
- if(em) {
- /* Remove editmesh elements */
- free_editMesh(em);
-
- eves= MEM_callocN(sizeof(EditVert*)*lvl->totvert, "editvert pointers");
- } else {
- CustomData_free_layer_active(&me->vdata, CD_MVERT, me->totvert);
- CustomData_free_layer_active(&me->edata, CD_MEDGE, me->totedge);
- CustomData_free_layer_active(&me->fdata, CD_MFACE, me->totface);
- CustomData_free_layer_active(&me->vdata, CD_MDEFORMVERT, me->totvert);
- CustomData_free_layers(&me->fdata, CD_MTFACE, me->totface);
- CustomData_free_layers(&me->fdata, CD_MCOL, me->totface);
-
- me->totvert= lvl->totvert;
- me->totface= lvl->totface;
- me->totedge= lvl->totedge;
-
- CustomData_add_layer(&me->vdata, CD_MVERT, CD_CALLOC, NULL, me->totvert);
- CustomData_add_layer(&me->edata, CD_MEDGE, CD_CALLOC, NULL, me->totedge);
- CustomData_add_layer(&me->fdata, CD_MFACE, CD_CALLOC, NULL, me->totface);
- mesh_update_customdata_pointers(me);
- }
-
- /* Vertices/Edges/Faces */
-
- for(i=0; i<lvl->totvert; ++i) {
- if(em) {
- eves[i]= addvertlist(me->mr->verts[i].co, NULL);
- if(me->mr->verts[i].flag & 1) eves[i]->f |= SELECT;
- if(me->mr->verts[i].flag & ME_HIDE) eves[i]->h= 1;
- eves[i]->data= NULL;
- }
- else
- me->mvert[i]= me->mr->verts[i];
- }
- for(i=0; i<lvl->totedge; ++i) {
- if(em) {
- addedgelist(eves[lvl->edges[i].v[0]], eves[lvl->edges[i].v[1]], NULL);
- } else {
- me->medge[i].v1= lvl->edges[i].v[0];
- me->medge[i].v2= lvl->edges[i].v[1];
- me->medge[i].flag &= ~ME_HIDE;
- }
- }
- for(i=0; i<lvl->totface; ++i) {
- if(em) {
- EditVert *eve4= lvl->faces[i].v[3] ? eves[lvl->faces[i].v[3]] : NULL;
- EditFace *efa= addfacelist(eves[lvl->faces[i].v[0]], eves[lvl->faces[i].v[1]],
- eves[lvl->faces[i].v[2]], eve4, NULL, NULL);
- efa->flag= lvl->faces[i].flag & ~ME_HIDE;
- efa->mat_nr= lvl->faces[i].mat_nr;
- if(lvl->faces[i].flag & ME_FACE_SEL)
- efa->f |= SELECT;
- if(lvl->faces[i].flag & ME_HIDE) efa->h= 1;
- efa->data= NULL;
- }
- else {
- me->mface[i].v1= lvl->faces[i].v[0];
- me->mface[i].v2= lvl->faces[i].v[1];
- me->mface[i].v3= lvl->faces[i].v[2];
- me->mface[i].v4= lvl->faces[i].v[3];
- me->mface[i].flag= lvl->faces[i].flag;
- me->mface[i].flag &= ~ME_HIDE;
- me->mface[i].mat_nr= lvl->faces[i].mat_nr;
- }
- }
-
- /* Edge flags */
- if(em) eed= em->edges.first;
- if(lvl==me->mr->levels.first) {
- for(i=0; i<lvl->totedge; ++i) {
- if(em) {
- medge_flag_to_eed(me->mr->edge_flags[i], me->mr->edge_creases[i], eed);
- eed= eed->next;
- }
- else {
- me->medge[i].flag= me->mr->edge_flags[i];
- me->medge[i].crease= me->mr->edge_creases[i];
- }
- }
- } else {
- MultiresLevel *lvl1= me->mr->levels.first;
- const int last= lvl1->totedge * pow(2, me->mr->current-1);
- for(i=0; i<last; ++i) {
- const int ndx= i / pow(2, me->mr->current-1);
-
- if(em) {
- medge_flag_to_eed(me->mr->edge_flags[ndx], me->mr->edge_creases[ndx], eed);
- eed= eed->next;
- }
- else {
- me->medge[i].flag= me->mr->edge_flags[ndx];
- me->medge[i].crease= me->mr->edge_creases[ndx];
- }
- }
- }
-
- if(em) {
- eed= em->edges.first;
- for(i=0, eed= em->edges.first; i<lvl->totedge; ++i, eed= eed->next) {
- eed->h= me->mr->verts[lvl->edges[i].v[0]].flag & ME_HIDE ||
- me->mr->verts[lvl->edges[i].v[1]].flag & ME_HIDE;
- }
- }
-
- EM_select_flush();
-
- multires_customdata_to_mesh(me, em, lvl, &me->mr->vdata, em ? &em->vdata : &me->vdata, CD_MDEFORMVERT);
- multires_customdata_to_mesh(me, em, lvl, &me->mr->fdata, em ? &em->fdata : &me->fdata, CD_MTFACE);
-
- /* Colors */
- if(me->mr->use_col) {
- MCol c[4];
- EditFace *efa= NULL;
- CustomData *src= em ? &em->fdata : &me->fdata;
- if(em) {
- if(me->mr->use_col) EM_add_data_layer(src, CD_MCOL);
- efa= em->faces.first;
- }
- else {
- if(me->mr->use_col) me->mcol= CustomData_add_layer(src, CD_MCOL, CD_CALLOC, NULL, me->totface);
- }
-
- for(i=0; i<lvl->totface; ++i) {
- if(em) {
- if(me->mr->use_col) {
- multires_to_mcol(&lvl->colfaces[i], c);
- CustomData_em_set(src, efa->data, CD_MCOL, c);
- }
- efa= efa->next;
- }
- else if(me->mr->use_col) multires_to_mcol(&lvl->colfaces[i], &me->mcol[i*4]);
- }
-
- }
-
- mesh_update_customdata_pointers(me);
-
- if(em) {
- MEM_freeN(eves);
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- recalc_editnormals();
- } else {
- multires_edge_level_update(ob,me);
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL);
- }
-
- /* friendly check for background render */
- if(G.background==0) {
- object_handle_update(ob);
- countall();
-
- if(G.vd && G.vd->depths) G.vd->depths->damaged= 1;
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIMAGE, 0);
- }
-}
-
-void multires_update_colors(Mesh *me)
-{
- MultiresLevel *lvl= BLI_findlink(&me->mr->levels,me->mr->current-1);
- MultiresCol *pr_deltas= NULL, *cr_deltas= NULL;
- EditMesh *em= G.obedit ? G.editMesh : NULL;
- CustomData *src= em ? &em->fdata : &me->fdata;
- EditFace *efa= NULL;
- unsigned i,j,curf= 0;
-
- if(me->mr->use_col) {
- /* Calc initial deltas */
- cr_deltas= MEM_callocN(sizeof(MultiresCol)*lvl->totface*4,"initial color/uv deltas");
-
- if(em) efa= em->faces.first;
- for(i=0; i<lvl->totface; ++i) {
- MCol *col= em ? CustomData_em_get(src, efa->data, CD_MCOL) : &me->mcol[i*4];
- for(j=0; j<4; ++j) {
- if(me->mr->use_col) {
- cr_deltas[i*4+j].a= col[j].a - lvl->colfaces[i].col[j].a;
- cr_deltas[i*4+j].r= col[j].r - lvl->colfaces[i].col[j].r;
- cr_deltas[i*4+j].g= col[j].g - lvl->colfaces[i].col[j].g;
- cr_deltas[i*4+j].b= col[j].b - lvl->colfaces[i].col[j].b;
- }
- }
- if(em) efa= efa->next;
- }
-
- /* Update current level */
- if(em) efa= em->faces.first;
- for(i=0; i<lvl->totface; ++i) {
- MultiresColFace *f= &lvl->colfaces[i];
-
- if(me->mr->use_col)
- mcol_to_multires(f, em ? CustomData_em_get(src, efa->data, CD_MCOL) : &me->mcol[i*4]);
-
- if(em) efa= efa->next;
- }
-
- /* Update higher levels */
- lvl= lvl->next;
- while(lvl) {
- /* Set up new deltas, but keep the ones from the previous level */
- if(pr_deltas) MEM_freeN(pr_deltas);
- pr_deltas= cr_deltas;
- cr_deltas= MEM_callocN(sizeof(MultiresCol)*lvl->totface*4,"color deltas");
-
- curf= 0;
- for(i=0; i<lvl->prev->totface; ++i) {
- const char sides= lvl->prev->faces[i].v[3]?4:3;
- MultiresCol cntr;
-
- /* Find average color of 4 (or 3 for triangle) verts */
- multires_col_avg(&cntr,&pr_deltas[i*4],sides);
-
- for(j=0; j<sides; ++j) {
- multires_col_avg2(&cr_deltas[curf*4],
- &pr_deltas[i*4+j],
- &pr_deltas[i*4+(j==0?sides-1:j-1)]);
- cr_deltas[curf*4+1]= pr_deltas[i*4+j];
- multires_col_avg2(&cr_deltas[curf*4+2],
- &pr_deltas[i*4+j],
- &pr_deltas[i*4+(j==sides-1?0:j+1)]);
- cr_deltas[curf*4+3]= cntr;
- ++curf;
- }
- }
-
- for(i=0; i<lvl->totface; ++i) {
- for(j=0; j<4; ++j) {
- lvl->colfaces[i].col[j].a+= cr_deltas[i*4+j].a;
- lvl->colfaces[i].col[j].r+= cr_deltas[i*4+j].r;
- lvl->colfaces[i].col[j].g+= cr_deltas[i*4+j].g;
- lvl->colfaces[i].col[j].b+= cr_deltas[i*4+j].b;
- }
- }
-
- lvl= lvl->next;
- }
- if(pr_deltas) MEM_freeN(pr_deltas);
- if(cr_deltas) MEM_freeN(cr_deltas);
-
- /* Update lower levels */
- lvl= me->mr->levels.last;
- lvl= lvl->prev;
- while(lvl) {
- MultiresColFace *nf= lvl->next->colfaces;
- for(i=0; i<lvl->totface; ++i) {
- MultiresFace *f= &lvl->faces[i];
- for(j=0; j<(f->v[3]?4:3); ++j) {
- lvl->colfaces[i].col[j]= nf->col[1];
- ++nf;
- }
- }
- lvl= lvl->prev;
- }
- }
-}
-
-/* Update vertex locations and vertex flags */
-void multires_update_vertices(Mesh *me, EditMesh *em)
-{
- MultiresLevel *cr_lvl= current_level(me->mr), *pr_lvl= NULL,
- *last_lvl= me->mr->levels.last;
- vec3f *pr_deltas= NULL, *cr_deltas= NULL, *swap_deltas= NULL;
- EditVert *eve= NULL;
- MultiApplyData data;
- int i, j;
-
- /* Prepare deltas */
- pr_deltas= MEM_callocN(sizeof(vec3f)*last_lvl->totvert, "multires deltas 1");
- cr_deltas= MEM_callocN(sizeof(vec3f)*last_lvl->totvert, "multires deltas 2");
-
- /* Calculate initial deltas -- current mesh subtracted from current level*/
- if(em) eve= em->verts.first;
- for(i=0; i<cr_lvl->totvert; ++i) {
- if(em) {
- VecSubf(&cr_deltas[i].x, eve->co, me->mr->verts[i].co);
- eve= eve->next;
- } else
- VecSubf(&cr_deltas[i].x, me->mvert[i].co, me->mr->verts[i].co);
- }
-
-
- /* Copy current level's vertex flags and clear the rest */
- if(em) eve= em->verts.first;
- for(i=0; i < last_lvl->totvert; ++i) {
- if(i < cr_lvl->totvert) {
- MVert mvflag;
- multires_get_vert(&mvflag, eve, &me->mvert[i], i);
- if(em) eve= eve->next;
- me->mr->verts[i].flag= mvflag.flag;
- }
- else
- me->mr->verts[i].flag= 0;
- }
-
- /* If already on the highest level, copy current verts (including flags) into current level */
- if(cr_lvl == last_lvl) {
- if(em)
- eve= em->verts.first;
- for(i=0; i<cr_lvl->totvert; ++i) {
- multires_get_vert(&me->mr->verts[i], eve, &me->mvert[i], i);
- if(em) eve= eve->next;
- }
- }
-
- /* Update higher levels */
- pr_lvl= BLI_findlink(&me->mr->levels,me->mr->current-1);
- cr_lvl= pr_lvl->next;
- while(cr_lvl) {
- multires_calc_temp_data(pr_lvl);
-
- /* Swap the old/new deltas */
- swap_deltas= pr_deltas;
- pr_deltas= cr_deltas;
- cr_deltas= swap_deltas;
-
- /* Calculate and add new deltas
- ============================ */
- for(i=0; i<pr_lvl->totface; ++i) {
- const MultiresFace *f= &pr_lvl->faces[i];
- data.corner1= &pr_deltas[f->v[0]].x;
- data.corner2= &pr_deltas[f->v[1]].x;
- data.corner3= &pr_deltas[f->v[2]].x;
- data.corner4= &pr_deltas[f->v[3]].x;
- data.quad= f->v[3] ? 1 : 0;
- multi_apply(&cr_deltas[f->mid].x, &data, 3, catmullclark_smooth_face);
-
- for(j=0; j<(data.quad?4:3); ++j)
- me->mr->verts[f->mid].flag |= me->mr->verts[f->v[j]].flag;
- }
-
- for(i=0; i<pr_lvl->totedge; ++i) {
- const MultiresEdge *e= &pr_lvl->edges[i];
- data.boundary= pr_lvl->edge_boundary_states[i];
- edge_face_neighbor_midpoints_accum(&data,pr_lvl,cr_deltas,sizeof(vec3f),e);
- data.endpoint1= &pr_deltas[e->v[0]].x;
- data.endpoint2= &pr_deltas[e->v[1]].x;
- multi_apply(&cr_deltas[e->mid].x, &data, 3, catmullclark_smooth_edge);
-
- for(j=0; j<2; ++j)
- me->mr->verts[e->mid].flag |= me->mr->verts[e->v[j]].flag;
- }
-
- for(i=0; i<pr_lvl->totvert; ++i) {
- data.boundary= multires_vert_is_boundary(pr_lvl,i);
- data.original= &pr_deltas[i].x;
- data.edge_count= BLI_countlist(&pr_lvl->vert_edge_map[i]);
- if(data.boundary)
- boundary_edges_average(&data,pr_lvl,pr_deltas,sizeof(vec3f),i);
- else {
- vert_face_neighbor_midpoints_average(&data,pr_lvl,cr_deltas,sizeof(vec3f),i);
- vert_edge_neighbor_midpoints_average(&data,pr_lvl,pr_deltas,sizeof(vec3f),i);
- }
- multi_apply(&cr_deltas[i].x, &data, 3, catmullclark_smooth_vert);
- }
-
- /* Apply deltas to vertex locations */
- for(i=0; (cr_lvl == last_lvl) && (i < cr_lvl->totvert); ++i) {
- VecAddf(me->mr->verts[i].co,
- me->mr->verts[i].co,
- &cr_deltas[i].x);
- }
-
- multires_free_temp_data(pr_lvl);
-
- pr_lvl= pr_lvl->next;
- cr_lvl= cr_lvl->next;
- }
- if(pr_deltas) MEM_freeN(pr_deltas);
- if(cr_deltas) MEM_freeN(cr_deltas);
-
-}
-
-void multires_update_faces(Mesh *me, EditMesh *em)
-{
- MultiresLevel *cr_lvl= current_level(me->mr), *pr_lvl= NULL,
- *last_lvl= me->mr->levels.last;
- char *pr_flag_damaged= NULL, *cr_flag_damaged= NULL, *or_flag_damaged= NULL,
- *pr_mat_damaged= NULL, *cr_mat_damaged= NULL, *or_mat_damaged= NULL, *swap= NULL;
- EditFace *efa= NULL;
- unsigned i,j,curf;
-
- /* Find for each face whether flag/mat has changed */
- pr_flag_damaged= MEM_callocN(sizeof(char) * last_lvl->totface, "flag_damaged 1");
- cr_flag_damaged= MEM_callocN(sizeof(char) * last_lvl->totface, "flag_damaged 1");
- pr_mat_damaged= MEM_callocN(sizeof(char) * last_lvl->totface, "mat_damaged 1");
- cr_mat_damaged= MEM_callocN(sizeof(char) * last_lvl->totface, "mat_damaged 1");
- if(em) efa= em->faces.first;
- for(i=0; i<cr_lvl->totface; ++i) {
- MultiresFace mftmp;
- multires_get_face(&mftmp, efa, &me->mface[i]);
- if(cr_lvl->faces[i].flag != mftmp.flag)
- cr_flag_damaged[i]= 1;
- if(cr_lvl->faces[i].mat_nr != mftmp.mat_nr)
- cr_mat_damaged[i]= 1;
-
- /* Update current level */
- cr_lvl->faces[i].flag= mftmp.flag;
- cr_lvl->faces[i].mat_nr= mftmp.mat_nr;
-
- if(em) efa= efa->next;
- }
- or_flag_damaged= MEM_dupallocN(cr_flag_damaged);
- or_mat_damaged= MEM_dupallocN(cr_mat_damaged);
-
- /* Update lower levels */
- cr_lvl= cr_lvl->prev;
- while(cr_lvl) {
- swap= pr_flag_damaged;
- pr_flag_damaged= cr_flag_damaged;
- cr_flag_damaged= swap;
-
- swap= pr_mat_damaged;
- pr_mat_damaged= cr_mat_damaged;
- cr_mat_damaged= swap;
-
- curf= 0;
- for(i=0; i<cr_lvl->totface; ++i) {
- const int sides= cr_lvl->faces[i].v[3] ? 4 : 3;
-
- /* Check damages */
- for(j=0; j<sides; ++j, ++curf) {
- if(pr_flag_damaged[curf]) {
- cr_lvl->faces[i].flag= cr_lvl->next->faces[curf].flag;
- cr_flag_damaged[i]= 1;
- }
- if(pr_mat_damaged[curf]) {
- cr_lvl->faces[i].mat_nr= cr_lvl->next->faces[curf].mat_nr;
- cr_mat_damaged[i]= 1;
- }
- }
- }
-
- cr_lvl= cr_lvl->prev;
- }
-
- /* Clear to original damages */
- if(cr_flag_damaged) MEM_freeN(cr_flag_damaged);
- if(cr_mat_damaged) MEM_freeN(cr_mat_damaged);
- cr_flag_damaged= or_flag_damaged;
- cr_mat_damaged= or_mat_damaged;
-
- /* Update higher levels */
- pr_lvl= current_level(me->mr);
- cr_lvl= pr_lvl->next;
- while(cr_lvl) {
- swap= pr_flag_damaged;
- pr_flag_damaged= cr_flag_damaged;
- cr_flag_damaged= swap;
-
- swap= pr_mat_damaged;
- pr_mat_damaged= cr_mat_damaged;
- cr_mat_damaged= swap;
-
- /* Update faces */
- for(i=0, curf= 0; i<pr_lvl->totface; ++i) {
- const int sides= cr_lvl->prev->faces[i].v[3] ? 4 : 3;
- for(j=0; j<sides; ++j, ++curf) {
- if(pr_flag_damaged[i]) {
- cr_lvl->faces[curf].flag= pr_lvl->faces[i].flag;
- cr_flag_damaged[curf]= 1;
- }
- if(pr_mat_damaged[i]) {
- cr_lvl->faces[curf].mat_nr= pr_lvl->faces[i].mat_nr;
- cr_mat_damaged[curf]= 1;
- }
- }
- }
-
- pr_lvl= pr_lvl->next;
- cr_lvl= cr_lvl->next;
- }
-
- if(pr_flag_damaged) MEM_freeN(pr_flag_damaged);
- if(cr_flag_damaged) MEM_freeN(cr_flag_damaged);
- if(pr_mat_damaged) MEM_freeN(pr_mat_damaged);
- if(cr_mat_damaged) MEM_freeN(cr_mat_damaged);
-}
-
-void multires_update_levels(Mesh *me, const int render)
-{
- EditMesh *em= (!render && G.obedit) ? G.editMesh : NULL;
-
- multires_update_first_level(me, em);
- multires_update_vertices(me, em);
- multires_update_faces(me, em);
- multires_update_colors(me);
-}
-
-void multires_calc_temp_data(MultiresLevel *lvl)
-{
- unsigned i, j, emax;
- MultiresMapNode *indexnode= NULL;
-
- lvl->map_mem= MEM_mallocN(sizeof(MultiresMapNode)*(lvl->totedge*2 + lvl->totface*4), "map_mem");
- indexnode= lvl->map_mem;
-
- /* edge map */
- lvl->vert_edge_map= MEM_callocN(sizeof(ListBase)*lvl->totvert,"vert_edge_map");
- for(i=0; i<lvl->totedge; ++i) {
- for(j=0; j<2; ++j, ++indexnode) {
- indexnode->Index= i;
- BLI_addtail(&lvl->vert_edge_map[lvl->edges[i].v[j]], indexnode);
- }
- }
-
- /* face map */
- lvl->vert_face_map= MEM_callocN(sizeof(ListBase)*lvl->totvert,"vert_face_map");
- for(i=0; i<lvl->totface; ++i){
- for(j=0; j<(lvl->faces[i].v[3]?4:3); ++j, ++indexnode) {
- indexnode->Index= i;
- BLI_addtail(&lvl->vert_face_map[lvl->faces[i].v[j]], indexnode);
- }
- }
-
- /* edge boundaries */
- emax = (lvl->prev ? (lvl->prev->totedge * 2) : lvl->totedge);
- lvl->edge_boundary_states= MEM_callocN(sizeof(char)*lvl->totedge, "edge_boundary_states");
- for(i=0; i<emax; ++i) {
- MultiresMapNode *n1= lvl->vert_face_map[lvl->edges[i].v[0]].first;
- unsigned total= 0;
-
- lvl->edge_boundary_states[i] = 1;
- while(n1 && lvl->edge_boundary_states[i] == 1) {
- MultiresMapNode *n2= lvl->vert_face_map[lvl->edges[i].v[1]].first;
- while(n2) {
- if(n1->Index == n2->Index) {
- ++total;
-
- if(total > 1) {
- lvl->edge_boundary_states[i] = 0;
- break;
- }
- }
-
- n2= n2->next;
- }
- n1= n1->next;
- }
- }
-}
-
-void multires_edge_level_update(void *ob, void *me_v)
-{
- if(!G.obedit) {
- Mesh *me= me_v;
- MultiresLevel *cr_lvl= BLI_findlink(&me->mr->levels,me->mr->current-1);
- MultiresLevel *edge_lvl= BLI_findlink(&me->mr->levels,me->mr->edgelvl-1);
- const int threshold= edge_lvl->totedge * powf(2, me->mr->current - me->mr->edgelvl);
- unsigned i;
-
- for(i=0; i<cr_lvl->totedge; ++i) {
- const int ndx= me->pv ? me->pv->edge_map[i] : i;
- if(ndx != -1) { /* -1= hidden edge */
- if(me->mr->edgelvl >= me->mr->current || i<threshold)
- me->medge[ndx].flag |= ME_EDGEDRAW | ME_EDGERENDER;
- else
- me->medge[ndx].flag &= ~ME_EDGEDRAW & ~ME_EDGERENDER;
- }
- }
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- }
-}
-
-int multires_modifier_warning()
-{
- ModifierData *md;
-
- for(md= modifiers_getVirtualModifierList(OBACT); md; md= md->next) {
- if(md->mode & eModifierMode_Render) {
- switch(md->type) {
- case eModifierType_Subsurf:
- case eModifierType_Build:
- case eModifierType_Mirror:
- case eModifierType_Decimate:
- case eModifierType_Boolean:
- case eModifierType_Array:
- case eModifierType_EdgeSplit:
- return 1;
- }
- }
- }
-
- return 0;
-}
diff --git a/source/blender/src/mywindow.c b/source/blender/src/mywindow.c
deleted file mode 100644
index 56ef28d3a6e..00000000000
--- a/source/blender/src/mywindow.c
+++ /dev/null
@@ -1,744 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- *
- *
- * for compatibility with old iris code, replacement of swinopen, winset, etc
- * btw: subwindows in X are way too slow, tried it, and choose for my own system... (ton)
- *
- */
-
-#include <string.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_gsqueue.h"
-
-#include "DNA_screen_types.h"
-
-#include "BKE_global.h"
-
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-#include "BIF_mywindow.h"
-#include "BIF_screen.h"
-
-#include "mydevice.h"
-#include "blendef.h"
-
-#include "winlay.h"
-
-typedef struct {
- struct bWindow *next, *prev;
- int id, pad;
-
- int xmin, xmax, ymin, ymax;
- float viewmat[4][4], winmat[4][4];
-
- GSQueue *qevents;
-} bWindow;
-
-/* globals */
-static Window *winlay_mainwindow;
-static int curswin=0;
-static bWindow *swinarray[MAXWIN]= {NULL};
-static bWindow mainwindow, renderwindow;
-static int mainwin_color_depth;
-
-/* prototypes --------------- */
-void mywindow_init_mainwin(Window *, int , int , int , int );
-void mywindow_build_and_set_renderwin( int , int , int , int);
-
-void mywindow_init_mainwin(Window *win, int orx, int ory, int sizex, int sizey)
-{
- GLint r, g, b;
-
- winlay_mainwindow= win;
-
- swinarray[1]= &mainwindow;
- curswin= 1;
-
- mainwindow.xmin= orx;
- mainwindow.ymin= ory;
- mainwindow.xmax= orx+sizex-1;
- mainwindow.ymax= ory+sizey-1;
- mainwindow.qevents= NULL;
-
- myortho2(-0.375, (float)sizex-0.375, -0.375, (float)sizey-0.375);
- glLoadIdentity();
-
- glGetFloatv(GL_PROJECTION_MATRIX, (float *)mainwindow.winmat);
- glGetFloatv(GL_MODELVIEW_MATRIX, (float *)mainwindow.viewmat);
-
- glGetIntegerv(GL_RED_BITS, &r);
- glGetIntegerv(GL_GREEN_BITS, &g);
- glGetIntegerv(GL_BLUE_BITS, &b);
-
- mainwin_color_depth= r + g + b;
- if(G.f & G_DEBUG) {
- printf("Color depth r %d g %d b %d\n", (int)r, (int)g, (int)b);
- glGetIntegerv(GL_AUX_BUFFERS, &r);
- printf("Aux buffers: %d\n", (int)r);
- }
-}
-
-/* XXXXXXXXXXXXXXXX very hacky, because of blenderwindows vs ghostwindows vs renderwindow
- this routine sets up a blenderwin (a mywin)
- */
-void mywindow_build_and_set_renderwin( int orx, int ory, int sizex, int sizey)
-{
-
- swinarray[2]= &renderwindow;
- curswin= 2; /* myortho2 needs this to be set */
-
- renderwindow.xmin= orx;
- renderwindow.ymin= ory;
- renderwindow.xmax= orx+sizex-1;
- renderwindow.ymax= ory+sizey-1;
- renderwindow.qevents= NULL;
-
- myortho2(-0.375, (float)sizex-0.375, -0.375, (float)sizey-0.375);
- glLoadIdentity();
-
- glGetFloatv(GL_PROJECTION_MATRIX, (float *)renderwindow.winmat);
- glGetFloatv(GL_MODELVIEW_MATRIX, (float *)renderwindow.viewmat);
- mywinset(2);
-
-}
-
-/* ------------------------------------------------------------------------- */
-
- /* XXXXX, remove later */
-static bWindow *bwin_from_winid(int winid)
-{
- bWindow *bwin= swinarray[winid];
- if (!bwin) {
- printf("bwin_from_winid: Internal error, bad winid: %d\n", winid);
- }
- return bwin;
-}
-
-int bwin_qtest(int winid)
-{
- return !BLI_gsqueue_is_empty(bwin_from_winid(winid)->qevents);
-}
-int bwin_qread(int winid, BWinEvent *evt_r)
-{
- if (bwin_qtest(winid)) {
- BLI_gsqueue_pop(bwin_from_winid(winid)->qevents, evt_r);
- return 1;
- } else {
- return 0;
- }
-}
-void bwin_qadd(int winid, BWinEvent *evt)
-{
- BLI_gsqueue_push(bwin_from_winid(winid)->qevents, evt);
-}
-
-/* ------------------------------------------------------------------------- */
-
-void bwin_get_rect(int winid, rcti *rect_r)
-{
- bWindow *win= bwin_from_winid(winid);
- if(win) {
- rect_r->xmin= win->xmin;
- rect_r->ymin= win->ymin;
- rect_r->xmax= win->xmax;
- rect_r->ymax= win->ymax;
- }
-}
-
-void bwin_getsize(int win, int *x, int *y)
-{
- if(win<4) {
- if (win==1) {
- window_get_size(winlay_mainwindow, x, y);
- } else {
- printf("bwin_getsize: Internal error, bad winid: %d\n", win);
- *x= *y= 0;
- }
- } else {
- bWindow *bwin= swinarray[win];
- if (bwin) {
- *x= bwin->xmax-bwin->xmin+1;
- *y= bwin->ymax-bwin->ymin+1;
- }
- }
-}
-
-void bwin_getsuborigin(int win, int *x, int *y)
-{
- if(win<4) {
- *x= *y= 0;
- } else {
- bWindow *bwin= swinarray[win];
- if (bwin) {
- *x= bwin->xmin;
- *y= bwin->ymin;
- }
- }
-}
-
-void bwin_getsinglematrix(int winid, float mat[][4])
-{
- bWindow *win;
- float matview[4][4], matproj[4][4];
-
- win= swinarray[winid];
- if(win==NULL) {
- glGetFloatv(GL_PROJECTION_MATRIX, (float *)matproj);
- glGetFloatv(GL_MODELVIEW_MATRIX, (float *)matview);
- Mat4MulMat4(mat, matview, matproj);
- }
- else {
- Mat4MulMat4(mat, win->viewmat, win->winmat);
- }
-}
-
-/* ------------------------------------------------------------------------- */
-
-void bwin_load_viewmatrix(int winid, float mat[][4])
-{
- bWindow *win= bwin_from_winid(winid);
- if(win) {
- glLoadMatrixf(mat);
- Mat4CpyMat4(win->viewmat, mat);
- }
-}
-void bwin_load_winmatrix(int winid, float mat[][4])
-{
- bWindow *win= bwin_from_winid(winid);
- if(win) {
- glLoadMatrixf(mat);
- Mat4CpyMat4(win->winmat, mat);
- }
-}
-
-void bwin_get_viewmatrix(int winid, float mat[][4])
-{
- bWindow *win= bwin_from_winid(winid);
- if(win)
- Mat4CpyMat4(mat, win->viewmat);
-}
-void bwin_get_winmatrix(int winid, float mat[][4])
-{
- bWindow *win= bwin_from_winid(winid);
- if(win)
- Mat4CpyMat4(mat, win->winmat);
-}
-
-void bwin_multmatrix(int winid, float mat[][4])
-{
- bWindow *win= bwin_from_winid(winid);
-
- if(win) {
- glMultMatrixf((float*) mat);
- glGetFloatv(GL_MODELVIEW_MATRIX, (float *)win->viewmat);
- }
-}
-
-void bwin_scalematrix(int winid, float x, float y, float z)
-{
- bWindow *win= bwin_from_winid(winid);
- if(win) {
- glScalef(x, y, z);
- glGetFloatv(GL_MODELVIEW_MATRIX, (float *)win->viewmat);
- }
-}
-
-void bwin_clear_viewmat(int swin)
-{
- bWindow *win;
-
- win= swinarray[swin];
- if(win==NULL) return;
-
- memset(win->viewmat, 0, sizeof(win->viewmat));
- win->viewmat[0][0]= 1.0;
- win->viewmat[1][1]= 1.0;
- win->viewmat[2][2]= 1.0;
- win->viewmat[3][3]= 1.0;
-}
-
-
-void myloadmatrix(float mat[][4])
-{
- if (glaGetOneInteger(GL_MATRIX_MODE)==GL_MODELVIEW) {
- bwin_load_viewmatrix(curswin, mat);
- } else {
- bwin_load_winmatrix(curswin, mat);
- }
-}
-
-void mygetmatrix(float mat[][4])
-{
- if (glaGetOneInteger(GL_MATRIX_MODE)==GL_MODELVIEW) {
- bwin_get_viewmatrix(curswin, mat);
- } else {
- bwin_get_winmatrix(curswin, mat);
- }
-}
-
-void mymultmatrix(float mat[][4])
-{
- bwin_multmatrix(curswin, mat);
-}
-
-void mygetsingmatrix(float mat[][4])
-{
- bwin_getsinglematrix(curswin, mat);
-}
-
-int mywinget(void)
-{
- return curswin;
-}
-
-void mywinset(int wid)
-{
- bWindow *win;
-
- win= swinarray[wid];
- if(win==NULL) {
- printf("mywinset %d: doesn't exist\n", wid);
- return;
- }
- if (wid == 1 || wid == 2) { /* main window or renderwindow*/
- glViewport(0, 0, ( win->xmax-win->xmin)+1, ( win->ymax-win->ymin)+1);
- glScissor(0, 0, ( win->xmax-win->xmin)+1, ( win->ymax-win->ymin)+1);
- }
- else {
- int width= (win->xmax - win->xmin)+1;
- int height= (win->ymax - win->ymin)+1;
-
- /* CRITICAL, this clamping ensures that
- * the viewport never goes outside the screen
- * edges (assuming the x, y coords aren't
- * outside). This causes a hardware lock
- * on Matrox cards if it happens.
- *
- * Really Blender should never _ever_ try
- * to do such a thing, but just to be safe
- * clamp it anyway (or fix the bScreen
- * scaling routine, and be damn sure you
- * fixed it). - zr
- */
- if (win->xmin + width>G.curscreen->sizex)
- width= G.curscreen->sizex - win->xmin;
- if (win->ymin + height>G.curscreen->sizey)
- height= G.curscreen->sizey - win->ymin;
-
- glViewport(win->xmin, win->ymin, width, height);
- glScissor(win->xmin, win->ymin, width, height);
- }
-
- glMatrixMode(GL_PROJECTION);
- glLoadMatrixf(&win->winmat[0][0]);
- glMatrixMode(GL_MODELVIEW);
- glLoadMatrixf(&win->viewmat[0][0]);
-
- glFlush();
-
- curswin= wid;
-}
-
-int myswinopen(int parentid, int xmin, int xmax, int ymin, int ymax)
-{
- bWindow *win= NULL;
- int freewinid;
-
- for (freewinid= 4; freewinid<MAXWIN; freewinid++)
- if (!swinarray[freewinid])
- break;
-
- /* this case is not handled in Blender, so will crash. use myswinopen_allowed() first to check */
- if (freewinid==MAXWIN) {
- printf("too many windows\n");
-
- return 0;
- }
- else {
- win= MEM_callocN(sizeof(*win), "winopen");
-
- win->id= freewinid;
- swinarray[win->id]= win;
-
- win->xmin= xmin;
- win->ymin= ymin;
- win->xmax= xmax;
- win->ymax= ymax;
-
- win->qevents= BLI_gsqueue_new(sizeof(BWinEvent));
-
- Mat4One(win->viewmat);
- Mat4One(win->winmat);
-
- mywinset(win->id);
-
- return win->id;
- }
-}
-
-int myswinopen_allowed(void)
-{
- int totfree=0;
- int freewinid;
-
- for (freewinid= 4; freewinid<MAXWIN; freewinid++)
- if (swinarray[freewinid]==NULL)
- totfree++;
- if(totfree<2)
- return 0;
- return 1;
-}
-
-void mywinclose(int winid)
-{
- if (winid<4) {
- if (winid==1) {
- window_destroy(winlay_mainwindow);
- winlay_mainwindow= NULL;
- } else {
- printf("mwinclose: Internal error, bad winid: %d\n", winid);
- }
- } else {
- bWindow *win= swinarray[winid];
-
- if (win) {
- BLI_gsqueue_free(win->qevents);
- MEM_freeN(win);
- } else {
- printf("mwinclose: Internal error, bad winid: %d\n", winid);
- }
- }
-
- swinarray[winid]= NULL;
- if (curswin==winid) curswin= 0;
-}
-
-void mywinposition(int winid, int xmin, int xmax, int ymin, int ymax) /* watch: syntax differs from iris */
-{
- bWindow *win= bwin_from_winid(winid);
- if(win) {
- win->xmin= xmin;
- win->ymin= ymin;
- win->xmax= xmax;
- win->ymax= ymax;
- }
-}
-
-
-void bwin_ortho(int winid, float x1, float x2, float y1, float y2, float n, float f)
-{
- bWindow *bwin= bwin_from_winid(winid);
- if(bwin) {
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
-
- glOrtho(x1, x2, y1, y2, n, f);
-
- glGetFloatv(GL_PROJECTION_MATRIX, (float *)bwin->winmat);
- glMatrixMode(GL_MODELVIEW);
- }
-}
-
-void bwin_ortho2(int win, float x1, float x2, float y1, float y2)
-{
- bwin_ortho(win, x1, x2, y1, y2, -1, 1);
-}
-
-void bwin_frustum(int winid, float x1, float x2, float y1, float y2, float n, float f)
-{
- bWindow *win= bwin_from_winid(winid);
- if(win) {
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum(x1, x2, y1, y2, n, f);
-
- glGetFloatv(GL_PROJECTION_MATRIX, (float *)win->winmat);
- glMatrixMode(GL_MODELVIEW);
- }
-}
-
-void myortho(float x1, float x2, float y1, float y2, float n, float f)
-{
- bwin_ortho(curswin, x1, x2, y1, y2, n, f);
-}
-
-void myortho2(float x1, float x2, float y1, float y2)
-{
- /* prevent opengl from generating errors */
- if(x1==x2) x2+=1.0;
- if(y1==y2) y2+=1.0;
- bwin_ortho(curswin, x1, x2, y1, y2, -100, 100);
-}
-
-void mywindow(float x1, float x2, float y1, float y2, float n, float f)
-{
- bwin_frustum(curswin, x1, x2, y1, y2, n, f);
-}
-
-#ifdef __APPLE__
-
-/* apple seems to round colors to below and up on some configs */
-
-static unsigned int index_to_framebuffer(int index)
-{
- unsigned int i= index;
-
- switch(mainwin_color_depth) {
- case 12:
- i= ((i & 0xF00)<<12) + ((i & 0xF0)<<8) + ((i & 0xF)<<4);
- /* sometimes dithering subtracts! */
- i |= 0x070707;
- break;
- case 15:
- case 16:
- i= ((i & 0x7C00)<<9) + ((i & 0x3E0)<<6) + ((i & 0x1F)<<3);
- i |= 0x030303;
- break;
- case 24:
- break;
- default: // 18 bits...
- i= ((i & 0x3F000)<<6) + ((i & 0xFC0)<<4) + ((i & 0x3F)<<2);
- i |= 0x010101;
- break;
- }
-
- return i;
-}
-
-#else
-
-/* this is the old method as being in use for ages.... seems to work? colors are rounded to lower values */
-
-static unsigned int index_to_framebuffer(int index)
-{
- unsigned int i= index;
-
- switch(mainwin_color_depth) {
- case 8:
- i= ((i & 48)<<18) + ((i & 12)<<12) + ((i & 3)<<6);
- i |= 0x3F3F3F;
- break;
- case 12:
- i= ((i & 0xF00)<<12) + ((i & 0xF0)<<8) + ((i & 0xF)<<4);
- /* sometimes dithering subtracts! */
- i |= 0x0F0F0F;
- break;
- case 15:
- case 16:
- i= ((i & 0x7C00)<<9) + ((i & 0x3E0)<<6) + ((i & 0x1F)<<3);
- i |= 0x070707;
- break;
- case 24:
- break;
- default: // 18 bits...
- i= ((i & 0x3F000)<<6) + ((i & 0xFC0)<<4) + ((i & 0x3F)<<2);
- i |= 0x030303;
- break;
- }
-
- return i;
-}
-
-#endif
-
-void set_framebuffer_index_color(int index)
-{
- cpack(index_to_framebuffer(index));
-}
-
-int framebuffer_to_index(unsigned int col)
-{
- if (col==0) return 0;
-
- switch(mainwin_color_depth) {
- case 8:
- return ((col & 0xC00000)>>18) + ((col & 0xC000)>>12) + ((col & 0xC0)>>6);
- case 12:
- return ((col & 0xF00000)>>12) + ((col & 0xF000)>>8) + ((col & 0xF0)>>4);
- case 15:
- case 16:
- return ((col & 0xF80000)>>9) + ((col & 0xF800)>>6) + ((col & 0xF8)>>3);
- case 24:
- return col & 0xFFFFFF;
- default: // 18 bits...
- return ((col & 0xFC0000)>>6) + ((col & 0xFC00)>>4) + ((col & 0xFC)>>2);
- }
-}
-
-
-/* ********** END MY WINDOW ************** */
-
-#ifdef WIN32
-static int is_a_really_crappy_nvidia_card(void) {
- static int well_is_it= -1;
-
- /* Do you understand the implication? Do you? */
- if (well_is_it==-1)
- well_is_it= (strcmp((char*) glGetString(GL_VENDOR), "NVIDIA Corporation") == 0);
-
- return well_is_it;
-}
-#endif
-
-void myswapbuffers(void)
-{
- ScrArea *sa;
-
- sa= G.curscreen->areabase.first;
- while(sa) {
- if(sa->win_swap==WIN_BACK_OK) sa->win_swap= WIN_FRONT_OK;
- if(sa->head_swap==WIN_BACK_OK) sa->head_swap= WIN_FRONT_OK;
-
- sa= sa->next;
- }
-
- /* HACK, some windows drivers feel they should honor the scissor
- * test when swapping buffers, disable the test while swapping
- * on WIN32. (namely Matrox and NVidia's new drivers around Oct 1 2001)
- * - zr
- */
-
-#ifdef WIN32
- /* HACK, in some NVidia driver release some kind of
- * fancy optimiziation (I presume) was put in which for
- * some reason causes parts of the buffer not to be
- * swapped. One way to defeat it is the following wierd
- * code (which we only do for nvidia cards). This should
- * be removed if NVidia fixes their drivers. - zr
- */
- if (is_a_really_crappy_nvidia_card()) {
- glDrawBuffer(GL_FRONT);
-
- glBegin(GL_LINES);
- glEnd();
-
- glDrawBuffer(GL_BACK);
- }
-
- glDisable(GL_SCISSOR_TEST);
- window_swap_buffers(winlay_mainwindow);
- glEnable(GL_SCISSOR_TEST);
-#else
- window_swap_buffers(winlay_mainwindow);
-#endif
-}
-
-
-/* *********************** PATTERNS ETC ***************** */
-
-void setlinestyle(int nr)
-{
- if(nr==0) {
- glDisable(GL_LINE_STIPPLE);
- }
- else {
-
- glEnable(GL_LINE_STIPPLE);
- glLineStipple(nr, 0xAAAA);
- }
-}
-
-/*******************/
-/*******************/
-/* Menu utilities */
-
-static int *frontbuffer_save= NULL;
-static int ov_x, ov_y, ov_sx, ov_sy;
-
-/*
-#if defined(__sgi) || defined(__sun) || defined(__sun__) || defined (__sparc) || defined (__sparc__)
-*/
-/* this is a dirty patch: gets sometimes the backbuffer */
-/* my_get_frontbuffer_image(0, 0, 1, 1);
-my_put_frontbuffer_image();
-#endif
-*/
-
-void my_put_frontbuffer_image(void)
-{
- if (frontbuffer_save) {
- glRasterPos2f( (float)ov_x -0.5, (float)ov_y - 0.5 );
- glDrawPixels(ov_sx, ov_sy, GL_RGBA, GL_UNSIGNED_BYTE, frontbuffer_save);
- MEM_freeN(frontbuffer_save);
- frontbuffer_save= NULL;
- }
-}
-
-void my_get_frontbuffer_image(int x, int y, int sx, int sy)
-{
- if(frontbuffer_save) return;
-
- ov_x= x;
- ov_y= y;
- ov_sx= sx;
- ov_sy= sy;
-
- if(sx>1 && sy>1) {
- frontbuffer_save= MEM_mallocN(sx*sy*4, "temp_frontbuffer_image");
- glReadPixels(x, y, sx, sy, GL_RGBA, GL_UNSIGNED_BYTE, frontbuffer_save);
- }
-
- #ifdef WIN32
- /* different coord system! */
- y= (G.curscreen->sizey-y);
-
- if(curswin>3) {
- y -= curarea->winrct.ymin;
- }
- #endif
-}
-
-int mywin_inmenu(void) {
- return frontbuffer_save?1:0;
-}
-
-void mywin_getmenu_rect(int *x, int *y, int *sx, int *sy) {
- *x= ov_x;
- *sx= ov_sx;
- *sy= ov_sy;
-
-#if defined(WIN32) || defined (__BeOS)
- *y= ov_y;
-#else
- *y= (G.curscreen->sizey - ov_y) - ov_sy;
-#endif
-}
diff --git a/source/blender/src/oops.c b/source/blender/src/oops.c
deleted file mode 100644
index 7def4ca615e..00000000000
--- a/source/blender/src/oops.c
+++ /dev/null
@@ -1,1104 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <math.h>
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "DNA_curve_types.h"
-#include "DNA_image_types.h"
-#include "DNA_ipo_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_material_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meta_types.h"
-#include "DNA_object_types.h"
-#include "DNA_oops_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_space_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_key_types.h"
-#include "DNA_group_types.h"
-
-#include "BKE_utildefines.h"
-#include "BKE_global.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
-
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-#include "BIF_oops.h"
-#include "BIF_drawoops.h"
-#include "BIF_outliner.h"
-
-#include "blendef.h"
-#include "mydevice.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-static int correct_oops_y(Oops *oops);
-
-
-Oops *add_oops(void *id)
-{
- Oops *oops;
-
- if(G.soops==0) return NULL;
- oops= MEM_callocN(sizeof(Oops), "oops");
-
- BLI_addtail(&G.soops->oops, oops);
-
- oops->id= id;
- oops->type= GS(oops->id->name);
-
- return oops;
-}
-
-
-Oops *find_oops(ID *id)
-{
- Oops *oops;
-
- /* searching for an oops with this ID */
- oops= G.soops->oops.first;
- while(oops) {
- if(oops->id == id) {
- /* this error once happened. securing it doesnt harm */
- if(oops->type != GS(id->name)) oops->id= 0;
- else break;
- }
- oops= oops->next;
- }
- return oops;
-}
-
-/* never even called! (ton) */
-int test_oops(Oops *oops)
-{
- /* test if own ID block still exists */
- ListBase *lb;
- ID *id;
-
- if(G.soops==0) return 0;
-
- lb= wich_libbase(G.main, oops->type);
- id= lb->first;
- while(id) {
- if(id==oops->id) break;
- id= id->next;
- }
-
- if(id==0) return 0;
-
-
- return 1;
-}
-
-void test_oopslinko(OopsLink *ol)
-{
- /* test if links exist */
- Oops *oops;
- ListBase *lb;
- ID *id, *from;
-
- if(G.soops==0) return;
-
- ol->to= 0;
- from= *ol->idfrom;
-
- if(from==0) return;
-
- lb= wich_libbase(G.main, ol->type);
- id= lb->first;
- while(id) {
- if(id==from) break;
- id= id->next;
- }
-
- if(id==0) {
- /* ID does not exist anymore */
- *ol->idfrom= 0;
- }
- else {
- /* search for oops with this ID */
- oops= G.soops->oops.first;
- while(oops) {
- if(oops->id == id) break;
- oops= oops->next;
- }
-
- ol->to= oops;
- }
-}
-
-void test_oopslink(OopsLink *ol)
-{
- /* test if links exist */
- Oops *oops;
- ID *from;
-
- if(G.soops==0) return;
-
- ol->to= 0;
- from= *ol->idfrom;
-
- if(from==0) return;
-
- /* search for oops with this ID */
- oops= G.soops->oops.first;
- while(oops) {
- if(oops->id == from) break;
- oops= oops->next;
- }
-
- ol->to= oops;
- if(oops) oops->flag |= OOPS_REFER;
-}
-
-
-OopsLink *add_oopslink(char *name, Oops *oops, short type, void *from, float xof, float yof)
-{
- OopsLink *ol;
-
- if(G.soops==0) return NULL;
-
- /* testing if it exsists: */
- /* ol= oops->link.first; */
- /* while(ol) { */
- /* if(ol->idfrom == from) { */
- /* strncpy(ol->name, name, 11); */
- /* ol->type= type; */
- /* ol->xof= xof; */
- /* ol->yof= yof; */
- /* return ol; */
- /* } */
- /* ol= ol->next; */
- /* } */
-
- if(* ((int *)from) == 0) return NULL;
-
- /* make new */
- ol= MEM_callocN(sizeof(OopsLink), "oopslink");
-
- BLI_addtail(&oops->link, ol);
-
- ol->type= type;
- ol->idfrom= from;
- ol->xof= xof;
- ol->yof= yof;
- BLI_strncpy(ol->name, name, sizeof(ol->name));
-
- return ol;
-}
-
-int oops_test_overlap(Oops *test)
-{
- Oops *oops;
- rctf rt, ro;
-
- rt.xmin= test->x;
- rt.xmax= (float)(test->x+OOPSX);
- rt.ymin= test->y;
- rt.ymax= (float)(test->y+OOPSY);
-
- oops= G.soops->oops.first;
- while(oops) {
- if(oops!=test) { /* do net test for hide: is only a temporal flag */
-
- ro.xmin= oops->x;
- ro.xmax= (float)(oops->x+OOPSX);
- ro.ymin= oops->y;
- ro.ymax= (float)(oops->y+OOPSY);
-
- if( BLI_isect_rctf(&rt, &ro, 0) ) return 1;
-
- }
- oops= oops->next;
- }
-
- return 0;
-}
-
-int oops_test_overlaphide(Oops *test)
-{
- Oops *oops;
- rctf rt, ro;
-
- rt.xmin= (float)(test->x);
- rt.xmax= (float)(test->x+OOPSX);
- rt.ymin= (float)(test->y);
- rt.ymax= (float)(test->y+OOPSY);
-
- oops= G.soops->oops.first;
- while(oops) {
- if(oops->hide==0 && oops!=test) { /* do test for hide, but not use it during build_oops */
-
- ro.xmin= oops->x;
- ro.xmax= (float)(oops->x+OOPSX);
- ro.ymin= oops->y;
- ro.ymax= (float)(oops->y+OOPSY);
-
- if( BLI_isect_rctf(&rt, &ro, 0) ) return 1;
-
- }
- oops= oops->next;
- }
-
- return 0;
-}
-
-float oopslink_totlen(Oops *oops)
-{
- OopsLink *ol;
- float vec[4], dx, dy, len= 0.0;
-
-
- ol= oops->link.first;
- while(ol) {
- if(ol->to) {
- give_oopslink_line(oops, ol, vec, vec+2);
-
- dx= vec[0]-vec[2];
- dy= vec[1]-vec[3];
-
- len+= (float)sqrt( dx*dx + dy*dy );
- }
- ol= ol->next;
- }
- return len;
-}
-
-
-void add_from_link(Oops *from, Oops *oops)
-{
- OopsLink *ol;
-
- ol= MEM_callocN(sizeof(OopsLink), "oopslinktemp");
- BLI_addtail(&oops->link, ol);
- ol->from= from;
-
-}
-
-void shuffle_oops()
-{
- Oops *o2, *oops;
- OopsLink *ol, *oln;
- float olen, len1, f1, f2;
- int go= 1, tot=0, dir=1, type1, type2;
-
-
- /* we take two oopses, calc the 'beauty' and the exchanged beauty */
-
- if(G.soops==0) return;
-
- waitcursor(1);
-
- /* to make it 100% OK and fast: temporal insert
- * to the ooplinklist - per oops - the 'from' links.
- * Don't forget to free!
- */
-
- oops= G.soops->oops.first;
- while(oops) {
- if(oops->hide==0) {
- ol= oops->link.first;
- while(ol) {
- if(ol->to && ol->to->hide==0) {
- if(ol->to->flag & SELECT) {
- add_from_link(oops, ol->to);
- }
- }
- ol= ol->next;
- }
- }
- oops= oops->next;
- }
-
- while(go) {
-
- go= 0;
- dir= 1-dir;
- tot++;
-
- if(dir) oops= G.soops->oops.last;
- else oops= G.soops->oops.first;
- while(oops) {
-
- if(oops->link.first && oops->hide==0 && (oops->flag & SELECT)) {
- /* find a good exchangable pair */
- olen= oopslink_totlen(oops);
-
- if(dir) o2= oops->prev;
- else o2= oops->next;
-
- if ELEM3(oops->type, ID_OB, ID_LI, ID_SCE) type1= 1; else type1= 0;
-
-
- while(o2) {
- if(o2->hide==0 && (o2->flag & SELECT)) {
-
- if ELEM3(o2->type, ID_OB, ID_LI, ID_SCE) type2= 1; else type2= 0;
-
- if(type1==type2) {
-
- len1= oopslink_totlen(o2);
-
- SWAP(float, oops->x, o2->x);
- SWAP(float, oops->y, o2->y);
-
- f1= oopslink_totlen(oops);
- f2= oopslink_totlen(o2);
-
- if( f1<=olen && f2<len1) { /* 1 x <= !!! */
- olen= oopslink_totlen(oops);
- go= 1;
- }
- else {
- SWAP(float, oops->x, o2->x);
- SWAP(float, oops->y, o2->y);
- }
- }
- }
- if(dir) o2= o2->prev;
- else o2= o2->next;
- }
- }
- if(dir) oops= oops->prev;
- else oops= oops->next;
-
-
- }
- if(tot>5) break;
- }
- waitcursor(0);
-
- /* free the from links */
- oops= G.soops->oops.first;
- while(oops) {
- if(oops->hide==0) {
- ol= oops->link.first;
- while(ol) {
- oln= ol->next;
- if(ol->from) {
- BLI_remlink(&oops->link, ol);
- MEM_freeN(ol);
- }
- ol= oln;
- }
- }
- oops= oops->next;
- }
-
- allqueue(REDRAWOOPS, 1);
-}
-
-void shrink_oops()
-{
- Oops *oops;
- OopsLink *ol;
- float vec[4];
- int /* go= 1, */tot=4;
-
-
- if(G.soops==0) return;
-
- if(okee("Shrink oops")==0) return;
-
- waitcursor(1);
-
- /* clear */
- oops= G.soops->oops.first;
- while(oops) {
- oops->dx= oops->dy= 0.0;
- oops= oops->next;
- }
-
- while(tot) {
- tot--;
-
- /* shrink */
- oops= G.soops->oops.first;
- while(oops) {
- if(oops->link.first && oops->hide==0 && (oops->flag & SELECT)) {
-
- ol= oops->link.first;
- while(ol) {
- if(ol->to && ol->to->hide==0) {
-
- give_oopslink_line(oops, ol, vec, vec+2);
-
- oops->dx= (float)(.8*oops->dx + .2*( vec[2]-vec[0]));
- oops->dy= (float)(.8*oops->dy + .2*( vec[3]-vec[1]));
-
- if(ol->to->flag & SELECT) {
- ol->to->dx= (float)(.8*ol->to->dx + .2*( vec[0]-vec[2]));
- ol->to->dy= (float)(.8*ol->to->dy + .2*( vec[1]-vec[3]));
- }
- }
-
- ol= ol->next;
- }
- }
- oops= oops->next;
- }
-
- /* apply */
- oops= G.soops->oops.first;
- while(oops) {
- if(oops->hide==0 && (oops->flag & SELECT)) {
-
- /* shrink */
- oops->x+= oops->dx;
- oops->y+= oops->dy;
-
- if(oops_test_overlaphide(oops)) {
- oops->x-= oops->dx;
- oops->y-= oops->dy;
- }
-
- oops->dx= oops->dy= 0.0;
- }
- oops= oops->next;
- }
- }
- waitcursor(0);
-
- allqueue(REDRAWOOPS, 1);
-}
-
-#define LIMSCE -20.0
-#define LIMOB 14.0
-#define LIMDATA 24.0
-
-static int correct_oops_y(Oops *oops)
-{
- float y;
-
- y= oops->y;
-
- switch(oops->type) {
- case ID_SCE:
- case ID_LI:
- if(oops->y > LIMSCE-OOPSY) oops->y= (float)(LIMSCE-OOPSY);
- break;
- case ID_OB:
- CLAMP(oops->y, LIMSCE, LIMOB);
- break;
- case ID_IP:
- case ID_MA:
- case ID_TE:
- if(oops->y < LIMDATA+OOPSY) oops->y= (float)(LIMDATA+OOPSY);
- break;
- default:
- CLAMP(oops->y, (float)(LIMOB+OOPSY), LIMDATA);
- break;
- }
-
- if(y==oops->y) return 0;
- else return 1;
-}
-
-float oopslastx=0.0, oopslasty= 0.0;
-
-void new_oops_location(Oops *new)
-{
- float dirvec[4][2];
- static int cnt=0;
- int a, b, rc= 1, tel=1, ok=0;
-
- if(G.soops==0) return;
-
- if(G.soops->oops.first==G.soops->oops.last) {
- oopslastx= oopslasty= 0.0;
- }
-
- cnt++;
-
- new->x= oopslastx;
- new->y= oopslasty;
-
- correct_oops_y(new);
-
- /* find from center free location */
- dirvec[cnt & 3][0]= 1.2*OOPSX;
- dirvec[cnt & 3][1]= 0;
- cnt++;
- dirvec[cnt & 3][0]= 0;
- dirvec[cnt & 3][1]= (float)(-1.2*OOPSY);
- cnt++;
- dirvec[cnt & 3][0]= -1.2*OOPSX;
- dirvec[cnt & 3][1]= 0;
- cnt++;
- dirvec[cnt & 3][0]= 0;
- dirvec[cnt & 3][1]= (float)(1.2*OOPSY);
- cnt++;
-
-
- new->x+= dirvec[ (rc-2) & 3][0];
- new->y+= dirvec[ (rc-2) & 3][1];
- rc+= correct_oops_y(new);
-
- if( oops_test_overlap(new)==0 ) {
- ok= 1;
- }
-
- rc++;
-
- if(ok==0) {
- new->x+= dirvec[ (rc-1) & 3][0];
- new->y+= dirvec[ (rc-1) & 3][1];
- rc+= correct_oops_y(new);
-
- if(oops_test_overlap(new)==0 ) {
- ok= 1;
- }
- rc++;
- }
-
-
- while(ok==0) {
-
- for(a=0;a<2;a++) {
- for(b=0;b<tel;b++) {
-
- if( oops_test_overlap(new)==0 ) {
- ok= 1;
- break;
- }
-
- rc &= 3;
- new->x += dirvec[rc][0];
- new->y += dirvec[rc][1];
- rc+= correct_oops_y(new);
- }
- rc++;
-
-
-
- if(ok) break;
- }
- if(ok || tel>100) break;
- tel++;
- }
- oopslastx= new->x;
- oopslasty= new->y;
-
-}
-
-
-void free_oops(Oops *oops) /* also oops itself */
-{
- BLI_freelistN(&oops->link);
- MEM_freeN(oops);
-}
-
-void free_oopspace(SpaceOops *so)
-{
- Oops *oops;
-
- while( (oops= so->oops.first) ) {
- BLI_remlink(&so->oops, oops);
- free_oops(oops);
- }
-
- outliner_free_tree(&so->tree);
- if(so->treestore) {
- if(so->treestore->data) MEM_freeN(so->treestore->data);
- MEM_freeN(so->treestore);
- }
-}
-
-void add_material_oopslinks(Material *ma, Oops *oops, short flag)
-{
- int a;
-
- if(flag & OOPS_TE) {
- for(a=0; a<MAX_MTEX; a++) {
- if(ma->mtex[a]) add_oopslink("tex", oops, ID_TE, &(ma->mtex[a]->tex), (float)(0.5*OOPSX), (float)OOPSY);
- }
- }
- if(flag & OOPS_OB) {
- for(a=0; a<MAX_MTEX; a++) {
- if(ma->mtex[a]) add_oopslink("ob", oops, ID_OB, &(ma->mtex[a]->object), 0.0, (float)(0.2*OOPSY));
- }
- }
- if(flag & OOPS_IP)
- if(ma->ipo) add_oopslink("ipo", oops, ID_IP, &(ma->ipo), OOPSX, (float)(0.5*OOPSY));
-
- if (ma->group)
- add_oopslink("group", oops, ID_GR, &(ma->group), OOPSX, (float)(0.5*OOPSY));
-}
-
-
-void add_group_oopslinks(Group *gp, Oops *oops, short flag)
-{
- GroupObject *gob;
- if(flag & OOPS_GR) {
- for(gob=gp->gobject.first; gob; gob= gob->next) {
- add_oopslink("group", oops, ID_GR, &(gob->ob), (float)(0.5*OOPSX), (float)OOPSY);
- }
- }
-}
-
-
-void add_object_oopslinks(Object *ob, Oops *oops, short flag)
-{
- ID *id;
-
- if(ob->parent) add_oopslink("parent", oops, ID_OB, &ob->parent, (float)(.6*OOPSX), (float)OOPSY);
- if(ob->track) add_oopslink("parent", oops, ID_OB, &ob->track, (float)(.4*OOPSX), (float)OOPSY);
-
- id= ob->data;
- if(id) {
- switch( GS(id->name) ) {
- case ID_ME:
- if(flag & OOPS_ME) add_oopslink("data", oops, ID_ME, &ob->data, (float)(.5*OOPSX), (float)OOPSY);
- break;
- case ID_CU:
- if(flag & OOPS_CU) add_oopslink("data", oops, ID_CU, &ob->data, (float)(.5*OOPSX), (float)OOPSY);
- break;
- case ID_MB:
- if(flag & OOPS_MB) add_oopslink("data", oops, ID_MB, &ob->data, (float)(.5*OOPSX), (float)OOPSY);
- break;
- case ID_LT:
- if(flag & OOPS_LT) add_oopslink("data", oops, ID_LT, &ob->data, (float)(.5*OOPSX), (float)OOPSY);
- break;
- case ID_LA:
- if(flag & OOPS_LA) add_oopslink("data", oops, ID_LA, &ob->data, (float)(.5*OOPSX), (float)OOPSY);
- break;
- }
- }
-
- if(flag & OOPS_MA) {
- short a;
-
- for(a=0; a<ob->totcol; a++) {
- if(ob->mat[a]) {
- add_oopslink("mat", oops, ID_MA, ob->mat+a, 0, (float)(0.5*OOPSY));
- }
- }
- }
-
- if(flag & OOPS_IP) add_oopslink("ipo", oops, ID_IP, &ob->ipo, OOPSX, (float)(0.5*OOPSY));
-
- if (ob->dup_group && (ob->transflag & OB_DUPLIGROUP))
- add_oopslink("group", oops, ID_GR, &ob->dup_group, OOPSX, (float)(0.5*OOPSY));
-}
-
-void add_mesh_oopslinks(Mesh *me, Oops *oops, short flag)
-{
- int a;
-
- if(flag & OOPS_MA) {
- for(a=0; a<me->totcol; a++) {
- if(me->mat[a]) {
- add_oopslink("ma", oops, ID_MA, me->mat+a, 0.0, (float)(0.5*OOPSY));
- }
- }
- }
- if(flag & OOPS_IP) {
- if(me->key) add_oopslink("ipo", oops, ID_IP, &me->key->ipo, OOPSX, (float)(0.5*OOPSY));
- }
-}
-
-void add_curve_oopslinks(Curve *cu, Oops *oops, short flag)
-{
- int a;
-
- if(flag & OOPS_MA) {
- for(a=0; a<cu->totcol; a++) {
- if(cu->mat[a]) {
- add_oopslink("ma", oops, ID_MA, cu->mat+a, 0.0, (float)(0.5*OOPSY));
- }
- }
- }
- if(flag & OOPS_IP) {
- add_oopslink("speed", oops, ID_IP, &cu->ipo, OOPSX, (float)(0.5*OOPSY));
- if(cu->key) add_oopslink("ipo", oops, ID_IP, &cu->key->ipo, OOPSX, (float)(0.5*OOPSY));
- }
-
-}
-
-void add_mball_oopslinks(MetaBall *mb, Oops *oops, short flag)
-{
- int a;
-
- if(flag & OOPS_MA) {
- for(a=0; a<mb->totcol; a++) {
- if(mb->mat[a]) {
- add_oopslink("ma", oops, ID_MA, mb->mat+a, 0.0, (float)(0.5*OOPSY));
- }
- }
- }
-}
-
-void add_lamp_oopslinks(Lamp *la, Oops *oops, short flag)
-{
- int a;
-
- if(flag & OOPS_TE) {
- for(a=0; a<MAX_MTEX; a++) {
- if(la->mtex[a]) {
- add_oopslink("tex", oops, ID_TE, &(la->mtex[a]->tex), 0.0, (float)(0.5*OOPSY));
- }
- }
- }
-}
-
-
-Oops *add_test_oops(void *id) /* incl links */
-{
- Oops *oops;
- Object *ob;
- Lamp *la;
- Tex *tex;
-
- if(id==0) return NULL;
-
- /* test if it exists */
- oops= find_oops(id);
-
- if(oops) {
- oops->hide= 0;
- }
- else {
- oops= add_oops(id);
- new_oops_location(oops);
- if(G.soops->flag & SO_NEWSELECTED) {
- oops->flag |= SELECT;
- }
- }
-
- switch( GS( ((ID *)id)->name)) {
- case ID_SCE:
- add_oopslink("set", oops, ID_SCE, &((Scene *)id)->set, (float)(.5*OOPSX), (float)OOPSY);
- break;
- case ID_OB:
- ob= (Object *)id;
- if(ob->flag & SELECT) oops->flag |= SELECT;
- else oops->flag &= ~SELECT;
- add_object_oopslinks(ob, oops, G.soops->visiflag);
- break;
- case ID_ME:
- add_mesh_oopslinks((Mesh *)id, oops, G.soops->visiflag);
- break;
- case ID_CU:
- add_curve_oopslinks((Curve *)id, oops, G.soops->visiflag);
- break;
- case ID_MB:
- add_mball_oopslinks((MetaBall *)id, oops, G.soops->visiflag);
- break;
- case ID_LA:
- la= (Lamp *)id;
- add_lamp_oopslinks(la, oops, G.soops->visiflag);
- if(la->ipo) if(G.soops->visiflag & OOPS_IP) add_oopslink("ipo", oops, ID_IP, &la->ipo, OOPSX, (float)(0.3*OOPSY));
- break;
- case ID_IP:
-
- break;
- case ID_MA:
- add_material_oopslinks((Material *)id, oops, G.soops->visiflag);
- break;
- case ID_GR:
- add_group_oopslinks((Group *)id, oops, G.soops->visiflag);
- break;
- case ID_TE:
- tex= (Tex *)id;
- if(tex->ima) if(G.soops->visiflag & OOPS_IM) add_oopslink("image", oops, ID_IM, &tex->ima, OOPSX, (float)(0.3*OOPSY));
- }
-
- return oops;
-}
-
-void add_texture_oops(Material *ma)
-{
- int a;
-
- for(a=0; a<MAX_MTEX; a++) {
- if(ma->mtex[a]) {
- add_test_oops(ma->mtex[a]->tex);
- if(ma->mtex[a]->tex) if(G.soops->visiflag & OOPS_IM) add_test_oops(ma->mtex[a]->tex->ima);
- }
- }
-}
-
-void build_oops()
-{
- Oops *oops;
- OopsLink *ol;
- ID *id;
- Base *base;
- Object *ob;
- short a, type;
-
- /* always build it all! */
-
- if(G.soops==0) return;
-
- /* set hide flags */
- oops= G.soops->oops.first;
- while(oops) {
- oops->hide= 1;
- oops->flag &= ~OOPS_REFER;
-
- BLI_freelistN(&oops->link); /* much safer */
-
- oops= oops->next;
- }
-
- /* make oops, includes testing for existance */
-
- /* always */
- if(G.soops->visiflag & OOPS_LI) {
- Library *li= G.main->library.first;
- while(li) {
- oops= add_test_oops(li);
- li= li->id.next;
- }
- }
-
- /* the rest in 2 ways: or everything (OOPS_SCE) or only the ones in this scene */
-
- if(G.soops->visiflag & OOPS_SCE) {
- Scene *sce= G.main->scene.first;
-
- while(sce) {
-
- oops= add_test_oops(sce);
-
- if(G.soops->visiflag & OOPS_OB) {
- base= sce->base.first;
- while(base) {
-
- add_oopslink("object", oops, ID_OB, &base->object, (float)(.5*OOPSX), (float)OOPSY);
- base= base->next;
- }
- }
-
- sce= sce->id.next;
- }
-
- if(G.soops->visiflag & OOPS_OB) {
- Object *ob= G.main->object.first;
-
- while(ob) {
- oops= add_test_oops(ob);
- ob= ob->id.next;
- }
- }
- if(G.soops->visiflag & OOPS_ME) {
- Mesh *me= G.main->mesh.first;
- while(me) {
- oops= add_test_oops(me);
- me= me->id.next;
- }
- }
-
- if(G.soops->visiflag & OOPS_CU) {
- Curve *cu= G.main->curve.first;
- while(cu) {
- oops= add_test_oops(cu);
- cu= cu->id.next;
- }
- }
-
- if(G.soops->visiflag & OOPS_MB) {
- MetaBall *mb= G.main->mball.first;
- while(mb) {
- oops= add_test_oops(mb);
- mb= mb->id.next;
- }
- }
-
- if(G.soops->visiflag & OOPS_LA) {
- Lamp *la= G.main->lamp.first;
- while(la) {
- oops= add_test_oops(la);
- la= la->id.next;
- }
- }
-
- if(G.soops->visiflag & OOPS_IP) {
- Ipo *ipo= G.main->ipo.first;
- while(ipo) {
- oops= add_test_oops(ipo);
- ipo= ipo->id.next;
- }
- }
-
- if(G.soops->visiflag & OOPS_MA) {
- Material *ma= G.main->mat.first;
- while(ma) {
- oops= add_test_oops(ma);
- ma= ma->id.next;
- }
- }
- if(G.soops->visiflag & OOPS_TE) {
- Tex *tex= G.main->tex.first;
- while(tex) {
- oops= add_test_oops(tex);
- tex= tex->id.next;
- }
- }
- if(G.soops->visiflag & OOPS_IM) {
- Image *ima= G.main->image.first;
- while(ima) {
- oops= add_test_oops(ima);
- ima= ima->id.next;
- }
- }
- if(G.soops->visiflag & OOPS_GR) {
- Group *gp= G.main->group.first;
- while(gp) {
- oops= add_test_oops(gp);
- gp= gp->id.next;
- }
- }
- }
- else {
-
- /* only blocks from this scene */
-
- base= FIRSTBASE;
- while(base) {
-
- /* layer? */
- if( (G.soops->visiflag & OOPS_LAY)==0 || (base->lay & G.scene->lay)) {
- ob= base->object;
-
- if(G.soops->visiflag & OOPS_OB) {
- oops= add_test_oops(ob);
- }
- if(G.soops->visiflag & OOPS_MA) {
- for(a=0; a<ob->totcol; a++) {
- if(ob->mat[a]) {
- oops= add_test_oops(ob->mat[a]);
- if(G.soops->visiflag & OOPS_TE) add_texture_oops(ob->mat[a]);
- if(G.soops->visiflag & OOPS_IP) add_test_oops(ob->mat[a]->ipo);
- }
- }
- }
- if(G.soops->visiflag & OOPS_IP) oops= add_test_oops(ob->ipo);
-
- id= ob->data;
- if(id) {
- type= GS(id->name);
-
- if(type==ID_ME && G.soops->visiflag & OOPS_ME) {
- Mesh *me= ob->data;
- oops= add_test_oops(ob->data);
-
- if(G.soops->visiflag & OOPS_MA) {
- for(a=0; a<me->totcol; a++) {
- if(me->mat[a]) {
- oops= add_test_oops(me->mat[a]);
- if(G.soops->visiflag & OOPS_TE) add_texture_oops(me->mat[a]);
- if(G.soops->visiflag & OOPS_IP) add_test_oops(me->mat[a]->ipo);
- }
- }
- }
- if(G.soops->visiflag & OOPS_IP) {
- if(me->key) oops= add_test_oops(me->key->ipo);
- }
- }
- else if(type==ID_CU && G.soops->visiflag & OOPS_CU) {
- Curve *cu= ob->data;
- oops= add_test_oops(ob->data);
-
- if(G.soops->visiflag & OOPS_MA) {
- for(a=0; a<cu->totcol; a++) {
- if(cu->mat[a]) {
- oops= add_test_oops(cu->mat[a]);
- if(G.soops->visiflag & OOPS_TE) add_texture_oops(cu->mat[a]);
- if(G.soops->visiflag & OOPS_IP) add_test_oops(cu->mat[a]->ipo);
- }
- }
- }
- if(G.soops->visiflag & OOPS_IP) {
- if(cu->ipo) oops= add_test_oops(cu->ipo);
- if(cu->key) oops= add_test_oops(cu->key->ipo);
- }
- }
- else if(type==ID_MB && G.soops->visiflag & OOPS_MB) {
- oops= add_test_oops(ob->data);
-
- if(G.soops->visiflag & OOPS_MA) {
- MetaBall *mb= ob->data;
- for(a=0; a<mb->totcol; a++) {
- if(mb->mat[a]) {
- oops= add_test_oops(mb->mat[a]);
- if(G.soops->visiflag & OOPS_TE) add_texture_oops(mb->mat[a]);
- if(G.soops->visiflag & OOPS_IP) add_test_oops(mb->mat[a]->ipo);
- }
- }
- }
- }
- else if(type==ID_LA && G.soops->visiflag & OOPS_LA) {
- Lamp *la= ob->data;
- oops= add_test_oops(ob->data);
- if(G.soops->visiflag & OOPS_IP) add_test_oops(la->ipo);
- if(G.soops->visiflag & OOPS_TE) {
- for(a=0; a<MAX_MTEX; a++) {
- if(la->mtex[a]) add_test_oops(la->mtex[a]->tex);
- }
- }
- }
- }
- }
- base= base->next;
- }
- }
-
-
-
-
- /* test links */
- oops= G.soops->oops.first;
- while(oops) {
- if(oops->hide==0) {
- ol= oops->link.first;
- while(ol) {
- test_oopslink(ol);
- ol= ol->next;
- }
- }
- oops= oops->next;
- }
-
- G.soops->flag &= ~SO_NEWSELECTED;
-}
diff --git a/source/blender/src/outliner.c b/source/blender/src/outliner.c
deleted file mode 100644
index 3e969e4ca9c..00000000000
--- a/source/blender/src/outliner.c
+++ /dev/null
@@ -1,3640 +0,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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2004 Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include <string.h>
-#include <stdlib.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_action_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_image_types.h"
-#include "DNA_ipo_types.h"
-#include "DNA_group_types.h"
-#include "DNA_key_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_material_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meta_types.h"
-#include "DNA_modifier_types.h"
-#include "DNA_nla_types.h"
-#include "DNA_object_types.h"
-#include "DNA_oops_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_text_types.h"
-#include "DNA_world_types.h"
-
-#include "BLI_blenlib.h"
-
-#include "BKE_constraint.h"
-#include "BKE_deform.h"
-#include "BKE_depsgraph.h"
-#include "BKE_global.h"
-#include "BKE_group.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
-#include "BKE_material.h"
-#include "BKE_modifier.h"
-#include "BKE_screen.h"
-#include "BKE_scene.h"
-#include "BKE_utildefines.h"
-
-#ifdef WITH_VERSE
-#include "BKE_verse.h"
-#endif
-
-#include "BIF_butspace.h"
-#include "BIF_drawscene.h"
-#include "BIF_drawtext.h"
-#include "BIF_editaction.h"
-#include "BIF_editarmature.h"
-#include "BIF_editdeform.h"
-#include "BIF_editnla.h"
-#include "BIF_editview.h"
-#include "BIF_editconstraint.h"
-#include "BIF_gl.h"
-#include "BIF_graphics.h"
-#include "BIF_interface.h"
-#include "BIF_interface_icons.h"
-#include "BIF_mywindow.h"
-#include "BIF_outliner.h"
-#include "BIF_language.h"
-#include "BIF_mainqueue.h"
-#include "BIF_poseobject.h"
-#include "BIF_previewrender.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-
-#ifdef WITH_VERSE
-#include "BIF_verse.h"
-#endif
-
-#ifdef INTERNATIONAL
-#include "FTF_Api.h"
-#endif
-
-#include "BDR_editobject.h"
-#include "BSE_drawipo.h"
-#include "BSE_edit.h"
-#include "BSE_view.h"
-
-#include "PIL_time.h"
-
-#include "blendef.h"
-#include "mydevice.h"
-
-#define OL_H 19
-#define OL_X 18
-
-#define OL_TOG_RESTRICT_VIEWX 54
-#define OL_TOG_RESTRICT_SELECTX 36
-#define OL_TOG_RESTRICT_RENDERX 18
-
-#define OL_TOGW OL_TOG_RESTRICT_VIEWX
-
-#define TS_CHUNK 128
-
-#define TREESTORE(a) ((a)?soops->treestore->data+(a)->store_index:NULL)
-
-#ifdef WITH_VERSE
-extern ListBase session_list;
-extern ListBase server_list;
-#endif
-
-
-/* ******************** PROTOTYPES ***************** */
-static void outliner_draw_tree_element(SpaceOops *soops, TreeElement *te, int startx, int *starty);
-
-
-/* ******************** PERSISTANT DATA ***************** */
-
-static void outliner_storage_cleanup(SpaceOops *soops)
-{
- TreeStore *ts= soops->treestore;
-
- if(ts) {
- TreeStoreElem *tselem;
- int a, unused= 0;
-
- /* each element used once, for ID blocks with more users to have each a treestore */
- for(a=0, tselem= ts->data; a<ts->usedelem; a++, tselem++) tselem->used= 0;
-
- /* cleanup only after reading file or undo step */
- if(soops->storeflag & SO_TREESTORE_CLEANUP) {
-
- for(a=0, tselem= ts->data; a<ts->usedelem; a++, tselem++) {
- if(tselem->id==NULL) unused++;
- }
-
- if(unused) {
- if(ts->usedelem == unused) {
- MEM_freeN(ts->data);
- ts->data= NULL;
- ts->usedelem= ts->totelem= 0;
- }
- else {
- TreeStoreElem *tsnewar, *tsnew;
-
- tsnew=tsnewar= MEM_mallocN((ts->usedelem-unused)*sizeof(TreeStoreElem), "new tselem");
- for(a=0, tselem= ts->data; a<ts->usedelem; a++, tselem++) {
- if(tselem->id) {
- *tsnew= *tselem;
- tsnew++;
- }
- }
- MEM_freeN(ts->data);
- ts->data= tsnewar;
- ts->usedelem-= unused;
- ts->totelem= ts->usedelem;
- }
- }
- }
- }
-}
-
-static void check_persistant(SpaceOops *soops, TreeElement *te, ID *id, short type, short nr)
-{
- TreeStore *ts;
- TreeStoreElem *tselem;
- int a;
-
- /* case 1; no TreeStore */
- if(soops->treestore==NULL) {
- ts= soops->treestore= MEM_callocN(sizeof(TreeStore), "treestore");
- }
- ts= soops->treestore;
-
- /* check if 'te' is in treestore */
- tselem= ts->data;
- for(a=0; a<ts->usedelem; a++, tselem++) {
- if(tselem->id==id && tselem->used==0) {
- if((type==0 && tselem->type==0) ||(tselem->type==type && tselem->nr==nr)) {
- te->store_index= a;
- tselem->used= 1;
- return;
- }
- }
- }
-
- /* add 1 element to treestore */
- if(ts->usedelem==ts->totelem) {
- TreeStoreElem *tsnew;
-
- tsnew= MEM_mallocN((ts->totelem+TS_CHUNK)*sizeof(TreeStoreElem), "treestore data");
- if(ts->data) {
- memcpy(tsnew, ts->data, ts->totelem*sizeof(TreeStoreElem));
- MEM_freeN(ts->data);
- }
- ts->data= tsnew;
- ts->totelem+= TS_CHUNK;
- }
-
- tselem= ts->data+ts->usedelem;
-
- tselem->type= type;
- if(type) tselem->nr= nr; // we're picky! :)
- else tselem->nr= 0;
- tselem->id= id;
- tselem->flag= TSE_CLOSED;
- te->store_index= ts->usedelem;
-
- ts->usedelem++;
-}
-
-/* ******************** TREE MANAGEMENT ****************** */
-
-void outliner_free_tree(ListBase *lb)
-{
-
- while(lb->first) {
- TreeElement *te= lb->first;
-
- outliner_free_tree(&te->subtree);
- BLI_remlink(lb, te);
- MEM_freeN(te);
- }
-}
-
-static void outliner_height(SpaceOops *soops, ListBase *lb, int *h)
-{
- TreeElement *te= lb->first;
- while(te) {
- TreeStoreElem *tselem= TREESTORE(te);
- if((tselem->flag & TSE_CLOSED)==0)
- outliner_height(soops, &te->subtree, h);
- (*h)++;
- te= te->next;
- }
-}
-
-static void outliner_width(SpaceOops *soops, ListBase *lb, int *w)
-{
- TreeElement *te= lb->first;
- while(te) {
- TreeStoreElem *tselem= TREESTORE(te);
- if(tselem->flag & TSE_CLOSED) {
- if (te->xend > *w)
- *w = te->xend;
- }
- outliner_width(soops, &te->subtree, w);
- te= te->next;
- }
-}
-
-static TreeElement *outliner_find_tree_element(ListBase *lb, int store_index)
-{
- TreeElement *te= lb->first, *tes;
- while(te) {
- if(te->store_index==store_index) return te;
- tes= outliner_find_tree_element(&te->subtree, store_index);
- if(tes) return tes;
- te= te->next;
- }
- return NULL;
-}
-
-
-
-static ID *outliner_search_back(SpaceOops *soops, TreeElement *te, short idcode)
-{
- TreeStoreElem *tselem;
- te= te->parent;
-
- while(te) {
- tselem= TREESTORE(te);
- if(te->idcode==idcode && tselem->type==0) return tselem->id;
- te= te->parent;
- }
- return NULL;
-}
-
-struct treesort {
- TreeElement *te;
- ID *id;
- char *name;
- short idcode;
-};
-
-static int treesort_alpha(const void *v1, const void *v2)
-{
- const struct treesort *x1= v1, *x2= v2;
- int comp;
-
- /* first put objects last (hierarchy) */
- comp= (x1->idcode==ID_OB);
- if(x2->idcode==ID_OB) comp+=2;
-
- if(comp==1) return 1;
- else if(comp==2) return -1;
- else if(comp==3) {
- int comp= strcmp(x1->name, x2->name);
-
- if( comp>0 ) return 1;
- else if( comp<0) return -1;
- return 0;
- }
- return 0;
-}
-
-/* this is nice option for later? doesnt look too useful... */
-#if 0
-static int treesort_obtype_alpha(const void *v1, const void *v2)
-{
- const struct treesort *x1= v1, *x2= v2;
-
- /* first put objects last (hierarchy) */
- if(x1->idcode==ID_OB && x2->idcode!=ID_OB) return 1;
- else if(x2->idcode==ID_OB && x1->idcode!=ID_OB) return -1;
- else {
- /* 2nd we check ob type */
- if(x1->idcode==ID_OB && x2->idcode==ID_OB) {
- if( ((Object *)x1->id)->type > ((Object *)x2->id)->type) return 1;
- else if( ((Object *)x1->id)->type > ((Object *)x2->id)->type) return -1;
- else return 0;
- }
- else {
- int comp= strcmp(x1->name, x2->name);
-
- if( comp>0 ) return 1;
- else if( comp<0) return -1;
- return 0;
- }
- }
-}
-#endif
-
-/* sort happens on each subtree individual */
-static void outliner_sort(SpaceOops *soops, ListBase *lb)
-{
- TreeElement *te;
- TreeStoreElem *tselem;
- int totelem=0;
-
- te= lb->last;
- if(te==NULL) return;
- tselem= TREESTORE(te);
-
- /* sorting rules; only object lists or deformgroups */
- if( (tselem->type==TSE_DEFGROUP) || (tselem->type==0 && te->idcode==ID_OB)) {
-
- /* count first */
- for(te= lb->first; te; te= te->next) totelem++;
-
- if(totelem>1) {
- struct treesort *tear= MEM_mallocN(totelem*sizeof(struct treesort), "tree sort array");
- struct treesort *tp=tear;
- int skip= 0;
-
- for(te= lb->first; te; te= te->next, tp++) {
- tselem= TREESTORE(te);
- tp->te= te;
- tp->name= te->name;
- tp->idcode= te->idcode;
- if(tselem->type && tselem->type!=TSE_DEFGROUP) tp->idcode= 0; // dont sort this
- tp->id= tselem->id;
- }
- /* keep beginning of list */
- for(tp= tear, skip=0; skip<totelem; skip++, tp++)
- if(tp->idcode) break;
-
- if(skip<totelem)
- qsort(tear+skip, totelem-skip, sizeof(struct treesort), treesort_alpha);
-
- lb->first=lb->last= NULL;
- tp= tear;
- while(totelem--) {
- BLI_addtail(lb, tp->te);
- tp++;
- }
- MEM_freeN(tear);
- }
- }
-
- for(te= lb->first; te; te= te->next) {
- outliner_sort(soops, &te->subtree);
- }
-}
-
-/* Prototype, see functions below */
-static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *idv,
- TreeElement *parent, short type, short index);
-
-
-static void outliner_add_passes(SpaceOops *soops, TreeElement *tenla, ID *id, SceneRenderLayer *srl)
-{
- TreeStoreElem *tselem= TREESTORE(tenla);
- TreeElement *te;
-
- te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_COMBINED);
- te->name= "Combined";
- te->directdata= &srl->passflag;
-
- /* save cpu cycles, but we add the first to invoke an open/close triangle */
- if(tselem->flag & TSE_CLOSED)
- return;
-
- te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_Z);
- te->name= "Z";
- te->directdata= &srl->passflag;
-
- te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_VECTOR);
- te->name= "Vector";
- te->directdata= &srl->passflag;
-
- te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_NORMAL);
- te->name= "Normal";
- te->directdata= &srl->passflag;
-
- te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_UV);
- te->name= "UV";
- te->directdata= &srl->passflag;
-
- te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_INDEXOB);
- te->name= "Index Object";
- te->directdata= &srl->passflag;
-
- te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_RGBA);
- te->name= "Color";
- te->directdata= &srl->passflag;
-
- te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_DIFFUSE);
- te->name= "Diffuse";
- te->directdata= &srl->passflag;
-
- te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_SPEC);
- te->name= "Specular";
- te->directdata= &srl->passflag;
-
- te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_SHADOW);
- te->name= "Shadow";
- te->directdata= &srl->passflag;
-
- te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_AO);
- te->name= "AO";
- te->directdata= &srl->passflag;
-
- te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_REFLECT);
- te->name= "Reflection";
- te->directdata= &srl->passflag;
-
- te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_REFRACT);
- te->name= "Refraction";
- te->directdata= &srl->passflag;
-
- te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_RADIO);
- te->name= "Radiosity";
- te->directdata= &srl->passflag;
-
-}
-
-
-/* special handling of hierarchical non-lib data */
-static void outliner_add_bone(SpaceOops *soops, ListBase *lb, ID *id, Bone *curBone,
- TreeElement *parent, int *a)
-{
- TreeElement *te= outliner_add_element(soops, lb, id, parent, TSE_BONE, *a);
-
- (*a)++;
- te->name= curBone->name;
- te->directdata= curBone;
-
- for(curBone= curBone->childbase.first; curBone; curBone=curBone->next) {
- outliner_add_bone(soops, &te->subtree, id, curBone, te, a);
- }
-}
-
-static void outliner_add_scene_contents(SpaceOops *soops, ListBase *lb, Scene *sce, TreeElement *te)
-{
- SceneRenderLayer *srl;
- TreeElement *tenla= outliner_add_element(soops, lb, sce, te, TSE_R_LAYER_BASE, 0);
- int a;
-
- tenla->name= "RenderLayers";
- for(a=0, srl= sce->r.layers.first; srl; srl= srl->next, a++) {
- TreeElement *tenlay= outliner_add_element(soops, &tenla->subtree, sce, te, TSE_R_LAYER, a);
- tenlay->name= srl->name;
- tenlay->directdata= &srl->passflag;
-
- if(srl->light_override)
- outliner_add_element(soops, &tenlay->subtree, srl->light_override, tenlay, TSE_LINKED_LAMP, 0);
- if(srl->mat_override)
- outliner_add_element(soops, &tenlay->subtree, srl->mat_override, tenlay, TSE_LINKED_MAT, 0);
-
- outliner_add_passes(soops, tenlay, &sce->id, srl);
- }
-
- outliner_add_element(soops, lb, sce->world, te, 0, 0);
-
- if(sce->scriptlink.scripts) {
- int a= 0;
- tenla= outliner_add_element(soops, lb, sce, te, TSE_SCRIPT_BASE, 0);
- tenla->name= "Scripts";
- for (a=0; a<sce->scriptlink.totscript; a++) {
- outliner_add_element(soops, &tenla->subtree, sce->scriptlink.scripts[a], tenla, 0, 0);
- }
- }
-
-}
-
-static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *idv,
- TreeElement *parent, short type, short index)
-{
- TreeElement *te;
- TreeStoreElem *tselem;
- ID *id= idv;
- int a;
-
- if(id==NULL) return NULL;
-
- te= MEM_callocN(sizeof(TreeElement), "tree elem");
- /* add to the visual tree */
- BLI_addtail(lb, te);
- /* add to the storage */
- check_persistant(soops, te, id, type, index);
- tselem= TREESTORE(te);
-
- te->parent= parent;
- te->index= index; // for data arays
- te->name= id->name+2; // default, can be overridden by Library or non-ID data
- te->idcode= GS(id->name);
-
- if(type==0) {
-
- /* tuck pointer back in object, to construct hierarchy */
- if(GS(id->name)==ID_OB) id->newid= (ID *)te;
-
- /* expand specific data always */
- switch(GS(id->name)) {
- case ID_LI:
- te->name= ((Library *)id)->name;
- break;
- case ID_SCE:
- outliner_add_scene_contents(soops, &te->subtree, (Scene *)id, te);
- break;
- case ID_OB:
- {
- Object *ob= (Object *)id;
-
- if(ob->proxy && ob->id.lib==NULL)
- outliner_add_element(soops, &te->subtree, ob->proxy, te, TSE_PROXY, 0);
-
- outliner_add_element(soops, &te->subtree, ob->data, te, 0, 0);
-
- if(ob->pose) {
- bPoseChannel *pchan;
- TreeElement *ten;
- TreeElement *tenla= outliner_add_element(soops, &te->subtree, ob, te, TSE_POSE_BASE, 0);
-
- tenla->name= "Pose";
-
- if(ob!=G.obedit && (ob->flag & OB_POSEMODE)) { // channels undefined in editmode, but we want the 'tenla' pose icon itself
- int a= 0, const_index= 1000; /* ensure unique id for bone constraints */
-
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next, a++) {
- ten= outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_POSE_CHANNEL, a);
- ten->name= pchan->name;
- ten->directdata= pchan;
- pchan->prev= (bPoseChannel *)ten;
-
- if(pchan->constraints.first) {
- //Object *target;
- bConstraint *con;
- TreeElement *ten1;
- TreeElement *tenla1= outliner_add_element(soops, &ten->subtree, ob, ten, TSE_CONSTRAINT_BASE, 0);
- //char *str;
-
- tenla1->name= "Constraints";
- for(con= pchan->constraints.first; con; con= con->next, const_index++) {
- ten1= outliner_add_element(soops, &tenla1->subtree, ob, tenla1, TSE_CONSTRAINT, const_index);
-#if 0 /* disabled as it needs to be reworked for recoded constraints system */
- target= get_constraint_target(con, &str);
- if(str && str[0]) ten1->name= str;
- else if(target) ten1->name= target->id.name+2;
- else ten1->name= con->name;
-#endif
- ten1->name= con->name;
- ten1->directdata= con;
- /* possible add all other types links? */
- }
- }
- }
- /* make hierarchy */
- ten= tenla->subtree.first;
- while(ten) {
- TreeElement *nten= ten->next, *par;
- tselem= TREESTORE(ten);
- if(tselem->type==TSE_POSE_CHANNEL) {
- pchan= (bPoseChannel *)ten->directdata;
- if(pchan->parent) {
- BLI_remlink(&tenla->subtree, ten);
- par= (TreeElement *)pchan->parent->prev;
- BLI_addtail(&par->subtree, ten);
- ten->parent= par;
- }
- }
- ten= nten;
- }
- /* restore prev pointers */
- pchan= ob->pose->chanbase.first;
- if(pchan) pchan->prev= NULL;
- for(; pchan; pchan= pchan->next) {
- if(pchan->next) pchan->next->prev= pchan;
- }
- }
- }
-
- outliner_add_element(soops, &te->subtree, ob->ipo, te, 0, 0);
- outliner_add_element(soops, &te->subtree, ob->action, te, 0, 0);
-
- for(a=0; a<ob->totcol; a++)
- outliner_add_element(soops, &te->subtree, ob->mat[a], te, 0, a);
-
- if(ob->constraints.first) {
- //Object *target;
- bConstraint *con;
- TreeElement *ten;
- TreeElement *tenla= outliner_add_element(soops, &te->subtree, ob, te, TSE_CONSTRAINT_BASE, 0);
- int a= 0;
- //char *str;
-
- tenla->name= "Constraints";
- for(con= ob->constraints.first; con; con= con->next, a++) {
- ten= outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_CONSTRAINT, a);
-#if 0 /* disabled due to constraints system targets recode... code here needs review */
- target= get_constraint_target(con, &str);
- if(str && str[0]) ten->name= str;
- else if(target) ten->name= target->id.name+2;
- else ten->name= con->name;
-#endif
- ten->name= con->name;
- ten->directdata= con;
- /* possible add all other types links? */
- }
- }
-
- if(ob->modifiers.first) {
- ModifierData *md;
- TreeElement *temod = outliner_add_element(soops, &te->subtree, ob, te, TSE_MODIFIER_BASE, 0);
- int index;
-
- temod->name = "Modifiers";
- for (index=0,md=ob->modifiers.first; md; index++,md=md->next) {
- TreeElement *te = outliner_add_element(soops, &temod->subtree, ob, temod, TSE_MODIFIER, index);
- te->name= md->name;
-
- if (md->type==eModifierType_Lattice) {
- outliner_add_element(soops, &te->subtree, ((LatticeModifierData*) md)->object, te, TSE_LINKED_OB, 0);
- } else if (md->type==eModifierType_Curve) {
- outliner_add_element(soops, &te->subtree, ((CurveModifierData*) md)->object, te, TSE_LINKED_OB, 0);
- } else if (md->type==eModifierType_Armature) {
- outliner_add_element(soops, &te->subtree, ((ArmatureModifierData*) md)->object, te, TSE_LINKED_OB, 0);
- } else if (md->type==eModifierType_Hook) {
- outliner_add_element(soops, &te->subtree, ((HookModifierData*) md)->object, te, TSE_LINKED_OB, 0);
- }
- }
- }
- if(ob->defbase.first) {
- bDeformGroup *defgroup;
- TreeElement *ten;
- TreeElement *tenla= outliner_add_element(soops, &te->subtree, ob, te, TSE_DEFGROUP_BASE, 0);
- int a= 0;
-
- tenla->name= "Vertex Groups";
- for (defgroup=ob->defbase.first; defgroup; defgroup=defgroup->next, a++) {
- ten= outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_DEFGROUP, a);
- ten->name= defgroup->name;
- ten->directdata= defgroup;
- }
- }
- if(ob->scriptlink.scripts) {
- TreeElement *tenla= outliner_add_element(soops, &te->subtree, ob, te, TSE_SCRIPT_BASE, 0);
- int a= 0;
-
- tenla->name= "Scripts";
- for (a=0; a<ob->scriptlink.totscript; a++) { /* ** */
- outliner_add_element(soops, &tenla->subtree, ob->scriptlink.scripts[a], te, 0, 0);
- }
- }
-
- if(ob->dup_group)
- outliner_add_element(soops, &te->subtree, ob->dup_group, te, 0, 0);
-
- if(ob->nlastrips.first) {
- bActionStrip *strip;
- TreeElement *ten;
- TreeElement *tenla= outliner_add_element(soops, &te->subtree, ob, te, TSE_NLA, 0);
- int a= 0;
-
- tenla->name= "NLA strips";
- for (strip=ob->nlastrips.first; strip; strip=strip->next, a++) {
- ten= outliner_add_element(soops, &tenla->subtree, strip->act, tenla, TSE_NLA_ACTION, a);
- if(ten) ten->directdata= strip;
- }
- }
-
- }
- break;
- case ID_ME:
- {
- Mesh *me= (Mesh *)id;
- outliner_add_element(soops, &te->subtree, me->ipo, te, 0, 0);
- outliner_add_element(soops, &te->subtree, me->key, te, 0, 0);
- for(a=0; a<me->totcol; a++)
- outliner_add_element(soops, &te->subtree, me->mat[a], te, 0, a);
- /* could do tfaces with image links, but the images are not grouped nicely.
- would require going over all tfaces, sort images in use. etc... */
- }
- break;
- case ID_CU:
- {
- Curve *cu= (Curve *)id;
- for(a=0; a<cu->totcol; a++)
- outliner_add_element(soops, &te->subtree, cu->mat[a], te, 0, a);
- }
- break;
- case ID_MB:
- {
- MetaBall *mb= (MetaBall *)id;
- for(a=0; a<mb->totcol; a++)
- outliner_add_element(soops, &te->subtree, mb->mat[a], te, 0, a);
- }
- break;
- case ID_MA:
- {
- Material *ma= (Material *)id;
-
- outliner_add_element(soops, &te->subtree, ma->ipo, te, 0, 0);
- for(a=0; a<MAX_MTEX; a++) {
- if(ma->mtex[a]) outliner_add_element(soops, &te->subtree, ma->mtex[a]->tex, te, 0, a);
- }
- }
- break;
- case ID_TE:
- {
- Tex *tex= (Tex *)id;
-
- outliner_add_element(soops, &te->subtree, tex->ipo, te, 0, 0);
- outliner_add_element(soops, &te->subtree, tex->ima, te, 0, 0);
- }
- break;
- case ID_CA:
- {
- Camera *ca= (Camera *)id;
- outliner_add_element(soops, &te->subtree, ca->ipo, te, 0, 0);
- }
- break;
- case ID_LA:
- {
- Lamp *la= (Lamp *)id;
- outliner_add_element(soops, &te->subtree, la->ipo, te, 0, 0);
- for(a=0; a<MAX_MTEX; a++) {
- if(la->mtex[a]) outliner_add_element(soops, &te->subtree, la->mtex[a]->tex, te, 0, a);
- }
- }
- break;
- case ID_WO:
- {
- World *wrld= (World *)id;
- outliner_add_element(soops, &te->subtree, wrld->ipo, te, 0, 0);
- for(a=0; a<MAX_MTEX; a++) {
- if(wrld->mtex[a]) outliner_add_element(soops, &te->subtree, wrld->mtex[a]->tex, te, 0, a);
- }
- }
- break;
- case ID_KE:
- {
- Key *key= (Key *)id;
- outliner_add_element(soops, &te->subtree, key->ipo, te, 0, 0);
- }
- break;
- case ID_IP:
- {
- Ipo *ipo= (Ipo *)id;
- IpoCurve *icu;
- Object *lastadded= NULL;
-
- for(icu= ipo->curve.first; icu; icu= icu->next) {
- if(icu->driver && icu->driver->ob) {
- if(lastadded!=icu->driver->ob) {
- outliner_add_element(soops, &te->subtree, icu->driver->ob, te, TSE_LINKED_OB, 0);
- lastadded= icu->driver->ob;
- }
- }
- }
- }
- case ID_AC:
- {
- bAction *act= (bAction *)id;
- bActionChannel *chan;
- int a= 0;
-
- tselem= TREESTORE(parent);
- for (chan=act->chanbase.first; chan; chan=chan->next, a++) {
- outliner_add_element(soops, &te->subtree, chan->ipo, te, 0, a);
- }
- }
- break;
- case ID_AR:
- {
- bArmature *arm= (bArmature *)id;
- int a= 0;
-
- if(G.obedit && G.obedit->data==arm) {
- EditBone *ebone;
- TreeElement *ten;
-
- for (ebone = G.edbo.first; ebone; ebone=ebone->next, a++) {
- ten= outliner_add_element(soops, &te->subtree, id, te, TSE_EBONE, a);
- ten->directdata= ebone;
- ten->name= ebone->name;
- ebone->temp= ten;
- }
- /* make hierarchy */
- ten= te->subtree.first;
- while(ten) {
- TreeElement *nten= ten->next, *par;
- ebone= (EditBone *)ten->directdata;
- if(ebone->parent) {
- BLI_remlink(&te->subtree, ten);
- par= ebone->parent->temp;
- BLI_addtail(&par->subtree, ten);
- ten->parent= par;
- }
- ten= nten;
- }
- }
- else {
- /* do not extend Armature when we have posemode */
- tselem= TREESTORE(te->parent);
- if( GS(tselem->id->name)==ID_OB && ((Object *)tselem->id)->flag & OB_POSEMODE);
- else {
- Bone *curBone;
- for (curBone=arm->bonebase.first; curBone; curBone=curBone->next){
- outliner_add_bone(soops, &te->subtree, id, curBone, te, &a);
- }
- }
- }
- }
- break;
- }
- }
-#ifdef WITH_VERSE
- else if(type==ID_VS) {
- struct VerseSession *session = (VerseSession*)idv;
- te->name = session->address;
- te->directdata = (void*)session;
- te->idcode = ID_VS;
- }
- else if(type==ID_MS) {
- te->name = "Available Verse Servers";
- te->idcode = ID_MS;
- }
- else if(type==ID_SS) {
- struct VerseServer *server = (VerseServer *)idv;
- te->name = server->name;
- te->directdata = (void *)server;
- te->idcode = ID_SS;
- }
- else if(type==ID_VN) {
- struct VNode *vnode = (VNode*)idv;
- te->name = vnode->name;
- te->idcode = ID_VN;
- if(vnode->type==V_NT_OBJECT) {
- struct TreeElement *ten;
- struct VNode *child_node;
- struct VLink *vlink;
-
- vlink = ((VObjectData*)vnode->data)->links.lb.first;
- while(vlink) {
- child_node = vlink->target;
- if(child_node && child_node->type==V_NT_GEOMETRY) {
- ten = outliner_add_element(soops, &te->subtree, child_node, te, ID_VN, 0);
- ten->directdata = child_node;
- }
- vlink = vlink->next;
- }
- }
- }
-#endif
- return te;
-}
-
-static void outliner_make_hierarchy(SpaceOops *soops, ListBase *lb)
-{
- TreeElement *te, *ten, *tep;
- TreeStoreElem *tselem;
-
- /* build hierarchy */
- te= lb->first;
- while(te) {
- ten= te->next;
- tselem= TREESTORE(te);
-
- if(tselem->type==0 && te->idcode==ID_OB) {
- Object *ob= (Object *)tselem->id;
- if(ob->parent && ob->parent->id.newid) {
- BLI_remlink(lb, te);
- tep= (TreeElement *)ob->parent->id.newid;
- BLI_addtail(&tep->subtree, te);
- // set correct parent pointers
- for(te=tep->subtree.first; te; te= te->next) te->parent= tep;
- }
- }
- te= ten;
- }
-}
-
-static void outliner_build_tree(SpaceOops *soops)
-{
- Base *base;
- Object *ob;
- TreeElement *te, *ten;
- TreeStoreElem *tselem;
- int show_opened= soops->treestore==NULL; /* on first view, we open scenes */
-#ifdef WITH_VERSE
- struct VerseSession *session;
-#endif
-
- if(soops->tree.first && (soops->storeflag & SO_TREESTORE_REDRAW))
- return;
-
- outliner_free_tree(&soops->tree);
- outliner_storage_cleanup(soops);
-
- /* clear ob id.new flags */
- for(ob= G.main->object.first; ob; ob= ob->id.next) ob->id.newid= NULL;
-
- /* options */
- if(soops->outlinevis == SO_LIBRARIES) {
- Library *lib;
-
- for(lib= G.main->library.first; lib; lib= lib->id.next) {
- ten= outliner_add_element(soops, &soops->tree, lib, NULL, 0, 0);
- lib->id.newid= (ID *)ten;
- }
- /* make hierarchy */
- ten= soops->tree.first;
- while(ten) {
- TreeElement *nten= ten->next, *par;
- tselem= TREESTORE(ten);
- lib= (Library *)tselem->id;
- if(lib->parent) {
- BLI_remlink(&soops->tree, ten);
- par= (TreeElement *)lib->parent->id.newid;
- BLI_addtail(&par->subtree, ten);
- ten->parent= par;
- }
- ten= nten;
- }
- /* restore newid pointers */
- for(lib= G.main->library.first; lib; lib= lib->id.next)
- lib->id.newid= NULL;
-
- }
- else if(soops->outlinevis == SO_ALL_SCENES) {
- Scene *sce;
- for(sce= G.main->scene.first; sce; sce= sce->id.next) {
- te= outliner_add_element(soops, &soops->tree, sce, NULL, 0, 0);
- tselem= TREESTORE(te);
- if(sce==G.scene && show_opened)
- tselem->flag &= ~TSE_CLOSED;
-
- for(base= sce->base.first; base; base= base->next) {
- ten= outliner_add_element(soops, &te->subtree, base->object, te, 0, 0);
- ten->directdata= base;
- }
- outliner_make_hierarchy(soops, &te->subtree);
- /* clear id.newid, to prevent objects be inserted in wrong scenes (parent in other scene) */
- for(base= sce->base.first; base; base= base->next) base->object->id.newid= NULL;
- }
- }
- else if(soops->outlinevis == SO_CUR_SCENE) {
-
- outliner_add_scene_contents(soops, &soops->tree, G.scene, NULL);
-
- for(base= G.scene->base.first; base; base= base->next) {
- ten= outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0);
- ten->directdata= base;
- }
- outliner_make_hierarchy(soops, &soops->tree);
- }
- else if(soops->outlinevis == SO_VISIBLE) {
- for(base= G.scene->base.first; base; base= base->next) {
- if(base->lay & G.scene->lay)
- outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0);
- }
- outliner_make_hierarchy(soops, &soops->tree);
- }
- else if(soops->outlinevis == SO_GROUPS) {
- Group *group;
- GroupObject *go;
-
- for(group= G.main->group.first; group; group= group->id.next) {
- if(group->id.us) {
- te= outliner_add_element(soops, &soops->tree, group, NULL, 0, 0);
- tselem= TREESTORE(te);
-
- for(go= group->gobject.first; go; go= go->next) {
- ten= outliner_add_element(soops, &te->subtree, go->ob, te, 0, 0);
- ten->directdata= NULL; /* eh, why? */
- }
- outliner_make_hierarchy(soops, &te->subtree);
- /* clear id.newid, to prevent objects be inserted in wrong scenes (parent in other scene) */
- for(go= group->gobject.first; go; go= go->next) go->ob->id.newid= NULL;
- }
- }
- }
- else if(soops->outlinevis == SO_SAME_TYPE) {
- Object *ob= OBACT;
- if(ob) {
- for(base= G.scene->base.first; base; base= base->next) {
- if(base->object->type==ob->type) {
- ten= outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0);
- ten->directdata= base;
- }
- }
- outliner_make_hierarchy(soops, &soops->tree);
- }
- }
- else if(soops->outlinevis == SO_SELECTED) {
- for(base= G.scene->base.first; base; base= base->next) {
- if(base->lay & G.scene->lay) {
- if(base==BASACT || (base->flag & SELECT)) {
- ten= outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0);
- ten->directdata= base;
- }
- }
- }
- outliner_make_hierarchy(soops, &soops->tree);
- }
-#ifdef WITH_VERSE
- else if(soops->outlinevis == SO_VERSE_SESSION) {
- /* add all session to the "root" of hierarchy */
- for(session=session_list.first; session; session = session->next) {
- struct VNode *vnode;
- if(session->flag & VERSE_CONNECTED) {
- te= outliner_add_element(soops, &soops->tree, session, NULL, ID_VS, 0);
- /* add all object nodes as childreen of session */
- for(vnode=session->nodes.lb.first; vnode; vnode=vnode->next) {
- if(vnode->type==V_NT_OBJECT) {
- ten= outliner_add_element(soops, &te->subtree, vnode, te, ID_VN, 0);
- ten->directdata= vnode;
- }
- else if(vnode->type==V_NT_BITMAP) {
- ten= outliner_add_element(soops, &te->subtree, vnode, te, ID_VN, 0);
- ten->directdata= vnode;
- }
- }
- }
- }
- }
- else if(soops->outlinevis == SO_VERSE_MS) {
- te= outliner_add_element(soops, &soops->tree, "MS", NULL, ID_MS, 0);
- if(server_list.first!=NULL) {
- struct VerseServer *server;
- /* add one main entry to root of hierarchy */
- for(server=server_list.first; server; server=server->next) {
- ten= outliner_add_element(soops, &te->subtree, server, te, ID_SS, 0);
- ten->directdata= server;
- }
- }
- }
-#endif
- else {
- ten= outliner_add_element(soops, &soops->tree, OBACT, NULL, 0, 0);
- if(ten) ten->directdata= BASACT;
- }
-
-
- outliner_sort(soops, &soops->tree);
-}
-
-/* **************** INTERACTIVE ************* */
-
-static int outliner_count_levels(SpaceOops *soops, ListBase *lb, int curlevel)
-{
- TreeElement *te;
- int level=curlevel, lev;
-
- for(te= lb->first; te; te= te->next) {
-
- lev= outliner_count_levels(soops, &te->subtree, curlevel+1);
- if(lev>level) level= lev;
- }
- return level;
-}
-
-static int outliner_has_one_flag(SpaceOops *soops, ListBase *lb, short flag, short curlevel)
-{
- TreeElement *te;
- TreeStoreElem *tselem;
- int level;
-
- for(te= lb->first; te; te= te->next) {
- tselem= TREESTORE(te);
- if(tselem->flag & flag) return curlevel;
-
- level= outliner_has_one_flag(soops, &te->subtree, flag, curlevel+1);
- if(level) return level;
- }
- return 0;
-}
-
-static void outliner_set_flag(SpaceOops *soops, ListBase *lb, short flag, short set)
-{
- TreeElement *te;
- TreeStoreElem *tselem;
-
- for(te= lb->first; te; te= te->next) {
- tselem= TREESTORE(te);
- if(set==0) tselem->flag &= ~flag;
- else tselem->flag |= flag;
- outliner_set_flag(soops, &te->subtree, flag, set);
- }
-}
-
-void outliner_toggle_visible(struct ScrArea *sa)
-{
- SpaceOops *soops= sa->spacedata.first;
-
- if( outliner_has_one_flag(soops, &soops->tree, TSE_CLOSED, 1))
- outliner_set_flag(soops, &soops->tree, TSE_CLOSED, 0);
- else
- outliner_set_flag(soops, &soops->tree, TSE_CLOSED, 1);
-
- BIF_undo_push("Outliner toggle visible");
- scrarea_queue_redraw(sa);
-}
-
-void outliner_toggle_selected(struct ScrArea *sa)
-{
- SpaceOops *soops= sa->spacedata.first;
-
- if( outliner_has_one_flag(soops, &soops->tree, TSE_SELECTED, 1))
- outliner_set_flag(soops, &soops->tree, TSE_SELECTED, 0);
- else
- outliner_set_flag(soops, &soops->tree, TSE_SELECTED, 1);
-
- BIF_undo_push("Outliner toggle selected");
- soops->storeflag |= SO_TREESTORE_REDRAW;
- scrarea_queue_redraw(sa);
-}
-
-
-static void outliner_openclose_level(SpaceOops *soops, ListBase *lb, int curlevel, int level, int open)
-{
- TreeElement *te;
- TreeStoreElem *tselem;
-
- for(te= lb->first; te; te= te->next) {
- tselem= TREESTORE(te);
-
- if(open) {
- if(curlevel<=level) tselem->flag &= ~TSE_CLOSED;
- }
- else {
- if(curlevel>=level) tselem->flag |= TSE_CLOSED;
- }
-
- outliner_openclose_level(soops, &te->subtree, curlevel+1, level, open);
- }
-}
-
-/* return 1 when levels were opened */
-static int outliner_open_back(SpaceOops *soops, TreeElement *te)
-{
- TreeStoreElem *tselem;
- int retval= 0;
-
- for (te= te->parent; te; te= te->parent) {
- tselem= TREESTORE(te);
- if (tselem->flag & TSE_CLOSED) {
- tselem->flag &= ~TSE_CLOSED;
- retval= 1;
- }
- }
- return retval;
-}
-
-static void outliner_open_reveal(SpaceOops *soops, ListBase *lb, TreeElement *teFind, int *found)
-{
- TreeElement *te;
- TreeStoreElem *tselem;
-
- for (te= lb->first; te; te= te->next) {
- /* check if this tree-element was the one we're seeking */
- if (te == teFind) {
- *found= 1;
- return;
- }
-
- /* try to see if sub-tree contains it then */
- outliner_open_reveal(soops, &te->subtree, teFind, found);
- if (*found) {
- tselem= TREESTORE(te);
- if (tselem->flag & TSE_CLOSED)
- tselem->flag &= ~TSE_CLOSED;
- return;
- }
- }
-}
-
-
-void outliner_one_level(struct ScrArea *sa, int add)
-{
- SpaceOops *soops= sa->spacedata.first;
- int level;
-
- level= outliner_has_one_flag(soops, &soops->tree, TSE_CLOSED, 1);
- if(add==1) {
- if(level) outliner_openclose_level(soops, &soops->tree, 1, level, 1);
- }
- else {
- if(level==0) level= outliner_count_levels(soops, &soops->tree, 0);
- if(level) outliner_openclose_level(soops, &soops->tree, 1, level-1, 0);
- }
-
- BIF_undo_push("Outliner show/hide one level");
- scrarea_queue_redraw(sa);
-}
-
-void outliner_page_up_down(ScrArea *sa, int up)
-{
- SpaceOops *soops= sa->spacedata.first;
- int dy= soops->v2d.mask.ymax-soops->v2d.mask.ymin;
-
- if(up == -1) dy= -dy;
- soops->v2d.cur.ymin+= dy;
- soops->v2d.cur.ymax+= dy;
-
- soops->storeflag |= SO_TREESTORE_REDRAW;
- scrarea_queue_redraw(sa);
-}
-
-/* **** do clicks on items ******* */
-
-static int tree_element_active_renderlayer(TreeElement *te, TreeStoreElem *tselem, int set)
-{
- Scene *sce;
-
- /* paranoia check */
- if(te->idcode!=ID_SCE)
- return 0;
- sce= (Scene *)tselem->id;
-
- if(set) {
- sce->r.actlay= tselem->nr;
- allqueue(REDRAWBUTSSCENE, 0);
- }
- else {
- return sce->r.actlay==tselem->nr;
- }
- return 0;
-}
-
-static void tree_element_active_object(SpaceOops *soops, TreeElement *te)
-{
- TreeStoreElem *tselem= TREESTORE(te);
- Scene *sce;
- Base *base;
- Object *ob= NULL;
-
- /* if id is not object, we search back */
- if(te->idcode==ID_OB) ob= (Object *)tselem->id;
- else {
- ob= (Object *)outliner_search_back(soops, te, ID_OB);
- if(ob==OBACT) return;
- }
- if(ob==NULL) return;
-
- sce= (Scene *)outliner_search_back(soops, te, ID_SCE);
- if(sce && G.scene != sce) {
- if(G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR);
- set_scene(sce);
- }
-
- /* find associated base in current scene */
- for(base= FIRSTBASE; base; base= base->next)
- if(base->object==ob) break;
- if(base) {
- if(G.qual & LR_SHIFTKEY) {
- /* swap select */
- if(base->flag & SELECT) base->flag &= ~SELECT;
- else if ((base->object->restrictflag & OB_RESTRICT_VIEW)==0) base->flag |= SELECT;
- base->object->flag= base->flag;
- }
- else {
- Base *b;
- /* deleselect all */
- for(b= FIRSTBASE; b; b= b->next) {
- b->flag &= ~SELECT;
- b->object->flag= b->flag;
- }
- if ((base->object->restrictflag & OB_RESTRICT_VIEW)==0) {
- base->flag |= SELECT;
- base->object->flag |= SELECT;
- }
- }
- set_active_base(base); /* editview.c */
-
- allqueue(REDRAWVIEW3D, 1);
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWINFO, 1);
- }
-
- if(ob!=G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR);
-}
-
-static int tree_element_active_material(SpaceOops *soops, TreeElement *te, int set)
-{
- TreeElement *tes;
- Object *ob;
-
- /* we search for the object parent */
- ob= (Object *)outliner_search_back(soops, te, ID_OB);
- if(ob==NULL || ob!=OBACT) return 0; // just paranoia
-
- /* searching in ob mat array? */
- tes= te->parent;
- if(tes->idcode==ID_OB) {
- if(set) {
- ob->actcol= te->index+1;
- ob->colbits |= (1<<te->index); // make ob material active too
- }
- else {
- if(ob->actcol == te->index+1)
- if(ob->colbits & (1<<te->index)) return 1;
- }
- }
- /* or we search for obdata material */
- else {
- if(set) {
- ob->actcol= te->index+1;
- ob->colbits &= ~(1<<te->index); // make obdata material active too
- }
- else {
- if(ob->actcol == te->index+1)
- if( (ob->colbits & (1<<te->index))==0 ) return 1;
- }
- }
- if(set) {
- extern_set_butspace(F5KEY, 0); // force shading buttons
- BIF_preview_changed(ID_MA);
- allqueue(REDRAWBUTSSHADING, 1);
- allqueue(REDRAWNODE, 0);
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWIPO, 0);
- }
- return 0;
-}
-
-static int tree_element_active_texture(SpaceOops *soops, TreeElement *te, int set)
-{
- TreeElement *tep;
- TreeStoreElem *tselem, *tselemp;
- Object *ob=OBACT;
- ScrArea *sa;
- SpaceButs *sbuts=NULL;
-
- if(ob==NULL) return 0; // no active object
-
- tselem= TREESTORE(te);
-
- /* find buttons area (note, this is undefined really still, needs recode in blender) */
- sa= G.curscreen->areabase.first;
- while(sa) {
- if(sa->spacetype==SPACE_BUTS) break;
- sa= sa->next;
- }
- if(sa) sbuts= sa->spacedata.first;
-
- /* where is texture linked to? */
- tep= te->parent;
- tselemp= TREESTORE(tep);
-
- if(tep->idcode==ID_WO) {
- World *wrld= (World *)tselemp->id;
-
- if(set) {
- if(sbuts) {
- sbuts->tabo= TAB_SHADING_TEX; // hack from header_buttonswin.c
- sbuts->texfrom= 1;
- }
- extern_set_butspace(F6KEY, 0); // force shading buttons texture
- wrld->texact= te->index;
- }
- else if(tselemp->id == (ID *)(G.scene->world)) {
- if(wrld->texact==te->index) return 1;
- }
- }
- else if(tep->idcode==ID_LA) {
- Lamp *la= (Lamp *)tselemp->id;
- if(set) {
- if(sbuts) {
- sbuts->tabo= TAB_SHADING_TEX; // hack from header_buttonswin.c
- sbuts->texfrom= 2;
- }
- extern_set_butspace(F6KEY, 0); // force shading buttons texture
- la->texact= te->index;
- }
- else {
- if(tselemp->id == ob->data) {
- if(la->texact==te->index) return 1;
- }
- }
- }
- else if(tep->idcode==ID_MA) {
- Material *ma= (Material *)tselemp->id;
- if(set) {
- if(sbuts) {
- //sbuts->tabo= TAB_SHADING_TEX; // hack from header_buttonswin.c
- sbuts->texfrom= 0;
- }
- extern_set_butspace(F6KEY, 0); // force shading buttons texture
- ma->texact= te->index;
-
- /* also set active material */
- ob->actcol= tep->index+1;
- }
- else if(tep->flag & TE_ACTIVE) { // this is active material
- if(ma->texact==te->index) return 1;
- }
- }
-
- return 0;
-}
-
-
-static int tree_element_active_lamp(SpaceOops *soops, TreeElement *te, int set)
-{
- Object *ob;
-
- /* we search for the object parent */
- ob= (Object *)outliner_search_back(soops, te, ID_OB);
- if(ob==NULL || ob!=OBACT) return 0; // just paranoia
-
- if(set) {
- extern_set_butspace(F5KEY, 0);
- BIF_preview_changed(ID_LA);
- allqueue(REDRAWBUTSSHADING, 1);
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWIPO, 0);
- }
- else return 1;
-
- return 0;
-}
-
-static int tree_element_active_world(SpaceOops *soops, TreeElement *te, int set)
-{
- TreeElement *tep;
- TreeStoreElem *tselem=NULL;
- Scene *sce=NULL;
-
- tep= te->parent;
- if(tep) {
- tselem= TREESTORE(tep);
- sce= (Scene *)tselem->id;
- }
-
- if(set) { // make new scene active
- if(sce && G.scene != sce) {
- if(G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR);
- set_scene(sce);
- }
- }
-
- if(tep==NULL || tselem->id == (ID *)G.scene) {
- if(set) {
- extern_set_butspace(F8KEY, 0);
- }
- else {
- return 1;
- }
- }
- return 0;
-}
-
-static int tree_element_active_ipo(SpaceOops *soops, TreeElement *te, int set)
-{
- TreeElement *tes;
- TreeStoreElem *tselems=NULL;
- Object *ob;
-
- /* we search for the object parent */
- ob= (Object *)outliner_search_back(soops, te, ID_OB);
- if(ob==NULL || ob!=OBACT) return 0; // just paranoia
-
- /* the parent of ipo */
- tes= te->parent;
- tselems= TREESTORE(tes);
-
- if(set) {
- if(tes->idcode==ID_AC) {
- if(ob->ipoflag & OB_ACTION_OB)
- ob->ipowin= ID_OB;
- else if(ob->ipoflag & OB_ACTION_KEY)
- ob->ipowin= ID_KE;
- else
- ob->ipowin= ID_PO;
- }
- else ob->ipowin= tes->idcode;
-
- if(ob->ipowin==ID_MA) tree_element_active_material(soops, tes, 1);
- else if(ob->ipowin==ID_AC) {
- bActionChannel *chan;
- short a=0;
- for(chan=ob->action->chanbase.first; chan; chan= chan->next) {
- if(a==te->index) break;
- if(chan->ipo) a++;
- }
- deselect_actionchannels(ob->action, 0);
- select_channel(ob->action, chan, SELECT_ADD);
- allqueue(REDRAWACTION, ob->ipowin);
- allqueue(REDRAWVIEW3D, ob->ipowin);
- }
-
- allqueue(REDRAWIPO, ob->ipowin);
- }
- else {
- if(tes->idcode==ID_AC) {
- if(ob->ipoflag & OB_ACTION_OB)
- return ob->ipowin==ID_OB;
- else if(ob->ipoflag & OB_ACTION_KEY)
- return ob->ipowin==ID_KE;
- else if(ob->ipowin==ID_AC) {
- bActionChannel *chan;
- short a=0;
- for(chan=ob->action->chanbase.first; chan; chan= chan->next) {
- if(a==te->index) break;
- if(chan->ipo) a++;
- }
- if(chan==get_hilighted_action_channel(ob->action)) return 1;
- }
- }
- else if(ob->ipowin==tes->idcode) {
- if(ob->ipowin==ID_MA) {
- Material *ma= give_current_material(ob, ob->actcol);
- if(ma==(Material *)tselems->id) return 1;
- }
- else return 1;
- }
- }
- return 0;
-}
-
-static int tree_element_active_defgroup(TreeElement *te, TreeStoreElem *tselem, int set)
-{
- Object *ob;
-
- /* id in tselem is object */
- ob= (Object *)tselem->id;
- if(set) {
- ob->actdef= te->index+1;
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, ob->ipowin);
- }
- else {
- if(ob==OBACT)
- if(ob->actdef== te->index+1) return 1;
- }
- return 0;
-}
-
-static int tree_element_active_nla_action(TreeElement *te, TreeStoreElem *tselem, int set)
-{
- if(set) {
- bActionStrip *strip= te->directdata;
- if(strip) {
- deselect_nlachannel_keys(0);
- strip->flag |= ACTSTRIP_SELECT;
- allqueue(REDRAWNLA, 0);
- }
- }
- else {
- /* id in tselem is action */
- bActionStrip *strip= te->directdata;
- if(strip) {
- if(strip->flag & ACTSTRIP_SELECT) return 1;
- }
- }
- return 0;
-}
-
-static int tree_element_active_posechannel(TreeElement *te, TreeStoreElem *tselem, int set)
-{
- Object *ob= (Object *)tselem->id;
- bPoseChannel *pchan= te->directdata;
-
- if(set) {
- if(!(pchan->bone->flag & BONE_HIDDEN_P)) {
-
- if(G.qual & LR_SHIFTKEY) deselectall_posearmature(ob, 2, 0); // 2 = clear active tag
- else deselectall_posearmature(ob, 0, 0); // 0 = deselect
- pchan->bone->flag |= BONE_SELECTED|BONE_ACTIVE;
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWACTION, 0);
- }
- }
- else {
- if(ob==OBACT && ob->pose) {
- if (pchan->bone->flag & BONE_SELECTED) return 1;
- }
- }
- return 0;
-}
-
-static int tree_element_active_bone(TreeElement *te, TreeStoreElem *tselem, int set)
-{
- bArmature *arm= (bArmature *)tselem->id;
- Bone *bone= te->directdata;
-
- if(set) {
- if(!(bone->flag & BONE_HIDDEN_P)) {
- if(G.qual & LR_SHIFTKEY) deselectall_posearmature(OBACT, 2, 0); // 2 is clear active tag
- else deselectall_posearmature(OBACT, 0, 0);
- bone->flag |= BONE_SELECTED|BONE_ACTIVE;
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWACTION, 0);
- }
- }
- else {
- Object *ob= OBACT;
-
- if(ob && ob->data==arm) {
- if (bone->flag & BONE_SELECTED) return 1;
- }
- }
- return 0;
-}
-
-
-/* ebones only draw in editmode armature */
-static int tree_element_active_ebone(TreeElement *te, TreeStoreElem *tselem, int set)
-{
- EditBone *ebone= te->directdata;
-
- if(set) {
- if(!(ebone->flag & BONE_HIDDEN_A)) {
-
- if(G.qual & LR_SHIFTKEY) deselectall_armature(2, 0); // only clear active tag
- else deselectall_armature(0, 0); // deselect
-
- ebone->flag |= BONE_SELECTED|BONE_ROOTSEL|BONE_TIPSEL|BONE_ACTIVE;
- // flush to parent?
- if(ebone->parent && (ebone->flag & BONE_CONNECTED)) ebone->parent->flag |= BONE_TIPSEL;
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWACTION, 0);
- }
- }
- else {
- if (ebone->flag & BONE_SELECTED) return 1;
- }
- return 0;
-}
-
-static int tree_element_active_modifier(TreeElement *te, TreeStoreElem *tselem, int set)
-{
- if(set) {
- extern_set_butspace(F9KEY, 0);
- }
-
- return 0;
-}
-
-static int tree_element_active_constraint(TreeElement *te, TreeStoreElem *tselem, int set)
-{
- if(set) {
- extern_set_butspace(F7KEY, 0);
- }
-
- return 0;
-}
-
-static int tree_element_active_text(SpaceOops *soops, TreeElement *te, int set)
-{
- ScrArea *sa=NULL;
-
- for(sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- if(sa->spacetype==SPACE_TEXT) break;
- }
- if(sa) {
- SpaceText *st= sa->spacedata.first;
- TreeStoreElem *tselem= TREESTORE(te);
-
- if(set) {
- st->text= (Text *)tselem->id;
- st->top= 0;
- scrarea_queue_redraw(sa);
- }
- else if(st->text==(Text *)tselem->id) return 1;
- }
- return 0;
-}
-
-/* generic call for ID data check or make/check active in UI */
-static int tree_element_active(SpaceOops *soops, TreeElement *te, int set)
-{
-
- switch(te->idcode) {
- case ID_MA:
- return tree_element_active_material(soops, te, set);
- case ID_WO:
- return tree_element_active_world(soops, te, set);
- case ID_LA:
- return tree_element_active_lamp(soops, te, set);
- case ID_IP:
- return tree_element_active_ipo(soops, te, set);
- case ID_TE:
- return tree_element_active_texture(soops, te, set);
- case ID_TXT:
- return tree_element_active_text(soops, te, set);
- }
- return 0;
-}
-
-static int tree_element_active_pose(TreeElement *te, TreeStoreElem *tselem, int set)
-{
- Object *ob= (Object *)tselem->id;
-
- if(set) {
- if(G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR);
- if(ob->flag & OB_POSEMODE) exit_posemode();
- else enter_posemode();
- }
- else {
- if(ob->flag & OB_POSEMODE) return 1;
- }
- return 0;
-}
-
-/* generic call for non-id data to make/check active in UI */
-static int tree_element_type_active(SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, int set)
-{
-
- switch(tselem->type) {
- case TSE_NLA_ACTION:
- return tree_element_active_nla_action(te, tselem, set);
- case TSE_DEFGROUP:
- return tree_element_active_defgroup(te, tselem, set);
- case TSE_BONE:
- return tree_element_active_bone(te, tselem, set);
- case TSE_EBONE:
- return tree_element_active_ebone(te, tselem, set);
- case TSE_MODIFIER:
- return tree_element_active_modifier(te, tselem, set);
- case TSE_LINKED_OB:
- if(set) tree_element_active_object(soops, te);
- else if(tselem->id==(ID *)OBACT) return 1;
- break;
- case TSE_POSE_BASE:
- return tree_element_active_pose(te, tselem, set);
- break;
- case TSE_POSE_CHANNEL:
- return tree_element_active_posechannel(te, tselem, set);
- case TSE_CONSTRAINT:
- return tree_element_active_constraint(te, tselem, set);
- case TSE_R_LAYER:
- return tree_element_active_renderlayer(te, tselem, set);
- }
- return 0;
-}
-
-#ifdef WITH_VERSE
-static void verse_operation_menu(TreeElement *te)
-{
- short event=0;
- if(te->idcode==ID_VS) {
- struct VerseSession *session = (VerseSession*)te->directdata;
- struct VNode *vnode;
- if(!(session->flag & VERSE_AUTOSUBSCRIBE)) {
- event = pupmenu("VerseSession %t| End Session %x1| Subscribe to All Nodes %x2| Start Autosubscribe %x3");
- }
- else {
- event = pupmenu("VerseSession %t| End Session %x1| Subscribe to All Nodes %x2| Stop Autosubscribe %x4");
- }
- switch(event) {
- case 1:
- end_verse_session(session);
- break;
- case 2:
- vnode = session->nodes.lb.first;
- while(vnode) {
- b_verse_pop_node(vnode);
- vnode = vnode->next;
- }
- break;
- case 3:
- vnode = session->nodes.lb.first;
- while(vnode) {
- b_verse_pop_node(vnode);
- vnode = vnode->next;
- }
- session->flag |= VERSE_AUTOSUBSCRIBE;
- break;
- case 4:
- session->flag &= ~VERSE_AUTOSUBSCRIBE;
- break;
- }
- }
- else if(te->idcode==ID_VN) {
- struct VNode *vnode = (VNode*)te->directdata;
- event = pupmenu("VerseNode %t| Subscribe %x1| Unsubscribe %x2");
- switch(event) {
- case 1:
- b_verse_pop_node(vnode);
- break;
- case 2:
- /* Global */
- b_verse_unsubscribe(vnode);
- break;
- }
- }
- else if(te->idcode==ID_MS) {
- event = pupmenu("Verse Master Server %t| Refresh %x1");
- b_verse_ms_get();
- }
- else if(te->idcode==ID_SS) {
- struct VerseServer *vserver = (VerseServer*)te->directdata;
-
- if(!(vserver->flag & VERSE_CONNECTING) && !(vserver->flag & VERSE_CONNECTED)) {
- event = pupmenu("VerseServer %t| Connect %x1");
- } else if((vserver->flag & VERSE_CONNECTING) && !(vserver->flag & VERSE_CONNECTED)) {
- event = pupmenu("VerseServer %t| Connecting %x2");
- } else if(!(vserver->flag & VERSE_CONNECTING) && (vserver->flag & VERSE_CONNECTED)) {
- event = pupmenu("VerseServer %t| Disconnect %x3");
- }
- switch(event) {
- case 1:
- b_verse_connect(vserver->ip);
- vserver->flag |= VERSE_CONNECTING;
- break;
- case 2:
- break;
- case 3:
- end_verse_session(vserver->session);
- break;
- }
- }
-}
-#endif
-
-
-static int do_outliner_mouse_event(SpaceOops *soops, TreeElement *te, short event, float *mval)
-{
-
- if(mval[1]>te->ys && mval[1]<te->ys+OL_H) {
- TreeStoreElem *tselem= TREESTORE(te);
- int openclose= 0;
-
- /* open close icon, three things to check */
- if(event==RETKEY || event==PADENTER) openclose= 1; // enter opens/closes always
- else if((te->flag & TE_ICONROW)==0) { // hidden icon, no open/close
- if( mval[0]>te->xs && mval[0]<te->xs+OL_X) openclose= 1;
- }
-
- if(openclose) {
-
- /* all below close/open? */
- if( (G.qual & LR_SHIFTKEY) ) {
- tselem->flag &= ~TSE_CLOSED;
- outliner_set_flag(soops, &te->subtree, TSE_CLOSED, !outliner_has_one_flag(soops, &te->subtree, TSE_CLOSED, 1));
- }
- else {
- if(tselem->flag & TSE_CLOSED) tselem->flag &= ~TSE_CLOSED;
- else tselem->flag |= TSE_CLOSED;
-
- }
-
- return 1;
- }
- /* name and first icon */
- else if(mval[0]>te->xs && mval[0]<te->xend) {
-
- /* activate a name button? */
- if(event==LEFTMOUSE) {
-
- if (G.qual & LR_CTRLKEY) {
- if(ELEM8(tselem->type, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE, TSE_SCRIPT_BASE, TSE_POSE_BASE, TSE_R_LAYER_BASE, TSE_R_PASS))
- error("Cannot edit builtin name");
- else if(tselem->id->lib)
- error_libdata();
- else {
- tselem->flag |= TSE_TEXTBUT;
- }
- } else {
-
- if (G.qual & LR_SHIFTKEY) {
- if(tselem->id->lib && tselem->type==0) {
- notice(tselem->id->lib->name);
- }
- }
- /* always makes active object */
- tree_element_active_object(soops, te);
-
- if(tselem->type==0) { // the lib blocks
- /* editmode? */
- if(te->idcode==ID_SCE) {
- if(G.scene!=(Scene *)tselem->id) {
- if(G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR);
- set_scene((Scene *)tselem->id);
- }
- }
- else if(ELEM5(te->idcode, ID_ME, ID_CU, ID_MB, ID_LT, ID_AR)) {
- if(G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR);
- else {
- enter_editmode(EM_WAITCURSOR);
- extern_set_butspace(F9KEY, 0);
- }
- } else { // rest of types
- tree_element_active(soops, te, 1);
- }
-
- }
- else tree_element_type_active(soops, te, tselem, 1);
- }
- }
- else if(event==RIGHTMOUSE) {
-#ifdef WITH_VERSE
- if(ELEM4(te->idcode, ID_VS, ID_VN, ID_MS, ID_SS))
- verse_operation_menu(te);
- else
-#endif
- /* select object that's clicked on and popup context menu */
- if (!(tselem->flag & TSE_SELECTED)) {
-
- if ( outliner_has_one_flag(soops, &soops->tree, TSE_SELECTED, 1) )
- outliner_set_flag(soops, &soops->tree, TSE_SELECTED, 0);
-
- tselem->flag |= TSE_SELECTED;
- /* redraw, same as outliner_select function */
- soops->storeflag |= SO_TREESTORE_REDRAW;
- scrarea_do_windraw(soops->area);
- screen_swapbuffers();
- }
-
- outliner_operation_menu(soops->area);
- }
- return 1;
- }
- }
-
- for(te= te->subtree.first; te; te= te->next) {
- if(do_outliner_mouse_event(soops, te, event, mval)) return 1;
- }
- return 0;
-}
-
-/* event can enterkey, then it opens/closes */
-void outliner_mouse_event(ScrArea *sa, short event)
-{
- SpaceOops *soops= sa->spacedata.first;
- TreeElement *te;
- float fmval[2];
- short mval[2];
-
- getmouseco_areawin(mval);
- areamouseco_to_ipoco(&soops->v2d, mval, fmval, fmval+1);
-
- for(te= soops->tree.first; te; te= te->next) {
- if(do_outliner_mouse_event(soops, te, event, fmval)) break;
- }
-
- if(te) {
- BIF_undo_push("Outliner click event");
- allqueue(REDRAWOOPS, 0);
- }
- else
- outliner_select(sa);
-
-}
-/* recursive helper for function below */
-static void outliner_set_coordinates_element(SpaceOops *soops, TreeElement *te, int startx, int *starty)
-{
- TreeStoreElem *tselem= TREESTORE(te);
-
- /* store coord and continue, we need coordinates for elements outside view too */
- te->xs= startx;
- te->ys= *starty;
- *starty-= OL_H;
-
- if((tselem->flag & TSE_CLOSED)==0) {
- TreeElement *ten;
- for(ten= te->subtree.first; ten; ten= ten->next) {
- outliner_set_coordinates_element(soops, ten, startx+OL_X, starty);
- }
- }
-
-}
-
-/* to retrieve coordinates with redrawing the entire tree */
-static void outliner_set_coordinates(SpaceOops *soops)
-{
- TreeElement *te;
- int starty= soops->v2d.tot.ymax-OL_H;
- int startx= 0;
-
- for(te= soops->tree.first; te; te= te->next) {
- outliner_set_coordinates_element(soops, te, startx, &starty);
- }
-}
-
-static TreeElement *outliner_find_id(SpaceOops *soops, ListBase *lb, ID *id)
-{
- TreeElement *te, *tes;
- TreeStoreElem *tselem;
-
- for(te= lb->first; te; te= te->next) {
- tselem= TREESTORE(te);
- if(tselem->type==0) {
- if(tselem->id==id) return te;
- /* only deeper on scene or object */
- if( te->idcode==ID_OB || te->idcode==ID_SCE) {
- tes= outliner_find_id(soops, &te->subtree, id);
- if(tes) return tes;
- }
- }
- }
- return NULL;
-}
-
-void outliner_show_active(struct ScrArea *sa)
-{
- SpaceOops *so= sa->spacedata.first;
- TreeElement *te;
- int xdelta, ytop;
-
- if(OBACT == NULL) return;
-
- te= outliner_find_id(so, &so->tree, (ID *)OBACT);
- if(te) {
- /* make te->ys center of view */
- ytop= te->ys + (so->v2d.mask.ymax-so->v2d.mask.ymin)/2;
- if(ytop>0) ytop= 0;
- so->v2d.cur.ymax= ytop;
- so->v2d.cur.ymin= ytop-(so->v2d.mask.ymax-so->v2d.mask.ymin);
-
- /* make te->xs ==> te->xend center of view */
- xdelta = te->xs - so->v2d.cur.xmin;
- so->v2d.cur.xmin += xdelta;
- so->v2d.cur.xmax += xdelta;
-
- so->storeflag |= SO_TREESTORE_REDRAW;
- scrarea_queue_redraw(sa);
- }
-}
-
-void outliner_show_selected(struct ScrArea *sa)
-{
- SpaceOops *so= sa->spacedata.first;
- TreeElement *te;
- int xdelta, ytop;
-
- te= outliner_find_id(so, &so->tree, (ID *)OBACT);
- if(te) {
- /* make te->ys center of view */
- ytop= te->ys + (so->v2d.mask.ymax-so->v2d.mask.ymin)/2;
- if(ytop>0) ytop= 0;
- so->v2d.cur.ymax= ytop;
- so->v2d.cur.ymin= ytop-(so->v2d.mask.ymax-so->v2d.mask.ymin);
-
- /* make te->xs ==> te->xend center of view */
- xdelta = te->xs - so->v2d.cur.xmin;
- so->v2d.cur.xmin += xdelta;
- so->v2d.cur.xmax += xdelta;
-
- so->storeflag |= SO_TREESTORE_REDRAW;
- scrarea_queue_redraw(sa);
- }
-}
-
-
-/* find next element that has this name */
-static TreeElement *outliner_find_named(SpaceOops *soops, ListBase *lb, char *name, int flags, TreeElement *prev, int *prevFound)
-{
- TreeElement *te, *tes;
-
- for (te= lb->first; te; te= te->next) {
- int found;
-
- /* determine if match */
- if(flags==OL_FIND)
- found= BLI_strcasestr(te->name, name)!=NULL;
- else if(flags==OL_FIND_CASE)
- found= strstr(te->name, name)!=NULL;
- else if(flags==OL_FIND_COMPLETE)
- found= BLI_strcasecmp(te->name, name)==0;
- else
- found= strcmp(te->name, name)==0;
-
- if(found) {
- /* name is right, but is element the previous one? */
- if (prev) {
- if ((te != prev) && (*prevFound))
- return te;
- if (te == prev) {
- *prevFound = 1;
- }
- }
- else
- return te;
- }
-
- tes= outliner_find_named(soops, &te->subtree, name, flags, prev, prevFound);
- if(tes) return tes;
- }
-
- /* nothing valid found */
- return NULL;
-}
-
-/* tse is not in the treestore, we use its contents to find a match */
-static TreeElement *outliner_find_tse(SpaceOops *soops, TreeStoreElem *tse)
-{
- TreeStore *ts= soops->treestore;
- TreeStoreElem *tselem;
- int a;
-
- if(tse->id==NULL) return NULL;
-
- /* check if 'tse' is in treestore */
- tselem= ts->data;
- for(a=0; a<ts->usedelem; a++, tselem++) {
- if(tselem->id==tse->id) {
- if((tse->type==0 && tselem->type==0) || (tselem->type==tse->type && tselem->nr==tse->nr)) {
- break;
- }
- }
- }
- if(tselem)
- return outliner_find_tree_element(&soops->tree, a);
-
- return NULL;
-}
-
-
-/* Called to find an item based on name.
- */
-void outliner_find_panel(struct ScrArea *sa, int again, int flags)
-{
- SpaceOops *soops= sa->spacedata.first;
- TreeElement *te= NULL;
- TreeElement *last_find;
- TreeStoreElem *tselem;
- int ytop, xdelta, prevFound=0;
- char name[33];
-
- /* get last found tree-element based on stored search_tse */
- last_find= outliner_find_tse(soops, &soops->search_tse);
-
- /* determine which type of search to do */
- if (again && last_find) {
- /* no popup panel - previous + user wanted to search for next after previous */
- BLI_strncpy(name, soops->search_string, 33);
- flags= soops->search_flags;
-
- /* try to find matching element */
- te= outliner_find_named(soops, &soops->tree, name, flags, last_find, &prevFound);
- if (te==NULL) {
- /* no more matches after previous, start from beginning again */
- prevFound= 1;
- te= outliner_find_named(soops, &soops->tree, name, flags, last_find, &prevFound);
- }
- }
- else {
- /* pop up panel - no previous, or user didn't want search after previous */
- strcpy(name, "");
- if (sbutton(name, 0, sizeof(name)-1, "Find: ") && name[0]) {
- te= outliner_find_named(soops, &soops->tree, name, flags, NULL, &prevFound);
- }
- else return; /* XXX RETURN! XXX */
- }
-
- /* do selection and reveil */
- if (te) {
- tselem= TREESTORE(te);
- if (tselem) {
- /* expand branches so that it will be visible, we need to get correct coordinates */
- if( outliner_open_back(soops, te))
- outliner_set_coordinates(soops);
-
- /* deselect all visible, and select found element */
- outliner_set_flag(soops, &soops->tree, TSE_SELECTED, 0);
- tselem->flag |= TSE_SELECTED;
-
- /* make te->ys center of view */
- ytop= te->ys + (soops->v2d.mask.ymax-soops->v2d.mask.ymin)/2;
- if(ytop>0) ytop= 0;
- soops->v2d.cur.ymax= ytop;
- soops->v2d.cur.ymin= ytop-(soops->v2d.mask.ymax-soops->v2d.mask.ymin);
-
- /* make te->xs ==> te->xend center of view */
- xdelta = te->xs - soops->v2d.cur.xmin;
- soops->v2d.cur.xmin += xdelta;
- soops->v2d.cur.xmax += xdelta;
-
- /* store selection */
- soops->search_tse= *tselem;
-
- BLI_strncpy(soops->search_string, name, 33);
- soops->search_flags= flags;
-
- /* redraw */
- soops->storeflag |= SO_TREESTORE_REDRAW;
- scrarea_queue_redraw(sa);
- }
- }
- else {
- /* no tree-element found */
- error("Not found: %s", name);
- }
-}
-
-static int subtree_has_objects(SpaceOops *soops, ListBase *lb)
-{
- TreeElement *te;
- TreeStoreElem *tselem;
-
- for(te= lb->first; te; te= te->next) {
- tselem= TREESTORE(te);
- if(tselem->type==0 && te->idcode==ID_OB) return 1;
- if( subtree_has_objects(soops, &te->subtree)) return 1;
- }
- return 0;
-}
-
-static void tree_element_show_hierarchy(SpaceOops *soops, ListBase *lb)
-{
- TreeElement *te;
- TreeStoreElem *tselem;
-
- /* open all object elems, close others */
- for(te= lb->first; te; te= te->next) {
- tselem= TREESTORE(te);
-
- if(tselem->type==0) {
- if(te->idcode==ID_SCE) {
- if(tselem->id!=(ID *)G.scene) tselem->flag |= TSE_CLOSED;
- else tselem->flag &= ~TSE_CLOSED;
- }
- else if(te->idcode==ID_OB) {
- if(subtree_has_objects(soops, &te->subtree)) tselem->flag &= ~TSE_CLOSED;
- else tselem->flag |= TSE_CLOSED;
- }
- }
- else tselem->flag |= TSE_CLOSED;
-
- if(tselem->flag & TSE_CLOSED); else tree_element_show_hierarchy(soops, &te->subtree);
- }
-
-}
-
-/* show entire object level hierarchy */
-void outliner_show_hierarchy(struct ScrArea *sa)
-{
- SpaceOops *so= sa->spacedata.first;
-
- tree_element_show_hierarchy(so, &so->tree);
- scrarea_queue_redraw(sa);
-
- BIF_undo_push("Outliner show hierarchy");
-}
-
-static void do_outliner_select(SpaceOops *soops, ListBase *lb, float y1, float y2, short *selecting)
-{
- TreeElement *te;
- TreeStoreElem *tselem;
-
- if(y1>y2) SWAP(float, y1, y2);
-
- for(te= lb->first; te; te= te->next) {
- tselem= TREESTORE(te);
-
- if(te->ys + OL_H < y1) return;
- if(te->ys < y2) {
- if((te->flag & TE_ICONROW)==0) {
- if(*selecting == -1) {
- if( tselem->flag & TSE_SELECTED) *selecting= 0;
- else *selecting= 1;
- }
- if(*selecting) tselem->flag |= TSE_SELECTED;
- else tselem->flag &= ~TSE_SELECTED;
- }
- }
- if((tselem->flag & TSE_CLOSED)==0) do_outliner_select(soops, &te->subtree, y1, y2, selecting);
- }
-}
-
-/* its own redraw loop... urm */
-void outliner_select(struct ScrArea *sa )
-{
- SpaceOops *so= sa->spacedata.first;
- float fmval[2], y1, y2;
- short mval[2], yo=-1, selecting= -1;
-
- getmouseco_areawin(mval);
- areamouseco_to_ipoco(&so->v2d, mval, fmval, fmval+1);
- y1= fmval[1];
-
- while (get_mbut() & (L_MOUSE|R_MOUSE)) {
- getmouseco_areawin(mval);
- areamouseco_to_ipoco(&so->v2d, mval, fmval, fmval+1);
- y2= fmval[1];
-
- if(yo!=mval[1]) {
- /* select the 'ouliner row' */
- do_outliner_select(so, &so->tree, y1, y2, &selecting);
- yo= mval[1];
-
- so->storeflag |= SO_TREESTORE_REDRAW;
- scrarea_do_windraw(sa);
- screen_swapbuffers();
-
- y1= y2;
- }
- else PIL_sleep_ms(30);
- }
-
- BIF_undo_push("Outliner selection");
-
-}
-
-/* ************ SELECTION OPERATIONS ********* */
-
-static int scenelevel=0, objectlevel=0, idlevel=0, datalevel=0; // globals, euh... you can do better
-
-static void set_operation_types(SpaceOops *soops, ListBase *lb)
-{
- TreeElement *te;
- TreeStoreElem *tselem;
-
- for(te= lb->first; te; te= te->next) {
- tselem= TREESTORE(te);
- if(tselem->flag & TSE_SELECTED) {
- if(tselem->type) {
-#ifdef WITH_VERSE
- if(te->idcode==ID_VS) datalevel= TSE_VERSE_SESSION;
- else if(te->idcode==ID_VN) datalevel= TSE_VERSE_OBJ_NODE;
- else if(datalevel==0) datalevel= tselem->type;
-#else
- if(datalevel==0) datalevel= tselem->type;
-#endif
- else if(datalevel!=tselem->type) datalevel= -1;
- }
- else {
- int idcode= GS(tselem->id->name);
- switch(idcode) {
- case ID_SCE:
- scenelevel= 1;
- break;
- case ID_OB:
- objectlevel= 1;
- break;
-
- case ID_ME: case ID_CU: case ID_MB: case ID_LT:
- case ID_LA: case ID_AR: case ID_CA:
- case ID_MA: case ID_TE: case ID_IP: case ID_IM:
- case ID_SO: case ID_KE: case ID_WO: case ID_AC:
- case ID_NLA: case ID_TXT: case ID_GR:
- if(idlevel==0) idlevel= idcode;
- else if(idlevel!=idcode) idlevel= -1;
- break;
- }
- }
- }
- if((tselem->flag & TSE_CLOSED)==0) set_operation_types(soops, &te->subtree);
- }
-}
-
-static void unlink_material_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
-{
- Material **matar=NULL;
- int a, totcol=0;
-
- if( GS(tsep->id->name)==ID_OB) {
- Object *ob= (Object *)tsep->id;
- totcol= ob->totcol;
- matar= ob->mat;
- }
- else if( GS(tsep->id->name)==ID_ME) {
- Mesh *me= (Mesh *)tsep->id;
- totcol= me->totcol;
- matar= me->mat;
- }
- else if( GS(tsep->id->name)==ID_CU) {
- Curve *cu= (Curve *)tsep->id;
- totcol= cu->totcol;
- matar= cu->mat;
- }
- else if( GS(tsep->id->name)==ID_MB) {
- MetaBall *mb= (MetaBall *)tsep->id;
- totcol= mb->totcol;
- matar= mb->mat;
- }
-
- for(a=0; a<totcol; a++) {
- if(a==te->index && matar[a]) {
- matar[a]->id.us--;
- matar[a]= NULL;
- }
- }
-}
-
-static void unlink_texture_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
-{
- MTex **mtex= NULL;
- int a;
-
- if( GS(tsep->id->name)==ID_MA) {
- Material *ma= (Material *)tsep->id;
- mtex= ma->mtex;
- }
- else if( GS(tsep->id->name)==ID_LA) {
- Lamp *la= (Lamp *)tsep->id;
- mtex= la->mtex;
- }
- else if( GS(tsep->id->name)==ID_WO) {
- World *wrld= (World *)tsep->id;
- mtex= wrld->mtex;
- }
- else return;
-
- for(a=0; a<MAX_MTEX; a++) {
- if(a==te->index && mtex[a]) {
- if(mtex[a]->tex) {
- mtex[a]->tex->id.us--;
- mtex[a]->tex= NULL;
- }
- }
- }
-}
-
-static void unlink_group_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
-{
- Group *group= (Group *)tselem->id;
-
- if(tsep) {
- if( GS(tsep->id->name)==ID_OB) {
- Object *ob= (Object *)tsep->id;
- ob->dup_group= NULL;
- group->id.us--;
- }
- }
- else {
- unlink_group(group);
- }
-}
-
-static void outliner_do_libdata_operation(SpaceOops *soops, ListBase *lb,
- void (*operation_cb)(TreeElement *, TreeStoreElem *, TreeStoreElem *))
-{
- TreeElement *te;
- TreeStoreElem *tselem;
-
- for(te=lb->first; te; te= te->next) {
- tselem= TREESTORE(te);
- if(tselem->flag & TSE_SELECTED) {
- if(tselem->type==0) {
- TreeStoreElem *tsep= TREESTORE(te->parent);
- operation_cb(te, tsep, tselem);
- }
- }
- if((tselem->flag & TSE_CLOSED)==0) {
- outliner_do_libdata_operation(soops, &te->subtree, operation_cb);
- }
- }
-}
-
-/* */
-
-static void object_select_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
-{
- Base *base= (Base *)te->directdata;
-
- if(base==NULL) base= object_in_scene((Object *)tselem->id, G.scene);
- if(base && ((base->object->restrictflag & OB_RESTRICT_VIEW)==0)) {
- base->flag |= SELECT;
- base->object->flag |= SELECT;
- }
-}
-
-static void object_deselect_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
-{
- Base *base= (Base *)te->directdata;
-
- if(base==NULL) base= object_in_scene((Object *)tselem->id, G.scene);
- if(base) {
- base->flag &= ~SELECT;
- base->object->flag &= ~SELECT;
- }
-}
-
-static void object_delete_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
-{
- Base *base= (Base *)te->directdata;
-
- if(base==NULL) base= object_in_scene((Object *)tselem->id, G.scene);
- if(base) {
- // check also library later
- if(G.obedit==base->object) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR);
-
- if(base==BASACT) {
- G.f &= ~(G_VERTEXPAINT+G_TEXTUREPAINT+G_WEIGHTPAINT);
- setcursor_space(SPACE_VIEW3D, CURSOR_STD);
- }
-
- free_and_unlink_base(base);
- te->directdata= NULL;
- tselem->id= NULL;
- }
-}
-
-static void id_local_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
-{
- if(tselem->id->lib && (tselem->id->flag & LIB_EXTERN)) {
- tselem->id->lib= NULL;
- tselem->id->flag= LIB_LOCAL;
- new_id(0, tselem->id, 0);
- }
-}
-
-static void outliner_do_object_operation(SpaceOops *soops, ListBase *lb,
- void (*operation_cb)(TreeElement *, TreeStoreElem *, TreeStoreElem *))
-{
- TreeElement *te;
- TreeStoreElem *tselem;
-
- for(te=lb->first; te; te= te->next) {
- tselem= TREESTORE(te);
- if(tselem->flag & TSE_SELECTED) {
- if(tselem->type==0 && te->idcode==ID_OB) {
- // when objects selected in other scenes... dunno if that should be allowed
- Scene *sce= (Scene *)outliner_search_back(soops, te, ID_SCE);
- if(sce && G.scene != sce) set_scene(sce);
-
- operation_cb(te, NULL, tselem);
- }
- }
- if((tselem->flag & TSE_CLOSED)==0) {
- outliner_do_object_operation(soops, &te->subtree, operation_cb);
- }
- }
-}
-
-static void pchan_cb(int event, TreeElement *te, TreeStoreElem *tselem)
-{
- bPoseChannel *pchan= (bPoseChannel *)te->directdata;
-
- if(event==1)
- pchan->bone->flag |= BONE_SELECTED;
- else if(event==2)
- pchan->bone->flag &= ~BONE_SELECTED;
- else if(event==3) {
- pchan->bone->flag |= BONE_HIDDEN_P;
- pchan->bone->flag &= ~BONE_SELECTED;
- }
- else if(event==4)
- pchan->bone->flag &= ~BONE_HIDDEN_P;
-}
-
-static void bone_cb(int event, TreeElement *te, TreeStoreElem *tselem)
-{
- Bone *bone= (Bone *)te->directdata;
-
- if(event==1)
- bone->flag |= BONE_SELECTED;
- else if(event==2)
- bone->flag &= ~BONE_SELECTED;
- else if(event==3) {
- bone->flag |= BONE_HIDDEN_P;
- bone->flag &= ~BONE_SELECTED;
- }
- else if(event==4)
- bone->flag &= ~BONE_HIDDEN_P;
-}
-
-static void ebone_cb(int event, TreeElement *te, TreeStoreElem *tselem)
-{
- EditBone *ebone= (EditBone *)te->directdata;
-
- if(event==1)
- ebone->flag |= BONE_SELECTED;
- else if(event==2)
- ebone->flag &= ~BONE_SELECTED;
- else if(event==3) {
- ebone->flag |= BONE_HIDDEN_A;
- ebone->flag &= ~BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL;
- }
- else if(event==4)
- ebone->flag &= ~BONE_HIDDEN_A;
-}
-
-#ifdef WITH_VERSE
-static void vsession_cb(int event, TreeElement *te, TreeStoreElem *tselem)
-{
-/* struct VerseSession *vsession =(VerseSession*)te->directdata;*/
-
- if(event==1) {
- printf("\tending verse session\n");
- }
-}
-#endif
-
-static void outliner_do_data_operation(SpaceOops *soops, int type, int event, ListBase *lb,
- void (*operation_cb)(int, TreeElement *, TreeStoreElem *))
-{
- TreeElement *te;
- TreeStoreElem *tselem;
-
- for(te=lb->first; te; te= te->next) {
- tselem= TREESTORE(te);
- if(tselem->flag & TSE_SELECTED) {
- if(tselem->type==type) {
- operation_cb(event, te, tselem);
- }
- }
- if((tselem->flag & TSE_CLOSED)==0) {
- outliner_do_data_operation(soops, type, event, &te->subtree, operation_cb);
- }
- }
-}
-
-void outliner_del(ScrArea *sa)
-{
- SpaceOops *soops= sa->spacedata.first;
- outliner_do_object_operation(soops, &soops->tree, object_delete_cb);
- DAG_scene_sort(G.scene);
- countall();
- BIF_undo_push("Delete Objects");
- allqueue(REDRAWALL, 0);
-}
-
-
-void outliner_operation_menu(ScrArea *sa)
-{
- SpaceOops *soops= sa->spacedata.first;
-
- // bad globals
- scenelevel= objectlevel= idlevel= datalevel=0;
-
- set_operation_types(soops, &soops->tree);
-
- if(scenelevel) {
- if(objectlevel || datalevel || idlevel) error("Mixed selection");
- //else pupmenu("Scene Operations%t|Delete");
- }
- else if(objectlevel) {
- short event= pupmenu("Select%x1|Deselect%x2|Delete%x4"); /* make local: does not work... it doesn't set lib_extern flags... so data gets lost */
- if(event>0) {
- char *str="";
-
- if(event==1) {
- Scene *sce= G.scene; // to be able to delete, scenes are set...
- outliner_do_object_operation(soops, &soops->tree, object_select_cb);
- if(G.scene != sce) set_scene(sce);
-
- str= "Select Objects";
- }
- else if(event==2) {
- outliner_do_object_operation(soops, &soops->tree, object_deselect_cb);
- str= "Deselect Objects";
- }
- else if(event==4) {
- outliner_do_object_operation(soops, &soops->tree, object_delete_cb);
- DAG_scene_sort(G.scene);
- str= "Delete Objects";
- }
- else if(event==5) { /* disabled, see above (ton) */
- outliner_do_object_operation(soops, &soops->tree, id_local_cb);
- str= "Localized Objects";
- }
-
- countall();
-
- BIF_undo_push(str);
- allqueue(REDRAWALL, 0);
- }
- }
- else if(idlevel) {
- if(idlevel==-1 || datalevel) error("Mixed selection");
- else {
- short event= pupmenu("Unlink %x1|Make Local %x2");
-
- if(event==1) {
- switch(idlevel) {
- case ID_MA:
- outliner_do_libdata_operation(soops, &soops->tree, unlink_material_cb);
- BIF_undo_push("Unlink material");
- allqueue(REDRAWBUTSSHADING, 1);
- break;
- case ID_TE:
- outliner_do_libdata_operation(soops, &soops->tree, unlink_texture_cb);
- allqueue(REDRAWBUTSSHADING, 1);
- BIF_undo_push("Unlink texture");
- break;
- case ID_GR:
- outliner_do_libdata_operation(soops, &soops->tree, unlink_group_cb);
- BIF_undo_push("Unlink group");
- break;
- default:
- error("Not yet...");
- }
- allqueue(REDRAWALL, 0);
- }
- else if(event==2) {
- outliner_do_libdata_operation(soops, &soops->tree, id_local_cb);
- BIF_undo_push("Localized Data");
- allqueue(REDRAWALL, 0);
- }
- }
- }
- else if(datalevel) {
- if(datalevel==-1) error("Mixed selection");
- else {
- if(datalevel==TSE_POSE_CHANNEL) {
- short event= pupmenu("PoseChannel Operations%t|Select%x1|Deselect%x2|Hide%x3|Unhide%x4");
- if(event>0) {
- outliner_do_data_operation(soops, datalevel, event, &soops->tree, pchan_cb);
- BIF_undo_push("PoseChannel operation");
- }
- }
- else if(datalevel==TSE_BONE) {
- short event= pupmenu("Bone Operations%t|Select%x1|Deselect%x2|Hide%x3|Unhide%x4");
- if(event>0) {
- outliner_do_data_operation(soops, datalevel, event, &soops->tree, bone_cb);
- BIF_undo_push("Bone operation");
- }
- }
- else if(datalevel==TSE_EBONE) {
- short event= pupmenu("EditBone Operations%t|Select%x1|Deselect%x2|Hide%x3|Unhide%x4");
- if(event>0) {
- outliner_do_data_operation(soops, datalevel, event, &soops->tree, ebone_cb);
- BIF_undo_push("EditBone operation");
- }
- }
-#ifdef WITH_VERSE
- else if(datalevel==TSE_VERSE_SESSION) {
- short event= pupmenu("VerseSession %t| End %x1");
- if(event>0) {
- outliner_do_data_operation(soops, datalevel, event, &soops->tree, vsession_cb);
- }
- }
-#endif
-
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWBUTSALL, 0);
- allqueue(REDRAWVIEW3D, 0);
- }
- }
-}
-
-
-/* ***************** DRAW *************** */
-
-static void tselem_draw_icon(float x, float y, TreeStoreElem *tselem, TreeElement *te)
-{
- if(tselem->type) {
- switch( tselem->type) {
- case TSE_NLA:
- BIF_icon_draw(x, y, ICON_NLA); break;
- case TSE_NLA_ACTION:
- BIF_icon_draw(x, y, ICON_ACTION); break;
- case TSE_DEFGROUP_BASE:
- BIF_icon_draw(x, y, ICON_VERTEXSEL); break;
- case TSE_BONE:
- case TSE_EBONE:
- BIF_icon_draw(x, y, ICON_WPAINT_DEHLT); break;
- case TSE_CONSTRAINT_BASE:
- BIF_icon_draw(x, y, ICON_CONSTRAINT); break;
- case TSE_MODIFIER_BASE:
- BIF_icon_draw(x, y, ICON_MODIFIER); break;
- case TSE_LINKED_OB:
- BIF_icon_draw(x, y, ICON_OBJECT); break;
- case TSE_MODIFIER:
- {
- Object *ob= (Object *)tselem->id;
- ModifierData *md= BLI_findlink(&ob->modifiers, tselem->nr);
- switch(md->type) {
- case eModifierType_Subsurf:
- BIF_icon_draw(x, y, ICON_MOD_SUBSURF); break;
- case eModifierType_Armature:
- BIF_icon_draw(x, y, ICON_ARMATURE); break;
- case eModifierType_Lattice:
- BIF_icon_draw(x, y, ICON_LATTICE); break;
- case eModifierType_Curve:
- BIF_icon_draw(x, y, ICON_CURVE); break;
- case eModifierType_Build:
- BIF_icon_draw(x, y, ICON_MOD_BUILD); break;
- case eModifierType_Mirror:
- BIF_icon_draw(x, y, ICON_MOD_MIRROR); break;
- case eModifierType_Decimate:
- BIF_icon_draw(x, y, ICON_MOD_DECIM); break;
- case eModifierType_Wave:
- BIF_icon_draw(x, y, ICON_MOD_WAVE); break;
- case eModifierType_Hook:
- BIF_icon_draw(x, y, ICON_HOOK); break;
- case eModifierType_Softbody:
- BIF_icon_draw(x, y, ICON_MOD_SOFT); break;
- case eModifierType_Boolean:
- BIF_icon_draw(x, y, ICON_MOD_BOOLEAN); break;
- default:
- BIF_icon_draw(x, y, ICON_DOT); break;
- }
- break;
- }
- case TSE_SCRIPT_BASE:
- BIF_icon_draw(x, y, ICON_TEXT); break;
- case TSE_POSE_BASE:
- BIF_icon_draw(x, y, ICON_ARMATURE_DEHLT); break;
- case TSE_POSE_CHANNEL:
- BIF_icon_draw(x, y, ICON_WPAINT_DEHLT); break;
- case TSE_PROXY:
- BIF_icon_draw(x, y, ICON_GHOST); break;
- case TSE_R_LAYER_BASE:
- BIF_icon_draw(x, y, ICON_RESTRICT_RENDER_OFF); break;
- case TSE_R_LAYER:
- BIF_icon_draw(x, y, ICON_IMAGE_DEHLT); break;
- case TSE_LINKED_LAMP:
- BIF_icon_draw(x, y, ICON_LAMP_DEHLT); break;
- case TSE_LINKED_MAT:
- BIF_icon_draw(x, y, ICON_MATERIAL_DEHLT); break;
-
-#ifdef WITH_VERSE
- case ID_VS:
- case ID_MS:
- case ID_SS:
- BIF_icon_draw(x, y, ICON_VERSE); break;
- case ID_VN:
- BIF_icon_draw(x, y, ICON_VERSE); break;
-#endif
- default:
- BIF_icon_draw(x, y, ICON_DOT); break;
- }
- }
- else {
- switch( GS(tselem->id->name)) {
- case ID_SCE:
- BIF_icon_draw(x, y, ICON_SCENE_DEHLT); break;
- case ID_OB:
- BIF_icon_draw(x, y, ICON_OBJECT); break;
- case ID_ME:
- BIF_icon_draw(x, y, ICON_MESH); break;
- case ID_CU:
- BIF_icon_draw(x, y, ICON_CURVE); break;
- case ID_MB:
- BIF_icon_draw(x, y, ICON_MBALL); break;
- case ID_LT:
- BIF_icon_draw(x, y, ICON_LATTICE); break;
- case ID_LA:
- BIF_icon_draw(x, y, ICON_LAMP_DEHLT); break;
- case ID_MA:
- BIF_icon_draw(x, y, ICON_MATERIAL_DEHLT); break;
- case ID_TE:
- BIF_icon_draw(x, y, ICON_TEXTURE_DEHLT); break;
- case ID_IP:
- BIF_icon_draw(x, y, ICON_IPO_DEHLT); break;
- case ID_IM:
- BIF_icon_draw(x, y, ICON_IMAGE_DEHLT); break;
- case ID_SO:
- BIF_icon_draw(x, y, ICON_SPEAKER); break;
- case ID_AR:
- BIF_icon_draw(x, y, ICON_ARMATURE); break;
- case ID_CA:
- BIF_icon_draw(x, y, ICON_CAMERA_DEHLT); break;
- case ID_KE:
- BIF_icon_draw(x, y, ICON_EDIT_DEHLT); break;
- case ID_WO:
- BIF_icon_draw(x, y, ICON_WORLD_DEHLT); break;
- case ID_AC:
- BIF_icon_draw(x, y, ICON_ACTION); break;
- case ID_NLA:
- BIF_icon_draw(x, y, ICON_NLA); break;
- case ID_TXT:
- BIF_icon_draw(x, y, ICON_SCRIPT); break;
- case ID_GR:
- BIF_icon_draw(x, y, ICON_CIRCLE_DEHLT); break;
- case ID_LI:
- BIF_icon_draw(x, y, ICON_LIBRARY_DEHLT); break;
- }
- }
-}
-
-static void outliner_draw_iconrow(SpaceOops *soops, ListBase *lb, int level, int *offsx, int ys)
-{
- TreeElement *te;
- TreeStoreElem *tselem;
- int active;
-
- for(te= lb->first; te; te= te->next) {
- tselem= TREESTORE(te);
-
- /* object hierarchy always, further constrained on level */
- if(level<1 || (tselem->type==0 && te->idcode==ID_OB)) {
-
- /* active blocks get white circle */
- active= 0;
- if(tselem->type==0) {
- if(te->idcode==ID_OB) active= (OBACT==(Object *)tselem->id);
- else if(G.obedit && G.obedit->data==tselem->id) active= 1;
- else active= tree_element_active(soops, te, 0);
- }
- else active= tree_element_type_active(soops, te, tselem, 0);
-
- if(active) {
- uiSetRoundBox(15);
- glColor4ub(255, 255, 255, 100);
- uiRoundBox( (float)*offsx-0.5, (float)ys-1.0, (float)*offsx+OL_H-3.0, (float)ys+OL_H-3.0, OL_H/2.0-2.0);
- glEnable(GL_BLEND);
- }
-
- tselem_draw_icon(*offsx, ys, tselem, te);
- te->xs= *offsx;
- te->ys= ys;
- te->xend= *offsx+OL_X;
- te->flag |= TE_ICONROW; // for click
-
- (*offsx) += OL_X;
- }
-
- /* this tree element always has same amount of branches, so dont draw */
- if(tselem->type!=TSE_R_LAYER)
- outliner_draw_iconrow(soops, &te->subtree, level+1, offsx, ys);
- }
-
-}
-
-static void outliner_draw_tree_element(SpaceOops *soops, TreeElement *te, int startx, int *starty)
-{
- TreeElement *ten;
- TreeStoreElem *tselem;
- int offsx= 0, active=0; // active=1 active obj, else active data
-
- tselem= TREESTORE(te);
-
- if(*starty >= soops->v2d.cur.ymin && *starty<= soops->v2d.cur.ymax) {
-
- glEnable(GL_BLEND);
-
- /* colors for active/selected data */
- if(tselem->type==0) {
- if(te->idcode==ID_SCE) {
- if(tselem->id == (ID *)G.scene) {
- glColor4ub(255, 255, 255, 100);
- active= 2;
- }
- }
- else if(te->idcode==ID_OB) {
- Object *ob= (Object *)tselem->id;
-
- if(ob==OBACT || (ob->flag & SELECT)) {
- char col[4];
-
- active= 2;
- if(ob==OBACT) {
- BIF_GetThemeColorType4ubv(TH_ACTIVE, SPACE_VIEW3D, col);
- /* so black text is drawn when active and not selected */
- if (ob->flag & SELECT) active= 1;
- }
- else BIF_GetThemeColorType4ubv(TH_SELECT, SPACE_VIEW3D, col);
- col[3]= 100;
- glColor4ubv((GLubyte *)col);
- }
-
-#ifdef WITH_VERSE
- if(ob->vnode) {
- if (active==0) active=2;
- if (ob==OBACT)
- glColor4ub(0,255,0,100);
- else
- glColor4ub(0,128,0,100);
- }
-#endif
- }
- else if(G.obedit && G.obedit->data==tselem->id) {
- glColor4ub(255, 255, 255, 100);
- active= 2;
- }
- else {
- if(tree_element_active(soops, te, 0)) {
- glColor4ub(220, 220, 255, 100);
- active= 2;
- }
- }
- } else if (tselem->type==ID_SS) {
-#ifdef WITH_VERSE
- /* draw colored circle behind verse server icon */
- struct VerseServer *server = (VerseServer *)te->directdata;
- if(server->flag & VERSE_CONNECTING) {
- glColor4ub(255,128,64,100);
- active = 2;
- } else if(server->flag & VERSE_CONNECTED) {
- glColor4ub(0,128,0,100);
- active = 2;
- }
-#endif
- }
- else if (tselem->type==ID_VN) {
-#ifdef WITH_VERSE
- struct VNode *vnode = (VNode *)te->directdata;
- if(vnode->type==V_NT_OBJECT) {
- if(((VObjectData*)vnode->data)->object) {
- glColor4ub(0,128,0,100);
- active = 2;
- }
- }
- else if(vnode->type==V_NT_GEOMETRY) {
- if(((VGeomData*)vnode->data)->mesh || ((VGeomData*)vnode->data)->editmesh) {
- glColor4ub(0,128,0,100);
- active = 2;
- }
- }
- if(vnode->type==V_NT_BITMAP) {
- if(((VBitmapData*)vnode->data)->image) {
- glColor4ub(0,128,0,100);
- active = 2;
- }
- }
-#endif
- }
- else {
- if( tree_element_type_active(soops, te, tselem, 0) ) active= 2;
- glColor4ub(220, 220, 255, 100);
- }
-
- /* active circle */
- if(active) {
- uiSetRoundBox(15);
- uiRoundBox( (float)startx+OL_H-1.5, (float)*starty+2.0, (float)startx+2*OL_H-4.0, (float)*starty+OL_H-1.0, OL_H/2.0-2.0);
- glEnable(GL_BLEND); /* roundbox disables it */
-
- te->flag |= TE_ACTIVE; // for lookup in display hierarchies
- }
-
- /* open/close icon, only when sublevels, except for scene */
- if(te->subtree.first || (te->idcode==ID_SCE && tselem->type==0)) {
- int icon_x;
- if((tselem->type==0 && ELEM(te->idcode, ID_OB, ID_SCE)) || ELEM4(te->idcode,ID_VN,ID_VS, ID_MS, ID_SS))
- icon_x = startx;
- else
- icon_x = startx+5;
-
- // icons a bit higher
- if(tselem->flag & TSE_CLOSED)
- BIF_icon_draw(icon_x, *starty+2, ICON_TRIA_RIGHT);
- else
- BIF_icon_draw(icon_x, *starty+2, ICON_TRIA_DOWN);
- }
- offsx+= OL_X;
-
- /* datatype icon */
-
- // icons a bit higher
- tselem_draw_icon(startx+offsx, *starty+2, tselem, te);
- offsx+= OL_X;
-
- if(tselem->id->lib && tselem->type==0) {
- glPixelTransferf(GL_ALPHA_SCALE, 0.5);
- if(tselem->id->flag & LIB_INDIRECT)
- BIF_icon_draw(startx+offsx, *starty+2, ICON_DATALIB);
- else
- BIF_icon_draw(startx+offsx, *starty+2, ICON_PARLIB);
- glPixelTransferf(GL_ALPHA_SCALE, 1.0);
- offsx+= OL_X;
- }
- glDisable(GL_BLEND);
-
- /* name */
- if(active==1) BIF_ThemeColor(TH_TEXT_HI);
- else BIF_ThemeColor(TH_TEXT);
- glRasterPos2i(startx+offsx, *starty+5);
- BIF_RasterPos(startx+offsx, *starty+5);
-#ifdef WITH_VERSE
- if(te->name) {
-#endif
- BIF_DrawString(G.font, te->name, 0);
- offsx+= OL_X + BIF_GetStringWidth(G.font, te->name, 0);
-#ifdef WITH_VERSE
- }
-#endif
-
- /* closed item, we draw the icons, not when it's a scene, or master-server list though */
- if(tselem->flag & TSE_CLOSED) {
- if(te->subtree.first) {
- if(tselem->type==0 && te->idcode==ID_SCE);
-#ifdef WITH_VERSE
- else if(tselem->type==ID_MS) {
- char server_buf[50];
- int nr_servers = 0;
- struct VerseServer *server = server_list.first;
- while (server) {
- nr_servers++;
- server = server->next;
- }
- sprintf(server_buf, "(%d server%s", nr_servers, nr_servers==1?")":"s)");
- glRasterPos2i(startx+offsx-10, *starty+5);
- BIF_RasterPos(startx+offsx-10, *starty+5);
- BIF_DrawString(G.font, server_buf, 0);
- offsx+= OL_X + BIF_GetStringWidth(G.font, server_buf, 0);
- }
-#endif
- else if(tselem->type!=TSE_R_LAYER) { /* this tree element always has same amount of branches, so dont draw */
- int tempx= startx+offsx;
- // divider
- BIF_ThemeColorShade(TH_BACK, -40);
- glRecti(tempx -10, *starty+4, tempx -8, *starty+OL_H-4);
-
- glEnable(GL_BLEND);
- glPixelTransferf(GL_ALPHA_SCALE, 0.5);
-
- outliner_draw_iconrow(soops, &te->subtree, 0, &tempx, *starty+2);
-
- glPixelTransferf(GL_ALPHA_SCALE, 1.0);
- glDisable(GL_BLEND);
- }
- }
- }
- }
- /* store coord and continue, we need coordinates for elements outside view too */
- te->xs= startx;
- te->ys= *starty;
- te->xend= startx+offsx;
-
- *starty-= OL_H;
-
- if((tselem->flag & TSE_CLOSED)==0) {
- for(ten= te->subtree.first; ten; ten= ten->next) {
- outliner_draw_tree_element(soops, ten, startx+OL_X, starty);
- }
- }
-}
-
-static void outliner_draw_hierarchy(SpaceOops *soops, ListBase *lb, int startx, int *starty)
-{
- TreeElement *te;
- TreeStoreElem *tselem;
- int y1, y2;
-
- if(lb->first==NULL) return;
-
- y1=y2= *starty; /* for vertical lines between objects */
- for(te=lb->first; te; te= te->next) {
- y2= *starty;
- tselem= TREESTORE(te);
-
- /* horizontal line? */
- if((tselem->type==0 && (te->idcode==ID_OB || te->idcode==ID_SCE)) || ELEM4(te->idcode,ID_VS,ID_VN,ID_MS,ID_SS))
- glRecti(startx, *starty, startx+OL_X, *starty-1);
-
- *starty-= OL_H;
-
- if((tselem->flag & TSE_CLOSED)==0)
- outliner_draw_hierarchy(soops, &te->subtree, startx+OL_X, starty);
- }
-
- /* vertical line */
- te= lb->last;
- if(te->parent || lb->first!=lb->last) {
- tselem= TREESTORE(te);
- if((tselem->type==0 && te->idcode==ID_OB) || ELEM4(te->idcode,ID_VS,ID_VN,ID_MS,ID_SS)) {
-
- glRecti(startx, y1+OL_H, startx+1, y2);
- }
- }
-}
-
-static void outliner_draw_selection(SpaceOops *soops, ListBase *lb, int *starty)
-{
- TreeElement *te;
- TreeStoreElem *tselem;
-
- for(te= lb->first; te; te= te->next) {
- tselem= TREESTORE(te);
-
- /* selection status */
- if(tselem->flag & TSE_SELECTED) {
- glRecti(0, *starty+1, (int)soops->v2d.cur.xmax, *starty+OL_H-1);
- }
- *starty-= OL_H;
- if((tselem->flag & TSE_CLOSED)==0) outliner_draw_selection(soops, &te->subtree, starty);
- }
-}
-
-
-static void outliner_draw_tree(SpaceOops *soops)
-{
- TreeElement *te;
- int starty, startx;
- float col[4];
-
-#ifdef INTERNATIONAL
- FTF_SetFontSize('l');
- BIF_SetScale(1.0);
-#endif
-
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // only once
-
- // selection first
- BIF_GetThemeColor3fv(TH_BACK, col);
- glColor3f(col[0]+0.06f, col[1]+0.08f, col[2]+0.10f);
- starty= soops->v2d.tot.ymax-OL_H;
- outliner_draw_selection(soops, &soops->tree, &starty);
-
- // grey hierarchy lines
- BIF_ThemeColorBlend(TH_BACK, TH_TEXT, 0.2);
- starty= soops->v2d.tot.ymax-OL_H/2;
- startx= 6;
- outliner_draw_hierarchy(soops, &soops->tree, startx, &starty);
-
- // items themselves
- starty= soops->v2d.tot.ymax-OL_H;
- startx= 0;
- for(te= soops->tree.first; te; te= te->next) {
- outliner_draw_tree_element(soops, te, startx, &starty);
- }
-}
-
-
-static void outliner_back(SpaceOops *soops)
-{
- int ystart;
-
- BIF_ThemeColorShade(TH_BACK, 6);
- ystart= soops->v2d.tot.ymax;
- ystart= OL_H*(ystart/(OL_H));
-
- while(ystart > soops->v2d.cur.ymin) {
- glRecti(0, ystart, (int)soops->v2d.cur.xmax, ystart+OL_H);
- ystart-= 2*OL_H;
- }
-}
-
-static void outliner_draw_restrictcols(SpaceOops *soops)
-{
- int ystart;
-
- /* background underneath */
- BIF_ThemeColor(TH_BACK);
- glRecti((int)soops->v2d.cur.xmax-OL_TOGW, soops->v2d.cur.ymin, (int)soops->v2d.cur.xmax, soops->v2d.cur.ymax);
-
- BIF_ThemeColorShade(TH_BACK, 6);
- ystart= soops->v2d.tot.ymax;
- ystart= OL_H*(ystart/(OL_H));
-
- while(ystart > soops->v2d.cur.ymin) {
- glRecti((int)soops->v2d.cur.xmax-OL_TOGW, ystart, (int)soops->v2d.cur.xmax, ystart+OL_H);
- ystart-= 2*OL_H;
- }
-
- BIF_ThemeColorShadeAlpha(TH_BACK, -15, -200);
-
- /* view */
- fdrawline(soops->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX,
- soops->v2d.cur.ymax,
- soops->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX,
- soops->v2d.cur.ymin);
-
- /* render */
- fdrawline(soops->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX,
- soops->v2d.cur.ymax,
- soops->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX,
- soops->v2d.cur.ymin);
-
- /* render */
- fdrawline(soops->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX,
- soops->v2d.cur.ymax,
- soops->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX,
- soops->v2d.cur.ymin);
-}
-
-static void restrictbutton_view_cb(void *poin, void *poin2)
-{
- Base *base;
- Object *ob = (Object *)poin;
-
- /* deselect objects that are invisible */
- if (ob->restrictflag & OB_RESTRICT_VIEW) {
-
- /* Ouch! There is no backwards pointer from Object to Base,
- * so have to do loop to find it. */
- for(base= FIRSTBASE; base; base= base->next) {
- if(base->object==ob) {
- base->flag &= ~SELECT;
- base->object->flag= base->flag;
- }
- }
- }
-
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static void restrictbutton_sel_cb(void *poin, void *poin2)
-{
- Base *base;
- Object *ob = (Object *)poin;
-
- /* if select restriction has just been turned on */
- if (ob->restrictflag & OB_RESTRICT_SELECT) {
-
- /* Ouch! There is no backwards pointer from Object to Base,
- * so have to do loop to find it. */
- for(base= FIRSTBASE; base; base= base->next) {
- if(base->object==ob) {
- base->flag &= ~SELECT;
- base->object->flag= base->flag;
- }
- }
- }
-
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static void restrictbutton_rend_cb(void *poin, void *poin2)
-{
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static void restrictbutton_r_lay_cb(void *poin, void *poin2)
-{
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWNODE, 0);
- allqueue(REDRAWBUTSSCENE, 0);
-}
-
-static void namebutton_cb(void *tep, void *oldnamep)
-{
- SpaceOops *soops= curarea->spacedata.first;
- TreeStore *ts= soops->treestore;
- TreeElement *te= tep;
-
- if(ts && te) {
- TreeStoreElem *tselem= TREESTORE(te);
-
- if(tselem->type==0) {
- test_idbutton(tselem->id->name+2); // library.c, unique name and alpha sort
-
- /* Check the library target exists */
- if (te->idcode == ID_LI) {
- char expanded[FILE_MAXDIR + FILE_MAXFILE];
- BLI_strncpy(expanded, ((Library *)tselem->id)->name, FILE_MAXDIR + FILE_MAXFILE);
- BLI_convertstringcode(expanded, G.sce, G.scene->r.cfra);
- if (!BLI_exists(expanded)) {
- error("This path does not exist, correct this before saving");
- }
- }
- }
- else {
- switch(tselem->type) {
- case TSE_DEFGROUP:
- unique_vertexgroup_name(te->directdata, (Object *)tselem->id); // id = object
- allqueue(REDRAWBUTSEDIT, 0);
- break;
- case TSE_NLA_ACTION:
- test_idbutton(tselem->id->name+2);
- break;
- case TSE_EBONE:
- if(G.obedit && G.obedit->data==(ID *)tselem->id) {
- EditBone *ebone= te->directdata;
- char newname[32];
-
- /* restore bone name */
- BLI_strncpy(newname, ebone->name, 32);
- BLI_strncpy(ebone->name, oldnamep, 32);
- armature_bone_rename(G.obedit->data, oldnamep, newname);
- }
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWVIEW3D, 1);
- allqueue(REDRAWBUTSEDIT, 0);
- break;
-
- case TSE_BONE:
- {
- Bone *bone= te->directdata;
- Object *ob;
- char newname[32];
-
- // always make current object active
- tree_element_active_object(soops, te);
- ob= OBACT;
-
- /* restore bone name */
- BLI_strncpy(newname, bone->name, 32);
- BLI_strncpy(bone->name, oldnamep, 32);
- armature_bone_rename(ob->data, oldnamep, newname);
- }
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWVIEW3D, 1);
- allqueue(REDRAWBUTSEDIT, 0);
- break;
- case TSE_POSE_CHANNEL:
- {
- bPoseChannel *pchan= te->directdata;
- Object *ob;
- char newname[32];
-
- // always make current object active
- tree_element_active_object(soops, te);
- ob= OBACT;
-
- /* restore bone name */
- BLI_strncpy(newname, pchan->name, 32);
- BLI_strncpy(pchan->name, oldnamep, 32);
- armature_bone_rename(ob->data, oldnamep, newname);
- }
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWVIEW3D, 1);
- allqueue(REDRAWBUTSEDIT, 0);
- break;
- case TSE_R_LAYER:
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWBUTSSCENE, 0);
- break;
- }
- }
- }
- scrarea_queue_redraw(curarea);
-}
-
-static void outliner_draw_restrictbuts(uiBlock *block, SpaceOops *soops, ListBase *lb)
-{
- uiBut *bt;
- TreeElement *te;
- TreeStoreElem *tselem;
- Object *ob;
-
- for(te= lb->first; te; te= te->next) {
- tselem= TREESTORE(te);
- if(te->ys >= soops->v2d.cur.ymin && te->ys <= soops->v2d.cur.ymax) {
- /* objects have toggle-able restriction flags */
- if(tselem->type==0 && te->idcode==ID_OB) {
- ob = (Object *)tselem->id;
-
- uiBlockSetEmboss(block, UI_EMBOSSN);
- bt= uiDefIconButBitS(block, ICONTOG, OB_RESTRICT_VIEW, REDRAWALL, ICON_RESTRICT_VIEW_OFF,
- (int)soops->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, te->ys, 17, OL_H-1, &(ob->restrictflag), 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View");
- uiButSetFunc(bt, restrictbutton_view_cb, ob, NULL);
- uiButSetFlag(bt, UI_NO_HILITE);
-
- bt= uiDefIconButBitS(block, ICONTOG, OB_RESTRICT_SELECT, REDRAWALL, ICON_RESTRICT_SELECT_OFF,
- (int)soops->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, te->ys, 17, OL_H-1, &(ob->restrictflag), 0, 0, 0, 0, "Restrict/Allow selection in the 3D View");
- uiButSetFunc(bt, restrictbutton_sel_cb, ob, NULL);
- uiButSetFlag(bt, UI_NO_HILITE);
-
- bt= uiDefIconButBitS(block, ICONTOG, OB_RESTRICT_RENDER, REDRAWALL, ICON_RESTRICT_RENDER_OFF,
- (int)soops->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX, te->ys, 17, OL_H-1, &(ob->restrictflag), 0, 0, 0, 0, "Restrict/Allow renderability");
- uiButSetFunc(bt, restrictbutton_rend_cb, NULL, NULL);
- uiButSetFlag(bt, UI_NO_HILITE);
-
- uiBlockSetEmboss(block, UI_EMBOSS);
- }
- /* scene render layers and passes have toggle-able flags too! */
- else if(tselem->type==TSE_R_LAYER) {
- uiBlockSetEmboss(block, UI_EMBOSSN);
-
- bt= uiDefIconButBitI(block, ICONTOGN, SCE_LAY_DISABLE, REDRAWBUTSSCENE, ICON_CHECKBOX_HLT-1,
- (int)soops->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, te->ys, 17, OL_H-1, te->directdata, 0, 0, 0, 0, "Render this RenderLayer");
- uiButSetFunc(bt, restrictbutton_r_lay_cb, NULL, NULL);
-
- uiBlockSetEmboss(block, UI_EMBOSS);
- }
- else if(tselem->type==TSE_R_PASS) {
- int *layflag= te->directdata;
- uiBlockSetEmboss(block, UI_EMBOSSN);
-
- /* NOTE: tselem->nr is short! */
- bt= uiDefIconButBitI(block, ICONTOG, tselem->nr, REDRAWBUTSSCENE, ICON_CHECKBOX_HLT-1,
- (int)soops->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, te->ys, 17, OL_H-1, layflag, 0, 0, 0, 0, "Render this Pass");
- uiButSetFunc(bt, restrictbutton_r_lay_cb, NULL, NULL);
-
- layflag++; /* is lay_xor */
- if(ELEM6(tselem->nr, SCE_PASS_SPEC, SCE_PASS_SHADOW, SCE_PASS_AO, SCE_PASS_REFLECT, SCE_PASS_REFRACT, SCE_PASS_RADIO))
- bt= uiDefIconButBitI(block, TOG, tselem->nr, REDRAWBUTSSCENE, (*layflag & tselem->nr)?ICON_DOT:ICON_BLANK1,
- (int)soops->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, te->ys, 17, OL_H-1, layflag, 0, 0, 0, 0, "Exclude this Pass from Combined");
- uiButSetFunc(bt, restrictbutton_r_lay_cb, NULL, NULL);
-
- uiBlockSetEmboss(block, UI_EMBOSS);
- }
- }
-
- if((tselem->flag & TSE_CLOSED)==0) outliner_draw_restrictbuts(block, soops, &te->subtree);
- }
-}
-
-static void outliner_buttons(uiBlock *block, SpaceOops *soops, ListBase *lb)
-{
- uiBut *bt;
- TreeElement *te;
- TreeStoreElem *tselem;
- int dx, len;
-
- for(te= lb->first; te; te= te->next) {
- tselem= TREESTORE(te);
- if(te->ys >= soops->v2d.cur.ymin && te->ys <= soops->v2d.cur.ymax) {
-
- if(tselem->flag & TSE_TEXTBUT) {
- if(tselem->type == TSE_POSE_BASE) continue; // prevent crash when trying to rename 'pose' entry of armature
-
- if(tselem->type==TSE_EBONE) len = sizeof(((EditBone*) 0)->name);
- else if (tselem->type==TSE_MODIFIER) len = sizeof(((ModifierData*) 0)->name);
- else if(tselem->id && GS(tselem->id->name)==ID_LI) len = sizeof(((Library*) 0)->name);
- else len= sizeof(((ID*) 0)->name)-2;
-
- dx= BIF_GetStringWidth(G.font, te->name, 0);
- if(dx<50) dx= 50;
-
- bt= uiDefBut(block, TEX, OL_NAMEBUTTON, "", te->xs+2*OL_X-4, te->ys, dx+10, OL_H-1, te->name, 1.0, (float)len-1, 0, 0, "");
- uiButSetFunc(bt, namebutton_cb, te, NULL);
-
- // signal for button to open
- addqueue(curarea->win, BUT_ACTIVATE, OL_NAMEBUTTON);
-
- /* otherwise keeps open on ESC */
- tselem->flag &= ~TSE_TEXTBUT;
- }
- }
-
- if((tselem->flag & TSE_CLOSED)==0) outliner_buttons(block, soops, &te->subtree);
- }
-}
-
-void draw_outliner(ScrArea *sa, SpaceOops *soops)
-{
- uiBlock *block;
- int sizey, sizex;
- short ofsx, ofsy;
-
- /* version patch for old outliners here - do_versions patch doesn't work */
- if (G.v2d->scroll != L_SCROLL+B_SCROLLO) {
- init_v2d_oops(curarea, soops);
- test_view2d(G.v2d, curarea->winx, curarea->winy);
- calc_scrollrcts(sa, G.v2d, sa->winx, sa->winy);
- }
- else
- calc_scrollrcts(sa, G.v2d, sa->winx, sa->winy);
-
- if(sa->winx>SCROLLB+10 && sa->winy>SCROLLH+10) {
- if(G.v2d->scroll) {
- ofsx= sa->winrct.xmin; /* because mywin */
- ofsy= sa->winrct.ymin;
- glViewport(ofsx+G.v2d->mask.xmin, ofsy+G.v2d->mask.ymin, ( ofsx+G.v2d->mask.xmax-1)-(ofsx+G.v2d->mask.xmin)+1, ( ofsy+G.v2d->mask.ymax-1)-( ofsy+G.v2d->mask.ymin)+1);
- glScissor(ofsx+G.v2d->mask.xmin, ofsy+G.v2d->mask.ymin, ( ofsx+G.v2d->mask.xmax-1)-(ofsx+G.v2d->mask.xmin)+1, ( ofsy+G.v2d->mask.ymax-1)-( ofsy+G.v2d->mask.ymin)+1);
- }
- }
-
- outliner_build_tree(soops); // always
- sizey = sizex = 0;
- outliner_height(soops, &soops->tree, &sizey);
- outliner_width(soops, &soops->tree, &sizex);
-
- /* we init all tot rect vars, only really needed on window size change though */
- G.v2d->tot.xmin= 0.0;
- G.v2d->tot.xmax= (G.v2d->mask.xmax-G.v2d->mask.xmin);
- if(soops->flag & SO_HIDE_RESTRICTCOLS) {
- if(G.v2d->tot.xmax <= sizex)
- G.v2d->tot.xmax= 2*sizex;
- }
- else {
- if(G.v2d->tot.xmax-OL_TOGW <= sizex)
- G.v2d->tot.xmax= 2*sizex;
- }
- G.v2d->tot.ymax= 0.0;
- G.v2d->tot.ymin= -sizey*OL_H;
- test_view2d(G.v2d, sa->winx, sa->winy);
-
- // align on top window if cur bigger than tot
- if(G.v2d->cur.ymax-G.v2d->cur.ymin > sizey*OL_H) {
- G.v2d->cur.ymax= 0.0;
- G.v2d->cur.ymin= -(G.v2d->mask.ymax-G.v2d->mask.ymin);
- }
-
- myortho2(G.v2d->cur.xmin-0.375, G.v2d->cur.xmax-0.375, G.v2d->cur.ymin-0.375, G.v2d->cur.ymax-0.375);
-
- /* draw outliner stuff (background and hierachy lines) */
- outliner_back(soops);
- outliner_draw_tree(soops);
-
- /* restore viewport */
- mywinset(sa->win);
-
- /* ortho corrected - 'pixel space' */
- myortho2(G.v2d->cur.xmin-SCROLLB-0.375, G.v2d->cur.xmax-0.375, G.v2d->cur.ymin-SCROLLH-0.375, G.v2d->cur.ymax-0.375);
-
- /* draw icons and names */
- block= uiNewBlock(&sa->uiblocks, "outliner buttons", UI_EMBOSS, UI_HELV, sa->win);
- outliner_buttons(block, soops, &soops->tree);
-
- /* draw restriction columns */
- if (!(soops->flag & SO_HIDE_RESTRICTCOLS)) {
- outliner_draw_restrictcols(soops);
- outliner_draw_restrictbuts(block, soops, &soops->tree);
- }
-
- uiDrawBlock(block);
-
- /* clear flag that allows quick redraws */
- soops->storeflag &= ~SO_TREESTORE_REDRAW;
-
- /* drawoopsspace handles sliders */
-}
diff --git a/source/blender/src/parametrizer.c b/source/blender/src/parametrizer.c
deleted file mode 100644
index f54bd22c79e..00000000000
--- a/source/blender/src/parametrizer.c
+++ /dev/null
@@ -1,4200 +0,0 @@
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_memarena.h"
-#include "BLI_arithb.h"
-#include "BLI_rand.h"
-#include "BLI_heap.h"
-#include "BLI_boxpack2d.h"
-
-#include "BKE_utildefines.h"
-
-#include "BIF_editsima.h"
-#include "BIF_toolbox.h"
-
-#include "ONL_opennl.h"
-
-#include "parametrizer.h"
-#include "parametrizer_intern.h"
-
-#include <math.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#if defined(_WIN32)
-#define M_PI 3.14159265358979323846
-#endif
-
-/* PHash
- - special purpose hash that keeps all its elements in a single linked list.
- - after construction, this hash is thrown away, and the list remains.
- - removing elements is not possible efficiently.
-*/
-
-static int PHashSizes[] = {
- 1, 3, 5, 11, 17, 37, 67, 131, 257, 521, 1031, 2053, 4099, 8209,
- 16411, 32771, 65537, 131101, 262147, 524309, 1048583, 2097169,
- 4194319, 8388617, 16777259, 33554467, 67108879, 134217757, 268435459
-};
-
-#define PHASH_hash(ph, item) (((unsigned long) (item))%((unsigned int) (ph)->cursize))
-#define PHASH_edge(v1, v2) ((v1)^(v2))
-
-static PHash *phash_new(PHashLink **list, int sizehint)
-{
- PHash *ph = (PHash*)MEM_callocN(sizeof(PHash), "PHash");
- ph->size = 0;
- ph->cursize_id = 0;
- ph->list = list;
-
- while (PHashSizes[ph->cursize_id] < sizehint)
- ph->cursize_id++;
-
- ph->cursize = PHashSizes[ph->cursize_id];
- ph->buckets = (PHashLink**)MEM_callocN(ph->cursize*sizeof(*ph->buckets), "PHashBuckets");
-
- return ph;
-}
-
-static void phash_delete(PHash *ph)
-{
- MEM_freeN(ph->buckets);
- MEM_freeN(ph);
-}
-
-static int phash_size(PHash *ph)
-{
- return ph->size;
-}
-
-static void phash_insert(PHash *ph, PHashLink *link)
-{
- int size = ph->cursize;
- int hash = PHASH_hash(ph, link->key);
- PHashLink *lookup = ph->buckets[hash];
-
- if (lookup == NULL) {
- /* insert in front of the list */
- ph->buckets[hash] = link;
- link->next = *(ph->list);
- *(ph->list) = link;
- }
- else {
- /* insert after existing element */
- link->next = lookup->next;
- lookup->next = link;
- }
-
- ph->size++;
-
- if (ph->size > (size*3)) {
- PHashLink *next = NULL, *first = *(ph->list);
-
- ph->cursize = PHashSizes[++ph->cursize_id];
- MEM_freeN(ph->buckets);
- ph->buckets = (PHashLink**)MEM_callocN(ph->cursize*sizeof(*ph->buckets), "PHashBuckets");
- ph->size = 0;
- *(ph->list) = NULL;
-
- for (link = first; link; link = next) {
- next = link->next;
- phash_insert(ph, link);
- }
- }
-}
-
-static PHashLink *phash_lookup(PHash *ph, PHashKey key)
-{
- PHashLink *link;
- int hash = PHASH_hash(ph, key);
-
- for (link = ph->buckets[hash]; link; link = link->next)
- if (link->key == key)
- return link;
- else if (PHASH_hash(ph, link->key) != hash)
- return NULL;
-
- return link;
-}
-
-static PHashLink *phash_next(PHash *ph, PHashKey key, PHashLink *link)
-{
- int hash = PHASH_hash(ph, key);
-
- for (link = link->next; link; link = link->next)
- if (link->key == key)
- return link;
- else if (PHASH_hash(ph, link->key) != hash)
- return NULL;
-
- return link;
-}
-
-/* Geometry */
-
-static float p_vec_angle_cos(float *v1, float *v2, float *v3)
-{
- float d1[3], d2[3];
-
- d1[0] = v1[0] - v2[0];
- d1[1] = v1[1] - v2[1];
- d1[2] = v1[2] - v2[2];
-
- d2[0] = v3[0] - v2[0];
- d2[1] = v3[1] - v2[1];
- d2[2] = v3[2] - v2[2];
-
- Normalize(d1);
- Normalize(d2);
-
- return d1[0]*d2[0] + d1[1]*d2[1] + d1[2]*d2[2];
-}
-
-static float p_vec_angle(float *v1, float *v2, float *v3)
-{
- float dot = p_vec_angle_cos(v1, v2, v3);
-
- if (dot <= -1.0f)
- return (float)M_PI;
- else if (dot >= 1.0f)
- return 0.0f;
- else
- return (float)acos(dot);
-}
-
-static float p_vec2_angle(float *v1, float *v2, float *v3)
-{
- float u1[3], u2[3], u3[3];
-
- u1[0] = v1[0]; u1[1] = v1[1]; u1[2] = 0.0f;
- u2[0] = v2[0]; u2[1] = v2[1]; u2[2] = 0.0f;
- u3[0] = v3[0]; u3[1] = v3[1]; u3[2] = 0.0f;
-
- return p_vec_angle(u1, u2, u3);
-}
-
-static void p_triangle_angles(float *v1, float *v2, float *v3, float *a1, float *a2, float *a3)
-{
- *a1 = p_vec_angle(v3, v1, v2);
- *a2 = p_vec_angle(v1, v2, v3);
- *a3 = M_PI - *a2 - *a1;
-}
-
-static void p_face_angles(PFace *f, float *a1, float *a2, float *a3)
-{
- PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next;
- PVert *v1 = e1->vert, *v2 = e2->vert, *v3 = e3->vert;
-
- p_triangle_angles(v1->co, v2->co, v3->co, a1, a2, a3);
-}
-
-static float p_face_area(PFace *f)
-{
- PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next;
- PVert *v1 = e1->vert, *v2 = e2->vert, *v3 = e3->vert;
-
- return AreaT3Dfl(v1->co, v2->co, v3->co);
-}
-
-static float p_area_signed(float *v1, float *v2, float *v3)
-{
- return 0.5f*(((v2[0] - v1[0])*(v3[1] - v1[1])) -
- ((v3[0] - v1[0])*(v2[1] - v1[1])));
-}
-
-static float p_face_uv_area_signed(PFace *f)
-{
- PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next;
- PVert *v1 = e1->vert, *v2 = e2->vert, *v3 = e3->vert;
-
- return 0.5f*(((v2->uv[0] - v1->uv[0])*(v3->uv[1] - v1->uv[1])) -
- ((v3->uv[0] - v1->uv[0])*(v2->uv[1] - v1->uv[1])));
-}
-
-static float p_edge_length(PEdge *e)
-{
- PVert *v1 = e->vert, *v2 = e->next->vert;
- float d[3];
-
- d[0] = v2->co[0] - v1->co[0];
- d[1] = v2->co[1] - v1->co[1];
- d[2] = v2->co[2] - v1->co[2];
-
- return sqrt(d[0]*d[0] + d[1]*d[1] + d[2]*d[2]);
-}
-
-static float p_edge_uv_length(PEdge *e)
-{
- PVert *v1 = e->vert, *v2 = e->next->vert;
- float d[3];
-
- d[0] = v2->uv[0] - v1->uv[0];
- d[1] = v2->uv[1] - v1->uv[1];
-
- return sqrt(d[0]*d[0] + d[1]*d[1]);
-}
-
-static void p_chart_uv_bbox(PChart *chart, float *minv, float *maxv)
-{
- PVert *v;
-
- INIT_MINMAX2(minv, maxv);
-
- for (v=chart->verts; v; v=v->nextlink) {
- DO_MINMAX2(v->uv, minv, maxv);
- }
-}
-
-static void p_chart_uv_scale(PChart *chart, float scale)
-{
- PVert *v;
-
- for (v=chart->verts; v; v=v->nextlink) {
- v->uv[0] *= scale;
- v->uv[1] *= scale;
- }
-}
-
-static void p_chart_uv_translate(PChart *chart, float trans[2])
-{
- PVert *v;
-
- for (v=chart->verts; v; v=v->nextlink) {
- v->uv[0] += trans[0];
- v->uv[1] += trans[1];
- }
-}
-
-static PBool p_intersect_line_2d_dir(float *v1, float *dir1, float *v2, float *dir2, float *isect)
-{
- float lmbda, div;
-
- div= dir2[0]*dir1[1] - dir2[1]*dir1[0];
-
- if (div == 0.0f)
- return P_FALSE;
-
- lmbda= ((v1[1]-v2[1])*dir1[0]-(v1[0]-v2[0])*dir1[1])/div;
- isect[0] = v1[0] + lmbda*dir2[0];
- isect[1] = v1[1] + lmbda*dir2[1];
-
- return P_TRUE;
-}
-
-#if 0
-static PBool p_intersect_line_2d(float *v1, float *v2, float *v3, float *v4, float *isect)
-{
- float dir1[2], dir2[2];
-
- dir1[0] = v4[0] - v3[0];
- dir1[1] = v4[1] - v3[1];
-
- dir2[0] = v2[0] - v1[0];
- dir2[1] = v2[1] - v1[1];
-
- if (!p_intersect_line_2d_dir(v1, dir1, v2, dir2, isect)) {
- /* parallel - should never happen in theory for polygon kernel, but
- let's give a point nearby in case things go wrong */
- isect[0] = (v1[0] + v2[0])*0.5f;
- isect[1] = (v1[1] + v2[1])*0.5f;
- return P_FALSE;
- }
-
- return P_TRUE;
-}
-#endif
-
-/* Topological Utilities */
-
-static PEdge *p_wheel_edge_next(PEdge *e)
-{
- return e->next->next->pair;
-}
-
-static PEdge *p_wheel_edge_prev(PEdge *e)
-{
- return (e->pair)? e->pair->next: NULL;
-}
-
-static PEdge *p_boundary_edge_next(PEdge *e)
-{
- return e->next->vert->edge;
-}
-
-static PEdge *p_boundary_edge_prev(PEdge *e)
-{
- PEdge *we = e, *last;
-
- do {
- last = we;
- we = p_wheel_edge_next(we);
- } while (we && (we != e));
-
- return last->next->next;
-}
-
-static PBool p_vert_interior(PVert *v)
-{
- return (v->edge->pair != NULL);
-}
-
-static void p_face_flip(PFace *f)
-{
- PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next;
- PVert *v1 = e1->vert, *v2 = e2->vert, *v3 = e3->vert;
- int f1 = e1->flag, f2 = e2->flag, f3 = e3->flag;
-
- e1->vert = v2;
- e1->next = e3;
- e1->flag = (f1 & ~PEDGE_VERTEX_FLAGS) | (f2 & PEDGE_VERTEX_FLAGS);
-
- e2->vert = v3;
- e2->next = e1;
- e2->flag = (f2 & ~PEDGE_VERTEX_FLAGS) | (f3 & PEDGE_VERTEX_FLAGS);
-
- e3->vert = v1;
- e3->next = e2;
- e3->flag = (f3 & ~PEDGE_VERTEX_FLAGS) | (f1 & PEDGE_VERTEX_FLAGS);
-}
-
-#if 0
-static void p_chart_topological_sanity_check(PChart *chart)
-{
- PVert *v;
- PEdge *e;
-
- for (v=chart->verts; v; v=v->nextlink)
- param_test_equals_ptr("v->edge->vert", v, v->edge->vert);
-
- for (e=chart->edges; e; e=e->nextlink) {
- if (e->pair) {
- param_test_equals_ptr("e->pair->pair", e, e->pair->pair);
- param_test_equals_ptr("pair->vert", e->vert, e->pair->next->vert);
- param_test_equals_ptr("pair->next->vert", e->next->vert, e->pair->vert);
- }
- }
-}
-#endif
-
-/* Loading / Flushing */
-
-static void p_vert_load_pin_select_uvs(PVert *v)
-{
- PEdge *e;
- int nedges = 0, npins = 0;
- float pinuv[2];
-
- v->uv[0] = v->uv[1] = 0.0f;
- pinuv[0] = pinuv[1] = 0.0f;
- e = v->edge;
- do {
- if (e->orig_uv) {
- if (e->flag & PEDGE_SELECT)
- v->flag |= PVERT_SELECT;
-
- if (e->flag & PEDGE_PIN) {
- pinuv[0] += e->orig_uv[0];
- pinuv[1] += e->orig_uv[1];
- npins++;
- }
- else {
- v->uv[0] += e->orig_uv[0];
- v->uv[1] += e->orig_uv[1];
- }
-
- nedges++;
- }
-
- e = p_wheel_edge_next(e);
- } while (e && e != (v->edge));
-
- if (npins > 0) {
- v->uv[0] = pinuv[0]/npins;
- v->uv[1] = pinuv[1]/npins;
- v->flag |= PVERT_PIN;
- }
- else if (nedges > 0) {
- v->uv[0] /= nedges;
- v->uv[1] /= nedges;
- }
-}
-
-static void p_flush_uvs(PChart *chart)
-{
- PEdge *e;
-
- for (e=chart->edges; e; e=e->nextlink) {
- if (e->orig_uv) {
- e->orig_uv[0] = e->vert->uv[0];
- e->orig_uv[1] = e->vert->uv[1];
- }
- }
-}
-
-static void p_flush_uvs_blend(PChart *chart, float blend)
-{
- PEdge *e;
- float invblend = 1.0f - blend;
-
- for (e=chart->edges; e; e=e->nextlink) {
- if (e->orig_uv) {
- e->orig_uv[0] = blend*e->old_uv[0] + invblend*e->vert->uv[0];
- e->orig_uv[1] = blend*e->old_uv[1] + invblend*e->vert->uv[1];
- }
- }
-}
-
-static void p_face_backup_uvs(PFace *f)
-{
- PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next;
-
- if (e1->orig_uv && e2->orig_uv && e3->orig_uv) {
- e1->old_uv[0] = e1->orig_uv[0];
- e1->old_uv[1] = e1->orig_uv[1];
- e2->old_uv[0] = e2->orig_uv[0];
- e2->old_uv[1] = e2->orig_uv[1];
- e3->old_uv[0] = e3->orig_uv[0];
- e3->old_uv[1] = e3->orig_uv[1];
- }
-}
-
-static void p_face_restore_uvs(PFace *f)
-{
- PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next;
-
- if (e1->orig_uv && e2->orig_uv && e3->orig_uv) {
- e1->orig_uv[0] = e1->old_uv[0];
- e1->orig_uv[1] = e1->old_uv[1];
- e2->orig_uv[0] = e2->old_uv[0];
- e2->orig_uv[1] = e2->old_uv[1];
- e3->orig_uv[0] = e3->old_uv[0];
- e3->orig_uv[1] = e3->old_uv[1];
- }
-}
-
-/* Construction (use only during construction, relies on u.key being set */
-
-static PVert *p_vert_add(PHandle *handle, PHashKey key, float *co, PEdge *e)
-{
- PVert *v = (PVert*)BLI_memarena_alloc(handle->arena, sizeof *v);
- v->co = co;
- v->u.key = key;
- v->edge = e;
- v->flag = 0;
-
- phash_insert(handle->hash_verts, (PHashLink*)v);
-
- return v;
-}
-
-static PVert *p_vert_lookup(PHandle *handle, PHashKey key, float *co, PEdge *e)
-{
- PVert *v = (PVert*)phash_lookup(handle->hash_verts, key);
-
- if (v)
- return v;
- else
- return p_vert_add(handle, key, co, e);
-}
-
-static PVert *p_vert_copy(PChart *chart, PVert *v)
-{
- PVert *nv = (PVert*)BLI_memarena_alloc(chart->handle->arena, sizeof *nv);
-
- nv->co = v->co;
- nv->uv[0] = v->uv[0];
- nv->uv[1] = v->uv[1];
- nv->u.key = v->u.key;
- nv->edge = v->edge;
- nv->flag = v->flag;
-
- return nv;
-}
-
-static PEdge *p_edge_lookup(PHandle *handle, PHashKey *vkeys)
-{
- PHashKey key = PHASH_edge(vkeys[0], vkeys[1]);
- PEdge *e = (PEdge*)phash_lookup(handle->hash_edges, key);
-
- while (e) {
- if ((e->vert->u.key == vkeys[0]) && (e->next->vert->u.key == vkeys[1]))
- return e;
- else if ((e->vert->u.key == vkeys[1]) && (e->next->vert->u.key == vkeys[0]))
- return e;
-
- e = (PEdge*)phash_next(handle->hash_edges, key, (PHashLink*)e);
- }
-
- return NULL;
-}
-
-static PBool p_face_exists(PHandle *handle, PHashKey *vkeys, int i1, int i2, int i3)
-{
- PHashKey key = PHASH_edge(vkeys[i1], vkeys[i2]);
- PEdge *e = (PEdge*)phash_lookup(handle->hash_edges, key);
-
- while (e) {
- if ((e->vert->u.key == vkeys[i1]) && (e->next->vert->u.key == vkeys[i2])) {
- if (e->next->next->vert->u.key == vkeys[i3])
- return P_TRUE;
- }
- else if ((e->vert->u.key == vkeys[i2]) && (e->next->vert->u.key == vkeys[i1])) {
- if (e->next->next->vert->u.key == vkeys[i3])
- return P_TRUE;
- }
-
- e = (PEdge*)phash_next(handle->hash_edges, key, (PHashLink*)e);
- }
-
- return P_FALSE;
-}
-
-static PChart *p_chart_new(PHandle *handle)
-{
- PChart *chart = (PChart*)MEM_callocN(sizeof*chart, "PChart");
- chart->handle = handle;
-
- return chart;
-}
-
-static void p_chart_delete(PChart *chart)
-{
- /* the actual links are free by memarena */
- MEM_freeN(chart);
-}
-
-static PBool p_edge_implicit_seam(PEdge *e, PEdge *ep)
-{
- float *uv1, *uv2, *uvp1, *uvp2;
- float limit[2];
-
- limit[0] = 0.00001;
- limit[1] = 0.00001;
-
- uv1 = e->orig_uv;
- uv2 = e->next->orig_uv;
-
- if (e->vert->u.key == ep->vert->u.key) {
- uvp1 = ep->orig_uv;
- uvp2 = ep->next->orig_uv;
- }
- else {
- uvp1 = ep->next->orig_uv;
- uvp2 = ep->orig_uv;
- }
-
- if((fabs(uv1[0]-uvp1[0]) > limit[0]) || (fabs(uv1[1]-uvp1[1]) > limit[1])) {
- e->flag |= PEDGE_SEAM;
- ep->flag |= PEDGE_SEAM;
- return P_TRUE;
- }
- if((fabs(uv2[0]-uvp2[0]) > limit[0]) || (fabs(uv2[1]-uvp2[1]) > limit[1])) {
- e->flag |= PEDGE_SEAM;
- ep->flag |= PEDGE_SEAM;
- return P_TRUE;
- }
-
- return P_FALSE;
-}
-
-static PBool p_edge_has_pair(PHandle *handle, PEdge *e, PEdge **pair, PBool impl)
-{
- PHashKey key;
- PEdge *pe;
- PVert *v1, *v2;
- PHashKey key1 = e->vert->u.key;
- PHashKey key2 = e->next->vert->u.key;
-
- if (e->flag & PEDGE_SEAM)
- return P_FALSE;
-
- key = PHASH_edge(key1, key2);
- pe = (PEdge*)phash_lookup(handle->hash_edges, key);
- *pair = NULL;
-
- while (pe) {
- if (pe != e) {
- v1 = pe->vert;
- v2 = pe->next->vert;
-
- if (((v1->u.key == key1) && (v2->u.key == key2)) ||
- ((v1->u.key == key2) && (v2->u.key == key1))) {
-
- /* don't connect seams and t-junctions */
- if ((pe->flag & PEDGE_SEAM) || *pair ||
- (impl && p_edge_implicit_seam(e, pe))) {
- *pair = NULL;
- return P_FALSE;
- }
-
- *pair = pe;
- }
- }
-
- pe = (PEdge*)phash_next(handle->hash_edges, key, (PHashLink*)pe);
- }
-
- if (*pair && (e->vert == (*pair)->vert)) {
- if ((*pair)->next->pair || (*pair)->next->next->pair) {
- /* non unfoldable, maybe mobius ring or klein bottle */
- *pair = NULL;
- return P_FALSE;
- }
- }
-
- return (*pair != NULL);
-}
-
-static PBool p_edge_connect_pair(PHandle *handle, PEdge *e, PEdge ***stack, PBool impl)
-{
- PEdge *pair = NULL;
-
- if(!e->pair && p_edge_has_pair(handle, e, &pair, impl)) {
- if (e->vert == pair->vert)
- p_face_flip(pair->face);
-
- e->pair = pair;
- pair->pair = e;
-
- if (!(pair->face->flag & PFACE_CONNECTED)) {
- **stack = pair;
- (*stack)++;
- }
- }
-
- return (e->pair != NULL);
-}
-
-static int p_connect_pairs(PHandle *handle, PBool impl)
-{
- PEdge **stackbase = MEM_mallocN(sizeof*stackbase*phash_size(handle->hash_faces), "Pstackbase");
- PEdge **stack = stackbase;
- PFace *f, *first;
- PEdge *e, *e1, *e2;
- PChart *chart = handle->construction_chart;
- int ncharts = 0;
-
- /* connect pairs, count edges, set vertex-edge pointer to a pairless edge */
- for (first=chart->faces; first; first=first->nextlink) {
- if (first->flag & PFACE_CONNECTED)
- continue;
-
- *stack = first->edge;
- stack++;
-
- while (stack != stackbase) {
- stack--;
- e = *stack;
- e1 = e->next;
- e2 = e1->next;
-
- f = e->face;
- f->flag |= PFACE_CONNECTED;
-
- /* assign verts to charts so we can sort them later */
- f->u.chart = ncharts;
-
- if (!p_edge_connect_pair(handle, e, &stack, impl))
- e->vert->edge = e;
- if (!p_edge_connect_pair(handle, e1, &stack, impl))
- e1->vert->edge = e1;
- if (!p_edge_connect_pair(handle, e2, &stack, impl))
- e2->vert->edge = e2;
- }
-
- ncharts++;
- }
-
- MEM_freeN(stackbase);
-
- return ncharts;
-}
-
-static void p_split_vert(PChart *chart, PEdge *e)
-{
- PEdge *we, *lastwe = NULL;
- PVert *v = e->vert;
- PBool copy = P_TRUE;
-
- if (e->flag & PEDGE_VERTEX_SPLIT)
- return;
-
- /* rewind to start */
- lastwe = e;
- for (we = p_wheel_edge_prev(e); we && (we != e); we = p_wheel_edge_prev(we))
- lastwe = we;
-
- /* go over all edges in wheel */
- for (we = lastwe; we; we = p_wheel_edge_next(we)) {
- if (we->flag & PEDGE_VERTEX_SPLIT)
- break;
-
- we->flag |= PEDGE_VERTEX_SPLIT;
-
- if (we == v->edge) {
- /* found it, no need to copy */
- copy = P_FALSE;
- v->nextlink = chart->verts;
- chart->verts = v;
- chart->nverts++;
- }
- }
-
- if (copy) {
- /* not found, copying */
- v->flag |= PVERT_SPLIT;
- v = p_vert_copy(chart, v);
- v->flag |= PVERT_SPLIT;
-
- v->nextlink = chart->verts;
- chart->verts = v;
- chart->nverts++;
-
- v->edge = lastwe;
-
- we = lastwe;
- do {
- we->vert = v;
- we = p_wheel_edge_next(we);
- } while (we && (we != lastwe));
- }
-}
-
-static PChart **p_split_charts(PHandle *handle, PChart *chart, int ncharts)
-{
- PChart **charts = MEM_mallocN(sizeof*charts * ncharts, "PCharts"), *nchart;
- PFace *f, *nextf;
- int i;
-
- for (i = 0; i < ncharts; i++)
- charts[i] = p_chart_new(handle);
-
- f = chart->faces;
- while (f) {
- PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next;
- nextf = f->nextlink;
-
- nchart = charts[f->u.chart];
-
- f->nextlink = nchart->faces;
- nchart->faces = f;
- e1->nextlink = nchart->edges;
- nchart->edges = e1;
- e2->nextlink = nchart->edges;
- nchart->edges = e2;
- e3->nextlink = nchart->edges;
- nchart->edges = e3;
-
- nchart->nfaces++;
- nchart->nedges += 3;
-
- p_split_vert(nchart, e1);
- p_split_vert(nchart, e2);
- p_split_vert(nchart, e3);
-
- f = nextf;
- }
-
- return charts;
-}
-
-static PFace *p_face_add(PHandle *handle)
-{
- PFace *f;
- PEdge *e1, *e2, *e3;
-
- /* allocate */
- f = (PFace*)BLI_memarena_alloc(handle->arena, sizeof *f);
- f->flag=0; // init !
-
- e1 = (PEdge*)BLI_memarena_alloc(handle->arena, sizeof *e1);
- e2 = (PEdge*)BLI_memarena_alloc(handle->arena, sizeof *e2);
- e3 = (PEdge*)BLI_memarena_alloc(handle->arena, sizeof *e3);
-
- /* set up edges */
- f->edge = e1;
- e1->face = e2->face = e3->face = f;
-
- e1->next = e2;
- e2->next = e3;
- e3->next = e1;
-
- e1->pair = NULL;
- e2->pair = NULL;
- e3->pair = NULL;
-
- e1->flag =0;
- e2->flag =0;
- e3->flag =0;
-
- return f;
-}
-
-static PFace *p_face_add_construct(PHandle *handle, ParamKey key, ParamKey *vkeys,
- float *co[3], float *uv[3], int i1, int i2, int i3,
- ParamBool *pin, ParamBool *select)
-{
- PFace *f = p_face_add(handle);
- PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next;
-
- e1->vert = p_vert_lookup(handle, vkeys[i1], co[i1], e1);
- e2->vert = p_vert_lookup(handle, vkeys[i2], co[i2], e2);
- e3->vert = p_vert_lookup(handle, vkeys[i3], co[i3], e3);
-
- e1->orig_uv = uv[i1];
- e2->orig_uv = uv[i2];
- e3->orig_uv = uv[i3];
-
- if (pin) {
- if (pin[i1]) e1->flag |= PEDGE_PIN;
- if (pin[i2]) e2->flag |= PEDGE_PIN;
- if (pin[i3]) e3->flag |= PEDGE_PIN;
- }
-
- if (select) {
- if (select[i1]) e1->flag |= PEDGE_SELECT;
- if (select[i2]) e2->flag |= PEDGE_SELECT;
- if (select[i3]) e3->flag |= PEDGE_SELECT;
- }
-
- /* insert into hash */
- f->u.key = key;
- phash_insert(handle->hash_faces, (PHashLink*)f);
-
- e1->u.key = PHASH_edge(vkeys[i1], vkeys[i2]);
- e2->u.key = PHASH_edge(vkeys[i2], vkeys[i3]);
- e3->u.key = PHASH_edge(vkeys[i3], vkeys[i1]);
-
- phash_insert(handle->hash_edges, (PHashLink*)e1);
- phash_insert(handle->hash_edges, (PHashLink*)e2);
- phash_insert(handle->hash_edges, (PHashLink*)e3);
-
- return f;
-}
-
-static PFace *p_face_add_fill(PChart *chart, PVert *v1, PVert *v2, PVert *v3)
-{
- PFace *f = p_face_add(chart->handle);
- PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next;
-
- e1->vert = v1;
- e2->vert = v2;
- e3->vert = v3;
-
- e1->orig_uv = e2->orig_uv = e3->orig_uv = NULL;
-
- f->nextlink = chart->faces;
- chart->faces = f;
- e1->nextlink = chart->edges;
- chart->edges = e1;
- e2->nextlink = chart->edges;
- chart->edges = e2;
- e3->nextlink = chart->edges;
- chart->edges = e3;
-
- chart->nfaces++;
- chart->nedges += 3;
-
- return f;
-}
-
-static PBool p_quad_split_direction(PHandle *handle, float **co, PHashKey *vkeys)
-{
- float fac= VecLenf(co[0], co[2]) - VecLenf(co[1], co[3]);
- PBool dir = (fac <= 0.0f);
-
- /* the face exists check is there because of a special case: when
- two quads share three vertices, they can each be split into two
- triangles, resulting in two identical triangles. for example in
- suzanne's nose. */
- if (dir) {
- if (p_face_exists(handle,vkeys,0,1,2) || p_face_exists(handle,vkeys,0,2,3))
- return !dir;
- }
- else {
- if (p_face_exists(handle,vkeys,0,1,3) || p_face_exists(handle,vkeys,1,2,3))
- return !dir;
- }
-
- return dir;
-}
-
-/* Construction: boundary filling */
-
-static void p_chart_boundaries(PChart *chart, int *nboundaries, PEdge **outer)
-{
- PEdge *e, *be;
- float len, maxlen = -1.0;
-
- if (nboundaries)
- *nboundaries = 0;
- if (outer)
- *outer = NULL;
-
- for (e=chart->edges; e; e=e->nextlink) {
- if (e->pair || (e->flag & PEDGE_DONE))
- continue;
-
- if (nboundaries)
- (*nboundaries)++;
-
- len = 0.0f;
-
- be = e;
- do {
- be->flag |= PEDGE_DONE;
- len += p_edge_length(be);
- be = be->next->vert->edge;
- } while(be != e);
-
- if (outer && (len > maxlen)) {
- *outer = e;
- maxlen = len;
- }
- }
-
- for (e=chart->edges; e; e=e->nextlink)
- e->flag &= ~PEDGE_DONE;
-}
-
-static float p_edge_boundary_angle(PEdge *e)
-{
- PEdge *we;
- PVert *v, *v1, *v2;
- float angle;
- int n = 0;
-
- v = e->vert;
-
- /* concave angle check -- could be better */
- angle = M_PI;
-
- we = v->edge;
- do {
- v1 = we->next->vert;
- v2 = we->next->next->vert;
- angle -= p_vec_angle(v1->co, v->co, v2->co);
-
- we = we->next->next->pair;
- n++;
- } while (we && (we != v->edge));
-
- return angle;
-}
-
-static void p_chart_fill_boundary(PChart *chart, PEdge *be, int nedges)
-{
- PEdge *e, *e1, *e2;
- PHashKey vkeys[3];
- PFace *f;
- struct Heap *heap = BLI_heap_new();
- float angle;
-
- e = be;
- do {
- angle = p_edge_boundary_angle(e);
- e->u.heaplink = BLI_heap_insert(heap, angle, e);
-
- e = p_boundary_edge_next(e);
- } while(e != be);
-
- if (nedges == 2) {
- /* no real boundary, but an isolated seam */
- e = be->next->vert->edge;
- e->pair = be;
- be->pair = e;
-
- BLI_heap_remove(heap, e->u.heaplink);
- BLI_heap_remove(heap, be->u.heaplink);
- }
- else {
- while (nedges > 2) {
- PEdge *ne, *ne1, *ne2;
-
- e = (PEdge*)BLI_heap_popmin(heap);
-
- e1 = p_boundary_edge_prev(e);
- e2 = p_boundary_edge_next(e);
-
- BLI_heap_remove(heap, e1->u.heaplink);
- BLI_heap_remove(heap, e2->u.heaplink);
- e->u.heaplink = e1->u.heaplink = e2->u.heaplink = NULL;
-
- e->flag |= PEDGE_FILLED;
- e1->flag |= PEDGE_FILLED;
-
- vkeys[0] = e->vert->u.key;
- vkeys[1] = e1->vert->u.key;
- vkeys[2] = e2->vert->u.key;
-
- f = p_face_add_fill(chart, e->vert, e1->vert, e2->vert);
- f->flag |= PFACE_FILLED;
-
- ne = f->edge->next->next;
- ne1 = f->edge;
- ne2 = f->edge->next;
-
- ne->flag = ne1->flag = ne2->flag = PEDGE_FILLED;
-
- e->pair = ne;
- ne->pair = e;
- e1->pair = ne1;
- ne1->pair = e1;
-
- ne->vert = e2->vert;
- ne1->vert = e->vert;
- ne2->vert = e1->vert;
-
- if (nedges == 3) {
- e2->pair = ne2;
- ne2->pair = e2;
- }
- else {
- ne2->vert->edge = ne2;
-
- ne2->u.heaplink = BLI_heap_insert(heap, p_edge_boundary_angle(ne2), ne2);
- e2->u.heaplink = BLI_heap_insert(heap, p_edge_boundary_angle(e2), e2);
- }
-
- nedges--;
- }
- }
-
- BLI_heap_free(heap, NULL);
-}
-
-static void p_chart_fill_boundaries(PChart *chart, PEdge *outer)
-{
- PEdge *e, *enext, *be;
- int nedges;
-
- for (e=chart->edges; e; e=e->nextlink) {
- enext = e->nextlink;
-
- if (e->pair || (e->flag & PEDGE_FILLED))
- continue;
-
- nedges = 0;
- be = e;
- do {
- be->flag |= PEDGE_FILLED;
- be = be->next->vert->edge;
- nedges++;
- } while(be != e);
-
- if (e != outer)
- p_chart_fill_boundary(chart, e, nedges);
- }
-}
-
-#if 0
-/* Polygon kernel for inserting uv's non overlapping */
-
-static int p_polygon_point_in(float *cp1, float *cp2, float *p)
-{
- if ((cp1[0] == p[0]) && (cp1[1] == p[1]))
- return 2;
- else if ((cp2[0] == p[0]) && (cp2[1] == p[1]))
- return 3;
- else
- return (p_area_signed(cp1, cp2, p) >= 0.0f);
-}
-
-static void p_polygon_kernel_clip(float (*oldpoints)[2], int noldpoints, float (*newpoints)[2], int *nnewpoints, float *cp1, float *cp2)
-{
- float *p2, *p1, isect[2];
- int i, p2in, p1in;
-
- p1 = oldpoints[noldpoints-1];
- p1in = p_polygon_point_in(cp1, cp2, p1);
- *nnewpoints = 0;
-
- for (i = 0; i < noldpoints; i++) {
- p2 = oldpoints[i];
- p2in = p_polygon_point_in(cp1, cp2, p2);
-
- if ((p2in >= 2) || (p1in && p2in)) {
- newpoints[*nnewpoints][0] = p2[0];
- newpoints[*nnewpoints][1] = p2[1];
- (*nnewpoints)++;
- }
- else if (p1in && !p2in) {
- if (p1in != 3) {
- p_intersect_line_2d(p1, p2, cp1, cp2, isect);
- newpoints[*nnewpoints][0] = isect[0];
- newpoints[*nnewpoints][1] = isect[1];
- (*nnewpoints)++;
- }
- }
- else if (!p1in && p2in) {
- p_intersect_line_2d(p1, p2, cp1, cp2, isect);
- newpoints[*nnewpoints][0] = isect[0];
- newpoints[*nnewpoints][1] = isect[1];
- (*nnewpoints)++;
-
- newpoints[*nnewpoints][0] = p2[0];
- newpoints[*nnewpoints][1] = p2[1];
- (*nnewpoints)++;
- }
-
- p1in = p2in;
- p1 = p2;
- }
-}
-
-static void p_polygon_kernel_center(float (*points)[2], int npoints, float *center)
-{
- int i, size, nnewpoints = npoints;
- float (*oldpoints)[2], (*newpoints)[2], *p1, *p2;
-
- size = npoints*3;
- oldpoints = MEM_mallocN(sizeof(float)*2*size, "PPolygonOldPoints");
- newpoints = MEM_mallocN(sizeof(float)*2*size, "PPolygonNewPoints");
-
- memcpy(oldpoints, points, sizeof(float)*2*npoints);
-
- for (i = 0; i < npoints; i++) {
- p1 = points[i];
- p2 = points[(i+1)%npoints];
- p_polygon_kernel_clip(oldpoints, nnewpoints, newpoints, &nnewpoints, p1, p2);
-
- if (nnewpoints == 0) {
- /* degenerate case, use center of original polygon */
- memcpy(oldpoints, points, sizeof(float)*2*npoints);
- nnewpoints = npoints;
- break;
- }
- else if (nnewpoints == 1) {
- /* degenerate case, use remaining point */
- center[0] = newpoints[0][0];
- center[1] = newpoints[0][1];
-
- MEM_freeN(oldpoints);
- MEM_freeN(newpoints);
-
- return;
- }
-
- if (nnewpoints*2 > size) {
- size *= 2;
- free(oldpoints);
- oldpoints = malloc(sizeof(float)*2*size);
- memcpy(oldpoints, newpoints, sizeof(float)*2*nnewpoints);
- free(newpoints);
- newpoints = malloc(sizeof(float)*2*size);
- }
- else {
- float (*sw_points)[2] = oldpoints;
- oldpoints = newpoints;
- newpoints = sw_points;
- }
- }
-
- center[0] = center[1] = 0.0f;
-
- for (i = 0; i < nnewpoints; i++) {
- center[0] += oldpoints[i][0];
- center[1] += oldpoints[i][1];
- }
-
- center[0] /= nnewpoints;
- center[1] /= nnewpoints;
-
- MEM_freeN(oldpoints);
- MEM_freeN(newpoints);
-}
-#endif
-
-#if 0
-/* Edge Collapser */
-
-int NCOLLAPSE = 1;
-int NCOLLAPSEX = 0;
-
-static float p_vert_cotan(float *v1, float *v2, float *v3)
-{
- float a[3], b[3], c[3], clen;
-
- VecSubf(a, v2, v1);
- VecSubf(b, v3, v1);
- Crossf(c, a, b);
-
- clen = VecLength(c);
-
- if (clen == 0.0f)
- return 0.0f;
-
- return Inpf(a, b)/clen;
-}
-
-static PBool p_vert_flipped_wheel_triangle(PVert *v)
-{
- PEdge *e = v->edge;
-
- do {
- if (p_face_uv_area_signed(e->face) < 0.0f)
- return P_TRUE;
-
- e = p_wheel_edge_next(e);
- } while (e && (e != v->edge));
-
- return P_FALSE;
-}
-
-static PBool p_vert_map_harmonic_weights(PVert *v)
-{
- float weightsum, positionsum[2], olduv[2];
-
- weightsum = 0.0f;
- positionsum[0] = positionsum[1] = 0.0f;
-
- if (p_vert_interior(v)) {
- PEdge *e = v->edge;
-
- do {
- float t1, t2, weight;
- PVert *v1, *v2;
-
- v1 = e->next->vert;
- v2 = e->next->next->vert;
- t1 = p_vert_cotan(v2->co, e->vert->co, v1->co);
-
- v1 = e->pair->next->vert;
- v2 = e->pair->next->next->vert;
- t2 = p_vert_cotan(v2->co, e->pair->vert->co, v1->co);
-
- weight = 0.5f*(t1 + t2);
- weightsum += weight;
- positionsum[0] += weight*e->pair->vert->uv[0];
- positionsum[1] += weight*e->pair->vert->uv[1];
-
- e = p_wheel_edge_next(e);
- } while (e && (e != v->edge));
- }
- else {
- PEdge *e = v->edge;
-
- do {
- float t1, t2;
- PVert *v1, *v2;
-
- v2 = e->next->vert;
- v1 = e->next->next->vert;
-
- t1 = p_vert_cotan(v1->co, v->co, v2->co);
- t2 = p_vert_cotan(v2->co, v->co, v1->co);
-
- weightsum += t1 + t2;
- positionsum[0] += (v2->uv[1] - v1->uv[1]) + (t1*v2->uv[0] + t2*v1->uv[0]);
- positionsum[1] += (v1->uv[0] - v2->uv[0]) + (t1*v2->uv[1] + t2*v1->uv[1]);
-
- e = p_wheel_edge_next(e);
- } while (e && (e != v->edge));
- }
-
- if (weightsum != 0.0f) {
- weightsum = 1.0f/weightsum;
- positionsum[0] *= weightsum;
- positionsum[1] *= weightsum;
- }
-
- olduv[0] = v->uv[0];
- olduv[1] = v->uv[1];
- v->uv[0] = positionsum[0];
- v->uv[1] = positionsum[1];
-
- if (p_vert_flipped_wheel_triangle(v)) {
- v->uv[0] = olduv[0];
- v->uv[1] = olduv[1];
-
- return P_FALSE;
- }
-
- return P_TRUE;
-}
-
-static void p_vert_harmonic_insert(PVert *v)
-{
- PEdge *e;
-
- if (!p_vert_map_harmonic_weights(v)) {
- /* do polygon kernel center insertion: this is quite slow, but should
- only be needed for 0.01 % of verts or so, when insert with harmonic
- weights fails */
-
- int npoints = 0, i;
- float (*points)[2];
-
- e = v->edge;
- do {
- npoints++;
- e = p_wheel_edge_next(e);
- } while (e && (e != v->edge));
-
- if (e == NULL)
- npoints++;
-
- points = MEM_mallocN(sizeof(float)*2*npoints, "PHarmonicPoints");
-
- e = v->edge;
- i = 0;
- do {
- PEdge *nexte = p_wheel_edge_next(e);
-
- points[i][0] = e->next->vert->uv[0];
- points[i][1] = e->next->vert->uv[1];
-
- if (nexte == NULL) {
- i++;
- points[i][0] = e->next->next->vert->uv[0];
- points[i][1] = e->next->next->vert->uv[1];
- break;
- }
-
- e = nexte;
- i++;
- } while (e != v->edge);
-
- p_polygon_kernel_center(points, npoints, v->uv);
-
- MEM_freeN(points);
- }
-
- e = v->edge;
- do {
- if (!(e->next->vert->flag & PVERT_PIN))
- p_vert_map_harmonic_weights(e->next->vert);
- e = p_wheel_edge_next(e);
- } while (e && (e != v->edge));
-
- p_vert_map_harmonic_weights(v);
-}
-
-static void p_vert_fix_edge_pointer(PVert *v)
-{
- PEdge *start = v->edge;
-
- /* set v->edge pointer to the edge with no pair, if there is one */
- while (v->edge->pair) {
- v->edge = p_wheel_edge_prev(v->edge);
-
- if (v->edge == start)
- break;
- }
-}
-
-static void p_collapsing_verts(PEdge *edge, PEdge *pair, PVert **newv, PVert **keepv)
-{
- /* the two vertices that are involved in the collapse */
- if (edge) {
- *newv = edge->vert;
- *keepv = edge->next->vert;
- }
- else {
- *newv = pair->next->vert;
- *keepv = pair->vert;
- }
-}
-
-static void p_collapse_edge(PEdge *edge, PEdge *pair)
-{
- PVert *oldv, *keepv;
- PEdge *e;
-
- p_collapsing_verts(edge, pair, &oldv, &keepv);
-
- /* change e->vert pointers from old vertex to the target vertex */
- e = oldv->edge;
- do {
- if ((e != edge) && !(pair && pair->next == e))
- e->vert = keepv;
-
- e = p_wheel_edge_next(e);
- } while (e && (e != oldv->edge));
-
- /* set keepv->edge pointer */
- if ((edge && (keepv->edge == edge->next)) || (keepv->edge == pair)) {
- if (edge && edge->next->pair)
- keepv->edge = edge->next->pair->next;
- else if (pair && pair->next->next->pair)
- keepv->edge = pair->next->next->pair;
- else if (edge && edge->next->next->pair)
- keepv->edge = edge->next->next->pair;
- else
- keepv->edge = pair->next->pair->next;
- }
-
- /* update pairs and v->edge pointers */
- if (edge) {
- PEdge *e1 = edge->next, *e2 = e1->next;
-
- if (e1->pair)
- e1->pair->pair = e2->pair;
-
- if (e2->pair) {
- e2->pair->pair = e1->pair;
- e2->vert->edge = p_wheel_edge_prev(e2);
- }
- else
- e2->vert->edge = p_wheel_edge_next(e2);
-
- p_vert_fix_edge_pointer(e2->vert);
- }
-
- if (pair) {
- PEdge *e1 = pair->next, *e2 = e1->next;
-
- if (e1->pair)
- e1->pair->pair = e2->pair;
-
- if (e2->pair) {
- e2->pair->pair = e1->pair;
- e2->vert->edge = p_wheel_edge_prev(e2);
- }
- else
- e2->vert->edge = p_wheel_edge_next(e2);
-
- p_vert_fix_edge_pointer(e2->vert);
- }
-
- p_vert_fix_edge_pointer(keepv);
-
- /* mark for move to collapsed list later */
- oldv->flag |= PVERT_COLLAPSE;
-
- if (edge) {
- PFace *f = edge->face;
- PEdge *e1 = edge->next, *e2 = e1->next;
-
- f->flag |= PFACE_COLLAPSE;
- edge->flag |= PEDGE_COLLAPSE;
- e1->flag |= PEDGE_COLLAPSE;
- e2->flag |= PEDGE_COLLAPSE;
- }
-
- if (pair) {
- PFace *f = pair->face;
- PEdge *e1 = pair->next, *e2 = e1->next;
-
- f->flag |= PFACE_COLLAPSE;
- pair->flag |= PEDGE_COLLAPSE;
- e1->flag |= PEDGE_COLLAPSE;
- e2->flag |= PEDGE_COLLAPSE;
- }
-}
-
-static void p_split_vertex(PEdge *edge, PEdge *pair)
-{
- PVert *newv, *keepv;
- PEdge *e;
-
- p_collapsing_verts(edge, pair, &newv, &keepv);
-
- /* update edge pairs */
- if (edge) {
- PEdge *e1 = edge->next, *e2 = e1->next;
-
- if (e1->pair)
- e1->pair->pair = e1;
- if (e2->pair)
- e2->pair->pair = e2;
-
- e2->vert->edge = e2;
- p_vert_fix_edge_pointer(e2->vert);
- keepv->edge = e1;
- }
-
- if (pair) {
- PEdge *e1 = pair->next, *e2 = e1->next;
-
- if (e1->pair)
- e1->pair->pair = e1;
- if (e2->pair)
- e2->pair->pair = e2;
-
- e2->vert->edge = e2;
- p_vert_fix_edge_pointer(e2->vert);
- keepv->edge = pair;
- }
-
- p_vert_fix_edge_pointer(keepv);
-
- /* set e->vert pointers to restored vertex */
- e = newv->edge;
- do {
- e->vert = newv;
- e = p_wheel_edge_next(e);
- } while (e && (e != newv->edge));
-}
-
-static PBool p_collapse_allowed_topologic(PEdge *edge, PEdge *pair)
-{
- PVert *oldv, *keepv;
-
- p_collapsing_verts(edge, pair, &oldv, &keepv);
-
- /* boundary edges */
- if (!edge || !pair) {
- /* avoid collapsing chart into an edge */
- if (edge && !edge->next->pair && !edge->next->next->pair)
- return P_FALSE;
- else if (pair && !pair->next->pair && !pair->next->next->pair)
- return P_FALSE;
- }
- /* avoid merging two boundaries (oldv and keepv are on the 'other side' of
- the chart) */
- else if (!p_vert_interior(oldv) && !p_vert_interior(keepv))
- return P_FALSE;
-
- return P_TRUE;
-}
-
-static PBool p_collapse_normal_flipped(float *v1, float *v2, float *vold, float *vnew)
-{
- float nold[3], nnew[3], sub1[3], sub2[3];
-
- VecSubf(sub1, vold, v1);
- VecSubf(sub2, vold, v2);
- Crossf(nold, sub1, sub2);
-
- VecSubf(sub1, vnew, v1);
- VecSubf(sub2, vnew, v2);
- Crossf(nnew, sub1, sub2);
-
- return (Inpf(nold, nnew) <= 0.0f);
-}
-
-static PBool p_collapse_allowed_geometric(PEdge *edge, PEdge *pair)
-{
- PVert *oldv, *keepv;
- PEdge *e;
- float angulardefect, angle;
-
- p_collapsing_verts(edge, pair, &oldv, &keepv);
-
- angulardefect = 2*M_PI;
-
- e = oldv->edge;
- do {
- float a[3], b[3], minangle, maxangle;
- PEdge *e1 = e->next, *e2 = e1->next;
- PVert *v1 = e1->vert, *v2 = e2->vert;
- int i;
-
- angle = p_vec_angle(v1->co, oldv->co, v2->co);
- angulardefect -= angle;
-
- /* skip collapsing faces */
- if (v1 == keepv || v2 == keepv) {
- e = p_wheel_edge_next(e);
- continue;
- }
-
- if (p_collapse_normal_flipped(v1->co, v2->co, oldv->co, keepv->co))
- return P_FALSE;
-
- a[0] = angle;
- a[1] = p_vec_angle(v2->co, v1->co, oldv->co);
- a[2] = M_PI - a[0] - a[1];
-
- b[0] = p_vec_angle(v1->co, keepv->co, v2->co);
- b[1] = p_vec_angle(v2->co, v1->co, keepv->co);
- b[2] = M_PI - b[0] - b[1];
-
- /* abf criterion 1: avoid sharp and obtuse angles */
- minangle = 15.0f*M_PI/180.0f;
- maxangle = M_PI - minangle;
-
- for (i = 0; i < 3; i++) {
- if ((b[i] < a[i]) && (b[i] < minangle))
- return P_FALSE;
- else if ((b[i] > a[i]) && (b[i] > maxangle))
- return P_FALSE;
- }
-
- e = p_wheel_edge_next(e);
- } while (e && (e != oldv->edge));
-
- if (p_vert_interior(oldv)) {
- /* hlscm criterion: angular defect smaller than threshold */
- if (fabs(angulardefect) > (M_PI*30.0/180.0))
- return P_FALSE;
- }
- else {
- PVert *v1 = p_boundary_edge_next(oldv->edge)->vert;
- PVert *v2 = p_boundary_edge_prev(oldv->edge)->vert;
-
- /* abf++ criterion 2: avoid collapsing verts inwards */
- if (p_vert_interior(keepv))
- return P_FALSE;
-
- /* don't collapse significant boundary changes */
- angle = p_vec_angle(v1->co, oldv->co, v2->co);
- if (angle < (M_PI*160.0/180.0))
- return P_FALSE;
- }
-
- return P_TRUE;
-}
-
-static PBool p_collapse_allowed(PEdge *edge, PEdge *pair)
-{
- PVert *oldv, *keepv;
-
- p_collapsing_verts(edge, pair, &oldv, &keepv);
-
- if (oldv->flag & PVERT_PIN)
- return P_FALSE;
-
- return (p_collapse_allowed_topologic(edge, pair) &&
- p_collapse_allowed_geometric(edge, pair));
-}
-
-static float p_collapse_cost(PEdge *edge, PEdge *pair)
-{
- /* based on volume and boundary optimization from:
- "Fast and Memory Efficient Polygonal Simplification" P. Lindstrom, G. Turk */
-
- PVert *oldv, *keepv;
- PEdge *e;
- PFace *oldf1, *oldf2;
- float volumecost = 0.0f, areacost = 0.0f, edgevec[3], cost, weight, elen;
- float shapecost = 0.0f;
- float shapeold = 0.0f, shapenew = 0.0f;
- int nshapeold = 0, nshapenew = 0;
-
- p_collapsing_verts(edge, pair, &oldv, &keepv);
- oldf1 = (edge)? edge->face: NULL;
- oldf2 = (pair)? pair->face: NULL;
-
- VecSubf(edgevec, keepv->co, oldv->co);
-
- e = oldv->edge;
- do {
- float a1, a2, a3;
- float *co1 = e->next->vert->co;
- float *co2 = e->next->next->vert->co;
-
- if ((e->face != oldf1) && (e->face != oldf2)) {
- float tetrav2[3], tetrav3[3], c[3];
-
- /* tetrahedron volume = (1/3!)*|a.(b x c)| */
- VecSubf(tetrav2, co1, oldv->co);
- VecSubf(tetrav3, co2, oldv->co);
- Crossf(c, tetrav2, tetrav3);
-
- volumecost += fabs(Inpf(edgevec, c)/6.0f);
-#if 0
- shapecost += Inpf(co1, keepv->co);
-
- if (p_wheel_edge_next(e) == NULL)
- shapecost += Inpf(co2, keepv->co);
-#endif
-
- p_triangle_angles(oldv->co, co1, co2, &a1, &a2, &a3);
- a1 = a1 - M_PI/3.0;
- a2 = a2 - M_PI/3.0;
- a3 = a3 - M_PI/3.0;
- shapeold = (a1*a1 + a2*a2 + a3*a3)/((M_PI/2)*(M_PI/2));
-
- nshapeold++;
- }
- else {
- p_triangle_angles(keepv->co, co1, co2, &a1, &a2, &a3);
- a1 = a1 - M_PI/3.0;
- a2 = a2 - M_PI/3.0;
- a3 = a3 - M_PI/3.0;
- shapenew = (a1*a1 + a2*a2 + a3*a3)/((M_PI/2)*(M_PI/2));
-
- nshapenew++;
- }
-
- e = p_wheel_edge_next(e);
- } while (e && (e != oldv->edge));
-
- if (!p_vert_interior(oldv)) {
- PVert *v1 = p_boundary_edge_prev(oldv->edge)->vert;
- PVert *v2 = p_boundary_edge_next(oldv->edge)->vert;
-
- areacost = AreaT3Dfl(oldv->co, v1->co, v2->co);
- }
-
- elen = VecLength(edgevec);
- weight = 1.0f; /* 0.2f */
- cost = weight*volumecost*volumecost + elen*elen*areacost*areacost;
-#if 0
- cost += shapecost;
-#else
- shapeold /= nshapeold;
- shapenew /= nshapenew;
- shapecost = (shapeold + 0.00001)/(shapenew + 0.00001);
-
- cost *= shapecost;
-#endif
-
- return cost;
-}
-
-static void p_collapse_cost_vertex(PVert *vert, float *mincost, PEdge **mine)
-{
- PEdge *e, *enext, *pair;
-
- *mine = NULL;
- *mincost = 0.0f;
- e = vert->edge;
- do {
- if (p_collapse_allowed(e, e->pair)) {
- float cost = p_collapse_cost(e, e->pair);
-
- if ((*mine == NULL) || (cost < *mincost)) {
- *mincost = cost;
- *mine = e;
- }
- }
-
- enext = p_wheel_edge_next(e);
-
- if (enext == NULL) {
- /* the other boundary edge, where we only have the pair halfedge */
- pair = e->next->next;
-
- if (p_collapse_allowed(NULL, pair)) {
- float cost = p_collapse_cost(NULL, pair);
-
- if ((*mine == NULL) || (cost < *mincost)) {
- *mincost = cost;
- *mine = pair;
- }
- }
-
- break;
- }
-
- e = enext;
- } while (e != vert->edge);
-}
-
-static void p_chart_post_collapse_flush(PChart *chart, PEdge *collapsed)
-{
- /* move to collapsed_ */
-
- PVert *v, *nextv = NULL, *verts = chart->verts;
- PEdge *e, *nexte = NULL, *edges = chart->edges, *laste = NULL;
- PFace *f, *nextf = NULL, *faces = chart->faces;
-
- chart->verts = chart->collapsed_verts = NULL;
- chart->edges = chart->collapsed_edges = NULL;
- chart->faces = chart->collapsed_faces = NULL;
-
- chart->nverts = chart->nedges = chart->nfaces = 0;
-
- for (v=verts; v; v=nextv) {
- nextv = v->nextlink;
-
- if (v->flag & PVERT_COLLAPSE) {
- v->nextlink = chart->collapsed_verts;
- chart->collapsed_verts = v;
- }
- else {
- v->nextlink = chart->verts;
- chart->verts = v;
- chart->nverts++;
- }
- }
-
- for (e=edges; e; e=nexte) {
- nexte = e->nextlink;
-
- if (!collapsed || !(e->flag & PEDGE_COLLAPSE_EDGE)) {
- if (e->flag & PEDGE_COLLAPSE) {
- e->nextlink = chart->collapsed_edges;
- chart->collapsed_edges = e;
- }
- else {
- e->nextlink = chart->edges;
- chart->edges = e;
- chart->nedges++;
- }
- }
- }
-
- /* these are added last so they can be popped of in the right order
- for splitting */
- for (e=collapsed; e; e=e->nextlink) {
- e->nextlink = e->u.nextcollapse;
- laste = e;
- }
- if (laste) {
- laste->nextlink = chart->collapsed_edges;
- chart->collapsed_edges = collapsed;
- }
-
- for (f=faces; f; f=nextf) {
- nextf = f->nextlink;
-
- if (f->flag & PFACE_COLLAPSE) {
- f->nextlink = chart->collapsed_faces;
- chart->collapsed_faces = f;
- }
- else {
- f->nextlink = chart->faces;
- chart->faces = f;
- chart->nfaces++;
- }
- }
-}
-
-static void p_chart_post_split_flush(PChart *chart)
-{
- /* move from collapsed_ */
-
- PVert *v, *nextv = NULL;
- PEdge *e, *nexte = NULL;
- PFace *f, *nextf = NULL;
-
- for (v=chart->collapsed_verts; v; v=nextv) {
- nextv = v->nextlink;
- v->nextlink = chart->verts;
- chart->verts = v;
- chart->nverts++;
- }
-
- for (e=chart->collapsed_edges; e; e=nexte) {
- nexte = e->nextlink;
- e->nextlink = chart->edges;
- chart->edges = e;
- chart->nedges++;
- }
-
- for (f=chart->collapsed_faces; f; f=nextf) {
- nextf = f->nextlink;
- f->nextlink = chart->faces;
- chart->faces = f;
- chart->nfaces++;
- }
-
- chart->collapsed_verts = NULL;
- chart->collapsed_edges = NULL;
- chart->collapsed_faces = NULL;
-}
-
-static void p_chart_simplify_compute(PChart *chart)
-{
- /* Computes a list of edge collapses / vertex splits. The collapsed
- simplices go in the chart->collapsed_* lists, The original and
- collapsed may then be view as stacks, where the next collapse/split
- is at the top of the respective lists. */
-
- Heap *heap = BLI_heap_new();
- PVert *v, **wheelverts;
- PEdge *collapsededges = NULL, *e;
- int nwheelverts, i, ncollapsed = 0;
-
- wheelverts = MEM_mallocN(sizeof(PVert*)*chart->nverts, "PChartWheelVerts");
-
- /* insert all potential collapses into heap */
- for (v=chart->verts; v; v=v->nextlink) {
- float cost;
- PEdge *e = NULL;
-
- p_collapse_cost_vertex(v, &cost, &e);
-
- if (e)
- v->u.heaplink = BLI_heap_insert(heap, cost, e);
- else
- v->u.heaplink = NULL;
- }
-
- for (e=chart->edges; e; e=e->nextlink)
- e->u.nextcollapse = NULL;
-
- /* pop edge collapse out of heap one by one */
- while (!BLI_heap_empty(heap)) {
- if (ncollapsed == NCOLLAPSE)
- break;
-
- HeapNode *link = BLI_heap_top(heap);
- PEdge *edge = (PEdge*)BLI_heap_popmin(heap), *pair = edge->pair;
- PVert *oldv, *keepv;
- PEdge *wheele, *nexte;
-
- /* remember the edges we collapsed */
- edge->u.nextcollapse = collapsededges;
- collapsededges = edge;
-
- if (edge->vert->u.heaplink != link) {
- edge->flag |= (PEDGE_COLLAPSE_EDGE|PEDGE_COLLAPSE_PAIR);
- edge->next->vert->u.heaplink = NULL;
- SWAP(PEdge*, edge, pair);
- }
- else {
- edge->flag |= PEDGE_COLLAPSE_EDGE;
- edge->vert->u.heaplink = NULL;
- }
-
- p_collapsing_verts(edge, pair, &oldv, &keepv);
-
- /* gather all wheel verts and remember them before collapse */
- nwheelverts = 0;
- wheele = oldv->edge;
-
- do {
- wheelverts[nwheelverts++] = wheele->next->vert;
- nexte = p_wheel_edge_next(wheele);
-
- if (nexte == NULL)
- wheelverts[nwheelverts++] = wheele->next->next->vert;
-
- wheele = nexte;
- } while (wheele && (wheele != oldv->edge));
-
- /* collapse */
- p_collapse_edge(edge, pair);
-
- for (i = 0; i < nwheelverts; i++) {
- float cost;
- PEdge *collapse = NULL;
-
- v = wheelverts[i];
-
- if (v->u.heaplink) {
- BLI_heap_remove(heap, v->u.heaplink);
- v->u.heaplink = NULL;
- }
-
- p_collapse_cost_vertex(v, &cost, &collapse);
-
- if (collapse)
- v->u.heaplink = BLI_heap_insert(heap, cost, collapse);
- }
-
- ncollapsed++;
- }
-
- MEM_freeN(wheelverts);
- BLI_heap_free(heap, NULL);
-
- p_chart_post_collapse_flush(chart, collapsededges);
-}
-
-static void p_chart_complexify(PChart *chart)
-{
- PEdge *e, *pair, *edge;
- PVert *newv, *keepv;
- int x = 0;
-
- for (e=chart->collapsed_edges; e; e=e->nextlink) {
- if (!(e->flag & PEDGE_COLLAPSE_EDGE))
- break;
-
- edge = e;
- pair = e->pair;
-
- if (edge->flag & PEDGE_COLLAPSE_PAIR) {
- SWAP(PEdge*, edge, pair);
- }
-
- p_split_vertex(edge, pair);
- p_collapsing_verts(edge, pair, &newv, &keepv);
-
- if (x >= NCOLLAPSEX) {
- newv->uv[0] = keepv->uv[0];
- newv->uv[1] = keepv->uv[1];
- }
- else {
- p_vert_harmonic_insert(newv);
- x++;
- }
- }
-
- p_chart_post_split_flush(chart);
-}
-
-#if 0
-static void p_chart_simplify(PChart *chart)
-{
- /* Not implemented, needs proper reordering in split_flush. */
-}
-#endif
-#endif
-
-/* ABF */
-
-#define ABF_MAX_ITER 20
-
-typedef struct PAbfSystem {
- int ninterior, nfaces, nangles;
- float *alpha, *beta, *sine, *cosine, *weight;
- float *bAlpha, *bTriangle, *bInterior;
- float *lambdaTriangle, *lambdaPlanar, *lambdaLength;
- float (*J2dt)[3], *bstar, *dstar;
- float minangle, maxangle;
-} PAbfSystem;
-
-static void p_abf_setup_system(PAbfSystem *sys)
-{
- int i;
-
- sys->alpha = (float*)MEM_mallocN(sizeof(float)*sys->nangles, "ABFalpha");
- sys->beta = (float*)MEM_mallocN(sizeof(float)*sys->nangles, "ABFbeta");
- sys->sine = (float*)MEM_mallocN(sizeof(float)*sys->nangles, "ABFsine");
- sys->cosine = (float*)MEM_mallocN(sizeof(float)*sys->nangles, "ABFcosine");
- sys->weight = (float*)MEM_mallocN(sizeof(float)*sys->nangles, "ABFweight");
-
- sys->bAlpha = (float*)MEM_mallocN(sizeof(float)*sys->nangles, "ABFbalpha");
- sys->bTriangle = (float*)MEM_mallocN(sizeof(float)*sys->nfaces, "ABFbtriangle");
- sys->bInterior = (float*)MEM_mallocN(sizeof(float)*2*sys->ninterior, "ABFbinterior");
-
- sys->lambdaTriangle = (float*)MEM_callocN(sizeof(float)*sys->nfaces, "ABFlambdatri");
- sys->lambdaPlanar = (float*)MEM_callocN(sizeof(float)*sys->ninterior, "ABFlamdaplane");
- sys->lambdaLength = (float*)MEM_mallocN(sizeof(float)*sys->ninterior, "ABFlambdalen");
-
- sys->J2dt = MEM_mallocN(sizeof(float)*sys->nangles*3, "ABFj2dt");
- sys->bstar = (float*)MEM_mallocN(sizeof(float)*sys->nfaces, "ABFbstar");
- sys->dstar = (float*)MEM_mallocN(sizeof(float)*sys->nfaces, "ABFdstar");
-
- for (i = 0; i < sys->ninterior; i++)
- sys->lambdaLength[i] = 1.0;
-
- sys->minangle = 7.5f*M_PI/180.0f;
- sys->maxangle = M_PI - sys->minangle;
-}
-
-static void p_abf_free_system(PAbfSystem *sys)
-{
- MEM_freeN(sys->alpha);
- MEM_freeN(sys->beta);
- MEM_freeN(sys->sine);
- MEM_freeN(sys->cosine);
- MEM_freeN(sys->weight);
- MEM_freeN(sys->bAlpha);
- MEM_freeN(sys->bTriangle);
- MEM_freeN(sys->bInterior);
- MEM_freeN(sys->lambdaTriangle);
- MEM_freeN(sys->lambdaPlanar);
- MEM_freeN(sys->lambdaLength);
- MEM_freeN(sys->J2dt);
- MEM_freeN(sys->bstar);
- MEM_freeN(sys->dstar);
-}
-
-static void p_abf_compute_sines(PAbfSystem *sys)
-{
- int i;
- float *sine = sys->sine, *cosine = sys->cosine, *alpha = sys->alpha;
-
- for (i = 0; i < sys->nangles; i++, sine++, cosine++, alpha++) {
- *sine = sin(*alpha);
- *cosine = cos(*alpha);
- }
-}
-
-static float p_abf_compute_sin_product(PAbfSystem *sys, PVert *v, int aid)
-{
- PEdge *e, *e1, *e2;
- float sin1, sin2;
-
- sin1 = sin2 = 1.0;
-
- e = v->edge;
- do {
- e1 = e->next;
- e2 = e->next->next;
-
- if (aid == e1->u.id) {
- /* we are computing a derivative for this angle,
- so we use cos and drop the other part */
- sin1 *= sys->cosine[e1->u.id];
- sin2 = 0.0;
- }
- else
- sin1 *= sys->sine[e1->u.id];
-
- if (aid == e2->u.id) {
- /* see above */
- sin1 = 0.0;
- sin2 *= sys->cosine[e2->u.id];
- }
- else
- sin2 *= sys->sine[e2->u.id];
-
- e = e->next->next->pair;
- } while (e && (e != v->edge));
-
- return (sin1 - sin2);
-}
-
-static float p_abf_compute_grad_alpha(PAbfSystem *sys, PFace *f, PEdge *e)
-{
- PVert *v = e->vert, *v1 = e->next->vert, *v2 = e->next->next->vert;
- float deriv;
-
- deriv = (sys->alpha[e->u.id] - sys->beta[e->u.id])*sys->weight[e->u.id];
- deriv += sys->lambdaTriangle[f->u.id];
-
- if (v->flag & PVERT_INTERIOR) {
- deriv += sys->lambdaPlanar[v->u.id];
- }
-
- if (v1->flag & PVERT_INTERIOR) {
- float product = p_abf_compute_sin_product(sys, v1, e->u.id);
- deriv += sys->lambdaLength[v1->u.id]*product;
- }
-
- if (v2->flag & PVERT_INTERIOR) {
- float product = p_abf_compute_sin_product(sys, v2, e->u.id);
- deriv += sys->lambdaLength[v2->u.id]*product;
- }
-
- return deriv;
-}
-
-static float p_abf_compute_gradient(PAbfSystem *sys, PChart *chart)
-{
- PFace *f;
- PEdge *e;
- PVert *v;
- float norm = 0.0;
-
- for (f=chart->faces; f; f=f->nextlink) {
- PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next;
- float gtriangle, galpha1, galpha2, galpha3;
-
- galpha1 = p_abf_compute_grad_alpha(sys, f, e1);
- galpha2 = p_abf_compute_grad_alpha(sys, f, e2);
- galpha3 = p_abf_compute_grad_alpha(sys, f, e3);
-
- sys->bAlpha[e1->u.id] = -galpha1;
- sys->bAlpha[e2->u.id] = -galpha2;
- sys->bAlpha[e3->u.id] = -galpha3;
-
- norm += galpha1*galpha1 + galpha2*galpha2 + galpha3*galpha3;
-
- gtriangle = sys->alpha[e1->u.id] + sys->alpha[e2->u.id] + sys->alpha[e3->u.id] - M_PI;
- sys->bTriangle[f->u.id] = -gtriangle;
- norm += gtriangle*gtriangle;
- }
-
- for (v=chart->verts; v; v=v->nextlink) {
- if (v->flag & PVERT_INTERIOR) {
- float gplanar = -2*M_PI, glength;
-
- e = v->edge;
- do {
- gplanar += sys->alpha[e->u.id];
- e = e->next->next->pair;
- } while (e && (e != v->edge));
-
- sys->bInterior[v->u.id] = -gplanar;
- norm += gplanar*gplanar;
-
- glength = p_abf_compute_sin_product(sys, v, -1);
- sys->bInterior[sys->ninterior + v->u.id] = -glength;
- norm += glength*glength;
- }
- }
-
- return norm;
-}
-
-static PBool p_abf_matrix_invert(PAbfSystem *sys, PChart *chart)
-{
- PFace *f;
- PEdge *e;
- int i, j, ninterior = sys->ninterior, nvar = 2*sys->ninterior;
- PBool success;
-
- nlNewContext();
- nlSolverParameteri(NL_NB_VARIABLES, nvar);
-
- nlBegin(NL_SYSTEM);
-
- nlBegin(NL_MATRIX);
-
- for (i = 0; i < nvar; i++)
- nlRightHandSideAdd(0, i, sys->bInterior[i]);
-
- for (f=chart->faces; f; f=f->nextlink) {
- float wi1, wi2, wi3, b, si, beta[3], j2[3][3], W[3][3];
- float row1[6], row2[6], row3[6];
- int vid[6];
- PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next;
- PVert *v1 = e1->vert, *v2 = e2->vert, *v3 = e3->vert;
-
- wi1 = 1.0/sys->weight[e1->u.id];
- wi2 = 1.0/sys->weight[e2->u.id];
- wi3 = 1.0/sys->weight[e3->u.id];
-
- /* bstar1 = (J1*dInv*bAlpha - bTriangle) */
- b = sys->bAlpha[e1->u.id]*wi1;
- b += sys->bAlpha[e2->u.id]*wi2;
- b += sys->bAlpha[e3->u.id]*wi3;
- b -= sys->bTriangle[f->u.id];
-
- /* si = J1*d*J1t */
- si = 1.0/(wi1 + wi2 + wi3);
-
- /* J1t*si*bstar1 - bAlpha */
- beta[0] = b*si - sys->bAlpha[e1->u.id];
- beta[1] = b*si - sys->bAlpha[e2->u.id];
- beta[2] = b*si - sys->bAlpha[e3->u.id];
-
- /* use this later for computing other lambda's */
- sys->bstar[f->u.id] = b;
- sys->dstar[f->u.id] = si;
-
- /* set matrix */
- W[0][0] = si - sys->weight[e1->u.id]; W[0][1] = si; W[0][2] = si;
- W[1][0] = si; W[1][1] = si - sys->weight[e2->u.id]; W[1][2] = si;
- W[2][0] = si; W[2][1] = si; W[2][2] = si - sys->weight[e3->u.id];
-
- vid[0] = vid[1] = vid[2] = vid[3] = vid[4] = vid[5] = -1;
-
- if (v1->flag & PVERT_INTERIOR) {
- vid[0] = v1->u.id;
- vid[3] = ninterior + v1->u.id;
-
- sys->J2dt[e1->u.id][0] = j2[0][0] = 1.0*wi1;
- sys->J2dt[e2->u.id][0] = j2[1][0] = p_abf_compute_sin_product(sys, v1, e2->u.id)*wi2;
- sys->J2dt[e3->u.id][0] = j2[2][0] = p_abf_compute_sin_product(sys, v1, e3->u.id)*wi3;
-
- nlRightHandSideAdd(0, v1->u.id, j2[0][0]*beta[0]);
- nlRightHandSideAdd(0, ninterior + v1->u.id, j2[1][0]*beta[1] + j2[2][0]*beta[2]);
-
- row1[0] = j2[0][0]*W[0][0];
- row2[0] = j2[0][0]*W[1][0];
- row3[0] = j2[0][0]*W[2][0];
-
- row1[3] = j2[1][0]*W[0][1] + j2[2][0]*W[0][2];
- row2[3] = j2[1][0]*W[1][1] + j2[2][0]*W[1][2];
- row3[3] = j2[1][0]*W[2][1] + j2[2][0]*W[2][2];
- }
-
- if (v2->flag & PVERT_INTERIOR) {
- vid[1] = v2->u.id;
- vid[4] = ninterior + v2->u.id;
-
- sys->J2dt[e1->u.id][1] = j2[0][1] = p_abf_compute_sin_product(sys, v2, e1->u.id)*wi1;
- sys->J2dt[e2->u.id][1] = j2[1][1] = 1.0*wi2;
- sys->J2dt[e3->u.id][1] = j2[2][1] = p_abf_compute_sin_product(sys, v2, e3->u.id)*wi3;
-
- nlRightHandSideAdd(0, v2->u.id, j2[1][1]*beta[1]);
- nlRightHandSideAdd(0, ninterior + v2->u.id, j2[0][1]*beta[0] + j2[2][1]*beta[2]);
-
- row1[1] = j2[1][1]*W[0][1];
- row2[1] = j2[1][1]*W[1][1];
- row3[1] = j2[1][1]*W[2][1];
-
- row1[4] = j2[0][1]*W[0][0] + j2[2][1]*W[0][2];
- row2[4] = j2[0][1]*W[1][0] + j2[2][1]*W[1][2];
- row3[4] = j2[0][1]*W[2][0] + j2[2][1]*W[2][2];
- }
-
- if (v3->flag & PVERT_INTERIOR) {
- vid[2] = v3->u.id;
- vid[5] = ninterior + v3->u.id;
-
- sys->J2dt[e1->u.id][2] = j2[0][2] = p_abf_compute_sin_product(sys, v3, e1->u.id)*wi1;
- sys->J2dt[e2->u.id][2] = j2[1][2] = p_abf_compute_sin_product(sys, v3, e2->u.id)*wi2;
- sys->J2dt[e3->u.id][2] = j2[2][2] = 1.0*wi3;
-
- nlRightHandSideAdd(0, v3->u.id, j2[2][2]*beta[2]);
- nlRightHandSideAdd(0, ninterior + v3->u.id, j2[0][2]*beta[0] + j2[1][2]*beta[1]);
-
- row1[2] = j2[2][2]*W[0][2];
- row2[2] = j2[2][2]*W[1][2];
- row3[2] = j2[2][2]*W[2][2];
-
- row1[5] = j2[0][2]*W[0][0] + j2[1][2]*W[0][1];
- row2[5] = j2[0][2]*W[1][0] + j2[1][2]*W[1][1];
- row3[5] = j2[0][2]*W[2][0] + j2[1][2]*W[2][1];
- }
-
- for (i = 0; i < 3; i++) {
- int r = vid[i];
-
- if (r == -1)
- continue;
-
- for (j = 0; j < 6; j++) {
- int c = vid[j];
-
- if (c == -1)
- continue;
-
- if (i == 0)
- nlMatrixAdd(r, c, j2[0][i]*row1[j]);
- else
- nlMatrixAdd(r + ninterior, c, j2[0][i]*row1[j]);
-
- if (i == 1)
- nlMatrixAdd(r, c, j2[1][i]*row2[j]);
- else
- nlMatrixAdd(r + ninterior, c, j2[1][i]*row2[j]);
-
-
- if (i == 2)
- nlMatrixAdd(r, c, j2[2][i]*row3[j]);
- else
- nlMatrixAdd(r + ninterior, c, j2[2][i]*row3[j]);
- }
- }
- }
-
- nlEnd(NL_MATRIX);
-
- nlEnd(NL_SYSTEM);
-
- success = nlSolve();
-
- if (success) {
- for (f=chart->faces; f; f=f->nextlink) {
- float dlambda1, pre[3], dalpha;
- PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next;
- PVert *v1 = e1->vert, *v2 = e2->vert, *v3 = e3->vert;
-
- pre[0] = pre[1] = pre[2] = 0.0;
-
- if (v1->flag & PVERT_INTERIOR) {
- float x = nlGetVariable(0, v1->u.id);
- float x2 = nlGetVariable(0, ninterior + v1->u.id);
- pre[0] += sys->J2dt[e1->u.id][0]*x;
- pre[1] += sys->J2dt[e2->u.id][0]*x2;
- pre[2] += sys->J2dt[e3->u.id][0]*x2;
- }
-
- if (v2->flag & PVERT_INTERIOR) {
- float x = nlGetVariable(0, v2->u.id);
- float x2 = nlGetVariable(0, ninterior + v2->u.id);
- pre[0] += sys->J2dt[e1->u.id][1]*x2;
- pre[1] += sys->J2dt[e2->u.id][1]*x;
- pre[2] += sys->J2dt[e3->u.id][1]*x2;
- }
-
- if (v3->flag & PVERT_INTERIOR) {
- float x = nlGetVariable(0, v3->u.id);
- float x2 = nlGetVariable(0, ninterior + v3->u.id);
- pre[0] += sys->J2dt[e1->u.id][2]*x2;
- pre[1] += sys->J2dt[e2->u.id][2]*x2;
- pre[2] += sys->J2dt[e3->u.id][2]*x;
- }
-
- dlambda1 = pre[0] + pre[1] + pre[2];
- dlambda1 = sys->dstar[f->u.id]*(sys->bstar[f->u.id] - dlambda1);
-
- sys->lambdaTriangle[f->u.id] += dlambda1;
-
- dalpha = (sys->bAlpha[e1->u.id] - dlambda1);
- sys->alpha[e1->u.id] += dalpha/sys->weight[e1->u.id] - pre[0];
-
- dalpha = (sys->bAlpha[e2->u.id] - dlambda1);
- sys->alpha[e2->u.id] += dalpha/sys->weight[e2->u.id] - pre[1];
-
- dalpha = (sys->bAlpha[e3->u.id] - dlambda1);
- sys->alpha[e3->u.id] += dalpha/sys->weight[e3->u.id] - pre[2];
-
- /* clamp */
- e = f->edge;
- do {
- if (sys->alpha[e->u.id] > M_PI)
- sys->alpha[e->u.id] = M_PI;
- else if (sys->alpha[e->u.id] < 0.0f)
- sys->alpha[e->u.id] = 0.0f;
- } while (e != f->edge);
- }
-
- for (i = 0; i < ninterior; i++) {
- sys->lambdaPlanar[i] += nlGetVariable(0, i);
- sys->lambdaLength[i] += nlGetVariable(0, ninterior + i);
- }
- }
-
- nlDeleteContext(nlGetCurrent());
-
- return success;
-}
-
-static PBool p_chart_abf_solve(PChart *chart)
-{
- PVert *v;
- PFace *f;
- PEdge *e, *e1, *e2, *e3;
- PAbfSystem sys;
- int i;
- float lastnorm, limit = (chart->nfaces > 100)? 1.0f: 0.001f;
-
- /* setup id's */
- sys.ninterior = sys.nfaces = sys.nangles = 0;
-
- for (v=chart->verts; v; v=v->nextlink) {
- if (p_vert_interior(v)) {
- v->flag |= PVERT_INTERIOR;
- v->u.id = sys.ninterior++;
- }
- else
- v->flag &= ~PVERT_INTERIOR;
- }
-
- for (f=chart->faces; f; f=f->nextlink) {
- e1 = f->edge; e2 = e1->next; e3 = e2->next;
- f->u.id = sys.nfaces++;
-
- /* angle id's are conveniently stored in half edges */
- e1->u.id = sys.nangles++;
- e2->u.id = sys.nangles++;
- e3->u.id = sys.nangles++;
- }
-
- p_abf_setup_system(&sys);
-
- /* compute initial angles */
- for (f=chart->faces; f; f=f->nextlink) {
- float a1, a2, a3;
-
- e1 = f->edge; e2 = e1->next; e3 = e2->next;
- p_face_angles(f, &a1, &a2, &a3);
-
- if (a1 < sys.minangle)
- a1 = sys.minangle;
- else if (a1 > sys.maxangle)
- a1 = sys.maxangle;
- if (a2 < sys.minangle)
- a2 = sys.minangle;
- else if (a2 > sys.maxangle)
- a2 = sys.maxangle;
- if (a3 < sys.minangle)
- a3 = sys.minangle;
- else if (a3 > sys.maxangle)
- a3 = sys.maxangle;
-
- sys.alpha[e1->u.id] = sys.beta[e1->u.id] = a1;
- sys.alpha[e2->u.id] = sys.beta[e2->u.id] = a2;
- sys.alpha[e3->u.id] = sys.beta[e3->u.id] = a3;
-
- sys.weight[e1->u.id] = 2.0/(a1*a1);
- sys.weight[e2->u.id] = 2.0/(a2*a2);
- sys.weight[e3->u.id] = 2.0/(a3*a3);
- }
-
- for (v=chart->verts; v; v=v->nextlink) {
- if (v->flag & PVERT_INTERIOR) {
- float anglesum = 0.0, scale;
-
- e = v->edge;
- do {
- anglesum += sys.beta[e->u.id];
- e = e->next->next->pair;
- } while (e && (e != v->edge));
-
- scale = (anglesum == 0.0f)? 0.0f: 2*M_PI/anglesum;
-
- e = v->edge;
- do {
- sys.beta[e->u.id] = sys.alpha[e->u.id] = sys.beta[e->u.id]*scale;
- e = e->next->next->pair;
- } while (e && (e != v->edge));
- }
- }
-
- if (sys.ninterior > 0) {
- p_abf_compute_sines(&sys);
-
- /* iteration */
- lastnorm = 1e10;
-
- for (i = 0; i < ABF_MAX_ITER; i++) {
- float norm = p_abf_compute_gradient(&sys, chart);
-
- lastnorm = norm;
-
- if (norm < limit)
- break;
-
- if (!p_abf_matrix_invert(&sys, chart)) {
- param_warning("ABF failed to invert matrix.");
- p_abf_free_system(&sys);
- return P_FALSE;
- }
-
- p_abf_compute_sines(&sys);
- }
-
- if (i == ABF_MAX_ITER) {
- param_warning("ABF maximum iterations reached.");
- p_abf_free_system(&sys);
- return P_FALSE;
- }
- }
-
- chart->u.lscm.abf_alpha = MEM_dupallocN(sys.alpha);
- p_abf_free_system(&sys);
-
- return P_TRUE;
-}
-
-/* Least Squares Conformal Maps */
-
-static void p_chart_pin_positions(PChart *chart, PVert **pin1, PVert **pin2)
-{
- if (pin1 == pin2) {
- /* degenerate case */
- PFace *f = chart->faces;
- *pin1 = f->edge->vert;
- *pin2 = f->edge->next->vert;
-
- (*pin1)->uv[0] = 0.0f;
- (*pin1)->uv[1] = 0.5f;
- (*pin2)->uv[0] = 1.0f;
- (*pin2)->uv[1] = 0.5f;
- }
- else {
- int diru, dirv, dirx, diry;
- float sub[3];
-
- VecSubf(sub, (*pin1)->co, (*pin2)->co);
- sub[0] = fabs(sub[0]);
- sub[1] = fabs(sub[1]);
- sub[2] = fabs(sub[2]);
-
- if ((sub[0] > sub[1]) && (sub[0] > sub[2])) {
- dirx = 0;
- diry = (sub[1] > sub[2])? 1: 2;
- }
- else if ((sub[1] > sub[0]) && (sub[1] > sub[2])) {
- dirx = 1;
- diry = (sub[0] > sub[2])? 0: 2;
- }
- else {
- dirx = 2;
- diry = (sub[0] > sub[1])? 0: 1;
- }
-
- if (dirx == 2) {
- diru = 1;
- dirv = 0;
- }
- else {
- diru = 0;
- dirv = 1;
- }
-
- (*pin1)->uv[diru] = (*pin1)->co[dirx];
- (*pin1)->uv[dirv] = (*pin1)->co[diry];
- (*pin2)->uv[diru] = (*pin2)->co[dirx];
- (*pin2)->uv[dirv] = (*pin2)->co[diry];
- }
-}
-
-static PBool p_chart_symmetry_pins(PChart *chart, PEdge *outer, PVert **pin1, PVert **pin2)
-{
- PEdge *be, *lastbe = NULL, *maxe1 = NULL, *maxe2 = NULL, *be1, *be2;
- PEdge *cure = NULL, *firste1 = NULL, *firste2 = NULL, *nextbe;
- float maxlen = 0.0f, curlen = 0.0f, totlen = 0.0f, firstlen = 0.0f;
- float len1, len2;
-
- /* find longest series of verts split in the chart itself, these are
- marked during construction */
- be = outer;
- lastbe = p_boundary_edge_prev(be);
- do {
- float len = p_edge_length(be);
- totlen += len;
-
- nextbe = p_boundary_edge_next(be);
-
- if ((be->vert->flag & PVERT_SPLIT) ||
- (lastbe->vert->flag & nextbe->vert->flag & PVERT_SPLIT)) {
- if (!cure) {
- if (be == outer)
- firste1 = be;
- cure = be;
- }
- else
- curlen += p_edge_length(lastbe);
- }
- else if (cure) {
- if (curlen > maxlen) {
- maxlen = curlen;
- maxe1 = cure;
- maxe2 = lastbe;
- }
-
- if (firste1 == cure) {
- firstlen = curlen;
- firste2 = lastbe;
- }
-
- curlen = 0.0f;
- cure = NULL;
- }
-
- lastbe = be;
- be = nextbe;
- } while(be != outer);
-
- /* make sure we also count a series of splits over the starting point */
- if (cure && (cure != outer)) {
- firstlen += curlen + p_edge_length(be);
-
- if (firstlen > maxlen) {
- maxlen = firstlen;
- maxe1 = cure;
- maxe2 = firste2;
- }
- }
-
- if (!maxe1 || !maxe2 || (maxlen < 0.5f*totlen))
- return P_FALSE;
-
- /* find pin1 in the split vertices */
- be1 = maxe1;
- be2 = maxe2;
- len1 = 0.0f;
- len2 = 0.0f;
-
- do {
- if (len1 < len2) {
- len1 += p_edge_length(be1);
- be1 = p_boundary_edge_next(be1);
- }
- else {
- be2 = p_boundary_edge_prev(be2);
- len2 += p_edge_length(be2);
- }
- } while (be1 != be2);
-
- *pin1 = be1->vert;
-
- /* find pin2 outside the split vertices */
- be1 = maxe1;
- be2 = maxe2;
- len1 = 0.0f;
- len2 = 0.0f;
-
- do {
- if (len1 < len2) {
- be1 = p_boundary_edge_prev(be1);
- len1 += p_edge_length(be1);
- }
- else {
- len2 += p_edge_length(be2);
- be2 = p_boundary_edge_next(be2);
- }
- } while (be1 != be2);
-
- *pin2 = be1->vert;
-
- p_chart_pin_positions(chart, pin1, pin2);
-
- return P_TRUE;
-}
-
-static void p_chart_extrema_verts(PChart *chart, PVert **pin1, PVert **pin2)
-{
- float minv[3], maxv[3], dirlen;
- PVert *v, *minvert[3], *maxvert[3];
- int i, dir;
-
- /* find minimum and maximum verts over x/y/z axes */
- minv[0] = minv[1] = minv[2] = 1e20;
- maxv[0] = maxv[1] = maxv[2] = -1e20;
-
- minvert[0] = minvert[1] = minvert[2] = NULL;
- maxvert[0] = maxvert[1] = maxvert[2] = NULL;
-
- for (v = chart->verts; v; v=v->nextlink) {
- for (i = 0; i < 3; i++) {
- if (v->co[i] < minv[i]) {
- minv[i] = v->co[i];
- minvert[i] = v;
- }
- if (v->co[i] > maxv[i]) {
- maxv[i] = v->co[i];
- maxvert[i] = v;
- }
- }
- }
-
- /* find axes with longest distance */
- dir = 0;
- dirlen = -1.0;
-
- for (i = 0; i < 3; i++) {
- if (maxv[i] - minv[i] > dirlen) {
- dir = i;
- dirlen = maxv[i] - minv[i];
- }
- }
-
- *pin1 = minvert[dir];
- *pin2 = maxvert[dir];
-
- p_chart_pin_positions(chart, pin1, pin2);
-}
-
-static void p_chart_lscm_load_solution(PChart *chart)
-{
- PVert *v;
-
- for (v=chart->verts; v; v=v->nextlink) {
- v->uv[0] = nlGetVariable(0, 2*v->u.id);
- v->uv[1] = nlGetVariable(0, 2*v->u.id + 1);
- }
-}
-
-static void p_chart_lscm_begin(PChart *chart, PBool live, PBool abf)
-{
- PVert *v, *pin1, *pin2;
- PBool select = P_FALSE, deselect = P_FALSE;
- int npins = 0, id = 0;
-
- /* give vertices matrix indices and count pins */
- for (v=chart->verts; v; v=v->nextlink) {
- if (v->flag & PVERT_PIN) {
- npins++;
- if (v->flag & PVERT_SELECT)
- select = P_TRUE;
- }
-
- if (!(v->flag & PVERT_SELECT))
- deselect = P_TRUE;
- }
-
- if ((live && (!select || !deselect)) || (npins == 1)) {
- chart->u.lscm.context = NULL;
- }
- else {
-#if 0
- p_chart_simplify_compute(chart);
- p_chart_topological_sanity_check(chart);
-#endif
-
- if (abf) {
- if (!p_chart_abf_solve(chart))
- param_warning("ABF solving failed: falling back to LSCM.\n");
- }
-
- if (npins <= 1) {
- /* not enough pins, lets find some ourself */
- PEdge *outer;
-
- p_chart_boundaries(chart, NULL, &outer);
-
- if (!p_chart_symmetry_pins(chart, outer, &pin1, &pin2))
- p_chart_extrema_verts(chart, &pin1, &pin2);
-
- chart->u.lscm.pin1 = pin1;
- chart->u.lscm.pin2 = pin2;
- }
- else {
- chart->flag |= PCHART_NOPACK;
- }
-
- for (v=chart->verts; v; v=v->nextlink)
- v->u.id = id++;
-
- nlNewContext();
- nlSolverParameteri(NL_NB_VARIABLES, 2*chart->nverts);
- nlSolverParameteri(NL_NB_ROWS, 2*chart->nfaces);
- nlSolverParameteri(NL_LEAST_SQUARES, NL_TRUE);
-
- chart->u.lscm.context = nlGetCurrent();
- }
-}
-
-static PBool p_chart_lscm_solve(PChart *chart)
-{
- PVert *v, *pin1 = chart->u.lscm.pin1, *pin2 = chart->u.lscm.pin2;
- PFace *f;
- float *alpha = chart->u.lscm.abf_alpha;
- int row;
-
- nlMakeCurrent(chart->u.lscm.context);
-
- nlBegin(NL_SYSTEM);
-
-#if 0
- /* TODO: make loading pins work for simplify/complexify. */
-#endif
-
- for (v=chart->verts; v; v=v->nextlink)
- if (v->flag & PVERT_PIN)
- p_vert_load_pin_select_uvs(v); /* reload for live */
-
- if (chart->u.lscm.pin1) {
- nlLockVariable(2*pin1->u.id);
- nlLockVariable(2*pin1->u.id + 1);
- nlLockVariable(2*pin2->u.id);
- nlLockVariable(2*pin2->u.id + 1);
-
- nlSetVariable(0, 2*pin1->u.id, pin1->uv[0]);
- nlSetVariable(0, 2*pin1->u.id + 1, pin1->uv[1]);
- nlSetVariable(0, 2*pin2->u.id, pin2->uv[0]);
- nlSetVariable(0, 2*pin2->u.id + 1, pin2->uv[1]);
- }
- else {
- /* set and lock the pins */
- for (v=chart->verts; v; v=v->nextlink) {
- if (v->flag & PVERT_PIN) {
- nlLockVariable(2*v->u.id);
- nlLockVariable(2*v->u.id + 1);
-
- nlSetVariable(0, 2*v->u.id, v->uv[0]);
- nlSetVariable(0, 2*v->u.id + 1, v->uv[1]);
- }
- }
- }
-
- /* construct matrix */
-
- nlBegin(NL_MATRIX);
-
- row = 0;
- for (f=chart->faces; f; f=f->nextlink) {
- PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next;
- PVert *v1 = e1->vert, *v2 = e2->vert, *v3 = e3->vert;
- float a1, a2, a3, ratio, cosine, sine;
- float sina1, sina2, sina3, sinmax;
-
- if (alpha) {
- /* use abf angles if passed on */
- a1 = *(alpha++);
- a2 = *(alpha++);
- a3 = *(alpha++);
- }
- else
- p_face_angles(f, &a1, &a2, &a3);
-
- sina1 = sin(a1);
- sina2 = sin(a2);
- sina3 = sin(a3);
-
- sinmax = MAX3(sina1, sina2, sina3);
-
- /* shift vertices to find most stable order */
- if (sina3 != sinmax) {
- SHIFT3(PVert*, v1, v2, v3);
- SHIFT3(float, a1, a2, a3);
- SHIFT3(float, sina1, sina2, sina3);
-
- if (sina2 == sinmax) {
- SHIFT3(PVert*, v1, v2, v3);
- SHIFT3(float, a1, a2, a3);
- SHIFT3(float, sina1, sina2, sina3);
- }
- }
-
- /* angle based lscm formulation */
- ratio = (sina3 == 0.0f)? 1.0f: sina2/sina3;
- cosine = cos(a1)*ratio;
- sine = sina1*ratio;
-
-#if 0
- nlBegin(NL_ROW);
- nlCoefficient(2*v1->u.id, cosine - 1.0);
- nlCoefficient(2*v1->u.id+1, -sine);
- nlCoefficient(2*v2->u.id, -cosine);
- nlCoefficient(2*v2->u.id+1, sine);
- nlCoefficient(2*v3->u.id, 1.0);
- nlEnd(NL_ROW);
-
- nlBegin(NL_ROW);
- nlCoefficient(2*v1->u.id, sine);
- nlCoefficient(2*v1->u.id+1, cosine - 1.0);
- nlCoefficient(2*v2->u.id, -sine);
- nlCoefficient(2*v2->u.id+1, -cosine);
- nlCoefficient(2*v3->u.id+1, 1.0);
- nlEnd(NL_ROW);
-#else
- nlMatrixAdd(row, 2*v1->u.id, cosine - 1.0);
- nlMatrixAdd(row, 2*v1->u.id+1, -sine);
- nlMatrixAdd(row, 2*v2->u.id, -cosine);
- nlMatrixAdd(row, 2*v2->u.id+1, sine);
- nlMatrixAdd(row, 2*v3->u.id, 1.0);
- row++;
-
- nlMatrixAdd(row, 2*v1->u.id, sine);
- nlMatrixAdd(row, 2*v1->u.id+1, cosine - 1.0);
- nlMatrixAdd(row, 2*v2->u.id, -sine);
- nlMatrixAdd(row, 2*v2->u.id+1, -cosine);
- nlMatrixAdd(row, 2*v3->u.id+1, 1.0);
- row++;
-#endif
- }
-
- nlEnd(NL_MATRIX);
-
- nlEnd(NL_SYSTEM);
-
- if (nlSolveAdvanced(NULL, NL_TRUE)) {
- p_chart_lscm_load_solution(chart);
- return P_TRUE;
- }
- else {
- for (v=chart->verts; v; v=v->nextlink) {
- v->uv[0] = 0.0f;
- v->uv[1] = 0.0f;
- }
- }
-
- return P_FALSE;
-}
-
-static void p_chart_lscm_end(PChart *chart)
-{
- if (chart->u.lscm.context)
- nlDeleteContext(chart->u.lscm.context);
-
- if (chart->u.lscm.abf_alpha) {
- MEM_freeN(chart->u.lscm.abf_alpha);
- chart->u.lscm.abf_alpha = NULL;
- }
-
- chart->u.lscm.context = NULL;
- chart->u.lscm.pin1 = NULL;
- chart->u.lscm.pin2 = NULL;
-}
-
-/* Stretch */
-
-#define P_STRETCH_ITER 20
-
-static void p_stretch_pin_boundary(PChart *chart)
-{
- PVert *v;
-
- for(v=chart->verts; v; v=v->nextlink)
- if (v->edge->pair == NULL)
- v->flag |= PVERT_PIN;
- else
- v->flag &= ~PVERT_PIN;
-}
-
-static float p_face_stretch(PFace *f)
-{
- float T, w, tmp[3];
- float Ps[3], Pt[3];
- float a, c, area;
- PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next;
- PVert *v1 = e1->vert, *v2 = e2->vert, *v3 = e3->vert;
-
- area = p_face_uv_area_signed(f);
-
- if (area <= 0.0f) /* flipped face -> infinite stretch */
- return 1e10f;
-
- w= 1.0f/(2.0f*area);
-
- /* compute derivatives */
- VecCopyf(Ps, v1->co);
- VecMulf(Ps, (v2->uv[1] - v3->uv[1]));
-
- VecCopyf(tmp, v2->co);
- VecMulf(tmp, (v3->uv[1] - v1->uv[1]));
- VecAddf(Ps, Ps, tmp);
-
- VecCopyf(tmp, v3->co);
- VecMulf(tmp, (v1->uv[1] - v2->uv[1]));
- VecAddf(Ps, Ps, tmp);
-
- VecMulf(Ps, w);
-
- VecCopyf(Pt, v1->co);
- VecMulf(Pt, (v3->uv[0] - v2->uv[0]));
-
- VecCopyf(tmp, v2->co);
- VecMulf(tmp, (v1->uv[0] - v3->uv[0]));
- VecAddf(Pt, Pt, tmp);
-
- VecCopyf(tmp, v3->co);
- VecMulf(tmp, (v2->uv[0] - v1->uv[0]));
- VecAddf(Pt, Pt, tmp);
-
- VecMulf(Pt, w);
-
- /* Sander Tensor */
- a= Inpf(Ps, Ps);
- c= Inpf(Pt, Pt);
-
- T = sqrt(0.5f*(a + c));
- if (f->flag & PFACE_FILLED)
- T *= 0.2;
-
- return T;
-}
-
-static float p_stretch_compute_vertex(PVert *v)
-{
- PEdge *e = v->edge;
- float sum = 0.0f;
-
- do {
- sum += p_face_stretch(e->face);
- e = p_wheel_edge_next(e);
- } while (e && e != (v->edge));
-
- return sum;
-}
-
-static void p_chart_stretch_minimize(PChart *chart, RNG *rng)
-{
- PVert *v;
- PEdge *e;
- int j, nedges;
- float orig_stretch, low, stretch_low, high, stretch_high, mid, stretch;
- float orig_uv[2], dir[2], random_angle, trusted_radius;
-
- for(v=chart->verts; v; v=v->nextlink) {
- if((v->flag & PVERT_PIN) || !(v->flag & PVERT_SELECT))
- continue;
-
- orig_stretch = p_stretch_compute_vertex(v);
- orig_uv[0] = v->uv[0];
- orig_uv[1] = v->uv[1];
-
- /* move vertex in a random direction */
- trusted_radius = 0.0f;
- nedges = 0;
- e = v->edge;
-
- do {
- trusted_radius += p_edge_uv_length(e);
- nedges++;
-
- e = p_wheel_edge_next(e);
- } while (e && e != (v->edge));
-
- trusted_radius /= 2 * nedges;
-
- random_angle = rng_getFloat(rng) * 2.0 * M_PI;
- dir[0] = trusted_radius * cos(random_angle);
- dir[1] = trusted_radius * sin(random_angle);
-
- /* calculate old and new stretch */
- low = 0;
- stretch_low = orig_stretch;
-
- Vec2Addf(v->uv, orig_uv, dir);
- high = 1;
- stretch = stretch_high = p_stretch_compute_vertex(v);
-
- /* binary search for lowest stretch position */
- for (j = 0; j < P_STRETCH_ITER; j++) {
- mid = 0.5 * (low + high);
- v->uv[0]= orig_uv[0] + mid*dir[0];
- v->uv[1]= orig_uv[1] + mid*dir[1];
- stretch = p_stretch_compute_vertex(v);
-
- if (stretch_low < stretch_high) {
- high = mid;
- stretch_high = stretch;
- }
- else {
- low = mid;
- stretch_low = stretch;
- }
- }
-
- /* no luck, stretch has increased, reset to old values */
- if(stretch >= orig_stretch)
- Vec2Copyf(v->uv, orig_uv);
- }
-}
-
-/* Minimum area enclosing rectangle for packing */
-
-static int p_compare_geometric_uv(const void *a, const void *b)
-{
- PVert *v1 = *(PVert**)a;
- PVert *v2 = *(PVert**)b;
-
- if (v1->uv[0] < v2->uv[0])
- return -1;
- else if (v1->uv[0] == v2->uv[0]) {
- if (v1->uv[1] < v2->uv[1])
- return -1;
- else if (v1->uv[1] == v2->uv[1])
- return 0;
- else
- return 1;
- }
- else
- return 1;
-}
-
-static PBool p_chart_convex_hull(PChart *chart, PVert ***verts, int *nverts, int *right)
-{
- /* Graham algorithm, taken from:
- * http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/117225 */
-
- PEdge *be, *e;
- int npoints = 0, i, ulen, llen;
- PVert **U, **L, **points, **p;
-
- p_chart_boundaries(chart, NULL, &be);
-
- if (!be)
- return P_FALSE;
-
- e = be;
- do {
- npoints++;
- e = p_boundary_edge_next(e);
- } while(e != be);
-
- p = points = (PVert**)MEM_mallocN(sizeof(PVert*)*npoints*2, "PCHullpoints");
- U = (PVert**)MEM_mallocN(sizeof(PVert*)*npoints, "PCHullU");
- L = (PVert**)MEM_mallocN(sizeof(PVert*)*npoints, "PCHullL");
-
- e = be;
- do {
- *p = e->vert;
- p++;
- e = p_boundary_edge_next(e);
- } while(e != be);
-
- qsort(points, npoints, sizeof(PVert*), p_compare_geometric_uv);
-
- ulen = llen = 0;
- for (p=points, i = 0; i < npoints; i++, p++) {
- while ((ulen > 1) && (p_area_signed(U[ulen-2]->uv, (*p)->uv, U[ulen-1]->uv) <= 0))
- ulen--;
- while ((llen > 1) && (p_area_signed(L[llen-2]->uv, (*p)->uv, L[llen-1]->uv) >= 0))
- llen--;
-
- U[ulen] = *p;
- ulen++;
- L[llen] = *p;
- llen++;
- }
-
- npoints = 0;
- for (p=points, i = 0; i < ulen; i++, p++, npoints++)
- *p = U[i];
-
- /* the first and last point in L are left out, since they are also in U */
- for (i = llen-2; i > 0; i--, p++, npoints++)
- *p = L[i];
-
- *verts = points;
- *nverts = npoints;
- *right = ulen - 1;
-
- MEM_freeN(U);
- MEM_freeN(L);
-
- return P_TRUE;
-}
-
-float p_rectangle_area(float *p1, float *dir, float *p2, float *p3, float *p4)
-{
- /* given 4 points on the rectangle edges and the direction of on edge,
- compute the area of the rectangle */
-
- float orthodir[2], corner1[2], corner2[2], corner3[2];
-
- orthodir[0] = dir[1];
- orthodir[1] = -dir[0];
-
- if (!p_intersect_line_2d_dir(p1, dir, p2, orthodir, corner1))
- return 1e10;
-
- if (!p_intersect_line_2d_dir(p1, dir, p4, orthodir, corner2))
- return 1e10;
-
- if (!p_intersect_line_2d_dir(p3, dir, p4, orthodir, corner3))
- return 1e10;
-
- return Vec2Lenf(corner1, corner2)*Vec2Lenf(corner2, corner3);
-}
-
-static float p_chart_minimum_area_angle(PChart *chart)
-{
- /* minimum area enclosing rectangle with rotating calipers, info:
- * http://cgm.cs.mcgill.ca/~orm/maer.html */
-
- float rotated, minarea, minangle, area, len;
- float *angles, miny, maxy, v[2], a[4], mina;
- int npoints, right, mini, maxi, i, idx[4], nextidx;
- PVert **points, *p1, *p2, *p3, *p4, *p1n;
-
- /* compute convex hull */
- if (!p_chart_convex_hull(chart, &points, &npoints, &right))
- return 0.0;
-
- /* find left/top/right/bottom points, and compute angle for each point */
- angles = MEM_mallocN(sizeof(float)*npoints, "PMinAreaAngles");
-
- mini = maxi = 0;
- miny = 1e10;
- maxy = -1e10;
-
- for (i = 0; i < npoints; i++) {
- p1 = (i == 0)? points[npoints-1]: points[i-1];
- p2 = points[i];
- p3 = (i == npoints-1)? points[0]: points[i+1];
-
- angles[i] = M_PI - p_vec2_angle(p1->uv, p2->uv, p3->uv);
-
- if (points[i]->uv[1] < miny) {
- miny = points[i]->uv[1];
- mini = i;
- }
- if (points[i]->uv[1] > maxy) {
- maxy = points[i]->uv[1];
- maxi = i;
- }
- }
-
- /* left, top, right, bottom */
- idx[0] = 0;
- idx[1] = maxi;
- idx[2] = right;
- idx[3] = mini;
-
- v[0] = points[idx[0]]->uv[0];
- v[1] = points[idx[0]]->uv[1] + 1.0f;
- a[0] = p_vec2_angle(points[(idx[0]+1)%npoints]->uv, points[idx[0]]->uv, v);
-
- v[0] = points[idx[1]]->uv[0] + 1.0f;
- v[1] = points[idx[1]]->uv[1];
- a[1] = p_vec2_angle(points[(idx[1]+1)%npoints]->uv, points[idx[1]]->uv, v);
-
- v[0] = points[idx[2]]->uv[0];
- v[1] = points[idx[2]]->uv[1] - 1.0f;
- a[2] = p_vec2_angle(points[(idx[2]+1)%npoints]->uv, points[idx[2]]->uv, v);
-
- v[0] = points[idx[3]]->uv[0] - 1.0f;
- v[1] = points[idx[3]]->uv[1];
- a[3] = p_vec2_angle(points[(idx[3]+1)%npoints]->uv, points[idx[3]]->uv, v);
-
- /* 4 rotating calipers */
-
- rotated = 0.0;
- minarea = 1e10;
- minangle = 0.0;
-
- while (rotated <= M_PI/2) { /* INVESTIGATE: how far to rotate? */
- /* rotate with the smallest angle */
- mini = 0;
- mina = 1e10;
-
- for (i = 0; i < 4; i++)
- if (a[i] < mina) {
- mina = a[i];
- mini = i;
- }
-
- rotated += mina;
- nextidx = (idx[mini]+1)%npoints;
-
- a[mini] = angles[nextidx];
- a[(mini+1)%4] = a[(mini+1)%4] - mina;
- a[(mini+2)%4] = a[(mini+2)%4] - mina;
- a[(mini+3)%4] = a[(mini+3)%4] - mina;
-
- /* compute area */
- p1 = points[idx[mini]];
- p1n = points[nextidx];
- p2 = points[idx[(mini+1)%4]];
- p3 = points[idx[(mini+2)%4]];
- p4 = points[idx[(mini+3)%4]];
-
- len = Vec2Lenf(p1->uv, p1n->uv);
-
- if (len > 0.0f) {
- len = 1.0/len;
- v[0] = (p1n->uv[0] - p1->uv[0])*len;
- v[1] = (p1n->uv[1] - p1->uv[1])*len;
-
- area = p_rectangle_area(p1->uv, v, p2->uv, p3->uv, p4->uv);
-
- /* remember smallest area */
- if (area < minarea) {
- minarea = area;
- minangle = rotated;
- }
- }
-
- idx[mini] = nextidx;
- }
-
- /* try keeping rotation as small as possible */
- if (minangle > M_PI/4)
- minangle -= M_PI/2;
-
- MEM_freeN(angles);
- MEM_freeN(points);
-
- return minangle;
-}
-
-void p_chart_rotate_minimum_area(PChart *chart)
-{
- float angle = p_chart_minimum_area_angle(chart);
- float sine = sin(angle);
- float cosine = cos(angle);
- PVert *v;
-
- for (v = chart->verts; v; v=v->nextlink) {
- float oldu = v->uv[0], oldv = v->uv[1];
- v->uv[0] = cosine*oldu - sine*oldv;
- v->uv[1] = sine*oldu + cosine*oldv;
- }
-}
-
-/* Area Smoothing */
-
-/* 2d bsp tree for inverse mapping - that's a bit silly */
-
-typedef struct SmoothTriangle {
- float co1[2], co2[2], co3[2];
- float oco1[2], oco2[2], oco3[2];
-} SmoothTriangle;
-
-typedef struct SmoothNode {
- struct SmoothNode *c1, *c2;
- SmoothTriangle **tri;
- float split;
- int axis, ntri;
-} SmoothNode;
-
-static void p_barycentric_2d(float *v1, float *v2, float *v3, float *p, float *b)
-{
- float a[2], c[2], h[2], div;
-
- a[0] = v2[0] - v1[0];
- a[1] = v2[1] - v1[1];
- c[0] = v3[0] - v1[0];
- c[1] = v3[1] - v1[1];
-
- div = a[0]*c[1] - a[1]*c[0];
-
- if (div == 0.0f) {
- b[0] = 1.0f/3.0f;
- b[1] = 1.0f/3.0f;
- b[2] = 1.0f/3.0f;
- }
- else {
- h[0] = p[0] - v1[0];
- h[1] = p[1] - v1[1];
-
- div = 1.0f/div;
-
- b[1] = (h[0]*c[1] - h[1]*c[0])*div;
- b[2] = (a[0]*h[1] - a[1]*h[0])*div;
- b[0] = 1.0 - b[1] - b[2];
- }
-}
-
-static PBool p_triangle_inside(SmoothTriangle *t, float *co)
-{
- float b[3];
-
- p_barycentric_2d(t->co1, t->co2, t->co3, co, b);
-
- if ((b[0] >= 0.0) && (b[1] >= 0.0) && (b[2] >= 0.0f)) {
- co[0] = t->oco1[0]*b[0] + t->oco2[0]*b[1] + t->oco3[0]*b[2];
- co[1] = t->oco1[1]*b[0] + t->oco2[1]*b[1] + t->oco3[1]*b[2];
- return P_TRUE;
- }
-
- return P_FALSE;
-}
-
-static SmoothNode *p_node_new(MemArena *arena, SmoothTriangle **tri, int ntri, float *bmin, float *bmax, int depth)
-{
- SmoothNode *node = BLI_memarena_alloc(arena, sizeof *node);
- int axis, i, t1size = 0, t2size = 0;
- float split, mi, mx;
- SmoothTriangle **t1, **t2, *t;
-
- node->tri = tri;
- node->ntri = ntri;
-
- if (ntri <= 10 || depth >= 15)
- return node;
-
- t1 = MEM_mallocN(sizeof(SmoothTriangle)*ntri, "PNodeTri1");
- t2 = MEM_mallocN(sizeof(SmoothTriangle)*ntri, "PNodeTri1");
-
- axis = (bmax[0] - bmin[0] > bmax[1] - bmin[1])? 0: 1;
- split = 0.5f*(bmin[axis] + bmax[axis]);
-
- for (i = 0; i < ntri; i++) {
- t = tri[i];
-
- if ((t->co1[axis] <= split) || (t->co2[axis] <= split) || (t->co3[axis] <= split)) {
- t1[t1size] = t;
- t1size++;
- }
- if ((t->co1[axis] >= split) || (t->co2[axis] >= split) || (t->co3[axis] >= split)) {
- t2[t2size] = t;
- t2size++;
- }
- }
-
- if ((t1size == t2size) && (t1size == ntri)) {
- MEM_freeN(t1);
- MEM_freeN(t2);
- return node;
- }
-
- node->tri = NULL;
- node->ntri = 0;
- MEM_freeN(tri);
-
- node->axis = axis;
- node->split = split;
-
- mi = bmin[axis];
- mx = bmax[axis];
- bmax[axis] = split;
- node->c1 = p_node_new(arena, t1, t1size, bmin, bmax, depth+1);
-
- bmin[axis] = bmax[axis];
- bmax[axis] = mx;
- node->c2 = p_node_new(arena, t2, t2size, bmin, bmax, depth+1);
-
- return node;
-}
-
-static void p_node_delete(SmoothNode *node)
-{
- if (node->c1)
- p_node_delete(node->c1);
- if (node->c2)
- p_node_delete(node->c2);
- if (node->tri)
- MEM_freeN(node->tri);
-}
-
-static PBool p_node_intersect(SmoothNode *node, float *co)
-{
- int i;
-
- if (node->tri) {
- for (i = 0; i < node->ntri; i++)
- if (p_triangle_inside(node->tri[i], co))
- return P_TRUE;
-
- return P_FALSE;
- }
- else {
- if (co[node->axis] < node->split)
- return p_node_intersect(node->c1, co);
- else
- return p_node_intersect(node->c2, co);
- }
-
-}
-
-/* smooothing */
-
-static int p_compare_float(const void *a, const void *b)
-{
- if (*((float*)a) < *((float*)b))
- return -1;
- else if (*((float*)a) == *((float*)b))
- return 0;
- else
- return 1;
-}
-
-static float p_smooth_median_edge_length(PChart *chart)
-{
- PEdge *e;
- float *lengths = MEM_mallocN(sizeof(chart->edges)*chart->nedges, "PMedianLength");
- float median;
- int i;
-
- /* ok, so i'm lazy */
- for (i=0, e=chart->edges; e; e=e->nextlink, i++)
- lengths[i] = p_edge_length(e);
-
- qsort(lengths, i, sizeof(float), p_compare_float);
-
- median = lengths[i/2];
- MEM_freeN(lengths);
-
- return median;
-}
-
-static float p_smooth_distortion(PEdge *e, float avg2d, float avg3d)
-{
- float len2d = p_edge_uv_length(e)*avg3d;
- float len3d = p_edge_length(e)*avg2d;
-
- return (len3d == 0.0f)? 0.0f: len2d/len3d;
-}
-
-void p_smooth(PChart *chart)
-{
- PEdge *e;
- PVert *v;
- PFace *f;
- int j, it2, maxiter2, it;
- int nedges = chart->nedges, nwheel, gridx, gridy;
- int edgesx, edgesy, nsize, esize, i, x, y, maxiter, totiter;
- float minv[2], maxv[2], median, invmedian, distortion, avglen2d, avglen3d;
- float center[2], dx, dy, *nodes, dlimit, d, *oldnodesx, *oldnodesy;
- float *nodesx, *nodesy, *hedges, *vedges, climit, moved, padding;
- SmoothTriangle *triangles, *t, *t2, **tri, **trip;
- SmoothNode *root;
- MemArena *arena;
-
- if (nedges == 0)
- return;
-
- p_chart_uv_bbox(chart, minv, maxv);
- median = p_smooth_median_edge_length(chart)*0.10f;
-
- if (median == 0.0)
- return;
-
- invmedian = 1.0/median;
-
- /* compute edge distortion */
- distortion = 0.0;
- avglen2d = avglen3d = 0.0;
-
- for (e=chart->edges; e; e=e->nextlink) {
- avglen2d += p_edge_uv_length(e);
- avglen3d += p_edge_length(e);
- }
-
- avglen2d /= nedges;
- avglen3d /= nedges;
-
- for (v=chart->verts; v; v=v->nextlink) {
- v->u.distortion = 0.0;
- nwheel = 0;
-
- e = v->edge;
- do {
- v->u.distortion += p_smooth_distortion(e, avglen2d, avglen3d);
- nwheel++;
-
- e = e->next->next->pair;
- } while(e && (e != v->edge));
-
- v->u.distortion /= nwheel;
- }
-
- /* need to do excessive grid size checking still */
- center[0] = 0.5f*(minv[0] + maxv[0]);
- center[1] = 0.5f*(minv[1] + maxv[1]);
-
- dx = 0.5f*(maxv[0] - minv[0]);
- dy = 0.5f*(maxv[1] - minv[1]);
-
- padding = 0.15f;
- dx += padding*dx + 2.0f*median;
- dy += padding*dy + 2.0f*median;
-
- gridx = (int)(dx*invmedian);
- gridy = (int)(dy*invmedian);
-
- minv[0] = center[0] - median*gridx;
- minv[1] = center[1] - median*gridy;
- maxv[0] = center[0] + median*gridx;
- maxv[1] = center[1] + median*gridy;
-
- /* create grid */
- gridx = gridx*2 + 1;
- gridy = gridy*2 + 1;
-
- if ((gridx <= 2) || (gridy <= 2))
- return;
-
- edgesx = gridx-1;
- edgesy = gridy-1;
- nsize = gridx*gridy;
- esize = edgesx*edgesy;
-
- nodes = MEM_mallocN(sizeof(float)*nsize, "PSmoothNodes");
- nodesx = MEM_mallocN(sizeof(float)*nsize, "PSmoothNodesX");
- nodesy = MEM_mallocN(sizeof(float)*nsize, "PSmoothNodesY");
- oldnodesx = MEM_mallocN(sizeof(float)*nsize, "PSmoothOldNodesX");
- oldnodesy = MEM_mallocN(sizeof(float)*nsize, "PSmoothOldNodesY");
- hedges = MEM_mallocN(sizeof(float)*esize, "PSmoothHEdges");
- vedges = MEM_mallocN(sizeof(float)*esize, "PSmoothVEdges");
-
- if (!nodes || !nodesx || !nodesy || !oldnodesx || !oldnodesy || !hedges || !vedges) {
- if (nodes) MEM_freeN(nodes);
- if (nodesx) MEM_freeN(nodesx);
- if (nodesy) MEM_freeN(nodesy);
- if (oldnodesx) MEM_freeN(oldnodesx);
- if (oldnodesy) MEM_freeN(oldnodesy);
- if (hedges) MEM_freeN(hedges);
- if (vedges) MEM_freeN(vedges);
-
- error("Not enough memory for area smoothing grid.");
- return;
- }
-
- for (x = 0; x < gridx; x++) {
- for (y = 0; y < gridy; y++) {
- i = x + y*gridx;
-
- nodesx[i] = minv[0] + median*x;
- nodesy[i] = minv[1] + median*y;
-
- nodes[i] = 1.0f;
- }
- }
-
- /* embed in grid */
- for (f=chart->faces; f; f=f->nextlink) {
- PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next;
- float fmin[2], fmax[2];
- int bx1, by1, bx2, by2;
-
- INIT_MINMAX2(fmin, fmax);
-
- DO_MINMAX2(e1->vert->uv, fmin, fmax);
- DO_MINMAX2(e2->vert->uv, fmin, fmax);
- DO_MINMAX2(e3->vert->uv, fmin, fmax);
-
- bx1 = (int)((fmin[0] - minv[0])*invmedian);
- by1 = (int)((fmin[1] - minv[1])*invmedian);
- bx2 = (int)((fmax[0] - minv[0])*invmedian + 2);
- by2 = (int)((fmax[1] - minv[1])*invmedian + 2);
-
- for (x = bx1; x < bx2; x++) {
- for (y = by1; y < by2; y++) {
- float p[2], b[3];
-
- i = x + y*gridx;
-
- p[0] = nodesx[i];
- p[1] = nodesy[i];
-
- p_barycentric_2d(e1->vert->uv, e2->vert->uv, e3->vert->uv, p, b);
-
- if ((b[0] > 0.0) && (b[1] > 0.0) && (b[2] > 0.0)) {
- nodes[i] = e1->vert->u.distortion*b[0];
- nodes[i] += e2->vert->u.distortion*b[1];
- nodes[i] += e3->vert->u.distortion*b[2];
- }
- }
- }
- }
-
- /* smooth the grid */
- maxiter = 10;
- totiter = 0;
- climit = 0.00001f*nsize;
-
- for (it = 0; it < maxiter; it++) {
- moved = 0.0f;
-
- for (x = 0; x < edgesx; x++) {
- for (y = 0; y < edgesy; y++) {
- i = x + y*gridx;
- j = x + y*edgesx;
-
- hedges[j] = (nodes[i] + nodes[i+1])*0.5f;
- vedges[j] = (nodes[i] + nodes[i+gridx])*0.5f;
-
- /* we do *inverse* mapping */
- hedges[j] = 1.0f/hedges[j];
- vedges[j] = 1.0f/vedges[j];
- }
- }
-
- maxiter2 = 50;
- dlimit = 0.0001f;
-
- for (it2 = 0; it2 < maxiter2; it2++) {
- d = 0.0f;
- totiter += 1;
-
- memcpy(oldnodesx, nodesx, sizeof(float)*nsize);
- memcpy(oldnodesy, nodesy, sizeof(float)*nsize);
-
- for (x=1; x < gridx-1; x++) {
- for (y=1; y < gridy-1; y++) {
- float p[2], oldp[2], sum1, sum2, diff[2], length;
-
- i = x + gridx*y;
- j = x + edgesx*y;
-
- oldp[0] = oldnodesx[i];
- oldp[1] = oldnodesy[i];
-
- sum1 = hedges[j-1]*oldnodesx[i-1];
- sum1 += hedges[j]*oldnodesx[i+1];
- sum1 += vedges[j-edgesx]*oldnodesx[i-gridx];
- sum1 += vedges[j]*oldnodesx[i+gridx];
-
- sum2 = hedges[j-1];
- sum2 += hedges[j];
- sum2 += vedges[j-edgesx];
- sum2 += vedges[j];
-
- nodesx[i] = sum1/sum2;
-
- sum1 = hedges[j-1]*oldnodesy[i-1];
- sum1 += hedges[j]*oldnodesy[i+1];
- sum1 += vedges[j-edgesx]*oldnodesy[i-gridx];
- sum1 += vedges[j]*oldnodesy[i+gridx];
-
- nodesy[i] = sum1/sum2;
-
- p[0] = nodesx[i];
- p[1] = nodesy[i];
-
- diff[0] = p[0] - oldp[0];
- diff[1] = p[1] - oldp[1];
-
- length = sqrt(diff[0]*diff[0] + diff[1]*diff[1]);
- d = MAX2(d, length);
- moved += length;
- }
- }
-
- if (d < dlimit)
- break;
- }
-
- if (moved < climit)
- break;
- }
-
- MEM_freeN(oldnodesx);
- MEM_freeN(oldnodesy);
- MEM_freeN(hedges);
- MEM_freeN(vedges);
-
- /* create bsp */
- t = triangles = MEM_mallocN(sizeof(SmoothTriangle)*esize*2, "PSmoothTris");
- trip = tri = MEM_mallocN(sizeof(SmoothTriangle*)*esize*2, "PSmoothTriP");
-
- if (!triangles || !tri) {
- MEM_freeN(nodes);
- MEM_freeN(nodesx);
- MEM_freeN(nodesy);
-
- if (triangles) MEM_freeN(triangles);
- if (tri) MEM_freeN(tri);
-
- error("Not enough memory for area smoothing grid.");
- return;
- }
-
- for (x = 0; x < edgesx; x++) {
- for (y = 0; y < edgesy; y++) {
- i = x + y*gridx;
-
- t->co1[0] = nodesx[i];
- t->co1[1] = nodesy[i];
-
- t->co2[0] = nodesx[i+1];
- t->co2[1] = nodesy[i+1];
-
- t->co3[0] = nodesx[i+gridx];
- t->co3[1] = nodesy[i+gridx];
-
- t->oco1[0] = minv[0] + x*median;
- t->oco1[1] = minv[1] + y*median;
-
- t->oco2[0] = minv[0] + (x+1)*median;
- t->oco2[1] = minv[1] + y*median;
-
- t->oco3[0] = minv[0] + x*median;
- t->oco3[1] = minv[1] + (y+1)*median;
-
- t2 = t+1;
-
- t2->co1[0] = nodesx[i+gridx+1];
- t2->co1[1] = nodesy[i+gridx+1];
-
- t2->oco1[0] = minv[0] + (x+1)*median;
- t2->oco1[1] = minv[1] + (y+1)*median;
-
- t2->co2[0] = t->co2[0]; t2->co2[1] = t->co2[1];
- t2->oco2[0] = t->oco2[0]; t2->oco2[1] = t->oco2[1];
-
- t2->co3[0] = t->co3[0]; t2->co3[1] = t->co3[1];
- t2->oco3[0] = t->oco3[0]; t2->oco3[1] = t->oco3[1];
-
- *trip = t; trip++; t++;
- *trip = t; trip++; t++;
- }
- }
-
- MEM_freeN(nodes);
- MEM_freeN(nodesx);
- MEM_freeN(nodesy);
-
- arena = BLI_memarena_new(1<<16);
- root = p_node_new(arena, tri, esize*2, minv, maxv, 0);
-
- for (v=chart->verts; v; v=v->nextlink)
- if (!p_node_intersect(root, v->uv))
- param_warning("area smoothing error: couldn't find mapping triangle\n");
-
- p_node_delete(root);
- BLI_memarena_free(arena);
-
- MEM_freeN(triangles);
-}
-
-/* Exported */
-
-ParamHandle *param_construct_begin()
-{
- PHandle *handle = MEM_callocN(sizeof*handle, "PHandle");
- handle->construction_chart = p_chart_new(handle);
- handle->state = PHANDLE_STATE_ALLOCATED;
- handle->arena = BLI_memarena_new((1<<16));
-
- handle->hash_verts = phash_new((PHashLink**)&handle->construction_chart->verts, 1);
- handle->hash_edges = phash_new((PHashLink**)&handle->construction_chart->edges, 1);
- handle->hash_faces = phash_new((PHashLink**)&handle->construction_chart->faces, 1);
-
- return (ParamHandle*)handle;
-}
-
-void param_delete(ParamHandle *handle)
-{
- PHandle *phandle = (PHandle*)handle;
- int i;
-
- param_assert((phandle->state == PHANDLE_STATE_ALLOCATED) ||
- (phandle->state == PHANDLE_STATE_CONSTRUCTED));
-
- for (i = 0; i < phandle->ncharts; i++)
- p_chart_delete(phandle->charts[i]);
-
- if (phandle->charts)
- MEM_freeN(phandle->charts);
-
- if (phandle->construction_chart) {
- p_chart_delete(phandle->construction_chart);
-
- phash_delete(phandle->hash_verts);
- phash_delete(phandle->hash_edges);
- phash_delete(phandle->hash_faces);
- }
-
- BLI_memarena_free(phandle->arena);
- MEM_freeN(phandle);
-}
-
-void param_face_add(ParamHandle *handle, ParamKey key, int nverts,
- ParamKey *vkeys, float **co, float **uv,
- ParamBool *pin, ParamBool *select)
-{
- PHandle *phandle = (PHandle*)handle;
-
- param_assert(phash_lookup(phandle->hash_faces, key) == NULL);
- param_assert(phandle->state == PHANDLE_STATE_ALLOCATED);
- param_assert((nverts == 3) || (nverts == 4));
-
- if (nverts == 4) {
- if (p_quad_split_direction(phandle, co, vkeys)) {
- p_face_add_construct(phandle, key, vkeys, co, uv, 0, 1, 2, pin, select);
- p_face_add_construct(phandle, key, vkeys, co, uv, 0, 2, 3, pin, select);
- }
- else {
- p_face_add_construct(phandle, key, vkeys, co, uv, 0, 1, 3, pin, select);
- p_face_add_construct(phandle, key, vkeys, co, uv, 1, 2, 3, pin, select);
- }
- }
- else
- p_face_add_construct(phandle, key, vkeys, co, uv, 0, 1, 2, pin, select);
-}
-
-void param_edge_set_seam(ParamHandle *handle, ParamKey *vkeys)
-{
- PHandle *phandle = (PHandle*)handle;
- PEdge *e;
-
- param_assert(phandle->state == PHANDLE_STATE_ALLOCATED);
-
- e = p_edge_lookup(phandle, vkeys);
- if (e)
- e->flag |= PEDGE_SEAM;
-}
-
-void param_construct_end(ParamHandle *handle, ParamBool fill, ParamBool impl)
-{
- PHandle *phandle = (PHandle*)handle;
- PChart *chart = phandle->construction_chart;
- int i, j, nboundaries = 0;
- PEdge *outer;
-
- param_assert(phandle->state == PHANDLE_STATE_ALLOCATED);
-
- phandle->ncharts = p_connect_pairs(phandle, impl);
- phandle->charts = p_split_charts(phandle, chart, phandle->ncharts);
-
- p_chart_delete(phandle->construction_chart);
- phandle->construction_chart = NULL;
-
- phash_delete(phandle->hash_verts);
- phash_delete(phandle->hash_edges);
- phash_delete(phandle->hash_faces);
- phandle->hash_verts = phandle->hash_edges = phandle->hash_faces = NULL;
-
- for (i = j = 0; i < phandle->ncharts; i++) {
- PVert *v;
- PChart *chart = phandle->charts[i];
-
- p_chart_boundaries(chart, &nboundaries, &outer);
-
- if (nboundaries == 0) {
- p_chart_delete(chart);
- continue;
- }
-
- phandle->charts[j] = chart;
- j++;
-
- if (fill && (nboundaries > 1))
- p_chart_fill_boundaries(chart, outer);
-
- for (v=chart->verts; v; v=v->nextlink)
- p_vert_load_pin_select_uvs(v);
- }
-
- phandle->ncharts = j;
-
- phandle->state = PHANDLE_STATE_CONSTRUCTED;
-}
-
-void param_lscm_begin(ParamHandle *handle, ParamBool live, ParamBool abf)
-{
- PHandle *phandle = (PHandle*)handle;
- PFace *f;
- int i;
-
- param_assert(phandle->state == PHANDLE_STATE_CONSTRUCTED);
- phandle->state = PHANDLE_STATE_LSCM;
-
- for (i = 0; i < phandle->ncharts; i++) {
- for (f=phandle->charts[i]->faces; f; f=f->nextlink)
- p_face_backup_uvs(f);
- p_chart_lscm_begin(phandle->charts[i], live, abf);
- }
-}
-
-void param_lscm_solve(ParamHandle *handle)
-{
- PHandle *phandle = (PHandle*)handle;
- PChart *chart;
- int i;
- PBool result;
-
- param_assert(phandle->state == PHANDLE_STATE_LSCM);
-
- for (i = 0; i < phandle->ncharts; i++) {
- chart = phandle->charts[i];
-
- if (chart->u.lscm.context) {
- result = p_chart_lscm_solve(chart);
-
- if (result && !(chart->flag & PCHART_NOPACK))
- p_chart_rotate_minimum_area(chart);
-
- if (!result || (chart->u.lscm.pin1))
- p_chart_lscm_end(chart);
- }
- }
-}
-
-void param_lscm_end(ParamHandle *handle)
-{
- PHandle *phandle = (PHandle*)handle;
- int i;
-
- param_assert(phandle->state == PHANDLE_STATE_LSCM);
-
- for (i = 0; i < phandle->ncharts; i++) {
- p_chart_lscm_end(phandle->charts[i]);
-#if 0
- p_chart_complexify(phandle->charts[i]);
-#endif
- }
-
- phandle->state = PHANDLE_STATE_CONSTRUCTED;
-}
-
-void param_stretch_begin(ParamHandle *handle)
-{
- PHandle *phandle = (PHandle*)handle;
- PChart *chart;
- PVert *v;
- PFace *f;
- int i;
-
- param_assert(phandle->state == PHANDLE_STATE_CONSTRUCTED);
- phandle->state = PHANDLE_STATE_STRETCH;
-
- phandle->rng = rng_new(31415926);
- phandle->blend = 0.0f;
-
- for (i = 0; i < phandle->ncharts; i++) {
- chart = phandle->charts[i];
-
- for (v=chart->verts; v; v=v->nextlink)
- v->flag &= ~PVERT_PIN; /* don't use user-defined pins */
-
- p_stretch_pin_boundary(chart);
-
- for (f=chart->faces; f; f=f->nextlink) {
- p_face_backup_uvs(f);
- f->u.area3d = p_face_area(f);
- }
- }
-}
-
-void param_stretch_blend(ParamHandle *handle, float blend)
-{
- PHandle *phandle = (PHandle*)handle;
-
- param_assert(phandle->state == PHANDLE_STATE_STRETCH);
- phandle->blend = blend;
-}
-
-void param_stretch_iter(ParamHandle *handle)
-{
- PHandle *phandle = (PHandle*)handle;
- PChart *chart;
- int i;
-
- param_assert(phandle->state == PHANDLE_STATE_STRETCH);
-
- for (i = 0; i < phandle->ncharts; i++) {
- chart = phandle->charts[i];
- p_chart_stretch_minimize(chart, phandle->rng);
- }
-}
-
-void param_stretch_end(ParamHandle *handle)
-{
- PHandle *phandle = (PHandle*)handle;
-
- param_assert(phandle->state == PHANDLE_STATE_STRETCH);
- phandle->state = PHANDLE_STATE_CONSTRUCTED;
-
- rng_free(phandle->rng);
- phandle->rng = NULL;
-}
-
-void param_smooth_area(ParamHandle *handle)
-{
- PHandle *phandle = (PHandle*)handle;
- int i;
-
- param_assert(phandle->state == PHANDLE_STATE_CONSTRUCTED);
-
- for (i = 0; i < phandle->ncharts; i++) {
- PChart *chart = phandle->charts[i];
- PVert *v;
-
- for (v=chart->verts; v; v=v->nextlink)
- v->flag &= ~PVERT_PIN;
-
- p_smooth(chart);
- }
-}
-
-void param_pack(ParamHandle *handle)
-{
- /* box packing variables */
- boxPack *boxarray, *box;
- float tot_width, tot_height, scale;
-
- PChart *chart;
- int i, unpacked=0;
- float trans[2];
-
- PHandle *phandle = (PHandle*)handle;
-
-
- if (phandle->ncharts == 0)
- return;
-
- /* we may not use all these boxes */
- boxarray = MEM_mallocN( phandle->ncharts*sizeof(boxPack), "boxPack box");
-
- for (i = 0; i < phandle->ncharts; i++) {
- chart = phandle->charts[i];
-
-
- if (chart->flag & PCHART_NOPACK) {
- unpacked++;
- continue;
- }
-
- box = boxarray+(i-unpacked);
-
- p_chart_uv_bbox(chart, trans, chart->u.pack.size);
-
- trans[0] = -trans[0];
- trans[1] = -trans[1];
-
- p_chart_uv_translate(chart, trans);
-
- box->w = chart->u.pack.size[0] + trans[0];
- box->h = chart->u.pack.size[1] + trans[1];
- box->index = i; /* warning this index skips PCHART_NOPACK boxes */
- }
-
- boxPack2D(boxarray, phandle->ncharts-unpacked, &tot_width, &tot_height);
-
- if (tot_height>tot_width)
- scale = 1.0/tot_height;
- else
- scale = 1.0/tot_width;
-
- for (i = 0; i < phandle->ncharts-unpacked; i++) {
- box = boxarray+i;
- trans[0] = box->x;
- trans[1] = box->y;
-
- chart = phandle->charts[box->index];
- p_chart_uv_translate(chart, trans);
- p_chart_uv_scale(chart, scale);
- }
- MEM_freeN(boxarray);
-}
-
-void param_flush(ParamHandle *handle)
-{
- PHandle *phandle = (PHandle*)handle;
- PChart *chart;
- int i;
-
- for (i = 0; i < phandle->ncharts; i++) {
- chart = phandle->charts[i];
-
- if ((phandle->state == PHANDLE_STATE_LSCM) && !chart->u.lscm.context)
- continue;
-
- if (phandle->blend == 0.0f)
- p_flush_uvs(chart);
- else
- p_flush_uvs_blend(chart, phandle->blend);
- }
-}
-
-void param_flush_restore(ParamHandle *handle)
-{
- PHandle *phandle = (PHandle*)handle;
- PChart *chart;
- PFace *f;
- int i;
-
- for (i = 0; i < phandle->ncharts; i++) {
- chart = phandle->charts[i];
-
- for (f=chart->faces; f; f=f->nextlink)
- p_face_restore_uvs(f);
- }
-}
-
diff --git a/source/blender/src/parametrizer.h b/source/blender/src/parametrizer.h
deleted file mode 100644
index fcda5fc6164..00000000000
--- a/source/blender/src/parametrizer.h
+++ /dev/null
@@ -1,85 +0,0 @@
-
-#ifndef __PARAMETRIZER_H__
-#define __PARAMETRIZER_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef void ParamHandle; /* handle to a set of charts */
-typedef long ParamKey; /* (hash) key for identifying verts and faces */
-typedef enum ParamBool {
- PARAM_TRUE = 1,
- PARAM_FALSE = 0
-} ParamBool;
-
-/* Chart construction:
- -------------------
- - faces and seams may only be added between construct_{begin|end}
- - the pointers to co and uv are stored, rather than being copied
- - vertices are implicitly created
- - in construct_end the mesh will be split up according to the seams
- - the resulting charts must be:
- - manifold, connected, open (at least one boundary loop)
- - output will be written to the uv pointers
-*/
-
-ParamHandle *param_construct_begin();
-
-void param_face_add(ParamHandle *handle,
- ParamKey key,
- int nverts,
- ParamKey *vkeys,
- float **co,
- float **uv,
- ParamBool *pin,
- ParamBool *select);
-
-void param_edge_set_seam(ParamHandle *handle,
- ParamKey *vkeys);
-
-void param_construct_end(ParamHandle *handle, ParamBool fill, ParamBool impl);
-void param_delete(ParamHandle *chart);
-
-/* Least Squares Conformal Maps:
- -----------------------------
- - charts with less than two pinned vertices are assigned 2 pins
- - lscm is divided in three steps:
- - begin: compute matrix and it's factorization (expensive)
- - solve using pinned coordinates (cheap)
- - end: clean up
- - uv coordinates are allowed to change within begin/end, for
- quick re-solving
-*/
-
-void param_lscm_begin(ParamHandle *handle, ParamBool live, ParamBool abf);
-void param_lscm_solve(ParamHandle *handle);
-void param_lscm_end(ParamHandle *handle);
-
-/* Stretch */
-
-void param_stretch_begin(ParamHandle *handle);
-void param_stretch_blend(ParamHandle *handle, float blend);
-void param_stretch_iter(ParamHandle *handle);
-void param_stretch_end(ParamHandle *handle);
-
-/* Area Smooth */
-
-void param_smooth_area(ParamHandle *handle);
-
-/* Packing */
-
-void param_pack(ParamHandle *handle);
-
-/* Flushing */
-
-void param_flush(ParamHandle *handle);
-void param_flush_restore(ParamHandle *handle);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*__PARAMETRIZER_H__*/
-
diff --git a/source/blender/src/parametrizer_intern.h b/source/blender/src/parametrizer_intern.h
deleted file mode 100644
index 6114ecc8696..00000000000
--- a/source/blender/src/parametrizer_intern.h
+++ /dev/null
@@ -1,192 +0,0 @@
-
-#ifndef __PARAMETRIZER_INTERN_H__
-#define __PARAMETRIZER_INTERN_H__
-
-/* Utils */
-
-#if 0
- #define param_assert(condition);
- #define param_warning(message);
- #define param_test_equals_ptr(condition);
- #define param_test_equals_int(condition);
-#else
- #define param_assert(condition) \
- if (!(condition)) \
- { /*printf("Assertion %s:%d\n", __FILE__, __LINE__); abort();*/ }
- #define param_warning(message) \
- { /*printf("Warning %s:%d: %s\n", __FILE__, __LINE__, message);*/ }
- #define param_test_equals_ptr(str, a, b) \
- if (a != b) \
- { /*printf("Equals %s => %p != %p\n", str, a, b);*/ };
- #define param_test_equals_int(str, a, b) \
- if (a != b) \
- { /*printf("Equals %s => %d != %d\n", str, a, b);*/ };
-#endif
-
-typedef enum PBool {
- P_TRUE = 1,
- P_FALSE = 0
-} PBool;
-
-/* Special Purpose Hash */
-
-typedef long PHashKey;
-
-typedef struct PHashLink {
- struct PHashLink *next;
- PHashKey key;
-} PHashLink;
-
-typedef struct PHash {
- PHashLink **list;
- PHashLink **buckets;
- int size, cursize, cursize_id;
-} PHash;
-
-
-
-struct PVert;
-struct PEdge;
-struct PFace;
-struct PChart;
-struct PHandle;
-
-/* Simplices */
-
-typedef struct PVert {
- struct PVert *nextlink;
-
- union PVertUnion {
- PHashKey key; /* construct */
- int id; /* abf/lscm matrix index */
- float distortion; /* area smoothing */
- HeapNode *heaplink; /* edge collapsing */
- } u;
-
- struct PEdge *edge;
- float *co;
- float uv[2];
- unsigned char flag;
-
-} PVert;
-
-typedef struct PEdge {
- struct PEdge *nextlink;
-
- union PEdgeUnion {
- PHashKey key; /* construct */
- int id; /* abf matrix index */
- HeapNode *heaplink; /* fill holes */
- struct PEdge *nextcollapse; /* simplification */
- } u;
-
- struct PVert *vert;
- struct PEdge *pair;
- struct PEdge *next;
- struct PFace *face;
- float *orig_uv, old_uv[2];
- unsigned short flag;
-
-} PEdge;
-
-typedef struct PFace {
- struct PFace *nextlink;
-
- union PFaceUnion {
- PHashKey key; /* construct */
- int chart; /* construct splitting*/
- float area3d; /* stretch */
- int id; /* abf matrix index */
- } u;
-
- struct PEdge *edge;
- unsigned char flag;
-
-} PFace;
-
-enum PVertFlag {
- PVERT_PIN = 1,
- PVERT_SELECT = 2,
- PVERT_INTERIOR = 4,
- PVERT_COLLAPSE = 8,
- PVERT_SPLIT = 16
-};
-
-enum PEdgeFlag {
- PEDGE_SEAM = 1,
- PEDGE_VERTEX_SPLIT = 2,
- PEDGE_PIN = 4,
- PEDGE_SELECT = 8,
- PEDGE_DONE = 16,
- PEDGE_FILLED = 32,
- PEDGE_COLLAPSE = 64,
- PEDGE_COLLAPSE_EDGE = 128,
- PEDGE_COLLAPSE_PAIR = 256
-};
-
-/* for flipping faces */
-#define PEDGE_VERTEX_FLAGS (PEDGE_PIN)
-
-enum PFaceFlag {
- PFACE_CONNECTED = 1,
- PFACE_FILLED = 2,
- PFACE_COLLAPSE = 4
-};
-
-/* Chart */
-
-typedef struct PChart {
- PVert *verts;
- PEdge *edges;
- PFace *faces;
- int nverts, nedges, nfaces;
-
- PVert *collapsed_verts;
- PEdge *collapsed_edges;
- PFace *collapsed_faces;
-
- union PChartUnion {
- struct PChartLscm {
- NLContext context;
- float *abf_alpha;
- PVert *pin1, *pin2;
- } lscm;
- struct PChartPack {
- float rescale, area;
- float size[2], trans[2];
- } pack;
- } u;
-
- unsigned char flag;
- struct PHandle *handle;
-} PChart;
-
-enum PChartFlag {
- PCHART_NOPACK = 1
-};
-
-enum PHandleState {
- PHANDLE_STATE_ALLOCATED,
- PHANDLE_STATE_CONSTRUCTED,
- PHANDLE_STATE_LSCM,
- PHANDLE_STATE_STRETCH
-};
-
-typedef struct PHandle {
- enum PHandleState state;
- MemArena *arena;
-
- PChart *construction_chart;
- PHash *hash_verts;
- PHash *hash_edges;
- PHash *hash_faces;
-
- PChart **charts;
- int ncharts;
-
- RNG *rng;
- float blend;
-} PHandle;
-
-#endif /*__PARAMETRIZER_INTERN_H__*/
-
diff --git a/source/blender/src/playanim.c b/source/blender/src/playanim.c
deleted file mode 100644
index e94366571db..00000000000
--- a/source/blender/src/playanim.c
+++ /dev/null
@@ -1,813 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <sys/types.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef WIN32
-#include <unistd.h>
-#include <sys/times.h>
-#include <sys/wait.h>
-#else
-#include <io.h>
-#endif
-#include "MEM_guardedalloc.h"
-
-#ifdef WITH_QUICKTIME
-#ifdef _WIN32
-#include <QTML.h>
-#include <Movies.h>
-#elif defined(__APPLE__)
-#include <QuickTime/Movies.h>
-#endif /* __APPLE__ */
-#endif /* WITH_QUICKTIME */
-
-#include "PIL_time.h"
-
-#include <math.h>
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "IMB_imbuf_types.h"
-#include "IMB_imbuf.h"
-
-#include "BDR_editcurve.h"
-
-#include "BKE_blender.h"
-#include "BKE_global.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-#include "BIF_screen.h"
-#include "BIF_mywindow.h"
-
-#include "BMF_Api.h"
-
-#include "playanim_ext.h"
-#include "mydevice.h"
-#include "blendef.h"
-#include "winlay.h"
-
-/* ***************** gl_util.c ****************** */
-
-static Window *g_window = NULL;
-static int qualN = 0;
-
-#define LSHIFT (1<<0)
-#define RSHIFT (1<<1)
-#define SHIFT (LSHIFT | RSHIFT)
-#define LALT (1<<2)
-#define RALT (1<<3)
-#define ALT (LALT | RALT)
-#define LCTRL (1<<4)
-#define RCTRL (1<<5)
-#define LMOUSE (1<<16)
-#define MMOUSE (1<<17)
-#define RMOUSE (1<<18)
-#define MOUSE (LMOUSE | MMOUSE | RMOUSE)
-
-unsigned short screen_qread(short *val, char *ascii);
-
-/* implementation */
-static int qreadN(short *val)
-{
- char ascii;
- int event = screen_qread(val, &ascii);
-
- switch(event){
- case LEFTMOUSE:
- if (*val) qualN |= LMOUSE;
- else qualN &= ~LMOUSE;
- break;
- case MIDDLEMOUSE:
- if (*val) qualN |= MMOUSE;
- else qualN &= ~MMOUSE;
- break;
- case RIGHTMOUSE:
- if (*val) qualN |= RMOUSE;
- else qualN &= ~RMOUSE;
- break;
- case LEFTSHIFTKEY:
- if (*val) qualN |= LSHIFT;
- else qualN &= ~LSHIFT;
- break;
- case RIGHTSHIFTKEY:
- if (*val) qualN |= RSHIFT;
- else qualN &= ~RSHIFT;
- break;
- case LEFTCTRLKEY:
- if (*val) qualN |= LCTRL;
- else qualN &= ~LCTRL;
- break;
- case RIGHTCTRLKEY:
- if (*val) qualN |= RCTRL;
- else qualN &= ~RCTRL;
- break;
- case LEFTALTKEY:
- if (*val) qualN |= LALT;
- else qualN &= ~LALT;
- break;
- case RIGHTALTKEY:
- if (*val) qualN |= RALT;
- else qualN &= ~RALT;
- break;
- }
-
- return(event);
-}
-
-/* ***************** gl_util.c ****************** */
-
-
-
-
-typedef struct pict{
- struct pict *next, *prev;
- char *mem;
- int size;
- char *name;
- struct ImBuf *ibuf;
- struct anim *anim;
- int frame;
- int IB_flags;
-}Pict;
-
-static struct ListBase _picsbase = {0,0};
-static struct ListBase *picsbase = &_picsbase;
-static int fromdisk = FALSE;
-static float zoomx = 1.0 , zoomy = 1.0;
-static double ptottime = 0.0, swaptime = 0.04;
-
-static int pupdate_time(void)
-{
- static double ltime;
- double time;
-
- time = PIL_check_seconds_timer();
-
- ptottime += (time - ltime);
- ltime = time;
- return (ptottime < 0);
-}
-
-static void toscreen(Pict *picture, struct ImBuf *ibuf)
-{
-
- if (ibuf == 0){
- printf("no ibuf !\n");
- return;
- }
-
- glRasterPos2f(0.0f, 0.0f);
-
- glDrawPixels(ibuf->x, ibuf->y, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
-
- pupdate_time();
-
- if(picture && (qualN & (SHIFT|LMOUSE))) {
- char str[256];
- cpack(-1);
- glRasterPos2f(0.02f, 0.03f);
- sprintf(str, "%s | %.2f frames/s\n", picture->name, 1.0 / swaptime);
- BMF_DrawString(G.fonts, str);
- }
-
- window_swap_buffers(g_window);
-}
-
-static void build_pict_list(char * first)
-{
- int size,pic,file;
- char *mem, name[256];
- short val;
- struct pict * picture = 0;
- struct ImBuf *ibuf = 0;
- int count = 0;
- char str[100];
- struct anim * anim;
-
- if (IMB_isanim(first)) {
- anim = IMB_open_anim(first, IB_rect);
- if (anim) {
- ibuf = IMB_anim_absolute(anim, 0);
- if (ibuf) {
- toscreen(NULL, ibuf);
- IMB_freeImBuf(ibuf);
- }
-
- for (pic = 0; pic < IMB_anim_get_duration(anim); pic ++) {
- picture = (Pict*)MEM_callocN(sizeof(Pict),"Pict");
- picture->anim = anim;
- picture->frame = pic;
- picture->IB_flags = IB_rect;
- sprintf(str, "%s : %d", first, pic + 1);
- picture->name = strdup(str);
- BLI_addtail(picsbase, picture);
- }
- }
- else printf("couldn't open anim %s\n", first);
- }
- else {
-
- strcpy(name,first);
-
- pupdate_time();
- ptottime = 1.0;
-
-/*
- O_DIRECT
- If set, all reads and writes on the resulting file descriptor will
- be performed directly to or from the user program buffer, provided
- appropriate size and alignment restrictions are met. Refer to the
- F_SETFL and F_DIOINFO commands in the fcntl(2) manual entry for
- information about how to determine the alignment constraints.
- O_DIRECT is a Silicon Graphics extension and is only supported on
- local EFS and XFS file systems.
-*/
- while(IMB_ispic(name)){
- file = open(name, O_BINARY|O_RDONLY, 0);
- if (file < 0) return;
- picture = (struct pict*)MEM_callocN(sizeof(struct pict), "picture");
- if (picture == 0){
- printf("Not enough memory for pict struct \n");
- close(file);
- return;
- }
- size = BLI_filesize(file);
-
- if (size < 1) {
- close(file);
- MEM_freeN(picture);
- return;
- }
-
- picture->size = size;
- picture->IB_flags = IB_rect;
-
- if (fromdisk == FALSE) {
- mem=(char *)MEM_mallocN(size, "build pic list");
- if (mem==0){
- printf("Couldn't get memory\n");
- close(file);
- MEM_freeN(picture);
- return;
- }
-
- if (read(file,mem,size) != size){
- printf("Error while reading %s\n",name);
- close(file);
- MEM_freeN(picture);
- MEM_freeN(mem);
- return;
- }
- } else mem = 0;
-
- picture->mem = mem;
- picture->name = strdup(name);
- close(file);
- BLI_addtail(picsbase,picture);
- count++;
-
- pupdate_time();
-
- if (ptottime > 1.0) {
- if (picture->mem) ibuf = IMB_ibImageFromMemory((int *) picture->mem, picture->size, picture->IB_flags);
- else ibuf = IMB_loadiffname(picture->name, picture->IB_flags);
- if (ibuf) {
- toscreen(picture, ibuf);
- IMB_freeImBuf(ibuf);
- }
- pupdate_time();
- ptottime = 0.0;
- }
-
- BLI_newname(name, +1);
-
- while(qtest()){
- switch(qreadN(&val)){
- case ESCKEY:
- if (val) return;
- break;
- }
- }
- }
- }
- return;
-}
-
-void playanim(int argc, char **argv)
-{
- struct ImBuf *ibuf = 0;
- struct pict *picture = 0;
- char name[256];
- short val = 0, go = TRUE, ibufx = 0, ibufy = 0;
- int event, stopped = FALSE, maxwinx, maxwiny;
- short /* c233 = FALSE, */ /* yuvx = FALSE, */ once = FALSE, sstep = FALSE, wait2 = FALSE, /* resetmap = FALSE, */ pause = 0;
- short pingpong = FALSE, direction = 1, next = 1, turbo = FALSE, /* doubleb = TRUE, */ noskip = FALSE;
- int sizex, sizey, ofsx, ofsy, i;
- /* This was done to disambiguate the name for use under c++. */
- struct anim * anim = 0;
- int start_x= 0, start_y= 0;
-
- while (argc > 1) {
- if (argv[1][0] == '-'){
- switch(argv[1][1]) {
- case 'm':
- fromdisk = TRUE;
- break;
- case 'p':
- if (argc>3) {
- start_x= atoi(argv[2]);
- start_y= atoi(argv[3]);
- argc-= 2;
- argv+= 2;
- } else {
- printf("too few arguments for -p (need 2): skipping\n");
- }
- break;
- case 'f':
- if (argc>3) {
- double fps = atof(argv[2]);
- double fps_base= atof(argv[3]);
- if (fps == 0) {
- fps = 1;
- printf("invalid fps,"
- "forcing 1\n");
- }
- swaptime = fps_base / fps;
- argc-= 2;
- argv+= 2;
- } else {
- printf("too few arguments for -f (need 2): skipping\n");
- }
- break;
- default:
- printf("unknown option '%c': skipping\n", argv[1][1]);
- break;
- }
- argc--;
- argv++;
- } else break;
- }
-
-#ifdef WITH_QUICKTIME
-#if defined (_WIN32) || defined (__APPLE__)
- /* Initialize QuickTime */
-#ifndef noErr
-#define noErr 0
-#endif
-
-#ifdef _WIN32
- if (InitializeQTML(0) != noErr)
- G.have_quicktime = FALSE;
- else
- G.have_quicktime = TRUE;
-#endif /* _WIN32 */
- if (EnterMovies() != noErr)
- G.have_quicktime = FALSE;
- else
-#endif /* _WIN32 || __APPLE__ */
- G.have_quicktime = TRUE;
-#endif /* WITH_QUICKTIME */
-
- if (argc > 1) strcpy(name,argv[1]);
- else {
- BLI_getwdN(name);
- if (name[strlen(name)-1] != '/') strcat(name,"/");
- }
-
- if (IMB_isanim(name)) {
- anim = IMB_open_anim(name, IB_rect);
- if (anim) {
- ibuf = IMB_anim_absolute(anim, 0);
- IMB_close_anim(anim);
- anim = NULL;
- }
- } else if (!IMB_ispic(name)) {
- exit(1);
- }
-
- if (ibuf == 0) ibuf = IMB_loadiffname(name, IB_rect);
- if (ibuf == 0){
- printf("couldn't open %s\n",name);
- exit(1);
- }
-
- #if !defined(WIN32) && !defined(__APPLE__)
- if (fork()) exit(0);
- #endif
-
- winlay_get_screensize(&maxwinx, &maxwiny);
-
- /* XXX, fixme zr */
- {
- extern void add_to_mainqueue(Window *win, void *user_data, short evt, short val, char ascii);
-
- g_window = window_open("Blender:Anim", start_x, start_y, ibuf->x, ibuf->y, 0);
- window_set_handler(g_window, add_to_mainqueue, NULL);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f);
- glMatrixMode(GL_MODELVIEW);
- }
-
- G.fonts= BMF_GetFont(BMF_kHelvetica10);
-
- ibufx = ibuf->x;
- ibufy = ibuf->y;
-
- if (maxwinx % ibuf->x) maxwinx = ibuf->x * (1 + (maxwinx / ibuf->x));
- if (maxwiny % ibuf->y) maxwiny = ibuf->y * (1 + (maxwiny / ibuf->y));
-
- glClearColor(0.0, 0.0, 0.0, 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- window_swap_buffers(g_window);
-
- build_pict_list(name);
-
- for (i = 2; i < argc; i++){
- strcpy(name, argv[i]);
- build_pict_list(name);
- }
-
- IMB_freeImBuf(ibuf);
- ibuf = 0;
-
- pupdate_time();
- ptottime = 0;
-
- while (go){
- if (pingpong) direction = -direction;
-
- if (direction == 1) picture = picsbase->first;
- else picture = picsbase->last;
-
- if (picture == 0){
- printf("couldn't find pictures\n");
- go = FALSE;
- }
- if (pingpong){
- if (direction == 1) picture = picture->next;
- else picture = picture->prev;
- }
- if (ptottime > 0.0) ptottime = 0.0;
-
- while (picture){
- if (ibuf != 0 && ibuf->type == 0) IMB_freeImBuf(ibuf);
-
- if (picture->ibuf) ibuf = picture->ibuf;
- else if (picture->anim) ibuf = IMB_anim_absolute(picture->anim, picture->frame);
- else if (picture->mem) ibuf = IMB_ibImageFromMemory((int *) picture->mem, picture->size, picture->IB_flags);
- else ibuf = IMB_loadiffname(picture->name, picture->IB_flags);
-
- if (ibuf){
- strcpy(ibuf->name, picture->name);
-
-#ifdef _WIN32
- window_set_title(g_window, picture->name);
-#endif
-
- while (pupdate_time()) PIL_sleep_ms(1);
- ptottime -= swaptime;
- toscreen(picture, ibuf);
- } /* else deleten */
- else {
- printf("error: can't play this image type\n");
- exit(0);
- }
-
- if (once){
- if (picture->next == 0) wait2 = TRUE;
- else if (picture->prev == 0) wait2 = TRUE;
- }
-
- next = direction;
-
- while ((qtest() != 0 ) || ( wait2 != 0)){
- if (wait2 && stopped) {
- stopped = FALSE;
- }
-
- event = qreadN(&val);
- /* printf("%d %d\n", event, val); */
-
- if (wait2){
- pupdate_time();
- ptottime = 0;
- }
- switch (event){
- case AKEY:
- if (val)
- noskip = !noskip;
- break;
- case PKEY:
- if (val)
- pingpong = !pingpong;
- break;
- case SLASHKEY:
- if (val) {
- if (qualN & SHIFT) {
- if (ibuf)
- printf(" Name: %s | Speed: %.2f frames/s\n", ibuf->name, 1.0 / swaptime);
- } else {
- swaptime = 1.0 / 5.0;
- }
- }
- break;
- case LEFTARROWKEY:
- if (val){
- sstep = TRUE;
- wait2 = FALSE;
- if (qualN & SHIFT) {
- picture = picsbase->first;
- next = 0;
- } else {
- next = -1;
- }
- }
- break;
- case DOWNARROWKEY:
- if (val){
- wait2 = FALSE;
- if (qualN & SHIFT) {
- next = direction = -1;
- } else {
- next = -10;
- sstep = TRUE;
- }
- }
- break;
- case RIGHTARROWKEY:
- if (val){
- sstep = TRUE;
- wait2 = FALSE;
- if (qualN & SHIFT) {
- picture = picsbase->last;
- next = 0;
- } else {
- next = 1;
- }
- }
- break;
- case UPARROWKEY:
- if (val){
- wait2 = FALSE;
- if (qualN & SHIFT) {
- next = direction = 1;
- } else {
- next = 10;
- sstep = TRUE;
- }
- }
- break;
- case LEFTMOUSE:
- case MOUSEX:
- if (qualN & LMOUSE) {
- window_get_size(g_window,&sizex,&sizey);
- picture = picsbase->first;
- i = 0;
- while (picture){
- i ++;
- picture = picture->next;
- }
- i = (i * val) / sizex;
- picture = picsbase->first;
- for (; i > 0; i--){
- if (picture->next == 0) break;
- picture = picture->next;
- }
- sstep = TRUE;
- wait2 = FALSE;
- next = 0;
- }
- break;
- go= FALSE;
- break;
- case EQUALKEY:
- if (val) {
- if (qualN & SHIFT) {
- pause ++;
- printf("pause:%d\n", pause);
- } else swaptime /= 1.1;
- }
- break;
- case MINUSKEY:
- if (val) {
- if (qualN & SHIFT) {
- pause --;
- printf("pause:%d\n", pause);
- } else swaptime *= 1.1;
- }
- break;
- case PAD0:
- if (val){
- if (once) once = wait2 = FALSE;
- else {
- picture = 0;
- once = TRUE;
- wait2 = FALSE;
- }
- }
- break;
- case RETKEY:
- case PADENTER:
- if (val){
- wait2 = sstep = FALSE;
- }
- break;
- case PADPERIOD:
- if (val){
- if (sstep) wait2 = FALSE;
- else {
- sstep = TRUE;
- wait2 = !wait2;
- }
- }
- break;
- case PAD1:
- swaptime = 1.0 / 60.0;
- break;
- case PAD2:
- swaptime = 1.0 / 50.0;
- break;
- case PAD3:
- swaptime = 1.0 / 30.0;
- break;
- case PAD4:
- if (qualN & SHIFT)
- swaptime = 1.0 / 24.0;
- else
- swaptime = 1.0 / 25.0;
- break;
- case PAD5:
- swaptime = 1.0 / 20.0;
- break;
- case PAD6:
- swaptime = 1.0 / 15.0;
- break;
- case PAD7:
- swaptime = 1.0 / 12.0;
- break;
- case PAD8:
- swaptime = 1.0 / 10.0;
- break;
- case PAD9:
- swaptime = 1.0 / 6.0;
- break;
- case PADPLUSKEY:
- if (val == 0) break;
- zoomx += 2.0;
- zoomy += 2.0;
- case PADMINUS:
- if (val == 0) break;
- if (zoomx > 1.0) zoomx -= 1.0;
- if (zoomy > 1.0) zoomy -= 1.0;
- window_get_position(g_window,&ofsx,&ofsy);
- window_get_size(g_window,&sizex,&sizey);
- ofsx += sizex/2;
- ofsy += sizey/2;
- sizex = zoomx * ibufx;
- sizey = zoomy * ibufy;
- ofsx -= sizex/2;
- ofsy -= sizey/2;
-/* window_set_position(g_window,sizex,sizey); */
- window_set_size(g_window,sizex,sizey);
- break;
- case RESHAPE:
- case REDRAW:
- window_get_size(g_window,&sizex,&sizey);
- window_make_active(g_window);
-
- glViewport(0, 0, sizex, sizey);
- glScissor(0, 0, sizex, sizey);
-
- zoomx = (float) sizex / ibufx;
- zoomy = (float) sizey / ibufy;
- zoomx = floor(zoomx + 0.5);
- zoomy = floor(zoomy + 0.5);
- if (zoomx < 1.0) zoomx = 1.0;
- if (zoomy < 1.0) zoomy = 1.0;
-
- sizex = zoomx * ibufx;
- sizey = zoomy * ibufy;
-
- glPixelZoom(zoomx, zoomy);
- glEnable(GL_DITHER);
- ptottime = 0.0;
- toscreen(picture, ibuf);
- while (qtest()) qreadN(&val);
-
- break;
- case ESCKEY:
- case WINCLOSE:
- case WINQUIT:
- go = FALSE;
- break;
- }
- if (go == FALSE) break;
- }
-
- wait2 = sstep;
-
- if (wait2 == 0 && stopped == 0) {
- stopped = TRUE;
- }
-
- pupdate_time();
-
- if (picture && next) {
- /* always at least set one step */
- while (picture){
- if (next < 0) picture = picture->prev;
- else picture = picture->next;
-
- if (once && picture != 0){
- if (picture->next == 0) wait2 = TRUE;
- else if (picture->prev == 0) wait2 = TRUE;
- }
-
- if (wait2 || ptottime < swaptime || turbo || noskip) break;
- ptottime -= swaptime;
- }
- if (picture == 0 && sstep) {
- if (next < 0) picture = picsbase->last;
- else if (next > 0) picture = picsbase->first;
- }
- }
- if (go == FALSE) break;
- }
- }
- picture = picsbase->first;
- anim = NULL;
- while (picture) {
- if (picture && picture->anim && (anim != picture->anim)) {
- // to prevent divx crashes
- anim = picture->anim;
- IMB_close_anim(anim);
- }
- if(picture->ibuf) IMB_freeImBuf(picture->ibuf);
- if(picture->mem) MEM_freeN(picture->mem);
-
- picture = picture->next;
- }
-#ifdef WITH_QUICKTIME
-#if defined (_WIN32) || defined (__APPLE__)
- if(G.have_quicktime) {
- ExitMovies();
-#ifdef _WIN32
- TerminateQTML();
-#endif /* _WIN32 */
- }
-#endif /* _WIN32 || __APPLE__ */
-#endif /* WITH_QUICKTIME */
-
- /* cleanup */
- if(ibuf) IMB_freeImBuf(ibuf);
- BLI_freelistN(picsbase);
- free_blender();
- window_destroy(g_window);
-
- if(totblock!=0) {
- printf("Error Totblock: %d\n",totblock);
- MEM_printmemlist();
- }
-}
diff --git a/source/blender/src/poseobject.c b/source/blender/src/poseobject.c
deleted file mode 100644
index 585ff320b71..00000000000
--- a/source/blender/src/poseobject.c
+++ /dev/null
@@ -1,1258 +0,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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * Contributor(s): Ton Roosendaal, Blender Foundation '05, full recode.
- *
- * ***** END GPL LICENSE BLOCK *****
- * support for animation modes - Reevan McKay
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_arithb.h"
-#include "BLI_blenlib.h"
-
-#include "DNA_action_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_modifier_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_view3d_types.h"
-
-#include "BKE_action.h"
-#include "BKE_armature.h"
-#include "BKE_blender.h"
-#include "BKE_constraint.h"
-#include "BKE_deform.h"
-#include "BKE_depsgraph.h"
-#include "BKE_displist.h"
-#include "BKE_global.h"
-#include "BKE_modifier.h"
-#include "BKE_object.h"
-#include "BKE_utildefines.h"
-#include "BKE_ipo.h"
-
-#include "BIF_editarmature.h"
-#include "BIF_editaction.h"
-#include "BIF_editconstraint.h"
-#include "BIF_editdeform.h"
-#include "BIF_gl.h"
-#include "BIF_graphics.h"
-#include "BIF_interface.h"
-#include "BIF_poseobject.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-#include "BIF_screen.h"
-
-#include "BDR_editobject.h"
-
-#include "BSE_edit.h"
-#include "BSE_editipo.h"
-#include "BSE_trans_types.h"
-
-#include "mydevice.h"
-#include "blendef.h"
-#include "transform.h"
-
-#include "BIF_transform.h" /* for autokey TFM_TRANSLATION, etc */
-
-void enter_posemode(void)
-{
- Base *base;
- Object *ob;
- bArmature *arm;
-
- if(G.scene->id.lib) return;
- base= BASACT;
- if(base==NULL) return;
-
- ob= base->object;
-
- if (ob->id.lib){
- error ("Can't pose libdata");
- return;
- }
-
- switch (ob->type){
- case OB_ARMATURE:
- arm= get_armature(ob);
- if( arm==NULL ) return;
-
- ob->flag |= OB_POSEMODE;
- base->flag= ob->flag;
-
- allqueue(REDRAWHEADERS, 0);
- allqueue(REDRAWBUTSALL, 0);
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWVIEW3D, 0);
- break;
- default:
- return;
- }
-
- if (G.obedit) exit_editmode(EM_FREEDATA|EM_WAITCURSOR);
- G.f &= ~(G_VERTEXPAINT | G_TEXTUREPAINT | G_WEIGHTPAINT);
-}
-
-void set_pose_keys (Object *ob)
-{
- bArmature *arm= ob->data;
- bPoseChannel *chan;
-
- if (ob->pose){
- for (chan=ob->pose->chanbase.first; chan; chan=chan->next){
- Bone *bone= chan->bone;
- if(bone && (bone->flag & BONE_SELECTED) && (arm->layer & bone->layer)) {
- chan->flag |= POSE_KEY;
- }
- else {
- chan->flag &= ~POSE_KEY;
- }
- }
- }
-}
-
-
-void exit_posemode(void)
-{
- Object *ob= OBACT;
- Base *base= BASACT;
-
- if(ob==NULL) return;
-
- ob->flag &= ~OB_POSEMODE;
- base->flag= ob->flag;
-
- countall();
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWHEADERS, 0);
- allqueue(REDRAWBUTSALL, 0);
-
- scrarea_queue_headredraw(curarea);
-}
-
-/* called by buttons to find a bone to display/edit values for */
-bPoseChannel *get_active_posechannel (Object *ob)
-{
- bArmature *arm= ob->data;
- bPoseChannel *pchan;
-
- /* find active */
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if(pchan->bone && (pchan->bone->flag & BONE_ACTIVE) && (pchan->bone->layer & arm->layer))
- return pchan;
- }
-
- return NULL;
-}
-
-/* if a selected or active bone is protected, throw error and return 1 */
-/* only_selected==1 : the active bone is allowed to be protected */
-static int pose_has_protected_selected(Object *ob, int only_selected)
-{
-
- /* check protection */
- if(ob->proxy) {
- bPoseChannel *pchan;
- bArmature *arm= ob->data;
-
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if(pchan->bone && (pchan->bone->layer & arm->layer)) {
- if(pchan->bone->layer & arm->layer_protected) {
- if(only_selected && (pchan->bone->flag & BONE_ACTIVE));
- else if(pchan->bone->flag & (BONE_ACTIVE|BONE_SELECTED))
- break;
- }
- }
- }
- if(pchan) {
- error("Cannot change Proxy protected bones");
- return 1;
- }
- }
- return 0;
-}
-
-/* only for real IK, not for auto-IK */
-int pose_channel_in_IK_chain(Object *ob, bPoseChannel *pchan)
-{
- bConstraint *con;
- Bone *bone;
-
- for(con= pchan->constraints.first; con; con= con->next) {
- if(con->type==CONSTRAINT_TYPE_KINEMATIC) {
- bKinematicConstraint *data= con->data;
- if((data->flag & CONSTRAINT_IK_AUTO)==0)
- return 1;
- }
- }
- for(bone= pchan->bone->childbase.first; bone; bone= bone->next) {
- pchan= get_pose_channel(ob->pose, bone->name);
- if(pchan && pose_channel_in_IK_chain(ob, pchan))
- return 1;
- }
- return 0;
-}
-
-/* ********************************************** */
-
-/* For the object with pose/action: create path curves for selected bones
- * This recalculates the WHOLE path within the pchan->pathsf and pchan->pathef range
- */
-void pose_calculate_path(Object *ob)
-{
- bArmature *arm;
- bPoseChannel *pchan;
- Base *base;
- float *fp;
- int cfra;
- int sfra, efra;
-
- if (ob==NULL || ob->pose==NULL)
- return;
- arm= ob->data;
-
- /* version patch for older files here (do_versions patch too complicated) */
- if ((arm->pathsf == 0) || (arm->pathef == 0)) {
- arm->pathsf = SFRA;
- arm->pathef = EFRA;
- }
- if (arm->pathsize == 0) {
- arm->pathsize = 1;
- }
-
- /* set frame values */
- cfra= CFRA;
- sfra = arm->pathsf;
- efra = arm->pathef;
- if (efra <= sfra) {
- error("Can't calculate paths when pathlen <= 0");
- return;
- }
-
- waitcursor(1);
-
- /* hack: for unsaved files, set OB_RECALC so that paths can get calculated */
- if ((ob->recalc & OB_RECALC)==0) {
- ob->recalc |= OB_RECALC;
- DAG_object_update_flags(G.scene, ob, screen_view3d_layers());
- }
- else
- DAG_object_update_flags(G.scene, ob, screen_view3d_layers());
-
-
- /* malloc the path blocks */
- for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if ((pchan->bone) && (pchan->bone->flag & BONE_SELECTED)) {
- if (arm->layer & pchan->bone->layer) {
- pchan->pathlen= efra-sfra+1;
- pchan->pathsf= sfra;
- pchan->pathef= efra+1;
- if (pchan->path)
- MEM_freeN(pchan->path);
- pchan->path= MEM_callocN(3*pchan->pathlen*sizeof(float), "pchan path");
- }
- }
- }
-
- for (CFRA=sfra; CFRA<=efra; CFRA++) {
- /* do all updates */
- for (base= FIRSTBASE; base; base= base->next) {
- if (base->object->recalc) {
- int temp= base->object->recalc;
- object_handle_update(base->object);
- base->object->recalc= temp;
- }
- }
-
- for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if ((pchan->bone) && (pchan->bone->flag & BONE_SELECTED)) {
- if (arm->layer & pchan->bone->layer) {
- if (pchan->path) {
- fp= pchan->path+3*(CFRA-sfra);
-
- if (arm->pathflag & ARM_PATH_HEADS) {
- VECCOPY(fp, pchan->pose_head);
- }
- else {
- VECCOPY(fp, pchan->pose_tail);
- }
-
- Mat4MulVecfl(ob->obmat, fp);
- }
- }
- }
- }
- }
-
- waitcursor(0);
-
- CFRA= cfra;
- allqueue(REDRAWVIEW3D, 0); /* recalc tags are still there */
- allqueue(REDRAWBUTSEDIT, 0);
-}
-
-/* For the object with pose/action: update paths for those that have got them
- * This should selectively update paths that exist...
- */
-void pose_recalculate_paths(Object *ob)
-{
- bArmature *arm;
- bPoseChannel *pchan;
- Base *base;
- float *fp;
- int cfra;
- int sfra, efra;
-
- if (ob==NULL || ob->pose==NULL)
- return;
- arm= ob->data;
-
- /* set frame values */
- cfra = CFRA;
- sfra = efra = cfra;
- for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if ((pchan->bone) && (arm->layer & pchan->bone->layer)) {
- if (pchan->path) {
- /* if the pathsf and pathef aren't initialised, abort! */
- if (ELEM(0, pchan->pathsf, pchan->pathef))
- return;
-
- /* try to increase area to do (only as much as needed) */
- sfra= MIN2(sfra, pchan->pathsf);
- efra= MAX2(efra, pchan->pathef);
- }
- }
- }
- if (efra <= sfra) return;
-
- waitcursor(1);
-
- /* hack: for unsaved files, set OB_RECALC so that paths can get calculated */
- if ((ob->recalc & OB_RECALC)==0) {
- ob->recalc |= OB_RECALC;
- DAG_object_update_flags(G.scene, ob, screen_view3d_layers());
- }
- else
- DAG_object_update_flags(G.scene, ob, screen_view3d_layers());
-
- for (CFRA=sfra; CFRA<=efra; CFRA++) {
- /* do all updates */
- for (base= FIRSTBASE; base; base= base->next) {
- if (base->object->recalc) {
- int temp= base->object->recalc;
- object_handle_update(base->object);
- base->object->recalc= temp;
- }
- }
-
- for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if ((pchan->bone) && (arm->layer & pchan->bone->layer)) {
- if (pchan->path) {
- /* only update if:
- * - in range of this pchan's existing path
- * - ... insert evil filtering/optimising conditions here...
- */
- if (IN_RANGE(CFRA, pchan->pathsf, pchan->pathef)) {
- fp= pchan->path+3*(CFRA-sfra);
-
- if (arm->pathflag & ARM_PATH_HEADS) {
- VECCOPY(fp, pchan->pose_head);
- }
- else {
- VECCOPY(fp, pchan->pose_tail);
- }
-
- Mat4MulVecfl(ob->obmat, fp);
- }
- }
- }
- }
- }
-
- waitcursor(0);
-
- CFRA= cfra;
- allqueue(REDRAWVIEW3D, 0); /* recalc tags are still there */
- allqueue(REDRAWBUTSEDIT, 0);
-}
-
-/* for the object with pose/action: clear path curves for selected bones only */
-void pose_clear_paths(Object *ob)
-{
- bPoseChannel *pchan;
-
- if (ob==NULL || ob->pose==NULL)
- return;
-
- /* free the path blocks */
- for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if ((pchan->bone) && (pchan->bone->flag & BONE_SELECTED)) {
- if (pchan->path) {
- MEM_freeN(pchan->path);
- pchan->path= NULL;
- }
- }
- }
-
- allqueue(REDRAWVIEW3D, 0);
-}
-
-
-
-void pose_select_constraint_target(void)
-{
- Object *ob= OBACT;
- bArmature *arm= ob->data;
- bPoseChannel *pchan;
- bConstraint *con;
-
- /* paranoia checks */
- if (!ob && !ob->pose) return;
- if (ob==G.obedit || (ob->flag & OB_POSEMODE)==0) return;
-
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if (arm->layer & pchan->bone->layer) {
- if (pchan->bone->flag & (BONE_ACTIVE|BONE_SELECTED)) {
- for (con= pchan->constraints.first; con; con= con->next) {
- bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
- ListBase targets = {NULL, NULL};
- bConstraintTarget *ct;
-
- if (cti && cti->get_constraint_targets) {
- cti->get_constraint_targets(con, &targets);
-
- for (ct= targets.first; ct; ct= ct->next) {
- if ((ct->tar == ob) && (ct->subtarget[0])) {
- bPoseChannel *pchanc= get_pose_channel(ob->pose, ct->subtarget);
- if(pchanc)
- pchanc->bone->flag |= BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL;
- }
- }
-
- if (cti->flush_constraint_targets)
- cti->flush_constraint_targets(con, &targets, 1);
- }
- }
- }
- }
- }
-
- allqueue (REDRAWVIEW3D, 0);
- allqueue (REDRAWBUTSOBJECT, 0);
- allqueue (REDRAWOOPS, 0);
-
- BIF_undo_push("Select constraint target");
-
-}
-
-/* context: active channel */
-void pose_special_editmenu(void)
-{
- Object *ob= OBACT;
- short nr;
-
- /* paranoia checks */
- if(!ob && !ob->pose) return;
- if(ob==G.obedit || (ob->flag & OB_POSEMODE)==0) return;
-
- nr= pupmenu("Specials%t|Select Constraint Target%x1|Flip Left-Right Names%x2|Calculate Paths%x3|Clear Paths%x4|Clear User Transform %x5|Relax Pose %x6");
- if(nr==1) {
- pose_select_constraint_target();
- }
- else if(nr==2) {
- pose_flip_names();
- }
- else if(nr==3) {
- pose_calculate_path(ob);
- }
- else if(nr==4) {
- pose_clear_paths(ob);
- }
- else if(nr==5) {
- rest_pose(ob->pose);
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- BIF_undo_push("Clear User Transform Pose");
- }
- else if(nr==6) {
- pose_relax();
- }
-}
-
-void pose_add_IK(void)
-{
- Object *ob= OBACT;
-
- /* paranoia checks */
- if(!ob && !ob->pose) return;
- if(ob==G.obedit || (ob->flag & OB_POSEMODE)==0) return;
-
- add_constraint(1); /* 1 means only IK */
-}
-
-/* context: all selected channels */
-void pose_clear_IK(void)
-{
- Object *ob= OBACT;
- bArmature *arm= ob->data;
- bPoseChannel *pchan;
- bConstraint *con;
- bConstraint *next;
-
- /* paranoia checks */
- if(!ob && !ob->pose) return;
- if(ob==G.obedit || (ob->flag & OB_POSEMODE)==0) return;
-
- if(pose_has_protected_selected(ob, 0))
- return;
-
- if(okee("Remove IK constraint(s)")==0) return;
-
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if(arm->layer & pchan->bone->layer) {
- if(pchan->bone->flag & (BONE_ACTIVE|BONE_SELECTED)) {
-
- for(con= pchan->constraints.first; con; con= next) {
- next= con->next;
- if(con->type==CONSTRAINT_TYPE_KINEMATIC) {
- BLI_remlink(&pchan->constraints, con);
- free_constraint_data(con);
- MEM_freeN(con);
- }
- }
- pchan->constflag &= ~(PCHAN_HAS_IK|PCHAN_HAS_TARGET);
- }
- }
- }
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); // and all its relations
-
- allqueue (REDRAWVIEW3D, 0);
- allqueue (REDRAWBUTSOBJECT, 0);
- allqueue (REDRAWOOPS, 0);
-
- BIF_undo_push("Remove IK constraint(s)");
-}
-
-void pose_clear_constraints(void)
-{
- Object *ob= OBACT;
- bArmature *arm= ob->data;
- bPoseChannel *pchan;
-
- /* paranoia checks */
- if(!ob && !ob->pose) return;
- if(ob==G.obedit || (ob->flag & OB_POSEMODE)==0) return;
-
- if(pose_has_protected_selected(ob, 0))
- return;
-
- if(okee("Remove Constraints")==0) return;
-
- /* find active */
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if(arm->layer & pchan->bone->layer) {
- if(pchan->bone->flag & (BONE_ACTIVE|BONE_SELECTED)) {
- free_constraints(&pchan->constraints);
- pchan->constflag= 0;
- }
- }
- }
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); // and all its relations
-
- allqueue (REDRAWVIEW3D, 0);
- allqueue (REDRAWBUTSOBJECT, 0);
- allqueue (REDRAWOOPS, 0);
-
- BIF_undo_push("Remove Constraint(s)");
-
-}
-
-
-void pose_copy_menu(void)
-{
- Object *ob= OBACT;
- bArmature *arm= ob->data;
- bPoseChannel *pchan, *pchanact;
- short nr;
- int i=0;
-
- /* paranoia checks */
- if(!ob && !ob->pose) return;
- if(ob==G.obedit || (ob->flag & OB_POSEMODE)==0) return;
-
- /* find active */
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if(pchan->bone->flag & BONE_ACTIVE) break;
- }
-
- if(pchan==NULL) return;
-
- if(pose_has_protected_selected(ob, 1))
- return;
-
- pchanact= pchan;
-
- i= BLI_countlist(&(pchanact->constraints)); /* if there are 24 or less, allow for the user to select constraints */
- if (i<25)
- nr= pupmenu("Copy Pose Attributes %t|Local Location%x1|Local Rotation%x2|Local Size%x3|%l|Visual Location %x9|Visual Rotation%x10|Visual Size%x11|%l|Constraints (All)%x4|Constraints...%x5|%l|Transform Locks%x6|IK Limits%x7|Bone Shape%x8");
- else
- nr= pupmenu("Copy Pose Attributes %t|Local Location%x1|Local Rotation%x2|Local Size%x3|%l|Visual Location %x9|Visual Rotation%x10|Visual Size%x11|%l|Constraints (All)%x4|%l|Transform Locks%x6|IK Limits%x7|Bone Shape%x8");
-
- if(nr==-1) return;
- if(nr!=5) {
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if( (arm->layer & pchan->bone->layer) &&
- (pchan->bone->flag & BONE_SELECTED) &&
- (pchan!=pchanact)
- ) {
- switch (nr) {
- case 1: /* Local Location */
- VECCOPY(pchan->loc, pchanact->loc);
- break;
- case 2: /* Local Rotation */
- QUATCOPY(pchan->quat, pchanact->quat);
- break;
- case 3: /* Local Size */
- VECCOPY(pchan->size, pchanact->size);
- break;
- case 4: /* All Constraints */
- {
- free_constraints(&pchan->constraints);
- copy_constraints(&pchan->constraints, &pchanact->constraints);
- pchan->constflag = pchanact->constflag;
- }
- break;
- case 6: /* Transform Locks */
- pchan->protectflag = pchanact->protectflag;
- break;
- case 7: /* IK (DOF) settings */
- {
- pchan->ikflag = pchanact->ikflag;
- VECCOPY(pchan->limitmin, pchanact->limitmin);
- VECCOPY(pchan->limitmax, pchanact->limitmax);
- VECCOPY(pchan->stiffness, pchanact->stiffness);
- pchan->ikstretch= pchanact->ikstretch;
- }
- break;
- case 8: /* Custom Bone Shape */
- pchan->custom = pchanact->custom;
- break;
- case 9: /* Visual Location */
- armature_loc_pose_to_bone(pchan, pchanact->pose_mat[3], pchan->loc);
- break;
- case 10: /* Visual Rotation */
- {
- float delta_mat[4][4], quat[4];
-
- armature_mat_pose_to_bone(pchan, pchanact->pose_mat, delta_mat);
- Mat4ToQuat(delta_mat, quat);
- QUATCOPY(pchan->quat, quat);
- }
- break;
- case 11: /* Visual Size */
- {
- float delta_mat[4][4], size[4];
-
- armature_mat_pose_to_bone(pchan, pchanact->pose_mat, delta_mat);
- Mat4ToSize(delta_mat, size);
- VECCOPY(pchan->size, size);
- }
- }
- }
- }
- } else { /* constraints, optional */
- bConstraint *con, *con_back;
- int const_toggle[24];
- ListBase const_copy={0, 0};
-
- duplicatelist (&const_copy, &(pchanact->constraints));
-
- /* build the puplist of constraints */
- for (con = pchanact->constraints.first, i=0; con; con=con->next, i++){
- const_toggle[i]= 1;
- add_numbut(i, TOG|INT, con->name, 0, 0, &(const_toggle[i]), "");
- }
-
- if (!do_clever_numbuts("Select Constraints", i, REDRAW)) {
- BLI_freelistN(&const_copy);
- return;
- }
-
- /* now build a new listbase from the options selected */
- for (i=0, con=const_copy.first; con; i++) {
- if (!const_toggle[i]) {
- con_back= con->next;
- BLI_freelinkN(&const_copy, con);
- con= con_back;
- } else {
- con= con->next;
- }
- }
-
- /* Copy the temo listbase to the selected posebones */
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if( (arm->layer & pchan->bone->layer) &&
- (pchan->bone->flag & BONE_SELECTED) &&
- (pchan!=pchanact)
- ) {
- free_constraints(&pchan->constraints);
- copy_constraints(&pchan->constraints, &const_copy);
- pchan->constflag = pchanact->constflag;
- }
- }
- BLI_freelistN(&const_copy);
- update_pose_constraint_flags(ob->pose); /* we could work out the flags but its simpler to do this */
- }
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); // and all its relations
-
- allqueue (REDRAWVIEW3D, 0);
- allqueue (REDRAWBUTSOBJECT, 0);
- allqueue (REDRAWOOPS, 0);
-
- BIF_undo_push("Copy Pose Attributes");
-
-}
-
-/* ******************** copy/paste pose ********************** */
-
-static bPose *g_posebuf=NULL;
-
-void free_posebuf(void)
-{
- if (g_posebuf) {
- // was copied without constraints
- BLI_freelistN (&g_posebuf->chanbase);
- MEM_freeN (g_posebuf);
- }
- g_posebuf=NULL;
-}
-
-void copy_posebuf (void)
-{
- Object *ob= OBACT;
-
- if (!ob || !ob->pose){
- error ("No Pose");
- return;
- }
-
- free_posebuf();
-
- set_pose_keys(ob); // sets chan->flag to POSE_KEY if bone selected
- copy_pose(&g_posebuf, ob->pose, 0);
-
-}
-
-void paste_posebuf (int flip)
-{
- Object *ob= OBACT;
- bPoseChannel *chan, *pchan;
- float eul[4];
- char name[32];
-
- if (!ob || !ob->pose)
- return;
-
- if (!g_posebuf){
- error ("Copy buffer is empty");
- return;
- }
-
- /*
- // disabled until protected bones in proxies follow the rules everywhere else!
- if(pose_has_protected_selected(ob, 1))
- return;
- */
-
- /* Safely merge all of the channels in this pose into
- any existing pose */
- for (chan=g_posebuf->chanbase.first; chan; chan=chan->next) {
- if (chan->flag & POSE_KEY) {
- BLI_strncpy(name, chan->name, sizeof(name));
- if (flip)
- bone_flip_name (name, 0); // 0 = don't strip off number extensions
-
- /* only copy when channel exists, poses are not meant to add random channels to anymore */
- pchan= get_pose_channel(ob->pose, name);
-
- if (pchan) {
- /* only loc rot size */
- /* only copies transform info for the pose */
- VECCOPY(pchan->loc, chan->loc);
- VECCOPY(pchan->size, chan->size);
- QUATCOPY(pchan->quat, chan->quat);
- pchan->flag= chan->flag;
-
- if (flip) {
- pchan->loc[0]*= -1;
-
- QuatToEul(pchan->quat, eul);
- eul[1]*= -1;
- eul[2]*= -1;
- EulToQuat(eul, pchan->quat);
- }
-
- if (G.flags & G_RECORDKEYS) {
- ID *id= &ob->id;
-
- /* Set keys on pose */
- if (chan->flag & POSE_ROT) {
- insertkey(id, ID_PO, pchan->name, NULL, AC_QUAT_X, 0);
- insertkey(id, ID_PO, pchan->name, NULL, AC_QUAT_Y, 0);
- insertkey(id, ID_PO, pchan->name, NULL, AC_QUAT_Z, 0);
- insertkey(id, ID_PO, pchan->name, NULL, AC_QUAT_W, 0);
- }
- if (chan->flag & POSE_SIZE) {
- insertkey(id, ID_PO, pchan->name, NULL, AC_SIZE_X, 0);
- insertkey(id, ID_PO, pchan->name, NULL, AC_SIZE_Y, 0);
- insertkey(id, ID_PO, pchan->name, NULL, AC_SIZE_Z, 0);
- }
- if (chan->flag & POSE_LOC) {
- insertkey(id, ID_PO, pchan->name, NULL, AC_LOC_X, 0);
- insertkey(id, ID_PO, pchan->name, NULL, AC_LOC_Y, 0);
- insertkey(id, ID_PO, pchan->name, NULL, AC_LOC_Z, 0);
- }
-
- /* clear any unkeyed tags */
- if (chan->bone)
- chan->bone->flag &= ~BONE_UNKEYED;
- }
- else {
- /* add unkeyed tags */
- if (chan->bone)
- chan->bone->flag |= BONE_UNKEYED;
- }
- }
- }
- }
-
- /* Update event for pose and deformation children */
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
-
- if (G.flags & G_RECORDKEYS) {
- remake_action_ipos(ob->action);
- allqueue (REDRAWIPO, 0);
- allqueue (REDRAWVIEW3D, 0);
- allqueue (REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- }
- else {
- /* need to trick depgraph, action is not allowed to execute on pose */
- where_is_pose(ob);
- ob->recalc= 0;
- }
-
- BIF_undo_push("Paste Action Pose");
-}
-
-/* ********************************************** */
-
-/* context weightpaint and deformer in posemode */
-void pose_adds_vgroups(Object *meshobj, int heatweights)
-{
- extern VPaint Gwp; /* from vpaint */
- Object *poseobj= modifiers_isDeformedByArmature(meshobj);
-
- if(poseobj==NULL || (poseobj->flag & OB_POSEMODE)==0) {
- error("The active object must have a deforming armature in pose mode");
- return;
- }
-
- add_verts_to_dgroups(meshobj, poseobj, heatweights, (Gwp.flag & VP_MIRROR_X));
-
- if(heatweights)
- BIF_undo_push("Apply Bone Heat Weights to Vertex Groups");
- else
- BIF_undo_push("Apply Bone Envelopes to Vertex Groups");
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
-
- // and all its relations
- DAG_object_flush_update(G.scene, meshobj, OB_RECALC_DATA);
-}
-
-/* ********************************************** */
-
-/* context active object */
-void pose_flip_names(void)
-{
- Object *ob= OBACT;
- bArmature *arm= ob->data;
- bPoseChannel *pchan;
- char newname[32];
-
- /* paranoia checks */
- if(!ob && !ob->pose) return;
- if(ob==G.obedit || (ob->flag & OB_POSEMODE)==0) return;
-
- if(pose_has_protected_selected(ob, 0))
- return;
-
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if(arm->layer & pchan->bone->layer) {
- if(pchan->bone->flag & (BONE_ACTIVE|BONE_SELECTED)) {
- BLI_strncpy(newname, pchan->name, sizeof(newname));
- bone_flip_name(newname, 1); // 1 = do strip off number extensions
- armature_bone_rename(ob->data, pchan->name, newname);
- }
- }
- }
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue (REDRAWACTION, 0);
- allqueue(REDRAWOOPS, 0);
- BIF_undo_push("Flip names");
-
-}
-
-/* context active object, or weightpainted object with armature in posemode */
-void pose_activate_flipped_bone(void)
-{
- Object *ob= OBACT;
- bArmature *arm= ob->data;
-
- if(ob==NULL) return;
-
- if(G.f & G_WEIGHTPAINT) {
- ob= modifiers_isDeformedByArmature(ob);
- }
- if(ob && (ob->flag & OB_POSEMODE)) {
- bPoseChannel *pchan, *pchanf;
-
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if(arm->layer & pchan->bone->layer) {
- if(pchan->bone->flag & BONE_ACTIVE)
- break;
- }
- }
- if(pchan) {
- char name[32];
-
- BLI_strncpy(name, pchan->name, 32);
- bone_flip_name(name, 1); // 0 = do not strip off number extensions
-
- pchanf= get_pose_channel(ob->pose, name);
- if(pchanf && pchanf!=pchan) {
- pchan->bone->flag &= ~(BONE_SELECTED|BONE_ACTIVE);
- pchanf->bone->flag |= (BONE_SELECTED|BONE_ACTIVE);
-
- /* in weightpaint we select the associated vertex group too */
- if(G.f & G_WEIGHTPAINT) {
- vertexgroup_select_by_name(OBACT, name);
- DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
- }
-
- select_actionchannel_by_name(ob->action, name, 1);
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWIPO, 0); /* To force action/constraint ipo update */
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWOOPS, 0);
- }
- }
- }
-}
-
-/* This function pops up the move-to-layer popup widgets when the user
- * presses either SHIFT-MKEY or MKEY in PoseMode OR EditMode (for Armatures)
- */
-void pose_movetolayer(void)
-{
- Object *ob= OBACT;
- bArmature *arm;
- short lay= 0;
-
- if (ob==NULL) return;
- arm= ob->data;
-
- if (G.qual & LR_SHIFTKEY) {
- /* armature layers */
- lay= arm->layer;
- if ( movetolayer_short_buts(&lay, "Armature Layers")==0 ) return;
- if (lay==0) return;
- arm->layer= lay;
- if(ob->pose)
- ob->pose->proxy_layer= lay;
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- }
- else if (G.obedit) {
- /* the check for editbone layer moving needs to occur before posemode one to work */
- EditBone *ebo;
- EditBone *flipBone;
-
- for (ebo= G.edbo.first; ebo; ebo= ebo->next) {
- if (arm->layer & ebo->layer) {
- if (ebo->flag & BONE_SELECTED)
- lay |= ebo->layer;
- }
- }
- if (lay==0) return;
-
- if ( movetolayer_short_buts(&lay, "Bone Layers")==0 ) return;
- if (lay==0) return;
-
- for (ebo= G.edbo.first; ebo; ebo= ebo->next) {
- if (arm->layer & ebo->layer) {
- if (ebo->flag & BONE_SELECTED) {
- ebo->layer= lay;
- if (arm->flag & ARM_MIRROR_EDIT) {
- flipBone = armature_bone_get_mirrored(ebo);
- if (flipBone)
- flipBone->layer = lay;
- }
- }
- }
- }
-
- BIF_undo_push("Move Bone Layer");
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- }
- else if (ob->flag & OB_POSEMODE) {
- /* pose-channel layers */
- bPoseChannel *pchan;
-
- if (pose_has_protected_selected(ob, 0))
- return;
-
- for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if (arm->layer & pchan->bone->layer) {
- if (pchan->bone->flag & BONE_SELECTED)
- lay |= pchan->bone->layer;
- }
- }
- if (lay==0) return;
-
- if ( movetolayer_short_buts(&lay, "Bone Layers")==0 ) return;
- if (lay==0) return;
-
- for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if (arm->layer & pchan->bone->layer) {
- if (pchan->bone->flag & BONE_SELECTED)
- pchan->bone->layer= lay;
- }
- }
-
- BIF_undo_push("Move Bone Layer");
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- }
-}
-
-
-/* for use with pose_relax only */
-static int pose_relax_icu(struct IpoCurve *icu, float framef, float *val, float *frame_prev, float *frame_next)
-{
- if (!icu) {
- return 0;
- } else {
- BezTriple *bezt = icu->bezt;
-
- BezTriple *bezt_prev=NULL, *bezt_next=NULL;
- float w1, w2, wtot;
- int i;
-
- for (i=0; i < icu->totvert; i++, bezt++) {
- if (bezt->vec[1][0] < framef - 0.5) {
- bezt_prev = bezt;
- } else {
- break;
- }
- }
-
- if (bezt_prev==NULL) return 0;
-
- /* advance to the next, dont need to advance i */
- bezt = bezt_prev+1;
-
- for (; i < icu->totvert; i++, bezt++) {
- if (bezt->vec[1][0] > framef + 0.5) {
- bezt_next = bezt;
- break;
- }
- }
-
- if (bezt_next==NULL) return 0;
-
- if (val) {
- w1 = framef - bezt_prev->vec[1][0];
- w2 = bezt_next->vec[1][0] - framef;
- wtot = w1 + w2;
- w1=w1/wtot;
- w2=w2/wtot;
-#if 0
- val = (bezt_prev->vec[1][1] * w2) + (bezt_next->vec[1][1] * w1);
-#else
- /* apply the value with a hard coded 6th */
- *val = (((bezt_prev->vec[1][1] * w2) + (bezt_next->vec[1][1] * w1)) + (*val * 5.0f)) / 6.0f;
-#endif
- }
-
- if (frame_prev) *frame_prev = bezt_prev->vec[1][0];
- if (frame_next) *frame_next = bezt_next->vec[1][0];
-
- return 1;
- }
-}
-
-void pose_relax()
-{
- Object *ob = OBACT;
- bPose *pose;
- bAction *act;
- bArmature *arm;
-
- IpoCurve *icu_w, *icu_x, *icu_y, *icu_z;
-
- bPoseChannel *pchan;
- bActionChannel *achan;
- float framef = F_CFRA;
- float frame_prev, frame_next;
- float quat_prev[4], quat_next[4], quat_interp[4], quat_orig[4];
-
- /*int do_scale = 0;
- int do_loc = 0;
- int do_quat = 0;
- int flag = 0;*/
- int do_x, do_y, do_z;
-
- if (!ob) return;
-
- pose = ob->pose;
- act = ob->action;
- arm = (bArmature *)ob->data;
-
- if (!pose || !act || !arm) return;
-
- for (pchan=pose->chanbase.first; pchan; pchan= pchan->next){
- if(pchan->bone->layer & arm->layer) {
- if(pchan->bone->flag & BONE_SELECTED) {
- /* do we have an ipo curve? */
- achan= get_action_channel(act, pchan->name);
- if(achan && achan->ipo) {
- /*calc_ipo(achan->ipo, ctime);*/
-
- do_x = pose_relax_icu(find_ipocurve(achan->ipo, AC_LOC_X), framef, &pchan->loc[0], NULL, NULL);
- do_y = pose_relax_icu(find_ipocurve(achan->ipo, AC_LOC_Y), framef, &pchan->loc[1], NULL, NULL);
- do_z = pose_relax_icu(find_ipocurve(achan->ipo, AC_LOC_Z), framef, &pchan->loc[2], NULL, NULL);
- /* do_loc = do_x + do_y + do_z */
-
- if (G.flags & G_RECORDKEYS) {
- if (do_x) insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_LOC_X, 0);
- if (do_y) insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_LOC_Y, 0);
- if (do_z) insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_LOC_Z, 0);
- }
-
- do_x = pose_relax_icu(find_ipocurve(achan->ipo, AC_SIZE_X), framef, &pchan->size[0], NULL, NULL);
- do_y = pose_relax_icu(find_ipocurve(achan->ipo, AC_SIZE_Y), framef, &pchan->size[1], NULL, NULL);
- do_z = pose_relax_icu(find_ipocurve(achan->ipo, AC_SIZE_Z), framef, &pchan->size[2], NULL, NULL);
- /* do_scale = do_x + do_y + do_z */
-
- if (G.flags & G_RECORDKEYS) {
- if (do_x) insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_X, 0);
- if (do_y) insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_Y, 0);
- if (do_z) insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_Z, 0);
- }
-
- if( ((icu_w = find_ipocurve(achan->ipo, AC_QUAT_W))) &&
- ((icu_x = find_ipocurve(achan->ipo, AC_QUAT_X))) &&
- ((icu_y = find_ipocurve(achan->ipo, AC_QUAT_Y))) &&
- ((icu_z = find_ipocurve(achan->ipo, AC_QUAT_Z))) )
- {
- /* use the quatw keyframe as a basis for others */
- if (pose_relax_icu(icu_w, framef, NULL, &frame_prev, &frame_next)) {
- /* get 2 quats */
- quat_prev[0] = eval_icu(icu_w, frame_prev);
- quat_prev[1] = eval_icu(icu_x, frame_prev);
- quat_prev[2] = eval_icu(icu_y, frame_prev);
- quat_prev[3] = eval_icu(icu_z, frame_prev);
-
- quat_next[0] = eval_icu(icu_w, frame_next);
- quat_next[1] = eval_icu(icu_x, frame_next);
- quat_next[2] = eval_icu(icu_y, frame_next);
- quat_next[3] = eval_icu(icu_z, frame_next);
-
-#if 0
- /* apply the setting, completely smooth */
- QuatInterpol(pchan->quat, quat_prev, quat_next, (framef-frame_prev) / (frame_next-frame_prev) );
-#else
- /* tricky interpolation */
- QuatInterpol(quat_interp, quat_prev, quat_next, (framef-frame_prev) / (frame_next-frame_prev) );
- QUATCOPY(quat_orig, pchan->quat);
- QuatInterpol(pchan->quat, quat_orig, quat_interp, 1.0f/6.0f);
- /* done */
-#endif
- /*do_quat++;*/
-
- if (G.flags & G_RECORDKEYS) {
- insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_X, 0);
- insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_Y, 0);
- insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_Z, 0);
- insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_W, 0);
- }
- }
- }
-
- if (G.flags & G_RECORDKEYS) {
- pchan->bone->flag &= ~BONE_UNKEYED;
- }
- }
- }
- }
- }
-
- ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK);
-
-#if 0
-// /* auto-keyframing - dosnt work, no idea why, do manually above */
- if (do_loc) flag |= TFM_TRANSLATION;
- if (do_scale) flag |= TFM_RESIZE;
- if (do_quat) flag |= TFM_ROTATION;
- autokeyframe_pose_cb_func(ob, flag, 0);
-#endif
-
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- BIF_undo_push("Relax Pose");
-
-}
diff --git a/source/blender/src/preview.blend.c b/source/blender/src/preview.blend.c
deleted file mode 100644
index 945fbd9a962..00000000000
--- a/source/blender/src/preview.blend.c
+++ /dev/null
@@ -1,13901 +0,0 @@
-/* DataToC output of file <preview_blend> */
-
-int datatoc_preview_blend_size= 444636;
-char datatoc_preview_blend[]= {
- 66, 76, 69, 78, 68, 69, 82, 45,118, 50, 52, 53, 82, 69, 78, 68, 32, 0, 0, 0, 80, 67,123,102,255,127, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 20, 0, 0, 0,112,114,101,118,105,101,119, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 71, 76, 79, 66, 40, 0, 0, 0, 80, 67,123,102,255,127, 0, 0,150, 0, 0, 0, 1, 0, 0, 0,
- 32, 32, 32, 56, 8, 0, 0, 0,240, 0, 0, 0, 1, 0, 0, 1, 64, 39,115, 1, 0, 0, 0, 0,128,199,115, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 64, 0, 0, 0, 83, 82, 0, 0,168, 0, 0, 0, 64, 39,115, 1, 0, 0, 0, 0,145, 0, 0, 0, 1, 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,
- 83, 82,115, 99,114,101,101,110, 0, 45, 83, 99,114,105,112,116,105,110,103, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 48, 40,115, 1, 0, 0, 0, 0,208, 42,115, 1, 0, 0, 0, 0, 48, 43,115, 1, 0, 0, 0, 0,
-144, 47,115, 1, 0, 0, 0, 0, 0, 48,115, 1, 0, 0, 0, 0,192,167,115, 1, 0, 0, 0, 0,128,199,115, 1, 0, 0, 0, 0,
- 0, 0,127, 7, 25, 0,125, 4,128, 7,101, 4, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 32, 0, 0, 0, 48, 40,115, 1, 0, 0, 0, 0,146, 0, 0, 0, 1, 0, 0, 0,
-144, 40,115, 1, 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,
- 68, 65, 84, 65, 32, 0, 0, 0,144, 40,115, 1, 0, 0, 0, 0,146, 0, 0, 0, 1, 0, 0, 0,240, 40,115, 1, 0, 0, 0, 0,
- 48, 40,115, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,101, 4, 0, 0, 0, 0, 68, 65, 84, 65, 32, 0, 0, 0,
-240, 40,115, 1, 0, 0, 0, 0,146, 0, 0, 0, 1, 0, 0, 0, 80, 41,115, 1, 0, 0, 0, 0,144, 40,115, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,128, 7,101, 4, 0, 0, 0, 0, 68, 65, 84, 65, 32, 0, 0, 0, 80, 41,115, 1, 0, 0, 0, 0,
-146, 0, 0, 0, 1, 0, 0, 0,176, 41,115, 1, 0, 0, 0, 0,240, 40,115, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-128, 7, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 32, 0, 0, 0,176, 41,115, 1, 0, 0, 0, 0,146, 0, 0, 0, 1, 0, 0, 0,
- 16, 42,115, 1, 0, 0, 0, 0, 80, 41,115, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 4, 1, 0, 0, 0,
- 68, 65, 84, 65, 32, 0, 0, 0, 16, 42,115, 1, 0, 0, 0, 0,146, 0, 0, 0, 1, 0, 0, 0,112, 42,115, 1, 0, 0, 0, 0,
-176, 41,115, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 7, 68, 4, 1, 0, 0, 0, 68, 65, 84, 65, 32, 0, 0, 0,
-112, 42,115, 1, 0, 0, 0, 0,146, 0, 0, 0, 1, 0, 0, 0,208, 42,115, 1, 0, 0, 0, 0, 16, 42,115, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,252, 5, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 32, 0, 0, 0,208, 42,115, 1, 0, 0, 0, 0,
-146, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,112, 42,115, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-252, 5, 68, 4, 1, 0, 0, 0, 68, 65, 84, 65, 40, 0, 0, 0, 48, 43,115, 1, 0, 0, 0, 0,147, 0, 0, 0, 1, 0, 0, 0,
-160, 43,115, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,144, 40,115, 1, 0, 0, 0, 0,240, 40,115, 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 40, 0, 0, 0,160, 43,115, 1, 0, 0, 0, 0,147, 0, 0, 0, 1, 0, 0, 0,
- 16, 44,115, 1, 0, 0, 0, 0, 48, 43,115, 1, 0, 0, 0, 0,144, 40,115, 1, 0, 0, 0, 0,176, 41,115, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 40, 0, 0, 0, 16, 44,115, 1, 0, 0, 0, 0,147, 0, 0, 0, 1, 0, 0, 0,
-128, 44,115, 1, 0, 0, 0, 0,160, 43,115, 1, 0, 0, 0, 0,240, 40,115, 1, 0, 0, 0, 0, 16, 42,115, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 40, 0, 0, 0,128, 44,115, 1, 0, 0, 0, 0,147, 0, 0, 0, 1, 0, 0, 0,
-240, 44,115, 1, 0, 0, 0, 0, 16, 44,115, 1, 0, 0, 0, 0,176, 41,115, 1, 0, 0, 0, 0, 16, 42,115, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 40, 0, 0, 0,240, 44,115, 1, 0, 0, 0, 0,147, 0, 0, 0, 1, 0, 0, 0,
- 96, 45,115, 1, 0, 0, 0, 0,128, 44,115, 1, 0, 0, 0, 0, 80, 41,115, 1, 0, 0, 0, 0,112, 42,115, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 40, 0, 0, 0, 96, 45,115, 1, 0, 0, 0, 0,147, 0, 0, 0, 1, 0, 0, 0,
-208, 45,115, 1, 0, 0, 0, 0,240, 44,115, 1, 0, 0, 0, 0, 16, 42,115, 1, 0, 0, 0, 0,208, 42,115, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 40, 0, 0, 0,208, 45,115, 1, 0, 0, 0, 0,147, 0, 0, 0, 1, 0, 0, 0,
- 64, 46,115, 1, 0, 0, 0, 0, 96, 45,115, 1, 0, 0, 0, 0,112, 42,115, 1, 0, 0, 0, 0,208, 42,115, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 40, 0, 0, 0, 64, 46,115, 1, 0, 0, 0, 0,147, 0, 0, 0, 1, 0, 0, 0,
-176, 46,115, 1, 0, 0, 0, 0,208, 45,115, 1, 0, 0, 0, 0, 80, 41,115, 1, 0, 0, 0, 0, 16, 42,115, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 40, 0, 0, 0,176, 46,115, 1, 0, 0, 0, 0,147, 0, 0, 0, 1, 0, 0, 0,
- 32, 47,115, 1, 0, 0, 0, 0, 64, 46,115, 1, 0, 0, 0, 0, 48, 40,115, 1, 0, 0, 0, 0,176, 41,115, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 40, 0, 0, 0, 32, 47,115, 1, 0, 0, 0, 0,147, 0, 0, 0, 1, 0, 0, 0,
-144, 47,115, 1, 0, 0, 0, 0,176, 46,115, 1, 0, 0, 0, 0,176, 41,115, 1, 0, 0, 0, 0,208, 42,115, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 40, 0, 0, 0,144, 47,115, 1, 0, 0, 0, 0,147, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 32, 47,115, 1, 0, 0, 0, 0, 48, 40,115, 1, 0, 0, 0, 0,112, 42,115, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 8, 1, 0, 0, 0, 48,115, 1, 0, 0, 0, 0,149, 0, 0, 0, 1, 0, 0, 0,
- 0, 98,115, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,176, 41,115, 1, 0, 0, 0, 0,144, 40,115, 1, 0, 0, 0, 0,
-240, 40,115, 1, 0, 0, 0, 0, 16, 42,115, 1, 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,128, 7, 0, 0,
- 69, 4, 0, 0,101, 4, 0, 0, 0, 0, 0, 0,128, 7, 0, 0, 69, 4, 0, 0, 95, 4, 0, 0, 0, 0, 0, 0,128, 7, 0, 0,
- 96, 4, 0, 0,101, 4, 0, 0, 5, 0, 4, 0, 1, 0, 7, 7,129, 7, 6, 0, 1, 0, 1, 0,189, 2, 0, 0, 7, 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, 32, 52, 88, 1, 0, 0, 0, 0,160,144,104, 1, 0, 0, 0, 0, 80, 49,115, 1, 0, 0, 0, 0,
-208, 96,115, 1, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0, 80, 49,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,
-128, 50,115, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79,117,116,112,117,116, 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, 82,101,110,100,101,114, 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, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,128, 50,115, 1, 0, 0, 0, 0,
-148, 0, 0, 0, 1, 0, 0, 0,176, 51,115, 1, 0, 0, 0, 0, 80, 49,115, 1, 0, 0, 0, 0, 82,101,110,100,101,114, 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, 82,101,110,100,101,114, 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, 70, 1, 0, 0, 62, 1,204, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,
-176, 51,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,224, 52,115, 1, 0, 0, 0, 0,128, 50,115, 1, 0, 0, 0, 0,
- 65,110,105,109, 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,
- 82,101,110,100,101,114, 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,
-140, 2, 0, 0, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 68, 65, 84, 65,240, 0, 0, 0,224, 52,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0, 16, 54,115, 1, 0, 0, 0, 0,
-176, 51,115, 1, 0, 0, 0, 0, 70,111,114,109, 97,116, 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, 82,101,110,100,101,114, 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,210, 3, 0, 0, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0, 16, 54,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,
- 64, 55,115, 1, 0, 0, 0, 0,224, 52,115, 1, 0, 0, 0, 0, 80,114,101,118,105,101,119, 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, 76, 97,109,112, 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, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0, 64, 55,115, 1, 0, 0, 0, 0,
-148, 0, 0, 0, 1, 0, 0, 0,112, 56,115, 1, 0, 0, 0, 0, 16, 54,115, 1, 0, 0, 0, 0, 76, 97,109,112, 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, 76, 97,109,112, 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, 70, 1, 0, 0, 62, 1,204, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,
-112, 56,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,160, 57,115, 1, 0, 0, 0, 0, 64, 55,115, 1, 0, 0, 0, 0,
- 83,104, 97,100,111,119, 32, 97,110,100, 32, 83,112,111,116, 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,
- 76, 97,109,112, 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,
-140, 2, 0, 0, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 68, 65, 84, 65,240, 0, 0, 0,160, 57,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,208, 58,115, 1, 0, 0, 0, 0,
-112, 56,115, 1, 0, 0, 0, 0, 84,101,120,116,117,114,101, 32, 97,110,100, 32, 73,110,112,117,116, 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, 76, 97,109,112, 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,210, 3, 0, 0, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,208, 58,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,
- 0, 60,115, 1, 0, 0, 0, 0,160, 57,115, 1, 0, 0, 0, 0, 77, 97,112, 32, 84,111, 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, 76, 97,109,112, 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,210, 3, 0, 0, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,160, 57,115, 1, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0, 0, 60,115, 1, 0, 0, 0, 0,
-148, 0, 0, 0, 1, 0, 0, 0, 48, 61,115, 1, 0, 0, 0, 0,208, 58,115, 1, 0, 0, 0, 0, 80,114,101,118,105,101,119, 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, 77, 97,116,101,114,105, 97,108,
- 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, 62, 1,204, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,
- 48, 61,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0, 96, 62,115, 1, 0, 0, 0, 0, 0, 60,115, 1, 0, 0, 0, 0,
- 76,105,110,107,115, 32, 97,110,100, 32, 80,105,112,101,108,105,110,101, 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,
- 77, 97,116,101,114,105, 97,108, 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,
- 70, 1, 0, 0, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 68, 65, 84, 65,240, 0, 0, 0, 96, 62,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,144, 63,115, 1, 0, 0, 0, 0,
- 48, 61,115, 1, 0, 0, 0, 0, 77, 97,116,101,114,105, 97,108, 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, 77, 97,116,101,114,105, 97,108, 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,140, 2, 0, 0, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,144, 63,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,
-192, 64,115, 1, 0, 0, 0, 0, 96, 62,115, 1, 0, 0, 0, 0, 82, 97,109,112,115, 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, 77, 97,116,101,114,105, 97,108, 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,140, 2, 0, 0, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 96, 62,115, 1, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,192, 64,115, 1, 0, 0, 0, 0,
-148, 0, 0, 0, 1, 0, 0, 0,240, 65,115, 1, 0, 0, 0, 0,144, 63,115, 1, 0, 0, 0, 0, 83,104, 97,100,101,114,115, 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, 77, 97,116,101,114,105, 97,108,
- 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,210, 3, 0, 0, 62, 1,204, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,240, 65,115, 1, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,
-240, 65,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0, 32, 67,115, 1, 0, 0, 0, 0,192, 64,115, 1, 0, 0, 0, 0,
- 77,105,114,114,111,114, 32, 84,114, 97,110,115,112, 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,
- 77, 97,116,101,114,105, 97,108, 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,
-210, 3, 0, 0, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 68, 65, 84, 65,240, 0, 0, 0, 32, 67,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0, 80, 68,115, 1, 0, 0, 0, 0,
-240, 65,115, 1, 0, 0, 0, 0, 84,101,120,116,117,114,101, 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, 77, 97,116,101,114,105, 97,108, 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, 24, 5, 0, 0, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0, 80, 68,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,
-128, 69,115, 1, 0, 0, 0, 0, 32, 67,115, 1, 0, 0, 0, 0, 77, 97,112, 32, 73,110,112,117,116, 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, 77, 97,116,101,114,105, 97,108, 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, 24, 5, 0, 0, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 32, 67,115, 1, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,128, 69,115, 1, 0, 0, 0, 0,
-148, 0, 0, 0, 1, 0, 0, 0,176, 70,115, 1, 0, 0, 0, 0, 80, 68,115, 1, 0, 0, 0, 0, 77, 97,112, 32, 84,111, 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, 77, 97,116,101,114,105, 97,108,
- 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, 24, 5, 0, 0, 62, 1,204, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 67,115, 1, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,
-176, 70,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,224, 71,115, 1, 0, 0, 0, 0,128, 69,115, 1, 0, 0, 0, 0,
- 76,105,110,107, 32, 97,110,100, 32, 77, 97,116,101,114,105, 97,108,115, 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,
- 69,100,105,116,105,110,103, 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, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 68, 65, 84, 65,240, 0, 0, 0,224, 71,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0, 16, 73,115, 1, 0, 0, 0, 0,
-176, 70,115, 1, 0, 0, 0, 0, 77,101,115,104, 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, 69,100,105,116,105,110,103, 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, 70, 1, 0, 0, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0, 16, 73,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,
- 64, 74,115, 1, 0, 0, 0, 0,224, 71,115, 1, 0, 0, 0, 0, 77,111,100,105,102,105,101,114,115, 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, 69,100,105,116,105,110,103, 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,140, 2, 0, 0, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0, 64, 74,115, 1, 0, 0, 0, 0,
-148, 0, 0, 0, 1, 0, 0, 0,112, 75,115, 1, 0, 0, 0, 0, 16, 73,115, 1, 0, 0, 0, 0, 83,104, 97,112,101,115, 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, 69,100,105,116,105,110,103, 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,140, 2, 0, 0, 62, 1,204, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 73,115, 1, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,
-112, 75,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,160, 76,115, 1, 0, 0, 0, 0, 64, 74,115, 1, 0, 0, 0, 0,
- 77,101,115,104, 32, 84,111,111,108,115, 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,
- 69,100,105,116,105,110,103, 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,
-210, 3, 0, 0, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 68, 65, 84, 65,240, 0, 0, 0,160, 76,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,208, 77,115, 1, 0, 0, 0, 0,
-112, 75,115, 1, 0, 0, 0, 0, 77,101,115,104, 32, 84,111,111,108,115, 32, 49, 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, 69,100,105,116,105,110,103, 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, 24, 5, 0, 0, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,208, 77,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,
- 0, 79,115, 1, 0, 0, 0, 0,160, 76,115, 1, 0, 0, 0, 0, 80,114,101,118,105,101,119, 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, 87,111,114,108,100, 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, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0, 0, 79,115, 1, 0, 0, 0, 0,
-148, 0, 0, 0, 1, 0, 0, 0, 48, 80,115, 1, 0, 0, 0, 0,208, 77,115, 1, 0, 0, 0, 0, 87,111,114,108,100, 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, 87,111,114,108,100, 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, 70, 1, 0, 0, 62, 1,204, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,
- 48, 80,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0, 96, 81,115, 1, 0, 0, 0, 0, 0, 79,115, 1, 0, 0, 0, 0,
- 77,105,115,116, 32, 47, 32, 83,116, 97,114,115, 32, 47, 32, 80,104,121,115,105, 99,115, 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,
- 87,111,114,108,100, 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,
-140, 2, 0, 0, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 68, 65, 84, 65,240, 0, 0, 0, 96, 81,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,144, 82,115, 1, 0, 0, 0, 0,
- 48, 80,115, 1, 0, 0, 0, 0, 65,109, 98, 32, 79, 99, 99, 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, 87,111,114,108,100, 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,140, 2, 0, 0, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 48, 80,115, 1, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,144, 82,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,
-192, 83,115, 1, 0, 0, 0, 0, 96, 81,115, 1, 0, 0, 0, 0, 84,101,120,116,117,114,101, 32, 97,110,100, 32, 73,110,112,117,
-116, 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, 87,111,114,108,100, 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,210, 3, 0, 0, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,192, 83,115, 1, 0, 0, 0, 0,
-148, 0, 0, 0, 1, 0, 0, 0,240, 84,115, 1, 0, 0, 0, 0,144, 82,115, 1, 0, 0, 0, 0, 77, 97,112, 32, 84,111, 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, 87,111,114,108,100, 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,210, 3, 0, 0, 62, 1,204, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,144, 82,115, 1, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,
-240, 84,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0, 32, 86,115, 1, 0, 0, 0, 0,192, 83,115, 1, 0, 0, 0, 0,
- 80,114,101,118,105,101,119, 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,
- 84,101,120,116,117,114,101, 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, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 68, 65, 84, 65,240, 0, 0, 0, 32, 86,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0, 80, 87,115, 1, 0, 0, 0, 0,
-240, 84,115, 1, 0, 0, 0, 0, 84,101,120,116,117,114,101, 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, 84,101,120,116,117,114,101, 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, 70, 1, 0, 0, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0, 80, 87,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,
-128, 88,115, 1, 0, 0, 0, 0, 32, 86,115, 1, 0, 0, 0, 0, 67,111,108,111,114,115, 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, 84,101,120,116,117,114,101, 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, 70, 1, 0, 0, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 32, 86,115, 1, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,128, 88,115, 1, 0, 0, 0, 0,
-148, 0, 0, 0, 1, 0, 0, 0,176, 89,115, 1, 0, 0, 0, 0, 80, 87,115, 1, 0, 0, 0, 0, 79, 98,106,101, 99,116, 32, 97,
-110,100, 32, 76,105,110,107,115, 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, 79, 98,106,101, 99,116, 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, 62, 1,204, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,
-176, 89,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,224, 90,115, 1, 0, 0, 0, 0,128, 88,115, 1, 0, 0, 0, 0,
- 65,110,105,109, 32,115,101,116,116,105,110,103,115, 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,
- 79, 98,106,101, 99,116, 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,
- 70, 1, 0, 0, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 68, 65, 84, 65,240, 0, 0, 0,224, 90,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0, 16, 92,115, 1, 0, 0, 0, 0,
-176, 89,115, 1, 0, 0, 0, 0, 68,114, 97,119, 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, 79, 98,106,101, 99,116, 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,140, 2, 0, 0, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0, 16, 92,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,
- 64, 93,115, 1, 0, 0, 0, 0,224, 90,115, 1, 0, 0, 0, 0, 67,111,110,115,116,114, 97,105,110,116,115, 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, 79, 98,106,101, 99,116, 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,210, 3, 0, 0, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0, 64, 93,115, 1, 0, 0, 0, 0,
-148, 0, 0, 0, 1, 0, 0, 0,112, 94,115, 1, 0, 0, 0, 0, 16, 92,115, 1, 0, 0, 0, 0, 67,108,111,117,100,115, 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, 84,101,120,116,117,114,101, 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,140, 2, 0, 0, 62, 1,204, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,
-112, 94,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,160, 95,115, 1, 0, 0, 0, 0, 64, 93,115, 1, 0, 0, 0, 0,
- 83,116,117, 99, 99,105, 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,
- 84,101,120,116,117,114,101, 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,
-140, 2, 0, 0, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 68, 65, 84, 65,240, 0, 0, 0,160, 95,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,208, 96,115, 1, 0, 0, 0, 0,
-112, 94,115, 1, 0, 0, 0, 0, 87,111,111,100, 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, 84,101,120,116,117,114,101, 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,140, 2, 0, 0, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,208, 96,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,160, 95,115, 1, 0, 0, 0, 0, 82,101,110,100,101,114, 32, 76, 97,121,101,114,115, 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, 82,101,110,100,101,114, 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, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 80, 49,115, 1, 0, 0, 0, 0, 68, 65, 84, 65, 8, 1, 0, 0, 0, 98,115, 1, 0, 0, 0, 0,
-149, 0, 0, 0, 1, 0, 0, 0,192,167,115, 1, 0, 0, 0, 0, 0, 48,115, 1, 0, 0, 0, 0,112, 42,115, 1, 0, 0, 0, 0,
-208, 42,115, 1, 0, 0, 0, 0, 16, 42,115, 1, 0, 0, 0, 0, 80, 41,115, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,140, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,171, 68, 45, 65, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 80, 1,128,191, 0, 0,128,191, 0, 0, 0,128, 0, 0, 0,128,226,215,163,188, 0, 0, 0,128,
-253, 5, 0, 0,128, 7, 0, 0, 0, 0, 0, 0, 67, 4, 0, 0,253, 5, 0, 0,128, 7, 0, 0, 41, 4, 0, 0, 67, 4, 0, 0,
-253, 5, 0, 0,128, 7, 0, 0, 0, 0, 0, 0, 40, 4, 0, 0, 7, 0, 6, 0, 2, 0, 4, 4,132, 1, 41, 4, 1, 0, 1, 0,
-136, 1, 4, 0, 7, 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,
-192,152,115, 1, 0, 0, 0, 0,208,165,115, 1, 0, 0, 0, 0,208,145,196, 1, 0, 0, 0, 0, 48, 29, 88, 1, 0, 0, 0, 0,
- 80, 99,115, 1, 0, 0, 0, 0, 80,143,114, 1, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0, 80, 99,115, 1, 0, 0, 0, 0,
-148, 0, 0, 0, 1, 0, 0, 0,128,100,115, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 84,114, 97,110,115,102,111,114,
-109, 32, 80,114,111,112,101,114,116,105,101,115, 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, 73,112,111, 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, 33, 0,167, 0, 62, 1,204, 0,
- 0, 0, 0, 0,162, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,
-128,100,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,176,101,115, 1, 0, 0, 0, 0, 80, 99,115, 1, 0, 0, 0, 0,
- 79,117,116,112,117,116, 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,
- 82,101,110,100,101,114, 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, 62, 1,204, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 80,137,115, 1, 0, 0, 0, 0,
- 68, 65, 84, 65,240, 0, 0, 0,176,101,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,224,102,115, 1, 0, 0, 0, 0,
-128,100,115, 1, 0, 0, 0, 0, 82,101,110,100,101,114, 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, 82,101,110,100,101,114, 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, 24,255, 62, 1,204, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,224,102,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,
- 16,104,115, 1, 0, 0, 0, 0,176,101,115, 1, 0, 0, 0, 0, 65,110,105,109, 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, 82,101,110,100,101,114, 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, 48,254, 62, 1,204, 0, 0, 0, 1, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0, 16,104,115, 1, 0, 0, 0, 0,
-148, 0, 0, 0, 1, 0, 0, 0, 64,105,115, 1, 0, 0, 0, 0,224,102,115, 1, 0, 0, 0, 0, 70,111,114,109, 97,116, 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, 82,101,110,100,101,114, 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, 72,253, 62, 1,204, 0,
- 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,
- 64,105,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,112,106,115, 1, 0, 0, 0, 0, 16,104,115, 1, 0, 0, 0, 0,
- 76,105,110,107, 32, 97,110,100, 32, 77, 97,116,101,114,105, 97,108,115, 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,
- 69,100,105,116,105,110,103, 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, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 68, 65, 84, 65,240, 0, 0, 0,112,106,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,160,107,115, 1, 0, 0, 0, 0,
- 64,105,115, 1, 0, 0, 0, 0, 67, 97,109,101,114, 97, 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, 69,100,105,116,105,110,103, 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, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,160,107,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,
-208,108,115, 1, 0, 0, 0, 0,112,106,115, 1, 0, 0, 0, 0, 80,114,101,118,105,101,119, 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, 76, 97,109,112, 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, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,208,108,115, 1, 0, 0, 0, 0,
-148, 0, 0, 0, 1, 0, 0, 0, 0,110,115, 1, 0, 0, 0, 0,160,107,115, 1, 0, 0, 0, 0, 76, 97,109,112, 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, 76, 97,109,112, 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, 24,255, 62, 1,204, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,
- 0,110,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0, 48,111,115, 1, 0, 0, 0, 0,208,108,115, 1, 0, 0, 0, 0,
- 83,104, 97,100,111,119, 32, 97,110,100, 32, 83,112,111,116, 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,
- 76, 97,109,112, 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, 48,254, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 68, 65, 84, 65,240, 0, 0, 0, 48,111,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0, 96,112,115, 1, 0, 0, 0, 0,
- 0,110,115, 1, 0, 0, 0, 0, 84,101,120,116,117,114,101, 32, 97,110,100, 32, 73,110,112,117,116, 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, 76, 97,109,112, 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, 72,253, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0, 96,112,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,
-144,113,115, 1, 0, 0, 0, 0, 48,111,115, 1, 0, 0, 0, 0, 77, 97,112, 32, 84,111, 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, 76, 97,109,112, 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, 72,253, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 48,111,115, 1, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,144,113,115, 1, 0, 0, 0, 0,
-148, 0, 0, 0, 1, 0, 0, 0,192,114,115, 1, 0, 0, 0, 0, 96,112,115, 1, 0, 0, 0, 0, 77,101,115,104, 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, 69,100,105,116,105,110,103, 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, 24,255, 62, 1,204, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,
-192,114,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,240,115,115, 1, 0, 0, 0, 0,144,113,115, 1, 0, 0, 0, 0,
- 77,111,100,105,102,105,101,114,115, 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,
- 69,100,105,116,105,110,103, 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, 72,253, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 68, 65, 84, 65,240, 0, 0, 0,240,115,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0, 32,117,115, 1, 0, 0, 0, 0,
-192,114,115, 1, 0, 0, 0, 0, 83,104, 97,112,101,115, 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, 69,100,105,116,105,110,103, 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, 72,253, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,
-192,114,115, 1, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0, 32,117,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,
- 80,118,115, 1, 0, 0, 0, 0,240,115,115, 1, 0, 0, 0, 0, 77,101,115,104, 32, 84,111,111,108,115, 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, 69,100,105,116,105,110,103, 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, 72,253, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0, 80,118,115, 1, 0, 0, 0, 0,
-148, 0, 0, 0, 1, 0, 0, 0,128,119,115, 1, 0, 0, 0, 0, 32,117,115, 1, 0, 0, 0, 0, 77,101,115,104, 32, 84,111,111,
-108,115, 32, 49, 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, 69,100,105,116,105,110,103, 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, 96,252, 62, 1,204, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,
-128,119,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,176,120,115, 1, 0, 0, 0, 0, 80,118,115, 1, 0, 0, 0, 0,
- 84,101,120,116,117,114,101, 32,102, 97, 99,101, 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,
- 69,100,105,116,105,110,103, 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, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,176,120,115, 1, 0, 0, 0, 0,
- 68, 65, 84, 65,240, 0, 0, 0,176,120,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,224,121,115, 1, 0, 0, 0, 0,
-128,119,115, 1, 0, 0, 0, 0, 85, 86, 32, 67, 97,108, 99,117,108, 97,116,105,111,110, 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, 69,100,105,116,105,110,103, 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, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,224,121,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,
- 16,123,115, 1, 0, 0, 0, 0,176,120,115, 1, 0, 0, 0, 0, 80, 97,105,110,116, 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, 69,100,105,116,105,110,103, 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, 48,254, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0, 16,123,115, 1, 0, 0, 0, 0,
-148, 0, 0, 0, 1, 0, 0, 0, 64,124,115, 1, 0, 0, 0, 0,224,121,115, 1, 0, 0, 0, 0, 67,117,114,118,101, 32, 97,110,
-100, 32, 83,117,114,102, 97, 99,101, 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, 69,100,105,116,105,110,103, 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, 62, 1,204, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,
- 64,124,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,112,125,115, 1, 0, 0, 0, 0, 16,123,115, 1, 0, 0, 0, 0,
- 67,117,114,118,101, 32, 84,111,111,108,115, 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,
- 69,100,105,116,105,110,103, 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, 24,255, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 68, 65, 84, 65,240, 0, 0, 0,112,125,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,160,126,115, 1, 0, 0, 0, 0,
- 64,124,115, 1, 0, 0, 0, 0, 67,117,114,118,101, 32, 84,111,111,108,115, 49, 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, 69,100,105,116,105,110,103, 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, 72,253, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,160,126,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,
-208,127,115, 1, 0, 0, 0, 0,112,125,115, 1, 0, 0, 0, 0, 80,114,101,118,105,101,119, 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, 77, 97,116,101,114,105, 97,108, 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, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,208,127,115, 1, 0, 0, 0, 0,
-148, 0, 0, 0, 1, 0, 0, 0, 0,129,115, 1, 0, 0, 0, 0,160,126,115, 1, 0, 0, 0, 0, 76,105,110,107,115, 32, 97,110,
-100, 32, 80,105,112,101,108,105,110,101, 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, 77, 97,116,101,114,105, 97,108,
- 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, 24,255, 62, 1,204, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,
- 0,129,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0, 48,130,115, 1, 0, 0, 0, 0,208,127,115, 1, 0, 0, 0, 0,
- 77, 97,116,101,114,105, 97,108, 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,
- 77, 97,116,101,114,105, 97,108, 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, 48,254, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 68, 65, 84, 65,240, 0, 0, 0, 48,130,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0, 96,131,115, 1, 0, 0, 0, 0,
- 0,129,115, 1, 0, 0, 0, 0, 82, 97,109,112,115, 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, 77, 97,116,101,114,105, 97,108, 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, 48,254, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0,129,115, 1, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0, 96,131,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,
-144,132,115, 1, 0, 0, 0, 0, 48,130,115, 1, 0, 0, 0, 0, 83,104, 97,100,101,114,115, 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, 77, 97,116,101,114,105, 97,108, 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, 72,253, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,144,132,115, 1, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,144,132,115, 1, 0, 0, 0, 0,
-148, 0, 0, 0, 1, 0, 0, 0,192,133,115, 1, 0, 0, 0, 0, 96,131,115, 1, 0, 0, 0, 0, 77,105,114,114,111,114, 32, 84,
-114, 97,110,115,112, 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, 77, 97,116,101,114,105, 97,108,
- 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, 72,253, 62, 1,204, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,
-192,133,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,240,134,115, 1, 0, 0, 0, 0,144,132,115, 1, 0, 0, 0, 0,
- 84,101,120,116,117,114,101, 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,
- 77, 97,116,101,114,105, 97,108, 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, 96,252, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 68, 65, 84, 65,240, 0, 0, 0,240,134,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0, 32,136,115, 1, 0, 0, 0, 0,
-192,133,115, 1, 0, 0, 0, 0, 77, 97,112, 32, 73,110,112,117,116, 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, 77, 97,116,101,114,105, 97,108, 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, 96,252, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-192,133,115, 1, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0, 32,136,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,
- 80,137,115, 1, 0, 0, 0, 0,240,134,115, 1, 0, 0, 0, 0, 77, 97,112, 32, 84,111, 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, 77, 97,116,101,114,105, 97,108, 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, 96,252, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,192,133,115, 1, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0, 80,137,115, 1, 0, 0, 0, 0,
-148, 0, 0, 0, 1, 0, 0, 0,128,138,115, 1, 0, 0, 0, 0, 32,136,115, 1, 0, 0, 0, 0, 82,101,110,100,101,114, 32, 76,
- 97,121,101,114,115, 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, 82,101,110,100,101,114, 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, 62, 1,204, 0,
- 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,
-128,138,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,176,139,115, 1, 0, 0, 0, 0, 80,137,115, 1, 0, 0, 0, 0,
- 80,114,101,118,105,101,119, 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,
- 87,111,114,108,100, 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, 48,254, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 68, 65, 84, 65,240, 0, 0, 0,176,139,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,224,140,115, 1, 0, 0, 0, 0,
-128,138,115, 1, 0, 0, 0, 0, 87,111,114,108,100, 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, 87,111,114,108,100, 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, 72,253, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,224,140,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,
- 16,142,115, 1, 0, 0, 0, 0,176,139,115, 1, 0, 0, 0, 0, 77,105,115,116, 32, 47, 32, 83,116, 97,114,115, 32, 47, 32, 80,
-104,121,115,105, 99,115, 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, 87,111,114,108,100, 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, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0, 16,142,115, 1, 0, 0, 0, 0,
-148, 0, 0, 0, 1, 0, 0, 0, 64,143,115, 1, 0, 0, 0, 0,224,140,115, 1, 0, 0, 0, 0, 65,109, 98, 32, 79, 99, 99, 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, 87,111,114,108,100, 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, 62, 1,204, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,224,140,115, 1, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,
- 64,143,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,112,144,115, 1, 0, 0, 0, 0, 16,142,115, 1, 0, 0, 0, 0,
- 84,101,120,116,117,114,101, 32, 97,110,100, 32, 73,110,112,117,116, 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,
- 87,111,114,108,100, 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, 24,255, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 68, 65, 84, 65,240, 0, 0, 0,112,144,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,160,145,115, 1, 0, 0, 0, 0,
- 64,143,115, 1, 0, 0, 0, 0, 77, 97,112, 32, 84,111, 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, 87,111,114,108,100, 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, 24,255, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 64,143,115, 1, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,160,145,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,
-208,146,115, 1, 0, 0, 0, 0,112,144,115, 1, 0, 0, 0, 0, 77,117,108,116,105,114,101,115, 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, 69,100,105,116,105,110,103, 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, 48,254, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,208,146,115, 1, 0, 0, 0, 0,
-148, 0, 0, 0, 1, 0, 0, 0, 0,148,115, 1, 0, 0, 0, 0,160,145,115, 1, 0, 0, 0, 0, 79, 98,106,101, 99,116, 32, 97,
-110,100, 32, 76,105,110,107,115, 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, 79, 98,106,101, 99,116, 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, 62, 1,204, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,
- 0,148,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0, 48,149,115, 1, 0, 0, 0, 0,208,146,115, 1, 0, 0, 0, 0,
- 65,110,105,109, 32,115,101,116,116,105,110,103,115, 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,
- 79, 98,106,101, 99,116, 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, 24,255, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 68, 65, 84, 65,240, 0, 0, 0, 48,149,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0, 96,150,115, 1, 0, 0, 0, 0,
- 0,148,115, 1, 0, 0, 0, 0, 68,114, 97,119, 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, 79, 98,106,101, 99,116, 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, 48,254, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0, 96,150,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,
-144,151,115, 1, 0, 0, 0, 0, 48,149,115, 1, 0, 0, 0, 0, 67,111,110,115,116,114, 97,105,110,116,115, 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, 79, 98,106,101, 99,116, 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, 72,253, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,144,151,115, 1, 0, 0, 0, 0,
-148, 0, 0, 0, 1, 0, 0, 0,144,144,114, 1, 0, 0, 0, 0, 96,150,115, 1, 0, 0, 0, 0, 66, 97,107,101, 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, 82,101,110,100,101,114, 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, 48,254, 62, 1,204, 0,
- 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0,224,102,115, 1, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,
-144,144,114, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,192, 26,122, 1, 0, 0, 0, 0,144,151,115, 1, 0, 0, 0, 0,
- 83,116, 97,109,112, 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,
- 82,101,110,100,101,114, 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, 72,253, 62, 1,204, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 16,104,115, 1, 0, 0, 0, 0,
- 68, 65, 84, 65,240, 0, 0, 0,192, 26,122, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,144,161,135, 1, 0, 0, 0, 0,
-144,144,114, 1, 0, 0, 0, 0, 80, 97,114,116,105, 99,108,101, 32, 83,121,115,116,101,109, 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, 80, 97,114,116,105, 99,108,101, 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, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,144,161,135, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,
- 64,247,121, 1, 0, 0, 0, 0,192, 26,122, 1, 0, 0, 0, 0, 80,104,121,115,105, 99,115, 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, 80, 97,114,116,105, 99,108,101, 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, 24,255, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0, 64,247,121, 1, 0, 0, 0, 0,
-148, 0, 0, 0, 1, 0, 0, 0, 64, 62,114, 1, 0, 0, 0, 0,144,161,135, 1, 0, 0, 0, 0, 86,105,115,117, 97,108,105,122,
- 97,116,105,111,110, 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, 80, 97,114,116,105, 99,108,101,
- 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, 48,254, 62, 1,204, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,
- 64, 62,114, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0, 80,143,114, 1, 0, 0, 0, 0, 64,247,121, 1, 0, 0, 0, 0,
- 69,120,116,114, 97,115, 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,
- 80, 97,114,116,105, 99,108,101, 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, 72,253, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 68, 65, 84, 65,240, 0, 0, 0, 80,143,114, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 64, 62,114, 1, 0, 0, 0, 0, 67,104,105,108,100,114,101,110, 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, 80, 97,114,116,105, 99,108,101, 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, 72,253, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0,
- 64, 62,114, 1, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,192,152,115, 1, 0, 0, 0, 0,129, 0, 0, 0, 1, 0, 0, 0,
-240,153,115, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 98,115, 1, 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, 2, 0, 0, 0,
- 0, 0, 0,193, 0, 0,163, 67, 0, 0,106,196, 0, 0,104, 67,108, 94,173,194,155, 87,202, 67,176,132,139,196,193,149,104, 67,
- 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,128, 67, 0, 0, 40, 66, 0, 0, 0, 69, 0, 0,225, 67,
- 0, 0, 0, 63, 72,225,154, 63, 0, 0, 1, 0, 1, 0, 1, 0,132, 1, 41, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,128,199,115, 1, 0, 0, 0, 0,255,255, 0, 0, 0, 0, 0, 0,
-150, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 68, 65, 84, 65, 56, 3, 0, 0,240,153,115, 1, 0, 0, 0, 0,
-124, 0, 0, 0, 1, 0, 0, 0,112,157,115, 1, 0, 0, 0, 0,192,152,115, 1, 0, 0, 0, 0, 1, 0, 0, 0, 51, 51, 51, 63,
- 0, 98,115, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 52,198,127, 63,146, 29,166,188,
- 97,153, 22, 61, 0, 0, 0, 0, 13,252, 43, 61, 89, 11,247, 62, 90,248, 95,191, 0, 0, 0, 0,196,176, 67, 52,246, 42, 96, 63,
- 44, 67,247, 62, 0, 0, 0, 0, 74, 45, 78, 64,201, 87,172, 62, 79,171, 41,194, 0, 0,128, 63, 53,198,127, 63,248,251, 43, 61,
- 0, 0, 80, 52, 0, 0, 0, 0,186, 29,166,188,119, 11,247, 62, 16, 43, 96, 63, 0, 0, 0, 0, 99,153, 22, 61,117,248, 95,191,
- 75, 67,247, 62, 0, 0, 0, 0,192,125,211,191,185,161, 21,194, 59,133,161, 65, 0, 0,128, 63,100,224,139, 63, 21,221, 96,190,
-236,154, 22,189, 97,153, 22,189,174, 27, 60, 61,239, 52,167, 64,166,250, 95, 63, 90,248, 95, 63, 86, 9, 86, 52, 41,185, 23, 65,
-181, 69,247,190, 44, 67,247,190,137,129, 97, 64, 27, 75,105, 64,145,152, 41, 66, 79,171, 41, 66, 95,225,105, 63, 84,247, 39, 61,
-176, 46,185,186,144,196,146,184,178,126,245,186, 48,117, 54, 61, 23,157,165, 61, 0,160,153, 52,225, 56,165, 66,192,202,233, 68,
- 18, 94,124,196, 87,254, 71,194,102, 77,165,194, 39,177,233,196,193, 65,124, 68,101, 0, 72, 66, 0, 0,140, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,171, 68, 45, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 80, 1,128,191, 0, 0,128,191, 0, 0, 0,128, 0, 0, 0,128,226,215,163,188, 0, 0, 0,128, 52,198,127, 63,146, 29,166,188,
- 97,153, 22, 61, 0, 0, 0, 0, 13,252, 43, 61, 89, 11,247, 62, 90,248, 95,191, 0, 0, 0, 0,196,176, 67, 52,246, 42, 96, 63,
- 44, 67,247, 62, 0, 0, 0, 0, 74, 45, 78, 64,201, 87,172, 62, 79,171, 41,194, 0, 0,128, 63,141, 99, 92, 63, 43, 35, 2,191,
-188,238, 46,188, 94, 32,148,188, 23,240, 25, 66, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,160,248,115, 1, 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, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
-226,255, 0, 0, 0, 0, 12, 66, 0, 0,128, 63, 0, 0,128, 63, 68, 56,124, 58, 10,215, 35, 60, 0, 0,250, 67, 0, 0, 0, 0,
- 0, 0, 0, 0,201, 77, 68, 64,228, 66,111, 64,230, 97,205,191,128,191,149, 60,116,109, 77,191,248,165,230, 63, 20, 0, 0, 0,
- 7, 0, 99, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,255,255, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 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, 24, 24, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 68, 65, 84, 65, 88, 1, 0, 0,112,157,115, 1, 0, 0, 0, 0,128, 0, 0, 0, 1, 0, 0, 0, 16,159,115, 1, 0, 0, 0, 0,
-240,153,115, 1, 0, 0, 0, 0, 2, 0, 0, 0, 51, 51, 51, 63, 0, 98,115, 1, 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,122, 67,205,204,204,189,205,204,140, 63,
- 0, 0,128, 63, 0, 0,122, 67, 0, 0,160,192, 0, 0,160, 64, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0,235, 2, 0, 0,
- 16, 0, 0, 0,168, 3, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 16, 0, 0, 0,168, 3, 0, 0, 16, 0, 0, 0,235, 2, 0, 0,
- 10,215, 35, 60, 10,215, 35, 60, 0, 96,106, 70, 0, 0,122, 68, 0, 0, 0, 0, 0, 0, 0, 0, 9, 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, 32, 20,116, 1, 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,
- 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 66, 1, 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,122, 67,205,204,204,189,205,204,140, 63, 68, 65, 84, 65,136, 0, 0, 0, 16,159,115, 1, 0, 0, 0, 0,
-135, 0, 0, 0, 1, 0, 0, 0,224,159,115, 1, 0, 0, 0, 0,112,157,115, 1, 0, 0, 0, 0, 9, 0, 0, 0, 51, 51, 51, 63,
- 0, 98,115, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,192,237,115, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 62, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,205,204,204, 61, 5, 0, 0, 0, 17, 0, 0, 0,225, 2, 0, 0,227, 2, 0, 0,
- 5, 0, 0, 0, 17, 0, 0, 0,207, 2, 0, 0,227, 2, 0, 0, 68, 65, 84, 65, 48, 1, 0, 0,224,159,115, 1, 0, 0, 0, 0,
-133, 0, 0, 0, 1, 0, 0, 0, 80,161,115, 1, 0, 0, 0, 0, 16,159,115, 1, 0, 0, 0, 0, 6, 0, 0, 0, 51, 51, 51, 63,
- 0, 98,115, 1, 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,128, 67,
- 0, 0, 0, 0, 0, 0,128, 67, 0, 0,120,190, 0, 0,159, 63, 0, 0,242,190, 0,128,188, 63, 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,124, 1, 0, 0,
- 0, 0, 0, 0,242, 1, 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, 2, 0, 0, 0, 0, 0, 1, 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, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 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, 68, 65, 84, 65, 48, 1, 0, 0,
- 80,161,115, 1, 0, 0, 0, 0,132, 0, 0, 0, 1, 0, 0, 0,192,162,115, 1, 0, 0, 0, 0,224,159,115, 1, 0, 0, 0, 0,
- 3, 0, 0, 0, 51, 51, 51, 63, 0, 98,115, 1, 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,182, 67, 0, 0,209,195, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,182, 67, 0, 0,190,195, 0, 0, 0,181,
- 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0,124, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 16, 0, 0, 0,124, 1, 0, 0, 0, 0, 0, 0,124, 1, 0, 0, 0, 0,190,195, 0, 0,190,195, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,128, 63, 0, 0,128, 63, 1, 0, 1, 0, 1, 0, 1, 0,108, 1,124, 1, 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,142, 3, 1, 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,
- 68, 65, 84, 65,192, 0, 0, 0,192,162,115, 1, 0, 0, 0, 0,206, 0, 0, 0, 1, 0, 0, 0,192,163,115, 1, 0, 0, 0, 0,
- 80,161,115, 1, 0, 0, 0, 0, 11, 0, 0, 0, 51, 51, 51, 63, 0, 98,115, 1, 0, 0, 0, 0, 0, 0,128,192, 0, 0,122, 67,
- 0, 0,128,192, 0, 0,127, 67, 0, 0,128,192, 0, 0, 72, 66, 0, 0,128,192, 0, 0,127, 67, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,124, 1, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0,124, 1, 0, 0,
- 16, 0, 0, 0,124, 1, 0, 0, 0, 0,128, 63, 0,128,129, 67, 0, 0,250, 70, 0,128,129, 67,205,204,204, 61, 0, 0, 32, 65,
- 8, 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, 68, 65, 84, 65,192, 0, 0, 0,
-192,163,115, 1, 0, 0, 0, 0,134, 0, 0, 0, 1, 0, 0, 0,192,164,115, 1, 0, 0, 0, 0,192,162,115, 1, 0, 0, 0, 0,
- 13, 0, 0, 0, 51, 51, 51, 63, 0, 98,115, 1, 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,128, 63, 0, 0,122, 68, 0, 0, 0, 0, 0, 0,122, 68, 0, 0,160,192, 0, 0,130, 66,
- 0, 0, 0, 0, 0, 0,182, 67,108, 1, 0, 0,124, 1, 0, 0, 0, 0, 0, 0,124, 1, 0, 0,196, 0, 0, 0,108, 1, 0, 0,
- 0, 0, 0, 0, 16, 0, 0, 0,196, 0, 0, 0,108, 1, 0, 0, 16, 0, 0, 0,124, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,122, 68, 0, 0,122, 68,205,204,204, 61, 0, 0, 72, 66, 10, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,208, 0, 0, 0,192,164,115, 1, 0, 0, 0, 0,
-215, 0, 0, 0, 1, 0, 0, 0,208,165,115, 1, 0, 0, 0, 0,192,163,115, 1, 0, 0, 0, 0, 12, 0, 0, 0, 51, 51, 51, 63,
- 0, 98,115, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,191, 0, 0, 2, 66,
- 0, 0,122,196, 0, 0, 0, 0, 0, 0, 0,191, 0, 0, 2, 66, 0, 0,150,194, 0, 0,160, 64,108, 1, 0, 0,124, 1, 0, 0,
- 0, 0, 0, 0, 14, 2, 0, 0,128, 0, 0, 0,108, 1, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0,128, 0, 0, 0,108, 1, 0, 0,
- 16, 0, 0, 0, 14, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,250, 70, 0, 0,122, 68, 10,215, 35, 60, 0, 0, 72, 66,
- 10, 0, 0, 0, 0, 0, 0, 2, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,168, 1, 0, 0,
-208,165,115, 1, 0, 0, 0, 0,131, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,192,164,115, 1, 0, 0, 0, 0,
- 5, 0, 0, 0, 51, 51, 51, 63, 0, 98,115, 1, 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,150, 0, 0, 0, 83, 97,118,101, 32, 70,105,108,101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 47, 85,115,101,114,115, 47,116,111,110, 47, 68,101,115,107,116,111,112, 47, 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,112,114,101,118,105,101,119, 46, 98,108,101,110,100, 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, 8, 0, 82, 0, 0, 0, 0, 0, 76, 1, 1, 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,255,255, 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, 68, 65, 84, 65, 8, 1, 0, 0,
-192,167,115, 1, 0, 0, 0, 0,149, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 98,115, 1, 0, 0, 0, 0,
- 48, 40,115, 1, 0, 0, 0, 0,176, 41,115, 1, 0, 0, 0, 0,208, 42,115, 1, 0, 0, 0, 0,112, 42,115, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,252, 65, 79, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,228, 17,149, 63,
- 0, 0, 0, 0, 0, 0, 0, 0,170, 82, 60,189,241, 1,131,188,206,211,153,191, 0, 0,128,191, 0, 0, 0, 0, 0, 0, 0, 0,
-225,236, 65,193, 0, 0, 0, 0, 0, 0, 0, 0,251, 5, 0, 0, 0, 0, 0, 0, 67, 4, 0, 0, 0, 0, 0, 0,251, 5, 0, 0,
- 0, 0, 0, 0, 26, 0, 0, 0, 0, 0, 0, 0,251, 5, 0, 0, 27, 0, 0, 0, 67, 4, 0, 0, 9, 0, 8, 0, 1, 0, 1, 1,
-252, 5, 41, 4, 1, 0, 1, 0,195, 2, 0, 0, 7, 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,128,184,115, 1, 0, 0, 0, 0,144,197,115, 1, 0, 0, 0, 0,144, 46,106, 1, 0, 0, 0, 0,
-144, 46,106, 1, 0, 0, 0, 0, 16,169,115, 1, 0, 0, 0, 0, 80,183,115, 1, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,
- 16,169,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0, 64,170,115, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 84,114, 97,110,115,102,111,114,109, 32, 80,114,111,112,101,114,116,105,101,115, 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,
- 73,112,111, 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,
- 33, 0,167, 0, 62, 1,204, 0, 0, 0, 0, 0,162, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 68, 65, 84, 65,240, 0, 0, 0, 64,170,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,112,171,115, 1, 0, 0, 0, 0,
- 16,169,115, 1, 0, 0, 0, 0, 79,117,116,112,117,116, 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, 82,101,110,100,101,114, 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, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,112,171,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,
-160,172,115, 1, 0, 0, 0, 0, 64,170,115, 1, 0, 0, 0, 0, 82,101,110,100,101,114, 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, 82,101,110,100,101,114, 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, 64, 1, 0, 0, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,160,172,115, 1, 0, 0, 0, 0,
-148, 0, 0, 0, 1, 0, 0, 0,208,173,115, 1, 0, 0, 0, 0,112,171,115, 1, 0, 0, 0, 0, 65,110,105,109, 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, 82,101,110,100,101,114, 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,128, 2, 0, 0, 62, 1,204, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,
-208,173,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0, 0,175,115, 1, 0, 0, 0, 0,160,172,115, 1, 0, 0, 0, 0,
- 70,111,114,109, 97,116, 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,
- 82,101,110,100,101,114, 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,
-192, 3, 0, 0, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 68, 65, 84, 65,240, 0, 0, 0, 0,175,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0, 48,176,115, 1, 0, 0, 0, 0,
-208,173,115, 1, 0, 0, 0, 0, 76,105,110,107, 32, 97,110,100, 32, 77, 97,116,101,114,105, 97,108,115, 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, 69,100,105,116,105,110,103, 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, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0, 48,176,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,
- 96,177,115, 1, 0, 0, 0, 0, 0,175,115, 1, 0, 0, 0, 0, 67, 97,109,101,114, 97, 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, 69,100,105,116,105,110,103, 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, 64, 1, 0, 0, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0, 96,177,115, 1, 0, 0, 0, 0,
-148, 0, 0, 0, 1, 0, 0, 0,144,178,115, 1, 0, 0, 0, 0, 48,176,115, 1, 0, 0, 0, 0, 80,114,101,118,105,101,119, 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, 76, 97,109,112, 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, 62, 1,204, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,
-144,178,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,192,179,115, 1, 0, 0, 0, 0, 96,177,115, 1, 0, 0, 0, 0,
- 76, 97,109,112, 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,
- 76, 97,109,112, 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, 24,255, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 68, 65, 84, 65,240, 0, 0, 0,192,179,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,240,180,115, 1, 0, 0, 0, 0,
-144,178,115, 1, 0, 0, 0, 0, 83,104, 97,100,111,119, 32, 97,110,100, 32, 83,112,111,116, 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, 76, 97,109,112, 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, 48,254, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,240,180,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0,
- 32,182,115, 1, 0, 0, 0, 0,192,179,115, 1, 0, 0, 0, 0, 84,101,120,116,117,114,101, 32, 97,110,100, 32, 73,110,112,117,
-116, 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, 76, 97,109,112, 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, 72,253, 62, 1,204, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0, 32,182,115, 1, 0, 0, 0, 0,
-148, 0, 0, 0, 1, 0, 0, 0, 80,183,115, 1, 0, 0, 0, 0,240,180,115, 1, 0, 0, 0, 0, 77, 97,112, 32, 84,111, 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, 76, 97,109,112, 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, 72,253, 62, 1,204, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,240,180,115, 1, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0,
- 80,183,115, 1, 0, 0, 0, 0,148, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32,182,115, 1, 0, 0, 0, 0,
- 84,114, 97,110,115,102,111,114,109, 32, 80,114,111,112,101,114,116,105,101,115, 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,
- 86,105,101,119, 51,100, 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,228, 0, 62, 1,204, 0, 0, 0, 0, 0,162, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 68, 65, 84, 65, 56, 3, 0, 0,128,184,115, 1, 0, 0, 0, 0,124, 0, 0, 0, 1, 0, 0, 0, 0,188,115, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 51, 51, 51, 63,192,167,115, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,255,255,127, 37, 0, 0,128, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,160, 51,
- 0, 0,128,191, 0, 0, 0, 0, 0, 0,128,165, 0, 0,128, 63,104, 33,162, 51, 0, 0, 0, 0, 78,199, 41, 60,210,129,230,191,
-225,230, 30,193, 0, 0,128, 63, 0, 0,128, 63,254,255,127, 37,255,255,127,165, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-255,255,127, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,128,191, 0, 0,160, 51, 0, 0, 0, 0, 79,199, 41,188,226,230, 30,193,
-216,129,230, 63, 0, 0,128, 63,252, 65, 79, 63,219, 5,147, 37,206,211,153,165, 0, 0,128,165,170, 82, 60, 61, 32, 2,131, 60,
-206,211,153, 63, 0, 0,128, 63,198,137,110,177,228, 17,149, 63, 54,216,194,179,104, 33,162,179, 88, 21,238, 62, 0, 31,248,191,
- 0,126, 61,190,225,230, 30, 65, 71, 26,158, 63, 70, 26,158, 37, 70, 26,158,165, 0, 0, 0, 26, 0, 0, 0,179, 0, 0,128, 51,
-254,208, 91, 63, 0, 0,128,179,192, 31, 96, 58, 5,196, 81, 63, 84, 37, 24,190,230,248,168,189, 23,210,108,189,230, 37,122, 60,
-168,200, 40, 62, 29, 17,203, 61,252, 65, 79, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,228, 17,149, 63,
- 0, 0, 0, 0, 0, 0, 0, 0,170, 82, 60,189,241, 1,131,188,206,211,153,191, 0, 0,128,191, 0, 0, 0, 0, 0, 0, 0, 0,
-225,236, 65,193, 0, 0, 0, 0, 0, 0,128, 63,255,255,127, 37, 0, 0,128, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,160, 51,
- 0, 0,128,191, 0, 0, 0, 0, 0, 0,128,165, 0, 0,128, 63,104, 33,162, 51, 0, 0, 0, 0, 78,199, 41, 60,210,129,230,191,
-225,230, 30,193, 0, 0,128, 63,244, 4, 53, 63,243, 4, 53,191,243, 4, 53,165,242, 4,181, 36,147,160, 98, 65, 0, 0, 0, 0,
- 0, 0, 0, 0, 2, 0, 0, 0,160,248,115, 1, 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,
- 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,251,255, 0, 0, 0, 0, 12, 66, 0, 0,128, 63, 0, 0,128, 63,
-155, 90,211, 58, 10,215, 35, 60, 0, 0,250, 67,228, 18,218,188, 37,180, 23,188, 81, 35, 24, 62, 64, 52, 55,190,244,153,230,191,
- 0, 0,224, 54, 56,146, 88, 63,198, 37, 71, 64, 20, 0, 0, 0, 7, 0,207, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,255,255,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 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, 8, 24,
- 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,240, 0, 0, 0, 0,188,115, 1, 0, 0, 0, 0,
-129, 0, 0, 0, 1, 0, 0, 0, 48,189,115, 1, 0, 0, 0, 0,128,184,115, 1, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0,
-192,167,115, 1, 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, 2, 0, 4, 0, 0, 0, 0, 0, 0, 0,160, 68, 0, 0, 46,196, 0, 0,100, 67,197,197,136, 55,118,209, 78, 68,
- 40,222,231,195,172,158, 25, 67, 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,128, 67, 0, 0, 40, 66,
- 0, 0, 0, 69, 0, 0,225, 67, 0, 0, 0, 63, 72,225,154, 63, 0, 0, 1, 0, 1, 0, 1, 0,233, 3,235, 2, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-255,255, 0, 0, 0, 0, 0, 0,150, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 68, 65, 84, 65, 88, 1, 0, 0,
- 48,189,115, 1, 0, 0, 0, 0,128, 0, 0, 0, 1, 0, 0, 0,208,190,115, 1, 0, 0, 0, 0, 0,188,115, 1, 0, 0, 0, 0,
- 2, 0, 0, 0, 51, 51, 51, 63,192,167,115, 1, 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,122, 67,205,204,204,189,205,204,140, 63, 0, 0,128, 63, 0, 0,122, 67,
- 0, 0,160,192, 0, 0,160, 64, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0,235, 2, 0, 0, 16, 0, 0, 0,168, 3, 0, 0,
- 0, 0, 0, 0, 16, 0, 0, 0, 16, 0, 0, 0,168, 3, 0, 0, 16, 0, 0, 0,235, 2, 0, 0, 10,215, 35, 60, 10,215, 35, 60,
- 0, 96,106, 70, 0, 0,122, 68, 0, 0, 0, 0, 0, 0, 0, 0, 9, 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, 32, 20,116, 1, 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, 29, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 79, 66, 1, 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,122, 67,
-205,204,204,189,205,204,140, 63, 68, 65, 84, 65,136, 0, 0, 0,208,190,115, 1, 0, 0, 0, 0,135, 0, 0, 0, 1, 0, 0, 0,
-160,191,115, 1, 0, 0, 0, 0, 48,189,115, 1, 0, 0, 0, 0, 9, 0, 0, 0, 51, 51, 51, 63,192,167,115, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,192,237,115, 1, 0, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,205,204,204, 61, 5, 0, 0, 0, 17, 0, 0, 0,225, 2, 0, 0,227, 2, 0, 0, 5, 0, 0, 0, 17, 0, 0, 0,
-207, 2, 0, 0,227, 2, 0, 0, 68, 65, 84, 65, 48, 1, 0, 0,160,191,115, 1, 0, 0, 0, 0,133, 0, 0, 0, 1, 0, 0, 0,
- 16,193,115, 1, 0, 0, 0, 0,208,190,115, 1, 0, 0, 0, 0, 6, 0, 0, 0, 51, 51, 51, 63,192,167,115, 1, 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,128, 67, 0, 0, 0, 0, 0, 0,128, 67,
- 0, 0,120,190, 0, 0,159, 63, 0, 0,242,190, 0,128,188, 63, 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,124, 1, 0, 0, 0, 0, 0, 0,242, 1, 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, 2, 0, 0, 0, 0, 0, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 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, 68, 65, 84, 65, 48, 1, 0, 0, 16,193,115, 1, 0, 0, 0, 0,
-132, 0, 0, 0, 1, 0, 0, 0,128,194,115, 1, 0, 0, 0, 0,160,191,115, 1, 0, 0, 0, 0, 3, 0, 0, 0, 51, 51, 51, 63,
-192,167,115, 1, 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,182, 67,
- 0, 0,209,195, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,182, 67, 0, 0,190,195, 0, 0, 0,181, 0, 0, 0, 0, 16, 0, 0, 0,
- 0, 0, 0, 0,124, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0,124, 1, 0, 0,
- 0, 0, 0, 0,124, 1, 0, 0, 0, 0,190,195, 0, 0,190,195, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63,
- 1, 0, 1, 0, 1, 0, 1, 0,108, 1,124, 1, 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,142, 3, 1, 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, 68, 65, 84, 65,192, 0, 0, 0,
-128,194,115, 1, 0, 0, 0, 0,206, 0, 0, 0, 1, 0, 0, 0,128,195,115, 1, 0, 0, 0, 0, 16,193,115, 1, 0, 0, 0, 0,
- 11, 0, 0, 0, 51, 51, 51, 63,192,167,115, 1, 0, 0, 0, 0, 0, 0,128,192, 0, 0,122, 67, 0, 0,128,192, 0, 0,127, 67,
- 0, 0,128,192, 0, 0, 72, 66, 0, 0,128,192, 0, 0,127, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,124, 1, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0,124, 1, 0, 0, 16, 0, 0, 0,124, 1, 0, 0,
- 0, 0,128, 63, 0,128,129, 67, 0, 0,250, 70, 0,128,129, 67,205,204,204, 61, 0, 0, 32, 65, 8, 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, 68, 65, 84, 65,192, 0, 0, 0,128,195,115, 1, 0, 0, 0, 0,
-134, 0, 0, 0, 1, 0, 0, 0,128,196,115, 1, 0, 0, 0, 0,128,194,115, 1, 0, 0, 0, 0, 13, 0, 0, 0, 51, 51, 51, 63,
-192,167,115, 1, 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,128, 63, 0, 0,122, 68, 0, 0, 0, 0, 0, 0,122, 68, 0, 0,160,192, 0, 0,130, 66, 0, 0, 0, 0, 0, 0,182, 67,
-108, 1, 0, 0,124, 1, 0, 0, 0, 0, 0, 0,124, 1, 0, 0,196, 0, 0, 0,108, 1, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0,
-196, 0, 0, 0,108, 1, 0, 0, 16, 0, 0, 0,124, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,122, 68, 0, 0,122, 68,
-205,204,204, 61, 0, 0, 72, 66, 10, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,208, 0, 0, 0,128,196,115, 1, 0, 0, 0, 0,215, 0, 0, 0, 1, 0, 0, 0,
-144,197,115, 1, 0, 0, 0, 0,128,195,115, 1, 0, 0, 0, 0, 12, 0, 0, 0, 51, 51, 51, 63,192,167,115, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,191, 0, 0, 2, 66, 0, 0,122,196, 0, 0, 0, 0,
- 0, 0, 0,191, 0, 0, 2, 66, 0, 0,150,194, 0, 0,160, 64,108, 1, 0, 0,124, 1, 0, 0, 0, 0, 0, 0, 14, 2, 0, 0,
-128, 0, 0, 0,108, 1, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0,128, 0, 0, 0,108, 1, 0, 0, 16, 0, 0, 0, 14, 2, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,250, 70, 0, 0,122, 68, 10,215, 35, 60, 0, 0, 72, 66, 10, 0, 0, 0, 0, 0, 0, 2,
- 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,168, 1, 0, 0,144,197,115, 1, 0, 0, 0, 0,
-131, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,196,115, 1, 0, 0, 0, 0, 5, 0, 0, 0, 51, 51, 51, 63,
-192,167,115, 1, 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,
- 86, 0, 0, 0, 83, 97,118,101, 32, 70,105,108,101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 85,115,101,
-114,115, 47,116,111,110, 47, 68,101,115,107,116,111,112, 47, 0,114, 47,114,101,108,101, 97,115,101, 47,100, 97,116, 97,102,105,
-108,101,115, 47, 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,112,114,101,118,
-105,101,119, 46, 98,108,101,110,100, 0, 0, 0, 98,108,101,110,100, 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, 8, 0, 46, 0, 0, 0, 0, 0, 85, 1, 1, 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, 72, 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, 83, 67, 0, 0, 24, 6, 0, 0,128,199,115, 1, 0, 0, 0, 0,
-122, 0, 0, 0, 1, 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, 83, 67,112,114,101,118,105,101,119, 0, 0, 99,101,110,101, 46, 48, 48, 49, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,160,248,115, 1, 0, 0, 0, 0,224,235,115, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,224,205,115, 1, 0, 0, 0, 0,128,215,115, 1, 0, 0, 0, 0,
-192,206,115, 1, 0, 0, 0, 0, 84,213,149, 63,126,238, 7,193, 36,109,142, 63, 52, 84,142, 55,194, 12,188,192, 28, 38, 71, 64,
- 52, 84,142, 55,194, 12,188,192, 28, 38, 71, 64, 52, 84,142, 55,194, 12,188,192, 28, 38, 71, 64, 1, 0, 0, 0, 65,245,214, 62,
- 1, 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,
-240,215,115, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96,216,115, 1, 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,
- 2, 0, 0, 0, 1, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,100, 0, 0, 0,100, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 2,224, 1, 60, 0,
- 32, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 25, 0,141, 0, 88, 2, 88, 2,100, 0,100, 0, 2, 0, 2, 0, 0, 0,
- 24, 0, 4, 0, 0, 0, 0, 0, 90, 0, 16, 0, 0, 0, 32, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 5, 0, 25, 0, 10, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 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, 64,217,115, 1, 0, 0, 0, 0, 64,217,115, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 5, 0, 2, 0, 1, 0, 1, 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, 47, 47, 98, 97, 99,107, 98,117,102, 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, 47,116,109,112, 47, 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, 47, 47,102,116,121,112,101, 0, 64, 38, 35, 0, 0, 0, 0, 0, 64, 94, 0, 0, 64, 38, 94, 0,
- 0, 0, 35, 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, 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,205,204, 76, 63,205,204, 76, 63,205,204, 76, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 62, 68,172, 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, 10, 0, 0, 0, 0, 0, 0, 0,192,249,117, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 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,
- 68, 65, 84, 65, 40, 0, 0, 0,224,205,115, 1, 0, 0, 0, 0,107, 0, 0, 0, 1, 0, 0, 0, 80,206,115, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 34, 3, 28, 2,176, 6,116, 1, 0, 0, 0, 0,
- 68, 65, 84, 65, 40, 0, 0, 0, 80,206,115, 1, 0, 0, 0, 0,107, 0, 0, 0, 1, 0, 0, 0,192,206,115, 1, 0, 0, 0, 0,
-224,205,115, 1, 0, 0, 0, 0, 14, 4, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 34, 3,228, 2, 0, 2,116, 1, 0, 0, 0, 0,
- 68, 65, 84, 65, 40, 0, 0, 0,192,206,115, 1, 0, 0, 0, 0,107, 0, 0, 0, 1, 0, 0, 0, 48,207,115, 1, 0, 0, 0, 0,
- 80,206,115, 1, 0, 0, 0, 0, 0, 4, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0,116, 3,187, 1,144, 88,116, 1, 0, 0, 0, 0,
- 68, 65, 84, 65, 40, 0, 0, 0, 48,207,115, 1, 0, 0, 0, 0,107, 0, 0, 0, 1, 0, 0, 0,160,207,115, 1, 0, 0, 0, 0,
-192,206,115, 1, 0, 0, 0, 0, 32, 0, 0, 0, 4, 0, 0, 0, 0, 16, 0, 0,224, 46, 49, 1, 96, 46,116, 1, 0, 0, 0, 0,
- 68, 65, 84, 65, 40, 0, 0, 0,160,207,115, 1, 0, 0, 0, 0,107, 0, 0, 0, 1, 0, 0, 0, 16,208,115, 1, 0, 0, 0, 0,
- 48,207,115, 1, 0, 0, 0, 0, 33, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 34, 3, 28, 2,192, 50,116, 1, 0, 0, 0, 0,
- 68, 65, 84, 65, 40, 0, 0, 0, 16,208,115, 1, 0, 0, 0, 0,107, 0, 0, 0, 1, 0, 0, 0,128,208,115, 1, 0, 0, 0, 0,
-160,207,115, 1, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 20, 0, 0,224, 46, 52, 0, 0, 42,116, 1, 0, 0, 0, 0,
- 68, 65, 84, 65, 40, 0, 0, 0,128,208,115, 1, 0, 0, 0, 0,107, 0, 0, 0, 1, 0, 0, 0,240,208,115, 1, 0, 0, 0, 0,
- 16,208,115, 1, 0, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 20, 0, 0,224, 46, 47, 0,160, 37,116, 1, 0, 0, 0, 0,
- 68, 65, 84, 65, 40, 0, 0, 0,240,208,115, 1, 0, 0, 0, 0,107, 0, 0, 0, 1, 0, 0, 0, 96,209,115, 1, 0, 0, 0, 0,
-128,208,115, 1, 0, 0, 0, 0, 2, 0, 0, 0, 4, 0, 0, 0, 0, 20, 0, 0,224, 46, 85, 1, 64, 33,116, 1, 0, 0, 0, 0,
- 68, 65, 84, 65, 40, 0, 0, 0, 96,209,115, 1, 0, 0, 0, 0,107, 0, 0, 0, 1, 0, 0, 0,208,209,115, 1, 0, 0, 0, 0,
-240,208,115, 1, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 20, 0, 0,224, 46,158, 0,224, 28,116, 1, 0, 0, 0, 0,
- 68, 65, 84, 65, 40, 0, 0, 0,208,209,115, 1, 0, 0, 0, 0,107, 0, 0, 0, 1, 0, 0, 0, 64,210,115, 1, 0, 0, 0, 0,
- 96,209,115, 1, 0, 0, 0, 0, 1, 0, 0, 0, 4, 0, 0, 0, 0, 20, 0, 0,224, 46,100, 0,128, 24,116, 1, 0, 0, 0, 0,
- 68, 65, 84, 65, 40, 0, 0, 0, 64,210,115, 1, 0, 0, 0, 0,107, 0, 0, 0, 1, 0, 0, 0,176,210,115, 1, 0, 0, 0, 0,
-208,209,115, 1, 0, 0, 0, 0, 4, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0,254, 1,152, 1,224, 83,116, 1, 0, 0, 0, 0,
- 68, 65, 84, 65, 40, 0, 0, 0,176,210,115, 1, 0, 0, 0, 0,107, 0, 0, 0, 1, 0, 0, 0, 32,211,115, 1, 0, 0, 0, 0,
- 64,210,115, 1, 0, 0, 0, 0, 14, 4, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 34, 3,228, 2, 0,253,115, 1, 0, 0, 0, 0,
- 68, 65, 84, 65, 40, 0, 0, 0, 32,211,115, 1, 0, 0, 0, 0,107, 0, 0, 0, 1, 0, 0, 0,144,211,115, 1, 0, 0, 0, 0,
-176,210,115, 1, 0, 0, 0, 0, 64, 0, 0, 0, 13, 0, 0, 0, 0, 16, 0, 0,252, 1,162, 2,208, 74,116, 1, 0, 0, 0, 0,
- 68, 65, 84, 65, 40, 0, 0, 0,144,211,115, 1, 0, 0, 0, 0,107, 0, 0, 0, 1, 0, 0, 0, 0,212,115, 1, 0, 0, 0, 0,
- 32,211,115, 1, 0, 0, 0, 0, 64, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0,249, 1,199, 1, 48, 79,116, 1, 0, 0, 0, 0,
- 68, 65, 84, 65, 40, 0, 0, 0, 0,212,115, 1, 0, 0, 0, 0,107, 0, 0, 0, 1, 0, 0, 0,112,212,115, 1, 0, 0, 0, 0,
-144,211,115, 1, 0, 0, 0, 0, 32, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0,253, 1,124, 1,144, 95,116, 1, 0, 0, 0, 0,
- 68, 65, 84, 65, 40, 0, 0, 0,112,212,115, 1, 0, 0, 0, 0,107, 0, 0, 0, 1, 0, 0, 0,224,212,115, 1, 0, 0, 0, 0,
- 0,212,115, 1, 0, 0, 0, 0, 16, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,254, 1,125, 1, 32, 70,116, 1, 0, 0, 0, 0,
- 68, 65, 84, 65, 40, 0, 0, 0,224,212,115, 1, 0, 0, 0, 0,107, 0, 0, 0, 1, 0, 0, 0, 80,213,115, 1, 0, 0, 0, 0,
-112,212,115, 1, 0, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 31, 3, 28, 2,112, 55,116, 1, 0, 0, 0, 0,
- 68, 65, 84, 65, 40, 0, 0, 0, 80,213,115, 1, 0, 0, 0, 0,107, 0, 0, 0, 1, 0, 0, 0,192,213,115, 1, 0, 0, 0, 0,
-224,212,115, 1, 0, 0, 0, 0, 28, 4, 0, 0, 4, 0, 0, 0, 0, 20, 0, 0,224, 46,152, 1, 96, 11,116, 1, 0, 0, 0, 0,
- 68, 65, 84, 65, 40, 0, 0, 0,192,213,115, 1, 0, 0, 0, 0,107, 0, 0, 0, 1, 0, 0, 0, 48,214,115, 1, 0, 0, 0, 0,
- 80,213,115, 1, 0, 0, 0, 0, 2, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0,254, 1,125, 1,112, 65,116, 1, 0, 0, 0, 0,
- 68, 65, 84, 65, 40, 0, 0, 0, 48,214,115, 1, 0, 0, 0, 0,107, 0, 0, 0, 1, 0, 0, 0,160,214,115, 1, 0, 0, 0, 0,
-192,213,115, 1, 0, 0, 0, 0, 28, 4, 0, 0, 5, 0, 0, 0, 0, 20, 0, 0,224, 46, 44, 0, 32, 20,116, 1, 0, 0, 0, 0,
- 68, 65, 84, 65, 40, 0, 0, 0,160,214,115, 1, 0, 0, 0, 0,107, 0, 0, 0, 1, 0, 0, 0, 16,215,115, 1, 0, 0, 0, 0,
- 48,214,115, 1, 0, 0, 0, 0, 8, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0,194, 1,152, 1, 32, 60,116, 1, 0, 0, 0, 0,
- 68, 65, 84, 65, 40, 0, 0, 0, 16,215,115, 1, 0, 0, 0, 0,107, 0, 0, 0, 1, 0, 0, 0,128,215,115, 1, 0, 0, 0, 0,
-160,214,115, 1, 0, 0, 0, 0, 28, 4, 0, 0, 6, 0, 0, 0, 0, 20, 0, 0,224, 46, 20, 0,192, 15,116, 1, 0, 0, 0, 0,
- 68, 65, 84, 65, 40, 0, 0, 0,128,215,115, 1, 0, 0, 0, 0,107, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 16,215,115, 1, 0, 0, 0, 0,223, 5, 0, 0, 7, 0, 0, 0, 0, 4, 0, 0,224, 46, 62, 0,160,248,115, 1, 0, 0, 0, 0,
- 68, 65, 84, 65, 40, 0, 0, 0,240,215,115, 1, 0, 0, 0, 0,106, 0, 0, 0, 1, 0, 0, 0, 44, 1, 0, 0, 1, 0, 2, 0,
- 1, 0, 2, 0, 0, 0, 1, 0,244, 1,200, 0,100, 0, 20, 0, 16, 39, 0, 0,205,204,204, 61, 0, 0,240, 65, 0, 0, 0, 64,
- 68, 65, 84, 65,152, 0, 0, 0, 96,216,115, 1, 0, 0, 0, 0,119, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0,205,204, 76, 63,
- 0, 0,180, 66, 9, 0, 1, 0, 0, 0,128, 63,111, 18,131, 58, 32, 0, 32, 0, 32, 0, 1, 0, 0, 0,128, 63, 0, 0,128, 63,
- 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 5, 0, 5, 0,255,255,
- 50, 0, 50, 0, 10, 0, 0, 0, 50, 0,100, 0, 10, 0, 0, 0, 50, 0, 50, 0, 10, 0, 0, 0, 50, 0, 50, 0, 10, 0, 0, 0,
- 50, 0, 50, 0, 10, 0, 0, 0, 50, 0, 50, 0, 10, 0, 0, 0, 50, 0, 50, 0, 10, 0, 0, 0, 0, 0,128, 62, 0, 0, 0, 0,
- 23,183,209, 56,205,204,204, 61, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 80, 0, 0, 0, 64,217,115, 1, 0, 0, 0, 0,
-112, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 32, 82,101,110,100,101,114,
- 76, 97,121,101,114, 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,
-160,243,115, 1, 0, 0, 0, 0,255,255, 15, 0,255,127, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 73, 77, 0, 0,176, 1, 0, 0,
-208,217,115, 1, 0, 0, 0, 0, 28, 0, 0, 0, 1, 0, 0, 0,224,201,114, 1, 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, 73, 77, 73,109, 97,103,101, 46, 48, 48, 49, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 85,110,116,105,116,108,101,100,
- 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,
- 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, 0, 0, 0, 1, 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,108,110,134, 68, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 73, 77, 0, 0,176, 1, 0, 0,224,201,114, 1, 0, 0, 0, 0, 28, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-208,217,115, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 73, 77, 82,101,110,100,101,114,
- 32, 82,101,115,117,108,116, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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, 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, 0, 0, 0, 5, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 1, 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, 0, 1, 1, 0, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 67, 65, 0, 0,168, 0, 0, 0,192,219,115, 1, 0, 0, 0, 0, 26, 0, 0, 0, 1, 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,
- 67, 65, 67, 97,109,101,114, 97, 46, 48, 48, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0,205,204, 76, 62,117,148, 96, 66, 76, 39,176, 64,210, 69,112, 66, 0, 0,240, 65,
-161, 14,234, 64, 0, 0, 0, 63, 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, 76, 65, 0, 0,104, 1, 0, 0,176,220,115, 1, 0, 0, 0, 0, 36, 0, 0, 0, 1, 0, 0, 0,
- 96,222,115, 1, 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,
- 76, 65, 76, 97,109,112, 46, 48, 48, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0,160, 65,182,152,143, 66,154,153, 25, 62, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0,
- 32,105,122, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 63, 0, 0, 32, 66, 0, 0, 52, 66, 0, 0,128, 63, 0, 0, 64, 64,
- 0, 2, 3, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63,
-111, 18,131, 58, 1, 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, 68, 65, 84, 65, 48, 1, 0, 0, 32,105,122, 1, 0, 0, 0, 0, 2, 1, 0, 0, 1, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0,128, 63, 2, 0, 1, 0, 0, 0,128, 67, 0, 0, 0, 0, 0, 0,128, 63,243, 4, 53,191,242, 4, 53, 63,
-242, 4, 53,191,243, 4, 53, 63, 64, 75,122, 1, 0, 0, 0, 0,128,143,118, 1, 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, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 68, 65, 84, 65, 24, 0, 0, 0, 64, 75,122, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 76, 65, 0, 0,104, 1, 0, 0, 96,222,115, 1, 0, 0, 0, 0, 36, 0, 0, 0, 1, 0, 0, 0, 16,224,115, 1, 0, 0, 0, 0,
-176,220,115, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 76, 65, 83,112,111,116, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 8, 16, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63,205,204, 12, 64,247,255,239, 65,
- 0, 0,150, 66,154,153, 25, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0,192,118, 1, 0, 0, 0, 0,
- 4, 0, 0, 0, 46, 26,128, 63, 25, 4,240, 65, 0, 0, 52, 66, 0, 0,128, 63, 0, 0, 64, 64, 64, 11, 3, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63,111, 18,131, 58, 1, 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,
- 68, 65, 84, 65, 48, 1, 0, 0, 0,192,118, 1, 0, 0, 0, 0, 2, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63,
- 2, 0, 1, 0, 0, 0,128, 67, 0, 0, 0, 0, 0, 0,128, 63,243, 4, 53,191,242, 4, 53, 63,242, 4, 53,191,243, 4, 53, 63,
-112,193,118, 1, 0, 0, 0, 0,192, 63,118, 1, 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, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0, 0, 0, 68, 65, 84, 65, 24, 0, 0, 0,112,193,118, 1, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 76, 65, 0, 0,104, 1, 0, 0,
- 16,224,115, 1, 0, 0, 0, 0, 36, 0, 0, 0, 1, 0, 0, 0,192,225,115, 1, 0, 0, 0, 0, 96,222,115, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 76, 65, 83,112,111,116, 46, 48, 48, 49, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63,102,102,102, 63,247,255,239, 65, 0, 0,150, 66,154,153, 25, 62,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0,176,118, 1, 0, 0, 0, 0, 1, 0, 0, 0, 46, 26,128, 63,
- 25, 4,240, 65, 0, 0, 52, 66, 0, 0,128, 63, 0, 0, 64, 64, 64, 11, 3, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63,111, 18,131, 58, 1, 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, 68, 65, 84, 65, 48, 1, 0, 0,
- 0,176,118, 1, 0, 0, 0, 0, 2, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 2, 0, 1, 0, 0, 0,128, 67,
- 0, 0, 0, 0, 0, 0,128, 63,243, 4, 53,191,242, 4, 53, 63,242, 4, 53,191,243, 4, 53, 63,112,177,118, 1, 0, 0, 0, 0,
-144,132,117, 1, 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, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0,
- 68, 65, 84, 65, 24, 0, 0, 0,112,177,118, 1, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 76, 65, 0, 0,104, 1, 0, 0,192,225,115, 1, 0, 0, 0, 0,
- 36, 0, 0, 0, 1, 0, 0, 0,112,227,115, 1, 0, 0, 0, 0, 16,224,115, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 76, 65, 83,112,111,116, 46, 48, 48, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 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,128, 63, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63,247,255,239, 65, 0, 0,150, 66,154,153, 25, 62, 0, 0,128, 63,200,182, 27, 63,
- 0, 0,128, 63, 0, 0, 0, 0,208,155,118, 1, 0, 0, 0, 0, 1, 0, 0, 0, 46, 26,128, 63, 25, 4,240, 65, 0, 0, 52, 66,
- 0, 0,128, 63, 0, 0, 64, 64, 64, 11, 3, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0,128, 63,111, 18,131, 58, 1, 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, 68, 65, 84, 65, 48, 1, 0, 0,208,155,118, 1, 0, 0, 0, 0,
- 2, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 2, 0, 1, 0, 0, 0,128, 67, 0, 0, 0, 0, 0, 0,128, 63,
-243, 4, 53,191,242, 4, 53, 63,242, 4, 53,191,243, 4, 53, 63, 64,157,118, 1, 0, 0, 0, 0,224,144,117, 1, 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, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 68, 65, 84, 65, 24, 0, 0, 0,
- 64,157,118, 1, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 76, 65, 0, 0,104, 1, 0, 0,112,227,115, 1, 0, 0, 0, 0, 36, 0, 0, 0, 1, 0, 0, 0,
- 32,229,115, 1, 0, 0, 0, 0,192,225,115, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 76, 65, 83,112,111,116, 46, 48, 48, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63,
-205,204,204, 62,247,255,239, 65, 0, 0,150, 66,154,153, 25, 62, 0, 0,128, 63,200,182, 27, 63, 0, 0,128, 63, 0, 0, 0, 0,
-160,157,118, 1, 0, 0, 0, 0, 1, 0, 0, 0, 46, 26,128, 63, 25, 4,240, 65, 0, 0, 52, 66, 0, 0,128, 63, 0, 0, 64, 64,
- 64, 11, 3, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63,
-111, 18,131, 58, 1, 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, 68, 65, 84, 65, 48, 1, 0, 0,160,157,118, 1, 0, 0, 0, 0, 2, 1, 0, 0, 1, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0,128, 63, 2, 0, 1, 0, 0, 0,128, 67, 0, 0, 0, 0, 0, 0,128, 63,243, 4, 53,191,242, 4, 53, 63,
-242, 4, 53,191,243, 4, 53, 63, 16,159,118, 1, 0, 0, 0, 0, 48,157,117, 1, 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, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 68, 65, 84, 65, 24, 0, 0, 0, 16,159,118, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 76, 65, 0, 0,104, 1, 0, 0, 32,229,115, 1, 0, 0, 0, 0, 36, 0, 0, 0, 1, 0, 0, 0,208,230,115, 1, 0, 0, 0, 0,
-112,227,115, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 76, 65, 83,112,111,116, 46, 48,
- 48, 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 8, 16, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 80, 78, 83, 63,247,255,239, 65,
- 0, 0,150, 66,154,153, 25, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0,112,159,118, 1, 0, 0, 0, 0,
- 4, 0, 0, 0, 46, 26,128, 63, 25, 4,240, 65, 0, 0, 52, 66, 0, 0,128, 63, 0, 0, 64, 64, 64, 11, 3, 0, 1, 0, 0, 0,
- 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63,111, 18,131, 58, 1, 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,
- 68, 65, 84, 65, 48, 1, 0, 0,112,159,118, 1, 0, 0, 0, 0, 2, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63,
- 2, 0, 1, 0, 0, 0,128, 67, 0, 0, 0, 0, 0, 0,128, 63,243, 4, 53,191,242, 4, 53, 63,242, 4, 53,191,243, 4, 53, 63,
-224,160,118, 1, 0, 0, 0, 0,128,169,117, 1, 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, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0, 0, 0, 68, 65, 84, 65, 24, 0, 0, 0,224,160,118, 1, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 76, 65, 0, 0,104, 1, 0, 0,
-208,230,115, 1, 0, 0, 0, 0, 36, 0, 0, 0, 1, 0, 0, 0,128,232,115, 1, 0, 0, 0, 0, 32,229,115, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 76, 65, 83,112,111,116, 46, 48, 48, 54, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 8, 0, 0, 0, 0, 0,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 51, 51,179, 63,247,255,239, 65, 0, 0, 72, 66,171,156, 8, 63,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 16, 76,118, 1, 0, 0, 0, 0, 4, 0, 0, 0, 78,207, 68, 65,
- 25, 4,240, 65, 0, 0, 52, 66, 0, 0,128, 63, 0, 0, 64, 64, 0, 2, 3, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63,111, 18,131, 58, 1, 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, 68, 65, 84, 65, 48, 1, 0, 0,
- 16, 76,118, 1, 0, 0, 0, 0, 2, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 2, 0, 1, 0, 0, 0,128, 67,
- 0, 0, 0, 0, 0, 0,128, 63,243, 4, 53,191,242, 4, 53, 63,242, 4, 53,191,243, 4, 53, 63,128, 77,118, 1, 0, 0, 0, 0,
-208,181,117, 1, 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, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0,
- 68, 65, 84, 65, 24, 0, 0, 0,128, 77,118, 1, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 76, 65, 0, 0,104, 1, 0, 0,128,232,115, 1, 0, 0, 0, 0,
- 36, 0, 0, 0, 1, 0, 0, 0, 48,234,115, 1, 0, 0, 0, 0,208,230,115, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 76, 65, 83,112,111,116, 46, 48, 48, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63,247,255,239, 65, 0, 0,150, 66,154,153, 25, 62, 0, 0,128, 63, 0, 0, 0, 0,
- 0, 0,128, 63, 0, 0, 0, 0,224, 77,118, 1, 0, 0, 0, 0, 1, 0, 0, 0, 46, 26,128, 63, 25, 4,240, 65, 0, 0, 52, 66,
- 0, 0,128, 63, 0, 0, 64, 64, 64, 11, 3, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0,128, 63,111, 18,131, 58, 1, 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, 68, 65, 84, 65, 48, 1, 0, 0,224, 77,118, 1, 0, 0, 0, 0,
- 2, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 2, 0, 1, 0, 0, 0,128, 67, 0, 0, 0, 0, 0, 0,128, 63,
-243, 4, 53,191,242, 4, 53, 63,242, 4, 53,191,243, 4, 53, 63, 80, 79,118, 1, 0, 0, 0, 0, 32,194,117, 1, 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, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 68, 65, 84, 65, 24, 0, 0, 0,
- 80, 79,118, 1, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 76, 65, 0, 0,104, 1, 0, 0, 48,234,115, 1, 0, 0, 0, 0, 36, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,128,232,115, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 76, 65, 76, 97,109,112, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0,192, 63, 0, 0,160, 65, 0, 0, 52, 66,154,153, 25, 62, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0,
-176, 79,118, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 63, 0, 0, 32, 66, 0, 0, 52, 66, 0, 0,128, 63, 0, 0, 64, 64,
- 0, 2, 3, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63,
-111, 18,131, 58, 1, 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, 68, 65, 84, 65, 48, 1, 0, 0,176, 79,118, 1, 0, 0, 0, 0, 2, 1, 0, 0, 1, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0,128, 63, 2, 0, 1, 0, 0, 0,128, 67, 0, 0, 0, 0, 0, 0,128, 63,243, 4, 53,191,242, 4, 53, 63,
-242, 4, 53,191,243, 4, 53, 63, 32, 81,118, 1, 0, 0, 0, 0,176,207,117, 1, 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, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 68, 65, 84, 65, 24, 0, 0, 0, 32, 81,118, 1, 0, 0, 0, 0,
- 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 87, 79, 0, 0,152, 1, 0, 0,224,235,115, 1, 0, 0, 0, 0,105, 0, 0, 0, 1, 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, 87, 79, 87,111,114,108,100, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,141, 47, 79, 62, 64, 19,209, 62, 73, 23, 14, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0,128, 63, 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,128, 63,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,205,204, 28, 65, 0, 0, 0, 0, 1, 0, 0, 0, 5, 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, 64, 0, 0, 0, 0, 0, 0,112, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 65, 0, 0, 0, 0,
- 0, 0,128, 63,205,204, 76, 61, 0, 0, 5, 0, 0, 0, 0, 0, 10,215,163, 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 2, 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, 84, 88, 0, 0,152, 0, 0, 0,192,237,115, 1, 0, 0, 0, 0,
- 24, 0, 0, 0, 1, 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, 84, 88, 84,101,120,116, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 1, 0, 0, 0,
-160,238,115, 1, 0, 0, 0, 0,160,238,115, 1, 0, 0, 0, 0,160,238,115, 1, 0, 0, 0, 0,160,238,115, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 96,239,115, 1, 0, 0, 0, 0,255,255,255,255, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 68, 65, 84, 65, 40, 0, 0, 0,160,238,115, 1, 0, 0, 0, 0, 23, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 16,239,115, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 69, 69, 82, 70,
- 68, 65, 84, 65, 4, 0, 0, 0, 16,239,115, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 71, 82, 0, 0,
- 96, 0, 0, 0,160,243,115, 1, 0, 0, 0, 0,208, 0, 0, 0, 1, 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, 71, 82, 79,118,101,114,114,105,100,101, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64,244,115, 1,
- 0, 0, 0, 0, 48,248,115, 1, 0, 0, 0, 0,255,255, 15, 0, 0, 0, 0, 0, 68, 65, 84, 65, 40, 0, 0, 0, 64,244,115, 1,
- 0, 0, 0, 0,207, 0, 0, 0, 1, 0, 0, 0,176,244,115, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96, 46,116, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 40, 0, 0, 0,176,244,115, 1,
- 0, 0, 0, 0,207, 0, 0, 0, 1, 0, 0, 0, 32,245,115, 1, 0, 0, 0, 0, 64,244,115, 1, 0, 0, 0, 0, 0, 42,116, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 40, 0, 0, 0, 32,245,115, 1,
- 0, 0, 0, 0,207, 0, 0, 0, 1, 0, 0, 0,144,245,115, 1, 0, 0, 0, 0,176,244,115, 1, 0, 0, 0, 0,160, 37,116, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 40, 0, 0, 0,144,245,115, 1,
- 0, 0, 0, 0,207, 0, 0, 0, 1, 0, 0, 0, 0,246,115, 1, 0, 0, 0, 0, 32,245,115, 1, 0, 0, 0, 0, 64, 33,116, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 40, 0, 0, 0, 0,246,115, 1,
- 0, 0, 0, 0,207, 0, 0, 0, 1, 0, 0, 0,112,246,115, 1, 0, 0, 0, 0,144,245,115, 1, 0, 0, 0, 0,224, 28,116, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 40, 0, 0, 0,112,246,115, 1,
- 0, 0, 0, 0,207, 0, 0, 0, 1, 0, 0, 0,224,246,115, 1, 0, 0, 0, 0, 0,246,115, 1, 0, 0, 0, 0,128, 24,116, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 40, 0, 0, 0,224,246,115, 1,
- 0, 0, 0, 0,207, 0, 0, 0, 1, 0, 0, 0, 80,247,115, 1, 0, 0, 0, 0,112,246,115, 1, 0, 0, 0, 0,208, 74,116, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 40, 0, 0, 0, 80,247,115, 1,
- 0, 0, 0, 0,207, 0, 0, 0, 1, 0, 0, 0,192,247,115, 1, 0, 0, 0, 0,224,246,115, 1, 0, 0, 0, 0, 96, 11,116, 1,
- 0, 0, 0, 0,160, 44,191, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 40, 0, 0, 0,192,247,115, 1,
- 0, 0, 0, 0,207, 0, 0, 0, 1, 0, 0, 0, 48,248,115, 1, 0, 0, 0, 0, 80,247,115, 1, 0, 0, 0, 0, 32, 20,116, 1,
- 0, 0, 0, 0,240,189,126, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 40, 0, 0, 0, 48,248,115, 1,
- 0, 0, 0, 0,207, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,192,247,115, 1, 0, 0, 0, 0,192, 15,116, 1,
- 0, 0, 0, 0,176, 51,191, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 66, 0, 0, 32, 4, 0, 0,160,248,115, 1,
- 0, 0, 0, 0, 99, 0, 0, 0, 1, 0, 0, 0, 0,253,115, 1, 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, 79, 66, 67, 97,109,101,114, 97, 46, 48, 48, 49, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 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,192,219,115, 1, 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, 78,199, 41,188,225,230, 30,193,216,129,230, 63,
- 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,128, 63, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,218, 15,201, 63, 0, 0,128, 37,255,255,127, 37, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,255,255,127, 37, 0, 0,128,165, 0, 0, 0, 0,255,255,127, 37,105, 33,162, 51,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 37, 0, 0,128,191,105, 33,162, 51, 0, 0, 0, 0, 78,199, 41,188,225,230, 30,193,
-216,129,230, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 60,110,145,137,160,133,136, 24, 0, 0, 0, 0,254,255,127, 25, 0, 0,128, 63,
- 0, 0, 0, 40, 0, 0, 0, 0,255,255,127,165, 64, 90,136,176, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 60,110,145,137,160,133,136, 24, 0, 0, 0, 0,254,255,127, 25, 0, 0,128, 63,
- 0, 0, 0, 40, 0, 0, 0, 0,255,255,127,165, 64, 90,136,176, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63,223, 5, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 5, 0, 1, 0, 0, 0, 0, 0, 79, 66, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0,128, 63,
- 6, 41,100, 63, 0, 0,128, 63,205,204,204, 62, 6, 41,100, 63, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,128, 63, 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,128, 63, 0, 0,128, 63, 0, 0,128, 63, 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, 79, 66, 0, 0, 32, 4, 0, 0, 0,253,115, 1, 0, 0, 0, 0, 99, 0, 0, 0,
- 1, 0, 0, 0, 0, 2,116, 1, 0, 0, 0, 0,160,248,115, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 79, 66, 99,104,101, 99,107,101,114,115, 46, 48, 48, 49, 0, 46, 48, 48, 49, 0, 0, 0, 0, 0, 1, 0, 0, 4,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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, 80, 83,118, 1, 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,176, 1,116, 1, 0, 0, 0, 0, 52, 84,142, 55,194, 12,188,192, 28, 38, 71, 64, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 69, 36,190, 64, 69, 36,190, 64, 68, 36,190, 64, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,218, 15, 73, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 83,115,134, 64, 82,115,134, 64, 0, 0, 0, 0, 0, 0, 0, 0, 82,115,134,192, 83,115,134, 64, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 36,190, 64, 0, 0, 0, 0, 52, 84,142, 55,194, 12,188,192, 28, 38, 71, 64, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,179, 0, 0, 0, 0, 0, 0,128, 63,
-207,183,243, 61,205,183,243,189,160, 83,162, 37, 0, 0, 0, 0, 29, 90, 26, 50, 31, 90, 26, 50,173, 85, 44, 62, 0, 0, 0, 0,
-205,183,243,189,207,183,243,189, 24,107, 87, 50, 0, 0, 0, 0,158,176,247,190,212,108,246,190, 64,232, 97,190, 0, 0,128, 63,
- 14, 4, 0, 0, 0, 4, 1, 0, 0, 0, 68, 0, 1, 0, 2, 0, 0, 0, 0, 0, 79, 66, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,100, 0, 0, 0, 0, 0, 0, 0, 56,180,150,201, 0, 0,128, 63, 10,215, 35, 61, 0, 0,128, 63,
-205,204,204, 62,205,204,204, 61, 0, 0, 0, 0, 4, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 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,128, 63, 0, 64, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 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, 64,117,127, 1, 0, 0, 0, 0, 80,133,127, 1, 0, 0, 0, 0, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 68, 65, 84, 65, 8, 0, 0, 0,176, 1,116, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,224,103,116, 1,
- 0, 0, 0, 0, 79, 66, 0, 0, 32, 4, 0, 0, 0, 2,116, 1, 0, 0, 0, 0, 99, 0, 0, 0, 1, 0, 0, 0,176, 6,116, 1,
- 0, 0, 0, 0, 0,253,115, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 66, 99,104,
-101, 99,107,101,114,115, 46, 48, 48, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 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, 32, 2,118, 1, 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, 96, 6,116, 1,
- 0, 0, 0, 0, 52, 84,142, 55,194, 12,188,192, 28, 38, 71, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 69, 36,190, 64, 69, 36,190, 64, 68, 36,190, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,128,218, 15, 73, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 83,115,134, 64, 82,115,134, 64,
- 0, 0, 0, 0, 0, 0, 0, 0, 82,115,134,192, 83,115,134, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 68, 36,190, 64, 0, 0, 0, 0, 52, 84,142, 55,194, 12,188,192, 28, 38, 71, 64, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,179, 0, 0, 0, 0, 0, 0,128, 63,207,183,243, 61,205,183,243,189,
-160, 83,162, 37, 0, 0, 0, 0, 29, 90, 26, 50, 31, 90, 26, 50,173, 85, 44, 62, 0, 0, 0, 0,205,183,243,189,207,183,243,189,
- 24,107, 87, 50, 0, 0, 0, 0,158,176,247,190,212,108,246,190, 64,232, 97,190, 0, 0,128, 63, 14, 4, 0, 0, 0, 4, 1, 0,
- 0, 0, 68, 0, 1, 0, 2, 0, 0, 0, 0, 0, 79, 66, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
-100, 0, 0, 0, 0, 0, 0, 0, 56,180,150,201, 0, 0,128, 63, 10,215, 35, 61, 0, 0,128, 63,205,204,204, 62,205,204,204, 61,
- 0, 0, 0, 0, 4, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 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,128, 63, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 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,160, 32,105, 1,
- 0, 0, 0, 0,144,244,123, 1, 0, 0, 0, 0, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
- 8, 0, 0, 0, 96, 6,116, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 64,100,116, 1, 0, 0, 0, 0, 79, 66, 0, 0,
- 32, 4, 0, 0,176, 6,116, 1, 0, 0, 0, 0, 99, 0, 0, 0, 1, 0, 0, 0, 96, 11,116, 1, 0, 0, 0, 0, 0, 2,116, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 66, 99,104,101, 99,107,101,114,115, 46, 48,
- 48, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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,144,162,118, 1,
- 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, 16, 11,116, 1, 0, 0, 0, 0, 0,131,102, 60,
- 14,112,164, 64, 24,211,229, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-178,159, 34, 65,178,159, 34, 65,177,159, 34, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,
-166,250, 89,178, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,178,159, 34, 65,151,120, 10,180, 0, 0, 0, 0, 0, 0, 0, 0,
-151,120, 10, 52,178,159, 34, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,177,159, 34, 65, 0, 0, 0, 0,
- 0,131,102, 60, 14,112,164, 64, 24,211,229, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,231,126,201, 61,219,145,171, 48, 34, 66,201,163, 0, 0, 0, 0,
- 65,209,167,164, 51, 57,255, 49,232,126,201, 61, 0, 0, 0, 0,235, 66,172, 48,231,126,201,189, 70,201,251, 49, 0, 0, 0, 0,
- 18,136, 29,187,203,200,189,191,180,139, 9, 58, 0, 0,128, 63, 33, 0, 0, 0, 0, 0, 1, 0, 0, 0, 68, 0, 1, 0, 2, 0,
- 0, 0, 0, 0, 79, 66, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,100, 0, 0, 0, 0, 0, 0, 0,
- 56,180,150,201, 0, 0,128, 63, 10,215, 35, 61, 0, 0,128, 63,205,204,204, 62,205,204,204, 61, 0, 0, 0, 0, 4, 0, 1, 1,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 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,128, 63, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0,128, 63, 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,208, 36, 78, 1, 0, 0, 0, 0,128,105, 65, 1,
- 0, 0, 0, 0, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 8, 0, 0, 0, 16, 11,116, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,224,103,116, 1, 0, 0, 0, 0, 79, 66, 0, 0, 32, 4, 0, 0, 96, 11,116, 1,
- 0, 0, 0, 0, 99, 0, 0, 0, 1, 0, 0, 0,192, 15,116, 1, 0, 0, 0, 0,176, 6,116, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 66, 76, 97,109,112, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 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, 96,222,115, 1, 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, 42, 57,110, 65,237,114, 11, 64,120, 99,121, 64,
- 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,128, 63, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 85, 90,103, 63,254, 45,186,190,115,209,128, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0,136,247,255, 62, 37, 39, 74, 63,138, 26,182, 62, 0, 0, 0, 0,164, 21, 44,191, 28, 67,194, 61,
-176,248, 59, 63, 0, 0, 0, 0,251,203, 11, 63,217, 45, 27,191, 47, 7, 20, 63, 0, 0, 0, 0, 42, 57,110, 65,237,114, 11, 64,
-120, 99,121, 64, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63,254,255,255, 38, 0, 0, 0, 51, 0, 0, 0, 0,254,255,255, 50,254,255,127, 63,
-254,255,127, 38, 0, 0, 0, 0, 0, 0, 64,179,254,255,127, 51, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63,138,247,255, 62,164, 21, 44,191,251,203, 11, 63, 0, 0, 0, 0,141, 26,182, 62,176,248, 59, 63,
- 45, 7, 20, 63, 0, 0, 0, 0, 37, 39, 74,191, 9, 67,194,189,217, 45, 27, 63, 0, 0, 0, 0,147, 14,142,193, 35,125,234, 64,
- 85,119, 0,192, 0, 0,128, 63, 28, 4, 0, 0, 0, 20, 0, 0, 0, 0, 68, 0, 5, 0, 1, 0, 0, 0, 0, 0, 79, 66, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,100, 0, 0, 0, 0, 0, 0, 0, 56,180,150,201, 0, 0,128, 63,
- 10,215, 35, 61, 0, 0,128, 63,205,204,204, 62,205,204,204, 61, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,128, 63, 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, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 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, 79, 66, 0, 0, 32, 4, 0, 0,192, 15,116, 1, 0, 0, 0, 0, 99, 0, 0, 0,
- 1, 0, 0, 0, 32, 20,116, 1, 0, 0, 0, 0, 96, 11,116, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 79, 66, 76, 97,109,112, 46, 48, 48, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 4,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 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, 16,224,115, 1, 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, 84, 76,210,191,178,162, 71,193,210,186,178, 64, 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,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 85, 90,103, 63,254, 45,186,190,115,209,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
-136,247,255, 62, 37, 39, 74, 63,138, 26,182, 62, 0, 0, 0, 0,164, 21, 44,191, 28, 67,194, 61,176,248, 59, 63, 0, 0, 0, 0,
-251,203, 11, 63,217, 45, 27,191, 47, 7, 20, 63, 0, 0, 0, 0, 84, 76,210,191,178,162, 71,193,210,186,178, 64, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
-254,255,127, 63,251,255,255, 50,251,255, 47, 52, 0, 0, 0, 0,251,255,127,180, 1, 0,128, 63,249,255,127, 52, 0, 0, 0, 0,
-251,255,159, 52,250,255,127,179,250,255,127, 63, 0, 0, 0, 0,254,255,127,181,251,255,255,168,251,255, 47,170, 0, 0,128, 63,
-136,247,255, 62,164, 21, 44,191,251,203, 11, 63, 0, 0, 0, 0,139, 26,182, 62,173,248, 59, 63, 44, 7, 20, 63, 0, 0, 0, 0,
- 36, 39, 74,191, 17, 67,194,189,217, 45, 27, 63, 0, 0, 0, 0,191,129,189, 63,176,159,104,192,132,194, 53,192, 0, 0,128, 63,
- 28, 4, 0, 0, 0, 20, 0, 0, 0, 0, 68, 0, 5, 0, 1, 0, 0, 0, 0, 0, 79, 66, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,100, 0, 0, 0, 0, 0, 0, 0, 56,180,150,201, 0, 0,128, 63, 10,215, 35, 61, 0, 0,128, 63,
-205,204,204, 62,205,204,204, 61, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 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, 64, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 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, 79, 66, 0, 0, 32, 4, 0, 0, 32, 20,116, 1, 0, 0, 0, 0, 99, 0, 0, 0, 1, 0, 0, 0,128, 24,116, 1,
- 0, 0, 0, 0,192, 15,116, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 66, 76, 97,
-109,112, 46, 48, 48, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 10, 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,208,230,115, 1, 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,238,188, 16,193,229,119, 57,193, 17,218,141, 65, 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,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-202, 79, 15,191,179,100, 12,191,112, 92,234, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,171,197, 96,190,149, 27, 83, 63,
- 10,118, 5, 63, 0, 0, 0, 0,142,218, 99,191,109, 4, 75, 61,179, 3,232,190, 0, 0, 0, 0,233,142,204,190,104, 64, 16,191,
-174, 28, 57, 63, 0, 0, 0, 0,238,188, 16,193,229,119, 57,193, 17,218,141, 65, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 1, 0,128, 63, 1, 0,128,179,
- 2, 0,128, 51, 0, 0, 0, 0, 1, 0,160,179, 0, 0,128, 63, 0, 0, 32,180, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,128, 63, 0, 0, 0, 0, 2, 0,192,180, 3, 0,128, 51, 0, 0, 0, 54, 0, 0,128, 63,175,197, 96,190,143,218, 99,191,
-235,142,204,190, 0, 0, 0, 0, 11,118, 5, 63,179, 3,232,190,172, 28, 57, 63, 0, 0, 0, 0,150, 27, 83,191,119, 4, 75,189,
-105, 64, 16, 63, 0, 0, 0, 0,128,181, 14,193,214,177, 61,191, 29,133,128,193, 0, 0,128, 63, 28, 4, 0, 0, 0, 20, 0, 0,
- 0, 0, 68, 0, 5, 0, 1, 0, 0, 0, 0, 0, 79, 66, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
-100, 0, 0, 0, 0, 0, 0, 0, 56,180,150,201, 0, 0,128, 63, 10,215, 35, 61, 0, 0,128, 63,205,204,204, 62,205,204,204, 61,
- 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 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, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 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, 79, 66, 0, 0,
- 32, 4, 0, 0,128, 24,116, 1, 0, 0, 0, 0, 99, 0, 0, 0, 1, 0, 0, 0,224, 28,116, 1, 0, 0, 0, 0, 32, 20,116, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 66, 76, 97,109,112, 46, 48, 48, 51, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 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,192,225,115, 1,
- 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,176,147,104, 64,
- 42, 84, 23,193,116, 77,171, 64, 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,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 85, 90,103, 63,254, 45,186,190,
-115,209,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,136,247,255, 62, 37, 39, 74, 63,138, 26,182, 62, 0, 0, 0, 0,
-164, 21, 44,191, 28, 67,194, 61,176,248, 59, 63, 0, 0, 0, 0,251,203, 11, 63,217, 45, 27,191, 47, 7, 20, 63, 0, 0, 0, 0,
-176,147,104, 64, 42, 84, 23,193,116, 77,171, 64, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,254,255,127, 63, 0, 0, 0, 0,255,255,191, 51, 0, 0, 0, 0,
-255,255,127, 51, 0, 0,128, 63,255,255,127,179, 0, 0, 0, 0,254,255,127,179, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0,
-255,255,127, 52, 0, 0,160, 52, 0, 0,128, 39, 0, 0,128, 63,137,247,255, 62,165, 21, 44,191,251,203, 11, 63, 0, 0, 0, 0,
-141, 26,182, 62,176,248, 59, 63, 46, 7, 20, 63, 0, 0, 0, 0, 37, 39, 74,191, 20, 67,194,189,217, 45, 27, 63, 0, 0, 0, 0,
- 91, 99, 93,192,136, 98, 80,190,223,119,112,192, 0, 0,128, 63, 1, 0, 0, 0, 0, 16, 0, 0, 0, 0, 68, 0, 5, 0, 1, 0,
- 0, 0, 0, 0, 79, 66, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,100, 0, 0, 0, 0, 0, 0, 0,
- 56,180,150,201, 0, 0,128, 63, 10,215, 35, 61, 0, 0,128, 63,205,204,204, 62,205,204,204, 61, 0, 0, 0, 0, 4, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 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, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0,128, 63, 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, 79, 66, 0, 0, 32, 4, 0, 0,224, 28,116, 1,
- 0, 0, 0, 0, 99, 0, 0, 0, 1, 0, 0, 0, 64, 33,116, 1, 0, 0, 0, 0,128, 24,116, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 66, 76, 97,109,112, 46, 48, 48, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 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,112,227,115, 1, 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,249,147,251,192,206, 0, 24,193, 67,131,104,192,
- 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,128, 63, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 85, 90,103, 63,254, 45,186,190,115,209,128, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0,136,247,255, 62, 37, 39, 74, 63,138, 26,182, 62, 0, 0, 0, 0,164, 21, 44,191, 28, 67,194, 61,
-176,248, 59, 63, 0, 0, 0, 0,251,203, 11, 63,217, 45, 27,191, 47, 7, 20, 63, 0, 0, 0, 0,249,147,251,192,206, 0, 24,193,
- 67,131,104,192, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63,254,255,255, 50, 0, 0, 0,179, 0, 0, 0, 0, 0, 0, 0, 0,254,255,127, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 50,254,255,255, 50, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128,181,255,255,191,180,
- 1, 0,224, 52, 0, 0,128, 63,137,247,255, 62,165, 21, 44,191,251,203, 11, 63, 0, 0, 0, 0,139, 26,182, 62,176,248, 59, 63,
- 45, 7, 20, 63, 0, 0, 0, 0, 36, 39, 74,191, 19, 67,194,189,217, 45, 27, 63, 0, 0, 0, 0,147,142,176, 64, 97, 22,170,191,
- 27, 28,246, 64, 0, 0,128, 63, 1, 0, 0, 0, 0, 16, 0, 0, 0, 0, 68, 0, 5, 0, 1, 0, 0, 0, 0, 0, 79, 66, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,100, 0, 0, 0, 0, 0, 0, 0, 56,180,150,201, 0, 0,128, 63,
- 10,215, 35, 61, 0, 0,128, 63,205,204,204, 62,205,204,204, 61, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,128, 63, 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, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 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, 79, 66, 0, 0, 32, 4, 0, 0, 64, 33,116, 1, 0, 0, 0, 0, 99, 0, 0, 0,
- 1, 0, 0, 0,160, 37,116, 1, 0, 0, 0, 0,224, 28,116, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 79, 66, 76, 97,109,112, 46, 48, 48, 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 4,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 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, 32,229,115, 1, 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,142, 41, 54, 65, 24,124,115,191,162,215, 58,192, 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,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 85, 90,103, 63,254, 45,186,190,115,209,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
-136,247,255, 62, 37, 39, 74, 63,138, 26,182, 62, 0, 0, 0, 0,164, 21, 44,191, 28, 67,194, 61,176,248, 59, 63, 0, 0, 0, 0,
-251,203, 11, 63,217, 45, 27,191, 47, 7, 20, 63, 0, 0, 0, 0,142, 41, 54, 65, 24,124,115,191,162,215, 58,192, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
-136,247,255, 62,164, 21, 44,191,251,203, 11, 63, 0, 0, 0, 0,139, 26,182, 62,175,248, 59, 63, 46, 7, 20, 63, 0, 0, 0, 0,
- 36, 39, 74,191, 25, 67,194,189,217, 45, 27, 63, 0, 0, 0, 0,139,192, 49,193, 40, 99, 36, 65, 89,156,249, 63, 0, 0,128, 63,
- 2, 0, 0, 0, 0, 16, 0, 0, 0, 0, 68, 0, 5, 0, 1, 0, 0, 0, 0, 0, 79, 66, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,100, 0, 0, 0, 0, 0, 0, 0, 56,180,150,201, 0, 0,128, 63, 10,215, 35, 61, 0, 0,128, 63,
-205,204,204, 62,205,204,204, 61, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 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, 64, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 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, 79, 66, 0, 0, 32, 4, 0, 0,160, 37,116, 1, 0, 0, 0, 0, 99, 0, 0, 0, 1, 0, 0, 0, 0, 42,116, 1,
- 0, 0, 0, 0, 64, 33,116, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 66, 76, 97,
-109,112, 46, 48, 48, 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 10, 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,208,230,115, 1, 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,220,239, 19,193,215,239, 54,193, 42, 9, 60, 65, 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,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 67,251,103,191,164, 27, 24,191, 37,136, 3, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 31,143,197,190,209,184, 59, 63,
-138, 80, 15, 63, 0, 0, 0, 0, 57, 66, 64,191,132,119,210, 61,118,249, 38,191, 0, 0, 0, 0, 37, 43, 9,191, 35, 15, 44,191,
-114,212, 2, 63, 0, 0, 0, 0,220,239, 19,193,215,239, 54,193, 42, 9, 60, 65, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 31,143,197,190, 56, 66, 64,191,
- 35, 43, 9,191, 0, 0, 0, 0,139, 80, 15, 63,117,249, 38,191,112,212, 2, 63, 0, 0, 0, 0,208,184, 59,191,142,119,210,189,
- 35, 15, 44, 63, 0, 0, 0, 0,195,135, 0,193,127,252,148,190, 8,180, 48,193, 0, 0,128, 63, 2, 0, 0, 0, 0, 16, 0, 0,
- 0, 0, 68, 0, 5, 0, 1, 0, 0, 0, 0, 0, 79, 66, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
-100, 0, 0, 0, 0, 0, 0, 0, 56,180,150,201, 0, 0,128, 63, 10,215, 35, 61, 0, 0,128, 63,205,204,204, 62,205,204,204, 61,
- 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 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, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 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, 79, 66, 0, 0,
- 32, 4, 0, 0, 0, 42,116, 1, 0, 0, 0, 0, 99, 0, 0, 0, 1, 0, 0, 0, 96, 46,116, 1, 0, 0, 0, 0,160, 37,116, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 66, 76, 97,109,112, 46, 48, 48, 55, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 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,128,232,115, 1,
- 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,104, 99,164,192,
-239,244, 51,193,188,110, 19, 64, 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,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 85, 90,103, 63,254, 45,186,190,
-115,209,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,136,247,255, 62, 37, 39, 74, 63,138, 26,182, 62, 0, 0, 0, 0,
-164, 21, 44,191, 28, 67,194, 61,176,248, 59, 63, 0, 0, 0, 0,251,203, 11, 63,217, 45, 27,191, 47, 7, 20, 63, 0, 0, 0, 0,
-104, 99,164,192,239,244, 51,193,188,110, 19, 64, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,137,247,255, 62,165, 21, 44,191,251,203, 11, 63, 0, 0, 0, 0,
-139, 26,182, 62,178,248, 59, 63, 45, 7, 20, 63, 0, 0, 0, 0, 36, 39, 74,191, 18, 67,194,189,217, 45, 27, 63, 0, 0, 0, 0,
- 96, 24, 91, 64,226, 50,108,192,101, 9,219, 63, 0, 0,128, 63, 2, 0, 0, 0, 0, 16, 0, 0, 0, 0, 68, 0, 5, 0, 1, 0,
- 0, 0, 0, 0, 79, 66, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,100, 0, 0, 0, 0, 0, 0, 0,
- 56,180,150,201, 0, 0,128, 63, 10,215, 35, 61, 0, 0,128, 63,205,204,204, 62,205,204,204, 61, 0, 0, 0, 0, 4, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 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, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0,128, 63, 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, 79, 66, 0, 0, 32, 4, 0, 0, 96, 46,116, 1,
- 0, 0, 0, 0, 99, 0, 0, 0, 1, 0, 0, 0,192, 50,116, 1, 0, 0, 0, 0, 0, 42,116, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 66, 76, 97,109,112, 46, 48, 48, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 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, 48,234,115, 1, 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,145, 75,188, 63, 44,197,107,193, 5,147, 81, 64,
- 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,128, 63, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,218, 15,201, 63, 0, 0,128, 37,255,255,127, 37, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,255,255,127, 37, 0, 0,128,165, 0, 0, 0, 0,255,255,127, 37,105, 33,162, 51,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 37, 0, 0,128,191,105, 33,162, 51, 0, 0, 0, 0,145, 75,188, 63, 44,197,107,193,
- 5,147, 81, 64, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 45, 25, 23,178,107,199, 75,179, 0, 0, 0, 0, 0,127,236,153, 0, 0,128, 63,
- 0, 0, 0, 40, 0, 0, 0, 0, 0,127,108,177,206, 9, 29, 50, 0, 0,128, 63, 0, 0, 0, 0, 32,159,189,191, 47,164,188,191,
-150,188,153,192, 0, 0,128, 63, 32, 0, 0, 0, 0, 16, 0, 0, 0, 0, 68, 0, 5, 0, 1, 0, 0, 0, 0, 0, 79, 66, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,100, 0, 0, 0, 0, 0, 0, 0, 56,180,150,201, 0, 0,128, 63,
- 10,215, 35, 61, 0, 0,128, 63,205,204,204, 62,205,204,204, 61, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,128, 63, 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,128, 63, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 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, 79, 66, 0, 0, 32, 4, 0, 0,192, 50,116, 1, 0, 0, 0, 0, 99, 0, 0, 0,
- 1, 0, 0, 0,112, 55,116, 1, 0, 0, 0, 0, 96, 46,116, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 79, 66, 99,104,101, 99,107,101,114,115, 0, 0,108, 97,110,101, 46, 48, 48, 51, 0, 0, 0, 0, 1, 0, 0, 4,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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,144,178,118, 1, 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, 32, 55,116, 1, 0, 0, 0, 0, 0,131,102, 60, 14,112,164, 64, 24,211,229, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,178,159, 34, 65,178,159, 34, 65,177,159, 34, 65, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,166,250, 89,178, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
-178,159, 34, 65,151,120, 10,180, 0, 0, 0, 0, 0, 0, 0, 0,151,120, 10, 52,178,159, 34, 65, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,177,159, 34, 65, 0, 0, 0, 0, 0,131,102, 60, 14,112,164, 64, 24,211,229, 63, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
-231,126,201, 61,219,145,171, 48, 34, 66,201,163, 0, 0, 0, 0, 65,209,167,164, 51, 57,255, 49,232,126,201, 61, 0, 0, 0, 0,
-235, 66,172, 48,231,126,201,189, 70,201,251, 49, 0, 0, 0, 0, 18,136, 29,187,203,200,189,191,180,139, 9, 58, 0, 0,128, 63,
- 33, 0, 0, 0, 0, 0, 1, 0, 0, 0, 68, 0, 1, 0, 2, 0, 0, 0, 0, 0, 79, 66, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,100, 0, 0, 0, 0, 0, 0, 0, 56,180,150,201, 0, 0,128, 63, 10,215, 35, 61, 0, 0,128, 63,
-205,204,204, 62,205,204,204, 61, 0, 0, 0, 0, 4, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 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,128, 63, 0, 64, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 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, 64, 70, 88, 1, 0, 0, 0, 0,128,224,117, 1, 0, 0, 0, 0, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 68, 65, 84, 65, 8, 0, 0, 0, 32, 55,116, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 64,100,116, 1,
- 0, 0, 0, 0, 79, 66, 0, 0, 32, 4, 0, 0,112, 55,116, 1, 0, 0, 0, 0, 99, 0, 0, 0, 1, 0, 0, 0, 32, 60,116, 1,
- 0, 0, 0, 0,192, 50,116, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 66,112,114,
-101,118,105,101,119, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 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,192, 66,122, 1, 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,208, 59,116, 1,
- 0, 0, 0, 0,100, 82, 7,189, 21,204,103,191,241,165,230, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,153, 39,155, 64,153, 39,155, 64,153, 39,155, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-218, 15,201, 63, 0, 0,192, 37,255,255,255, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,153, 39,155, 64,152, 39, 27, 38,
-102,187,232,166, 0, 0, 0, 0,102,187,232, 38,157,134,196, 52,153, 39,155, 64, 0, 0, 0, 0,154, 39, 27, 38,153, 39,155,192,
-157,134,196, 52, 0, 0, 0, 0,100, 82, 7,189, 21,204,103,191,241,165,230, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0,
- 32,222,204,151, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,120,200,204, 24, 0, 0, 0, 0,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,179, 0, 0, 0, 0, 0, 0,128, 63, 25, 50, 83, 62, 28, 50,211, 35,
- 23, 50,211,163, 0, 0, 0, 0, 27, 50,211,163, 25, 50, 83, 62,158, 59,174, 38, 0, 0, 0, 0, 0, 94,204,173,158, 79, 96,175,
- 25, 50, 83, 62, 0, 0, 0, 0,135, 62,153, 59,217, 94,110,185,118, 71,238, 63, 0, 0,128, 63, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 68, 0, 1, 0, 2, 0, 0, 0, 0, 0, 79, 66, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
-100, 0, 0, 0, 0, 0, 0, 0, 56,180,150,201, 0, 0,128, 63, 10,215, 35, 61, 0, 0,128, 63,205,204,204, 62,205,204,204, 61,
- 0, 0, 0, 0, 4, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 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,128, 63, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 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,112,233,117, 1,
- 0, 0, 0, 0,240,240,117, 1, 0, 0, 0, 0, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
- 8, 0, 0, 0,208, 59,116, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 66, 0, 0,
- 32, 4, 0, 0, 32, 60,116, 1, 0, 0, 0, 0, 99, 0, 0, 0, 1, 0, 0, 0,112, 65,116, 1, 0, 0, 0, 0,112, 55,116, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 66,112,114,101,118,105,101,119, 46, 48, 48,
- 50, 0, 46, 48, 48, 49, 0, 0, 0, 0, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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, 96,130,116, 1,
- 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,128, 64,116, 1, 0, 0, 0, 0,128, 64,116, 1, 0, 0, 0, 0, 32, 65,116, 1, 0, 0, 0, 0,242,187,213,191,
-194,145,134, 63,254,100, 35, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-243, 0, 28, 65,246, 0, 28, 65,243, 0, 28, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48,110,135, 63,180,169, 59, 62,
-138,115, 1,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,198, 49, 6, 65,115,154,148,192, 3,113,227,191, 0, 0, 0, 0,
-159,250,106, 64,189,207, 91, 64, 80,170, 5, 65, 0, 0, 0, 0, 46,151, 86,192,125, 94,251,192,188,127,150, 64, 0, 0, 0, 0,
-242,187,213,191,194,145,134, 63,254,100, 35, 64, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,143,174,180, 61,160, 48, 30, 61,223,118, 16,189, 0, 0, 0, 0,
-162, 29,153,188, 38,248,179, 61,115,162, 74, 61, 0, 0, 0, 0, 15, 21, 72, 61,160,250, 19,189, 88, 57,169, 61, 0, 0, 0, 0,
- 4,107, 50, 63, 88, 46,204,190,177,206, 79, 63, 0, 0,128, 63, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 0, 1, 0, 2, 0,
- 0, 0, 0, 0, 79, 66, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,100, 0, 0, 0, 0, 0, 0, 0,
- 56,180,150,201, 0, 0,128, 63, 10,215, 35, 61, 0, 0,128, 63,205,204,204, 62,205,204,204, 61, 0, 0, 0, 0, 4, 0, 1, 1,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 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,128, 63, 0, 64, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0,128, 63, 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, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 8, 0, 0, 0, 32, 65,116, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 88, 0, 0, 0,128, 64,116, 1,
- 0, 0, 0, 0, 73, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 31, 0, 0, 0, 83,117, 98,115,117,114,102, 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, 0, 1, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 79, 66, 0, 0, 32, 4, 0, 0,112, 65,116, 1, 0, 0, 0, 0, 99, 0, 0, 0, 1, 0, 0, 0, 32, 70,116, 1,
- 0, 0, 0, 0, 32, 60,116, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 66,112,114,
-101,118,105,101,119, 46, 48, 48, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 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,128,202,118, 1, 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,208, 69,116, 1,
- 0, 0, 0, 0, 16,194,203,187,155, 89, 45, 63,244,153,230, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 56,135, 72, 63, 56,135, 72, 63, 56,135, 72, 63, 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,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 56,135, 72, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56,135, 72, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 56,135, 72, 63, 0, 0, 0, 0, 16,194,203,187,155, 89, 45, 63,244,153,230, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,144,104,163, 63,143,104,163, 37,
-143,104,163,165, 0, 0, 0, 0, 66,104,165, 37,252,250,206, 51,144,104,163, 63, 0, 0, 0, 0, 60,240,202,173,144,104,163,191,
-183, 63,204, 51, 0, 0, 0, 0,105, 93,173,187,172,176, 88,193, 95, 52,118,186, 0, 0,128, 63, 2, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 68, 0, 1, 0, 2, 0, 0, 0, 0, 0, 79, 66, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
-100, 0, 0, 0, 0, 0, 0, 0, 56,180,150,201, 0, 0,128, 63, 10,215, 35, 61, 0, 0,128, 63,205,204,204, 62,205,204,204, 61,
- 0, 0, 0, 0, 4, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 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,128, 63, 0, 64, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 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, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
- 8, 0, 0, 0,208, 69,116, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 66, 0, 0,
- 32, 4, 0, 0, 32, 70,116, 1, 0, 0, 0, 0, 99, 0, 0, 0, 1, 0, 0, 0,208, 74,116, 1, 0, 0, 0, 0,112, 65,116, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 66,112,114,101,118,105,101,119, 46, 48, 48,
- 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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,128,202,118, 1,
- 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,128, 74,116, 1, 0, 0, 0, 0, 0, 31, 10, 58,
- 59, 94,236, 63,236, 84,231, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 91,188,110, 63, 91,188,110, 63, 91,188,110, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,218, 15,201, 63, 0, 0, 0,128,
- 0, 0, 0,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 91,188,110, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 90, 50,151, 51, 91,188,110, 63, 0, 0, 0, 0, 0, 0, 0, 0, 91,188,110,191, 90, 50,151, 51, 0, 0, 0, 0,
- 0, 31, 10, 58, 59, 94,236, 63,236, 84,231, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,160, 65,137, 63,159, 65,137,165,161, 65,137,165, 0, 0, 0, 0,
-160, 65,137, 37,160, 65,137, 63,157, 46, 19, 40, 0, 0, 0, 0,248,127, 14, 45,159,195,150,176,161, 65,137, 63, 0, 0, 0, 0,
- 29, 80, 63,188, 62, 95,226,187, 87, 19, 74, 65, 0, 0,128, 63, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 0, 1, 0, 2, 0,
- 0, 0, 0, 0, 79, 66, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,100, 0, 0, 0, 0, 0, 0, 0,
- 56,180,150,201, 0, 0,128, 63, 10,215, 35, 61, 0, 0,128, 63,205,204,204, 62,205,204,204, 61, 0, 0, 0, 0, 4, 0, 1, 1,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 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,128, 63, 0, 64, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0,128, 63, 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, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 8, 0, 0, 0,128, 74,116, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 66, 0, 0, 32, 4, 0, 0,208, 74,116, 1,
- 0, 0, 0, 0, 99, 0, 0, 0, 1, 0, 0, 0, 48, 79,116, 1, 0, 0, 0, 0, 32, 70,116, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 66,112,114,101,118,105,101,119, 46, 48, 48, 53, 0, 48, 48, 51, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 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,176,220,115, 1, 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,128,155,195,189, 20,145,188, 64, 94,220, 88, 65,
- 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,128, 63, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,221,180,134, 63, 48,190,141, 37,253, 55, 57, 35, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,253, 55, 57, 35, 48,190,141,165, 0, 0, 0, 0,219,128,112, 37, 52,177,253, 62,
- 94, 93, 94, 63, 0, 0, 0, 0, 52,133, 22, 37, 94, 93, 94,191, 52,177,253, 62, 0, 0, 0, 0,128,155,195,189, 20,145,188, 64,
- 94,220, 88, 65, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 23,252, 16, 37,196,176, 70,165, 0, 0, 0, 0, 80, 90,231,174, 94, 93, 94, 63,
- 52,177,253, 62, 0, 0, 0, 0, 0, 68,239,172, 50,177,253,190, 95, 93, 94, 63, 0, 0, 0, 0,150, 98,174, 61, 85,101,144,193,
-196,124,253, 64, 0, 0,128, 63, 64, 0, 0, 0, 0, 16, 0, 0, 0, 0, 68, 0, 5, 0, 1, 0, 0, 0, 0, 0, 79, 66, 0, 0,
- 7, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,100, 0, 0, 0, 0, 0, 0, 0, 56,180,150,201, 0, 0,128, 63,
- 10,215, 35, 61, 0, 0,128, 63,205,204,204, 62,205,204,204, 61, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,128, 63, 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,128, 63, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 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, 79, 66, 0, 0, 32, 4, 0, 0, 48, 79,116, 1, 0, 0, 0, 0, 99, 0, 0, 0,
- 1, 0, 0, 0,224, 83,116, 1, 0, 0, 0, 0,208, 74,116, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 79, 66,112,114,101,118,105,101,119, 46, 48, 48, 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 4,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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, 64, 85,122, 1, 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,144, 83,116, 1, 0, 0, 0, 0, 94, 52,252,190,174,101,228, 65,141,116, 17, 65, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,235,239, 30, 66,236,239, 30, 66,235,239, 30, 66, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,138,174, 95, 63, 98,132,123, 37, 61, 56, 87,165, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
-235,239, 30, 66,105,158, 5,168,108, 39, 28,168, 0, 0, 0, 0,212,129, 77, 40, 66, 15,204, 65,158,186,243, 65, 0, 0, 0, 0,
- 55, 89, 13,165,156,186,243,193, 65, 15,204, 65, 0, 0, 0, 0, 94, 52,252,190,174,101,228, 65,141,116, 17, 65, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
-101, 43,206, 60,143,217,240, 34,201,165, 18,163, 0, 0, 0, 0,226, 14,231, 31,101, 20,158, 60,193, 89,132, 60, 0, 0, 0, 0,
-190, 83,173, 34,192, 89,132,188,103, 20,158, 60, 0, 0, 0, 0, 11,215, 70, 60, 61, 43, 67,191,185,241, 31, 63, 0, 0,128, 63,
- 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 0, 1, 0, 2, 0, 0, 0, 0, 0, 79, 66, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,100, 0, 0, 0, 0, 0, 0, 0, 56,180,150,201, 0, 0,128, 63, 10,215, 35, 61, 0, 0,128, 63,
-205,204,204, 62,205,204,204, 61, 0, 0, 0, 0, 4, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 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,128, 63, 0, 64, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 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, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 68, 65, 84, 65, 8, 0, 0, 0,144, 83,116, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 79, 66, 0, 0, 32, 4, 0, 0,224, 83,116, 1, 0, 0, 0, 0, 99, 0, 0, 0, 1, 0, 0, 0,144, 88,116, 1,
- 0, 0, 0, 0, 48, 79,116, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 66,112,114,
-101,118,105,101,119, 99,117, 98,101, 0,117, 98,101, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 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,112, 94,122, 1, 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, 64, 88,116, 1,
- 0, 0, 0, 0,128,253, 88, 59,220,118,160, 63, 0, 15, 37, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 84, 88, 68, 64, 84, 88, 68, 64, 83, 88, 68, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1,190,237, 62,108,230,217,190, 20,151, 52, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 67, 38, 8, 64,191,228,231, 63,
-186, 31,162, 63, 0, 0, 0, 0, 35,118, 13,192, 2, 61,220, 63, 31, 44,160, 63, 0, 0, 0, 0,166, 52,234, 60,102,223,227,191,
- 55,229, 31, 64, 0, 0, 0, 0,128,253, 88, 59,220,118,160, 63, 0, 15, 37, 64, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 10,115,103, 62,201,122,112,190,
-255, 17, 71, 59, 0, 0, 0, 0,116,205, 9, 62,205, 36, 8, 62,136,232,135, 62, 0, 0, 0, 0, 1, 27, 69,190,224, 50, 59,190,
- 25,176, 65, 62, 0, 0, 0, 0,110,176, 16,192,158, 71, 9,192,115, 90,244, 63, 0, 0,128, 63, 4, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 68, 0, 1, 0, 2, 0, 0, 0, 0, 0, 79, 66, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
-100, 0, 0, 0, 0, 0, 0, 0, 56,180,150,201, 0, 0,128, 63, 10,215, 35, 61, 0, 0,128, 63,205,204,204, 62,205,204,204, 61,
- 0, 0, 0, 0, 4, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 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,128, 63, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 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, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
- 8, 0, 0, 0, 64, 88,116, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 66, 0, 0,
- 32, 4, 0, 0,144, 88,116, 1, 0, 0, 0, 0, 99, 0, 0, 0, 1, 0, 0, 0,144, 95,116, 1, 0, 0, 0, 0,224, 83,116, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 66,112,114,101,118,105,101,119,104, 97,105,
-114, 0,108, 97,110,101, 0, 0, 0, 0, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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,144,194,118, 1,
- 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,224,223,117, 1, 0, 0, 0, 0,224,223,117, 1, 0, 0, 0, 0, 64, 95,116, 1, 0, 0, 0, 0, 86, 92,200, 63,
- 7,205,227, 63,149,199, 9,189, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-234,126, 47, 64,234,126, 47, 64,236,126, 47, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,225, 80, 2, 63, 5,211, 15,191,
- 92,219, 18, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,224,254, 18, 64, 23,209,169, 62, 27,251,186, 63, 0, 0, 0, 0,
- 71,254,133,191,207, 40, 17, 64,229,194,144, 63, 0, 0, 0, 0, 78, 38,137,191, 48,162,192,191,125,176, 1, 64, 0, 0, 0, 0,
- 86, 92,200, 63, 7,205,227, 63,149,199, 9,189, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 2, 0, 64,179, 0, 0,128,179, 0, 0, 0, 0,
- 2, 0, 64, 51, 1, 0,128, 63, 2, 0, 64,167, 0, 0, 0, 0, 0, 0,192,179, 0, 0, 0,179, 0, 0,128, 63, 0, 0, 0, 0,
-255,255,127,179, 2, 0,192,179, 0, 0, 0,180, 0, 0,128, 63,244,100,156, 62,135,143, 14,190, 52,235, 17,190, 0, 0, 0, 0,
-175,239, 70, 62,102, 4, 26, 62, 72,251,137, 62, 0, 0, 0, 0,174,172, 52,189,211,112,154,190, 67,243, 76, 62, 0, 0, 0, 0,
-149, 56, 36,191,139, 98, 66,192,168, 5, 68, 64, 0, 0,128, 63, 0, 4, 0, 0, 1, 4, 0, 0, 0, 0, 68, 0, 1, 0, 2, 0,
- 0, 0, 0, 0, 79, 66, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,100, 0, 0, 0, 0, 0, 0, 0,
- 56,180,150,201, 0, 0,128, 63, 10,215, 35, 61, 0, 0,128, 63,205,204,204, 62,205,204,204, 61, 0, 0, 0, 0, 4, 0, 1, 1,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 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,128, 63, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0,128, 63, 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,220,117, 1, 0, 0, 0, 0, 0,220,117, 1,
- 0, 0, 0, 0,128, 94,116, 1, 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, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 8, 0, 0, 0, 64, 95,116, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,120, 0, 0, 0,128, 94,116, 1,
- 0, 0, 0, 0,101, 0, 0, 0, 1, 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,205,204,204, 61,205,204, 76, 62, 10,215,163, 60, 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, 68, 65, 84, 65,104, 1, 0, 0, 0,220,117, 1, 0, 0, 0, 0, 12, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,176,221,117, 1, 0, 0, 0, 0,240, 21,124, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96,193,114, 1, 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,244,100,156, 62,
-135,143, 14,190, 52,235, 17,190, 0, 0, 0, 0,175,239, 70, 62,102, 4, 26, 62, 72,251,137, 62, 0, 0, 0, 0,174,172, 52,189,
-211,112,154,190, 67,243, 76, 62, 0, 0, 0, 0,149, 56, 36,191,139, 98, 66,192,168, 5, 68, 64, 0, 0,128, 63, 0, 0, 0, 64,
- 0, 0, 0, 0, 17, 2, 0, 0,150, 0, 0, 0, 0, 0, 0, 0,150, 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, 68, 65, 84, 65,224,121, 0, 0,240, 21,124, 1, 0, 0, 0, 0, 10, 1, 0, 0,150, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 21,135, 17,192, 32,121, 97,192,108, 32,141, 63,190, 81, 55,191,107,243, 71,191, 98,237, 42, 63,234,163,214, 62,
-198,206,183,190,203,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 80, 96,114, 1,
- 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, 78, 96, 32, 63,
-185,201,160, 62,160, 3, 6, 63, 11, 34,248,190,192, 53,185, 60,192,197,178, 61,174,184, 53, 63,224,172,162,190,108,136,224, 62,
-142,173, 61,191,181, 96, 10, 60,201,196,163, 61, 78,182, 99, 63,165,242,180, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,248,112,150, 62, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,109, 46, 7,192,144, 26, 60,192, 25,147,207, 63,
-190, 81, 55,191,109,243, 71,191, 98,237, 42, 63,234,163,214, 62,201,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 32, 19,124, 1, 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, 6,121,229,190,108, 50, 41,191,136,152, 7,191,155,100,146,190,146,141, 25,191,
- 40, 92,142, 62,212,104, 18, 63,228,105,105,190,112,156, 96, 62,137,226, 69,191,146,247, 17, 61, 49,172, 44, 62, 17,125, 54, 63,
- 69,195,169, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,144, 63,245, 62,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,224,103,174,189, 59, 88, 17,192,230, 35, 76, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,233,163,214, 62,
-201,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,176,101,114, 1,
- 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,102,160,155, 62,
- 58, 87,152, 62,118,199, 84,191, 84, 89,183, 62,120,103,231, 62,112, 47,177,189,156, 8, 4,191,100, 60,199, 62,200, 40,177,189,
- 0, 14, 46, 62,101, 96, 39, 62,100,119,242, 61,188,168,146, 62, 55, 9,221, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,135, 36, 87, 61, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 76,102,131,192,184,241, 26, 63,143,198, 76, 64,
-190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,128,127, 92, 1, 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, 49, 80, 39, 63,171, 26,218,190, 88,118, 16, 63,131, 72,138,190,168,255,122,190,
-185,111, 14,191, 22,207, 38, 63, 80,252,211, 61,198,177, 80,191, 40,154,203,189,226,146, 53, 61, 63,180,115, 63,246,113, 42, 59,
-153, 63,144, 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,175, 95,142, 62,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 32, 43,226,189,254, 85,220,191,226,104,101, 64,190, 81, 55,191,107,243, 71,191,102,237, 42, 63,233,163,214, 62,
-202,206,183,190,201,137, 61,190,157, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,208,220,114, 1,
- 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,119, 97, 45, 63,
-120, 47,205,190, 35,117, 19, 63,168,125, 98, 62,240,195, 73, 62,124,228,243, 62,120, 86, 11, 63, 72,156, 89, 62,230,232, 88, 63,
-130, 53,204,190,248,120,128, 62, 17,194, 20, 62, 61, 15, 90, 62, 94, 30,200, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 53,129,253, 62, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,108,159,129,191, 4,210, 6, 63, 35,221,152, 64,
-190, 81, 55,191,107,243, 71,191,102,237, 42, 63,233,163,214, 62,202,206,183,190,201,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0,219,135, 1, 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, 43,167,210,190,195,172,139, 62,250,220, 35, 63, 30,182, 22,191,128, 3,136, 61,
-110,164,176,190, 30,153,147,190, 0,249, 10,188,234, 90,160,190, 90,241,205,190,148,235, 25, 63,206,172,146, 62,143,195, 52, 61,
-104,142,139, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 37,227, 77, 62,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,114,167,189,191,212, 59,104,192,184,179,184, 63,190, 81, 55,191,107,243, 71,191,100,237, 42, 63,233,163,214, 62,
-200,206,183,190,204,137, 61,190,157, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 80, 0,105, 1,
- 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, 53, 45,121, 62,
-121,126, 98, 63, 56,171,135,189,139,174,200,190,220,142, 21, 63, 77, 70, 40,191,116, 70,150, 62, 0,245, 92, 61,160,118,174,190,
-176,217, 49, 63,120,167,104, 60,164,104,235, 60,217,251, 73, 63, 12, 25, 44, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,217, 2,247, 62, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 86,112, 30, 63,112, 69, 82,192, 58,191, 51, 64,
-190, 81, 55,191,109,243, 71,191, 98,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,224, 45,122, 1, 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, 49,227,137,190,206,195, 71,191, 70, 31, 96,190,127, 46, 5, 63, 96, 51,214,189,
-228, 61, 67,191,136, 90, 2, 62,120,214,146,190, 32,111, 33, 62,136,229,187,190, 28,112,241, 60, 3,187,177, 60, 6,134,171, 62,
-164, 35, 29, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,130,192, 56, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,116,148,176,191,100,200, 1, 63, 89, 48,146, 64,190, 81, 55,191,107,243, 71,191,102,237, 42, 63,233,163,214, 62,
-202,206,183,190,201,137, 61,190,157, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 16,144,124, 1,
- 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, 43,169, 82,190,
-102,214, 57, 63, 55,112, 36,191, 61,205, 9, 62,184,139, 5, 63,104, 32, 43,190,120, 62, 37,191,220,215, 15, 63,180, 2, 8, 63,
-196,170,163, 62,159,178, 8, 63,184,164,184, 62, 70, 72, 63, 61, 17,104,112, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 97,249,192, 62, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,198, 80,168,191, 7,154,165,191,229,248, 80, 64,
-190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 48,145,124, 1, 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, 56,145, 5,191, 84, 77,126, 62, 14,133, 63,191,190, 5,167, 62,124,212, 96,190,
-232,136,176, 62, 32,193, 80,189,144, 49, 18, 62,224, 40, 25, 62, 59,204, 10,191,177, 46,104, 62, 36,106,150, 62, 1, 61,138, 62,
- 4,131, 86, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 39, 27, 19, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,224,189,246,189,236,129, 90,192,226,155, 20, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,
-202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,112,111,105, 1,
- 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, 31, 77, 14,191,
-232, 81,154, 62, 41,220, 22,191,104,189, 0,191,214,167,160,190,140, 60, 22,190, 38, 85, 74, 63, 32,253, 8,191, 96,146, 23, 61,
-196, 30,177,190, 80, 25,187, 60,206,244,194, 60, 50,234,253, 62,235, 52,234, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,218, 21, 79, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,144,231, 67,190,176,104, 11,189,211,111,153, 64,
-190, 81, 55,191,106,243, 71,191,102,237, 42, 63,233,163,214, 62,201,206,183,190,202,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,144,112,105, 1, 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, 74,110,205, 62,147,226, 27,191, 69, 95,219, 61, 76, 3, 45, 63,222,109,147,190,
-152,196, 40, 63, 36,136,116,190,180, 21,190,190,210, 38,213,190,112,230,183, 62,207,217, 24, 63, 57,222, 25, 62,255, 49,134, 61,
-140,161, 63, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,180, 67,127, 62,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 58,217,158, 63,120,225, 17,192,212,158,120, 64,190, 81, 55,191,106,243, 71,191,102,237, 42, 63,233,163,214, 62,
-201,206,183,190,202,137, 61,190,157, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,160,161,114, 1,
- 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,175, 95, 22, 63,
-171, 95,210,190,114, 70, 46,191, 69, 71, 26, 62,192,164,234, 61,121,120, 78,191,192,229,108,188,144,225, 72,190,196,218, 42,190,
- 83,104,114,191, 26,213, 73, 62,213,230, 49, 61,216,117,187, 61,145,253, 42, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,226,144, 95, 62, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23,205,127,191,229,116,142,191,114, 64,100, 64,
-190, 81, 55,191,109,243, 71,191, 98,237, 42, 63,234,163,214, 62,201,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,192,162,114, 1, 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,193, 25,132,189, 67,167, 41,191,248,145,174,190,170,227, 41, 63, 80,208, 94, 62,
- 98, 21, 50, 63,138,162, 46,191,136, 53, 56,191, 8, 44,160, 62, 14, 42,188,190,111,124,145, 62, 46, 84,135, 62, 93, 56, 95, 62,
-104, 38,111, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,183,116, 87, 62,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,142,106, 67,192,223, 1,236, 62,229,139,105, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,
-202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,192,145,114, 1,
- 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, 59, 62, 72, 62,
-146,226,176, 62, 67,185, 48,191, 0,216, 26,191, 0,159,254,187, 90,238,201,190,100,166, 39, 63,102,238, 3,191,208,229, 10, 62,
-164, 53,230, 62, 35,227,100, 62,229, 38, 54, 63, 91, 4, 43, 61,170, 1,190, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,213, 26,126, 61, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,110, 63, 58,191,238, 44,102,191,240,155,119, 64,
-190, 81, 55,191,107,243, 71,191,102,237, 42, 63,233,163,214, 62,202,206,183,190,201,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,224,146,114, 1, 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,202,238,131, 61, 49, 99, 58,191, 62,180, 26, 63,201, 92,162,190,112,254,209, 62,
-150, 67, 12, 63, 80,138,197, 62,198,116, 72,191,118,129,182,190,184,137, 76, 62,232,134,178, 62, 21,134,113, 62,234,242, 46, 62,
- 45,121,122, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,248, 12,169, 62,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,236,173,175, 62,216,194,141, 61, 0,239,164, 64,190, 81, 55,191,107,243, 71,191,102,237, 42, 63,233,163,214, 62,
-202,206,183,190,201,137, 61,190,157, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0,148,114, 1,
- 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,213, 38, 28, 63,
- 74,248,166, 60,227,199, 67,191,127,123, 83,190,122,119,224,190, 72, 46,149, 62,136, 43, 62, 62, 32,175,199, 62, 98,224, 2, 63,
-180,198,250, 62,209, 97, 48, 63, 39,134,130, 61,168, 53, 8, 61, 57, 40, 91, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 93,115,157, 62, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,131,188, 36,192, 82,192, 42,192, 16, 24,202, 63,
-190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 16, 45,105, 1, 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, 8,121, 82,190,233,142,216,190, 95,156, 83,191,222, 73,158, 62,170,207, 3, 63,
- 64, 41, 39,191, 4,164,147, 62, 36,187, 38,191, 0, 1,218, 62,145,119, 32,191,146,242,154, 60, 19,165,130, 62,128,236, 49, 63,
- 79, 44,253, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 13,194,130, 62,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,183,117, 51, 63, 38,247, 44,192, 85, 59, 82, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,
-202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 48, 46,105, 1,
- 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,221,175, 71, 59,
-214, 55, 18,191, 64, 82,223,190,142, 2, 50, 63,240, 17,202, 61, 52,118,199, 62,128,125, 72, 63, 86,250, 36,191, 64, 99, 90, 61,
-124, 38, 25, 63,229, 50,227, 61, 58,152,110, 61,163, 58,104, 62,119,161, 26, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 21, 69, 35, 62, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22,218, 44,192,101,112,159,190, 70,196, 80, 64,
-190, 81, 55,191,107,243, 71,191,100,237, 42, 63,233,163,214, 62,200,206,183,190,204,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 80, 47,105, 1, 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, 62, 65, 39,191,175,203,203,190, 23, 58, 8,191,133,178,185,190, 48,133, 27, 63,
-166,150, 35, 63,192,164,174,189,144, 20,209,189,124, 43, 3,191,220,188, 54, 63, 27,126, 53, 62, 93,113, 22, 63, 28,104, 42, 62,
-169,168,140, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 90,122,222, 62,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,218,253, 61,191,188,216, 43,190,219,239,140, 64,190, 81, 55,191,107,243, 71,191,102,237, 42, 63,233,163,214, 62,
-202,206,183,190,201,137, 61,190,157, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,192,216,114, 1,
- 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, 59, 62,251,190,
-156,207,132, 62,191,198, 19,191,122, 82, 25,191,178,114,169,190,242, 80, 46,191,160, 92,100,189,124,103,188, 62, 0,234, 23,191,
- 12,140, 22, 63, 23, 36,252, 62,188,130,121, 62,100,245,198, 61,101,186, 42, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 62,205, 89, 62, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,194,168,212,191, 48,175, 30,192, 93,228, 12, 64,
-190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,224,217,114, 1, 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,244,136, 6, 62,240,135, 58,191, 94,198,233, 61, 57,148, 41, 63,152,188,189,190,
-156, 72,189,190,184, 14, 86, 63,186, 54,165,190,128,220, 49, 62, 64, 87,189,189,118,198,167, 61, 93,200, 80, 62,158,210, 10, 63,
-240, 9, 48, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,186,132,181, 61,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,114,184,238,190,239,206,230,191,208,122, 85, 64,190, 81, 55,191,109,243, 71,191, 98,237, 42, 63,234,163,214, 62,
-201,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0,219,114, 1,
- 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,129,165, 30, 63,
-159, 50,249,190,187,213, 86,189,178, 10, 29,191,227,247, 49,191,208,139, 7,189,224,249,154,189,152, 77, 23,191,160, 58, 14, 63,
- 64, 47, 15, 61,135,132, 94, 62,167,190, 48, 62,203, 41,136, 62,156, 52,176, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 38,177,233, 62, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 19,104, 63,177,122,254,191,116, 37,123, 64,
-190, 81, 55,191,109,243, 71,191,102,237, 42, 63,236,163,214, 62,200,206,183,190,203,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 64,235,104, 1, 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, 68,231,181, 62, 36, 19, 51, 63,126, 5, 6,191,231, 27,170,190,128,253, 35,189,
-184, 11,151,189, 76,171,178, 62,128,231, 49, 63,204,146,128, 62, 88,100, 17, 62,198,245,124, 62, 33,108,130, 61,205,152,229, 61,
-240,193, 19, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 56,156, 79, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,172,106,191, 63,110,225, 42,192, 6,170,110, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,
-202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 96,236,104, 1,
- 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, 49,227, 27,191,
- 17, 83, 26, 63, 27,229, 2,191, 86, 48,135, 61,200,244,134, 62, 56, 37,151,190,208,195,237,189,248, 39, 17, 63,160, 1, 76, 61,
- 76,194, 79,191,241, 99,249, 61,190, 88,249, 60,171, 20,183, 61, 38, 38, 66, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,150, 40,178, 62, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,119, 3, 12,192, 71, 11,252,190,144,136, 89, 64,
-190, 81, 55,191,109,243, 71,191, 98,237, 42, 63,234,163,214, 62,201,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,128,237,104, 1, 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,105, 59, 20,191, 31, 36, 17, 63,112, 57,252,190, 32,101,162, 62,140, 6,160, 62,
- 64,160, 80, 61,112,243,245, 61, 40, 18,224,190,192,154,227,188,238,196,139,190,172, 28,108, 62,189,152,246, 62,202, 50, 61, 62,
- 34,254,210, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 20,166, 56, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,250,104,187,191,168, 86,139,189,145, 23,131, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,
-202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,128, 5,124, 1,
- 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,227, 80, 19,191,
-120,138, 16,191,122,210, 6,191,144, 14,138, 62, 72, 65,189, 62, 16, 89,244,189,208, 5, 83, 62, 92,159,107,190, 20,199,255, 62,
- 16,124, 48,190, 13, 67,208, 62,184, 57,190, 62,121,154,219, 61,111,114,234, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,203, 51,223, 62, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 56,161, 62,253,221,207,191,204,110,120, 64,
-188, 81, 55,191,107,243, 71,191,102,237, 42, 63,233,163,214, 62,203,206,183,190,202,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,160, 6,124, 1, 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,138,124, 47, 63, 11,193, 0, 63,126, 39,176, 62, 68, 3,204,190,128,180, 43, 61,
- 64,184,104,189, 69,173, 54,191, 16,239,116,189,192,183, 53,190,120, 91,198,190,123, 33,150, 62, 70, 30,226, 61,225,121, 27, 62,
- 3,154,227, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,117, 22, 35, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 60, 89, 41,192,114,107, 25,192,178,245,222, 63,190, 81, 55,191,107,243, 71,191,100,237, 42, 63,233,163,214, 62,
-200,206,183,190,204,137, 61,190,157, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,192, 7,124, 1,
- 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, 65,202,207, 62,
-211, 32, 47, 63,139,219, 0,191,197,212,172,190,196, 68, 65, 63,104,152,217,190,160,218,214,190, 84,113, 84,190,194,108,158,190,
-224,217,235, 61,107,179,202, 60,195,106,157, 62,210,197, 33, 63, 28,243, 18, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 1,162,102, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96,238,220,191, 89, 70,150,191,200,192, 72, 64,
-190, 81, 55,191,109,243, 71,191, 98,237, 42, 63,234,163,214, 62,201,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,224, 8,124, 1, 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,175, 95, 22, 63,171, 95,210,190,114, 70, 46,191, 69, 71, 26, 62,192,164,234, 61,
-121,120, 78,191,192,229,108,188,144,225, 72,190,196,218, 42,190, 83,104,114,191, 14,183, 77, 62,160,153,182, 62, 65, 59,143, 62,
- 51,159, 38, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,226,144, 95, 62,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 60,234,116,192, 32,103,238,188,165, 20, 56, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,
-202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 10,124, 1,
- 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,244,136, 6, 62,
-240,135, 58,191, 94,198,233, 61, 57,148, 41, 63,152,188,189,190,156, 72,189,190,184, 14, 86, 63,186, 54,165,190,128,220, 49, 62,
- 64, 87,189,189, 29,255,242, 60,231,194, 83, 63,189, 56, 5, 62, 66,188, 85, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,186,132,181, 61, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,208,209,240,189,182,183, 95, 63, 5, 67,176, 64,
-192, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,200,206,183,190,202,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 32, 11,124, 1, 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,107,114, 86,191,137,141, 2,191,201,140,105, 61, 69,121, 63,190,132,242,218, 62,
-236,163,132,190, 0,236, 16, 60, 84,203,248, 62, 79,244, 80,191,104, 0,148, 62,154,189, 85, 63,146,104,200, 61,242, 55,142, 60,
- 69, 57, 76, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 31,252, 33, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,205, 54, 25,192,189,197,162, 62, 8, 16,121, 64,190, 81, 55,191,107,243, 71,191,100,237, 42, 63,233,163,214, 62,
-200,206,183,190,204,137, 61,190,157, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 32,124,114, 1,
- 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,219,100,244,190,
-182, 69, 91,191, 61,137,144,189,165,126, 59, 62, 28,228,200,190, 60, 49,170, 62,224,139,250,189,248,143,111, 62,252,103,100,191,
-144, 32, 79, 62,103,246,163, 62, 91,201, 16, 63, 24,104,136, 61,228,230, 66, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,182, 88, 41, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 57, 61,192,232, 53, 39,191,172,221, 55, 64,
-190, 81, 55,191,107,243, 71,191, 98,237, 42, 63,234,163,214, 62,198,206,183,190,203,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 64,125,114, 1, 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,164, 43, 35,190,245,210,225, 61,197, 58, 30, 63,229, 8, 67, 63,208,176,222, 61,
- 70, 15, 12, 63, 80,195,165, 62,224, 72,227, 61,188, 66, 87,191,144,213,195, 62, 46,218,212, 61,242, 20, 25, 63,124, 70,118, 62,
-167,226,107, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,173, 74, 64, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,249, 62, 40,191, 32,113, 26, 63, 50,179,160, 64,190, 81, 55,191,107,243, 71,191,102,237, 42, 63,233,163,214, 62,
-202,206,183,190,201,137, 61,190,157, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 96,126,114, 1,
- 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,190, 29,224,190,
-239, 44, 4, 63,125,217, 49, 63,107, 25,121,190,116,172,217, 62,240, 98,116,190,148,162, 42, 63,142,178,199,190, 54,105, 13,191,
- 84,107,163,190, 64,186, 45, 63,110,122, 91, 62, 32,134, 21, 61, 18,118,144, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,113,107, 73, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 51,138,191,200, 14,110,192, 13, 66,203, 63,
-190, 81, 55,191,109,243, 71,191, 98,237, 42, 63,234,163,214, 62,201,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,128,127,114, 1, 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, 36, 78, 39, 63,128, 50,251,190,139,185,189,190,173, 4,226, 62,118, 23,153,190,
- 68,228,120,190, 50,226, 42,191,239,243, 86,191, 36, 42,189,190, 66, 1,190,190,234,223,153, 59, 20,174,243, 59,232,160, 60, 63,
-248,135,128, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,167,245,105, 62,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 44, 75,186,191,173,205,204,191,131,169, 61, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,
-202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,160,128,114, 1,
- 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,117,223,155, 62,
-249,196, 3,191,115, 12,163,190,212, 73, 60,191, 56,208, 85, 62, 64, 11,155, 62, 24, 17,173,189, 20, 16,254,190,212,229, 32, 63,
-224,221, 28,189, 77, 19, 52, 62,228, 52,146, 62,193,228,171, 62,107,185, 79, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 45,184, 37, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,118,219, 63,227, 73, 28,192, 81,117,128, 64,
-192, 81, 55,191,107,243, 71,191, 98,237, 42, 63,234,163,214, 62,197,206,183,190,202,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,192,129,114, 1, 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,167,109,254, 62,209,146, 4, 63,232,131, 23, 63, 68,212,187, 62, 10,109,158,190,
- 72, 12,216, 62, 0, 20,153, 59, 8, 2, 7, 62, 96,134, 91, 62, 44,128, 33,191,191, 75, 51, 62,208,251,144, 60,197, 49, 19, 61,
- 21,114, 69, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,221,100,115, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,177, 59,194,191, 34, 29, 13,192, 13,208, 30, 64,192, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,
-200,206,183,190,202,137, 61,190,157, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 64,106,127, 1,
- 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,117,223,155, 62,
-249,196, 3,191,115, 12,163,190,212, 73, 60,191, 56,208, 85, 62, 64, 11,155, 62, 24, 17,173,189, 20, 16,254,190,212,229, 32, 63,
-224,221, 28,189, 96, 31,227, 61,168,207,104, 62, 38, 89,237, 62, 91,238, 74, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 45,184, 37, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,197,190, 82,192, 3,149,174, 62, 30,189, 91, 64,
-190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 96,107,127, 1, 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,170,132, 10,191, 82, 61,237, 62,127,191,223,190, 11,148, 12, 63,240,142, 92, 62,
- 18,199, 32, 63,160,206,242,189,198,114, 15, 63, 92, 82, 33,191, 4,247,167,190,212, 10, 37, 62,124,152, 65, 63, 17,110,106, 61,
-172,189,207, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 40, 23,140, 62,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,112,157,163,190, 48,219, 33, 63,250, 25,167, 64,190, 81, 55,191,107,243, 71,191,102,237, 42, 63,233,163,214, 62,
-202,206,183,190,201,137, 61,190,157, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,128,108,127, 1,
- 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,101,175, 4,191,
-158,200, 50,190,247,214, 77, 63,225,194,110,190,144, 10,198, 61,208,213, 62, 62,144,163,253, 61,112,130,160, 61,201,229,101,191,
-104,145, 50, 62, 53,192, 61, 63, 16, 50, 23, 62, 37, 56, 1, 61, 41,254,162, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 89, 81,220, 60, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,135, 63, 79, 63, 22,225,203,191,183, 83,133, 64,
-190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,160,109,127, 1, 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, 70,155,194,190, 81, 93, 3,191, 23,133, 19,191,178,146, 2,191,128,198,104, 62,
- 16,189, 93, 63, 76,226,209,190,158,122, 21,191,168,192,234,190, 16,128, 35, 63, 10,188,167, 62,140,167,138, 61,186,163,185, 61,
-147,152, 3, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 25,249,236, 59,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 20,218, 89, 62,170, 21, 81,192, 50,226, 38, 64,190, 81, 55,191,107,243, 71,191, 98,237, 42, 63,234,163,214, 62,
-198,206,183,190,203,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,192,110,127, 1,
- 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,140,169, 52, 63,
- 96,163,156, 62, 27,132,184,190, 82, 25, 7, 63,128,117,151, 62,252,206,247, 62, 28,144, 76, 63,148, 57,204, 62,192,181,246,188,
-196,222, 19, 63,175,237, 18, 61, 50, 0, 0, 61,180, 45,208, 62, 72,186, 6, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 61,195,186, 62, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,192, 91,166,190,195,138,151, 62,233, 4,159, 64,
-188, 81, 55,191,109,243, 71,191,102,237, 42, 63,237,163,214, 62,198,206,183,190,202,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,224,111,127, 1, 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,212,240, 7, 63,213, 2, 18,191,228, 90, 5,191,222, 92,178, 62, 8,236, 16, 63,
- 92,216,151, 62,156,193,128, 62, 64, 60,245,188,118,129,160,190, 47,157,113,191,112,117, 40, 63,168, 92, 37, 62, 75,198, 78, 61,
- 7, 28, 5, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,137, 96,226, 62,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,106,137,191,191,137,156,208,190,238,245,116, 64,190, 81, 55,191,107,243, 71,191,102,237, 42, 63,233,163,214, 62,
-202,206,183,190,201,137, 61,190,157, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0,113,127, 1,
- 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,173,218, 49,191,
-113,109, 23,191, 30, 16, 55, 62, 55,117,188,190, 24, 20,208, 62,118,245, 46,191, 0,158,236,186, 55, 10, 97,191,140,128,183, 62,
-178,230,146,190,120,217,174, 62, 45, 55,188, 62, 42, 76, 25, 62,138,146, 16, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 96, 85, 48, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,222, 6, 78,191,236,247, 2,191, 2,181,131, 64,
-190, 81, 55,191,109,243, 71,191,102,237, 42, 63,236,163,214, 62,200,206,183,190,203,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 16,133,114, 1, 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,178, 25,236,189,127,158, 27, 63,122,235,239, 62, 59,108, 33, 63,244,198,103,190,
-252,192,187, 62,180, 39,101,190,108,210,138, 62,145,168, 54,191,208, 20, 63,190,236,209,211, 62, 2,168,129, 62,107,237, 7, 62,
-185, 30, 77, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 2,210,109, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 97,181,251,191,176, 67, 79, 63, 85,115,143, 64,188, 81, 55,191,107,243, 71,191,102,237, 42, 63,233,163,214, 62,
-203,206,183,190,202,137, 61,190,157, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 48,134,114, 1,
- 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,119,243,237, 61,
- 12,234,169,190,211,226, 55,191,185,175, 25,191, 24,201, 39, 63,204, 23, 71,190, 88, 61,218, 62, 32,211, 39, 63,108,101,215,190,
- 32,125,244,189, 31, 56,250, 62,175,208,248, 62, 52, 43, 79, 60,247,186, 79, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 83,130,186, 61, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,165,143, 16,192,220, 40, 31,192,184,165,240, 63,
-190, 81, 55,191,107,243, 71,191,100,237, 42, 63,233,163,214, 62,200,206,183,190,204,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 80,135,114, 1, 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,193,157, 15,191, 48, 51,205,190,152, 40,136,190,128,122, 44, 63,194,144, 92, 63,
-236, 36, 99,190,244, 22,206,190,144, 32,220, 62,170,244, 19, 63,160,205,238,189, 90,255, 69, 61,125,237,129, 62,202,113, 29, 63,
- 20,188,169, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,249,139,151, 61,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 47, 16, 46,192,250,135, 17, 62,198,174,101, 64,190, 81, 55,191,107,243, 71,191,102,237, 42, 63,233,163,214, 62,
-202,206,183,190,201,137, 61,190,157, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,112,136,114, 1,
- 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,186,110,162,190,
-145,104,105,190,247,168,239, 62, 3,235, 74, 63,140, 77,178,190, 80, 49, 72, 63,168, 45,112, 62, 42,101, 44, 63, 96,162,173, 62,
-180,215,104,190,132,185,112, 62, 76,198, 31, 63, 80,148,186, 61,145,140, 75, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,161,174,120, 61, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,222, 76, 34,192,190, 63,220,191,102, 92, 19, 64,
-190, 81, 55,191,109,243, 71,191,100,237, 42, 63,233,163,214, 62,201,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,144,137,114, 1, 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,105, 89, 32, 62,234, 91, 82, 63, 19, 79, 86, 60, 22, 61, 12, 63,250,120,178,190,
-203, 19, 37,191,128, 65, 24, 63,196,226, 52, 63,219,214, 0,191,204,228,210,190,193, 5,144, 61, 31,251,203, 62, 4,217,232, 62,
-185,169,156, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 7,165,113, 62,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,209,208,191,175, 98, 57,192,212, 39,244, 63,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,
-202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,176,138,114, 1,
- 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,244,136, 6, 62,
-240,135, 58,191, 94,198,233, 61, 57,148, 41, 63,152,188,189,190,156, 72,189,190,184, 14, 86, 63,186, 54,165,190,128,220, 49, 62,
- 64, 87,189,189, 40,142,100, 61,205, 81, 18, 62, 52,238, 34, 63,214,209, 40, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,186,132,181, 61, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,156,146, 19,192,144,169, 38, 63,119,240,133, 64,
-190, 81, 55,191,107,243, 71,191,102,237, 42, 63,233,163,214, 62,202,206,183,190,201,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,208,139,114, 1, 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,123,191,104,191, 90, 12,172,190,102, 97,112, 62,249, 67,150, 61,240,234,241, 61,
-120, 15, 65,190,224, 2, 61, 62,158, 38,233,190,128, 62,191,187,106,119, 29, 63,176, 98,202, 62,157,134, 14, 63,239,140,213, 60,
- 93,116,179, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,159,173, 69, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 95,209,211, 63, 77, 57, 64,192,236, 52,100, 64,192, 81, 55,191,107,243, 71,191, 98,237, 42, 63,234,163,214, 62,
-197,206,183,190,202,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,144, 2,114, 1,
- 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,129, 46,157,190,
-239,142, 47,191,248,128,219, 60,123,203, 40, 63, 0,175,122,189,180, 33,139, 62,160, 8, 63, 61, 74,191, 26,191, 48,191,189, 61,
-124,188,100,190,133,222,112, 61,149,149,161, 60,121,188,202, 61,220,141, 82, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 34, 78, 58, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,204, 40,195, 62,168, 66, 22,192, 54, 69, 88, 64,
-190, 81, 55,191,107,243, 71,191, 98,237, 42, 63,234,163,214, 62,198,206,183,190,203,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,176, 3,114, 1, 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,168, 69, 25, 63, 77,123,124, 62,100,238, 32,191,234,140,220, 62, 96,159,120, 61,
-192,254,244, 61,104,215, 59, 63,244,235, 71,190, 9,172, 73,191, 94,228,165,190,238,198, 39, 62,233,166,180, 61, 35, 45,106, 62,
- 32,238, 4, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,128,255,104, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,179, 41,124, 63,215, 52, 92,192, 2,194, 56, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,
-202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,208, 4,114, 1,
- 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,250,191,175, 62,
- 72,210, 67, 63, 93, 44,255,190, 34,232, 97, 62,184, 89, 70,191, 58, 37,246,190,112,174,211, 61,224,174,119,189,237, 2,119,191,
-176,205, 35, 62,226,119,158, 59, 63,185, 89, 59, 58, 41,150, 62,186,212, 50, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 78,102, 32, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 76,215, 66,192, 80,102, 17,189,252, 64, 82, 64,
-190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,240, 5,114, 1, 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, 40, 15,158,190, 97, 48, 27,191, 48,181, 41,191, 31, 19,160,190, 88, 23,153,189,
-100,243,110,190,182,169,164,190, 97,129,120,191,128,101, 90, 60,192, 53,186, 61, 94, 65, 31, 62,150, 57, 45, 63,119,240,248, 61,
- 59,128, 61, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,196, 79,137, 61,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,246,234,243, 63, 15,199, 50,192,250,173,118, 64,188, 81, 55,191,109,243, 71,191,100,237, 42, 63,235,163,214, 62,
-201,206,183,190,201,137, 61,190,157, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 16, 7,114, 1,
- 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,133,137,136, 62,
-101, 7,106,191,250,249,155,190,188,218,155, 60,192,212,184,188, 72,215,201,189, 40,244, 61,191,128,234, 70, 61,154,226, 1,191,
-118,139, 91, 63,202, 64,207, 61, 44,106, 89, 60, 30, 53, 13, 61,236,222, 89, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 6, 40, 87, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,170,176, 54,191, 97,173,187,191,212, 31, 93, 64,
-190, 81, 55,191,107,243, 71,191,102,237, 42, 63,233,163,214, 62,202,206,183,190,201,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 48, 8,114, 1, 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,221,175, 71, 59,214, 55, 18,191, 64, 82,223,190,142, 2, 50, 63,240, 17,202, 61,
- 52,118,199, 62,128,125, 72, 63, 86,250, 36,191, 64, 99, 90, 61,124, 38, 25, 63,101,144,129, 62,185, 1, 91, 62, 60, 67,121, 62,
- 32, 77,148, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 21, 69, 35, 62,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,237,131,100,192,234,185, 81,191, 36, 50, 27, 64,190, 81, 55,191,109,243, 71,191, 98,237, 42, 63,234,163,214, 62,
-201,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 80, 9,114, 1,
- 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,164, 43, 35,190,
-245,210,225, 61,197, 58, 30, 63,229, 8, 67, 63,208,176,222, 61, 70, 15, 12, 63, 80,195,165, 62,224, 72,227, 61,188, 66, 87,191,
-144,213,195, 62,157,146, 70, 60, 81,125, 44, 63, 69,124,156, 62, 99,144, 10, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,173, 74, 64, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,226, 77,248,190,220,108,103,190,232,231,143, 64,
-190, 81, 55,191,107,243, 71,191,102,237, 42, 63,233,163,214, 62,202,206,183,190,201,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,112, 10,114, 1, 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, 59, 62,251,190,156,207,132, 62,191,198, 19,191,122, 82, 25,191,178,114,169,190,
-242, 80, 46,191,160, 92,100,189,124,103,188, 62, 0,234, 23,191, 12,140, 22, 63, 56,173, 3, 63,188,233, 78, 62, 70,225,187, 61,
-197,112, 68, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 62,205, 89, 62,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,129, 80, 10, 64,250,130, 74,192,126,179,109, 64,190, 81, 55,191,107,243, 71,191,102,237, 42, 63,233,163,214, 62,
-202,206,183,190,201,137, 61,190,157, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,144, 11,114, 1,
- 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,221,175, 71, 59,
-214, 55, 18,191, 64, 82,223,190,142, 2, 50, 63,240, 17,202, 61, 52,118,199, 62,128,125, 72, 63, 86,250, 36,191, 64, 99, 90, 61,
-124, 38, 25, 63,214, 2,202, 60, 34,116,181, 59,235,167,204, 60,194,223,113, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 21, 69, 35, 62, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 73, 37, 55,192, 93, 44,210,191,133, 20, 12, 64,
-190, 81, 55,191,109,243, 71,191,100,237, 42, 63,233,163,214, 62,201,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,208,191,105, 1, 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, 34, 7, 15, 63,134,194, 46,190, 35, 82,148, 62,186, 22, 66,191,210,135, 53, 63,
-112, 29,172,190,200, 68,229, 62,252,167,140, 62,180,223, 99,190, 34,226,176,190,143,158, 50, 61, 52,247,230, 62,255, 25,236, 62,
-225,215, 52, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,202,199,214, 62,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 2,163,152,191,233,189, 16,192,148, 29, 39, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,
-202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,240,192,105, 1,
- 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,178, 25,236,189,
-127,158, 27, 63,122,235,239, 62, 59,108, 33, 63,244,198,103,190,252,192,187, 62,180, 39,101,190,108,210,138, 62,145,168, 54,191,
-208, 20, 63,190,112,136,250, 61,107, 45, 71, 62,247,240,222, 62,108,172,125, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 2,210,109, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92,219,213, 63,121,221, 77,192, 99,157, 90, 64,
-190, 81, 55,191,107,243, 71,191,100,237, 42, 63,233,163,214, 62,200,206,183,190,204,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 16,194,105, 1, 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, 56,225, 4,191,238,172, 35, 63, 92, 44, 4,191, 90,166,112,190,228,149,176,190,
-232,184, 6, 63, 91,120, 44,191,208, 36, 20, 63,166, 84, 79, 63,192,145, 89, 61,107,154,192, 60,171,233, 43, 60, 72, 13, 0, 62,
- 52, 72, 87, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 34,131, 32, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,122, 39,106,191,130, 29,114, 63,156,123,164, 64,190, 81, 55,191,107,243, 71,191,102,237, 42, 63,233,163,214, 62,
-202,206,183,190,201,137, 61,190,157, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 48,195,105, 1,
- 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,119, 97, 45, 63,
-120, 47,205,190, 35,117, 19, 63,168,125, 98, 62,240,195, 73, 62,124,228,243, 62,120, 86, 11, 63, 72,156, 89, 62,230,232, 88, 63,
-130, 53,204,190,148, 27, 54, 63,245, 38,133, 62,230, 55, 53, 60, 90,130,143, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 53,129,253, 62, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 71,102,192, 7,110,194,190,108, 39, 47, 64,
-192, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,200,206,183,190,202,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 80,196,105, 1, 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, 98,157,105,188,148, 8,184, 62,181,109, 7,191,177,194, 68,191,162, 77,220,190,
- 58,120,101, 63, 0,106, 25, 61, 72,197, 86, 62,214, 78,236,190,126,136, 46, 63,150,203, 22, 61,130,161, 61, 63, 69,196, 79, 62,
- 80, 22,160, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,112,148, 93, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 12,224,214, 63,227,182, 5,192,246, 59,136, 64,190, 81, 55,191,109,243, 71,191,102,237, 42, 63,236,163,214, 62,
-200,206,183,190,203,137, 61,190,157, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,112,197,105, 1,
- 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,191, 46, 24,191,
- 41, 20, 43,191,185,184,183, 62, 44,173,136, 62, 76, 75, 50, 63, 40, 83,126, 62,188,195, 8, 63,232,211,238, 62, 64, 36,152, 61,
-236,106,145, 62,209, 28,131, 62, 30,255, 46, 60, 17,165,139, 60,114, 88, 55, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 93,122, 57, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 99,158, 92, 63,115,243, 67,192, 15,154, 70, 64,
-190, 81, 55,191,107,243, 71,191,100,237, 42, 63,233,163,214, 62,200,206,183,190,204,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,144,198,105, 1, 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,101,175, 4,191,158,200, 50,190,247,214, 77, 63,225,194,110,190,144, 10,198, 61,
-208,213, 62, 62,144,163,253, 61,112,130,160, 61,201,229,101,191,104,145, 50, 62,103, 55,104, 61, 9, 23, 9, 61,208, 82,129, 62,
-177, 65, 40, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 89, 81,220, 60,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 87,234, 31,192,204,234, 65,192,108,200,172, 63,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,
-202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,176,199,105, 1,
- 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,162,180, 99, 63,
-129,169,145, 62,112, 95,174, 62,161,121,223,189,174,190, 73, 63,120, 72, 51,190,116, 48,162,190, 56, 98,139,189, 76,245,191, 62,
- 80,124,253, 61,197,252, 48, 60,163,176, 62, 62,216, 93, 72, 63, 94, 65,166, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 81, 69, 12, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,122,189,191,238,243,102,191,158,253, 93, 64,
-190, 81, 55,191,107,243, 71,191,100,237, 42, 63,233,163,214, 62,200,206,183,190,204,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,208,200,105, 1, 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, 27,139,218,189,160, 81,222,190, 77, 71,151,190, 48, 33, 88,191,152,174,128,190,
- 44,218,107,190, 40, 96, 66,190,220, 29,113,190, 88,240,184,190,152, 92,204, 62,101,159,135, 62,252,216,174, 62,218, 99, 96, 62,
-104,171, 50, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 5, 27,207, 61,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,223, 75, 67, 63,208,124, 78, 61,200,150,171, 64,190, 81, 55,191,106,243, 71,191,102,237, 42, 63,233,163,214, 62,
-201,206,183,190,202,137, 61,190,157, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,240,201,105, 1,
- 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, 93, 19,190,190,
-189,203,147, 62, 26,242, 2, 62,224,138, 95, 63,128, 50, 24, 60,148,174, 64, 63,196,158, 11,191,220, 22, 64, 63,100, 35, 19,190,
-216, 93, 44, 62,192,115, 58, 63,107,198, 2, 60,236,102,167, 59,175,100,132, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,189,176, 27, 62, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,240, 36,139, 62,248,230, 62, 63,173,205,179, 64,
-192, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,200,206,183,190,202,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 16,203,105, 1, 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, 87,220,239, 60,168,204, 46,191, 74, 95, 84, 61, 8,105, 58,191,232,245, 43, 63,
- 92,254,151, 62, 80,143,206, 61,176,139, 42, 63, 26,107,196,190,150,211,139,190, 50, 23, 92, 63,172, 27, 15, 61, 11, 43, 83, 60,
- 57, 83,189, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,121,221, 49, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 34,247,225,191, 36,175, 81,192,248,254,198, 63,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,
-202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 80,166,114, 1,
- 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, 60,132,130, 62,
-129,166,120,190, 15,191,109,191,174,164,238, 61, 20, 93, 78,190,248,164,231,189, 0,255, 16, 62, 62,189,234,190,112,167,116,189,
- 68,175, 16, 63, 66,132, 2, 61,192, 37,189, 61,173, 5, 64, 63, 91,181, 0, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,129, 93, 2, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,232,110,165, 61,209, 43,239, 62,128,243,169, 64,
-190, 81, 55,191,107,243, 71,191,102,237, 42, 63,233,163,214, 62,201,206,183,190,201,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,112,167,114, 1, 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,173,218, 49,191,113,109, 23,191, 30, 16, 55, 62, 55,117,188,190, 24, 20,208, 62,
-118,245, 46,191, 0,158,236,186, 55, 10, 97,191,140,128,183, 62,178,230,146,190, 62,109, 66, 63,246,159,170, 61, 85,150,243, 60,
- 72,136, 2, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 96, 85, 48, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 14,158,243,191,244,237,104,192,136, 34,155, 63,190, 81, 55,191,109,243, 71,191, 98,237, 42, 63,234,163,214, 62,
-201,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,144,168,114, 1,
- 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,155, 22, 49,191,
-222,232,165, 62,133,208, 6,191, 93,253,190,190,190,234,194,190,240, 89, 29,191,134,110, 23,191, 8,217, 30,191,108,159,205,190,
- 18, 94,185,190,229,106, 92, 60, 23, 25, 35, 61,136,111, 93, 63,212,105,167, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,252,153,132, 62, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,118, 74, 8, 63,255,239, 1,192, 28,123,108, 64,
-190, 81, 55,191,106,243, 71,191,102,237, 42, 63,233,163,214, 62,201,206,183,190,202,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,176,169,114, 1, 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,217,155,104, 63,216,164, 29,190,175, 60,179,190,203,201, 43, 62, 96, 60, 67, 61,
-176, 42, 90,189, 68, 85, 4,191, 68,249,130, 62,230,199,133,190,148, 14,107, 63,233,242,101, 62,183,120,181, 61,232,136, 43, 62,
-245,241, 4, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,252,179,108, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 30, 24,231,191, 44,105, 21,191,187, 32, 98, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,
-202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,208,170,114, 1,
- 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,126, 52, 49,191,
-202, 9, 43, 63,166,234, 96,190,182,210, 37,190,192, 58, 54, 61,232, 1, 63, 63,134,173, 34,191, 4,154,170,190, 92,112, 51, 63,
- 18, 61, 23,191, 67,189,138, 62,116,103,210, 62,114,128, 62, 62, 32, 54, 7, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 33,132,126, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,145, 52, 5,191, 10,103, 49,192,233,154, 37, 64,
-190, 81, 55,191,107,243, 71,191,100,237, 42, 63,233,163,214, 62,200,206,183,190,204,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,240,171,114, 1, 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, 78, 96, 32, 63,185,201,160, 62,160, 3, 6, 63, 11, 34,248,190,192, 53,185, 60,
-192,197,178, 61,174,184, 53, 63,224,172,162,190,108,136,224, 62,142,173, 61,191,135, 47,184, 61,247,157,207, 61,168, 0,225, 62,
-249, 11,189, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,248,112,150, 62,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,134, 45,177,191, 34,253, 99, 63, 8, 58,155, 64,190, 81, 55,191,107,243, 71,191,102,237, 42, 63,233,163,214, 62,
-202,206,183,190,201,137, 61,190,157, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 16,173,114, 1,
- 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, 47,202, 55, 63,
-247,235, 89,190,127, 18, 92,190,146,129, 32,191, 8,212, 8,190,168, 50,171,190, 96,120,123, 62,232,152,249,189,140, 18,149, 62,
- 32,111, 13, 61,147,253, 28, 63,230,184,184, 62, 51, 48, 58, 60, 59, 78,111, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,115, 61, 18, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34,255, 57,191,231, 4, 65,192, 78, 7, 19, 64,
-190, 81, 55,191,107,243, 71,191,100,237, 42, 63,233,163,214, 62,200,206,183,190,204,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 48,174,114, 1, 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,204,218,133,189,113, 10,176,189,186,237, 10, 63, 14, 61, 85, 63,180,219, 38,190,
-176,175,206, 62, 46,240, 10, 63, 32,232,114,190, 92,162,207,190,172, 85,193,190,228,255,128, 61, 73, 32,172, 61,146,152, 5, 63,
-206,134,169, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 62, 38,212, 60,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,182, 68,137,191,204,177,226, 61,196,247,141, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,
-202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 80,175,114, 1,
- 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,137,138,146, 61,
-191, 75, 8,187, 25,235, 68, 62,122,141,122, 63,116,117, 92, 63, 8,147,125,190, 88, 49,147,190, 8, 88, 41, 63, 64,255, 2, 63,
- 64, 44,126, 61,107,166, 0, 63, 23, 29,154, 62, 34,214,165, 61, 42,130,236, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,241,170,103, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20,103, 82,192, 72, 75,201,191, 3,247, 0, 64,
-190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,112,176,114, 1, 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,229,120,168, 62,178,154, 7,191, 41,180, 48, 63,240,232,187,190, 9, 35,104,191,
-224, 8,114, 62, 76,143,177,190,106, 29, 28,191,208,112,234, 62, 8,249, 92,190, 78,110,118, 59,167,155, 4, 63, 69, 2,243, 62,
-182,199,108, 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 74, 4,184, 62,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,196,241,246,191, 95,130,236, 62, 50,209,135, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,233,163,214, 62,
-201,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,144,177,114, 1,
- 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,123,197,223, 62,
- 33,243,189,190,199,213,140,190, 13,149, 69,191,222,235,199,190,160, 79,240, 62,112,202, 14,190,184,168, 60,190, 4,145,220,190,
- 44, 8,148, 62, 47, 99,219, 62, 87, 73,242, 62,132, 14, 79, 61, 70,141, 67, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,157,236,192, 62, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,160,228,149,189, 15, 14,221,190,209,251,145, 64,
-190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,176,178,114, 1, 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, 93, 19,190,190,189,203,147, 62, 26,242, 2, 62,224,138, 95, 63,128, 50, 24, 60,
-148,174, 64, 63,196,158, 11,191,220, 22, 64, 63,100, 35, 19,190,216, 93, 44, 62,196,141, 4, 63, 1, 71, 19, 62, 65,186,174, 61,
-103,146,129, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,189,176, 27, 62,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 20,120, 89, 62, 92,169,120,190, 29, 78,155, 64,190, 81, 55,191,107,243, 71,191,102,237, 42, 63,233,163,214, 62,
-202,206,183,190,201,137, 61,190,157, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,208,179,114, 1,
- 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,118,201, 94, 63,
-194,189,213, 62,141, 27, 67, 62,215, 93, 55,190, 6,154,131,190,132, 48,178,190,140, 11,192,190, 40,123,147,189, 28,130, 57,191,
- 44,253, 33,190,226, 89, 24, 63,192,174,198, 61, 0,152,101, 61,141,237,128, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 59,122,117, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 91, 80, 26,192,152, 3,239,189,183,210, 99, 64,
-190, 81, 55,191,107,243, 71,191,100,237, 42, 63,233,163,214, 62,200,206,183,190,204,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,240,180,114, 1, 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,148, 16,153,190,223, 1, 33,191, 43,253,168, 62,253, 36, 35, 63,124,255, 19,191,
- 70, 97,138,190,192,109, 6, 62, 64, 58,223,190,152,121,189,189, 8,126,170, 62,117,248,126, 62, 83, 41, 12, 63,152, 55, 4, 62,
- 62, 85,152, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 74,244,106, 61,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 80,245, 70,190,135,148, 37,192, 40,107, 57, 64,190, 81, 55,191,109,243, 71,191, 98,237, 42, 63,234,163,214, 62,
-201,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 16,182,114, 1,
- 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, 45,246,249, 62,
-199,102,140, 62,155,199, 10, 63, 39,102, 32, 63, 78, 10, 19,191,224,238,250,190, 0, 13,111,190,240,232,187, 61,104, 10, 99, 62,
-164, 96,221, 62,208,237,239, 61, 8, 34,210, 61, 61,101,181, 62,204, 22,218, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 35,143, 25, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,173, 25,191, 65,234,249,191, 59,217, 73, 64,
-190, 81, 55,191,107,243, 71,191,100,237, 42, 63,233,163,214, 62,200,206,183,190,204,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 48,183,114, 1, 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,205,109,230, 62, 67, 47,189,190,208,119,155,189,238, 53, 79,191,223,144, 88,191,
- 88,163,146, 62, 64, 99,208,190,236,235,130, 62, 72, 10, 17,190,124,223, 15, 63, 12,172, 64, 62,161, 24, 51, 62,145, 49,156, 62,
- 24,236,169, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,254,237, 72, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 79, 63, 60,192,189, 70,245,191,243,177,248, 63,190, 81, 55,191,109,243, 71,191, 98,237, 42, 63,234,163,214, 62,
-201,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 80,184,114, 1,
- 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, 50,162, 16, 63,
- 33,180,219,190, 24,166,177,190,234, 8, 29,191, 24, 26, 48,190,240, 70,115,190, 0,197, 54, 63, 72,201, 75, 62, 32,174, 10,189,
- 82,128, 78, 63,159,109,175, 60, 10,135,214, 62, 58, 12, 9, 63,133,154,198, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 34, 50,138, 62, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6,125,162, 63, 64,233, 64,192,144,167, 86, 64,
-190, 81, 55,191,109,243, 71,191, 98,237, 42, 63,234,163,214, 62,201,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 16, 51,105, 1, 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,234,120, 11, 63,200, 35,253,190, 3,152,233,190, 0, 38, 0,191,214, 3, 36,191,
- 4,239, 45,190,136,175, 9,191, 16,130, 42,190,156,197, 38, 63,182, 37,238,190, 3, 49,119, 61,118,251,224, 60, 93, 5, 47, 62,
-189,195, 61, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 89,162,191, 62,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,184, 96, 27,192,250, 23,179,191,194, 77, 38, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,233,163,214, 62,
-201,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 48, 52,105, 1,
- 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,177,231, 32,191,
-150, 89,239, 62,128,156,188,190,225, 45, 0,191,248,133,210, 62, 52,169, 40, 63,146,184, 26, 63,210, 39,223,190,182,238, 15,191,
- 74, 63,146,190,168,161,213, 61,218,242,218, 62, 37, 18,191, 62, 88, 74,194, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 81,236,129, 61, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,181, 0, 21,191,137,241, 14,192,206, 27, 61, 64,
-190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 80, 53,105, 1, 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,215, 79,213,190, 94, 19, 10, 63, 60, 25, 56,191,192,193, 10, 62,128,232, 10,190,
-160,126, 93,190, 24,169, 7, 63, 38,209,221,190, 52,214,186, 62, 20, 63, 41,191, 59, 36, 27, 62,244,151, 28, 62, 83, 23,179, 62,
-150, 10,177, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 98,241, 41, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 80, 57,189,194, 80,166,191,242,172,123, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,
-202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,112, 54,105, 1,
- 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,160,174,232, 62,
- 63, 99,164, 61, 41,108, 12, 63,106,126, 50,191, 64,117,124, 62,134, 54, 82, 63, 36, 55,191, 62,120,232,197,190,192,203, 70,189,
- 26, 88, 51,191,198,225,170, 62,113, 67, 23, 62,201, 56, 33, 62, 27,224,184, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,216,213,138, 61, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,218,106,219,190, 34,216,127, 63,142,251,173, 64,
-190, 81, 55,191,107,243, 71,191,102,237, 42, 63,233,163,214, 62,202,206,183,190,201,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,144, 55,105, 1, 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,215, 79,213,190, 94, 19, 10, 63, 60, 25, 56,191,192,193, 10, 62,128,232, 10,190,
-160,126, 93,190, 24,169, 7, 63, 38,209,221,190, 52,214,186, 62, 20, 63, 41,191, 7,203, 79, 63,111, 14, 32, 62,255,238, 44, 60,
- 59,180,175, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 98,241, 41, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,110, 39, 91,192, 65, 81,150,191, 89, 68, 15, 64,190, 81, 55,191,107,243, 71,191,100,237, 42, 63,233,163,214, 62,
-200,206,183,190,204,137, 61,190,157, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,176, 56,105, 1,
- 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,131,212, 0,191,
- 16,161, 38,191,131,203,123,190,208, 48, 3,191,112, 6, 64, 63,136, 53, 34,190,175,202, 6,191, 64,241, 19, 62,120,105, 85,190,
-144,246,146, 61, 23, 88, 25, 60, 83, 74, 25, 63,200,185,196, 62,208,179,249, 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,198,223, 90, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,231, 17, 40, 63,155, 44,153,190, 68,123,161, 64,
-190, 81, 55,191,109,243, 71,191,102,237, 42, 63,236,163,214, 62,200,206,183,190,203,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,208, 57,105, 1, 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, 69,219, 68, 63,191, 75, 74, 62,251,129,229, 62,197, 78,210,190, 64, 63, 59,188,
-172,173,214, 62, 16,159, 85, 62, 24,160,185,189,169,193, 46,191,176, 21, 77,190,202,133, 32, 63, 25,163, 36, 61, 44,136,225, 60,
-132, 71,156, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 22,208,141, 61,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 50, 95,160, 63, 33,101,249,191,177, 96,132, 64,190, 81, 55,191,109,243, 71,191,102,237, 42, 63,236,163,214, 62,
-200,206,183,190,203,137, 61,190,157, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,240, 58,105, 1,
- 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,178, 25,236,189,
-127,158, 27, 63,122,235,239, 62, 59,108, 33, 63,244,198,103,190,252,192,187, 62,180, 39,101,190,108,210,138, 62,145,168, 54,191,
-208, 20, 63,190, 62, 45,138, 62, 35,142, 30, 61,173, 78,128, 61,170,246, 32, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 2,210,109, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,110,133, 6,192,171,152,225,191, 84, 16, 32, 64,
-190, 81, 55,191,109,243, 71,191,100,237, 42, 63,233,163,214, 62,201,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 16, 60,105, 1, 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,186, 57,241, 62,210,244,173, 62,197,195,188, 61,228, 10, 79, 63, 14,223, 34,191,
-172, 65, 40,190,160,228, 38, 61,186,225, 12, 63,192,196, 13,189,186,253, 14,191,241,107,217, 61,249,147,174, 62,230,232,218, 62,
- 70, 80, 0, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 8,168,183, 62,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 82, 99,228,190, 40, 59, 51,191,220, 75,133, 64,190, 81, 55,191,107,243, 71,191, 98,237, 42, 63,234,163,214, 62,
-198,206,183,190,203,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 48, 61,105, 1,
- 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, 51,191, 23, 63,
-250,209, 82, 62, 34, 21,204, 62, 21, 58, 43, 63, 0, 3,139, 61, 48,159,135, 61, 32,117, 36,189,232,123,244, 62, 80,104,185, 62,
- 18, 73, 33, 63,114,208,213, 62,122,118, 76, 62, 34,254, 5, 62, 63,245,128, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,179,246, 4, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 86,101, 74,192,162,185,105,191, 18,141, 36, 64,
-190, 81, 55,191,107,243, 71,191,100,237, 42, 63,233,163,214, 62,200,206,183,190,204,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 80, 62,105, 1, 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,221,157, 3, 63, 67, 81,215, 62,135, 46, 5, 63,121,108, 9,191, 36, 83, 16,190,
- 38,244,130,190,192, 18,216, 62,222, 44, 53, 63,152,136,162,189, 80,138,252,190,222,214,102, 61, 50, 22, 25, 63,139, 42,157, 62,
-164,113, 30, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,145,208, 26, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,124,234,218,191, 45,177,232,191,109,174, 42, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,
-202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,112, 63,105, 1,
- 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, 98, 41, 59,191,
-238, 70,252, 61, 77, 96, 25,191, 33,195,154,190, 32,119,242,190,124, 79,204,190, 24, 53, 18,190,102, 31,214,190,166,174,199,190,
- 32,105,169,188,231, 50, 8, 62,230,251,148, 62,128, 65,206, 62, 72, 82, 49, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 44,230, 5, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,254,106,206,191,179, 36,150, 62, 96, 42,137, 64,
-190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,144, 64,105, 1, 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, 51,191, 23, 63,250,209, 82, 62, 34, 21,204, 62, 21, 58, 43, 63, 0, 3,139, 61,
- 48,159,135, 61, 32,117, 36,189,232,123,244, 62, 80,104,185, 62, 18, 73, 33, 63, 87, 15,231, 62, 50,237,207, 62,254, 43,141, 61,
-226,225,150, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,179,246, 4, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,200, 61,167, 63,119, 5,171,191, 88,214,147, 64,190, 81, 55,191,109,243, 71,191,102,237, 42, 63,236,163,214, 62,
-200,206,183,190,203,137, 61,190,157, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,176, 65,105, 1,
- 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,111, 39, 70, 63,
- 89,103,218,188, 45, 24, 30, 63, 26, 81, 12, 62, 26,129, 16, 63,208,153,162, 61, 11,203, 31,191,222,132, 2, 63, 26, 4,154,190,
-200,112,100, 62,215, 36,214, 62,168, 85,122, 60, 41,247,142, 60,132,140, 12, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 48, 61,115, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,196, 14,251,191, 16,213,105,190,166,188,109, 64,
-190, 81, 55,191,106,243, 71,191,102,237, 42, 63,233,163,214, 62,201,206,183,190,202,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,208, 66,105, 1, 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,173, 49, 3,191,179,133, 9, 63,104, 18, 16, 63,157, 16,186, 62,184,147,245, 62,
-224, 88,111, 62,220, 25, 2, 63, 80, 44, 77,191, 76,136,152, 62,128,242,176, 61,239, 13,155, 62, 41, 17,234, 62, 93,128, 13, 62,
-225,130,208, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 65,147,208, 62,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,105, 47, 46,192, 88,212, 45, 63, 62, 35,127, 64,190, 81, 55,191,107,243, 71,191,102,237, 42, 63,233,163,214, 62,
-202,206,183,190,201,137, 61,190,157, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,240, 67,105, 1,
- 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, 8,164, 48, 63,
- 32,100, 38,191,163,157,157,190, 14, 78,167, 61, 0, 8, 54, 59,140,155,147,190, 10, 41, 50, 63, 28,101,140, 62,242,237,110, 63,
- 0,188,179, 59, 76, 31,165, 62,210,208, 37, 63, 76,227,141, 60, 10, 28, 76, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,129, 24, 80, 62, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22,203, 83,191,127, 15, 29,192,240, 82, 42, 64,
-190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 16, 69,105, 1, 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, 41,194,232,190,155,110, 35, 63,233,200, 75,190,170,158, 22,191, 80,122,193,189,
-216, 58,149,189, 80, 15, 18,191, 64, 37,145,189, 96,184,219,189, 70,185, 86,191, 38,150,239, 61,142,193, 24, 62, 40, 71,217, 62,
-137,114,158, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,122,231, 75, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 51, 71,102, 63, 24, 13, 44,191, 26,187,156, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,
-202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,192, 74,105, 1,
- 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,119, 40, 61,190,
-150,196, 15,191,159,219, 54,191,233,195,191, 62,104, 96,122,190,192, 71, 74,191, 16,230, 56,190, 64,156,203, 61,224, 39,177, 61,
- 26,222,193,190,177,206, 13, 63,144,101,237, 60, 18,227,198, 60, 19, 30,201, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 74,137,189, 61, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,172,210,252, 62,212, 58, 44,191, 99,217,149, 64,
-190, 81, 55,191,107,243, 71,191,102,237, 42, 63,233,163,214, 62,201,206,183,190,201,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,224, 75,105, 1, 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, 87,152, 38, 63,169,225, 17,191, 60,217,140,189, 67,124,254,190, 16, 65, 17, 62,
-230,204, 15, 63,180,148,241, 62,175,210, 73,191,182,161, 21, 63,192,222,169,188,235,174, 4, 63,126,216,156, 61,114,228,115, 61,
-126,239,176, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 86,104,165, 61,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,181,210, 46,192, 59, 4,135,191,167, 99, 44, 64,190, 81, 55,191,107,243, 71,191,100,237, 42, 63,233,163,214, 62,
-200,206,183,190,204,137, 61,190,157, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 77,105, 1,
- 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,119, 97, 45, 63,
-120, 47,205,190, 35,117, 19, 63,168,125, 98, 62,240,195, 73, 62,124,228,243, 62,120, 86, 11, 63, 72,156, 89, 62,230,232, 88, 63,
-130, 53,204,190,152, 69,201, 61, 74,143, 3, 63,155, 10,162, 62,186, 21,146, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 53,129,253, 62, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,231, 64, 60,203,210,147, 63,204, 32,185, 64,
-192, 81, 55,191,109,243, 71,191, 98,237, 42, 63,233,163,214, 62,199,206,183,190,198,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 32, 78,105, 1, 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,133,137,136, 62,101, 7,106,191,250,249,155,190,188,218,155, 60,192,212,184,188,
- 72,215,201,189, 40,244, 61,191,128,234, 70, 61,154,226, 1,191,118,139, 91, 63,135,168,109, 63, 85, 44,112, 61, 69, 72,115, 59,
-186, 90, 24, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 6, 40, 87, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,159,185, 0,192,197,235, 38,192,184,221,245, 63,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,
-202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 64, 79,105, 1,
- 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,242, 54,241, 62,
- 25, 75, 60,190,136, 31,166,190, 26,162, 76, 63,212, 23,180, 62,134, 28, 22,191,188,125,184, 62,170,143, 49, 63, 40,100,208, 62,
-202,182, 12, 63, 90,123,103, 61,230, 65, 90, 62, 33,215, 29, 63,131, 5,233, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,233, 6, 78, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,134,118,247,191, 86, 66, 8,192, 90, 88, 20, 64,
-190, 81, 55,191,107,243, 71,191, 98,237, 42, 63,234,163,214, 62,198,206,183,190,203,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 96, 80,105, 1, 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,180,149,157, 62,171,241,150, 62,211, 72, 5, 63,196, 98, 61,191, 94, 43,103,191,
-144,249, 13, 62,108, 40, 28,190,176,143, 89,189,160,169,180, 62, 50,210,102, 63, 12,245,186, 61,252,211,140, 62,239,184,252, 62,
-162,107, 15, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,234, 53,126, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,112,252, 2,190,192, 32, 63,192,250,176, 40, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,
-202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,128, 81,105, 1,
- 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,226,185,185, 62,
- 69, 55,133,190, 78,101,246, 62,146, 32, 65,191, 12,142, 47,190,208,240, 16,191,192, 47,250, 60,148, 12,135, 62,250,130,192,190,
-182,224, 63, 63,110,251,141, 61,211, 15,135, 61,153,122,212, 62,150, 66,230, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,194, 22,201, 62, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,184, 37, 60,192,208, 36, 19,192,202,102,212, 63,
-190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,160, 82,105, 1, 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,133,116,253,190,160,178, 23, 63,114, 78, 32,191, 59, 97,221, 61,192,244,236,189,
-204, 56,214, 62, 76,142, 40,191, 32, 48,161, 61, 82, 95, 7, 63,244, 70, 62,190,199,146,141, 59, 23,189,182, 62, 10, 24, 34, 63,
- 60, 34,183, 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 51, 4, 90, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 62,165,155, 63, 34,188,200,191,156,201,140, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,
-202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,192, 83,105, 1,
- 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, 68,198,205, 62,
- 50, 21, 99, 63, 18,246, 86,190,239, 24,178,189,232,177, 74, 62,232, 94,174,190, 16,113, 17,189,144,148,211, 62,156,182, 80,190,
- 18,214, 66,191, 55,112,182, 62,157,202, 2, 61, 67,146, 40, 61, 23, 18, 18, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,229, 84,124, 62, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,134, 48, 1, 63,115, 14,211, 62,119,209,175, 64,
-192, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,200,206,183,190,202,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,224, 84,105, 1, 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, 38, 0,181, 60,183, 21, 39, 63,174, 28, 42,191,206,254,185, 62, 64,101,180, 61,
-224,164,162, 62,169, 22, 78,191, 14,164,146,190, 68, 47,188, 62,233,255, 63,191, 26, 61, 76, 63,219,234,171, 60,236,187, 47, 60,
-123,146, 46, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,113,195, 41, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,196,144, 98, 62, 53,190,112,191,153,224,138, 64,190, 81, 55,191,106,243, 71,191,102,237, 42, 63,233,163,214, 62,
-201,206,183,190,202,137, 61,190,157, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 86,105, 1,
- 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,255, 80,148,190,
- 18,138, 5, 63,169, 16, 38, 62,107, 50, 73,191,214,126, 32, 63,144, 14,148, 62,182, 31, 4,191, 72,152,145, 62, 16, 32, 89,189,
- 64,239,100, 62, 51,212,220, 62, 48, 96,238, 61, 2,246,205, 61, 65, 22,180, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,247, 33, 76, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80,243, 2,192, 18, 84, 91,191,110, 0, 77, 64,
-190, 81, 55,191,109,243, 71,191,100,237, 42, 63,233,163,214, 62,201,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 32, 87,105, 1, 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, 49,146, 69,191,235,123, 69,190,179,188, 26,191,213,182, 47,189, 96, 14,105,191,
- 56,120, 31,190,136, 41, 18, 62,208, 73,183,189,112, 99, 57,189, 32,155,137,190,111,143, 79, 62, 12, 36,220, 62,207,171,119, 62,
-169,124, 0, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,184,151,199, 62,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,228, 81, 34, 62,178, 55, 39,192, 87, 36, 68, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,
-202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 64, 88,105, 1,
- 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,230,148, 3, 63,
-224, 68,239, 62, 74, 64,241, 62, 71, 35, 11,191,248,202, 31,191, 68, 98,182, 62, 18,127, 48,191,160,108, 26,189,144, 93,173,190,
-160,155, 16,191,143, 72,244, 61,152, 98,173, 61, 16,243,154, 62, 39,162,252, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 69,111,245, 62, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,224,206,132,191,153,157,254,191, 61, 78, 57, 64,
-190, 81, 55,191,107,243, 71,191,100,237, 42, 63,233,163,214, 62,200,206,183,190,204,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 96, 89,105, 1, 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, 45, 64,217, 62,153, 24,213,190, 97,174,187, 61,103,136, 76, 63, 26, 1, 32, 63,
-232, 95,162,189,124, 18, 29,191, 76, 78,155,190,124,134, 43,191,174,202,184,190, 49,138, 35, 62,234,209, 85, 62,126, 75,186, 62,
-115, 6,137, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,111,100, 76, 61,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,220,163,237, 62, 54, 20, 58,192, 9,122, 64, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,
-202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,128, 90,105, 1,
- 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, 77, 95, 55,189,
- 43, 21,181,190,230, 3,101,191, 87,248,137, 62, 8,208, 75, 62, 0,116,115, 59,100,196, 95,190,192, 15, 83, 62, 84,222, 81,191,
- 36, 58,169, 62,187,215,163, 61, 90,207, 92, 61,187,248,152, 62,181, 59, 17, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,230,119,112, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 59,148,191,188,242, 56,191,189,111,113, 64,
-190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,160, 91,105, 1, 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,203, 21,192, 61,216, 22, 8, 63,188, 84, 66, 63,159, 70,186, 62,240,211, 98, 62,
-124, 7,155, 62, 12,134,246, 62,108, 16, 79,190,248,197,252,189, 80,188, 39, 63, 42,204,169, 62,204,195,154, 62,146,225, 51, 62,
-125,254, 66, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,123, 26, 81, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 32,179,252,191, 87,102,184,191,168,174, 51, 64,190, 81, 55,191,109,243, 71,191, 98,237, 42, 63,234,163,214, 62,
-201,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,192, 92,105, 1,
- 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,233, 50,144,190,
-207, 31, 50,191,179,203, 40,191,211, 99, 45,189,108,153, 34,190,239, 94, 10,191,114,186,212,190, 40,234, 19,190, 72, 26, 97,191,
-128,105, 99, 61, 46,210, 21, 62,250, 32,186, 62,196,126,178, 62, 86,238, 16, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,131,240,124, 60, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,244, 77,192, 37, 52,163,190, 30,234, 62, 64,
-190, 81, 55,191,107,243, 71,191,100,237, 42, 63,233,163,214, 62,200,206,183,190,204,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,224, 93,105, 1, 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,125, 41,112, 63, 48,166,164, 61, 88, 4,240, 61, 15,172,161, 62,106,126,191,190,
-116, 33, 64, 63,128,227,184, 62, 92, 20,244,190,208,168,180,189, 60, 25, 43,191, 90,246,198, 61, 31,130, 46, 63,224,241, 54, 62,
-222, 41, 46, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,190,196,107, 62,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,251, 27,122, 63,181,229,133,191, 64, 39,149, 64,190, 81, 55,191,109,243, 71,191, 98,237, 42, 63,234,163,214, 62,
-201,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 95,105, 1,
- 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,191, 46, 24,191,
- 41, 20, 43,191,185,184,183, 62, 44,173,136, 62, 76, 75, 50, 63, 40, 83,126, 62,188,195, 8, 63,232,211,238, 62, 64, 36,152, 61,
-236,106,145, 62,215, 4,239, 62,239,100, 21, 61,177, 73, 20, 61, 82,197,235, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 93,122, 57, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 66,151,191,209,139, 62,192, 97,118, 5, 64,
-190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 32, 96,105, 1, 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,158,160, 32,190,190, 39, 52,191,142,138, 9,191,138, 13,224, 62,168,218,242, 62,
- 92, 71, 26, 63, 32, 22, 52, 62,232, 52,124, 62,164, 91,192,190,148,111, 86,191,207,101,120, 61, 65, 26,221, 61,159, 82, 22, 63,
-241, 14,122, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,195, 96, 22, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,208, 63, 46,190,222,105,107,191,197,191,132, 64,190, 81, 55,191,109,243, 71,191, 98,237, 42, 63,234,163,214, 62,
-201,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,128, 3,105, 1,
- 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, 47,202, 55, 63,
-247,235, 89,190,127, 18, 92,190,146,129, 32,191, 8,212, 8,190,168, 50,171,190, 96,120,123, 62,232,152,249,189,140, 18,149, 62,
- 32,111, 13, 61, 91,238,204, 62, 9, 90, 39, 62,122,156, 6, 62, 99, 22,156, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,115, 61, 18, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,250,148,234,190, 11,179, 97,192, 16,215, 3, 64,
-190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,160, 4,105, 1, 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,177,227,248,190,160,134,192,190,155,159,184, 62,105,157, 51, 63, 2, 56, 54, 63,
- 88,126,182, 62, 0,207, 4,187, 40,216,198, 62,140, 66, 73,191,144,126,248, 61,250, 26,119, 60, 35,207,150, 60,170,176, 20, 63,
-225,120,197, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,208,234,216, 62,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,202,177,135,191,150,220, 86,192,144, 9,239, 63,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,
-202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,192, 5,105, 1,
- 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,201,122, 18,191,
-155, 68,163,190,236, 36, 39,191,221,182,194,190,216, 47, 98,190, 98, 46,230,190,196,236,134, 62,192, 40,187, 60,112, 92,179,189,
- 72, 17, 54, 63, 87,169, 5, 61,120,116, 92, 61,179,253, 38, 63,225,192,133, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,100, 58,154, 60, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,214,105,108,192,107,145,223, 62,196,182, 82, 64,
-190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,224, 6,105, 1, 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,192,244, 32,190,175,189,218,190,167, 11, 55, 62,157, 75, 95,191, 32,155,243,190,
-180, 86, 90,191, 56,237, 86, 62,224,198,126,190, 32, 34,101, 61, 92,239,180,190,206, 82,204, 61, 44,113, 89, 63, 62, 63, 23, 61,
-219, 33,100, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 6, 63, 50, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 92, 23,243, 62, 46,133,166,191, 79,153,134, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,
-202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 8,105, 1,
- 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,173,218, 49,191,
-113,109, 23,191, 30, 16, 55, 62, 55,117,188,190, 24, 20,208, 62,118,245, 46,191, 0,158,236,186, 55, 10, 97,191,140,128,183, 62,
-178,230,146,190,158, 2,190, 62, 33,141,193, 61,217, 93,214, 61,163, 2,220, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 96, 85, 48, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,130,192,214,190,181, 57, 73,192,176, 83, 23, 64,
-190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 32, 9,105, 1, 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,206,172, 34,191, 67, 79,187, 62,140,197, 11, 62,199,135, 42, 63, 96, 91,148, 61,
-128, 75, 25, 60, 56,126,232,189,208,190,220,189, 8,158,186, 62,182, 62,225,190,213,103, 84, 61, 92,194,115, 61,146,216,253, 62,
- 40, 34,201, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 38,103,162, 62,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,123, 4,133,192, 83,136,128, 62,136, 58, 58, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,
-202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 64, 10,105, 1,
- 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,147,206,137, 62,
-234,207, 11, 63,195,144,225, 62,162,225, 40, 63, 24, 69,148,190, 48,238,190, 61, 13, 31, 86,191,218,106, 71, 63,248, 60, 1, 62,
-160,250,136, 62,231, 78,156, 58,143,100,108, 63, 18, 72,153, 61, 52, 34, 17, 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,174,199, 41, 60, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,116, 40, 12, 62,101, 32, 1,192,220,178, 95, 64,
-190, 81, 55,191,109,243, 71,191, 98,237, 42, 63,234,163,214, 62,201,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 96, 11,105, 1, 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,159, 57, 95, 63,237,148,214, 62, 88,249,109, 62,231,220,204,189,240,118,221,189,
-121,162, 19,191,202, 50, 48,191, 56,232, 80,190,142,100, 8,191,228,142, 19, 63,225,196, 88, 62,137, 94,237, 61,140, 5, 97, 62,
- 40,195,231, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 75, 11, 15, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,211,109, 80, 63, 95,210, 20,192,246,253,103, 64,190, 81, 55,191,107,243, 71,191,102,237, 42, 63,233,163,214, 62,
-202,206,183,190,201,137, 61,190,157, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,128, 12,105, 1,
- 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, 89, 32,133, 62,
- 13,201,189,190, 54, 43, 66, 63, 73,254,239, 62, 0,164,179, 62, 0,181,171,188,128, 8,196, 60,214, 27, 14,191, 86, 32,128,190,
-190, 27,208,190, 68,196, 53, 62,136,184,135, 61,240,250, 35, 62, 34,153, 24, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,224, 93,234, 62, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,240,142,147,191, 8, 7,166,190, 61, 69,130, 64,
-190, 81, 55,191,106,243, 71,191,102,237, 42, 63,233,163,214, 62,201,206,183,190,202,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,160, 13,105, 1, 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, 45,246,249, 62,199,102,140, 62,155,199, 10, 63, 39,102, 32, 63, 78, 10, 19,191,
-224,238,250,190, 0, 13,111,190,240,232,187, 61,104, 10, 99, 62,164, 96,221, 62, 56,243,206, 62,109,170,159, 62,223,145, 2, 62,
-211, 50, 32, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 35,143, 25, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 6,254, 89,191,191,197, 85,192,180,197,254, 63,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,
-202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,192, 14,105, 1,
- 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,121,125,204, 62,
- 38, 10, 46, 63, 69, 71, 26,190,131,168, 24, 63,116,105, 36,190,144,220, 32, 63, 12,167,231, 62,152,145,179, 62, 32, 72, 36,190,
- 42, 67, 50,191,130, 3, 11, 61, 13, 3, 76, 61,228,181, 28, 63,102,179,155, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,244,186,188, 62, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 46,253,191,200,126,214, 61,251, 1,125, 64,
-190, 81, 55,191,109,243, 71,191,100,237, 42, 63,233,163,214, 62,201,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,224, 15,105, 1, 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,170,218,181,190,161,100, 80, 63, 86, 18,175,190,141, 51,157,190, 18, 35, 4,191,
-208,113,210, 62, 0,170, 11, 63,134,126,165,190,144, 47, 59, 62,104,163, 62,191, 20,251,181, 62,223,163,242, 62, 90, 98,191, 61,
-223, 33,158, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 83, 76,104, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,114, 18, 94,192,208, 61, 49, 61, 94,153, 71, 64,190, 81, 55,191,107,243, 71,191,100,237, 42, 63,233,163,214, 62,
-200,206,183,190,204,137, 61,190,157, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 17,105, 1,
- 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,125, 41,112, 63,
- 48,166,164, 61, 88, 4,240, 61, 15,172,161, 62,106,126,191,190,116, 33, 64, 63,128,227,184, 62, 92, 20,244,190,208,168,180,189,
- 60, 25, 43,191,145,188,190, 61,117,157, 68, 63,105,119,224, 61,118,129,239, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,190,196,107, 62, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 34,141,191,223,140, 39,192,178, 55, 25, 64,
-190, 81, 55,191,109,243, 71,191, 98,237, 42, 63,234,163,214, 62,201,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 32, 18,105, 1, 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,193, 40, 85, 63,120, 79,146,190, 68,249,203,190,206,217,131, 62,230, 65, 22, 63,
-120,104, 63, 63,176,135,124,189,130,179,190,190,208, 81,171, 62,210,132, 69, 63,122, 6,189, 61, 59,195, 23, 62, 10,114,254, 62,
-188,106,134, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,179,102, 20, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,149, 14, 63,192, 64,204,165,191, 11, 96, 24, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,
-202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 64, 19,105, 1,
- 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, 54, 81, 30,191,
-157, 39,223, 62,214, 30, 11, 63, 76, 51,186, 62,208,228, 83, 62,224,146, 0, 61, 22,106,121, 63, 0,124, 6,187, 0,234, 71,187,
-216,190,173, 62, 15, 67, 83, 61,192,186, 4, 63, 40,206,197, 62,178,159, 50, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,208, 19, 52, 60, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,183,180, 22,192,125,173, 4,192,238,189, 8, 64,
-190, 81, 55,191,107,243, 71,191, 98,237, 42, 63,234,163,214, 62,198,206,183,190,203,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 96, 20,105, 1, 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,105, 59, 20,191, 31, 36, 17, 63,112, 57,252,190, 32,101,162, 62,140, 6,160, 62,
- 64,160, 80, 61,112,243,245, 61, 40, 18,224,190,192,154,227,188,238,196,139,190,133, 49,131, 61,129, 33,167, 62,160,225, 5, 63,
-124, 59,177, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 20,166, 56, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 24,160, 97, 63,127,220,163,191,193,248,141, 64,192, 81, 55,191,107,243, 71,191, 98,237, 42, 63,234,163,214, 62,
-197,206,183,190,202,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,128, 21,105, 1,
- 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,180,149,157, 62,
-171,241,150, 62,211, 72, 5, 63,196, 98, 61,191, 94, 43,103,191,144,249, 13, 62,108, 40, 28,190,176,143, 89,189,160,169,180, 62,
- 50,210,102, 63, 78,174,206, 62, 66,159, 93, 61,158, 84,118, 61, 56,211,246, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,234, 53,126, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5,223, 18,192,153,169,140,191,151, 18, 57, 64,
-190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,160, 22,105, 1, 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,187, 63, 44, 63,134,104,136, 62, 45,117, 32, 63,178,227,147,190,254, 77, 90, 63,
- 0,117,175,190,120, 69,167, 62,240, 73,138, 61, 56,211,189, 62,210, 28, 37,191,245, 96, 21, 62, 38,104,227, 62, 82, 62,154, 62,
- 62,164,222, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,130, 27,151, 62,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,100,193,179,191,252,111, 78,192,161, 64,228, 63,190, 81, 55,191,109,243, 71,191, 98,237, 42, 63,234,163,214, 62,
-201,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,192, 23,105, 1,
- 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,129,101, 4,191,
-237, 90, 0, 63,105,125,239,190,131, 31, 3, 63,200,160,212,190,114,217, 27, 63, 56,189, 6,190,132,223, 22,190, 4,241,223,190,
- 4, 70, 0,190, 38,242, 35, 61,205,214,171, 61,176, 25, 46, 63, 82,177, 72, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,184,249,202, 62, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 91, 90,124,191,113, 48,212,191, 57,208, 74, 64,
-190, 81, 55,191,109,243, 71,191,100,237, 42, 63,232,163,214, 62,202,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,224, 24,105, 1, 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,178, 25,236,189,127,158, 27, 63,122,235,239, 62, 59,108, 33, 63,244,198,103,190,
-252,192,187, 62,180, 39,101,190,108,210,138, 62,145,168, 54,191,208, 20, 63,190,188,178, 81, 62,178, 57,108, 62, 93,177,153, 62,
-110, 88,135, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 2,210,109, 63,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,252,231, 33,192,132, 2, 59,191, 77,162, 66, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,233,163,214, 62,
-201,206,183,190,200,137, 61,190,158, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 26,105, 1,
- 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,191, 46, 24,191,
- 41, 20, 43,191,185,184,183, 62, 44,173,136, 62, 76, 75, 50, 63, 40, 83,126, 62,188,195, 8, 63,232,211,238, 62, 64, 36,152, 61,
-236,106,145, 62,215, 15, 30, 62,227,209, 4, 63,181,148,117, 62,217, 39,178, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 93,122, 57, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4,185,138, 63,193,128, 41,192,138,193, 97, 64,
-190, 81, 55,191,109,243, 71,191,102,237, 42, 63,236,163,214, 62,200,206,183,190,203,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0,190,114, 1, 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,229,120,168, 62,178,154, 7,191, 41,180, 48, 63,240,232,187,190, 9, 35,104,191,
-224, 8,114, 62, 76,143,177,190,106, 29, 28,191,208,112,234, 62, 8,249, 92,190,244,195,250, 61, 74,120, 62, 61,198, 12, 31, 62,
-203,252, 44, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 74, 4,184, 62,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,234, 63,243,190, 82,176,159,191,246,150,111, 64,190, 81, 55,191,107,243, 71,191,102,237, 42, 63,233,163,214, 62,
-202,206,183,190,201,137, 61,190,157, 38, 80,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 32,191,114, 1,
- 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,167, 26, 58,191,
- 2, 70,159, 62,113,111, 2, 63,234,187,173,190,116, 51,237, 62,128, 53,247, 62,244,199, 26,190,232, 88,172,189,120,115,244, 62,
- 34,147, 5,191,219, 77,158, 62, 43,131, 72, 62,117,208, 68, 62, 85, 8,155, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63,253,152,110, 63, 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,198,178, 48,191,138, 39, 52, 62, 40,252,149, 64,
-190, 81, 55,191,107,243, 71,191,102,237, 42, 63,233,163,214, 62,202,206,183,190,201,137, 61,190,157, 38, 80,191, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 64,192,114, 1, 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, 43,167,210,190,195,172,139, 62,250,220, 35, 63, 30,182, 22,191,128, 3,136, 61,
-110,164,176,190, 30,153,147,190, 0,249, 10,188,234, 90,160,190, 90,241,205,190, 62, 71, 19, 63,111,215,107, 62, 63, 71,138, 61,
-242,231, 1, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,200, 66, 0, 0,200, 66, 0, 0, 0, 0, 0, 0,128, 63, 37,227, 77, 62,
- 0, 0, 0, 0,255,255,255,255, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 80, 96,114, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,255,223,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187,255,223,124, 60,187, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,
-255, 61, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 7, 85,145,188, 31,224,124, 61,125,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,203, 20,227,188, 15,143,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,168,127, 35,189, 15, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 43,138, 94,189,
-151,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0,255, 84,145,189, 31,224,124, 62,140, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 32, 19,124, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,
-255,223,124, 59, 57,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 85,145,187, 63,224,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,200,127, 35,188, 15, 62, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 39, 85,145,188, 31,224,124, 61,126,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,235, 20,227,188,
- 23,143,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,184,127, 35,189, 15, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 91,138, 94,189,151,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 39, 85,145,189, 35,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,176,101,114, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,255,223,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 71, 85,145,187,191,223,124, 60,186, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,200,127, 35,188,
-239, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 55, 85,145,188,255,223,124, 61,125,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,251, 20,227,188,255,142,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,192,127, 35,189, 7, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 67,138, 94,189,
-143,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 23, 85,145,189, 23,224,124, 62,141, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,128,127, 92, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,
-255,223,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 85,145,187,255,223,124, 60,188, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,128, 35,188, 15, 62, 14, 61,221,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 71, 85,145,188, 15,224,124, 61,128,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0, 11, 21,227,188,
- 7,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,200,127, 35,189, 3, 62, 14, 62,165,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 75,138, 94,189,139,155, 65, 62,185,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 23, 85,145,189, 19,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,208,220,114, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 85,145,186,255,222,124, 59, 59,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187,191,223,124, 60,188, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,
-223, 61, 14, 61,221,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0,223, 84,145,188,223,223,124, 61,128,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,171, 20,227,188,255,142,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,152,127, 35,189, 3, 62, 14, 62,166,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 27,138, 94,189,
-135,155, 65, 62,186,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0,251, 84,145,189, 19,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 0,219,135, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 80,145,186,
-255,223,124, 59, 59,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 84,145,187,191,223,124, 60,189, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,126, 35,188,255, 61, 14, 61,221,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,135, 84,145,188,255,223,124, 61,128,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0, 75, 20,227,188,
- 7,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,104,127, 35,189, 11, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0,235,137, 94,189,143,155, 65, 62,185,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0,231, 84,145,189, 27,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 80, 0,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,255,223,124, 59, 59,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0,135, 84,145,187,255,223,124, 60,188, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 72,127, 35,188,
-255, 61, 14, 61,221,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0,167, 84,145,188, 15,224,124, 61,127,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,139, 20,227,188, 7,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,120,127, 35,189, 11, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0,251,137, 94,189,
-143,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0,239, 84,145,189, 27,224,124, 62,141, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,224, 45,122, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,
-255,222,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,135, 85,145,187,191,223,124, 60,186, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,128, 35,188,239, 61, 14, 61,218,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 39, 85,145,188, 15,224,124, 61,124,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0, 11, 21,227,188,
- 7,143,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,200,127, 35,189, 7, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 91,138, 94,189,143,155, 65, 62,185,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 23, 85,145,189, 23,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 16,144,124, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,255,222,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187,191,223,124, 60,187, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,127, 35,188,
-239, 61, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0,199, 84,145,188,255,223,124, 61,125,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,139, 20,227,188,255,142,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,136,127, 35,189, 7, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 11,138, 94,189,
-147,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0,247, 84,145,189, 23,224,124, 62,140, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 48,145,124, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,
-255,223,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,135, 84,145,187,255,223,124, 60,186, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188, 7, 62, 14, 61,218,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,247, 84,145,188, 23,224,124, 61,125,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,203, 20,227,188,
- 15,143,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,168,127, 35,189, 15, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 51,138, 94,189,151,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 7, 85,145,189, 29,224,124, 62,141, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,112,111,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,255,223,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187, 63,224,124, 60,187, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,200,127, 35,188,
- 7, 62, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 7, 85,145,188, 7,224,124, 61,125,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,203, 20,227,188, 15,143,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,168,127, 35,189, 15, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 75,138, 94,189,
-149,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 15, 85,145,189, 29,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,144,112,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,
-255,221,124, 59, 54,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,135, 84,145,187,127,223,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,127, 35,188,191, 61, 14, 61,218,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,135, 84,145,188,191,223,124, 61,124,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0, 75, 20,227,188,
-239,142,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,104,127, 35,189,255, 61, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0,235,137, 94,189,131,155, 65, 62,183,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0,223, 84,145,189, 11,224,124, 62,141, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,160,161,114, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,255,223,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0,135, 84,145,187,255,223,124, 60,188, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,
-255, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0,199, 84,145,188,255,223,124, 61,126,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,139, 20,227,188,255,142,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,136,127, 35,189,255, 61, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0,251,137, 94,189,
-143,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0,231, 84,145,189, 15,224,124, 62,140, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,192,162,114, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,
-255,222,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,135, 85,145,187,255,223,124, 60,188, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,232,127, 35,188,255, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 39, 85,145,188,255,223,124, 61,126,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0, 11, 21,227,188,
- 19,143,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,200,127, 35,189, 15, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 91,138, 94,189,155,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 27, 85,145,189, 35,224,124, 62,141, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,192,145,114, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,255,223,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187, 63,224,124, 60,188, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,128, 35,188,
- 15, 62, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 71, 85,145,188, 15,224,124, 61,126,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0, 11, 21,227,188, 15,143,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,200,127, 35,189, 15, 62, 14, 62,165,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 75,138, 94,189,
-147,155, 65, 62,185,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 39, 85,145,189, 27,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,224,146,114, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,
-255,223,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,199, 84,145,187,191,223,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,104,127, 35,188,255, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,231, 84,145,188, 15,224,124, 61,126,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,187, 20,227,188,
- 7,143,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,152,127, 35,189, 11, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 27,138, 94,189,143,155, 65, 62,185,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 3, 85,145,189, 27,224,124, 62,141, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 0,148,114, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,255,221,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0,135, 83,145,187,127,223,124, 60,188, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,200,126, 35,188,
-223, 61, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0,167, 84,145,188,223,223,124, 61,126,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,139, 20,227,188,239,142,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,120,127, 35,189,247, 61, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 11,138, 94,189,
-127,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0,239, 84,145,189, 7,224,124, 62,141, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 16, 45,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,
-255,223,124, 59, 57,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 85,145,187,255,223,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,168,127, 35,188, 15, 62, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 7, 85,145,188, 31,224,124, 61,126,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,235, 20,227,188,
- 15,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,168,127, 35,189, 7, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 75,138, 94,189,143,155, 65, 62,186,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 23, 85,145,189, 23,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 48, 46,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,255,223,124, 59, 57,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187,191,223,124, 60,187, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,
-239, 61, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 7, 85,145,188,239,223,124, 61,126,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,235, 20,227,188,255,142,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,184,127, 35,189, 3, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 75,138, 94,189,
-139,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 23, 85,145,189, 19,224,124, 62,141, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 80, 47,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,
-255,222,124, 59, 57,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 84,145,187,191,223,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,255, 61, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 7, 85,145,188, 15,224,124, 61,125,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,203, 20,227,188,
- 7,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,168,127, 35,189, 11, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 43,138, 94,189,139,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 7, 85,145,189, 23,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,192,216,114, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,255,222,124, 59, 55,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0,135, 84,145,187,191,223,124, 60,187, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,127, 35,188,
-239, 61, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0,199, 84,145,188, 15,224,124, 61,125,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,139, 20,227,188, 7,143,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,120,127, 35,189, 11, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 11,138, 94,189,
-147,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0,247, 84,145,189, 27,224,124, 62,141, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,224,217,114, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,
-255,223,124, 59, 57,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 85,145,187,255,223,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,168,127, 35,188, 15, 62, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,247, 84,145,188, 15,224,124, 61,127,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,203, 20,227,188,
- 15,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,168,127, 35,189, 15, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 59,138, 94,189,151,155, 65, 62,186,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 19, 85,145,189, 31,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 0,219,114, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0,135, 84,145,186,255,223,124, 59, 57,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187,255,223,124, 60,187, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,200,127, 35,188,
- 15, 62, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 31, 85,145,188, 31,224,124, 61,125,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,243, 20,227,188, 23,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,180,127, 35,189, 15, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 71,138, 94,189,
-155,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 25, 85,145,189, 35,224,124, 62,140, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 64,235,104, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 85,145,186,
-255,223,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,199, 84,145,187,127,223,124, 60,188, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,168,127, 35,188,223, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,247, 84,145,188,223,223,124, 61,127,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,203, 20,227,188,
-255,142,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,168,127, 35,189,255, 61, 14, 62,165,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 51,138, 94,189,135,155, 65, 62,185,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 11, 85,145,189, 15,224,124, 62,141, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 96,236,104, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 88,145,186,255,223,124, 59, 60,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0,135, 85,145,187,255,223,124, 60,188, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,200,127, 35,188,
-223, 61, 14, 61,222,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 71, 85,145,188,255,223,124, 61,128,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0, 11, 21,227,188,255,142,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,200,127, 35,189, 7, 62, 14, 62,165,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 75,138, 94,189,
-135,155, 65, 62,186,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 23, 85,145,189, 23,224,124, 62,143, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,128,237,104, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,
-255,223,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 85,145,187,255,223,124, 60,186, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188, 15, 62, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 7, 85,145,188, 31,224,124, 61,125,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,235, 20,227,188,
- 19,143,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,168,127, 35,189, 13, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 59,138, 94,189,147,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 23, 85,145,189, 31,224,124, 62,140, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,128, 5,124, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 88,145,186,255,223,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0,135, 85,145,187, 63,224,124, 60,187, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,
- 15, 62, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 39, 85,145,188, 31,224,124, 61,126,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,235, 20,227,188, 23,143,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,184,127, 35,189, 19, 62, 14, 62,165,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 75,138, 94,189,
-151,155, 65, 62,185,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 7, 85,145,189, 27,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,160, 6,124, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 85,145,186,
-255,221,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 85,145,187,127,223,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,168,127, 35,188,255, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,255, 84,145,188,255,223,124, 61,126,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,195, 20,227,188,
-255,142,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,148,127, 35,189,255, 61, 14, 62,165,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 31,138, 94,189,131,155, 65, 62,185,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 1, 85,145,189, 11,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,192, 7,124, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 85,145,186,255,223,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187,191,223,124, 60,188, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,
-255, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0,247, 84,145,188,255,223,124, 61,126,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,203, 20,227,188, 7,143,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,160,127, 35,189, 7, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 43,138, 94,189,
-143,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0,255, 84,145,189, 23,224,124, 62,141, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,224, 8,124, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,
-255,223,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,199, 84,145,187, 31,224,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,168,127, 35,188, 15, 62, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 23, 85,145,188, 31,224,124, 61,125,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,251, 20,227,188,
- 31,143,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,192,127, 35,189, 19, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 83,138, 94,189,153,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 23, 85,145,189, 31,224,124, 62,140, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 0, 10,124, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 88,145,186,255,223,124, 59, 59,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187, 63,224,124, 60,188, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,
- 15, 62, 14, 61,221,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 7, 85,145,188, 31,224,124, 61,127,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,235, 20,227,188, 15,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,184,127, 35,189, 15, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 43,138, 94,189,
-143,155, 65, 62,185,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 15, 85,145,189, 15,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 32, 11,124, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 88,145,186,
-255,221,124, 59, 54,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 86,145,187,255,223,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,128, 35,188,255, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 71, 85,145,188, 31,224,124, 61,127,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0, 75, 21,227,188,
- 31,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,200,127, 35,189, 15, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 75,138, 94,189,151,155, 65, 62,186,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 23, 85,145,189, 31,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 32,124,114, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,127,223,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 84,145,187,223,223,124, 60,186, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,127, 35,188,
-247, 61, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0,199, 84,145,188, 7,224,124, 61,125,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,139, 20,227,188, 7,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,136,127, 35,189, 9, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 11,138, 94,189,
-141,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0,247, 84,145,189, 21,224,124, 62,140, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 64,125,114, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,
-255,223,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 85,145,187,255,223,124, 60,186, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,255, 61, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 7, 85,145,188, 31,224,124, 61,125,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,235, 20,227,188,
- 23,143,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,184,127, 35,189, 19, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 59,138, 94,189,147,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 15, 85,145,189, 31,224,124, 62,140, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 96,126,114, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 88,145,186,255,223,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187,127,223,124, 60,186, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,
-223, 61, 14, 61,218,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 7, 85,145,188,255,223,124, 61,123,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,139, 20,227,188,255,142,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,136,127, 35,189, 7, 62, 14, 62,163,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 43,138, 94,189,
-143,155, 65, 62,183,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0,247, 84,145,189, 23,224,124, 62,141, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,128,127,114, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,
-127,224,124, 59, 57,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,135, 84,145,187, 31,224,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188, 23, 62, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 7, 85,145,188, 39,224,124, 61,125,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,235, 20,227,188,
- 27,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,184,127, 35,189, 21, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 91,138, 94,189,157,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 31, 85,145,189, 41,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,160,128,114, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0,135, 85,145,186,255,223,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0,199, 84,145,187,255,223,124, 60,188, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,168,127, 35,188,
- 7, 62, 14, 61,221,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0,255, 84,145,188, 15,224,124, 61,127,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,203, 20,227,188, 15,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,176,127, 35,189, 13, 62, 14, 62,166,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 51,138, 94,189,
-147,155, 65, 62,186,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 11, 85,145,189, 27,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,192,129,114, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 82,145,186,
-255,223,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 84,145,187,255,223,124, 60,186, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 72,127, 35,188, 31, 62, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,231, 84,145,188, 31,224,124, 61,124,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,171, 20,227,188,
- 31,143,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,120,127, 35,189, 23, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 11,138, 94,189,167,155, 65, 62,182,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0,247, 84,145,189, 47,224,124, 62,140, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 64,106,127, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,127,223,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0,199, 84,145,187,255,223,124, 60,188, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,
- 15, 62, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0,247, 84,145,188, 31,224,124, 61,127,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,203, 20,227,188, 23,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,160,127, 35,189, 19, 62, 14, 62,166,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 35,138, 94,189,
-155,155, 65, 62,186,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0,255, 84,145,189, 39,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 96,107,127, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,
-255,223,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 85,145,187,255,223,124, 60,189, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,128, 35,188, 15, 62, 14, 61,221,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 71, 85,145,188, 15,224,124, 61,127,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0, 11, 21,227,188,
- 7,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,168,127, 35,189, 7, 62, 14, 62,166,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 75,138, 94,189,143,155, 65, 62,186,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 23, 85,145,189, 19,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,128,108,127, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 80,145,186,255,223,124, 59, 52,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 84,145,187,127,223,124, 60,186, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,127, 35,188,
-223, 61, 14, 61,218,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0,135, 84,145,188,255,223,124, 61,125,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0, 75, 20,227,188,239,142,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,104,127, 35,189,255, 61, 14, 62,165,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0,235,137, 94,189,
-135,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0,231, 84,145,189, 19,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,160,109,127, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,
-255,223,124, 59, 60,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,231, 84,145,187,255,223,124, 60,188, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,200,127, 35,188,255, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 7, 85,145,188,255,223,124, 61,126,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,235, 20,227,188,
- 15,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,184,127, 35,189, 7, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 75,138, 94,189,135,155, 65, 62,186,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 23, 85,145,189, 23,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,192,110,127, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,255,223,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187,255,223,124, 60,186, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,200,127, 35,188,
-255, 61, 14, 61,218,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 71, 85,145,188,255,223,124, 61,124,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0, 11, 21,227,188, 15,143,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,168,127, 35,189, 7, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 43,138, 94,189,
-145,155, 65, 62,182,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 7, 85,145,189, 23,224,124, 62,140, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,224,111,127, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 88,145,186,
-255,223,124, 59, 60,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 86,145,187,127,223,124, 60,189, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,128, 35,188,255, 61, 14, 61,222,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 71, 85,145,188,255,223,124, 61,129,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0, 43, 21,227,188,
-255,142,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,216,127, 35,189, 3, 62, 14, 62,165,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 75,138, 94,189,139,155, 65, 62,185,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 31, 85,145,189, 19,224,124, 62,143, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 0,113,127, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,255,222,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0,135, 84,145,187,191,223,124, 60,186, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 72,127, 35,188,
-255, 61, 14, 61,218,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0,199, 84,145,188,255,223,124, 61,126,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,171, 20,227,188, 3,143,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,136,127, 35,189, 7, 62, 14, 62,165,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 11,138, 94,189,
-143,155, 65, 62,185,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0,239, 84,145,189, 23,224,124, 62,141, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 16,133,114, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 90,145,186,
-255,223,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,135, 85,145,187,255,223,124, 60,188, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,128, 35,188,255, 61, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 39, 85,145,188, 31,224,124, 61,126,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,235, 20,227,188,
- 15,143,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,200,127, 35,189, 15, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 75,138, 94,189,151,155, 65, 62,185,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 23, 85,145,189, 31,224,124, 62,141, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 48,134,114, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,255,223,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 84,145,187,191,223,124, 60,186, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,127, 35,188,
-239, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0,199, 84,145,188,239,223,124, 61,126,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0, 75, 20,227,188,243,142,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,104,127, 35,189, 1, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0,235,137, 94,189,
-133,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0,247, 84,145,189, 15,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 80,135,114, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 85,145,186,
-255,223,124, 59, 57,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 85,145,187,255,223,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,104,127, 35,188, 15, 62, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,231, 84,145,188, 31,224,124, 61,126,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,187, 20,227,188,
- 23,143,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,152,127, 35,189, 19, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 35,138, 94,189,151,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0,255, 84,145,189, 31,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,112,136,114, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,255,222,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187,191,223,124, 60,187, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,127, 35,188,
-255, 61, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0,199, 84,145,188,247,223,124, 61,127,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,139, 20,227,188,247,142,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,136,127, 35,189, 7, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 27,138, 94,189,
-139,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0,255, 84,145,189, 19,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,144,137,114, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 85,145,186,
-255,223,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 39, 85,145,187,255,223,124, 60,188, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,184,127, 35,188,255, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 7, 85,145,188,255,223,124, 61,126,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,235, 20,227,188,
- 15,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,180,127, 35,189, 15, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 59,138, 94,189,143,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 19, 85,145,189, 23,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,176,138,114, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,255,223,124, 59, 57,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187, 63,224,124, 60,187, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,200,127, 35,188,
- 15, 62, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 7, 85,145,188, 31,224,124, 61,126,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0, 11, 21,227,188, 23,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,184,127, 35,189, 15, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 59,138, 94,189,
-151,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 23, 85,145,189, 31,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,208,139,114, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,
-255,222,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 84,145,187,223,223,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,127, 35,188,255, 61, 14, 61,218,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,199, 84,145,188, 15,224,124, 61,124,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,139, 20,227,188,
- 7,143,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,136,127, 35,189, 9, 62, 14, 62,163,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 11,138, 94,189,143,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 7, 85,145,189, 23,224,124, 62,140, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,144, 2,114, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 82,145,186,255,225,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 84,145,187,255,223,124, 60,186, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,127, 35,188,
- 31, 62, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0,199, 84,145,188, 31,224,124, 61,125,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,139, 20,227,188, 47,143,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,168,127, 35,189, 23, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 27,138, 94,189,
-167,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0,247, 84,145,189, 47,224,124, 62,140, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,176, 3,114, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,
-255,222,124, 59, 55,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 85,145,187,255,223,124, 60,186, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,255, 61, 14, 61,218,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 7, 85,145,188,255,223,124, 61,123,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,203, 20,227,188,
-255,142,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,168,127, 35,189, 3, 62, 14, 62,163,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 75,138, 94,189,143,155, 65, 62,183,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 7, 85,145,189, 23,224,124, 62,140, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,208, 4,114, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,255,222,124, 59, 57,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0,135, 84,145,187,191,223,124, 60,187, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,200,127, 35,188,
-239, 61, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 39, 85,145,188,255,223,124, 61,126,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,171, 20,227,188,255,142,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,216,127, 35,189, 7, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 91,138, 94,189,
-135,155, 65, 62,185,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 15, 85,145,189, 19,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,240, 5,114, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 88,145,186,
-255,223,124, 59, 59,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,135, 85,145,187, 63,224,124, 60,189, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,128, 35,188, 15, 62, 14, 61,221,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 71, 85,145,188, 15,224,124, 61,127,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0, 11, 21,227,188,
- 15,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,200,127, 35,189, 11, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 75,138, 94,189,147,155, 65, 62,186,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 23, 85,145,189, 23,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 16, 7,114, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 82,145,186,255,225,124, 59, 57,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187,255,223,124, 60,187, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,
-223, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0,231, 84,145,188,255,223,124, 61,127,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,235, 20,227,188, 15,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,184,127, 35,189, 7, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 59,138, 94,189,
-143,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 15, 85,145,189, 23,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 48, 8,114, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0,135, 84,145,186,
-255,223,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,167, 84,145,187,191,223,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,120,127, 35,188,239, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,231, 84,145,188,255,223,124, 61,127,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,155, 20,227,188,
-255,142,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,128,127, 35,189, 3, 62, 14, 62,166,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 11,138, 94,189,135,155, 65, 62,186,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0,247, 84,145,189, 15,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 80, 9,114, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,255,222,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187,191,223,124, 60,186, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,200,127, 35,188,
-255, 61, 14, 61,218,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 7, 85,145,188,255,223,124, 61,125,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,235, 20,227,188,255,142,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,184,127, 35,189, 7, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 91,138, 94,189,
-143,155, 65, 62,182,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 23, 85,145,189, 23,224,124, 62,140, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,112, 10,114, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 80,145,186,
-255,222,124, 59, 57,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 84,145,187,191,223,124, 60,186, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 72,127, 35,188,223, 61, 14, 61,218,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,199, 84,145,188,239,223,124, 61,126,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,139, 20,227,188,
-255,142,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,136,127, 35,189, 7, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 11,138, 94,189,139,155, 65, 62,185,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0,239, 84,145,189, 19,224,124, 62,141, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,144, 11,114, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,255,223,124, 59, 60,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187,255,223,124, 60,189, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,
- 31, 62, 14, 61,221,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0,231, 84,145,188, 31,224,124, 61,127,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,235, 20,227,188, 15,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,152,127, 35,189, 7, 62, 14, 62,166,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 11,138, 94,189,
-135,155, 65, 62,186,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0,247, 84,145,189, 23,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,208,191,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,
-255,223,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,199, 84,145,187,255,223,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,255, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 7, 85,145,188,255,223,124, 61,126,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,235, 20,227,188,
- 7,143,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,184,127, 35,189, 7, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 67,138, 94,189,143,155, 65, 62,185,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 19, 85,145,189, 23,224,124, 62,141, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,240,192,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 85,145,186,255,223,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187,255,223,124, 60,187, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,168,127, 35,188,
- 7, 62, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 23, 85,145,188, 23,224,124, 61,126,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,251, 20,227,188, 19,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,176,127, 35,189, 15, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 59,138, 94,189,
-149,155, 65, 62,186,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 19, 85,145,189, 27,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 16,194,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 82,145,186,
-255,223,124, 59, 54,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,135, 84,145,187,255,223,124, 60,186, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 72,127, 35,188,255, 61, 14, 61,218,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 7, 85,145,188,255,223,124, 61,123,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,171, 20,227,188,
- 15,143,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,152,127, 35,189, 7, 62, 14, 62,163,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 27,138, 94,189,143,155, 65, 62,183,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0,247, 84,145,189, 15,224,124, 62,139, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 48,195,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,255,221,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 84,145,187,191,223,124, 60,187, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,127, 35,188,
-223, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0,135, 84,145,188,255,223,124, 61,126,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,139, 20,227,188, 7,143,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,104,127, 35,189, 7, 62, 14, 62,163,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0,235,137, 94,189,
-143,155, 65, 62,185,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0,231, 84,145,189, 23,224,124, 62,141, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 80,196,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,
-255,223,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 85,145,187,255,223,124, 60,188, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188, 15, 62, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,231, 84,145,188, 15,224,124, 61,127,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,171, 20,227,188,
- 7,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,168,127, 35,189, 19, 62, 14, 62,165,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 43,138, 94,189,155,155, 65, 62,186,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 7, 85,145,189, 27,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,112,197,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 85,145,186,255,221,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187,127,223,124, 60,188, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,168,127, 35,188,
-255, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 7, 85,145,188,223,223,124, 61,126,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,235, 20,227,188,255,142,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,176,127, 35,189, 7, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 51,138, 94,189,
-135,155, 65, 62,185,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 27, 85,145,189, 15,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,144,198,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,
-255,222,124, 59, 55,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 85,145,187,191,223,124, 60,186, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,200,127, 35,188,239, 61, 14, 61,218,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 7, 85,145,188,255,223,124, 61,124,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,203, 20,227,188,
- 7,143,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,152,127, 35,189, 7, 62, 14, 62,163,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 27,138, 94,189,139,155, 65, 62,183,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0,247, 84,145,189, 19,224,124, 62,140, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,176,199,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,255,223,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187,255,223,124, 60,187, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,200,127, 35,188,
-255, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 39, 85,145,188,255,223,124, 61,127,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,235, 20,227,188, 15,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,168,127, 35,189, 15, 62, 14, 62,165,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 59,138, 94,189,
-143,155, 65, 62,185,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 31, 85,145,189, 23,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,208,200,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,
-127,224,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,135, 84,145,187, 31,224,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188, 7, 62, 14, 61,221,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,231, 84,145,188, 23,224,124, 61,126,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,203, 20,227,188,
- 19,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,152,127, 35,189, 13, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 27,138, 94,189,147,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0,255, 84,145,189, 25,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,240,201,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,255,223,124, 59, 54,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 84,145,187,255,223,124, 60,186, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,127, 35,188,
-223, 61, 14, 61,218,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0,167, 84,145,188,255,223,124, 61,123,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,107, 20,227,188,255,142,197, 61, 78, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,120,127, 35,189,255, 61, 14, 62,162,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0,251,137, 94,189,
-135,155, 65, 62,182,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0,231, 84,145,189, 23,224,124, 62,140, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 16,203,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,
-255,225,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 86,145,187,127,224,124, 60,188, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,128, 35,188, 31, 62, 14, 61,221,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 7, 85,145,188, 31,224,124, 61,128,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0, 11, 21,227,188,
- 31,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,168,127, 35,189, 23, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 75,138, 94,189,159,155, 65, 62,186,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 7, 85,145,189, 39,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 80,166,114, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,255,223,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187,255,223,124, 60,187, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,
-255, 61, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 7, 85,145,188, 15,224,124, 61,125,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,235, 20,227,188, 15,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,184,127, 35,189, 15, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 59,138, 94,189,
-151,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 23, 85,145,189, 31,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,112,167,114, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 80,145,186,
-255,223,124, 59, 60,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,135, 83,145,187,255,223,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,200,126, 35,188,255, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,135, 84,145,188,255,223,124, 61,125,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,107, 20,227,188,
-255,142,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,104,127, 35,189, 7, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0,251,137, 94,189,143,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0,231, 84,145,189, 23,224,124, 62,141, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,144,168,114, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,255,223,124, 59, 55,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187,255,223,124, 60,186, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,
-255, 61, 14, 61,218,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 7, 85,145,188, 31,224,124, 61,125,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,235, 20,227,188, 23,143,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,184,127, 35,189, 19, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0,107,138, 94,189,
-155,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 39, 85,145,189, 31,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,176,169,114, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 85,145,186,
-255,221,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,199, 84,145,187,127,223,124, 60,188, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 72,127, 35,188,223, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,199, 84,145,188,207,223,124, 61,127,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,139, 20,227,188,
-231,142,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,128,127, 35,189,247, 61, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 19,138, 94,189,127,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0,243, 84,145,189, 7,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,208,170,114, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 88,145,186,255,223,124, 59, 57,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0,135, 85,145,187, 31,224,124, 60,186, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,200,127, 35,188,
- 7, 62, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 39, 85,145,188, 23,224,124, 61,126,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,235, 20,227,188, 15,143,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,184,127, 35,189, 17, 62, 14, 62,165,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 75,138, 94,189,
-149,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 23, 85,145,189, 29,224,124, 62,141, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,240,171,114, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,
-255,222,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,135, 84,145,187,223,223,124, 60,186, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,247, 61, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,231, 84,145,188,255,223,124, 61,126,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,171, 20,227,188,
- 3,143,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,152,127, 35,189, 9, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 43,138, 94,189,143,155, 65, 62,185,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0,255, 84,145,189, 23,224,124, 62,141, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 16,173,114, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 80,145,186,255,223,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 84,145,187,255,223,124, 60,186, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,126, 35,188,
-255, 61, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0,135, 84,145,188, 15,224,124, 61,124,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0, 75, 20,227,188, 7,143,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,104,127, 35,189, 11, 62, 14, 62,163,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0,235,137, 94,189,
-143,155, 65, 62,183,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0,231, 84,145,189, 23,224,124, 62,141, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 48,174,114, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,
-255,223,124, 59, 55,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,135, 84,145,187,191,223,124, 60,186, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,255, 61, 14, 61,218,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,199, 84,145,188, 15,224,124, 61,125,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,139, 20,227,188,
- 11,143,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,120,127, 35,189, 11, 62, 14, 62,163,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0,251,137, 94,189,143,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0,231, 84,145,189, 25,224,124, 62,141, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 80,175,114, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,255,224,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0,135, 85,145,187, 63,224,124, 60,187, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,128, 35,188,
- 15, 62, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 71, 85,145,188, 31,224,124, 61,126,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0, 11, 21,227,188, 23,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,184,127, 35,189, 15, 62, 14, 62,165,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 75,138, 94,189,
-155,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 23, 85,145,189, 35,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,112,176,114, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 85,145,186,
-255,223,124, 59, 57,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,199, 84,145,187, 63,224,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188, 15, 62, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,247, 84,145,188, 15,224,124, 61,126,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,219, 20,227,188,
- 7,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,176,127, 35,189, 11, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 59,138, 94,189,139,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 11, 85,145,189, 19,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,144,177,114, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 88,145,186,255,222,124, 59, 59,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 86,145,187,191,223,124, 60,188, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,128, 35,188,
-247, 61, 14, 61,221,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 71, 85,145,188,255,223,124, 61,127,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0, 11, 21,227,188, 3,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,200,127, 35,189, 7, 62, 14, 62,166,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 75,138, 94,189,
-143,155, 65, 62,186,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 23, 85,145,189, 15,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,176,178,114, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,
-255,223,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 85,145,187,255,223,124, 60,186, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,200,127, 35,188,255, 61, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 39, 85,145,188,255,223,124, 61,126,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,235, 20,227,188,
-255,142,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,184,127, 35,189, 7, 62, 14, 62,163,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 75,138, 94,189,143,155, 65, 62,183,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 23, 85,145,189, 27,224,124, 62,141, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,208,179,114, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,255,221,124, 59, 60,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0,135, 84,145,187,127,223,124, 60,188, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,
-191, 61, 14, 61,221,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0,199, 84,145,188,191,223,124, 61,128,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,171, 20,227,188,239,142,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,152,127, 35,189,255, 61, 14, 62,165,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 27,138, 94,189,
-135,155, 65, 62,185,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0,247, 84,145,189, 15,224,124, 62,143, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,240,180,114, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 82,145,186,
-255,223,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 84,145,187,223,223,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,200,126, 35,188,255, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,199, 84,145,188,255,223,124, 61,126,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,139, 20,227,188,
- 7,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,136,127, 35,189, 7, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 11,138, 94,189,139,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0,247, 84,145,189, 19,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 16,182,114, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,255,222,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187,127,223,124, 60,187, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,128, 35,188,
-239, 61, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 71, 85,145,188,239,223,124, 61,125,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0, 11, 21,227,188,255,142,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,200,127, 35,189, 9, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 75,138, 94,189,
-143,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 23, 85,145,189, 27,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 48,183,114, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 85,145,186,
-255,223,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,199, 84,145,187,255,223,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,104,127, 35,188,255, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,247, 84,145,188, 15,224,124, 61,126,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,187, 20,227,188,
- 11,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,152,127, 35,189, 11, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 35,138, 94,189,147,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0,255, 84,145,189, 27,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 80,184,114, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,255,223,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 39, 85,145,187,255,223,124, 60,187, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,216,127, 35,188,
- 15, 62, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 31, 85,145,188, 15,224,124, 61,125,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0, 3, 21,227,188, 23,143,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,196,127, 35,189, 11, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 83,138, 94,189,
-155,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 29, 85,145,189, 35,224,124, 62,140, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 16, 51,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,
-255,221,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,135, 85,145,187,127,223,124, 60,186, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,128, 35,188,255, 61, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 71, 85,145,188,255,223,124, 61,124,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0, 75, 21,227,188,
- 15,143,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,232,127, 35,189, 7, 62, 14, 62,163,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0,139,138, 94,189,151,155, 65, 62,183,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 47, 85,145,189, 27,224,124, 62,140, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 48, 52,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,255,223,124, 59, 57,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0,199, 84,145,187,255,223,124, 60,187, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,
- 15, 62, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 7, 85,145,188, 15,224,124, 61,125,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,219, 20,227,188, 23,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,168,127, 35,189, 19, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 59,138, 94,189,
-147,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 15, 85,145,189, 27,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 80, 53,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,
-255,223,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 71, 85,145,187, 63,224,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,200,127, 35,188,255, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 23, 85,145,188, 15,224,124, 61,127,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,235, 20,227,188,
- 15,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,176,127, 35,189, 15, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 59,138, 94,189,151,155, 65, 62,186,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 11, 85,145,189, 31,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,112, 54,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,255,222,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0,199, 84,145,187,191,223,124, 60,186, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,168,127, 35,188,
-239, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 7, 85,145,188,239,223,124, 61,126,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,219, 20,227,188, 7,143,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,172,127, 35,189, 11, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 51,138, 94,189,
-139,155, 65, 62,185,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 7, 85,145,189, 19,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,144, 55,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 80,145,186,
-255,221,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 84,145,187,255,222,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,127, 35,188,191, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,135, 84,145,188,191,223,124, 61,125,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0, 11, 20,227,188,
-239,142,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0, 72,127, 35,189,247, 61, 14, 62,165,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0,203,137, 94,189,127,155, 65, 62,185,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0,231, 84,145,189, 7,224,124, 62,141, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,176, 56,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,255,224,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 84,145,187, 63,224,124, 60,188, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,
- 15, 62, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0,231, 84,145,188, 15,224,124, 61,126,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,171, 20,227,188, 7,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,144,127, 35,189, 11, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 35,138, 94,189,
-139,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0,255, 84,145,189, 19,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,208, 57,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,
-255,223,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 85,145,187,255,223,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,200,127, 35,188,255, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 7, 85,145,188, 31,224,124, 61,126,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,203, 20,227,188,
-255,142,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,168,127, 35,189, 7, 62, 14, 62,165,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 59,138, 94,189,143,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 23, 85,145,189, 23,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,240, 58,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,255,225,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0,199, 84,145,187,255,223,124, 60,187, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,
-223, 61, 14, 61,221,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0,231, 84,145,188,223,223,124, 61,127,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,203, 20,227,188,239,142,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,160,127, 35,189,255, 61, 14, 62,166,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 35,138, 94,189,
-135,155, 65, 62,186,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 19, 85,145,189, 15,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 16, 60,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 85,145,186,
-255,223,124, 59, 57,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,231, 84,145,187,255,223,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,152,127, 35,188, 15, 62, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,255, 84,145,188, 15,224,124, 61,126,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,219, 20,227,188,
- 15,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,164,127, 35,189, 15, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 47,138, 94,189,143,155, 65, 62,186,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 13, 85,145,189, 23,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 48, 61,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 82,145,186,255,224,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187,127,224,124, 60,188, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,
- 31, 62, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0,231, 84,145,188, 31,224,124, 61,126,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,203, 20,227,188, 31,143,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,168,127, 35,189, 19, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 43,138, 94,189,
-159,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 11, 85,145,189, 39,224,124, 62,140, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 80, 62,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 82,145,186,
-255,223,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,135, 84,145,187,255,223,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,255, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,231, 84,145,188, 15,224,124, 61,126,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,171, 20,227,188,
- 15,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,152,127, 35,189, 7, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 27,138, 94,189,143,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0,255, 84,145,189, 23,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,112, 63,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0,135, 85,145,186,255,223,124, 59, 57,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0,231, 84,145,187,255,223,124, 60,187, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,168,127, 35,188,
- 7, 62, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 7, 85,145,188, 23,224,124, 61,126,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,235, 20,227,188, 19,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,172,127, 35,189, 13, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 67,138, 94,189,
-145,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 11, 85,145,189, 29,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,144, 64,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,
-255,223,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 85,145,187,191,223,124, 60,188, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,128, 35,188,255, 61, 14, 61,221,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 7, 85,145,188, 15,224,124, 61,127,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,203, 20,227,188,
- 15,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,184,127, 35,189, 13, 62, 14, 62,165,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 75,138, 94,189,147,155, 65, 62,186,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 15, 85,145,189, 31,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,176, 65,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 85,145,186,255,223,124, 59, 55,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187,127,224,124, 60,187, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,
-255, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0,247, 84,145,188,223,223,124, 61,127,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,203, 20,227,188, 15,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,168,127, 35,189, 7, 62, 14, 62,165,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 43,138, 94,189,
-135,155, 65, 62,185,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 15, 85,145,189, 23,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,208, 66,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 82,145,186,
-255,222,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 84,145,187,191,223,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,127, 35,188,239, 61, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,135, 84,145,188,247,223,124, 61,125,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,107, 20,227,188,
-255,142,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0, 88,127, 35,189, 3, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0,219,137, 94,189,139,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0,223, 84,145,189, 15,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,240, 67,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 80,145,186,255,223,124, 59, 55,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 84,145,187,255,223,124, 60,186, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,127, 35,188,
- 7, 62, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0,199, 84,145,188, 15,224,124, 61,124,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,139, 20,227,188, 11,143,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,136,127, 35,189, 11, 62, 14, 62,163,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 11,138, 94,189,
-143,155, 65, 62,183,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0,247, 84,145,189, 23,224,124, 62,140, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 16, 69,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 85,145,186,
-127,223,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,199, 84,145,187,223,223,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,255, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,247, 84,145,188, 7,224,124, 61,127,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,219, 20,227,188,
- 11,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,160,127, 35,189, 11, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 51,138, 94,189,147,155, 65, 62,186,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 19, 85,145,189, 31,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,192, 74,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,255,223,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0,135, 85,145,187,255,223,124, 60,188, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,232,127, 35,188,
-255, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 55, 85,145,188,255,223,124, 61,126,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,251, 20,227,188,255,142,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,192,127, 35,189, 7, 62, 14, 62,165,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 75,138, 94,189,
-143,155, 65, 62,185,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 19, 85,145,189, 23,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,224, 75,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,
-255,221,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,199, 84,145,187,127,223,124, 60,186, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,223, 61, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 7, 85,145,188,255,223,124, 61,126,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,187, 20,227,188,
-255,142,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,152,127, 35,189,255, 61, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 35,138, 94,189,135,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 3, 85,145,189, 15,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 0, 77,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,255,223,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187,255,223,124, 60,186, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,
-255, 61, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0,231, 84,145,188,255,223,124, 61,126,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,171, 20,227,188,255,142,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,152,127, 35,189, 7, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 35,138, 94,189,
-139,155, 65, 62,185,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 3, 85,145,189, 15,224,124, 62,141, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 32, 78,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,
-255,223,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 85,145,187,255,223,124, 60,186, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,128, 35,188, 63, 62, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 71, 85,145,188, 63,224,124, 61,125,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0, 11, 21,227,188,
- 47,143,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,200,127, 35,189, 23, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0,107,138, 94,189,159,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 23, 85,145,189, 39,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 64, 79,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 85,145,186,255,223,124, 59, 60,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187,255,223,124, 60,188, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,168,127, 35,188,
-255, 61, 14, 61,221,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 23, 85,145,188, 15,224,124, 61,128,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,219, 20,227,188, 15,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,176,127, 35,189, 15, 62, 14, 62,165,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 51,138, 94,189,
-151,155, 65, 62,186,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 11, 85,145,189, 31,224,124, 62,143, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 96, 80,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,
-255,223,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 85,145,187,255,223,124, 60,186, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,168,127, 35,188, 15, 62, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 7, 85,145,188, 15,224,124, 61,125,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,235, 20,227,188,
- 23,143,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,168,127, 35,189, 19, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 67,138, 94,189,151,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 15, 85,145,189, 31,224,124, 62,140, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,128, 81,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,255,223,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187,191,223,124, 60,187, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,200,127, 35,188,
-239, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 7, 85,145,188,239,223,124, 61,126,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,235, 20,227,188, 7,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,168,127, 35,189, 7, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 75,138, 94,189,
-143,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 23, 85,145,189, 23,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,160, 82,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 85,145,186,
-255,223,124, 59, 57,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,199, 84,145,187,255,223,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,168,127, 35,188,255, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 7, 85,145,188,255,223,124, 61,126,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,235, 20,227,188,
-255,142,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,176,127, 35,189, 7, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 51,138, 94,189,143,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 15, 85,145,189, 15,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,192, 83,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0,135, 84,145,186,255,223,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 39, 85,145,187,255,223,124, 60,187, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,168,127, 35,188,
-255, 61, 14, 61,218,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 23, 85,145,188, 31,224,124, 61,124,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,251, 20,227,188, 15,143,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,192,127, 35,189, 15, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 67,138, 94,189,
-151,155, 65, 62,183,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 27, 85,145,189, 31,224,124, 62,141, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,224, 84,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,
-255,225,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 85,145,187,127,224,124, 60,188, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,128, 35,188, 31, 62, 14, 61,222,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 7, 85,145,188, 63,224,124, 61,128,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0, 43, 21,227,188,
- 31,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,184,127, 35,189, 23, 62, 14, 62,166,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 59,138, 94,189,159,155, 65, 62,186,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 15, 85,145,189, 47,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 0, 86,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 83,145,186,255,223,124, 59, 57,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 84,145,187,127,223,124, 60,186, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,127, 35,188,
-223, 61, 14, 61,218,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0,183, 84,145,188,255,223,124, 61,124,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,139, 20,227,188,255,142,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,128,127, 35,189, 3, 62, 14, 62,163,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 3,138, 94,189,
-139,155, 65, 62,183,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0,235, 84,145,189, 19,224,124, 62,140, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 32, 87,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,
-255,223,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 85,145,187,255,223,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,200,127, 35,188, 7, 62, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,231, 84,145,188, 15,224,124, 61,127,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,203, 20,227,188,
- 15,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,168,127, 35,189, 13, 62, 14, 62,165,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 59,138, 94,189,147,155, 65, 62,186,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 7, 85,145,189, 27,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 64, 88,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,255,222,124, 59, 57,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187,191,223,124, 60,188, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,200,127, 35,188,
-255, 61, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 39, 85,145,188, 15,224,124, 61,126,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,235, 20,227,188, 7,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,184,127, 35,189, 7, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 59,138, 94,189,
-143,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 31, 85,145,189, 27,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 96, 89,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 85,145,186,
-127,223,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,199, 84,145,187,223,223,124, 60,186, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,104,127, 35,188,255, 61, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,247, 84,145,188, 15,224,124, 61,125,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,187, 20,227,188,
- 15,143,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,144,127, 35,189, 11, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 35,138, 94,189,147,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0,251, 84,145,189, 27,224,124, 62,141, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,128, 90,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,255,223,124, 59, 57,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187,191,223,124, 60,187, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,200,127, 35,188,
-239, 61, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 39, 85,145,188,239,223,124, 61,125,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,203, 20,227,188, 7,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,184,127, 35,189, 3, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 75,138, 94,189,
-139,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 23, 85,145,189, 23,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,160, 91,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,
-255,222,124, 59, 59,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,135, 85,145,187,191,223,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,200,127, 35,188,255, 61, 14, 61,221,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 39, 85,145,188, 15,224,124, 61,126,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,235, 20,227,188,
- 11,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,184,127, 35,189, 11, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 59,138, 94,189,145,155, 65, 62,186,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 15, 85,145,189, 27,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,192, 92,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,255,223,124, 59, 57,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0,199, 84,145,187, 31,224,124, 60,188, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,
- 15, 62, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 7, 85,145,188, 23,224,124, 61,126,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,219, 20,227,188, 19,143,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,176,127, 35,189, 13, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 59,138, 94,189,
-149,155, 65, 62,185,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 11, 85,145,189, 25,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,224, 93,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 82,145,186,
-255,223,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 84,145,187, 63,224,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 72,127, 35,188,255, 61, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,167, 84,145,188,255,223,124, 61,125,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,139, 20,227,188,
- 7,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,136,127, 35,189, 11, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 27,138, 94,189,143,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0,247, 84,145,189, 23,224,124, 62,140, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 0, 95,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 83,145,186,255,223,124, 59, 57,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0,199, 84,145,187,255,223,124, 60,187, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,
-255, 61, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 7, 85,145,188,255,223,124, 61,124,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,235, 20,227,188, 15,143,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,184,127, 35,189, 15, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 91,138, 94,189,
-151,155, 65, 62,182,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 23, 85,145,189, 31,224,124, 62,140, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 32, 96,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,
-255,223,124, 59, 57,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 85,145,187, 31,224,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,200,127, 35,188, 15, 62, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 7, 85,145,188, 23,224,124, 61,126,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,203, 20,227,188,
- 19,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,168,127, 35,189, 15, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 75,138, 94,189,147,155, 65, 62,186,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 23, 85,145,189, 27,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,128, 3,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,255,222,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 71, 85,145,187,127,223,124, 60,186, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,200,127, 35,188,
-255, 61, 14, 61,218,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 39, 85,145,188,255,223,124, 61,124,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0, 11, 21,227,188, 7,143,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,192,127, 35,189, 11, 62, 14, 62,163,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 91,138, 94,189,
-151,155, 65, 62,183,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 27, 85,145,189, 31,224,124, 62,140, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,160, 4,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,
-255,223,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,135, 84,145,187, 63,224,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188, 15, 62, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,231, 84,145,188, 31,224,124, 61,126,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,171, 20,227,188,
- 23,143,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,168,127, 35,189, 15, 62, 14, 62,165,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 59,138, 94,189,151,155, 65, 62,185,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 15, 85,145,189, 33,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,192, 5,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,255,223,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187,255,223,124, 60,187, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,
- 7, 62, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 7, 85,145,188, 15,224,124, 61,126,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,203, 20,227,188, 15,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,168,127, 35,189, 15, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 59,138, 94,189,
-151,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 23, 85,145,189, 31,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,224, 6,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 88,145,186,
-255,222,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 86,145,187, 63,224,124, 60,188, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,128, 35,188, 15, 62, 14, 61,221,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 71, 85,145,188, 15,224,124, 61,127,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0, 11, 21,227,188,
- 7,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,200,127, 35,189, 7, 62, 14, 62,166,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 75,138, 94,189,143,155, 65, 62,186,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 39, 85,145,189, 19,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 0, 8,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,255,221,124, 59, 55,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0,199, 84,145,187,255,223,124, 60,186, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,152,127, 35,188,
-223, 61, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 7, 85,145,188,223,223,124, 61,125,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,227, 20,227,188,255,142,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,184,127, 35,189, 7, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 67,138, 94,189,
-135,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 15, 85,145,189, 15,224,124, 62,141, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 32, 9,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,
-255,222,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 85,145,187,223,223,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,200,127, 35,188,255, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 39, 85,145,188, 15,224,124, 61,126,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,203, 20,227,188,
- 7,143,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,184,127, 35,189, 11, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 59,138, 94,189,143,155, 65, 62,185,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 15, 85,145,189, 25,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 64, 10,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,255,223,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187,255,223,124, 60,189, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,
-255, 61, 14, 61,221,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 71, 85,145,188, 31,224,124, 61,127,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,203, 20,227,188, 15,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,168,127, 35,189, 15, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 75,138, 94,189,
-143,155, 65, 62,186,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 7, 85,145,189, 31,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 96, 11,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,
-255,223,124, 59, 57,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 85,145,187,255,223,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,200,127, 35,188, 15, 62, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 39, 85,145,188, 31,224,124, 61,125,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0, 11, 21,227,188,
- 15,143,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,192,127, 35,189, 15, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 83,138, 94,189,151,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 31, 85,145,189, 31,224,124, 62,140, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,128, 12,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,255,221,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0,135, 84,145,187,127,223,124, 60,187, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,
-223, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0,199, 84,145,188,223,223,124, 61,126,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,203, 20,227,188,239,142,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,168,127, 35,189,255, 61, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 43,138, 94,189,
-135,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 7, 85,145,189, 15,224,124, 62,141, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,160, 13,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,
-255,223,124, 59, 57,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,135, 84,145,187,255,223,124, 60,186, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,127, 35,188,255, 61, 14, 61,218,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,167, 84,145,188, 15,224,124, 61,124,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,107, 20,227,188,
- 15,143,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,104,127, 35,189, 15, 62, 14, 62,163,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0,235,137, 94,189,147,155, 65, 62,183,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0,231, 84,145,189, 27,224,124, 62,140, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,192, 14,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,127,223,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0,135, 84,145,187,255,223,124, 60,188, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,
- 7, 62, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0,231, 84,145,188, 23,224,124, 61,127,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,203, 20,227,188, 19,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,168,127, 35,189, 13, 62, 14, 62,165,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 59,138, 94,189,
-149,155, 65, 62,186,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 15, 85,145,189, 29,224,124, 62,143, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,224, 15,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,
-127,223,124, 59, 61,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 85,145,187,223,223,124, 60,188, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,255, 61, 14, 61,222,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 71, 85,145,188, 15,224,124, 61,128,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,235, 20,227,188,
- 11,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,184,127, 35,189, 11, 62, 14, 62,165,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 75,138, 94,189,145,155, 65, 62,186,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 15, 85,145,189, 21,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 0, 17,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,255,223,124, 59, 57,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187,255,223,124, 60,187, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,
-255, 61, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 7, 85,145,188,255,223,124, 61,125,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,203, 20,227,188,255,142,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,168,127, 35,189, 11, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 43,138, 94,189,
-143,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0,255, 84,145,189, 15,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 32, 18,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,
-255,223,124, 59, 59,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,135, 85,145,187,255,223,124, 60,188, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,128, 35,188, 7, 62, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 39, 85,145,188, 23,224,124, 61,126,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0, 11, 21,227,188,
- 19,143,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,200,127, 35,189, 15, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 75,138, 94,189,155,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 31, 85,145,189, 35,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 64, 19,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,255,223,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0,199, 84,145,187,255,223,124, 60,188, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,
-255, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 7, 85,145,188, 15,224,124, 61,126,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,235, 20,227,188, 15,143,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,184,127, 35,189, 15, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 75,138, 94,189,
-147,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 15, 85,145,189, 23,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 96, 20,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,
-255,223,124, 59, 57,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,199, 84,145,187,255,223,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188, 15, 62, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,239, 84,145,188, 31,224,124, 61,125,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,187, 20,227,188,
- 23,143,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,168,127, 35,189, 15, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 43,138, 94,189,151,155, 65, 62,183,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 7, 85,145,189, 27,224,124, 62,140, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,128, 21,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,255,225,124, 59, 59,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0,231, 84,145,187,255,224,124, 60,187, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,104,127, 35,188,
- 63, 62, 14, 61,221,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0,239, 84,145,188, 63,224,124, 61,126,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,195, 20,227,188, 47,143,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,156,127, 35,189, 31, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 55,138, 94,189,
-175,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 5, 85,145,189, 55,224,124, 62,141, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,160, 22,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 84,145,186,
-127,223,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,199, 84,145,187,223,223,124, 60,186, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,104,127, 35,188, 7, 62, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,247, 84,145,188, 7,224,124, 61,126,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,219, 20,227,188,
- 19,143,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,168,127, 35,189, 17, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 59,138, 94,189,149,155, 65, 62,185,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 11, 85,145,189, 29,224,124, 62,141, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0,192, 23,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,255,222,124, 59, 57,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0,135, 85,145,187,255,223,124, 60,187, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,128, 35,188,
- 15, 62, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 39, 85,145,188, 15,224,124, 61,125,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0, 11, 21,227,188, 23,143,197, 61, 80, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,200,127, 35,189, 15, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 91,138, 94,189,
-155,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 31, 85,145,189, 35,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0,224, 24,105, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0,135, 84,145,186,
-255,223,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0,199, 84,145,187,223,223,124, 60,187, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188, 7, 62, 14, 61,221,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,247, 84,145,188, 7,224,124, 61,127,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,211, 20,227,188,
- 11,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,168,127, 35,189, 13, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 51,138, 94,189,147,155, 65, 62,186,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 7, 85,145,189, 27,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 0, 26,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,255,222,124, 59, 57,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187,255,223,124, 60,187, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,200,127, 35,188,
-255, 61, 14, 61,219,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 7, 85,145,188,255,223,124, 61,125,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,235, 20,227,188, 15,143,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,184,127, 35,189, 15, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 59,138, 94,189,
-143,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0, 15, 85,145,189, 27,224,124, 62,142, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 0,190,114, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 86,145,186,
-255,223,124, 59, 58,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 85,145,187,255,223,124, 60,188, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0, 8,128, 35,188,223, 61, 14, 61,221,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0, 39, 85,145,188,255,223,124, 61,127,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0, 11, 21,227,188,
-255,142,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,200,127, 35,189, 7, 62, 14, 62,164,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 75,138, 94,189,135,155, 65, 62,186,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0, 23, 85,145,189, 15,224,124, 62,142, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
-216, 0, 0, 0, 32,191,114, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 85,145,186,255,223,124, 59, 56,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63,
- 0, 0, 0, 0, 7, 85,145,187,191,223,124, 60,186, 71, 2, 63, 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,127, 35,188,
-239, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63, 0, 0, 0, 0, 7, 85,145,188,255,223,124, 61,125,101,127, 63,
- 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0,203, 20,227,188,255,142,197, 61, 81, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62,
- 0, 0, 0, 0,160,127, 35,189, 7, 62, 14, 62,164,172,187, 63, 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0, 35,138, 94,189,
-143,155, 65, 62,184,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62, 0, 0, 0, 0,255, 84,145,189, 23,224,124, 62,141, 17,245, 63,
- 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,216, 0, 0, 0, 64,192,114, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 7, 82,145,186,
-255,223,124, 59, 59,146,131, 62, 0, 0, 72, 65, 0, 0, 96, 63, 0, 0, 0, 0, 7, 84,145,187,191,223,124, 60,188, 71, 2, 63,
- 0, 0,200, 65, 0, 0, 64, 63, 0, 0, 0, 0,136,126, 35,188,239, 61, 14, 61,220,123, 65, 63, 0, 0, 22, 66, 0, 0, 32, 63,
- 0, 0, 0, 0,135, 84,145,188,239,223,124, 61,128,101,127, 63, 0, 0, 72, 66, 0, 0, 0, 63, 0, 0, 0, 0, 75, 20,227,188,
-255,142,197, 61, 82, 2,158, 63, 0, 0,122, 66, 0, 0,192, 62, 0, 0, 0, 0,104,127, 35,189, 3, 62, 14, 62,165,172,187, 63,
- 0, 0,150, 66, 0, 0,128, 62, 0, 0, 0, 0,235,137, 94,189,139,155, 65, 62,185,177,216, 63, 0, 0,175, 66, 0, 0, 0, 62,
- 0, 0, 0, 0,231, 84,145,189, 19,224,124, 62,143, 17,245, 63, 0, 0,200, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
- 88, 0, 0, 0,224,223,117, 1, 0, 0, 0, 0, 93, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 19, 0, 0, 0, 23, 0, 0, 0, 80, 97,114,116,105, 99,108,101, 83,121,115,116,101,109, 32, 49, 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,220,117, 1, 0, 0, 0, 0,224,235,196, 1,
- 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 79, 66, 0, 0, 32, 4, 0, 0,144, 95,116, 1, 0, 0, 0, 0, 99, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,144, 88,116, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 79, 66,116,101,120,116,117,114,101, 0,114,101,118,105,101,119, 46, 48, 48, 53, 0, 0, 0, 0, 1, 0, 0, 4,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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, 16, 76,122, 1, 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,240, 99,116, 1, 0, 0, 0, 0, 61, 16,183,188, 21,204,103,191, 48,234,228, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,153, 39,155, 64,153, 39,155, 64,153, 39,155, 64, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,218, 15,201, 63, 0, 0,192, 37,255,255,255, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
-153, 39,155, 64,152, 39, 27, 38,102,187,232,166, 0, 0, 0, 0,102,187,232, 38,157,134,196, 52,153, 39,155, 64, 0, 0, 0, 0,
-154, 39, 27, 38,153, 39,155,192,157,134,196, 52, 0, 0, 0, 0, 61, 16,183,188, 21,204,103,191, 48,234,228, 63, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 25, 50, 83, 62, 28, 50,211, 35, 23, 50,211,163, 0, 0, 0, 0, 27, 50,211,163, 25, 50, 83, 62,158, 59,174, 38, 0, 0, 0, 0,
- 0, 24, 44,173,224,165, 94,175, 25, 50, 83, 62, 0, 0, 0, 0,236,251, 33, 59,135, 37, 40, 59,118, 71,238, 63, 0, 0,128, 63,
- 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 0, 1, 0, 2, 0, 0, 0, 0, 0, 79, 66, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,100, 0, 0, 0, 0, 0, 0, 0, 56,180,150,201, 0, 0,128, 63, 10,215, 35, 61, 0, 0,128, 63,
-205,204,204, 62,205,204,204, 61, 0, 0, 0, 0, 4, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 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,128, 63, 0, 64, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 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, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 68, 65, 84, 65, 8, 0, 0, 0,240, 99,116, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 77, 65, 0, 0,144, 2, 0, 0, 64,100,116, 1, 0, 0, 0, 0, 38, 0, 0, 0, 1, 0, 0, 0,224,103,116, 1,
- 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, 77, 65, 99,104,
-101, 99,107,101,114,100, 97,114,107, 0, 0, 0, 97,116,101,114,105, 97, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 3, 0, 1, 0,116, 1,221, 61,200,251,220, 61,200,251,220, 61, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63,154,153, 89, 63,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63,205,204, 76, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,160, 63, 0, 0, 0, 0, 0, 0,160, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 2, 0, 2, 0, 1, 0, 0, 6, 0, 0,128, 63, 0, 0,128, 63, 18, 0, 18, 0, 10,215,163, 59, 10,215,163, 59, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 64, 1, 3, 0, 64, 1, 1, 0, 4, 0, 12, 0, 4, 0, 0, 0, 0, 63, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 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,128, 63, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0,128, 64, 0, 0, 0, 63,205,204,204, 61,
- 0, 0, 0, 63,205,204,204, 61,205,204,204, 61, 0, 0,128, 63, 16, 8, 1, 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,128, 63, 0, 0,128, 63, 16,103,116, 1, 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, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0,128, 63,205,204, 76, 63,205,204, 76, 63,205,204, 76, 63,205,204, 76, 61,205,204,204, 61,102,102,166, 63,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 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, 68, 65, 84, 65,136, 0, 0, 0, 16,103,116, 1, 0, 0, 0, 0, 29, 0, 0, 0,
- 1, 0, 0, 0, 16, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,240,128,116, 1, 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, 2, 3, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,192, 63, 1, 0,192, 63, 1, 0,192, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 23,183,209, 56,184,177,209, 56,184,177,209, 56, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 63,
- 0, 0,128, 63,205,204, 76, 62, 0, 0, 0, 0, 77, 65, 0, 0,144, 2, 0, 0,224,103,116, 1, 0, 0, 0, 0, 38, 0, 0, 0,
- 1, 0, 0, 0,128,107,116, 1, 0, 0, 0, 0, 64,100,116, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 77, 65, 99,104,101, 99,107,101,114,108,105,103,104,116, 0, 0, 0, 97,116,101,114,105, 0, 0, 2, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 1, 0,188, 65,157, 62,178, 61,157, 62,178, 61,157, 62, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 63,154,153, 89, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63,205,204, 76, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,160, 63, 0, 0, 0, 0, 0, 0,160, 63, 0, 0, 0, 0,
- 0, 0, 0, 0,205,204,204, 61, 2, 0, 2, 0, 1, 0, 0, 6, 0, 0,128, 63, 0, 0,128, 63, 18, 0, 18, 0, 10,215,163, 59,
- 10,215,163, 59, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 64, 1, 3, 0, 64, 1, 1, 0, 4, 0, 12, 0, 4, 0,
- 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 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,128, 63, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0,128, 64,
- 0, 0, 0, 63,205,204,204, 61, 0, 0, 0, 63,205,204,204, 61,205,204,204, 61, 0, 0,128, 63, 16, 8, 1, 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,128, 63, 0, 0,128, 63,176,106,116, 1,
- 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, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63,205,204, 76, 63,205,204, 76, 63,205,204, 76, 63,205,204, 76, 61,
-205,204,204, 61,102,102,166, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 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, 68, 65, 84, 65,136, 0, 0, 0,176,106,116, 1,
- 0, 0, 0, 0, 29, 0, 0, 0, 1, 0, 0, 0, 16, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,240,128,116, 1,
- 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, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 23,183,209, 56,184,177,209, 56,184,177,209, 56, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0,
- 0, 0,128, 63, 0, 0, 0, 63, 0, 0,128, 63,205,204, 76, 62, 0, 0, 0, 0, 77, 65, 0, 0,144, 2, 0, 0,128,107,116, 1,
- 0, 0, 0, 0, 38, 0, 0, 0, 1, 0, 0, 0,112,114,116, 1, 0, 0, 0, 0,224,103,116, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 65,112,114,101,118,105,101,119, 0, 0, 97,116,101,114,105, 97,108, 0, 0,
- 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,128, 63, 61,232, 54, 63,
-184,161, 23, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63,188,248, 68, 62, 0, 0,128, 63,
-205,204, 76, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,198,121,130, 63, 0, 0,160, 63, 0, 0, 0, 0,
- 0, 0,160, 63, 0, 0, 0, 0, 0, 0, 0, 0,205,204,204, 61, 2, 0, 2, 0, 50, 0, 0, 6, 0, 0,128, 63, 0, 0,128, 63,
- 18, 0, 18, 0, 10,215,163, 59, 10,215,163, 59, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 17, 3, 3, 0, 17, 3,
- 1, 0, 4, 0, 12, 0, 4, 0, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63,
- 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,128, 63, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0,
- 0, 0, 0, 63, 0, 0,128, 64, 0, 0, 0, 63,205,204,204, 61, 0, 0, 0, 63,205,204,204, 61,205,204,204, 61, 0, 0,128, 63,
- 1, 8, 1, 0, 32,111,116, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0,128, 63, 80,110,116, 1, 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, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63,205,204, 76, 63,205,204, 76, 63,
-205,204, 76, 63,205,204, 76, 61,205,204,204, 61,102,102,166, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63,
- 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, 68, 65, 84, 65,
-136, 0, 0, 0, 80,110,116, 1, 0, 0, 0, 0, 29, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,128,127,116, 1, 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, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0,128, 63, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 63, 0, 0,128, 63,205,204, 76, 62, 0, 0, 0, 0, 68, 65, 84, 65,
- 8, 3, 0, 0, 32,111,116, 1, 0, 0, 0, 0, 32, 0, 0, 0, 1, 0, 0, 0, 0, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,245, 40,220, 62, 0, 0, 0, 0,164,112,125, 63, 0, 0,128, 63,106,214, 24, 63,
- 0, 0,128, 63, 0, 0,128, 63, 1, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0, 0, 63,
- 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63,
- 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63,
- 0, 0,128, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0, 0, 63,
- 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63,
- 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63,
- 0, 0,128, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0, 0, 63,
- 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63,
- 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63,
- 0, 0,128, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0, 0, 63,
- 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0, 0, 63, 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, 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, 0, 0, 0, 0, 77, 65, 0, 0,
-144, 2, 0, 0,112,114,116, 1, 0, 0, 0, 0, 38, 0, 0, 0, 1, 0, 0, 0, 96,121,116, 1, 0, 0, 0, 0,128,107,116, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 65,116,101,120,116,117,114,101, 0,114,101,
-118,105,101,119, 46, 48, 48, 49, 0, 0, 0, 0, 1, 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,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0,205,204, 76, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,160, 63, 0, 0, 0, 0, 0, 0,160, 63, 0, 0, 0, 0, 0, 0, 0, 0,205,204,204, 61, 2, 0, 2, 0, 50, 0, 0, 6,
- 0, 0,128, 63, 0, 0,128, 63, 18, 0, 18, 0, 10,215,163, 59, 10,215,163, 59, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 71, 0, 1, 3, 67, 0, 1, 3, 1, 0, 4, 0, 12, 0, 4, 0, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0,128, 63, 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,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0,
- 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0,128, 64, 0, 0, 0, 63,205,204,204, 61, 0, 0, 0, 63,205,204,204, 61,
-205,204,204, 61, 0, 0,128, 63, 1, 8,129, 0, 16,118,116, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 64,117,116, 1, 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, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63,
-205,204, 76, 63,205,204, 76, 63,205,204, 76, 63,205,204, 76, 61,205,204,204, 61,102,102,166, 63, 0, 0,128, 63, 0, 0, 0, 0,
- 0, 0,128, 63, 0, 0,128, 63, 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, 68, 65, 84, 65,136, 0, 0, 0, 64,117,116, 1, 0, 0, 0, 0, 29, 0, 0, 0, 1, 0, 0, 0, 1, 0,129, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,127,116, 1, 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, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 63, 0, 0,128, 63,205,204, 76, 62,
- 0, 0, 0, 0, 68, 65, 84, 65, 8, 3, 0, 0, 16,118,116, 1, 0, 0, 0, 0, 32, 0, 0, 0, 1, 0, 0, 0, 0, 0, 2, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,245, 40,220, 62, 0, 0, 0, 0,164,112,125, 63,
- 0, 0,128, 63,106,214, 24, 63, 0, 0,128, 63, 0, 0,128, 63, 1, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63,
- 0, 0,128, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0, 0, 63,
- 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63,
- 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63,
- 0, 0,128, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0, 0, 63,
- 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63,
- 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63,
- 0, 0,128, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0, 0, 63,
- 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63,
- 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63,
- 0, 0,128, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0, 0, 63,
- 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,
- 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,
- 0, 0, 0, 0, 77, 65, 0, 0,144, 2, 0, 0, 96,121,116, 1, 0, 0, 0, 0, 38, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,112,114,116, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 65,116,101,
-120,116,117,114,101, 46, 48, 48, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 0,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63,205,204, 76, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,160, 63, 0, 0, 0, 0, 0, 0,160, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 2, 0, 2, 0, 50, 0, 0, 6, 0, 0,128, 63, 0, 0,128, 63, 18, 0, 18, 0, 10,215,163, 59, 10,215,163, 59, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 1, 3, 3, 0, 1, 3, 1, 0, 4, 0, 12, 0, 4, 0, 0, 0, 0, 63, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 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,128, 63, 0, 0, 0, 0,
- 1, 0, 2, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0,128, 64, 0, 0, 0, 63,205,204,204, 61,
- 0, 0, 0, 63,205,204,204, 61,205,204,204, 61, 0, 0,128, 63, 0, 0, 0, 0, 48,124,116, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 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, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0,128, 63,205,204, 76, 63,205,204, 76, 63,205,204, 76, 63,205,204, 76, 61,205,204,204, 61,102,102,166, 63,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 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, 68, 65, 84, 65, 8, 3, 0, 0, 48,124,116, 1, 0, 0, 0, 0, 32, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,245, 40,220, 62,
- 0, 0, 0, 0,164,112,125, 63, 0, 0,128, 63,106,214, 24, 63, 0, 0,128, 63, 0, 0,128, 63, 1, 0, 0, 0, 0, 0, 0, 63,
- 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63,
- 0, 0,128, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0, 0, 63,
- 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63,
- 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63,
- 0, 0,128, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0, 0, 63,
- 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63,
- 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63,
- 0, 0,128, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0, 0, 63,
- 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63,
- 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63,
- 0, 0,128, 63, 0, 0, 0, 63, 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, 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, 0, 0, 0, 0, 84, 69, 0, 0, 48, 1, 0, 0,128,127,116, 1, 0, 0, 0, 0, 34, 0, 0, 0,
- 1, 0, 0, 0,240,128,116, 1, 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, 84, 69,112,114,101,118,105,101,119, 0,101,120, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 62, 0, 0,160, 64, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 64, 0, 0, 0, 64, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 64, 0, 0, 0, 0,
- 2, 0, 0, 0, 0, 0, 0, 0, 5, 0, 8, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63,
- 1, 0, 1, 0, 3, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,205,204,204, 60,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 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, 84, 69, 0, 0, 48, 1, 0, 0,240,128,116, 1,
- 0, 0, 0, 0, 34, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,127,116, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 84, 69,102, 97,107,101,115,104, 97,100,111,119, 0, 0, 76,101,110,100, 0,101,
-120, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 62, 0, 0,160, 64, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 64, 0, 0, 0, 64,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 32, 64, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 5, 0, 40, 0, 5, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,128, 63, 0, 0,128, 63, 1, 0, 1, 0, 3, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0,205,204,204, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0,
- 0, 0, 1, 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, 77, 69, 0, 0,
-120, 1, 0, 0, 96,130,116, 1, 0, 0, 0, 0, 50, 0, 0, 0, 1, 0, 0, 0, 32, 2,118, 1, 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, 77, 69, 67,117, 98,101, 46, 48, 48, 49, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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,208, 1,118, 1, 0, 0, 0, 0,192,223,116, 1, 0, 0, 0, 0, 16, 7,117, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,160,133,116, 1, 0, 0, 0, 0,224,174,116, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16,101,117, 1,
- 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, 32,132,116, 1,
- 0, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 96,173,116, 1, 0, 0, 0, 0, 1, 0, 0, 0,
- 5, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 64,222,116, 1, 0, 0, 0, 0, 3, 0, 0, 0, 5, 0, 0, 0, 80, 0, 0, 0,
- 0, 0, 0, 0,249, 1, 0, 0,237, 3, 0, 0,244, 1, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,192,133, 88, 61,
-184, 45, 85,189,196,181, 24,190,185, 71, 35, 63,153, 31,235, 62,130,102,203, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 30, 0, 4, 0, 1, 0, 1, 0, 1, 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, 68, 65, 84, 65, 8, 0, 0, 0,208, 1,118, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0,128,107,116, 1, 0, 0, 0, 0, 68, 65, 84, 65, 64, 1, 0, 0, 32,132,116, 1, 0, 0, 0, 0, 5, 1, 0, 0,
- 5, 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,160,133,116, 1,
- 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,
- 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, 68, 65, 84, 65,116, 39, 0, 0,160,133,116, 1, 0, 0, 0, 0, 56, 0, 0, 0,249, 1, 0, 0,140,144,131, 62,
-119,163,200, 60,156, 9, 85, 62,125, 92, 70,170,228, 21, 0,255, 50,222, 26,190,119,163,200, 60,156, 9, 85, 62,131,163, 70,170,
-228, 21, 0,255, 61,126,146, 62,223, 37, 8,188, 99,183, 47, 62,247, 76,191,194,228, 81, 2,255,147,185, 56,190,223, 37, 8,188,
- 99,183, 47, 62, 9,179,191,194,228, 81, 2,255,129,176,157, 62,211, 91,217,188,244,238,246, 61, 31, 84,226,181,191, 61, 2,255,
- 28, 30, 79,190,211, 91,217,188,244,238,246, 61,225,171,226,181,191, 61, 2,255,115, 19, 94, 62,103,251,128,189,150, 32, 14, 62,
-241, 9,155,144, 64, 62, 2,255, 26,161,227,189,103,251,128,189,150, 32, 14, 62, 15,246,155,144, 64, 62, 2,255,115, 19, 94, 62,
-251,118, 25,189, 20,165, 62, 62,184, 14,144,163, 76, 87, 2,255, 26,161,227,189,251,118, 25,189, 20,165, 62, 62, 72,241,144,163,
- 76, 87, 2,255,115, 19, 94, 62,232,107, 34, 60,116,128, 92, 62, 3, 3,121,131,110, 29, 0,255, 26,161,227,189,232,107, 34, 60,
-116,128, 92, 62,253,252,121,131,110, 29, 0,255, 58,193, 56, 62,119,163,200, 60, 77,247, 99, 62, 56,171,117,167,206, 36, 0,255,
-168,252,152,189,119,163,200, 60, 77,247, 99, 62,200, 84,117,167,206, 36, 0,255,109, 42, 23, 62,223, 37, 8,188, 88,215, 73, 62,
-152,217,122,203, 56,110, 0,255,229,197, 0, 62,211, 91,217,188, 71, 14, 29, 62,179,184, 93,175, 66, 69, 2,255,249, 23,164,188,
-211, 91,217,188, 71, 14, 29, 62, 77, 71, 93,175, 66, 69, 2,255, 88,231,182, 61,159,154,121, 61,179,201, 32, 62,181,151,104,255,
- 51, 74, 2,255,207,121,134, 60,159,154,121, 61,179,201, 32, 62, 75,104,104,255, 51, 74, 2,255, 25,158,242, 61,159,154,121, 61,
- 88,215, 73, 62, 78,171,150,255,246, 95, 2,255,110,194, 80,188,159,154,121, 61, 88,215, 73, 62,178, 84,150,255,246, 95, 2,255,
-138,211, 41, 62,159,154,121, 61, 77,247, 99, 62,152,133,153,254, 98, 37, 0,255,143, 66,118,189,159,154,121, 61, 77,247, 99, 62,
-104,122,153,254, 98, 37, 0,255, 58,193, 56, 62,154,232,206, 61, 77,247, 99, 62, 24,170, 13, 88, 89, 35, 0,255,168,252,152,189,
-154,232,206, 61, 77,247, 99, 62,232, 85, 13, 88, 89, 35, 0,255,109, 42, 23, 62,173, 79, 5, 62, 88,215, 73, 62,249,200,221, 65,
-244, 94, 2,255, 31,158, 43,189,173, 79, 5, 62, 88,215, 73, 62, 7, 55,221, 65,244, 94, 2,255,229,197, 0, 62, 54,180, 27, 62,
- 71, 14, 29, 62, 51,186, 86, 78, 78, 73, 2,255,249, 23,164,188, 54,180, 27, 62, 71, 14, 29, 62,205, 69, 86, 78, 78, 73, 2,255,
-115, 19, 94, 62,111, 6, 65, 62,150, 32, 14, 62, 2, 11,152,107,114, 68, 2,255, 26,161,227,189,111, 6, 65, 62,150, 32, 14, 62,
-254,244,152,107,114, 68, 2,255,115, 19, 94, 62, 14, 43, 35, 62, 20,165, 62, 62,201, 14,180, 91, 14, 88, 2,255, 26,161,227,189,
- 14, 43, 35, 62, 20,165, 62, 62, 55,241,180, 91, 14, 88, 2,255,115, 19, 94, 62,250,195,236, 61,116,128, 92, 62,134, 2, 29,125,
-228, 26, 0,255, 26,161,227,189,250,195,236, 61,116,128, 92, 62,122,253, 29,125,228, 26, 0,255,140,144,131, 62,154,232,206, 61,
-156, 9, 85, 62, 54, 93, 67, 85,154, 20, 0,255, 50,222, 26,190,154,232,206, 61,156, 9, 85, 62,202,162, 67, 85,154, 20, 0,255,
- 61,126,146, 62,173, 79, 5, 62, 99,183, 47, 62,241, 76,161, 60, 97, 82, 2,255,147,185, 56,190,173, 79, 5, 62, 99,183, 47, 62,
- 15,179,161, 60, 97, 82, 2,255,129,176,157, 62, 54,180, 27, 62,244,238,246, 61,179, 83,157, 71, 45, 65, 2,255, 28, 30, 79,190,
- 54,180, 27, 62,244,238,246, 61, 77,172,157, 71, 45, 65, 2,255,157, 89,176, 62,159,154,121, 61, 67, 1,232, 61, 40,111,113,255,
-117, 63, 2,255, 84,112,116,190,159,154,121, 61, 67, 1,232, 61,216,144,113,255,117, 63, 2,255,237,107,161, 62,159,154,121, 61,
-139, 64, 40, 62, 48,100,154,255,167, 79, 2,255,244,148, 86,190,159,154,121, 61,139, 64, 40, 62,208,155,154,255,167, 79, 2,255,
-100, 7,139, 62,159,154,121, 61, 48, 78, 81, 62,117,126,181,254,185, 19, 0,255,227,203, 41,190,159,154,121, 61, 48, 78, 81, 62,
-139,129,181,254,185, 19, 0,255, 26,229,140, 62,159,154,121, 61, 8,197, 88, 62,160,120,106,254,198, 42, 2,255, 79,135, 45,190,
-159,154,121, 61, 8,197, 88, 62, 96,135,106,254,198, 42, 2,255, 66,110,133, 62,114, 95,214, 61,116,128, 92, 62,173, 93,126, 74,
- 93, 45, 2,255,158,153, 30,190,114, 95,214, 61,116,128, 92, 62, 83,162,126, 74, 93, 45, 2,255,115, 19, 94, 62,170,177,251, 61,
-185,178,103, 62, 9, 11, 31,115,216, 54, 2,255, 26,161,227,189,170,177,251, 61,185,178,103, 62,247,244, 31,115,216, 54, 2,255,
-206, 5, 53, 62,114, 95,214, 61,145, 41,111, 62, 9,181,184, 80, 43, 65, 2,255,208,133,145,189,114, 95,214, 61,145, 41,111, 62,
-247, 74,184, 80, 43, 65, 2,255,178, 92, 34, 62,159,154,121, 61,145, 41,111, 62,116,146, 57,254, 43, 66, 2,255, 48,103, 88,189,
-159,154,121, 61,145, 41,111, 62,140,109, 57,254, 43, 66, 2,255,206, 5, 53, 62, 22,200,170, 60,145, 41,111, 62, 34,182,181,173,
-115, 64, 2,255,208,133,145,189, 22,200,170, 60,145, 41,111, 62,222, 73,181,173,115, 64, 2,255,115, 19, 94, 62,159,154,121, 61,
-253,228,114, 62, 74, 24,139,255,171,125, 2,255, 26,161,227,189,159,154,121, 61,253,228,114, 62,182,231,139,255,171,125, 2,255,
-115, 19, 94, 62,149,249, 43, 59,185,178,103, 62,218, 10,140,140, 45, 54, 2,255, 26,161,227,189,149,249, 43, 59,185,178,103, 62,
- 38,245,140,140, 45, 54, 2,255, 66,110,133, 62, 22,200,170, 60,116,128, 92, 62,141, 92,203,179,210, 44, 2,255,158,153, 30,190,
- 22,200,170, 60,116,128, 92, 62,115,163,203,179,210, 44, 2,255,203,133, 88, 61,202,248, 23, 62, 88,215, 73, 62, 0, 0, 43,124,
- 17, 31, 0,255,203,133, 88, 61, 34, 77,229, 61,145, 41,111, 62, 0, 0, 63,249,209,127, 0,255,203,133, 88, 61,150,254,188,190,
-236, 27, 70, 62, 0, 0,204,251,237,127, 0,255,203,133, 88, 61,191, 79, 78,190,116,128, 92, 62, 0, 0, 33,150,238, 71, 2,255,
-203,133, 88, 61,146,221, 14,190, 77,247, 99, 62, 0, 0, 28,100,192, 79, 0,255,203,133, 88, 61, 30, 99,211,190, 20,165, 62, 62,
- 0, 0,184,142,147, 59, 2,255,203,133, 88, 61,133,198, 12, 62,190,169, 6, 62, 0, 0,143,103, 57, 75, 0,255,203,133, 88, 61,
- 99, 38, 91, 62, 28,120,239, 61, 0, 0,115, 78, 34,101, 0,255,203,133, 88, 61, 16,243,187, 62,170,250,206,190, 0, 0,190,110,
-212,191, 2,255,203,133, 88, 61,247,106, 87, 62,178,224, 11,191, 0, 0,144, 35, 12,133, 3,255,203,133, 88, 61, 18,165,157,188,
- 33, 20, 9,191, 0, 0,194,214,213,134, 2,255,203,133, 88, 61, 32, 43,108,190,227, 83,160,190, 0, 0,154,134,113,215, 2,255,
-109, 42, 23, 62,146,221, 14,190, 67, 1,232, 61,144,113,122,198, 79, 13, 0,255, 31,158, 43,189,146,221, 14,190, 67, 1,232, 61,
-112,142,122,198, 79, 13, 0,255, 87,106, 75, 62,138, 37,131,190, 28,120,239, 61,196,122, 19, 31,152, 18, 2,255,225, 78,190,189,
-138, 37,131,190, 28,120,239, 61, 60,133, 19, 31,152, 18, 2,255,115, 19, 94, 62, 2,186,192,190, 28,120,239, 61,167,125,146, 12,
-226, 20, 0,255, 26,161,227,189, 2,186,192,190, 28,120,239, 61, 89,130,146, 12,226, 20, 0,255, 75,138,101, 62,200, 96,239,190,
-227, 37,202, 61,113,124,142,242,196, 26, 2,255,203,142,242,189,200, 96,239,190,227, 37,202, 61,143,131,142,242,196, 26, 2,255,
- 47,225, 82, 62,195,112,252,190, 10,175,194, 61,159, 79, 44,159,210, 25, 2,255,146, 60,205,189,195,112,252,190, 10,175,194, 61,
- 97,176, 44,159,210, 25, 2,255, 41,248, 11, 62,242, 4, 1,191,107,138,224, 61,143, 19, 13,131,178, 19, 2,255, 27,170,253,188,
-242, 4, 1,191,107,138,224, 61,113,236, 13,131,178, 19, 2,255,203,133, 88, 61,168,226, 2,191,244,238,246, 61, 0, 0, 75,130,
- 21, 24, 2,255,140,144,131, 62, 18,242,240,189,227, 37,202, 61,114, 47,117,137,232, 8, 2,255, 50,222, 26,190, 18,242,240,189,
-227, 37,202, 61,142,208,117,137,232, 8, 2,255, 83, 55,178, 62, 23,233,143,189,187,156,209, 61, 25, 77,198,154,214, 13, 2,255,
-193, 43,120,190, 23,233,143,189,187,156,209, 61,231,178,198,154,214, 13, 2,255, 26,222,224, 62,182,236,140, 60, 49, 21,112, 61,
-216,113,247,198,255, 12, 2,255,167,188,170,190,182,236,140, 60, 49, 21,112, 61, 40,142,247,198,255, 12, 2,255,243, 84,232, 62,
-202,248, 23, 62, 82,238, 2, 62,104,113, 31, 51, 32, 30, 2,255,128, 51,178,190,202,248, 23, 62, 82,238, 2, 62,152,142, 31, 51,
- 32, 30, 2,255,112,224,196, 62,190, 24, 50, 62, 2,220, 17, 62,216, 64,225,106,121, 27, 0,255,253,190,142,190,190, 24, 50, 62,
- 2,220, 17, 62, 40,191,225,106,121, 27, 0,255,134,160,144, 62, 20, 20,106, 62, 99,183, 47, 62,137, 75, 82,101, 70, 20, 0,255,
- 39,254, 52,190, 20, 20,106, 62, 99,183, 47, 62,119,180, 82,101, 70, 20, 0,255,195, 37, 79, 62, 67, 92,154, 62,236, 27, 70, 62,
-241, 38, 19,119, 54, 26, 2,255,186,197,197,189, 67, 92,154, 62,236, 27, 70, 62, 15,217, 19,119, 54, 26, 2,255,229,197, 0, 62,
-181, 7,145, 62, 48, 78, 81, 62, 21,175, 54, 96, 12, 24, 2,255,249, 23,164,188,181, 7,145, 62, 48, 78, 81, 62,235, 80, 54, 96,
- 12, 24, 2,255,168,249,167, 61, 42,212, 53, 62,196,146, 77, 62,174,155,128, 76,151, 21, 0,255,144, 48,194, 60, 42,212, 53, 62,
-196,146, 77, 62, 82,100,128, 76,151, 21, 0,255, 81,129, 4, 62,241,129, 16, 62, 8,197, 88, 62, 0, 25, 4,237, 22,124, 0,255,
- 89,243,193,188,241,129, 16, 62, 8,197, 88, 62, 0,231, 4,237, 22,124, 0,255,105,176,227, 61, 17,132,184, 61,156, 9, 85, 62,
-160,255,126,232,209,125, 0,255,214,169,178,187, 17,132,184, 61,156, 9, 85, 62, 96, 0,126,232,209,125, 0,255, 31,158, 43,189,
-223, 37, 8,188, 88,215, 73, 62,104, 38,122,203, 56,110, 0,255,184, 69,105, 62, 92, 82, 55,189, 59, 46, 55, 62,106, 34,119,200,
- 16,110, 0,255,163, 5,250,189, 92, 82, 55,189, 59, 46, 55, 62,150,221,119,200, 16,110, 0,255,134,160,144, 62,115,128,187,188,
-139, 64, 40, 62,161, 55, 60,207,115,104, 0,255, 39,254, 52,190,115,128,187,188,139, 64, 40, 62, 95,200, 60,207,115,104, 0,255,
-157, 89,176, 62,205, 26, 17, 61, 71, 14, 29, 62,181, 58,123,226,214,109, 0,255, 84,112,116,190,205, 26, 17, 61, 71, 14, 29, 62,
- 75,197,123,226,214,109, 0,255, 9, 21,180, 62, 57, 13,177, 61, 71, 14, 29, 62,157, 49, 61,230, 36,115, 0,255, 45,231,123,190,
- 57, 13,177, 61, 71, 14, 29, 62, 99,206, 61,230, 36,115, 0,255,123,192,170, 62,170,177,251, 61, 31,133, 36, 62,206, 39,175,234,
-196,119, 0,255, 16, 62,105,190,170,177,251, 61, 31,133, 36, 62, 50,216,175,234,196,119, 0,255,214,178,129, 62, 54,180, 27, 62,
- 20,165, 62, 62, 62, 24, 85,255,173,125, 0,255,198, 34, 23,190, 54,180, 27, 62, 20,165, 62, 62,194,231, 85,255,173,125, 0,255,
-246,142, 45, 62,230,161, 42, 62, 48, 78, 81, 62,251, 31, 40,247,158,123, 0,255, 32,152,130,189,230,161, 42, 62, 48, 78, 81, 62,
- 5,224, 40,247,158,123, 0,255,203,133, 88, 61,104,133,209,190,236, 27, 70, 62, 0, 0,148,210,170,119, 0,255,185,194,212, 61,
- 36, 83,198,190,236, 27, 70, 62, 39, 19, 65,222,248,121, 0,255,191,196,240, 58, 36, 83,198,190,236, 27, 70, 62,217,236, 65,222,
-248,121, 0,255,145, 57,220, 61,207, 80,226,190,167,233, 58, 62,134, 2,132,217, 12,122, 0,255, 77,241,236,186,207, 80,226,190,
-167,233, 58, 62,122,253,132,217, 12,122, 0,255,168,249,167, 61, 19,131,237,190,207,114, 51, 62, 13,252,169,214, 18,121, 0,255,
-144, 48,194, 60, 19,131,237,190,207,114, 51, 62,243, 3,169,214, 18,121, 0,255,203,133, 88, 61,200, 96,239,190, 99,183, 47, 62,
- 0, 0,150,219,180,122, 0,255,203,133, 88, 61,254,152, 18,190,196,146, 77, 62, 0, 0, 46, 97, 76, 83, 0,255,203,133, 88, 61,
- 18,242,240,189, 88,215, 73, 62, 0, 0,197,104,134, 73, 0,255,225, 75,205, 61,235,104,248,189, 88,215, 73, 62, 52, 36, 2, 53,
-187,110, 0,255,179,158,179, 59,235,104,248,189, 88,215, 73, 62,204,219, 2, 53,187,110, 0,255,105,176,227, 61,174,134, 33,190,
-196,146, 77, 62,187, 95, 14,212,182, 72, 0,255,214,169,178,187,174,134, 33,190,196,146, 77, 62, 69,160, 14,212,182, 72, 0,255,
- 48, 94,190, 61, 15, 98, 63,190, 88,215, 73, 62,117, 64,117,207, 90, 99, 0,255,220, 60, 81, 60, 15, 98, 63,190, 88,215, 73, 62,
-139,191,117,207, 90, 99, 0,255,252,119,116, 62,239, 95,151,189,139, 64, 40, 62,103, 49,157,196, 13,102, 0,255, 22, 53, 8,190,
-239, 95,151,189,139, 64, 40, 62,153,206,157,196, 13,102, 0,255,231,123,174, 62,211, 91,217,188, 2,220, 17, 62,142, 59,107,204,
-223,100, 2,255,232,180,112,190,211, 91,217,188, 2,220, 17, 62,114,196,107,204,223,100, 2,255,220,155,200, 62, 45,246, 46, 61,
-190,169, 6, 62,102, 66, 11,217, 65,102, 0,255,105,122,146,190, 45,246, 46, 61,190,169, 6, 62,154,189, 11,217, 65,102, 0,255,
- 72, 87,204, 62,170,177,251, 61,179,201, 32, 62, 87, 54,142,228,151,112, 0,255,213, 53,150,190,170,177,251, 61,179,201, 32, 62,
-169,201,142,228,151,112, 0,255, 78, 71,191, 62,241,129, 16, 62,128, 96, 66, 62, 82, 42, 97,247,125,120, 2,255,219, 37,137,190,
-241,129, 16, 62,128, 96, 66, 62,174,213, 97,247,125,120, 2,255,140,144,131, 62, 31,244, 79, 62, 77,247, 99, 62,192, 41,216,254,
-253,120, 0,255, 50,222, 26,190, 31,244, 79, 62, 77,247, 99, 62, 64,214,216,254,253,120, 0,255, 87,106, 75, 62, 48,189,124, 62,
-105,160,118, 62,217, 28, 53, 7,126,124, 0,255,225, 78,190,189, 48,189,124, 62,105,160,118, 62, 39,227, 53, 7,126,124, 0,255,
-109, 42, 23, 62,236,138,113, 62, 65, 23,126, 62,125,255, 44, 5,227,127, 0,255, 31,158, 43,189,236,138,113, 62, 65, 23,126, 62,
-131, 0, 44, 5,227,127, 0,255,225, 75,205, 61,202,248, 23, 62,213, 91,122, 62,130,238, 89, 2,197,126, 0,255,179,158,179, 59,
-202,248, 23, 62,213, 91,122, 62,126, 17, 89, 2,197,126, 0,255,105,176,227, 61,217,159,203,189, 37,110,107, 62,115, 23, 27,230,
- 34,123, 0,255,214,169,178,187,217,159,203,189, 37,110,107, 62,141,232, 27,230, 34,123, 0,255,218,229, 26, 62, 64, 3,133,190,
-167,233, 58, 62,212, 74, 28, 14,225,102, 2,255,207,139, 58,189, 64, 3,133,190,167,233, 58, 62, 44,181, 28, 14,225,102, 2,255,
-246,142, 45, 62,184,151,194,190, 99,183, 47, 62,235, 72, 17,252, 31,105, 2,255, 32,152,130,189,184,151,194,190, 99,183, 47, 62,
- 21,183, 17,252, 31,105, 2,255,206, 5, 53, 62, 99,149,222,190, 31,133, 36, 62,179, 66,197,225,249,104, 2,255,208,133,145,189,
- 99,149,222,190, 31,133, 36, 62, 77,189,197,225,249,104, 2,255, 30, 24, 38, 62,234,249,244,190,111,151, 21, 62, 62, 44, 4,183,
- 98, 95, 2,255,224, 84,103,189,234,249,244,190,111,151, 21, 62,194,211, 4,183, 98, 95, 2,255, 81,129, 4, 62, 86,181,248,190,
-111,151, 21, 62,155, 19, 52,158, 54, 80, 2,255, 89,243,193,188, 86,181,248,190,111,151, 21, 62,101,236, 52,158, 54, 80, 2,255,
-203,133, 88, 61,195,112,252,190,219, 82, 25, 62, 0, 0,201,154, 88, 78, 2,255,203,133, 88, 61, 52, 55,247,188,128, 96, 66, 62,
- 0, 0, 2,252,239,127, 0,255,203,133, 88, 61,222,227, 61, 61,156, 9, 85, 62, 0, 0,112,227,196,124, 0,255, 47,225, 82, 62,
- 82, 93, 46, 62, 88,215, 73, 62, 58, 21,234,254, 56,126, 0,255,146, 60,205,189, 82, 93, 46, 62, 88,215, 73, 62,198,234,234,254,
- 56,126, 0,255, 81,129, 4, 62,170, 34, 94, 60,196,146, 77, 62, 37,214,110,232,163,118, 0,255, 89,243,193,188,170, 34, 94, 60,
-196,146, 77, 62,219, 41,110,232,163,118, 0,255, 65, 39,235, 61,222,227, 61, 61, 48, 78, 81, 62,150,232,127,230, 57,123, 0,255,
-173, 11, 21,188,222,227, 61, 61, 48, 78, 81, 62,106, 23,127,230, 57,123, 0,255,145, 57,220, 61, 76,220,190,190,236, 27, 70, 62,
-117, 20,197,248, 36,126, 0,255, 77,241,236,186, 76,220,190,190,236, 27, 70, 62,139,235,197,248, 36,126, 0,255, 88,231,182, 61,
- 64, 3,133,190,196,146, 77, 62, 43, 19,128, 0,141,126, 2,255,207,121,134, 60, 64, 3,133,190,196,146, 77, 62,213,236,128, 0,
-141,126, 2,255,203,133, 88, 61, 64, 3,133,190,196,146, 77, 62, 0, 0,122,255,254,127, 0,255,203,133, 88, 61, 43, 11, 82,190,
- 88,215, 73, 62, 0, 0,121,184, 36,106, 0,255, 8,213,197, 61, 55,235, 55,190,116,128, 92, 62,167, 66,139,160, 45, 53, 2,255,
- 27,134, 21, 60, 55,235, 55,190,116,128, 92, 62, 89,189,139,160, 45, 53, 2,255, 65, 39,235, 61,174,134, 33,190, 77,247, 99, 62,
-133,118,215,224,239, 36, 2,255,173, 11, 21,188,174,134, 33,190, 77,247, 99, 62,123,137,215,224,239, 36, 2,255,185,194,212, 61,
- 57,123,233,189,116,128, 92, 62,167, 81,141, 95, 49, 24, 2,255,191,196,240, 58, 57,123,233,189,116,128, 92, 62, 89,174,141, 95,
- 49, 24, 2,255, 31,149,145, 61, 97, 4,226,189,116,128, 92, 62,189,200,160,108, 26, 39, 2,255, 89,225, 13, 61, 97, 4,226,189,
-116,128, 92, 62, 67, 55,160,108, 26, 39, 2,255,203,133, 88, 61,106, 84, 22,190,253,228,114, 62, 0, 0, 42, 23,225,125, 0,255,
-247, 11,153, 61,235,104,248,189, 37,110,107, 62,186,231, 89, 78, 66, 98, 2,255, 82,231,253, 60,235,104,248,189, 37,110,107, 62,
- 70, 24, 89, 78, 66, 98, 2,255, 8,213,197, 61,195,223,255,189, 37,110,107, 62, 88, 43,134, 62,237,102, 2,255, 27,134, 21, 60,
-195,223,255,189, 37,110,107, 62,168,212,134, 62,237,102, 2,255,185,194,212, 61,174,134, 33,190,253,228,114, 62,247, 46, 89,233,
-228,116, 2,255,191,196,240, 58,174,134, 33,190,253,228,114, 62, 9,209, 89,233,228,116, 2,255, 88,231,182, 61,243,184, 44,190,
-185,178,103, 62, 46, 31,198,181,128, 99, 2,255,207,121,134, 60,243,184, 44,190,185,178,103, 62,210,224,198,181,128, 99, 2,255,
-203,133, 88, 61, 15, 98, 63,190,185,178,103, 62, 0, 0,185,191,175,110, 2,255, 98, 74, 49, 62, 83,148, 74,190,107,138,224, 61,
- 23,120, 34, 41, 99, 16, 0,255,248, 14,138,189, 83,148, 74,190,107,138,224, 61,233,135, 34, 41, 99, 16, 0,255, 81,129, 4, 62,
-134,253, 40,190,167,233, 58, 62,251, 80, 26,250,241, 98, 0,255, 89,243,193,188,134,253, 40,190,167,233, 58, 62, 5,175, 26,250,
-241, 98, 0,255, 41,248, 11, 62, 83,148, 74,190,167,233, 58, 62,215, 83,153, 16, 71, 95, 0,255, 27,170,253,188, 83,148, 74,190,
-167,233, 58, 62, 41,172,153, 16, 71, 95, 0,255, 30, 24, 38, 62,243,184, 44,190,107,138,224, 61, 24,122, 67, 35, 64, 15, 0,255,
-224, 84,103,189,243,184, 44,190,107,138,224, 61,232,133, 67, 35, 64, 15, 0,255,203,133, 88, 61, 93,165,235,190, 99,183, 47, 62,
- 0, 0,139, 86, 77, 94, 0,255,247, 11,153, 61,167,199,233,190, 99,183, 47, 62,144,206,200, 70,125, 94, 0,255, 82,231,253, 60,
-167,199,233,190, 99,183, 47, 62,112, 49,200, 70,125, 94, 0,255, 8,213,197, 61, 99,149,222,190,167,233, 58, 62,253,164,109, 17,
- 75, 88, 0,255, 27,134, 21, 60, 99,149,222,190,167,233, 58, 62, 3, 91,109, 17, 75, 88, 0,255, 8,213,197, 61, 70,236,203,190,
-128, 96, 66, 62,141,225, 87,168, 39, 88, 0,255, 27,134, 21, 60, 70,236,203,190,128, 96, 66, 62,115, 30, 87,168, 39, 88, 0,255,
-203,133, 88, 61,212, 64,213,190,179,201, 32, 62, 0, 0, 20,159,153, 83, 0,255, 8,213,197, 61,252,201,205,190, 31,133, 36, 62,
- 5,230,250,177, 20, 98, 0,255, 27,134, 21, 60,252,201,205,190, 31,133, 36, 62,251, 25,250,177, 20, 98, 0,255, 8,213,197, 61,
-173,183,220,190,219, 82, 25, 62, 18,152, 8, 24,188, 70, 0,255, 27,134, 21, 60,173,183,220,190,219, 82, 25, 62,238,103, 8, 24,
-188, 70, 0,255,247, 11,153, 61, 59, 12,230,190,111,151, 21, 62, 26,222,242, 49,221,112, 0,255, 82,231,253, 60, 59, 12,230,190,
-111,151, 21, 62,230, 33,242, 49,221,112, 0,255,203,133, 88, 61,241,233,231,190,111,151, 21, 62, 0, 0, 18, 60, 5,113, 0,255,
-189, 60, 8, 62,142,209, 76, 61,116,128, 92, 62, 4, 30, 93,244,225,123, 0,255,186,206,223,188,142,209, 76, 61,116,128, 92, 62,
-252,225, 93,244,225,123, 0,255,149,179, 15, 62, 22,200,170, 60, 8,197, 88, 62, 71, 9, 34,251,144,127, 0,255,190,194, 13,189,
- 22,200,170, 60, 8,197, 88, 62,185,246, 34,251,144,127, 0,255,155,156, 86, 62,202,248, 23, 62, 48, 78, 81, 62, 81, 17, 74, 2,
-204,126, 0,255,106,179,212,189,202,248, 23, 62, 48, 78, 81, 62,175,238, 74, 2,204,126, 0,255, 58,193, 56, 62, 94, 61, 20, 62,
- 8,197, 88, 62,218, 25,177,253, 86,125, 2,255,168,252,152,189, 94, 61, 20, 62, 8,197, 88, 62, 38,230,177,253, 86,125, 2,255,
- 64,170,127, 62, 25, 11, 9, 62, 8,197, 88, 62,182, 21,210,240, 57,125, 2,255, 90,103, 19,190, 25, 11, 9, 62, 8,197, 88, 62,
- 74,234,210,240, 57,125, 2,255,237,107,161, 62, 34, 77,229, 61,207,114, 51, 62,143, 28,249,237,117,123, 0,255,244,148, 86,190,
- 34, 77,229, 61,207,114, 51, 62,113,227,249,237,117,123, 0,255, 15, 5,167, 62, 97,150,169, 61, 99,183, 47, 62,209, 15,217,246,
-175,126, 0,255, 56,199, 97,190, 97,150,169, 61, 99,183, 47, 62, 47,240,217,246,175,126, 0,255, 89, 39,165, 62,125, 8, 32, 61,
-247,251, 43, 62,177, 24,190,253,146,125, 0,255,204, 11, 94,190,125, 8, 32, 61,247,251, 43, 62, 79,231,190,253,146,125, 0,255,
- 26,229,140, 62, 60,222,152,187, 20,165, 62, 62, 20, 33, 75, 2,160,123, 0,255, 79,135, 45,190, 60,222,152,187, 20,165, 62, 62,
-236,222, 75, 2,160,123, 0,255,184, 69,105, 62,115,128,187,188, 88,215, 73, 62, 85, 26,238,248, 14,125, 0,255,163, 5,250,189,
-115,128,187,188, 88,215, 73, 62,171,229,238,248, 14,125, 0,255,178, 92, 34, 62,226,194,133,186,116,128, 92, 62, 8, 7,142,250,
-175,127, 0,255, 48,103, 88,189,226,194,133,186,116,128, 92, 62,248,248,142,250,175,127, 0,255, 41,248, 11, 62, 57, 13,177, 61,
-116,128, 92, 62,169, 34, 2,240, 43,122, 0,255, 27,170,253,188, 57, 13,177, 61,116,128, 92, 62, 87,221, 2,240, 43,122, 0,255,
-218,229, 26, 62,170,177,251, 61,116,128, 92, 62,126, 27,108,239,231,123, 0,255,207,139, 58,189,170,177,251, 61,116,128, 92, 62,
-130,228,108,239,231,123, 0,255, 30, 24, 38, 62,250,195,236, 61, 48, 78, 81, 62,226, 64, 13,207,224, 98, 0,255,224, 84,103,189,
-250,195,236, 61, 48, 78, 81, 62, 30,191, 13,207,224, 98, 0,255, 1,111, 19, 62, 57, 13,177, 61, 48, 78, 81, 62, 29, 96,169,229,
- 81, 80, 0,255,110,176, 28,189, 57, 13,177, 61, 48, 78, 81, 62,227,159,169,229, 81, 80, 0,255,138,211, 41, 62, 77,106,205, 59,
- 48, 78, 81, 62, 36, 55,122, 71,188, 90, 0,255,143, 66,118,189, 77,106,205, 59, 48, 78, 81, 62,220,200,122, 71,188, 90, 0,255,
-184, 69,105, 62,161,220, 67,188,128, 96, 66, 62, 76, 21, 90, 78,241, 98, 0,255,163, 5,250,189,161,220, 67,188,128, 96, 66, 62,
-180,234, 90, 78,241, 98, 0,255,174, 41,137, 62,149,249, 43, 59, 59, 46, 55, 62, 85,245, 69, 69, 25,107, 0,255,118, 16, 38,190,
-149,249, 43, 59, 59, 46, 55, 62,171, 10, 69, 69, 25,107, 0,255,129,176,157, 62,222,227, 61, 61,139, 64, 40, 62,232,223,211, 29,
- 67,120, 0,255, 28, 30, 79,190,222,227, 61, 61,139, 64, 40, 62, 24, 32,211, 29, 67,120, 0,255, 55,142,159, 62,137, 31,162, 61,
-139, 64, 40, 62,148,210,123,238, 95,118, 0,255,136,217, 82,190,137, 31,162, 61,139, 64, 40, 62,108, 45,123,238, 95,118, 0,255,
- 21,245,153, 62,114, 95,214, 61,247,251, 43, 62,216,229,108,179, 43, 99, 0,255, 67,167, 71,190,114, 95,214, 61,247,251, 43, 62,
- 40, 26,108,179, 43, 99, 0,255,212,238,123, 62,173, 79, 5, 62,196,146, 77, 62,202,237,179,158, 35, 81, 2,255,238,171, 15,190,
-173, 79, 5, 62,196,146, 77, 62, 54, 18,179,158, 35, 81, 2,255,166,124, 60, 62, 25, 11, 9, 62,156, 9, 85, 62, 24, 39,118,212,
-214,113, 2,255,129,115,160,189, 25, 11, 9, 62,156, 9, 85, 62,232,216,118,212,214,113, 2,255,155,156, 86, 62,133,198, 12, 62,
-196,146, 77, 62,213, 1,189,193,208,111, 0,255,106,179,212,189,133,198, 12, 62,196,146, 77, 62, 43,254,189,193,208,111, 0,255,
-109, 42, 23, 62,216,126,230, 60,196,146, 77, 62,226, 84,192, 42,187, 85, 0,255, 31,158, 43,189,216,126,230, 60,196,146, 77, 62,
- 30,171,192, 42,187, 85, 0,255, 1,111, 19, 62, 63,191, 91, 61,196,146, 77, 62,235,102,196, 2, 11, 76, 0,255,110,176, 28,189,
- 63,191, 91, 61,196,146, 77, 62, 21,153,196, 2, 11, 76, 0,255,185,194,212, 61,122,230, 38, 62, 42,101, 10, 62,183,182,118,104,
- 5,246, 0,255,191,196,240, 58,122,230, 38, 62, 42,101, 10, 62, 73, 73,118,104, 5,246, 0,255, 1,111, 19, 62,186,247,131, 62,
-150, 32, 14, 62,208,192,221, 66, 3,167, 2,255,110,176, 28,189,186,247,131, 62,150, 32, 14, 62, 48, 63,221, 66, 3,167, 2,255,
-155,156, 86, 62,220,144,137, 62, 82,238, 2, 62, 59, 9, 89, 90,208,165, 2,255,106,179,212,189,220,144,137, 62, 82,238, 2, 62,
-197,246, 89, 90,208,165, 2,255,208,194,142, 62,139,175, 83, 62,107,138,224, 61,165, 37,104,114,176,212, 0,255,187, 66, 49,190,
-139,175, 83, 62,107,138,224, 61, 91,218,104,114,176,212, 0,255,152,105,189, 62, 14, 43, 35, 62,170,211,164, 61, 67, 45, 40,116,
- 1,227, 0,255, 37, 72,135,190, 14, 43, 35, 62,170,211,164, 61,189,210, 40,116, 1,227, 0,255, 66,103,217, 62,133,198, 12, 62,
- 73,248,134, 61,100, 94,237, 79, 18,223, 0,255,207, 69,163,190,133,198, 12, 62, 73,248,134, 61,156,161,237, 79, 18,223, 0,255,
- 32,206,211, 62,119,163,200, 60,252,115,211, 60,247,120,255,221,165,231, 0,255,173,172,157,190,119,163,200, 60,252,115,211, 60,
- 9,135,255,221,165,231, 0,255,123,192,170, 62,188, 45, 85,189,112, 94, 52, 61,155, 76,106,154, 19,242, 0,255, 16, 62,105,190,
-188, 45, 85,189,112, 94, 52, 61,101,179,106,154, 19,242, 0,255,140,144,131, 62, 0, 41,196,189, 33,111,142, 61,204, 56, 26,142,
-138, 13, 0,255, 50,222, 26,190, 0, 41,196,189, 33,111,142, 61, 52,199, 26,142,138, 13, 0,255,203,133, 88, 61, 16,243,187, 62,
- 89,242,105,188, 0, 0,155,106,214, 70, 2,255,203,133, 88, 61,226,121,208, 62,254, 7, 62,190, 0, 0,243,127, 82, 3, 2,255,
-203,133, 88, 61,254,152, 18,190, 11,214,236,190, 0, 0, 54,164,204,166, 3,255,203,133, 88, 61,173,190,136,190,139,142,124,189,
- 0, 0,179,129, 65,235, 0,255,203,133, 88, 61,205,243, 1,191, 73,248,134, 61, 0, 0,182,151,204,181, 2,255,203,133, 88, 61,
-247,217,218,190,241, 12, 56, 60, 0, 0,231,221,162,132, 2,255,203,133, 88, 61,161,222,162,190,147, 21,157, 57, 0, 0, 16,212,
-201,135, 0,255,203,133, 88, 61,207, 87,142,190,141,212,146,188, 0, 0,245,147, 97,187, 0,255, 61,119,230, 62,239,172,106, 61,
-161, 43,253,189,164,125,181,235,156, 13, 0,255,202, 85,176,190,239,172,106, 61,161, 43,253,189, 92,130,181,235,156, 13, 0,255,
-243, 84,232, 62,194,113,199, 61, 78, 26, 47,190,174,126, 23,238, 66,252, 0,255,128, 51,178,190,194,113,199, 61, 78, 26, 47,190,
- 82,129, 23,238, 66,252, 0,255, 32,206,211, 62,216, 49,147, 61,181,218,180,190, 70, 81,148, 13, 15,158, 1,255,173,172,157,190,
-216, 49,147, 61,181,218,180,190,186,174,148, 13, 15,158, 1,255,174, 41,137, 62, 54,180, 27, 62,226, 76,244,190,123, 58,228, 21,
- 70,144, 3,255,118, 16, 38,190, 54,180, 27, 62,226, 76,244,190,133,197,228, 21, 70,144, 3,255,146,121,202, 62,239, 95,151,189,
-240, 61,238,189, 76, 89,139,164,161, 6, 2,255, 31, 88,148,190,239, 95,151,189,240, 61,238,189,180,166,139,164,161, 6, 2,255,
-197,226,168, 62, 97, 4,226,189,163, 21,103,190, 93, 38, 34,134,182, 7, 0,255,164,130,101,190, 97, 4,226,189,163, 21,103,190,
-163,217, 34,134,182, 7, 0,255, 9, 21,180, 62,109, 27,100,189,255,252,178,190,106, 43,219,170,222,170, 1,255, 45,231,123,190,
-109, 27,100,189,255,252,178,190,150,212,219,170,222,170, 1,255,155,156, 86, 62,211, 91,217,188, 85,248,234,190,168, 55,109,213,
-229,148, 2,255,106,179,212,189,211, 91,217,188, 85,248,234,190, 88,200,109,213,229,148, 2,255, 30, 24, 38, 62,112, 61, 93,190,
-191,112, 37, 61,197,120, 36,255,158,213, 0,255,224, 84,103,189,112, 61, 93,190,191,112, 37, 61, 59,135, 36,255,158,213, 0,255,
- 41,248, 11, 62,209, 24,123,190,176,102,236,188,188, 84, 20,181, 24,196, 0,255, 27,170,253,188,209, 24,123,190,176,102,236,188,
- 68,171, 20,181, 24,196, 0,255, 19, 56, 64, 62,110,117,196,190, 92, 79,241, 60,131, 79, 86,254,183,155, 2,255, 89,234,167,189,
-110,117,196,190, 92, 79,241, 60,125,176, 86,254,183,155, 2,255,246,142, 45, 62, 59, 19,146,190, 95,149, 7, 61, 5, 99, 8, 1,
-231,174, 0,255, 32,152,130,189, 59, 19,146,190, 95,149, 7, 61,251,156, 8, 1,231,174, 0,255, 47,225, 82, 62,234,249,244,190,
- 15,131, 22, 61, 65, 62,227,185,224,168, 2,255,146, 60,205,189,234,249,244,190, 15,131, 22, 61,191,193,227,185,224,168, 2,255,
- 25,158,242, 61,178,167,207,190,155,152,181, 60,133, 16,208,232, 55,131, 0,255,110,194, 80,188,178,167,207,190,155,152,181, 60,
-123,239,208,232, 55,131, 0,255,105,176,227, 61,201,103,155,190, 58,189,151, 60, 7, 48,163,224,149,141, 0,255,214,169,178,187,
-201,103,155,190, 58,189,151, 60,249,207,163,224,149,141, 0,255, 81,129, 4, 62,195,112,252,190,129, 39, 97, 61, 68, 12,218,158,
-147,173, 0,255, 89,243,193,188,195,112,252,190,129, 39, 97, 61,188,243,218,158,147,173, 0,255, 70,161, 30, 62,163,166, 59,190,
-208, 57, 82, 61,195,124,106,227,203,255, 0,255,127,121, 73,189,163,166, 59,190,208, 57, 82, 61, 61,131,106,227,203,255, 0,255,
-218,229, 26, 62,174,134, 33,190, 33,111,142, 61, 29,120,105,231,193, 36, 0,255,207,139, 58,189,174,134, 33,190, 33,111,142, 61,
-227,135,105,231,193, 36, 0,255,109, 42, 23, 62,186,102, 7,190,130, 74,172, 61,160,101,164,182,240, 25, 0,255, 31,158, 43,189,
-186,102, 7,190,130, 74,172, 61, 96,154,164,182,240, 25, 0,255,218,229, 26, 62,140,230,111,190,206,171,148,189,120, 84,221,159,
-198,253, 0,255,207,139, 58,189,140,230,111,190,206,171,148,189,136,171,221,159,198,253, 0,255,127,243, 67, 62, 83,148, 74,190,
- 16,205,139,190,255, 67, 42,151, 73,228, 2,255, 49, 97,175,189, 83,148, 74,190, 16,205,139,190, 1,188, 42,151, 73,228, 2,255,
- 7, 88, 90, 62,235,104,248,189,244, 28,205,190,201, 63, 25,176, 0,179, 3,255, 66, 42,220,189,235,104,248,189,244, 28,205,190,
- 55,192, 25,176, 0,179, 3,255,248, 75,135, 62, 55,124,180, 62,187,202,167,190, 34, 56,160, 95, 17,192, 2,255, 10, 85, 34,190,
- 55,124,180, 62,187,202,167,190,222,199,160, 95, 17,192, 2,255,248, 75,135, 62,232,105,195, 62,146, 76, 58,190, 54, 55,120,115,
-239, 0, 2,255, 10, 85, 34,190,232,105,195, 62,146, 76, 58,190,202,200,120,115,239, 0, 2,255,248, 75,135, 62,203,192,176, 62,
-105,252, 34,189,239, 63,164, 92,238, 60, 2,255, 10, 85, 34,190,203,192,176, 62,105,252, 34,189, 17,192,164, 92,238, 60, 2,255,
-174, 41,137, 62,219,193, 68, 62,208, 57, 82, 61,123, 49,255,102,170, 57, 0,255,118, 16, 38,190,219,193, 68, 62,208, 57, 82, 61,
-133,206,255,102,170, 57, 0,255,220,155,200, 62,133,198, 12, 62, 95,172,248, 59,142, 98,198, 73, 6, 35, 0,255,105,122,146,190,
-133,198, 12, 62, 95,172,248, 59,114,157,198, 73, 6, 35, 0,255, 83, 55,178, 62, 14, 43, 35, 62,141,212,146,188,129, 61,254,106,
-241, 33, 0,255,193, 43,120,190, 14, 43, 35, 62,141,212,146,188,127,194,254,106,241, 33, 0,255, 9, 21,180, 62, 72, 76,141, 62,
-161, 43,253,189,234, 76,151, 87,221, 52, 0,255, 45,231,123,190, 72, 76,141, 62,161, 43,253,189, 22,179,151, 87,221, 52, 0,255,
- 66,103,217, 62,247,106, 87, 62, 7,254,185,189,187,101, 28, 66,199, 40, 2,255,207, 69,163,190,247,106, 87, 62, 7,254,185,189,
- 69,154, 28, 66,199, 40, 2,255, 66,103,217, 62,236,138,113, 62, 26,177, 80,190,183,113, 68, 58,119,248, 2,255,207, 69,163,190,
-236,138,113, 62, 26,177, 80,190, 73,142, 68, 58,119,248, 2,255, 9, 21,180, 62,141,126,152, 62, 83, 3,118,190,235, 86,238, 93,
-205,253, 0,255, 45,231,123,190,141,126,152, 62, 83, 3,118,190, 21,169,238, 93,205,253, 0,255, 9, 21,180, 62, 38,179,135, 62,
-107,184,182,190,232, 85,154, 70,157,192, 2,255, 45,231,123,190, 38,179,135, 62,107,184,182,190, 24,170,154, 70,157,192, 2,255,
- 66,103,217, 62,179, 56, 76, 62,153, 49,162,190,166,110,177, 42,222,207, 2,255,207, 69,163,190,179, 56, 76, 62,153, 49,162,190,
- 90,145,177, 42,222,207, 2,255,231,123,174, 62,154,232,206, 61, 56, 79,216,190, 58, 75, 57, 1,116,152, 3,255,232,180,112,190,
-154,232,206, 61, 56, 79,216,190,198,180, 57, 1,116,152, 3,255,208,194,142, 62,171,100, 40,189,170,250,206,190, 73, 70,147,187,
-200,173, 1,255,187, 66, 49,190,171,100, 40,189,170,250,206,190,183,185,147,187,200,173, 0,255,100, 0,223, 62,154,232,206, 61,
-191,190,121,190,194,114, 80, 41,207, 38, 0,255,241,222,168,190,154,232,206, 61,191,190,121,190, 62,141, 80, 41,207, 38, 0,255,
-104, 51,120, 62,186,102, 7,190,127,153,163,189,232, 74,153,154, 28, 22, 0,255,130,240, 11,190,186,102, 7,190,127,153,163,189,
- 24,181,153,154, 28, 22, 0,255,214,178,129, 62,254,152, 18,190, 44,122,125,190, 89, 71,115,151, 1,237, 0,255,198, 34, 23,190,
-254,152, 18,190, 44,122,125,190,167,184,115,151, 1,237, 0,255,202,203,239, 62,133,198, 12, 62, 56, 86,132,190, 72,220,207, 93,
-106, 79, 2,255, 88,170,185,190,133,198, 12, 62, 56, 86,132,190,184, 35,207, 93,106, 79, 2,255, 32,206,211, 62, 18,242,240,189,
-135,108, 84,190, 30, 15, 34,150, 84, 70, 2,255,173,172,157,190, 18,242,240,189,135,108, 84,190,226,240, 34,150, 84, 70, 2,255,
- 38,160, 9, 63,217,159,203,189,192,186,154,190,164, 67,138,166,172, 61, 0,255,219, 30,221,190,217,159,203,189,192,186,154,190,
- 92,188,138,166,172, 61, 0,255,172,140, 38, 63,211, 91,217,188,255,252,178,190,179, 83,223,206,114, 83, 0,255,244,123, 11,191,
-211, 91,217,188,255,252,178,190, 77,172,223,206,114, 83, 0,255, 95,242, 46, 63,194,113,199, 61, 73, 31,177,190, 54, 92,232, 12,
-210, 87, 2,255,167,225, 19,191,194,113,199, 61, 73, 31,177,190,202,163,232, 12,210, 87, 2,255,138,243, 32, 63, 3, 75, 61, 62,
- 73, 31,177,190,247, 62,221, 83, 97, 73, 0,255,209,226, 5,191, 3, 75, 61, 62, 73, 31,177,190, 9,193,221, 83, 97, 73, 0,255,
-112,194, 7, 63, 82, 93, 46, 62, 84,255,150,190,181, 5, 80,111,236, 62, 0,255,111, 99,217,190, 82, 93, 46, 62, 84,255,150,190,
- 75,250, 80,111,236, 62, 0,255,149,211, 6, 63,241,129, 16, 62, 50,102,145,190,236, 69,117,239,236,105, 0,255,185,133,215,190,
-241,129, 16, 62, 50,102,145,190, 20,186,117,239,236,105, 0,255,104, 90, 27, 63, 54,180, 27, 62,113,168,169,190, 34, 24,205,231,
- 89,123, 0,255,175, 73, 0,191, 54,180, 27, 62,113,168,169,190,222,231,205,231, 89,123, 0,255,246,174, 36, 63, 97,150,169, 61,
-221, 99,173,190, 69,223, 16,252,173,123, 0,255, 62,158, 9,191, 97,150,169, 61,221, 99,173,190,187, 32, 16,252,173,123, 0,255,
-249, 38, 30, 63, 98,147,127,188,221, 99,173,190,171,239, 0, 39,207,120, 0,255, 64, 22, 3,191, 98,147,127,188,221, 99,173,190,
- 85, 16, 0, 39,207,120, 0,255, 75,177, 8, 63, 23,233,143,189,158, 33,149,190, 9, 51, 56, 45, 82,108, 0,255, 37, 65,219,190,
- 23,233,143,189,158, 33,149,190,247,204, 56, 45, 82,108, 0,255, 26,222,224, 62,120,196,173,189,243, 39, 88,190,147, 38,224, 62,
-153,104, 2,255,167,188,170,190,120,196,173,189,243, 39, 88,190,109,217,224, 62,153,104, 2,255,162, 66,247, 62,250,195,236, 61,
-204,154,128,190,218, 62,152,243,206,110, 2,255, 48, 33,193,190,250,195,236, 61,204,154,128,190, 38,193,152,243,206,110, 2,255,
-196,219,252, 62, 17,132,184, 61, 50,102,145,190, 10, 87, 73,182, 19, 58, 0,255, 82,186,198,190, 17,132,184, 61, 50,102,145,190,
-246,168, 73,182, 19, 58, 0,255, 21,238,237, 62,103,251,128,189, 44,122,125,190,232, 15,106,121, 64, 37, 0,255,162,204,183,190,
-103,251,128,189, 44,122,125,190, 24,240,106,121, 64, 37, 0,255, 38,160, 9, 63,188, 45, 85,189, 79, 15,164,190,157,239, 89,122,
-212, 33, 0,255,219, 30,221,190,188, 45, 85,189, 79, 15,164,190, 99, 16, 89,122,212, 33, 0,255,104, 90, 27, 63,223, 37, 8,188,
-107,184,182,190, 8,158,202, 81,185, 9, 0,255,175, 73, 0,191,223, 37, 8,188,107,184,182,190,248, 97,202, 81,185, 9, 0,255,
-138,243, 32, 63, 40, 68,132, 61,107,184,182,190, 60,131,145,239, 95, 23, 0,255,209,226, 5,191, 40, 68,132, 61,107,184,182,190,
-196,124,145,239, 95, 23, 0,255,178,124, 25, 63,250,195,236, 61,181,218,180,190, 27,228, 22,153,206, 70, 0,255,242,215,252,190,
-250,195,236, 61,181,218,180,190,229, 27, 22,153,206, 70, 0,255,112,194, 7, 63, 74,214,221, 61,153, 49,162,190, 65, 68,253,168,
-113, 64, 0,255,111, 99,217,190, 74,214,221, 61,153, 49,162,190,191,187,253,168,113, 64, 0,255,135,153,228, 62, 97,150,169, 61,
- 44,122,125,190,113, 86,190,222, 87, 88, 0,255, 20,120,174,190, 97,150,169, 61, 44,122,125,190,143,169,190,222, 87, 88, 0,255,
-209,187,226, 62,216,126,230, 60,198,170,141,190,196, 95,107,182,100, 42, 0,255, 93,154,172,190,216,126,230, 60,198,170,141,190,
- 60,160,107,182,100, 42, 0,255,180, 18,208, 62,223, 37, 8,188,198,170,141,190, 42,111, 21, 14,220, 61, 0,255, 65,241,153,190,
-223, 37, 8,188,198,170,141,190,214,144, 21, 14,220, 61, 0,255,100, 0,223, 62,161,220, 67,188,198,170,141,190, 3, 79, 4, 91,
- 19, 43, 2,255,241,222,168,190,161,220, 67,188,198,170,141,190,253,176, 4, 91, 19, 43, 2,255,135,153,228, 62, 92, 82, 55,189,
-198,170,141,190,207,107,198,254,250, 68, 2,255, 20,120,174,190, 92, 82, 55,189,198,170,141,190, 49,148,198,254,250, 68, 2,255,
-174, 34,221, 62, 29, 9,115,189,198,170,141,190, 7, 82,225, 64,200, 73, 0,255, 59, 1,167,190, 29, 9,115,189,198,170,141,190,
-249,173,225, 64,200, 73, 0,255,220,155,200, 62,188, 45, 85,189,146, 76, 58,190, 38,117, 66,207, 47,239, 0,255,105,122,146,190,
-188, 45, 85,189,146, 76, 58,190,218,138, 66,207, 47,239, 0,255, 38,190,198, 62,103,251,128,189, 15,209,106,190,150, 97,139, 18,
-184, 80, 0,255,179,156,144,190,103,251,128,189, 15,209,106,190,106,158,139, 18,184, 80, 0,255, 38,190,198, 62, 74,137, 10,189,
-231, 71,114,190, 17,116, 66,240,154, 51, 0,255,179,156,144,190, 74,137, 10,189,231, 71,114,190,239,139, 66,240,154, 51, 0,255,
- 66,103,217, 62, 45,246, 46, 61, 44,122,125,190,112,113,245,204, 39, 30, 0,255,207, 69,163,190, 45,246, 46, 61, 44,122,125,190,
-144,142,245,204, 39, 30, 0,255,202,203,239, 62,159,154,121, 61, 16,205,139,190,105, 90, 61,185,146, 56, 0,255, 88,170,185,190,
-159,154,121, 61, 16,205,139,190,151,165, 61,185,146, 56, 0,255,202,203,239, 62,239,172,106, 61, 10,221,152,190,191, 82,102,204,
-230, 82, 0,255, 88,170,185,190,239,172,106, 61, 10,221,152,190, 65,173,102,204,230, 82, 0,255,174, 34,221, 62, 29, 9,115,189,
- 10,221,152,190,246, 29, 64, 98, 94, 76, 0,255, 59, 1,167,190, 29, 9,115,189, 10,221,152,190, 10,226, 64, 98, 94, 76, 0,255,
- 61,119,230, 62, 92, 82, 55,189, 10,221,152,190,150, 77,111, 17, 75,100, 0,255,202, 85,176,190, 92, 82, 55,189, 10,221,152,190,
-106,178,111, 17, 75,100, 0,255, 26,222,224, 62, 98,147,127,188, 10,221,152,190,239, 60,190, 60,195, 94, 0,255,167,188,170,190,
- 98,147,127,188, 10,221,152,190, 17,195,190, 60,195, 94, 0,255,106,240,209, 62,223, 37, 8,188, 10,221,152,190,199, 83,178, 23,
-209, 93, 0,255,247,206,155,190,223, 37, 8,188, 10,221,152,190, 57,172,178, 23,209, 93, 0,255,135,153,228, 62,216,126,230, 60,
- 10,221,152,190, 98, 73, 1,200,170, 88, 0,255, 20,120,174,190,216,126,230, 60, 10,221,152,190,158,182, 1,200,170, 88, 0,255,
- 38,160, 9, 63,154,232,206, 61,147, 65,175,190, 23, 68,166,223,112,103, 0,255,219, 30,221,190,154,232,206, 61,147, 65,175,190,
-233,187,166,223,112,103, 0,255,104, 90, 27, 63, 74,214,221, 61,249, 12,192,190,165, 18,156,216, 89,120, 0,255,175, 73, 0,191,
- 74,214,221, 61,249, 12,192,190, 91,237,156,216, 89,120, 0,255, 27,192, 35, 63,159,154,121, 61,175,234,193,190, 25,185, 29,231,
-157,103, 0,255, 98,175, 8,191,159,154,121, 61,175,234,193,190,231, 70, 29,231,157,103, 0,255,249, 38, 30, 63,161,220, 67,188,
-249, 12,192,190, 43,209, 0, 64,119,100, 0,255, 64, 22, 3,191,161,220, 67,188,249, 12,192,190,213, 46, 0, 64,119,100, 0,255,
- 1,143, 10, 63,188, 45, 85,189, 73, 31,177,190, 52, 26,240, 92, 3, 84, 0,255,145,252,222,190,188, 45, 85,189, 73, 31,177,190,
-204,229,240, 92, 3, 84, 0,255, 21,238,237, 62, 29, 9,115,189, 16,205,139,190, 58, 8,116,111,101, 62, 0,255,162,204,183,190,
- 29, 9,115,189, 16,205,139,190,198,247,116,111,101, 62, 0,255,122,185,254, 62, 97,150,169, 61, 45,118,158,190,198, 80,102,213,
-175, 89, 0,255, 8,152,200,190, 97,150,169, 61, 45,118,158,190, 58,175,102,213,175, 89, 0,255,202,203,239, 62,226,194,133,186,
-192,186,154,190,136, 25,130, 0,108,125, 0,255, 88,170,185,190,226,194,133,186,192,186,154,190,120,230,130, 0,108,125, 0,255,
- 14,254,250, 62,115,128,187,188,119,152,156,190, 2, 27, 58, 30,104,121, 0,255,156,220,196,190,115,128,187,188,119,152,156,190,
-254,228, 58, 30,104,121, 0,255,223,245, 4, 63, 77,106,205, 59, 79, 15,164,190,218, 55,126,253, 35,115, 0,255, 76,202,211,190,
- 77,106,205, 59, 79, 15,164,190, 38,200,126,253, 35,115, 0,255,152, 75, 0, 63,216,126,230, 60,227, 83,160,190,164, 41,199,255,
- 8,121, 0,255,190,117,202,190,216,126,230, 60,227, 83,160,190, 92,214,199,255, 8,121, 0,255,149,211, 6, 63,239,172,106, 61,
- 5,237,165,190,237, 39,191, 9, 55,121, 0,255,185,133,215,190,239,172,106, 61, 5,237,165,190, 19,216,191, 9, 55,121, 0,255,
-220,125, 11, 63,205, 26, 17, 61,187,202,167,190,208, 46, 41,244,137,118, 0,255, 71,218,224,190,205, 26, 17, 61,187,202,167,190,
- 48,209, 41,244,137,118, 0,255,218, 5, 18, 63,222,227, 61, 61,113,168,169,190, 70, 53, 84, 3, 85,116, 2,255, 65,234,237,190,
-222,227, 61, 61,113,168,169,190,186,202, 84, 3, 85,116, 2,255, 73, 57, 15, 63,176,168,154, 61,113,168,169,190, 99, 44, 36, 38,
-212,113, 2,255, 31, 81,232,190,176,168,154, 61,113,168,169,190,157,211, 36, 38,212,113, 2,255,112,194, 7, 63, 54,180, 27, 62,
-249, 12,192,190,249,198, 3, 72,222,166, 3,255,111, 99,217,190, 54,180, 27, 62,249, 12,192,190, 7, 57, 3, 72,222,166, 3,255,
- 64,209, 34, 63,230,161, 42, 62,170,250,206,190,198, 37,123, 68,174,154, 3,255,135,192, 7,191,230,161, 42, 62,170,250,206,190,
- 58,218,123, 68,174,154, 3,255, 21,208, 48, 63, 57, 13,177, 61,102,200,195,190, 3,121,201, 17, 73,218, 3,255, 93,191, 21,191,
- 57, 13,177, 61,102,200,195,190,253,134,201, 17, 73,218, 3,255, 24, 72, 42, 63,211, 91,217,188, 62, 63,203,190, 59, 82, 75,200,
- 70,175, 3,255, 96, 55, 15,191,211, 91,217,188, 62, 63,203,190,197,173, 75,200, 70,175, 3,255, 38,160, 9, 63, 40,178,188,189,
-175,234,193,190,134,249,184,165,129,165, 3,255,219, 30,221,190, 40,178,188,189,175,234,193,190,122, 6,184,165,129,165, 3,255,
-140,137,215, 62, 97, 4,226,189,192,186,154,190,126,249,122,163,205,167, 1,255, 25,104,161,190, 97, 4,226,189,192,186,154,190,
-130, 6,122,163,205,167, 1,255,243, 84,232, 62, 65,148, 1, 62,187,202,167,190, 93,193,224, 65,229,165, 1,255,128, 51,178,190,
- 65,148, 1, 62,187,202,167,190,163, 62,224, 65,229,165, 1,255, 68, 65, 84, 65, 64, 1, 0, 0, 96,173,116, 1, 0, 0, 0, 0,
- 5, 1, 0, 0, 5, 0, 0, 0, 3, 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,
-224,174,116, 1, 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, 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, 68, 65, 84, 65, 28, 47, 0, 0,224,174,116, 1, 0, 0, 0, 0, 53, 0, 0, 0,237, 3, 0, 0,
- 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 34, 0, 2, 0, 0, 0, 43, 0, 0, 0,
- 0, 0, 34, 0, 43, 0, 0, 0, 45, 0, 0, 0, 0, 0, 34, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 34, 0, 1, 0, 0, 0,
- 46, 0, 0, 0, 0, 0, 34, 0, 44, 0, 0, 0, 46, 0, 0, 0, 0, 0, 34, 0, 3, 0, 0, 0, 44, 0, 0, 0, 0, 0, 34, 0,
- 2, 0, 0, 0, 4, 0, 0, 0, 0, 0, 34, 0, 4, 0, 0, 0, 41, 0, 0, 0, 0, 0, 34, 0, 41, 0, 0, 0, 43, 0, 0, 0,
- 0, 0, 34, 0, 3, 0, 0, 0, 5, 0, 0, 0, 0, 0, 34, 0, 42, 0, 0, 0, 44, 0, 0, 0, 0, 0, 34, 0, 5, 0, 0, 0,
- 42, 0, 0, 0, 0, 0, 34, 0, 2, 0, 0, 0, 8, 0, 0, 0, 0, 0, 34, 0, 6, 0, 0, 0, 8, 0, 0, 0, 0, 0, 34, 0,
- 4, 0, 0, 0, 6, 0, 0, 0, 0, 0, 34, 0, 7, 0, 0, 0, 9, 0, 0, 0, 0, 0, 34, 0, 3, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 34, 0, 5, 0, 0, 0, 7, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 34, 0, 8, 0, 0, 0,
- 10, 0, 0, 0, 0, 0, 34, 0, 9, 0, 0, 0, 11, 0, 0, 0, 0, 0, 34, 0, 1, 0, 0, 0, 11, 0, 0, 0, 0, 0, 34, 0,
- 10, 0, 0, 0, 12, 0, 0, 0, 0, 0, 34, 0, 12, 0, 0, 0, 14, 0, 0, 0, 0, 0, 34, 0, 8, 0, 0, 0, 14, 0, 0, 0,
- 0, 0, 34, 0, 11, 0, 0, 0, 13, 0, 0, 0, 0, 0, 34, 0, 14, 0, 0, 0, 15, 0, 0, 0, 0, 0, 34, 0, 6, 0, 0, 0,
- 15, 0, 0, 0, 0, 0, 34, 0, 7, 0, 0, 0, 16, 0, 0, 0, 0, 0, 34, 0, 14, 0, 0, 0, 19, 0, 0, 0, 0, 0, 34, 0,
- 17, 0, 0, 0, 19, 0, 0, 0, 0, 0, 34, 0, 15, 0, 0, 0, 17, 0, 0, 0, 0, 0, 34, 0, 18, 0, 0, 0, 20, 0, 0, 0,
- 0, 0, 34, 0, 16, 0, 0, 0, 18, 0, 0, 0, 0, 0, 34, 0, 12, 0, 0, 0, 21, 0, 0, 0, 0, 0, 34, 0, 19, 0, 0, 0,
- 21, 0, 0, 0, 0, 0, 34, 0, 20, 0, 0, 0, 22, 0, 0, 0, 0, 0, 34, 0, 13, 0, 0, 0, 22, 0, 0, 0, 0, 0, 34, 0,
- 21, 0, 0, 0, 23, 0, 0, 0, 0, 0, 34, 0, 23, 0, 0, 0, 25, 0, 0, 0, 0, 0, 34, 0, 19, 0, 0, 0, 25, 0, 0, 0,
- 0, 0, 34, 0, 24, 0, 0, 0, 26, 0, 0, 0, 0, 0, 34, 0, 22, 0, 0, 0, 24, 0, 0, 0, 0, 0, 34, 0, 20, 0, 0, 0,
- 26, 0, 0, 0, 0, 0, 34, 0, 25, 0, 0, 0, 27, 0, 0, 0, 0, 0, 34, 0, 17, 0, 0, 0, 27, 0, 0, 0, 0, 0, 34, 0,
- 26, 0, 0, 0, 28, 0, 0, 0, 0, 0, 34, 0, 18, 0, 0, 0, 28, 0, 0, 0, 0, 0, 34, 0, 25, 0, 0, 0, 31, 0, 0, 0,
- 0, 0, 34, 0, 29, 0, 0, 0, 31, 0, 0, 0, 0, 0, 34, 0, 27, 0, 0, 0, 29, 0, 0, 0, 0, 0, 34, 0, 30, 0, 0, 0,
- 32, 0, 0, 0, 0, 0, 34, 0, 26, 0, 0, 0, 32, 0, 0, 0, 0, 0, 34, 0, 28, 0, 0, 0, 30, 0, 0, 0, 0, 0, 34, 0,
- 23, 0, 0, 0, 33, 0, 0, 0, 0, 0, 34, 0, 31, 0, 0, 0, 33, 0, 0, 0, 0, 0, 34, 0, 32, 0, 0, 0, 34, 0, 0, 0,
- 0, 0, 34, 0, 24, 0, 0, 0, 34, 0, 0, 0, 0, 0, 34, 0, 33, 0, 0, 0, 35, 0, 0, 0, 0, 0, 34, 0, 35, 0, 0, 0,
- 37, 0, 0, 0, 0, 0, 34, 0, 31, 0, 0, 0, 37, 0, 0, 0, 0, 0, 34, 0, 36, 0, 0, 0, 38, 0, 0, 0, 0, 0, 34, 0,
- 34, 0, 0, 0, 36, 0, 0, 0, 0, 0, 34, 0, 32, 0, 0, 0, 38, 0, 0, 0, 0, 0, 34, 0, 37, 0, 0, 0, 39, 0, 0, 0,
- 0, 0, 34, 0, 29, 0, 0, 0, 39, 0, 0, 0, 0, 0, 34, 0, 38, 0, 0, 0, 40, 0, 0, 0, 0, 0, 34, 0, 30, 0, 0, 0,
- 40, 0, 0, 0, 0, 0, 34, 0, 37, 0, 0, 0, 43, 0, 0, 0, 0, 0, 34, 0, 39, 0, 0, 0, 41, 0, 0, 0, 0, 0, 34, 0,
- 38, 0, 0, 0, 44, 0, 0, 0, 0, 0, 34, 0, 40, 0, 0, 0, 42, 0, 0, 0, 0, 0, 34, 0, 35, 0, 0, 0, 45, 0, 0, 0,
- 0, 0, 34, 0, 36, 0, 0, 0, 46, 0, 0, 0, 0, 0, 34, 0, 35, 0, 0, 0, 49, 0, 0, 0, 0, 0, 34, 0, 47, 0, 0, 0,
- 49, 0, 0, 0, 0, 0, 34, 0, 45, 0, 0, 0, 47, 0, 0, 0, 0, 0, 34, 0, 36, 0, 0, 0, 50, 0, 0, 0, 0, 0, 34, 0,
- 46, 0, 0, 0, 48, 0, 0, 0, 0, 0, 34, 0, 48, 0, 0, 0, 50, 0, 0, 0, 0, 0, 34, 0, 33, 0, 0, 0, 51, 0, 0, 0,
- 0, 0, 34, 0, 49, 0, 0, 0, 51, 0, 0, 0, 0, 0, 34, 0, 34, 0, 0, 0, 52, 0, 0, 0, 0, 0, 34, 0, 50, 0, 0, 0,
- 52, 0, 0, 0, 0, 0, 34, 0, 23, 0, 0, 0, 53, 0, 0, 0, 0, 0, 34, 0, 51, 0, 0, 0, 53, 0, 0, 0, 0, 0, 34, 0,
- 24, 0, 0, 0, 54, 0, 0, 0, 0, 0, 34, 0, 52, 0, 0, 0, 54, 0, 0, 0, 0, 0, 34, 0, 21, 0, 0, 0, 55, 0, 0, 0,
- 0, 0, 34, 0, 53, 0, 0, 0, 55, 0, 0, 0, 0, 0, 34, 0, 22, 0, 0, 0, 56, 0, 0, 0, 0, 0, 34, 0, 54, 0, 0, 0,
- 56, 0, 0, 0, 0, 0, 34, 0, 12, 0, 0, 0, 57, 0, 0, 0, 0, 0, 34, 0, 55, 0, 0, 0, 57, 0, 0, 0, 0, 0, 34, 0,
- 13, 0, 0, 0, 58, 0, 0, 0, 0, 0, 34, 0, 56, 0, 0, 0, 58, 0, 0, 0, 0, 0, 34, 0, 10, 0, 0, 0, 61, 0, 0, 0,
- 0, 0, 34, 0, 57, 0, 0, 0, 61, 0, 0, 0, 0, 0, 34, 0, 11, 0, 0, 0, 62, 0, 0, 0, 0, 0, 34, 0, 58, 0, 0, 0,
- 62, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 63, 0, 0, 0, 0, 0, 34, 0, 61, 0, 0, 0, 63, 0, 0, 0, 0, 0, 34, 0,
- 1, 0, 0, 0, 64, 0, 0, 0, 0, 0, 34, 0, 62, 0, 0, 0, 64, 0, 0, 0, 0, 0, 34, 0, 47, 0, 0, 0, 63, 0, 0, 0,
- 0, 0, 34, 0, 48, 0, 0, 0, 64, 0, 0, 0, 0, 0, 34, 0, 59, 0, 0, 0, 63, 0, 0, 0, 0, 0, 34, 0, 47, 0, 0, 0,
- 59, 0, 0, 0, 0, 0, 34, 0, 60, 0, 0, 0, 64, 0, 0, 0, 0, 0, 34, 0, 48, 0, 0, 0, 60, 0, 0, 0, 0, 0, 34, 0,
- 59, 0, 0, 0, 61, 0, 0, 0, 0, 0, 34, 0, 60, 0, 0, 0, 62, 0, 0, 0, 0, 0, 34, 0, 57, 0, 0, 0, 59, 0, 0, 0,
- 0, 0, 34, 0, 58, 0, 0, 0, 60, 0, 0, 0, 0, 0, 34, 0, 55, 0, 0, 0, 59, 0, 0, 0, 0, 0, 34, 0, 56, 0, 0, 0,
- 60, 0, 0, 0, 0, 0, 34, 0, 53, 0, 0, 0, 59, 0, 0, 0, 0, 0, 34, 0, 54, 0, 0, 0, 60, 0, 0, 0, 0, 0, 34, 0,
- 51, 0, 0, 0, 59, 0, 0, 0, 0, 0, 34, 0, 52, 0, 0, 0, 60, 0, 0, 0, 0, 0, 34, 0, 49, 0, 0, 0, 59, 0, 0, 0,
- 0, 0, 34, 0, 50, 0, 0, 0, 60, 0, 0, 0, 0, 0, 34, 0, 87, 0, 0, 0,171, 0, 0, 0, 0, 0, 34, 0,171, 0, 0, 0,
-173, 0, 0, 0, 0, 0, 34, 0, 89, 0, 0, 0,173, 0, 0, 0, 0, 0, 34, 0, 87, 0, 0, 0, 89, 0, 0, 0, 0, 0, 34, 0,
-172, 0, 0, 0,173, 0, 0, 0, 0, 0, 34, 0, 88, 0, 0, 0,172, 0, 0, 0, 0, 0, 34, 0, 88, 0, 0, 0, 89, 0, 0, 0,
- 0, 0, 34, 0, 85, 0, 0, 0,169, 0, 0, 0, 0, 0, 34, 0,169, 0, 0, 0,171, 0, 0, 0, 0, 0, 34, 0, 85, 0, 0, 0,
- 87, 0, 0, 0, 0, 0, 34, 0,170, 0, 0, 0,172, 0, 0, 0, 0, 0, 34, 0, 86, 0, 0, 0,170, 0, 0, 0, 0, 0, 34, 0,
- 86, 0, 0, 0, 88, 0, 0, 0, 0, 0, 34, 0, 83, 0, 0, 0,167, 0, 0, 0, 0, 0, 34, 0,167, 0, 0, 0,169, 0, 0, 0,
- 0, 0, 34, 0, 83, 0, 0, 0, 85, 0, 0, 0, 0, 0, 34, 0,168, 0, 0, 0,170, 0, 0, 0, 0, 0, 34, 0, 84, 0, 0, 0,
-168, 0, 0, 0, 0, 0, 34, 0, 84, 0, 0, 0, 86, 0, 0, 0, 0, 0, 34, 0, 81, 0, 0, 0,165, 0, 0, 0, 0, 0, 34, 0,
-165, 0, 0, 0,167, 0, 0, 0, 0, 0, 34, 0, 81, 0, 0, 0, 83, 0, 0, 0, 0, 0, 34, 0,166, 0, 0, 0,168, 0, 0, 0,
- 0, 0, 34, 0, 82, 0, 0, 0,166, 0, 0, 0, 0, 0, 34, 0, 82, 0, 0, 0, 84, 0, 0, 0, 0, 0, 34, 0, 79, 0, 0, 0,
-163, 0, 0, 0, 0, 0, 34, 0,163, 0, 0, 0,165, 0, 0, 0, 0, 0, 34, 0, 79, 0, 0, 0, 81, 0, 0, 0, 0, 0, 34, 0,
-164, 0, 0, 0,166, 0, 0, 0, 0, 0, 34, 0, 80, 0, 0, 0,164, 0, 0, 0, 0, 0, 34, 0, 80, 0, 0, 0, 82, 0, 0, 0,
- 0, 0, 34, 0, 77, 0, 0, 0, 90, 0, 0, 0, 0, 0, 34, 0, 90, 0, 0, 0,143, 0, 0, 0, 0, 0, 34, 0,143, 0, 0, 0,
-161, 0, 0, 0, 0, 0, 34, 0, 77, 0, 0, 0,161, 0, 0, 0, 0, 0, 34, 0, 91, 0, 0, 0,144, 0, 0, 0, 0, 0, 34, 0,
- 78, 0, 0, 0, 91, 0, 0, 0, 0, 0, 34, 0, 78, 0, 0, 0,162, 0, 0, 0, 0, 0, 34, 0,144, 0, 0, 0,162, 0, 0, 0,
- 0, 0, 34, 0, 90, 0, 0, 0, 92, 0, 0, 0, 0, 0, 34, 0, 92, 0, 0, 0,145, 0, 0, 0, 0, 0, 34, 0,143, 0, 0, 0,
-145, 0, 0, 0, 0, 0, 34, 0, 93, 0, 0, 0,146, 0, 0, 0, 0, 0, 34, 0, 91, 0, 0, 0, 93, 0, 0, 0, 0, 0, 34, 0,
-144, 0, 0, 0,146, 0, 0, 0, 0, 0, 34, 0, 92, 0, 0, 0, 94, 0, 0, 0, 0, 0, 34, 0, 94, 0, 0, 0,147, 0, 0, 0,
- 0, 0, 34, 0,145, 0, 0, 0,147, 0, 0, 0, 0, 0, 34, 0, 95, 0, 0, 0,148, 0, 0, 0, 0, 0, 34, 0, 93, 0, 0, 0,
- 95, 0, 0, 0, 0, 0, 34, 0,146, 0, 0, 0,148, 0, 0, 0, 0, 0, 34, 0, 94, 0, 0, 0, 96, 0, 0, 0, 0, 0, 34, 0,
- 96, 0, 0, 0,149, 0, 0, 0, 0, 0, 34, 0,147, 0, 0, 0,149, 0, 0, 0, 0, 0, 34, 0, 97, 0, 0, 0,150, 0, 0, 0,
- 0, 0, 34, 0, 95, 0, 0, 0, 97, 0, 0, 0, 0, 0, 34, 0,148, 0, 0, 0,150, 0, 0, 0, 0, 0, 34, 0, 96, 0, 0, 0,
- 98, 0, 0, 0, 0, 0, 34, 0, 98, 0, 0, 0,151, 0, 0, 0, 0, 0, 34, 0,149, 0, 0, 0,151, 0, 0, 0, 0, 0, 34, 0,
- 99, 0, 0, 0,152, 0, 0, 0, 0, 0, 34, 0, 97, 0, 0, 0, 99, 0, 0, 0, 0, 0, 34, 0,150, 0, 0, 0,152, 0, 0, 0,
- 0, 0, 34, 0, 98, 0, 0, 0,100, 0, 0, 0, 0, 0, 34, 0,100, 0, 0, 0,153, 0, 0, 0, 0, 0, 34, 0,151, 0, 0, 0,
-153, 0, 0, 0, 0, 0, 34, 0,101, 0, 0, 0,154, 0, 0, 0, 0, 0, 34, 0, 99, 0, 0, 0,101, 0, 0, 0, 0, 0, 34, 0,
-152, 0, 0, 0,154, 0, 0, 0, 0, 0, 34, 0,100, 0, 0, 0,102, 0, 0, 0, 0, 0, 34, 0,102, 0, 0, 0,155, 0, 0, 0,
- 0, 0, 34, 0,153, 0, 0, 0,155, 0, 0, 0, 0, 0, 34, 0,103, 0, 0, 0,156, 0, 0, 0, 0, 0, 34, 0,101, 0, 0, 0,
-103, 0, 0, 0, 0, 0, 34, 0,154, 0, 0, 0,156, 0, 0, 0, 0, 0, 34, 0,102, 0, 0, 0,104, 0, 0, 0, 0, 0, 34, 0,
-104, 0, 0, 0,157, 0, 0, 0, 0, 0, 34, 0,155, 0, 0, 0,157, 0, 0, 0, 0, 0, 34, 0,105, 0, 0, 0,158, 0, 0, 0,
- 0, 0, 34, 0,103, 0, 0, 0,105, 0, 0, 0, 0, 0, 34, 0,156, 0, 0, 0,158, 0, 0, 0, 0, 0, 34, 0,104, 0, 0, 0,
-106, 0, 0, 0, 0, 0, 34, 0,106, 0, 0, 0,159, 0, 0, 0, 0, 0, 34, 0,157, 0, 0, 0,159, 0, 0, 0, 0, 0, 34, 0,
-107, 0, 0, 0,160, 0, 0, 0, 0, 0, 34, 0,105, 0, 0, 0,107, 0, 0, 0, 0, 0, 34, 0,158, 0, 0, 0,160, 0, 0, 0,
- 0, 0, 34, 0, 65, 0, 0, 0,106, 0, 0, 0, 0, 0, 34, 0, 65, 0, 0, 0, 66, 0, 0, 0, 0, 0, 34, 0, 66, 0, 0, 0,
-159, 0, 0, 0, 0, 0, 34, 0, 65, 0, 0, 0,107, 0, 0, 0, 0, 0, 34, 0, 66, 0, 0, 0,160, 0, 0, 0, 0, 0, 34, 0,
-108, 0, 0, 0,125, 0, 0, 0, 0, 0, 34, 0,125, 0, 0, 0,157, 0, 0, 0, 0, 0, 34, 0,108, 0, 0, 0,159, 0, 0, 0,
- 0, 0, 34, 0,126, 0, 0, 0,158, 0, 0, 0, 0, 0, 34, 0,109, 0, 0, 0,126, 0, 0, 0, 0, 0, 34, 0,109, 0, 0, 0,
-160, 0, 0, 0, 0, 0, 34, 0,125, 0, 0, 0,176, 0, 0, 0, 0, 0, 34, 0,155, 0, 0, 0,176, 0, 0, 0, 0, 0, 34, 0,
-156, 0, 0, 0,177, 0, 0, 0, 0, 0, 34, 0,126, 0, 0, 0,177, 0, 0, 0, 0, 0, 34, 0,123, 0, 0, 0,153, 0, 0, 0,
- 0, 0, 34, 0,123, 0, 0, 0,176, 0, 0, 0, 0, 0, 34, 0,124, 0, 0, 0,154, 0, 0, 0, 0, 0, 34, 0,124, 0, 0, 0,
-177, 0, 0, 0, 0, 0, 34, 0,121, 0, 0, 0,151, 0, 0, 0, 0, 0, 34, 0,121, 0, 0, 0,123, 0, 0, 0, 0, 0, 34, 0,
-122, 0, 0, 0,152, 0, 0, 0, 0, 0, 34, 0,122, 0, 0, 0,124, 0, 0, 0, 0, 0, 34, 0,119, 0, 0, 0,149, 0, 0, 0,
- 0, 0, 34, 0,119, 0, 0, 0,121, 0, 0, 0, 0, 0, 34, 0,120, 0, 0, 0,150, 0, 0, 0, 0, 0, 34, 0,120, 0, 0, 0,
-122, 0, 0, 0, 0, 0, 34, 0,117, 0, 0, 0,147, 0, 0, 0, 0, 0, 34, 0,117, 0, 0, 0,119, 0, 0, 0, 0, 0, 34, 0,
-118, 0, 0, 0,148, 0, 0, 0, 0, 0, 34, 0,118, 0, 0, 0,120, 0, 0, 0, 0, 0, 34, 0,115, 0, 0, 0,145, 0, 0, 0,
- 0, 0, 34, 0,115, 0, 0, 0,117, 0, 0, 0, 0, 0, 34, 0,116, 0, 0, 0,146, 0, 0, 0, 0, 0, 34, 0,116, 0, 0, 0,
-118, 0, 0, 0, 0, 0, 34, 0,113, 0, 0, 0,143, 0, 0, 0, 0, 0, 34, 0,113, 0, 0, 0,115, 0, 0, 0, 0, 0, 34, 0,
-114, 0, 0, 0,144, 0, 0, 0, 0, 0, 34, 0,114, 0, 0, 0,116, 0, 0, 0, 0, 0, 34, 0,112, 0, 0, 0,162, 0, 0, 0,
- 0, 0, 34, 0,112, 0, 0, 0,114, 0, 0, 0, 0, 0, 34, 0,174, 0, 0, 0,178, 0, 0, 0, 0, 0, 34, 0,161, 0, 0, 0,
-174, 0, 0, 0, 0, 0, 34, 0,174, 0, 0, 0,179, 0, 0, 0, 0, 0, 34, 0,112, 0, 0, 0,179, 0, 0, 0, 0, 0, 34, 0,
-162, 0, 0, 0,174, 0, 0, 0, 0, 0, 34, 0, 66, 0, 0, 0,110, 0, 0, 0, 0, 0, 34, 0,108, 0, 0, 0,110, 0, 0, 0,
- 0, 0, 34, 0,109, 0, 0, 0,111, 0, 0, 0, 0, 0, 34, 0, 66, 0, 0, 0,111, 0, 0, 0, 0, 0, 34, 0, 66, 0, 0, 0,
-175, 0, 0, 0, 0, 0, 34, 0,175, 0, 0, 0,180, 0, 0, 0, 0, 0, 34, 0,110, 0, 0, 0,180, 0, 0, 0, 0, 0, 34, 0,
-111, 0, 0, 0,181, 0, 0, 0, 0, 0, 34, 0,175, 0, 0, 0,181, 0, 0, 0, 0, 0, 34, 0,178, 0, 0, 0,180, 0, 0, 0,
- 0, 0, 34, 0,174, 0, 0, 0,175, 0, 0, 0, 0, 0, 32, 0,179, 0, 0, 0,181, 0, 0, 0, 0, 0, 34, 0,132, 0, 0, 0,
-134, 0, 0, 0, 0, 0, 34, 0,134, 0, 0, 0,173, 0, 0, 0, 0, 0, 34, 0,132, 0, 0, 0,171, 0, 0, 0, 0, 0, 34, 0,
-133, 0, 0, 0,134, 0, 0, 0, 0, 0, 34, 0,133, 0, 0, 0,172, 0, 0, 0, 0, 0, 34, 0,130, 0, 0, 0,132, 0, 0, 0,
- 0, 0, 34, 0,130, 0, 0, 0,169, 0, 0, 0, 0, 0, 34, 0,131, 0, 0, 0,133, 0, 0, 0, 0, 0, 34, 0,131, 0, 0, 0,
-170, 0, 0, 0, 0, 0, 34, 0,128, 0, 0, 0,130, 0, 0, 0, 0, 0, 34, 0,128, 0, 0, 0,167, 0, 0, 0, 0, 0, 34, 0,
-129, 0, 0, 0,131, 0, 0, 0, 0, 0, 34, 0,129, 0, 0, 0,168, 0, 0, 0, 0, 0, 34, 0,163, 0, 0, 0,184, 0, 0, 0,
- 0, 0, 34, 0,182, 0, 0, 0,184, 0, 0, 0, 0, 0, 34, 0,165, 0, 0, 0,182, 0, 0, 0, 0, 0, 34, 0,183, 0, 0, 0,
-185, 0, 0, 0, 0, 0, 34, 0,164, 0, 0, 0,185, 0, 0, 0, 0, 0, 34, 0,166, 0, 0, 0,183, 0, 0, 0, 0, 0, 34, 0,
-128, 0, 0, 0,182, 0, 0, 0, 0, 0, 34, 0,129, 0, 0, 0,183, 0, 0, 0, 0, 0, 34, 0,141, 0, 0, 0,187, 0, 0, 0,
- 0, 0, 34, 0,186, 0, 0, 0,187, 0, 0, 0, 0, 0, 32, 0,184, 0, 0, 0,186, 0, 0, 0, 0, 0, 34, 0,141, 0, 0, 0,
-184, 0, 0, 0, 0, 0, 34, 0,142, 0, 0, 0,187, 0, 0, 0, 0, 0, 34, 0,142, 0, 0, 0,185, 0, 0, 0, 0, 0, 34, 0,
-185, 0, 0, 0,186, 0, 0, 0, 0, 0, 34, 0, 67, 0, 0, 0,186, 0, 0, 0, 0, 0, 32, 0, 67, 0, 0, 0,182, 0, 0, 0,
- 0, 0, 34, 0, 67, 0, 0, 0,183, 0, 0, 0, 0, 0, 34, 0,127, 0, 0, 0,128, 0, 0, 0, 0, 0, 34, 0, 67, 0, 0, 0,
-127, 0, 0, 0, 0, 0, 32, 0,127, 0, 0, 0,129, 0, 0, 0, 0, 0, 34, 0,139, 0, 0, 0,190, 0, 0, 0, 0, 0, 34, 0,
-188, 0, 0, 0,190, 0, 0, 0, 0, 0, 34, 0,141, 0, 0, 0,188, 0, 0, 0, 0, 0, 34, 0,139, 0, 0, 0,141, 0, 0, 0,
- 0, 0, 34, 0,189, 0, 0, 0,191, 0, 0, 0, 0, 0, 34, 0,140, 0, 0, 0,191, 0, 0, 0, 0, 0, 34, 0,140, 0, 0, 0,
-142, 0, 0, 0, 0, 0, 34, 0,142, 0, 0, 0,189, 0, 0, 0, 0, 0, 34, 0,137, 0, 0, 0,192, 0, 0, 0, 0, 0, 34, 0,
-190, 0, 0, 0,192, 0, 0, 0, 0, 0, 34, 0,137, 0, 0, 0,139, 0, 0, 0, 0, 0, 34, 0,191, 0, 0, 0,193, 0, 0, 0,
- 0, 0, 34, 0,138, 0, 0, 0,193, 0, 0, 0, 0, 0, 34, 0,138, 0, 0, 0,140, 0, 0, 0, 0, 0, 34, 0,136, 0, 0, 0,
-194, 0, 0, 0, 0, 0, 34, 0,192, 0, 0, 0,194, 0, 0, 0, 0, 0, 34, 0,136, 0, 0, 0,137, 0, 0, 0, 0, 0, 34, 0,
-193, 0, 0, 0,195, 0, 0, 0, 0, 0, 34, 0,136, 0, 0, 0,195, 0, 0, 0, 0, 0, 34, 0,136, 0, 0, 0,138, 0, 0, 0,
- 0, 0, 34, 0, 69, 0, 0, 0,135, 0, 0, 0, 0, 0, 34, 0, 69, 0, 0, 0,194, 0, 0, 0, 0, 0, 34, 0,135, 0, 0, 0,
-136, 0, 0, 0, 0, 0, 34, 0, 69, 0, 0, 0,195, 0, 0, 0, 0, 0, 34, 0, 68, 0, 0, 0,188, 0, 0, 0, 0, 0, 34, 0,
- 68, 0, 0, 0,187, 0, 0, 0, 0, 0, 34, 0, 68, 0, 0, 0,189, 0, 0, 0, 0, 0, 34, 0,188, 0, 0, 0,203, 0, 0, 0,
- 0, 0, 34, 0,203, 0, 0, 0,205, 0, 0, 0, 0, 0, 34, 0, 68, 0, 0, 0,205, 0, 0, 0, 0, 0, 34, 0,189, 0, 0, 0,
-204, 0, 0, 0, 0, 0, 34, 0,204, 0, 0, 0,205, 0, 0, 0, 0, 0, 34, 0, 69, 0, 0, 0,196, 0, 0, 0, 0, 0, 34, 0,
-196, 0, 0, 0,197, 0, 0, 0, 0, 0, 34, 0,194, 0, 0, 0,197, 0, 0, 0, 0, 0, 34, 0,196, 0, 0, 0,198, 0, 0, 0,
- 0, 0, 34, 0,195, 0, 0, 0,198, 0, 0, 0, 0, 0, 34, 0,197, 0, 0, 0,199, 0, 0, 0, 0, 0, 34, 0,192, 0, 0, 0,
-199, 0, 0, 0, 0, 0, 34, 0,198, 0, 0, 0,200, 0, 0, 0, 0, 0, 34, 0,193, 0, 0, 0,200, 0, 0, 0, 0, 0, 34, 0,
-199, 0, 0, 0,201, 0, 0, 0, 0, 0, 34, 0,190, 0, 0, 0,201, 0, 0, 0, 0, 0, 34, 0,200, 0, 0, 0,202, 0, 0, 0,
- 0, 0, 34, 0,191, 0, 0, 0,202, 0, 0, 0, 0, 0, 34, 0,201, 0, 0, 0,203, 0, 0, 0, 0, 0, 34, 0,202, 0, 0, 0,
-204, 0, 0, 0, 0, 0, 34, 0,196, 0, 0, 0,201, 0, 0, 0, 0, 0, 34, 0,196, 0, 0, 0,202, 0, 0, 0, 0, 0, 34, 0,
-196, 0, 0, 0,205, 0, 0, 0, 0, 0, 34, 0,137, 0, 0, 0,161, 0, 0, 0, 0, 0, 34, 0,136, 0, 0, 0,174, 0, 0, 0,
- 0, 0, 34, 0,138, 0, 0, 0,162, 0, 0, 0, 0, 0, 34, 0,139, 0, 0, 0,208, 0, 0, 0, 0, 0, 34, 0,161, 0, 0, 0,
-208, 0, 0, 0, 0, 0, 34, 0,140, 0, 0, 0,209, 0, 0, 0, 0, 0, 34, 0,162, 0, 0, 0,209, 0, 0, 0, 0, 0, 34, 0,
-141, 0, 0, 0,210, 0, 0, 0, 0, 0, 34, 0,208, 0, 0, 0,210, 0, 0, 0, 0, 0, 34, 0,142, 0, 0, 0,211, 0, 0, 0,
- 0, 0, 34, 0,209, 0, 0, 0,211, 0, 0, 0, 0, 0, 34, 0,163, 0, 0, 0,210, 0, 0, 0, 0, 0, 34, 0,164, 0, 0, 0,
-211, 0, 0, 0, 0, 0, 34, 0, 79, 0, 0, 0,206, 0, 0, 0, 0, 0, 34, 0,206, 0, 0, 0,210, 0, 0, 0, 0, 0, 34, 0,
-207, 0, 0, 0,211, 0, 0, 0, 0, 0, 34, 0, 80, 0, 0, 0,207, 0, 0, 0, 0, 0, 34, 0,206, 0, 0, 0,212, 0, 0, 0,
- 0, 0, 34, 0,208, 0, 0, 0,212, 0, 0, 0, 0, 0, 34, 0,209, 0, 0, 0,213, 0, 0, 0, 0, 0, 34, 0,207, 0, 0, 0,
-213, 0, 0, 0, 0, 0, 34, 0, 77, 0, 0, 0,212, 0, 0, 0, 0, 0, 34, 0, 78, 0, 0, 0,213, 0, 0, 0, 0, 0, 34, 0,
- 70, 0, 0, 0,127, 0, 0, 0, 0, 0, 34, 0, 70, 0, 0, 0,219, 0, 0, 0, 0, 0, 34, 0,128, 0, 0, 0,219, 0, 0, 0,
- 0, 0, 34, 0,129, 0, 0, 0,220, 0, 0, 0, 0, 0, 34, 0, 70, 0, 0, 0,220, 0, 0, 0, 0, 0, 34, 0,217, 0, 0, 0,
-219, 0, 0, 0, 0, 0, 34, 0,130, 0, 0, 0,217, 0, 0, 0, 0, 0, 34, 0,131, 0, 0, 0,218, 0, 0, 0, 0, 0, 34, 0,
-218, 0, 0, 0,220, 0, 0, 0, 0, 0, 34, 0,215, 0, 0, 0,217, 0, 0, 0, 0, 0, 34, 0,132, 0, 0, 0,215, 0, 0, 0,
- 0, 0, 34, 0,133, 0, 0, 0,216, 0, 0, 0, 0, 0, 34, 0,216, 0, 0, 0,218, 0, 0, 0, 0, 0, 34, 0,214, 0, 0, 0,
-215, 0, 0, 0, 0, 0, 34, 0,134, 0, 0, 0,214, 0, 0, 0, 0, 0, 34, 0,214, 0, 0, 0,216, 0, 0, 0, 0, 0, 34, 0,
-215, 0, 0, 0,226, 0, 0, 0, 0, 0, 34, 0,226, 0, 0, 0,228, 0, 0, 0, 0, 0, 34, 0,214, 0, 0, 0,228, 0, 0, 0,
- 0, 0, 34, 0,216, 0, 0, 0,227, 0, 0, 0, 0, 0, 34, 0,227, 0, 0, 0,228, 0, 0, 0, 0, 0, 34, 0,217, 0, 0, 0,
-224, 0, 0, 0, 0, 0, 34, 0,224, 0, 0, 0,226, 0, 0, 0, 0, 0, 34, 0,218, 0, 0, 0,225, 0, 0, 0, 0, 0, 34, 0,
-225, 0, 0, 0,227, 0, 0, 0, 0, 0, 34, 0,219, 0, 0, 0,222, 0, 0, 0, 0, 0, 34, 0,222, 0, 0, 0,224, 0, 0, 0,
- 0, 0, 34, 0,220, 0, 0, 0,223, 0, 0, 0, 0, 0, 34, 0,223, 0, 0, 0,225, 0, 0, 0, 0, 0, 34, 0, 70, 0, 0, 0,
-221, 0, 0, 0, 0, 0, 34, 0,221, 0, 0, 0,222, 0, 0, 0, 0, 0, 34, 0,221, 0, 0, 0,223, 0, 0, 0, 0, 0, 34, 0,
-221, 0, 0, 0,228, 0, 0, 0, 0, 0, 34, 0,222, 0, 0, 0,226, 0, 0, 0, 0, 0, 34, 0,223, 0, 0, 0,227, 0, 0, 0,
- 0, 0, 34, 0,178, 0, 0, 0,231, 0, 0, 0, 0, 0, 34, 0,229, 0, 0, 0,231, 0, 0, 0, 0, 0, 34, 0,180, 0, 0, 0,
-229, 0, 0, 0, 0, 0, 34, 0,179, 0, 0, 0,232, 0, 0, 0, 0, 0, 34, 0,181, 0, 0, 0,230, 0, 0, 0, 0, 0, 34, 0,
-230, 0, 0, 0,232, 0, 0, 0, 0, 0, 34, 0,229, 0, 0, 0,251, 0, 0, 0, 0, 0, 34, 0,110, 0, 0, 0,251, 0, 0, 0,
- 0, 0, 34, 0,111, 0, 0, 0,252, 0, 0, 0, 0, 0, 34, 0,230, 0, 0, 0,252, 0, 0, 0, 0, 0, 34, 0,251, 0, 0, 0,
-253, 0, 0, 0, 0, 0, 34, 0,108, 0, 0, 0,253, 0, 0, 0, 0, 0, 34, 0,109, 0, 0, 0,254, 0, 0, 0, 0, 0, 34, 0,
-252, 0, 0, 0,254, 0, 0, 0, 0, 0, 34, 0,231, 0, 0, 0,249, 0, 0, 0, 0, 0, 34, 0,112, 0, 0, 0,250, 0, 0, 0,
- 0, 0, 34, 0,232, 0, 0, 0,250, 0, 0, 0, 0, 0, 34, 0,113, 0, 0, 0,247, 0, 0, 0, 0, 0, 34, 0,247, 0, 0, 0,
-249, 0, 0, 0, 0, 0, 34, 0,114, 0, 0, 0,248, 0, 0, 0, 0, 0, 34, 0,248, 0, 0, 0,250, 0, 0, 0, 0, 0, 34, 0,
-115, 0, 0, 0,245, 0, 0, 0, 0, 0, 34, 0,245, 0, 0, 0,247, 0, 0, 0, 0, 0, 34, 0,116, 0, 0, 0,246, 0, 0, 0,
- 0, 0, 34, 0,246, 0, 0, 0,248, 0, 0, 0, 0, 0, 34, 0,117, 0, 0, 0,243, 0, 0, 0, 0, 0, 34, 0,243, 0, 0, 0,
-245, 0, 0, 0, 0, 0, 34, 0,118, 0, 0, 0,244, 0, 0, 0, 0, 0, 34, 0,244, 0, 0, 0,246, 0, 0, 0, 0, 0, 34, 0,
-119, 0, 0, 0,241, 0, 0, 0, 0, 0, 34, 0,241, 0, 0, 0,243, 0, 0, 0, 0, 0, 34, 0,120, 0, 0, 0,242, 0, 0, 0,
- 0, 0, 34, 0,242, 0, 0, 0,244, 0, 0, 0, 0, 0, 34, 0,121, 0, 0, 0,239, 0, 0, 0, 0, 0, 34, 0,239, 0, 0, 0,
-241, 0, 0, 0, 0, 0, 34, 0,122, 0, 0, 0,240, 0, 0, 0, 0, 0, 34, 0,240, 0, 0, 0,242, 0, 0, 0, 0, 0, 34, 0,
-123, 0, 0, 0,237, 0, 0, 0, 0, 0, 34, 0,237, 0, 0, 0,239, 0, 0, 0, 0, 0, 34, 0,124, 0, 0, 0,238, 0, 0, 0,
- 0, 0, 34, 0,238, 0, 0, 0,240, 0, 0, 0, 0, 0, 34, 0,176, 0, 0, 0,233, 0, 0, 0, 0, 0, 34, 0,233, 0, 0, 0,
-237, 0, 0, 0, 0, 0, 34, 0,177, 0, 0, 0,234, 0, 0, 0, 0, 0, 34, 0,234, 0, 0, 0,238, 0, 0, 0, 0, 0, 34, 0,
-125, 0, 0, 0,235, 0, 0, 0, 0, 0, 34, 0,233, 0, 0, 0,235, 0, 0, 0, 0, 0, 34, 0,126, 0, 0, 0,236, 0, 0, 0,
- 0, 0, 34, 0,234, 0, 0, 0,236, 0, 0, 0, 0, 0, 34, 0,235, 0, 0, 0,253, 0, 0, 0, 0, 0, 34, 0,236, 0, 0, 0,
-254, 0, 0, 0, 0, 0, 34, 0,253, 0, 0, 0,255, 0, 0, 0, 0, 0, 34, 0,255, 0, 0, 0, 17, 1, 0, 0, 0, 0, 34, 0,
-235, 0, 0, 0, 17, 1, 0, 0, 0, 0, 34, 0,254, 0, 0, 0, 0, 1, 0, 0, 0, 0, 34, 0,236, 0, 0, 0, 18, 1, 0, 0,
- 0, 0, 34, 0, 0, 1, 0, 0, 18, 1, 0, 0, 0, 0, 34, 0, 17, 1, 0, 0, 19, 1, 0, 0, 0, 0, 34, 0,233, 0, 0, 0,
- 19, 1, 0, 0, 0, 0, 34, 0,234, 0, 0, 0, 20, 1, 0, 0, 0, 0, 34, 0, 18, 1, 0, 0, 20, 1, 0, 0, 0, 0, 34, 0,
- 15, 1, 0, 0, 19, 1, 0, 0, 0, 0, 34, 0,237, 0, 0, 0, 15, 1, 0, 0, 0, 0, 34, 0,238, 0, 0, 0, 16, 1, 0, 0,
- 0, 0, 34, 0, 16, 1, 0, 0, 20, 1, 0, 0, 0, 0, 34, 0, 13, 1, 0, 0, 15, 1, 0, 0, 0, 0, 34, 0,239, 0, 0, 0,
- 13, 1, 0, 0, 0, 0, 34, 0,240, 0, 0, 0, 14, 1, 0, 0, 0, 0, 34, 0, 14, 1, 0, 0, 16, 1, 0, 0, 0, 0, 34, 0,
- 11, 1, 0, 0, 13, 1, 0, 0, 0, 0, 34, 0,241, 0, 0, 0, 11, 1, 0, 0, 0, 0, 34, 0,242, 0, 0, 0, 12, 1, 0, 0,
- 0, 0, 34, 0, 12, 1, 0, 0, 14, 1, 0, 0, 0, 0, 34, 0, 9, 1, 0, 0, 11, 1, 0, 0, 0, 0, 34, 0,243, 0, 0, 0,
- 9, 1, 0, 0, 0, 0, 34, 0,244, 0, 0, 0, 10, 1, 0, 0, 0, 0, 34, 0, 10, 1, 0, 0, 12, 1, 0, 0, 0, 0, 34, 0,
- 7, 1, 0, 0, 9, 1, 0, 0, 0, 0, 34, 0,245, 0, 0, 0, 7, 1, 0, 0, 0, 0, 34, 0,246, 0, 0, 0, 8, 1, 0, 0,
- 0, 0, 34, 0, 8, 1, 0, 0, 10, 1, 0, 0, 0, 0, 34, 0, 5, 1, 0, 0, 7, 1, 0, 0, 0, 0, 34, 0,247, 0, 0, 0,
- 5, 1, 0, 0, 0, 0, 34, 0,248, 0, 0, 0, 6, 1, 0, 0, 0, 0, 34, 0, 6, 1, 0, 0, 8, 1, 0, 0, 0, 0, 34, 0,
- 3, 1, 0, 0, 5, 1, 0, 0, 0, 0, 34, 0,249, 0, 0, 0, 3, 1, 0, 0, 0, 0, 34, 0,250, 0, 0, 0, 4, 1, 0, 0,
- 0, 0, 34, 0, 4, 1, 0, 0, 6, 1, 0, 0, 0, 0, 34, 0, 3, 1, 0, 0, 21, 1, 0, 0, 0, 0, 34, 0,231, 0, 0, 0,
- 21, 1, 0, 0, 0, 0, 34, 0,232, 0, 0, 0, 22, 1, 0, 0, 0, 0, 34, 0, 4, 1, 0, 0, 22, 1, 0, 0, 0, 0, 34, 0,
-251, 0, 0, 0, 1, 1, 0, 0, 0, 0, 34, 0,255, 0, 0, 0, 1, 1, 0, 0, 0, 0, 34, 0,252, 0, 0, 0, 2, 1, 0, 0,
- 0, 0, 34, 0, 0, 1, 0, 0, 2, 1, 0, 0, 0, 0, 34, 0,229, 0, 0, 0, 23, 1, 0, 0, 0, 0, 34, 0, 1, 1, 0, 0,
- 23, 1, 0, 0, 0, 0, 34, 0,230, 0, 0, 0, 24, 1, 0, 0, 0, 0, 34, 0, 2, 1, 0, 0, 24, 1, 0, 0, 0, 0, 34, 0,
- 21, 1, 0, 0, 23, 1, 0, 0, 0, 0, 34, 0, 22, 1, 0, 0, 24, 1, 0, 0, 0, 0, 34, 0,106, 0, 0, 0, 25, 1, 0, 0,
- 0, 0, 34, 0, 71, 0, 0, 0, 25, 1, 0, 0, 0, 0, 38, 0, 65, 0, 0, 0, 71, 0, 0, 0, 0, 0, 34, 0,107, 0, 0, 0,
- 26, 1, 0, 0, 0, 0, 34, 0, 71, 0, 0, 0, 26, 1, 0, 0, 0, 0, 38, 0,104, 0, 0, 0, 27, 1, 0, 0, 0, 0, 34, 0,
- 25, 1, 0, 0, 27, 1, 0, 0, 0, 0, 34, 0,105, 0, 0, 0, 28, 1, 0, 0, 0, 0, 34, 0, 26, 1, 0, 0, 28, 1, 0, 0,
- 0, 0, 34, 0,102, 0, 0, 0, 29, 1, 0, 0, 0, 0, 34, 0, 27, 1, 0, 0, 29, 1, 0, 0, 0, 0, 34, 0,103, 0, 0, 0,
- 30, 1, 0, 0, 0, 0, 34, 0, 28, 1, 0, 0, 30, 1, 0, 0, 0, 0, 34, 0,100, 0, 0, 0, 31, 1, 0, 0, 0, 0, 34, 0,
- 29, 1, 0, 0, 31, 1, 0, 0, 0, 0, 34, 0,101, 0, 0, 0, 32, 1, 0, 0, 0, 0, 34, 0, 30, 1, 0, 0, 32, 1, 0, 0,
- 0, 0, 34, 0, 98, 0, 0, 0, 33, 1, 0, 0, 0, 0, 34, 0, 31, 1, 0, 0, 33, 1, 0, 0, 0, 0, 38, 0, 99, 0, 0, 0,
- 34, 1, 0, 0, 0, 0, 34, 0, 32, 1, 0, 0, 34, 1, 0, 0, 0, 0, 38, 0, 96, 0, 0, 0, 35, 1, 0, 0, 0, 0, 34, 0,
- 33, 1, 0, 0, 35, 1, 0, 0, 0, 0, 34, 0, 97, 0, 0, 0, 36, 1, 0, 0, 0, 0, 34, 0, 34, 1, 0, 0, 36, 1, 0, 0,
- 0, 0, 34, 0, 94, 0, 0, 0, 37, 1, 0, 0, 0, 0, 34, 0, 35, 1, 0, 0, 37, 1, 0, 0, 0, 0, 34, 0, 95, 0, 0, 0,
- 38, 1, 0, 0, 0, 0, 34, 0, 36, 1, 0, 0, 38, 1, 0, 0, 0, 0, 34, 0, 92, 0, 0, 0, 39, 1, 0, 0, 0, 0, 34, 0,
- 37, 1, 0, 0, 39, 1, 0, 0, 0, 0, 34, 0, 93, 0, 0, 0, 40, 1, 0, 0, 0, 0, 34, 0, 38, 1, 0, 0, 40, 1, 0, 0,
- 0, 0, 34, 0, 90, 0, 0, 0, 41, 1, 0, 0, 0, 0, 34, 0, 39, 1, 0, 0, 41, 1, 0, 0, 0, 0, 34, 0, 91, 0, 0, 0,
- 42, 1, 0, 0, 0, 0, 34, 0, 40, 1, 0, 0, 42, 1, 0, 0, 0, 0, 34, 0, 49, 1, 0, 0, 50, 1, 0, 0, 0, 0, 38, 0,
- 50, 1, 0, 0, 69, 1, 0, 0, 0, 0, 34, 0, 69, 1, 0, 0, 79, 1, 0, 0, 0, 0, 34, 0, 49, 1, 0, 0, 79, 1, 0, 0,
- 0, 0, 34, 0, 50, 1, 0, 0, 70, 1, 0, 0, 0, 0, 34, 0, 49, 1, 0, 0, 80, 1, 0, 0, 0, 0, 34, 0, 70, 1, 0, 0,
- 80, 1, 0, 0, 0, 0, 34, 0, 48, 1, 0, 0, 49, 1, 0, 0, 0, 0, 38, 0, 77, 1, 0, 0, 79, 1, 0, 0, 0, 0, 34, 0,
- 48, 1, 0, 0, 77, 1, 0, 0, 0, 0, 34, 0, 48, 1, 0, 0, 78, 1, 0, 0, 0, 0, 34, 0, 78, 1, 0, 0, 80, 1, 0, 0,
- 0, 0, 34, 0, 47, 1, 0, 0, 48, 1, 0, 0, 0, 0, 38, 0, 77, 1, 0, 0, 81, 1, 0, 0, 0, 0, 34, 0, 47, 1, 0, 0,
- 81, 1, 0, 0, 0, 0, 34, 0, 47, 1, 0, 0, 82, 1, 0, 0, 0, 0, 34, 0, 78, 1, 0, 0, 82, 1, 0, 0, 0, 0, 34, 0,
- 89, 0, 0, 0, 47, 1, 0, 0, 0, 0, 38, 0, 87, 0, 0, 0, 81, 1, 0, 0, 0, 0, 34, 0, 88, 0, 0, 0, 82, 1, 0, 0,
- 0, 0, 34, 0, 75, 1, 0, 0, 81, 1, 0, 0, 0, 0, 34, 0, 85, 0, 0, 0, 75, 1, 0, 0, 0, 0, 34, 0, 86, 0, 0, 0,
- 76, 1, 0, 0, 0, 0, 34, 0, 76, 1, 0, 0, 82, 1, 0, 0, 0, 0, 34, 0, 71, 1, 0, 0, 75, 1, 0, 0, 0, 0, 34, 0,
- 83, 0, 0, 0, 71, 1, 0, 0, 0, 0, 34, 0, 84, 0, 0, 0, 72, 1, 0, 0, 0, 0, 34, 0, 72, 1, 0, 0, 76, 1, 0, 0,
- 0, 0, 34, 0, 71, 1, 0, 0, 73, 1, 0, 0, 0, 0, 34, 0, 81, 0, 0, 0, 73, 1, 0, 0, 0, 0, 34, 0, 82, 0, 0, 0,
- 74, 1, 0, 0, 0, 0, 34, 0, 72, 1, 0, 0, 74, 1, 0, 0, 0, 0, 34, 0, 71, 1, 0, 0, 77, 1, 0, 0, 0, 0, 34, 0,
- 73, 1, 0, 0, 79, 1, 0, 0, 0, 0, 34, 0, 72, 1, 0, 0, 78, 1, 0, 0, 0, 0, 34, 0, 74, 1, 0, 0, 80, 1, 0, 0,
- 0, 0, 34, 0, 67, 1, 0, 0, 73, 1, 0, 0, 0, 0, 34, 0, 67, 1, 0, 0, 69, 1, 0, 0, 0, 0, 34, 0, 68, 1, 0, 0,
- 74, 1, 0, 0, 0, 0, 34, 0, 68, 1, 0, 0, 70, 1, 0, 0, 0, 0, 34, 0, 79, 0, 0, 0, 67, 1, 0, 0, 0, 0, 34, 0,
- 80, 0, 0, 0, 68, 1, 0, 0, 0, 0, 34, 0,206, 0, 0, 0, 83, 1, 0, 0, 0, 0, 34, 0, 83, 1, 0, 0, 85, 1, 0, 0,
- 0, 0, 34, 0,212, 0, 0, 0, 85, 1, 0, 0, 0, 0, 34, 0, 84, 1, 0, 0, 86, 1, 0, 0, 0, 0, 34, 0,207, 0, 0, 0,
- 84, 1, 0, 0, 0, 0, 34, 0,213, 0, 0, 0, 86, 1, 0, 0, 0, 0, 34, 0, 67, 1, 0, 0, 83, 1, 0, 0, 0, 0, 34, 0,
- 68, 1, 0, 0, 84, 1, 0, 0, 0, 0, 34, 0, 85, 1, 0, 0, 87, 1, 0, 0, 0, 0, 34, 0, 77, 0, 0, 0, 87, 1, 0, 0,
- 0, 0, 34, 0, 78, 0, 0, 0, 88, 1, 0, 0, 0, 0, 34, 0, 86, 1, 0, 0, 88, 1, 0, 0, 0, 0, 34, 0, 41, 1, 0, 0,
- 87, 1, 0, 0, 0, 0, 34, 0, 42, 1, 0, 0, 88, 1, 0, 0, 0, 0, 34, 0, 75, 0, 0, 0, 65, 1, 0, 0, 0, 0, 34, 0,
- 65, 1, 0, 0, 93, 1, 0, 0, 0, 0, 34, 0, 45, 1, 0, 0, 93, 1, 0, 0, 0, 0, 39, 0, 75, 0, 0, 0, 45, 1, 0, 0,
- 0, 0, 38, 0, 66, 1, 0, 0, 94, 1, 0, 0, 0, 0, 34, 0, 75, 0, 0, 0, 66, 1, 0, 0, 0, 0, 34, 0, 45, 1, 0, 0,
- 94, 1, 0, 0, 0, 0, 39, 0, 91, 1, 0, 0, 93, 1, 0, 0, 0, 0, 34, 0, 76, 0, 0, 0, 91, 1, 0, 0, 0, 0, 34, 0,
- 76, 0, 0, 0, 45, 1, 0, 0, 0, 0, 38, 0, 92, 1, 0, 0, 94, 1, 0, 0, 0, 0, 34, 0, 76, 0, 0, 0, 92, 1, 0, 0,
- 0, 0, 34, 0, 89, 1, 0, 0, 91, 1, 0, 0, 0, 0, 34, 0, 46, 1, 0, 0, 89, 1, 0, 0, 0, 0, 34, 0, 76, 0, 0, 0,
- 46, 1, 0, 0, 0, 0, 38, 0, 90, 1, 0, 0, 92, 1, 0, 0, 0, 0, 34, 0, 46, 1, 0, 0, 90, 1, 0, 0, 0, 0, 34, 0,
- 69, 1, 0, 0, 89, 1, 0, 0, 0, 0, 34, 0, 46, 1, 0, 0, 50, 1, 0, 0, 0, 0, 38, 0, 70, 1, 0, 0, 90, 1, 0, 0,
- 0, 0, 34, 0, 83, 1, 0, 0, 89, 1, 0, 0, 0, 0, 34, 0, 84, 1, 0, 0, 90, 1, 0, 0, 0, 0, 34, 0, 39, 1, 0, 0,
- 59, 1, 0, 0, 0, 0, 34, 0, 51, 1, 0, 0, 59, 1, 0, 0, 0, 0, 34, 0, 37, 1, 0, 0, 51, 1, 0, 0, 0, 0, 34, 0,
- 40, 1, 0, 0, 60, 1, 0, 0, 0, 0, 34, 0, 38, 1, 0, 0, 52, 1, 0, 0, 0, 0, 34, 0, 52, 1, 0, 0, 60, 1, 0, 0,
- 0, 0, 34, 0, 74, 0, 0, 0, 57, 1, 0, 0, 0, 0, 39, 0, 57, 1, 0, 0, 65, 1, 0, 0, 0, 0, 34, 0, 74, 0, 0, 0,
- 75, 0, 0, 0, 0, 0, 38, 0, 58, 1, 0, 0, 66, 1, 0, 0, 0, 0, 34, 0, 74, 0, 0, 0, 58, 1, 0, 0, 0, 0, 39, 0,
- 43, 1, 0, 0, 99, 1, 0, 0, 0, 0, 34, 0, 97, 1, 0, 0, 99, 1, 0, 0, 0, 0, 34, 0, 44, 1, 0, 0, 97, 1, 0, 0,
- 0, 0, 34, 0, 43, 1, 0, 0, 44, 1, 0, 0, 0, 0, 38, 0, 98, 1, 0, 0,100, 1, 0, 0, 0, 0, 34, 0, 43, 1, 0, 0,
-100, 1, 0, 0, 0, 0, 34, 0, 44, 1, 0, 0, 98, 1, 0, 0, 0, 0, 34, 0, 95, 1, 0, 0, 97, 1, 0, 0, 0, 0, 34, 0,
- 73, 0, 0, 0, 95, 1, 0, 0, 0, 0, 34, 0, 73, 0, 0, 0, 44, 1, 0, 0, 0, 0, 38, 0, 96, 1, 0, 0, 98, 1, 0, 0,
- 0, 0, 34, 0, 73, 0, 0, 0, 96, 1, 0, 0, 0, 0, 34, 0, 57, 1, 0, 0, 95, 1, 0, 0, 0, 0, 34, 0, 73, 0, 0, 0,
- 74, 0, 0, 0, 0, 0, 38, 0, 58, 1, 0, 0, 96, 1, 0, 0, 0, 0, 34, 0, 35, 1, 0, 0,103, 1, 0, 0, 0, 0, 34, 0,
-103, 1, 0, 0,105, 1, 0, 0, 0, 0, 34, 0, 33, 1, 0, 0,105, 1, 0, 0, 0, 0, 34, 0, 36, 1, 0, 0,104, 1, 0, 0,
- 0, 0, 34, 0, 34, 1, 0, 0,106, 1, 0, 0, 0, 0, 34, 0,104, 1, 0, 0,106, 1, 0, 0, 0, 0, 34, 0,103, 1, 0, 0,
-109, 1, 0, 0, 0, 0, 34, 0,107, 1, 0, 0,109, 1, 0, 0, 0, 0, 34, 0,105, 1, 0, 0,107, 1, 0, 0, 0, 0, 34, 0,
-104, 1, 0, 0,110, 1, 0, 0, 0, 0, 34, 0,106, 1, 0, 0,108, 1, 0, 0, 0, 0, 34, 0,108, 1, 0, 0,110, 1, 0, 0,
- 0, 0, 34, 0,109, 1, 0, 0,111, 1, 0, 0, 0, 0, 34, 0,111, 1, 0, 0,113, 1, 0, 0, 0, 0, 34, 0,107, 1, 0, 0,
-113, 1, 0, 0, 0, 0, 34, 0,110, 1, 0, 0,112, 1, 0, 0, 0, 0, 34, 0,108, 1, 0, 0,114, 1, 0, 0, 0, 0, 34, 0,
-112, 1, 0, 0,114, 1, 0, 0, 0, 0, 34, 0,111, 1, 0, 0,117, 1, 0, 0, 0, 0, 34, 0,115, 1, 0, 0,117, 1, 0, 0,
- 0, 0, 34, 0,113, 1, 0, 0,115, 1, 0, 0, 0, 0, 34, 0,112, 1, 0, 0,118, 1, 0, 0, 0, 0, 34, 0,114, 1, 0, 0,
-116, 1, 0, 0, 0, 0, 34, 0,116, 1, 0, 0,118, 1, 0, 0, 0, 0, 34, 0, 55, 1, 0, 0,119, 1, 0, 0, 0, 0, 39, 0,
-115, 1, 0, 0,119, 1, 0, 0, 0, 0, 34, 0, 55, 1, 0, 0,117, 1, 0, 0, 0, 0, 34, 0,116, 1, 0, 0,120, 1, 0, 0,
- 0, 0, 34, 0, 56, 1, 0, 0,120, 1, 0, 0, 0, 0, 39, 0, 56, 1, 0, 0,118, 1, 0, 0, 0, 0, 34, 0, 95, 1, 0, 0,
-115, 1, 0, 0, 0, 0, 34, 0, 57, 1, 0, 0,119, 1, 0, 0, 0, 0, 39, 0, 96, 1, 0, 0,116, 1, 0, 0, 0, 0, 34, 0,
- 58, 1, 0, 0,120, 1, 0, 0, 0, 0, 39, 0, 97, 1, 0, 0,113, 1, 0, 0, 0, 0, 34, 0, 98, 1, 0, 0,114, 1, 0, 0,
- 0, 0, 34, 0, 99, 1, 0, 0,107, 1, 0, 0, 0, 0, 34, 0,100, 1, 0, 0,108, 1, 0, 0, 0, 0, 34, 0, 99, 1, 0, 0,
-101, 1, 0, 0, 0, 0, 34, 0,101, 1, 0, 0,105, 1, 0, 0, 0, 0, 34, 0,102, 1, 0, 0,106, 1, 0, 0, 0, 0, 34, 0,
-100, 1, 0, 0,102, 1, 0, 0, 0, 0, 34, 0, 31, 1, 0, 0,101, 1, 0, 0, 0, 0, 34, 0, 32, 1, 0, 0,102, 1, 0, 0,
- 0, 0, 34, 0, 72, 0, 0, 0,101, 1, 0, 0, 0, 0, 34, 0, 72, 0, 0, 0, 43, 1, 0, 0, 0, 0, 38, 0, 72, 0, 0, 0,
-102, 1, 0, 0, 0, 0, 34, 0, 25, 1, 0, 0, 31, 1, 0, 0, 0, 0, 38, 0, 26, 1, 0, 0, 32, 1, 0, 0, 0, 0, 38, 0,
- 72, 0, 0, 0, 25, 1, 0, 0, 0, 0, 34, 0, 72, 0, 0, 0, 26, 1, 0, 0, 0, 0, 34, 0, 71, 0, 0, 0, 72, 0, 0, 0,
- 0, 0, 38, 0, 51, 1, 0, 0,103, 1, 0, 0, 0, 0, 34, 0, 52, 1, 0, 0,104, 1, 0, 0, 0, 0, 34, 0, 51, 1, 0, 0,
- 53, 1, 0, 0, 0, 0, 34, 0, 53, 1, 0, 0,109, 1, 0, 0, 0, 0, 34, 0, 54, 1, 0, 0,110, 1, 0, 0, 0, 0, 34, 0,
- 52, 1, 0, 0, 54, 1, 0, 0, 0, 0, 34, 0, 53, 1, 0, 0,123, 1, 0, 0, 0, 0, 34, 0,111, 1, 0, 0,123, 1, 0, 0,
- 0, 0, 34, 0,112, 1, 0, 0,124, 1, 0, 0, 0, 0, 34, 0, 54, 1, 0, 0,124, 1, 0, 0, 0, 0, 34, 0, 55, 1, 0, 0,
-123, 1, 0, 0, 0, 0, 34, 0, 56, 1, 0, 0,124, 1, 0, 0, 0, 0, 34, 0, 91, 1, 0, 0,127, 1, 0, 0, 0, 0, 34, 0,
-125, 1, 0, 0,127, 1, 0, 0, 0, 0, 34, 0, 89, 1, 0, 0,125, 1, 0, 0, 0, 0, 34, 0, 92, 1, 0, 0,128, 1, 0, 0,
- 0, 0, 34, 0, 90, 1, 0, 0,126, 1, 0, 0, 0, 0, 34, 0,126, 1, 0, 0,128, 1, 0, 0, 0, 0, 34, 0, 59, 1, 0, 0,
-125, 1, 0, 0, 0, 0, 34, 0, 61, 1, 0, 0,127, 1, 0, 0, 0, 0, 34, 0, 59, 1, 0, 0, 61, 1, 0, 0, 0, 0, 34, 0,
- 60, 1, 0, 0,126, 1, 0, 0, 0, 0, 34, 0, 60, 1, 0, 0, 62, 1, 0, 0, 0, 0, 34, 0, 62, 1, 0, 0,128, 1, 0, 0,
- 0, 0, 34, 0, 41, 1, 0, 0,125, 1, 0, 0, 0, 0, 34, 0, 42, 1, 0, 0,126, 1, 0, 0, 0, 0, 34, 0, 41, 1, 0, 0,
- 85, 1, 0, 0, 0, 0, 34, 0, 83, 1, 0, 0,125, 1, 0, 0, 0, 0, 34, 0, 42, 1, 0, 0, 86, 1, 0, 0, 0, 0, 34, 0,
- 84, 1, 0, 0,126, 1, 0, 0, 0, 0, 34, 0, 55, 1, 0, 0, 63, 1, 0, 0, 0, 0, 34, 0, 63, 1, 0, 0,121, 1, 0, 0,
- 0, 0, 39, 0,119, 1, 0, 0,121, 1, 0, 0, 0, 0, 34, 0, 64, 1, 0, 0,122, 1, 0, 0, 0, 0, 39, 0, 56, 1, 0, 0,
- 64, 1, 0, 0, 0, 0, 34, 0,120, 1, 0, 0,122, 1, 0, 0, 0, 0, 34, 0, 65, 1, 0, 0,121, 1, 0, 0, 0, 0, 34, 0,
- 66, 1, 0, 0,122, 1, 0, 0, 0, 0, 34, 0,121, 1, 0, 0,127, 1, 0, 0, 0, 0, 34, 0, 61, 1, 0, 0, 63, 1, 0, 0,
- 0, 0, 34, 0,122, 1, 0, 0,128, 1, 0, 0, 0, 0, 34, 0, 62, 1, 0, 0, 64, 1, 0, 0, 0, 0, 34, 0, 93, 1, 0, 0,
-121, 1, 0, 0, 0, 0, 39, 0, 94, 1, 0, 0,122, 1, 0, 0, 0, 0, 39, 0,129, 1, 0, 0,141, 1, 0, 0, 0, 0, 34, 0,
-129, 1, 0, 0,155, 1, 0, 0, 0, 0, 34, 0,143, 1, 0, 0,155, 1, 0, 0, 0, 0, 34, 0,141, 1, 0, 0,143, 1, 0, 0,
- 0, 0, 34, 0,130, 1, 0, 0,156, 1, 0, 0, 0, 0, 34, 0,130, 1, 0, 0,142, 1, 0, 0, 0, 0, 34, 0,142, 1, 0, 0,
-144, 1, 0, 0, 0, 0, 34, 0,144, 1, 0, 0,156, 1, 0, 0, 0, 0, 34, 0,143, 1, 0, 0,145, 1, 0, 0, 0, 0, 34, 0,
-139, 1, 0, 0,145, 1, 0, 0, 0, 0, 34, 0,139, 1, 0, 0,141, 1, 0, 0, 0, 0, 34, 0,144, 1, 0, 0,146, 1, 0, 0,
- 0, 0, 34, 0,140, 1, 0, 0,142, 1, 0, 0, 0, 0, 34, 0,140, 1, 0, 0,146, 1, 0, 0, 0, 0, 34, 0,145, 1, 0, 0,
-147, 1, 0, 0, 0, 0, 34, 0,137, 1, 0, 0,147, 1, 0, 0, 0, 0, 34, 0,137, 1, 0, 0,139, 1, 0, 0, 0, 0, 34, 0,
-146, 1, 0, 0,148, 1, 0, 0, 0, 0, 34, 0,138, 1, 0, 0,140, 1, 0, 0, 0, 0, 34, 0,138, 1, 0, 0,148, 1, 0, 0,
- 0, 0, 34, 0,147, 1, 0, 0,149, 1, 0, 0, 0, 0, 34, 0,135, 1, 0, 0,149, 1, 0, 0, 0, 0, 34, 0,135, 1, 0, 0,
-137, 1, 0, 0, 0, 0, 34, 0,148, 1, 0, 0,150, 1, 0, 0, 0, 0, 34, 0,136, 1, 0, 0,138, 1, 0, 0, 0, 0, 34, 0,
-136, 1, 0, 0,150, 1, 0, 0, 0, 0, 34, 0,149, 1, 0, 0,151, 1, 0, 0, 0, 0, 34, 0,133, 1, 0, 0,151, 1, 0, 0,
- 0, 0, 34, 0,133, 1, 0, 0,135, 1, 0, 0, 0, 0, 34, 0,150, 1, 0, 0,152, 1, 0, 0, 0, 0, 34, 0,134, 1, 0, 0,
-136, 1, 0, 0, 0, 0, 34, 0,134, 1, 0, 0,152, 1, 0, 0, 0, 0, 34, 0,151, 1, 0, 0,153, 1, 0, 0, 0, 0, 34, 0,
-131, 1, 0, 0,153, 1, 0, 0, 0, 0, 34, 0,131, 1, 0, 0,133, 1, 0, 0, 0, 0, 34, 0,152, 1, 0, 0,154, 1, 0, 0,
- 0, 0, 34, 0,132, 1, 0, 0,134, 1, 0, 0, 0, 0, 34, 0,132, 1, 0, 0,154, 1, 0, 0, 0, 0, 34, 0,151, 1, 0, 0,
-161, 1, 0, 0, 0, 0, 34, 0,159, 1, 0, 0,161, 1, 0, 0, 0, 0, 34, 0,153, 1, 0, 0,159, 1, 0, 0, 0, 0, 34, 0,
-160, 1, 0, 0,162, 1, 0, 0, 0, 0, 34, 0,152, 1, 0, 0,162, 1, 0, 0, 0, 0, 34, 0,154, 1, 0, 0,160, 1, 0, 0,
- 0, 0, 34, 0,149, 1, 0, 0,163, 1, 0, 0, 0, 0, 34, 0,161, 1, 0, 0,163, 1, 0, 0, 0, 0, 34, 0,162, 1, 0, 0,
-164, 1, 0, 0, 0, 0, 34, 0,150, 1, 0, 0,164, 1, 0, 0, 0, 0, 34, 0,147, 1, 0, 0,165, 1, 0, 0, 0, 0, 34, 0,
-163, 1, 0, 0,165, 1, 0, 0, 0, 0, 34, 0,164, 1, 0, 0,166, 1, 0, 0, 0, 0, 34, 0,148, 1, 0, 0,166, 1, 0, 0,
- 0, 0, 34, 0,145, 1, 0, 0,167, 1, 0, 0, 0, 0, 34, 0,165, 1, 0, 0,167, 1, 0, 0, 0, 0, 34, 0,166, 1, 0, 0,
-168, 1, 0, 0, 0, 0, 34, 0,146, 1, 0, 0,168, 1, 0, 0, 0, 0, 34, 0,143, 1, 0, 0,169, 1, 0, 0, 0, 0, 34, 0,
-167, 1, 0, 0,169, 1, 0, 0, 0, 0, 34, 0,168, 1, 0, 0,170, 1, 0, 0, 0, 0, 34, 0,144, 1, 0, 0,170, 1, 0, 0,
- 0, 0, 34, 0,155, 1, 0, 0,157, 1, 0, 0, 0, 0, 34, 0,157, 1, 0, 0,169, 1, 0, 0, 0, 0, 34, 0,156, 1, 0, 0,
-158, 1, 0, 0, 0, 0, 34, 0,158, 1, 0, 0,170, 1, 0, 0, 0, 0, 34, 0, 61, 1, 0, 0,185, 1, 0, 0, 0, 0, 34, 0,
-183, 1, 0, 0,185, 1, 0, 0, 0, 0, 34, 0, 59, 1, 0, 0,183, 1, 0, 0, 0, 0, 34, 0, 62, 1, 0, 0,186, 1, 0, 0,
- 0, 0, 34, 0, 60, 1, 0, 0,184, 1, 0, 0, 0, 0, 34, 0,184, 1, 0, 0,186, 1, 0, 0, 0, 0, 34, 0, 61, 1, 0, 0,
-131, 1, 0, 0, 0, 0, 34, 0,153, 1, 0, 0,185, 1, 0, 0, 0, 0, 34, 0, 62, 1, 0, 0,132, 1, 0, 0, 0, 0, 34, 0,
-154, 1, 0, 0,186, 1, 0, 0, 0, 0, 34, 0, 53, 1, 0, 0,183, 1, 0, 0, 0, 0, 34, 0, 54, 1, 0, 0,184, 1, 0, 0,
- 0, 0, 34, 0,123, 1, 0, 0,171, 1, 0, 0, 0, 0, 34, 0,155, 1, 0, 0,171, 1, 0, 0, 0, 0, 34, 0,123, 1, 0, 0,
-129, 1, 0, 0, 0, 0, 34, 0,156, 1, 0, 0,172, 1, 0, 0, 0, 0, 34, 0,124, 1, 0, 0,172, 1, 0, 0, 0, 0, 34, 0,
-124, 1, 0, 0,130, 1, 0, 0, 0, 0, 34, 0,159, 1, 0, 0,181, 1, 0, 0, 0, 0, 34, 0,181, 1, 0, 0,185, 1, 0, 0,
- 0, 0, 34, 0,160, 1, 0, 0,182, 1, 0, 0, 0, 0, 34, 0,182, 1, 0, 0,186, 1, 0, 0, 0, 0, 34, 0,179, 1, 0, 0,
-187, 1, 0, 0, 0, 0, 34, 0,185, 1, 0, 0,187, 1, 0, 0, 0, 0, 34, 0,179, 1, 0, 0,181, 1, 0, 0, 0, 0, 34, 0,
-186, 1, 0, 0,188, 1, 0, 0, 0, 0, 34, 0,180, 1, 0, 0,188, 1, 0, 0, 0, 0, 34, 0,180, 1, 0, 0,182, 1, 0, 0,
- 0, 0, 34, 0,175, 1, 0, 0,187, 1, 0, 0, 0, 0, 34, 0,177, 1, 0, 0,179, 1, 0, 0, 0, 0, 34, 0,175, 1, 0, 0,
-177, 1, 0, 0, 0, 0, 34, 0,176, 1, 0, 0,188, 1, 0, 0, 0, 0, 34, 0,176, 1, 0, 0,178, 1, 0, 0, 0, 0, 34, 0,
-178, 1, 0, 0,180, 1, 0, 0, 0, 0, 34, 0,173, 1, 0, 0,189, 1, 0, 0, 0, 0, 34, 0,187, 1, 0, 0,189, 1, 0, 0,
- 0, 0, 34, 0,173, 1, 0, 0,175, 1, 0, 0, 0, 0, 34, 0,188, 1, 0, 0,190, 1, 0, 0, 0, 0, 34, 0,174, 1, 0, 0,
-190, 1, 0, 0, 0, 0, 34, 0,174, 1, 0, 0,176, 1, 0, 0, 0, 0, 34, 0,171, 1, 0, 0,189, 1, 0, 0, 0, 0, 34, 0,
-173, 1, 0, 0,191, 1, 0, 0, 0, 0, 34, 0,171, 1, 0, 0,191, 1, 0, 0, 0, 0, 32, 0,172, 1, 0, 0,190, 1, 0, 0,
- 0, 0, 34, 0,172, 1, 0, 0,192, 1, 0, 0, 0, 0, 32, 0,174, 1, 0, 0,192, 1, 0, 0, 0, 0, 34, 0,157, 1, 0, 0,
-191, 1, 0, 0, 0, 0, 34, 0,158, 1, 0, 0,192, 1, 0, 0, 0, 0, 34, 0, 53, 1, 0, 0,189, 1, 0, 0, 0, 0, 34, 0,
- 54, 1, 0, 0,190, 1, 0, 0, 0, 0, 34, 0,183, 1, 0, 0,187, 1, 0, 0, 0, 0, 34, 0,184, 1, 0, 0,188, 1, 0, 0,
- 0, 0, 34, 0,191, 1, 0, 0,193, 1, 0, 0, 0, 0, 34, 0,193, 1, 0, 0,217, 1, 0, 0, 0, 0, 34, 0,157, 1, 0, 0,
-217, 1, 0, 0, 0, 0, 34, 0,192, 1, 0, 0,194, 1, 0, 0, 0, 0, 34, 0,158, 1, 0, 0,218, 1, 0, 0, 0, 0, 34, 0,
-194, 1, 0, 0,218, 1, 0, 0, 0, 0, 34, 0,173, 1, 0, 0,203, 1, 0, 0, 0, 0, 34, 0,193, 1, 0, 0,203, 1, 0, 0,
- 0, 0, 34, 0,174, 1, 0, 0,204, 1, 0, 0, 0, 0, 34, 0,194, 1, 0, 0,204, 1, 0, 0, 0, 0, 34, 0,175, 1, 0, 0,
-201, 1, 0, 0, 0, 0, 34, 0,201, 1, 0, 0,203, 1, 0, 0, 0, 0, 34, 0,176, 1, 0, 0,202, 1, 0, 0, 0, 0, 34, 0,
-202, 1, 0, 0,204, 1, 0, 0, 0, 0, 34, 0,177, 1, 0, 0,199, 1, 0, 0, 0, 0, 34, 0,199, 1, 0, 0,201, 1, 0, 0,
- 0, 0, 34, 0,178, 1, 0, 0,200, 1, 0, 0, 0, 0, 34, 0,200, 1, 0, 0,202, 1, 0, 0, 0, 0, 34, 0,179, 1, 0, 0,
-197, 1, 0, 0, 0, 0, 34, 0,197, 1, 0, 0,199, 1, 0, 0, 0, 0, 34, 0,180, 1, 0, 0,198, 1, 0, 0, 0, 0, 34, 0,
-198, 1, 0, 0,200, 1, 0, 0, 0, 0, 34, 0,181, 1, 0, 0,195, 1, 0, 0, 0, 0, 34, 0,195, 1, 0, 0,197, 1, 0, 0,
- 0, 0, 34, 0,182, 1, 0, 0,196, 1, 0, 0, 0, 0, 34, 0,196, 1, 0, 0,198, 1, 0, 0, 0, 0, 34, 0,159, 1, 0, 0,
-215, 1, 0, 0, 0, 0, 34, 0,195, 1, 0, 0,215, 1, 0, 0, 0, 0, 34, 0,160, 1, 0, 0,216, 1, 0, 0, 0, 0, 34, 0,
-196, 1, 0, 0,216, 1, 0, 0, 0, 0, 34, 0,205, 1, 0, 0,217, 1, 0, 0, 0, 0, 34, 0,169, 1, 0, 0,205, 1, 0, 0,
- 0, 0, 34, 0,170, 1, 0, 0,206, 1, 0, 0, 0, 0, 34, 0,206, 1, 0, 0,218, 1, 0, 0, 0, 0, 34, 0,205, 1, 0, 0,
-207, 1, 0, 0, 0, 0, 34, 0,167, 1, 0, 0,207, 1, 0, 0, 0, 0, 34, 0,168, 1, 0, 0,208, 1, 0, 0, 0, 0, 34, 0,
-206, 1, 0, 0,208, 1, 0, 0, 0, 0, 34, 0,207, 1, 0, 0,209, 1, 0, 0, 0, 0, 34, 0,165, 1, 0, 0,209, 1, 0, 0,
- 0, 0, 34, 0,166, 1, 0, 0,210, 1, 0, 0, 0, 0, 34, 0,208, 1, 0, 0,210, 1, 0, 0, 0, 0, 34, 0,209, 1, 0, 0,
-211, 1, 0, 0, 0, 0, 34, 0,163, 1, 0, 0,211, 1, 0, 0, 0, 0, 34, 0,164, 1, 0, 0,212, 1, 0, 0, 0, 0, 34, 0,
-210, 1, 0, 0,212, 1, 0, 0, 0, 0, 34, 0,211, 1, 0, 0,213, 1, 0, 0, 0, 0, 34, 0,161, 1, 0, 0,213, 1, 0, 0,
- 0, 0, 34, 0,162, 1, 0, 0,214, 1, 0, 0, 0, 0, 34, 0,212, 1, 0, 0,214, 1, 0, 0, 0, 0, 34, 0,213, 1, 0, 0,
-215, 1, 0, 0, 0, 0, 34, 0,214, 1, 0, 0,216, 1, 0, 0, 0, 0, 34, 0,197, 1, 0, 0,221, 1, 0, 0, 0, 0, 34, 0,
-219, 1, 0, 0,221, 1, 0, 0, 0, 0, 34, 0,199, 1, 0, 0,219, 1, 0, 0, 0, 0, 34, 0,198, 1, 0, 0,222, 1, 0, 0,
- 0, 0, 34, 0,200, 1, 0, 0,220, 1, 0, 0, 0, 0, 34, 0,220, 1, 0, 0,222, 1, 0, 0, 0, 0, 34, 0,221, 1, 0, 0,
-223, 1, 0, 0, 0, 0, 34, 0,223, 1, 0, 0,225, 1, 0, 0, 0, 0, 32, 0,219, 1, 0, 0,225, 1, 0, 0, 0, 0, 34, 0,
-222, 1, 0, 0,224, 1, 0, 0, 0, 0, 34, 0,220, 1, 0, 0,226, 1, 0, 0, 0, 0, 34, 0,224, 1, 0, 0,226, 1, 0, 0,
- 0, 0, 32, 0,223, 1, 0, 0,229, 1, 0, 0, 0, 0, 34, 0,227, 1, 0, 0,229, 1, 0, 0, 0, 0, 34, 0,225, 1, 0, 0,
-227, 1, 0, 0, 0, 0, 34, 0,224, 1, 0, 0,230, 1, 0, 0, 0, 0, 34, 0,226, 1, 0, 0,228, 1, 0, 0, 0, 0, 34, 0,
-228, 1, 0, 0,230, 1, 0, 0, 0, 0, 34, 0,229, 1, 0, 0,231, 1, 0, 0, 0, 0, 34, 0,231, 1, 0, 0,233, 1, 0, 0,
- 0, 0, 34, 0,227, 1, 0, 0,233, 1, 0, 0, 0, 0, 34, 0,230, 1, 0, 0,232, 1, 0, 0, 0, 0, 34, 0,228, 1, 0, 0,
-234, 1, 0, 0, 0, 0, 34, 0,232, 1, 0, 0,234, 1, 0, 0, 0, 0, 34, 0,217, 1, 0, 0,227, 1, 0, 0, 0, 0, 34, 0,
-205, 1, 0, 0,233, 1, 0, 0, 0, 0, 34, 0,218, 1, 0, 0,228, 1, 0, 0, 0, 0, 34, 0,206, 1, 0, 0,234, 1, 0, 0,
- 0, 0, 34, 0,193, 1, 0, 0,225, 1, 0, 0, 0, 0, 34, 0,194, 1, 0, 0,226, 1, 0, 0, 0, 0, 34, 0,203, 1, 0, 0,
-219, 1, 0, 0, 0, 0, 34, 0,204, 1, 0, 0,220, 1, 0, 0, 0, 0, 34, 0,215, 1, 0, 0,221, 1, 0, 0, 0, 0, 34, 0,
-216, 1, 0, 0,222, 1, 0, 0, 0, 0, 34, 0,213, 1, 0, 0,223, 1, 0, 0, 0, 0, 34, 0,214, 1, 0, 0,224, 1, 0, 0,
- 0, 0, 34, 0,211, 1, 0, 0,229, 1, 0, 0, 0, 0, 34, 0,212, 1, 0, 0,230, 1, 0, 0, 0, 0, 34, 0,209, 1, 0, 0,
-231, 1, 0, 0, 0, 0, 34, 0,210, 1, 0, 0,232, 1, 0, 0, 0, 0, 34, 0,207, 1, 0, 0,233, 1, 0, 0, 0, 0, 34, 0,
-208, 1, 0, 0,234, 1, 0, 0, 0, 0, 34, 0,131, 1, 0, 0,245, 1, 0, 0, 0, 0, 34, 0,243, 1, 0, 0,245, 1, 0, 0,
- 0, 0, 39, 0,133, 1, 0, 0,243, 1, 0, 0, 0, 0, 34, 0,132, 1, 0, 0,246, 1, 0, 0, 0, 0, 34, 0,134, 1, 0, 0,
-244, 1, 0, 0, 0, 0, 34, 0,244, 1, 0, 0,246, 1, 0, 0, 0, 0, 39, 0,241, 1, 0, 0,243, 1, 0, 0, 0, 0, 39, 0,
-135, 1, 0, 0,241, 1, 0, 0, 0, 0, 34, 0,136, 1, 0, 0,242, 1, 0, 0, 0, 0, 34, 0,242, 1, 0, 0,244, 1, 0, 0,
- 0, 0, 39, 0,239, 1, 0, 0,241, 1, 0, 0, 0, 0, 39, 0,137, 1, 0, 0,239, 1, 0, 0, 0, 0, 34, 0,138, 1, 0, 0,
-240, 1, 0, 0, 0, 0, 34, 0,240, 1, 0, 0,242, 1, 0, 0, 0, 0, 39, 0,237, 1, 0, 0,239, 1, 0, 0, 0, 0, 39, 0,
-139, 1, 0, 0,237, 1, 0, 0, 0, 0, 34, 0,140, 1, 0, 0,238, 1, 0, 0, 0, 0, 34, 0,238, 1, 0, 0,240, 1, 0, 0,
- 0, 0, 39, 0,235, 1, 0, 0,237, 1, 0, 0, 0, 0, 39, 0,141, 1, 0, 0,235, 1, 0, 0, 0, 0, 34, 0,142, 1, 0, 0,
-236, 1, 0, 0, 0, 0, 34, 0,236, 1, 0, 0,238, 1, 0, 0, 0, 0, 39, 0,235, 1, 0, 0,247, 1, 0, 0, 0, 0, 39, 0,
-129, 1, 0, 0,247, 1, 0, 0, 0, 0, 34, 0,130, 1, 0, 0,248, 1, 0, 0, 0, 0, 34, 0,236, 1, 0, 0,248, 1, 0, 0,
- 0, 0, 39, 0,235, 1, 0, 0,243, 1, 0, 0, 0, 0, 34, 0,245, 1, 0, 0,247, 1, 0, 0, 0, 0, 34, 0,236, 1, 0, 0,
-244, 1, 0, 0, 0, 0, 34, 0,246, 1, 0, 0,248, 1, 0, 0, 0, 0, 34, 0,237, 1, 0, 0,241, 1, 0, 0, 0, 0, 34, 0,
-238, 1, 0, 0,242, 1, 0, 0, 0, 0, 34, 0, 55, 1, 0, 0,247, 1, 0, 0, 0, 0, 39, 0, 56, 1, 0, 0,248, 1, 0, 0,
- 0, 0, 39, 0, 63, 1, 0, 0,245, 1, 0, 0, 0, 0, 39, 0, 64, 1, 0, 0,246, 1, 0, 0, 0, 0, 39, 0, 14, 0, 0, 0,
-249, 0, 0, 0, 0, 0, 34, 0, 14, 0, 0, 0,178, 0, 0, 0, 0, 0, 34, 0, 14, 0, 0, 0,113, 0, 0, 0, 0, 0, 34, 0,
- 14, 0, 0, 0,161, 0, 0, 0, 0, 0, 34, 0, 20, 0, 0, 0,112, 0, 0, 0, 0, 0, 34, 0, 16, 0, 0, 0,112, 0, 0, 0,
- 0, 0, 34, 0, 9, 0, 0, 0,112, 0, 0, 0, 0, 0, 34, 0, 13, 0, 0, 0,112, 0, 0, 0, 0, 0, 34, 0, 68, 65, 84, 65,
- 64, 1, 0, 0, 64,222,116, 1, 0, 0, 0, 0, 5, 1, 0, 0, 5, 0, 0, 0, 4, 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,192,223,116, 1, 0, 0, 0, 0, 5, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 85, 86, 84,101,120, 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, 16, 7,117, 1, 0, 0, 0, 0, 6, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67,111,108, 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, 16,101,117, 1, 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, 68, 65, 84, 65, 16, 39, 0, 0,192,223,116, 1,
- 0, 0, 0, 0, 52, 0, 0, 0,244, 1, 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 43, 0, 0, 0, 0, 0, 0, 1,
- 3, 0, 0, 0, 1, 0, 0, 0, 46, 0, 0, 0, 44, 0, 0, 0, 0, 0, 0, 1, 43, 0, 0, 0, 2, 0, 0, 0, 4, 0, 0, 0,
- 41, 0, 0, 0, 0, 0, 0, 1, 5, 0, 0, 0, 3, 0, 0, 0, 44, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0,
- 8, 0, 0, 0, 6, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 1, 7, 0, 0, 0, 9, 0, 0, 0, 3, 0, 0, 0, 5, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0, 10, 0, 0, 0, 8, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 1, 9, 0, 0, 0, 11, 0, 0, 0,
- 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 1, 10, 0, 0, 0, 12, 0, 0, 0, 14, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 1,
-112, 0, 0, 0, 13, 0, 0, 0, 11, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 1, 8, 0, 0, 0, 14, 0, 0, 0, 15, 0, 0, 0,
- 6, 0, 0, 0, 0, 0, 0, 1, 16, 0, 0, 0,112, 0, 0, 0, 9, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 1, 14, 0, 0, 0,
- 19, 0, 0, 0, 17, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 1, 18, 0, 0, 0, 20, 0, 0, 0,112, 0, 0, 0, 16, 0, 0, 0,
- 0, 0, 0, 1, 12, 0, 0, 0, 21, 0, 0, 0, 19, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 1, 20, 0, 0, 0, 22, 0, 0, 0,
- 13, 0, 0, 0,112, 0, 0, 0, 0, 0, 0, 1, 21, 0, 0, 0, 23, 0, 0, 0, 25, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 1,
- 26, 0, 0, 0, 24, 0, 0, 0, 22, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 1, 19, 0, 0, 0, 25, 0, 0, 0, 27, 0, 0, 0,
- 17, 0, 0, 0, 0, 0, 0, 1, 28, 0, 0, 0, 26, 0, 0, 0, 20, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 1, 25, 0, 0, 0,
- 31, 0, 0, 0, 29, 0, 0, 0, 27, 0, 0, 0, 0, 0, 0, 1, 30, 0, 0, 0, 32, 0, 0, 0, 26, 0, 0, 0, 28, 0, 0, 0,
- 0, 0, 0, 1, 23, 0, 0, 0, 33, 0, 0, 0, 31, 0, 0, 0, 25, 0, 0, 0, 0, 0, 0, 1, 32, 0, 0, 0, 34, 0, 0, 0,
- 24, 0, 0, 0, 26, 0, 0, 0, 0, 0, 0, 1, 33, 0, 0, 0, 35, 0, 0, 0, 37, 0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 1,
- 38, 0, 0, 0, 36, 0, 0, 0, 34, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 1, 31, 0, 0, 0, 37, 0, 0, 0, 39, 0, 0, 0,
- 29, 0, 0, 0, 0, 0, 0, 1, 40, 0, 0, 0, 38, 0, 0, 0, 32, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 1, 37, 0, 0, 0,
- 43, 0, 0, 0, 41, 0, 0, 0, 39, 0, 0, 0, 0, 0, 0, 1, 42, 0, 0, 0, 44, 0, 0, 0, 38, 0, 0, 0, 40, 0, 0, 0,
- 0, 0, 0, 1, 35, 0, 0, 0, 45, 0, 0, 0, 43, 0, 0, 0, 37, 0, 0, 0, 0, 0, 0, 1, 44, 0, 0, 0, 46, 0, 0, 0,
- 36, 0, 0, 0, 38, 0, 0, 0, 0, 0, 0, 1, 45, 0, 0, 0, 35, 0, 0, 0, 49, 0, 0, 0, 47, 0, 0, 0, 0, 0, 0, 1,
- 50, 0, 0, 0, 36, 0, 0, 0, 46, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0, 1, 35, 0, 0, 0, 33, 0, 0, 0, 51, 0, 0, 0,
- 49, 0, 0, 0, 0, 0, 0, 1, 52, 0, 0, 0, 34, 0, 0, 0, 36, 0, 0, 0, 50, 0, 0, 0, 0, 0, 0, 1, 33, 0, 0, 0,
- 23, 0, 0, 0, 53, 0, 0, 0, 51, 0, 0, 0, 0, 0, 0, 1, 54, 0, 0, 0, 24, 0, 0, 0, 34, 0, 0, 0, 52, 0, 0, 0,
- 0, 0, 0, 1, 23, 0, 0, 0, 21, 0, 0, 0, 55, 0, 0, 0, 53, 0, 0, 0, 0, 0, 0, 1, 56, 0, 0, 0, 22, 0, 0, 0,
- 24, 0, 0, 0, 54, 0, 0, 0, 0, 0, 0, 1, 21, 0, 0, 0, 12, 0, 0, 0, 57, 0, 0, 0, 55, 0, 0, 0, 0, 0, 0, 1,
- 58, 0, 0, 0, 13, 0, 0, 0, 22, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 1, 12, 0, 0, 0, 10, 0, 0, 0, 61, 0, 0, 0,
- 57, 0, 0, 0, 0, 0, 0, 1, 62, 0, 0, 0, 11, 0, 0, 0, 13, 0, 0, 0, 58, 0, 0, 0, 0, 0, 0, 1, 10, 0, 0, 0,
- 0, 0, 0, 0, 63, 0, 0, 0, 61, 0, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 1, 0, 0, 0, 11, 0, 0, 0, 62, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0, 45, 0, 0, 0, 47, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 1, 48, 0, 0, 0, 46, 0, 0, 0,
- 1, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 1, 59, 0, 0, 0, 63, 0, 0, 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
- 48, 0, 0, 0, 64, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 61, 0, 0, 0, 63, 0, 0, 0, 59, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 1, 60, 0, 0, 0, 64, 0, 0, 0, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 59, 0, 0, 0,
- 57, 0, 0, 0, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 62, 0, 0, 0, 58, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 59, 0, 0, 0, 55, 0, 0, 0, 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 58, 0, 0, 0, 56, 0, 0, 0,
- 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 59, 0, 0, 0, 53, 0, 0, 0, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
- 56, 0, 0, 0, 54, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 59, 0, 0, 0, 51, 0, 0, 0, 53, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 1, 54, 0, 0, 0, 52, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 59, 0, 0, 0,
- 49, 0, 0, 0, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 52, 0, 0, 0, 50, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 59, 0, 0, 0, 47, 0, 0, 0, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 50, 0, 0, 0, 48, 0, 0, 0,
- 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 87, 0, 0, 0,171, 0, 0, 0,173, 0, 0, 0, 89, 0, 0, 0, 0, 0, 0, 1,
-173, 0, 0, 0,172, 0, 0, 0, 88, 0, 0, 0, 89, 0, 0, 0, 0, 0, 0, 1, 85, 0, 0, 0,169, 0, 0, 0,171, 0, 0, 0,
- 87, 0, 0, 0, 0, 0, 0, 1,172, 0, 0, 0,170, 0, 0, 0, 86, 0, 0, 0, 88, 0, 0, 0, 0, 0, 0, 1, 83, 0, 0, 0,
-167, 0, 0, 0,169, 0, 0, 0, 85, 0, 0, 0, 0, 0, 0, 1,170, 0, 0, 0,168, 0, 0, 0, 84, 0, 0, 0, 86, 0, 0, 0,
- 0, 0, 0, 1, 81, 0, 0, 0,165, 0, 0, 0,167, 0, 0, 0, 83, 0, 0, 0, 0, 0, 0, 1,168, 0, 0, 0,166, 0, 0, 0,
- 82, 0, 0, 0, 84, 0, 0, 0, 0, 0, 0, 1, 79, 0, 0, 0,163, 0, 0, 0,165, 0, 0, 0, 81, 0, 0, 0, 0, 0, 0, 1,
-166, 0, 0, 0,164, 0, 0, 0, 80, 0, 0, 0, 82, 0, 0, 0, 0, 0, 0, 1, 77, 0, 0, 0, 90, 0, 0, 0,143, 0, 0, 0,
-161, 0, 0, 0, 0, 0, 0, 1,144, 0, 0, 0, 91, 0, 0, 0, 78, 0, 0, 0,162, 0, 0, 0, 0, 0, 0, 1, 90, 0, 0, 0,
- 92, 0, 0, 0,145, 0, 0, 0,143, 0, 0, 0, 0, 0, 0, 1,146, 0, 0, 0, 93, 0, 0, 0, 91, 0, 0, 0,144, 0, 0, 0,
- 0, 0, 0, 1, 92, 0, 0, 0, 94, 0, 0, 0,147, 0, 0, 0,145, 0, 0, 0, 0, 0, 0, 1,148, 0, 0, 0, 95, 0, 0, 0,
- 93, 0, 0, 0,146, 0, 0, 0, 0, 0, 0, 1, 94, 0, 0, 0, 96, 0, 0, 0,149, 0, 0, 0,147, 0, 0, 0, 0, 0, 0, 1,
-150, 0, 0, 0, 97, 0, 0, 0, 95, 0, 0, 0,148, 0, 0, 0, 0, 0, 0, 1, 96, 0, 0, 0, 98, 0, 0, 0,151, 0, 0, 0,
-149, 0, 0, 0, 0, 0, 0, 1,152, 0, 0, 0, 99, 0, 0, 0, 97, 0, 0, 0,150, 0, 0, 0, 0, 0, 0, 1, 98, 0, 0, 0,
-100, 0, 0, 0,153, 0, 0, 0,151, 0, 0, 0, 0, 0, 0, 1,154, 0, 0, 0,101, 0, 0, 0, 99, 0, 0, 0,152, 0, 0, 0,
- 0, 0, 0, 1,100, 0, 0, 0,102, 0, 0, 0,155, 0, 0, 0,153, 0, 0, 0, 0, 0, 0, 1,156, 0, 0, 0,103, 0, 0, 0,
-101, 0, 0, 0,154, 0, 0, 0, 0, 0, 0, 1,102, 0, 0, 0,104, 0, 0, 0,157, 0, 0, 0,155, 0, 0, 0, 0, 0, 0, 1,
-158, 0, 0, 0,105, 0, 0, 0,103, 0, 0, 0,156, 0, 0, 0, 0, 0, 0, 1,104, 0, 0, 0,106, 0, 0, 0,159, 0, 0, 0,
-157, 0, 0, 0, 0, 0, 0, 1,160, 0, 0, 0,107, 0, 0, 0,105, 0, 0, 0,158, 0, 0, 0, 0, 0, 0, 1,106, 0, 0, 0,
- 65, 0, 0, 0, 66, 0, 0, 0,159, 0, 0, 0, 0, 0, 0, 1, 66, 0, 0, 0, 65, 0, 0, 0,107, 0, 0, 0,160, 0, 0, 0,
- 0, 0, 0, 1,108, 0, 0, 0,125, 0, 0, 0,157, 0, 0, 0,159, 0, 0, 0, 0, 0, 0, 1,158, 0, 0, 0,126, 0, 0, 0,
-109, 0, 0, 0,160, 0, 0, 0, 0, 0, 0, 1,125, 0, 0, 0,176, 0, 0, 0,155, 0, 0, 0,157, 0, 0, 0, 0, 0, 0, 1,
-156, 0, 0, 0,177, 0, 0, 0,126, 0, 0, 0,158, 0, 0, 0, 0, 0, 0, 1,123, 0, 0, 0,153, 0, 0, 0,155, 0, 0, 0,
-176, 0, 0, 0, 0, 0, 0, 1,156, 0, 0, 0,154, 0, 0, 0,124, 0, 0, 0,177, 0, 0, 0, 0, 0, 0, 1,121, 0, 0, 0,
-151, 0, 0, 0,153, 0, 0, 0,123, 0, 0, 0, 0, 0, 0, 1,154, 0, 0, 0,152, 0, 0, 0,122, 0, 0, 0,124, 0, 0, 0,
- 0, 0, 0, 1,119, 0, 0, 0,149, 0, 0, 0,151, 0, 0, 0,121, 0, 0, 0, 0, 0, 0, 1,152, 0, 0, 0,150, 0, 0, 0,
-120, 0, 0, 0,122, 0, 0, 0, 0, 0, 0, 1,117, 0, 0, 0,147, 0, 0, 0,149, 0, 0, 0,119, 0, 0, 0, 0, 0, 0, 1,
-150, 0, 0, 0,148, 0, 0, 0,118, 0, 0, 0,120, 0, 0, 0, 0, 0, 0, 1,115, 0, 0, 0,145, 0, 0, 0,147, 0, 0, 0,
-117, 0, 0, 0, 0, 0, 0, 1,148, 0, 0, 0,146, 0, 0, 0,116, 0, 0, 0,118, 0, 0, 0, 0, 0, 0, 1,113, 0, 0, 0,
-143, 0, 0, 0,145, 0, 0, 0,115, 0, 0, 0, 0, 0, 0, 1,146, 0, 0, 0,144, 0, 0, 0,114, 0, 0, 0,116, 0, 0, 0,
- 0, 0, 0, 1, 14, 0, 0, 0,161, 0, 0, 0,143, 0, 0, 0,113, 0, 0, 0, 0, 0, 0, 1,144, 0, 0, 0,162, 0, 0, 0,
-112, 0, 0, 0,114, 0, 0, 0, 0, 0, 0, 1, 14, 0, 0, 0,178, 0, 0, 0,174, 0, 0, 0,161, 0, 0, 0, 0, 0, 0, 1,
-174, 0, 0, 0,179, 0, 0, 0,112, 0, 0, 0,162, 0, 0, 0, 0, 0, 0, 1,108, 0, 0, 0,159, 0, 0, 0, 66, 0, 0, 0,
-110, 0, 0, 0, 0, 0, 0, 1, 66, 0, 0, 0,160, 0, 0, 0,109, 0, 0, 0,111, 0, 0, 0, 0, 0, 0, 1,110, 0, 0, 0,
- 66, 0, 0, 0,175, 0, 0, 0,180, 0, 0, 0, 0, 0, 0, 1,175, 0, 0, 0, 66, 0, 0, 0,111, 0, 0, 0,181, 0, 0, 0,
- 0, 0, 0, 1,174, 0, 0, 0,178, 0, 0, 0,180, 0, 0, 0,175, 0, 0, 0, 0, 0, 0, 1,181, 0, 0, 0,179, 0, 0, 0,
-174, 0, 0, 0,175, 0, 0, 0, 0, 0, 0, 1,132, 0, 0, 0,134, 0, 0, 0,173, 0, 0, 0,171, 0, 0, 0, 0, 0, 0, 1,
-173, 0, 0, 0,134, 0, 0, 0,133, 0, 0, 0,172, 0, 0, 0, 0, 0, 0, 1,130, 0, 0, 0,132, 0, 0, 0,171, 0, 0, 0,
-169, 0, 0, 0, 0, 0, 0, 1,172, 0, 0, 0,133, 0, 0, 0,131, 0, 0, 0,170, 0, 0, 0, 0, 0, 0, 1,128, 0, 0, 0,
-130, 0, 0, 0,169, 0, 0, 0,167, 0, 0, 0, 0, 0, 0, 1,170, 0, 0, 0,131, 0, 0, 0,129, 0, 0, 0,168, 0, 0, 0,
- 0, 0, 0, 1,163, 0, 0, 0,184, 0, 0, 0,182, 0, 0, 0,165, 0, 0, 0, 0, 0, 0, 1,183, 0, 0, 0,185, 0, 0, 0,
-164, 0, 0, 0,166, 0, 0, 0, 0, 0, 0, 1,128, 0, 0, 0,167, 0, 0, 0,165, 0, 0, 0,182, 0, 0, 0, 0, 0, 0, 1,
-166, 0, 0, 0,168, 0, 0, 0,129, 0, 0, 0,183, 0, 0, 0, 0, 0, 0, 1,141, 0, 0, 0,187, 0, 0, 0,186, 0, 0, 0,
-184, 0, 0, 0, 0, 0, 0, 1,186, 0, 0, 0,187, 0, 0, 0,142, 0, 0, 0,185, 0, 0, 0, 0, 0, 0, 1,182, 0, 0, 0,
-184, 0, 0, 0,186, 0, 0, 0, 67, 0, 0, 0, 0, 0, 0, 1,186, 0, 0, 0,185, 0, 0, 0,183, 0, 0, 0, 67, 0, 0, 0,
- 0, 0, 0, 1,127, 0, 0, 0,128, 0, 0, 0,182, 0, 0, 0, 67, 0, 0, 0, 0, 0, 0, 1,183, 0, 0, 0,129, 0, 0, 0,
-127, 0, 0, 0, 67, 0, 0, 0, 0, 0, 0, 1,139, 0, 0, 0,190, 0, 0, 0,188, 0, 0, 0,141, 0, 0, 0, 0, 0, 0, 1,
-189, 0, 0, 0,191, 0, 0, 0,140, 0, 0, 0,142, 0, 0, 0, 0, 0, 0, 1,137, 0, 0, 0,192, 0, 0, 0,190, 0, 0, 0,
-139, 0, 0, 0, 0, 0, 0, 1,191, 0, 0, 0,193, 0, 0, 0,138, 0, 0, 0,140, 0, 0, 0, 0, 0, 0, 1,136, 0, 0, 0,
-194, 0, 0, 0,192, 0, 0, 0,137, 0, 0, 0, 0, 0, 0, 1,193, 0, 0, 0,195, 0, 0, 0,136, 0, 0, 0,138, 0, 0, 0,
- 0, 0, 0, 1,135, 0, 0, 0, 69, 0, 0, 0,194, 0, 0, 0,136, 0, 0, 0, 0, 0, 0, 1,195, 0, 0, 0, 69, 0, 0, 0,
-135, 0, 0, 0,136, 0, 0, 0, 0, 0, 0, 1,187, 0, 0, 0,141, 0, 0, 0,188, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 1,
-189, 0, 0, 0,142, 0, 0, 0,187, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 1, 68, 0, 0, 0,188, 0, 0, 0,203, 0, 0, 0,
-205, 0, 0, 0, 0, 0, 0, 1,204, 0, 0, 0,189, 0, 0, 0, 68, 0, 0, 0,205, 0, 0, 0, 0, 0, 0, 1, 69, 0, 0, 0,
-196, 0, 0, 0,197, 0, 0, 0,194, 0, 0, 0, 0, 0, 0, 1,198, 0, 0, 0,196, 0, 0, 0, 69, 0, 0, 0,195, 0, 0, 0,
- 0, 0, 0, 1,194, 0, 0, 0,197, 0, 0, 0,199, 0, 0, 0,192, 0, 0, 0, 0, 0, 0, 1,200, 0, 0, 0,198, 0, 0, 0,
-195, 0, 0, 0,193, 0, 0, 0, 0, 0, 0, 1,192, 0, 0, 0,199, 0, 0, 0,201, 0, 0, 0,190, 0, 0, 0, 0, 0, 0, 1,
-202, 0, 0, 0,200, 0, 0, 0,193, 0, 0, 0,191, 0, 0, 0, 0, 0, 0, 1,190, 0, 0, 0,201, 0, 0, 0,203, 0, 0, 0,
-188, 0, 0, 0, 0, 0, 0, 1,204, 0, 0, 0,202, 0, 0, 0,191, 0, 0, 0,189, 0, 0, 0, 0, 0, 0, 1,196, 0, 0, 0,
-201, 0, 0, 0,199, 0, 0, 0,197, 0, 0, 0, 0, 0, 0, 1,200, 0, 0, 0,202, 0, 0, 0,196, 0, 0, 0,198, 0, 0, 0,
- 0, 0, 0, 1,196, 0, 0, 0,205, 0, 0, 0,203, 0, 0, 0,201, 0, 0, 0, 0, 0, 0, 1,204, 0, 0, 0,205, 0, 0, 0,
-196, 0, 0, 0,202, 0, 0, 0, 0, 0, 0, 1,136, 0, 0, 0,137, 0, 0, 0,161, 0, 0, 0,174, 0, 0, 0, 0, 0, 0, 1,
-162, 0, 0, 0,138, 0, 0, 0,136, 0, 0, 0,174, 0, 0, 0, 0, 0, 0, 1,137, 0, 0, 0,139, 0, 0, 0,208, 0, 0, 0,
-161, 0, 0, 0, 0, 0, 0, 1,209, 0, 0, 0,140, 0, 0, 0,138, 0, 0, 0,162, 0, 0, 0, 0, 0, 0, 1,139, 0, 0, 0,
-141, 0, 0, 0,210, 0, 0, 0,208, 0, 0, 0, 0, 0, 0, 1,211, 0, 0, 0,142, 0, 0, 0,140, 0, 0, 0,209, 0, 0, 0,
- 0, 0, 0, 1,141, 0, 0, 0,184, 0, 0, 0,163, 0, 0, 0,210, 0, 0, 0, 0, 0, 0, 1,164, 0, 0, 0,185, 0, 0, 0,
-142, 0, 0, 0,211, 0, 0, 0, 0, 0, 0, 1, 79, 0, 0, 0,206, 0, 0, 0,210, 0, 0, 0,163, 0, 0, 0, 0, 0, 0, 1,
-211, 0, 0, 0,207, 0, 0, 0, 80, 0, 0, 0,164, 0, 0, 0, 0, 0, 0, 1,206, 0, 0, 0,212, 0, 0, 0,208, 0, 0, 0,
-210, 0, 0, 0, 0, 0, 0, 1,209, 0, 0, 0,213, 0, 0, 0,207, 0, 0, 0,211, 0, 0, 0, 0, 0, 0, 1, 77, 0, 0, 0,
-161, 0, 0, 0,208, 0, 0, 0,212, 0, 0, 0, 0, 0, 0, 1,209, 0, 0, 0,162, 0, 0, 0, 78, 0, 0, 0,213, 0, 0, 0,
- 0, 0, 0, 1,128, 0, 0, 0,127, 0, 0, 0, 70, 0, 0, 0,219, 0, 0, 0, 0, 0, 0, 1, 70, 0, 0, 0,127, 0, 0, 0,
-129, 0, 0, 0,220, 0, 0, 0, 0, 0, 0, 1,130, 0, 0, 0,128, 0, 0, 0,219, 0, 0, 0,217, 0, 0, 0, 0, 0, 0, 1,
-220, 0, 0, 0,129, 0, 0, 0,131, 0, 0, 0,218, 0, 0, 0, 0, 0, 0, 1,132, 0, 0, 0,130, 0, 0, 0,217, 0, 0, 0,
-215, 0, 0, 0, 0, 0, 0, 1,218, 0, 0, 0,131, 0, 0, 0,133, 0, 0, 0,216, 0, 0, 0, 0, 0, 0, 1,134, 0, 0, 0,
-132, 0, 0, 0,215, 0, 0, 0,214, 0, 0, 0, 0, 0, 0, 1,216, 0, 0, 0,133, 0, 0, 0,134, 0, 0, 0,214, 0, 0, 0,
- 0, 0, 0, 1,214, 0, 0, 0,215, 0, 0, 0,226, 0, 0, 0,228, 0, 0, 0, 0, 0, 0, 1,227, 0, 0, 0,216, 0, 0, 0,
-214, 0, 0, 0,228, 0, 0, 0, 0, 0, 0, 1,215, 0, 0, 0,217, 0, 0, 0,224, 0, 0, 0,226, 0, 0, 0, 0, 0, 0, 1,
-225, 0, 0, 0,218, 0, 0, 0,216, 0, 0, 0,227, 0, 0, 0, 0, 0, 0, 1,217, 0, 0, 0,219, 0, 0, 0,222, 0, 0, 0,
-224, 0, 0, 0, 0, 0, 0, 1,223, 0, 0, 0,220, 0, 0, 0,218, 0, 0, 0,225, 0, 0, 0, 0, 0, 0, 1,219, 0, 0, 0,
- 70, 0, 0, 0,221, 0, 0, 0,222, 0, 0, 0, 0, 0, 0, 1,221, 0, 0, 0, 70, 0, 0, 0,220, 0, 0, 0,223, 0, 0, 0,
- 0, 0, 0, 1,221, 0, 0, 0,228, 0, 0, 0,226, 0, 0, 0,222, 0, 0, 0, 0, 0, 0, 1,227, 0, 0, 0,228, 0, 0, 0,
-221, 0, 0, 0,223, 0, 0, 0, 0, 0, 0, 1,222, 0, 0, 0,226, 0, 0, 0,224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
-225, 0, 0, 0,227, 0, 0, 0,223, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,180, 0, 0, 0,178, 0, 0, 0,231, 0, 0, 0,
-229, 0, 0, 0, 0, 0, 0, 1,232, 0, 0, 0,179, 0, 0, 0,181, 0, 0, 0,230, 0, 0, 0, 0, 0, 0, 1,110, 0, 0, 0,
-180, 0, 0, 0,229, 0, 0, 0,251, 0, 0, 0, 0, 0, 0, 1,230, 0, 0, 0,181, 0, 0, 0,111, 0, 0, 0,252, 0, 0, 0,
- 0, 0, 0, 1,108, 0, 0, 0,110, 0, 0, 0,251, 0, 0, 0,253, 0, 0, 0, 0, 0, 0, 1,252, 0, 0, 0,111, 0, 0, 0,
-109, 0, 0, 0,254, 0, 0, 0, 0, 0, 0, 1,178, 0, 0, 0, 14, 0, 0, 0,249, 0, 0, 0,231, 0, 0, 0, 0, 0, 0, 1,
-250, 0, 0, 0,112, 0, 0, 0,179, 0, 0, 0,232, 0, 0, 0, 0, 0, 0, 1, 14, 0, 0, 0,113, 0, 0, 0,247, 0, 0, 0,
-249, 0, 0, 0, 0, 0, 0, 1,248, 0, 0, 0,114, 0, 0, 0,112, 0, 0, 0,250, 0, 0, 0, 0, 0, 0, 1,113, 0, 0, 0,
-115, 0, 0, 0,245, 0, 0, 0,247, 0, 0, 0, 0, 0, 0, 1,246, 0, 0, 0,116, 0, 0, 0,114, 0, 0, 0,248, 0, 0, 0,
- 0, 0, 0, 1,115, 0, 0, 0,117, 0, 0, 0,243, 0, 0, 0,245, 0, 0, 0, 0, 0, 0, 1,244, 0, 0, 0,118, 0, 0, 0,
-116, 0, 0, 0,246, 0, 0, 0, 0, 0, 0, 1,117, 0, 0, 0,119, 0, 0, 0,241, 0, 0, 0,243, 0, 0, 0, 0, 0, 0, 1,
-242, 0, 0, 0,120, 0, 0, 0,118, 0, 0, 0,244, 0, 0, 0, 0, 0, 0, 1,119, 0, 0, 0,121, 0, 0, 0,239, 0, 0, 0,
-241, 0, 0, 0, 0, 0, 0, 1,240, 0, 0, 0,122, 0, 0, 0,120, 0, 0, 0,242, 0, 0, 0, 0, 0, 0, 1,121, 0, 0, 0,
-123, 0, 0, 0,237, 0, 0, 0,239, 0, 0, 0, 0, 0, 0, 1,238, 0, 0, 0,124, 0, 0, 0,122, 0, 0, 0,240, 0, 0, 0,
- 0, 0, 0, 1,123, 0, 0, 0,176, 0, 0, 0,233, 0, 0, 0,237, 0, 0, 0, 0, 0, 0, 1,234, 0, 0, 0,177, 0, 0, 0,
-124, 0, 0, 0,238, 0, 0, 0, 0, 0, 0, 1,176, 0, 0, 0,125, 0, 0, 0,235, 0, 0, 0,233, 0, 0, 0, 0, 0, 0, 1,
-236, 0, 0, 0,126, 0, 0, 0,177, 0, 0, 0,234, 0, 0, 0, 0, 0, 0, 1,125, 0, 0, 0,108, 0, 0, 0,253, 0, 0, 0,
-235, 0, 0, 0, 0, 0, 0, 1,254, 0, 0, 0,109, 0, 0, 0,126, 0, 0, 0,236, 0, 0, 0, 0, 0, 0, 1,235, 0, 0, 0,
-253, 0, 0, 0,255, 0, 0, 0, 17, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0,254, 0, 0, 0,236, 0, 0, 0, 18, 1, 0, 0,
- 0, 0, 0, 1,233, 0, 0, 0,235, 0, 0, 0, 17, 1, 0, 0, 19, 1, 0, 0, 0, 0, 0, 1, 18, 1, 0, 0,236, 0, 0, 0,
-234, 0, 0, 0, 20, 1, 0, 0, 0, 0, 0, 1,237, 0, 0, 0,233, 0, 0, 0, 19, 1, 0, 0, 15, 1, 0, 0, 0, 0, 0, 1,
- 20, 1, 0, 0,234, 0, 0, 0,238, 0, 0, 0, 16, 1, 0, 0, 0, 0, 0, 1,239, 0, 0, 0,237, 0, 0, 0, 15, 1, 0, 0,
- 13, 1, 0, 0, 0, 0, 0, 1, 16, 1, 0, 0,238, 0, 0, 0,240, 0, 0, 0, 14, 1, 0, 0, 0, 0, 0, 1,241, 0, 0, 0,
-239, 0, 0, 0, 13, 1, 0, 0, 11, 1, 0, 0, 0, 0, 0, 1, 14, 1, 0, 0,240, 0, 0, 0,242, 0, 0, 0, 12, 1, 0, 0,
- 0, 0, 0, 1,243, 0, 0, 0,241, 0, 0, 0, 11, 1, 0, 0, 9, 1, 0, 0, 0, 0, 0, 1, 12, 1, 0, 0,242, 0, 0, 0,
-244, 0, 0, 0, 10, 1, 0, 0, 0, 0, 0, 1,245, 0, 0, 0,243, 0, 0, 0, 9, 1, 0, 0, 7, 1, 0, 0, 0, 0, 0, 1,
- 10, 1, 0, 0,244, 0, 0, 0,246, 0, 0, 0, 8, 1, 0, 0, 0, 0, 0, 1,247, 0, 0, 0,245, 0, 0, 0, 7, 1, 0, 0,
- 5, 1, 0, 0, 0, 0, 0, 1, 8, 1, 0, 0,246, 0, 0, 0,248, 0, 0, 0, 6, 1, 0, 0, 0, 0, 0, 1,249, 0, 0, 0,
-247, 0, 0, 0, 5, 1, 0, 0, 3, 1, 0, 0, 0, 0, 0, 1, 6, 1, 0, 0,248, 0, 0, 0,250, 0, 0, 0, 4, 1, 0, 0,
- 0, 0, 0, 1,231, 0, 0, 0,249, 0, 0, 0, 3, 1, 0, 0, 21, 1, 0, 0, 0, 0, 0, 1, 4, 1, 0, 0,250, 0, 0, 0,
-232, 0, 0, 0, 22, 1, 0, 0, 0, 0, 0, 1,253, 0, 0, 0,251, 0, 0, 0, 1, 1, 0, 0,255, 0, 0, 0, 0, 0, 0, 1,
- 2, 1, 0, 0,252, 0, 0, 0,254, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1,251, 0, 0, 0,229, 0, 0, 0, 23, 1, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 1, 24, 1, 0, 0,230, 0, 0, 0,252, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 1,229, 0, 0, 0,
-231, 0, 0, 0, 21, 1, 0, 0, 23, 1, 0, 0, 0, 0, 0, 1, 22, 1, 0, 0,232, 0, 0, 0,230, 0, 0, 0, 24, 1, 0, 0,
- 0, 0, 0, 1, 65, 0, 0, 0,106, 0, 0, 0, 25, 1, 0, 0, 71, 0, 0, 0, 0, 0, 0, 1, 26, 1, 0, 0,107, 0, 0, 0,
- 65, 0, 0, 0, 71, 0, 0, 0, 0, 0, 0, 1,106, 0, 0, 0,104, 0, 0, 0, 27, 1, 0, 0, 25, 1, 0, 0, 0, 0, 0, 1,
- 28, 1, 0, 0,105, 0, 0, 0,107, 0, 0, 0, 26, 1, 0, 0, 0, 0, 0, 1,104, 0, 0, 0,102, 0, 0, 0, 29, 1, 0, 0,
- 27, 1, 0, 0, 0, 0, 0, 1, 30, 1, 0, 0,103, 0, 0, 0,105, 0, 0, 0, 28, 1, 0, 0, 0, 0, 0, 1,102, 0, 0, 0,
-100, 0, 0, 0, 31, 1, 0, 0, 29, 1, 0, 0, 0, 0, 0, 1, 32, 1, 0, 0,101, 0, 0, 0,103, 0, 0, 0, 30, 1, 0, 0,
- 0, 0, 0, 1,100, 0, 0, 0, 98, 0, 0, 0, 33, 1, 0, 0, 31, 1, 0, 0, 0, 0, 0, 1, 34, 1, 0, 0, 99, 0, 0, 0,
-101, 0, 0, 0, 32, 1, 0, 0, 0, 0, 0, 1, 98, 0, 0, 0, 96, 0, 0, 0, 35, 1, 0, 0, 33, 1, 0, 0, 0, 0, 0, 1,
- 36, 1, 0, 0, 97, 0, 0, 0, 99, 0, 0, 0, 34, 1, 0, 0, 0, 0, 0, 1, 96, 0, 0, 0, 94, 0, 0, 0, 37, 1, 0, 0,
- 35, 1, 0, 0, 0, 0, 0, 1, 38, 1, 0, 0, 95, 0, 0, 0, 97, 0, 0, 0, 36, 1, 0, 0, 0, 0, 0, 1, 94, 0, 0, 0,
- 92, 0, 0, 0, 39, 1, 0, 0, 37, 1, 0, 0, 0, 0, 0, 1, 40, 1, 0, 0, 93, 0, 0, 0, 95, 0, 0, 0, 38, 1, 0, 0,
- 0, 0, 0, 1, 92, 0, 0, 0, 90, 0, 0, 0, 41, 1, 0, 0, 39, 1, 0, 0, 0, 0, 0, 1, 42, 1, 0, 0, 91, 0, 0, 0,
- 93, 0, 0, 0, 40, 1, 0, 0, 0, 0, 0, 1, 49, 1, 0, 0, 50, 1, 0, 0, 69, 1, 0, 0, 79, 1, 0, 0, 0, 0, 0, 1,
- 70, 1, 0, 0, 50, 1, 0, 0, 49, 1, 0, 0, 80, 1, 0, 0, 0, 0, 0, 1, 48, 1, 0, 0, 49, 1, 0, 0, 79, 1, 0, 0,
- 77, 1, 0, 0, 0, 0, 0, 1, 80, 1, 0, 0, 49, 1, 0, 0, 48, 1, 0, 0, 78, 1, 0, 0, 0, 0, 0, 1, 47, 1, 0, 0,
- 48, 1, 0, 0, 77, 1, 0, 0, 81, 1, 0, 0, 0, 0, 0, 1, 78, 1, 0, 0, 48, 1, 0, 0, 47, 1, 0, 0, 82, 1, 0, 0,
- 0, 0, 0, 1, 87, 0, 0, 0, 89, 0, 0, 0, 47, 1, 0, 0, 81, 1, 0, 0, 0, 0, 0, 1, 47, 1, 0, 0, 89, 0, 0, 0,
- 88, 0, 0, 0, 82, 1, 0, 0, 0, 0, 0, 1, 85, 0, 0, 0, 87, 0, 0, 0, 81, 1, 0, 0, 75, 1, 0, 0, 0, 0, 0, 1,
- 82, 1, 0, 0, 88, 0, 0, 0, 86, 0, 0, 0, 76, 1, 0, 0, 0, 0, 0, 1, 83, 0, 0, 0, 85, 0, 0, 0, 75, 1, 0, 0,
- 71, 1, 0, 0, 0, 0, 0, 1, 76, 1, 0, 0, 86, 0, 0, 0, 84, 0, 0, 0, 72, 1, 0, 0, 0, 0, 0, 1, 81, 0, 0, 0,
- 83, 0, 0, 0, 71, 1, 0, 0, 73, 1, 0, 0, 0, 0, 0, 1, 72, 1, 0, 0, 84, 0, 0, 0, 82, 0, 0, 0, 74, 1, 0, 0,
- 0, 0, 0, 1, 71, 1, 0, 0, 77, 1, 0, 0, 79, 1, 0, 0, 73, 1, 0, 0, 0, 0, 0, 1, 80, 1, 0, 0, 78, 1, 0, 0,
- 72, 1, 0, 0, 74, 1, 0, 0, 0, 0, 0, 1, 71, 1, 0, 0, 75, 1, 0, 0, 81, 1, 0, 0, 77, 1, 0, 0, 0, 0, 0, 1,
- 82, 1, 0, 0, 76, 1, 0, 0, 72, 1, 0, 0, 78, 1, 0, 0, 0, 0, 0, 1, 67, 1, 0, 0, 73, 1, 0, 0, 79, 1, 0, 0,
- 69, 1, 0, 0, 0, 0, 0, 1, 80, 1, 0, 0, 74, 1, 0, 0, 68, 1, 0, 0, 70, 1, 0, 0, 0, 0, 0, 1, 79, 0, 0, 0,
- 81, 0, 0, 0, 73, 1, 0, 0, 67, 1, 0, 0, 0, 0, 0, 1, 74, 1, 0, 0, 82, 0, 0, 0, 80, 0, 0, 0, 68, 1, 0, 0,
- 0, 0, 0, 1,206, 0, 0, 0, 83, 1, 0, 0, 85, 1, 0, 0,212, 0, 0, 0, 0, 0, 0, 1, 86, 1, 0, 0, 84, 1, 0, 0,
-207, 0, 0, 0,213, 0, 0, 0, 0, 0, 0, 1, 79, 0, 0, 0, 67, 1, 0, 0, 83, 1, 0, 0,206, 0, 0, 0, 0, 0, 0, 1,
- 84, 1, 0, 0, 68, 1, 0, 0, 80, 0, 0, 0,207, 0, 0, 0, 0, 0, 0, 1, 77, 0, 0, 0,212, 0, 0, 0, 85, 1, 0, 0,
- 87, 1, 0, 0, 0, 0, 0, 1, 86, 1, 0, 0,213, 0, 0, 0, 78, 0, 0, 0, 88, 1, 0, 0, 0, 0, 0, 1, 77, 0, 0, 0,
- 87, 1, 0, 0, 41, 1, 0, 0, 90, 0, 0, 0, 0, 0, 0, 1, 42, 1, 0, 0, 88, 1, 0, 0, 78, 0, 0, 0, 91, 0, 0, 0,
- 0, 0, 0, 1, 75, 0, 0, 0, 65, 1, 0, 0, 93, 1, 0, 0, 45, 1, 0, 0, 0, 0, 0, 1, 94, 1, 0, 0, 66, 1, 0, 0,
- 75, 0, 0, 0, 45, 1, 0, 0, 0, 0, 0, 1, 45, 1, 0, 0, 93, 1, 0, 0, 91, 1, 0, 0, 76, 0, 0, 0, 0, 0, 0, 1,
- 92, 1, 0, 0, 94, 1, 0, 0, 45, 1, 0, 0, 76, 0, 0, 0, 0, 0, 0, 1, 76, 0, 0, 0, 91, 1, 0, 0, 89, 1, 0, 0,
- 46, 1, 0, 0, 0, 0, 0, 1, 90, 1, 0, 0, 92, 1, 0, 0, 76, 0, 0, 0, 46, 1, 0, 0, 0, 0, 0, 1, 46, 1, 0, 0,
- 89, 1, 0, 0, 69, 1, 0, 0, 50, 1, 0, 0, 0, 0, 0, 1, 70, 1, 0, 0, 90, 1, 0, 0, 46, 1, 0, 0, 50, 1, 0, 0,
- 0, 0, 0, 1, 67, 1, 0, 0, 69, 1, 0, 0, 89, 1, 0, 0, 83, 1, 0, 0, 0, 0, 0, 1, 90, 1, 0, 0, 70, 1, 0, 0,
- 68, 1, 0, 0, 84, 1, 0, 0, 0, 0, 0, 1, 37, 1, 0, 0, 39, 1, 0, 0, 59, 1, 0, 0, 51, 1, 0, 0, 0, 0, 0, 1,
- 60, 1, 0, 0, 40, 1, 0, 0, 38, 1, 0, 0, 52, 1, 0, 0, 0, 0, 0, 1, 74, 0, 0, 0, 57, 1, 0, 0, 65, 1, 0, 0,
- 75, 0, 0, 0, 0, 0, 0, 1, 66, 1, 0, 0, 58, 1, 0, 0, 74, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 1, 43, 1, 0, 0,
- 99, 1, 0, 0, 97, 1, 0, 0, 44, 1, 0, 0, 0, 0, 0, 1, 98, 1, 0, 0,100, 1, 0, 0, 43, 1, 0, 0, 44, 1, 0, 0,
- 0, 0, 0, 1, 44, 1, 0, 0, 97, 1, 0, 0, 95, 1, 0, 0, 73, 0, 0, 0, 0, 0, 0, 1, 96, 1, 0, 0, 98, 1, 0, 0,
- 44, 1, 0, 0, 73, 0, 0, 0, 0, 0, 0, 1, 73, 0, 0, 0, 95, 1, 0, 0, 57, 1, 0, 0, 74, 0, 0, 0, 0, 0, 0, 1,
- 58, 1, 0, 0, 96, 1, 0, 0, 73, 0, 0, 0, 74, 0, 0, 0, 0, 0, 0, 1, 33, 1, 0, 0, 35, 1, 0, 0,103, 1, 0, 0,
-105, 1, 0, 0, 0, 0, 0, 1,104, 1, 0, 0, 36, 1, 0, 0, 34, 1, 0, 0,106, 1, 0, 0, 0, 0, 0, 1,105, 1, 0, 0,
-103, 1, 0, 0,109, 1, 0, 0,107, 1, 0, 0, 0, 0, 0, 1,110, 1, 0, 0,104, 1, 0, 0,106, 1, 0, 0,108, 1, 0, 0,
- 0, 0, 0, 1,107, 1, 0, 0,109, 1, 0, 0,111, 1, 0, 0,113, 1, 0, 0, 0, 0, 0, 1,112, 1, 0, 0,110, 1, 0, 0,
-108, 1, 0, 0,114, 1, 0, 0, 0, 0, 0, 1,113, 1, 0, 0,111, 1, 0, 0,117, 1, 0, 0,115, 1, 0, 0, 0, 0, 0, 1,
-118, 1, 0, 0,112, 1, 0, 0,114, 1, 0, 0,116, 1, 0, 0, 0, 0, 0, 1, 55, 1, 0, 0,119, 1, 0, 0,115, 1, 0, 0,
-117, 1, 0, 0, 0, 0, 0, 1,116, 1, 0, 0,120, 1, 0, 0, 56, 1, 0, 0,118, 1, 0, 0, 0, 0, 0, 1, 57, 1, 0, 0,
- 95, 1, 0, 0,115, 1, 0, 0,119, 1, 0, 0, 0, 0, 0, 1,116, 1, 0, 0, 96, 1, 0, 0, 58, 1, 0, 0,120, 1, 0, 0,
- 0, 0, 0, 1, 95, 1, 0, 0, 97, 1, 0, 0,113, 1, 0, 0,115, 1, 0, 0, 0, 0, 0, 1,114, 1, 0, 0, 98, 1, 0, 0,
- 96, 1, 0, 0,116, 1, 0, 0, 0, 0, 0, 1, 97, 1, 0, 0, 99, 1, 0, 0,107, 1, 0, 0,113, 1, 0, 0, 0, 0, 0, 1,
-108, 1, 0, 0,100, 1, 0, 0, 98, 1, 0, 0,114, 1, 0, 0, 0, 0, 0, 1, 99, 1, 0, 0,101, 1, 0, 0,105, 1, 0, 0,
-107, 1, 0, 0, 0, 0, 0, 1,106, 1, 0, 0,102, 1, 0, 0,100, 1, 0, 0,108, 1, 0, 0, 0, 0, 0, 1, 31, 1, 0, 0,
- 33, 1, 0, 0,105, 1, 0, 0,101, 1, 0, 0, 0, 0, 0, 1,106, 1, 0, 0, 34, 1, 0, 0, 32, 1, 0, 0,102, 1, 0, 0,
- 0, 0, 0, 1, 72, 0, 0, 0,101, 1, 0, 0, 99, 1, 0, 0, 43, 1, 0, 0, 0, 0, 0, 1,100, 1, 0, 0,102, 1, 0, 0,
- 72, 0, 0, 0, 43, 1, 0, 0, 0, 0, 0, 1, 25, 1, 0, 0, 27, 1, 0, 0, 29, 1, 0, 0, 31, 1, 0, 0, 0, 0, 0, 1,
- 30, 1, 0, 0, 28, 1, 0, 0, 26, 1, 0, 0, 32, 1, 0, 0, 0, 0, 0, 1, 25, 1, 0, 0, 31, 1, 0, 0,101, 1, 0, 0,
- 72, 0, 0, 0, 0, 0, 0, 1,102, 1, 0, 0, 32, 1, 0, 0, 26, 1, 0, 0, 72, 0, 0, 0, 0, 0, 0, 1, 71, 0, 0, 0,
- 25, 1, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 72, 0, 0, 0, 26, 1, 0, 0, 71, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 35, 1, 0, 0, 37, 1, 0, 0, 51, 1, 0, 0,103, 1, 0, 0, 0, 0, 0, 1, 52, 1, 0, 0, 38, 1, 0, 0,
- 36, 1, 0, 0,104, 1, 0, 0, 0, 0, 0, 1, 51, 1, 0, 0, 53, 1, 0, 0,109, 1, 0, 0,103, 1, 0, 0, 0, 0, 0, 1,
-110, 1, 0, 0, 54, 1, 0, 0, 52, 1, 0, 0,104, 1, 0, 0, 0, 0, 0, 1, 53, 1, 0, 0,123, 1, 0, 0,111, 1, 0, 0,
-109, 1, 0, 0, 0, 0, 0, 1,112, 1, 0, 0,124, 1, 0, 0, 54, 1, 0, 0,110, 1, 0, 0, 0, 0, 0, 1, 55, 1, 0, 0,
-117, 1, 0, 0,111, 1, 0, 0,123, 1, 0, 0, 0, 0, 0, 1,112, 1, 0, 0,118, 1, 0, 0, 56, 1, 0, 0,124, 1, 0, 0,
- 0, 0, 0, 1, 89, 1, 0, 0, 91, 1, 0, 0,127, 1, 0, 0,125, 1, 0, 0, 0, 0, 0, 1,128, 1, 0, 0, 92, 1, 0, 0,
- 90, 1, 0, 0,126, 1, 0, 0, 0, 0, 0, 1, 59, 1, 0, 0,125, 1, 0, 0,127, 1, 0, 0, 61, 1, 0, 0, 0, 0, 0, 1,
-128, 1, 0, 0,126, 1, 0, 0, 60, 1, 0, 0, 62, 1, 0, 0, 0, 0, 0, 1, 39, 1, 0, 0, 41, 1, 0, 0,125, 1, 0, 0,
- 59, 1, 0, 0, 0, 0, 0, 1,126, 1, 0, 0, 42, 1, 0, 0, 40, 1, 0, 0, 60, 1, 0, 0, 0, 0, 0, 1, 41, 1, 0, 0,
- 85, 1, 0, 0, 83, 1, 0, 0,125, 1, 0, 0, 0, 0, 0, 1, 84, 1, 0, 0, 86, 1, 0, 0, 42, 1, 0, 0,126, 1, 0, 0,
- 0, 0, 0, 1, 83, 1, 0, 0, 89, 1, 0, 0,125, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,126, 1, 0, 0, 90, 1, 0, 0,
- 84, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 41, 1, 0, 0, 87, 1, 0, 0, 85, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
- 86, 1, 0, 0, 88, 1, 0, 0, 42, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 55, 1, 0, 0, 63, 1, 0, 0,121, 1, 0, 0,
-119, 1, 0, 0, 0, 0, 0, 1,122, 1, 0, 0, 64, 1, 0, 0, 56, 1, 0, 0,120, 1, 0, 0, 0, 0, 0, 1, 57, 1, 0, 0,
-119, 1, 0, 0,121, 1, 0, 0, 65, 1, 0, 0, 0, 0, 0, 1,122, 1, 0, 0,120, 1, 0, 0, 58, 1, 0, 0, 66, 1, 0, 0,
- 0, 0, 0, 1, 61, 1, 0, 0,127, 1, 0, 0,121, 1, 0, 0, 63, 1, 0, 0, 0, 0, 0, 1,122, 1, 0, 0,128, 1, 0, 0,
- 62, 1, 0, 0, 64, 1, 0, 0, 0, 0, 0, 1, 91, 1, 0, 0, 93, 1, 0, 0,121, 1, 0, 0,127, 1, 0, 0, 0, 0, 0, 1,
-122, 1, 0, 0, 94, 1, 0, 0, 92, 1, 0, 0,128, 1, 0, 0, 0, 0, 0, 1, 65, 1, 0, 0,121, 1, 0, 0, 93, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 1, 94, 1, 0, 0,122, 1, 0, 0, 66, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,141, 1, 0, 0,
-129, 1, 0, 0,155, 1, 0, 0,143, 1, 0, 0, 0, 0, 0, 1,156, 1, 0, 0,130, 1, 0, 0,142, 1, 0, 0,144, 1, 0, 0,
- 0, 0, 0, 1,141, 1, 0, 0,143, 1, 0, 0,145, 1, 0, 0,139, 1, 0, 0, 0, 0, 0, 1,146, 1, 0, 0,144, 1, 0, 0,
-142, 1, 0, 0,140, 1, 0, 0, 0, 0, 0, 1,139, 1, 0, 0,145, 1, 0, 0,147, 1, 0, 0,137, 1, 0, 0, 0, 0, 0, 1,
-148, 1, 0, 0,146, 1, 0, 0,140, 1, 0, 0,138, 1, 0, 0, 0, 0, 0, 1,137, 1, 0, 0,147, 1, 0, 0,149, 1, 0, 0,
-135, 1, 0, 0, 0, 0, 0, 1,150, 1, 0, 0,148, 1, 0, 0,138, 1, 0, 0,136, 1, 0, 0, 0, 0, 0, 1,135, 1, 0, 0,
-149, 1, 0, 0,151, 1, 0, 0,133, 1, 0, 0, 0, 0, 0, 1,152, 1, 0, 0,150, 1, 0, 0,136, 1, 0, 0,134, 1, 0, 0,
- 0, 0, 0, 1,133, 1, 0, 0,151, 1, 0, 0,153, 1, 0, 0,131, 1, 0, 0, 0, 0, 0, 1,154, 1, 0, 0,152, 1, 0, 0,
-134, 1, 0, 0,132, 1, 0, 0, 0, 0, 0, 1,151, 1, 0, 0,161, 1, 0, 0,159, 1, 0, 0,153, 1, 0, 0, 0, 0, 0, 1,
-160, 1, 0, 0,162, 1, 0, 0,152, 1, 0, 0,154, 1, 0, 0, 0, 0, 0, 1,149, 1, 0, 0,163, 1, 0, 0,161, 1, 0, 0,
-151, 1, 0, 0, 0, 0, 0, 1,162, 1, 0, 0,164, 1, 0, 0,150, 1, 0, 0,152, 1, 0, 0, 0, 0, 0, 1,147, 1, 0, 0,
-165, 1, 0, 0,163, 1, 0, 0,149, 1, 0, 0, 0, 0, 0, 1,164, 1, 0, 0,166, 1, 0, 0,148, 1, 0, 0,150, 1, 0, 0,
- 0, 0, 0, 1,145, 1, 0, 0,167, 1, 0, 0,165, 1, 0, 0,147, 1, 0, 0, 0, 0, 0, 1,166, 1, 0, 0,168, 1, 0, 0,
-146, 1, 0, 0,148, 1, 0, 0, 0, 0, 0, 1,143, 1, 0, 0,169, 1, 0, 0,167, 1, 0, 0,145, 1, 0, 0, 0, 0, 0, 1,
-168, 1, 0, 0,170, 1, 0, 0,144, 1, 0, 0,146, 1, 0, 0, 0, 0, 0, 1,143, 1, 0, 0,155, 1, 0, 0,157, 1, 0, 0,
-169, 1, 0, 0, 0, 0, 0, 1,158, 1, 0, 0,156, 1, 0, 0,144, 1, 0, 0,170, 1, 0, 0, 0, 0, 0, 1, 59, 1, 0, 0,
- 61, 1, 0, 0,185, 1, 0, 0,183, 1, 0, 0, 0, 0, 0, 1,186, 1, 0, 0, 62, 1, 0, 0, 60, 1, 0, 0,184, 1, 0, 0,
- 0, 0, 0, 1, 61, 1, 0, 0,131, 1, 0, 0,153, 1, 0, 0,185, 1, 0, 0, 0, 0, 0, 1,154, 1, 0, 0,132, 1, 0, 0,
- 62, 1, 0, 0,186, 1, 0, 0, 0, 0, 0, 1, 51, 1, 0, 0, 59, 1, 0, 0,183, 1, 0, 0, 53, 1, 0, 0, 0, 0, 0, 1,
-184, 1, 0, 0, 60, 1, 0, 0, 52, 1, 0, 0, 54, 1, 0, 0, 0, 0, 0, 1,123, 1, 0, 0,171, 1, 0, 0,155, 1, 0, 0,
-129, 1, 0, 0, 0, 0, 0, 1,156, 1, 0, 0,172, 1, 0, 0,124, 1, 0, 0,130, 1, 0, 0, 0, 0, 0, 1,153, 1, 0, 0,
-159, 1, 0, 0,181, 1, 0, 0,185, 1, 0, 0, 0, 0, 0, 1,182, 1, 0, 0,160, 1, 0, 0,154, 1, 0, 0,186, 1, 0, 0,
- 0, 0, 0, 1,179, 1, 0, 0,187, 1, 0, 0,185, 1, 0, 0,181, 1, 0, 0, 0, 0, 0, 1,186, 1, 0, 0,188, 1, 0, 0,
-180, 1, 0, 0,182, 1, 0, 0, 0, 0, 0, 1,175, 1, 0, 0,187, 1, 0, 0,179, 1, 0, 0,177, 1, 0, 0, 0, 0, 0, 1,
-180, 1, 0, 0,188, 1, 0, 0,176, 1, 0, 0,178, 1, 0, 0, 0, 0, 0, 1,173, 1, 0, 0,189, 1, 0, 0,187, 1, 0, 0,
-175, 1, 0, 0, 0, 0, 0, 1,188, 1, 0, 0,190, 1, 0, 0,174, 1, 0, 0,176, 1, 0, 0, 0, 0, 0, 1,171, 1, 0, 0,
-189, 1, 0, 0,173, 1, 0, 0,191, 1, 0, 0, 0, 0, 0, 1,174, 1, 0, 0,190, 1, 0, 0,172, 1, 0, 0,192, 1, 0, 0,
- 0, 0, 0, 1,155, 1, 0, 0,171, 1, 0, 0,191, 1, 0, 0,157, 1, 0, 0, 0, 0, 0, 1,192, 1, 0, 0,172, 1, 0, 0,
-156, 1, 0, 0,158, 1, 0, 0, 0, 0, 0, 1, 53, 1, 0, 0,189, 1, 0, 0,171, 1, 0, 0,123, 1, 0, 0, 0, 0, 0, 1,
-172, 1, 0, 0,190, 1, 0, 0, 54, 1, 0, 0,124, 1, 0, 0, 0, 0, 0, 1, 53, 1, 0, 0,183, 1, 0, 0,187, 1, 0, 0,
-189, 1, 0, 0, 0, 0, 0, 1,188, 1, 0, 0,184, 1, 0, 0, 54, 1, 0, 0,190, 1, 0, 0, 0, 0, 0, 1,183, 1, 0, 0,
-185, 1, 0, 0,187, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,188, 1, 0, 0,186, 1, 0, 0,184, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1,157, 1, 0, 0,191, 1, 0, 0,193, 1, 0, 0,217, 1, 0, 0, 0, 0, 0, 1,194, 1, 0, 0,192, 1, 0, 0,
-158, 1, 0, 0,218, 1, 0, 0, 0, 0, 0, 1,191, 1, 0, 0,173, 1, 0, 0,203, 1, 0, 0,193, 1, 0, 0, 0, 0, 0, 1,
-204, 1, 0, 0,174, 1, 0, 0,192, 1, 0, 0,194, 1, 0, 0, 0, 0, 0, 1,173, 1, 0, 0,175, 1, 0, 0,201, 1, 0, 0,
-203, 1, 0, 0, 0, 0, 0, 1,202, 1, 0, 0,176, 1, 0, 0,174, 1, 0, 0,204, 1, 0, 0, 0, 0, 0, 1,175, 1, 0, 0,
-177, 1, 0, 0,199, 1, 0, 0,201, 1, 0, 0, 0, 0, 0, 1,200, 1, 0, 0,178, 1, 0, 0,176, 1, 0, 0,202, 1, 0, 0,
- 0, 0, 0, 1,177, 1, 0, 0,179, 1, 0, 0,197, 1, 0, 0,199, 1, 0, 0, 0, 0, 0, 1,198, 1, 0, 0,180, 1, 0, 0,
-178, 1, 0, 0,200, 1, 0, 0, 0, 0, 0, 1,179, 1, 0, 0,181, 1, 0, 0,195, 1, 0, 0,197, 1, 0, 0, 0, 0, 0, 1,
-196, 1, 0, 0,182, 1, 0, 0,180, 1, 0, 0,198, 1, 0, 0, 0, 0, 0, 1,181, 1, 0, 0,159, 1, 0, 0,215, 1, 0, 0,
-195, 1, 0, 0, 0, 0, 0, 1,216, 1, 0, 0,160, 1, 0, 0,182, 1, 0, 0,196, 1, 0, 0, 0, 0, 0, 1,169, 1, 0, 0,
-157, 1, 0, 0,217, 1, 0, 0,205, 1, 0, 0, 0, 0, 0, 1,218, 1, 0, 0,158, 1, 0, 0,170, 1, 0, 0,206, 1, 0, 0,
- 0, 0, 0, 1,167, 1, 0, 0,169, 1, 0, 0,205, 1, 0, 0,207, 1, 0, 0, 0, 0, 0, 1,206, 1, 0, 0,170, 1, 0, 0,
-168, 1, 0, 0,208, 1, 0, 0, 0, 0, 0, 1,165, 1, 0, 0,167, 1, 0, 0,207, 1, 0, 0,209, 1, 0, 0, 0, 0, 0, 1,
-208, 1, 0, 0,168, 1, 0, 0,166, 1, 0, 0,210, 1, 0, 0, 0, 0, 0, 1,163, 1, 0, 0,165, 1, 0, 0,209, 1, 0, 0,
-211, 1, 0, 0, 0, 0, 0, 1,210, 1, 0, 0,166, 1, 0, 0,164, 1, 0, 0,212, 1, 0, 0, 0, 0, 0, 1,161, 1, 0, 0,
-163, 1, 0, 0,211, 1, 0, 0,213, 1, 0, 0, 0, 0, 0, 1,212, 1, 0, 0,164, 1, 0, 0,162, 1, 0, 0,214, 1, 0, 0,
- 0, 0, 0, 1,159, 1, 0, 0,161, 1, 0, 0,213, 1, 0, 0,215, 1, 0, 0, 0, 0, 0, 1,214, 1, 0, 0,162, 1, 0, 0,
-160, 1, 0, 0,216, 1, 0, 0, 0, 0, 0, 1,199, 1, 0, 0,197, 1, 0, 0,221, 1, 0, 0,219, 1, 0, 0, 0, 0, 0, 1,
-222, 1, 0, 0,198, 1, 0, 0,200, 1, 0, 0,220, 1, 0, 0, 0, 0, 0, 1,219, 1, 0, 0,221, 1, 0, 0,223, 1, 0, 0,
-225, 1, 0, 0, 0, 0, 0, 1,224, 1, 0, 0,222, 1, 0, 0,220, 1, 0, 0,226, 1, 0, 0, 0, 0, 0, 1,225, 1, 0, 0,
-223, 1, 0, 0,229, 1, 0, 0,227, 1, 0, 0, 0, 0, 0, 1,230, 1, 0, 0,224, 1, 0, 0,226, 1, 0, 0,228, 1, 0, 0,
- 0, 0, 0, 1,227, 1, 0, 0,229, 1, 0, 0,231, 1, 0, 0,233, 1, 0, 0, 0, 0, 0, 1,232, 1, 0, 0,230, 1, 0, 0,
-228, 1, 0, 0,234, 1, 0, 0, 0, 0, 0, 1,205, 1, 0, 0,217, 1, 0, 0,227, 1, 0, 0,233, 1, 0, 0, 0, 0, 0, 1,
-228, 1, 0, 0,218, 1, 0, 0,206, 1, 0, 0,234, 1, 0, 0, 0, 0, 0, 1,193, 1, 0, 0,225, 1, 0, 0,227, 1, 0, 0,
-217, 1, 0, 0, 0, 0, 0, 1,228, 1, 0, 0,226, 1, 0, 0,194, 1, 0, 0,218, 1, 0, 0, 0, 0, 0, 1,193, 1, 0, 0,
-203, 1, 0, 0,219, 1, 0, 0,225, 1, 0, 0, 0, 0, 0, 1,220, 1, 0, 0,204, 1, 0, 0,194, 1, 0, 0,226, 1, 0, 0,
- 0, 0, 0, 1,199, 1, 0, 0,219, 1, 0, 0,203, 1, 0, 0,201, 1, 0, 0, 0, 0, 0, 1,204, 1, 0, 0,220, 1, 0, 0,
-200, 1, 0, 0,202, 1, 0, 0, 0, 0, 0, 1,195, 1, 0, 0,215, 1, 0, 0,221, 1, 0, 0,197, 1, 0, 0, 0, 0, 0, 1,
-222, 1, 0, 0,216, 1, 0, 0,196, 1, 0, 0,198, 1, 0, 0, 0, 0, 0, 1,213, 1, 0, 0,223, 1, 0, 0,221, 1, 0, 0,
-215, 1, 0, 0, 0, 0, 0, 1,222, 1, 0, 0,224, 1, 0, 0,214, 1, 0, 0,216, 1, 0, 0, 0, 0, 0, 1,211, 1, 0, 0,
-229, 1, 0, 0,223, 1, 0, 0,213, 1, 0, 0, 0, 0, 0, 1,224, 1, 0, 0,230, 1, 0, 0,212, 1, 0, 0,214, 1, 0, 0,
- 0, 0, 0, 1,209, 1, 0, 0,231, 1, 0, 0,229, 1, 0, 0,211, 1, 0, 0, 0, 0, 0, 1,230, 1, 0, 0,232, 1, 0, 0,
-210, 1, 0, 0,212, 1, 0, 0, 0, 0, 0, 1,207, 1, 0, 0,233, 1, 0, 0,231, 1, 0, 0,209, 1, 0, 0, 0, 0, 0, 1,
-232, 1, 0, 0,234, 1, 0, 0,208, 1, 0, 0,210, 1, 0, 0, 0, 0, 0, 1,205, 1, 0, 0,233, 1, 0, 0,207, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 1,208, 1, 0, 0,234, 1, 0, 0,206, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,133, 1, 0, 0,
-131, 1, 0, 0,245, 1, 0, 0,243, 1, 0, 0, 0, 0, 0, 1,246, 1, 0, 0,132, 1, 0, 0,134, 1, 0, 0,244, 1, 0, 0,
- 0, 0, 0, 1,135, 1, 0, 0,133, 1, 0, 0,243, 1, 0, 0,241, 1, 0, 0, 0, 0, 0, 1,244, 1, 0, 0,134, 1, 0, 0,
-136, 1, 0, 0,242, 1, 0, 0, 0, 0, 0, 1,137, 1, 0, 0,135, 1, 0, 0,241, 1, 0, 0,239, 1, 0, 0, 0, 0, 0, 1,
-242, 1, 0, 0,136, 1, 0, 0,138, 1, 0, 0,240, 1, 0, 0, 0, 0, 0, 1,139, 1, 0, 0,137, 1, 0, 0,239, 1, 0, 0,
-237, 1, 0, 0, 0, 0, 0, 1,240, 1, 0, 0,138, 1, 0, 0,140, 1, 0, 0,238, 1, 0, 0, 0, 0, 0, 1,141, 1, 0, 0,
-139, 1, 0, 0,237, 1, 0, 0,235, 1, 0, 0, 0, 0, 0, 1,238, 1, 0, 0,140, 1, 0, 0,142, 1, 0, 0,236, 1, 0, 0,
- 0, 0, 0, 1,129, 1, 0, 0,141, 1, 0, 0,235, 1, 0, 0,247, 1, 0, 0, 0, 0, 0, 1,236, 1, 0, 0,142, 1, 0, 0,
-130, 1, 0, 0,248, 1, 0, 0, 0, 0, 0, 1,235, 1, 0, 0,243, 1, 0, 0,245, 1, 0, 0,247, 1, 0, 0, 0, 0, 0, 1,
-246, 1, 0, 0,244, 1, 0, 0,236, 1, 0, 0,248, 1, 0, 0, 0, 0, 0, 1,235, 1, 0, 0,237, 1, 0, 0,241, 1, 0, 0,
-243, 1, 0, 0, 0, 0, 0, 1,242, 1, 0, 0,238, 1, 0, 0,236, 1, 0, 0,244, 1, 0, 0, 0, 0, 0, 1,237, 1, 0, 0,
-239, 1, 0, 0,241, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,242, 1, 0, 0,240, 1, 0, 0,238, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 55, 1, 0, 0,123, 1, 0, 0,129, 1, 0, 0,247, 1, 0, 0, 0, 0, 0, 1,130, 1, 0, 0,124, 1, 0, 0,
- 56, 1, 0, 0,248, 1, 0, 0, 0, 0, 0, 1, 55, 1, 0, 0,247, 1, 0, 0,245, 1, 0, 0, 63, 1, 0, 0, 0, 0, 0, 1,
-246, 1, 0, 0,248, 1, 0, 0, 56, 1, 0, 0, 64, 1, 0, 0, 0, 0, 0, 1, 61, 1, 0, 0, 63, 1, 0, 0,245, 1, 0, 0,
-131, 1, 0, 0, 0, 0, 0, 1,246, 1, 0, 0, 64, 1, 0, 0, 62, 1, 0, 0,132, 1, 0, 0, 0, 0, 0, 1, 68, 65, 84, 65,
-192, 93, 0, 0, 16, 7,117, 1, 0, 0, 0, 0, 60, 0, 0, 0,244, 1, 0, 0, 3,112, 28, 63,185,178,236, 62,224,124, 27, 63,
-235, 65,232, 62,144, 63, 30, 63,233,195,226, 62,118,152, 32, 63, 37,167,236, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,240, 0, 2,232,209, 62,222, 21,226, 62,102,109,215, 62,222,147,231, 62, 28,135,213, 62,172, 4,236, 62, 56, 54,205, 62,
- 22,249,235, 62,208,217,115, 1, 0, 0, 0, 0, 61, 0, 5, 0, 0, 0,240, 0,118,152, 32, 63, 37,167,236, 62,144, 63, 30, 63,
-233,195,226, 62,108,235, 33, 63,197,235,220, 62,209,151, 37, 63, 89,161,236, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,240, 0, 76,144,202, 62,186, 61,220, 62, 2,232,209, 62,222, 21,226, 62, 56, 54,205, 62, 22,249,235, 62,128, 55,195, 62,
- 70,243,235, 62,208,217,115, 1, 0, 0, 0, 0, 61, 0, 5, 0, 0, 0,240, 0,144, 63, 30, 63,233,195,226, 62, 20, 55, 25, 63,
- 1, 35,223, 62,200,178, 25, 63, 77,233,214, 62,108,235, 33, 63,197,235,220, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,240, 0,146, 1,219, 62, 66, 59,214, 62,248,248,219, 62,246,116,222, 62, 2,232,209, 62,222, 21,226, 62, 76,144,202, 62,
-186, 61,220, 62,208,217,115, 1, 0, 0, 0, 0, 61, 0, 5, 0, 0, 0,240, 0,224,124, 27, 63,235, 65,232, 62, 87,252, 24, 63,
- 93,111,230, 62, 20, 55, 25, 63, 1, 35,223, 62,144, 63, 30, 63,233,195,226, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,240, 0,248,248,219, 62,246,116,222, 62,118,110,220, 62, 78,193,229, 62,102,109,215, 62,222,147,231, 62, 2,232,209, 62,
-222, 21,226, 62,208,217,115, 1, 0, 0, 0, 0, 61, 0, 5, 0, 0, 0,240, 0, 87,252, 24, 63, 93,111,230, 62, 22,195, 22, 63,
-195, 90,232, 62,191, 91, 20, 63,193, 18,227, 62, 20, 55, 25, 63, 1, 35,223, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,240, 0,162,175,229, 62,178,100,226, 62,248,224,224, 62,182,172,231, 62,118,110,220, 62, 78,193,229, 62,248,248,219, 62,
-246,116,222, 62,208,217,115, 1, 0, 0, 0, 0, 61, 0, 5, 0, 0, 0,240, 0, 20, 55, 25, 63, 1, 35,223, 62,191, 91, 20, 63,
-193, 18,227, 62,187,165, 17, 63,225, 6,221, 62,200,178, 25, 63, 77,233,214, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,240, 0,170, 27,235, 62,214, 88,220, 62,162,175,229, 62,178,100,226, 62,248,248,219, 62,246,116,222, 62,146, 1,219, 62,
- 66, 59,214, 62,208,217,115, 1, 0, 0, 0, 0, 61, 0, 5, 0, 0, 0,240, 0,191, 91, 20, 63,193, 18,227, 62,164, 18, 18, 63,
-173,201,236, 62,157,231, 13, 63, 89,161,236, 62,187,165, 17, 63,225, 6,221, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,240, 0,232,151,242, 62, 70,243,235, 62,216, 65,234, 62,158, 27,236, 62,162,175,229, 62,178,100,226, 62,170, 27,235, 62,
-214, 88,220, 62,208,217,115, 1, 0, 0, 0, 0, 61, 0, 5, 0, 0, 0,240, 0, 22,195, 22, 63,195, 90,232, 62, 11,202, 21, 63,
- 1,189,236, 62,164, 18, 18, 63,173,201,236, 62,191, 91, 20, 63,193, 18,227, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,240, 0,216, 65,234, 62,158, 27,236, 62, 12,211,226, 62,246, 14,236, 62,248,224,224, 62,182,172,231, 62,162,175,229, 62,
-178,100,226, 62,208,217,115, 1, 0, 0, 0, 0, 61, 0, 5, 0, 0, 0,240, 0, 11,202, 21, 63, 1,189,236, 62,215,202, 22, 63,
-237,124,241, 62,125,105, 20, 63, 1, 71,246, 62,164, 18, 18, 63,173,201,236, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,240, 0, 42,148,229, 62,246,152,245, 62,112,209,224, 62,226,206,240, 62, 12,211,226, 62,246, 14,236, 62,216, 65,234, 62,
-158, 27,236, 62,208,217,115, 1, 0, 0, 0, 0, 61, 0, 5, 0, 0, 0,240, 0,164, 18, 18, 63,173,201,236, 62,125,105, 20, 63,
- 1, 71,246, 62, 44,173, 17, 63,231,149,252, 62,157,231, 13, 63, 89,161,236, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,240, 0,206, 12,235, 62,218,231,251, 62, 42,148,229, 62,246,152,245, 62,216, 65,234, 62,158, 27,236, 62,232,151,242, 62,
- 70,243,235, 62,208,217,115, 1, 0, 0, 0, 0, 61, 0, 5, 0, 0, 0,240, 0,125,105, 20, 63, 1, 71,246, 62, 37, 59, 25, 63,
- 49, 73,250, 62,108,178, 25, 63,218,108, 1, 63, 44,173, 17, 63,231,149,252, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,240, 0, 76, 2,219, 62,213, 21, 1, 63,216,240,219, 62, 38,155,249, 62, 42,148,229, 62,246,152,245, 62,206, 12,235, 62,
-218,231,251, 62,208,217,115, 1, 0, 0, 0, 0, 61, 0, 5, 0, 0, 0,240, 0,215,202, 22, 63,237,124,241, 62,195, 1, 25, 63,
-169,102,243, 62, 37, 59, 25, 63, 49, 73,250, 62,125,105, 20, 63, 1, 71,246, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,240, 0,216,240,219, 62, 38,155,249, 62,156, 99,220, 62,154,184,242, 62,112,209,224, 62,226,206,240, 62, 42,148,229, 62,
-246,152,245, 62,208,217,115, 1, 0, 0, 0, 0, 61, 0, 5, 0, 0, 0,240, 0,195, 1, 25, 63,169,102,243, 62,176,125, 27, 63,
-149,145,241, 62,167, 74, 30, 63, 3,153,246, 62, 37, 59, 25, 63, 49, 73,250, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,240, 0,212,209,209, 62,246,234,245, 62,192,107,215, 62,138,227,240, 62,156, 99,220, 62,154,184,242, 62,216,240,219, 62,
- 38,155,249, 62,208,217,115, 1, 0, 0, 0, 0, 61, 0, 5, 0, 0, 0,240, 0, 37, 59, 25, 63, 49, 73,250, 62,167, 74, 30, 63,
- 3,153,246, 62,204,230, 33, 63,107,232,252, 62,108,178, 25, 63,218,108, 1, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,240, 0,132,153,202, 62, 94, 58,252, 62,212,209,209, 62,246,234,245, 62,216,240,219, 62, 38,155,249, 62, 76, 2,219, 62,
-213, 21, 1, 63,208,217,115, 1, 0, 0, 0, 0, 61, 0, 5, 0, 0, 0,240, 0,167, 74, 30, 63, 3,153,246, 62,118,152, 32, 63,
- 37,167,236, 62,209,151, 37, 63, 89,161,236, 62,204,230, 33, 63,107,232,252, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,240, 0,128, 55,195, 62, 70,243,235, 62, 56, 54,205, 62, 22,249,235, 62,212,209,209, 62,246,234,245, 62,132,153,202, 62,
- 94, 58,252, 62,208,217,115, 1, 0, 0, 0, 0, 61, 0, 5, 0, 0, 0,240, 0,176,125, 27, 63,149,145,241, 62, 3,112, 28, 63,
-185,178,236, 62,118,152, 32, 63, 37,167,236, 62,167, 74, 30, 63, 3,153,246, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,240, 0, 56, 54,205, 62, 22,249,235, 62, 28,135,213, 62,172, 4,236, 62,192,107,215, 62,138,227,240, 62,212,209,209, 62,
-246,234,245, 62,208,217,115, 1, 0, 0, 0, 0, 61, 0, 5, 0, 0, 0,240, 0, 3,112, 28, 63,185,178,236, 62,176,125, 27, 63,
-149,145,241, 62, 42, 39, 27, 63, 57, 1,241, 62,140,249, 27, 63,115,186,236, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,240, 0,206, 24,216, 62, 46, 83,240, 62,192,107,215, 62,138,227,240, 62, 28,135,213, 62,172, 4,236, 62, 8,116,214, 62,
-102, 12,236, 62,208,217,115, 1, 0, 0, 0, 0, 61, 0, 5, 0, 0, 0,240, 0,176,125, 27, 63,149,145,241, 62,195, 1, 25, 63,
-169,102,243, 62, 6,248, 24, 63,185, 91,242, 62, 42, 39, 27, 63, 57, 1,241, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,240, 0, 22,119,220, 62,174,173,241, 62,156, 99,220, 62,154,184,242, 62,192,107,215, 62,138,227,240, 62,206, 24,216, 62,
- 46, 83,240, 62,208,217,115, 1, 0, 0, 0, 0, 61, 0, 5, 0, 0, 0,240, 0,195, 1, 25, 63,169,102,243, 62,215,202, 22, 63,
-237,124,241, 62,157, 38, 23, 63,225,173,240, 62, 6,248, 24, 63,185, 91,242, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,240, 0,234, 25,224, 62,214,255,239, 62,112,209,224, 62,226,206,240, 62,156, 99,220, 62,154,184,242, 62, 22,119,220, 62,
-174,173,241, 62,208,217,115, 1, 0, 0, 0, 0, 61, 0, 5, 0, 0, 0,240, 0,215,202, 22, 63,237,124,241, 62, 11,202, 21, 63,
- 1,189,236, 62, 13, 89, 22, 63,247,196,236, 62,157, 38, 23, 63,225,173,240, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,240, 0, 8,181,225, 62,234, 22,236, 62, 12,211,226, 62,246, 14,236, 62,112,209,224, 62,226,206,240, 62,234, 25,224, 62,
-214,255,239, 62,208,217,115, 1, 0, 0, 0, 0, 61, 0, 5, 0, 0, 0,240, 0, 11,202, 21, 63, 1,189,236, 62, 22,195, 22, 63,
-195, 90,232, 62, 88, 33, 23, 63, 69, 47,233, 62, 13, 89, 22, 63,247,196,236, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,240, 0,112, 36,224, 62, 58,129,232, 62,248,224,224, 62,182,172,231, 62, 12,211,226, 62,246, 14,236, 62, 8,181,225, 62,
-234, 22,236, 62,208,217,115, 1, 0, 0, 0, 0, 61, 0, 5, 0, 0, 0,240, 0, 22,195, 22, 63,195, 90,232, 62, 87,252, 24, 63,
- 93,111,230, 62,100,243, 24, 63, 5,123,231, 62, 88, 33, 23, 63, 69, 47,233, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,240, 0, 90,128,220, 62,248,204,230, 62,118,110,220, 62, 78,193,229, 62,248,224,224, 62,182,172,231, 62,112, 36,224, 62,
- 58,129,232, 62,208,217,115, 1, 0, 0, 0, 0, 61, 0, 5, 0, 0, 0,240, 0, 87,252, 24, 63, 93,111,230, 62,224,124, 27, 63,
-235, 65,232, 62,169, 37, 27, 63, 35,211,232, 62,100,243, 24, 63, 5,123,231, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,240, 0,206, 27,216, 62, 22, 37,232, 62,102,109,215, 62,222,147,231, 62,118,110,220, 62, 78,193,229, 62, 90,128,220, 62,
-248,204,230, 62,208,217,115, 1, 0, 0, 0, 0, 61, 0, 5, 0, 0, 0,240, 0,224,124, 27, 63,235, 65,232, 62, 3,112, 28, 63,
-185,178,236, 62,140,249, 27, 63,115,186,236, 62,169, 37, 27, 63, 35,211,232, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,240, 0, 8,116,214, 62,102, 12,236, 62, 28,135,213, 62,172, 4,236, 62,102,109,215, 62,222,147,231, 62,206, 27,216, 62,
- 22, 37,232, 62,208,217,115, 1, 0, 0, 0, 0, 61, 0, 5, 0, 0, 0,240, 0,138,242, 24, 63, 21,194,236, 62,169, 37, 27, 63,
- 35,211,232, 62,140,249, 27, 63,115,186,236, 62, 0, 0,128, 63, 0, 0,128, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,112, 0, 8,116,214, 62,102, 12,236, 62,206, 27,216, 62, 22, 37,232, 62, 16,130,220, 62, 6, 20,236, 62, 0, 0,128, 63,
- 0, 0,128, 63,208,217,115, 1, 0, 0, 0, 0, 61, 0, 5, 0, 0, 0,112, 0,100,243, 24, 63, 5,123,231, 62,169, 37, 27, 63,
- 35,211,232, 62,138,242, 24, 63, 21,194,236, 62, 0, 0,128, 63, 0, 0,128, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,112, 0, 16,130,220, 62, 6, 20,236, 62,206, 27,216, 62, 22, 37,232, 62, 90,128,220, 62,248,204,230, 62, 0, 0,128, 63,
- 0, 0,128, 63,208,217,115, 1, 0, 0, 0, 0, 61, 0, 5, 0, 0, 0,112, 0,138,242, 24, 63, 21,194,236, 62, 88, 33, 23, 63,
- 69, 47,233, 62,100,243, 24, 63, 5,123,231, 62, 0, 0,128, 63, 0, 0,128, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,112, 0, 90,128,220, 62,248,204,230, 62,112, 36,224, 62, 58,129,232, 62, 16,130,220, 62, 6, 20,236, 62, 0, 0,128, 63,
- 0, 0,128, 63,208,217,115, 1, 0, 0, 0, 0, 61, 0, 5, 0, 0, 0,112, 0,138,242, 24, 63, 21,194,236, 62, 13, 89, 22, 63,
-247,196,236, 62, 88, 33, 23, 63, 69, 47,233, 62, 0, 0,128, 63, 0, 0,128, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,112, 0,112, 36,224, 62, 58,129,232, 62, 8,181,225, 62,234, 22,236, 62, 16,130,220, 62, 6, 20,236, 62, 0, 0,128, 63,
- 0, 0,128, 63,208,217,115, 1, 0, 0, 0, 0, 61, 0, 5, 0, 0, 0,112, 0,138,242, 24, 63, 21,194,236, 62,157, 38, 23, 63,
-225,173,240, 62, 13, 89, 22, 63,247,196,236, 62, 0, 0,128, 63, 0, 0,128, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,112, 0, 8,181,225, 62,234, 22,236, 62,234, 25,224, 62,214,255,239, 62, 16,130,220, 62, 6, 20,236, 62, 0, 0,128, 63,
- 0, 0,128, 63,208,217,115, 1, 0, 0, 0, 0, 61, 0, 5, 0, 0, 0,112, 0,138,242, 24, 63, 21,194,236, 62, 6,248, 24, 63,
-185, 91,242, 62,157, 38, 23, 63,225,173,240, 62, 0, 0,128, 63, 0, 0,128, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,112, 0,234, 25,224, 62,214,255,239, 62, 22,119,220, 62,174,173,241, 62, 16,130,220, 62, 6, 20,236, 62, 0, 0,128, 63,
- 0, 0,128, 63,208,217,115, 1, 0, 0, 0, 0, 61, 0, 5, 0, 0, 0,112, 0,138,242, 24, 63, 21,194,236, 62, 42, 39, 27, 63,
- 57, 1,241, 62, 6,248, 24, 63,185, 91,242, 62, 0, 0,128, 63, 0, 0,128, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,112, 0, 22,119,220, 62,174,173,241, 62,206, 24,216, 62, 46, 83,240, 62, 16,130,220, 62, 6, 20,236, 62, 0, 0,128, 63,
- 0, 0,128, 63,208,217,115, 1, 0, 0, 0, 0, 61, 0, 5, 0, 0, 0,112, 0,138,242, 24, 63, 21,194,236, 62,140,249, 27, 63,
-115,186,236, 62, 42, 39, 27, 63, 57, 1,241, 62, 0, 0,128, 63, 0, 0,128, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,112, 0,206, 24,216, 62, 46, 83,240, 62, 8,116,214, 62,102, 12,236, 62, 16,130,220, 62, 6, 20,236, 62, 0, 0,128, 63,
- 0, 0,128, 63,208,217,115, 1, 0, 0, 0, 0, 61, 0, 5, 0, 0, 0,112, 0,174,254, 16, 63, 94, 45, 34, 62, 79,190, 13, 63,
-160,193, 46, 62,220,199, 3, 63, 89,219, 24, 62,219,199, 3, 63, 18, 28,229, 61,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 16, 0,220,199, 3, 63, 89,219, 24, 62, 14,150,243, 62,204, 79, 47, 62,140,248,236, 62,182,202, 34, 62,219,199, 3, 63,
- 18, 28,229, 61,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 64, 0,184,152, 21, 63,182, 47, 53, 62,250,104, 16, 63,
- 16,113, 55, 62, 79,190, 13, 63,160,193, 46, 62,174,254, 16, 63, 94, 45, 34, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,128, 0, 14,150,243, 62,204, 79, 47, 62,200, 68,238, 62, 76, 62, 56, 62,183,207,227, 62,250, 75, 54, 62,140,248,236, 62,
-182,202, 34, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0,128, 0,137, 57, 22, 63, 81, 93, 61, 62,206,186, 16, 63,
- 85,129, 72, 62,250,104, 16, 63, 16,113, 55, 62,184,152, 21, 63,182, 47, 53, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,200, 68,238, 62, 76, 62, 56, 62,192,187,237, 62,194,118, 73, 62,122,152,226, 62,190,166, 62, 62,183,207,227, 62,
-250, 75, 54, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,250,249, 22, 63,160,251, 88, 62,222, 32, 16, 63,
- 34,106, 93, 62,206,186, 16, 63, 85,129, 72, 62,137, 57, 22, 63, 81, 93, 61, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,192,187,237, 62,194,118, 73, 62, 21, 19,239, 62,121,110, 94, 62, 90, 83,225, 62, 21,153, 90, 62,122,152,226, 62,
-190,166, 62, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 20, 81, 25, 63, 17, 56,132, 62,206,243, 15, 63,
-182,207,136, 62,222, 32, 16, 63, 34,106, 93, 62,250,249, 22, 63,160,251, 88, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 21, 19,239, 62,121,110, 94, 62, 92,193,239, 62,113, 61,137, 62, 54, 42,221, 62,209, 25,133, 62, 90, 83,225, 62,
- 21,153, 90, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,111,239, 27, 63,159, 77,166, 62, 91, 94, 37, 63,
-107,120,187, 62, 66, 21, 30, 63,178,139,200, 62,158,237, 12, 63, 38,241,187, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,139,125,211, 62,170,171,200, 62,156, 28,197, 62,166,130,187, 62,115, 21,216, 62, 14,177,166, 62, 15,175,245, 62,
-188, 14,188, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 91, 94, 37, 63,107,120,187, 62, 87, 57, 43, 63,
-222, 58,206, 62, 24,163, 39, 63,174, 95,216, 62, 66, 21, 30, 63,178,139,200, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 98,194,191, 62, 42, 94,216, 62,130,207,184, 62, 42, 27,206, 62,156, 28,197, 62,166,130,187, 62,139,125,211, 62,
-170,171,200, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 87, 57, 43, 63,222, 58,206, 62, 38,229, 50, 63,
-169, 32,226, 62,177, 79, 43, 63,202,194,231, 62, 24,163, 39, 63,174, 95,216, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 60,201,183, 62, 82,218,231, 62,196, 39,168, 62,206, 11,226, 62,130,207,184, 62, 42, 27,206, 62, 98,194,191, 62,
- 42, 94,216, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 38,229, 50, 63,169, 32,226, 62, 62,134, 48, 63,
- 37,107,249, 62,154,190, 43, 63,192, 0,249, 62,177, 79, 43, 63,202,194,231, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,138,190,182, 62, 35, 49,249, 62,172,229,172, 62,116,127,249, 62,196, 39,168, 62,206, 11,226, 62, 60,201,183, 62,
- 82,218,231, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 62,134, 48, 63, 37,107,249, 62,238, 88, 46, 63,
-146,223, 2, 63,123,207, 40, 63,218,175,254, 62,154,190, 43, 63,192, 0,249, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 2,184,188, 62,140, 0,255, 62,173, 87,177, 62,102, 9, 3, 63,172,229,172, 62,116,127,249, 62,138,190,182, 62,
- 35, 49,249, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,238, 88, 46, 63,146,223, 2, 63,220,158, 34, 63,
-175, 23, 10, 63,126, 77, 30, 63,156, 88, 5, 63,123,207, 40, 63,218,175,254, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 89, 65,210, 62, 56,158, 5, 63,124,109,201, 62, 72,121, 10, 63,173, 87,177, 62,102, 9, 3, 63, 2,184,188, 62,
-140, 0,255, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,220,158, 34, 63,175, 23, 10, 63, 28,105, 26, 63,
-242,194, 11, 63,244,120, 25, 63, 78,242, 7, 63,126, 77, 30, 63,156, 88, 5, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 0, 39,220, 62,252, 58, 8, 63,220, 73,218, 62,169, 31, 12, 63,124,109,201, 62, 72,121, 10, 63, 89, 65,210, 62,
- 56,158, 5, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 28,105, 26, 63,242,194, 11, 63,173,244, 22, 63,
-236,215, 11, 63,202, 47, 22, 63,156, 60, 8, 63,244,120, 25, 63, 78,242, 7, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 11,221,226, 62, 90,125, 8, 63,220, 89,225, 62, 77, 42, 12, 63,220, 73,218, 62,169, 31, 12, 63, 0, 39,220, 62,
-252, 58, 8, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,173,244, 22, 63,236,215, 11, 63, 67,169, 11, 63,
- 18,197, 11, 63,106,252, 12, 63,180,173, 3, 63,202, 47, 22, 63,156, 60, 8, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 35,114,245, 62,233,196, 3, 63, 55, 72,248, 62, 91,232, 11, 63,220, 89,225, 62, 77, 42, 12, 63, 11,221,226, 62,
- 90,125, 8, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 67,169, 11, 63, 18,197, 11, 63,148,232, 3, 63,
-164, 17, 11, 63,162,220, 3, 63, 45, 88, 0, 63,106,252, 12, 63,180,173, 3, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,162,220, 3, 63, 45, 88, 0, 63,148,232, 3, 63,164, 17, 11, 63, 55, 72,248, 62, 91,232, 11, 63, 35,114,245, 62,
-233,196, 3, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,103, 59, 17, 63,120,195,255, 62,240, 81, 22, 63,
-114, 70, 1, 63,202, 47, 22, 63,156, 60, 8, 63,106,252, 12, 63,180,173, 3, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 11,221,226, 62, 90,125, 8, 63,106,128,226, 62,198,111, 1, 63,209,213,236, 62, 4,250,255, 62, 35,114,245, 62,
-233,196, 3, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,240, 81, 22, 63,114, 70, 1, 63,151,182, 25, 63,
-130, 9, 1, 63,244,120, 25, 63, 78,242, 7, 63,202, 47, 22, 63,156, 60, 8, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 0, 39,220, 62,252, 58, 8, 63,213,150,219, 62, 50, 55, 1, 63,106,128,226, 62,198,111, 1, 63, 11,221,226, 62,
- 90,125, 8, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 96, 49, 30, 63,121,229,254, 62,126, 77, 30, 63,
-156, 88, 5, 63,244,120, 25, 63, 78,242, 7, 63,151,182, 25, 63,130, 9, 1, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 0, 39,220, 62,252, 58, 8, 63, 89, 65,210, 62, 56,158, 5, 63,176,116,210, 62,227, 62,255, 62,213,150,219, 62,
- 50, 55, 1, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 25,113, 37, 63, 35,157,247, 62,123,207, 40, 63,
-218,175,254, 62,126, 77, 30, 63,156, 88, 5, 63, 96, 49, 30, 63,121,229,254, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 89, 65,210, 62, 56,158, 5, 63, 2,184,188, 62,140, 0,255, 62,189,165,195, 62,139,232,247, 62,176,116,210, 62,
-227, 62,255, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 92, 62, 39, 63,121, 75,240, 62,154,190, 43, 63,
-192, 0,249, 62,123,207, 40, 63,218,175,254, 62, 25,113, 37, 63, 35,157,247, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 2,184,188, 62,140, 0,255, 62,138,190,182, 62, 35, 49,249, 62,222, 10,192, 62,163,128,240, 62,189,165,195, 62,
-139,232,247, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,140,149, 38, 63, 38, 95,229, 62,177, 79, 43, 63,
-202,194,231, 62,154,190, 43, 63,192, 0,249, 62, 92, 62, 39, 63,121, 75,240, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,138,190,182, 62, 35, 49,249, 62, 60,201,183, 62, 82,218,231, 62,168,140,193, 62, 94,129,229, 62,222, 10,192, 62,
-163,128,240, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 14,120, 33, 63,166,238,214, 62, 24,163, 39, 63,
-174, 95,216, 62,177, 79, 43, 63,202,194,231, 62,140,149, 38, 63, 38, 95,229, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 60,201,183, 62, 82,218,231, 62, 98,194,191, 62, 42, 94,216, 62,168, 75,204, 62, 62, 7,215, 62,168,140,193, 62,
- 94,129,229, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,165,178, 27, 63,128, 17,208, 62, 66, 21, 30, 63,
-178,139,200, 62, 24,163, 39, 63,174, 95,216, 62, 14,120, 33, 63,166,238,214, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 98,194,191, 62, 42, 94,216, 62,139,125,211, 62,170,171,200, 62, 6, 24,216, 62,128, 57,208, 62,168, 75,204, 62,
- 62, 7,215, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 15, 97, 17, 63,220, 34,214, 62,158,237, 12, 63,
- 38,241,187, 62, 66, 21, 30, 63,178,139,200, 62,165,178, 27, 63,128, 17,208, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,139,125,211, 62,170,171,200, 62, 15,175,245, 62,188, 14,188, 62,217,200,236, 62,134, 49,214, 62, 6, 24,216, 62,
-128, 57,208, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 15, 97, 17, 63,220, 34,214, 62,149,244, 14, 63,
- 4, 42,221, 62,147,230, 3, 63, 78, 47,208, 62,158,237, 12, 63, 38,241,187, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,147,230, 3, 63, 78, 47,208, 62,141,144,241, 62,244, 52,221, 62,217,200,236, 62,134, 49,214, 62, 15,175,245, 62,
-188, 14,188, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,103, 59, 17, 63,120,195,255, 62,106,252, 12, 63,
-180,173, 3, 63,162,220, 3, 63, 45, 88, 0, 63, 71, 25, 13, 63,116,163,243, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,162,220, 3, 63, 45, 88, 0, 63, 35,114,245, 62,233,196, 3, 63,209,213,236, 62, 4,250,255, 62, 0, 45,245, 62,
-206,185,243, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 71, 25, 13, 63,116,163,243, 62,162,220, 3, 63,
- 45, 88, 0, 63,215,220, 3, 63,148,189,231, 62, 64, 2, 13, 63, 52,215,230, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,215,220, 3, 63,148,189,231, 62,162,220, 3, 63, 45, 88, 0, 63, 0, 45,245, 62,206,185,243, 62,219,100,245, 62,
-184,230,230, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,147,230, 3, 63, 78, 47,208, 62,149,244, 14, 63,
- 4, 42,221, 62, 64, 2, 13, 63, 52,215,230, 62,215,220, 3, 63,148,189,231, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,219,100,245, 62,184,230,230, 62,141,144,241, 62,244, 52,221, 62,147,230, 3, 63, 78, 47,208, 62,215,220, 3, 63,
-148,189,231, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,250, 61, 7, 63,148, 31, 54, 62,193,202, 3, 63,
-214,174, 49, 62,220,199, 3, 63, 89,219, 24, 62, 79,190, 13, 63,160,193, 46, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,220,199, 3, 63, 89,219, 24, 62,193,202, 3, 63,214,174, 49, 62,175, 87, 0, 63,251, 90, 54, 62, 14,150,243, 62,
-204, 79, 47, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 68,214, 9, 63,246,237, 66, 62,250, 61, 7, 63,
-148, 31, 54, 62, 79,190, 13, 63,160,193, 46, 62,250,104, 16, 63, 16,113, 55, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 14,150,243, 62,204, 79, 47, 62,175, 87, 0, 63,251, 90, 54, 62,104,137,251, 62,179, 92, 67, 62,200, 68,238, 62,
- 76, 62, 56, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,237,221, 8, 63,218, 90, 91, 62, 68,214, 9, 63,
-246,237, 66, 62,250,104, 16, 63, 16,113, 55, 62,206,186, 16, 63, 85,129, 72, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,200, 68,238, 62, 76, 62, 56, 62,104,137,251, 62,179, 92, 67, 62, 39,153,253, 62, 27,195, 91, 62,192,187,237, 62,
-194,118, 73, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,206,243, 15, 63,182,207,136, 62, 77, 32, 8, 63,
- 10, 39,139, 62, 22,117, 9, 63,146,203, 97, 62,222, 32, 16, 63, 34,106, 93, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,192,110,252, 62, 79, 68, 98, 62,219, 89,255, 62,116, 79,139, 62, 92,193,239, 62,113, 61,137, 62, 21, 19,239, 62,
-121,110, 94, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,237,221, 8, 63,218, 90, 91, 62,206,186, 16, 63,
- 85,129, 72, 62,222, 32, 16, 63, 34,106, 93, 62, 22,117, 9, 63,146,203, 97, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 21, 19,239, 62,121,110, 94, 62,192,187,237, 62,194,118, 73, 62, 39,153,253, 62, 27,195, 91, 62,192,110,252, 62,
- 79, 68, 98, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,119,125, 9, 63, 7,112,158, 62, 70,233, 3, 63,
- 88, 27,154, 62,235,229, 3, 63, 97,108,139, 62, 77, 32, 8, 63, 10, 39,139, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,235,229, 3, 63, 97,108,139, 62, 70,233, 3, 63, 88, 27,154, 62,165,179,252, 62,163,140,158, 62,219, 89,255, 62,
-116, 79,139, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 22,117, 9, 63,146,203, 97, 62, 77, 32, 8, 63,
- 10, 39,139, 62,235,229, 3, 63, 97,108,139, 62,246,215, 3, 63,143, 56,101, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,235,229, 3, 63, 97,108,139, 62,219, 89,255, 62,116, 79,139, 62,192,110,252, 62, 79, 68, 98, 62,246,215, 3, 63,
-143, 56,101, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,147,210, 3, 63,221, 95, 86, 62,237,221, 8, 63,
-218, 90, 91, 62, 22,117, 9, 63,146,203, 97, 62,246,215, 3, 63,143, 56,101, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,192,110,252, 62, 79, 68, 98, 62, 39,153,253, 62, 27,195, 91, 62,147,210, 3, 63,221, 95, 86, 62,246,215, 3, 63,
-143, 56,101, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 5, 54, 12, 63,188,183,167, 62,250, 61, 9, 63,
-252,214,168, 62,152,143, 8, 63, 45,107,163, 62,119,125, 9, 63, 7,112,158, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,100,136,254, 62, 38,123,163, 62,110, 39,253, 62,103,224,168, 62, 98, 68,247, 62,146,206,167, 62,165,179,252, 62,
-163,140,158, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,135,196, 10, 63, 52,208,178, 62, 25,233, 8, 63,
-116,110,175, 62,250, 61, 9, 63,252,214,168, 62, 5, 54, 12, 63,188,183,167, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,110, 39,253, 62,103,224,168, 62,102,195,253, 62,184,102,175, 62, 98, 14,250, 62,149,202,178, 62, 98, 68,247, 62,
-146,206,167, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 69, 17, 4, 63,105,176,182, 62, 69,138, 6, 63,
- 80,180,177, 62, 25,233, 8, 63,116,110,175, 62,135,196, 10, 63, 52,208,178, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,102,195,253, 62,184,102,175, 62, 14, 49, 1, 63, 62,150,177, 62, 69, 17, 4, 63,105,176,182, 62, 98, 14,250, 62,
-149,202,178, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,209,124, 3, 63, 70, 0,177, 62, 11,232, 3, 63,
-140, 4,174, 62, 69,138, 6, 63, 80,180,177, 62, 69, 17, 4, 63,105,176,182, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 14, 49, 1, 63, 62,150,177, 62, 11,232, 3, 63,140, 4,174, 62,209,124, 3, 63, 70, 0,177, 62, 69, 17, 4, 63,
-105,176,182, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 70,233, 3, 63, 88, 27,154, 62,119,125, 9, 63,
- 7,112,158, 62,152,143, 8, 63, 45,107,163, 62,212,232, 3, 63, 58,152,158, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,100,136,254, 62, 38,123,163, 62,165,179,252, 62,163,140,158, 62, 70,233, 3, 63, 88, 27,154, 62,212,232, 3, 63,
- 58,152,158, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,212,232, 3, 63, 58,152,158, 62,152,143, 8, 63,
- 45,107,163, 62,121, 91, 7, 63,134, 51,166, 62,205,231, 3, 63, 58,149,162, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 44,116, 0, 63,255, 56,166, 62,100,136,254, 62, 38,123,163, 62,212,232, 3, 63, 58,152,158, 62,205,231, 3, 63,
- 58,149,162, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 11,232, 3, 63,140, 4,174, 62,214,233, 3, 63,
-198,154,170, 62,233,110, 6, 63, 94,152,174, 62, 69,138, 6, 63, 80,180,177, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,228, 82, 1, 63, 95,140,174, 62,214,233, 3, 63,198,154,170, 62, 11,232, 3, 63,140, 4,174, 62, 14, 49, 1, 63,
- 62,150,177, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 69,138, 6, 63, 80,180,177, 62,233,110, 6, 63,
- 94,152,174, 62, 59,236, 7, 63, 19,123,173, 62, 25,233, 8, 63,116,110,175, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,217,185,255, 62, 92,116,173, 62,228, 82, 1, 63, 95,140,174, 62, 14, 49, 1, 63, 62,150,177, 62,102,195,253, 62,
-184,102,175, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 25,233, 8, 63,116,110,175, 62, 59,236, 7, 63,
- 19,123,173, 62, 85,249, 7, 63, 92, 52,169, 62,250, 61, 9, 63,252,214,168, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,160,169,255, 62, 6, 57,169, 62,217,185,255, 62, 92,116,173, 62,102,195,253, 62,184,102,175, 62,110, 39,253, 62,
-103,224,168, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,250, 61, 9, 63,252,214,168, 62, 85,249, 7, 63,
- 92, 52,169, 62,121, 91, 7, 63,134, 51,166, 62,152,143, 8, 63, 45,107,163, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 44,116, 0, 63,255, 56,166, 62,160,169,255, 62, 6, 57,169, 62,110, 39,253, 62,103,224,168, 62,100,136,254, 62,
- 38,123,163, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,214,233, 3, 63,198,154,170, 62, 85,249, 7, 63,
- 92, 52,169, 62, 59,236, 7, 63, 19,123,173, 62,233,110, 6, 63, 94,152,174, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,217,185,255, 62, 92,116,173, 62,160,169,255, 62, 6, 57,169, 62,214,233, 3, 63,198,154,170, 62,228, 82, 1, 63,
- 95,140,174, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,214,233, 3, 63,198,154,170, 62,205,231, 3, 63,
- 58,149,162, 62,121, 91, 7, 63,134, 51,166, 62, 85,249, 7, 63, 92, 52,169, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 44,116, 0, 63,255, 56,166, 62,205,231, 3, 63, 58,149,162, 62,214,233, 3, 63,198,154,170, 62,160,169,255, 62,
- 6, 57,169, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 69, 17, 4, 63,105,176,182, 62,135,196, 10, 63,
- 52,208,178, 62,158,237, 12, 63, 38,241,187, 62,147,230, 3, 63, 78, 47,208, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 15,175,245, 62,188, 14,188, 62, 98, 14,250, 62,149,202,178, 62, 69, 17, 4, 63,105,176,182, 62,147,230, 3, 63,
- 78, 47,208, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,135,196, 10, 63, 52,208,178, 62, 5, 54, 12, 63,
-188,183,167, 62,112, 0, 16, 63,254,246,164, 62,158,237, 12, 63, 38,241,187, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,207,187,239, 62, 19, 42,165, 62, 98, 68,247, 62,146,206,167, 62, 98, 14,250, 62,149,202,178, 62, 15,175,245, 62,
-188, 14,188, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 5, 54, 12, 63,188,183,167, 62,119,125, 9, 63,
- 7,112,158, 62, 44,250, 15, 63,109, 0,154, 62,112, 0, 16, 63,254,246,164, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 56,205,239, 62, 8, 71,154, 62,165,179,252, 62,163,140,158, 62, 98, 68,247, 62,146,206,167, 62,207,187,239, 62,
- 19, 42,165, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,119,125, 9, 63, 7,112,158, 62, 77, 32, 8, 63,
- 10, 39,139, 62,206,243, 15, 63,182,207,136, 62, 44,250, 15, 63,109, 0,154, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 92,193,239, 62,113, 61,137, 62,219, 89,255, 62,116, 79,139, 62,165,179,252, 62,163,140,158, 62, 56,205,239, 62,
- 8, 71,154, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 20, 81, 25, 63, 17, 56,132, 62,208, 46, 27, 63,
-149, 35,148, 62, 44,250, 15, 63,109, 0,154, 62,206,243, 15, 63,182,207,136, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 56,205,239, 62, 8, 71,154, 62,238,166,217, 62,229,221,148, 62, 54, 42,221, 62,209, 25,133, 62, 92,193,239, 62,
-113, 61,137, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,208, 46, 27, 63,149, 35,148, 62, 36,177, 27, 63,
-158,151,156, 62,112, 0, 16, 63,254,246,164, 62, 44,250, 15, 63,109, 0,154, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,207,187,239, 62, 19, 42,165, 62, 0,160,216, 62,127, 44,157, 62,238,166,217, 62,229,221,148, 62, 56,205,239, 62,
- 8, 71,154, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,111,239, 27, 63,159, 77,166, 62,158,237, 12, 63,
- 38,241,187, 62,112, 0, 16, 63,254,246,164, 62, 36,177, 27, 63,158,151,156, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,207,187,239, 62, 19, 42,165, 62, 15,175,245, 62,188, 14,188, 62,115, 21,216, 62, 14,177,166, 62, 0,160,216, 62,
-127, 44,157, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,237,221, 8, 63,218, 90, 91, 62,147,210, 3, 63,
-221, 95, 86, 62,129,211, 3, 63,248,168, 83, 62,170, 33, 8, 63,254,149, 86, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,129,211, 3, 63,248,168, 83, 62,147,210, 3, 63,221, 95, 86, 62, 39,153,253, 62, 27,195, 91, 62, 8, 14,255, 62,
- 58,232, 86, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 68,214, 9, 63,246,237, 66, 62,237,221, 8, 63,
-218, 90, 91, 62,170, 33, 8, 63,254,149, 86, 62, 20,180, 8, 63, 94, 29, 69, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 8, 14,255, 62, 58,232, 86, 62, 39,153,253, 62, 27,195, 91, 62,104,137,251, 62,179, 92, 67, 62, 19,210,253, 62,
- 55,114, 69, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,250, 61, 7, 63,148, 31, 54, 62, 68,214, 9, 63,
-246,237, 66, 62, 20,180, 8, 63, 94, 29, 69, 62,168, 82, 6, 63, 80, 43, 57, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 19,210,253, 62, 55,114, 69, 62,104,137,251, 62,179, 92, 67, 62,175, 87, 0, 63,251, 90, 54, 62, 48, 68, 1, 63,
-166, 84, 57, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,193,202, 3, 63,214,174, 49, 62,250, 61, 7, 63,
-148, 31, 54, 62,168, 82, 6, 63, 80, 43, 57, 62,205,202, 3, 63, 8, 22, 54, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 48, 68, 1, 63,166, 84, 57, 62,175, 87, 0, 63,251, 90, 54, 62,193,202, 3, 63,214,174, 49, 62,205,202, 3, 63,
- 8, 22, 54, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,205,202, 3, 63, 8, 22, 54, 62,168, 82, 6, 63,
- 80, 43, 57, 62,246, 24, 5, 63, 26,150, 66, 62,213,205, 3, 63,220,232, 64, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 29,131, 2, 63, 22,172, 66, 62, 48, 68, 1, 63,166, 84, 57, 62,205,202, 3, 63, 8, 22, 54, 62,213,205, 3, 63,
-220,232, 64, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,168, 82, 6, 63, 80, 43, 57, 62, 20,180, 8, 63,
- 94, 29, 69, 62, 39, 83, 6, 63,191,114, 70, 62,246, 24, 5, 63, 26,150, 66, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,185, 75, 1, 63,222,160, 70, 62, 19,210,253, 62, 55,114, 69, 62, 48, 68, 1, 63,166, 84, 57, 62, 29,131, 2, 63,
- 22,172, 66, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 20,180, 8, 63, 94, 29, 69, 62,170, 33, 8, 63,
-254,149, 86, 62, 4,111, 6, 63, 40,172, 76, 62, 39, 83, 6, 63,191,114, 70, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,157, 51, 1, 63,158,218, 76, 62, 8, 14,255, 62, 58,232, 86, 62, 19,210,253, 62, 55,114, 69, 62,185, 75, 1, 63,
-222,160, 70, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,170, 33, 8, 63,254,149, 86, 62,129,211, 3, 63,
-248,168, 83, 62,234,208, 3, 63,146, 43, 75, 62, 4,111, 6, 63, 40,172, 76, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,234,208, 3, 63,146, 43, 75, 62,129,211, 3, 63,248,168, 83, 62, 8, 14,255, 62, 58,232, 86, 62,157, 51, 1, 63,
-158,218, 76, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,234,208, 3, 63,146, 43, 75, 62,213,205, 3, 63,
-220,232, 64, 62,246, 24, 5, 63, 26,150, 66, 62, 4,111, 6, 63, 40,172, 76, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 29,131, 2, 63, 22,172, 66, 62,213,205, 3, 63,220,232, 64, 62,234,208, 3, 63,146, 43, 75, 62,157, 51, 1, 63,
-158,218, 76, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 4,111, 6, 63, 40,172, 76, 62,246, 24, 5, 63,
- 26,150, 66, 62, 39, 83, 6, 63,191,114, 70, 62, 0, 0,128, 63, 0, 0,128, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,185, 75, 1, 63,222,160, 70, 62, 29,131, 2, 63, 22,172, 66, 62,157, 51, 1, 63,158,218, 76, 62, 0, 0,128, 63,
- 0, 0,128, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 64, 2, 13, 63, 52,215,230, 62,149,244, 14, 63,
- 4, 42,221, 62, 4,216, 16, 63,160, 24,224, 62,120,200, 15, 63, 84,255,231, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,119,193,237, 62,190, 38,224, 62,141,144,241, 62,244, 52,221, 62,219,100,245, 62,184,230,230, 62, 21,211,239, 62,
-185, 18,232, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 71, 25, 13, 63,116,163,243, 62, 64, 2, 13, 63,
- 52,215,230, 62,120,200, 15, 63, 84,255,231, 62,184,171, 16, 63, 40,133,241, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 21,211,239, 62,185, 18,232, 62,219,100,245, 62,184,230,230, 62, 0, 45,245, 62,206,185,243, 62,218,252,237, 62,
- 62,160,241, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,103, 59, 17, 63,120,195,255, 62, 71, 25, 13, 63,
-116,163,243, 62,184,171, 16, 63, 40,133,241, 62, 55, 44, 19, 63, 86, 21,250, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,218,252,237, 62, 62,160,241, 62, 0, 45,245, 62,206,185,243, 62,209,213,236, 62, 4,250,255, 62,153,228,232, 62,
-154, 67,250, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,149,244, 14, 63, 4, 42,221, 62, 15, 97, 17, 63,
-220, 34,214, 62,217, 53, 19, 63, 16,211,218, 62, 4,216, 16, 63,160, 24,224, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 8, 14,233, 62, 66,226,218, 62,217,200,236, 62,134, 49,214, 62,141,144,241, 62,244, 52,221, 62,119,193,237, 62,
-190, 38,224, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 15, 97, 17, 63,220, 34,214, 62,165,178, 27, 63,
-128, 17,208, 62,205,198, 26, 63,124,184,214, 62,217, 53, 19, 63, 16,211,218, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,216,214,217, 62,218,224,214, 62, 6, 24,216, 62,128, 57,208, 62,217,200,236, 62,134, 49,214, 62, 8, 14,233, 62,
- 66,226,218, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,165,178, 27, 63,128, 17,208, 62, 14,120, 33, 63,
-166,238,214, 62,156,136, 31, 63,194,138,219, 62,205,198, 26, 63,124,184,214, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,254, 30,208, 62,204,177,219, 62,168, 75,204, 62, 62, 7,215, 62, 6, 24,216, 62,128, 57,208, 62,216,214,217, 62,
-218,224,214, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 14,120, 33, 63,166,238,214, 62,140,149, 38, 63,
- 38, 95,229, 62, 79, 9, 36, 63, 94,224,229, 62,156,136, 31, 63,194,138,219, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,148,192,198, 62,182, 11,230, 62,168,140,193, 62, 94,129,229, 62,168, 75,204, 62, 62, 7,215, 62,254, 30,208, 62,
-204,177,219, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,140,149, 38, 63, 38, 95,229, 62, 92, 62, 39, 63,
-121, 75,240, 62, 14, 49, 36, 63,253, 88,239, 62, 79, 9, 36, 63, 94,224,229, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 97, 71,198, 62,192,149,239, 62,222, 10,192, 62,163,128,240, 62,168,140,193, 62, 94,129,229, 62,148,192,198, 62,
-182, 11,230, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 92, 62, 39, 63,121, 75,240, 62, 25,113, 37, 63,
- 35,157,247, 62,243, 33, 35, 63, 80,143,245, 62, 14, 49, 36, 63,253, 88,239, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 87, 99,200, 62,172,217,245, 62,189,165,195, 62,139,232,247, 62,222, 10,192, 62,163,128,240, 62, 97, 71,198, 62,
-192,149,239, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 25,113, 37, 63, 35,157,247, 62, 96, 49, 30, 63,
-121,229,254, 62,223, 49, 29, 63,199,140,250, 62,243, 33, 35, 63, 80,143,245, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,147,124,212, 62,146,215,250, 62,176,116,210, 62,227, 62,255, 62,189,165,195, 62,139,232,247, 62, 87, 99,200, 62,
-172,217,245, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 96, 49, 30, 63,121,229,254, 62,151,182, 25, 63,
-130, 9, 1, 63, 50,181, 25, 63,118,111,253, 62,223, 49, 29, 63,199,140,250, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 52,151,219, 62, 68,186,253, 62,213,150,219, 62, 50, 55, 1, 63,176,116,210, 62,227, 62,255, 62,147,124,212, 62,
-146,215,250, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,151,182, 25, 63,130, 9, 1, 63,240, 81, 22, 63,
-114, 70, 1, 63,241,188, 22, 63, 28,149,253, 62, 50,181, 25, 63,118,111,253, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,212,163,225, 62, 91,215,253, 62,106,128,226, 62,198,111, 1, 63,213,150,219, 62, 50, 55, 1, 63, 52,151,219, 62,
- 68,186,253, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,240, 81, 22, 63,114, 70, 1, 63,103, 59, 17, 63,
-120,195,255, 62, 55, 44, 19, 63, 86, 21,250, 62,241,188, 22, 63, 28,149,253, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,153,228,232, 62,154, 67,250, 62,209,213,236, 62, 4,250,255, 62,106,128,226, 62,198,111, 1, 63,212,163,225, 62,
- 91,215,253, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,241,188, 22, 63, 28,149,253, 62, 55, 44, 19, 63,
- 86, 21,250, 62, 9,165, 20, 63,248, 99,247, 62, 20, 0, 23, 63, 6, 57,251, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,232,232,229, 62, 74,142,247, 62,153,228,232, 62,154, 67,250, 62,212,163,225, 62, 91,215,253, 62,145, 26,225, 62,
-114,116,251, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 50,181, 25, 63,118,111,253, 62,241,188, 22, 63,
- 28,149,253, 62, 20, 0, 23, 63, 6, 57,251, 62,130,144, 25, 63,128, 7,251, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,145, 26,225, 62,114,116,251, 62,212,163,225, 62, 91,215,253, 62, 52,151,219, 62, 68,186,253, 62,177,225,219, 62,
- 67, 75,251, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,223, 49, 29, 63,199,140,250, 62, 50,181, 25, 63,
-118,111,253, 62,130,144, 25, 63,128, 7,251, 62, 80,195, 28, 63, 55,166,248, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,177,225,219, 62, 67, 75,251, 62, 52,151,219, 62, 68,186,253, 62,147,124,212, 62,146,215,250, 62,233, 95,213, 62,
- 20,237,248, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,243, 33, 35, 63, 80,143,245, 62,223, 49, 29, 63,
-199,140,250, 62, 80,195, 28, 63, 55,166,248, 62, 22,164, 33, 63,102, 75,243, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,233, 95,213, 62, 20,237,248, 62,147,124,212, 62,146,215,250, 62, 87, 99,200, 62,172,217,245, 62, 65,114,203, 62,
-159,143,243, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 14, 49, 36, 63,253, 88,239, 62,243, 33, 35, 63,
- 80,143,245, 62, 22,164, 33, 63,102, 75,243, 62, 30,160, 34, 63,169, 47,238, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 65,114,203, 62,159,143,243, 62, 87, 99,200, 62,172,217,245, 62, 97, 71,198, 62,192,149,239, 62,188,128,201, 62,
-126,110,238, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 79, 9, 36, 63, 94,224,229, 62, 14, 49, 36, 63,
-253, 88,239, 62, 30,160, 34, 63,169, 47,238, 62,131,144, 34, 63,253, 87,231, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,188,128,201, 62,126,110,238, 62, 97, 71,198, 62,192,149,239, 62,148,192,198, 62,182, 11,230, 62,141,190,201, 62,
-124,140,231, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,156,136, 31, 63,194,138,219, 62, 79, 9, 36, 63,
- 94,224,229, 62,131,144, 34, 63,253, 87,231, 62, 21,208, 30, 63,174,182,221, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,141,190,201, 62,124,140,231, 62,148,192,198, 62,182, 11,230, 62,254, 30,208, 62,204,177,219, 62,168,133,209, 62,
- 51,221,221, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,205,198, 26, 63,124,184,214, 62,156,136, 31, 63,
-194,138,219, 62, 21,208, 30, 63,174,182,221, 62,128,218, 26, 63, 68,206,217, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,168,133,209, 62, 51,221,221, 62,254, 30,208, 62,204,177,219, 62,216,214,217, 62,218,224,214, 62, 11,157,217, 62,
- 64,243,217, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,217, 53, 19, 63, 16,211,218, 62,205,198, 26, 63,
-124,184,214, 62,128,218, 26, 63, 68,206,217, 62,103, 53, 20, 63,236, 84,221, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 11,157,217, 62, 64,243,217, 62,216,214,217, 62,218,224,214, 62, 8, 14,233, 62, 66,226,218, 62, 68, 5,231, 62,
-234,101,221, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 4,216, 16, 63,160, 24,224, 62,217, 53, 19, 63,
- 16,211,218, 62,103, 53, 20, 63,236, 84,221, 62, 81, 87, 18, 63, 33,175,226, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 68, 5,231, 62,234,101,221, 62, 8, 14,233, 62, 66,226,218, 62,119,193,237, 62,190, 38,224, 62,180,187,234, 62,
-249,190,226, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 55, 44, 19, 63, 86, 21,250, 62,184,171, 16, 63,
- 40,133,241, 62, 98, 68, 18, 63,150,197,240, 62, 9,165, 20, 63,248, 99,247, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 35,197,234, 62,215,226,240, 62,218,252,237, 62, 62,160,241, 62,153,228,232, 62,154, 67,250, 62,232,232,229, 62,
- 74,142,247, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,184,171, 16, 63, 40,133,241, 62,120,200, 15, 63,
- 84,255,231, 62,161, 4, 18, 63,138,184,232, 62, 98, 68, 18, 63,150,197,240, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,154, 85,235, 62, 92,206,232, 62, 21,211,239, 62,185, 18,232, 62,218,252,237, 62, 62,160,241, 62, 35,197,234, 62,
-215,226,240, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,120,200, 15, 63, 84,255,231, 62, 4,216, 16, 63,
-160, 24,224, 62, 81, 87, 18, 63, 33,175,226, 62,161, 4, 18, 63,138,184,232, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,180,187,234, 62,249,190,226, 62,119,193,237, 62,190, 38,224, 62, 21,211,239, 62,185, 18,232, 62,154, 85,235, 62,
- 92,206,232, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,148,232, 3, 63,164, 17, 11, 63, 67,169, 11, 63,
- 18,197, 11, 63,216,120, 13, 63,160, 81, 23, 63,147, 15, 4, 63,227,248, 23, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 64, 27,245, 62,100,166, 23, 63, 55, 72,248, 62, 91,232, 11, 63,148,232, 3, 63,164, 17, 11, 63,147, 15, 4, 63,
-227,248, 23, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 67,169, 11, 63, 18,197, 11, 63,173,244, 22, 63,
-236,215, 11, 63, 94,233, 23, 63,186, 60, 16, 63,216,120, 13, 63,160, 81, 23, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,109,130,223, 62,118,165, 16, 63,220, 89,225, 62, 77, 42, 12, 63, 55, 72,248, 62, 91,232, 11, 63, 64, 27,245, 62,
-100,166, 23, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,173,244, 22, 63,236,215, 11, 63, 28,105, 26, 63,
-242,194, 11, 63,220, 56, 28, 63, 66,250, 14, 63, 94,233, 23, 63,186, 60, 16, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,157,161,214, 62,219,110, 15, 63,220, 73,218, 62,169, 31, 12, 63,220, 89,225, 62, 77, 42, 12, 63,109,130,223, 62,
-118,165, 16, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 28,105, 26, 63,242,194, 11, 63,220,158, 34, 63,
-175, 23, 10, 63,109, 44, 39, 63,107,221, 19, 63,220, 56, 28, 63, 66,250, 14, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,156, 26,192, 62, 31,139, 20, 63,124,109,201, 62, 72,121, 10, 63,220, 73,218, 62,169, 31, 12, 63,157,161,214, 62,
-219,110, 15, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,220,158, 34, 63,175, 23, 10, 63,238, 88, 46, 63,
-146,223, 2, 63,242, 80, 56, 63, 44,244, 6, 63,109, 44, 39, 63,107,221, 19, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 64, 0, 61,208,156, 62,204, 16, 7, 63,173, 87,177, 62,102, 9, 3, 63,124,109,201, 62, 72,121, 10, 63,156, 26,192, 62,
- 31,139, 20, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 16, 0,238, 88, 46, 63,146,223, 2, 63, 62,134, 48, 63,
- 37,107,249, 62,195,173, 54, 63,239,106,252, 62,242, 80, 56, 63, 44,244, 6, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,128, 0,202, 36,160, 62, 94, 51,252, 62,172,229,172, 62,116,127,249, 62,173, 87,177, 62,102, 9, 3, 63, 61,208,156, 62,
-204, 16, 7, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0,128, 0, 62,134, 48, 63, 37,107,249, 62, 38,229, 50, 63,
-169, 32,226, 62,154, 88, 53, 63,240,146,221, 62,195,173, 54, 63,239,106,252, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 64, 0,128,172,162, 62, 17,169,221, 62,196, 39,168, 62,206, 11,226, 62,172,229,172, 62,116,127,249, 62,202, 36,160, 62,
- 94, 51,252, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 16, 0, 38,229, 50, 63,169, 32,226, 62, 87, 57, 43, 63,
-222, 58,206, 62,240,117, 49, 63,164,138,198, 62,154, 88, 53, 63,240,146,221, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,128, 0,147,137,172, 62,148, 19,198, 62,130,207,184, 62, 42, 27,206, 62,196, 39,168, 62,206, 11,226, 62,128,172,162, 62,
- 17,169,221, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0,128, 0, 87, 57, 43, 63,222, 58,206, 62, 91, 94, 37, 63,
-107,120,187, 62,156,160, 41, 63, 56,175,182, 62,240,117, 49, 63,164,138,198, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,202,212,188, 62,245,163,182, 62,156, 28,197, 62,166,130,187, 62,130,207,184, 62, 42, 27,206, 62,147,137,172, 62,
-148, 19,198, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,165,252, 48, 63,133, 33, 85, 62,112, 54, 48, 63,
- 20, 19, 96, 62,172, 36, 46, 63,208, 7,129, 62,240, 17, 42, 63,129, 84, 97, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 76, 71,181, 62,204,200,131, 62,117,121,175, 62,183,185,106, 62,217, 24,172, 62, 21,237, 92, 62,138, 81,187, 62,
- 59, 40,103, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,204, 89, 48, 63,134,194, 4, 62,165,252, 48, 63,
-133, 33, 85, 62,240, 17, 42, 63,129, 84, 97, 62,160,125, 37, 63, 50,211, 46, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 16, 0,138, 81,187, 62, 59, 40,103, 62,217, 24,172, 62, 21,237, 92, 62, 94,197,172, 62,109,200, 4, 62, 25,121,195, 62,
- 46,253, 48, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 64, 0, 11, 44, 20, 63, 20, 26,163, 61,204, 89, 48, 63,
-134,194, 4, 62,160,125, 37, 63, 50,211, 46, 62, 40, 92, 24, 63,214,184, 21, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 32, 0, 25,121,195, 62, 46,253, 48, 62, 94,197,172, 62,109,200, 4, 62,140,122,230, 62,202,248,161, 61,216, 13,222, 62,
-222,116, 22, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 32, 0,174,254, 16, 63, 94, 45, 34, 62,219,199, 3, 63,
- 18, 28,229, 61, 11, 44, 20, 63, 20, 26,163, 61, 40, 92, 24, 63,214,184, 21, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 16, 0,140,122,230, 62,202,248,161, 61,219,199, 3, 63, 18, 28,229, 61,140,248,236, 62,182,202, 34, 62,216, 13,222, 62,
-222,116, 22, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 64, 0,184,152, 21, 63,182, 47, 53, 62,174,254, 16, 63,
- 94, 45, 34, 62, 40, 92, 24, 63,214,184, 21, 62,209, 52, 25, 63, 76,140, 51, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 32, 0,216, 13,222, 62,222,116, 22, 62,140,248,236, 62,182,202, 34, 62,183,207,227, 62,250, 75, 54, 62,229,137,220, 62,
-185,228, 52, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 32, 0,137, 57, 22, 63, 81, 93, 61, 62,184,152, 21, 63,
-182, 47, 53, 62,209, 52, 25, 63, 76,140, 51, 62,193,166, 30, 63,114,168, 73, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,229,137,220, 62,185,228, 52, 62,183,207,227, 62,250, 75, 54, 62,122,152,226, 62,190,166, 62, 62, 54,198,209, 62,
- 18,240, 75, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,250,249, 22, 63,160,251, 88, 62,137, 57, 22, 63,
- 81, 93, 61, 62,193,166, 30, 63,114,168, 73, 62, 75, 0, 36, 63,229, 47,116, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 54,198,209, 62, 18,240, 75, 62,122,152,226, 62,190,166, 62, 62, 90, 83,225, 62, 21,153, 90, 62,211,231,199, 62,
-216,237,119, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,193,166, 30, 63,114,168, 73, 62,160,125, 37, 63,
- 50,211, 46, 62,240, 17, 42, 63,129, 84, 97, 62, 75, 0, 36, 63,229, 47,116, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,138, 81,187, 62, 59, 40,103, 62, 25,121,195, 62, 46,253, 48, 62, 54,198,209, 62, 18,240, 75, 62,211,231,199, 62,
-216,237,119, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,193,166, 30, 63,114,168, 73, 62,209, 52, 25, 63,
- 76,140, 51, 62, 40, 92, 24, 63,214,184, 21, 62,160,125, 37, 63, 50,211, 46, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,216, 13,222, 62,222,116, 22, 62,229,137,220, 62,185,228, 52, 62, 54,198,209, 62, 18,240, 75, 62, 25,121,195, 62,
- 46,253, 48, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 37,163, 36, 63,191,168,140, 62, 75, 0, 36, 63,
-229, 47,116, 62,240, 17, 42, 63,129, 84, 97, 62,172, 36, 46, 63,208, 7,129, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,138, 81,187, 62, 59, 40,103, 62,211,231,199, 62,216,237,119, 62, 6, 64,199, 62,105, 6,142, 62, 76, 71,181, 62,
-204,200,131, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 20, 81, 25, 63, 17, 56,132, 62,250,249, 22, 63,
-160,251, 88, 62, 75, 0, 36, 63,229, 47,116, 62, 37,163, 36, 63,191,168,140, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,211,231,199, 62,216,237,119, 62, 90, 83,225, 62, 21,153, 90, 62, 54, 42,221, 62,209, 25,133, 62, 6, 64,199, 62,
-105, 6,142, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,208, 46, 27, 63,149, 35,148, 62, 91, 60, 36, 63,
-221,222,150, 62,222,170, 33, 63, 74,126,158, 62, 36,177, 27, 63,158,151,156, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 72,234,204, 62, 56, 63,159, 62,150,245,199, 62, 85, 15,152, 62,238,166,217, 62,229,221,148, 62, 0,160,216, 62,
-127, 44,157, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 20, 81, 25, 63, 17, 56,132, 62, 37,163, 36, 63,
-191,168,140, 62, 91, 60, 36, 63,221,222,150, 62,208, 46, 27, 63,149, 35,148, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,150,245,199, 62, 85, 15,152, 62, 6, 64,199, 62,105, 6,142, 62, 54, 42,221, 62,209, 25,133, 62,238,166,217, 62,
-229,221,148, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,111,239, 27, 63,159, 77,166, 62, 36,177, 27, 63,
-158,151,156, 62,222,170, 33, 63, 74,126,158, 62,102,212, 31, 63,144,192,164, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 72,234,204, 62, 56, 63,159, 62, 0,160,216, 62,127, 44,157, 62,115, 21,216, 62, 14,177,166, 62, 17,119,208, 62,
-201, 65,165, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,111,239, 27, 63,159, 77,166, 62,102,212, 31, 63,
-144,192,164, 62,156,160, 41, 63, 56,175,182, 62, 91, 94, 37, 63,107,120,187, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,202,212,188, 62,245,163,182, 62, 17,119,208, 62,201, 65,165, 62,115, 21,216, 62, 14,177,166, 62,156, 28,197, 62,
-166,130,187, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,104,119,194, 62,164,189, 82, 63, 23, 73,212, 62,
-152,239, 90, 63,100,192,205, 62, 46,238, 97, 63, 38, 56,185, 62, 72,154, 91, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,240, 0,228, 94,141, 62, 86,234,100, 63, 84, 66,150, 62,114,154, 94, 63,230, 86,173, 62, 79, 66, 98, 63, 20,143,162, 62,
- 44,173,106, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0,240, 0, 72,122, 87, 63,216, 8, 62, 62,202,106, 84, 63,
-137,185,113, 62,226, 77, 72, 63,204, 21,121, 62,158,225, 71, 63,113, 34, 68, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 16, 0,132, 32,137, 62,181, 65,121, 62,168,179,107, 62,139,127,103, 62,210,147,114, 62,212,116, 61, 62,248,125,142, 62,
- 30, 4, 80, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 64, 0,158,225, 71, 63,113, 34, 68, 62,226, 77, 72, 63,
-204, 21,121, 62, 8, 7, 51, 63, 5,186,130, 62, 3,166, 49, 63,232, 57, 96, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 18,197,172, 62, 41,112,133, 62,132, 32,137, 62,181, 65,121, 62,248,125,142, 62, 30, 4, 80, 62,121,228,174, 62,
- 52, 79,109, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 3,166, 49, 63,232, 57, 96, 62, 8, 7, 51, 63,
- 5,186,130, 62,172, 36, 46, 63,208, 7,129, 62,112, 54, 48, 63, 20, 19, 96, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 76, 71,181, 62,204,200,131, 62, 18,197,172, 62, 41,112,133, 62,121,228,174, 62, 52, 79,109, 62,117,121,175, 62,
-183,185,106, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 37,163, 36, 63,191,168,140, 62,172, 36, 46, 63,
-208, 7,129, 62, 8, 7, 51, 63, 5,186,130, 62, 91, 60, 36, 63,221,222,150, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 18,197,172, 62, 41,112,133, 62, 76, 71,181, 62,204,200,131, 62, 6, 64,199, 62,105, 6,142, 62,150,245,199, 62,
- 85, 15,152, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,154, 88, 53, 63,240,146,221, 62,240,117, 49, 63,
-164,138,198, 62,224, 19, 69, 63, 24, 68,190, 62, 53, 64, 74, 63,171, 31,224, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 16, 0,250, 78,134, 62,148,213,186, 62,147,137,172, 62,148, 19,198, 62,128,172,162, 62, 17,169,221, 62,184,112,114, 62,
-248,169,220, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 64, 0, 54, 74,214, 62, 20, 55, 70, 63, 48,130,233, 62,
-188, 69, 83, 63, 23, 73,212, 62,152,239, 90, 63,104,119,194, 62,164,189, 82, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,240, 0, 84, 66,150, 62,114,154, 94, 63, 66, 1,153, 62,245,149, 81, 63, 38, 56,185, 62,102,110, 83, 63,230, 86,173, 62,
- 79, 66, 98, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0,240, 0,106,242, 66, 63,202, 94, 25, 63,190,100, 70, 63,
-222,234, 15, 63, 90,189, 77, 63,233, 88, 17, 63, 8,206, 74, 63, 88,118, 27, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 22, 32, 96, 62, 66, 60, 16, 63, 86, 87,125, 62,174, 5, 15, 63, 78,187,132, 62,180, 44, 24, 63, 26, 79,108, 62,
-124, 1, 26, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 8,206, 74, 63, 88,118, 27, 63, 90,189, 77, 63,
-233, 88, 17, 63, 72,139, 85, 63,103, 51, 19, 63,220,119, 85, 63, 77, 71, 31, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 64,199, 64, 62, 26, 40, 18, 63, 22, 32, 96, 62, 66, 60, 16, 63, 26, 79,108, 62,124, 1, 26, 63, 44,191, 67, 62,
- 90, 89, 30, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,220,119, 85, 63, 77, 71, 31, 63, 72,139, 85, 63,
-103, 51, 19, 63,228,213,100, 63, 72,156, 20, 63, 18, 82, 96, 63,128,133, 34, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,128, 0,226, 50, 1, 62,184, 68, 20, 63, 64,199, 64, 62, 26, 40, 18, 63, 44,191, 67, 62, 90, 89, 30, 63,194,204, 24, 62,
- 32,186, 34, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0,128, 0,242, 80, 56, 63, 44,244, 6, 63,195,173, 54, 63,
-239,106,252, 62,115,205, 60, 63,213,150,253, 62,166, 14, 64, 63, 81, 80, 4, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 16, 0,190, 85,147, 62, 91,176,252, 62,202, 36,160, 62, 94, 51,252, 62, 61,208,156, 62,204, 16, 7, 63,160,121,140, 62,
- 74,197, 3, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 64, 0,166, 14, 64, 63, 81, 80, 4, 63,115,205, 60, 63,
-213,150,253, 62, 68,103, 73, 63,233,248, 0, 63,248, 12, 75, 63, 64,206, 8, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,144, 59,115, 62,102,143,255, 62,190, 85,147, 62, 91,176,252, 62,160,121,140, 62, 74,197, 3, 63, 78,135,107, 62,
- 88,182, 7, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,248, 12, 75, 63, 64,206, 8, 63, 68,103, 73, 63,
-233,248, 0, 63,239,151, 82, 63, 86,223, 3, 63,181,227, 82, 63,189,102, 11, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 82, 17, 77, 62,162, 98, 2, 63,144, 59,115, 62,102,143,255, 62, 78,135,107, 62, 88,182, 7, 63,202, 98, 75, 62,
-108, 43, 10, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,181,227, 82, 63,189,102, 11, 63,239,151, 82, 63,
- 86,223, 3, 63, 92,224, 91, 63,239,144, 5, 63,161,148, 90, 63,146, 95, 13, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,178, 40, 38, 62, 14,230, 3, 63, 82, 17, 77, 62,162, 98, 2, 63,202, 98, 75, 62,108, 43, 10, 63, 10,162, 43, 62,
- 8, 50, 12, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,120, 89,103, 63,105, 76, 2, 63,170,179,103, 63,
-142,105, 12, 63,161,148, 90, 63,146, 95, 13, 63, 92,224, 91, 63,239,144, 5, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 10,162, 43, 62, 8, 50, 12, 63,168, 41,231, 61,158, 83, 11, 63,116,128,234, 61,200, 39, 0, 63,178, 40, 38, 62,
- 14,230, 3, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,228,213,100, 63, 72,156, 20, 63, 72,139, 85, 63,
-103, 51, 19, 63,161,148, 90, 63,146, 95, 13, 63,170,179,103, 63,142,105, 12, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 10,162, 43, 62, 8, 50, 12, 63, 64,199, 64, 62, 26, 40, 18, 63,226, 50, 1, 62,184, 68, 20, 63,168, 41,231, 61,
-158, 83, 11, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 72,139, 85, 63,103, 51, 19, 63, 90,189, 77, 63,
-233, 88, 17, 63,181,227, 82, 63,189,102, 11, 63,161,148, 90, 63,146, 95, 13, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,202, 98, 75, 62,108, 43, 10, 63, 22, 32, 96, 62, 66, 60, 16, 63, 64,199, 64, 62, 26, 40, 18, 63, 10,162, 43, 62,
- 8, 50, 12, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 90,189, 77, 63,233, 88, 17, 63,190,100, 70, 63,
-222,234, 15, 63,248, 12, 75, 63, 64,206, 8, 63,181,227, 82, 63,189,102, 11, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 78,135,107, 62, 88,182, 7, 63, 86, 87,125, 62,174, 5, 15, 63, 22, 32, 96, 62, 66, 60, 16, 63,202, 98, 75, 62,
-108, 43, 10, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,190,100, 70, 63,222,234, 15, 63, 82,235, 60, 63,
- 27, 12, 12, 63,166, 14, 64, 63, 81, 80, 4, 63,248, 12, 75, 63, 64,206, 8, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,160,121,140, 62, 74,197, 3, 63, 78,230,145, 62,148,225, 11, 63, 86, 87,125, 62,174, 5, 15, 63, 78,135,107, 62,
- 88,182, 7, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 31,118, 57, 63,230, 79, 12, 63,242, 80, 56, 63,
- 44,244, 6, 63,166, 14, 64, 63, 81, 80, 4, 63, 82,235, 60, 63, 27, 12, 12, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 32, 0,160,121,140, 62, 74,197, 3, 63, 61,208,156, 62,204, 16, 7, 63, 0,199,152, 62, 13,133, 12, 63, 78,230,145, 62,
-148,225, 11, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 32, 0,195,240, 57, 63, 10,138, 23, 63, 82,235, 60, 63,
- 27, 12, 12, 63,190,100, 70, 63,222,234, 15, 63,106,242, 66, 63,202, 94, 25, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 86, 87,125, 62,174, 5, 15, 63, 78,230,145, 62,148,225, 11, 63,247, 7,150, 62, 96, 12, 23, 63, 78,187,132, 62,
-180, 44, 24, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,216,120, 13, 63,160, 81, 23, 63, 94,233, 23, 63,
-186, 60, 16, 63,220, 56, 28, 63, 66,250, 14, 63,109, 44, 39, 63,107,221, 19, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,157,161,214, 62,219,110, 15, 63,109,130,223, 62,118,165, 16, 63, 64, 27,245, 62,100,166, 23, 63,156, 26,192, 62,
- 31,139, 20, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,176, 29, 56, 63, 88,206, 20, 63, 31,118, 57, 63,
-230, 79, 12, 63, 82,235, 60, 63, 27, 12, 12, 63,195,240, 57, 63, 10,138, 23, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 78,230,145, 62,148,225, 11, 63, 0,199,152, 62, 13,133, 12, 63,239,211,153, 62,220,159, 20, 63,247, 7,150, 62,
- 96, 12, 23, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 48,148, 54, 63,220,206, 22, 63,176, 29, 56, 63,
- 88,206, 20, 63,195,240, 57, 63, 10,138, 23, 63, 0, 0,128, 63, 0, 0,128, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,247, 7,150, 62, 96, 12, 23, 63,239,211,153, 62,220,159, 20, 63,108,106,156, 62,146,154, 22, 63, 0, 0,128, 63,
- 0, 0,128, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,195,173, 54, 63,239,106,252, 62,154, 88, 53, 63,
-240,146,221, 62, 53, 64, 74, 63,171, 31,224, 62,115,205, 60, 63,213,150,253, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 32, 0,184,112,114, 62,248,169,220, 62,128,172,162, 62, 17,169,221, 62,202, 36,160, 62, 94, 51,252, 62,190, 85,147, 62,
- 91,176,252, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 32, 0, 53, 64, 74, 63,171, 31,224, 62,217,106, 81, 63,
- 14,214,232, 62, 68,103, 73, 63,233,248, 0, 63,115,205, 60, 63,213,150,253, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,144, 59,115, 62,102,143,255, 62, 88, 93, 84, 62, 50,105,228, 62,184,112,114, 62,248,169,220, 62,190, 85,147, 62,
- 91,176,252, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,217,106, 81, 63, 14,214,232, 62,106,154, 93, 63,
-226, 26,233, 62,239,151, 82, 63, 86,223, 3, 63, 68,103, 73, 63,233,248, 0, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 82, 17, 77, 62,162, 98, 2, 63,128, 1, 33, 62, 70,210,226, 62, 88, 93, 84, 62, 50,105,228, 62,144, 59,115, 62,
-102,143,255, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,120, 89,103, 63,105, 76, 2, 63, 92,224, 91, 63,
-239,144, 5, 63,239,151, 82, 63, 86,223, 3, 63,106,154, 93, 63,226, 26,233, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 82, 17, 77, 62,162, 98, 2, 63,178, 40, 38, 62, 14,230, 3, 63,116,128,234, 61,200, 39, 0, 63,128, 1, 33, 62,
- 70,210,226, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 8, 7, 51, 63, 5,186,130, 62,226, 77, 72, 63,
-204, 21,121, 62,154,254, 73, 63,178, 82,140, 62, 90,188, 56, 63,103,207,159, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,249,249,130, 62,246,175,137, 62,132, 32,137, 62,181, 65,121, 62, 18,197,172, 62, 41,112,133, 62,192, 5,161, 62,
-228, 40,159, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,224, 19, 69, 63, 24, 68,190, 62, 90,188, 56, 63,
-103,207,159, 62,154,254, 73, 63,178, 82,140, 62,216,217, 77, 63, 7,228,157, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,128, 0,249,249,130, 62,246,175,137, 62,192, 5,161, 62,228, 40,159, 62,250, 78,134, 62,148,213,186, 62,154,118,111, 62,
-120,108,152, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0,128, 0,240,117, 49, 63,164,138,198, 62,156,160, 41, 63,
- 56,175,182, 62, 90,188, 56, 63,103,207,159, 62,224, 19, 69, 63, 24, 68,190, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,192, 5,161, 62,228, 40,159, 62,202,212,188, 62,245,163,182, 62,147,137,172, 62,148, 19,198, 62,250, 78,134, 62,
-148,213,186, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,156,160, 41, 63, 56,175,182, 62,222,170, 33, 63,
- 74,126,158, 62, 91, 60, 36, 63,221,222,150, 62, 90,188, 56, 63,103,207,159, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,150,245,199, 62, 85, 15,152, 62, 72,234,204, 62, 56, 63,159, 62,202,212,188, 62,245,163,182, 62,192, 5,161, 62,
-228, 40,159, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 91, 60, 36, 63,221,222,150, 62, 8, 7, 51, 63,
- 5,186,130, 62, 90,188, 56, 63,103,207,159, 62, 0, 0,128, 63, 0, 0,128, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,192, 5,161, 62,228, 40,159, 62, 18,197,172, 62, 41,112,133, 62,150,245,199, 62, 85, 15,152, 62, 0, 0,128, 63,
- 0, 0,128, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,156,160, 41, 63, 56,175,182, 62,102,212, 31, 63,
-144,192,164, 62,222,170, 33, 63, 74,126,158, 62, 0, 0,128, 63, 0, 0,128, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 72,234,204, 62, 56, 63,159, 62, 17,119,208, 62,201, 65,165, 62,202,212,188, 62,245,163,182, 62, 0, 0,128, 63,
- 0, 0,128, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,226, 44,245, 62,129,140, 96, 63, 42,135,227, 62,
- 58, 2,101, 63,136,168,219, 62, 30,236, 95, 63,135, 30,238, 62,200, 41, 90, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,240, 0,216,240,137, 62, 90,226, 93, 63,110,103,122, 62,236,255, 92, 63, 74, 84,120, 62,104, 32, 83, 63, 32,193,138, 62,
- 16, 3, 83, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0,240, 0, 48,130,233, 62,188, 69, 83, 63,135, 30,238, 62,
-200, 41, 90, 63,136,168,219, 62, 30,236, 95, 63, 23, 73,212, 62,152,239, 90, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,240, 0,216,240,137, 62, 90,226, 93, 63, 32,193,138, 62, 16, 3, 83, 63, 66, 1,153, 62,245,149, 81, 63, 84, 66,150, 62,
-114,154, 94, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0,240, 0,216,217, 77, 63, 7,228,157, 62,154,254, 73, 63,
-178, 82,140, 62, 33, 61, 90, 63,195,207,124, 62,160,225, 90, 63,110,121,137, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 16, 0, 98,207, 81, 62,109, 1,110, 62,249,249,130, 62,246,175,137, 62,154,118,111, 62,120,108,152, 62,166,125, 74, 62,
-252, 30,130, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 64, 0,226, 77, 72, 63,204, 21,121, 62,202,106, 84, 63,
-137,185,113, 62, 33, 61, 90, 63,195,207,124, 62,154,254, 73, 63,178, 82,140, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 98,207, 81, 62,109, 1,110, 62,168,179,107, 62,139,127,103, 62,132, 32,137, 62,181, 65,121, 62,249,249,130, 62,
-246,175,137, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 23, 73,212, 62,152,239, 90, 63,136,168,219, 62,
- 30,236, 95, 63,100,192,205, 62, 46,238, 97, 63, 0, 0,128, 63, 0, 0,128, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,112, 0,228, 94,141, 62, 86,234,100, 63,216,240,137, 62, 90,226, 93, 63, 84, 66,150, 62,114,154, 94, 63, 0, 0,128, 63,
- 0, 0,128, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0,112, 0, 31,178,109, 63,224, 68,228, 62, 46,178,102, 63,
-100,184,232, 62,100,251,101, 63,238,198,227, 62, 94,173,107, 63,168,130,225, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 68,209,249, 61, 70,134,219, 62,120,216,242, 61,124, 40,225, 62, 28, 27,177, 61, 42,240,219, 62, 76,131,196, 61,
-196, 97,216, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 31,178,109, 63,224, 68,228, 62, 94,173,107, 63,
-168,130,225, 62,144,102,114, 63,198, 23,220, 62, 41, 76,116, 63,139,153,222, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 56,163,120, 61, 58,252,208, 62, 76,131,196, 61,196, 97,216, 62, 28, 27,177, 61, 42,240,219, 62,128,183, 73, 61,
- 84,108,213, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 41, 76,116, 63,139,153,222, 62,144,102,114, 63,
-198, 23,220, 62, 84, 87,117, 63,221,255,211, 62,183,115,119, 63,140, 49,215, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,144, 29, 55, 61,207,183,194, 62, 56,163,120, 61, 58,252,208, 62,128,183, 73, 61, 84,108,213, 62,224,111,231, 60,
-100,142,198, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,183,115,119, 63,140, 49,215, 62, 84, 87,117, 63,
-221,255,211, 62,150, 20,118, 63, 60,110,196, 62, 49, 12,122, 63,246, 8,197, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 96,197,103, 61, 15,206,170, 62,144, 29, 55, 61,207,183,194, 62,224,111,231, 60,100,142,198, 62,240, 54, 16, 61,
-120, 4,167, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 49, 12,122, 63,246, 8,197, 62,150, 20,118, 63,
- 60,110,196, 62, 17,155,108, 63,130,201,178, 62, 84,190,110, 63,223, 77,172, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,148,252,246, 61,164,116,160, 62, 96,197,103, 61, 15,206,170, 62,240, 54, 16, 61,120, 4,167, 62, 8, 66,246, 61,
- 28,161,152, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 84,190,110, 63,223, 77,172, 62, 17,155,108, 63,
-130,201,178, 62, 21,180, 92, 63,202, 95,173, 62,151, 5, 90, 63,138, 61,167, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,144,216, 54, 62, 35, 76,163, 62,148,252,246, 61,164,116,160, 62, 8, 66,246, 61, 28,161,152, 62,194,251, 66, 62,
-163,102,158, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 17,155,108, 63,130,201,178, 62,198,132,109, 63,
-182,157,186, 62, 68, 32, 97, 63,192, 12,178, 62, 21,180, 92, 63,202, 95,173, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 48,185, 36, 62, 16, 7,166, 62, 40, 91,221, 61, 4,194,167, 62,148,252,246, 61,164,116,160, 62,144,216, 54, 62,
- 35, 76,163, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,150, 20,118, 63, 60,110,196, 62, 84,225,115, 63,
-208, 85,198, 62,198,132,109, 63,182,157,186, 62, 17,155,108, 63,130,201,178, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 40, 91,221, 61, 4,194,167, 62,244,221,134, 61,121,164,175, 62, 96,197,103, 61, 15,206,170, 62,148,252,246, 61,
-164,116,160, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 84, 87,117, 63,221,255,211, 62,222, 48,116, 63,
-169, 8,209, 62, 84,225,115, 63,208, 85,198, 62,150, 20,118, 63, 60,110,196, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,244,221,134, 61,121,164,175, 62,160,108, 93, 61, 17,207,190, 62,144, 29, 55, 61,207,183,194, 62, 96,197,103, 61,
- 15,206,170, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,144,102,114, 63,198, 23,220, 62,174,151,113, 63,
- 26,229,214, 62,222, 48,116, 63,169, 8,209, 62, 84, 87,117, 63,221,255,211, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,160,108, 93, 61, 17,207,190, 62, 12,155,135, 61,166, 39,201, 62, 56,163,120, 61, 58,252,208, 62,144, 29, 55, 61,
-207,183,194, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 94,173,107, 63,168,130,225, 62,228,239,107, 63,
- 62, 59,218, 62,174,151,113, 63, 26,229,214, 62,144,102,114, 63,198, 23,220, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 12,155,135, 61,166, 39,201, 62,128, 47,195, 61, 6, 11,207, 62, 76,131,196, 61,196, 97,216, 62, 56,163,120, 61,
- 58,252,208, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 94,173,107, 63,168,130,225, 62,100,251,101, 63,
-238,198,227, 62, 71,205,102, 63,132, 94,219, 62,228,239,107, 63, 62, 59,218, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,192,157,244, 61,157,137,209, 62, 68,209,249, 61, 70,134,219, 62, 76,131,196, 61,196, 97,216, 62,128, 47,195, 61,
- 6, 11,207, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,224, 19, 69, 63, 24, 68,190, 62,216,217, 77, 63,
- 7,228,157, 62,236, 35, 85, 63,164,201,181, 62, 56, 92, 78, 63,177,114,188, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 32, 0,122, 91, 80, 62, 72, 18,174, 62,154,118,111, 62,120,108,152, 62,250, 78,134, 62,148,213,186, 62,162,163,104, 62,
-150,180,182, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 32, 0,216,217, 77, 63, 7,228,157, 62,151, 5, 90, 63,
-138, 61,167, 62, 21,180, 92, 63,202, 95,173, 62,236, 35, 85, 63,164,201,181, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 16, 0,144,216, 54, 62, 35, 76,163, 62,194,251, 66, 62,163,102,158, 62,154,118,111, 62,120,108,152, 62,122, 91, 80, 62,
- 72, 18,174, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 64, 0, 53, 64, 74, 63,171, 31,224, 62,224, 19, 69, 63,
- 24, 68,190, 62, 56, 92, 78, 63,177,114,188, 62,217,106, 81, 63, 14,214,232, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,162,163,104, 62,150,180,182, 62,250, 78,134, 62,148,213,186, 62,184,112,114, 62,248,169,220, 62, 88, 93, 84, 62,
- 50,105,228, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,106,154, 93, 63,226, 26,233, 62,196,229, 94, 63,
-128,195,224, 62,100,251,101, 63,238,198,227, 62, 46,178,102, 63,100,184,232, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 68,209,249, 61, 70,134,219, 62,108,187, 28, 62, 48, 86,217, 62,128, 1, 33, 62, 70,210,226, 62,120,216,242, 61,
-124, 40,225, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 21,180, 92, 63,202, 95,173, 62, 68, 32, 97, 63,
-192, 12,178, 62, 9,215, 94, 63, 4, 54,186, 62,236, 35, 85, 63,164,201,181, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 60,122, 41, 62, 16, 58,175, 62, 48,185, 36, 62, 16, 7,166, 62,144,216, 54, 62, 35, 76,163, 62,122, 91, 80, 62,
- 72, 18,174, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,230, 78, 95, 63, 4,233,189, 62, 32,188, 86, 63,
- 44, 62,190, 62,236, 35, 85, 63,164,201,181, 62, 9,215, 94, 63, 4, 54,186, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,122, 91, 80, 62, 72, 18,174, 62, 78,118, 71, 62, 27, 49,182, 62, 52,225, 37, 62, 40, 12,179, 62, 60,122, 41, 62,
- 16, 58,175, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 70,166, 92, 63, 0,166,197, 62, 32,188, 86, 63,
- 44, 62,190, 62,230, 78, 95, 63, 4,233,189, 62,226, 13, 95, 63, 37,152,194, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 52,225, 37, 62, 40, 12,179, 62, 78,118, 71, 62, 27, 49,182, 62,142,143, 45, 62,237, 37,188, 62,106,230, 36, 62,
-222, 27,184, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,248, 90, 95, 63,100,122,207, 62,108,249, 90, 63,
- 58,199,212, 62, 32,188, 86, 63, 44, 62,190, 62, 70,166, 92, 63, 0,166,197, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 78,118, 71, 62, 27, 49,182, 62,110, 56, 48, 62,230, 43,205, 62,174,250, 30, 62, 26, 12,198, 62,142,143, 45, 62,
-237, 37,188, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,196,229, 94, 63,128,195,224, 62,108,249, 90, 63,
- 58,199,212, 62,248, 90, 95, 63,100,122,207, 62, 92,104, 98, 63,197,136,215, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,174,250, 30, 62, 26, 12,198, 62,110, 56, 48, 62,230, 43,205, 62,108,187, 28, 62, 48, 86,217, 62,212, 59, 15, 62,
-224, 50,206, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,100,251,101, 63,238,198,227, 62,196,229, 94, 63,
-128,195,224, 62, 92,104, 98, 63,197,136,215, 62, 71,205,102, 63,132, 94,219, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,212, 59, 15, 62,224, 50,206, 62,108,187, 28, 62, 48, 86,217, 62, 68,209,249, 61, 70,134,219, 62,192,157,244, 61,
-157,137,209, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,217,106, 81, 63, 14,214,232, 62,108,249, 90, 63,
- 58,199,212, 62,196,229, 94, 63,128,195,224, 62,106,154, 93, 63,226, 26,233, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,108,187, 28, 62, 48, 86,217, 62,110, 56, 48, 62,230, 43,205, 62, 88, 93, 84, 62, 50,105,228, 62,128, 1, 33, 62,
- 70,210,226, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,217,106, 81, 63, 14,214,232, 62, 56, 92, 78, 63,
-177,114,188, 62, 32,188, 86, 63, 44, 62,190, 62,108,249, 90, 63, 58,199,212, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 78,118, 71, 62, 27, 49,182, 62,162,163,104, 62,150,180,182, 62, 88, 93, 84, 62, 50,105,228, 62,110, 56, 48, 62,
-230, 43,205, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 56, 92, 78, 63,177,114,188, 62,236, 35, 85, 63,
-164,201,181, 62, 32,188, 86, 63, 44, 62,190, 62, 0, 0,128, 63, 0, 0,128, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 78,118, 71, 62, 27, 49,182, 62,122, 91, 80, 62, 72, 18,174, 62,162,163,104, 62,150,180,182, 62, 0, 0,128, 63,
- 0, 0,128, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 71,205,102, 63,132, 94,219, 62, 92,104, 98, 63,
-197,136,215, 62,182,109,100, 63,149,255,210, 62, 54, 86,104, 63,209,241,214, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,160,107, 7, 62, 34,103,200, 62,212, 59, 15, 62,224, 50,206, 62,192,157,244, 61,157,137,209, 62, 8, 2,232, 61,
- 20,214,203, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 92,104, 98, 63,197,136,215, 62,248, 90, 95, 63,
-100,122,207, 62,112,206, 97, 63, 10,202,204, 62,182,109,100, 63,149,255,210, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 64, 68, 21, 62,107, 55,194, 62,174,250, 30, 62, 26, 12,198, 62,212, 59, 15, 62,224, 50,206, 62,160,107, 7, 62,
- 34,103,200, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,248, 90, 95, 63,100,122,207, 62, 70,166, 92, 63,
- 0,166,197, 62, 82,241, 94, 63, 40,103,198, 62,112,206, 97, 63, 10,202,204, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 20,225, 35, 62, 39, 50,188, 62,142,143, 45, 62,237, 37,188, 62,174,250, 30, 62, 26, 12,198, 62, 64, 68, 21, 62,
-107, 55,194, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 70,166, 92, 63, 0,166,197, 62,226, 13, 95, 63,
- 37,152,194, 62,118, 1, 97, 63, 47,226,195, 62, 82,241, 94, 63, 40,103,198, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 12, 43, 28, 62,186,177,184, 62,106,230, 36, 62,222, 27,184, 62,142,143, 45, 62,237, 37,188, 62, 20,225, 35, 62,
- 39, 50,188, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,226, 13, 95, 63, 37,152,194, 62,230, 78, 95, 63,
- 4,233,189, 62, 51,113, 97, 63, 92,151,189, 62,118, 1, 97, 63, 47,226,195, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,104, 67, 29, 62, 58,199,177, 62, 52,225, 37, 62, 40, 12,179, 62,106,230, 36, 62,222, 27,184, 62, 12, 43, 28, 62,
-186,177,184, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,230, 78, 95, 63, 4,233,189, 62, 9,215, 94, 63,
- 4, 54,186, 62, 96, 69, 96, 63,152,133,187, 62, 51,113, 97, 63, 92,151,189, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,140, 14, 35, 62, 33, 19,176, 62, 60,122, 41, 62, 16, 58,175, 62, 52,225, 37, 62, 40, 12,179, 62,104, 67, 29, 62,
- 58,199,177, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 9,215, 94, 63, 4, 54,186, 62, 68, 32, 97, 63,
-192, 12,178, 62,112, 91, 98, 63,149,128,182, 62, 96, 69, 96, 63,152,133,187, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,228,107, 29, 62, 95,230,169, 62, 48,185, 36, 62, 16, 7,166, 62, 60,122, 41, 62, 16, 58,175, 62,140, 14, 35, 62,
- 33, 19,176, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,228,239,107, 63, 62, 59,218, 62, 71,205,102, 63,
-132, 94,219, 62, 54, 86,104, 63,209,241,214, 62, 34, 27,109, 63,155,254,214, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 8, 2,232, 61, 20,214,203, 62,192,157,244, 61,157,137,209, 62,128, 47,195, 61, 6, 11,207, 62, 36,174,184, 61,
-216,130,202, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,174,151,113, 63, 26,229,214, 62,228,239,107, 63,
- 62, 59,218, 62, 34, 27,109, 63,155,254,214, 62, 69,134,113, 63,156, 82,212, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 36,174,184, 61,216,130,202, 62,128, 47,195, 61, 6, 11,207, 62, 12,155,135, 61,166, 39,201, 62, 60,114,138, 61,
- 28, 61,197, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,222, 48,116, 63,169, 8,209, 62,174,151,113, 63,
- 26,229,214, 62, 69,134,113, 63,156, 82,212, 62, 42,143,114, 63, 24,168,207, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 60,114,138, 61, 28, 61,197, 62, 12,155,135, 61,166, 39,201, 62,160,108, 93, 61, 17,207,190, 62,184, 85,132, 61,
- 22,211,189, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 84,225,115, 63,208, 85,198, 62,222, 48,116, 63,
-169, 8,209, 62, 42,143,114, 63, 24,168,207, 62,203,125,114, 63, 96,114,200, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,184, 85,132, 61, 22,211,189, 62,160,108, 93, 61, 17,207,190, 62,244,221,134, 61,121,164,175, 62, 16,152,145, 61,
- 84,214,179, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,198,132,109, 63,182,157,186, 62, 84,225,115, 63,
-208, 85,198, 62,203,125,114, 63, 96,114,200, 62,177,192,109, 63,152,240,190, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 16,152,145, 61, 84,214,179, 62,244,221,134, 61,121,164,175, 62, 40, 91,221, 61, 4,194,167, 62, 64,226,208, 61,
-232, 58,172, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 68, 32, 97, 63,192, 12,178, 62,198,132,109, 63,
-182,157,186, 62,177,192,109, 63,152,240,190, 62,112, 91, 98, 63,149,128,182, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 64,226,208, 61,232, 58,172, 62, 40, 91,221, 61, 4,194,167, 62, 48,185, 36, 62, 16, 7,166, 62,228,107, 29, 62,
- 95,230,169, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,118, 1, 97, 63, 47,226,195, 62, 51,113, 97, 63,
- 92,151,189, 62,215,139,102, 63, 15,109,193, 62, 54, 47,100, 63,186,115,198, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 92,169, 5, 62,168,115,179, 62,104, 67, 29, 62, 58,199,177, 62, 12, 43, 28, 62,186,177,184, 62, 50, 97, 13, 62,
- 50, 42,186, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 54, 47,100, 63,186,115,198, 62,215,139,102, 63,
- 15,109,193, 62,174,241,105, 63,204, 8,200, 62, 71,233,103, 63,178, 42,204, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,228,171,229, 61, 41, 42,185, 62, 92,169, 5, 62,168,115,179, 62, 50, 97, 13, 62, 50, 42,186, 62, 92,248,243, 61,
- 96, 22,191, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 71,233,103, 63,178, 42,204, 62,174,241,105, 63,
-204, 8,200, 62, 51, 37,108, 63,249, 3,205, 62, 56,212,106, 63, 96,238,208, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,120, 99,202, 61,192, 49,190, 62,228,171,229, 61, 41, 42,185, 62, 92,248,243, 61, 96, 22,191, 62,160,209,211, 61,
-108,159,195, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 56,212,106, 63, 96,238,208, 62, 51, 37,108, 63,
-249, 3,205, 62, 56, 73,110, 63,186,119,206, 62, 46,191,109, 63, 92, 64,210, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,244,234,179, 61,240,219,190, 62,120, 99,202, 61,192, 49,190, 62,160,209,211, 61,108,159,195, 62,196,129,181, 61,
-204, 14,196, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 34, 27,109, 63,155,254,214, 62, 54, 86,104, 63,
-209,241,214, 62, 56,212,106, 63, 96,238,208, 62, 46,191,109, 63, 92, 64,210, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,160,209,211, 61,108,159,195, 62, 8, 2,232, 61, 20,214,203, 62, 36,174,184, 61,216,130,202, 62,196,129,181, 61,
-204, 14,196, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,182,109,100, 63,149,255,210, 62, 71,233,103, 63,
-178, 42,204, 62, 56,212,106, 63, 96,238,208, 62, 54, 86,104, 63,209,241,214, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,160,209,211, 61,108,159,195, 62, 92,248,243, 61, 96, 22,191, 62,160,107, 7, 62, 34,103,200, 62, 8, 2,232, 61,
- 20,214,203, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,182,109,100, 63,149,255,210, 62,112,206, 97, 63,
- 10,202,204, 62, 54, 47,100, 63,186,115,198, 62, 71,233,103, 63,178, 42,204, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 50, 97, 13, 62, 50, 42,186, 62, 64, 68, 21, 62,107, 55,194, 62,160,107, 7, 62, 34,103,200, 62, 92,248,243, 61,
- 96, 22,191, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,118, 1, 97, 63, 47,226,195, 62, 54, 47,100, 63,
-186,115,198, 62,112,206, 97, 63, 10,202,204, 62, 82,241, 94, 63, 40,103,198, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 64, 68, 21, 62,107, 55,194, 62, 50, 97, 13, 62, 50, 42,186, 62, 12, 43, 28, 62,186,177,184, 62, 20,225, 35, 62,
- 39, 50,188, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 96, 69, 96, 63,152,133,187, 62,112, 91, 98, 63,
-149,128,182, 62,215,139,102, 63, 15,109,193, 62, 51,113, 97, 63, 92,151,189, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 92,169, 5, 62,168,115,179, 62,228,107, 29, 62, 95,230,169, 62,140, 14, 35, 62, 33, 19,176, 62,104, 67, 29, 62,
- 58,199,177, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,177,192,109, 63,152,240,190, 62,174,241,105, 63,
-204, 8,200, 62,215,139,102, 63, 15,109,193, 62,112, 91, 98, 63,149,128,182, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 92,169, 5, 62,168,115,179, 62,228,171,229, 61, 41, 42,185, 62, 64,226,208, 61,232, 58,172, 62,228,107, 29, 62,
- 95,230,169, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,203,125,114, 63, 96,114,200, 62, 51, 37,108, 63,
-249, 3,205, 62,174,241,105, 63,204, 8,200, 62,177,192,109, 63,152,240,190, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,228,171,229, 61, 41, 42,185, 62,120, 99,202, 61,192, 49,190, 62, 16,152,145, 61, 84,214,179, 62, 64,226,208, 61,
-232, 58,172, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 42,143,114, 63, 24,168,207, 62, 56, 73,110, 63,
-186,119,206, 62, 51, 37,108, 63,249, 3,205, 62,203,125,114, 63, 96,114,200, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,120, 99,202, 61,192, 49,190, 62,244,234,179, 61,240,219,190, 62,184, 85,132, 61, 22,211,189, 62, 16,152,145, 61,
- 84,214,179, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 69,134,113, 63,156, 82,212, 62, 46,191,109, 63,
- 92, 64,210, 62, 56, 73,110, 63,186,119,206, 62, 42,143,114, 63, 24,168,207, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,244,234,179, 61,240,219,190, 62,196,129,181, 61,204, 14,196, 62, 60,114,138, 61, 28, 61,197, 62,184, 85,132, 61,
- 22,211,189, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 34, 27,109, 63,155,254,214, 62, 46,191,109, 63,
- 92, 64,210, 62, 69,134,113, 63,156, 82,212, 62, 0, 0,128, 63, 0, 0,128, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 60,114,138, 61, 28, 61,197, 62,196,129,181, 61,204, 14,196, 62, 36,174,184, 61,216,130,202, 62, 0, 0,128, 63,
- 0, 0,128, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 84,190,110, 63,223, 77,172, 62,151, 5, 90, 63,
-138, 61,167, 62, 22, 25, 96, 63,246,248,149, 62,162,176,122, 63,145,215,161, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,128, 0, 64,234, 54, 62,146,219,140, 62,194,251, 66, 62,163,102,158, 62, 8, 66,246, 61, 28,161,152, 62,172,241,189, 61,
- 13,107,132, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 49, 12,122, 63,246, 8,197, 62, 84,190,110, 63,
-223, 77,172, 62,162,176,122, 63,145,215,161, 62,188,255,126, 63,115,248,198, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 64, 0,172,241,189, 61, 13,107,132, 62, 8, 66,246, 61, 28,161,152, 62,240, 54, 16, 61,120, 4,167, 62, 0, 8,163, 58,
- 39, 69,162, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0,128, 0,183,115,119, 63,140, 49,215, 62, 49, 12,122, 63,
-246, 8,197, 62,188,255,126, 63,115,248,198, 62, 47, 6,122, 63,248,157,216, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0, 0, 8,163, 58, 39, 69,162, 62,240, 54, 16, 61,120, 4,167, 62,224,111,231, 60,100,142,198, 62,224,248, 14, 60,
- 70,141,198, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 16, 0, 41, 76,116, 63,139,153,222, 62,183,115,119, 63,
-140, 49,215, 62, 47, 6,122, 63,248,157,216, 62,134, 98,119, 63,204, 37,225, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,224,248, 14, 60, 70,141,198, 62,224,111,231, 60,100,142,198, 62,128,183, 73, 61, 84,108,213, 62, 80,210,229, 60,
- 32,239,218, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 31,178,109, 63,224, 68,228, 62, 41, 76,116, 63,
-139,153,222, 62,134, 98,119, 63,204, 37,225, 62, 46,185,115, 63, 90,157,234, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,128, 0, 80,210,229, 60, 32,239,218, 62,128,183, 73, 61, 84,108,213, 62, 28, 27,177, 61, 42,240,219, 62, 56,103,122, 61,
- 30, 10,230, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0,128, 0, 46,178,102, 63,100,184,232, 62, 31,178,109, 63,
-224, 68,228, 62, 46,185,115, 63, 90,157,234, 62,244,134,106, 63,234, 64,246, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 64, 0, 56,103,122, 61, 30, 10,230, 62, 28, 27,177, 61, 42,240,219, 62,120,216,242, 61,124, 40,225, 62,212,222,209, 61,
-238,123,240, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 16, 0,235,188, 5, 63,252, 74, 98, 63,200,111,248, 62,
-197,105,112, 63, 0, 49,231, 62,118,190,107, 63,150, 57,255, 62, 53, 14, 96, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,240, 0, 80, 99, 95, 62,149,194, 94, 63, 58, 8, 62, 62, 10,154, 89, 63, 40, 24, 92, 62, 14, 82, 74, 63,112, 11,112, 62,
-157,133, 78, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0,240, 0,235,188, 5, 63,252, 74, 98, 63,136,139, 12, 63,
-138,233,101, 63,116, 45, 6, 63,112,245,113, 63,200,111,248, 62,197,105,112, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,240, 0, 68,219, 36, 62,249,186, 81, 63, 28,254, 65, 62, 20, 55, 70, 63, 40, 24, 92, 62, 14, 82, 74, 63, 58, 8, 62, 62,
- 10,154, 89, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0,240, 0,136,139, 12, 63,138,233,101, 63, 5,130, 12, 63,
-149,216,108, 63,116, 45, 6, 63,112,245,113, 63, 0, 0,128, 63, 0, 0,128, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,112, 0, 68,219, 36, 62,249,186, 81, 63, 76, 1, 42, 62, 39,178, 73, 63, 28,254, 65, 62, 20, 55, 70, 63, 0, 0,128, 63,
- 0, 0,128, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0,112, 0,120, 89,103, 63,105, 76, 2, 63,106,154, 93, 63,
-226, 26,233, 62, 46,178,102, 63,100,184,232, 62,244,134,106, 63,234, 64,246, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 0, 0,120,216,242, 61,124, 40,225, 62,128, 1, 33, 62, 70,210,226, 62,116,128,234, 61,200, 39, 0, 63,212,222,209, 61,
-238,123,240, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,226, 44,245, 62,129,140, 96, 63,150, 57,255, 62,
- 53, 14, 96, 63, 0, 49,231, 62,118,190,107, 63, 42,135,227, 62, 58, 2,101, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0,240, 0, 80, 99, 95, 62,149,194, 94, 63,112, 11,112, 62,157,133, 78, 63, 74, 84,120, 62,104, 32, 83, 63,110,103,122, 62,
-236,255, 92, 63,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0,240, 0,216,217, 77, 63, 7,228,157, 62,160,225, 90, 63,
-110,121,137, 62, 22, 25, 96, 63,246,248,149, 62,151, 5, 90, 63,138, 61,167, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0,
- 0, 0, 16, 0, 64,234, 54, 62,146,219,140, 62,166,125, 74, 62,252, 30,130, 62,154,118,111, 62,120,108,152, 62,194,251, 66, 62,
-163,102,158, 62,208,217,115, 1, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 64, 0, 68, 65, 84, 65, 64, 31, 0, 0, 16,101,117, 1,
- 0, 0, 0, 0, 57, 0, 0, 0,208, 7, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255, 77, 69, 0, 0,120, 1, 0, 0, 32, 2,118, 1, 0, 0, 0, 0, 50, 0, 0, 0,
- 1, 0, 0, 0, 80, 83,118, 1, 0, 0, 0, 0, 96,130,116, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 77, 69, 80,108, 97,110,101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,208, 4,124, 1, 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, 83,118, 1, 0, 0, 0, 0, 16, 38,118, 1,
- 0, 0, 0, 0, 64, 44,118, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96, 5,118, 1, 0, 0, 0, 0,208, 21,118, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,192, 58,118, 1, 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,224, 3,118, 1, 0, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0, 20, 0, 0, 0,
- 0, 0, 0, 0, 80, 20,118, 1, 0, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0,144, 36,118, 1,
- 0, 0, 0, 0, 3, 0, 0, 0, 5, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0,188, 0, 0, 0, 53, 1, 0, 0, 76, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,213,204, 76, 63,255,204, 76, 63, 0, 0,104,182, 30, 0,128, 63,140, 0,128, 63,
-214,255,127, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 0, 4, 0, 0, 0, 0, 0,
- 1, 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, 68, 65, 84, 65,
- 8, 0, 0, 0, 0, 83,118, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,
- 64, 1, 0, 0,224, 3,118, 1, 0, 0, 0, 0, 5, 1, 0, 0, 5, 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, 96, 5,118, 1, 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, 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, 68, 65, 84, 65,176, 14, 0, 0, 96, 5,118, 1,
- 0, 0, 0, 0, 56, 0, 0, 0,188, 0, 0, 0,133,102,230, 63,208, 51,179, 63,146,255,127, 63,127,165, 0, 0,129, 90, 2,255,
-133,102,230, 63,206,154, 25, 63,146,255,127, 63,127,165, 0, 0,129, 90, 2,255, 81, 51,179, 63,210, 51,179, 63,148,255,127, 63,
- 0, 0, 0, 0,255,127, 2,255, 28, 0,128, 63,212, 51,179, 63,152,255,127, 63, 0, 0, 0, 0,255,127, 2,255,207,153, 25, 63,
-214, 51,179, 63,154,255,127, 63, 0, 0, 0, 0,255,127, 2,255,152,205, 76, 62,216, 51,179, 63,156,255,127, 63, 0, 0, 0, 0,
-255,127, 2,255, 80, 51,179, 63,158, 0,128, 63,148,255,127, 63, 0, 0, 0, 0,255,127, 2,255, 27, 0,128, 63,160, 0,128, 63,
-150,255,127, 63, 0, 0, 0, 0,255,127, 2,255,204,153, 25, 63,162, 0,128, 63,154,255,127, 63, 0, 0, 0, 0,255,127, 2,255,
-140,205, 76, 62,163, 0,128, 63,156,255,127, 63, 0, 0, 0, 0,255,127, 2,255, 80, 51,179, 63,209,154, 25, 63,148,255,127, 63,
- 0, 0, 0, 0,255,127, 2,255, 27, 0,128, 63,213,154, 25, 63,150,255,127, 63, 0, 0, 0, 0,255,127, 2,255,204,153, 25, 63,
-217,154, 25, 63,154,255,127, 63, 0, 0, 0, 0,255,127, 2,255,140,205, 76, 62,221,154, 25, 63,156,255,127, 63, 0, 0, 0, 0,
-255,127, 2,255, 80, 51,179, 63,160,209, 76, 62,148,255,127, 63, 0, 0, 0, 0,255,127, 2,255, 27, 0,128, 63,176,209, 76, 62,
-150,255,127, 63, 0, 0, 0, 0,255,127, 2,255,204,153, 25, 63,188,209, 76, 62,152,255,127, 63, 0, 0, 0, 0,255,127, 2,255,
-140,205, 76, 62,204,209, 76, 62,154,255,127, 63, 0, 0, 0, 0,255,127, 2,255,140,205, 76, 62, 8,103,230, 63,148,255,127, 63,
- 0, 0,127,165,129, 90, 0,255,204,153, 25, 63, 10,103,230, 63,146,255,127, 63, 0, 0,127,165,129, 90, 0,255, 27, 0,128, 63,
- 10,103,230, 63,142,255,127, 63, 0, 0,127,165,129, 90, 0,255, 80, 51,179, 63, 12,103,230, 63,140,255,127, 63, 0, 0,127,165,
-129, 90, 0,255,152,205, 76,190, 12,103,230, 63,140,255,127, 63, 0, 0,127,165,129, 90, 0,255,152,205, 76,190,160,209, 76, 62,
-148,255,127, 63, 0, 0, 0, 0,255,127, 2,255,152,205, 76,190,209,154, 25, 63,148,255,127, 63, 0, 0, 0, 0,255,127, 2,255,
-152,205, 76,190,158, 0,128, 63,148,255,127, 63, 0, 0, 0, 0,255,127, 2,255,144,205, 76,190,210, 51,179, 63,148,255,127, 63,
- 0, 0, 0, 0,255,127, 2,255,131,102,230, 63, 7,103,230, 63,148,255,127, 63, 0, 0,127,165,129, 90, 0,255,131,102,230, 63,
-160, 0,128, 63,142,255,127, 63,127,165, 0, 0,129, 90, 2,255,127,102,230, 63, 28,208, 76, 62,148,255,127, 63,127,165, 0, 0,
-129, 90, 2,255,146,205, 76,190, 72,208, 76,190,148,255,127, 63, 0, 0, 0, 0,255,127, 2,255,150,205, 76, 62, 24,208, 76,190,
-156,255,127, 63, 0, 0, 0, 0,255,127, 2,255,207,153, 25, 63, 40,208, 76,190,154,255,127, 63, 0, 0, 0, 0,255,127, 2,255,
- 28, 0,128, 63, 56,208, 76,190,152,255,127, 63, 0, 0, 0, 0,255,127, 2,255, 81, 51,179, 63, 72,208, 76,190,148,255,127, 63,
- 0, 0, 0, 0,255,127, 2,255,133,102,230, 63, 88,208, 76,190,146,255,127, 63, 0, 0, 0, 0,255,127, 2,255,133,102,230, 63,
- 88,208, 76,190, 4, 0,128,191, 0, 0, 0, 0,255,127, 2,255, 81, 51,179, 63, 72,208, 76,190, 3, 0,128,191, 0, 0, 0, 0,
-255,127, 2,255, 28, 0,128, 63, 56,208, 76,190, 1, 0,128,191, 0, 0, 0, 0,255,127, 2,255,207,153, 25, 63, 40,208, 76,190,
- 0, 0,128,191, 0, 0, 0, 0,255,127, 2,255,150,205, 76, 62, 24,208, 76,190,254,255,127,191, 0, 0, 0, 0,255,127, 2,255,
-146,205, 76,190, 72,208, 76,190, 3, 0,128,191, 0, 0, 0, 0,255,127, 2,255,127,102,230, 63, 28,208, 76, 62,155,153, 25,191,
- 1,128, 0, 0, 0, 0, 2,255,131,102,230, 63,136,201, 76,190,159,153, 25,191, 1,128, 0, 0, 0, 0, 2,255,127,102,230, 63,
- 28,208, 76, 62,193,204, 76,190, 1,128, 0, 0, 0, 0, 2,255,131,102,230, 63,136,201, 76,190,209,204, 76,190, 1,128, 0, 0,
- 0, 0, 2,255,127,102,230, 63, 28,208, 76, 62,219,204, 76, 62, 1,128, 0, 0, 0, 0, 2,255,131,102,230, 63,136,201, 76,190,
-203,204, 76, 62, 1,128, 0, 0, 0, 0, 2,255,127,102,230, 63, 28,208, 76, 62,159,153, 25, 63, 1,128, 0, 0, 0, 0, 2,255,
-131,102,230, 63,136,201, 76,190,155,153, 25, 63, 1,128, 0, 0, 0, 0, 2,255,127,102,230, 63, 28,208, 76, 62, 3, 0,128,191,
-127,165, 0, 0,129, 90, 2,255,131,102,230, 63,160, 0,128, 63, 6, 0,128,191,127,165, 0, 0,129, 90, 2,255,131,102,230, 63,
- 7,103,230, 63, 3, 0,128,191, 0, 0,127,165,129, 90, 0,255,135,102,230, 63,207,154, 25, 63,151,153, 25, 63, 1,128, 0, 0,
- 0, 0, 2,255,131,102,230, 63,156, 0,128, 63,151,153, 25, 63, 1,128, 0, 0, 0, 0, 2,255,131,102,230, 63,212, 51,179, 63,
-155,153, 25, 63, 1,128, 0, 0, 0, 0, 2,255,131,102,230, 63, 7,103,230, 63,159,153, 25, 63,127,165,127,165, 0, 0, 2,255,
-135,102,230, 63,207,154, 25, 63,171,204, 76, 62, 1,128, 0, 0, 0, 0, 2,255,131,102,230, 63,160, 0,128, 63,187,204, 76, 62,
- 1,128, 0, 0, 0, 0, 2,255,131,102,230, 63,212, 51,179, 63,203,204, 76, 62, 1,128, 0, 0, 0, 0, 2,255,131,102,230, 63,
- 7,103,230, 63,219,204, 76, 62,127,165,127,165, 0, 0, 2,255,135,102,230, 63,207,154, 25, 63,241,204, 76,190, 1,128, 0, 0,
- 0, 0, 2,255,131,102,230, 63,160, 0,128, 63,225,204, 76,190, 1,128, 0, 0, 0, 0, 2,255,131,102,230, 63,212, 51,179, 63,
-209,204, 76,190, 1,128, 0, 0, 0, 0, 2,255,131,102,230, 63, 7,103,230, 63,193,204, 76,190,127,165,127,165, 0, 0, 2,255,
-135,102,230, 63,207,154, 25, 63,167,153, 25,191, 1,128, 0, 0, 0, 0, 2,255,131,102,230, 63,160, 0,128, 63,163,153, 25,191,
- 1,128, 0, 0, 0, 0, 2,255,131,102,230, 63,212, 51,179, 63,159,153, 25,191, 1,128, 0, 0, 0, 0, 2,255,131,102,230, 63,
- 7,103,230, 63,155,153, 25,191,127,165,127,165, 0, 0, 2,255,144,205, 76,190,210, 51,179, 63, 3, 0,128,191, 0, 0, 0, 0,
-255,127, 2,255,152,205, 76,190,158, 0,128, 63, 3, 0,128,191, 0, 0, 0, 0,255,127, 2,255,152,205, 76,190,209,154, 25, 63,
- 3, 0,128,191, 0, 0, 0, 0,255,127, 2,255,152,205, 76,190,160,209, 76, 62, 3, 0,128,191, 0, 0, 0, 0,255,127, 2,255,
-152,205, 76,190, 12,103,230, 63,168,153, 25,191, 0, 0, 1,128, 0, 0, 2,255,152,205, 76,190, 12,103,230, 63,244,204, 76,190,
- 0, 0, 1,128, 0, 0, 2,255,152,205, 76,190, 12,103,230, 63,168,204, 76, 62, 0, 0, 1,128, 0, 0, 2,255,144,205, 76,190,
- 12,103,230, 63,150,153, 25, 63, 0, 0, 1,128, 0, 0, 2,255,152,205, 76,190, 12,103,230, 63, 7, 0,128,191, 0, 0,127,165,
-129, 90, 0,255, 80, 51,179, 63, 12,103,230, 63, 7, 0,128,191, 0, 0,127,165,129, 90, 0,255, 27, 0,128, 63, 10,103,230, 63,
- 6, 0,128,191, 0, 0,127,165,129, 90, 0,255,204,153, 25, 63, 10,103,230, 63, 4, 0,128,191, 0, 0,127,165,129, 90, 0,255,
-140,205, 76, 62, 8,103,230, 63, 3, 0,128,191, 0, 0,127,165,129, 90, 0,255, 81, 51,179, 63, 12,103,230, 63,150,153, 25, 63,
- 0, 0, 1,128, 0, 0, 2,255, 28, 0,128, 63, 10,103,230, 63,150,153, 25, 63, 0, 0, 1,128, 0, 0, 2,255,207,153, 25, 63,
- 10,103,230, 63,154,153, 25, 63, 0, 0, 1,128, 0, 0, 2,255,152,205, 76, 62, 8,103,230, 63,158,153, 25, 63, 0, 0, 1,128,
- 0, 0, 2,255, 80, 51,179, 63, 12,103,230, 63,168,204, 76, 62, 0, 0, 1,128, 0, 0, 2,255, 27, 0,128, 63, 10,103,230, 63,
-184,204, 76, 62, 0, 0, 1,128, 0, 0, 2,255,204,153, 25, 63, 10,103,230, 63,200,204, 76, 62, 0, 0, 1,128, 0, 0, 2,255,
-140,205, 76, 62, 8,103,230, 63,216,204, 76, 62, 0, 0, 1,128, 0, 0, 2,255, 80, 51,179, 63, 12,103,230, 63,244,204, 76,190,
- 0, 0, 1,128, 0, 0, 2,255, 27, 0,128, 63, 10,103,230, 63,228,204, 76,190, 0, 0, 1,128, 0, 0, 2,255,204,153, 25, 63,
- 10,103,230, 63,212,204, 76,190, 0, 0, 1,128, 0, 0, 2,255,140,205, 76, 62, 8,103,230, 63,196,204, 76,190, 0, 0, 1,128,
- 0, 0, 2,255, 80, 51,179, 63, 12,103,230, 63,168,153, 25,191, 0, 0, 1,128, 0, 0, 2,255, 27, 0,128, 63, 10,103,230, 63,
-164,153, 25,191, 0, 0, 1,128, 0, 0, 2,255,204,153, 25, 63, 10,103,230, 63,160,153, 25,191, 0, 0, 1,128, 0, 0, 2,255,
-140,205, 76, 62, 8,103,230, 63,156,153, 25,191, 0, 0, 1,128, 0, 0, 2,255,140,205, 76, 62,204,209, 76, 62,255,255,127,191,
- 0, 0, 0, 0,255,127, 2,255,204,153, 25, 63,188,209, 76, 62, 1, 0,128,191, 0, 0, 0, 0,255,127, 2,255, 27, 0,128, 63,
-176,209, 76, 62, 2, 0,128,191, 0, 0, 0, 0,255,127, 2,255, 80, 51,179, 63,160,209, 76, 62, 3, 0,128,191, 0, 0, 0, 0,
-255,127, 2,255,140,205, 76, 62,221,154, 25, 63,254,255,127,191, 0, 0, 0, 0,255,127, 2,255,204,153, 25, 63,217,154, 25, 63,
- 0, 0,128,191, 0, 0, 0, 0,255,127, 2,255, 27, 0,128, 63,213,154, 25, 63, 2, 0,128,191, 0, 0, 0, 0,255,127, 2,255,
- 80, 51,179, 63,209,154, 25, 63, 3, 0,128,191, 0, 0, 0, 0,255,127, 2,255,140,205, 76, 62,163, 0,128, 63,254,255,127,191,
- 0, 0, 0, 0,255,127, 2,255,204,153, 25, 63,162, 0,128, 63, 0, 0,128,191, 0, 0, 0, 0,255,127, 2,255, 27, 0,128, 63,
-160, 0,128, 63, 2, 0,128,191, 0, 0, 0, 0,255,127, 2,255, 80, 51,179, 63,158, 0,128, 63, 3, 0,128,191, 0, 0, 0, 0,
-255,127, 2,255,152,205, 76, 62,216, 51,179, 63,254,255,127,191, 0, 0, 0, 0,255,127, 2,255,207,153, 25, 63,214, 51,179, 63,
- 0, 0,128,191, 0, 0, 0, 0,255,127, 2,255, 28, 0,128, 63,212, 51,179, 63, 1, 0,128,191, 0, 0, 0, 0,255,127, 2,255,
- 81, 51,179, 63,210, 51,179, 63, 3, 0,128,191, 0, 0, 0, 0,255,127, 2,255,133,102,230, 63,206,154, 25, 63, 4, 0,128,191,
-127,165, 0, 0,129, 90, 2,255,133,102,230, 63,208, 51,179, 63, 4, 0,128,191,127,165, 0, 0,129, 90, 2,255,128,205, 76,190,
-116,201, 76, 62, 5, 0,128,191,255,127, 0, 0, 0, 0, 16,255,136,205, 76,190, 48,255,127, 63, 5, 0,128,191,255,127, 0, 0,
- 0, 0, 16,255,112,205, 76,190, 64,208, 76,190,156,153, 25,191,255,127, 0, 0, 0, 0, 16,255,112,205, 76,190, 84,201, 76, 62,
-160,153, 25,191,255,127, 0, 0, 0, 0, 18,255,120,205, 76,190,190,152, 25, 63,164,153, 25,191,255,127, 0, 0, 0, 0, 18,255,
-152,205, 76,190, 46,255,127, 63,168,153, 25,191,255,127, 0, 0, 0, 0, 18,255,112,205, 76,190, 64,208, 76,190,195,204, 76,190,
-255,127, 0, 0, 0, 0, 16,255,112,205, 76,190, 84,201, 76, 62,211,204, 76,190,255,127, 0, 0, 0, 0, 18,255,120,205, 76,190,
-190,152, 25, 63,227,204, 76,190,255,127, 0, 0, 0, 0, 18,255,152,205, 76,190, 46,255,127, 63,243,204, 76,190,255,127, 0, 0,
- 0, 0, 18,255,112,205, 76,190, 64,208, 76,190,221,204, 76, 62,255,127, 0, 0, 0, 0, 16,255,112,205, 76,190, 84,201, 76, 62,
-205,204, 76, 62,255,127, 0, 0, 0, 0, 18,255,120,205, 76,190,190,152, 25, 63,189,204, 76, 62,255,127, 0, 0, 0, 0, 18,255,
-152,205, 76,190, 46,255,127, 63,173,204, 76, 62,255,127, 0, 0, 0, 0, 18,255,112,205, 76,190, 64,208, 76,190,160,153, 25, 63,
-255,127, 0, 0, 0, 0, 16,255,112,205, 76,190, 84,201, 76, 62,156,153, 25, 63,255,127, 0, 0, 0, 0, 18,255,120,205, 76,190,
-198,152, 25, 63,152,153, 25, 63,255,127, 0, 0, 0, 0, 18,255,152,205, 76,190, 46,255,127, 63,152,153, 25, 63,255,127, 0, 0,
- 0, 0, 18,255,112,205, 76,190, 64,208, 76,190, 4, 0,128,191, 94,231, 94,231,215,132, 16,255,120,205, 76,190,190,152, 25, 63,
- 7, 0,128,191,255,127, 0, 0, 0, 0, 16,255, 96,205, 76,190,251, 50,179, 63, 4, 0,128,191,255,127, 0, 0, 0, 0, 16,255,
-128,205, 76,190, 48,102,230, 63,156,153, 25, 63,255,127, 0, 0, 0, 0, 18,255, 96,205, 76,190,251, 50,179, 63,160,153, 25, 63,
-255,127, 0, 0, 0, 0, 18,255,128,205, 76,190, 48,102,230, 63,205,204, 76, 62,255,127, 0, 0, 0, 0, 18,255, 96,205, 76,190,
-251, 50,179, 63,221,204, 76, 62,255,127, 0, 0, 0, 0, 18,255,128,205, 76,190, 48,102,230, 63,211,204, 76,190,255,127, 0, 0,
- 0, 0, 18,255, 96,205, 76,190,251, 50,179, 63,195,204, 76,190,255,127, 0, 0, 0, 0, 18,255,128,205, 76,190, 48,102,230, 63,
-160,153, 25,191,255,127, 0, 0, 0, 0, 18,255, 96,205, 76,190,251, 50,179, 63,156,153, 25,191,255,127, 0, 0, 0, 0, 18,255,
-144,205, 76,190, 10,103,230, 63, 5, 0,128,191,161,243, 93,111, 34,194, 16,255,144,205, 76,190, 10,103,230, 63,148,255,127, 63,
-161,243, 93,111,222, 61, 16,255, 96,205, 76,190,251, 50,179, 63,150,255,127, 63,255,127, 0, 0, 0, 0, 16,255,120,205, 76,190,
-190,152, 25, 63,144,255,127, 63,255,127, 0, 0, 0, 0, 16,255,112,205, 76,190, 64,208, 76,190,150,255,127, 63, 94,231, 94,231,
- 41,123, 16,255,136,205, 76,190, 48,255,127, 63,148,255,127, 63,255,127, 0, 0, 0, 0, 16,255,128,205, 76,190,116,201, 76, 62,
-148,255,127, 63,255,127, 0, 0, 0, 0, 16,255, 36, 51,179, 63, 56,208, 76,190,157,153, 25,191, 0, 0,255,127, 0, 0, 3,255,
-222,255,127, 63, 80,208, 76,190,161,153, 25,191, 0, 0,255,127, 0, 0, 3,255,116,153, 25, 63, 80,208, 76,190,165,153, 25,191,
- 0, 0,255,127, 0, 0, 3,255, 44,204, 76, 62,104,208, 76,190,169,153, 25,191, 0, 0,255,127, 0, 0, 3,255, 36, 51,179, 63,
- 56,208, 76,190,198,204, 76,190, 0, 0,255,127, 0, 0, 3,255,222,255,127, 63, 80,208, 76,190,214,204, 76,190, 0, 0,255,127,
- 0, 0, 3,255,116,153, 25, 63, 80,208, 76,190,230,204, 76,190, 0, 0,255,127, 0, 0, 3,255, 44,204, 76, 62,104,208, 76,190,
-246,204, 76,190, 0, 0,255,127, 0, 0, 3,255, 36, 51,179, 63, 56,208, 76,190,218,204, 76, 62, 0, 0,255,127, 0, 0, 3,255,
-222,255,127, 63, 80,208, 76,190,202,204, 76, 62, 0, 0,255,127, 0, 0, 3,255,116,153, 25, 63, 80,208, 76,190,186,204, 76, 62,
- 0, 0,255,127, 0, 0, 3,255, 44,204, 76, 62,104,208, 76,190,170,204, 76, 62, 0, 0,255,127, 0, 0, 3,255, 34, 51,179, 63,
- 56,208, 76,190,159,153, 25, 63, 0, 0,255,127, 0, 0, 3,255,220,255,127, 63, 80,208, 76,190,155,153, 25, 63, 0, 0,255,127,
- 0, 0, 3,255,114,153, 25, 63, 80,208, 76,190,151,153, 25, 63, 0, 0,255,127, 0, 0, 3,255, 36,204, 76, 62,104,208, 76,190,
-151,153, 25, 63, 0, 0,255,127, 0, 0, 3,255, 36, 51,179, 63, 56,208, 76,190, 4, 0,128,191, 0, 0,255,127, 0, 0, 3,255,
-222,255,127, 63, 80,208, 76,190, 5, 0,128,191, 0, 0,255,127, 0, 0, 3,255,116,153, 25, 63, 80,208, 76,190, 7, 0,128,191,
- 0, 0,255,127, 0, 0, 3,255, 44,204, 76, 62,104,208, 76,190, 8, 0,128,191, 0, 0,255,127, 0, 0, 3,255,136,102,230, 63,
- 88,208, 76,190, 8, 0,128,191, 0, 0,255,127, 0, 0, 3,255,135,102,230, 63, 88,208, 76,190,151,153, 25, 63, 0, 0,255,127,
- 0, 0, 3,255,136,102,230, 63, 88,208, 76,190,170,204, 76, 62, 0, 0,255,127, 0, 0, 3,255,136,102,230, 63, 88,208, 76,190,
-246,204, 76,190, 0, 0,255,127, 0, 0, 3,255,136,102,230, 63, 88,208, 76,190,169,153, 25,191, 0, 0,255,127, 0, 0, 3,255,
-112,205, 76,190, 64,208, 76,190,156,153, 25,191, 0, 0,255,127, 0, 0, 1,255,112,205, 76,190, 64,208, 76,190,195,204, 76,190,
- 0, 0,255,127, 0, 0, 1,255,112,205, 76,190, 64,208, 76,190,221,204, 76, 62, 0, 0,255,127, 0, 0, 1,255,112,205, 76,190,
- 64,208, 76,190,160,153, 25, 63, 0, 0,255,127, 0, 0, 1,255,112,205, 76,190, 64,208, 76,190, 4, 0,128,191, 0, 0,255,127,
- 0, 0, 3,255,112,205, 76,190, 64,208, 76,190,150,255,127, 63, 0, 0,255,127, 0, 0, 3,255,136,102,230, 63, 88,208, 76,190,
-142,255,127, 63, 0, 0,255,127, 0, 0, 3,255, 44,204, 76, 62,104,208, 76,190,142,255,127, 63, 0, 0,255,127, 0, 0, 3,255,
-116,153, 25, 63, 80,208, 76,190,144,255,127, 63, 0, 0,255,127, 0, 0, 3,255,222,255,127, 63, 80,208, 76,190,148,255,127, 63,
- 0, 0,255,127, 0, 0, 3,255, 36, 51,179, 63, 56,208, 76,190,150,255,127, 63, 0, 0,255,127, 0, 0, 3,255, 68, 65, 84, 65,
- 64, 1, 0, 0, 80, 20,118, 1, 0, 0, 0, 0, 5, 1, 0, 0, 5, 0, 0, 0, 3, 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,208, 21,118, 1, 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, 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, 68, 65, 84, 65,124, 14, 0, 0,208, 21,118, 1,
- 0, 0, 0, 0, 53, 0, 0, 0, 53, 1, 0, 0, 21, 0, 0, 0, 82, 0, 0, 0, 0, 0, 34, 0, 20, 0, 0, 0, 83, 0, 0, 0,
- 0, 0, 34, 0, 19, 0, 0, 0, 84, 0, 0, 0, 0, 0, 34, 0, 18, 0, 0, 0, 85, 0, 0, 0, 0, 0, 34, 0, 22, 0, 0, 0,
- 76, 0, 0, 0, 0, 0, 34, 0, 1, 0, 0, 0, 53, 0, 0, 0, 0, 0, 34, 0, 28, 0, 0, 0, 54, 0, 0, 0, 0, 0, 34, 0,
- 0, 0, 0, 0, 55, 0, 0, 0, 0, 0, 34, 0, 27, 0, 0, 0, 56, 0, 0, 0, 0, 0, 34, 0, 29, 0, 0, 0, 48, 0, 0, 0,
- 0, 0, 34, 0, 4, 0, 0, 0, 5, 0, 0, 0, 0, 0, 34, 0, 3, 0, 0, 0, 4, 0, 0, 0, 0, 0, 34, 0, 2, 0, 0, 0,
- 3, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 34, 0, 5, 0, 0, 0, 9, 0, 0, 0, 0, 0, 34, 0,
- 8, 0, 0, 0, 9, 0, 0, 0, 0, 0, 34, 0, 4, 0, 0, 0, 8, 0, 0, 0, 0, 0, 34, 0, 7, 0, 0, 0, 8, 0, 0, 0,
- 0, 0, 34, 0, 3, 0, 0, 0, 7, 0, 0, 0, 0, 0, 34, 0, 6, 0, 0, 0, 7, 0, 0, 0, 0, 0, 34, 0, 2, 0, 0, 0,
- 6, 0, 0, 0, 0, 0, 34, 0, 9, 0, 0, 0, 13, 0, 0, 0, 0, 0, 34, 0, 12, 0, 0, 0, 13, 0, 0, 0, 0, 0, 34, 0,
- 8, 0, 0, 0, 12, 0, 0, 0, 0, 0, 34, 0, 11, 0, 0, 0, 12, 0, 0, 0, 0, 0, 34, 0, 7, 0, 0, 0, 11, 0, 0, 0,
- 0, 0, 34, 0, 10, 0, 0, 0, 11, 0, 0, 0, 0, 0, 34, 0, 6, 0, 0, 0, 10, 0, 0, 0, 0, 0, 34, 0, 1, 0, 0, 0,
- 10, 0, 0, 0, 0, 0, 34, 0, 13, 0, 0, 0, 17, 0, 0, 0, 0, 0, 34, 0, 16, 0, 0, 0, 17, 0, 0, 0, 0, 0, 34, 0,
- 12, 0, 0, 0, 16, 0, 0, 0, 0, 0, 34, 0, 15, 0, 0, 0, 16, 0, 0, 0, 0, 0, 34, 0, 11, 0, 0, 0, 15, 0, 0, 0,
- 0, 0, 34, 0, 14, 0, 0, 0, 15, 0, 0, 0, 0, 0, 34, 0, 10, 0, 0, 0, 14, 0, 0, 0, 0, 0, 34, 0, 19, 0, 0, 0,
- 20, 0, 0, 0, 0, 0, 34, 0, 2, 0, 0, 0, 21, 0, 0, 0, 0, 0, 34, 0, 3, 0, 0, 0, 20, 0, 0, 0, 0, 0, 34, 0,
- 4, 0, 0, 0, 19, 0, 0, 0, 0, 0, 34, 0, 5, 0, 0, 0, 18, 0, 0, 0, 0, 0, 34, 0, 22, 0, 0, 0, 26, 0, 0, 0,
- 0, 0, 34, 0, 24, 0, 0, 0, 25, 0, 0, 0, 0, 0, 34, 0, 18, 0, 0, 0, 22, 0, 0, 0, 0, 0, 34, 0, 17, 0, 0, 0,
- 23, 0, 0, 0, 0, 0, 34, 0, 13, 0, 0, 0, 24, 0, 0, 0, 0, 0, 34, 0, 9, 0, 0, 0, 25, 0, 0, 0, 0, 0, 34, 0,
- 5, 0, 0, 0, 26, 0, 0, 0, 0, 0, 34, 0, 1, 0, 0, 0, 28, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 28, 0, 0, 0,
- 0, 0, 34, 0, 0, 0, 0, 0, 27, 0, 0, 0, 0, 0, 34, 0, 1, 0, 0, 0, 29, 0, 0, 0, 0, 0, 34, 0, 21, 0, 0, 0,
- 27, 0, 0, 0, 0, 0, 34, 0, 14, 0, 0, 0, 29, 0, 0, 0, 0, 0, 34, 0, 6, 0, 0, 0, 28, 0, 0, 0, 0, 0, 34, 0,
- 30, 0, 0, 0, 31, 0, 0, 0, 0, 0, 34, 0, 34, 0, 0, 0, 35, 0, 0, 0, 0, 0, 34, 0, 32, 0, 0, 0, 33, 0, 0, 0,
- 0, 0, 34, 0, 29, 0, 0, 0, 35, 0, 0, 0, 0, 0, 34, 0, 23, 0, 0, 0, 30, 0, 0, 0, 0, 0, 34, 0, 14, 0, 0, 0,
- 34, 0, 0, 0, 0, 0, 34, 0, 15, 0, 0, 0, 33, 0, 0, 0, 0, 0, 34, 0, 16, 0, 0, 0, 32, 0, 0, 0, 0, 0, 34, 0,
- 17, 0, 0, 0, 31, 0, 0, 0, 0, 0, 34, 0, 40, 0, 0, 0, 98, 0, 0, 0, 0, 0, 34, 0, 39, 0, 0, 0, 99, 0, 0, 0,
- 0, 0, 34, 0, 38, 0, 0, 0,100, 0, 0, 0, 0, 0, 34, 0, 37, 0, 0, 0,101, 0, 0, 0, 0, 0, 34, 0, 41, 0, 0, 0,
- 72, 0, 0, 0, 0, 0, 34, 0, 36, 0, 0, 0, 50, 0, 0, 0, 0, 0, 34, 0, 38, 0, 0, 0, 39, 0, 0, 0, 0, 0, 34, 0,
- 36, 0, 0, 0, 37, 0, 0, 0, 0, 0, 34, 0, 40, 0, 0, 0, 41, 0, 0, 0, 0, 0, 34, 0, 51, 0, 0, 0,109, 0, 0, 0,
- 0, 0, 34, 0, 50, 0, 0, 0,101, 0, 0, 0, 0, 0, 34, 0, 68, 0, 0, 0, 94, 0, 0, 0, 0, 0, 34, 0, 64, 0, 0, 0,
- 90, 0, 0, 0, 0, 0, 34, 0, 60, 0, 0, 0, 86, 0, 0, 0, 0, 0, 34, 0, 56, 0, 0, 0, 82, 0, 0, 0, 0, 0, 34, 0,
- 52, 0, 0, 0, 78, 0, 0, 0, 0, 0, 34, 0, 50, 0, 0, 0,114, 0, 0, 0, 0, 0, 34, 0, 65, 0, 0, 0,114, 0, 0, 0,
- 0, 0, 34, 0, 67, 0, 0, 0,115, 0, 0, 0, 0, 0, 34, 0, 52, 0, 0, 0,115, 0, 0, 0, 0, 0, 34, 0, 51, 0, 0, 0,
-115, 0, 0, 0, 0, 0, 34, 0, 51, 0, 0, 0,114, 0, 0, 0, 0, 0, 34, 0, 42, 0, 0, 0, 50, 0, 0, 0, 0, 0, 34, 0,
- 43, 0, 0, 0, 45, 0, 0, 0, 0, 0, 34, 0, 42, 0, 0, 0, 43, 0, 0, 0, 0, 0, 34, 0, 42, 0, 0, 0, 44, 0, 0, 0,
- 0, 0, 34, 0, 44, 0, 0, 0, 45, 0, 0, 0, 0, 0, 34, 0, 44, 0, 0, 0, 46, 0, 0, 0, 0, 0, 34, 0, 47, 0, 0, 0,
- 49, 0, 0, 0, 0, 0, 34, 0, 46, 0, 0, 0, 47, 0, 0, 0, 0, 0, 34, 0, 46, 0, 0, 0, 48, 0, 0, 0, 0, 0, 34, 0,
- 48, 0, 0, 0, 49, 0, 0, 0, 0, 0, 34, 0, 55, 0, 0, 0, 56, 0, 0, 0, 0, 0, 34, 0, 54, 0, 0, 0, 55, 0, 0, 0,
- 0, 0, 34, 0, 53, 0, 0, 0, 54, 0, 0, 0, 0, 0, 34, 0, 56, 0, 0, 0, 60, 0, 0, 0, 0, 0, 34, 0, 59, 0, 0, 0,
- 60, 0, 0, 0, 0, 0, 34, 0, 55, 0, 0, 0, 59, 0, 0, 0, 0, 0, 34, 0, 58, 0, 0, 0, 59, 0, 0, 0, 0, 0, 34, 0,
- 54, 0, 0, 0, 58, 0, 0, 0, 0, 0, 34, 0, 57, 0, 0, 0, 58, 0, 0, 0, 0, 0, 34, 0, 53, 0, 0, 0, 57, 0, 0, 0,
- 0, 0, 34, 0, 60, 0, 0, 0, 64, 0, 0, 0, 0, 0, 34, 0, 63, 0, 0, 0, 64, 0, 0, 0, 0, 0, 34, 0, 59, 0, 0, 0,
- 63, 0, 0, 0, 0, 0, 34, 0, 62, 0, 0, 0, 63, 0, 0, 0, 0, 0, 34, 0, 58, 0, 0, 0, 62, 0, 0, 0, 0, 0, 34, 0,
- 61, 0, 0, 0, 62, 0, 0, 0, 0, 0, 34, 0, 57, 0, 0, 0, 61, 0, 0, 0, 0, 0, 34, 0, 64, 0, 0, 0, 68, 0, 0, 0,
- 0, 0, 34, 0, 67, 0, 0, 0, 68, 0, 0, 0, 0, 0, 34, 0, 63, 0, 0, 0, 67, 0, 0, 0, 0, 0, 34, 0, 66, 0, 0, 0,
- 67, 0, 0, 0, 0, 0, 34, 0, 62, 0, 0, 0, 66, 0, 0, 0, 0, 0, 34, 0, 65, 0, 0, 0, 66, 0, 0, 0, 0, 0, 34, 0,
- 61, 0, 0, 0, 65, 0, 0, 0, 0, 0, 34, 0, 52, 0, 0, 0, 68, 0, 0, 0, 0, 0, 34, 0, 51, 0, 0, 0, 66, 0, 0, 0,
- 0, 0, 34, 0, 48, 0, 0, 0, 53, 0, 0, 0, 0, 0, 34, 0, 46, 0, 0, 0, 57, 0, 0, 0, 0, 0, 34, 0, 44, 0, 0, 0,
- 61, 0, 0, 0, 0, 0, 34, 0, 42, 0, 0, 0, 65, 0, 0, 0, 0, 0, 34, 0, 69, 0, 0, 0,110, 0, 0, 0, 0, 0, 34, 0,
- 70, 0, 0, 0,106, 0, 0, 0, 0, 0, 34, 0, 71, 0, 0, 0,102, 0, 0, 0, 0, 0, 34, 0, 72, 0, 0, 0, 98, 0, 0, 0,
- 0, 0, 34, 0, 73, 0, 0, 0, 97, 0, 0, 0, 0, 0, 34, 0, 74, 0, 0, 0, 93, 0, 0, 0, 0, 0, 34, 0, 75, 0, 0, 0,
- 89, 0, 0, 0, 0, 0, 34, 0, 76, 0, 0, 0, 85, 0, 0, 0, 0, 0, 34, 0, 77, 0, 0, 0, 81, 0, 0, 0, 0, 0, 34, 0,
- 70, 0, 0, 0, 71, 0, 0, 0, 0, 0, 34, 0, 73, 0, 0, 0, 77, 0, 0, 0, 0, 0, 34, 0, 74, 0, 0, 0, 75, 0, 0, 0,
- 0, 0, 34, 0, 69, 0, 0, 0, 77, 0, 0, 0, 0, 0, 34, 0, 81, 0, 0, 0,110, 0, 0, 0, 0, 0, 34, 0, 80, 0, 0, 0,
-111, 0, 0, 0, 0, 0, 34, 0, 79, 0, 0, 0,112, 0, 0, 0, 0, 0, 34, 0, 78, 0, 0, 0,113, 0, 0, 0, 0, 0, 34, 0,
- 79, 0, 0, 0, 80, 0, 0, 0, 0, 0, 34, 0, 84, 0, 0, 0, 85, 0, 0, 0, 0, 0, 34, 0, 83, 0, 0, 0, 84, 0, 0, 0,
- 0, 0, 34, 0, 82, 0, 0, 0, 83, 0, 0, 0, 0, 0, 34, 0, 85, 0, 0, 0, 89, 0, 0, 0, 0, 0, 34, 0, 88, 0, 0, 0,
- 89, 0, 0, 0, 0, 0, 34, 0, 84, 0, 0, 0, 88, 0, 0, 0, 0, 0, 34, 0, 87, 0, 0, 0, 88, 0, 0, 0, 0, 0, 34, 0,
- 83, 0, 0, 0, 87, 0, 0, 0, 0, 0, 34, 0, 86, 0, 0, 0, 87, 0, 0, 0, 0, 0, 34, 0, 82, 0, 0, 0, 86, 0, 0, 0,
- 0, 0, 34, 0, 89, 0, 0, 0, 93, 0, 0, 0, 0, 0, 34, 0, 92, 0, 0, 0, 93, 0, 0, 0, 0, 0, 34, 0, 88, 0, 0, 0,
- 92, 0, 0, 0, 0, 0, 34, 0, 91, 0, 0, 0, 92, 0, 0, 0, 0, 0, 34, 0, 87, 0, 0, 0, 91, 0, 0, 0, 0, 0, 34, 0,
- 90, 0, 0, 0, 91, 0, 0, 0, 0, 0, 34, 0, 86, 0, 0, 0, 90, 0, 0, 0, 0, 0, 34, 0, 93, 0, 0, 0, 97, 0, 0, 0,
- 0, 0, 34, 0, 96, 0, 0, 0, 97, 0, 0, 0, 0, 0, 34, 0, 92, 0, 0, 0, 96, 0, 0, 0, 0, 0, 34, 0, 95, 0, 0, 0,
- 96, 0, 0, 0, 0, 0, 34, 0, 91, 0, 0, 0, 95, 0, 0, 0, 0, 0, 34, 0, 94, 0, 0, 0, 95, 0, 0, 0, 0, 0, 34, 0,
- 90, 0, 0, 0, 94, 0, 0, 0, 0, 0, 34, 0, 81, 0, 0, 0, 97, 0, 0, 0, 0, 0, 34, 0, 80, 0, 0, 0, 96, 0, 0, 0,
- 0, 0, 34, 0, 79, 0, 0, 0, 95, 0, 0, 0, 0, 0, 34, 0, 78, 0, 0, 0, 94, 0, 0, 0, 0, 0, 34, 0,101, 0, 0, 0,
-105, 0, 0, 0, 0, 0, 34, 0,100, 0, 0, 0,101, 0, 0, 0, 0, 0, 34, 0,100, 0, 0, 0,104, 0, 0, 0, 0, 0, 34, 0,
- 99, 0, 0, 0,100, 0, 0, 0, 0, 0, 34, 0, 99, 0, 0, 0,103, 0, 0, 0, 0, 0, 34, 0, 98, 0, 0, 0, 99, 0, 0, 0,
- 0, 0, 34, 0, 98, 0, 0, 0,102, 0, 0, 0, 0, 0, 34, 0,105, 0, 0, 0,114, 0, 0, 0, 0, 0, 34, 0,105, 0, 0, 0,
-109, 0, 0, 0, 0, 0, 34, 0,104, 0, 0, 0,105, 0, 0, 0, 0, 0, 34, 0,104, 0, 0, 0,108, 0, 0, 0, 0, 0, 34, 0,
-103, 0, 0, 0,104, 0, 0, 0, 0, 0, 34, 0,103, 0, 0, 0,107, 0, 0, 0, 0, 0, 34, 0,102, 0, 0, 0,103, 0, 0, 0,
- 0, 0, 34, 0,102, 0, 0, 0,106, 0, 0, 0, 0, 0, 34, 0,109, 0, 0, 0,113, 0, 0, 0, 0, 0, 34, 0,108, 0, 0, 0,
-109, 0, 0, 0, 0, 0, 34, 0,108, 0, 0, 0,112, 0, 0, 0, 0, 0, 34, 0,107, 0, 0, 0,108, 0, 0, 0, 0, 0, 34, 0,
-107, 0, 0, 0,111, 0, 0, 0, 0, 0, 34, 0,106, 0, 0, 0,107, 0, 0, 0, 0, 0, 34, 0,106, 0, 0, 0,110, 0, 0, 0,
- 0, 0, 34, 0,113, 0, 0, 0,115, 0, 0, 0, 0, 0, 34, 0,112, 0, 0, 0,113, 0, 0, 0, 0, 0, 34, 0,111, 0, 0, 0,
-112, 0, 0, 0, 0, 0, 34, 0,110, 0, 0, 0,111, 0, 0, 0, 0, 0, 34, 0,121, 0, 0, 0,144, 0, 0, 0, 0, 0, 50, 0,
-125, 0, 0, 0,142, 0, 0, 0, 0, 0, 50, 0,129, 0, 0, 0,140, 0, 0, 0, 0, 0, 50, 0,133, 0, 0, 0,138, 0, 0, 0,
- 0, 0, 50, 0,120, 0, 0, 0,135, 0, 0, 0, 0, 0, 50, 0,118, 0, 0, 0,134, 0, 0, 0, 0, 0,178, 0,121, 0, 0, 0,
-125, 0, 0, 0, 0, 0, 50, 0,120, 0, 0, 0,121, 0, 0, 0, 0, 0, 50, 0,120, 0, 0, 0,124, 0, 0, 0, 0, 0, 50, 0,
-120, 0, 0, 0,119, 0, 0, 0, 0, 0, 50, 0,119, 0, 0, 0,123, 0, 0, 0, 0, 0, 50, 0,118, 0, 0, 0,119, 0, 0, 0,
- 0, 0, 50, 0,118, 0, 0, 0,122, 0, 0, 0, 0, 0, 50, 0,125, 0, 0, 0,129, 0, 0, 0, 0, 0, 50, 0,124, 0, 0, 0,
-125, 0, 0, 0, 0, 0, 50, 0,124, 0, 0, 0,128, 0, 0, 0, 0, 0, 50, 0,123, 0, 0, 0,124, 0, 0, 0, 0, 0, 50, 0,
-123, 0, 0, 0,127, 0, 0, 0, 0, 0, 50, 0,122, 0, 0, 0,123, 0, 0, 0, 0, 0, 50, 0,122, 0, 0, 0,126, 0, 0, 0,
- 0, 0,178, 0,129, 0, 0, 0,133, 0, 0, 0, 0, 0, 50, 0,128, 0, 0, 0,129, 0, 0, 0, 0, 0, 50, 0,128, 0, 0, 0,
-132, 0, 0, 0, 0, 0, 50, 0,127, 0, 0, 0,128, 0, 0, 0, 0, 0, 50, 0,127, 0, 0, 0,131, 0, 0, 0, 0, 0, 50, 0,
-126, 0, 0, 0,127, 0, 0, 0, 0, 0, 50, 0,126, 0, 0, 0,130, 0, 0, 0, 0, 0, 50, 0,132, 0, 0, 0,133, 0, 0, 0,
- 0, 0, 50, 0,131, 0, 0, 0,132, 0, 0, 0, 0, 0, 50, 0,130, 0, 0, 0,131, 0, 0, 0, 0, 0, 50, 0,137, 0, 0, 0,
-138, 0, 0, 0, 0, 0, 50, 0,138, 0, 0, 0,140, 0, 0, 0, 0, 0, 50, 0,139, 0, 0, 0,140, 0, 0, 0, 0, 0, 50, 0,
-137, 0, 0, 0,139, 0, 0, 0, 0, 0, 50, 0,140, 0, 0, 0,142, 0, 0, 0, 0, 0, 50, 0,141, 0, 0, 0,142, 0, 0, 0,
- 0, 0, 50, 0,142, 0, 0, 0,144, 0, 0, 0, 0, 0, 50, 0,143, 0, 0, 0,144, 0, 0, 0, 0, 0, 50, 0,141, 0, 0, 0,
-143, 0, 0, 0, 0, 0, 50, 0,136, 0, 0, 0,144, 0, 0, 0, 0, 0, 50, 0,117, 0, 0, 0,135, 0, 0, 0, 0, 0,178, 0,
-116, 0, 0, 0,135, 0, 0, 0, 0, 0, 50, 0,116, 0, 0, 0,134, 0, 0, 0, 0, 0,178, 0,119, 0, 0, 0,116, 0, 0, 0,
- 0, 0, 50, 0,117, 0, 0, 0,121, 0, 0, 0, 0, 0, 50, 0,117, 0, 0, 0,136, 0, 0, 0, 0, 0, 50, 0,136, 0, 0, 0,
-145, 0, 0, 0, 0, 0,178, 0,146, 0, 0, 0,147, 0, 0, 0, 0, 0,178, 0,147, 0, 0, 0,150, 0, 0, 0, 0, 0, 50, 0,
-149, 0, 0, 0,151, 0, 0, 0, 0, 0,178, 0,148, 0, 0, 0,151, 0, 0, 0, 0, 0, 50, 0,148, 0, 0, 0,150, 0, 0, 0,
- 0, 0,178, 0,138, 0, 0, 0,147, 0, 0, 0, 0, 0, 50, 0,130, 0, 0, 0,149, 0, 0, 0, 0, 0,178, 0,131, 0, 0, 0,
-151, 0, 0, 0, 0, 0, 50, 0,132, 0, 0, 0,148, 0, 0, 0, 0, 0, 50, 0,133, 0, 0, 0,150, 0, 0, 0, 0, 0, 50, 0,
-155, 0, 0, 0,171, 0, 0, 0, 0, 0, 35, 0,154, 0, 0, 0,170, 0, 0, 0, 0, 0, 35, 0,153, 0, 0, 0,169, 0, 0, 0,
- 0, 0, 35, 0,152, 0, 0, 0,168, 0, 0, 0, 0, 0, 35, 0,155, 0, 0, 0,159, 0, 0, 0, 0, 0, 35, 0,154, 0, 0, 0,
-155, 0, 0, 0, 0, 0, 35, 0,154, 0, 0, 0,158, 0, 0, 0, 0, 0, 35, 0,153, 0, 0, 0,154, 0, 0, 0, 0, 0, 35, 0,
-153, 0, 0, 0,157, 0, 0, 0, 0, 0, 35, 0,152, 0, 0, 0,153, 0, 0, 0, 0, 0, 35, 0,152, 0, 0, 0,156, 0, 0, 0,
- 0, 0, 35, 0,159, 0, 0, 0,163, 0, 0, 0, 0, 0, 35, 0,158, 0, 0, 0,159, 0, 0, 0, 0, 0, 35, 0,158, 0, 0, 0,
-162, 0, 0, 0, 0, 0, 35, 0,157, 0, 0, 0,158, 0, 0, 0, 0, 0, 35, 0,157, 0, 0, 0,161, 0, 0, 0, 0, 0, 35, 0,
-156, 0, 0, 0,157, 0, 0, 0, 0, 0, 35, 0,156, 0, 0, 0,160, 0, 0, 0, 0, 0, 35, 0,163, 0, 0, 0,167, 0, 0, 0,
- 0, 0, 35, 0,162, 0, 0, 0,163, 0, 0, 0, 0, 0, 35, 0,162, 0, 0, 0,166, 0, 0, 0, 0, 0, 35, 0,161, 0, 0, 0,
-162, 0, 0, 0, 0, 0, 35, 0,161, 0, 0, 0,165, 0, 0, 0, 0, 0, 35, 0,160, 0, 0, 0,161, 0, 0, 0, 0, 0, 35, 0,
-160, 0, 0, 0,164, 0, 0, 0, 0, 0, 35, 0,166, 0, 0, 0,167, 0, 0, 0, 0, 0, 35, 0,165, 0, 0, 0,166, 0, 0, 0,
- 0, 0, 35, 0,164, 0, 0, 0,165, 0, 0, 0, 0, 0, 35, 0,169, 0, 0, 0,170, 0, 0, 0, 0, 0, 35, 0,174, 0, 0, 0,
-175, 0, 0, 0, 0, 0, 35, 0,172, 0, 0, 0,176, 0, 0, 0, 0, 0, 35, 0,168, 0, 0, 0,172, 0, 0, 0, 0, 0, 35, 0,
-164, 0, 0, 0,173, 0, 0, 0, 0, 0, 35, 0,160, 0, 0, 0,174, 0, 0, 0, 0, 0, 35, 0,156, 0, 0, 0,175, 0, 0, 0,
- 0, 0, 35, 0,152, 0, 0, 0,176, 0, 0, 0, 0, 0, 35, 0,177, 0, 0, 0,181, 0, 0, 0, 0, 0, 35, 0,177, 0, 0, 0,
-178, 0, 0, 0, 0, 0,163, 0,178, 0, 0, 0,179, 0, 0, 0, 0, 0, 35, 0,179, 0, 0, 0,180, 0, 0, 0, 0, 0,163, 0,
-171, 0, 0, 0,181, 0, 0, 0, 0, 0, 35, 0,167, 0, 0, 0,180, 0, 0, 0, 0, 0, 35, 0,163, 0, 0, 0,179, 0, 0, 0,
- 0, 0, 35, 0,159, 0, 0, 0,178, 0, 0, 0, 0, 0, 35, 0,155, 0, 0, 0,177, 0, 0, 0, 0, 0, 35, 0,182, 0, 0, 0,
-184, 0, 0, 0, 0, 0, 35, 0,183, 0, 0, 0,187, 0, 0, 0, 0, 0, 35, 0,185, 0, 0, 0,186, 0, 0, 0, 0, 0, 35, 0,
-180, 0, 0, 0,182, 0, 0, 0, 0, 0, 35, 0,173, 0, 0, 0,183, 0, 0, 0, 0, 0, 35, 0,164, 0, 0, 0,187, 0, 0, 0,
- 0, 0, 35, 0,165, 0, 0, 0,186, 0, 0, 0, 0, 0, 35, 0,166, 0, 0, 0,185, 0, 0, 0, 0, 0, 35, 0,167, 0, 0, 0,
-184, 0, 0, 0, 0, 0, 35, 0, 68, 65, 84, 65, 64, 1, 0, 0,144, 36,118, 1, 0, 0, 0, 0, 5, 1, 0, 0, 5, 0, 0, 0,
- 4, 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, 16, 38,118, 1, 0, 0, 0, 0,
- 5, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 85, 86, 84,101,120, 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, 64, 44,118, 1, 0, 0, 0, 0,
- 6, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67,111,108, 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,192, 58,118, 1, 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,
- 68, 65, 84, 65,240, 5, 0, 0, 16, 38,118, 1, 0, 0, 0, 0, 52, 0, 0, 0, 76, 0, 0, 0, 18, 0, 0, 0, 22, 0, 0, 0,
- 26, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 19, 0, 0, 0, 4, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0,
- 2, 0, 0, 0, 0, 0, 0, 0, 27, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 9, 0, 0, 0,
- 8, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 7, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0,
- 25, 0, 0, 0, 24, 0, 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 8, 0, 0, 0, 12, 0, 0, 0, 11, 0, 0, 0,
- 0, 0, 0, 0, 28, 0, 0, 0, 6, 0, 0, 0, 10, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 13, 0, 0, 0,
- 17, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 11, 0, 0, 0, 15, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0,
- 17, 0, 0, 0, 23, 0, 0, 0, 30, 0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 16, 0, 0, 0, 32, 0, 0, 0,
- 33, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 35, 0, 0, 0, 29, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0,
- 65, 0, 0, 0,114, 0, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 45, 0, 0, 0, 44, 0, 0, 0, 42, 0, 0, 0, 43, 0, 0, 0,
- 0, 0, 0, 0, 46, 0, 0, 0, 57, 0, 0, 0, 61, 0, 0, 0, 44, 0, 0, 0, 0, 0, 0, 0, 49, 0, 0, 0, 48, 0, 0, 0,
- 46, 0, 0, 0, 47, 0, 0, 0, 0, 0, 0, 0, 29, 0, 0, 0, 1, 0, 0, 0, 53, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0,
- 28, 0, 0, 0, 0, 0, 0, 0, 55, 0, 0, 0, 54, 0, 0, 0, 0, 0, 0, 0, 55, 0, 0, 0, 56, 0, 0, 0, 60, 0, 0, 0,
- 59, 0, 0, 0, 0, 0, 0, 0, 53, 0, 0, 0, 54, 0, 0, 0, 58, 0, 0, 0, 57, 0, 0, 0, 0, 0, 0, 0, 58, 0, 0, 0,
- 59, 0, 0, 0, 63, 0, 0, 0, 62, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 64, 0, 0, 0, 68, 0, 0, 0, 67, 0, 0, 0,
- 0, 0, 0, 0, 61, 0, 0, 0, 62, 0, 0, 0, 66, 0, 0, 0, 65, 0, 0, 0, 0, 0, 0, 0,115, 0, 0, 0, 51, 0, 0, 0,
- 66, 0, 0, 0, 67, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 22, 0, 0, 0, 76, 0, 0, 0, 85, 0, 0, 0, 0, 0, 0, 0,
- 20, 0, 0, 0, 19, 0, 0, 0, 84, 0, 0, 0, 83, 0, 0, 0, 0, 0, 0, 0, 27, 0, 0, 0, 21, 0, 0, 0, 82, 0, 0, 0,
- 56, 0, 0, 0, 0, 0, 0, 0, 84, 0, 0, 0, 85, 0, 0, 0, 89, 0, 0, 0, 88, 0, 0, 0, 0, 0, 0, 0, 82, 0, 0, 0,
- 83, 0, 0, 0, 87, 0, 0, 0, 86, 0, 0, 0, 0, 0, 0, 0, 89, 0, 0, 0, 75, 0, 0, 0, 74, 0, 0, 0, 93, 0, 0, 0,
- 0, 0, 0, 0, 87, 0, 0, 0, 88, 0, 0, 0, 92, 0, 0, 0, 91, 0, 0, 0, 0, 0, 0, 0, 60, 0, 0, 0, 86, 0, 0, 0,
- 90, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 92, 0, 0, 0, 93, 0, 0, 0, 97, 0, 0, 0, 96, 0, 0, 0, 0, 0, 0, 0,
- 90, 0, 0, 0, 91, 0, 0, 0, 95, 0, 0, 0, 94, 0, 0, 0, 0, 0, 0, 0, 97, 0, 0, 0, 73, 0, 0, 0, 77, 0, 0, 0,
- 81, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 96, 0, 0, 0, 80, 0, 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, 78, 0, 0, 0,
- 52, 0, 0, 0, 68, 0, 0, 0, 94, 0, 0, 0, 0, 0, 0, 0, 37, 0, 0, 0, 36, 0, 0, 0, 50, 0, 0, 0,101, 0, 0, 0,
- 0, 0, 0, 0,100, 0, 0, 0, 99, 0, 0, 0, 39, 0, 0, 0, 38, 0, 0, 0, 0, 0, 0, 0, 98, 0, 0, 0, 72, 0, 0, 0,
- 41, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0,105, 0, 0, 0,104, 0, 0, 0,100, 0, 0, 0,101, 0, 0, 0, 0, 0, 0, 0,
-103, 0, 0, 0,102, 0, 0, 0, 98, 0, 0, 0, 99, 0, 0, 0, 0, 0, 0, 0, 51, 0, 0, 0,109, 0, 0, 0,105, 0, 0, 0,
-114, 0, 0, 0, 0, 0, 0, 0,108, 0, 0, 0,107, 0, 0, 0,103, 0, 0, 0,104, 0, 0, 0, 0, 0, 0, 0,106, 0, 0, 0,
- 70, 0, 0, 0, 71, 0, 0, 0,102, 0, 0, 0, 0, 0, 0, 0,113, 0, 0, 0,112, 0, 0, 0,108, 0, 0, 0,109, 0, 0, 0,
- 0, 0, 0, 0,111, 0, 0, 0,110, 0, 0, 0,106, 0, 0, 0,107, 0, 0, 0, 0, 0, 0, 0,113, 0, 0, 0,115, 0, 0, 0,
- 52, 0, 0, 0, 78, 0, 0, 0, 0, 0, 0, 0, 79, 0, 0, 0, 80, 0, 0, 0,111, 0, 0, 0,112, 0, 0, 0, 0, 0, 0, 0,
- 81, 0, 0, 0, 77, 0, 0, 0, 69, 0, 0, 0,110, 0, 0, 0, 0, 0, 0, 0,116, 0, 0, 0,135, 0, 0, 0,120, 0, 0, 0,
-119, 0, 0, 0, 0, 0, 0, 16,125, 0, 0, 0,124, 0, 0, 0,120, 0, 0, 0,121, 0, 0, 0, 0, 0, 0, 16,123, 0, 0, 0,
-122, 0, 0, 0,118, 0, 0, 0,119, 0, 0, 0, 0, 0, 0, 16,128, 0, 0, 0,127, 0, 0, 0,123, 0, 0, 0,124, 0, 0, 0,
- 0, 0, 0, 16,133, 0, 0, 0,132, 0, 0, 0,128, 0, 0, 0,129, 0, 0, 0, 0, 0, 0, 16,131, 0, 0, 0,130, 0, 0, 0,
-126, 0, 0, 0,127, 0, 0, 0, 0, 0, 0, 16,148, 0, 0, 0,151, 0, 0, 0,131, 0, 0, 0,132, 0, 0, 0, 0, 0, 0, 16,
-147, 0, 0, 0,150, 0, 0, 0,133, 0, 0, 0,138, 0, 0, 0, 0, 0, 0, 16,137, 0, 0, 0,138, 0, 0, 0,140, 0, 0, 0,
-139, 0, 0, 0, 0, 0, 0, 16,140, 0, 0, 0,129, 0, 0, 0,125, 0, 0, 0,142, 0, 0, 0, 0, 0, 0, 16,141, 0, 0, 0,
-142, 0, 0, 0,144, 0, 0, 0,143, 0, 0, 0, 0, 0, 0, 16,144, 0, 0, 0,121, 0, 0, 0,117, 0, 0, 0,136, 0, 0, 0,
- 0, 0, 0, 16,171, 0, 0, 0,181, 0, 0, 0,177, 0, 0, 0,155, 0, 0, 0, 0, 0, 0, 2,154, 0, 0, 0,153, 0, 0, 0,
-169, 0, 0, 0,170, 0, 0, 0, 0, 0, 0, 2,152, 0, 0, 0,176, 0, 0, 0,172, 0, 0, 0,168, 0, 0, 0, 0, 0, 0, 2,
-159, 0, 0, 0,158, 0, 0, 0,154, 0, 0, 0,155, 0, 0, 0, 0, 0, 0, 2,157, 0, 0, 0,156, 0, 0, 0,152, 0, 0, 0,
-153, 0, 0, 0, 0, 0, 0, 2,179, 0, 0, 0,163, 0, 0, 0,159, 0, 0, 0,178, 0, 0, 0, 0, 0, 0, 2,162, 0, 0, 0,
-161, 0, 0, 0,157, 0, 0, 0,158, 0, 0, 0, 0, 0, 0, 2,160, 0, 0, 0,174, 0, 0, 0,175, 0, 0, 0,156, 0, 0, 0,
- 0, 0, 0, 2,167, 0, 0, 0,166, 0, 0, 0,162, 0, 0, 0,163, 0, 0, 0, 0, 0, 0, 2,165, 0, 0, 0,164, 0, 0, 0,
-160, 0, 0, 0,161, 0, 0, 0, 0, 0, 0, 2,182, 0, 0, 0,184, 0, 0, 0,167, 0, 0, 0,180, 0, 0, 0, 0, 0, 0, 2,
-185, 0, 0, 0,186, 0, 0, 0,165, 0, 0, 0,166, 0, 0, 0, 0, 0, 0, 2,187, 0, 0, 0,183, 0, 0, 0,173, 0, 0, 0,
-164, 0, 0, 0, 0, 0, 0, 2, 68, 65, 84, 65, 64, 14, 0, 0, 64, 44,118, 1, 0, 0, 0, 0, 60, 0, 0, 0, 76, 0, 0, 0,
-250,168, 27, 63, 96,211, 93, 59, 84,162,203, 62, 96,211, 93, 59, 84,162,203, 62, 96,211, 93, 59,251,168, 27, 63, 96,211, 93, 59,
- 0, 0, 0, 0, 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0, 21,172,131, 63, 96,211, 93, 59,146,128, 81, 63, 96,211, 93, 59,
-149,128, 81, 63, 96,211, 93, 59, 22,172,131, 63, 96,211, 93, 59, 0, 0, 0, 0, 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0,
-227,151,158, 63, 96,211, 93, 59,174,131,185, 63, 96,211, 93, 59,174,131,185, 63, 96,211, 93, 59,225,151,158, 63, 96,211, 93, 59,
- 0, 0, 0, 0, 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0,149,128, 81, 63, 96,211, 93, 59,251,168, 27, 63, 96,211, 93, 59,
-246,168, 27, 63, 96,211, 93, 59,142,128, 81, 63, 96,211, 93, 59, 0, 0, 0, 0, 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0,
-227,151,158, 63, 96,211, 93, 59, 22,172,131, 63, 96,211, 93, 59, 24,172,131, 63, 96,211, 93, 59,226,151,158, 63, 96,211, 93, 59,
- 0, 0, 0, 0, 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0,246,168, 27, 63, 96,211, 93, 59, 86,162,203, 62, 96,211, 93, 59,
- 85,162,203, 62, 96,211, 93, 59,247,168, 27, 63, 96,211, 93, 59, 0, 0, 0, 0, 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0,
- 24,172,131, 63, 96,211, 93, 59,142,128, 81, 63, 96,211, 93, 59,144,128, 81, 63, 96,211, 93, 59, 21,172,131, 63, 96,211, 93, 59,
- 0, 0, 0, 0, 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0,174,131,185, 63, 96,211, 93, 59,226,151,158, 63, 96,211, 93, 59,
-226,151,158, 63, 96,211, 93, 59,176,131,185, 63, 96,211, 93, 59, 0, 0, 0, 0, 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0,
-144,128, 81, 63, 96,211, 93, 59,247,168, 27, 63, 96,211, 93, 59,247,168, 27, 63, 96,211, 93, 59,144,128, 81, 63, 96,211, 93, 59,
- 0, 0, 0, 0, 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0,226,151,158, 63, 96,211, 93, 59, 21,172,131, 63, 96,211, 93, 59,
- 22,172,131, 63, 96,211, 93, 59,224,151,158, 63, 96,211, 93, 59, 0, 0, 0, 0, 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0,
-247,168, 27, 63, 96,211, 93, 59, 85,162,203, 62, 96,211, 93, 59, 86,162,203, 62, 96,211, 93, 59,248,168, 27, 63, 96,211, 93, 59,
- 0, 0, 0, 0, 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0, 22,172,131, 63, 96,211, 93, 59,144,128, 81, 63, 96,211, 93, 59,
-144,128, 81, 63, 96,211, 93, 59, 22,172,131, 63, 96,211, 93, 59, 0, 0, 0, 0, 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0,
-226,151,158, 63, 96,211, 93, 59,176,131,185, 63, 96,211, 93, 59,174,131,185, 63, 96,211, 93, 59,224,151,158, 63, 96,211, 93, 59,
- 0, 0, 0, 0, 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0, 99,131,140, 63, 76, 47, 41, 63, 44,244,114, 63,236, 65, 79, 63,
- 44,244,114, 63,236, 65, 79, 63, 99,131,140, 63, 76, 47, 41, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,
-161,140,159, 63,210, 28, 3, 63, 99,131,140, 63, 76, 47, 41, 63, 99,131,140, 63, 76, 47, 41, 63,161,140,159, 63,210, 28, 3, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 99,131,140, 63, 76, 47, 41, 63, 44,244,114, 63,236, 65, 79, 63,
- 44,244,114, 63,236, 65, 79, 63, 99,131,140, 63, 76, 47, 41, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,
-161,140,159, 63,210, 28, 3, 63, 99,131,140, 63, 76, 47, 41, 63, 99,131,140, 63, 76, 47, 41, 63,161,140,159, 63,210, 28, 3, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 99,131,140, 63, 72, 47, 41, 63, 44,244,114, 63,236, 65, 79, 63,
- 44,244,114, 63,236, 65, 79, 63, 99,131,140, 63, 76, 47, 41, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,
-174,225, 76, 63,102, 84,117, 63, 52,207, 38, 63,111,179,141, 63, 52,207, 38, 63,111,179,141, 63,174,225, 76, 63,102, 84,117, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 52,207, 38, 63,111,179,141, 63,188,188, 0, 63,173,188,160, 63,
-188,188, 0, 63,173,188,160, 63, 52,207, 38, 63,111,179,141, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,
- 44,244,114, 63,236, 65, 79, 63,174,225, 76, 63,102, 84,117, 63,172,225, 76, 63,102, 84,117, 63, 44,244,114, 63,236, 65, 79, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,172,225, 76, 63,102, 84,117, 63, 52,207, 38, 63,111,179,141, 63,
- 52,207, 38, 63,111,179,141, 63,172,225, 76, 63,102, 84,117, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,
- 52,207, 38, 63,111,179,141, 63,188,188, 0, 63,173,188,160, 63,188,188, 0, 63,173,188,160, 63, 52,207, 38, 63,111,179,141, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 44,244,114, 63,236, 65, 79, 63,172,225, 76, 63,102, 84,117, 63,
-172,225, 76, 63,102, 84,117, 63, 44,244,114, 63,236, 65, 79, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,
- 56,207, 38, 63,111,179,141, 63,172,225, 76, 63,102, 84,117, 63,172,225, 76, 63,102, 84,117, 63, 52,207, 38, 63,111,179,141, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 96,105,188,189,120, 47, 41, 63, 56,127,118,190,220, 28, 3, 63,
- 56,127,118,190,220, 28, 3, 63, 96,105,188,189,120, 47, 41, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,
- 26, 95, 82, 62,102, 84,117, 63,200, 84,104, 61,244, 65, 79, 63,200, 84,104, 61,242, 65, 79, 63, 26, 95, 82, 62,102, 84,117, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,190,188, 0, 63,171,188,160, 63,122, 84,181, 62,113,179,141, 63,
-122, 84,181, 62,113,179,141, 63,188,188, 0, 63,173,188,160, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,
-200, 84,104, 61,242, 65, 79, 63, 96,105,188,189,120, 47, 41, 63,128,105,188,189,120, 47, 41, 63,160, 84,104, 61,242, 65, 79, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,122, 84,181, 62,113,179,141, 63, 26, 95, 82, 62,102, 84,117, 63,
- 26, 95, 82, 62,102, 84,117, 63,122, 84,181, 62,113,179,141, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,
-128,105,188,189,120, 47, 41, 63, 64,127,118,190,216, 28, 3, 63, 64,127,118,190,216, 28, 3, 63,128,105,188,189,120, 47, 41, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 26, 95, 82, 62,102, 84,117, 63,160, 84,104, 61,242, 65, 79, 63,
-160, 84,104, 61,242, 65, 79, 63, 26, 95, 82, 62,102, 84,117, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,
-188,188, 0, 63,173,188,160, 63,122, 84,181, 62,113,179,141, 63,122, 84,181, 62,113,179,141, 63,188,188, 0, 63,173,188,160, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,160, 84,104, 61,242, 65, 79, 63,128,105,188,189,120, 47, 41, 63,
-128,105,188,189,120, 47, 41, 63,160, 84,104, 61,242, 65, 79, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,
-122, 84,181, 62,113,179,141, 63, 26, 95, 82, 62,102, 84,117, 63, 26, 95, 82, 62,102, 84,117, 63,122, 84,181, 62,113,179,141, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,128,105,188,189,120, 47, 41, 63, 64,127,118,190,216, 28, 3, 63,
- 64,127,118,190,216, 28, 3, 63,128,105,188,189,120, 47, 41, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,
- 26, 95, 82, 62,102, 84,117, 63,160, 84,104, 61,242, 65, 79, 63,160, 84,104, 61,242, 65, 79, 63, 26, 95, 82, 62,102, 84,117, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,122, 84,181, 62,113,179,141, 63,188,188, 0, 63,173,188,160, 63,
-188,188, 0, 63,173,188,160, 63,122, 84,181, 62,113,179,141, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,
-180,131,140, 63,116, 19,186, 62,244,140,159, 63, 50, 28, 3, 63, 99,131,140, 63, 76, 47, 41, 63, 42,244,114, 63,244, 28, 3, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,174,225, 76, 63, 0, 21,186, 62, 51,207, 38, 63, 24,224, 91, 62,
-112,226, 76, 63, 64, 38,135, 61,240,244,114, 63, 4,221, 91, 62, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,
-185,188, 0, 63, 96, 44,135, 61, 61, 84,181, 62,176,104,169,189, 93,189, 0, 63, 80, 1,109,190,248,207, 38, 63,144,109,169,189,
- 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,174,225, 76, 63,116, 47, 41, 63, 52,207, 38, 63,248, 28, 3, 63,
-174,225, 76, 63, 0, 21,186, 62, 42,244,114, 63,244, 28, 3, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,
-185,188, 0, 63, 0, 21,186, 62,122, 84,181, 62, 32,224, 91, 62,185,188, 0, 63, 96, 44,135, 61, 51,207, 38, 63, 24,224, 91, 62,
- 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,172,225, 76, 63,102, 84,117, 63, 52,207, 38, 63,236, 65, 79, 63,
-174,225, 76, 63,116, 47, 41, 63, 44,244,114, 63,236, 65, 79, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,
-188,188, 0, 63,120, 47, 41, 63,122, 84,181, 62,248, 28, 3, 63,185,188, 0, 63, 0, 21,186, 62, 52,207, 38, 63,248, 28, 3, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 14, 95, 82, 62, 0, 21,186, 62,144, 82,104, 61,128,223, 91, 62,
-138, 94, 82, 62, 48, 43,135, 61,122, 84,181, 62, 32,224, 91, 62, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,
-190,188, 0, 63,102, 84,117, 63,127, 84,181, 62,242, 65, 79, 63,188,188, 0, 63,120, 47, 41, 63, 52,207, 38, 63,236, 65, 79, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 26, 95, 82, 62,120, 47, 41, 63,160, 84,104, 61, 0, 29, 3, 63,
- 14, 95, 82, 62, 0, 21,186, 62,122, 84,181, 62,248, 28, 3, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,
-190,188, 0, 63,102, 84,117, 63, 56,207, 38, 63,111,179,141, 63,188,188, 0, 63,173,188,160, 63,122, 84,181, 62,113,179,141, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 26, 95, 82, 62,102, 84,117, 63,160, 84,104, 61,242, 65, 79, 63,
- 26, 95, 82, 62,120, 47, 41, 63,127, 84,181, 62,242, 65, 79, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,
-128,105,188,189,120, 47, 41, 63, 64,127,118,190,216, 28, 3, 63,128,106,188,189,176, 20,186, 62,160, 84,104, 61, 0, 29, 3, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 56,207, 38, 63,111,179,141, 63,172,225, 76, 63,102, 84,117, 63,
-172,225, 76, 63,102, 84,117, 63, 52,207, 38, 63,111,179,141, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,
- 44,244,114, 63,236, 65, 79, 63,172,225, 76, 63,102, 84,117, 63,172,225, 76, 63,102, 84,117, 63, 44,244,114, 63,236, 65, 79, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 52,207, 38, 63,111,179,141, 63,188,188, 0, 63,173,188,160, 63,
-188,188, 0, 63,173,188,160, 63, 52,207, 38, 63,111,179,141, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,
-172,225, 76, 63,102, 84,117, 63, 52,207, 38, 63,111,179,141, 63, 52,207, 38, 63,111,179,141, 63,172,225, 76, 63,102, 84,117, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 44,244,114, 63,236, 65, 79, 63,174,225, 76, 63,102, 84,117, 63,
-172,225, 76, 63,102, 84,117, 63, 44,244,114, 63,236, 65, 79, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,
- 52,207, 38, 63,111,179,141, 63,188,188, 0, 63,173,188,160, 63,188,188, 0, 63,173,188,160, 63, 52,207, 38, 63,111,179,141, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,174,225, 76, 63,102, 84,117, 63, 52,207, 38, 63,111,179,141, 63,
- 52,207, 38, 63,111,179,141, 63,174,225, 76, 63,102, 84,117, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,
- 99,131,140, 63, 72, 47, 41, 63, 44,244,114, 63,236, 65, 79, 63, 44,244,114, 63,236, 65, 79, 63, 99,131,140, 63, 76, 47, 41, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,161,140,159, 63,210, 28, 3, 63, 99,131,140, 63, 76, 47, 41, 63,
- 99,131,140, 63, 76, 47, 41, 63,161,140,159, 63,210, 28, 3, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,
- 99,131,140, 63, 76, 47, 41, 63, 44,244,114, 63,236, 65, 79, 63, 44,244,114, 63,236, 65, 79, 63, 99,131,140, 63, 76, 47, 41, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,161,140,159, 63,210, 28, 3, 63, 99,131,140, 63, 76, 47, 41, 63,
- 99,131,140, 63, 76, 47, 41, 63,161,140,159, 63,210, 28, 3, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,
- 99,131,140, 63, 76, 47, 41, 63, 44,244,114, 63,236, 65, 79, 63, 44,244,114, 63,236, 65, 79, 63, 99,131,140, 63, 76, 47, 41, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,122, 84,181, 62,113,179,141, 63,188,188, 0, 63,173,188,160, 63,
-188,188, 0, 63,173,188,160, 63,122, 84,181, 62,113,179,141, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,
- 26, 95, 82, 62,102, 84,117, 63,160, 84,104, 61,242, 65, 79, 63,160, 84,104, 61,242, 65, 79, 63, 26, 95, 82, 62,102, 84,117, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,128,105,188,189,120, 47, 41, 63, 64,127,118,190,216, 28, 3, 63,
- 64,127,118,190,216, 28, 3, 63,128,105,188,189,120, 47, 41, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,
-122, 84,181, 62,113,179,141, 63, 26, 95, 82, 62,102, 84,117, 63, 26, 95, 82, 62,102, 84,117, 63,122, 84,181, 62,113,179,141, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,160, 84,104, 61,242, 65, 79, 63,128,105,188,189,120, 47, 41, 63,
-128,105,188,189,120, 47, 41, 63,160, 84,104, 61,242, 65, 79, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,
-188,188, 0, 63,173,188,160, 63,122, 84,181, 62,113,179,141, 63,122, 84,181, 62,113,179,141, 63,188,188, 0, 63,173,188,160, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 26, 95, 82, 62,102, 84,117, 63,160, 84,104, 61,242, 65, 79, 63,
-160, 84,104, 61,242, 65, 79, 63, 26, 95, 82, 62,102, 84,117, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,
-128,105,188,189,120, 47, 41, 63, 64,127,118,190,216, 28, 3, 63, 64,127,118,190,216, 28, 3, 63,128,105,188,189,120, 47, 41, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,122, 84,181, 62,113,179,141, 63, 26, 95, 82, 62,102, 84,117, 63,
- 26, 95, 82, 62,102, 84,117, 63,122, 84,181, 62,113,179,141, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,
-200, 84,104, 61,242, 65, 79, 63, 96,105,188,189,120, 47, 41, 63,128,105,188,189,120, 47, 41, 63,160, 84,104, 61,242, 65, 79, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,190,188, 0, 63,171,188,160, 63,122, 84,181, 62,113,179,141, 63,
-122, 84,181, 62,113,179,141, 63,188,188, 0, 63,173,188,160, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,
- 26, 95, 82, 62,102, 84,117, 63,200, 84,104, 61,244, 65, 79, 63,200, 84,104, 61,242, 65, 79, 63, 26, 95, 82, 62,102, 84,117, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 96,105,188,189,120, 47, 41, 63, 56,127,118,190,220, 28, 3, 63,
- 56,127,118,190,220, 28, 3, 63, 96,105,188,189,120, 47, 41, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,
- 68, 65, 84, 65,192, 4, 0, 0,192, 58,118, 1, 0, 0, 0, 0, 57, 0, 0, 0, 48, 1, 0, 0,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 77, 69, 0, 0,120, 1, 0, 0,
- 80, 83,118, 1, 0, 0, 0, 0, 50, 0, 0, 0, 1, 0, 0, 0,144,162,118, 1, 0, 0, 0, 0, 32, 2,118, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 69, 80,108, 97,110,101, 46, 48, 48, 49, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96,149,127, 1, 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,
- 64,162,118, 1, 0, 0, 0, 0,112,118,118, 1, 0, 0, 0, 0,128,124,118, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-144, 86,118, 1, 0, 0, 0, 0,144,102,118, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,160,138,118, 1, 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, 16, 85,118, 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 5, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 16,101,118, 1, 0, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0,
- 12, 0, 0, 0, 0, 0, 0, 0,240,116,118, 1, 0, 0, 0, 0, 3, 0, 0, 0, 5, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0,
-182, 0, 0, 0, 45, 1, 0, 0, 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,213,204, 76, 63,255,204, 76, 63,
- 0, 0,104,182, 30, 0,128, 63,140, 0,128, 63,214,255,127, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 30, 0, 4, 0, 0, 0, 0, 0, 1, 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, 68, 65, 84, 65, 8, 0, 0, 0, 64,162,118, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 64, 1, 0, 0, 16, 85,118, 1, 0, 0, 0, 0, 5, 1, 0, 0, 5, 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,144, 86,118, 1, 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, 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,
- 68, 65, 84, 65, 56, 14, 0, 0,144, 86,118, 1, 0, 0, 0, 0, 56, 0, 0, 0,182, 0, 0, 0,133,102,230, 63,208, 51,179, 63,
- 4, 0,128,191,127,165, 0, 0,129, 90, 2,255,133,102,230, 63,206,154, 25, 63, 4, 0,128,191,127,165, 0, 0,129, 90, 2,255,
- 81, 51,179, 63,210, 51,179, 63, 3, 0,128,191, 0, 0, 0, 0,255,127, 2,255, 28, 0,128, 63,212, 51,179, 63, 1, 0,128,191,
- 0, 0, 0, 0,255,127, 2,255,207,153, 25, 63,214, 51,179, 63, 0, 0,128,191, 0, 0, 0, 0,255,127, 2,255,152,205, 76, 62,
-216, 51,179, 63,254,255,127,191, 0, 0, 0, 0,255,127, 2,255, 80, 51,179, 63,158, 0,128, 63, 3, 0,128,191, 0, 0, 0, 0,
-255,127, 2,255, 27, 0,128, 63,160, 0,128, 63, 2, 0,128,191, 0, 0, 0, 0,255,127, 2,255,204,153, 25, 63,162, 0,128, 63,
- 0, 0,128,191, 0, 0, 0, 0,255,127, 2,255,140,205, 76, 62,163, 0,128, 63,254,255,127,191, 0, 0, 0, 0,255,127, 2,255,
- 80, 51,179, 63,209,154, 25, 63, 3, 0,128,191, 0, 0, 0, 0,255,127, 2,255, 27, 0,128, 63,213,154, 25, 63, 2, 0,128,191,
- 0, 0, 0, 0,255,127, 2,255,204,153, 25, 63,217,154, 25, 63, 0, 0,128,191, 0, 0, 0, 0,255,127, 2,255,140,205, 76, 62,
-221,154, 25, 63,254,255,127,191, 0, 0, 0, 0,255,127, 2,255, 80, 51,179, 63,160,209, 76, 62, 3, 0,128,191, 0, 0, 0, 0,
-255,127, 2,255, 27, 0,128, 63,176,209, 76, 62, 2, 0,128,191, 0, 0, 0, 0,255,127, 2,255,204,153, 25, 63,188,209, 76, 62,
- 1, 0,128,191, 0, 0, 0, 0,255,127, 2,255,140,205, 76, 62,204,209, 76, 62,255,255,127,191, 0, 0, 0, 0,255,127, 2,255,
-140,205, 76, 62, 8,103,230, 63,156,153, 25,191, 0, 0, 1,128, 0, 0, 2,255,204,153, 25, 63, 10,103,230, 63,160,153, 25,191,
- 0, 0, 1,128, 0, 0, 2,255, 27, 0,128, 63, 10,103,230, 63,164,153, 25,191, 0, 0, 1,128, 0, 0, 2,255, 80, 51,179, 63,
- 12,103,230, 63,168,153, 25,191, 0, 0, 1,128, 0, 0, 2,255,140,205, 76, 62, 8,103,230, 63,196,204, 76,190, 0, 0, 1,128,
- 0, 0, 2,255,204,153, 25, 63, 10,103,230, 63,212,204, 76,190, 0, 0, 1,128, 0, 0, 2,255, 27, 0,128, 63, 10,103,230, 63,
-228,204, 76,190, 0, 0, 1,128, 0, 0, 2,255, 80, 51,179, 63, 12,103,230, 63,244,204, 76,190, 0, 0, 1,128, 0, 0, 2,255,
-140,205, 76, 62, 8,103,230, 63,216,204, 76, 62, 0, 0, 1,128, 0, 0, 2,255,204,153, 25, 63, 10,103,230, 63,200,204, 76, 62,
- 0, 0, 1,128, 0, 0, 2,255, 27, 0,128, 63, 10,103,230, 63,184,204, 76, 62, 0, 0, 1,128, 0, 0, 2,255, 80, 51,179, 63,
- 12,103,230, 63,168,204, 76, 62, 0, 0, 1,128, 0, 0, 2,255,152,205, 76, 62, 8,103,230, 63,158,153, 25, 63, 0, 0, 1,128,
- 0, 0, 2,255,207,153, 25, 63, 10,103,230, 63,154,153, 25, 63, 0, 0, 1,128, 0, 0, 2,255, 28, 0,128, 63, 10,103,230, 63,
-150,153, 25, 63, 0, 0, 1,128, 0, 0, 2,255, 81, 51,179, 63, 12,103,230, 63,150,153, 25, 63, 0, 0, 1,128, 0, 0, 2,255,
-140,205, 76, 62, 8,103,230, 63, 3, 0,128,191, 0, 0,127,165,129, 90, 0,255,204,153, 25, 63, 10,103,230, 63, 4, 0,128,191,
- 0, 0,127,165,129, 90, 0,255, 27, 0,128, 63, 10,103,230, 63, 6, 0,128,191, 0, 0,127,165,129, 90, 0,255, 80, 51,179, 63,
- 12,103,230, 63, 7, 0,128,191, 0, 0,127,165,129, 90, 0,255,144,205, 76,190, 12,103,230, 63,150,153, 25, 63, 0, 0, 1,128,
- 0, 0, 2,255,152,205, 76,190, 12,103,230, 63,168,204, 76, 62, 0, 0, 1,128, 0, 0, 2,255,152,205, 76,190, 12,103,230, 63,
-244,204, 76,190, 0, 0, 1,128, 0, 0, 2,255,152,205, 76,190, 12,103,230, 63,168,153, 25,191, 0, 0, 1,128, 0, 0, 2,255,
-152,205, 76,190,160,209, 76, 62, 3, 0,128,191, 0, 0, 0, 0,255,127, 2,255,152,205, 76,190,209,154, 25, 63, 3, 0,128,191,
- 0, 0, 0, 0,255,127, 2,255,152,205, 76,190,158, 0,128, 63, 3, 0,128,191, 0, 0, 0, 0,255,127, 2,255,144,205, 76,190,
-210, 51,179, 63, 3, 0,128,191, 0, 0, 0, 0,255,127, 2,255,131,102,230, 63, 7,103,230, 63,155,153, 25,191,127,165,127,165,
- 0, 0, 2,255,131,102,230, 63,212, 51,179, 63,159,153, 25,191, 1,128, 0, 0, 0, 0, 2,255,131,102,230, 63,160, 0,128, 63,
-163,153, 25,191, 1,128, 0, 0, 0, 0, 2,255,135,102,230, 63,207,154, 25, 63,167,153, 25,191, 1,128, 0, 0, 0, 0, 2,255,
-131,102,230, 63, 7,103,230, 63,193,204, 76,190,127,165,127,165, 0, 0, 2,255,131,102,230, 63,212, 51,179, 63,209,204, 76,190,
- 1,128, 0, 0, 0, 0, 2,255,131,102,230, 63,160, 0,128, 63,225,204, 76,190, 1,128, 0, 0, 0, 0, 2,255,135,102,230, 63,
-207,154, 25, 63,241,204, 76,190, 1,128, 0, 0, 0, 0, 2,255,131,102,230, 63, 7,103,230, 63,219,204, 76, 62,127,165,127,165,
- 0, 0, 2,255,131,102,230, 63,212, 51,179, 63,203,204, 76, 62, 1,128, 0, 0, 0, 0, 2,255,131,102,230, 63,160, 0,128, 63,
-187,204, 76, 62, 1,128, 0, 0, 0, 0, 2,255,135,102,230, 63,207,154, 25, 63,171,204, 76, 62, 1,128, 0, 0, 0, 0, 2,255,
-131,102,230, 63, 7,103,230, 63,159,153, 25, 63,127,165,127,165, 0, 0, 2,255,131,102,230, 63,212, 51,179, 63,155,153, 25, 63,
- 1,128, 0, 0, 0, 0, 2,255,131,102,230, 63,156, 0,128, 63,151,153, 25, 63, 1,128, 0, 0, 0, 0, 2,255,135,102,230, 63,
-207,154, 25, 63,151,153, 25, 63, 1,128, 0, 0, 0, 0, 2,255,131,102,230, 63, 7,103,230, 63, 3, 0,128,191, 1,128, 0, 0,
- 0, 0, 2,255,131,102,230, 63,160, 0,128, 63, 6, 0,128,191,127,165, 0, 0,129, 90, 2,255,127,102,230, 63, 28,208, 76, 62,
- 3, 0,128,191,127,165, 0, 0,129, 90, 2,255,131,102,230, 63,136,201, 76,190,155,153, 25, 63, 1,128, 0, 0, 0, 0, 2,255,
-127,102,230, 63, 28,208, 76, 62,159,153, 25, 63, 1,128, 0, 0, 0, 0, 2,255,131,102,230, 63,136,201, 76,190,203,204, 76, 62,
- 1,128, 0, 0, 0, 0, 2,255,127,102,230, 63, 28,208, 76, 62,219,204, 76, 62, 1,128, 0, 0, 0, 0, 2,255,131,102,230, 63,
-136,201, 76,190,209,204, 76,190, 1,128, 0, 0, 0, 0, 2,255,127,102,230, 63, 28,208, 76, 62,193,204, 76,190, 1,128, 0, 0,
- 0, 0, 2,255,131,102,230, 63,136,201, 76,190,159,153, 25,191, 1,128, 0, 0, 0, 0, 2,255,127,102,230, 63, 28,208, 76, 62,
-155,153, 25,191, 1,128, 0, 0, 0, 0, 2,255,150,205, 76, 62, 24,208, 76,190,254,255,127,191, 0, 0, 0, 0,255,127, 2,255,
-207,153, 25, 63, 40,208, 76,190, 0, 0,128,191, 0, 0, 0, 0,255,127, 2,255, 28, 0,128, 63, 56,208, 76,190, 1, 0,128,191,
- 0, 0, 0, 0,255,127, 2,255, 81, 51,179, 63, 72,208, 76,190, 3, 0,128,191, 0, 0, 0, 0,255,127, 2,255,133,102,230, 63,
- 88,208, 76,190, 4, 0,128,191, 1,128, 0, 0, 0, 0, 2,255,133,102,230, 63, 88,208, 76,190,146,255,127, 63, 1,128, 0, 0,
- 0, 0, 2,255, 81, 51,179, 63, 72,208, 76,190,148,255,127, 63, 0, 0, 0, 0,255,127, 2,255, 28, 0,128, 63, 56,208, 76,190,
-152,255,127, 63, 0, 0, 0, 0,255,127, 2,255,207,153, 25, 63, 40,208, 76,190,154,255,127, 63, 0, 0, 0, 0,255,127, 2,255,
-150,205, 76, 62, 24,208, 76,190,156,255,127, 63, 0, 0, 0, 0,255,127, 2,255,127,102,230, 63, 28,208, 76, 62,148,255,127, 63,
-127,165, 0, 0,129, 90, 2,255,131,102,230, 63,160, 0,128, 63,142,255,127, 63,127,165, 0, 0,129, 90, 2,255,131,102,230, 63,
- 7,103,230, 63,148,255,127, 63, 1,128, 0, 0, 0, 0, 2,255,144,205, 76,190,210, 51,179, 63,148,255,127, 63, 0, 0, 0, 0,
-255,127, 2,255,152,205, 76,190,158, 0,128, 63,148,255,127, 63, 0, 0, 0, 0,255,127, 2,255,152,205, 76,190,209,154, 25, 63,
-148,255,127, 63, 0, 0, 0, 0,255,127, 2,255,152,205, 76,190,160,209, 76, 62,148,255,127, 63, 0, 0, 0, 0,255,127, 2,255,
- 80, 51,179, 63, 12,103,230, 63,140,255,127, 63, 0, 0,127,165,129, 90, 2,255, 27, 0,128, 63, 10,103,230, 63,142,255,127, 63,
- 0, 0,127,165,129, 90, 2,255,204,153, 25, 63, 10,103,230, 63,146,255,127, 63, 0, 0,127,165,129, 90, 2,255,140,205, 76, 62,
- 8,103,230, 63,148,255,127, 63, 0, 0,127,165,129, 90, 2,255,140,205, 76, 62,204,209, 76, 62,154,255,127, 63, 0, 0, 0, 0,
-255,127, 2,255,204,153, 25, 63,188,209, 76, 62,152,255,127, 63, 0, 0, 0, 0,255,127, 2,255, 27, 0,128, 63,176,209, 76, 62,
-150,255,127, 63, 0, 0, 0, 0,255,127, 2,255, 80, 51,179, 63,160,209, 76, 62,148,255,127, 63, 0, 0, 0, 0,255,127, 2,255,
-140,205, 76, 62,221,154, 25, 63,156,255,127, 63, 0, 0, 0, 0,255,127, 2,255,204,153, 25, 63,217,154, 25, 63,154,255,127, 63,
- 0, 0, 0, 0,255,127, 2,255, 27, 0,128, 63,213,154, 25, 63,150,255,127, 63, 0, 0, 0, 0,255,127, 2,255, 80, 51,179, 63,
-209,154, 25, 63,148,255,127, 63, 0, 0, 0, 0,255,127, 2,255,140,205, 76, 62,163, 0,128, 63,156,255,127, 63, 0, 0, 0, 0,
-255,127, 2,255,204,153, 25, 63,162, 0,128, 63,154,255,127, 63, 0, 0, 0, 0,255,127, 2,255, 27, 0,128, 63,160, 0,128, 63,
-150,255,127, 63, 0, 0, 0, 0,255,127, 2,255, 80, 51,179, 63,158, 0,128, 63,148,255,127, 63, 0, 0, 0, 0,255,127, 2,255,
-152,205, 76, 62,216, 51,179, 63,156,255,127, 63, 0, 0, 0, 0,255,127, 2,255,207,153, 25, 63,214, 51,179, 63,154,255,127, 63,
- 0, 0, 0, 0,255,127, 2,255, 28, 0,128, 63,212, 51,179, 63,152,255,127, 63, 0, 0, 0, 0,255,127, 2,255, 81, 51,179, 63,
-210, 51,179, 63,148,255,127, 63, 0, 0, 0, 0,255,127, 2,255,133,102,230, 63,206,154, 25, 63,146,255,127, 63,127,165, 0, 0,
-129, 90, 2,255,133,102,230, 63,208, 51,179, 63,146,255,127, 63,127,165, 0, 0,129, 90, 2,255,144,205, 76,190,140,201, 76, 62,
-148,255,127, 63,255,127, 0, 0, 0, 0, 1,255,136,205, 76,190, 52,255,127, 63,148,255,127, 63,255,127, 0, 0, 0, 0, 1,255,
-128,205, 76,190, 48,208, 76,190,150,255,127, 63,255,127, 0, 0, 0, 0, 3,255,120,205, 76,190,194,152, 25, 63,144,255,127, 63,
-255,127, 0, 0, 0, 0, 1,255, 80,205, 76,190,254, 50,179, 63,150,255,127, 63,255,127, 0, 0, 0, 0, 1,255,128,205, 76,190,
- 12,103,230, 63,148,255,127, 63,255,127, 0, 0, 0, 0, 3,255,128,205, 76,190, 12,103,230, 63, 5, 0,128,191,255,127, 0, 0,
- 0, 0, 3,255, 80,205, 76,190,254, 50,179, 63,156,153, 25,191,255,127, 0, 0, 0, 0, 3,255,112,205, 76,190, 50,102,230, 63,
-160,153, 25,191,255,127, 0, 0, 0, 0, 3,255, 80,205, 76,190,254, 50,179, 63,195,204, 76,190,255,127, 0, 0, 0, 0, 3,255,
-112,205, 76,190, 50,102,230, 63,211,204, 76,190,255,127, 0, 0, 0, 0, 3,255, 80,205, 76,190,254, 50,179, 63,221,204, 76, 62,
-255,127, 0, 0, 0, 0, 3,255,112,205, 76,190, 50,102,230, 63,205,204, 76, 62,255,127, 0, 0, 0, 0, 3,255, 80,205, 76,190,
-254, 50,179, 63,160,153, 25, 63,255,127, 0, 0, 0, 0, 3,255,112,205, 76,190, 50,102,230, 63,156,153, 25, 63,255,127, 0, 0,
- 0, 0, 3,255, 80,205, 76,190,254, 50,179, 63, 4, 0,128,191,255,127, 0, 0, 0, 0, 1,255,120,205, 76,190,194,152, 25, 63,
- 7, 0,128,191,255,127, 0, 0, 0, 0, 1,255,128,205, 76,190, 48,208, 76,190, 4, 0,128,191,255,127, 0, 0, 0, 0, 3,255,
-152,205, 76,190, 52,255,127, 63,152,153, 25, 63,255,127, 0, 0, 0, 0, 3,255,120,205, 76,190,202,152, 25, 63,152,153, 25, 63,
-255,127, 0, 0, 0, 0, 3,255,128,205, 76,190,108,201, 76, 62,156,153, 25, 63,255,127, 0, 0, 0, 0, 3,255,128,205, 76,190,
- 48,208, 76,190,160,153, 25, 63,255,127, 0, 0, 0, 0, 1,255,152,205, 76,190, 52,255,127, 63,173,204, 76, 62,255,127, 0, 0,
- 0, 0, 3,255,120,205, 76,190,194,152, 25, 63,189,204, 76, 62,255,127, 0, 0, 0, 0, 3,255,128,205, 76,190,108,201, 76, 62,
-205,204, 76, 62,255,127, 0, 0, 0, 0, 3,255,128,205, 76,190, 48,208, 76,190,221,204, 76, 62,255,127, 0, 0, 0, 0, 1,255,
-152,205, 76,190, 52,255,127, 63,243,204, 76,190,255,127, 0, 0, 0, 0, 3,255,120,205, 76,190,194,152, 25, 63,227,204, 76,190,
-255,127, 0, 0, 0, 0, 3,255,128,205, 76,190,108,201, 76, 62,211,204, 76,190,255,127, 0, 0, 0, 0, 3,255,128,205, 76,190,
- 48,208, 76,190,195,204, 76,190,255,127, 0, 0, 0, 0, 1,255,152,205, 76,190, 52,255,127, 63,168,153, 25,191,255,127, 0, 0,
- 0, 0, 3,255,120,205, 76,190,194,152, 25, 63,164,153, 25,191,255,127, 0, 0, 0, 0, 3,255,128,205, 76,190,108,201, 76, 62,
-160,153, 25,191,255,127, 0, 0, 0, 0, 3,255,128,205, 76,190, 48,208, 76,190,156,153, 25,191,255,127, 0, 0, 0, 0, 1,255,
-136,205, 76,190, 52,255,127, 63, 5, 0,128,191,255,127, 0, 0, 0, 0, 1,255,144,205, 76,190,140,201, 76, 62, 5, 0,128,191,
-255,127, 0, 0, 0, 0, 1,255, 36, 51,179, 63, 56,208, 76,190,150,255,127, 63, 0, 0,255,127, 0, 0, 3,255,222,255,127, 63,
- 80,208, 76,190,148,255,127, 63, 0, 0,255,127, 0, 0, 3,255,116,153, 25, 63, 80,208, 76,190,144,255,127, 63, 0, 0,255,127,
- 0, 0, 3,255, 44,204, 76, 62,104,208, 76,190,142,255,127, 63, 0, 0,255,127, 0, 0, 3,255,112,205, 76,190, 64,208, 76,190,
-150,255,127, 63, 94,231, 94,231, 41,123, 1,255,112,205, 76,190, 64,208, 76,190, 4, 0,128,191, 94,231, 94,231,215,132, 1,255,
-112,205, 76,190, 64,208, 76,190,160,153, 25, 63, 0, 0,255,127, 0, 0, 1,255,112,205, 76,190, 64,208, 76,190,221,204, 76, 62,
- 0, 0,255,127, 0, 0, 1,255,112,205, 76,190, 64,208, 76,190,195,204, 76,190, 0, 0,255,127, 0, 0, 1,255,112,205, 76,190,
- 64,208, 76,190,156,153, 25,191, 0, 0,255,127, 0, 0, 1,255,136,102,230, 63, 88,208, 76,190,169,153, 25,191, 0, 0,255,127,
- 0, 0, 3,255,136,102,230, 63, 88,208, 76,190,246,204, 76,190, 0, 0,255,127, 0, 0, 3,255,136,102,230, 63, 88,208, 76,190,
-170,204, 76, 62, 0, 0,255,127, 0, 0, 3,255,135,102,230, 63, 88,208, 76,190,151,153, 25, 63, 0, 0,255,127, 0, 0, 3,255,
- 44,204, 76, 62,104,208, 76,190, 8, 0,128,191, 0, 0,255,127, 0, 0, 3,255,116,153, 25, 63, 80,208, 76,190, 7, 0,128,191,
- 0, 0,255,127, 0, 0, 3,255,222,255,127, 63, 80,208, 76,190, 5, 0,128,191, 0, 0,255,127, 0, 0, 3,255, 36, 51,179, 63,
- 56,208, 76,190, 4, 0,128,191, 0, 0,255,127, 0, 0, 3,255, 36,204, 76, 62,104,208, 76,190,151,153, 25, 63, 0, 0,255,127,
- 0, 0, 3,255,114,153, 25, 63, 80,208, 76,190,151,153, 25, 63, 0, 0,255,127, 0, 0, 3,255,220,255,127, 63, 80,208, 76,190,
-155,153, 25, 63, 0, 0,255,127, 0, 0, 3,255, 34, 51,179, 63, 56,208, 76,190,159,153, 25, 63, 0, 0,255,127, 0, 0, 3,255,
- 44,204, 76, 62,104,208, 76,190,170,204, 76, 62, 0, 0,255,127, 0, 0, 3,255,116,153, 25, 63, 80,208, 76,190,186,204, 76, 62,
- 0, 0,255,127, 0, 0, 3,255,222,255,127, 63, 80,208, 76,190,202,204, 76, 62, 0, 0,255,127, 0, 0, 3,255, 36, 51,179, 63,
- 56,208, 76,190,218,204, 76, 62, 0, 0,255,127, 0, 0, 3,255, 44,204, 76, 62,104,208, 76,190,246,204, 76,190, 0, 0,255,127,
- 0, 0, 3,255,116,153, 25, 63, 80,208, 76,190,230,204, 76,190, 0, 0,255,127, 0, 0, 3,255,222,255,127, 63, 80,208, 76,190,
-214,204, 76,190, 0, 0,255,127, 0, 0, 3,255, 36, 51,179, 63, 56,208, 76,190,198,204, 76,190, 0, 0,255,127, 0, 0, 3,255,
- 44,204, 76, 62,104,208, 76,190,169,153, 25,191, 0, 0,255,127, 0, 0, 3,255,116,153, 25, 63, 80,208, 76,190,165,153, 25,191,
- 0, 0,255,127, 0, 0, 3,255,222,255,127, 63, 80,208, 76,190,161,153, 25,191, 0, 0,255,127, 0, 0, 3,255, 36, 51,179, 63,
- 56,208, 76,190,157,153, 25,191, 0, 0,255,127, 0, 0, 3,255, 68, 65, 84, 65, 64, 1, 0, 0, 16,101,118, 1, 0, 0, 0, 0,
- 5, 1, 0, 0, 5, 0, 0, 0, 3, 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,
-144,102,118, 1, 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, 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, 68, 65, 84, 65, 28, 14, 0, 0,144,102,118, 1, 0, 0, 0, 0, 53, 0, 0, 0, 45, 1, 0, 0,
- 4, 0, 0, 0, 5, 0, 0, 0, 0, 0, 34, 0, 3, 0, 0, 0, 4, 0, 0, 0, 0, 0, 34, 0, 2, 0, 0, 0, 3, 0, 0, 0,
- 0, 0, 34, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 34, 0, 5, 0, 0, 0, 9, 0, 0, 0, 0, 0, 34, 0, 8, 0, 0, 0,
- 9, 0, 0, 0, 0, 0, 34, 0, 4, 0, 0, 0, 8, 0, 0, 0, 0, 0, 34, 0, 7, 0, 0, 0, 8, 0, 0, 0, 0, 0, 34, 0,
- 3, 0, 0, 0, 7, 0, 0, 0, 0, 0, 34, 0, 6, 0, 0, 0, 7, 0, 0, 0, 0, 0, 34, 0, 2, 0, 0, 0, 6, 0, 0, 0,
- 0, 0, 34, 0, 9, 0, 0, 0, 13, 0, 0, 0, 0, 0, 34, 0, 12, 0, 0, 0, 13, 0, 0, 0, 0, 0, 34, 0, 8, 0, 0, 0,
- 12, 0, 0, 0, 0, 0, 34, 0, 11, 0, 0, 0, 12, 0, 0, 0, 0, 0, 34, 0, 7, 0, 0, 0, 11, 0, 0, 0, 0, 0, 34, 0,
- 10, 0, 0, 0, 11, 0, 0, 0, 0, 0, 34, 0, 6, 0, 0, 0, 10, 0, 0, 0, 0, 0, 34, 0, 1, 0, 0, 0, 10, 0, 0, 0,
- 0, 0, 34, 0, 13, 0, 0, 0, 17, 0, 0, 0, 0, 0, 34, 0, 16, 0, 0, 0, 17, 0, 0, 0, 0, 0, 34, 0, 12, 0, 0, 0,
- 16, 0, 0, 0, 0, 0, 34, 0, 15, 0, 0, 0, 16, 0, 0, 0, 0, 0, 34, 0, 11, 0, 0, 0, 15, 0, 0, 0, 0, 0, 34, 0,
- 14, 0, 0, 0, 15, 0, 0, 0, 0, 0, 34, 0, 10, 0, 0, 0, 14, 0, 0, 0, 0, 0, 34, 0, 21, 0, 0, 0, 37, 0, 0, 0,
- 0, 0, 34, 0, 20, 0, 0, 0, 36, 0, 0, 0, 0, 0, 34, 0, 19, 0, 0, 0, 35, 0, 0, 0, 0, 0, 34, 0, 18, 0, 0, 0,
- 34, 0, 0, 0, 0, 0, 34, 0, 21, 0, 0, 0, 25, 0, 0, 0, 0, 0, 34, 0, 20, 0, 0, 0, 21, 0, 0, 0, 0, 0, 34, 0,
- 20, 0, 0, 0, 24, 0, 0, 0, 0, 0, 34, 0, 19, 0, 0, 0, 20, 0, 0, 0, 0, 0, 34, 0, 19, 0, 0, 0, 23, 0, 0, 0,
- 0, 0, 34, 0, 18, 0, 0, 0, 19, 0, 0, 0, 0, 0, 34, 0, 18, 0, 0, 0, 22, 0, 0, 0, 0, 0, 34, 0, 25, 0, 0, 0,
- 29, 0, 0, 0, 0, 0, 34, 0, 24, 0, 0, 0, 25, 0, 0, 0, 0, 0, 34, 0, 24, 0, 0, 0, 28, 0, 0, 0, 0, 0, 34, 0,
- 23, 0, 0, 0, 24, 0, 0, 0, 0, 0, 34, 0, 23, 0, 0, 0, 27, 0, 0, 0, 0, 0, 34, 0, 22, 0, 0, 0, 23, 0, 0, 0,
- 0, 0, 34, 0, 22, 0, 0, 0, 26, 0, 0, 0, 0, 0, 34, 0, 29, 0, 0, 0, 33, 0, 0, 0, 0, 0, 34, 0, 28, 0, 0, 0,
- 29, 0, 0, 0, 0, 0, 34, 0, 28, 0, 0, 0, 32, 0, 0, 0, 0, 0, 34, 0, 27, 0, 0, 0, 28, 0, 0, 0, 0, 0, 34, 0,
- 27, 0, 0, 0, 31, 0, 0, 0, 0, 0, 34, 0, 26, 0, 0, 0, 27, 0, 0, 0, 0, 0, 34, 0, 26, 0, 0, 0, 30, 0, 0, 0,
- 0, 0, 34, 0, 32, 0, 0, 0, 33, 0, 0, 0, 0, 0, 34, 0, 31, 0, 0, 0, 32, 0, 0, 0, 0, 0, 34, 0, 30, 0, 0, 0,
- 31, 0, 0, 0, 0, 0, 34, 0, 34, 0, 0, 0, 35, 0, 0, 0, 0, 0, 34, 0, 36, 0, 0, 0, 37, 0, 0, 0, 0, 0, 34, 0,
- 2, 0, 0, 0, 37, 0, 0, 0, 0, 0, 34, 0, 3, 0, 0, 0, 36, 0, 0, 0, 0, 0, 34, 0, 4, 0, 0, 0, 35, 0, 0, 0,
- 0, 0, 34, 0, 5, 0, 0, 0, 34, 0, 0, 0, 0, 0, 34, 0, 38, 0, 0, 0, 39, 0, 0, 0, 0, 0, 34, 0, 40, 0, 0, 0,
- 41, 0, 0, 0, 0, 0, 34, 0, 42, 0, 0, 0, 43, 0, 0, 0, 0, 0, 34, 0, 44, 0, 0, 0, 45, 0, 0, 0, 0, 0, 34, 0,
- 30, 0, 0, 0, 38, 0, 0, 0, 0, 0, 34, 0, 26, 0, 0, 0, 39, 0, 0, 0, 0, 0, 34, 0, 22, 0, 0, 0, 40, 0, 0, 0,
- 0, 0, 34, 0, 18, 0, 0, 0, 41, 0, 0, 0, 0, 0, 34, 0, 17, 0, 0, 0, 42, 0, 0, 0, 0, 0, 34, 0, 13, 0, 0, 0,
- 43, 0, 0, 0, 0, 0, 34, 0, 9, 0, 0, 0, 44, 0, 0, 0, 0, 0, 34, 0, 5, 0, 0, 0, 45, 0, 0, 0, 0, 0, 34, 0,
- 49, 0, 0, 0, 72, 0, 0, 0, 0, 0, 34, 0, 53, 0, 0, 0, 70, 0, 0, 0, 0, 0, 34, 0, 57, 0, 0, 0, 68, 0, 0, 0,
- 0, 0, 34, 0, 61, 0, 0, 0, 66, 0, 0, 0, 0, 0, 34, 0, 48, 0, 0, 0, 63, 0, 0, 0, 0, 0, 34, 0, 46, 0, 0, 0,
- 62, 0, 0, 0, 0, 0, 34, 0, 49, 0, 0, 0, 53, 0, 0, 0, 0, 0, 34, 0, 48, 0, 0, 0, 49, 0, 0, 0, 0, 0, 34, 0,
- 48, 0, 0, 0, 52, 0, 0, 0, 0, 0, 34, 0, 47, 0, 0, 0, 48, 0, 0, 0, 0, 0, 34, 0, 47, 0, 0, 0, 51, 0, 0, 0,
- 0, 0, 34, 0, 46, 0, 0, 0, 47, 0, 0, 0, 0, 0, 34, 0, 46, 0, 0, 0, 50, 0, 0, 0, 0, 0, 34, 0, 53, 0, 0, 0,
- 57, 0, 0, 0, 0, 0, 34, 0, 52, 0, 0, 0, 53, 0, 0, 0, 0, 0, 34, 0, 52, 0, 0, 0, 56, 0, 0, 0, 0, 0, 34, 0,
- 51, 0, 0, 0, 52, 0, 0, 0, 0, 0, 34, 0, 51, 0, 0, 0, 55, 0, 0, 0, 0, 0, 34, 0, 50, 0, 0, 0, 51, 0, 0, 0,
- 0, 0, 34, 0, 50, 0, 0, 0, 54, 0, 0, 0, 0, 0, 34, 0, 57, 0, 0, 0, 61, 0, 0, 0, 0, 0, 34, 0, 56, 0, 0, 0,
- 57, 0, 0, 0, 0, 0, 34, 0, 56, 0, 0, 0, 60, 0, 0, 0, 0, 0, 34, 0, 55, 0, 0, 0, 56, 0, 0, 0, 0, 0, 34, 0,
- 55, 0, 0, 0, 59, 0, 0, 0, 0, 0, 34, 0, 54, 0, 0, 0, 55, 0, 0, 0, 0, 0, 34, 0, 54, 0, 0, 0, 58, 0, 0, 0,
- 0, 0, 34, 0, 60, 0, 0, 0, 61, 0, 0, 0, 0, 0, 34, 0, 59, 0, 0, 0, 60, 0, 0, 0, 0, 0, 34, 0, 58, 0, 0, 0,
- 59, 0, 0, 0, 0, 0, 34, 0, 65, 0, 0, 0, 66, 0, 0, 0, 0, 0, 34, 0, 66, 0, 0, 0, 68, 0, 0, 0, 0, 0, 34, 0,
- 67, 0, 0, 0, 68, 0, 0, 0, 0, 0, 34, 0, 68, 0, 0, 0, 70, 0, 0, 0, 0, 0, 34, 0, 69, 0, 0, 0, 70, 0, 0, 0,
- 0, 0, 34, 0, 67, 0, 0, 0, 69, 0, 0, 0, 0, 0, 34, 0, 70, 0, 0, 0, 72, 0, 0, 0, 0, 0, 34, 0, 71, 0, 0, 0,
- 72, 0, 0, 0, 0, 0, 34, 0, 64, 0, 0, 0, 72, 0, 0, 0, 0, 0, 34, 0, 1, 0, 0, 0, 63, 0, 0, 0, 0, 0, 34, 0,
- 0, 0, 0, 0, 63, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 62, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 47, 0, 0, 0,
- 0, 0, 34, 0, 1, 0, 0, 0, 49, 0, 0, 0, 0, 0, 34, 0, 1, 0, 0, 0, 64, 0, 0, 0, 0, 0, 34, 0, 33, 0, 0, 0,
- 58, 0, 0, 0, 0, 0, 34, 0, 29, 0, 0, 0, 54, 0, 0, 0, 0, 0, 34, 0, 25, 0, 0, 0, 50, 0, 0, 0, 0, 0, 34, 0,
- 21, 0, 0, 0, 46, 0, 0, 0, 0, 0, 34, 0, 14, 0, 0, 0, 64, 0, 0, 0, 0, 0, 34, 0, 6, 0, 0, 0, 63, 0, 0, 0,
- 0, 0, 34, 0, 75, 0, 0, 0, 76, 0, 0, 0, 0, 0, 34, 0, 73, 0, 0, 0, 74, 0, 0, 0, 0, 0, 34, 0, 71, 0, 0, 0,
- 77, 0, 0, 0, 0, 0, 34, 0, 64, 0, 0, 0, 77, 0, 0, 0, 0, 0, 34, 0, 14, 0, 0, 0, 76, 0, 0, 0, 0, 0, 34, 0,
- 15, 0, 0, 0, 75, 0, 0, 0, 0, 0, 34, 0, 16, 0, 0, 0, 74, 0, 0, 0, 0, 0, 34, 0, 17, 0, 0, 0, 73, 0, 0, 0,
- 0, 0, 34, 0, 82, 0, 0, 0, 94, 0, 0, 0, 0, 0, 34, 0, 81, 0, 0, 0, 95, 0, 0, 0, 0, 0, 34, 0, 80, 0, 0, 0,
- 96, 0, 0, 0, 0, 0, 34, 0, 79, 0, 0, 0, 97, 0, 0, 0, 0, 0, 34, 0, 78, 0, 0, 0, 83, 0, 0, 0, 0, 0, 34, 0,
- 81, 0, 0, 0, 82, 0, 0, 0, 0, 0, 34, 0, 79, 0, 0, 0, 80, 0, 0, 0, 0, 0, 34, 0, 84, 0, 0, 0,105, 0, 0, 0,
- 0, 0, 34, 0, 83, 0, 0, 0, 97, 0, 0, 0, 0, 0, 34, 0, 83, 0, 0, 0,110, 0, 0, 0, 0, 0, 34, 0, 85, 0, 0, 0,
-111, 0, 0, 0, 0, 0, 34, 0, 84, 0, 0, 0,111, 0, 0, 0, 0, 0, 34, 0, 84, 0, 0, 0,110, 0, 0, 0, 0, 0, 34, 0,
- 86, 0, 0, 0,106, 0, 0, 0, 0, 0, 34, 0, 87, 0, 0, 0,102, 0, 0, 0, 0, 0, 34, 0, 88, 0, 0, 0, 98, 0, 0, 0,
- 0, 0, 34, 0, 89, 0, 0, 0, 94, 0, 0, 0, 0, 0, 34, 0, 86, 0, 0, 0, 87, 0, 0, 0, 0, 0, 34, 0, 88, 0, 0, 0,
- 89, 0, 0, 0, 0, 0, 34, 0, 93, 0, 0, 0,106, 0, 0, 0, 0, 0, 34, 0, 92, 0, 0, 0,107, 0, 0, 0, 0, 0, 34, 0,
- 91, 0, 0, 0,108, 0, 0, 0, 0, 0, 34, 0, 90, 0, 0, 0,109, 0, 0, 0, 0, 0, 34, 0, 90, 0, 0, 0, 91, 0, 0, 0,
- 0, 0, 34, 0, 92, 0, 0, 0, 93, 0, 0, 0, 0, 0, 34, 0, 97, 0, 0, 0,101, 0, 0, 0, 0, 0, 34, 0, 96, 0, 0, 0,
- 97, 0, 0, 0, 0, 0, 34, 0, 96, 0, 0, 0,100, 0, 0, 0, 0, 0, 34, 0, 95, 0, 0, 0, 96, 0, 0, 0, 0, 0, 34, 0,
- 95, 0, 0, 0, 99, 0, 0, 0, 0, 0, 34, 0, 94, 0, 0, 0, 95, 0, 0, 0, 0, 0, 34, 0, 94, 0, 0, 0, 98, 0, 0, 0,
- 0, 0, 34, 0,101, 0, 0, 0,110, 0, 0, 0, 0, 0, 34, 0,101, 0, 0, 0,105, 0, 0, 0, 0, 0, 34, 0,100, 0, 0, 0,
-101, 0, 0, 0, 0, 0, 34, 0,100, 0, 0, 0,104, 0, 0, 0, 0, 0, 34, 0, 99, 0, 0, 0,100, 0, 0, 0, 0, 0, 34, 0,
- 99, 0, 0, 0,103, 0, 0, 0, 0, 0, 34, 0, 98, 0, 0, 0, 99, 0, 0, 0, 0, 0, 34, 0, 98, 0, 0, 0,102, 0, 0, 0,
- 0, 0, 34, 0,105, 0, 0, 0,109, 0, 0, 0, 0, 0, 34, 0,104, 0, 0, 0,105, 0, 0, 0, 0, 0, 34, 0,104, 0, 0, 0,
-108, 0, 0, 0, 0, 0, 34, 0,103, 0, 0, 0,104, 0, 0, 0, 0, 0, 34, 0,103, 0, 0, 0,107, 0, 0, 0, 0, 0, 34, 0,
-102, 0, 0, 0,103, 0, 0, 0, 0, 0, 34, 0,102, 0, 0, 0,106, 0, 0, 0, 0, 0, 34, 0,109, 0, 0, 0,111, 0, 0, 0,
- 0, 0, 34, 0,108, 0, 0, 0,109, 0, 0, 0, 0, 0, 34, 0,107, 0, 0, 0,108, 0, 0, 0, 0, 0, 34, 0,106, 0, 0, 0,
-107, 0, 0, 0, 0, 0, 34, 0, 65, 0, 0, 0, 78, 0, 0, 0, 0, 0, 34, 0, 66, 0, 0, 0, 83, 0, 0, 0, 0, 0, 34, 0,
- 58, 0, 0, 0, 85, 0, 0, 0, 0, 0, 34, 0, 59, 0, 0, 0,111, 0, 0, 0, 0, 0, 34, 0, 60, 0, 0, 0, 84, 0, 0, 0,
- 0, 0, 34, 0, 61, 0, 0, 0,110, 0, 0, 0, 0, 0, 34, 0, 30, 0, 0, 0, 93, 0, 0, 0, 0, 0, 34, 0, 31, 0, 0, 0,
- 92, 0, 0, 0, 0, 0, 34, 0, 32, 0, 0, 0, 91, 0, 0, 0, 0, 0, 34, 0, 33, 0, 0, 0, 90, 0, 0, 0, 0, 0, 34, 0,
-113, 0, 0, 0,130, 0, 0, 0, 0, 0, 35, 0,115, 0, 0, 0,131, 0, 0, 0, 0, 0, 35, 0,112, 0, 0, 0,132, 0, 0, 0,
- 0, 0, 35, 0,114, 0, 0, 0,133, 0, 0, 0, 0, 0, 35, 0,116, 0, 0, 0,125, 0, 0, 0, 0, 0, 35, 0,117, 0, 0, 0,
-126, 0, 0, 0, 0, 0, 35, 0,113, 0, 0, 0,115, 0, 0, 0, 0, 0, 35, 0,112, 0, 0, 0,115, 0, 0, 0, 0, 0,163, 0,
-112, 0, 0, 0,114, 0, 0, 0, 0, 0, 35, 0,113, 0, 0, 0,116, 0, 0, 0, 0, 0,163, 0,116, 0, 0, 0,117, 0, 0, 0,
- 0, 0, 35, 0,118, 0, 0, 0,127, 0, 0, 0, 0, 0, 35, 0,118, 0, 0, 0,120, 0, 0, 0, 0, 0, 35, 0,127, 0, 0, 0,
-146, 0, 0, 0, 0, 0,163, 0,142, 0, 0, 0,146, 0, 0, 0, 0, 0, 35, 0,144, 0, 0, 0,147, 0, 0, 0, 0, 0, 35, 0,
-129, 0, 0, 0,147, 0, 0, 0, 0, 0, 35, 0,128, 0, 0, 0,147, 0, 0, 0, 0, 0,163, 0,128, 0, 0, 0,146, 0, 0, 0,
- 0, 0, 35, 0,119, 0, 0, 0,127, 0, 0, 0, 0, 0, 35, 0,119, 0, 0, 0,120, 0, 0, 0, 0, 0, 35, 0,119, 0, 0, 0,
-121, 0, 0, 0, 0, 0, 35, 0,122, 0, 0, 0,124, 0, 0, 0, 0, 0, 35, 0,121, 0, 0, 0,122, 0, 0, 0, 0, 0, 35, 0,
-121, 0, 0, 0,123, 0, 0, 0, 0, 0, 35, 0,123, 0, 0, 0,124, 0, 0, 0, 0, 0, 35, 0,123, 0, 0, 0,125, 0, 0, 0,
- 0, 0, 35, 0,125, 0, 0, 0,126, 0, 0, 0, 0, 0, 35, 0,132, 0, 0, 0,133, 0, 0, 0, 0, 0, 35, 0,131, 0, 0, 0,
-132, 0, 0, 0, 0, 0, 35, 0,130, 0, 0, 0,131, 0, 0, 0, 0, 0, 35, 0,133, 0, 0, 0,137, 0, 0, 0, 0, 0,163, 0,
-136, 0, 0, 0,137, 0, 0, 0, 0, 0, 35, 0,132, 0, 0, 0,136, 0, 0, 0, 0, 0, 35, 0,135, 0, 0, 0,136, 0, 0, 0,
- 0, 0, 35, 0,131, 0, 0, 0,135, 0, 0, 0, 0, 0, 35, 0,134, 0, 0, 0,135, 0, 0, 0, 0, 0, 35, 0,130, 0, 0, 0,
-134, 0, 0, 0, 0, 0, 35, 0,137, 0, 0, 0,141, 0, 0, 0, 0, 0, 35, 0,140, 0, 0, 0,141, 0, 0, 0, 0, 0, 35, 0,
-136, 0, 0, 0,140, 0, 0, 0, 0, 0, 35, 0,139, 0, 0, 0,140, 0, 0, 0, 0, 0, 35, 0,135, 0, 0, 0,139, 0, 0, 0,
- 0, 0, 35, 0,138, 0, 0, 0,139, 0, 0, 0, 0, 0, 35, 0,134, 0, 0, 0,138, 0, 0, 0, 0, 0, 35, 0,141, 0, 0, 0,
-145, 0, 0, 0, 0, 0,163, 0,144, 0, 0, 0,145, 0, 0, 0, 0, 0, 35, 0,140, 0, 0, 0,144, 0, 0, 0, 0, 0, 35, 0,
-143, 0, 0, 0,144, 0, 0, 0, 0, 0, 35, 0,139, 0, 0, 0,143, 0, 0, 0, 0, 0, 35, 0,142, 0, 0, 0,143, 0, 0, 0,
- 0, 0, 35, 0,138, 0, 0, 0,142, 0, 0, 0, 0, 0, 35, 0,129, 0, 0, 0,145, 0, 0, 0, 0, 0, 35, 0,128, 0, 0, 0,
-143, 0, 0, 0, 0, 0, 35, 0,125, 0, 0, 0,130, 0, 0, 0, 0, 0, 35, 0,123, 0, 0, 0,134, 0, 0, 0, 0, 0, 35, 0,
-121, 0, 0, 0,138, 0, 0, 0, 0, 0, 35, 0,119, 0, 0, 0,142, 0, 0, 0, 0, 0, 35, 0,151, 0, 0, 0,166, 0, 0, 0,
- 0, 0, 35, 0,150, 0, 0, 0,167, 0, 0, 0, 0, 0, 35, 0,149, 0, 0, 0,168, 0, 0, 0, 0, 0, 35, 0,148, 0, 0, 0,
-169, 0, 0, 0, 0, 0, 35, 0,152, 0, 0, 0,154, 0, 0, 0, 0, 0,163, 0,148, 0, 0, 0,149, 0, 0, 0, 0, 0, 35, 0,
-150, 0, 0, 0,151, 0, 0, 0, 0, 0, 35, 0,157, 0, 0, 0,178, 0, 0, 0, 0, 0, 35, 0,156, 0, 0, 0,174, 0, 0, 0,
- 0, 0, 35, 0,155, 0, 0, 0,170, 0, 0, 0, 0, 0, 35, 0,154, 0, 0, 0,166, 0, 0, 0, 0, 0, 35, 0,154, 0, 0, 0,
-155, 0, 0, 0, 0, 0, 35, 0,155, 0, 0, 0,156, 0, 0, 0, 0, 0,163, 0,156, 0, 0, 0,157, 0, 0, 0, 0, 0, 35, 0,
-153, 0, 0, 0,157, 0, 0, 0, 0, 0,163, 0,158, 0, 0, 0,181, 0, 0, 0, 0, 0, 35, 0,159, 0, 0, 0,177, 0, 0, 0,
- 0, 0, 35, 0,160, 0, 0, 0,173, 0, 0, 0, 0, 0, 35, 0,161, 0, 0, 0,169, 0, 0, 0, 0, 0, 35, 0,158, 0, 0, 0,
-159, 0, 0, 0, 0, 0, 35, 0,160, 0, 0, 0,161, 0, 0, 0, 0, 0, 35, 0,162, 0, 0, 0,163, 0, 0, 0, 0, 0, 35, 0,
-164, 0, 0, 0,165, 0, 0, 0, 0, 0, 35, 0,168, 0, 0, 0,169, 0, 0, 0, 0, 0, 35, 0,167, 0, 0, 0,168, 0, 0, 0,
- 0, 0, 35, 0,166, 0, 0, 0,167, 0, 0, 0, 0, 0, 35, 0,169, 0, 0, 0,173, 0, 0, 0, 0, 0, 35, 0,172, 0, 0, 0,
-173, 0, 0, 0, 0, 0, 35, 0,168, 0, 0, 0,172, 0, 0, 0, 0, 0, 35, 0,171, 0, 0, 0,172, 0, 0, 0, 0, 0, 35, 0,
-167, 0, 0, 0,171, 0, 0, 0, 0, 0, 35, 0,170, 0, 0, 0,171, 0, 0, 0, 0, 0, 35, 0,166, 0, 0, 0,170, 0, 0, 0,
- 0, 0, 35, 0,173, 0, 0, 0,177, 0, 0, 0, 0, 0, 35, 0,176, 0, 0, 0,177, 0, 0, 0, 0, 0, 35, 0,172, 0, 0, 0,
-176, 0, 0, 0, 0, 0, 35, 0,175, 0, 0, 0,176, 0, 0, 0, 0, 0, 35, 0,171, 0, 0, 0,175, 0, 0, 0, 0, 0, 35, 0,
-174, 0, 0, 0,175, 0, 0, 0, 0, 0, 35, 0,170, 0, 0, 0,174, 0, 0, 0, 0, 0, 35, 0,177, 0, 0, 0,181, 0, 0, 0,
- 0, 0, 35, 0,180, 0, 0, 0,181, 0, 0, 0, 0, 0, 35, 0,176, 0, 0, 0,180, 0, 0, 0, 0, 0, 35, 0,179, 0, 0, 0,
-180, 0, 0, 0, 0, 0, 35, 0,175, 0, 0, 0,179, 0, 0, 0, 0, 0, 35, 0,178, 0, 0, 0,179, 0, 0, 0, 0, 0, 35, 0,
-174, 0, 0, 0,178, 0, 0, 0, 0, 0, 35, 0,165, 0, 0, 0,181, 0, 0, 0, 0, 0, 35, 0,164, 0, 0, 0,180, 0, 0, 0,
- 0, 0, 35, 0,163, 0, 0, 0,179, 0, 0, 0, 0, 0, 35, 0,162, 0, 0, 0,178, 0, 0, 0, 0, 0, 35, 0, 68, 65, 84, 65,
- 64, 1, 0, 0,240,116,118, 1, 0, 0, 0, 0, 5, 1, 0, 0, 5, 0, 0, 0, 4, 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,112,118,118, 1, 0, 0, 0, 0, 5, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 85, 86, 84,101,120, 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,128,124,118, 1, 0, 0, 0, 0, 6, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67,111,108, 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,160,138,118, 1, 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, 68, 65, 84, 65,200, 5, 0, 0,112,118,118, 1,
- 0, 0, 0, 0, 52, 0, 0, 0, 74, 0, 0, 0, 35, 0, 0, 0, 34, 0, 0, 0, 5, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0,
- 37, 0, 0, 0, 36, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 45, 0, 0, 0, 44, 0, 0, 0,
- 9, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 4, 0, 0, 0, 8, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 2, 0, 0, 0, 6, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 9, 0, 0, 0, 13, 0, 0, 0, 12, 0, 0, 0,
- 0, 0, 0, 0, 6, 0, 0, 0, 7, 0, 0, 0, 11, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 43, 0, 0, 0,
- 42, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 12, 0, 0, 0, 16, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 10, 0, 0, 0, 14, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 17, 0, 0, 0, 73, 0, 0, 0,
- 74, 0, 0, 0, 0, 0, 0, 0, 75, 0, 0, 0, 76, 0, 0, 0, 14, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, 0,
- 20, 0, 0, 0, 36, 0, 0, 0, 37, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 18, 0, 0, 0, 34, 0, 0, 0, 35, 0, 0, 0,
- 0, 0, 0, 0, 50, 0, 0, 0, 25, 0, 0, 0, 21, 0, 0, 0, 46, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 23, 0, 0, 0,
- 19, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 22, 0, 0, 0, 40, 0, 0, 0, 41, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0,
- 29, 0, 0, 0, 28, 0, 0, 0, 24, 0, 0, 0, 25, 0, 0, 0, 0, 0, 0, 0, 27, 0, 0, 0, 26, 0, 0, 0, 22, 0, 0, 0,
- 23, 0, 0, 0, 0, 0, 0, 0, 58, 0, 0, 0, 33, 0, 0, 0, 29, 0, 0, 0, 54, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0,
- 31, 0, 0, 0, 27, 0, 0, 0, 28, 0, 0, 0, 0, 0, 0, 0, 30, 0, 0, 0, 38, 0, 0, 0, 39, 0, 0, 0, 26, 0, 0, 0,
- 0, 0, 0, 0, 90, 0, 0, 0, 91, 0, 0, 0, 32, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 0, 92, 0, 0, 0, 93, 0, 0, 0,
- 30, 0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 0, 49, 0, 0, 0, 48, 0, 0, 0, 63, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
- 62, 0, 0, 0, 0, 0, 0, 0, 47, 0, 0, 0, 46, 0, 0, 0, 0, 0, 0, 0, 52, 0, 0, 0, 51, 0, 0, 0, 47, 0, 0, 0,
- 48, 0, 0, 0, 0, 0, 0, 0, 57, 0, 0, 0, 56, 0, 0, 0, 52, 0, 0, 0, 53, 0, 0, 0, 0, 0, 0, 0, 55, 0, 0, 0,
- 54, 0, 0, 0, 50, 0, 0, 0, 51, 0, 0, 0, 0, 0, 0, 0, 60, 0, 0, 0, 59, 0, 0, 0, 55, 0, 0, 0, 56, 0, 0, 0,
- 0, 0, 0, 0,110, 0, 0, 0, 84, 0, 0, 0, 60, 0, 0, 0, 61, 0, 0, 0, 0, 0, 0, 0,111, 0, 0, 0, 85, 0, 0, 0,
- 58, 0, 0, 0, 59, 0, 0, 0, 0, 0, 0, 0, 78, 0, 0, 0, 83, 0, 0, 0, 66, 0, 0, 0, 65, 0, 0, 0, 0, 0, 0, 0,
- 66, 0, 0, 0, 61, 0, 0, 0, 57, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 68, 0, 0, 0, 70, 0, 0, 0,
- 69, 0, 0, 0, 0, 0, 0, 0, 70, 0, 0, 0, 53, 0, 0, 0, 49, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 71, 0, 0, 0,
- 72, 0, 0, 0, 64, 0, 0, 0, 77, 0, 0, 0, 0, 0, 0, 0, 80, 0, 0, 0, 79, 0, 0, 0, 97, 0, 0, 0, 96, 0, 0, 0,
- 0, 0, 0, 0, 95, 0, 0, 0, 94, 0, 0, 0, 82, 0, 0, 0, 81, 0, 0, 0, 0, 0, 0, 0,110, 0, 0, 0,101, 0, 0, 0,
- 97, 0, 0, 0, 83, 0, 0, 0, 0, 0, 0, 0,100, 0, 0, 0, 99, 0, 0, 0, 95, 0, 0, 0, 96, 0, 0, 0, 0, 0, 0, 0,
- 98, 0, 0, 0, 88, 0, 0, 0, 89, 0, 0, 0, 94, 0, 0, 0, 0, 0, 0, 0,105, 0, 0, 0,104, 0, 0, 0,100, 0, 0, 0,
-101, 0, 0, 0, 0, 0, 0, 0,103, 0, 0, 0,102, 0, 0, 0, 98, 0, 0, 0, 99, 0, 0, 0, 0, 0, 0, 0,111, 0, 0, 0,
-109, 0, 0, 0,105, 0, 0, 0, 84, 0, 0, 0, 0, 0, 0, 0,108, 0, 0, 0,107, 0, 0, 0,103, 0, 0, 0,104, 0, 0, 0,
- 0, 0, 0, 0,106, 0, 0, 0, 86, 0, 0, 0, 87, 0, 0, 0,102, 0, 0, 0, 0, 0, 0, 0, 90, 0, 0, 0, 91, 0, 0, 0,
-108, 0, 0, 0,109, 0, 0, 0, 0, 0, 0, 0, 92, 0, 0, 0, 93, 0, 0, 0,106, 0, 0, 0,107, 0, 0, 0, 0, 0, 0, 0,
-120, 0, 0, 0,119, 0, 0, 0,127, 0, 0, 0,118, 0, 0, 0, 0, 0, 0, 2,121, 0, 0, 0,138, 0, 0, 0,142, 0, 0, 0,
-119, 0, 0, 0, 0, 0, 0, 2,124, 0, 0, 0,123, 0, 0, 0,121, 0, 0, 0,122, 0, 0, 0, 0, 0, 0, 2,125, 0, 0, 0,
-130, 0, 0, 0,134, 0, 0, 0,123, 0, 0, 0, 0, 0, 0, 2,117, 0, 0, 0,116, 0, 0, 0,125, 0, 0, 0,126, 0, 0, 0,
- 0, 0, 0, 2,112, 0, 0, 0,114, 0, 0, 0,133, 0, 0, 0,132, 0, 0, 0, 0, 0, 0, 2,113, 0, 0, 0,115, 0, 0, 0,
-131, 0, 0, 0,130, 0, 0, 0, 0, 0, 0, 2,131, 0, 0, 0,132, 0, 0, 0,136, 0, 0, 0,135, 0, 0, 0, 0, 0, 0, 2,
-136, 0, 0, 0,137, 0, 0, 0,141, 0, 0, 0,140, 0, 0, 0, 0, 0, 0, 2,134, 0, 0, 0,135, 0, 0, 0,139, 0, 0, 0,
-138, 0, 0, 0, 0, 0, 0, 2,139, 0, 0, 0,140, 0, 0, 0,144, 0, 0, 0,143, 0, 0, 0, 0, 0, 0, 2,129, 0, 0, 0,
-147, 0, 0, 0,144, 0, 0, 0,145, 0, 0, 0, 0, 0, 0, 2,142, 0, 0, 0,143, 0, 0, 0,128, 0, 0, 0,146, 0, 0, 0,
- 0, 0, 0, 2,149, 0, 0, 0,148, 0, 0, 0,169, 0, 0, 0,168, 0, 0, 0, 0, 0, 0, 2,151, 0, 0, 0,150, 0, 0, 0,
-167, 0, 0, 0,166, 0, 0, 0, 0, 0, 0, 2,169, 0, 0, 0,161, 0, 0, 0,160, 0, 0, 0,173, 0, 0, 0, 0, 0, 0, 2,
-167, 0, 0, 0,168, 0, 0, 0,172, 0, 0, 0,171, 0, 0, 0, 0, 0, 0, 2,154, 0, 0, 0,166, 0, 0, 0,170, 0, 0, 0,
-155, 0, 0, 0, 0, 0, 0, 2,172, 0, 0, 0,173, 0, 0, 0,177, 0, 0, 0,176, 0, 0, 0, 0, 0, 0, 2,170, 0, 0, 0,
-171, 0, 0, 0,175, 0, 0, 0,174, 0, 0, 0, 0, 0, 0, 2,177, 0, 0, 0,159, 0, 0, 0,158, 0, 0, 0,181, 0, 0, 0,
- 0, 0, 0, 2,175, 0, 0, 0,176, 0, 0, 0,180, 0, 0, 0,179, 0, 0, 0, 0, 0, 0, 2,156, 0, 0, 0,174, 0, 0, 0,
-178, 0, 0, 0,157, 0, 0, 0, 0, 0, 0, 2,180, 0, 0, 0,181, 0, 0, 0,165, 0, 0, 0,164, 0, 0, 0, 0, 0, 0, 2,
-178, 0, 0, 0,179, 0, 0, 0,163, 0, 0, 0,162, 0, 0, 0, 0, 0, 0, 2, 68, 65, 84, 65,224, 13, 0, 0,128,124,118, 1,
- 0, 0, 0, 0, 60, 0, 0, 0, 74, 0, 0, 0,160, 84,104, 61,242, 65, 79, 63,128,105,188,189,120, 47, 41, 63,160, 84,104, 61,
- 0, 29, 3, 63, 26, 95, 82, 62,120, 47, 41, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,122, 84,181, 62,
-113,179,141, 63, 26, 95, 82, 62,102, 84,117, 63,127, 84,181, 62,242, 65, 79, 63,190,188, 0, 63,102, 84,117, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,160, 84,104, 61, 0, 29, 3, 63,128,106,188,189,176, 20,186, 62,144, 82,104, 61,
-128,223, 91, 62, 14, 95, 82, 62, 0, 21,186, 62, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,127, 84,181, 62,
-242, 65, 79, 63, 26, 95, 82, 62,120, 47, 41, 63,122, 84,181, 62,248, 28, 3, 63,188,188, 0, 63,120, 47, 41, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 56,207, 38, 63,111,179,141, 63,190,188, 0, 63,102, 84,117, 63, 52,207, 38, 63,
-236, 65, 79, 63,172,225, 76, 63,102, 84,117, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,122, 84,181, 62,
-248, 28, 3, 63, 14, 95, 82, 62, 0, 21,186, 62,122, 84,181, 62, 32,224, 91, 62,185,188, 0, 63, 0, 21,186, 62, 0, 0, 0, 0,
- 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 52,207, 38, 63,236, 65, 79, 63,188,188, 0, 63,120, 47, 41, 63, 52,207, 38, 63,
-248, 28, 3, 63,174,225, 76, 63,116, 47, 41, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,122, 84,181, 62,
- 32,224, 91, 62,138, 94, 82, 62, 48, 43,135, 61, 61, 84,181, 62,176,104,169,189,185,188, 0, 63, 96, 44,135, 61, 0, 0, 0, 0,
- 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 52,207, 38, 63,248, 28, 3, 63,185,188, 0, 63, 0, 21,186, 62, 51,207, 38, 63,
- 24,224, 91, 62,174,225, 76, 63, 0, 21,186, 62, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 44,244,114, 63,
-236, 65, 79, 63,174,225, 76, 63,116, 47, 41, 63, 42,244,114, 63,244, 28, 3, 63, 99,131,140, 63, 76, 47, 41, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 51,207, 38, 63, 24,224, 91, 62,185,188, 0, 63, 96, 44,135, 61,248,207, 38, 63,
-144,109,169,189,112,226, 76, 63, 64, 38,135, 61, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,240,244,114, 63,
- 4,221, 91, 62,180,131,140, 63,116, 19,186, 62, 42,244,114, 63,244, 28, 3, 63,174,225, 76, 63, 0, 21,186, 62, 0, 0, 0, 0,
- 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,122, 84,181, 62,113,179,141, 63, 26, 95, 82, 62,102, 84,117, 63, 26, 95, 82, 62,
-102, 84,117, 63,122, 84,181, 62,113,179,141, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,160, 84,104, 61,
-242, 65, 79, 63,128,105,188,189,120, 47, 41, 63,128,105,188,189,120, 47, 41, 63,160, 84,104, 61,242, 65, 79, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,188,188, 0, 63,173,188,160, 63,122, 84,181, 62,113,179,141, 63,122, 84,181, 62,
-113,179,141, 63,188,188, 0, 63,173,188,160, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 26, 95, 82, 62,
-102, 84,117, 63,160, 84,104, 61,242, 65, 79, 63,160, 84,104, 61,242, 65, 79, 63, 26, 95, 82, 62,102, 84,117, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,128,105,188,189,120, 47, 41, 63, 64,127,118,190,216, 28, 3, 63, 64,127,118,190,
-216, 28, 3, 63,128,105,188,189,120, 47, 41, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,122, 84,181, 62,
-113,179,141, 63, 26, 95, 82, 62,102, 84,117, 63, 26, 95, 82, 62,102, 84,117, 63,122, 84,181, 62,113,179,141, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,160, 84,104, 61,242, 65, 79, 63,128,105,188,189,120, 47, 41, 63,128,105,188,189,
-120, 47, 41, 63,160, 84,104, 61,242, 65, 79, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,188,188, 0, 63,
-173,188,160, 63,122, 84,181, 62,113,179,141, 63,122, 84,181, 62,113,179,141, 63,188,188, 0, 63,173,188,160, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 26, 95, 82, 62,102, 84,117, 63,200, 84,104, 61,242, 65, 79, 63,160, 84,104, 61,
-242, 65, 79, 63, 26, 95, 82, 62,102, 84,117, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 96,105,188,189,
-120, 47, 41, 63, 56,127,118,190,220, 28, 3, 63, 64,127,118,190,216, 28, 3, 63,128,105,188,189,120, 47, 41, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,122, 84,181, 62,113,179,141, 63, 26, 95, 82, 62,102, 84,117, 63, 26, 95, 82, 62,
-102, 84,117, 63,122, 84,181, 62,113,179,141, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,200, 84,104, 61,
-244, 65, 79, 63, 96,105,188,189,120, 47, 41, 63, 96,105,188,189,120, 47, 41, 63,200, 84,104, 61,242, 65, 79, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 44,244,114, 63,236, 65, 79, 63,172,225, 76, 63,102, 84,117, 63,172,225, 76, 63,
-102, 84,117, 63, 44,244,114, 63,236, 65, 79, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,188,188, 0, 63,
-173,188,160, 63, 56,207, 38, 63,111,179,141, 63, 52,207, 38, 63,111,179,141, 63,188,188, 0, 63,173,188,160, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,172,225, 76, 63,102, 84,117, 63, 52,207, 38, 63,111,179,141, 63, 52,207, 38, 63,
-111,179,141, 63,172,225, 76, 63,102, 84,117, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 44,244,114, 63,
-236, 65, 79, 63,172,225, 76, 63,102, 84,117, 63,172,225, 76, 63,102, 84,117, 63, 44,244,114, 63,236, 65, 79, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 52,207, 38, 63,111,179,141, 63,188,188, 0, 63,173,188,160, 63,188,188, 0, 63,
-173,188,160, 63, 52,207, 38, 63,111,179,141, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,174,225, 76, 63,
-102, 84,117, 63, 52,207, 38, 63,111,179,141, 63, 52,207, 38, 63,111,179,141, 63,172,225, 76, 63,102, 84,117, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 44,244,114, 63,236, 65, 79, 63,174,225, 76, 63,102, 84,117, 63,174,225, 76, 63,
-102, 84,117, 63, 44,244,114, 63,236, 65, 79, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 52,207, 38, 63,
-111,179,141, 63,190,188, 0, 63,171,188,160, 63,188,188, 0, 63,173,188,160, 63, 52,207, 38, 63,111,179,141, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,162,140,159, 63,210, 28, 3, 63, 99,131,140, 63, 72, 47, 41, 63, 99,131,140, 63,
- 76, 47, 41, 63,161,140,159, 63,210, 28, 3, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 99,131,140, 63,
- 76, 47, 41, 63, 44,244,114, 63,236, 65, 79, 63, 44,244,114, 63,236, 65, 79, 63, 99,131,140, 63, 76, 47, 41, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,161,140,159, 63,210, 28, 3, 63, 99,131,140, 63, 76, 47, 41, 63, 99,131,140, 63,
- 76, 47, 41, 63,161,140,159, 63,210, 28, 3, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 99,131,140, 63,
- 76, 47, 41, 63, 44,244,114, 63,236, 65, 79, 63, 44,244,114, 63,236, 65, 79, 63, 99,131,140, 63, 76, 47, 41, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,161,140,159, 63,210, 28, 3, 63, 99,131,140, 63, 76, 47, 41, 63, 99,131,140, 63,
- 76, 47, 41, 63,244,140,159, 63, 50, 28, 3, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 22,172,131, 63,
- 96,211, 93, 59,226,151,158, 63, 96,211, 93, 59,224,151,158, 63, 96,211, 93, 59, 22,172,131, 63, 96,211, 93, 59, 0, 0, 0, 0,
- 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0,144,128, 81, 63, 96,211, 93, 59,247,168, 27, 63, 96,211, 93, 59,248,168, 27, 63,
- 96,211, 93, 59,144,128, 81, 63, 96,211, 93, 59, 0, 0, 0, 0, 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0,176,131,185, 63,
- 96,211, 93, 59,226,151,158, 63, 96,211, 93, 59,224,151,158, 63, 96,211, 93, 59,174,131,185, 63, 96,211, 93, 59, 0, 0, 0, 0,
- 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0, 21,172,131, 63, 96,211, 93, 59,144,128, 81, 63, 96,211, 93, 59,144,128, 81, 63,
- 96,211, 93, 59, 22,172,131, 63, 96,211, 93, 59, 0, 0, 0, 0, 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0,247,168, 27, 63,
- 96,211, 93, 59, 85,162,203, 62, 96,211, 93, 59, 85,162,203, 62, 96,211, 93, 59,247,168, 27, 63, 96,211, 93, 59, 0, 0, 0, 0,
- 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0,226,151,158, 63, 96,211, 93, 59, 24,172,131, 63, 96,211, 93, 59, 21,172,131, 63,
- 96,211, 93, 59,226,151,158, 63, 96,211, 93, 59, 0, 0, 0, 0, 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0,142,128, 81, 63,
- 96,211, 93, 59,246,168, 27, 63, 96,211, 93, 59,247,168, 27, 63, 96,211, 93, 59,144,128, 81, 63, 96,211, 93, 59, 0, 0, 0, 0,
- 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0,174,131,185, 63, 96,211, 93, 59,227,151,158, 63, 96,211, 93, 59,226,151,158, 63,
- 96,211, 93, 59,174,131,185, 63, 96,211, 93, 59, 0, 0, 0, 0, 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0, 22,172,131, 63,
- 96,211, 93, 59,149,128, 81, 63, 96,211, 93, 59,142,128, 81, 63, 96,211, 93, 59, 24,172,131, 63, 96,211, 93, 59, 0, 0, 0, 0,
- 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0,251,168, 27, 63, 96,211, 93, 59, 84,162,203, 62, 96,211, 93, 59, 86,162,203, 62,
- 96,211, 93, 59,246,168, 27, 63, 96,211, 93, 59, 0, 0, 0, 0, 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0,225,151,158, 63,
- 96,211, 93, 59, 21,172,131, 63, 96,211, 93, 59, 22,172,131, 63, 96,211, 93, 59,227,151,158, 63, 96,211, 93, 59, 0, 0, 0, 0,
- 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0,146,128, 81, 63, 96,211, 93, 59,250,168, 27, 63, 96,211, 93, 59,251,168, 27, 63,
- 96,211, 93, 59,149,128, 81, 63, 96,211, 93, 59, 0, 0, 0, 0, 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0,161,140,159, 63,
-210, 28, 3, 63, 99,131,140, 63, 76, 47, 41, 63, 99,131,140, 63, 76, 47, 41, 63,244,140,159, 63, 50, 28, 3, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 99,131,140, 63, 76, 47, 41, 63, 44,244,114, 63,236, 65, 79, 63, 44,244,114, 63,
-236, 65, 79, 63, 99,131,140, 63, 76, 47, 41, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,161,140,159, 63,
-210, 28, 3, 63, 99,131,140, 63, 76, 47, 41, 63, 99,131,140, 63, 76, 47, 41, 63,161,140,159, 63,210, 28, 3, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 99,131,140, 63, 76, 47, 41, 63, 44,244,114, 63,236, 65, 79, 63, 44,244,114, 63,
-236, 65, 79, 63, 99,131,140, 63, 76, 47, 41, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,162,140,159, 63,
-210, 28, 3, 63, 99,131,140, 63, 72, 47, 41, 63, 99,131,140, 63, 76, 47, 41, 63,161,140,159, 63,210, 28, 3, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 52,207, 38, 63,111,179,141, 63,190,188, 0, 63,171,188,160, 63,188,188, 0, 63,
-173,188,160, 63, 52,207, 38, 63,111,179,141, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 44,244,114, 63,
-236, 65, 79, 63,174,225, 76, 63,102, 84,117, 63,174,225, 76, 63,102, 84,117, 63, 44,244,114, 63,236, 65, 79, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,174,225, 76, 63,102, 84,117, 63, 52,207, 38, 63,111,179,141, 63, 52,207, 38, 63,
-111,179,141, 63,172,225, 76, 63,102, 84,117, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 52,207, 38, 63,
-111,179,141, 63,188,188, 0, 63,173,188,160, 63,188,188, 0, 63,173,188,160, 63, 52,207, 38, 63,111,179,141, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 44,244,114, 63,236, 65, 79, 63,172,225, 76, 63,102, 84,117, 63,172,225, 76, 63,
-102, 84,117, 63, 44,244,114, 63,236, 65, 79, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,172,225, 76, 63,
-102, 84,117, 63, 52,207, 38, 63,111,179,141, 63, 52,207, 38, 63,111,179,141, 63,172,225, 76, 63,102, 84,117, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,188,188, 0, 63,173,188,160, 63, 56,207, 38, 63,111,179,141, 63, 52,207, 38, 63,
-111,179,141, 63,188,188, 0, 63,173,188,160, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 44,244,114, 63,
-236, 65, 79, 63,172,225, 76, 63,102, 84,117, 63,172,225, 76, 63,102, 84,117, 63, 44,244,114, 63,236, 65, 79, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,200, 84,104, 61,244, 65, 79, 63, 96,105,188,189,120, 47, 41, 63, 96,105,188,189,
-120, 47, 41, 63,200, 84,104, 61,242, 65, 79, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,122, 84,181, 62,
-113,179,141, 63, 26, 95, 82, 62,102, 84,117, 63, 26, 95, 82, 62,102, 84,117, 63,122, 84,181, 62,113,179,141, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 96,105,188,189,120, 47, 41, 63, 56,127,118,190,220, 28, 3, 63, 64,127,118,190,
-216, 28, 3, 63,128,105,188,189,120, 47, 41, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 26, 95, 82, 62,
-102, 84,117, 63,200, 84,104, 61,242, 65, 79, 63,160, 84,104, 61,242, 65, 79, 63, 26, 95, 82, 62,102, 84,117, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,188,188, 0, 63,173,188,160, 63,122, 84,181, 62,113,179,141, 63,122, 84,181, 62,
-113,179,141, 63,188,188, 0, 63,173,188,160, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,160, 84,104, 61,
-242, 65, 79, 63,128,105,188,189,120, 47, 41, 63,128,105,188,189,120, 47, 41, 63,160, 84,104, 61,242, 65, 79, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,122, 84,181, 62,113,179,141, 63, 26, 95, 82, 62,102, 84,117, 63, 26, 95, 82, 62,
-102, 84,117, 63,122, 84,181, 62,113,179,141, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,128,105,188,189,
-120, 47, 41, 63, 64,127,118,190,216, 28, 3, 63, 64,127,118,190,216, 28, 3, 63,128,105,188,189,120, 47, 41, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 26, 95, 82, 62,102, 84,117, 63,160, 84,104, 61,242, 65, 79, 63,160, 84,104, 61,
-242, 65, 79, 63, 26, 95, 82, 62,102, 84,117, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,188,188, 0, 63,
-173,188,160, 63,122, 84,181, 62,113,179,141, 63,122, 84,181, 62,113,179,141, 63,188,188, 0, 63,173,188,160, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,160, 84,104, 61,242, 65, 79, 63,128,105,188,189,120, 47, 41, 63,128,105,188,189,
-120, 47, 41, 63,160, 84,104, 61,242, 65, 79, 63, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0,122, 84,181, 62,
-113,179,141, 63, 26, 95, 82, 62,102, 84,117, 63, 26, 95, 82, 62,102, 84,117, 63,122, 84,181, 62,113,179,141, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 60, 0, 1, 0, 0, 0, 0, 0, 68, 65, 84, 65,160, 4, 0, 0,160,138,118, 1, 0, 0, 0, 0, 57, 0, 0, 0,
- 40, 1, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255, 77, 69, 0, 0,120, 1, 0, 0,144,162,118, 1, 0, 0, 0, 0, 50, 0, 0, 0, 1, 0, 0, 0,144,178,118, 1,
- 0, 0, 0, 0, 80, 83,118, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 69, 80,108,
- 97,110,101, 46, 48, 48, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,144, 69, 88, 1, 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, 64,178,118, 1, 0, 0, 0, 0,160,172,118, 1, 0, 0, 0, 0,128,173,118, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,208,165,118, 1, 0, 0, 0, 0, 96,169,118, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 64,175,118, 1, 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, 80,164,118, 1, 0, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0,224,167,118, 1,
- 0, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 32,171,118, 1, 0, 0, 0, 0, 3, 0, 0, 0,
- 5, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 0, 32, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4,205, 76, 63,172,197, 39, 55,214,204, 76, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 0, 5, 0, 0, 0, 0, 0, 1, 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, 68, 65, 84, 65, 8, 0, 0, 0, 64,178,118, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 64, 1, 0, 0, 80,164,118, 1,
- 0, 0, 0, 0, 5, 1, 0, 0, 5, 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,208,165,118, 1, 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, 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, 68, 65, 84, 65,204, 1, 0, 0,208,165,118, 1, 0, 0, 0, 0, 56, 0, 0, 0,
- 23, 0, 0, 0, 4,205, 76,191, 0, 0, 0, 0,208,204,204,190, 0, 0, 1,128, 0, 0, 3, 1, 55,205,204,190, 0, 0, 0, 0,
-216,204,204,190, 0, 0, 1,128, 0, 0, 3, 1, 0, 0, 70,182, 0, 0,128, 52,224,204,204,190, 0, 0, 1,128, 0, 0, 3, 1,
- 4,205, 76,191, 0, 0, 0, 0, 0, 0, 96, 52, 0, 0, 1,128, 0, 0, 3, 1, 55,205,204,190, 0, 0, 0, 0, 0, 0, 0,179,
- 0, 0, 1,128, 0, 0, 3, 1, 0, 0, 70,182, 0, 0,128, 52, 0, 0,144,180, 0, 0, 1,128, 0, 0, 3, 1, 4,205, 76,191,
- 0, 0, 0, 0,213,204,204, 62, 0, 0, 1,128, 0, 0, 3, 1, 55,205,204,190, 0, 0, 0, 0,205,204,204, 62, 0, 0, 1,128,
- 0, 0, 3, 1, 0, 0, 70,182, 0, 0,128, 52,197,204,204, 62, 0, 0, 1,128, 0, 0, 3, 1, 47,205,204,190, 0, 0, 0, 0,
-206,204, 76, 63, 0, 0, 1,128, 0, 0, 3, 1, 0, 0, 62,182, 0, 0,128, 52,206,204, 76, 63, 0, 0, 1,128, 0, 0, 3, 1,
- 4,205, 76,191, 0, 0, 0, 0,208,204, 76,191, 0, 0, 1,128, 0, 0, 3, 1, 55,205,204,190, 0, 0, 0, 0,212,204, 76,191,
- 0, 0, 1,128, 0, 0, 3, 1, 0, 0, 70,182, 0, 0,128, 52,214,204, 76,191, 0, 0, 1,128, 0, 0, 3, 1, 47,205,204, 62,
- 0, 0,128,180,206,204, 76,191, 0, 0, 1,128, 0, 0, 3, 1, 4,205, 76, 63, 0, 0, 0, 0,210,204, 76, 63, 0, 0, 1,128,
- 0, 0, 3, 1, 53,205,204, 62, 0, 0,128,180,214,204, 76, 63, 0, 0, 1,128, 0, 0, 3, 1, 0,205, 76, 63, 0, 0, 0, 0,
-213,204,204, 62, 0, 0, 1,128, 0, 0, 3, 1, 47,205,204, 62, 0, 0,128,180,221,204,204, 62, 0, 0, 1,128, 0, 0, 3, 1,
- 0,205, 76, 63, 0, 0, 0, 0, 0, 0, 96, 52, 0, 0, 1,128, 0, 0, 3, 1, 47,205,204, 62, 0, 0,128,180, 0, 0,240, 52,
- 0, 0, 1,128, 0, 0, 3, 1, 0,205, 76, 63, 0, 0, 0, 0,208,204,204,190, 0, 0, 1,128, 0, 0, 3, 1, 47,205,204, 62,
- 0, 0,128,180,200,204,204,190, 0, 0, 1,128, 0, 0, 3, 1, 68, 65, 84, 65, 64, 1, 0, 0,224,167,118, 1, 0, 0, 0, 0,
- 5, 1, 0, 0, 5, 0, 0, 0, 3, 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,
- 96,169,118, 1, 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, 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, 68, 65, 84, 65,128, 1, 0, 0, 96,169,118, 1, 0, 0, 0, 0, 53, 0, 0, 0, 32, 0, 0, 0,
- 2, 0, 0, 0, 22, 0, 0, 0, 0, 0, 35, 0, 5, 0, 0, 0, 20, 0, 0, 0, 0, 0, 35, 0, 8, 0, 0, 0, 18, 0, 0, 0,
- 0, 0, 35, 0, 14, 0, 0, 0, 13, 0, 0, 0, 0, 0, 35, 0, 2, 0, 0, 0, 13, 0, 0, 0, 0, 0, 35, 0, 1, 0, 0, 0,
- 12, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 35, 0, 5, 0, 0, 0, 2, 0, 0, 0, 0, 0, 35, 0,
- 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 35, 0, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 35, 0, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 35, 0, 5, 0, 0, 0, 8, 0, 0, 0, 0, 0, 35, 0, 5, 0, 0, 0, 4, 0, 0, 0, 0, 0, 35, 0, 4, 0, 0, 0,
- 7, 0, 0, 0, 0, 0, 35, 0, 4, 0, 0, 0, 3, 0, 0, 0, 0, 0, 35, 0, 6, 0, 0, 0, 3, 0, 0, 0, 0, 0, 35, 0,
- 8, 0, 0, 0, 10, 0, 0, 0, 0, 0, 35, 0, 8, 0, 0, 0, 7, 0, 0, 0, 0, 0, 35, 0, 7, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 35, 0, 6, 0, 0, 0, 7, 0, 0, 0, 0, 0, 35, 0, 9, 0, 0, 0, 10, 0, 0, 0, 0, 0, 35, 0, 11, 0, 0, 0,
- 12, 0, 0, 0, 0, 0, 35, 0, 15, 0, 0, 0, 16, 0, 0, 0, 0, 0, 35, 0, 16, 0, 0, 0, 18, 0, 0, 0, 0, 0, 35, 0,
- 17, 0, 0, 0, 18, 0, 0, 0, 0, 0, 35, 0, 15, 0, 0, 0, 17, 0, 0, 0, 0, 0, 35, 0, 18, 0, 0, 0, 20, 0, 0, 0,
- 0, 0, 35, 0, 19, 0, 0, 0, 20, 0, 0, 0, 0, 0, 35, 0, 20, 0, 0, 0, 22, 0, 0, 0, 0, 0, 35, 0, 21, 0, 0, 0,
- 22, 0, 0, 0, 0, 0, 35, 0, 19, 0, 0, 0, 21, 0, 0, 0, 0, 0, 35, 0, 14, 0, 0, 0, 22, 0, 0, 0, 0, 0, 35, 0,
- 68, 65, 84, 65, 64, 1, 0, 0, 32,171,118, 1, 0, 0, 0, 0, 5, 1, 0, 0, 5, 0, 0, 0, 4, 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,160,172,118, 1, 0, 0, 0, 0, 5, 0, 0, 0, 20, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 85, 86, 84,101,120, 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,128,173,118, 1, 0, 0, 0, 0, 6, 0, 0, 0, 64, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67,111,108, 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, 64,175,118, 1, 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, 68, 65, 84, 65,160, 0, 0, 0,
-160,172,118, 1, 0, 0, 0, 0, 52, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 12, 0, 0, 0,
- 0, 0, 0, 2, 5, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 2, 7, 0, 0, 0, 6, 0, 0, 0,
- 3, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 2, 10, 0, 0, 0, 9, 0, 0, 0, 7, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 2,
- 15, 0, 0, 0, 16, 0, 0, 0, 18, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 2, 18, 0, 0, 0, 8, 0, 0, 0, 5, 0, 0, 0,
- 20, 0, 0, 0, 0, 0, 0, 2, 22, 0, 0, 0, 21, 0, 0, 0, 19, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 2, 22, 0, 0, 0,
- 2, 0, 0, 0, 13, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 2, 68, 65, 84, 65,128, 1, 0, 0,128,173,118, 1, 0, 0, 0, 0,
- 60, 0, 0, 0, 8, 0, 0, 0, 12,192,137, 62,162,226,125, 63,144,108,246, 61,162,226,125, 63,144,108,246, 61,162,226,125, 63,
- 12,192,137, 62,162,226,125, 63, 0, 0, 0, 0, 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0,252,228,213, 62,162,226,125, 63,
- 12,192,137, 62,162,226,125, 63, 12,192,137, 62,162,226,125, 63,252,228,213, 62,162,226,125, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 61, 0, 1, 0, 0, 0, 0, 0, 12,192,137, 62,162,226,125, 63,144,108,246, 61,162,226,125, 63,144,108,246, 61,162,226,125, 63,
- 12,192,137, 62,162,226,125, 63, 0, 0, 0, 0, 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0, 0,229,213, 62,162,226,125, 63,
- 18,192,137, 62,162,226,125, 63, 12,192,137, 62,162,226,125, 63,252,228,213, 62,162,226,125, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 61, 0, 1, 0, 0, 0, 0, 0,154, 23, 55, 63,162,226,125, 63, 34, 5, 17, 63,162,226,125, 63, 30, 5, 17, 63,162,226,125, 63,
-152, 23, 55, 63,162,226,125, 63, 0, 0, 0, 0, 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0, 30, 5, 17, 63,162,226,125, 63,
-252,228,213, 62,162,226,125, 63,252,228,213, 62,162,226,125, 63, 30, 5, 17, 63,162,226,125, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 61, 0, 1, 0, 0, 0, 0, 0, 30, 5, 17, 63,162,226,125, 63,152, 23, 55, 63,162,226,125, 63,152, 23, 55, 63,162,226,125, 63,
- 30, 5, 17, 63,162,226,125, 63, 0, 0, 0, 0, 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0, 30, 5, 17, 63,162,226,125, 63,
-252,228,213, 62,162,226,125, 63,252,228,213, 62,162,226,125, 63, 30, 5, 17, 63,162,226,125, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 61, 0, 1, 0, 0, 0, 0, 0, 68, 65, 84, 65,128, 0, 0, 0, 64,175,118, 1, 0, 0, 0, 0, 57, 0, 0, 0, 32, 0, 0, 0,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 77, 69, 0, 0,120, 1, 0, 0,144,178,118, 1, 0, 0, 0, 0, 50, 0, 0, 0, 1, 0, 0, 0,144,194,118, 1, 0, 0, 0, 0,
-144,162,118, 1, 0, 0, 0, 0, 1, 94, 44, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 69, 80,108, 97,110,101, 46,
- 48, 48, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-192,232,117, 1, 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, 64,194,118, 1, 0, 0, 0, 0,160,188,118, 1, 0, 0, 0, 0,128,189,118, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,208,181,118, 1, 0, 0, 0, 0, 96,185,118, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 64,191,118, 1, 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,
- 80,180,118, 1, 0, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0,224,183,118, 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 5, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 32,187,118, 1, 0, 0, 0, 0, 3, 0, 0, 0, 5, 0, 0, 0,
- 80, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 0, 32, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0,180, 0, 0, 0, 0, 0, 0, 0, 0, 2,205, 76, 63,172,197, 39, 55,214,204, 76, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 0, 5, 0, 0, 0, 0, 0, 1, 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, 68, 65, 84, 65, 8, 0, 0, 0, 64,194,118, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 64, 1, 0, 0, 80,180,118, 1, 0, 0, 0, 0,
- 5, 1, 0, 0, 5, 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,
-208,181,118, 1, 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, 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, 68, 65, 84, 65,204, 1, 0, 0,208,181,118, 1, 0, 0, 0, 0, 56, 0, 0, 0, 23, 0, 0, 0,
- 47,205,204, 62, 0, 0,128,180,200,204,204,190, 0, 0, 1,128, 0, 0, 2, 0, 0,205, 76, 63, 0, 0, 0, 0,208,204,204,190,
- 0, 0, 1,128, 0, 0, 2, 0, 47,205,204, 62, 0, 0,128,180, 0, 0,240, 52, 0, 0, 1,128, 0, 0, 2, 0, 0,205, 76, 63,
- 0, 0, 0, 0, 0, 0, 96, 52, 0, 0, 1,128, 0, 0, 2, 0, 47,205,204, 62, 0, 0,128,180,221,204,204, 62, 0, 0, 1,128,
- 0, 0, 2, 0, 0,205, 76, 63, 0, 0, 0, 0,213,204,204, 62, 0, 0, 1,128, 0, 0, 2, 0, 53,205,204, 62, 0, 0,128,180,
-214,204, 76, 63, 0, 0, 1,128, 0, 0, 2, 0, 47,205,204, 62, 0, 0,128,180,206,204, 76,191, 0, 0, 1,128, 0, 0, 2, 0,
- 0,205, 76, 63, 0, 0, 0, 0,208,204, 76,191, 0, 0, 1,128, 0, 0, 2, 0, 0, 0, 70,182, 0, 0,128, 52,214,204, 76,191,
- 0, 0, 1,128, 0, 0, 2, 0, 55,205,204,190, 0, 0, 0, 0,212,204, 76,191, 0, 0, 1,128, 0, 0, 2, 0, 0, 0, 62,182,
- 0, 0,128, 52,206,204, 76, 63, 0, 0, 1,128, 0, 0, 2, 0, 47,205,204,190, 0, 0, 0, 0,206,204, 76, 63, 0, 0, 1,128,
- 0, 0, 2, 0, 4,205, 76,191, 0, 0, 0, 0,210,204, 76, 63, 0, 0, 1,128, 0, 0, 2, 0, 0, 0, 70,182, 0, 0,128, 52,
-197,204,204, 62, 0, 0, 1,128, 0, 0, 2, 0, 55,205,204,190, 0, 0, 0, 0,205,204,204, 62, 0, 0, 1,128, 0, 0, 2, 0,
- 4,205, 76,191, 0, 0, 0, 0,213,204,204, 62, 0, 0, 1,128, 0, 0, 2, 0, 0, 0, 70,182, 0, 0,128, 52, 0, 0,144,180,
- 0, 0, 1,128, 0, 0, 2, 0, 55,205,204,190, 0, 0, 0, 0, 0, 0, 0,179, 0, 0, 1,128, 0, 0, 2, 0, 4,205, 76,191,
- 0, 0, 0, 0, 0, 0, 96, 52, 0, 0, 1,128, 0, 0, 2, 0, 0, 0, 70,182, 0, 0,128, 52,224,204,204,190, 0, 0, 1,128,
- 0, 0, 2, 0, 55,205,204,190, 0, 0, 0, 0,216,204,204,190, 0, 0, 1,128, 0, 0, 2, 0, 4,205, 76,191, 0, 0, 0, 0,
-208,204,204,190, 0, 0, 1,128, 0, 0, 2, 0, 68, 65, 84, 65, 64, 1, 0, 0,224,183,118, 1, 0, 0, 0, 0, 5, 1, 0, 0,
- 5, 0, 0, 0, 3, 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, 96,185,118, 1,
- 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,
- 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, 68, 65, 84, 65,128, 1, 0, 0, 96,185,118, 1, 0, 0, 0, 0, 53, 0, 0, 0, 32, 0, 0, 0, 1, 0, 0, 0,
- 8, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 34, 0,
- 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 34, 0, 3, 0, 0, 0, 5, 0, 0, 0, 0, 0, 34, 0, 2, 0, 0, 0, 3, 0, 0, 0,
- 0, 0, 34, 0, 2, 0, 0, 0, 4, 0, 0, 0, 0, 0, 34, 0, 4, 0, 0, 0, 5, 0, 0, 0, 0, 0, 34, 0, 4, 0, 0, 0,
- 6, 0, 0, 0, 0, 0, 34, 0, 7, 0, 0, 0, 8, 0, 0, 0, 0, 0, 34, 0, 9, 0, 0, 0, 10, 0, 0, 0, 0, 0, 34, 0,
- 12, 0, 0, 0, 13, 0, 0, 0, 0, 0, 34, 0, 13, 0, 0, 0, 16, 0, 0, 0, 0, 0, 34, 0, 15, 0, 0, 0, 16, 0, 0, 0,
- 0, 0, 34, 0, 12, 0, 0, 0, 15, 0, 0, 0, 0, 0, 34, 0, 14, 0, 0, 0, 15, 0, 0, 0, 0, 0, 34, 0, 11, 0, 0, 0,
- 14, 0, 0, 0, 0, 0, 34, 0, 18, 0, 0, 0, 19, 0, 0, 0, 0, 0, 34, 0, 15, 0, 0, 0, 18, 0, 0, 0, 0, 0, 34, 0,
- 17, 0, 0, 0, 18, 0, 0, 0, 0, 0, 34, 0, 14, 0, 0, 0, 17, 0, 0, 0, 0, 0, 34, 0, 19, 0, 0, 0, 22, 0, 0, 0,
- 0, 0, 34, 0, 21, 0, 0, 0, 22, 0, 0, 0, 0, 0, 34, 0, 18, 0, 0, 0, 21, 0, 0, 0, 0, 0, 34, 0, 20, 0, 0, 0,
- 21, 0, 0, 0, 0, 0, 34, 0, 17, 0, 0, 0, 20, 0, 0, 0, 0, 0, 34, 0, 10, 0, 0, 0, 21, 0, 0, 0, 0, 0, 34, 0,
- 9, 0, 0, 0, 20, 0, 0, 0, 0, 0, 34, 0, 6, 0, 0, 0, 11, 0, 0, 0, 0, 0, 34, 0, 4, 0, 0, 0, 14, 0, 0, 0,
- 0, 0, 34, 0, 2, 0, 0, 0, 17, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 34, 0, 68, 65, 84, 65,
- 64, 1, 0, 0, 32,187,118, 1, 0, 0, 0, 0, 5, 1, 0, 0, 5, 0, 0, 0, 4, 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,160,188,118, 1, 0, 0, 0, 0, 5, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 85, 86, 84,101,120, 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,128,189,118, 1, 0, 0, 0, 0, 6, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67,111,108, 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, 64,191,118, 1, 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, 68, 65, 84, 65,160, 0, 0, 0,160,188,118, 1,
- 0, 0, 0, 0, 52, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
- 20, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0,
- 3, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 11, 0, 0, 0, 14, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0,
- 13, 0, 0, 0, 16, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 15, 0, 0, 0, 18, 0, 0, 0, 17, 0, 0, 0,
- 0, 0, 0, 0, 18, 0, 0, 0, 19, 0, 0, 0, 22, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 21, 0, 0, 0,
- 10, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65,128, 1, 0, 0,128,189,118, 1, 0, 0, 0, 0, 60, 0, 0, 0,
- 8, 0, 0, 0,152, 23, 55, 63,162,226,125, 63, 30, 5, 17, 63,162,226,125, 63, 30, 5, 17, 63,162,226,125, 63,152, 23, 55, 63,
-162,226,125, 63, 0, 0, 0, 0, 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0,252,228,213, 62,162,226,125, 63, 30, 5, 17, 63,
-162,226,125, 63, 30, 5, 17, 63,162,226,125, 63,252,228,213, 62,162,226,125, 63, 0, 0, 0, 0, 0, 0, 0, 0, 61, 0, 1, 0,
- 0, 0, 0, 0,152, 23, 55, 63,162,226,125, 63, 30, 5, 17, 63,162,226,125, 63, 30, 5, 17, 63,162,226,125, 63,152, 23, 55, 63,
-162,226,125, 63, 0, 0, 0, 0, 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0, 34, 5, 17, 63,162,226,125, 63, 0,229,213, 62,
-162,226,125, 63,252,228,213, 62,162,226,125, 63, 30, 5, 17, 63,162,226,125, 63, 0, 0, 0, 0, 0, 0, 0, 0, 61, 0, 1, 0,
- 0, 0, 0, 0, 18,192,137, 62,162,226,125, 63,144,108,246, 61,162,226,125, 63,144,108,246, 61,162,226,125, 63, 12,192,137, 62,
-162,226,125, 63, 0, 0, 0, 0, 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0,252,228,213, 62,162,226,125, 63, 12,192,137, 62,
-162,226,125, 63, 12,192,137, 62,162,226,125, 63,252,228,213, 62,162,226,125, 63, 0, 0, 0, 0, 0, 0, 0, 0, 61, 0, 1, 0,
- 0, 0, 0, 0, 12,192,137, 62,162,226,125, 63,144,108,246, 61,162,226,125, 63,144,108,246, 61,162,226,125, 63, 12,192,137, 62,
-162,226,125, 63, 0, 0, 0, 0, 0, 0, 0, 0, 61, 0, 1, 0, 0, 0, 0, 0,252,228,213, 62,162,226,125, 63, 12,192,137, 62,
-162,226,125, 63, 12,192,137, 62,162,226,125, 63,252,228,213, 62,162,226,125, 63, 0, 0, 0, 0, 0, 0, 0, 0, 61, 0, 1, 0,
- 0, 0, 0, 0, 68, 65, 84, 65,128, 0, 0, 0, 64,191,118, 1, 0, 0, 0, 0, 57, 0, 0, 0, 32, 0, 0, 0,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 77, 69, 0, 0,
-120, 1, 0, 0,144,194,118, 1, 0, 0, 0, 0, 50, 0, 0, 0, 1, 0, 0, 0,128,202,118, 1, 0, 0, 0, 0,144,178,118, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 69, 80,108, 97,110,101, 46, 48, 48, 52, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,224,237,196, 1,
- 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, 48,202,118, 1, 0, 0, 0, 0,208,201,118, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,208,197,118, 1, 0, 0, 0, 0,224,199,118, 1, 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, 80,196,118, 1,
- 0, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 96,198,118, 1, 0, 0, 0, 0, 1, 0, 0, 0,
- 5, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 80,200,118, 1, 0, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0, 20, 0, 0, 0,
- 0, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,128,179,
- 0, 0, 64, 52, 0, 0, 0, 0, 0, 0,128, 63, 2, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 30, 0, 4, 0, 0, 0, 0, 0, 1, 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, 68, 65, 84, 65, 8, 0, 0, 0, 48,202,118, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0,128,107,116, 1, 0, 0, 0, 0, 68, 65, 84, 65, 64, 1, 0, 0, 80,196,118, 1, 0, 0, 0, 0, 5, 1, 0, 0,
- 5, 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,208,197,118, 1,
- 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,
- 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, 68, 65, 84, 65, 80, 0, 0, 0,208,197,118, 1, 0, 0, 0, 0, 56, 0, 0, 0, 4, 0, 0, 0, 0, 0,128, 63,
-255,255,127, 63, 0, 0, 0, 0, 0, 0, 0, 0,255,127, 3,255, 0, 0,128, 63, 0, 0,128,191, 0, 0, 0, 0, 0, 0, 0, 0,
-255,127, 3,255, 1, 0,128,191,253,255,127,191, 0, 0, 0, 0, 0, 0, 0, 0,255,127, 3,255,250,255,127,191, 3, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0,255,127, 3,255, 68, 65, 84, 65, 64, 1, 0, 0, 96,198,118, 1, 0, 0, 0, 0, 5, 1, 0, 0,
- 5, 0, 0, 0, 3, 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,224,199,118, 1,
- 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,
- 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, 68, 65, 84, 65, 48, 0, 0, 0,224,199,118, 1, 0, 0, 0, 0, 53, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0,
- 2, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 35, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 35, 0,
- 3, 0, 0, 0, 2, 0, 0, 0, 0, 0, 35, 0, 68, 65, 84, 65, 64, 1, 0, 0, 80,200,118, 1, 0, 0, 0, 0, 5, 1, 0, 0,
- 5, 0, 0, 0, 4, 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,208,201,118, 1,
- 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,
- 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, 68, 65, 84, 65, 20, 0, 0, 0,208,201,118, 1, 0, 0, 0, 0, 52, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
- 3, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 2, 77, 69, 0, 0,120, 1, 0, 0,128,202,118, 1, 0, 0, 0, 0,
- 50, 0, 0, 0, 1, 0, 0, 0,192, 66,122, 1, 0, 0, 0, 0,144,194,118, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 77, 69,112,114,101,118,105,101,119, 0, 0, 0, 0,112,104,101,114,101, 0, 0, 0, 0, 0, 0,
- 2, 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,112, 66,122, 1, 0, 0, 0, 0,
-112, 93,119, 1, 0, 0, 0, 0,176,193,119, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,192,205,118, 1, 0, 0, 0, 0,
-176, 1,119, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,240,177,120, 1, 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, 64,204,118, 1, 0, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0,
- 20, 0, 0, 0, 0, 0, 0, 0, 48, 0,119, 1, 0, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0,
-240, 91,119, 1, 0, 0, 0, 0, 3, 0, 0, 0, 5, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0,130, 2, 0, 0,128, 7, 0, 0,
- 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,117,224,186, 64,
- 91, 13,187, 64,160,240,186, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 0, 4, 0,
- 0, 0, 0, 0, 1, 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,
- 68, 65, 84, 65, 8, 0, 0, 0,112, 66,122, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,128,107,116, 1, 0, 0, 0, 0,
- 68, 65, 84, 65, 64, 1, 0, 0, 64,204,118, 1, 0, 0, 0, 0, 5, 1, 0, 0, 5, 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,192,205,118, 1, 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, 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, 68, 65, 84, 65, 40, 50, 0, 0,
-192,205,118, 1, 0, 0, 0, 0, 56, 0, 0, 0,130, 2, 0, 0, 28,136,141,191, 12,243,244, 62,198, 86,183,192,212,231,117, 10,
-191,130, 3,255,240,102,131,192, 30,183,119, 64,109,169,199,191, 58,166,158, 84,230,221, 3,255,119,108,239, 63,213, 85,156, 64,
-188, 58, 40,192,228, 40,207,106,137,198, 3,255, 95,135,146, 64, 63, 54, 14,191,241,194,102,192, 27,100,219,243, 45,177, 3,255,
-239, 84,141, 62, 16,220,157,192, 14, 2, 73,192, 8, 6, 39,148, 86,187, 3,255,132,239,162,192,206,165, 12,192,150, 45,240,191,
-175,144,245,207,251,214, 3,255,239, 84,141,190, 16,220,157, 64, 14, 2, 73, 64,248,249,217,107,170, 68, 3,255,132,239,162, 64,
-206,165, 12, 64,150, 45,240, 63, 81,111, 11, 48, 5, 41, 3,255,240,102,131, 64, 30,183,119,192,109,169,199, 63,198, 89, 98,171,
- 26, 34, 3,255,119,108,239,191,213, 85,156,192,188, 58, 40, 64, 28,215, 49,149,119, 57, 3,255, 95,135,146,192, 63, 54, 14, 63,
-241,194,102, 64,229,155, 37, 12,211, 78, 3,255, 28,136,141, 63, 12,243,244,190,198, 86,183, 64, 44, 24,139,245, 65,125, 3,255,
-114, 17, 68,192,226,153, 35, 64,154, 26,137,192, 6,189,226, 55, 85,162, 3,255,155, 40,230, 62,239,199, 73, 64,176, 52,157,192,
-211, 9,237, 68,153,148, 3,255,124, 55,168,191,224,177,164, 64, 58,144, 29,192, 69,227,132,112, 46,202, 3,255, 94, 35,105,192,
-230, 88,129,191,195, 14,143,192, 93,176,233,233, 68,158, 3,255, 37, 2,173,192,137,187,123, 63, 56, 68, 1,192,206,137,127, 21,
-216,211, 3,255,234,168, 2, 64,231,158, 57,189, 65,149,175,192,162, 44, 3,255, 11,136, 3,255, 19,159,114, 64,254,226, 34, 64,
-196,133,106,192,225, 82,164, 55,228,175, 3,255,105,176,249,190, 21,148, 39,192,217,214,166,192, 87,245,194,198, 5,142, 3,255,
-227,163, 54, 64, 86,121, 78,192, 22,202,125,192, 99, 62,120,185, 79,169, 3,255,241, 40, 53,192,200, 31,134,192,229,188, 60,192,
- 30,194, 94,164,136,191, 3,255, 96,230,181,192, 33, 24,119,191,174, 26,130, 63,186,131,231,234, 56, 22, 3,255,103, 93,163,192,
-136,128, 38, 64, 83,235,153, 63,100,144,224, 56, 74, 26, 3,255,238,219, 36,192,132,151,165, 64,165,226,109, 63,176,199, 33,113,
- 80, 20, 3,255, 24,237,111, 63,118,174,184, 64,212, 34,154, 62,125, 20, 44,126,148, 6, 3,255,163,244,130, 64,157, 58,133, 64,
-125, 95,226,190,119, 89, 5, 91, 86,246, 3,255, 96,230,181, 64, 33, 24,119, 63,174, 26,130,191, 70,124, 25, 21,200,233, 3,255,
-103, 93,163, 64,136,128, 38,192, 83,235,153,191,156,111, 32,199,182,229, 3,255,238,219, 36, 64,132,151,165,192,165,226,109,191,
- 80, 56,223,142,176,235, 3,255, 24,237,111,191,118,174,184,192,212, 34,154,190,131,235,212,129,108,249, 3,255,163,244,130,192,
-157, 58,133,192,125, 95,226, 62,137,166,251,164,170, 9, 3,255,227,163, 54,192, 86,121, 78, 64, 22,202,125, 64,157,193,136, 70,
-177, 86, 3,255,241, 40, 53, 64,200, 31,134, 64,229,188, 60, 64,226, 61,162, 91,120, 64, 3,255, 37, 2,173, 64,137,187,123,191,
- 56, 68, 1, 64, 50,118,129,234, 40, 44, 3,255,124, 55,168, 63,224,177,164,192, 58,144, 29, 64,187, 28,124,143,210, 53, 3,255,
- 19,159,114,192,254,226, 34,192,196,133,106, 64, 31,173, 92,200, 28, 80, 3,255,234,168, 2,192,231,158, 57, 61, 65,149,175, 64,
- 94,211,253, 0,245,119, 3,255,105,176,249, 62, 21,148, 39, 64,217,214,166, 64,169, 10, 62, 57,251,113, 3,255, 94, 35,105, 64,
-230, 88,129, 63,195, 14,143, 64,163, 79, 23, 22,188, 97, 3,255,114, 17, 68, 64,226,153, 35,192,154, 26,137, 64,250, 66, 30,200,
-171, 93, 3,255,155, 40,230,190,239,199, 73,192,176, 52,157, 64, 45,246, 19,187,103,107, 3,255, 37,178, 10,192,138,231,201, 63,
-149,143,166,192,129,209,140, 33,145,141, 3,255, 3,132,110,192,243,203, 85, 64,151,107, 66,192, 16,174,158, 73,209,190, 3,255,
-116,161,174,190, 81,152,241, 63,110, 2,177,192,217,247, 15, 40,182,134, 3,255,138, 91,154, 63,218,179,133, 64,209,222,122,192,
- 0, 27, 30, 92, 86,171, 3,255, 7, 82, 52,192, 82,252,149, 64, 64,202, 5,192, 39,193,227,101,181,210, 3,255,179, 12,148, 62,
-251,221,166, 64,188, 87, 41,192,192, 7,224,113, 21,198, 3,255,216,246, 29,192, 17,156,141,190,209,167,169,192, 47,203,160,250,
-137,139, 3,255, 99, 72,145,192, 79,114,213,191,183, 35, 83,192, 26,156, 3,219, 12,185, 3,255,115, 58,158,192,129,120, 33, 64,
-198, 41,238,191,126,148,116, 56,137,215, 3,255,118,158,174,192,103,148, 33,191,140,156, 1,192,218,136,198,240,203,211, 3,255,
- 55, 14,249, 62, 95,133,102, 62,210,143,186,192, 56, 9, 40, 5,113,128, 3,255,220, 61, 92, 64, 56,230,159,190, 6, 61,151,192,
- 94, 76,242,248,135,153, 3,255, 7, 86, 60, 64, 60, 48,119, 64, 93, 88, 81,192,119, 63,124, 85,246,184, 3,255,252, 55,139, 64,
- 62, 95,132, 63,225,216,113,192,118, 95, 54, 21,107,173, 3,255, 18, 6, 84,191,251, 96,142,191, 76, 4,182,192,158,237, 20,233,
-109,131, 3,255,109, 74,225,189, 51, 54,123,192, 34,246,138,192,241,253, 39,169, 1,162, 3,255,153, 66,119, 64,127,154,251,191,
-161,220,123,192, 59, 85, 59,214, 34,170, 3,255,201, 59,208, 63,241,182,135,192,212,101,108,192,103, 34,133,162,160,175, 3,255,
-161,246,169,191,235,196,151,192,170,149, 74,192, 95,228,253,151,184,186, 3,255, 33,198,131,192,218,137, 84,192, 37,134, 32,192,
-247,164, 77,184,167,201, 3,255,176, 61,179,192,138,110,210,191, 24,220,228,190,210,133,130,219,238,244, 3,255, 73,182,170,192,
-136, 16, 90,190, 90,194, 25, 64,224,139, 8,252,174, 53, 3,255, 75, 55,153,192, 4, 78, 87, 64, 12, 54, 62,190,200,151, 29, 74,
-179,250, 3,255,235, 19,161,192,207, 12,210, 63,210,242, 31, 64, 50,146,244, 34,182, 55, 3,255, 60, 75, 94,192,189,115,150, 64,
-186,211,167,190, 98,179, 49,102,183,247, 3,255,186,191,189,191, 63, 32,168, 64,213,100, 7, 64,161,224,191,114, 61, 47, 3,255,
-242,205,186, 63,141, 65,177, 64,127,219,154,191, 82, 32,177,120, 61,228, 3,255, 99,245,175, 62, 97, 12,178, 64,255,253,228, 63,
-247, 6, 65,121, 98, 40, 3,255,226, 92, 70, 64, 8,131,150, 64,182, 77,204,191,193, 66, 37,103, 32,220, 3,255,200,194,152, 64,
-180,155, 83, 64,154,217, 62, 63,207,104,101, 71, 87, 17, 3,255, 73,182,170, 64,136, 16, 90, 62, 90,194, 25,192, 32,116,248, 3,
- 82,202, 3,255,176, 61,179, 64,138,110,210, 63, 24,220,228, 62, 46,122,126, 36, 18, 11, 3,255,235, 19,161, 64,207, 12,210,191,
-210,242, 31,192,206,109, 12,221, 74,200, 3,255, 75, 55,153, 64, 4, 78, 87,192, 12, 54, 62, 62, 56,104,227,181, 77, 5, 3,255,
-186,191,189, 63, 63, 32,168,192,213,100, 7,192, 95, 31, 65,141,195,208, 3,255, 60, 75, 94, 64,189,115,150,192,186,211,167, 62,
-158, 76,207,153, 73, 8, 3,255, 99,245,175,190, 97, 12,178,192,255,253,228,191, 9,249,191,134,158,215, 3,255,242,205,186,191,
-141, 65,177,192,127,219,154, 63,174,223, 79,135,195, 27, 3,255,200,194,152,192,180,155, 83,192,154,217, 62,191, 49,151,155,184,
-169,238, 3,255,226, 92, 70,192, 8,131,150,192,182, 77,204, 63, 63,189,219,152,224, 35, 3,255,201, 59,208,191,241,182,135, 64,
-212,101,108, 64,153,221,123, 93, 96, 80, 3,255,153, 66,119,192,127,154,251, 63,161,220,123, 64,197,170,197, 41,222, 85, 3,255,
-161,246,169, 63,235,196,151, 64,170,149, 74, 64,161, 27, 3,104, 72, 69, 3,255, 33,198,131, 64,218,137, 84, 64, 37,134, 32, 64,
- 9, 91,179, 71, 89, 54, 3,255,118,158,174, 64,103,148, 33, 63,140,156, 1, 64, 38,119, 58, 15, 53, 44, 3,255,115, 58,158, 64,
-129,120, 33,192,198, 41,238, 63,130,107,140,199,119, 40, 3,255, 7, 82, 52, 64, 82,252,149,192, 64,202, 5, 64,217, 62, 29,154,
- 75, 45, 3,255,179, 12,148,190,251,221,166,192,188, 87, 41, 64, 64,248, 32,142,235, 57, 3,255, 7, 86, 60,192, 60, 48,119,192,
- 93, 88, 81, 64,137,192,132,170, 10, 71, 3,255,252, 55,139,192, 62, 95,132,191,225,216,113, 64,138,160,202,234,149, 82, 3,255,
-220, 61, 92,192, 56,230,159, 62, 6, 61,151, 64,162,179, 14, 7,121,102, 3,255, 55, 14,249,190, 95,133,102,190,210,143,186, 64,
-200,246,216,250,143,127, 3,255,109, 74,225, 61, 51, 54,123, 64, 34,246,138, 64, 15, 2,217, 86,255, 93, 3,255, 18, 6, 84, 63,
-251, 96,142, 63, 76, 4,182, 64, 98, 18,236, 22,147,124, 3,255, 99, 72,145, 64, 79,114,213, 63,183, 35, 83, 64,230, 99,253, 36,
-244, 70, 3,255,216,246, 29, 64, 17,156,141, 62,209,167,169, 64,209, 52, 96, 5,119,116, 3,255, 3,132,110, 64,243,203, 85,192,
-151,107, 66, 64,240, 81, 98,182, 47, 65, 3,255, 37,178, 10, 64,138,231,201,191,149,143,166, 64,127, 46,116,222,111,114, 3,255,
-138, 91,154,191,218,179,133,192,209,222,122, 64, 0,229,226,163,170, 84, 3,255,116,161,174, 62, 81,152,241,191,110, 2,177, 64,
- 39, 8,241,215, 74,121, 3,255, 36, 76, 19,192, 25,151,129, 64,212,254, 98,192,231,206, 97, 88,131,177, 3,255, 93,232,175,191,
-177, 23, 64, 64, 69,186,154,192,227,225,235, 66, 34,151, 3,255,208,190,232,190, 93,160,139, 64,191, 33,120,192,183,244,205, 94,
-192,170, 3,255,210,126,142,192, 43, 49,238, 63,112, 30, 84,192,187,158, 95, 39,183,182, 3,255,138,165, 97,192, 92, 9, 80, 63,
- 20, 74,147,192,183,177,233, 17, 86,156, 3,255, 98, 61,152,192, 87, 63,106,188, 6, 97, 90,192,127,152,251, 0,183,180, 3,255,
-200,173, 14, 64,155,183, 63, 64,192, 75,144,192,206, 48, 45, 64,152,156, 3,255, 95,162,167, 63,144, 29,209, 63, 25,245,174,192,
-250, 29, 75, 36,250,136, 3,255,211, 62, 68, 64, 51, 56,168, 63, 13,245,153,192,241, 65,192, 29,106,150, 3,255, 33,182, 36, 64,
- 34, 38,220,191,150, 5,159,192,233, 54,211,217,223,146, 3,255, 16, 34, 81, 63,129, 64,179,191,162, 5,180,192,242, 18, 93,224,
-111,133, 3,255,212, 56,159, 63,172,166, 68,192,212,108,154,192,176, 27, 32,190,208,149, 3,255,204, 76,223,191,170, 32,101,192,
- 65, 83,137,192,199,216,195,178,198,161, 3,255,249,249, 10,192, 62, 52,244,191, 25,236,162,192, 9,208, 0,213,102,145, 3,255,
- 42,207, 89,192,251, 6, 47,192, 27,165,121,192,209,182, 18,196,198,169, 3,255,137,215,176,192, 25, 62,241, 63,179,254,219,190,
-179,134,232, 39, 78,247, 3,255, 28,150,186,192,150, 16, 28, 60,191, 9, 7,191,118,128,131, 1, 77,245, 3,255, 34,132,181,192,
- 99, 60, 92, 63,217, 81,149, 63,181,131,238, 18,252, 23, 3,255,175,242, 74,190,164,173,183, 64,227,105,145,191,117,250,160,125,
- 31,232, 3,255,219,227, 2,192, 96,164,173, 64,200, 71, 78,191,164,212, 52,119,226,238, 3,255,181,140, 92,191, 75, 38,184, 64,
-176,148, 37, 63,224,236,237,125,159, 12, 3,255, 75,104,159, 64,212, 56,236, 63,240,126, 29,192,211,108,166, 41, 9,203, 3,255,
-215,159,132, 64, 84,184, 97, 64, 30, 44, 10,192,176, 91, 19, 76, 56,209, 3,255, 95,122,164, 64,199,143, 44, 64, 53, 78, 68,191,
- 17,112, 17, 59,185,237, 3,255,255,176, 54, 64,243, 84,141,192,237,176, 36,192,192, 63, 9,160, 63,200, 3,255, 93,229,133, 64,
-217, 21, 68,192,157,226, 45,192,249, 90,187,187, 78,197, 3,255,203, 56,129, 64, 21,211,130,192,187,115,143,191,252, 87,194,166,
-252,229, 3,255,189,239,104,192, 82,142,140,192,178,178,168,191,134,177,245,158,155,227, 3,255, 50,141,253,191, 52,155,167,192,
-170,181,218,191,125,211,166,141,155,219, 3,255,164, 58, 41,192,172, 34,167,192,206,232,151, 61,232,197,243,141, 26, 0, 3,255,
- 93,229,133,192,217, 21, 68, 64,157,226, 45, 64, 7,165, 69, 68,178, 58, 3,255,203, 56,129,192, 21,211,130, 64,187,115,143, 63,
- 4,168, 62, 89, 4, 26, 3,255,255,176, 54,192,243, 84,141, 64,237,176, 36, 64, 64,192,247, 95,193, 55, 3,255, 50,141,253, 63,
- 52,155,167, 64,170,181,218, 63,131, 44, 90,114,101, 36, 3,255,164, 58, 41, 64,172, 34,167, 64,206,232,151,189, 24, 58, 13,114,
-230,255, 3,255,189,239,104, 64, 82,142,140, 64,178,178,168, 63,122, 78, 11, 97,101, 28, 3,255, 28,150,186, 64,150, 16, 28,188,
-191, 9, 7, 63,138,127,125,254,179, 10, 3,255, 34,132,181, 64, 99, 60, 92,191,217, 81,149,191, 75,124, 18,237, 4,232, 3,255,
-137,215,176, 64, 25, 62,241,191,179,254,219, 62, 77,121, 24,216,178, 8, 3,255,219,227, 2, 64, 96,164,173,192,200, 71, 78, 63,
- 92, 43,204,136, 30, 17, 3,255,181,140, 92, 63, 75, 38,184,192,176,148, 37,191, 32, 19, 19,130, 97,243, 3,255,175,242, 74, 62,
-164,173,183,192,227,105,145, 63,139, 5, 96,130,225, 23, 3,255,215,159,132,192, 84,184, 97,192, 30, 44, 10, 64, 80,164,237,179,
-200, 46, 3,255, 95,122,164,192,199,143, 44,192, 53, 78, 68, 63,239,143,239,196, 71, 18, 3,255, 75,104,159,192,212, 56,236,191,
-240,126, 29, 64, 45,147, 90,214,247, 52, 3,255,212, 56,159,191,172,166, 68, 64,212,108,154, 64, 80,228,224, 65, 48,106, 3,255,
- 33,182, 36,192, 34, 38,220, 63,150, 5,159, 64, 23,201, 45, 38, 33,109, 3,255, 16, 34, 81,191,129, 64,179, 63,162, 5,180, 64,
- 14,237,163, 31,145,122, 3,255, 42,207, 89, 64,251, 6, 47, 64, 27,165,121, 64, 47, 73,238, 59, 58, 86, 3,255,208, 76,223, 63,
-170, 32,101, 64, 65, 83,137, 64, 57, 39, 61, 77, 58, 94, 3,255,249,249, 10, 64, 62, 52,244, 63, 25,236,162, 64,247, 47, 0, 43,
-154,110, 3,255,210,126,142, 64, 43, 49,238,191,112, 30, 84, 64, 69, 97,161,216, 73, 73, 3,255, 98, 61,152, 64, 87, 63,106, 60,
- 6, 97, 90, 64,129,103, 5,255, 73, 75, 3,255,138,165, 97, 64, 92, 9, 80,191, 20, 74,147, 64, 73, 78, 23,238,170, 99, 3,255,
-208,190,232, 62, 93,160,139,192,191, 33,120, 64, 73, 11, 51,161, 64, 85, 3,255, 36, 76, 19, 64, 25,151,129,192,212,254, 98, 64,
- 25, 49,159,167,125, 78, 3,255, 93,232,175, 63,177, 23, 64,192, 69,186,154, 64, 29, 30, 21,189,222,104, 3,255,211, 62, 68,192,
- 51, 56,168,191, 13,245,153, 64, 15,190, 64,226,150,105, 3,255,200,173, 14,192,155,183, 63,192,192, 75,144, 64, 50,207,211,191,
-104, 99, 3,255, 95,162,167,191,144, 29,209,191, 25,245,174, 64, 6,226,181,219, 6,119, 3,255,158,156,211,191,185,228,132, 63,
-190,207,176,192,164,220,231, 21,244,134, 3,255, 0, 76, 41,192,190,199, 5, 64, 83,157,153,192,146,198, 75, 45,246,150, 3,255,
-204, 83,125,192,169, 55,105, 64,244,162, 20,192, 72,169,246, 79, 82,206, 3,255,178,215, 91,192,222,235, 62, 64,190,254,108,192,
-215,180, 87, 65,155,175, 3,255,242, 63, 59,191,210,237,152, 63,251, 21,182,192,125,239, 26, 25,149,131, 3,255, 86,230, 94, 61,
-198, 30, 35, 64,233, 15,169,192,238, 0, 52, 55,135,140, 3,255,220, 4,199, 63, 7,145,146, 64,104,186, 83,192,109, 34,137,100,
-168,184, 3,255, 9,120, 86, 63,149, 91,109, 64, 79,242,142,192,133, 18, 64, 81,218,158, 3,255,103,243, 95,192,221, 91,138, 64,
-186, 15,236,191,170,178,219, 93, 25,216, 3,255, 46,206, 5,192,121, 41,159, 64,154, 91, 19,192,230,209, 96,108,226,205, 3,255,
-169,200,139, 63,198, 78,163, 64,201,146, 42,192,247, 24, 59,111,206,197, 3,255,187,128, 4,191,206,181,167, 64, 74, 92, 37,192,
- 57,245, 96,114,145,199, 3,255,151, 16,231,191,160,166,209, 61,167, 95,178,192,136,217,196, 2,245,133, 3,255,163,200, 69,192,
-178,143, 38,191,148, 48,158,192,243,188, 11,242,223,147, 3,255, 43,192,155,192,151, 6,250,191,170, 82, 39,192, 79,149,247,212,
-231,199, 3,255,233,118,132,192,217,111,173,191, 67,122,123,192,100,165, 58,226,165,170, 3,255,238, 85,146,192,178,205, 78, 64,
- 70, 54,221,191,183,156,134, 71,120,218, 3,255, 76,137,167,192,111, 31,227, 63,158, 57,251,191,234,141, 54, 39, 59,213, 3,255,
- 39,143,170,192,167, 15,183,191,251, 85,252,191,217,139,169,223, 13,213, 3,255, 8,214,175,192,177,124, 53, 62,206,241, 2,192,
- 23,136, 89, 3, 92,211, 3,255, 77,160,160,190, 9, 20,182, 62,108,232,186,192, 8,248,241, 7,128,128, 3,255, 33,144,163, 63,
-151,144,186, 61, 50, 47,183,192, 97, 27, 19, 2,252,130, 3,255,222,179,129, 64,234,147,224,190, 38,180,134,192, 83, 89, 64,246,
-218,164, 3,255,114,138, 49, 64,246, 97, 57,190, 57, 76,165,192,250, 60,247,251,138,143, 3,255,249,158, 27, 64,197,118,141, 64,
- 58,196, 62,192, 90, 52, 70, 97, 90,191, 3,255, 98,244, 89, 64, 8,120, 79, 64, 65,128, 96,192, 8, 74, 39, 71,151,179, 3,255,
- 13,100,144, 64,200,214,118, 62, 64,205,110,192,182, 98, 37, 4,161,174, 3,255, 42,202,131, 64, 60,161,231, 63,142,245,112,192,
- 10, 90,255, 38,209,173, 3,255,149, 51,122,191, 52,151,163,190, 15,157,184,192,118,234, 36,250,248,129, 3,255, 5,113, 42,191,
- 31,112,241,191, 15,119,176,192, 93,241, 84,215,135,135, 3,255, 60, 55,172, 61, 22, 64,143,192,164,246,113,192, 27, 2,132,157,
- 71,174, 3,255,167,173,154,190,111,224, 83,192,198,169,154,192,136,249, 89,183,211,150, 3,255,151,133,136, 64, 9,249,162,191,
-106,219,115,192,175, 93, 47,229, 3,173, 3,255,110,124, 89, 64,135, 6, 40,192,223,195,127,192,120, 74, 31,199,208,168, 3,255,
-244,248,117, 63,109, 90,148,192,123, 0, 93,192, 8, 20, 66,154,249,180, 3,255,162, 0, 17, 64, 63,196,113,192, 52,239,119,192,
- 10, 49, 64,173,144,171, 3,255,162,217, 7,191, 21,117,156,192,222,238, 75,192,139,245, 20,149,108,186, 3,255,171,144, 6,192,
-112,158,144,192,198,241, 69,192,156,210, 55,157,115,188, 3,255,110,238,148,192,115,109, 50,192,187,197, 13,192,170,153,231,195,
- 17,208, 3,255, 79,252, 96,192,140, 40,115,192,116,165, 48,192,226,178, 98,173,236,195, 3,255,100,228,172,192,217,128,248,191,
- 8, 93,150,191, 91,138, 53,213, 86,229, 3,255, 82,171,182,192,216,250,168,191, 15, 15,147, 62,122,131,250,226,203, 5, 3,255,
-215, 73,160,192,124,165, 49, 62,232, 85, 66, 64, 33,147, 84, 4, 42, 67, 3,255,171, 89,178,192,192,115, 24,191, 78,116,221, 63,
-129,134, 64,243, 50, 38, 3,255, 51,206,143,192,133,250,105, 64,119,251, 97,191, 85,158, 53, 80,193,235, 3,255, 62, 32,160,192,
-163, 38, 65, 64,164,117, 3, 63,236,146, 24, 66,193, 10, 3,255,216,108,155,192, 59,255,141, 63,189,117, 69, 64, 61,150,119, 23,
- 42, 68, 3,255, 85, 27,164,192,244, 78, 9, 64, 87,193,239, 63, 33,144,128, 46, 73, 41, 3,255,134, 35,117,192, 39,152,138, 64,
- 73, 86,116,191,230,171, 2, 94, 73,234, 3,255, 35,220, 67,192, 6,218,159, 64,242,103,155, 62,240,188,215,108, 55, 6, 3,255,
-130, 79, 99,191,215,182,164, 64, 10, 4, 42, 64,118,237, 50,112,190, 58, 3,255,161, 86, 3,192, 14,205,168, 64, 60, 55,197, 63,
-148,211, 31,115,255, 33, 3,255,229,101,215, 63, 84,141,168, 64, 16, 90,248,191, 11, 37,148,114,159,212, 3,255, 99, 52,155, 63,
-198, 17,183, 64,232,199,235,190,159, 26,192,124,120,245, 3,255,105,179, 10, 61, 25,185,169, 64,120,119, 31, 64, 77, 0,101,115,
- 96, 55, 3,255,143,198, 37, 63,123,120,183, 64,160,108,135, 63,240, 13, 8,125,144, 23, 3,255,180,174, 32, 64, 65, 13,155, 64,
-238,167, 8,192,247, 53,245,105,163,208, 3,255, 69,199,104, 64,177,135,143, 64, 41, 12,132,191, 10, 79, 10, 98, 31,233, 3,255,
-121,134,159, 64, 49,245, 49, 64,210,166,169, 63, 27,109,242, 59,190, 29, 3,255, 52,133,143, 64,119,200,113, 64,186,206, 29, 62,
- 20, 98, 39, 82,190, 3, 3,255,215, 73,160, 64,124,165, 49,190,232, 85, 66,192,223,108,172,251,214,188, 3,255,171, 89,178, 64,
-192,115, 24, 63, 78,116,221,191,127,121,192, 12,206,217, 3,255,100,228,172, 64,217,128,248, 63, 8, 93,150, 63,165,117,203, 42,
-170, 26, 3,255, 82,171,182, 64,216,250,168, 63, 15, 15,147,190,134,124, 6, 29, 53,250, 3,255,216,108,155, 64, 59,255,141,191,
-189,117, 69,192,195,105,137,232,214,187, 3,255, 85, 27,164, 64,244, 78, 9,192, 87,193,239,191,223,111,128,209,183,214, 3,255,
- 51,206,143, 64,133,250,105,192,119,251, 97, 63,171, 97,203,175, 63, 20, 3,255, 62, 32,160, 64,163, 38, 65,192,164,117, 3,191,
- 20,109,232,189, 63,245, 3,255,130, 79, 99, 63,215,182,164,192, 10, 4, 42,192,138, 18,206,143, 66,197, 3,255,161, 86, 3, 64,
- 14,205,168,192, 60, 55,197,191,108, 44,225,140, 1,222, 3,255,134, 35,117, 64, 39,152,138,192, 73, 86,116, 63, 26, 84,254,161,
-183, 21, 3,255, 35,220, 67, 64, 6,218,159,192,242,103,155,190, 16, 67, 41,147,201,249, 3,255,105,179, 10,189, 25,185,169,192,
-120,119, 31,192,179,255,155,140,160,200, 3,255,143,198, 37,191,123,120,183,192,160,108,135,191, 16,242,248,130,112,232, 3,255,
-229,101,215,191, 84,141,168,192, 16, 90,248, 63,245,218,108,141, 97, 43, 3,255, 99, 52,155,191,198, 17,183,192,232,199,235, 62,
- 97,229, 64,131,136, 10, 3,255,121,134,159,192, 49,245, 49,192,210,166,169,191,229,146, 14,196, 66,226, 3,255, 52,133,143,192,
-119,200,113,192,186,206, 29,190,236,157,217,173, 66,252, 3,255,180,174, 32,192, 65, 13,155,192,238,167, 8, 64, 9,202, 11,150,
- 93, 47, 3,255, 69,199,104,192,177,135,143,192, 41, 12,132, 63,246,176,246,157,225, 22, 3,255,244,248,117,191,109, 90,148, 64,
-123, 0, 93, 64,248,235,190,101, 7, 75, 3,255,162, 0, 17,192, 63,196,113, 64, 52,239,119, 64,246,206,192, 82,112, 84, 3,255,
-151,133,136,192, 9,249,162, 63,106,219,115, 64, 81,162,209, 26,253, 82, 3,255,110,124, 89,192,135, 6, 40, 64,223,195,127, 64,
-136,181,225, 56, 48, 87, 3,255,162,217, 7, 63, 21,117,156, 64,222,238, 75, 64,117, 10,236,106,148, 69, 3,255,171,144, 6, 64,
-112,158,144, 64,198,241, 69, 64,100, 45,201, 98,141, 67, 3,255,110,238,148, 64,115,109, 50, 64,187,197, 13, 64, 86,102, 25, 60,
-239, 47, 3,255, 79,252, 96, 64,140, 40,115, 64,116,165, 48, 64, 30, 77,158, 82, 20, 60, 3,255, 39,143,170, 64,167, 15,183, 63,
-251, 85,252, 63, 39,116, 87, 32,243, 42, 3,255, 8,214,175, 64,177,124, 53,190,206,241, 2, 64,233,119,167,252,164, 44, 3,255,
-238, 85,146, 64,178,205, 78,192, 70, 54,221, 63, 73, 99,122,184,136, 37, 3,255, 76,137,167, 64,111, 31,227,191,158, 57,251, 63,
- 22,114,202,216,197, 42, 3,255,103,243, 95, 64,221, 91,138,192,186, 15,236, 63, 86, 77, 37,162,231, 39, 3,255, 46,206, 5, 64,
-121, 41,159,192,154, 91, 19, 64, 26, 46,160,147, 30, 50, 3,255,169,200,139,191,198, 78,163,192,201,146, 42, 64, 9,231,197,144,
- 50, 58, 3,255,187,128, 4, 63,206,181,167,192, 74, 92, 37, 64,199, 10,160,141,111, 56, 3,255,249,158, 27,192,197,118,141,192,
- 58,196, 62, 64,166,203,186,158,166, 64, 3,255, 98,244, 89,192, 8,120, 79,192, 65,128, 96, 64,248,181,217,184,105, 76, 3,255,
- 13,100,144,192,200,214,118,190, 64,205,110, 64, 74,157,219,251, 95, 81, 3,255, 42,202,131,192, 60,161,231,191,142,245,112, 64,
-246,165, 1,217, 47, 82, 3,255,222,179,129,192,234,147,224, 62, 38,180,134, 64,173,166,192, 9, 38, 91, 3,255,114,138, 49,192,
-246, 97, 57, 62, 57, 76,165, 64, 6,195, 9, 4,118,112, 3,255, 77,160,160, 62, 9, 20,182,190,108,232,186, 64,248, 7, 15,248,
-128,127, 3,255, 33,144,163,191,151,144,186,189, 50, 47,183, 64,159,228,237,253, 4,125, 3,255, 60, 55,172,189, 22, 64,143, 64,
-164,246,113, 64,229,253,124, 98,185, 81, 3,255,167,173,154, 62,111,224, 83, 64,198,169,154, 64,120, 6,167, 72, 45,105, 3,255,
-149, 51,122, 63, 52,151,163, 62, 15,157,184, 64,138, 21,220, 5, 8,126, 3,255, 5,113, 42, 63, 31,112,241, 63, 15,119,176, 64,
-163, 14,172, 40,121,120, 3,255, 43,192,155, 64,151, 6,250, 63,170, 82, 39, 64,177,106, 9, 43, 25, 56, 3,255,233,118,132, 64,
-217,111,173, 63, 67,122,123, 64,156, 90,198, 29, 91, 85, 3,255,151, 16,231, 63,160,166,209,189,167, 95,178, 64,120, 38, 60,253,
- 11,122, 3,255,163,200, 69, 64,178,143, 38, 63,148, 48,158, 64, 13, 67,245, 13, 33,108, 3,255,204, 83,125, 64,169, 55,105,192,
-244,162, 20, 64,184, 86, 10,176,174, 49, 3,255,178,215, 91, 64,222,235, 62,192,190,254,108, 64, 41, 75,169,190,101, 80, 3,255,
-158,156,211, 63,185,228,132,191,190,207,176, 64, 92, 35, 25,234, 12,121, 3,255, 0, 76, 41, 64,190,199, 5,192, 83,157,153, 64,
-110, 57,181,210, 10,105, 3,255,220, 4,199,191, 7,145,146,192,104,186, 83, 64,147,221,119,155, 88, 71, 3,255, 9,120, 86,191,
-149, 91,109,192, 79,242,142, 64,123,237,192,174, 38, 97, 3,255,242, 63, 59, 63,210,237,152,191,251, 21,182, 64,131, 16,230,230,
-107,124, 3,255, 86,230, 94,189,198, 30, 35,192,233, 15,169, 64, 18,255,204,200,121,115, 3,255,208, 27, 46,192,124,104, 86, 64,
- 85, 52,126,192,137,197,226, 72,134,168, 3,255, 82,168,234,191, 87, 62,149, 64,118, 12, 67,192, 5,217,188,101,210,188, 3,255,
-186, 10, 16,192,249,106, 52, 64,210,253,147,192,182,206,131, 62,198,155, 3,255, 93, 33,240,190,191,199, 71, 64,142, 47,158,192,
-214,245, 40, 69,199,148, 3,255, 19, 46, 71,187,194,240,115, 64,175,166,142,192,240,254,161, 82, 66,158, 3,255,188,194,101,191,
- 17, 84,154, 64,240,193, 77,192, 76,235,214,104,142,185, 3,255,246,246,115,192,183, 86, 15, 64, 51,168,118,192,249,172,229, 47,
- 45,171, 3,255,101, 1,160,192, 47,146,184, 63,153, 38, 45,192,225,146, 96, 30,102,196, 3,255,215,229, 85,192,166,178,218, 63,
-183, 55,144,192, 38,182,133, 37,110,158, 3,255,151,178,104,192,245,107,205,189,175, 60,147,192,178,175,205,253, 91,156, 3,255,
-192, 81,136,192, 55,239, 4,191, 24,222,127,192,130,163,158,245, 35,168, 3,255, 70,241,164,192,102,218,251, 62,143, 82, 48,192,
-222,143,210, 11,110,195, 3,255,209,230,173, 63,231,135, 71, 64, 27,234,152,192,148, 29, 4, 67, 11,151, 3,255,158,103, 67, 64,
- 82,206, 51, 64, 39,168,132,192,203, 66, 63, 60,242,164, 3,255,136,131,100, 63, 16, 95, 27, 64, 4,115,168,192,122, 20,138, 53,
-143,141, 3,255, 77,154,217, 63,185, 69, 78, 63,221,196,177,192, 53, 38,236, 17, 42,135, 3,255,107,195, 37, 64, 4,213, 36, 63,
- 20, 33,167,192,151, 55,194, 14,168,141, 3,255,103,139, 94, 64,153,146,250, 63, 72,141,137,192, 19, 75,156, 43,245,161, 3,255,
-231,195, 21, 64,236, 58,101,191,218,178,169,192,247, 49, 31,236,218,139, 3,255,142, 32, 48, 64,155,140, 32,192,195, 1,145,192,
- 3, 59,178,200,204,156, 3,255, 70,155,185, 63, 12,202, 59,191,163, 86,180,192,149, 32, 73,239, 91,133, 3,255, 29, 97, 43, 62,
-144,118, 2,192,125,231,175,192,106, 4,160,210,103,136, 3,255, 97,116,196, 62, 10,176, 56,192,120,239,162,192,164, 8, 20,194,
- 81,144, 3,255,185, 2, 5, 64,217,105, 76,192,135,173,142,192,218, 45, 79,187, 56,158, 3,255,163,243,144,191,252, 41, 73,192,
-148, 66,154,192,134,230, 73,188,107,150, 3,255,147,133, 20,192,234, 55,124,192,176, 3,107,192,110,204,196,170,164,175, 3,255,
- 42,186, 60,192,219,128,189,191, 23, 43,155,192, 41,191,189,222,199,150, 3,255, 52,164,172,191,106,240, 18,192,141, 58,167,192,
- 76,226,213,204,128,142, 3,255, 12,171,100,192,249, 33,243,191,106,221,135,192,248,178,143,214,143,162, 3,255,195, 78, 74,192,
-241,206, 96,192, 98, 88, 94,192, 4,188, 34,179,129,179, 3,255, 41,110,177,192, 81, 30,186, 63,105,249,158,191,160,134,165, 30,
- 86,229, 3,255, 45,138,172,192,114,149, 17, 64,127,203,200, 62,251,137,171, 48, 56, 9, 3,255, 10, 94,182,192, 48, 5, 1, 63,
- 86, 81,165,191,156,131, 24, 12, 94,228, 3,255,117,224,186,192, 37,234,247,190,147, 56,126, 62,132,128,101,246, 46, 6, 3,255,
-204, 78,184,192, 19,193, 89,189,187,163,141, 63, 22,130,208,254,241, 22, 3,255,105,232,174,192,151,187,224, 63,156,183,153, 63,
-137,136,137, 38, 3, 25, 3,255, 42,118, 68,191,101,173,176, 64,114,132,233,191, 57,238,142,120,217,216, 3,255, 81,172,191, 62,
- 67,208,186, 64,195,163,216,190, 75, 7,131,127,159,247, 3,255,113, 2,218,191,172,151,171, 64,114, 25,212,191,243,219,116,117,
- 30,220, 3,255,251,244, 21,192, 28, 12,172, 64, 13,151,128, 61,229,205,196,117,226, 1, 3,255, 51, 39,223,191,248, 94,177, 64,
-104,122, 76, 63,155,217, 3,121, 65, 16, 3,255, 72,208, 28, 61, 91, 13,187, 64, 64,215,245, 62,187, 0,168,127, 66, 9, 3,255,
- 45, 93,142, 64, 70,137, 14, 64,147,202, 70,192,241, 96,173, 49,202,188, 3,255,106, 23,173, 64,157,131,182, 63,175,176,225,191,
- 7,118, 20, 32, 72,218, 3,255, 78,203,128, 64,124, 14, 69, 64, 55, 0, 61,192,168, 88, 80, 66,199,191, 3,255,133,175,133, 64,
- 28,149,121, 64, 51,212,168,191, 4, 92, 86, 84,170,227, 3,255, 8,211,149, 64, 84,166, 94, 64, 68, 24, 29,191,221,101, 30, 76,
-113,241, 3,255, 31,169,175, 64,138,176,237, 63, 15,168,103,191,152,119,128, 40, 11,235, 3,255,122, 78, 57, 64,224, 12,120,192,
- 7, 56, 84,192, 62, 64,247,171,239,183, 3,255, 0, 74, 48, 64,245,165,155,192,208, 87,227,191, 38, 61, 68,150,192,217, 3,255,
- 85,108,100, 64,115, 47, 76,192,149,224, 88,192,102, 77, 90,185,131,182, 3,255,173,191,150, 64,227,233, 55,192,198,101,254,191,
-121,102, 79,192, 73,213, 3,255,119, 97,148, 64,200, 33, 89,192, 24,225,150,191, 7,101, 44,182, 20,229, 3,255, 75,171, 86, 64,
- 36, 83,150,192, 22, 36,133,191,220, 72,131,153, 32,232, 3,255,116,251, 81,192,115, 80,139,192, 57,124, 10,192, 81,185, 53,160,
-254,208, 3,255, 70,239,122,192, 53,220,138,192,113, 86,227,190, 68,171,132,160,195,246, 3,255, 14, 50, 28,192,245, 4,153,192,
-141, 39, 23,192,187,201,215,151, 33,205, 3,255, 34,123,189,191,203,168,178,192,149,106,130,191,209,222, 63,134,158,234, 3,255,
-176,127,232,191,177,107,178,192, 47,189,236,189, 65,216,100,134, 66,252, 3,255, 53,168, 90,192,169, 83,152,192,227,201,133, 62,
- 29,181, 77,152,136, 4, 3,255,173,191,150,192,227,233, 55, 64,198,101,254, 63,135,153,177, 63,183, 42, 3,255, 85,108,100,192,
-115, 47, 76, 64,149,224, 88, 64,154,178,166, 70,125, 73, 3,255,119, 97,148,192,200, 33, 89, 64, 24,225,150, 63,249,154,212, 73,
-236, 26, 3,255, 75,171, 86,192, 36, 83,150, 64, 22, 36,133, 63, 36,183,125,102,224, 23, 3,255, 0, 74, 48,192,245,165,155, 64,
-208, 87,227, 63,218,194,188,105, 64, 38, 3,255,122, 78, 57,192,224, 12,120, 64, 7, 56, 84, 64,194,191, 9, 84, 17, 72, 3,255,
- 34,123,189, 63,203,168,178, 64,149,106,130, 63, 47, 33,193,121, 98, 21, 3,255, 14, 50, 28, 64,245, 4,153, 64,141, 39, 23, 64,
- 69, 54, 41,104,223, 50, 3,255,176,127,232, 63,177,107,178, 64, 47,189,236, 61,191, 39,156,121,190, 3, 3,255, 53,168, 90, 64,
-169, 83,152, 64,227,201,133,190,227, 74,179,103,120,251, 3,255, 70,239,122, 64, 53,220,138, 64,113, 86,227, 62,188, 84,124, 95,
- 61, 9, 3,255,116,251, 81, 64,115, 80,139, 64, 57,124, 10, 64,175, 70,203, 95, 2, 47, 3,255,117,224,186, 64, 37,234,247, 62,
-147, 56,126,190,124,127,155, 9,210,249, 3,255, 10, 94,182, 64, 48, 5, 1,191, 86, 81,165, 63,100,124,232,243,162, 27, 3,255,
-204, 78,184, 64, 19,193, 89, 61,187,163,141,191,234,125, 48, 1, 15,233, 3,255,105,232,174, 64,151,187,224,191,156,183,153,191,
-119,119,119,217,253,230, 3,255, 45,138,172, 64,114,149, 17,192,127,203,200,190, 5,118, 85,207,200,246, 3,255, 41,110,177, 64,
- 81, 30,186,191,105,249,158, 63, 96,121, 91,225,170, 26, 3,255,251,244, 21, 64, 28, 12,172,192, 13,151,128,189, 27, 50, 60,138,
- 30,254, 3,255,113, 2,218, 63,172,151,171,192,114, 25,212, 63, 13, 36,140,138,226, 35, 3,255, 51, 39,223, 63,248, 94,177,192,
-104,122, 76,191,101, 38,253,134,191,239, 3,255, 72,208, 28,189, 91, 13,187,192, 64,215,245,190, 69,255, 88,128,190,246, 3,255,
- 81,172,191,190, 67,208,186,192,195,163,216, 62,181,248,125,128, 97, 8, 3,255, 42,118, 68, 63,101,173,176,192,114,132,233, 63,
-199, 17,114,135, 39, 39, 3,255,133,175,133,192, 28,149,121,192, 51,212,168, 63,252,163,170,171, 86, 28, 3,255, 78,203,128,192,
-124, 14, 69,192, 55, 0, 61, 64, 88,167,176,189, 57, 64, 3,255, 31,169,175,192,138,176,237,191, 15,168,103, 63,104,136,128,215,
-245, 20, 3,255, 8,211,149,192, 84,166, 94,192, 68, 24, 29, 63, 35,154,226,179,143, 14, 3,255,106, 23,173,192,157,131,182,191,
-175,176,225, 63,249,137,236,223,184, 37, 3,255, 45, 93,142,192, 70,137, 14,192,147,202, 70, 64, 15,159, 83,206, 54, 67, 3,255,
-185, 2, 5,192,217,105, 76, 64,135,173,142, 64, 38,210,177, 68,200, 97, 3,255, 97,116,196,190, 10,176, 56, 64,120,239,162, 64,
- 92,247,236, 61,175,111, 3,255,142, 32, 48,192,155,140, 32, 64,195, 1,145, 64,253,196, 78, 55, 52, 99, 3,255,231,195, 21,192,
-236, 58,101, 63,218,178,169, 64, 9,206,225, 19, 38,116, 3,255, 70,155,185,191, 12,202, 59, 63,163, 86,180, 64,107,223,183, 16,
-165,122, 3,255, 29, 97, 43,190,144,118, 2, 64,125,231,175, 64,150,251, 96, 45,153,119, 3,255,195, 78, 74, 64,241,206, 96, 64,
- 98, 88, 94, 64,252, 67,222, 76,127, 76, 3,255, 12,171,100, 64,249, 33,243, 63,106,221,135, 64, 8, 77,113, 41,113, 93, 3,255,
-147,133, 20, 64,234, 55,124, 64,176, 3,107, 64,146, 51, 60, 85, 92, 80, 3,255,164,243,144, 63,252, 41, 73, 64,148, 66,154, 64,
-122, 25,183, 67,149,105, 3,255, 52,164,172, 63,106,240, 18, 64,141, 58,167, 64,180, 29, 43, 51,128,113, 3,255, 42,186, 60, 64,
-219,128,189, 63, 23, 43,155, 64,215, 64, 67, 33, 57,105, 3,255,101, 1,160, 64, 47,146,184,191,153, 38, 45, 64, 31,109,160,225,
-154, 59, 3,255,246,246,115, 64,183, 86, 15,192, 51,168,118, 64, 7, 83, 27,208,211, 84, 3,255, 70,241,164, 64,102,218,251,190,
-143, 82, 48, 64, 34,112, 46,244,146, 60, 3,255,192, 81,136, 64, 55,239, 4, 63, 24,222,127, 64,126, 92, 98, 10,221, 87, 3,255,
-151,178,104, 64,245,107,205, 61,175, 60,147, 64, 78, 80, 51, 2,165, 99, 3,255,215,229, 85, 64,166,178,218,191,183, 55,144, 64,
-218, 73,123,218,146, 97, 3,255,188,194,101, 63, 17, 84,154,192,240,193, 77, 64,180, 20, 42,151,114, 70, 3,255, 19, 46, 71, 59,
-194,240,115,192,175,166,142, 64, 16, 1, 95,173,190, 97, 3,255, 82,168,234, 63, 87, 62,149,192,118, 12, 67, 64,251, 38, 68,154,
- 46, 67, 3,255,208, 27, 46, 64,124,104, 86,192, 85, 52,126, 64,119, 58, 30,183,122, 87, 3,255,186, 10, 16, 64,249,106, 52,192,
-210,253,147, 64, 74, 49,125,193, 58,100, 3,255, 93, 33,240, 62,191,199, 71,192,142, 47,158, 64, 42, 10,216,186, 57,107, 3,255,
-103,139, 94,192,153,146,250,191, 72,141,137, 64,237,180,100,212, 11, 94, 3,255,107,195, 37,192, 4,213, 36,191, 20, 33,167, 64,
-105,200, 62,241, 88,114, 3,255,158,103, 67,192, 82,206, 51,192, 39,168,132, 64, 53,189,193,195, 14, 91, 3,255,209,230,173,191,
-231,135, 71,192, 27,234,152, 64,108,226,252,188,245,104, 3,255, 77,154,217,191,185, 69, 78,191,221,196,177, 64,203,217, 20,238,
-214,120, 3,255,136,131,100,191, 16, 95, 27,192, 4,115,168, 64,134,235,118,202,113,114, 3,255,139,220, 37,192,245,135,141, 64,
-114,173, 54,192, 45,199, 95, 96,211,193, 3,255,204,119, 84,192, 93, 73,130, 64,212,107, 38,192, 58,183,223, 88,137,199, 3,255,
-208, 76, 67,192, 62,120,111, 64, 14, 89, 85,192, 80,189,196, 81,140,183, 3,255, 68,147,238,191,166,230,100, 64,234, 9,136,192,
-216,215,130, 78, 59,163, 3,255, 30,149,109,191, 40, 18,111, 64,171,100,141,192, 37,235,201, 81,199,159, 3,255,144,237,178,191,
- 25,136,136, 64,121, 1,113,192,117,225,189, 92, 62,173, 3,255,214, 82, 66, 63,128,115,152, 64,164, 25, 85,192,241, 16, 27,104,
-126,183, 3,255,119,155,171,189,138, 40,155, 64,113, 96, 83,192,128,254,196,105,238,183, 3,255, 67,138,194, 62,177, 97,138, 64,
- 75,158,124,192,112, 8,134, 94, 29,170, 3,255,158,106, 94,191,167,106, 30, 64,254,240,167,192,229,236,187, 53,105,141, 3,255,
- 22,114,229,191,193, 96, 20, 64,253,167,162,192, 22,217, 93, 50,244,144, 3,255, 45,210,162,191,233,211,224, 63,184, 67,174,192,
- 69,228,245, 37,244,136, 3,255, 37, 61,152,192,230, 9, 14, 64,137,179, 39,192, 85,152,183, 48,226,198, 3,255,232,187,140,192,
- 6, 96, 62, 64,107,247, 30,192, 7,160, 68, 65, 11,202, 3,255,116,134,132,192, 40,130, 40, 64,237,207, 77,192,139,165,149, 57,
- 30,186, 3,255, 12,129,129,192,231,129,173, 63,159,125,128,192, 62,167, 15, 29,123,168, 3,255,254,112,134,192,126,146,207, 62,
-159, 19,130,192, 15,164,119, 9,117,167, 3,255,189,121,149,192,142,192,111, 63, 76, 95, 90,192, 95,154,107, 20,236,180, 3,255,
- 12, 65,162,192, 11, 84,149,191,172,202, 44,192, 60,145, 47,230, 75,197, 3,255, 74,120,165,192, 95, 78,167,190,139, 51, 48,192,
- 54,143,140,248,244,195, 3,255, 61,161,150,192,107,221, 89,191,118,113, 89,192, 40,153, 79,237, 35,182, 3,255, 52, 56, 66,192,
-206, 40,139, 62, 21,116,160,192, 13,190, 19, 6,121,146, 3,255,245,120, 56,192,118,213,154, 63, 81,227,158,192, 81,193, 47, 26,
-133,147, 3,255,220,104, 22,192,204,221, 40, 63,115,137,170,192, 16,205, 89, 14,117,139, 3,255,145,143, 39, 64,190, 49, 94, 64,
-165, 27,124,192,238, 56,252, 75, 43,170, 3,255,130,168, 6, 64,190,132,130, 64, 12, 96,105,192,226, 45, 91, 89,173,176, 3,255,
- 76,169,222, 63,205,107,104, 64,150,142,136,192, 23, 38,105, 79, 33,163, 3,255,137,207,229, 63, 30, 63, 22, 64,207,235,161,192,
-198, 39,227, 50,127,145, 3,255,239, 11, 14, 64,175,114,191, 63,254,208,166,192,133, 48, 81, 33, 87,142, 3,255,239,222, 43, 64,
-212,226, 11, 64,227, 71,151,192, 33, 58,140, 47, 91,152, 3,255, 0,245,124, 64, 27, 32,187, 62, 57, 6,138,192,138, 86,176, 7,
- 2,162, 3,255, 42, 75,112, 64,228, 42,152, 63, 25, 44,139,192, 0, 82,159, 25, 31,161, 3,255,178,218, 82, 64,178,247, 1, 63,
-211,129,154,192, 35, 72, 4, 11,217,150, 3,255,208,203,104, 63,146, 6,113, 63,108, 5,183,192,132, 19,150, 20, 49,131, 3,255,
- 26, 68,251, 62,111, 38,228, 63,114, 48,178,192,139, 10,158, 38,109,134, 3,255,163, 78,149, 61, 65, 25,137, 63,234,102,184,192,
- 54, 1, 52, 23, 34,130, 3,255, 98,140, 80, 64,169,205,238,191, 83, 69,144,192, 70, 71,145,215,173,157, 3,255,177, 39,109, 64,
-155,213,147,191,238,143,140,192, 57, 81,247,230, 77,160, 3,255,100,225, 66, 64,146,191,131,191,152, 18,157,192,178, 66,128,233,
- 25,149, 3,255,190, 24,220, 63,163,163,202,191,160,244,171,192, 99, 37,199,220,196,138, 3,255,227,219,133, 63,172, 47, 17,192,
- 93,160,169,192,126, 23,164,206, 68,140, 3,255, 46,202,247, 63, 23,140, 27,192,116,252,158,192,217, 41, 77,203, 32,147, 3,255,
- 36,220, 68, 63, 24,143,132,192, 20,105,130,192,163, 16, 66,165, 72,167, 3,255, 60,255,185, 63,215,244,108,192,129, 7,138,192,
-113, 31, 11,175,251,161, 3,255,220, 18, 19, 63,168,186, 98,192, 66,136,148,192,155, 12,121,178,241,154, 3,255,131,119,172,187,
-182,209,162,191,170, 73,183,192,209,255,144,228,251,130, 3,255,165,230, 40, 63,246,111, 24,191, 50,150,185,192, 19, 14, 18,243,
-113,129, 3,255,123, 45, 50,190,213, 16,230,190,160,240,186,192,231,251,124,246,109,128, 3,255,221, 22,199,191, 71,211,134,192,
- 37,161,113,192, 98,222,255,163,157,173, 3,255,171,131, 58,191, 57,178,140,192,214,174,115,192,105,240,201,159, 11,173, 3,255,
-228,119,112,191, 49, 46,115,192,186,222,139,192,152,235,221,172,217,160, 3,255,122, 75,254,191, 18, 36, 50,192, 84, 70,152,192,
-253,211, 46,195, 87,152, 3,255,190,239, 52,192,193,186, 22,192,166,240,145,192,167,194, 3,204,108,156, 3,255, 51, 23, 39,192,
- 14,245, 76,192,105,248,132,192, 29,199,137,186,200,164, 3,255,202,137,140,192, 4,234, 33,192,152,117, 60,192,215,159,216,200,
- 6,192, 3,255, 68,176,115,192, 85, 49, 68,192, 65,173, 79,192,178,172, 81,189, 81,185, 3,255,131,173,128,192, 50,170, 14,192,
-247, 71,105,192, 30,168, 64,207,189,176, 3,255,230, 80, 22,192, 50,155,141,191,108, 95,168,192, 3,205, 6,232, 19,141, 3,255,
- 96,113,194,191,166,184,195,191, 31,160,174,192,205,222,245,222,227,136, 3,255,249,244,213,191, 10, 33, 52,191,248, 94,178,192,
-172,219, 3,241, 48,134, 3,255, 30, 26,167,192, 62, 11, 42, 64,199,163,159,190, 45,142, 26, 58,236,248, 3,255, 15,242,157,192,
-177, 35, 63, 64,242,230,132,191,115,148,134, 65, 39,233, 3,255, 58,163,169,192,184,207, 14, 64, 43, 92,148,191,122,140,250, 48,
-193,230, 3,255,241, 83,184,192, 33,241,117, 63,204, 69,248,190, 32,130,245, 20, 22,246, 3,255, 88,178,186,192,180, 33,226, 62,
- 69,211,165, 62,153,128, 65, 10,196, 6, 3,255,100,194,181,192,227, 37,178, 63, 65, 51,191, 62,199,131,217, 29,201, 7, 3,255,
-140, 68,168,192,162,100, 57, 63, 90, 41, 31, 64, 91,141,195, 15,175, 54, 3,255,185,114,173,192,147, 11,162, 63,136,131,237, 63,
-204,137,106, 27,187, 40, 3,255, 90, 82,178,192,181, 0,168, 62,125, 64,231, 63,136,134, 78, 7,175, 39, 3,255,235, 52,185,192,
-191,185, 83,191, 39,176,252,190,201,129,211,237,241,244, 3,255, 95,222,182,192,178, 32,161,190, 48, 92,165,191, 90,131,208,248,
-211,227, 3,255, 52,119,179,192,223,204,147,191,116,141,160,191,169,133,113,230,103,228, 3,255,109, 88, 35, 63,129,186,182, 64,
-207, 8,152,191, 5, 14,127,124,202,229, 3,255,226, 54, 99, 63,172,134,174, 64, 96, 98,250,191,180, 19,244,118, 14,213, 3,255,
-150,195, 60, 61, 46,121,177, 64,174, 6,245,191, 84, 1,249,120, 55,214, 3,255,228,160,145,191,121, 59,181, 64,246,252,123,191,
- 63,231,214,123, 42,235, 3,255, 29,166,188,191,167,120,181, 64, 4,224,165,189, 81,224,253,123,203,253, 3,255, 26,186, 9,191,
-104,142,186, 64,128, 74,126,190,158,243, 69,127, 88,250, 3,255,179,205, 19,191, 33,145,175, 64,102,151,253, 63,125,243,171,119,
-167, 43, 3,255,163,114,134,190, 81, 94,183, 64, 73,210,157, 63, 40,250,240,124, 49, 27, 3,255,253,217,151,191, 90, 89,178, 64,
-210,246,178, 63, 89,230,146,121,187, 30, 3,255,107,200, 50,192, 4, 21,164, 64,143,252, 18,191,229,194,189,111, 58,243, 3,255,
-219,140, 29,192,164,216,163, 64,163,160,187,191, 2,202,148,111, 27,224, 3,255, 8, 63, 76,192,149, 92,152, 64,201, 6,157,191,
-254,185,184,103, 25,229, 3,255,102, 31,167, 64, 18,113,133, 63,122,150, 29,192,214,113,149, 22, 5,202, 3,255,115, 48,157, 64,
- 74,183, 33, 63, 21,172, 72,192, 50,107,106, 13, 91,187, 3,255,250, 48,151, 64,117,157,186, 63,236, 37, 74,192, 41,103,126, 31,
- 23,187, 3,255,118, 31,148, 64,144, 99, 46, 64, 95,237, 21,192,101,101,141, 59,115,205, 3,255, 40,177,150, 64,101,250, 73, 64,
-104,252,189,191, 13,103,113, 68, 39,223, 3,255, 59, 67,164, 64,106,116, 19, 64, 96,145,209,191,204,111,223, 50,255,219, 3,255,
- 9, 99,168, 64,184,173, 32, 64,129, 16, 27, 63,228,114,189, 54,164, 13, 3,255,225, 1,174, 64, 65,167, 12, 64,199, 1, 38,190,
-149,118, 17, 48,195,252, 3,255,172,156,160, 64, 23,121, 66, 64,220,253, 53,188,155,109, 25, 66, 0, 0, 3,255,230,184,106, 64,
-117, 83,133, 64, 76, 95,243,191,202, 79,251, 90, 77,214, 3,255,116,166,101, 64, 67,107,111, 64, 69,233, 47,192, 23, 78,219, 81,
- 34,196, 3,255,109, 20, 68, 64,202, 9,139, 64,124,255, 29,192,138, 66, 22, 95, 6,202, 3,255, 46,138, 12, 64,195,168,156,192,
- 99,240, 23,192,172, 47, 54,149,252,203, 3,255,110,189,201, 63, 48, 28,154,192,180,148, 60,192, 2, 34,195,150,147,191, 3,255,
- 21, 55, 17, 64,125, 67,140,192,118, 8, 75,192, 61, 49, 50,160,221,186, 3,255, 85,126,100, 64,103,211,114,192,187,176, 43,192,
- 60, 78,241,172, 2,198, 3,255, 29,112,133, 64,168, 45,104,192, 95, 44,249,191,154, 90, 96,176, 48,213, 3,255,192,193, 95, 64,
-221, 5,138,192, 42,219,239,191,181, 76, 61,162,177,214, 3,255, 28, 21,134, 64,185,231,130,192,175,210,133, 62,128, 91,182,166,
- 33, 6, 3,255,128,101,115, 64,106,100,142,192,214,174,205,190, 32, 83, 12,159,127,247, 3,255,187,250,142, 64,178,123,113,192,
- 90,120,242,190, 99, 97,142,173,244,245, 3,255,115, 83,149, 64, 25,118, 24,192, 96, 5, 41,192,195,101, 61,204, 36,198, 3,255,
-236, 97,130, 64,181,248, 34,192, 49,132, 87,192, 17, 89,184,200,144,182, 3,255,186,103,144, 64, 91, 9,234,191,150,226, 80,192,
-152, 98,121,216,152,184, 3,255,208, 74,136,192,231,117,121,192, 32,193,133,191,248,162, 42,171,249,232, 3,255, 31, 84,144,192,
- 24, 19, 87,192, 53, 65,211,191, 74,157,248,182,224,219, 3,255, 7, 90,123,192,107,238,121,192,115,227,247,191, 22,170, 1,171,
-218,213, 3,255,161,112, 54,192, 94, 77,156,192,207,107,196,191,198,193, 23,149, 32,223, 3,255, 24, 41, 22,192, 1,197,169,192,
-191, 68, 84,191, 45,204,105,140,172,237, 3,255, 73,243, 75,192, 86, 16,156,192,180,150, 33,191,216,186, 63,149,194,241, 3,255,
-140,246, 19,192,148, 60,166,192, 11, 70,182, 63,164,205,159,142,127, 31, 3,255, 17, 21, 58,192,224,209,160,192,103,100, 88, 63,
-202,192, 72,146,171, 18, 3,255,151,252, 4,192, 71, 89,174,192,215, 93, 38, 63,148,210, 55,137,122, 14, 3,255, 53,176,150,191,
-238,252,174,192, 37,172,226,191,114,230,199,136, 20,217, 3,255,225,105,214,191,211,177,161,192,160,229, 29,192,197,219,175,145,
- 38,202, 3,255, 62,213, 88,191,193, 70,167,192,212,217, 32,192,221,237,232,141,230,200, 3,255,236, 97,130,192,181,248, 34, 64,
- 49,132, 87, 64,239,166, 72, 55,112, 73, 3,255,186,103,144,192, 91, 9,234, 63,150,226, 80, 64,104,157,135, 39,104, 71, 3,255,
-115, 83,149,192, 25,118, 24, 64, 96, 5, 41, 64, 61,154,195, 51,220, 57, 3,255, 29,112,133,192,168, 45,104, 64, 95, 44,249, 63,
-102,165,160, 79,208, 42, 3,255,192,193, 95,192,221, 5,138, 64, 42,219,239, 63, 75,179,195, 93, 79, 41, 3,255, 85,126,100,192,
-103,211,114, 64,187,176, 43, 64,196,177, 15, 83,254, 57, 3,255,110,189,201,191, 48, 28,154, 64,180,148, 60, 64,254,221, 61,105,
-109, 64, 3,255, 21, 55, 17,192,125, 67,140, 64,118, 8, 75, 64,195,206,206, 95, 35, 69, 3,255, 46,138, 12,192,195,168,156, 64,
- 99,240, 23, 64, 84,208,202,106, 4, 52, 3,255,128,101,115,192,106,100,142, 64,214,174,205, 62,224,172,244, 96,129, 8, 3,255,
-187,250,142,192,178,123,113, 64, 90,120,242, 62,157,158,114, 82, 12, 10, 3,255, 28, 21,134,192,185,231,130, 64,175,210,133,190,
-128,164, 74, 89,223,249, 3,255,225,105,214, 63,211,177,161, 64,160,229, 29, 64, 59, 36, 81,110,218, 53, 3,255, 62,213, 88, 63,
-193, 70,167, 64,212,217, 32, 64, 35, 18, 24,114, 26, 55, 3,255, 53,176,150, 63,238,252,174, 64, 37,172,226, 63,142, 25, 57,119,
-236, 38, 3,255, 24, 41, 22, 64, 1,197,169, 64,191, 68, 84, 63,211, 51,151,115, 84, 18, 3,255, 73,243, 75, 64, 86, 16,156, 64,
-180,150, 33, 63, 40, 69,193,106, 62, 14, 3,255,161,112, 54, 64, 94, 77,156, 64,208,107,196, 63, 58, 62,233,106,224, 32, 3,255,
- 31, 84,144, 64, 24, 19, 87, 64, 53, 65,211, 63,182, 98, 8, 73, 32, 36, 3,255, 7, 90,123, 64,107,238,121, 64,115,227,247, 63,
-234, 85,255, 84, 38, 42, 3,255,208, 74,136, 64,231,117,121, 64, 32,193,133, 63, 8, 93,214, 84, 7, 23, 3,255, 17, 21, 58, 64,
-224,209,160, 64,103,100, 88,191, 54, 63,184,109, 85,237, 3,255,151,252, 4, 64, 71, 89,174, 64,215, 93, 38,191,108, 45,201,118,
-134,241, 3,255,140,246, 19, 64,148, 60,166, 64, 11, 70,182,191, 92, 50, 97,113,129,224, 3,255, 95,222,182, 64,178, 32,161, 62,
- 48, 92,165, 63,166,124, 48, 7, 45, 28, 3,255, 52,119,179, 64,223,204,147, 63,116,141,160, 63, 87,122,143, 25,153, 27, 3,255,
-235, 52,185, 64,191,185, 83, 63, 39,176,252, 62, 55,126, 45, 18, 15, 11, 3,255, 88,178,186, 64,180, 33,226,190, 69,211,165,190,
-103,127,191,245, 60,249, 3,255,100,194,181, 64,227, 37,178,191, 65, 51,191,190, 57,124, 39,226, 55,248, 3,255,241, 83,184, 64,
- 33,241,117,191,204, 69,248, 62,224,125, 11,235,234, 9, 3,255, 15,242,157, 64,177, 35, 63,192,242,230,132, 63,141,107,122,190,
-217, 22, 3,255, 58,163,169, 64,184,207, 14,192, 43, 92,148, 63,134,115, 6,207, 63, 25, 3,255, 30, 26,167, 64, 62, 11, 42,192,
-199,163,159, 62,211,113,230,197, 20, 7, 3,255,185,114,173, 64,147, 11,162,191,136,131,237,191, 52,118,150,228, 69,215, 3,255,
- 90, 82,178, 64,181, 0,168,190,125, 64,231,191,120,121,178,248, 81,216, 3,255,140, 68,168, 64,162,100, 57,191, 90, 41, 31,192,
-165,114, 61,240, 81,201, 3,255,219,140, 29, 64,164,216,163,192,163,160,187, 63,254, 53,108,144,229, 31, 3,255, 8, 63, 76, 64,
-149, 92,152,192,201, 6,157, 63, 2, 70, 72,152,231, 26, 3,255,107,200, 50, 64, 4, 21,164,192,143,252, 18, 63, 27, 61, 67,144,
-198, 12, 3,255, 29,166,188, 63,167,120,181,192, 4,224,165, 61,175, 31, 3,132, 53, 2, 3,255, 26,186, 9, 63,104,142,186,192,
-128, 74,126, 62, 98, 12,187,128,168, 5, 3,255,228,160,145, 63,121, 59,181,192,246,252,123, 63,193, 24, 42,132,214, 20, 3,255,
-226, 54, 99,191,172,134,174,192, 96, 98,250, 63, 76,236, 12,137,242, 42, 3,255,150,195, 60,189, 46,121,177,192,174, 6,245, 63,
-172,254, 7,135,201, 41, 3,255,109, 88, 35,191,129,186,182,192,207, 8,152, 63,251,241,129,131, 54, 26, 3,255,163,114,134, 62,
- 81, 94,183,192, 73,210,157,191,216, 5, 16,131,207,228, 3,255,253,217,151, 63, 90, 89,178,192,210,246,178,191,167, 25,110,134,
- 69,225, 3,255,179,205, 19, 63, 33,145,175,192,102,151,253,191,131, 12, 85,136, 89,212, 3,255,116,166,101,192, 67,107,111,192,
- 69,233, 47, 64,233,177, 37,174,222, 59, 3,255,109, 20, 68,192,202, 9,139,192,124,255, 29, 64,118,189,234,160,250, 53, 3,255,
-230,184,106,192,117, 83,133,192, 76, 95,243, 63, 54,176, 5,165,179, 41, 3,255, 40,177,150,192,101,250, 73,192,104,252,189, 63,
-243,152,143,187,217, 32, 3,255, 59, 67,164,192,106,116, 19,192, 96,145,209, 63, 52,144, 33,205, 1, 36, 3,255,118, 31,148,192,
-144, 99, 46,192, 95,237, 21, 64,155,154,115,196,141, 50, 3,255,115, 48,157,192, 74,183, 33,191, 21,172, 72, 64,206,148,150,242,
-165, 68, 3,255,250, 48,151,192,117,157,186,191,236, 37, 74, 64,215,152,130,224,233, 68, 3,255,102, 31,167,192, 18,113,133,191,
-122,150, 29, 64, 42,142,107,233,251, 53, 3,255,225, 1,174,192, 65,167, 12,192,199, 1, 38, 62,107,137,239,207, 61, 3, 3,255,
-172,156,160,192, 23,121, 66,192,220,253, 53, 60,101,146,231,189, 0, 0, 3,255, 9, 99,168,192,184,173, 32,192,129, 16, 27,191,
- 28,141, 67,201, 92,242, 3,255,220, 18, 19,191,168,186, 98, 64, 66,136,148, 64,101,243,135, 77, 15,101, 3,255, 36,220, 68,191,
- 24,143,132, 64, 20,105,130, 64, 93,239,190, 90,184, 88, 3,255, 60,255,185,191,215,244,108, 64,129, 7,138, 64,143,224,245, 80,
- 5, 94, 3,255, 46,202,247,191, 23,140, 27, 64,116,252,158, 64, 39,214,179, 52,224,108, 3,255,190, 24,220,191,163,163,202, 63,
-160,244,171, 64,157,218, 57, 35, 60,117, 3,255,227,219,133,191,172, 47, 17, 64, 93,160,169, 64,130,232, 92, 49,188,115, 3,255,
-123, 45, 50, 62,213, 16,230, 62,160,240,186, 64, 25, 4,132, 9,147,127, 3,255,131,119,172, 59,182,209,162, 63,170, 73,183, 64,
- 47, 0,112, 27, 5,125, 3,255,165,230, 40,191,246,111, 24, 63, 50,150,185, 64,237,241,238, 12,143,126, 3,255,100,225, 66,192,
-146,191,131, 63,152, 18,157, 64, 78,189,128, 22,231,106, 3,255, 98,140, 80,192,169,205,238, 63, 83, 69,144, 64,186,184,111, 40,
- 83, 98, 3,255,177, 39,109,192,154,213,147, 63,239,143,140, 64,199,174, 9, 25,179, 95, 3,255,131,173,128, 64, 50,170, 14, 64,
-247, 71,105, 64,226, 87,192, 48, 67, 79, 3,255,202,137,140, 64, 4,234, 33, 64,152,117, 60, 64, 41, 96, 40, 55,250, 63, 3,255,
- 68,176,115, 64, 85, 49, 68, 64, 65,173, 79, 64, 78, 83,175, 66,175, 70, 3,255, 51, 23, 39, 64, 14,245, 76, 64,105,248,132, 64,
-227, 56,119, 69, 56, 91, 3,255,122, 75,254, 63, 17, 36, 50, 64, 83, 70,152, 64, 3, 44,210, 60,169,103, 3,255,190,239, 52, 64,
-193,186, 22, 64,166,240,145, 64, 89, 61,253, 51,148, 99, 3,255,249,244,213, 63, 10, 33, 52, 63,248, 94,178, 64, 84, 36,253, 14,
-208,121, 3,255,230, 80, 22, 64, 50,155,141, 63,108, 95,168, 64,253, 50,250, 23,237,114, 3,255, 96,113,194, 63,166,184,195, 63,
- 31,160,174, 64, 51, 33, 11, 33, 29,119, 3,255,228,119,112, 63, 49, 46,115, 64,186,222,139, 64,104, 20, 35, 83, 40, 95, 3,255,
-221, 22,199, 63, 71,211,134, 64, 37,161,113, 64,158, 33, 1, 92, 99, 82, 3,255,170,131, 58, 63, 58,178,140, 64,213,174,115, 64,
-151, 15, 55, 96,245, 82, 3,255,116,134,132, 64, 40,130, 40,192,237,207, 77, 64,117, 90,107,198,226, 69, 3,255,232,187,140, 64,
- 6, 96, 62,192,107,247, 30, 64,249, 95,188,190,245, 53, 3,255, 37, 61,152, 64,230, 9, 14,192,137,179, 39, 64,171,103, 73,207,
- 30, 57, 3,255,189,121,149, 64,142,192,111,191, 76, 95, 90, 64,161,101,149,235, 20, 75, 3,255,254,112,134, 64,126,146,207,190,
-159, 19,130, 64,241, 91,137,246,139, 88, 3,255, 12,129,129, 64,231,129,173,191,159,125,128, 64,194, 88,241,226,133, 87, 3,255,
-220,104, 22, 64,204,221, 40,191,115,137,170, 64,240, 50,167,241,139,116, 3,255,245,120, 56, 64,118,213,154,191, 81,227,158, 64,
-175, 62,209,229,123,108, 3,255, 52, 56, 66, 64,206, 40,139,190, 21,116,160, 64,243, 65,237,249,135,109, 3,255, 61,161,150, 64,
-107,221, 89, 63,118,113, 89, 64,216,102,177, 18,221, 73, 3,255, 74,120,165, 64, 95, 78,167, 62,139, 51, 48, 64,202,112,116, 7,
- 12, 60, 3,255, 12, 65,162, 64, 11, 84,149, 63,172,202, 44, 64,196,110,209, 25,181, 58, 3,255, 67,138,194,190,177, 97,138,192,
- 75,158,124, 64,144,247,122,161,227, 85, 3,255,214, 82, 66,191,128,115,152,192,164, 25, 85, 64, 15,239,229,151,130, 72, 3,255,
-119,155,171, 61,138, 40,155,192,113, 96, 83, 64,128, 1, 60,150, 18, 72, 3,255,144,237,178, 63, 25,136,136,192,121, 1,113, 64,
-139, 30, 67,163,194, 82, 3,255, 68,147,238, 63,166,230,100,192,234, 9,136, 64, 40, 40,126,177,197, 92, 3,255, 30,149,109, 63,
- 40, 18,111,192,171,100,141, 64,219, 20, 55,174, 57, 96, 3,255, 45,210,162, 63,233,211,224,191,184, 67,174, 64,187, 27, 11,218,
- 12,119, 3,255,158,106, 94, 63,167,106, 30,192,254,240,167, 64, 27, 19, 69,202,151,114, 3,255, 22,114,229, 63,193, 96, 20,192,
-253,167,162, 64,234, 38,163,205, 12,111, 3,255,208, 76, 67, 64, 62,120,111,192, 14, 89, 85, 64,176, 66, 60,174,116, 72, 3,255,
-139,220, 37, 64,245,135,141,192,114,173, 54, 64,211, 56,161,159, 45, 62, 3,255,204,119, 84, 64, 93, 73,130,192,212,107, 38, 64,
-198, 72, 33,167,119, 56, 3,255,178,218, 82,192,178,247, 1,191,211,129,154, 64,221,183,252,244, 39,105, 3,255, 0,245,124,192,
- 27, 32,187,190, 57, 6,138, 64,118,169, 80,248,254, 93, 3,255, 42, 75,112,192,228, 42,152,191, 25, 44,139, 64, 0,174, 97,230,
-225, 94, 3,255,239,222, 43,192,212,226, 11,192,227, 71,151, 64,223,197,116,208,165,103, 3,255,137,207,229,191, 30, 63, 22,192,
-207,235,161, 64, 58,216, 29,205,129,110, 3,255,239, 11, 14,192,175,114,191,191,254,208,166, 64,123,207,175,222,169,113, 3,255,
-163, 78,149,189, 65, 25,137,191,234,102,184, 64,202,254,204,232,222,125, 3,255,208,203,104,191,146, 6,113,191,108, 5,183, 64,
-124,236,106,235,207,124, 3,255, 26, 68,251,190,111, 38,228,191,114, 48,178, 64,117,245, 98,217,147,121, 3,255, 76,169,222,191,
-205,107,104,192,150,142,136, 64,233,217,151,176,223, 92, 3,255,145,143, 39,192,190, 49, 94,192,165, 27,124, 64, 18,199, 4,180,
-213, 85, 3,255,130,168, 6,192,190,132,130,192, 12, 96,105, 64, 30,210,165,166, 83, 79, 3,255, 68, 65, 84, 65, 64, 1, 0, 0,
- 48, 0,119, 1, 0, 0, 0, 0, 5, 1, 0, 0, 5, 0, 0, 0, 3, 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,176, 1,119, 1, 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, 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, 68, 65, 84, 65, 0, 90, 0, 0,176, 1,119, 1, 0, 0, 0, 0,
- 53, 0, 0, 0,128, 7, 0, 0, 0, 0, 0, 0,162, 0, 0, 0, 0, 0, 35, 0, 42, 0, 0, 0,162, 0, 0, 0, 0, 0, 35, 0,
- 12, 0, 0, 0,163, 0, 0, 0, 0, 0, 35, 0, 42, 0, 0, 0,163, 0, 0, 0, 0, 0, 35, 0, 1, 0, 0, 0,164, 0, 0, 0,
- 0, 0, 35, 0, 43, 0, 0, 0,164, 0, 0, 0, 0, 0, 35, 0, 12, 0, 0, 0,165, 0, 0, 0, 0, 0, 35, 0, 43, 0, 0, 0,
-165, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 0,166, 0, 0, 0, 0, 0, 35, 0, 44, 0, 0, 0,166, 0, 0, 0, 0, 0, 35, 0,
- 13, 0, 0, 0,167, 0, 0, 0, 0, 0, 35, 0, 44, 0, 0, 0,167, 0, 0, 0, 0, 0, 35, 0, 2, 0, 0, 0,168, 0, 0, 0,
- 0, 0, 35, 0, 45, 0, 0, 0,168, 0, 0, 0, 0, 0, 35, 0, 13, 0, 0, 0,169, 0, 0, 0, 0, 0, 35, 0, 45, 0, 0, 0,
-169, 0, 0, 0, 0, 0, 35, 0, 1, 0, 0, 0,170, 0, 0, 0, 0, 0, 35, 0, 46, 0, 0, 0,170, 0, 0, 0, 0, 0, 35, 0,
- 14, 0, 0, 0,171, 0, 0, 0, 0, 0, 35, 0, 46, 0, 0, 0,171, 0, 0, 0, 0, 0, 35, 0, 2, 0, 0, 0,172, 0, 0, 0,
- 0, 0, 35, 0, 47, 0, 0, 0,172, 0, 0, 0, 0, 0, 35, 0, 14, 0, 0, 0,173, 0, 0, 0, 0, 0, 35, 0, 47, 0, 0, 0,
-173, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 0,174, 0, 0, 0, 0, 0, 35, 0, 48, 0, 0, 0,174, 0, 0, 0, 0, 0, 35, 0,
- 15, 0, 0, 0,175, 0, 0, 0, 0, 0, 35, 0, 48, 0, 0, 0,175, 0, 0, 0, 0, 0, 35, 0, 5, 0, 0, 0,176, 0, 0, 0,
- 0, 0, 35, 0, 49, 0, 0, 0,176, 0, 0, 0, 0, 0, 35, 0, 15, 0, 0, 0,177, 0, 0, 0, 0, 0, 35, 0, 49, 0, 0, 0,
-177, 0, 0, 0, 0, 0, 35, 0, 1, 0, 0, 0,178, 0, 0, 0, 0, 0, 35, 0, 50, 0, 0, 0,178, 0, 0, 0, 0, 0, 35, 0,
- 16, 0, 0, 0,179, 0, 0, 0, 0, 0, 35, 0, 50, 0, 0, 0,179, 0, 0, 0, 0, 0, 35, 0, 5, 0, 0, 0,180, 0, 0, 0,
- 0, 0, 35, 0, 51, 0, 0, 0,180, 0, 0, 0, 0, 0, 35, 0, 16, 0, 0, 0,181, 0, 0, 0, 0, 0, 35, 0, 51, 0, 0, 0,
-181, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 0,182, 0, 0, 0, 0, 0, 35, 0, 52, 0, 0, 0,182, 0, 0, 0, 0, 0, 35, 0,
- 17, 0, 0, 0,183, 0, 0, 0, 0, 0, 35, 0, 52, 0, 0, 0,183, 0, 0, 0, 0, 0, 35, 0, 3, 0, 0, 0,184, 0, 0, 0,
- 0, 0, 35, 0, 53, 0, 0, 0,184, 0, 0, 0, 0, 0, 35, 0, 17, 0, 0, 0,185, 0, 0, 0, 0, 0, 35, 0, 53, 0, 0, 0,
-185, 0, 0, 0, 0, 0, 35, 0, 2, 0, 0, 0,186, 0, 0, 0, 0, 0, 35, 0, 54, 0, 0, 0,186, 0, 0, 0, 0, 0, 35, 0,
- 18, 0, 0, 0,187, 0, 0, 0, 0, 0, 35, 0, 54, 0, 0, 0,187, 0, 0, 0, 0, 0, 35, 0, 3, 0, 0, 0,188, 0, 0, 0,
- 0, 0, 35, 0, 55, 0, 0, 0,188, 0, 0, 0, 0, 0, 35, 0, 18, 0, 0, 0,189, 0, 0, 0, 0, 0, 35, 0, 55, 0, 0, 0,
-189, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 0,190, 0, 0, 0, 0, 0, 35, 0, 56, 0, 0, 0,190, 0, 0, 0, 0, 0, 35, 0,
- 19, 0, 0, 0,191, 0, 0, 0, 0, 0, 35, 0, 56, 0, 0, 0,191, 0, 0, 0, 0, 0, 35, 0, 4, 0, 0, 0,192, 0, 0, 0,
- 0, 0, 35, 0, 57, 0, 0, 0,192, 0, 0, 0, 0, 0, 35, 0, 19, 0, 0, 0,193, 0, 0, 0, 0, 0, 35, 0, 57, 0, 0, 0,
-193, 0, 0, 0, 0, 0, 35, 0, 3, 0, 0, 0,194, 0, 0, 0, 0, 0, 35, 0, 58, 0, 0, 0,194, 0, 0, 0, 0, 0, 35, 0,
- 20, 0, 0, 0,195, 0, 0, 0, 0, 0, 35, 0, 58, 0, 0, 0,195, 0, 0, 0, 0, 0, 35, 0, 4, 0, 0, 0,196, 0, 0, 0,
- 0, 0, 35, 0, 59, 0, 0, 0,196, 0, 0, 0, 0, 0, 35, 0, 20, 0, 0, 0,197, 0, 0, 0, 0, 0, 35, 0, 59, 0, 0, 0,
-197, 0, 0, 0, 0, 0, 35, 0, 4, 0, 0, 0,198, 0, 0, 0, 0, 0, 35, 0, 60, 0, 0, 0,198, 0, 0, 0, 0, 0, 35, 0,
- 21, 0, 0, 0,199, 0, 0, 0, 0, 0, 35, 0, 60, 0, 0, 0,199, 0, 0, 0, 0, 0, 35, 0, 5, 0, 0, 0,200, 0, 0, 0,
- 0, 0, 35, 0, 61, 0, 0, 0,200, 0, 0, 0, 0, 0, 35, 0, 21, 0, 0, 0,201, 0, 0, 0, 0, 0, 35, 0, 61, 0, 0, 0,
-201, 0, 0, 0, 0, 0, 35, 0, 5, 0, 0, 0,202, 0, 0, 0, 0, 0, 35, 0, 62, 0, 0, 0,202, 0, 0, 0, 0, 0, 35, 0,
- 22, 0, 0, 0,203, 0, 0, 0, 0, 0, 35, 0, 62, 0, 0, 0,203, 0, 0, 0, 0, 0, 35, 0, 10, 0, 0, 0,204, 0, 0, 0,
- 0, 0, 35, 0, 63, 0, 0, 0,204, 0, 0, 0, 0, 0, 35, 0, 22, 0, 0, 0,205, 0, 0, 0, 0, 0, 35, 0, 63, 0, 0, 0,
-205, 0, 0, 0, 0, 0, 35, 0, 1, 0, 0, 0,206, 0, 0, 0, 0, 0, 35, 0, 64, 0, 0, 0,206, 0, 0, 0, 0, 0, 35, 0,
- 23, 0, 0, 0,207, 0, 0, 0, 0, 0, 35, 0, 64, 0, 0, 0,207, 0, 0, 0, 0, 0, 35, 0, 10, 0, 0, 0,208, 0, 0, 0,
- 0, 0, 35, 0, 65, 0, 0, 0,208, 0, 0, 0, 0, 0, 35, 0, 23, 0, 0, 0,209, 0, 0, 0, 0, 0, 35, 0, 65, 0, 0, 0,
-209, 0, 0, 0, 0, 0, 35, 0, 1, 0, 0, 0,210, 0, 0, 0, 0, 0, 35, 0, 66, 0, 0, 0,210, 0, 0, 0, 0, 0, 35, 0,
- 24, 0, 0, 0,211, 0, 0, 0, 0, 0, 35, 0, 66, 0, 0, 0,211, 0, 0, 0, 0, 0, 35, 0, 6, 0, 0, 0,212, 0, 0, 0,
- 0, 0, 35, 0, 67, 0, 0, 0,212, 0, 0, 0, 0, 0, 35, 0, 24, 0, 0, 0,213, 0, 0, 0, 0, 0, 35, 0, 67, 0, 0, 0,
-213, 0, 0, 0, 0, 0, 35, 0, 2, 0, 0, 0,214, 0, 0, 0, 0, 0, 35, 0, 68, 0, 0, 0,214, 0, 0, 0, 0, 0, 35, 0,
- 25, 0, 0, 0,215, 0, 0, 0, 0, 0, 35, 0, 68, 0, 0, 0,215, 0, 0, 0, 0, 0, 35, 0, 6, 0, 0, 0,216, 0, 0, 0,
- 0, 0, 35, 0, 69, 0, 0, 0,216, 0, 0, 0, 0, 0, 35, 0, 25, 0, 0, 0,217, 0, 0, 0, 0, 0, 35, 0, 69, 0, 0, 0,
-217, 0, 0, 0, 0, 0, 35, 0, 2, 0, 0, 0,218, 0, 0, 0, 0, 0, 35, 0, 70, 0, 0, 0,218, 0, 0, 0, 0, 0, 35, 0,
- 26, 0, 0, 0,219, 0, 0, 0, 0, 0, 35, 0, 70, 0, 0, 0,219, 0, 0, 0, 0, 0, 35, 0, 7, 0, 0, 0,220, 0, 0, 0,
- 0, 0, 35, 0, 71, 0, 0, 0,220, 0, 0, 0, 0, 0, 35, 0, 26, 0, 0, 0,221, 0, 0, 0, 0, 0, 35, 0, 71, 0, 0, 0,
-221, 0, 0, 0, 0, 0, 35, 0, 3, 0, 0, 0,222, 0, 0, 0, 0, 0, 35, 0, 72, 0, 0, 0,222, 0, 0, 0, 0, 0, 35, 0,
- 27, 0, 0, 0,223, 0, 0, 0, 0, 0, 35, 0, 72, 0, 0, 0,223, 0, 0, 0, 0, 0, 35, 0, 7, 0, 0, 0,224, 0, 0, 0,
- 0, 0, 35, 0, 73, 0, 0, 0,224, 0, 0, 0, 0, 0, 35, 0, 27, 0, 0, 0,225, 0, 0, 0, 0, 0, 35, 0, 73, 0, 0, 0,
-225, 0, 0, 0, 0, 0, 35, 0, 3, 0, 0, 0,226, 0, 0, 0, 0, 0, 35, 0, 74, 0, 0, 0,226, 0, 0, 0, 0, 0, 35, 0,
- 28, 0, 0, 0,227, 0, 0, 0, 0, 0, 35, 0, 74, 0, 0, 0,227, 0, 0, 0, 0, 0, 35, 0, 8, 0, 0, 0,228, 0, 0, 0,
- 0, 0, 35, 0, 75, 0, 0, 0,228, 0, 0, 0, 0, 0, 35, 0, 28, 0, 0, 0,229, 0, 0, 0, 0, 0, 35, 0, 75, 0, 0, 0,
-229, 0, 0, 0, 0, 0, 35, 0, 4, 0, 0, 0,230, 0, 0, 0, 0, 0, 35, 0, 76, 0, 0, 0,230, 0, 0, 0, 0, 0, 35, 0,
- 29, 0, 0, 0,231, 0, 0, 0, 0, 0, 35, 0, 76, 0, 0, 0,231, 0, 0, 0, 0, 0, 35, 0, 8, 0, 0, 0,232, 0, 0, 0,
- 0, 0, 35, 0, 77, 0, 0, 0,232, 0, 0, 0, 0, 0, 35, 0, 29, 0, 0, 0,233, 0, 0, 0, 0, 0, 35, 0, 77, 0, 0, 0,
-233, 0, 0, 0, 0, 0, 35, 0, 4, 0, 0, 0,234, 0, 0, 0, 0, 0, 35, 0, 78, 0, 0, 0,234, 0, 0, 0, 0, 0, 35, 0,
- 30, 0, 0, 0,235, 0, 0, 0, 0, 0, 35, 0, 78, 0, 0, 0,235, 0, 0, 0, 0, 0, 35, 0, 9, 0, 0, 0,236, 0, 0, 0,
- 0, 0, 35, 0, 79, 0, 0, 0,236, 0, 0, 0, 0, 0, 35, 0, 30, 0, 0, 0,237, 0, 0, 0, 0, 0, 35, 0, 79, 0, 0, 0,
-237, 0, 0, 0, 0, 0, 35, 0, 5, 0, 0, 0,238, 0, 0, 0, 0, 0, 35, 0, 80, 0, 0, 0,238, 0, 0, 0, 0, 0, 35, 0,
- 31, 0, 0, 0,239, 0, 0, 0, 0, 0, 35, 0, 80, 0, 0, 0,239, 0, 0, 0, 0, 0, 35, 0, 9, 0, 0, 0,240, 0, 0, 0,
- 0, 0, 35, 0, 81, 0, 0, 0,240, 0, 0, 0, 0, 0, 35, 0, 31, 0, 0, 0,241, 0, 0, 0, 0, 0, 35, 0, 81, 0, 0, 0,
-241, 0, 0, 0, 0, 0, 35, 0, 6, 0, 0, 0,242, 0, 0, 0, 0, 0, 35, 0, 82, 0, 0, 0,242, 0, 0, 0, 0, 0, 35, 0,
- 32, 0, 0, 0,243, 0, 0, 0, 0, 0, 35, 0, 82, 0, 0, 0,243, 0, 0, 0, 0, 0, 35, 0, 10, 0, 0, 0,244, 0, 0, 0,
- 0, 0, 35, 0, 83, 0, 0, 0,244, 0, 0, 0, 0, 0, 35, 0, 32, 0, 0, 0,245, 0, 0, 0, 0, 0, 35, 0, 83, 0, 0, 0,
-245, 0, 0, 0, 0, 0, 35, 0, 6, 0, 0, 0,246, 0, 0, 0, 0, 0, 35, 0, 84, 0, 0, 0,246, 0, 0, 0, 0, 0, 35, 0,
- 33, 0, 0, 0,247, 0, 0, 0, 0, 0, 35, 0, 84, 0, 0, 0,247, 0, 0, 0, 0, 0, 35, 0, 7, 0, 0, 0,248, 0, 0, 0,
- 0, 0, 35, 0, 85, 0, 0, 0,248, 0, 0, 0, 0, 0, 35, 0, 33, 0, 0, 0,249, 0, 0, 0, 0, 0, 35, 0, 85, 0, 0, 0,
-249, 0, 0, 0, 0, 0, 35, 0, 7, 0, 0, 0,250, 0, 0, 0, 0, 0, 35, 0, 86, 0, 0, 0,250, 0, 0, 0, 0, 0, 35, 0,
- 34, 0, 0, 0,251, 0, 0, 0, 0, 0, 35, 0, 86, 0, 0, 0,251, 0, 0, 0, 0, 0, 35, 0, 8, 0, 0, 0,252, 0, 0, 0,
- 0, 0, 35, 0, 87, 0, 0, 0,252, 0, 0, 0, 0, 0, 35, 0, 34, 0, 0, 0,253, 0, 0, 0, 0, 0, 35, 0, 87, 0, 0, 0,
-253, 0, 0, 0, 0, 0, 35, 0, 8, 0, 0, 0,254, 0, 0, 0, 0, 0, 35, 0, 88, 0, 0, 0,254, 0, 0, 0, 0, 0, 35, 0,
- 35, 0, 0, 0,255, 0, 0, 0, 0, 0, 35, 0, 88, 0, 0, 0,255, 0, 0, 0, 0, 0, 35, 0, 9, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 35, 0, 89, 0, 0, 0, 0, 1, 0, 0, 0, 0, 35, 0, 35, 0, 0, 0, 1, 1, 0, 0, 0, 0, 35, 0, 89, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 35, 0, 9, 0, 0, 0, 2, 1, 0, 0, 0, 0, 35, 0, 90, 0, 0, 0, 2, 1, 0, 0, 0, 0, 35, 0,
- 36, 0, 0, 0, 3, 1, 0, 0, 0, 0, 35, 0, 90, 0, 0, 0, 3, 1, 0, 0, 0, 0, 35, 0, 10, 0, 0, 0, 4, 1, 0, 0,
- 0, 0, 35, 0, 91, 0, 0, 0, 4, 1, 0, 0, 0, 0, 35, 0, 36, 0, 0, 0, 5, 1, 0, 0, 0, 0, 35, 0, 91, 0, 0, 0,
- 5, 1, 0, 0, 0, 0, 35, 0, 10, 0, 0, 0, 6, 1, 0, 0, 0, 0, 35, 0, 92, 0, 0, 0, 6, 1, 0, 0, 0, 0, 35, 0,
- 37, 0, 0, 0, 7, 1, 0, 0, 0, 0, 35, 0, 92, 0, 0, 0, 7, 1, 0, 0, 0, 0, 35, 0, 11, 0, 0, 0, 8, 1, 0, 0,
- 0, 0, 35, 0, 93, 0, 0, 0, 8, 1, 0, 0, 0, 0, 35, 0, 37, 0, 0, 0, 9, 1, 0, 0, 0, 0, 35, 0, 93, 0, 0, 0,
- 9, 1, 0, 0, 0, 0, 35, 0, 6, 0, 0, 0, 10, 1, 0, 0, 0, 0, 35, 0, 94, 0, 0, 0, 10, 1, 0, 0, 0, 0, 35, 0,
- 38, 0, 0, 0, 11, 1, 0, 0, 0, 0, 35, 0, 94, 0, 0, 0, 11, 1, 0, 0, 0, 0, 35, 0, 11, 0, 0, 0, 12, 1, 0, 0,
- 0, 0, 35, 0, 95, 0, 0, 0, 12, 1, 0, 0, 0, 0, 35, 0, 38, 0, 0, 0, 13, 1, 0, 0, 0, 0, 35, 0, 95, 0, 0, 0,
- 13, 1, 0, 0, 0, 0, 35, 0, 7, 0, 0, 0, 14, 1, 0, 0, 0, 0, 35, 0, 96, 0, 0, 0, 14, 1, 0, 0, 0, 0, 35, 0,
- 39, 0, 0, 0, 15, 1, 0, 0, 0, 0, 35, 0, 96, 0, 0, 0, 15, 1, 0, 0, 0, 0, 35, 0, 11, 0, 0, 0, 16, 1, 0, 0,
- 0, 0, 35, 0, 97, 0, 0, 0, 16, 1, 0, 0, 0, 0, 35, 0, 39, 0, 0, 0, 17, 1, 0, 0, 0, 0, 35, 0, 97, 0, 0, 0,
- 17, 1, 0, 0, 0, 0, 35, 0, 8, 0, 0, 0, 18, 1, 0, 0, 0, 0, 35, 0, 98, 0, 0, 0, 18, 1, 0, 0, 0, 0, 35, 0,
- 40, 0, 0, 0, 19, 1, 0, 0, 0, 0, 35, 0, 98, 0, 0, 0, 19, 1, 0, 0, 0, 0, 35, 0, 11, 0, 0, 0, 20, 1, 0, 0,
- 0, 0, 35, 0, 99, 0, 0, 0, 20, 1, 0, 0, 0, 0, 35, 0, 40, 0, 0, 0, 21, 1, 0, 0, 0, 0, 35, 0, 99, 0, 0, 0,
- 21, 1, 0, 0, 0, 0, 35, 0, 9, 0, 0, 0, 22, 1, 0, 0, 0, 0, 35, 0,100, 0, 0, 0, 22, 1, 0, 0, 0, 0, 35, 0,
- 41, 0, 0, 0, 23, 1, 0, 0, 0, 0, 35, 0,100, 0, 0, 0, 23, 1, 0, 0, 0, 0, 35, 0, 11, 0, 0, 0, 24, 1, 0, 0,
- 0, 0, 35, 0,101, 0, 0, 0, 24, 1, 0, 0, 0, 0, 35, 0, 41, 0, 0, 0, 25, 1, 0, 0, 0, 0, 35, 0,101, 0, 0, 0,
- 25, 1, 0, 0, 0, 0, 35, 0, 12, 0, 0, 0, 26, 1, 0, 0, 0, 0, 35, 0,102, 0, 0, 0, 26, 1, 0, 0, 0, 0, 35, 0,
- 14, 0, 0, 0, 27, 1, 0, 0, 0, 0, 35, 0,102, 0, 0, 0, 27, 1, 0, 0, 0, 0, 35, 0, 12, 0, 0, 0, 28, 1, 0, 0,
- 0, 0, 35, 0,103, 0, 0, 0, 28, 1, 0, 0, 0, 0, 35, 0, 13, 0, 0, 0, 29, 1, 0, 0, 0, 0, 35, 0,103, 0, 0, 0,
- 29, 1, 0, 0, 0, 0, 35, 0, 13, 0, 0, 0, 30, 1, 0, 0, 0, 0, 35, 0,104, 0, 0, 0, 30, 1, 0, 0, 0, 0, 35, 0,
- 14, 0, 0, 0, 31, 1, 0, 0, 0, 0, 35, 0,104, 0, 0, 0, 31, 1, 0, 0, 0, 0, 35, 0, 12, 0, 0, 0, 32, 1, 0, 0,
- 0, 0, 35, 0,105, 0, 0, 0, 32, 1, 0, 0, 0, 0, 35, 0, 16, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 0,105, 0, 0, 0,
- 33, 1, 0, 0, 0, 0, 35, 0, 12, 0, 0, 0, 34, 1, 0, 0, 0, 0, 35, 0,106, 0, 0, 0, 34, 1, 0, 0, 0, 0, 35, 0,
- 15, 0, 0, 0, 35, 1, 0, 0, 0, 0, 35, 0,106, 0, 0, 0, 35, 1, 0, 0, 0, 0, 35, 0, 15, 0, 0, 0, 36, 1, 0, 0,
- 0, 0, 35, 0,107, 0, 0, 0, 36, 1, 0, 0, 0, 0, 35, 0, 16, 0, 0, 0, 37, 1, 0, 0, 0, 0, 35, 0,107, 0, 0, 0,
- 37, 1, 0, 0, 0, 0, 35, 0, 13, 0, 0, 0, 38, 1, 0, 0, 0, 0, 35, 0,108, 0, 0, 0, 38, 1, 0, 0, 0, 0, 35, 0,
- 18, 0, 0, 0, 39, 1, 0, 0, 0, 0, 35, 0,108, 0, 0, 0, 39, 1, 0, 0, 0, 0, 35, 0, 13, 0, 0, 0, 40, 1, 0, 0,
- 0, 0, 35, 0,109, 0, 0, 0, 40, 1, 0, 0, 0, 0, 35, 0, 17, 0, 0, 0, 41, 1, 0, 0, 0, 0, 35, 0,109, 0, 0, 0,
- 41, 1, 0, 0, 0, 0, 35, 0, 17, 0, 0, 0, 42, 1, 0, 0, 0, 0, 35, 0,110, 0, 0, 0, 42, 1, 0, 0, 0, 0, 35, 0,
- 18, 0, 0, 0, 43, 1, 0, 0, 0, 0, 35, 0,110, 0, 0, 0, 43, 1, 0, 0, 0, 0, 35, 0, 17, 0, 0, 0, 44, 1, 0, 0,
- 0, 0, 35, 0,111, 0, 0, 0, 44, 1, 0, 0, 0, 0, 35, 0, 20, 0, 0, 0, 45, 1, 0, 0, 0, 0, 35, 0,111, 0, 0, 0,
- 45, 1, 0, 0, 0, 0, 35, 0, 17, 0, 0, 0, 46, 1, 0, 0, 0, 0, 35, 0,112, 0, 0, 0, 46, 1, 0, 0, 0, 0, 35, 0,
- 19, 0, 0, 0, 47, 1, 0, 0, 0, 0, 35, 0,112, 0, 0, 0, 47, 1, 0, 0, 0, 0, 35, 0, 19, 0, 0, 0, 48, 1, 0, 0,
- 0, 0, 35, 0,113, 0, 0, 0, 48, 1, 0, 0, 0, 0, 35, 0, 20, 0, 0, 0, 49, 1, 0, 0, 0, 0, 35, 0,113, 0, 0, 0,
- 49, 1, 0, 0, 0, 0, 35, 0, 19, 0, 0, 0, 50, 1, 0, 0, 0, 0, 35, 0,114, 0, 0, 0, 50, 1, 0, 0, 0, 0, 35, 0,
- 21, 0, 0, 0, 51, 1, 0, 0, 0, 0, 35, 0,114, 0, 0, 0, 51, 1, 0, 0, 0, 0, 35, 0, 15, 0, 0, 0, 52, 1, 0, 0,
- 0, 0, 35, 0,115, 0, 0, 0, 52, 1, 0, 0, 0, 0, 35, 0, 19, 0, 0, 0, 53, 1, 0, 0, 0, 0, 35, 0,115, 0, 0, 0,
- 53, 1, 0, 0, 0, 0, 35, 0, 15, 0, 0, 0, 54, 1, 0, 0, 0, 0, 35, 0,116, 0, 0, 0, 54, 1, 0, 0, 0, 0, 35, 0,
- 21, 0, 0, 0, 55, 1, 0, 0, 0, 0, 35, 0,116, 0, 0, 0, 55, 1, 0, 0, 0, 0, 35, 0, 16, 0, 0, 0, 56, 1, 0, 0,
- 0, 0, 35, 0,117, 0, 0, 0, 56, 1, 0, 0, 0, 0, 35, 0, 23, 0, 0, 0, 57, 1, 0, 0, 0, 0, 35, 0,117, 0, 0, 0,
- 57, 1, 0, 0, 0, 0, 35, 0, 16, 0, 0, 0, 58, 1, 0, 0, 0, 0, 35, 0,118, 0, 0, 0, 58, 1, 0, 0, 0, 0, 35, 0,
- 22, 0, 0, 0, 59, 1, 0, 0, 0, 0, 35, 0,118, 0, 0, 0, 59, 1, 0, 0, 0, 0, 35, 0, 22, 0, 0, 0, 60, 1, 0, 0,
- 0, 0, 35, 0,119, 0, 0, 0, 60, 1, 0, 0, 0, 0, 35, 0, 23, 0, 0, 0, 61, 1, 0, 0, 0, 0, 35, 0,119, 0, 0, 0,
- 61, 1, 0, 0, 0, 0, 35, 0, 14, 0, 0, 0, 62, 1, 0, 0, 0, 0, 35, 0,120, 0, 0, 0, 62, 1, 0, 0, 0, 0, 35, 0,
- 25, 0, 0, 0, 63, 1, 0, 0, 0, 0, 35, 0,120, 0, 0, 0, 63, 1, 0, 0, 0, 0, 35, 0, 14, 0, 0, 0, 64, 1, 0, 0,
- 0, 0, 35, 0,121, 0, 0, 0, 64, 1, 0, 0, 0, 0, 35, 0, 24, 0, 0, 0, 65, 1, 0, 0, 0, 0, 35, 0,121, 0, 0, 0,
- 65, 1, 0, 0, 0, 0, 35, 0, 24, 0, 0, 0, 66, 1, 0, 0, 0, 0, 35, 0,122, 0, 0, 0, 66, 1, 0, 0, 0, 0, 35, 0,
- 25, 0, 0, 0, 67, 1, 0, 0, 0, 0, 35, 0,122, 0, 0, 0, 67, 1, 0, 0, 0, 0, 35, 0, 18, 0, 0, 0, 68, 1, 0, 0,
- 0, 0, 35, 0,123, 0, 0, 0, 68, 1, 0, 0, 0, 0, 35, 0, 27, 0, 0, 0, 69, 1, 0, 0, 0, 0, 35, 0,123, 0, 0, 0,
- 69, 1, 0, 0, 0, 0, 35, 0, 18, 0, 0, 0, 70, 1, 0, 0, 0, 0, 35, 0,124, 0, 0, 0, 70, 1, 0, 0, 0, 0, 35, 0,
- 26, 0, 0, 0, 71, 1, 0, 0, 0, 0, 35, 0,124, 0, 0, 0, 71, 1, 0, 0, 0, 0, 35, 0, 26, 0, 0, 0, 72, 1, 0, 0,
- 0, 0, 35, 0,125, 0, 0, 0, 72, 1, 0, 0, 0, 0, 35, 0, 27, 0, 0, 0, 73, 1, 0, 0, 0, 0, 35, 0,125, 0, 0, 0,
- 73, 1, 0, 0, 0, 0, 35, 0, 20, 0, 0, 0, 74, 1, 0, 0, 0, 0, 35, 0,126, 0, 0, 0, 74, 1, 0, 0, 0, 0, 35, 0,
- 29, 0, 0, 0, 75, 1, 0, 0, 0, 0, 35, 0,126, 0, 0, 0, 75, 1, 0, 0, 0, 0, 35, 0, 20, 0, 0, 0, 76, 1, 0, 0,
- 0, 0, 35, 0,127, 0, 0, 0, 76, 1, 0, 0, 0, 0, 35, 0, 28, 0, 0, 0, 77, 1, 0, 0, 0, 0, 35, 0,127, 0, 0, 0,
- 77, 1, 0, 0, 0, 0, 35, 0, 28, 0, 0, 0, 78, 1, 0, 0, 0, 0, 35, 0,128, 0, 0, 0, 78, 1, 0, 0, 0, 0, 35, 0,
- 29, 0, 0, 0, 79, 1, 0, 0, 0, 0, 35, 0,128, 0, 0, 0, 79, 1, 0, 0, 0, 0, 35, 0, 21, 0, 0, 0, 80, 1, 0, 0,
- 0, 0, 35, 0,129, 0, 0, 0, 80, 1, 0, 0, 0, 0, 35, 0, 31, 0, 0, 0, 81, 1, 0, 0, 0, 0, 35, 0,129, 0, 0, 0,
- 81, 1, 0, 0, 0, 0, 35, 0, 21, 0, 0, 0, 82, 1, 0, 0, 0, 0, 35, 0,130, 0, 0, 0, 82, 1, 0, 0, 0, 0, 35, 0,
- 30, 0, 0, 0, 83, 1, 0, 0, 0, 0, 35, 0,130, 0, 0, 0, 83, 1, 0, 0, 0, 0, 35, 0, 30, 0, 0, 0, 84, 1, 0, 0,
- 0, 0, 35, 0,131, 0, 0, 0, 84, 1, 0, 0, 0, 0, 35, 0, 31, 0, 0, 0, 85, 1, 0, 0, 0, 0, 35, 0,131, 0, 0, 0,
- 85, 1, 0, 0, 0, 0, 35, 0, 23, 0, 0, 0, 86, 1, 0, 0, 0, 0, 35, 0,132, 0, 0, 0, 86, 1, 0, 0, 0, 0, 35, 0,
- 32, 0, 0, 0, 87, 1, 0, 0, 0, 0, 35, 0,132, 0, 0, 0, 87, 1, 0, 0, 0, 0, 35, 0, 23, 0, 0, 0, 88, 1, 0, 0,
- 0, 0, 35, 0,133, 0, 0, 0, 88, 1, 0, 0, 0, 0, 35, 0, 24, 0, 0, 0, 89, 1, 0, 0, 0, 0, 35, 0,133, 0, 0, 0,
- 89, 1, 0, 0, 0, 0, 35, 0, 24, 0, 0, 0, 90, 1, 0, 0, 0, 0, 35, 0,134, 0, 0, 0, 90, 1, 0, 0, 0, 0, 35, 0,
- 32, 0, 0, 0, 91, 1, 0, 0, 0, 0, 35, 0,134, 0, 0, 0, 91, 1, 0, 0, 0, 0, 35, 0, 25, 0, 0, 0, 92, 1, 0, 0,
- 0, 0, 35, 0,135, 0, 0, 0, 92, 1, 0, 0, 0, 0, 35, 0, 33, 0, 0, 0, 93, 1, 0, 0, 0, 0, 35, 0,135, 0, 0, 0,
- 93, 1, 0, 0, 0, 0, 35, 0, 25, 0, 0, 0, 94, 1, 0, 0, 0, 0, 35, 0,136, 0, 0, 0, 94, 1, 0, 0, 0, 0, 35, 0,
- 26, 0, 0, 0, 95, 1, 0, 0, 0, 0, 35, 0,136, 0, 0, 0, 95, 1, 0, 0, 0, 0, 35, 0, 26, 0, 0, 0, 96, 1, 0, 0,
- 0, 0, 35, 0,137, 0, 0, 0, 96, 1, 0, 0, 0, 0, 35, 0, 33, 0, 0, 0, 97, 1, 0, 0, 0, 0, 35, 0,137, 0, 0, 0,
- 97, 1, 0, 0, 0, 0, 35, 0, 27, 0, 0, 0, 98, 1, 0, 0, 0, 0, 35, 0,138, 0, 0, 0, 98, 1, 0, 0, 0, 0, 35, 0,
- 34, 0, 0, 0, 99, 1, 0, 0, 0, 0, 35, 0,138, 0, 0, 0, 99, 1, 0, 0, 0, 0, 35, 0, 27, 0, 0, 0,100, 1, 0, 0,
- 0, 0, 35, 0,139, 0, 0, 0,100, 1, 0, 0, 0, 0, 35, 0, 28, 0, 0, 0,101, 1, 0, 0, 0, 0, 35, 0,139, 0, 0, 0,
-101, 1, 0, 0, 0, 0, 35, 0, 28, 0, 0, 0,102, 1, 0, 0, 0, 0, 35, 0,140, 0, 0, 0,102, 1, 0, 0, 0, 0, 35, 0,
- 34, 0, 0, 0,103, 1, 0, 0, 0, 0, 35, 0,140, 0, 0, 0,103, 1, 0, 0, 0, 0, 35, 0, 29, 0, 0, 0,104, 1, 0, 0,
- 0, 0, 35, 0,141, 0, 0, 0,104, 1, 0, 0, 0, 0, 35, 0, 35, 0, 0, 0,105, 1, 0, 0, 0, 0, 35, 0,141, 0, 0, 0,
-105, 1, 0, 0, 0, 0, 35, 0, 29, 0, 0, 0,106, 1, 0, 0, 0, 0, 35, 0,142, 0, 0, 0,106, 1, 0, 0, 0, 0, 35, 0,
- 30, 0, 0, 0,107, 1, 0, 0, 0, 0, 35, 0,142, 0, 0, 0,107, 1, 0, 0, 0, 0, 35, 0, 30, 0, 0, 0,108, 1, 0, 0,
- 0, 0, 35, 0,143, 0, 0, 0,108, 1, 0, 0, 0, 0, 35, 0, 35, 0, 0, 0,109, 1, 0, 0, 0, 0, 35, 0,143, 0, 0, 0,
-109, 1, 0, 0, 0, 0, 35, 0, 31, 0, 0, 0,110, 1, 0, 0, 0, 0, 35, 0,144, 0, 0, 0,110, 1, 0, 0, 0, 0, 35, 0,
- 36, 0, 0, 0,111, 1, 0, 0, 0, 0, 35, 0,144, 0, 0, 0,111, 1, 0, 0, 0, 0, 35, 0, 22, 0, 0, 0,112, 1, 0, 0,
- 0, 0, 35, 0,145, 0, 0, 0,112, 1, 0, 0, 0, 0, 35, 0, 31, 0, 0, 0,113, 1, 0, 0, 0, 0, 35, 0,145, 0, 0, 0,
-113, 1, 0, 0, 0, 0, 35, 0, 22, 0, 0, 0,114, 1, 0, 0, 0, 0, 35, 0,146, 0, 0, 0,114, 1, 0, 0, 0, 0, 35, 0,
- 36, 0, 0, 0,115, 1, 0, 0, 0, 0, 35, 0,146, 0, 0, 0,115, 1, 0, 0, 0, 0, 35, 0, 32, 0, 0, 0,116, 1, 0, 0,
- 0, 0, 35, 0,147, 0, 0, 0,116, 1, 0, 0, 0, 0, 35, 0, 38, 0, 0, 0,117, 1, 0, 0, 0, 0, 35, 0,147, 0, 0, 0,
-117, 1, 0, 0, 0, 0, 35, 0, 32, 0, 0, 0,118, 1, 0, 0, 0, 0, 35, 0,148, 0, 0, 0,118, 1, 0, 0, 0, 0, 35, 0,
- 37, 0, 0, 0,119, 1, 0, 0, 0, 0, 35, 0,148, 0, 0, 0,119, 1, 0, 0, 0, 0, 35, 0, 37, 0, 0, 0,120, 1, 0, 0,
- 0, 0, 35, 0,149, 0, 0, 0,120, 1, 0, 0, 0, 0, 35, 0, 38, 0, 0, 0,121, 1, 0, 0, 0, 0, 35, 0,149, 0, 0, 0,
-121, 1, 0, 0, 0, 0, 35, 0, 33, 0, 0, 0,122, 1, 0, 0, 0, 0, 35, 0,150, 0, 0, 0,122, 1, 0, 0, 0, 0, 35, 0,
- 39, 0, 0, 0,123, 1, 0, 0, 0, 0, 35, 0,150, 0, 0, 0,123, 1, 0, 0, 0, 0, 35, 0, 33, 0, 0, 0,124, 1, 0, 0,
- 0, 0, 35, 0,151, 0, 0, 0,124, 1, 0, 0, 0, 0, 35, 0, 38, 0, 0, 0,125, 1, 0, 0, 0, 0, 35, 0,151, 0, 0, 0,
-125, 1, 0, 0, 0, 0, 35, 0, 38, 0, 0, 0,126, 1, 0, 0, 0, 0, 35, 0,152, 0, 0, 0,126, 1, 0, 0, 0, 0, 35, 0,
- 39, 0, 0, 0,127, 1, 0, 0, 0, 0, 35, 0,152, 0, 0, 0,127, 1, 0, 0, 0, 0, 35, 0, 34, 0, 0, 0,128, 1, 0, 0,
- 0, 0, 35, 0,153, 0, 0, 0,128, 1, 0, 0, 0, 0, 35, 0, 40, 0, 0, 0,129, 1, 0, 0, 0, 0, 35, 0,153, 0, 0, 0,
-129, 1, 0, 0, 0, 0, 35, 0, 34, 0, 0, 0,130, 1, 0, 0, 0, 0, 35, 0,154, 0, 0, 0,130, 1, 0, 0, 0, 0, 35, 0,
- 39, 0, 0, 0,131, 1, 0, 0, 0, 0, 35, 0,154, 0, 0, 0,131, 1, 0, 0, 0, 0, 35, 0, 39, 0, 0, 0,132, 1, 0, 0,
- 0, 0, 35, 0,155, 0, 0, 0,132, 1, 0, 0, 0, 0, 35, 0, 40, 0, 0, 0,133, 1, 0, 0, 0, 0, 35, 0,155, 0, 0, 0,
-133, 1, 0, 0, 0, 0, 35, 0, 35, 0, 0, 0,134, 1, 0, 0, 0, 0, 35, 0,156, 0, 0, 0,134, 1, 0, 0, 0, 0, 35, 0,
- 41, 0, 0, 0,135, 1, 0, 0, 0, 0, 35, 0,156, 0, 0, 0,135, 1, 0, 0, 0, 0, 35, 0, 35, 0, 0, 0,136, 1, 0, 0,
- 0, 0, 35, 0,157, 0, 0, 0,136, 1, 0, 0, 0, 0, 35, 0, 40, 0, 0, 0,137, 1, 0, 0, 0, 0, 35, 0,157, 0, 0, 0,
-137, 1, 0, 0, 0, 0, 35, 0, 40, 0, 0, 0,138, 1, 0, 0, 0, 0, 35, 0,158, 0, 0, 0,138, 1, 0, 0, 0, 0, 35, 0,
- 41, 0, 0, 0,139, 1, 0, 0, 0, 0, 35, 0,158, 0, 0, 0,139, 1, 0, 0, 0, 0, 35, 0, 36, 0, 0, 0,140, 1, 0, 0,
- 0, 0, 35, 0,159, 0, 0, 0,140, 1, 0, 0, 0, 0, 35, 0, 37, 0, 0, 0,141, 1, 0, 0, 0, 0, 35, 0,159, 0, 0, 0,
-141, 1, 0, 0, 0, 0, 35, 0, 36, 0, 0, 0,142, 1, 0, 0, 0, 0, 35, 0,160, 0, 0, 0,142, 1, 0, 0, 0, 0, 35, 0,
- 41, 0, 0, 0,143, 1, 0, 0, 0, 0, 35, 0,160, 0, 0, 0,143, 1, 0, 0, 0, 0, 35, 0, 37, 0, 0, 0,144, 1, 0, 0,
- 0, 0, 35, 0,161, 0, 0, 0,144, 1, 0, 0, 0, 0, 35, 0, 41, 0, 0, 0,145, 1, 0, 0, 0, 0, 35, 0,161, 0, 0, 0,
-145, 1, 0, 0, 0, 0, 35, 0, 46, 0, 0, 0,146, 1, 0, 0, 0, 0, 35, 0,102, 0, 0, 0,146, 1, 0, 0, 0, 0, 35, 0,
- 43, 0, 0, 0,147, 1, 0, 0, 0, 0, 33, 0, 46, 0, 0, 0,147, 1, 0, 0, 0, 0, 33, 0, 43, 0, 0, 0,148, 1, 0, 0,
- 0, 0, 35, 0,102, 0, 0, 0,148, 1, 0, 0, 0, 0, 35, 0,102, 0, 0, 0,149, 1, 0, 0, 0, 0, 35, 0,103, 0, 0, 0,
-149, 1, 0, 0, 0, 0, 35, 0,103, 0, 0, 0,150, 1, 0, 0, 0, 0, 35, 0,104, 0, 0, 0,150, 1, 0, 0, 0, 0, 35, 0,
-102, 0, 0, 0,151, 1, 0, 0, 0, 0, 35, 0,104, 0, 0, 0,151, 1, 0, 0, 0, 0, 35, 0, 45, 0, 0, 0,152, 1, 0, 0,
- 0, 0, 33, 0, 47, 0, 0, 0,152, 1, 0, 0, 0, 0, 33, 0, 47, 0, 0, 0,153, 1, 0, 0, 0, 0, 35, 0,104, 0, 0, 0,
-153, 1, 0, 0, 0, 0, 35, 0, 45, 0, 0, 0,154, 1, 0, 0, 0, 0, 35, 0,104, 0, 0, 0,154, 1, 0, 0, 0, 0, 35, 0,
- 44, 0, 0, 0,155, 1, 0, 0, 0, 0, 35, 0,103, 0, 0, 0,155, 1, 0, 0, 0, 0, 35, 0, 42, 0, 0, 0,156, 1, 0, 0,
- 0, 0, 35, 0,103, 0, 0, 0,156, 1, 0, 0, 0, 0, 35, 0, 42, 0, 0, 0,157, 1, 0, 0, 0, 0, 33, 0, 44, 0, 0, 0,
-157, 1, 0, 0, 0, 0, 33, 0, 50, 0, 0, 0,158, 1, 0, 0, 0, 0, 35, 0,105, 0, 0, 0,158, 1, 0, 0, 0, 0, 35, 0,
- 43, 0, 0, 0,159, 1, 0, 0, 0, 0, 33, 0, 50, 0, 0, 0,159, 1, 0, 0, 0, 0, 33, 0, 43, 0, 0, 0,160, 1, 0, 0,
- 0, 0, 35, 0,105, 0, 0, 0,160, 1, 0, 0, 0, 0, 35, 0,105, 0, 0, 0,161, 1, 0, 0, 0, 0, 35, 0,106, 0, 0, 0,
-161, 1, 0, 0, 0, 0, 35, 0,106, 0, 0, 0,162, 1, 0, 0, 0, 0, 35, 0,107, 0, 0, 0,162, 1, 0, 0, 0, 0, 35, 0,
-105, 0, 0, 0,163, 1, 0, 0, 0, 0, 35, 0,107, 0, 0, 0,163, 1, 0, 0, 0, 0, 35, 0, 49, 0, 0, 0,164, 1, 0, 0,
- 0, 0, 33, 0, 51, 0, 0, 0,164, 1, 0, 0, 0, 0, 33, 0, 51, 0, 0, 0,165, 1, 0, 0, 0, 0, 35, 0,107, 0, 0, 0,
-165, 1, 0, 0, 0, 0, 35, 0, 49, 0, 0, 0,166, 1, 0, 0, 0, 0, 35, 0,107, 0, 0, 0,166, 1, 0, 0, 0, 0, 35, 0,
- 48, 0, 0, 0,167, 1, 0, 0, 0, 0, 35, 0,106, 0, 0, 0,167, 1, 0, 0, 0, 0, 35, 0, 42, 0, 0, 0,168, 1, 0, 0,
- 0, 0, 35, 0,106, 0, 0, 0,168, 1, 0, 0, 0, 0, 35, 0, 42, 0, 0, 0,169, 1, 0, 0, 0, 0, 33, 0, 48, 0, 0, 0,
-169, 1, 0, 0, 0, 0, 33, 0, 54, 0, 0, 0,170, 1, 0, 0, 0, 0, 35, 0,108, 0, 0, 0,170, 1, 0, 0, 0, 0, 35, 0,
- 45, 0, 0, 0,171, 1, 0, 0, 0, 0, 33, 0, 54, 0, 0, 0,171, 1, 0, 0, 0, 0, 33, 0, 45, 0, 0, 0,172, 1, 0, 0,
- 0, 0, 35, 0,108, 0, 0, 0,172, 1, 0, 0, 0, 0, 35, 0,108, 0, 0, 0,173, 1, 0, 0, 0, 0, 35, 0,109, 0, 0, 0,
-173, 1, 0, 0, 0, 0, 35, 0,109, 0, 0, 0,174, 1, 0, 0, 0, 0, 35, 0,110, 0, 0, 0,174, 1, 0, 0, 0, 0, 35, 0,
-108, 0, 0, 0,175, 1, 0, 0, 0, 0, 35, 0,110, 0, 0, 0,175, 1, 0, 0, 0, 0, 35, 0, 53, 0, 0, 0,176, 1, 0, 0,
- 0, 0, 33, 0, 55, 0, 0, 0,176, 1, 0, 0, 0, 0, 33, 0, 55, 0, 0, 0,177, 1, 0, 0, 0, 0, 35, 0,110, 0, 0, 0,
-177, 1, 0, 0, 0, 0, 35, 0, 53, 0, 0, 0,178, 1, 0, 0, 0, 0, 35, 0,110, 0, 0, 0,178, 1, 0, 0, 0, 0, 35, 0,
- 52, 0, 0, 0,179, 1, 0, 0, 0, 0, 35, 0,109, 0, 0, 0,179, 1, 0, 0, 0, 0, 35, 0, 44, 0, 0, 0,180, 1, 0, 0,
- 0, 0, 35, 0,109, 0, 0, 0,180, 1, 0, 0, 0, 0, 35, 0, 44, 0, 0, 0,181, 1, 0, 0, 0, 0, 33, 0, 52, 0, 0, 0,
-181, 1, 0, 0, 0, 0, 33, 0, 58, 0, 0, 0,182, 1, 0, 0, 0, 0, 35, 0,111, 0, 0, 0,182, 1, 0, 0, 0, 0, 35, 0,
- 53, 0, 0, 0,183, 1, 0, 0, 0, 0, 33, 0, 58, 0, 0, 0,183, 1, 0, 0, 0, 0, 33, 0, 53, 0, 0, 0,184, 1, 0, 0,
- 0, 0, 35, 0,111, 0, 0, 0,184, 1, 0, 0, 0, 0, 35, 0,111, 0, 0, 0,185, 1, 0, 0, 0, 0, 35, 0,112, 0, 0, 0,
-185, 1, 0, 0, 0, 0, 35, 0,112, 0, 0, 0,186, 1, 0, 0, 0, 0, 35, 0,113, 0, 0, 0,186, 1, 0, 0, 0, 0, 35, 0,
-111, 0, 0, 0,187, 1, 0, 0, 0, 0, 35, 0,113, 0, 0, 0,187, 1, 0, 0, 0, 0, 35, 0, 57, 0, 0, 0,188, 1, 0, 0,
- 0, 0, 33, 0, 59, 0, 0, 0,188, 1, 0, 0, 0, 0, 33, 0, 59, 0, 0, 0,189, 1, 0, 0, 0, 0, 35, 0,113, 0, 0, 0,
-189, 1, 0, 0, 0, 0, 35, 0, 57, 0, 0, 0,190, 1, 0, 0, 0, 0, 35, 0,113, 0, 0, 0,190, 1, 0, 0, 0, 0, 35, 0,
- 56, 0, 0, 0,191, 1, 0, 0, 0, 0, 35, 0,112, 0, 0, 0,191, 1, 0, 0, 0, 0, 35, 0, 52, 0, 0, 0,192, 1, 0, 0,
- 0, 0, 35, 0,112, 0, 0, 0,192, 1, 0, 0, 0, 0, 35, 0, 52, 0, 0, 0,193, 1, 0, 0, 0, 0, 33, 0, 56, 0, 0, 0,
-193, 1, 0, 0, 0, 0, 33, 0, 60, 0, 0, 0,194, 1, 0, 0, 0, 0, 35, 0,114, 0, 0, 0,194, 1, 0, 0, 0, 0, 35, 0,
- 57, 0, 0, 0,195, 1, 0, 0, 0, 0, 33, 0, 60, 0, 0, 0,195, 1, 0, 0, 0, 0, 33, 0, 57, 0, 0, 0,196, 1, 0, 0,
- 0, 0, 35, 0,114, 0, 0, 0,196, 1, 0, 0, 0, 0, 35, 0,114, 0, 0, 0,197, 1, 0, 0, 0, 0, 35, 0,115, 0, 0, 0,
-197, 1, 0, 0, 0, 0, 35, 0,115, 0, 0, 0,198, 1, 0, 0, 0, 0, 35, 0,116, 0, 0, 0,198, 1, 0, 0, 0, 0, 35, 0,
-114, 0, 0, 0,199, 1, 0, 0, 0, 0, 35, 0,116, 0, 0, 0,199, 1, 0, 0, 0, 0, 35, 0, 49, 0, 0, 0,200, 1, 0, 0,
- 0, 0, 33, 0, 61, 0, 0, 0,200, 1, 0, 0, 0, 0, 33, 0, 61, 0, 0, 0,201, 1, 0, 0, 0, 0, 35, 0,116, 0, 0, 0,
-201, 1, 0, 0, 0, 0, 35, 0, 49, 0, 0, 0,202, 1, 0, 0, 0, 0, 35, 0,116, 0, 0, 0,202, 1, 0, 0, 0, 0, 35, 0,
- 48, 0, 0, 0,203, 1, 0, 0, 0, 0, 35, 0,115, 0, 0, 0,203, 1, 0, 0, 0, 0, 35, 0, 56, 0, 0, 0,204, 1, 0, 0,
- 0, 0, 35, 0,115, 0, 0, 0,204, 1, 0, 0, 0, 0, 35, 0, 48, 0, 0, 0,205, 1, 0, 0, 0, 0, 33, 0, 56, 0, 0, 0,
-205, 1, 0, 0, 0, 0, 33, 0, 64, 0, 0, 0,206, 1, 0, 0, 0, 0, 35, 0,117, 0, 0, 0,206, 1, 0, 0, 0, 0, 35, 0,
- 50, 0, 0, 0,207, 1, 0, 0, 0, 0, 33, 0, 64, 0, 0, 0,207, 1, 0, 0, 0, 0, 33, 0, 50, 0, 0, 0,208, 1, 0, 0,
- 0, 0, 35, 0,117, 0, 0, 0,208, 1, 0, 0, 0, 0, 35, 0,117, 0, 0, 0,209, 1, 0, 0, 0, 0, 35, 0,118, 0, 0, 0,
-209, 1, 0, 0, 0, 0, 35, 0,118, 0, 0, 0,210, 1, 0, 0, 0, 0, 35, 0,119, 0, 0, 0,210, 1, 0, 0, 0, 0, 35, 0,
-117, 0, 0, 0,211, 1, 0, 0, 0, 0, 35, 0,119, 0, 0, 0,211, 1, 0, 0, 0, 0, 35, 0, 63, 0, 0, 0,212, 1, 0, 0,
- 0, 0, 33, 0, 65, 0, 0, 0,212, 1, 0, 0, 0, 0, 33, 0, 65, 0, 0, 0,213, 1, 0, 0, 0, 0, 35, 0,119, 0, 0, 0,
-213, 1, 0, 0, 0, 0, 35, 0, 63, 0, 0, 0,214, 1, 0, 0, 0, 0, 35, 0,119, 0, 0, 0,214, 1, 0, 0, 0, 0, 35, 0,
- 62, 0, 0, 0,215, 1, 0, 0, 0, 0, 35, 0,118, 0, 0, 0,215, 1, 0, 0, 0, 0, 35, 0, 51, 0, 0, 0,216, 1, 0, 0,
- 0, 0, 35, 0,118, 0, 0, 0,216, 1, 0, 0, 0, 0, 35, 0, 51, 0, 0, 0,217, 1, 0, 0, 0, 0, 33, 0, 62, 0, 0, 0,
-217, 1, 0, 0, 0, 0, 33, 0, 68, 0, 0, 0,218, 1, 0, 0, 0, 0, 35, 0,120, 0, 0, 0,218, 1, 0, 0, 0, 0, 35, 0,
- 47, 0, 0, 0,219, 1, 0, 0, 0, 0, 33, 0, 68, 0, 0, 0,219, 1, 0, 0, 0, 0, 33, 0, 47, 0, 0, 0,220, 1, 0, 0,
- 0, 0, 35, 0,120, 0, 0, 0,220, 1, 0, 0, 0, 0, 35, 0,120, 0, 0, 0,221, 1, 0, 0, 0, 0, 35, 0,121, 0, 0, 0,
-221, 1, 0, 0, 0, 0, 35, 0,121, 0, 0, 0,222, 1, 0, 0, 0, 0, 35, 0,122, 0, 0, 0,222, 1, 0, 0, 0, 0, 35, 0,
-120, 0, 0, 0,223, 1, 0, 0, 0, 0, 35, 0,122, 0, 0, 0,223, 1, 0, 0, 0, 0, 35, 0, 67, 0, 0, 0,224, 1, 0, 0,
- 0, 0, 33, 0, 69, 0, 0, 0,224, 1, 0, 0, 0, 0, 33, 0, 69, 0, 0, 0,225, 1, 0, 0, 0, 0, 35, 0,122, 0, 0, 0,
-225, 1, 0, 0, 0, 0, 35, 0, 67, 0, 0, 0,226, 1, 0, 0, 0, 0, 35, 0,122, 0, 0, 0,226, 1, 0, 0, 0, 0, 35, 0,
- 66, 0, 0, 0,227, 1, 0, 0, 0, 0, 35, 0,121, 0, 0, 0,227, 1, 0, 0, 0, 0, 35, 0, 46, 0, 0, 0,228, 1, 0, 0,
- 0, 0, 35, 0,121, 0, 0, 0,228, 1, 0, 0, 0, 0, 35, 0, 46, 0, 0, 0,229, 1, 0, 0, 0, 0, 33, 0, 66, 0, 0, 0,
-229, 1, 0, 0, 0, 0, 33, 0, 72, 0, 0, 0,230, 1, 0, 0, 0, 0, 35, 0,123, 0, 0, 0,230, 1, 0, 0, 0, 0, 35, 0,
- 55, 0, 0, 0,231, 1, 0, 0, 0, 0, 33, 0, 72, 0, 0, 0,231, 1, 0, 0, 0, 0, 33, 0, 55, 0, 0, 0,232, 1, 0, 0,
- 0, 0, 35, 0,123, 0, 0, 0,232, 1, 0, 0, 0, 0, 35, 0,123, 0, 0, 0,233, 1, 0, 0, 0, 0, 35, 0,124, 0, 0, 0,
-233, 1, 0, 0, 0, 0, 35, 0,124, 0, 0, 0,234, 1, 0, 0, 0, 0, 35, 0,125, 0, 0, 0,234, 1, 0, 0, 0, 0, 35, 0,
-123, 0, 0, 0,235, 1, 0, 0, 0, 0, 35, 0,125, 0, 0, 0,235, 1, 0, 0, 0, 0, 35, 0, 71, 0, 0, 0,236, 1, 0, 0,
- 0, 0, 33, 0, 73, 0, 0, 0,236, 1, 0, 0, 0, 0, 33, 0, 73, 0, 0, 0,237, 1, 0, 0, 0, 0, 35, 0,125, 0, 0, 0,
-237, 1, 0, 0, 0, 0, 35, 0, 71, 0, 0, 0,238, 1, 0, 0, 0, 0, 35, 0,125, 0, 0, 0,238, 1, 0, 0, 0, 0, 35, 0,
- 70, 0, 0, 0,239, 1, 0, 0, 0, 0, 35, 0,124, 0, 0, 0,239, 1, 0, 0, 0, 0, 35, 0, 54, 0, 0, 0,240, 1, 0, 0,
- 0, 0, 35, 0,124, 0, 0, 0,240, 1, 0, 0, 0, 0, 35, 0, 54, 0, 0, 0,241, 1, 0, 0, 0, 0, 33, 0, 70, 0, 0, 0,
-241, 1, 0, 0, 0, 0, 33, 0, 76, 0, 0, 0,242, 1, 0, 0, 0, 0, 35, 0,126, 0, 0, 0,242, 1, 0, 0, 0, 0, 35, 0,
- 59, 0, 0, 0,243, 1, 0, 0, 0, 0, 33, 0, 76, 0, 0, 0,243, 1, 0, 0, 0, 0, 33, 0, 59, 0, 0, 0,244, 1, 0, 0,
- 0, 0, 35, 0,126, 0, 0, 0,244, 1, 0, 0, 0, 0, 35, 0,126, 0, 0, 0,245, 1, 0, 0, 0, 0, 35, 0,127, 0, 0, 0,
-245, 1, 0, 0, 0, 0, 35, 0,127, 0, 0, 0,246, 1, 0, 0, 0, 0, 35, 0,128, 0, 0, 0,246, 1, 0, 0, 0, 0, 35, 0,
-126, 0, 0, 0,247, 1, 0, 0, 0, 0, 35, 0,128, 0, 0, 0,247, 1, 0, 0, 0, 0, 35, 0, 75, 0, 0, 0,248, 1, 0, 0,
- 0, 0, 33, 0, 77, 0, 0, 0,248, 1, 0, 0, 0, 0, 33, 0, 77, 0, 0, 0,249, 1, 0, 0, 0, 0, 35, 0,128, 0, 0, 0,
-249, 1, 0, 0, 0, 0, 35, 0, 75, 0, 0, 0,250, 1, 0, 0, 0, 0, 35, 0,128, 0, 0, 0,250, 1, 0, 0, 0, 0, 35, 0,
- 74, 0, 0, 0,251, 1, 0, 0, 0, 0, 35, 0,127, 0, 0, 0,251, 1, 0, 0, 0, 0, 35, 0, 58, 0, 0, 0,252, 1, 0, 0,
- 0, 0, 35, 0,127, 0, 0, 0,252, 1, 0, 0, 0, 0, 35, 0, 58, 0, 0, 0,253, 1, 0, 0, 0, 0, 33, 0, 74, 0, 0, 0,
-253, 1, 0, 0, 0, 0, 33, 0, 80, 0, 0, 0,254, 1, 0, 0, 0, 0, 35, 0,129, 0, 0, 0,254, 1, 0, 0, 0, 0, 35, 0,
- 61, 0, 0, 0,255, 1, 0, 0, 0, 0, 33, 0, 80, 0, 0, 0,255, 1, 0, 0, 0, 0, 33, 0, 61, 0, 0, 0, 0, 2, 0, 0,
- 0, 0, 35, 0,129, 0, 0, 0, 0, 2, 0, 0, 0, 0, 35, 0,129, 0, 0, 0, 1, 2, 0, 0, 0, 0, 35, 0,130, 0, 0, 0,
- 1, 2, 0, 0, 0, 0, 35, 0,130, 0, 0, 0, 2, 2, 0, 0, 0, 0, 35, 0,131, 0, 0, 0, 2, 2, 0, 0, 0, 0, 35, 0,
-129, 0, 0, 0, 3, 2, 0, 0, 0, 0, 35, 0,131, 0, 0, 0, 3, 2, 0, 0, 0, 0, 35, 0, 79, 0, 0, 0, 4, 2, 0, 0,
- 0, 0, 33, 0, 81, 0, 0, 0, 4, 2, 0, 0, 0, 0, 33, 0, 81, 0, 0, 0, 5, 2, 0, 0, 0, 0, 35, 0,131, 0, 0, 0,
- 5, 2, 0, 0, 0, 0, 35, 0, 79, 0, 0, 0, 6, 2, 0, 0, 0, 0, 35, 0,131, 0, 0, 0, 6, 2, 0, 0, 0, 0, 35, 0,
- 78, 0, 0, 0, 7, 2, 0, 0, 0, 0, 35, 0,130, 0, 0, 0, 7, 2, 0, 0, 0, 0, 35, 0, 60, 0, 0, 0, 8, 2, 0, 0,
- 0, 0, 35, 0,130, 0, 0, 0, 8, 2, 0, 0, 0, 0, 35, 0, 60, 0, 0, 0, 9, 2, 0, 0, 0, 0, 33, 0, 78, 0, 0, 0,
- 9, 2, 0, 0, 0, 0, 33, 0, 83, 0, 0, 0, 10, 2, 0, 0, 0, 0, 35, 0,132, 0, 0, 0, 10, 2, 0, 0, 0, 0, 35, 0,
- 65, 0, 0, 0, 11, 2, 0, 0, 0, 0, 33, 0, 83, 0, 0, 0, 11, 2, 0, 0, 0, 0, 33, 0, 65, 0, 0, 0, 12, 2, 0, 0,
- 0, 0, 35, 0,132, 0, 0, 0, 12, 2, 0, 0, 0, 0, 35, 0,132, 0, 0, 0, 13, 2, 0, 0, 0, 0, 35, 0,133, 0, 0, 0,
- 13, 2, 0, 0, 0, 0, 35, 0,133, 0, 0, 0, 14, 2, 0, 0, 0, 0, 35, 0,134, 0, 0, 0, 14, 2, 0, 0, 0, 0, 35, 0,
-132, 0, 0, 0, 15, 2, 0, 0, 0, 0, 35, 0,134, 0, 0, 0, 15, 2, 0, 0, 0, 0, 35, 0, 67, 0, 0, 0, 16, 2, 0, 0,
- 0, 0, 33, 0, 82, 0, 0, 0, 16, 2, 0, 0, 0, 0, 33, 0, 82, 0, 0, 0, 17, 2, 0, 0, 0, 0, 35, 0,134, 0, 0, 0,
- 17, 2, 0, 0, 0, 0, 35, 0, 67, 0, 0, 0, 18, 2, 0, 0, 0, 0, 35, 0,134, 0, 0, 0, 18, 2, 0, 0, 0, 0, 35, 0,
- 66, 0, 0, 0, 19, 2, 0, 0, 0, 0, 35, 0,133, 0, 0, 0, 19, 2, 0, 0, 0, 0, 35, 0, 64, 0, 0, 0, 20, 2, 0, 0,
- 0, 0, 35, 0,133, 0, 0, 0, 20, 2, 0, 0, 0, 0, 35, 0, 64, 0, 0, 0, 21, 2, 0, 0, 0, 0, 33, 0, 66, 0, 0, 0,
- 21, 2, 0, 0, 0, 0, 33, 0, 84, 0, 0, 0, 22, 2, 0, 0, 0, 0, 35, 0,135, 0, 0, 0, 22, 2, 0, 0, 0, 0, 35, 0,
- 69, 0, 0, 0, 23, 2, 0, 0, 0, 0, 33, 0, 84, 0, 0, 0, 23, 2, 0, 0, 0, 0, 33, 0, 69, 0, 0, 0, 24, 2, 0, 0,
- 0, 0, 35, 0,135, 0, 0, 0, 24, 2, 0, 0, 0, 0, 35, 0,135, 0, 0, 0, 25, 2, 0, 0, 0, 0, 35, 0,136, 0, 0, 0,
- 25, 2, 0, 0, 0, 0, 35, 0,136, 0, 0, 0, 26, 2, 0, 0, 0, 0, 35, 0,137, 0, 0, 0, 26, 2, 0, 0, 0, 0, 35, 0,
-135, 0, 0, 0, 27, 2, 0, 0, 0, 0, 35, 0,137, 0, 0, 0, 27, 2, 0, 0, 0, 0, 35, 0, 71, 0, 0, 0, 28, 2, 0, 0,
- 0, 0, 33, 0, 85, 0, 0, 0, 28, 2, 0, 0, 0, 0, 33, 0, 85, 0, 0, 0, 29, 2, 0, 0, 0, 0, 35, 0,137, 0, 0, 0,
- 29, 2, 0, 0, 0, 0, 35, 0, 71, 0, 0, 0, 30, 2, 0, 0, 0, 0, 35, 0,137, 0, 0, 0, 30, 2, 0, 0, 0, 0, 35, 0,
- 70, 0, 0, 0, 31, 2, 0, 0, 0, 0, 35, 0,136, 0, 0, 0, 31, 2, 0, 0, 0, 0, 35, 0, 68, 0, 0, 0, 32, 2, 0, 0,
- 0, 0, 35, 0,136, 0, 0, 0, 32, 2, 0, 0, 0, 0, 35, 0, 68, 0, 0, 0, 33, 2, 0, 0, 0, 0, 33, 0, 70, 0, 0, 0,
- 33, 2, 0, 0, 0, 0, 33, 0, 86, 0, 0, 0, 34, 2, 0, 0, 0, 0, 35, 0,138, 0, 0, 0, 34, 2, 0, 0, 0, 0, 35, 0,
- 73, 0, 0, 0, 35, 2, 0, 0, 0, 0, 33, 0, 86, 0, 0, 0, 35, 2, 0, 0, 0, 0, 33, 0, 73, 0, 0, 0, 36, 2, 0, 0,
- 0, 0, 35, 0,138, 0, 0, 0, 36, 2, 0, 0, 0, 0, 35, 0,138, 0, 0, 0, 37, 2, 0, 0, 0, 0, 35, 0,139, 0, 0, 0,
- 37, 2, 0, 0, 0, 0, 35, 0,139, 0, 0, 0, 38, 2, 0, 0, 0, 0, 35, 0,140, 0, 0, 0, 38, 2, 0, 0, 0, 0, 35, 0,
-138, 0, 0, 0, 39, 2, 0, 0, 0, 0, 35, 0,140, 0, 0, 0, 39, 2, 0, 0, 0, 0, 35, 0, 75, 0, 0, 0, 40, 2, 0, 0,
- 0, 0, 33, 0, 87, 0, 0, 0, 40, 2, 0, 0, 0, 0, 33, 0, 87, 0, 0, 0, 41, 2, 0, 0, 0, 0, 35, 0,140, 0, 0, 0,
- 41, 2, 0, 0, 0, 0, 35, 0, 75, 0, 0, 0, 42, 2, 0, 0, 0, 0, 35, 0,140, 0, 0, 0, 42, 2, 0, 0, 0, 0, 35, 0,
- 74, 0, 0, 0, 43, 2, 0, 0, 0, 0, 35, 0,139, 0, 0, 0, 43, 2, 0, 0, 0, 0, 35, 0, 72, 0, 0, 0, 44, 2, 0, 0,
- 0, 0, 35, 0,139, 0, 0, 0, 44, 2, 0, 0, 0, 0, 35, 0, 72, 0, 0, 0, 45, 2, 0, 0, 0, 0, 33, 0, 74, 0, 0, 0,
- 45, 2, 0, 0, 0, 0, 33, 0, 88, 0, 0, 0, 46, 2, 0, 0, 0, 0, 35, 0,141, 0, 0, 0, 46, 2, 0, 0, 0, 0, 35, 0,
- 77, 0, 0, 0, 47, 2, 0, 0, 0, 0, 33, 0, 88, 0, 0, 0, 47, 2, 0, 0, 0, 0, 33, 0, 77, 0, 0, 0, 48, 2, 0, 0,
- 0, 0, 35, 0,141, 0, 0, 0, 48, 2, 0, 0, 0, 0, 35, 0,141, 0, 0, 0, 49, 2, 0, 0, 0, 0, 35, 0,142, 0, 0, 0,
- 49, 2, 0, 0, 0, 0, 35, 0,142, 0, 0, 0, 50, 2, 0, 0, 0, 0, 35, 0,143, 0, 0, 0, 50, 2, 0, 0, 0, 0, 35, 0,
-141, 0, 0, 0, 51, 2, 0, 0, 0, 0, 35, 0,143, 0, 0, 0, 51, 2, 0, 0, 0, 0, 35, 0, 79, 0, 0, 0, 52, 2, 0, 0,
- 0, 0, 33, 0, 89, 0, 0, 0, 52, 2, 0, 0, 0, 0, 33, 0, 89, 0, 0, 0, 53, 2, 0, 0, 0, 0, 35, 0,143, 0, 0, 0,
- 53, 2, 0, 0, 0, 0, 35, 0, 79, 0, 0, 0, 54, 2, 0, 0, 0, 0, 35, 0,143, 0, 0, 0, 54, 2, 0, 0, 0, 0, 35, 0,
- 78, 0, 0, 0, 55, 2, 0, 0, 0, 0, 35, 0,142, 0, 0, 0, 55, 2, 0, 0, 0, 0, 35, 0, 76, 0, 0, 0, 56, 2, 0, 0,
- 0, 0, 35, 0,142, 0, 0, 0, 56, 2, 0, 0, 0, 0, 35, 0, 76, 0, 0, 0, 57, 2, 0, 0, 0, 0, 33, 0, 78, 0, 0, 0,
- 57, 2, 0, 0, 0, 0, 33, 0, 90, 0, 0, 0, 58, 2, 0, 0, 0, 0, 35, 0,144, 0, 0, 0, 58, 2, 0, 0, 0, 0, 35, 0,
- 81, 0, 0, 0, 59, 2, 0, 0, 0, 0, 33, 0, 90, 0, 0, 0, 59, 2, 0, 0, 0, 0, 33, 0, 81, 0, 0, 0, 60, 2, 0, 0,
- 0, 0, 35, 0,144, 0, 0, 0, 60, 2, 0, 0, 0, 0, 35, 0,144, 0, 0, 0, 61, 2, 0, 0, 0, 0, 35, 0,145, 0, 0, 0,
- 61, 2, 0, 0, 0, 0, 35, 0,145, 0, 0, 0, 62, 2, 0, 0, 0, 0, 35, 0,146, 0, 0, 0, 62, 2, 0, 0, 0, 0, 35, 0,
-144, 0, 0, 0, 63, 2, 0, 0, 0, 0, 35, 0,146, 0, 0, 0, 63, 2, 0, 0, 0, 0, 35, 0, 63, 0, 0, 0, 64, 2, 0, 0,
- 0, 0, 33, 0, 91, 0, 0, 0, 64, 2, 0, 0, 0, 0, 33, 0, 91, 0, 0, 0, 65, 2, 0, 0, 0, 0, 35, 0,146, 0, 0, 0,
- 65, 2, 0, 0, 0, 0, 35, 0, 63, 0, 0, 0, 66, 2, 0, 0, 0, 0, 35, 0,146, 0, 0, 0, 66, 2, 0, 0, 0, 0, 35, 0,
- 62, 0, 0, 0, 67, 2, 0, 0, 0, 0, 35, 0,145, 0, 0, 0, 67, 2, 0, 0, 0, 0, 35, 0, 80, 0, 0, 0, 68, 2, 0, 0,
- 0, 0, 35, 0,145, 0, 0, 0, 68, 2, 0, 0, 0, 0, 35, 0, 62, 0, 0, 0, 69, 2, 0, 0, 0, 0, 33, 0, 80, 0, 0, 0,
- 69, 2, 0, 0, 0, 0, 33, 0, 94, 0, 0, 0, 70, 2, 0, 0, 0, 0, 35, 0,147, 0, 0, 0, 70, 2, 0, 0, 0, 0, 35, 0,
- 82, 0, 0, 0, 71, 2, 0, 0, 0, 0, 33, 0, 94, 0, 0, 0, 71, 2, 0, 0, 0, 0, 33, 0, 82, 0, 0, 0, 72, 2, 0, 0,
- 0, 0, 35, 0,147, 0, 0, 0, 72, 2, 0, 0, 0, 0, 35, 0,147, 0, 0, 0, 73, 2, 0, 0, 0, 0, 35, 0,148, 0, 0, 0,
- 73, 2, 0, 0, 0, 0, 35, 0,148, 0, 0, 0, 74, 2, 0, 0, 0, 0, 35, 0,149, 0, 0, 0, 74, 2, 0, 0, 0, 0, 35, 0,
-147, 0, 0, 0, 75, 2, 0, 0, 0, 0, 35, 0,149, 0, 0, 0, 75, 2, 0, 0, 0, 0, 35, 0, 93, 0, 0, 0, 76, 2, 0, 0,
- 0, 0, 33, 0, 95, 0, 0, 0, 76, 2, 0, 0, 0, 0, 33, 0, 95, 0, 0, 0, 77, 2, 0, 0, 0, 0, 35, 0,149, 0, 0, 0,
- 77, 2, 0, 0, 0, 0, 35, 0, 93, 0, 0, 0, 78, 2, 0, 0, 0, 0, 35, 0,149, 0, 0, 0, 78, 2, 0, 0, 0, 0, 35, 0,
- 92, 0, 0, 0, 79, 2, 0, 0, 0, 0, 35, 0,148, 0, 0, 0, 79, 2, 0, 0, 0, 0, 35, 0, 83, 0, 0, 0, 80, 2, 0, 0,
- 0, 0, 35, 0,148, 0, 0, 0, 80, 2, 0, 0, 0, 0, 35, 0, 83, 0, 0, 0, 81, 2, 0, 0, 0, 0, 33, 0, 92, 0, 0, 0,
- 81, 2, 0, 0, 0, 0, 33, 0, 96, 0, 0, 0, 82, 2, 0, 0, 0, 0, 35, 0,150, 0, 0, 0, 82, 2, 0, 0, 0, 0, 35, 0,
- 85, 0, 0, 0, 83, 2, 0, 0, 0, 0, 33, 0, 96, 0, 0, 0, 83, 2, 0, 0, 0, 0, 33, 0, 85, 0, 0, 0, 84, 2, 0, 0,
- 0, 0, 35, 0,150, 0, 0, 0, 84, 2, 0, 0, 0, 0, 35, 0,150, 0, 0, 0, 85, 2, 0, 0, 0, 0, 35, 0,151, 0, 0, 0,
- 85, 2, 0, 0, 0, 0, 35, 0,151, 0, 0, 0, 86, 2, 0, 0, 0, 0, 35, 0,152, 0, 0, 0, 86, 2, 0, 0, 0, 0, 35, 0,
-150, 0, 0, 0, 87, 2, 0, 0, 0, 0, 35, 0,152, 0, 0, 0, 87, 2, 0, 0, 0, 0, 35, 0, 95, 0, 0, 0, 88, 2, 0, 0,
- 0, 0, 33, 0, 97, 0, 0, 0, 88, 2, 0, 0, 0, 0, 33, 0, 97, 0, 0, 0, 89, 2, 0, 0, 0, 0, 35, 0,152, 0, 0, 0,
- 89, 2, 0, 0, 0, 0, 35, 0, 95, 0, 0, 0, 90, 2, 0, 0, 0, 0, 35, 0,152, 0, 0, 0, 90, 2, 0, 0, 0, 0, 35, 0,
- 94, 0, 0, 0, 91, 2, 0, 0, 0, 0, 35, 0,151, 0, 0, 0, 91, 2, 0, 0, 0, 0, 35, 0, 84, 0, 0, 0, 92, 2, 0, 0,
- 0, 0, 35, 0,151, 0, 0, 0, 92, 2, 0, 0, 0, 0, 35, 0, 84, 0, 0, 0, 93, 2, 0, 0, 0, 0, 33, 0, 94, 0, 0, 0,
- 93, 2, 0, 0, 0, 0, 33, 0, 98, 0, 0, 0, 94, 2, 0, 0, 0, 0, 35, 0,153, 0, 0, 0, 94, 2, 0, 0, 0, 0, 35, 0,
- 87, 0, 0, 0, 95, 2, 0, 0, 0, 0, 33, 0, 98, 0, 0, 0, 95, 2, 0, 0, 0, 0, 33, 0, 87, 0, 0, 0, 96, 2, 0, 0,
- 0, 0, 35, 0,153, 0, 0, 0, 96, 2, 0, 0, 0, 0, 35, 0,153, 0, 0, 0, 97, 2, 0, 0, 0, 0, 35, 0,154, 0, 0, 0,
- 97, 2, 0, 0, 0, 0, 35, 0,154, 0, 0, 0, 98, 2, 0, 0, 0, 0, 35, 0,155, 0, 0, 0, 98, 2, 0, 0, 0, 0, 35, 0,
-153, 0, 0, 0, 99, 2, 0, 0, 0, 0, 35, 0,155, 0, 0, 0, 99, 2, 0, 0, 0, 0, 35, 0, 97, 0, 0, 0,100, 2, 0, 0,
- 0, 0, 33, 0, 99, 0, 0, 0,100, 2, 0, 0, 0, 0, 33, 0, 99, 0, 0, 0,101, 2, 0, 0, 0, 0, 35, 0,155, 0, 0, 0,
-101, 2, 0, 0, 0, 0, 35, 0, 97, 0, 0, 0,102, 2, 0, 0, 0, 0, 35, 0,155, 0, 0, 0,102, 2, 0, 0, 0, 0, 35, 0,
- 96, 0, 0, 0,103, 2, 0, 0, 0, 0, 35, 0,154, 0, 0, 0,103, 2, 0, 0, 0, 0, 35, 0, 86, 0, 0, 0,104, 2, 0, 0,
- 0, 0, 35, 0,154, 0, 0, 0,104, 2, 0, 0, 0, 0, 35, 0, 86, 0, 0, 0,105, 2, 0, 0, 0, 0, 33, 0, 96, 0, 0, 0,
-105, 2, 0, 0, 0, 0, 33, 0,100, 0, 0, 0,106, 2, 0, 0, 0, 0, 35, 0,156, 0, 0, 0,106, 2, 0, 0, 0, 0, 35, 0,
- 89, 0, 0, 0,107, 2, 0, 0, 0, 0, 33, 0,100, 0, 0, 0,107, 2, 0, 0, 0, 0, 33, 0, 89, 0, 0, 0,108, 2, 0, 0,
- 0, 0, 35, 0,156, 0, 0, 0,108, 2, 0, 0, 0, 0, 35, 0,156, 0, 0, 0,109, 2, 0, 0, 0, 0, 35, 0,157, 0, 0, 0,
-109, 2, 0, 0, 0, 0, 35, 0,157, 0, 0, 0,110, 2, 0, 0, 0, 0, 35, 0,158, 0, 0, 0,110, 2, 0, 0, 0, 0, 35, 0,
-156, 0, 0, 0,111, 2, 0, 0, 0, 0, 35, 0,158, 0, 0, 0,111, 2, 0, 0, 0, 0, 35, 0, 99, 0, 0, 0,112, 2, 0, 0,
- 0, 0, 33, 0,101, 0, 0, 0,112, 2, 0, 0, 0, 0, 33, 0,101, 0, 0, 0,113, 2, 0, 0, 0, 0, 35, 0,158, 0, 0, 0,
-113, 2, 0, 0, 0, 0, 35, 0, 99, 0, 0, 0,114, 2, 0, 0, 0, 0, 35, 0,158, 0, 0, 0,114, 2, 0, 0, 0, 0, 35, 0,
- 98, 0, 0, 0,115, 2, 0, 0, 0, 0, 35, 0,157, 0, 0, 0,115, 2, 0, 0, 0, 0, 35, 0, 88, 0, 0, 0,116, 2, 0, 0,
- 0, 0, 35, 0,157, 0, 0, 0,116, 2, 0, 0, 0, 0, 35, 0, 88, 0, 0, 0,117, 2, 0, 0, 0, 0, 33, 0, 98, 0, 0, 0,
-117, 2, 0, 0, 0, 0, 33, 0, 92, 0, 0, 0,118, 2, 0, 0, 0, 0, 35, 0,159, 0, 0, 0,118, 2, 0, 0, 0, 0, 35, 0,
- 91, 0, 0, 0,119, 2, 0, 0, 0, 0, 33, 0, 92, 0, 0, 0,119, 2, 0, 0, 0, 0, 33, 0, 91, 0, 0, 0,120, 2, 0, 0,
- 0, 0, 35, 0,159, 0, 0, 0,120, 2, 0, 0, 0, 0, 35, 0,159, 0, 0, 0,121, 2, 0, 0, 0, 0, 35, 0,160, 0, 0, 0,
-121, 2, 0, 0, 0, 0, 35, 0,160, 0, 0, 0,122, 2, 0, 0, 0, 0, 35, 0,161, 0, 0, 0,122, 2, 0, 0, 0, 0, 35, 0,
-159, 0, 0, 0,123, 2, 0, 0, 0, 0, 35, 0,161, 0, 0, 0,123, 2, 0, 0, 0, 0, 35, 0, 93, 0, 0, 0,124, 2, 0, 0,
- 0, 0, 33, 0,101, 0, 0, 0,124, 2, 0, 0, 0, 0, 33, 0, 93, 0, 0, 0,125, 2, 0, 0, 0, 0, 35, 0,161, 0, 0, 0,
-125, 2, 0, 0, 0, 0, 35, 0,101, 0, 0, 0,126, 2, 0, 0, 0, 0, 35, 0,161, 0, 0, 0,126, 2, 0, 0, 0, 0, 35, 0,
-100, 0, 0, 0,127, 2, 0, 0, 0, 0, 35, 0,160, 0, 0, 0,127, 2, 0, 0, 0, 0, 35, 0, 90, 0, 0, 0,128, 2, 0, 0,
- 0, 0, 35, 0,160, 0, 0, 0,128, 2, 0, 0, 0, 0, 35, 0, 90, 0, 0, 0,129, 2, 0, 0, 0, 0, 33, 0,100, 0, 0, 0,
-129, 2, 0, 0, 0, 0, 33, 0, 27, 1, 0, 0,146, 1, 0, 0, 0, 0, 35, 0,171, 0, 0, 0,146, 1, 0, 0, 0, 0, 35, 0,
-171, 0, 0, 0, 27, 1, 0, 0, 0, 0, 35, 0,146, 1, 0, 0,147, 1, 0, 0, 0, 0, 35, 0,146, 1, 0, 0,148, 1, 0, 0,
- 0, 0, 35, 0,147, 1, 0, 0,148, 1, 0, 0, 0, 0, 35, 0,165, 0, 0, 0, 26, 1, 0, 0, 0, 0, 35, 0,165, 0, 0, 0,
-148, 1, 0, 0, 0, 0, 35, 0, 26, 1, 0, 0,148, 1, 0, 0, 0, 0, 35, 0,164, 0, 0, 0,147, 1, 0, 0, 0, 0, 35, 0,
-164, 0, 0, 0,170, 0, 0, 0, 0, 0, 35, 0,170, 0, 0, 0,147, 1, 0, 0, 0, 0, 35, 0, 26, 1, 0, 0,149, 1, 0, 0,
- 0, 0, 35, 0, 28, 1, 0, 0,149, 1, 0, 0, 0, 0, 35, 0, 26, 1, 0, 0, 28, 1, 0, 0, 0, 0, 35, 0,149, 1, 0, 0,
-150, 1, 0, 0, 0, 0, 35, 0,149, 1, 0, 0,151, 1, 0, 0, 0, 0, 35, 0,150, 1, 0, 0,151, 1, 0, 0, 0, 0, 35, 0,
- 27, 1, 0, 0, 31, 1, 0, 0, 0, 0, 35, 0, 31, 1, 0, 0,151, 1, 0, 0, 0, 0, 35, 0, 27, 1, 0, 0,151, 1, 0, 0,
- 0, 0, 35, 0, 30, 1, 0, 0,150, 1, 0, 0, 0, 0, 35, 0, 29, 1, 0, 0, 30, 1, 0, 0, 0, 0, 35, 0, 29, 1, 0, 0,
-150, 1, 0, 0, 0, 0, 35, 0,168, 0, 0, 0,152, 1, 0, 0, 0, 0, 35, 0,172, 0, 0, 0,152, 1, 0, 0, 0, 0, 35, 0,
-168, 0, 0, 0,172, 0, 0, 0, 0, 0, 35, 0,152, 1, 0, 0,153, 1, 0, 0, 0, 0, 35, 0,152, 1, 0, 0,154, 1, 0, 0,
- 0, 0, 35, 0,153, 1, 0, 0,154, 1, 0, 0, 0, 0, 35, 0,169, 0, 0, 0, 30, 1, 0, 0, 0, 0, 35, 0, 30, 1, 0, 0,
-154, 1, 0, 0, 0, 0, 35, 0,169, 0, 0, 0,154, 1, 0, 0, 0, 0, 35, 0, 31, 1, 0, 0,153, 1, 0, 0, 0, 0, 35, 0,
-173, 0, 0, 0, 31, 1, 0, 0, 0, 0, 35, 0,173, 0, 0, 0,153, 1, 0, 0, 0, 0, 35, 0,167, 0, 0, 0,155, 1, 0, 0,
- 0, 0, 35, 0, 29, 1, 0, 0,155, 1, 0, 0, 0, 0, 35, 0,167, 0, 0, 0, 29, 1, 0, 0, 0, 0, 35, 0,155, 1, 0, 0,
-156, 1, 0, 0, 0, 0, 35, 0,155, 1, 0, 0,157, 1, 0, 0, 0, 0, 35, 0,156, 1, 0, 0,157, 1, 0, 0, 0, 0, 35, 0,
-162, 0, 0, 0,166, 0, 0, 0, 0, 0, 35, 0,162, 0, 0, 0,157, 1, 0, 0, 0, 0, 35, 0,166, 0, 0, 0,157, 1, 0, 0,
- 0, 0, 35, 0,163, 0, 0, 0,156, 1, 0, 0, 0, 0, 35, 0,163, 0, 0, 0, 28, 1, 0, 0, 0, 0, 35, 0, 28, 1, 0, 0,
-156, 1, 0, 0, 0, 0, 35, 0, 33, 1, 0, 0,158, 1, 0, 0, 0, 0, 35, 0,179, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 0,
-179, 0, 0, 0,158, 1, 0, 0, 0, 0, 35, 0,158, 1, 0, 0,159, 1, 0, 0, 0, 0, 35, 0,159, 1, 0, 0,160, 1, 0, 0,
- 0, 0, 35, 0,158, 1, 0, 0,160, 1, 0, 0, 0, 0, 35, 0,165, 0, 0, 0, 32, 1, 0, 0, 0, 0, 35, 0, 32, 1, 0, 0,
-160, 1, 0, 0, 0, 0, 35, 0,165, 0, 0, 0,160, 1, 0, 0, 0, 0, 35, 0,164, 0, 0, 0,159, 1, 0, 0, 0, 0, 35, 0,
-178, 0, 0, 0,159, 1, 0, 0, 0, 0, 35, 0,164, 0, 0, 0,178, 0, 0, 0, 0, 0, 35, 0, 32, 1, 0, 0,161, 1, 0, 0,
- 0, 0, 35, 0, 32, 1, 0, 0, 34, 1, 0, 0, 0, 0, 35, 0, 34, 1, 0, 0,161, 1, 0, 0, 0, 0, 35, 0,161, 1, 0, 0,
-162, 1, 0, 0, 0, 0, 35, 0,162, 1, 0, 0,163, 1, 0, 0, 0, 0, 35, 0,161, 1, 0, 0,163, 1, 0, 0, 0, 0, 35, 0,
- 33, 1, 0, 0, 37, 1, 0, 0, 0, 0, 35, 0, 33, 1, 0, 0,163, 1, 0, 0, 0, 0, 35, 0, 37, 1, 0, 0,163, 1, 0, 0,
- 0, 0, 35, 0, 36, 1, 0, 0,162, 1, 0, 0, 0, 0, 35, 0, 35, 1, 0, 0,162, 1, 0, 0, 0, 0, 35, 0, 35, 1, 0, 0,
- 36, 1, 0, 0, 0, 0, 35, 0,176, 0, 0, 0,164, 1, 0, 0, 0, 0, 35, 0,176, 0, 0, 0,180, 0, 0, 0, 0, 0, 35, 0,
-180, 0, 0, 0,164, 1, 0, 0, 0, 0, 35, 0,164, 1, 0, 0,165, 1, 0, 0, 0, 0, 35, 0,165, 1, 0, 0,166, 1, 0, 0,
- 0, 0, 35, 0,164, 1, 0, 0,166, 1, 0, 0, 0, 0, 35, 0,177, 0, 0, 0, 36, 1, 0, 0, 0, 0, 35, 0,177, 0, 0, 0,
-166, 1, 0, 0, 0, 0, 35, 0, 36, 1, 0, 0,166, 1, 0, 0, 0, 0, 35, 0, 37, 1, 0, 0,165, 1, 0, 0, 0, 0, 35, 0,
-181, 0, 0, 0,165, 1, 0, 0, 0, 0, 35, 0,181, 0, 0, 0, 37, 1, 0, 0, 0, 0, 35, 0,175, 0, 0, 0,167, 1, 0, 0,
- 0, 0, 35, 0,175, 0, 0, 0, 35, 1, 0, 0, 0, 0, 35, 0, 35, 1, 0, 0,167, 1, 0, 0, 0, 0, 35, 0,167, 1, 0, 0,
-168, 1, 0, 0, 0, 0, 35, 0,168, 1, 0, 0,169, 1, 0, 0, 0, 0, 35, 0,167, 1, 0, 0,169, 1, 0, 0, 0, 0, 35, 0,
-162, 0, 0, 0,174, 0, 0, 0, 0, 0, 35, 0,174, 0, 0, 0,169, 1, 0, 0, 0, 0, 35, 0,162, 0, 0, 0,169, 1, 0, 0,
- 0, 0, 35, 0,163, 0, 0, 0,168, 1, 0, 0, 0, 0, 35, 0, 34, 1, 0, 0,168, 1, 0, 0, 0, 0, 35, 0,163, 0, 0, 0,
- 34, 1, 0, 0, 0, 0, 35, 0, 39, 1, 0, 0,170, 1, 0, 0, 0, 0, 35, 0,187, 0, 0, 0,170, 1, 0, 0, 0, 0, 35, 0,
-187, 0, 0, 0, 39, 1, 0, 0, 0, 0, 35, 0,170, 1, 0, 0,171, 1, 0, 0, 0, 0, 35, 0,170, 1, 0, 0,172, 1, 0, 0,
- 0, 0, 35, 0,171, 1, 0, 0,172, 1, 0, 0, 0, 0, 35, 0,169, 0, 0, 0, 38, 1, 0, 0, 0, 0, 35, 0,169, 0, 0, 0,
-172, 1, 0, 0, 0, 0, 35, 0, 38, 1, 0, 0,172, 1, 0, 0, 0, 0, 35, 0,168, 0, 0, 0,171, 1, 0, 0, 0, 0, 35, 0,
-168, 0, 0, 0,186, 0, 0, 0, 0, 0, 35, 0,186, 0, 0, 0,171, 1, 0, 0, 0, 0, 35, 0, 38, 1, 0, 0,173, 1, 0, 0,
- 0, 0, 35, 0, 40, 1, 0, 0,173, 1, 0, 0, 0, 0, 35, 0, 38, 1, 0, 0, 40, 1, 0, 0, 0, 0, 35, 0,173, 1, 0, 0,
-174, 1, 0, 0, 0, 0, 35, 0,173, 1, 0, 0,175, 1, 0, 0, 0, 0, 35, 0,174, 1, 0, 0,175, 1, 0, 0, 0, 0, 35, 0,
- 39, 1, 0, 0, 43, 1, 0, 0, 0, 0, 35, 0, 43, 1, 0, 0,175, 1, 0, 0, 0, 0, 35, 0, 39, 1, 0, 0,175, 1, 0, 0,
- 0, 0, 35, 0, 42, 1, 0, 0,174, 1, 0, 0, 0, 0, 35, 0, 41, 1, 0, 0, 42, 1, 0, 0, 0, 0, 35, 0, 41, 1, 0, 0,
-174, 1, 0, 0, 0, 0, 35, 0,184, 0, 0, 0,176, 1, 0, 0, 0, 0, 35, 0,188, 0, 0, 0,176, 1, 0, 0, 0, 0, 35, 0,
-184, 0, 0, 0,188, 0, 0, 0, 0, 0, 35, 0,176, 1, 0, 0,177, 1, 0, 0, 0, 0, 35, 0,176, 1, 0, 0,178, 1, 0, 0,
- 0, 0, 35, 0,177, 1, 0, 0,178, 1, 0, 0, 0, 0, 35, 0,185, 0, 0, 0, 42, 1, 0, 0, 0, 0, 35, 0, 42, 1, 0, 0,
-178, 1, 0, 0, 0, 0, 35, 0,185, 0, 0, 0,178, 1, 0, 0, 0, 0, 35, 0, 43, 1, 0, 0,177, 1, 0, 0, 0, 0, 35, 0,
-189, 0, 0, 0, 43, 1, 0, 0, 0, 0, 35, 0,189, 0, 0, 0,177, 1, 0, 0, 0, 0, 35, 0,183, 0, 0, 0,179, 1, 0, 0,
- 0, 0, 35, 0, 41, 1, 0, 0,179, 1, 0, 0, 0, 0, 35, 0,183, 0, 0, 0, 41, 1, 0, 0, 0, 0, 35, 0,179, 1, 0, 0,
-180, 1, 0, 0, 0, 0, 35, 0,179, 1, 0, 0,181, 1, 0, 0, 0, 0, 35, 0,180, 1, 0, 0,181, 1, 0, 0, 0, 0, 35, 0,
-166, 0, 0, 0,182, 0, 0, 0, 0, 0, 35, 0,166, 0, 0, 0,181, 1, 0, 0, 0, 0, 35, 0,182, 0, 0, 0,181, 1, 0, 0,
- 0, 0, 35, 0,167, 0, 0, 0,180, 1, 0, 0, 0, 0, 35, 0,167, 0, 0, 0, 40, 1, 0, 0, 0, 0, 35, 0, 40, 1, 0, 0,
-180, 1, 0, 0, 0, 0, 35, 0, 45, 1, 0, 0,182, 1, 0, 0, 0, 0, 35, 0,195, 0, 0, 0,182, 1, 0, 0, 0, 0, 35, 0,
-195, 0, 0, 0, 45, 1, 0, 0, 0, 0, 35, 0,182, 1, 0, 0,183, 1, 0, 0, 0, 0, 35, 0,182, 1, 0, 0,184, 1, 0, 0,
- 0, 0, 35, 0,183, 1, 0, 0,184, 1, 0, 0, 0, 0, 35, 0,185, 0, 0, 0, 44, 1, 0, 0, 0, 0, 35, 0,185, 0, 0, 0,
-184, 1, 0, 0, 0, 0, 35, 0, 44, 1, 0, 0,184, 1, 0, 0, 0, 0, 35, 0,184, 0, 0, 0,183, 1, 0, 0, 0, 0, 35, 0,
-184, 0, 0, 0,194, 0, 0, 0, 0, 0, 35, 0,194, 0, 0, 0,183, 1, 0, 0, 0, 0, 35, 0, 44, 1, 0, 0,185, 1, 0, 0,
- 0, 0, 35, 0, 46, 1, 0, 0,185, 1, 0, 0, 0, 0, 35, 0, 44, 1, 0, 0, 46, 1, 0, 0, 0, 0, 35, 0,185, 1, 0, 0,
-186, 1, 0, 0, 0, 0, 35, 0,185, 1, 0, 0,187, 1, 0, 0, 0, 0, 35, 0,186, 1, 0, 0,187, 1, 0, 0, 0, 0, 35, 0,
- 45, 1, 0, 0, 49, 1, 0, 0, 0, 0, 35, 0, 49, 1, 0, 0,187, 1, 0, 0, 0, 0, 35, 0, 45, 1, 0, 0,187, 1, 0, 0,
- 0, 0, 35, 0, 48, 1, 0, 0,186, 1, 0, 0, 0, 0, 35, 0, 47, 1, 0, 0, 48, 1, 0, 0, 0, 0, 35, 0, 47, 1, 0, 0,
-186, 1, 0, 0, 0, 0, 35, 0,192, 0, 0, 0,188, 1, 0, 0, 0, 0, 35, 0,196, 0, 0, 0,188, 1, 0, 0, 0, 0, 35, 0,
-192, 0, 0, 0,196, 0, 0, 0, 0, 0, 35, 0,188, 1, 0, 0,189, 1, 0, 0, 0, 0, 35, 0,188, 1, 0, 0,190, 1, 0, 0,
- 0, 0, 35, 0,189, 1, 0, 0,190, 1, 0, 0, 0, 0, 35, 0,193, 0, 0, 0, 48, 1, 0, 0, 0, 0, 35, 0, 48, 1, 0, 0,
-190, 1, 0, 0, 0, 0, 35, 0,193, 0, 0, 0,190, 1, 0, 0, 0, 0, 35, 0, 49, 1, 0, 0,189, 1, 0, 0, 0, 0, 35, 0,
-197, 0, 0, 0, 49, 1, 0, 0, 0, 0, 35, 0,197, 0, 0, 0,189, 1, 0, 0, 0, 0, 35, 0,191, 0, 0, 0,191, 1, 0, 0,
- 0, 0, 35, 0, 47, 1, 0, 0,191, 1, 0, 0, 0, 0, 35, 0,191, 0, 0, 0, 47, 1, 0, 0, 0, 0, 35, 0,191, 1, 0, 0,
-192, 1, 0, 0, 0, 0, 35, 0,191, 1, 0, 0,193, 1, 0, 0, 0, 0, 35, 0,192, 1, 0, 0,193, 1, 0, 0, 0, 0, 35, 0,
-182, 0, 0, 0,190, 0, 0, 0, 0, 0, 35, 0,182, 0, 0, 0,193, 1, 0, 0, 0, 0, 35, 0,190, 0, 0, 0,193, 1, 0, 0,
- 0, 0, 35, 0,183, 0, 0, 0,192, 1, 0, 0, 0, 0, 35, 0,183, 0, 0, 0, 46, 1, 0, 0, 0, 0, 35, 0, 46, 1, 0, 0,
-192, 1, 0, 0, 0, 0, 35, 0, 51, 1, 0, 0,194, 1, 0, 0, 0, 0, 35, 0,199, 0, 0, 0,194, 1, 0, 0, 0, 0, 35, 0,
-199, 0, 0, 0, 51, 1, 0, 0, 0, 0, 35, 0,194, 1, 0, 0,195, 1, 0, 0, 0, 0, 35, 0,194, 1, 0, 0,196, 1, 0, 0,
- 0, 0, 35, 0,195, 1, 0, 0,196, 1, 0, 0, 0, 0, 35, 0,193, 0, 0, 0, 50, 1, 0, 0, 0, 0, 35, 0,193, 0, 0, 0,
-196, 1, 0, 0, 0, 0, 35, 0, 50, 1, 0, 0,196, 1, 0, 0, 0, 0, 35, 0,192, 0, 0, 0,195, 1, 0, 0, 0, 0, 35, 0,
-192, 0, 0, 0,198, 0, 0, 0, 0, 0, 35, 0,198, 0, 0, 0,195, 1, 0, 0, 0, 0, 35, 0, 50, 1, 0, 0,197, 1, 0, 0,
- 0, 0, 35, 0, 53, 1, 0, 0,197, 1, 0, 0, 0, 0, 35, 0, 50, 1, 0, 0, 53, 1, 0, 0, 0, 0, 35, 0,197, 1, 0, 0,
-198, 1, 0, 0, 0, 0, 35, 0,197, 1, 0, 0,199, 1, 0, 0, 0, 0, 35, 0,198, 1, 0, 0,199, 1, 0, 0, 0, 0, 35, 0,
- 51, 1, 0, 0, 55, 1, 0, 0, 0, 0, 35, 0, 55, 1, 0, 0,199, 1, 0, 0, 0, 0, 35, 0, 51, 1, 0, 0,199, 1, 0, 0,
- 0, 0, 35, 0, 54, 1, 0, 0,198, 1, 0, 0, 0, 0, 35, 0, 52, 1, 0, 0, 54, 1, 0, 0, 0, 0, 35, 0, 52, 1, 0, 0,
-198, 1, 0, 0, 0, 0, 35, 0,176, 0, 0, 0,200, 1, 0, 0, 0, 0, 35, 0,200, 0, 0, 0,200, 1, 0, 0, 0, 0, 35, 0,
-176, 0, 0, 0,200, 0, 0, 0, 0, 0, 35, 0,200, 1, 0, 0,201, 1, 0, 0, 0, 0, 35, 0,200, 1, 0, 0,202, 1, 0, 0,
- 0, 0, 35, 0,201, 1, 0, 0,202, 1, 0, 0, 0, 0, 35, 0,177, 0, 0, 0, 54, 1, 0, 0, 0, 0, 35, 0, 54, 1, 0, 0,
-202, 1, 0, 0, 0, 0, 35, 0,177, 0, 0, 0,202, 1, 0, 0, 0, 0, 35, 0, 55, 1, 0, 0,201, 1, 0, 0, 0, 0, 35, 0,
-201, 0, 0, 0, 55, 1, 0, 0, 0, 0, 35, 0,201, 0, 0, 0,201, 1, 0, 0, 0, 0, 35, 0,175, 0, 0, 0,203, 1, 0, 0,
- 0, 0, 35, 0, 52, 1, 0, 0,203, 1, 0, 0, 0, 0, 35, 0,175, 0, 0, 0, 52, 1, 0, 0, 0, 0, 35, 0,203, 1, 0, 0,
-204, 1, 0, 0, 0, 0, 35, 0,203, 1, 0, 0,205, 1, 0, 0, 0, 0, 35, 0,204, 1, 0, 0,205, 1, 0, 0, 0, 0, 35, 0,
-174, 0, 0, 0,190, 0, 0, 0, 0, 0, 35, 0,190, 0, 0, 0,205, 1, 0, 0, 0, 0, 35, 0,174, 0, 0, 0,205, 1, 0, 0,
- 0, 0, 35, 0,191, 0, 0, 0,204, 1, 0, 0, 0, 0, 35, 0,191, 0, 0, 0, 53, 1, 0, 0, 0, 0, 35, 0, 53, 1, 0, 0,
-204, 1, 0, 0, 0, 0, 35, 0, 57, 1, 0, 0,206, 1, 0, 0, 0, 0, 35, 0,207, 0, 0, 0, 57, 1, 0, 0, 0, 0, 35, 0,
-207, 0, 0, 0,206, 1, 0, 0, 0, 0, 35, 0,206, 1, 0, 0,207, 1, 0, 0, 0, 0, 35, 0,207, 1, 0, 0,208, 1, 0, 0,
- 0, 0, 35, 0,206, 1, 0, 0,208, 1, 0, 0, 0, 0, 35, 0,179, 0, 0, 0, 56, 1, 0, 0, 0, 0, 35, 0, 56, 1, 0, 0,
-208, 1, 0, 0, 0, 0, 35, 0,179, 0, 0, 0,208, 1, 0, 0, 0, 0, 35, 0,178, 0, 0, 0,207, 1, 0, 0, 0, 0, 35, 0,
-206, 0, 0, 0,207, 1, 0, 0, 0, 0, 35, 0,178, 0, 0, 0,206, 0, 0, 0, 0, 0, 35, 0, 56, 1, 0, 0,209, 1, 0, 0,
- 0, 0, 35, 0, 56, 1, 0, 0, 58, 1, 0, 0, 0, 0, 35, 0, 58, 1, 0, 0,209, 1, 0, 0, 0, 0, 35, 0,209, 1, 0, 0,
-210, 1, 0, 0, 0, 0, 35, 0,210, 1, 0, 0,211, 1, 0, 0, 0, 0, 35, 0,209, 1, 0, 0,211, 1, 0, 0, 0, 0, 35, 0,
- 57, 1, 0, 0, 61, 1, 0, 0, 0, 0, 35, 0, 57, 1, 0, 0,211, 1, 0, 0, 0, 0, 35, 0, 61, 1, 0, 0,211, 1, 0, 0,
- 0, 0, 35, 0, 60, 1, 0, 0,210, 1, 0, 0, 0, 0, 35, 0, 59, 1, 0, 0,210, 1, 0, 0, 0, 0, 35, 0, 59, 1, 0, 0,
- 60, 1, 0, 0, 0, 0, 35, 0,204, 0, 0, 0,212, 1, 0, 0, 0, 0, 35, 0,204, 0, 0, 0,208, 0, 0, 0, 0, 0, 35, 0,
-208, 0, 0, 0,212, 1, 0, 0, 0, 0, 35, 0,212, 1, 0, 0,213, 1, 0, 0, 0, 0, 35, 0,213, 1, 0, 0,214, 1, 0, 0,
- 0, 0, 35, 0,212, 1, 0, 0,214, 1, 0, 0, 0, 0, 35, 0,205, 0, 0, 0, 60, 1, 0, 0, 0, 0, 35, 0,205, 0, 0, 0,
-214, 1, 0, 0, 0, 0, 35, 0, 60, 1, 0, 0,214, 1, 0, 0, 0, 0, 35, 0, 61, 1, 0, 0,213, 1, 0, 0, 0, 0, 35, 0,
-209, 0, 0, 0,213, 1, 0, 0, 0, 0, 35, 0,209, 0, 0, 0, 61, 1, 0, 0, 0, 0, 35, 0,203, 0, 0, 0,215, 1, 0, 0,
- 0, 0, 35, 0,203, 0, 0, 0, 59, 1, 0, 0, 0, 0, 35, 0, 59, 1, 0, 0,215, 1, 0, 0, 0, 0, 35, 0,215, 1, 0, 0,
-216, 1, 0, 0, 0, 0, 35, 0,216, 1, 0, 0,217, 1, 0, 0, 0, 0, 35, 0,215, 1, 0, 0,217, 1, 0, 0, 0, 0, 35, 0,
-180, 0, 0, 0,202, 0, 0, 0, 0, 0, 35, 0,202, 0, 0, 0,217, 1, 0, 0, 0, 0, 35, 0,180, 0, 0, 0,217, 1, 0, 0,
- 0, 0, 35, 0,181, 0, 0, 0,216, 1, 0, 0, 0, 0, 35, 0, 58, 1, 0, 0,216, 1, 0, 0, 0, 0, 35, 0,181, 0, 0, 0,
- 58, 1, 0, 0, 0, 0, 35, 0, 63, 1, 0, 0,218, 1, 0, 0, 0, 0, 35, 0,215, 0, 0, 0, 63, 1, 0, 0, 0, 0, 35, 0,
-215, 0, 0, 0,218, 1, 0, 0, 0, 0, 35, 0,218, 1, 0, 0,219, 1, 0, 0, 0, 0, 35, 0,219, 1, 0, 0,220, 1, 0, 0,
- 0, 0, 35, 0,218, 1, 0, 0,220, 1, 0, 0, 0, 0, 35, 0,173, 0, 0, 0, 62, 1, 0, 0, 0, 0, 35, 0, 62, 1, 0, 0,
-220, 1, 0, 0, 0, 0, 35, 0,173, 0, 0, 0,220, 1, 0, 0, 0, 0, 35, 0,172, 0, 0, 0,219, 1, 0, 0, 0, 0, 35, 0,
-214, 0, 0, 0,219, 1, 0, 0, 0, 0, 35, 0,172, 0, 0, 0,214, 0, 0, 0, 0, 0, 35, 0, 62, 1, 0, 0,221, 1, 0, 0,
- 0, 0, 35, 0, 62, 1, 0, 0, 64, 1, 0, 0, 0, 0, 35, 0, 64, 1, 0, 0,221, 1, 0, 0, 0, 0, 35, 0,221, 1, 0, 0,
-222, 1, 0, 0, 0, 0, 35, 0,222, 1, 0, 0,223, 1, 0, 0, 0, 0, 35, 0,221, 1, 0, 0,223, 1, 0, 0, 0, 0, 35, 0,
- 63, 1, 0, 0, 67, 1, 0, 0, 0, 0, 35, 0, 63, 1, 0, 0,223, 1, 0, 0, 0, 0, 35, 0, 67, 1, 0, 0,223, 1, 0, 0,
- 0, 0, 35, 0, 66, 1, 0, 0,222, 1, 0, 0, 0, 0, 35, 0, 65, 1, 0, 0,222, 1, 0, 0, 0, 0, 35, 0, 65, 1, 0, 0,
- 66, 1, 0, 0, 0, 0, 35, 0,212, 0, 0, 0,224, 1, 0, 0, 0, 0, 35, 0,212, 0, 0, 0,216, 0, 0, 0, 0, 0, 35, 0,
-216, 0, 0, 0,224, 1, 0, 0, 0, 0, 35, 0,224, 1, 0, 0,225, 1, 0, 0, 0, 0, 35, 0,225, 1, 0, 0,226, 1, 0, 0,
- 0, 0, 35, 0,224, 1, 0, 0,226, 1, 0, 0, 0, 0, 35, 0,213, 0, 0, 0, 66, 1, 0, 0, 0, 0, 35, 0,213, 0, 0, 0,
-226, 1, 0, 0, 0, 0, 35, 0, 66, 1, 0, 0,226, 1, 0, 0, 0, 0, 35, 0, 67, 1, 0, 0,225, 1, 0, 0, 0, 0, 35, 0,
-217, 0, 0, 0,225, 1, 0, 0, 0, 0, 35, 0,217, 0, 0, 0, 67, 1, 0, 0, 0, 0, 35, 0,211, 0, 0, 0,227, 1, 0, 0,
- 0, 0, 35, 0,211, 0, 0, 0, 65, 1, 0, 0, 0, 0, 35, 0, 65, 1, 0, 0,227, 1, 0, 0, 0, 0, 35, 0,227, 1, 0, 0,
-228, 1, 0, 0, 0, 0, 35, 0,228, 1, 0, 0,229, 1, 0, 0, 0, 0, 35, 0,227, 1, 0, 0,229, 1, 0, 0, 0, 0, 35, 0,
-170, 0, 0, 0,210, 0, 0, 0, 0, 0, 35, 0,210, 0, 0, 0,229, 1, 0, 0, 0, 0, 35, 0,170, 0, 0, 0,229, 1, 0, 0,
- 0, 0, 35, 0,171, 0, 0, 0,228, 1, 0, 0, 0, 0, 35, 0, 64, 1, 0, 0,228, 1, 0, 0, 0, 0, 35, 0,171, 0, 0, 0,
- 64, 1, 0, 0, 0, 0, 35, 0, 69, 1, 0, 0,230, 1, 0, 0, 0, 0, 35, 0,223, 0, 0, 0, 69, 1, 0, 0, 0, 0, 35, 0,
-223, 0, 0, 0,230, 1, 0, 0, 0, 0, 35, 0,230, 1, 0, 0,231, 1, 0, 0, 0, 0, 35, 0,231, 1, 0, 0,232, 1, 0, 0,
- 0, 0, 35, 0,230, 1, 0, 0,232, 1, 0, 0, 0, 0, 35, 0,189, 0, 0, 0, 68, 1, 0, 0, 0, 0, 35, 0, 68, 1, 0, 0,
-232, 1, 0, 0, 0, 0, 35, 0,189, 0, 0, 0,232, 1, 0, 0, 0, 0, 35, 0,188, 0, 0, 0,231, 1, 0, 0, 0, 0, 35, 0,
-222, 0, 0, 0,231, 1, 0, 0, 0, 0, 35, 0,188, 0, 0, 0,222, 0, 0, 0, 0, 0, 35, 0, 68, 1, 0, 0,233, 1, 0, 0,
- 0, 0, 35, 0, 68, 1, 0, 0, 70, 1, 0, 0, 0, 0, 35, 0, 70, 1, 0, 0,233, 1, 0, 0, 0, 0, 35, 0,233, 1, 0, 0,
-234, 1, 0, 0, 0, 0, 35, 0,234, 1, 0, 0,235, 1, 0, 0, 0, 0, 35, 0,233, 1, 0, 0,235, 1, 0, 0, 0, 0, 35, 0,
- 69, 1, 0, 0, 73, 1, 0, 0, 0, 0, 35, 0, 69, 1, 0, 0,235, 1, 0, 0, 0, 0, 35, 0, 73, 1, 0, 0,235, 1, 0, 0,
- 0, 0, 35, 0, 72, 1, 0, 0,234, 1, 0, 0, 0, 0, 35, 0, 71, 1, 0, 0,234, 1, 0, 0, 0, 0, 35, 0, 71, 1, 0, 0,
- 72, 1, 0, 0, 0, 0, 35, 0,220, 0, 0, 0,236, 1, 0, 0, 0, 0, 35, 0,220, 0, 0, 0,224, 0, 0, 0, 0, 0, 35, 0,
-224, 0, 0, 0,236, 1, 0, 0, 0, 0, 35, 0,236, 1, 0, 0,237, 1, 0, 0, 0, 0, 35, 0,237, 1, 0, 0,238, 1, 0, 0,
- 0, 0, 35, 0,236, 1, 0, 0,238, 1, 0, 0, 0, 0, 35, 0,221, 0, 0, 0, 72, 1, 0, 0, 0, 0, 35, 0,221, 0, 0, 0,
-238, 1, 0, 0, 0, 0, 35, 0, 72, 1, 0, 0,238, 1, 0, 0, 0, 0, 35, 0, 73, 1, 0, 0,237, 1, 0, 0, 0, 0, 35, 0,
-225, 0, 0, 0,237, 1, 0, 0, 0, 0, 35, 0,225, 0, 0, 0, 73, 1, 0, 0, 0, 0, 35, 0,219, 0, 0, 0,239, 1, 0, 0,
- 0, 0, 35, 0,219, 0, 0, 0, 71, 1, 0, 0, 0, 0, 35, 0, 71, 1, 0, 0,239, 1, 0, 0, 0, 0, 35, 0,239, 1, 0, 0,
-240, 1, 0, 0, 0, 0, 35, 0,240, 1, 0, 0,241, 1, 0, 0, 0, 0, 35, 0,239, 1, 0, 0,241, 1, 0, 0, 0, 0, 35, 0,
-186, 0, 0, 0,218, 0, 0, 0, 0, 0, 35, 0,218, 0, 0, 0,241, 1, 0, 0, 0, 0, 35, 0,186, 0, 0, 0,241, 1, 0, 0,
- 0, 0, 35, 0,187, 0, 0, 0,240, 1, 0, 0, 0, 0, 35, 0, 70, 1, 0, 0,240, 1, 0, 0, 0, 0, 35, 0,187, 0, 0, 0,
- 70, 1, 0, 0, 0, 0, 35, 0, 75, 1, 0, 0,242, 1, 0, 0, 0, 0, 35, 0,231, 0, 0, 0, 75, 1, 0, 0, 0, 0, 35, 0,
-231, 0, 0, 0,242, 1, 0, 0, 0, 0, 35, 0,242, 1, 0, 0,243, 1, 0, 0, 0, 0, 35, 0,243, 1, 0, 0,244, 1, 0, 0,
- 0, 0, 35, 0,242, 1, 0, 0,244, 1, 0, 0, 0, 0, 35, 0,197, 0, 0, 0, 74, 1, 0, 0, 0, 0, 35, 0, 74, 1, 0, 0,
-244, 1, 0, 0, 0, 0, 35, 0,197, 0, 0, 0,244, 1, 0, 0, 0, 0, 35, 0,196, 0, 0, 0,243, 1, 0, 0, 0, 0, 35, 0,
-230, 0, 0, 0,243, 1, 0, 0, 0, 0, 35, 0,196, 0, 0, 0,230, 0, 0, 0, 0, 0, 35, 0, 74, 1, 0, 0,245, 1, 0, 0,
- 0, 0, 35, 0, 74, 1, 0, 0, 76, 1, 0, 0, 0, 0, 35, 0, 76, 1, 0, 0,245, 1, 0, 0, 0, 0, 35, 0,245, 1, 0, 0,
-246, 1, 0, 0, 0, 0, 35, 0,246, 1, 0, 0,247, 1, 0, 0, 0, 0, 35, 0,245, 1, 0, 0,247, 1, 0, 0, 0, 0, 35, 0,
- 75, 1, 0, 0, 79, 1, 0, 0, 0, 0, 35, 0, 75, 1, 0, 0,247, 1, 0, 0, 0, 0, 35, 0, 79, 1, 0, 0,247, 1, 0, 0,
- 0, 0, 35, 0, 78, 1, 0, 0,246, 1, 0, 0, 0, 0, 35, 0, 77, 1, 0, 0,246, 1, 0, 0, 0, 0, 35, 0, 77, 1, 0, 0,
- 78, 1, 0, 0, 0, 0, 35, 0,228, 0, 0, 0,248, 1, 0, 0, 0, 0, 35, 0,228, 0, 0, 0,232, 0, 0, 0, 0, 0, 35, 0,
-232, 0, 0, 0,248, 1, 0, 0, 0, 0, 35, 0,248, 1, 0, 0,249, 1, 0, 0, 0, 0, 35, 0,249, 1, 0, 0,250, 1, 0, 0,
- 0, 0, 35, 0,248, 1, 0, 0,250, 1, 0, 0, 0, 0, 35, 0,229, 0, 0, 0, 78, 1, 0, 0, 0, 0, 35, 0,229, 0, 0, 0,
-250, 1, 0, 0, 0, 0, 35, 0, 78, 1, 0, 0,250, 1, 0, 0, 0, 0, 35, 0, 79, 1, 0, 0,249, 1, 0, 0, 0, 0, 35, 0,
-233, 0, 0, 0,249, 1, 0, 0, 0, 0, 35, 0,233, 0, 0, 0, 79, 1, 0, 0, 0, 0, 35, 0,227, 0, 0, 0,251, 1, 0, 0,
- 0, 0, 35, 0,227, 0, 0, 0, 77, 1, 0, 0, 0, 0, 35, 0, 77, 1, 0, 0,251, 1, 0, 0, 0, 0, 35, 0,251, 1, 0, 0,
-252, 1, 0, 0, 0, 0, 35, 0,252, 1, 0, 0,253, 1, 0, 0, 0, 0, 35, 0,251, 1, 0, 0,253, 1, 0, 0, 0, 0, 35, 0,
-194, 0, 0, 0,226, 0, 0, 0, 0, 0, 35, 0,226, 0, 0, 0,253, 1, 0, 0, 0, 0, 35, 0,194, 0, 0, 0,253, 1, 0, 0,
- 0, 0, 35, 0,195, 0, 0, 0,252, 1, 0, 0, 0, 0, 35, 0, 76, 1, 0, 0,252, 1, 0, 0, 0, 0, 35, 0,195, 0, 0, 0,
- 76, 1, 0, 0, 0, 0, 35, 0, 81, 1, 0, 0,254, 1, 0, 0, 0, 0, 35, 0,239, 0, 0, 0, 81, 1, 0, 0, 0, 0, 35, 0,
-239, 0, 0, 0,254, 1, 0, 0, 0, 0, 35, 0,254, 1, 0, 0,255, 1, 0, 0, 0, 0, 35, 0,255, 1, 0, 0, 0, 2, 0, 0,
- 0, 0, 35, 0,254, 1, 0, 0, 0, 2, 0, 0, 0, 0, 35, 0,201, 0, 0, 0, 80, 1, 0, 0, 0, 0, 35, 0, 80, 1, 0, 0,
- 0, 2, 0, 0, 0, 0, 35, 0,201, 0, 0, 0, 0, 2, 0, 0, 0, 0, 35, 0,200, 0, 0, 0,255, 1, 0, 0, 0, 0, 35, 0,
-238, 0, 0, 0,255, 1, 0, 0, 0, 0, 35, 0,200, 0, 0, 0,238, 0, 0, 0, 0, 0, 35, 0, 80, 1, 0, 0, 1, 2, 0, 0,
- 0, 0, 35, 0, 80, 1, 0, 0, 82, 1, 0, 0, 0, 0, 35, 0, 82, 1, 0, 0, 1, 2, 0, 0, 0, 0, 35, 0, 1, 2, 0, 0,
- 2, 2, 0, 0, 0, 0, 35, 0, 2, 2, 0, 0, 3, 2, 0, 0, 0, 0, 35, 0, 1, 2, 0, 0, 3, 2, 0, 0, 0, 0, 35, 0,
- 81, 1, 0, 0, 85, 1, 0, 0, 0, 0, 35, 0, 81, 1, 0, 0, 3, 2, 0, 0, 0, 0, 35, 0, 85, 1, 0, 0, 3, 2, 0, 0,
- 0, 0, 35, 0, 84, 1, 0, 0, 2, 2, 0, 0, 0, 0, 35, 0, 83, 1, 0, 0, 2, 2, 0, 0, 0, 0, 35, 0, 83, 1, 0, 0,
- 84, 1, 0, 0, 0, 0, 35, 0,236, 0, 0, 0, 4, 2, 0, 0, 0, 0, 35, 0,236, 0, 0, 0,240, 0, 0, 0, 0, 0, 35, 0,
-240, 0, 0, 0, 4, 2, 0, 0, 0, 0, 35, 0, 4, 2, 0, 0, 5, 2, 0, 0, 0, 0, 35, 0, 5, 2, 0, 0, 6, 2, 0, 0,
- 0, 0, 35, 0, 4, 2, 0, 0, 6, 2, 0, 0, 0, 0, 35, 0,237, 0, 0, 0, 84, 1, 0, 0, 0, 0, 35, 0,237, 0, 0, 0,
- 6, 2, 0, 0, 0, 0, 35, 0, 84, 1, 0, 0, 6, 2, 0, 0, 0, 0, 35, 0, 85, 1, 0, 0, 5, 2, 0, 0, 0, 0, 35, 0,
-241, 0, 0, 0, 5, 2, 0, 0, 0, 0, 35, 0,241, 0, 0, 0, 85, 1, 0, 0, 0, 0, 35, 0,235, 0, 0, 0, 7, 2, 0, 0,
- 0, 0, 35, 0,235, 0, 0, 0, 83, 1, 0, 0, 0, 0, 35, 0, 83, 1, 0, 0, 7, 2, 0, 0, 0, 0, 35, 0, 7, 2, 0, 0,
- 8, 2, 0, 0, 0, 0, 35, 0, 8, 2, 0, 0, 9, 2, 0, 0, 0, 0, 35, 0, 7, 2, 0, 0, 9, 2, 0, 0, 0, 0, 35, 0,
-198, 0, 0, 0,234, 0, 0, 0, 0, 0, 35, 0,234, 0, 0, 0, 9, 2, 0, 0, 0, 0, 35, 0,198, 0, 0, 0, 9, 2, 0, 0,
- 0, 0, 35, 0,199, 0, 0, 0, 8, 2, 0, 0, 0, 0, 35, 0, 82, 1, 0, 0, 8, 2, 0, 0, 0, 0, 35, 0,199, 0, 0, 0,
- 82, 1, 0, 0, 0, 0, 35, 0, 87, 1, 0, 0, 10, 2, 0, 0, 0, 0, 35, 0,245, 0, 0, 0, 10, 2, 0, 0, 0, 0, 35, 0,
-245, 0, 0, 0, 87, 1, 0, 0, 0, 0, 35, 0, 10, 2, 0, 0, 11, 2, 0, 0, 0, 0, 35, 0, 10, 2, 0, 0, 12, 2, 0, 0,
- 0, 0, 35, 0, 11, 2, 0, 0, 12, 2, 0, 0, 0, 0, 35, 0,209, 0, 0, 0, 86, 1, 0, 0, 0, 0, 35, 0,209, 0, 0, 0,
- 12, 2, 0, 0, 0, 0, 35, 0, 86, 1, 0, 0, 12, 2, 0, 0, 0, 0, 35, 0,208, 0, 0, 0, 11, 2, 0, 0, 0, 0, 35, 0,
-208, 0, 0, 0,244, 0, 0, 0, 0, 0, 35, 0,244, 0, 0, 0, 11, 2, 0, 0, 0, 0, 35, 0, 86, 1, 0, 0, 13, 2, 0, 0,
- 0, 0, 35, 0, 88, 1, 0, 0, 13, 2, 0, 0, 0, 0, 35, 0, 86, 1, 0, 0, 88, 1, 0, 0, 0, 0, 35, 0, 13, 2, 0, 0,
- 14, 2, 0, 0, 0, 0, 35, 0, 13, 2, 0, 0, 15, 2, 0, 0, 0, 0, 35, 0, 14, 2, 0, 0, 15, 2, 0, 0, 0, 0, 35, 0,
- 87, 1, 0, 0, 91, 1, 0, 0, 0, 0, 35, 0, 91, 1, 0, 0, 15, 2, 0, 0, 0, 0, 35, 0, 87, 1, 0, 0, 15, 2, 0, 0,
- 0, 0, 35, 0, 90, 1, 0, 0, 14, 2, 0, 0, 0, 0, 35, 0, 89, 1, 0, 0, 90, 1, 0, 0, 0, 0, 35, 0, 89, 1, 0, 0,
- 14, 2, 0, 0, 0, 0, 35, 0,212, 0, 0, 0, 16, 2, 0, 0, 0, 0, 35, 0,242, 0, 0, 0, 16, 2, 0, 0, 0, 0, 35, 0,
-212, 0, 0, 0,242, 0, 0, 0, 0, 0, 35, 0, 16, 2, 0, 0, 17, 2, 0, 0, 0, 0, 35, 0, 16, 2, 0, 0, 18, 2, 0, 0,
- 0, 0, 35, 0, 17, 2, 0, 0, 18, 2, 0, 0, 0, 0, 35, 0,213, 0, 0, 0, 90, 1, 0, 0, 0, 0, 35, 0, 90, 1, 0, 0,
- 18, 2, 0, 0, 0, 0, 35, 0,213, 0, 0, 0, 18, 2, 0, 0, 0, 0, 35, 0, 91, 1, 0, 0, 17, 2, 0, 0, 0, 0, 35, 0,
-243, 0, 0, 0, 91, 1, 0, 0, 0, 0, 35, 0,243, 0, 0, 0, 17, 2, 0, 0, 0, 0, 35, 0,211, 0, 0, 0, 19, 2, 0, 0,
- 0, 0, 35, 0, 89, 1, 0, 0, 19, 2, 0, 0, 0, 0, 35, 0,211, 0, 0, 0, 89, 1, 0, 0, 0, 0, 35, 0, 19, 2, 0, 0,
- 20, 2, 0, 0, 0, 0, 35, 0, 19, 2, 0, 0, 21, 2, 0, 0, 0, 0, 35, 0, 20, 2, 0, 0, 21, 2, 0, 0, 0, 0, 35, 0,
-206, 0, 0, 0,210, 0, 0, 0, 0, 0, 35, 0,206, 0, 0, 0, 21, 2, 0, 0, 0, 0, 35, 0,210, 0, 0, 0, 21, 2, 0, 0,
- 0, 0, 35, 0,207, 0, 0, 0, 20, 2, 0, 0, 0, 0, 35, 0,207, 0, 0, 0, 88, 1, 0, 0, 0, 0, 35, 0, 88, 1, 0, 0,
- 20, 2, 0, 0, 0, 0, 35, 0, 93, 1, 0, 0, 22, 2, 0, 0, 0, 0, 35, 0,247, 0, 0, 0, 22, 2, 0, 0, 0, 0, 35, 0,
-247, 0, 0, 0, 93, 1, 0, 0, 0, 0, 35, 0, 22, 2, 0, 0, 23, 2, 0, 0, 0, 0, 35, 0, 22, 2, 0, 0, 24, 2, 0, 0,
- 0, 0, 35, 0, 23, 2, 0, 0, 24, 2, 0, 0, 0, 0, 35, 0,217, 0, 0, 0, 92, 1, 0, 0, 0, 0, 35, 0,217, 0, 0, 0,
- 24, 2, 0, 0, 0, 0, 35, 0, 92, 1, 0, 0, 24, 2, 0, 0, 0, 0, 35, 0,216, 0, 0, 0, 23, 2, 0, 0, 0, 0, 35, 0,
-216, 0, 0, 0,246, 0, 0, 0, 0, 0, 35, 0,246, 0, 0, 0, 23, 2, 0, 0, 0, 0, 35, 0, 92, 1, 0, 0, 25, 2, 0, 0,
- 0, 0, 35, 0, 94, 1, 0, 0, 25, 2, 0, 0, 0, 0, 35, 0, 92, 1, 0, 0, 94, 1, 0, 0, 0, 0, 35, 0, 25, 2, 0, 0,
- 26, 2, 0, 0, 0, 0, 35, 0, 25, 2, 0, 0, 27, 2, 0, 0, 0, 0, 35, 0, 26, 2, 0, 0, 27, 2, 0, 0, 0, 0, 35, 0,
- 93, 1, 0, 0, 97, 1, 0, 0, 0, 0, 35, 0, 97, 1, 0, 0, 27, 2, 0, 0, 0, 0, 35, 0, 93, 1, 0, 0, 27, 2, 0, 0,
- 0, 0, 35, 0, 96, 1, 0, 0, 26, 2, 0, 0, 0, 0, 35, 0, 95, 1, 0, 0, 96, 1, 0, 0, 0, 0, 35, 0, 95, 1, 0, 0,
- 26, 2, 0, 0, 0, 0, 35, 0,220, 0, 0, 0, 28, 2, 0, 0, 0, 0, 35, 0,248, 0, 0, 0, 28, 2, 0, 0, 0, 0, 35, 0,
-220, 0, 0, 0,248, 0, 0, 0, 0, 0, 35, 0, 28, 2, 0, 0, 29, 2, 0, 0, 0, 0, 35, 0, 28, 2, 0, 0, 30, 2, 0, 0,
- 0, 0, 35, 0, 29, 2, 0, 0, 30, 2, 0, 0, 0, 0, 35, 0,221, 0, 0, 0, 96, 1, 0, 0, 0, 0, 35, 0, 96, 1, 0, 0,
- 30, 2, 0, 0, 0, 0, 35, 0,221, 0, 0, 0, 30, 2, 0, 0, 0, 0, 35, 0, 97, 1, 0, 0, 29, 2, 0, 0, 0, 0, 35, 0,
-249, 0, 0, 0, 97, 1, 0, 0, 0, 0, 35, 0,249, 0, 0, 0, 29, 2, 0, 0, 0, 0, 35, 0,219, 0, 0, 0, 31, 2, 0, 0,
- 0, 0, 35, 0, 95, 1, 0, 0, 31, 2, 0, 0, 0, 0, 35, 0,219, 0, 0, 0, 95, 1, 0, 0, 0, 0, 35, 0, 31, 2, 0, 0,
- 32, 2, 0, 0, 0, 0, 35, 0, 31, 2, 0, 0, 33, 2, 0, 0, 0, 0, 35, 0, 32, 2, 0, 0, 33, 2, 0, 0, 0, 0, 35, 0,
-214, 0, 0, 0,218, 0, 0, 0, 0, 0, 35, 0,214, 0, 0, 0, 33, 2, 0, 0, 0, 0, 35, 0,218, 0, 0, 0, 33, 2, 0, 0,
- 0, 0, 35, 0,215, 0, 0, 0, 32, 2, 0, 0, 0, 0, 35, 0,215, 0, 0, 0, 94, 1, 0, 0, 0, 0, 35, 0, 94, 1, 0, 0,
- 32, 2, 0, 0, 0, 0, 35, 0, 99, 1, 0, 0, 34, 2, 0, 0, 0, 0, 35, 0,251, 0, 0, 0, 34, 2, 0, 0, 0, 0, 35, 0,
-251, 0, 0, 0, 99, 1, 0, 0, 0, 0, 35, 0, 34, 2, 0, 0, 35, 2, 0, 0, 0, 0, 35, 0, 34, 2, 0, 0, 36, 2, 0, 0,
- 0, 0, 35, 0, 35, 2, 0, 0, 36, 2, 0, 0, 0, 0, 35, 0,225, 0, 0, 0, 98, 1, 0, 0, 0, 0, 35, 0,225, 0, 0, 0,
- 36, 2, 0, 0, 0, 0, 35, 0, 98, 1, 0, 0, 36, 2, 0, 0, 0, 0, 35, 0,224, 0, 0, 0, 35, 2, 0, 0, 0, 0, 35, 0,
-224, 0, 0, 0,250, 0, 0, 0, 0, 0, 35, 0,250, 0, 0, 0, 35, 2, 0, 0, 0, 0, 35, 0, 98, 1, 0, 0, 37, 2, 0, 0,
- 0, 0, 35, 0,100, 1, 0, 0, 37, 2, 0, 0, 0, 0, 35, 0, 98, 1, 0, 0,100, 1, 0, 0, 0, 0, 35, 0, 37, 2, 0, 0,
- 38, 2, 0, 0, 0, 0, 35, 0, 37, 2, 0, 0, 39, 2, 0, 0, 0, 0, 35, 0, 38, 2, 0, 0, 39, 2, 0, 0, 0, 0, 35, 0,
- 99, 1, 0, 0,103, 1, 0, 0, 0, 0, 35, 0,103, 1, 0, 0, 39, 2, 0, 0, 0, 0, 35, 0, 99, 1, 0, 0, 39, 2, 0, 0,
- 0, 0, 35, 0,102, 1, 0, 0, 38, 2, 0, 0, 0, 0, 35, 0,101, 1, 0, 0,102, 1, 0, 0, 0, 0, 35, 0,101, 1, 0, 0,
- 38, 2, 0, 0, 0, 0, 35, 0,228, 0, 0, 0, 40, 2, 0, 0, 0, 0, 35, 0,252, 0, 0, 0, 40, 2, 0, 0, 0, 0, 35, 0,
-228, 0, 0, 0,252, 0, 0, 0, 0, 0, 35, 0, 40, 2, 0, 0, 41, 2, 0, 0, 0, 0, 35, 0, 40, 2, 0, 0, 42, 2, 0, 0,
- 0, 0, 35, 0, 41, 2, 0, 0, 42, 2, 0, 0, 0, 0, 35, 0,229, 0, 0, 0,102, 1, 0, 0, 0, 0, 35, 0,102, 1, 0, 0,
- 42, 2, 0, 0, 0, 0, 35, 0,229, 0, 0, 0, 42, 2, 0, 0, 0, 0, 35, 0,103, 1, 0, 0, 41, 2, 0, 0, 0, 0, 35, 0,
-253, 0, 0, 0,103, 1, 0, 0, 0, 0, 35, 0,253, 0, 0, 0, 41, 2, 0, 0, 0, 0, 35, 0,227, 0, 0, 0, 43, 2, 0, 0,
- 0, 0, 35, 0,101, 1, 0, 0, 43, 2, 0, 0, 0, 0, 35, 0,227, 0, 0, 0,101, 1, 0, 0, 0, 0, 35, 0, 43, 2, 0, 0,
- 44, 2, 0, 0, 0, 0, 35, 0, 43, 2, 0, 0, 45, 2, 0, 0, 0, 0, 35, 0, 44, 2, 0, 0, 45, 2, 0, 0, 0, 0, 35, 0,
-222, 0, 0, 0,226, 0, 0, 0, 0, 0, 35, 0,222, 0, 0, 0, 45, 2, 0, 0, 0, 0, 35, 0,226, 0, 0, 0, 45, 2, 0, 0,
- 0, 0, 35, 0,223, 0, 0, 0, 44, 2, 0, 0, 0, 0, 35, 0,223, 0, 0, 0,100, 1, 0, 0, 0, 0, 35, 0,100, 1, 0, 0,
- 44, 2, 0, 0, 0, 0, 35, 0,105, 1, 0, 0, 46, 2, 0, 0, 0, 0, 35, 0,255, 0, 0, 0, 46, 2, 0, 0, 0, 0, 35, 0,
-255, 0, 0, 0,105, 1, 0, 0, 0, 0, 35, 0, 46, 2, 0, 0, 47, 2, 0, 0, 0, 0, 35, 0, 46, 2, 0, 0, 48, 2, 0, 0,
- 0, 0, 35, 0, 47, 2, 0, 0, 48, 2, 0, 0, 0, 0, 35, 0,233, 0, 0, 0,104, 1, 0, 0, 0, 0, 35, 0,233, 0, 0, 0,
- 48, 2, 0, 0, 0, 0, 35, 0,104, 1, 0, 0, 48, 2, 0, 0, 0, 0, 35, 0,232, 0, 0, 0, 47, 2, 0, 0, 0, 0, 35, 0,
-232, 0, 0, 0,254, 0, 0, 0, 0, 0, 35, 0,254, 0, 0, 0, 47, 2, 0, 0, 0, 0, 35, 0,104, 1, 0, 0, 49, 2, 0, 0,
- 0, 0, 35, 0,106, 1, 0, 0, 49, 2, 0, 0, 0, 0, 35, 0,104, 1, 0, 0,106, 1, 0, 0, 0, 0, 35, 0, 49, 2, 0, 0,
- 50, 2, 0, 0, 0, 0, 35, 0, 49, 2, 0, 0, 51, 2, 0, 0, 0, 0, 35, 0, 50, 2, 0, 0, 51, 2, 0, 0, 0, 0, 35, 0,
-105, 1, 0, 0,109, 1, 0, 0, 0, 0, 35, 0,109, 1, 0, 0, 51, 2, 0, 0, 0, 0, 35, 0,105, 1, 0, 0, 51, 2, 0, 0,
- 0, 0, 35, 0,108, 1, 0, 0, 50, 2, 0, 0, 0, 0, 35, 0,107, 1, 0, 0,108, 1, 0, 0, 0, 0, 35, 0,107, 1, 0, 0,
- 50, 2, 0, 0, 0, 0, 35, 0,236, 0, 0, 0, 52, 2, 0, 0, 0, 0, 35, 0, 0, 1, 0, 0, 52, 2, 0, 0, 0, 0, 35, 0,
-236, 0, 0, 0, 0, 1, 0, 0, 0, 0, 35, 0, 52, 2, 0, 0, 53, 2, 0, 0, 0, 0, 35, 0, 52, 2, 0, 0, 54, 2, 0, 0,
- 0, 0, 35, 0, 53, 2, 0, 0, 54, 2, 0, 0, 0, 0, 35, 0,237, 0, 0, 0,108, 1, 0, 0, 0, 0, 35, 0,108, 1, 0, 0,
- 54, 2, 0, 0, 0, 0, 35, 0,237, 0, 0, 0, 54, 2, 0, 0, 0, 0, 35, 0,109, 1, 0, 0, 53, 2, 0, 0, 0, 0, 35, 0,
- 1, 1, 0, 0,109, 1, 0, 0, 0, 0, 35, 0, 1, 1, 0, 0, 53, 2, 0, 0, 0, 0, 35, 0,235, 0, 0, 0, 55, 2, 0, 0,
- 0, 0, 35, 0,107, 1, 0, 0, 55, 2, 0, 0, 0, 0, 35, 0,235, 0, 0, 0,107, 1, 0, 0, 0, 0, 35, 0, 55, 2, 0, 0,
- 56, 2, 0, 0, 0, 0, 35, 0, 55, 2, 0, 0, 57, 2, 0, 0, 0, 0, 35, 0, 56, 2, 0, 0, 57, 2, 0, 0, 0, 0, 35, 0,
-230, 0, 0, 0,234, 0, 0, 0, 0, 0, 35, 0,230, 0, 0, 0, 57, 2, 0, 0, 0, 0, 35, 0,234, 0, 0, 0, 57, 2, 0, 0,
- 0, 0, 35, 0,231, 0, 0, 0, 56, 2, 0, 0, 0, 0, 35, 0,231, 0, 0, 0,106, 1, 0, 0, 0, 0, 35, 0,106, 1, 0, 0,
- 56, 2, 0, 0, 0, 0, 35, 0,111, 1, 0, 0, 58, 2, 0, 0, 0, 0, 35, 0, 3, 1, 0, 0, 58, 2, 0, 0, 0, 0, 35, 0,
- 3, 1, 0, 0,111, 1, 0, 0, 0, 0, 35, 0, 58, 2, 0, 0, 59, 2, 0, 0, 0, 0, 35, 0, 58, 2, 0, 0, 60, 2, 0, 0,
- 0, 0, 35, 0, 59, 2, 0, 0, 60, 2, 0, 0, 0, 0, 35, 0,241, 0, 0, 0,110, 1, 0, 0, 0, 0, 35, 0,241, 0, 0, 0,
- 60, 2, 0, 0, 0, 0, 35, 0,110, 1, 0, 0, 60, 2, 0, 0, 0, 0, 35, 0,240, 0, 0, 0, 59, 2, 0, 0, 0, 0, 35, 0,
-240, 0, 0, 0, 2, 1, 0, 0, 0, 0, 35, 0, 2, 1, 0, 0, 59, 2, 0, 0, 0, 0, 35, 0,110, 1, 0, 0, 61, 2, 0, 0,
- 0, 0, 35, 0,113, 1, 0, 0, 61, 2, 0, 0, 0, 0, 35, 0,110, 1, 0, 0,113, 1, 0, 0, 0, 0, 35, 0, 61, 2, 0, 0,
- 62, 2, 0, 0, 0, 0, 35, 0, 61, 2, 0, 0, 63, 2, 0, 0, 0, 0, 35, 0, 62, 2, 0, 0, 63, 2, 0, 0, 0, 0, 35, 0,
-111, 1, 0, 0,115, 1, 0, 0, 0, 0, 35, 0,115, 1, 0, 0, 63, 2, 0, 0, 0, 0, 35, 0,111, 1, 0, 0, 63, 2, 0, 0,
- 0, 0, 35, 0,114, 1, 0, 0, 62, 2, 0, 0, 0, 0, 35, 0,112, 1, 0, 0,114, 1, 0, 0, 0, 0, 35, 0,112, 1, 0, 0,
- 62, 2, 0, 0, 0, 0, 35, 0,204, 0, 0, 0, 64, 2, 0, 0, 0, 0, 35, 0, 4, 1, 0, 0, 64, 2, 0, 0, 0, 0, 35, 0,
-204, 0, 0, 0, 4, 1, 0, 0, 0, 0, 35, 0, 64, 2, 0, 0, 65, 2, 0, 0, 0, 0, 35, 0, 64, 2, 0, 0, 66, 2, 0, 0,
- 0, 0, 35, 0, 65, 2, 0, 0, 66, 2, 0, 0, 0, 0, 35, 0,205, 0, 0, 0,114, 1, 0, 0, 0, 0, 35, 0,114, 1, 0, 0,
- 66, 2, 0, 0, 0, 0, 35, 0,205, 0, 0, 0, 66, 2, 0, 0, 0, 0, 35, 0,115, 1, 0, 0, 65, 2, 0, 0, 0, 0, 35, 0,
- 5, 1, 0, 0,115, 1, 0, 0, 0, 0, 35, 0, 5, 1, 0, 0, 65, 2, 0, 0, 0, 0, 35, 0,203, 0, 0, 0, 67, 2, 0, 0,
- 0, 0, 35, 0,112, 1, 0, 0, 67, 2, 0, 0, 0, 0, 35, 0,203, 0, 0, 0,112, 1, 0, 0, 0, 0, 35, 0, 67, 2, 0, 0,
- 68, 2, 0, 0, 0, 0, 35, 0, 67, 2, 0, 0, 69, 2, 0, 0, 0, 0, 35, 0, 68, 2, 0, 0, 69, 2, 0, 0, 0, 0, 35, 0,
-202, 0, 0, 0,238, 0, 0, 0, 0, 0, 35, 0,238, 0, 0, 0, 69, 2, 0, 0, 0, 0, 35, 0,202, 0, 0, 0, 69, 2, 0, 0,
- 0, 0, 35, 0,239, 0, 0, 0, 68, 2, 0, 0, 0, 0, 35, 0,239, 0, 0, 0,113, 1, 0, 0, 0, 0, 35, 0,113, 1, 0, 0,
- 68, 2, 0, 0, 0, 0, 35, 0,117, 1, 0, 0, 70, 2, 0, 0, 0, 0, 35, 0, 11, 1, 0, 0,117, 1, 0, 0, 0, 0, 35, 0,
- 11, 1, 0, 0, 70, 2, 0, 0, 0, 0, 35, 0, 70, 2, 0, 0, 71, 2, 0, 0, 0, 0, 35, 0, 71, 2, 0, 0, 72, 2, 0, 0,
- 0, 0, 35, 0, 70, 2, 0, 0, 72, 2, 0, 0, 0, 0, 35, 0,243, 0, 0, 0,116, 1, 0, 0, 0, 0, 35, 0,116, 1, 0, 0,
- 72, 2, 0, 0, 0, 0, 35, 0,243, 0, 0, 0, 72, 2, 0, 0, 0, 0, 35, 0,242, 0, 0, 0, 71, 2, 0, 0, 0, 0, 35, 0,
- 10, 1, 0, 0, 71, 2, 0, 0, 0, 0, 35, 0,242, 0, 0, 0, 10, 1, 0, 0, 0, 0, 35, 0,116, 1, 0, 0, 73, 2, 0, 0,
- 0, 0, 35, 0,116, 1, 0, 0,118, 1, 0, 0, 0, 0, 35, 0,118, 1, 0, 0, 73, 2, 0, 0, 0, 0, 35, 0, 73, 2, 0, 0,
- 74, 2, 0, 0, 0, 0, 35, 0, 74, 2, 0, 0, 75, 2, 0, 0, 0, 0, 35, 0, 73, 2, 0, 0, 75, 2, 0, 0, 0, 0, 35, 0,
-117, 1, 0, 0,121, 1, 0, 0, 0, 0, 35, 0,117, 1, 0, 0, 75, 2, 0, 0, 0, 0, 35, 0,121, 1, 0, 0, 75, 2, 0, 0,
- 0, 0, 35, 0,120, 1, 0, 0, 74, 2, 0, 0, 0, 0, 35, 0,119, 1, 0, 0, 74, 2, 0, 0, 0, 0, 35, 0,119, 1, 0, 0,
-120, 1, 0, 0, 0, 0, 35, 0, 8, 1, 0, 0, 76, 2, 0, 0, 0, 0, 35, 0, 8, 1, 0, 0, 12, 1, 0, 0, 0, 0, 35, 0,
- 12, 1, 0, 0, 76, 2, 0, 0, 0, 0, 35, 0, 76, 2, 0, 0, 77, 2, 0, 0, 0, 0, 35, 0, 77, 2, 0, 0, 78, 2, 0, 0,
- 0, 0, 35, 0, 76, 2, 0, 0, 78, 2, 0, 0, 0, 0, 35, 0, 9, 1, 0, 0,120, 1, 0, 0, 0, 0, 35, 0, 9, 1, 0, 0,
- 78, 2, 0, 0, 0, 0, 35, 0,120, 1, 0, 0, 78, 2, 0, 0, 0, 0, 35, 0,121, 1, 0, 0, 77, 2, 0, 0, 0, 0, 35, 0,
- 13, 1, 0, 0, 77, 2, 0, 0, 0, 0, 35, 0, 13, 1, 0, 0,121, 1, 0, 0, 0, 0, 35, 0, 7, 1, 0, 0, 79, 2, 0, 0,
- 0, 0, 35, 0, 7, 1, 0, 0,119, 1, 0, 0, 0, 0, 35, 0,119, 1, 0, 0, 79, 2, 0, 0, 0, 0, 35, 0, 79, 2, 0, 0,
- 80, 2, 0, 0, 0, 0, 35, 0, 80, 2, 0, 0, 81, 2, 0, 0, 0, 0, 35, 0, 79, 2, 0, 0, 81, 2, 0, 0, 0, 0, 35, 0,
-244, 0, 0, 0, 6, 1, 0, 0, 0, 0, 35, 0, 6, 1, 0, 0, 81, 2, 0, 0, 0, 0, 35, 0,244, 0, 0, 0, 81, 2, 0, 0,
- 0, 0, 35, 0,245, 0, 0, 0, 80, 2, 0, 0, 0, 0, 35, 0,118, 1, 0, 0, 80, 2, 0, 0, 0, 0, 35, 0,245, 0, 0, 0,
-118, 1, 0, 0, 0, 0, 35, 0,123, 1, 0, 0, 82, 2, 0, 0, 0, 0, 35, 0, 15, 1, 0, 0,123, 1, 0, 0, 0, 0, 35, 0,
- 15, 1, 0, 0, 82, 2, 0, 0, 0, 0, 35, 0, 82, 2, 0, 0, 83, 2, 0, 0, 0, 0, 35, 0, 83, 2, 0, 0, 84, 2, 0, 0,
- 0, 0, 35, 0, 82, 2, 0, 0, 84, 2, 0, 0, 0, 0, 35, 0,249, 0, 0, 0,122, 1, 0, 0, 0, 0, 35, 0,122, 1, 0, 0,
- 84, 2, 0, 0, 0, 0, 35, 0,249, 0, 0, 0, 84, 2, 0, 0, 0, 0, 35, 0,248, 0, 0, 0, 83, 2, 0, 0, 0, 0, 35, 0,
- 14, 1, 0, 0, 83, 2, 0, 0, 0, 0, 35, 0,248, 0, 0, 0, 14, 1, 0, 0, 0, 0, 35, 0,122, 1, 0, 0, 85, 2, 0, 0,
- 0, 0, 35, 0,122, 1, 0, 0,124, 1, 0, 0, 0, 0, 35, 0,124, 1, 0, 0, 85, 2, 0, 0, 0, 0, 35, 0, 85, 2, 0, 0,
- 86, 2, 0, 0, 0, 0, 35, 0, 86, 2, 0, 0, 87, 2, 0, 0, 0, 0, 35, 0, 85, 2, 0, 0, 87, 2, 0, 0, 0, 0, 35, 0,
-123, 1, 0, 0,127, 1, 0, 0, 0, 0, 35, 0,123, 1, 0, 0, 87, 2, 0, 0, 0, 0, 35, 0,127, 1, 0, 0, 87, 2, 0, 0,
- 0, 0, 35, 0,126, 1, 0, 0, 86, 2, 0, 0, 0, 0, 35, 0,125, 1, 0, 0, 86, 2, 0, 0, 0, 0, 35, 0,125, 1, 0, 0,
-126, 1, 0, 0, 0, 0, 35, 0, 12, 1, 0, 0, 88, 2, 0, 0, 0, 0, 35, 0, 12, 1, 0, 0, 16, 1, 0, 0, 0, 0, 35, 0,
- 16, 1, 0, 0, 88, 2, 0, 0, 0, 0, 35, 0, 88, 2, 0, 0, 89, 2, 0, 0, 0, 0, 35, 0, 89, 2, 0, 0, 90, 2, 0, 0,
- 0, 0, 35, 0, 88, 2, 0, 0, 90, 2, 0, 0, 0, 0, 35, 0, 13, 1, 0, 0,126, 1, 0, 0, 0, 0, 35, 0, 13, 1, 0, 0,
- 90, 2, 0, 0, 0, 0, 35, 0,126, 1, 0, 0, 90, 2, 0, 0, 0, 0, 35, 0,127, 1, 0, 0, 89, 2, 0, 0, 0, 0, 35, 0,
- 17, 1, 0, 0, 89, 2, 0, 0, 0, 0, 35, 0, 17, 1, 0, 0,127, 1, 0, 0, 0, 0, 35, 0, 11, 1, 0, 0, 91, 2, 0, 0,
- 0, 0, 35, 0, 11, 1, 0, 0,125, 1, 0, 0, 0, 0, 35, 0,125, 1, 0, 0, 91, 2, 0, 0, 0, 0, 35, 0, 91, 2, 0, 0,
- 92, 2, 0, 0, 0, 0, 35, 0, 92, 2, 0, 0, 93, 2, 0, 0, 0, 0, 35, 0, 91, 2, 0, 0, 93, 2, 0, 0, 0, 0, 35, 0,
-246, 0, 0, 0, 10, 1, 0, 0, 0, 0, 35, 0, 10, 1, 0, 0, 93, 2, 0, 0, 0, 0, 35, 0,246, 0, 0, 0, 93, 2, 0, 0,
- 0, 0, 35, 0,247, 0, 0, 0, 92, 2, 0, 0, 0, 0, 35, 0,124, 1, 0, 0, 92, 2, 0, 0, 0, 0, 35, 0,247, 0, 0, 0,
-124, 1, 0, 0, 0, 0, 35, 0,129, 1, 0, 0, 94, 2, 0, 0, 0, 0, 35, 0, 19, 1, 0, 0,129, 1, 0, 0, 0, 0, 35, 0,
- 19, 1, 0, 0, 94, 2, 0, 0, 0, 0, 35, 0, 94, 2, 0, 0, 95, 2, 0, 0, 0, 0, 35, 0, 95, 2, 0, 0, 96, 2, 0, 0,
- 0, 0, 35, 0, 94, 2, 0, 0, 96, 2, 0, 0, 0, 0, 35, 0,253, 0, 0, 0,128, 1, 0, 0, 0, 0, 35, 0,128, 1, 0, 0,
- 96, 2, 0, 0, 0, 0, 35, 0,253, 0, 0, 0, 96, 2, 0, 0, 0, 0, 35, 0,252, 0, 0, 0, 95, 2, 0, 0, 0, 0, 35, 0,
- 18, 1, 0, 0, 95, 2, 0, 0, 0, 0, 35, 0,252, 0, 0, 0, 18, 1, 0, 0, 0, 0, 35, 0,128, 1, 0, 0, 97, 2, 0, 0,
- 0, 0, 35, 0,128, 1, 0, 0,130, 1, 0, 0, 0, 0, 35, 0,130, 1, 0, 0, 97, 2, 0, 0, 0, 0, 35, 0, 97, 2, 0, 0,
- 98, 2, 0, 0, 0, 0, 35, 0, 98, 2, 0, 0, 99, 2, 0, 0, 0, 0, 35, 0, 97, 2, 0, 0, 99, 2, 0, 0, 0, 0, 35, 0,
-129, 1, 0, 0,133, 1, 0, 0, 0, 0, 35, 0,129, 1, 0, 0, 99, 2, 0, 0, 0, 0, 35, 0,133, 1, 0, 0, 99, 2, 0, 0,
- 0, 0, 35, 0,132, 1, 0, 0, 98, 2, 0, 0, 0, 0, 35, 0,131, 1, 0, 0, 98, 2, 0, 0, 0, 0, 35, 0,131, 1, 0, 0,
-132, 1, 0, 0, 0, 0, 35, 0, 16, 1, 0, 0,100, 2, 0, 0, 0, 0, 35, 0, 16, 1, 0, 0, 20, 1, 0, 0, 0, 0, 35, 0,
- 20, 1, 0, 0,100, 2, 0, 0, 0, 0, 35, 0,100, 2, 0, 0,101, 2, 0, 0, 0, 0, 35, 0,101, 2, 0, 0,102, 2, 0, 0,
- 0, 0, 35, 0,100, 2, 0, 0,102, 2, 0, 0, 0, 0, 35, 0, 17, 1, 0, 0,132, 1, 0, 0, 0, 0, 35, 0, 17, 1, 0, 0,
-102, 2, 0, 0, 0, 0, 35, 0,132, 1, 0, 0,102, 2, 0, 0, 0, 0, 35, 0,133, 1, 0, 0,101, 2, 0, 0, 0, 0, 35, 0,
- 21, 1, 0, 0,101, 2, 0, 0, 0, 0, 35, 0, 21, 1, 0, 0,133, 1, 0, 0, 0, 0, 35, 0, 15, 1, 0, 0,103, 2, 0, 0,
- 0, 0, 35, 0, 15, 1, 0, 0,131, 1, 0, 0, 0, 0, 35, 0,131, 1, 0, 0,103, 2, 0, 0, 0, 0, 35, 0,103, 2, 0, 0,
-104, 2, 0, 0, 0, 0, 35, 0,104, 2, 0, 0,105, 2, 0, 0, 0, 0, 35, 0,103, 2, 0, 0,105, 2, 0, 0, 0, 0, 35, 0,
-250, 0, 0, 0, 14, 1, 0, 0, 0, 0, 35, 0, 14, 1, 0, 0,105, 2, 0, 0, 0, 0, 35, 0,250, 0, 0, 0,105, 2, 0, 0,
- 0, 0, 35, 0,251, 0, 0, 0,104, 2, 0, 0, 0, 0, 35, 0,130, 1, 0, 0,104, 2, 0, 0, 0, 0, 35, 0,251, 0, 0, 0,
-130, 1, 0, 0, 0, 0, 35, 0,135, 1, 0, 0,106, 2, 0, 0, 0, 0, 35, 0, 23, 1, 0, 0,135, 1, 0, 0, 0, 0, 35, 0,
- 23, 1, 0, 0,106, 2, 0, 0, 0, 0, 35, 0,106, 2, 0, 0,107, 2, 0, 0, 0, 0, 35, 0,107, 2, 0, 0,108, 2, 0, 0,
- 0, 0, 35, 0,106, 2, 0, 0,108, 2, 0, 0, 0, 0, 35, 0, 1, 1, 0, 0,134, 1, 0, 0, 0, 0, 35, 0,134, 1, 0, 0,
-108, 2, 0, 0, 0, 0, 35, 0, 1, 1, 0, 0,108, 2, 0, 0, 0, 0, 35, 0, 0, 1, 0, 0,107, 2, 0, 0, 0, 0, 35, 0,
- 22, 1, 0, 0,107, 2, 0, 0, 0, 0, 35, 0, 0, 1, 0, 0, 22, 1, 0, 0, 0, 0, 35, 0,134, 1, 0, 0,109, 2, 0, 0,
- 0, 0, 35, 0,134, 1, 0, 0,136, 1, 0, 0, 0, 0, 35, 0,136, 1, 0, 0,109, 2, 0, 0, 0, 0, 35, 0,109, 2, 0, 0,
-110, 2, 0, 0, 0, 0, 35, 0,110, 2, 0, 0,111, 2, 0, 0, 0, 0, 35, 0,109, 2, 0, 0,111, 2, 0, 0, 0, 0, 35, 0,
-135, 1, 0, 0,139, 1, 0, 0, 0, 0, 35, 0,135, 1, 0, 0,111, 2, 0, 0, 0, 0, 35, 0,139, 1, 0, 0,111, 2, 0, 0,
- 0, 0, 35, 0,138, 1, 0, 0,110, 2, 0, 0, 0, 0, 35, 0,137, 1, 0, 0,110, 2, 0, 0, 0, 0, 35, 0,137, 1, 0, 0,
-138, 1, 0, 0, 0, 0, 35, 0, 20, 1, 0, 0,112, 2, 0, 0, 0, 0, 35, 0, 20, 1, 0, 0, 24, 1, 0, 0, 0, 0, 35, 0,
- 24, 1, 0, 0,112, 2, 0, 0, 0, 0, 35, 0,112, 2, 0, 0,113, 2, 0, 0, 0, 0, 35, 0,113, 2, 0, 0,114, 2, 0, 0,
- 0, 0, 35, 0,112, 2, 0, 0,114, 2, 0, 0, 0, 0, 35, 0, 21, 1, 0, 0,138, 1, 0, 0, 0, 0, 35, 0, 21, 1, 0, 0,
-114, 2, 0, 0, 0, 0, 35, 0,138, 1, 0, 0,114, 2, 0, 0, 0, 0, 35, 0,139, 1, 0, 0,113, 2, 0, 0, 0, 0, 35, 0,
- 25, 1, 0, 0,113, 2, 0, 0, 0, 0, 35, 0, 25, 1, 0, 0,139, 1, 0, 0, 0, 0, 35, 0, 19, 1, 0, 0,115, 2, 0, 0,
- 0, 0, 35, 0, 19, 1, 0, 0,137, 1, 0, 0, 0, 0, 35, 0,137, 1, 0, 0,115, 2, 0, 0, 0, 0, 35, 0,115, 2, 0, 0,
-116, 2, 0, 0, 0, 0, 35, 0,116, 2, 0, 0,117, 2, 0, 0, 0, 0, 35, 0,115, 2, 0, 0,117, 2, 0, 0, 0, 0, 35, 0,
-254, 0, 0, 0, 18, 1, 0, 0, 0, 0, 35, 0, 18, 1, 0, 0,117, 2, 0, 0, 0, 0, 35, 0,254, 0, 0, 0,117, 2, 0, 0,
- 0, 0, 35, 0,255, 0, 0, 0,116, 2, 0, 0, 0, 0, 35, 0,136, 1, 0, 0,116, 2, 0, 0, 0, 0, 35, 0,255, 0, 0, 0,
-136, 1, 0, 0, 0, 0, 35, 0,141, 1, 0, 0,118, 2, 0, 0, 0, 0, 35, 0, 7, 1, 0, 0,141, 1, 0, 0, 0, 0, 35, 0,
- 7, 1, 0, 0,118, 2, 0, 0, 0, 0, 35, 0,118, 2, 0, 0,119, 2, 0, 0, 0, 0, 35, 0,119, 2, 0, 0,120, 2, 0, 0,
- 0, 0, 35, 0,118, 2, 0, 0,120, 2, 0, 0, 0, 0, 35, 0, 5, 1, 0, 0,140, 1, 0, 0, 0, 0, 35, 0,140, 1, 0, 0,
-120, 2, 0, 0, 0, 0, 35, 0, 5, 1, 0, 0,120, 2, 0, 0, 0, 0, 35, 0, 4, 1, 0, 0,119, 2, 0, 0, 0, 0, 35, 0,
- 6, 1, 0, 0,119, 2, 0, 0, 0, 0, 35, 0, 4, 1, 0, 0, 6, 1, 0, 0, 0, 0, 35, 0,140, 1, 0, 0,121, 2, 0, 0,
- 0, 0, 35, 0,140, 1, 0, 0,142, 1, 0, 0, 0, 0, 35, 0,142, 1, 0, 0,121, 2, 0, 0, 0, 0, 35, 0,121, 2, 0, 0,
-122, 2, 0, 0, 0, 0, 35, 0,122, 2, 0, 0,123, 2, 0, 0, 0, 0, 35, 0,121, 2, 0, 0,123, 2, 0, 0, 0, 0, 35, 0,
-141, 1, 0, 0,144, 1, 0, 0, 0, 0, 35, 0,141, 1, 0, 0,123, 2, 0, 0, 0, 0, 35, 0,144, 1, 0, 0,123, 2, 0, 0,
- 0, 0, 35, 0,145, 1, 0, 0,122, 2, 0, 0, 0, 0, 35, 0,143, 1, 0, 0,122, 2, 0, 0, 0, 0, 35, 0,143, 1, 0, 0,
-145, 1, 0, 0, 0, 0, 35, 0, 24, 1, 0, 0,124, 2, 0, 0, 0, 0, 35, 0, 8, 1, 0, 0, 24, 1, 0, 0, 0, 0, 35, 0,
- 8, 1, 0, 0,124, 2, 0, 0, 0, 0, 35, 0,124, 2, 0, 0,125, 2, 0, 0, 0, 0, 35, 0,125, 2, 0, 0,126, 2, 0, 0,
- 0, 0, 35, 0,124, 2, 0, 0,126, 2, 0, 0, 0, 0, 35, 0, 25, 1, 0, 0,145, 1, 0, 0, 0, 0, 35, 0, 25, 1, 0, 0,
-126, 2, 0, 0, 0, 0, 35, 0,145, 1, 0, 0,126, 2, 0, 0, 0, 0, 35, 0,144, 1, 0, 0,125, 2, 0, 0, 0, 0, 35, 0,
- 9, 1, 0, 0,125, 2, 0, 0, 0, 0, 35, 0, 9, 1, 0, 0,144, 1, 0, 0, 0, 0, 35, 0, 23, 1, 0, 0,127, 2, 0, 0,
- 0, 0, 35, 0, 23, 1, 0, 0,143, 1, 0, 0, 0, 0, 35, 0,143, 1, 0, 0,127, 2, 0, 0, 0, 0, 35, 0,127, 2, 0, 0,
-128, 2, 0, 0, 0, 0, 35, 0,128, 2, 0, 0,129, 2, 0, 0, 0, 0, 35, 0,127, 2, 0, 0,129, 2, 0, 0, 0, 0, 35, 0,
- 2, 1, 0, 0, 22, 1, 0, 0, 0, 0, 35, 0, 22, 1, 0, 0,129, 2, 0, 0, 0, 0, 35, 0, 2, 1, 0, 0,129, 2, 0, 0,
- 0, 0, 35, 0, 3, 1, 0, 0,128, 2, 0, 0, 0, 0, 35, 0,142, 1, 0, 0,128, 2, 0, 0, 0, 0, 35, 0, 3, 1, 0, 0,
-142, 1, 0, 0, 0, 0, 35, 0, 68, 65, 84, 65, 64, 1, 0, 0,240, 91,119, 1, 0, 0, 0, 0, 5, 1, 0, 0, 5, 0, 0, 0,
- 4, 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,112, 93,119, 1, 0, 0, 0, 0,
- 5, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 85, 86, 84,101,120, 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,176,193,119, 1, 0, 0, 0, 0,
- 6, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67,111,108, 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,240,177,120, 1, 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,
- 68, 65, 84, 65, 0,100, 0, 0,112, 93,119, 1, 0, 0, 0, 0, 52, 0, 0, 0, 0, 5, 0, 0, 27, 1, 0, 0,102, 0, 0, 0,
-146, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,146, 1, 0, 0,171, 0, 0, 0, 27, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 14, 0, 0, 0, 27, 1, 0, 0,171, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,171, 0, 0, 0,146, 1, 0, 0, 46, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,147, 1, 0, 0, 46, 0, 0, 0,146, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,146, 1, 0, 0,
-148, 1, 0, 0,147, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 43, 0, 0, 0,147, 1, 0, 0,148, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,148, 1, 0, 0,146, 1, 0, 0,102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 26, 1, 0, 0, 12, 0, 0, 0,
-165, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,165, 0, 0, 0,148, 1, 0, 0, 26, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-102, 0, 0, 0, 26, 1, 0, 0,148, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,148, 1, 0, 0,165, 0, 0, 0, 43, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,147, 1, 0, 0, 43, 0, 0, 0,164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,164, 0, 0, 0,
-170, 0, 0, 0,147, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 46, 0, 0, 0,147, 1, 0, 0,170, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,170, 0, 0, 0,164, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 26, 1, 0, 0,102, 0, 0, 0,
-149, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,149, 1, 0, 0, 28, 1, 0, 0, 26, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 12, 0, 0, 0, 26, 1, 0, 0, 28, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 28, 1, 0, 0,149, 1, 0, 0,103, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,150, 1, 0, 0,103, 0, 0, 0,149, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,149, 1, 0, 0,
-151, 1, 0, 0,150, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,104, 0, 0, 0,150, 1, 0, 0,151, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,151, 1, 0, 0,149, 1, 0, 0,102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 27, 1, 0, 0, 14, 0, 0, 0,
- 31, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 31, 1, 0, 0,151, 1, 0, 0, 27, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-102, 0, 0, 0, 27, 1, 0, 0,151, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,151, 1, 0, 0, 31, 1, 0, 0,104, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,150, 1, 0, 0,104, 0, 0, 0, 30, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 30, 1, 0, 0,
- 29, 1, 0, 0,150, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,103, 0, 0, 0,150, 1, 0, 0, 29, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 29, 1, 0, 0, 30, 1, 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,168, 0, 0, 0, 45, 0, 0, 0,
-152, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,152, 1, 0, 0,172, 0, 0, 0,168, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 2, 0, 0, 0,168, 0, 0, 0,172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,172, 0, 0, 0,152, 1, 0, 0, 47, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,153, 1, 0, 0, 47, 0, 0, 0,152, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,152, 1, 0, 0,
-154, 1, 0, 0,153, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,104, 0, 0, 0,153, 1, 0, 0,154, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,154, 1, 0, 0,152, 1, 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,169, 0, 0, 0, 13, 0, 0, 0,
- 30, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 30, 1, 0, 0,154, 1, 0, 0,169, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 45, 0, 0, 0,169, 0, 0, 0,154, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,154, 1, 0, 0, 30, 1, 0, 0,104, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,153, 1, 0, 0,104, 0, 0, 0, 31, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 31, 1, 0, 0,
-173, 0, 0, 0,153, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 47, 0, 0, 0,153, 1, 0, 0,173, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,173, 0, 0, 0, 31, 1, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,167, 0, 0, 0, 44, 0, 0, 0,
-155, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,155, 1, 0, 0, 29, 1, 0, 0,167, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 13, 0, 0, 0,167, 0, 0, 0, 29, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 29, 1, 0, 0,155, 1, 0, 0,103, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,156, 1, 0, 0,103, 0, 0, 0,155, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,155, 1, 0, 0,
-157, 1, 0, 0,156, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 42, 0, 0, 0,156, 1, 0, 0,157, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,157, 1, 0, 0,155, 1, 0, 0, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,166, 0, 0, 0, 0, 0, 0, 0,
-162, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,162, 0, 0, 0,157, 1, 0, 0,166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 44, 0, 0, 0,166, 0, 0, 0,157, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,157, 1, 0, 0,162, 0, 0, 0, 42, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,156, 1, 0, 0, 42, 0, 0, 0,163, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,163, 0, 0, 0,
- 28, 1, 0, 0,156, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,103, 0, 0, 0,156, 1, 0, 0, 28, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 28, 1, 0, 0,163, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,158, 1, 0, 0,105, 0, 0, 0,
- 33, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 33, 1, 0, 0,179, 0, 0, 0,158, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 50, 0, 0, 0,158, 1, 0, 0,179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,179, 0, 0, 0, 33, 1, 0, 0, 16, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,158, 1, 0, 0, 50, 0, 0, 0,159, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,159, 1, 0, 0,
-160, 1, 0, 0,158, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,105, 0, 0, 0,158, 1, 0, 0,160, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,160, 1, 0, 0,159, 1, 0, 0, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,165, 0, 0, 0, 12, 0, 0, 0,
- 32, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 32, 1, 0, 0,160, 1, 0, 0,165, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 43, 0, 0, 0,165, 0, 0, 0,160, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,160, 1, 0, 0, 32, 1, 0, 0,105, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,164, 0, 0, 0, 43, 0, 0, 0,159, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,159, 1, 0, 0,
-178, 0, 0, 0,164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 1, 0, 0, 0,164, 0, 0, 0,178, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,178, 0, 0, 0,159, 1, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,161, 1, 0, 0,105, 0, 0, 0,
- 32, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 32, 1, 0, 0, 34, 1, 0, 0,161, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-106, 0, 0, 0,161, 1, 0, 0, 34, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 34, 1, 0, 0, 32, 1, 0, 0, 12, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,161, 1, 0, 0,106, 0, 0, 0,162, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,162, 1, 0, 0,
-163, 1, 0, 0,161, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,105, 0, 0, 0,161, 1, 0, 0,163, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,163, 1, 0, 0,162, 1, 0, 0,107, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 37, 1, 0, 0, 16, 0, 0, 0,
- 33, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 33, 1, 0, 0,163, 1, 0, 0, 37, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-107, 0, 0, 0, 37, 1, 0, 0,163, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,163, 1, 0, 0, 33, 1, 0, 0,105, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 36, 1, 0, 0,107, 0, 0, 0,162, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,162, 1, 0, 0,
- 35, 1, 0, 0, 36, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 15, 0, 0, 0, 36, 1, 0, 0, 35, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 35, 1, 0, 0,162, 1, 0, 0,106, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,164, 1, 0, 0, 49, 0, 0, 0,
-176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,176, 0, 0, 0,180, 0, 0, 0,164, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 51, 0, 0, 0,164, 1, 0, 0,180, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,180, 0, 0, 0,176, 0, 0, 0, 5, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,164, 1, 0, 0, 51, 0, 0, 0,165, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,165, 1, 0, 0,
-166, 1, 0, 0,164, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 49, 0, 0, 0,164, 1, 0, 0,166, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,166, 1, 0, 0,165, 1, 0, 0,107, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 36, 1, 0, 0, 15, 0, 0, 0,
-177, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,177, 0, 0, 0,166, 1, 0, 0, 36, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-107, 0, 0, 0, 36, 1, 0, 0,166, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,166, 1, 0, 0,177, 0, 0, 0, 49, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 37, 1, 0, 0,107, 0, 0, 0,165, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,165, 1, 0, 0,
-181, 0, 0, 0, 37, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 16, 0, 0, 0, 37, 1, 0, 0,181, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,181, 0, 0, 0,165, 1, 0, 0, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,167, 1, 0, 0, 48, 0, 0, 0,
-175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,175, 0, 0, 0, 35, 1, 0, 0,167, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-106, 0, 0, 0,167, 1, 0, 0, 35, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 35, 1, 0, 0,175, 0, 0, 0, 15, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,167, 1, 0, 0,106, 0, 0, 0,168, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,168, 1, 0, 0,
-169, 1, 0, 0,167, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 48, 0, 0, 0,167, 1, 0, 0,169, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,169, 1, 0, 0,168, 1, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,162, 0, 0, 0, 0, 0, 0, 0,
-174, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,174, 0, 0, 0,169, 1, 0, 0,162, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 42, 0, 0, 0,162, 0, 0, 0,169, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,169, 1, 0, 0,174, 0, 0, 0, 48, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,163, 0, 0, 0, 42, 0, 0, 0,168, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,168, 1, 0, 0,
- 34, 1, 0, 0,163, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 12, 0, 0, 0,163, 0, 0, 0, 34, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 34, 1, 0, 0,168, 1, 0, 0,106, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 39, 1, 0, 0,108, 0, 0, 0,
-170, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,170, 1, 0, 0,187, 0, 0, 0, 39, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 18, 0, 0, 0, 39, 1, 0, 0,187, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,187, 0, 0, 0,170, 1, 0, 0, 54, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,171, 1, 0, 0, 54, 0, 0, 0,170, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,170, 1, 0, 0,
-172, 1, 0, 0,171, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 45, 0, 0, 0,171, 1, 0, 0,172, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,172, 1, 0, 0,170, 1, 0, 0,108, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 38, 1, 0, 0, 13, 0, 0, 0,
-169, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,169, 0, 0, 0,172, 1, 0, 0, 38, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-108, 0, 0, 0, 38, 1, 0, 0,172, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,172, 1, 0, 0,169, 0, 0, 0, 45, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,171, 1, 0, 0, 45, 0, 0, 0,168, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,168, 0, 0, 0,
-186, 0, 0, 0,171, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 54, 0, 0, 0,171, 1, 0, 0,186, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,186, 0, 0, 0,168, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 38, 1, 0, 0,108, 0, 0, 0,
-173, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,173, 1, 0, 0, 40, 1, 0, 0, 38, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 13, 0, 0, 0, 38, 1, 0, 0, 40, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 40, 1, 0, 0,173, 1, 0, 0,109, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,174, 1, 0, 0,109, 0, 0, 0,173, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,173, 1, 0, 0,
-175, 1, 0, 0,174, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,110, 0, 0, 0,174, 1, 0, 0,175, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,175, 1, 0, 0,173, 1, 0, 0,108, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 39, 1, 0, 0, 18, 0, 0, 0,
- 43, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 43, 1, 0, 0,175, 1, 0, 0, 39, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-108, 0, 0, 0, 39, 1, 0, 0,175, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,175, 1, 0, 0, 43, 1, 0, 0,110, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,174, 1, 0, 0,110, 0, 0, 0, 42, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 42, 1, 0, 0,
- 41, 1, 0, 0,174, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,109, 0, 0, 0,174, 1, 0, 0, 41, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 41, 1, 0, 0, 42, 1, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,184, 0, 0, 0, 53, 0, 0, 0,
-176, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,176, 1, 0, 0,188, 0, 0, 0,184, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 3, 0, 0, 0,184, 0, 0, 0,188, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,188, 0, 0, 0,176, 1, 0, 0, 55, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,177, 1, 0, 0, 55, 0, 0, 0,176, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,176, 1, 0, 0,
-178, 1, 0, 0,177, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,110, 0, 0, 0,177, 1, 0, 0,178, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,178, 1, 0, 0,176, 1, 0, 0, 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,185, 0, 0, 0, 17, 0, 0, 0,
- 42, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 42, 1, 0, 0,178, 1, 0, 0,185, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 53, 0, 0, 0,185, 0, 0, 0,178, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,178, 1, 0, 0, 42, 1, 0, 0,110, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,177, 1, 0, 0,110, 0, 0, 0, 43, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 43, 1, 0, 0,
-189, 0, 0, 0,177, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 55, 0, 0, 0,177, 1, 0, 0,189, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,189, 0, 0, 0, 43, 1, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,183, 0, 0, 0, 52, 0, 0, 0,
-179, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,179, 1, 0, 0, 41, 1, 0, 0,183, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 17, 0, 0, 0,183, 0, 0, 0, 41, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 41, 1, 0, 0,179, 1, 0, 0,109, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,180, 1, 0, 0,109, 0, 0, 0,179, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,179, 1, 0, 0,
-181, 1, 0, 0,180, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 44, 0, 0, 0,180, 1, 0, 0,181, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,181, 1, 0, 0,179, 1, 0, 0, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,182, 0, 0, 0, 0, 0, 0, 0,
-166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,166, 0, 0, 0,181, 1, 0, 0,182, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 52, 0, 0, 0,182, 0, 0, 0,181, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,181, 1, 0, 0,166, 0, 0, 0, 44, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,180, 1, 0, 0, 44, 0, 0, 0,167, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,167, 0, 0, 0,
- 40, 1, 0, 0,180, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,109, 0, 0, 0,180, 1, 0, 0, 40, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 40, 1, 0, 0,167, 0, 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 45, 1, 0, 0,111, 0, 0, 0,
-182, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,182, 1, 0, 0,195, 0, 0, 0, 45, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 20, 0, 0, 0, 45, 1, 0, 0,195, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,195, 0, 0, 0,182, 1, 0, 0, 58, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,183, 1, 0, 0, 58, 0, 0, 0,182, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,182, 1, 0, 0,
-184, 1, 0, 0,183, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 53, 0, 0, 0,183, 1, 0, 0,184, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,184, 1, 0, 0,182, 1, 0, 0,111, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 44, 1, 0, 0, 17, 0, 0, 0,
-185, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,185, 0, 0, 0,184, 1, 0, 0, 44, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-111, 0, 0, 0, 44, 1, 0, 0,184, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,184, 1, 0, 0,185, 0, 0, 0, 53, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,183, 1, 0, 0, 53, 0, 0, 0,184, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,184, 0, 0, 0,
-194, 0, 0, 0,183, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 58, 0, 0, 0,183, 1, 0, 0,194, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,194, 0, 0, 0,184, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 44, 1, 0, 0,111, 0, 0, 0,
-185, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,185, 1, 0, 0, 46, 1, 0, 0, 44, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 17, 0, 0, 0, 44, 1, 0, 0, 46, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 46, 1, 0, 0,185, 1, 0, 0,112, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,186, 1, 0, 0,112, 0, 0, 0,185, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,185, 1, 0, 0,
-187, 1, 0, 0,186, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,113, 0, 0, 0,186, 1, 0, 0,187, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,187, 1, 0, 0,185, 1, 0, 0,111, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 45, 1, 0, 0, 20, 0, 0, 0,
- 49, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 49, 1, 0, 0,187, 1, 0, 0, 45, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-111, 0, 0, 0, 45, 1, 0, 0,187, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,187, 1, 0, 0, 49, 1, 0, 0,113, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,186, 1, 0, 0,113, 0, 0, 0, 48, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 48, 1, 0, 0,
- 47, 1, 0, 0,186, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,112, 0, 0, 0,186, 1, 0, 0, 47, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 47, 1, 0, 0, 48, 1, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,192, 0, 0, 0, 57, 0, 0, 0,
-188, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,188, 1, 0, 0,196, 0, 0, 0,192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 4, 0, 0, 0,192, 0, 0, 0,196, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,196, 0, 0, 0,188, 1, 0, 0, 59, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,189, 1, 0, 0, 59, 0, 0, 0,188, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,188, 1, 0, 0,
-190, 1, 0, 0,189, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,113, 0, 0, 0,189, 1, 0, 0,190, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,190, 1, 0, 0,188, 1, 0, 0, 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,193, 0, 0, 0, 19, 0, 0, 0,
- 48, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 48, 1, 0, 0,190, 1, 0, 0,193, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 57, 0, 0, 0,193, 0, 0, 0,190, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,190, 1, 0, 0, 48, 1, 0, 0,113, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,189, 1, 0, 0,113, 0, 0, 0, 49, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 49, 1, 0, 0,
-197, 0, 0, 0,189, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 59, 0, 0, 0,189, 1, 0, 0,197, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,197, 0, 0, 0, 49, 1, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,191, 0, 0, 0, 56, 0, 0, 0,
-191, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,191, 1, 0, 0, 47, 1, 0, 0,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 19, 0, 0, 0,191, 0, 0, 0, 47, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 47, 1, 0, 0,191, 1, 0, 0,112, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,192, 1, 0, 0,112, 0, 0, 0,191, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,191, 1, 0, 0,
-193, 1, 0, 0,192, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 52, 0, 0, 0,192, 1, 0, 0,193, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,193, 1, 0, 0,191, 1, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,190, 0, 0, 0, 0, 0, 0, 0,
-182, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,182, 0, 0, 0,193, 1, 0, 0,190, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 56, 0, 0, 0,190, 0, 0, 0,193, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,193, 1, 0, 0,182, 0, 0, 0, 52, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,192, 1, 0, 0, 52, 0, 0, 0,183, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,183, 0, 0, 0,
- 46, 1, 0, 0,192, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,112, 0, 0, 0,192, 1, 0, 0, 46, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 46, 1, 0, 0,183, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 51, 1, 0, 0,114, 0, 0, 0,
-194, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,194, 1, 0, 0,199, 0, 0, 0, 51, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 21, 0, 0, 0, 51, 1, 0, 0,199, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,199, 0, 0, 0,194, 1, 0, 0, 60, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,195, 1, 0, 0, 60, 0, 0, 0,194, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,194, 1, 0, 0,
-196, 1, 0, 0,195, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 57, 0, 0, 0,195, 1, 0, 0,196, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,196, 1, 0, 0,194, 1, 0, 0,114, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 50, 1, 0, 0, 19, 0, 0, 0,
-193, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,193, 0, 0, 0,196, 1, 0, 0, 50, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-114, 0, 0, 0, 50, 1, 0, 0,196, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,196, 1, 0, 0,193, 0, 0, 0, 57, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,195, 1, 0, 0, 57, 0, 0, 0,192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,192, 0, 0, 0,
-198, 0, 0, 0,195, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 60, 0, 0, 0,195, 1, 0, 0,198, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,198, 0, 0, 0,192, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 50, 1, 0, 0,114, 0, 0, 0,
-197, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,197, 1, 0, 0, 53, 1, 0, 0, 50, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 19, 0, 0, 0, 50, 1, 0, 0, 53, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 53, 1, 0, 0,197, 1, 0, 0,115, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,198, 1, 0, 0,115, 0, 0, 0,197, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,197, 1, 0, 0,
-199, 1, 0, 0,198, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,116, 0, 0, 0,198, 1, 0, 0,199, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,199, 1, 0, 0,197, 1, 0, 0,114, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 51, 1, 0, 0, 21, 0, 0, 0,
- 55, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 55, 1, 0, 0,199, 1, 0, 0, 51, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-114, 0, 0, 0, 51, 1, 0, 0,199, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,199, 1, 0, 0, 55, 1, 0, 0,116, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,198, 1, 0, 0,116, 0, 0, 0, 54, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 54, 1, 0, 0,
- 52, 1, 0, 0,198, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,115, 0, 0, 0,198, 1, 0, 0, 52, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 52, 1, 0, 0, 54, 1, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,176, 0, 0, 0, 49, 0, 0, 0,
-200, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,200, 1, 0, 0,200, 0, 0, 0,176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 5, 0, 0, 0,176, 0, 0, 0,200, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,200, 0, 0, 0,200, 1, 0, 0, 61, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,201, 1, 0, 0, 61, 0, 0, 0,200, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,200, 1, 0, 0,
-202, 1, 0, 0,201, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,116, 0, 0, 0,201, 1, 0, 0,202, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,202, 1, 0, 0,200, 1, 0, 0, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,177, 0, 0, 0, 15, 0, 0, 0,
- 54, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 54, 1, 0, 0,202, 1, 0, 0,177, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 49, 0, 0, 0,177, 0, 0, 0,202, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,202, 1, 0, 0, 54, 1, 0, 0,116, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,201, 1, 0, 0,116, 0, 0, 0, 55, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 55, 1, 0, 0,
-201, 0, 0, 0,201, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 61, 0, 0, 0,201, 1, 0, 0,201, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,201, 0, 0, 0, 55, 1, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,175, 0, 0, 0, 48, 0, 0, 0,
-203, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,203, 1, 0, 0, 52, 1, 0, 0,175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 15, 0, 0, 0,175, 0, 0, 0, 52, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 52, 1, 0, 0,203, 1, 0, 0,115, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,204, 1, 0, 0,115, 0, 0, 0,203, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,203, 1, 0, 0,
-205, 1, 0, 0,204, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 56, 0, 0, 0,204, 1, 0, 0,205, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,205, 1, 0, 0,203, 1, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,174, 0, 0, 0, 0, 0, 0, 0,
-190, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,190, 0, 0, 0,205, 1, 0, 0,174, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 48, 0, 0, 0,174, 0, 0, 0,205, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,205, 1, 0, 0,190, 0, 0, 0, 56, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,204, 1, 0, 0, 56, 0, 0, 0,191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,191, 0, 0, 0,
- 53, 1, 0, 0,204, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,115, 0, 0, 0,204, 1, 0, 0, 53, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 53, 1, 0, 0,191, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,206, 1, 0, 0,117, 0, 0, 0,
- 57, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 57, 1, 0, 0,207, 0, 0, 0,206, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 64, 0, 0, 0,206, 1, 0, 0,207, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,207, 0, 0, 0, 57, 1, 0, 0, 23, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,206, 1, 0, 0, 64, 0, 0, 0,207, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,207, 1, 0, 0,
-208, 1, 0, 0,206, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,117, 0, 0, 0,206, 1, 0, 0,208, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,208, 1, 0, 0,207, 1, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,179, 0, 0, 0, 16, 0, 0, 0,
- 56, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 56, 1, 0, 0,208, 1, 0, 0,179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 50, 0, 0, 0,179, 0, 0, 0,208, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,208, 1, 0, 0, 56, 1, 0, 0,117, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,178, 0, 0, 0, 50, 0, 0, 0,207, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,207, 1, 0, 0,
-206, 0, 0, 0,178, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 1, 0, 0, 0,178, 0, 0, 0,206, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,206, 0, 0, 0,207, 1, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,209, 1, 0, 0,117, 0, 0, 0,
- 56, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 56, 1, 0, 0, 58, 1, 0, 0,209, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-118, 0, 0, 0,209, 1, 0, 0, 58, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 58, 1, 0, 0, 56, 1, 0, 0, 16, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,209, 1, 0, 0,118, 0, 0, 0,210, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,210, 1, 0, 0,
-211, 1, 0, 0,209, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,117, 0, 0, 0,209, 1, 0, 0,211, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,211, 1, 0, 0,210, 1, 0, 0,119, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 61, 1, 0, 0, 23, 0, 0, 0,
- 57, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 57, 1, 0, 0,211, 1, 0, 0, 61, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-119, 0, 0, 0, 61, 1, 0, 0,211, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,211, 1, 0, 0, 57, 1, 0, 0,117, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 60, 1, 0, 0,119, 0, 0, 0,210, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,210, 1, 0, 0,
- 59, 1, 0, 0, 60, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 22, 0, 0, 0, 60, 1, 0, 0, 59, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 59, 1, 0, 0,210, 1, 0, 0,118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,212, 1, 0, 0, 63, 0, 0, 0,
-204, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,204, 0, 0, 0,208, 0, 0, 0,212, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 65, 0, 0, 0,212, 1, 0, 0,208, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,208, 0, 0, 0,204, 0, 0, 0, 10, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,212, 1, 0, 0, 65, 0, 0, 0,213, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,213, 1, 0, 0,
-214, 1, 0, 0,212, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 63, 0, 0, 0,212, 1, 0, 0,214, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,214, 1, 0, 0,213, 1, 0, 0,119, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 60, 1, 0, 0, 22, 0, 0, 0,
-205, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,205, 0, 0, 0,214, 1, 0, 0, 60, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-119, 0, 0, 0, 60, 1, 0, 0,214, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,214, 1, 0, 0,205, 0, 0, 0, 63, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 61, 1, 0, 0,119, 0, 0, 0,213, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,213, 1, 0, 0,
-209, 0, 0, 0, 61, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 23, 0, 0, 0, 61, 1, 0, 0,209, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,209, 0, 0, 0,213, 1, 0, 0, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,215, 1, 0, 0, 62, 0, 0, 0,
-203, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,203, 0, 0, 0, 59, 1, 0, 0,215, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-118, 0, 0, 0,215, 1, 0, 0, 59, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 59, 1, 0, 0,203, 0, 0, 0, 22, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,215, 1, 0, 0,118, 0, 0, 0,216, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,216, 1, 0, 0,
-217, 1, 0, 0,215, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 62, 0, 0, 0,215, 1, 0, 0,217, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,217, 1, 0, 0,216, 1, 0, 0, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,180, 0, 0, 0, 5, 0, 0, 0,
-202, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,202, 0, 0, 0,217, 1, 0, 0,180, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 51, 0, 0, 0,180, 0, 0, 0,217, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,217, 1, 0, 0,202, 0, 0, 0, 62, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,181, 0, 0, 0, 51, 0, 0, 0,216, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,216, 1, 0, 0,
- 58, 1, 0, 0,181, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 16, 0, 0, 0,181, 0, 0, 0, 58, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 58, 1, 0, 0,216, 1, 0, 0,118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,218, 1, 0, 0,120, 0, 0, 0,
- 63, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 63, 1, 0, 0,215, 0, 0, 0,218, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 68, 0, 0, 0,218, 1, 0, 0,215, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,215, 0, 0, 0, 63, 1, 0, 0, 25, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,218, 1, 0, 0, 68, 0, 0, 0,219, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,219, 1, 0, 0,
-220, 1, 0, 0,218, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,120, 0, 0, 0,218, 1, 0, 0,220, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,220, 1, 0, 0,219, 1, 0, 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,173, 0, 0, 0, 14, 0, 0, 0,
- 62, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 62, 1, 0, 0,220, 1, 0, 0,173, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 47, 0, 0, 0,173, 0, 0, 0,220, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,220, 1, 0, 0, 62, 1, 0, 0,120, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,172, 0, 0, 0, 47, 0, 0, 0,219, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,219, 1, 0, 0,
-214, 0, 0, 0,172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 2, 0, 0, 0,172, 0, 0, 0,214, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,214, 0, 0, 0,219, 1, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,221, 1, 0, 0,120, 0, 0, 0,
- 62, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 62, 1, 0, 0, 64, 1, 0, 0,221, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-121, 0, 0, 0,221, 1, 0, 0, 64, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 64, 1, 0, 0, 62, 1, 0, 0, 14, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,221, 1, 0, 0,121, 0, 0, 0,222, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,222, 1, 0, 0,
-223, 1, 0, 0,221, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,120, 0, 0, 0,221, 1, 0, 0,223, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,223, 1, 0, 0,222, 1, 0, 0,122, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 67, 1, 0, 0, 25, 0, 0, 0,
- 63, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 63, 1, 0, 0,223, 1, 0, 0, 67, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-122, 0, 0, 0, 67, 1, 0, 0,223, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,223, 1, 0, 0, 63, 1, 0, 0,120, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 66, 1, 0, 0,122, 0, 0, 0,222, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,222, 1, 0, 0,
- 65, 1, 0, 0, 66, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 24, 0, 0, 0, 66, 1, 0, 0, 65, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 65, 1, 0, 0,222, 1, 0, 0,121, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,224, 1, 0, 0, 67, 0, 0, 0,
-212, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,212, 0, 0, 0,216, 0, 0, 0,224, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 69, 0, 0, 0,224, 1, 0, 0,216, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,216, 0, 0, 0,212, 0, 0, 0, 6, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,224, 1, 0, 0, 69, 0, 0, 0,225, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,225, 1, 0, 0,
-226, 1, 0, 0,224, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 67, 0, 0, 0,224, 1, 0, 0,226, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,226, 1, 0, 0,225, 1, 0, 0,122, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 66, 1, 0, 0, 24, 0, 0, 0,
-213, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,213, 0, 0, 0,226, 1, 0, 0, 66, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-122, 0, 0, 0, 66, 1, 0, 0,226, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,226, 1, 0, 0,213, 0, 0, 0, 67, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 67, 1, 0, 0,122, 0, 0, 0,225, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,225, 1, 0, 0,
-217, 0, 0, 0, 67, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 25, 0, 0, 0, 67, 1, 0, 0,217, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,217, 0, 0, 0,225, 1, 0, 0, 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,227, 1, 0, 0, 66, 0, 0, 0,
-211, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,211, 0, 0, 0, 65, 1, 0, 0,227, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-121, 0, 0, 0,227, 1, 0, 0, 65, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 65, 1, 0, 0,211, 0, 0, 0, 24, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,227, 1, 0, 0,121, 0, 0, 0,228, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,228, 1, 0, 0,
-229, 1, 0, 0,227, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 66, 0, 0, 0,227, 1, 0, 0,229, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,229, 1, 0, 0,228, 1, 0, 0, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,170, 0, 0, 0, 1, 0, 0, 0,
-210, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,210, 0, 0, 0,229, 1, 0, 0,170, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 46, 0, 0, 0,170, 0, 0, 0,229, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,229, 1, 0, 0,210, 0, 0, 0, 66, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,171, 0, 0, 0, 46, 0, 0, 0,228, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,228, 1, 0, 0,
- 64, 1, 0, 0,171, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 14, 0, 0, 0,171, 0, 0, 0, 64, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 64, 1, 0, 0,228, 1, 0, 0,121, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,230, 1, 0, 0,123, 0, 0, 0,
- 69, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 69, 1, 0, 0,223, 0, 0, 0,230, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 72, 0, 0, 0,230, 1, 0, 0,223, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,223, 0, 0, 0, 69, 1, 0, 0, 27, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,230, 1, 0, 0, 72, 0, 0, 0,231, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,231, 1, 0, 0,
-232, 1, 0, 0,230, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,123, 0, 0, 0,230, 1, 0, 0,232, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,232, 1, 0, 0,231, 1, 0, 0, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,189, 0, 0, 0, 18, 0, 0, 0,
- 68, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 68, 1, 0, 0,232, 1, 0, 0,189, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 55, 0, 0, 0,189, 0, 0, 0,232, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,232, 1, 0, 0, 68, 1, 0, 0,123, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,188, 0, 0, 0, 55, 0, 0, 0,231, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,231, 1, 0, 0,
-222, 0, 0, 0,188, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0,188, 0, 0, 0,222, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,222, 0, 0, 0,231, 1, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,233, 1, 0, 0,123, 0, 0, 0,
- 68, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 68, 1, 0, 0, 70, 1, 0, 0,233, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-124, 0, 0, 0,233, 1, 0, 0, 70, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 70, 1, 0, 0, 68, 1, 0, 0, 18, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,233, 1, 0, 0,124, 0, 0, 0,234, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,234, 1, 0, 0,
-235, 1, 0, 0,233, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,123, 0, 0, 0,233, 1, 0, 0,235, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,235, 1, 0, 0,234, 1, 0, 0,125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 73, 1, 0, 0, 27, 0, 0, 0,
- 69, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 69, 1, 0, 0,235, 1, 0, 0, 73, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-125, 0, 0, 0, 73, 1, 0, 0,235, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,235, 1, 0, 0, 69, 1, 0, 0,123, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 72, 1, 0, 0,125, 0, 0, 0,234, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,234, 1, 0, 0,
- 71, 1, 0, 0, 72, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 26, 0, 0, 0, 72, 1, 0, 0, 71, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 71, 1, 0, 0,234, 1, 0, 0,124, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,236, 1, 0, 0, 71, 0, 0, 0,
-220, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,220, 0, 0, 0,224, 0, 0, 0,236, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 73, 0, 0, 0,236, 1, 0, 0,224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,224, 0, 0, 0,220, 0, 0, 0, 7, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,236, 1, 0, 0, 73, 0, 0, 0,237, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,237, 1, 0, 0,
-238, 1, 0, 0,236, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 71, 0, 0, 0,236, 1, 0, 0,238, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,238, 1, 0, 0,237, 1, 0, 0,125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 72, 1, 0, 0, 26, 0, 0, 0,
-221, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,221, 0, 0, 0,238, 1, 0, 0, 72, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-125, 0, 0, 0, 72, 1, 0, 0,238, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,238, 1, 0, 0,221, 0, 0, 0, 71, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 73, 1, 0, 0,125, 0, 0, 0,237, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,237, 1, 0, 0,
-225, 0, 0, 0, 73, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 27, 0, 0, 0, 73, 1, 0, 0,225, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,225, 0, 0, 0,237, 1, 0, 0, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,239, 1, 0, 0, 70, 0, 0, 0,
-219, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,219, 0, 0, 0, 71, 1, 0, 0,239, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-124, 0, 0, 0,239, 1, 0, 0, 71, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 71, 1, 0, 0,219, 0, 0, 0, 26, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,239, 1, 0, 0,124, 0, 0, 0,240, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,240, 1, 0, 0,
-241, 1, 0, 0,239, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 70, 0, 0, 0,239, 1, 0, 0,241, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,241, 1, 0, 0,240, 1, 0, 0, 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,186, 0, 0, 0, 2, 0, 0, 0,
-218, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,218, 0, 0, 0,241, 1, 0, 0,186, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 54, 0, 0, 0,186, 0, 0, 0,241, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,241, 1, 0, 0,218, 0, 0, 0, 70, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,187, 0, 0, 0, 54, 0, 0, 0,240, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,240, 1, 0, 0,
- 70, 1, 0, 0,187, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 18, 0, 0, 0,187, 0, 0, 0, 70, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 70, 1, 0, 0,240, 1, 0, 0,124, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,242, 1, 0, 0,126, 0, 0, 0,
- 75, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 75, 1, 0, 0,231, 0, 0, 0,242, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 76, 0, 0, 0,242, 1, 0, 0,231, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,231, 0, 0, 0, 75, 1, 0, 0, 29, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,242, 1, 0, 0, 76, 0, 0, 0,243, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,243, 1, 0, 0,
-244, 1, 0, 0,242, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,126, 0, 0, 0,242, 1, 0, 0,244, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,244, 1, 0, 0,243, 1, 0, 0, 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,197, 0, 0, 0, 20, 0, 0, 0,
- 74, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 74, 1, 0, 0,244, 1, 0, 0,197, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 59, 0, 0, 0,197, 0, 0, 0,244, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,244, 1, 0, 0, 74, 1, 0, 0,126, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,196, 0, 0, 0, 59, 0, 0, 0,243, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,243, 1, 0, 0,
-230, 0, 0, 0,196, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 0, 0, 0,196, 0, 0, 0,230, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,230, 0, 0, 0,243, 1, 0, 0, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,245, 1, 0, 0,126, 0, 0, 0,
- 74, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 74, 1, 0, 0, 76, 1, 0, 0,245, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-127, 0, 0, 0,245, 1, 0, 0, 76, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 76, 1, 0, 0, 74, 1, 0, 0, 20, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,245, 1, 0, 0,127, 0, 0, 0,246, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,246, 1, 0, 0,
-247, 1, 0, 0,245, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,126, 0, 0, 0,245, 1, 0, 0,247, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,247, 1, 0, 0,246, 1, 0, 0,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 79, 1, 0, 0, 29, 0, 0, 0,
- 75, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 75, 1, 0, 0,247, 1, 0, 0, 79, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-128, 0, 0, 0, 79, 1, 0, 0,247, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,247, 1, 0, 0, 75, 1, 0, 0,126, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 78, 1, 0, 0,128, 0, 0, 0,246, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,246, 1, 0, 0,
- 77, 1, 0, 0, 78, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 28, 0, 0, 0, 78, 1, 0, 0, 77, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 77, 1, 0, 0,246, 1, 0, 0,127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,248, 1, 0, 0, 75, 0, 0, 0,
-228, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,228, 0, 0, 0,232, 0, 0, 0,248, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 77, 0, 0, 0,248, 1, 0, 0,232, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,232, 0, 0, 0,228, 0, 0, 0, 8, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,248, 1, 0, 0, 77, 0, 0, 0,249, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,249, 1, 0, 0,
-250, 1, 0, 0,248, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 75, 0, 0, 0,248, 1, 0, 0,250, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,250, 1, 0, 0,249, 1, 0, 0,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 78, 1, 0, 0, 28, 0, 0, 0,
-229, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,229, 0, 0, 0,250, 1, 0, 0, 78, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-128, 0, 0, 0, 78, 1, 0, 0,250, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,250, 1, 0, 0,229, 0, 0, 0, 75, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 79, 1, 0, 0,128, 0, 0, 0,249, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,249, 1, 0, 0,
-233, 0, 0, 0, 79, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 29, 0, 0, 0, 79, 1, 0, 0,233, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,233, 0, 0, 0,249, 1, 0, 0, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,251, 1, 0, 0, 74, 0, 0, 0,
-227, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,227, 0, 0, 0, 77, 1, 0, 0,251, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-127, 0, 0, 0,251, 1, 0, 0, 77, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 77, 1, 0, 0,227, 0, 0, 0, 28, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,251, 1, 0, 0,127, 0, 0, 0,252, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,252, 1, 0, 0,
-253, 1, 0, 0,251, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 74, 0, 0, 0,251, 1, 0, 0,253, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,253, 1, 0, 0,252, 1, 0, 0, 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,194, 0, 0, 0, 3, 0, 0, 0,
-226, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,226, 0, 0, 0,253, 1, 0, 0,194, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 58, 0, 0, 0,194, 0, 0, 0,253, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,253, 1, 0, 0,226, 0, 0, 0, 74, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,195, 0, 0, 0, 58, 0, 0, 0,252, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,252, 1, 0, 0,
- 76, 1, 0, 0,195, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 20, 0, 0, 0,195, 0, 0, 0, 76, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 76, 1, 0, 0,252, 1, 0, 0,127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,254, 1, 0, 0,129, 0, 0, 0,
- 81, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 81, 1, 0, 0,239, 0, 0, 0,254, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 80, 0, 0, 0,254, 1, 0, 0,239, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,239, 0, 0, 0, 81, 1, 0, 0, 31, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,254, 1, 0, 0, 80, 0, 0, 0,255, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,255, 1, 0, 0,
- 0, 2, 0, 0,254, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,129, 0, 0, 0,254, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 0, 2, 0, 0,255, 1, 0, 0, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,201, 0, 0, 0, 21, 0, 0, 0,
- 80, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 80, 1, 0, 0, 0, 2, 0, 0,201, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 61, 0, 0, 0,201, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 2, 0, 0, 80, 1, 0, 0,129, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,200, 0, 0, 0, 61, 0, 0, 0,255, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,255, 1, 0, 0,
-238, 0, 0, 0,200, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 0, 0, 0,200, 0, 0, 0,238, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,238, 0, 0, 0,255, 1, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 1, 2, 0, 0,129, 0, 0, 0,
- 80, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 80, 1, 0, 0, 82, 1, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-130, 0, 0, 0, 1, 2, 0, 0, 82, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 82, 1, 0, 0, 80, 1, 0, 0, 21, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 1, 2, 0, 0,130, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 2, 2, 0, 0,
- 3, 2, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,129, 0, 0, 0, 1, 2, 0, 0, 3, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 3, 2, 0, 0, 2, 2, 0, 0,131, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 85, 1, 0, 0, 31, 0, 0, 0,
- 81, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 81, 1, 0, 0, 3, 2, 0, 0, 85, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-131, 0, 0, 0, 85, 1, 0, 0, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 2, 0, 0, 81, 1, 0, 0,129, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 84, 1, 0, 0,131, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 2, 2, 0, 0,
- 83, 1, 0, 0, 84, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 30, 0, 0, 0, 84, 1, 0, 0, 83, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 83, 1, 0, 0, 2, 2, 0, 0,130, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 2, 0, 0, 79, 0, 0, 0,
-236, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,236, 0, 0, 0,240, 0, 0, 0, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 81, 0, 0, 0, 4, 2, 0, 0,240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,240, 0, 0, 0,236, 0, 0, 0, 9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 4, 2, 0, 0, 81, 0, 0, 0, 5, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 2, 0, 0,
- 6, 2, 0, 0, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 79, 0, 0, 0, 4, 2, 0, 0, 6, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 6, 2, 0, 0, 5, 2, 0, 0,131, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 84, 1, 0, 0, 30, 0, 0, 0,
-237, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,237, 0, 0, 0, 6, 2, 0, 0, 84, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-131, 0, 0, 0, 84, 1, 0, 0, 6, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 6, 2, 0, 0,237, 0, 0, 0, 79, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 85, 1, 0, 0,131, 0, 0, 0, 5, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 2, 0, 0,
-241, 0, 0, 0, 85, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 31, 0, 0, 0, 85, 1, 0, 0,241, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,241, 0, 0, 0, 5, 2, 0, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 7, 2, 0, 0, 78, 0, 0, 0,
-235, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,235, 0, 0, 0, 83, 1, 0, 0, 7, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-130, 0, 0, 0, 7, 2, 0, 0, 83, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 83, 1, 0, 0,235, 0, 0, 0, 30, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 7, 2, 0, 0,130, 0, 0, 0, 8, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 8, 2, 0, 0,
- 9, 2, 0, 0, 7, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 78, 0, 0, 0, 7, 2, 0, 0, 9, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 9, 2, 0, 0, 8, 2, 0, 0, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,198, 0, 0, 0, 4, 0, 0, 0,
-234, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,234, 0, 0, 0, 9, 2, 0, 0,198, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 60, 0, 0, 0,198, 0, 0, 0, 9, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 9, 2, 0, 0,234, 0, 0, 0, 78, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,199, 0, 0, 0, 60, 0, 0, 0, 8, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 8, 2, 0, 0,
- 82, 1, 0, 0,199, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 21, 0, 0, 0,199, 0, 0, 0, 82, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 82, 1, 0, 0, 8, 2, 0, 0,130, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 87, 1, 0, 0,132, 0, 0, 0,
- 10, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 10, 2, 0, 0,245, 0, 0, 0, 87, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 32, 0, 0, 0, 87, 1, 0, 0,245, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,245, 0, 0, 0, 10, 2, 0, 0, 83, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 11, 2, 0, 0, 83, 0, 0, 0, 10, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 10, 2, 0, 0,
- 12, 2, 0, 0, 11, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 65, 0, 0, 0, 11, 2, 0, 0, 12, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 12, 2, 0, 0, 10, 2, 0, 0,132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 86, 1, 0, 0, 23, 0, 0, 0,
-209, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,209, 0, 0, 0, 12, 2, 0, 0, 86, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-132, 0, 0, 0, 86, 1, 0, 0, 12, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 12, 2, 0, 0,209, 0, 0, 0, 65, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 11, 2, 0, 0, 65, 0, 0, 0,208, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,208, 0, 0, 0,
-244, 0, 0, 0, 11, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 83, 0, 0, 0, 11, 2, 0, 0,244, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,244, 0, 0, 0,208, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 86, 1, 0, 0,132, 0, 0, 0,
- 13, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 13, 2, 0, 0, 88, 1, 0, 0, 86, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 23, 0, 0, 0, 86, 1, 0, 0, 88, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 88, 1, 0, 0, 13, 2, 0, 0,133, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 14, 2, 0, 0,133, 0, 0, 0, 13, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 13, 2, 0, 0,
- 15, 2, 0, 0, 14, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,134, 0, 0, 0, 14, 2, 0, 0, 15, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 15, 2, 0, 0, 13, 2, 0, 0,132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 87, 1, 0, 0, 32, 0, 0, 0,
- 91, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 91, 1, 0, 0, 15, 2, 0, 0, 87, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-132, 0, 0, 0, 87, 1, 0, 0, 15, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 15, 2, 0, 0, 91, 1, 0, 0,134, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 14, 2, 0, 0,134, 0, 0, 0, 90, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 90, 1, 0, 0,
- 89, 1, 0, 0, 14, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,133, 0, 0, 0, 14, 2, 0, 0, 89, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 89, 1, 0, 0, 90, 1, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,212, 0, 0, 0, 67, 0, 0, 0,
- 16, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 16, 2, 0, 0,242, 0, 0, 0,212, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 6, 0, 0, 0,212, 0, 0, 0,242, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,242, 0, 0, 0, 16, 2, 0, 0, 82, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 17, 2, 0, 0, 82, 0, 0, 0, 16, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 16, 2, 0, 0,
- 18, 2, 0, 0, 17, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,134, 0, 0, 0, 17, 2, 0, 0, 18, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 18, 2, 0, 0, 16, 2, 0, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,213, 0, 0, 0, 24, 0, 0, 0,
- 90, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 90, 1, 0, 0, 18, 2, 0, 0,213, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 67, 0, 0, 0,213, 0, 0, 0, 18, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 18, 2, 0, 0, 90, 1, 0, 0,134, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 17, 2, 0, 0,134, 0, 0, 0, 91, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 91, 1, 0, 0,
-243, 0, 0, 0, 17, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 82, 0, 0, 0, 17, 2, 0, 0,243, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,243, 0, 0, 0, 91, 1, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,211, 0, 0, 0, 66, 0, 0, 0,
- 19, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 19, 2, 0, 0, 89, 1, 0, 0,211, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 24, 0, 0, 0,211, 0, 0, 0, 89, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 89, 1, 0, 0, 19, 2, 0, 0,133, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 20, 2, 0, 0,133, 0, 0, 0, 19, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 19, 2, 0, 0,
- 21, 2, 0, 0, 20, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 64, 0, 0, 0, 20, 2, 0, 0, 21, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 21, 2, 0, 0, 19, 2, 0, 0, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,210, 0, 0, 0, 1, 0, 0, 0,
-206, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,206, 0, 0, 0, 21, 2, 0, 0,210, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 66, 0, 0, 0,210, 0, 0, 0, 21, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 21, 2, 0, 0,206, 0, 0, 0, 64, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 20, 2, 0, 0, 64, 0, 0, 0,207, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,207, 0, 0, 0,
- 88, 1, 0, 0, 20, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,133, 0, 0, 0, 20, 2, 0, 0, 88, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 88, 1, 0, 0,207, 0, 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 93, 1, 0, 0,135, 0, 0, 0,
- 22, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 22, 2, 0, 0,247, 0, 0, 0, 93, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 33, 0, 0, 0, 93, 1, 0, 0,247, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,247, 0, 0, 0, 22, 2, 0, 0, 84, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 23, 2, 0, 0, 84, 0, 0, 0, 22, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 22, 2, 0, 0,
- 24, 2, 0, 0, 23, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 69, 0, 0, 0, 23, 2, 0, 0, 24, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 24, 2, 0, 0, 22, 2, 0, 0,135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 92, 1, 0, 0, 25, 0, 0, 0,
-217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,217, 0, 0, 0, 24, 2, 0, 0, 92, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-135, 0, 0, 0, 92, 1, 0, 0, 24, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 24, 2, 0, 0,217, 0, 0, 0, 69, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 23, 2, 0, 0, 69, 0, 0, 0,216, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,216, 0, 0, 0,
-246, 0, 0, 0, 23, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 84, 0, 0, 0, 23, 2, 0, 0,246, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,246, 0, 0, 0,216, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 92, 1, 0, 0,135, 0, 0, 0,
- 25, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 25, 2, 0, 0, 94, 1, 0, 0, 92, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 25, 0, 0, 0, 92, 1, 0, 0, 94, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 94, 1, 0, 0, 25, 2, 0, 0,136, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 26, 2, 0, 0,136, 0, 0, 0, 25, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 25, 2, 0, 0,
- 27, 2, 0, 0, 26, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,137, 0, 0, 0, 26, 2, 0, 0, 27, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 27, 2, 0, 0, 25, 2, 0, 0,135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 93, 1, 0, 0, 33, 0, 0, 0,
- 97, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 97, 1, 0, 0, 27, 2, 0, 0, 93, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-135, 0, 0, 0, 93, 1, 0, 0, 27, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 27, 2, 0, 0, 97, 1, 0, 0,137, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 26, 2, 0, 0,137, 0, 0, 0, 96, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 96, 1, 0, 0,
- 95, 1, 0, 0, 26, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,136, 0, 0, 0, 26, 2, 0, 0, 95, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 95, 1, 0, 0, 96, 1, 0, 0, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,220, 0, 0, 0, 71, 0, 0, 0,
- 28, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 28, 2, 0, 0,248, 0, 0, 0,220, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 7, 0, 0, 0,220, 0, 0, 0,248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,248, 0, 0, 0, 28, 2, 0, 0, 85, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 29, 2, 0, 0, 85, 0, 0, 0, 28, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 28, 2, 0, 0,
- 30, 2, 0, 0, 29, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,137, 0, 0, 0, 29, 2, 0, 0, 30, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 30, 2, 0, 0, 28, 2, 0, 0, 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,221, 0, 0, 0, 26, 0, 0, 0,
- 96, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 96, 1, 0, 0, 30, 2, 0, 0,221, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 71, 0, 0, 0,221, 0, 0, 0, 30, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 30, 2, 0, 0, 96, 1, 0, 0,137, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 29, 2, 0, 0,137, 0, 0, 0, 97, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 97, 1, 0, 0,
-249, 0, 0, 0, 29, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 85, 0, 0, 0, 29, 2, 0, 0,249, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,249, 0, 0, 0, 97, 1, 0, 0, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,219, 0, 0, 0, 70, 0, 0, 0,
- 31, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 31, 2, 0, 0, 95, 1, 0, 0,219, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 26, 0, 0, 0,219, 0, 0, 0, 95, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 95, 1, 0, 0, 31, 2, 0, 0,136, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 32, 2, 0, 0,136, 0, 0, 0, 31, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 31, 2, 0, 0,
- 33, 2, 0, 0, 32, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 68, 0, 0, 0, 32, 2, 0, 0, 33, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 33, 2, 0, 0, 31, 2, 0, 0, 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,218, 0, 0, 0, 2, 0, 0, 0,
-214, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,214, 0, 0, 0, 33, 2, 0, 0,218, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 70, 0, 0, 0,218, 0, 0, 0, 33, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 33, 2, 0, 0,214, 0, 0, 0, 68, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 32, 2, 0, 0, 68, 0, 0, 0,215, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,215, 0, 0, 0,
- 94, 1, 0, 0, 32, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,136, 0, 0, 0, 32, 2, 0, 0, 94, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 94, 1, 0, 0,215, 0, 0, 0, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 99, 1, 0, 0,138, 0, 0, 0,
- 34, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 34, 2, 0, 0,251, 0, 0, 0, 99, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 34, 0, 0, 0, 99, 1, 0, 0,251, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,251, 0, 0, 0, 34, 2, 0, 0, 86, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 35, 2, 0, 0, 86, 0, 0, 0, 34, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 34, 2, 0, 0,
- 36, 2, 0, 0, 35, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 73, 0, 0, 0, 35, 2, 0, 0, 36, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 36, 2, 0, 0, 34, 2, 0, 0,138, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 98, 1, 0, 0, 27, 0, 0, 0,
-225, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,225, 0, 0, 0, 36, 2, 0, 0, 98, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-138, 0, 0, 0, 98, 1, 0, 0, 36, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 36, 2, 0, 0,225, 0, 0, 0, 73, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 35, 2, 0, 0, 73, 0, 0, 0,224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,224, 0, 0, 0,
-250, 0, 0, 0, 35, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 86, 0, 0, 0, 35, 2, 0, 0,250, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,250, 0, 0, 0,224, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 98, 1, 0, 0,138, 0, 0, 0,
- 37, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 37, 2, 0, 0,100, 1, 0, 0, 98, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 27, 0, 0, 0, 98, 1, 0, 0,100, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,100, 1, 0, 0, 37, 2, 0, 0,139, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 38, 2, 0, 0,139, 0, 0, 0, 37, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 37, 2, 0, 0,
- 39, 2, 0, 0, 38, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,140, 0, 0, 0, 38, 2, 0, 0, 39, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 39, 2, 0, 0, 37, 2, 0, 0,138, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 99, 1, 0, 0, 34, 0, 0, 0,
-103, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,103, 1, 0, 0, 39, 2, 0, 0, 99, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-138, 0, 0, 0, 99, 1, 0, 0, 39, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 39, 2, 0, 0,103, 1, 0, 0,140, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 38, 2, 0, 0,140, 0, 0, 0,102, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,102, 1, 0, 0,
-101, 1, 0, 0, 38, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,139, 0, 0, 0, 38, 2, 0, 0,101, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,101, 1, 0, 0,102, 1, 0, 0, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,228, 0, 0, 0, 75, 0, 0, 0,
- 40, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 40, 2, 0, 0,252, 0, 0, 0,228, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 8, 0, 0, 0,228, 0, 0, 0,252, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,252, 0, 0, 0, 40, 2, 0, 0, 87, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 41, 2, 0, 0, 87, 0, 0, 0, 40, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 40, 2, 0, 0,
- 42, 2, 0, 0, 41, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,140, 0, 0, 0, 41, 2, 0, 0, 42, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 42, 2, 0, 0, 40, 2, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,229, 0, 0, 0, 28, 0, 0, 0,
-102, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,102, 1, 0, 0, 42, 2, 0, 0,229, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 75, 0, 0, 0,229, 0, 0, 0, 42, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 42, 2, 0, 0,102, 1, 0, 0,140, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 41, 2, 0, 0,140, 0, 0, 0,103, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,103, 1, 0, 0,
-253, 0, 0, 0, 41, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 87, 0, 0, 0, 41, 2, 0, 0,253, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,253, 0, 0, 0,103, 1, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,227, 0, 0, 0, 74, 0, 0, 0,
- 43, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 43, 2, 0, 0,101, 1, 0, 0,227, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 28, 0, 0, 0,227, 0, 0, 0,101, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,101, 1, 0, 0, 43, 2, 0, 0,139, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 44, 2, 0, 0,139, 0, 0, 0, 43, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 43, 2, 0, 0,
- 45, 2, 0, 0, 44, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 72, 0, 0, 0, 44, 2, 0, 0, 45, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 45, 2, 0, 0, 43, 2, 0, 0, 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,226, 0, 0, 0, 3, 0, 0, 0,
-222, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,222, 0, 0, 0, 45, 2, 0, 0,226, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 74, 0, 0, 0,226, 0, 0, 0, 45, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 45, 2, 0, 0,222, 0, 0, 0, 72, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 44, 2, 0, 0, 72, 0, 0, 0,223, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,223, 0, 0, 0,
-100, 1, 0, 0, 44, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,139, 0, 0, 0, 44, 2, 0, 0,100, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,100, 1, 0, 0,223, 0, 0, 0, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,105, 1, 0, 0,141, 0, 0, 0,
- 46, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 46, 2, 0, 0,255, 0, 0, 0,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 35, 0, 0, 0,105, 1, 0, 0,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,255, 0, 0, 0, 46, 2, 0, 0, 88, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 47, 2, 0, 0, 88, 0, 0, 0, 46, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 46, 2, 0, 0,
- 48, 2, 0, 0, 47, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 77, 0, 0, 0, 47, 2, 0, 0, 48, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 48, 2, 0, 0, 46, 2, 0, 0,141, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,104, 1, 0, 0, 29, 0, 0, 0,
-233, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,233, 0, 0, 0, 48, 2, 0, 0,104, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-141, 0, 0, 0,104, 1, 0, 0, 48, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 48, 2, 0, 0,233, 0, 0, 0, 77, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 47, 2, 0, 0, 77, 0, 0, 0,232, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,232, 0, 0, 0,
-254, 0, 0, 0, 47, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 88, 0, 0, 0, 47, 2, 0, 0,254, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,254, 0, 0, 0,232, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,104, 1, 0, 0,141, 0, 0, 0,
- 49, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 49, 2, 0, 0,106, 1, 0, 0,104, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 29, 0, 0, 0,104, 1, 0, 0,106, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,106, 1, 0, 0, 49, 2, 0, 0,142, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 50, 2, 0, 0,142, 0, 0, 0, 49, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 49, 2, 0, 0,
- 51, 2, 0, 0, 50, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,143, 0, 0, 0, 50, 2, 0, 0, 51, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 51, 2, 0, 0, 49, 2, 0, 0,141, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,105, 1, 0, 0, 35, 0, 0, 0,
-109, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,109, 1, 0, 0, 51, 2, 0, 0,105, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-141, 0, 0, 0,105, 1, 0, 0, 51, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 51, 2, 0, 0,109, 1, 0, 0,143, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 50, 2, 0, 0,143, 0, 0, 0,108, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,108, 1, 0, 0,
-107, 1, 0, 0, 50, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,142, 0, 0, 0, 50, 2, 0, 0,107, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,107, 1, 0, 0,108, 1, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,236, 0, 0, 0, 79, 0, 0, 0,
- 52, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 52, 2, 0, 0, 0, 1, 0, 0,236, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 9, 0, 0, 0,236, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 1, 0, 0, 52, 2, 0, 0, 89, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 53, 2, 0, 0, 89, 0, 0, 0, 52, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 52, 2, 0, 0,
- 54, 2, 0, 0, 53, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,143, 0, 0, 0, 53, 2, 0, 0, 54, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 54, 2, 0, 0, 52, 2, 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,237, 0, 0, 0, 30, 0, 0, 0,
-108, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,108, 1, 0, 0, 54, 2, 0, 0,237, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 79, 0, 0, 0,237, 0, 0, 0, 54, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 54, 2, 0, 0,108, 1, 0, 0,143, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 53, 2, 0, 0,143, 0, 0, 0,109, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,109, 1, 0, 0,
- 1, 1, 0, 0, 53, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 89, 0, 0, 0, 53, 2, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 1, 1, 0, 0,109, 1, 0, 0, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,235, 0, 0, 0, 78, 0, 0, 0,
- 55, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 55, 2, 0, 0,107, 1, 0, 0,235, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 30, 0, 0, 0,235, 0, 0, 0,107, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,107, 1, 0, 0, 55, 2, 0, 0,142, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 56, 2, 0, 0,142, 0, 0, 0, 55, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 55, 2, 0, 0,
- 57, 2, 0, 0, 56, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 76, 0, 0, 0, 56, 2, 0, 0, 57, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 57, 2, 0, 0, 55, 2, 0, 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,234, 0, 0, 0, 4, 0, 0, 0,
-230, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,230, 0, 0, 0, 57, 2, 0, 0,234, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 78, 0, 0, 0,234, 0, 0, 0, 57, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 57, 2, 0, 0,230, 0, 0, 0, 76, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 56, 2, 0, 0, 76, 0, 0, 0,231, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,231, 0, 0, 0,
-106, 1, 0, 0, 56, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,142, 0, 0, 0, 56, 2, 0, 0,106, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,106, 1, 0, 0,231, 0, 0, 0, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,111, 1, 0, 0,144, 0, 0, 0,
- 58, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 58, 2, 0, 0, 3, 1, 0, 0,111, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 36, 0, 0, 0,111, 1, 0, 0, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 1, 0, 0, 58, 2, 0, 0, 90, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 59, 2, 0, 0, 90, 0, 0, 0, 58, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 58, 2, 0, 0,
- 60, 2, 0, 0, 59, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 81, 0, 0, 0, 59, 2, 0, 0, 60, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 60, 2, 0, 0, 58, 2, 0, 0,144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,110, 1, 0, 0, 31, 0, 0, 0,
-241, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,241, 0, 0, 0, 60, 2, 0, 0,110, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-144, 0, 0, 0,110, 1, 0, 0, 60, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 60, 2, 0, 0,241, 0, 0, 0, 81, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 59, 2, 0, 0, 81, 0, 0, 0,240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,240, 0, 0, 0,
- 2, 1, 0, 0, 59, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 90, 0, 0, 0, 59, 2, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 2, 1, 0, 0,240, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,110, 1, 0, 0,144, 0, 0, 0,
- 61, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 61, 2, 0, 0,113, 1, 0, 0,110, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 31, 0, 0, 0,110, 1, 0, 0,113, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,113, 1, 0, 0, 61, 2, 0, 0,145, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 62, 2, 0, 0,145, 0, 0, 0, 61, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 61, 2, 0, 0,
- 63, 2, 0, 0, 62, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,146, 0, 0, 0, 62, 2, 0, 0, 63, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 63, 2, 0, 0, 61, 2, 0, 0,144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,111, 1, 0, 0, 36, 0, 0, 0,
-115, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,115, 1, 0, 0, 63, 2, 0, 0,111, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-144, 0, 0, 0,111, 1, 0, 0, 63, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 63, 2, 0, 0,115, 1, 0, 0,146, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 62, 2, 0, 0,146, 0, 0, 0,114, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,114, 1, 0, 0,
-112, 1, 0, 0, 62, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,145, 0, 0, 0, 62, 2, 0, 0,112, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,112, 1, 0, 0,114, 1, 0, 0, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,204, 0, 0, 0, 63, 0, 0, 0,
- 64, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 64, 2, 0, 0, 4, 1, 0, 0,204, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 10, 0, 0, 0,204, 0, 0, 0, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 1, 0, 0, 64, 2, 0, 0, 91, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 65, 2, 0, 0, 91, 0, 0, 0, 64, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 64, 2, 0, 0,
- 66, 2, 0, 0, 65, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,146, 0, 0, 0, 65, 2, 0, 0, 66, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 66, 2, 0, 0, 64, 2, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,205, 0, 0, 0, 22, 0, 0, 0,
-114, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,114, 1, 0, 0, 66, 2, 0, 0,205, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 63, 0, 0, 0,205, 0, 0, 0, 66, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 66, 2, 0, 0,114, 1, 0, 0,146, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 65, 2, 0, 0,146, 0, 0, 0,115, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,115, 1, 0, 0,
- 5, 1, 0, 0, 65, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 91, 0, 0, 0, 65, 2, 0, 0, 5, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 5, 1, 0, 0,115, 1, 0, 0, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,203, 0, 0, 0, 62, 0, 0, 0,
- 67, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 67, 2, 0, 0,112, 1, 0, 0,203, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 22, 0, 0, 0,203, 0, 0, 0,112, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,112, 1, 0, 0, 67, 2, 0, 0,145, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 68, 2, 0, 0,145, 0, 0, 0, 67, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 67, 2, 0, 0,
- 69, 2, 0, 0, 68, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 80, 0, 0, 0, 68, 2, 0, 0, 69, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 69, 2, 0, 0, 67, 2, 0, 0, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,202, 0, 0, 0, 5, 0, 0, 0,
-238, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,238, 0, 0, 0, 69, 2, 0, 0,202, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 62, 0, 0, 0,202, 0, 0, 0, 69, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 69, 2, 0, 0,238, 0, 0, 0, 80, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 68, 2, 0, 0, 80, 0, 0, 0,239, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,239, 0, 0, 0,
-113, 1, 0, 0, 68, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,145, 0, 0, 0, 68, 2, 0, 0,113, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,113, 1, 0, 0,239, 0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 70, 2, 0, 0,147, 0, 0, 0,
-117, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,117, 1, 0, 0, 11, 1, 0, 0, 70, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 94, 0, 0, 0, 70, 2, 0, 0, 11, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 11, 1, 0, 0,117, 1, 0, 0, 38, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 70, 2, 0, 0, 94, 0, 0, 0, 71, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 71, 2, 0, 0,
- 72, 2, 0, 0, 70, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,147, 0, 0, 0, 70, 2, 0, 0, 72, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 72, 2, 0, 0, 71, 2, 0, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,243, 0, 0, 0, 32, 0, 0, 0,
-116, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,116, 1, 0, 0, 72, 2, 0, 0,243, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 82, 0, 0, 0,243, 0, 0, 0, 72, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 72, 2, 0, 0,116, 1, 0, 0,147, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,242, 0, 0, 0, 82, 0, 0, 0, 71, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 71, 2, 0, 0,
- 10, 1, 0, 0,242, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 6, 0, 0, 0,242, 0, 0, 0, 10, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 10, 1, 0, 0, 71, 2, 0, 0, 94, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 73, 2, 0, 0,147, 0, 0, 0,
-116, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,116, 1, 0, 0,118, 1, 0, 0, 73, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-148, 0, 0, 0, 73, 2, 0, 0,118, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,118, 1, 0, 0,116, 1, 0, 0, 32, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 73, 2, 0, 0,148, 0, 0, 0, 74, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 74, 2, 0, 0,
- 75, 2, 0, 0, 73, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,147, 0, 0, 0, 73, 2, 0, 0, 75, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 75, 2, 0, 0, 74, 2, 0, 0,149, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,121, 1, 0, 0, 38, 0, 0, 0,
-117, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,117, 1, 0, 0, 75, 2, 0, 0,121, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-149, 0, 0, 0,121, 1, 0, 0, 75, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 75, 2, 0, 0,117, 1, 0, 0,147, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,120, 1, 0, 0,149, 0, 0, 0, 74, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 74, 2, 0, 0,
-119, 1, 0, 0,120, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 37, 0, 0, 0,120, 1, 0, 0,119, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,119, 1, 0, 0, 74, 2, 0, 0,148, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 76, 2, 0, 0, 93, 0, 0, 0,
- 8, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 8, 1, 0, 0, 12, 1, 0, 0, 76, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 95, 0, 0, 0, 76, 2, 0, 0, 12, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 12, 1, 0, 0, 8, 1, 0, 0, 11, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 76, 2, 0, 0, 95, 0, 0, 0, 77, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 77, 2, 0, 0,
- 78, 2, 0, 0, 76, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 93, 0, 0, 0, 76, 2, 0, 0, 78, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 78, 2, 0, 0, 77, 2, 0, 0,149, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,120, 1, 0, 0, 37, 0, 0, 0,
- 9, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 9, 1, 0, 0, 78, 2, 0, 0,120, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-149, 0, 0, 0,120, 1, 0, 0, 78, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 78, 2, 0, 0, 9, 1, 0, 0, 93, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,121, 1, 0, 0,149, 0, 0, 0, 77, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 77, 2, 0, 0,
- 13, 1, 0, 0,121, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 38, 0, 0, 0,121, 1, 0, 0, 13, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 13, 1, 0, 0, 77, 2, 0, 0, 95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 79, 2, 0, 0, 92, 0, 0, 0,
- 7, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 7, 1, 0, 0,119, 1, 0, 0, 79, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-148, 0, 0, 0, 79, 2, 0, 0,119, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,119, 1, 0, 0, 7, 1, 0, 0, 37, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 79, 2, 0, 0,148, 0, 0, 0, 80, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 80, 2, 0, 0,
- 81, 2, 0, 0, 79, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 92, 0, 0, 0, 79, 2, 0, 0, 81, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 81, 2, 0, 0, 80, 2, 0, 0, 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,244, 0, 0, 0, 10, 0, 0, 0,
- 6, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 6, 1, 0, 0, 81, 2, 0, 0,244, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 83, 0, 0, 0,244, 0, 0, 0, 81, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 81, 2, 0, 0, 6, 1, 0, 0, 92, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,245, 0, 0, 0, 83, 0, 0, 0, 80, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 80, 2, 0, 0,
-118, 1, 0, 0,245, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 32, 0, 0, 0,245, 0, 0, 0,118, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,118, 1, 0, 0, 80, 2, 0, 0,148, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 82, 2, 0, 0,150, 0, 0, 0,
-123, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,123, 1, 0, 0, 15, 1, 0, 0, 82, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 96, 0, 0, 0, 82, 2, 0, 0, 15, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 15, 1, 0, 0,123, 1, 0, 0, 39, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 82, 2, 0, 0, 96, 0, 0, 0, 83, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 83, 2, 0, 0,
- 84, 2, 0, 0, 82, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,150, 0, 0, 0, 82, 2, 0, 0, 84, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 84, 2, 0, 0, 83, 2, 0, 0, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,249, 0, 0, 0, 33, 0, 0, 0,
-122, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,122, 1, 0, 0, 84, 2, 0, 0,249, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 85, 0, 0, 0,249, 0, 0, 0, 84, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 84, 2, 0, 0,122, 1, 0, 0,150, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,248, 0, 0, 0, 85, 0, 0, 0, 83, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 83, 2, 0, 0,
- 14, 1, 0, 0,248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 7, 0, 0, 0,248, 0, 0, 0, 14, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 14, 1, 0, 0, 83, 2, 0, 0, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 85, 2, 0, 0,150, 0, 0, 0,
-122, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,122, 1, 0, 0,124, 1, 0, 0, 85, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-151, 0, 0, 0, 85, 2, 0, 0,124, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,124, 1, 0, 0,122, 1, 0, 0, 33, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 85, 2, 0, 0,151, 0, 0, 0, 86, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 86, 2, 0, 0,
- 87, 2, 0, 0, 85, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,150, 0, 0, 0, 85, 2, 0, 0, 87, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 87, 2, 0, 0, 86, 2, 0, 0,152, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,127, 1, 0, 0, 39, 0, 0, 0,
-123, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,123, 1, 0, 0, 87, 2, 0, 0,127, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-152, 0, 0, 0,127, 1, 0, 0, 87, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 87, 2, 0, 0,123, 1, 0, 0,150, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,126, 1, 0, 0,152, 0, 0, 0, 86, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 86, 2, 0, 0,
-125, 1, 0, 0,126, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 38, 0, 0, 0,126, 1, 0, 0,125, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,125, 1, 0, 0, 86, 2, 0, 0,151, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 88, 2, 0, 0, 95, 0, 0, 0,
- 12, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 12, 1, 0, 0, 16, 1, 0, 0, 88, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 97, 0, 0, 0, 88, 2, 0, 0, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 16, 1, 0, 0, 12, 1, 0, 0, 11, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 88, 2, 0, 0, 97, 0, 0, 0, 89, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 89, 2, 0, 0,
- 90, 2, 0, 0, 88, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 95, 0, 0, 0, 88, 2, 0, 0, 90, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 90, 2, 0, 0, 89, 2, 0, 0,152, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,126, 1, 0, 0, 38, 0, 0, 0,
- 13, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 13, 1, 0, 0, 90, 2, 0, 0,126, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-152, 0, 0, 0,126, 1, 0, 0, 90, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 90, 2, 0, 0, 13, 1, 0, 0, 95, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,127, 1, 0, 0,152, 0, 0, 0, 89, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 89, 2, 0, 0,
- 17, 1, 0, 0,127, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 39, 0, 0, 0,127, 1, 0, 0, 17, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 17, 1, 0, 0, 89, 2, 0, 0, 97, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 91, 2, 0, 0, 94, 0, 0, 0,
- 11, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 11, 1, 0, 0,125, 1, 0, 0, 91, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-151, 0, 0, 0, 91, 2, 0, 0,125, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,125, 1, 0, 0, 11, 1, 0, 0, 38, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 91, 2, 0, 0,151, 0, 0, 0, 92, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 92, 2, 0, 0,
- 93, 2, 0, 0, 91, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 94, 0, 0, 0, 91, 2, 0, 0, 93, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 93, 2, 0, 0, 92, 2, 0, 0, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,246, 0, 0, 0, 6, 0, 0, 0,
- 10, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 10, 1, 0, 0, 93, 2, 0, 0,246, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 84, 0, 0, 0,246, 0, 0, 0, 93, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 93, 2, 0, 0, 10, 1, 0, 0, 94, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,247, 0, 0, 0, 84, 0, 0, 0, 92, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 92, 2, 0, 0,
-124, 1, 0, 0,247, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 33, 0, 0, 0,247, 0, 0, 0,124, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,124, 1, 0, 0, 92, 2, 0, 0,151, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 94, 2, 0, 0,153, 0, 0, 0,
-129, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,129, 1, 0, 0, 19, 1, 0, 0, 94, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 98, 0, 0, 0, 94, 2, 0, 0, 19, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 19, 1, 0, 0,129, 1, 0, 0, 40, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 94, 2, 0, 0, 98, 0, 0, 0, 95, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 95, 2, 0, 0,
- 96, 2, 0, 0, 94, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,153, 0, 0, 0, 94, 2, 0, 0, 96, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 96, 2, 0, 0, 95, 2, 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,253, 0, 0, 0, 34, 0, 0, 0,
-128, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,128, 1, 0, 0, 96, 2, 0, 0,253, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 87, 0, 0, 0,253, 0, 0, 0, 96, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 96, 2, 0, 0,128, 1, 0, 0,153, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,252, 0, 0, 0, 87, 0, 0, 0, 95, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 95, 2, 0, 0,
- 18, 1, 0, 0,252, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 8, 0, 0, 0,252, 0, 0, 0, 18, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 18, 1, 0, 0, 95, 2, 0, 0, 98, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 97, 2, 0, 0,153, 0, 0, 0,
-128, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,128, 1, 0, 0,130, 1, 0, 0, 97, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-154, 0, 0, 0, 97, 2, 0, 0,130, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,130, 1, 0, 0,128, 1, 0, 0, 34, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 97, 2, 0, 0,154, 0, 0, 0, 98, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 98, 2, 0, 0,
- 99, 2, 0, 0, 97, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,153, 0, 0, 0, 97, 2, 0, 0, 99, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 99, 2, 0, 0, 98, 2, 0, 0,155, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,133, 1, 0, 0, 40, 0, 0, 0,
-129, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,129, 1, 0, 0, 99, 2, 0, 0,133, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-155, 0, 0, 0,133, 1, 0, 0, 99, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 99, 2, 0, 0,129, 1, 0, 0,153, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,132, 1, 0, 0,155, 0, 0, 0, 98, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 98, 2, 0, 0,
-131, 1, 0, 0,132, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 39, 0, 0, 0,132, 1, 0, 0,131, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,131, 1, 0, 0, 98, 2, 0, 0,154, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,100, 2, 0, 0, 97, 0, 0, 0,
- 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 16, 1, 0, 0, 20, 1, 0, 0,100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 99, 0, 0, 0,100, 2, 0, 0, 20, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 20, 1, 0, 0, 16, 1, 0, 0, 11, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,100, 2, 0, 0, 99, 0, 0, 0,101, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,101, 2, 0, 0,
-102, 2, 0, 0,100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 97, 0, 0, 0,100, 2, 0, 0,102, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,102, 2, 0, 0,101, 2, 0, 0,155, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,132, 1, 0, 0, 39, 0, 0, 0,
- 17, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 17, 1, 0, 0,102, 2, 0, 0,132, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-155, 0, 0, 0,132, 1, 0, 0,102, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,102, 2, 0, 0, 17, 1, 0, 0, 97, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,133, 1, 0, 0,155, 0, 0, 0,101, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,101, 2, 0, 0,
- 21, 1, 0, 0,133, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 40, 0, 0, 0,133, 1, 0, 0, 21, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 21, 1, 0, 0,101, 2, 0, 0, 99, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,103, 2, 0, 0, 96, 0, 0, 0,
- 15, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 15, 1, 0, 0,131, 1, 0, 0,103, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-154, 0, 0, 0,103, 2, 0, 0,131, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,131, 1, 0, 0, 15, 1, 0, 0, 39, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,103, 2, 0, 0,154, 0, 0, 0,104, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,104, 2, 0, 0,
-105, 2, 0, 0,103, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 96, 0, 0, 0,103, 2, 0, 0,105, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,105, 2, 0, 0,104, 2, 0, 0, 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,250, 0, 0, 0, 7, 0, 0, 0,
- 14, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 14, 1, 0, 0,105, 2, 0, 0,250, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 86, 0, 0, 0,250, 0, 0, 0,105, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,105, 2, 0, 0, 14, 1, 0, 0, 96, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,251, 0, 0, 0, 86, 0, 0, 0,104, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,104, 2, 0, 0,
-130, 1, 0, 0,251, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 34, 0, 0, 0,251, 0, 0, 0,130, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,130, 1, 0, 0,104, 2, 0, 0,154, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,106, 2, 0, 0,156, 0, 0, 0,
-135, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,135, 1, 0, 0, 23, 1, 0, 0,106, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-100, 0, 0, 0,106, 2, 0, 0, 23, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 23, 1, 0, 0,135, 1, 0, 0, 41, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,106, 2, 0, 0,100, 0, 0, 0,107, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,107, 2, 0, 0,
-108, 2, 0, 0,106, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,156, 0, 0, 0,106, 2, 0, 0,108, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,108, 2, 0, 0,107, 2, 0, 0, 89, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 1, 1, 0, 0, 35, 0, 0, 0,
-134, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,134, 1, 0, 0,108, 2, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 89, 0, 0, 0, 1, 1, 0, 0,108, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,108, 2, 0, 0,134, 1, 0, 0,156, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 0, 1, 0, 0, 89, 0, 0, 0,107, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,107, 2, 0, 0,
- 22, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 9, 0, 0, 0, 0, 1, 0, 0, 22, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 22, 1, 0, 0,107, 2, 0, 0,100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,109, 2, 0, 0,156, 0, 0, 0,
-134, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,134, 1, 0, 0,136, 1, 0, 0,109, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-157, 0, 0, 0,109, 2, 0, 0,136, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,136, 1, 0, 0,134, 1, 0, 0, 35, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,109, 2, 0, 0,157, 0, 0, 0,110, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,110, 2, 0, 0,
-111, 2, 0, 0,109, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,156, 0, 0, 0,109, 2, 0, 0,111, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,111, 2, 0, 0,110, 2, 0, 0,158, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,139, 1, 0, 0, 41, 0, 0, 0,
-135, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,135, 1, 0, 0,111, 2, 0, 0,139, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-158, 0, 0, 0,139, 1, 0, 0,111, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,111, 2, 0, 0,135, 1, 0, 0,156, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,138, 1, 0, 0,158, 0, 0, 0,110, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,110, 2, 0, 0,
-137, 1, 0, 0,138, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 40, 0, 0, 0,138, 1, 0, 0,137, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,137, 1, 0, 0,110, 2, 0, 0,157, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,112, 2, 0, 0, 99, 0, 0, 0,
- 20, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 20, 1, 0, 0, 24, 1, 0, 0,112, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-101, 0, 0, 0,112, 2, 0, 0, 24, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 24, 1, 0, 0, 20, 1, 0, 0, 11, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,112, 2, 0, 0,101, 0, 0, 0,113, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,113, 2, 0, 0,
-114, 2, 0, 0,112, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 99, 0, 0, 0,112, 2, 0, 0,114, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,114, 2, 0, 0,113, 2, 0, 0,158, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,138, 1, 0, 0, 40, 0, 0, 0,
- 21, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 21, 1, 0, 0,114, 2, 0, 0,138, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-158, 0, 0, 0,138, 1, 0, 0,114, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,114, 2, 0, 0, 21, 1, 0, 0, 99, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,139, 1, 0, 0,158, 0, 0, 0,113, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,113, 2, 0, 0,
- 25, 1, 0, 0,139, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 41, 0, 0, 0,139, 1, 0, 0, 25, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 25, 1, 0, 0,113, 2, 0, 0,101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,115, 2, 0, 0, 98, 0, 0, 0,
- 19, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 19, 1, 0, 0,137, 1, 0, 0,115, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-157, 0, 0, 0,115, 2, 0, 0,137, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,137, 1, 0, 0, 19, 1, 0, 0, 40, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,115, 2, 0, 0,157, 0, 0, 0,116, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,116, 2, 0, 0,
-117, 2, 0, 0,115, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 98, 0, 0, 0,115, 2, 0, 0,117, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,117, 2, 0, 0,116, 2, 0, 0, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,254, 0, 0, 0, 8, 0, 0, 0,
- 18, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 18, 1, 0, 0,117, 2, 0, 0,254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 88, 0, 0, 0,254, 0, 0, 0,117, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,117, 2, 0, 0, 18, 1, 0, 0, 98, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,255, 0, 0, 0, 88, 0, 0, 0,116, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,116, 2, 0, 0,
-136, 1, 0, 0,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 35, 0, 0, 0,255, 0, 0, 0,136, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,136, 1, 0, 0,116, 2, 0, 0,157, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,118, 2, 0, 0,159, 0, 0, 0,
-141, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,141, 1, 0, 0, 7, 1, 0, 0,118, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 92, 0, 0, 0,118, 2, 0, 0, 7, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 7, 1, 0, 0,141, 1, 0, 0, 37, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,118, 2, 0, 0, 92, 0, 0, 0,119, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,119, 2, 0, 0,
-120, 2, 0, 0,118, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,159, 0, 0, 0,118, 2, 0, 0,120, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,120, 2, 0, 0,119, 2, 0, 0, 91, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 1, 0, 0, 36, 0, 0, 0,
-140, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,140, 1, 0, 0,120, 2, 0, 0, 5, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 91, 0, 0, 0, 5, 1, 0, 0,120, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,120, 2, 0, 0,140, 1, 0, 0,159, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 4, 1, 0, 0, 91, 0, 0, 0,119, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,119, 2, 0, 0,
- 6, 1, 0, 0, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 10, 0, 0, 0, 4, 1, 0, 0, 6, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 6, 1, 0, 0,119, 2, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,121, 2, 0, 0,159, 0, 0, 0,
-140, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,140, 1, 0, 0,142, 1, 0, 0,121, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-160, 0, 0, 0,121, 2, 0, 0,142, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,142, 1, 0, 0,140, 1, 0, 0, 36, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,121, 2, 0, 0,160, 0, 0, 0,122, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,122, 2, 0, 0,
-123, 2, 0, 0,121, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,159, 0, 0, 0,121, 2, 0, 0,123, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,123, 2, 0, 0,122, 2, 0, 0,161, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,144, 1, 0, 0, 37, 0, 0, 0,
-141, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,141, 1, 0, 0,123, 2, 0, 0,144, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-161, 0, 0, 0,144, 1, 0, 0,123, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,123, 2, 0, 0,141, 1, 0, 0,159, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,145, 1, 0, 0,161, 0, 0, 0,122, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,122, 2, 0, 0,
-143, 1, 0, 0,145, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 41, 0, 0, 0,145, 1, 0, 0,143, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,143, 1, 0, 0,122, 2, 0, 0,160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,124, 2, 0, 0,101, 0, 0, 0,
- 24, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 24, 1, 0, 0, 8, 1, 0, 0,124, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 93, 0, 0, 0,124, 2, 0, 0, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 8, 1, 0, 0, 24, 1, 0, 0, 11, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,124, 2, 0, 0, 93, 0, 0, 0,125, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,125, 2, 0, 0,
-126, 2, 0, 0,124, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,101, 0, 0, 0,124, 2, 0, 0,126, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,126, 2, 0, 0,125, 2, 0, 0,161, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,145, 1, 0, 0, 41, 0, 0, 0,
- 25, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 25, 1, 0, 0,126, 2, 0, 0,145, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-161, 0, 0, 0,145, 1, 0, 0,126, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,126, 2, 0, 0, 25, 1, 0, 0,101, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,144, 1, 0, 0,161, 0, 0, 0,125, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,125, 2, 0, 0,
- 9, 1, 0, 0,144, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 37, 0, 0, 0,144, 1, 0, 0, 9, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 9, 1, 0, 0,125, 2, 0, 0, 93, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,127, 2, 0, 0,100, 0, 0, 0,
- 23, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 23, 1, 0, 0,143, 1, 0, 0,127, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
-160, 0, 0, 0,127, 2, 0, 0,143, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,143, 1, 0, 0, 23, 1, 0, 0, 41, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,127, 2, 0, 0,160, 0, 0, 0,128, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,128, 2, 0, 0,
-129, 2, 0, 0,127, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,100, 0, 0, 0,127, 2, 0, 0,129, 2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,129, 2, 0, 0,128, 2, 0, 0, 90, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 2, 1, 0, 0, 9, 0, 0, 0,
- 22, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 22, 1, 0, 0,129, 2, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 90, 0, 0, 0, 2, 1, 0, 0,129, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,129, 2, 0, 0, 22, 1, 0, 0,100, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 3, 1, 0, 0, 90, 0, 0, 0,128, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,128, 2, 0, 0,
-142, 1, 0, 0, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 36, 0, 0, 0, 3, 1, 0, 0,142, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3,142, 1, 0, 0,128, 2, 0, 0,160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 68, 65, 84, 65, 0,240, 0, 0,
-176,193,119, 1, 0, 0, 0, 0, 60, 0, 0, 0, 0, 5, 0, 0,166,222,110, 63, 9,205, 55, 63,212,132,105, 63,201,236, 65, 63,
-218,153,103, 63,119,155, 54, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-218,153,103, 63,119,155, 54, 63,118,148,108, 63,211,160, 44, 63,166,222,110, 63, 9,205, 55, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 36, 51,115, 63, 36, 28, 45, 63,166,222,110, 63, 9,205, 55, 63,
-118,148,108, 63,211,160, 44, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-118,148,108, 63,211,160, 44, 63,218,153,103, 63,119,155, 54, 63, 87, 17,102, 63,229, 52, 43, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 56, 81, 96, 63,170, 55, 52, 63, 87, 17,102, 63,229, 52, 43, 63,
-218,153,103, 63,119,155, 54, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-218,153,103, 63,119,155, 54, 63, 9, 75, 97, 63, 92,233, 63, 63, 56, 81, 96, 63,170, 55, 52, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,138,153, 89, 63, 49, 86, 60, 63, 56, 81, 96, 63,170, 55, 52, 63,
- 9, 75, 97, 63, 92,233, 63, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 9, 75, 97, 63, 92,233, 63, 63,218,153,103, 63,119,155, 54, 63,212,132,105, 63,201,236, 65, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,103,167, 98, 63,168, 39, 75, 63,138,153, 89, 63, 39,228, 82, 63,
-139,153, 89, 63,255,153, 71, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-139,153, 89, 63,255,153, 71, 63, 9, 75, 97, 63, 92,233, 63, 63,103,167, 98, 63,168, 39, 75, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,212,132,105, 63,201,236, 65, 63,103,167, 98, 63,168, 39, 75, 63,
- 9, 75, 97, 63, 92,233, 63, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 9, 75, 97, 63, 92,233, 63, 63,139,153, 89, 63,255,153, 71, 63,138,153, 89, 63, 49, 86, 60, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 56, 81, 96, 63,170, 55, 52, 63,138,153, 89, 63, 49, 86, 60, 63,
-139,153, 89, 63, 79, 12, 49, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-139,153, 89, 63, 79, 12, 49, 63,205,182, 95, 63,222,228, 40, 63, 56, 81, 96, 63,170, 55, 52, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 87, 17,102, 63,229, 52, 43, 63, 56, 81, 96, 63,170, 55, 52, 63,
-205,182, 95, 63,222,228, 40, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-205,182, 95, 63,222,228, 40, 63,139,153, 89, 63, 79, 12, 49, 63,139,153, 89, 63, 45,200, 37, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,103,167, 98, 63,168, 39, 75, 63,212,132,105, 63,201,236, 65, 63,
-168, 83,109, 63,207, 83, 78, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-168, 83,109, 63,207, 83, 78, 63,135, 85,101, 63,148, 64, 88, 63,103,167, 98, 63,168, 39, 75, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,138,153, 89, 63, 39,228, 82, 63,103,167, 98, 63,168, 39, 75, 63,
-135, 85,101, 63,148, 64, 88, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-135, 85,101, 63,148, 64, 88, 63,168, 83,109, 63,207, 83, 78, 63, 36, 51,115, 63, 22, 56, 90, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,162, 18,121, 63,207, 83, 78, 63, 36, 51,115, 63, 22, 56, 90, 63,
-168, 83,109, 63,207, 83, 78, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-168, 83,109, 63,207, 83, 78, 63, 36, 51,115, 63,115, 23, 67, 63,162, 18,121, 63,207, 83, 78, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,116,225,124, 63,202,236, 65, 63,162, 18,121, 63,207, 83, 78, 63,
- 36, 51,115, 63,115, 23, 67, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 36, 51,115, 63,115, 23, 67, 63,168, 83,109, 63,207, 83, 78, 63,212,132,105, 63,201,236, 65, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,166,222,110, 63, 9,205, 55, 63, 36, 51,115, 63, 36, 28, 45, 63,
-163,135,119, 63, 11,205, 55, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-163,135,119, 63, 11,205, 55, 63, 36, 51,115, 63,115, 23, 67, 63,166,222,110, 63, 9,205, 55, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,212,132,105, 63,201,236, 65, 63,166,222,110, 63, 9,205, 55, 63,
- 36, 51,115, 63,115, 23, 67, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 36, 51,115, 63,115, 23, 67, 63,163,135,119, 63, 11,205, 55, 63,116,225,124, 63,202,236, 65, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,162, 18,121, 63,207, 83, 78, 63,116,225,124, 63,202,236, 65, 63,
-113,223,129, 63,170, 39, 75, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-113,223,129, 63,170, 39, 75, 63, 98,136,128, 63,148, 64, 88, 63,162, 18,121, 63,207, 83, 78, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 36, 51,115, 63, 22, 56, 90, 63,162, 18,121, 63,207, 83, 78, 63,
- 98,136,128, 63,148, 64, 88, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 95, 98,136, 59,148, 64, 88, 63,160,184,111, 60,170, 39, 75, 63,243,203, 76, 61, 41,228, 82, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,243,203, 76, 61, 82, 12, 49, 63,246,203, 76, 61, 53, 86, 60, 63,
- 31,162,194, 60,172, 55, 52, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 31,162,194, 60,172, 55, 52, 63,111,239,213, 60,223,228, 40, 63,243,203, 76, 61, 82, 12, 49, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,246,203, 76, 61, 48,200, 37, 63,243,203, 76, 61, 82, 12, 49, 63,
-111,239,213, 60,223,228, 40, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-111,239,213, 60,223,228, 40, 63, 31,162,194, 60,172, 55, 52, 63,120,226,169, 58,230, 52, 43, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,111,204,126, 63,121,155, 54, 63,121, 42,128, 63,230, 52, 43, 63,
-136, 10,131, 63,172, 55, 52, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-136, 10,131, 63,172, 55, 52, 63,160,141,130, 63, 95,233, 63, 63,111,204,126, 63,121,155, 54, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,116,225,124, 63,202,236, 65, 63,111,204,126, 63,121,155, 54, 63,
-160,141,130, 63, 95,233, 63, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 11,104,163, 60, 95,233, 63, 63, 31,162,194, 60,172, 55, 52, 63,246,203, 76, 61, 53, 86, 60, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,244,203, 76, 61, 2,154, 71, 63,243,203, 76, 61, 41,228, 82, 63,
-160,184,111, 60,170, 39, 75, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-160,184,111, 60,170, 39, 75, 63, 11,104,163, 60, 95,233, 63, 63,244,203, 76, 61, 2,154, 71, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,246,203, 76, 61, 53, 86, 60, 63,244,203, 76, 61, 2,154, 71, 63,
- 11,104,163, 60, 95,233, 63, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-160,141,130, 63, 95,233, 63, 63,113,223,129, 63,170, 39, 75, 63,116,225,124, 63,202,236, 65, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,111,204,126, 63,121,155, 54, 63,116,225,124, 63,202,236, 65, 63,
-163,135,119, 63, 11,205, 55, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-163,135,119, 63, 11,205, 55, 63,210,209,121, 63,212,160, 44, 63,111,204,126, 63,121,155, 54, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,121, 42,128, 63,230, 52, 43, 63,111,204,126, 63,121,155, 54, 63,
-210,209,121, 63,212,160, 44, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-210,209,121, 63,212,160, 44, 63,163,135,119, 63, 11,205, 55, 63, 36, 51,115, 63, 36, 28, 45, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 95,102,134, 63, 79, 46, 94, 63, 95,102,134, 63, 22,114,105, 63,
- 52,205,124, 63, 58, 26, 99, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 52,205,124, 63, 58, 26, 99, 63, 98,136,128, 63,148, 64, 88, 63, 95,102,134, 63, 79, 46, 94, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,243,203, 76, 61, 41,228, 82, 63,234,203, 76, 61, 79, 46, 94, 63,
- 95, 98,136, 59,148, 64, 88, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 98,136,128, 63,148, 64, 88, 63, 52,205,124, 63, 58, 26, 99, 63, 36, 51,115, 63, 22, 56, 90, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 21,153,105, 63, 58, 26, 99, 63, 36, 51,115, 63, 22, 56, 90, 63,
- 52,205,124, 63, 58, 26, 99, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 52,205,124, 63, 58, 26, 99, 63, 32, 51,115, 63,212,154,109, 63, 21,153,105, 63, 58, 26, 99, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,138,153, 89, 63, 19,114,105, 63, 21,153,105, 63, 58, 26, 99, 63,
- 32, 51,115, 63,212,154,109, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 32, 51,115, 63,212,154,109, 63, 52,205,124, 63, 58, 26, 99, 63, 95,102,134, 63, 22,114,105, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 95,102,134, 63,242,187,116, 63, 3,153, 59, 63, 0, 0,128, 63,
-136,153, 89, 63,242,187,116, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-136,153, 89, 63,242,187,116, 63, 32, 51,115, 63,212,154,109, 63, 95,102,134, 63,242,187,116, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 95,102,134, 63, 22,114,105, 63, 95,102,134, 63,242,187,116, 63,
- 32, 51,115, 63,212,154,109, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 32, 51,115, 63,212,154,109, 63,136,153, 89, 63,242,187,116, 63,138,153, 89, 63, 19,114,105, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 21,153,105, 63, 58, 26, 99, 63,138,153, 89, 63, 19,114,105, 63,
-138,153, 89, 63, 77, 46, 94, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-138,153, 89, 63, 77, 46, 94, 63,135, 85,101, 63,148, 64, 88, 63, 21,153,105, 63, 58, 26, 99, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 36, 51,115, 63, 22, 56, 90, 63, 21,153,105, 63, 58, 26, 99, 63,
-135, 85,101, 63,148, 64, 88, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-135, 85,101, 63,148, 64, 88, 63,138,153, 89, 63, 77, 46, 94, 63,138,153, 89, 63, 39,228, 82, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 67,153, 75, 63,113,155, 54, 63, 74,174, 73, 63,193,236, 65, 63,
-124, 84, 68, 63,255,204, 55, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-124, 84, 68, 63,255,204, 55, 63,169,158, 70, 63,200,160, 44, 63, 67,153, 75, 63,113,155, 54, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,196, 33, 77, 63,221, 52, 43, 63, 67,153, 75, 63,113,155, 54, 63,
-169,158, 70, 63,200,160, 44, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-169,158, 70, 63,200,160, 44, 63,124, 84, 68, 63,255,204, 55, 63, 0, 0, 64, 63, 24, 28, 45, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 67,153, 75, 63,113,155, 54, 63,196, 33, 77, 63,221, 52, 43, 63,
-225,225, 82, 63,165, 55, 52, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-225,225, 82, 63,165, 55, 52, 63, 16,232, 81, 63, 89,233, 63, 63, 67,153, 75, 63,113,155, 54, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 74,174, 73, 63,193,236, 65, 63, 67,153, 75, 63,113,155, 54, 63,
- 16,232, 81, 63, 89,233, 63, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 16,232, 81, 63, 89,233, 63, 63,225,225, 82, 63,165, 55, 52, 63,138,153, 89, 63, 49, 86, 60, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,139,153, 89, 63,255,153, 71, 63,138,153, 89, 63, 39,228, 82, 63,
-179,139, 80, 63,164, 39, 75, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-179,139, 80, 63,164, 39, 75, 63, 16,232, 81, 63, 89,233, 63, 63,139,153, 89, 63,255,153, 71, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,138,153, 89, 63, 49, 86, 60, 63,139,153, 89, 63,255,153, 71, 63,
- 16,232, 81, 63, 89,233, 63, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 16,232, 81, 63, 89,233, 63, 63,179,139, 80, 63,164, 39, 75, 63, 74,174, 73, 63,193,236, 65, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,139,153, 89, 63, 79, 12, 49, 63,138,153, 89, 63, 49, 86, 60, 63,
-225,225, 82, 63,165, 55, 52, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-225,225, 82, 63,165, 55, 52, 63, 75,124, 83, 63,217,228, 40, 63,139,153, 89, 63, 79, 12, 49, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,139,153, 89, 63, 45,200, 37, 63,139,153, 89, 63, 79, 12, 49, 63,
- 75,124, 83, 63,217,228, 40, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 75,124, 83, 63,217,228, 40, 63,225,225, 82, 63,165, 55, 52, 63,196, 33, 77, 63,221, 52, 43, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,120,223, 69, 63,198, 83, 78, 63, 74,174, 73, 63,193,236, 65, 63,
-179,139, 80, 63,164, 39, 75, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-179,139, 80, 63,164, 39, 75, 63,148,221, 77, 63,140, 64, 88, 63,120,223, 69, 63,198, 83, 78, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 64, 63, 12, 56, 90, 63,120,223, 69, 63,198, 83, 78, 63,
-148,221, 77, 63,140, 64, 88, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-148,221, 77, 63,140, 64, 88, 63,179,139, 80, 63,164, 39, 75, 63,138,153, 89, 63, 39,228, 82, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,120,223, 69, 63,198, 83, 78, 63, 0, 0, 64, 63, 12, 56, 90, 63,
-136, 32, 58, 63,198, 83, 78, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-136, 32, 58, 63,198, 83, 78, 63, 0, 0, 64, 63,106, 23, 67, 63,120,223, 69, 63,198, 83, 78, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 74,174, 73, 63,193,236, 65, 63,120,223, 69, 63,198, 83, 78, 63,
- 0, 0, 64, 63,106, 23, 67, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 64, 63,106, 23, 67, 63,136, 32, 58, 63,198, 83, 78, 63,182, 81, 54, 63,193,236, 65, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,132,171, 59, 63,255,204, 55, 63, 0, 0, 64, 63, 24, 28, 45, 63,
-124, 84, 68, 63,255,204, 55, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-124, 84, 68, 63,255,204, 55, 63, 0, 0, 64, 63,106, 23, 67, 63,132,171, 59, 63,255,204, 55, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,182, 81, 54, 63,193,236, 65, 63,132,171, 59, 63,255,204, 55, 63,
- 0, 0, 64, 63,106, 23, 67, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 64, 63,106, 23, 67, 63,124, 84, 68, 63,255,204, 55, 63, 74,174, 73, 63,193,236, 65, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 77,116, 47, 63,164, 39, 75, 63,182, 81, 54, 63,193,236, 65, 63,
-136, 32, 58, 63,198, 83, 78, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-136, 32, 58, 63,198, 83, 78, 63,108, 34, 50, 63,140, 64, 88, 63, 77,116, 47, 63,164, 39, 75, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,118,102, 38, 63, 38,228, 82, 63, 77,116, 47, 63,164, 39, 75, 63,
-108, 34, 50, 63,140, 64, 88, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-108, 34, 50, 63,140, 64, 88, 63,136, 32, 58, 63,198, 83, 78, 63, 0, 0, 64, 63, 12, 56, 90, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 31, 30, 45, 63,165, 55, 52, 63,117,102, 38, 63, 50, 86, 60, 63,
-117,102, 38, 63, 78, 12, 49, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-117,102, 38, 63, 78, 12, 49, 63,181,131, 44, 63,216,228, 40, 63, 31, 30, 45, 63,165, 55, 52, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 60,222, 50, 63,221, 52, 43, 63, 31, 30, 45, 63,165, 55, 52, 63,
-181,131, 44, 63,216,228, 40, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-181,131, 44, 63,216,228, 40, 63,117,102, 38, 63, 78, 12, 49, 63,117,102, 38, 63, 45,200, 37, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 31, 30, 45, 63,165, 55, 52, 63, 60,222, 50, 63,221, 52, 43, 63,
-189,102, 52, 63,113,155, 54, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-189,102, 52, 63,113,155, 54, 63,240, 23, 46, 63, 89,233, 63, 63, 31, 30, 45, 63,165, 55, 52, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,117,102, 38, 63, 50, 86, 60, 63, 31, 30, 45, 63,165, 55, 52, 63,
-240, 23, 46, 63, 89,233, 63, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-240, 23, 46, 63, 89,233, 63, 63,189,102, 52, 63,113,155, 54, 63,182, 81, 54, 63,193,236, 65, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 77,116, 47, 63,164, 39, 75, 63,118,102, 38, 63, 38,228, 82, 63,
-117,102, 38, 63,255,153, 71, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-117,102, 38, 63,255,153, 71, 63,240, 23, 46, 63, 89,233, 63, 63, 77,116, 47, 63,164, 39, 75, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,182, 81, 54, 63,193,236, 65, 63, 77,116, 47, 63,164, 39, 75, 63,
-240, 23, 46, 63, 89,233, 63, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-240, 23, 46, 63, 89,233, 63, 63,117,102, 38, 63,255,153, 71, 63,117,102, 38, 63, 50, 86, 60, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,132,171, 59, 63,255,204, 55, 63,182, 81, 54, 63,193,236, 65, 63,
-189,102, 52, 63,113,155, 54, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-189,102, 52, 63,113,155, 54, 63, 87, 97, 57, 63,200,160, 44, 63,132,171, 59, 63,255,204, 55, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 64, 63, 24, 28, 45, 63,132,171, 59, 63,255,204, 55, 63,
- 87, 97, 57, 63,200,160, 44, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 87, 97, 57, 63,200,160, 44, 63,189,102, 52, 63,113,155, 54, 63, 60,222, 50, 63,221, 52, 43, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,250,101, 54, 63, 51, 26, 99, 63,118,102, 38, 63, 19,114,105, 63,
-118,102, 38, 63, 77, 46, 94, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-118,102, 38, 63, 77, 46, 94, 63,108, 34, 50, 63,140, 64, 88, 63,250,101, 54, 63, 51, 26, 99, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 64, 63, 12, 56, 90, 63,250,101, 54, 63, 51, 26, 99, 63,
-108, 34, 50, 63,140, 64, 88, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-108, 34, 50, 63,140, 64, 88, 63,118,102, 38, 63, 77, 46, 94, 63,118,102, 38, 63, 38,228, 82, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,250,101, 54, 63, 51, 26, 99, 63, 0, 0, 64, 63, 12, 56, 90, 63,
- 6,154, 73, 63, 51, 26, 99, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 6,154, 73, 63, 51, 26, 99, 63, 0, 0, 64, 63,206,154,109, 63,250,101, 54, 63, 51, 26, 99, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,118,102, 38, 63, 19,114,105, 63,250,101, 54, 63, 51, 26, 99, 63,
- 0, 0, 64, 63,206,154,109, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 64, 63,206,154,109, 63, 6,154, 73, 63, 51, 26, 99, 63,138,153, 89, 63, 19,114,105, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,136,153, 89, 63,242,187,116, 63, 3,153, 59, 63, 0, 0,128, 63,
-120,102, 38, 63,242,187,116, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-120,102, 38, 63,242,187,116, 63, 0, 0, 64, 63,206,154,109, 63,136,153, 89, 63,242,187,116, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,138,153, 89, 63, 19,114,105, 63,136,153, 89, 63,242,187,116, 63,
- 0, 0, 64, 63,206,154,109, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 64, 63,206,154,109, 63,120,102, 38, 63,242,187,116, 63,118,102, 38, 63, 19,114,105, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,138,153, 89, 63, 77, 46, 94, 63,138,153, 89, 63, 19,114,105, 63,
- 6,154, 73, 63, 51, 26, 99, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 6,154, 73, 63, 51, 26, 99, 63,148,221, 77, 63,140, 64, 88, 63,138,153, 89, 63, 77, 46, 94, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,138,153, 89, 63, 39,228, 82, 63,138,153, 89, 63, 77, 46, 94, 63,
-148,221, 77, 63,140, 64, 88, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-148,221, 77, 63,140, 64, 88, 63, 6,154, 73, 63, 51, 26, 99, 63, 0, 0, 64, 63, 12, 56, 90, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,167, 71, 8, 62, 7,205, 55, 63,170,192,229, 61,200,236, 65, 63,
-203,104,214, 61,120,155, 54, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-203,104,214, 61,120,155, 54, 63,201, 61,254, 61,207,160, 44, 63,167, 71, 8, 62, 7,205, 55, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,173,153, 25, 62, 27, 28, 45, 63,167, 71, 8, 62, 7,205, 55, 63,
-201, 61,254, 61,207,160, 44, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-201, 61,254, 61,207,160, 44, 63,203,104,214, 61,120,155, 54, 63,175, 36,202, 61,228, 52, 43, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,145, 35,156, 61,172, 55, 52, 63,175, 36,202, 61,228, 52, 43, 63,
-203,104,214, 61,120,155, 54, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-203,104,214, 61,120,155, 54, 63, 32,242,163, 61, 96,233, 63, 63,145, 35,156, 61,172, 55, 52, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,246,203, 76, 61, 53, 86, 60, 63,145, 35,156, 61,172, 55, 52, 63,
- 32,242,163, 61, 96,233, 63, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 32,242,163, 61, 96,233, 63, 63,203,104,214, 61,120,155, 54, 63,170,192,229, 61,200,236, 65, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 17,213,174, 61,171, 39, 75, 63,243,203, 76, 61, 41,228, 82, 63,
-244,203, 76, 61, 2,154, 71, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-244,203, 76, 61, 2,154, 71, 63, 32,242,163, 61, 96,233, 63, 63, 17,213,174, 61,171, 39, 75, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,170,192,229, 61,200,236, 65, 63, 17,213,174, 61,171, 39, 75, 63,
- 32,242,163, 61, 96,233, 63, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 32,242,163, 61, 96,233, 63, 63,244,203, 76, 61, 2,154, 71, 63,246,203, 76, 61, 53, 86, 60, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,145, 35,156, 61,172, 55, 52, 63,246,203, 76, 61, 53, 86, 60, 63,
-243,203, 76, 61, 82, 12, 49, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-243,203, 76, 61, 82, 12, 49, 63, 53, 80,151, 61,223,228, 40, 63,145, 35,156, 61,172, 55, 52, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,175, 36,202, 61,228, 52, 43, 63,145, 35,156, 61,172, 55, 52, 63,
- 53, 80,151, 61,223,228, 40, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 53, 80,151, 61,223,228, 40, 63,243,203, 76, 61, 82, 12, 49, 63,246,203, 76, 61, 48,200, 37, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 17,213,174, 61,171, 39, 75, 63,170,192,229, 61,200,236, 65, 63,
-169, 27, 2, 62,204, 83, 78, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-169, 27, 2, 62,204, 83, 78, 63, 23, 70,196, 61,147, 64, 88, 63, 17,213,174, 61,171, 39, 75, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,243,203, 76, 61, 41,228, 82, 63, 17,213,174, 61,171, 39, 75, 63,
- 23, 70,196, 61,147, 64, 88, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 23, 70,196, 61,147, 64, 88, 63,169, 27, 2, 62,204, 83, 78, 63,160,153, 25, 62, 14, 56, 90, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,162, 23, 49, 62,195, 83, 78, 63,160,153, 25, 62, 14, 56, 90, 63,
-169, 27, 2, 62,204, 83, 78, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-169, 27, 2, 62,204, 83, 78, 63,172,153, 25, 62,108, 23, 67, 63,162, 23, 49, 62,195, 83, 78, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,240, 82, 64, 62,183,236, 65, 63,162, 23, 49, 62,195, 83, 78, 63,
-172,153, 25, 62,108, 23, 67, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-172,153, 25, 62,108, 23, 67, 63,169, 27, 2, 62,204, 83, 78, 63,170,192,229, 61,200,236, 65, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,167, 71, 8, 62, 7,205, 55, 63,173,153, 25, 62, 27, 28, 45, 63,
-173,235, 42, 62,254,204, 55, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-173,235, 42, 62,254,204, 55, 63,172,153, 25, 62,108, 23, 67, 63,167, 71, 8, 62, 7,205, 55, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,170,192,229, 61,200,236, 65, 63,167, 71, 8, 62, 7,205, 55, 63,
-172,153, 25, 62,108, 23, 67, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-172,153, 25, 62,108, 23, 67, 63,173,235, 42, 62,254,204, 55, 63,240, 82, 64, 62,183,236, 65, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,162, 23, 49, 62,195, 83, 78, 63,240, 82, 64, 62,183,236, 65, 63,
-166,200, 91, 62,147, 39, 75, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-166,200, 91, 62,147, 39, 75, 63, 34, 16, 81, 62,131, 64, 88, 63,162, 23, 49, 62,195, 83, 78, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,160,153, 25, 62, 14, 56, 90, 63,162, 23, 49, 62,195, 83, 78, 63,
- 34, 16, 81, 62,131, 64, 88, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 34, 16, 81, 62,131, 64, 88, 63,166,200, 91, 62,147, 39, 75, 63, 0, 0,128, 62, 13,228, 82, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,128, 62, 47, 12, 49, 63, 0, 0,128, 62, 19, 86, 60, 63,
- 92, 33,101, 62,146, 55, 52, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 92, 33,101, 62,146, 55, 52, 63, 14,139,103, 62,199,228, 40, 63, 0, 0,128, 62, 47, 12, 49, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,128, 62, 23,200, 37, 63, 0, 0,128, 62, 47, 12, 49, 63,
- 14,139,103, 62,199,228, 40, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 14,139,103, 62,199,228, 40, 63, 92, 33,101, 62,146, 55, 52, 63,230, 32, 78, 62,211, 52, 43, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,223,254, 71, 62,102,155, 54, 63,230, 32, 78, 62,211, 52, 43, 63,
- 92, 33,101, 62,146, 55, 52, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 92, 33,101, 62,146, 55, 52, 63, 23, 58, 97, 62, 69,233, 63, 63,223,254, 71, 62,102,155, 54, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,240, 82, 64, 62,183,236, 65, 63,223,254, 71, 62,102,155, 54, 63,
- 23, 58, 97, 62, 69,233, 63, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 23, 58, 97, 62, 69,233, 63, 63, 92, 33,101, 62,146, 55, 52, 63, 0, 0,128, 62, 19, 86, 60, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,128, 62,228,153, 71, 63, 0, 0,128, 62, 13,228, 82, 63,
-166,200, 91, 62,147, 39, 75, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-166,200, 91, 62,147, 39, 75, 63, 23, 58, 97, 62, 69,233, 63, 63, 0, 0,128, 62,228,153, 71, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,128, 62, 19, 86, 60, 63, 0, 0,128, 62,228,153, 71, 63,
- 23, 58, 97, 62, 69,233, 63, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 23, 58, 97, 62, 69,233, 63, 63,166,200, 91, 62,147, 39, 75, 63,240, 82, 64, 62,183,236, 65, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,223,254, 71, 62,102,155, 54, 63,240, 82, 64, 62,183,236, 65, 63,
-173,235, 42, 62,254,204, 55, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-173,235, 42, 62,254,204, 55, 63,105, 20, 52, 62,198,160, 44, 63,223,254, 71, 62,102,155, 54, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,230, 32, 78, 62,211, 52, 43, 63,223,254, 71, 62,102,155, 54, 63,
-105, 20, 52, 62,198,160, 44, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-105, 20, 52, 62,198,160, 44, 63,173,235, 42, 62,254,204, 55, 63,173,153, 25, 62, 27, 28, 45, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,128, 62, 58, 46, 94, 63, 0, 0,128, 62, 8,114,105, 63,
-230, 1, 64, 62, 49, 26, 99, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-230, 1, 64, 62, 49, 26, 99, 63, 34, 16, 81, 62,131, 64, 88, 63, 0, 0,128, 62, 58, 46, 94, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,128, 62, 13,228, 82, 63, 0, 0,128, 62, 58, 46, 94, 63,
- 34, 16, 81, 62,131, 64, 88, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 34, 16, 81, 62,131, 64, 88, 63,230, 1, 64, 62, 49, 26, 99, 63,160,153, 25, 62, 14, 56, 90, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,164, 98,230, 61, 58, 26, 99, 63,160,153, 25, 62, 14, 56, 90, 63,
-230, 1, 64, 62, 49, 26, 99, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-230, 1, 64, 62, 49, 26, 99, 63,159,153, 25, 62,210,154,109, 63,164, 98,230, 61, 58, 26, 99, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,237,203, 76, 61, 22,114,105, 63,164, 98,230, 61, 58, 26, 99, 63,
-159,153, 25, 62,210,154,109, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-159,153, 25, 62,210,154,109, 63,230, 1, 64, 62, 49, 26, 99, 63, 0, 0,128, 62, 8,114,105, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,128, 62,232,187,116, 63, 3,153, 59, 63, 0, 0,128, 63,
- 95,102,134, 63,242,187,116, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-210,203, 76, 61,242,187,116, 63,159,153, 25, 62,210,154,109, 63, 0, 0,128, 62,232,187,116, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,128, 62, 8,114,105, 63, 0, 0,128, 62,232,187,116, 63,
-159,153, 25, 62,210,154,109, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-159,153, 25, 62,210,154,109, 63,210,203, 76, 61,242,187,116, 63,237,203, 76, 61, 22,114,105, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,164, 98,230, 61, 58, 26, 99, 63,237,203, 76, 61, 22,114,105, 63,
-234,203, 76, 61, 79, 46, 94, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-234,203, 76, 61, 79, 46, 94, 63, 23, 70,196, 61,147, 64, 88, 63,164, 98,230, 61, 58, 26, 99, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,160,153, 25, 62, 14, 56, 90, 63,164, 98,230, 61, 58, 26, 99, 63,
- 23, 70,196, 61,147, 64, 88, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 23, 70,196, 61,147, 64, 88, 63,234,203, 76, 61, 79, 46, 94, 63,243,203, 76, 61, 41,228, 82, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 42,138,170, 62,254,204, 55, 63,136,214,159, 62,183,236, 65, 63,
-145, 0,156, 62,102,155, 54, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-145, 0,156, 62,102,155, 54, 63,204,245,165, 62,198,160, 44, 63, 42,138,170, 62,254,204, 55, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 42, 51,179, 62, 28, 28, 45, 63, 42,138,170, 62,254,204, 55, 63,
-204,245,165, 62,198,160, 44, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-204,245,165, 62,198,160, 44, 63,145, 0,156, 62,102,155, 54, 63,141,239,152, 62,211, 52, 43, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 82,111,141, 62,146, 55, 52, 63,141,239,152, 62,211, 52, 43, 63,
-145, 0,156, 62,102,155, 54, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-145, 0,156, 62,102,155, 54, 63,245, 98,143, 62, 68,233, 63, 63, 82,111,141, 62,146, 55, 52, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,128, 62, 19, 86, 60, 63, 82,111,141, 62,146, 55, 52, 63,
-245, 98,143, 62, 68,233, 63, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-245, 98,143, 62, 68,233, 63, 63,145, 0,156, 62,102,155, 54, 63,136,214,159, 62,183,236, 65, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,173, 27,146, 62,147, 39, 75, 63, 0, 0,128, 62, 13,228, 82, 63,
- 0, 0,128, 62,228,153, 71, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 0, 0,128, 62,228,153, 71, 63,245, 98,143, 62, 68,233, 63, 63,173, 27,146, 62,147, 39, 75, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,136,214,159, 62,183,236, 65, 63,173, 27,146, 62,147, 39, 75, 63,
-245, 98,143, 62, 68,233, 63, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-245, 98,143, 62, 68,233, 63, 63, 0, 0,128, 62,228,153, 71, 63, 0, 0,128, 62, 19, 86, 60, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 82,111,141, 62,146, 55, 52, 63, 0, 0,128, 62, 19, 86, 60, 63,
- 0, 0,128, 62, 47, 12, 49, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 0, 0,128, 62, 47, 12, 49, 63,121, 58,140, 62,199,228, 40, 63, 82,111,141, 62,146, 55, 52, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,141,239,152, 62,211, 52, 43, 63, 82,111,141, 62,146, 55, 52, 63,
-121, 58,140, 62,199,228, 40, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-121, 58,140, 62,199,228, 40, 63, 0, 0,128, 62, 47, 12, 49, 63, 0, 0,128, 62, 23,200, 37, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,173, 27,146, 62,147, 39, 75, 63,136,214,159, 62,183,236, 65, 63,
- 47,116,167, 62,195, 83, 78, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 47,116,167, 62,195, 83, 78, 63,239,119,151, 62,131, 64, 88, 63,173, 27,146, 62,147, 39, 75, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,128, 62, 13,228, 82, 63,173, 27,146, 62,147, 39, 75, 63,
-239,119,151, 62,131, 64, 88, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-239,119,151, 62,131, 64, 88, 63, 47,116,167, 62,195, 83, 78, 63, 49, 51,179, 62, 14, 56, 90, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 44,242,190, 62,205, 83, 78, 63, 49, 51,179, 62, 14, 56, 90, 63,
- 47,116,167, 62,195, 83, 78, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 47,116,167, 62,195, 83, 78, 63, 42, 51,179, 62,108, 23, 67, 63, 44,242,190, 62,205, 83, 78, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,214,143,198, 62,200,236, 65, 63, 44,242,190, 62,205, 83, 78, 63,
- 42, 51,179, 62,108, 23, 67, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 42, 51,179, 62,108, 23, 67, 63, 47,116,167, 62,195, 83, 78, 63,136,214,159, 62,183,236, 65, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 42,138,170, 62,254,204, 55, 63, 42, 51,179, 62, 28, 28, 45, 63,
- 45,220,187, 62, 7,205, 55, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 45,220,187, 62, 7,205, 55, 63, 42, 51,179, 62,108, 23, 67, 63, 42,138,170, 62,254,204, 55, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,136,214,159, 62,183,236, 65, 63, 42,138,170, 62,254,204, 55, 63,
- 42, 51,179, 62,108, 23, 67, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 42, 51,179, 62,108, 23, 67, 63, 45,220,187, 62, 7,205, 55, 63,214,143,198, 62,200,236, 65, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 44,242,190, 62,205, 83, 78, 63,214,143,198, 62,200,236, 65, 63,
-188, 74,212, 62,171, 39, 75, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-188, 74,212, 62,171, 39, 75, 63,122,238,206, 62,147, 64, 88, 63, 44,242,190, 62,205, 83, 78, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 49, 51,179, 62, 14, 56, 90, 63, 44,242,190, 62,205, 83, 78, 63,
-122,238,206, 62,147, 64, 88, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-122,238,206, 62,147, 64, 88, 63,188, 74,212, 62,171, 39, 75, 63,130,102,230, 62, 41,228, 82, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,130,102,230, 62, 82, 12, 49, 63,129,102,230, 62, 53, 86, 60, 63,
- 28,247,216, 62,172, 55, 52, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 28,247,216, 62,172, 55, 52, 63,243, 43,218, 62,223,228, 40, 63,130,102,230, 62, 82, 12, 49, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,129,102,230, 62, 48,200, 37, 63,130,102,230, 62, 82, 12, 49, 63,
-243, 43,218, 62,223,228, 40, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-243, 43,218, 62,223,228, 40, 63, 28,247,216, 62,172, 55, 52, 63,212,118,205, 62,228, 52, 43, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,206,101,202, 62,120,155, 54, 63,212,118,205, 62,228, 52, 43, 63,
- 28,247,216, 62,172, 55, 52, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 28,247,216, 62,172, 55, 52, 63,120, 3,215, 62, 95,233, 63, 63,206,101,202, 62,120,155, 54, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,214,143,198, 62,200,236, 65, 63,206,101,202, 62,120,155, 54, 63,
-120, 3,215, 62, 95,233, 63, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-120, 3,215, 62, 95,233, 63, 63, 28,247,216, 62,172, 55, 52, 63,129,102,230, 62, 53, 86, 60, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,130,102,230, 62, 1,154, 71, 63,130,102,230, 62, 41,228, 82, 63,
-188, 74,212, 62,171, 39, 75, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-188, 74,212, 62,171, 39, 75, 63,120, 3,215, 62, 95,233, 63, 63,130,102,230, 62, 1,154, 71, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,129,102,230, 62, 53, 86, 60, 63,130,102,230, 62, 1,154, 71, 63,
-120, 3,215, 62, 95,233, 63, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-120, 3,215, 62, 95,233, 63, 63,188, 74,212, 62,171, 39, 75, 63,214,143,198, 62,200,236, 65, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,206,101,202, 62,120,155, 54, 63,214,143,198, 62,200,236, 65, 63,
- 45,220,187, 62, 7,205, 55, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 45,220,187, 62, 7,205, 55, 63,142,112,192, 62,207,160, 44, 63,206,101,202, 62,120,155, 54, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,212,118,205, 62,228, 52, 43, 63,206,101,202, 62,120,155, 54, 63,
-142,112,192, 62,207,160, 44, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-142,112,192, 62,207,160, 44, 63, 45,220,187, 62, 7,205, 55, 63, 42, 51,179, 62, 28, 28, 45, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,131,102,230, 62, 79, 46, 94, 63,131,102,230, 62, 22,114,105, 63,
- 87,103,198, 62, 58, 26, 99, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 87,103,198, 62, 58, 26, 99, 63,122,238,206, 62,147, 64, 88, 63,131,102,230, 62, 79, 46, 94, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,130,102,230, 62, 41,228, 82, 63,131,102,230, 62, 79, 46, 94, 63,
-122,238,206, 62,147, 64, 88, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-122,238,206, 62,147, 64, 88, 63, 87,103,198, 62, 58, 26, 99, 63, 49, 51,179, 62, 14, 56, 90, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 14,255,159, 62, 49, 26, 99, 63, 49, 51,179, 62, 14, 56, 90, 63,
- 87,103,198, 62, 58, 26, 99, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 87,103,198, 62, 58, 26, 99, 63, 49, 51,179, 62,210,154,109, 63, 14,255,159, 62, 49, 26, 99, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,128, 62, 8,114,105, 63, 14,255,159, 62, 49, 26, 99, 63,
- 49, 51,179, 62,210,154,109, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 49, 51,179, 62,210,154,109, 63, 87,103,198, 62, 58, 26, 99, 63,131,102,230, 62, 22,114,105, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,134,102,230, 62,242,187,116, 63, 3,153, 59, 63, 0, 0,128, 63,
- 0, 0,128, 62,232,187,116, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 0, 0,128, 62,232,187,116, 63, 49, 51,179, 62,210,154,109, 63,134,102,230, 62,242,187,116, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,131,102,230, 62, 22,114,105, 63,134,102,230, 62,242,187,116, 63,
- 49, 51,179, 62,210,154,109, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 49, 51,179, 62,210,154,109, 63, 0, 0,128, 62,232,187,116, 63, 0, 0,128, 62, 8,114,105, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 14,255,159, 62, 49, 26, 99, 63, 0, 0,128, 62, 8,114,105, 63,
- 0, 0,128, 62, 58, 46, 94, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 0, 0,128, 62, 58, 46, 94, 63,239,119,151, 62,131, 64, 88, 63, 14,255,159, 62, 49, 26, 99, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 49, 51,179, 62, 14, 56, 90, 63, 14,255,159, 62, 49, 26, 99, 63,
-239,119,151, 62,131, 64, 88, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-239,119,151, 62,131, 64, 88, 63, 0, 0,128, 62, 58, 46, 94, 63, 0, 0,128, 62, 13,228, 82, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 93,120, 8, 63, 11,205, 55, 63,140, 30, 3, 63,201,236, 65, 63,
-145, 51, 1, 63,121,155, 54, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-145, 51, 1, 63,121,155, 54, 63, 46, 46, 6, 63,211,160, 44, 63, 93,120, 8, 63, 11,205, 55, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,220,204, 12, 63, 35, 28, 45, 63, 93,120, 8, 63, 11,205, 55, 63,
- 46, 46, 6, 63,211,160, 44, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 46, 46, 6, 63,211,160, 44, 63,145, 51, 1, 63,121,155, 54, 63, 30, 86,255, 62,230, 52, 43, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,222,213,243, 62,172, 55, 52, 63, 30, 86,255, 62,230, 52, 43, 63,
-145, 51, 1, 63,121,155, 54, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-145, 51, 1, 63,121,155, 54, 63,128,201,245, 62, 94,233, 63, 63,222,213,243, 62,172, 55, 52, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,129,102,230, 62, 53, 86, 60, 63,222,213,243, 62,172, 55, 52, 63,
-128,201,245, 62, 94,233, 63, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-128,201,245, 62, 94,233, 63, 63,145, 51, 1, 63,121,155, 54, 63,140, 30, 3, 63,201,236, 65, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 59,130,248, 62,169, 39, 75, 63,130,102,230, 62, 41,228, 82, 63,
-130,102,230, 62, 1,154, 71, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-130,102,230, 62, 1,154, 71, 63,128,201,245, 62, 94,233, 63, 63, 59,130,248, 62,169, 39, 75, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,140, 30, 3, 63,201,236, 65, 63, 59,130,248, 62,169, 39, 75, 63,
-128,201,245, 62, 94,233, 63, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-128,201,245, 62, 94,233, 63, 63,130,102,230, 62, 1,154, 71, 63,129,102,230, 62, 53, 86, 60, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,222,213,243, 62,172, 55, 52, 63,129,102,230, 62, 53, 86, 60, 63,
-130,102,230, 62, 82, 12, 49, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-130,102,230, 62, 82, 12, 49, 63, 9,161,242, 62,223,228, 40, 63,222,213,243, 62,172, 55, 52, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 30, 86,255, 62,230, 52, 43, 63,222,213,243, 62,172, 55, 52, 63,
- 9,161,242, 62,223,228, 40, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 9,161,242, 62,223,228, 40, 63,130,102,230, 62, 82, 12, 49, 63,129,102,230, 62, 48,200, 37, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 59,130,248, 62,169, 39, 75, 63,140, 30, 3, 63,201,236, 65, 63,
- 94,237, 6, 63,207, 83, 78, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 94,237, 6, 63,207, 83, 78, 63,118,222,253, 62,148, 64, 88, 63, 59,130,248, 62,169, 39, 75, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,130,102,230, 62, 41,228, 82, 63, 59,130,248, 62,169, 39, 75, 63,
-118,222,253, 62,148, 64, 88, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-118,222,253, 62,148, 64, 88, 63, 94,237, 6, 63,207, 83, 78, 63,220,204, 12, 63, 22, 56, 90, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 88,172, 18, 63,207, 83, 78, 63,220,204, 12, 63, 22, 56, 90, 63,
- 94,237, 6, 63,207, 83, 78, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 94,237, 6, 63,207, 83, 78, 63,220,204, 12, 63,115, 23, 67, 63, 88,172, 18, 63,207, 83, 78, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 44,123, 22, 63,201,236, 65, 63, 88,172, 18, 63,207, 83, 78, 63,
-220,204, 12, 63,115, 23, 67, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-220,204, 12, 63,115, 23, 67, 63, 94,237, 6, 63,207, 83, 78, 63,140, 30, 3, 63,201,236, 65, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 93,120, 8, 63, 11,205, 55, 63,220,204, 12, 63, 35, 28, 45, 63,
- 91, 33, 17, 63, 9,205, 55, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 91, 33, 17, 63, 9,205, 55, 63,220,204, 12, 63,115, 23, 67, 63, 93,120, 8, 63, 11,205, 55, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,140, 30, 3, 63,201,236, 65, 63, 93,120, 8, 63, 11,205, 55, 63,
-220,204, 12, 63,115, 23, 67, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-220,204, 12, 63,115, 23, 67, 63, 91, 33, 17, 63, 9,205, 55, 63, 44,123, 22, 63,201,236, 65, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 88,172, 18, 63,207, 83, 78, 63, 44,123, 22, 63,201,236, 65, 63,
-153, 88, 29, 63,167, 39, 75, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-153, 88, 29, 63,167, 39, 75, 63,121,170, 26, 63,147, 64, 88, 63, 88,172, 18, 63,207, 83, 78, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,220,204, 12, 63, 22, 56, 90, 63, 88,172, 18, 63,207, 83, 78, 63,
-121,170, 26, 63,147, 64, 88, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-121,170, 26, 63,147, 64, 88, 63,153, 88, 29, 63,167, 39, 75, 63,118,102, 38, 63, 38,228, 82, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,117,102, 38, 63, 78, 12, 49, 63,117,102, 38, 63, 50, 86, 60, 63,
-200,174, 31, 63,169, 55, 52, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-200,174, 31, 63,169, 55, 52, 63, 51, 73, 32, 63,221,228, 40, 63,117,102, 38, 63, 78, 12, 49, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,117,102, 38, 63, 45,200, 37, 63,117,102, 38, 63, 78, 12, 49, 63,
- 51, 73, 32, 63,221,228, 40, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 51, 73, 32, 63,221,228, 40, 63,200,174, 31, 63,169, 55, 52, 63,169,238, 25, 63,229, 52, 43, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 39,102, 24, 63,119,155, 54, 63,169,238, 25, 63,229, 52, 43, 63,
-200,174, 31, 63,169, 55, 52, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-200,174, 31, 63,169, 55, 52, 63,246,180, 30, 63, 92,233, 63, 63, 39,102, 24, 63,119,155, 54, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 44,123, 22, 63,201,236, 65, 63, 39,102, 24, 63,119,155, 54, 63,
-246,180, 30, 63, 92,233, 63, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-246,180, 30, 63, 92,233, 63, 63,200,174, 31, 63,169, 55, 52, 63,117,102, 38, 63, 50, 86, 60, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,117,102, 38, 63,255,153, 71, 63,118,102, 38, 63, 38,228, 82, 63,
-153, 88, 29, 63,167, 39, 75, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-153, 88, 29, 63,167, 39, 75, 63,246,180, 30, 63, 92,233, 63, 63,117,102, 38, 63,255,153, 71, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,117,102, 38, 63, 50, 86, 60, 63,117,102, 38, 63,255,153, 71, 63,
-246,180, 30, 63, 92,233, 63, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-246,180, 30, 63, 92,233, 63, 63,153, 88, 29, 63,167, 39, 75, 63, 44,123, 22, 63,201,236, 65, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 39,102, 24, 63,119,155, 54, 63, 44,123, 22, 63,201,236, 65, 63,
- 91, 33, 17, 63, 9,205, 55, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 91, 33, 17, 63, 9,205, 55, 63,138,107, 19, 63,211,160, 44, 63, 39,102, 24, 63,119,155, 54, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,169,238, 25, 63,229, 52, 43, 63, 39,102, 24, 63,119,155, 54, 63,
-138,107, 19, 63,211,160, 44, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-138,107, 19, 63,211,160, 44, 63, 91, 33, 17, 63, 9,205, 55, 63,220,204, 12, 63, 35, 28, 45, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,118,102, 38, 63, 77, 46, 94, 63,118,102, 38, 63, 19,114,105, 63,
-235,102, 22, 63, 59, 26, 99, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-235,102, 22, 63, 59, 26, 99, 63,121,170, 26, 63,147, 64, 88, 63,118,102, 38, 63, 77, 46, 94, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,118,102, 38, 63, 38,228, 82, 63,118,102, 38, 63, 77, 46, 94, 63,
-121,170, 26, 63,147, 64, 88, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-121,170, 26, 63,147, 64, 88, 63,235,102, 22, 63, 59, 26, 99, 63,220,204, 12, 63, 22, 56, 90, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,204, 50, 3, 63, 58, 26, 99, 63,220,204, 12, 63, 22, 56, 90, 63,
-235,102, 22, 63, 59, 26, 99, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-235,102, 22, 63, 59, 26, 99, 63,224,204, 12, 63,212,154,109, 63,204, 50, 3, 63, 58, 26, 99, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,131,102,230, 62, 22,114,105, 63,204, 50, 3, 63, 58, 26, 99, 63,
-224,204, 12, 63,212,154,109, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-224,204, 12, 63,212,154,109, 63,235,102, 22, 63, 59, 26, 99, 63,118,102, 38, 63, 19,114,105, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,120,102, 38, 63,242,187,116, 63, 3,153, 59, 63, 0, 0,128, 63,
-134,102,230, 62,242,187,116, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-134,102,230, 62,242,187,116, 63,224,204, 12, 63,212,154,109, 63,120,102, 38, 63,242,187,116, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,118,102, 38, 63, 19,114,105, 63,120,102, 38, 63,242,187,116, 63,
-224,204, 12, 63,212,154,109, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-224,204, 12, 63,212,154,109, 63,134,102,230, 62,242,187,116, 63,131,102,230, 62, 22,114,105, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,204, 50, 3, 63, 58, 26, 99, 63,131,102,230, 62, 22,114,105, 63,
-131,102,230, 62, 79, 46, 94, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-131,102,230, 62, 79, 46, 94, 63,118,222,253, 62,148, 64, 88, 63,204, 50, 3, 63, 58, 26, 99, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,220,204, 12, 63, 22, 56, 90, 63,204, 50, 3, 63, 58, 26, 99, 63,
-118,222,253, 62,148, 64, 88, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-118,222,253, 62,148, 64, 88, 63,131,102,230, 62, 79, 46, 94, 63,130,102,230, 62, 41,228, 82, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,213,233, 76, 63, 35, 48, 21, 63,176,235, 70, 63,226,209, 22, 63,
- 80,234, 73, 63,146,111, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 80,234, 73, 63,146,111, 11, 63, 1,200, 79, 63, 94,152, 9, 63,213,233, 76, 63, 35, 48, 21, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 19,215, 82, 63,252, 29, 19, 63,213,233, 76, 63, 35, 48, 21, 63,
- 1,200, 79, 63, 94,152, 9, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 1,200, 79, 63, 94,152, 9, 63, 80,234, 73, 63,146,111, 11, 63,193,204, 76, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,213,233, 76, 63, 35, 48, 21, 63, 19,215, 82, 63,252, 29, 19, 63,
-220, 41, 80, 63,105, 60, 31, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-220, 41, 80, 63,105, 60, 31, 63,164,219, 73, 63,173, 23, 33, 63,213,233, 76, 63, 35, 48, 21, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,176,235, 70, 63,226,209, 22, 63,213,233, 76, 63, 35, 48, 21, 63,
-164,219, 73, 63,173, 23, 33, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-164,219, 73, 63,173, 23, 33, 63,220, 41, 80, 63,105, 60, 31, 63,196, 33, 77, 63,221, 52, 43, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,169,158, 70, 63,200,160, 44, 63, 0, 0, 64, 63, 24, 28, 45, 63,
- 5,171, 67, 63,216, 17, 34, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 5,171, 67, 63,216, 17, 34, 63,164,219, 73, 63,173, 23, 33, 63,169,158, 70, 63,200,160, 44, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,196, 33, 77, 63,221, 52, 43, 63,169,158, 70, 63,200,160, 44, 63,
-164,219, 73, 63,173, 23, 33, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-164,219, 73, 63,173, 23, 33, 63, 5,171, 67, 63,216, 17, 34, 63,176,235, 70, 63,226,209, 22, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 75,124, 83, 63,217,228, 40, 63,196, 33, 77, 63,221, 52, 43, 63,
-220, 41, 80, 63,105, 60, 31, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-220, 41, 80, 63,105, 60, 31, 63,218, 20, 86, 63,143,140, 28, 63, 75,124, 83, 63,217,228, 40, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,139,153, 89, 63, 45,200, 37, 63, 75,124, 83, 63,217,228, 40, 63,
-218, 20, 86, 63,143,140, 28, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-218, 20, 86, 63,143,140, 28, 63,220, 41, 80, 63,105, 60, 31, 63, 19,215, 82, 63,252, 29, 19, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 64, 63,182, 32, 23, 63,176,235, 70, 63,226,209, 22, 63,
- 5,171, 67, 63,216, 17, 34, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 5,171, 67, 63,216, 17, 34, 63,251, 84, 60, 63,216, 17, 34, 63, 0, 0, 64, 63,182, 32, 23, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 80, 20, 57, 63,226,209, 22, 63, 0, 0, 64, 63,182, 32, 23, 63,
-251, 84, 60, 63,216, 17, 34, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-251, 84, 60, 63,216, 17, 34, 63, 5,171, 67, 63,216, 17, 34, 63, 0, 0, 64, 63, 24, 28, 45, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 64, 63,182, 32, 23, 63, 80, 20, 57, 63,226,209, 22, 63,
-169,156, 60, 63, 96,116, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-169,156, 60, 63, 96,116, 11, 63, 87, 99, 67, 63, 96,116, 11, 63, 0, 0, 64, 63,182, 32, 23, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,176,235, 70, 63,226,209, 22, 63, 0, 0, 64, 63,182, 32, 23, 63,
- 87, 99, 67, 63, 96,116, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 87, 99, 67, 63, 96,116, 11, 63,169,156, 60, 63, 96,116, 11, 63, 0, 0, 64, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 96,102, 70, 63,244, 1, 0, 63,193,204, 76, 63, 0, 0, 0, 63,
- 80,234, 73, 63,146,111, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 80,234, 73, 63,146,111, 11, 63, 87, 99, 67, 63, 96,116, 11, 63, 96,102, 70, 63,244, 1, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 64, 63, 0, 0, 0, 63, 96,102, 70, 63,244, 1, 0, 63,
- 87, 99, 67, 63, 96,116, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 87, 99, 67, 63, 96,116, 11, 63, 80,234, 73, 63,146,111, 11, 63,176,235, 70, 63,226,209, 22, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,160,153, 57, 63,244, 1, 0, 63, 0, 0, 64, 63, 0, 0, 0, 63,
-169,156, 60, 63, 96,116, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-169,156, 60, 63, 96,116, 11, 63,176, 21, 54, 63,146,111, 11, 63,160,153, 57, 63,244, 1, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 63, 51, 51, 63, 0, 0, 0, 63,160,153, 57, 63,244, 1, 0, 63,
-176, 21, 54, 63,146,111, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-176, 21, 54, 63,146,111, 11, 63,169,156, 60, 63, 96,116, 11, 63, 80, 20, 57, 63,226,209, 22, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 64, 63, 93, 58,217, 62,144, 61, 57, 63, 19,196,217, 62,
- 85,123, 60, 63,253,230,198, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 85,123, 60, 63,253,230,198, 62,171,132, 67, 63,253,230,198, 62, 0, 0, 64, 63, 93, 58,217, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,112,194, 70, 63, 19,196,217, 62, 0, 0, 64, 63, 93, 58,217, 62,
-171,132, 67, 63,253,230,198, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-171,132, 67, 63,253,230,198, 62, 85,123, 60, 63,253,230,198, 62, 0, 0, 64, 63,211,111,180, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 64, 63, 93, 58,217, 62,112,194, 70, 63, 19,196,217, 62,
-125, 84, 67, 63, 42,211,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-125, 84, 67, 63, 42,211,236, 62,131,171, 60, 63, 42,211,236, 62, 0, 0, 64, 63, 93, 58,217, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,144, 61, 57, 63, 19,196,217, 62, 0, 0, 64, 63, 93, 58,217, 62,
-131,171, 60, 63, 42,211,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-131,171, 60, 63, 42,211,236, 62,125, 84, 67, 63, 42,211,236, 62, 0, 0, 64, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,160,153, 57, 63,244, 1, 0, 63, 63, 51, 51, 63, 0, 0, 0, 63,
-128, 46, 54, 63, 75,207,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-128, 46, 54, 63, 75,207,236, 62,131,171, 60, 63, 42,211,236, 62,160,153, 57, 63,244, 1, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 64, 63, 0, 0, 0, 63,160,153, 57, 63,244, 1, 0, 63,
-131,171, 60, 63, 42,211,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-131,171, 60, 63, 42,211,236, 62,128, 46, 54, 63, 75,207,236, 62,144, 61, 57, 63, 19,196,217, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 96,102, 70, 63,244, 1, 0, 63, 0, 0, 64, 63, 0, 0, 0, 63,
-125, 84, 67, 63, 42,211,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-125, 84, 67, 63, 42,211,236, 62,128,209, 73, 63, 75,207,236, 62, 96,102, 70, 63,244, 1, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,193,204, 76, 63, 0, 0, 0, 63, 96,102, 70, 63,244, 1, 0, 63,
-128,209, 73, 63, 75,207,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-128,209, 73, 63, 75,207,236, 62,125, 84, 67, 63, 42,211,236, 62,112,194, 70, 63, 19,196,217, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 43, 22, 51, 63, 35, 48, 21, 63,237, 40, 45, 63,252, 29, 19, 63,
-255, 55, 48, 63, 94,152, 9, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-255, 55, 48, 63, 94,152, 9, 63,176, 21, 54, 63,146,111, 11, 63, 43, 22, 51, 63, 35, 48, 21, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 80, 20, 57, 63,226,209, 22, 63, 43, 22, 51, 63, 35, 48, 21, 63,
-176, 21, 54, 63,146,111, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-176, 21, 54, 63,146,111, 11, 63,255, 55, 48, 63, 94,152, 9, 63, 63, 51, 51, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 43, 22, 51, 63, 35, 48, 21, 63, 80, 20, 57, 63,226,209, 22, 63,
- 91, 36, 54, 63,173, 23, 33, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 91, 36, 54, 63,173, 23, 33, 63, 36,214, 47, 63,105, 60, 31, 63, 43, 22, 51, 63, 35, 48, 21, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,237, 40, 45, 63,252, 29, 19, 63, 43, 22, 51, 63, 35, 48, 21, 63,
- 36,214, 47, 63,105, 60, 31, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 36,214, 47, 63,105, 60, 31, 63, 91, 36, 54, 63,173, 23, 33, 63, 60,222, 50, 63,221, 52, 43, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,181,131, 44, 63,216,228, 40, 63,117,102, 38, 63, 45,200, 37, 63,
- 38,235, 41, 63,141,140, 28, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 38,235, 41, 63,141,140, 28, 63, 36,214, 47, 63,105, 60, 31, 63,181,131, 44, 63,216,228, 40, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 60,222, 50, 63,221, 52, 43, 63,181,131, 44, 63,216,228, 40, 63,
- 36,214, 47, 63,105, 60, 31, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 36,214, 47, 63,105, 60, 31, 63, 38,235, 41, 63,141,140, 28, 63,237, 40, 45, 63,252, 29, 19, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 87, 97, 57, 63,200,160, 44, 63, 60,222, 50, 63,221, 52, 43, 63,
- 91, 36, 54, 63,173, 23, 33, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 91, 36, 54, 63,173, 23, 33, 63,251, 84, 60, 63,216, 17, 34, 63, 87, 97, 57, 63,200,160, 44, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 64, 63, 24, 28, 45, 63, 87, 97, 57, 63,200,160, 44, 63,
-251, 84, 60, 63,216, 17, 34, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-251, 84, 60, 63,216, 17, 34, 63, 91, 36, 54, 63,173, 23, 33, 63, 80, 20, 57, 63,226,209, 22, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,134, 14,128, 63, 39, 48, 21, 63,227, 30,122, 63,233,209, 22, 63,
-138, 29,125, 63,150,111, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-138, 29,125, 63,150,111, 11, 63,159,125,129, 63, 94,152, 9, 63,134, 14,128, 63, 39, 48, 21, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,174, 73,193, 60,253, 29, 19, 63,209, 92,232, 57, 39, 48, 21, 63,
-114,207, 62, 60, 94,152, 9, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-159,125,129, 63, 94,152, 9, 63,138, 29,125, 63,150,111, 11, 63, 0, 0,128, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,209, 92,232, 57, 39, 48, 21, 63,174, 73,193, 60,253, 29, 19, 63,
-214, 67, 87, 60,110, 60, 31, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-136,174,129, 63,110, 60, 31, 63,213, 14,125, 63,180, 23, 33, 63,134, 14,128, 63, 39, 48, 21, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,227, 30,122, 63,233,209, 22, 63,134, 14,128, 63, 39, 48, 21, 63,
-213, 14,125, 63,180, 23, 33, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-213, 14,125, 63,180, 23, 33, 63,136,174,129, 63,110, 60, 31, 63,121, 42,128, 63,230, 52, 43, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,210,209,121, 63,212,160, 44, 63, 36, 51,115, 63, 36, 28, 45, 63,
- 49,222,118, 63,226, 17, 34, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 49,222,118, 63,226, 17, 34, 63,213, 14,125, 63,180, 23, 33, 63,210,209,121, 63,212,160, 44, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,121, 42,128, 63,230, 52, 43, 63,210,209,121, 63,212,160, 44, 63,
-213, 14,125, 63,180, 23, 33, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-213, 14,125, 63,180, 23, 33, 63, 49,222,118, 63,226, 17, 34, 63,227, 30,122, 63,233,209, 22, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,111,239,213, 60,223,228, 40, 63,120,226,169, 58,230, 52, 43, 63,
-214, 67, 87, 60,110, 60, 31, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-214, 67, 87, 60,110, 60, 31, 63, 13,129, 20, 61,143,140, 28, 63,111,239,213, 60,223,228, 40, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,246,203, 76, 61, 48,200, 37, 63,111,239,213, 60,223,228, 40, 63,
- 13,129, 20, 61,143,140, 28, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 13,129, 20, 61,143,140, 28, 63,214, 67, 87, 60,110, 60, 31, 63,174, 73,193, 60,253, 29, 19, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 44, 51,115, 63,188, 32, 23, 63,227, 30,122, 63,233,209, 22, 63,
- 49,222,118, 63,226, 17, 34, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 49,222,118, 63,226, 17, 34, 63, 31,136,111, 63,225, 17, 34, 63, 44, 51,115, 63,188, 32, 23, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,116, 71,108, 63,232,209, 22, 63, 44, 51,115, 63,188, 32, 23, 63,
- 31,136,111, 63,225, 17, 34, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 31,136,111, 63,225, 17, 34, 63, 49,222,118, 63,226, 17, 34, 63, 36, 51,115, 63, 36, 28, 45, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 44, 51,115, 63,188, 32, 23, 63,116, 71,108, 63,232,209, 22, 63,
-213,207,111, 63,100,116, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-213,207,111, 63,100,116, 11, 63,138,150,118, 63,101,116, 11, 63, 44, 51,115, 63,188, 32, 23, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,227, 30,122, 63,233,209, 22, 63, 44, 51,115, 63,188, 32, 23, 63,
-138,150,118, 63,101,116, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-138,150,118, 63,101,116, 11, 63,213,207,111, 63,100,116, 11, 63, 51, 51,115, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,154,153,121, 63,244, 1, 0, 63, 0, 0,128, 63, 0, 0, 0, 63,
-138, 29,125, 63,150,111, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-138, 29,125, 63,150,111, 11, 63,138,150,118, 63,101,116, 11, 63,154,153,121, 63,244, 1, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 51, 51,115, 63, 0, 0, 0, 63,154,153,121, 63,244, 1, 0, 63,
-138,150,118, 63,101,116, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-138,150,118, 63,101,116, 11, 63,138, 29,125, 63,150,111, 11, 63,227, 30,122, 63,233,209, 22, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,205,204,108, 63,244, 1, 0, 63, 51, 51,115, 63, 0, 0, 0, 63,
-213,207,111, 63,100,116, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-213,207,111, 63,100,116, 11, 63,213, 72,105, 63,149,111, 11, 63,205,204,108, 63,244, 1, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,101,102,102, 63, 0, 0, 0, 63,205,204,108, 63,244, 1, 0, 63,
-213, 72,105, 63,149,111, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-213, 72,105, 63,149,111, 11, 63,213,207,111, 63,100,116, 11, 63,116, 71,108, 63,232,209, 22, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 58, 51,115, 63, 73, 58,217, 62,192,112,108, 63, 4,196,217, 62,
-139,174,111, 63,223,230,198, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-139,174,111, 63,223,230,198, 62,239,183,118, 63,227,230,198, 62, 58, 51,115, 63, 73, 58,217, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,179,245,121, 63, 6,196,217, 62, 58, 51,115, 63, 73, 58,217, 62,
-239,183,118, 63,227,230,198, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-239,183,118, 63,227,230,198, 62,139,174,111, 63,223,230,198, 62, 65, 51,115, 63,160,111,180, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 58, 51,115, 63, 73, 58,217, 62,179,245,121, 63, 6,196,217, 62,
-185,135,118, 63, 30,211,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-185,135,118, 63, 30,211,236, 62,180,222,111, 63, 30,211,236, 62, 58, 51,115, 63, 73, 58,217, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,192,112,108, 63, 4,196,217, 62, 58, 51,115, 63, 73, 58,217, 62,
-180,222,111, 63, 30,211,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-180,222,111, 63, 30,211,236, 62,185,135,118, 63, 30,211,236, 62, 51, 51,115, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,205,204,108, 63,244, 1, 0, 63,101,102,102, 63, 0, 0, 0, 63,
-170, 97,105, 63, 65,207,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-170, 97,105, 63, 65,207,236, 62,180,222,111, 63, 30,211,236, 62,205,204,108, 63,244, 1, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 51, 51,115, 63, 0, 0, 0, 63,205,204,108, 63,244, 1, 0, 63,
-180,222,111, 63, 30,211,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-180,222,111, 63, 30,211,236, 62,170, 97,105, 63, 65,207,236, 62,192,112,108, 63, 4,196,217, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,154,153,121, 63,244, 1, 0, 63, 51, 51,115, 63, 0, 0, 0, 63,
-185,135,118, 63, 30,211,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-185,135,118, 63, 30,211,236, 62,194, 4,125, 63, 67,207,236, 62,154,153,121, 63,244, 1, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 63,154,153,121, 63,244, 1, 0, 63,
-194, 4,125, 63, 67,207,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-194, 4,125, 63, 67,207,236, 62,185,135,118, 63, 30,211,236, 62,179,245,121, 63, 6,196,217, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 76, 73,102, 63, 38, 48, 21, 63, 11, 92, 96, 63,253, 29, 19, 63,
- 33,107, 99, 63, 94,152, 9, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 33,107, 99, 63, 94,152, 9, 63,213, 72,105, 63,149,111, 11, 63, 76, 73,102, 63, 38, 48, 21, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,116, 71,108, 63,232,209, 22, 63, 76, 73,102, 63, 38, 48, 21, 63,
-213, 72,105, 63,149,111, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-213, 72,105, 63,149,111, 11, 63, 33,107, 99, 63, 94,152, 9, 63,101,102,102, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 76, 73,102, 63, 38, 48, 21, 63,116, 71,108, 63,232,209, 22, 63,
-124, 87,105, 63,180, 23, 33, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-124, 87,105, 63,180, 23, 33, 63, 65, 9, 99, 63,109, 60, 31, 63, 76, 73,102, 63, 38, 48, 21, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 11, 92, 96, 63,253, 29, 19, 63, 76, 73,102, 63, 38, 48, 21, 63,
- 65, 9, 99, 63,109, 60, 31, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 65, 9, 99, 63,109, 60, 31, 63,124, 87,105, 63,180, 23, 33, 63, 87, 17,102, 63,229, 52, 43, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,205,182, 95, 63,222,228, 40, 63,139,153, 89, 63, 45,200, 37, 63,
- 63, 30, 93, 63,143,140, 28, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 63, 30, 93, 63,143,140, 28, 63, 65, 9, 99, 63,109, 60, 31, 63,205,182, 95, 63,222,228, 40, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 87, 17,102, 63,229, 52, 43, 63,205,182, 95, 63,222,228, 40, 63,
- 65, 9, 99, 63,109, 60, 31, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 65, 9, 99, 63,109, 60, 31, 63, 63, 30, 93, 63,143,140, 28, 63, 11, 92, 96, 63,253, 29, 19, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,118,148,108, 63,211,160, 44, 63, 87, 17,102, 63,229, 52, 43, 63,
-124, 87,105, 63,180, 23, 33, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-124, 87,105, 63,180, 23, 33, 63, 31,136,111, 63,225, 17, 34, 63,118,148,108, 63,211,160, 44, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 36, 51,115, 63, 36, 28, 45, 63,118,148,108, 63,211,160, 44, 63,
- 31,136,111, 63,225, 17, 34, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 31,136,111, 63,225, 17, 34, 63,124, 87,105, 63,180, 23, 33, 63,116, 71,108, 63,232,209, 22, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 65, 65, 77, 62, 32, 48, 21, 63,152, 72, 53, 62,229,209, 22, 63,
- 47, 67, 65, 62,147,111, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 47, 67, 65, 62,147,111, 11, 63,255,185, 88, 62, 90,152, 9, 63, 65, 65, 77, 62, 32, 48, 21, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 64,246,100, 62,246, 29, 19, 63, 65, 65, 77, 62, 32, 48, 21, 63,
-255,185, 88, 62, 90,152, 9, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-255,185, 88, 62, 90,152, 9, 63, 47, 67, 65, 62,147,111, 11, 63,254,204, 76, 62, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 65, 65, 77, 62, 32, 48, 21, 63, 64,246,100, 62,246, 29, 19, 63,
- 89, 65, 90, 62, 94, 60, 31, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 89, 65, 90, 62, 94, 60, 31, 63,107, 8, 65, 62,170, 23, 33, 63, 65, 65, 77, 62, 32, 48, 21, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,152, 72, 53, 62,229,209, 22, 63, 65, 65, 77, 62, 32, 48, 21, 63,
-107, 8, 65, 62,170, 23, 33, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-107, 8, 65, 62,170, 23, 33, 63, 89, 65, 90, 62, 94, 60, 31, 63,230, 32, 78, 62,211, 52, 43, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,105, 20, 52, 62,198,160, 44, 63,173,153, 25, 62, 27, 28, 45, 63,
-216, 69, 40, 62,220, 17, 34, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-216, 69, 40, 62,220, 17, 34, 63,107, 8, 65, 62,170, 23, 33, 63,105, 20, 52, 62,198,160, 44, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,230, 32, 78, 62,211, 52, 43, 63,105, 20, 52, 62,198,160, 44, 63,
-107, 8, 65, 62,170, 23, 33, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-107, 8, 65, 62,170, 23, 33, 63,216, 69, 40, 62,220, 17, 34, 63,152, 72, 53, 62,229,209, 22, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 14,139,103, 62,199,228, 40, 63,230, 32, 78, 62,211, 52, 43, 63,
- 89, 65, 90, 62, 94, 60, 31, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 89, 65, 90, 62, 94, 60, 31, 63, 83,237,113, 62,130,140, 28, 63, 14,139,103, 62,199,228, 40, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,128, 62, 23,200, 37, 63, 14,139,103, 62,199,228, 40, 63,
- 83,237,113, 62,130,140, 28, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 83,237,113, 62,130,140, 28, 63, 89, 65, 90, 62, 94, 60, 31, 63, 64,246,100, 62,246, 29, 19, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,180,153, 25, 62,185, 32, 23, 63,152, 72, 53, 62,229,209, 22, 63,
-216, 69, 40, 62,220, 17, 34, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-216, 69, 40, 62,220, 17, 34, 63,133,237, 10, 62,219, 17, 34, 63,180,153, 25, 62,185, 32, 23, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,147,213,251, 61,228,209, 22, 63,180,153, 25, 62,185, 32, 23, 63,
-133,237, 10, 62,219, 17, 34, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-133,237, 10, 62,219, 17, 34, 63,216, 69, 40, 62,220, 17, 34, 63,173,153, 25, 62, 27, 28, 45, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,180,153, 25, 62,185, 32, 23, 63,147,213,251, 61,228,209, 22, 63,
- 67, 12, 12, 62, 98,116, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 67, 12, 12, 62, 98,116, 11, 63, 34, 39, 39, 62, 98,116, 11, 63,180,153, 25, 62,185, 32, 23, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,152, 72, 53, 62,229,209, 22, 63,180,153, 25, 62,185, 32, 23, 63,
- 34, 39, 39, 62, 98,116, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 34, 39, 39, 62, 98,116, 11, 63, 67, 12, 12, 62, 98,116, 11, 63,181,153, 25, 62, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 92, 51, 51, 62,244, 1, 0, 63,254,204, 76, 62, 0, 0, 0, 63,
- 47, 67, 65, 62,147,111, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 47, 67, 65, 62,147,111, 11, 63, 34, 39, 39, 62, 98,116, 11, 63, 92, 51, 51, 62,244, 1, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,181,153, 25, 62, 0, 0, 0, 63, 92, 51, 51, 62,244, 1, 0, 63,
- 34, 39, 39, 62, 98,116, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 34, 39, 39, 62, 98,116, 11, 63, 47, 67, 65, 62,147,111, 11, 63,152, 72, 53, 62,229,209, 22, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 8, 0, 0, 62,244, 1, 0, 63,181,153, 25, 62, 0, 0, 0, 63,
- 67, 12, 12, 62, 98,116, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 67, 12, 12, 62, 98,116, 11, 63,109,224,227, 61,147,111, 11, 63, 8, 0, 0, 62,244, 1, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,215,204,204, 61, 0, 0, 0, 63, 8, 0, 0, 62,244, 1, 0, 63,
-109,224,227, 61,147,111, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-109,224,227, 61,147,111, 11, 63, 67, 12, 12, 62, 98,116, 11, 63,147,213,251, 61,228,209, 22, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,196,153, 25, 62, 73, 58,217, 62,171, 31,253, 61, 6,196,217, 62,
- 1,135, 11, 62,228,230,198, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 1,135, 11, 62,228,230,198, 62,153,172, 39, 62,230,230,198, 62,196,153, 25, 62, 73, 58,217, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,179,163, 52, 62, 7,196,217, 62,196,153, 25, 62, 73, 58,217, 62,
-153,172, 39, 62,230,230,198, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-153,172, 39, 62,230,230,198, 62, 1,135, 11, 62,228,230,198, 62,214,153, 25, 62,165,111,180, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,196,153, 25, 62, 73, 58,217, 62,179,163, 52, 62, 7,196,217, 62,
-202,235, 38, 62, 33,211,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-202,235, 38, 62, 33,211,236, 62,173, 71, 12, 62, 31,211,236, 62,196,153, 25, 62, 73, 58,217, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,171, 31,253, 61, 6,196,217, 62,196,153, 25, 62, 73, 58,217, 62,
-173, 71, 12, 62, 31,211,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-173, 71, 12, 62, 31,211,236, 62,202,235, 38, 62, 33,211,236, 62,181,153, 25, 62, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 8, 0, 0, 62,244, 1, 0, 63,215,204,204, 61, 0, 0, 0, 63,
-251,166,228, 61, 67,207,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-251,166,228, 61, 67,207,236, 62,173, 71, 12, 62, 31,211,236, 62, 8, 0, 0, 62,244, 1, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,181,153, 25, 62, 0, 0, 0, 63, 8, 0, 0, 62,244, 1, 0, 63,
-173, 71, 12, 62, 31,211,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-173, 71, 12, 62, 31,211,236, 62,251,166,228, 61, 67,207,236, 62,171, 31,253, 61, 6,196,217, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 92, 51, 51, 62,244, 1, 0, 63,181,153, 25, 62, 0, 0, 0, 63,
-202,235, 38, 62, 33,211,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-202,235, 38, 62, 33,211,236, 62,251,223, 64, 62, 67,207,236, 62, 92, 51, 51, 62,244, 1, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,254,204, 76, 62, 0, 0, 0, 63, 92, 51, 51, 62,244, 1, 0, 63,
-251,223, 64, 62, 67,207,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-251,223, 64, 62, 67,207,236, 62,202,235, 38, 62, 33,211,236, 62,179,163, 52, 62, 7,196,217, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 42,228,203, 61, 37, 48, 21, 63, 1,122,156, 61,254, 29, 19, 63,
-172,242,180, 61, 96,152, 9, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-172,242,180, 61, 96,152, 9, 63,109,224,227, 61,147,111, 11, 63, 42,228,203, 61, 37, 48, 21, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,147,213,251, 61,228,209, 22, 63, 42,228,203, 61, 37, 48, 21, 63,
-109,224,227, 61,147,111, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-109,224,227, 61,147,111, 11, 63,172,242,180, 61, 96,152, 9, 63,215,204,204, 61, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 42,228,203, 61, 37, 48, 21, 63,147,213,251, 61,228,209, 22, 63,
-208, 85,228, 61,179, 23, 33, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-208, 85,228, 61,179, 23, 33, 63,212,227,177, 61,110, 60, 31, 63, 42,228,203, 61, 37, 48, 21, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1,122,156, 61,254, 29, 19, 63, 42,228,203, 61, 37, 48, 21, 63,
-212,227,177, 61,110, 60, 31, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-212,227,177, 61,110, 60, 31, 63,208, 85,228, 61,179, 23, 33, 63,175, 36,202, 61,228, 52, 43, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 53, 80,151, 61,223,228, 40, 63,246,203, 76, 61, 48,200, 37, 63,
-166,139,130, 61,145,140, 28, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-166,139,130, 61,145,140, 28, 63,212,227,177, 61,110, 60, 31, 63, 53, 80,151, 61,223,228, 40, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,175, 36,202, 61,228, 52, 43, 63, 53, 80,151, 61,223,228, 40, 63,
-212,227,177, 61,110, 60, 31, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-212,227,177, 61,110, 60, 31, 63,166,139,130, 61,145,140, 28, 63, 1,122,156, 61,254, 29, 19, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,201, 61,254, 61,207,160, 44, 63,175, 36,202, 61,228, 52, 43, 63,
-208, 85,228, 61,179, 23, 33, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-208, 85,228, 61,179, 23, 33, 63,133,237, 10, 62,219, 17, 34, 63,201, 61,254, 61,207,160, 44, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,173,153, 25, 62, 27, 28, 45, 63,201, 61,254, 61,207,160, 44, 63,
-133,237, 10, 62,219, 17, 34, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-133,237, 10, 62,219, 17, 34, 63,208, 85,228, 61,179, 23, 33, 63,147,213,251, 61,228,209, 22, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,245, 6,205, 62, 37, 48, 21, 63,155, 10,193, 62,229,209, 22, 63,
-229, 7,199, 62,147,111, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-229, 7,199, 62,147,111, 11, 63, 85,195,210, 62, 96,152, 9, 63,245, 6,205, 62, 37, 48, 21, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,128,225,216, 62,254, 29, 19, 63,245, 6,205, 62, 37, 48, 21, 63,
- 85,195,210, 62, 96,152, 9, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 85,195,210, 62, 96,152, 9, 63,229, 7,199, 62,147,111, 11, 63,202,204,204, 62, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,245, 6,205, 62, 37, 48, 21, 63,128,225,216, 62,254, 29, 19, 63,
- 11,135,211, 62,110, 60, 31, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 11,135,211, 62,110, 60, 31, 63,140,234,198, 62,179, 23, 33, 63,245, 6,205, 62, 37, 48, 21, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,155, 10,193, 62,229,209, 22, 63,245, 6,205, 62, 37, 48, 21, 63,
-140,234,198, 62,179, 23, 33, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-140,234,198, 62,179, 23, 33, 63, 11,135,211, 62,110, 60, 31, 63,212,118,205, 62,228, 52, 43, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,142,112,192, 62,207,160, 44, 63, 42, 51,179, 62, 28, 28, 45, 63,
- 61,137,186, 62,219, 17, 34, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 61,137,186, 62,219, 17, 34, 63,140,234,198, 62,179, 23, 33, 63,142,112,192, 62,207,160, 44, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,212,118,205, 62,228, 52, 43, 63,142,112,192, 62,207,160, 44, 63,
-140,234,198, 62,179, 23, 33, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-140,234,198, 62,179, 23, 33, 63, 61,137,186, 62,219, 17, 34, 63,155, 10,193, 62,229,209, 22, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,243, 43,218, 62,223,228, 40, 63,212,118,205, 62,228, 52, 43, 63,
- 11,135,211, 62,110, 60, 31, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 11,135,211, 62,110, 60, 31, 63, 22, 93,223, 62,145,140, 28, 63,243, 43,218, 62,223,228, 40, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,129,102,230, 62, 48,200, 37, 63,243, 43,218, 62,223,228, 40, 63,
- 22, 93,223, 62,145,140, 28, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 22, 93,223, 62,145,140, 28, 63, 11,135,211, 62,110, 60, 31, 63,128,225,216, 62,254, 29, 19, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 38, 51,179, 62,185, 32, 23, 63,155, 10,193, 62,229,209, 22, 63,
- 61,137,186, 62,219, 17, 34, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 61,137,186, 62,219, 17, 34, 63, 20,221,171, 62,219, 17, 34, 63, 38, 51,179, 62,185, 32, 23, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,180, 91,165, 62,229,209, 22, 63, 38, 51,179, 62,185, 32, 23, 63,
- 20,221,171, 62,219, 17, 34, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 20,221,171, 62,219, 17, 34, 63, 61,137,186, 62,219, 17, 34, 63, 42, 51,179, 62, 28, 28, 45, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 38, 51,179, 62,185, 32, 23, 63,180, 91,165, 62,229,209, 22, 63,
-111,108,172, 62, 98,116, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-111,108,172, 62, 98,116, 11, 63,222,249,185, 62, 98,116, 11, 63, 38, 51,179, 62,185, 32, 23, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,155, 10,193, 62,229,209, 22, 63, 38, 51,179, 62,185, 32, 23, 63,
-222,249,185, 62, 98,116, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-222,249,185, 62, 98,116, 11, 63,111,108,172, 62, 98,116, 11, 63, 38, 51,179, 62, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,252,255,191, 62,244, 1, 0, 63,202,204,204, 62, 0, 0, 0, 63,
-229, 7,199, 62,147,111, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-229, 7,199, 62,147,111, 11, 63,222,249,185, 62, 98,116, 11, 63,252,255,191, 62,244, 1, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 38, 51,179, 62, 0, 0, 0, 63,252,255,191, 62,244, 1, 0, 63,
-222,249,185, 62, 98,116, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-222,249,185, 62, 98,116, 11, 63,229, 7,199, 62,147,111, 11, 63,155, 10,193, 62,229,209, 22, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 82,102,166, 62,244, 1, 0, 63, 38, 51,179, 62, 0, 0, 0, 63,
-111,108,172, 62, 98,116, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-111,108,172, 62, 98,116, 11, 63,104, 94,159, 62,147,111, 11, 63, 82,102,166, 62,244, 1, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,129,153,153, 62, 0, 0, 0, 63, 82,102,166, 62,244, 1, 0, 63,
-104, 94,159, 62,147,111, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-104, 94,159, 62,147,111, 11, 63,111,108,172, 62, 98,116, 11, 63,180, 91,165, 62,229,209, 22, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 30, 51,179, 62, 73, 58,217, 62, 39,174,165, 62, 7,196,217, 62,
-180, 41,172, 62,227,230,198, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-180, 41,172, 62,227,230,198, 62,127, 60,186, 62,225,230,198, 62, 30, 51,179, 62, 73, 58,217, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 21,184,192, 62, 6,196,217, 62, 30, 51,179, 62, 73, 58,217, 62,
-127, 60,186, 62,225,230,198, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-127, 60,186, 62,225,230,198, 62,180, 41,172, 62,227,230,198, 62, 21, 51,179, 62,165,111,180, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 30, 51,179, 62, 73, 58,217, 62, 21,184,192, 62, 6,196,217, 62,
- 42,220,185, 62, 31,211,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 42,220,185, 62, 31,211,236, 62, 27,138,172, 62, 33,211,236, 62, 30, 51,179, 62, 73, 58,217, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 39,174,165, 62, 7,196,217, 62, 30, 51,179, 62, 73, 58,217, 62,
- 27,138,172, 62, 33,211,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 27,138,172, 62, 33,211,236, 62, 42,220,185, 62, 31,211,236, 62, 38, 51,179, 62, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 82,102,166, 62,244, 1, 0, 63,129,153,153, 62, 0, 0, 0, 63,
- 3,144,159, 62, 67,207,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 3,144,159, 62, 67,207,236, 62, 27,138,172, 62, 33,211,236, 62, 82,102,166, 62,244, 1, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 38, 51,179, 62, 0, 0, 0, 63, 82,102,166, 62,244, 1, 0, 63,
- 27,138,172, 62, 33,211,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 27,138,172, 62, 33,211,236, 62, 3,144,159, 62, 67,207,236, 62, 39,174,165, 62, 7,196,217, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,252,255,191, 62,244, 1, 0, 63, 38, 51,179, 62, 0, 0, 0, 63,
- 42,220,185, 62, 31,211,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 42,220,185, 62, 31,211,236, 62, 65,214,198, 62, 67,207,236, 62,252,255,191, 62,244, 1, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,202,204,204, 62, 0, 0, 0, 63,252,255,191, 62,244, 1, 0, 63,
- 65,214,198, 62, 67,207,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 65,214,198, 62, 67,207,236, 62, 42,220,185, 62, 31,211,236, 62, 21,184,192, 62, 6,196,217, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 95, 95,153, 62, 32, 48, 21, 63,224,132,141, 62,246, 29, 19, 63,
- 1,163,147, 62, 91,152, 9, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 1,163,147, 62, 91,152, 9, 63,104, 94,159, 62,147,111, 11, 63, 95, 95,153, 62, 32, 48, 21, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,180, 91,165, 62,229,209, 22, 63, 95, 95,153, 62, 32, 48, 21, 63,
-104, 94,159, 62,147,111, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-104, 94,159, 62,147,111, 11, 63, 1,163,147, 62, 91,152, 9, 63,129,153,153, 62, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 95, 95,153, 62, 32, 48, 21, 63,180, 91,165, 62,229,209, 22, 63,
-203,123,159, 62,170, 23, 33, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-203,123,159, 62,170, 23, 33, 63, 84,223,146, 62, 94, 60, 31, 63, 95, 95,153, 62, 32, 48, 21, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,224,132,141, 62,246, 29, 19, 63, 95, 95,153, 62, 32, 48, 21, 63,
- 84,223,146, 62, 94, 60, 31, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 84,223,146, 62, 94, 60, 31, 63,203,123,159, 62,170, 23, 33, 63,141,239,152, 62,211, 52, 43, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,121, 58,140, 62,199,228, 40, 63, 0, 0,128, 62, 23,200, 37, 63,
- 86, 9,135, 62,130,140, 28, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 86, 9,135, 62,130,140, 28, 63, 84,223,146, 62, 94, 60, 31, 63,121, 58,140, 62,199,228, 40, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,141,239,152, 62,211, 52, 43, 63,121, 58,140, 62,199,228, 40, 63,
- 84,223,146, 62, 94, 60, 31, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 84,223,146, 62, 94, 60, 31, 63, 86, 9,135, 62,130,140, 28, 63,224,132,141, 62,246, 29, 19, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,204,245,165, 62,198,160, 44, 63,141,239,152, 62,211, 52, 43, 63,
-203,123,159, 62,170, 23, 33, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-203,123,159, 62,170, 23, 33, 63, 20,221,171, 62,219, 17, 34, 63,204,245,165, 62,198,160, 44, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 42, 51,179, 62, 28, 28, 45, 63,204,245,165, 62,198,160, 44, 63,
- 20,221,171, 62,219, 17, 34, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 20,221,171, 62,219, 17, 34, 63,203,123,159, 62,170, 23, 33, 63,180, 91,165, 62,229,209, 22, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,180,182, 25, 63, 38, 48, 21, 63,140,184, 19, 63,232,209, 22, 63,
- 43,183, 22, 63,149,111, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 43,183, 22, 63,149,111, 11, 63,223,148, 28, 63, 94,152, 9, 63,180,182, 25, 63, 38, 48, 21, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,245,163, 31, 63,253, 29, 19, 63,180,182, 25, 63, 38, 48, 21, 63,
-223,148, 28, 63, 94,152, 9, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-223,148, 28, 63, 94,152, 9, 63, 43,183, 22, 63,149,111, 11, 63,155,153, 25, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,180,182, 25, 63, 38, 48, 21, 63,245,163, 31, 63,253, 29, 19, 63,
-191,246, 28, 63,109, 60, 31, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-191,246, 28, 63,109, 60, 31, 63,132,168, 22, 63,180, 23, 33, 63,180,182, 25, 63, 38, 48, 21, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,140,184, 19, 63,232,209, 22, 63,180,182, 25, 63, 38, 48, 21, 63,
-132,168, 22, 63,180, 23, 33, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-132,168, 22, 63,180, 23, 33, 63,191,246, 28, 63,109, 60, 31, 63,169,238, 25, 63,229, 52, 43, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,138,107, 19, 63,211,160, 44, 63,220,204, 12, 63, 35, 28, 45, 63,
-225,119, 16, 63,225, 17, 34, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-225,119, 16, 63,225, 17, 34, 63,132,168, 22, 63,180, 23, 33, 63,138,107, 19, 63,211,160, 44, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,169,238, 25, 63,229, 52, 43, 63,138,107, 19, 63,211,160, 44, 63,
-132,168, 22, 63,180, 23, 33, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-132,168, 22, 63,180, 23, 33, 63,225,119, 16, 63,225, 17, 34, 63,140,184, 19, 63,232,209, 22, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 51, 73, 32, 63,221,228, 40, 63,169,238, 25, 63,229, 52, 43, 63,
-191,246, 28, 63,109, 60, 31, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-191,246, 28, 63,109, 60, 31, 63,192,225, 34, 63,142,140, 28, 63, 51, 73, 32, 63,221,228, 40, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,117,102, 38, 63, 45,200, 37, 63, 51, 73, 32, 63,221,228, 40, 63,
-192,225, 34, 63,142,140, 28, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-192,225, 34, 63,142,140, 28, 63,191,246, 28, 63,109, 60, 31, 63,245,163, 31, 63,253, 29, 19, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,212,204, 12, 63,188, 32, 23, 63,140,184, 19, 63,232,209, 22, 63,
-225,119, 16, 63,225, 17, 34, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-225,119, 16, 63,225, 17, 34, 63,207, 33, 9, 63,226, 17, 34, 63,212,204, 12, 63,188, 32, 23, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 29,225, 5, 63,233,209, 22, 63,212,204, 12, 63,188, 32, 23, 63,
-207, 33, 9, 63,226, 17, 34, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-207, 33, 9, 63,226, 17, 34, 63,225,119, 16, 63,225, 17, 34, 63,220,204, 12, 63, 35, 28, 45, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,212,204, 12, 63,188, 32, 23, 63, 29,225, 5, 63,233,209, 22, 63,
-118,105, 9, 63,101,116, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-118,105, 9, 63,101,116, 11, 63, 43, 48, 16, 63,100,116, 11, 63,212,204, 12, 63,188, 32, 23, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,140,184, 19, 63,232,209, 22, 63,212,204, 12, 63,188, 32, 23, 63,
- 43, 48, 16, 63,100,116, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 43, 48, 16, 63,100,116, 11, 63,118,105, 9, 63,101,116, 11, 63,205,204, 12, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 51, 51, 19, 63,244, 1, 0, 63,155,153, 25, 63, 0, 0, 0, 63,
- 43,183, 22, 63,149,111, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 43,183, 22, 63,149,111, 11, 63, 43, 48, 16, 63,100,116, 11, 63, 51, 51, 19, 63,244, 1, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,205,204, 12, 63, 0, 0, 0, 63, 51, 51, 19, 63,244, 1, 0, 63,
- 43, 48, 16, 63,100,116, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 43, 48, 16, 63,100,116, 11, 63, 43,183, 22, 63,149,111, 11, 63,140,184, 19, 63,232,209, 22, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,102,102, 6, 63,244, 1, 0, 63,205,204, 12, 63, 0, 0, 0, 63,
-118,105, 9, 63,101,116, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-118,105, 9, 63,101,116, 11, 63,118,226, 2, 63,149,111, 11, 63,102,102, 6, 63,244, 1, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63,102,102, 6, 63,244, 1, 0, 63,
-118,226, 2, 63,149,111, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-118,226, 2, 63,149,111, 11, 63,118,105, 9, 63,101,116, 11, 63, 29,225, 5, 63,233,209, 22, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,198,204, 12, 63, 72, 58,217, 62, 77, 10, 6, 63, 6,196,217, 62,
- 17, 72, 9, 63,227,230,198, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 17, 72, 9, 63,227,230,198, 62,117, 81, 16, 63,223,230,198, 62,198,204, 12, 63, 72, 58,217, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 64,143, 19, 63, 4,196,217, 62,198,204, 12, 63, 72, 58,217, 62,
-117, 81, 16, 63,223,230,198, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-117, 81, 16, 63,223,230,198, 62, 17, 72, 9, 63,227,230,198, 62,191,204, 12, 63,160,111,180, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,198,204, 12, 63, 72, 58,217, 62, 64,143, 19, 63, 4,196,217, 62,
- 76, 33, 16, 63, 30,211,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 76, 33, 16, 63, 30,211,236, 62, 71,120, 9, 63, 30,211,236, 62,198,204, 12, 63, 72, 58,217, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 77, 10, 6, 63, 6,196,217, 62,198,204, 12, 63, 72, 58,217, 62,
- 71,120, 9, 63, 30,211,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 71,120, 9, 63, 30,211,236, 62, 76, 33, 16, 63, 30,211,236, 62,205,204, 12, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,102,102, 6, 63,244, 1, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63,
- 62,251, 2, 63, 67,207,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 62,251, 2, 63, 67,207,236, 62, 71,120, 9, 63, 30,211,236, 62,102,102, 6, 63,244, 1, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,205,204, 12, 63, 0, 0, 0, 63,102,102, 6, 63,244, 1, 0, 63,
- 71,120, 9, 63, 30,211,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 71,120, 9, 63, 30,211,236, 62, 62,251, 2, 63, 67,207,236, 62, 77, 10, 6, 63, 6,196,217, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 51, 51, 19, 63,244, 1, 0, 63,205,204, 12, 63, 0, 0, 0, 63,
- 76, 33, 16, 63, 30,211,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 76, 33, 16, 63, 30,211,236, 62, 86,158, 22, 63, 65,207,236, 62, 51, 51, 19, 63,244, 1, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,155,153, 25, 63, 0, 0, 0, 63, 51, 51, 19, 63,244, 1, 0, 63,
- 86,158, 22, 63, 65,207,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 86,158, 22, 63, 65,207,236, 62, 76, 33, 16, 63, 30,211,236, 62, 64,143, 19, 63, 4,196,217, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,233,197,255, 62, 39, 48, 21, 63,101,235,243, 62,252, 29, 19, 63,
-132, 9,250, 62, 94,152, 9, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-132, 9,250, 62, 94,152, 9, 63,118,226, 2, 63,149,111, 11, 63,233,197,255, 62, 39, 48, 21, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 29,225, 5, 63,233,209, 22, 63,233,197,255, 62, 39, 48, 21, 63,
-118,226, 2, 63,149,111, 11, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-118,226, 2, 63,149,111, 11, 63,132, 9,250, 62, 94,152, 9, 63, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,233,197,255, 62, 39, 48, 21, 63, 29,225, 5, 63,233,209, 22, 63,
- 43,241, 2, 63,181, 23, 33, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 43,241, 2, 63,181, 23, 33, 63,225, 69,249, 62,110, 60, 31, 63,233,197,255, 62, 39, 48, 21, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,101,235,243, 62,252, 29, 19, 63,233,197,255, 62, 39, 48, 21, 63,
-225, 69,249, 62,110, 60, 31, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-225, 69,249, 62,110, 60, 31, 63, 43,241, 2, 63,181, 23, 33, 63, 30, 86,255, 62,230, 52, 43, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 9,161,242, 62,223,228, 40, 63,129,102,230, 62, 48,200, 37, 63,
-222,111,237, 62,143,140, 28, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-222,111,237, 62,143,140, 28, 63,225, 69,249, 62,110, 60, 31, 63, 9,161,242, 62,223,228, 40, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 30, 86,255, 62,230, 52, 43, 63, 9,161,242, 62,223,228, 40, 63,
-225, 69,249, 62,110, 60, 31, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-225, 69,249, 62,110, 60, 31, 63,222,111,237, 62,143,140, 28, 63,101,235,243, 62,252, 29, 19, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 46, 46, 6, 63,211,160, 44, 63, 30, 86,255, 62,230, 52, 43, 63,
- 43,241, 2, 63,181, 23, 33, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 43,241, 2, 63,181, 23, 33, 63,207, 33, 9, 63,226, 17, 34, 63, 46, 46, 6, 63,211,160, 44, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,220,204, 12, 63, 35, 28, 45, 63, 46, 46, 6, 63,211,160, 44, 63,
-207, 33, 9, 63,226, 17, 34, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-207, 33, 9, 63,226, 17, 34, 63, 43,241, 2, 63,181, 23, 33, 63, 29,225, 5, 63,233,209, 22, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,138,238, 85, 63, 72,220,187, 62,218,173, 82, 63, 55, 92,210, 62,
-229,189, 79, 63,173,208,189, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-229,189, 79, 63,173,208,189, 62,230,250, 82, 63,117,190,166, 62,138,238, 85, 63, 72,220,187, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,149,153, 89, 63,201,199,165, 62,138,238, 85, 63, 72,220,187, 62,
-230,250, 82, 63,117,190,166, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-230,250, 82, 63,117,190,166, 62,229,189, 79, 63,173,208,189, 62,198,119, 76, 63, 90,150,169, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,170,111, 73, 63, 68,135,193, 62,198,119, 76, 63, 90,150,169, 62,
-229,189, 79, 63,173,208,189, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-229,189, 79, 63,173,208,189, 62,176,175, 76, 63,192,159,213, 62,170,111, 73, 63, 68,135,193, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,112,194, 70, 63, 19,196,217, 62,170,111, 73, 63, 68,135,193, 62,
-176,175, 76, 63,192,159,213, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-176,175, 76, 63,192,159,213, 62,229,189, 79, 63,173,208,189, 62,218,173, 82, 63, 55, 92,210, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 52,175, 79, 63,218, 32,233, 62,193,204, 76, 63, 0, 0, 0, 63,
-128,209, 73, 63, 75,207,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-128,209, 73, 63, 75,207,236, 62,176,175, 76, 63,192,159,213, 62, 52,175, 79, 63,218, 32,233, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,218,173, 82, 63, 55, 92,210, 62, 52,175, 79, 63,218, 32,233, 62,
-176,175, 76, 63,192,159,213, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-176,175, 76, 63,192,159,213, 62,128,209, 73, 63, 75,207,236, 62,112,194, 70, 63, 19,196,217, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,170,111, 73, 63, 68,135,193, 62,112,194, 70, 63, 19,196,217, 62,
-171,132, 67, 63,253,230,198, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-171,132, 67, 63,253,230,198, 62, 61, 29, 70, 63,114, 54,174, 62,170,111, 73, 63, 68,135,193, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,198,119, 76, 63, 90,150,169, 62,170,111, 73, 63, 68,135,193, 62,
- 61, 29, 70, 63,114, 54,174, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 61, 29, 70, 63,114, 54,174, 62,171,132, 67, 63,253,230,198, 62, 0, 0, 64, 63,211,111,180, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 52,175, 79, 63,218, 32,233, 62,218,173, 82, 63, 55, 92,210, 62,
- 56, 54, 86, 63, 58, 23,233, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 56, 54, 86, 63, 58, 23,233, 62, 41, 51, 83, 63, 24,252,255, 62, 52,175, 79, 63,218, 32,233, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,193,204, 76, 63, 0, 0, 0, 63, 52,175, 79, 63,218, 32,233, 62,
- 41, 51, 83, 63, 24,252,255, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 41, 51, 83, 63, 24,252,255, 62, 56, 54, 86, 63, 58, 23,233, 62,147,153, 89, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,239,252, 92, 63, 58, 23,233, 62,147,153, 89, 63, 0, 0, 0, 63,
- 56, 54, 86, 63, 58, 23,233, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 56, 54, 86, 63, 58, 23,233, 62,147,153, 89, 63,143,190,209, 62,239,252, 92, 63, 58, 23,233, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 78,133, 96, 63, 55, 92,210, 62,239,252, 92, 63, 58, 23,233, 62,
-147,153, 89, 63,143,190,209, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-147,153, 89, 63,143,190,209, 62, 56, 54, 86, 63, 58, 23,233, 62,218,173, 82, 63, 55, 92,210, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,138,238, 85, 63, 72,220,187, 62,149,153, 89, 63,201,199,165, 62,
-159, 68, 93, 63, 72,220,187, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-159, 68, 93, 63, 72,220,187, 62,147,153, 89, 63,143,190,209, 62,138,238, 85, 63, 72,220,187, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,218,173, 82, 63, 55, 92,210, 62,138,238, 85, 63, 72,220,187, 62,
-147,153, 89, 63,143,190,209, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-147,153, 89, 63,143,190,209, 62,159, 68, 93, 63, 72,220,187, 62, 78,133, 96, 63, 55, 92,210, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,239,252, 92, 63, 58, 23,233, 62, 78,133, 96, 63, 55, 92,210, 62,
-242,131, 99, 63,218, 32,233, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-242,131, 99, 63,218, 32,233, 62,254,255, 95, 63, 24,252,255, 62,239,252, 92, 63, 58, 23,233, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,147,153, 89, 63, 0, 0, 0, 63,239,252, 92, 63, 58, 23,233, 62,
-254,255, 95, 63, 24,252,255, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-254,255, 95, 63, 24,252,255, 62,242,131, 99, 63,218, 32,233, 62,101,102,102, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,139,174,111, 63,223,230,198, 62,192,112,108, 63, 4,196,217, 62,
-133,195,105, 63, 37,135,193, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-133,195,105, 63, 37,135,193, 62,249, 21,109, 63, 65, 54,174, 62,139,174,111, 63,223,230,198, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 65, 51,115, 63,160,111,180, 62,139,174,111, 63,223,230,198, 62,
-249, 21,109, 63, 65, 54,174, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-249, 21,109, 63, 65, 54,174, 62,133,195,105, 63, 37,135,193, 62,106,187,102, 63, 54,150,169, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 70,117, 99, 63,155,208,189, 62,106,187,102, 63, 54,150,169, 62,
-133,195,105, 63, 37,135,193, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-133,195,105, 63, 37,135,193, 62,123,131,102, 63,181,159,213, 62, 70,117, 99, 63,155,208,189, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 78,133, 96, 63, 55, 92,210, 62, 70,117, 99, 63,155,208,189, 62,
-123,131,102, 63,181,159,213, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-123,131,102, 63,181,159,213, 62,133,195,105, 63, 37,135,193, 62,192,112,108, 63, 4,196,217, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,170, 97,105, 63, 65,207,236, 62,101,102,102, 63, 0, 0, 0, 63,
-242,131, 99, 63,218, 32,233, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-242,131, 99, 63,218, 32,233, 62,123,131,102, 63,181,159,213, 62,170, 97,105, 63, 65,207,236, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,192,112,108, 63, 4,196,217, 62,170, 97,105, 63, 65,207,236, 62,
-123,131,102, 63,181,159,213, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-123,131,102, 63,181,159,213, 62,242,131, 99, 63,218, 32,233, 62, 78,133, 96, 63, 55, 92,210, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 70,117, 99, 63,155,208,189, 62, 78,133, 96, 63, 55, 92,210, 62,
-159, 68, 93, 63, 72,220,187, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-159, 68, 93, 63, 72,220,187, 62, 71, 56, 96, 63, 99,190,166, 62, 70,117, 99, 63,155,208,189, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,106,187,102, 63, 54,150,169, 62, 70,117, 99, 63,155,208,189, 62,
- 71, 56, 96, 63, 99,190,166, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 71, 56, 96, 63, 99,190,166, 62,159, 68, 93, 63, 72,220,187, 62,149,153, 89, 63,201,199,165, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 33,107, 99, 63, 94,152, 9, 63, 11, 92, 96, 63,253, 29, 19, 63,
- 21,238, 92, 63,112,150, 9, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 21,238, 92, 63,112,150, 9, 63,254,255, 95, 63, 24,252,255, 62, 33,107, 99, 63, 94,152, 9, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,101,102,102, 63, 0, 0, 0, 63, 33,107, 99, 63, 94,152, 9, 63,
-254,255, 95, 63, 24,252,255, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-254,255, 95, 63, 24,252,255, 62, 21,238, 92, 63,112,150, 9, 63,147,153, 89, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 14, 69, 86, 63,112,150, 9, 63,147,153, 89, 63, 0, 0, 0, 63,
- 21,238, 92, 63,112,150, 9, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 21,238, 92, 63,112,150, 9, 63,143,153, 89, 63,219, 98, 19, 63, 14, 69, 86, 63,112,150, 9, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 19,215, 82, 63,252, 29, 19, 63, 14, 69, 86, 63,112,150, 9, 63,
-143,153, 89, 63,219, 98, 19, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-143,153, 89, 63,219, 98, 19, 63, 21,238, 92, 63,112,150, 9, 63, 11, 92, 96, 63,253, 29, 19, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 63, 30, 93, 63,143,140, 28, 63,139,153, 89, 63, 45,200, 37, 63,
-218, 20, 86, 63,143,140, 28, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-218, 20, 86, 63,143,140, 28, 63,143,153, 89, 63,219, 98, 19, 63, 63, 30, 93, 63,143,140, 28, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 11, 92, 96, 63,253, 29, 19, 63, 63, 30, 93, 63,143,140, 28, 63,
-143,153, 89, 63,219, 98, 19, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-143,153, 89, 63,219, 98, 19, 63,218, 20, 86, 63,143,140, 28, 63, 19,215, 82, 63,252, 29, 19, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 14, 69, 86, 63,112,150, 9, 63, 19,215, 82, 63,252, 29, 19, 63,
- 1,200, 79, 63, 94,152, 9, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 1,200, 79, 63, 94,152, 9, 63, 41, 51, 83, 63, 24,252,255, 62, 14, 69, 86, 63,112,150, 9, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,147,153, 89, 63, 0, 0, 0, 63, 14, 69, 86, 63,112,150, 9, 63,
- 41, 51, 83, 63, 24,252,255, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 41, 51, 83, 63, 24,252,255, 62, 1,200, 79, 63, 94,152, 9, 63,193,204, 76, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,237, 28, 18, 61, 60,220,187, 62,151, 35,188, 60, 46, 92,210, 62,
-218, 74, 60, 60,150,208,189, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-218, 74, 60, 60,150,208,189, 62,195,197,197, 60, 89,190,166, 62,237, 28, 18, 61, 60,220,187, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,194,205, 76, 61,186,199,165, 62,237, 28, 18, 61, 60,220,187, 62,
-195,197,197, 60, 89,190,166, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 23, 23,131, 63, 89,190,166, 62,150,120,129, 63,150,208,189, 62, 15,171,127, 63, 52,150,169, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,241,162,124, 63, 36,135,193, 62, 15,171,127, 63, 52,150,169, 62,
-150,120,129, 63,150,208,189, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-150,120,129, 63,150,208,189, 62,244,226,127, 63,179,159,213, 62,241,162,124, 63, 36,135,193, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,179,245,121, 63, 6,196,217, 62,241,162,124, 63, 36,135,193, 62,
-244,226,127, 63,179,159,213, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-244,226,127, 63,179,159,213, 62,150,120,129, 63,150,208,189, 62,142,240,130, 63, 46, 92,210, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 59,113,129, 63,214, 32,233, 62, 0, 0,128, 63, 0, 0, 0, 63,
-194, 4,125, 63, 67,207,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-194, 4,125, 63, 67,207,236, 62,244,226,127, 63,179,159,213, 62, 59,113,129, 63,214, 32,233, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,142,240,130, 63, 46, 92,210, 62, 59,113,129, 63,214, 32,233, 62,
-244,226,127, 63,179,159,213, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-244,226,127, 63,179,159,213, 62,194, 4,125, 63, 67,207,236, 62,179,245,121, 63, 6,196,217, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,241,162,124, 63, 36,135,193, 62,179,245,121, 63, 6,196,217, 62,
-239,183,118, 63,227,230,198, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-239,183,118, 63,227,230,198, 62,133, 80,121, 63, 65, 54,174, 62,241,162,124, 63, 36,135,193, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 15,171,127, 63, 52,150,169, 62,241,162,124, 63, 36,135,193, 62,
-133, 80,121, 63, 65, 54,174, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-133, 80,121, 63, 65, 54,174, 62,239,183,118, 63,227,230,198, 62, 65, 51,115, 63,160,111,180, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,110,157, 56, 60,214, 32,233, 62,151, 35,188, 60, 46, 92,210, 62,
- 95,151, 22, 61, 55, 23,233, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 95,151, 22, 61, 55, 23,233, 62,176,204,204, 60, 24,252,255, 62,110,157, 56, 60,214, 32,233, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,167, 79, 11, 38, 0, 0, 0, 63,110,157, 56, 60,214, 32,233, 62,
-176,204,204, 60, 24,252,255, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-176,204,204, 60, 24,252,255, 62, 95,151, 22, 61, 55, 23,233, 62,215,204, 76, 61, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 87,129,129, 61, 57, 23,233, 62,215,204, 76, 61, 0, 0, 0, 63,
- 95,151, 22, 61, 55, 23,233, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 95,151, 22, 61, 55, 23,233, 62, 68,205, 76, 61,135,190,209, 62, 87,129,129, 61, 57, 23,233, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 92,196,157, 61, 49, 92,210, 62, 87,129,129, 61, 57, 23,233, 62,
- 68,205, 76, 61,135,190,209, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 68,205, 76, 61,135,190,209, 62, 95,151, 22, 61, 55, 23,233, 62,151, 35,188, 60, 46, 92,210, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,237, 28, 18, 61, 60,220,187, 62,194,205, 76, 61,186,199,165, 62,
- 7,191,131, 61, 62,220,187, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 7,191,131, 61, 62,220,187, 62, 68,205, 76, 61,135,190,209, 62,237, 28, 18, 61, 60,220,187, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,151, 35,188, 60, 46, 92,210, 62,237, 28, 18, 61, 60,220,187, 62,
- 68,205, 76, 61,135,190,209, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 68,205, 76, 61,135,190,209, 62, 7,191,131, 61, 62,220,187, 62, 92,196,157, 61, 49, 92,210, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 87,129,129, 61, 57, 23,233, 62, 92,196,157, 61, 49, 92,210, 62,
- 89,185,181, 61,214, 32,233, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 89,185,181, 61,214, 32,233, 62,154,153,153, 61, 25,252,255, 62, 87,129,129, 61, 57, 23,233, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,215,204, 76, 61, 0, 0, 0, 63, 87,129,129, 61, 57, 23,233, 62,
-154,153,153, 61, 25,252,255, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-154,153,153, 61, 25,252,255, 62, 89,185,181, 61,214, 32,233, 62,215,204,204, 61, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1,135, 11, 62,228,230,198, 62,171, 31,253, 61, 6,196,217, 62,
-251,181,231, 61, 38,135,193, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-251,181,231, 61, 38,135,193, 62,204, 36, 1, 62, 70, 54,174, 62, 1,135, 11, 62,228,230,198, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,214,153, 25, 62,165,111,180, 62, 1,135, 11, 62,228,230,198, 62,
-204, 36, 1, 62, 70, 54,174, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-204, 36, 1, 62, 70, 54,174, 62,251,181,231, 61, 38,135,193, 62, 70,117,207, 61, 54,150,169, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 35, 68,181, 61,153,208,189, 62, 70,117,207, 61, 54,150,169, 62,
-251,181,231, 61, 38,135,193, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-251,181,231, 61, 38,135,193, 62,164,181,205, 61,180,159,213, 62, 35, 68,181, 61,153,208,189, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 92,196,157, 61, 49, 92,210, 62, 35, 68,181, 61,153,208,189, 62,
-164,181,205, 61,180,159,213, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-164,181,205, 61,180,159,213, 62,251,181,231, 61, 38,135,193, 62,171, 31,253, 61, 6,196,217, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,251,166,228, 61, 67,207,236, 62,215,204,204, 61, 0, 0, 0, 63,
- 89,185,181, 61,214, 32,233, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 89,185,181, 61,214, 32,233, 62,164,181,205, 61,180,159,213, 62,251,166,228, 61, 67,207,236, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,171, 31,253, 61, 6,196,217, 62,251,166,228, 61, 67,207,236, 62,
-164,181,205, 61,180,159,213, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-164,181,205, 61,180,159,213, 62, 89,185,181, 61,214, 32,233, 62, 92,196,157, 61, 49, 92,210, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 35, 68,181, 61,153,208,189, 62, 92,196,157, 61, 49, 92,210, 62,
- 7,191,131, 61, 62,220,187, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 7,191,131, 61, 62,220,187, 62, 79, 92,155, 61, 91,190,166, 62, 35, 68,181, 61,153,208,189, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 70,117,207, 61, 54,150,169, 62, 35, 68,181, 61,153,208,189, 62,
- 79, 92,155, 61, 91,190,166, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 79, 92,155, 61, 91,190,166, 62, 7,191,131, 61, 62,220,187, 62,194,205, 76, 61,186,199,165, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,172,242,180, 61, 96,152, 9, 63, 1,122,156, 61,254, 29, 19, 63,
-100, 10,129, 61,113,150, 9, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-100, 10,129, 61,113,150, 9, 63,154,153,153, 61, 25,252,255, 62,172,242,180, 61, 96,152, 9, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,215,204,204, 61, 0, 0, 0, 63,172,242,180, 61, 96,152, 9, 63,
-154,153,153, 61, 25,252,255, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-154,153,153, 61, 25,252,255, 62,100, 10,129, 61,113,150, 9, 63,215,204, 76, 61, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,109,132, 23, 61,113,150, 9, 63,215,204, 76, 61, 0, 0, 0, 63,
-100, 10,129, 61,113,150, 9, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-100, 10,129, 61,113,150, 9, 63, 91,204, 76, 61,220, 98, 19, 63,109,132, 23, 61,113,150, 9, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,174, 73,193, 60,253, 29, 19, 63,109,132, 23, 61,113,150, 9, 63,
- 91,204, 76, 61,220, 98, 19, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 91,204, 76, 61,220, 98, 19, 63,100, 10,129, 61,113,150, 9, 63, 1,122,156, 61,254, 29, 19, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,166,139,130, 61,145,140, 28, 63,246,203, 76, 61, 48,200, 37, 63,
- 13,129, 20, 61,143,140, 28, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 13,129, 20, 61,143,140, 28, 63, 91,204, 76, 61,220, 98, 19, 63,166,139,130, 61,145,140, 28, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1,122,156, 61,254, 29, 19, 63,166,139,130, 61,145,140, 28, 63,
- 91,204, 76, 61,220, 98, 19, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 91,204, 76, 61,220, 98, 19, 63, 13,129, 20, 61,143,140, 28, 63,174, 73,193, 60,253, 29, 19, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,109,132, 23, 61,113,150, 9, 63,174, 73,193, 60,253, 29, 19, 63,
-114,207, 62, 60, 94,152, 9, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-114,207, 62, 60, 94,152, 9, 63,176,204,204, 60, 24,252,255, 62,109,132, 23, 61,113,150, 9, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,215,204, 76, 61, 0, 0, 0, 63,109,132, 23, 61,113,150, 9, 63,
-176,204,204, 60, 24,252,255, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-176,204,204, 60, 24,252,255, 62,114,207, 62, 60, 94,152, 9, 63,167, 79, 11, 38, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,237, 83,113, 62, 79,220,187, 62, 63, 81,100, 62, 60, 92,210, 62,
-110,145, 88, 62,167,208,189, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-110,145, 88, 62,167,208,189, 62, 91,133,101, 62,112,190,166, 62,237, 83,113, 62, 79,220,187, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,128, 62,206,199,165, 62,237, 83,113, 62, 79,220,187, 62,
- 91,133,101, 62,112,190,166, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 91,133,101, 62,112,190,166, 62,110,145, 88, 62,167,208,189, 62,239,120, 75, 62, 70,150,169, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,144, 88, 63, 62, 46,135,193, 62,239,120, 75, 62, 70,150,169, 62,
-110,145, 88, 62,167,208,189, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-110,145, 88, 62,167,208,189, 62,170, 88, 76, 62,187,159,213, 62,144, 88, 63, 62, 46,135,193, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,179,163, 52, 62, 7,196,217, 62,144, 88, 63, 62, 46,135,193, 62,
-170, 88, 76, 62,187,159,213, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-170, 88, 76, 62,187,159,213, 62,110,145, 88, 62,167,208,189, 62, 63, 81,100, 62, 60, 92,210, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,190, 86, 88, 62,221, 32,233, 62,254,204, 76, 62, 0, 0, 0, 63,
-251,223, 64, 62, 67,207,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-251,223, 64, 62, 67,207,236, 62,170, 88, 76, 62,187,159,213, 62,190, 86, 88, 62,221, 32,233, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 63, 81,100, 62, 60, 92,210, 62,190, 86, 88, 62,221, 32,233, 62,
-170, 88, 76, 62,187,159,213, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-170, 88, 76, 62,187,159,213, 62,251,223, 64, 62, 67,207,236, 62,179,163, 52, 62, 7,196,217, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,144, 88, 63, 62, 46,135,193, 62,179,163, 52, 62, 7,196,217, 62,
-153,172, 39, 62,230,230,198, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-153,172, 39, 62,230,230,198, 62,213, 14, 50, 62, 78, 54,174, 62,144, 88, 63, 62, 46,135,193, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,239,120, 75, 62, 70,150,169, 62,144, 88, 63, 62, 46,135,193, 62,
-213, 14, 50, 62, 78, 54,174, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-213, 14, 50, 62, 78, 54,174, 62,153,172, 39, 62,230,230,198, 62,214,153, 25, 62,165,111,180, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,190, 86, 88, 62,221, 32,233, 62, 63, 81,100, 62, 60, 92,210, 62,
-166,114,114, 62, 63, 23,233, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-166,114,114, 62, 63, 23,233, 62,126,102,102, 62, 25,252,255, 62,190, 86, 88, 62,221, 32,233, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,254,204, 76, 62, 0, 0, 0, 63,190, 86, 88, 62,221, 32,233, 62,
-126,102,102, 62, 25,252,255, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-126,102,102, 62, 25,252,255, 62,166,114,114, 62, 63, 23,233, 62, 0, 0,128, 62, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,173,198,134, 62, 63, 23,233, 62, 0, 0,128, 62, 0, 0, 0, 63,
-166,114,114, 62, 63, 23,233, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-166,114,114, 62, 63, 23,233, 62, 0, 0,128, 62,149,190,209, 62,173,198,134, 62, 63, 23,233, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 97,215,141, 62, 60, 92,210, 62,173,198,134, 62, 63, 23,233, 62,
- 0, 0,128, 62,149,190,209, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 0, 0,128, 62,149,190,209, 62,166,114,114, 62, 63, 23,233, 62, 63, 81,100, 62, 60, 92,210, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,237, 83,113, 62, 79,220,187, 62, 0, 0,128, 62,206,199,165, 62,
- 9, 86,135, 62, 79,220,187, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 9, 86,135, 62, 79,220,187, 62, 0, 0,128, 62,149,190,209, 62,237, 83,113, 62, 79,220,187, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 63, 81,100, 62, 60, 92,210, 62,237, 83,113, 62, 79,220,187, 62,
- 0, 0,128, 62,149,190,209, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 0, 0,128, 62,149,190,209, 62, 9, 86,135, 62, 79,220,187, 62, 97,215,141, 62, 60, 92,210, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,173,198,134, 62, 63, 23,233, 62, 97,215,141, 62, 60, 92,210, 62,
-161,212,147, 62,221, 32,233, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-161,212,147, 62,221, 32,233, 62,193,204,140, 62, 25,252,255, 62,173,198,134, 62, 63, 23,233, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,128, 62, 0, 0, 0, 63,173,198,134, 62, 63, 23,233, 62,
-193,204,140, 62, 25,252,255, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-193,204,140, 62, 25,252,255, 62,161,212,147, 62,221, 32,233, 62,129,153,153, 62, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,180, 41,172, 62,227,230,198, 62, 39,174,165, 62, 7,196,217, 62,
-184, 83,160, 62, 46,135,193, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-184, 83,160, 62, 46,135,193, 62,150,248,166, 62, 78, 54,174, 62,180, 41,172, 62,227,230,198, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 21, 51,179, 62,165,111,180, 62,180, 41,172, 62,227,230,198, 62,
-150,248,166, 62, 78, 54,174, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-150,248,166, 62, 78, 54,174, 62,184, 83,160, 62, 46,135,193, 62,137, 67,154, 62, 70,150,169, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 73,183,147, 62,167,208,189, 62,137, 67,154, 62, 70,150,169, 62,
-184, 83,160, 62, 46,135,193, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-184, 83,160, 62, 46,135,193, 62,171,211,153, 62,187,159,213, 62, 73,183,147, 62,167,208,189, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 97,215,141, 62, 60, 92,210, 62, 73,183,147, 62,167,208,189, 62,
-171,211,153, 62,187,159,213, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-171,211,153, 62,187,159,213, 62,184, 83,160, 62, 46,135,193, 62, 39,174,165, 62, 7,196,217, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 3,144,159, 62, 67,207,236, 62,129,153,153, 62, 0, 0, 0, 63,
-161,212,147, 62,221, 32,233, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-161,212,147, 62,221, 32,233, 62,171,211,153, 62,187,159,213, 62, 3,144,159, 62, 67,207,236, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 39,174,165, 62, 7,196,217, 62, 3,144,159, 62, 67,207,236, 62,
-171,211,153, 62,187,159,213, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-171,211,153, 62,187,159,213, 62,161,212,147, 62,221, 32,233, 62, 97,215,141, 62, 60, 92,210, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 73,183,147, 62,167,208,189, 62, 97,215,141, 62, 60, 92,210, 62,
- 9, 86,135, 62, 79,220,187, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 9, 86,135, 62, 79,220,187, 62, 82, 61,141, 62,112,190,166, 62, 73,183,147, 62,167,208,189, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,137, 67,154, 62, 70,150,169, 62, 73,183,147, 62,167,208,189, 62,
- 82, 61,141, 62,112,190,166, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 82, 61,141, 62,112,190,166, 62, 9, 86,135, 62, 79,220,187, 62, 0, 0,128, 62,206,199,165, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1,163,147, 62, 91,152, 9, 63,224,132,141, 62,246, 29, 19, 63,
-251,168,134, 62,107,150, 9, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-251,168,134, 62,107,150, 9, 63,193,204,140, 62, 25,252,255, 62, 1,163,147, 62, 91,152, 9, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,129,153,153, 62, 0, 0, 0, 63, 1,163,147, 62, 91,152, 9, 63,
-193,204,140, 62, 25,252,255, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-193,204,140, 62, 25,252,255, 62,251,168,134, 62,107,150, 9, 63, 0, 0,128, 62, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 11,174,114, 62,107,150, 9, 63, 0, 0,128, 62, 0, 0, 0, 63,
-251,168,134, 62,107,150, 9, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-251,168,134, 62,107,150, 9, 63, 0, 0,128, 62,209, 98, 19, 63, 11,174,114, 62,107,150, 9, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 64,246,100, 62,246, 29, 19, 63, 11,174,114, 62,107,150, 9, 63,
- 0, 0,128, 62,209, 98, 19, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 0, 0,128, 62,209, 98, 19, 63,251,168,134, 62,107,150, 9, 63,224,132,141, 62,246, 29, 19, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 86, 9,135, 62,130,140, 28, 63, 0, 0,128, 62, 23,200, 37, 63,
- 83,237,113, 62,130,140, 28, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 83,237,113, 62,130,140, 28, 63, 0, 0,128, 62,209, 98, 19, 63, 86, 9,135, 62,130,140, 28, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,224,132,141, 62,246, 29, 19, 63, 86, 9,135, 62,130,140, 28, 63,
- 0, 0,128, 62,209, 98, 19, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 0, 0,128, 62,209, 98, 19, 63, 83,237,113, 62,130,140, 28, 63, 64,246,100, 62,246, 29, 19, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 11,174,114, 62,107,150, 9, 63, 64,246,100, 62,246, 29, 19, 63,
-255,185, 88, 62, 90,152, 9, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-255,185, 88, 62, 90,152, 9, 63,126,102,102, 62, 25,252,255, 62, 11,174,114, 62,107,150, 9, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,128, 62, 0, 0, 0, 63, 11,174,114, 62,107,150, 9, 63,
-126,102,102, 62, 25,252,255, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-126,102,102, 62, 25,252,255, 62,255,185, 88, 62, 90,152, 9, 63,254,204, 76, 62, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 63, 16,223, 62, 62,220,187, 62,233,142,216, 62, 49, 92,210, 62,
-248,174,210, 62,153,208,189, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-248,174,210, 62,153,208,189, 62,237, 40,217, 62, 91,190,166, 62, 63, 16,223, 62, 62,220,187, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 72,102,230, 62,183,199,165, 62, 63, 16,223, 62, 62,220,187, 62,
-237, 40,217, 62, 91,190,166, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-237, 40,217, 62, 91,190,166, 62,248,174,210, 62,153,208,189, 62,175, 34,204, 62, 54,150,169, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,129, 18,198, 62, 37,135,193, 62,175, 34,204, 62, 54,150,169, 62,
-248,174,210, 62,153,208,189, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-248,174,210, 62,153,208,189, 62,151,146,204, 62,180,159,213, 62,129, 18,198, 62, 37,135,193, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 21,184,192, 62, 6,196,217, 62,129, 18,198, 62, 37,135,193, 62,
-151,146,204, 62,180,159,213, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-151,146,204, 62,180,159,213, 62,248,174,210, 62,153,208,189, 62,233,142,216, 62, 49, 92,210, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,170,145,210, 62,214, 32,233, 62,202,204,204, 62, 0, 0, 0, 63,
- 65,214,198, 62, 67,207,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 65,214,198, 62, 67,207,236, 62,151,146,204, 62,180,159,213, 62,170,145,210, 62,214, 32,233, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,233,142,216, 62, 49, 92,210, 62,170,145,210, 62,214, 32,233, 62,
-151,146,204, 62,180,159,213, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-151,146,204, 62,180,159,213, 62, 65,214,198, 62, 67,207,236, 62, 21,184,192, 62, 6,196,217, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,129, 18,198, 62, 37,135,193, 62, 21,184,192, 62, 6,196,217, 62,
-127, 60,186, 62,225,230,198, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-127, 60,186, 62,225,230,198, 62,154,109,191, 62, 68, 54,174, 62,129, 18,198, 62, 37,135,193, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,175, 34,204, 62, 54,150,169, 62,129, 18,198, 62, 37,135,193, 62,
-154,109,191, 62, 68, 54,174, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-154,109,191, 62, 68, 54,174, 62,127, 60,186, 62,225,230,198, 62, 21, 51,179, 62,165,111,180, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,170,145,210, 62,214, 32,233, 62,233,142,216, 62, 49, 92,210, 62,
-171,159,223, 62, 57, 23,233, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-171,159,223, 62, 57, 23,233, 62,154,153,217, 62, 24,252,255, 62,170,145,210, 62,214, 32,233, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,202,204,204, 62, 0, 0, 0, 63,170,145,210, 62,214, 32,233, 62,
-154,153,217, 62, 24,252,255, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-154,153,217, 62, 24,252,255, 62,171,159,223, 62, 57, 23,233, 62,101,102,230, 62, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 20, 45,237, 62, 55, 23,233, 62,101,102,230, 62, 0, 0, 0, 63,
-171,159,223, 62, 57, 23,233, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-171,159,223, 62, 57, 23,233, 62, 88,102,230, 62,135,190,209, 62, 20, 45,237, 62, 55, 23,233, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,199, 61,244, 62, 46, 92,210, 62, 20, 45,237, 62, 55, 23,233, 62,
- 88,102,230, 62,135,190,209, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 88,102,230, 62,135,190,209, 62,171,159,223, 62, 57, 23,233, 62,233,142,216, 62, 49, 92,210, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 63, 16,223, 62, 62,220,187, 62, 72,102,230, 62,183,199,165, 62,
- 99,188,237, 62, 60,220,187, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 99,188,237, 62, 60,220,187, 62, 88,102,230, 62,135,190,209, 62, 63, 16,223, 62, 62,220,187, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,233,142,216, 62, 49, 92,210, 62, 63, 16,223, 62, 62,220,187, 62,
- 88,102,230, 62,135,190,209, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 88,102,230, 62,135,190,209, 62, 99,188,237, 62, 60,220,187, 62,199, 61,244, 62, 46, 92,210, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 20, 45,237, 62, 55, 23,233, 62,199, 61,244, 62, 46, 92,210, 62,
- 21, 59,250, 62,213, 32,233, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 21, 59,250, 62,213, 32,233, 62, 53, 51,243, 62, 24,252,255, 62, 20, 45,237, 62, 55, 23,233, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,101,102,230, 62, 0, 0, 0, 63, 20, 45,237, 62, 55, 23,233, 62,
- 53, 51,243, 62, 24,252,255, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 53, 51,243, 62, 24,252,255, 62, 21, 59,250, 62,213, 32,233, 62, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 17, 72, 9, 63,227,230,198, 62, 77, 10, 6, 63, 6,196,217, 62,
- 15, 93, 3, 63, 36,135,193, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 15, 93, 3, 63, 36,135,193, 62,123,175, 6, 63, 65, 54,174, 62, 17, 72, 9, 63,227,230,198, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,191,204, 12, 63,160,111,180, 62, 17, 72, 9, 63,227,230,198, 62,
-123,175, 6, 63, 65, 54,174, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-123,175, 6, 63, 65, 54,174, 62, 15, 93, 3, 63, 36,135,193, 62,241, 84, 0, 63, 52,150,169, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,169, 29,250, 62,150,208,189, 62,241, 84, 0, 63, 52,150,169, 62,
- 15, 93, 3, 63, 36,135,193, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 15, 93, 3, 63, 36,135,193, 62, 12, 29, 0, 63,179,159,213, 62,169, 29,250, 62,150,208,189, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,199, 61,244, 62, 46, 92,210, 62,169, 29,250, 62,150,208,189, 62,
- 12, 29, 0, 63,179,159,213, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 12, 29, 0, 63,179,159,213, 62, 15, 93, 3, 63, 36,135,193, 62, 77, 10, 6, 63, 6,196,217, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 62,251, 2, 63, 67,207,236, 62, 0, 0, 0, 63, 0, 0, 0, 63,
- 21, 59,250, 62,213, 32,233, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 21, 59,250, 62,213, 32,233, 62, 12, 29, 0, 63,179,159,213, 62, 62,251, 2, 63, 67,207,236, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 77, 10, 6, 63, 6,196,217, 62, 62,251, 2, 63, 67,207,236, 62,
- 12, 29, 0, 63,179,159,213, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 12, 29, 0, 63,179,159,213, 62, 21, 59,250, 62,213, 32,233, 62,199, 61,244, 62, 46, 92,210, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,169, 29,250, 62,150,208,189, 62,199, 61,244, 62, 46, 92,210, 62,
- 99,188,237, 62, 60,220,187, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 99,188,237, 62, 60,220,187, 62,164,163,243, 62, 89,190,166, 62,169, 29,250, 62,150,208,189, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,241, 84, 0, 63, 52,150,169, 62,169, 29,250, 62,150,208,189, 62,
-164,163,243, 62, 89,190,166, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-164,163,243, 62, 89,190,166, 62, 99,188,237, 62, 60,220,187, 62, 72,102,230, 62,183,199,165, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,132, 9,250, 62, 94,152, 9, 63,101,235,243, 62,252, 29, 19, 63,
-114, 15,237, 62,113,150, 9, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-114, 15,237, 62,113,150, 9, 63, 53, 51,243, 62, 24,252,255, 62,132, 9,250, 62, 94,152, 9, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63,132, 9,250, 62, 94,152, 9, 63,
- 53, 51,243, 62, 24,252,255, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 53, 51,243, 62, 24,252,255, 62,114, 15,237, 62,113,150, 9, 63,101,102,230, 62, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,103,189,223, 62,112,150, 9, 63,101,102,230, 62, 0, 0, 0, 63,
-114, 15,237, 62,113,150, 9, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-114, 15,237, 62,113,150, 9, 63,117,102,230, 62,220, 98, 19, 63,103,189,223, 62,112,150, 9, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,128,225,216, 62,254, 29, 19, 63,103,189,223, 62,112,150, 9, 63,
-117,102,230, 62,220, 98, 19, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-117,102,230, 62,220, 98, 19, 63,114, 15,237, 62,113,150, 9, 63,101,235,243, 62,252, 29, 19, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,222,111,237, 62,143,140, 28, 63,129,102,230, 62, 48,200, 37, 63,
- 22, 93,223, 62,145,140, 28, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 22, 93,223, 62,145,140, 28, 63,117,102,230, 62,220, 98, 19, 63,222,111,237, 62,143,140, 28, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,101,235,243, 62,252, 29, 19, 63,222,111,237, 62,143,140, 28, 63,
-117,102,230, 62,220, 98, 19, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-117,102,230, 62,220, 98, 19, 63, 22, 93,223, 62,145,140, 28, 63,128,225,216, 62,254, 29, 19, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,103,189,223, 62,112,150, 9, 63,128,225,216, 62,254, 29, 19, 63,
- 85,195,210, 62, 96,152, 9, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 85,195,210, 62, 96,152, 9, 63,154,153,217, 62, 24,252,255, 62,103,189,223, 62,112,150, 9, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,101,102,230, 62, 0, 0, 0, 63,103,189,223, 62,112,150, 9, 63,
-154,153,217, 62, 24,252,255, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-154,153,217, 62, 24,252,255, 62, 85,195,210, 62, 96,152, 9, 63,202,204,204, 62, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 97,187, 34, 63, 72,220,187, 62,178,122, 31, 63, 55, 92,210, 62,
-186,138, 28, 63,155,208,189, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-186,138, 28, 63,155,208,189, 62,185,199, 31, 63, 96,190,166, 62, 97,187, 34, 63, 72,220,187, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,107,102, 38, 63,201,199,165, 62, 97,187, 34, 63, 72,220,187, 62,
-185,199, 31, 63, 96,190,166, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-185,199, 31, 63, 96,190,166, 62,186,138, 28, 63,155,208,189, 62,150, 68, 25, 63, 54,150,169, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,123, 60, 22, 63, 36,135,193, 62,150, 68, 25, 63, 54,150,169, 62,
-186,138, 28, 63,155,208,189, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-186,138, 28, 63,155,208,189, 62,133,124, 25, 63,181,159,213, 62,123, 60, 22, 63, 36,135,193, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 64,143, 19, 63, 4,196,217, 62,123, 60, 22, 63, 36,135,193, 62,
-133,124, 25, 63,181,159,213, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-133,124, 25, 63,181,159,213, 62,186,138, 28, 63,155,208,189, 62,178,122, 31, 63, 55, 92,210, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 14,124, 28, 63,218, 32,233, 62,155,153, 25, 63, 0, 0, 0, 63,
- 86,158, 22, 63, 65,207,236, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 86,158, 22, 63, 65,207,236, 62,133,124, 25, 63,181,159,213, 62, 14,124, 28, 63,218, 32,233, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,178,122, 31, 63, 55, 92,210, 62, 14,124, 28, 63,218, 32,233, 62,
-133,124, 25, 63,181,159,213, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-133,124, 25, 63,181,159,213, 62, 86,158, 22, 63, 65,207,236, 62, 64,143, 19, 63, 4,196,217, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,123, 60, 22, 63, 36,135,193, 62, 64,143, 19, 63, 4,196,217, 62,
-117, 81, 16, 63,223,230,198, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-117, 81, 16, 63,223,230,198, 62, 7,234, 18, 63, 65, 54,174, 62,123, 60, 22, 63, 36,135,193, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,150, 68, 25, 63, 54,150,169, 62,123, 60, 22, 63, 36,135,193, 62,
- 7,234, 18, 63, 65, 54,174, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 7,234, 18, 63, 65, 54,174, 62,117, 81, 16, 63,223,230,198, 62,191,204, 12, 63,160,111,180, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 14,124, 28, 63,218, 32,233, 62,178,122, 31, 63, 55, 92,210, 62,
- 17, 3, 35, 63, 58, 23,233, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 17, 3, 35, 63, 58, 23,233, 62, 2, 0, 32, 63, 24,252,255, 62, 14,124, 28, 63,218, 32,233, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,155,153, 25, 63, 0, 0, 0, 63, 14,124, 28, 63,218, 32,233, 62,
- 2, 0, 32, 63, 24,252,255, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 2, 0, 32, 63, 24,252,255, 62, 17, 3, 35, 63, 58, 23,233, 62,109,102, 38, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,200,201, 41, 63, 58, 23,233, 62,109,102, 38, 63, 0, 0, 0, 63,
- 17, 3, 35, 63, 58, 23,233, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 17, 3, 35, 63, 58, 23,233, 62,109,102, 38, 63,143,190,209, 62,200,201, 41, 63, 58, 23,233, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 38, 82, 45, 63, 55, 92,210, 62,200,201, 41, 63, 58, 23,233, 62,
-109,102, 38, 63,143,190,209, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-109,102, 38, 63,143,190,209, 62, 17, 3, 35, 63, 58, 23,233, 62,178,122, 31, 63, 55, 92,210, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 97,187, 34, 63, 72,220,187, 62,107,102, 38, 63,201,199,165, 62,
-118, 17, 42, 63, 72,220,187, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-118, 17, 42, 63, 72,220,187, 62,109,102, 38, 63,143,190,209, 62, 97,187, 34, 63, 72,220,187, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,178,122, 31, 63, 55, 92,210, 62, 97,187, 34, 63, 72,220,187, 62,
-109,102, 38, 63,143,190,209, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-109,102, 38, 63,143,190,209, 62,118, 17, 42, 63, 72,220,187, 62, 38, 82, 45, 63, 55, 92,210, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,200,201, 41, 63, 58, 23,233, 62, 38, 82, 45, 63, 55, 92,210, 62,
-204, 80, 48, 63,218, 32,233, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-204, 80, 48, 63,218, 32,233, 62,215,204, 44, 63, 23,252,255, 62,200,201, 41, 63, 58, 23,233, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,109,102, 38, 63, 0, 0, 0, 63,200,201, 41, 63, 58, 23,233, 62,
-215,204, 44, 63, 23,252,255, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-215,204, 44, 63, 23,252,255, 62,204, 80, 48, 63,218, 32,233, 62, 63, 51, 51, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 85,123, 60, 63,253,230,198, 62,144, 61, 57, 63, 19,196,217, 62,
- 86,144, 54, 63, 68,135,193, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 86,144, 54, 63, 68,135,193, 62,196,226, 57, 63,114, 54,174, 62, 85,123, 60, 63,253,230,198, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 64, 63,211,111,180, 62, 85,123, 60, 63,253,230,198, 62,
-196,226, 57, 63,114, 54,174, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-196,226, 57, 63,114, 54,174, 62, 86,144, 54, 63, 68,135,193, 62, 58,136, 51, 63, 90,150,169, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 27, 66, 48, 63,173,208,189, 62, 58,136, 51, 63, 90,150,169, 62,
- 86,144, 54, 63, 68,135,193, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 86,144, 54, 63, 68,135,193, 62, 80, 80, 51, 63,192,159,213, 62, 27, 66, 48, 63,173,208,189, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 38, 82, 45, 63, 55, 92,210, 62, 27, 66, 48, 63,173,208,189, 62,
- 80, 80, 51, 63,192,159,213, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 80, 80, 51, 63,192,159,213, 62, 86,144, 54, 63, 68,135,193, 62,144, 61, 57, 63, 19,196,217, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,128, 46, 54, 63, 75,207,236, 62, 63, 51, 51, 63, 0, 0, 0, 63,
-204, 80, 48, 63,218, 32,233, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-204, 80, 48, 63,218, 32,233, 62, 80, 80, 51, 63,192,159,213, 62,128, 46, 54, 63, 75,207,236, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,144, 61, 57, 63, 19,196,217, 62,128, 46, 54, 63, 75,207,236, 62,
- 80, 80, 51, 63,192,159,213, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 80, 80, 51, 63,192,159,213, 62,204, 80, 48, 63,218, 32,233, 62, 38, 82, 45, 63, 55, 92,210, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 27, 66, 48, 63,173,208,189, 62, 38, 82, 45, 63, 55, 92,210, 62,
-118, 17, 42, 63, 72,220,187, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-118, 17, 42, 63, 72,220,187, 62, 26, 5, 45, 63,117,190,166, 62, 27, 66, 48, 63,173,208,189, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 58,136, 51, 63, 90,150,169, 62, 27, 66, 48, 63,173,208,189, 62,
- 26, 5, 45, 63,117,190,166, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 26, 5, 45, 63,117,190,166, 62,118, 17, 42, 63, 72,220,187, 62,107,102, 38, 63,201,199,165, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,255, 55, 48, 63, 94,152, 9, 63,237, 40, 45, 63,252, 29, 19, 63,
-242,186, 41, 63,112,150, 9, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-242,186, 41, 63,112,150, 9, 63,215,204, 44, 63, 23,252,255, 62,255, 55, 48, 63, 94,152, 9, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 63, 51, 51, 63, 0, 0, 0, 63,255, 55, 48, 63, 94,152, 9, 63,
-215,204, 44, 63, 23,252,255, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-215,204, 44, 63, 23,252,255, 62,242,186, 41, 63,112,150, 9, 63,109,102, 38, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,235, 17, 35, 63,112,150, 9, 63,109,102, 38, 63, 0, 0, 0, 63,
-242,186, 41, 63,112,150, 9, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-242,186, 41, 63,112,150, 9, 63,113,102, 38, 63,219, 98, 19, 63,235, 17, 35, 63,112,150, 9, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,245,163, 31, 63,253, 29, 19, 63,235, 17, 35, 63,112,150, 9, 63,
-113,102, 38, 63,219, 98, 19, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-113,102, 38, 63,219, 98, 19, 63,242,186, 41, 63,112,150, 9, 63,237, 40, 45, 63,252, 29, 19, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 38,235, 41, 63,141,140, 28, 63,117,102, 38, 63, 45,200, 37, 63,
-192,225, 34, 63,142,140, 28, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-192,225, 34, 63,142,140, 28, 63,113,102, 38, 63,219, 98, 19, 63, 38,235, 41, 63,141,140, 28, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,237, 40, 45, 63,252, 29, 19, 63, 38,235, 41, 63,141,140, 28, 63,
-113,102, 38, 63,219, 98, 19, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-113,102, 38, 63,219, 98, 19, 63,192,225, 34, 63,142,140, 28, 63,245,163, 31, 63,253, 29, 19, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,235, 17, 35, 63,112,150, 9, 63,245,163, 31, 63,253, 29, 19, 63,
-223,148, 28, 63, 94,152, 9, 63, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-223,148, 28, 63, 94,152, 9, 63, 2, 0, 32, 63, 24,252,255, 62,235, 17, 35, 63,112,150, 9, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,109,102, 38, 63, 0, 0, 0, 63,235, 17, 35, 63,112,150, 9, 63,
- 2, 0, 32, 63, 24,252,255, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 2, 0, 32, 63, 24,252,255, 62,223,148, 28, 63, 94,152, 9, 63,155,153, 25, 63, 0, 0, 0, 63, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,188,129,107, 63, 66, 45,128, 62,235, 71, 99, 63,222, 76,120, 62,
- 94, 37,106, 63, 84, 97, 83, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 94, 37,106, 63, 84, 97, 83, 62, 65, 51,115, 63,248,151, 97, 62,188,129,107, 63, 66, 45,128, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 65, 51,115, 63,151, 83,135, 62,188,129,107, 63, 66, 45,128, 62,
- 65, 51,115, 63,248,151, 97, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 65, 51,115, 63,248,151, 97, 62, 94, 37,106, 63, 84, 97, 83, 62, 65, 51,115, 63, 90,111, 52, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,188,129,107, 63, 66, 45,128, 62, 65, 51,115, 63,151, 83,135, 62,
-142,123,108, 63,169,144,151, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-142,123,108, 63,169,144,151, 62,231, 50,101, 63, 17,201,146, 62,188,129,107, 63, 66, 45,128, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,235, 71, 99, 63,222, 76,120, 62,188,129,107, 63, 66, 45,128, 62,
-231, 50,101, 63, 17,201,146, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-231, 50,101, 63, 17,201,146, 62,142,123,108, 63,169,144,151, 62,106,187,102, 63, 54,150,169, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 71, 56, 96, 63, 99,190,166, 62,149,153, 89, 63,201,199,165, 62,
- 22,238, 93, 63,243,101,144, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 22,238, 93, 63,243,101,144, 62,231, 50,101, 63, 17,201,146, 62, 71, 56, 96, 63, 99,190,166, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,106,187,102, 63, 54,150,169, 62, 71, 56, 96, 63, 99,190,166, 62,
-231, 50,101, 63, 17,201,146, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-231, 50,101, 63, 17,201,146, 62, 22,238, 93, 63,243,101,144, 62,235, 71, 99, 63,222, 76,120, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,249, 21,109, 63, 65, 54,174, 62,106,187,102, 63, 54,150,169, 62,
-142,123,108, 63,169,144,151, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-142,123,108, 63,169,144,151, 62, 65, 51,115, 63, 93,231,157, 62,249, 21,109, 63, 65, 54,174, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 65, 51,115, 63,160,111,180, 62,249, 21,109, 63, 65, 54,174, 62,
- 65, 51,115, 63, 93,231,157, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 65, 51,115, 63, 93,231,157, 62,142,123,108, 63,169,144,151, 62, 65, 51,115, 63,151, 83,135, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,149,153, 89, 63, 79,162,115, 62,235, 71, 99, 63,222, 76,120, 62,
- 22,238, 93, 63,243,101,144, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 22,238, 93, 63,243,101,144, 62, 21, 69, 85, 63, 3,102,144, 62,149,153, 89, 63, 79,162,115, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 68,235, 79, 63, 37, 77,120, 62,149,153, 89, 63, 79,162,115, 62,
- 21, 69, 85, 63, 3,102,144, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 21, 69, 85, 63, 3,102,144, 62, 22,238, 93, 63,243,101,144, 62,149,153, 89, 63,201,199,165, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,149,153, 89, 63, 79,162,115, 62, 68,235, 79, 63, 37, 77,120, 62,
- 24,186, 83, 63,245,176, 70, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 24,186, 83, 63,245,176, 70, 62, 22,121, 95, 63,204,176, 70, 62,149,153, 89, 63, 79,162,115, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,235, 71, 99, 63,222, 76,120, 62,149,153, 89, 63, 79,162,115, 62,
- 22,121, 95, 63,204,176, 70, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 22,121, 95, 63,204,176, 70, 62, 24,186, 83, 63,245,176, 70, 62,152,153, 89, 63,198, 31, 23, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 61,119,103, 63,179,253, 30, 62, 65, 51,115, 63, 90,111, 52, 62,
- 94, 37,106, 63, 84, 97, 83, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 94, 37,106, 63, 84, 97, 83, 62, 22,121, 95, 63,204,176, 70, 62, 61,119,103, 63,179,253, 30, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,152,153, 89, 63,198, 31, 23, 62, 61,119,103, 63,179,253, 30, 62,
- 22,121, 95, 63,204,176, 70, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 22,121, 95, 63,204,176, 70, 62, 94, 37,106, 63, 84, 97, 83, 62,235, 71, 99, 63,222, 76,120, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,248,187, 75, 63,241,253, 30, 62,152,153, 89, 63,198, 31, 23, 62,
- 24,186, 83, 63,245,176, 70, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 24,186, 83, 63,245,176, 70, 62,214, 13, 73, 63,181, 97, 83, 62,248,187, 75, 63,241,253, 30, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 64, 63,202,111, 52, 62,248,187, 75, 63,241,253, 30, 62,
-214, 13, 73, 63,181, 97, 83, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-214, 13, 73, 63,181, 97, 83, 62, 24,186, 83, 63,245,176, 70, 62, 68,235, 79, 63, 37, 77,120, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,152,153, 89, 63,111, 41,147, 61, 0, 0, 64, 63,195,111,180, 61,
- 0, 0, 64, 63,111, 65, 52, 61, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 64, 63,111, 65, 52, 61, 38, 49,117, 63,225, 64, 52, 61,152,153, 89, 63,111, 41,147, 61, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 65, 51,115, 63, 83,111,180, 61,152,153, 89, 63,111, 41,147, 61,
- 38, 49,117, 63,225, 64, 52, 61, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 38, 49,117, 63,225, 64, 52, 61, 0, 0, 64, 63,111, 65, 52, 61,208,222,121, 63,102, 9,239,178, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,152,153, 89, 63,111, 41,147, 61, 65, 51,115, 63, 83,111,180, 61,
-172, 51, 99, 63, 48, 46,231, 61, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-172, 51, 99, 63, 48, 46,231, 61,135,255, 79, 63,120, 46,231, 61,152,153, 89, 63,111, 41,147, 61, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 64, 63,195,111,180, 61,152,153, 89, 63,111, 41,147, 61,
-135,255, 79, 63,120, 46,231, 61, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-135,255, 79, 63,120, 46,231, 61,172, 51, 99, 63, 48, 46,231, 61,152,153, 89, 63,198, 31, 23, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,248,187, 75, 63,241,253, 30, 62, 0, 0, 64, 63,202,111, 52, 62,
- 0, 0, 64, 63, 24, 71, 7, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 64, 63, 24, 71, 7, 62,135,255, 79, 63,120, 46,231, 61,248,187, 75, 63,241,253, 30, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,152,153, 89, 63,198, 31, 23, 62,248,187, 75, 63,241,253, 30, 62,
-135,255, 79, 63,120, 46,231, 61, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-135,255, 79, 63,120, 46,231, 61, 0, 0, 64, 63, 24, 71, 7, 62, 0, 0, 64, 63,195,111,180, 61, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 61,119,103, 63,179,253, 30, 62,152,153, 89, 63,198, 31, 23, 62,
-172, 51, 99, 63, 48, 46,231, 61, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-172, 51, 99, 63, 48, 46,231, 61, 66, 51,115, 63,199, 70, 7, 62, 61,119,103, 63,179,253, 30, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 65, 51,115, 63, 90,111, 52, 62, 61,119,103, 63,179,253, 30, 62,
- 66, 51,115, 63,199, 70, 7, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 66, 51,115, 63,199, 70, 7, 62,172, 51, 99, 63, 48, 46,231, 61, 65, 51,115, 63, 83,111,180, 61, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,122,177, 71, 63,120, 45,128, 62, 0, 0, 64, 63,218, 83,135, 62,
- 0, 0, 64, 63,115,152, 97, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 64, 63,115,152, 97, 62,214, 13, 73, 63,181, 97, 83, 62,122,177, 71, 63,120, 45,128, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 68,235, 79, 63, 37, 77,120, 62,122,177, 71, 63,120, 45,128, 62,
-214, 13, 73, 63,181, 97, 83, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-214, 13, 73, 63,181, 97, 83, 62, 0, 0, 64, 63,115,152, 97, 62, 0, 0, 64, 63,202,111, 52, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,122,177, 71, 63,120, 45,128, 62, 68,235, 79, 63, 37, 77,120, 62,
- 72, 0, 78, 63, 52,201,146, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 72, 0, 78, 63, 52,201,146, 62,169,183, 70, 63,219,144,151, 62,122,177, 71, 63,120, 45,128, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 64, 63,218, 83,135, 62,122,177, 71, 63,120, 45,128, 62,
-169,183, 70, 63,219,144,151, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-169,183, 70, 63,219,144,151, 62, 72, 0, 78, 63, 52,201,146, 62,198,119, 76, 63, 90,150,169, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 61, 29, 70, 63,114, 54,174, 62, 0, 0, 64, 63,211,111,180, 62,
- 0, 0, 64, 63,162,231,157, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 64, 63,162,231,157, 62,169,183, 70, 63,219,144,151, 62, 61, 29, 70, 63,114, 54,174, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,198,119, 76, 63, 90,150,169, 62, 61, 29, 70, 63,114, 54,174, 62,
-169,183, 70, 63,219,144,151, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-169,183, 70, 63,219,144,151, 62, 0, 0, 64, 63,162,231,157, 62, 0, 0, 64, 63,218, 83,135, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,230,250, 82, 63,117,190,166, 62,198,119, 76, 63, 90,150,169, 62,
- 72, 0, 78, 63, 52,201,146, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 72, 0, 78, 63, 52,201,146, 62, 21, 69, 85, 63, 3,102,144, 62,230,250, 82, 63,117,190,166, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,149,153, 89, 63,201,199,165, 62,230,250, 82, 63,117,190,166, 62,
- 21, 69, 85, 63, 3,102,144, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 21, 69, 85, 63, 3,102,144, 62, 72, 0, 78, 63, 52,201,146, 62, 68,235, 79, 63, 37, 77,120, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,179,167,245, 61, 72, 45,128, 62, 94,217,179, 61,222, 76,120, 62,
-202,196,234, 61,100, 97, 83, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-202,196,234, 61,100, 97, 83, 62,212,153, 25, 62, 2,152, 97, 62,179,167,245, 61, 72, 45,128, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,214,153, 25, 62,156, 83,135, 62,179,167,245, 61, 72, 45,128, 62,
-212,153, 25, 62, 2,152, 97, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-212,153, 25, 62, 2,152, 97, 62,202,196,234, 61,100, 97, 83, 62,214,153, 25, 62,106,111, 52, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,179,167,245, 61, 72, 45,128, 62,214,153, 25, 62,156, 83,135, 62,
- 62,118,253, 61,174,144,151, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 62,118,253, 61,174,144,151, 62, 53, 49,195, 61, 17,201,146, 62,179,167,245, 61, 72, 45,128, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 94,217,179, 61,222, 76,120, 62,179,167,245, 61, 72, 45,128, 62,
- 53, 49,195, 61, 17,201,146, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 53, 49,195, 61, 17,201,146, 62, 62,118,253, 61,174,144,151, 62, 70,117,207, 61, 54,150,169, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 79, 92,155, 61, 91,190,166, 62,194,205, 76, 61,186,199,165, 62,
-212, 10,137, 61,238,101,144, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-212, 10,137, 61,238,101,144, 62, 53, 49,195, 61, 17,201,146, 62, 79, 92,155, 61, 91,190,166, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 70,117,207, 61, 54,150,169, 62, 79, 92,155, 61, 91,190,166, 62,
- 53, 49,195, 61, 17,201,146, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 53, 49,195, 61, 17,201,146, 62,212, 10,137, 61,238,101,144, 62, 94,217,179, 61,222, 76,120, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,204, 36, 1, 62, 70, 54,174, 62, 70,117,207, 61, 54,150,169, 62,
- 62,118,253, 61,174,144,151, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 62,118,253, 61,174,144,151, 62,213,153, 25, 62,100,231,157, 62,204, 36, 1, 62, 70, 54,174, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,214,153, 25, 62,165,111,180, 62,204, 36, 1, 62, 70, 54,174, 62,
-213,153, 25, 62,100,231,157, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-213,153, 25, 62,100,231,157, 62, 62,118,253, 61,174,144,151, 62,214,153, 25, 62,156, 83,135, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,188,205, 76, 61, 53,162,115, 62, 94,217,179, 61,222, 76,120, 62,
-212, 10,137, 61,238,101,144, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-212, 10,137, 61,238,101,144, 62,207,133, 7, 61,236,101,144, 62,188,205, 76, 61, 53,162,115, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,255,162, 71, 60,216, 76,120, 62,188,205, 76, 61, 53,162,115, 62,
-207,133, 7, 61,236,101,144, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-207,133, 7, 61,236,101,144, 62,212, 10,137, 61,238,101,144, 62,194,205, 76, 61,186,199,165, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,188,205, 76, 61, 53,162,115, 62,255,162, 71, 60,216, 76,120, 62,
-190,171,221, 60,194,176, 70, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-190,171,221, 60,194,176, 70, 62,194, 98,149, 61,194,176, 70, 62,188,205, 76, 61, 53,162,115, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 94,217,179, 61,222, 76,120, 62,188,205, 76, 61, 53,162,115, 62,
-194, 98,149, 61,194,176, 70, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-194, 98,149, 61,194,176, 70, 62,190,171,221, 60,194,176, 70, 62,193,205, 76, 61,168, 31, 23, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,198, 83,213, 61,179,253, 30, 62,214,153, 25, 62,106,111, 52, 62,
-202,196,234, 61,100, 97, 83, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-202,196,234, 61,100, 97, 83, 62,194, 98,149, 61,194,176, 70, 62,198, 83,213, 61,179,253, 30, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,193,205, 76, 61,168, 31, 23, 62,198, 83,213, 61,179,253, 30, 62,
-194, 98,149, 61,194,176, 70, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-194, 98,149, 61,194,176, 70, 62,202,196,234, 61,100, 97, 83, 62, 94,217,179, 61,222, 76,120, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 59,239,126, 63,174,253, 30, 62,154,105,131, 63,168, 31, 23, 62,
-175,118,131, 63,194,176, 70, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-175,118,131, 63,194,176, 70, 62, 30, 65,124, 63, 90, 97, 83, 62, 59,239,126, 63,174,253, 30, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 65, 51,115, 63, 90,111, 52, 62, 59,239,126, 63,174,253, 30, 62,
- 30, 65,124, 63, 90, 97, 83, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 30, 65,124, 63, 90, 97, 83, 62,175,118,131, 63,194,176, 70, 62, 70,143,129, 63,216, 76,120, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,156,105,131, 63,101, 41,147, 61, 65, 51,115, 63, 83,111,180, 61,
- 38, 49,117, 63,225, 64, 52, 61, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 38, 49,117, 63,225, 64, 52, 61,232,148,135, 63,144,158,125, 60,156,105,131, 63,101, 41,147, 61, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,215,153, 25, 62,104,111,180, 61,122,245,128, 61,101, 41,147, 61,
-224,153, 25, 62,225, 64, 52, 61, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-232,148,135, 63,144,158,125, 60, 38, 49,117, 63,225, 64, 52, 61,208,222,121, 63,102, 9,239,178, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,122,245,128, 61,101, 41,147, 61,215,153, 25, 62,104,111,180, 61,
- 89, 55,179, 61, 38, 46,231, 61, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 89, 55,179, 61, 38, 46,231, 61, 96,147,208, 60, 48, 46,231, 61,122,245,128, 61,101, 41,147, 61, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 65, 51,115, 63, 83,111,180, 61,156,105,131, 63,101, 41,147, 61,
-102,153,129, 63, 48, 46,231, 61, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 96,147,208, 60, 48, 46,231, 61, 89, 55,179, 61, 38, 46,231, 61,193,205, 76, 61,168, 31, 23, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 59,239,126, 63,174,253, 30, 62, 65, 51,115, 63, 90,111, 52, 62,
- 66, 51,115, 63,199, 70, 7, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 66, 51,115, 63,199, 70, 7, 62,102,153,129, 63, 48, 46,231, 61, 59,239,126, 63,174,253, 30, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,154,105,131, 63,168, 31, 23, 62, 59,239,126, 63,174,253, 30, 62,
-102,153,129, 63, 48, 46,231, 61, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-102,153,129, 63, 48, 46,231, 61, 66, 51,115, 63,199, 70, 7, 62, 65, 51,115, 63, 83,111,180, 61, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,198, 83,213, 61,179,253, 30, 62,193,205, 76, 61,168, 31, 23, 62,
- 89, 55,179, 61, 38, 46,231, 61, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 89, 55,179, 61, 38, 46,231, 61,217,153, 25, 62,204, 70, 7, 62,198, 83,213, 61,179,253, 30, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,214,153, 25, 62,106,111, 52, 62,198, 83,213, 61,179,253, 30, 62,
-217,153, 25, 62,204, 70, 7, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-217,153, 25, 62,204, 70, 7, 62, 89, 55,179, 61, 38, 46,231, 61,215,153, 25, 62,104,111,180, 61, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,192,228,122, 63, 66, 45,128, 62, 65, 51,115, 63,151, 83,135, 62,
- 65, 51,115, 63,248,151, 97, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 65, 51,115, 63,248,151, 97, 62, 30, 65,124, 63, 90, 97, 83, 62,192,228,122, 63, 66, 45,128, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 70,143,129, 63,216, 76,120, 62,192,228,122, 63, 66, 45,128, 62,
- 30, 65,124, 63, 90, 97, 83, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 30, 65,124, 63, 90, 97, 83, 62, 65, 51,115, 63,248,151, 97, 62, 65, 51,115, 63, 90,111, 52, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,192,228,122, 63, 66, 45,128, 62, 70,143,129, 63,216, 76,120, 62,
-201,153,128, 63, 14,201,146, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-201,153,128, 63, 14,201,146, 62,239,234,121, 63,169,144,151, 62,192,228,122, 63, 66, 45,128, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 65, 51,115, 63,151, 83,135, 62,192,228,122, 63, 66, 45,128, 62,
-239,234,121, 63,169,144,151, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-239,234,121, 63,169,144,151, 62,201,153,128, 63, 14,201,146, 62, 15,171,127, 63, 52,150,169, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,133, 80,121, 63, 65, 54,174, 62, 65, 51,115, 63,160,111,180, 62,
- 65, 51,115, 63, 93,231,157, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 65, 51,115, 63, 93,231,157, 62,239,234,121, 63,169,144,151, 62,133, 80,121, 63, 65, 54,174, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 15,171,127, 63, 52,150,169, 62,133, 80,121, 63, 65, 54,174, 62,
-239,234,121, 63,169,144,151, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-239,234,121, 63,169,144,151, 62, 65, 51,115, 63, 93,231,157, 62, 65, 51,115, 63,151, 83,135, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 23, 23,131, 63, 89,190,166, 62, 15,171,127, 63, 52,150,169, 62,
-201,153,128, 63, 14,201,146, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-136,200,153, 59, 14,201,146, 62,207,133, 7, 61,236,101,144, 62,195,197,197, 60, 89,190,166, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,194,205, 76, 61,186,199,165, 62,195,197,197, 60, 89,190,166, 62,
-207,133, 7, 61,236,101,144, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-207,133, 7, 61,236,101,144, 62,136,200,153, 59, 14,201,146, 62,255,162, 71, 60,216, 76,120, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 32,208,163, 62, 79, 45,128, 62,147, 92,147, 62,252, 76,120, 62,
-102, 23,161, 62,115, 97, 83, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-102, 23,161, 62,115, 97, 83, 62, 22, 51,179, 62, 2,152, 97, 62, 32,208,163, 62, 79, 45,128, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 21, 51,179, 62,156, 83,135, 62, 32,208,163, 62, 79, 45,128, 62,
- 22, 51,179, 62, 2,152, 97, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 22, 51,179, 62, 2,152, 97, 62,102, 23,161, 62,115, 97, 83, 62, 21, 51,179, 62,101,111, 52, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 32,208,163, 62, 79, 45,128, 62, 21, 51,179, 62,156, 83,135, 62,
-194,195,165, 62,181,144,151, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-194,195,165, 62,181,144,151, 62,134, 50,151, 62, 29,201,146, 62, 32,208,163, 62, 79, 45,128, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,147, 92,147, 62,252, 76,120, 62, 32,208,163, 62, 79, 45,128, 62,
-134, 50,151, 62, 29,201,146, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-134, 50,151, 62, 29,201,146, 62,194,195,165, 62,181,144,151, 62,137, 67,154, 62, 70,150,169, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 82, 61,141, 62,112,190,166, 62, 0, 0,128, 62,206,199,165, 62,
-247,168,136, 62, 3,102,144, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-247,168,136, 62, 3,102,144, 62,134, 50,151, 62, 29,201,146, 62, 82, 61,141, 62,112,190,166, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,137, 67,154, 62, 70,150,169, 62, 82, 61,141, 62,112,190,166, 62,
-134, 50,151, 62, 29,201,146, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-134, 50,151, 62, 29,201,146, 62,247,168,136, 62, 3,102,144, 62,147, 92,147, 62,252, 76,120, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,150,248,166, 62, 78, 54,174, 62,137, 67,154, 62, 70,150,169, 62,
-194,195,165, 62,181,144,151, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-194,195,165, 62,181,144,151, 62, 21, 51,179, 62, 98,231,157, 62,150,248,166, 62, 78, 54,174, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 21, 51,179, 62,165,111,180, 62,150,248,166, 62, 78, 54,174, 62,
- 21, 51,179, 62, 98,231,157, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 21, 51,179, 62, 98,231,157, 62,194,195,165, 62,181,144,151, 62, 21, 51,179, 62,156, 83,135, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,128, 62, 89,162,115, 62,147, 92,147, 62,252, 76,120, 62,
-247,168,136, 62, 3,102,144, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-247,168,136, 62, 3,102,144, 62, 18,174,110, 62, 3,102,144, 62, 0, 0,128, 62, 89,162,115, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,217, 70, 89, 62,252, 76,120, 62, 0, 0,128, 62, 89,162,115, 62,
- 18,174,110, 62, 3,102,144, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 18,174,110, 62, 3,102,144, 62,247,168,136, 62, 3,102,144, 62, 0, 0,128, 62,206,199,165, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,128, 62, 89,162,115, 62,217, 70, 89, 62,252, 76,120, 62,
- 30,130,104, 62,230,176, 70, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 30,130,104, 62,230,176, 70, 62,241,190,139, 62,230,176, 70, 62, 0, 0,128, 62, 89,162,115, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,147, 92,147, 62,252, 76,120, 62, 0, 0,128, 62, 89,162,115, 62,
-241,190,139, 62,230,176, 70, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-241,190,139, 62,230,176, 70, 62, 30,130,104, 62,230,176, 70, 62, 0, 0,128, 62,208, 31, 23, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 41,187,155, 62,205,253, 30, 62, 21, 51,179, 62,101,111, 52, 62,
-102, 23,161, 62,115, 97, 83, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-102, 23,161, 62,115, 97, 83, 62,241,190,139, 62,230,176, 70, 62, 41,187,155, 62,205,253, 30, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,128, 62,208, 31, 23, 62, 41,187,155, 62,205,253, 30, 62,
-241,190,139, 62,230,176, 70, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-241,190,139, 62,230,176, 70, 62,102, 23,161, 62,115, 97, 83, 62,147, 92,147, 62,252, 76,120, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,174,137, 72, 62,205,253, 30, 62, 0, 0,128, 62,208, 31, 23, 62,
- 30,130,104, 62,230,176, 70, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 30,130,104, 62,230,176, 70, 62, 51,209, 61, 62,115, 97, 83, 62,174,137, 72, 62,205,253, 30, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,214,153, 25, 62,106,111, 52, 62,174,137, 72, 62,205,253, 30, 62,
- 51,209, 61, 62,115, 97, 83, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 51,209, 61, 62,115, 97, 83, 62, 30,130,104, 62,230,176, 70, 62,217, 70, 89, 62,252, 76,120, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,255,255,127, 62,141, 41,147, 61,215,153, 25, 62,104,111,180, 61,
-224,153, 25, 62,225, 64, 52, 61, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-224,153, 25, 62,225, 64, 52, 61, 15, 51,179, 62,225, 64, 52, 61,255,255,127, 62,141, 41,147, 61, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 20, 51,179, 62,104,111,180, 61,255,255,127, 62,141, 41,147, 61,
- 15, 51,179, 62,225, 64, 52, 61, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 15, 51,179, 62,225, 64, 52, 61,224,153, 25, 62,225, 64, 52, 61,144,175,161, 62,102, 9,239,178, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,255,255,127, 62,141, 41,147, 61, 20, 51,179, 62,104,111,180, 61,
- 12, 52,147, 62,109, 46,231, 61, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 12, 52,147, 62,109, 46,231, 61,231,151, 89, 62,109, 46,231, 61,255,255,127, 62,141, 41,147, 61, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,215,153, 25, 62,104,111,180, 61,255,255,127, 62,141, 41,147, 61,
-231,151, 89, 62,109, 46,231, 61, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-231,151, 89, 62,109, 46,231, 61, 12, 52,147, 62,109, 46,231, 61, 0, 0,128, 62,208, 31, 23, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,174,137, 72, 62,205,253, 30, 62,214,153, 25, 62,106,111, 52, 62,
-217,153, 25, 62,204, 70, 7, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-217,153, 25, 62,204, 70, 7, 62,231,151, 89, 62,109, 46,231, 61,174,137, 72, 62,205,253, 30, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,128, 62,208, 31, 23, 62,174,137, 72, 62,205,253, 30, 62,
-231,151, 89, 62,109, 46,231, 61, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-231,151, 89, 62,109, 46,231, 61,217,153, 25, 62,204, 70, 7, 62,215,153, 25, 62,104,111,180, 61, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 41,187,155, 62,205,253, 30, 62, 0, 0,128, 62,208, 31, 23, 62,
- 12, 52,147, 62,109, 46,231, 61, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 12, 52,147, 62,109, 46,231, 61, 19, 51,179, 62,204, 70, 7, 62, 41,187,155, 62,205,253, 30, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 21, 51,179, 62,101,111, 52, 62, 41,187,155, 62,205,253, 30, 62,
- 19, 51,179, 62,204, 70, 7, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 19, 51,179, 62,204, 70, 7, 62, 12, 52,147, 62,109, 46,231, 61, 20, 51,179, 62,104,111,180, 61, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,192, 95, 56, 62, 79, 45,128, 62,214,153, 25, 62,156, 83,135, 62,
-212,153, 25, 62, 2,152, 97, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-212,153, 25, 62, 2,152, 97, 62, 51,209, 61, 62,115, 97, 83, 62,192, 95, 56, 62, 79, 45,128, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,217, 70, 89, 62,252, 76,120, 62,192, 95, 56, 62, 79, 45,128, 62,
- 51,209, 61, 62,115, 97, 83, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 51,209, 61, 62,115, 97, 83, 62,212,153, 25, 62, 2,152, 97, 62,214,153, 25, 62,106,111, 52, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,192, 95, 56, 62, 79, 45,128, 62,217, 70, 89, 62,252, 76,120, 62,
-245,154, 81, 62, 29,201,146, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-245,154, 81, 62, 29,201,146, 62,125,120, 52, 62,181,144,151, 62,192, 95, 56, 62, 79, 45,128, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,214,153, 25, 62,156, 83,135, 62,192, 95, 56, 62, 79, 45,128, 62,
-125,120, 52, 62,181,144,151, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-125,120, 52, 62,181,144,151, 62,245,154, 81, 62, 29,201,146, 62,239,120, 75, 62, 70,150,169, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,213, 14, 50, 62, 78, 54,174, 62,214,153, 25, 62,165,111,180, 62,
-213,153, 25, 62,100,231,157, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-213,153, 25, 62,100,231,157, 62,125,120, 52, 62,181,144,151, 62,213, 14, 50, 62, 78, 54,174, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,239,120, 75, 62, 70,150,169, 62,213, 14, 50, 62, 78, 54,174, 62,
-125,120, 52, 62,181,144,151, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-125,120, 52, 62,181,144,151, 62,213,153, 25, 62,100,231,157, 62,214,153, 25, 62,156, 83,135, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 91,133,101, 62,112,190,166, 62,239,120, 75, 62, 70,150,169, 62,
-245,154, 81, 62, 29,201,146, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-245,154, 81, 62, 29,201,146, 62, 18,174,110, 62, 3,102,144, 62, 91,133,101, 62,112,190,166, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,128, 62,206,199,165, 62, 91,133,101, 62,112,190,166, 62,
- 18,174,110, 62, 3,102,144, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 18,174,110, 62, 3,102,144, 62,245,154, 81, 62, 29,201,146, 62,217, 70, 89, 62,252, 76,120, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 64, 27, 5, 63, 66, 45,128, 62,232,194,249, 62,216, 76,120, 62,
-226,190, 3, 63, 90, 97, 83, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-226,190, 3, 63, 90, 97, 83, 62,191,204, 12, 63,248,151, 97, 62, 64, 27, 5, 63, 66, 45,128, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,191,204, 12, 63,149, 83,135, 62, 64, 27, 5, 63, 66, 45,128, 62,
-191,204, 12, 63,248,151, 97, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-191,204, 12, 63,248,151, 97, 62,226,190, 3, 63, 90, 97, 83, 62,191,204, 12, 63, 90,111, 52, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 64, 27, 5, 63, 66, 45,128, 62,191,204, 12, 63,149, 83,135, 62,
- 17, 21, 6, 63,169,144,151, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 17, 21, 6, 63,169,144,151, 62,222,152,253, 62, 14,201,146, 62, 64, 27, 5, 63, 66, 45,128, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,232,194,249, 62,216, 76,120, 62, 64, 27, 5, 63, 66, 45,128, 62,
-222,152,253, 62, 14,201,146, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-222,152,253, 62, 14,201,146, 62, 17, 21, 6, 63,169,144,151, 62,241, 84, 0, 63, 52,150,169, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,164,163,243, 62, 89,190,166, 62, 72,102,230, 62,183,199,165, 62,
- 70, 15,239, 62,233,101,144, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 70, 15,239, 62,233,101,144, 62,222,152,253, 62, 14,201,146, 62,164,163,243, 62, 89,190,166, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,241, 84, 0, 63, 52,150,169, 62,164,163,243, 62, 89,190,166, 62,
-222,152,253, 62, 14,201,146, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-222,152,253, 62, 14,201,146, 62, 70, 15,239, 62,233,101,144, 62,232,194,249, 62,216, 76,120, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,123,175, 6, 63, 65, 54,174, 62,241, 84, 0, 63, 52,150,169, 62,
- 17, 21, 6, 63,169,144,151, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 17, 21, 6, 63,169,144,151, 62,191,204, 12, 63, 90,231,157, 62,123,175, 6, 63, 65, 54,174, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,191,204, 12, 63,160,111,180, 62,123,175, 6, 63, 65, 54,174, 62,
-191,204, 12, 63, 90,231,157, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-191,204, 12, 63, 90,231,157, 62, 17, 21, 6, 63,169,144,151, 62,191,204, 12, 63,149, 83,135, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 72,102,230, 62, 53,162,115, 62,232,194,249, 62,216, 76,120, 62,
- 70, 15,239, 62,233,101,144, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 70, 15,239, 62,233,101,144, 62, 75,189,221, 62,238,101,144, 62, 72,102,230, 62, 53,162,115, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,168, 9,211, 62,222, 76,120, 62, 72,102,230, 62, 53,162,115, 62,
- 75,189,221, 62,238,101,144, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 75,189,221, 62,238,101,144, 62, 70, 15,239, 62,233,101,144, 62, 72,102,230, 62,183,199,165, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 72,102,230, 62, 53,162,115, 62,168, 9,211, 62,222, 76,120, 62,
- 80,167,218, 62,194,176, 70, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 80,167,218, 62,194,176, 70, 62, 68, 37,242, 62,194,176, 70, 62, 72,102,230, 62, 53,162,115, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,232,194,249, 62,216, 76,120, 62, 72,102,230, 62, 53,162,115, 62,
- 68, 37,242, 62,194,176, 70, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 68, 37,242, 62,194,176, 70, 62, 80,167,218, 62,194,176, 70, 62, 72,102,230, 62,168, 31, 23, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,197, 16, 1, 63,174,253, 30, 62,191,204, 12, 63, 90,111, 52, 62,
-226,190, 3, 63, 90, 97, 83, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-226,190, 3, 63, 90, 97, 83, 62, 68, 37,242, 62,194,176, 70, 62,197, 16, 1, 63,174,253, 30, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 72,102,230, 62,168, 31, 23, 62,197, 16, 1, 63,174,253, 30, 62,
- 68, 37,242, 62,194,176, 70, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 68, 37,242, 62,194,176, 70, 62,226,190, 3, 63, 90, 97, 83, 62,232,194,249, 62,216, 76,120, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 14,171,202, 62,179,253, 30, 62, 72,102,230, 62,168, 31, 23, 62,
- 80,167,218, 62,194,176, 70, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 80,167,218, 62,194,176, 70, 62,205, 78,197, 62, 95, 97, 83, 62, 14,171,202, 62,179,253, 30, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 21, 51,179, 62,101,111, 52, 62, 14,171,202, 62,179,253, 30, 62,
-205, 78,197, 62, 95, 97, 83, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-205, 78,197, 62, 95, 97, 83, 62, 80,167,218, 62,194,176, 70, 62,168, 9,211, 62,222, 76,120, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 63,102,230, 62,101, 41,147, 61, 20, 51,179, 62,104,111,180, 61,
- 15, 51,179, 62,225, 64, 52, 61, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 15, 51,179, 62,225, 64, 52, 61,189,204, 12, 63,225, 64, 52, 61, 63,102,230, 62,101, 41,147, 61, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,191,204, 12, 63, 83,111,180, 61, 63,102,230, 62,101, 41,147, 61,
-189,204, 12, 63,225, 64, 52, 61, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-189,204, 12, 63,225, 64, 52, 61, 15, 51,179, 62,225, 64, 52, 61,144,175,161, 62,102, 9,239,178, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 63,102,230, 62,101, 41,147, 61,191,204, 12, 63, 83,111,180, 61,
-104,154,249, 62, 48, 46,231, 61, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-104,154,249, 62, 48, 46,231, 61, 42, 50,211, 62, 48, 46,231, 61, 63,102,230, 62,101, 41,147, 61, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 20, 51,179, 62,104,111,180, 61, 63,102,230, 62,101, 41,147, 61,
- 42, 50,211, 62, 48, 46,231, 61, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 42, 50,211, 62, 48, 46,231, 61,104,154,249, 62, 48, 46,231, 61, 72,102,230, 62,168, 31, 23, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 14,171,202, 62,179,253, 30, 62, 21, 51,179, 62,101,111, 52, 62,
- 19, 51,179, 62,204, 70, 7, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 19, 51,179, 62,204, 70, 7, 62, 42, 50,211, 62, 48, 46,231, 61, 14,171,202, 62,179,253, 30, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 72,102,230, 62,168, 31, 23, 62, 14,171,202, 62,179,253, 30, 62,
- 42, 50,211, 62, 48, 46,231, 61, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 42, 50,211, 62, 48, 46,231, 61, 19, 51,179, 62,204, 70, 7, 62, 20, 51,179, 62,104,111,180, 61, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,197, 16, 1, 63,174,253, 30, 62, 72,102,230, 62,168, 31, 23, 62,
-104,154,249, 62, 48, 46,231, 61, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-104,154,249, 62, 48, 46,231, 61,191,204, 12, 63,199, 70, 7, 62,197, 16, 1, 63,174,253, 30, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,191,204, 12, 63, 90,111, 52, 62,197, 16, 1, 63,174,253, 30, 62,
-191,204, 12, 63,199, 70, 7, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-191,204, 12, 63,199, 70, 7, 62,104,154,249, 62, 48, 46,231, 61,191,204, 12, 63, 83,111,180, 61, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 19,150,194, 62, 72, 45,128, 62, 21, 51,179, 62,156, 83,135, 62,
- 22, 51,179, 62, 2,152, 97, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 22, 51,179, 62, 2,152, 97, 62,205, 78,197, 62, 95, 97, 83, 62, 19,150,194, 62, 72, 45,128, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,168, 9,211, 62,222, 76,120, 62, 19,150,194, 62, 72, 45,128, 62,
-205, 78,197, 62, 95, 97, 83, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-205, 78,197, 62, 95, 97, 83, 62, 22, 51,179, 62, 2,152, 97, 62, 21, 51,179, 62,101,111, 52, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 19,150,194, 62, 72, 45,128, 62,168, 9,211, 62,222, 76,120, 62,
-179, 51,207, 62, 17,201,146, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-179, 51,207, 62, 17,201,146, 62,113,162,192, 62,174,144,151, 62, 19,150,194, 62, 72, 45,128, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 21, 51,179, 62,156, 83,135, 62, 19,150,194, 62, 72, 45,128, 62,
-113,162,192, 62,174,144,151, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-113,162,192, 62,174,144,151, 62,179, 51,207, 62, 17,201,146, 62,175, 34,204, 62, 54,150,169, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,154,109,191, 62, 68, 54,174, 62, 21, 51,179, 62,165,111,180, 62,
- 21, 51,179, 62, 98,231,157, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 21, 51,179, 62, 98,231,157, 62,113,162,192, 62,174,144,151, 62,154,109,191, 62, 68, 54,174, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,175, 34,204, 62, 54,150,169, 62,154,109,191, 62, 68, 54,174, 62,
-113,162,192, 62,174,144,151, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-113,162,192, 62,174,144,151, 62, 21, 51,179, 62, 98,231,157, 62, 21, 51,179, 62,156, 83,135, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,237, 40,217, 62, 91,190,166, 62,175, 34,204, 62, 54,150,169, 62,
-179, 51,207, 62, 17,201,146, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-179, 51,207, 62, 17,201,146, 62, 75,189,221, 62,238,101,144, 62,237, 40,217, 62, 91,190,166, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 72,102,230, 62,183,199,165, 62,237, 40,217, 62, 91,190,166, 62,
- 75,189,221, 62,238,101,144, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 75,189,221, 62,238,101,144, 62,179, 51,207, 62, 17,201,146, 62,168, 9,211, 62,222, 76,120, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,134, 78, 56, 63,117, 45,128, 62,188, 20, 48, 63, 37, 77,120, 62,
- 42,242, 54, 63,181, 97, 83, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 42,242, 54, 63,181, 97, 83, 62, 0, 0, 64, 63,115,152, 97, 62,134, 78, 56, 63,117, 45,128, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 64, 63,218, 83,135, 62,134, 78, 56, 63,117, 45,128, 62,
- 0, 0, 64, 63,115,152, 97, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 64, 63,115,152, 97, 62, 42,242, 54, 63,181, 97, 83, 62, 0, 0, 64, 63,202,111, 52, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,134, 78, 56, 63,117, 45,128, 62, 0, 0, 64, 63,218, 83,135, 62,
- 87, 72, 57, 63,219,144,151, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 87, 72, 57, 63,219,144,151, 62,184,255, 49, 63, 52,201,146, 62,134, 78, 56, 63,117, 45,128, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,188, 20, 48, 63, 37, 77,120, 62,134, 78, 56, 63,117, 45,128, 62,
-184,255, 49, 63, 52,201,146, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-184,255, 49, 63, 52,201,146, 62, 87, 72, 57, 63,219,144,151, 62, 58,136, 51, 63, 90,150,169, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 26, 5, 45, 63,117,190,166, 62,107,102, 38, 63,201,199,165, 62,
-235,186, 42, 63, 5,102,144, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-235,186, 42, 63, 5,102,144, 62,184,255, 49, 63, 52,201,146, 62, 26, 5, 45, 63,117,190,166, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 58,136, 51, 63, 90,150,169, 62, 26, 5, 45, 63,117,190,166, 62,
-184,255, 49, 63, 52,201,146, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-184,255, 49, 63, 52,201,146, 62,235,186, 42, 63, 5,102,144, 62,188, 20, 48, 63, 37, 77,120, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,196,226, 57, 63,114, 54,174, 62, 58,136, 51, 63, 90,150,169, 62,
- 87, 72, 57, 63,219,144,151, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 87, 72, 57, 63,219,144,151, 62, 0, 0, 64, 63,162,231,157, 62,196,226, 57, 63,114, 54,174, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 64, 63,211,111,180, 62,196,226, 57, 63,114, 54,174, 62,
- 0, 0, 64, 63,162,231,157, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 64, 63,162,231,157, 62, 87, 72, 57, 63,219,144,151, 62, 0, 0, 64, 63,218, 83,135, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,107,102, 38, 63, 79,162,115, 62,188, 20, 48, 63, 37, 77,120, 62,
-235,186, 42, 63, 5,102,144, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-235,186, 42, 63, 5,102,144, 62,234, 17, 34, 63,243,101,144, 62,107,102, 38, 63, 79,162,115, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 21,184, 28, 63,222, 76,120, 62,107,102, 38, 63, 79,162,115, 62,
-234, 17, 34, 63,243,101,144, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-234, 17, 34, 63,243,101,144, 62,235,186, 42, 63, 5,102,144, 62,107,102, 38, 63,201,199,165, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,107,102, 38, 63, 79,162,115, 62, 21,184, 28, 63,222, 76,120, 62,
-234,134, 32, 63,204,176, 70, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-234,134, 32, 63,204,176, 70, 62,233, 69, 44, 63,245,176, 70, 62,107,102, 38, 63, 79,162,115, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,188, 20, 48, 63, 37, 77,120, 62,107,102, 38, 63, 79,162,115, 62,
-233, 69, 44, 63,245,176, 70, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-233, 69, 44, 63,245,176, 70, 62,234,134, 32, 63,204,176, 70, 62,104,102, 38, 63,198, 31, 23, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 9, 68, 52, 63,241,253, 30, 62, 0, 0, 64, 63,202,111, 52, 62,
- 42,242, 54, 63,181, 97, 83, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 42,242, 54, 63,181, 97, 83, 62,233, 69, 44, 63,245,176, 70, 62, 9, 68, 52, 63,241,253, 30, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,104,102, 38, 63,198, 31, 23, 62, 9, 68, 52, 63,241,253, 30, 62,
-233, 69, 44, 63,245,176, 70, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-233, 69, 44, 63,245,176, 70, 62, 42,242, 54, 63,181, 97, 83, 62,188, 20, 48, 63, 37, 77,120, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,195,136, 24, 63,179,253, 30, 62,104,102, 38, 63,198, 31, 23, 62,
-234,134, 32, 63,204,176, 70, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-234,134, 32, 63,204,176, 70, 62,162,218, 21, 63, 84, 97, 83, 62,195,136, 24, 63,179,253, 30, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,191,204, 12, 63, 90,111, 52, 62,195,136, 24, 63,179,253, 30, 62,
-162,218, 21, 63, 84, 97, 83, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-162,218, 21, 63, 84, 97, 83, 62,234,134, 32, 63,204,176, 70, 62, 21,184, 28, 63,222, 76,120, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,104,102, 38, 63,111, 41,147, 61,191,204, 12, 63, 83,111,180, 61,
-189,204, 12, 63,225, 64, 52, 61, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-189,204, 12, 63,225, 64, 52, 61, 0, 0, 64, 63,111, 65, 52, 61,104,102, 38, 63,111, 41,147, 61, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 64, 63,195,111,180, 61,104,102, 38, 63,111, 41,147, 61,
- 0, 0, 64, 63,111, 65, 52, 61, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 64, 63,111, 65, 52, 61,189,204, 12, 63,225, 64, 52, 61,208,222,121, 63,102, 9,239,178, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,104,102, 38, 63,111, 41,147, 61, 0, 0, 64, 63,195,111,180, 61,
-122, 0, 48, 63,120, 46,231, 61, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-122, 0, 48, 63,120, 46,231, 61, 85,204, 28, 63, 48, 46,231, 61,104,102, 38, 63,111, 41,147, 61, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,191,204, 12, 63, 83,111,180, 61,104,102, 38, 63,111, 41,147, 61,
- 85,204, 28, 63, 48, 46,231, 61, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 85,204, 28, 63, 48, 46,231, 61,122, 0, 48, 63,120, 46,231, 61,104,102, 38, 63,198, 31, 23, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,195,136, 24, 63,179,253, 30, 62,191,204, 12, 63, 90,111, 52, 62,
-191,204, 12, 63,199, 70, 7, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-191,204, 12, 63,199, 70, 7, 62, 85,204, 28, 63, 48, 46,231, 61,195,136, 24, 63,179,253, 30, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,104,102, 38, 63,198, 31, 23, 62,195,136, 24, 63,179,253, 30, 62,
- 85,204, 28, 63, 48, 46,231, 61, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 85,204, 28, 63, 48, 46,231, 61,191,204, 12, 63,199, 70, 7, 62,191,204, 12, 63, 83,111,180, 61, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 9, 68, 52, 63,241,253, 30, 62,104,102, 38, 63,198, 31, 23, 62,
-122, 0, 48, 63,120, 46,231, 61, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-122, 0, 48, 63,120, 46,231, 61, 0, 0, 64, 63, 24, 71, 7, 62, 9, 68, 52, 63,241,253, 30, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 64, 63,202,111, 52, 62, 9, 68, 52, 63,241,253, 30, 62,
- 0, 0, 64, 63, 24, 71, 7, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 64, 63, 24, 71, 7, 62,122, 0, 48, 63,120, 46,231, 61, 0, 0, 64, 63,195,111,180, 61, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 68,126, 20, 63, 64, 45,128, 62,191,204, 12, 63,149, 83,135, 62,
-191,204, 12, 63,248,151, 97, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-191,204, 12, 63,248,151, 97, 62,162,218, 21, 63, 84, 97, 83, 62, 68,126, 20, 63, 64, 45,128, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 21,184, 28, 63,222, 76,120, 62, 68,126, 20, 63, 64, 45,128, 62,
-162,218, 21, 63, 84, 97, 83, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-162,218, 21, 63, 84, 97, 83, 62,191,204, 12, 63,248,151, 97, 62,191,204, 12, 63, 90,111, 52, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 68,126, 20, 63, 64, 45,128, 62, 21,184, 28, 63,222, 76,120, 62,
- 25,205, 26, 63, 14,201,146, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 25,205, 26, 63, 14,201,146, 62,114,132, 19, 63,169,144,151, 62, 68,126, 20, 63, 64, 45,128, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,191,204, 12, 63,149, 83,135, 62, 68,126, 20, 63, 64, 45,128, 62,
-114,132, 19, 63,169,144,151, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-114,132, 19, 63,169,144,151, 62, 25,205, 26, 63, 14,201,146, 62,150, 68, 25, 63, 54,150,169, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 7,234, 18, 63, 65, 54,174, 62,191,204, 12, 63,160,111,180, 62,
-191,204, 12, 63, 90,231,157, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-191,204, 12, 63, 90,231,157, 62,114,132, 19, 63,169,144,151, 62, 7,234, 18, 63, 65, 54,174, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,150, 68, 25, 63, 54,150,169, 62, 7,234, 18, 63, 65, 54,174, 62,
-114,132, 19, 63,169,144,151, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-114,132, 19, 63,169,144,151, 62,191,204, 12, 63, 90,231,157, 62,191,204, 12, 63,149, 83,135, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,185,199, 31, 63, 96,190,166, 62,150, 68, 25, 63, 54,150,169, 62,
- 25,205, 26, 63, 14,201,146, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 25,205, 26, 63, 14,201,146, 62,234, 17, 34, 63,243,101,144, 62,185,199, 31, 63, 96,190,166, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,107,102, 38, 63,201,199,165, 62,185,199, 31, 63, 96,190,166, 62,
-234, 17, 34, 63,243,101,144, 62, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
-234, 17, 34, 63,243,101,144, 62, 25,205, 26, 63, 14,201,146, 62, 21,184, 28, 63,222, 76,120, 62, 0, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 68, 65, 84, 65, 0, 80, 0, 0,240,177,120, 1, 0, 0, 0, 0,
- 57, 0, 0, 0, 0, 20, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255, 77, 69, 0, 0,120, 1, 0, 0,192, 66,122, 1, 0, 0, 0, 0, 50, 0, 0, 0, 1, 0, 0, 0,
- 16, 76,122, 1, 0, 0, 0, 0,128,202,118, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 77, 69,112,114,101,118,105,101,119, 46, 48, 48, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,112,248,117, 1, 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,192, 75,122, 1, 0, 0, 0, 0, 32, 74,122, 1, 0, 0, 0, 0,
-128, 74,122, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 70,122, 1, 0, 0, 0, 0, 48, 72,122, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,240, 74,122, 1, 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,128, 68,122, 1, 0, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0,
-176, 70,122, 1, 0, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0,160, 72,122, 1, 0, 0, 0, 0,
- 3, 0, 0, 0, 5, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,128,179, 0, 0, 64, 52,235, 92,142,188, 0, 0,128, 63, 2, 0,128, 63,235, 92,142, 60,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 0, 4, 0, 0, 0, 0, 0, 1, 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, 68, 65, 84, 65, 8, 0, 0, 0,
-192, 75,122, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,128,107,116, 1, 0, 0, 0, 0, 68, 65, 84, 65, 64, 1, 0, 0,
-128, 68,122, 1, 0, 0, 0, 0, 5, 1, 0, 0, 5, 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, 70,122, 1, 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, 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, 68, 65, 84, 65,100, 0, 0, 0, 0, 70,122, 1, 0, 0, 0, 0,
- 56, 0, 0, 0, 5, 0, 0, 0, 0, 0,128, 63,255,255,127, 63,255,255,251, 39, 0, 0, 0, 0,255,127, 2,255, 0, 0,128, 63,
- 0, 0,128,191, 0, 0, 2,168, 0, 0, 0, 0,255,127, 2,255, 1, 0,128,191,253,255,127,191,253,255,251,167, 0, 0, 0, 0,
-255,127, 2,255,250,255,127,191, 3, 0,128, 63, 3, 0, 2, 40, 0, 0, 0, 0,255,127, 2,255, 0,239,110, 59,131,164, 26, 60,
-235, 92, 14,189,228, 12, 95, 33, 28,133, 3,255, 68, 65, 84, 65, 64, 1, 0, 0,176, 70,122, 1, 0, 0, 0, 0, 5, 1, 0, 0,
- 5, 0, 0, 0, 3, 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, 48, 72,122, 1,
- 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,
- 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, 68, 65, 84, 65, 48, 0, 0, 0, 48, 72,122, 1, 0, 0, 0, 0, 53, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0,
- 2, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 34, 0,
- 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 34, 0, 68, 65, 84, 65, 64, 1, 0, 0,160, 72,122, 1, 0, 0, 0, 0, 5, 1, 0, 0,
- 5, 0, 0, 0, 4, 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, 32, 74,122, 1,
- 0, 0, 0, 0, 5, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 85, 86, 84,101,
-120, 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,128, 74,122, 1,
- 0, 0, 0, 0, 6, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67,111,108, 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,240, 74,122, 1,
- 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, 68, 65, 84, 65, 20, 0, 0, 0, 32, 74,122, 1, 0, 0, 0, 0, 52, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
- 3, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 68, 65, 84, 65, 48, 0, 0, 0,128, 74,122, 1, 0, 0, 0, 0,
- 60, 0, 0, 0, 1, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 68, 65, 84, 65, 16, 0, 0, 0,
-240, 74,122, 1, 0, 0, 0, 0, 57, 0, 0, 0, 4, 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 77, 69, 0, 0,120, 1, 0, 0, 16, 76,122, 1, 0, 0, 0, 0, 50, 0, 0, 0, 1, 0, 0, 0, 64, 85,122, 1, 0, 0, 0, 0,
-192, 66,122, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 69,112,114,101,118,105,101,
-119, 46, 48, 48, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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,240, 84,122, 1, 0, 0, 0, 0, 80, 83,122, 1, 0, 0, 0, 0,176, 83,122, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 80, 79,122, 1, 0, 0, 0, 0, 96, 81,122, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 32, 84,122, 1, 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,
-208, 77,122, 1, 0, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0,224, 79,122, 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 5, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0,208, 81,122, 1, 0, 0, 0, 0, 3, 0, 0, 0, 5, 0, 0, 0,
- 80, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0,128,179, 0, 0, 64, 52, 0, 0,192, 28, 0, 0,128, 63, 2, 0,128, 63,172,197, 39, 55, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 0, 4, 0, 0, 0, 0, 0, 1, 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, 68, 65, 84, 65, 8, 0, 0, 0,240, 84,122, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,112,114,116, 1, 0, 0, 0, 0, 68, 65, 84, 65, 64, 1, 0, 0,208, 77,122, 1, 0, 0, 0, 0,
- 5, 1, 0, 0, 5, 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,
- 80, 79,122, 1, 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, 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, 68, 65, 84, 65, 80, 0, 0, 0, 80, 79,122, 1, 0, 0, 0, 0, 56, 0, 0, 0, 4, 0, 0, 0,
- 0, 0,128, 63,255,255,127, 63,255,255,251, 39, 0, 0, 0, 0,255,127, 3,255, 0, 0,128, 63, 0, 0,128,191, 0, 0, 2,168,
- 0, 0, 0, 0,255,127, 3,255, 1, 0,128,191,253,255,127,191,253,255,251,167, 0, 0, 0, 0,255,127, 3,255,250,255,127,191,
- 3, 0,128, 63, 3, 0, 2, 40, 0, 0, 0, 0,255,127, 3,255, 68, 65, 84, 65, 64, 1, 0, 0,224, 79,122, 1, 0, 0, 0, 0,
- 5, 1, 0, 0, 5, 0, 0, 0, 3, 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,
- 96, 81,122, 1, 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, 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, 68, 65, 84, 65, 48, 0, 0, 0, 96, 81,122, 1, 0, 0, 0, 0, 53, 0, 0, 0, 4, 0, 0, 0,
- 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 0, 3, 0, 0, 0,
- 0, 0, 35, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 35, 0, 68, 65, 84, 65, 64, 1, 0, 0,208, 81,122, 1, 0, 0, 0, 0,
- 5, 1, 0, 0, 5, 0, 0, 0, 4, 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,
- 80, 83,122, 1, 0, 0, 0, 0, 5, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 85, 86, 84,101,120, 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,
-176, 83,122, 1, 0, 0, 0, 0, 6, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 67,111,108, 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,
- 32, 84,122, 1, 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, 68, 65, 84, 65, 20, 0, 0, 0, 80, 83,122, 1, 0, 0, 0, 0, 52, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 2, 68, 65, 84, 65, 48, 0, 0, 0,176, 83,122, 1,
- 0, 0, 0, 0, 60, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 68, 65, 84, 65,
- 16, 0, 0, 0, 32, 84,122, 1, 0, 0, 0, 0, 57, 0, 0, 0, 4, 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255, 77, 69, 0, 0,120, 1, 0, 0, 64, 85,122, 1, 0, 0, 0, 0, 50, 0, 0, 0, 1, 0, 0, 0,112, 94,122, 1,
- 0, 0, 0, 0, 16, 76,122, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 69,112,114,
-101,118,105,101,119, 46, 48, 48, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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, 32, 94,122, 1, 0, 0, 0, 0,128, 92,122, 1, 0, 0, 0, 0,224, 92,122, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 88,122, 1, 0, 0, 0, 0,144, 90,122, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 80, 93,122, 1, 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, 87,122, 1, 0, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 16, 89,122, 1,
- 0, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 91,122, 1, 0, 0, 0, 0, 3, 0, 0, 0,
- 5, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,128,179, 0, 0, 64, 52, 0, 0,192, 28, 0, 0,128, 63, 2, 0,128, 63,172,197, 39, 55, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 0, 4, 0, 0, 0, 0, 0, 1, 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, 68, 65, 84, 65, 8, 0, 0, 0, 32, 94,122, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 96,121,116, 1, 0, 0, 0, 0, 68, 65, 84, 65, 64, 1, 0, 0, 0, 87,122, 1,
- 0, 0, 0, 0, 5, 1, 0, 0, 5, 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,128, 88,122, 1, 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, 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, 68, 65, 84, 65, 80, 0, 0, 0,128, 88,122, 1, 0, 0, 0, 0, 56, 0, 0, 0,
- 4, 0, 0, 0, 0, 0,128, 63,255,255,127, 63,255,255,251, 39, 0, 0, 0, 0,255,127, 3,255, 0, 0,128, 63, 0, 0,128,191,
- 0, 0, 2,168, 0, 0, 0, 0,255,127, 3,255, 1, 0,128,191,253,255,127,191,253,255,251,167, 0, 0, 0, 0,255,127, 3,255,
-250,255,127,191, 3, 0,128, 63, 3, 0, 2, 40, 0, 0, 0, 0,255,127, 3,255, 68, 65, 84, 65, 64, 1, 0, 0, 16, 89,122, 1,
- 0, 0, 0, 0, 5, 1, 0, 0, 5, 0, 0, 0, 3, 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,144, 90,122, 1, 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, 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, 68, 65, 84, 65, 48, 0, 0, 0,144, 90,122, 1, 0, 0, 0, 0, 53, 0, 0, 0,
- 4, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 0,
- 3, 0, 0, 0, 0, 0, 35, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 35, 0, 68, 65, 84, 65, 64, 1, 0, 0, 0, 91,122, 1,
- 0, 0, 0, 0, 5, 1, 0, 0, 5, 0, 0, 0, 4, 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,128, 92,122, 1, 0, 0, 0, 0, 5, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 85, 86, 84,101,120, 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,224, 92,122, 1, 0, 0, 0, 0, 6, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 67,111,108, 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, 80, 93,122, 1, 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, 68, 65, 84, 65, 20, 0, 0, 0,128, 92,122, 1, 0, 0, 0, 0, 52, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 2, 68, 65, 84, 65, 48, 0, 0, 0,
-224, 92,122, 1, 0, 0, 0, 0, 60, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
- 68, 65, 84, 65, 16, 0, 0, 0, 80, 93,122, 1, 0, 0, 0, 0, 57, 0, 0, 0, 4, 0, 0, 0,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255, 77, 69, 0, 0,120, 1, 0, 0,112, 94,122, 1, 0, 0, 0, 0, 50, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 64, 85,122, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 77, 69, 67,117, 98,101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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,224,106,122, 1, 0, 0, 0, 0, 96,102,122, 1, 0, 0, 0, 0,
- 32,103,122, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,176, 97,122, 1, 0, 0, 0, 0, 16,100,122, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,128,104,122, 1, 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, 48, 96,122, 1, 0, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0,
-144, 98,122, 1, 0, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0,224,100,122, 1, 0, 0, 0, 0,
- 3, 0, 0, 0, 5, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 12, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,128, 51, 0, 0, 0,180, 0, 0, 0, 0, 4, 0,128, 63, 4, 0,128, 63, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 0, 4, 0, 0, 0, 0, 0, 1, 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, 68, 65, 84, 65, 8, 0, 0, 0,
-224,106,122, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,128,107,116, 1, 0, 0, 0, 0, 68, 65, 84, 65, 64, 1, 0, 0,
- 48, 96,122, 1, 0, 0, 0, 0, 5, 1, 0, 0, 5, 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,176, 97,122, 1, 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, 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, 68, 65, 84, 65,160, 0, 0, 0,176, 97,122, 1, 0, 0, 0, 0,
- 56, 0, 0, 0, 8, 0, 0, 0, 0, 0,128, 63,255,255,127, 63, 0, 0,128,191,230, 73,230, 73, 26,182, 3,255, 0, 0,128, 63,
- 0, 0,128,191, 0, 0,128,191,230, 73, 26,182, 26,182, 3,255, 1, 0,128,191,253,255,127,191, 0, 0,128,191, 26,182, 26,182,
- 26,182, 3,255,250,255,127,191, 3, 0,128, 63, 0, 0,128,191, 26,182,230, 73, 26,182, 3,255, 4, 0,128, 63,247,255,127, 63,
- 0, 0,128, 63,230, 73,230, 73,230, 73, 3,255,245,255,127, 63, 5, 0,128,191, 0, 0,128, 63,230, 73, 26,182,230, 73, 3,255,
- 3, 0,128,191,250,255,127,191, 0, 0,128, 63, 26,182, 26,182,230, 73, 3,255,255,255,127,191, 0, 0,128, 63, 0, 0,128, 63,
- 26,182,230, 73,230, 73, 3,255, 68, 65, 84, 65, 64, 1, 0, 0,144, 98,122, 1, 0, 0, 0, 0, 5, 1, 0, 0, 5, 0, 0, 0,
- 3, 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, 16,100,122, 1, 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, 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,
- 68, 65, 84, 65,144, 0, 0, 0, 16,100,122, 1, 0, 0, 0, 0, 53, 0, 0, 0, 12, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0,
- 0, 0, 35, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 35, 0, 2, 0, 0, 0,
- 3, 0, 0, 0, 0, 0, 35, 0, 4, 0, 0, 0, 5, 0, 0, 0, 0, 0, 35, 0, 5, 0, 0, 0, 6, 0, 0, 0, 0, 0, 35, 0,
- 6, 0, 0, 0, 7, 0, 0, 0, 0, 0, 35, 0, 4, 0, 0, 0, 7, 0, 0, 0, 0, 0, 35, 0, 1, 0, 0, 0, 5, 0, 0, 0,
- 0, 0, 35, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 35, 0, 2, 0, 0, 0, 6, 0, 0, 0, 0, 0, 35, 0, 3, 0, 0, 0,
- 7, 0, 0, 0, 0, 0, 35, 0, 68, 65, 84, 65, 64, 1, 0, 0,224,100,122, 1, 0, 0, 0, 0, 5, 1, 0, 0, 5, 0, 0, 0,
- 4, 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, 96,102,122, 1, 0, 0, 0, 0,
- 5, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 85, 86, 84,101,120, 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, 32,103,122, 1, 0, 0, 0, 0,
- 6, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67,111,108, 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,128,104,122, 1, 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,
- 68, 65, 84, 65,120, 0, 0, 0, 96,102,122, 1, 0, 0, 0, 0, 52, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 2, 4, 0, 0, 0, 7, 0, 0, 0, 6, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 2,
- 0, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 5, 0, 0, 0, 6, 0, 0, 0,
- 2, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 6, 0, 0, 0, 7, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 2, 4, 0, 0, 0,
- 0, 0, 0, 0, 3, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 2, 68, 65, 84, 65, 32, 1, 0, 0, 32,103,122, 1, 0, 0, 0, 0,
- 60, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 1, 0, 0, 0, 0, 0, 68, 65, 84, 65, 96, 0, 0, 0,128,104,122, 1, 0, 0, 0, 0, 57, 0, 0, 0, 24, 0, 0, 0,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 80, 65, 0, 0,232, 1, 0, 0,176,221,117, 1, 0, 0, 0, 0, 11, 1, 0, 0, 1, 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, 80, 65, 80, 83,121,115, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 18, 0, 0, 0, 2, 0, 1, 0, 0, 0, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 4, 0, 6, 0, 8, 0,
- 5, 0, 5, 0, 3, 0,100, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 4, 0, 5, 0, 3, 0, 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0,200, 66, 0, 0, 72, 66, 0, 0, 0, 0,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 63,150, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0,128, 41,182, 63, 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,128, 63, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,128, 63, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63,240,214, 35,189, 0, 0, 0, 0,184,155,196,189, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0,205,204, 76, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,205,204, 76, 62, 0, 0, 0, 64,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 63,
- 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 32, 65, 0, 0,128, 63,205,204, 76, 62,154,153,153, 62, 0, 0,128, 63,
- 0, 0,128, 63, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 63,
- 0, 0, 0, 63, 0, 0, 0, 63, 0, 1, 2, 3, 4, 5, 6, 7, 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,
- 68, 78, 65, 49, 80,145, 0, 0,192, 43,191, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 83, 68, 78, 65, 78, 65, 77, 69,
- 19, 8, 0, 0, 42,110,101,120,116, 0, 42,112,114,101,118, 0, 42,102,105,114,115,116, 0, 42,108, 97,115,116, 0,120, 0,121,
- 0,122, 0,119, 0,120,109,105,110, 0,120,109, 97,120, 0,121,109,105,110, 0,121,109, 97,120, 0, 42,112,111,105,110,116,101,
-114, 0,103,114,111,117,112, 0,118, 97,108, 0,112, 97,100, 0,110, 97,109,101, 91, 51, 50, 93, 0,116,121,112,101, 0,115,117,
- 98,116,121,112,101, 0,102,108, 97,103, 0,115, 97,118,101,100, 0,100, 97,116, 97, 0,108,101,110, 0,116,111,116, 97,108,108,
-101,110, 0, 42,110,101,119,105,100, 0, 42,108,105, 98, 0,110, 97,109,101, 91, 50, 52, 93, 0,117,115, 0,105, 99,111,110, 95,
-105,100, 0, 42,112,114,111,112,101,114,116,105,101,115, 0,105,100, 0, 42,105,100, 98,108,111, 99,107, 0, 42,102,105,108,101,
-100, 97,116, 97, 0,110, 97,109,101, 91, 50, 52, 48, 93, 0,102,105,108,101,110, 97,109,101, 91, 50, 52, 48, 93, 0,116,111,116,
- 0, 42,112, 97,114,101,110,116, 0,119, 91, 50, 93, 0,104, 91, 50, 93, 0, 99,104, 97,110,103,101,100, 91, 50, 93, 0,112, 97,
-100, 48, 0,112, 97,100, 49, 0, 42,114,101, 99,116, 91, 50, 93, 0, 99,117,114,118,101, 0, 99,117,114, 0, 98,108,111, 99,107,
-116,121,112,101, 0,115,104,111,119,107,101,121, 0,109,117,116,101,105,112,111, 0,112,111,115, 0, 99,117,114,118, 97,108, 0,
- 97,100,114, 99,111,100,101, 0,114,101,108, 97,116,105,118,101, 0,116,111,116,101,108,101,109, 0,112, 97,100, 50, 0, 42,100,
- 97,116, 97, 0, 42,119,101,105,103,104,116,115, 0,118,103,114,111,117,112, 91, 51, 50, 93, 0,115,108,105,100,101,114,109,105,
-110, 0,115,108,105,100,101,114,109, 97,120, 0, 42,114,101,102,107,101,121, 0,101,108,101,109,115,116,114, 91, 51, 50, 93, 0,
-101,108,101,109,115,105,122,101, 0, 98,108,111, 99,107, 0, 42,105,112,111, 0, 42,102,114,111,109, 0,116,111,116,107,101,121,
- 0,115,108,117,114,112,104, 0, 42, 42,115, 99,114,105,112,116,115, 0, 42,102,108, 97,103, 0, 97, 99,116,115, 99,114,105,112,
-116, 0,116,111,116,115, 99,114,105,112,116, 0, 42,108,105,110,101, 0, 42,102,111,114,109, 97,116, 0, 98,108,101,110, 0, 42,
-110, 97,109,101, 0,102,108, 97,103,115, 0,110,108,105,110,101,115, 0,108,105,110,101,115, 0, 42, 99,117,114,108, 0, 42,115,
-101,108,108, 0, 99,117,114, 99, 0,115,101,108, 99, 0, 42,117,110,100,111, 95, 98,117,102, 0,117,110,100,111, 95,112,111,115,
- 0,117,110,100,111, 95,108,101,110, 0, 42, 99,111,109,112,105,108,101,100, 0,115,105,122,101, 0,115,101,101,107, 0,112, 97,
-115,115,101,112, 97,114,116, 97,108,112,104, 97, 0, 97,110,103,108,101, 0, 99,108,105,112,115,116, 97, 0, 99,108,105,112,101,
-110,100, 0,108,101,110,115, 0,111,114,116,104,111, 95,115, 99, 97,108,101, 0,100,114, 97,119,115,105,122,101, 0,115,104,105,
-102,116,120, 0,115,104,105,102,116,121, 0, 89, 70, 95,100,111,102,100,105,115,116, 0, 89, 70, 95, 97,112,101,114,116,117,114,
-101, 0, 89, 70, 95, 98,107,104,116,121,112,101, 0, 89, 70, 95, 98,107,104, 98,105, 97,115, 0, 89, 70, 95, 98,107,104,114,111,
-116, 0,115, 99,114,105,112,116,108,105,110,107, 0, 42,100,111,102, 95,111, 98, 0,102,114, 97,109,101,110,114, 0,102,114, 97,
-109,101,115, 0,111,102,102,115,101,116, 0,115,102,114, 97, 0,102,105,101, 95,105,109, 97, 0, 99,121, 99,108, 0,111,107, 0,
-109,117,108,116,105, 95,105,110,100,101,120, 0,108, 97,121,101,114, 0,112, 97,115,115, 0,109,101,110,117,110,114, 0,105, 98,
-117,102,115, 0, 42, 97,110,105,109, 0, 42,114,114, 0,115,111,117,114, 99,101, 0,108, 97,115,116,102,114, 97,109,101, 0,116,
-112, 97,103,101,102,108, 97,103, 0,116,111,116, 98,105,110,100, 0,120,114,101,112, 0,121,114,101,112, 0,116,119,115,116, 97,
- 0,116,119,101,110,100, 0, 98,105,110,100, 99,111,100,101, 0, 42,114,101,112, 98,105,110,100, 0, 42,112, 97, 99,107,101,100,
-102,105,108,101, 0, 42,112,114,101,118,105,101,119, 0,108, 97,115,116,117,112,100, 97,116,101, 0,108, 97,115,116,117,115,101,
-100, 0, 97,110,105,109,115,112,101,101,100, 0,103,101,110, 95,120, 0,103,101,110, 95,121, 0,103,101,110, 95,116,121,112,101,
- 0, 97,115,112,120, 0, 97,115,112,121, 0, 42,118,110,111,100,101, 0,116,101,120, 99,111, 0,109, 97,112,116,111, 0,109, 97,
-112,116,111,110,101,103, 0, 98,108,101,110,100,116,121,112,101, 0, 42,111, 98,106,101, 99,116, 0, 42,116,101,120, 0,117,118,
-110, 97,109,101, 91, 51, 50, 93, 0,112,114,111,106,120, 0,112,114,111,106,121, 0,112,114,111,106,122, 0,109, 97,112,112,105,
-110,103, 0,111,102,115, 91, 51, 93, 0,115,105,122,101, 91, 51, 93, 0,116,101,120,102,108, 97,103, 0, 99,111,108,111,114,109,
-111,100,101,108, 0,112,109, 97,112,116,111, 0,112,109, 97,112,116,111,110,101,103, 0,114, 0,103, 0, 98, 0,107, 0,100,101,
-102, 95,118, 97,114, 0,114,116, 0, 99,111,108,102, 97, 99, 0,110,111,114,102, 97, 99, 0,118, 97,114,102, 97, 99, 0,100,105,
-115,112,102, 97, 99, 0,119, 97,114,112,102, 97, 99, 0,110, 97,109,101, 91, 49, 54, 48, 93, 0, 42,104, 97,110,100,108,101, 0,
- 42,112,110, 97,109,101, 0, 42,115,116,110, 97,109,101,115, 0,115,116,121,112,101,115, 0,118, 97,114,115, 0, 42,118, 97,114,
-115,116,114, 0, 42,114,101,115,117,108,116, 0, 42, 99,102,114, 97, 0,100, 97,116, 97, 91, 51, 50, 93, 0, 40, 42,100,111,105,
-116, 41, 40, 41, 0, 40, 42,105,110,115,116, 97,110, 99,101, 95,105,110,105,116, 41, 40, 41, 0, 40, 42, 99, 97,108,108, 98, 97,
- 99,107, 41, 40, 41, 0,118,101,114,115,105,111,110, 0, 97, 0,105,112,111,116,121,112,101, 0, 42,105,109, 97, 0, 42, 99,117,
- 98,101, 91, 54, 93, 0,105,109, 97,116, 91, 52, 93, 91, 52, 93, 0,111, 98,105,109, 97,116, 91, 51, 93, 91, 51, 93, 0,115,116,
-121,112,101, 0,118,105,101,119,115, 99, 97,108,101, 0,110,111,116,108, 97,121, 0, 99,117, 98,101,114,101,115, 0,100,101,112,
-116,104, 0,114,101, 99, 97,108, 99, 0,108, 97,115,116,115,105,122,101, 0,110,111,105,115,101,115,105,122,101, 0,116,117,114,
- 98,117,108, 0, 98,114,105,103,104,116, 0, 99,111,110,116,114, 97,115,116, 0,114,102, 97, 99, 0,103,102, 97, 99, 0, 98,102,
- 97, 99, 0,102,105,108,116,101,114,115,105,122,101, 0,109,103, 95, 72, 0,109,103, 95,108, 97, 99,117,110, 97,114,105,116,121,
- 0,109,103, 95,111, 99,116, 97,118,101,115, 0,109,103, 95,111,102,102,115,101,116, 0,109,103, 95,103, 97,105,110, 0,100,105,
-115,116, 95, 97,109,111,117,110,116, 0,110,115, 95,111,117,116,115, 99, 97,108,101, 0,118,110, 95,119, 49, 0,118,110, 95,119,
- 50, 0,118,110, 95,119, 51, 0,118,110, 95,119, 52, 0,118,110, 95,109,101,120,112, 0,118,110, 95,100,105,115,116,109, 0,118,
-110, 95, 99,111,108,116,121,112,101, 0,110,111,105,115,101,100,101,112,116,104, 0,110,111,105,115,101,116,121,112,101, 0,110,
-111,105,115,101, 98, 97,115,105,115, 0,110,111,105,115,101, 98, 97,115,105,115, 50, 0,105,109, 97,102,108, 97,103, 0, 99,114,
-111,112,120,109,105,110, 0, 99,114,111,112,121,109,105,110, 0, 99,114,111,112,120,109, 97,120, 0, 99,114,111,112,121,109, 97,
-120, 0,120,114,101,112,101, 97,116, 0,121,114,101,112,101, 97,116, 0,101,120,116,101,110,100, 0, 99,104,101, 99,107,101,114,
-100,105,115,116, 0,110, 97, 98,108, 97, 0,105,117,115,101,114, 0, 42,112,108,117,103,105,110, 0, 42, 99,111, 98, 97, 0, 42,
-101,110,118, 0,108,111, 99, 91, 51, 93, 0,114,111,116, 91, 51, 93, 0,109, 97,116, 91, 52, 93, 91, 52, 93, 0,109,105,110, 91,
- 51, 93, 0,109, 97,120, 91, 51, 93, 0, 42,111, 98, 0,109,111,100,101, 0,116,111,116,101,120, 0,101,110,101,114,103,121, 0,
-100,105,115,116, 0,115,112,111,116,115,105,122,101, 0,115,112,111,116, 98,108,101,110,100, 0,104, 97,105,110,116, 0, 97,116,
-116, 49, 0, 97,116,116, 50, 0, 42, 99,117,114,102, 97,108,108,111,102,102, 0,102, 97,108,108,111,102,102, 95,116,121,112,101,
- 0,112, 97,100, 51, 0,115,104, 97,100,115,112,111,116,115,105,122,101, 0, 98,105, 97,115, 0,115,111,102,116, 0, 98,117,102,
-115,105,122,101, 0,115, 97,109,112, 0, 98,117,102,102,101,114,115, 0,102,105,108,116,101,114,116,121,112,101, 0, 98,117,102,
-102,108, 97,103, 0, 98,117,102,116,121,112,101, 0,114, 97,121, 95,115, 97,109,112, 0,114, 97,121, 95,115, 97,109,112,121, 0,
-114, 97,121, 95,115, 97,109,112,122, 0,114, 97,121, 95,115, 97,109,112, 95,116,121,112,101, 0, 97,114,101, 97, 95,115,104, 97,
-112,101, 0, 97,114,101, 97, 95,115,105,122,101, 0, 97,114,101, 97, 95,115,105,122,101,121, 0, 97,114,101, 97, 95,115,105,122,
-101,122, 0, 97,100, 97,112,116, 95,116,104,114,101,115,104, 0,114, 97,121, 95,115, 97,109,112, 95,109,101,116,104,111,100, 0,
-116,101,120, 97, 99,116, 0,115,104, 97,100,104, 97,108,111,115,116,101,112, 0, 89, 70, 95,110,117,109,112,104,111,116,111,110,
-115, 0, 89, 70, 95,110,117,109,115,101, 97,114, 99,104, 0, 89, 70, 95,112,104,100,101,112,116,104, 0, 89, 70, 95,117,115,101,
-113,109, 99, 0, 89, 70, 95, 98,117,102,115,105,122,101, 0, 89, 70, 95,112, 97,100, 0, 89, 70, 95, 99, 97,117,115,116,105, 99,
- 98,108,117,114, 0, 89, 70, 95,108,116,114, 97,100,105,117,115, 0, 89, 70, 95,103,108,111,119,105,110,116, 0, 89, 70, 95,103,
-108,111,119,111,102,115, 0, 89, 70, 95,103,108,111,119,116,121,112,101, 0, 89, 70, 95,112, 97,100, 50, 0, 42,109,116,101,120,
- 91, 49, 48, 93, 0,115,112,101, 99,114, 0,115,112,101, 99,103, 0,115,112,101, 99, 98, 0,109,105,114,114, 0,109,105,114,103,
- 0,109,105,114, 98, 0, 97,109, 98,114, 0, 97,109, 98, 98, 0, 97,109, 98,103, 0, 97,109, 98, 0,101,109,105,116, 0, 97,110,
-103, 0,115,112,101, 99,116,114, 97, 0,114, 97,121, 95,109,105,114,114,111,114, 0, 97,108,112,104, 97, 0,114,101,102, 0,115,
-112,101, 99, 0,122,111,102,102,115, 0, 97,100,100, 0,116,114, 97,110,115,108,117, 99,101,110, 99,121, 0,102,114,101,115,110,
-101,108, 95,109,105,114, 0,102,114,101,115,110,101,108, 95,109,105,114, 95,105, 0,102,114,101,115,110,101,108, 95,116,114, 97,
- 0,102,114,101,115,110,101,108, 95,116,114, 97, 95,105, 0,102,105,108,116,101,114, 0,116,120, 95,108,105,109,105,116, 0,116,
-120, 95,102, 97,108,108,111,102,102, 0,114, 97,121, 95,100,101,112,116,104, 0,114, 97,121, 95,100,101,112,116,104, 95,116,114,
- 97, 0,104, 97,114, 0,115,101,101,100, 49, 0,115,101,101,100, 50, 0,103,108,111,115,115, 95,109,105,114, 0,103,108,111,115,
-115, 95,116,114, 97, 0,115, 97,109,112, 95,103,108,111,115,115, 95,109,105,114, 0,115, 97,109,112, 95,103,108,111,115,115, 95,
-116,114, 97, 0, 97,100, 97,112,116, 95,116,104,114,101,115,104, 95,109,105,114, 0, 97,100, 97,112,116, 95,116,104,114,101,115,
-104, 95,116,114, 97, 0, 97,110,105,115,111, 95,103,108,111,115,115, 95,109,105,114, 0,100,105,115,116, 95,109,105,114, 0,102,
- 97,100,101,116,111, 95,109,105,114, 0,109,111,100,101, 95,108, 0,102,108, 97,114,101, 99, 0,115,116, 97,114, 99, 0,108,105,
-110,101, 99, 0,114,105,110,103, 99, 0,104, 97,115,105,122,101, 0,102,108, 97,114,101,115,105,122,101, 0,115,117, 98,115,105,
-122,101, 0,102,108, 97,114,101, 98,111,111,115,116, 0,115,116,114, 97,110,100, 95,115,116, 97, 0,115,116,114, 97,110,100, 95,
-101,110,100, 0,115,116,114, 97,110,100, 95,101, 97,115,101, 0,115,116,114, 97,110,100, 95,117,118,110, 97,109,101, 91, 51, 50,
- 93, 0,115, 98,105, 97,115, 0,115,104, 97,100, 95, 97,108,112,104, 97, 0,112, 97,100,102, 0,114,103, 98,115,101,108, 0,112,
-114, 95,116,121,112,101, 0,117,115,101, 95,110,111,100,101,115, 0,112,114, 95, 98, 97, 99,107, 0,112,114, 95,108, 97,109,112,
- 0,115,101,112,116,101,120, 0,109,108, 95,102,108, 97,103, 0,100,105,102,102, 95,115,104, 97,100,101,114, 0,115,112,101, 99,
- 95,115,104, 97,100,101,114, 0,114,111,117,103,104,110,101,115,115, 0,114,101,102,114, 97, 99, 0,112, 97,114, 97,109, 91, 52,
- 93, 0,114,109,115, 0,100, 97,114,107,110,101,115,115, 0, 42,114, 97,109,112, 95, 99,111,108, 0, 42,114, 97,109,112, 95,115,
-112,101, 99, 0,114, 97,109,112,105,110, 95, 99,111,108, 0,114, 97,109,112,105,110, 95,115,112,101, 99, 0,114, 97,109,112, 98,
-108,101,110,100, 95, 99,111,108, 0,114, 97,109,112, 98,108,101,110,100, 95,115,112,101, 99, 0,114, 97,109,112, 95,115,104,111,
-119, 0,114, 97,109,112,102, 97, 99, 95, 99,111,108, 0,114, 97,109,112,102, 97, 99, 95,115,112,101, 99, 0, 42,110,111,100,101,
-116,114,101,101, 0, 42,103,114,111,117,112, 0,102,114,105, 99,116,105,111,110, 0,102,104, 0,114,101,102,108,101, 99,116, 0,
-102,104,100,105,115,116, 0,120,121,102,114,105, 99,116, 0,100,121,110, 97,109,111,100,101, 0,115,115,115, 95,114, 97,100,105,
-117,115, 91, 51, 93, 0,115,115,115, 95, 99,111,108, 91, 51, 93, 0,115,115,115, 95,101,114,114,111,114, 0,115,115,115, 95,115,
- 99, 97,108,101, 0,115,115,115, 95,105,111,114, 0,115,115,115, 95, 99,111,108,102, 97, 99, 0,115,115,115, 95,116,101,120,102,
- 97, 99, 0,115,115,115, 95,102,114,111,110,116, 0,115,115,115, 95, 98, 97, 99,107, 0,115,115,115, 95,102,108, 97,103, 0,115,
-115,115, 95,112,114,101,115,101,116, 0, 89, 70, 95, 97,114, 0, 89, 70, 95, 97,103, 0, 89, 70, 95, 97, 98, 0, 89, 70, 95,100,
-115, 99, 97,108,101, 0, 89, 70, 95,100,112,119,114, 0, 89, 70, 95,100,115,109,112, 0, 89, 70, 95,112,114,101,115,101,116, 0,
- 89, 70, 95,100,106,105,116, 0,110, 97,109,101, 91, 50, 53, 54, 93, 0,115, 99, 97,108,101, 0, 42, 98, 98, 0,105, 49, 0,106,
- 49, 0,107, 49, 0,105, 50, 0,106, 50, 0,107, 50, 0,115,101,108, 99,111,108, 49, 0,115,101,108, 99,111,108, 50, 0,113,117,
- 97,116, 91, 52, 93, 0,101,120,112,120, 0,101,120,112,121, 0,101,120,112,122, 0,114, 97,100, 0,114, 97,100, 50, 0,115, 0,
- 42,109, 97,116, 0, 42,105,109, 97,116, 0,101,108,101,109,115, 0,100,105,115,112, 0, 42, 42,109, 97,116, 0,116,111,116, 99,
-111,108, 0,119,105,114,101,115,105,122,101, 0,114,101,110,100,101,114,115,105,122,101, 0,116,104,114,101,115,104, 0,118,101,
- 99, 91, 51, 93, 91, 51, 93, 0, 97,108,102, 97, 0,119,101,105,103,104,116, 0,114, 97,100,105,117,115, 0,104, 49, 0,104, 50,
- 0,102, 49, 0,102, 50, 0,102, 51, 0,104,105,100,101, 0,118,101, 99, 91, 52, 93, 0,109, 97,116, 95,110,114, 0,112,110,116,
-115,117, 0,112,110,116,115,118, 0,114,101,115,111,108,117, 0,114,101,115,111,108,118, 0,111,114,100,101,114,117, 0,111,114,
-100,101,114,118, 0,102,108, 97,103,117, 0,102,108, 97,103,118, 0, 42,107,110,111,116,115,117, 0, 42,107,110,111,116,115,118,
- 0, 42, 98,112, 0, 42, 98,101,122,116, 0,116,105,108,116, 95,105,110,116,101,114,112, 0, 99,104, 97,114,105,100,120, 0,107,
-101,114,110, 0,104, 0,110,117,114, 98, 0, 42, 98,101,118,111, 98,106, 0, 42,116, 97,112,101,114,111, 98,106, 0, 42,116,101,
-120,116,111,110, 99,117,114,118,101, 0, 42,112, 97,116,104, 0, 42,107,101,121, 0, 98,101,118, 0,112, 97,116,104,108,101,110,
- 0, 98,101,118,114,101,115,111,108, 0,119,105,100,116,104, 0,101,120,116, 49, 0,101,120,116, 50, 0,114,101,115,111,108,117,
- 95,114,101,110, 0,114,101,115,111,108,118, 95,114,101,110, 0,115,112, 97, 99,101,109,111,100,101, 0,115,112, 97, 99,105,110,
-103, 0,108,105,110,101,100,105,115,116, 0,115,104,101, 97,114, 0,102,115,105,122,101, 0,119,111,114,100,115,112, 97, 99,101,
- 0,117,108,112,111,115, 0,117,108,104,101,105,103,104,116, 0,120,111,102, 0,121,111,102, 0,108,105,110,101,119,105,100,116,
-104, 0, 42,115,116,114, 0,102, 97,109,105,108,121, 91, 50, 52, 93, 0, 42,118,102,111,110,116, 0, 42,118,102,111,110,116, 98,
- 0, 42,118,102,111,110,116,105, 0, 42,118,102,111,110,116, 98,105, 0,115,101,112, 99,104, 97,114, 0,116,111,116, 98,111,120,
- 0, 97, 99,116, 98,111,120, 0, 42,116, 98, 0,115,101,108,115,116, 97,114,116, 0,115,101,108,101,110,100, 0, 42,115,116,114,
-105,110,102,111, 0, 99,117,114,105,110,102,111, 0,110, 97,109,101, 91, 49, 50, 56, 93, 0,109, 97,120,114, 99,116, 0,116,111,
-116,114, 99,116, 0,118, 97,114,116,121,112,101, 0,116,111,116,118,101,114,116, 0,105,112,111, 0,101,120,116,114, 97,112, 0,
- 98,105,116,109, 97,115,107, 0,115,108,105,100,101, 95,109,105,110, 0,115,108,105,100,101, 95,109, 97,120, 0, 42,100,114,105,
-118,101,114, 0,101,102,102,101, 99,116, 0, 42,109,102, 97, 99,101, 0, 42,109,116,102, 97, 99,101, 0, 42,116,102, 97, 99,101,
- 0, 42,109,118,101,114,116, 0, 42,109,101,100,103,101, 0, 42,100,118,101,114,116, 0, 42,109, 99,111,108, 0, 42,109,115,116,
-105, 99,107,121, 0, 42,116,101,120, 99,111,109,101,115,104, 0, 42,109,115,101,108,101, 99,116, 0,118,100, 97,116, 97, 0,101,
-100, 97,116, 97, 0,102,100, 97,116, 97, 0,116,111,116,101,100,103,101, 0,116,111,116,102, 97, 99,101, 0,116,111,116,115,101,
-108,101, 99,116, 0, 97, 99,116, 95,102, 97, 99,101, 0, 99,117, 98,101,109, 97,112,115,105,122,101, 0,115,109,111,111,116,104,
-114,101,115,104, 0,115,117, 98,100,105,118, 0,115,117, 98,100,105,118,114, 0,115,117, 98,115,117,114,102,116,121,112,101, 0,
- 42,109,114, 0, 42,112,118, 0, 42,116,112, 97,103,101, 0,117,118, 91, 52, 93, 91, 50, 93, 0, 99,111,108, 91, 52, 93, 0,116,
-114, 97,110,115,112, 0,116,105,108,101, 0,117,110,119,114, 97,112, 0,118, 49, 0,118, 50, 0,118, 51, 0,118, 52, 0,101,100,
- 99,111,100,101, 0, 99,114,101, 97,115,101, 0,100,101,102, 95,110,114, 0, 42,100,119, 0,116,111,116,119,101,105,103,104,116,
- 0, 99,111, 91, 51, 93, 0,110,111, 91, 51, 93, 0, 99,111, 91, 50, 93, 0,105,110,100,101,120, 0,102, 0,105, 0,115, 91, 50,
- 53, 54, 93, 0,118, 91, 52, 93, 0,109,105,100, 0,112, 97,100, 91, 50, 93, 0,118, 91, 50, 93, 0, 42,102, 97, 99,101,115, 0,
- 42, 99,111,108,102, 97, 99,101,115, 0, 42,101,100,103,101,115, 0, 42,101,100,103,101, 95, 98,111,117,110,100, 97,114,121, 95,
-115,116, 97,116,101,115, 0, 42,118,101,114,116, 95,101,100,103,101, 95,109, 97,112, 0, 42,118,101,114,116, 95,102, 97, 99,101,
- 95,109, 97,112, 0, 42,109, 97,112, 95,109,101,109, 0, 42,118,101,114,116,115, 0,108,101,118,101,108,115, 0,108,101,118,101,
-108, 95, 99,111,117,110,116, 0, 99,117,114,114,101,110,116, 0,110,101,119,108,118,108, 0,101,100,103,101,108,118,108, 0,112,
-105,110,108,118,108, 0,114,101,110,100,101,114,108,118,108, 0,117,115,101, 95, 99,111,108, 0, 42,101,100,103,101, 95,102,108,
- 97,103,115, 0, 42,101,100,103,101, 95, 99,114,101, 97,115,101,115, 0, 42,118,101,114,116, 95,109, 97,112, 0, 42,101,100,103,
-101, 95,109, 97,112, 0, 42,111,108,100, 95,102, 97, 99,101,115, 0, 42,111,108,100, 95,101,100,103,101,115, 0, 42,101,114,114,
-111,114, 0,109,111,100,105,102,105,101,114, 0,115,117, 98,100,105,118, 84,121,112,101, 0,114,101,110,100,101,114, 76,101,118,
-101,108,115, 0, 42,101,109, 67, 97, 99,104,101, 0, 42,109, 67, 97, 99,104,101, 0,100,101,102, 97,120,105,115, 0,112, 97,100,
- 91, 54, 93, 0,115,116, 97,114,116, 0,108,101,110,103,116,104, 0,114, 97,110,100,111,109,105,122,101, 0,115,101,101,100, 0,
- 42,115,116, 97,114,116, 95, 99, 97,112, 0, 42,101,110,100, 95, 99, 97,112, 0, 42, 99,117,114,118,101, 95,111, 98, 0, 42,111,
-102,102,115,101,116, 95,111, 98, 0,111,102,102,115,101,116, 91, 51, 93, 0,115, 99, 97,108,101, 91, 51, 93, 0,109,101,114,103,
-101, 95,100,105,115,116, 0,102,105,116, 95,116,121,112,101, 0,111,102,102,115,101,116, 95,116,121,112,101, 0, 99,111,117,110,
-116, 0, 97,120,105,115, 0,116,111,108,101,114, 97,110, 99,101, 0, 42,109,105,114,114,111,114, 95,111, 98, 0,115,112,108,105,
-116, 95, 97,110,103,108,101, 0, 42,116,101,120,116,117,114,101, 0,115,116,114,101,110,103,116,104, 0,100,105,114,101, 99,116,
-105,111,110, 0,100,101,102,103,114,112, 95,110, 97,109,101, 91, 51, 50, 93, 0,109,105,100,108,101,118,101,108, 0,116,101,120,
-109, 97,112,112,105,110,103, 0, 42,109, 97,112, 95,111, 98,106,101, 99,116, 0,117,118,108, 97,121,101,114, 95,110, 97,109,101,
- 91, 51, 50, 93, 0,117,118,108, 97,121,101,114, 95,116,109,112, 0, 42,112,114,111,106,101, 99,116,111,114,115, 91, 49, 48, 93,
- 0, 42,105,109, 97,103,101, 0,110,117,109, 95,112,114,111,106,101, 99,116,111,114,115, 0, 97,115,112,101, 99,116,120, 0, 97,
-115,112,101, 99,116,121, 0,112,101,114, 99,101,110,116, 0,102, 97, 99,101, 67,111,117,110,116, 0,102, 97, 99, 0,114,101,112,
-101, 97,116, 0, 42,111, 98,106,101, 99,116, 99,101,110,116,101,114, 0,115,116, 97,114,116,120, 0,115,116, 97,114,116,121, 0,
-104,101,105,103,104,116, 0,110, 97,114,114,111,119, 0,115,112,101,101,100, 0,100, 97,109,112, 0,116,105,109,101,111,102,102,
-115, 0,108,105,102,101,116,105,109,101, 0,100,101,102,111,114,109,102,108, 97,103, 0,109,117,108,116,105, 0, 42,112,114,101,
-118, 67,111,115, 0,112, 97,114,101,110,116,105,110,118, 91, 52, 93, 91, 52, 93, 0, 99,101,110,116, 91, 51, 93, 0,102, 97,108,
-108,111,102,102, 0, 42,105,110,100,101,120, 97,114, 0,116,111,116,105,110,100,101,120, 0,102,111,114, 99,101, 0,111,112,101,
-114, 97,116,105,111,110, 0,118,101,114,116,101,120, 0,116,111,116,105,110,102,108,117,101,110, 99,101, 0,103,114,105,100,115,
-105,122,101, 0,110,101,101,100, 98,105,110,100, 0, 42, 98,105,110,100,119,101,105,103,104,116,115, 0, 42, 98,105,110,100, 99,
-111,115, 0,116,111,116, 99, 97,103,101,118,101,114,116, 0, 42,100,121,110,103,114,105,100, 0, 42,100,121,110,105,110,102,108,
-117,101,110, 99,101,115, 0, 42,100,121,110,118,101,114,116,115, 0, 42,112, 97,100, 50, 0,100,121,110,103,114,105,100,115,105,
-122,101, 0,100,121,110, 99,101,108,108,109,105,110, 91, 51, 93, 0,100,121,110, 99,101,108,108,119,105,100,116,104, 0, 98,105,
-110,100,109, 97,116, 91, 52, 93, 91, 52, 93, 0, 42,112,115,121,115, 0, 42,100,109, 0,114,116, 91, 51, 93, 0,112,115,121,115,
- 0,114,116, 91, 50, 93, 0, 42,102, 97, 99,101,112, 97, 0,118,103,114,111,117,112, 0,112,114,111,116,101, 99,116, 0,112,110,
-116,115,119, 0,111,112,110,116,115,117, 0,111,112,110,116,115,118, 0,111,112,110,116,115,119, 0,116,121,112,101,117, 0,116,
-121,112,101,118, 0,116,121,112,101,119, 0,102,117, 0,102,118, 0,102,119, 0,100,117, 0,100,118, 0,100,119, 0, 42,100,101,
-102, 0,118,101, 99, 91, 56, 93, 91, 51, 93, 0,112, 97,114,116,121,112,101, 0,112, 97,114, 49, 0,112, 97,114, 50, 0,112, 97,
-114, 51, 0,112, 97,114,115,117, 98,115,116,114, 91, 51, 50, 93, 0, 42,116,114, 97, 99,107, 0, 42,112,114,111,120,121, 0, 42,
-112,114,111,120,121, 95,103,114,111,117,112, 0, 42,112,114,111,120,121, 95,102,114,111,109, 0, 42, 97, 99,116,105,111,110, 0,
- 42,112,111,115,101, 0, 99,111,110,115,116,114, 97,105,110,116, 67,104, 97,110,110,101,108,115, 0,100,101,102, 98, 97,115,101,
- 0,109,111,100,105,102,105,101,114,115, 0,100,108,111, 99, 91, 51, 93, 0,111,114,105,103, 91, 51, 93, 0,100,115,105,122,101,
- 91, 51, 93, 0,100,114,111,116, 91, 51, 93, 0,100,113,117, 97,116, 91, 52, 93, 0,111, 98,109, 97,116, 91, 52, 93, 91, 52, 93,
- 0, 99,111,110,115,116,105,110,118, 91, 52, 93, 91, 52, 93, 0,108, 97,121, 0, 99,111,108, 98,105,116,115, 0,116,114, 97,110,
-115,102,108, 97,103, 0,105,112,111,102,108, 97,103, 0,116,114, 97, 99,107,102,108, 97,103, 0,117,112,102,108, 97,103, 0,110,
-108, 97,102,108, 97,103, 0,112,114,111,116,101, 99,116,102,108, 97,103, 0,105,112,111,119,105,110, 0,115, 99, 97,102,108, 97,
-103, 0,115, 99, 97,118,105,115,102,108, 97,103, 0, 98,111,117,110,100,116,121,112,101, 0,100,117,112,111,110, 0,100,117,112,
-111,102,102, 0,100,117,112,115,116, 97, 0,100,117,112,101,110,100, 0,115,102, 0, 99,116,105,109,101, 0,109, 97,115,115, 0,
-100, 97,109,112,105,110,103, 0,105,110,101,114,116,105, 97, 0,102,111,114,109,102, 97, 99,116,111,114, 0,114,100, 97,109,112,
-105,110,103, 0,115,105,122,101,102, 97, 99, 0,100,116, 0,100,116,120, 0, 97, 99,116, 99,111,108, 0,101,109,112,116,121, 95,
-100,114, 97,119,116,121,112,101, 0,112, 97,100, 49, 91, 55, 93, 0,101,109,112,116,121, 95,100,114, 97,119,115,105,122,101, 0,
-112,114,111,112, 0,115,101,110,115,111,114,115, 0, 99,111,110,116,114,111,108,108,101,114,115, 0, 97, 99,116,117, 97,116,111,
-114,115, 0, 42,115,117,109,111,104, 97,110,100,108,101, 0, 98, 98,115,105,122,101, 91, 51, 93, 0, 97, 99,116,100,101,102, 0,
-103, 97,109,101,102,108, 97,103, 0,103, 97,109,101,102,108, 97,103, 50, 0,115,111,102,116,102,108, 97,103, 0, 97,110,105,115,
-111,116,114,111,112,105, 99, 70,114,105, 99,116,105,111,110, 91, 51, 93, 0, 99,111,110,115,116,114, 97,105,110,116,115, 0,110,
-108, 97,115,116,114,105,112,115, 0,104,111,111,107,115, 0,112, 97,114,116,105, 99,108,101,115,121,115,116,101,109, 0, 42,112,
-100, 0, 42,115,111,102,116, 0, 42,100,117,112, 95,103,114,111,117,112, 0,102,108,117,105,100,115,105,109, 70,108, 97,103, 0,
-114,101,115,116,114,105, 99,116,102,108, 97,103, 0,115,104, 97,112,101,110,114, 0,115,104, 97,112,101,102,108, 97,103, 0,114,
-101, 99, 97,108, 99,111, 0,112, 97,100, 52, 0, 42,102,108,117,105,100,115,105,109, 83,101,116,116,105,110,103,115, 0, 42,100,
-101,114,105,118,101,100, 68,101,102,111,114,109, 0, 42,100,101,114,105,118,101,100, 70,105,110, 97,108, 0,108, 97,115,116, 68,
- 97,116, 97, 77, 97,115,107, 0, 99,117,114,105,110,100,101,120, 0, 97, 99,116,105,118,101, 0,100,101,102,108,101, 99,116, 0,
-102,111,114, 99,101,102,105,101,108,100, 0,112,100,101,102, 95,100, 97,109,112, 0,112,100,101,102, 95,114,100, 97,109,112, 0,
-112,100,101,102, 95,112,101,114,109, 0,112,100,101,102, 95,102,114,105, 99,116, 0,112,100,101,102, 95,114,102,114,105, 99,116,
- 0,102, 95,115,116,114,101,110,103,116,104, 0,102, 95,112,111,119,101,114, 0,102, 95,100,105,115,116, 0,102, 95,100, 97,109,
-112, 0,109, 97,120,100,105,115,116, 0,109,105,110,100,105,115,116, 0,109, 97,120,114, 97,100, 0,109,105,110,114, 97,100, 0,
-102, 95,112,111,119,101,114, 95,114, 0,112,100,101,102, 95,115, 98,100, 97,109,112, 0,112,100,101,102, 95,115, 98,105,102,116,
- 0,112,100,101,102, 95,115, 98,111,102,116, 0, 99,108,117,109,112, 95,102, 97, 99, 0, 99,108,117,109,112, 95,112,111,119, 0,
-107,105,110,107, 95,102,114,101,113, 0,107,105,110,107, 95,115,104, 97,112,101, 0,107,105,110,107, 95, 97,109,112, 0,102,114,
-101,101, 95,101,110,100, 0,116,101,120, 95,110, 97, 98,108, 97, 0,116,101,120, 95,109,111,100,101, 0,107,105,110,107, 0,107,
-105,110,107, 95, 97,120,105,115, 0,114,116, 50, 0, 42,112, 97,114,116,105, 99,108,101,115, 0,116,111,116,112,111,105,110,116,
- 0,116,111,116,115,112,114,105,110,103, 0, 42, 98,112,111,105,110,116, 0, 42, 98,115,112,114,105,110,103, 0,110,111,100,101,
-109, 97,115,115, 0,103,114, 97,118, 0,109,101,100,105, 97,102,114,105, 99,116, 0,114,107,108,105,109,105,116, 0,112,104,121,
-115,105, 99,115, 95,115,112,101,101,100, 0,103,111, 97,108,115,112,114,105,110,103, 0,103,111, 97,108,102,114,105, 99,116, 0,
-109,105,110,103,111, 97,108, 0,109, 97,120,103,111, 97,108, 0,100,101,102,103,111, 97,108, 0,118,101,114,116,103,114,111,117,
-112, 0,102,117,122,122,121,110,101,115,115, 0,105,110,115,112,114,105,110,103, 0,105,110,102,114,105, 99,116, 0,101,102,114,
- 97, 0,105,110,116,101,114,118, 97,108, 0,108,111, 99, 97,108, 0,115,111,108,118,101,114,102,108, 97,103,115, 0, 42, 42,107,
-101,121,115, 0,116,111,116,112,111,105,110,116,107,101,121, 0,115,101, 99,111,110,100,115,112,114,105,110,103, 0, 99,111,108,
- 98, 97,108,108, 0, 98, 97,108,108,100, 97,109,112, 0, 98, 97,108,108,115,116,105,102,102, 0,115, 98, 99, 95,109,111,100,101,
- 0, 97,101,114,111,101,100,103,101, 0,109,105,110,108,111,111,112,115, 0,109, 97,120,108,111,111,112,115, 0, 99,104,111,107,
-101, 0,112, 97,100, 53, 0, 42,115, 99,114, 97,116, 99,104, 0,115,104,111,119, 95, 97,100,118, 97,110, 99,101,100,111,112,116,
-105,111,110,115, 0,114,101,115,111,108,117,116,105,111,110,120,121,122, 0,112,114,101,118,105,101,119,114,101,115,120,121,122,
- 0,114,101, 97,108,115,105,122,101, 0,103,117,105, 68,105,115,112,108, 97,121, 77,111,100,101, 0,114,101,110,100,101,114, 68,
-105,115,112,108, 97,121, 77,111,100,101, 0,118,105,115, 99,111,115,105,116,121, 86, 97,108,117,101, 0,118,105,115, 99,111,115,
-105,116,121, 77,111,100,101, 0,118,105,115, 99,111,115,105,116,121, 69,120,112,111,110,101,110,116, 0,103,114, 97,118,120, 0,
-103,114, 97,118,121, 0,103,114, 97,118,122, 0, 97,110,105,109, 83,116, 97,114,116, 0, 97,110,105,109, 69,110,100, 0,103,115,
-116, 97,114, 0,109, 97,120, 82,101,102,105,110,101, 0,105,110,105, 86,101,108,120, 0,105,110,105, 86,101,108,121, 0,105,110,
-105, 86,101,108,122, 0, 42,111,114,103, 77,101,115,104, 0, 42,109,101,115,104, 83,117,114,102, 97, 99,101, 0, 42,109,101,115,
-104, 66, 66, 0,115,117,114,102,100, 97,116, 97, 80, 97,116,104, 91, 50, 52, 48, 93, 0, 98, 98, 83,116, 97,114,116, 91, 51, 93,
- 0, 98, 98, 83,105,122,101, 91, 51, 93, 0,116,121,112,101, 70,108, 97,103,115, 0,100,111,109, 97,105,110, 78,111,118,101, 99,
-103,101,110, 0,118,111,108,117,109,101, 73,110,105,116, 84,121,112,101, 0,112, 97,114,116, 83,108,105,112, 86, 97,108,117,101,
- 0,103,101,110,101,114, 97,116,101, 84,114, 97, 99,101,114,115, 0,103,101,110,101,114, 97,116,101, 80, 97,114,116,105, 99,108,
-101,115, 0,115,117,114,102, 97, 99,101, 83,109,111,111,116,104,105,110,103, 0,115,117,114,102, 97, 99,101, 83,117, 98,100,105,
-118,115, 0,117,110,117,115,101,100, 68, 78, 65, 68,117,109,109,121, 0,112, 97,114,116,105, 99,108,101, 73,110,102, 83,105,122,
-101, 0,112, 97,114,116,105, 99,108,101, 73,110,102, 65,108,112,104, 97, 0,102, 97,114, 70,105,101,108,100, 83,105,122,101, 0,
- 42,109,101,115,104, 83,117,114,102, 78,111,114,109, 97,108,115, 0,109,105,115,116,121,112,101, 0,104,111,114,114, 0,104,111,
-114,103, 0,104,111,114, 98, 0,104,111,114,107, 0,122,101,110,114, 0,122,101,110,103, 0,122,101,110, 98, 0,122,101,110,107,
- 0, 97,109, 98,107, 0,102, 97,115,116, 99,111,108, 0,101,120,112,111,115,117,114,101, 0,101,120,112, 0,114, 97,110,103,101,
- 0,108,105,110,102, 97, 99, 0,108,111,103,102, 97, 99, 0,103,114, 97,118,105,116,121, 0, 97, 99,116,105,118,105,116,121, 66,
-111,120, 82, 97,100,105,117,115, 0,115,107,121,116,121,112,101, 0,112,104,121,115,105, 99,115, 69,110,103,105,110,101, 0,109,
-105,115,105, 0,109,105,115,116,115,116, 97, 0,109,105,115,116,100,105,115,116, 0,109,105,115,116,104,105, 0,115,116, 97,114,
-114, 0,115,116, 97,114,103, 0,115,116, 97,114, 98, 0,115,116, 97,114,107, 0,115,116, 97,114,115,105,122,101, 0,115,116, 97,
-114,109,105,110,100,105,115,116, 0,115,116, 97,114,100,105,115,116, 0,115,116, 97,114, 99,111,108,110,111,105,115,101, 0,100,
-111,102,115,116, 97, 0,100,111,102,101,110,100, 0,100,111,102,109,105,110, 0,100,111,102,109, 97,120, 0, 97,111,100,105,115,
-116, 0, 97,111,100,105,115,116,102, 97, 99, 0, 97,111,101,110,101,114,103,121, 0, 97,111, 98,105, 97,115, 0, 97,111,109,111,
-100,101, 0, 97,111,115, 97,109,112, 0, 97,111,109,105,120, 0, 97,111, 99,111,108,111,114, 0, 97,111, 95, 97,100, 97,112,116,
- 95,116,104,114,101,115,104, 0, 97,111, 95, 97,100, 97,112,116, 95,115,112,101,101,100, 95,102, 97, 99, 0,112, 97,100, 50, 91,
- 50, 93, 0, 97,111, 95,115, 97,109,112, 95,109,101,116,104,111,100, 0,112, 97,100, 49, 91, 51, 93, 0, 42, 97,111,115,112,104,
-101,114,101, 0, 42, 97,111,116, 97, 98,108,101,115, 0,104,101,109,105,114,101,115, 0,109, 97,120,105,116,101,114, 0,100,114,
- 97,119,116,121,112,101, 0,115,117, 98,115,104,111,111,116,112, 0,115,117, 98,115,104,111,111,116,101, 0,110,111,100,101,108,
-105,109, 0,109, 97,120,115,117, 98,108, 97,109,112, 0,112, 97,109, 97, 0,112, 97,109,105, 0,101,108,109, 97, 0,101,108,109,
-105, 0,109, 97,120,110,111,100,101, 0, 99,111,110,118,101,114,103,101,110, 99,101, 0,114, 97,100,102, 97, 99, 0,103, 97,109,
-109, 97, 0,115,101,108, 99,111,108, 0,115,120, 0,115,121, 0, 42,108,112, 70,111,114,109, 97,116, 0, 42,108,112, 80, 97,114,
-109,115, 0, 99, 98, 70,111,114,109, 97,116, 0, 99, 98, 80, 97,114,109,115, 0,102, 99, 99, 84,121,112,101, 0,102, 99, 99, 72,
- 97,110,100,108,101,114, 0,100,119, 75,101,121, 70,114, 97,109,101, 69,118,101,114,121, 0,100,119, 81,117, 97,108,105,116,121,
- 0,100,119, 66,121,116,101,115, 80,101,114, 83,101, 99,111,110,100, 0,100,119, 70,108, 97,103,115, 0,100,119, 73,110,116,101,
-114,108,101, 97,118,101, 69,118,101,114,121, 0, 97,118,105, 99,111,100,101, 99,110, 97,109,101, 91, 49, 50, 56, 93, 0, 42, 99,
-100, 80, 97,114,109,115, 0, 42,112, 97,100, 0, 99,100, 83,105,122,101, 0,113,116, 99,111,100,101, 99,110, 97,109,101, 91, 49,
- 50, 56, 93, 0, 99,111,100,101, 99, 0, 97,117,100,105,111, 95, 99,111,100,101, 99, 0,118,105,100,101,111, 95, 98,105,116,114,
- 97,116,101, 0, 97,117,100,105,111, 95, 98,105,116,114, 97,116,101, 0,103,111,112, 95,115,105,122,101, 0,114, 99, 95,109,105,
-110, 95,114, 97,116,101, 0,114, 99, 95,109, 97,120, 95,114, 97,116,101, 0,114, 99, 95, 98,117,102,102,101,114, 95,115,105,122,
-101, 0,109,117,120, 95,112, 97, 99,107,101,116, 95,115,105,122,101, 0,109,117,120, 95,114, 97,116,101, 0,109,105,120,114, 97,
-116,101, 0,109, 97,105,110, 0,112, 97,100, 91, 51, 93, 0, 42,109, 97,116, 95,111,118,101,114,114,105,100,101, 0, 42,108,105,
-103,104,116, 95,111,118,101,114,114,105,100,101, 0,108, 97,121,102,108, 97,103, 0,112, 97,115,115,102,108, 97,103, 0,112, 97,
-115,115, 95,120,111,114, 0, 42, 97,118,105, 99,111,100,101, 99,100, 97,116, 97, 0, 42,113,116, 99,111,100,101, 99,100, 97,116,
- 97, 0,102,102, 99,111,100,101, 99,100, 97,116, 97, 0, 99,102,114, 97, 0,112,115,102,114, 97, 0,112,101,102,114, 97, 0,105,
-109, 97,103,101,115, 0,102,114, 97,109, 97,112,116,111, 0,116,104,114,101, 97,100,115, 0,102,114, 97,109,101,108,101,110, 0,
- 98,108,117,114,102, 97, 99, 0,101,100,103,101, 82, 0,101,100,103,101, 71, 0,101,100,103,101, 66, 0,102,117,108,108,115, 99,
-114,101,101,110, 0,120,112,108, 97,121, 0,121,112,108, 97,121, 0,102,114,101,113,112,108, 97,121, 0, 97,116,116,114,105, 98,
- 0,114,116, 49, 0,115,116,101,114,101,111,109,111,100,101, 0,100,105,109,101,110,115,105,111,110,115,112,114,101,115,101,116,
- 0,109, 97,120,105,109,115,105,122,101, 0,120,115, 99,104, 0,121,115, 99,104, 0,120, 97,115,112, 0,121, 97,115,112, 0,120,
-112, 97,114,116,115, 0,121,112, 97,114,116,115, 0,119,105,110,112,111,115, 0,112,108, 97,110,101,115, 0,105,109,116,121,112,
-101, 0,115,117, 98,105,109,116,121,112,101, 0,113,117, 97,108,105,116,121, 0,115, 99,101,109,111,100,101, 0,114,101,110,100,
-101,114,101,114, 0,111, 99,114,101,115, 0,114,112, 97,100, 91, 50, 93, 0, 97,108,112,104, 97,109,111,100,101, 0,111,115, 97,
- 0,102,114,115, 95,115,101, 99, 0,101,100,103,101,105,110,116, 0,115, 97,102,101,116,121, 0, 98,111,114,100,101,114, 0,100,
-105,115,112,114,101, 99,116, 0,108, 97,121,101,114,115, 0, 97, 99,116,108, 97,121, 0,102,114,115, 95,115,101, 99, 95, 98, 97,
-115,101, 0,103, 97,117,115,115, 0,112,111,115,116,109,117,108, 0,112,111,115,116,103, 97,109,109, 97, 0,112,111,115,116,104,
-117,101, 0,112,111,115,116,115, 97,116, 0,100,105,116,104,101,114, 95,105,110,116,101,110,115,105,116,121, 0, 98, 97,107,101,
- 95,111,115, 97, 0, 98, 97,107,101, 95,102,105,108,116,101,114, 0, 98, 97,107,101, 95,109,111,100,101, 0, 98, 97,107,101, 95,
-102,108, 97,103, 0, 71, 73,113,117, 97,108,105,116,121, 0, 71, 73, 99, 97, 99,104,101, 0, 71, 73,109,101,116,104,111,100, 0,
- 71, 73,112,104,111,116,111,110,115, 0, 71, 73,100,105,114,101, 99,116, 0, 89, 70, 95, 65, 65, 0, 89, 70,101,120,112,111,114,
-116,120,109,108, 0, 89, 70, 95,110,111, 98,117,109,112, 0, 89, 70, 95, 99,108, 97,109,112,114,103, 98, 0,121,102,112, 97,100,
- 49, 0, 71, 73,100,101,112,116,104, 0, 71, 73, 99, 97,117,115,100,101,112,116,104, 0, 71, 73,112,105,120,101,108,115,112,101,
-114,115, 97,109,112,108,101, 0, 71, 73,112,104,111,116,111,110, 99,111,117,110,116, 0, 71, 73,109,105,120,112,104,111,116,111,
-110,115, 0, 71, 73,112,104,111,116,111,110,114, 97,100,105,117,115, 0, 89, 70, 95,110,117,109,112,114,111, 99,115, 0, 89, 70,
- 95,114, 97,121,100,101,112,116,104, 0, 89, 70, 95, 65, 65,112, 97,115,115,101,115, 0, 89, 70, 95, 65, 65,115, 97,109,112,108,
-101,115, 0, 71, 73,115,104, 97,100,111,119,113,117, 97,108,105,116,121, 0, 71, 73,114,101,102,105,110,101,109,101,110,116, 0,
- 71, 73,112,111,119,101,114, 0, 71, 73,105,110,100,105,114,112,111,119,101,114, 0, 89, 70, 95,103, 97,109,109, 97, 0, 89, 70,
- 95,101,120,112,111,115,117,114,101, 0, 89, 70, 95,114, 97,121, 98,105, 97,115, 0, 89, 70, 95, 65, 65,112,105,120,101,108,115,
-105,122,101, 0, 89, 70, 95, 65, 65,116,104,114,101,115,104,111,108,100, 0, 98, 97, 99,107, 98,117,102, 91, 49, 54, 48, 93, 0,
-112,105, 99, 91, 49, 54, 48, 93, 0,102,116,121,112,101, 91, 49, 54, 48, 93, 0,115,116, 97,109,112, 0,115,116, 97,109,112, 95,
-102,111,110,116, 95,105,100, 0,115,116, 97,109,112, 95,117,100, 97,116, 97, 91, 49, 54, 48, 93, 0,102,103, 95,115,116, 97,109,
-112, 91, 52, 93, 0, 98,103, 95,115,116, 97,109,112, 91, 52, 93, 0, 99,111,108, 91, 51, 93, 0,102,114, 97,109,101, 0,110, 97,
-109,101, 91, 54, 52, 93, 0, 42, 98,114,117,115,104, 0,116,111,111,108, 0,115,116,101,112, 0,105,110,118,101,114,116, 0,116,
-111,116,114,101,107,101,121, 0,116,111,116, 97,100,100,107,101,121, 0, 98,114,117,115,104,116,121,112,101, 0, 98,114,117,115,
-104, 91, 55, 93, 0,101,109,105,116,116,101,114,100,105,115,116, 0,100,114, 97,119, 95,116,105,109,101,100, 0, 99,111,114,110,
-101,114,116,121,112,101, 0,101,100,105,116, 98,117,116,102,108, 97,103, 0,106,111,105,110,116,114,105,108,105,109,105,116, 0,
-100,101,103,114, 0,116,117,114,110, 0,101,120,116,114, 95,111,102,102,115, 0,100,111,117, 98,108,105,109,105,116, 0,115,101,
-103,109,101,110,116,115, 0,114,105,110,103,115, 0,118,101,114,116,105, 99,101,115, 0,117,110,119,114, 97,112,112,101,114, 0,
-117,118, 99, 97,108, 99, 95,114, 97,100,105,117,115, 0,117,118, 99, 97,108, 99, 95, 99,117, 98,101,115,105,122,101, 0,117,118,
- 99, 97,108, 99, 95,109, 97,112,100,105,114, 0,117,118, 99, 97,108, 99, 95,109, 97,112, 97,108,105,103,110, 0,117,118, 99, 97,
-108, 99, 95,102,108, 97,103, 0,105,109, 97,112, 97,105,110,116, 0,112, 97,114,116,105, 99,108,101, 0,115,101,108,101, 99,116,
- 95,116,104,114,101,115,104, 0, 99,108,101, 97,110, 95,116,104,114,101,115,104, 0,114,101,116,111,112,111, 95,109,111,100,101,
- 0,114,101,116,111,112,111, 95,112, 97,105,110,116, 95,116,111,111,108, 0,108,105,110,101, 95,100,105,118, 0,101,108,108,105,
-112,115,101, 95,100,105,118, 0,114,101,116,111,112,111, 95,104,111,116,115,112,111,116, 0,109,117,108,116,105,114,101,115, 95,
-115,117, 98,100,105,118, 95,116,121,112,101, 0,112, 97,100, 52, 91, 50, 93, 0,100,105,114, 0, 97,105,114, 98,114,117,115,104,
- 0,118,105,101,119, 0, 42,115,101,115,115,105,111,110, 0,100,114, 97,119, 98,114,117,115,104, 0,115,109,111,111,116,104, 98,
-114,117,115,104, 0,112,105,110, 99,104, 98,114,117,115,104, 0,105,110,102,108, 97,116,101, 98,114,117,115,104, 0,103,114, 97,
- 98, 98,114,117,115,104, 0,108, 97,121,101,114, 98,114,117,115,104, 0,102,108, 97,116,116,101,110, 98,114,117,115,104, 0, 98,
-114,117,115,104, 95,116,121,112,101, 0,116,101,120,110,114, 0,116,101,120,114,101,112,116, 0,116,101,120,102, 97,100,101, 0,
-116,101,120,115,101,112, 0, 97,118,101,114, 97,103,105,110,103, 0,116, 97, 98,108,101,116, 95,115,105,122,101, 0,116, 97, 98,
-108,101,116, 95,115,116,114,101,110,103,116,104, 0,115,121,109,109, 0, 42, 99, 97,109,101,114, 97, 0, 42,119,111,114,108,100,
- 0, 42,115,101,116, 0, 98, 97,115,101, 0, 42, 98, 97,115, 97, 99,116, 0, 99,117,114,115,111,114, 91, 51, 93, 0,116,119, 99,
-101,110,116, 91, 51, 93, 0,116,119,109,105,110, 91, 51, 93, 0,116,119,109, 97,120, 91, 51, 93, 0,101,100,105,116, 98,117,116,
-115,105,122,101, 0,115,101,108,101, 99,116,109,111,100,101, 0,112,114,111,112,111,114,116,105,111,110, 97,108, 0,112,114,111,
-112, 95,109,111,100,101, 0, 97,117,116,111,109,101,114,103,101, 0,112, 97,100, 54, 0,112, 97,100, 55, 0, 42,101,100, 0, 42,
-114, 97,100,105,111, 0,102,114, 97,109,105,110,103, 0, 42,116,111,111,108,115,101,116,116,105,110,103,115, 0, 97,117,100,105,
-111, 0,109, 97,114,107,101,114,115, 0,106,117,109,112,102,114, 97,109,101, 0,115,110, 97,112, 95,102,108, 97,103, 0,115,110,
- 97,112, 95,116, 97,114,103,101,116, 0, 42,116,104,101, 68, 97,103, 0,100, 97,103,105,115,118, 97,108,105,100, 0,100, 97,103,
-102,108, 97,103,115, 0,115, 99,117,108,112,116,100, 97,116, 97, 0,122,111,111,109, 0, 98,108,101,110,100, 0,120,105,109, 0,
-121,105,109, 0,115,112, 97, 99,101,116,121,112,101, 0, 98,108,111, 99,107,115, 99, 97,108,101, 0, 42, 97,114,101, 97, 0, 98,
-108,111, 99,107,104, 97,110,100,108,101,114, 91, 56, 93, 0,118,105,101,119,109, 97,116, 91, 52, 93, 91, 52, 93, 0,118,105,101,
-119,105,110,118, 91, 52, 93, 91, 52, 93, 0,112,101,114,115,109, 97,116, 91, 52, 93, 91, 52, 93, 0,112,101,114,115,105,110,118,
- 91, 52, 93, 91, 52, 93, 0,119,105,110,109, 97,116, 49, 91, 52, 93, 91, 52, 93, 0,118,105,101,119,109, 97,116, 49, 91, 52, 93,
- 91, 52, 93, 0,118,105,101,119,113,117, 97,116, 91, 52, 93, 0,122,102, 97, 99, 0,112,101,114,115,112, 0, 42,111, 98, 95, 99,
-101,110,116,114,101, 0, 42, 98,103,112,105, 99, 0, 42,108,111, 99, 97,108,118,100, 0, 42,114,105, 0, 42,114,101,116,111,112,
-111, 95,118,105,101,119, 95,100, 97,116, 97, 0, 42,100,101,112,116,104,115, 0,111, 98, 95, 99,101,110,116,114,101, 95, 98,111,
-110,101, 91, 51, 50, 93, 0,108,111, 99, 97,108,118,105,101,119, 0,108, 97,121, 97, 99,116, 0,115, 99,101,110,101,108,111, 99,
-107, 0, 97,114,111,117,110,100, 0, 99, 97,109,122,111,111,109, 0,112,105,118,111,116, 95,108, 97,115,116, 0,103,114,105,100,
- 0,103,114,105,100,118,105,101,119, 0,112,105,120,115,105,122,101, 0,110,101, 97,114, 0,102, 97,114, 0, 99, 97,109,100,120,
- 0, 99, 97,109,100,121, 0,103,114,105,100,108,105,110,101,115, 0,118,105,101,119, 98,117,116, 0,103,114,105,100,102,108, 97,
-103, 0,109,111,100,101,115,101,108,101, 99,116, 0,116,119,116,121,112,101, 0,116,119,109,111,100,101, 0,116,119,102,108, 97,
-103, 0,116,119,100,114, 97,119,102,108, 97,103, 0,116,119,109, 97,116, 91, 52, 93, 91, 52, 93, 0, 99,108,105,112, 91, 52, 93,
- 91, 52, 93, 0, 42, 99,108,105,112, 98, 98, 0, 97,102,116,101,114,100,114, 97,119, 0,122, 98,117,102, 0,120,114, 97,121, 0,
-102,108, 97,103, 50, 0,103,114,105,100,115,117, 98,100,105,118, 0, 42,112,114,111,112,101,114,116,105,101,115, 95,115,116,111,
-114, 97,103,101, 0,118,101,114,116, 0,104,111,114, 0,109, 97,115,107, 0,109,105,110, 91, 50, 93, 0,109, 97,120, 91, 50, 93,
- 0,109,105,110,122,111,111,109, 0,109, 97,120,122,111,111,109, 0,115, 99,114,111,108,108, 0,107,101,101,112,116,111,116, 0,
-107,101,101,112, 97,115,112,101, 99,116, 0,107,101,101,112,122,111,111,109, 0,111,108,100,119,105,110,120, 0,111,108,100,119,
-105,110,121, 0, 99,117,114,115,111,114, 91, 50, 93, 0,114,111,119, 98,117,116, 0,118, 50,100, 0, 42,101,100,105,116,105,112,
-111, 0,105,112,111,107,101,121, 0, 97, 99,116,110, 97,109,101, 91, 51, 50, 93, 0, 99,111,110,115,116,110, 97,109,101, 91, 51,
- 50, 93, 0,116,111,116,105,112,111, 0,112,105,110, 0, 98,117,116,111,102,115, 0, 99,104, 97,110,110,101,108, 0,108,111, 99,
-107, 0,109,101,100,105, 97,110, 91, 51, 93, 0, 99,117,114,115,101,110,115, 0, 99,117,114, 97, 99,116, 0, 97,108,105,103,110,
- 0,116, 97, 98,111, 0,109, 97,105,110, 98, 0,109, 97,105,110, 98,111, 0, 42,108,111, 99,107,112,111,105,110, 0,116,101,120,
-102,114,111,109, 0,115,104,111,119,103,114,111,117,112, 0,109,111,100,101,108,116,121,112,101, 0,115, 99,114,105,112,116, 98,
-108,111, 99,107, 0,114,101, 95, 97,108,105,103,110, 0,111,108,100,107,101,121,112,114,101,115,115, 0,116, 97, 98, 91, 55, 93,
- 0, 99,104, 97,110,115,104,111,119,110, 0, 42,102,105,108,101,108,105,115,116, 0,116,111,116,102,105,108,101, 0,116,105,116,
-108,101, 91, 50, 52, 93, 0,100,105,114, 91, 49, 54, 48, 93, 0,102,105,108,101, 91, 56, 48, 93, 0,111,102,115, 0,115,111,114,
-116, 0,109, 97,120,110, 97,109,101,108,101,110, 0, 99,111,108,108,117,109,115, 0,102, 95,102,112, 0,102,112, 95,115,116,114,
- 91, 56, 93, 0, 42,108,105, 98,102,105,108,101,100, 97,116, 97, 0,114,101,116,118, 97,108, 0,109,101,110,117, 0, 97, 99,116,
- 0, 40, 42,114,101,116,117,114,110,102,117,110, 99, 41, 40, 41, 0, 40, 42,114,101,116,117,114,110,102,117,110, 99, 95,101,118,
-101,110,116, 41, 40, 41, 0, 40, 42,114,101,116,117,114,110,102,117,110, 99, 95, 97,114,103,115, 41, 40, 41, 0, 42, 97,114,103,
- 49, 0, 42, 97,114,103, 50, 0, 42,109,101,110,117,112, 0, 42,112,117,112,109,101,110,117, 0,111,111,112,115, 0,118,105,115,
-105,102,108, 97,103, 0,116,114,101,101, 0, 42,116,114,101,101,115,116,111,114,101, 0,115,101, 97,114, 99,104, 95,115,116,114,
-105,110,103, 91, 51, 50, 93, 0,115,101, 97,114, 99,104, 95,116,115,101, 0,115,101, 97,114, 99,104, 95,102,108, 97,103,115, 0,
-100,111, 95, 0,111,117,116,108,105,110,101,118,105,115, 0,115,116,111,114,101,102,108, 97,103, 0,100,101,112,115, 95,102,108,
- 97,103,115, 0, 42, 99,117,109, 97,112, 0,105,109, 97,110,114, 0, 99,117,114,116,105,108,101, 0,105,109,116,121,112,101,110,
-114, 0,115,104,111,119,115,112, 97,114,101, 0,100,116, 95,117,118, 0,115,116,105, 99,107,121, 0, 99,101,110,116,120, 0, 99,
-101,110,116,121, 0, 42,105,110,102,111, 95,115,116,114, 0, 42,105,110,102,111, 95,115,112, 97,114,101, 0, 42,115,112, 97,114,
-101, 0, 97,117,116,111,115,110, 97,112, 0, 42,116,101,120,116, 0,116,111,112, 0,118,105,101,119,108,105,110,101,115, 0,102,
-111,110,116, 95,105,100, 0,108,104,101,105,103,104,116, 0,108,101,102,116, 0,115,104,111,119,108,105,110,101,110,114,115, 0,
-116, 97, 98,110,117,109, 98,101,114, 0, 99,117,114,114,116, 97, 98, 95,115,101,116, 0,115,104,111,119,115,121,110,116, 97,120,
- 0,117,110,117,115,101,100, 95,112, 97,100,100, 0,112,105,120, 95,112,101,114, 95,108,105,110,101, 0,116,120,116,115, 99,114,
-111,108,108, 0,116,120,116, 98, 97,114, 0, 42,115, 99,114,105,112,116, 0, 42, 98,117,116, 95,114,101,102,115, 0,114,101,100,
-114, 97,119,115, 0, 42,105,100, 0, 97,115,112,101, 99,116, 0, 42, 99,117,114,102,111,110,116, 0, 42,101,100,105,116,116,114,
-101,101, 0,116,114,101,101,116,121,112,101, 0, 42,102,105,108,101,115, 0, 97, 99,116,105,118,101, 95,102,105,108,101, 0,110,
-117,109,116,105,108,101,115,120, 0,110,117,109,116,105,108,101,115,121, 0,115,101,108,115,116, 97,116,101, 0,118,105,101,119,
-114,101, 99,116, 0, 98,111,111,107,109, 97,114,107,114,101, 99,116, 0,115, 99,114,111,108,108,112,111,115, 0,115, 99,114,111,
-108,108,104,101,105,103,104,116, 0,115, 99,114,111,108,108, 97,114,101, 97, 0, 97, 99,116,105,118,101, 95, 98,111,111,107,109,
- 97,114,107, 0,112,114,118, 95,119, 0,112,114,118, 95,104, 0, 42,105,109,103, 0,111,117,116,108,105,110,101, 91, 52, 93, 0,
-110,101,117,116,114, 97,108, 91, 52, 93, 0, 97, 99,116,105,111,110, 91, 52, 93, 0,115,101,116,116,105,110,103, 91, 52, 93, 0,
-115,101,116,116,105,110,103, 49, 91, 52, 93, 0,115,101,116,116,105,110,103, 50, 91, 52, 93, 0,110,117,109, 91, 52, 93, 0,116,
-101,120,116,102,105,101,108,100, 91, 52, 93, 0,116,101,120,116,102,105,101,108,100, 95,104,105, 91, 52, 93, 0,112,111,112,117,
-112, 91, 52, 93, 0,116,101,120,116, 91, 52, 93, 0,116,101,120,116, 95,104,105, 91, 52, 93, 0,109,101,110,117, 95, 98, 97, 99,
-107, 91, 52, 93, 0,109,101,110,117, 95,105,116,101,109, 91, 52, 93, 0,109,101,110,117, 95,104,105,108,105,116,101, 91, 52, 93,
- 0,109,101,110,117, 95,116,101,120,116, 91, 52, 93, 0,109,101,110,117, 95,116,101,120,116, 95,104,105, 91, 52, 93, 0, 98,117,
-116, 95,100,114, 97,119,116,121,112,101, 0,105, 99,111,110,102,105,108,101, 91, 56, 48, 93, 0, 98, 97, 99,107, 91, 52, 93, 0,
-104,101, 97,100,101,114, 91, 52, 93, 0,112, 97,110,101,108, 91, 52, 93, 0,115,104, 97,100,101, 49, 91, 52, 93, 0,115,104, 97,
-100,101, 50, 91, 52, 93, 0,104,105,108,105,116,101, 91, 52, 93, 0,103,114,105,100, 91, 52, 93, 0,119,105,114,101, 91, 52, 93,
- 0,115,101,108,101, 99,116, 91, 52, 93, 0,108, 97,109,112, 91, 52, 93, 0, 97, 99,116,105,118,101, 91, 52, 93, 0,103,114,111,
-117,112, 91, 52, 93, 0,103,114,111,117,112, 95, 97, 99,116,105,118,101, 91, 52, 93, 0,116,114, 97,110,115,102,111,114,109, 91,
- 52, 93, 0,118,101,114,116,101,120, 91, 52, 93, 0,118,101,114,116,101,120, 95,115,101,108,101, 99,116, 91, 52, 93, 0,101,100,
-103,101, 91, 52, 93, 0,101,100,103,101, 95,115,101,108,101, 99,116, 91, 52, 93, 0,101,100,103,101, 95,115,101, 97,109, 91, 52,
- 93, 0,101,100,103,101, 95,115,104, 97,114,112, 91, 52, 93, 0,101,100,103,101, 95,102, 97, 99,101,115,101,108, 91, 52, 93, 0,
-102, 97, 99,101, 91, 52, 93, 0,102, 97, 99,101, 95,115,101,108,101, 99,116, 91, 52, 93, 0,102, 97, 99,101, 95,100,111,116, 91,
- 52, 93, 0,110,111,114,109, 97,108, 91, 52, 93, 0, 98,111,110,101, 95,115,111,108,105,100, 91, 52, 93, 0, 98,111,110,101, 95,
-112,111,115,101, 91, 52, 93, 0,115,116,114,105,112, 91, 52, 93, 0,115,116,114,105,112, 95,115,101,108,101, 99,116, 91, 52, 93,
- 0,118,101,114,116,101,120, 95,115,105,122,101, 0,102, 97, 99,101,100,111,116, 95,115,105,122,101, 0, 98,112, 97,100, 91, 50,
- 93, 0,115,121,110,116, 97,120,108, 91, 52, 93, 0,115,121,110,116, 97,120,110, 91, 52, 93, 0,115,121,110,116, 97,120, 98, 91,
- 52, 93, 0,115,121,110,116, 97,120,118, 91, 52, 93, 0,115,121,110,116, 97,120, 99, 91, 52, 93, 0,109,111,118,105,101, 91, 52,
- 93, 0,105,109, 97,103,101, 91, 52, 93, 0,115, 99,101,110,101, 91, 52, 93, 0, 97,117,100,105,111, 91, 52, 93, 0,101,102,102,
-101, 99,116, 91, 52, 93, 0,112,108,117,103,105,110, 91, 52, 93, 0,116,114, 97,110,115,105,116,105,111,110, 91, 52, 93, 0,109,
-101,116, 97, 91, 52, 93, 0,101,100,105,116,109,101,115,104, 95, 97, 99,116,105,118,101, 91, 52, 93, 0,116,117,105, 0,116, 98,
-117,116,115, 0,116,118, 51,100, 0,116,102,105,108,101, 0,116,105,112,111, 0,116,105,110,102,111, 0,116,115,110,100, 0,116,
- 97, 99,116, 0,116,110,108, 97, 0,116,115,101,113, 0,116,105,109, 97, 0,116,105,109, 97,115,101,108, 0,116,101,120,116, 0,
-116,111,111,112,115, 0,116,116,105,109,101, 0,116,110,111,100,101, 0, 98,112, 97,100, 91, 52, 93, 0, 98,112, 97,100, 49, 91,
- 52, 93, 0,115,112,101, 99, 91, 52, 93, 0,100,117,112,102,108, 97,103, 0,115, 97,118,101,116,105,109,101, 0,116,101,109,112,
-100,105,114, 91, 49, 54, 48, 93, 0,102,111,110,116,100,105,114, 91, 49, 54, 48, 93, 0,114,101,110,100,101,114,100,105,114, 91,
- 49, 54, 48, 93, 0,116,101,120,116,117,100,105,114, 91, 49, 54, 48, 93, 0,112,108,117,103,116,101,120,100,105,114, 91, 49, 54,
- 48, 93, 0,112,108,117,103,115,101,113,100,105,114, 91, 49, 54, 48, 93, 0,112,121,116,104,111,110,100,105,114, 91, 49, 54, 48,
- 93, 0,115,111,117,110,100,100,105,114, 91, 49, 54, 48, 93, 0,121,102,101,120,112,111,114,116,100,105,114, 91, 49, 54, 48, 93,
- 0,118,101,114,115,105,111,110,115, 0,118,114,109,108,102,108, 97,103, 0,103, 97,109,101,102,108, 97,103,115, 0,119,104,101,
-101,108,108,105,110,101,115, 99,114,111,108,108, 0,117,105,102,108, 97,103, 0,108, 97,110,103,117, 97,103,101, 0,117,115,101,
-114,112,114,101,102, 0,118,105,101,119,122,111,111,109, 0, 99,111,110,115,111,108,101, 95, 98,117,102,102,101,114, 0, 99,111,
-110,115,111,108,101, 95,111,117,116, 0,109,105,120, 98,117,102,115,105,122,101, 0,102,111,110,116,115,105,122,101, 0,101,110,
- 99,111,100,105,110,103, 0,116,114, 97,110,115,111,112,116,115, 0,109,101,110,117,116,104,114,101,115,104,111,108,100, 49, 0,
-109,101,110,117,116,104,114,101,115,104,111,108,100, 50, 0,102,111,110,116,110, 97,109,101, 91, 50, 53, 54, 93, 0,116,104,101,
-109,101,115, 0,117,110,100,111,115,116,101,112,115, 0, 99,117,114,115,115,105,122,101, 0,116, 98, 95,108,101,102,116,109,111,
-117,115,101, 0,116, 98, 95,114,105,103,104,116,109,111,117,115,101, 0,108,105,103,104,116, 91, 51, 93, 0,116,119, 95,104,111,
-116,115,112,111,116, 0,116,119, 95,102,108, 97,103, 0,116,119, 95,104, 97,110,100,108,101,115,105,122,101, 0,116,119, 95,115,
-105,122,101, 0,116,101,120,116,105,109,101,111,117,116, 0,116,101,120, 99,111,108,108,101, 99,116,114, 97,116,101, 0,109,101,
-109, 99, 97, 99,104,101,108,105,109,105,116, 0,112,114,101,102,101,116, 99,104,102,114, 97,109,101,115, 0,102,114, 97,109,101,
-115,101,114,118,101,114,112,111,114,116, 0,112, 97,100, 95,114,111,116, 95, 97,110,103,108,101, 0,111, 98, 99,101,110,116,101,
-114, 95,100,105, 97, 0,114,118,105,115,105,122,101, 0,114,118,105, 98,114,105,103,104,116, 0,114,101, 99,101,110,116, 95,102,
-105,108,101,115, 0,115,109,111,111,116,104, 95,118,105,101,119,116,120, 0,103,108,114,101,115,108,105,109,105,116, 0,118,101,
-114,115,101,109, 97,115,116,101,114, 91, 49, 54, 48, 93, 0,118,101,114,115,101,117,115,101,114, 91, 49, 54, 48, 93, 0,103,108,
- 97,108,112,104, 97, 99,108,105,112, 0, 99,111, 98, 97, 95,119,101,105,103,104,116, 0,118,101,114,116, 98, 97,115,101, 0,101,
-100,103,101, 98, 97,115,101, 0, 97,114,101, 97, 98, 97,115,101, 0, 42,115, 99,101,110,101, 0,101,110,100,120, 0,101,110,100,
-121, 0,115,105,122,101,120, 0,115,105,122,101,121, 0,115, 99,101,110,101,110,114, 0,115, 99,114,101,101,110,110,114, 0,102,
-117,108,108, 0,109, 97,105,110,119,105,110, 0,119,105,110, 97,107,116, 0,104, 97,110,100,108,101,114, 91, 56, 93, 0, 42,110,
-101,119,118, 0,118,101, 99, 0, 42,118, 49, 0, 42,118, 50, 0,112, 97,110,101,108,110, 97,109,101, 91, 54, 52, 93, 0,116, 97,
- 98,110, 97,109,101, 91, 54, 52, 93, 0,100,114, 97,119,110, 97,109,101, 91, 54, 52, 93, 0,111,102,115,120, 0,111,102,115,121,
- 0, 99,111,110,116,114,111,108, 0,115,110, 97,112, 0,111,108,100, 95,111,102,115,120, 0,111,108,100, 95,111,102,115,121, 0,
-115,111,114,116, 99,111,117,110,116,101,114, 0, 42,112, 97,110,101,108,116, 97, 98, 0, 42,118, 51, 0, 42,118, 52, 0, 42,102,
-117,108,108, 0,119,105,110,109, 97,116, 91, 52, 93, 91, 52, 93, 0,104,101, 97,100,114, 99,116, 0,119,105,110,114, 99,116, 0,
-104,101, 97,100,119,105,110, 0,119,105,110, 0,104,101, 97,100,101,114,116,121,112,101, 0, 98,117,116,115,112, 97, 99,101,116,
-121,112,101, 0,119,105,110,120, 0,119,105,110,121, 0,104,101, 97,100, 95,115,119, 97,112, 0,104,101, 97,100, 95,101,113,117,
- 97,108, 0,119,105,110, 95,115,119, 97,112, 0,119,105,110, 95,101,113,117, 97,108, 0,104,101, 97,100, 98,117,116,108,101,110,
- 0,104,101, 97,100, 98,117,116,111,102,115, 0, 99,117,114,115,111,114, 0,115,112, 97, 99,101,100, 97,116, 97, 0,117,105, 98,
-108,111, 99,107,115, 0,112, 97,110,101,108,115, 0,115,117, 98,118,115,116,114, 91, 52, 93, 0,115,117, 98,118,101,114,115,105,
-111,110, 0,112, 97,100,115, 0,109,105,110,118,101,114,115,105,111,110, 0,109,105,110,115,117, 98,118,101,114,115,105,111,110,
- 0,100,105,115,112,108, 97,121,109,111,100,101, 0, 42, 99,117,114,115, 99,114,101,101,110, 0, 42, 99,117,114,115, 99,101,110,
-101, 0,102,105,108,101,102,108, 97,103,115, 0,103,108,111, 98, 97,108,102, 0,110, 97,109,101, 91, 56, 48, 93, 0, 42,105, 98,
-117,102, 0, 42,115,101, 49, 0, 42,115,101, 50, 0, 42,115,101, 51, 0,110,114, 0,100,111,110,101, 0, 42,115,116,114,105,112,
-100, 97,116, 97, 0,111,114,120, 0,111,114,121, 0, 42,116,115,116,114,105,112,100, 97,116, 97, 0, 42,105,110,115,116, 97,110,
- 99,101, 95,112,114,105,118, 97,116,101, 95,100, 97,116, 97, 0, 42, 42, 99,117,114,114,101,110,116, 95,112,114,105,118, 97,116,
-101, 95,100, 97,116, 97, 0, 42,116,109,112, 0,115,116, 97,114,116,111,102,115, 0,101,110,100,111,102,115, 0,115,116, 97,114,
-116,115,116,105,108,108, 0,101,110,100,115,116,105,108,108, 0,109, 97, 99,104,105,110,101, 0,115,116, 97,114,116,100,105,115,
-112, 0,101,110,100,100,105,115,112, 0,109,117,108, 0,104, 97,110,100,115,105,122,101, 0, 42,115,116,114,105,112, 0,102, 97,
- 99,102, 48, 0,102, 97, 99,102, 49, 0, 42,115,101,113, 49, 0, 42,115,101,113, 50, 0, 42,115,101,113, 51, 0,115,101,113, 98,
- 97,115,101, 0, 42,115,111,117,110,100, 0, 42,104,100, 97,117,100,105,111, 0,108,101,118,101,108, 0,112, 97,110, 0, 99,117,
-114,112,111,115, 0,115,116,114,111, 98,101, 0, 42,101,102,102,101, 99,116,100, 97,116, 97, 0, 97,110,105,109, 95,112,114,101,
-115,101,101,107, 0, 42,111,108,100, 98, 97,115,101,112, 0, 42,112, 97,114,115,101,113, 0, 42,115,101,113, 98, 97,115,101,112,
- 0,109,101,116, 97,115,116, 97, 99,107, 0,101,100,103,101, 87,105,100,116,104, 0,102,111,114,119, 97,114,100, 0,119,105,112,
-101,116,121,112,101, 0,102, 77,105,110,105, 0,102, 67,108, 97,109,112, 0,102, 66,111,111,115,116, 0,100, 68,105,115,116, 0,
-100, 81,117, 97,108,105,116,121, 0, 98, 78,111, 67,111,109,112, 0, 83, 99, 97,108,101,120, 73,110,105, 0, 83, 99, 97,108,101,
-121, 73,110,105, 0, 83, 99, 97,108,101,120, 70,105,110, 0, 83, 99, 97,108,101,121, 70,105,110, 0,120, 73,110,105, 0,120, 70,
-105,110, 0,121, 73,110,105, 0,121, 70,105,110, 0,114,111,116, 73,110,105, 0,114,111,116, 70,105,110, 0,105,110,116,101,114,
-112,111,108, 97,116,105,111,110, 0, 42,102,114, 97,109,101, 77, 97,112, 0,103,108,111, 98, 97,108, 83,112,101,101,100, 0,108,
- 97,115,116, 86, 97,108,105,100, 70,114, 97,109,101, 0, 98,117,116,116,121,112,101, 0,117,115,101,114,106,105,116, 0,115,116,
- 97, 0,101,110,100, 0,116,111,116,112, 97,114,116, 0,110,111,114,109,102, 97, 99, 0,111, 98,102, 97, 99, 0,114, 97,110,100,
-102, 97, 99, 0,116,101,120,102, 97, 99, 0,114, 97,110,100,108,105,102,101, 0,102,111,114, 99,101, 91, 51, 93, 0,118,101, 99,
-116,115,105,122,101, 0,109, 97,120,108,101,110, 0,100,101,102,118,101, 99, 91, 51, 93, 0,109,117,108,116, 91, 52, 93, 0,108,
-105,102,101, 91, 52, 93, 0, 99,104,105,108,100, 91, 52, 93, 0,109, 97,116, 91, 52, 93, 0,116,101,120,109, 97,112, 0, 99,117,
-114,109,117,108,116, 0,115,116, 97,116,105, 99,115,116,101,112, 0,111,109, 97,116, 0,116,105,109,101,116,101,120, 0,115,112,
-101,101,100,116,101,120, 0,102,108, 97,103, 50,110,101,103, 0,118,101,114,116,103,114,111,117,112, 95,118, 0,118,103,114,111,
-117,112,110, 97,109,101, 91, 51, 50, 93, 0,118,103,114,111,117,112,110, 97,109,101, 95,118, 91, 51, 50, 93, 0, 42,107,101,121,
-115, 0,109,105,110,102, 97, 99, 0,117,115,101,100, 0,117,115,101,100,101,108,101,109, 0,100,120, 0,100,121, 0,108,105,110,
-107, 0,111,116,121,112,101, 0,111,108,100, 0, 42,112,111,105,110, 0, 42,111,108,100,112,111,105,110, 0,114,101,115,101,116,
-100,105,115,116, 0,108, 97,115,116,118, 97,108, 0, 42,109, 97, 0,107,101,121, 0,113,117, 97,108, 0,113,117, 97,108, 50, 0,
-116, 97,114,103,101,116, 78, 97,109,101, 91, 51, 50, 93, 0,116,111,103,103,108,101, 78, 97,109,101, 91, 51, 50, 93, 0,118, 97,
-108,117,101, 91, 51, 50, 93, 0,109, 97,120,118, 97,108,117,101, 91, 51, 50, 93, 0,109, 97,116,101,114,105, 97,108, 78, 97,109,
-101, 91, 51, 50, 93, 0,100, 97,109,112,116,105,109,101,114, 0,100,101,108, 97,121, 0,112,114,111,112,110, 97,109,101, 91, 51,
- 50, 93, 0,109, 97,116,110, 97,109,101, 91, 51, 50, 93, 0, 97,120,105,115,102,108, 97,103, 0, 42,102,114,111,109, 79, 98,106,
-101, 99,116, 0,115,117, 98,106,101, 99,116, 91, 51, 50, 93, 0, 98,111,100,121, 91, 51, 50, 93, 0,112,117,108,115,101, 0,102,
-114,101,113, 0,116,111,116,108,105,110,107,115, 0, 42, 42,108,105,110,107,115, 0,102,114,101,113, 50, 0, 97,120,105,115,102,
- 0, 98,117,116,116,111,110, 0, 98,117,116,116,111,110,102, 0,104, 97,116, 0,104, 97,116,102, 0,112,114,101, 99,105,115,105,
-111,110, 0,115,116,114, 91, 49, 50, 56, 93, 0, 42,109,121,110,101,119, 0,105,110,112,117,116,115, 0,116,111,116,115,108,105,
-110,107,115, 0, 42, 42,115,108,105,110,107,115, 0,118, 97,108,111, 0,116,105,109,101, 0, 42, 97, 99,116, 0, 98,108,101,110,
-100,105,110, 0,112,114,105,111,114,105,116,121, 0,115,116,114,105,100,101, 97,120,105,115, 0,115,116,114,105,100,101,108,101,
-110,103,116,104, 0,115,110,100,110,114, 0,112, 97,100, 49, 91, 50, 93, 0,109, 97,107,101, 99,111,112,121, 0, 99,111,112,121,
-109, 97,100,101, 0,112, 97,100, 50, 91, 49, 93, 0,116,114, 97, 99,107, 0,118,111,108,117,109,101, 0, 42,109,101, 0,108,105,
-110, 86,101,108,111, 99,105,116,121, 91, 51, 93, 0,108,111, 99, 97,108,102,108, 97,103, 0,102,111,114, 99,101,108,111, 99, 91,
- 51, 93, 0,102,111,114, 99,101,114,111,116, 91, 51, 93, 0,108,105,110,101, 97,114,118,101,108,111, 99,105,116,121, 91, 51, 93,
- 0, 97,110,103,117,108, 97,114,118,101,108,111, 99,105,116,121, 91, 51, 93, 0, 98,117,116,115,116, 97, 0, 98,117,116,101,110,
-100, 0,109,105,110, 0,109, 97,120, 0,118,105,115,105,102, 97, 99, 0,115,108,111,119, 0,109,105,110,108,111, 99, 91, 51, 93,
- 0,109, 97,120,108,111, 99, 91, 51, 93, 0,109,105,110,114,111,116, 91, 51, 93, 0,109, 97,120,114,111,116, 91, 51, 93, 0,100,
-105,115,116,114,105, 98,117,116,105,111,110, 0,105,110,116, 95, 97,114,103, 95, 49, 0,105,110,116, 95, 97,114,103, 95, 50, 0,
-102,108,111, 97,116, 95, 97,114,103, 95, 49, 0,102,108,111, 97,116, 95, 97,114,103, 95, 50, 0,116,111, 80,114,111,112, 78, 97,
-109,101, 91, 51, 50, 93, 0, 42,116,111, 79, 98,106,101, 99,116, 0, 98,111,100,121, 84,121,112,101, 0,102,105,108,101,110, 97,
-109,101, 91, 54, 52, 93, 0,108,111, 97,100, 97,110,105,110, 97,109,101, 91, 54, 52, 93, 0,103,111, 0, 97, 99, 99,101,108,108,
-101,114, 97,116,105,111,110, 0,109, 97,120,115,112,101,101,100, 0,109, 97,120,114,111,116,115,112,101,101,100, 0,109, 97,120,
-116,105,108,116,115,112,101,101,100, 0,114,111,116,100, 97,109,112, 0,116,105,108,116,100, 97,109,112, 0,115,112,101,101,100,
-100, 97,109,112, 0, 42,115, 97,109,112,108,101, 0, 42,115,116,114,101, 97,109, 0, 42,110,101,119,112, 97, 99,107,101,100,102,
-105,108,101, 0, 42,115,110,100, 95,115,111,117,110,100, 0,112, 97,110,110,105,110,103, 0, 97,116,116,101,110,117, 97,116,105,
-111,110, 0,112,105,116, 99,104, 0,109,105,110, 95,103, 97,105,110, 0,109, 97,120, 95,103, 97,105,110, 0,100,105,115,116, 97,
-110, 99,101, 0,115,116,114,101, 97,109,108,101,110, 0, 99,104, 97,110,110,101,108,115, 0,104,105,103,104,112,114,105,111, 0,
-112, 97,100, 91, 49, 48, 93, 0,103, 97,105,110, 0,100,111,112,112,108,101,114,102, 97, 99,116,111,114, 0,100,111,112,112,108,
-101,114,118,101,108,111, 99,105,116,121, 0,110,117,109,115,111,117,110,100,115, 98,108,101,110,100,101,114, 0,110,117,109,115,
-111,117,110,100,115,103, 97,109,101,101,110,103,105,110,101, 0, 42,108, 97,109,112,114,101,110, 0,103,111, 98,106,101, 99,116,
- 0, 99,104,105,108,100, 98, 97,115,101, 0,114,111,108,108, 0,104,101, 97,100, 91, 51, 93, 0,116, 97,105,108, 91, 51, 93, 0,
- 98,111,110,101, 95,109, 97,116, 91, 51, 93, 91, 51, 93, 0, 97,114,109, 95,104,101, 97,100, 91, 51, 93, 0, 97,114,109, 95,116,
- 97,105,108, 91, 51, 93, 0, 97,114,109, 95,109, 97,116, 91, 52, 93, 91, 52, 93, 0,120,119,105,100,116,104, 0,122,119,105,100,
-116,104, 0,101, 97,115,101, 49, 0,101, 97,115,101, 50, 0,114, 97,100, 95,104,101, 97,100, 0,114, 97,100, 95,116, 97,105,108,
- 0, 98,111,110,101, 98, 97,115,101, 0, 99,104, 97,105,110, 98, 97,115,101, 0,112, 97,116,104,102,108, 97,103, 0,108, 97,121,
-101,114, 95,112,114,111,116,101, 99,116,101,100, 0,103,104,111,115,116,101,112, 0,103,104,111,115,116,115,105,122,101, 0,103,
-104,111,115,116,116,121,112,101, 0,112, 97,116,104,115,105,122,101, 0,103,104,111,115,116,115,102, 0,103,104,111,115,116,101,
-102, 0,112, 97,116,104,115,102, 0,112, 97,116,104,101,102, 0,112, 97,116,104, 98, 99, 0,112, 97,116,104, 97, 99, 0, 99,111,
-110,115,116,102,108, 97,103, 0,105,107,102,108, 97,103, 0,115,101,108,101, 99,116,102,108, 97,103, 0, 42, 98,111,110,101, 0,
- 42, 99,104,105,108,100, 0,105,107,116,114,101,101, 0, 42, 98, 95, 98,111,110,101, 95,109, 97,116,115, 0, 42,100,117, 97,108,
- 95,113,117, 97,116, 0, 42, 98, 95, 98,111,110,101, 95,100,117, 97,108, 95,113,117, 97,116,115, 0, 99,104, 97,110, 95,109, 97,
-116, 91, 52, 93, 91, 52, 93, 0,112,111,115,101, 95,109, 97,116, 91, 52, 93, 91, 52, 93, 0,112,111,115,101, 95,104,101, 97,100,
- 91, 51, 93, 0,112,111,115,101, 95,116, 97,105,108, 91, 51, 93, 0,108,105,109,105,116,109,105,110, 91, 51, 93, 0,108,105,109,
-105,116,109, 97,120, 91, 51, 93, 0,115,116,105,102,102,110,101,115,115, 91, 51, 93, 0,105,107,115,116,114,101,116, 99,104, 0,
- 42, 99,117,115,116,111,109, 0, 99,104, 97,110, 98, 97,115,101, 0,112,114,111,120,121, 95,108, 97,121,101,114, 0,115,116,114,
-105,100,101, 95,111,102,102,115,101,116, 91, 51, 93, 0, 99,121, 99,108,105, 99, 95,111,102,102,115,101,116, 91, 51, 93, 0,114,
-101,115,101,114,118,101,100, 49, 0, 97, 99,116,110,114, 0, 97, 99,116,119,105,100,116,104, 0,116,105,109,101,115,108,105,100,
-101, 0,110, 97,109,101, 91, 51, 48, 93, 0,111,119,110,115,112, 97, 99,101, 0,116, 97,114,115,112, 97, 99,101, 0,101,110,102,
-111,114, 99,101, 0,104,101, 97,100,116, 97,105,108, 0, 42,116, 97,114, 0,115,117, 98,116, 97,114,103,101,116, 91, 51, 50, 93,
- 0,109, 97,116,114,105,120, 91, 52, 93, 91, 52, 93, 0,115,112, 97, 99,101, 0, 42,112,114,111,112, 0,116, 97,114,110,117,109,
- 0,116, 97,114,103,101,116,115, 0,105,116,101,114, 97,116,105,111,110,115, 0,114,111,111,116, 98,111,110,101, 0, 42,112,111,
-108,101,116, 97,114, 0,112,111,108,101,115,117, 98,116, 97,114,103,101,116, 91, 51, 50, 93, 0,112,111,108,101, 97,110,103,108,
-101, 0,111,114,105,101,110,116,119,101,105,103,104,116, 0,103,114, 97, 98,116, 97,114,103,101,116, 91, 51, 93, 0,114,101,115,
-101,114,118,101,100, 50, 0,109,105,110,109, 97,120,102,108, 97,103, 0,115,116,117, 99,107, 0, 99, 97, 99,104,101, 91, 51, 93,
- 0,108,111, 99,107,102,108, 97,103, 0,102,111,108,108,111,119,102,108, 97,103, 0,118,111,108,109,111,100,101, 0,112,108, 97,
-110,101, 0,111,114,103,108,101,110,103,116,104, 0, 98,117,108,103,101, 0,112,105,118, 88, 0,112,105,118, 89, 0,112,105,118,
- 90, 0, 97,120, 88, 0, 97,120, 89, 0, 97,120, 90, 0,109,105,110, 76,105,109,105,116, 91, 54, 93, 0,109, 97,120, 76,105,109,
-105,116, 91, 54, 93, 0,101,120,116,114, 97, 70,122, 0,105,110,118,109, 97,116, 91, 52, 93, 91, 52, 93, 0,102,114,111,109, 0,
-116,111, 0,109, 97,112, 91, 51, 93, 0,101,120,112,111, 0,102,114,111,109, 95,109,105,110, 91, 51, 93, 0,102,114,111,109, 95,
-109, 97,120, 91, 51, 93, 0,116,111, 95,109,105,110, 91, 51, 93, 0,116,111, 95,109, 97,120, 91, 51, 93, 0,122,109,105,110, 0,
-122,109, 97,120, 0, 99,104, 97,110,110,101,108, 91, 51, 50, 93, 0,110,111, 95,114,111,116, 95, 97,120,105,115, 0,115,116,114,
-105,100,101, 95, 97,120,105,115, 0, 99,117,114,109,111,100, 0, 97, 99,116,115,116, 97,114,116, 0, 97, 99,116,101,110,100, 0,
- 97, 99,116,111,102,102,115, 0,115,116,114,105,100,101,108,101,110, 0, 98,108,101,110,100,111,117,116, 0,115,116,114,105,100,
-101, 99,104, 97,110,110,101,108, 91, 51, 50, 93, 0,111,102,102,115, 95, 98,111,110,101, 91, 51, 50, 93, 0,104, 97,115,105,110,
-112,117,116, 0,104, 97,115,111,117,116,112,117,116, 0,100, 97,116, 97,116,121,112,101, 0,115,111, 99,107,101,116,116,121,112,
-101, 0,110,115, 0,108,105,109,105,116, 0,115,116, 97, 99,107, 95,105,110,100,101,120, 0,105,110,116,101,114,110, 0,115,116,
- 97, 99,107, 95,105,110,100,101,120, 95,101,120,116, 0,108,111, 99,120, 0,108,111, 99,121, 0,111,119,110, 95,105,110,100,101,
-120, 0,116,111, 95,105,110,100,101,120, 0, 42,116,111,115,111, 99,107, 0, 42,108,105,110,107, 0, 42,110,101,119, 95,110,111,
-100,101, 0,108, 97,115,116,121, 0,111,117,116,112,117,116,115, 0, 42,115,116,111,114, 97,103,101, 0,109,105,110,105,119,105,
-100,116,104, 0, 99,117,115,116,111,109, 49, 0, 99,117,115,116,111,109, 50, 0,110,101,101,100, 95,101,120,101, 99, 0,101,120,
-101, 99, 0,116,111,116,114, 0, 98,117,116,114, 0,112,114,118,114, 0, 42,116,121,112,101,105,110,102,111, 0, 42,102,114,111,
-109,110,111,100,101, 0, 42,116,111,110,111,100,101, 0, 42,102,114,111,109,115,111, 99,107, 0,110,111,100,101,115, 0,108,105,
-110,107,115, 0, 42, 42,115,116, 97, 99,107, 0,105,110,105,116, 0,115,116, 97, 99,107,115,105,122,101, 0, 99,117,114, 95,105,
-110,100,101,120, 0, 97,108,108,116,121,112,101,115, 0, 42,111,119,110,116,121,112,101, 0, 40, 42,116,105,109,101, 99,117,114,
-115,111,114, 41, 40, 41, 0, 40, 42,115,116, 97,116,115, 95,100,114, 97,119, 41, 40, 41, 0, 40, 42,116,101,115,116, 95, 98,114,
-101, 97,107, 41, 40, 41, 0, 99,121, 99,108,105, 99, 0,109,111,118,105,101, 0,115, 97,109,112,108,101,115, 0,109,105,110,115,
-112,101,101,100, 0, 98,111,107,101,104, 0,104,117,101, 0,115, 97,116, 0,116, 49, 0,116, 50, 0,116, 51, 0,102,115,116,114,
-101,110,103,116,104, 0,102, 97,108,112,104, 97, 0,107,101,121, 91, 52, 93, 0,120, 49, 0,120, 50, 0,121, 49, 0,121, 50, 0,
- 99,111,108,110, 97,109,101, 91, 51, 50, 93, 0, 98,107,116,121,112,101, 0,114,111,116, 97,116,105,111,110, 0,112,114,101,118,
-105,101,119, 0,103, 97,109, 99,111, 0,110,111, 95,122, 98,117,102, 0,102,115,116,111,112, 0,109, 97,120, 98,108,117,114, 0,
- 98,116,104,114,101,115,104, 0,105,116,101,114, 0, 97,110,103,108,101, 95,111,102,115, 0, 99,111,108,109,111,100, 0,109,105,
-120, 0,116,104,114,101,115,104,111,108,100, 0,102, 97,100,101, 0,109, 0, 99, 0,106,105,116, 0,112,114,111,106, 0,102,105,
-116, 0,115,104,111,114,116,121, 0,109,105,110,116, 97, 98,108,101, 0,109, 97,120,116, 97, 98,108,101, 0,101,120,116, 95,105,
-110, 91, 50, 93, 0,101,120,116, 95,111,117,116, 91, 50, 93, 0, 42, 99,117,114,118,101, 0, 42,116, 97, 98,108,101, 0, 42,112,
-114,101,109,117,108,116, 97, 98,108,101, 0, 99,117,114,114, 0, 99,108,105,112,114, 0, 99,109, 91, 52, 93, 0, 98,108, 97, 99,
-107, 91, 51, 93, 0,119,104,105,116,101, 91, 51, 93, 0, 98,119,109,117,108, 91, 51, 93, 0,111,102,102,115,101,116, 91, 50, 93,
- 0,105,110,110,101,114,114, 97,100,105,117,115, 0,114, 97,116,101, 0,114,103, 98, 91, 51, 93, 0, 99,108,111,110,101, 0, 97,
- 99,116,105,118,101, 95,114,110,100, 0,112, 97,100, 91, 52, 93, 0, 42,108, 97,121,101,114,115, 0,116,111,116,108, 97,121,101,
-114, 0,109, 97,120,108, 97,121,101,114, 0,116,111,116,115,105,122,101, 0,101,100,105,116,102,108, 97,103, 0,118,101,108, 91,
- 51, 93, 0,114,111,116, 91, 52, 93, 0, 97,118,101, 91, 51, 93, 0,110,117,109, 0,112, 97,114,101,110,116, 0,112, 97, 91, 52,
- 93, 0,119, 91, 52, 93, 0,102,117,118, 91, 52, 93, 0,102,111,102,102,115,101,116, 0,114, 97,110,100, 91, 51, 93, 0, 42,115,
-116,105, 99,107, 95,111, 98, 0,115,116, 97,116,101, 0, 42,104, 97,105,114, 0,105, 95,114,111,116, 91, 52, 93, 0,114, 95,114,
-111,116, 91, 52, 93, 0,114, 95, 97,118,101, 91, 51, 93, 0,114, 95,118,101, 91, 51, 93, 0,100,105,101,116,105,109,101, 0, 98,
- 97,110,107, 0,115,105,122,101,109,117,108, 0,110,117,109, 95,100,109, 99, 97, 99,104,101, 0, 98,112,105, 0, 97,108,105,118,
-101, 0,108,111,111,112, 0,100,105,115,116,114, 0,112,104,121,115,116,121,112,101, 0,114,111,116,109,111,100,101, 0, 97,118,
-101,109,111,100,101, 0,114,101, 97, 99,116,101,118,101,110,116, 0,100,114, 97,119, 0,100,114, 97,119, 95, 97,115, 0,100,114,
- 97,119, 95,115,105,122,101, 0, 99,104,105,108,100,116,121,112,101, 0,100,114, 97,119, 95,115,116,101,112, 0,114,101,110, 95,
-115,116,101,112, 0,104, 97,105,114, 95,115,116,101,112, 0,107,101,121,115, 95,115,116,101,112, 0, 97,100, 97,112,116, 95, 97,
-110,103,108,101, 0, 97,100, 97,112,116, 95,112,105,120, 0,114,111,116,102,114,111,109, 0,105,110,116,101,103,114, 97,116,111,
-114, 0,110, 98,101,116,119,101,101,110, 0, 98,111,105,100,110,101,105,103,104, 98,111,117,114,115, 0, 98, 98, 95, 97,108,105,
-103,110, 0, 98, 98, 95,117,118, 95,115,112,108,105,116, 0, 98, 98, 95, 97,110,105,109, 0, 98, 98, 95,115,112,108,105,116, 95,
-111,102,102,115,101,116, 0, 98, 98, 95,116,105,108,116, 0, 98, 98, 95,114, 97,110,100, 95,116,105,108,116, 0, 98, 98, 95,111,
-102,102,115,101,116, 91, 50, 93, 0,116,105,109,101,116,119,101, 97,107, 0,106,105,116,102, 97, 99, 0,107,101,121,101,100, 95,
-116,105,109,101, 0,103,114,105,100, 95,114,101,115, 0,112, 97,114,116,102, 97, 99, 0,116, 97,110,102, 97, 99, 0,116, 97,110,
-112,104, 97,115,101, 0,114,101, 97, 99,116,102, 97, 99, 0,114,111,116,102, 97, 99, 0, 97,118,101,102, 97, 99, 0,112,104, 97,
-115,101,102, 97, 99, 0,114, 97,110,100,115,105,122,101, 0,114,101, 97, 99,116,115,104, 97,112,101, 0, 97, 99, 99, 91, 51, 93,
- 0,100,114, 97,103,102, 97, 99, 0, 98,114,111,119,110,102, 97, 99, 0,100, 97,109,112,102, 97, 99, 0, 97, 98,115,108,101,110,
-103,116,104, 0,114, 97,110,100,108,101,110,103,116,104, 0, 99,104,105,108,100, 95,110, 98,114, 0,112, 97,114,101,110,116,115,
- 0, 99,104,105,108,100,115,105,122,101, 0, 99,104,105,108,100,114, 97,110,100,115,105,122,101, 0, 99,104,105,108,100,114, 97,
-100, 0, 99,104,105,108,100,102,108, 97,116, 0, 99,104,105,108,100,115,112,114,101, 97,100, 0, 99,108,117,109,112,102, 97, 99,
- 0, 99,108,117,109,112,112,111,119, 0,114,111,117,103,104, 49, 0,114,111,117,103,104, 49, 95,115,105,122,101, 0,114,111,117,
-103,104, 50, 0,114,111,117,103,104, 50, 95,115,105,122,101, 0,114,111,117,103,104, 50, 95,116,104,114,101,115, 0,114,111,117,
-103,104, 95,101,110,100, 0,114,111,117,103,104, 95,101,110,100, 95,115,104, 97,112,101, 0, 98,114, 97,110, 99,104, 95,116,104,
-114,101,115, 0,100,114, 97,119, 95,108,105,110,101, 91, 50, 93, 0,109, 97,120, 95,118,101,108, 0,109, 97,120, 95,108, 97,116,
- 95, 97, 99, 99, 0,109, 97,120, 95,116, 97,110, 95, 97, 99, 99, 0, 97,118,101,114, 97,103,101, 95,118,101,108, 0, 98, 97,110,
-107,105,110,103, 0,109, 97,120, 95, 98, 97,110,107, 0,103,114,111,117,110,100,122, 0, 98,111,105,100,102, 97, 99, 91, 56, 93,
- 0, 98,111,105,100,114,117,108,101, 91, 56, 93, 0, 42,101,102,102, 95,103,114,111,117,112, 0, 42,100,117,112, 95,111, 98, 0,
- 42, 98, 98, 95,111, 98, 0, 42,112, 97,114,116, 0, 42,101,100,105,116, 0, 42, 42,112, 97,116,104, 99, 97, 99,104,101, 0, 42,
- 42, 99,104,105,108,100, 99, 97, 99,104,101, 0, 42,116, 97,114,103,101,116, 95,111, 98, 0, 42,107,101,121,101,100, 95,111, 98,
- 0, 42,108, 97,116,116,105, 99,101, 0,101,102,102,101, 99,116,111,114,115, 0,114,101, 97, 99,116,101,118,101,110,116,115, 0,
-116,111,116, 99,104,105,108,100, 0,116,111,116, 99, 97, 99,104,101,100, 0,116,111,116, 99,104,105,108,100, 99, 97, 99,104,101,
- 0,116, 97,114,103,101,116, 95,112,115,121,115, 0,107,101,121,101,100, 95,112,115,121,115, 0,116,111,116,107,101,121,101,100,
- 0, 98, 97,107,101,115,112, 97, 99,101, 0, 98, 98, 95,117,118,110, 97,109,101, 91, 51, 93, 91, 51, 50, 93, 0,118,103,114,111,
-117,112, 91, 49, 49, 93, 0,118,103, 95,110,101,103, 0,114,116, 51, 91, 50, 93, 0, 0, 0, 0, 84, 89, 80, 69, 50, 1, 0, 0,
- 99,104, 97,114, 0,117, 99,104, 97,114, 0,115,104,111,114,116, 0,117,115,104,111,114,116, 0,105,110,116, 0,108,111,110,103,
- 0,117,108,111,110,103, 0,102,108,111, 97,116, 0,100,111,117, 98,108,101, 0,118,111,105,100, 0, 76,105,110,107, 0, 76,105,
-115,116, 66, 97,115,101, 0,118,101, 99, 50,115, 0,118,101, 99, 50,105, 0,118,101, 99, 50,102, 0,118,101, 99, 50,100, 0,118,
-101, 99, 51,105, 0,118,101, 99, 51,102, 0,118,101, 99, 51,100, 0,118,101, 99, 52,105, 0,118,101, 99, 52,102, 0,118,101, 99,
- 52,100, 0,114, 99,116,105, 0,114, 99,116,102, 0, 73, 68, 80,114,111,112,101,114,116,121, 68, 97,116, 97, 0, 73, 68, 80,114,
-111,112,101,114,116,121, 0, 73, 68, 0, 76,105, 98,114, 97,114,121, 0, 70,105,108,101, 68, 97,116, 97, 0, 80,114,101,118,105,
-101,119, 73,109, 97,103,101, 0, 73,112,111, 0, 75,101,121, 66,108,111, 99,107, 0, 75,101,121, 0, 83, 99,114,105,112,116, 76,
-105,110,107, 0, 84,101,120,116, 76,105,110,101, 0, 84,101,120,116, 0, 80, 97, 99,107,101,100, 70,105,108,101, 0, 67, 97,109,
-101,114, 97, 0, 79, 98,106,101, 99,116, 0, 73,109, 97,103,101, 85,115,101,114, 0, 73,109, 97,103,101, 0, 97,110,105,109, 0,
- 82,101,110,100,101,114, 82,101,115,117,108,116, 0, 77, 84,101,120, 0, 84,101,120, 0, 80,108,117,103,105,110, 84,101,120, 0,
- 67, 66, 68, 97,116, 97, 0, 67,111,108,111,114, 66, 97,110,100, 0, 69,110,118, 77, 97,112, 0, 73,109, 66,117,102, 0, 84,101,
-120, 77, 97,112,112,105,110,103, 0, 76, 97,109,112, 0, 67,117,114,118,101, 77, 97,112,112,105,110,103, 0, 87, 97,118,101, 0,
- 77, 97,116,101,114,105, 97,108, 0, 98, 78,111,100,101, 84,114,101,101, 0, 71,114,111,117,112, 0, 86, 70,111,110,116, 0, 86,
- 70,111,110,116, 68, 97,116, 97, 0, 77,101,116, 97, 69,108,101,109, 0, 66,111,117,110,100, 66,111,120, 0, 77,101,116, 97, 66,
- 97,108,108, 0, 66,101,122, 84,114,105,112,108,101, 0, 66, 80,111,105,110,116, 0, 78,117,114, 98, 0, 67,104, 97,114, 73,110,
-102,111, 0, 84,101,120,116, 66,111,120, 0, 67,117,114,118,101, 0, 80, 97,116,104, 0, 73,112,111, 68,114,105,118,101,114, 0,
- 73,112,111, 67,117,114,118,101, 0, 77,101,115,104, 0, 77, 70, 97, 99,101, 0, 77, 84, 70, 97, 99,101, 0, 84, 70, 97, 99,101,
- 0, 77, 86,101,114,116, 0, 77, 69,100,103,101, 0, 77, 68,101,102,111,114,109, 86,101,114,116, 0, 77, 67,111,108, 0, 77, 83,
-116,105, 99,107,121, 0, 77, 83,101,108,101, 99,116, 0, 67,117,115,116,111,109, 68, 97,116, 97, 0, 77,117,108,116,105,114,101,
-115, 0, 80, 97,114,116,105, 97,108, 86,105,115,105, 98,105,108,105,116,121, 0, 77, 68,101,102,111,114,109, 87,101,105,103,104,
-116, 0, 77, 70,108,111, 97,116, 80,114,111,112,101,114,116,121, 0, 77, 73,110,116, 80,114,111,112,101,114,116,121, 0, 77, 83,
-116,114,105,110,103, 80,114,111,112,101,114,116,121, 0, 79,114,105,103, 83,112, 97, 99,101, 70, 97, 99,101, 0, 77,117,108,116,
-105,114,101,115, 67,111,108, 0, 77,117,108,116,105,114,101,115, 67,111,108, 70, 97, 99,101, 0, 77,117,108,116,105,114,101,115,
- 70, 97, 99,101, 0, 77,117,108,116,105,114,101,115, 69,100,103,101, 0, 77,117,108,116,105,114,101,115, 76,101,118,101,108, 0,
- 77,117,108,116,105,114,101,115, 77, 97,112, 78,111,100,101, 0, 77,111,100,105,102,105,101,114, 68, 97,116, 97, 0, 83,117, 98,
-115,117,114,102, 77,111,100,105,102,105,101,114, 68, 97,116, 97, 0, 76, 97,116,116,105, 99,101, 77,111,100,105,102,105,101,114,
- 68, 97,116, 97, 0, 67,117,114,118,101, 77,111,100,105,102,105,101,114, 68, 97,116, 97, 0, 66,117,105,108,100, 77,111,100,105,
-102,105,101,114, 68, 97,116, 97, 0, 65,114,114, 97,121, 77,111,100,105,102,105,101,114, 68, 97,116, 97, 0, 77,105,114,114,111,
-114, 77,111,100,105,102,105,101,114, 68, 97,116, 97, 0, 69,100,103,101, 83,112,108,105,116, 77,111,100,105,102,105,101,114, 68,
- 97,116, 97, 0, 68,105,115,112,108, 97, 99,101, 77,111,100,105,102,105,101,114, 68, 97,116, 97, 0, 85, 86, 80,114,111,106,101,
- 99,116, 77,111,100,105,102,105,101,114, 68, 97,116, 97, 0, 68,101, 99,105,109, 97,116,101, 77,111,100,105,102,105,101,114, 68,
- 97,116, 97, 0, 83,109,111,111,116,104, 77,111,100,105,102,105,101,114, 68, 97,116, 97, 0, 67, 97,115,116, 77,111,100,105,102,
-105,101,114, 68, 97,116, 97, 0, 87, 97,118,101, 77,111,100,105,102,105,101,114, 68, 97,116, 97, 0, 65,114,109, 97,116,117,114,
-101, 77,111,100,105,102,105,101,114, 68, 97,116, 97, 0, 72,111,111,107, 77,111,100,105,102,105,101,114, 68, 97,116, 97, 0, 83,
-111,102,116, 98,111,100,121, 77,111,100,105,102,105,101,114, 68, 97,116, 97, 0, 66,111,111,108,101, 97,110, 77,111,100,105,102,
-105,101,114, 68, 97,116, 97, 0, 77, 68,101,102, 73,110,102,108,117,101,110, 99,101, 0, 77, 68,101,102, 67,101,108,108, 0, 77,
-101,115,104, 68,101,102,111,114,109, 77,111,100,105,102,105,101,114, 68, 97,116, 97, 0, 80, 97,114,116,105, 99,108,101, 83,121,
-115,116,101,109, 77,111,100,105,102,105,101,114, 68, 97,116, 97, 0, 80, 97,114,116,105, 99,108,101, 83,121,115,116,101,109, 0,
- 68,101,114,105,118,101,100, 77,101,115,104, 0, 80, 97,114,116,105, 99,108,101, 73,110,115,116, 97,110, 99,101, 77,111,100,105,
-102,105,101,114, 68, 97,116, 97, 0, 69,120,112,108,111,100,101, 77,111,100,105,102,105,101,114, 68, 97,116, 97, 0, 76, 97,116,
-116,105, 99,101, 0, 98, 68,101,102,111,114,109, 71,114,111,117,112, 0, 98, 65, 99,116,105,111,110, 0, 98, 80,111,115,101, 0,
- 80, 97,114,116, 68,101,102,108,101, 99,116, 0, 83,111,102,116, 66,111,100,121, 0, 70,108,117,105,100,115,105,109, 83,101,116,
-116,105,110,103,115, 0, 79, 98, 72,111,111,107, 0, 83, 66, 86,101,114,116,101,120, 0, 66,111,100,121, 80,111,105,110,116, 0,
- 66,111,100,121, 83,112,114,105,110,103, 0, 83, 66, 83, 99,114, 97,116, 99,104, 0, 87,111,114,108,100, 0, 82, 97,100,105,111,
- 0, 66, 97,115,101, 0, 65,118,105, 67,111,100,101, 99, 68, 97,116, 97, 0, 81,117,105, 99,107,116,105,109,101, 67,111,100,101,
- 99, 68, 97,116, 97, 0, 70, 70, 77,112,101,103, 67,111,100,101, 99, 68, 97,116, 97, 0, 65,117,100,105,111, 68, 97,116, 97, 0,
- 83, 99,101,110,101, 82,101,110,100,101,114, 76, 97,121,101,114, 0, 82,101,110,100,101,114, 68, 97,116, 97, 0, 71, 97,109,101,
- 70,114, 97,109,105,110,103, 0, 84,105,109,101, 77, 97,114,107,101,114, 0, 73,109, 97,103,101, 80, 97,105,110,116, 83,101,116,
-116,105,110,103,115, 0, 66,114,117,115,104, 0, 80, 97,114,116,105, 99,108,101, 66,114,117,115,104, 68, 97,116, 97, 0, 80, 97,
-114,116,105, 99,108,101, 69,100,105,116, 83,101,116,116,105,110,103,115, 0, 84,111,111,108, 83,101,116,116,105,110,103,115, 0,
- 66,114,117,115,104, 68, 97,116, 97, 0, 83, 99,117,108,112,116, 68, 97,116, 97, 0, 83, 99,117,108,112,116, 83,101,115,115,105,
-111,110, 0, 83, 99,101,110,101, 0, 68, 97,103, 70,111,114,101,115,116, 0, 66, 71,112,105, 99, 0, 86,105,101,119, 51, 68, 0,
- 83,112, 97, 99,101, 76,105,110,107, 0, 83, 99,114, 65,114,101, 97, 0, 82,101,110,100,101,114, 73,110,102,111, 0, 82,101,116,
-111,112,111, 86,105,101,119, 68, 97,116, 97, 0, 86,105,101,119, 68,101,112,116,104,115, 0, 86,105,101,119, 50, 68, 0, 83,112,
- 97, 99,101, 73,110,102,111, 0, 83,112, 97, 99,101, 73,112,111, 0, 83,112, 97, 99,101, 66,117,116,115, 0, 83,112, 97, 99,101,
- 83,101,113, 0, 83,112, 97, 99,101, 70,105,108,101, 0,100,105,114,101,110,116,114,121, 0, 66,108,101,110,100, 72, 97,110,100,
-108,101, 0, 83,112, 97, 99,101, 79,111,112,115, 0, 84,114,101,101, 83,116,111,114,101, 0, 84,114,101,101, 83,116,111,114,101,
- 69,108,101,109, 0, 83,112, 97, 99,101, 73,109, 97,103,101, 0, 83,112, 97, 99,101, 78,108, 97, 0, 83,112, 97, 99,101, 84,101,
-120,116, 0, 83,112, 97, 99,101, 83, 99,114,105,112,116, 0, 83, 99,114,105,112,116, 0, 83,112, 97, 99,101, 84,105,109,101, 0,
- 83,112, 97, 99,101, 78,111,100,101, 0, 83,112, 97, 99,101, 73,109, 97, 83,101,108, 0, 70,105,108,101, 76,105,115,116, 0, 84,
-104,101,109,101, 85, 73, 0, 84,104,101,109,101, 83,112, 97, 99,101, 0, 98, 84,104,101,109,101, 0, 83,111,108,105,100, 76,105,
-103,104,116, 0, 85,115,101,114, 68,101,102, 0, 98, 83, 99,114,101,101,110, 0, 83, 99,114, 86,101,114,116, 0, 83, 99,114, 69,
-100,103,101, 0, 80, 97,110,101,108, 0, 70,105,108,101, 71,108,111, 98, 97,108, 0, 83,116,114,105,112, 69,108,101,109, 0, 84,
- 83,116,114,105,112, 69,108,101,109, 0, 83,116,114,105,112, 0, 80,108,117,103,105,110, 83,101,113, 0, 83,101,113,117,101,110,
- 99,101, 0, 98, 83,111,117,110,100, 0,104,100, 97,117,100,105,111, 0, 77,101,116, 97, 83,116, 97, 99,107, 0, 69,100,105,116,
-105,110,103, 0, 87,105,112,101, 86, 97,114,115, 0, 71,108,111,119, 86, 97,114,115, 0, 84,114, 97,110,115,102,111,114,109, 86,
- 97,114,115, 0, 83,111,108,105,100, 67,111,108,111,114, 86, 97,114,115, 0, 83,112,101,101,100, 67,111,110,116,114,111,108, 86,
- 97,114,115, 0, 69,102,102,101, 99,116, 0, 66,117,105,108,100, 69,102,102, 0, 80, 97,114,116, 69,102,102, 0, 80, 97,114,116,
-105, 99,108,101, 0, 87, 97,118,101, 69,102,102, 0, 79,111,112,115, 0, 98, 80,114,111,112,101,114,116,121, 0, 98, 78,101, 97,
-114, 83,101,110,115,111,114, 0, 98, 77,111,117,115,101, 83,101,110,115,111,114, 0, 98, 84,111,117, 99,104, 83,101,110,115,111,
-114, 0, 98, 75,101,121, 98,111, 97,114,100, 83,101,110,115,111,114, 0, 98, 80,114,111,112,101,114,116,121, 83,101,110,115,111,
-114, 0, 98, 67,111,108,108,105,115,105,111,110, 83,101,110,115,111,114, 0, 98, 82, 97,100, 97,114, 83,101,110,115,111,114, 0,
- 98, 82, 97,110,100,111,109, 83,101,110,115,111,114, 0, 98, 82, 97,121, 83,101,110,115,111,114, 0, 98, 77,101,115,115, 97,103,
-101, 83,101,110,115,111,114, 0, 98, 83,101,110,115,111,114, 0, 98, 67,111,110,116,114,111,108,108,101,114, 0, 98, 74,111,121,
-115,116,105, 99,107, 83,101,110,115,111,114, 0, 98, 69,120,112,114,101,115,115,105,111,110, 67,111,110,116, 0, 98, 80,121,116,
-104,111,110, 67,111,110,116, 0, 98, 65, 99,116,117, 97,116,111,114, 0, 98, 65,100,100, 79, 98,106,101, 99,116, 65, 99,116,117,
- 97,116,111,114, 0, 98, 65, 99,116,105,111,110, 65, 99,116,117, 97,116,111,114, 0, 98, 83,111,117,110,100, 65, 99,116,117, 97,
-116,111,114, 0, 98, 67, 68, 65, 99,116,117, 97,116,111,114, 0, 98, 69,100,105,116, 79, 98,106,101, 99,116, 65, 99,116,117, 97,
-116,111,114, 0, 98, 83, 99,101,110,101, 65, 99,116,117, 97,116,111,114, 0, 98, 80,114,111,112,101,114,116,121, 65, 99,116,117,
- 97,116,111,114, 0, 98, 79, 98,106,101, 99,116, 65, 99,116,117, 97,116,111,114, 0, 98, 73,112,111, 65, 99,116,117, 97,116,111,
-114, 0, 98, 67, 97,109,101,114, 97, 65, 99,116,117, 97,116,111,114, 0, 98, 67,111,110,115,116,114, 97,105,110,116, 65, 99,116,
-117, 97,116,111,114, 0, 98, 71,114,111,117,112, 65, 99,116,117, 97,116,111,114, 0, 98, 82, 97,110,100,111,109, 65, 99,116,117,
- 97,116,111,114, 0, 98, 77,101,115,115, 97,103,101, 65, 99,116,117, 97,116,111,114, 0, 98, 71, 97,109,101, 65, 99,116,117, 97,
-116,111,114, 0, 98, 86,105,115,105, 98,105,108,105,116,121, 65, 99,116,117, 97,116,111,114, 0, 70,114,101,101, 67, 97,109,101,
-114, 97, 0, 98, 83, 97,109,112,108,101, 0, 98, 83,111,117,110,100, 76,105,115,116,101,110,101,114, 0, 83,112, 97, 99,101, 83,
-111,117,110,100, 0, 71,114,111,117,112, 79, 98,106,101, 99,116, 0, 66,111,110,101, 0, 98, 65,114,109, 97,116,117,114,101, 0,
- 98, 80,111,115,101, 67,104, 97,110,110,101,108, 0, 98, 65, 99,116,105,111,110, 67,104, 97,110,110,101,108, 0, 83,112, 97, 99,
-101, 65, 99,116,105,111,110, 0, 98, 67,111,110,115,116,114, 97,105,110,116, 67,104, 97,110,110,101,108, 0, 98, 67,111,110,115,
-116,114, 97,105,110,116, 0, 98, 67,111,110,115,116,114, 97,105,110,116, 84, 97,114,103,101,116, 0, 98, 80,121,116,104,111,110,
- 67,111,110,115,116,114, 97,105,110,116, 0, 98, 75,105,110,101,109, 97,116,105, 99, 67,111,110,115,116,114, 97,105,110,116, 0,
- 98, 84,114, 97, 99,107, 84,111, 67,111,110,115,116,114, 97,105,110,116, 0, 98, 82,111,116, 97,116,101, 76,105,107,101, 67,111,
-110,115,116,114, 97,105,110,116, 0, 98, 76,111, 99, 97,116,101, 76,105,107,101, 67,111,110,115,116,114, 97,105,110,116, 0, 98,
- 77,105,110, 77, 97,120, 67,111,110,115,116,114, 97,105,110,116, 0, 98, 83,105,122,101, 76,105,107,101, 67,111,110,115,116,114,
- 97,105,110,116, 0, 98, 65, 99,116,105,111,110, 67,111,110,115,116,114, 97,105,110,116, 0, 98, 76,111, 99,107, 84,114, 97, 99,
-107, 67,111,110,115,116,114, 97,105,110,116, 0, 98, 70,111,108,108,111,119, 80, 97,116,104, 67,111,110,115,116,114, 97,105,110,
-116, 0, 98, 83,116,114,101,116, 99,104, 84,111, 67,111,110,115,116,114, 97,105,110,116, 0, 98, 82,105,103,105,100, 66,111,100,
-121, 74,111,105,110,116, 67,111,110,115,116,114, 97,105,110,116, 0, 98, 67,108, 97,109,112, 84,111, 67,111,110,115,116,114, 97,
-105,110,116, 0, 98, 67,104,105,108,100, 79,102, 67,111,110,115,116,114, 97,105,110,116, 0, 98, 84,114, 97,110,115,102,111,114,
-109, 67,111,110,115,116,114, 97,105,110,116, 0, 98, 76,111, 99, 76,105,109,105,116, 67,111,110,115,116,114, 97,105,110,116, 0,
- 98, 82,111,116, 76,105,109,105,116, 67,111,110,115,116,114, 97,105,110,116, 0, 98, 83,105,122,101, 76,105,109,105,116, 67,111,
-110,115,116,114, 97,105,110,116, 0, 98, 65, 99,116,105,111,110, 77,111,100,105,102,105,101,114, 0, 98, 65, 99,116,105,111,110,
- 83,116,114,105,112, 0, 98, 78,111,100,101, 83,116, 97, 99,107, 0, 98, 78,111,100,101, 83,111, 99,107,101,116, 0, 98, 78,111,
-100,101, 76,105,110,107, 0, 98, 78,111,100,101, 0, 98, 78,111,100,101, 80,114,101,118,105,101,119, 0, 98, 78,111,100,101, 84,
-121,112,101, 0, 78,111,100,101, 73,109, 97,103,101, 65,110,105,109, 0, 78,111,100,101, 66,108,117,114, 68, 97,116, 97, 0, 78,
-111,100,101, 72,117,101, 83, 97,116, 0, 78,111,100,101, 73,109, 97,103,101, 70,105,108,101, 0, 78,111,100,101, 67,104,114,111,
-109, 97, 0, 78,111,100,101, 84,119,111, 88, 89,115, 0, 78,111,100,101, 71,101,111,109,101,116,114,121, 0, 78,111,100,101, 86,
-101,114,116,101,120, 67,111,108, 0, 78,111,100,101, 68,101,102,111, 99,117,115, 0, 78,111,100,101, 71,108, 97,114,101, 0, 78,
-111,100,101, 84,111,110,101,109, 97,112, 0, 78,111,100,101, 76,101,110,115, 68,105,115,116, 0, 67,117,114,118,101, 77, 97,112,
- 80,111,105,110,116, 0, 67,117,114,118,101, 77, 97,112, 0, 66,114,117,115,104, 67,108,111,110,101, 0, 67,117,115,116,111,109,
- 68, 97,116, 97, 76, 97,121,101,114, 0, 72, 97,105,114, 75,101,121, 0, 80, 97,114,116,105, 99,108,101, 75,101,121, 0, 67,104,
-105,108,100, 80, 97,114,116,105, 99,108,101, 0, 80, 97,114,116,105, 99,108,101, 68, 97,116, 97, 0, 80, 97,114,116,105, 99,108,
-101, 83,101,116,116,105,110,103,115, 0, 80, 97,114,116,105, 99,108,101, 69,100,105,116, 0, 80, 97,114,116,105, 99,108,101, 67,
- 97, 99,104,101, 75,101,121, 0, 84, 76, 69, 78, 1, 0, 1, 0, 2, 0, 2, 0, 4, 0, 4, 0, 4, 0, 4, 0, 8, 0, 0, 0,
- 16, 0, 16, 0, 4, 0, 8, 0, 8, 0, 16, 0, 12, 0, 12, 0, 24, 0, 16, 0, 16, 0, 32, 0, 16, 0, 16, 0, 32, 0, 96, 0,
- 72, 0, 72, 2, 0, 0, 40, 0,112, 0,128, 0,160, 0, 24, 0, 40, 0,152, 0, 24, 0,168, 0, 32, 4, 32, 0,176, 1, 0, 0,
- 0, 0,136, 0, 48, 1,120, 1, 24, 0, 8, 3,200, 0, 0, 0,136, 0,104, 1, 48, 1, 80, 0,144, 2,176, 0, 96, 0, 96, 1,
- 0, 0,128, 0,104, 0,184, 0, 56, 0, 36, 0, 80, 0, 8, 0, 16, 0,160, 1, 0, 0,144, 0,112, 0,120, 1, 20, 0, 48, 0,
- 64, 0, 20, 0, 12, 0, 16, 0, 4, 0, 8, 0, 8, 0, 24, 0, 96, 0, 48, 0, 8, 0, 4, 0, 4, 0, 0, 1, 32, 0, 16, 0,
- 64, 0, 24, 0, 12, 0, 96, 0, 0, 0, 64, 0, 88, 0,104, 0,112, 0, 80, 0,144, 0, 80, 0, 72, 0,168, 0,208, 0, 72, 0,
-104, 0,120, 0,200, 0,120, 0,200, 0, 64, 0, 80, 0, 8, 0, 8, 0, 0, 1, 88, 0,104, 1, 0, 0, 80, 0, 80, 0,152, 0,
- 48, 0, 88, 0, 48, 0,120, 0,160, 0,152, 1,224, 0, 16, 0, 0, 0, 0, 0, 0, 0,152, 1, 40, 0, 40, 0,184, 0,152, 0,
- 48, 0, 16, 0, 80, 0, 48, 4, 16, 0, 88, 0, 16, 0,216, 0, 8, 0, 72, 0,152, 0, 8, 0,160, 0, 0, 0, 24, 6, 0, 0,
- 64, 0, 56, 3, 48, 0, 8, 1, 0, 0, 0, 0, 0, 0,136, 0, 48, 0, 88, 1,240, 0,208, 0,168, 1, 0, 0, 0, 0, 48, 1,
- 16, 0, 16, 0, 48, 1,192, 0,136, 0, 56, 0, 0, 0,176, 0,232, 0,104, 2, 0, 0,152, 0,184, 0,152, 11, 56, 0, 16, 12,
-168, 0, 32, 0, 40, 0,240, 0, 40, 0, 80, 0, 40, 0,216, 0,200, 1,248, 0, 72, 1, 0, 0, 32, 0, 48, 0, 12, 0, 24, 0,
- 48, 0, 16, 0, 24, 0, 24, 0, 32, 0, 72, 1, 0, 0, 64, 0, 64, 0, 80, 0, 48, 0, 8, 0, 48, 0, 72, 0,104, 0, 72, 0,
- 44, 0, 40, 0,108, 0, 72, 0, 96, 0,104, 0, 64, 0,128, 0, 8, 0, 80, 0, 16, 0, 64, 0, 32, 0, 20, 0, 72, 0, 24, 0,
- 80, 0,104, 0, 52, 0, 32, 0, 56, 0, 64, 0, 56, 0,112, 0,140, 0, 4, 0, 40, 0, 0, 0, 88, 0,192, 0, 40, 0, 24, 1,
-152, 0,208, 1, 80, 0,208, 0, 56, 0, 72, 0,128, 0, 80, 0,112, 0, 56, 0, 48, 0, 48, 0, 72, 0, 48, 0, 72, 0, 48, 0,
- 24, 0, 56, 0,104, 0, 16, 0,112, 0, 96, 0, 28, 0, 28, 0, 28, 0, 72, 0,168, 0, 40, 0,136, 0, 48, 0,208, 0, 0, 0,
- 0, 0, 16, 0, 24, 0, 12, 0, 16, 1, 40, 0, 8, 0, 64, 0, 32, 0, 24, 0, 24, 0, 32, 0, 8, 0, 12, 0, 56, 0, 24, 0,
- 64, 0, 24, 0, 56, 0, 72, 0,208, 0,232, 1, 0, 0, 0, 0, 83, 84, 82, 67, 13, 1, 0, 0, 10, 0, 2, 0, 10, 0, 0, 0,
- 10, 0, 1, 0, 11, 0, 2, 0, 9, 0, 2, 0, 9, 0, 3, 0, 12, 0, 2, 0, 2, 0, 4, 0, 2, 0, 5, 0, 13, 0, 2, 0,
- 4, 0, 4, 0, 4, 0, 5, 0, 14, 0, 2, 0, 7, 0, 4, 0, 7, 0, 5, 0, 15, 0, 2, 0, 8, 0, 4, 0, 8, 0, 5, 0,
- 16, 0, 3, 0, 4, 0, 4, 0, 4, 0, 5, 0, 4, 0, 6, 0, 17, 0, 3, 0, 7, 0, 4, 0, 7, 0, 5, 0, 7, 0, 6, 0,
- 18, 0, 3, 0, 8, 0, 4, 0, 8, 0, 5, 0, 8, 0, 6, 0, 19, 0, 4, 0, 4, 0, 4, 0, 4, 0, 5, 0, 4, 0, 6, 0,
- 4, 0, 7, 0, 20, 0, 4, 0, 7, 0, 4, 0, 7, 0, 5, 0, 7, 0, 6, 0, 7, 0, 7, 0, 21, 0, 4, 0, 8, 0, 4, 0,
- 8, 0, 5, 0, 8, 0, 6, 0, 8, 0, 7, 0, 22, 0, 4, 0, 4, 0, 8, 0, 4, 0, 9, 0, 4, 0, 10, 0, 4, 0, 11, 0,
- 23, 0, 4, 0, 7, 0, 8, 0, 7, 0, 9, 0, 7, 0, 10, 0, 7, 0, 11, 0, 24, 0, 4, 0, 9, 0, 12, 0, 11, 0, 13, 0,
- 4, 0, 14, 0, 4, 0, 15, 0, 25, 0, 10, 0, 25, 0, 0, 0, 25, 0, 1, 0, 0, 0, 16, 0, 0, 0, 17, 0, 0, 0, 18, 0,
- 2, 0, 19, 0, 4, 0, 20, 0, 24, 0, 21, 0, 4, 0, 22, 0, 4, 0, 23, 0, 26, 0, 9, 0, 9, 0, 0, 0, 9, 0, 1, 0,
- 26, 0, 24, 0, 27, 0, 25, 0, 0, 0, 26, 0, 2, 0, 27, 0, 2, 0, 19, 0, 4, 0, 28, 0, 25, 0, 29, 0, 27, 0, 8, 0,
- 26, 0, 30, 0, 26, 0, 31, 0, 28, 0, 32, 0, 0, 0, 33, 0, 0, 0, 34, 0, 4, 0, 35, 0, 4, 0, 15, 0, 27, 0, 36, 0,
- 29, 0, 6, 0, 4, 0, 37, 0, 4, 0, 38, 0, 2, 0, 39, 0, 2, 0, 40, 0, 2, 0, 41, 0, 4, 0, 42, 0, 30, 0, 7, 0,
- 26, 0, 30, 0, 11, 0, 43, 0, 23, 0, 44, 0, 2, 0, 45, 0, 2, 0, 46, 0, 2, 0, 47, 0, 2, 0, 15, 0, 31, 0, 16, 0,
- 31, 0, 0, 0, 31, 0, 1, 0, 7, 0, 48, 0, 7, 0, 49, 0, 2, 0, 17, 0, 2, 0, 50, 0, 2, 0, 51, 0, 2, 0, 41, 0,
- 4, 0, 52, 0, 4, 0, 53, 0, 9, 0, 54, 0, 7, 0, 55, 0, 0, 0, 16, 0, 0, 0, 56, 0, 7, 0, 57, 0, 7, 0, 58, 0,
- 32, 0, 12, 0, 26, 0, 30, 0, 31, 0, 59, 0, 0, 0, 60, 0, 4, 0, 61, 0, 7, 0, 49, 0, 11, 0, 62, 0, 30, 0, 63, 0,
- 26, 0, 64, 0, 2, 0, 17, 0, 2, 0, 65, 0, 2, 0, 66, 0, 2, 0, 19, 0, 33, 0, 5, 0, 26, 0, 67, 0, 2, 0, 68, 0,
- 2, 0, 69, 0, 2, 0, 70, 0, 4, 0, 15, 0, 34, 0, 6, 0, 34, 0, 0, 0, 34, 0, 1, 0, 0, 0, 71, 0, 0, 0, 72, 0,
- 4, 0, 22, 0, 4, 0, 73, 0, 35, 0, 13, 0, 26, 0, 30, 0, 0, 0, 74, 0, 4, 0, 75, 0, 4, 0, 76, 0, 11, 0, 77, 0,
- 34, 0, 78, 0, 34, 0, 79, 0, 4, 0, 80, 0, 4, 0, 81, 0, 0, 0, 82, 0, 4, 0, 83, 0, 4, 0, 84, 0, 9, 0, 85, 0,
- 36, 0, 5, 0, 4, 0, 86, 0, 4, 0, 87, 0, 4, 0, 75, 0, 4, 0, 15, 0, 9, 0, 54, 0, 37, 0, 20, 0, 26, 0, 30, 0,
- 2, 0, 17, 0, 2, 0, 19, 0, 7, 0, 88, 0, 7, 0, 89, 0, 7, 0, 90, 0, 7, 0, 91, 0, 7, 0, 92, 0, 7, 0, 93, 0,
- 7, 0, 94, 0, 7, 0, 95, 0, 7, 0, 96, 0, 7, 0, 97, 0, 7, 0, 98, 0, 2, 0, 99, 0, 2, 0,100, 0, 7, 0,101, 0,
- 30, 0, 63, 0, 33, 0,102, 0, 38, 0,103, 0, 39, 0, 12, 0, 4, 0,104, 0, 4, 0,105, 0, 4, 0,106, 0, 4, 0,107, 0,
- 2, 0,108, 0, 2, 0,109, 0, 2, 0, 19, 0, 2, 0,110, 0, 2, 0,111, 0, 2, 0,112, 0, 2, 0,113, 0, 2, 0,114, 0,
- 40, 0, 31, 0, 26, 0, 30, 0, 0, 0, 33, 0, 11, 0,115, 0, 41, 0,116, 0, 42, 0,117, 0, 2, 0,110, 0, 2, 0, 19, 0,
- 2, 0,118, 0, 2, 0, 17, 0, 2, 0, 15, 0, 2, 0, 41, 0, 4, 0,119, 0, 2, 0,120, 0, 2, 0,121, 0, 2, 0,122, 0,
- 2, 0,123, 0, 2, 0,124, 0, 2, 0,125, 0, 4, 0,126, 0, 4, 0,127, 0, 36, 0,128, 0, 29, 0,129, 0, 7, 0,130, 0,
- 4, 0,131, 0, 2, 0,132, 0, 2, 0,133, 0, 2, 0,134, 0, 2, 0,135, 0, 7, 0,136, 0, 7, 0,137, 0, 9, 0,138, 0,
- 43, 0, 28, 0, 2, 0,139, 0, 2, 0,140, 0, 2, 0,141, 0, 2, 0,142, 0, 38, 0,143, 0, 44, 0,144, 0, 0, 0,145, 0,
- 0, 0,146, 0, 0, 0,147, 0, 0, 0,148, 0, 0, 0,149, 0, 7, 0,150, 0, 7, 0,151, 0, 2, 0,152, 0, 2, 0,153, 0,
- 2, 0,154, 0, 2, 0,155, 0, 7, 0,156, 0, 7, 0,157, 0, 7, 0,158, 0, 7, 0,159, 0, 7, 0,160, 0, 7, 0,161, 0,
- 7, 0,162, 0, 7, 0,163, 0, 7, 0,164, 0, 7, 0,165, 0, 7, 0,166, 0, 45, 0, 15, 0, 0, 0,167, 0, 9, 0,168, 0,
- 0, 0,169, 0, 0, 0,170, 0, 4, 0,171, 0, 4, 0,172, 0, 9, 0,173, 0, 7, 0,174, 0, 7, 0,175, 0, 7, 0,176, 0,
- 4, 0,177, 0, 9, 0,178, 0, 9, 0,179, 0, 4, 0,180, 0, 4, 0, 15, 0, 46, 0, 6, 0, 7, 0,156, 0, 7, 0,157, 0,
- 7, 0,158, 0, 7, 0,181, 0, 7, 0, 48, 0, 4, 0, 44, 0, 47, 0, 5, 0, 2, 0, 19, 0, 2, 0, 35, 0, 2, 0, 44, 0,
- 2, 0,182, 0, 46, 0,176, 0, 48, 0, 17, 0, 38, 0,143, 0, 40, 0,183, 0, 49, 0,184, 0, 7, 0,185, 0, 7, 0,186, 0,
- 2, 0, 17, 0, 2, 0,187, 0, 7, 0, 90, 0, 7, 0, 91, 0, 7, 0,188, 0, 4, 0,189, 0, 2, 0,190, 0, 2, 0,191, 0,
- 4, 0,110, 0, 4, 0,119, 0, 2, 0,192, 0, 2, 0,193, 0, 44, 0, 53, 0, 26, 0, 30, 0, 7, 0,194, 0, 7, 0,195, 0,
- 7, 0,196, 0, 7, 0,197, 0, 7, 0,198, 0, 7, 0,199, 0, 7, 0,200, 0, 7, 0,201, 0, 7, 0,202, 0, 7, 0,203, 0,
- 7, 0,204, 0, 7, 0,205, 0, 7, 0,206, 0, 7, 0,207, 0, 7, 0,208, 0, 7, 0,209, 0, 7, 0,210, 0, 7, 0,211, 0,
- 7, 0,212, 0, 7, 0,213, 0, 2, 0,214, 0, 2, 0,215, 0, 2, 0,216, 0, 2, 0,217, 0, 2, 0,218, 0, 2, 0,219, 0,
- 2, 0,220, 0, 2, 0, 19, 0, 2, 0, 17, 0, 2, 0,187, 0, 7, 0,221, 0, 7, 0,222, 0, 7, 0,223, 0, 7, 0,224, 0,
- 2, 0,225, 0, 2, 0,226, 0, 2, 0,227, 0, 2, 0,108, 0, 4, 0, 22, 0, 4, 0,105, 0, 4, 0,106, 0, 4, 0,107, 0,
- 7, 0,228, 0, 7, 0,229, 0, 7, 0,163, 0, 39, 0,230, 0, 30, 0, 63, 0, 40, 0,183, 0, 45, 0,231, 0, 47, 0,232, 0,
- 48, 0,233, 0, 29, 0,129, 0, 50, 0, 8, 0, 7, 0,234, 0, 7, 0,235, 0, 7, 0,151, 0, 4, 0, 19, 0, 7, 0,236, 0,
- 7, 0,237, 0, 7, 0,238, 0, 38, 0,239, 0, 51, 0, 60, 0, 26, 0, 30, 0, 2, 0, 17, 0, 2, 0,240, 0, 2, 0,153, 0,
- 2, 0,241, 0, 7, 0,156, 0, 7, 0,157, 0, 7, 0,158, 0, 7, 0,159, 0, 7, 0,242, 0, 7, 0,243, 0, 7, 0,244, 0,
- 7, 0,245, 0, 7, 0,246, 0, 7, 0,247, 0, 7, 0,248, 0, 4, 0, 53, 0, 52, 0,249, 0, 2, 0,250, 0, 2, 0,251, 0,
- 7, 0, 90, 0, 7, 0, 91, 0, 7, 0,252, 0, 7, 0,253, 0, 7, 0,254, 0, 2, 0,255, 0, 2, 0, 0, 1, 2, 0, 1, 1,
- 2, 0, 2, 1, 0, 0, 3, 1, 0, 0, 4, 1, 2, 0, 5, 1, 2, 0, 6, 1, 2, 0, 7, 1, 2, 0, 8, 1, 2, 0, 9, 1,
- 7, 0, 10, 1, 7, 0, 11, 1, 7, 0, 12, 1, 7, 0, 13, 1, 2, 0, 14, 1, 2, 0, 41, 0, 2, 0, 15, 1, 2, 0, 16, 1,
- 4, 0, 17, 1, 4, 0, 18, 1, 2, 0, 19, 1, 2, 0, 20, 1, 2, 0, 21, 1, 2, 0, 22, 1, 7, 0, 23, 1, 7, 0, 24, 1,
- 7, 0, 25, 1, 7, 0, 26, 1, 2, 0, 27, 1, 2, 0, 28, 1, 43, 0, 29, 1, 30, 0, 63, 0, 29, 0,129, 0, 33, 0,102, 0,
- 53, 0, 2, 0, 26, 0, 30, 0, 30, 0, 63, 0, 54, 0,124, 0, 26, 0, 30, 0, 2, 0,153, 0, 2, 0, 19, 0, 7, 0,156, 0,
- 7, 0,157, 0, 7, 0,158, 0, 7, 0, 30, 1, 7, 0, 31, 1, 7, 0, 32, 1, 7, 0, 33, 1, 7, 0, 34, 1, 7, 0, 35, 1,
- 7, 0, 36, 1, 7, 0, 37, 1, 7, 0, 38, 1, 7, 0, 39, 1, 7, 0, 40, 1, 7, 0, 41, 1, 7, 0, 42, 1, 7, 0, 43, 1,
- 7, 0, 44, 1, 7, 0, 45, 1, 7, 0, 46, 1, 7, 0, 47, 1, 7, 0, 48, 1, 7, 0, 49, 1, 7, 0, 50, 1, 7, 0, 51, 1,
- 7, 0, 52, 1, 7, 0, 53, 1, 7, 0, 54, 1, 7, 0, 55, 1, 7, 0, 56, 1, 2, 0, 57, 1, 2, 0, 58, 1, 2, 0, 59, 1,
- 0, 0, 60, 1, 0, 0, 61, 1, 7, 0, 62, 1, 7, 0, 63, 1, 2, 0, 64, 1, 2, 0, 65, 1, 7, 0, 66, 1, 7, 0, 67, 1,
- 7, 0, 68, 1, 7, 0, 69, 1, 2, 0, 70, 1, 2, 0, 41, 0, 4, 0,240, 0, 4, 0, 71, 1, 2, 0, 72, 1, 2, 0, 73, 1,
- 2, 0, 74, 1, 2, 0, 75, 1, 7, 0, 76, 1, 7, 0, 77, 1, 7, 0, 78, 1, 7, 0, 79, 1, 7, 0, 80, 1, 7, 0, 81, 1,
- 7, 0, 82, 1, 0, 0, 83, 1, 7, 0, 84, 1, 7, 0, 85, 1, 7, 0, 86, 1, 0, 0, 87, 1, 0, 0, 15, 1, 0, 0, 88, 1,
- 0, 0, 89, 1, 2, 0, 90, 1, 2, 0, 91, 1, 2, 0, 92, 1, 2, 0, 93, 1, 2, 0, 94, 1, 2, 0, 95, 1, 7, 0, 96, 1,
- 7, 0, 97, 1, 7, 0, 98, 1, 7, 0, 99, 1, 7, 0,100, 1, 2, 0,139, 0, 2, 0,140, 0, 47, 0,101, 1, 47, 0,102, 1,
- 0, 0,103, 1, 0, 0,104, 1, 0, 0,105, 1, 0, 0,106, 1, 2, 0,107, 1, 2, 0,251, 0, 7, 0,108, 1, 7, 0,109, 1,
- 43, 0, 29, 1, 55, 0,110, 1, 30, 0, 63, 0, 56, 0,111, 1, 29, 0,129, 0, 7, 0,112, 1, 7, 0,113, 1, 7, 0,114, 1,
- 7, 0,115, 1, 7, 0,116, 1, 2, 0,117, 1, 2, 0, 53, 0, 7, 0,118, 1, 7, 0,119, 1, 7, 0,120, 1, 7, 0,121, 1,
- 7, 0,122, 1, 7, 0,123, 1, 7, 0,124, 1, 7, 0,125, 1, 7, 0,126, 1, 2, 0,127, 1, 2, 0,128, 1, 7, 0,129, 1,
- 7, 0,130, 1, 7, 0,131, 1, 7, 0,132, 1, 7, 0,133, 1, 4, 0,134, 1, 4, 0,135, 1, 4, 0,136, 1, 33, 0,102, 0,
- 57, 0, 6, 0, 26, 0, 30, 0, 0, 0,137, 1, 7, 0,138, 1, 7, 0, 15, 0, 58, 0, 54, 0, 36, 0,128, 0, 59, 0, 26, 0,
- 59, 0, 0, 0, 59, 0, 1, 0, 60, 0,139, 1, 4, 0,140, 1, 4, 0,141, 1, 4, 0,142, 1, 4, 0,143, 1, 4, 0,144, 1,
- 4, 0,145, 1, 2, 0, 17, 0, 2, 0, 19, 0, 2, 0,146, 1, 2, 0,147, 1, 7, 0, 4, 0, 7, 0, 5, 0, 7, 0, 6, 0,
- 7, 0,148, 1, 7, 0,149, 1, 7, 0,150, 1, 7, 0,151, 1, 7, 0,152, 1, 7, 0,153, 1, 7, 0,154, 1, 7, 0, 22, 0,
- 7, 0,155, 1, 7, 0,156, 1, 61, 0, 15, 0, 26, 0, 30, 0, 60, 0,139, 1, 11, 0,157, 1, 11, 0,158, 1, 30, 0, 63, 0,
- 54, 0,159, 1, 2, 0, 19, 0, 2, 0,160, 1, 4, 0,152, 0, 7, 0,234, 0, 7, 0,151, 0, 7, 0,235, 0, 7, 0,161, 1,
- 7, 0,162, 1, 7, 0,163, 1, 62, 0, 10, 0, 7, 0,164, 1, 7, 0,165, 1, 7, 0,166, 1, 7, 0,167, 1, 2, 0,168, 1,
- 2, 0,169, 1, 0, 0,170, 1, 0, 0,171, 1, 0, 0,172, 1, 0, 0,173, 1, 63, 0, 7, 0, 7, 0,174, 1, 7, 0,165, 1,
- 7, 0,166, 1, 2, 0,170, 1, 2, 0,173, 1, 7, 0,167, 1, 7, 0, 15, 0, 64, 0, 21, 0, 64, 0, 0, 0, 64, 0, 1, 0,
- 2, 0, 17, 0, 2, 0,175, 1, 2, 0,173, 1, 2, 0, 19, 0, 2, 0,176, 1, 2, 0,177, 1, 2, 0,178, 1, 2, 0,179, 1,
- 2, 0,180, 1, 2, 0,181, 1, 2, 0,182, 1, 2, 0,183, 1, 7, 0,184, 1, 7, 0,185, 1, 63, 0,186, 1, 62, 0,187, 1,
- 2, 0,188, 1, 2, 0, 15, 0, 4, 0,189, 1, 65, 0, 5, 0, 2, 0,190, 1, 2, 0,175, 1, 0, 0, 19, 0, 0, 0, 15, 0,
- 2, 0, 53, 0, 66, 0, 4, 0, 7, 0, 4, 0, 7, 0, 5, 0, 7, 0, 7, 0, 7, 0,191, 1, 67, 0, 57, 0, 26, 0, 30, 0,
- 60, 0,139, 1, 11, 0,192, 1, 11, 0,158, 1, 38, 0,193, 1, 38, 0,194, 1, 38, 0,195, 1, 30, 0, 63, 0, 68, 0,196, 1,
- 32, 0,197, 1, 54, 0,159, 1, 11, 0,198, 1, 7, 0,234, 0, 7, 0,151, 0, 7, 0,235, 0, 4, 0,152, 0, 2, 0,199, 1,
- 2, 0,160, 1, 2, 0, 19, 0, 2, 0,200, 1, 7, 0,201, 1, 7, 0,202, 1, 7, 0,203, 1, 2, 0,178, 1, 2, 0,179, 1,
- 2, 0,204, 1, 2, 0,205, 1, 4, 0, 53, 0, 2, 0, 22, 0, 2, 0, 77, 0, 2, 0, 48, 0, 2, 0,206, 1, 7, 0,207, 1,
- 7, 0,208, 1, 7, 0,209, 1, 7, 0,210, 1, 7, 0,211, 1, 7, 0,212, 1, 7, 0,213, 1, 7, 0,214, 1, 7, 0,215, 1,
- 7, 0,216, 1, 0, 0,217, 1, 0, 0,218, 1, 57, 0,219, 1, 57, 0,220, 1, 57, 0,221, 1, 57, 0,222, 1, 4, 0,223, 1,
- 4, 0,224, 1, 4, 0,225, 1, 4, 0, 15, 0, 66, 0,226, 1, 4, 0,227, 1, 4, 0,228, 1, 65, 0,229, 1, 65, 0,230, 1,
- 69, 0, 6, 0, 38, 0,239, 0, 2, 0, 45, 0, 2, 0, 50, 0, 2, 0, 17, 0, 2, 0, 19, 0, 0, 0,231, 1, 70, 0, 21, 0,
- 70, 0, 0, 0, 70, 0, 1, 0, 63, 0,186, 1, 62, 0,187, 1, 23, 0,232, 1, 23, 0,233, 1, 2, 0, 45, 0, 2, 0, 50, 0,
- 2, 0,234, 1, 2, 0,235, 1, 2, 0,236, 1, 2, 0,237, 1, 2, 0, 19, 0, 2, 0,161, 0, 7, 0, 10, 0, 7, 0, 11, 0,
- 4, 0,238, 1, 7, 0,239, 1, 7, 0,240, 1, 7, 0, 49, 0, 69, 0,241, 1, 71, 0, 39, 0, 26, 0, 30, 0, 60, 0,139, 1,
- 11, 0,242, 1, 30, 0, 63, 0, 32, 0,197, 1, 54, 0,159, 1, 72, 0,243, 1, 73, 0,244, 1, 74, 0,245, 1, 75, 0,246, 1,
- 76, 0,247, 1, 77, 0,248, 1, 78, 0,249, 1, 79, 0,250, 1, 71, 0,251, 1, 80, 0,252, 1, 81, 0,253, 1, 81, 0,254, 1,
- 81, 0,255, 1, 4, 0,235, 1, 4, 0, 0, 2, 4, 0, 1, 2, 4, 0, 2, 2, 4, 0, 3, 2, 4, 0,152, 0, 7, 0,234, 0,
- 7, 0,151, 0, 7, 0,235, 0, 7, 0, 4, 2, 7, 0, 15, 0, 2, 0, 5, 2, 2, 0, 19, 0, 2, 0, 6, 2, 2, 0, 7, 2,
- 2, 0,160, 1, 2, 0, 8, 2, 82, 0, 9, 2, 83, 0, 10, 2, 9, 0,138, 0, 74, 0, 8, 0, 9, 0, 11, 2, 7, 0, 12, 2,
- 4, 0, 13, 2, 0, 0, 19, 0, 0, 0, 14, 2, 2, 0,240, 0, 2, 0, 15, 2, 2, 0, 16, 2, 72, 0, 8, 0, 4, 0, 17, 2,
- 4, 0, 18, 2, 4, 0, 19, 2, 4, 0, 20, 2, 0, 0, 15, 0, 0, 0,175, 1, 0, 0, 21, 2, 0, 0, 19, 0, 76, 0, 5, 0,
- 4, 0, 17, 2, 4, 0, 18, 2, 0, 0, 22, 2, 0, 0, 15, 0, 2, 0, 19, 0, 84, 0, 2, 0, 4, 0, 23, 2, 7, 0,166, 1,
- 77, 0, 3, 0, 84, 0, 24, 2, 4, 0, 25, 2, 4, 0, 19, 0, 75, 0, 4, 0, 7, 0, 26, 2, 2, 0, 27, 2, 0, 0, 19, 0,
- 0, 0,175, 1, 78, 0, 4, 0, 0, 0,181, 0, 0, 0,156, 0, 0, 0,157, 0, 0, 0,158, 0, 79, 0, 1, 0, 7, 0, 28, 2,
- 80, 0, 2, 0, 4, 0, 29, 2, 4, 0, 17, 0, 73, 0, 7, 0, 7, 0, 12, 2, 40, 0, 11, 2, 0, 0, 19, 0, 0, 0, 14, 2,
- 2, 0,240, 0, 2, 0, 15, 2, 2, 0, 16, 2, 85, 0, 1, 0, 7, 0, 30, 2, 86, 0, 1, 0, 4, 0, 31, 2, 87, 0, 1, 0,
- 0, 0, 32, 2, 88, 0, 1, 0, 7, 0, 12, 2, 89, 0, 4, 0, 7, 0,181, 0, 7, 0,156, 0, 7, 0,157, 0, 7, 0,158, 0,
- 90, 0, 1, 0, 89, 0, 13, 2, 91, 0, 5, 0, 4, 0, 33, 2, 4, 0, 34, 2, 0, 0, 19, 0, 0, 0,175, 1, 0, 0, 35, 2,
- 92, 0, 2, 0, 4, 0, 36, 2, 4, 0, 34, 2, 93, 0, 14, 0, 93, 0, 0, 0, 93, 0, 1, 0, 91, 0, 37, 2, 90, 0, 38, 2,
- 92, 0, 39, 2, 0, 0, 40, 2, 11, 0, 41, 2, 11, 0, 42, 2, 94, 0, 43, 2, 4, 0,235, 1, 4, 0, 1, 2, 4, 0, 0, 2,
- 4, 0, 15, 0, 75, 0, 44, 2, 82, 0, 14, 0, 11, 0, 45, 2, 75, 0, 44, 2, 0, 0, 46, 2, 0, 0, 47, 2, 0, 0, 48, 2,
- 0, 0, 49, 2, 0, 0, 50, 2, 0, 0, 51, 2, 0, 0, 52, 2, 0, 0, 15, 0, 81, 0,253, 1, 81, 0,255, 1, 2, 0, 53, 2,
- 0, 0, 54, 2, 83, 0, 8, 0, 4, 0, 55, 2, 4, 0, 56, 2, 72, 0, 57, 2, 76, 0, 58, 2, 4, 0, 1, 2, 4, 0, 0, 2,
- 4, 0,235, 1, 4, 0, 15, 0, 95, 0, 6, 0, 95, 0, 0, 0, 95, 0, 1, 0, 4, 0, 17, 0, 4, 0,240, 0, 0, 0, 16, 0,
- 0, 0, 59, 2, 96, 0, 7, 0, 95, 0, 60, 2, 2, 0, 61, 2, 2, 0, 45, 2, 2, 0, 62, 2, 2, 0, 75, 0, 9, 0, 63, 2,
- 9, 0, 64, 2, 97, 0, 3, 0, 95, 0, 60, 2, 38, 0,143, 0, 0, 0, 16, 0, 98, 0, 5, 0, 95, 0, 60, 2, 38, 0,143, 0,
- 0, 0, 16, 0, 2, 0, 65, 2, 0, 0, 66, 2, 99, 0, 5, 0, 95, 0, 60, 2, 7, 0, 67, 2, 7, 0, 68, 2, 4, 0, 69, 2,
- 4, 0, 70, 2,100, 0, 13, 0, 95, 0, 60, 2, 38, 0, 71, 2, 38, 0, 72, 2, 38, 0, 73, 2, 38, 0, 74, 2, 7, 0, 75, 2,
- 7, 0, 76, 2, 7, 0, 68, 2, 7, 0, 77, 2, 4, 0, 78, 2, 4, 0, 79, 2, 4, 0, 75, 0, 4, 0, 80, 2,101, 0, 5, 0,
- 95, 0, 60, 2, 2, 0, 81, 2, 2, 0, 19, 0, 7, 0, 82, 2, 38, 0, 83, 2,102, 0, 3, 0, 95, 0, 60, 2, 7, 0, 84, 2,
- 4, 0, 75, 0,103, 0, 11, 0, 95, 0, 60, 2, 44, 0, 85, 2, 7, 0, 86, 2, 4, 0, 87, 2, 0, 0, 88, 2, 7, 0, 89, 2,
- 4, 0, 90, 2, 38, 0, 91, 2, 0, 0, 92, 2, 4, 0, 93, 2, 4, 0, 15, 0,104, 0, 10, 0, 95, 0, 60, 2, 38, 0, 94, 2,
- 40, 0, 95, 2, 4, 0, 75, 0, 4, 0, 96, 2, 7, 0, 97, 2, 7, 0, 98, 2, 0, 0, 92, 2, 4, 0, 93, 2, 4, 0, 15, 0,
-105, 0, 3, 0, 95, 0, 60, 2, 7, 0, 99, 2, 4, 0,100, 2,106, 0, 5, 0, 95, 0, 60, 2, 7, 0,101, 2, 0, 0, 88, 2,
- 2, 0, 19, 0, 2, 0,102, 2,107, 0, 8, 0, 95, 0, 60, 2, 38, 0,143, 0, 7, 0,101, 2, 7, 0,167, 1, 7, 0, 86, 0,
- 0, 0, 88, 2, 2, 0, 19, 0, 2, 0, 17, 0,108, 0, 19, 0, 95, 0, 60, 2, 38, 0,103, 2, 0, 0, 88, 2, 44, 0, 85, 2,
- 38, 0, 91, 2, 2, 0, 19, 0, 2, 0, 15, 0, 7, 0,104, 2, 7, 0,105, 2, 7, 0,106, 2, 7, 0,201, 1, 7, 0,107, 2,
- 7, 0,108, 2, 7, 0,109, 2, 4, 0, 90, 2, 4, 0, 93, 2, 0, 0, 92, 2, 7, 0,110, 2, 7, 0,111, 2,109, 0, 7, 0,
- 95, 0, 60, 2, 2, 0,112, 2, 2, 0,113, 2, 4, 0, 53, 0, 38, 0,143, 0, 7, 0,114, 2, 0, 0, 88, 2,110, 0, 9, 0,
- 95, 0, 60, 2, 38, 0,143, 0, 7, 0,115, 2, 7, 0,116, 2, 7, 0,117, 2, 4, 0,118, 2, 4, 0,119, 2, 7, 0,120, 2,
- 0, 0, 16, 0,111, 0, 1, 0, 95, 0, 60, 2,112, 0, 4, 0, 95, 0, 60, 2, 38, 0,143, 0, 4, 0,121, 2, 4, 0, 15, 0,
-113, 0, 2, 0, 4, 0,122, 2, 7, 0,166, 1,114, 0, 2, 0, 4, 0,106, 0, 4, 0,123, 2,115, 0, 20, 0, 95, 0, 60, 2,
- 38, 0,143, 0, 0, 0, 88, 2, 2, 0,124, 2, 2, 0,125, 2, 2, 0, 19, 0, 2, 0, 15, 0, 7, 0,126, 2, 7, 0,127, 2,
- 4, 0,235, 1, 4, 0,128, 2,114, 0,129, 2,113, 0,130, 2, 4, 0,131, 2, 4, 0,132, 2, 4, 0,133, 2, 4, 0,123, 2,
- 7, 0,134, 2, 7, 0,135, 2, 7, 0,136, 2,116, 0, 5, 0, 95, 0, 60, 2,117, 0,137, 2,118, 0,138, 2, 2, 0, 19, 0,
- 2, 0,139, 2,119, 0, 5, 0, 95, 0, 60, 2, 38, 0,239, 0, 2, 0,140, 2, 2, 0, 19, 0, 2, 0,141, 2,120, 0, 5, 0,
- 95, 0, 60, 2, 4, 0,142, 2, 2, 0, 19, 0, 2, 0,143, 2, 7, 0,144, 2,121, 0, 24, 0, 26, 0, 30, 0, 2, 0,176, 1,
- 2, 0,177, 1, 2, 0,145, 2, 2, 0, 19, 0, 2, 0,146, 2, 2, 0,147, 2, 2, 0,148, 2, 2, 0, 53, 0, 0, 0,149, 2,
- 0, 0,150, 2, 0, 0,151, 2, 0, 0, 17, 0, 4, 0, 15, 0, 7, 0,152, 2, 7, 0,153, 2, 7, 0,154, 2, 7, 0,155, 2,
- 7, 0,156, 2, 7, 0,157, 2, 63, 0,158, 2, 30, 0, 63, 0, 32, 0,197, 1, 77, 0,248, 1,122, 0, 3, 0,122, 0, 0, 0,
-122, 0, 1, 0, 0, 0, 16, 0, 60, 0, 3, 0, 7, 0,159, 2, 4, 0, 19, 0, 4, 0, 15, 0, 38, 0,104, 0, 26, 0, 30, 0,
- 2, 0, 17, 0, 2, 0,160, 2, 4, 0,161, 2, 4, 0,162, 2, 4, 0,163, 2, 0, 0,164, 2, 38, 0, 36, 0, 38, 0,165, 2,
- 38, 0,166, 2, 38, 0,167, 2, 38, 0,168, 2, 30, 0, 63, 0, 68, 0,196, 1, 60, 0,139, 1,123, 0,169, 2,124, 0,170, 2,
- 9, 0, 54, 0, 11, 0,171, 2, 11, 0,242, 1, 11, 0,158, 1, 11, 0,172, 2, 11, 0,173, 2, 54, 0,159, 1, 7, 0,234, 0,
- 7, 0,174, 2, 7, 0,175, 2, 7, 0,151, 0, 7, 0,176, 2, 7, 0,235, 0, 7, 0,177, 2, 7, 0,148, 1, 7, 0,178, 2,
- 7, 0,179, 2, 7, 0,115, 2, 7, 0,180, 2, 7, 0,185, 0, 4, 0,181, 2, 2, 0, 19, 0, 2, 0,182, 2, 2, 0,183, 2,
- 2, 0,184, 2, 2, 0,185, 2, 2, 0,186, 2, 2, 0,187, 2, 2, 0,188, 2, 2, 0,189, 2, 2, 0,190, 2, 2, 0,191, 2,
- 2, 0,192, 2, 4, 0,193, 2, 4, 0,194, 2, 4, 0,195, 2, 4, 0,196, 2, 7, 0,197, 2, 7, 0,198, 2, 7, 0,199, 2,
- 7, 0,200, 2, 7, 0,201, 2, 7, 0,202, 2, 7, 0,203, 2, 7, 0,204, 2, 0, 0,205, 2, 0, 0,206, 2, 0, 0,160, 1,
- 0, 0,207, 2, 0, 0,208, 2, 0, 0,209, 2, 7, 0,210, 2, 33, 0,102, 0, 11, 0,211, 2, 11, 0,212, 2, 11, 0,213, 2,
- 11, 0,214, 2, 9, 0,215, 2, 7, 0,216, 2, 2, 0, 29, 2, 2, 0,217, 2, 7, 0, 13, 2, 4, 0,218, 2, 4, 0,219, 2,
- 2, 0,220, 2, 2, 0,192, 0, 7, 0,221, 2, 11, 0,222, 2, 11, 0,223, 2, 11, 0,224, 2, 11, 0,225, 2,125, 0,226, 2,
-126, 0,227, 2, 56, 0,228, 2, 2, 0,229, 2, 2, 0,230, 2, 2, 0,231, 2, 2, 0,232, 2, 7, 0, 5, 2, 2, 0,233, 2,
- 2, 0,234, 2,127, 0,235, 2,118, 0,236, 2,118, 0,237, 2, 4, 0,238, 2, 4, 0, 15, 0, 9, 0,138, 0,128, 0, 14, 0,
-128, 0, 0, 0,128, 0, 1, 0, 38, 0, 36, 0, 7, 0,115, 2, 7, 0,236, 0, 7, 0,116, 2, 7, 0,117, 2, 0, 0, 16, 0,
- 4, 0,118, 2, 4, 0,119, 2, 4, 0,239, 2, 2, 0, 17, 0, 2, 0,240, 2, 7, 0,120, 2,125, 0, 33, 0, 2, 0,241, 2,
- 2, 0,242, 2, 2, 0, 19, 0, 2, 0,117, 2, 7, 0,243, 2, 7, 0,244, 2, 7, 0,245, 2, 7, 0,246, 2, 7, 0,247, 2,
- 7, 0,248, 2, 7, 0,249, 2, 7, 0,250, 2, 7, 0,251, 2, 7, 0,252, 2, 7, 0,253, 2, 7, 0,254, 2, 7, 0,255, 2,
- 7, 0, 0, 3, 7, 0, 1, 3, 7, 0, 2, 3, 7, 0, 3, 3, 7, 0, 4, 3, 7, 0, 5, 3, 7, 0, 6, 3, 7, 0, 7, 3,
- 7, 0, 8, 3, 7, 0, 9, 3, 7, 0, 10, 3, 2, 0, 11, 3, 2, 0, 12, 3, 2, 0, 13, 3, 2, 0, 14, 3, 44, 0,144, 0,
-129, 0, 1, 0, 7, 0,174, 1,126, 0, 41, 0,117, 0, 15, 3, 4, 0, 16, 3, 4, 0, 17, 3,130, 0, 18, 3,131, 0, 19, 3,
- 7, 0,198, 2, 7, 0, 20, 3, 7, 0, 21, 3, 7, 0, 22, 3, 7, 0, 23, 3, 7, 0, 24, 3, 7, 0, 25, 3, 7, 0, 26, 3,
- 7, 0, 27, 3, 7, 0, 28, 3, 7, 0, 29, 3, 2, 0, 30, 3, 2, 0, 31, 3, 7, 0, 32, 3, 7, 0, 33, 3, 4, 0,107, 0,
- 4, 0, 34, 3, 4, 0, 35, 3, 2, 0, 36, 3, 2, 0, 37, 3,129, 0, 38, 3, 4, 0, 39, 3, 4, 0, 65, 0, 7, 0, 40, 3,
- 7, 0, 41, 3, 7, 0, 42, 3, 7, 0, 43, 3, 2, 0, 44, 3, 2, 0, 45, 3, 2, 0, 46, 3, 2, 0, 47, 3, 2, 0, 48, 3,
- 2, 0,251, 0, 2, 0,234, 2, 2, 0, 49, 3,132, 0, 50, 3,127, 0, 40, 0, 2, 0, 17, 0, 2, 0, 51, 3, 2, 0, 52, 3,
- 2, 0, 53, 3, 7, 0, 54, 3, 2, 0, 55, 3, 2, 0, 56, 3, 7, 0, 57, 3, 2, 0, 58, 3, 2, 0, 59, 3, 7, 0, 60, 3,
- 7, 0, 61, 3, 7, 0, 62, 3, 7, 0, 63, 3, 7, 0, 64, 3, 7, 0, 65, 3, 4, 0, 66, 3, 7, 0, 67, 3, 7, 0, 68, 3,
- 7, 0, 69, 3, 71, 0, 70, 3, 71, 0, 71, 3, 71, 0, 72, 3, 0, 0, 73, 3, 7, 0, 74, 3, 7, 0, 75, 3, 30, 0, 63, 0,
- 2, 0, 76, 3, 0, 0, 77, 3, 0, 0, 78, 3, 7, 0, 79, 3, 4, 0, 80, 3, 7, 0, 81, 3, 7, 0, 82, 3, 4, 0, 83, 3,
- 4, 0, 84, 3, 7, 0, 85, 3, 7, 0, 86, 3, 7, 0, 87, 3, 75, 0, 88, 3,133, 0, 63, 0, 26, 0, 30, 0, 2, 0,153, 0,
- 2, 0,241, 0, 2, 0, 15, 1, 2, 0, 89, 3, 7, 0, 90, 3, 7, 0, 91, 3, 7, 0, 92, 3, 7, 0, 93, 3, 7, 0, 94, 3,
- 7, 0, 95, 3, 7, 0, 96, 3, 7, 0, 97, 3, 7, 0, 36, 1, 7, 0, 38, 1, 7, 0, 37, 1, 7, 0, 98, 3, 4, 0, 99, 3,
- 7, 0,100, 3, 7, 0,101, 3, 7, 0,102, 3, 7, 0,103, 3, 7, 0,104, 3, 7, 0,105, 3, 7, 0,106, 3, 2, 0,107, 3,
- 2, 0,240, 0, 4, 0,108, 3, 7, 0,109, 3, 7, 0,110, 3, 7, 0,111, 3, 7, 0,112, 3, 7, 0,113, 3, 7, 0,114, 3,
- 7, 0,115, 3, 7, 0,116, 3, 7, 0,117, 3, 7, 0,118, 3, 7, 0,119, 3, 7, 0,120, 3, 2, 0,121, 3, 2, 0,122, 3,
- 2, 0,123, 3, 2, 0,124, 3, 7, 0,125, 3, 7, 0,126, 3, 7, 0,127, 3, 7, 0,128, 3, 2, 0,129, 3, 2, 0,130, 3,
- 2, 0,131, 3, 2, 0,132, 3, 7, 0,133, 3, 7, 0,134, 3, 7, 0,135, 3, 2, 0,136, 3, 2, 0,137, 3, 7, 0,138, 3,
- 7, 0,139, 3, 30, 0, 63, 0, 43, 0, 29, 1, 29, 0,129, 0, 33, 0,102, 0,134, 0, 16, 0, 2, 0,140, 3, 2, 0,141, 3,
- 2, 0,142, 3, 2, 0, 19, 0, 2, 0,143, 3, 2, 0,144, 3, 2, 0,145, 3, 2, 0,146, 3, 2, 0,147, 3, 2, 0,148, 3,
- 2, 0,149, 3, 2, 0,150, 3, 4, 0,151, 3, 7, 0,152, 3, 7, 0,153, 3, 7, 0,154, 3,135, 0, 8, 0,135, 0, 0, 0,
-135, 0, 1, 0, 4, 0,181, 2, 4, 0,155, 3, 4, 0, 19, 0, 2, 0,156, 3, 2, 0,157, 3, 38, 0,143, 0,136, 0, 13, 0,
- 9, 0,158, 3, 9, 0,159, 3, 4, 0,160, 3, 4, 0,161, 3, 4, 0,162, 3, 4, 0,163, 3, 4, 0,164, 3, 4, 0,165, 3,
- 4, 0,166, 3, 4, 0,167, 3, 4, 0,168, 3, 4, 0, 15, 0, 0, 0,169, 3,137, 0, 5, 0, 9, 0,170, 3, 9, 0,171, 3,
- 4, 0,172, 3, 4, 0, 53, 0, 0, 0,173, 3,138, 0, 12, 0, 4, 0, 17, 0, 4, 0,174, 3, 4, 0,175, 3, 4, 0,176, 3,
- 4, 0,177, 3, 4, 0,178, 3, 4, 0, 75, 0, 4, 0,179, 3, 4, 0,180, 3, 4, 0,181, 3, 4, 0,182, 3, 4, 0,183, 3,
-139, 0, 4, 0, 4, 0,184, 3, 7, 0,185, 3, 2, 0, 19, 0, 2, 0,186, 3,140, 0, 9, 0,140, 0, 0, 0,140, 0, 1, 0,
- 0, 0, 16, 0, 54, 0,187, 3, 56, 0,188, 3, 4, 0,181, 2, 4, 0,189, 3, 4, 0,190, 3, 4, 0,191, 3,141, 0,107, 0,
-136, 0,192, 3,137, 0,193, 3,138, 0,194, 3, 4, 0,195, 3, 4, 0,107, 0, 4, 0, 34, 3, 4, 0,196, 3, 4, 0,197, 3,
- 4, 0,198, 3, 4, 0,199, 3, 2, 0, 19, 0, 2, 0,200, 3, 7, 0,198, 2, 7, 0,201, 3, 7, 0,202, 3, 7, 0,203, 3,
- 7, 0,204, 3, 7, 0,205, 3, 2, 0,206, 3, 2, 0,207, 3, 2, 0,208, 3, 2, 0,209, 3, 2, 0,191, 0, 2, 0,210, 3,
- 2, 0,211, 3, 2, 0, 14, 3, 2, 0,212, 3, 2, 0,213, 3, 2, 0, 2, 1, 2, 0, 86, 0, 2, 0,214, 3, 2, 0,215, 3,
- 2, 0,216, 3, 2, 0,217, 3, 2, 0,218, 3, 2, 0,219, 3, 2, 0,220, 3, 2, 0,221, 3, 2, 0,222, 3, 2, 0,223, 3,
- 2, 0,224, 3, 2, 0, 3, 1, 2, 0,225, 3, 2, 0,226, 3, 4, 0,240, 0, 2, 0,227, 3, 2, 0,228, 3, 2, 0,229, 3,
- 2, 0,230, 3, 2, 0,231, 3, 2, 0,232, 3, 2, 0,233, 3, 23, 0,234, 3, 23, 0,235, 3, 22, 0,236, 3, 11, 0,237, 3,
- 2, 0,238, 3, 2, 0, 15, 0, 7, 0,239, 3, 7, 0,240, 3, 7, 0,241, 3, 7, 0,242, 3, 7, 0,243, 3, 7, 0,244, 3,
- 7, 0,245, 3, 2, 0,246, 3, 2, 0,247, 3, 2, 0,248, 3, 2, 0,249, 3, 2, 0,250, 3, 2, 0,251, 3, 2, 0,252, 3,
- 2, 0,253, 3, 2, 0,254, 3, 2, 0,255, 3, 2, 0, 0, 4, 2, 0, 1, 4, 2, 0, 2, 4, 2, 0, 3, 4, 4, 0, 4, 4,
- 4, 0, 5, 4, 4, 0, 6, 4, 4, 0, 7, 4, 4, 0, 8, 4, 7, 0, 9, 4, 4, 0, 10, 4, 4, 0, 11, 4, 4, 0, 12, 4,
- 4, 0, 13, 4, 7, 0, 14, 4, 7, 0, 15, 4, 7, 0, 16, 4, 7, 0, 17, 4, 7, 0, 18, 4, 7, 0, 19, 4, 7, 0, 20, 4,
- 7, 0, 21, 4, 7, 0, 22, 4, 0, 0, 23, 4, 0, 0, 24, 4, 0, 0, 25, 4, 4, 0, 26, 4, 2, 0, 27, 4, 2, 0,251, 0,
- 0, 0, 28, 4, 7, 0, 29, 4, 7, 0, 30, 4,142, 0, 5, 0, 7, 0, 31, 4, 0, 0, 17, 0, 0, 0, 41, 0, 0, 0, 53, 0,
- 0, 0,251, 0,143, 0, 5, 0,143, 0, 0, 0,143, 0, 1, 0, 4, 0, 32, 4, 0, 0, 33, 4, 4, 0, 19, 0,144, 0, 4, 0,
-145, 0, 34, 4, 2, 0, 19, 0, 2, 0, 35, 4, 4, 0,251, 0,146, 0, 4, 0, 2, 0, 86, 0, 2, 0, 86, 2, 2, 0, 36, 4,
- 2, 0, 37, 4,147, 0, 7, 0, 2, 0, 19, 0, 2, 0, 38, 4, 2, 0, 39, 4, 2, 0, 40, 4,146, 0, 41, 4, 7, 0, 42, 4,
- 4, 0, 43, 4,148, 0, 29, 0, 2, 0, 44, 4, 2, 0, 45, 4, 7, 0, 46, 4, 7, 0, 47, 4, 2, 0, 36, 4, 2, 0, 48, 4,
- 7, 0, 49, 4, 7, 0, 50, 4, 2, 0, 51, 4, 2, 0, 52, 4, 2, 0, 53, 4, 2, 0, 54, 4, 7, 0, 55, 4, 7, 0, 56, 4,
- 2, 0, 57, 4, 2, 0, 58, 4, 2, 0, 59, 4, 2, 0, 53, 0,144, 0, 60, 4,147, 0, 61, 4, 7, 0, 62, 4, 7, 0, 63, 4,
- 0, 0, 64, 4, 0, 0, 65, 4, 0, 0, 66, 4, 0, 0, 67, 4, 0, 0, 68, 4, 0, 0, 69, 4, 0, 0, 70, 4,149, 0, 6, 0,
- 2, 0, 86, 0, 0, 0, 86, 2, 0, 0, 71, 4, 0, 0, 72, 4, 0, 0, 73, 4, 0, 0, 35, 2,150, 0, 21, 0,151, 0, 74, 4,
- 43, 0, 29, 1,149, 0, 75, 4,149, 0, 76, 4,149, 0, 77, 4,149, 0, 78, 4,149, 0, 79, 4,149, 0, 80, 4,149, 0, 81, 4,
- 2, 0, 82, 4, 2, 0, 15, 1, 2, 0, 83, 4, 2, 0,207, 1, 0, 0, 84, 4, 0, 0, 85, 4, 0, 0, 86, 4, 0, 0, 87, 4,
- 0, 0, 75, 0, 0, 0, 88, 4, 0, 0, 89, 4, 0, 0, 90, 4,152, 0, 40, 0, 26, 0, 30, 0, 38, 0, 91, 4,133, 0, 92, 4,
-152, 0, 93, 4, 40, 0,183, 0, 11, 0, 94, 4,135, 0, 95, 4, 7, 0, 96, 4, 7, 0, 97, 4, 7, 0, 98, 4, 7, 0, 99, 4,
- 4, 0,181, 2, 7, 0,100, 4, 2, 0,101, 4, 2, 0,102, 4, 2, 0,103, 4, 2, 0,104, 4, 2, 0, 49, 3, 2, 0,105, 4,
- 2, 0,106, 4, 2, 0, 89, 1, 55, 0,110, 1, 9, 0,107, 4,134, 0,108, 4,142, 0,109, 4,148, 0,110, 4,141, 0,156, 0,
-139, 0,111, 4, 33, 0,102, 0, 11, 0,112, 4, 2, 0,113, 4, 2, 0, 41, 0, 2, 0,114, 4, 2, 0,115, 4,153, 0,116, 4,
- 2, 0,117, 4, 2, 0,118, 4, 2, 0,234, 2, 2, 0,192, 0,150, 0,119, 4,154, 0, 9, 0, 40, 0,183, 0, 39, 0,230, 0,
- 7, 0,214, 1, 7, 0,215, 1, 7, 0, 86, 0, 7, 0,120, 4, 7, 0,121, 4, 2, 0,122, 4, 2, 0,123, 4,155, 0, 68, 0,
-156, 0, 0, 0,156, 0, 1, 0, 4, 0,124, 4, 7, 0,125, 4,157, 0,126, 4, 2, 0,127, 4, 7, 0,128, 4, 7, 0,129, 4,
- 7, 0,130, 4, 7, 0,131, 4, 7, 0,132, 4, 7, 0,133, 4, 7, 0,134, 4, 7, 0,243, 0, 7, 0,135, 4, 7, 0, 40, 0,
- 2, 0,136, 4, 2, 0, 73, 4, 38, 0, 91, 4, 38, 0,137, 4,154, 0,138, 4,155, 0,139, 4,158, 0,140, 4,159, 0,141, 4,
-160, 0,142, 4, 0, 0,143, 4, 2, 0,142, 3, 2, 0,144, 4, 4, 0,181, 2, 4, 0,145, 4, 2, 0,146, 4, 2, 0,147, 4,
- 2, 0,148, 4, 0, 0,149, 4, 0, 0, 41, 0, 7, 0, 92, 0, 7, 0,150, 4, 7, 0,151, 4, 7, 0,152, 4, 7, 0,153, 4,
- 7, 0,154, 4, 7, 0,155, 4, 7, 0,156, 4, 7, 0,150, 0, 7, 0, 96, 4, 2, 0,157, 4, 2, 0,158, 4, 2, 0,159, 4,
- 2, 0,160, 4, 2, 0,114, 0, 2, 0, 83, 4, 2, 0,161, 4, 2, 0,162, 4, 2, 0,163, 4, 2, 0,164, 4, 7, 0,165, 4,
- 7, 0,166, 4, 60, 0,167, 4, 11, 0,168, 4, 2, 0,169, 4, 2, 0, 14, 2, 2, 0,170, 4, 2, 0, 19, 0, 2, 0,171, 4,
- 2, 0,172, 4, 2, 0,251, 0, 2, 0, 53, 0, 9, 0,173, 4,161, 0, 19, 0, 23, 0, 35, 0, 23, 0, 44, 0, 22, 0,174, 4,
- 22, 0,175, 4, 22, 0,176, 4, 7, 0,177, 4, 7, 0,178, 4, 7, 0,179, 4, 7, 0,180, 4, 2, 0,181, 4, 2, 0,182, 4,
- 2, 0,183, 4, 2, 0,184, 4, 2, 0,185, 4, 2, 0,186, 4, 4, 0, 19, 0, 7, 0,187, 4, 2, 0,147, 4, 0, 0, 66, 2,
-156, 0, 6, 0,156, 0, 0, 0,156, 0, 1, 0, 4, 0,124, 4, 7, 0,125, 4,157, 0,126, 4, 2, 0,127, 4,162, 0, 6, 0,
-156, 0, 0, 0,156, 0, 1, 0, 4, 0,124, 4, 7, 0,125, 4,157, 0,126, 4, 2, 0,127, 4,163, 0, 26, 0,156, 0, 0, 0,
-156, 0, 1, 0, 4, 0,124, 4, 7, 0,125, 4,157, 0,126, 4, 2, 0,127, 4, 4, 0,188, 4, 4, 0, 53, 0,161, 0,189, 4,
- 9, 0,190, 4, 11, 0,191, 4, 30, 0, 63, 0, 26, 0, 64, 0, 0, 0,192, 4, 0, 0,193, 4, 2, 0,194, 4, 2, 0,195, 4,
- 2, 0,196, 4, 2, 0,197, 4, 2, 0, 46, 0, 2, 0, 45, 0, 2, 0,114, 0, 2, 0,198, 4, 4, 0, 19, 0, 7, 0,199, 4,
- 23, 0, 35, 0,164, 0, 29, 0,156, 0, 0, 0,156, 0, 1, 0, 4, 0,124, 4, 7, 0,125, 4,157, 0,126, 4,158, 0,140, 4,
- 2, 0,127, 4, 2, 0,200, 4, 2, 0,201, 4, 2, 0,202, 4, 2, 0,203, 4,161, 0,189, 4, 2, 0,204, 4, 2, 0,114, 0,
- 2, 0,195, 4, 2, 0,205, 4, 9, 0,206, 4, 2, 0, 83, 4, 0, 0,207, 4, 0, 0,208, 4, 2, 0,209, 4, 2, 0,210, 4,
- 2, 0,190, 2, 2, 0,211, 4, 2, 0,212, 4, 0, 0, 15, 0, 0, 0, 19, 0, 0, 0, 15, 1, 0, 0,213, 4,165, 0, 15, 0,
-156, 0, 0, 0,156, 0, 1, 0, 4, 0,124, 4, 7, 0,125, 4,157, 0,126, 4, 2, 0,127, 4,161, 0,189, 4, 7, 0,214, 1,
- 7, 0,215, 1, 2, 0,204, 4, 2, 0,120, 4, 2, 0,214, 4, 2, 0, 53, 0, 4, 0, 19, 0, 4, 0, 15, 0,166, 0, 33, 0,
-156, 0, 0, 0,156, 0, 1, 0, 4, 0,124, 4, 7, 0,125, 4,157, 0,126, 4, 2, 0,127, 4,167, 0,215, 4, 4, 0,216, 4,
- 0, 0,217, 4, 0, 0,218, 4, 0, 0,219, 4, 2, 0, 17, 0, 2, 0,220, 4, 2, 0, 19, 0, 2, 0,221, 4, 2, 0,222, 4,
- 2, 0,223, 4, 2, 0,224, 4, 2, 0, 41, 0, 4, 0, 53, 0, 0, 0,225, 4,168, 0,226, 4, 2, 0,227, 4, 2, 0,228, 4,
- 2, 0,229, 4, 2, 0,182, 0, 9, 0,230, 4, 9, 0,231, 4, 9, 0,232, 4, 9, 0,233, 4, 9, 0,234, 4, 2, 0,235, 4,
- 0, 0,236, 4,169, 0, 23, 0,156, 0, 0, 0,156, 0, 1, 0, 4, 0,124, 4, 7, 0,125, 4,157, 0,126, 4, 2, 0,127, 4,
-161, 0,189, 4, 11, 0,237, 4, 2, 0,195, 4, 2, 0,238, 4, 2, 0, 19, 0, 2, 0,161, 0, 9, 0,206, 4, 11, 0,239, 4,
-170, 0,240, 4, 0, 0,241, 4,171, 0,242, 4, 4, 0,243, 4, 4, 0,244, 4, 2, 0, 17, 0, 2, 0,245, 4, 2, 0,246, 4,
- 2, 0,247, 4,172, 0, 30, 0,156, 0, 0, 0,156, 0, 1, 0, 4, 0,124, 4, 7, 0,125, 4,157, 0,126, 4, 2, 0,127, 4,
-161, 0,189, 4, 40, 0, 95, 2, 39, 0,230, 0, 52, 0,248, 4, 2, 0,240, 0, 2, 0,114, 0, 2, 0,249, 4, 2, 0,250, 4,
- 4, 0, 19, 0, 2, 0,251, 4, 2, 0,198, 4, 2, 0,252, 4, 2, 0,195, 4, 7, 0,120, 4, 0, 0,253, 4, 0, 0,254, 4,
- 0, 0, 66, 2, 7, 0,214, 1, 7, 0,215, 1, 7, 0,255, 4, 7, 0, 0, 5, 0, 0, 1, 5, 0, 0, 2, 5, 49, 0, 3, 5,
-173, 0, 11, 0,156, 0, 0, 0,156, 0, 1, 0, 4, 0,124, 4, 7, 0,125, 4,157, 0,126, 4, 2, 0,127, 4, 2, 0,114, 0,
- 2, 0,198, 4, 2, 0, 4, 5, 2, 0, 19, 0,161, 0,189, 4,174, 0, 22, 0,156, 0, 0, 0,156, 0, 1, 0, 4, 0,124, 4,
- 7, 0,125, 4,157, 0,126, 4, 2, 0,127, 4, 35, 0, 5, 5, 4, 0, 6, 5, 4, 0, 7, 5, 2, 0, 75, 0, 2, 0,114, 0,
- 4, 0, 8, 5, 4, 0, 9, 5, 4, 0, 10, 5, 4, 0, 11, 5, 4, 0, 12, 5, 4, 0, 13, 5, 4, 0, 14, 5, 4, 0, 15, 5,
- 7, 0, 16, 5, 22, 0, 17, 5, 22, 0, 18, 5,175, 0, 10, 0,156, 0, 0, 0,156, 0, 1, 0, 4, 0,124, 4, 7, 0,125, 4,
-157, 0,126, 4,176, 0, 19, 5, 2, 0, 75, 0, 2, 0,114, 0, 4, 0, 41, 0, 9, 0, 20, 5,177, 0, 8, 0,156, 0, 0, 0,
-156, 0, 1, 0, 4, 0,124, 4, 7, 0,125, 4,157, 0,126, 4,161, 0,189, 4, 4, 0, 19, 0, 4, 0, 21, 5,178, 0, 18, 0,
-156, 0, 0, 0,156, 0, 1, 0, 4, 0,124, 4, 7, 0,125, 4,157, 0,126, 4,161, 0,189, 4, 26, 0, 22, 5, 26, 0, 64, 0,
- 2, 0, 19, 0, 2, 0,114, 0, 7, 0, 23, 5, 9, 0, 24, 5, 7, 0,214, 1, 7, 0,215, 1, 55, 0,110, 1, 55, 0, 25, 5,
- 4, 0, 26, 5, 4, 0, 15, 0,179, 0, 42, 0,156, 0, 0, 0,156, 0, 1, 0, 4, 0,124, 4, 7, 0,125, 4,157, 0,126, 4,
- 2, 0,127, 4,161, 0,189, 4,180, 0, 27, 5, 0, 0,217, 4, 0, 0,218, 4, 0, 0,219, 4, 2, 0, 17, 0, 2, 0,228, 4,
- 2, 0, 19, 0, 2, 0,221, 4, 9, 0, 24, 5, 4, 0, 28, 5, 4, 0, 29, 5, 4, 0, 30, 5, 4, 0, 31, 5, 22, 0, 32, 5,
- 22, 0, 33, 5, 7, 0, 34, 5, 7, 0, 35, 5, 7, 0, 36, 5, 7, 0, 23, 5, 2, 0,227, 4, 2, 0,182, 0, 2, 0, 54, 1,
- 2, 0, 37, 5, 2, 0, 15, 0, 2, 0, 41, 0, 2, 0, 38, 5, 2, 0, 39, 5, 9, 0,230, 4, 9, 0,231, 4, 9, 0,232, 4,
- 9, 0,233, 4, 9, 0,234, 4, 2, 0,235, 4, 0, 0,236, 4, 49, 0, 40, 5,181, 0, 20, 0, 0, 0, 41, 5, 0, 0, 42, 5,
- 0, 0, 43, 5, 0, 0, 44, 5, 0, 0, 45, 5, 0, 0, 46, 5, 0, 0, 47, 5, 0, 0, 48, 5, 0, 0, 49, 5, 0, 0, 50, 5,
- 0, 0, 51, 5, 0, 0, 52, 5, 0, 0, 53, 5, 0, 0, 54, 5, 0, 0, 55, 5, 0, 0, 56, 5, 0, 0, 57, 5, 0, 0, 58, 5,
- 0, 0,186, 3, 0, 0, 59, 5,182, 0, 48, 0, 0, 0, 60, 5, 0, 0, 51, 5, 0, 0, 52, 5, 0, 0, 61, 5, 0, 0, 62, 5,
- 0, 0, 63, 5, 0, 0, 64, 5, 0, 0, 65, 5, 0, 0, 66, 5, 0, 0, 67, 5, 0, 0, 68, 5, 0, 0, 69, 5, 0, 0, 70, 5,
- 0, 0, 71, 5, 0, 0, 72, 5, 0, 0, 73, 5, 0, 0, 74, 5, 0, 0, 75, 5, 0, 0, 76, 5, 0, 0, 77, 5, 0, 0, 78, 5,
- 0, 0, 79, 5, 0, 0, 80, 5, 0, 0, 81, 5, 0, 0, 82, 5, 0, 0, 83, 5, 0, 0, 84, 5, 0, 0, 85, 5, 0, 0, 86, 5,
- 0, 0, 87, 5, 0, 0, 88, 5, 0, 0, 89, 5, 0, 0, 90, 5, 0, 0, 91, 5, 0, 0, 92, 5, 0, 0, 93, 5, 0, 0, 94, 5,
- 0, 0, 95, 5, 0, 0, 96, 5, 0, 0, 97, 5, 0, 0, 98, 5, 0, 0, 99, 5, 0, 0,100, 5, 0, 0,101, 5, 0, 0,102, 5,
- 0, 0,103, 5, 0, 0,104, 5, 0, 0,105, 5,183, 0, 21, 0,183, 0, 0, 0,183, 0, 1, 0, 0, 0, 16, 0,181, 0,106, 5,
-182, 0,107, 5,182, 0,108, 5,182, 0,109, 5,182, 0,110, 5,182, 0,111, 5,182, 0,112, 5,182, 0,113, 5,182, 0,114, 5,
-182, 0,115, 5,182, 0,116, 5,182, 0,117, 5,182, 0,118, 5,182, 0,119, 5,182, 0,120, 5,182, 0,121, 5, 0, 0,122, 5,
- 0, 0,123, 5,184, 0, 5, 0, 4, 0, 19, 0, 4, 0, 15, 0, 7, 0, 13, 2, 7, 0,124, 5, 7, 0,174, 1,185, 0, 56, 0,
- 4, 0, 19, 0, 4, 0,125, 5, 4, 0,126, 5, 0, 0,127, 5, 0, 0,128, 5, 0, 0,129, 5, 0, 0,130, 5, 0, 0,131, 5,
- 0, 0,132, 5, 0, 0,133, 5, 0, 0,134, 5, 0, 0,135, 5, 2, 0,136, 5, 2, 0,137, 5, 4, 0,138, 5, 4, 0,139, 5,
- 4, 0,140, 5, 4, 0,141, 5, 2, 0,142, 5, 2, 0,143, 5, 2, 0,144, 5, 2, 0,145, 5, 4, 0,146, 5, 4, 0,147, 5,
- 2, 0,148, 5, 2, 0,149, 5, 2, 0,150, 5, 2, 0,151, 5, 0, 0,152, 5, 11, 0,153, 5, 2, 0,154, 5, 2, 0,155, 5,
- 2, 0,156, 5, 2, 0,157, 5,184, 0,158, 5, 2, 0,159, 5, 2, 0,160, 5, 2, 0,161, 5, 2, 0,162, 5, 4, 0,163, 5,
- 4, 0,164, 5, 4, 0,165, 5, 4, 0,166, 5, 2, 0,167, 5, 2, 0,168, 5, 2, 0,169, 5, 2, 0,170, 5, 2, 0,171, 5,
- 2, 0,172, 5, 2, 0,173, 5, 2, 0,174, 5, 0, 0,175, 5, 0, 0,176, 5, 7, 0,177, 5, 7, 0, 15, 0, 47, 0,178, 5,
-186, 0, 18, 0, 26, 0, 30, 0, 11, 0,179, 5, 11, 0,180, 5, 11, 0,181, 5,152, 0,182, 5, 2, 0,104, 2, 2, 0,183, 5,
- 2, 0,105, 2, 2, 0,184, 5, 2, 0,185, 5, 2, 0,186, 5, 2, 0,187, 5, 2, 0,188, 5, 2, 0,189, 5, 2, 0, 15, 0,
- 2, 0,190, 5, 2, 0,191, 5, 2, 0,192, 5,187, 0, 5, 0,187, 0, 0, 0,187, 0, 1, 0,187, 0,193, 5, 12, 0,194, 5,
- 4, 0, 19, 0,188, 0, 7, 0,188, 0, 0, 0,188, 0, 1, 0,187, 0,195, 5,187, 0,196, 5, 2, 0,235, 3, 2, 0, 19, 0,
- 4, 0, 15, 0,189, 0, 17, 0,189, 0, 0, 0,189, 0, 1, 0, 0, 0,197, 5, 0, 0,198, 5, 0, 0,199, 5, 2, 0,200, 5,
- 2, 0,201, 5, 2, 0,185, 5, 2, 0,186, 5, 2, 0, 19, 0, 2, 0,240, 2, 2, 0,202, 5, 2, 0,203, 5, 2, 0,204, 5,
- 2, 0,205, 5, 4, 0,206, 5,189, 0,207, 5,157, 0, 30, 0,157, 0, 0, 0,157, 0, 1, 0,187, 0,195, 5,187, 0,196, 5,
-187, 0,208, 5,187, 0,209, 5,186, 0,210, 5, 7, 0,211, 5, 22, 0,233, 1, 22, 0,212, 5, 22, 0,213, 5, 2, 0,214, 5,
- 2, 0,215, 5, 2, 0,216, 5, 0, 0,124, 4, 0, 0,217, 5, 2, 0,218, 5, 2, 0,219, 5, 0, 0,220, 5, 0, 0,221, 5,
- 0, 0,222, 5, 0, 0,223, 5, 2, 0,224, 5, 2, 0,225, 5, 2, 0,226, 5, 2, 0, 19, 0, 33, 0,102, 0, 11, 0,227, 5,
- 11, 0,228, 5, 11, 0,229, 5,190, 0, 11, 0, 0, 0,230, 5, 2, 0,231, 5, 2, 0,232, 5, 2, 0,233, 5, 2, 0,234, 5,
- 2, 0,235, 5, 2, 0,221, 3, 9, 0,236, 5, 9, 0,237, 5, 4, 0,238, 5, 4, 0,239, 5,191, 0, 1, 0, 0, 0,240, 5,
-192, 0, 7, 0, 49, 0,241, 5,192, 0,242, 5,192, 0,243, 5,192, 0,244, 5, 2, 0,110, 0, 2, 0, 15, 0, 4, 0,245, 5,
-193, 0, 11, 0,193, 0, 0, 0,193, 0, 1, 0, 4, 0,161, 0, 4, 0, 22, 0, 4, 0, 27, 0, 4, 0,246, 5,191, 0,247, 5,
- 0, 0,218, 4, 4, 0,248, 5, 4, 0,249, 5,192, 0,250, 5,194, 0, 12, 0, 0, 0,137, 1, 9, 0,168, 0, 0, 0,169, 0,
- 4, 0,172, 0, 4, 0,180, 0, 9, 0,173, 0, 7, 0,175, 0, 7, 0,176, 0, 9, 0,251, 5, 9, 0,252, 5, 9, 0,177, 0,
- 9, 0,179, 0,195, 0, 40, 0,195, 0, 0, 0,195, 0, 1, 0, 9, 0,253, 5, 9, 0, 25, 0, 0, 0, 26, 0, 2, 0, 19, 0,
- 2, 0, 17, 0, 4, 0, 22, 0, 4, 0, 67, 2, 4, 0,254, 5, 4, 0,255, 5, 4, 0, 0, 6, 4, 0, 1, 6, 4, 0, 2, 6,
- 4, 0,191, 0, 4, 0, 3, 6, 4, 0, 4, 6, 7, 0, 5, 6, 7, 0, 6, 6, 4, 0,107, 0,193, 0, 7, 6, 30, 0, 63, 0,
-152, 0,182, 5, 41, 0,116, 0, 7, 0, 8, 6, 7, 0, 9, 6,194, 0,231, 0,195, 0, 10, 6,195, 0, 11, 6,195, 0, 12, 6,
- 11, 0, 13, 6,196, 0, 14, 6,197, 0, 15, 6, 7, 0, 16, 6, 7, 0, 17, 6, 4, 0, 18, 6, 7, 0, 19, 6, 9, 0, 20, 6,
- 4, 0, 21, 6, 4, 0, 15, 0,198, 0, 4, 0,198, 0, 0, 0,198, 0, 1, 0, 11, 0, 22, 6,195, 0, 23, 6,199, 0, 6, 0,
- 11, 0, 24, 6, 11, 0, 13, 6, 11, 0, 25, 6, 2, 0, 19, 0, 2, 0, 15, 0, 4, 0,161, 0,200, 0, 4, 0, 7, 0, 26, 6,
- 7, 0, 89, 0, 2, 0, 27, 6, 2, 0, 28, 6,201, 0, 6, 0, 7, 0, 29, 6, 7, 0, 30, 6, 7, 0, 31, 6, 7, 0, 32, 6,
- 4, 0, 33, 6, 4, 0, 34, 6,202, 0, 12, 0, 7, 0, 35, 6, 7, 0, 36, 6, 7, 0, 37, 6, 7, 0, 38, 6, 7, 0, 39, 6,
- 7, 0, 40, 6, 7, 0, 41, 6, 7, 0, 42, 6, 7, 0, 43, 6, 7, 0, 44, 6, 4, 0, 99, 2, 4, 0, 45, 6,203, 0, 2, 0,
- 7, 0, 31, 4, 7, 0, 15, 0,204, 0, 5, 0, 7, 0, 46, 6, 7, 0, 47, 6, 4, 0, 75, 0, 4, 0, 68, 2, 4, 0, 48, 6,
-205, 0, 6, 0,205, 0, 0, 0,205, 0, 1, 0, 2, 0, 17, 0, 2, 0, 19, 0, 2, 0, 49, 6, 2, 0,161, 0,206, 0, 8, 0,
-206, 0, 0, 0,206, 0, 1, 0, 2, 0, 17, 0, 2, 0, 19, 0, 2, 0, 49, 6, 2, 0,161, 0, 7, 0, 22, 0, 7, 0,107, 0,
-207, 0, 45, 0,207, 0, 0, 0,207, 0, 1, 0, 2, 0, 17, 0, 2, 0, 19, 0, 2, 0, 49, 6, 2, 0,187, 0, 2, 0, 30, 3,
- 2, 0, 50, 6, 7, 0, 51, 6, 7, 0, 52, 6, 7, 0,111, 2, 4, 0, 53, 6, 4, 0, 65, 0, 4, 0, 70, 2, 7, 0, 54, 6,
- 7, 0, 55, 6, 7, 0, 56, 6, 7, 0, 57, 6, 7, 0, 58, 6, 7, 0, 59, 6, 7, 0,109, 2, 7, 0,229, 0, 7, 0, 60, 6,
- 7, 0, 61, 6, 7, 0, 15, 0, 7, 0, 62, 6, 7, 0, 63, 6, 7, 0, 64, 6, 2, 0, 65, 6, 2, 0, 66, 6, 2, 0, 67, 6,
- 2, 0, 68, 6, 2, 0, 69, 6, 2, 0, 70, 6, 2, 0, 71, 6, 2, 0, 72, 6, 2, 0,171, 4, 2, 0, 73, 6, 2, 0,158, 1,
- 2, 0, 74, 6, 0, 0, 75, 6, 0, 0, 76, 6, 7, 0,185, 0,208, 0, 77, 6, 56, 0,111, 1,209, 0, 16, 0,209, 0, 0, 0,
-209, 0, 1, 0, 2, 0, 17, 0, 2, 0, 19, 0, 2, 0, 49, 6, 2, 0,187, 0, 7, 0,104, 2, 7, 0,105, 2, 7, 0,106, 2,
- 7, 0,201, 1, 7, 0,107, 2, 7, 0,108, 2, 7, 0, 78, 6, 7, 0,109, 2, 7, 0,110, 2, 7, 0,111, 2,171, 0, 5, 0,
- 2, 0, 17, 0, 2, 0,245, 5, 2, 0, 19, 0, 2, 0, 79, 6, 26, 0, 22, 5,170, 0, 3, 0, 4, 0, 52, 0, 4, 0, 80, 6,
-171, 0, 54, 0,210, 0, 12, 0,210, 0, 0, 0,210, 0, 1, 0, 2, 0, 17, 0, 2, 0, 19, 0, 2, 0,205, 2, 2, 0,173, 1,
- 7, 0, 4, 0, 7, 0, 5, 0, 7, 0, 81, 6, 7, 0, 82, 6, 26, 0, 22, 5, 11, 0, 83, 6,211, 0, 11, 0,211, 0, 0, 0,
-211, 0, 1, 0, 0, 0, 16, 0, 2, 0, 17, 0, 2, 0, 84, 6, 4, 0, 21, 0, 4, 0, 85, 6, 2, 0, 19, 0, 2, 0, 15, 0,
- 9, 0, 86, 6, 9, 0, 87, 6,212, 0, 5, 0, 0, 0, 16, 0, 7, 0,243, 0, 7, 0, 88, 6, 4, 0, 89, 6, 4, 0, 15, 0,
-213, 0, 4, 0, 2, 0, 17, 0, 2, 0, 19, 0, 2, 0, 41, 0, 2, 0, 53, 0,214, 0, 4, 0, 0, 0, 16, 0, 54, 0, 90, 6,
- 7, 0,243, 0, 7, 0, 15, 0,215, 0, 6, 0, 2, 0, 91, 6, 2, 0, 92, 6, 2, 0, 17, 0, 2, 0, 93, 6, 0, 0, 94, 6,
- 0, 0, 95, 6,216, 0, 5, 0, 4, 0, 17, 0, 4, 0, 15, 0, 0, 0, 16, 0, 0, 0, 96, 6, 0, 0, 97, 6,217, 0, 6, 0,
- 0, 0, 16, 0, 0, 0, 98, 6, 2, 0, 99, 6, 2, 0,109, 2, 2, 0,240, 0, 2, 0, 53, 0,218, 0, 5, 0, 0, 0, 16, 0,
- 7, 0, 89, 0, 7, 0,102, 3, 2, 0, 19, 0, 2, 0, 81, 2,219, 0, 3, 0, 0, 0, 16, 0, 4, 0, 70, 2, 4, 0,100, 6,
-220, 0, 7, 0, 0, 0, 16, 0, 7, 0,102, 3, 0, 0,101, 6, 0, 0,102, 6, 2, 0,240, 0, 2, 0, 41, 0, 4, 0,103, 6,
-221, 0, 3, 0, 38, 0,104, 6, 0, 0,105, 6, 0, 0,106, 6,222, 0, 17, 0,222, 0, 0, 0,222, 0, 1, 0, 2, 0, 17, 0,
- 2, 0, 84, 6, 2, 0, 19, 0, 2, 0,107, 6, 2, 0,108, 6, 2, 0,109, 6, 2, 0, 41, 0, 2, 0, 53, 0, 0, 0, 16, 0,
- 9, 0, 54, 0,223, 0,110, 6, 38, 0,239, 0, 2, 0, 37, 4, 2, 0,111, 6, 4, 0, 15, 0,224, 0, 10, 0, 0, 0, 16, 0,
- 2, 0, 17, 0, 2, 0, 15, 0, 4, 0, 81, 2, 4, 0,112, 6, 4, 0,113, 6, 4, 0,114, 6, 4, 0,115, 6, 4, 0,116, 6,
- 4, 0,117, 6,225, 0, 1, 0, 0, 0,118, 6,226, 0, 1, 0, 35, 0, 5, 5,223, 0, 18, 0,223, 0, 0, 0,223, 0, 1, 0,
-223, 0,119, 6, 2, 0, 17, 0, 2, 0, 19, 0, 2, 0,120, 6, 2, 0,109, 6, 2, 0, 84, 6, 2, 0,121, 6, 2, 0, 53, 0,
- 2, 0,251, 0, 0, 0, 16, 0, 9, 0, 54, 0,227, 0,110, 6,222, 0,122, 6, 2, 0, 14, 0, 2, 0,123, 6, 4, 0, 49, 3,
-228, 0, 3, 0, 4, 0,124, 6, 4, 0, 15, 0, 38, 0,239, 0,229, 0, 10, 0,123, 0,125, 6, 2, 0, 17, 0, 2, 0, 19, 0,
- 4, 0, 51, 6, 4, 0, 52, 6, 0, 0, 16, 0, 4, 0,126, 6, 2, 0,127, 6, 2, 0,128, 6, 7, 0,129, 6,230, 0, 10, 0,
- 2, 0, 19, 0, 2, 0,130, 6, 4, 0, 51, 6, 4, 0, 52, 6, 2, 0,131, 6,196, 0, 14, 6, 2, 0, 17, 0, 2, 0,132, 6,
- 2, 0,133, 6, 2, 0,134, 6,231, 0, 7, 0, 2, 0, 19, 0, 2, 0,130, 6, 4, 0, 51, 6, 4, 0, 52, 6, 2, 0, 17, 0,
- 2, 0,135, 6, 7, 0,136, 6,232, 0, 9, 0, 4, 0,124, 6, 2, 0, 17, 0, 2, 0, 19, 0, 38, 0,239, 0, 71, 0,137, 6,
- 0, 0, 16, 0, 7, 0,138, 6, 2, 0,139, 6, 2, 0, 15, 0,233, 0, 5, 0, 2, 0, 17, 0, 2, 0, 19, 0, 4, 0, 15, 0,
-152, 0,182, 5, 38, 0, 91, 4,234, 0, 5, 0, 4, 0, 19, 0, 4, 0, 17, 0, 0, 0, 16, 0, 0, 0, 96, 6, 38, 0,239, 0,
-235, 0, 10, 0, 4, 0, 19, 0, 4, 0, 17, 0, 7, 0,140, 6, 7, 0,141, 6, 7, 0,234, 0, 7, 0,235, 0, 7, 0,174, 2,
- 7, 0,177, 2, 7, 0,142, 6, 7, 0,143, 6,236, 0, 9, 0, 2, 0, 19, 0, 2, 0, 17, 0, 4, 0, 51, 6, 4, 0, 52, 6,
- 0, 0, 16, 0, 2, 0, 41, 0, 2, 0, 44, 0, 2, 0,144, 6, 2, 0,145, 6,237, 0, 8, 0, 38, 0,239, 0, 7, 0,106, 2,
- 7, 0,146, 6, 7, 0,147, 6, 7, 0,101, 2, 2, 0, 19, 0, 2, 0, 81, 2, 7, 0,148, 6,238, 0, 7, 0, 2, 0, 19, 0,
- 2, 0,109, 2, 7, 0,149, 6, 7, 0,150, 6, 7, 0,151, 6, 7, 0,152, 6, 7, 0,153, 6,239, 0, 10, 0, 2, 0, 19, 0,
- 2, 0, 17, 0, 4, 0, 51, 6, 4, 0, 52, 6, 0, 0, 16, 0, 2, 0,186, 3, 2, 0, 44, 0, 2, 0,144, 6, 2, 0,145, 6,
- 56, 0,111, 1,240, 0, 7, 0, 4, 0, 70, 2, 4, 0,154, 6, 4, 0,155, 6, 4, 0,156, 6, 7, 0,157, 6, 7, 0,158, 6,
- 0, 0,101, 6,241, 0, 7, 0, 0, 0,159, 6, 38, 0,160, 6, 0, 0,105, 6, 2, 0,161, 6, 2, 0, 41, 0, 4, 0, 53, 0,
- 0, 0,106, 6,242, 0, 6, 0, 2, 0, 19, 0, 2, 0, 17, 0, 4, 0, 51, 6, 4, 0, 52, 6, 0, 0,162, 6, 0, 0,163, 6,
-243, 0, 1, 0, 4, 0, 19, 0,227, 0, 10, 0,227, 0, 0, 0,227, 0, 1, 0,227, 0,119, 6, 2, 0, 17, 0, 2, 0, 19, 0,
- 2, 0, 84, 6, 2, 0,164, 6, 0, 0, 16, 0, 9, 0, 54, 0, 38, 0,239, 0,244, 0, 10, 0, 7, 0,199, 2, 7, 0,165, 6,
- 7, 0,166, 6, 7, 0,167, 6, 7, 0,168, 6, 4, 0, 19, 0, 7, 0,169, 6, 7, 0,170, 6, 7, 0,171, 6, 7, 0, 15, 0,
-196, 0, 20, 0, 26, 0, 30, 0, 0, 0,167, 0,245, 0,172, 6, 9, 0,173, 6, 36, 0,128, 0, 36, 0,174, 6, 9, 0,175, 6,
- 30, 0, 63, 0, 7, 0,136, 6, 7, 0,176, 6, 7, 0,177, 6, 7, 0,178, 6, 7, 0,179, 6, 7, 0,180, 6, 7, 0,181, 6,
- 4, 0, 75, 0, 4, 0,182, 6, 0, 0,183, 6, 0, 0,184, 6, 0, 0,185, 6,246, 0, 6, 0, 26, 0, 30, 0, 7, 0,186, 6,
- 7, 0,187, 6, 7, 0,188, 6, 2, 0,189, 6, 2, 0,190, 6,247, 0, 14, 0,156, 0, 0, 0,156, 0, 1, 0, 4, 0,124, 4,
- 7, 0,125, 4,157, 0,126, 4,161, 0,189, 4,196, 0, 14, 6, 2, 0,240, 0, 2, 0,130, 6, 2, 0,214, 1, 2, 0,215, 1,
- 2, 0, 19, 0, 2, 0,198, 4, 4, 0, 53, 0,248, 0, 6, 0,248, 0, 0, 0,248, 0, 1, 0, 38, 0,239, 0, 9, 0,191, 6,
- 4, 0,192, 0, 4, 0, 15, 0, 56, 0, 4, 0, 26, 0, 30, 0, 11, 0,192, 6, 4, 0,112, 0, 4, 0, 15, 0,249, 0, 25, 0,
-249, 0, 0, 0,249, 0, 1, 0,249, 0, 36, 0, 11, 0,193, 6, 0, 0, 16, 0, 7, 0,194, 6, 7, 0,195, 6, 7, 0,196, 6,
- 7, 0,197, 6, 4, 0, 19, 0, 7, 0,198, 6, 7, 0,199, 6, 7, 0,200, 6, 7, 0,243, 0, 7, 0,166, 1, 7, 0,201, 6,
- 7, 0, 68, 2, 7, 0,202, 6, 7, 0,203, 6, 7, 0,204, 6, 7, 0,205, 6, 7, 0,206, 6, 7, 0,151, 0, 2, 0,112, 0,
- 2, 0, 51, 4,250, 0, 19, 0, 26, 0, 30, 0, 11, 0,207, 6, 11, 0,208, 6, 4, 0, 19, 0, 4, 0,142, 3, 2, 0,112, 2,
- 2, 0,209, 6, 2, 0,112, 0, 2, 0,210, 6, 2, 0,211, 6, 2, 0,212, 6, 2, 0,213, 6, 2, 0,214, 6, 4, 0,215, 6,
- 4, 0,216, 6, 4, 0,217, 6, 4, 0,218, 6, 4, 0,219, 6, 4, 0,220, 6,251, 0, 34, 0,251, 0, 0, 0,251, 0, 1, 0,
- 11, 0,222, 2, 0, 0, 16, 0, 2, 0, 19, 0, 2, 0,221, 6, 2, 0,222, 6, 2, 0,223, 6, 2, 0,188, 2, 2, 0, 53, 0,
- 4, 0,199, 1, 4, 0,217, 6, 4, 0,218, 6,249, 0,224, 6,251, 0, 36, 0,251, 0,225, 6, 11, 0,226, 6, 9, 0,227, 6,
- 9, 0,228, 6, 9, 0,229, 6, 7, 0,234, 0, 7, 0,151, 0, 7, 0,148, 1, 7, 0,230, 6, 7, 0,231, 6, 7, 0,180, 2,
- 7, 0,232, 6, 7, 0,233, 6, 7, 0,234, 6, 7, 0,235, 6, 7, 0,236, 6, 7, 0,237, 6, 7, 0,196, 1, 38, 0,238, 6,
-124, 0, 6, 0, 11, 0,239, 6, 2, 0, 19, 0, 2, 0,240, 6, 7, 0,198, 2, 7, 0,241, 6, 7, 0,242, 6,252, 0, 7, 0,
-252, 0, 0, 0,252, 0, 1, 0, 30, 0, 63, 0, 11, 0,171, 2, 4, 0, 19, 0, 0, 0, 16, 0, 4, 0,243, 6,123, 0, 2, 0,
- 26, 0, 30, 0, 11, 0,239, 6,253, 0, 15, 0,156, 0, 0, 0,156, 0, 1, 0, 4, 0,124, 4, 7, 0,125, 4,157, 0,126, 4,
- 2, 0,127, 4,161, 0,189, 4,123, 0,169, 2, 2, 0, 19, 0, 2, 0, 4, 5, 2, 0,195, 4, 2, 0,244, 6, 2, 0,198, 4,
- 2, 0,245, 6, 7, 0,246, 6,254, 0, 5, 0,254, 0, 0, 0,254, 0, 1, 0, 30, 0, 63, 0, 2, 0, 19, 0, 0, 0,247, 6,
-255, 0, 11, 0,255, 0, 0, 0,255, 0, 1, 0, 9, 0, 54, 0, 2, 0, 17, 0, 2, 0, 19, 0, 0, 0,248, 6, 0, 0,249, 6,
- 0, 0,247, 6, 7, 0,250, 6, 7, 0,251, 6, 4, 0, 15, 0, 0, 1, 9, 0, 0, 1, 0, 0, 0, 1, 1, 0, 38, 0,252, 6,
- 0, 0,253, 6, 7, 0,254, 6, 2, 0,255, 6, 2, 0, 19, 0, 2, 0, 17, 0, 2, 0, 15, 0, 1, 1, 7, 0, 35, 0, 5, 5,
- 25, 0, 0, 7, 4, 0, 19, 0, 4, 0, 1, 7, 11, 0, 2, 7, 38, 0,252, 6, 0, 0,253, 6, 2, 1, 11, 0, 38, 0,252, 6,
- 2, 0, 3, 7, 2, 0, 19, 0, 4, 0, 4, 7, 0, 0,253, 6, 38, 0, 5, 7, 0, 0, 6, 7, 7, 0, 7, 7, 7, 0,166, 1,
- 7, 0, 8, 7, 7, 0, 9, 7, 3, 1, 6, 0, 38, 0,252, 6, 4, 0,243, 6, 4, 0, 10, 7, 4, 0, 75, 0, 4, 0, 15, 0,
- 0, 0,253, 6, 4, 1, 4, 0, 38, 0,252, 6, 4, 0, 19, 0, 4, 0,243, 6, 0, 0,253, 6, 5, 1, 4, 0, 38, 0,252, 6,
- 4, 0, 19, 0, 4, 0,243, 6, 0, 0,253, 6, 6, 1, 10, 0, 38, 0,252, 6, 4, 0, 11, 7, 7, 0,106, 0, 4, 0, 19, 0,
- 2, 0,254, 4, 2, 0, 12, 7, 2, 0, 41, 0, 2, 0, 53, 0, 7, 0, 13, 7, 0, 0,253, 6, 7, 1, 4, 0, 38, 0,252, 6,
- 4, 0, 19, 0, 4, 0,243, 6, 0, 0,253, 6, 8, 1, 10, 0, 38, 0,252, 6, 2, 0, 17, 0, 2, 0, 36, 3, 4, 0, 67, 2,
- 4, 0, 52, 6, 7, 0,146, 6, 7, 0,147, 6, 4, 0, 15, 0,123, 0,125, 6, 0, 0,253, 6, 9, 1, 4, 0, 38, 0,252, 6,
- 4, 0,185, 2, 4, 0, 14, 7, 0, 0,253, 6, 10, 1, 5, 0, 38, 0,252, 6, 7, 0,106, 0, 4, 0, 15, 7, 4, 0,185, 2,
- 4, 0,186, 2, 11, 1, 6, 0, 38, 0,252, 6, 4, 0, 16, 7, 4, 0, 17, 7, 7, 0, 18, 7, 7, 0, 19, 7, 0, 0,253, 6,
- 12, 1, 16, 0, 38, 0,252, 6, 38, 0,225, 6, 4, 0, 17, 0, 7, 0, 20, 7, 7, 0, 21, 7, 7, 0, 22, 7, 7, 0, 23, 7,
- 7, 0, 24, 7, 7, 0, 25, 7, 7, 0, 26, 7, 7, 0, 27, 7, 7, 0, 28, 7, 2, 0, 19, 0, 2, 0, 15, 0, 2, 0, 41, 0,
- 2, 0, 53, 0, 13, 1, 3, 0, 38, 0,252, 6, 4, 0, 19, 0, 4, 0,171, 4, 14, 1, 5, 0, 38, 0,252, 6, 4, 0, 19, 0,
- 4, 0, 15, 0, 7, 0, 29, 7, 0, 0,253, 6, 15, 1, 10, 0, 38, 0,252, 6, 0, 0,253, 6, 2, 0, 30, 7, 2, 0, 31, 7,
- 0, 0, 32, 7, 0, 0, 33, 7, 7, 0, 34, 7, 7, 0, 35, 7, 7, 0, 36, 7, 7, 0, 37, 7, 16, 1, 8, 0, 7, 0, 8, 0,
- 7, 0, 9, 0, 7, 0, 10, 0, 7, 0, 11, 0, 7, 0, 38, 7, 7, 0, 39, 7, 2, 0, 19, 0, 2, 0,171, 4, 17, 1, 8, 0,
- 7, 0, 8, 0, 7, 0, 9, 0, 7, 0, 10, 0, 7, 0, 11, 0, 7, 0, 38, 7, 7, 0, 39, 7, 2, 0, 19, 0, 2, 0, 41, 0,
- 18, 1, 8, 0, 7, 0, 8, 0, 7, 0, 9, 0, 7, 0, 10, 0, 7, 0, 11, 0, 7, 0, 38, 7, 7, 0, 39, 7, 2, 0, 19, 0,
- 2, 0, 41, 0, 19, 1, 10, 0, 19, 1, 0, 0, 19, 1, 1, 0, 2, 0, 17, 0, 2, 0, 19, 0, 0, 0, 40, 7, 7, 0,194, 0,
- 7, 0,195, 0, 2, 0,183, 6, 2, 0, 41, 7, 38, 0,239, 0, 20, 1, 22, 0, 20, 1, 0, 0, 20, 1, 1, 0, 2, 0, 19, 0,
- 2, 0,240, 0, 2, 0, 42, 7, 2, 0, 43, 7, 30, 0, 63, 0,123, 0,125, 6, 38, 0,143, 0, 7, 0, 67, 2, 7, 0, 52, 6,
- 7, 0, 44, 7, 7, 0, 45, 7, 7, 0, 46, 7, 7, 0, 86, 1, 7, 0, 47, 7, 7, 0,102, 2, 7, 0,126, 6, 7, 0, 48, 7,
- 0, 0, 49, 7, 0, 0, 50, 7, 11, 0,173, 2, 21, 1, 8, 0, 7, 0,174, 1, 7, 0,146, 6, 7, 0,147, 6, 9, 0, 54, 0,
- 2, 0, 51, 7, 2, 0, 52, 7, 2, 0, 53, 7, 2, 0, 54, 7, 22, 1, 17, 0, 22, 1, 0, 0, 22, 1, 1, 0, 0, 0, 16, 0,
- 21, 1, 55, 7, 2, 0, 17, 0, 2, 0, 19, 0, 2, 0, 56, 7, 2, 0, 57, 7, 2, 0, 58, 7, 2, 0, 59, 7, 4, 0, 41, 0,
- 7, 0, 60, 7, 7, 0, 61, 7, 4, 0, 62, 7, 4, 0, 63, 7, 22, 1, 64, 7, 23, 1, 65, 7, 24, 1, 29, 0, 24, 1, 0, 0,
- 24, 1, 1, 0, 24, 1, 66, 7, 0, 0, 16, 0, 2, 0, 17, 0, 2, 0, 19, 0, 2, 0,246, 5, 2, 0, 16, 6, 2, 0, 67, 7,
- 2, 0,114, 0, 2, 0, 57, 7, 2, 0,245, 5, 11, 0,120, 6, 11, 0, 68, 7, 26, 0, 22, 5, 9, 0, 69, 7, 7, 0, 60, 7,
- 7, 0, 61, 7, 7, 0,201, 1, 7, 0, 70, 7, 2, 0, 71, 7, 2, 0, 72, 7, 2, 0, 73, 7, 2, 0, 74, 7, 23, 0, 75, 7,
- 23, 0, 76, 7, 23, 0, 77, 7, 25, 1,129, 0, 26, 1, 78, 7, 23, 1, 6, 0, 23, 1, 0, 0, 23, 1, 1, 0, 24, 1, 79, 7,
- 24, 1, 80, 7, 22, 1, 81, 7, 22, 1, 64, 7, 55, 0, 13, 0, 26, 0, 30, 0, 11, 0, 82, 7, 11, 0, 83, 7, 21, 1, 84, 7,
- 4, 0, 17, 0, 4, 0, 85, 7, 4, 0, 86, 7, 4, 0, 87, 7, 11, 0, 88, 7, 26, 1, 89, 7, 9, 0, 90, 7, 9, 0, 91, 7,
- 4, 0, 92, 7, 27, 1, 6, 0, 4, 0,105, 0, 4, 0,107, 0, 4, 0,245, 5, 0, 0, 93, 7, 0, 0, 94, 7, 2, 0, 15, 0,
- 28, 1, 11, 0, 2, 0,185, 5, 2, 0,186, 5, 2, 0, 95, 7, 2, 0,166, 6, 2, 0, 96, 7, 2, 0, 41, 0, 7, 0,101, 2,
- 2, 0, 2, 1, 0, 0, 97, 7, 0, 0,154, 3, 4, 0, 53, 0, 29, 1, 3, 0, 7, 0, 98, 7, 7, 0, 99, 7, 7, 0, 14, 0,
- 30, 1, 7, 0, 0, 0,137, 1, 2, 0,223, 3, 2, 0,224, 3, 2, 0,225, 3, 2, 0,174, 3, 4, 0,107, 0, 4, 0, 34, 3,
- 31, 1, 7, 0, 7, 0,100, 7, 7, 0,101, 7, 7, 0,102, 7, 7, 0,210, 1, 7, 0,103, 7, 7, 0,104, 7, 7, 0,105, 7,
- 32, 1, 4, 0, 2, 0,106, 7, 2, 0,107, 7, 2, 0,108, 7, 2, 0,109, 7, 33, 1, 2, 0, 0, 0,145, 0, 0, 0,110, 7,
- 34, 1, 1, 0, 0, 0, 16, 0, 35, 1, 10, 0, 0, 0,111, 7, 0, 0,112, 7, 0, 0,113, 7, 0, 0,114, 7, 2, 0, 95, 7,
- 2, 0,115, 7, 7, 0,116, 7, 7, 0,117, 7, 7, 0,118, 7, 7, 0,138, 1, 36, 1, 11, 0, 0, 0,225, 3, 0, 0, 17, 0,
- 0, 0,119, 7, 0, 0, 89, 0, 0, 0,120, 7, 0, 0, 86, 0, 0, 0, 35, 2, 7, 0,121, 7, 7, 0,122, 7, 7, 0,123, 7,
- 7, 0,124, 7, 37, 1, 8, 0, 7, 0, 91, 6, 7, 0,106, 0, 7, 0,154, 3, 7, 0, 30, 2, 7, 0,125, 7, 7, 0,181, 0,
- 7, 0,126, 7, 4, 0, 17, 0, 38, 1, 4, 0, 2, 0,127, 7, 2, 0,128, 7, 2, 0,129, 7, 2, 0, 15, 0, 39, 1, 4, 0,
- 7, 0, 4, 0, 7, 0, 5, 0, 2, 0, 19, 0, 2, 0,130, 7, 40, 1, 10, 0, 2, 0, 16, 3, 2, 0, 19, 0, 7, 0,102, 3,
- 7, 0,131, 7, 7, 0,132, 7, 7, 0,133, 7, 7, 0,134, 7, 39, 1,135, 7, 39, 1,136, 7, 39, 1,137, 7, 52, 0, 9, 0,
- 4, 0, 19, 0, 4, 0, 44, 0, 23, 0,138, 7, 23, 0,139, 7, 40, 1,140, 7, 7, 0,141, 7, 7, 0,142, 7, 7, 0,143, 7,
- 7, 0, 86, 1, 41, 1, 4, 0, 40, 0, 95, 2, 7, 0,144, 7, 7, 0, 44, 1, 7, 0, 15, 0,145, 0, 13, 0, 26, 0, 30, 0,
- 2, 0, 19, 0, 2, 0,121, 4, 4, 0, 86, 0, 7, 0,145, 7, 7, 0,207, 1, 7, 0,146, 7, 7, 0,147, 7, 7, 0, 44, 1,
- 2, 0, 15, 1, 2, 0, 15, 0, 43, 0, 29, 1, 41, 1,148, 7, 42, 1, 8, 0, 4, 0, 17, 0, 4, 0,106, 0, 4, 0, 19, 0,
- 4, 0,240, 2, 4, 0,149, 7, 0, 0,150, 7, 0, 0, 16, 0, 9, 0, 54, 0, 81, 0, 5, 0, 42, 1,151, 7, 4, 0,152, 7,
- 4, 0,153, 7, 4, 0,154, 7, 4, 0, 15, 0, 43, 1, 5, 0, 7, 0, 26, 2, 7, 0,124, 6, 7, 0,166, 1, 2, 0,155, 7,
- 2, 0, 15, 0, 44, 1, 5, 0, 7, 0, 26, 2, 7, 0,156, 7, 7, 0,157, 7, 7, 0,158, 7, 7, 0,124, 6, 45, 1, 7, 0,
- 4, 0,159, 7, 4, 0,160, 7, 4, 0,161, 7, 7, 0,162, 7, 7, 0,163, 7, 7, 0,164, 7, 7, 0,165, 7, 46, 1, 25, 0,
- 38, 0,166, 7, 44, 1,167, 7, 43, 1,168, 7, 44, 1, 77, 6, 7, 0,169, 7, 7, 0,170, 7, 7, 0,171, 7, 7, 0,172, 7,
- 7, 0,163, 7, 7, 0,164, 7, 7, 0,124, 6, 7, 0,111, 2, 7, 0,173, 7, 7, 0,174, 7, 7, 0, 86, 0, 7, 0,175, 7,
- 4, 0,159, 7, 4, 0,176, 7, 4, 0, 15, 0, 4, 0, 65, 0, 4, 0,177, 7, 2, 0, 19, 0, 2, 0,178, 7, 2, 0,179, 7,
- 2, 0, 14, 3, 47, 1,102, 0, 26, 0, 30, 0, 4, 0, 19, 0, 2, 0, 17, 0, 2, 0, 30, 7, 2, 0,180, 7, 2, 0,181, 7,
- 2, 0,182, 7, 2, 0,183, 7, 2, 0,184, 7, 2, 0,185, 7, 2, 0,186, 7, 2, 0,187, 7, 2, 0,188, 7, 2, 0,189, 7,
- 2, 0,190, 7, 2, 0,191, 7, 2, 0,192, 7, 2, 0,193, 7, 2, 0,194, 7, 2, 0,158, 1, 2, 0, 70, 6, 2, 0, 45, 6,
- 2, 0,195, 7, 2, 0,196, 7, 2, 0, 12, 3, 2, 0, 13, 3, 2, 0,197, 7, 2, 0,198, 7, 2, 0,199, 7, 2, 0,200, 7,
- 2, 0,201, 7, 2, 0,202, 7, 7, 0,203, 7, 7, 0,204, 7, 7, 0,205, 7, 7, 0, 51, 6, 7, 0, 52, 6, 7, 0,111, 2,
- 7, 0, 58, 6, 7, 0,206, 7, 7, 0,207, 7, 7, 0,208, 7, 4, 0, 53, 6, 4, 0, 50, 6, 4, 0,209, 7, 7, 0, 54, 6,
- 7, 0, 55, 6, 7, 0, 56, 6, 7, 0,210, 7, 7, 0,211, 7, 7, 0,212, 7, 7, 0,213, 7, 7, 0,214, 7, 7, 0,215, 7,
- 7, 0,216, 7, 7, 0,199, 2, 7, 0, 86, 0, 7, 0,217, 7, 7, 0,218, 7, 7, 0,219, 7, 7, 0,220, 7, 7, 0,221, 7,
- 7, 0,222, 7, 7, 0, 68, 2, 7, 0,223, 7, 7, 0,224, 7, 4, 0,225, 7, 7, 0,226, 7, 7, 0,227, 7, 7, 0,228, 7,
- 7, 0,229, 7, 7, 0,230, 7, 7, 0,231, 7, 7, 0,232, 7, 7, 0,233, 7, 7, 0, 8, 3, 7, 0, 6, 3, 7, 0, 7, 3,
- 7, 0,234, 7, 7, 0,235, 7, 7, 0,236, 7, 7, 0,237, 7, 7, 0,238, 7, 7, 0,239, 7, 7, 0,240, 7, 7, 0,241, 7,
- 7, 0,242, 7, 7, 0,243, 7, 7, 0,244, 7, 7, 0,245, 7, 7, 0,246, 7, 7, 0,247, 7, 7, 0,248, 7, 7, 0,249, 7,
- 7, 0,250, 7, 0, 0,251, 7, 56, 0,228, 2, 56, 0,252, 7, 38, 0,253, 7, 38, 0,254, 7, 30, 0, 63, 0,125, 0,226, 2,
-117, 0, 33, 0,117, 0, 0, 0,117, 0, 1, 0, 47, 1,255, 7, 46, 1, 15, 3, 45, 1,225, 6, 48, 1, 0, 8, 49, 1, 1, 8,
- 49, 1, 2, 8,126, 0,227, 2, 38, 0, 3, 8, 38, 0, 4, 8, 38, 0, 5, 8, 11, 0, 6, 8, 11, 0, 7, 8, 7, 0,185, 0,
- 7, 0,195, 3, 4, 0, 70, 2, 4, 0, 19, 0, 4, 0, 53, 6, 4, 0, 8, 8, 4, 0, 9, 8, 4, 0, 10, 8, 4, 0,161, 0,
- 2, 0,192, 0, 2, 0, 11, 8, 2, 0, 12, 8, 2, 0, 13, 8, 2, 0,220, 2, 2, 0, 14, 8, 0, 0, 15, 8, 2, 0, 16, 8,
- 2, 0, 17, 8, 2, 0, 18, 8, 69, 78, 68, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-};
-
diff --git a/source/blender/src/previewrender.c b/source/blender/src/previewrender.c
deleted file mode 100644
index 2f7b4754d76..00000000000
--- a/source/blender/src/previewrender.c
+++ /dev/null
@@ -1,912 +0,0 @@
-/*
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-/* global includes */
-
-#include <stdlib.h>
-#include <math.h>
-#include <string.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef WIN32
-#include <unistd.h>
-#else
-#include <io.h>
-#endif
-#include "MEM_guardedalloc.h"
-
-#include "BLI_arithb.h"
-#include "BLI_blenlib.h"
-
-#include "MTC_matrixops.h"
-
-#include "DNA_texture_types.h"
-#include "DNA_world_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_image_types.h"
-#include "DNA_material_types.h"
-#include "DNA_node_types.h"
-#include "DNA_object_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_space_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-
-#include "BKE_depsgraph.h"
-#include "BKE_global.h"
-#include "BKE_image.h"
-#include "BKE_icons.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
-#include "BKE_texture.h"
-#include "BKE_material.h"
-#include "BKE_node.h"
-#include "BKE_world.h"
-#include "BKE_texture.h"
-#include "BKE_utildefines.h"
-
-#include "IMB_imbuf.h"
-#include "IMB_imbuf_types.h"
-
-#include "BSE_headerbuttons.h"
-#include "BSE_node.h"
-#include "BSE_view.h"
-
-#include "BIF_gl.h"
-#include "BIF_screen.h"
-#include "BIF_space.h" /* allqueue */
-#include "BIF_butspace.h"
-#include "BIF_mywindow.h"
-#include "BIF_interface.h"
-#include "BIF_glutil.h"
-
-#include "BIF_previewrender.h" /* include ourself for prototypes */
-
-#include "PIL_time.h"
-
-#include "RE_pipeline.h"
-#include "BLO_readfile.h"
-
-#include "blendef.h" /* CLAMP */
-#include "interface.h" /* ui_graphics_to_window(), SOLVE! (ton) */
-#include "mydevice.h"
-
-
-#define PR_XMIN 10
-#define PR_YMIN 5
-#define PR_XMAX 200
-#define PR_YMAX 195
-
-
-static void set_previewrect(RenderInfo *ri, int win)
-{
- rctf viewplane;
-
- BLI_init_rctf(&viewplane, PR_XMIN, PR_XMAX, PR_YMIN, PR_YMAX);
-
- ui_graphics_to_window_rct(win, &viewplane, &ri->disprect);
-
- /* correction for gla draw */
- BLI_translate_rcti(&ri->disprect, -curarea->winrct.xmin, -curarea->winrct.ymin);
-
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
-
- glaDefine2DArea(&curarea->winrct);
-
- ri->pr_rectx= (ri->disprect.xmax-ri->disprect.xmin);
- ri->pr_recty= (ri->disprect.ymax-ri->disprect.ymin);
-}
-
-static void end_previewrect(void)
-{
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
-
- // restore viewport / scissor which was set by glaDefine2DArea
- glViewport(curarea->winrct.xmin, curarea->winrct.ymin, curarea->winx, curarea->winy);
- glScissor(curarea->winrct.xmin, curarea->winrct.ymin, curarea->winx, curarea->winy);
-
-}
-
-/* unused now */
-void draw_tex_crop(Tex *tex)
-{
- rcti rct;
- int ret= 0;
-
- if(tex==0) return;
-
- if(tex->type==TEX_IMAGE) {
- if(tex->cropxmin==0.0f) ret++;
- if(tex->cropymin==0.0f) ret++;
- if(tex->cropxmax==1.0f) ret++;
- if(tex->cropymax==1.0f) ret++;
- if(ret==4) return;
-
- rct.xmin= PR_XMIN+2+tex->cropxmin*(PR_XMAX-PR_XMIN-4);
- rct.xmax= PR_XMIN+2+tex->cropxmax*(PR_XMAX-PR_XMIN-4);
- rct.ymin= PR_YMIN+2+tex->cropymin*(PR_YMAX-PR_YMIN-4);
- rct.ymax= PR_YMIN+2+tex->cropymax*(PR_YMAX-PR_YMIN-4);
-
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
-
- glColor3ub(0, 0, 0);
- glRecti(rct.xmin+1, rct.ymin-1, rct.xmax+1, rct.ymax-1);
-
- glColor3ub(255, 255, 255);
- glRecti(rct.xmin, rct.ymin, rct.xmax, rct.ymax);
-
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- }
-
-}
-
-/* temporal abuse; if id_code is -1 it only does texture.... solve! */
-void BIF_preview_changed(short id_code)
-{
- ScrArea *sa;
-
- for(sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- if(sa->spacetype==SPACE_BUTS) {
- SpaceButs *sbuts= sa->spacedata.first;
- if(sbuts->mainb==CONTEXT_SHADING) {
- int tab= sbuts->tab[CONTEXT_SHADING];
- if(tab==TAB_SHADING_MAT && (id_code==ID_MA || id_code==ID_TE)) {
- if (sbuts->ri) sbuts->ri->curtile= 0;
- addafterqueue(sa->win, RENDERPREVIEW, 1);
- }
- else if(tab==TAB_SHADING_TEX && (id_code==ID_TE || id_code==-1)) {
- if (sbuts->ri) sbuts->ri->curtile= 0;
- addafterqueue(sa->win, RENDERPREVIEW, 1);
- }
- else if(tab==TAB_SHADING_LAMP && (id_code==ID_LA || id_code==ID_TE)) {
- if (sbuts->ri) sbuts->ri->curtile= 0;
- addafterqueue(sa->win, RENDERPREVIEW, 1);
- }
- else if(tab==TAB_SHADING_WORLD && (id_code==ID_WO || id_code==ID_TE)) {
- if (sbuts->ri) sbuts->ri->curtile= 0;
- addafterqueue(sa->win, RENDERPREVIEW, 1);
- }
- }
- else if (sbuts->ri)
- sbuts->ri->curtile= 0; /* ensure changes always result in re-render when context is restored */
- }
- else if(sa->spacetype==SPACE_NODE) {
- SpaceNode *snode= sa->spacedata.first;
- if(snode->treetype==NTREE_SHADER && (id_code==ID_MA || id_code==ID_TE)) {
- snode_tag_dirty(snode);
- }
- }
- else if(sa->spacetype==SPACE_VIEW3D) {
- View3D *vd= sa->spacedata.first;
- /* if is has a renderinfo, we consider that reason for signalling */
- if (vd->ri) {
- vd->ri->curtile= 0;
- addafterqueue(sa->win, RENDERPREVIEW, 1);
- }
- }
- }
-}
-
-/* *************************** Preview for buttons *********************** */
-
-static Main *pr_main= NULL;
-
-void BIF_preview_init_dbase(void)
-{
- BlendReadError bre;
- BlendFileData *bfd;
- extern int datatoc_preview_blend_size;
- extern char datatoc_preview_blend[];
-
- G.fileflags |= G_FILE_NO_UI;
- bfd= BLO_read_from_memory(datatoc_preview_blend, datatoc_preview_blend_size, &bre);
- if (bfd) {
- pr_main= bfd->main;
-
- MEM_freeN(bfd);
- }
- G.fileflags &= ~G_FILE_NO_UI;
-}
-
-void BIF_preview_free_dbase(void)
-{
- if(pr_main)
- free_main(pr_main);
-}
-
-/* call this with an ID pointer to initialize preview scene */
-/* call this with ID NULL to restore assigned ID pointers in preview scene */
-static Scene *preview_prepare_scene(RenderInfo *ri, int id_type, ID *id, int pr_method)
-{
- Scene *sce;
- Base *base;
-
- if(pr_main==NULL) return NULL;
-
- sce= pr_main->scene.first;
- if(sce) {
-
- // sce->r.mode |= G.scene->r.mode & R_THREADS;
- /* this flag tells render to not execute depsgraph or ipos etc */
- sce->r.scemode |= R_PREVIEWBUTS;
- /* set world always back, is used now */
- sce->world= pr_main->world.first;
-
- sce->r.cfra= G.scene->r.cfra;
-
- if(id_type==ID_MA) {
- Material *mat= (Material *)id;
-
- if(id) {
- init_render_material(mat, 0, NULL); /* call that retrieves mode_l */
- end_render_material(mat);
-
- /* turn on raytracing if needed */
- if(mat->mode_l & (MA_RAYTRANSP|MA_RAYMIRROR))
- sce->r.mode |= R_RAYTRACE;
- if(mat->sss_flag & MA_DIFF_SSS)
- sce->r.mode |= R_SSS;
-
- /* turn off fake shadows if needed */
- /* this only works in a specific case where the preview.blend contains
- * an object starting with 'c' which has a material linked to it (not the obdata)
- * and that material has a fake shadow texture in the active texture slot */
- for(base= sce->base.first; base; base= base->next) {
- if(base->object->id.name[2]=='c') {
- Material *shadmat= give_current_material(base->object, base->object->actcol);
- if(shadmat) {
- if (mat->mode & MA_SHADBUF) shadmat->septex = 0;
- else shadmat->septex |= 1;
- }
- }
- }
-
-
- if(pr_method==PR_ICON_RENDER) {
- if (mat->mode & MA_HALO) {
- sce->lay= 1<<MA_FLAT;
- }
- else {
- sce->lay= 1<<MA_SPHERE_A;
- }
- }
- else {
- sce->lay= 1<<mat->pr_type;
- if(mat->nodetree)
- ntreeInitPreview(mat->nodetree, ri->pr_rectx, ri->pr_recty);
- }
- }
- else {
- sce->r.mode &= ~(R_OSA|R_RAYTRACE|R_SSS);
- }
-
- for(base= sce->base.first; base; base= base->next) {
- if(base->object->id.name[2]=='p') {
- if(ELEM4(base->object->type, OB_MESH, OB_CURVE, OB_SURF, OB_MBALL))
- assign_material(base->object, mat, base->object->actcol);
- }
- }
- }
- else if(id_type==ID_TE) {
- Tex *tex= (Tex *)id;
-
- sce->lay= 1<<MA_TEXTURE;
-
- for(base= sce->base.first; base; base= base->next) {
- if(base->object->id.name[2]=='t') {
- Material *mat= give_current_material(base->object, base->object->actcol);
- if(mat && mat->mtex[0]) {
- mat->mtex[0]->tex= tex;
- /* show alpha in this case */
- if(tex==NULL || (tex->flag & TEX_PRV_ALPHA)) {
- mat->mtex[0]->mapto |= MAP_ALPHA;
- mat->alpha= 0.0f;
- }
- else {
- mat->mtex[0]->mapto &= ~MAP_ALPHA;
- mat->alpha= 1.0f;
- }
- }
- }
- }
- }
- else if(id_type==ID_LA) {
- Lamp *la= (Lamp *)id;
-
- sce->lay= 1<<MA_LAMP;
- sce->r.mode &= ~R_SHADOW;
-
- for(base= sce->base.first; base; base= base->next) {
- if(base->object->id.name[2]=='p') {
- if(base->object->type==OB_LAMP)
- base->object->data= la;
- }
- }
- }
- else if(id_type==ID_WO) {
- sce->lay= 1<<MA_SKY;
- sce->world= (World *)id;
- }
-
- return sce;
- }
-
- return NULL;
-}
-
-static void previewrender_progress(RenderResult *rr, volatile rcti *renrect)
-{
- RenderLayer *rl;
- RenderInfo *ri= G.buts->ri;
- float ofsx, ofsy;
-
- if(renrect) return;
-
- rl= rr->layers.first;
-
- ofsx= ri->disprect.xmin + rr->tilerect.xmin;
- ofsy= ri->disprect.ymin + rr->tilerect.ymin;
-
- glDrawBuffer(GL_FRONT);
- glaDrawPixelsSafe_to32(ofsx, ofsy, rr->rectx, rr->recty, rr->rectx, rl->rectf);
- bglFlush();
- glDrawBuffer(GL_BACK);
-}
-
-
-/* called by interface_icons.c, or by BIF_previewrender_buts or by nodes... */
-void BIF_previewrender(struct ID *id, struct RenderInfo *ri, struct ScrArea *area, int pr_method)
-{
- Render *re;
- RenderStats *rstats;
- Scene *sce;
- SpaceButs *sbuts= NULL;
- int oldx= ri->pr_rectx, oldy= ri->pr_recty;
- char name [32];
-
- if(ri->tottile && ri->curtile>=ri->tottile) return;
-
- /* check for return with a new event */
- if(pr_method!=PR_ICON_RENDER && qtest()) {
- if(area)
- addafterqueue(area->win, RENDERPREVIEW, 1);
- return;
- }
-
- /* get the stuff from the builtin preview dbase */
- sce= preview_prepare_scene(ri, GS(id->name), id, pr_method);
- if(sce==NULL) return;
-
- /* set drawing conditions OK */
- if(area) {
- sbuts= area->spacedata.first; /* needed for flag */
-
- set_previewrect(ri, area->win); // uses UImat
-
- /* because preview render size can differs */
- if(ri->rect && (oldx!=ri->pr_rectx || oldy!=ri->pr_recty)) {
- MEM_freeN(ri->rect);
- ri->rect= NULL;
- ri->curtile= 0;
- }
- }
-
- sprintf(name, "ButsPreview %d", area?area->win:0);
- re= RE_GetRender(name);
-
- /* full refreshed render from first tile */
- if(re==NULL || ri->curtile==0) {
-
- re= RE_NewRender(name);
-
- /* handle cases */
- if(pr_method==PR_DRAW_RENDER) {
- RE_display_draw_cb(re, previewrender_progress);
- RE_test_break_cb(re, qtest);
- sce->r.scemode |= R_NODE_PREVIEW;
- if(sbuts->flag & SB_PRV_OSA)
- sce->r.mode |= R_OSA;
- sce->r.scemode &= ~R_NO_IMAGE_LOAD;
- }
- else if(pr_method==PR_DO_RENDER) {
- RE_test_break_cb(re, qtest);
- sce->r.scemode |= R_NODE_PREVIEW;
- sce->r.scemode &= ~R_NO_IMAGE_LOAD;
- }
- else { /* PR_ICON_RENDER */
- sce->r.scemode &= ~R_NODE_PREVIEW;
- sce->r.scemode |= R_NO_IMAGE_LOAD;
- }
-
- /* allocates render result */
- RE_InitState(re, &sce->r, ri->pr_rectx, ri->pr_recty, NULL);
-
- /* enforce preview image clear */
- if(GS(id->name)==ID_MA) {
- Material *ma= (Material *)id;
- ntreeClearPreview(ma->nodetree);
- }
- }
- /* entire cycle for render engine */
- RE_SetCamera(re, sce->camera);
- RE_Database_FromScene(re, sce, 1);
- RE_TileProcessor(re, ri->curtile, 0); // actual render engine
- RE_Database_Free(re);
-
- /* handle results */
- if(pr_method==PR_ICON_RENDER) {
- if(ri->rect==NULL)
- ri->rect= MEM_mallocN(sizeof(int)*ri->pr_rectx*ri->pr_recty, "BIF_previewrender");
- RE_ResultGet32(re, ri->rect);
- }
- else {
- rstats= RE_GetStats(re);
-
- if(rstats->partsdone!=ri->curtile) {
- if(ri->rect==NULL)
- ri->rect= MEM_mallocN(sizeof(int)*ri->pr_rectx*ri->pr_recty, "BIF_previewrender");
- RE_ResultGet32(re, ri->rect);
- }
-
- if(rstats->totpart==rstats->partsdone && rstats->partsdone) {
- if(GS(id->name)==ID_MA && ((Material *)id)->use_nodes)
- allqueue(REDRAWNODE, 0);
- allqueue(REDRAWBUTSSHADING, 0);
- }
- else {
- if(pr_method==PR_DRAW_RENDER && qtest())
- addafterqueue(area->win, RENDERPREVIEW, 1);
- }
-
- ri->curtile= rstats->partsdone;
- ri->tottile= rstats->totpart;
- }
-
- /* unassign the pointers, reset vars */
- preview_prepare_scene(ri, GS(id->name), NULL, 0);
-
-}
-
-
-/* afterqueue call */
-void BIF_previewrender_buts(SpaceButs *sbuts)
-{
- uiBlock *block;
- struct ID* id = 0;
- struct ID* idfrom = 0;
- struct ID* idshow = 0;
- Object *ob;
-
- if (!sbuts->ri) return;
-
- /* we safely assume curarea has panel "preview" */
- /* quick hack for now, later on preview should become uiBlock itself */
-
- block= uiFindOpenPanelBlockName(&curarea->uiblocks, "Preview");
- if(block==NULL) return;
-
- ob= ((G.scene->basact)? (G.scene->basact)->object: 0);
-
- /* we cant trust this global lockpoin.. for example with headerless window */
- buttons_active_id(&id, &idfrom);
- G.buts->lockpoin= id;
-
- if(sbuts->mainb==CONTEXT_SHADING) {
- int tab= sbuts->tab[CONTEXT_SHADING];
-
- if(tab==TAB_SHADING_MAT)
- idshow = sbuts->lockpoin;
- else if(tab==TAB_SHADING_TEX)
- idshow = sbuts->lockpoin;
- else if(tab==TAB_SHADING_LAMP) {
- if(ob && ob->type==OB_LAMP) idshow= ob->data;
- }
- else if(tab==TAB_SHADING_WORLD)
- idshow = sbuts->lockpoin;
- }
- else if(sbuts->mainb==CONTEXT_OBJECT) {
- if(ob && ob->type==OB_LAMP) idshow = ob->data;
- }
-
- if (idshow) {
- BKE_icon_changed(BKE_icon_getid(idshow));
- uiPanelPush(block);
- BIF_previewrender(idshow, sbuts->ri, sbuts->area, PR_DRAW_RENDER);
- uiPanelPop(block);
- end_previewrect();
- }
- else {
- /* no active block to draw. But we do draw black if possible */
- if(sbuts->ri->rect) {
- memset(sbuts->ri->rect, 0, sizeof(int)*sbuts->ri->pr_rectx*sbuts->ri->pr_recty);
- sbuts->ri->tottile= 10000;
- addqueue(curarea->win, REDRAW, 1);
- }
- return;
- }
-}
-
-
-/* is panel callback, supposed to be called with correct panel offset matrix */
-void BIF_previewdraw(ScrArea *sa, uiBlock *block)
-{
- SpaceButs *sbuts= sa->spacedata.first;
- short id_code= 0;
-
- if(sbuts->lockpoin) {
- ID *id= sbuts->lockpoin;
- id_code= GS(id->name);
- }
-
- if (!sbuts->ri) {
- sbuts->ri= MEM_callocN(sizeof(RenderInfo), "butsrenderinfo");
- sbuts->ri->tottile = 10000;
- }
-
- if (sbuts->ri->rect==NULL) BIF_preview_changed(id_code);
- else {
- RenderInfo *ri= sbuts->ri;
- int oldx= ri->pr_rectx, oldy= ri->pr_recty;
-
- /* we now do scalable previews! */
- set_previewrect(ri, sa->win);
- if( ABS(oldx-ri->pr_rectx)<2 && ABS(oldy-ri->pr_recty)<2 ) {
- /* restore old values for drawing! */
- ri->pr_rectx= oldx;
- ri->pr_recty= oldy;
- glaDrawPixelsSafe(ri->disprect.xmin, ri->disprect.ymin, ri->pr_rectx, ri->pr_recty, ri->pr_rectx, GL_RGBA, GL_UNSIGNED_BYTE, ri->rect);
- }
- else {
- MEM_freeN(ri->rect);
- ri->rect= NULL;
- sbuts->ri->curtile= 0;
- }
- end_previewrect();
- }
- if(sbuts->ri->curtile==0) BIF_preview_changed(id_code);
-
-}
-
-/* *************************** Preview for 3d window *********************** */
-static void view3d_previewrender_stats(RenderStats *rs)
-{
-// if(rs->convertdone)
-// printf("rendered %d %.3f\n", rs->partsdone, rs->lastframetime);
-}
-
-static void view3d_previewrender_progress(RenderResult *rr, volatile rcti *renrect)
-{
- RenderLayer *rl;
- int ofsx, ofsy;
-
- if(renrect) return;
-
- rl= rr->layers.first;
-
- /* this case is when we render envmaps... */
- if(rr->rectx>G.vd->ri->pr_rectx || rr->recty>G.vd->ri->pr_recty)
- return;
-
- ofsx= G.vd->ri->disprect.xmin + rr->tilerect.xmin;
- ofsy= G.vd->ri->disprect.ymin + rr->tilerect.ymin;
-
- glDrawBuffer(GL_FRONT);
- glaDefine2DArea(&curarea->winrct);
- glaDrawPixelsSafe_to32(ofsx, ofsy, rr->rectx, rr->recty, rr->rectx, rl->rectf);
- bglFlush();
- glDrawBuffer(GL_BACK);
-
-}
-
-void BIF_view3d_previewrender_signal(ScrArea *sa, short signal)
-{
- View3D *v3d= sa->spacedata.first;
-
- /* this can be called from other window... solve! */
- if(sa->spacetype!=SPACE_VIEW3D)
- v3d= G.vd;
-
- if(v3d && v3d->ri) {
- RenderInfo *ri= v3d->ri;
- ri->status &= ~signal;
- ri->curtile= 0;
- //printf("preview signal %d\n", signal);
- if(ri->re && (signal & PR_DBASE))
- RE_Database_Free(ri->re);
-
- addafterqueue(sa->win, RENDERPREVIEW, 1);
- }
-}
-
-void BIF_view3d_previewrender_free(View3D *v3d)
-{
-
- if(v3d->ri) {
- RenderInfo *ri= v3d->ri;
- if(ri->re) {
-// printf("free render\n");
- RE_Database_Free(ri->re);
- RE_FreeRender(ri->re);
- ri->re= NULL;
- }
- if (v3d->ri->rect) MEM_freeN(v3d->ri->rect);
- MEM_freeN(v3d->ri);
- v3d->ri= NULL;
- }
-}
-
-/* returns 1 if OK, do not call while in panel space! */
-static int view3d_previewrender_get_rects(ScrArea *sa, rctf *viewplane, RenderInfo *ri, float *clipsta, float *clipend, int *ortho, float *pixsize)
-{
- int rectx, recty;
- uiBlock *block;
-
- block= uiFindOpenPanelBlockName(&curarea->uiblocks, "Preview");
- if(block==NULL) return 0;
-
- /* calculate preview rect size */
- BLI_init_rctf(viewplane, 15.0f, (block->maxx - block->minx)-15.0f, 15.0f, (block->maxy - block->miny)-15.0f);
- uiPanelPush(block);
- ui_graphics_to_window_rct(sa->win, viewplane, &ri->disprect);
- uiPanelPop(block);
-
- /* correction for gla draw */
- BLI_translate_rcti(&ri->disprect, -sa->winrct.xmin, -sa->winrct.ymin);
-
- *ortho= get_view3d_viewplane(sa->winx, sa->winy, viewplane, clipsta, clipend, pixsize);
-
- rectx= ri->disprect.xmax - ri->disprect.xmin;
- recty= ri->disprect.ymax - ri->disprect.ymin;
-
- if(rectx<4 || recty<4) return 0;
-
- if(ri->rect && (rectx!=ri->pr_rectx || recty!=ri->pr_recty)) {
- MEM_freeN(ri->rect);
- ri->rect= NULL;
- ri->curtile= 0;
- printf("changed size\n");
- }
- ri->pr_rectx= rectx;
- ri->pr_recty= recty;
-
- return 1;
-}
-
-/* called before a panel gets moved/scaled, makes sure we can see through */
-void BIF_view3d_previewrender_clear(ScrArea *sa)
-{
- View3D *v3d= sa->spacedata.first;
-
- if(v3d->ri) {
- RenderInfo *ri= v3d->ri;
- ri->curtile= 0;
- if(ri->rect)
- MEM_freeN(ri->rect);
- ri->rect= NULL;
- }
-}
-
-/* afterqueue call */
-void BIF_view3d_previewrender(ScrArea *sa)
-{
- View3D *v3d= sa->spacedata.first;
- Render *re;
- RenderInfo *ri; /* preview struct! */
- RenderStats *rstats;
- RenderData rdata;
- rctf viewplane;
- float clipsta, clipend, pixsize;
- int orth;
-
- /* first get the render info right */
- if (!v3d->ri) {
- ri= v3d->ri= MEM_callocN(sizeof(RenderInfo), "butsrenderinfo");
- ri->tottile= 10000;
- }
- ri= v3d->ri;
-
- if(0==view3d_previewrender_get_rects(sa, &viewplane, ri, &clipsta, &clipend, &orth, &pixsize))
- return;
-
- /* render is finished, so return */
- if(ri->tottile && ri->curtile>=ri->tottile) return;
-
- /* or return with a new event */
- if(qtest()) {
- addafterqueue(curarea->win, RENDERPREVIEW, 1);
- return;
- }
- //printf("Enter previewrender\n");
- /* ok, are we rendering all over? */
- if(ri->re==NULL) {
- char name[32];
-
- ri->status= 0;
-
- sprintf(name, "View3dPreview %d", sa->win);
- re= ri->re= RE_NewRender(name);
- RE_display_draw_cb(re, view3d_previewrender_progress);
- RE_stats_draw_cb(re, view3d_previewrender_stats);
- RE_test_break_cb(re, qtest);
-
- /* no osa, blur, seq, layers, etc for preview render */
- rdata= G.scene->r;
- rdata.mode &= ~(R_OSA|R_MBLUR);
- rdata.scemode &= ~(R_DOSEQ|R_DOCOMP|R_FREE_IMAGE);
- rdata.layers.first= rdata.layers.last= NULL;
- rdata.renderer= R_INTERN;
-
- RE_InitState(re, &rdata, sa->winx, sa->winy, &ri->disprect);
-
- if(orth)
- RE_SetOrtho(re, &viewplane, clipsta, clipend);
- else
- RE_SetWindow(re, &viewplane, clipsta, clipend);
- RE_SetPixelSize(re, pixsize);
-
- /* until here are no escapes */
- ri->status |= PR_DISPRECT;
- ri->curtile= 0;
- //printf("new render\n");
- }
-
- re= ri->re;
-
- PIL_sleep_ms(100); /* wait 0.1 second if theres really no event... */
- if(qtest()==0) {
-
- /* check status */
- if((ri->status & PR_DISPRECT)==0) {
- RE_SetDispRect(ri->re, &ri->disprect);
- if(orth)
- RE_SetOrtho(ri->re, &viewplane, clipsta, clipend);
- else
- RE_SetWindow(ri->re, &viewplane, clipsta, clipend);
- RE_SetPixelSize(re, pixsize);
- ri->status |= PR_DISPRECT;
- ri->curtile= 0;
- //printf("disprect update\n");
- }
- if((ri->status & PR_DBASE)==0) {
- unsigned int lay= G.scene->lay;
-
- RE_SetView(re, G.vd->viewmat);
-
- /* allow localview render for objects with lights in normal layers */
- if(v3d->lay & 0xFF000000)
- G.scene->lay |= v3d->lay;
- else G.scene->lay= v3d->lay;
-
- RE_Database_FromScene(re, G.scene, 0); // 0= dont use camera view
- G.scene->lay= lay;
-
- rstats= RE_GetStats(re);
- if(rstats->convertdone)
- ri->status |= PR_DBASE|PR_PROJECTED|PR_ROTATED;
- ri->curtile= 0;
-
- /* database can have created render-resol data... */
- if(rstats->convertdone)
- DAG_scene_update_flags(G.scene, screen_view3d_layers());
-
- //printf("dbase update\n");
- }
- if((ri->status & PR_PROJECTED)==0) {
- if(ri->status & PR_DBASE) {
- if(orth)
- RE_SetOrtho(ri->re, &viewplane, clipsta, clipend);
- else
- RE_SetWindow(ri->re, &viewplane, clipsta, clipend);
- RE_DataBase_ApplyWindow(re);
- ri->status |= PR_PROJECTED;
- }
- ri->curtile= 0;
- //printf("project update\n");
- }
-
- /* OK, can we enter render code? */
- if(ri->status==(PR_DISPRECT|PR_DBASE|PR_PROJECTED|PR_ROTATED)) {
- //printf("curtile %d tottile %d\n", ri->curtile, ri->tottile);
- RE_TileProcessor(ri->re, ri->curtile, 0);
-
- if(ri->rect==NULL)
- ri->rect= MEM_mallocN(sizeof(int)*ri->pr_rectx*ri->pr_recty, "preview view3d rect");
-
- RE_ResultGet32(ri->re, ri->rect);
- }
-
- rstats= RE_GetStats(ri->re);
- if(rstats->totpart==rstats->partsdone && rstats->partsdone)
- addqueue(sa->win, REDRAW, 1);
- else
- addafterqueue(curarea->win, RENDERPREVIEW, 1);
-
- ri->curtile= rstats->partsdone;
- ri->tottile= rstats->totpart;
- }
- else {
- addafterqueue(curarea->win, RENDERPREVIEW, 1);
- }
-
- //printf("\n");
-}
-
-/* in panel space! */
-static void view3d_previewdraw_rect(ScrArea *sa, uiBlock *block, RenderInfo *ri)
-{
- rctf dispf;
-
- if(ri->rect==NULL)
- return;
-
- BLI_init_rctf(&dispf, 15.0f, (block->maxx - block->minx)-15.0f, 15.0f, (block->maxy - block->miny)-15.0f);
- ui_graphics_to_window_rct(sa->win, &dispf, &ri->disprect);
-
- /* correction for gla draw */
- BLI_translate_rcti(&ri->disprect, -curarea->winrct.xmin, -curarea->winrct.ymin);
-
- /* when panel scale changed, free rect */
- if(ri->disprect.xmax-ri->disprect.xmin != ri->pr_rectx ||
- ri->disprect.ymax-ri->disprect.ymin != ri->pr_recty) {
- MEM_freeN(ri->rect);
- ri->rect= NULL;
- }
- else {
- glaDefine2DArea(&sa->winrct);
- glaDrawPixelsSafe(ri->disprect.xmin, ri->disprect.ymin, ri->pr_rectx, ri->pr_recty, ri->pr_rectx, GL_RGBA, GL_UNSIGNED_BYTE, ri->rect);
- }
-}
-
-/* is panel callback, supposed to be called with correct panel offset matrix */
-void BIF_view3d_previewdraw(struct ScrArea *sa, struct uiBlock *block)
-{
- View3D *v3d= sa->spacedata.first;
-
- if (v3d->ri==NULL || v3d->ri->rect==NULL)
- addafterqueue(sa->win, RENDERPREVIEW, 1);
- else {
- view3d_previewdraw_rect(sa, block, v3d->ri);
- if(v3d->ri->curtile==0)
- addafterqueue(sa->win, RENDERPREVIEW, 1);
- }
-}
-
diff --git a/source/blender/src/prvicons.c b/source/blender/src/prvicons.c
deleted file mode 100644
index 6222090705a..00000000000
--- a/source/blender/src/prvicons.c
+++ /dev/null
@@ -1,436 +0,0 @@
-/* DataToC output of file <prvicons> */
-
-int datatoc_prvicons_size= 13732;
-char datatoc_prvicons[]= {
-137, 80, 78, 71,
- 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 0,192, 0, 0, 0,192, 8, 6, 0, 0, 0, 82,220,108, 7, 0, 0, 0,
- 6, 98, 75, 71, 68, 0, 0, 0, 0, 0, 0,249, 67,187,127, 0, 0, 0, 9,112, 72, 89,115, 0, 0, 11, 19, 0, 0, 11, 19, 1,
- 0,154,156, 24, 0, 0, 0, 7,116, 73, 77, 69, 7,215, 8, 27, 17, 57, 33, 43,142, 73,203, 0, 0, 0, 29,116, 69, 88,116, 67,
-111,109,109,101,110,116, 0, 67,114,101, 97,116,101,100, 32,119,105,116,104, 32, 84,104,101, 32, 71, 73, 77, 80,239,100, 37,110,
- 0, 0, 32, 0, 73, 68, 65, 84,120,218,237,125,121,124, 84,213,249,254,115,238,189, 51,147,201,158, 12, 73, 72,216, 3,200, 98,
- 88, 69, 66, 38, 65, 16, 20,165, 40,213,162, 32, 45,138,203, 79,176,223, 42,180,110, 72,235,190, 97, 91, 91, 21,181,149,182, 90,
- 20, 42, 10, 66, 80,164, 34, 59,146, 5,194, 30, 18, 8, 75, 2,201,144,144,201, 62, 73,102,189,247,158,243,251, 35,235, 36, 51,
-217,200,100, 38,229, 62,159,207,124,146,123,239,153, 59,207, 61,247,125,207,121,223,247,156,243, 30, 64,129, 2, 5, 10, 20, 40,
- 80,160, 64,129, 2, 5, 10, 20, 40, 80,160, 64,129, 2, 5, 10, 20, 40, 80,160, 64,129, 2, 5, 10, 20, 40, 80,160, 64,129, 2,
- 5, 10, 20, 40, 80,160, 64,129, 2, 5, 10, 20, 40, 80,160, 64,129, 2, 5, 10, 20, 40, 80,160, 64,129, 2, 5, 10, 20, 40, 80,
-160, 64,129, 2, 5, 10, 20, 40, 80,160, 64,129, 2, 5, 10, 20, 40, 80,160, 64,129, 2, 5, 10, 20, 40, 80,160, 64,129, 2, 5,
- 10, 20, 40, 80,160, 64,129, 2, 5, 10, 20, 40, 80,160, 64,129, 2, 5, 10, 20, 40, 80,160, 64,129, 2, 5, 10, 20, 40, 80,160,
- 64,129, 2, 5, 10, 20, 40, 80,160, 64,129, 2, 5, 10, 20, 40, 80,160, 64,129, 2, 5, 10, 20, 40, 80,208, 18, 36, 41, 41,105,
-180, 32, 8,143, 16, 66, 72,119,223,156, 49, 22, 46,203,242,112,198,216,203, 41, 41, 41,251, 60,241, 0,189,157,191, 2,239, 43,
-192, 61, 49, 49, 49, 27,230,204,153,227,215,157, 55,206,206,206,198,169, 83,167, 16, 25, 25, 9,131,193, 64, 37, 73,154,150,146,
-146,146,226, 1, 5,232,213,252, 21,120, 23, 2, 0, 68, 71, 71,219, 23, 46, 92,216,109, 2,180,105,211, 38, 24, 12, 6, 60,250,
-232,163,224, 56, 14, 7, 15, 30,228, 50, 51, 51, 15, 36, 38, 38, 38,164,166,166,102,116,247, 67,244,118,254, 10,188, 7,174,187,
-111, 40, 73, 18,214,175, 95,143, 5, 11, 22,160,111,223,190,240,247,247, 71, 98, 98, 34,226,226,226, 56,149, 74,149,174,215,235,
- 39,250,114,133,244,118,254, 10,188,172, 0, 6,131, 1,193,193,193,136,136,136,128, 32, 8,208,106,181,208,106,181,208,235,245,
- 24, 57,114, 36,167, 86,171, 51,244,122,125,156,175, 86, 72,111,231,175,192,203, 10, 80, 88, 88, 8,157, 78,215,120,172,209,104,
- 26,133, 40, 49, 49, 17,195,135, 15,231,213,106,245,137,132,132,132, 27,124,177, 66,122, 59,127, 5, 94, 86,128,192,192, 64, 88,
-173, 86,167,115,254,254,254,141,159,164,164, 36,196,198,198, 10,126,126,126, 89,122,189, 62,214,215, 42,164,183,243, 87,224,101,
- 5,208,233,116, 48,153, 76,173,206, 55,180,162, 90,173, 22, 73, 73, 73, 24, 56,112,160, 74,163,209,156,213,235,245, 3,124,169,
- 66,122, 59,127, 5,157,131,208,221, 55,140,138,138, 66, 77, 77, 13,172, 86, 43,180, 90, 45, 0,160,170,170, 10,165,165,165, 40,
- 47, 47, 71,105,105, 41, 44, 22, 11, 6, 15, 30, 12, 81, 20,213, 87,175, 94, 61,175,215,235,135,164,165,165, 21,251, 66,133,244,
-118,254, 10,188,172, 0,106,181, 26,227,199,143, 71, 78, 78, 14,116, 58, 29, 14, 28, 56,128,130,130, 2,196,198,198, 34, 42, 42,
- 10, 67,135, 14, 5,207,243, 72, 77, 77,133,209,104,132, 40,138,126, 26,141, 38, 79,175,215, 15, 74, 75, 75, 43,245,118,133,244,
-118,254, 10,188,172, 0, 0, 48,109,218, 52,124,250,233,167, 16, 69, 17,143, 63,254, 56,102,206,156, 9,181, 90,237, 84,102,209,
-162, 69, 48,153, 76, 88,183,110, 29,182,108,217,162,165,148,190, 9,224, 9, 0,204,219,149,210,219,249, 43,240,162, 15, 0, 0,
- 9, 9, 9, 8, 12, 12,196, 71, 31,125,132,217,179,103,183, 18,158, 6,132,132,132,224,201, 39,159,132, 70,163, 97, 86,171,117,
-108,104,104,104,127, 0,196,219,149,210,219,249, 43,240,178, 2, 4, 5, 5, 97,205,154, 53,136,137,137,233, 80,249, 33, 67,134,
- 72, 86,171,213,204,243,252,253,190, 32, 64,189,157,191, 2, 47, 43, 0, 0, 8, 66,199,173, 43, 63, 63, 63, 70, 41,149, 24, 99,
- 26, 95, 17,160,222,206, 95,129,151, 21,160,139,144,123,121,125,202,138, 72, 41, 10,208, 37, 16, 66,100, 66, 72,175, 21,160,222,
-206,255,122,133,208, 19, 63, 98,178,216,193, 24,131, 74,224, 17,160, 81,185,109, 61, 25, 99, 50,122,111, 20,165,183,243, 87, 20,
-192, 19,200, 45,174,194,152,103, 62, 5, 0, 68,135, 5,226,252,234, 37,224,185,122, 51,153, 81, 56,142,252, 11,183, 71, 92,225,
- 39,223, 22, 56, 50, 88,173,213,234, 99,111,136,134, 64,254, 25,249,155,244,139,158,230,166, 82,185, 85, 70,136,162,216,217, 30,
-128, 2,160,138, 15,160, 40,128, 19, 62, 63,112,186,241,255,171,149,181,248,241,100, 30,126, 54,113, 40, 0,128,154,174,192,126,
-124, 61,146,194,192, 35, 76, 51, 28,192,112, 0,183, 17,137,255,216,155,194,223,145,235, 45,148,132, 1,104, 48,129,148, 30, 64,
-241, 1,234,109, 2,202,240,159,159,178,157,206,125,113, 32,171,241,127, 90,118,190,213,119, 24, 80, 30,190, 60,165,192,155,194,
-223,197,251, 80,197, 9, 86, 20,192, 9, 59, 79, 93,194,213, 42, 51,180,234,166,142,230,135, 19,121, 40,173,182,212, 41, 72,217,
- 5,184,208,128, 19,189,169, 2,155, 41, 1,173,247, 1, 20, 40, 10,224,220,218,191,255,240, 76, 52, 44, 89, 23,101,138, 13, 41,
-103,234, 36,166,212,101, 15,112,220,215, 43, 77, 20, 69,167, 15, 0, 13,165, 20, 0,244, 0,120, 69,172, 20, 5, 64,105,181, 5,
-255, 61,158,139, 65, 17, 33, 88,116, 75, 28,102,196, 13,106,230, 23,100,213,247, 0, 46, 20,128,178,227,189,173, 18, 25, 99, 0,
- 16, 7,160, 76,241, 1, 20, 39, 24, 0,176, 33,229, 12, 68,153,226,161,105, 55,130, 16,224,161,105, 99,176,231,116, 62, 0,224,
-236,149,114,100,100,102, 97,148,189,166,213,247,204,140,157, 0,128,146,143,167, 7,242,212, 54, 7,192, 72, 70,137,131,227,113,
- 90,148,232,145,168,223, 30, 54,250,168, 2,252, 4,160, 90, 17, 41,165, 7,104,108,229, 57, 66,240,224,180,186,229,179,115, 39,
- 13, 67, 88, 64, 83,226,134,181,123, 91,155,250,162,204, 44,187,114,228, 75,229,171,227,159,225,101, 91, 49, 24,190, 2,195,171,
-132,176,183, 25,101,219, 4,142,228, 85,172, 78, 88,234,139, 21,233,112, 56,202, 25, 99,134,122,103, 88,193,245,172, 0, 71,115,
-139,113,246, 74, 57,102,142, 25,132,254,225, 65, 0, 0,141,138,199,130,196, 81,141,101, 54,159, 42,133, 85,118, 54,151,171,172,
-180,224, 23,113,170,117, 0,121, 23, 64,128,139, 91,251, 51,176, 79,202, 62, 72, 88,229,131,117, 25, 98,179,217,250,195,247,166,
-151, 40,232,105, 5, 88,187,191, 46,246,191,120,250, 24,167,243, 15, 79,111, 74,166, 80,227, 96,216, 86,230, 60,219, 82, 23,192,
- 15, 35,192,130,246,238, 79, 8,123,166,236,189, 41,163,188, 85,105, 42,149,170, 85, 40,149, 16, 2, 74,169, 77, 81,128,235, 92,
- 1, 44,118, 17,223,164,159,131, 46, 72,139,187,110, 26,234,116,109,236,160, 72,140, 27, 28,217,228, 39, 24, 7, 57,147, 33, 16,
- 24, 96, 7,240, 79, 2,242, 75, 2,242, 75, 6, 28,112, 37,131,132,195,115,222,170,180,102,209,159, 70,225,231, 56, 14, 42,149,
-234, 40,234,162, 64,202,104,240,245,170, 0, 91,143, 92, 64,181,213,142, 7, 18, 71, 65, 45,180,142, 8, 62,220,172, 87, 72,175,
- 14,199,101, 91,147,165, 67, 41,236,162,204,238,214, 45, 59,180, 36,124, 89,250,134,240,101,233, 27,116, 21,126,183, 1,200,105,
-221, 13,224,198,107, 17, 96, 15, 33,166,222, 7, 96, 0, 84,138,120, 93,135, 10,208, 16,251, 95, 60,205,117,238,168,249,250,145,
-240, 19,184,250,232, 9,193,134,226,129,141,215, 14, 92, 52,255, 43,250,119,135,247, 56,201,249,171,251, 37, 66, 88,178,139,216,
-139, 79,229,229,169,207,205, 43,212,127, 72,125,221,106, 20, 17,187,142, 20,224, 82,137, 9, 7,207, 26, 48, 49, 54, 10,113, 3,
- 35, 92,150, 9, 11,240,195, 93,195,154,150, 24,126,109, 28, 8,153, 17, 88, 37, 88, 95,218,102,220,233, 70,188,170, 92,156,243,
-243,149, 74,164,148,130, 82, 10, 73,146, 56, 0, 13,221,139, 31,234,204, 57, 5, 62,140,110, 29, 7,248,226, 64, 22, 24, 3,146,
- 70, 14, 64,102,126,137,219,114, 19,131, 42,241, 13,234, 82,142, 92,117,248, 97,127,101, 36, 2,107, 11, 47, 24,107, 36,171,171,
-242,140,161,159,139,211, 62,149,129,161,190, 7, 16,209, 52, 16,102, 82,196,235, 58, 82, 0,202, 24,214,255, 84,103,254,172,254,
-239, 81,172,254,239,209, 54, 74,107,157,142, 54, 24, 7,226, 94,114,165,202,221,130, 18, 2, 50,136,181, 30, 96,205,242, 86,165,
- 53, 68,128,154,251, 18,140, 49,112, 28, 39,214,215,169,168,136,214,117,166, 0,187, 78, 93, 70, 97, 69, 45,166,142, 26,128,219,
-199, 14,118, 95, 80,118,192,126,116, 45, 14,155,194,177,187, 50, 10, 0,240, 99,121, 95,220,168,209, 88, 40,165,173,166, 19,151,
-175,142, 15,102, 96,183,182,234, 21, 0,175,231,234, 87,169, 84, 78, 74,192,113,156, 67, 49,123,174, 83, 5,104,112,126, 95,186,
- 79,143,164,145,253,221,150,147,138, 78,192,106, 60,143,139,186, 64,236, 62, 86,167, 0, 14,198,225, 44, 63,108, 24, 33, 57,178,
- 11,211,226, 9,198, 16,220,178,195,225,101,124,233, 11, 21,216,208, 27,168, 84, 42,155, 90,173,110,112,128, 21, 92, 79, 78,112,
-121,141, 21,219,143,231, 98, 72,100, 8, 18, 71,244,111,219, 84,170,159, 1, 58,204,191, 22, 55, 7, 87, 52,158, 63, 45,247, 31,
- 76,235,167, 84, 54,160,236,195,201, 51, 24,195, 75, 46,140,162, 45, 97,191, 59,116,217,135,236,255, 82, 65, 16,120, 40, 19,225,
-174,207, 30,224,171,212,179,112, 72, 50, 22,221,114, 35,218,219,169,171,249, 26,128, 95, 70,229,227, 72,117, 56, 0, 32,207, 22,
- 36,124,241,127,250, 79,110,139,170,120,141,112, 40,231, 25,110,167, 12,207,160,117, 40,209,194,113,228, 89, 95,170, 68,158,231,
- 3,120,158,175, 97,140, 29,135, 50, 23,232,250,235, 1,214,238, 63, 13,142, 16, 44,186,165,253,125, 35,154,175, 2,251,121, 68,
- 33,252, 57,169,241,120,111,109,255, 49, 60,193, 55, 28,195, 62, 6,252,158,180, 22,126, 10, 66, 30, 14,123, 50, 45,223,199,234,
-145, 17, 66,168, 39, 54,234, 83,224,163, 61, 64, 65, 89, 53,118,158,186,132,242, 26, 43,178, 13,101,232, 23, 30,136, 31, 79,230,
- 1, 0,126, 54,113, 40, 98,194, 2, 91, 75,137,100, 3,173, 42, 64,165,164,198,119,165,117,243,128, 6,105, 45, 56,107,174, 51,
-241,183,148,246,199,232,128,186, 25,197,183,134,149, 96,160,159,197,201,125, 32,192,178,240,167,210, 55,249, 82, 5,138,162,216,
- 16, 2,149, 91,154,112, 10,254,135, 21, 32,203, 80,134,101,159,237,110, 60, 46,172,168,109, 60, 30,214, 55,204,165, 2,208,242,
- 92,128, 81, 20,219,253,240,252,197,113,173,174, 87, 75,170,198,243,159,141,202,104,174, 0, 57,132,224,255,133, 63,117, 40,181,
- 59, 5,247, 90,215, 6, 55, 68,128, 24, 99,168,239, 1, 20, 5,184, 94, 20, 32,126, 88, 52,118,252, 97,190,203,107, 99, 7,185,
- 30, 5,230,130,251, 65, 59,247, 3,140,112,200,216, 62,185,166,222,129,228,177,230,235, 31,109,135,207,228,173, 11, 12,208,156,
-126,112, 28, 25, 30,161,178, 15, 25, 27,100,178, 1,200, 97,132,238,235,243, 84,198, 94, 79,181,222,157, 77,141, 34, 73, 82,171,
-180,137,132, 16, 48,198,168, 44,203, 65,138, 72, 93, 39, 10,160, 11,210,226,150,209,157,219, 28,133,104, 67, 33,104, 39, 32, 4,
-192,173,131,155,206,127,191,245, 59, 57,220,116,225, 66,126,102,254,174, 63,236, 48,125,212,147,209,148,206, 78,140,115,151, 51,
- 84,201, 12,119, 29, 59,193,221,132,222, 46, 64,138, 2,244,214, 30,192,100, 50, 9, 25, 25,222,219,255,217,100, 50,241,132, 16,
- 42,203,178,220,197,239,247,106,254, 10,188,171, 0,198,226,226,226, 83,171, 86,173,226,237,118,123, 52, 99, 76,141,186,176, 30,
-234, 77, 17,214,204, 36, 97,132,144,198,255, 91, 94,115,119,189,197,189, 90,150,101,178, 44,203,146, 36,149,212, 59,145,157, 53,
-127,122, 59,127, 5, 94, 68,243,184, 53,167,211,233,150, 3,232,139,166, 44,103, 50, 99, 76, 34,132,200,140, 49,153, 16, 34, 53,
- 59, 71,155, 93,107, 56, 47, 19, 66,164,250, 4, 81,114,195, 53, 66,136, 76, 41,149, 90, 28,203, 13,118, 51,165, 84,146,101, 89,
- 98,140, 89,204,102,243,149,174,154,115,189,156,191, 2, 47, 43, 0, 9, 12, 12,140,230, 56, 78, 77, 8, 97,245, 19,189, 26, 91,
-185,134, 86,176,249,113,125,232,143, 1,128,195,225,112,106, 65, 9, 33,172,217,167,161, 44, 44, 22,139,211, 61, 56,142, 99,132,
- 16, 86, 89, 89,201,234,133,182,171, 51, 41,123, 59,127, 5, 94, 86, 0, 87,199, 29, 5,243,209,231,233,109,252, 21,244,180,192,
- 36, 37, 37,141, 22, 4,225, 17, 79, 12,227, 51,198,194,101, 89, 30,206, 24,123, 57, 37, 37,101,159, 39, 30, 64,225,175,240,191,
- 86, 5,184, 39, 38, 38,102,195,156, 57,115,186,117,137, 97,118,118, 54, 78,157, 58,133,200,200, 72, 24, 12, 6, 42, 73,210,180,
-148,148,148, 20, 15,188, 0,133,191,194,255,154,162, 64,136,142,142,182, 47, 92,184,176,219, 30, 96,211,166, 77, 48, 24, 12,120,
-244,209, 71,193,113, 28, 14, 30, 60,200,101,102,102, 30, 72, 76, 76, 76, 72, 77, 77,237,246,120,165,194, 95,225,223, 85,116,251,
- 64,152, 36, 73, 88,191,126, 61, 22, 44, 88,128,190,125,251,194,223,223, 31,137,137,137,136,139,139,227, 84, 42, 85,186, 94,175,
-159,232,203, 54,161,194,255,250,226,223,237, 10, 96, 48, 24, 16, 28, 28,140,136,136, 8, 8,130, 0,173, 86, 11,173, 86, 11,189,
- 94,143,145, 35, 71,114,106,181, 58, 67,175,215,199,249,234, 11, 80,248, 95, 95,252,187, 93, 1, 10, 11, 11,161,211,233, 26,143,
- 53, 26, 77,227, 67, 36, 38, 38, 98,248,240,225,188, 90,173, 62,145,144,144,112,131, 47,190, 0,133,255,245,197,191,219, 21, 32,
- 48, 48, 16, 86,171,115,118, 19,127,127,255,198, 79, 82, 82, 18, 98, 99, 99, 5, 63, 63,191, 44,189, 94, 31,235,107, 47, 64,225,
-127,125,241,239,118, 5,208,233,116, 48,153, 90,167,196,105,208, 98,173, 86,139,164,164, 36, 12, 28, 56, 80,165,209,104,206,234,
-245,250, 1,190,244, 2, 20,254,215, 23,255,110,223, 32, 35, 42, 42, 10, 53, 53, 53,176, 90,173,208,106,235,242,255, 84, 85, 85,
-161,180,180, 20,229,229,229, 40, 45, 45,133,197, 98,193,224,193,131, 33,138,162,250,234,213,171,231,245,122,253,144,180,180,180,
- 98, 95,120, 1, 10,255,235,139,127,183, 43,128, 90,173,198,248,241,227,145,147,147, 3,157, 78,135, 3, 7, 14,160,160,160, 0,
-177,177,177,136,138,138,194,208,161, 67,193,243, 60, 82, 83, 83, 97, 52, 26, 33,138,162,159, 70,163,201,211,235,245,131,210,210,
-210,188,158,237, 77,225,127,125,241,247,200, 22, 73,211,166, 77,195,167,159,126, 10, 81, 20,241,248,227,143, 99,230,204,153, 80,
-171,213, 78,101, 22, 45, 90, 4,147,201,132,117,235,214, 97,203,150, 45, 90, 74,233,155, 0,158,128, 15, 76, 75, 80,248, 95, 63,
-252, 61,178, 32, 38, 33, 33, 1,129,129,129,248,232,163,143, 48,123,246,108,183,171,168, 66, 66, 66,240,228,147, 79, 66,163,209,
- 48,171,213, 58, 54, 52, 52,180, 63,124, 32,177, 84, 75,254, 45, 43, 95,225,255,191,195,223, 35, 10, 16, 20, 20,132, 53,107,214,
- 32, 38, 38, 6,207, 62,251, 44,102,204,152, 1,135,195,225,182,252,144, 33, 67, 36,171,213,106,230,121,254,126, 95,120, 1,205,
-249,119, 4,189,141,191,217, 46,225, 82,105, 45,142, 95,174,192,190, 51,197,136,136,155, 70, 73,212, 40,191,136,184,169,207,196,
-175,248, 79,191,235,169,254, 61,182, 75,164, 32, 8,248,252,243,207,177,122,245,106, 0, 64,114,114, 50, 22, 44,112,189,251,145,
-159,159, 31,163,148, 74,140, 49, 13,124, 36,181,160,187, 94,171, 55,243, 63,122,169, 2,155, 50, 12,200, 41, 50,129,202, 82, 99,
- 90,119, 22, 54,158, 15,157, 50,118,124, 8,165,227, 41,149,151, 37,190,240,245, 22,202,196,215,210,255,184,232,244,255,122,253,
- 11,158,124,136, 63,252,225, 15, 0,128,216,216, 88,124,241,197, 23,110, 21,160, 25,122,251,146, 66,159,229,127,185,204,140, 55,
-191,205,134,192, 1, 49, 33, 26, 20,148,137, 96,148,130,177, 86, 31, 2, 70,231,129,146, 95, 76,126,118,253,188,140,119, 23, 37,
-119,250,189,111,248, 9, 89, 5,158,245,167,191,121,246, 94,168,120,238,154,235,223, 99, 10, 80, 84, 84,132,146,146, 18,188,249,
-230,155,120,238,185,231,176,120,241,226, 54,203,247,246,172, 10,190,206,255, 68,126, 37, 24,163,120,235,254, 9, 24, 17, 29,140,
- 63,109, 59,141,189, 89, 69, 96, 13,189, 64,227, 95,214,112, 76, 64,233, 59, 0, 58,173, 0,207,220, 61, 25, 14,201,179, 85,209,
- 82,248,187, 90,255, 30, 83,128,236,236,108, 68, 68, 68,224,217,103,159, 5, 33, 4,185,185,185, 46,115,234, 52,215,222,250,165,
-136,189,117,113,138, 79,243, 63, 83,104, 2,165, 20, 2, 87,103, 33,168, 56, 82,215, 3,180,248,180, 80,130, 27,110, 90,178,198,
-255,216, 63,150, 90, 58,243, 91, 57,133,229, 40,175,181, 94, 51,103,209, 97,119,235, 59,206, 26, 59, 24, 92,253, 18, 4,187,221,
- 14, 89,150, 57, 89,150,213, 0, 66,208,118,126,214,234,230,215, 59,164, 0,159,237,205,196,165,146,206,109,120,146,157,150,138,
-232, 81,147,240,202,198, 84, 72, 14, 59,206,156,191,136, 87,190, 78, 1,199,183,222, 56,239, 80, 77, 8, 95, 54,112,234, 72,235,
- 0,149, 86, 8, 31, 20, 13,144,118,133, 72, 82,227,143,248,114,101,165, 15,245, 0,180,190, 98,125, 50, 63,168, 67,148,193, 40,
-195,138, 47,143,162, 95,152, 22, 57,133,149,117, 2,207, 24, 24,163,160,204,165, 57, 4,217, 95,173, 6,208, 41, 5,200, 51, 86,
- 33,191,172,250,154, 57,239, 92,247, 49,210,183,111,236, 72, 81, 53,128, 59,235, 63,111,183, 83,246, 70, 0,103, 58,165, 0,250,
- 17,253,220,238,249,229, 14, 17, 86, 3,138,250,248,225,238, 73,195,240,233, 71,239, 33,208,223, 31, 63,143, 31,225,186,194, 82,
-183,211, 98, 83,126,161,228, 96,167,164,240,129,223, 18,158,111, 63,197, 96,165,214,210, 93,194, 65,171, 12,224, 66, 59, 54,162,
-110, 50,153, 96,179,217, 16, 21, 21,213,252, 52, 67, 83, 94, 32, 31,237,193,234, 4,221,108,151,113,174,200,214, 36,244,148,130,
- 82,230,214, 20, 2,215,249, 64,225,162, 91,110,236, 22,198,166, 67,201, 72,175,139,242, 32, 34,194,181,252,157, 57,115, 6,181,
-181,181, 13,141, 80, 25, 99, 44,215,205,237, 70, 1,173,246,153,232,152, 2,140,236,167,235,188, 61, 80, 58, 4, 63, 92,202, 65,
-148,202,129, 13,159,125,130, 25, 51,102, 96,242,176,104,151,101,163, 84, 14,234, 95,109, 40,179,150,151, 95,172,201,220,123, 8,
- 61,156, 98,220,113, 98, 61,184,136, 17, 80,199,253,162,221,178, 85, 85, 85,152, 59,119, 46,118,239,222,221,242,165, 80, 95,115,
-130, 25, 99, 16,229, 58,125, 92,126,199, 72,136,242, 8,103,253,100,117,255, 63,248,167,173,204, 14,129,184, 50,133, 0,128, 93,
-125,186, 97,177,139, 68,162,255, 42,181,247,187,203,255,189, 27, 39, 47,151, 92,187,227,158, 86,183, 59, 46, 55,106, 6,248,113,
- 83,157,174,237,122,105, 1,212, 2,143,105,211,166, 33, 61, 61, 29, 0,160,209,104,126,176,217,108, 15,187,145,159, 61, 0,102,
-244,152, 15, 48, 96,192, 0, 28, 59,118, 12,219,183,111,135,205,102,195,252,249,243,219,109,136,235,109,104,175,180,142,246,148,
- 15, 64, 56, 30,170,209, 63,111,183,244,217,179,103,113,199, 29,119, 96,231,206,157,232,211,167,143, 15,240,119,150,233,140,188,
- 10,164,158, 47, 65, 70, 94, 57,204, 86, 7, 40,149, 91,181,240, 78,231,160, 34, 13, 38, 80, 75, 83,232,181,159, 93,137, 4,112,
-174,241, 25,175,254,238, 44,152,188,140,196,172,118,155,175,245,131, 71,110,235,150,103,121,222,122, 18,239,103,236,192,138,123,
-226,241,240,195,191,236,136,194,119,186,225,236,144, 2, 56, 36, 25,148,117,174,103, 55,219,108,216,187,119, 47,100, 89, 70,100,
-100, 36,102,205,254, 25,108,162,228, 38,118, 72, 64,121, 1,208,104, 57,220,189,212, 15,186,232,246, 31,100,237, 43,246,142,248,
- 10,157, 81, 2,219, 79,127, 5, 8, 15,213,168,187,218, 45,157,149,149,133, 59,239,188, 19, 59,119, 54,238,236,234, 19, 81,160,
- 79,246,229,226,199,204,162, 38, 97,111, 33,216, 77, 2,206,156,237,125, 23,166, 80,235, 42,162, 28,152,116, 35,152,252, 29, 51,
- 44, 25, 72, 6,252,163,194, 21,135,175,211,114, 96,232, 6, 31,224,104,110,221,252,182, 31, 79, 94, 66,217,119,206, 43, 33,127,
-119,215,205,224,185, 86,238,150,103, 20,224,181, 77,169,157,138,235, 58,204,213, 72, 91,243, 18, 26, 50, 5, 14,152,181, 24,143,
-253, 99,143,251, 22,181, 50, 92, 85, 26, 59,123,170, 72, 84,163, 4, 77,240, 47, 96,110,223,142,150, 22,190,189, 24, 27, 96,236,
-238,158,192,118,224,207, 0,199, 67, 53, 98,118,187,165, 51, 51, 51, 49,123,246,108, 76,154, 52, 9,245,137,182,188,170, 0, 57,
- 87,107,240,227,233,171,237, 10,182,187,191,172,222,236,113, 45,252, 18,192,228,186, 15,149, 2,192,228,223, 0,120,195,165, 73,
- 27,226,223, 24,161,185, 22,204,152, 53, 27, 67, 6, 13, 68,220,164,201,232, 31, 17,210, 34,232,224,218,138,104,227,118, 31, 3,
-216, 6,160,184,211, 10,240,214,194, 91, 58, 69,124,225,194,133,176, 86,214,217,128, 43, 86,172,192, 27,111,188,209,102,249,167,
-159,126,218,177,235,232,174, 93,165,165,165,187, 42, 42, 42,190,132, 87,183, 25, 98,176,237,255, 35, 8,199, 67, 24, 62,171,221,
-210, 39, 78,156, 64, 97, 97,161, 42, 40, 40,136,247,182, 15,176,247,140,177, 93,193,102, 45,206, 57,149,173,239, 33,154,161,118,
-214,232,138, 64, 48, 9,160,178,179, 18, 48,233,255,220, 41,192,164,161,125, 33,201,215,254, 10,111, 31, 59, 8,192,189, 46,175,
-185, 81,176,182, 26,206, 45, 93,238, 1, 58,131, 77,155, 54, 97,243,230,205, 0,128,233,211,167, 99,220,184,113, 29, 14, 35,250,
-130, 13, 93,223,213,195,186,247,109,104, 9, 15, 97,216,204,118,139,151,148,148,112, 85, 85, 85, 51,181, 90,237, 78,111,210, 46,
- 40, 51,183, 22,108, 39,211,135,181,109, 10, 81,218,232, 24,215,139,211, 14, 63, 34,198,131,214, 11,190,179, 18,244,101,185,247,
- 69, 76, 93, 92,236,210, 98,200,204,247,236, 72,240,182, 23,230, 65, 45,240, 61,227, 3,116, 20, 70,163, 17,203,150, 45, 3, 0,
- 60,245,212, 83, 88,190,124, 57,222,127,255,125,220,119,223,125,237, 9,191,207,216,208, 78, 74,176,231, 13,104, 57, 30, 66,236,
-244,246,205, 62,135, 35, 66,146,164, 21, 0, 54,163,110,176,165,199, 81,108,178,180, 22,236, 86,145,157, 54, 76, 32,103, 63,239,
-220,188,201,149,175,129,138, 59,235, 91,252,230, 38, 80,195,255,195, 93,241,248,243,131,183,122,235,173,121, 70, 1, 58, 58, 16,
-182,229,253,151, 80, 94, 94,142,126,195,227,224, 55,241,110,124,188,247, 44, 54,126,247, 3, 28, 3, 39, 35,172,175,251, 73,134,
-233, 53,193, 66,241,128, 91, 38, 89, 7,106,116, 66,112,244, 77, 62, 51, 16,198, 40,172,187, 95,131,246,118, 30,194,144,169,237,
-215, 62,165, 35,234,237,204,159, 1, 48,247,228,155,183,139, 50,202,170,173,109, 10, 56, 24,197,168,126, 97, 24, 30, 19, 10,127,
- 53, 95,175, 36, 12,187,247,236,145, 10,140,101,217, 18,175,189,164, 14, 31,144, 77,128,172,111,127,115,246,252,128, 80,219, 23,
- 96, 82,180,139,214, 31,245,102,209, 48, 87,202,254,238,119, 25, 56, 95, 84,225,209,231,253,248,241, 89,174,230, 2,121, 70, 1,
-166,223, 56, 16,147,134, 58,218,142,138,156, 58,129, 11,199,211,160,235, 19,129,127,253,123, 45, 34,162,250,226,245,149,207,162,
-164, 32, 23,255,120,254, 33, 68,247,235,143, 71,150, 62,137, 95, 44, 92,212,186,235, 78,219, 78, 75,170, 46, 94,144,236, 72,167,
-129,186,253,224, 85,237, 63,136, 40,246,140,128, 81, 25,214, 93,175, 64,123,199, 27, 16, 6, 37,118,228, 27,183,212, 43,193, 28,
- 0,214,158, 82, 0,158, 35, 0, 99,110,109,252,176, 64, 53,126, 63,111, 18,110, 30, 80, 14, 34, 93, 6, 88,211,134,246, 55,251,
-149, 18,201, 94,174,234, 19, 74,252, 71, 13,171,138, 38,160,119,130, 74,227, 65,101,190,141,214, 31, 96, 82,128, 43, 5, 88,144,
- 56, 10, 86,187,103,115, 4, 11,174, 7,232,152, 71, 20, 32, 54, 42,180,221, 50, 23,143,213,201,227,250,117, 95, 96,230,228,177,
- 88,191,126, 61,190,251,230,171,198,235, 87, 11,175,224,237,151, 95,192,200,193, 49,120,224,129, 7,156,190,219, 71, 37,202, 1,
-181, 87, 75,106,141,198,139,181,153,123, 79,194,215,246,218,165, 18,172, 59, 95,134,118,214,155, 0, 58, 52, 71,253, 86, 0,223,
- 1,184, 27,128,173, 39, 40, 10, 60,135,240, 0, 21, 74, 76, 98, 43, 27,159,128,225,181, 7,166, 96, 92,216, 15,224,106,178, 90,
-125, 87, 63, 30, 60, 88,232,104, 80,121,180,139, 86, 30,173,148,160, 73, 17,114, 80, 55,247,198, 9,102,155, 3,213, 86,199,255,
-142, 9,212, 17,148,151,151, 35, 52, 52, 20, 51,103,214, 57,141,111,189,245, 22,198,141, 27,135,249,243,231, 35, 47, 47, 15, 35,
- 71,142,196, 59,239,188,131, 23, 95,124,177,149, 2, 52,115, 96,124,119, 54,168, 44,194,150,242, 30,144,240,118, 71,191,113, 27,
-128,135, 0,252,163,167, 40,246, 13,209,194, 88, 89,219,202,244,153,114, 67, 20,198, 70, 21,128,171,205,114,209,102,182, 16,112,
- 87,166,142,203,243, 50, 64,165,179, 0,166,180,188,229,206, 83,151,112,161,216,179,214,233,196, 33, 81, 16,122,202, 4,170,181,
- 57,218, 13,107,197, 12, 28,140, 81,163,111, 68,149,217,134,146, 18, 35,114,115,115,241,205,214,239, 16, 63, 37, 1,143, 62,180,
- 8,171,222,125, 15, 34, 5,126,191,226, 57,100,229, 92, 64,255, 1, 77,115,111,236,148, 16, 89,229,175,146, 2,250,248,225,230,
-135, 67,161, 13,110,255, 65,198,163, 26,175,190,218, 99, 61, 5,231,175,131,118,206,187, 40, 55,117,184,151,125,191, 39,133, 31,
- 0,134, 68, 4,226,100, 94, 73,171,112,231,232, 1,225, 32,226,233,214,214, 66, 91,173, 60,117,161, 4,206,231,175,144,184,148,
-226,164,164,164, 86, 60,150,253,108,146,119,226, 22,158,138, 2,253,101,219, 17,100, 27,218, 14,107,201, 14, 59, 78, 95,184,132,
- 37,107,118,128,202, 18,180, 33, 58,124,145, 85,131,245, 57,251,144,117,165, 2, 75,214,236,128,100,139, 0, 39,168,240,252,231,
- 59, 17, 24,209,228, 20,103, 85,135,169,138, 7,207,184,205, 65,212, 99, 4, 77,224, 67, 29,114,130, 79, 9, 75, 0,148,244,152,
-240,207,253, 0, 92,232, 64,192,148,223, 81,225,255, 93, 79, 11,192,188,248,193,248,238, 72, 30,100,217, 57,220, 25,232,167, 2,
-161,181, 78,206,125,199, 90,249,230,202,209,226, 26,240, 23,119, 60,126,253,207,157, 56,158,231,217, 44, 43, 7,223,248, 85,171,
- 48,168,199,122,128, 87,238,239,144,243,135,249,199, 55,227, 47,247,223,132, 1, 3, 6,224, 29,249, 34,180,154, 34, 44, 95,190,
- 28,203,243,247,225,165,135,146,224,231,231,135, 81,127, 95,129,109,111, 62, 1,190,217,180,232,103,158, 57,232,216,115,108, 79,
-178,209,104,252,161,188,188,124,191, 47,249, 0, 78,194,223, 49,124,224, 13,225, 7,128,200, 16, 45,102,143, 31,128,173,135,115,
-157, 28, 96,231, 9,112,157,106,229, 91, 40,135,220,240,106, 74,219,234,221,254,254,248, 44,175,188,171,102,251,187,245,188, 15,
- 0, 0,127,255,251,223,241,252,243,207,227,239,127,255, 59, 94,120,225, 5, 36, 39, 39, 67,146, 36,140, 27, 55, 14,199,143, 31,
- 71,126,126, 62,238,184,227, 14, 39,225,111,230,189,203,148, 82,159,154, 78,220, 89,225,231,121,254, 27, 89,150,127,231, 77,206,
-191,190, 35, 14,126, 42, 14, 7, 78, 27, 80, 92, 89, 11, 6, 82, 63,106, 74, 1, 38,186,108,229,101, 81, 6,152, 36, 19, 34, 83,
- 14, 50,117,171, 4,117, 14,253, 81, 0,207,146,184, 84,183,211,209,119,158,186,132, 18,147,197,163,207,185, 48,105,116,171,185,
- 64,245, 38, 16,243,154, 2,232,116, 58,188,248,226,139, 88,185,114, 37,238,186,235, 46,220,123,111,221, 48,246,152, 49, 99,240,
-250,235,175,227,198, 27,111,196,154, 53,107,220,105, 47,245,165,129,176,206, 10,127, 80, 80,208, 17,149, 74,245, 65, 69, 69,133,
- 87,121,171, 4, 14, 75,102,197, 97,201,172, 22, 9,148, 77,123, 1, 42,186, 52,117,254,181, 45,216,158,113,228,196,231,209, 97,
-214,159, 94,249, 77,255,227, 42,158,177,102,189,193,121, 18,119,176, 83, 61,178, 40, 83,183, 19, 31,123,101, 20,232,147,157, 39,
-144,107,172,234, 56,139,209,183,227,131,173, 7,241,202,223,214,163,232, 66, 54,170,203,141,144, 28,118,140,184,255,183,120,225,
-203,159, 90,219,115,213, 33,234, 43, 3,111,157,105, 25,172, 29, 42,248,135,221,215,145, 69, 85, 18, 52,175, 99,211,211, 21,190,
- 32,252,227,198,141,147, 36, 73,218, 89, 88, 88,232, 91,225,219, 22,161,220,186, 86,189,181,169,179,244,238, 18,205,210,187,162,
-150,128,201, 75, 90,181,254, 96, 97, 0,170, 58,243, 83,115, 38, 14,245,150, 19,236, 25, 19,104,214,184, 33,168,181,117, 50,174,
-123,155,243, 62, 6, 75, 23,221,143,135,166,141,113, 89,180,228,200,143, 82, 85,213,197,147,146,168, 74,113, 12,158,156, 5,194,
-117,224, 65,170,107,125, 65,248,151, 45, 91, 6,198,152, 99,223,190,125, 62,190,168, 95,114,107, 2, 57, 69,129, 84,209,102, 16,
-129,192,122,222,191,203,102, 88, 39,157,224,221, 47, 63,128, 32,173,218,119,123,128,142, 12,132,181,135, 49,163, 70, 96,236,160,
- 72,151,215,250,168, 68, 57,168,182,176,168,186,176,240,172,249,232,182,147,222,242, 3,186, 34,252,239,190,251, 46,158,121,230,
- 25,230,107, 38, 92,235,214,145, 7,105, 48,129,220,216,248,148,105,109, 92,236,218, 0, 16, 14,184,176,160, 22,142, 66,127, 0,
-246, 78,251,130, 94,114,130,225,205,129,176,230, 56,113,226, 4,190,252,242, 75, 76,157, 58, 21,115,231,206, 5, 0, 12, 29, 58,
- 20,178, 44,187,114,128, 27, 39,195,213, 59,193,232, 77,194,239, 43,252,219, 85, 0,213, 96,192,156,222,102,180,135, 48,137,135,
- 92, 13,112, 26, 64,174, 38, 0, 78,146,184, 84,171,175, 61,203,246,237,219, 81, 88, 88, 8, 0, 40, 46,110,234,105, 40,165, 19,
-209,148, 31,116, 63,128,156, 30, 87, 0, 74, 41,230,205,155,135, 43, 87,174,224,227,143, 63,198,241,227,199, 49,114,228, 72,132,
-132,132,192,106,181, 34, 48, 48,208,149,237,230, 85, 39,152,248,247,233,178,240,251, 2,255, 14,189,151,192, 89,224, 44,135, 64,
-172,103, 93,155, 64,160, 32,128, 10,231,127,110, 7, 56, 6, 38,137, 0,150,250,226,179,172, 94,189, 26,251,246,237,115, 37,123,
-115, 80, 55, 7, 11, 0, 30,243,138, 2,212,214,214,226,202,149, 43,141,202,208,208,226, 23, 23, 23, 67, 20, 69,119, 17, 32, 48,
-198,168,220,176,132,172,135,161,185,249, 49,128,227, 59, 84,182, 95,191,126, 78,194,239, 11,252, 59,166,229, 42, 72, 81,175,131,
- 51,167,129,171, 88, 7, 98,191,220,220,209,109,214, 26,201,118, 64,126, 15,192,123, 36, 46,213,228,139,143,242,231, 63,255, 25,
-149,149, 77, 83, 45,254,246,183,191,217, 14, 31, 62,188,174,180,180, 52, 77, 20,197,252,250, 7,202,233,200,189,186, 93, 1,130,
-131,131,113,251,237,183, 35, 59, 59, 27,159,127,254, 57,134, 15, 31,142,140,140, 12, 24,141, 70,132,133,133,185,127, 63,222,204,
-172,214, 65,225, 7,220,231,172,236, 29,153,237, 8,104, 64, 34,104, 64, 34, 32, 87,129, 56, 10, 64, 28, 6,108,217,188,209,158,
-151,119,225,115,115,109,229, 87, 99,134, 9, 63,205,127,250,156, 79, 63,199,216,177, 99,157,142,183,109,219, 38,231,230,230, 94,
- 48,155,205,135, 76, 38,211,185,206,248,144, 30,241, 1, 54,110,220,136,215, 94,123, 13,159,125,246, 25,190,255,254,123,232,116,
- 58,124,240,193, 7,237,125,173, 87,167, 70,236,117,252,249, 80, 48,109, 40,152,118, 44, 82,206,236,147,246,239,207, 62, 87, 80,
- 80,126,165,170,170,138, 94, 79,245, 47, 0,128,201,100, 18, 50, 50,186,119,255,228,150,171,192, 78,158, 60,233,182,172,201,100,
-226, 9, 33, 93, 54, 33, 60,193,191,147,191,175,240,239,165,252, 5, 0,198,226,226,226, 83,171, 86,173,226,237,118,123, 52, 99,
- 76, 13,128,213, 71, 54, 88,179, 15,234,207, 55,254,223,242,154,187,235, 45,238,213,178, 44,147,101, 89,150, 36,169,164, 62,189,
- 96,103, 67,160, 10,127,133,127,151,249, 55, 31,114,229,116, 58,221,114, 0,125,209,148,229, 76,102,140, 73,132, 16,153, 49, 38,
- 19, 66,164,102,231,104,179,107, 13,231,101, 66,136, 84,191,184, 93,110,184, 70, 8,145, 41,165, 82,139, 99,185,193,110,166,148,
- 74,178, 44, 75,140, 49,139,217,108,190,210, 85, 75, 94,225,175,240,239, 44,255,230, 10, 64, 2, 3, 3,163, 57,142, 83, 19, 66,
-152, 74,165,130, 40,138,141, 90,214,160,133,205,143,235, 67,127, 12, 0, 28, 14,135,147, 6, 19, 66, 88,179, 79, 67, 89, 88, 44,
- 22,167,123,112, 28,199, 8, 33,172,178,178,146,213, 87, 90, 87,215,210, 41,252, 21,254,157,230, 79,218, 57,238, 40,124,101, 6,
-167,194, 95,225,223, 35,132,187, 5, 73, 73, 73, 2,128,217, 28,199,221,247,211, 79, 63, 45,238,109, 97, 7,133, 63,144,148,148,
- 52, 90, 16,132, 71, 8, 33,221, 46, 75,140,177,112, 89,150,135, 51,198, 94, 78, 73, 73,217,231,137, 58, 16,186,169, 34,251, 1,
- 40, 79, 73, 73,177,117,176,252,120,181, 90,189,132, 49,246, 43,157, 78,199,149,149,149, 9, 0, 22,123, 81, 16, 20,254, 93,231,
-127, 67,100,100,228,147,115,230,204,241,235,206,103,202,206,206,198,169, 83,167, 16, 25, 25, 9,131,193,176, 59, 41, 41,105, 90,
- 74, 74, 74,138,207, 40, 64, 82, 82, 82, 8,128,121, 90,173,246,215, 14,135, 99,188, 32, 8, 59,146,146,146,230,166,164,164, 48,
- 55,229, 35, 57,142,123, 80,173, 86,255,159, 32, 8, 81,241,241,241,154, 73,147, 38, 9, 90,173, 22,111,190,249,166,205, 11, 66,
-163,240,239, 38,254,209,209,209,246,133, 11, 23,118,155, 2,108,218,180, 9, 6,131, 1,143, 62,250, 40, 56,142,195,193,131, 7,
-185,204,204,204, 3,137,137,137, 9,169,169,169, 25, 94, 83,128,164,164, 36, 53,128,217,126,126,126, 75,101, 89,158, 62,108,216,
- 48, 41, 62, 62, 62,104,232,208,161, 88,179,102,205,173, 37, 37, 37,239, 2,120,166, 69,249,185, 90,173,246, 73, 73,146,226,227,
-226,226,104,124,124,188,255,224,193,131, 27, 38,144,193,106,181,246,164,208, 40,252,189,200,191, 35,144, 36, 9,235,215,175,199,
-210,165, 75, 17, 22, 22,134,218,218, 90, 36, 38, 38,130, 82,202,101,101,101,165,235,245,250,155,211,210,210,142,247,152, 2, 36,
- 37, 37, 17, 0, 73, 26,141,230, 49, 74,233,188,190,125,251,202, 83,166, 76, 9,137,139,139,131,159, 95,147,210, 63,246,216, 99,
- 1,239,189,247,222, 19,183,220,114, 75, 14,165,244,148, 70,163, 89, 74, 41,157, 31, 19, 19, 67, 19, 18, 18,130,227,226,226,160,
- 82,169,188, 97, 30, 40,252,189,200,191,179, 48, 24, 12, 8, 14, 14,110,220,124, 68,171,213, 66,150,101,232,245,122, 72,146,196,
-229,228,228,100,232,245,250,241,105,105,105, 89, 30, 85,128,122,231,102, 49,199,113,143, 6, 6, 6,170,227,227,227, 3, 38, 76,
-152,192,135,132,132,184, 44,239,239,239,143, 37, 75,150,248,175, 94,189,250, 35,173, 86,235,152, 50,101,138,118,226,196,137,124,
-104,104,104,183, 85,206,244,233,211,251,216,237,118,154,158,158, 94,209, 1,193, 81,248,123,145,127, 87, 81, 88, 88, 8,157,174,
-105, 71, 34,141, 70, 3, 89,150, 33,203, 50, 18, 19, 19, 33,203, 50,127,225,194,133, 19, 9, 9, 9, 55,166,167,167,159,239, 86,
- 5, 72, 74, 74,138,225, 56,238, 87,106,181,122, 9,199,113, 49,147, 38, 77, 18,110,186,233, 38,117,223,190,125, 59,116,179,136,
-136, 8,172, 92,185, 82,237,239,239,175,238,206, 74, 73, 76, 76, 28, 17, 16, 16,176,210,110,183,223, 86, 93, 93, 29,219,134,208,
- 40,252,189,200,191, 59, 16, 24, 24,216,202, 44,243,247,247,111,220,212, 59, 41, 41, 9,178, 44, 11,151, 46, 93,202,210,235,245,
- 35,211,210,210,242,186, 69, 1,146,146,146, 18, 4, 65,216, 59,102,204, 24,122,243,205, 55,251,199,198,198,162, 43,145, 45,127,
-127,255,110,171,140,169, 83,167, 78, 11, 8, 8,120,153, 82,154, 16, 16, 16,160,150,101,249,163,236,236,108,135, 27,225, 81,248,
-123,145,127,119, 65,167,211,193,100,106, 61, 11,187,193, 20,146,101,185, 65, 9, 84, 5, 5, 5,103,245,122,253,176,180,180, 52,
-195, 53, 43,128,159,159,223,107,208,238,250,153, 0, 0, 20,252, 73, 68, 65, 84,119,222,121,167, 58, 33, 33,129,131, 23, 49,125,
-250,116, 65,150,229,251,252,253,253, 95,241,247,247,239,255,224,131, 15, 6, 76,159, 62,157, 44, 88,176,192,102,177, 88, 62,114,
-247, 61,133,191,119,249,119, 23,162,162,162, 80, 83, 83, 3,171,213, 10,173, 86, 11,160,110, 99,194,210,210, 82,148,151,151,163,
-180,180, 20, 22,139, 5,131, 7, 15,134, 40,138,234,171, 87,175,158,215,235,245, 67,210,210,210,138,187,172, 0, 73, 73, 73, 35,
- 1, 36, 77,154, 52,201,107,149, 31, 31, 31, 31,172,209,104,150, 8,130,176, 98,232,208,161,154,135, 30,122, 40,104,202,148, 41,
- 32,132, 96,247,238,221, 16, 4,225, 84,122,122,250, 69, 55,173,167,194,223,139,252,187, 19,106,181, 26,227,199,143, 71, 78, 78,
- 14,116, 58, 29, 14, 28, 56,128,130,130, 2,196,198,198, 34, 42, 42, 10, 67,135, 14, 5,207,243, 72, 77, 77,133,209,104,132, 40,
-138,126, 26,141, 38, 79,175,215, 15, 74, 75, 75, 43,237,146, 2,104, 52,154,151,166, 78,157,170,242, 70,148,160,186,186, 26, 28,
-199,169, 2, 3, 3,139, 38, 79,158,140, 95,253,234, 87, 1, 55,220,112,131, 83,153,111,190,249,166,166,182,182,246,207,238,238,
-161,240,119,195,205, 38,225,167,139,165, 40,169,113, 64, 45,112, 80,243, 4,106,158,131, 70,224, 48, 97, 64, 40,250, 6,251,117,
- 11,255,238,198,180,105,211,240,233,167,159, 66, 20, 69, 60,254,248,227,152, 57,115, 38,212,106,103,183,102,209,162, 69, 48,153,
- 76, 88,183,110, 29,182,108,217,162,165,148,190,137,166,245,192, 29, 87,128,164,164,164,104, 74,233,189,122,189, 94,232, 73,193,
- 41, 44, 44, 68, 74, 74, 10,206,157, 59,135, 57,115,230,240, 11, 22, 44, 8,136,140,108,157, 53, 34, 63, 63, 31, 5, 5, 5,148,
-231,249,111,221,180,158, 94,231, 63,243,206,159,241,139,127,249,128, 79,240,183, 75, 20,169,121,229,216,157, 83,130,140,252, 74,
-136,110,146, 26, 19, 0, 3, 53,118,220,104,207,198, 67,119, 37,240,183,205,127, 34, 32, 50, 50,170,211,252, 61,129,132,132, 4,
-124,253,245,215,120,227,141, 55, 16, 19,227, 62, 29,125, 72, 72, 8,158,124,242, 73,108,223,190,157,213,212,212,140, 13, 13, 13,
-237, 95, 85, 85,117,165, 51, 74, 32,168,213,234,231,110,186,233, 38,174, 59,157, 39,119, 96,140, 33, 39, 39, 7,169,169,169,168,
-172,172,196,125,247,221,135,215, 95,127,189, 77,199, 45, 57, 57,217,193, 24, 91,179,127,255,126,201, 77,151,233, 85,254,137,243,
- 30,197,211,235,126,194, 61,178, 10,145, 94,228,207, 24,240,245,113, 3,214, 30, 42,128, 85,108,127, 93, 8, 3,144,111,215,224,
-151,131,181,184, 91,216, 3,203,119,199, 96, 31, 57, 3,252,144,169, 16,162,199, 55, 46, 19,109,143,191, 39, 16, 20, 20,132, 53,
-107,214,184, 93,126,218, 18, 67,134, 12,145, 12, 6,131,153,231,249,251, 81,151,152,184,227, 10,192,243,252,207, 39, 77,154,164,
-241,228, 3, 73,146,132, 99,199,142, 33, 45, 45, 13, 1, 1, 1, 88,184,112, 33,166, 77,155,230, 50, 69,138, 83,107,102,183, 99,
-231,206,157,212,106,181,254,205, 93, 25,111,242,207,200, 45,198, 93,171,190,129,213, 33,225,238,119,190,193,190, 87, 23, 34, 58,
- 44,176,199,249,151,155, 29,120,251,199,115, 56, 90,208,249,156,252, 19, 2,235,190,227, 47, 85,193,145,181, 5,200,218, 2,226,
- 23, 12, 97,144, 30,108,128, 30,251,246,180,205,223, 83,232,168,240,215, 7, 16, 24,165, 84, 98,140,105,208,201, 9,158, 2, 0,
-194,113,158,241,189,204,102, 51,210,211,211,113,248,240, 97,140, 26, 53, 10, 43, 86,172,232,240,174,145, 0,176,111,223, 62, 8,
-130,112, 36, 45, 45,173,173,156,228, 94,225,159,109, 40,195,188,119,183,194,234,168,107, 24, 11,202,170,113,239,159,147,177,243,
-165,249, 8,214,106,122,140,191,201, 38,225,183,155, 51, 81, 80,209,249,100,180, 4,192,248,160,214, 89, 15,153,173, 26,226,185,
- 29,192,185, 29,248,247,108,162, 82, 17,246, 23,242,192,148,100,104,196,239,195,151, 30,243,201, 76, 17,245,232,218,154,224,238,
- 70,105,105, 41, 82, 83, 83,145,153,153,137,105,211,166,225,195, 15, 63,196,128,102, 27, 98,116, 20, 61,237,124,117,148,127, 65,
- 89, 53,230,190,243, 13,170,204,206,115,200, 50,243, 75,176,240,253,109, 72,126,238, 94,168, 5,222,227,252,173,162,140,231,147,
- 79,119, 73,248, 1, 32, 86, 91,139, 16,161,237,245, 35, 42,142,241, 0,230, 49, 96, 58,236,170,229,229, 31, 76,249, 74,144,201,
-218,144,167,211,189,155, 5,152, 81,128, 52, 53, 28, 93,205,202,209,173, 10,144,151,151,135,148,148, 20, 20, 22, 22, 98,238,220,
-185,120,238,185,231,208,213,161,248,220,220, 92, 92,189,122, 85,140,142,142,254,111, 79,213,105, 71,248,151,152, 44,152,179,106,
- 19,174, 86,185,222,163,111, 95, 86, 62,150,124,178, 3, 47,222, 57,210,227,252,255,153,122, 25, 57,198,154,182, 91,121, 2,232,
- 71,244, 71, 76, 88, 0,204, 54, 17,149,102, 59, 14, 95, 40, 2,101, 12, 19,130, 42,219,234,151,144,122,133,179,199,199,208, 39,
- 52, 4, 7, 67,151,165,229,250, 66, 19, 79, 45,229,176,253,176, 18,204, 82, 6,245,228, 37, 80,141,184,163,177,245,175, 95, 74,
-217,233,244,232,215,180, 26,135, 82,138,204,204, 76,164,166,166, 66,150,101, 60,240,192, 3,184,253,246,219, 91,133,173, 58,139,
-173, 91,183,218, 41,165, 31,111,218,180,169, 61,173,238, 49,254, 53, 86, 7,238,249,211, 22,228, 22,183,157, 44,121, 99,122, 14,
- 12,185, 57,178,218,131,252, 47,150,214, 34,249, 84,161,219,235,129,126,106,172,184, 39, 30, 11, 18, 71,161,127,120,144,211,181,
-203, 37, 38,124,180,227, 56, 6, 95,106, 61,159,204, 6, 13,252, 96, 7, 24,197,153, 50, 97,227,220, 63,166,172,245, 37, 27,135,
- 85, 23, 65,174,200,173,219,179,109,223,219, 16,179,147, 17,227, 7, 82,191, 32,158,118,197, 7,232, 18, 28, 14, 7, 14, 29, 58,
-132,244,244,116,244,239,223, 31, 79, 60,241, 4,226,227,227,209, 29, 11,131,108, 54, 27,246,236,217,195,108, 54,219, 39,158,170,
-200,206,242,183,139, 50, 22,188,247, 45, 78, 94, 54,118,232,254,233, 37,224, 53, 33,137, 20,216,227, 17,254,255, 72,201, 3,117,
-163, 58,209, 97,129,216,242,236,189, 24, 55,216,117, 50,226,193,145, 33,120,247,161, 91, 81,242,229, 23, 78,155,156,214,112, 65,
- 8,162, 77, 61,202,226, 56,199,224, 23,124,204,200,231,251,142,129,118,214, 27,176,238,124, 9,144, 69,200, 37,103,241,255, 6,
- 16,149,223, 20,255,193,111,109, 39, 93,234, 1,186,132,109,219,182,129, 82,138, 85,171, 86, 97,248,240,225,221,250,144,123,246,
-236,129, 32, 8,169,169,169,169, 69,158,170,200,206,240,167,140,225,145,143,183, 99,127,118, 65,167,126,195,206,107, 95,230,231,
-175, 58, 39,111, 92,185,161, 59,185,151,155, 29,200,200,175,116,217,216, 13,208, 5, 97,247, 43, 11, 49, 64, 23,212,142,187, 40,
- 66,107,174,123, 30, 17, 2,100,162,114, 18,126, 0, 80,243,152, 90,249,158,126,124,216,239,210, 78,250,146, 18, 8,131,244,208,
-206,122, 3,182,157, 47,131,201, 14,240,132, 97,241, 36,191,113, 83, 6, 14,122, 88, 16,134,173,155,252,234,225,234,142,222,139,
- 67, 23,246, 21, 48,155,205,200,204,204,196,202,149, 43,187, 93,248, 27,156, 95,179,217,220, 81,231,209,227,252,151,125,182, 27,
- 91,143, 92,232,202,163, 16,194,176, 86,184,127,213,140,238,228,191, 35,171, 16,204, 77, 79,255,135,121,250,246,133, 31,128, 92,
- 94,103, 70,128, 87, 33, 48,225, 9,248, 49,215, 11, 99, 40, 47,223,235,139,225, 30, 97,144, 30,126,179,255, 8,162,210, 54,158,
- 27, 17,169,158, 52, 52,156, 28, 42,251, 48, 97,164, 71,123,128,163, 71,143, 34, 33, 33,161,205, 92,159, 93,197,185,115,231, 80,
- 82, 82, 98, 59,120,240,224, 78, 79, 85, 94,103,248,191,254, 77, 42, 62,219,155,121, 45, 63,167, 6,144,172, 90,240,206, 45,226,
-215, 47,156,234, 14,254,169,103, 93, 79,126, 28,216, 39, 24, 11,147, 70,119, 44, 94, 88,114, 6, 32, 28,180,183,191, 6, 97,112,
- 18,196,236,100,208,106, 23, 62, 5, 35, 9, 61,102,223,215,150, 64, 42, 60, 6, 72,118, 48, 89, 4,100, 7, 24, 21, 65,168, 4,
-230,176,130, 57,106,193, 28,181,128,104, 1,179,155,235,254,111,189, 51,234, 40,194,216,225,242, 15, 19,230,235,158, 74,255,177,
-219, 21,128, 82,138,140,140, 12,188,252,242,203, 30,169,132,173, 91,183,218, 68, 81,252, 0, 30, 74,149,209, 25,254,127,251,241,
- 56,222, 73, 62,212,120, 28,164, 85, 99, 70,220, 32,216, 68, 9, 63,158,188,228,186, 66, 9, 16,224,168, 56,100, 82,133,107, 0,
- 76,168, 63, 29,204, 40,251,193,239,129, 85,122,219, 87, 43, 47, 95, 43,255,203,149, 86,128,104, 91, 93, 91,116,203,141, 80,241,
- 29, 27, 83,160, 37,103,161,137, 95, 10, 97,112,221, 62,191,170,225, 51, 97, 63,246,133,139, 62, 12, 61,178,233,175,116, 97, 39,
-172,123,223,118, 37,208, 93, 65, 48, 24,219, 94,241, 97,252,178,240,167, 14,255,173, 61, 19,168, 83, 56,127,254, 60,130,130,130,
- 16, 23, 23,215,237,149, 96,177, 88,176,127,255,126, 56, 28,142,127,122,170,162, 59,202,255,235,180, 28, 60,183,110, 31,162,195,
- 2,241,248,109,227,240,237,138,121, 48,124,242,127,216,240,219,185,109,239,129, 69, 37,140, 40, 73,253,185,180,105,229, 68, 9,
-100, 16, 1,158, 2,176, 27, 64,164, 36, 99, 7,238,125, 91,119,173,252, 45,196,245,250,243,168,144,128,142,219,102,234, 0,168,
-199, 63,208, 36, 8, 49, 19,221, 21, 13,233, 9, 5, 16,207,239,236, 46,225,111,244,151, 25, 35, 31,151,127,144,240, 62,123,213,
-189,156, 11,157,221, 91,245,240,225,195,248,197, 47,126,225,145, 74,216,181,107, 23, 83,171,213,123,247,236,217,211,225, 13,176,
- 61,193,127, 87,230,101,252,117, 91, 6,214, 44,189, 19, 11,244,163, 58,220,170, 2, 0, 3,145,210,210,210,234,248,111,122,161,
- 64, 4, 62, 2,240,145,102,193,159,134, 74,178,252,172, 32,112,155,164,251,255, 58, 7,155,158,182,118,149,191,138,143,133, 67,
-110,253,181,176, 64,103,197, 56,124,161, 8,195,163,195, 17,222,226, 60, 24,133,122,226,131,206, 78,180,228, 54, 49, 4,199, 54,
-222,207,147,249,155, 60,154,249,218,111,198,139,144, 75,178, 1,209, 10, 38, 90,193, 28, 22,192, 81, 3,106, 53,129,150,157,131,
- 92,226, 58,221, 63, 31, 58, 16,124,248, 96, 64,208,128, 89, 42, 32, 22,157,172,223,240,163, 65, 64,216,242,242,176, 41, 67, 75,
- 62,246, 91, 24,249,155,253,181, 93, 54,129, 24, 99, 40, 47, 47, 71, 65, 65, 1,110,187,237, 54,143, 84,194,166, 77,155,204,213,
-213,213,239,122,196,190,236, 32,127,179, 93,132,192, 17, 28,122,251, 33,116, 37,162, 75, 9,231,114, 79, 45,251,215,207,231, 2,
-248, 53, 22,190, 21, 37,136,142, 9, 18,144,214, 85,254, 1,125, 71,194, 97,110,253, 51,205,103,126,214,218, 28,120,107, 75, 58,
-190, 91, 49,207, 69,171,193,129,248, 59,119, 68,204,230, 54,112, 34,226,204, 38,143,103,110, 35,218, 80, 8,131, 90,111,200, 46,
- 95,205,132, 53,111,127,171,243,170,126, 19,161,141,127, 28, 66,191,241,173,158,195,126,126, 39, 44, 41,171,235,156,124, 0,132,
-224, 46, 94,182,165,148,175,142,191, 75,183,236,240,149, 78, 41, 0, 99,245, 59,142, 51,134,195,135, 15, 99,214,172, 89,208,104,
-186,127,238,217,153, 51,103, 80, 85, 85, 85,147,154,154,186,175,187, 5,191, 51,252, 3, 52, 42,220, 26, 55,168,235,191, 7,210,
-246,172,201, 13,127, 48, 74,128,241, 90,248, 27, 11,131, 81,105,110,189,246, 99,219,145, 11, 88,152, 56, 10,140, 1,203, 63,219,
-141, 62, 65,218, 14,243, 46,185,120, 28,193,174, 47, 93, 32,175,194, 43,123, 6, 72, 23,247,192,186,239,237, 70, 65,110,236, 45,
-110,122, 8,254, 9, 75, 27,167, 66,156, 59,127, 6,102,179, 25,186,112, 29, 6, 13,138,133,223,216,251, 32, 68,220,128,154,237,
- 43,192,172,141,131,150,227, 0,238, 61, 0,247,119,216, 7,160,148, 54,174,195,180,217,108, 56,126,252, 56,238,185,231, 30,143,
- 60,236,150, 45, 91,172,162, 40,190,215,221, 14,111, 79,241,247,148,195,238,138,255,228,225,209, 46,203,239,204,188, 12,139, 93,
-196,239, 55, 28,192,134,212,179,152, 60, 44,186, 99, 74,230,176, 64,147,191,219, 77, 43, 79,206,244,248,131, 51, 10,251,225, 53,
-176,238,126,189,149,240,171,135,205,128,191,254,215, 0,225,112, 56, 35, 29,241, 79,188,138,184, 23,191, 67,252,170, 61, 24,246,
-220, 70,252,252,153, 55,112,241, 98, 14,132,232,177, 8,185,255, 95, 32,126,205,167,178,176,123,171, 62,156, 60,164,165, 2,180,
-138, 67, 55,175,248,134, 79,102,102, 38,134, 13, 27,134,254,253,251,119,251,243,214,212,212, 32, 53, 53,149,216,108,182, 79,187,
-214,200,123,151,255,181,119, 82,157,227, 63,101,120, 63,215, 65, 4,187,136,121,127,217,138, 15,182, 31, 5, 0, 76, 30, 22,211,
- 33, 2,181,199,191,130,134,147,220, 24,124,108,103,143, 42,189,185, 12,150,109,203,225, 56,241,159,214,129, 64, 65, 3,255,233,
-207, 2, 0,242,242,206,227,231,171,119,227,120,133,179,127,243, 95,131, 10,243,255,244, 21, 36, 81, 4, 23,210, 15,234, 33,122,
- 39,151, 65,166,252,114,183, 61, 0, 99,172,177,194, 37, 73,130, 36, 73,141,199,199,143, 31,199,188,121,243, 60,242,208, 59,119,
-238,132, 90,173,222,113,173,249,102,188,197,191, 59,205,181,142,240,159, 59,105, 24, 66,252, 93,155,113, 7,234, 71,171,181,106,
- 1, 99, 6, 69,180,111,102,228,167, 65, 62,245, 31,119,151,109, 68, 35,110,236, 49,147,231,202, 49, 88,191,121, 12,114,145,235,
-225, 18, 85,244, 88,112,218,186,177,155, 15,191,254, 14,229, 14,215, 75, 72, 79, 87,249,225,207,255,168, 11, 36,170, 6, 76,110,
-209,161,177, 71, 13,127, 77,208, 58, 41, 64,131,157,217,178,213,105,120, 17, 6,131, 1, 22,139, 5, 9, 9,221, 59, 38, 66, 41,
-197,158, 61,123,176,118,237, 90,212,214,214,190,123, 45,130,227, 13,254,221,237,167,116,148,127,144, 86,141, 71,110, 29,219,230,
- 61,199,235, 36,168,218,153, 30,239,200,254, 22,150, 31, 86,130,103,110,167, 68,127,213, 35,243,255, 25,133,253,216, 90, 88,183,
- 63, 3,106,117, 63, 67, 85,136,106, 26,228, 59,125,213,220,230, 45,243, 74,235,156,122, 97,192,205, 45, 47, 5,169,180, 36,168,
-185, 19,204, 26, 42,186,193,217,106, 72, 66,212,240, 57,113,226, 4,238,185,231, 30,116,215,194, 19, 89,150,177,107,215, 46,124,
-246,217,103,176, 88, 44,142,226,226,226, 45, 6,131, 33, 60, 56, 56,248,230,234,234,234, 35,157,173,190,158,230, 79,105,183,250,
-132, 93,226,255,200,140, 49, 88,179,235, 68,227,130,156,150,152,192, 95,132,121,227, 98, 8, 35,102, 67,125,195, 29, 32,129,117,
- 19,227,152,104,133,227,226, 62,148, 30,222,128, 16, 91,126, 91, 83, 39, 77, 50, 47,175,244,184,236,139, 86,216,118,189, 2,169,
-224,144,115, 67,205,171,193,192,156,124, 0, 90,219, 20, 29, 31, 18,174,193,129, 54, 18,161,140,111,152, 8,232, 98,108,193,223,
-108,111, 60, 41, 52,111,125, 26, 42,188,249, 75,176, 88, 44, 56,127,254, 60, 94,121,229,149,107,239,226, 36, 9, 63,252,240, 3,
-214,174, 93, 11,155,205,102,191,122,245,234,214,162,162,162,100, 74,105, 49,207,243, 70, 89,150, 75,174,165,245,236, 41,254,255,
- 90,191, 3, 16, 98,187,189,245,119,197,223, 84,107,198,169,220, 43,184,243, 87, 75,177,249,240,121, 28,207, 43, 70,218,185, 66,
-156,184,100,132, 67,114,223,194,223, 20, 84, 9,106, 42,130, 35,227,159,112,100,252,179, 46, 98, 66, 56, 48, 42,131,128,181, 59,
-186, 69, 8, 94,136,252,205,145, 98,143, 10,191,189, 22,214,255, 62, 7,217,152,237,252,219,193, 49,240,159,245, 38,236, 71,254,
- 5, 41,191, 41, 90, 44,149,158,107,252,255,233, 7,238,194,127, 94,217, 6,145,181, 86,225, 80,149,132,217,183,212,141,112,203,
-165,173,179, 39, 50, 78, 77,157,194,160, 45, 95, 64,243, 23,113,234,212, 41, 36, 36, 36,224, 90,114, 76, 58, 28, 14,124,255,253,
-247, 88,183,110, 29, 28, 14,135,173,168,168, 40,185,168,168,232,123,142,227,140,140, 49,163, 36, 73,198,170,170,170,210,107,105,
-145,123,146,255, 85, 41,226, 52,250,224,230,238,142,246,184,226,159,125,250, 52,134,198, 77,192, 15, 89,133,216,118,244, 34,174,
- 86,214,118,232,158, 55, 5, 87,180, 50, 51,192,104,135, 38,203, 51,134,191,233,150, 29,250,196,147,194, 79,173,149,117, 38, 79,
-153,115,170, 33, 97,144, 30,126, 51, 94, 4,209, 4, 66, 24,156,232,164, 0,114,121, 30,236,103,191,135,102,212, 93, 24, 53, 50,
- 14,219,127, 99,196, 67,255, 76, 69,177,189,105,237,198,208, 0, 59, 62, 91, 58, 3,177,177,117,169, 93,172, 39,190,108,249,211,
-162, 57,192, 97,115, 82,128, 6,123,179,229, 11,144,101, 25, 89, 89, 89,120,253,245,215,187,244,144,118,187, 29,223,126,251, 45,
-214,175, 95, 15, 89,150,109,133,133,133,155,141, 70,227, 14,198,152, 17,128,145,231,121, 99,121,121,185,241, 90, 43,179,167,249,
- 91,198,207,187, 25,232, 62, 5,104,139,127,118,214,105,188,254,250,235, 24, 61,122, 52,254,186,120, 6, 14,157, 47, 66,114,198,
-121,108,205, 56,143,194, 10,215,202, 16,163,177, 34, 90,109,235, 98,143,132, 47,117,149,135,158,242,104,203,111,173,130,245,219,
- 39, 65,171,154, 77,234,227, 4,104,110,126, 12,234, 9,191, 68,195, 8, 53, 63, 48,161,254,255,166,104,144, 53,245, 35,168, 98,
- 38,128, 11,233,135, 91,111,153,137,203,137,211,177,231,192, 30, 20,149,150, 33, 38,162, 15,110,155, 62, 19, 28,199, 3,140,194,
-146,178, 26,210,149, 99, 45,186, 54,124, 25,179,244,152,197,165, 15,208,210,254,204,203,203, 67,104,104, 40, 70,143, 30,221,169,
- 7,180, 88, 44, 72, 78, 78,198,134, 13, 27, 64, 41,181, 22, 20, 20,108, 46, 47, 47,223,205, 24, 51, 82, 74,141,130, 32, 24,203,
-202,202,140,232,194, 34,230,182,108,232,158,226, 79,253,195,251,121,194, 7,104,143, 63, 71, 8,244, 35,250, 65, 63,162, 31,254,
-180,232, 86, 28,201,189,138,228,140,243, 72, 62,124, 30, 5,101,213, 78,230, 79, 23, 32,130,177,223,235,150, 29,254, 11, 33,158,
-221,179, 75, 46, 60,234, 36,252, 92,200, 0,248,221,246, 50,248,136, 17, 78,229,184,128, 62,224,251,222, 8,185, 56,171, 89,207,
- 97,130,233,171,135, 17,112,219, 31,160, 30, 58, 29, 60,207, 99,214,140, 89,173, 76,171,218, 29, 47, 66, 44, 56,220,170,174,193,
-216,159,156,122,156,230,161,183,150, 54,232,153, 51,103, 58, 21, 58,172,173,173,197,230,205,155,177,113,227, 70, 80, 74, 45, 6,
-131,225,155,178,178,178,253,140, 49, 35,207,243, 70,198,152,177,170,170,202,136,174,239, 68,216,102,232,176,167,248,171,180, 33,
-241,221, 37, 34, 93,229, 79, 8, 48,121, 88, 52, 38, 15,139,198,170, 95, 78,195,241, 60, 35, 54,238,203, 64,114,250,105,140, 15,
-236,148, 2, 72,140, 97, 7,227,232,107, 17,203, 50,142, 98,185,231,163, 94,252,160, 68,240,125,199, 64, 46, 57, 11,213,136,217,
-208,232,159,116,154,215,223, 28,154,164,223,194,178,229, 9,128, 54, 57,251,204, 81,139,218,255,174,132,122,232,116, 8, 81,163,
-193,135, 15, 1, 9,208, 65,174,184, 12,185,236, 2, 28,185, 7, 64,171, 91,175,165, 98,192,247,125,150, 29,118, 26,216,115,235,
- 3,152, 76, 38, 20, 23, 23, 99,198,140, 25,237, 62, 80,117,117, 53,190,254,250,107, 36, 39, 39,131, 82,106,190,114,229,202,230,
-178,178,178,131,140, 49, 99,189,157, 95, 28, 26, 26,106,188,120,241,162,221, 35,246,164,194, 31,199,246,124,135,204,228,100, 12,
-161,212,188, 35,219,184,189,223, 56,106,191,101,120,224, 68,157, 63, 63, 26,196,133,233, 79,112,152, 49,178, 94,237,112,124, 21,
-252,236,177,178,158, 12,251, 18,149, 22,254,247,124,220,184, 32,167, 77,101,233,115, 3,212,147, 30,169,115,228, 91,250,102,185,
-251,225,200,221,223,193, 31, 37,121, 2,228, 86,234,237,214, 7,200,206,206,198,157,119,222,217,230,188,153,170,170, 42,124,249,
-229,151, 13,203, 11,107, 13, 6,195,230,170,170,170,180, 6, 27,159, 82,106,212,106,181,198,162,162, 34, 75,101,101,165,199, 42,
- 84,225,223,154,255,243,151,152, 81,150,139,140,235, 31, 25, 64, 18, 6, 5,106,136, 74,230,136,172, 34, 96, 50, 7,162,170, 10,
- 95,150, 82, 0,111,131,239, 88, 46, 84,205,132, 95, 1,142, 90, 56, 78,118,121,101,233, 41,153,147,238,212,185,136,106, 53, 42,
- 64,115, 27, 84, 20, 69,156, 63,127, 30,207, 60,243,140,203,187,149,151,151, 99,253,250,245,216,177, 99, 7,100, 89,174,169,175,
-248,140, 6,161, 81,169, 84,197,140, 49, 99, 69, 69, 69,173,171, 92,239,158, 16, 32,133,191,107,254,119,191,239,203,121,172, 58,
-218,101,112,208, 76,249, 53,248, 62, 55,192,182,255,143, 96, 82,167, 28,252, 20,162, 17,239,138,116, 51,160,215,202, 4, 98,140,
-225,226,197,139, 24, 49, 98, 4,250,245,115,246,245, 74, 74, 74,240,197, 23, 95, 96,247,238,221,144, 36,169,218, 96, 48,108,169,
-174,174, 62,202, 24, 51, 54,216,201, 0,140, 37, 37, 37, 61, 90,235, 10,127,239,242,239, 41, 8,195,102,194,191,223, 68,136,103,
-190,131,120,230, 91, 48,179, 91,203,205, 0, 32,153, 3,217, 18,218,183,127, 74, 91,107, 25, 4,198, 24,107,217, 5, 95,184,112,
- 1, 79, 61,213, 20, 9, 43, 42, 42,194,231,159,127,142, 3, 7, 14, 64,146, 36, 83,126,126,254,150,218,218,218,147, 13, 81, 17,
-158,231,141,146, 36, 25, 43, 43, 43,123, 60, 91,152, 87,248,203,220, 81,240,244, 53,215,132,136,205,231,249,247, 98,112,218, 48,
-104,110, 90, 12,205,132, 69,117,249,129, 28, 22,124,182,230, 67, 27, 45, 57,179,121, 76, 31,122,118,100,140,176,179,239,242, 35,
- 29,158, 77, 32, 16, 66,242,171,171,171, 71,134,133,133,129, 82,138,210,210, 82,136,162,136, 41, 83,166,192, 96, 48,224,223,255,
-254, 55,210,210,210, 32,138, 98,229,229,203,151,183,154,205,230,204, 6,231, 16,128, 81,150,101, 99, 85, 85, 85,153,183, 42,196,
- 27,252,197,205, 43,142, 2, 56,218, 91,249,255,111,104, 2, 15,190, 79,221, 96,215, 57,115,152,188,255,136,120,188,160,160, 96,
- 91, 85, 85, 85,167, 54,241, 16,236,118,123,106, 73, 73,201,204,254,253,251, 11,148, 82, 92,188,120, 17, 19, 38, 76,192,203, 47,
-191,140, 35, 71,142,192,110,183, 87, 24, 12,134,111,107,107,107,179, 8, 33, 37,168, 91,204, 97,228,121,222, 88, 82, 82, 98,244,
-118, 61, 40,252,189, 15,147,201, 36,100,100,100,120,243,247,121, 66, 8,149,101,185,243,185, 65, 25, 99, 25,121,121,121,246, 33,
- 67,134, 8,118,187, 29,121,121,121,200,207,207,135,205,102,107,168,248,179,205, 91,155,102,131, 88,212, 23, 42, 95,225,239,117,
- 24,139,139,139, 79,173, 90,181,138,183,219,237,209,140, 49, 53, 0, 86,159, 97,143, 53,251,160,254, 60,107, 10,203, 59, 95,115,
-119,189,197,189, 90,150,101,178, 44,203,146, 36,149,212,167, 71,236,212, 8, 13, 1,128,105,211,166, 61, 79, 41,125, 11,128,236,
-112, 56,106,138,138,138,182,213,214,214,158,227, 56,174,193,198, 44, 97,140, 21,215, 79, 91,144,224, 99, 80,248,251,134, 81,162,
-211,233,150, 3,232, 91,175,156, 50,234, 18,214, 74,132, 16,153, 49, 38, 19, 66,164,102,231,104,179,107, 13,231,101, 66,136, 84,
-159,228, 86,110,184, 70, 8,145, 41,165, 82,139, 99,185, 33, 35, 52,165, 84,146,101, 89, 98,140, 89,204,102,243,149, 78, 43, 64,
- 61, 84,225,225,225, 81,140,177, 48,142,227,180, 0,136, 44,203,118,142,227,202,195,195,195, 75, 60, 53, 8,212,141, 80,248,123,
- 57, 88, 25, 24, 24, 24,205,113,156,154, 16,194, 84, 42, 21, 68, 81,108,108,165, 27, 90,241,230,199,132, 16,218,208,226, 59, 28,
- 14,167, 30,128, 16,194,154,125, 26,202,194, 98,177, 56,221,131,227, 56, 70, 8, 97,149,149,149,172, 94,233,196,174, 42,128, 2,
- 5,215,172, 4, 93,181, 4,189, 69,248,255, 3,212, 21,184,121, 66,226, 69,162, 0, 0, 0, 0, 73, 69, 78, 68,174, 66, 96,130,
-};
-
diff --git a/source/blender/src/pub/license_key.c b/source/blender/src/pub/license_key.c
deleted file mode 100644
index 07e8296a185..00000000000
--- a/source/blender/src/pub/license_key.c
+++ /dev/null
@@ -1,447 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include "license_key.h"
-#include "keyed_functions.h"
-#include "BKE_utildefines.h"
-#include "BIF_screen.h" // splash
-#include "BIF_toolbox.h"
-#include "blenkey.h"
-#include <stdio.h>
-#include <string.h>
-
-#include "BLI_blenlib.h"
-
-#include "BLO_readfile.h"
-#include "BLO_keyStore.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-int LICENSE_KEY_VALID = TRUE;
-int I_AM_PUBLISHER = TRUE;
-
-static UserStruct User;
-
-// Python stuff
-
-#include "Python.h"
-#include "marshal.h"
-#include "compile.h" /* to give us PyCodeObject */
-#include "eval.h" /* prototype for PyEval_EvalCode */
-
-#include "BPY_extern.h"
-
-#include "IMB_imbuf.h"
-
-Fptr g_functab[PYKEY_TABLEN];
-Fptr g_ptrtab[PYKEY_TABLEN];
-
-static int g_seed[3] = PYKEY_SEED;
-static PyObject *g_module_self;
-static PyObject *g_main;
-
-
-// end Python stuff
-
-// **************** PYTHON STUFF **************************
-/* ----------------------------------------------------- */
-/* this is the dummy functions to demonstrate */
-
-int sticky_shoes(void *vp)
-{
- return 0;
-}
-
-/*
-int key_func1(void *vp) {
- printf("function 1 called\n");
-}
-
-*/
-int key_return_true(void *vp) {
- return 1;
-}
-
-
-/* ----------------------------------------------------- */
-
-/* Declarations for objects of type Fplist */
-
-
-static char prot_getseed__doc__[] = "";
-
-static PyObject *
-prot_getseed(self, args)
- PyObject *self; /* Not used */
- PyObject *args;
-{
- PyObject *p;
- p = PyTuple_New(3);
- PyTuple_SetItem(p, 0, PyInt_FromLong(g_seed[0]));
- PyTuple_SetItem(p, 1, PyInt_FromLong(g_seed[1]));
- PyTuple_SetItem(p, 2, PyInt_FromLong(g_seed[2]));
- return p;
-}
-
-static char prot_getlen__doc__[] = "";
-static PyObject *
-prot_getlen(self, args)
- PyObject *self; /* Not used */
- PyObject *args;
-{
- return Py_BuildValue("i", PYKEY_TABLEN);
-}
-
-static char prot_getptr__doc__[] =
-""
-;
-
-static PyObject *
-prot_getptr(self, args)
- PyObject *self; /* Not used */
- PyObject *args;
-{
- PyObject *p;
- Fptr f;
- int index;
- /* we don't catch errors here, we're in the key code */
- if (!g_functab)
- return NULL;
- if (!PyArg_ParseTuple(args, "i", &index))
- return NULL;
- if (index >= PYKEY_TABLEN)
- return NULL;
-
- f = g_functab[index];
- p = PyCObject_FromVoidPtr(f , NULL);
- return p;
-}
-
-static char prot_setptr__doc__[] =
-""
-;
-static PyObject *
-prot_setptr(self, args)
- PyObject *self; /* Not used */
- PyObject *args;
-{
- PyObject *p;
-
- int index;
-
- if (!g_ptrtab)
- return NULL;
- if (!PyArg_ParseTuple(args, "iO", &index, &p))
- return NULL;
- if (index >= PYKEY_TABLEN)
- return NULL;
- if (!PyCObject_Check(p)) {
- return NULL;
- }
-
- g_ptrtab[index] = PyCObject_AsVoidPtr(p);
- return Py_BuildValue("i", 1);
-}
-
-static PyObject *callkeycode(
- unsigned char *keycode,
- int keycodelen)
-{
- PyCodeObject *code;
- PyObject *maindict = PyModule_GetDict(g_main);
-
- code = (PyCodeObject *) PyMarshal_ReadObjectFromString(keycode, keycodelen);
- if (!PyEval_EvalCode(code, maindict, maindict))
- return NULL;
- return Py_BuildValue("i", 1);
-}
-
-
-
-/* List of methods defined in the module */
-
-static struct PyMethodDef prot_methods[] = {
- {"getlen", (PyCFunction)prot_getlen, METH_VARARGS, prot_getlen__doc__},
- {"getseed", (PyCFunction)prot_getseed, METH_VARARGS, prot_getseed__doc__},
- {"getptr", (PyCFunction)prot_getptr, METH_VARARGS, prot_getptr__doc__},
- {"setptr", (PyCFunction)prot_setptr, METH_VARARGS, prot_setptr__doc__},
-
- {NULL, (PyCFunction)NULL, 0, NULL} /* sentinel */
-};
-
-
-/* Initialization function for the module (*must* be called initprot) */
-
-static char prot_module_documentation[] = "No Documentation";
-
-static void init_ftable(void) // initializes functiontable
-{
- int i;
-
- g_functab[0] = &key_func1;
-/* add more key_funcs here */
-
- for (i = 1; i < PYKEY_TABLEN; i++)
- {
- g_functab[i] = &sticky_shoes;
- }
-}
-
-
-static void init_ptable(void) // initializes functiontable
-{
- int i;
-
- for (i = 0; i < PYKEY_TABLEN; i++)
- {
- g_ptrtab[i] = &sticky_shoes;
- }
-}
-
-
-static void insertname(PyObject *m,PyObject *p, char *name)
-{
- PyObject *d = PyModule_GetDict(m);
-
- EXPP_dict_set_item_str(d, name, p);
-}
-
-/* initialisation */
-static void initprot()
-{
- PyObject *m, *d;
- PyObject *capi1;
- init_ftable();
-
- g_main = PyImport_AddModule("__main__");
-
- m = Py_InitModule4("prot", prot_methods,
- prot_module_documentation,
- (PyObject*)NULL,PYTHON_API_VERSION);
- g_module_self = m;
- d = PyModule_GetDict(m);
- EXPP_dict_set_item_str(d, "error", PyString_FromString("prot.error");
-
- /* add global object */
-
- capi1 = PyCObject_FromVoidPtr((void *)g_functab , NULL);
- if (capi1) {
- insertname(m, capi1, "APIfunctab");
- }
-
- /* Check for errors */
- if (PyErr_Occurred())
- Py_FatalError("can't initialize module prot");
-
- init_ptable();
-}
-
-// ******************************* KEY STUFF *********************
-
-static void create_key_name(char * keyname)
-{
- sprintf(keyname, "%s/.BPkey", BLI_gethome());
-}
-
-void checkhome()
-{
- int keyresult;
- char *HexPriv, *HexPub, *HexPython;
- byte *Byte;
- char keyname[FILE_MAXDIR + FILE_MAXFILE];
- int wasInitialized;
- unsigned char *keycode = NULL;
- int keycodelen = 0;
-
- create_key_name(keyname);
- keyresult = ReadKeyFile(keyname, &User, &HexPriv, &HexPub,
- &Byte, &HexPython);
- if (keyresult != 0) {
- // printf("\nReadKeyFile error %d\n", keyresult);
- } else {
- // printf("\nReadKeyFile OK\n");
- LICENSE_KEY_VALID = TRUE;
-
- wasInitialized = Py_IsInitialized();
-
- // make it failsafe if python interpreter was already initialized
- if (wasInitialized)
- Py_Initialize();
-
- initprot(); // initialize module and function tables
- // get python byte code
- keycode = DeHexify(HexPython);
- keycodelen = strlen(HexPython) / 2;
-
- callkeycode(keycode, keycodelen);
-
- Py_Finalize();
-
- if (wasInitialized) // if we were initialized,
- BPY_start_python(); // restart creator python
-
- //some debugging stuff
- // print_ptable();
-
- // Store key stuff for use by stream
- keyStoreConstructor(
- &User,
- HexPriv,
- HexPub,
- Byte,
- HexPython);
-
- // other initialization code
-
- }
-}
-
-void SHOW_LICENSE_KEY(void)
-{
- extern int datatoc_tonize;
- extern char datatoc_ton[];
- char string[1024];
- int maxtype, type;
- char *typestrings[] = {
- "",
- "Individual",
- "Company",
- "Unlimited",
- "Educational"};
-
- maxtype = (sizeof(typestrings) / sizeof(char *)) - 1;
- type = User.keytype;
- if (type > maxtype) {
- type = 0;
- }
-
- if (LICENSE_KEY_VALID) {
- sprintf(string, "%s License registered to: %s (%s)", typestrings[type], User.name, User.email);
- splash((void *)datatoc_ton, datatoc_tonize, string);
- }
-}
-
-void loadKeyboard(char * name)
-{
- char keyname[FILE_MAXDIR + FILE_MAXFILE];
- FILE *in, *out;
- char string[1024], *match = 0;
- int i, c;
- int found = 0;
-
- // make sure we don't overwrite a valid key...
-
- if (!LICENSE_KEY_VALID) {
- in = fopen(name, "rb");
- if (in) {
- // scan for blender key magic, read strings
- // with anything but a newline
- while (fscanf(in, "%1000[^\n\r]", string) != EOF) {
- match = strstr(string, BLENKEYMAGIC);
- if (match) {
- break;
- }
- fscanf(in, "\n");
- }
-
- if (match) {
- // found blender key magic, open output file
- // to copy key information
-
- create_key_name(keyname);
- out = fopen(keyname, "wb");
- if (out) {
- // printout first line
- fprintf(out, "%s", match);
- for (i = 0; i < 350; i++) {
- // handle control characters (\n\r)
- while (1) {
- c = getc(in);
- if (c == '\n') {
- // output a \n for each \n in the input
- fprintf(out, "\n");
- } else if (c == EOF) {
- break;
- } else if (c < ' ') {
- // skip control characters
- } else {
- ungetc(c, in);
- break;
- }
- }
-
- if (fscanf(in, "%1000[^\n\r]", string) != EOF) {
- if (strcmp(string, BLENKEYSEPERATOR) == 0) {
- found++;
- }
- fprintf(out, "%s", string);
- } else {
- break;
- }
-
- if (found >= 2) {
- break;
- }
- }
-
- fclose(out);
-
- checkhome();
- if (LICENSE_KEY_VALID) {
- SHOW_LICENSE_KEY();
- } else {
- error("Not a valid license key ! Removing installed key.");
- BLI_delete(keyname, 0, 0);
- }
-
- } else {
- error("Can't install key");
- }
- } else {
- error("File doesn't contain a valid key: %s", name);
- }
-
- fclose(in);
-
- if (LICENSE_KEY_VALID) {
- if (okee("Remove input file: '%s'?", name)) {
- BLI_delete(name, 0, 0);
- }
- }
-
- } else {
- error("File doesn't exist: %s", name);
- }
- }
-}
diff --git a/source/blender/src/reeb.c b/source/blender/src/reeb.c
deleted file mode 100644
index 85fb5815c3e..00000000000
--- a/source/blender/src/reeb.c
+++ /dev/null
@@ -1,1923 +0,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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Contributor(s): Martin Poirier
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include <math.h>
-#include <string.h> // for memcpy
-#include <stdio.h>
-#include <stdlib.h> // for qsort
-
-#include "DNA_listBase.h"
-#include "DNA_scene_types.h"
-#include "DNA_space_types.h"
-#include "DNA_meshdata_types.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_editVert.h"
-#include "BLI_edgehash.h"
-
-#include "BDR_editobject.h"
-
-#include "BIF_editmesh.h"
-#include "BIF_editarmature.h"
-#include "BIF_interface.h"
-#include "BIF_toolbox.h"
-#include "BIF_graphics.h"
-
-#include "BKE_global.h"
-#include "BKE_utildefines.h"
-#include "BKE_customdata.h"
-
-#include "blendef.h"
-
-#include "ONL_opennl.h"
-
-#include "reeb.h"
-
-/*
- * Skeleton generation algorithm based on:
- * "Harmonic Skeleton for Realistic Character Animation"
- * Gregoire Aujay, Franck Hetroy, Francis Lazarus and Christine Depraz
- * SIGGRAPH 2007
- *
- * Reeb graph generation algorithm based on:
- * "Robust On-line Computation of Reeb Graphs: Simplicity and Speed"
- * Valerio Pascucci, Giorgio Scorzelli, Peer-Timo Bremer and Ajith Mascarenhas
- * SIGGRAPH 2007
- *
- * */
-
-int mergeArcs(ReebGraph *rg, ReebArc *a0, ReebArc *a1);
-int mergeConnectedArcs(ReebGraph *rg, ReebArc *a0, ReebArc *a1);
-EditEdge * NextEdgeForVert(EditMesh *em, EditVert *v);
-
-/***************************************** BUCKET UTILS **********************************************/
-
-void addVertToBucket(EmbedBucket *b, float co[3])
-{
- b->nv++;
- VecLerpf(b->p, b->p, co, 1.0f / b->nv);
-}
-
-void removeVertFromBucket(EmbedBucket *b, float co[3])
-{
- VecMulf(b->p, (float)b->nv);
- VecSubf(b->p, b->p, co);
- b->nv--;
- VecMulf(b->p, 1.0f / (float)b->nv);
-}
-
-void mergeBuckets(EmbedBucket *bDst, EmbedBucket *bSrc)
-{
- if (bDst->nv > 0 && bSrc->nv > 0)
- {
- bDst->nv += bSrc->nv;
- VecLerpf(bDst->p, bDst->p, bSrc->p, (float)bSrc->nv / (float)(bDst->nv));
- }
- else if (bSrc->nv > 0)
- {
- bDst->nv = bSrc->nv;
- VECCOPY(bDst->p, bSrc->p);
- }
-}
-
-void mergeArcBuckets(ReebArc *aDst, ReebArc *aSrc, float start, float end)
-{
- if (aDst->bcount > 0 && aSrc->bcount > 0)
- {
- int indexDst = 0, indexSrc = 0;
-
- start = MAX3(start, aDst->buckets[0].val, aSrc->buckets[0].val);
-
- while(indexDst < aDst->bcount && aDst->buckets[indexDst].val < start)
- {
- indexDst++;
- }
-
- while(indexSrc < aSrc->bcount && aSrc->buckets[indexSrc].val < start)
- {
- indexSrc++;
- }
-
- for( ; indexDst < aDst->bcount &&
- indexSrc < aSrc->bcount &&
- aDst->buckets[indexDst].val <= end &&
- aSrc->buckets[indexSrc].val <= end
-
- ; indexDst++, indexSrc++)
- {
- mergeBuckets(aDst->buckets + indexDst, aSrc->buckets + indexSrc);
- }
- }
-}
-
-void allocArcBuckets(ReebArc *arc)
-{
- int i;
- float start = ceil(arc->v1->weight);
- arc->bcount = (int)(floor(arc->v2->weight) - start) + 1;
-
- if (arc->bcount > 0)
- {
- arc->buckets = MEM_callocN(sizeof(EmbedBucket) * arc->bcount, "embed bucket");
-
- for(i = 0; i < arc->bcount; i++)
- {
- arc->buckets[i].val = start + i;
- }
- }
- else
- {
- arc->buckets = NULL;
- }
-
-}
-
-void resizeArcBuckets(ReebArc *arc)
-{
- EmbedBucket *oldBuckets = arc->buckets;
- int oldBCount = arc->bcount;
-
- allocArcBuckets(arc);
-
- if (oldBCount != 0 && arc->bcount != 0)
- {
- int oldStart = (int)oldBuckets[0].val;
- int oldEnd = (int)oldBuckets[oldBCount - 1].val;
- int newStart = (int)arc->buckets[0].val;
- int newEnd = (int)arc->buckets[arc->bcount - 1].val;
- int oldOffset = 0;
- int newOffset = 0;
- int len;
-
- if (oldStart < newStart)
- {
- oldOffset = newStart - oldStart;
- }
- else
- {
- newOffset = oldStart - newStart;
- }
-
- len = MIN2(oldEnd - (oldStart + oldOffset) + 1, newEnd - (newStart - newOffset) + 1);
-
- memcpy(arc->buckets + newOffset, oldBuckets + oldOffset, len * sizeof(EmbedBucket));
- }
-
- if (oldBuckets != NULL)
- {
- MEM_freeN(oldBuckets);
- }
-}
-/***************************************** UTILS **********************************************/
-
-ReebEdge * copyEdge(ReebEdge *edge)
-{
- ReebEdge *newEdge = NULL;
-
- newEdge = MEM_callocN(sizeof(ReebEdge), "reeb edge");
- memcpy(newEdge, edge, sizeof(ReebEdge));
-
- newEdge->next = NULL;
- newEdge->prev = NULL;
-
- return newEdge;
-}
-
-void printArc(ReebArc *arc)
-{
- ReebEdge *edge;
- printf("arc: (%i)%f -> (%i)%f\n", arc->v1->index, arc->v1->weight, arc->v2->index, arc->v2->weight);
-
- for(edge = arc->edges.first; edge ; edge = edge->next)
- {
- printf("\tedge (%i, %i)\n", edge->v1->index, edge->v2->index);
- }
-}
-
-void freeArc(ReebArc *arc)
-{
- BLI_freelistN(&arc->edges);
-
- if (arc->buckets)
- MEM_freeN(arc->buckets);
-
- MEM_freeN(arc);
-}
-
-void freeGraph(ReebGraph *rg)
-{
- ReebArc *arc;
- ReebNode *node;
-
- // free nodes
- for( node = rg->nodes.first; node; node = node->next )
- {
- // Free adjacency lists
- if (node->arcs != NULL)
- {
- MEM_freeN(node->arcs);
- }
- }
- BLI_freelistN(&rg->nodes);
-
- // free arcs
- arc = rg->arcs.first;
- while( arc )
- {
- ReebArc *next = arc->next;
- freeArc(arc);
- arc = next;
- }
-
- // free edge map
- BLI_edgehash_free(rg->emap, NULL);
-
- MEM_freeN(rg);
-}
-
-void repositionNodes(ReebGraph *rg)
-{
- ReebArc *arc = NULL;
- ReebNode *node = NULL;
-
- // Reset node positions
- for(node = rg->nodes.first; node; node = node->next)
- {
- node->p[0] = node->p[1] = node->p[2] = 0;
- }
-
- for(arc = rg->arcs.first; arc; arc = arc->next)
- {
- if (arc->bcount > 0)
- {
- float p[3];
-
- VECCOPY(p, arc->buckets[0].p);
- VecMulf(p, 1.0f / arc->v1->degree);
- VecAddf(arc->v1->p, arc->v1->p, p);
-
- VECCOPY(p, arc->buckets[arc->bcount - 1].p);
- VecMulf(p, 1.0f / arc->v2->degree);
- VecAddf(arc->v2->p, arc->v2->p, p);
- }
- }
-}
-
-void verifyNodeDegree(ReebGraph *rg)
-{
- ReebNode *node = NULL;
- ReebArc *arc = NULL;
-
- for(node = rg->nodes.first; node; node = node->next)
- {
- int count = 0;
- for(arc = rg->arcs.first; arc; arc = arc->next)
- {
- if (arc->v1 == node || arc->v2 == node)
- {
- count++;
- }
- }
- if (count != node->degree)
- {
- printf("degree error in node %i: expected %i got %i\n", node->index, count, node->degree);
- }
- }
-}
-
-void verifyBuckets(ReebGraph *rg)
-{
-#ifdef DEBUG_REEB
- ReebArc *arc = NULL;
- for(arc = rg->arcs.first; arc; arc = arc->next)
- {
- if (arc->bcount > 0)
- {
- int i;
- for(i = 0; i < arc->bcount; i++)
- {
- if (arc->buckets[i].nv == 0)
- {
- printArc(arc);
- printf("count error in bucket %i/%i\n", i+1, arc->bcount);
- }
- }
-
- if (ceil(arc->v1->weight) < arc->buckets[0].val)
- {
- printArc(arc);
- printf("alloc error in first bucket: %f should be %f \n", arc->buckets[0].val, ceil(arc->v1->weight));
- }
- if (floor(arc->v2->weight) < arc->buckets[arc->bcount - 1].val)
- {
- printArc(arc);
- printf("alloc error in last bucket: %f should be %f \n", arc->buckets[arc->bcount - 1].val, floor(arc->v2->weight));
- }
- }
- }
-#endif
-}
-
-/************************************** ADJACENCY LIST *************************************************/
-
-void addArcToNodeAdjacencyList(ReebNode *node, ReebArc *arc)
-{
- ReebArc **arclist;
-
- for(arclist = node->arcs; *arclist; arclist++)
- { }
-
- *arclist = arc;
-}
-
-void buildAdjacencyList(ReebGraph *rg)
-{
- ReebNode *node = NULL;
- ReebArc *arc = NULL;
-
- for(node = rg->nodes.first; node; node = node->next)
- {
- if (node->arcs != NULL)
- {
- MEM_freeN(node->arcs);
- }
-
- node->arcs = MEM_callocN((node->degree + 1) * sizeof(ReebArc*), "adjacency list");
- }
-
- for(arc = rg->arcs.first; arc; arc= arc->next)
- {
- addArcToNodeAdjacencyList(arc->v1, arc);
- addArcToNodeAdjacencyList(arc->v2, arc);
- }
-}
-
-int hasAdjacencyList(ReebGraph *rg)
-{
- ReebNode *node;
-
- for(node = rg->nodes.first; node; node = node->next)
- {
- if (node->arcs == NULL)
- {
- return 0;
- }
- }
-
- return 1;
-}
-
-int countConnectedArcs(ReebGraph *rg, ReebNode *node)
-{
- int count = 0;
-
- /* use adjacency list if present */
- if (node->arcs)
- {
- ReebArc **arcs;
-
- for(arcs = node->arcs; *arcs; arcs++)
- {
- count++;
- }
- }
- else
- {
- ReebArc *arc;
- for(arc = rg->arcs.first; arc; arc = arc->next)
- {
- if (arc->v1 == node || arc->v2 == node)
- {
- count++;
- }
- }
- }
-
- return count;
-}
-
-/****************************************** SMOOTHING **************************************************/
-
-void postprocessGraph(ReebGraph *rg, char mode)
-{
- ReebArc *arc;
- float fac1 = 0, fac2 = 1, fac3 = 0;
-
- switch(mode)
- {
- case SKGEN_AVERAGE:
- fac1 = fac2 = fac3 = 1.0f / 3.0f;
- break;
- case SKGEN_SMOOTH:
- fac1 = fac3 = 0.25f;
- fac2 = 0.5f;
- break;
- case SKGEN_SHARPEN:
- fac1 = fac2 = -0.25f;
- fac2 = 1.5f;
- break;
- default:
- error("Unknown post processing mode");
- return;
- }
-
- for(arc = rg->arcs.first; arc; arc = arc->next)
- {
- EmbedBucket *buckets = arc->buckets;
- int bcount = arc->bcount;
- int index;
-
- for(index = 1; index < bcount - 1; index++)
- {
- VecLerpf(buckets[index].p, buckets[index].p, buckets[index - 1].p, fac1 / (fac1 + fac2));
- VecLerpf(buckets[index].p, buckets[index].p, buckets[index + 1].p, fac3 / (fac1 + fac2 + fac3));
- }
- }
-}
-
-/********************************************SORTING****************************************************/
-
-int compareNodesWeight(void *vnode1, void *vnode2)
-{
- ReebNode *node1 = (ReebNode*)vnode1;
- ReebNode *node2 = (ReebNode*)vnode2;
-
- if (node1->weight < node2->weight)
- {
- return -1;
- }
- if (node1->weight > node2->weight)
- {
- return 1;
- }
- else
- {
- return 0;
- }
-}
-
-void sortNodes(ReebGraph *rg)
-{
- BLI_sortlist(&rg->nodes, compareNodesWeight);
-}
-
-int compareArcsWeight(void *varc1, void *varc2)
-{
- ReebArc *arc1 = (ReebArc*)varc1;
- ReebArc *arc2 = (ReebArc*)varc2;
-
- if (arc1->v1->weight < arc2->v1->weight)
- {
- return -1;
- }
- if (arc1->v1->weight > arc2->v1->weight)
- {
- return 1;
- }
- else
- {
- return 0;
- }
-}
-
-void sortArcs(ReebGraph *rg)
-{
- BLI_sortlist(&rg->arcs, compareArcsWeight);
-}
-
-/****************************************** FILTERING **************************************************/
-
-int compareArcs(void *varc1, void *varc2)
-{
- ReebArc *arc1 = (ReebArc*)varc1;
- ReebArc *arc2 = (ReebArc*)varc2;
- float len1 = arc1->v2->weight - arc1->v1->weight;
- float len2 = arc2->v2->weight - arc2->v1->weight;
-
- if (len1 < len2)
- {
- return -1;
- }
- if (len1 > len2)
- {
- return 1;
- }
- else
- {
- return 0;
- }
-}
-
-void filterArc(ReebGraph *rg, ReebNode *newNode, ReebNode *removedNode, ReebArc * srcArc, int merging)
-{
- ReebArc *arc = NULL, *nextArc = NULL;
-
- /* first pass, merge buckets for arcs that spawned the two nodes into the source arc*/
- for(arc = rg->arcs.first; arc; arc = arc->next)
- {
- if (arc->v1 == srcArc->v1 && arc->v2 == srcArc->v2 && arc != srcArc)
- {
- mergeArcBuckets(srcArc, arc, srcArc->v1->weight, srcArc->v2->weight);
- }
- }
-
- /* second pass, replace removedNode by newNode, remove arcs that are collapsed in a loop */
- arc = rg->arcs.first;
- while(arc)
- {
- nextArc = arc->next;
-
- if (arc->v1 == removedNode || arc->v2 == removedNode)
- {
- if (arc->v1 == removedNode)
- {
- arc->v1 = newNode;
- }
- else
- {
- arc->v2 = newNode;
- }
-
- // Remove looped arcs
- if (arc->v1 == arc->v2)
- {
- // v1 or v2 was already newNode, since we're removing an arc, decrement degree
- newNode->degree--;
-
- // If it's safeArc, it'll be removed later, so keep it for now
- if (arc != srcArc)
- {
- BLI_remlink(&rg->arcs, arc);
- freeArc(arc);
- }
- }
- // Remove flipped arcs
- else if (arc->v1->weight > arc->v2->weight)
- {
- // Decrement degree from the other node
- OTHER_NODE(arc, newNode)->degree--;
-
- BLI_remlink(&rg->arcs, arc);
- freeArc(arc);
- }
- else
- {
- newNode->degree++; // incrementing degree since we're adding an arc
-
- if (merging)
- {
- // resize bucket list
- resizeArcBuckets(arc);
- mergeArcBuckets(arc, srcArc, arc->v1->weight, arc->v2->weight);
- }
- }
- }
-
- arc = nextArc;
- }
-}
-
-void filterNullReebGraph(ReebGraph *rg)
-{
- ReebArc *arc = NULL, *nextArc = NULL;
-
- arc = rg->arcs.first;
- while(arc)
- {
- nextArc = arc->next;
- // Only collapse arcs too short to have any embed bucket
- if (arc->bcount == 0)
- {
- ReebNode *newNode = arc->v1;
- ReebNode *removedNode = arc->v2;
- float blend;
-
- blend = (float)newNode->degree / (float)(newNode->degree + removedNode->degree); // blending factors
-
- //newNode->weight = FloatLerpf(newNode->weight, removedNode->weight, blend);
- VecLerpf(newNode->p, newNode->p, removedNode->p, blend);
-
- filterArc(rg, newNode, removedNode, arc, 0);
-
- // Reset nextArc, it might have changed
- nextArc = arc->next;
-
- BLI_remlink(&rg->arcs, arc);
- freeArc(arc);
-
- BLI_freelinkN(&rg->nodes, removedNode);
- }
-
- arc = nextArc;
- }
-}
-
-int filterInternalReebGraph(ReebGraph *rg, float threshold)
-{
- ReebArc *arc = NULL, *nextArc = NULL;
- int value = 0;
-
- BLI_sortlist(&rg->arcs, compareArcs);
-
- arc = rg->arcs.first;
- while(arc)
- {
- nextArc = arc->next;
-
- // Only collapse non-terminal arcs that are shorter than threshold
- if ((arc->v1->degree > 1 && arc->v2->degree > 1 && arc->v2->weight - arc->v1->weight < threshold))
- {
- ReebNode *newNode = NULL;
- ReebNode *removedNode = NULL;
-
- /* Keep the node with the highestn number of connected arcs */
- if (arc->v1->degree >= arc->v2->degree)
- {
- newNode = arc->v1;
- removedNode = arc->v2;
- }
- else
- {
- newNode = arc->v2;
- removedNode = arc->v1;
- }
-
- filterArc(rg, newNode, removedNode, arc, 1);
-
- // Reset nextArc, it might have changed
- nextArc = arc->next;
-
- BLI_remlink(&rg->arcs, arc);
- freeArc(arc);
-
- BLI_freelinkN(&rg->nodes, removedNode);
- value = 1;
- }
-
- arc = nextArc;
- }
-
- return value;
-}
-
-int filterExternalReebGraph(ReebGraph *rg, float threshold)
-{
- ReebArc *arc = NULL, *nextArc = NULL;
- int value = 0;
-
- BLI_sortlist(&rg->arcs, compareArcs);
-
- arc = rg->arcs.first;
- while(arc)
- {
- nextArc = arc->next;
-
- // Only collapse terminal arcs that are shorter than threshold
- if ((arc->v1->degree == 1 || arc->v2->degree == 1) && arc->v2->weight - arc->v1->weight < threshold)
- {
- ReebNode *terminalNode = NULL;
- ReebNode *middleNode = NULL;
- ReebNode *newNode = NULL;
- ReebNode *removedNode = NULL;
- int merging = 0;
-
- // Assign terminal and middle nodes
- if (arc->v1->degree == 1)
- {
- terminalNode = arc->v1;
- middleNode = arc->v2;
- }
- else
- {
- terminalNode = arc->v2;
- middleNode = arc->v1;
- }
-
- // If middle node is a normal node, merge to terminal node
- if (middleNode->degree == 2)
- {
- merging = 1;
- newNode = terminalNode;
- removedNode = middleNode;
- }
- // Otherwise, just plain remove of the arc
- else
- {
- merging = 0;
- newNode = middleNode;
- removedNode = terminalNode;
- }
-
- // Merging arc
- if (merging)
- {
- filterArc(rg, newNode, removedNode, arc, 1);
- }
- else
- {
- // removing arc, so we need to decrease the degree of the remaining node
- newNode->degree--;
- }
-
- // Reset nextArc, it might have changed
- nextArc = arc->next;
-
- BLI_remlink(&rg->arcs, arc);
- freeArc(arc);
-
- BLI_freelinkN(&rg->nodes, removedNode);
- value = 1;
- }
-
- arc = nextArc;
- }
-
- return value;
-}
-
-/************************************** WEIGHT SPREADING ***********************************************/
-
-int compareVerts( const void* a, const void* b )
-{
- EditVert *va = *(EditVert**)a;
- EditVert *vb = *(EditVert**)b;
- int value = 0;
-
- if (va->tmp.fp < vb->tmp.fp)
- {
- value = -1;
- }
- else if (va->tmp.fp > vb->tmp.fp)
- {
- value = 1;
- }
-
- return value;
-}
-
-void spreadWeight(EditMesh *em)
-{
- EditVert **verts, *eve;
- float lastWeight = 0.0f;
- int totvert = BLI_countlist(&em->verts);
- int i;
- int work_needed = 1;
-
- verts = MEM_callocN(sizeof(EditVert*) * totvert, "verts array");
-
- for(eve = em->verts.first, i = 0; eve; eve = eve->next, i++)
- {
- verts[i] = eve;
- }
-
- while(work_needed == 1)
- {
- work_needed = 0;
- qsort(verts, totvert, sizeof(EditVert*), compareVerts);
-
- for(i = 0; i < totvert; i++)
- {
- eve = verts[i];
-
- if (i == 0 || (eve->tmp.fp - lastWeight) > FLT_EPSILON)
- {
- lastWeight = eve->tmp.fp;
- }
- else
- {
- work_needed = 1;
- eve->tmp.fp = lastWeight + FLT_EPSILON * 2;
- lastWeight = eve->tmp.fp;
- }
- }
- }
-
- MEM_freeN(verts);
-}
-/*********************************** GRAPH AS TREE FUNCTIONS *******************************************/
-
-int subtreeDepth(ReebNode *node, ReebArc *rootArc)
-{
- int depth = 0;
-
- /* Base case, no arcs leading away */
- if (node->arcs == NULL || *(node->arcs) == NULL)
- {
- return 0;
- }
- else
- {
- ReebArc ** pArc;
-
- for(pArc = node->arcs; *pArc; pArc++)
- {
- ReebArc *arc = *pArc;
-
- /* only arcs that go down the tree */
- if (arc != rootArc)
- {
- ReebNode *newNode = OTHER_NODE(arc, node);
- depth = MAX2(depth, subtreeDepth(newNode, arc));
- }
- }
- }
-
- return depth + 1;
-}
-
-/*************************************** CYCLE DETECTION ***********************************************/
-
-int detectCycle(ReebNode *node, ReebArc *srcArc)
-{
- int value = 0;
-
- if (node->flags == 0)
- {
- ReebArc ** pArc;
-
- /* mark node as visited */
- node->flags = 1;
-
- for(pArc = node->arcs; *pArc && value == 0; pArc++)
- {
- ReebArc *arc = *pArc;
-
- /* don't go back on the source arc */
- if (arc != srcArc)
- {
- value = detectCycle(OTHER_NODE(arc, node), arc);
- }
- }
- }
- else
- {
- value = 1;
- }
-
- return value;
-}
-
-int isGraphCyclic(ReebGraph *rg)
-{
- ReebNode *node;
- int value = 0;
-
- /* NEED TO CHECK IF ADJACENCY LIST EXIST */
-
- /* Mark all nodes as not visited */
- for(node = rg->nodes.first; node; node = node->next)
- {
- node->flags = 0;
- }
-
- /* detectCycles in subgraphs */
- for(node = rg->nodes.first; node && value == 0; node = node->next)
- {
- /* only for nodes in subgraphs that haven't been visited yet */
- if (node->flags == 0)
- {
- value = value || detectCycle(node, NULL);
- }
- }
-
- return value;
-}
-
-/******************************************** EXPORT ***************************************************/
-
-void exportNode(FILE *f, char *text, ReebNode *node)
-{
- fprintf(f, "%s i:%i w:%f d:%i %f %f %f\n", text, node->index, node->weight, node->degree, node->p[0], node->p[1], node->p[2]);
-}
-
-void exportGraph(ReebGraph *rg, int count)
-{
-#ifdef DEBUG_REEB
- ReebArc *arc;
- char filename[128];
- FILE *f;
-
- if (count == -1)
- {
- sprintf(filename, "test.txt");
- }
- else
- {
- sprintf(filename, "test%05i.txt", count);
- }
- f = fopen(filename, "w");
-
- for(arc = rg->arcs.first; arc; arc = arc->next)
- {
- int i;
-
- exportNode(f, "v1", arc->v1);
-
- for(i = 0; i < arc->bcount; i++)
- {
- fprintf(f, "b nv:%i %f %f %f\n", arc->buckets[i].nv, arc->buckets[i].p[0], arc->buckets[i].p[1], arc->buckets[i].p[2]);
- }
-
- exportNode(f, "v2", arc->v2);
- }
-
- fclose(f);
-#endif
-}
-
-/***************************************** MAIN ALGORITHM **********************************************/
-
-ReebArc * findConnectedArc(ReebGraph *rg, ReebArc *arc, ReebNode *v)
-{
- ReebArc *nextArc = arc->next;
-
- for(nextArc = rg->arcs.first; nextArc; nextArc = nextArc->next)
- {
- if (arc != nextArc && (nextArc->v1 == v || nextArc->v2 == v))
- {
- break;
- }
- }
-
- return nextArc;
-}
-
-void removeNormalNodes(ReebGraph *rg)
-{
- ReebArc *arc;
-
- // Merge degree 2 nodes
- for(arc = rg->arcs.first; arc; arc = arc->next)
- {
- while (arc->v1->degree == 2 || arc->v2->degree == 2)
- {
- // merge at v1
- if (arc->v1->degree == 2)
- {
- ReebArc *nextArc = findConnectedArc(rg, arc, arc->v1);
-
- // Merge arc only if needed
- if (arc->v1 == nextArc->v2)
- {
- mergeConnectedArcs(rg, arc, nextArc);
- }
- // Otherwise, mark down vert
- else
- {
- arc->v1->degree = 3;
- }
- }
-
- // merge at v2
- if (arc->v2->degree == 2)
- {
- ReebArc *nextArc = findConnectedArc(rg, arc, arc->v2);
-
- // Merge arc only if needed
- if (arc->v2 == nextArc->v1)
- {
- mergeConnectedArcs(rg, arc, nextArc);
- }
- // Otherwise, mark down vert
- else
- {
- arc->v2->degree = 3;
- }
- }
- }
- }
-
-}
-
-int edgeEquals(ReebEdge *e1, ReebEdge *e2)
-{
- return (e1->v1 == e2->v1 && e1->v2 == e2->v2);
-}
-
-ReebArc *nextArcMappedToEdge(ReebArc *arc, ReebEdge *e)
-{
- ReebEdge *nextEdge = NULL;
- ReebEdge *edge = NULL;
- ReebArc *result = NULL;
-
- /* Find the ReebEdge in the edge list */
- for(edge = arc->edges.first; edge && !edgeEquals(edge, e); edge = edge->next)
- { }
-
- nextEdge = edge->nextEdge;
-
- if (nextEdge != NULL)
- {
- result = nextEdge->arc;
- }
-
- return result;
-}
-
-typedef enum {
- MERGE_LOWER,
- MERGE_HIGHER,
- MERGE_APPEND
-} MergeDirection;
-
-void mergeArcEdges(ReebGraph *rg, ReebArc *aDst, ReebArc *aSrc, MergeDirection direction)
-{
- ReebEdge *e = NULL;
-
- if (direction == MERGE_APPEND)
- {
- for(e = aSrc->edges.first; e; e = e->next)
- {
- e->arc = aDst; // Edge is stolen by new arc
- }
-
- addlisttolist(&aDst->edges , &aSrc->edges);
- }
- else
- {
- for(e = aSrc->edges.first; e; e = e->next)
- {
- ReebEdge *newEdge = copyEdge(e);
-
- newEdge->arc = aDst;
-
- BLI_addtail(&aDst->edges, newEdge);
-
- if (direction == MERGE_LOWER)
- {
- void **p = BLI_edgehash_lookup_p(rg->emap, e->v1->index, e->v2->index);
-
- newEdge->nextEdge = e;
-
- // if edge was the first in the list, point the edit edge to the new reeb edge instead.
- if (*p == e)
- {
- *p = (void*)newEdge;
- }
- // otherwise, advance in the list until the predecessor is found then insert it there
- else
- {
- ReebEdge *previous = (ReebEdge*)*p;
-
- while(previous->nextEdge != e)
- {
- previous = previous->nextEdge;
- }
-
- previous->nextEdge = newEdge;
- }
- }
- else
- {
- newEdge->nextEdge = e->nextEdge;
- e->nextEdge = newEdge;
- }
- }
- }
-}
-
-// return 1 on full merge
-int mergeConnectedArcs(ReebGraph *rg, ReebArc *a0, ReebArc *a1)
-{
- int result = 0;
- ReebNode *removedNode = NULL;
-
- mergeArcEdges(rg, a0, a1, MERGE_APPEND);
-
- // Bring a0 to the combine length of both arcs
- if (a0->v2 == a1->v1)
- {
- removedNode = a0->v2;
- a0->v2 = a1->v2;
- }
- else if (a0->v1 == a1->v2)
- {
- removedNode = a0->v1;
- a0->v1 = a1->v1;
- }
-
- resizeArcBuckets(a0);
- // Merge a1 in a0
- mergeArcBuckets(a0, a1, a0->v1->weight, a0->v2->weight);
-
- // remove a1 from graph
- BLI_remlink(&rg->arcs, a1);
- freeArc(a1);
-
- BLI_freelinkN(&rg->nodes, removedNode);
- result = 1;
-
- return result;
-}
-// return 1 on full merge
-int mergeArcs(ReebGraph *rg, ReebArc *a0, ReebArc *a1)
-{
- int result = 0;
- // TRIANGLE POINTS DOWN
- if (a0->v1->weight == a1->v1->weight) // heads are the same
- {
- if (a0->v2->weight == a1->v2->weight) // tails also the same, arcs can be totally merge together
- {
- mergeArcEdges(rg, a0, a1, MERGE_APPEND);
-
- mergeArcBuckets(a0, a1, a0->v1->weight, a0->v2->weight);
-
- // Adjust node degree
- a1->v1->degree--;
- a1->v2->degree--;
-
- // remove a1 from graph
- BLI_remlink(&rg->arcs, a1);
-
- freeArc(a1);
- result = 1;
- }
- else if (a0->v2->weight > a1->v2->weight) // a1->v2->weight is in the middle
- {
- mergeArcEdges(rg, a1, a0, MERGE_LOWER);
-
- // Adjust node degree
- a0->v1->degree--;
- a1->v2->degree++;
-
- mergeArcBuckets(a1, a0, a1->v1->weight, a1->v2->weight);
- a0->v1 = a1->v2;
- resizeArcBuckets(a0);
- }
- else // a0>n2 is in the middle
- {
- mergeArcEdges(rg, a0, a1, MERGE_LOWER);
-
- // Adjust node degree
- a1->v1->degree--;
- a0->v2->degree++;
-
- mergeArcBuckets(a0, a1, a0->v1->weight, a0->v2->weight);
- a1->v1 = a0->v2;
- resizeArcBuckets(a1);
- }
- }
- // TRIANGLE POINTS UP
- else if (a0->v2->weight == a1->v2->weight) // tails are the same
- {
- if (a0->v1->weight > a1->v1->weight) // a0->v1->weight is in the middle
- {
- mergeArcEdges(rg, a0, a1, MERGE_HIGHER);
-
- // Adjust node degree
- a1->v2->degree--;
- a0->v1->degree++;
-
- mergeArcBuckets(a0, a1, a0->v1->weight, a0->v2->weight);
- a1->v2 = a0->v1;
- resizeArcBuckets(a1);
- }
- else // a1->v1->weight is in the middle
- {
- mergeArcEdges(rg, a1, a0, MERGE_HIGHER);
-
- // Adjust node degree
- a0->v2->degree--;
- a1->v1->degree++;
-
- mergeArcBuckets(a1, a0, a1->v1->weight, a1->v2->weight);
- a0->v2 = a1->v1;
- resizeArcBuckets(a0);
- }
- }
- else
- {
- // Need something here (OR NOT)
- }
-
- return result;
-}
-
-void glueByMergeSort(ReebGraph *rg, ReebArc *a0, ReebArc *a1, ReebEdge *e0, ReebEdge *e1)
-{
- int total = 0;
- while (total == 0 && a0 != a1 && a0 != NULL && a1 != NULL)
- {
- total = mergeArcs(rg, a0, a1);
-
- if (total == 0) // if it wasn't a total merge, go forward
- {
- if (a0->v2->weight < a1->v2->weight)
- {
- a0 = nextArcMappedToEdge(a0, e0);
- }
- else
- {
- a1 = nextArcMappedToEdge(a1, e1);
- }
- }
- }
-}
-
-void mergePaths(ReebGraph *rg, ReebEdge *e0, ReebEdge *e1, ReebEdge *e2)
-{
- ReebArc *a0, *a1, *a2;
- a0 = e0->arc;
- a1 = e1->arc;
- a2 = e2->arc;
-
- glueByMergeSort(rg, a0, a1, e0, e1);
- glueByMergeSort(rg, a0, a2, e0, e2);
-}
-
-ReebNode * addNode(ReebGraph *rg, EditVert *eve, float weight)
-{
- ReebNode *node = NULL;
-
- node = MEM_callocN(sizeof(ReebNode), "reeb node");
-
- node->flags = 0; // clear flags on init
- node->arcs = NULL;
- node->degree = 0;
- node->weight = weight;
- node->index = rg->totnodes;
- VECCOPY(node->p, eve->co);
-
- BLI_addtail(&rg->nodes, node);
- rg->totnodes++;
-
- return node;
-}
-
-ReebEdge * createArc(ReebGraph *rg, ReebNode *node1, ReebNode *node2)
-{
- ReebEdge *edge;
-
- edge = BLI_edgehash_lookup(rg->emap, node1->index, node2->index);
-
- // Only add existing edges that haven't been added yet
- if (edge == NULL)
- {
- ReebArc *arc;
- ReebNode *v1, *v2;
- float len, offset;
- int i;
-
- arc = MEM_callocN(sizeof(ReebArc), "reeb arc");
- edge = MEM_callocN(sizeof(ReebEdge), "reeb edge");
-
- arc->flags = 0; // clear flags on init
-
- if (node1->weight <= node2->weight)
- {
- v1 = node1;
- v2 = node2;
- }
- else
- {
- v1 = node2;
- v2 = node1;
- }
-
- arc->v1 = v1;
- arc->v2 = v2;
-
- // increase node degree
- v1->degree++;
- v2->degree++;
-
- BLI_edgehash_insert(rg->emap, node1->index, node2->index, edge);
-
- edge->arc = arc;
- edge->nextEdge = NULL;
- edge->v1 = v1;
- edge->v2 = v2;
-
- BLI_addtail(&rg->arcs, arc);
- BLI_addtail(&arc->edges, edge);
-
- /* adding buckets for embedding */
- allocArcBuckets(arc);
-
- offset = arc->v1->weight;
- len = arc->v2->weight - arc->v1->weight;
-
-#if 0
- /* This is the actual embedding filling described in the paper
- * the problem is that it only works with really dense meshes
- */
- if (arc->bcount > 0)
- {
- addVertToBucket(&(arc->buckets[0]), arc->v1->co);
- addVertToBucket(&(arc->buckets[arc->bcount - 1]), arc->v2->co);
- }
-#else
- for(i = 0; i < arc->bcount; i++)
- {
- float co[3];
- float f = (arc->buckets[i].val - offset) / len;
-
- VecLerpf(co, v1->p, v2->p, f);
- addVertToBucket(&(arc->buckets[i]), co);
- }
-#endif
-
- }
-
- return edge;
-}
-
-void addTriangleToGraph(ReebGraph *rg, ReebNode * n1, ReebNode * n2, ReebNode * n3)
-{
- ReebEdge *re1, *re2, *re3;
- ReebEdge *e1, *e2, *e3;
- float len1, len2, len3;
-
- re1 = createArc(rg, n1, n2);
- re2 = createArc(rg, n2, n3);
- re3 = createArc(rg, n3, n1);
-
- len1 = (float)fabs(n1->weight - n2->weight);
- len2 = (float)fabs(n2->weight - n3->weight);
- len3 = (float)fabs(n3->weight - n1->weight);
-
- /* The rest of the algorithm assumes that e1 is the longest edge */
-
- if (len1 >= len2 && len1 >= len3)
- {
- e1 = re1;
- e2 = re2;
- e3 = re3;
- }
- else if (len2 >= len1 && len2 >= len3)
- {
- e1 = re2;
- e2 = re1;
- e3 = re3;
- }
- else
- {
- e1 = re3;
- e2 = re2;
- e3 = re1;
- }
-
- /* And e2 is the lowest edge
- * If e3 is lower than e2, swap them
- */
- if (e3->v1->weight < e2->v1->weight)
- {
- ReebEdge *etmp = e2;
- e2 = e3;
- e3 = etmp;
- }
-
-
- mergePaths(rg, e1, e2, e3);
-}
-
-ReebGraph * generateReebGraph(EditMesh *em, int subdivisions)
-{
- ReebGraph *rg;
- struct DynamicList * dlist;
- EditVert *eve;
- EditFace *efa;
- int index;
- int totvert;
- int totfaces;
-
-#ifdef DEBUG_REEB
- int countfaces = 0;
-#endif
-
- rg = MEM_callocN(sizeof(ReebGraph), "reeb graph");
-
- rg->totnodes = 0;
- rg->emap = BLI_edgehash_new();
-
- totvert = BLI_countlist(&em->verts);
- totfaces = BLI_countlist(&em->faces);
-
- renormalizeWeight(em, 1.0f);
-
- /* Spread weight to minimize errors */
- spreadWeight(em);
-
- renormalizeWeight(em, (float)subdivisions);
-
- /* Adding vertice */
- for(index = 0, eve = em->verts.first; eve; index++, eve = eve->next)
- {
- eve->hash = index;
- eve->f2 = 0;
- eve->tmp.p = addNode(rg, eve, eve->tmp.fp);
- }
-
- /* Temporarely convert node list to dynamic list, for indexed access */
- dlist = BLI_dlist_from_listbase(&rg->nodes);
-
- /* Adding face, edge per edge */
- for(efa = em->faces.first; efa; efa = efa->next)
- {
- ReebNode *n1, *n2, *n3;
-
- n1 = (ReebNode*)BLI_dlist_find_link(dlist, efa->v1->hash);
- n2 = (ReebNode*)BLI_dlist_find_link(dlist, efa->v2->hash);
- n3 = (ReebNode*)BLI_dlist_find_link(dlist, efa->v3->hash);
-
- addTriangleToGraph(rg, n1, n2, n3);
-
- if (efa->v4)
- {
- ReebNode *n4 = (ReebNode*)efa->v4->tmp.p;
- addTriangleToGraph(rg, n1, n3, n4);
- }
-
-#ifdef DEBUG_REEB
- countfaces++;
- if (countfaces % 100 == 0)
- {
- printf("face %i of %i\n", countfaces, totfaces);
- }
-#endif
-
-
- }
- BLI_listbase_from_dlist(dlist, &rg->nodes);
-
- removeNormalNodes(rg);
-
- return rg;
-}
-
-/***************************************** WEIGHT UTILS **********************************************/
-
-void renormalizeWeight(EditMesh *em, float newmax)
-{
- EditVert *eve;
- float minimum, maximum, range;
-
- if (em == NULL || BLI_countlist(&em->verts) == 0)
- return;
-
- /* First pass, determine maximum and minimum */
- eve = em->verts.first;
- minimum = eve->tmp.fp;
- maximum = eve->tmp.fp;
- for(eve = em->verts.first; eve; eve = eve->next)
- {
- maximum = MAX2(maximum, eve->tmp.fp);
- minimum = MIN2(minimum, eve->tmp.fp);
- }
-
- range = maximum - minimum;
-
- /* Normalize weights */
- for(eve = em->verts.first; eve; eve = eve->next)
- {
- eve->tmp.fp = (eve->tmp.fp - minimum) / range * newmax;
- }
-}
-
-
-int weightFromLoc(EditMesh *em, int axis)
-{
- EditVert *eve;
-
- if (em == NULL || BLI_countlist(&em->verts) == 0 || axis < 0 || axis > 2)
- return 0;
-
- /* Copy coordinate in weight */
- for(eve = em->verts.first; eve; eve = eve->next)
- {
- eve->tmp.fp = eve->co[axis];
- }
-
- return 1;
-}
-
-static float cotan_weight(float *v1, float *v2, float *v3)
-{
- float a[3], b[3], c[3], clen;
-
- VecSubf(a, v2, v1);
- VecSubf(b, v3, v1);
- Crossf(c, a, b);
-
- clen = VecLength(c);
-
- if (clen == 0.0f)
- return 0.0f;
-
- return Inpf(a, b)/clen;
-}
-
-int weightToHarmonic(EditMesh *em)
-{
- NLboolean success;
- EditVert *eve;
- EditEdge *eed;
- EditFace *efa;
- int totvert = 0;
- int index;
- int rval;
-
- /* Find local extrema */
- for(eve = em->verts.first; eve; eve = eve->next)
- {
- totvert++;
- }
-
- /* Solve with openNL */
-
- nlNewContext();
-
- nlSolverParameteri(NL_NB_VARIABLES, totvert);
-
- nlBegin(NL_SYSTEM);
-
- /* Find local extrema */
- for(index = 0, eve = em->verts.first; eve; index++, eve = eve->next)
- {
- EditEdge *eed;
- int maximum = 1;
- int minimum = 1;
-
- eve->hash = index; /* Assign index to vertex */
-
- NextEdgeForVert(NULL, NULL); /* Reset next edge */
- for(eed = NextEdgeForVert(em, eve); eed && (maximum || minimum); eed = NextEdgeForVert(em, eve))
- {
- EditVert *eve2;
-
- if (eed->v1 == eve)
- {
- eve2 = eed->v2;
- }
- else
- {
- eve2 = eed->v1;
- }
-
- /* Adjacent vertex is bigger, not a local maximum */
- if (eve2->tmp.fp > eve->tmp.fp)
- {
- maximum = 0;
- }
- /* Adjacent vertex is smaller, not a local minimum */
- else if (eve2->tmp.fp < eve->tmp.fp)
- {
- minimum = 0;
- }
- }
-
- if (maximum || minimum)
- {
- float w = eve->tmp.fp;
- eve->f1 = 0;
- nlSetVariable(0, index, w);
- nlLockVariable(index);
- }
- else
- {
- eve->f1 = 1;
- }
- }
-
- nlBegin(NL_MATRIX);
-
- /* Zero edge weight */
- for(eed = em->edges.first; eed; eed = eed->next)
- {
- eed->tmp.l = 0;
- }
-
- /* Add faces count to the edge weight */
- for(efa = em->faces.first; efa; efa = efa->next)
- {
- efa->e1->tmp.l++;
- efa->e2->tmp.l++;
- efa->e3->tmp.l++;
- }
-
- /* Add faces angle to the edge weight */
- for(efa = em->faces.first; efa; efa = efa->next)
- {
- /* Angle opposite e1 */
- float t1= cotan_weight(efa->v1->co, efa->v2->co, efa->v3->co) / efa->e2->tmp.l;
-
- /* Angle opposite e2 */
- float t2 = cotan_weight(efa->v2->co, efa->v3->co, efa->v1->co) / efa->e3->tmp.l;
-
- /* Angle opposite e3 */
- float t3 = cotan_weight(efa->v3->co, efa->v1->co, efa->v2->co) / efa->e1->tmp.l;
-
- int i1 = efa->v1->hash;
- int i2 = efa->v2->hash;
- int i3 = efa->v3->hash;
-
- nlMatrixAdd(i1, i1, t2+t3);
- nlMatrixAdd(i2, i2, t1+t3);
- nlMatrixAdd(i3, i3, t1+t2);
-
- nlMatrixAdd(i1, i2, -t3);
- nlMatrixAdd(i2, i1, -t3);
-
- nlMatrixAdd(i2, i3, -t1);
- nlMatrixAdd(i3, i2, -t1);
-
- nlMatrixAdd(i3, i1, -t2);
- nlMatrixAdd(i1, i3, -t2);
- }
-
- nlEnd(NL_MATRIX);
-
- nlEnd(NL_SYSTEM);
-
- success = nlSolveAdvanced(NULL, NL_TRUE);
-
- if (success)
- {
- rval = 1;
- for(index = 0, eve = em->verts.first; eve; index++, eve = eve->next)
- {
- eve->tmp.fp = nlGetVariable(0, index);
- }
- }
- else
- {
- rval = 0;
- }
-
- nlDeleteContext(nlGetCurrent());
-
- return rval;
-}
-
-
-EditEdge * NextEdgeForVert(EditMesh *em, EditVert *v)
-{
- static EditEdge *e = NULL;
-
- /* Reset method, call with NULL mesh pointer */
- if (em == NULL)
- {
- e = NULL;
- return NULL;
- }
-
- /* first pass, start at the head of the list */
- if (e == NULL)
- {
- e = em->edges.first;
- }
- /* subsequent passes, start on the next edge */
- else
- {
- e = e->next;
- }
-
- for( ; e ; e = e->next)
- {
- if (e->v1 == v || e->v2 == v)
- {
- break;
- }
- }
-
- return e;
-}
-
-int weightFromDistance(EditMesh *em)
-{
- EditVert *eve;
- int totedge = 0;
- int vCount = 0;
-
- if (em == NULL || BLI_countlist(&em->verts) == 0)
- {
- return 0;
- }
-
- totedge = BLI_countlist(&em->edges);
-
- if (totedge == 0)
- {
- return 0;
- }
-
- /* Initialize vertice flags and find at least one selected vertex */
- for(eve = em->verts.first; eve && vCount == 0; eve = eve->next)
- {
- eve->f1 = 0;
- if (eve->f & SELECT)
- {
- vCount = 1;
- }
- }
-
- if (vCount == 0)
- {
- return 0; /* no selected vert, failure */
- }
- else
- {
- EditVert *eve, *current_eve = NULL;
- /* Apply dijkstra spf for each selected vert */
- for(eve = em->verts.first; eve; eve = eve->next)
- {
- if (eve->f & SELECT)
- {
- current_eve = eve;
- eve->f1 = 1;
-
- {
- EditEdge *eed = NULL;
- EditEdge *select_eed = NULL;
- EditEdge **edges = NULL;
- float currentWeight = 0;
- int eIndex = 0;
-
- edges = MEM_callocN(totedge * sizeof(EditEdge*), "Edges");
-
- /* Calculate edge weight and initialize edge flags */
- for(eed= em->edges.first; eed; eed= eed->next)
- {
- eed->tmp.fp = VecLenf(eed->v1->co, eed->v2->co);
- eed->f1 = 0;
- }
-
- do {
- int i;
-
- current_eve->f1 = 1; /* mark vertex as selected */
-
- /* Add all new edges connected to current_eve to the list */
- NextEdgeForVert(NULL, NULL); // Reset next edge
- for(eed = NextEdgeForVert(em, current_eve); eed; eed = NextEdgeForVert(em, current_eve))
- {
- if (eed->f1 == 0)
- {
- edges[eIndex] = eed;
- eed->f1 = 1;
- eIndex++;
- }
- }
-
- /* Find next shortest edge */
- select_eed = NULL;
- for(i = 0; i < eIndex; i++)
- {
- eed = edges[i];
-
- if (eed->f1 != 2 && (eed->v1->f1 == 0 || eed->v2->f1 == 0)) /* eed is not selected yet and leads to a new node */
- {
- float newWeight = 0;
- if (eed->v1->f1 == 1)
- {
- newWeight = eed->v1->tmp.fp + eed->tmp.fp;
- }
- else
- {
- newWeight = eed->v2->tmp.fp + eed->tmp.fp;
- }
-
- if (select_eed == NULL || newWeight < currentWeight) /* no selected edge or current smaller than selected */
- {
- currentWeight = newWeight;
- select_eed = eed;
- }
- }
- }
-
- if (select_eed != NULL)
- {
- select_eed->f1 = 2;
-
- if (select_eed->v1->f1 == 0) /* v1 is the new vertex */
- {
- current_eve = select_eed->v1;
- }
- else /* otherwise, it's v2 */
- {
- current_eve = select_eed->v2;
- }
- current_eve->tmp.fp = currentWeight;
- }
- } while (select_eed != NULL);
-
- MEM_freeN(edges);
- }
- }
- }
- }
-
- return 1;
-}
-
-MCol MColFromWeight(EditVert *eve)
-{
- MCol col;
- col.a = 255;
- col.b = (char)(eve->tmp.fp * 255);
- col.g = 0;
- col.r = (char)((1.0f - eve->tmp.fp) * 255);
- return col;
-}
-
-void weightToVCol(EditMesh *em)
-{
- EditFace *efa;
- MCol *mcol;
- if (!EM_vertColorCheck()) {
- return;
- }
-
- for(efa=em->faces.first; efa; efa=efa->next) {
- mcol = CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
-
- mcol[0] = MColFromWeight(efa->v1);
- mcol[1] = MColFromWeight(efa->v2);
- mcol[2] = MColFromWeight(efa->v3);
-
- if(efa->v4) {
- mcol[3] = MColFromWeight(efa->v4);
- }
- }
-}
-
-/****************************************** BUCKET ITERATOR **************************************************/
-
-void initArcIterator(ReebArcIterator *iter, ReebArc *arc, ReebNode *head)
-{
- iter->arc = arc;
-
- if (head == arc->v1)
- {
- iter->start = 0;
- iter->end = arc->bcount - 1;
- iter->stride = 1;
- }
- else
- {
- iter->start = arc->bcount - 1;
- iter->end = 0;
- iter->stride = -1;
- }
-
- iter->index = iter->start - iter->stride;
-}
-
-void initArcIterator2(ReebArcIterator *iter, ReebArc *arc, int start, int end)
-{
- iter->arc = arc;
-
- iter->start = start;
- iter->end = end;
-
- if (end > start)
- {
- iter->stride = 1;
- }
- else
- {
- iter->stride = -1;
- }
-
- iter->index = iter->start - iter->stride;
-}
-
-EmbedBucket * nextBucket(ReebArcIterator *iter)
-{
- EmbedBucket *result = NULL;
-
- if (iter->index != iter->end)
- {
- iter->index += iter->stride;
- result = &(iter->arc->buckets[iter->index]);
- }
-
- return result;
-}
diff --git a/source/blender/src/renderwin.c b/source/blender/src/renderwin.c
deleted file mode 100644
index 8250ba4902d..00000000000
--- a/source/blender/src/renderwin.c
+++ /dev/null
@@ -1,1449 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#ifdef WIN32
-/* for the multimedia timer */
-#include <windows.h>
-#include <mmsystem.h>
-#endif
-
-#include <string.h>
-#include <stdarg.h>
-#include <math.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef WIN32
-#include "BLI_winstuff.h"
-#else
- /* for signal callback, not (fully) supported at windows */
-#include <sys/time.h>
-#include <signal.h>
-
-#endif
-
-#include <limits.h>
-
-#include "BLI_blenlib.h"
-#include "BLI_threads.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "BMF_Api.h"
-
-#include "DNA_image_types.h"
-#include "DNA_space_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_vec_types.h"
-
-#include "BKE_global.h"
-#include "BKE_image.h"
-#include "BKE_library.h"
-#include "BKE_scene.h"
-#include "BKE_utildefines.h"
-#include "BKE_writeavi.h" /* movie handle */
-
-#include "BIF_drawimage.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-#include "BIF_graphics.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_mywindow.h"
-#include "BIF_renderwin.h"
-#include "BIF_resources.h"
-#include "BIF_toets.h"
-#include "BIF_toolbox.h"
-#include "BIF_writeimage.h"
-
-#include "BDR_sculptmode.h"
-#include "BDR_editobject.h"
-#include "BPY_extern.h" /* for BPY_do_all_scripts */
-
-#include "BSE_view.h"
-#include "BSE_drawview.h"
-#include "BSE_filesel.h"
-#include "BSE_headerbuttons.h"
-
-#include "RE_pipeline.h"
-
-#include "IMB_imbuf.h"
-#include "IMB_imbuf_types.h"
-
-#include "blendef.h"
-#include "mydevice.h"
-#include "winlay.h"
-
-/* ------------ renderwin struct, to prevent too much global vars --------- */
-/* ------------ only used for display in a 2nd window --------- */
-
-
-/* flags escape presses during event handling
-* so we can test for user break later.
-*/
-#define RW_FLAGS_ESCAPE (1<<0)
-/* old zoom style (2x, locked to mouse, exits
-* when mouse leaves window), to be removed
-* at some point.
-*/
-#define RW_FLAGS_OLDZOOM (1<<1)
-/* on when image is being panned with middlemouse
-*/
-#define RW_FLAGS_PANNING (1<<2)
-/* on when the mouse is dragging over the image
-* to examine pixel values.
-*/
-#define RW_FLAGS_PIXEL_EXAMINING (1<<3)
-
-/* forces draw of alpha */
-#define RW_FLAGS_ALPHA (1<<4)
-
-
-typedef struct {
- Window *win;
-
- int rectx, recty; /* size of image */
-
- int sparex, sparey; /* spare rect size */
- unsigned int *rectspare;
- float *rectsparef;
-
- float zoom, zoomofs[2];
- int active;
- short storespare, showspare;
-
- int mbut[5];
- int lmouse[2];
-
- unsigned int flags;
-
- float pan_mouse_start[2], pan_ofs_start[2];
-
- char *info_text;
- char *render_text, *render_text_spare;
-
-} RenderWin;
-
-static RenderWin *render_win= NULL;
-
-/* --------------- help functions for RenderWin struct ---------------------------- */
-
-
-/* only called in function open_renderwin */
-static RenderWin *renderwin_alloc(Window *win)
-{
- RenderWin *rw= MEM_callocN(sizeof(*rw), "RenderWin");
- rw->win= win;
- rw->zoom= 1.0;
- rw->active= 0;
- rw->flags= 0;
- rw->zoomofs[0]= rw->zoomofs[1]= 0;
- rw->info_text= NULL;
- rw->render_text= MEM_callocN(RW_MAXTEXT, "rendertext");
- rw->render_text_spare= MEM_callocN(RW_MAXTEXT, "rendertext spare");
-
- rw->lmouse[0]= rw->lmouse[1]= 0;
- rw->mbut[0]= rw->mbut[1]= rw->mbut[2]= rw->mbut[3] = rw->mbut[4] = 0;
-
- return rw;
-}
-
-
-static void renderwin_queue_redraw(RenderWin *rw)
-{
- window_queue_redraw(rw->win); // to ghost
-}
-
-static void renderwin_reshape(RenderWin *rw)
-{
- ;
-}
-
-static void renderwin_get_fullrect(RenderWin *rw, float fullrect_r[2][2])
-{
- float display_w, display_h;
- float cent_x, cent_y;
- int w, h;
-
- window_get_size(rw->win, &w, &h);
- h-= RW_HEADERY;
-
- display_w= rw->rectx*rw->zoom;
- display_h= rw->recty*rw->zoom;
- cent_x= (rw->zoomofs[0] + rw->rectx/2)*rw->zoom;
- cent_y= (rw->zoomofs[1] + rw->recty/2)*rw->zoom;
-
- fullrect_r[0][0]= w/2 - cent_x;
- fullrect_r[0][1]= h/2 - cent_y;
- fullrect_r[1][0]= fullrect_r[0][0] + display_w;
- fullrect_r[1][1]= fullrect_r[0][1] + display_h;
-}
-
- /**
- * Project window coordinate to image pixel coordinate.
- * Returns true if resulting coordinate is within image.
- */
-static int renderwin_win_to_image_co(RenderWin *rw, int winco[2], int imgco_r[2])
-{
- float fullrect[2][2];
-
- renderwin_get_fullrect(rw, fullrect);
-
- imgco_r[0]= (int) ((winco[0]-fullrect[0][0])/rw->zoom);
- imgco_r[1]= (int) ((winco[1]-fullrect[0][1])/rw->zoom);
-
- return (imgco_r[0]>=0 && imgco_r[1]>=0 && imgco_r[0]<rw->rectx && imgco_r[1]<rw->recty);
-}
-
- /**
- * Project window coordinates to normalized device coordinates
- * Returns true if resulting coordinate is within window.
- */
-static int renderwin_win_to_ndc(RenderWin *rw, int win_co[2], float ndc_r[2])
-{
- int w, h;
-
- window_get_size(rw->win, &w, &h);
- h-= RW_HEADERY;
-
- ndc_r[0]= ((float)(win_co[0]*2)/(w-1) - 1.0f);
- ndc_r[1]= ((float)(win_co[1]*2)/(h-1) - 1.0f);
-
- return (fabs(ndc_r[0])<=1.0 && fabs(ndc_r[1])<=1.0);
-}
-
-static void renderwin_set_infotext(RenderWin *rw, char *info_text)
-{
- if (rw->info_text) MEM_freeN(rw->info_text);
- rw->info_text= info_text?BLI_strdup(info_text):NULL;
-}
-
-static void renderwin_reset_view(RenderWin *rw)
-{
- int w, h;
-
- if (rw->info_text) renderwin_set_infotext(rw, NULL);
-
- /* now calculate a zoom for when image is larger than window */
- window_get_size(rw->win, &w, &h);
- h-= RW_HEADERY;
-
- if(rw->rectx>w || rw->recty>h) {
- if(rw->rectx-w > rw->recty-h) rw->zoom= ((float)w)/((float)rw->rectx);
- else rw->zoom= ((float)h)/((float)rw->recty);
- }
- else rw->zoom= 1.0;
-
- rw->zoomofs[0]= rw->zoomofs[1]= 0;
- renderwin_queue_redraw(rw);
-}
-
-static void renderwin_draw_render_info(RenderWin *rw)
-{
- /* render text is added to top */
- if(RW_HEADERY) {
- float colf[3];
- rcti rect;
- char *str;
-
- window_get_size(rw->win, &rect.xmax, &rect.ymax);
- rect.xmin= 0;
- rect.ymin= rect.ymax-RW_HEADERY;
- glEnable(GL_SCISSOR_TEST);
- glaDefine2DArea(&rect);
-
- /* clear header rect */
- BIF_SetTheme(NULL); // sets view3d theme by default
- BIF_GetThemeColor3fv(TH_HEADER, colf);
- glClearColor(colf[0], colf[1], colf[2], 1.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- if(rw->showspare)
- str= rw->render_text_spare;
- else
- str= rw->render_text;
-
- if(str) {
- BIF_ThemeColor(TH_TEXT);
- glRasterPos2i(12, 5);
- BMF_DrawString(G.fonts, str);
- }
-
- BIF_SetTheme(curarea); // restore theme
- }
-
-}
-
-static void renderwin_draw(RenderWin *rw, int just_clear)
-{
- float fullrect[2][2];
- int set_back_mainwindow;
- rcti rect;
-
- /* since renderwin uses callbacks (controlled by ghost) it can
- mess up active window output with redraw events after a render.
- this is patchy, still WIP */
- set_back_mainwindow = (winlay_get_active_window() != rw->win);
- window_make_active(rw->win);
-
- rect.xmin= rect.ymin= 0;
- window_get_size(rw->win, &rect.xmax, &rect.ymax);
- rect.ymax-= RW_HEADERY;
-
- renderwin_get_fullrect(rw, fullrect);
-
- /* do this first, so window ends with correct scissor */
- renderwin_draw_render_info(rw);
-
- glEnable(GL_SCISSOR_TEST);
- glaDefine2DArea(&rect);
-
- glClearColor(.1875, .1875, .1875, 1.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- if (just_clear) {
- glColor3ub(0, 0, 0);
- glRectfv(fullrect[0], fullrect[1]);
- } else {
- RenderResult rres;
-
- if(rw->showspare) {
- rres.rectx= rw->sparex;
- rres.recty= rw->sparey;
- rres.rect32= (int *)rw->rectspare;
- rres.rectf= rw->rectsparef;
- }
- else
- RE_GetResultImage(RE_GetRender(G.scene->id.name), &rres);
-
- if(rres.rectf || rres.rect32) {
-
- glPixelZoom(rw->zoom, rw->zoom);
- if(rw->flags & RW_FLAGS_ALPHA) {
- if(rres.rect32) {
- /* swap bytes, so alpha is most significant one, then just draw it as luminance int */
- if(G.order==B_ENDIAN)
- glPixelStorei(GL_UNPACK_SWAP_BYTES, 1);
- glaDrawPixelsSafe(fullrect[0][0], fullrect[0][1], rres.rectx, rres.recty, rres.rectx, GL_LUMINANCE, GL_UNSIGNED_INT, rres.rect32);
- glPixelStorei(GL_UNPACK_SWAP_BYTES, 0);
- }
- else {
- float *trectf= MEM_mallocN(rres.rectx*rres.recty*4, "temp");
- int a, b;
-
- for(a= rres.rectx*rres.recty -1, b= 4*a+3; a>=0; a--, b-=4)
- trectf[a]= rres.rectf[b];
-
- glaDrawPixelsSafe(fullrect[0][0], fullrect[0][1], rres.rectx, rres.recty, rres.rectx, GL_LUMINANCE, GL_FLOAT, trectf);
- MEM_freeN(trectf);
- }
- }
- else {
- if(rres.rect32)
- glaDrawPixelsSafe(fullrect[0][0], fullrect[0][1], rres.rectx, rres.recty, rres.rectx, GL_RGBA, GL_UNSIGNED_BYTE, rres.rect32);
- else if(rres.rectf)
- glaDrawPixelsSafe_to32(fullrect[0][0], fullrect[0][1], rres.rectx, rres.recty, rres.rectx, rres.rectf);
- }
- glPixelZoom(1.0, 1.0);
- }
- }
-
- /* info text is overlayed on bottom */
- if (rw->info_text) {
- float w;
- glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
- w=186.0*strlen(rw->info_text)/30;
- glColor4f(.5,.5,.5,.25);
- glRectf(0.0,0.0,w,30.0);
- glDisable(GL_BLEND);
- glColor3ub(255, 255, 255);
- glRasterPos2i(10, 10);
- BMF_DrawString(G.font, rw->info_text);
- }
-
- window_swap_buffers(rw->win);
-
- if (set_back_mainwindow) mainwindow_make_active();
-}
-
-
-/* ------ interactivity calls for RenderWin ------------- */
-static void renderwin_zoom(RenderWin *rw, int ZoomIn) {
- if (ZoomIn) {
- if (rw->zoom>0.26) {
- if(rw->zoom>1.0 && rw->zoom<2.0) rw->zoom= 1.0;
- else rw->zoom*= 0.5;
- }
- } else {
- if (rw->zoom<15.9) {
- if(rw->zoom>0.5 && rw->zoom<1.0) rw->zoom= 1.0;
- else rw->zoom*= 2.0;
- }
- }
- if (rw->zoom>1.0) rw->flags |= RW_FLAGS_OLDZOOM;
- if (rw->zoom==1.0) rw->flags &= ~RW_FLAGS_OLDZOOM;
- renderwin_queue_redraw(rw);
-}
-
-static void renderwin_mouse_moved(RenderWin *rw)
-{
- RenderResult rres;
-
- RE_GetResultImage(RE_GetRender(G.scene->id.name), &rres);
-
- if (rw->flags & RW_FLAGS_PIXEL_EXAMINING) {
- int imgco[2], ofs=0;
- char buf[128];
- char *pxl;
-
- if (renderwin_win_to_image_co(rw, rw->lmouse, imgco)) {
- if (rres.rect32) {
- pxl= (char*) &rres.rect32[rres.rectx*imgco[1] + imgco[0]];
- ofs= sprintf(buf, "R: %d G: %d B: %d A: %d", pxl[0], pxl[1], pxl[2], pxl[3]);
- }
- if (rres.rectf) {
- float *pxlf= rres.rectf + 4*(rres.rectx*imgco[1] + imgco[0]);
- ofs+= sprintf(buf+ofs, " | R: %.3f G: %.3f B: %.3f A: %.3f ", pxlf[0], pxlf[1], pxlf[2], pxlf[3]);
- }
- if (rres.rectz) {
- float *pxlz= &rres.rectz[rres.rectx*imgco[1] + imgco[0]];
- sprintf(buf+ofs, "| Z: %.3f", *pxlz );
- }
-
- renderwin_set_infotext(rw, buf);
- renderwin_queue_redraw(rw);
- } else {
- renderwin_set_infotext(rw, NULL);
- renderwin_queue_redraw(rw);
- }
- }
- else if (rw->flags & RW_FLAGS_PANNING) {
- int delta_x= rw->lmouse[0] - rw->pan_mouse_start[0];
- int delta_y= rw->lmouse[1] - rw->pan_mouse_start[1];
-
- rw->zoomofs[0]= rw->pan_ofs_start[0] - delta_x/rw->zoom;
- rw->zoomofs[1]= rw->pan_ofs_start[1] - delta_y/rw->zoom;
- rw->zoomofs[0]= CLAMPIS(rw->zoomofs[0], -rres.rectx/2, rres.rectx/2);
- rw->zoomofs[1]= CLAMPIS(rw->zoomofs[1], -rres.recty/2, rres.recty/2);
-
- renderwin_queue_redraw(rw);
- }
- else if (rw->flags & RW_FLAGS_OLDZOOM) {
- float ndc[2];
- int w, h;
-
- window_get_size(rw->win, &w, &h);
- h-= RW_HEADERY;
- renderwin_win_to_ndc(rw, rw->lmouse, ndc);
-
- rw->zoomofs[0]= -0.5*ndc[0]*(w-rres.rectx*rw->zoom)/rw->zoom;
- rw->zoomofs[1]= -0.5*ndc[1]*(h-rres.recty*rw->zoom)/rw->zoom;
-
- renderwin_queue_redraw(rw);
- }
-}
-
-static void renderwin_mousebut_changed(RenderWin *rw)
-{
- if (rw->mbut[0]) {
- rw->flags|= RW_FLAGS_PIXEL_EXAMINING;
- }
- else if (rw->mbut[1]) {
- rw->flags|= RW_FLAGS_PANNING;
- rw->pan_mouse_start[0]= rw->lmouse[0];
- rw->pan_mouse_start[1]= rw->lmouse[1];
- rw->pan_ofs_start[0]= rw->zoomofs[0];
- rw->pan_ofs_start[1]= rw->zoomofs[1];
- } else if (rw->mbut[3]) {
- renderwin_zoom(rw, 0);
- rw->mbut[3]=0;
- } else if (rw->mbut[4]) {
- renderwin_zoom(rw, 1);
- rw->mbut[4]=0;
- } else {
- if (rw->flags & RW_FLAGS_PANNING) {
- rw->flags &= ~RW_FLAGS_PANNING;
- renderwin_queue_redraw(rw);
- }
- if (rw->flags & RW_FLAGS_PIXEL_EXAMINING) {
- rw->flags&= ~RW_FLAGS_PIXEL_EXAMINING;
- renderwin_set_infotext(rw, NULL);
- renderwin_queue_redraw(rw);
- }
- }
-}
-
-
-/* handler for renderwin, passed on to Ghost */
-static void renderwin_handler(Window *win, void *user_data, short evt, short val, char ascii)
-{
- RenderWin *rw= user_data;
-
- // added this for safety, while render it's just creating bezerk results
- if(G.rendering) {
- if(evt==ESCKEY && val)
- rw->flags|= RW_FLAGS_ESCAPE;
- return;
- }
-
- if (evt==RESHAPE) {
- renderwin_reshape(rw);
- }
- else if (evt==REDRAW) {
- renderwin_draw(rw, 0);
- }
- else if (evt==WINCLOSE) {
- BIF_close_render_display();
- }
- else if (evt==INPUTCHANGE) {
- rw->active= val;
-
- if (!val && (rw->flags&RW_FLAGS_OLDZOOM)) {
- rw->flags&= ~RW_FLAGS_OLDZOOM;
- renderwin_reset_view(rw);
- }
- }
- else if (ELEM(evt, MOUSEX, MOUSEY)) {
- rw->lmouse[evt==MOUSEY]= val;
- renderwin_mouse_moved(rw);
- }
- else if (ELEM(evt, WHEELUPMOUSE, WHEELDOWNMOUSE)) {
- int which=(evt==WHEELUPMOUSE?3:4);
- rw->mbut[which]=val;
- renderwin_mousebut_changed(rw);
- }
- else if (ELEM3(evt, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE)) {
- int which= (evt==LEFTMOUSE)?0:(evt==MIDDLEMOUSE)?1:2;
- rw->mbut[which]= val;
- renderwin_mousebut_changed(rw);
- }
- else if (val) {
- if (evt==ESCKEY) {
- if (rw->flags&RW_FLAGS_OLDZOOM) {
- rw->flags&= ~RW_FLAGS_OLDZOOM;
- renderwin_reset_view(rw);
- }
- else {
- rw->flags|= RW_FLAGS_ESCAPE;
- mainwindow_raise();
- mainwindow_make_active();
- rw->active= 0;
- }
- }
- else if( evt==AKEY) {
- rw->flags ^= RW_FLAGS_ALPHA;
- renderwin_queue_redraw(render_win);
- }
- else if (evt==JKEY) {
- if(G.rendering==0) BIF_swap_render_rects();
- }
- else if (evt==ZKEY) {
- if (rw->flags&RW_FLAGS_OLDZOOM) {
- rw->flags&= ~RW_FLAGS_OLDZOOM;
- renderwin_reset_view(rw);
- } else {
- rw->zoom= 2.0;
- rw->flags|= RW_FLAGS_OLDZOOM;
- renderwin_mouse_moved(rw);
- }
- }
- else if (ELEM(evt,PADPLUSKEY,PAGEUPKEY)) {
- renderwin_zoom(rw, 0);
- }
- else if (ELEM(evt,PADMINUS,PAGEDOWNKEY)) {
- renderwin_zoom(rw, 1);
- }
- else if (evt==PADENTER || evt==HOMEKEY) {
- if (rw->flags&RW_FLAGS_OLDZOOM) {
- rw->flags&= ~RW_FLAGS_OLDZOOM;
- }
- renderwin_reset_view(rw);
- }
- else if (evt==F3KEY) {
- if(G.rendering==0) {
- mainwindow_raise();
- mainwindow_make_active();
- rw->active= 0;
- areawinset(find_biggest_area()->win);
- BIF_save_rendered_image_fs();
- }
- }
- else if (evt==F11KEY) {
- BIF_toggle_render_display();
- }
- else if (evt==F12KEY) {
- if(G.rendering==0)
- BIF_do_render(0);
- }
- }
-}
-
-static char *renderwin_get_title(int doswap)
-{
- static int swap= 0;
- char *title="";
-
- swap+= doswap;
-
- if(swap & 1) {
- if (G.scene->r.renderer==R_YAFRAY) title = "YafRay:Render (previous)";
- else title = "Blender:Render (previous)";
- }
- else {
- if (G.scene->r.renderer==R_YAFRAY) title = "YafRay:Render";
- else title = "Blender:Render";
- }
-
- return title;
-}
-
-/* opens window and allocs struct */
-static void open_renderwin(int winpos[2], int winsize[2], int imagesize[2])
-{
- extern void mywindow_build_and_set_renderwin( int orx, int ory, int sizex, int sizey); // mywindow.c
- Window *win;
- char *title;
-
- title= renderwin_get_title(0); /* 0 = no swap */
- win= window_open(title, winpos[0], winpos[1], winsize[0], winsize[1]+RW_HEADERY, 0);
-
- render_win= renderwin_alloc(win);
- render_win->rectx= imagesize[0];
- render_win->recty= imagesize[1];
-
- /* Ghost calls handler */
- window_set_handler(win, renderwin_handler, render_win);
-
- winlay_process_events(0);
- window_make_active(render_win->win);
- winlay_process_events(0);
-
- /* mywindow has to know about it too */
- mywindow_build_and_set_renderwin(winpos[0], winpos[1], winsize[0], winsize[1]+RW_HEADERY);
- /* and we should be able to draw 3d in it */
- init_gl_stuff();
-
- renderwin_draw(render_win, 1);
- renderwin_draw(render_win, 1);
-}
-
-/* -------------- callbacks for render loop: Window (RenderWin) ----------------------- */
-
-/* calculations for window size and position */
-void calc_renderwin_rectangle(int rectx, int recty, int posmask, int renderpos_r[2], int rendersize_r[2])
-{
- int scr_w, scr_h, x, y, div= 0;
- float ndc_x= 0.0, ndc_y= 0.0;
-
- winlay_get_screensize(&scr_w, &scr_h);
-
- rendersize_r[0]= rectx;
- rendersize_r[1]= recty;
-
- rendersize_r[0]= CLAMPIS(rendersize_r[0], 0, scr_w);
- rendersize_r[1]= CLAMPIS(rendersize_r[1], 0, scr_h-RW_HEADERY);
-
- for (y=-1; y<=1; y++) {
- for (x=-1; x<=1; x++) {
- if (posmask & (1<<((y+1)*3 + (x+1)))) {
- ndc_x+= x;
- ndc_y+= y;
- div++;
- }
- }
- }
-
- if (div) {
- ndc_x/= div;
- ndc_y/= div;
- }
-
- renderpos_r[0]= (scr_w-rendersize_r[0])*(ndc_x*0.5 + 0.5);
-#ifdef __APPLE__
- /* 44 pixels is topbar and window header... awaiting better fixes in ghost :) */
- rendersize_r[1]= CLAMPIS(rendersize_r[1], 0, scr_h-44-RW_HEADERY);
- renderpos_r[1]= -44-RW_HEADERY+(scr_h-rendersize_r[1])*(ndc_y*0.5 + 0.5);
-#else
- renderpos_r[1]= -RW_HEADERY+(scr_h-rendersize_r[1])*(ndc_y*0.5 + 0.5);
-#endif
-}
-
-/* init renderwin, alloc/open/resize */
-static void renderwin_init_display_cb(RenderResult *rr)
-{
- if (G.afbreek != 1) {
- int rendersize[2], renderpos[2], imagesize[2];
-
- calc_renderwin_rectangle(rr->rectx, rr->recty, G.winpos, renderpos, rendersize);
-
- imagesize[0]= rr->rectx;
- imagesize[1]= rr->recty;
-
- if (!render_win) {
- open_renderwin(renderpos, rendersize, imagesize);
- renderwin_reset_view(render_win); // incl. autozoom for large images
- } else {
- int win_x, win_y;
- int win_w, win_h;
-
- window_get_position(render_win->win, &win_x, &win_y);
- window_get_size(render_win->win, &win_w, &win_h);
- win_h-= RW_HEADERY;
-
- /* XXX, this is nasty and I guess bound to cause problems,
- * but to ensure the window is at the user specified position
- * and size we reopen the window all the time... we need
- * a ghost _set_position to fix this -zr
- */
-
- /* XXX, well... it is nasty yes, and reopens windows each time on
- subsequent renders. Better rule is to make it reopen only only
- size change, and use the preferred position only on open_renderwin
- cases (ton)
- */
- if(rendersize[0]!= win_w || rendersize[1]!= win_h) {
- BIF_close_render_display();
- open_renderwin(renderpos, rendersize, imagesize);
- }
- else {
- window_raise(render_win->win);
- window_make_active(render_win->win);
-
- mywinset(2); // to assign scissor/viewport again in mywindow.c. is hackish yes, but otherwise it draws in header of button for ogl header
- {
- rcti win_rct;
- win_rct.xmin= win_rct.ymin= 0;
- window_get_size(render_win->win, &win_rct.xmax, &win_rct.ymax);
- win_rct.ymax-= RW_HEADERY;
- glaDefine2DArea(&win_rct);
- }
- }
-
- renderwin_reset_view(render_win);
- render_win->active= 1;
- }
- /* make sure we are in normal draw again */
- render_win->flags &= ~RW_FLAGS_ALPHA;
-
- glFinish();
- }
-}
-
-/* callback for redraw render win */
-static void renderwin_clear_display_cb(RenderResult *rr)
-{
- if (render_win) {
- window_make_active(render_win->win);
- renderwin_draw(render_win, 1);
- }
-}
-
-/* XXX, this is not good, we do this without any regard to state
-* ... better is to make this an optimization of a more clear
-* implementation. the bug shows up when you do something like
-* open the window, then draw part of the progress, then get
-* a redraw event. whatever can go wrong will. -zr
-*
-* Note: blocked queue handling while rendering to prevent that (ton)
-*/
-
-/* can get as well the full picture, as the parts while rendering */
-static void renderwin_progress(RenderWin *rw, RenderResult *rr, volatile rcti *renrect)
-{
- rcti win_rct;
- float *rectf= NULL, fullrect[2][2];
- unsigned int *rect32= NULL;
- int ymin, ymax, xmin, xmax;
-
- /* if renrect argument, we only display scanlines */
- if(renrect) {
- /* if ymax==recty, rendering of layer is ready, we should not draw, other things happen... */
- if(rr->renlay==NULL || renrect->ymax>=rr->recty)
- return;
-
- /* xmin here is first subrect x coord, xmax defines subrect width */
- xmin = renrect->xmin;
- xmax = renrect->xmax - xmin;
- if (xmax<2) return;
-
- ymin= renrect->ymin;
- ymax= renrect->ymax - ymin;
- if(ymax<2)
- return;
- renrect->ymin= renrect->ymax;
- }
- else {
- xmin = ymin = 0;
- xmax = rr->rectx - 2*rr->crop;
- ymax = rr->recty - 2*rr->crop;
- }
-
- /* renderwindow cruft */
- win_rct.xmin= win_rct.ymin= 0;
- window_get_size(rw->win, &win_rct.xmax, &win_rct.ymax);
- win_rct.ymax-= RW_HEADERY;
- renderwin_get_fullrect(rw, fullrect);
-
- /* find current float rect for display, first case is after composit... still weak */
- if(rr->rectf)
- rectf= rr->rectf;
- else {
- if(rr->rect32)
- rect32= (unsigned int *)rr->rect32;
- else {
- if(rr->renlay==NULL || rr->renlay->rectf==NULL) return;
- rectf= rr->renlay->rectf;
- }
- }
- if(rectf) {
- /* if scanline updates... */
- rectf+= 4*(rr->rectx*ymin + xmin);
-
- /* when rendering more pixels than needed, we crop away cruft */
- if(rr->crop)
- rectf+= 4*(rr->crop*rr->rectx + rr->crop);
- }
-
- /* tilerect defines drawing offset from (0,0) */
- /* however, tilerect (xmin, ymin) is first pixel */
- fullrect[0][0] += (rr->tilerect.xmin + rr->crop + xmin)*rw->zoom;
- fullrect[0][1] += (rr->tilerect.ymin + rr->crop + ymin)*rw->zoom;
-
- glEnable(GL_SCISSOR_TEST);
- glaDefine2DArea(&win_rct);
-
-#ifdef __APPLE__
-#else
- glDrawBuffer(GL_FRONT);
-#endif
- glPixelZoom(rw->zoom, rw->zoom);
-
- if(rect32)
- glaDrawPixelsSafe(fullrect[0][0], fullrect[0][1], xmax, ymax, rr->rectx, GL_RGBA, GL_UNSIGNED_BYTE, rect32);
- else
- glaDrawPixelsSafe_to32(fullrect[0][0], fullrect[0][1], xmax, ymax, rr->rectx, rectf);
-
- glPixelZoom(1.0, 1.0);
-
-#ifdef __APPLE__
- window_swap_buffers(render_win->win);
-#else
- glFlush();
- glDrawBuffer(GL_BACK);
-#endif
-}
-
-
-/* in render window; display a couple of scanlines of rendered image */
-static void renderwin_progress_display_cb(RenderResult *rr, volatile rcti *rect)
-{
- if (render_win) {
- renderwin_progress(render_win, rr, rect);
- }
-}
-
-/* -------------- callbacks for render loop: interactivity ----------------------- */
-
-/* string is RW_MAXTEXT chars min */
-void make_renderinfo_string(RenderStats *rs, char *str)
-{
- extern char info_time_str[32]; // header_info.c
- extern unsigned long mem_in_use, mmap_in_use;
- float megs_used_memory, mmap_used_memory;
- char *spos= str;
-
- megs_used_memory= (mem_in_use-mmap_in_use)/(1024.0*1024.0);
- mmap_used_memory= (mmap_in_use)/(1024.0*1024.0);
-
- if(G.scene->lay & 0xFF000000)
- spos+= sprintf(spos, "Localview | ");
- else if(G.scene->r.scemode & R_SINGLE_LAYER)
- spos+= sprintf(spos, "Single Layer | ");
-
- spos+= sprintf(spos, "Fra:%d Ve:%d Fa:%d ", (G.scene->r.cfra), rs->totvert, rs->totface);
- if(rs->tothalo) spos+= sprintf(spos, "Ha:%d ", rs->tothalo);
- if(rs->totstrand) spos+= sprintf(spos, "St:%d ", rs->totstrand);
- spos+= sprintf(spos, "La:%d Mem:%.2fM (%.2fM) ", rs->totlamp, megs_used_memory, mmap_used_memory);
-
- if(rs->curfield)
- spos+= sprintf(spos, "Field %d ", rs->curfield);
- if(rs->curblur)
- spos+= sprintf(spos, "Blur %d ", rs->curblur);
-
- BLI_timestr(rs->lastframetime, info_time_str);
- spos+= sprintf(spos, "Time:%s ", info_time_str);
-
- if(rs->infostr)
- spos+= sprintf(spos, "| %s ", rs->infostr);
-
- /* very weak... but 512 characters is quite safe... we cannot malloc during thread render */
- if(spos >= str+RW_MAXTEXT)
- printf("WARNING! renderwin text beyond limit \n");
-
-}
-
-/* callback for print info in top header of renderwin */
-static void renderwin_renderinfo_cb(RenderStats *rs)
-{
-
- if(render_win) {
-
- make_renderinfo_string(rs, render_win->render_text);
-
-#ifdef __APPLE__
-#else
- glDrawBuffer(GL_FRONT);
-#endif
- renderwin_draw_render_info(render_win);
-
-#ifdef __APPLE__
- window_swap_buffers(render_win->win);
-#else
- glFlush();
- glDrawBuffer(GL_BACK);
-#endif
- }
-
-}
-
-/* -------------- callback system to allow ESC from rendering ----------------------- */
-
-/* POSIX & WIN32: this function is called all the time, and should not use cpu or resources */
-static int test_break(void)
-{
-
- if(G.afbreek==2) { /* code for testing queue */
-
- G.afbreek= 0;
-
- blender_test_break(); /* tests blender interface */
-
- if (G.afbreek==0 && render_win) { /* tests window */
- winlay_process_events(0);
- // render_win can be closed in winlay_process_events()
- if (render_win == 0 || (render_win->flags & RW_FLAGS_ESCAPE)) {
- G.afbreek= 1;
- }
- }
- }
-
- if(G.afbreek==1) return 1;
- else return 0;
-}
-
-
-
-#ifdef _WIN32
-/* we use the multimedia time here */
-static UINT uRenderTimerId;
-
-void CALLBACK interruptESC(UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2)
-{
- if(G.afbreek==0) G.afbreek= 2; /* code for read queue */
-}
-
-/* WIN32: init SetTimer callback */
-static void init_test_break_callback()
-{
- timeBeginPeriod(50);
- uRenderTimerId = timeSetEvent(250, 1, interruptESC, 0, TIME_PERIODIC);
-}
-
-/* WIN32: stop SetTimer callback */
-static void end_test_break_callback()
-{
- timeEndPeriod(50);
- timeKillEvent(uRenderTimerId);
-}
-
-#else
-/* all other OS's support signal(SIGVTALRM) */
-
-/* XXX The ESC problem: some unix users reported that ESC doesn't cancel
- * renders anymore. Most complaints came from linux, but it's not
- * general, not all linux users have the problem.
- *
- * From tests, the systems that do have it are not signalling SIGVTALRM
- * interrupts (an issue with signals and threads). Using SIGALRM instead
- * fixes the problem, at least while we investigate better.
- *
- * ITIMER_REAL (SIGALRM): timer that counts real system time
- * ITIMER_VIRTUAL (SIGVTALRM): only counts time spent in its owner process */
-
-/* POSIX: this function goes in the signal() callback */
-static void interruptESC(int sig)
-{
-
- if(G.afbreek==0) G.afbreek= 2; /* code for read queue */
-
- /* call again, timer was reset */
- signal(SIGALRM, interruptESC);
-}
-
-/* POSIX: initialize timer and signal */
-static void init_test_break_callback()
-{
-
- struct itimerval tmevalue;
-
- tmevalue.it_interval.tv_sec = 0;
- tmevalue.it_interval.tv_usec = 250000;
- /* when the first ? */
- tmevalue.it_value.tv_sec = 0;
- tmevalue.it_value.tv_usec = 10000;
-
- signal(SIGALRM, interruptESC);
- setitimer(ITIMER_REAL, &tmevalue, 0);
-}
-
-/* POSIX: stop timer and callback */
-static void end_test_break_callback()
-{
- struct itimerval tmevalue;
-
- memset(&tmevalue, 0, sizeof(struct itimerval));
-
- setitimer(ITIMER_REAL, &tmevalue, 0);
- signal(SIGALRM, SIG_IGN);
-
-}
-
-
-#endif
-
-
-
-/* -------------- callbacks for render loop: init & run! ----------------------- */
-
-
-/* - initialize displays
- - set callbacks
- - cleanup
-*/
-
-static void do_render(int anim)
-{
- Image *ima;
- Render *re= RE_NewRender(G.scene->id.name);
- unsigned int lay= G.scene->lay;
- int scemode= G.scene->r.scemode;
- int sculptmode= G.f & G_SCULPTMODE;
-
- /* UGLY! we set this flag to prevent renderwindow queue to execute another render */
- /* is reset in RE_BlenderFrame */
- G.rendering= 1;
-
- /* set render callbacks, also starts ESC timer */
- BIF_init_render_callbacks(re, 1);
-
- waitcursor(1);
- if(render_win)
- window_set_cursor(render_win->win, CURSOR_WAIT);
-
- if(G.obedit)
- exit_editmode(0); /* 0 = no free data */
-
- if(sculptmode) set_sculptmode();
-
- /* allow localview render for objects with lights in normal layers */
- if(curarea->spacetype==SPACE_VIEW3D) {
- /* if view is defined (might not be if called from script), check and set layers. */
- if(G.vd) {
- if(G.vd->lay & 0xFF000000) {
- G.scene->lay |= G.vd->lay;
- G.scene->r.scemode |= R_SINGLE_LAYER;
- }
- else G.scene->lay= G.vd->lay;
- }
- }
-
- if(anim)
- RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra);
- else
- RE_BlenderFrame(re, G.scene, G.scene->r.cfra);
-
- /* restore local view exception */
- G.scene->lay= lay;
- G.scene->r.scemode= scemode;
-
- if(render_win) window_set_cursor(render_win->win, CURSOR_STD);
-
- free_filesel_spec(G.scene->r.pic);
-
- G.afbreek= 0;
- BIF_end_render_callbacks();
-
- /* after an envmap creation... */
-// if(R.flag & R_REDRAW_PRV) {
-// BIF_preview_changed(ID_TE);
-// }
-
- scene_update_for_newframe(G.scene, G.scene->lay); // no redraw needed, this restores to view as we left it
-
- /* get a render result image, and make sure it is clean */
- ima= BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result");
- BKE_image_signal(ima, NULL, IMA_SIGNAL_FREE);
-
- if(sculptmode) set_sculptmode();
-
- waitcursor(0);
-}
-
-/* called before render, store old render in spare buffer */
-static void renderwin_store_spare(void)
-{
- RenderResult rres;
-
- if(render_win==0 || render_win->storespare==0)
- return;
-
- /* only store when it does not show spare */
- if(render_win->showspare==0)
- return;
-
- render_win->showspare= 0;
- window_set_title(render_win->win, renderwin_get_title(1));
-
- BLI_strncpy(render_win->render_text_spare, render_win->render_text, RW_MAXTEXT);
-
- if(render_win->rectspare) MEM_freeN(render_win->rectspare);
- render_win->rectspare= NULL;
- if(render_win->rectsparef) MEM_freeN(render_win->rectsparef);
- render_win->rectsparef= NULL;
-
- RE_GetResultImage(RE_GetRender(G.scene->id.name), &rres);
-
- if(rres.rect32)
- render_win->rectspare= MEM_dupallocN(rres.rect32);
- else if(rres.rectf)
- render_win->rectsparef= MEM_dupallocN(rres.rectf);
-
- render_win->sparex= rres.rectx;
- render_win->sparey= rres.recty;
-}
-
-/* -------------- API: externally called --------------- */
-
-static void error_cb(char *str){error(str);}
-static int esc_timer_set= 0;
-
-/* set callbacks, exported to sequence render too.
- Only call in foreground (UI) renders. */
-
-void BIF_init_render_callbacks(Render *re, int do_display)
-{
- if(do_display) {
- if(G.displaymode!=R_DISPLAYWIN) {
- if(render_win)
- BIF_close_render_display();
- imagewindow_render_callbacks(re);
- }
- else {
- RE_display_init_cb(re, renderwin_init_display_cb);
- RE_display_draw_cb(re, renderwin_progress_display_cb);
- RE_display_clear_cb(re, renderwin_clear_display_cb);
- RE_stats_draw_cb(re, renderwin_renderinfo_cb);
- }
- }
-
- RE_error_cb(re, error_cb);
-
- G.afbreek= 0;
- if(render_win)
- render_win->flags &= ~RW_FLAGS_ESCAPE;
-
- /* start esc timer. ensure it happens once only */
- if(esc_timer_set==0)
- init_test_break_callback();
- esc_timer_set++;
-
- RE_test_break_cb(re, test_break);
- RE_timecursor_cb(re, set_timecursor);
-
-}
-
-/* the init/end callbacks can be called multiple times (sequence render) */
-void BIF_end_render_callbacks(void)
-{
- esc_timer_set--;
- if(esc_timer_set==0) {
- end_test_break_callback();
-
- if(render_win)
- mainwindow_make_active();
- }
-}
-
-void BIF_store_spare(void)
-{
- if(render_win)
- renderwin_store_spare();
- else
- imagewin_store_spare();
-}
-
-/* set up display, render an image or scene */
-void BIF_do_render(int anim)
-{
- int slink_flag = 0;
-
- if (G.f & G_DOSCRIPTLINKS) {
- BPY_do_all_scripts(SCRIPT_RENDER);
- if (!anim) { /* avoid FRAMECHANGED slink in render callback */
- G.f &= ~G_DOSCRIPTLINKS;
- slink_flag = 1;
- }
- }
-
- BIF_store_spare();
-
- do_render(anim);
-
- if(G.scene->use_nodes) {
- allqueue(REDRAWNODE, 1);
- allqueue(REDRAWIMAGE, 1);
- }
- if (slink_flag) G.f |= G_DOSCRIPTLINKS;
- if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_POSTRENDER);
-}
-
-void do_ogl_view3d_render(Render *re, View3D *v3d, int winx, int winy)
-{
- float winmat[4][4];
-
- update_for_newframe_muted(); /* here, since camera can be animated */
-
- if(v3d->persp==2 && v3d->camera) {
- /* in camera view, use actual render winmat */
- RE_GetCameraWindow(re, v3d->camera, CFRA, winmat);
- drawview3d_render(v3d, winx, winy, winmat);
- }
- else
- drawview3d_render(v3d, winx, winy, NULL);
-}
-
-/* set up display, render the current area view in an image */
-/* the RE_Render is only used to make sure we got the picture in the result */
-void BIF_do_ogl_render(View3D *v3d, int anim)
-{
- Render *re= RE_NewRender(G.scene->id.name);
- RenderResult *rr;
- int winx, winy;
-
- G.afbreek= 0;
- init_test_break_callback();
-
- winx= (G.scene->r.size*G.scene->r.xsch)/100;
- winy= (G.scene->r.size*G.scene->r.ysch)/100;
-
- RE_InitState(re, &G.scene->r, winx, winy, NULL);
-
- /* for now, result is defaulting to floats still... */
- rr= RE_GetResult(re);
- if(rr->rect32==NULL)
- rr->rect32= MEM_mallocN(sizeof(int)*winx*winy, "32 bits rects");
-
- /* open window */
- renderwin_init_display_cb(rr);
- if(render_win)
- render_win->flags &= ~RW_FLAGS_ESCAPE;
-
- init_gl_stuff();
-
- waitcursor(1);
-
- if(anim) {
- bMovieHandle *mh= BKE_get_movie_handle(G.scene->r.imtype);
- int cfrao= CFRA;
-
- if(BKE_imtype_is_movie(G.scene->r.imtype))
- mh->start_movie(&G.scene->r, winx, winy);
-
- for(CFRA= SFRA; CFRA<=EFRA; CFRA++) {
- /* user event can close window */
- if(render_win==NULL)
- break;
-
- do_ogl_view3d_render(re, v3d, winx, winy);
- glReadPixels(0, 0, winx, winy, GL_RGBA, GL_UNSIGNED_BYTE, rr->rect32);
- BKE_stamp_buf((unsigned char *)rr->rect32, rr->rectf, rr->rectx, rr->recty);
- window_swap_buffers(render_win->win);
-
- if(BKE_imtype_is_movie(G.scene->r.imtype)) {
- mh->append_movie(CFRA, rr->rect32, winx, winy);
- printf("Append frame %d", G.scene->r.cfra);
- }
- else {
- ImBuf *ibuf= IMB_allocImBuf(winx, winy, G.scene->r.planes, 0, 0);
- char name[FILE_MAXDIR+FILE_MAXFILE];
- int ok;
-
- BKE_makepicstring(name, G.scene->r.pic, G.scene->r.cfra, G.scene->r.imtype);
-
- ibuf->rect= (unsigned int *)rr->rect32;
- ok= BKE_write_ibuf(ibuf, name, G.scene->r.imtype, G.scene->r.subimtype, G.scene->r.quality);
-
- if(ok==0) {
- printf("Write error: cannot save %s\n", name);
- break;
- }
- else printf("Saved: %s", name);
-
- /* imbuf knows which rects are not part of ibuf */
- IMB_freeImBuf(ibuf);
- }
- /* movie stats prints have no line break */
- printf("\n");
-
- if(test_break()) break;
- }
-
- if(BKE_imtype_is_movie(G.scene->r.imtype))
- mh->end_movie();
-
- CFRA= cfrao;
- }
- else {
- do_ogl_view3d_render(re, v3d, winx, winy);
- glReadPixels(0, 0, winx, winy, GL_RGBA, GL_UNSIGNED_BYTE, rr->rect32);
- BKE_stamp_buf((unsigned char *)rr->rect32, rr->rectf, rr->rectx, rr->recty);
- window_swap_buffers(render_win->win);
- }
-
- if(render_win)
- renderwin_draw(render_win, 0);
-
- mainwindow_make_active();
-
- if(anim)
- scene_update_for_newframe(G.scene, G.scene->lay); // no redraw needed, this restores to view as we left it
-
- end_test_break_callback();
- waitcursor(0);
-}
-
-void BIF_redraw_render_rect(void)
-{
- /* redraw */
- if (render_win) {
- renderwin_queue_redraw(render_win);
- }
- else {
- allqueue(REDRAWIMAGE, 0);
- }
-}
-
-void BIF_swap_render_rects(void)
-{
- RenderResult rres;
-
- if(G.displaymode!=R_DISPLAYWIN) {
- imagewindow_swap_render_rects();
- }
- else if(render_win) {
-
- render_win->storespare= 1;
- render_win->showspare ^= 1;
-
- RE_GetResultImage(RE_GetRender(G.scene->id.name), &rres);
-
- if(render_win->sparex!=rres.rectx || render_win->sparey!=rres.recty) {
- if(render_win->rectspare) MEM_freeN(render_win->rectspare);
- render_win->rectspare= NULL;
- if(render_win->rectsparef) MEM_freeN(render_win->rectsparef);
- render_win->rectsparef= NULL;
- }
-
- window_set_title(render_win->win, renderwin_get_title(1));
- }
-
- /* redraw */
- BIF_redraw_render_rect();
-
-}
-
-/* called from usiblender.c too, to free and close renderwin */
-void BIF_close_render_display(void)
-{
- if (render_win) {
- if (render_win->info_text) MEM_freeN(render_win->info_text);
- if (render_win->render_text) MEM_freeN(render_win->render_text);
- if (render_win->render_text_spare) MEM_freeN(render_win->render_text_spare);
- if (render_win->rectspare) MEM_freeN(render_win->rectspare);
- if (render_win->rectsparef) MEM_freeN(render_win->rectsparef);
-
- window_destroy(render_win->win); /* ghost close window */
- MEM_freeN(render_win);
-
- render_win= NULL;
- }
-}
-
-
-/* typical with F11 key, show image or hide/close */
-void BIF_toggle_render_display(void)
-{
-
- if (G.displaymode!=R_DISPLAYWIN) {
- imagewindow_toggle_render();
- }
- else {
- if (render_win) {
- if(render_win->active) {
- mainwindow_raise();
- mainwindow_make_active();
- render_win->active= 0;
- }
- else {
- window_raise(render_win->win);
- window_make_active(render_win->win);
- render_win->active= 1;
- }
- }
- else {
- RenderResult *rr= RE_GetResult(RE_GetRender(G.scene->id.name));
- if(rr) renderwin_init_display_cb(rr);
- }
- }
-}
-
-void BIF_renderwin_set_custom_cursor(unsigned char mask[16][2], unsigned char bitmap[16][2])
-{
- if (render_win) {
- window_set_custom_cursor(render_win->win, mask, bitmap, 7, 7);
- }
-}
diff --git a/source/blender/src/resources.c b/source/blender/src/resources.c
deleted file mode 100644
index 25295f4cd3c..00000000000
--- a/source/blender/src/resources.c
+++ /dev/null
@@ -1,923 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_listBase.h"
-#include "DNA_userdef_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-
-#include "IMB_imbuf.h"
-#include "IMB_imbuf_types.h"
-
-#include "BKE_utildefines.h"
-
-#include "BIF_gl.h"
-#include "BIF_resources.h"
-#include "BIF_interface_icons.h"
-
-#include "BLI_blenlib.h"
-#include "blendef.h" // CLAMP
-#include "datatoc.h"
-
-/* global for themes */
-typedef void (*VectorDrawFunc)(int x, int y, int w, int h, float alpha);
-
-static bTheme *theme_active=NULL;
-static int theme_spacetype= SPACE_VIEW3D;
-
-
-void BIF_resources_init(void)
-{
- BIF_icons_init(BIFICONID_LAST+1);
-}
-
-void BIF_resources_free(void)
-{
- BIF_icons_free();
-}
-
-
-/* ******************************************************** */
-/* THEMES */
-/* ******************************************************** */
-
-char *BIF_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
-{
- ThemeSpace *ts= NULL;
- static char error[4]={240, 0, 240, 255};
- static char alert[4]={240, 60, 60, 255};
- static char headerdesel[4]={0,0,0,255};
- static char custom[4]={0,0,0,255};
-
- char *cp= error;
-
- if(btheme) {
-
- // first check for ui buttons theme
- if(colorid < TH_THEMEUI) {
-
- switch(colorid) {
- case TH_BUT_OUTLINE:
- cp= btheme->tui.outline; break;
- case TH_BUT_NEUTRAL:
- cp= btheme->tui.neutral; break;
- case TH_BUT_ACTION:
- cp= btheme->tui.action; break;
- case TH_BUT_SETTING:
- cp= btheme->tui.setting; break;
- case TH_BUT_SETTING1:
- cp= btheme->tui.setting1; break;
- case TH_BUT_SETTING2:
- cp= btheme->tui.setting2; break;
- case TH_BUT_NUM:
- cp= btheme->tui.num; break;
- case TH_BUT_TEXTFIELD:
- cp= btheme->tui.textfield; break;
- case TH_BUT_TEXTFIELD_HI:
- cp= btheme->tui.textfield_hi; break;
- case TH_BUT_POPUP:
- cp= btheme->tui.popup; break;
- case TH_BUT_TEXT:
- cp= btheme->tui.text; break;
- case TH_BUT_TEXT_HI:
- cp= btheme->tui.text_hi; break;
- case TH_MENU_BACK:
- cp= btheme->tui.menu_back; break;
- case TH_MENU_ITEM:
- cp= btheme->tui.menu_item; break;
- case TH_MENU_HILITE:
- cp= btheme->tui.menu_hilite; break;
- case TH_MENU_TEXT:
- cp= btheme->tui.menu_text; break;
- case TH_MENU_TEXT_HI:
- cp= btheme->tui.menu_text_hi; break;
-
- case TH_BUT_DRAWTYPE:
- cp= &btheme->tui.but_drawtype; break;
-
- case TH_ICONFILE:
- cp= btheme->tui.iconfile; break;
-
- case TH_REDALERT:
- cp= alert; break;
- case TH_CUSTOM:
- cp= custom; break;
- }
- }
- else {
-
- switch(spacetype) {
- case SPACE_BUTS:
- ts= &btheme->tbuts;
- break;
- case SPACE_VIEW3D:
- ts= &btheme->tv3d;
- break;
- case SPACE_IPO:
- ts= &btheme->tipo;
- break;
- case SPACE_FILE:
- ts= &btheme->tfile;
- break;
- case SPACE_NLA:
- ts= &btheme->tnla;
- break;
- case SPACE_ACTION:
- ts= &btheme->tact;
- break;
- case SPACE_SEQ:
- ts= &btheme->tseq;
- break;
- case SPACE_IMAGE:
- ts= &btheme->tima;
- break;
- case SPACE_IMASEL:
- ts= &btheme->timasel;
- break;
- case SPACE_TEXT:
- ts= &btheme->text;
- break;
- case SPACE_OOPS:
- ts= &btheme->toops;
- break;
- case SPACE_SOUND:
- ts= &btheme->tsnd;
- break;
- case SPACE_INFO:
- ts= &btheme->tinfo;
- break;
- case SPACE_TIME:
- ts= &btheme->ttime;
- break;
- case SPACE_NODE:
- ts= &btheme->tnode;
- break;
- default:
- ts= &btheme->tv3d;
- break;
- }
-
- switch(colorid) {
- case TH_BACK:
- cp= ts->back; break;
- case TH_TEXT:
- cp= ts->text; break;
- case TH_TEXT_HI:
- cp= ts->text_hi; break;
- case TH_HEADER:
- cp= ts->header; break;
- case TH_HEADERDESEL:
- /* we calculate a dynamic builtin header deselect color, also for pulldowns... */
- cp= ts->header;
- headerdesel[0]= cp[0]>10?cp[0]-10:0;
- headerdesel[1]= cp[1]>10?cp[1]-10:0;
- headerdesel[2]= cp[2]>10?cp[2]-10:0;
- cp= headerdesel;
- break;
- case TH_PANEL:
- cp= ts->panel; break;
- case TH_SHADE1:
- cp= ts->shade1; break;
- case TH_SHADE2:
- cp= ts->shade2; break;
- case TH_HILITE:
- cp= ts->hilite; break;
-
- case TH_GRID:
- cp= ts->grid; break;
- case TH_WIRE:
- cp= ts->wire; break;
- case TH_LAMP:
- cp= ts->lamp; break;
- case TH_SELECT:
- cp= ts->select; break;
- case TH_ACTIVE:
- cp= ts->active; break;
- case TH_GROUP:
- cp= ts->group; break;
- case TH_GROUP_ACTIVE:
- cp= ts->group_active; break;
- case TH_TRANSFORM:
- cp= ts->transform; break;
- case TH_VERTEX:
- cp= ts->vertex; break;
- case TH_VERTEX_SELECT:
- cp= ts->vertex_select; break;
- case TH_VERTEX_SIZE:
- cp= &ts->vertex_size; break;
- case TH_EDGE:
- cp= ts->edge; break;
- case TH_EDGE_SELECT:
- cp= ts->edge_select; break;
- case TH_EDGE_SEAM:
- cp= ts->edge_seam; break;
- case TH_EDGE_SHARP:
- cp= ts->edge_sharp; break;
- case TH_EDITMESH_ACTIVE:
- cp= ts->editmesh_active; break;
- case TH_EDGE_FACESEL:
- cp= ts->edge_facesel; break;
- case TH_FACE:
- cp= ts->face; break;
- case TH_FACE_SELECT:
- cp= ts->face_select; break;
- case TH_FACE_DOT:
- cp= ts->face_dot; break;
- case TH_FACEDOT_SIZE:
- cp= &ts->facedot_size; break;
- case TH_NORMAL:
- cp= ts->normal; break;
- case TH_BONE_SOLID:
- cp= ts->bone_solid; break;
- case TH_BONE_POSE:
- cp= ts->bone_pose; break;
- case TH_STRIP:
- cp= ts->strip; break;
- case TH_STRIP_SELECT:
- cp= ts->strip_select; break;
- case TH_CFRAME:
- cp= ts->cframe; break;
-
- case TH_SYNTAX_B:
- cp= ts->syntaxb; break;
- case TH_SYNTAX_V:
- cp= ts->syntaxv; break;
- case TH_SYNTAX_C:
- cp= ts->syntaxc; break;
- case TH_SYNTAX_L:
- cp= ts->syntaxl; break;
- case TH_SYNTAX_N:
- cp= ts->syntaxn; break;
-
- case TH_NODE:
- cp= ts->syntaxl; break;
- case TH_NODE_IN_OUT:
- cp= ts->syntaxn; break;
- case TH_NODE_OPERATOR:
- cp= ts->syntaxb; break;
- case TH_NODE_CONVERTOR:
- cp= ts->syntaxv; break;
- case TH_NODE_GROUP:
- cp= ts->syntaxc; break;
-
- case TH_SEQ_MOVIE:
- cp= ts->movie; break;
- case TH_SEQ_IMAGE:
- cp= ts->image; break;
- case TH_SEQ_SCENE:
- cp= ts->scene; break;
- case TH_SEQ_AUDIO:
- cp= ts->audio; break;
- case TH_SEQ_EFFECT:
- cp= ts->effect; break;
- case TH_SEQ_PLUGIN:
- cp= ts->plugin; break;
- case TH_SEQ_TRANSITION:
- cp= ts->transition; break;
- case TH_SEQ_META:
- cp= ts->meta; break;
-
- }
-
- }
- }
-
- return cp;
-}
-
-#define SETCOL(col, r, g, b, a) col[0]=r; col[1]=g; col[2]= b; col[3]= a;
-
-/* initialize
- Note: when you add new colors, created & saved themes need initialized
- in usiblender.c, search for "versionfile"
-*/
-void BIF_InitTheme(void)
-{
- bTheme *btheme= U.themes.first;
-
- /* we search for the theme with name Default */
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
- if(strcmp("Default", btheme->name)==0) break;
- }
-
- if(btheme==NULL) {
- btheme= MEM_callocN(sizeof(bTheme), "theme");
- BLI_addtail(&U.themes, btheme);
- strcpy(btheme->name, "Default");
- }
-
- BIF_SetTheme(NULL); // make sure the global used in this file is set
-
- /* UI buttons (todo) */
- SETCOL(btheme->tui.outline, 0xA0,0xA0,0xA0, 255);
- SETCOL(btheme->tui.neutral, 0xA0,0xA0,0xA0, 255);
- SETCOL(btheme->tui.action, 0xAD,0xA0,0x93, 255);
- SETCOL(btheme->tui.setting, 0x8A,0x9E,0xA1, 255);
- SETCOL(btheme->tui.setting1, 0xA1,0xA1,0xAE, 255);
- SETCOL(btheme->tui.setting2, 0xA1,0x99,0xA7, 255);
- SETCOL(btheme->tui.num, 0x90,0x90,0x90, 255);
- SETCOL(btheme->tui.textfield, 0x90,0x90,0x90, 255);
- SETCOL(btheme->tui.textfield_hi,0xc6,0x77,0x77, 255);
- SETCOL(btheme->tui.popup, 0xA0,0xA0,0xA0, 255);
-
- SETCOL(btheme->tui.text, 0,0,0, 255);
- SETCOL(btheme->tui.text_hi, 255, 255, 255, 255);
-
- SETCOL(btheme->tui.menu_back, 0xD2,0xD2,0xD2, 255);
- SETCOL(btheme->tui.menu_item, 0xDA,0xDA,0xDA, 255);
- SETCOL(btheme->tui.menu_hilite, 0x7F,0x7F,0x7F, 255);
- SETCOL(btheme->tui.menu_text, 0, 0, 0, 255);
- SETCOL(btheme->tui.menu_text_hi, 255, 255, 255, 255);
- btheme->tui.but_drawtype= TH_SHADED;
-
- BLI_strncpy(btheme->tui.iconfile, "", sizeof(btheme->tui.iconfile));
-
- /* space view3d */
- SETCOL(btheme->tv3d.back, 115, 115, 115, 255);
- SETCOL(btheme->tv3d.text, 0, 0, 0, 255);
- SETCOL(btheme->tv3d.text_hi, 255, 255, 255, 255);
- SETCOL(btheme->tv3d.header, 195, 195, 195, 255);
- SETCOL(btheme->tv3d.panel, 165, 165, 165, 127);
-
- SETCOL(btheme->tv3d.shade1, 160, 160, 160, 100);
- SETCOL(btheme->tv3d.shade2, 0x7f, 0x70, 0x70, 100);
-
- SETCOL(btheme->tv3d.grid, 92, 92, 92, 255);
- SETCOL(btheme->tv3d.wire, 0x0, 0x0, 0x0, 255);
- SETCOL(btheme->tv3d.lamp, 0, 0, 0, 40);
- SETCOL(btheme->tv3d.select, 0xff, 0x88, 0xff, 255);
- SETCOL(btheme->tv3d.active, 0xff, 0xbb, 0xff, 255);
- SETCOL(btheme->tv3d.group, 0x10, 0x40, 0x10, 255);
- SETCOL(btheme->tv3d.group_active, 0x55, 0xbb, 0x55, 255);
- SETCOL(btheme->tv3d.transform, 0xff, 0xff, 0xff, 255);
- SETCOL(btheme->tv3d.vertex, 0xff, 0x70, 0xff, 255);
- SETCOL(btheme->tv3d.vertex_select, 0xff, 0xff, 0x70, 255);
- btheme->tv3d.vertex_size= 2;
- SETCOL(btheme->tv3d.edge, 0x0, 0x0, 0x0, 255);
- SETCOL(btheme->tv3d.edge_select, 0xb0, 0xb0, 0x30, 255);
- SETCOL(btheme->tv3d.edge_seam, 230, 150, 50, 255);
- SETCOL(btheme->tv3d.edge_facesel, 75, 75, 75, 255);
- SETCOL(btheme->tv3d.face, 0, 50, 150, 30);
- SETCOL(btheme->tv3d.face_select, 200, 100, 200, 60);
- SETCOL(btheme->tv3d.normal, 0x22, 0xDD, 0xDD, 255);
- SETCOL(btheme->tv3d.face_dot, 255, 138, 48, 255);
- btheme->tv3d.facedot_size= 4;
- SETCOL(btheme->tv3d.cframe, 0x60, 0xc0, 0x40, 255);
-
- SETCOL(btheme->tv3d.bone_solid, 200, 200, 200, 255);
- SETCOL(btheme->tv3d.bone_pose, 80, 200, 255, 80); // alpha 80 is not meant editable, used for wire+action draw
-
-
- /* space buttons */
- /* to have something initialized */
- btheme->tbuts= btheme->tv3d;
-
- SETCOL(btheme->tbuts.back, 180, 180, 180, 255);
- SETCOL(btheme->tbuts.header, 195, 195, 195, 255);
- SETCOL(btheme->tbuts.panel, 255, 255, 255, 40);
-
- /* space ipo */
- /* to have something initialized */
- btheme->tipo= btheme->tv3d;
-
- SETCOL(btheme->tipo.grid, 94, 94, 94, 255);
- SETCOL(btheme->tipo.back, 120, 120, 120, 255);
- SETCOL(btheme->tipo.header, 195, 195, 195, 255);
- SETCOL(btheme->tipo.panel, 255, 255, 255, 150);
- SETCOL(btheme->tipo.shade1, 172, 172, 172, 100);
- SETCOL(btheme->tipo.shade2, 0x70, 0x70, 0x70, 100);
- SETCOL(btheme->tipo.vertex, 0xff, 0x70, 0xff, 255);
- SETCOL(btheme->tipo.vertex_select, 0xff, 0xff, 0x70, 255);
- SETCOL(btheme->tipo.hilite, 0x60, 0xc0, 0x40, 255);
- btheme->tipo.vertex_size= 3;
-
- /* space file */
- /* to have something initialized */
- btheme->tfile= btheme->tv3d;
- SETCOL(btheme->tfile.back, 128, 128, 128, 255);
- SETCOL(btheme->tfile.text, 0, 0, 0, 255);
- SETCOL(btheme->tfile.text_hi, 255, 255, 255, 255);
- SETCOL(btheme->tfile.header, 182, 182, 182, 255);
- SETCOL(btheme->tfile.hilite, 0xA0, 0xA0, 0xD0, 255); // selected files
-
-
- /* space action */
- btheme->tact= btheme->tv3d;
- SETCOL(btheme->tact.back, 116, 116, 116, 255);
- SETCOL(btheme->tact.text, 0, 0, 0, 255);
- SETCOL(btheme->tact.text_hi, 255, 255, 255, 255);
- SETCOL(btheme->tact.header, 182, 182, 182, 255);
- SETCOL(btheme->tact.grid, 94, 94, 94, 255);
- SETCOL(btheme->tact.face, 166, 166, 166, 255); // RVK
- SETCOL(btheme->tact.shade1, 172, 172, 172, 255); // sliders
- SETCOL(btheme->tact.shade2, 84, 44, 31, 100); // bar
- SETCOL(btheme->tact.hilite, 17, 27, 60, 100); // bar
- SETCOL(btheme->tact.strip_select, 0xff, 0xff, 0xaa, 255);
- SETCOL(btheme->tact.strip, 0xe4, 0x9c, 0xc6, 255);
-
- /* space nla */
- btheme->tnla= btheme->tv3d;
- SETCOL(btheme->tnla.back, 116, 116, 116, 255);
- SETCOL(btheme->tnla.text, 0, 0, 0, 255);
- SETCOL(btheme->tnla.text_hi, 255, 255, 255, 255);
- SETCOL(btheme->tnla.header, 182, 182, 182, 255);
- SETCOL(btheme->tnla.grid, 94, 94, 94, 255);
- SETCOL(btheme->tnla.shade1, 172, 172, 172, 255); // sliders
- SETCOL(btheme->tnla.shade2, 84, 44, 31, 100); // bar
- SETCOL(btheme->tnla.hilite, 17, 27, 60, 100); // bar
- SETCOL(btheme->tnla.strip_select, 0xff, 0xff, 0xaa, 255);
- SETCOL(btheme->tnla.strip, 0xe4, 0x9c, 0xc6, 255);
-
- /* space seq */
- btheme->tseq= btheme->tv3d;
- SETCOL(btheme->tseq.back, 116, 116, 116, 255);
- SETCOL(btheme->tseq.movie, 81, 105, 135, 255);
- SETCOL(btheme->tseq.image, 109, 88, 129, 255);
- SETCOL(btheme->tseq.scene, 78, 152, 62, 255);
- SETCOL(btheme->tseq.audio, 46, 143, 143, 255);
- SETCOL(btheme->tseq.effect, 169, 84, 124, 255);
- SETCOL(btheme->tseq.plugin, 126, 126, 80, 255);
- SETCOL(btheme->tseq.transition, 162, 95, 111, 255);
- SETCOL(btheme->tseq.meta, 109, 145, 131, 255);
-
-
- /* space image */
- btheme->tima= btheme->tv3d;
- SETCOL(btheme->tima.back, 53, 53, 53, 255);
- SETCOL(btheme->tima.vertex, 0xff, 0x70, 0xff, 255);
- SETCOL(btheme->tima.vertex_select, 0xff, 0xff, 0x70, 255);
- btheme->tima.vertex_size= 2;
- SETCOL(btheme->tima.face, 0, 50, 150, 40);
- SETCOL(btheme->tima.face_select, 200, 100, 200, 80);
-
- /* space imageselect */
- btheme->timasel= btheme->tv3d;
- SETCOL(btheme->timasel.active, 195, 195, 195, 255); /* active tile */
- SETCOL(btheme->timasel.grid, 94, 94, 94, 255); /* active file text */
- SETCOL(btheme->timasel.back, 110, 110, 110, 255);
- SETCOL(btheme->timasel.header, 195, 195, 195, 255);
- SETCOL(btheme->timasel.shade1, 94, 94, 94, 255); /* bar */
- SETCOL(btheme->timasel.shade2, 172, 172, 172, 255); /* sliders */
- SETCOL(btheme->timasel.hilite, 17, 27, 60, 100); /* selected tile */
- SETCOL(btheme->timasel.text, 0, 0, 0, 255);
- SETCOL(btheme->timasel.text_hi, 255, 255, 255, 255);
- SETCOL(btheme->timasel.panel, 132, 132, 132, 255);
-
- /* space text */
- btheme->text= btheme->tv3d;
- SETCOL(btheme->text.back, 153, 153, 153, 255);
- SETCOL(btheme->text.shade1, 143, 143, 143, 255);
- SETCOL(btheme->text.shade2, 0xc6, 0x77, 0x77, 255);
- SETCOL(btheme->text.hilite, 255, 0, 0, 255);
-
- /* syntax highlighting */
- SETCOL(btheme->text.syntaxn, 0, 0, 200, 255); /* Numbers Blue*/
- SETCOL(btheme->text.syntaxl, 100, 0, 0, 255); /* Strings red */
- SETCOL(btheme->text.syntaxc, 0, 100, 50, 255); /* Comments greenish */
- SETCOL(btheme->text.syntaxv, 95, 95, 0, 255); /* Special */
- SETCOL(btheme->text.syntaxb, 128, 0, 80, 255); /* Builtin, red-purple */
-
- /* space oops */
- btheme->toops= btheme->tv3d;
- SETCOL(btheme->toops.back, 153, 153, 153, 255);
-
- /* space info */
- btheme->tinfo= btheme->tv3d;
- SETCOL(btheme->tinfo.back, 153, 153, 153, 255);
-
- /* space sound */
- btheme->tsnd= btheme->tv3d;
- SETCOL(btheme->tsnd.back, 153, 153, 153, 255);
- SETCOL(btheme->tsnd.shade1, 173, 173, 173, 255); // sliders
- SETCOL(btheme->tsnd.grid, 140, 140, 140, 255);
-
- /* space time */
- btheme->ttime= btheme->tsnd; // same as sound space
-
- /* space node, re-uses syntax color storage */
- btheme->tnode= btheme->tv3d;
- SETCOL(btheme->tnode.edge_select, 255, 255, 255, 255);
- SETCOL(btheme->tnode.syntaxl, 150, 150, 150, 255); /* TH_NODE, backdrop */
- SETCOL(btheme->tnode.syntaxn, 129, 131, 144, 255); /* in/output */
- SETCOL(btheme->tnode.syntaxb, 127,127,127, 255); /* operator */
- SETCOL(btheme->tnode.syntaxv, 142, 138, 145, 255); /* generator */
- SETCOL(btheme->tnode.syntaxc, 120, 145, 120, 255); /* group */
-
-}
-
-char *BIF_ThemeColorsPup(int spacetype)
-{
- char *cp= MEM_callocN(32*32, "theme pup");
- char *str = cp;
-
- if(spacetype==0) {
- str += sprintf(str, "Outline %%x%d|", TH_BUT_OUTLINE);
- str += sprintf(str, "Neutral %%x%d|", TH_BUT_NEUTRAL);
- str += sprintf(str, "Action %%x%d|", TH_BUT_ACTION);
- str += sprintf(str, "Setting %%x%d|", TH_BUT_SETTING);
- str += sprintf(str, "Special Setting 1%%x%d|", TH_BUT_SETTING1);
- str += sprintf(str, "Special Setting 2 %%x%d|", TH_BUT_SETTING2);
- str += sprintf(str, "Number Input %%x%d|", TH_BUT_NUM);
- str += sprintf(str, "Text Input %%x%d|", TH_BUT_TEXTFIELD);
- str += sprintf(str, "Text Input Highlight %%x%d|", TH_BUT_TEXTFIELD_HI);
- str += sprintf(str, "Popup %%x%d|", TH_BUT_POPUP);
- str += sprintf(str, "Text %%x%d|", TH_BUT_TEXT);
- str += sprintf(str, "Text Highlight %%x%d|", TH_BUT_TEXT_HI);
- str += sprintf(str, "%%l|");
- str += sprintf(str, "Menu Background %%x%d|", TH_MENU_BACK);
- str += sprintf(str, "Menu Item %%x%d|", TH_MENU_ITEM);
- str += sprintf(str, "Menu Item Highlight %%x%d|", TH_MENU_HILITE);
- str += sprintf(str, "Menu Text %%x%d|", TH_MENU_TEXT);
- str += sprintf(str, "Menu Text Highlight %%x%d|", TH_MENU_TEXT_HI);
- str += sprintf(str, "%%l|");
- str += sprintf(str, "Drawtype %%x%d|", TH_BUT_DRAWTYPE);
- str += sprintf(str, "%%l|");
- str += sprintf(str, "Icon File %%x%d|", TH_ICONFILE);
- }
- else {
- // first defaults for each space
- str += sprintf(str, "Background %%x%d|", TH_BACK);
- str += sprintf(str, "Text %%x%d|", TH_TEXT);
- str += sprintf(str, "Text Highlight %%x%d|", TH_TEXT_HI);
- str += sprintf(str, "Header %%x%d|", TH_HEADER);
-
- switch(spacetype) {
- case SPACE_VIEW3D:
- str += sprintf(str, "Panel %%x%d|", TH_PANEL);
- str += sprintf(str, "%%l|");
- str += sprintf(str, "Grid %%x%d|", TH_GRID);
- str += sprintf(str, "Wire %%x%d|", TH_WIRE);
- str += sprintf(str, "Lamp %%x%d|", TH_LAMP);
- str += sprintf(str, "Object Selected %%x%d|", TH_SELECT);
- str += sprintf(str, "Object Active %%x%d|", TH_ACTIVE);
- str += sprintf(str, "Object Grouped %%x%d|", TH_GROUP);
- str += sprintf(str, "Object Grouped Active %%x%d|", TH_GROUP_ACTIVE);
- str += sprintf(str, "Transform %%x%d|", TH_TRANSFORM);
- str += sprintf(str, "%%l|");
- str += sprintf(str, "Vertex %%x%d|", TH_VERTEX);
- str += sprintf(str, "Vertex Selected %%x%d|", TH_VERTEX_SELECT);
- str += sprintf(str, "Vertex Size %%x%d|", TH_VERTEX_SIZE);
- str += sprintf(str, "Edge Selected %%x%d|", TH_EDGE_SELECT);
- str += sprintf(str, "Edge Seam %%x%d|", TH_EDGE_SEAM);
- str += sprintf(str, "Edge Sharp %%x%d|", TH_EDGE_SHARP);
- str += sprintf(str, "Edge UV Face Select %%x%d|", TH_EDGE_FACESEL);
- str += sprintf(str, "Face (transp) %%x%d|", TH_FACE);
- str += sprintf(str, "Face Selected (transp) %%x%d|", TH_FACE_SELECT);
- str += sprintf(str, "Face Dot Selected %%x%d|", TH_FACE_DOT);
- str += sprintf(str, "Face Dot Size %%x%d|", TH_FACEDOT_SIZE);
- str += sprintf(str, "Active Vert/Edge/Face %%x%d|", TH_EDITMESH_ACTIVE);
- str += sprintf(str, "Normal %%x%d|", TH_NORMAL);
- str += sprintf(str, "Bone Solid %%x%d|", TH_BONE_SOLID);
- str += sprintf(str, "Bone Pose %%x%d", TH_BONE_POSE);
- str += sprintf(str, "Current Frame %%x%d", TH_CFRAME);
- break;
- case SPACE_IPO:
- str += sprintf(str, "Panel %%x%d|", TH_PANEL);
- str += sprintf(str, "%%l|");
- str += sprintf(str, "Grid %%x%d|", TH_GRID);
- str += sprintf(str, "Window Sliders %%x%d|", TH_SHADE1);
- str += sprintf(str, "Ipo Channels %%x%d|", TH_SHADE2);
- str += sprintf(str, "Vertex %%x%d|", TH_VERTEX);
- str += sprintf(str, "Vertex Selected %%x%d|", TH_VERTEX_SELECT);
- str += sprintf(str, "Vertex Size %%x%d|", TH_VERTEX_SIZE);
- str += sprintf(str, "Current Frame %%x%d", TH_CFRAME);
- break;
- case SPACE_FILE:
- str += sprintf(str, "Selected file %%x%d", TH_HILITE);
- break;
- case SPACE_NLA:
- //str += sprintf(str, "Panel %%x%d|", TH_PANEL);
- str += sprintf(str, "%%l|");
- str += sprintf(str, "Grid %%x%d|", TH_GRID);
- str += sprintf(str, "View Sliders %%x%d|", TH_SHADE1);
- str += sprintf(str, "Bars %%x%d|", TH_SHADE2);
- str += sprintf(str, "Bars selected %%x%d|", TH_HILITE);
- str += sprintf(str, "Strips %%x%d|", TH_STRIP);
- str += sprintf(str, "Strips selected %%x%d|", TH_STRIP_SELECT);
- str += sprintf(str, "Current Frame %%x%d", TH_CFRAME);
- break;
- case SPACE_ACTION:
- //str += sprintf(str, "Panel %%x%d|", TH_PANEL);
- str += sprintf(str, "%%l|");
- str += sprintf(str, "Grid %%x%d|", TH_GRID);
- str += sprintf(str, "RVK Sliders %%x%d|", TH_FACE);
- str += sprintf(str, "View Sliders %%x%d|", TH_SHADE1);
- str += sprintf(str, "Channels %%x%d|", TH_SHADE2);
- str += sprintf(str, "Channels Selected %%x%d|", TH_HILITE);
- str += sprintf(str, "Long Key %%x%d|", TH_STRIP);
- str += sprintf(str, "Long Key selected %%x%d|", TH_STRIP_SELECT);
- str += sprintf(str, "Current Frame %%x%d", TH_CFRAME);
- break;
- case SPACE_IMAGE:
- str += sprintf(str, "%%l|");
- str += sprintf(str, "Vertex %%x%d|", TH_VERTEX);
- str += sprintf(str, "Vertex Selected %%x%d|", TH_VERTEX_SELECT);
- str += sprintf(str, "Vertex Size %%x%d|", TH_VERTEX_SIZE);
- str += sprintf(str, "Face %%x%d|", TH_FACE);
- str += sprintf(str, "Face Selected %%x%d", TH_FACE_SELECT);
- break;
- case SPACE_SEQ:
- str += sprintf(str, "Grid %%x%d|", TH_GRID);
- str += sprintf(str, "Window Sliders %%x%d|", TH_SHADE1);
- str += sprintf(str, "%%l|");
- str += sprintf(str, "Movie Strip %%x%d|", TH_SEQ_MOVIE);
- str += sprintf(str, "Image Strip %%x%d|", TH_SEQ_IMAGE);
- str += sprintf(str, "Scene Strip %%x%d|", TH_SEQ_SCENE);
- str += sprintf(str, "Audio Strip %%x%d|", TH_SEQ_AUDIO);
- str += sprintf(str, "Effect Strip %%x%d|", TH_SEQ_EFFECT);
- str += sprintf(str, "Plugin Strip %%x%d|", TH_SEQ_PLUGIN);
- str += sprintf(str, "Transition Strip %%x%d|", TH_SEQ_TRANSITION);
- str += sprintf(str, "Meta Strip %%x%d|", TH_SEQ_META);
- str += sprintf(str, "Current Frame %%x%d", TH_CFRAME);
- break;
- case SPACE_SOUND:
- str += sprintf(str, "Grid %%x%d|", TH_GRID);
- str += sprintf(str, "Window Slider %%x%d|", TH_SHADE1);
- str += sprintf(str, "Current Frame %%x%d", TH_CFRAME);
- break;
- case SPACE_BUTS:
- str += sprintf(str, "Panel %%x%d|", TH_PANEL);
- break;
- case SPACE_IMASEL:
- str += sprintf(str, "Tiles %%x%d|", TH_PANEL);
- str += sprintf(str, "Scrollbar %%x%d|", TH_SHADE1);
- str += sprintf(str, "Scroll Handle %%x%d|", TH_SHADE2);
- str += sprintf(str, "Selected File %%x%d|", TH_HILITE);
- str += sprintf(str, "Active File %%x%d|", TH_ACTIVE);
- str += sprintf(str, "Active File Text%%x%d|", TH_GRID);
- break;
- case SPACE_TEXT:
- str += sprintf(str, "Scroll Bar %%x%d|", TH_SHADE1);
- str += sprintf(str, "Selected Text %%x%d|", TH_SHADE2);
- str += sprintf(str, "Cursor %%x%d|", TH_HILITE);
- str += sprintf(str, "%%l|");
- str += sprintf(str, "Syntax Builtin %%x%d|", TH_SYNTAX_B);
- str += sprintf(str, "Syntax Special %%x%d|", TH_SYNTAX_V);
- str += sprintf(str, "Syntax Comment %%x%d|", TH_SYNTAX_C);
- str += sprintf(str, "Syntax Strings %%x%d|", TH_SYNTAX_L);
- str += sprintf(str, "Syntax Numbers %%x%d|", TH_SYNTAX_N);
- break;
- case SPACE_TIME:
- str += sprintf(str, "Grid %%x%d|", TH_GRID);
- str += sprintf(str, "Current Frame %%x%d", TH_CFRAME);
- break;
- case SPACE_NODE:
- str += sprintf(str, "Wires %%x%d|", TH_WIRE);
- str += sprintf(str, "Wires Select %%x%d|", TH_EDGE_SELECT);
- str += sprintf(str, "%%l|");
- str += sprintf(str, "Node Backdrop %%x%d|", TH_NODE);
- str += sprintf(str, "In/Out Node %%x%d|", TH_NODE_IN_OUT);
- str += sprintf(str, "Convertor Node %%x%d|", TH_NODE_CONVERTOR);
- str += sprintf(str, "Operator Node %%x%d|", TH_NODE_OPERATOR);
- str += sprintf(str, "Group Node %%x%d|", TH_NODE_GROUP);
- break;
- }
- }
- return cp;
-}
-
-void BIF_SetTheme(ScrArea *sa)
-{
- if(sa==NULL) { // called for safety, when delete themes
- theme_active= U.themes.first;
- theme_spacetype= SPACE_VIEW3D;
- }
- else {
- // later on, a local theme can be found too
- theme_active= U.themes.first;
- theme_spacetype= sa->spacetype;
-
- }
-}
-
-// for space windows only
-void BIF_ThemeColor(int colorid)
-{
- char *cp;
-
- cp= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
- glColor3ub(cp[0], cp[1], cp[2]);
-
-}
-
-// plus alpha
-void BIF_ThemeColor4(int colorid)
-{
- char *cp;
-
- cp= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
- glColor4ub(cp[0], cp[1], cp[2], cp[3]);
-
-}
-
-// set the color with offset for shades
-void BIF_ThemeColorShade(int colorid, int offset)
-{
- int r, g, b;
- char *cp;
-
- cp= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
- r= offset + (int) cp[0];
- CLAMP(r, 0, 255);
- g= offset + (int) cp[1];
- CLAMP(g, 0, 255);
- b= offset + (int) cp[2];
- CLAMP(b, 0, 255);
- //glColor3ub(r, g, b);
- glColor4ub(r, g, b, cp[3]);
-}
-void BIF_ThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset)
-{
- int r, g, b, a;
- char *cp;
-
- cp= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
- r= coloffset + (int) cp[0];
- CLAMP(r, 0, 255);
- g= coloffset + (int) cp[1];
- CLAMP(g, 0, 255);
- b= coloffset + (int) cp[2];
- CLAMP(b, 0, 255);
- a= alphaoffset + (int) cp[3];
- CLAMP(a, 0, 255);
- glColor4ub(r, g, b, a);
-}
-
-// blend between to theme colors, and set it
-void BIF_ThemeColorBlend(int colorid1, int colorid2, float fac)
-{
- int r, g, b;
- char *cp1, *cp2;
-
- cp1= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
- cp2= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
-
- if(fac<0.0) fac=0.0; else if(fac>1.0) fac= 1.0;
- r= floor((1.0-fac)*cp1[0] + fac*cp2[0]);
- g= floor((1.0-fac)*cp1[1] + fac*cp2[1]);
- b= floor((1.0-fac)*cp1[2] + fac*cp2[2]);
-
- glColor3ub(r, g, b);
-}
-
-// blend between to theme colors, shade it, and set it
-void BIF_ThemeColorBlendShade(int colorid1, int colorid2, float fac, int offset)
-{
- int r, g, b;
- char *cp1, *cp2;
-
- cp1= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
- cp2= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
-
- if(fac<0.0) fac=0.0; else if(fac>1.0) fac= 1.0;
- r= offset+floor((1.0-fac)*cp1[0] + fac*cp2[0]);
- g= offset+floor((1.0-fac)*cp1[1] + fac*cp2[1]);
- b= offset+floor((1.0-fac)*cp1[2] + fac*cp2[2]);
-
- r= r<0?0:(r>255?255:r);
- g= g<0?0:(g>255?255:g);
- b= b<0?0:(b>255?255:b);
-
- glColor3ub(r, g, b);
-}
-
-// get individual values, not scaled
-float BIF_GetThemeValuef(int colorid)
-{
- char *cp;
-
- cp= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
- return ((float)cp[0]);
-
-}
-
-// get individual values, not scaled
-int BIF_GetThemeValue(int colorid)
-{
- char *cp;
-
- cp= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
- return ((int) cp[0]);
-
-}
-
-
-// get the color, range 0.0-1.0
-void BIF_GetThemeColor3fv(int colorid, float *col)
-{
- char *cp;
-
- cp= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
- col[0]= ((float)cp[0])/255.0;
- col[1]= ((float)cp[1])/255.0;
- col[2]= ((float)cp[2])/255.0;
-}
-
-// get the color, in char pointer
-void BIF_GetThemeColor3ubv(int colorid, char *col)
-{
- char *cp;
-
- cp= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
- col[0]= cp[0];
- col[1]= cp[1];
- col[2]= cp[2];
-}
-
-// get the color, in char pointer
-void BIF_GetThemeColor4ubv(int colorid, char *col)
-{
- char *cp;
-
- cp= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
- col[0]= cp[0];
- col[1]= cp[1];
- col[2]= cp[2];
- col[3]= cp[3];
-}
-
-void BIF_GetThemeColorType4ubv(int colorid, int spacetype, char *col)
-{
- char *cp;
-
- cp= BIF_ThemeGetColorPtr(theme_active, spacetype, colorid);
- col[0]= cp[0];
- col[1]= cp[1];
- col[2]= cp[2];
- col[3]= cp[3];
-}
-
-// blends and shades between two char color pointers
-void BIF_ColorPtrBlendShade3ubv(char *cp1, char *cp2, float fac, int offset)
-{
- int r, g, b;
-
- if(fac<0.0) fac=0.0; else if(fac>1.0) fac= 1.0;
- r= offset+floor((1.0-fac)*cp1[0] + fac*cp2[0]);
- g= offset+floor((1.0-fac)*cp1[1] + fac*cp2[1]);
- b= offset+floor((1.0-fac)*cp1[2] + fac*cp2[2]);
-
- r= r<0?0:(r>255?255:r);
- g= g<0?0:(g>255?255:g);
- b= b<0?0:(b>255?255:b);
-
- glColor3ub(r, g, b);
-}
-
-// get a 3 byte color, blended and shaded between two other char color pointers
-void BIF_GetColorPtrBlendShade3ubv(char *cp1, char *cp2, char *col, float fac, int offset)
-{
- int r, g, b;
-
- if(fac<0.0) fac=0.0; else if(fac>1.0) fac= 1.0;
- r= offset+floor((1.0-fac)*cp1[0] + fac*cp2[0]);
- g= offset+floor((1.0-fac)*cp1[1] + fac*cp2[1]);
- b= offset+floor((1.0-fac)*cp1[2] + fac*cp2[2]);
-
- r= r<0?0:(r>255?255:r);
- g= g<0?0:(g>255?255:g);
- b= b<0?0:(b>255?255:b);
-
- col[0] = r;
- col[1] = g;
- col[2] = b;
-}
diff --git a/source/blender/src/retopo.c b/source/blender/src/retopo.c
deleted file mode 100644
index 60be622e3ad..00000000000
--- a/source/blender/src/retopo.c
+++ /dev/null
@@ -1,921 +0,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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2006 by Nicholas Bishop
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
- * Implements the Retopo tools
- *
- * BIF_retopo.h
- *
- */
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_curve_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_view3d_types.h"
-
-#include "BDR_editobject.h"
-
-#include "BIF_editmesh.h"
-#include "BIF_editmode_undo.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-#include "BIF_mywindow.h"
-#include "BIF_retopo.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-
-#include "BKE_curve.h"
-#include "BKE_depsgraph.h"
-#include "BKE_global.h"
-#include "BKE_mesh.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_editVert.h"
-
-#include "BSE_drawview.h"
-#include "BSE_edit.h"
-#include "BSE_view.h"
-
-#include "editmesh.h"
-#include "mydevice.h"
-
-#ifdef WIN32
-#define _USE_MATH_DEFINES
-#endif
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-
-typedef struct RetopoPaintHit {
- struct RetopoPaintHit *next, *prev;
- RetopoPaintPoint *intersection;
- short index;
- float where;
-} RetopoPaintHit;
-
-void retopo_do_2d(View3D *v3d, double proj[2], float *v, char adj);
-void retopo_paint_debug_print(RetopoPaintData *rpd);
-
-/* Painting */
-RetopoPaintData *get_retopo_paint_data()
-{
- if(!retopo_mesh_paint_check()) return NULL;
- if(!G.editMesh) return NULL;
- return G.editMesh->retopo_paint_data;
-}
-
-char retopo_mesh_paint_check()
-{
- return retopo_mesh_check() && G.scene->toolsettings->retopo_mode & RETOPO_PAINT;
-}
-
-void retopo_free_paint_data(RetopoPaintData *rpd)
-{
- if(rpd) {
- RetopoPaintLine *l;
- for(l= rpd->lines.first; l; l= l->next) {
- BLI_freelistN(&l->points);
- BLI_freelistN(&l->hitlist);
- }
- BLI_freelistN(&rpd->lines);
-
- BLI_freelistN(&rpd->intersections);
-
- MEM_freeN(rpd);
- }
-}
-
-void retopo_free_paint()
-{
- retopo_free_paint_data(G.editMesh->retopo_paint_data);
- G.editMesh->retopo_paint_data= NULL;
-}
-
-char line_intersection_2d(const vec2s *a, const vec2s *b, const vec2s *c, const vec2s *d, vec2s *out,
- float *r, float *s)
-{
- float den;
- *r= (a->y - c->y) * (d->x - c->x) - (a->x - c->x) * (d->y - c->y);
- *s= (a->y - c->y) * (b->x - a->x) - (a->x - c->x) * (b->y - a->y);
- den= (b->x - a->x) * (d->y - c->y) - (b->y - a->y) * (d->x - c->x);
-
- if((a->x==b->x && a->y==b->y) || (c->x==d->x && c->y==d->y)) return 0;
-
- if(!den) return 0;
-
- *r/= den;
- *s/= den;
-
- if(*s<0 || *s>=1 || *r<0 || *r>=1) return 0;
-
- out->x= a->x + *r*(b->x - a->x);
- out->y= a->y + *r*(b->y - a->y);
- return 1;
-}
-
-void retopo_paint_add_line_hit(RetopoPaintLine *l, RetopoPaintPoint *p, RetopoPaintPoint *intersection, float w)
-{
- RetopoPaintHit *prev, *hit= MEM_callocN(sizeof(RetopoPaintHit),"RetopoPaintHit");
-
- hit->intersection= intersection;
- hit->index= p->index;
- hit->where= w;
-
- prev= l->hitlist.first;
- if(!prev) {
- BLI_addtail(&l->hitlist,hit);
- }
- else if(prev->index>hit->index) {
- BLI_addhead(&l->hitlist,hit);
- }
- else {
- /* Move forward until we hit the next highest index */
- while(prev->next) {
- if(prev->next->index > hit->index) break;
- prev= prev->next;
- }
- /* Move backward until we hit the next lowest where */
- while(prev->prev && prev->prev->index==prev->index &&
- prev->where > hit->where)
- prev=prev->prev;
- BLI_insertlink(&l->hitlist,prev,hit);
- }
-
- /* Removed duplicate intersections */
- if(hit->prev && hit->prev->intersection==hit->intersection) {
- BLI_freelinkN(&l->hitlist,hit);
- }
-}
-
-char retopo_paint_add_intersection(RetopoPaintData *rpd, RetopoPaintLine *l1, RetopoPaintPoint *p1,
- RetopoPaintLine *l2, RetopoPaintPoint *p2, vec2s *out, float r, float s)
-{
- RetopoPaintPoint *p, *hit;
- char found= 0;
-
- for(p=rpd->intersections.first; p; p= p->next) {
- if(sqrt(pow(p->loc.x-out->x,2)+pow(p->loc.y-out->y,2))<7) {
- found= 1;
- break;
- }
- }
-
- if(!found) {
- hit= MEM_callocN(sizeof(RetopoPaintPoint),"Retopo paint intersection");
- hit->loc.x= out->x;
- hit->loc.y= out->y;
- BLI_addtail(&rpd->intersections,hit);
- } else {
- hit= p;
- }
-
- retopo_paint_add_line_hit(l1,p1,hit,r);
- retopo_paint_add_line_hit(l2,p2,hit,s);
-
- return !found;
-}
-
-
-/* Returns 1 if a new intersection was added */
-char do_line_intersection(RetopoPaintData *rpd, RetopoPaintLine *l1, RetopoPaintPoint *p1,
- RetopoPaintLine *l2, RetopoPaintPoint *p2)
-{
- vec2s out;
- float r,s;
- if(line_intersection_2d(&p1->loc, &p1->next->loc,
- &p2->loc, &p2->next->loc,
- &out,&r,&s)) {
- if(retopo_paint_add_intersection(rpd,l1,p1,l2,p2,&out,r,s))
- return 1;
- }
- return 0;
-}
-
-typedef struct FaceNode {
- struct FaceNode *next, *prev;
- MFace f;
-} FaceNode;
-
-char faces_equal(EditFace *f1, EditFace *f2)
-{
- return editface_containsVert(f2,f1->v1) &&
- editface_containsVert(f2,f1->v2) &&
- editface_containsVert(f2,f1->v3) &&
- (f1->v4 ? editface_containsVert(f2,f1->v4) : 1);
-}
-
-EditFace *addfaceif(EditMesh *em, EditVert *v1, EditVert *v2, EditVert *v3, EditVert *v4)
-{
- EditFace *efa;
-
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(editface_containsVert(efa,v1) &&
- editface_containsVert(efa,v2) &&
- editface_containsVert(efa,v3) &&
- (v4 ? editface_containsVert(efa,v4) : 1))
- return NULL;
- }
-
- return addfacelist(v1,v2,v3,v4,NULL,NULL);
-}
-
-void retopo_paint_apply()
-{
- RetopoPaintData *rpd= G.editMesh->retopo_paint_data;
- EditVert *eve;
-
- if(rpd) {
- RetopoPaintLine *l1, *l2;
- RetopoPaintPoint *p1, *p2;
- unsigned hitcount= 0;
- unsigned i;
- RetopoPaintHit *h;
- float hitco[3];
-
- /* Find intersections */
- BLI_freelistN(&rpd->intersections);
- for(l1= rpd->lines.first; l1; l1= l1->next) {
- for(l2= rpd->lines.first; l2; l2= l2->next) {
- if(l1!=l2) {
- for(p1= l1->points.first; p1 && p1!=l1->points.last; p1= p1->next) {
- for(p2= l2->points.first; p2 && p2!=l2->points.last; p2= p2->next) {
- if(p1!=p2) {
- if(do_line_intersection(rpd,l1,p1,l2,p2))
- ++hitcount;
- }
- }
- }
- }
- }
- }
-
- /*topoPaintHit *hit;
- l1= rpd->lines.first;
- for(hit= l1->hitlist.first; hit; hit= hit->next) {
- printf("\nhit(%p,%d) ",hit->intersection,hit->index);
- }
- fflush(stdout);*/
-
- /* Deselect */
- for(eve= G.editMesh->verts.first; eve; eve= eve->next)
- eve->f &= ~SELECT;
- EM_deselect_flush();
-
- for(i=0; i<hitcount; ++i) {
- RetopoPaintPoint *intersection= BLI_findlink(&rpd->intersections,i);
- double proj[2] = {intersection->loc.x, intersection->loc.y};
- retopo_do_2d(rpd->paint_v3d, proj, hitco, 1);
- intersection->eve= addvertlist(hitco, NULL);
- intersection->eve->f= SELECT;
- }
-
- for(l1= rpd->lines.first; l1; l1= l1->next) {
- unsigned etcount= BLI_countlist(&l1->hitlist);
- if(etcount>=2) {
- for(h= l1->hitlist.first; (h && h->next); h= h->next)
- addedgelist(h->intersection->eve,h->next->intersection->eve,NULL);
- if(etcount>=3 && l1->cyclic)
- addedgelist(((RetopoPaintHit*)l1->hitlist.first)->intersection->eve,
- ((RetopoPaintHit*)l1->hitlist.last)->intersection->eve, NULL);
- }
- }
-
- addfaces_from_edgenet();
- }
-
- retopo_free_paint();
-}
-
-void add_rppoint(RetopoPaintLine *l, short x, short y)
-{
- RetopoPaintPoint *p= MEM_callocN(sizeof(RetopoPaintPoint),"RetopoPaintPoint");
- double proj[2];
- p->loc.x= x;
- p->loc.y= y;
- BLI_addtail(&l->points,p);
- p->index= p->prev?p->prev->index+1:0;
-
- proj[0] = p->loc.x;
- proj[1] = p->loc.y;
-
- retopo_do_2d(G.editMesh->retopo_paint_data->paint_v3d, proj, p->co, 1);
-}
-RetopoPaintLine *add_rpline(RetopoPaintData *rpd)
-{
- RetopoPaintLine *l= MEM_callocN(sizeof(RetopoPaintLine),"RetopoPaintLine");
- BLI_addtail(&rpd->lines,l);
- return l;
-}
-
-void retopo_paint_toggle_cyclic(RetopoPaintLine *l)
-{
- if(l==NULL)
- return;
- if(!l->cyclic) {
- RetopoPaintPoint *pf= l->points.first;
-
- if(pf) {
- add_rppoint(l, pf->loc.x, pf->loc.y);
- l->cyclic= l->points.last;
- }
- } else {
- BLI_freelinkN(&l->points,l->cyclic);
- l->cyclic= NULL;
- }
-}
-
-void retopo_paint_add_line(RetopoPaintData *rpd, short mouse[2])
-{
- RetopoPaintLine *l= add_rpline(rpd);
- float range[2]= {mouse[0]-rpd->sloc[0],mouse[1]-rpd->sloc[1]};
- int i;
-
- /* Add initial point */
- add_rppoint(l,rpd->sloc[0],rpd->sloc[1]);
- for(i=0; i<G.scene->toolsettings->line_div; ++i) {
- const float mul= (i+1.0f) / G.scene->toolsettings->line_div;
- add_rppoint(l,rpd->sloc[0] + range[0]*mul,rpd->sloc[1] + range[1]*mul);
- }
-
- allqueue(REDRAWVIEW3D,0);
-}
-
-void retopo_paint_add_ellipse(RetopoPaintData *rpd, short mouse[2])
-{
- int i;
-
- add_rpline(rpd);
- for (i=0; i<G.scene->toolsettings->ellipse_div; i++) {
- float t= (float) i / G.scene->toolsettings->ellipse_div;
- float cur= t*(M_PI*2);
-
- float w= abs(mouse[0]-rpd->sloc[0]);
- float h= abs(mouse[1]-rpd->sloc[1]);
-
- add_rppoint(rpd->lines.last,cos(cur)*w+rpd->sloc[0],sin(cur)*h+rpd->sloc[1]);
- }
-
- retopo_paint_toggle_cyclic(rpd->lines.last);
-
- allqueue(REDRAWVIEW3D,0);
-}
-
-void retopo_end_okee()
-{
- if(okee("Apply retopo paint?"))
- retopo_paint_apply();
- else
- retopo_free_paint();
- G.scene->toolsettings->retopo_mode &= ~RETOPO_PAINT;
-}
-
-void retopo_paint_toggle(void *a, void *b)
-{
- /* Note that these operations are reversed because mode bit has already been set! */
- if(retopo_mesh_paint_check()) { /* Activate retopo paint */
- RetopoPaintData *rpd= MEM_callocN(sizeof(RetopoPaintData),"RetopoPaintData");
-
- G.editMesh->retopo_paint_data= rpd;
- G.scene->toolsettings->retopo_paint_tool= RETOPO_PEN;
- rpd->seldist= 15;
- rpd->nearest.line= NULL;
- G.scene->toolsettings->line_div= 25;
- G.scene->toolsettings->ellipse_div= 25;
- G.scene->toolsettings->retopo_hotspot= 1;
- } else retopo_end_okee();
-
- BIF_undo_push("Retopo toggle");
-
- allqueue(REDRAWVIEW3D, 1);
-}
-
-void retopo_paint_view_update(struct View3D *v3d)
-{
- RetopoPaintData *rpd= get_retopo_paint_data();
-
- if(rpd && rpd->paint_v3d==v3d) {
- RetopoPaintLine *l;
- RetopoPaintPoint *p;
- double ux, uy, uz;
-
- for(l= rpd->lines.first; l; l= l->next) {
- for(p= l->points.first; p; p= p->next) {
- gluProject(p->co[0],p->co[1],p->co[2], v3d->retopo_view_data->mats.modelview,
- v3d->retopo_view_data->mats.projection,
- (GLint *)v3d->retopo_view_data->mats.viewport, &ux, &uy, &uz);
- p->loc.x= ux;
- p->loc.y= uy;
- }
- }
- }
-}
-
-void retopo_force_update()
-{
- RetopoPaintData *rpd= get_retopo_paint_data();
-
- if(rpd) {
- View3D *vd= rpd->paint_v3d;
-
- if(vd) {
- if(vd->depths) vd->depths->damaged= 1;
- retopo_queue_updates(vd);
- if(retopo_mesh_paint_check() && vd->retopo_view_data)
- allqueue(REDRAWVIEW3D, 0);
- }
- }
-}
-
-/* Returns 1 if event should be processed by caller, 0 otherwise */
-char retopo_paint(const unsigned short event)
-{
- RetopoPaintData *rpd= get_retopo_paint_data();
-
- if(!event) return 1;
- if(rpd) {
- RetopoPaintLine *l;
- short mouse[2];
- char lbut= get_mbut() & (U.flag & USER_LMOUSESELECT ? R_MOUSE : L_MOUSE);
-
- if(rpd->paint_v3d && rpd->paint_v3d!=G.vd) return 1;
-
- getmouseco_areawin(mouse);
-
- if(rpd->in_drag && !lbut) { /* End drag */
- rpd->in_drag= 0;
-
- switch(G.scene->toolsettings->retopo_paint_tool) {
- case RETOPO_PEN:
- break;
- case RETOPO_LINE:
- retopo_paint_add_line(rpd, mouse);
- break;
- case RETOPO_ELLIPSE:
- retopo_paint_add_ellipse(rpd, mouse);
- break;
- }
- BIF_undo_push("Retopo paint");
- }
-
- switch(event) {
- case MOUSEX:
- case MOUSEY:
- switch(G.scene->toolsettings->retopo_paint_tool) {
- case RETOPO_PEN:
- if(rpd->in_drag && rpd->lines.last) {
- l= rpd->lines.last;
-
- if(((RetopoPaintPoint*)l->points.last)->loc.x != mouse[0] ||
- ((RetopoPaintPoint*)l->points.last)->loc.y != mouse[1]) {
- add_rppoint(l,mouse[0],mouse[1]);
- }
- rpd->nearest.line= NULL;
-
- break;
- } else if(G.scene->toolsettings->retopo_hotspot) { /* Find nearest endpoint */
- float sdist;
- RetopoPaintLine *l= rpd->lines.first;
- RetopoPaintSel n= {NULL,NULL,l,1};
- sdist= rpd->seldist + 10;
- for(l= rpd->lines.first; l; l= l->next) {
- float tdist;
- RetopoPaintPoint *p1= l->points.first, *p2= l->points.last;
-
- tdist= sqrt(pow(mouse[0] - p1->loc.x,2)+pow(mouse[1] - p1->loc.y,2));
- if(tdist < sdist && tdist < rpd->seldist) {
- sdist= tdist;
- n.line= l;
- n.first= 1;
- } else {
- tdist= sqrt(pow(mouse[0] - p2->loc.x,2)+pow(mouse[1] - p2->loc.y,2));
- if(tdist < sdist && tdist < rpd->seldist) {
- sdist= tdist;
- n.line= l;
- n.first= 0;
- }
- }
- }
-
- if(sdist < rpd->seldist)
- rpd->nearest= n;
- else rpd->nearest.line= NULL;
- }
- break;
- case RETOPO_LINE:
- break;
- case RETOPO_ELLIPSE:
- break;
- }
- allqueue(REDRAWVIEW3D,0);
- break;
- case RETKEY:
- case PADENTER:
- retopo_paint_apply();
- case ESCKEY:
- G.scene->toolsettings->retopo_mode&= ~RETOPO_PAINT;
- retopo_free_paint();
-
- BIF_undo_push("Retopo toggle");
-
- allqueue(REDRAWVIEW3D, 1);
- allqueue(REDRAWBUTSEDIT, 0);
- break;
- case CKEY:
- retopo_paint_toggle_cyclic(rpd->lines.last);
- BIF_undo_push("Retopo toggle cyclic");
- allqueue(REDRAWVIEW3D, 0);
- break;
- case EKEY:
- G.scene->toolsettings->retopo_paint_tool= RETOPO_ELLIPSE;
- allqueue(REDRAWVIEW3D, 1);
- break;
- case HKEY:
- G.scene->toolsettings->retopo_hotspot= !G.scene->toolsettings->retopo_hotspot;
- allqueue(REDRAWVIEW3D, 1);
- break;
- case LKEY:
- G.scene->toolsettings->retopo_paint_tool= RETOPO_LINE;
- allqueue(REDRAWVIEW3D, 1);
- break;
- case PKEY:
- G.scene->toolsettings->retopo_paint_tool= RETOPO_PEN;
- allqueue(REDRAWVIEW3D, 1);
- break;
- case XKEY:
- case DELKEY:
- l= rpd->lines.last;
- if(l) {
- BLI_freelistN(&l->points);
- BLI_freelistN(&l->hitlist);
- BLI_freelinkN(&rpd->lines, l);
- if(rpd->nearest.line == l)
- rpd->nearest.line= NULL;
- BIF_undo_push("Erase line");
- allqueue(REDRAWVIEW3D, 0);
- }
- break;
- case LEFTMOUSE:
- if(!rpd->in_drag) { /* Start new drag */
- rpd->in_drag= 1;
-
- if(!rpd->paint_v3d)
- rpd->paint_v3d= G.vd;
-
- /* Location of mouse down */
- rpd->sloc[0]= mouse[0];
- rpd->sloc[1]= mouse[1];
-
- switch(G.scene->toolsettings->retopo_paint_tool) {
- case RETOPO_PEN:
- if(rpd->nearest.line) {
- RetopoPaintPoint *p, *pt;
- int i;
-
- BLI_remlink(&rpd->lines,rpd->nearest.line);
- BLI_addtail(&rpd->lines,rpd->nearest.line);
-
- /* Check if we need to reverse the line */
- if(rpd->nearest.first) {
- for(p= rpd->nearest.line->points.first; p; p= p->prev) {
- pt= p->prev;
- p->prev= p->next;
- p->next= pt;
- }
- pt= rpd->nearest.line->points.first;
- rpd->nearest.line->points.first= rpd->nearest.line->points.last;
- rpd->nearest.line->points.last= pt;
-
- /* Reverse indices */
- i= 0;
- for(p= rpd->nearest.line->points.first; p; p= p->next)
- p->index= i++;
- }
- } else {
- add_rpline(rpd);
- add_rppoint(rpd->lines.last,mouse[0],mouse[1]);
- }
- break;
- case RETOPO_LINE:
- break;
- case RETOPO_ELLIPSE:
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
- }
- break;
- case MIDDLEMOUSE:
- case WHEELUPMOUSE:
- case WHEELDOWNMOUSE:
- case PAD0: case PAD1: case PAD2: case PAD3: case PAD4:
- case PAD5: case PAD6: case PAD7: case PAD8: case PAD9:
- case PADMINUS: case PADPLUSKEY:
- return 1;
- }
- return 0;
- } else return 1;
-}
-void retopo_draw_paint_lines()
-{
- RetopoPaintData *rpd= get_retopo_paint_data();
-
- if(rpd && rpd->paint_v3d==G.vd) {
- RetopoPaintLine *l;
- RetopoPaintPoint *p;
-
- glColor3f(0,0,0);
- glLineWidth(2);
-
- /* Draw existing lines */
- for(l= rpd->lines.first; l; l= l->next) {
- if(l==rpd->lines.last)
- glColor3f(0.3,0,0);
- glBegin(l->cyclic?GL_LINE_LOOP:GL_LINE_STRIP);
- for(p= l->points.first; p; p= p->next) {
- glVertex2s(p->loc.x,p->loc.y);
- }
- glEnd();
- }
-
- /* Draw ellipse */
- if(G.scene->toolsettings->retopo_paint_tool==RETOPO_ELLIPSE && rpd->in_drag) {
- short mouse[2];
- getmouseco_areawin(mouse);
-
- setlinestyle(3);
- fdrawXORellipse(rpd->sloc[0],rpd->sloc[1],abs(mouse[0]-rpd->sloc[0]),abs(mouse[1]-rpd->sloc[1]));
- setlinestyle(0);
- }
- else if(G.scene->toolsettings->retopo_paint_tool==RETOPO_LINE && rpd->in_drag) {
- short mouse[2];
- getmouseco_areawin(mouse);
-
- setlinestyle(3);
- sdrawXORline(rpd->sloc[0],rpd->sloc[1],mouse[0],mouse[1]);
- setlinestyle(0);
- }
- else if(rpd->nearest.line) { /* Draw selection */
- RetopoPaintPoint *p= rpd->nearest.first ? rpd->nearest.line->points.first :
- rpd->nearest.line->points.last;
- if(p)
- fdrawXORcirc(p->loc.x, p->loc.y, rpd->seldist);
- }
-
- glLineWidth(1);
- }
-}
-
-RetopoPaintData *retopo_paint_data_copy(RetopoPaintData *rpd)
-{
- RetopoPaintData *copy;
- RetopoPaintLine *l, *lcp;
- RetopoPaintPoint *p, *pcp;
-
- if(!rpd) return NULL;
-
- copy= MEM_mallocN(sizeof(RetopoPaintData),"RetopoPaintDataCopy");
-
- memcpy(copy,rpd,sizeof(RetopoPaintData));
- copy->lines.first= copy->lines.last= NULL;
- for(l= rpd->lines.first; l; l= l->next) {
- lcp= MEM_mallocN(sizeof(RetopoPaintLine),"RetopoPaintLineCopy");
- memcpy(lcp,l,sizeof(RetopoPaintLine));
- BLI_addtail(&copy->lines,lcp);
-
- lcp->hitlist.first= lcp->hitlist.last= NULL;
- lcp->points.first= lcp->points.last= NULL;
- for(p= l->points.first; p; p= p->next) {
- pcp= MEM_mallocN(sizeof(RetopoPaintPoint),"RetopoPaintPointCopy");
- memcpy(pcp,p,sizeof(RetopoPaintPoint));
- BLI_addtail(&lcp->points,pcp);
- }
- }
-
- copy->intersections.first= copy->intersections.last= NULL;
-
- return copy;
-}
-
-char retopo_mesh_check()
-{
- return G.obedit && G.obedit->type==OB_MESH && (G.scene->toolsettings->retopo_mode & RETOPO);
-}
-char retopo_curve_check()
-{
- return G.obedit && (G.obedit->type==OB_CURVE ||
- G.obedit->type==OB_SURF) && (((Curve*)G.obedit->data)->flag & CU_RETOPO);
-}
-
-void retopo_toggle(void *j1,void *j2)
-{
- if(retopo_mesh_check() || retopo_curve_check()) {
- if(G.vd->depths) G.vd->depths->damaged= 1;
- retopo_queue_updates(G.vd);
- } else {
- if(G.editMesh && G.scene->toolsettings->retopo_mode & RETOPO_PAINT)
- retopo_end_okee();
- }
-
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWVIEW3D, 0);
-}
-
-void retopo_do_2d(View3D *v3d, double proj[2], float *v, char adj)
-{
- /* Check to make sure vert is visible in window */
- if(proj[0]>0 && proj[1]>0 && proj[0] < v3d->depths->w && proj[1] < v3d->depths->h) {
- float depth= v3d->depths->depths[((int)proj[1])*v3d->depths->w+((int)proj[0])];
- double px, py, pz;
-
- /* Don't modify the point if it'll be mapped to the background */
- if(depth==v3d->depths->depth_range[1]) {
- if(adj) {
- /* Find the depth of (0,0,0); */
- gluProject(0,0,0,v3d->retopo_view_data->mats.modelview,
- v3d->retopo_view_data->mats.projection,
- (GLint *)v3d->retopo_view_data->mats.viewport,&px,&py,&pz);
- depth= pz;
- }
- else return;
- }
-
- /* Find 3D location with new depth (unproject) */
- gluUnProject(proj[0],proj[1],depth,v3d->retopo_view_data->mats.modelview,
- v3d->retopo_view_data->mats.projection,
- (GLint *)v3d->retopo_view_data->mats.viewport,&px,&py,&pz);
-
- v[0]= px;
- v[1]= py;
- v[2]= pz;
- }
-}
-
-void retopo_do_vert(View3D *v3d, float *v)
-{
- double proj[3];
-
- /* Find 2D location (project) */
- gluProject(v[0],v[1],v[2],v3d->retopo_view_data->mats.modelview,v3d->retopo_view_data->mats.projection,
- (GLint *)v3d->retopo_view_data->mats.viewport,&proj[0],&proj[1],&proj[2]);
-
- retopo_do_2d(v3d,proj,v,0);
-}
-
-void retopo_do_all()
-{
- RetopoViewData *rvd= G.vd->retopo_view_data;
- if(retopo_mesh_check()) {
- if(rvd) {
- EditMesh *em= G.editMesh;
- EditVert *eve;
-
- /* Apply retopo to all selected vertices */
- eve= em->verts.first;
- while(eve) {
- if(eve->f & SELECT)
- retopo_do_vert(G.vd,eve->co);
- eve= eve->next;
- }
-
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- }
- }
- else if(retopo_curve_check()) {
- if(rvd) {
- extern ListBase editNurb;
- Nurb *nu;
- BPoint *bp;
- int i, j;
-
- for(nu= editNurb.first; nu; nu= nu->next)
- {
- if(nu->type & CU_2D) {
- /* Can't wrap a 2D curve onto a 3D surface */
- }
- else if(nu->type & CU_BEZIER) {
- for(i=0; i<nu->pntsu; ++i) {
- if(nu->bezt[i].f1 & 1)
- retopo_do_vert(G.vd, nu->bezt[i].vec[0]);
- if(nu->bezt[i].f2 & 1)
- retopo_do_vert(G.vd, nu->bezt[i].vec[1]);
- if(nu->bezt[i].f3 & 1)
- retopo_do_vert(G.vd, nu->bezt[i].vec[2]);
- }
- }
- else {
- bp= nu->bp;
- for(i=0; i<nu->pntsv; ++i) {
- for(j=0; j<nu->pntsu; ++j, ++bp) {
- if(bp->f1 & SELECT)
- retopo_do_vert(G.vd,bp->vec);
- }
- }
- }
-
- testhandlesNurb(nu);
- }
-
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- }
- }
-}
-
-void retopo_do_all_cb(void *j1, void *j2)
-{
- /* This is called from editbuttons, so user needs to specify view */
- if(!select_area(SPACE_VIEW3D)) return;
-
- if(G.vd->drawtype == OB_WIRE) {
- error("Cannot apply retopo in wireframe mode");
- return;
- }
-
- retopo_do_all();
- BIF_undo_push("Retopo all");
-}
-
-void retopo_queue_updates(View3D *v3d)
-{
- if(retopo_mesh_check() || retopo_curve_check()) {
- if(!v3d->retopo_view_data)
- v3d->retopo_view_data= MEM_callocN(sizeof(RetopoViewData),"RetopoViewData");
-
- v3d->retopo_view_data->queue_matrix_update= 1;
-
- allqueue(REDRAWVIEW3D, 0);
- }
-}
-
-void retopo_matrix_update(View3D *v3d)
-{
- RetopoPaintData *rpd= get_retopo_paint_data();
- if((retopo_mesh_check() || retopo_curve_check()) && (!rpd || rpd->paint_v3d==v3d)) {
- RetopoViewData *rvd= v3d->retopo_view_data;
- if(!rvd) {
- rvd= MEM_callocN(sizeof(RetopoViewData),"RetopoViewData");
- v3d->retopo_view_data= rvd;
- rvd->queue_matrix_update= 1;
- }
- if(rvd && rvd->queue_matrix_update) {
- bgl_get_mats(&rvd->mats);
-
- rvd->queue_matrix_update= 0;
- }
- }
-}
-
-void retopo_free_view_data(View3D *v3d)
-{
- if(v3d->retopo_view_data) {
- MEM_freeN(v3d->retopo_view_data);
- v3d->retopo_view_data= NULL;
- }
-}
-
-void retopo_paint_debug_print(RetopoPaintData *rpd)
-{
- RetopoPaintLine *l;
- RetopoPaintPoint *p;
-
- for(l= rpd->lines.first; l; l= l->next) {
- printf("Line:\n");
- for(p= l->points.first; p; p= p->next) {
- printf(" Point(%d: %d,%d)\n",p->index,p->loc.x,p->loc.y);
- }
- }
-
- fflush(stdout);
-}
diff --git a/source/blender/src/screendump.c b/source/blender/src/screendump.c
deleted file mode 100644
index 4c1cda52da3..00000000000
--- a/source/blender/src/screendump.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * Making screendumps.
- */
-
-#include <string.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-
-#include "IMB_imbuf_types.h"
-#include "IMB_imbuf.h"
-
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-
-#include "BKE_utildefines.h"
-#include "BKE_global.h"
-#include "BKE_image.h"
-#include "BKE_material.h"
-#include "BKE_sca.h"
-
-#include "BIF_gl.h"
-#include "BIF_toolbox.h"
-#include "BIF_mywindow.h"
-#include "BIF_screen.h"
-#include "BIF_toets.h"
-#include "BIF_interface.h"
-#include "BIF_writeimage.h"
-
-#include "BSE_filesel.h"
-
-#include "mydevice.h"
-
-static unsigned int *dumprect=0;
-static int dumpsx, dumpsy;
-
-void write_screendump(char *name)
-{
- ImBuf *ibuf;
-
- if(dumprect) {
-
- strcpy(G.ima, name);
- BLI_convertstringcode(name, G.sce, G.scene->r.cfra);
-
- /* BKE_add_image_extension() checks for if extension was already set */
- if(G.scene->r.scemode & R_EXTENSION)
- if(strlen(name)<FILE_MAXDIR+FILE_MAXFILE-5)
- BKE_add_image_extension(name, G.scene->r.imtype);
-
- if(saveover(name)) {
- waitcursor(1);
-
- ibuf= IMB_allocImBuf(dumpsx, dumpsy, 24, 0, 0);
- ibuf->rect= dumprect;
-
- if(G.scene->r.planes == 8) IMB_cspace(ibuf, rgb_to_bw);
-
- BKE_write_ibuf(ibuf, name, G.scene->r.imtype, G.scene->r.subimtype, G.scene->r.quality);
-
- IMB_freeImBuf(ibuf);
-
- waitcursor(0);
- }
- MEM_freeN(dumprect);
- dumprect= NULL;
- }
-}
-
-/* get dump from frontbuffer */
-void BIF_screendump(int fscreen)
-{
- extern int uiIsMenu(int *x, int *y, int *sizex, int *sizey);
- int ismenu;
- static int wasmenu= 0;
- int x=0, y=0;
- char imstr[64];
-
- /* this sets dumpsx/y to zero if ismenu==0 */
- ismenu= uiIsMenu(&x, &y, &dumpsx, &dumpsy);
-
- if(wasmenu && !ismenu) {
- save_image_filesel_str(imstr);
- strcat(imstr, " (Menu)");
- activate_fileselect(FILE_SPECIAL, imstr, G.ima, write_screendump);
- wasmenu= 0;
- return;
- }
-
- if(dumprect) MEM_freeN(dumprect);
- dumprect= NULL;
-
- if((G.qual & LR_SHIFTKEY) || fscreen) { /* full screen */
- x= 0;
- y= 0;
-
- dumpsx= G.curscreen->sizex;
- dumpsy= G.curscreen->sizey;
-
- }
- else {
- if(ismenu==0) { /* a window */
- //int win= mywinget();
-
- //bwin_getsuborigin(win, &x, &y);
- //bwin_getsize(win, &dumpsx, &dumpsy);
- x= curarea->totrct.xmin;
- y= curarea->totrct.ymin;
- dumpsx= curarea->totrct.xmax-x;
- dumpsy= curarea->totrct.ymax-y;
- }
- }
-
- if (dumpsx && dumpsy) {
-
- dumprect= MEM_mallocN(sizeof(int)*dumpsx*dumpsy, "dumprect");
- glReadBuffer(GL_FRONT);
- glReadPixels(x, y, dumpsx, dumpsy, GL_RGBA, GL_UNSIGNED_BYTE, dumprect);
- glFinish();
- glReadBuffer(GL_BACK);
-
- if(ismenu==0) {
- wasmenu= 0;
- save_image_filesel_str(imstr);
- activate_fileselect(FILE_SPECIAL, imstr, G.ima, write_screendump);
- }
- else wasmenu= 1;
- }
-
-}
diff --git a/source/blender/src/sculptmode-stroke.c b/source/blender/src/sculptmode-stroke.c
deleted file mode 100644
index 2f8dac2818c..00000000000
--- a/source/blender/src/sculptmode-stroke.c
+++ /dev/null
@@ -1,279 +0,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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2007 by Nicholas Bishop
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
- * Storage and manipulation of sculptmode brush strokes.
- *
- */
-
-#include "MEM_guardedalloc.h"
-#include "DNA_listBase.h"
-#include "DNA_scene_types.h"
-#include "BLI_blenlib.h"
-#include "BIF_gl.h"
-#include "BDR_sculptmode.h"
-#include <math.h>
-
-/* Temporary storage of input stroke control points */
-typedef struct StrokePoint {
- struct StrokePoint *next, *prev;
- short x, y;
-} StrokePoint;
-typedef struct SculptStroke {
- short (*loc)[2];
- int max;
- int index;
- float length;
- ListBase final;
- StrokePoint *final_mem;
- float offset;
-} SculptStroke;
-
-void sculpt_stroke_new(const int max)
-{
- SculptSession *ss = sculpt_session();
-
- ss->stroke = MEM_callocN(sizeof(SculptStroke), "SculptStroke");
- ss->stroke->loc = MEM_callocN(sizeof(short) * 2 * max, "SculptStroke.loc");
- ss->stroke->max = max;
- ss->stroke->index = -1;
-}
-
-void sculpt_stroke_free()
-{
- SculptSession *ss = sculpt_session();
- if(ss && ss->stroke) {
- if(ss->stroke->loc) MEM_freeN(ss->stroke->loc);
- if(ss->stroke->final_mem) MEM_freeN(ss->stroke->final_mem);
-
- MEM_freeN(ss->stroke);
- ss->stroke = NULL;
- }
-}
-
-void sculpt_stroke_add_point(const short x, const short y)
-{
- SculptStroke *stroke = sculpt_session()->stroke;
- const int next = stroke->index + 1;
-
- if(stroke->index == -1) {
- stroke->loc[0][0] = x;
- stroke->loc[0][1] = y;
- stroke->index = 0;
- }
- else if(next < stroke->max) {
- const int dx = x - stroke->loc[stroke->index][0];
- const int dy = y - stroke->loc[stroke->index][1];
- stroke->loc[next][0] = x;
- stroke->loc[next][1] = y;
- stroke->length += sqrt(dx*dx + dy*dy);
- stroke->index = next;
- }
-}
-
-void sculpt_stroke_smooth(SculptStroke *stroke)
-{
- /* Apply smoothing (exclude the first and last points)*/
- StrokePoint *p = stroke->final.first;
- if(p && p->next && p->next->next) {
- for(p = p->next->next; p && p->next && p->next->next; p = p->next) {
- p->x = p->prev->prev->x*0.1 + p->prev->x*0.2 + p->x*0.4 + p->next->x*0.2 + p->next->next->x*0.1;
- p->y = p->prev->prev->y*0.1 + p->prev->y*0.2 + p->y*0.4 + p->next->y*0.2 + p->next->next->y*0.1;
- }
- }
-}
-
-static void sculpt_stroke_create_final()
-{
- SculptStroke *stroke = sculpt_session()->stroke;
-
- if(stroke) {
- StrokePoint *p, *pnext;
- int i;
-
- /* Copy loc into final */
- if(stroke->final_mem)
- MEM_freeN(stroke->final_mem);
- stroke->final_mem = MEM_callocN(sizeof(StrokePoint) * (stroke->index + 1) * 2, "SculptStroke.final");
- stroke->final.first = stroke->final.last = NULL;
- for(i = 0; i <= stroke->index; ++i) {
- p = &stroke->final_mem[i];
- p->x = stroke->loc[i][0];
- p->y = stroke->loc[i][1];
- BLI_addtail(&stroke->final, p);
- }
-
- /* Remove shortest edges */
- if(stroke->final.first) {
- for(p = ((StrokePoint*)stroke->final.first)->next; p && p->next; p = pnext) {
- const int dx = p->x - p->prev->x;
- const int dy = p->y - p->prev->y;
- const float len = sqrt(dx*dx + dy*dy);
- pnext = p->next;
- if(len < 10) {
- BLI_remlink(&stroke->final, p);
- }
- }
- }
-
- sculpt_stroke_smooth(stroke);
-
- /* Subdivide edges */
- for(p = stroke->final.first; p && p->next; p = pnext) {
- StrokePoint *np = &stroke->final_mem[i++];
-
- pnext = p->next;
- np->x = (p->x + p->next->x) / 2;
- np->y = (p->y + p->next->y) / 2;
- BLI_insertlink(&stroke->final, p, np);
- }
-
- sculpt_stroke_smooth(stroke);
- }
-}
-
-float sculpt_stroke_seglen(StrokePoint *p1, StrokePoint *p2)
-{
- int dx = p2->x - p1->x;
- int dy = p2->y - p1->y;
- return sqrt(dx*dx + dy*dy);
-}
-
-float sculpt_stroke_final_length(SculptStroke *stroke)
-{
- StrokePoint *p;
- float len = 0;
- for(p = stroke->final.first; p && p->next; ++p)
- len += sculpt_stroke_seglen(p, p->next);
- return len;
-}
-
-/* If partial is nonzero, cuts off apply after that length has been processed */
-static StrokePoint *sculpt_stroke_apply_generic(SculptStroke *stroke, struct EditData *e, const int partial)
-{
- const int sdspace = sculpt_data()->spacing;
- const short spacing = sdspace > 0 ? sdspace : 2;
- const int dots = sculpt_stroke_final_length(stroke) / spacing;
- int i;
- StrokePoint *p = stroke->final.first;
- float startloc = stroke->offset;
-
- for(i = 0; i < dots && p && p->next; ++i) {
- const float dotloc = spacing * i;
- short co[2];
- float len = sculpt_stroke_seglen(p, p->next);
- float u, v;
-
- /* Find edge containing dot */
- while(dotloc > startloc + len && p && p->next && p->next->next) {
- p = p->next;
- startloc += len;
- len = sculpt_stroke_seglen(p, p->next);
- }
-
- if(!p || !p->next || dotloc > startloc + len)
- break;
-
- if(partial && startloc > partial) {
- /* Calculate offset for next stroke segment */
- stroke->offset = startloc + len - dotloc;
- break;
- }
-
- u = (dotloc - startloc) / len;
- v = 1 - u;
-
- co[0] = p->x*v + p->next->x*u;
- co[1] = p->y*v + p->next->y*u;
-
- do_symmetrical_brush_actions(e, co, NULL);
- }
-
- return p ? p->next : NULL;
-}
-
-void sculpt_stroke_apply(struct EditData *e)
-{
- SculptStroke *stroke = sculpt_session()->stroke;
- /* TODO: make these values user-modifiable? */
- const int partial_len = 100;
- const int min_len = 200;
-
- if(stroke) {
- sculpt_stroke_create_final();
-
- if(sculpt_stroke_final_length(stroke) > min_len) {
- StrokePoint *p = sculpt_stroke_apply_generic(stroke, e, partial_len);
-
- /* Replace remaining values in stroke->loc with remaining stroke->final values */
- stroke->index = -1;
- stroke->length = 0;
- for(; p; p = p->next) {
- ++stroke->index;
- stroke->loc[stroke->index][0] = p->x;
- stroke->loc[stroke->index][1] = p->y;
- if(p->next) {
- stroke->length += sculpt_stroke_seglen(p, p->next);
- }
- }
- }
- }
-}
-
-void sculpt_stroke_apply_all(struct EditData *e)
-{
- SculptStroke *stroke = sculpt_session()->stroke;
-
- sculpt_stroke_create_final();
-
- if(stroke) {
- sculpt_stroke_apply_generic(stroke, e, 0);
- }
-}
-
-void sculpt_stroke_draw()
-{
- SculptStroke *stroke = sculpt_session()->stroke;
-
- if(stroke) {
- StrokePoint *p;
-
- /* Draws the original stroke */
- /*glColor3f(1, 0, 0);
- glBegin(GL_LINE_STRIP);
- for(i = 0; i <= stroke->index; ++i)
- glVertex2s(stroke->loc[i][0], stroke->loc[i][1]);
- glEnd();*/
-
- /* Draws the smoothed stroke */
- glColor3f(0, 1, 0);
- glBegin(GL_LINE_STRIP);
- for(p = stroke->final.first; p; p = p->next)
- glVertex2s(p->x, p->y);
- glEnd();
- }
-}
diff --git a/source/blender/src/sculptmode.c b/source/blender/src/sculptmode.c
deleted file mode 100644
index 010bf6f746c..00000000000
--- a/source/blender/src/sculptmode.c
+++ /dev/null
@@ -1,2267 +0,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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2006 by Nicholas Bishop
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
- * Implements the Sculpt Mode tools
- *
- * BDR_sculptmode.h
- *
- */
-
-#include "GHOST_Types.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_arithb.h"
-#include "BLI_blenlib.h"
-#include "BLI_dynstr.h"
-
-#include "DNA_armature_types.h"
-#include "DNA_brush_types.h"
-#include "DNA_image_types.h"
-#include "DNA_key_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_modifier_types.h"
-#include "DNA_object_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_color_types.h"
-
-#include "BKE_customdata.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_depsgraph.h"
-#include "BKE_global.h"
-#include "BKE_image.h"
-#include "BKE_key.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
-#include "BKE_mesh.h"
-#include "BKE_modifier.h"
-#include "BKE_texture.h"
-#include "BKE_utildefines.h"
-#include "BKE_colortools.h"
-
-#include "BIF_editkey.h"
-#include "BIF_editview.h"
-#include "BIF_glutil.h"
-#include "BIF_gl.h"
-#include "BIF_interface.h"
-#include "BIF_mywindow.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-
-#include "BDR_drawobject.h"
-#include "BDR_sculptmode.h"
-
-#include "BSE_drawview.h"
-#include "BSE_edit.h"
-#include "BSE_view.h"
-
-#include "IMB_imbuf_types.h"
-
-#include "blendef.h"
-#include "multires.h"
-#include "mydevice.h"
-
-#include "RE_render_ext.h"
-#include "RE_shader_ext.h" /*for multitex_ext*/
-
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-
-/* Number of vertices to average in order to determine the flatten distance */
-#define FLATTEN_SAMPLE_SIZE 10
-
-/* ===== STRUCTS =====
- *
- */
-
-/* Used by vertex_users to store face indices in a list */
-typedef struct IndexNode {
- struct IndexNode* next,* prev;
- int Index;
-} IndexNode;
-
-
-/* ActiveData stores an Index into the mvert array of Mesh, plus Fade, which
- stores how far the vertex is from the brush center, scaled to the range [0,1]. */
-typedef struct ActiveData {
- struct ActiveData *next, *prev;
- unsigned int Index;
- float Fade;
- float dist;
-} ActiveData;
-
-typedef struct GrabData {
- char firsttime;
- ListBase active_verts[8];
- unsigned char index;
- vec3f delta, delta_symm;
- float depth;
-} GrabData;
-
-typedef struct EditData {
- vec3f center;
- float size;
- char flip;
- short mouse[2];
-
- /* Adjust brush strength along each axis
- to adjust for object scaling */
- float scale[3];
-
- /* View normals */
- vec3f up, right, out;
-
- GrabData *grabdata;
- float *layer_disps;
- vec3f *layer_store;
-
- char clip[3];
- float cliptol[3];
-
- char symm;
-} EditData;
-
-typedef struct RectNode {
- struct RectNode *next, *prev;
- rcti r;
-} RectNode;
-
-/* Used to store to 2D screen coordinates of each vertex in the mesh. */
-typedef struct ProjVert {
- short co[2];
-
- /* Used to mark whether a vertex is inside a rough bounding box
- containing the brush. */
- char inside;
-} ProjVert;
-
-static ProjVert *projverts= NULL;
-static Object *active_ob= NULL;
-
-SculptData *sculpt_data(void)
-{
- return &G.scene->sculptdata;
-}
-
-void sculpt_init_session(void);
-void init_editdata(EditData *e, short *, short *);
-void sculpt_undo_push(const short);
-
-SculptSession *sculpt_session(void)
-{
- if(!sculpt_data()->session)
- sculpt_init_session();
- return sculpt_data()->session;
-}
-
-/* ===== MEMORY =====
- *
- * Allocate/initialize/free data
- */
-
-// Default curve approximates 0.5 * (cos(pi * x) + 1), with 0 <= x <= 1;
-void sculpt_reset_curve(SculptData *sd)
-{
- CurveMap *cm = NULL;
-
- if(!sd->cumap)
- sd->cumap = curvemapping_add(1, 0, 0, 1, 1);
-
- cm = sd->cumap->cm;
-
- if(cm->curve)
- MEM_freeN(cm->curve);
- cm->curve= MEM_callocN(6*sizeof(CurveMapPoint), "curve points");
- cm->flag &= ~CUMA_EXTEND_EXTRAPOLATE;
- cm->totpoint= 6;
- cm->curve[0].x= 0;
- cm->curve[0].y= 1;
- cm->curve[1].x= 0.1;
- cm->curve[1].y= 0.97553;
- cm->curve[2].x= 0.3;
- cm->curve[2].y= 0.79389;
- cm->curve[3].x= 0.9;
- cm->curve[3].y= 0.02447;
- cm->curve[4].x= 0.7;
- cm->curve[4].y= 0.20611;
- cm->curve[5].x= 1;
- cm->curve[5].y= 0;
-}
-
-/* Initialize 'permanent' sculpt data that is saved with file kept after
- switching out of sculptmode. */
-void sculptmode_init(Scene *sce)
-{
- SculptData *sd;
-
- if(!sce) {
- error("Unable to initialize sculptmode: bad scene");
- return;
- }
-
- sd= &sce->sculptdata;
-
- if(sd->cumap)
- curvemapping_free(sd->cumap);
-
- memset(sd, 0, sizeof(SculptData));
-
- sd->drawbrush.size = sd->smoothbrush.size = sd->pinchbrush.size =
- sd->inflatebrush.size = sd->grabbrush.size =
- sd->layerbrush.size = sd->flattenbrush.size = 50;
- sd->drawbrush.strength = sd->smoothbrush.strength =
- sd->pinchbrush.strength = sd->inflatebrush.strength =
- sd->grabbrush.strength = sd->layerbrush.strength =
- sd->flattenbrush.strength = 25;
- sd->drawbrush.dir = sd->pinchbrush.dir = sd->inflatebrush.dir = sd->layerbrush.dir= 1;
- sd->drawbrush.airbrush = sd->smoothbrush.airbrush =
- sd->pinchbrush.airbrush = sd->inflatebrush.airbrush =
- sd->layerbrush.airbrush = sd->flattenbrush.airbrush = 0;
- sd->drawbrush.view= 0;
- sd->brush_type= DRAW_BRUSH;
- sd->texact= -1;
- sd->texfade= 1;
- sd->averaging= 1;
- sd->texsep= 0;
- sd->texrept= SCULPTREPT_DRAG;
- sd->flags= SCULPT_DRAW_BRUSH;
- sd->tablet_size=3;
- sd->tablet_strength=10;
- sd->rake=0;
- sculpt_reset_curve(sd);
-}
-
-void sculptmode_free_session(Scene *);
-void sculpt_init_session(void)
-{
- if(sculpt_data()->session)
- sculptmode_free_session(G.scene);
- sculpt_data()->session= MEM_callocN(sizeof(SculptSession), "SculptSession");
-}
-
-void sculptmode_free_vertexusers(SculptSession *ss)
-{
- if(ss && ss->vertex_users){
- MEM_freeN(ss->vertex_users);
- MEM_freeN(ss->vertex_users_mem);
- ss->vertex_users= NULL;
- ss->vertex_users_mem= NULL;
- ss->vertex_users_size= 0;
- }
-}
-
-void sculptmode_propset_end(SculptSession *ss, int);
-void sculptmode_free_session(Scene *sce)
-{
- SculptSession *ss= sce->sculptdata.session;
- if(ss) {
- sculptmode_free_vertexusers(ss);
- if(ss->texcache)
- MEM_freeN(ss->texcache);
- sculptmode_propset_end(ss, 1);
- MEM_freeN(ss);
- sce->sculptdata.session= NULL;
- }
-}
-
-void sculptmode_free_all(Scene *sce)
-{
- SculptData *sd= &sce->sculptdata;
- int a;
-
- sculptmode_free_session(sce);
-
- if(projverts) {
- MEM_freeN(projverts);
- projverts = NULL;
- }
-
- for(a=0; a<MAX_MTEX; a++) {
- MTex *mtex= sd->mtex[a];
- if(mtex) {
- if(mtex->tex) mtex->tex->id.us--;
- MEM_freeN(mtex);
- }
- }
-
- curvemapping_free(sd->cumap);
- sd->cumap = NULL;
-}
-
-/* vertex_users is an array of Lists that store all the faces that use a
- particular vertex. vertex_users is in the same order as mesh.mvert */
-void calc_vertex_users()
-{
- SculptSession *ss= sculpt_session();
- int i,j;
- IndexNode *node= NULL;
- Mesh *me= get_mesh(OBACT);
-
- sculptmode_free_vertexusers(ss);
-
- /* For efficiency, use vertex_users_mem as a memory pool (may be larger
- than necessary if mesh has triangles, but only one alloc is needed.) */
- ss->vertex_users= MEM_callocN(sizeof(ListBase) * me->totvert, "vertex_users");
- ss->vertex_users_size= me->totvert;
- ss->vertex_users_mem= MEM_callocN(sizeof(IndexNode)*me->totface*4, "vertex_users_mem");
- node= ss->vertex_users_mem;
-
- /* Find the users */
- for(i=0; i<me->totface; ++i){
- for(j=0; j<(me->mface[i].v4?4:3); ++j, ++node) {
- node->Index=i;
- BLI_addtail(&ss->vertex_users[((unsigned int*)(&me->mface[i]))[j]], node);
- }
- }
-}
-
-/* ===== INTERFACE =====
- */
-
-void sculptmode_rem_tex(void *junk0,void *junk1)
-{
- MTex *mtex= G.scene->sculptdata.mtex[G.scene->sculptdata.texact];
- if(mtex) {
- SculptSession *ss= sculpt_session();
- if(mtex->tex) mtex->tex->id.us--;
- MEM_freeN(mtex);
- G.scene->sculptdata.mtex[G.scene->sculptdata.texact]= NULL;
- /* Clear brush preview */
- if(ss->texcache) {
- MEM_freeN(ss->texcache);
- ss->texcache= NULL;
- }
- BIF_undo_push("Unlink brush texture");
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWOOPS, 0);
- }
-}
-
-/* ===== OPENGL =====
- *
- * Simple functions to get data from the GL
- */
-
-/* Store the modelview and projection matrices and viewport. */
-void init_sculptmatrices()
-{
- SculptSession *ss= sculpt_session();
-
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glMultMatrixf(OBACT->obmat);
-
- bgl_get_mats(&ss->mats);
-
- glPopMatrix();
-
-}
-
-/* Uses window coordinates (x,y) to find the depth in the GL depth buffer. If
- available, G.vd->depths is used so that the brush doesn't sculpt on top of
- itself (G.vd->depths is only updated at the end of a brush stroke.) */
-float get_depth(short x, short y)
-{
- float depth;
-
- if(x<0 || y<0) return 1;
- if(x>=curarea->winx || y>=curarea->winy) return 1;
-
- if(G.vd->depths && x<G.vd->depths->w && y<G.vd->depths->h)
- return G.vd->depths->depths[y*G.vd->depths->w+x];
-
- x+= curarea->winrct.xmin;
- y+= curarea->winrct.ymin;
-
- glReadPixels(x, y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth);
-
- return depth;
-}
-
-/* Uses window coordinates (x,y) and depth component z to find a point in
- modelspace */
-vec3f unproject(const short x, const short y, const float z)
-{
- SculptSession *ss= sculpt_session();
- double ux, uy, uz;
- vec3f p;
-
- gluUnProject(x,y,z, ss->mats.modelview, ss->mats.projection,
- (GLint *)ss->mats.viewport, &ux, &uy, &uz );
- p.x= ux;
- p.y= uy;
- p.z= uz;
- return p;
-}
-
-/* Convert a point in model coordinates to 2D screen coordinates. */
-void project(const float v[3], short p[2])
-{
- SculptSession *ss= sculpt_session();
- double ux, uy, uz;
-
- gluProject(v[0],v[1],v[2], ss->mats.modelview, ss->mats.projection,
- (GLint *)ss->mats.viewport, &ux, &uy, &uz);
- p[0]= ux;
- p[1]= uy;
-}
-
-/* ===== Sculpting =====
- *
- */
-
-/* Return modified brush size. Uses current tablet pressure (if available) to
- shrink the brush. Skipped for grab brush because only the first mouse down
- size is used, which is small if the user has just touched the pen to the
- tablet */
-char brush_size()
-{
- const BrushData *b= sculptmode_brush();
- float size= b->size;
- float pressure= get_pressure();
- short activedevice= get_activedevice();
-
- if(sculpt_data()->brush_type!=GRAB_BRUSH) {
- const float size_factor= G.scene->sculptdata.tablet_size / 10.0f;
- if(ELEM(activedevice, DEV_STYLUS, DEV_ERASER))
- size*= G.scene->sculptdata.tablet_size==0?1:
- (1-size_factor) + pressure*size_factor;
- }
-
- return size;
-}
-
-/* Return modified brush strength. Includes the direction of the brush, positive
- values pull vertices, negative values push. Uses tablet pressure and a
- special multiplier found experimentally to scale the strength factor. */
-float brush_strength(EditData *e)
-{
- const BrushData* b= sculptmode_brush();
- float dir= b->dir==1 ? 1 : -1;
- float pressure= 1;
- short activedevice= get_activedevice();
- float flip= e->flip ? -1:1;
-
- const float strength_factor= G.scene->sculptdata.tablet_strength / 10.0f;
- if(ELEM(activedevice, DEV_STYLUS, DEV_ERASER))
- pressure= G.scene->sculptdata.tablet_strength==0?1:
- (1-strength_factor) + get_pressure()*strength_factor;
-
- /* Flip direction for eraser */
- if(activedevice==DEV_ERASER)
- dir= -dir;
-
- switch(G.scene->sculptdata.brush_type){
- case DRAW_BRUSH:
- case LAYER_BRUSH:
- return b->strength / 5000.0f * dir * pressure * flip;
- case SMOOTH_BRUSH:
- return b->strength / 50.0f * pressure;
- case PINCH_BRUSH:
- return b->strength / 1000.0f * dir * pressure * flip;
- case GRAB_BRUSH:
- return 1;
- case INFLATE_BRUSH:
- return b->strength / 5000.0f * dir * pressure * flip;
- case FLATTEN_BRUSH:
- return b->strength / 500.0f * pressure;
- default:
- return 0;
- }
-}
-
-/* For clipping against a mirror modifier */
-void sculpt_clip(const EditData *e, float *co, const float val[3])
-{
- char i;
- for(i=0; i<3; ++i) {
- if(e->clip[i] && (fabs(co[i]) <= e->cliptol[i]))
- co[i]= 0.0f;
- else
- co[i]= val[i];
- }
-}
-
-/* Currently only for the draw brush; finds average normal for all active
- vertices */
-vec3f calc_area_normal(const vec3f *outdir, const ListBase* active_verts)
-{
- Mesh *me= get_mesh(OBACT);
- vec3f area_normal= {0,0,0};
- ActiveData *node= active_verts->first;
- const int view= sculpt_data()->brush_type==DRAW_BRUSH ? sculptmode_brush()->view : 0;
-
- while(node){
- area_normal.x+= me->mvert[node->Index].no[0];
- area_normal.y+= me->mvert[node->Index].no[1];
- area_normal.z+= me->mvert[node->Index].no[2];
- node= node->next;
- }
- Normalize(&area_normal.x);
- if(outdir) {
- area_normal.x= outdir->x * view + area_normal.x * (10-view);
- area_normal.y= outdir->y * view + area_normal.y * (10-view);
- area_normal.z= outdir->z * view + area_normal.z * (10-view);
- }
- Normalize(&area_normal.x);
- return area_normal;
-}
-void do_draw_brush(const EditData *e, const ListBase* active_verts)
-{
- Mesh *me= get_mesh(OBACT);
- const vec3f area_normal= calc_area_normal(&e->out, active_verts);
- ActiveData *node= active_verts->first;
-
- while(node){
- float *co= me->mvert[node->Index].co;
-
- const float val[3]= {co[0]+area_normal.x*node->Fade*e->scale[0],
- co[1]+area_normal.y*node->Fade*e->scale[1],
- co[2]+area_normal.z*node->Fade*e->scale[2]};
-
- sculpt_clip(e, co, val);
-
- node= node->next;
- }
-}
-
-/* For the smooth brush, uses the neighboring vertices around vert to calculate
- a smoothed location for vert. Skips corner vertices (used by only one
- polygon.) */
-vec3f neighbor_average(const int vert)
-{
- SculptSession *ss= sculpt_session();
- Mesh *me= get_mesh(OBACT);
- int i, skip= -1, total=0;
- IndexNode *node= ss->vertex_users[vert].first;
- vec3f avg= {0,0,0};
- char ncount= BLI_countlist(&ss->vertex_users[vert]);
- MFace *f;
-
- /* Don't modify corner vertices */
- if(ncount==1) {
- VecCopyf(&avg.x, me->mvert[vert].co);
- return avg;
- }
-
- while(node){
- f= &me->mface[node->Index];
-
- if(f->v4) {
- skip= (f->v1==vert?2:
- f->v2==vert?3:
- f->v3==vert?0:
- f->v4==vert?1:-1);
- }
-
- for(i=0; i<(f->v4?4:3); ++i) {
- if(i != skip && (ncount!=2 || BLI_countlist(&ss->vertex_users[(&f->v1)[i]]) <= 2)) {
- VecAddf(&avg.x,&avg.x,me->mvert[(&f->v1)[i]].co);
- ++total;
- }
- }
-
- node= node->next;
- }
-
- if(total>0) {
- avg.x/= total;
- avg.y/= total;
- avg.z/= total;
- }
- else
- VecCopyf(&avg.x, me->mvert[vert].co);
-
- return avg;
-}
-
-void do_smooth_brush(const EditData *e, const ListBase* active_verts)
-{
- ActiveData *node= active_verts->first;
- Mesh *me= get_mesh(OBACT);
-
- while(node){
- float *co= me->mvert[node->Index].co;
- const vec3f avg= neighbor_average(node->Index);
- const float val[3]= {co[0]+(avg.x-co[0])*node->Fade,
- co[1]+(avg.y-co[1])*node->Fade,
- co[2]+(avg.z-co[2])*node->Fade};
- sculpt_clip(e, co, val);
- node= node->next;
- }
-}
-
-void do_pinch_brush(const EditData *e, const ListBase* active_verts)
-{
- Mesh *me= get_mesh(OBACT);
- ActiveData *node= active_verts->first;
-
- while(node) {
- float *co= me->mvert[node->Index].co;
- const float val[3]= {co[0]+(e->center.x-co[0])*node->Fade,
- co[1]+(e->center.y-co[1])*node->Fade,
- co[2]+(e->center.z-co[2])*node->Fade};
- sculpt_clip(e, co, val);
- node= node->next;
- }
-}
-
-void do_grab_brush(EditData *e)
-{
- Mesh *me= get_mesh(OBACT);
- ActiveData *node= e->grabdata->active_verts[e->grabdata->index].first;
- float add[3];
-
- while(node) {
- float *co= me->mvert[node->Index].co;
-
- VecCopyf(add, &e->grabdata->delta_symm.x);
- VecMulf(add, node->Fade);
- VecAddf(add, add, co);
- sculpt_clip(e, co, add);
-
- node= node->next;
- }
-}
-
-void do_layer_brush(EditData *e, const ListBase *active_verts)
-{
- Mesh *me= get_mesh(OBACT);
- vec3f area_normal= calc_area_normal(NULL, active_verts);
- ActiveData *node= active_verts->first;
- const float bstr= brush_strength(e);
-
- while(node){
- float *disp= &e->layer_disps[node->Index];
-
- if((bstr > 0 && *disp < bstr) ||
- (bstr < 0 && *disp > bstr)) {
- float *co= me->mvert[node->Index].co;
-
- *disp+= node->Fade;
-
- if(bstr < 0) {
- if(*disp < bstr)
- *disp = bstr;
- } else {
- if(*disp > bstr)
- *disp = bstr;
- }
-
- {
- const float val[3]= {e->layer_store[node->Index].x+area_normal.x * *disp*e->scale[0],
- e->layer_store[node->Index].y+area_normal.y * *disp*e->scale[1],
- e->layer_store[node->Index].z+area_normal.z * *disp*e->scale[2]};
- sculpt_clip(e, co, val);
- }
- }
-
- node= node->next;
- }
-}
-
-void do_inflate_brush(const EditData *e, const ListBase *active_verts)
-{
- ActiveData *node= active_verts->first;
- float add[3];
- Mesh *me= get_mesh(OBACT);
-
- while(node) {
- float *co= me->mvert[node->Index].co;
- short *no= me->mvert[node->Index].no;
-
- add[0]= no[0]/ 32767.0f;
- add[1]= no[1]/ 32767.0f;
- add[2]= no[2]/ 32767.0f;
- VecMulf(add, node->Fade);
- add[0]*= e->scale[0];
- add[1]*= e->scale[1];
- add[2]*= e->scale[2];
- VecAddf(add, add, co);
-
- sculpt_clip(e, co, add);
-
- node= node->next;
- }
-}
-
-void calc_flatten_center(Mesh *me, ActiveData *node, const EditData *e, float co[3])
-{
- ActiveData *outer[FLATTEN_SAMPLE_SIZE];
- int i;
-
- for(i = 0; i < FLATTEN_SAMPLE_SIZE; ++i)
- outer[i] = node;
-
- for(; node; node = node->next) {
- for(i = 0; i < FLATTEN_SAMPLE_SIZE; ++i) {
- if(node->dist > outer[i]->dist) {
- outer[i] = node;
- break;
- }
- }
- }
-
- co[0] = co[1] = co[2] = 0.0f;
- for(i = 0; i < FLATTEN_SAMPLE_SIZE; ++i)
- VecAddf(co, co, me->mvert[outer[i]->Index].co);
- VecMulf(co, 1.0f / FLATTEN_SAMPLE_SIZE);
-}
-
-void do_flatten_brush(const EditData *e, const ListBase *active_verts)
-{
- Mesh *me= get_mesh(OBACT);
- ActiveData *node= active_verts->first;
- /* area_normal and cntr define the plane towards which vertices are squashed */
- vec3f area_normal= calc_area_normal(&e->out, active_verts);
- float cntr[3];
-
- calc_flatten_center(me, node, e, cntr);
-
- while(node){
- float *co= me->mvert[node->Index].co;
- float p1[3], sub1[3], sub2[3], intr[3], val[3];
-
- /* Find the intersection between squash-plane and vertex (along the area normal) */
- VecSubf(p1, co, &area_normal.x);
- VecSubf(sub1, cntr, p1);
- VecSubf(sub2, co, p1);
- VecSubf(intr, co, p1);
- VecMulf(intr, Inpf(&area_normal.x, sub1) / Inpf(&area_normal.x, sub2));
- VecAddf(intr, intr, p1);
-
- VecSubf(val, intr, co);
- VecMulf(val, node->Fade);
- VecAddf(val, val, co);
-
- sculpt_clip(e, co, val);
-
- node= node->next;
- }
-}
-
-/* Uses the brush curve control to find a strength value between 0 and 1 */
-float curve_strength(float p, const float len)
-{
- if(p > len) p= len;
- return curvemapping_evaluateF(G.scene->sculptdata.cumap, 0, p/len);
-}
-
-/* Uses symm to selectively flip any axis of a coordinate. */
-void flip_coord(float co[3], const char symm)
-{
- if(symm & SYMM_X)
- co[0]= -co[0];
- if(symm & SYMM_Y)
- co[1]= -co[1];
- if(symm & SYMM_Z)
- co[2]= -co[2];
-}
-
-/* Use the warpfac field in MTex to store a rotation value for sculpt textures. Value is in degrees */
-float tex_angle(void)
-{
- SculptData *sd= sculpt_data();
- if(sd->texact!=-1 && sd->mtex[sd->texact])
- return sd->mtex[sd->texact]->warpfac;
- return 0;
-}
-
-void set_tex_angle(const float f)
-{
- SculptData *sd = sculpt_data();
- if(sd->texact != -1 && sd->mtex[sd->texact])
- sd->mtex[sd->texact]->warpfac = f;
-}
-
-float to_rad(const float deg)
-{
- return deg * (M_PI/180.0f);
-}
-
-float to_deg(const float rad)
-{
- return rad * (180.0f/M_PI);
-}
-
-/* Get a pixel from the texcache at (px, py) */
-unsigned *get_texcache_pixel(const SculptSession *ss, int px, int py)
-{
- if(px < 0) px= 0;
- if(py < 0) py= 0;
- if(px > ss->texcache_w - 1) px= ss->texcache_w - 1;
- if(py > ss->texcache_h - 1) py= ss->texcache_h - 1;
- return ss->texcache + py * ss->texcache_w + px;
-}
-
-/* Return a multiplier for brush strength on a particular vertex. */
-float tex_strength(EditData *e, float *point, const float len,const unsigned vindex)
-{
- SculptData *sd= sculpt_data();
- SculptSession *ss= sculpt_session();
- float avg= 1;
-
- if(sd->texact==-1 || !sd->mtex[sd->texact])
- avg= 1;
- else if(sd->texrept==SCULPTREPT_3D) {
- /* Get strength by feeding the vertex location directly
- into a texture */
- float jnk;
- const float factor= 0.01;
- MTex mtex;
- memset(&mtex,0,sizeof(MTex));
- mtex.tex= sd->mtex[sd->texact]->tex;
- mtex.projx= 1;
- mtex.projy= 2;
- mtex.projz= 3;
- VecCopyf(mtex.size, sd->mtex[sd->texact]->size);
- VecMulf(mtex.size, factor);
- if(!sd->texsep)
- mtex.size[1]= mtex.size[2]= mtex.size[0];
-
- externtex(&mtex,point,&avg,&jnk,&jnk,&jnk,&jnk);
- }
- else if(ss->texcache) {
- const short bsize= sculptmode_brush()->size * 2;
- const short half= sculptmode_brush()->size;
- const float rot= to_rad(tex_angle());
- const unsigned tcw = ss->texcache_w, tch = ss->texcache_h;
- int px, py;
- unsigned i, *p;
- ProjVert pv;
-
- /* If the active area is being applied for symmetry, flip it
- across the symmetry axis in order to project it. This insures
- that the brush texture will be oriented correctly. */
- if(!e->symm)
- pv= projverts[vindex];
- else {
- float co[3];
- VecCopyf(co, point);
- flip_coord(co, e->symm);
- project(co, pv.co);
- }
-
- /* For Tile and Drag modes, get the 2D screen coordinates of the
- and scale them up or down to the texture size. */
- if(sd->texrept==SCULPTREPT_TILE) {
- const int sx= (const int)sd->mtex[sd->texact]->size[0];
- const int sy= (const int)sd->texsep ? sd->mtex[sd->texact]->size[1] : sx;
-
- float fx= pv.co[0];
- float fy= pv.co[1];
-
- float angle= atan2(fy, fx) - rot;
- float len= sqrtf(fx*fx + fy*fy);
-
- if(rot<0.001 && rot>-0.001) {
- px= pv.co[0];
- py= pv.co[1];
- } else {
- px= len * cos(angle) + 2000;
- py= len * sin(angle) + 2000;
- }
- if(sx != 1)
- px %= sx-1;
- if(sy != 1)
- py %= sy-1;
- p= get_texcache_pixel(ss, tcw*px/sx, tch*py/sy);
- } else {
- float fx= (pv.co[0] - e->mouse[0] + half) * (tcw*1.0f/bsize) - tcw/2;
- float fy= (pv.co[1] - e->mouse[1] + half) * (tch*1.0f/bsize) - tch/2;
-
- float angle= atan2(fy, fx) - rot;
- float len= sqrtf(fx*fx + fy*fy);
-
- px= tcw/2 + len * cos(angle);
- py= tch/2 + len * sin(angle);
-
- p= get_texcache_pixel(ss, px, py);
- }
-
- avg= 0;
- for(i=0; i<3; ++i)
- avg+= ((unsigned char*)(p))[i] / 255.0f;
-
- avg/= 3;
- }
-
- if(sd->texfade)
- avg*= curve_strength(len,e->size); /* Smooth curve */
-
- return avg;
-}
-
-/* Mark area around the brush as damaged. projverts are marked if they are
- inside the area and the damaged rectangle in 2D screen coordinates is
- added to damaged_rects. */
-void sculpt_add_damaged_rect(EditData *e)
-{
- short p[2];
- const float radius= brush_size();
- RectNode *rn= MEM_mallocN(sizeof(RectNode),"RectNode");
- Mesh *me= get_mesh(OBACT);
- unsigned i;
-
- /* Find center */
- project(&e->center.x, p);
- rn->r.xmin= p[0]-radius;
- rn->r.ymin= p[1]-radius;
- rn->r.xmax= p[0]+radius;
- rn->r.ymax= p[1]+radius;
-
- BLI_addtail(&sculpt_session()->damaged_rects, rn);
-
- /* Update insides */
- for(i=0; i<me->totvert; ++i) {
- if(!projverts[i].inside) {
- if(projverts[i].co[0] > rn->r.xmin && projverts[i].co[1] > rn->r.ymin &&
- projverts[i].co[0] < rn->r.xmax && projverts[i].co[1] < rn->r.ymax) {
- projverts[i].inside= 1;
- }
- }
- }
-}
-
-/* Clears the depth buffer in each modified area. */
-void sculpt_clear_damaged_areas(SculptSession *ss)
-{
- RectNode *rn= NULL;
-
- for(rn = ss->damaged_rects.first; rn; rn = rn->next) {
- rcti clp = rn->r;
- rcti *win = &curarea->winrct;
-
- clp.xmin += win->xmin;
- clp.xmax += win->xmin;
- clp.ymin += win->ymin;
- clp.ymax += win->ymin;
-
- if(clp.xmin < win->xmax && clp.xmax > win->xmin &&
- clp.ymin < win->ymax && clp.ymax > win->ymin) {
- if(clp.xmin < win->xmin) clp.xmin = win->xmin;
- if(clp.ymin < win->ymin) clp.ymin = win->ymin;
- if(clp.xmax > win->xmax) clp.xmax = win->xmax;
- if(clp.ymax > win->ymax) clp.ymax = win->ymax;
-
- glScissor(clp.xmin + 1, clp.ymin + 1,
- clp.xmax - clp.xmin - 2,
- clp.ymax - clp.ymin - 2);
- }
-
- glClear(GL_DEPTH_BUFFER_BIT);
- }
-}
-
-void do_brush_action(EditData e)
-{
- int i;
- float av_dist;
- ListBase active_verts={0,0};
- ActiveData *adata= 0;
- float *vert;
- Mesh *me= get_mesh(OBACT);
- const float bstrength= brush_strength(&e);
- KeyBlock *keyblock= ob_get_keyblock(OBACT);
- SculptSession *ss = sculpt_session();
-
- sculpt_add_damaged_rect(&e);
-
- /* Build a list of all vertices that are potentially within the brush's
- area of influence. Only do this once for the grab brush. */
- if(!e.grabdata || (e.grabdata && e.grabdata->firsttime)) {
- for(i=0; i<me->totvert; ++i) {
- /* Projverts.inside provides a rough bounding box */
- if(projverts[i].inside) {
- vert= ss->vertexcosnos ? &ss->vertexcosnos[i*6] : me->mvert[i].co;
- av_dist= VecLenf(&e.center.x,vert);
- if(av_dist < e.size) {
- adata= (ActiveData*)MEM_mallocN(sizeof(ActiveData), "ActiveData");
- adata->Index = i;
- /* Fade is used to store the final strength at which the brush
- should modify a particular vertex. */
- adata->Fade= tex_strength(&e,vert,av_dist,i) * bstrength;
- adata->dist = av_dist;
- if(e.grabdata && e.grabdata->firsttime)
- BLI_addtail(&e.grabdata->active_verts[e.grabdata->index], adata);
- else
- BLI_addtail(&active_verts, adata);
- }
- }
- }
- }
-
- /* Only act if some verts are inside the brush area */
- if(active_verts.first || (e.grabdata && e.grabdata->active_verts[e.grabdata->index].first)) {
- /* Apply one type of brush action */
- switch(G.scene->sculptdata.brush_type){
- case DRAW_BRUSH:
- do_draw_brush(&e, &active_verts);
- break;
- case SMOOTH_BRUSH:
- do_smooth_brush(&e, &active_verts);
- break;
- case PINCH_BRUSH:
- do_pinch_brush(&e, &active_verts);
- break;
- case INFLATE_BRUSH:
- do_inflate_brush(&e, &active_verts);
- break;
- case GRAB_BRUSH:
- do_grab_brush(&e);
- break;
- case LAYER_BRUSH:
- do_layer_brush(&e, &active_verts);
- break;
- case FLATTEN_BRUSH:
- do_flatten_brush(&e, &active_verts);
- break;
- }
-
- /* Copy the modified vertices from mesh to the active key */
- if(keyblock) {
- float *co= keyblock->data;
- if(co) {
- adata = e.grabdata ? e.grabdata->active_verts[e.grabdata->index].first : active_verts.first;
- for(; adata; adata= adata->next)
- if(adata->Index < keyblock->totelem)
- VecCopyf(&co[adata->Index*3], me->mvert[adata->Index].co);
- }
- }
-
- if(ss->vertexcosnos)
- BLI_freelistN(&active_verts);
- else {
- if(!e.grabdata)
- addlisttolist(&ss->damaged_verts, &active_verts);
- }
- }
-}
-
-/* Flip all the editdata across the axis/axes specified by symm. Used to
- calculate multiple modifications to the mesh when symmetry is enabled. */
-EditData flip_editdata(EditData *e, const char symm)
-{
- EditData fe= *e;
- GrabData *gd= fe.grabdata;
-
- flip_coord(&fe.center.x, symm);
- flip_coord(&fe.up.x, symm);
- flip_coord(&fe.right.x, symm);
- flip_coord(&fe.out.x, symm);
-
- fe.symm= symm;
-
- project(&e->center.x,fe.mouse);
-
- if(gd) {
- gd->index= symm;
- gd->delta_symm= gd->delta;
- flip_coord(&gd->delta_symm.x, symm);
- }
-
- return fe;
-}
-
-void do_symmetrical_brush_actions(EditData * e, short co[2], short pr_co[2])
-{
- const char symm= sculpt_data()->symm;
-
- init_editdata(e, co, pr_co);
-
- do_brush_action(flip_editdata(e, 0));
-
- if(symm & SYMM_X)
- do_brush_action(flip_editdata(e, SYMM_X));
- if(symm & SYMM_Y)
- do_brush_action(flip_editdata(e, SYMM_Y));
- if(symm & SYMM_Z)
- do_brush_action(flip_editdata(e, SYMM_Z));
- if(symm & SYMM_X && symm & SYMM_Y)
- do_brush_action(flip_editdata(e, SYMM_X | SYMM_Y));
- if(symm & SYMM_X && symm & SYMM_Z)
- do_brush_action(flip_editdata(e, SYMM_X | SYMM_Z));
- if(symm & SYMM_Y && symm & SYMM_Z)
- do_brush_action(flip_editdata(e, SYMM_Y | SYMM_Z));
- if(symm & SYMM_X && symm & SYMM_Y && symm & SYMM_Z)
- do_brush_action(flip_editdata(e, SYMM_X | SYMM_Y | SYMM_Z));
-}
-
-void add_face_normal(vec3f *norm, const MFace* face)
-{
- Mesh *me= get_mesh(OBACT);
-
- vec3f c= {me->mvert[face->v1].co[0],me->mvert[face->v1].co[1],me->mvert[face->v1].co[2]};
- vec3f b= {me->mvert[face->v2].co[0],me->mvert[face->v2].co[1],me->mvert[face->v2].co[2]};
- vec3f a= {me->mvert[face->v3].co[0],me->mvert[face->v3].co[1],me->mvert[face->v3].co[2]};
- vec3f s1, s2;
-
- VecSubf(&s1.x,&a.x,&b.x);
- VecSubf(&s2.x,&c.x,&b.x);
-
- norm->x+= s1.y * s2.z - s1.z * s2.y;
- norm->y+= s1.z * s2.x - s1.x * s2.z;
- norm->z+= s1.x * s2.y - s1.y * s2.x;
-}
-
-void update_damaged_vert(Mesh *me, ListBase *lb)
-{
- ActiveData *vert;
-
- for(vert= lb->first; vert; vert= vert->next) {
- vec3f norm= {0,0,0};
- IndexNode *face= sculpt_session()->vertex_users[vert->Index].first;
-
- while(face){
- add_face_normal(&norm,&me->mface[face->Index]);
- face= face->next;
- }
- Normalize(&norm.x);
-
- me->mvert[vert->Index].no[0]=norm.x*32767;
- me->mvert[vert->Index].no[1]=norm.y*32767;
- me->mvert[vert->Index].no[2]=norm.z*32767;
- }
-}
-
-void calc_damaged_verts(ListBase *damaged_verts, GrabData *grabdata)
-{
- Mesh *me= get_mesh(OBACT);
-
- if(grabdata) {
- int i;
- for(i=0; i<8; ++i)
- update_damaged_vert(me,&grabdata->active_verts[i]);
- } else {
- update_damaged_vert(me,damaged_verts);
- BLI_freelistN(damaged_verts);
- damaged_verts->first = damaged_verts->last = NULL;
- }
-}
-
-void projverts_clear_inside()
-{
- Mesh *me = get_mesh(OBACT);
- if(me) {
- int i;
- for(i = 0; i < me->totvert; ++i)
- projverts[i].inside = 0;
- }
-}
-
-BrushData *sculptmode_brush(void)
-{
- SculptData *sd= &G.scene->sculptdata;
-
- BrushData *bd =
- (sd->brush_type==DRAW_BRUSH ? &sd->drawbrush :
- sd->brush_type==SMOOTH_BRUSH ? &sd->smoothbrush :
- sd->brush_type==PINCH_BRUSH ? &sd->pinchbrush :
- sd->brush_type==INFLATE_BRUSH ? &sd->inflatebrush :
- sd->brush_type==GRAB_BRUSH ? &sd->grabbrush :
- sd->brush_type==LAYER_BRUSH ? &sd->layerbrush :
- sd->brush_type==FLATTEN_BRUSH ? &sd->flattenbrush : NULL);
-
- if(!bd) {
- sculptmode_init(G.scene);
- bd = &sd->drawbrush;
- }
-
- return bd;
-}
-
-void sculptmode_update_tex()
-{
- SculptData *sd= sculpt_data();
- SculptSession *ss= sculpt_session();
- MTex *mtex = sd->mtex[sd->texact];
- TexResult texres = {0};
- float x, y, step=2.0/128.0, co[3];
- int hasrgb, ix, iy;
-
- /* Skip Default brush shape and non-textures */
- if(sd->texact == -1 || !sd->mtex[sd->texact]) return;
-
- if(ss->texcache) {
- MEM_freeN(ss->texcache);
- ss->texcache= NULL;
- }
-
- ss->texcache_w = ss->texcache_h = 128;
- ss->texcache = MEM_callocN(sizeof(int) * ss->texcache_w * ss->texcache_h, "Sculpt Texture cache");
-
- if(mtex && mtex->tex) {
- BKE_image_get_ibuf(sd->mtex[sd->texact]->tex->ima, NULL);
-
- /*do normalized cannonical view coords for texture*/
- for (y=-1.0, iy=0; iy<128; iy++, y += step) {
- for (x=-1.0, ix=0; ix<128; ix++, x += step) {
- co[0]= x;
- co[1]= y;
- co[2]= 0.0f;
-
- /* This is copied from displace modifier code */
- hasrgb = multitex_ext(mtex->tex, co, NULL, NULL, 1, &texres);
-
- /* if the texture gave an RGB value, we assume it didn't give a valid
- * intensity, so calculate one (formula from do_material_tex).
- * if the texture didn't give an RGB value, copy the intensity across
- */
- if(hasrgb & TEX_RGB)
- texres.tin = (0.35 * texres.tr + 0.45 *
- texres.tg + 0.2 * texres.tb);
-
- texres.tin = texres.tin * 255.0;
- ((char*)ss->texcache)[(iy*128+ix)*4] = (char)texres.tin;
- ((char*)ss->texcache)[(iy*128+ix)*4+1] = (char)texres.tin;
- ((char*)ss->texcache)[(iy*128+ix)*4+2] = (char)texres.tin;
- ((char*)ss->texcache)[(iy*128+ix)*4+3] = (char)texres.tin;
- }
- }
- }
-}
-
-/* pr_mouse is only used for the grab brush, can be NULL otherwise */
-void init_editdata(EditData *e, short *mouse, short *pr_mouse)
-{
- SculptData *sd = sculpt_data();
- const float mouse_depth= get_depth(mouse[0],mouse[1]);
- vec3f brush_edge_loc, zero_loc, oldloc;
- ModifierData *md;
- int i;
- const char flip = (get_qual() == LR_SHIFTKEY);
-
- e->flip= flip;
-
- /* Convert the location and size of the brush to
- modelspace coords */
- e->center= unproject(mouse[0],mouse[1],mouse_depth);
- brush_edge_loc= unproject(mouse[0] +
- brush_size(),mouse[1],
- mouse_depth);
- e->size= VecLenf(&e->center.x,&brush_edge_loc.x);
-
- /* Set the pivot to allow the model to rotate around the center of the brush */
- if(get_depth(mouse[0],mouse[1]) < 1.0)
- sculpt_session()->pivot= e->center;
-
- /* Now project the Up, Right, and Out normals from view to model coords */
- zero_loc= unproject(0, 0, 0);
- e->up= unproject(0, -1, 0);
- e->right= unproject(1, 0, 0);
- e->out= unproject(0, 0, -1);
- VecSubf(&e->up.x, &e->up.x, &zero_loc.x);
- VecSubf(&e->right.x, &e->right.x, &zero_loc.x);
- VecSubf(&e->out.x, &e->out.x, &zero_loc.x);
- Normalize(&e->up.x);
- Normalize(&e->right.x);
- Normalize(&e->out.x);
-
- /* Initialize mirror modifier clipping */
- for(i=0; i<3; ++i) {
- e->clip[i]= 0;
- e->cliptol[i]= 0;
- }
- for(md= OBACT->modifiers.first; md; md= md->next) {
- if(md->type==eModifierType_Mirror && (md->mode & eModifierMode_Realtime)) {
- const MirrorModifierData *mmd = (MirrorModifierData*) md;
-
- if(mmd->flag & MOD_MIR_CLIPPING) {
- e->clip[mmd->axis]= 1;
- if(mmd->tolerance > e->cliptol[mmd->axis])
- e->cliptol[mmd->axis]= mmd->tolerance;
- }
- }
- }
-
- if(sd->brush_type == GRAB_BRUSH) {
- vec3f gcenter;
- if(!e->grabdata) {
- e->grabdata= MEM_callocN(sizeof(GrabData),"grab data");
- e->grabdata->firsttime= 1;
- e->grabdata->depth= mouse_depth;
- }
- else
- e->grabdata->firsttime= 0;
-
- /* Find the delta */
- gcenter= unproject(mouse[0],mouse[1],e->grabdata->depth);
- oldloc= unproject(pr_mouse[0],pr_mouse[1],e->grabdata->depth);
- VecSubf(&e->grabdata->delta.x,&gcenter.x,&oldloc.x);
- }
- else if(sd->brush_type == LAYER_BRUSH) {
- Mesh *me= get_mesh(OBACT);
-
- if(!e->layer_disps)
- e->layer_disps= MEM_callocN(sizeof(float)*me->totvert,"Layer disps");
- if(!e->layer_store) {
- unsigned i;
- e->layer_store= MEM_mallocN(sizeof(vec3f)*me->totvert,"Layer store");
- for(i=0; i<me->totvert; ++i)
- VecCopyf(&e->layer_store[i].x,me->mvert[i].co);
- }
- }
-}
-void sculptmode_set_strength(const int delta)
-{
- int val = sculptmode_brush()->strength + delta;
- if(val < 1) val = 1;
- if(val > 100) val = 100;
- sculptmode_brush()->strength= val;
-}
-
-void sculptmode_propset_calctex()
-{
- SculptData *sd= sculpt_data();
- SculptSession *ss= sculpt_session();
- PropsetData *pd= sculpt_session()->propset;
- if(pd) {
- int i, j;
- const int tsz = 128;
- float *d;
- if(!pd->texdata) {
- pd->texdata= MEM_mallocN(sizeof(float)*tsz*tsz, "Brush preview");
- if(sd->texrept!=SCULPTREPT_3D)
- sculptmode_update_tex();
- for(i=0; i<tsz; ++i)
- for(j=0; j<tsz; ++j) {
- float magn= sqrt(pow(i-tsz/2,2)+pow(j-tsz/2,2));
- if(sd->texfade)
- pd->texdata[i*tsz+j]= curve_strength(magn,tsz/2);
- else
- pd->texdata[i*tsz+j]= magn < tsz/2 ? 1 : 0;
- }
- if(sd->texact != -1 && ss->texcache) {
- for(i=0; i<tsz; ++i)
- for(j=0; j<tsz; ++j) {
- const int col= ss->texcache[i*tsz+j];
- pd->texdata[i*tsz+j]*= (((char*)&col)[0]+((char*)&col)[1]+((char*)&col)[2])/3.0f/255.0f;
- }
- }
- }
-
- /* Adjust alpha with brush strength */
- d= MEM_dupallocN(pd->texdata);
- for(i=0; i<tsz; ++i)
- for(j=0; j<tsz; ++j)
- d[i*tsz+j]*= sculptmode_brush()->strength/200.0f+0.5f;
-
-
- if(!pd->tex)
- glGenTextures(1, (GLuint *)&pd->tex);
- glBindTexture(GL_TEXTURE_2D, pd->tex);
-
- glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, tsz, tsz, 0, GL_ALPHA, GL_FLOAT, d);
- MEM_freeN(d);
- }
-}
-
-void sculptmode_propset_header()
-{
- SculptSession *ss= sculpt_session();
- PropsetData *pd= ss ? ss->propset : NULL;
- if(pd) {
- char str[512];
- const char *name= "";
- int val= 0;
- if(pd->mode == PropsetSize) {
- name= "Size";
- val= sculptmode_brush()->size;
- }
- else if(pd->mode == PropsetStrength) {
- name= "Strength";
- val= sculptmode_brush()->strength;
- }
- else if(pd->mode == PropsetTexRot) {
- name= "Texture Angle";
- val= tex_angle();
- }
- sprintf(str, "Brush %s: %d", name, val);
- headerprint(str);
- }
-}
-
-void sculptmode_propset_end(SculptSession *ss, int cancel)
-{
- if(ss && ss->propset) {
- PropsetData *pd= ss->propset;
-
- if(cancel) {
- sculptmode_brush()->size= pd->origsize;
- sculptmode_brush()->strength= pd->origstrength;
- set_tex_angle(pd->origtexrot);
- } else {
- if(pd->mode != PropsetSize)
- sculptmode_brush()->size= pd->origsize;
- if(pd->mode != PropsetStrength)
- sculptmode_brush()->strength= pd->origstrength;
- if(pd->mode != PropsetTexRot)
- set_tex_angle(pd->origtexrot);
- }
- glDeleteTextures(1, &pd->tex);
- MEM_freeN(pd->texdata);
- MEM_freeN(pd);
- ss->propset= NULL;
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWHEADERS, 0);
- }
-}
-
-void sculptmode_propset_init(PropsetMode mode)
-{
- SculptSession *ss= sculpt_session();
- PropsetData *pd= ss->propset;
- const float ang= tex_angle();
-
- if(!pd) {
- short mouse[2];
-
- pd= MEM_callocN(sizeof(PropsetData),"PropsetSize");
- ss->propset= pd;
-
- getmouseco_areawin(mouse);
- pd->origloc[0]= mouse[0];
- pd->origloc[1]= mouse[1];
-
- if(mode == PropsetSize)
- pd->origloc[0]-= sculptmode_brush()->size;
- else if(mode == PropsetStrength)
- pd->origloc[0]-= 200 - 2*sculptmode_brush()->strength;
- else if(mode == PropsetTexRot) {
- pd->origloc[0]-= 200 * cos(to_rad(ang));
- pd->origloc[1]-= 200 * sin(to_rad(ang));
- }
-
- pd->origsize= sculptmode_brush()->size;
- pd->origstrength= sculptmode_brush()->strength;
- pd->origtexrot= ang;
-
- sculptmode_propset_calctex();
-
- pd->num.idx_max= 0;
- }
-
- pd->mode= mode;
- sculptmode_propset_header();
-
- allqueue(REDRAWVIEW3D, 0);
-}
-
-void sculpt_paint_brush(char clear)
-{
- if(sculpt_data()->flags & SCULPT_DRAW_BRUSH) {
- static short mvalo[2];
- short mval[2];
- const short rad= sculptmode_brush()->size;
-
- getmouseco_areawin(mval);
-
- persp(PERSP_WIN);
- if(clear)
- fdrawXORcirc(mval[0], mval[1], rad);
- else
- draw_sel_circle(mval, mvalo, rad, rad, 0);
-
- mvalo[0]= mval[0];
- mvalo[1]= mval[1];
- }
-}
-
-void sculptmode_propset(unsigned short event)
-{
- PropsetData *pd= sculpt_session()->propset;
- short mouse[2];
- short tmp[2];
- float dist;
- BrushData *brush= sculptmode_brush();
- char valset= 0;
-
- handleNumInput(&pd->num, event);
-
- if(hasNumInput(&pd->num)) {
- float val;
- applyNumInput(&pd->num, &val);
- if(pd->mode==PropsetSize)
- brush->size= val;
- else if(pd->mode==PropsetStrength)
- brush->strength= val;
- else if(pd->mode==PropsetTexRot)
- set_tex_angle(val);
- valset= 1;
- allqueue(REDRAWVIEW3D, 0);
- }
-
- switch(event) {
- case MOUSEX:
- case MOUSEY:
- if(!hasNumInput(&pd->num)) {
- char ctrl= G.qual & LR_CTRLKEY;
- getmouseco_areawin(mouse);
- tmp[0]= pd->origloc[0]-mouse[0];
- tmp[1]= pd->origloc[1]-mouse[1];
- dist= sqrt(tmp[0]*tmp[0]+tmp[1]*tmp[1]);
- if(pd->mode == PropsetSize) {
- brush->size= dist;
- if(ctrl) brush->size= (brush->size+5)/10*10;
- } else if(pd->mode == PropsetStrength) {
- float fin= (200.0f - dist) * 0.5f;
- brush->strength= fin>=0 ? fin : 0;
- if(ctrl) brush->strength= (brush->strength+5)/10*10;
- } else if(pd->mode == PropsetTexRot) {
- set_tex_angle((int)to_deg(atan2(tmp[1], tmp[0])) + 180);
- if(ctrl)
- set_tex_angle(((int)(tex_angle())+5)/10*10);
- }
- valset= 1;
- allqueue(REDRAWVIEW3D, 0);
- }
- break;
- case ESCKEY:
- case RIGHTMOUSE:
- brush->size= pd->origsize;
- brush->strength= pd->origstrength;
- set_tex_angle(pd->origtexrot);
- case LEFTMOUSE:
- while(get_mbut()==L_MOUSE);
- case RETKEY:
- case PADENTER:
- sculptmode_propset_end(sculpt_session(), 0);
- break;
- default:
- break;
- };
-
- if(valset) {
- if(pd->mode == PropsetSize) {
- if(brush->size<1) brush->size= 1;
- if(brush->size>200) brush->size= 200;
- }
- else if(pd->mode == PropsetStrength) {
- if(brush->strength > 100) brush->strength= 100;
- sculptmode_propset_calctex();
- }
- else if(pd->mode == PropsetTexRot) {
- if(tex_angle() < 0)
- set_tex_angle(0);
- else if(tex_angle() > 360)
- set_tex_angle(360);
- }
- }
-
- sculptmode_propset_header();
-}
-
-void sculptmode_selectbrush_menu(void)
-{
- SculptData *sd= sculpt_data();
- int val;
-
- pupmenu_set_active(sd->brush_type);
-
- val= pupmenu("Select Brush%t|Draw|Smooth|Pinch|Inflate|Grab|Layer|Flatten");
-
- if(val>0) {
- sd->brush_type= val;
-
- allqueue(REDRAWVIEW3D, 1);
- allqueue(REDRAWBUTSEDIT, 1);
- }
-}
-
-void sculptmode_update_all_projverts(float *vertcosnos)
-{
- Mesh *me= get_mesh(OBACT);
- unsigned i;
-
- if(!projverts)
- projverts = MEM_mallocN(sizeof(ProjVert)*me->totvert,"ProjVerts");
-
- for(i=0; i<me->totvert; ++i) {
- project(vertcosnos ? &vertcosnos[i * 6] : me->mvert[i].co, projverts[i].co);
- projverts[i].inside= 0;
- }
-}
-
-void sculptmode_draw_wires(int only_damaged, Mesh *me)
-{
- int i;
-
- bglPolygonOffset(1.0);
- glDepthMask(0);
- BIF_ThemeColor((OBACT==OBACT)?TH_ACTIVE:TH_SELECT);
-
- for(i=0; i<me->totedge; i++) {
- MEdge *med= &me->medge[i];
-
- if((!only_damaged || (projverts[med->v1].inside || projverts[med->v2].inside)) &&
- (med->flag & ME_EDGEDRAW)) {
- glDrawElements(GL_LINES, 2, GL_UNSIGNED_INT, &med->v1);
- }
- }
-
- glDepthMask(1);
- bglPolygonOffset(0.0);
-}
-
-void sculptmode_draw_mesh(int only_damaged)
-{
- Mesh *me= get_mesh(OBACT);
- int i, j, dt, drawCurrentMat = 1, matnr= -1;
-
- persp(PERSP_VIEW);
- mymultmatrix(OBACT->obmat);
- glEnable(GL_DEPTH_TEST);
- glEnable(GL_LIGHTING);
- init_gl_materials(OBACT, 0);
- glEnable(GL_CULL_FACE);
-
- glShadeModel(GL_SMOOTH);
-
- glVertexPointer(3, GL_FLOAT, sizeof(MVert), &me->mvert[0].co);
- glNormalPointer(GL_SHORT, sizeof(MVert), &me->mvert[0].no);
-
- dt= MIN2(G.vd->drawtype, OBACT->dt);
- if(dt==OB_WIRE)
- glColorMask(0,0,0,0);
-
- for(i=0; i<me->totface; ++i) {
- MFace *f= &me->mface[i];
- char inside= 0;
- int new_matnr= f->mat_nr + 1;
-
- if(new_matnr != matnr)
- drawCurrentMat= set_gl_material(matnr = new_matnr);
-
- /* If only_damaged!=0, only draw faces that are partially
- inside the area(s) modified by the brush */
- if(only_damaged) {
- for(j=0; j<(f->v4?4:3); ++j) {
- if(projverts[*((&f->v1)+j)].inside) {
- inside= 1;
- break;
- }
- }
- }
- else
- inside= 1;
-
- if(inside && drawCurrentMat)
- glDrawElements(f->v4?GL_QUADS:GL_TRIANGLES, f->v4?4:3, GL_UNSIGNED_INT, &f->v1);
- }
-
- glDisable(GL_CULL_FACE);
- glDisable(GL_LIGHTING);
- glColorMask(1,1,1,1);
-
- if(dt==OB_WIRE || (OBACT->dtx & OB_DRAWWIRE))
- sculptmode_draw_wires(only_damaged, me);
-
- glDisable(GL_DEPTH_TEST);
-}
-
-void sculptmode_correct_state(void)
-{
- if(!sculpt_session())
- sculpt_init_session();
-
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_NORMAL_ARRAY);
-
- if(!sculpt_session()->vertex_users) calc_vertex_users();
-}
-
-/* Checks whether full update mode (slower) needs to be used to work with modifiers */
-char sculpt_modifiers_active(Object *ob)
-{
- ModifierData *md;
-
- for(md= modifiers_getVirtualModifierList(ob); md; md= md->next) {
- if(md->mode & eModifierMode_Realtime)
- return 1;
- }
-
- return 0;
-}
-
-void sculpt(void)
-{
- SculptData *sd= sculpt_data();
- SculptSession *ss= sculpt_session();
- Object *ob= OBACT;
- /* lastSigMouse is for the rake, to store the last place the mouse movement was significant */
- short mouse[2], mvalo[2], lastSigMouse[2],firsttime=1, mousebut;
- short modifier_calculations= 0;
- EditData e;
- short spacing= 32000;
- int scissor_box[4];
- float offsetRot;
- if(!(G.f & G_SCULPTMODE) || G.obedit || !ob || ob->id.lib || !get_mesh(ob) || (get_mesh(ob)->totface == 0))
- return;
- if(!(ob->lay & G.vd->lay))
- error("Active object is not in this layer");
- if(ob_get_keyblock(ob)) {
- if(!(ob->shapeflag & OB_SHAPE_LOCK)) {
- error("Cannot sculpt on unlocked shape key");
- return;
- }
- }
-
- if(!ss) {
- sculpt_init_session();
- ss= sd->session;
- }
-
- if(sd->flags & SCULPT_INPUT_SMOOTH)
- sculpt_stroke_new(256);
-
- ss->damaged_rects.first = ss->damaged_rects.last = NULL;
- ss->damaged_verts.first = ss->damaged_verts.last = NULL;
- ss->vertexcosnos = NULL;
-
- /* Check that vertex users are up-to-date */
- if(ob != active_ob || !ss->vertex_users || ss->vertex_users_size != get_mesh(ob)->totvert) {
- sculptmode_free_vertexusers(ss);
- calc_vertex_users();
- if(projverts)
- MEM_freeN(projverts);
- projverts = NULL;
- active_ob= ob;
- }
-
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_NORMAL_ARRAY);
-
- persp(PERSP_VIEW);
-
- getmouseco_areawin(mvalo);
-
- /* Init texture
- FIXME: Shouldn't be doing this every time! */
- if(sd->texrept!=SCULPTREPT_3D)
- sculptmode_update_tex();
-
- getmouseco_areawin(mouse);
- mvalo[0]= mouse[0];
- mvalo[1]= mouse[1];
- lastSigMouse[0]=mouse[0];
- lastSigMouse[1]=mouse[1];
- mousebut = L_MOUSE;
-
- /* If modifier_calculations is true, then extra time must be spent
- updating the mesh. This takes a *lot* longer, so it's worth
- skipping if the modifier stack is empty. */
- modifier_calculations= sculpt_modifiers_active(ob);
-
- init_sculptmatrices();
-
- if(modifier_calculations)
- ss->vertexcosnos= mesh_get_mapped_verts_nors(ob);
- sculptmode_update_all_projverts(ss->vertexcosnos);
-
- e.grabdata= NULL;
- e.layer_disps= NULL;
- e.layer_store= NULL;
-
- /* Set scaling adjustment */
- e.scale[0]= 1.0f / ob->size[0];
- e.scale[1]= 1.0f / ob->size[1];
- e.scale[2]= 1.0f / ob->size[2];
-
- /* Capture original copy */
- if(sd->flags & SCULPT_DRAW_FAST)
- glAccum(GL_LOAD, 1);
-
- /* Get original scissor box */
- glGetIntegerv(GL_SCISSOR_BOX, scissor_box);
-
- /* For raking, get the original angle*/
- offsetRot=tex_angle();
-
- while (get_mbut() & mousebut) {
- getmouseco_areawin(mouse);
- /* If rake, and the mouse has moved over 10 pixels (euclidean) (prevents jitter) then get the new angle */
- if (sd->rake && (pow(lastSigMouse[0]-mouse[0],2)+pow(lastSigMouse[1]-mouse[1],2))>100){
- /*Nasty looking, but just orig + new angle really*/
- set_tex_angle(offsetRot+180.+to_deg(atan2((float)(mouse[1]-lastSigMouse[1]),(float)(mouse[0]-lastSigMouse[0]))));
- lastSigMouse[0]=mouse[0];
- lastSigMouse[1]=mouse[1];
- }
-
- if(firsttime || mouse[0]!=mvalo[0] || mouse[1]!=mvalo[1] || sculptmode_brush()->airbrush) {
- firsttime= 0;
-
- if(sd->flags & SCULPT_INPUT_SMOOTH)
- sculpt_stroke_add_point(mouse[0], mouse[1]);
-
- spacing+= sqrt(pow(mvalo[0]-mouse[0],2)+pow(mvalo[1]-mouse[1],2));
-
- if(modifier_calculations && !ss->vertexcosnos)
- ss->vertexcosnos= mesh_get_mapped_verts_nors(ob);
-
- if(G.scene->sculptdata.brush_type != GRAB_BRUSH) {
- if(sd->flags & SCULPT_INPUT_SMOOTH) {
- sculpt_stroke_apply(&e);
- }
- else if(sd->spacing==0 || spacing>sd->spacing) {
- do_symmetrical_brush_actions(&e, mouse, NULL);
- spacing= 0;
- }
- }
- else {
- do_symmetrical_brush_actions(&e, mouse, mvalo);
- ss->pivot= unproject(mouse[0],mouse[1],e.grabdata->depth);
- }
-
- if(modifier_calculations || ob_get_keyblock(ob))
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
-
- if(modifier_calculations || sd->brush_type == GRAB_BRUSH || !(sd->flags & SCULPT_DRAW_FAST)) {
- calc_damaged_verts(&ss->damaged_verts,e.grabdata);
- scrarea_do_windraw(curarea);
- screen_swapbuffers();
- } else { /* Optimized drawing */
- calc_damaged_verts(&ss->damaged_verts,e.grabdata);
-
- /* Draw the stored image to the screen */
- glAccum(GL_RETURN, 1);
-
- sculpt_clear_damaged_areas(ss);
-
- /* Draw all the polygons that are inside the modified area(s) */
- glScissor(scissor_box[0], scissor_box[1], scissor_box[2], scissor_box[3]);
- sculptmode_draw_mesh(1);
- glAccum(GL_LOAD, 1);
-
- projverts_clear_inside();
-
- persp(PERSP_WIN);
- glDisable(GL_DEPTH_TEST);
-
- /* Draw cursor */
- if(sculpt_data()->flags & SCULPT_DRAW_BRUSH)
- fdrawXORcirc((float)mouse[0],(float)mouse[1],sculptmode_brush()->size);
- if(sculpt_data()->flags & SCULPT_INPUT_SMOOTH)
- sculpt_stroke_draw();
-
- myswapbuffers();
- }
-
- BLI_freelistN(&ss->damaged_rects);
- ss->damaged_rects.first = ss->damaged_rects.last = NULL;
-
- mvalo[0]= mouse[0];
- mvalo[1]= mouse[1];
-
- if(ss->vertexcosnos) {
- MEM_freeN(ss->vertexcosnos);
- ss->vertexcosnos= NULL;
- }
-
- }
- else BIF_wait_for_statechange();
- }
-
- /* Set the rotation of the brush back to what it was before any rake */
- set_tex_angle(offsetRot);
-
- if(sd->flags & SCULPT_INPUT_SMOOTH) {
- sculpt_stroke_apply_all(&e);
- calc_damaged_verts(&ss->damaged_verts,e.grabdata);
- BLI_freelistN(&ss->damaged_rects);
- }
-
- if(e.layer_disps) MEM_freeN(e.layer_disps);
- if(e.layer_store) MEM_freeN(e.layer_store);
- /* Free GrabData */
- if(e.grabdata) {
- int i;
- for(i=0; i<8; ++i)
- BLI_freelistN(&e.grabdata->active_verts[i]);
- MEM_freeN(e.grabdata);
- }
- sculpt_stroke_free();
-
- sculpt_undo_push(G.scene->sculptdata.brush_type);
-
- if(G.vd->depths) G.vd->depths->damaged= 1;
-
- allqueue(REDRAWVIEW3D, 0);
-}
-
-void sculpt_undo_push(const short brush_type)
-{
- switch(brush_type) {
- case DRAW_BRUSH:
- BIF_undo_push("Draw Brush"); break;
- case SMOOTH_BRUSH:
- BIF_undo_push("Smooth Brush"); break;
- case PINCH_BRUSH:
- BIF_undo_push("Pinch Brush"); break;
- case INFLATE_BRUSH:
- BIF_undo_push("Inflate Brush"); break;
- case GRAB_BRUSH:
- BIF_undo_push("Grab Brush"); break;
- case LAYER_BRUSH:
- BIF_undo_push("Layer Brush"); break;
- case FLATTEN_BRUSH:
- BIF_undo_push("Flatten Brush"); break;
- default:
- BIF_undo_push("Sculpting"); break;
- }
-}
-
-void set_sculptmode(void)
-{
- if(G.f & G_SCULPTMODE) {
- Mesh *me= get_mesh(OBACT);
-
- G.f &= ~G_SCULPTMODE;
-
- sculptmode_free_session(G.scene);
- if(me && me->pv)
- sculptmode_pmv_off(me);
- }
- else {
- G.f |= G_SCULPTMODE;
-
- /* Called here to sanity-check the brush */
- sculptmode_brush();
-
- sculpt_init_session();
-
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_NORMAL_ARRAY);
- }
-
- active_ob= NULL;
-
- allqueue(REDRAWVIEW3D, 1);
- allqueue(REDRAWBUTSEDIT, 0);
-}
-
-/* Partial Mesh Visibility */
-PartialVisibility *sculptmode_copy_pmv(PartialVisibility *pmv)
-{
- PartialVisibility *n= MEM_dupallocN(pmv);
- n->vert_map= MEM_dupallocN(pmv->vert_map);
- n->edge_map= MEM_dupallocN(pmv->edge_map);
- n->old_edges= MEM_dupallocN(pmv->old_edges);
- n->old_faces= MEM_dupallocN(pmv->old_faces);
- return n;
-}
-
-void sculptmode_pmv_free(PartialVisibility *pv)
-{
- MEM_freeN(pv->vert_map);
- MEM_freeN(pv->edge_map);
- MEM_freeN(pv->old_faces);
- MEM_freeN(pv->old_edges);
- MEM_freeN(pv);
-}
-
-void sculptmode_revert_pmv(Mesh *me)
-{
- if(me->pv) {
- unsigned i;
- MVert *nve, *old_verts;
-
- active_ob= NULL;
-
- /* Reorder vertices */
- nve= me->mvert;
- old_verts = MEM_mallocN(sizeof(MVert)*me->pv->totvert,"PMV revert verts");
- for(i=0; i<me->pv->totvert; ++i)
- old_verts[i]= nve[me->pv->vert_map[i]];
-
- /* Restore verts, edges and faces */
- CustomData_free_layer_active(&me->vdata, CD_MVERT, me->totvert);
- CustomData_free_layer_active(&me->edata, CD_MEDGE, me->totedge);
- CustomData_free_layer_active(&me->fdata, CD_MFACE, me->totface);
-
- CustomData_add_layer(&me->vdata, CD_MVERT, CD_ASSIGN, old_verts, me->pv->totvert);
- CustomData_add_layer(&me->edata, CD_MEDGE, CD_ASSIGN, me->pv->old_edges, me->pv->totedge);
- CustomData_add_layer(&me->fdata, CD_MFACE, CD_ASSIGN, me->pv->old_faces, me->pv->totface);
- mesh_update_customdata_pointers(me);
-
- me->totvert= me->pv->totvert;
- me->totedge= me->pv->totedge;
- me->totface= me->pv->totface;
-
- me->pv->old_edges= NULL;
- me->pv->old_faces= NULL;
-
- /* Free maps */
- MEM_freeN(me->pv->edge_map);
- me->pv->edge_map= NULL;
- MEM_freeN(me->pv->vert_map);
- me->pv->vert_map= NULL;
-
- DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
- }
-}
-
-void sculptmode_pmv_off(Mesh *me)
-{
- if(me->pv) {
- sculptmode_revert_pmv(me);
- MEM_freeN(me->pv);
- me->pv= NULL;
- }
-}
-
-/* mode: 0=hide outside selection, 1=hide inside selection */
-void sculptmode_do_pmv(Object *ob, rcti *hb_2d, int mode)
-{
- Mesh *me= get_mesh(ob);
- vec3f hidebox[6];
- vec3f plane_normals[4];
- float plane_ds[4];
- unsigned i, j;
- unsigned ndx_show, ndx_hide;
- MVert *nve;
- unsigned face_cnt_show= 0, face_ndx_show= 0;
- unsigned edge_cnt_show= 0, edge_ndx_show= 0;
- unsigned *old_map= NULL;
- const unsigned SHOW= 0, HIDE=1;
-
- /* Convert hide box from 2D to 3D */
- hidebox[0]= unproject(hb_2d->xmin, hb_2d->ymax, 1);
- hidebox[1]= unproject(hb_2d->xmax, hb_2d->ymax, 1);
- hidebox[2]= unproject(hb_2d->xmax, hb_2d->ymin, 1);
- hidebox[3]= unproject(hb_2d->xmin, hb_2d->ymin, 1);
- hidebox[4]= unproject(hb_2d->xmin, hb_2d->ymax, 0);
- hidebox[5]= unproject(hb_2d->xmax, hb_2d->ymin, 0);
-
- /* Calculate normals for each side of hide box */
- CalcNormFloat(&hidebox[0].x,&hidebox[1].x,&hidebox[4].x,&plane_normals[0].x);
- CalcNormFloat(&hidebox[1].x,&hidebox[2].x,&hidebox[5].x,&plane_normals[1].x);
- CalcNormFloat(&hidebox[2].x,&hidebox[3].x,&hidebox[5].x,&plane_normals[2].x);
- CalcNormFloat(&hidebox[3].x,&hidebox[0].x,&hidebox[4].x,&plane_normals[3].x);
-
- /* Calculate D for each side of hide box */
- for(i= 0; i<4; ++i)
- plane_ds[i]= hidebox[i].x*plane_normals[i].x + hidebox[i].y*plane_normals[i].y +
- hidebox[i].z*plane_normals[i].z;
-
- /* Add partial visibility to mesh */
- if(!me->pv) {
- me->pv= MEM_callocN(sizeof(PartialVisibility),"PartialVisibility");
- } else {
- old_map= MEM_callocN(sizeof(unsigned)*me->pv->totvert,"PMV oldmap");
- for(i=0; i<me->pv->totvert; ++i) {
- old_map[i]= me->pv->vert_map[i]<me->totvert?0:1;
- }
- sculptmode_revert_pmv(me);
- }
-
- /* Kill sculpt data */
- active_ob= NULL;
-
- /* Initalize map with which verts are to be hidden */
- me->pv->vert_map= MEM_mallocN(sizeof(unsigned)*me->totvert, "PMV vertmap");
- me->pv->totvert= me->totvert;
- me->totvert= 0;
- for(i=0; i<me->pv->totvert; ++i) {
- me->pv->vert_map[i]= mode ? HIDE:SHOW;
- for(j=0; j<4; ++j) {
- if(me->mvert[i].co[0] * plane_normals[j].x +
- me->mvert[i].co[1] * plane_normals[j].y +
- me->mvert[i].co[2] * plane_normals[j].z < plane_ds[j] ) {
- me->pv->vert_map[i]= mode ? SHOW:HIDE; /* Vert is outside the hide box */
- break;
- }
- }
- if(old_map && old_map[i]) me->pv->vert_map[i]= 1;
- if(!me->pv->vert_map[i]) ++me->totvert;
-
- }
- if(old_map) MEM_freeN(old_map);
-
- /* Find out how many faces to show */
- for(i=0; i<me->totface; ++i) {
- if(!me->pv->vert_map[me->mface[i].v1] &&
- !me->pv->vert_map[me->mface[i].v2] &&
- !me->pv->vert_map[me->mface[i].v3]) {
- if(me->mface[i].v4) {
- if(!me->pv->vert_map[me->mface[i].v4])
- ++face_cnt_show;
- }
- else ++face_cnt_show;
- }
- }
- /* Find out how many edges to show */
- for(i=0; i<me->totedge; ++i) {
- if(!me->pv->vert_map[me->medge[i].v1] &&
- !me->pv->vert_map[me->medge[i].v2])
- ++edge_cnt_show;
- }
-
- /* Create new vert array and reset each vert's map with map[old]=new index */
- nve= MEM_mallocN(sizeof(MVert)*me->pv->totvert, "PMV verts");
- ndx_show= 0; ndx_hide= me->totvert;
- for(i=0; i<me->pv->totvert; ++i) {
- if(me->pv->vert_map[i]) {
- me->pv->vert_map[i]= ndx_hide;
- nve[me->pv->vert_map[i]]= me->mvert[i];
- ++ndx_hide;
- } else {
- me->pv->vert_map[i]= ndx_show;
- nve[me->pv->vert_map[i]]= me->mvert[i];
- ++ndx_show;
- }
- }
- CustomData_free_layer_active(&me->vdata, CD_MVERT, me->pv->totvert);
- me->mvert= CustomData_add_layer(&me->vdata, CD_MVERT, CD_ASSIGN, nve, me->totvert);
-
- /* Create new face array */
- me->pv->old_faces= me->mface;
- me->pv->totface= me->totface;
- me->mface= MEM_mallocN(sizeof(MFace)*face_cnt_show, "PMV faces");
- for(i=0; i<me->totface; ++i) {
- MFace *pr_f= &me->pv->old_faces[i];
- char show= 0;
-
- if(me->pv->vert_map[pr_f->v1] < me->totvert &&
- me->pv->vert_map[pr_f->v2] < me->totvert &&
- me->pv->vert_map[pr_f->v3] < me->totvert) {
- if(pr_f->v4) {
- if(me->pv->vert_map[pr_f->v4] < me->totvert)
- show= 1;
- }
- else show= 1;
- }
-
- if(show) {
- MFace *cr_f= &me->mface[face_ndx_show];
- *cr_f= *pr_f;
- cr_f->v1= me->pv->vert_map[pr_f->v1];
- cr_f->v2= me->pv->vert_map[pr_f->v2];
- cr_f->v3= me->pv->vert_map[pr_f->v3];
- cr_f->v4= pr_f->v4 ? me->pv->vert_map[pr_f->v4] : 0;
- test_index_face(cr_f,NULL,0,pr_f->v4?4:3);
- ++face_ndx_show;
- }
- }
- me->totface= face_cnt_show;
- CustomData_set_layer(&me->fdata, CD_MFACE, me->mface);
-
- /* Create new edge array */
- me->pv->old_edges= me->medge;
- me->pv->totedge= me->totedge;
- me->medge= MEM_mallocN(sizeof(MEdge)*edge_cnt_show, "PMV edges");
- me->pv->edge_map= MEM_mallocN(sizeof(int)*me->pv->totedge,"PMV edgemap");
- for(i=0; i<me->totedge; ++i) {
- if(me->pv->vert_map[me->pv->old_edges[i].v1] < me->totvert &&
- me->pv->vert_map[me->pv->old_edges[i].v2] < me->totvert) {
- MEdge *cr_e= &me->medge[edge_ndx_show];
- me->pv->edge_map[i]= edge_ndx_show;
- *cr_e= me->pv->old_edges[i];
- cr_e->v1= me->pv->vert_map[me->pv->old_edges[i].v1];
- cr_e->v2= me->pv->vert_map[me->pv->old_edges[i].v2];
- ++edge_ndx_show;
- }
- else me->pv->edge_map[i]= -1;
- }
- me->totedge= edge_cnt_show;
- CustomData_set_layer(&me->edata, CD_MEDGE, me->medge);
-
- DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
-}
-
-rcti sculptmode_pmv_box()
-{
- short down[2], mouse[2];
- rcti ret;
-
- getmouseco_areawin(down);
-
- while((get_mbut()&L_MOUSE) || (get_mbut()&R_MOUSE)) {
- getmouseco_areawin(mouse);
-
- scrarea_do_windraw(curarea);
-
- persp(PERSP_WIN);
- glLineWidth(2);
- setlinestyle(2);
- sdrawXORline(down[0],down[1],mouse[0],down[1]);
- sdrawXORline(mouse[0],down[1],mouse[0],mouse[1]);
- sdrawXORline(mouse[0],mouse[1],down[0],mouse[1]);
- sdrawXORline(down[0],mouse[1],down[0],down[1]);
- setlinestyle(0);
- glLineWidth(1);
- persp(PERSP_VIEW);
-
- screen_swapbuffers();
- backdrawview3d(0);
- }
-
- ret.xmin= down[0]<mouse[0]?down[0]:mouse[0];
- ret.ymin= down[1]<mouse[1]?down[1]:mouse[1];
- ret.xmax= down[0]>mouse[0]?down[0]:mouse[0];
- ret.ymax= down[1]>mouse[1]?down[1]:mouse[1];
- return ret;
-}
-
-void sculptmode_pmv(int mode)
-{
- Object *ob= OBACT;
- rcti hb_2d;
-
- if(ob_get_key(ob)) {
- error("Cannot hide mesh with shape keys enabled");
- return;
- }
-
- hb_2d= sculptmode_pmv_box(); /* Get 2D hide box */
-
- sculptmode_correct_state();
-
- waitcursor(1);
-
- if(hb_2d.xmax-hb_2d.xmin > 3 && hb_2d.ymax-hb_2d.ymin > 3) {
- init_sculptmatrices();
-
- sculptmode_do_pmv(ob,&hb_2d,mode);
- }
- else sculptmode_pmv_off(get_mesh(ob));
-
- scrarea_do_windraw(curarea);
-
- BIF_undo_push("Partial mesh hide");
-
- waitcursor(0);
-}
diff --git a/source/blender/src/seqaudio.c b/source/blender/src/seqaudio.c
deleted file mode 100644
index ae76de90ddf..00000000000
--- a/source/blender/src/seqaudio.c
+++ /dev/null
@@ -1,553 +0,0 @@
-/*
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): intrr, Peter Schlaile
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifndef WIN32
-#define __USE_XOPEN /* Needed for swab on linux */
-#include <unistd.h>
-#undef __USE_XOPEN
-#else
-#include <io.h>
-#endif
-
-#include <fcntl.h>
-#include <stdio.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "PIL_time.h"
-
-#include "BMF_Api.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "DNA_screen_types.h"
-#include "DNA_sound_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_sequence_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_ipo_types.h"
-
-#include "BKE_utildefines.h"
-#include "BKE_global.h"
-#include "BKE_library.h"
-#include "BKE_blender.h"
-#include "BKE_main.h"
-#include "BKE_ipo.h"
-
-#include "BIF_gl.h"
-#include "BIF_graphics.h"
-#include "BIF_keyval.h"
-#include "BIF_mainqueue.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_toolbox.h"
-#include "BIF_mywindow.h"
-#include "BIF_space.h"
-#include "BIF_glutil.h"
-#include "BIF_interface.h"
-
-#include "BSE_view.h"
-#include "BSE_seqaudio.h"
-#include "BIF_editsound.h"
-
-#include "mydevice.h"
-#include "blendef.h"
-
-
-void audio_fill(void *mixdown, Uint8 *sstream, int len);
-/* ************ GLOBALS ************* */
-
-static int audio_pos;
-static int audio_scrub=0;
-static int audio_playing=0;
-static int audio_initialised=0;
-static int audio_startframe=0;
-static double audio_starttime = 0.0;
-/////
-//
-/* local protos ------------------- */
-void audio_mixdown(void);
-
-void makewavstring (char *string)
-{
- char txt[64];
-
- if (string==0) return;
-
- strcpy(string, G.scene->r.pic);
- BLI_convertstringcode(string, G.sce, G.scene->r.cfra);
-
- BLI_make_existing_file(string);
-
- if (BLI_strcasecmp(string + strlen(string) - 4, ".wav")) {
- sprintf(txt, "%04d_%04d.wav", (G.scene->r.sfra) , (G.scene->r.efra) );
- strcat(string, txt);
- }
-}
-
-void audio_mixdown()
-{
- int file, c, totlen, totframe, i, oldcfra;
- char *buf;
-
- buf = MEM_mallocN(65536, "audio_mixdown");
- makewavstring(buf);
-
- file = open(buf, O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666);
-
- if(file == -1)
- {
- error("Can't open output file");
- return;
- }
-
- waitcursor(1);
-
- printf("Saving: %s ", buf);
-
- strcpy(buf, "RIFFlengWAVEfmt fmln01ccRATEbsecBP16dataDLEN");
- totframe = (EFRA - SFRA + 1);
- totlen = (int) ( FRA2TIME(totframe) * (float)G.scene->audio.mixrate * 4.0);
- printf(" totlen %d\n", totlen+36+8);
-
- totlen+= 36; /* len is filesize-8 in WAV spec, total header is 44 bytes */
- memcpy(buf+4, &totlen, 4);
- totlen-= 36;
-
- buf[16] = 0x10; buf[17] = buf[18] = buf[19] = 0; buf[20] = 1; buf[21] = 0;
- buf[22] = 2; buf[23]= 0;
- memcpy(buf+24, &G.scene->audio.mixrate, 4);
- i = G.scene->audio.mixrate * 4;
- memcpy(buf+28, &i, 4);
- buf[32] = 4; buf[33] = 0; buf[34] = 16; buf[35] = 0;
- i = totlen;
- memcpy(buf+40, &i, 4);
-
- if (G.order == B_ENDIAN) {
- /* swap the four ints to little endian */
-
- /* length */
- SWITCH_INT(buf[4]);
-
- /* audio rate */
- SWITCH_INT(buf[24]);
-
- /* audio mixrate * 4 */
- SWITCH_INT(buf[28]);
-
- /* length */
- SWITCH_INT(buf[40]);
- }
-
- c = write(file, buf, 44);
-
- oldcfra = CFRA;
- audiostream_play(SFRA, 0, 1);
-
- i= 0;
- while ( totlen > 0 ) {
- totlen -= 64;
-
- memset(buf+i, 0, 64);
-
- CFRA=(int) ( ((float)(audio_pos-64)/( G.scene->audio.mixrate*4 ))*FPS );
-
- audio_fill(buf+i, NULL, 64);
- if (G.order == B_ENDIAN) {
- char tbuf[64];
- memcpy(tbuf, buf+i, 64);
- swab(tbuf, buf+i, 64);
- }
- if (i == (65536-64)) {
- i=0;
- write(file, buf, 65536);
- }
- else i+=64;
- }
- write(file, buf, i);
-
- waitcursor(0);
- CFRA = oldcfra;
- close(file);
- MEM_freeN(buf);
-
- return;
-}
-
-void audiostream_fill(Uint8 *mixdown, int len)
-{
- int oldcfra = CFRA;
- int i;
-
- memset(mixdown, 0, len);
-
- for (i = 0; i < len; i += 64) {
- CFRA = (int) ( ((float)(audio_pos-64)
- /( G.scene->audio.mixrate*4 ))
- * FPS );
-
- audio_fill(mixdown + i, NULL,
- (len - i) > 64 ? 64 : (len - i));
- }
-
- CFRA = oldcfra;
-}
-
-
-static void audio_levels(Uint8 *buf, int len, float db, float facf, float pan)
-{
- int i;
- float facl, facr, fac;
- signed short *sample;
-
- if (pan>=0) { facr = 1.0; facl = 1.0-pan; }
- else { facr = pan+1.0; facl = 1.0; }
-
- fac = pow(10.0, ((-(db+G.scene->audio.main))/20.0)) / facf;
- facl /= fac;
- facr /= fac;
-
- for (i=0; i<len; i+=4) {
- sample = (signed short*)(buf+i);
- sample[0] = (short) ((float)sample[0] * facl);
- sample[1] = (short) ((float)sample[1] * facr);
- }
-}
-
-/* convert mono/stereo and sampling rate, alloc a buffer for
- * sound->stream to contain the new sample, and set sound->streamlen
- * accordingly.
- */
-void audio_makestream(bSound *sound)
-{
- signed short *source, *dest;
- float ratio;
- int i;
-
- if ( (!sound)||(sound->stream)||(!sound->sample)||(!G.scene) ) {
- return;
- }
- ratio = (float)G.scene->audio.mixrate / (float)sound->sample->rate;
- sound->streamlen = (int) ( (float)sound->sample->len * ratio * 2.0/((float)sound->sample->channels) );
- sound->stream = malloc((int) ((float)sound->streamlen * 1.05));
- if (sound->sample->rate == G.scene->audio.mixrate) {
- if (sound->sample->channels == 2) {
- memcpy(sound->stream, sound->sample->data, sound->streamlen);
- return;
- } else {
- for (source = (signed short*)(sound->sample->data),
- dest = (signed short*)(sound->stream),
- i=0;
- i<sound->streamlen/4;
- dest += 2, source++, i++) dest[0] = dest[1] = source[0];
- return;
- }
- }
- if (sound->sample->channels == 1) {
- for (dest=(signed short*)(sound->stream), i=0, source=(signed short*)(sound->sample->data);
- i<(sound->streamlen/4); dest+=2, i++)
- dest[0] = dest[1] = source[(int)((float)i/ratio)];
- }
- else if (sound->sample->channels == 2) {
- for (dest=(signed short*)(sound->stream), i=0, source=(signed short*)(sound->sample->data);
- i<(sound->streamlen/2); dest+=2, i+=2) {
- dest[1] = source[(int)((float)i/ratio)];
- dest[0] = source[(int)((float)i/ratio)+1];
- }
- }
-}
-
-static void audio_fill_ram_sound(Sequence *seq, void * mixdown,
- Uint8 * sstream, int len)
-{
- Uint8* cvtbuf;
- bSound* sound;
- float facf;
-
- sound = seq->sound;
- audio_makestream(sound);
- if ((seq->curpos<sound->streamlen -len) && (seq->curpos>=0) &&
- (seq->startdisp <= CFRA) && ((seq->enddisp) > CFRA))
- {
- if(seq->ipo && seq->ipo->curve.first) {
- do_seq_ipo(seq, CFRA);
- facf = seq->facf0;
- } else {
- facf = 1.0;
- }
- cvtbuf = malloc(len);
- memcpy(cvtbuf, ((Uint8*)sound->stream)+(seq->curpos & (~3)), len);
- audio_levels(cvtbuf, len, seq->level, facf, seq->pan);
- if (!mixdown) {
- SDL_MixAudio(sstream, cvtbuf, len, SDL_MIX_MAXVOLUME);
- } else {
- SDL_MixAudio((Uint8*)mixdown, cvtbuf, len, SDL_MIX_MAXVOLUME);
- }
- free(cvtbuf);
- }
- seq->curpos += len;
-}
-
-static void audio_fill_hd_sound(Sequence *seq,
- void * mixdown, Uint8 * sstream,
- int len)
-{
- Uint8* cvtbuf;
- float facf;
-
- if ((seq->curpos >= 0) &&
- (seq->startdisp <= CFRA) && ((seq->enddisp) > CFRA))
- {
- if(seq->ipo && seq->ipo->curve.first) {
- do_seq_ipo(seq, CFRA);
- facf = seq->facf0;
- } else {
- facf = 1.0;
- }
- cvtbuf = malloc(len);
-
- sound_hdaudio_extract(seq->hdaudio, (short*) cvtbuf,
- seq->curpos / 4,
- G.scene->audio.mixrate,
- 2,
- len / 4);
- audio_levels(cvtbuf, len, seq->level, facf, seq->pan);
- if (!mixdown) {
- SDL_MixAudio(sstream,
- cvtbuf, len, SDL_MIX_MAXVOLUME);
- } else {
- SDL_MixAudio((Uint8*)mixdown,
- cvtbuf, len, SDL_MIX_MAXVOLUME);
- }
- free(cvtbuf);
- }
- seq->curpos += len;
-}
-
-static void audio_fill_seq(Sequence * seq, void * mixdown,
- Uint8 *sstream, int len)
-{
- while(seq) {
- if (seq->type == SEQ_META) {
- audio_fill_seq(seq->seqbase.first,
- mixdown, sstream, len);
- }
- if ( (seq->type == SEQ_RAM_SOUND) &&
- (seq->sound) &&
- (!(seq->flag & SEQ_MUTE))) {
- audio_fill_ram_sound(seq, mixdown, sstream, len);
- }
- if ( (seq->type == SEQ_HD_SOUND) &&
- (!(seq->flag & SEQ_MUTE))) {
- if (!seq->hdaudio) {
- char name[FILE_MAXDIR+FILE_MAXFILE];
-
- strncpy(name, seq->strip->dir,
- FILE_MAXDIR-1);
- strncat(name,
- seq->strip->stripdata->name,
- FILE_MAXFILE-1);
- BLI_convertstringcode(name, G.sce,
- G.scene->r.cfra);
-
- seq->hdaudio= sound_open_hdaudio(name);
- }
- if (seq->hdaudio) {
- audio_fill_hd_sound(seq, mixdown,
- sstream, len);
- }
- }
- seq = seq->next;
- }
-}
-
-void audio_fill(void *mixdown, Uint8 *sstream, int len)
-{
- Editing *ed;
- Sequence *seq;
-
- ed = G.scene->ed;
- if((ed) && (!(G.scene->audio.flag & AUDIO_MUTE))) {
- seq = ed->seqbasep->first;
- audio_fill_seq(seq, mixdown, sstream, len);
- }
-
- audio_pos += len;
- if (audio_scrub) {
- audio_scrub--;
- if (!audio_scrub) {
- audiostream_stop();
- }
- }
-}
-
-static int audio_init(SDL_AudioSpec *desired)
-{
- SDL_AudioSpec *obtained, *hardware_spec;
-
- SDL_CloseAudio();
-
- obtained = (SDL_AudioSpec*)MEM_mallocN(sizeof(SDL_AudioSpec),
- "SDL_AudioSpec");
-
- desired->callback=audio_fill;
-
- if ( SDL_OpenAudio(desired, obtained) < 0 ) {
- fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError());
- if (obtained) MEM_freeN(obtained);
- return 0;
- }
- audio_initialised = 1;
- hardware_spec=obtained;
-
- MEM_freeN(obtained);
-
- SDL_PauseAudio(0);
- return 1;
-}
-
-static int audiostream_play_seq(Sequence * seq, Uint32 startframe)
-{
- char name[FILE_MAXDIR+FILE_MAXFILE];
- int have_sound = 0;
-
- while(seq) {
- if (seq->type == SEQ_META) {
- if (audiostream_play_seq(
- seq->seqbase.first, startframe)) {
- have_sound = 1;
- }
- }
- if ((seq->type == SEQ_RAM_SOUND) && (seq->sound)) {
- have_sound = 1;
- seq->curpos = (int)( (FRA2TIME((double) startframe -
- (double) seq->start)
- * ((float)G.scene->audio.mixrate)
- * 4 ));
- }
- if ((seq->type == SEQ_HD_SOUND)) {
- have_sound = 1;
- if (!seq->hdaudio) {
- strncpy(name, seq->strip->dir, FILE_MAXDIR-1);
- strncat(name, seq->strip->stripdata->name,
- FILE_MAXFILE-1);
-
- seq->hdaudio = sound_open_hdaudio(name);
- }
- seq->curpos = (int)( (FRA2TIME((double) startframe -
- (double) seq->start)
- * ((float)G.scene->audio.mixrate)
- * 4 ));
- }
- seq= seq->next;
- }
- return have_sound;
-}
-
-void audiostream_play(Uint32 startframe, Uint32 duration, int mixdown)
-{
- static SDL_AudioSpec desired;
- Editing *ed;
- int have_sound = 0;
-
- ed= G.scene->ed;
- if(ed) {
- have_sound =
- audiostream_play_seq(ed->seqbasep->first, startframe);
- }
-
- if(have_sound) {
- /* this call used to be in startup */
- sound_init_audio();
- }
-
- if (U.mixbufsize && !audio_initialised && !(duration + mixdown)) {
- desired.freq=G.scene->audio.mixrate;
- desired.format=AUDIO_S16SYS;
- desired.channels=2;
- desired.samples=U.mixbufsize;
- desired.userdata=0;
- if (audio_init(&desired)==0) {
- U.mixbufsize = 0; /* no audio */
- }
- }
-
- audio_startframe = startframe;
- audio_pos = ( ((int)( FRA2TIME(startframe)
- *(G.scene->audio.mixrate)*4 )) & (~3) );
- audio_starttime = PIL_check_seconds_timer();
-
- audio_scrub = duration;
- if (!mixdown) {
- SDL_PauseAudio(0);
- audio_playing++;
- }
-}
-
-void audiostream_start(Uint32 frame)
-{
- audiostream_play(frame, 0, 0);
-}
-
-void audiostream_scrub(Uint32 frame)
-{
- if (U.mixbufsize) audiostream_play(frame, 4096/U.mixbufsize, 0);
-}
-
-void audiostream_stop(void)
-{
- SDL_PauseAudio(1);
- audio_playing=0;
-}
-
-int audiostream_pos(void)
-{
- int pos;
-
- if (U.mixbufsize) {
- pos = (int) (((double)(audio_pos-U.mixbufsize)
- / ( G.scene->audio.mixrate*4 ))
- * FPS );
- } else { /* fallback to seconds_timer when no audio available */
- pos = (int) ((PIL_check_seconds_timer() - audio_starttime)
- * FPS);
- }
-
- if (pos < audio_startframe) pos = audio_startframe;
- return ( pos );
-}
-
diff --git a/source/blender/src/seqeffects.c b/source/blender/src/seqeffects.c
deleted file mode 100644
index 5ed7ea29e2f..00000000000
--- a/source/blender/src/seqeffects.c
+++ /dev/null
@@ -1,3032 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * Contributor(s): Peter Schlaile <peter [at] schlaile [dot] de> 2005/2006
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <string.h>
-#include <math.h>
-#include <stdlib.h>
-
-#include "MEM_guardedalloc.h"
-#include "PIL_dynlib.h"
-
-#include "DNA_scene_types.h"
-#include "DNA_sequence_types.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "BIF_interface.h"
-#include "BIF_toolbox.h"
-
-#include "BSE_seqeffects.h"
-#include "BSE_sequence.h"
-
-#include "BKE_global.h"
-#include "BKE_ipo.h"
-#include "BKE_plugin_types.h"
-#include "BKE_texture.h"
-#include "BKE_utildefines.h"
-
-#include "IMB_imbuf_types.h"
-#include "IMB_imbuf.h"
-
-#include "RE_pipeline.h" // talks to entire render API
-
-#include "blendef.h"
-
-/* Glow effect */
-enum {
- GlowR=0,
- GlowG=1,
- GlowB=2,
- GlowA=3
-};
-
-
-/* **********************************************************************
- PLUGINS
- ********************************************************************** */
-
-static void open_plugin_seq(PluginSeq *pis, const char *seqname)
-{
- int (*version)();
- void* (*alloc_private)();
- char *cp;
-
- /* to be sure: (is tested for) */
- pis->doit= 0;
- pis->pname= 0;
- pis->varstr= 0;
- pis->cfra= 0;
- pis->version= 0;
- pis->instance_private_data = 0;
-
- /* clear the error list */
- PIL_dynlib_get_error_as_string(NULL);
-
- /* if(pis->handle) PIL_dynlib_close(pis->handle); */
- /* pis->handle= 0; */
-
- /* open the needed object */
- pis->handle= PIL_dynlib_open(pis->name);
- if(test_dlerr(pis->name, pis->name)) return;
-
- if (pis->handle != 0) {
- /* find the address of the version function */
- version= (int (*)())PIL_dynlib_find_symbol(pis->handle, "plugin_seq_getversion");
- if (test_dlerr(pis->name, "plugin_seq_getversion")) return;
-
- if (version != 0) {
- pis->version= version();
- if (pis->version >= 2 && pis->version <= 5) {
- int (*info_func)(PluginInfo *);
- PluginInfo *info= (PluginInfo*) MEM_mallocN(sizeof(PluginInfo), "plugin_info");
-
- info_func= (int (*)(PluginInfo *))PIL_dynlib_find_symbol(pis->handle, "plugin_getinfo");
-
- if(info_func == NULL) error("No info func");
- else {
- info_func(info);
-
- pis->pname= info->name;
- pis->vars= info->nvars;
- pis->cfra= info->cfra;
-
- pis->varstr= info->varstr;
-
- pis->doit= (void(*)(void))info->seq_doit;
- if (info->init)
- info->init();
- }
- MEM_freeN(info);
-
- cp= PIL_dynlib_find_symbol(pis->handle, "seqname");
- if(cp) strncpy(cp, seqname, 21);
- } else {
- printf ("Plugin returned unrecognized version number\n");
- return;
- }
- }
- alloc_private = (void* (*)())PIL_dynlib_find_symbol(
- pis->handle, "plugin_seq_alloc_private_data");
- if (alloc_private) {
- pis->instance_private_data = alloc_private();
- }
-
- pis->current_private_data = (void**)
- PIL_dynlib_find_symbol(
- pis->handle, "plugin_private_data");
- }
-}
-
-static PluginSeq *add_plugin_seq(const char *str, const char *seqname)
-{
- PluginSeq *pis;
- VarStruct *varstr;
- int a;
-
- pis= MEM_callocN(sizeof(PluginSeq), "PluginSeq");
-
- strncpy(pis->name, str, FILE_MAXDIR+FILE_MAXFILE);
- open_plugin_seq(pis, seqname);
-
- if(pis->doit==0) {
- if(pis->handle==0) error("no plugin: %s", str);
- else error("in plugin: %s", str);
- MEM_freeN(pis);
- return 0;
- }
-
- /* default values */
- varstr= pis->varstr;
- for(a=0; a<pis->vars; a++, varstr++) {
- if( (varstr->type & FLO)==FLO)
- pis->data[a]= varstr->def;
- else if( (varstr->type & INT)==INT)
- *((int *)(pis->data+a))= (int) varstr->def;
- }
-
- return pis;
-}
-
-static void free_plugin_seq(PluginSeq *pis)
-{
- if(pis==0) return;
-
- /* no PIL_dynlib_close: same plugin can be opened multiple times with 1 handle */
-
- if (pis->instance_private_data) {
- void (*free_private)(void *);
-
- free_private = (void (*)(void *))PIL_dynlib_find_symbol(
- pis->handle, "plugin_seq_free_private_data");
- if (free_private) {
- free_private(pis->instance_private_data);
- }
- }
-
- MEM_freeN(pis);
-}
-
-static void init_plugin(Sequence * seq, const char * fname)
-{
- seq->plugin= (PluginSeq *)add_plugin_seq(fname, seq->name+2);
-}
-
-/*
- * FIXME: should query plugin! Could be generator, that needs zero inputs...
- */
-static int num_inputs_plugin()
-{
- return 1;
-}
-
-static void load_plugin(Sequence * seq)
-{
- if (seq) {
- open_plugin_seq(seq->plugin, seq->name+2);
- }
-}
-
-static void copy_plugin(Sequence * dst, Sequence * src)
-{
- if(src->plugin) {
- dst->plugin= MEM_dupallocN(src->plugin);
- open_plugin_seq(dst->plugin, dst->name+2);
- }
-}
-
-static ImBuf * IMB_cast_away_list(ImBuf * i)
-{
- if (!i) {
- return 0;
- }
- return (ImBuf*) (((void**) i) + 2);
-}
-
-static void do_plugin_effect(Sequence * seq,int cfra,
- float facf0, float facf1, int x, int y,
- struct ImBuf *ibuf1, struct ImBuf *ibuf2,
- struct ImBuf *ibuf3, struct ImBuf *out)
-{
- char *cp;
- int float_rendering;
- int use_temp_bufs = 0; /* Are needed since blur.c (and maybe some other
- old plugins) do very bad stuff
- with imbuf-internals */
-
- if(seq->plugin && seq->plugin->doit) {
- if(seq->plugin->cfra)
- *(seq->plugin->cfra)= frame_to_float(cfra);
-
- cp = PIL_dynlib_find_symbol(
- seq->plugin->handle, "seqname");
-
- if(cp) strncpy(cp, seq->name+2, 22);
-
- if (seq->plugin->current_private_data) {
- *seq->plugin->current_private_data
- = seq->plugin->instance_private_data;
- }
-
- float_rendering = (out->rect_float != NULL);
-
- if (seq->plugin->version<=3 && float_rendering) {
- use_temp_bufs = 1;
-
- if (ibuf1) {
- ibuf1 = IMB_dupImBuf(ibuf1);
- IMB_rect_from_float(ibuf1);
- imb_freerectfloatImBuf(ibuf1);
- ibuf1->flags &= ~IB_rectfloat;
- }
- if (ibuf2) {
- ibuf2 = IMB_dupImBuf(ibuf2);
- IMB_rect_from_float(ibuf2);
- imb_freerectfloatImBuf(ibuf2);
- ibuf2->flags &= ~IB_rectfloat;
- }
- if (ibuf3) {
- ibuf3 = IMB_dupImBuf(ibuf3);
- IMB_rect_from_float(ibuf3);
- imb_freerectfloatImBuf(ibuf3);
- ibuf3->flags &= ~IB_rectfloat;
- }
- if (!out->rect) imb_addrectImBuf(out);
- imb_freerectfloatImBuf(out);
- out->flags &= ~IB_rectfloat;
- }
-
- if (seq->plugin->version<=2) {
- if(ibuf1) IMB_convert_rgba_to_abgr(ibuf1);
- if(ibuf2) IMB_convert_rgba_to_abgr(ibuf2);
- if(ibuf3) IMB_convert_rgba_to_abgr(ibuf3);
- }
-
- if (seq->plugin->version<=4) {
- ((SeqDoit)seq->plugin->doit)(
- seq->plugin->data, facf0, facf1, x, y,
- IMB_cast_away_list(ibuf1),
- IMB_cast_away_list(ibuf2),
- IMB_cast_away_list(out),
- IMB_cast_away_list(ibuf3));
- } else {
- ((SeqDoit)seq->plugin->doit)(
- seq->plugin->data, facf0, facf1, x, y,
- ibuf1, ibuf2, out, ibuf3);
- }
-
- if (seq->plugin->version<=2) {
- if (!use_temp_bufs) {
- if(ibuf1) IMB_convert_rgba_to_abgr(ibuf1);
- if(ibuf2) IMB_convert_rgba_to_abgr(ibuf2);
- if(ibuf3) IMB_convert_rgba_to_abgr(ibuf3);
- }
- IMB_convert_rgba_to_abgr(out);
- }
- if (seq->plugin->version<=3 && float_rendering) {
- IMB_float_from_rect(out);
- }
-
- if (use_temp_bufs) {
- if (ibuf1) IMB_freeImBuf(ibuf1);
- if (ibuf2) IMB_freeImBuf(ibuf2);
- if (ibuf3) IMB_freeImBuf(ibuf3);
- }
- }
-}
-
-static int do_plugin_early_out(struct Sequence *seq,
- float facf0, float facf1)
-{
- return 0;
-}
-
-static void free_plugin(struct Sequence * seq)
-{
- free_plugin_seq(seq->plugin);
- seq->plugin = 0;
-}
-
-/* **********************************************************************
- ALPHA OVER
- ********************************************************************** */
-
-static void init_alpha_over_or_under(Sequence * seq)
-{
- Sequence * seq1 = seq->seq1;
- Sequence * seq2 = seq->seq2;
-
- seq->seq2= seq1;
- seq->seq1= seq2;
-}
-
-static void do_alphaover_effect_byte(float facf0, float facf1, int x, int y,
- char * rect1, char *rect2, char *out)
-{
- int fac2, mfac, fac, fac4;
- int xo, tempc;
- char *rt1, *rt2, *rt;
-
- xo= x;
- rt1= (char *)rect1;
- rt2= (char *)rect2;
- rt= (char *)out;
-
- fac2= (int)(256.0*facf0);
- fac4= (int)(256.0*facf1);
-
- while(y--) {
-
- x= xo;
- while(x--) {
-
- /* rt = rt1 over rt2 (alpha from rt1) */
-
- fac= fac2;
- mfac= 256 - ( (fac2*rt1[3])>>8 );
-
- if(fac==0) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
- else if(mfac==0) *( (unsigned int *)rt) = *( (unsigned int *)rt1);
- else {
- tempc= ( fac*rt1[0] + mfac*rt2[0])>>8;
- if(tempc>255) rt[0]= 255; else rt[0]= tempc;
- tempc= ( fac*rt1[1] + mfac*rt2[1])>>8;
- if(tempc>255) rt[1]= 255; else rt[1]= tempc;
- tempc= ( fac*rt1[2] + mfac*rt2[2])>>8;
- if(tempc>255) rt[2]= 255; else rt[2]= tempc;
- tempc= ( fac*rt1[3] + mfac*rt2[3])>>8;
- if(tempc>255) rt[3]= 255; else rt[3]= tempc;
- }
- rt1+= 4; rt2+= 4; rt+= 4;
- }
-
- if(y==0) break;
- y--;
-
- x= xo;
- while(x--) {
-
- fac= fac4;
- mfac= 256 - ( (fac4*rt1[3])>>8 );
-
- if(fac==0) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
- else if(mfac==0) *( (unsigned int *)rt) = *( (unsigned int *)rt1);
- else {
- tempc= ( fac*rt1[0] + mfac*rt2[0])>>8;
- if(tempc>255) rt[0]= 255; else rt[0]= tempc;
- tempc= ( fac*rt1[1] + mfac*rt2[1])>>8;
- if(tempc>255) rt[1]= 255; else rt[1]= tempc;
- tempc= ( fac*rt1[2] + mfac*rt2[2])>>8;
- if(tempc>255) rt[2]= 255; else rt[2]= tempc;
- tempc= ( fac*rt1[3] + mfac*rt2[3])>>8;
- if(tempc>255) rt[3]= 255; else rt[3]= tempc;
- }
- rt1+= 4; rt2+= 4; rt+= 4;
- }
- }
-}
-
-static void do_alphaover_effect_float(float facf0, float facf1, int x, int y,
- float * rect1, float *rect2, float *out)
-{
- float fac2, mfac, fac, fac4;
- int xo;
- float *rt1, *rt2, *rt;
-
- xo= x;
- rt1= rect1;
- rt2= rect2;
- rt= out;
-
- fac2= facf0;
- fac4= facf1;
-
- while(y--) {
-
- x= xo;
- while(x--) {
-
- /* rt = rt1 over rt2 (alpha from rt1) */
-
- fac= fac2;
- mfac= 1.0 - (fac2*rt1[3]) ;
-
- if(fac <= 0.0) {
- memcpy(rt, rt2, 4 * sizeof(float));
- } else if(mfac <=0) {
- memcpy(rt, rt1, 4 * sizeof(float));
- } else {
- rt[0] = fac*rt1[0] + mfac*rt2[0];
- rt[1] = fac*rt1[1] + mfac*rt2[1];
- rt[2] = fac*rt1[2] + mfac*rt2[2];
- rt[3] = fac*rt1[3] + mfac*rt2[3];
- }
- rt1+= 4; rt2+= 4; rt+= 4;
- }
-
- if(y==0) break;
- y--;
-
- x= xo;
- while(x--) {
-
- fac= fac4;
- mfac= 1.0 - (fac4*rt1[3]);
-
- if(fac <= 0.0) {
- memcpy(rt, rt2, 4 * sizeof(float));
- } else if(mfac <= 0.0) {
- memcpy(rt, rt1, 4 * sizeof(float));
- } else {
- rt[0] = fac*rt1[0] + mfac*rt2[0];
- rt[1] = fac*rt1[1] + mfac*rt2[1];
- rt[2] = fac*rt1[2] + mfac*rt2[2];
- rt[3] = fac*rt1[3] + mfac*rt2[3];
- }
- rt1+= 4; rt2+= 4; rt+= 4;
- }
- }
-}
-
-static void do_alphaover_effect(Sequence * seq,int cfra,
- float facf0, float facf1, int x, int y,
- struct ImBuf *ibuf1, struct ImBuf *ibuf2,
- struct ImBuf *ibuf3, struct ImBuf *out)
-{
- if (out->rect_float) {
- do_alphaover_effect_float(
- facf0, facf1, x, y,
- ibuf1->rect_float, ibuf2->rect_float,
- out->rect_float);
- } else {
- do_alphaover_effect_byte(
- facf0, facf1, x, y,
- (char*) ibuf1->rect, (char*) ibuf2->rect,
- (char*) out->rect);
- }
-}
-
-
-/* **********************************************************************
- ALPHA UNDER
- ********************************************************************** */
-
-void do_alphaunder_effect_byte(
- float facf0, float facf1, int x, int y, char *rect1,
- char *rect2, char *out)
-{
- int fac2, mfac, fac, fac4;
- int xo;
- char *rt1, *rt2, *rt;
-
- xo= x;
- rt1= rect1;
- rt2= rect2;
- rt= out;
-
- fac2= (int)(256.0*facf0);
- fac4= (int)(256.0*facf1);
-
- while(y--) {
-
- x= xo;
- while(x--) {
-
- /* rt = rt1 under rt2 (alpha from rt2) */
-
- /* this complex optimalisation is because the
- * 'skybuf' can be crossed in
- */
- if(rt2[3]==0 && fac2==256) *( (unsigned int *)rt) = *( (unsigned int *)rt1);
- else if(rt2[3]==255) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
- else {
- mfac= rt2[3];
- fac= (fac2*(256-mfac))>>8;
-
- if(fac==0) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
- else {
- rt[0]= ( fac*rt1[0] + mfac*rt2[0])>>8;
- rt[1]= ( fac*rt1[1] + mfac*rt2[1])>>8;
- rt[2]= ( fac*rt1[2] + mfac*rt2[2])>>8;
- rt[3]= ( fac*rt1[3] + mfac*rt2[3])>>8;
- }
- }
- rt1+= 4; rt2+= 4; rt+= 4;
- }
-
- if(y==0) break;
- y--;
-
- x= xo;
- while(x--) {
-
- if(rt2[3]==0 && fac4==256) *( (unsigned int *)rt) = *( (unsigned int *)rt1);
- else if(rt2[3]==255) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
- else {
- mfac= rt2[3];
- fac= (fac4*(256-mfac))>>8;
-
- if(fac==0) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
- else {
- rt[0]= ( fac*rt1[0] + mfac*rt2[0])>>8;
- rt[1]= ( fac*rt1[1] + mfac*rt2[1])>>8;
- rt[2]= ( fac*rt1[2] + mfac*rt2[2])>>8;
- rt[3]= ( fac*rt1[3] + mfac*rt2[3])>>8;
- }
- }
- rt1+= 4; rt2+= 4; rt+= 4;
- }
- }
-}
-
-
-static void do_alphaunder_effect_float(float facf0, float facf1, int x, int y,
- float *rect1, float *rect2,
- float *out)
-{
- float fac2, mfac, fac, fac4;
- int xo;
- float *rt1, *rt2, *rt;
-
- xo= x;
- rt1= rect1;
- rt2= rect2;
- rt= out;
-
- fac2= facf0;
- fac4= facf1;
-
- while(y--) {
-
- x= xo;
- while(x--) {
-
- /* rt = rt1 under rt2 (alpha from rt2) */
-
- /* this complex optimalisation is because the
- * 'skybuf' can be crossed in
- */
- if( rt2[3]<=0 && fac2>=1.0) {
- memcpy(rt, rt1, 4 * sizeof(float));
- } else if(rt2[3]>=1.0) {
- memcpy(rt, rt2, 4 * sizeof(float));
- } else {
- mfac = rt2[3];
- fac = fac2 * (1.0 - mfac);
-
- if(fac == 0) {
- memcpy(rt, rt2, 4 * sizeof(float));
- } else {
- rt[0]= fac*rt1[0] + mfac*rt2[0];
- rt[1]= fac*rt1[1] + mfac*rt2[1];
- rt[2]= fac*rt1[2] + mfac*rt2[2];
- rt[3]= fac*rt1[3] + mfac*rt2[3];
- }
- }
- rt1+= 4; rt2+= 4; rt+= 4;
- }
-
- if(y==0) break;
- y--;
-
- x= xo;
- while(x--) {
-
- if(rt2[3]<=0 && fac4 >= 1.0) {
- memcpy(rt, rt1, 4 * sizeof(float));
-
- } else if(rt2[3]>=1.0) {
- memcpy(rt, rt2, 4 * sizeof(float));
- } else {
- mfac= rt2[3];
- fac= fac4*(1.0-mfac);
-
- if(fac == 0) {
- memcpy(rt, rt2, 4 * sizeof(float));
- } else {
- rt[0]= fac * rt1[0] + mfac * rt2[0];
- rt[1]= fac * rt1[1] + mfac * rt2[1];
- rt[2]= fac * rt1[2] + mfac * rt2[2];
- rt[3]= fac * rt1[3] + mfac * rt2[3];
- }
- }
- rt1+= 4; rt2+= 4; rt+= 4;
- }
- }
-}
-
-static void do_alphaunder_effect(Sequence * seq,int cfra,
- float facf0, float facf1, int x, int y,
- struct ImBuf *ibuf1, struct ImBuf *ibuf2,
- struct ImBuf *ibuf3, struct ImBuf *out)
-{
- if (out->rect_float) {
- do_alphaunder_effect_float(
- facf0, facf1, x, y,
- ibuf1->rect_float, ibuf2->rect_float,
- out->rect_float);
- } else {
- do_alphaunder_effect_byte(
- facf0, facf1, x, y,
- (char*) ibuf1->rect, (char*) ibuf2->rect,
- (char*) out->rect);
- }
-}
-
-
-/* **********************************************************************
- CROSS
- ********************************************************************** */
-
-void do_cross_effect_byte(float facf0, float facf1, int x, int y,
- char *rect1, char *rect2,
- char *out)
-{
- int fac1, fac2, fac3, fac4;
- int xo;
- char *rt1, *rt2, *rt;
-
- xo= x;
- rt1= rect1;
- rt2= rect2;
- rt= out;
-
- fac2= (int)(256.0*facf0);
- fac1= 256-fac2;
- fac4= (int)(256.0*facf1);
- fac3= 256-fac4;
-
- while(y--) {
-
- x= xo;
- while(x--) {
-
- rt[0]= (fac1*rt1[0] + fac2*rt2[0])>>8;
- rt[1]= (fac1*rt1[1] + fac2*rt2[1])>>8;
- rt[2]= (fac1*rt1[2] + fac2*rt2[2])>>8;
- rt[3]= (fac1*rt1[3] + fac2*rt2[3])>>8;
-
- rt1+= 4; rt2+= 4; rt+= 4;
- }
-
- if(y==0) break;
- y--;
-
- x= xo;
- while(x--) {
-
- rt[0]= (fac3*rt1[0] + fac4*rt2[0])>>8;
- rt[1]= (fac3*rt1[1] + fac4*rt2[1])>>8;
- rt[2]= (fac3*rt1[2] + fac4*rt2[2])>>8;
- rt[3]= (fac3*rt1[3] + fac4*rt2[3])>>8;
-
- rt1+= 4; rt2+= 4; rt+= 4;
- }
-
- }
-}
-
-void do_cross_effect_float(float facf0, float facf1, int x, int y,
- float *rect1, float *rect2, float *out)
-{
- float fac1, fac2, fac3, fac4;
- int xo;
- float *rt1, *rt2, *rt;
-
- xo= x;
- rt1= rect1;
- rt2= rect2;
- rt= out;
-
- fac2= facf0;
- fac1= 1.0 - fac2;
- fac4= facf1;
- fac3= 1.0 - fac4;
-
- while(y--) {
-
- x= xo;
- while(x--) {
-
- rt[0]= fac1*rt1[0] + fac2*rt2[0];
- rt[1]= fac1*rt1[1] + fac2*rt2[1];
- rt[2]= fac1*rt1[2] + fac2*rt2[2];
- rt[3]= fac1*rt1[3] + fac2*rt2[3];
-
- rt1+= 4; rt2+= 4; rt+= 4;
- }
-
- if(y==0) break;
- y--;
-
- x= xo;
- while(x--) {
-
- rt[0]= fac3*rt1[0] + fac4*rt2[0];
- rt[1]= fac3*rt1[1] + fac4*rt2[1];
- rt[2]= fac3*rt1[2] + fac4*rt2[2];
- rt[3]= fac3*rt1[3] + fac4*rt2[3];
-
- rt1+= 4; rt2+= 4; rt+= 4;
- }
-
- }
-}
-
-/* carefull: also used by speed effect! */
-
-static void do_cross_effect(Sequence * seq,int cfra,
- float facf0, float facf1, int x, int y,
- struct ImBuf *ibuf1, struct ImBuf *ibuf2,
- struct ImBuf *ibuf3, struct ImBuf *out)
-{
- if (out->rect_float) {
- do_cross_effect_float(
- facf0, facf1, x, y,
- ibuf1->rect_float, ibuf2->rect_float,
- out->rect_float);
- } else {
- do_cross_effect_byte(
- facf0, facf1, x, y,
- (char*) ibuf1->rect, (char*) ibuf2->rect,
- (char*) out->rect);
- }
-}
-
-
-/* **********************************************************************
- GAMMA CROSS
- ********************************************************************** */
-
-/* copied code from initrender.c */
-static unsigned short *gamtab = 0;
-static unsigned short *igamtab1 = 0;
-static int gamma_tabs_refcount = 0;
-
-#define RE_GAMMA_TABLE_SIZE 400
-
-static float gamma_range_table[RE_GAMMA_TABLE_SIZE + 1];
-static float gamfactor_table[RE_GAMMA_TABLE_SIZE];
-static float inv_gamma_range_table[RE_GAMMA_TABLE_SIZE + 1];
-static float inv_gamfactor_table[RE_GAMMA_TABLE_SIZE];
-static float color_domain_table[RE_GAMMA_TABLE_SIZE + 1];
-static float color_step;
-static float inv_color_step;
-static float valid_gamma;
-static float valid_inv_gamma;
-
-static void makeGammaTables(float gamma)
-{
- /* we need two tables: one forward, one backward */
- int i;
-
- valid_gamma = gamma;
- valid_inv_gamma = 1.0 / gamma;
- color_step = 1.0 / RE_GAMMA_TABLE_SIZE;
- inv_color_step = (float) RE_GAMMA_TABLE_SIZE;
-
- /* We could squeeze out the two range tables to gain some memory. */
- for (i = 0; i < RE_GAMMA_TABLE_SIZE; i++) {
- color_domain_table[i] = i * color_step;
- gamma_range_table[i] = pow(color_domain_table[i],
- valid_gamma);
- inv_gamma_range_table[i] = pow(color_domain_table[i],
- valid_inv_gamma);
- }
-
- /* The end of the table should match 1.0 carefully. In order to avoid */
- /* rounding errors, we just set this explicitly. The last segment may */
- /* have a different lenght than the other segments, but our */
- /* interpolation is insensitive to that. */
- color_domain_table[RE_GAMMA_TABLE_SIZE] = 1.0;
- gamma_range_table[RE_GAMMA_TABLE_SIZE] = 1.0;
- inv_gamma_range_table[RE_GAMMA_TABLE_SIZE] = 1.0;
-
- /* To speed up calculations, we make these calc factor tables. They are */
- /* multiplication factors used in scaling the interpolation. */
- for (i = 0; i < RE_GAMMA_TABLE_SIZE; i++ ) {
- gamfactor_table[i] = inv_color_step
- * (gamma_range_table[i + 1] - gamma_range_table[i]) ;
- inv_gamfactor_table[i] = inv_color_step
- * (inv_gamma_range_table[i + 1] - inv_gamma_range_table[i]) ;
- }
-
-} /* end of void makeGammaTables(float gamma) */
-
-
-static float gammaCorrect(float c)
-{
- int i;
- float res = 0.0;
-
- i = floor(c * inv_color_step);
- /* Clip to range [0,1]: outside, just do the complete calculation. */
- /* We may have some performance problems here. Stretching up the LUT */
- /* may help solve that, by exchanging LUT size for the interpolation. */
- /* Negative colors are explicitly handled. */
- if (i < 0) res = -pow(abs(c), valid_gamma);
- else if (i >= RE_GAMMA_TABLE_SIZE ) res = pow(c, valid_gamma);
- else res = gamma_range_table[i] +
- ( (c - color_domain_table[i]) * gamfactor_table[i]);
-
- return res;
-} /* end of float gammaCorrect(float col) */
-
-/* ------------------------------------------------------------------------- */
-
-static float invGammaCorrect(float col)
-{
- int i;
- float res = 0.0;
-
- i = floor(col*inv_color_step);
- /* Negative colors are explicitly handled. */
- if (i < 0) res = -pow(abs(col), valid_inv_gamma);
- else if (i >= RE_GAMMA_TABLE_SIZE) res = pow(col, valid_inv_gamma);
- else res = inv_gamma_range_table[i] +
- ( (col - color_domain_table[i]) * inv_gamfactor_table[i]);
-
- return res;
-} /* end of float invGammaCorrect(float col) */
-
-
-static void gamtabs(float gamma)
-{
- float val, igamma= 1.0f/gamma;
- int a;
-
- gamtab= MEM_mallocN(65536*sizeof(short), "initGaus2");
- igamtab1= MEM_mallocN(256*sizeof(short), "initGaus2");
-
- /* gamtab: in short, out short */
- for(a=0; a<65536; a++) {
- val= a;
- val/= 65535.0;
-
- if(gamma==2.0) val= sqrt(val);
- else if(gamma!=1.0) val= pow(val, igamma);
-
- gamtab[a]= (65535.99*val);
- }
- /* inverse gamtab1 : in byte, out short */
- for(a=1; a<=256; a++) {
- if(gamma==2.0) igamtab1[a-1]= a*a-1;
- else if(gamma==1.0) igamtab1[a-1]= 256*a-1;
- else {
- val= a/256.0;
- igamtab1[a-1]= (65535.0*pow(val, gamma)) -1 ;
- }
- }
-
-}
-
-static void alloc_or_ref_gammatabs()
-{
- if (gamma_tabs_refcount == 0) {
- gamtabs(2.0f);
- makeGammaTables(2.0f);
- }
- gamma_tabs_refcount++;
-}
-
-static void init_gammacross(Sequence * seq)
-{
- alloc_or_ref_gammatabs();
-}
-
-static void load_gammacross(Sequence * seq)
-{
- alloc_or_ref_gammatabs();
-}
-
-static void free_gammacross(Sequence * seq)
-{
- if (--gamma_tabs_refcount == 0) {
- MEM_freeN(gamtab);
- MEM_freeN(igamtab1);
- gamtab = 0;
- igamtab1 = 0;
- }
- if (gamma_tabs_refcount < 0) {
- fprintf(stderr, "seqeffects: free_gammacross double free!\n");
- }
-}
-
-static void do_gammacross_effect_byte(float facf0, float facf1,
- int x, int y,
- char *rect1,
- char *rect2,
- char *out)
-{
- int fac1, fac2, col;
- int xo;
- char *rt1, *rt2, *rt;
-
- xo= x;
- rt1= (char *)rect1;
- rt2= (char *)rect2;
- rt= (char *)out;
-
- fac2= (int)(256.0*facf0);
- fac1= 256-fac2;
-
- while(y--) {
-
- x= xo;
- while(x--) {
-
- col= (fac1*igamtab1[rt1[0]] + fac2*igamtab1[rt2[0]])>>8;
- if(col>65535) rt[0]= 255; else rt[0]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
- col=(fac1*igamtab1[rt1[1]] + fac2*igamtab1[rt2[1]])>>8;
- if(col>65535) rt[1]= 255; else rt[1]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
- col= (fac1*igamtab1[rt1[2]] + fac2*igamtab1[rt2[2]])>>8;
- if(col>65535) rt[2]= 255; else rt[2]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
- col= (fac1*igamtab1[rt1[3]] + fac2*igamtab1[rt2[3]])>>8;
- if(col>65535) rt[3]= 255; else rt[3]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
-
- rt1+= 4; rt2+= 4; rt+= 4;
- }
-
- if(y==0) break;
- y--;
-
- x= xo;
- while(x--) {
-
- col= (fac1*igamtab1[rt1[0]] + fac2*igamtab1[rt2[0]])>>8;
- if(col>65535) rt[0]= 255; else rt[0]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
- col= (fac1*igamtab1[rt1[1]] + fac2*igamtab1[rt2[1]])>>8;
- if(col>65535) rt[1]= 255; else rt[1]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
- col= (fac1*igamtab1[rt1[2]] + fac2*igamtab1[rt2[2]])>>8;
- if(col>65535) rt[2]= 255; else rt[2]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
- col= (fac1*igamtab1[rt1[3]] + fac2*igamtab1[rt2[3]])>>8;
- if(col>65535) rt[3]= 255; else rt[3]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
-
- rt1+= 4; rt2+= 4; rt+= 4;
- }
- }
-
-}
-
-static void do_gammacross_effect_float(float facf0, float facf1,
- int x, int y,
- float *rect1, float *rect2,
- float *out)
-{
- float fac1, fac2, col;
- int xo;
- float *rt1, *rt2, *rt;
-
- xo= x;
- rt1= rect1;
- rt2= rect2;
- rt= out;
-
- fac2= facf0;
- fac1= 1.0 - fac2;
-
- while(y--) {
-
- x= xo * 4;
- while(x--) {
-
- *rt= gammaCorrect(
- fac1 * invGammaCorrect(*rt1)
- + fac2 * invGammaCorrect(*rt2));
- rt1++; rt2++; rt++;
- }
-
- if(y==0) break;
- y--;
-
- x= xo * 4;
- while(x--) {
-
- col= gammaCorrect(
- fac1*invGammaCorrect(*rt1)
- + fac2*invGammaCorrect(*rt2));
-
- rt1++; rt2++; rt++;
- }
- }
-}
-
-static void do_gammacross_effect(Sequence * seq,int cfra,
- float facf0, float facf1, int x, int y,
- struct ImBuf *ibuf1, struct ImBuf *ibuf2,
- struct ImBuf *ibuf3, struct ImBuf *out)
-{
- if (out->rect_float) {
- do_gammacross_effect_float(
- facf0, facf1, x, y,
- ibuf1->rect_float, ibuf2->rect_float,
- out->rect_float);
- } else {
- do_gammacross_effect_byte(
- facf0, facf1, x, y,
- (char*) ibuf1->rect, (char*) ibuf2->rect,
- (char*) out->rect);
- }
-}
-
-
-/* **********************************************************************
- ADD
- ********************************************************************** */
-
-static void do_add_effect_byte(float facf0, float facf1, int x, int y,
- unsigned char *rect1, unsigned char *rect2,
- unsigned char *out)
-{
- int col, xo, fac1, fac3;
- char *rt1, *rt2, *rt;
-
- xo= x;
- rt1= (char *)rect1;
- rt2= (char *)rect2;
- rt= (char *)out;
-
- fac1= (int)(256.0*facf0);
- fac3= (int)(256.0*facf1);
-
- while(y--) {
-
- x= xo;
- while(x--) {
-
- col= rt1[0]+ ((fac1*rt2[0])>>8);
- if(col>255) rt[0]= 255; else rt[0]= col;
- col= rt1[1]+ ((fac1*rt2[1])>>8);
- if(col>255) rt[1]= 255; else rt[1]= col;
- col= rt1[2]+ ((fac1*rt2[2])>>8);
- if(col>255) rt[2]= 255; else rt[2]= col;
- col= rt1[3]+ ((fac1*rt2[3])>>8);
- if(col>255) rt[3]= 255; else rt[3]= col;
-
- rt1+= 4; rt2+= 4; rt+= 4;
- }
-
- if(y==0) break;
- y--;
-
- x= xo;
- while(x--) {
-
- col= rt1[0]+ ((fac3*rt2[0])>>8);
- if(col>255) rt[0]= 255; else rt[0]= col;
- col= rt1[1]+ ((fac3*rt2[1])>>8);
- if(col>255) rt[1]= 255; else rt[1]= col;
- col= rt1[2]+ ((fac3*rt2[2])>>8);
- if(col>255) rt[2]= 255; else rt[2]= col;
- col= rt1[3]+ ((fac3*rt2[3])>>8);
- if(col>255) rt[3]= 255; else rt[3]= col;
-
- rt1+= 4; rt2+= 4; rt+= 4;
- }
- }
-}
-
-static void do_add_effect_float(float facf0, float facf1, int x, int y,
- float *rect1, float *rect2,
- float *out)
-{
- int xo;
- float fac1, fac3;
- float *rt1, *rt2, *rt;
-
- xo= x;
- rt1= rect1;
- rt2= rect2;
- rt= out;
-
- fac1= facf0;
- fac3= facf1;
-
- while(y--) {
-
- x= xo * 4;
- while(x--) {
- *rt = *rt1 + fac1 * (*rt2);
-
- rt1++; rt2++; rt++;
- }
-
- if(y==0) break;
- y--;
-
- x= xo * 4;
- while(x--) {
- *rt = *rt1 + fac3 * (*rt2);
-
- rt1++; rt2++; rt++;
- }
- }
-}
-
-static void do_add_effect(Sequence * seq,int cfra,
- float facf0, float facf1, int x, int y,
- struct ImBuf *ibuf1, struct ImBuf *ibuf2,
- struct ImBuf *ibuf3, struct ImBuf *out)
-{
- if (out->rect_float) {
- do_add_effect_float(
- facf0, facf1, x, y,
- ibuf1->rect_float, ibuf2->rect_float,
- out->rect_float);
- } else {
- do_add_effect_byte(
- facf0, facf1, x, y,
- (unsigned char*) ibuf1->rect, (unsigned char*) ibuf2->rect,
- (unsigned char*) out->rect);
- }
-}
-
-
-/* **********************************************************************
- SUB
- ********************************************************************** */
-
-static void do_sub_effect_byte(float facf0, float facf1,
- int x, int y,
- char *rect1, char *rect2, char *out)
-{
- int col, xo, fac1, fac3;
- char *rt1, *rt2, *rt;
-
- xo= x;
- rt1= (char *)rect1;
- rt2= (char *)rect2;
- rt= (char *)out;
-
- fac1= (int)(256.0*facf0);
- fac3= (int)(256.0*facf1);
-
- while(y--) {
-
- x= xo;
- while(x--) {
-
- col= rt1[0]- ((fac1*rt2[0])>>8);
- if(col<0) rt[0]= 0; else rt[0]= col;
- col= rt1[1]- ((fac1*rt2[1])>>8);
- if(col<0) rt[1]= 0; else rt[1]= col;
- col= rt1[2]- ((fac1*rt2[2])>>8);
- if(col<0) rt[2]= 0; else rt[2]= col;
- col= rt1[3]- ((fac1*rt2[3])>>8);
- if(col<0) rt[3]= 0; else rt[3]= col;
-
- rt1+= 4; rt2+= 4; rt+= 4;
- }
-
- if(y==0) break;
- y--;
-
- x= xo;
- while(x--) {
-
- col= rt1[0]- ((fac3*rt2[0])>>8);
- if(col<0) rt[0]= 0; else rt[0]= col;
- col= rt1[1]- ((fac3*rt2[1])>>8);
- if(col<0) rt[1]= 0; else rt[1]= col;
- col= rt1[2]- ((fac3*rt2[2])>>8);
- if(col<0) rt[2]= 0; else rt[2]= col;
- col= rt1[3]- ((fac3*rt2[3])>>8);
- if(col<0) rt[3]= 0; else rt[3]= col;
-
- rt1+= 4; rt2+= 4; rt+= 4;
- }
- }
-}
-
-static void do_sub_effect_float(float facf0, float facf1, int x, int y,
- float *rect1, float *rect2,
- float *out)
-{
- int xo;
- float fac1, fac3;
- float *rt1, *rt2, *rt;
-
- xo= x;
- rt1= rect1;
- rt2= rect2;
- rt= out;
-
- fac1= facf0;
- fac3= facf1;
-
- while(y--) {
-
- x= xo * 4;
- while(x--) {
- *rt = *rt1 - fac1 * (*rt2);
-
- rt1++; rt2++; rt++;
- }
-
- if(y==0) break;
- y--;
-
- x= xo * 4;
- while(x--) {
- *rt = *rt1 - fac3 * (*rt2);
-
- rt1++; rt2++; rt++;
- }
- }
-}
-
-static void do_sub_effect(Sequence * seq,int cfra,
- float facf0, float facf1, int x, int y,
- struct ImBuf *ibuf1, struct ImBuf *ibuf2,
- struct ImBuf *ibuf3, struct ImBuf *out)
-{
- if (out->rect_float) {
- do_sub_effect_float(
- facf0, facf1, x, y,
- ibuf1->rect_float, ibuf2->rect_float,
- out->rect_float);
- } else {
- do_sub_effect_byte(
- facf0, facf1, x, y,
- (char*) ibuf1->rect, (char*) ibuf2->rect,
- (char*) out->rect);
- }
-}
-
-/* **********************************************************************
- DROP
- ********************************************************************** */
-
-/* Must be > 0 or add precopy, etc to the function */
-#define XOFF 8
-#define YOFF 8
-
-static void do_drop_effect_byte(float facf0, float facf1, int x, int y,
- unsigned char *rect2i, unsigned char *rect1i,
- unsigned char *outi)
-{
- int height, width, temp, fac, fac1, fac2;
- char *rt1, *rt2, *out;
- int field= 1;
-
- width= x;
- height= y;
-
- fac1= (int)(70.0*facf0);
- fac2= (int)(70.0*facf1);
-
- rt2= (char*) (rect2i + YOFF*width);
- rt1= (char*) rect1i;
- out= (char*) outi;
- for (y=0; y<height-YOFF; y++) {
- if(field) fac= fac1;
- else fac= fac2;
- field= !field;
-
- memcpy(out, rt1, sizeof(int)*XOFF);
- rt1+= XOFF*4;
- out+= XOFF*4;
-
- for (x=XOFF; x<width; x++) {
- temp= ((fac*rt2[3])>>8);
-
- *(out++)= MAX2(0, *rt1 - temp); rt1++;
- *(out++)= MAX2(0, *rt1 - temp); rt1++;
- *(out++)= MAX2(0, *rt1 - temp); rt1++;
- *(out++)= MAX2(0, *rt1 - temp); rt1++;
- rt2+=4;
- }
- rt2+=XOFF*4;
- }
- memcpy(out, rt1, sizeof(int)*YOFF*width);
-}
-
-static void do_drop_effect_float(float facf0, float facf1, int x, int y,
- float *rect2i, float *rect1i,
- float *outi)
-{
- int height, width;
- float temp, fac, fac1, fac2;
- float *rt1, *rt2, *out;
- int field= 1;
-
- width= x;
- height= y;
-
- fac1= 70.0*facf0;
- fac2= 70.0*facf1;
-
- rt2= (rect2i + YOFF*width);
- rt1= rect1i;
- out= outi;
- for (y=0; y<height-YOFF; y++) {
- if(field) fac= fac1;
- else fac= fac2;
- field= !field;
-
- memcpy(out, rt1, 4 * sizeof(float)*XOFF);
- rt1+= XOFF*4;
- out+= XOFF*4;
-
- for (x=XOFF; x<width; x++) {
- temp= fac * rt2[3];
-
- *(out++)= MAX2(0.0, *rt1 - temp); rt1++;
- *(out++)= MAX2(0.0, *rt1 - temp); rt1++;
- *(out++)= MAX2(0.0, *rt1 - temp); rt1++;
- *(out++)= MAX2(0.0, *rt1 - temp); rt1++;
- rt2+=4;
- }
- rt2+=XOFF*4;
- }
- memcpy(out, rt1, 4 * sizeof(float)*YOFF*width);
-}
-
-
-static void do_drop_effect(Sequence * seq,int cfra,
- float facf0, float facf1, int x, int y,
- struct ImBuf *ibuf1, struct ImBuf *ibuf2,
- struct ImBuf * ibuf3,
- struct ImBuf *out)
-{
- if (out->rect_float) {
- do_drop_effect_float(
- facf0, facf1, x, y,
- ibuf1->rect_float, ibuf2->rect_float,
- out->rect_float);
- } else {
- do_drop_effect_byte(
- facf0, facf1, x, y,
- (unsigned char*) ibuf1->rect, (unsigned char*) ibuf2->rect,
- (unsigned char*) out->rect);
- }
-}
-
-/* **********************************************************************
- MUL
- ********************************************************************** */
-
-static void do_mul_effect_byte(float facf0, float facf1, int x, int y,
- unsigned char *rect1, unsigned char *rect2,
- unsigned char *out)
-{
- int xo, fac1, fac3;
- char *rt1, *rt2, *rt;
-
- xo= x;
- rt1= (char *)rect1;
- rt2= (char *)rect2;
- rt= (char *)out;
-
- fac1= (int)(256.0*facf0);
- fac3= (int)(256.0*facf1);
-
- /* formula:
- * fac*(a*b) + (1-fac)*a => fac*a*(b-1)+axaux= c*px + py*s ;//+centx
- yaux= -s*px + c*py;//+centy
- */
-
- while(y--) {
-
- x= xo;
- while(x--) {
-
- rt[0]= rt1[0] + ((fac1*rt1[0]*(rt2[0]-256))>>16);
- rt[1]= rt1[1] + ((fac1*rt1[1]*(rt2[1]-256))>>16);
- rt[2]= rt1[2] + ((fac1*rt1[2]*(rt2[2]-256))>>16);
- rt[3]= rt1[3] + ((fac1*rt1[3]*(rt2[3]-256))>>16);
-
- rt1+= 4; rt2+= 4; rt+= 4;
- }
-
- if(y==0) break;
- y--;
-
- x= xo;
- while(x--) {
-
- rt[0]= rt1[0] + ((fac3*rt1[0]*(rt2[0]-256))>>16);
- rt[1]= rt1[1] + ((fac3*rt1[1]*(rt2[1]-256))>>16);
- rt[2]= rt1[2] + ((fac3*rt1[2]*(rt2[2]-256))>>16);
- rt[3]= rt1[3] + ((fac3*rt1[3]*(rt2[3]-256))>>16);
-
- rt1+= 4; rt2+= 4; rt+= 4;
- }
- }
-}
-
-static void do_mul_effect_float(float facf0, float facf1, int x, int y,
- float *rect1, float *rect2,
- float *out)
-{
- int xo;
- float fac1, fac3;
- float *rt1, *rt2, *rt;
-
- xo= x;
- rt1= rect1;
- rt2= rect2;
- rt= out;
-
- fac1= facf0;
- fac3= facf1;
-
- /* formula:
- * fac*(a*b) + (1-fac)*a => fac*a*(b-1)+a
- */
-
- while(y--) {
-
- x= xo;
- while(x--) {
-
- rt[0]= rt1[0] + fac1*rt1[0]*(rt2[0]-1.0);
- rt[1]= rt1[1] + fac1*rt1[1]*(rt2[1]-1.0);
- rt[2]= rt1[2] + fac1*rt1[2]*(rt2[2]-1.0);
- rt[3]= rt1[3] + fac1*rt1[3]*(rt2[3]-1.0);
-
- rt1+= 4; rt2+= 4; rt+= 4;
- }
-
- if(y==0) break;
- y--;
-
- x= xo;
- while(x--) {
-
- rt[0]= rt1[0] + fac3*rt1[0]*(rt2[0]-1.0);
- rt[1]= rt1[1] + fac3*rt1[1]*(rt2[1]-1.0);
- rt[2]= rt1[2] + fac3*rt1[2]*(rt2[2]-1.0);
- rt[3]= rt1[3] + fac3*rt1[3]*(rt2[3]-1.0);
-
- rt1+= 4; rt2+= 4; rt+= 4;
- }
- }
-}
-
-static void do_mul_effect(Sequence * seq,int cfra,
- float facf0, float facf1, int x, int y,
- struct ImBuf *ibuf1, struct ImBuf *ibuf2,
- struct ImBuf *ibuf3, struct ImBuf *out)
-{
- if (out->rect_float) {
- do_mul_effect_float(
- facf0, facf1, x, y,
- ibuf1->rect_float, ibuf2->rect_float,
- out->rect_float);
- } else {
- do_mul_effect_byte(
- facf0, facf1, x, y,
- (unsigned char*) ibuf1->rect, (unsigned char*) ibuf2->rect,
- (unsigned char*) out->rect);
- }
-}
-
-/* **********************************************************************
- WIPE
- ********************************************************************** */
-
-// This function calculates the blur band for the wipe effects
-static float in_band(float width,float dist, float perc,int side,int dir){
-
- float t1,t2,alpha,percwidth;
- if(width == 0)
- return (float)side;
- if(side == 1)
- percwidth = width * perc;
- else
- percwidth = width * (1 - perc);
-
- if(width < dist)
- return side;
-
- t1 = dist / width; //percentange of width that is
- t2 = 1 / width; //amount of alpha per % point
-
- if(side == 1)
- alpha = (t1*t2*100) + (1-perc); // add point's alpha contrib to current position in wipe
- else
- alpha = (1-perc) - (t1*t2*100);
-
- if(dir == 0)
- alpha = 1-alpha;
- return alpha;
-}
-
-static float check_zone(int x, int y, int xo, int yo,
- Sequence *seq, float facf0)
-{
- float posx, posy,hyp,hyp2,angle,hwidth,b1,b2,b3,pointdist;
-/*some future stuff
-float hyp3,hyp4,b4,b5
-*/
- float temp1,temp2,temp3,temp4; //some placeholder variables
- float halfx = xo/2;
- float halfy = yo/2;
- float widthf,output=0;
- WipeVars *wipe = (WipeVars *)seq->effectdata;
- int width;
-
- angle = wipe->angle;
- if(angle < 0){
- x = xo-x;
- //y = yo-y
- }
- angle = pow(fabs(angle)/45,log(xo)/log(2));
-
- posy = facf0 * yo;
- if(wipe->forward){
- posx = facf0 * xo;
- posy = facf0 * yo;
- } else{
- posx = xo - facf0 * xo;
- posy = yo - facf0 * yo;
- }
- switch (wipe->wipetype) {
- case DO_SINGLE_WIPE:
- width = (int)(wipe->edgeWidth*((xo+yo)/2.0));
- hwidth = (float)width/2.0;
-
- if (angle == 0.0)angle = 0.000001;
- b1 = posy - (-angle)*posx;
- b2 = y - (-angle)*x;
- hyp = fabs(angle*x+y+(-posy-angle*posx))/sqrt(angle*angle+1);
- if(angle < 0){
- temp1 = b1;
- b1 = b2;
- b2 = temp1;
- }
- if(wipe->forward){
- if(b1 < b2)
- output = in_band(width,hyp,facf0,1,1);
- else
- output = in_band(width,hyp,facf0,0,1);
- } else{
- if(b1 < b2)
- output = in_band(width,hyp,facf0,0,1);
- else
- output = in_band(width,hyp,facf0,1,1);
- }
- break;
-
-
- case DO_DOUBLE_WIPE:
- if(!wipe->forward)facf0 = 1-facf0; // Go the other direction
-
- width = (int)(wipe->edgeWidth*((xo+yo)/2.0)); // calculate the blur width
- hwidth = (float)width/2.0;
- if (angle == 0)angle = 0.000001;
- b1 = posy/2 - (-angle)*posx/2;
- b3 = (yo-posy/2) - (-angle)*(xo-posx/2);
- b2 = y - (-angle)*x;
-
- hyp = abs(angle*x+y+(-posy/2-angle*posx/2))/sqrt(angle*angle+1);
- hyp2 = abs(angle*x+y+(-(yo-posy/2)-angle*(xo-posx/2)))/sqrt(angle*angle+1);
-
- temp1 = xo*(1-facf0/2)-xo*facf0/2;
- temp2 = yo*(1-facf0/2)-yo*facf0/2;
- pointdist = sqrt(temp1*temp1 + temp2*temp2);
-
- if(b2 < b1 && b2 < b3 ){
- if(hwidth < pointdist)
- output = in_band(hwidth,hyp,facf0,0,1);
- } else if(b2 > b1 && b2 > b3 ){
- if(hwidth < pointdist)
- output = in_band(hwidth,hyp2,facf0,0,1);
- } else {
- if( hyp < hwidth && hyp2 > hwidth )
- output = in_band(hwidth,hyp,facf0,1,1);
- else if( hyp > hwidth && hyp2 < hwidth )
- output = in_band(hwidth,hyp2,facf0,1,1);
- else
- output = in_band(hwidth,hyp2,facf0,1,1) * in_band(hwidth,hyp,facf0,1,1);
- }
- if(!wipe->forward)output = 1-output;
- break;
- case DO_CLOCK_WIPE:
- /*
- temp1: angle of effect center in rads
- temp2: angle of line through (halfx,halfy) and (x,y) in rads
- temp3: angle of low side of blur
- temp4: angle of high side of blur
- */
- output = 1-facf0;
- widthf = wipe->edgeWidth*2*3.14159;
- temp1 = 2 * 3.14159 * facf0;
-
- if(wipe->forward){
- temp1 = 2*3.14159-temp1;
- }
-
- x = x - halfx;
- y = y - halfy;
-
- temp2 = asin(abs(y)/sqrt(x*x + y*y));
- if(x <= 0 && y >= 0) temp2 = 3.14159 - temp2;
- else if(x<=0 && y <= 0) temp2 += 3.14159;
- else if(x >= 0 && y <= 0) temp2 = 2*3.14159 - temp2;
-
- if(wipe->forward){
- temp3 = temp1-(widthf/2)*facf0;
- temp4 = temp1+(widthf/2)*(1-facf0);
- } else{
- temp3 = temp1-(widthf/2)*(1-facf0);
- temp4 = temp1+(widthf/2)*facf0;
- }
- if (temp3 < 0) temp3 = 0;
- if (temp4 > 2*3.14159) temp4 = 2*3.14159;
-
-
- if(temp2 < temp3) output = 0;
- else if (temp2 > temp4) output = 1;
- else output = (temp2-temp3)/(temp4-temp3);
- if(x == 0 && y == 0) output = 1;
- if(output != output) output = 1;
- if(wipe->forward) output = 1 - output;
- break;
- /* BOX WIPE IS NOT WORKING YET */
- /* case DO_CROSS_WIPE: */
- /* BOX WIPE IS NOT WORKING YET */
- /*
- case DO_BOX_WIPE:
- if(invert)facf0 = 1-facf0;
-
- width = (int)(wipe->edgeWidth*((xo+yo)/2.0));
- hwidth = (float)width/2.0;
- if (angle == 0)angle = 0.000001;
- b1 = posy/2 - (-angle)*posx/2;
- b3 = (yo-posy/2) - (-angle)*(xo-posx/2);
- b2 = y - (-angle)*x;
-
- hyp = abs(angle*x+y+(-posy/2-angle*posx/2))/sqrt(angle*angle+1);
- hyp2 = abs(angle*x+y+(-(yo-posy/2)-angle*(xo-posx/2)))/sqrt(angle*angle+1);
-
- temp1 = xo*(1-facf0/2)-xo*facf0/2;
- temp2 = yo*(1-facf0/2)-yo*facf0/2;
- pointdist = sqrt(temp1*temp1 + temp2*temp2);
-
- if(b2 < b1 && b2 < b3 ){
- if(hwidth < pointdist)
- output = in_band(hwidth,hyp,facf0,0,1);
- } else if(b2 > b1 && b2 > b3 ){
- if(hwidth < pointdist)
- output = in_band(hwidth,hyp2,facf0,0,1);
- } else {
- if( hyp < hwidth && hyp2 > hwidth )
- output = in_band(hwidth,hyp,facf0,1,1);
- else if( hyp > hwidth && hyp2 < hwidth )
- output = in_band(hwidth,hyp2,facf0,1,1);
- else
- output = in_band(hwidth,hyp2,facf0,1,1) * in_band(hwidth,hyp,facf0,1,1);
- }
-
- if(invert)facf0 = 1-facf0;
- angle = -1/angle;
- b1 = posy/2 - (-angle)*posx/2;
- b3 = (yo-posy/2) - (-angle)*(xo-posx/2);
- b2 = y - (-angle)*x;
-
- hyp = abs(angle*x+y+(-posy/2-angle*posx/2))/sqrt(angle*angle+1);
- hyp2 = abs(angle*x+y+(-(yo-posy/2)-angle*(xo-posx/2)))/sqrt(angle*angle+1);
-
- if(b2 < b1 && b2 < b3 ){
- if(hwidth < pointdist)
- output *= in_band(hwidth,hyp,facf0,0,1);
- } else if(b2 > b1 && b2 > b3 ){
- if(hwidth < pointdist)
- output *= in_band(hwidth,hyp2,facf0,0,1);
- } else {
- if( hyp < hwidth && hyp2 > hwidth )
- output *= in_band(hwidth,hyp,facf0,1,1);
- else if( hyp > hwidth && hyp2 < hwidth )
- output *= in_band(hwidth,hyp2,facf0,1,1);
- else
- output *= in_band(hwidth,hyp2,facf0,1,1) * in_band(hwidth,hyp,facf0,1,1);
- }
-
- break;
-*/
- case DO_IRIS_WIPE:
- if(xo > yo) yo = xo;
- else xo = yo;
-
- if(!wipe->forward) facf0 = 1-facf0;
-
- width = (int)(wipe->edgeWidth*((xo+yo)/2.0));
- hwidth = (float)width/2.0;
-
- temp1 = (halfx-(halfx)*facf0);
- pointdist = sqrt(temp1*temp1 + temp1*temp1);
-
- temp2 = sqrt((halfx-x)*(halfx-x) + (halfy-y)*(halfy-y));
- if(temp2 > pointdist) output = in_band(hwidth,fabs(temp2-pointdist),facf0,0,1);
- else output = in_band(hwidth,fabs(temp2-pointdist),facf0,1,1);
-
- if(!wipe->forward) output = 1-output;
-
- break;
- }
- if (output < 0) output = 0;
- else if(output > 1) output = 1;
- return output;
-}
-
-static void init_wipe_effect(Sequence *seq)
-{
- if(seq->effectdata)MEM_freeN(seq->effectdata);
- seq->effectdata = MEM_callocN(sizeof(struct WipeVars), "wipevars");
-}
-
-static int num_inputs_wipe()
-{
- return 1;
-}
-
-static void free_wipe_effect(Sequence *seq)
-{
- if(seq->effectdata)MEM_freeN(seq->effectdata);
- seq->effectdata = 0;
-}
-
-static void copy_wipe_effect(Sequence *dst, Sequence *src)
-{
- dst->effectdata = MEM_dupallocN(src->effectdata);
-}
-
-static void do_wipe_effect_byte(Sequence *seq, float facf0, float facf1,
- int x, int y,
- unsigned char *rect1,
- unsigned char *rect2, unsigned char *out)
-{
- int xo, yo;
- char *rt1, *rt2, *rt;
- rt1 = (char *)rect1;
- rt2 = (char *)rect2;
- rt = (char *)out;
-
- xo = x;
- yo = y;
- for(y=0;y<yo;y++) {
- for(x=0;x<xo;x++) {
- float check = check_zone(x,y,xo,yo,seq,facf0);
- if (check) {
- if (rt1) {
- rt[0] = (int)(rt1[0]*check)+ (int)(rt2[0]*(1-check));
- rt[1] = (int)(rt1[1]*check)+ (int)(rt2[1]*(1-check));
- rt[2] = (int)(rt1[2]*check)+ (int)(rt2[2]*(1-check));
- rt[3] = (int)(rt1[3]*check)+ (int)(rt2[3]*(1-check));
- } else {
- rt[0] = 0;
- rt[1] = 0;
- rt[2] = 0;
- rt[3] = 255;
- }
- } else {
- if (rt2) {
- rt[0] = rt2[0];
- rt[1] = rt2[1];
- rt[2] = rt2[2];
- rt[3] = rt2[3];
- } else {
- rt[0] = 0;
- rt[1] = 0;
- rt[2] = 0;
- rt[3] = 255;
- }
- }
-
- rt+=4;
- if(rt1 !=NULL){
- rt1+=4;
- }
- if(rt2 !=NULL){
- rt2+=4;
- }
- }
- }
-}
-
-static void do_wipe_effect_float(Sequence *seq, float facf0, float facf1,
- int x, int y,
- float *rect1,
- float *rect2, float *out)
-{
- int xo, yo;
- float *rt1, *rt2, *rt;
- rt1 = rect1;
- rt2 = rect2;
- rt = out;
-
- xo = x;
- yo = y;
- for(y=0;y<yo;y++) {
- for(x=0;x<xo;x++) {
- float check = check_zone(x,y,xo,yo,seq,facf0);
- if (check) {
- if (rt1) {
- rt[0] = rt1[0]*check+ rt2[0]*(1-check);
- rt[1] = rt1[1]*check+ rt2[1]*(1-check);
- rt[2] = rt1[2]*check+ rt2[2]*(1-check);
- rt[3] = rt1[3]*check+ rt2[3]*(1-check);
- } else {
- rt[0] = 0;
- rt[1] = 0;
- rt[2] = 0;
- rt[3] = 1.0;
- }
- } else {
- if (rt2) {
- rt[0] = rt2[0];
- rt[1] = rt2[1];
- rt[2] = rt2[2];
- rt[3] = rt2[3];
- } else {
- rt[0] = 0;
- rt[1] = 0;
- rt[2] = 0;
- rt[3] = 1.0;
- }
- }
-
- rt+=4;
- if(rt1 !=NULL){
- rt1+=4;
- }
- if(rt2 !=NULL){
- rt2+=4;
- }
- }
- }
-}
-
-static void do_wipe_effect(Sequence * seq,int cfra,
- float facf0, float facf1, int x, int y,
- struct ImBuf *ibuf1, struct ImBuf *ibuf2,
- struct ImBuf *ibuf3, struct ImBuf *out)
-{
- if (out->rect_float) {
- do_wipe_effect_float(seq,
- facf0, facf1, x, y,
- ibuf1->rect_float, ibuf2->rect_float,
- out->rect_float);
- } else {
- do_wipe_effect_byte(seq,
- facf0, facf1, x, y,
- (unsigned char*) ibuf1->rect, (unsigned char*) ibuf2->rect,
- (unsigned char*) out->rect);
- }
-}
-/* **********************************************************************
- TRANSFORM
- ********************************************************************** */
-static void init_transform_effect(Sequence *seq)
-{
- TransformVars *scale;
-
- if(seq->effectdata)MEM_freeN(seq->effectdata);
- seq->effectdata = MEM_callocN(sizeof(struct TransformVars), "transformvars");
-
- scale = (TransformVars *)seq->effectdata;
- scale->ScalexIni = 1;
- scale->ScaleyIni = 1;
- scale->ScalexFin = 1;
- scale->ScaleyFin = 1;
-
- scale->xIni=0;
- scale->xFin=0;
- scale->yIni=0;
- scale->yFin=0;
-
- scale->rotIni=0;
- scale->rotFin=0;
-
- scale->interpolation=1;
- scale->percent=1;
-}
-
-static int num_inputs_transform()
-{
- return 1;
-}
-
-static void free_transform_effect(Sequence *seq)
-{
- if(seq->effectdata)MEM_freeN(seq->effectdata);
- seq->effectdata = 0;
-}
-
-static void copy_transform_effect(Sequence *dst, Sequence *src)
-{
- dst->effectdata = MEM_dupallocN(src->effectdata);
-}
-
-static void do_transform(Sequence * seq,float facf0, int x, int y,
- struct ImBuf *ibuf1,struct ImBuf *out)
-{
- int xo, yo, xi, yi;
- float xs,ys,factxScale,factyScale,tx,ty,rad,s,c,xaux,yaux,factRot,px,py;
- TransformVars *scale;
-
- scale = (TransformVars *)seq->effectdata;
- xo = x;
- yo = y;
-
- //factor scale
- factxScale = scale->ScalexIni + (scale->ScalexFin - scale->ScalexIni) * facf0;
- factyScale = scale->ScaleyIni + (scale->ScaleyFin - scale->ScaleyIni) * facf0;
-
- //Factor translate
- if(!scale->percent){
- tx = scale->xIni+(xo / 2.0f) + (scale->xFin-(xo / 2.0f) - scale->xIni+(xo / 2.0f)) * facf0;
- ty = scale->yIni+(yo / 2.0f) + (scale->yFin-(yo / 2.0f) - scale->yIni+(yo / 2.0f)) * facf0;
- }else{
- tx = xo*(scale->xIni/100.0)+(xo / 2.0f) + (xo*(scale->xFin/100.0)-(xo / 2.0f) - xo*(scale->xIni/100.0)+(xo / 2.0f)) * facf0;
- ty = yo*(scale->yIni/100.0)+(yo / 2.0f) + (yo*(scale->yFin/100.0)-(yo / 2.0f) - yo*(scale->yIni/100.0)+(yo / 2.0f)) * facf0;
- }
-
- //factor Rotate
- factRot = scale->rotIni + (scale->rotFin - scale->rotIni) * facf0;
- rad = (M_PI * factRot) / 180.0f;
- s= sin(rad);
- c= cos(rad);
-
- for (yi = 0; yi < yo; yi++) {
- for (xi = 0; xi < xo; xi++) {
- //tranlate point
- px = xi-tx;
- py = yi-ty;
-
- //rotate point with center ref
- xaux = c*px + py*s ;
- yaux = -s*px + c*py;
-
- //scale point with center ref
- xs = xaux / factxScale;
- ys = yaux / factyScale;
-
- //undo reference center point
- xs += (xo / 2.0f);
- ys += (yo / 2.0f);
-
- //interpolate
- if(scale->interpolation==0)
- neareast_interpolation(ibuf1,out, xs,ys,xi,yi);
- if(scale->interpolation==1)
- bilinear_interpolation(ibuf1,out, xs,ys,xi,yi);
- if(scale->interpolation==2)
- bicubic_interpolation(ibuf1,out, xs,ys,xi,yi);
- }
- }
-
-}
-static void do_transform_effect(Sequence * seq,int cfra,
- float facf0, float facf1, int x, int y,
- struct ImBuf *ibuf1, struct ImBuf *ibuf2,
- struct ImBuf *ibuf3, struct ImBuf *out)
-{
- do_transform(seq, facf0, x, y, ibuf1, out);
-}
-
-
-/* **********************************************************************
- GLOW
- ********************************************************************** */
-
-static void RVBlurBitmap2_byte ( unsigned char* map, int width,int height,
- float blur,
- int quality)
-/* MUUUCCH better than the previous blur. */
-/* We do the blurring in two passes which is a whole lot faster. */
-/* I changed the math arount to implement an actual Gaussian */
-/* distribution. */
-/* */
-/* Watch out though, it tends to misbehaven with large blur values on */
-/* a small bitmap. Avoid avoid avoid. */
-/*=============================== */
-{
- unsigned char* temp=NULL,*swap;
- float *filter=NULL;
- int x,y,i,fx,fy;
- int index, ix, halfWidth;
- float fval, k, curColor[3], curColor2[3], weight=0;
-
- /* If we're not really blurring, bail out */
- if (blur<=0)
- return;
-
- /* Allocate memory for the tempmap and the blur filter matrix */
- temp= MEM_mallocN( (width*height*4), "blurbitmaptemp");
- if (!temp)
- return;
-
- /* Allocate memory for the filter elements */
- halfWidth = ((quality+1)*blur);
- filter = (float *)MEM_mallocN(sizeof(float)*halfWidth*2, "blurbitmapfilter");
- if (!filter){
- MEM_freeN (temp);
- return;
- }
-
- /* Apparently we're calculating a bell curve */
- /* based on the standard deviation (or radius) */
- /* This code is based on an example */
- /* posted to comp.graphics.algorithms by */
- /* Blancmange (bmange@airdmhor.gen.nz) */
-
- k = -1.0/(2.0*3.14159*blur*blur);
- fval=0;
- for (ix = 0;ix< halfWidth;ix++){
- weight = (float)exp(k*(ix*ix));
- filter[halfWidth - ix] = weight;
- filter[halfWidth + ix] = weight;
- }
- filter[0] = weight;
-
- /* Normalize the array */
- fval=0;
- for (ix = 0;ix< halfWidth*2;ix++)
- fval+=filter[ix];
-
- for (ix = 0;ix< halfWidth*2;ix++)
- filter[ix]/=fval;
-
- /* Blur the rows */
- for (y=0;y<height;y++){
- /* Do the left & right strips */
- for (x=0;x<halfWidth;x++){
- index=(x+y*width)*4;
- fx=0;
- curColor[0]=curColor[1]=curColor[2]=0;
- curColor2[0]=curColor2[1]=curColor2[2]=0;
-
- for (i=x-halfWidth;i<x+halfWidth;i++){
- if ((i>=0)&&(i<width)){
- curColor[0]+=map[(i+y*width)*4+GlowR]*filter[fx];
- curColor[1]+=map[(i+y*width)*4+GlowG]*filter[fx];
- curColor[2]+=map[(i+y*width)*4+GlowB]*filter[fx];
-
- curColor2[0]+=map[(width-1-i+y*width)*4+GlowR] *
- filter[fx];
- curColor2[1]+=map[(width-1-i+y*width)*4+GlowG] *
- filter[fx];
- curColor2[2]+=map[(width-1-i+y*width)*4+GlowB] *
- filter[fx];
- }
- fx++;
- }
- temp[index+GlowR]=curColor[0];
- temp[index+GlowG]=curColor[1];
- temp[index+GlowB]=curColor[2];
-
- temp[((width-1-x+y*width)*4)+GlowR]=curColor2[0];
- temp[((width-1-x+y*width)*4)+GlowG]=curColor2[1];
- temp[((width-1-x+y*width)*4)+GlowB]=curColor2[2];
-
- }
- /* Do the main body */
- for (x=halfWidth;x<width-halfWidth;x++){
- index=(x+y*width)*4;
- fx=0;
- curColor[0]=curColor[1]=curColor[2]=0;
- for (i=x-halfWidth;i<x+halfWidth;i++){
- curColor[0]+=map[(i+y*width)*4+GlowR]*filter[fx];
- curColor[1]+=map[(i+y*width)*4+GlowG]*filter[fx];
- curColor[2]+=map[(i+y*width)*4+GlowB]*filter[fx];
- fx++;
- }
- temp[index+GlowR]=curColor[0];
- temp[index+GlowG]=curColor[1];
- temp[index+GlowB]=curColor[2];
- }
- }
-
- /* Swap buffers */
- swap=temp;temp=map;map=swap;
-
-
- /* Blur the columns */
- for (x=0;x<width;x++){
- /* Do the top & bottom strips */
- for (y=0;y<halfWidth;y++){
- index=(x+y*width)*4;
- fy=0;
- curColor[0]=curColor[1]=curColor[2]=0;
- curColor2[0]=curColor2[1]=curColor2[2]=0;
- for (i=y-halfWidth;i<y+halfWidth;i++){
- if ((i>=0)&&(i<height)){
- /* Bottom */
- curColor[0]+=map[(x+i*width)*4+GlowR]*filter[fy];
- curColor[1]+=map[(x+i*width)*4+GlowG]*filter[fy];
- curColor[2]+=map[(x+i*width)*4+GlowB]*filter[fy];
-
- /* Top */
- curColor2[0]+=map[(x+(height-1-i)*width) *
- 4+GlowR]*filter[fy];
- curColor2[1]+=map[(x+(height-1-i)*width) *
- 4+GlowG]*filter[fy];
- curColor2[2]+=map[(x+(height-1-i)*width) *
- 4+GlowB]*filter[fy];
- }
- fy++;
- }
- temp[index+GlowR]=curColor[0];
- temp[index+GlowG]=curColor[1];
- temp[index+GlowB]=curColor[2];
- temp[((x+(height-1-y)*width)*4)+GlowR]=curColor2[0];
- temp[((x+(height-1-y)*width)*4)+GlowG]=curColor2[1];
- temp[((x+(height-1-y)*width)*4)+GlowB]=curColor2[2];
- }
- /* Do the main body */
- for (y=halfWidth;y<height-halfWidth;y++){
- index=(x+y*width)*4;
- fy=0;
- curColor[0]=curColor[1]=curColor[2]=0;
- for (i=y-halfWidth;i<y+halfWidth;i++){
- curColor[0]+=map[(x+i*width)*4+GlowR]*filter[fy];
- curColor[1]+=map[(x+i*width)*4+GlowG]*filter[fy];
- curColor[2]+=map[(x+i*width)*4+GlowB]*filter[fy];
- fy++;
- }
- temp[index+GlowR]=curColor[0];
- temp[index+GlowG]=curColor[1];
- temp[index+GlowB]=curColor[2];
- }
- }
-
-
- /* Swap buffers */
- swap=temp;temp=map;map=swap;
-
- /* Tidy up */
- MEM_freeN (filter);
- MEM_freeN (temp);
-}
-
-static void RVBlurBitmap2_float ( float* map, int width,int height,
- float blur,
- int quality)
-/* MUUUCCH better than the previous blur. */
-/* We do the blurring in two passes which is a whole lot faster. */
-/* I changed the math arount to implement an actual Gaussian */
-/* distribution. */
-/* */
-/* Watch out though, it tends to misbehaven with large blur values on */
-/* a small bitmap. Avoid avoid avoid. */
-/*=============================== */
-{
- float* temp=NULL,*swap;
- float *filter=NULL;
- int x,y,i,fx,fy;
- int index, ix, halfWidth;
- float fval, k, curColor[3], curColor2[3], weight=0;
-
- /* If we're not really blurring, bail out */
- if (blur<=0)
- return;
-
- /* Allocate memory for the tempmap and the blur filter matrix */
- temp= MEM_mallocN( (width*height*4*sizeof(float)), "blurbitmaptemp");
- if (!temp)
- return;
-
- /* Allocate memory for the filter elements */
- halfWidth = ((quality+1)*blur);
- filter = (float *)MEM_mallocN(sizeof(float)*halfWidth*2, "blurbitmapfilter");
- if (!filter){
- MEM_freeN (temp);
- return;
- }
-
- /* Apparently we're calculating a bell curve */
- /* based on the standard deviation (or radius) */
- /* This code is based on an example */
- /* posted to comp.graphics.algorithms by */
- /* Blancmange (bmange@airdmhor.gen.nz) */
-
- k = -1.0/(2.0*3.14159*blur*blur);
- fval=0;
- for (ix = 0;ix< halfWidth;ix++){
- weight = (float)exp(k*(ix*ix));
- filter[halfWidth - ix] = weight;
- filter[halfWidth + ix] = weight;
- }
- filter[0] = weight;
-
- /* Normalize the array */
- fval=0;
- for (ix = 0;ix< halfWidth*2;ix++)
- fval+=filter[ix];
-
- for (ix = 0;ix< halfWidth*2;ix++)
- filter[ix]/=fval;
-
- /* Blur the rows */
- for (y=0;y<height;y++){
- /* Do the left & right strips */
- for (x=0;x<halfWidth;x++){
- index=(x+y*width)*4;
- fx=0;
- curColor[0]=curColor[1]=curColor[2]=0.0f;
- curColor2[0]=curColor2[1]=curColor2[2]=0.0f;
-
- for (i=x-halfWidth;i<x+halfWidth;i++){
- if ((i>=0)&&(i<width)){
- curColor[0]+=map[(i+y*width)*4+GlowR]*filter[fx];
- curColor[1]+=map[(i+y*width)*4+GlowG]*filter[fx];
- curColor[2]+=map[(i+y*width)*4+GlowB]*filter[fx];
-
- curColor2[0]+=map[(width-1-i+y*width)*4+GlowR] *
- filter[fx];
- curColor2[1]+=map[(width-1-i+y*width)*4+GlowG] *
- filter[fx];
- curColor2[2]+=map[(width-1-i+y*width)*4+GlowB] *
- filter[fx];
- }
- fx++;
- }
- temp[index+GlowR]=curColor[0];
- temp[index+GlowG]=curColor[1];
- temp[index+GlowB]=curColor[2];
-
- temp[((width-1-x+y*width)*4)+GlowR]=curColor2[0];
- temp[((width-1-x+y*width)*4)+GlowG]=curColor2[1];
- temp[((width-1-x+y*width)*4)+GlowB]=curColor2[2];
-
- }
- /* Do the main body */
- for (x=halfWidth;x<width-halfWidth;x++){
- index=(x+y*width)*4;
- fx=0;
- curColor[0]=curColor[1]=curColor[2]=0;
- for (i=x-halfWidth;i<x+halfWidth;i++){
- curColor[0]+=map[(i+y*width)*4+GlowR]*filter[fx];
- curColor[1]+=map[(i+y*width)*4+GlowG]*filter[fx];
- curColor[2]+=map[(i+y*width)*4+GlowB]*filter[fx];
- fx++;
- }
- temp[index+GlowR]=curColor[0];
- temp[index+GlowG]=curColor[1];
- temp[index+GlowB]=curColor[2];
- }
- }
-
- /* Swap buffers */
- swap=temp;temp=map;map=swap;
-
-
- /* Blur the columns */
- for (x=0;x<width;x++){
- /* Do the top & bottom strips */
- for (y=0;y<halfWidth;y++){
- index=(x+y*width)*4;
- fy=0;
- curColor[0]=curColor[1]=curColor[2]=0;
- curColor2[0]=curColor2[1]=curColor2[2]=0;
- for (i=y-halfWidth;i<y+halfWidth;i++){
- if ((i>=0)&&(i<height)){
- /* Bottom */
- curColor[0]+=map[(x+i*width)*4+GlowR]*filter[fy];
- curColor[1]+=map[(x+i*width)*4+GlowG]*filter[fy];
- curColor[2]+=map[(x+i*width)*4+GlowB]*filter[fy];
-
- /* Top */
- curColor2[0]+=map[(x+(height-1-i)*width) *
- 4+GlowR]*filter[fy];
- curColor2[1]+=map[(x+(height-1-i)*width) *
- 4+GlowG]*filter[fy];
- curColor2[2]+=map[(x+(height-1-i)*width) *
- 4+GlowB]*filter[fy];
- }
- fy++;
- }
- temp[index+GlowR]=curColor[0];
- temp[index+GlowG]=curColor[1];
- temp[index+GlowB]=curColor[2];
- temp[((x+(height-1-y)*width)*4)+GlowR]=curColor2[0];
- temp[((x+(height-1-y)*width)*4)+GlowG]=curColor2[1];
- temp[((x+(height-1-y)*width)*4)+GlowB]=curColor2[2];
- }
- /* Do the main body */
- for (y=halfWidth;y<height-halfWidth;y++){
- index=(x+y*width)*4;
- fy=0;
- curColor[0]=curColor[1]=curColor[2]=0;
- for (i=y-halfWidth;i<y+halfWidth;i++){
- curColor[0]+=map[(x+i*width)*4+GlowR]*filter[fy];
- curColor[1]+=map[(x+i*width)*4+GlowG]*filter[fy];
- curColor[2]+=map[(x+i*width)*4+GlowB]*filter[fy];
- fy++;
- }
- temp[index+GlowR]=curColor[0];
- temp[index+GlowG]=curColor[1];
- temp[index+GlowB]=curColor[2];
- }
- }
-
-
- /* Swap buffers */
- swap=temp;temp=map;map=swap;
-
- /* Tidy up */
- MEM_freeN (filter);
- MEM_freeN (temp);
-}
-
-
-/* Adds two bitmaps and puts the results into a third map. */
-/* C must have been previously allocated but it may be A or B. */
-/* We clamp values to 255 to prevent weirdness */
-/*=============================== */
-static void RVAddBitmaps_byte (unsigned char* a, unsigned char* b, unsigned char* c, int width, int height)
-{
- int x,y,index;
-
- for (y=0;y<height;y++){
- for (x=0;x<width;x++){
- index=(x+y*width)*4;
- c[index+GlowR]=MIN2(255,a[index+GlowR]+b[index+GlowR]);
- c[index+GlowG]=MIN2(255,a[index+GlowG]+b[index+GlowG]);
- c[index+GlowB]=MIN2(255,a[index+GlowB]+b[index+GlowB]);
- c[index+GlowA]=MIN2(255,a[index+GlowA]+b[index+GlowA]);
- }
- }
-}
-
-static void RVAddBitmaps_float (float* a, float* b, float* c,
- int width, int height)
-{
- int x,y,index;
-
- for (y=0;y<height;y++){
- for (x=0;x<width;x++){
- index=(x+y*width)*4;
- c[index+GlowR]=MIN2(1.0,a[index+GlowR]+b[index+GlowR]);
- c[index+GlowG]=MIN2(1.0,a[index+GlowG]+b[index+GlowG]);
- c[index+GlowB]=MIN2(1.0,a[index+GlowB]+b[index+GlowB]);
- c[index+GlowA]=MIN2(1.0,a[index+GlowA]+b[index+GlowA]);
- }
- }
-}
-
-/* For each pixel whose total luminance exceeds the threshold, */
-/* Multiply it's value by BOOST and add it to the output map */
-static void RVIsolateHighlights_byte (unsigned char* in, unsigned char* out,
- int width, int height, int threshold,
- float boost, float clamp)
-{
- int x,y,index;
- int intensity;
-
-
- for(y=0;y< height;y++) {
- for (x=0;x< width;x++) {
- index= (x+y*width)*4;
-
- /* Isolate the intensity */
- intensity=(in[index+GlowR]+in[index+GlowG]+in[index+GlowB]-threshold);
- if (intensity>0){
- out[index+GlowR]=MIN2(255*clamp, (in[index+GlowR]*boost*intensity)/255);
- out[index+GlowG]=MIN2(255*clamp, (in[index+GlowG]*boost*intensity)/255);
- out[index+GlowB]=MIN2(255*clamp, (in[index+GlowB]*boost*intensity)/255);
- out[index+GlowA]=MIN2(255*clamp, (in[index+GlowA]*boost*intensity)/255);
- } else{
- out[index+GlowR]=0;
- out[index+GlowG]=0;
- out[index+GlowB]=0;
- out[index+GlowA]=0;
- }
- }
- }
-}
-
-static void RVIsolateHighlights_float (float* in, float* out,
- int width, int height, float threshold,
- float boost, float clamp)
-{
- int x,y,index;
- float intensity;
-
-
- for(y=0;y< height;y++) {
- for (x=0;x< width;x++) {
- index= (x+y*width)*4;
-
- /* Isolate the intensity */
- intensity=(in[index+GlowR]+in[index+GlowG]+in[index+GlowB]-threshold);
- if (intensity>0){
- out[index+GlowR]=MIN2(clamp, (in[index+GlowR]*boost*intensity));
- out[index+GlowG]=MIN2(clamp, (in[index+GlowG]*boost*intensity));
- out[index+GlowB]=MIN2(clamp, (in[index+GlowB]*boost*intensity));
- out[index+GlowA]=MIN2(clamp, (in[index+GlowA]*boost*intensity));
- } else{
- out[index+GlowR]=0;
- out[index+GlowG]=0;
- out[index+GlowB]=0;
- out[index+GlowA]=0;
- }
- }
- }
-}
-
-static void init_glow_effect(Sequence *seq)
-{
- GlowVars *glow;
-
- if(seq->effectdata)MEM_freeN(seq->effectdata);
- seq->effectdata = MEM_callocN(sizeof(struct GlowVars), "glowvars");
-
- glow = (GlowVars *)seq->effectdata;
- glow->fMini = 0.25;
- glow->fClamp = 1.0;
- glow->fBoost = 0.5;
- glow->dDist = 3.0;
- glow->dQuality = 3;
- glow->bNoComp = 0;
-}
-
-static int num_inputs_glow()
-{
- return 1;
-}
-
-static void free_glow_effect(Sequence *seq)
-{
- if(seq->effectdata)MEM_freeN(seq->effectdata);
- seq->effectdata = 0;
-}
-
-static void copy_glow_effect(Sequence *dst, Sequence *src)
-{
- dst->effectdata = MEM_dupallocN(src->effectdata);
-}
-
-//void do_glow_effect(Cast *cast, float facf0, float facf1, int xo, int yo, ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *outbuf, ImBuf *use)
-static void do_glow_effect_byte(Sequence *seq, float facf0, float facf1,
- int x, int y, char *rect1,
- char *rect2, char *out)
-{
- unsigned char *outbuf=(unsigned char *)out;
- unsigned char *inbuf=(unsigned char *)rect1;
- GlowVars *glow = (GlowVars *)seq->effectdata;
- struct RenderData *rd = &G.scene->r;
-
- RVIsolateHighlights_byte(inbuf, outbuf , x, y, glow->fMini*765, glow->fBoost, glow->fClamp);
- RVBlurBitmap2_byte (outbuf, x, y, glow->dDist * (rd->size / 100.0f),glow->dQuality);
- if (!glow->bNoComp)
- RVAddBitmaps_byte (inbuf , outbuf, outbuf, x, y);
-}
-
-static void do_glow_effect_float(Sequence *seq, float facf0, float facf1,
- int x, int y,
- float *rect1, float *rect2, float *out)
-{
- float *outbuf = out;
- float *inbuf = rect1;
- GlowVars *glow = (GlowVars *)seq->effectdata;
- struct RenderData *rd = &G.scene->r;
-
- RVIsolateHighlights_float(inbuf, outbuf , x, y, glow->fMini*3.0f, glow->fBoost, glow->fClamp);
- RVBlurBitmap2_float (outbuf, x, y, glow->dDist * (rd->size / 100.0f),glow->dQuality);
- if (!glow->bNoComp)
- RVAddBitmaps_float (inbuf , outbuf, outbuf, x, y);
-}
-
-static void do_glow_effect(Sequence * seq,int cfra,
- float facf0, float facf1, int x, int y,
- struct ImBuf *ibuf1, struct ImBuf *ibuf2,
- struct ImBuf *ibuf3, struct ImBuf *out)
-{
- if (out->rect_float) {
- do_glow_effect_float(seq,
- facf0, facf1, x, y,
- ibuf1->rect_float, ibuf2->rect_float,
- out->rect_float);
- } else {
- do_glow_effect_byte(seq,
- facf0, facf1, x, y,
- (char*) ibuf1->rect, (char*) ibuf2->rect,
- (char*) out->rect);
- }
-}
-
-/* **********************************************************************
- SOLID COLOR
- ********************************************************************** */
-
-static void init_solid_color(Sequence *seq)
-{
- SolidColorVars *cv;
-
- if(seq->effectdata)MEM_freeN(seq->effectdata);
- seq->effectdata = MEM_callocN(sizeof(struct SolidColorVars), "solidcolor");
-
- cv = (SolidColorVars *)seq->effectdata;
- cv->col[0] = cv->col[1] = cv->col[2] = 0.5;
-}
-
-static int num_inputs_color()
-{
- return 0;
-}
-
-static void free_solid_color(Sequence *seq)
-{
- if(seq->effectdata)MEM_freeN(seq->effectdata);
- seq->effectdata = 0;
-}
-
-static void copy_solid_color(Sequence *dst, Sequence *src)
-{
- dst->effectdata = MEM_dupallocN(src->effectdata);
-}
-
-static int early_out_color(struct Sequence *seq,
- float facf0, float facf1)
-{
- return -1;
-}
-
-static void do_solid_color(Sequence * seq,int cfra,
- float facf0, float facf1, int x, int y,
- struct ImBuf *ibuf1, struct ImBuf *ibuf2,
- struct ImBuf *ibuf3, struct ImBuf *out)
-{
- SolidColorVars *cv = (SolidColorVars *)seq->effectdata;
-
- unsigned char *rect;
- float *rect_float;
-
- if (out->rect) {
- rect = (unsigned char *)out->rect;
-
- for(y=0; y<out->y; y++) {
- for(x=0; x<out->x; x++, rect+=4) {
- rect[0]= (char)(cv->col[0]*255);
- rect[1]= (char)(cv->col[1]*255);
- rect[2]= (char)(cv->col[2]*255);
- rect[3]= 255;
- }
- }
- } else if (out->rect_float) {
- rect_float = out->rect_float;
-
- for(y=0; y<out->y; y++) {
- for(x=0; x<out->x; x++, rect_float+=4) {
- rect_float[0]= cv->col[0];
- rect_float[1]= cv->col[1];
- rect_float[2]= cv->col[2];
- rect_float[3]= 1.0;
- }
- }
- }
-}
-
-/* **********************************************************************
- SPEED
- ********************************************************************** */
-static void init_speed_effect(Sequence *seq)
-{
- SpeedControlVars * v;
-
- if(seq->effectdata) MEM_freeN(seq->effectdata);
- seq->effectdata = MEM_callocN(sizeof(struct SpeedControlVars),
- "speedcontrolvars");
-
- v = (SpeedControlVars *)seq->effectdata;
- v->globalSpeed = 1.0;
- v->frameMap = 0;
- v->flags = SEQ_SPEED_COMPRESS_IPO_Y;
- v->length = 0;
-}
-
-static void load_speed_effect(Sequence * seq)
-{
- SpeedControlVars * v = (SpeedControlVars *)seq->effectdata;
-
- v->frameMap = 0;
- v->length = 0;
-}
-
-static int num_inputs_speed()
-{
- return 1;
-}
-
-static void free_speed_effect(Sequence *seq)
-{
- SpeedControlVars * v = (SpeedControlVars *)seq->effectdata;
- if(v->frameMap) MEM_freeN(v->frameMap);
- if(seq->effectdata) MEM_freeN(seq->effectdata);
- seq->effectdata = 0;
-}
-
-static void copy_speed_effect(Sequence *dst, Sequence *src)
-{
- SpeedControlVars * v;
- dst->effectdata = MEM_dupallocN(src->effectdata);
- v = (SpeedControlVars *)dst->effectdata;
- v->frameMap = 0;
- v->length = 0;
-}
-
-static int early_out_speed(struct Sequence *seq,
- float facf0, float facf1)
-{
- return 1;
-}
-
-static void store_icu_yrange_speed(struct Sequence * seq,
- short adrcode, float * ymin, float * ymax)
-{
- SpeedControlVars * v = (SpeedControlVars *)seq->effectdata;
-
- /* if not already done, load / initialize data */
- get_sequence_effect(seq);
-
- if ((v->flags & SEQ_SPEED_INTEGRATE) != 0) {
- *ymin = -100.0;
- *ymax = 100.0;
- } else {
- if (v->flags & SEQ_SPEED_COMPRESS_IPO_Y) {
- *ymin = 0.0;
- *ymax = 1.0;
- } else {
- *ymin = 0.0;
- *ymax = seq->len;
- }
- }
-}
-
-void sequence_effect_speed_rebuild_map(struct Sequence * seq, int force)
-{
- float facf0 = seq->facf0;
- float ctime, div;
- int cfra;
- float fallback_fac;
- SpeedControlVars * v = (SpeedControlVars *)seq->effectdata;
-
- /* if not already done, load / initialize data */
- get_sequence_effect(seq);
-
- if (!(force || seq->len != v->length || !v->frameMap)) {
- return;
- }
-
- if (!v->frameMap || v->length != seq->len) {
- if (v->frameMap) MEM_freeN(v->frameMap);
-
- v->length = seq->len;
-
- v->frameMap = MEM_callocN(sizeof(float) * v->length,
- "speedcontrol frameMap");
- }
-
- fallback_fac = 1.0;
-
- /* if there is no IPO, try to make retiming easy by stretching the
- strip */
-
- if (!seq->ipo && seq->seq1 && seq->seq1->enddisp != seq->seq1->start
- && seq->seq1->len != 0) {
- fallback_fac = (float) seq->seq1->len /
- (float) (seq->seq1->enddisp - seq->seq1->start);
- /* FIXME: this strip stretching gets screwed by stripdata
- handling one layer up.
-
- So it currently works by enlarging, never by shrinking!
-
- (IPOs still work, if used correctly)
- */
- if (fallback_fac > 1.0) {
- fallback_fac = 1.0;
- }
- }
-
- if ((v->flags & SEQ_SPEED_INTEGRATE) != 0) {
- float cursor = 0;
-
- v->frameMap[0] = 0;
- v->lastValidFrame = 0;
-
- for (cfra = 1; cfra < v->length; cfra++) {
- if(seq->ipo) {
- if((seq->flag & SEQ_IPO_FRAME_LOCKED) != 0) {
- ctime = frame_to_float(seq->startdisp
- + cfra);
- div = 1.0;
- } else {
- ctime= frame_to_float(cfra);
- div= v->length / 100.0f;
- if(div==0.0) return;
- }
-
- calc_ipo(seq->ipo, ctime/div);
- execute_ipo((ID *)seq, seq->ipo);
- } else {
- seq->facf0 = fallback_fac;
- }
- seq->facf0 *= v->globalSpeed;
-
- cursor += seq->facf0;
-
- if (cursor >= v->length) {
- v->frameMap[cfra] = v->length - 1;
- } else {
- v->frameMap[cfra] = cursor;
- v->lastValidFrame = cfra;
- }
- }
- } else {
- v->lastValidFrame = 0;
- for (cfra = 0; cfra < v->length; cfra++) {
- if(seq->ipo) {
- if((seq->flag & SEQ_IPO_FRAME_LOCKED) != 0) {
- ctime = frame_to_float(seq->startdisp
- + cfra);
- div = 1.0;
- } else {
- ctime= frame_to_float(cfra);
- div= v->length / 100.0f;
- if(div==0.0) return;
- }
-
- calc_ipo(seq->ipo, ctime/div);
- execute_ipo((ID *)seq, seq->ipo);
- }
-
- if (v->flags & SEQ_SPEED_COMPRESS_IPO_Y) {
- seq->facf0 *= v->length;
- }
- if (!seq->ipo) {
- seq->facf0 = (float) cfra * fallback_fac;
- }
- seq->facf0 *= v->globalSpeed;
- if (seq->facf0 >= v->length) {
- seq->facf0 = v->length - 1;
- } else {
- v->lastValidFrame = cfra;
- }
- v->frameMap[cfra] = seq->facf0;
- }
- }
- seq->facf0 = facf0;
-}
-
-/*
- simply reuse do_cross_effect for blending...
-
-static void do_speed_effect(Sequence * seq,int cfra,
- float facf0, float facf1, int x, int y,
- struct ImBuf *ibuf1, struct ImBuf *ibuf2,
- struct ImBuf *ibuf3, struct ImBuf *out)
-{
-
-}
-*/
-
-
-/* **********************************************************************
- sequence effect factory
- ********************************************************************** */
-
-
-static void init_noop(struct Sequence *seq)
-{
-
-}
-
-static void load_noop(struct Sequence *seq)
-{
-
-}
-
-static void init_plugin_noop(struct Sequence *seq, const char * fname)
-{
-
-}
-
-static void free_noop(struct Sequence *seq)
-{
-
-}
-
-static int num_inputs_default()
-{
- return 2;
-}
-
-static int early_out_noop(struct Sequence *seq,
- float facf0, float facf1)
-{
- return 0;
-}
-
-static int early_out_fade(struct Sequence *seq,
- float facf0, float facf1)
-{
- if (facf0 == 0.0 && facf1 == 0.0) {
- return 1;
- } else if (facf0 == 1.0 && facf1 == 1.0) {
- return 2;
- }
- return 0;
-}
-
-static int early_out_mul_input2(struct Sequence *seq,
- float facf0, float facf1)
-{
- if (facf0 == 0.0 && facf1 == 0.0) {
- return 1;
- }
- return 0;
-}
-
-static void store_icu_yrange_noop(struct Sequence * seq,
- short adrcode, float * ymin, float * ymax)
-{
- /* defaults are fine */
-}
-
-static void get_default_fac_noop(struct Sequence *seq, int cfra,
- float * facf0, float * facf1)
-{
- *facf0 = *facf1 = 1.0;
-}
-
-static void get_default_fac_fade(struct Sequence *seq, int cfra,
- float * facf0, float * facf1)
-{
- *facf0 = (float)(cfra - seq->startdisp);
- *facf1 = (float)(*facf0 + 0.5);
- *facf0 /= seq->len;
- *facf1 /= seq->len;
-}
-
-static void do_overdrop_effect(struct Sequence * seq, int cfra,
- float fac, float facf,
- int x, int y, struct ImBuf * ibuf1,
- struct ImBuf * ibuf2,
- struct ImBuf * ibuf3,
- struct ImBuf * out)
-{
- do_drop_effect(seq, cfra, fac, facf, x, y,
- ibuf1, ibuf2, ibuf3, out);
- do_alphaover_effect(seq, cfra, fac, facf, x, y,
- ibuf1, ibuf2, ibuf3, out);
-}
-
-static struct SeqEffectHandle get_sequence_effect_impl(int seq_type)
-{
- struct SeqEffectHandle rval;
- int sequence_type = seq_type;
-
- rval.init = init_noop;
- rval.init_plugin = init_plugin_noop;
- rval.num_inputs = num_inputs_default;
- rval.load = load_noop;
- rval.free = free_noop;
- rval.early_out = early_out_noop;
- rval.get_default_fac = get_default_fac_noop;
- rval.store_icu_yrange = store_icu_yrange_noop;
- rval.execute = NULL;
- rval.copy = NULL;
-
- switch (sequence_type) {
- case SEQ_CROSS:
- rval.execute = do_cross_effect;
- rval.early_out = early_out_fade;
- rval.get_default_fac = get_default_fac_fade;
- break;
- case SEQ_GAMCROSS:
- rval.init = init_gammacross;
- rval.load = load_gammacross;
- rval.free = free_gammacross;
- rval.early_out = early_out_fade;
- rval.get_default_fac = get_default_fac_fade;
- rval.execute = do_gammacross_effect;
- break;
- case SEQ_ADD:
- rval.execute = do_add_effect;
- rval.early_out = early_out_mul_input2;
- break;
- case SEQ_SUB:
- rval.execute = do_sub_effect;
- rval.early_out = early_out_mul_input2;
- break;
- case SEQ_MUL:
- rval.execute = do_mul_effect;
- rval.early_out = early_out_mul_input2;
- break;
- case SEQ_ALPHAOVER:
- rval.init = init_alpha_over_or_under;
- rval.execute = do_alphaover_effect;
- break;
- case SEQ_OVERDROP:
- rval.execute = do_overdrop_effect;
- break;
- case SEQ_ALPHAUNDER:
- rval.init = init_alpha_over_or_under;
- rval.execute = do_alphaunder_effect;
- break;
- case SEQ_WIPE:
- rval.init = init_wipe_effect;
- rval.num_inputs = num_inputs_wipe;
- rval.free = free_wipe_effect;
- rval.copy = copy_wipe_effect;
- rval.early_out = early_out_fade;
- rval.get_default_fac = get_default_fac_fade;
- rval.execute = do_wipe_effect;
- break;
- case SEQ_GLOW:
- rval.init = init_glow_effect;
- rval.num_inputs = num_inputs_glow;
- rval.free = free_glow_effect;
- rval.copy = copy_glow_effect;
- rval.execute = do_glow_effect;
- break;
- case SEQ_TRANSFORM:
- rval.init = init_transform_effect;
- rval.num_inputs = num_inputs_transform;
- rval.free = free_transform_effect;
- rval.copy = copy_transform_effect;
- rval.execute = do_transform_effect;
- break;
- case SEQ_SPEED:
- rval.init = init_speed_effect;
- rval.num_inputs = num_inputs_speed;
- rval.load = load_speed_effect;
- rval.free = free_speed_effect;
- rval.copy = copy_speed_effect;
- rval.execute = do_cross_effect;
- rval.early_out = early_out_speed;
- rval.store_icu_yrange = store_icu_yrange_speed;
- break;
- case SEQ_COLOR:
- rval.init = init_solid_color;
- rval.num_inputs = num_inputs_color;
- rval.early_out = early_out_color;
- rval.free = free_solid_color;
- rval.copy = copy_solid_color;
- rval.execute = do_solid_color;
- break;
- case SEQ_PLUGIN:
- rval.init_plugin = init_plugin;
- rval.num_inputs = num_inputs_plugin;
- rval.load = load_plugin;
- rval.free = free_plugin;
- rval.copy = copy_plugin;
- rval.execute = do_plugin_effect;
- rval.early_out = do_plugin_early_out;
- rval.get_default_fac = get_default_fac_fade;
- break;
- }
-
- return rval;
-}
-
-
-struct SeqEffectHandle get_sequence_effect(Sequence * seq)
-{
- struct SeqEffectHandle rval = get_sequence_effect_impl(seq->type);
-
- if ((seq->flag & SEQ_EFFECT_NOT_LOADED) != 0) {
- rval.load(seq);
- seq->flag &= ~SEQ_EFFECT_NOT_LOADED;
- }
-
- return rval;
-}
-
-int get_sequence_effect_num_inputs(int seq_type)
-{
- struct SeqEffectHandle rval = get_sequence_effect_impl(seq_type);
-
- return rval.num_inputs();
-}
diff --git a/source/blender/src/seqscopes.c b/source/blender/src/seqscopes.c
deleted file mode 100644
index 1fa01a6145e..00000000000
--- a/source/blender/src/seqscopes.c
+++ /dev/null
@@ -1,340 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Author: Peter Schlaile < peter [at] schlaile [dot] de >
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- *
- */
-
-#include "BSE_seqscopes.h"
-#include "IMB_imbuf_types.h"
-#include "IMB_imbuf.h"
-#include "BKE_utildefines.h"
-#include <math.h>
-#include <string.h>
-
-static void rgb_to_yuv(float rgb[3], float yuv[3]) {
- yuv[0]= 0.299*rgb[0] + 0.587*rgb[1] + 0.114*rgb[2];
- yuv[1]= 0.492*(rgb[2] - yuv[0]);
- yuv[2]= 0.877*(rgb[0] - yuv[0]);
-
- /* Normalize */
- yuv[1]*= 255.0/(122*2.0);
- yuv[1]+= 0.5;
-
- yuv[2]*= 255.0/(157*2.0);
- yuv[2]+= 0.5;
-}
-
-static void scope_put_pixel(unsigned char* table, unsigned char * pos)
-{
- char newval = table[*pos];
- pos[0] = pos[1] = pos[2] = newval;
- pos[3] = 255;
-}
-
-static void wform_put_line(int w,
- unsigned char * last_pos, unsigned char * new_pos)
-{
- if (last_pos > new_pos) {
- unsigned char* temp = new_pos;
- new_pos = last_pos;
- last_pos = temp;
- }
-
- while (last_pos < new_pos) {
- if (last_pos[0] == 0) {
- last_pos[0] = last_pos[1] = last_pos[2] = 32;
- last_pos[3] = 255;
- }
- last_pos += 4*w;
- }
-}
-
-static struct ImBuf *make_waveform_view_from_ibuf_byte(struct ImBuf * ibuf)
-{
- struct ImBuf * rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect, 0);
- int x,y;
- unsigned char* src = (unsigned char*) ibuf->rect;
- unsigned char* tgt = (unsigned char*) rval->rect;
- int w = ibuf->x + 3;
- int h = 515;
- float waveform_gamma = 0.2;
- unsigned char wtable[256];
-
- for (x = 0; x < 256; x++) {
- wtable[x] = (unsigned char) (pow(((float) x + 1)/256,
- waveform_gamma)*255);
- }
-
- for (y = 0; y < ibuf->y; y++) {
- unsigned char * last_p = 0;
-
- for (x = 0; x < ibuf->x; x++) {
- unsigned char * rgb = src + 4 * (ibuf->x * y + x);
- float v = 1.0 *
- ( 0.299*rgb[0]
- + 0.587*rgb[1]
- + 0.114*rgb[2]) / 255.0;
- unsigned char * p = tgt;
- p += 4 * (w * ((int) (v * (h - 3)) + 1) + x + 1);
-
- scope_put_pixel(wtable, p);
- p += 4 * w;
- scope_put_pixel(wtable, p);
-
- if (last_p != 0) {
- wform_put_line(w, last_p, p);
- }
- last_p = p;
- }
- }
-
- for (x = 0; x < w; x++) {
- unsigned char * p = tgt + 4 * x;
- p[1] = p[3] = 255.0;
- p[4 * w + 1] = p[4 * w + 3] = 255.0;
- p = tgt + 4 * (w * (h - 1) + x);
- p[1] = p[3] = 255.0;
- p[-4 * w + 1] = p[-4 * w + 3] = 255.0;
- }
-
- for (y = 0; y < h; y++) {
- unsigned char * p = tgt + 4 * w * y;
- p[1] = p[3] = 255.0;
- p[4 + 1] = p[4 + 3] = 255.0;
- p = tgt + 4 * (w * y + w - 1);
- p[1] = p[3] = 255.0;
- p[-4 + 1] = p[-4 + 3] = 255.0;
- }
-
- return rval;
-}
-
-static struct ImBuf *make_waveform_view_from_ibuf_float(struct ImBuf * ibuf)
-{
- struct ImBuf * rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect, 0);
- int x,y;
- float* src = ibuf->rect_float;
- unsigned char* tgt = (unsigned char*) rval->rect;
- int w = ibuf->x + 3;
- int h = 515;
- float waveform_gamma = 0.2;
- unsigned char wtable[256];
-
- for (x = 0; x < 256; x++) {
- wtable[x] = (unsigned char) (pow(((float) x + 1)/256,
- waveform_gamma)*255);
- }
-
- for (y = 0; y < ibuf->y; y++) {
- unsigned char * last_p = 0;
-
- for (x = 0; x < ibuf->x; x++) {
- float * rgb = src + 4 * (ibuf->x * y + x);
- float v = 1.0 *
- ( 0.299*rgb[0]
- + 0.587*rgb[1]
- + 0.114*rgb[2]);
- unsigned char * p = tgt;
-
- CLAMP(v, 0.0, 1.0);
-
- p += 4 * (w * ((int) (v * (h - 3)) + 1) + x + 1);
-
- scope_put_pixel(wtable, p);
- p += 4 * w;
- scope_put_pixel(wtable, p);
-
- if (last_p != 0) {
- wform_put_line(w, last_p, p);
- }
- last_p = p;
- }
- }
-
- for (x = 0; x < w; x++) {
- unsigned char * p = tgt + 4 * x;
- p[1] = p[3] = 255.0;
- p[4 * w + 1] = p[4 * w + 3] = 255.0;
- p = tgt + 4 * (w * (h - 1) + x);
- p[1] = p[3] = 255.0;
- p[-4 * w + 1] = p[-4 * w + 3] = 255.0;
- }
-
- for (y = 0; y < h; y++) {
- unsigned char * p = tgt + 4 * w * y;
- p[1] = p[3] = 255.0;
- p[4 + 1] = p[4 + 3] = 255.0;
- p = tgt + 4 * (w * y + w - 1);
- p[1] = p[3] = 255.0;
- p[-4 + 1] = p[-4 + 3] = 255.0;
- }
-
- return rval;
-}
-
-struct ImBuf *make_waveform_view_from_ibuf(struct ImBuf * ibuf)
-{
- if (ibuf->rect_float) {
- return make_waveform_view_from_ibuf_float(ibuf);
- } else {
- return make_waveform_view_from_ibuf_byte(ibuf);
- }
-}
-
-
-static void vectorscope_put_cross(unsigned char r, unsigned char g,
- unsigned char b,
- char * tgt, int w, int h, int size)
-{
- float rgb[3], yuv[3];
- char * p;
- int x = 0;
- int y = 0;
-
- rgb[0]= (float)r/255.0;
- rgb[1]= (float)g/255.0;
- rgb[2]= (float)b/255.0;
- rgb_to_yuv(rgb, yuv);
-
- p = tgt + 4 * (w * (int) ((yuv[2] * (h - 3) + 1))
- + (int) ((yuv[1] * (w - 3) + 1)));
-
- if (r == 0 && g == 0 && b == 0) {
- r = 255;
- }
-
- for (y = -size; y <= size; y++) {
- for (x = -size; x <= size; x++) {
- char * q = p + 4 * (y * w + x);
- q[0] = r; q[1] = g; q[2] = b; q[3] = 255;
- }
- }
-}
-
-static struct ImBuf *make_vectorscope_view_from_ibuf_byte(struct ImBuf * ibuf)
-{
- struct ImBuf * rval = IMB_allocImBuf(515, 515, 32, IB_rect, 0);
- int x,y;
- char* src = (char*) ibuf->rect;
- char* tgt = (char*) rval->rect;
- float rgb[3], yuv[3];
- int w = 515;
- int h = 515;
- float scope_gamma = 0.2;
- unsigned char wtable[256];
-
- for (x = 0; x < 256; x++) {
- wtable[x] = (unsigned char) (pow(((float) x + 1)/256,
- scope_gamma)*255);
- }
-
- for (x = 0; x <= 255; x++) {
- vectorscope_put_cross(255 , 0,255 - x, tgt, w, h, 1);
- vectorscope_put_cross(255 , x, 0, tgt, w, h, 1);
- vectorscope_put_cross(255- x, 255, 0, tgt, w, h, 1);
- vectorscope_put_cross(0, 255, x, tgt, w, h, 1);
- vectorscope_put_cross(0, 255 - x, 255, tgt, w, h, 1);
- vectorscope_put_cross(x, 0, 255, tgt, w, h, 1);
- }
-
- for (y = 0; y < ibuf->y; y++) {
- for (x = 0; x < ibuf->x; x++) {
- char * src1 = src + 4 * (ibuf->x * y + x);
- char * p;
-
- rgb[0]= (float)src1[0]/255.0;
- rgb[1]= (float)src1[1]/255.0;
- rgb[2]= (float)src1[2]/255.0;
- rgb_to_yuv(rgb, yuv);
-
- p = tgt + 4 * (w * (int) ((yuv[2] * (h - 3) + 1))
- + (int) ((yuv[1] * (w - 3) + 1)));
- scope_put_pixel(wtable, (unsigned char*)p);
- }
- }
-
- vectorscope_put_cross(0, 0, 0, tgt, w, h, 3);
-
- return rval;
-}
-
-static struct ImBuf *make_vectorscope_view_from_ibuf_float(struct ImBuf * ibuf)
-{
- struct ImBuf * rval = IMB_allocImBuf(515, 515, 32, IB_rect, 0);
- int x,y;
- float* src = ibuf->rect_float;
- char* tgt = (char*) rval->rect;
- float rgb[3], yuv[3];
- int w = 515;
- int h = 515;
- float scope_gamma = 0.2;
- unsigned char wtable[256];
-
- for (x = 0; x < 256; x++) {
- wtable[x] = (unsigned char) (pow(((float) x + 1)/256,
- scope_gamma)*255);
- }
-
- for (x = 0; x <= 255; x++) {
- vectorscope_put_cross(255 , 0,255 - x, tgt, w, h, 1);
- vectorscope_put_cross(255 , x, 0, tgt, w, h, 1);
- vectorscope_put_cross(255- x, 255, 0, tgt, w, h, 1);
- vectorscope_put_cross(0, 255, x, tgt, w, h, 1);
- vectorscope_put_cross(0, 255 - x, 255, tgt, w, h, 1);
- vectorscope_put_cross(x, 0, 255, tgt, w, h, 1);
- }
-
- for (y = 0; y < ibuf->y; y++) {
- for (x = 0; x < ibuf->x; x++) {
- float * src1 = src + 4 * (ibuf->x * y + x);
- char * p;
-
- memcpy(rgb, src1, 3 * sizeof(float));
-
- CLAMP(rgb[0], 0.0, 1.0);
- CLAMP(rgb[1], 0.0, 1.0);
- CLAMP(rgb[2], 0.0, 1.0);
-
- rgb_to_yuv(rgb, yuv);
-
- p = tgt + 4 * (w * (int) ((yuv[2] * (h - 3) + 1))
- + (int) ((yuv[1] * (w - 3) + 1)));
- scope_put_pixel(wtable, (unsigned char*)p);
- }
- }
-
- vectorscope_put_cross(0, 0, 0, tgt, w, h, 3);
-
- return rval;
-}
-
-struct ImBuf *make_vectorscope_view_from_ibuf(struct ImBuf * ibuf)
-{
- if (ibuf->rect_float) {
- return make_vectorscope_view_from_ibuf_float(ibuf);
- } else {
- return make_vectorscope_view_from_ibuf_byte(ibuf);
- }
-}
diff --git a/source/blender/src/sequence.c b/source/blender/src/sequence.c
deleted file mode 100644
index 6d663b610ca..00000000000
--- a/source/blender/src/sequence.c
+++ /dev/null
@@ -1,1776 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * Contributor(s): Peter Schlaile <peter [at] schlaile [dot] de> 2005/2006
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <string.h>
-#include <math.h>
-#include <stdlib.h>
-
-#include "MEM_guardedalloc.h"
-#include "MEM_CacheLimiterC-Api.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "IMB_imbuf_types.h"
-#include "IMB_imbuf.h"
-
-#include "DNA_ipo_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_sequence_types.h"
-#include "DNA_view3d_types.h"
-
-#include "BKE_global.h"
-#include "BKE_image.h"
-#include "BKE_ipo.h"
-#include "BKE_main.h"
-#include "BKE_scene.h"
-#include "BKE_texture.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_editsound.h"
-#include "BIF_editseq.h"
-#include "BSE_filesel.h"
-#include "BSE_headerbuttons.h"
-#include "BIF_interface.h"
-#include "BIF_renderwin.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-
-#include "BSE_sequence.h"
-#include "BSE_seqeffects.h"
-
-#include "RE_pipeline.h" // talks to entire render API
-
-#include "blendef.h"
-
-#include "BLI_threads.h"
-#include <pthread.h>
-
-int seqrectx, seqrecty;
-
-void free_tstripdata(int len, TStripElem *se)
-{
- TStripElem *seo;
- int a;
-
- seo= se;
- if (!se) {
- return;
- }
-
- for(a=0; a<len; a++, se++) {
- if(se->ibuf && se->ok != STRIPELEM_META) {
- IMB_freeImBuf(se->ibuf);
- se->ibuf = 0;
- }
- }
-
- MEM_freeN(seo);
-
-}
-
-void free_strip(Strip *strip)
-{
- strip->us--;
- if(strip->us>0) return;
- if(strip->us<0) {
- printf("error: negative users in strip\n");
- return;
- }
-
- if(strip->stripdata) {
- MEM_freeN(strip->stripdata);
- }
-
- free_tstripdata(strip->len, strip->tstripdata);
-
- MEM_freeN(strip);
-}
-
-void new_tstripdata(Sequence *seq)
-{
- if(seq->strip) {
- free_tstripdata(seq->strip->len, seq->strip->tstripdata);
- seq->strip->tstripdata= 0;
- seq->strip->len= seq->len;
- }
-}
-
-void free_sequence(Sequence *seq)
-{
- Sequence *last_seq = get_last_seq();
-
- if(seq->strip) free_strip(seq->strip);
-
- if(seq->anim) IMB_free_anim(seq->anim);
- if(seq->hdaudio) sound_close_hdaudio(seq->hdaudio);
-
- if (seq->type & SEQ_EFFECT) {
- struct SeqEffectHandle sh = get_sequence_effect(seq);
-
- sh.free(seq);
- }
-
- if(seq==last_seq) set_last_seq(NULL);
-
- MEM_freeN(seq);
-}
-
-/*
- **********************************************************************
- * build_seqar
- **********************************************************************
- * Build a complete array of _all_ sequencies (including those
- * in metastrips!)
- **********************************************************************
-*/
-
-static void do_seq_count(ListBase *seqbase, int *totseq)
-{
- Sequence *seq;
-
- seq= seqbase->first;
- while(seq) {
- (*totseq)++;
- if(seq->seqbase.first) do_seq_count(&seq->seqbase, totseq);
- seq= seq->next;
- }
-}
-
-static void do_build_seqar(ListBase *seqbase, Sequence ***seqar, int depth)
-{
- Sequence *seq;
-
- seq= seqbase->first;
- while(seq) {
- seq->depth= depth;
- if(seq->seqbase.first) do_build_seqar(&seq->seqbase, seqar, depth+1);
- **seqar= seq;
- (*seqar)++;
- seq= seq->next;
- }
-}
-
-void build_seqar(ListBase *seqbase, Sequence ***seqar, int *totseq)
-{
- Sequence **tseqar;
-
- *totseq= 0;
- do_seq_count(seqbase, totseq);
-
- if(*totseq==0) {
- *seqar= 0;
- return;
- }
- *seqar= MEM_mallocN(sizeof(void *)* *totseq, "seqar");
- tseqar= *seqar;
-
- do_build_seqar(seqbase, seqar, 0);
- *seqar= tseqar;
-}
-
-void free_editing(Editing *ed)
-{
- MetaStack *ms;
- Sequence *seq;
-
- if(ed==NULL) return;
- set_last_seq(NULL); /* clear_last_seq doesnt work, it screws up free_sequence */
-
- WHILE_SEQ(&ed->seqbase) {
- free_sequence(seq);
- }
- END_SEQ
-
- while( (ms= ed->metastack.first) ) {
- BLI_remlink(&ed->metastack, ms);
- MEM_freeN(ms);
- }
-
- MEM_freeN(ed);
-
-}
-
-void calc_sequence_disp(Sequence *seq)
-{
- if(seq->startofs && seq->startstill) seq->startstill= 0;
- if(seq->endofs && seq->endstill) seq->endstill= 0;
-
- seq->startdisp= seq->start + seq->startofs - seq->startstill;
- seq->enddisp= seq->start+seq->len - seq->endofs + seq->endstill;
-
- seq->handsize= 10.0; /* 10 frames */
- if( seq->enddisp-seq->startdisp < 10 ) {
- seq->handsize= (float)(0.5*(seq->enddisp-seq->startdisp));
- }
- else if(seq->enddisp-seq->startdisp > 250) {
- seq->handsize= (float)((seq->enddisp-seq->startdisp)/25);
- }
-}
-
-void calc_sequence(Sequence *seq)
-{
- Sequence *seqm;
- int min, max;
-
- /* check all metas recursively */
- seqm= seq->seqbase.first;
- while(seqm) {
- if(seqm->seqbase.first) calc_sequence(seqm);
- seqm= seqm->next;
- }
-
- /* effects and meta: automatic start and end */
-
- if(seq->type & SEQ_EFFECT) {
- /* pointers */
- if(seq->seq2==0) seq->seq2= seq->seq1;
- if(seq->seq3==0) seq->seq3= seq->seq1;
-
- /* effecten go from seq1 -> seq2: test */
-
- /* we take the largest start and smallest end */
-
- // seq->start= seq->startdisp= MAX2(seq->seq1->startdisp, seq->seq2->startdisp);
- // seq->enddisp= MIN2(seq->seq1->enddisp, seq->seq2->enddisp);
-
- if (seq->seq1) {
- seq->start= seq->startdisp= MAX3(seq->seq1->startdisp, seq->seq2->startdisp, seq->seq3->startdisp);
- seq->enddisp= MIN3(seq->seq1->enddisp, seq->seq2->enddisp, seq->seq3->enddisp);
- seq->len= seq->enddisp - seq->startdisp;
- } else {
- calc_sequence_disp(seq);
- }
-
- if(seq->strip && seq->len!=seq->strip->len) {
- new_tstripdata(seq);
- }
-
- }
- else {
- if(seq->type==SEQ_META) {
- seqm= seq->seqbase.first;
- if(seqm) {
- min= 1000000;
- max= -1000000;
- while(seqm) {
- if(seqm->startdisp < min) min= seqm->startdisp;
- if(seqm->enddisp > max) max= seqm->enddisp;
- seqm= seqm->next;
- }
- seq->start= min;
- seq->len= max-min;
-
- if(seq->strip && seq->len!=seq->strip->len) {
- new_tstripdata(seq);
- }
- }
- }
- calc_sequence_disp(seq);
- }
-}
-
-void sort_seq()
-{
- /* all strips together per kind, and in order of y location ("machine") */
- ListBase seqbase, effbase;
- Editing *ed;
- Sequence *seq, *seqt;
-
- ed= G.scene->ed;
- if(ed==0) return;
-
- seqbase.first= seqbase.last= 0;
- effbase.first= effbase.last= 0;
-
- while( (seq= ed->seqbasep->first) ) {
- BLI_remlink(ed->seqbasep, seq);
-
- if(seq->type & SEQ_EFFECT) {
- seqt= effbase.first;
- while(seqt) {
- if(seqt->machine>=seq->machine) {
- BLI_insertlinkbefore(&effbase, seqt, seq);
- break;
- }
- seqt= seqt->next;
- }
- if(seqt==0) BLI_addtail(&effbase, seq);
- }
- else {
- seqt= seqbase.first;
- while(seqt) {
- if(seqt->machine>=seq->machine) {
- BLI_insertlinkbefore(&seqbase, seqt, seq);
- break;
- }
- seqt= seqt->next;
- }
- if(seqt==0) BLI_addtail(&seqbase, seq);
- }
- }
-
- addlisttolist(&seqbase, &effbase);
- *(ed->seqbasep)= seqbase;
-}
-
-
-void clear_scene_in_allseqs(Scene *sce)
-{
- Scene *sce1;
- Editing *ed;
- Sequence *seq;
-
- /* when a scene is deleted: test all seqs */
-
- sce1= G.main->scene.first;
- while(sce1) {
- if(sce1!=sce && sce1->ed) {
- ed= sce1->ed;
-
- WHILE_SEQ(&ed->seqbase) {
-
- if(seq->scene==sce) seq->scene= 0;
-
- }
- END_SEQ
- }
-
- sce1= sce1->id.next;
- }
-}
-
-/* ***************** DO THE SEQUENCE ***************** */
-
-static void make_black_ibuf(ImBuf *ibuf)
-{
- unsigned int *rect;
- float *rect_float;
- int tot;
-
- if(ibuf==0 || (ibuf->rect==0 && ibuf->rect_float==0)) return;
-
- tot= ibuf->x*ibuf->y;
-
- rect= ibuf->rect;
- rect_float = ibuf->rect_float;
-
- if (rect) {
- memset(rect, 0, tot * sizeof(char) * 4);
- }
-
- if (rect_float) {
- memset(rect_float, 0, tot * sizeof(float) * 4);
- }
-}
-
-static void multibuf(ImBuf *ibuf, float fmul)
-{
- char *rt;
- float *rt_float;
-
- int a, mul, icol;
-
- mul= (int)(256.0*fmul);
-
- a= ibuf->x*ibuf->y;
- rt= (char *)ibuf->rect;
- rt_float = ibuf->rect_float;
-
- if (rt) {
- while(a--) {
-
- icol= (mul*rt[0])>>8;
- if(icol>254) rt[0]= 255; else rt[0]= icol;
- icol= (mul*rt[1])>>8;
- if(icol>254) rt[1]= 255; else rt[1]= icol;
- icol= (mul*rt[2])>>8;
- if(icol>254) rt[2]= 255; else rt[2]= icol;
- icol= (mul*rt[3])>>8;
- if(icol>254) rt[3]= 255; else rt[3]= icol;
-
- rt+= 4;
- }
- }
- if (rt_float) {
- while(a--) {
- rt_float[0] *= fmul;
- rt_float[1] *= fmul;
- rt_float[2] *= fmul;
- rt_float[3] *= fmul;
-
- rt_float += 4;
- }
- }
-}
-
-static void do_effect(int cfra, Sequence *seq, TStripElem *se)
-{
- TStripElem *se1, *se2, *se3;
- float fac, facf;
- int x, y;
- int early_out;
- struct SeqEffectHandle sh = get_sequence_effect(seq);
-
- if (!sh.execute) { /* effect not supported in this version... */
- make_black_ibuf(se->ibuf);
- return;
- }
-
- if(seq->ipo && seq->ipo->curve.first) {
- do_seq_ipo(seq, cfra);
- fac= seq->facf0;
- facf= seq->facf1;
- } else {
- sh.get_default_fac(seq, cfra, &fac, &facf);
- }
-
- if( !(G.scene->r.mode & R_FIELDS) ) facf = fac;
-
- early_out = sh.early_out(seq, fac, facf);
-
- if (early_out == -1) { /* no input needed */
- sh.execute(seq, cfra, fac, facf, se->ibuf->x, se->ibuf->y,
- 0, 0, 0, se->ibuf);
- return;
- }
-
- switch (early_out) {
- case 0:
- if (se->se1==0 || se->se2==0 || se->se3==0) {
- make_black_ibuf(se->ibuf);
- return;
- }
-
- if(se->se1->ok == STRIPELEM_META) se1= se->se1->se1;
- else se1= se->se1;
-
- if(se->se2->ok == STRIPELEM_META) se2= se->se2->se1;
- else se2= se->se2;
-
- if(se->se3->ok == STRIPELEM_META) se3= se->se3->se1;
- else se3= se->se3;
-
- if ( (se1==0 || se2==0 || se3==0)
- || (se1->ibuf==0 || se2->ibuf==0 || se3->ibuf==0)) {
- make_black_ibuf(se->ibuf);
- return;
- }
-
- break;
- case 1:
- if (se->se1 == 0) {
- make_black_ibuf(se->ibuf);
- return;
- }
-
- if(se->se1->ok == STRIPELEM_META) se1= se->se1->se1;
- else se1= se->se1;
-
- if (se1 == 0 || se1->ibuf == 0) {
- make_black_ibuf(se->ibuf);
- return;
- }
-
- if (se->ibuf != se1->ibuf) {
- IMB_freeImBuf(se->ibuf);
- se->ibuf = se1->ibuf;
- IMB_refImBuf(se->ibuf);
- }
- return;
- case 2:
- if (se->se2 == 0) {
- make_black_ibuf(se->ibuf);
- return;
- }
-
- if(se->se2->ok == STRIPELEM_META) se2= se->se2->se1;
- else se2= se->se2;
-
- if (se2 == 0 || se2->ibuf == 0) {
- make_black_ibuf(se->ibuf);
- return;
- }
- if (se->ibuf != se2->ibuf) {
- IMB_freeImBuf(se->ibuf);
- se->ibuf = se2->ibuf;
- IMB_refImBuf(se->ibuf);
- }
- return;
- default:
- make_black_ibuf(se->ibuf);
- return;
- }
-
- x= se2->ibuf->x;
- y= se2->ibuf->y;
-
- if (!se1->ibuf->rect_float && se->ibuf->rect_float) {
- IMB_float_from_rect(se1->ibuf);
- }
- if (!se2->ibuf->rect_float && se->ibuf->rect_float) {
- IMB_float_from_rect(se2->ibuf);
- }
-
- if (!se1->ibuf->rect && !se->ibuf->rect_float) {
- IMB_rect_from_float(se1->ibuf);
- }
- if (!se2->ibuf->rect && !se->ibuf->rect_float) {
- IMB_rect_from_float(se2->ibuf);
- }
-
- sh.execute(seq, cfra, fac, facf, x, y, se1->ibuf, se2->ibuf, se3->ibuf,
- se->ibuf);
-}
-
-static int give_stripelem_index(Sequence *seq, int cfra)
-{
- int nr;
-
- if(seq->startdisp >cfra || seq->enddisp <= cfra) return -1;
-
- if(seq->flag&SEQ_REVERSE_FRAMES) {
- /*reverse frame in this sequence */
- if(cfra <= seq->start) nr= seq->len-1;
- else if(cfra >= seq->start+seq->len-1) nr= 0;
- else nr= (seq->start + seq->len) - cfra;
- } else {
- if(cfra <= seq->start) nr= 0;
- else if(cfra >= seq->start+seq->len-1) nr= seq->len-1;
- else nr= cfra-seq->start;
- }
- if (seq->strobe < 1.0) seq->strobe = 1.0;
- if (seq->strobe > 1.0) {
- nr -= (int)fmod((double)nr, (double)seq->strobe);
- }
-
- return nr;
-}
-
-TStripElem *give_tstripelem(Sequence *seq, int cfra)
-{
- TStripElem *se;
- int nr;
-
- se = seq->strip->tstripdata;
- if (se == 0 && seq->len > 0) {
- int i;
- se = seq->strip->tstripdata = MEM_callocN(
- seq->len*sizeof(TStripElem), "tstripelems");
- for (i = 0; i < seq->len; i++) {
- se[i].ok = STRIPELEM_OK;
- }
- }
- nr = give_stripelem_index(seq, cfra);
-
- if (nr == -1) return 0;
- if (se == 0) return 0;
-
- se+= nr;
- se->nr= nr;
-
- return se;
-}
-
-StripElem *give_stripelem(Sequence *seq, int cfra)
-{
- StripElem *se;
- int nr;
-
- se = seq->strip->stripdata;
- nr = give_stripelem_index(seq, cfra);
-
- if (nr == -1) return 0;
- if (se == 0) return 0;
-
- se += nr;
-
- return se;
-}
-
-static int evaluate_seq_frame_gen(
- Sequence ** seq_arr, ListBase *seqbase, int cfra)
-{
- Sequence *seq;
- int totseq=0;
-
- memset(seq_arr, 0, sizeof(Sequence*) * MAXSEQ);
-
- seq= seqbase->first;
- while(seq) {
- if(seq->startdisp <=cfra && seq->enddisp > cfra) {
- seq_arr[seq->machine]= seq;
- totseq++;
- }
- seq= seq->next;
- }
-
- return totseq;
-}
-
-int evaluate_seq_frame(int cfra)
-{
- Editing *ed;
- Sequence *seq_arr[MAXSEQ+1];
-
- ed= G.scene->ed;
- if(ed==0) return 0;
-
- return evaluate_seq_frame_gen(seq_arr, ed->seqbasep, cfra);
-
-}
-
-Sequence *get_shown_sequence(ListBase * seqbasep, int cfra, int chanshown)
-{
- Sequence *seq, *seqim, *seqeff;
- Sequence *seq_arr[MAXSEQ+1];
- int b;
-
- seq = 0;
-
- if (chanshown > MAXSEQ) {
- return 0;
- }
-
- if(evaluate_seq_frame_gen(seq_arr, seqbasep, cfra)) {
- if (chanshown > 0) {
- return seq_arr[chanshown];
- }
-
- /* we take the upper effect strip or
- the lowest imagestrip/metastrip */
- seqim= seqeff= 0;
-
- for(b=1; b<MAXSEQ; b++) {
- if(seq_arr[b]) {
- seq= seq_arr[b];
- if(seq->type & SEQ_EFFECT) {
- if(seqeff==0) seqeff= seq;
- else if(seqeff->machine < seq->machine)
- seqeff= seq;
- } else if (seq->type != SEQ_RAM_SOUND && seq->type != SEQ_HD_SOUND) {
- if(seqim==0) seqim= seq;
- else if(seqim->machine > seq->machine)
- seqim= seq;
- }
- }
- }
- if(seqeff) seq= seqeff;
- else if(seqim) seq= seqim;
- else seq= 0;
- }
-
- return seq;
-}
-
-static Sequence * get_shown_seq_from_metastrip(Sequence * seqm, int cfra)
-{
- return get_shown_sequence(&seqm->seqbase, cfra, 0);
-}
-
-void set_meta_stripdata(Sequence *seqm)
-{
- Sequence *seq;
- TStripElem *se;
- int a, cfra;
-
- se= seqm->strip->tstripdata;
-
- if (se == 0 && seqm->len > 0) {
- int i;
- se = seqm->strip->tstripdata = MEM_callocN(
- seqm->len*sizeof(TStripElem), "tstripelems");
- for (i = 0; i < seqm->len; i++) {
- se[i].ok = STRIPELEM_META;
- }
- }
-
- /* sets all ->se1 pointers in stripdata, to read the ibuf from it */
-
- for(a=0; a<seqm->len; a++, se++) {
- cfra= a+seqm->start;
- seq = get_shown_seq_from_metastrip(seqm, cfra);
- if (seq) {
- se->se1= give_tstripelem(seq, cfra);
- } else {
- se->se1= 0;
- }
- }
-}
-
-static TStripElem* do_build_seq_recursively(Sequence * seq, int cfra);
-
-static void do_build_seq_ibuf(Sequence * seq, TStripElem *se, int cfra)
-{
- char name[FILE_MAXDIR+FILE_MAXFILE];
-
- if(seq->type == SEQ_META) {
- if(seq->seqbase.first) {
- Sequence * seqmshown=
- get_shown_seq_from_metastrip(seq, cfra);
- if (seqmshown) {
- if(cfra< seq->start)
- do_build_seq_recursively(seqmshown, seq->start);
- else if(cfra> seq->start+seq->len-1)
- do_build_seq_recursively(seqmshown, seq->start + seq->len-1);
- else do_build_seq_recursively(seqmshown, cfra);
- }
- }
-
- se->ok = STRIPELEM_META;
- if(se->se1 == 0) set_meta_stripdata(seq);
- if(se->se1) {
- se->ibuf= se->se1->ibuf;
- }
- } else if(seq->type & SEQ_EFFECT) {
-
- /* test if image is too small or discarded from cache: reload */
- if(se->ibuf) {
- if(se->ibuf->x < seqrectx || se->ibuf->y < seqrecty || !(se->ibuf->rect || se->ibuf->rect_float)) {
- IMB_freeImBuf(se->ibuf);
- se->ibuf= 0;
- }
- }
-
- /* should the effect be recalculated? */
-
- if(se->ibuf == 0) {
- /* if one of two first inputs are rectfloat, output is float too */
- if((se->se1 && se->se1->ibuf && se->se1->ibuf->rect_float) ||
- (se->se2 && se->se2->ibuf && se->se2->ibuf->rect_float))
- se->ibuf= IMB_allocImBuf((short)seqrectx, (short)seqrecty, 32, IB_rectfloat, 0);
- else
- se->ibuf= IMB_allocImBuf((short)seqrectx, (short)seqrecty, 32, IB_rect, 0);
-
- do_effect(cfra, seq, se);
- }
-
- /* test size */
- if(se->ibuf) {
- if(se->ibuf->x != seqrectx || se->ibuf->y != seqrecty ) {
- if(G.scene->r.mode & R_OSA) {
- IMB_scaleImBuf(se->ibuf, (short)seqrectx, (short)seqrecty);
- } else {
- IMB_scalefastImBuf(se->ibuf, (short)seqrectx, (short)seqrecty);
- }
- }
- }
- } else if(seq->type < SEQ_EFFECT) {
- if(se->ibuf) {
- /* test if image too small
- or discarded from cache: reload */
- if(se->ibuf->x < seqrectx || se->ibuf->y < seqrecty || !(se->ibuf->rect || se->ibuf->rect_float)) {
- IMB_freeImBuf(se->ibuf);
- se->ibuf= 0;
- se->ok= STRIPELEM_OK;
- }
- }
-
- if(seq->type==SEQ_IMAGE) {
- if(se->ok == STRIPELEM_OK && se->ibuf==0) {
- StripElem * s_elem = give_stripelem(seq, cfra);
-
- /* if playanim or render:
- no waitcursor */
- if((G.f & G_PLAYANIM)==0)
- waitcursor(1);
-
- strncpy(name, seq->strip->dir, FILE_MAXDIR-1);
- strncat(name, s_elem->name, FILE_MAXFILE);
- BLI_convertstringcode(name, G.sce, G.scene->r.cfra);
- se->ibuf= IMB_loadiffname(name, IB_rect);
-
- if((G.f & G_PLAYANIM)==0)
- waitcursor(0);
-
- if(se->ibuf == 0) {
- se->ok = STRIPELEM_FAILED;
- } else {
- if(seq->flag & SEQ_MAKE_PREMUL) {
- if(se->ibuf->depth==32 && se->ibuf->zbuf==0) converttopremul(se->ibuf);
- }
- seq->strip->orx= se->ibuf->x;
- seq->strip->ory= se->ibuf->y;
- if(seq->flag & SEQ_FILTERY) IMB_filtery(se->ibuf);
- if(seq->flag & SEQ_FLIPX) IMB_flipx(se->ibuf);
- if(seq->flag & SEQ_FLIPY) IMB_flipy(se->ibuf);
- if(seq->mul==0.0) seq->mul= 1.0;
- if(seq->mul != 1.0) multibuf(se->ibuf, seq->mul);
- }
- }
- }
- else if(seq->type==SEQ_MOVIE) {
- if(se->ok == STRIPELEM_OK && se->ibuf==0) {
- if(seq->anim==0) {
- strncpy(name, seq->strip->dir, FILE_MAXDIR-1);
- strncat(name, seq->strip->stripdata->name, FILE_MAXFILE-1);
- BLI_convertstringcode(name, G.sce, G.scene->r.cfra);
-
- seq->anim = openanim(name, IB_rect);
- }
- if(seq->anim) {
- IMB_anim_set_preseek(seq->anim, seq->anim_preseek);
- se->ibuf = IMB_anim_absolute(seq->anim, se->nr);
- }
-
- if(se->ibuf == 0) {
- se->ok = STRIPELEM_FAILED;
- } else {
- if(seq->flag & SEQ_MAKE_PREMUL) {
- if(se->ibuf->depth==32) converttopremul(se->ibuf);
- }
- seq->strip->orx= se->ibuf->x;
- seq->strip->ory= se->ibuf->y;
- if(seq->flag & SEQ_FILTERY) IMB_filtery(se->ibuf);
- if(seq->mul==0.0) seq->mul= 1.0;
- if(seq->mul != 1.0) multibuf(se->ibuf, seq->mul);
- }
- }
- } else if(seq->type==SEQ_SCENE && se->ibuf==NULL && seq->scene) { // scene can be NULL after deletions
- int oldcfra = CFRA;
- Scene *sce= seq->scene, *oldsce= G.scene;
- Render *re;
- RenderResult rres;
- int doseq, rendering= G.rendering;
- char scenename[64];
-
- waitcursor(1);
-
- /* Hack! This function can be called from do_render_seq(), in that case
- the seq->scene can already have a Render initialized with same name,
- so we have to use a default name. (compositor uses G.scene name to
- find render).
- However, when called from within the UI (image preview in sequencer)
- we do want to use scene Render, that way the render result is defined
- for display in render/imagewindow */
- if(rendering) {
- BLI_strncpy(scenename, sce->id.name+2, 64);
- strcpy(sce->id.name+2, " do_build_seq_ibuf");
- }
- re= RE_NewRender(sce->id.name);
-
- /* prevent eternal loop */
- doseq= G.scene->r.scemode & R_DOSEQ;
- G.scene->r.scemode &= ~R_DOSEQ;
-
- BIF_init_render_callbacks(re, 0); /* 0= no display callbacks */
-
- /* hrms, set_scene still needed? work on that... */
- if(sce!=oldsce) set_scene_bg(sce);
- RE_BlenderFrame(re, sce, seq->sfra + se->nr);
- if(sce!=oldsce) set_scene_bg(oldsce);
-
- /* UGLY WARNING, it is set to zero in RE_BlenderFrame */
- G.rendering= rendering;
- if(rendering)
- BLI_strncpy(sce->id.name+2, scenename, 64);
-
- RE_GetResultImage(re, &rres);
-
- if(rres.rectf) {
- se->ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rectfloat, 0);
- memcpy(se->ibuf->rect_float, rres.rectf, 4*sizeof(float)*rres.rectx*rres.recty);
- if(rres.rectz) {
- addzbuffloatImBuf(se->ibuf);
- memcpy(se->ibuf->zbuf_float, rres.rectz, sizeof(float)*rres.rectx*rres.recty);
- }
- } else if (rres.rect32) {
- se->ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rect, 0);
- memcpy(se->ibuf->rect, rres.rect32, 4*rres.rectx*rres.recty);
- }
-
- BIF_end_render_callbacks();
-
- /* restore */
- G.scene->r.scemode |= doseq;
-
- if((G.f & G_PLAYANIM)==0) /* bad, is set on do_render_seq */
- waitcursor(0);
- CFRA = oldcfra;
- }
-
- /* size test */
- if(se->ibuf) {
- if(se->ibuf->x != seqrectx || se->ibuf->y != seqrecty ) {
-
- if (0) { // G.scene->r.mode & R_FIELDS) {
-
- if (seqrecty > 288)
- IMB_scalefieldImBuf(se->ibuf, (short)seqrectx, (short)seqrecty);
- else {
- IMB_de_interlace(se->ibuf);
-
- if(G.scene->r.mode & R_OSA)
- IMB_scaleImBuf(se->ibuf, (short)seqrectx, (short)seqrecty);
- else
- IMB_scalefastImBuf(se->ibuf, (short)seqrectx, (short)seqrecty);
- }
- }
- else {
- if(G.scene->r.mode & R_OSA)
- IMB_scaleImBuf(se->ibuf,(short)seqrectx, (short)seqrecty);
- else
- IMB_scalefastImBuf(se->ibuf, (short)seqrectx, (short)seqrecty);
- }
- }
-
- }
- }
- if (se->ibuf && seq->type != SEQ_META) {
- IMB_cache_limiter_insert(se->ibuf);
- IMB_cache_limiter_ref(se->ibuf);
- IMB_cache_limiter_touch(se->ibuf);
- }
-}
-
-static void do_effect_seq_recursively(Sequence * seq, TStripElem *se, int cfra)
-{
- float fac, facf;
- struct SeqEffectHandle sh = get_sequence_effect(seq);
- int early_out;
-
- se->se1 = 0;
- se->se2 = 0;
- se->se3 = 0;
-
- if(seq->ipo && seq->ipo->curve.first) {
- do_seq_ipo(seq, cfra);
- fac= seq->facf0;
- facf= seq->facf1;
- } else {
- sh.get_default_fac(seq, cfra, &fac, &facf);
- }
-
- if( G.scene->r.mode & R_FIELDS ); else facf= fac;
-
- early_out = sh.early_out(seq, fac, facf);
- switch (early_out) {
- case -1:
- /* no input needed */
- break;
- case 0:
- se->se1 = do_build_seq_recursively(seq->seq1, cfra);
- se->se2 = do_build_seq_recursively(seq->seq2, cfra);
- if (seq->seq3) {
- se->se3 = do_build_seq_recursively(seq->seq3, cfra);
- }
- break;
- case 1:
- se->se1 = do_build_seq_recursively(seq->seq1, cfra);
- break;
- case 2:
- se->se2 = do_build_seq_recursively(seq->seq2, cfra);
- break;
- }
-
-
- do_build_seq_ibuf(seq, se, cfra);
-
- /* children are not needed anymore ... */
-
- if (se->se1 && se->se1->ibuf) {
- IMB_cache_limiter_unref(se->se1->ibuf);
- }
- if (se->se2 && se->se2->ibuf) {
- IMB_cache_limiter_unref(se->se2->ibuf);
- }
- if (se->se3 && se->se3->ibuf) {
- IMB_cache_limiter_unref(se->se3->ibuf);
- }
-}
-
-static TStripElem* do_build_seq_recursively_impl(Sequence * seq, int cfra)
-{
- TStripElem *se;
-
- se = give_tstripelem(seq, cfra);
-
- if(se) {
- if (seq->type & SEQ_EFFECT) {
- do_effect_seq_recursively(seq, se, cfra);
- } else {
- do_build_seq_ibuf(seq, se, cfra);
- }
- }
- return se;
-}
-
-/* FIXME:
-
-If cfra was float throughout blender (especially in the render
-pipeline) one could even _render_ with subframe precision
-instead of faking using the blend code below...
-
-*/
-
-static TStripElem* do_handle_speed_effect(Sequence * seq, int cfra)
-{
- SpeedControlVars * s = (SpeedControlVars *)seq->effectdata;
- int nr = cfra - seq->start;
- float f_cfra;
- int cfra_left;
- int cfra_right;
- TStripElem * se = 0;
- TStripElem * se1 = 0;
- TStripElem * se2 = 0;
-
- sequence_effect_speed_rebuild_map(seq, 0);
-
- f_cfra = seq->start + s->frameMap[nr];
-
- cfra_left = (int) floor(f_cfra);
- cfra_right = (int) ceil(f_cfra);
-
- se = give_tstripelem(seq, cfra);
-
- if (cfra_left == cfra_right ||
- (s->flags & SEQ_SPEED_BLEND) == 0) {
- if(se->ibuf) {
- if(se->ibuf->x < seqrectx || se->ibuf->y < seqrecty
- || !(se->ibuf->rect || se->ibuf->rect_float)) {
- IMB_freeImBuf(se->ibuf);
- se->ibuf= 0;
- }
- }
-
- if (se->ibuf == NULL) {
- se1 = do_build_seq_recursively_impl(
- seq->seq1, cfra_left);
-
- if((se1 && se1->ibuf && se1->ibuf->rect_float))
- se->ibuf= IMB_allocImBuf((short)seqrectx, (short)seqrecty, 32, IB_rectfloat, 0);
- else
- se->ibuf= IMB_allocImBuf((short)seqrectx, (short)seqrecty, 32, IB_rect, 0);
-
- if (se1 == 0 || se1->ibuf == 0) {
- make_black_ibuf(se->ibuf);
- } else {
- if (se->ibuf != se1->ibuf) {
- if (se->ibuf) {
- IMB_freeImBuf(se->ibuf);
- }
-
- se->ibuf = se1->ibuf;
- IMB_refImBuf(se->ibuf);
- }
- }
- }
- } else {
- struct SeqEffectHandle sh;
-
- if(se->ibuf) {
- if(se->ibuf->x < seqrectx || se->ibuf->y < seqrecty
- || !(se->ibuf->rect || se->ibuf->rect_float)) {
- IMB_freeImBuf(se->ibuf);
- se->ibuf= 0;
- }
- }
-
- if (se->ibuf == NULL) {
- se1 = do_build_seq_recursively_impl(
- seq->seq1, cfra_left);
- se2 = do_build_seq_recursively_impl(
- seq->seq1, cfra_right);
-
- if((se1 && se1->ibuf && se1->ibuf->rect_float))
- se->ibuf= IMB_allocImBuf((short)seqrectx, (short)seqrecty, 32, IB_rectfloat, 0);
- else
- se->ibuf= IMB_allocImBuf((short)seqrectx, (short)seqrecty, 32, IB_rect, 0);
-
- if (!se1 || !se2) {
- make_black_ibuf(se->ibuf);
- } else {
- sh = get_sequence_effect(seq);
-
- sh.execute(seq, cfra,
- f_cfra - (float) cfra_left,
- f_cfra - (float) cfra_left,
- se->ibuf->x, se->ibuf->y,
- se1->ibuf, se2->ibuf, 0, se->ibuf);
- }
- }
-
- }
-
- /* caller expects this to be referenced, so do it! */
- if (se->ibuf) {
- IMB_cache_limiter_insert(se->ibuf);
- IMB_cache_limiter_ref(se->ibuf);
- IMB_cache_limiter_touch(se->ibuf);
- }
-
- /* children are no longer needed */
- if (se1 && se1->ibuf)
- IMB_cache_limiter_unref(se1->ibuf);
- if (se2 && se2->ibuf)
- IMB_cache_limiter_unref(se2->ibuf);
-
- return se;
-}
-
-/*
- * build all ibufs recursively
- *
- * if successfull, the returned TStripElem contains the (referenced!) imbuf
- * that means: you _must_ call
- *
- * IMB_cache_limiter_unref(rval);
- *
- * if rval != 0
- *
- */
-
-static TStripElem* do_build_seq_recursively(Sequence * seq, int cfra)
-{
- if (seq->type == SEQ_SPEED) {
- return do_handle_speed_effect(seq, cfra);
- } else {
- return do_build_seq_recursively_impl(seq, cfra);
- }
-}
-
-/*
- * returned ImBuf is refed!
- * you have to unref after usage!
- */
-
-static ImBuf *give_ibuf_seq_impl(int rectx, int recty, int cfra, int chanshown)
-{
- Sequence *seqfirst=0;
- Editing *ed;
- int count;
- ListBase *seqbasep;
- TStripElem *se;
-
- ed= G.scene->ed;
- if(ed==0) return 0;
-
- count = BLI_countlist(&ed->metastack);
- if((chanshown < 0) && (count > 0)) {
- count = MAX2(count + chanshown, 0);
- seqbasep= ((MetaStack*)BLI_findlink(&ed->metastack, count))->oldbasep;
- } else {
- seqbasep= ed->seqbasep;
- }
-
- seqrectx= rectx; /* bad bad global! */
- seqrecty= recty;
-
- seqfirst = get_shown_sequence(seqbasep, cfra, chanshown);
-
- if (!seqfirst) {
- return 0;
- }
-
- se = do_build_seq_recursively(seqfirst, cfra);
-
- if(!se) {
- return 0;
- }
-
- return se->ibuf;
-}
-
-ImBuf *give_ibuf_seq_direct(int rectx, int recty, int cfra,
- Sequence * seq)
-{
- TStripElem* se;
-
- seqrectx= rectx; /* bad bad global! */
- seqrecty= recty;
-
- se = do_build_seq_recursively(seq, cfra);
-
- if(!se) {
- return 0;
- }
-
- if (se->ibuf) {
- IMB_cache_limiter_unref(se->ibuf);
- }
-
- return se->ibuf;
-}
-
-ImBuf *give_ibuf_seq(int rectx, int recty, int cfra, int chanshown)
-{
- ImBuf* i = give_ibuf_seq_impl(rectx, recty, cfra, chanshown);
-
- if (i) {
- IMB_cache_limiter_unref(i);
- }
- return i;
-}
-
-/* threading api */
-
-static ListBase running_threads;
-static ListBase prefetch_wait;
-static ListBase prefetch_done;
-
-static pthread_mutex_t queue_lock = PTHREAD_MUTEX_INITIALIZER;
-static pthread_mutex_t wakeup_lock = PTHREAD_MUTEX_INITIALIZER;
-static pthread_cond_t wakeup_cond = PTHREAD_COND_INITIALIZER;
-
-static pthread_mutex_t prefetch_ready_lock = PTHREAD_MUTEX_INITIALIZER;
-static pthread_cond_t prefetch_ready_cond = PTHREAD_COND_INITIALIZER;
-
-static pthread_mutex_t frame_done_lock = PTHREAD_MUTEX_INITIALIZER;
-static pthread_cond_t frame_done_cond = PTHREAD_COND_INITIALIZER;
-
-static volatile int seq_thread_shutdown = FALSE;
-static volatile int seq_last_given_monoton_cfra = 0;
-static int monoton_cfra = 0;
-
-typedef struct PrefetchThread {
- struct PrefetchThread *next, *prev;
- struct PrefetchQueueElem *current;
- pthread_t pthread;
- int running;
-} PrefetchThread;
-
-typedef struct PrefetchQueueElem {
- struct PrefetchQueueElem *next, *prev;
-
- int rectx;
- int recty;
- int cfra;
- int chanshown;
-
- int monoton_cfra;
-
- struct ImBuf * ibuf;
-} PrefetchQueueElem;
-
-static void * seq_prefetch_thread(void * This_)
-{
- PrefetchThread * This = This_;
-
- while (!seq_thread_shutdown) {
- PrefetchQueueElem * e;
- int s_last;
-
- pthread_mutex_lock(&queue_lock);
- e = prefetch_wait.first;
- if (e) {
- BLI_remlink(&prefetch_wait, e);
- }
- s_last = seq_last_given_monoton_cfra;
-
- This->current = e;
-
- pthread_mutex_unlock(&queue_lock);
-
- if (!e) {
- pthread_mutex_lock(&prefetch_ready_lock);
-
- This->running = FALSE;
-
- pthread_cond_signal(&prefetch_ready_cond);
- pthread_mutex_unlock(&prefetch_ready_lock);
-
- pthread_mutex_lock(&wakeup_lock);
- if (!seq_thread_shutdown) {
- pthread_cond_wait(&wakeup_cond, &wakeup_lock);
- }
- pthread_mutex_unlock(&wakeup_lock);
- continue;
- }
-
- This->running = TRUE;
-
- if (e->cfra >= s_last) {
- e->ibuf = give_ibuf_seq_impl(
- e->rectx, e->recty, e->cfra, e->chanshown);
- }
-
- pthread_mutex_lock(&queue_lock);
-
- BLI_addtail(&prefetch_done, e);
-
- for (e = prefetch_wait.first; e; e = e->next) {
- if (s_last > e->monoton_cfra) {
- BLI_remlink(&prefetch_wait, e);
- MEM_freeN(e);
- }
- }
-
- for (e = prefetch_done.first; e; e = e->next) {
- if (s_last > e->monoton_cfra) {
- if (e->ibuf) {
- IMB_cache_limiter_unref(e->ibuf);
- }
- BLI_remlink(&prefetch_done, e);
- MEM_freeN(e);
- }
- }
-
- pthread_mutex_unlock(&queue_lock);
-
- pthread_mutex_lock(&frame_done_lock);
- pthread_cond_signal(&frame_done_cond);
- pthread_mutex_unlock(&frame_done_lock);
- }
- return 0;
-}
-
-void seq_start_threads()
-{
- int i;
-
- running_threads.first = running_threads.last = NULL;
- prefetch_wait.first = prefetch_wait.last = NULL;
- prefetch_done.first = prefetch_done.last = NULL;
-
- seq_thread_shutdown = FALSE;
- seq_last_given_monoton_cfra = monoton_cfra = 0;
-
- /* since global structures are modified during the processing
- of one frame, only one render thread is currently possible...
-
- (but we code, in the hope, that we can remove this restriction
- soon...)
- */
-
- fprintf(stderr, "SEQ-THREAD: seq_start_threads\n");
-
- for (i = 0; i < 1; i++) {
- PrefetchThread *t = MEM_callocN(sizeof(PrefetchThread),
- "prefetch_thread");
- t->running = TRUE;
- BLI_addtail(&running_threads, t);
-
- pthread_create(&t->pthread, NULL, seq_prefetch_thread, t);
- }
-
- /* init malloc mutex */
- BLI_init_threads(0, 0, 0);
-}
-
-void seq_stop_threads()
-{
- PrefetchThread *tslot;
- PrefetchQueueElem * e;
-
- fprintf(stderr, "SEQ-THREAD: seq_stop_threads()\n");
-
- if (seq_thread_shutdown) {
- fprintf(stderr, "SEQ-THREAD: ... already stopped\n");
- return;
- }
-
- pthread_mutex_lock(&wakeup_lock);
-
- seq_thread_shutdown = TRUE;
-
- pthread_cond_broadcast(&wakeup_cond);
- pthread_mutex_unlock(&wakeup_lock);
-
- for(tslot = running_threads.first; tslot; tslot= tslot->next) {
- pthread_join(tslot->pthread, NULL);
- }
-
-
- for (e = prefetch_wait.first; e; e = e->next) {
- BLI_remlink(&prefetch_wait, e);
- MEM_freeN(e);
- }
-
- for (e = prefetch_done.first; e; e = e->next) {
- if (e->ibuf) {
- IMB_cache_limiter_unref(e->ibuf);
- }
- BLI_remlink(&prefetch_done, e);
- MEM_freeN(e);
- }
-
- BLI_freelistN(&running_threads);
-
- /* deinit malloc mutex */
- BLI_end_threads(0);
-}
-
-void give_ibuf_prefetch_request(int rectx, int recty, int cfra, int chanshown)
-{
- PrefetchQueueElem * e;
- if (seq_thread_shutdown) {
- return;
- }
-
- e = MEM_callocN(sizeof(PrefetchQueueElem), "prefetch_queue_elem");
- e->rectx = rectx;
- e->recty = recty;
- e->cfra = cfra;
- e->chanshown = chanshown;
- e->monoton_cfra = monoton_cfra++;
-
- pthread_mutex_lock(&queue_lock);
- BLI_addtail(&prefetch_wait, e);
- pthread_mutex_unlock(&queue_lock);
-
- pthread_mutex_lock(&wakeup_lock);
- pthread_cond_signal(&wakeup_cond);
- pthread_mutex_unlock(&wakeup_lock);
-}
-
-void seq_wait_for_prefetch_ready()
-{
- PrefetchThread *tslot;
-
- if (seq_thread_shutdown) {
- return;
- }
-
- fprintf(stderr, "SEQ-THREAD: rendering prefetch frames...\n");
-
- pthread_mutex_lock(&prefetch_ready_lock);
-
- for(;;) {
- for(tslot = running_threads.first; tslot; tslot= tslot->next) {
- if (tslot->running) {
- break;
- }
- }
- if (!tslot) {
- break;
- }
- pthread_cond_wait(&prefetch_ready_cond, &prefetch_ready_lock);
- }
-
- pthread_mutex_unlock(&prefetch_ready_lock);
-
- fprintf(stderr, "SEQ-THREAD: prefetch done\n");
-}
-
-ImBuf * give_ibuf_seq_threaded(int rectx, int recty, int cfra, int chanshown)
-{
- PrefetchQueueElem * e = 0;
- int found_something = FALSE;
-
- if (seq_thread_shutdown) {
- return give_ibuf_seq(rectx, recty, cfra, chanshown);
- }
-
- while (!e) {
- int success = FALSE;
- pthread_mutex_lock(&queue_lock);
-
- for (e = prefetch_done.first; e; e = e->next) {
- if (cfra == e->cfra &&
- chanshown == e->chanshown &&
- rectx == e->rectx &&
- recty == e->recty) {
- success = TRUE;
- found_something = TRUE;
- break;
- }
- }
-
- if (!e) {
- for (e = prefetch_wait.first; e; e = e->next) {
- if (cfra == e->cfra &&
- chanshown == e->chanshown &&
- rectx == e->rectx &&
- recty == e->recty) {
- found_something = TRUE;
- break;
- }
- }
- }
-
- if (!e) {
- PrefetchThread *tslot;
-
- for(tslot = running_threads.first;
- tslot; tslot= tslot->next) {
- if (tslot->current &&
- cfra == tslot->current->cfra &&
- chanshown == tslot->current->chanshown &&
- rectx == tslot->current->rectx &&
- recty == tslot->current->recty) {
- found_something = TRUE;
- break;
- }
- }
- }
-
- /* e->ibuf is unrefed by render thread on next round. */
-
- if (e) {
- seq_last_given_monoton_cfra = e->monoton_cfra;
- }
-
- pthread_mutex_unlock(&queue_lock);
-
- if (!success) {
- e = NULL;
-
- if (!found_something) {
- fprintf(stderr,
- "SEQ-THREAD: Requested frame "
- "not in queue ???\n");
- break;
- }
- pthread_mutex_lock(&frame_done_lock);
- pthread_cond_wait(&frame_done_cond, &frame_done_lock);
- pthread_mutex_unlock(&frame_done_lock);
- }
- }
-
- return e ? e->ibuf : 0;
-}
-
-/* Functions to free imbuf and anim data on changes */
-
-static void free_imbuf_strip_elem(TStripElem *se)
-{
- if (se->ibuf) {
- if (se->ok != STRIPELEM_META && se->ibuf != 0)
- IMB_freeImBuf(se->ibuf);
- se->ibuf= 0;
- se->ok= STRIPELEM_OK;
- se->se1= se->se2= se->se3= 0;
- }
-}
-
-static void free_anim_seq(Sequence *seq)
-{
- if(seq->anim) {
- IMB_free_anim(seq->anim);
- seq->anim = 0;
- }
-}
-
-void free_imbuf_seq_except(int cfra)
-{
- Editing *ed= G.scene->ed;
- Sequence *seq;
- TStripElem *se;
- int a;
-
- if(ed==0) return;
-
- WHILE_SEQ(&ed->seqbase) {
- if(seq->strip) {
- TStripElem * curelem = give_tstripelem(seq, cfra);
-
- for(a=0, se= seq->strip->tstripdata; a<seq->len; a++, se++)
- if(se != curelem)
- free_imbuf_strip_elem(se);
-
- if(seq->type==SEQ_MOVIE)
- if(seq->startdisp > cfra || seq->enddisp < cfra)
- free_anim_seq(seq);
- }
- }
- END_SEQ
-}
-
-void free_imbuf_seq()
-{
- Editing *ed= G.scene->ed;
- Sequence *seq;
- TStripElem *se;
- int a;
-
- if(ed==0) return;
-
- WHILE_SEQ(&ed->seqbase) {
- if(seq->strip) {
- if (seq->strip->tstripdata) {
- for(a=0, se= seq->strip->tstripdata; a<seq->len; a++, se++)
- free_imbuf_strip_elem(se);
- }
-
- if(seq->type==SEQ_MOVIE)
- free_anim_seq(seq);
- if(seq->type==SEQ_SPEED) {
- sequence_effect_speed_rebuild_map(seq, 1);
- }
- }
- }
- END_SEQ
-}
-
-void free_imbuf_seq_with_ipo(struct Ipo *ipo)
-{
- /* force update of all sequences with this ipo, on ipo changes */
- Editing *ed= G.scene->ed;
- Sequence *seq;
-
- if(ed==0) return;
-
- WHILE_SEQ(&ed->seqbase) {
- if(seq->ipo == ipo) {
- update_changed_seq_and_deps(seq, 0, 1);
- if(seq->type == SEQ_SPEED) {
- sequence_effect_speed_rebuild_map(seq, 1);
- }
- }
- }
- END_SEQ
-}
-
-static int update_changed_seq_recurs(Sequence *seq, Sequence *changed_seq, int len_change, int ibuf_change)
-{
- Sequence *subseq;
- int a, free_imbuf = 0;
- TStripElem *se;
-
- /* recurs downwards to see if this seq depends on the changed seq */
-
- if(seq == NULL)
- return 0;
-
- if(seq == changed_seq)
- free_imbuf = 1;
-
- for(subseq=seq->seqbase.first; subseq; subseq=subseq->next)
- if(update_changed_seq_recurs(subseq, changed_seq, len_change, ibuf_change))
- free_imbuf = TRUE;
-
- if(seq->seq1)
- if(update_changed_seq_recurs(seq->seq1, changed_seq, len_change, ibuf_change))
- free_imbuf = TRUE;
- if(seq->seq2 && (seq->seq2 != seq->seq1))
- if(update_changed_seq_recurs(seq->seq2, changed_seq, len_change, ibuf_change))
- free_imbuf = TRUE;
- if(seq->seq3 && (seq->seq3 != seq->seq1) && (seq->seq3 != seq->seq2))
- if(update_changed_seq_recurs(seq->seq3, changed_seq, len_change, ibuf_change))
- free_imbuf = TRUE;
-
- if(free_imbuf) {
- if(ibuf_change) {
- se= seq->strip->tstripdata;
- if (se) {
- for(a=0; a<seq->len; a++, se++)
- free_imbuf_strip_elem(se);
- }
-
- if(seq->type == SEQ_MOVIE)
- free_anim_seq(seq);
- if(seq->type == SEQ_SPEED) {
- sequence_effect_speed_rebuild_map(seq, 1);
- }
- }
-
- if(len_change)
- calc_sequence(seq);
- }
-
- return free_imbuf;
-}
-
-void update_changed_seq_and_deps(Sequence *changed_seq, int len_change, int ibuf_change)
-{
- Editing *ed= G.scene->ed;
- Sequence *seq;
-
- if (!ed) return;
-
- for (seq=ed->seqbase.first; seq; seq=seq->next)
- update_changed_seq_recurs(seq, changed_seq, len_change, ibuf_change);
-}
-
-/* bad levell call... */
-void do_render_seq(RenderResult *rr, int cfra)
-{
- ImBuf *ibuf;
-
- G.f |= G_PLAYANIM; /* waitcursor patch */
-
- ibuf= give_ibuf_seq(rr->rectx, rr->recty, cfra, 0);
-
- if(ibuf) {
- if(ibuf->rect_float) {
- if (!rr->rectf)
- rr->rectf= MEM_mallocN(4*sizeof(float)*rr->rectx*rr->recty, "render_seq rectf");
-
- memcpy(rr->rectf, ibuf->rect_float, 4*sizeof(float)*rr->rectx*rr->recty);
-
- /* TSK! Since sequence render doesn't free the *rr render result, the old rect32
- can hang around when sequence render has rendered a 32 bits one before */
- if(rr->rect32) {
- MEM_freeN(rr->rect32);
- rr->rect32= NULL;
- }
- }
- else if(ibuf->rect) {
- if (!rr->rect32)
- rr->rect32= MEM_mallocN(sizeof(int)*rr->rectx*rr->recty, "render_seq rect");
-
- memcpy(rr->rect32, ibuf->rect, 4*rr->rectx*rr->recty);
-
- /* if (ibuf->zbuf) { */
- /* if (R.rectz) freeN(R.rectz); */
- /* R.rectz = BLI_dupallocN(ibuf->zbuf); */
- /* } */
- }
-
- /* Let the cache limitor take care of this (schlaile) */
- /* While render let's keep all memory available for render
- (ton)
- At least if free memory is tight...
- This can make a big difference in encoding speed
- (it is around 4 times(!) faster, if we do not waste time
- on freeing _all_ buffers every time on long timelines...)
- (schlaile)
- */
- {
- extern int mem_in_use;
- extern int mmap_in_use;
-
- int max = MEM_CacheLimiter_get_maximum();
- if (max != 0 && mem_in_use + mmap_in_use > max) {
- fprintf(stderr, "mem_in_use = %d, max = %d\n",
- mem_in_use + mmap_in_use, max);
- fprintf(stderr, "Cleaning up, please wait...\n"
- "If this happens very often,\n"
- "consider "
- "raising the memcache limit in the "
- "user preferences.\n");
- free_imbuf_seq();
- }
- }
- }
- else {
- /* render result is delivered empty in most cases, nevertheless we handle all cases */
- if (rr->rectf)
- memset(rr->rectf, 0, 4*sizeof(float)*rr->rectx*rr->recty);
- else if (rr->rect32)
- memset(rr->rect32, 0, 4*rr->rectx*rr->recty);
- else
- rr->rect32= MEM_callocN(sizeof(int)*rr->rectx*rr->recty, "render_seq rect");
- }
-
- G.f &= ~G_PLAYANIM;
-
-}
diff --git a/source/blender/src/space.c b/source/blender/src/space.c
deleted file mode 100644
index 2e560b05228..00000000000
--- a/source/blender/src/space.c
+++ /dev/null
@@ -1,6678 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- *
- *
- * - here initialize and free and handling SPACE data
- */
-
-#include <string.h>
-#include <stdio.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-#include "MEM_CacheLimiterC-Api.h"
-
-#ifdef INTERNATIONAL
-#include "BIF_language.h"
-#endif
-
-#include "IMB_imbuf_types.h"
-#include "IMB_imbuf.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_gsqueue.h"
-#include "BLI_linklist.h"
-
-#include "DNA_action_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_group_types.h" /* used for select_same_group */
-#include "DNA_image_types.h"
-#include "DNA_ipo_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_modifier_types.h" /* used for select grouped hooks */
-#include "DNA_object_types.h"
-#include "DNA_particle_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_sequence_types.h"
-#include "DNA_sound_types.h"
-#include "DNA_space_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_view2d_types.h"
-#include "DNA_view3d_types.h"
-
-#include "BKE_blender.h"
-#include "BKE_colortools.h"
-#include "BKE_curve.h"
-#include "BKE_depsgraph.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_displist.h"
-#include "BKE_global.h"
-#include "BKE_group.h"
-#include "BKE_ipo.h"
-#include "BKE_main.h"
-#include "BKE_mesh.h"
-#include "BKE_node.h"
-#include "BKE_scene.h"
-#include "BKE_texture.h"
-#include "BKE_utildefines.h"
-#include "BKE_image.h" /* for IMA_TYPE_COMPOSITE and IMA_TYPE_R_RESULT */
-#include "BKE_particle.h"
-
-#include "BIF_spacetypes.h" /* first, nasty dependency with typedef */
-
-#include "BIF_butspace.h"
-#include "BIF_drawimage.h"
-#include "BIF_drawseq.h"
-#include "BIF_drawtext.h"
-#include "BIF_drawscript.h"
-#include "BIF_editarmature.h"
-#include "BIF_editparticle.h"
-#include "BIF_editconstraint.h"
-#include "BIF_editdeform.h"
-#include "BIF_editfont.h"
-#include "BIF_editgroup.h"
-#include "BIF_editkey.h"
-#include "BIF_editlattice.h"
-#include "BIF_editmesh.h"
-#include "BIF_editmode_undo.h"
-#include "BIF_editnla.h"
-#include "BIF_editoops.h"
-#include "BIF_editseq.h"
-#include "BIF_editsima.h"
-#include "BIF_editsound.h"
-#include "BIF_editview.h"
-#include "BIF_filelist.h"
-#include "BIF_gl.h"
-#include "BIF_imasel.h"
-#include "BIF_interface.h"
-#include "BIF_interface_icons.h"
-#include "BIF_meshtools.h"
-#include "BIF_mywindow.h"
-#include "BIF_oops.h"
-#include "BIF_poseobject.h"
-#include "BIF_outliner.h"
-#include "BIF_resources.h"
-#include "BIF_retopo.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toets.h"
-#include "BIF_toolbox.h"
-#include "BIF_usiblender.h"
-#include "BIF_previewrender.h"
-
-#include "BSE_edit.h"
-#include "BSE_view.h"
-#include "BSE_editipo.h"
-#include "BSE_drawipo.h"
-#include "BSE_drawview.h"
-#include "BSE_drawnla.h"
-#include "BSE_filesel.h"
-#include "BSE_headerbuttons.h"
-#include "BSE_editnla_types.h"
-#include "BSE_time.h"
-#include "BSE_trans_types.h"
-
-#include "BDR_vpaint.h"
-#include "BDR_editmball.h"
-#include "BDR_editobject.h"
-#include "BDR_editcurve.h"
-#include "BDR_editface.h"
-#include "BDR_drawmesh.h"
-#include "BDR_drawobject.h"
-#include "BDR_imagepaint.h"
-#include "BDR_sculptmode.h"
-#include "BDR_unwrapper.h"
-
-#include "BLO_readfile.h" /* for BLO_blendhandle_close */
-
-#include "PIL_time.h"
-
-#include "BPY_extern.h"
-
-#include "butspace.h"
-#include "mydevice.h"
-#include "blendef.h"
-#include "datatoc.h"
-#include "multires.h"
-
-#include "BIF_transform.h"
-
-#include "BKE_depsgraph.h"
-
-#include "BSE_trans_types.h"
-
-#include "SYS_System.h" /* for the user def menu ... should move elsewhere. */
-
-/* maybe we need this defined somewhere else */
-extern void StartKetsjiShell(ScrArea *area, char* startscenename, struct Main* maggie, struct SpaceIpo* sipo,int always_use_expand_framing);
-extern void StartKetsjiShellSimulation(ScrArea *area, char* startscenename, struct Main* maggie, struct SpaceIpo* sipo,int always_use_expand_framing);/*rcruiz*/
-
-/**
- * When the mipmap setting changes, we want to redraw the view right
- * away to reflect this setting.
- */
-void space_mipmap_button_function(int event);
-
-void free_soundspace(SpaceSound *ssound);
-
-/* *************************************** */
-
-/* don't know yet how the handlers will evolve, for simplicity
- i choose for an array with eventcodes, this saves in a file!
- */
-void add_blockhandler(ScrArea *sa, short eventcode, short val)
-{
- SpaceLink *sl= sa->spacedata.first;
- short a;
-
- /* find empty spot */
- for(a=0; a<SPACE_MAXHANDLER; a+=2) {
- if( sl->blockhandler[a]==eventcode ) {
- sl->blockhandler[a+1]= val;
- break;
- }
- else if( sl->blockhandler[a]==0) {
- sl->blockhandler[a]= eventcode;
- sl->blockhandler[a+1]= val;
- break;
- }
- }
- if(a==SPACE_MAXHANDLER) printf("error; max (4) blockhandlers reached!\n");
-}
-
-void rem_blockhandler(ScrArea *sa, short eventcode)
-{
- SpaceLink *sl= sa->spacedata.first;
- short a;
-
- for(a=0; a<SPACE_MAXHANDLER; a+=2) {
- if( sl->blockhandler[a]==eventcode) {
- sl->blockhandler[a]= 0;
-
- /* specific free calls */
- if(eventcode==IMAGE_HANDLER_PREVIEW)
- image_preview_event(0);
- break;
- }
- }
-}
-
-void toggle_blockhandler(ScrArea *sa, short eventcode, short val)
-{
- SpaceLink *sl= sa->spacedata.first;
- short a, addnew=1;
-
- /* find if it exists */
- for(a=0; a<SPACE_MAXHANDLER; a+=2) {
- if( sl->blockhandler[a]==eventcode ) {
- sl->blockhandler[a]= 0;
-
- /* specific free calls */
- if(eventcode==VIEW3D_HANDLER_PREVIEW)
- BIF_view3d_previewrender_free(sa->spacedata.first);
- else if(eventcode==IMAGE_HANDLER_PREVIEW)
- image_preview_event(0);
-
- addnew= 0;
- }
- }
- if(addnew) {
- add_blockhandler(sa, eventcode, val);
-
- /* specific add new calls */
- if(eventcode==IMAGE_HANDLER_PREVIEW)
- image_preview_event(1);
- }
-}
-
-
-
-/* ************* SPACE: VIEW3D ************* */
-
-/* extern void drawview3dspace(ScrArea *sa, void *spacedata); BSE_drawview.h */
-
-
-void copy_view3d_lock(short val)
-{
- bScreen *sc;
- int bit;
-
- /* from G.scene copy to the other views */
- sc= G.main->screen.first;
-
- while(sc) {
- if(sc->scene==G.scene) {
- ScrArea *sa= sc->areabase.first;
- while(sa) {
- SpaceLink *sl= sa->spacedata.first;
- while(sl) {
- if(sl->spacetype==SPACE_OOPS && val==REDRAW) {
- if(sa->win) scrarea_queue_winredraw(sa);
- }
- else if(sl->spacetype==SPACE_VIEW3D) {
- View3D *vd= (View3D*) sl;
- if(vd->scenelock && vd->localview==0) {
- vd->lay= G.scene->lay;
- vd->camera= G.scene->camera;
-
- if(vd->camera==0 && vd->persp>1) vd->persp= 1;
-
- if( (vd->lay & vd->layact) == 0) {
- bit= 0;
- while(bit<32) {
- if(vd->lay & (1<<bit)) {
- vd->layact= 1<<bit;
- break;
- }
- bit++;
- }
- }
-
- if(val==REDRAW && vd==sa->spacedata.first) {
- if(sa->win) scrarea_queue_redraw(sa);
- }
- }
- }
- sl= sl->next;
- }
- sa= sa->next;
- }
- }
- sc= sc->id.next;
- }
-}
-
-void handle_view3d_around()
-{
- bScreen *sc;
-
- if ((U.uiflag & USER_LOCKAROUND)==0) return;
-
- /* copies from G.vd->around to other view3ds */
-
- sc= G.main->screen.first;
-
- while(sc) {
- if(sc->scene==G.scene) {
- ScrArea *sa= sc->areabase.first;
- while(sa) {
- SpaceLink *sl= sa->spacedata.first;
- while(sl) {
- if(sl->spacetype==SPACE_VIEW3D) {
- View3D *vd= (View3D*) sl;
- if (vd != G.vd) {
- vd->around= G.vd->around;
- if (G.vd->flag & V3D_ALIGN)
- vd->flag |= V3D_ALIGN;
- else
- vd->flag &= ~V3D_ALIGN;
- scrarea_queue_headredraw(sa);
- }
- }
- sl= sl->next;
- }
- sa= sa->next;
- }
- }
- sc= sc->id.next;
- }
-}
-
-void handle_view3d_lock()
-{
- if (G.vd != NULL && curarea != NULL ) {
- if(G.vd->localview==0 && G.vd->scenelock && curarea->spacetype==SPACE_VIEW3D) {
-
- /* copy to scene */
- G.scene->lay= G.vd->lay;
- G.scene->camera= G.vd->camera;
-
- copy_view3d_lock(REDRAW);
- }
- }
-}
-
-void space_set_commmandline_options(void) {
- SYS_SystemHandle syshandle;
- int a;
-
- if ( (syshandle = SYS_GetSystem()) ) {
- /* User defined settings */
- a= (U.gameflags & USER_VERTEX_ARRAYS);
- SYS_WriteCommandLineInt(syshandle, "vertexarrays", a);
-
- a= (U.gameflags & USER_DISABLE_SOUND);
- SYS_WriteCommandLineInt(syshandle, "noaudio", a);
-
- a= (U.gameflags & USER_DISABLE_MIPMAP);
- set_mipmap(!a);
- SYS_WriteCommandLineInt(syshandle, "nomipmap", a);
-
- /* File specific settings: */
- /* Only test the first one. These two are switched
- * simultaneously. */
- a= (G.fileflags & G_FILE_SHOW_FRAMERATE);
- SYS_WriteCommandLineInt(syshandle, "show_framerate", a);
- SYS_WriteCommandLineInt(syshandle, "show_profile", a);
-
- /* When in wireframe mode, always draw debug props. */
- if (G.vd) {
- a = ( (G.fileflags & G_FILE_SHOW_DEBUG_PROPS)
- || (G.vd->drawtype == OB_WIRE)
- || (G.vd->drawtype == OB_SOLID) );
- SYS_WriteCommandLineInt(syshandle, "show_properties", a);
- }
-
- a= (G.fileflags & G_FILE_SHOW_PHYSICS);
- SYS_WriteCommandLineInt(syshandle, "show_physics", a);
-
- a= (G.fileflags & G_FILE_ENABLE_ALL_FRAMES);
- SYS_WriteCommandLineInt(syshandle, "fixedtime", a);
-
- a= (G.fileflags & G_FILE_GAME_TO_IPO);
- SYS_WriteCommandLineInt(syshandle, "game2ipo", a);
-
- a=(G.fileflags & G_FILE_GAME_MAT);
- SYS_WriteCommandLineInt(syshandle, "blender_material", a);
- a=(G.fileflags & G_FILE_DIAPLAY_LISTS);
- SYS_WriteCommandLineInt(syshandle, "displaylists", a);
-
-
- }
-}
-
-#if GAMEBLENDER == 1
- /**
- * These two routines imported from the gameengine,
- * I suspect a lot of the resetting stuff is cruft
- * and can be removed, but it should be checked.
- */
-static void SaveState(void)
-{
- glPushAttrib(GL_ALL_ATTRIB_BITS);
-
- init_realtime_GL();
- init_gl_stuff();
-
- if(G.f & G_TEXTUREPAINT)
- texpaint_enable_mipmap();
-
- if(G.scene->camera==0 || G.scene->camera->type!=OB_CAMERA)
- error("no (correct) camera");
-
- waitcursor(1);
-}
-
-static void RestoreState(void)
-{
- if(G.f & G_TEXTUREPAINT)
- texpaint_disable_mipmap();
-
- curarea->win_swap = 0;
- curarea->head_swap=0;
- allqueue(REDRAWVIEW3D, 1);
- allqueue(REDRAWBUTSALL, 0);
- reset_slowparents();
- waitcursor(0);
- G.qual= 0;
- glPopAttrib();
-}
-
-static LinkNode *save_and_reset_all_scene_cfra(void)
-{
- LinkNode *storelist= NULL;
- Scene *sc;
-
- for (sc= G.main->scene.first; sc; sc= sc->id.next) {
- BLI_linklist_prepend(&storelist, (void*) (long) sc->r.cfra);
-
- /* why is this reset to 1 ?*/
- /* sc->r.cfra= 1;*/
-
- set_scene_bg(sc);
- }
-
- BLI_linklist_reverse(&storelist);
-
- return storelist;
-}
-
-static void restore_all_scene_cfra(LinkNode *storelist) {
- LinkNode *sc_store= storelist;
- Scene *sc;
-
- for (sc= G.main->scene.first; sc; sc= sc->id.next) {
- int stored_cfra= (long) sc_store->link;
-
- sc->r.cfra= stored_cfra;
- set_scene_bg(sc);
-
- sc_store= sc_store->next;
- }
-
- BLI_linklist_free(storelist, NULL);
-}
-#endif
-
-void start_game(void)
-{
-#if GAMEBLENDER == 1
-#ifndef NO_KETSJI
- Scene *sc, *startscene = G.scene;
- LinkNode *scene_cfra_store;
-
- /* XXX, silly code - the game engine can
- * access any scene through logic, so we try
- * to make sure each scene has a valid camera,
- * just in case the game engine tries to use it.
- *
- * Better would be to make a better routine
- * in the game engine for finding the camera.
- * - zr
- * Note: yes, this is all very badly hacked! (ton)
- */
- for (sc= G.main->scene.first; sc; sc= sc->id.next) {
- if (!sc->camera) {
- Base *base;
-
- for (base= sc->base.first; base; base= base->next)
- if (base->object->type==OB_CAMERA)
- break;
-
- sc->camera= base?base->object:NULL;
- }
- }
-
- /* these two lines make sure front and backbuffer are equal. for swapbuffers */
- markdirty_all();
- screen_swapbuffers();
-
- /* can start from header */
- mywinset(curarea->win);
-
- scene_cfra_store= save_and_reset_all_scene_cfra();
-
-
- /* game engine will do its own sounds. */
- sound_stop_all_sounds();
- sound_exit_audio();
-
- /* Before jumping into Ketsji, we configure some settings. */
- space_set_commmandline_options();
-
- SaveState();
- StartKetsjiShell(curarea, startscene->id.name+2, G.main,G.sipo, 1);
- RestoreState();
-
- /* Restart BPY - unload the game engine modules. */
- BPY_end_python();
- BPY_start_python(0, NULL); /* argc, argv stored there already */
- BPY_post_start_python(); /* userpref path and menus init */
-
- restore_all_scene_cfra(scene_cfra_store);
- set_scene_bg(startscene);
- scene_update_for_newframe(G.scene, G.scene->lay);
-
- if (G.flags & G_FILE_AUTOPLAY)
- exit_usiblender();
-
- /* groups could have changed ipo */
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWACTION, 0);
- allspace(REMAKEIPO, 0);
- allqueue(REDRAWIPO, 0);
-#endif
-#else
- notice("Game engine is disabled in this release!");
-#endif
-}
-
-void start_RBSimulation(void)
-{
-#if GAMEBLENDER == 1
-#ifndef NO_KETSJI
- Scene *sc, *startscene = G.scene;
- LinkNode *scene_cfra_store;
-
- /* XXX, silly code - the game engine can
- * access any scene through logic, so we try
- * to make sure each scene has a valid camera,
- * just in case the game engine tries to use it.
- *
- * Better would be to make a better routine
- * in the game engine for finding the camera.
- * - zr
- * Note: yes, this is all very badly hacked! (ton)
- */
- for (sc= G.main->scene.first; sc; sc= sc->id.next) {
- if (!sc->camera) {
- Base *base;
-
- for (base= sc->base.first; base; base= base->next)
- if (base->object->type==OB_CAMERA)
- break;
-
- sc->camera= base?base->object:NULL;
- }
- }
-
- /* these two lines make sure front and backbuffer are equal. for swapbuffers */
- markdirty_all();
- screen_swapbuffers();
-
- /* can start from header */
- mywinset(curarea->win);
-
- scene_cfra_store= save_and_reset_all_scene_cfra();
-
-
- /* game engine will do its own sounds. */
- sound_stop_all_sounds();
- sound_exit_audio();
-
- /* Before jumping into Ketsji, we configure some settings. */
- space_set_commmandline_options();
-
- SaveState();
- StartKetsjiShellSimulation(curarea, startscene->id.name+2, G.main,G.sipo, 1);
- RestoreState();
- /* Restart BPY - unload the game engine modules. */
- BPY_end_python();
- BPY_start_python(0, NULL); /* argc, argv stored there already */
- BPY_post_start_python(); /* userpref path and menus init */
-
- restore_all_scene_cfra(scene_cfra_store);
- set_scene_bg(startscene);
- scene_update_for_newframe(G.scene, G.scene->lay);
-
- if (G.flags & G_FILE_AUTOPLAY)
- exit_usiblender();
-
- /* groups could have changed ipo */
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWACTION, 0);
- allspace(REMAKEIPO, 0);
- allqueue(REDRAWIPO, 0);
-#endif
-#else
- notice("YOU NEED GAME ENGIEN TO RUN THE SIMULATION!");
-#endif
-}
-
-static void changeview3dspace(ScrArea *sa, void *spacedata)
-{
- setwinmatrixview3d(sa->winx, sa->winy, NULL); /* 0= no pick rect */
-}
-
- /* Callable from editmode and faceselect mode from the
- * moment, would be nice (and is easy) to generalize
- * to any mode.
- */
-static void align_view_to_selected(View3D *v3d)
-{
- int nr= pupmenu("Align View (Ctrl flips)%t|To Selected (top)%x3|To Selected (front)%x2|To Selected (side)%x1");
- if (nr!=-1) {
- int axis= nr;
-
- /* opposite axis in case ctrl is pressed */
- if(G.qual==LR_CTRLKEY) axis= -axis;
-
- if ((G.obedit) && (G.obedit->type == OB_MESH)) {
- editmesh_align_view_to_selected(v3d, axis);
- addqueue(v3d->area->win, REDRAW, 1);
- } else if (FACESEL_PAINT_TEST) {
- Object *obact= OBACT;
- if (obact && obact->type==OB_MESH) {
- Mesh *me= obact->data;
- faceselect_align_view_to_selected(v3d, me, axis);
- addqueue(v3d->area->win, REDRAW, 1);
- }
- }
- }
-}
-
-
-static short select_children(Object *ob, int recursive)
-{
- short changed = 0;
- Base *base;
-
- for (base= FIRSTBASE; base; base= base->next) {
- if (ob == base->object->parent) {
- if (BASE_SELECTABLE(base) && !(base->flag & SELECT)) {
- base->flag |= SELECT;
- base->object->flag |= SELECT;
- changed = 1;
- }
-
- if (recursive)
- changed |= select_children(base->object, 1);
- }
- }
- return changed;
-}
-
-static short select_parent(void) /* Makes parent active and de-selected OBACT */
-{
- short changed = 0;
- Base *base, *startbase, *basact=NULL, *oldbasact;
-
- if (!(OBACT) || !(OBACT->parent)) return 0;
- BASACT->flag &= (~SELECT);
- BASACT->object->flag &= (~SELECT);
- startbase= FIRSTBASE;
- if(BASACT && BASACT->next) startbase= BASACT->next;
- base = startbase;
- while(base) {
- if(base->object==BASACT->object->parent) { basact=base; break; }
- base=base->next;
- if(base==NULL) base= FIRSTBASE;
- if(base==startbase) break;
- }
- /* can be NULL if parent in other scene */
- if(basact && BASE_SELECTABLE(basact)) {
- oldbasact = BASACT;
- BASACT = basact;
- basact->flag |= SELECT;
-
- basact->object->flag= basact->flag;
-
- set_active_base(basact);
- changed = 1;
- }
- return changed;
-}
-
-
-#define GROUP_MENU_MAX 24
-static short select_same_group(Object *ob) /* Select objects in the same group as the active */
-{
- short changed = 0;
- Base *base;
- Group *group, *ob_groups[GROUP_MENU_MAX];
- char str[10 + (24*GROUP_MENU_MAX)];
- char *p = str;
- int group_count=0, menu, i;
-
- if (!ob)
- return 0;
-
- for ( group=G.main->group.first;
- group && group_count < GROUP_MENU_MAX;
- group=group->id.next
- ) {
- if (object_in_group (ob, group)) {
- ob_groups[group_count] = group;
- group_count++;
- }
- }
-
- if (!group_count)
- return 0;
-
- else if (group_count == 1) {
- group = ob_groups[0];
- for (base= FIRSTBASE; base; base= base->next) {
- if (BASE_SELECTABLE(base) && !(base->flag & SELECT) && object_in_group(base->object, group)) {
- base->flag |= SELECT;
- base->object->flag |= SELECT;
- changed = 1;
- }
- }
- return changed;
- }
-
- /* build the menu. */
- p += sprintf(str, "Groups%%t");
- for (i=0; i<group_count; i++) {
- group = ob_groups[i];
- p += sprintf (p, "|%s%%x%i", group->id.name+2, i);
- }
-
- menu = pupmenu (str);
- if (menu == -1)
- return 0;
-
- group = ob_groups[menu];
- for (base= FIRSTBASE; base; base= base->next) {
- if (!(base->flag & SELECT) && object_in_group(base->object, group)) {
- base->flag |= SELECT;
- base->object->flag |= SELECT;
- changed = 1;
- }
- }
- return changed;
-}
-
-static short select_object_hooks(Object *ob)
-{
- short changed = 0;
- Base *base;
- ModifierData *md;
- HookModifierData *hmd;
-
- if (!ob)
- return 0;
-
- for (md = ob->modifiers.first; md; md=md->next) {
- if (md->type==eModifierType_Hook) {
- hmd= (HookModifierData*) md;
- if (hmd->object && !(hmd->object->flag & SELECT)) {
- base= object_in_scene(hmd->object, G.scene);
- if (base && BASE_SELECTABLE(base)) {
- base->flag |= SELECT;
- base->object->flag |= SELECT;
- changed = 1;
- }
- }
- }
- }
- return changed;
-}
-
-/* Select objects woth the same parent as the active (siblings),
- * parent can be NULL also */
-static short select_same_parent(Object *ob)
-{
- short changed = 0;
- Base *base;
- if (!ob)
- return 0;
-
- for (base= FIRSTBASE; base; base= base->next) {
- if (BASE_SELECTABLE(base) && (base->object->parent==ob->parent) && !(base->flag & SELECT)) {
- base->flag |= SELECT;
- base->object->flag |= SELECT;
- changed = 1;
- }
- }
- return changed;
-}
-
-static short select_same_type(Object *ob)
-{
- short changed = 0;
- Base *base;
- if (!ob)
- return 0;
-
- for (base= FIRSTBASE; base; base= base->next) {
- if (BASE_SELECTABLE(base) && (base->object->type == ob->type) && !(base->flag & SELECT)) {
- base->flag |= SELECT;
- base->object->flag |= SELECT;
- changed = 1;
- }
- }
- return changed;
-}
-
-static short select_same_layer(Object *ob)
-{
- char changed = 0;
- Base *base = FIRSTBASE;
-
- if (!ob)
- return 0;
-
- while(base) {
- if (BASE_SELECTABLE(base) && (base->lay & ob->lay) && !(base->flag & SELECT)) {
- base->flag |= SELECT;
- base->object->flag |= SELECT;
- changed = 1;
- }
- base= base->next;
- }
- return changed;
-}
-
-static short select_same_index_object(Object *ob)
-{
- char changed = 0;
- Base *base = FIRSTBASE;
-
- if (!ob)
- return 0;
-
- while(base) {
- if (BASE_SELECTABLE(base) && (base->object->index == ob->index) && !(base->flag & SELECT)) {
- base->flag |= SELECT;
- base->object->flag |= SELECT;
- changed = 1;
- }
- base= base->next;
- }
- return changed;
-}
-
-void select_object_grouped(short nr)
-{
- short changed = 0;
- if(nr==1) changed = select_children(OBACT, 1);
- else if(nr==2) changed = select_children(OBACT, 0);
- else if(nr==3) changed = select_parent();
- else if(nr==4) changed = select_same_parent(OBACT);
- else if(nr==5) changed = select_same_type(OBACT);
- else if(nr==6) changed = select_same_layer(OBACT);
- else if(nr==7) changed = select_same_group(OBACT);
- else if(nr==8) changed = select_object_hooks(OBACT);
- else if(nr==9) changed = select_same_index_object(OBACT);
-
- if (changed) {
- countall();
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- allspace(REMAKEIPO, 0);
- allqueue(REDRAWIPO, 0);
- BIF_undo_push("Select Grouped");
- }
-}
-
-static void select_object_grouped_menu(void)
-{
- char *str;
- short nr;
-
- /* make menu string */
-
- str= MEM_mallocN(512, "groupmenu");
- strcpy(str, "Select Grouped%t|Children%x1|"
- "Immediate Children%x2|Parent%x3|"
- "Siblings (Shared Parent)%x4|"
- "Objects of Same Type%x5|"
- "Objects on Shared Layers%x6|"
- "Objects in Same Group%x7|"
- "Object Hooks%x8|Object PassIndex%x9");
-
- /* here we go */
-
- nr= pupmenu(str);
- MEM_freeN(str);
-
- select_object_grouped(nr);
-}
-
-void join_menu(void)
-{
- Object *ob= OBACT;
- if (G.obedit) {
- error("This data does not support joining in editmode");
- return;
- }
- if (!ob) {
- error("Can't join unless there is an active object");
- return;
- }
-
- if(ob->type == OB_MESH) {
- if(okee("Join selected meshes")==0) return;
- join_mesh();
- } else if(ob->type == OB_CURVE) {
- if(okee("Join selected curves")==0) return;
- join_curve(OB_CURVE);
- } else if(ob->type == OB_SURF) {
- if(okee("Join selected NURBS")==0) return;
- join_curve(OB_SURF);
- } else if(ob->type == OB_ARMATURE) {
- /* Make sure the user wants to continue*/
- if(okee("Join selected armatures")==0) return;
- join_armature ();
- } else {
- error("This object type doesn't support joining");
- }
-}
-
-static unsigned short convert_for_nonumpad(unsigned short event)
-{
- if (event>=ZEROKEY && event<=NINEKEY) {
- return event - ZEROKEY + PAD0;
- } else if (event==MINUSKEY) {
- return PADMINUS;
- } else if (event==EQUALKEY) {
- return PADPLUSKEY;
- } else if (event==BACKSLASHKEY) {
- return PADSLASHKEY;
- } else {
- return event;
- }
-}
-
-/* *************** */
-
-void BIF_undo_push(char *str)
-{
- if(G.obedit) {
- if (U.undosteps == 0) return;
-
- if(G.obedit->type==OB_MESH)
- undo_push_mesh(str);
- else if ELEM(G.obedit->type, OB_CURVE, OB_SURF)
- undo_push_curve(str);
- else if (G.obedit->type==OB_FONT)
- undo_push_font(str);
- else if (G.obedit->type==OB_MBALL)
- undo_push_mball(str);
- else if (G.obedit->type==OB_LATTICE)
- undo_push_lattice(str);
- else if (G.obedit->type==OB_ARMATURE)
- undo_push_armature(str);
- }
- else if(G.f & G_PARTICLEEDIT) {
- PE_undo_push(str);
- }
- else {
- if(U.uiflag & USER_GLOBALUNDO)
- BKE_write_undo(str);
- }
-}
-
-void BIF_undo(void)
-{
- if(G.obedit) {
- if ELEM7(G.obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE)
- undo_editmode_step(1);
- }
- else {
- if(G.f & G_TEXTUREPAINT)
- imagepaint_undo();
- else if(curarea->spacetype==SPACE_IMAGE && (G.sima->flag & SI_DRAWTOOL))
- imagepaint_undo();
- else if(G.f & G_PARTICLEEDIT)
- PE_undo();
- else {
- /* now also in faceselect mode */
- if(U.uiflag & USER_GLOBALUNDO) {
- BKE_undo_step(1);
- sound_initialize_sounds();
- }
- }
- }
-}
-
-void BIF_redo(void)
-{
- if(G.obedit) {
- if ELEM7(G.obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE)
- undo_editmode_step(-1);
- }
- else {
- if(G.f & G_TEXTUREPAINT)
- imagepaint_undo();
- else if(curarea->spacetype==SPACE_IMAGE && (G.sima->flag & SI_DRAWTOOL))
- imagepaint_undo();
- else if(G.f & G_PARTICLEEDIT)
- PE_redo();
- else {
- /* includes faceselect now */
- if(U.uiflag & USER_GLOBALUNDO) {
- BKE_undo_step(-1);
- sound_initialize_sounds();
- }
- }
- }
-}
-
-void BIF_undo_menu(void)
-{
- if(G.obedit) {
- if ELEM7(G.obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE)
- undo_editmode_menu();
- allqueue(REDRAWALL, 0);
- }
- else {
- if(G.f & G_PARTICLEEDIT)
- PE_undo_menu();
- else if(U.uiflag & USER_GLOBALUNDO) {
- char *menu= BKE_undo_menu_string();
- if(menu) {
- short event= pupmenu_col(menu, 20);
- MEM_freeN(menu);
- if(event>0) BKE_undo_number(event);
- }
- }
- }
-}
-
-/* *************** */
-
-void handle_view_middlemouse() {
- /* use '&' here, because of alt+leftmouse which emulates middlemouse */
- if(U.flag & USER_VIEWMOVE) {
- if((G.qual==LR_SHIFTKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_SHIFTKEY))))
- viewmove(0);
- else if((G.qual==LR_CTRLKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_CTRLKEY))))
- viewmove(2);
- else if((G.qual==0) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==LR_ALTKEY)))
- viewmove(1);
- }
- else {
- if((G.qual==LR_SHIFTKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_SHIFTKEY))))
- viewmove(1);
- else if((G.qual==LR_CTRLKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_CTRLKEY))))
- viewmove(2);
- else if((G.qual==0) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==LR_ALTKEY)))
- viewmove(0);
- }
-}
-
-void handle_view_wheelup()
-{
- /* Regular: Zoom in */
- /* Shift: Scroll up */
- /* Ctrl: Scroll right */
- /* Alt-Shift: Rotate up */
- /* Alt-Ctrl: Rotate right */
-
- if( G.qual & LR_SHIFTKEY ) {
- if( G.qual & LR_ALTKEY ) {
- G.qual &= ~LR_SHIFTKEY;
- persptoetsen(PAD2);
- G.qual |= LR_SHIFTKEY;
- } else {
- persptoetsen(PAD2);
- }
- } else if( G.qual & LR_CTRLKEY ) {
- if( G.qual & LR_ALTKEY ) {
- G.qual &= ~LR_CTRLKEY;
- persptoetsen(PAD4);
- G.qual |= LR_CTRLKEY;
- } else {
- persptoetsen(PAD4);
- }
- } else if(U.uiflag & USER_WHEELZOOMDIR)
- persptoetsen(PADMINUS);
- else
- persptoetsen(PADPLUSKEY);
-}
-
-void handle_view_wheeldown()
-{
- /* Regular: Zoom out */
- /* Shift: Scroll down */
- /* Ctrl: Scroll left */
- /* Alt-Shift: Rotate down */
- /* Alt-Ctrl: Rotate left */
-
- if( G.qual & LR_SHIFTKEY ) {
- if( G.qual & LR_ALTKEY ) {
- G.qual &= ~LR_SHIFTKEY;
- persptoetsen(PAD8);
- G.qual |= LR_SHIFTKEY;
- } else {
- persptoetsen(PAD8);
- }
- } else if( G.qual & LR_CTRLKEY ) {
- if( G.qual & LR_ALTKEY ) {
- G.qual &= ~LR_CTRLKEY;
- persptoetsen(PAD6);
- G.qual |= LR_CTRLKEY;
- } else {
- persptoetsen(PAD6);
- }
- } else if(U.uiflag & USER_WHEELZOOMDIR)
- persptoetsen(PADPLUSKEY);
- else
- persptoetsen(PADMINUS);
-}
-
-int mouse_in_header(ScrArea *sa)
-{
- short mouse[2];
- getmouseco_sc(mouse);
- return mouse[0] >= sa->headrct.xmin &&
- mouse[0] <= sa->headrct.xmax &&
- mouse[1] >= sa->headrct.ymin &&
- mouse[1] <= sa->headrct.ymax;
-}
-
-static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
-{
- View3D *v3d= sa->spacedata.first;
- Object *ob= OBACT; /* do not change! */
- float *curs;
- int doredraw= 0, pupval;
- unsigned short event= evt->event;
- short val= evt->val;
- char ascii= evt->ascii;
-
- if(curarea->win==0) return; /* when it comes from sa->headqread() */
-
- if(val) {
-
- if( uiDoBlocks(&curarea->uiblocks, event, 1)!=UI_NOTHING ) event= 0;
-
- if(event==UI_BUT_EVENT) do_butspace(val); /* temporal, view3d deserves own queue? */
-
- /* we consider manipulator a button, defaulting to leftmouse */
- if(event==LEFTMOUSE) if(BIF_do_manipulator(sa)) return;
-
- /* swap mouse buttons based on user preference */
- if (U.flag & USER_LMOUSESELECT) {
- /* only swap mouse button for selection, in modes where it is relevant.
- * painting/sculpting stays on LEFTMOUSE */
- if ( !((G.f & G_SCULPTMODE) || (G.f & G_WEIGHTPAINT) ||
- (G.f & G_VERTEXPAINT) || (G.f & G_TEXTUREPAINT) || (G.f & G_PARTICLEEDIT)) ||
- (G.obedit) )
- {
- if (event==LEFTMOUSE) event = RIGHTMOUSE;
- else if (event==RIGHTMOUSE) event = LEFTMOUSE;
- }
- }
-
- if(!mouse_in_header(sa)) {
- if(!G.obedit && (G.f & G_SCULPTMODE)) {
- SculptSession *ss= sculpt_session();
- if(ss && ss->propset) {
- sculptmode_propset(event);
- return;
- }
- else if(event!=LEFTMOUSE && event!=MIDDLEMOUSE && (event==MOUSEY || event==MOUSEX)) {
- if(!bwin_qtest(sa->win))
- allqueue(REDRAWVIEW3D, 0);
- }
- }
- else if(!G.obedit && OBACT && G.f&G_PARTICLEEDIT){
- ParticleSystem *psys=PE_get_current(OBACT);
- ParticleEditSettings *pset=PE_settings();
- if(psys && psys->edit){
- if(pset->brushtype>=0 &&
- event!=LEFTMOUSE && event!=RIGHTMOUSE && event!=MIDDLEMOUSE &&
- (event==MOUSEY || event==MOUSEX) && bwin_qtest(sa->win)==0) {
- allqueue(REDRAWVIEW3D, 0);
- }
- }
- }
-
- /* Handle retopo painting */
- if(retopo_mesh_paint_check()) {
- if(!retopo_paint(event))
- return;
- }
- }
-
- /* run any view3d event handler script links */
- if (event && sa->scriptlink.totscript)
- if (BPY_do_spacehandlers(sa, event, SPACEHANDLER_VIEW3D_EVENT))
- return; /* return if event was processed (swallowed) by handler(s) */
-
- /* TEXTEDITING?? */
- if((G.obedit) && G.obedit->type==OB_FONT) {
- switch(event) {
-
- case LEFTMOUSE:
- mouse_cursor();
- break;
- case MIDDLEMOUSE:
- /* use '&' here, because of alt+leftmouse which emulates middlemouse */
- if(U.flag & USER_VIEWMOVE) {
- if((G.qual==LR_SHIFTKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_SHIFTKEY))))
- viewmove(0);
- else if((G.qual==LR_CTRLKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_CTRLKEY))))
- viewmove(2);
- else if((G.qual==0) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==LR_ALTKEY)))
- viewmove(1);
- }
- else {
- if((G.qual==LR_SHIFTKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_SHIFTKEY))))
- viewmove(1);
- else if((G.qual==LR_CTRLKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_CTRLKEY))))
- viewmove(2);
- else
- viewmove(0);
- }
- break;
-
- case WHEELUPMOUSE:
- /* Regular: Zoom in */
- /* Shift: Scroll up */
- /* Ctrl: Scroll right */
- /* Alt-Shift: Rotate up */
- /* Alt-Ctrl: Rotate right */
-
- if( G.qual & LR_SHIFTKEY ) {
- if( G.qual & LR_ALTKEY ) {
- G.qual &= ~LR_SHIFTKEY;
- persptoetsen(PAD2);
- G.qual |= LR_SHIFTKEY;
- } else {
- persptoetsen(PAD2);
- }
- } else if( G.qual & LR_CTRLKEY ) {
- if( G.qual & LR_ALTKEY ) {
- G.qual &= ~LR_CTRLKEY;
- persptoetsen(PAD4);
- G.qual |= LR_CTRLKEY;
- } else {
- persptoetsen(PAD4);
- }
- } else if(U.uiflag & USER_WHEELZOOMDIR)
- persptoetsen(PADMINUS);
- else
- persptoetsen(PADPLUSKEY);
-
- doredraw= 1;
- break;
-
- case WHEELDOWNMOUSE:
- /* Regular: Zoom out */
- /* Shift: Scroll down */
- /* Ctrl: Scroll left */
- /* Alt-Shift: Rotate down */
- /* Alt-Ctrl: Rotate left */
-
- if( G.qual & LR_SHIFTKEY ) {
- if( G.qual & LR_ALTKEY ) {
- G.qual &= ~LR_SHIFTKEY;
- persptoetsen(PAD8);
- G.qual |= LR_SHIFTKEY;
- } else {
- persptoetsen(PAD8);
- }
- } else if( G.qual & LR_CTRLKEY ) {
- if( G.qual & LR_ALTKEY ) {
- G.qual &= ~LR_CTRLKEY;
- persptoetsen(PAD6);
- G.qual |= LR_CTRLKEY;
- } else {
- persptoetsen(PAD6);
- }
- } else if(U.uiflag & USER_WHEELZOOMDIR)
- persptoetsen(PADPLUSKEY);
- else
- persptoetsen(PADMINUS);
-
- doredraw= 1;
- break;
-
- case UKEY:
- if(G.qual==LR_ALTKEY) {
- remake_editText();
- doredraw= 1;
- }
- else {
- do_textedit(event, val, ascii);
- }
- break;
- case VKEY:
- if(G.qual==LR_ALTKEY) {
- paste_editText();
- doredraw= 1;
- }
- else {
- do_textedit(event, val, ascii);
- }
- break;
- case PAD0: case PAD1: case PAD2: case PAD3: case PAD4:
- case PAD5: case PAD6: case PAD7: case PAD8: case PAD9:
- case PADENTER:
- persptoetsen(event);
- doredraw= 1;
- break;
-
- default:
- do_textedit(event, val, ascii);
- break;
- }
- }
- else if(!G.obedit && (G.f & G_SCULPTMODE)) {
- SculptData *sd= sculpt_data();
- SculptSession *ss= sculpt_session();
- BrushData *br= sculptmode_brush();
- Mesh *me= get_mesh(OBACT);
- char update_prop= 0;
-
- if(U.flag & USER_NONUMPAD) {
- event= convert_for_nonumpad(event);
- }
-
- switch(event) {
- case LEFTMOUSE:
- if(G.qual==LR_SHIFTKEY+LR_CTRLKEY)
- sculptmode_pmv(0);
- else if(!(ss && ss->propset))
- sculpt();
- break;
- /* View */
- case MIDDLEMOUSE:
- handle_view_middlemouse();
- break;
- case WHEELUPMOUSE:
- handle_view_wheelup();
- doredraw= 1;
- break;
- case WHEELDOWNMOUSE:
- handle_view_wheeldown();
- doredraw= 1;
- break;
- case RIGHTMOUSE:
- if(G.qual==LR_SHIFTKEY+LR_CTRLKEY)
- sculptmode_pmv(1);
- break;
- case CKEY:
- if(G.qual==LR_SHIFTKEY) {
- view3d_home(1);
- curs= give_cursor();
- curs[0]=curs[1]=curs[2]= 0.0;
- allqueue(REDRAWVIEW3D, 0);
- }
- else if(G.qual==0) {
- if (G.vd->persp==2)
- /* center the camera offset */
- G.vd->camdx= G.vd->camdy= 0.0;
- else {
- /*non camera center*/
- float new_ofs[3];
- curs= give_cursor();
- new_ofs[0]= -curs[0];
- new_ofs[1]= -curs[1];
- new_ofs[2]= -curs[2];
- smooth_view(G.vd, new_ofs, NULL, NULL, NULL);
- }
- }
- doredraw= 1;
- break;
- case PAD0: case PAD1: case PAD2: case PAD3: case PAD4:
- case PAD5: case PAD6: case PAD7: case PAD8: case PAD9:
- case PADPLUSKEY:
- case PADMINUS:
- case PADENTER:
- persptoetsen(event);
- doredraw= 1;
- break;
- case BKEY:
- if(G.qual==LR_ALTKEY)
- view3d_edit_clipping(v3d);
- else if(G.qual==LR_SHIFTKEY) {
- if(G.vd->persp==2)
- set_render_border();
- else
- view3d_border_zoom();
- }
- break;
- case PADSLASHKEY:
- if(!G.qual) {
- if(G.vd->localview) {
- G.vd->localview= 0;
- endlocalview(curarea);
- }
- else {
- G.vd->localview= 1;
- initlocalview();
- }
- allqueue(REDRAWVIEW3D, 1);
- }
- break;
- /* Brush properties */
- case AKEY:
- br->airbrush= !br->airbrush;
- update_prop= 1; break;
- case FKEY:
- if(G.qual==0)
- sculptmode_propset_init(PropsetSize);
- if(G.qual==LR_SHIFTKEY)
- sculptmode_propset_init(PropsetStrength);
- if(G.qual==LR_CTRLKEY)
- sculptmode_propset_init(PropsetTexRot);
- break;
- case VKEY:
- br->dir= br->dir==1 ? 2 : 1;
- update_prop= 1; break;
- /* Set brush */
- case DKEY:
- sd->brush_type= DRAW_BRUSH;
- update_prop= 1; break;
- case SKEY:
- sd->brush_type= SMOOTH_BRUSH;
- update_prop= 1; break;
- case PKEY:
- sd->brush_type= PINCH_BRUSH;
- update_prop= 1; break;
- case IKEY:
- sd->brush_type= INFLATE_BRUSH;
- update_prop= 1; break;
- case GKEY:
- sd->brush_type= GRAB_BRUSH;
- update_prop= 1; break;
- case LKEY:
- sd->brush_type= LAYER_BRUSH;
- update_prop= 1; break;
- case TKEY:
- sd->brush_type= FLATTEN_BRUSH;
- update_prop= 1; break;
- /* Symmetry */
- case XKEY:
- sd->symm^= SYMM_X;
- update_prop= 1; break;
- case YKEY:
- sd->symm^= SYMM_Y;
- update_prop= 1; break;
- case ZKEY:
- sd->symm^= SYMM_Z;
- update_prop= 1; break;
- /* Interface */
- case NKEY:
- if(G.qual==0) {
- toggle_blockhandler(curarea, VIEW3D_HANDLER_OBJECT, UI_PNL_TO_MOUSE);
- allqueue(REDRAWVIEW3D, 0);
- }
- break;
- /* Multires */
- case PAGEUPKEY:
- if(me && me->mr) {
- me->mr->newlvl= ((Mesh*)ob->data)->mr->current+1;
- multires_set_level(ob, ob->data, 0);
- }
- break;
- case PAGEDOWNKEY:
- if(me && me->mr) {
- me->mr->newlvl= ((Mesh*)ob->data)->mr->current-1;
- multires_set_level(ob, ob->data, 0);
- }
- break;
- /* Partial Visibility */
- case HKEY:
- if(G.qual==LR_ALTKEY) {
- waitcursor(1);
- sculptmode_pmv_off(get_mesh(ob));
- BIF_undo_push("Partial mesh hide");
- allqueue(REDRAWVIEW3D,0);
- waitcursor(0);
- }
- break;
- /* Layers */
- case ONEKEY:
- do_layer_buttons(0); break;
- case TWOKEY:
- do_layer_buttons(1); break;
- case THREEKEY:
- do_layer_buttons(2); break;
- case FOURKEY:
- do_layer_buttons(3); break;
- case FIVEKEY:
- do_layer_buttons(4); break;
- case SIXKEY:
- do_layer_buttons(5); break;
- case SEVENKEY:
- do_layer_buttons(6); break;
- case EIGHTKEY:
- do_layer_buttons(7); break;
- case NINEKEY:
- do_layer_buttons(8); break;
- case ZEROKEY:
- do_layer_buttons(9); break;
- case MINUSKEY:
- do_layer_buttons(10); break;
- case EQUALKEY:
- do_layer_buttons(11); break;
- case ACCENTGRAVEKEY:
- do_layer_buttons(-1); break;
- }
-
- /* Redraw buttons window as well as view 3d (for floating panel) */
- if(update_prop) {
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- }
- } else {
-
- if (U.flag & USER_NONUMPAD) {
- event= convert_for_nonumpad(event);
- }
-
- switch(event) {
-
- /* Afterqueue events */
- case BACKBUFDRAW:
- backdrawview3d(1);
- break;
- case RENDERPREVIEW:
- BIF_view3d_previewrender(sa);
- break;
-
- case TABKEY:
- /* Shift-Tabe handling (other cases are in toets) */
- if (G.qual == LR_SHIFTKEY)
- {
- /* Snap toggle (only edit mesh right now) */
- if (G.obedit && G.obedit->type==OB_MESH)
- {
- G.scene->snap_flag ^= SCE_SNAP;
- allqueue(REDRAWHEADERS, 0);
- }
- }
- break;
-
- /* LEFTMOUSE and RIGHTMOUSE event codes can be swapped above,
- * based on user preference USER_LMOUSESELECT
- */
- case LEFTMOUSE:
- if ((G.obedit) || !(G.f&(G_VERTEXPAINT|G_WEIGHTPAINT|G_TEXTUREPAINT|G_PARTICLEEDIT))) {
- mouse_cursor();
- }
- else if (G.f & G_WEIGHTPAINT) {
- weight_paint();
- }
- else if (G.f & G_VERTEXPAINT) {
- vertex_paint();
- }
- else if (G.f & G_TEXTUREPAINT) {
- imagepaint_paint(L_MOUSE, 1);
- }
- else if (G.f & G_PARTICLEEDIT) {
- if(G.qual & LR_CTRLKEY)
- mouse_cursor();
- else if(!PE_brush_particles())
- mouse_cursor();
- }
- break;
- case MIDDLEMOUSE:
- handle_view_middlemouse();
- break;
- case RIGHTMOUSE:
- if((G.obedit) && (G.qual & LR_CTRLKEY)==0) {
- if(G.obedit->type==OB_MESH)
- mouse_mesh();
- else if ELEM(G.obedit->type, OB_CURVE, OB_SURF)
- mouse_nurb();
- else if(G.obedit->type==OB_MBALL)
- mouse_mball();
- else if(G.obedit->type==OB_LATTICE)
- mouse_lattice();
- else if(G.obedit->type==OB_ARMATURE)
- mouse_armature();
- }
- else if((G.obedit && G.obedit->type==OB_MESH) && (G.qual == (LR_CTRLKEY|LR_ALTKEY)))
- mouse_mesh(); /* loop select for 1 mousebutton dudes */
- else if((G.obedit && G.obedit->type==OB_MESH) && (G.qual == (LR_CTRLKEY|LR_ALTKEY|LR_SHIFTKEY)))
- mouse_mesh(); /* loop select for 1 mousebutton dudes */
- else if(G.qual==LR_CTRLKEY)
- mouse_select(); /* also allow in editmode, for vertex parenting */
- else if(FACESEL_PAINT_TEST)
- face_select();
- else if( G.f & (G_VERTEXPAINT|G_TEXTUREPAINT))
- sample_vpaint();
- else if( G.f & G_PARTICLEEDIT)
- PE_mouse_particles();
- else
- mouse_select(); /* does poses too */
- break;
- case WHEELUPMOUSE:
- handle_view_wheelup();
- doredraw= 1;
- break;
- case WHEELDOWNMOUSE:
- handle_view_wheeldown();
- doredraw= 1;
- break;
-
- case ONEKEY:
- if(G.qual==LR_CTRLKEY) {
- flip_subdivison(1);
- }
- else do_layer_buttons(0);
- break;
-
- case TWOKEY:
- if(G.qual==LR_CTRLKEY) {
- flip_subdivison(2);
- }
- else do_layer_buttons(1);
- break;
-
- case THREEKEY:
- if(G.qual==LR_CTRLKEY) {
- flip_subdivison(3);
- }
- else if ( G.qual == (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) {
- if ( (G.obedit) && (G.obedit->type==OB_MESH) )
- select_faces_by_numverts(3);
- }
- else do_layer_buttons(2);
- break;
-
- case FOURKEY:
- if(G.qual==LR_CTRLKEY) {
- flip_subdivison(4);
- }
- else if ( G.qual == (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) {
- if ( (G.obedit) && (G.obedit->type==OB_MESH) )
- select_faces_by_numverts(4);
- }
- else do_layer_buttons(3);
- break;
-
- case FIVEKEY:
- if ( G.qual == (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) {
- if ( (G.obedit) && (G.obedit->type==OB_MESH) )
- select_faces_by_numverts(5);
- }
- else do_layer_buttons(4);
- break;
-
- case SIXKEY:
- do_layer_buttons(5); break;
- case SEVENKEY:
- do_layer_buttons(6); break;
- case EIGHTKEY:
- do_layer_buttons(7); break;
- case NINEKEY:
- do_layer_buttons(8); break;
- case ZEROKEY:
- do_layer_buttons(9); break;
- case MINUSKEY:
- do_layer_buttons(10); break;
- case EQUALKEY:
- do_layer_buttons(11); break;
- case ACCENTGRAVEKEY:
- do_layer_buttons(-1); break;
-
- case SPACEKEY:
- if(G.qual == LR_CTRLKEY) {
- val= pupmenu("Manipulator%t|Enable/Disable|Translate|Rotate|Scale|Combo");
- if(val>0) {
- if(val==1) v3d->twflag ^= V3D_USE_MANIPULATOR;
- else {
- if(val==2) v3d->twtype= V3D_MANIP_TRANSLATE;
- else if(val==3) v3d->twtype= V3D_MANIP_ROTATE;
- else if(val==4) v3d->twtype= V3D_MANIP_SCALE;
- else if(val==5) v3d->twtype= V3D_MANIP_TRANSLATE|V3D_MANIP_ROTATE|V3D_MANIP_SCALE;
- v3d->twflag |= V3D_USE_MANIPULATOR;
- }
- doredraw= 1;
- }
- }
- else if(G.qual == LR_ALTKEY) {
- BIF_selectOrientation();
- doredraw= 1;
- }
-
- break;
-
- case AKEY:
- if(G.qual & LR_CTRLKEY) apply_object(); /* also with shift! */
- else if((G.qual==LR_SHIFTKEY)) {
- toolbox_n_add();
- }
- else {
- if(G.obedit) {
- if(G.obedit->type==OB_MESH)
- deselectall_mesh();
- else if ELEM(G.obedit->type, OB_CURVE, OB_SURF)
- deselectall_nurb();
- else if(G.obedit->type==OB_MBALL)
- deselectall_mball();
- else if(G.obedit->type==OB_LATTICE)
- deselectall_Latt();
- else if(G.obedit->type==OB_ARMATURE)
- deselectall_armature(1, 1); /* 1 == toggle */
- }
- else if (ob && (ob->flag & OB_POSEMODE)){
- deselectall_posearmature(ob, 1, 1);
- }
- else {
- if(FACESEL_PAINT_TEST) deselectall_tface();
- else if(G.f & G_PARTICLEEDIT) PE_deselectall();
- else {
- /* by design, the center of the active object
- * (which need not necessarily by selected) will
- * still be drawn as if it were selected.
- */
- deselectall();
- }
- }
- }
- break;
- case BKEY:
- if(G.qual==LR_ALTKEY)
- view3d_edit_clipping(v3d);
- else if(G.qual==LR_SHIFTKEY)
- {
- if(G.vd->persp==2)
- set_render_border();
- else
- view3d_border_zoom();
- }
- else if(G.qual==LR_CTRLKEY) {
- if(okee("Bake all selected")) {
- extern void softbody_bake(Object *ob);
- extern void fluidsimBake(Object *ob);
- softbody_bake(NULL);
- /* also bake first domain of selected objects... */
- fluidsimBake(NULL);
- }
- }
- else if(G.qual== (LR_ALTKEY|LR_CTRLKEY))
- objects_bake_render_menu();
- else if(G.qual==0)
- borderselect();
- break;
- case CKEY:
- if(G.qual==LR_CTRLKEY) {
- if(ob && (ob->flag & OB_POSEMODE))
- pose_copy_menu(); /* poseobject.c */
- else
- copy_attr_menu();
- }
- else if(G.qual==LR_ALTKEY) {
- if(ob && (ob->flag & OB_POSEMODE))
- pose_clear_constraints(); /* poseobject.c */
- else
- convertmenu(); /* editobject.c */
- }
- else if(G.qual==(LR_ALTKEY|LR_CTRLKEY))
- add_constraint(0); /* editconstraint.c, generic for objects and posemode */
- else if((G.qual==LR_SHIFTKEY)) {
- view3d_home(1);
- curs= give_cursor();
- curs[0]=curs[1]=curs[2]= 0.0;
- allqueue(REDRAWVIEW3D, 0);
- }
- else if((G.obedit) && ELEM(G.obedit->type, OB_CURVE, OB_SURF) ) {
- makecyclicNurb();
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- }
- else if((G.qual==0)){
- if (G.vd->persp==2)
- /* center the camera offset */
- G.vd->camdx= G.vd->camdy= 0.0;
- else {
- /*non camera center*/
- float new_ofs[3];
- curs= give_cursor();
- new_ofs[0]= -curs[0];
- new_ofs[1]= -curs[1];
- new_ofs[2]= -curs[2];
- smooth_view(G.vd, new_ofs, NULL, NULL, NULL);
- }
- scrarea_queue_winredraw(curarea);
- }
- break;
- case DKEY:
- if((G.qual==LR_SHIFTKEY)) {
- duplicate_context_selected();
- }
- else if(G.qual==LR_ALTKEY) {
- if(ob && (ob->flag & OB_POSEMODE))
- error ("Duplicate not possible in posemode.");
- else if((G.obedit==NULL))
- adduplicate(0, 0);
- }
- else if(G.qual==LR_CTRLKEY) {
- imagestodisplist();
- }
- else if((G.qual==0)){
- pupval= pupmenu("Draw mode%t|BoundBox %x1|Wire %x2|OpenGL Solid %x3|Shaded Solid %x4|Textured Solid %x5");
- if(pupval>0) {
- G.vd->drawtype= pupval;
- doredraw= 1;
- }
- }
-
- break;
- case EKEY:
- if (G.qual==0){
- if(G.obedit) {
- if(G.obedit->type==OB_MESH)
- extrude_mesh();
- else if(G.obedit->type==OB_CURVE)
- addvert_Nurb('e');
- else if(G.obedit->type==OB_SURF)
- extrude_nurb();
- else if(G.obedit->type==OB_ARMATURE)
- extrude_armature(0);
- }
- }
- else if (G.qual==LR_CTRLKEY) {
- if(G.obedit && G.obedit->type==OB_MESH)
- Edge_Menu();
- else if (FACESEL_PAINT_TEST)
- seam_mark_clear_tface(0);
- }
- else if (G.qual==LR_SHIFTKEY) {
- if (G.obedit && G.obedit->type==OB_MESH &&
- !multires_level1_test()) {
- initTransform(TFM_CREASE, CTX_EDGE);
- Transform();
- }
- else if (G.obedit && G.obedit->type==OB_ARMATURE) {
- extrude_armature(1);
- }
- }
- break;
- case FKEY:
- if(G.obedit) {
- if(G.obedit->type==OB_MESH) {
- if(G.qual == LR_CTRLKEY)
- Face_Menu();
- else if((G.qual==LR_SHIFTKEY))
- fill_mesh();
- else if(G.qual==LR_ALTKEY)
- beauty_fill();
- else if(G.qual==(LR_CTRLKEY|LR_SHIFTKEY))
- edge_flip();
- else if (G.qual==0)
- addedgeface_mesh();
- else if ( G.qual ==
- (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) {
- select_linked_flat_faces();
- }
-
- }
- else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
- addsegment_nurb();
- }
- else if(G.obedit->type == OB_ARMATURE) {
- fill_bones_armature();
- }
- }
- else if(G.qual==LR_CTRLKEY)
- sort_faces();
- else if((G.qual==LR_SHIFTKEY)) {
- if(ob && (ob->flag & OB_POSEMODE))
- pose_activate_flipped_bone();
- else if(G.f & G_WEIGHTPAINT)
- pose_activate_flipped_bone();
- else
- fly();
- }
- else {
- if (G.f & (G_VERTEXPAINT|G_WEIGHTPAINT|G_TEXTUREPAINT)){
- G.f ^= G_FACESELECT;
- allqueue(REDRAWVIEW3D, 1);
- }
- }
-
- break;
- case GKEY:
- if((G.qual == LR_CTRLKEY)) {
- if(G.obedit) {
- if(ELEM(G.obedit->type, OB_MESH, OB_LATTICE))
- vgroup_assign_with_menu();
- }
- else
- group_operation_with_menu();
- }
- else if((G.qual == (LR_CTRLKEY|LR_SHIFTKEY))) {
- if(G.obedit) {
- if(ELEM(G.obedit->type, OB_MESH, OB_LATTICE))
- vgroup_operation_with_menu();
- }
- }
- else if((G.qual==LR_SHIFTKEY))
- if(G.obedit) {
- if(G.obedit->type==OB_MESH)
- select_mesh_group_menu();
- } else
- select_object_grouped_menu();
- else if((G.obedit==0) && G.qual==LR_ALTKEY) {
- if(okee("Clear location")) {
- clear_object('g');
- }
- }
- else if(G.qual== (LR_CTRLKEY|LR_ALTKEY)) {
- v3d->twtype= V3D_MANIP_TRANSLATE;
- doredraw= 1;
- }
- else if((G.qual==0)) {
- initTransform(TFM_TRANSLATION, CTX_NONE);
- Transform();
- }
- break;
- case HKEY:
- if(G.obedit) {
- if(G.obedit->type==OB_MESH) {
- if(G.qual==LR_CTRLKEY)
- add_hook();
- else if(G.qual==LR_ALTKEY)
- reveal_mesh();
- else if((G.qual==LR_SHIFTKEY))
- hide_mesh(1);
- else if((G.qual==0))
- hide_mesh(0);
- }
- else if(G.obedit->type== OB_SURF) {
- if(G.qual==LR_CTRLKEY)
- add_hook();
- else if(G.qual==LR_ALTKEY)
- revealNurb();
- else if((G.qual==LR_SHIFTKEY))
- hideNurb(1);
- else if((G.qual==0))
- hideNurb(0);
- }
- else if(G.obedit->type==OB_CURVE) {
- if(G.qual==LR_CTRLKEY)
- add_hook();
- else if(G.qual==LR_ALTKEY)
- revealNurb();
- /* should be G.qual==LR_SHIFTKEY, but that is taken fro handles already */
- else if((G.qual==(LR_ALTKEY|LR_SHIFTKEY)))
- hideNurb(1);
- /* should be G.qual==0, but that is taken for handles already */
- else if((G.qual==(LR_ALTKEY|LR_CTRLKEY)))
- hideNurb(0);
- else {
- if(G.qual==LR_CTRLKEY) /* conflict */
- autocalchandlesNurb_all(1); /* flag=1, selected */
- else if((G.qual==LR_SHIFTKEY))
- sethandlesNurb(1);
- else if((G.qual==0))
- sethandlesNurb(3);
-
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- BIF_undo_push("Handle change");
- allqueue(REDRAWVIEW3D, 0);
- }
- }
- else if(G.obedit->type==OB_LATTICE) {
- if(G.qual==LR_CTRLKEY) add_hook();
- }
- else if(G.obedit->type==OB_MBALL) {
- if(G.qual==LR_ALTKEY)
- reveal_mball();
- else if((G.qual==LR_SHIFTKEY))
- hide_mball(1);
- else if((G.qual==0))
- hide_mball(0);
- }
- else if(G.obedit->type==OB_ARMATURE) {
- if (G.qual==0)
- hide_selected_armature_bones();
- else if (G.qual==LR_SHIFTKEY)
- hide_unselected_armature_bones();
- else if (G.qual==LR_ALTKEY)
- show_all_armature_bones();
- }
- }
- else if(FACESEL_PAINT_TEST)
- hide_tface();
- else if(G.f & G_PARTICLEEDIT) {
- if(G.qual == LR_ALTKEY)
- PE_hide(0);
- else if(G.qual == LR_SHIFTKEY)
- PE_hide(1);
- else if(G.qual == 0)
- PE_hide(2);
- }
- else if(ob && (ob->flag & OB_POSEMODE)) {
- if (G.qual==0)
- hide_selected_pose_bones();
- else if (G.qual==LR_SHIFTKEY)
- hide_unselected_pose_bones();
- else if (G.qual==LR_ALTKEY)
- show_all_pose_bones();
- }
- /* Object mode only, other modes are accounted for above */
- else if ((G.f & (G_VERTEXPAINT|G_TEXTUREPAINT|G_WEIGHTPAINT))==0) {
- if(G.qual==LR_CTRLKEY)hookmenu();
- else if(G.qual==LR_ALTKEY) show_objects();
- else if(G.qual==LR_SHIFTKEY) hide_objects(0);
- else hide_objects(1);
- }
- break;
- case IKEY:
- if(G.obedit) {
- if(G.qual==LR_CTRLKEY)
- selectswap_mesh();
- } else if(G.qual==LR_CTRLKEY) {
- if(ob && ob->type==OB_ARMATURE)
- if(ob->flag & OB_POSEMODE)
- pose_add_IK();
- }
- else if(G.qual==LR_ALTKEY) {
- if(ob && ob->type==OB_ARMATURE)
- if(ob->flag & OB_POSEMODE)
- pose_clear_IK();
- }
- break;
-
- case JKEY:
- if(G.qual==LR_CTRLKEY) {
- if( ob ) {
- join_menu();
- }
- else if ((G.obedit) && ELEM(G.obedit->type, OB_CURVE, OB_SURF)) {
- addsegment_nurb();
- } else {
- error("Can't join unless there is an active object");
- }
-
- }
- else if(G.obedit) {
- if(G.obedit->type==OB_MESH) {
- join_triangles();
- }
- }
-
- break;
- case KKEY:
- if(G.obedit) {
- if (G.obedit->type==OB_MESH) {
- if (G.qual==LR_SHIFTKEY)
- KnifeSubdivide(KNIFE_PROMPT);
- else if (G.qual==0)
- LoopMenu();
- }
- else if(G.obedit->type==OB_SURF)
- printknots();
- }
- else {
- if((G.qual==LR_SHIFTKEY)) {
- if(FACESEL_PAINT_TEST)
- if (G.f & G_WEIGHTPAINT)
- clear_wpaint_selectedfaces();
- else
- clear_vpaint_selectedfaces();
- else if(G.f & G_VERTEXPAINT)
- clear_vpaint();
- else
- select_select_keys();
- }
- else if (G.qual==0)
- set_ob_ipoflags();
- }
-
- break;
- case LKEY:
- if(G.obedit) {
- if(G.obedit->type==OB_MESH) {
- if (G.qual & LR_CTRLKEY) {
- if ((G.scene->selectmode & SCE_SELECT_FACE) == 0) {
- selectconnected_mesh_all(); /* normal select linked */
- } else {
- selectconnected_delimit_mesh_all(); /* select linked with edge crease delimiting */
- }
- } else {
- if ((G.scene->selectmode & SCE_SELECT_FACE) == 0) {
- selectconnected_mesh();
- } else {
- selectconnected_delimit_mesh();
- }
- }
- }
- if(G.obedit->type==OB_ARMATURE)
- selectconnected_armature();
- else if ELEM(G.obedit->type, OB_CURVE, OB_SURF)
- selectconnected_nurb();
- }
- else if(ob && (ob->flag & OB_POSEMODE)) {
- selectconnected_posearmature();
- }
- else {
- if(FACESEL_PAINT_TEST) {
- if((G.qual==0))
- select_linked_tfaces(0);
- else if((G.qual==LR_SHIFTKEY))
- select_linked_tfaces(1);
- else if(G.qual==LR_CTRLKEY)
- select_linked_tfaces(2);
- }
- else if(G.f & G_PARTICLEEDIT) {
- PE_select_linked();
- }
- else {
- if((G.qual==0))
- make_local_menu();
- else if((G.qual==LR_SHIFTKEY))
- selectlinks_menu();
- else if(G.qual==LR_CTRLKEY)
- make_links_menu();
- }
- }
- break;
- case MKEY:
- if(G.obedit){
- if (ELEM(G.qual, 0, LR_SHIFTKEY) && (G.obedit->type==OB_ARMATURE)) {
- pose_movetolayer();
- }
- else if (G.qual==LR_ALTKEY) {
- if (G.obedit->type == OB_MESH) {
- mergemenu();
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- }
- else if (G.obedit->type == OB_ARMATURE) {
- merge_armature();
- }
- }
- else if ((G.qual==0) || (G.qual==LR_CTRLKEY)) {
- mirrormenu();
- }
- else if ( G.qual == (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) {
- if(G.obedit->type==OB_MESH) select_non_manifold();
- }
- }
- else if(G.qual & LR_CTRLKEY) {
- mirrormenu();
- }
- else if(G.qual==0 || G.qual==LR_SHIFTKEY) {
- if(ob && (ob->flag & OB_POSEMODE))
- pose_movetolayer();
- else
- movetolayer();
- }
- break;
- case NKEY:
- if((G.qual==0)) {
- toggle_blockhandler(curarea, VIEW3D_HANDLER_OBJECT, UI_PNL_TO_MOUSE);
- allqueue(REDRAWVIEW3D, 0);
- }
- else if(G.obedit) {
- switch (G.obedit->type){
- case OB_ARMATURE:
- if(G.qual==LR_CTRLKEY) {
- pupval= pupmenu("Recalculate Bone Roll Angles%t|Clear Roll (Z-Axis Up) %x1|Align Z-Axis to 3D-Cursor %x2");
- if (pupval > 0) {
- auto_align_armature(pupval - 1);
- allqueue(REDRAWVIEW3D, 0);
- }
- }
- break;
- case OB_MESH:
- if(G.qual==(LR_SHIFTKEY|LR_CTRLKEY)) {
- if(okee("Recalculate normals inside")) {
- righthandfaces(2);
- allqueue(REDRAWVIEW3D, 0);
- BIF_undo_push("Recalculate normals inside");
- }
- }
- else if(G.qual==LR_CTRLKEY){
- if(okee("Recalculate normals outside")) {
- righthandfaces(1);
- allqueue(REDRAWVIEW3D, 0);
- BIF_undo_push("Recalculate normals outside");
- }
- }
- break;
- }
- }
-
- break;
- case OKEY:
- if (G.obedit || G.f&G_PARTICLEEDIT) {
- if (G.qual==LR_SHIFTKEY) {
- G.scene->prop_mode = (G.scene->prop_mode+1)%7;
- allqueue(REDRAWHEADERS, 0);
- }
- else if((G.qual==LR_ALTKEY)) {
- if(G.scene->proportional==2) G.scene->proportional= 1;
- else G.scene->proportional= 2;
- allqueue(REDRAWHEADERS, 0);
- }
- else if((G.qual==0)) {
- G.scene->proportional= !G.scene->proportional;
- allqueue(REDRAWHEADERS, 0);
- }
- }
- else if((G.qual==LR_SHIFTKEY || G.qual==(LR_ALTKEY|LR_SHIFTKEY))) {
- flip_subdivison(-1);
- }
- else if(G.qual==LR_ALTKEY) {
- if(okee("Clear origin")) {
- clear_object('o');
- }
- }
- break;
-
- case PKEY:
- if(G.obedit) {
- if(G.qual==LR_CTRLKEY || G.qual==(LR_SHIFTKEY|LR_CTRLKEY)) {
- if(G.obedit->type==OB_ARMATURE)
- make_bone_parent();
- else
- make_parent();
- }
-
- else if(G.qual==LR_ALTKEY && G.obedit->type==OB_ARMATURE)
- clear_bone_parent();
- else if((G.qual==0) && (G.obedit->type==OB_ARMATURE))
- select_bone_parent();
- else if((G.qual==0) && G.obedit->type==OB_MESH)
- separatemenu();
- else if ((G.qual==0) && ELEM(G.obedit->type, OB_CURVE, OB_SURF))
- separate_nurb();
- else if (G.qual==LR_SHIFTKEY) {
- initTransform(TFM_PUSHPULL, CTX_NONE);
- Transform();
- }
- }
- else if(G.qual==LR_CTRLKEY || G.qual==(LR_SHIFTKEY|LR_CTRLKEY))
- make_parent();
- else if(G.qual==LR_SHIFTKEY) {
- toggle_blockhandler(curarea, VIEW3D_HANDLER_PREVIEW, 0);
- doredraw= 1;
- }
- else if(G.qual==(LR_ALTKEY|LR_SHIFTKEY)) {
- initTransform(TFM_PUSHPULL, CTX_NONE);
- Transform();
- }
- else if(G.qual==LR_ALTKEY)
- clear_parent();
- else if(G.qual==(LR_ALTKEY|LR_CTRLKEY))
- make_proxy();
- else if(G.qual==(LR_ALTKEY|LR_CTRLKEY|LR_SHIFTKEY)) {
- start_RBSimulation();
- }
- else if((G.qual==0) && (OBACT) && (OBACT->type==OB_ARMATURE) && (OBACT->flag & OB_POSEMODE))
- select_bone_parent();
- else if((G.qual==0)) {
- start_game();
- }
- break;
- case RKEY:
- if((G.obedit==0) && G.qual==LR_ALTKEY) {
- if(okee("Clear rotation")) {
- clear_object('r');
- }
- }
- else if(G.qual== (LR_CTRLKEY|LR_ALTKEY)) {
- v3d->twtype= V3D_MANIP_ROTATE;
- doredraw= 1;
- }
- else if (G.obedit) {
- if((G.qual==LR_SHIFTKEY)) {
- if ELEM(G.obedit->type, OB_CURVE, OB_SURF)
- selectrow_nurb();
- }
- else if(G.qual==LR_CTRLKEY) {
- if (G.obedit->type==OB_MESH) {
- CutEdgeloop(1);
- BIF_undo_push("Cut Edgeloop");
- }
- else if (G.obedit->type==OB_ARMATURE) {
- initTransform(TFM_BONE_ROLL, CTX_NONE);
- Transform();
- }
- }
- else if((G.qual==0)) {
- initTransform(TFM_ROTATION, CTX_NONE);
- Transform();
- }
- }
- else if((G.qual==0)) {
- initTransform(TFM_ROTATION, CTX_NONE);
- Transform();
- }
- break;
- case SKEY:
- if(G.qual== (LR_CTRLKEY|LR_ALTKEY)) {
- v3d->twtype= V3D_MANIP_SCALE;
- doredraw= 1;
- }
- else if(G.obedit) {
-
- if(G.qual==LR_ALTKEY) {
- if(G.obedit->type==OB_ARMATURE) {
- initTransform(TFM_BONESIZE, CTX_NONE);
- }
- else if (G.obedit->type==OB_CURVE) {
- initTransform(TFM_CURVE_SHRINKFATTEN, CTX_NONE);
- } else {
- initTransform(TFM_SHRINKFATTEN, CTX_NONE);
- }
- Transform();
- }
- else if(G.qual==LR_CTRLKEY) {
- initTransform(TFM_SHEAR, CTX_NONE);
- Transform();
- }
- else if(G.qual==LR_SHIFTKEY)
- snapmenu();
- else if(G.qual==0) {
- if(G.obedit->type==OB_ARMATURE) {
- bArmature *arm= G.obedit->data;
- if(arm->drawtype==ARM_ENVELOPE)
- initTransform(TFM_BONE_ENVELOPE, CTX_NONE);
- else
- initTransform(TFM_RESIZE, CTX_NONE);
- }
- else
- initTransform(TFM_RESIZE, CTX_NONE);
- Transform();
- }
- else if(G.qual==(LR_SHIFTKEY|LR_CTRLKEY)){
- initTransform(TFM_TOSPHERE, CTX_NONE);
- Transform();
- }
- if ( G.qual == (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) {
- if(G.obedit->type==OB_MESH) select_sharp_edges();
- }
- }
- else if(G.qual==LR_ALTKEY) {
- if(G.f & G_WEIGHTPAINT)
- ob= ob->parent;
- if(ob && (ob->flag & OB_POSEMODE)) {
- bArmature *arm= ob->data;
- if( arm->drawtype==ARM_ENVELOPE) {
- initTransform(TFM_BONESIZE, CTX_NONE);
- Transform();
- break;
- }
- }
-
- if(okee("Clear scale")) {
- clear_object('s');
- }
- }
- else if(G.qual==LR_SHIFTKEY) {
- snapmenu();
- }
- else if((G.qual==0)) {
- initTransform(TFM_RESIZE, CTX_NONE);
- Transform();
- }
- else if(G.qual==(LR_SHIFTKEY|LR_CTRLKEY)) {
- initTransform(TFM_TOSPHERE, CTX_NONE);
- Transform();
- }
- else if(G.qual==(LR_CTRLKEY|LR_ALTKEY|LR_SHIFTKEY)) {
- initTransform(TFM_SHEAR, CTX_NONE);
- Transform();
- }
- break;
- case TKEY:
- if(G.qual == LR_SHIFTKEY) { /* toggle texture in solid draw mode */
- G.vd->flag2 ^= V3D_SOLID_TEX;
- allqueue(REDRAWVIEW3D, 0);
- } else if(G.obedit){
- if((G.qual & LR_CTRLKEY) && G.obedit->type==OB_MESH) {
- convert_to_triface(G.qual & LR_SHIFTKEY);
- allqueue(REDRAWVIEW3D, 0);
- if (EM_texFaceCheck())
- allqueue(REDRAWIMAGE, 0);
-
- countall();
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- }
- if (G.obedit->type==OB_CURVE) {
- if (G.qual==LR_ALTKEY) {
- clear_tilt();
- }
- else if (G.qual==0) {
- initTransform(TFM_TILT, CTX_NONE);
- Transform();
- }
- }
- }
- else if(G.f & G_PARTICLEEDIT) {
- initTransform(TFM_BAKE_TIME, CTX_NONE);
- Transform();
- }
- else if(G.qual==LR_CTRLKEY) {
- if(ob && (ob->flag & OB_POSEMODE));
- else make_track();
- }
- else if(G.qual==LR_ALTKEY) {
- if(ob && (ob->flag & OB_POSEMODE));
- else clear_track();
- }
- else if((G.qual==0)){
- texspace_edit();
- }
-
- break;
- case UKEY:
- /*// Use Ctrl Z like everybody else
- if(G.obedit) {
- if(G.obedit->type==OB_MESH) {
- if(G.qual==0) BIF_undo(); else BIF_redo();
- }
- else if ELEM5(G.obedit->type, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE) {
- if(G.qual==0) BIF_undo(); else BIF_redo();
- }
- }*/
- if(G.obedit) {
- if(G.obedit->type==OB_MESH && G.qual==0) {
- uv_autocalc_tface();
- }
- }
- else if (G.f & G_PARTICLEEDIT){
- if(G.qual==0) BIF_undo(); else BIF_redo();
- }
- else if((G.qual==0)) {
- if(G.f & G_WEIGHTPAINT)
- BIF_undo();
- else if(G.f & G_VERTEXPAINT)
- BIF_undo();
- else if(G.f & G_TEXTUREPAINT)
- imagepaint_undo();
- else {
- single_user();
- }
- }
-
- break;
- case VKEY:
- if ((G.qual==LR_CTRLKEY)) {
- if ((G.obedit) && G.obedit->type==OB_MESH) {
- Vertex_Menu();
- }
- } else if((G.qual==LR_SHIFTKEY)) {
- if ((G.obedit) && G.obedit->type==OB_MESH) {
- align_view_to_selected(v3d);
- }
- else if (FACESEL_PAINT_TEST) {
- align_view_to_selected(v3d);
- }
- }
- else if(G.qual==LR_ALTKEY)
- image_aspect();
- else if (G.qual==0){
- if(G.obedit) {
- if(G.obedit->type==OB_MESH) {
- mesh_rip();
- }
- else if(G.obedit->type==OB_CURVE) {
- sethandlesNurb(2);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- BIF_undo_push("Handle change");
- }
- }
- else if(ob && ob->type == OB_MESH)
- set_vpaint();
- }
- break;
- case WKEY:
- if((G.qual==LR_SHIFTKEY)) {
- initTransform(TFM_WARP, CTX_NONE);
- Transform();
- }
- /*else if(G.qual==LR_ALTKEY) {}*/
- else if(G.qual==LR_CTRLKEY) {
- if(G.obedit) {
- if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
- switchdirectionNurb2();
- }
- }
- }
- else if((G.qual==0))
- special_editmenu();
-
- break;
- case XKEY:
- case DELKEY:
- if(G.qual==0 || G.qual==LR_SHIFTKEY)
- delete_context_selected();
- break;
- case YKEY:
- if((G.qual==0) && (G.obedit)) {
- if(G.obedit->type==OB_MESH) split_mesh();
- }
- break;
- case ZKEY:
- toggle_shading();
-
- scrarea_queue_headredraw(curarea);
- scrarea_queue_winredraw(curarea);
- break;
-
- case HOMEKEY:
- if(G.qual==0)
- view3d_home(0);
- break;
- case COMMAKEY:
- if(G.qual==LR_CTRLKEY) {
- G.vd->around= V3D_CENTROID;
- } else if(G.qual==LR_SHIFTKEY) {
- G.vd->around= V3D_CENTROID;
- } else if(G.qual==0) {
- G.vd->around= V3D_CENTER;
- }
- handle_view3d_around();
-
- scrarea_queue_headredraw(curarea);
- scrarea_queue_winredraw(curarea);
- break;
-
- case PERIODKEY:
- if(G.qual==LR_CTRLKEY) {
- G.vd->around= V3D_LOCAL;
- } else if(G.qual==LR_ALTKEY) {
- G.vd->around= V3D_ACTIVE;
- } else if(G.qual==0) {
- G.vd->around= V3D_CURSOR;
- }
- handle_view3d_around();
-
- scrarea_queue_headredraw(curarea);
- scrarea_queue_winredraw(curarea);
- break;
-
- case PADSLASHKEY:
- if(G.qual==0) {
- if(G.vd->localview) {
- G.vd->localview= 0;
- endlocalview(curarea);
- }
- else {
- G.vd->localview= 1;
- initlocalview();
- }
- scrarea_queue_headredraw(curarea);
- }
- break;
- case PADASTERKEY: /* '*' */
- if(G.qual==0) {
- if(ob) {
- if ((G.obedit) && (G.obedit->type == OB_MESH)) {
- editmesh_align_view_to_selected(G.vd, 3);
- }
- else if (FACESEL_PAINT_TEST) {
- if(ob->type==OB_MESH) {
- Mesh *me= ob->data;
- faceselect_align_view_to_selected(G.vd, me, 3);
- }
- }
- else
- obmat_to_viewmat(ob, 1);
-
- if(G.vd->persp==2) G.vd->persp= 1;
- scrarea_queue_winredraw(curarea);
- }
- }
- break;
- case PADPERIOD: /* '.' */
- if(G.qual==0)
- centerview();
- break;
-
- case PAGEUPKEY:
- if(G.qual==LR_CTRLKEY)
- movekey_obipo(1);
- else if((G.qual==0))
- nextkey_obipo(1); /* in editipo.c */
- break;
-
- case PAGEDOWNKEY:
- if(G.qual==LR_CTRLKEY)
- movekey_obipo(-1);
- else if((G.qual==0))
- nextkey_obipo(-1);
- break;
-
- case PAD0: case PAD1: case PAD2: case PAD3: case PAD4:
- case PAD5: case PAD6: case PAD7: case PAD8: case PAD9:
- case PADENTER:
- persptoetsen(event);
- doredraw= 1;
- break;
- case PADMINUS:
- if ( (G.qual==LR_CTRLKEY)
- && (G.obedit) && (G.obedit->type==OB_MESH) )
- select_less();
- else if ( (G.qual==LR_CTRLKEY)
- && (G.obedit) && (G.obedit->type==OB_CURVE) )
- select_less_nurb();
- else if ( (G.qual==LR_CTRLKEY)
- && (G.obedit) && (G.obedit->type==OB_SURF) )
- select_less_nurb();
- else if ( (G.qual==LR_CTRLKEY)
- && (G.f & G_PARTICLEEDIT) )
- PE_select_less();
- else {
- persptoetsen(event);
- doredraw= 1;
- }
- break;
-
- case PADPLUSKEY:
- if ( (G.qual==LR_CTRLKEY)
- && (G.obedit) && (G.obedit->type==OB_MESH) )
- select_more();
- else if ( (G.qual==LR_CTRLKEY)
- && (G.obedit) && (G.obedit->type==OB_CURVE) )
- select_more_nurb();
- else if ( (G.qual==LR_CTRLKEY)
- && (G.obedit) && (G.obedit->type==OB_SURF) )
- select_more_nurb();
- else if ( (G.qual==LR_CTRLKEY)
- && (G.f & G_PARTICLEEDIT) )
- PE_select_more();
- else {
- persptoetsen(event);
- doredraw= 1;
- }
- break;
-
- case ESCKEY:
- if(G.qual==0) {
- if (G.vd->flag & V3D_DISPIMAGE) {
- G.vd->flag &= ~V3D_DISPIMAGE;
- doredraw= 1;
- }
- }
- break;
- }
- }
- }
-
- if(doredraw) {
- scrarea_queue_winredraw(curarea);
- scrarea_queue_headredraw(curarea);
- }
-}
-
-static void initview3d(ScrArea *sa)
-{
- View3D *vd;
-
- vd= MEM_callocN(sizeof(View3D), "initview3d");
- BLI_addhead(&sa->spacedata, vd); /* addhead! not addtail */
-
- vd->spacetype= SPACE_VIEW3D;
- vd->blockscale= 0.7f;
- vd->viewquat[0]= 1.0f;
- vd->viewquat[1]= vd->viewquat[2]= vd->viewquat[3]= 0.0f;
- vd->persp= 1;
- vd->drawtype= OB_WIRE;
- vd->view= 7;
- vd->dist= 10.0;
- vd->lens= 35.0f;
- vd->near= 0.01f;
- vd->far= 500.0f;
- vd->grid= 1.0f;
- vd->gridlines= 16;
- vd->gridsubdiv = 10;
-
- vd->lay= vd->layact= 1;
- if(G.scene) {
- vd->lay= vd->layact= G.scene->lay;
- vd->camera= G.scene->camera;
- }
- vd->scenelock= 1;
- vd->gridflag |= V3D_SHOW_X;
- vd->gridflag |= V3D_SHOW_Y;
- vd->gridflag |= V3D_SHOW_FLOOR;
- vd->gridflag &= ~V3D_SHOW_Z;
-
- vd->depths= NULL;
-}
-
-
-/* ******************** SPACE: IPO ********************** */
-
-static void changeview2dspace(ScrArea *sa, void *spacedata)
-{
- if(G.v2d==0) return;
-
- test_view2d(G.v2d, curarea->winx, curarea->winy);
- myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax);
-}
-
-static int get_cfra_from_dx(SpaceIpo * sipo, int dx)
-{
- if (sipo->blocktype == ID_SEQ) {
- Sequence * seq = (Sequence*) sipo->from;
- if (!seq) {
- return dx;
- }
- if ((seq->flag & SEQ_IPO_FRAME_LOCKED) != 0) {
- return dx;
- } else {
- float m= (seq->enddisp - seq->startdisp)/100.0f;
- float cfra = dx * m + seq->startdisp;
-
- return (int) cfra;
- }
- } else {
- return dx;
- }
-}
-
-static void winqreadipospace(ScrArea *sa, void *spacedata, BWinEvent *evt)
-{
- extern void do_ipobuts(unsigned short event); /* drawipo.c */
- unsigned short event= evt->event;
- short val= evt->val;
- SpaceIpo *sipo= curarea->spacedata.first;
- View2D *v2d= &sipo->v2d;
- float dx, dy;
- int cfra, doredraw= 0;
- short mval[2];
- short mousebut = L_MOUSE;
-
- if(sa->win==0) return;
-
- if(val) {
- if( uiDoBlocks(&sa->uiblocks, event, 1)!=UI_NOTHING ) event= 0;
-
- /* swap mouse buttons based on user preference */
- if (U.flag & USER_LMOUSESELECT) {
- if (event == LEFTMOUSE) {
- event = RIGHTMOUSE;
- mousebut = L_MOUSE;
- } else if (event == RIGHTMOUSE) {
- event = LEFTMOUSE;
- mousebut = R_MOUSE;
- }
- }
-
- switch(event) {
- case UI_BUT_EVENT:
- /* note: bad bad code, will be cleaned! is because event queues are all shattered */
- if(val>0 && val < 256) do_ipowin_buts(val-1);
- else do_ipobuts(val);
- break;
-
- case LEFTMOUSE:
- if( in_ipo_buttons() ) {
- do_ipo_selectbuttons();
- doredraw= 1;
- }
- else if(view2dmove(LEFTMOUSE)); /* only checks for sliders */
- else if((G.qual & LR_CTRLKEY) && (sipo->showkey==0)) add_vert_ipo();
- else {
- do {
- getmouseco_areawin(mval);
- areamouseco_to_ipoco(v2d, mval, &dx, &dy);
-
- cfra = get_cfra_from_dx(sipo, (int)dx);
- if(cfra< 1) cfra= 1;
-
- if( cfra!=CFRA ) {
- CFRA= cfra;
- update_for_newframe_nodraw(0); /* 1 = nosound */
- force_draw_all(0); /* To make constraint sliders redraw */
- }
- else PIL_sleep_ms(30);
-
- } while(get_mbut() & mousebut);
- }
- break;
- case RIGHTMOUSE:
- mouse_select_ipo();
- allqueue(REDRAWMARKER, 0);
- break;
- case MIDDLEMOUSE:
- if(in_ipo_buttons()) {
- scroll_ipobuts();
- }
- else view2dmove(event); /* in drawipo.c */
- break;
- case WHEELUPMOUSE:
- case WHEELDOWNMOUSE:
- view2dmove(event); /* in drawipo.c */
- break;
- case PADPLUSKEY:
- view2d_zoom(v2d, 0.1154f, sa->winx, sa->winy);
- doredraw= 1;
- break;
- case PADMINUS:
- view2d_zoom(v2d, -0.15f, sa->winx, sa->winy);
- doredraw= 1;
- break;
- case PAGEUPKEY:
- if(G.qual & LR_CTRLKEY)
- movekey_ipo(1);
- else if(G.qual & LR_SHIFTKEY)
- nextkey_ipo(1);
- else
- nextprev_marker(1);
- break;
- case PAGEDOWNKEY:
- if(G.qual & LR_CTRLKEY)
- movekey_ipo(-1);
- else if(G.qual & LR_SHIFTKEY)
- nextkey_ipo(-1);
- else
- nextprev_marker(-1);
- break;
- case HOMEKEY:
- if((G.qual==0))
- do_ipo_buttons(B_IPOHOME);
- break;
- case PADPERIOD:
- if((G.qual==0))
- do_ipo_buttons(B_IPOVIEWCENTER);
- break;
-
- case AKEY:
- if (G.qual & LR_CTRLKEY) {
- deselect_markers(1, 0);
- allqueue(REDRAWMARKER, 0);
- }
- else if (G.qual==0) {
- if(in_ipo_buttons()) {
- swap_visible_editipo();
- }
- else {
- swap_selectall_editipo();
- }
- allspace (REMAKEIPO, 0);
- allqueue (REDRAWNLA, 0);
- allqueue (REDRAWACTION, 0);
- }
-
- break;
- case BKEY:
- if (G.qual==0)
- borderselect_ipo();
- else if (G.qual==LR_CTRLKEY) {
- borderselect_markers();
- }
- break;
- case CKEY:
- if (G.qual == LR_SHIFTKEY)
- center_currframe();
- else
- move_to_frame();
- break;
- case DKEY:
- if (G.qual==LR_SHIFTKEY) {
- add_duplicate_editipo();
- } else if (G.qual == (LR_CTRLKEY|LR_SHIFTKEY)) {
- duplicate_marker();
- allqueue(REDRAWMARKER, 0);
- }
- break;
- case GKEY:
- if (G.qual & LR_CTRLKEY) {
- transform_markers('g', 0);
- allqueue(REDRAWMARKER, 0);
- } else if (G.qual==0)
- transform_ipo('g');
- break;
- case HKEY:
- if (G.qual==LR_ALTKEY)
- sethandles_ipo(HD_AUTO_ANIM);
- if (G.qual==LR_SHIFTKEY)
- sethandles_ipo(HD_AUTO);
- else if (G.qual==0)
- sethandles_ipo(HD_ALIGN);
- break;
- case JKEY:
- if (G.qual==LR_CTRLKEY)
- join_ipo_menu();
- break;
- case KKEY:
- if (G.qual==0) {
- ipo_toggle_showkey();
- scrarea_queue_headredraw(curarea);
- allqueue(REDRAWVIEW3D, 0);
- doredraw= 1;
- }
- break;
- case MKEY:
- if (G.qual==0) {
- add_marker(CFRA);
- } else if (G.qual==LR_SHIFTKEY) {
- ipo_mirror_menu();
- break;
- } else if (G.qual == LR_CTRLKEY) {
- rename_marker();
- } else {
- break;
- }
- allqueue(REDRAWMARKER, 0);
- break;
- case NKEY:
- toggle_blockhandler(sa, IPO_HANDLER_PROPERTIES, UI_PNL_TO_MOUSE);
- doredraw= 1;
- break;
- case OKEY:
- if (G.qual==LR_SHIFTKEY)
- smooth_ipo();
- else
- clean_ipo();
- break;
- case PKEY:
- if (G.qual & LR_CTRLKEY) /* set preview range */
- anim_previewrange_set();
- else if (G.qual & LR_ALTKEY) /* clear preview range */
- anim_previewrange_clear();
- allqueue(REDRAWTIME, 0);
- allqueue(REDRAWBUTSALL, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWIPO, 0);
- break;
- case RKEY:
- if (G.qual==LR_CTRLKEY)
- ipo_record();
- else
- transform_ipo('r');
- break;
- case SKEY:
- if (G.qual==LR_SHIFTKEY) {
- ipo_snap_menu();
- }
- else if (G.qual==0)
- transform_ipo('s');
- break;
- case TKEY:
- if (G.qual==0)
- set_ipotype();
- break;
- case VKEY:
- if (G.qual==0)
- sethandles_ipo(HD_VECT);
- break;
- case XKEY:
- case DELKEY:
- if (okee("Erase selected")) {
- remove_marker();
- del_ipo(0);
-
- /* note: don't update the other spaces (in particular ipo)
- * or else curves disappear.
- */
- allqueue(REDRAWTIME, 0);
- allqueue(REDRAWSOUND, 0);
- }
- break;
- case ACCENTGRAVEKEY:
- if((G.qual==0)) {
- do_ipo_buttons(B_IPOVIEWALL);
- allqueue(REDRAWIPO, 0);
- }
- break;
-
- }
- }
-
- if(doredraw) scrarea_queue_winredraw(sa);
-}
-
-void initipo(ScrArea *sa)
-{
- SpaceIpo *sipo;
-
- sipo= MEM_callocN(sizeof(SpaceIpo), "initipo");
- BLI_addhead(&sa->spacedata, sipo);
-
- sipo->spacetype= SPACE_IPO;
- sipo->blockscale= 0.7f;
-
- /* sipo space loopt van (0,-?) tot (??,?) */
- sipo->v2d.tot.xmin= 0.0;
- sipo->v2d.tot.ymin= -10.0;
- sipo->v2d.tot.xmax= G.scene->r.efra;
- sipo->v2d.tot.ymax= 10.0;
-
- sipo->v2d.cur= sipo->v2d.tot;
-
- sipo->v2d.min[0]= 0.01f;
- sipo->v2d.min[1]= 0.01f;
-
- sipo->v2d.max[0]= 15000.0f;
- sipo->v2d.max[1]= 10000.0f;
-
- sipo->v2d.scroll= L_SCROLL+B_SCROLL;
- sipo->v2d.keeptot= 0;
-
- sipo->blocktype= ID_OB;
-}
-
-/* ******************** SPACE: INFO ********************** */
-
-void space_mipmap_button_function(int event) {
- set_mipmap(!(U.gameflags & USER_DISABLE_MIPMAP));
-
- allqueue(REDRAWVIEW3D, 0);
-}
-
-#if 0
-static void space_sound_button_function(int event)
-{
- int a;
- SYS_SystemHandle syshandle;
-
- if ((syshandle = SYS_GetSystem()))
- {
- a = (U.gameflags & USER_DISABLE_SOUND);
- SYS_WriteCommandLineInt(syshandle, "noaudio", a);
- }
-}
-#endif
-
-
-static char *iconfile_menu(void)
-{
- static char string[512];
- char *str = string;
- IconFile *ifile;
- ListBase *iconfilelist = BIF_iconfile_list();
-
- str += sprintf(str, "Built-in %%x0|%%l|");
-
- for(ifile=iconfilelist->first; ifile; ifile=ifile->next) {
- str += sprintf(str, "%s %%x%d|", ifile->filename, ifile->index);
- }
-
- return string;
-}
-
-static void set_userdef_iconfile_cb(void *menuindex, void *unused2)
-{
- bTheme *btheme= U.themes.first;
- IconFile *ifile;
- ListBase *iconfilelist = BIF_iconfile_list();
- int index = *((int *)menuindex);
-
- if (index==0) {
- BLI_strncpy(btheme->tui.iconfile, "", sizeof(btheme->tui.iconfile));
- return;
- }
-
- for(ifile=iconfilelist->first; ifile; ifile=ifile->next) {
- if (index == ifile->index) {
- BLI_strncpy(btheme->tui.iconfile, ifile->filename, sizeof(btheme->tui.iconfile));
- }
- }
-}
-
-/* needed for event; choose new 'curmain' resets it... */
-static short th_curcol= TH_BACK;
-static char *th_curcol_ptr= NULL;
-static char th_curcol_arr[4]={0, 0, 0, 255};
-
-static void info_user_themebuts(uiBlock *block, short y1, short y2, short y3)
-{
- bTheme *btheme, *bt;
- int spacetype= 0;
- static short cur=1, curmain=2;
- short a, tot=0, isbuiltin= 0;
- char string[21*32], *strp, *col;
- /* for choosing an icon image based on index in the cached list */
- static int iconfileindex=0;
-
- y3= y2+23; /* exception! */
-
- /* count total, max 16! */
- for(bt= U.themes.first; bt; bt= bt->next) tot++;
-
- /* if cur not is 1; move that to front of list */
- if(cur!=1) {
- a= 1;
- for(bt= U.themes.first; bt; bt= bt->next, a++) {
- if(a==cur) {
- BLI_remlink(&U.themes, bt);
- BLI_addhead(&U.themes, bt);
- allqueue(REDRAWALL, 0);
- cur= 1;
- break;
- }
- }
- }
-
- /* the current theme */
- btheme= U.themes.first;
- if(strcmp(btheme->name, "Default")==0) isbuiltin= 1;
-
- /* construct popup script */
- string[0]= 0;
- for(bt= U.themes.first; bt; bt= bt->next) {
- strcat(string, bt->name);
- if(btheme->next) strcat(string, " |");
- }
- uiDefButS(block, MENU, B_UPDATE_THEME_ICONS, string, 45,y3,200,20, &cur, 0, 0, 0, 0, "Current theme");
-
-
- /* add / delete / name */
-
- if(tot<16)
- uiDefBut(block, BUT, B_ADD_THEME, "Add", 45,y2,200,20, NULL, 0, 0, 0, 0, "Makes new copy of this theme");
- if(tot>1 && isbuiltin==0)
- uiDefBut(block, BUT, B_DEL_THEME, "Delete", 45,y1,200,20, NULL, 0, 0, 0, 0, "Delete theme");
-
- if(isbuiltin) return;
-
- /* name */
- uiDefBut(block, TEX, B_NAME_THEME, "", 255,y3,200,20, btheme->name, 1.0, 30.0, 0, 0, "Rename theme");
-
- /* main choices pup: note, it uses collums, and the seperators (%l) then have to fill both halves equally for the menu to work */
- uiDefButS(block, MENU, B_CHANGE_THEME, "UI and Buttons %x1|%l|3D View %x2|%l|Ipo Curve Editor %x3|Action Editor %x4|"
- "NLA Editor %x5|%l|UV/Image Editor %x6|Video Sequence Editor %x7|Node Editor %x16|Timeline %x15|%l|Audio Window %x8|Text Editor %x9|%l|User Preferences %x10|"
- "Outliner %x11|Buttons Window %x12|%l|File Browser %x13|Image Browser %x14",
- 255,y2,200,20, &curmain, 0, 0, 0, 0, "Specify theme for...");
- if(curmain==1) spacetype= 0;
- else if(curmain==2) spacetype= SPACE_VIEW3D;
- else if(curmain==3) spacetype= SPACE_IPO;
- else if(curmain==4) spacetype= SPACE_ACTION;
- else if(curmain==5) spacetype= SPACE_NLA;
- else if(curmain==6) spacetype= SPACE_IMAGE;
- else if(curmain==7) spacetype= SPACE_SEQ;
- else if(curmain==8) spacetype= SPACE_SOUND;
- else if(curmain==9) spacetype= SPACE_TEXT;
- else if(curmain==10) spacetype= SPACE_INFO;
- else if(curmain==11) spacetype= SPACE_OOPS;
- else if(curmain==12) spacetype= SPACE_BUTS;
- else if(curmain==13) spacetype= SPACE_FILE;
- else if(curmain==14) spacetype= SPACE_IMASEL;
- else if(curmain==15) spacetype= SPACE_TIME;
- else if(curmain==16) spacetype= SPACE_NODE;
- else return; /* only needed while coding... when adding themes for more windows */
-
- /* color choices pup */
- if(curmain==1) {
- strp= BIF_ThemeColorsPup(0);
- if(th_curcol==TH_BACK) th_curcol= TH_BUT_OUTLINE; /* switching main choices... */
- }
- else strp= BIF_ThemeColorsPup(spacetype);
-
- uiDefButS(block, MENU, B_REDR, strp, 255,y1,200,20, &th_curcol, 0, 0, 0, 0, "Current color");
- MEM_freeN(strp);
-
- th_curcol_ptr= col= BIF_ThemeGetColorPtr(btheme, spacetype, th_curcol);
- if(col==NULL) return;
-
- /* first handle exceptions, special single values, row selection, etc */
- if(th_curcol==TH_VERTEX_SIZE) {
- uiDefButC(block, NUMSLI, B_UPDATE_THEME,"Vertex size ", 465,y3,200,20, col, 1.0, 10.0, 0, 0, "");
- }
- else if(th_curcol==TH_FACEDOT_SIZE) {
- uiDefButC(block, NUMSLI, B_UPDATE_THEME,"Face dot size ", 465,y3,200,20, col, 1.0, 10.0, 0, 0, "");
- }
- else if(th_curcol==TH_BUT_DRAWTYPE) {
- uiBlockBeginAlign(block);
- uiDefButC(block, ROW, B_UPDATE_THEME, "Shaded", 465,y2,80,20, col, 2.0, (float) TH_SHADED, 0, 0, "");
- uiDefButC(block, ROW, B_UPDATE_THEME, "Rounded", 545,y2,80,20, col, 2.0, (float) TH_ROUNDED, 0, 0, "");
- uiDefButC(block, ROW, B_UPDATE_THEME, "Minimal", 625,y2,80,20, col, 2.0, (float) TH_MINIMAL, 0, 0, "");
- uiDefButC(block, ROW, B_UPDATE_THEME, "OldSkool", 705,y2,80,20, col, 2.0, (float) TH_OLDSKOOL, 0, 0, "");
- uiBlockEndAlign(block);
- }
- else if(th_curcol==TH_ICONFILE) {
- uiBut *but;
-
- /* set the icon file menu to the correct icon file index for what's stored in the theme values */
- iconfileindex= BIF_iconfile_get_index(btheme->tui.iconfile);
-
- but = uiDefButI(block, MENU, B_UPDATE_THEME_ICONS, iconfile_menu(),
- 465,y2,200,20, &iconfileindex, 0, 0, 0, 0, "The icon PNG file to use, searching in .blender/icons");
- uiButSetFunc(but, set_userdef_iconfile_cb, &iconfileindex, NULL);
-
- }
- else {
- uiBlockBeginAlign(block);
- if ELEM9(th_curcol, TH_PANEL, TH_LAMP, TH_FACE, TH_FACE_SELECT, TH_EDITMESH_ACTIVE, TH_MENU_BACK, TH_MENU_HILITE, TH_MENU_ITEM, TH_NODE) {
- uiDefButC(block, NUMSLI, B_UPDATE_THEME,"A ", 465,y3+25,200,20, col+3, 0.0, 255.0, B_THEMECOL, 0, "");
- }
- uiDefButC(block, NUMSLI, B_UPDATE_THEME,"R ", 465,y3,200,20, col, 0.0, 255.0, B_THEMECOL, 0, "");
- uiDefButC(block, NUMSLI, B_UPDATE_THEME,"G ", 465,y2,200,20, col+1, 0.0, 255.0, B_THEMECOL, 0, "");
- uiDefButC(block, NUMSLI, B_UPDATE_THEME,"B ", 465,y1,200,20, col+2, 0.0, 255.0, B_THEMECOL, 0, "");
- uiBlockEndAlign(block);
-
- uiDefButC(block, COL, B_UPDATE_THEME, "", 675,y1,50,y3-y1+20, col, 0, 0, 0, 0, "");
-
- /* copy paste */
- uiBlockBeginAlign(block);
- uiDefBut(block, BUT, B_THEME_COPY, "Copy Color", 755,y2,120,20, NULL, 0, 0, 0, 0, "Stores current color in buffer");
- uiDefBut(block, BUT, B_THEME_PASTE, "Paste Color", 755,y1,120,20, NULL, 0, 0, 0, 0, "Pastes buffer color");
- uiBlockEndAlign(block);
-
- uiDefButC(block, COL, 0, "", 885,y1,50,y2-y1+20, th_curcol_arr, 0, 0, 0, 0, "");
-
- }
-}
-
-
-void drawinfospace(ScrArea *sa, void *spacedata)
-{
- uiBlock *block;
- static short cur_light=0;
- float fac, col[3];
- short xpos, ypos, ypostab, buth, rspace, dx, y1, y2, y3, y4, y5, y6, y7;
- short y2label, y3label, y4label, y5label, y6label, y7label;
- short spref, mpref, lpref, smfileselbut;
- short edgsp, midsp;
- char naam[32];
-
- if(curarea->win==0 || curarea->winy<2) return;
-
- BIF_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- /* smaller buttons make no sense */
- if(curarea->winx<320) return;
-
- if(curarea->winx<=1280.0) {
- fac= ((float)curarea->winx)/1280.0f;
- myortho2(0.375f, 1280.375f, 0.375f, curarea->winy/fac + 0.375f);
- }
- else {
- myortho2(0.375f, (float)curarea->winx + 0.375f, 0.375f, (float)curarea->winy + 0.375f);
- }
-
- sprintf(naam, "infowin %d", curarea->win);
- block= uiNewBlock(&curarea->uiblocks, naam, UI_EMBOSS, UI_HELV, curarea->win);
-
-
- /* Vars for nice grid alignment */
- dx= (1280-90)/7; /* spacing for use in equally dividing 'tab' row */
-
- xpos = 45; /* left padding */
- ypos = 50; /* bottom padding for buttons */
- ypostab = 10; /* bottom padding for 'tab' row */
-
- buth = 20; /* standard button height */
-
- spref = 90; /* standard size for small preferences button */
- mpref = 189; /* standard size for medium preferences button */
- lpref = 288; /* standard size for large preferences button */
- smfileselbut = buth; /* standard size for fileselect button (square) */
-
- edgsp = 3; /* space from edge of end 'tab' to edge of end button */
- midsp = 9; /* horizontal space between buttons */
-
- rspace = 3; /* default space between rows */
-
- y1 = ypos; /* grid alignment for each row of buttons */
- y2 = ypos+buth+rspace;
- y3 = ypos+2*(buth+rspace);
- y4 = ypos+3*(buth+rspace);
- y5 = ypos+4*(buth+rspace);
- y6 = ypos+5*(buth+rspace);
- y7 = ypos+6*(buth+rspace);
-
-
- y2label = y2-2; /* adjustments to offset the labels down to align better */
- y3label = y3-2;
- y4label = y4-2;
- y5label = y5-2;
- y6label = y6-2;
- y7label = y7-2;
-
-
- /* set the color to blue and draw the main 'tab' controls */
-
- uiBlockSetCol(block, TH_BUT_SETTING1);
- uiBlockBeginAlign(block);
-
- uiDefButS(block, ROW,B_USERPREF,"View & Controls",
- xpos,ypostab,(short)dx,buth,
- &U.userpref,1.0,0.0, 0, 0,"");
-
- uiDefButS(block, ROW,B_USERPREF,"Edit Methods",
- (short)(xpos+dx),ypostab,(short)dx,buth,
- &U.userpref,1.0,1.0, 0, 0,"");
-
- uiDefButS(block, ROW,B_USERPREF,"Language & Font",
- (short)(xpos+2*dx),ypostab,(short)dx,buth,
- &U.userpref,1.0,2.0, 0, 0,"");
-
- uiDefButS(block, ROW,B_USERPREF,"Themes",
- (short)(xpos+3*dx),ypostab,(short)dx,buth,
- &U.userpref,1.0,6.0, 0, 0,"");
-
- uiDefButS(block, ROW,B_USERPREF,"Auto Save",
- (short)(xpos+4*dx),ypostab,(short)dx,buth,
- &U.userpref,1.0,3.0, 0, 0,"");
-
- uiDefButS(block, ROW,B_USERPREF,"System & OpenGL",
- (short)(xpos+5*dx),ypostab,(short)dx,buth,
- &U.userpref,1.0,4.0, 0, 0,"");
-
- uiDefButS(block, ROW,B_USERPREF,"File Paths",
- (short)(xpos+6*dx),ypostab,(short)dx,buth,
- &U.userpref,1.0,5.0, 0, 0,"");
-
- uiBlockSetCol(block, TH_AUTO);
- uiBlockEndAlign(block);
- /* end 'tab' controls */
-
- /* line 2: left x co-ord, top y co-ord, width, height */
-
- if(U.userpref == 6) {
- info_user_themebuts(block, y1, y2, y3);
- }
- else if (U.userpref == 0) { /* view & controls */
-
- uiDefBut(block, LABEL,0,"Display:",
- xpos,y6label,spref,buth,
- 0, 0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, USER_TOOLTIPS, 0, "Tool Tips",
- (xpos+edgsp),y5,spref,buth,
- &(U.flag), 0, 0, 0, 0,
- "Display tooltips (help tags) over buttons");
- uiDefButBitI(block, TOG, USER_DRAWVIEWINFO, B_DRAWINFO, "Object Info",
- (xpos+edgsp),y4,spref,buth,
- &(U.uiflag), 0, 0, 0, 0,
- "Display active object name and frame number in the 3D View");
- uiDefButBitI(block, TOG, USER_SCENEGLOBAL, 0, "Global Scene",
- (xpos+edgsp),y3,spref,buth,
- &(U.flag), 0, 0, 0, 0,
- "Forces the current Scene to be displayed in all Screens");
-#ifndef __APPLE__
- uiDefButBitS(block, TOG, 1, 0, "Large Cursors",
- (xpos+edgsp),y2,spref,buth,
- &(U.curssize), 0, 0, 0, 0,
- "Use large mouse cursors when available");
-#else
- U.curssize=0; /*Small Cursor always for OS X for now */
-#endif
- uiDefButBitI(block, TOG, USER_SHOW_VIEWPORTNAME, B_DRAWINFO, "View Name",
- (xpos+edgsp),y1,spref,buth,
- &(U.uiflag), 0, 0, 0, 0,
- "Show the name of the view's direction in each 3D View");
- uiBlockEndAlign(block);
-
- uiDefBut(block, LABEL,0,"Menus:",
- (xpos+(2*edgsp)+spref),y6label,spref,buth,
- 0, 0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, USER_MENUOPENAUTO, 0, "Open on Mouse Over",
- (xpos+edgsp+spref+midsp),y5,mpref,buth,
- &(U.uiflag), 0, 0, 0, 0,
- "Open menu buttons and pulldowns automatically when the mouse is hovering");
- uiDefButS(block, NUM, 0, "Top Level:",
- (xpos+edgsp+spref+midsp),y4,spref+edgsp,buth,
- &(U.menuthreshold1), 1, 40, 0, 0,
- "Time delay in 1/10 seconds before automatically opening top level menus");
- uiDefButS(block, NUM, 0, "Sublevels:",
- (xpos+edgsp+(2*spref)+(2*midsp)-edgsp),y4,spref+edgsp,buth,
- &(U.menuthreshold2), 1, 40, 0, 0,
- "Time delay in 1/10 seconds before automatically opening menu sublevels");
- uiBlockEndAlign(block);
-
- uiDefBut(block, LABEL,0,"Toolbox click-hold delay:",
- (xpos+(2*edgsp)+spref),y3label,mpref,buth,
- 0, 0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButS(block, NUM, 0, "LMB:",
- (xpos+edgsp+spref+midsp),y2,spref+edgsp,buth,
- &(U.tb_leftmouse), 2, 40, 0, 0,
- "Time in 1/10 seconds to hold the Left Mouse Button before opening the toolbox");
- uiDefButS(block, NUM, 0, "RMB:",
- (xpos+edgsp+(2*spref)+(2*midsp)-edgsp),y2,spref+edgsp,buth,
- &(U.tb_rightmouse), 2, 40, 0, 0,
- "Time in 1/10 seconds to hold the Right Mouse Button before opening the toolbox");
- uiBlockEndAlign(block);
-
- uiDefButBitI(block, TOG, USER_PANELPINNED, 0, "Pin Floating Panels",
- (xpos+edgsp+spref+midsp),y1,(mpref/2),buth,
- &(U.uiflag), 0, 0, 0, 0,
- "Make floating panels invoked by a hotkey (eg. N Key) open at the previous location");
- uiDefButBitI(block, TOG, USER_PLAINMENUS, B_PLAINMENUS, "Plain Menus",
- (xpos+edgsp+(2*spref)+(2*midsp)),y1,spref,buth,
- &(U.uiflag), 0, 0, 0, 0,
- "Use a column layout for toolbox and do not flip the contents of any menu");
- uiBlockEndAlign(block);
-
- uiDefBut(block, LABEL,0,"Snap to grid:",
- (xpos+(2*edgsp)+spref+midsp+mpref),y6label,mpref,buth,
- 0, 0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, USER_AUTOGRABGRID, 0, "Grab/Move",
- (xpos+edgsp+mpref+spref+(2*midsp)),y5,spref,buth,
- &(U.flag), 0, 0, 0, 0,
- "Snap objects and sub-objects to grid units when moving");
- uiDefButBitI(block, TOG, USER_AUTOROTGRID, 0, "Rotate",
- (xpos+edgsp+mpref+spref+(2*midsp)),y4,spref,buth,
- &(U.flag), 0, 0, 0, 0,
- "Snap objects and sub-objects to grid units when rotating");
- uiDefButBitI(block, TOG, USER_AUTOSIZEGRID, 0, "Scale",
- (xpos+edgsp+mpref+spref+(2*midsp)),y3,spref,buth,
- &(U.flag), 0, 0, 0, 0,
- "Snap objects and sub-objects to grid units when scaling");
- uiBlockEndAlign(block);
-
- uiDefButBitI(block, TOG, USER_LOCKAROUND, B_DRAWINFO, "Global Pivot",
- (xpos+edgsp+mpref+spref+(2*midsp)),y1,spref,buth,
- &(U.uiflag), 0, 0, 0, 0,
- "Lock the same rotation/scaling pivot in all 3D Views");
-
- uiDefBut(block, LABEL,0,"View zoom:",
- (xpos+(2*edgsp)+mpref+(2*spref)+(2*midsp)),y6label,mpref,buth,
- 0, 0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiBlockSetCol(block, TH_BUT_SETTING1); /* mutually exclusive toggles, start color */
- uiDefButS(block, ROW, 0, "Continue",
- (xpos+edgsp+mpref+(2*spref)+(3*midsp)),y5,(mpref/3),buth,
- &(U.viewzoom), 40, USER_ZOOM_CONT, 0, 0,
- "Old style zoom, continues while moving mouse up or down");
- uiDefButS(block, ROW, 0, "Dolly",
- (xpos+edgsp+mpref+(2*spref)+(3*midsp)+(mpref/3)),y5,(mpref/3),buth,
- &(U.viewzoom), 40, USER_ZOOM_DOLLY, 0, 0,
- "Zooms in and out based on vertical mouse movement.");
- uiDefButS(block, ROW, 0, "Scale",
- (xpos+edgsp+mpref+(2*spref)+(3*midsp)+(2*mpref/3)),y5,(mpref/3),buth,
- &(U.viewzoom), 40, USER_ZOOM_SCALE, 0, 0,
- "Zooms in and out like scaling the view, mouse movements relative to center.");
- uiBlockSetCol(block, TH_AUTO); /* end color */
- uiBlockEndAlign(block);
-
- uiDefButBitI(block, TOG, USER_ZOOM_TO_MOUSEPOS, B_DRAWINFO, "Zoom to Mouse Position",
- (xpos+edgsp+mpref+(2*spref)+(3*midsp)),y4,mpref,buth,
- &(U.uiflag), 0, 0, 0, 0,
- "Zoom in towards the mouse pointer's position in the 3D view, rather than the 2D window center");
-
- uiDefBut(block, LABEL,0,"View rotation:",
- (xpos+(2*edgsp)+mpref+(2*spref)+(2*midsp)),y3label,mpref,buth,
- 0, 0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiBlockSetCol(block, TH_BUT_SETTING1); /* mutually exclusive toggles, start color */
- uiDefButBitI(block, TOG, USER_TRACKBALL, B_DRAWINFO, "Trackball",
- (xpos+edgsp+mpref+(2*spref)+(3*midsp)),y2,(mpref/2),buth,
- &(U.flag), 0, 0, 0, 0,
- "Allow the view to tumble freely when orbiting with the Middle Mouse Button");
- uiDefButBitI(block, TOGN, USER_TRACKBALL, B_DRAWINFO, "Turntable",
- (xpos+edgsp+mpref+(2*spref)+(3*midsp)+(mpref/2)),y2,(mpref/2),buth,
- &(U.flag), 0, 0, 0, 0,
- "Use fixed up axis for orbiting with Middle Mouse Button");
- uiBlockSetCol(block, TH_AUTO); /* end color */
- uiDefButBitI(block, TOG, USER_AUTOPERSP, B_DRAWINFO, "Auto Perspective",
- (xpos+edgsp+mpref+(2*spref)+(3*midsp)),y1,(mpref/2),buth,
- &(U.uiflag), 0, 0, 0, 0,
- "Automatically switch between orthographic and perspective when changing from top/front/side views");
- uiDefButBitI(block, TOG, USER_ORBIT_SELECTION, B_DRAWINFO, "Around Selection",
- (xpos+edgsp+mpref+(2*spref)+(3*midsp)+(mpref/2)),y1,(mpref/2),buth,
- &(U.uiflag), 0, 0, 0, 0,
- "Use selection as the orbiting center");
- uiBlockEndAlign(block);
-
- uiDefBut(block, LABEL,0,"Select with:",
- (xpos+(2*edgsp)+(3*mpref)+(3*midsp)),y6label,mpref,buth,
- 0, 0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiBlockSetCol(block, TH_BUT_SETTING1); /* mutually exclusive toggles, start color */
- uiDefButBitI(block, TOG, USER_LMOUSESELECT, B_DRAWINFO, "Left Mouse",
- (xpos+edgsp+(3*mpref)+(4*midsp)),y5,(mpref/2),buth,
- &(U.flag), 0, 0, 0, 0, "Use the Left Mouse Button for selection");
- uiDefButBitI(block, TOGN, USER_LMOUSESELECT, B_DRAWINFO, "Right Mouse",
- (xpos+edgsp+(3*mpref)+(4*midsp)+(mpref/2)),y5,(mpref/2),buth,
- &(U.flag), 0, 0, 0, 0, "Use the Right Mouse Button for selection");
- uiBlockSetCol(block, TH_AUTO); /* end color */
- uiBlockEndAlign(block);
-
-
- if(U.flag & USER_LMOUSESELECT) {
- uiDefBut(block, LABEL,0,"Cursor with: Right Mouse",
- (xpos+(2*edgsp)+(3*mpref)+(3*midsp)),y4label+5,mpref,buth,
- 0, 0, 0, 0, 0, "");
- } else {
- uiDefBut(block, LABEL,0,"Cursor with: Left Mouse",
- (xpos+(2*edgsp)+(3*mpref)+(3*midsp)),y4label+5,mpref,buth,
- 0, 0, 0, 0, 0, "");
- }
-
- uiDefButBitI(block, TOG, USER_SHOW_FPS, B_DRAWINFO, "Display FPS in View",
- (xpos+edgsp+(3*mpref)+(4*midsp)),y2,mpref,buth,
- &(U.uiflag), 0, 0, 0, 0,
- "Display the number of frames per secons being drawn");
-
- /* illegal combo... */
- if (U.flag & USER_LMOUSESELECT)
- U.flag &= ~USER_TWOBUTTONMOUSE;
-
- uiDefButBitI(block, TOG, USER_TWOBUTTONMOUSE, B_DRAWINFO, "Emulate 3 Button Mouse",
- (xpos+edgsp+(3*mpref)+(4*midsp)),y3,mpref,buth,
- &(U.flag), 0, 0, 0, 0,
- "Emulates Middle Mouse with Alt+LeftMouse (doesnt work with Left Mouse Select option)");
-
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, USER_SHOW_ROTVIEWICON, B_DRAWINFO, "Mini Axis",
- (xpos+edgsp+(3*mpref)+(4*midsp)),y1,(mpref/3),buth,
- &(U.uiflag), 0, 0, 0, 0,
- "Show a small rotating 3D axis in the bottom left corner of the 3D View");
- uiDefButS(block, NUM, B_DRAWINFO, "Size:",
- (xpos+edgsp+(3*mpref)+(4*midsp)+(mpref/3)),y1,(mpref/3),buth,
- &U.rvisize, 10, 64, 0, 0,
- "The axis icon's size");
- uiDefButS(block, NUM, B_DRAWINFO, "Bright:",
- (xpos+edgsp+(3*mpref)+(4*midsp)+2*(mpref/3)),y1,(mpref/3),buth,
- &U.rvibright, 0, 10, 0, 0,
- "The brightness of the icon");
- uiBlockEndAlign(block);
-
- uiDefBut(block, LABEL,0,"Middle Mouse Button:",
- (xpos+(2*edgsp)+(4*mpref)+(4*midsp)),y6label,mpref,buth,
- 0, 0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiBlockSetCol(block, TH_BUT_SETTING1); /* mutually exclusive toggles, start color */
- uiDefButBitI(block, TOGN, USER_VIEWMOVE, B_DRAWINFO, "Rotate View",
- (xpos+edgsp+(4*mpref)+(5*midsp)),y5,(mpref/2),buth,
- &(U.flag), 0, 0, 0, 0, "Default action for the Middle Mouse Button");
- uiDefButBitI(block, TOG, USER_VIEWMOVE, B_DRAWINFO, "Pan View",
- (xpos+edgsp+(4*mpref)+(5*midsp)+(mpref/2)),y5,(mpref/2),buth,
- &(U.flag), 0, 0, 0, 0, "Default action for the Middle Mouse Button");
- uiBlockSetCol(block, TH_AUTO); /* end color */
- uiBlockEndAlign(block);
-
-
- uiDefBut(block, LABEL,0,"Mouse Wheel:",
- (xpos+(2*edgsp)+(4*mpref)+(4*midsp)),y4label,mpref,buth,
- 0, 0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, USER_WHEELZOOMDIR, 0, "Invert Zoom",
- (xpos+edgsp+(4*mpref)+(5*midsp)),y3,spref,buth,
- &(U.uiflag), 0, 0, 0, 0,
- "Swap the Mouse Wheel zoom direction");
- uiDefButI(block, NUM, 0, "Scroll Lines:",
- (xpos+edgsp+(4*mpref)+(6*midsp)+spref-edgsp),y3,spref+edgsp,buth,
- &U.wheellinescroll, 0.0, 32.0, 0, 0,
- "The number of lines scrolled at a time with the mouse wheel");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButS(block, NUM, B_DRAWINFO, "Smooth View:",
- (xpos+edgsp+(4*mpref)+(5*midsp)),y2,(mpref),buth,
- &U.smooth_viewtx, 0, 1000, 0, 0,
- "The time to animate the view in miliseconds, zero to disable");
- uiDefButS(block, NUM, B_DRAWINFO, "Rotation Angle:",
- (xpos+edgsp+(4*mpref)+(5*midsp)),y1,(mpref),buth,
- &U.pad_rot_angle, 0, 90, 0, 0,
- "The rotation step for numerical pad keys (2 4 6 8)");
- uiBlockEndAlign(block);
-
-
- uiDefBut(block, LABEL,0,"3D Transform Widget:",
- (xpos+(2*edgsp)+(5*mpref)+(5*midsp)),y6label,mpref,buth,
- 0, 0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButS(block, NUM, B_REDRCURW3D, "Size:",
- (xpos+edgsp+(5*mpref)+(6*midsp)),y5,(mpref/2),buth,
- &(U.tw_size), 2, 40, 0, 0, "Diameter of widget, in 10 pixel units");
- uiDefButS(block, NUM, B_REDRCURW3D, "Handle:",
- (xpos+edgsp+(5*mpref)+(6*midsp)+(mpref/2)),y5,(mpref/2),buth,
- &(U.tw_handlesize), 2, 40, 0, 0, "Size of widget handles as percentage of widget radius");
- uiDefButS(block, NUM, B_REDRCURW3D, "Hotspot:",
- (xpos+edgsp+(5*mpref)+(6*midsp)),y4,(mpref),buth,
- &(U.tw_hotspot), 4, 40, 0, 0, "Hotspot in pixels for clicking widget handles");
- uiBlockEndAlign(block);
-
- uiDefButS(block, NUM, B_REDRCURW3D, "Object Center Size: ",
- (xpos+edgsp+(5*mpref)+(6*midsp)),y3,mpref,buth,
- &(U.obcenter_dia), 4, 10, 0, 0,
- "Diameter in Pixels for Object/Lamp center display");
-
-
- } else if (U.userpref == 1) { /* edit methods */
-
-
- uiDefBut(block, LABEL,0,"Material linked to:",
- xpos,y5label,mpref,buth,
- 0, 0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOGN, USER_MAT_ON_OB, B_DRAWINFO, "ObData",
- (xpos+edgsp),y4,(mpref/2),buth,
- &(U.flag), 0, 0, 0, 0, "Link new objects' material to the obData block");
- uiDefButBitI(block, TOG, USER_MAT_ON_OB, B_DRAWINFO, "Object",
- (xpos+edgsp+(mpref/2)),y4,(mpref/2),buth,
- &(U.flag), 0, 0, 0, 0, "Link new objects' material to the object block");
- uiBlockEndAlign(block);
-
- uiDefBut(block, LABEL,0,"Add new objects:",
- xpos,y3label,mpref,buth,
- 0, 0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, USER_ADD_EDITMODE, B_DRAWINFO, "Switch to Edit Mode",
- (xpos+edgsp),y2,mpref,buth,
- &(U.flag), 0, 0, 0, 0, "Enter Edit Mode automatically after adding a new object");
- uiDefButBitI(block, TOG, USER_ADD_VIEWALIGNED, B_DRAWINFO, "Aligned to View",
- (xpos+edgsp),y1,mpref,buth,
- &(U.flag), 0, 0, 0, 0, "Align newly added objects facing the 3D View direction");
- uiBlockEndAlign(block);
-
-
- uiDefBut(block, LABEL,0,"Undo:",
- (xpos+(2*edgsp)+mpref),y3label, mpref,buth,
- 0, 0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButS(block, NUMSLI, B_DRAWINFO, "Steps: ",
- (xpos+edgsp+mpref+midsp),y2,mpref,buth,
- &(U.undosteps), 0, 64, 0, 0, "Number of undo steps available (smaller values conserve memory)");
-
- uiDefButBitI(block, TOG, USER_GLOBALUNDO, B_DRAWINFO, "Global Undo",
- (xpos+edgsp+mpref+midsp),y1,mpref,buth,
- &(U.uiflag), 2, 64, 0, 0, "Global undo works by keeping a full copy of the file itself in memory, so takes extra memory");
- uiBlockEndAlign(block);
-
-
- uiDefBut(block, LABEL,0,"Auto keyframe",
- (xpos+(2*edgsp)+(2*mpref)+midsp),y5label,mpref,buth,
- 0, 0, 0, 0, 0, "");
-
- uiDefButBitI(block, TOG, G_RECORDKEYS, REDRAWTIME, "Action and Object",
- (xpos+edgsp+(2*mpref)+(2*midsp)),y4,mpref, buth,
- &(G.flags), 0, 0, 0, 0, "Automatic keyframe insertion in Object and Action Ipo curves");
-
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, USER_KEYINSERTAVAI, REDRAWTIME, "Available",
- (xpos+edgsp+(2*mpref)+(2*midsp)),y3,mpref, buth,
- &(U.uiflag), 0, 0, 0, 0, "Automatic keyframe insertion in available curves");
-
- uiDefButBitI(block, TOG, USER_KEYINSERTNEED, REDRAWTIME, "Needed",
- (xpos+edgsp+(2*mpref)+(2*midsp)),y2,mpref, buth,
- &(U.uiflag), 0, 0, 0, 0, "Automatic keyframe insertion only when keyframe needed");
-
- uiDefButBitI(block, TOG, G_AUTOMATKEYS, REDRAWTIME, "Use Visual Keying",
- (xpos+edgsp+(2*mpref)+(2*midsp)),y1,mpref, buth,
- &(G.flags), 0, 0, 0, 0, "Use Visual keying automatically for constrained objects");
- uiBlockEndAlign(block);
-
-/* uiDefButBitS(block, TOG, USER_KEYINSERTACT, 0, "Action",
- (xpos+edgsp+(2*mpref)+(2*midsp)),y2,(spref+edgsp),buth,
- &(U.uiflag), 0, 0, 0, 0, "Automatic keyframe insertion in Action Ipo curve");
- uiDefButBitS(block, TOG, USER_KEYINSERTOBJ, 0, "Object",
- (xpos+edgsp+(2*mpref)+(3*midsp)+spref-edgsp),y2,(spref+edgsp),buth,
- &(U.uiflag), 0, 0, 0, 0, "Automatic keyframe insertion in Object Ipo curve"); */
-
-
- uiDefBut(block, LABEL,0,"Duplicate with object:",
- (xpos+(2*edgsp)+(3*midsp)+(3*mpref)+spref),y3label,mpref,buth,
- 0, 0, 0, 0, 0, "");
-
- uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, USER_DUP_MESH, 0, "Mesh",
- (xpos+edgsp+(4*midsp)+(3*mpref)+spref),y2,(spref+edgsp),buth,
- &(U.dupflag), 0, 0, 0, 0, "Causes mesh data to be duplicated with Shift+D");
- uiDefButBitI(block, TOG, USER_DUP_SURF, 0, "Surface",
- (xpos+edgsp+(5*midsp)+(3*mpref)+(2*spref)),y2,(spref+edgsp),buth,
- &(U.dupflag), 0, 0, 0, 0, "Causes surface data to be duplicated with Shift+D");
- uiDefButBitI(block, TOG, USER_DUP_CURVE, 0, "Curve",
- (xpos+edgsp+(6*midsp)+(3*mpref)+(3*spref)),y2,(spref+edgsp),buth,
- &(U.dupflag), 0, 0, 0, 0, "Causes curve data to be duplicated with Shift+D");
- uiDefButBitI(block, TOG, USER_DUP_FONT, 0, "Text",
- (xpos+edgsp+(7*midsp)+(3*mpref)+(4*spref)),y2,(spref+edgsp),buth,
- &(U.dupflag), 0, 0, 0, 0, "Causes text data to be duplicated with Shift+D");
- uiDefButBitI(block, TOG, USER_DUP_MBALL, 0, "Metaball",
- (xpos+edgsp+(8*midsp)+(3*mpref)+(5*spref)),y2,(spref+edgsp),buth,
- &(U.dupflag), 0, 0, 0, 0, "Causes metaball data to be duplicated with Shift+D");
-
- uiDefButBitI(block, TOG, USER_DUP_ARM, 0, "Armature",
- (xpos+edgsp+(4*midsp)+(3*mpref)+spref),y1,(spref+edgsp),buth,
- &(U.dupflag), 0, 0, 0, 0, "Causes armature data to be duplicated with Shift+D");
- uiDefButBitI(block, TOG, USER_DUP_LAMP, 0, "Lamp",
- (xpos+edgsp+(5*midsp)+(3*mpref)+(2*spref)),y1,(spref+edgsp),buth,
- &(U.dupflag), 0, 0, 0, 0, "Causes lamp data to be duplicated with Shift+D");
- uiDefButBitI(block, TOG, USER_DUP_MAT, 0, "Material",
- (xpos+edgsp+(6*midsp)+(3*mpref)+(3*spref)),y1,(spref+edgsp),buth,
- &(U.dupflag), 0, 0, 0, 0, "Causes material data to be duplicated with Shift+D");
- uiDefButBitI(block, TOG, USER_DUP_TEX, 0, "Texture",
- (xpos+edgsp+(7*midsp)+(3*mpref)+(4*spref)),y1,(spref+edgsp),buth,
- &(U.dupflag), 0, 0, 0, 0, "Causes texture data to be duplicated with Shift+D");
- uiDefButBitI(block, TOG, USER_DUP_IPO, 0, "Ipo",
- (xpos+edgsp+(8*midsp)+(3*mpref)+(5*spref)),y1,(spref+edgsp),buth,
- &(U.dupflag), 0, 0, 0, 0, "Causes ipo data to be duplicated with Shift+D");
- uiBlockEndAlign(block);
-
- } else if(U.userpref == 2) { /* language & colors */
-
-#ifdef INTERNATIONAL
- uiDefButBitS(block, TOG, USER_DOTRANSLATE, B_DOLANGUIFONT, "International Fonts",
- xpos,y2,mpref,buth,
- &(U.transopts), 0, 0, 0, 0, "Activate international interface");
-
- if(U.transopts & USER_DOTRANSLATE) {
- char curfont[320];
-
- sprintf(curfont, "Interface Font: ");
- if(U.fontname[0]) strcat(curfont, U.fontname);
- else strcat(curfont, "Built-in");
-
- uiDefBut(block, LABEL,0,curfont,
- (xpos),y3,4*mpref,buth,
- 0, 0, 0, 0, 0, "");
-
- uiDefBut(block, BUT, B_LOADUIFONT, "Select Font",
- xpos,y1,mpref,buth,
- 0, 0, 0, 0, 0, "Select a new font for the interface");
-
- uiDefButI(block, BUT, B_RESTOREFONT, "Restore to default",
- (xpos+edgsp+mpref+midsp),y2,mpref,buth,
- &U.fontsize, 0, 0, 0, 0, "Restores to using the default included antialised font");
-
- uiDefButI(block, MENU, B_SETFONTSIZE, fontsize_pup(),
- (xpos+edgsp+mpref+midsp),y1,mpref,buth,
- &U.fontsize, 0, 0, 0, 0, "Current interface font size (points)");
-
-/*
- uiDefButS(block, MENU, B_SETENCODING, encoding_pup(),
- (xpos+edgsp+mpref+midsp),y1,mpref,buth,
- &U.encoding, 0, 0, 0, 0, "Current interface font encoding");
-
-
- uiDefBut(block, LABEL,0,"Translate:",
- (xpos+edgsp+(2.1*mpref)+(2*midsp)),y3label,mpref,buth,
- 0, 0, 0, 0, 0, "");
-*/
-
- uiDefButBitS(block, TOG, USER_TR_TOOLTIPS, B_SETTRANSBUTS, "Tooltips",
- (xpos+edgsp+(2.2*mpref)+(3*midsp)),y1,spref,buth,
- &(U.transopts), 0, 0, 0, 0, "Translate tooltips");
-
- uiDefButBitS(block, TOG, USER_TR_BUTTONS, B_SETTRANSBUTS, "Buttons",
- (xpos+edgsp+(2.2*mpref)+(4*midsp)+spref),y1,spref,buth,
- &(U.transopts), 0, 0, 0, 0, "Translate button labels");
-
- uiDefButBitS(block, TOG, USER_TR_MENUS, B_SETTRANSBUTS, "Toolbox",
- (xpos+edgsp+(2.2*mpref)+(5*midsp)+(2*spref)),y1,spref,buth,
- &(U.transopts), 0, 0, 0, 0, "Translate toolbox menu");
-
- uiDefButI(block, MENU, B_SETLANGUAGE, language_pup(),
- (xpos+edgsp+(2.2*mpref)+(3*midsp)),y2,mpref+(0.5*mpref)+3,buth,
- &U.language, 0, 0, 0, 0, "Select interface language");
-
- uiDefButBitS(block, TOG, USER_USETEXTUREFONT, B_USETEXTUREFONT, "Use Textured Fonts",
- (xpos+edgsp+(4*mpref)+(4*midsp)),y2,mpref,buth,
- &(U.transopts), 0, 0, 0, 0,
- "Use Textured Fonts");
- }
-
-/* end of INTERNATIONAL */
-#endif
-
- } else if(U.userpref == 3) { /* auto save */
-
-
- uiDefButS(block, NUM, 0, "Save Versions:",
- (xpos+edgsp),y3,mpref,buth,
- &U.versions, 0.0, 32.0, 0, 0,
- "The number of old versions to maintain in the current directory, when manually saving");
-
- uiDefButBitI(block, TOG, USER_AUTOSAVE, B_RESETAUTOSAVE, "Auto Save Temp Files",
- (xpos+edgsp+mpref+midsp),y3,mpref,buth,
- &(U.flag), 0, 0, 0, 0,
- "Enables automatic saving of temporary files");
-
- if(U.flag & USER_AUTOSAVE) {
-
- uiDefButI(block, NUM, B_RESETAUTOSAVE, "Minutes:",
- (xpos+edgsp+mpref+midsp),y2,mpref,buth,
- &(U.savetime), 1.0, 60.0, 0, 0,
- "The time (in minutes) to wait between automatic temporary saves");
-
- uiDefBut(block, BUT, B_LOADTEMP, "Open Recent",
- (xpos+edgsp+mpref+midsp),y1,mpref,buth,
- 0, 0, 0, 0, 0,"Open the most recently saved temporary file");
- }
-
- uiDefButS(block, NUM, B_DRAWINFO, "Recent Files:",
- (xpos+edgsp+(2*mpref)+(3*midsp)),y3,(mpref),buth,
- &U.recent_files, 0, 30, 0, 0,
- "Maximum number of recently opened files to remember");
-
- uiDefButBitI(block, TOG, USER_SAVE_PREVIEWS, 0, "Save Preview Images",
- (xpos+edgsp+(3*mpref)+(4*midsp)),y3,mpref,buth,
- &(U.flag), 0, 0, 0, 0,
- "Enables automatic saving of preview images in the .blend file");
-
- } else if (U.userpref == 4) { /* system & opengl */
- int memcachemax;
- if (sizeof(void *) ==8) memcachemax = 1024*16; /* 64bit system, 16 gig of ram would be nice */
- else memcachemax = 1024; /* 32 bit system, cant address over 2gig anyway */
-
- uiDefBut(block, LABEL,0,"Solid OpenGL lights:",
- xpos+edgsp, y6label, mpref, buth,
- 0, 0, 0, 0, 0, "");
-
- for (cur_light=0; cur_light<3; cur_light++) {
- char lightname[12];
- int lightbutw=buth*2;
- int offs=cur_light*(midsp+lightbutw);
-
- sprintf(lightname, "Light %d", cur_light+1);
-
- uiDefButBitI(block, TOG, 1, B_RECALCLIGHT, lightname,
- xpos+edgsp+offs, y5, lightbutw, buth,
- &U.light[cur_light].flag, 0.0, 0.0, 0, 0, "Enable this OpenGL light in Solid draw mode");
-
- uiDefButF(block, BUT_NORMAL, B_RECALCLIGHT, "",
- xpos+edgsp+offs, y3, lightbutw, buth*2+rspace,
- U.light[cur_light].vec, 0.0f, 1.0f, 0, 0, "The direction that the OpenGL light is shining");
-
- uiDefButF(block, COL, B_RECALCLIGHT, "",
- xpos+edgsp+offs, y2, lightbutw, buth,
- U.light[cur_light].col, 0.0, 0.0, 0, 0, "");
- uiDefButF(block, COL, B_RECALCLIGHT, "",
- xpos+edgsp+offs, y1, lightbutw, buth,
- U.light[cur_light].spec, 0.0, 0.0, 0, 0, "");
- }
-
- uiDefBut(block, LABEL,0,"Color",
- xpos+edgsp+140, y2, mpref/4, buth,
- 0, 0, 0, 0, 0, "");
- uiDefBut(block, LABEL,0,"Spec",
- xpos+edgsp+140, y1, mpref/4, buth,
- 0, 0, 0, 0, 0, "");
-
-
-#ifdef WITH_VERSE
- uiDefBut(block, LABEL,0,"Verse:",
- (xpos+edgsp+(3*midsp)+(3*mpref)),y6label,mpref,buth,
- 0, 0, 0, 0, 0, "");
-
- uiDefBut(block, TEX, 0, "Master: ",
- (xpos+edgsp+(3*midsp)+(3*mpref)),y5,mpref,buth,
- U.versemaster, 1.0, 63.0, 0, 0,
- "The Verse Master-server IP");
- uiDefBut(block, TEX, 0, "Username: ",
- (xpos+edgsp+(3*midsp)+(3*mpref)),y4,mpref,buth,
- U.verseuser, 1.0, 63.0, 0, 0,
- "The Verse user name");
-#endif
-
-/*
- uiDefButBitS(block, TOG, USER_EVTTOCONSOLE, 0, "Log Events to Console",
- (xpos+edgsp),y2,lpref,buth,
- &(U.uiflag), 0, 0, 0, 0, "Display a list of input events in the console");
-
- uiDefButS(block, MENU, B_CONSOLEOUT, consolemethod_pup(),
- (xpos+edgsp), y1, lpref,buth,
- &U.console_out, 0, 0, 0, 0, "Select console output method");
-
- uiDefButS(block, NUM, B_CONSOLENUMLINES, "Lines:",
- (xpos+edgsp+lpref+midsp),y1,spref,buth,
- &U.console_buffer, 1.0, 4000.0, 0, 0, "Maximum number of internal console lines");
-*/
-
-#ifdef _WIN32
- uiDefBut(block, LABEL,0,"Win Codecs:",
- (xpos+edgsp+(1*midsp)+(1*mpref)),y3label,mpref,buth,
- 0, 0, 0, 0, 0, "");
-
- uiDefButBitI(block, TOG, USER_ALLWINCODECS, 0, "Enable all codecs",
- (xpos+edgsp+(1*mpref)+(1*midsp)),y2,mpref,buth,
- &(U.uiflag), 0, 0, 0, 0, "Allows all codecs for rendering (not guaranteed)");
-#endif
-
- uiDefBut(block, LABEL,0,"Auto Run Python Scripts",
- (xpos+edgsp+(1*midsp)+(1*mpref)),y6label,mpref,buth,
- 0, 0, 0, 0, 0, "");
-
- uiDefButBitI(block, TOG, G_DOSCRIPTLINKS, REDRAWBUTSSCRIPT, "Enabled by Default",
- (xpos+edgsp+(1*mpref)+(1*midsp)),y5,mpref,buth,
- &(G.f), 0, 0, 0, 0, "Allow any .blend file to run scripts automatically (unsafe with blend files from an untrusted source)");
-
- uiDefBut(block, LABEL,0,"Keyboard:",
- (xpos+edgsp+(3*midsp)+(3*mpref)),y3label,mpref,buth,
- 0, 0, 0, 0, 0, "");
-
- uiDefButBitI(block, TOG, USER_NO_CAPSLOCK, B_U_CAPSLOCK, "Disable Caps Lock",
- (xpos+edgsp+(3*midsp)+(3*mpref)),y1,mpref,buth,
- &(U.flag), 0, 0, 0, 0,
- "Disables the Caps Lock key when entering text");
-
- uiDefButBitI(block, TOG, USER_NONUMPAD, 0, "Emulate Numpad",
- (xpos+edgsp+(3*midsp)+(3*mpref)),y2,mpref,buth,
- &(U.flag), 0, 0, 0, 0,
- "Causes the 1 to 0 keys to act as the numpad (useful for laptops)");
-
-
- uiDefBut(block, LABEL,0,"System:",
- (xpos+edgsp+(4*midsp)+(4*mpref)),y7label,mpref,buth,
- 0, 0, 0, 0, 0, "");
- uiDefButI(block, NUM, B_REDR, "Prefetch frames ",
- (xpos+edgsp+(4*mpref)+(4*midsp)), y6, mpref, buth,
- &U.prefetchframes, 0.0, 500.0, 20, 2,
- "Number of frames to render ahead during playback.");
-
- uiDefButI(block, NUM, B_MEMCACHELIMIT, "MEM Cache Limit ",
- (xpos+edgsp+(4*mpref)+(4*midsp)), y5, mpref, buth,
- &U.memcachelimit, 0.0, (float)memcachemax, 30, 2,
- "Memory cache limit in sequencer (megabytes)");
-
- uiDefButS(block, NUM, B_REDR, "Frameserver Port ",
- (xpos+edgsp+(4*mpref)+(4*midsp)), y4, mpref, buth,
- &U.frameserverport, 0.0, 32727.0, 30, 2,
- "Frameserver Port for Framserver-Rendering");
-
- uiDefButBitI(block, TOG, USER_DISABLE_SOUND, B_SOUNDTOGGLE, "Disable Game Sound",
- (xpos+edgsp+(4*mpref)+(4*midsp)),y3,mpref,buth,
- &(U.gameflags), 0, 0, 0, 0, "Disables sounds from being played in games");
-
- uiDefButBitI(block, TOG, USER_FILTERFILEEXTS, 0, "Filter File Extensions",
- (xpos+edgsp+(4*mpref)+(4*midsp)),y2,mpref,buth,
- &(U.uiflag), 0, 0, 0, 0, "Display only files with extensions in the image select window");
-
- uiDefButBitI(block, TOG, USER_HIDE_DOT, 0, "Hide dot file/datablock",
- (xpos+edgsp+(4*mpref)+(4*midsp)),y1,mpref,buth,
- &(U.uiflag), 0, 0, 0, 0, "Hide files/datablocks that start with a dot(.*)");
-
- uiDefBut(block, LABEL,0,"OpenGL:",
- (xpos+edgsp+(5*midsp)+(5*mpref)),y7label,mpref,buth,
- 0, 0, 0, 0, 0, "");
-
- uiDefButF(block, NUMSLI, B_DRAWINFO, "Clip Alpha: ",
- (xpos+edgsp+(5*mpref)+(5*midsp)),y6,mpref,buth,
- &(U.glalphaclip), 0.0, 1.0, 0, 0, "Clip alpha below this threshold in the 3d textured view");
-
- uiDefButBitI(block, TOGN, USER_DISABLE_MIPMAP, B_MIPMAPCHANGED, "Mipmaps",
- (xpos+edgsp+(5*mpref)+(5*midsp)),y5,mpref,buth,
- &(U.gameflags), 0, 0, 0, 0, "Toggles between mipmap textures on (beautiful) and off (fast)");
-
- /* main choices pup: note, it uses collums, and the seperators (%l) then have to fill both halves equally for the menu to work */
- uiDefButS(block, MENU, B_GLRESLIMITCHANGED, "GL Texture Clamp Off%x0|%l|GL Texture Clamp 8192%x8192|GL Texture Clamp 4096%x4096|GL Texture Clamp 2048%x2048|GL Texture Clamp 1024%x1024|GL Texture Clamp 512%x512|GL Texture Clamp 256%x256|GL Texture Clamp 128%x128",
- (xpos+edgsp+(5*mpref)+(5*midsp)),y4,mpref,buth, &(U.glreslimit), 0, 0, 0, 0, "Limit the texture size to save graphics memory");
-
- uiDefButBitI(block, TOG, USER_VERTEX_ARRAYS, 0, "Vertex Arrays",
- (xpos+edgsp+(5*mpref)+(5*midsp)),y3,mpref,buth,
- &(U.gameflags), 0, 0, 0, 0, "Toggles between vertex arrays on (less reliable) and off (more reliable)");
-
- uiDefButI(block, NUM, 0, "Time Out ",
- (xpos+edgsp+(5*mpref)+(5*midsp)), y2, mpref, buth,
- &U.textimeout, 0.0, 3600.0, 30, 2, "Time since last access of a GL texture in seconds after which it is freed. (Set to 0 to keep textures allocated)");
- uiDefButI(block, NUM, 0, "Collect Rate ",
- (xpos+edgsp+(5*mpref)+(5*midsp)), y1, mpref, buth,
- &U.texcollectrate, 1.0, 3600.0, 30, 2, "Number of seconds between each run of the GL texture garbage collector.");
-
- /* *** */
- uiDefBut(block, LABEL,0,"Color range for weight paint",
- (xpos+edgsp+(2*midsp)+(2*mpref)),y6label,mpref,buth,
- 0, 0, 0, 0, 0, "");
-
- uiDefButBitI(block, TOG, USER_CUSTOM_RANGE, B_WPAINT_RANGE, "ColorBand",
- (xpos+edgsp+(2*midsp)+(2*mpref)),y5,mpref,buth,
- &(U.flag), 0, 0, 0, 0,
- "");
-
- if((U.flag & USER_CUSTOM_RANGE)==0) {
- vDM_ColorBand_store(NULL);
- }
- else {
- rctf butrect;
-
- vDM_ColorBand_store(&U.coba_weight); /* also signal for derivedmesh to use colorband */
-
- BLI_init_rctf(&butrect, (xpos+edgsp+(2*midsp)+(2*mpref)),
- (xpos+edgsp+(2*midsp)+(2*mpref)) + mpref,
- y3, y3+30);
-
- draw_colorband_buts_small(block, &U.coba_weight, &butrect, B_WPAINT_RANGE);
- }
-
- uiDefBut(block, LABEL,0,"Audio mixing buffer:",
- (xpos+edgsp+(2*midsp)+(2*mpref)),y2label,mpref,buth,
- 0, 0, 0, 0, 0, "");
- uiBlockBeginAlign(block);
- uiDefButI(block, ROW, 0, "256",
- (xpos+edgsp+(2*midsp)+(2*mpref)),y1,(mpref/4),buth,
- &U.mixbufsize, 2.0, 256.0, 0, 0, "Set audio mixing buffer size to 256 samples");
- uiDefButI(block, ROW, 0, "512",
- (xpos+edgsp+(2*midsp)+(2*mpref)+(mpref/4)),y1,(mpref/4),buth,
- &U.mixbufsize, 2.0, 512.0, 0, 0, "Set audio mixing buffer size to 512 samples");
- uiDefButI(block, ROW, 0, "1024",
- (xpos+edgsp+(2*midsp)+(2*mpref)+(2*mpref/4)),y1,(mpref/4),buth,
- &U.mixbufsize, 2.0, 1024.0, 0, 0, "Set audio mixing buffer size to 1024 samples");
- uiDefButI(block, ROW, 0, "2048",
- (xpos+edgsp+(2*midsp)+(2*mpref)+(3*mpref/4)),y1,(mpref/4),buth,
- &U.mixbufsize, 2.0, 2048.0, 0, 0, "Set audio mixing buffer size to 2048 samples");
- uiBlockEndAlign(block);
-
- } else if(U.userpref == 5) { /* file paths */
-
- /* yafray: (temporary) path button for yafray xml export, now with fileselect */
- uiBlockBeginAlign(block);
- uiDefBut(block, TEX, 0, "YFexport: ",
- (xpos+edgsp), y2+buth+rspace, lpref-smfileselbut, buth,
- U.yfexportdir, 1.0, 63.0, 0, 0,
- "The default directory for yafray xml export (must exist!)");
- uiDefIconBut(block, BUT, B_YAFRAYDIRFILESEL, ICON_FILESEL,
- (xpos+edgsp+lpref-smfileselbut), y2+buth+rspace, smfileselbut, buth,
- 0, 0, 0, 0, 0, "Select the default yafray export directory");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefBut(block, TEX, 0, "Fonts: ",
- (xpos+edgsp),y2,(lpref-smfileselbut),buth,
- U.fontdir, 1.0, 63.0, 0, 0,
- "The default directory to search for loading fonts");
- uiDefIconBut(block, BUT, B_FONTDIRFILESEL, ICON_FILESEL,
- (xpos+edgsp+lpref-smfileselbut),y2,smfileselbut,buth,
- 0, 0, 0, 0, 0, "Select the default font directory");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefBut(block, TEX, 0, "Textures: ",
- (xpos+edgsp+lpref+midsp),y2,(lpref-smfileselbut),buth,
- U.textudir, 1.0, 63.0, 0, 0, "The default directory to search for textures");
- uiDefIconBut(block, BUT, B_TEXTUDIRFILESEL, ICON_FILESEL,
- (xpos+edgsp+(2*lpref)+midsp-smfileselbut),y2,smfileselbut,buth,
- 0, 0, 0, 0, 0, "Select the default texture location");
- uiBlockEndAlign(block);
-
-
- uiBlockBeginAlign(block);
- uiDefBut(block, TEX, 0, "Tex Plugins: ",
- (xpos+edgsp+(2*lpref)+(2*midsp)),y2,(lpref-smfileselbut),buth,
- U.plugtexdir, 1.0, 63.0, 0, 0, "The default directory to search for texture plugins");
- uiDefIconBut(block, BUT, B_PLUGTEXDIRFILESEL, ICON_FILESEL,
- (xpos+edgsp+(3*lpref)+(2*midsp)-smfileselbut),y2,smfileselbut,buth,
- 0, 0, 0, 0, 0, "Select the default texture plugin location");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefBut(block, TEX, 0, "Seq Plugins: ",
- (xpos+edgsp+(3*lpref)+(3*midsp)),y2,(lpref-smfileselbut),buth,
- U.plugseqdir, 1.0, 63.0, 0, 0, "The default directory to search for sequence plugins");
- uiDefIconBut(block, BUT, B_PLUGSEQDIRFILESEL, ICON_FILESEL,
- (xpos+edgsp+(4*lpref)+(3*midsp)-smfileselbut),y2,smfileselbut,buth,
- 0, 0, 0, 0, 0, "Select the default sequence plugin location");
- uiBlockEndAlign(block);
-
-
- uiBlockBeginAlign(block);
- uiDefBut(block, TEX, 0, "Render: ",
- (xpos+edgsp),y1,(lpref-smfileselbut),buth,
- U.renderdir, 1.0, 63.0, 0, 0, "The default directory for rendering output");
- uiDefIconBut(block, BUT, B_RENDERDIRFILESEL, ICON_FILESEL,
- (xpos+edgsp+lpref-smfileselbut),y1,smfileselbut,buth,
- 0, 0, 0, 0, 0, "Select the default render output location");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefBut(block, TEX, 0, "Python: ",
- (xpos+edgsp+lpref+midsp),y1,(lpref-2*smfileselbut),buth,
- U.pythondir, 1.0, 63.0, 0, 0, "The default directory to search for Python scripts");
- uiDefIconBut(block, BUT, B_PYMENUEVAL, ICON_SCRIPT,
- (xpos+edgsp+(2*lpref)+midsp-2*smfileselbut),y1,smfileselbut,buth,
- 0, 0, 0, 0, 0, "Re-evaluate scripts registration in menus");
- uiDefIconBut(block, BUT, B_PYTHONDIRFILESEL, ICON_FILESEL,
- (xpos+edgsp+(2*lpref)+midsp-smfileselbut),y1,smfileselbut,buth,
- 0, 0, 0, 0, 0, "Select the default Python script location");
- uiBlockEndAlign(block);
-
-
- uiBlockBeginAlign(block);
- uiDefBut(block, TEX, 0, "Sounds: ",
- (xpos+edgsp+(2*lpref)+(2*midsp)),y1,(lpref-smfileselbut),buth,
- U.sounddir, 1.0, 63.0, 0, 0, "The default directory to search for sounds");
- uiDefIconBut(block, BUT, B_SOUNDDIRFILESEL, ICON_FILESEL,
- (xpos+edgsp+(3*lpref)+(2*midsp)-smfileselbut),y1,smfileselbut,buth,
- 0, 0, 0, 0, 0, "Selet the default sound location");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefBut(block, TEX, 0, "Temp: ",
- (xpos+edgsp+(3*lpref)+(3*midsp)),y1,(lpref-smfileselbut),buth,
- U.tempdir, 1.0, 63.0, 0, 0, "The directory for storing temporary save files");
- uiDefIconBut(block, BUT, B_TEMPDIRFILESEL, ICON_FILESEL,
- (xpos+edgsp+(4*lpref)+(3*midsp)-smfileselbut),y1,smfileselbut,buth,
- 0, 0, 0, 0, 0, "Select the default temporary save file location");
- uiBlockEndAlign(block);
-
- }
-
- uiDrawBlock(block);
-
- myortho2(-0.375, (float)(sa->winx)-0.375, -0.375, (float)(sa->winy)-0.375);
- draw_area_emboss(sa);
-
- /* restore buttons transform */
- if(curarea->winx<=1280.0) {
- fac= ((float)curarea->winx)/1280.0f;
- myortho2(0.0, 1280.0, 0.0, curarea->winy/fac);
- }
- else {
- myortho2(0.0, (float)curarea->winx, 0.0, (float)curarea->winy);
- }
- sa->win_swap= WIN_BACK_OK;
-
-}
-
-
-static void winqreadinfospace(ScrArea *sa, void *spacedata, BWinEvent *evt)
-{
- unsigned short event= evt->event;
- short val= evt->val;
-
- if(val) {
- if( uiDoBlocks(&curarea->uiblocks, event, 1)!=UI_NOTHING ) event= 0;
-
- switch(event) {
- case UI_BUT_EVENT:
- if(val==REDRAWTIME) allqueue(REDRAWTIME, 0);
- else if(val==B_ADD_THEME) {
- bTheme *btheme, *new;
-
- btheme= U.themes.first;
- new= MEM_callocN(sizeof(bTheme), "theme");
- memcpy(new, btheme, sizeof(bTheme));
- BLI_addhead(&U.themes, new);
- strcpy(new->name, "New User Theme");
- addqueue(sa->win, REDRAW, 1);
- }
- else if(val==B_DEL_THEME) {
- bTheme *btheme= U.themes.first;
- BLI_remlink(&U.themes, btheme);
- MEM_freeN(btheme);
- BIF_SetTheme(sa); /* prevent usage of old theme in calls */
- addqueue(sa->win, REDRAW, 1);
- }
- else if(val==B_NAME_THEME) {
- bTheme *btheme= U.themes.first;
- if(strcmp(btheme->name, "Default")==0) {
- strcpy(btheme->name, "New User Theme");
- addqueue(sa->win, REDRAW, 1);
- }
- }
- else if(val==B_UPDATE_THEME) {
- allqueue(REDRAWALL, 0);
- }
- else if(val==B_UPDATE_THEME_ICONS) {
- BIF_icons_free();
- BIF_icons_init(BIFICONID_LAST+1);
- allqueue(REDRAWALL, 0);
- }
- else if(val==B_CHANGE_THEME) {
- th_curcol= TH_BACK; /* backdrop color is always there... */
- addqueue(sa->win, REDRAW, 1);
- }
- else if(val==B_THEME_COPY) {
- if(th_curcol_ptr) {
- th_curcol_arr[0]= th_curcol_ptr[0];
- th_curcol_arr[1]= th_curcol_ptr[1];
- th_curcol_arr[2]= th_curcol_ptr[2];
- th_curcol_arr[3]= th_curcol_ptr[3];
- addqueue(sa->win, REDRAW, 1);
- }
- }
- else if(val==B_THEME_PASTE) {
- if(th_curcol_ptr) {
- th_curcol_ptr[0]= th_curcol_arr[0];
- th_curcol_ptr[1]= th_curcol_arr[1];
- th_curcol_ptr[2]= th_curcol_arr[2];
- th_curcol_ptr[3]= th_curcol_arr[3];
- allqueue(REDRAWALL, 0);
- }
- }
- else if(val==B_RECALCLIGHT) {
- if(U.light[0].flag==0 && U.light[1].flag==0 && U.light[2].flag==0)
- U.light[0].flag= 1;
-
- default_gl_light();
- addqueue(sa->win, REDRAW, 1);
- allqueue(REDRAWVIEW3D, 0);
- }
- else if (val==B_MEMCACHELIMIT) {
- printf("Setting memcache limit to %d\n",
- U.memcachelimit);
- MEM_CacheLimiter_set_maximum(
- U.memcachelimit * 1024 * 1024);
- }
- else if (val==B_WPAINT_RANGE) {
- addqueue(sa->win, REDRAW, 1);
- if(OBACT && (G.f & G_WEIGHTPAINT)) {
- DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- }
- }
- else do_global_buttons(val);
-
- break;
- }
- }
-}
-
-static void init_infospace(ScrArea *sa)
-{
- SpaceInfo *sinfo;
-
- sinfo= MEM_callocN(sizeof(SpaceInfo), "initinfo");
- BLI_addhead(&sa->spacedata, sinfo);
-
- sinfo->spacetype=SPACE_INFO;
-}
-
-/* ******************** SPACE: BUTS ********************** */
-
-extern void drawbutspace(ScrArea *sa, void *spacedata); /* buttons.c */
-
-static void changebutspace(ScrArea *sa, void *spacedata)
-{
- if(G.v2d==0) return;
-
- test_view2d(G.v2d, curarea->winx, curarea->winy);
- myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax);
-}
-
-static void winqreadbutspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
-{
- unsigned short event= evt->event;
- short val= evt->val;
- SpaceButs *sbuts= curarea->spacedata.first;
- ScrArea *sa2, *sa3d;
- int nr;
-
- if(val) {
-
- if( uiDoBlocks(&curarea->uiblocks, event, 1)!=UI_NOTHING ) event= 0;
-
- switch(event) {
- case UI_BUT_EVENT:
- do_butspace(val);
- break;
-
- case MIDDLEMOUSE:
- case WHEELUPMOUSE:
- case WHEELDOWNMOUSE:
- view2dmove(event); /* in drawipo.c */
- break;
- case PAGEUPKEY:
- event= WHEELUPMOUSE;
- view2dmove(event); /* in drawipo.c */
- break;
- case PAGEDOWNKEY:
- event= WHEELDOWNMOUSE;
- view2dmove(event); /* in drawipo.c */
- break;
-
- case RIGHTMOUSE:
- nr= pupmenu("Panel Alignment%t|Horizontal%x1|Vertical%x2|Free %x0");
- if (nr>=0) {
- sbuts->align= nr;
- if(nr) {
- uiAlignPanelStep(sa, 1.0);
- do_buts_buttons(B_BUTSHOME);
- }
- }
-
- break;
- case PADPLUSKEY:
- view2d_zoom(&sbuts->v2d, 0.06f, curarea->winx, curarea->winy);
- scrarea_queue_winredraw(curarea);
- break;
- case PADMINUS:
- view2d_zoom(&sbuts->v2d, -0.075f, curarea->winx, curarea->winy);
- scrarea_queue_winredraw(curarea);
- break;
- case RENDERPREVIEW:
- BIF_previewrender_buts(sbuts);
- break;
-
- case HOMEKEY:
- do_buts_buttons(B_BUTSHOME);
- break;
-
-
- /* if only 1 view, also de persp, excluding arrowkeys */
- case PAD0: case PAD1: case PAD3:
- case PAD5: case PAD7: case PAD9:
- case PADENTER: case ZKEY: case PKEY:
- sa3d= 0;
- sa2= G.curscreen->areabase.first;
- while(sa2) {
- if(sa2->spacetype==SPACE_VIEW3D) {
- if(sa3d) return;
- sa3d= sa2;
- }
- sa2= sa2->next;
- }
- if(sa3d) {
- sa= curarea;
- areawinset(sa3d->win);
-
- if(event==PKEY && G.qual==0) start_game();
- else if(event==ZKEY) toggle_shading();
- else persptoetsen(event);
-
- scrarea_queue_winredraw(sa3d);
- scrarea_queue_headredraw(sa3d);
- areawinset(sa->win);
- }
- }
- }
-
-}
-
-void set_rects_butspace(SpaceButs *buts)
-{
- /* buts space goes from (0,0) to (1280, 228) */
-
- buts->v2d.tot.xmin= 0.0f;
- buts->v2d.tot.ymin= 0.0f;
- buts->v2d.tot.xmax= 1279.0f;
- buts->v2d.tot.ymax= 228.0f;
-
- buts->v2d.min[0]= 256.0f;
- buts->v2d.min[1]= 42.0f;
-
- buts->v2d.max[0]= 2048.0f;
- buts->v2d.max[1]= 450.0f;
-
- buts->v2d.minzoom= 0.5f;
- buts->v2d.maxzoom= 1.21f;
-
- buts->v2d.scroll= 0;
- buts->v2d.keepaspect= 1;
- buts->v2d.keepzoom= 1;
- buts->v2d.keeptot= 1;
-
-}
-
-void test_butspace(void)
-{
- ScrArea *area= curarea;
- int blocksmin= uiBlocksGetYMin(&area->uiblocks)-10.0f;
-
- G.buts->v2d.tot.ymin= MIN2(0.0f, blocksmin-10.0f);
-}
-
-static void init_butspace(ScrArea *sa)
-{
- SpaceButs *buts;
-
- buts= MEM_callocN(sizeof(SpaceButs), "initbuts");
- BLI_addhead(&sa->spacedata, buts);
-
- buts->spacetype= SPACE_BUTS;
- buts->scaflag= BUTS_SENS_LINK|BUTS_SENS_ACT|BUTS_CONT_ACT|BUTS_ACT_ACT|BUTS_ACT_LINK;
-
- /* set_rects only does defaults, so after reading a file the cur has not changed */
- set_rects_butspace(buts);
- buts->v2d.cur= buts->v2d.tot;
-
- buts->ri = NULL;
-}
-
-void extern_set_butspace(int fkey, int do_cycle)
-{
- ScrArea *sa;
- SpaceButs *sbuts;
- Object *ob= OBACT;
-
- /* when a f-key pressed: 'closest' button window is initialized */
- if(curarea->spacetype==SPACE_BUTS) sa= curarea;
- else {
- /* find area */
- sa= G.curscreen->areabase.first;
- while(sa) {
- if(sa->spacetype==SPACE_BUTS) break;
- sa= sa->next;
- }
- }
-
- if(sa==NULL) return;
-
- if(sa!=curarea) areawinset(sa->win);
-
- sbuts= sa->spacedata.first;
- if(!do_cycle) sbuts->oldkeypress= 0;
-
- if(fkey==F4KEY) {
- sbuts->mainb= CONTEXT_LOGIC;
- }
- else if(fkey==F5KEY) {
- /* if it's already in shading context, cycle between tabs with the same key */
- if (sbuts->oldkeypress == F5KEY) {
-
- if (sbuts->tab[CONTEXT_SHADING]==TAB_SHADING_LAMP)
- sbuts->tab[CONTEXT_SHADING]=TAB_SHADING_MAT;
- else if (sbuts->tab[CONTEXT_SHADING]==TAB_SHADING_MAT)
- sbuts->tab[CONTEXT_SHADING]=TAB_SHADING_TEX;
- else if (sbuts->tab[CONTEXT_SHADING]==1) {
- sbuts->tab[CONTEXT_SHADING]=TAB_SHADING_RAD;
- }
- else if (sbuts->tab[CONTEXT_SHADING]==TAB_SHADING_RAD)
- sbuts->tab[CONTEXT_SHADING]=TAB_SHADING_WORLD;
- else if (sbuts->tab[CONTEXT_SHADING]==TAB_SHADING_WORLD)
- sbuts->tab[CONTEXT_SHADING]=TAB_SHADING_LAMP;
- }
- /* if we're coming in from texture buttons,
- or from outside the shading context, just go to the 'default' */
- else if (ob) {
- sbuts->mainb= CONTEXT_SHADING;
-
- if(ob->type==OB_CAMERA)
- sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_WORLD;
- else if(ob->type==OB_LAMP)
- sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_LAMP;
- else
- sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_MAT;
- }
- else {
- sbuts->mainb= CONTEXT_SHADING;
- sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_MAT;
- }
- BIF_preview_changed(ID_TE);
- }
- else if(fkey==F6KEY) {
- sbuts->mainb= CONTEXT_SHADING;
- sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_TEX;
- BIF_preview_changed(ID_TE);
- }
- else if(fkey==F7KEY) {
- /* if it's already in object context, cycle between tabs with the same key */
- if (sbuts->oldkeypress == F7KEY) {
-
- if (sbuts->tab[CONTEXT_OBJECT]==TAB_OBJECT_OBJECT)
- sbuts->tab[CONTEXT_OBJECT]=TAB_OBJECT_PHYSICS;
- else if (sbuts->tab[CONTEXT_OBJECT]==TAB_OBJECT_PHYSICS)
- sbuts->tab[CONTEXT_OBJECT]=TAB_OBJECT_PARTICLE;
- else if (sbuts->tab[CONTEXT_OBJECT]==TAB_OBJECT_PARTICLE)
- sbuts->tab[CONTEXT_OBJECT]=TAB_OBJECT_OBJECT;
- }
- else sbuts->mainb= CONTEXT_OBJECT;
-
- }
- else if(fkey==F8KEY) {
- sbuts->mainb= CONTEXT_SHADING;
- sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_WORLD;
- BIF_preview_changed(ID_TE);
- }
- else if(fkey==F9KEY) sbuts->mainb= CONTEXT_EDITING;
- else if(fkey==F10KEY) {
- /* if it's already in scene context, cycle between tabs with the same key */
- if (sbuts->oldkeypress == F10KEY) {
-
- if (sbuts->tab[CONTEXT_SCENE]==TAB_SCENE_RENDER)
- sbuts->tab[CONTEXT_SCENE]=TAB_SCENE_ANIM;
- else if (sbuts->tab[CONTEXT_SCENE]==TAB_SCENE_ANIM)
- sbuts->tab[CONTEXT_SCENE]=TAB_SCENE_SOUND;
- else if (sbuts->tab[CONTEXT_SCENE]==TAB_SCENE_SOUND)
- sbuts->tab[CONTEXT_SCENE]=TAB_SCENE_RENDER;
- }
- else sbuts->mainb= CONTEXT_SCENE;
- }
-
- sbuts->oldkeypress = fkey;
-
- scrarea_queue_headredraw(sa);
- scrarea_queue_winredraw(sa);
-}
-
-/* ******************** SPACE: SEQUENCE ********************** */
-
-/* extern void drawseqspace(ScrArea *sa, void *spacedata); BIF_drawseq.h */
-
-static void winqreadseqspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
-{
- unsigned short event= evt->event;
- short val= evt->val;
- SpaceSeq *sseq= curarea->spacedata.first;
- View2D *v2d= &sseq->v2d;
- Sequence *last_seq = get_last_seq();
- float dx, dy;
- int doredraw= 0, cfra=0, first;
- short mval[2];
- short nr;
- short mousebut = L_MOUSE;
-
- if(curarea->win==0) return;
-
- if(val) {
- if( uiDoBlocks(&curarea->uiblocks, event, 1)!=UI_NOTHING ) event= 0;
-
- /* swap mouse buttons based on user preference */
- if (U.flag & USER_LMOUSESELECT) {
- if (event == LEFTMOUSE) {
- event = RIGHTMOUSE;
- mousebut = L_MOUSE;
- } else if (event == RIGHTMOUSE) {
- event = LEFTMOUSE;
- mousebut = R_MOUSE;
- }
- }
-
- switch(event) {
- case UI_BUT_EVENT:
- do_seqbuttons(val);
- break;
- case LEFTMOUSE:
- if(sseq->mainb || view2dmove(event)==0) {
-
- first= 1;
- set_special_seq_update(1);
-
- do {
- getmouseco_areawin(mval);
- areamouseco_to_ipoco(v2d, mval, &dx, &dy);
-
- cfra= (int)dx;
- if(cfra< 1) cfra= 1;
- /* else if(cfra> EFRA) cfra= EFRA; */
-
- if( cfra!=CFRA || first ) {
- first= 0;
-
- CFRA= cfra;
- force_draw(0);
- update_for_newframe(); /* for audio scrubbing */
- }
- else PIL_sleep_ms(30);
-
- } while(get_mbut() & mousebut);
-
- set_special_seq_update(0);
-
- if (cfra == 0)
- update_for_newframe();
- }
- break;
- case MIDDLEMOUSE:
- if(sseq->mainb) seq_viewmove(sseq);
- else view2dmove(event); /* in drawipo.c */
- break;
- case RIGHTMOUSE:
- if(sseq->mainb) break;
- mouse_select_seq();
- break;
- case PADPLUSKEY:
- if (G.qual==LR_CTRLKEY) {
- select_more_seq();
- break;
- }
- case WHEELUPMOUSE:
- if(sseq->mainb) {
- sseq->zoom++;
- if(sseq->zoom==-1) sseq->zoom= 1;
- if(sseq->zoom>8) sseq->zoom= 8;
- }
- else {
- if((G.qual==0)) {
- dx= 0.1154f*(v2d->cur.xmax-v2d->cur.xmin);
- v2d->cur.xmin+= dx;
- v2d->cur.xmax-= dx;
- test_view2d(G.v2d, sa->winx, sa->winy);
- view2d_do_locks(sa, V2D_LOCK_COPY);
- }
- else if((G.qual==LR_SHIFTKEY)) {
- insert_gap(25, CFRA);
- BIF_undo_push("Insert gaps Sequencer");
- allqueue(REDRAWSEQ, 0);
- }
- else if(G.qual==LR_ALTKEY) {
- insert_gap(250, CFRA);
- BIF_undo_push("Insert gaps Sequencer");
- allqueue(REDRAWSEQ, 0);
- }
- }
- doredraw= 1;
- break;
- case PADMINUS:
- if (G.qual==LR_CTRLKEY) {
- select_less_seq();
- break;
- }
- case WHEELDOWNMOUSE:
- if(sseq->mainb) {
- sseq->zoom--;
- if(sseq->zoom==0) sseq->zoom= -2;
- if(sseq->zoom<-8) sseq->zoom= -8;
- }
- else {
- if((G.qual==LR_SHIFTKEY))
- no_gaps();
- else if((G.qual==0)) {
- dx= 0.15f*(v2d->cur.xmax-v2d->cur.xmin);
- v2d->cur.xmin-= dx;
- v2d->cur.xmax+= dx;
- test_view2d(G.v2d, sa->winx, sa->winy);
- view2d_do_locks(sa, V2D_LOCK_COPY);
- }
- }
- doredraw= 1;
- break;
- case HOMEKEY:
- if((G.qual==0))
- do_seq_buttons(B_SEQHOME);
- break;
- case PADPERIOD:
- if(last_seq) {
- CFRA= last_seq->startdisp;
- v2d->cur.xmin= last_seq->startdisp- (last_seq->len/20);
- v2d->cur.xmax= last_seq->enddisp+ (last_seq->len/20);
- update_for_newframe();
- }
- break;
-
- case AKEY:
- if (G.qual == LR_CTRLKEY) {
- deselect_markers(1, 0);
- allqueue(REDRAWMARKER, 0);
- } else {
- if(sseq->mainb) break;
- if((G.qual==LR_SHIFTKEY)) {
- add_sequence(-1);
- } else if((G.qual==0)) {
- swap_select_seq();
- }
- }
- break;
- case SPACEKEY:
- if (G.qual==0) {
- if (sseq->mainb) {
- play_anim(1);
- } else {
- add_sequence(-1);
- }
- }
- break;
- case BKEY:
- if(sseq->mainb) break;
- if((G.qual==0))
- borderselect_seq();
- break;
- case CKEY:
- if((G.qual==0)) {
- if(last_seq && (last_seq->flag & (SEQ_LEFTSEL+SEQ_RIGHTSEL))) {
- if(last_seq->flag & SEQ_LEFTSEL) CFRA= last_seq->startdisp;
- else CFRA= last_seq->enddisp-1;
-
- dx= CFRA-(v2d->cur.xmax+v2d->cur.xmin)/2;
- v2d->cur.xmax+= dx;
- v2d->cur.xmin+= dx;
- update_for_newframe();
- }
- else
- change_sequence();
- }
- break;
- case DKEY:
- if (G.qual == (LR_CTRLKEY|LR_SHIFTKEY))
- duplicate_marker();
- else if ((G.qual==LR_SHIFTKEY)) {
- if(sseq->mainb) break;
- add_duplicate_seq();
- }
- break;
- case EKEY:
- if(sseq->mainb) break;
- if((G.qual==0))
- transform_seq('e', 0);
- break;
- case FKEY:
- if((G.qual==0))
- set_filter_seq();
- break;
- case GKEY:
- if (G.qual & LR_CTRLKEY)
- transform_markers('g', 0);
- else if (G.qual==0) {
- if(sseq->mainb) break;
- transform_seq('g', 0);
- }
- break;
- case KKEY:
- if((G.qual==0)) { /* Cut at current frame */
- seq_cut(CFRA);
- }
- break;
- case LKEY:
- if((G.qual==0)) { /* Cut at current frame */
- select_linked_seq( 0 );
- } else if((G.qual==LR_CTRLKEY)) { /* Cut at current frame */
- select_linked_seq( 2 );
- }
- break;
- case YKEY:
- if((G.qual==0)) { /* Cut at current frame */
- seq_separate_images();
- }
- break;
- case MKEY:
- if(G.qual==LR_ALTKEY) {
- un_meta();
- break; /*dont redraw timeline etc */
- } else if((G.qual==0)){
- if ((last_seq) &&
- (last_seq->type == SEQ_RAM_SOUND
- || last_seq->type == SEQ_HD_SOUND))
- {
- last_seq->flag ^= SEQ_MUTE;
- doredraw = 1;
- } else {
- make_meta();
- }
- break; /*dont redraw timeline etc */
- } else if ((G.qual==(LR_CTRLKEY|LR_ALTKEY) )) {
- add_marker(CFRA);
- } else if ((G.qual==LR_CTRLKEY)) {
- rename_marker();
- } else {
- break; /* do nothing */
- }
- allqueue(REDRAWMARKER, 0);
- break;
- case NKEY:
- if(G.qual==0) {
- toggle_blockhandler(curarea, SEQ_HANDLER_PROPERTIES, UI_PNL_TO_MOUSE);
- scrarea_queue_winredraw(curarea);
- }
- break;
- case RKEY:
- if(G.qual==LR_SHIFTKEY)
- seq_remap_paths();
- if(G.qual==LR_ALTKEY)
- reload_sequence();
- else if (G.qual==0)
- reassign_inputs_seq_effect();
- break;
- case SKEY:
- if((G.qual==LR_SHIFTKEY))
- seq_snap_menu();
- break;
- case PKEY:
- if((G.qual==0))
- touch_seq_files();
- break;
- case TKEY: /* popup menu */
- nr= pupmenu("Time value%t|Frames %x1|Seconds%x2");
- if (nr>0) {
- if(nr==1) sseq->flag |= SEQ_DRAWFRAMES;
- else sseq->flag &= ~SEQ_DRAWFRAMES;
- doredraw= 1;
- }
- break;
- case XKEY:
- case DELKEY:
- if(G.qual==0) {
- if(sseq->mainb) break;
- if((G.qual==0))
- del_seq();
- }
- break;
- }
- }
-
- if(doredraw) scrarea_queue_winredraw(curarea);
-}
-
-
-static void init_seqspace(ScrArea *sa)
-{
- SpaceSeq *sseq;
-
- sseq= MEM_callocN(sizeof(SpaceSeq), "initseqspace");
- BLI_addhead(&sa->spacedata, sseq);
-
- sseq->spacetype= SPACE_SEQ;
- sseq->zoom= 4;
- sseq->blockscale= 0.7;
- sseq->chanshown = 0;
-
- /* seq space goes from (0,8) to (250, 0) */
-
- sseq->v2d.tot.xmin= 0.0;
- sseq->v2d.tot.ymin= 0.0;
- sseq->v2d.tot.xmax= 250.0;
- sseq->v2d.tot.ymax= 8.0;
-
- sseq->v2d.cur= sseq->v2d.tot;
-
- sseq->v2d.min[0]= 10.0;
- sseq->v2d.min[1]= 4.0;
-
- sseq->v2d.max[0]= 32000.0;
- sseq->v2d.max[1]= MAXSEQ;
-
- sseq->v2d.minzoom= 0.1f;
- sseq->v2d.maxzoom= 10.0;
-
- sseq->v2d.scroll= L_SCROLL+B_SCROLL;
- sseq->v2d.keepaspect= 0;
- sseq->v2d.keepzoom= 0;
- sseq->v2d.keeptot= 0;
-}
-
-/* ******************** SPACE: ACTION ********************** */
-extern void drawactionspace(ScrArea *sa, void *spacedata);
-extern void winqreadactionspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
-
-static void changeactionspace(ScrArea *sa, void *spacedata)
-{
- if(G.v2d==0) return;
-
- /* this sets the sub-areas correct, for scrollbars */
- test_view2d(G.v2d, sa->winx, sa->winy);
-
- /* action space uses weird matrices... local calculated in a function */
- /* myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax); */
-}
-
-
-static void init_actionspace(ScrArea *sa)
-{
- SpaceAction *saction;
-
- saction= MEM_callocN(sizeof(SpaceAction), "initactionspace");
- BLI_addhead(&sa->spacedata, saction);
-
- saction->spacetype= SPACE_ACTION;
- saction->blockscale= 0.7;
-
- saction->v2d.tot.xmin= 1.0;
- saction->v2d.tot.ymin= -1000.0;
- saction->v2d.tot.xmax= 1000.0;
- saction->v2d.tot.ymax= 0.0;
-
- saction->v2d.cur.xmin= -5.0;
- saction->v2d.cur.ymin= -75.0;
- saction->v2d.cur.xmax= 65.0;
- saction->v2d.cur.ymax= 5.0;
-
- saction->v2d.min[0]= 0.0;
- saction->v2d.min[1]= 0.0;
-
- saction->v2d.max[0]= 32000.0;
- saction->v2d.max[1]= 1000.0;
-
- saction->v2d.minzoom= 0.01;
- saction->v2d.maxzoom= 50;
-
- saction->v2d.scroll= R_SCROLL+B_SCROLL;
- saction->v2d.keepaspect= 0;
- saction->v2d.keepzoom= V2D_LOCKZOOM_Y;
- saction->v2d.keeptot= 0;
-
-}
-
-static void free_actionspace(SpaceAction *saction)
-{
- /* don't free saction itself */
-
- /* __PINFAKE */
-/* if (saction->flag & SACTION_PIN)
- if (saction->action)
- saction->action->id.us --;
-
-*/ /* end PINFAKE */
-}
-
-
-/* ******************** SPACE: FILE ********************** */
-
-static void init_filespace(ScrArea *sa)
-{
- SpaceFile *sfile;
-
- sfile= MEM_callocN(sizeof(SpaceFile), "initfilespace");
- BLI_addhead(&sa->spacedata, sfile);
-
- sfile->dir[0]= '/';
- sfile->type= FILE_UNIX;
- sfile->blockscale= 0.7;
- sfile->spacetype= SPACE_FILE;
-}
-
-
-/* ******************** SPACE: SOUND ********************** */
-
-extern void drawsoundspace(ScrArea *sa, void *spacedata);
-extern void winqreadsoundspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
-
-static void init_soundspace(ScrArea *sa)
-{
- SpaceSound *ssound;
-
- ssound= MEM_callocN(sizeof(SpaceSound), "initsoundspace");
- BLI_addhead(&sa->spacedata, ssound);
-
- ssound->spacetype= SPACE_SOUND;
- ssound->blockscale= 0.7;
- /* sound space goes from (0,8) to (250, 0) */
-
- ssound->v2d.tot.xmin= -4.0;
- ssound->v2d.tot.ymin= -4.0;
- ssound->v2d.tot.xmax= 250.0;
- ssound->v2d.tot.ymax= 255.0;
-
- ssound->v2d.cur.xmin= -4.0;
- ssound->v2d.cur.ymin= -4.0;
- ssound->v2d.cur.xmax= 50.0;
- ssound->v2d.cur.ymax= 255.0;
-
- ssound->v2d.min[0]= 1.0;
- ssound->v2d.min[1]= 259.0;
-
- ssound->v2d.max[0]= 32000.0;
- ssound->v2d.max[1]= 259;
-
- ssound->v2d.minzoom= 0.1f;
- ssound->v2d.maxzoom= 10.0;
-
- ssound->v2d.scroll= B_SCROLL;
- ssound->v2d.keepaspect= 0;
- ssound->v2d.keepzoom= 0;
- ssound->v2d.keeptot= 0;
-
-}
-
-void free_soundspace(SpaceSound *ssound)
-{
- /* don't free ssound itself */
-
-
-}
-
-/* ******************** SPACE: IMAGE ********************** */
-
-static void changeimagepace(ScrArea *sa, void *spacedata)
-{
- image_preview_event(2);
-}
-
-static void winqreadimagespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
-{
- SpaceImage *sima= spacedata;
- unsigned short event= evt->event;
- short val= evt->val;
-
- if(val==0) return;
-
- if(uiDoBlocks(&sa->uiblocks, event, 1)!=UI_NOTHING ) event= 0;
-
- if (U.flag & USER_LMOUSESELECT) {
- if (event == LEFTMOUSE) {
- event = RIGHTMOUSE;
- } else if (event == RIGHTMOUSE) {
- event = LEFTMOUSE;
- }
- }
-
- if (sima->image && (sima->flag & SI_DRAWTOOL)) {
- switch(event) {
- case CKEY:
- toggle_blockhandler(sa, IMAGE_HANDLER_PAINT, UI_PNL_UNSTOW);
- scrarea_queue_winredraw(sa);
- break;
- case LEFTMOUSE:
- imagepaint_paint(L_MOUSE, 0);
- break;
- case RIGHTMOUSE:
- imagepaint_pick(R_MOUSE);
- break;
- }
- }
- else if (G.obedit) {
- /* Draw tool is inactive, editmode is enabled and the image is not a render or composite */
- if (EM_texFaceCheck() && (G.sima->image==0 || (G.sima->image->type != IMA_TYPE_R_RESULT && G.sima->image->type != IMA_TYPE_COMPOSITE))) {
- switch(event) {
- case LEFTMOUSE:
- if(G.qual == LR_SHIFTKEY) {
- if(G.sima->image && G.sima->image->tpageflag & IMA_TILES) {
- mouseco_to_curtile();
- }
- } else if (!gesture()) {
- mouseco_to_cursor_sima();
- }
- break;
- case RIGHTMOUSE:
- mouse_select_sima();
- break;
- case AKEY:
- select_swap_tface_uv();
- break;
- case BKEY:
- if(G.qual==LR_SHIFTKEY)
- borderselect_sima(UV_SELECT_PINNED);
- else if((G.qual==0))
- borderselect_sima(UV_SELECT_ALL);
- break;
- case CKEY:
- if (G.sima->flag & SI_SYNC_UVSEL) {
- /* operate on the editmesh */
- if (G.qual==0) {
- if (G.scene->selectmode != SCE_SELECT_FACE) {
- G.sima->flag ^= SI_SELACTFACE;
- scrarea_queue_winredraw(curarea);
- }
- } else {
- error("Sync selection to Edit Mesh disables UV select options");
- }
- } else {
- /* normal operaton */
- if(G.qual==LR_CTRLKEY) {
- G.sima->sticky = SI_STICKY_VERTEX;
- scrarea_do_headdraw(curarea);
- } else if(G.qual==LR_SHIFTKEY) {
- G.sima->sticky = SI_STICKY_DISABLE;
- scrarea_do_headdraw(curarea);
- } else if(G.qual==LR_ALTKEY) {
- G.sima->sticky = SI_STICKY_LOC;
- scrarea_do_headdraw(curarea);
- } else {
- G.sima->flag ^= SI_SELACTFACE;
- scrarea_queue_winredraw(curarea);
- }
- }
- break;
- case EKEY :
- if(okee("Unwrap"))
- unwrap_lscm(0);
- break;
- case HKEY:
- if(G.qual==LR_ALTKEY)
- reveal_tface_uv();
- else if((G.qual==LR_SHIFTKEY))
- hide_tface_uv(1);
- else if((G.qual==0))
- hide_tface_uv(0);
- break;
- case LKEY:
- if(G.qual==0)
- select_linked_tface_uv(0);
- else if(G.qual==LR_SHIFTKEY)
- select_linked_tface_uv(1);
- else if(G.qual==LR_CTRLKEY)
- select_linked_tface_uv(2);
- else if(G.qual==LR_ALTKEY)
- unlink_selection();
- break;
- case PKEY:
- if(G.qual==LR_CTRLKEY)
- pack_charts_tface_uv();
- else if(G.qual==LR_SHIFTKEY)
- select_pinned_tface_uv();
- else if(G.qual==LR_ALTKEY)
- pin_tface_uv(0);
- else
- pin_tface_uv(1);
- break;
- case GKEY:
- if((G.qual==0) && is_uv_tface_editing_allowed()) {
- initTransform(TFM_TRANSLATION, CTX_NONE);
- Transform();
- }
- break;
- case RKEY:
- if((G.qual==0) && is_uv_tface_editing_allowed()) {
- initTransform(TFM_ROTATION, CTX_NONE);
- Transform();
- }
- break;
- case SKEY:
- if (is_uv_tface_editing_allowed()) {
- if ( G.qual==LR_SHIFTKEY) {
- /* Snap */
- snap_menu_sima();
- } else if (G.qual==0) {
- initTransform(TFM_RESIZE, CTX_NONE);
- Transform();
- }
- }
- break;
- case VKEY:
- if(G.qual == 0)
- stitch_vert_uv_tface();
- else if(G.qual==LR_SHIFTKEY)
- stitch_limit_uv_tface();
- else if(G.qual==LR_CTRLKEY)
- minimize_stretch_tface_uv();
- break;
- case WKEY:
- weld_align_menu_tface_uv();
- break;
- case MKEY:
- if((G.qual==0))
- mirrormenu_tface_uv();
- break;
- case COMMAKEY:
- if(G.qual==LR_SHIFTKEY) {
- G.v2d->around= V3D_CENTROID;
- } else if(G.qual==0) {
- G.v2d->around= V3D_CENTER;
- }
-
- scrarea_queue_headredraw(curarea);
- scrarea_queue_winredraw(curarea);
- break;
- case PERIODKEY:
- if(G.qual==LR_CTRLKEY) {
- G.v2d->around= V3D_LOCAL;
- } else if(G.qual==0) {
- G.v2d->around= V3D_CURSOR;
- }
- scrarea_queue_headredraw(curarea);
- scrarea_queue_winredraw(curarea);
- break;
- case PADPERIOD:
- if(G.qual==0)
- image_viewcenter();
- break;
- case OKEY:
- if(G.qual==0) {
- G.scene->proportional= !G.scene->proportional;
- allqueue(REDRAWHEADERS, 0);
- } else if (G.qual==LR_SHIFTKEY) {
- G.scene->prop_mode = (G.scene->prop_mode+1)%7;
- allqueue(REDRAWHEADERS, 0);
- }
- break;
- case PADSLASHKEY:
- if(G.qual==0)
- G.sima->flag ^= SI_LOCAL_UV;
- scrarea_queue_winredraw(curarea);
- break;
- case TABKEY:
- if (G.qual == LR_SHIFTKEY) {
- G.scene->snap_flag ^= SCE_SNAP;
- allqueue(REDRAWHEADERS, 0);
- }
- break;
- }
- }
- } else {
- /* Draw and editmode are inactive */
- switch(event) {
- case LEFTMOUSE:
- sima_sample_color();
- break;
- case RIGHTMOUSE:
- if(G.f & (G_VERTEXPAINT|G_TEXTUREPAINT))
- sample_vpaint();
- break;
- case NKEY:
- if(G.qual==LR_CTRLKEY)
- replace_names_but();
- break;
- case PKEY:
- if(G.qual==LR_SHIFTKEY) {
- toggle_blockhandler(sa, IMAGE_HANDLER_PREVIEW, 0);
- scrarea_queue_winredraw(sa);
- }
- break;
- }
- }
-
-
- /* least intrusive nonumpad hack, only for plus/minus */
- if (U.flag & USER_NONUMPAD) {
- event= convert_for_nonumpad(event);
- }
-
- /* Events handled always (whether the draw tool is active or not) */
- switch (event) {
- case UI_BUT_EVENT:
- do_image_buttons(val); /* header_image.c */
- break;
- case MIDDLEMOUSE:
- if((G.qual==LR_CTRLKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_CTRLKEY))))
- image_viewmove(1);
- else
- image_viewmove(0);
- break;
- case WHEELUPMOUSE: case WHEELDOWNMOUSE: case PADPLUSKEY: case PADMINUS:
- case PAD1: case PAD2: case PAD4: case PAD8:
- image_viewzoom(event, (G.qual & LR_SHIFTKEY)==0);
- scrarea_queue_winredraw(sa);
- break;
- case HOMEKEY:
- if((G.qual==0))
- image_home();
-
- break;
- case NKEY:
- if(G.qual==LR_ALTKEY) {
- new_image_sima();
- } else if(G.qual==0) {
- /*if (EM_texFaceCheck()) {
- toggle_blockhandler(sa, IMAGE_HANDLER_TRANSFORM_PROPERTIES, UI_PNL_TO_MOUSE);
- } else {
- toggle_blockhandler(sa, IMAGE_HANDLER_PROPERTIES, UI_PNL_TO_MOUSE);
- }*/
- toggle_blockhandler(sa, IMAGE_HANDLER_PROPERTIES, UI_PNL_TO_MOUSE);
- scrarea_queue_winredraw(sa);
- }
- break;
- case OKEY:
- if (G.qual & LR_ALTKEY)
- open_image_sima(G.qual & LR_CTRLKEY);
- break;
- case RKEY:
- if(G.qual==LR_ALTKEY)
- reload_image_sima();
- break;
- case SKEY:
- if(G.qual & LR_ALTKEY)
- save_image_sima();
- break;
- case ESCKEY:
- if(sima->flag & SI_PREVSPACE) {
- /* only allow ESC once */
- sima->flag &= ~SI_PREVSPACE;
-
- sima= sa->spacedata.first;
- if(sima->next) {
- SpaceLink *sl;
-
- BLI_remlink(&sa->spacedata, sima);
- BLI_addtail(&sa->spacedata, sima);
-
- sl= sa->spacedata.first;
-
- newspace(sa, sl->spacetype);
- }
- }
- if(sima->flag & SI_FULLWINDOW) {
- sima->flag &= ~SI_FULLWINDOW;
- if(sa->full)
- area_fullscreen();
- }
- }
-}
-
-
-static void init_imagespace(ScrArea *sa)
-{
- SpaceImage *sima;
-
- sima= MEM_callocN(sizeof(SpaceImage), "initimaspace");
- BLI_addhead(&sa->spacedata, sima);
-
- sima->spacetype= SPACE_IMAGE;
- sima->zoom= 1;
- sima->blockscale= 0.7;
-
- sima->iuser.ok= 1;
- sima->iuser.fie_ima= 2;
- sima->iuser.frames= 100;
-}
-
-
-/* ******************** SPACE: IMASEL ********************** */
-
-extern void drawimaselspace(ScrArea *sa, void *spacedata);
-extern void winqreadimaselspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
-
-static void changeimaselspace(ScrArea *sa, void *spacedata)
-{
- if(G.v2d==0) return;
-
- test_view2d(G.v2d, curarea->winx, curarea->winy);
- myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax);
-}
-
-static void init_imaselspace(ScrArea *sa)
-{
- SpaceImaSel *simasel;
-
- simasel= MEM_callocN(sizeof(SpaceImaSel), "init imaselspace");
- BLI_addhead(&sa->spacedata, simasel);
-
- simasel->spacetype= SPACE_IMASEL;
- simasel->blockscale= 0.7;
-
- /* view 2D */
- simasel->v2d.tot.xmin= -10.0;
- simasel->v2d.tot.ymin= -10.0;
- simasel->v2d.tot.xmax= (float)sa->winx + 10.0f;
- simasel->v2d.tot.ymax= (float)sa->winy + 10.0f;
-
- simasel->v2d.cur.xmin= 0.0;
- simasel->v2d.cur.ymin= 0.0;
- simasel->v2d.cur.xmax= (float)sa->winx;
- simasel->v2d.cur.ymax= (float)sa->winy;
-
- simasel->v2d.min[0]= 1.0;
- simasel->v2d.min[1]= 1.0;
-
- simasel->v2d.max[0]= 32000.0f;
- simasel->v2d.max[1]= 32000.0f;
-
- simasel->v2d.minzoom= 0.5f;
- simasel->v2d.maxzoom= 1.21f;
-
- simasel->v2d.scroll= 0;
- simasel->v2d.keepaspect= 1;
- simasel->v2d.keepzoom= 1;
- simasel->v2d.keeptot= 0;
-
- simasel->prv_h = 96;
- simasel->prv_w = 96;
-
- simasel->flag = 7; /* ??? elubie */
- strcpy (simasel->dir, U.textudir); /* TON */
- strcpy (simasel->file, "");
-
- simasel->returnfunc = 0;
- simasel->title[0] = 0;
- simasel->type = FILE_UNIX;
- simasel->files = BIF_filelist_new();
-}
-
-/* ******************** SPACE: OOPS ********************** */
-
-extern void drawoopsspace(ScrArea *sa, void *spacedata);
-
-static void winqreadoopsspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
-{
- unsigned short event= evt->event;
- short val= evt->val;
- SpaceOops *soops= curarea->spacedata.first;
- View2D *v2d= &soops->v2d;
- float dx, dy;
-
- if(val==0) return;
-
- if( uiDoBlocks(&sa->uiblocks, event, 1)!=UI_NOTHING ) event= 0;
-
- if (U.flag & USER_NONUMPAD) {
- event= convert_for_nonumpad(event);
- }
-
- /* keep leftmouse select for outliner, regardless of user pref */
- if(soops->type==SO_OUTLINER) {
- switch(event) {
- case LEFTMOUSE:
- case RIGHTMOUSE:
- outliner_mouse_event(sa, event);
- break;
- case MIDDLEMOUSE:
- case WHEELUPMOUSE:
- case WHEELDOWNMOUSE:
- view2dmove(event); /* in drawipo.c */
- soops->storeflag |= SO_TREESTORE_REDRAW;
- break;
-
- case AKEY:
- if(G.qual==LR_SHIFTKEY)
- outliner_toggle_selected(sa);
- else
- outliner_toggle_visible(sa);
- break;
- case FKEY:
- {
- /* search */
- int search_flags=0, again=0;
-
- /* CTRL=case sensitive, SHIFT=find again, ALT=complete */
- if (G.qual & LR_CTRLKEY) search_flags |= 1;
- if (G.qual & LR_ALTKEY) search_flags |= 8;
- if (G.qual & LR_SHIFTKEY) again = 1;
-
- outliner_find_panel(sa, again, search_flags);
- }
- break;
- case XKEY:
- case DELKEY:
- outliner_del(sa);
- break;
- case WKEY:
- outliner_operation_menu(sa);
- break;
-
- case HOMEKEY:
- outliner_show_hierarchy(sa);
- break;
- case PAGEUPKEY:
- outliner_page_up_down(sa, 1);
- break;
- case PAGEDOWNKEY:
- outliner_page_up_down(sa, -1);
- break;
-
- case RETKEY:
- case PADENTER:
- outliner_mouse_event(sa, event);
- break;
- case PERIODKEY:
- case PADPERIOD:
- outliner_show_active(sa);
- break;
- case PADPLUSKEY:
- outliner_one_level(sa, 1);
- break;
- case PADMINUS:
- outliner_one_level(sa, -1);
- break;
- }
- }
- else {
- /* swap mouse buttons based on user preference */
- if (U.flag & USER_LMOUSESELECT) {
- if (event==LEFTMOUSE) event = RIGHTMOUSE;
- else if (event==RIGHTMOUSE) event = LEFTMOUSE;
- }
-
- switch(event) {
- case LEFTMOUSE:
- gesture();
- break;
- case MIDDLEMOUSE:
- case WHEELUPMOUSE:
- case WHEELDOWNMOUSE:
- view2dmove(event); /* in drawipo.c */
- break;
- case RIGHTMOUSE:
- mouse_select_oops();
- break;
- case PADPLUSKEY:
-
- dx= 0.1154*(v2d->cur.xmax-v2d->cur.xmin);
- dy= 0.1154*(v2d->cur.ymax-v2d->cur.ymin);
- v2d->cur.xmin+= dx;
- v2d->cur.xmax-= dx;
- v2d->cur.ymin+= dy;
- v2d->cur.ymax-= dy;
- test_view2d(G.v2d, curarea->winx, curarea->winy);
- scrarea_queue_winredraw(curarea);
- break;
-
- case PADMINUS:
-
- dx= 0.15*(v2d->cur.xmax-v2d->cur.xmin);
- dy= 0.15*(v2d->cur.ymax-v2d->cur.ymin);
- v2d->cur.xmin-= dx;
- v2d->cur.xmax+= dx;
- v2d->cur.ymin-= dy;
- v2d->cur.ymax+= dy;
- test_view2d(G.v2d, curarea->winx, curarea->winy);
- scrarea_queue_winredraw(curarea);
- break;
-
- case HOMEKEY:
- if((G.qual==0))
- do_oops_buttons(B_OOPSHOME);
- break;
-
- case PADPERIOD:
- if((G.qual==0))
- do_oops_buttons(B_OOPSVIEWSEL);
- break;
-
- case AKEY:
- if((G.qual==0)) {
- swap_select_all_oops();
- scrarea_queue_winredraw(curarea);
- }
- break;
- case BKEY:
- if((G.qual==0))
- borderselect_oops();
- break;
- case GKEY:
- if((G.qual==0))
- transform_oops('g', 0);
- break;
- case LKEY:
- if((G.qual==LR_SHIFTKEY))
- select_backlinked_oops();
- else if((G.qual==0))
- select_linked_oops();
- break;
- case SKEY:
- if((G.qual==LR_ALTKEY)) {
- if (okee("Shrink blocks")) {
- shrink_oops();
- }
- } else if((G.qual==LR_SHIFTKEY)) {
- if (okee("Shuffle blocks")) {
- shuffle_oops();
- }
- } else if((G.qual==0)) {
- transform_oops('s', 0);
- }
- break;
- case PKEY:
- if((G.qual==LR_CTRLKEY)) {
- make_parent();
- } else if((G.qual==LR_ALTKEY)) {
- clear_parent();
- }
- break;
-
-
- case ONEKEY:
- do_layer_buttons(0); break;
- case TWOKEY:
- do_layer_buttons(1); break;
- case THREEKEY:
- do_layer_buttons(2); break;
- case FOURKEY:
- do_layer_buttons(3); break;
- case FIVEKEY:
- do_layer_buttons(4); break;
- case SIXKEY:
- do_layer_buttons(5); break;
- case SEVENKEY:
- do_layer_buttons(6); break;
- case EIGHTKEY:
- do_layer_buttons(7); break;
- case NINEKEY:
- do_layer_buttons(8); break;
- case ZEROKEY:
- do_layer_buttons(9); break;
- case MINUSKEY:
- do_layer_buttons(10); break;
- case EQUALKEY:
- do_layer_buttons(11); break;
- case ACCENTGRAVEKEY:
- do_layer_buttons(-1); break;
-
- }
- }
-}
-
-void init_v2d_oops(ScrArea *sa, SpaceOops *soops)
-{
- View2D *v2d= &soops->v2d;
-
- if(soops->type==SO_OUTLINER) {
- /* outliner space is window size */
- calc_scrollrcts(sa, v2d, sa->winx, sa->winy);
-
- v2d->tot.xmax= (v2d->mask.xmax-v2d->mask.xmin);
- v2d->tot.ymax= (v2d->mask.ymax-v2d->mask.ymin);
- v2d->tot.xmin= 0.0;
- v2d->tot.ymin= 0.0;
-
- v2d->cur= v2d->tot;
-
- v2d->min[0]= v2d->tot.xmin;
- v2d->min[1]= v2d->tot.ymin;
-
- v2d->max[0]= v2d->tot.xmax;
- v2d->max[1]= v2d->tot.ymax;
-
- v2d->minzoom= 1.0;
- v2d->maxzoom= 1.0;
-
- /* B_SCROLLO used here instead of B_SCROLL, to stop old blender's hanging on
- * loading a file from a version with horizontal scrolling due to an old bug
- */
- v2d->scroll= L_SCROLL+B_SCROLLO;
- v2d->keepaspect= 1;
- v2d->keepzoom= 1;
-
- /* NOTE: keeptot is 2, as keeptot!=0 makes sure it does get
- * too freely scrolled on x-axis, but keeptot=1 will result
- * in a snap-back when clicking on elements
- */
- v2d->keeptot= 2;
- }
- else {
- v2d->tot.xmin= -28.0;
- v2d->tot.xmax= 28.0;
- v2d->tot.ymin= -28.0;
- v2d->tot.ymax= 28.0;
-
- v2d->cur= v2d->tot;
-
- v2d->min[0]= 10.0;
- v2d->min[1]= 4.0;
-
- v2d->max[0]= 320.0;
- v2d->max[1]= 320.0;
-
- v2d->minzoom= 0.01f;
- v2d->maxzoom= 2.0;
-
- /* v2d->scroll= L_SCROLL+B_SCROLL; */
- v2d->scroll= 0;
- v2d->keepaspect= 1;
- v2d->keepzoom= 0;
- v2d->keeptot= 0;
- }
-}
-
-static void init_oopsspace(ScrArea *sa)
-{
- SpaceOops *soops;
-
- soops= MEM_callocN(sizeof(SpaceOops), "initoopsspace");
- BLI_addhead(&sa->spacedata, soops);
-
- soops->visiflag= OOPS_OB+OOPS_MA+OOPS_ME+OOPS_TE+OOPS_CU+OOPS_IP;
- /* new oops is default an outliner */
- soops->type= SO_OUTLINER;
-
- soops->spacetype= SPACE_OOPS;
- soops->blockscale= 0.7;
- init_v2d_oops(sa, soops);
-}
-
-/* ******************** SPACE: NLA ********************** */
-
-static void init_nlaspace(ScrArea *sa)
-{
- SpaceNla *snla;
-
- snla= MEM_callocN(sizeof(SpaceNla), "initnlaspace");
- BLI_addhead(&sa->spacedata, snla);
-
- snla->spacetype= SPACE_NLA;
- snla->blockscale= 0.7;
-
- snla->v2d.tot.xmin= 1.0;
- snla->v2d.tot.ymin= 0.0;
- snla->v2d.tot.xmax= 1000.0;
- snla->v2d.tot.ymax= 1000.0;
-
- snla->v2d.cur.xmin= -5.0;
- snla->v2d.cur.ymin= 0.0;
- snla->v2d.cur.xmax= 65.0;
- snla->v2d.cur.ymax= 1000.0;
-
- snla->v2d.min[0]= 0.0;
- snla->v2d.min[1]= 0.0;
-
- snla->v2d.max[0]= 1000.0;
- snla->v2d.max[1]= 1000.0;
-
- snla->v2d.minzoom= 0.1F;
- snla->v2d.maxzoom= 50;
-
- snla->v2d.scroll= R_SCROLL+B_SCROLL;
- snla->v2d.keepaspect= 0;
- snla->v2d.keepzoom= V2D_LOCKZOOM_Y;
- snla->v2d.keeptot= 0;
-
- snla->lock = 0;
-}
-
-
-
-/* ******************** SPACE: Text ********************** */
-
-extern void drawtextspace(ScrArea *sa, void *spacedata);
-extern void winqreadtextspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
-
-static void init_textspace(ScrArea *sa)
-{
- SpaceText *st;
-
- st= MEM_callocN(sizeof(SpaceText), "inittextspace");
- BLI_addhead(&sa->spacedata, st);
-
- st->spacetype= SPACE_TEXT;
- st->blockscale= 0.7;
- st->text= NULL;
- st->flags= 0;
-
- st->font_id= 5;
- st->lheight= 12;
- st->showlinenrs= 0;
- st->tabnumber = 4;
- st->currtab_set = 0;
-
- st->top= 0;
-}
-
-
-/* ******************** SPACE: Script ********************** */
-
-extern void drawscriptspace(ScrArea *sa, void *spacedata);
-extern void winqreadscriptspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
-
-static void init_scriptspace(ScrArea *sa)
-{
- SpaceScript *sc;
-
- sc = MEM_callocN(sizeof(SpaceScript), "initscriptspace");
- BLI_addhead(&sa->spacedata, sc);
-
- sc->spacetype = SPACE_SCRIPT;
- sc->blockscale= 0.7;
- sc->script = NULL;
- sc->flags = 0;
-}
-
-
-/* ******************** SPACE: Time ********************** */
-
-extern void drawtimespace(ScrArea *sa, void *spacedata);
-extern void winqreadtimespace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
-
-static void init_timespace(ScrArea *sa)
-{
- SpaceTime *stime;
-
- stime= MEM_callocN(sizeof(SpaceTime), "init timespace");
- BLI_addhead(&sa->spacedata, stime);
-
- stime->spacetype= SPACE_TIME;
- stime->blockscale= 0.7;
- stime->redraws= TIME_ALL_3D_WIN|TIME_ALL_ANIM_WIN;
-
- stime->v2d.tot.xmin= -4.0;
- stime->v2d.tot.ymin= 0.0;
- stime->v2d.tot.xmax= (float)EFRA + 4.0;
- stime->v2d.tot.ymax= (float)sa->winy;
-
- stime->v2d.cur= stime->v2d.tot;
-
- stime->v2d.min[0]= 1.0;
- stime->v2d.min[1]= (float)sa->winy;
-
- stime->v2d.max[0]= 32000.0;
- stime->v2d.max[1]= (float)sa->winy;
-
- stime->v2d.minzoom= 0.1f;
- stime->v2d.maxzoom= 10.0;
-
- stime->v2d.scroll= 0;
- stime->v2d.keepaspect= 0;
- stime->v2d.keepzoom= 0;
- stime->v2d.keeptot= 0;
-
- stime->flag |= TIME_DRAWFRAMES;
-
-}
-
-/* ******************** SPACE: Nodes ********************** */
-
-extern void drawnodespace(ScrArea *sa, void *spacedata);
-extern void winqreadnodespace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
-
-static void init_nodespace(ScrArea *sa)
-{
- SpaceNode *snode;
-
- snode= MEM_callocN(sizeof(SpaceNode), "init nodespace");
- BLI_addhead(&sa->spacedata, snode);
-
- snode->spacetype= SPACE_NODE;
- snode->blockscale= 0.7;
-
- snode->v2d.tot.xmin= -10.0;
- snode->v2d.tot.ymin= -10.0;
- snode->v2d.tot.xmax= (float)sa->winx + 10.0f;
- snode->v2d.tot.ymax= (float)sa->winy + 10.0f;
-
- snode->v2d.cur.xmin= 0.0;
- snode->v2d.cur.ymin= 0.0;
- snode->v2d.cur.xmax= (float)sa->winx;
- snode->v2d.cur.ymax= (float)sa->winy;
-
- snode->v2d.min[0]= 1.0;
- snode->v2d.min[1]= 1.0;
-
- snode->v2d.max[0]= 32000.0f;
- snode->v2d.max[1]= 32000.0f;
-
- snode->v2d.minzoom= 0.5f;
- snode->v2d.maxzoom= 1.21f;
-
- snode->v2d.scroll= 0;
- snode->v2d.keepaspect= 1;
- snode->v2d.keepzoom= 1;
- snode->v2d.keeptot= 0;
-}
-
-
-
-/* ******************** SPACE: GENERAL ********************** */
-
-void newspace(ScrArea *sa, int type)
-{
- int xtra= type & 256; /* hack to enforce outliner with hotkey from toets.c */
-
- type &= ~256;
-
- if(type>=0) {
- if(sa->spacetype != type) {
- SpaceLink *sl;
-
- sa->spacetype= type;
- sa->headbutofs= 0;
-
- uiFreeBlocks(&sa->uiblocks);
- wich_cursor(sa);
-
- if (sa->headwin) addqueue(sa->headwin, CHANGED, 1);
- scrarea_queue_headredraw(sa);
-
- addqueue(sa->win, CHANGED, 1);
- scrarea_queue_winredraw(sa);
-
- for (sl= sa->spacedata.first; sl; sl= sl->next)
- if(sl->spacetype==type)
- break;
-
- if (sl) {
- BLI_remlink(&sa->spacedata, sl);
- BLI_addhead(&sa->spacedata, sl);
- } else {
- if(type==SPACE_VIEW3D)
- initview3d(sa);
- else if(type==SPACE_IPO)
- initipo(sa);
- else if(type==SPACE_INFO)
- init_infospace(sa);
- else if(type==SPACE_BUTS)
- init_butspace(sa);
- else if(type==SPACE_FILE)
- init_filespace(sa);
- else if(type==SPACE_SEQ)
- init_seqspace(sa);
- else if(type==SPACE_IMAGE)
- init_imagespace(sa);
- else if(type==SPACE_IMASEL)
- init_imaselspace(sa);
- else if(type==SPACE_OOPS)
- init_oopsspace(sa);
- else if(type==SPACE_ACTION)
- init_actionspace(sa);
- else if(type==SPACE_TEXT)
- init_textspace(sa);
- else if(type==SPACE_SCRIPT)
- init_scriptspace(sa);
- else if(type==SPACE_SOUND)
- init_soundspace(sa);
- else if(type==SPACE_NLA)
- init_nlaspace(sa);
- else if(type==SPACE_TIME)
- init_timespace(sa);
- else if(type==SPACE_NODE)
- init_nodespace(sa);
-
- sl= sa->spacedata.first;
- sl->area= sa;
- }
-
- areawinset(sa->win);
- bwin_clear_viewmat(sa->win);
- }
- }
-
-
- /* exception: filespace */
- if(sa->spacetype==SPACE_FILE) {
- SpaceFile *sfile= sa->spacedata.first;
-
- if(sfile->type==FILE_MAIN) {
- freefilelist(sfile);
- } else {
- sfile->type= FILE_UNIX;
- }
-
- sfile->returnfunc= NULL;
- sfile->title[0]= 0;
- if(sfile->filelist) test_flags_file(sfile);
- }
- /* exception: imasel space */
- else if(sa->spacetype==SPACE_IMASEL) {
- SpaceImaSel *simasel= sa->spacedata.first;
- if(simasel->type==FILE_MAIN) {
- if (simasel->files) {
- BIF_filelist_free(simasel->files);
- BIF_filelist_settype(simasel->files, FILE_MAIN);
- }
- } else {
- if (simasel->files) {
- simasel->type= FILE_UNIX;
- BIF_filelist_settype(simasel->files, simasel->type);
- }
- }
- simasel->returnfunc= NULL;
- simasel->title[0]= 0;
- }
- else if(sa->spacetype==SPACE_OOPS) {
- SpaceOops *so= sa->spacedata.first;
- if(xtra && so->type!=SO_OUTLINER) {
- so->type= SO_OUTLINER;
- init_v2d_oops(sa, so);
- scrarea_queue_winredraw(sa);
- scrarea_queue_headredraw(sa);
- }
- }
-}
-
-void freespacelist(ScrArea *sa)
-{
- SpaceLink *sl;
-
- for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if(sl->spacetype==SPACE_FILE) {
- SpaceFile *sfile= (SpaceFile*) sl;
- if(sfile->libfiledata)
- BLO_blendhandle_close(sfile->libfiledata);
- if(sfile->filelist)
- freefilelist(sfile);
- if(sfile->pupmenu)
- MEM_freeN(sfile->pupmenu);
- }
- else if(sl->spacetype==SPACE_BUTS) {
- SpaceButs *buts= (SpaceButs*) sl;
- if(buts->ri) {
- if (buts->ri->rect) MEM_freeN(buts->ri->rect);
- MEM_freeN(buts->ri);
- }
- if(G.buts==buts) G.buts= NULL;
- }
- else if(sl->spacetype==SPACE_IPO) {
- SpaceIpo *si= (SpaceIpo*) sl;
- if(si->editipo) MEM_freeN(si->editipo);
- free_ipokey(&si->ipokey);
- if(G.sipo==si) G.sipo= NULL;
- }
- else if(sl->spacetype==SPACE_VIEW3D) {
- View3D *vd= (View3D*) sl;
- if(vd->bgpic) {
- if(vd->bgpic->ima) vd->bgpic->ima->id.us--;
- MEM_freeN(vd->bgpic);
- }
- if(vd->localvd) MEM_freeN(vd->localvd);
- if(vd->clipbb) MEM_freeN(vd->clipbb);
- if(vd->depths) {
- if(vd->depths->depths) MEM_freeN(vd->depths->depths);
- MEM_freeN(vd->depths);
- vd->depths= NULL;
- }
- retopo_free_view_data(vd);
- if(vd->properties_storage) MEM_freeN(vd->properties_storage);
- if(G.vd==vd) G.vd= NULL;
- if(vd->ri) {
- BIF_view3d_previewrender_free(vd);
- }
- }
- else if(sl->spacetype==SPACE_OOPS) {
- SpaceOops *so= (SpaceOops *) sl;
- free_oopspace(so);
- }
- else if(sl->spacetype==SPACE_IMASEL) {
- SpaceImaSel *simasel= (SpaceImaSel*) sl;
- free_imasel(simasel);
- }
- else if(sl->spacetype==SPACE_ACTION) {
- free_actionspace((SpaceAction*)sl);
- }
- else if(sl->spacetype==SPACE_NLA){
-/* free_nlaspace((SpaceNla*)sl); */
- }
- else if(sl->spacetype==SPACE_TEXT) {
- free_textspace((SpaceText *)sl);
- }
- else if(sl->spacetype==SPACE_SCRIPT) {
- free_scriptspace((SpaceScript *)sl);
- }
- else if(sl->spacetype==SPACE_SOUND) {
- free_soundspace((SpaceSound *)sl);
- }
- else if(sl->spacetype==SPACE_IMAGE) {
- SpaceImage *sima= (SpaceImage *)sl;
- if(sima->cumap)
- curvemapping_free(sima->cumap);
- if(sima->info_str)
- MEM_freeN(sima->info_str);
- if(sima->info_spare)
- MEM_freeN(sima->info_spare);
- if(sima->spare)
- IMB_freeImBuf(sima->spare);
- }
- else if(sl->spacetype==SPACE_NODE) {
-/* SpaceNode *snode= (SpaceNode *)sl; */
- }
- }
-
- BLI_freelistN(&sa->spacedata);
-}
-
-/* can be called for area-full, so it should keep interesting stuff */
-void duplicatespacelist(ScrArea *newarea, ListBase *lb1, ListBase *lb2)
-{
- SpaceLink *sl;
-
- duplicatelist(lb1, lb2);
-
- /* lb1 is copy from lb2, from lb2 we free stuff, rely on event system to properly re-alloc */
-
- sl= lb2->first;
- while(sl) {
- if(sl->spacetype==SPACE_FILE) {
- SpaceFile *sfile= (SpaceFile*) sl;
- sfile->libfiledata= NULL;
- sfile->filelist= NULL;
- sfile->pupmenu= NULL;
- sfile->menup= NULL;
- }
- else if(sl->spacetype==SPACE_VIEW3D) {
- View3D *v3d= (View3D*)sl;
- BIF_view3d_previewrender_free(v3d);
- v3d->depths= NULL;
- v3d->retopo_view_data= NULL;
- }
- else if(sl->spacetype==SPACE_OOPS) {
- SpaceOops *so= (SpaceOops *)sl;
- so->oops.first= so->oops.last= NULL;
- so->tree.first= so->tree.last= NULL;
- so->treestore= NULL;
- }
- else if(sl->spacetype==SPACE_IMASEL) {
- SpaceImaSel *simasel= (SpaceImaSel*) sl;
- simasel->pupmenu= NULL;
- simasel->menup= NULL;
- simasel->files = BIF_filelist_new();
- BIF_filelist_setdir(simasel->files, simasel->dir);
- BIF_filelist_settype(simasel->files, simasel->type);
- /* see SPACE_FILE - elubie */
- }
- else if(sl->spacetype==SPACE_NODE) {
- SpaceNode *snode= (SpaceNode *)sl;
- snode->nodetree= NULL;
- }
-
- sl= sl->next;
- }
-
- /* but some things we copy */
-
- sl= lb1->first;
- while(sl) {
- sl->area= newarea;
-
- if(sl->spacetype==SPACE_BUTS) {
- SpaceButs *buts= (SpaceButs *)sl;
- buts->ri= NULL;
- }
- else if(sl->spacetype==SPACE_FILE) {
- SpaceFile *sfile= (SpaceFile*) sl;
- sfile->menup= NULL;
- }
- else if(sl->spacetype==SPACE_IPO) {
- SpaceIpo *si= (SpaceIpo *)sl;
- si->editipo= NULL;
- si->ipokey.first= si->ipokey.last= NULL;
- }
- else if(sl->spacetype==SPACE_VIEW3D) {
- View3D *vd= (View3D *)sl;
- if(vd->bgpic) {
- vd->bgpic= MEM_dupallocN(vd->bgpic);
- if(vd->bgpic->ima) vd->bgpic->ima->id.us++;
- }
- vd->clipbb= MEM_dupallocN(vd->clipbb);
- vd->ri= NULL;
- vd->properties_storage= NULL;
- }
- else if(sl->spacetype==SPACE_IMAGE) {
- SpaceImage *sima= (SpaceImage *)sl;
- if(sima->cumap)
- sima->cumap= curvemapping_copy(sima->cumap);
- if(sima->info_str)
- sima->info_str= MEM_dupallocN(sima->info_str);
- if(sima->info_spare)
- sima->info_spare= MEM_dupallocN(sima->info_spare);
- }
- sl= sl->next;
- }
-
- /* again: from old View3D restore localview (because full) */
- sl= lb2->first;
- while(sl) {
- if(sl->spacetype==SPACE_VIEW3D) {
- View3D *v3d= (View3D*) sl;
- if(v3d->localvd) {
- restore_localviewdata(v3d);
- v3d->localvd= NULL;
- v3d->properties_storage= NULL;
- v3d->localview= 0;
- v3d->lay &= 0xFFFFFF;
- }
- }
- sl= sl->next;
- }
-}
-
-/* is called everywhere in blender */
-void allqueue(unsigned short event, short val)
-{
- ScrArea *sa;
- View3D *v3d;
- SpaceButs *buts;
- SpaceFile *sfile;
-
- sa= G.curscreen->areabase.first;
- while(sa) {
-
- if(event==REDRAWALL) {
- scrarea_queue_winredraw(sa);
- scrarea_queue_headredraw(sa);
- }
- else if(sa->win != val) {
- switch(event) {
-
- case REDRAWHEADERS:
- scrarea_queue_headredraw(sa);
- break;
- case REDRAWVIEW3D:
- if(sa->spacetype==SPACE_VIEW3D) {
- scrarea_queue_winredraw(sa);
- if(val) scrarea_queue_headredraw(sa);
- }
- break;
- case REDRAWVIEW3D_Z:
- if(sa->spacetype==SPACE_VIEW3D) {
- v3d= sa->spacedata.first;
- if(v3d->drawtype==OB_SOLID) {
- scrarea_queue_winredraw(sa);
- if(val) scrarea_queue_headredraw(sa);
- }
- }
- break;
- case REDRAWVIEW3D_IMAGE:
- if(sa->spacetype==SPACE_VIEW3D || sa->spacetype==SPACE_IMAGE) {
- scrarea_queue_winredraw(sa);
- if(val) scrarea_queue_headredraw(sa);
- }
- break;
- case REDRAWVIEWCAM:
- if(sa->spacetype==SPACE_VIEW3D) {
- v3d= sa->spacedata.first;
- if(v3d->persp>1) scrarea_queue_winredraw(sa);
- }
- break;
- case REDRAWINFO:
- if(sa->spacetype==SPACE_INFO) {
- scrarea_queue_winredraw(sa);
- scrarea_queue_headredraw(sa);
- }
- break;
- case REDRAWIMAGE:
- if(sa->spacetype==SPACE_IMAGE) {
- scrarea_queue_winredraw(sa);
- scrarea_queue_headredraw(sa);
- }
- break;
- case REDRAWIPO:
- if(sa->spacetype==SPACE_IPO) {
- SpaceIpo *si;
- scrarea_queue_winredraw(sa);
- scrarea_queue_headredraw(sa);
- if(val) {
- si= sa->spacedata.first;
- if (si->pin==0)
- si->blocktype= val;
- }
- }
- else if(sa->spacetype==SPACE_OOPS) {
- scrarea_queue_winredraw(sa);
- }
-
- break;
-
- case REDRAWBUTSALL:
- if(sa->spacetype==SPACE_BUTS) {
- buts= sa->spacedata.first;
- buts->re_align= 1;
- scrarea_queue_winredraw(sa);
- scrarea_queue_headredraw(sa);
- }
- break;
- case REDRAWBUTSHEAD:
- if(sa->spacetype==SPACE_BUTS) {
- scrarea_queue_headredraw(sa);
- }
- break;
- case REDRAWBUTSSCENE:
- if(sa->spacetype==SPACE_BUTS) {
- buts= sa->spacedata.first;
- if(buts->mainb==CONTEXT_SCENE) {
- buts->re_align= 1;
- scrarea_queue_winredraw(sa);
- scrarea_queue_headredraw(sa);
- }
- }
- break;
- case REDRAWBUTSOBJECT:
- if(sa->spacetype==SPACE_BUTS) {
- buts= sa->spacedata.first;
- if(buts->mainb==CONTEXT_OBJECT) {
- buts->re_align= 1;
- scrarea_queue_winredraw(sa);
- scrarea_queue_headredraw(sa);
- }
- }
- break;
- case REDRAWBUTSSHADING:
- if(sa->spacetype==SPACE_BUTS) {
- buts= sa->spacedata.first;
- if(buts->mainb==CONTEXT_SHADING) {
- buts->re_align= 1;
- scrarea_queue_winredraw(sa);
- scrarea_queue_headredraw(sa);
- }
- }
- break;
- case REDRAWBUTSEDIT:
- if(sa->spacetype==SPACE_BUTS) {
- buts= sa->spacedata.first;
- if(buts->mainb==CONTEXT_EDITING) {
- buts->re_align= 1;
- scrarea_queue_winredraw(sa);
- scrarea_queue_headredraw(sa);
- }
- }
- break;
- case REDRAWBUTSSCRIPT:
- if(sa->spacetype==SPACE_BUTS) {
- buts= sa->spacedata.first;
- if(buts->mainb==CONTEXT_SCRIPT) {
- buts->re_align= 1;
- scrarea_queue_winredraw(sa);
- scrarea_queue_headredraw(sa);
- }
- }
- break;
- case REDRAWBUTSLOGIC:
- if(sa->spacetype==SPACE_BUTS) {
- buts= sa->spacedata.first;
- if(buts->mainb==CONTEXT_LOGIC) {
- scrarea_queue_winredraw(sa);
- scrarea_queue_headredraw(sa);
- }
- }
- break;
-
- case REDRAWDATASELECT:
- if(sa->spacetype==SPACE_FILE) {
- sfile= sa->spacedata.first;
- if(sfile->type==FILE_MAIN) {
- freefilelist(sfile);
- scrarea_queue_winredraw(sa);
- }
- }
- else if(sa->spacetype==SPACE_OOPS) {
- scrarea_queue_winredraw(sa);
- }
- break;
- case REDRAWSEQ:
- if(sa->spacetype==SPACE_SEQ) {
- addqueue(sa->win, CHANGED, 1);
- scrarea_queue_winredraw(sa);
- scrarea_queue_headredraw(sa);
- }
- break;
- case REDRAWOOPS:
- if(sa->spacetype==SPACE_OOPS) {
- scrarea_queue_winredraw(sa);
- }
- break;
- case REDRAWNLA:
- if(sa->spacetype==SPACE_NLA) {
- scrarea_queue_headredraw(sa);
- scrarea_queue_winredraw(sa);
- }
- case REDRAWACTION:
- if(sa->spacetype==SPACE_ACTION) {
- scrarea_queue_headredraw(sa);
- scrarea_queue_winredraw(sa);
- }
- break;
- case REDRAWTEXT:
- if(sa->spacetype==SPACE_TEXT) {
- scrarea_queue_winredraw(sa);
- }
- break;
- case REDRAWSCRIPT:
- if (sa->spacetype==SPACE_SCRIPT) {
- scrarea_queue_winredraw(sa);
- }
- break;
- case REDRAWSOUND:
- if(sa->spacetype==SPACE_SOUND) {
- scrarea_queue_headredraw(sa);
- scrarea_queue_winredraw(sa);
- }
- break;
- case REDRAWTIME:
- if(sa->spacetype==SPACE_TIME) {
- scrarea_queue_headredraw(sa);
- scrarea_queue_winredraw(sa);
- }
- break;
- case REDRAWNODE:
- if(sa->spacetype==SPACE_NODE) {
- scrarea_queue_headredraw(sa);
- scrarea_queue_winredraw(sa);
- }
- break;
- case RECALC_COMPOSITE:
- if(sa->spacetype==SPACE_NODE) {
- addqueue(sa->win, UI_BUT_EVENT, B_NODE_TREE_EXEC);
- }
- break;
- case REDRAWANIM:
- if ELEM6(sa->spacetype, SPACE_IPO, SPACE_SOUND, SPACE_TIME, SPACE_NLA, SPACE_ACTION, SPACE_SEQ) {
- scrarea_queue_winredraw(sa);
- if(val) scrarea_queue_headredraw(sa);
- }
- case REDRAWMARKER: /* markers may not always match animation */
- if ELEM6(sa->spacetype, SPACE_TIME, SPACE_IPO, SPACE_ACTION, SPACE_NLA, SPACE_SOUND, SPACE_SEQ) {
- scrarea_queue_winredraw(sa);
- if(val) scrarea_queue_headredraw(sa);
- }
- }
- }
- sa= sa->next;
- }
-}
-
-void allspace(unsigned short event, short val)
-{
- bScreen *sc;
-
- sc= G.main->screen.first;
- while(sc) {
- ScrArea *sa= sc->areabase.first;
- while(sa) {
- SpaceLink *sl= sa->spacedata.first;
- while(sl) {
- switch(event) {
- case REMAKEIPO:
- if(sl->spacetype==SPACE_IPO) {
- SpaceIpo *si= (SpaceIpo *)sl;
- {
- if(si->editipo) MEM_freeN(si->editipo);
- si->editipo= 0;
- free_ipokey(&si->ipokey);
- }
- }
- break;
-
- case OOPS_TEST:
- if(sl->spacetype==SPACE_OOPS) {
- SpaceOops *so= (SpaceOops *)sl;
- so->flag |= SO_TESTBLOCKS;
- }
- break;
- }
-
- sl= sl->next;
- }
- sa= sa->next;
- }
- sc= sc->id.next;
- }
-}
-
-/* if header==1, then draw header for curarea too. Excepption for headerprint()... */
-void force_draw(int header)
-{
- /* draws all areas that show something identical to curarea */
- extern int afterqtest(short win, unsigned short evt); /*editscreen.c*/
- ScrArea *tempsa, *sa;
-
- scrarea_do_windraw(curarea);
- if(header) scrarea_do_headdraw(curarea);
-
- tempsa= curarea;
- sa= G.curscreen->areabase.first;
- while(sa) {
- if(sa!=tempsa && sa->spacetype==tempsa->spacetype) {
- areawinset(sa->win);
- scrarea_do_windraw(sa);
- scrarea_do_headdraw(sa);
- }
- sa= sa->next;
- }
-
- screen_swapbuffers();
-
-#ifndef __APPLE__
- if(tempsa->spacetype==SPACE_VIEW3D) {
- /* de the afterqueuetest for backbuf draw */
- sa= G.curscreen->areabase.first;
- while(sa) {
- if(sa->spacetype==SPACE_VIEW3D) {
- if(afterqtest(sa->win, BACKBUFDRAW)) {
- areawinset(sa->win);
- backdrawview3d(0);
- }
- }
- sa= sa->next;
- }
- }
-#endif
- if(curarea!=tempsa) areawinset(tempsa->win);
-
-}
-
-/* if header==1, then draw header for curarea too. Exception for headerprint()... */
-void force_draw_plus(int type, int header)
-{
- /* draws all areas that show something like curarea AND areas of 'type' */
- ScrArea *tempsa, *sa;
-
- scrarea_do_windraw(curarea);
- if(header) scrarea_do_headdraw(curarea);
-
- tempsa= curarea;
- sa= G.curscreen->areabase.first;
- while(sa) {
- if(sa!=tempsa && (sa->spacetype==tempsa->spacetype || sa->spacetype==type)) {
- if(ELEM5(sa->spacetype, SPACE_VIEW3D, SPACE_IPO, SPACE_SEQ, SPACE_BUTS, SPACE_ACTION)) {
- areawinset(sa->win);
- scrarea_do_windraw(sa);
- scrarea_do_headdraw(sa);
- }
- }
- sa= sa->next;
- }
- if(curarea!=tempsa) areawinset(tempsa->win);
-
- screen_swapbuffers();
-}
-
-/* if header==1, then draw header for curarea too. Excepption for headerprint()... */
-void force_draw_all(int header)
-{
- /* redraws all */
- ScrArea *tempsa, *sa;
-
- tempsa= curarea;
- sa= G.curscreen->areabase.first;
- while(sa) {
- if(sa->headwin) {
- scrarea_do_headdraw(sa);
- if(sa!=curarea || header) scrarea_do_headchange(sa);
- }
- if(sa->win) {
- scrarea_do_windraw(sa);
- }
- sa= sa->next;
- }
- if(curarea!=tempsa) areawinset(tempsa->win);
-
- screen_swapbuffers();
-}
-
-/***/
-
-SpaceType *spaceaction_get_type(void)
-{
- static SpaceType *st= NULL;
-
- if (!st) {
- st= spacetype_new("Action");
- spacetype_set_winfuncs(st, NULL, drawactionspace, changeactionspace, winqreadactionspace);
- }
-
- return st;
-}
-SpaceType *spacebuts_get_type(void)
-{
- static SpaceType *st= NULL;
-
- if (!st) {
- st= spacetype_new("Buts");
- spacetype_set_winfuncs(st, NULL, drawbutspace, changebutspace, winqreadbutspace);
- }
-
- return st;
-}
-SpaceType *spacefile_get_type(void)
-{
- static SpaceType *st= NULL;
-
- if (!st) {
- st= spacetype_new("File");
- spacetype_set_winfuncs(st, NULL, drawfilespace, NULL, winqreadfilespace);
- }
-
- return st;
-}
-SpaceType *spaceimage_get_type(void)
-{
- static SpaceType *st= NULL;
-
- if (!st) {
- st= spacetype_new("Image");
- spacetype_set_winfuncs(st, NULL, drawimagespace, changeimagepace, winqreadimagespace);
- }
-
- return st;
-}
-SpaceType *spaceimasel_get_type(void)
-{
- static SpaceType *st= NULL;
-
- if (!st) {
- st= spacetype_new("Imasel");
- spacetype_set_winfuncs(st, NULL, drawimaselspace, changeimaselspace, winqreadimaselspace);
- }
-
- return st;
-}
-SpaceType *spaceinfo_get_type(void)
-{
- static SpaceType *st= NULL;
-
- if (!st) {
- st= spacetype_new("Info");
- spacetype_set_winfuncs(st, NULL, drawinfospace, NULL, winqreadinfospace);
- }
-
- return st;
-}
-SpaceType *spaceipo_get_type(void)
-{
- static SpaceType *st= NULL;
-
- if (!st) {
- st= spacetype_new("Ipo");
- spacetype_set_winfuncs(st, NULL, drawipospace, changeview2dspace, winqreadipospace);
- }
-
- return st;
-}
-SpaceType *spacenla_get_type(void)
-{
- static SpaceType *st= NULL;
-
- if (!st) {
- st= spacetype_new("Nla");
- spacetype_set_winfuncs(st, NULL, drawnlaspace, changeview2dspace, winqreadnlaspace);
- }
-
- return st;
-}
-SpaceType *spaceoops_get_type(void)
-{
- static SpaceType *st= NULL;
-
- if (!st) {
- st= spacetype_new("Oops");
- spacetype_set_winfuncs(st, NULL, drawoopsspace, changeview2dspace, winqreadoopsspace);
- }
-
- return st;
-}
-SpaceType *spaceseq_get_type(void)
-{
- static SpaceType *st= NULL;
-
- if (!st) {
- st= spacetype_new("Sequence");
- spacetype_set_winfuncs(st, drawprefetchseqspace, drawseqspace, changeview2dspace, winqreadseqspace);
- }
-
- return st;
-}
-SpaceType *spacesound_get_type(void)
-{
- static SpaceType *st= NULL;
-
- if (!st) {
- st= spacetype_new("Sound");
- spacetype_set_winfuncs(st, NULL, drawsoundspace, changeview2dspace, winqreadsoundspace);
- }
-
- return st;
-}
-SpaceType *spacetext_get_type(void)
-{
- static SpaceType *st= NULL;
-
- if (!st) {
- st= spacetype_new("Text");
- spacetype_set_winfuncs(st, NULL, drawtextspace, NULL, winqreadtextspace);
- }
-
- return st;
-}
-
-static void spacescript_change(ScrArea *sa, void *spacedata)
-{
- SpaceScript *sc = (SpaceScript*) spacedata;
-
- /*clear all temp button references*/
- if (sc->but_refs) {
- BPy_Set_DrawButtonsList(sc->but_refs);
- BPy_Free_DrawButtonsList();
- sc->but_refs = NULL;
- }
-}
-
-SpaceType *spacescript_get_type(void)
-{
- static SpaceType *st = NULL;
-
- if (!st) {
- st = spacetype_new("Script");
- spacetype_set_winfuncs(st, NULL, drawscriptspace, spacescript_change, winqreadscriptspace);
- }
-
- return st;
-}
-SpaceType *spaceview3d_get_type(void)
-{
- static SpaceType *st= NULL;
-
- if (!st) {
- st= spacetype_new("View3D");
- spacetype_set_winfuncs(st, NULL, drawview3dspace, changeview3dspace, winqreadview3dspace);
- }
-
- return st;
-}
-SpaceType *spacetime_get_type(void)
-{
- static SpaceType *st= NULL;
-
- if (!st) {
- st= spacetype_new("Time");
- spacetype_set_winfuncs(st, NULL, drawtimespace, NULL, winqreadtimespace);
- }
-
- return st;
-}
-
-SpaceType *spacenode_get_type(void)
-{
- static SpaceType *st= NULL;
-
- if (!st) {
- st= spacetype_new("Node");
- spacetype_set_winfuncs(st, NULL, drawnodespace, changeview2dspace, winqreadnodespace);
- }
-
- return st;
-}
diff --git a/source/blender/src/spacetypes.c b/source/blender/src/spacetypes.c
deleted file mode 100644
index 4a0375f2366..00000000000
--- a/source/blender/src/spacetypes.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "BLI_blenlib.h"
-
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-
-#include "BIF_gl.h"
-#include "BIF_mywindow.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_spacetypes.h"
-
-/***/
-
-struct _SpaceType {
- char name[32];
-
- SpacePrefetchDrawFP winprefetchdraw;
- SpaceDrawFP windraw;
- SpaceChangeFP winchange;
- SpaceHandleFP winhandle;
-};
-
-/* local prototypes ----------------------- */
-void scrarea_do_windraw(ScrArea *area);
-void scrarea_do_winchange(ScrArea *area);
-void scrarea_do_winhandle(ScrArea *area, BWinEvent *evt);
-
-SpaceType *spacetype_new(char *name)
-{
- SpaceType *st= calloc(1, sizeof(*st));
- BLI_strncpy(st->name, name, sizeof(st->name));
-
- return st;
-}
-
-void spacetype_set_winfuncs(SpaceType *st, SpacePrefetchDrawFP prefetchdraw, SpaceDrawFP draw, SpaceChangeFP change, SpaceHandleFP handle)
-{
- st->winprefetchdraw = prefetchdraw;
- st->windraw= draw;
- st->winchange= change;
- st->winhandle= handle;
-}
-
- /* gets SpaceType struct, but also has patch to initialize unknown spacetypes */
-
-static SpaceType *spacetype_from_area(ScrArea *area)
-{
- switch (area->spacetype) {
- case SPACE_ACTION: return spaceaction_get_type();
- case SPACE_BUTS: return spacebuts_get_type();
- case SPACE_FILE: return spacefile_get_type();
- case SPACE_IMAGE: return spaceimage_get_type();
- case SPACE_IMASEL: return spaceimasel_get_type();
- case SPACE_INFO: return spaceinfo_get_type();
- case SPACE_IPO: return spaceipo_get_type();
- case SPACE_NLA: return spacenla_get_type();
- case SPACE_OOPS: return spaceoops_get_type();
- case SPACE_SEQ: return spaceseq_get_type();
- case SPACE_SOUND: return spacesound_get_type();
- case SPACE_TEXT: return spacetext_get_type();
- case SPACE_SCRIPT: return spacescript_get_type();
- case SPACE_VIEW3D: return spaceview3d_get_type();
- case SPACE_TIME: return spacetime_get_type();
- case SPACE_NODE: return spacenode_get_type();
- default:
- newspace(area, SPACE_VIEW3D);
- return spaceview3d_get_type();
- return NULL;
- }
-}
-
-void scrarea_do_winprefetchdraw(ScrArea *area)
-{
- SpaceType *st= spacetype_from_area(area);
-
- areawinset(area->win);
-
- if(area->win && st->winprefetchdraw) {
- st->winprefetchdraw(area, area->spacedata.first);
- }
-}
-
-void scrarea_do_windraw(ScrArea *area)
-{
- SpaceType *st= spacetype_from_area(area);
-
- areawinset(area->win);
-
- if(area->win && st->windraw) {
- st->windraw(area, area->spacedata.first);
- }
- else {
- glClearColor(0.4375, 0.4375, 0.4375, 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
- }
-
- area->win_swap= WIN_BACK_OK;
-}
-void scrarea_do_winchange(ScrArea *area)
-{
- SpaceType *st= spacetype_from_area(area);
-
- areawinset(area->win);
-
- if (st->winchange) {
- st->winchange(area, area->spacedata.first);
- } else {
- if (!BLI_rcti_is_empty(&area->winrct)) {
- bwin_ortho2(area->win, -0.375, area->winrct.xmax-area->winrct.xmin-0.375, -0.375, area->winrct.ymax-area->winrct.ymin-0.375);
- glLoadIdentity();
- }
- }
-}
-void scrarea_do_winhandle(ScrArea *area, BWinEvent *evt)
-{
- SpaceType *st= spacetype_from_area(area);
-
- areawinset(area->win);
-
- if (st->winhandle) {
- st->winhandle(area, area->spacedata.first, evt);
- }
-}
diff --git a/source/blender/src/swapbuffers.c b/source/blender/src/swapbuffers.c
deleted file mode 100644
index cad8d86e677..00000000000
--- a/source/blender/src/swapbuffers.c
+++ /dev/null
@@ -1,289 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-
-/* HRMS!!... blender has its own swapbuffers method. for sgi only that worked pretty nice.
- * but with porting to linux and win, with mesa and opengl variations, it all grow
- * out of control.
- * with the introduction of Ghost (2002) we really should bring this back to a single
- * method again. (ton)
- */
-
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "DNA_space_types.h"
-#include "DNA_screen_types.h"
-
-#include "BKE_global.h"
-
-#include "BIF_gl.h"
-#include "BIF_interface.h"
-#include "BIF_mywindow.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-
-#include "winlay.h"
-
-#if 0
-static void copy_back_to_front(void)
-{
- int actually_swap= 0;
- int winx, winy;
- char *data;
-
- winlay_get_winsize(&winx, &winy);
-
- if (actually_swap) {
- data= MEM_mallocN(4*winx*winy, "swap");
- glReadPixels(0, 0, winx, winy, GL_RGBA, GL_UNSIGNED_BYTE, data);
- }
-
- mywinset(1);
- glRasterPos2f(-0.5,-0.5);
- glReadBuffer(GL_BACK);
- glDrawBuffer(GL_FRONT);
- glCopyPixels(0, 0, winx, winy, GL_COLOR);
- glDrawBuffer(GL_BACK);
- glFlush();
-
- if (actually_swap) {
- glRasterPos2f(-0.5,-0.5);
- glDrawPixels(winx, winy, GL_RGBA, GL_UNSIGNED_BYTE, data);
- glFlush();
- MEM_freeN(data);
- }
-}
-#endif
-
-static void screen_swapbuffers_REDRAW(bScreen *sc)
-{
- ScrArea *sa;
- int doswap= 0, swap;
-
- /* a new implementation: only using redraws and a normal swapbuffer */
-
- /* all areas front ok? */
- sa= sc->areabase.first;
- while(sa) {
- if(sa->win && (sa->win_swap & WIN_FRONT_OK)==0) break;
- if(sa->headertype==0) sa->head_swap= WIN_EQUAL;
- if((sa->head_swap & WIN_FRONT_OK)==0) break;
- sa= sa->next;
- }
- if(sa==0) return;
-
- sa= sc->areabase.first;
- while(sa) {
- swap= sa->win_swap;
- if( (swap & WIN_BACK_OK) == 0) {
- scrarea_do_windraw(sa);
-
- doswap= 1;
- sa->win_swap= swap | WIN_BACK_OK;
- }
- else if( sa->win_swap==WIN_BACK_OK) doswap= 1;
-
- swap= sa->head_swap;
- if( (swap & WIN_BACK_OK) == 0) {
- if (sa->headertype) scrarea_do_headdraw(sa);
- doswap= 1;
- sa->head_swap = swap | WIN_BACK_OK;
- }
- else if( sa->head_swap==WIN_BACK_OK) doswap= 1;
-
- sa= sa->next;
- }
-
- /* the whole backbuffer should now be ok */
- if(doswap) {
- myswapbuffers();
- }
-}
-
-#include "BMF_Api.h"
-#include <stdio.h>
-
-static void draw_debug_win(int win)
-{
- static int drawcounter= 0;
- char buf[64];
- int x, y;
- int w, h;
-
- bwin_getsuborigin(win, &x, &y);
- bwin_getsize(win, &w, &h);
-
- mywinset(win);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(0, w, 0, h, -1, 1);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-
- glColor3f(0.8, 0.8, 0.8);
- glRecti(0, 0, w, h);
-
- glColor3f(0.6, 0.6, 0.6);
- glRecti(2, 2, w-4, h-4);
-
- glColor3ub(0, 0, 0);
- glRasterPos2i(5, 5);
-
- sprintf(buf, "win: %d - (%d, %d, %d, %d) %d\n", win, x, y, w, h, drawcounter++);
- BMF_DrawString(G.font, buf);
-}
-
-static void screen_swapbuffers_DEBUG(bScreen *sc)
-{
- ScrArea *sa;
-
- for (sa= sc->areabase.first; sa; sa= sa->next) {
- draw_debug_win(sa->win);
- if (sa->headwin) draw_debug_win(sa->headwin);
- }
-
- myswapbuffers();
-}
-
-static void screen_swapbuffers_DEBUG_SWAP(bScreen *sc)
-{
- ScrArea *sa;
- int doswap= 0, swap;
-
- /* a new implementation: only using redraws and a normal swapbuffer */
-
- /* all areas front ok? */
- sa= sc->areabase.first;
- while(sa) {
- if(sa->win && (sa->win_swap & WIN_FRONT_OK)==0) break;
- if(!sa->headertype) sa->head_swap= WIN_EQUAL;
- if((sa->head_swap & WIN_FRONT_OK)==0) break;
- sa= sa->next;
- }
- if(sa==0) return;
-
- sa= sc->areabase.first;
- while(sa) {
-
- swap= sa->win_swap;
- if( (swap & WIN_BACK_OK) == 0) {
- scrarea_do_windraw(sa);
- draw_debug_win(sa->win);
-
- doswap= 1;
- sa->win_swap= swap | WIN_BACK_OK;
- }
- else if( sa->win_swap==WIN_BACK_OK) doswap= 1;
-
- swap= sa->head_swap;
- if( (swap & WIN_BACK_OK) == 0) {
- if (sa->headertype) {
- scrarea_do_headdraw(sa);
- draw_debug_win(sa->headwin);
- }
- doswap= 1;
- sa->head_swap = swap | WIN_BACK_OK;
- }
- else if( sa->head_swap==WIN_BACK_OK) doswap= 1;
-
- sa= sa->next;
- }
-
- if(doswap) {
- myswapbuffers();
- }
-}
-
-static void screen_swapbuffers_SIMPLE(bScreen *sc)
-{
- ScrArea *sa;
-
- mywinset(1);
- glClearColor(0.8, 0.6, 0.7, 1.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- for (sa= sc->areabase.first; sa; sa= sa->next) {
- scrarea_do_windraw(sa);
- if (sa->headertype) scrarea_do_headdraw(sa);
- }
-
- myswapbuffers();
-}
-
-static int drawmode_default= 'r';
-int debug_swapbuffers_override= 0;
-
-void set_debug_swapbuffers_ovveride(bScreen *sc, int mode)
-{
- ScrArea *sa;
- for (sa= sc->areabase.first; sa; sa= sa->next) {
- sa->win_swap= 0;
- sa->head_swap= 0;
- }
- debug_swapbuffers_override= mode;
-}
-
-void screen_swapbuffers(void)
-{
- ScrArea *tempsa;
-
- bScreen *sc= G.curscreen;
- int drawmode;
-
- if (debug_swapbuffers_override) {
- drawmode= debug_swapbuffers_override;
- } else {
- drawmode= drawmode_default;
- }
-
- tempsa= curarea;
- areawinset(1);
-
- if (drawmode=='s') {
- screen_swapbuffers_SIMPLE(sc);
- } else if (drawmode=='d') {
- screen_swapbuffers_DEBUG(sc);
- } else if (drawmode=='f') {
- screen_swapbuffers_DEBUG_SWAP(sc);
- } else {
- screen_swapbuffers_REDRAW(sc);
- }
-
- areawinset(tempsa->win);
-}
diff --git a/source/blender/src/toets.c b/source/blender/src/toets.c
deleted file mode 100644
index 53bbfb3fb69..00000000000
--- a/source/blender/src/toets.c
+++ /dev/null
@@ -1,983 +0,0 @@
-/**
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-
- *
- *
- * General blender hot keys (toets = dutch), special hotkeys are in space.c
- *
- */
-
-#include <string.h>
-#include <math.h>
-
-#ifdef WIN32
-#include "BLI_winstuff.h"
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "PIL_time.h"
-
-#include "nla.h" /* Only for the #ifdef flag - To be removed later */
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "DNA_object_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_space_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_userdef_types.h"
-
-#include "BKE_action.h"
-#include "BKE_anim.h"
-#include "BKE_blender.h"
-#include "BKE_depsgraph.h"
-#include "BKE_displist.h"
-#include "BKE_global.h"
-#include "BKE_image.h"
-#include "BKE_ipo.h"
-#include "BKE_key.h"
-#include "BKE_scene.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_butspace.h"
-#include "BIF_editseq.h"
-#include "BIF_editsound.h"
-#include "BIF_editmesh.h"
-#include "BIF_imasel.h"
-#include "BIF_editparticle.h"
-#include "BIF_interface.h"
-#include "BKE_object.h"
-#include "BIF_poseobject.h"
-#include "BIF_previewrender.h"
-#include "BIF_renderwin.h"
-#include "BIF_retopo.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toets.h"
-#include "BIF_toolbox.h"
-#include "BIF_usiblender.h"
-#include "BIF_writeimage.h"
-
-#include "BDR_sculptmode.h"
-#include "BDR_vpaint.h"
-#include "BDR_editobject.h"
-#include "BDR_editface.h"
-
-#include "BSE_filesel.h" /* For activate_fileselect */
-#include "BSE_drawview.h" /* For play_anim */
-#include "BSE_view.h"
-#include "BSE_edit.h"
-#include "BSE_editipo.h"
-#include "BSE_headerbuttons.h"
-#include "BSE_seqaudio.h"
-
-#include "blendef.h"
-
-#include "IMB_imbuf.h"
-#include "IMB_imbuf_types.h"
-
-#include "mydevice.h"
-
-#include "BIF_poseobject.h"
-
-#define VIEW_ZOOM_OUT_FACTOR (1.15f)
-#define VIEW_ZOOM_IN_FACTOR (1.0f/VIEW_ZOOM_OUT_FACTOR)
-
-/* ------------------------------------------------------------------------- */
-
-static int is_an_active_object(void *ob) {
- Base *base;
-
- for (base= FIRSTBASE; base; base= base->next)
- if (base->object == ob)
- return 1;
-
- return 0;
-}
-
-/* run when pressing 1,3 or 7 */
-static void axis_set_view(float q1, float q2, float q3, float q4, short view, int perspo)
-{
- float new_quat[4];
- new_quat[0]= q1; new_quat[1]= q2;
- new_quat[2]= q3; new_quat[3]= q4;
- G.vd->view=0;
-
- if (G.vd->persp==2 && G.vd->camera) {
- /* Is this switching from a camera view ? */
- float orig_ofs[3];
- float orig_lens= G.vd->lens;
- VECCOPY(orig_ofs, G.vd->ofs);
- view_settings_from_ob(G.vd->camera, G.vd->ofs, G.vd->viewquat, &G.vd->dist, &G.vd->lens);
-
- if (U.uiflag & USER_AUTOPERSP) G.vd->persp= 0;
- else if(G.vd->persp>=2) G.vd->persp= perspo;
-
- smooth_view(G.vd, orig_ofs, new_quat, NULL, &orig_lens);
- } else {
-
- if (U.uiflag & USER_AUTOPERSP) G.vd->persp= 0;
- else if(G.vd->persp>=2) G.vd->persp= perspo;
-
- smooth_view(G.vd, NULL, new_quat, NULL, NULL);
- }
- G.vd->view= view;
-}
-
-void persptoetsen(unsigned short event)
-{
- static Object *oldcamera=0;
- float phi, si, q1[4], vec[3];
- static int perspo=1;
- int preview3d_event= 1;
- short mouseloc[2];
-
- float new_dist, orig_ofs[3];
-
- /* Use this to test if we started out with a camera */
- Object *act_cam_orig=NULL;
- if (G.vd->persp == 2)
- act_cam_orig = G.vd->camera;
-
- if(event==PADENTER) {
- if (G.qual == LR_SHIFTKEY) {
- view3d_set_1_to_1_viewborder(G.vd);
- } else {
- if (G.vd->persp==2) {
- G.vd->camzoom= 0;
- } else {
- new_dist = 10.0;
- smooth_view(G.vd, NULL, NULL, &new_dist, NULL);
- }
- }
- }
- else if((G.qual & (LR_SHIFTKEY | LR_CTRLKEY)) && (event != PAD0)) {
-
- /* Indicate that this view is inverted,
- * but only if it actually _was_ inverted (jobbe) */
- if (event==PAD7 || event == PAD1 || event == PAD3)
- G.vd->flag2 |= V3D_OPP_DIRECTION_NAME;
-
- if(event==PAD0) {
- /* G.vd->persp= 3; */
- }
- else if(event==PAD7) {
- axis_set_view(0.0, -1.0, 0.0, 0.0, 7, perspo);
- }
- else if(event==PAD1) {
- axis_set_view(0.0, 0.0, (float)-cos(M_PI/4.0), (float)-cos(M_PI/4.0), 1, perspo);
- }
- else if(event==PAD3) {
- axis_set_view(0.5, -0.5, 0.5, 0.5, 3, perspo);
- }
- else if(event==PADMINUS) {
- /* this min and max is also in viewmove() */
- if(G.vd->persp==2) {
- G.vd->camzoom-= 10;
- if(G.vd->camzoom<-30) G.vd->camzoom= -30;
- }
- else if(G.vd->dist<10.0*G.vd->far) G.vd->dist*=1.2f;
- }
- else if(event==PADPLUSKEY) {
- if(G.vd->persp==2) {
- G.vd->camzoom+= 10;
- if(G.vd->camzoom>300) G.vd->camzoom= 300;
- }
- else if(G.vd->dist> 0.001*G.vd->grid) G.vd->dist*=.83333f;
- }
- else {
-
- initgrabz(0.0, 0.0, 0.0);
-
- if(event==PAD6) window_to_3d(vec, -32, 0);
- else if(event==PAD4) window_to_3d(vec, 32, 0);
- else if(event==PAD8) window_to_3d(vec, 0, -25);
- else if(event==PAD2) window_to_3d(vec, 0, 25);
- G.vd->ofs[0]+= vec[0];
- G.vd->ofs[1]+= vec[1];
- G.vd->ofs[2]+= vec[2];
- }
- }
- else {
- /* Indicate that this view is not inverted.
- * Don't do this for PADMINUS/PADPLUSKEY, though. (jobbe)*/
- if (event != PADMINUS && event != PADPLUSKEY)
- G.vd->flag2 &= ~V3D_OPP_DIRECTION_NAME;
-
-
- if(event==PAD7) {
- axis_set_view(1.0, 0.0, 0.0, 0.0, 7, perspo);
- }
- else if(event==PAD1) {
- axis_set_view((float)cos(M_PI/4.0), (float)-sin(M_PI/4.0), 0.0, 0.0, 1, perspo);
- }
- else if(event==PAD3) {
- axis_set_view(0.5, -0.5, -0.5, -0.5, 3, perspo);
- }
- else if(event==PADMINUS) {
- /* this min and max is also in viewmove() */
- if(G.vd->persp==2) {
- G.vd->camzoom= MAX2(-30, G.vd->camzoom-5);
- }
- else if(G.vd->dist<10.0*G.vd->far) {
- getmouseco_areawin(mouseloc);
- view_zoom_mouseloc(VIEW_ZOOM_OUT_FACTOR, mouseloc);
- }
- if(G.vd->persp!=1) preview3d_event= 0;
- }
- else if(event==PADPLUSKEY) {
- if(G.vd->persp==2) {
- G.vd->camzoom= MIN2(300, G.vd->camzoom+5);
- }
- else if(G.vd->dist> 0.001*G.vd->grid) {
- getmouseco_areawin(mouseloc);
- view_zoom_mouseloc(VIEW_ZOOM_IN_FACTOR, mouseloc);
- }
- if(G.vd->persp!=1) preview3d_event= 0;
- }
- else if(event==PAD5) {
- if (U.smooth_viewtx) {
- if(G.vd->persp==1) { G.vd->persp=0;
- } else if (act_cam_orig) {
- /* were from a camera view */
- float orig_dist= G.vd->dist;
- float orig_lens= G.vd->lens;
- VECCOPY(orig_ofs, G.vd->ofs);
-
- G.vd->persp=1;
- G.vd->dist= 0.0;
-
- view_settings_from_ob(act_cam_orig, G.vd->ofs, NULL, NULL, &G.vd->lens);
-
- smooth_view(G.vd, orig_ofs, NULL, &orig_dist, &orig_lens);
-
- } else {
- G.vd->persp=1;
- }
- } else {
- if(G.vd->persp==1) G.vd->persp=0;
- else G.vd->persp=1;
- }
- }
- else if(event==PAD0) {
- if(G.qual==LR_ALTKEY) {
- if(oldcamera && is_an_active_object(oldcamera)) {
- G.vd->camera= oldcamera;
- }
- handle_view3d_lock();
- }
- else if(BASACT) {
- /* check both G.vd as G.scene cameras */
- if(G.qual==LR_CTRLKEY) {
- if(G.vd->camera != OBACT || G.scene->camera != OBACT) {
- if(G.vd->camera && G.vd->camera->type==OB_CAMERA)
- oldcamera= G.vd->camera;
-
- G.vd->camera= OBACT;
- handle_view3d_lock();
- }
- }
- else if((G.vd->camera==NULL || G.scene->camera==NULL) && OBACT->type==OB_CAMERA) {
- G.vd->camera= OBACT;
- handle_view3d_lock();
- }
- }
- if(G.vd->camera==0) {
- G.vd->camera= scene_find_camera(G.scene);
- handle_view3d_lock();
- }
-
- if(G.vd->camera && (G.vd->camera != act_cam_orig)) {
- G.vd->persp= 2;
- G.vd->view= 0;
-
- if(((G.qual & LR_CTRLKEY) && (G.qual & LR_ALTKEY)) || (G.qual & LR_SHIFTKEY)) {
- void setcameratoview3d(void); // view.c
- setcameratoview3d();
- DAG_object_flush_update(G.scene, G.scene->camera, OB_RECALC_OB);
- BIF_undo_push("View to Camera position");
- allqueue(REDRAWVIEW3D, 0);
-
- } else if (U.smooth_viewtx) {
- /* move 3d view to camera view */
- float orig_lens = G.vd->lens;
- VECCOPY(orig_ofs, G.vd->ofs);
-
- if (act_cam_orig)
- view_settings_from_ob(act_cam_orig, G.vd->ofs, G.vd->viewquat, &G.vd->dist, &G.vd->lens);
-
- smooth_view_to_camera(G.vd);
- VECCOPY(G.vd->ofs, orig_ofs);
- G.vd->lens = orig_lens;
- }
-
-
- }
- }
- else if(event==PAD9) {
- countall();
- update_for_newframe();
-
- reset_slowparents(); /* editobject.c */
- }
- else if(G.vd->persp<2) {
- if(event==PAD4 || event==PAD6) {
- /* z-axis */
- phi= (float)(M_PI/360.0)*U.pad_rot_angle;
- if(event==PAD6) phi= -phi;
- si= (float)sin(phi);
- q1[0]= (float)cos(phi);
- q1[1]= q1[2]= 0.0;
- q1[3]= si;
- QuatMul(G.vd->viewquat, G.vd->viewquat, q1);
- G.vd->view= 0;
- }
- if(event==PAD2 || event==PAD8) {
- /* horizontal axis */
- VECCOPY(q1+1, G.vd->viewinv[0]);
-
- Normalize(q1+1);
- phi= (float)(M_PI/360.0)*U.pad_rot_angle;
- if(event==PAD2) phi= -phi;
- si= (float)sin(phi);
- q1[0]= (float)cos(phi);
- q1[1]*= si;
- q1[2]*= si;
- q1[3]*= si;
- QuatMul(G.vd->viewquat, G.vd->viewquat, q1);
- G.vd->view= 0;
- }
- }
-
- if(G.vd->persp<2) perspo= G.vd->persp;
- }
-
- if(G.vd->depths) G.vd->depths->damaged= 1;
- retopo_queue_updates(G.vd);
-
- if(preview3d_event)
- BIF_view3d_previewrender_signal(curarea, PR_DBASE|PR_DISPRECT);
- else
- BIF_view3d_previewrender_signal(curarea, PR_PROJECTED);
-
- scrarea_queue_redraw(curarea);
-}
-
-int untitled(char * name)
-{
- if (G.save_over == 0 ) {
- char * c= BLI_last_slash(name);
-
- if (c)
- strcpy(&c[1], "untitled.blend");
- else
- strcpy(name, "untitled.blend");
-
- return(TRUE);
- }
-
- return(FALSE);
-}
-
-char *recent_filelist(void)
-{
- struct RecentFile *recent;
- int event, i, ofs;
- char pup[2048], *p;
-
- p= pup + sprintf(pup, "Open Recent%%t");
-
- if (G.sce[0]) {
- p+= sprintf(p, "|%s %%x%d", G.sce, 1);
- ofs = 1;
- } else ofs = 0;
-
- for (recent = G.recent_files.first, i=0; (i<U.recent_files) && (recent); recent = recent->next, i++) {
- if (strcmp(recent->filename, G.sce)) {
- p+= sprintf(p, "|%s %%x%d", recent->filename, i+ofs+1);
- }
- }
- event= pupmenu(pup);
- if(event>0) {
- if (ofs && (event==1))
- return(G.sce);
- else
- recent = BLI_findlink(&(G.recent_files), event-1-ofs);
- if(recent) return(recent->filename);
- }
-
- return(NULL);
-}
-
-int blenderqread(unsigned short event, short val)
-{
- /* here do the general keys handling (not screen/window/space) */
- /* return 0: do not pass on to the other queues */
- extern int textediting;
- extern void playback_anim();
- ScrArea *sa;
- Object *ob;
- int textspace=0;
- /* Changed str and dir size to 160, to make sure there is enough
- * space for filenames. */
- char dir[FILE_MAXDIR * 2], str[FILE_MAXFILE * 2];
- char *recentfile;
-
- if(val==0) return 1;
- if(event==MOUSEY || event==MOUSEX) return 1;
- if (G.flags & G_FILE_AUTOPLAY) return 1;
-
- if (curarea && curarea->spacetype==SPACE_TEXT) textspace= 1;
- else if (curarea && curarea->spacetype==SPACE_SCRIPT) textspace= 1;
-
- switch(event) {
-
- case F1KEY:
- if(G.qual==0) {
- /* this exception because of the '?' button */
- if(curarea->spacetype==SPACE_INFO) {
- sa= closest_bigger_area();
- areawinset(sa->win);
- }
-
- activate_fileselect(FILE_BLENDER, "Open File", G.sce, BIF_read_file);
- return 0;
- }
- else if(G.qual==LR_SHIFTKEY) {
- activate_fileselect(FILE_LOADLIB, "Load Library", G.lib, 0);
- return 0;
- }
- else if(G.qual==LR_CTRLKEY) {
- activate_imageselect(FILE_LOADLIB, "Load Library", G.lib, 0);
- return 0;
- }
- break;
- case F2KEY:
- if(G.qual==0) {
- strcpy(dir, G.sce);
- untitled(dir);
- activate_fileselect(FILE_BLENDER, "Save File", dir, BIF_write_file);
- return 0;
- }
- else if(G.qual==LR_CTRLKEY) {
- write_vrml_fs();
- return 0;
- }
- else if(G.qual==LR_SHIFTKEY) {
- write_dxf_fs();
- return 0;
- }
- break;
- case F3KEY:
- if(G.qual==0) {
- BIF_save_rendered_image_fs();
- return 0;
- }
- else if(G.qual==LR_SHIFTKEY) {
- newspace(curarea, SPACE_NODE);
- return 0;
- }
- else if(G.qual & LR_CTRLKEY) {
- BIF_screendump(0);
- }
- break;
- case F4KEY:
- if(G.qual==LR_SHIFTKEY) {
-
- memset(str, 0, 16);
- ob= OBACT;
- if(ob) strcpy(str, ob->id.name);
-
- activate_fileselect(FILE_MAIN, "Data Select", str, NULL);
- return 0;
- }
- else if(G.qual==LR_CTRLKEY) {
-
- memset(str, 0, 16);
- ob= OBACT;
- if(ob) strcpy(str, ob->id.name);
-
- activate_imageselect(FILE_MAIN, "Data Select", str, 0);
- return 0;
- }
- else if(G.qual==0) {
- extern_set_butspace(event, 1);
- }
- break;
- case F5KEY:
- if(G.qual==LR_SHIFTKEY) {
- newspace(curarea, SPACE_VIEW3D);
- return 0;
- }
- else if(G.qual==0) {
- extern_set_butspace(event, 1);
- }
- break;
- case F6KEY:
- if(G.qual==LR_SHIFTKEY) {
- newspace(curarea, SPACE_IPO);
- return 0;
- }
- else if(G.qual==0) {
- extern_set_butspace(event, 1);
- }
- break;
- case F7KEY:
- if(G.qual==LR_SHIFTKEY) {
- newspace(curarea, SPACE_BUTS);
- return 0;
- }
- else if(G.qual==0) {
- extern_set_butspace(event, 1);
- }
- break;
- case F8KEY:
- if(G.qual==LR_SHIFTKEY) {
- newspace(curarea, SPACE_SEQ);
- return 0;
- }
- else if(G.qual==0) {
- extern_set_butspace(event, 1);
- }
- break;
- case F9KEY:
- if(G.qual==LR_SHIFTKEY) {
- newspace(curarea, SPACE_OOPS);
- return 0;
- }
- else if(G.qual==(LR_SHIFTKEY|LR_ALTKEY)) {
- newspace(curarea, SPACE_OOPS+256);
- return 0;
- }
- else if(G.qual==0) {
- extern_set_butspace(event, 1);
- }
- break;
- case F10KEY:
- if(G.qual==LR_SHIFTKEY) {
- newspace(curarea, SPACE_IMAGE);
- return 0;
- }
- else if(G.qual==0) {
- extern_set_butspace(event, 1);
- }
- break;
- case F11KEY:
- if(G.qual==LR_SHIFTKEY) {
- newspace(curarea, SPACE_TEXT);
- return 0;
- }
- else if (G.qual==LR_CTRLKEY) {
- playback_anim();
- }
- else if(G.qual==0) {
- BIF_toggle_render_display();
- return 0;
- }
- break;
- case F12KEY:
- if(G.qual==LR_SHIFTKEY) {
- newspace(curarea, SPACE_ACTION);
- return 0;
- }
- else if (G.qual==(LR_SHIFTKEY|LR_CTRLKEY)) {
- newspace(curarea, SPACE_NLA);
- return 0;
- }
- else if (G.qual==LR_CTRLKEY) {
- BIF_do_render(1);
- }
- else {
- /* ctrl/alt + f12 should render too, for some macs have f12 assigned to cd eject */
- BIF_do_render(0);
- }
- return 0;
- break;
-
- case WHEELUPMOUSE:
- if(G.qual==LR_ALTKEY || G.qual==LR_COMMANDKEY) {
- if(CFRA>1) {
- CFRA--;
- update_for_newframe();
- }
- return 0;
- }
- break;
- case WHEELDOWNMOUSE:
- if(G.qual==LR_ALTKEY || G.qual==LR_COMMANDKEY) {
- CFRA++;
- update_for_newframe();
- return 0;
- }
- break;
-
- case LEFTARROWKEY:
- case DOWNARROWKEY:
- if(textediting==0 && textspace==0) {
-
-#if 0
-//#ifdef _WIN32 // FULLSCREEN
- if(event==DOWNARROWKEY){
- if (G.qual==LR_ALTKEY)
- mainwindow_toggle_fullscreen(0);
- else if(G.qual==0)
- CFRA-= G.scene->jumpframe;
- }
-#else
- if((event==DOWNARROWKEY)&&(G.qual==0))
- CFRA-= G.scene->jumpframe;
-#endif
- else if((event==LEFTARROWKEY)&&(G.qual==0))
- CFRA--;
-
- if(G.qual==LR_SHIFTKEY)
- CFRA= PSFRA;
- if(CFRA<1) CFRA=1;
-
- update_for_newframe();
- return 0;
- }
- break;
-
- case RIGHTARROWKEY:
- case UPARROWKEY:
- if(textediting==0 && textspace==0) {
-
-#if 0
-//#ifdef _WIN32 // FULLSCREEN
- if(event==UPARROWKEY){
- if(G.qual==LR_ALTKEY)
- mainwindow_toggle_fullscreen(1);
- else if(G.qual==0)
- CFRA+= G.scene->jumpframe;
- }
-#else
- if((event==UPARROWKEY)&&(G.qual==0))
- CFRA+= G.scene->jumpframe;
-#endif
- else if((event==RIGHTARROWKEY)&&(G.qual==0))
- CFRA++;
-
- if(G.qual==LR_SHIFTKEY)
- CFRA= PEFRA;
-
- update_for_newframe();
- }
- break;
-
- case ESCKEY:
- sound_stop_all_sounds(); // whats this?
-
- /* stop playback on ESC always */
- rem_screenhandler(G.curscreen, SCREEN_HANDLER_ANIM);
- audiostream_stop();
- allqueue(REDRAWALL, 0);
-
- break;
- case TABKEY:
- if(G.qual==0) {
- if(textspace==0) {
- if(curarea->spacetype==SPACE_IPO)
- set_editflag_editipo();
- else if(curarea->spacetype==SPACE_SEQ)
- enter_meta();
- else if(curarea->spacetype==SPACE_NODE)
- return 1;
- else if(G.vd) {
- /* also when Alt-E */
- if(G.obedit==NULL) {
- enter_editmode(EM_WAITCURSOR);
- if(G.obedit) BIF_undo_push("Original"); // here, because all over code enter_editmode is abused
- }
- else
- exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); // freedata, and undo
- }
- return 0;
- }
- }
- else if(G.qual==LR_CTRLKEY){
- Object *ob= OBACT;
- if(ob) {
- if(ob->type==OB_ARMATURE) {
- if(ob->flag & OB_POSEMODE) exit_posemode();
- else enter_posemode();
- }
- else if(ob->type==OB_MESH) {
- if(ob==G.obedit) EM_selectmode_menu();
- else if(G.f & G_PARTICLEEDIT)
- PE_selectbrush_menu();
- else if(G.f & G_SCULPTMODE)
- sculptmode_selectbrush_menu();
- else set_wpaint();
- }
- }
- }
- else if(G.qual&LR_CTRLKEY && G.qual&LR_SHIFTKEY){
- PE_set_particle_edit();
- }
- break;
-
- case BACKSPACEKEY:
- break;
-
- case AKEY:
- if(textediting==0 && textspace==0) {
- if ((G.qual==LR_ALTKEY) && (curarea && curarea->spacetype==SPACE_VIEW3D)) {
- play_anim(0);
- return 0;
- }
- else if ((G.qual==LR_ALTKEY) || (G.qual==(LR_ALTKEY|LR_SHIFTKEY))){
- play_anim(1);
- return 0;
- }
- }
- break;
- case EKEY:
- if(G.qual==LR_ALTKEY) {
- if(G.vd && textspace==0) {
- if(G.obedit==0) {
- enter_editmode(EM_WAITCURSOR);
- BIF_undo_push("Original");
- }
- else
- exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); // freedata, and undo
- return 0;
- }
- }
- break;
- case IKEY:
- if(textediting==0 && textspace==0 && !ELEM3(curarea->spacetype, SPACE_FILE, SPACE_IMASEL, SPACE_NODE)) {
- if(G.f & G_SCULPTMODE) return 1;
- else if(G.qual==0) {
- common_insertkey();
- return 0;
- }
- }
- break;
- case JKEY:
- if(textediting==0 && textspace==0) {
- if (G.qual==0) {
- BIF_swap_render_rects();
- return 0;
- }
- }
- break;
-
- case NKEY:
- if(textediting==0 && textspace==0) {
- if(G.qual & LR_CTRLKEY);
- else if(G.qual==0 || (G.qual & LR_SHIFTKEY)) {
- if(curarea->spacetype==SPACE_VIEW3D); // is new panel, in view3d queue
- else if(curarea->spacetype==SPACE_IPO); // is new panel, in ipo queue
- else if(curarea->spacetype==SPACE_IMAGE); // is new panel, in ipo queue
- else if(curarea->spacetype==SPACE_ACTION); // is own queue
- else if(curarea->spacetype==SPACE_NLA); // is new panel
- else if(curarea->spacetype==SPACE_SEQ); // is new panel
- else {
- clever_numbuts();
- return 0;
- }
- }
- }
- break;
-
- case OKEY:
- if(textediting==0) {
- if(G.qual==LR_CTRLKEY) {
- recentfile = recent_filelist();
- if(recentfile) {
- BIF_read_file(recentfile);
- }
- return 0;
- }
- }
- break;
-
- case SKEY:
- if(G.obedit==NULL) {
- if(G.qual==LR_CTRLKEY) {
- strcpy(dir, G.sce);
- if (untitled(dir)) {
- activate_fileselect(FILE_BLENDER, "Save File", dir, BIF_write_file);
- } else {
- BIF_write_file(dir);
- free_filesel_spec(dir);
- }
- return 0;
- }
- }
- break;
-
- case TKEY:
- if (G.qual==(LR_SHIFTKEY|LR_ALTKEY|LR_CTRLKEY)) {
- Object *ob = OBACT;
- int event = pupmenu(ob?"Time%t|draw|recalc ob|recalc data":"Time%t|draw");
- int a;
- double delta, stime;
-
- if (event < 0) return 0; /* cancelled by user */
-
- waitcursor(1);
-
- stime= PIL_check_seconds_timer();
- for(a=0; a<100000; a++) {
- if (event==1) {
- scrarea_do_windraw(curarea);
- } else if (event==2) {
- ob->recalc |= OB_RECALC_OB;
- object_handle_update(ob);
- } else if (event==3) {
- ob->recalc |= OB_RECALC_DATA;
- object_handle_update(ob);
- }
-
- delta= PIL_check_seconds_timer()-stime;
- if (delta>5.0) break;
- }
-
- waitcursor(0);
- notice("%8.6f s/op - %6.2f ops/s - %d iterations", delta/a, a/delta, a);
- return 0;
- }
- else if(G.qual==(LR_ALTKEY|LR_CTRLKEY)) {
- int a;
- int event= pupmenu("10 Timer%t|draw|draw+swap|undo");
- if(event>0) {
- double stime= PIL_check_seconds_timer();
- char tmpstr[128];
- int time;
-
- waitcursor(1);
-
- for(a=0; a<10; a++) {
- if (event==1) {
- scrarea_do_windraw(curarea);
- } else if (event==2) {
- scrarea_do_windraw(curarea);
- screen_swapbuffers();
- }
- else if(event==3) {
- BIF_undo();
- BIF_redo();
- }
- }
-
- time= (int) ((PIL_check_seconds_timer()-stime)*1000);
-
- if(event==1) sprintf(tmpstr, "draw %%t|%d ms", time);
- if(event==2) sprintf(tmpstr, "d+sw %%t|%d ms", time);
- if(event==3) sprintf(tmpstr, "undo %%t|%d ms", time);
-
- waitcursor(0);
- pupmenu(tmpstr);
-
- }
- return 0;
- }
- break;
-
- case UKEY:
- if(textediting==0) {
- if(G.qual==LR_CTRLKEY) {
- if(okee("Save user defaults")) {
- BIF_write_homefile();
- }
- return 0;
- }
- else if(G.qual==LR_ALTKEY) {
- if(curarea->spacetype!=SPACE_TEXT) {
- BIF_undo_menu();
- return 0;
- }
- }
- }
- break;
-
- case WKEY:
- if(textediting==0) {
- if(G.qual==LR_CTRLKEY) {
- strcpy(dir, G.sce);
- if (untitled(dir)) {
- activate_fileselect(FILE_BLENDER, "Save File", dir, BIF_write_file);
- } else {
- BIF_write_file(dir);
- free_filesel_spec(dir);
- }
- return 0;
- }
- /* Python specials? ;)
- else if(G.qual==LR_ALTKEY) {
- write_videoscape_fs();
- return 0;
- }*/
- }
- break;
-
- case XKEY:
- if(textspace==0 && textediting==0) {
- if(G.qual==LR_CTRLKEY) {
- if(okee("Erase all")) {
- if( BIF_read_homefile(0)==0) error("No file ~/.B.blend");
-
- /* Reset lights
- * This isn't done when reading userdef, do it now
- * */
- default_gl_light();
- }
- return 0;
- }
- }
- break;
- case YKEY: // redo alternative
- if(textspace==0) {
- if(G.qual==LR_CTRLKEY) {
- BIF_redo();
- return 0;
- }
- }
- break;
- case ZKEY: // undo
- if(textspace==0) {
- if(G.qual & (LR_CTRLKEY|LR_COMMANDKEY)) { // all combos with ctrl/commandkey are accepted
- if ELEM(G.qual, LR_CTRLKEY, LR_COMMANDKEY) BIF_undo();
- else BIF_redo(); // all combos with ctrl is redo
- return 0;
- }
- }
- break;
- }
-
- return 1;
-}
-
-/* eof */
diff --git a/source/blender/src/toolbox.c b/source/blender/src/toolbox.c
deleted file mode 100644
index 969b9d4657b..00000000000
--- a/source/blender/src/toolbox.c
+++ /dev/null
@@ -1,2245 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#define PY_TOOLBOX 1
-
-#include <math.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef WIN32
-#include <unistd.h>
-#else
-#include <io.h>
-#endif
-
-#include <fcntl.h>
-#include "MEM_guardedalloc.h"
-
-#include "BMF_Api.h"
-#include "BIF_language.h"
-#include "BIF_resources.h"
-
-#include "DNA_group_types.h"
-#include "DNA_image_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_node_types.h"
-#include "DNA_object_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_camera_types.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "BKE_displist.h"
-#include "BKE_depsgraph.h"
-#include "BKE_global.h"
-#include "BKE_image.h"
-#include "BKE_library.h"
-#include "BKE_mesh.h"
-#include "BKE_node.h"
-#include "BKE_main.h"
-#include "BKE_plugin_types.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_editnla.h"
-#include "BIF_editarmature.h"
-#include "BIF_editdeform.h"
-#include "BIF_editfont.h"
-#include "BIF_editmesh.h"
-#include "BIF_editseq.h"
-#include "BIF_editlattice.h"
-#include "BIF_editsima.h"
-#include "BIF_editoops.h"
-#include "BIF_editview.h"
-#include "BIF_gl.h"
-#include "BIF_graphics.h"
-#include "BIF_imasel.h"
-#include "BIF_interface.h"
-#include "BIF_mainqueue.h"
-#include "BIF_mywindow.h"
-#include "BIF_renderwin.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-#include "BIF_tbcallback.h"
-#include "BIF_transform.h"
-
-#include "BDR_editobject.h"
-#include "BDR_editcurve.h"
-#include "BDR_editmball.h"
-
-#include "BSE_drawipo.h"
-#include "BSE_edit.h"
-#include "BSE_editipo.h"
-#include "BSE_filesel.h"
-#include "BSE_headerbuttons.h"
-#include "BSE_node.h"
-
-#include "IMB_imbuf.h"
-
-#include "blendef.h"
-#include "butspace.h"
-#include "mydevice.h"
-
-/* bpymenu */
-#include "BPY_extern.h"
-#include "BPY_menus.h"
-
-void asciitoraw(int ch, unsigned short *event, unsigned short *qual)
-{
- if( isalpha(ch)==0 ) return;
-
- if( isupper(ch) ) {
- *qual= LEFTSHIFTKEY;
- ch= tolower(ch);
- }
-
- switch(ch) {
- case 'a': *event= AKEY; break;
- case 'b': *event= BKEY; break;
- case 'c': *event= CKEY; break;
- case 'd': *event= DKEY; break;
- case 'e': *event= EKEY; break;
- case 'f': *event= FKEY; break;
- case 'g': *event= GKEY; break;
- case 'h': *event= HKEY; break;
- case 'i': *event= IKEY; break;
- case 'j': *event= JKEY; break;
- case 'k': *event= KKEY; break;
- case 'l': *event= LKEY; break;
- case 'm': *event= MKEY; break;
- case 'n': *event= NKEY; break;
- case 'o': *event= OKEY; break;
- case 'p': *event= PKEY; break;
- case 'q': *event= QKEY; break;
- case 'r': *event= RKEY; break;
- case 's': *event= SKEY; break;
- case 't': *event= TKEY; break;
- case 'u': *event= UKEY; break;
- case 'v': *event= VKEY; break;
- case 'w': *event= WKEY; break;
- case 'x': *event= XKEY; break;
- case 'y': *event= YKEY; break;
- case 'z': *event= ZKEY; break;
- }
-}
-
-/* ************************************ */
-
-/* this va_ stuff allows printf() style codes in these menus */
-
-static int vconfirm(char *title, char *itemfmt, va_list ap)
-{
- char *s, buf[512];
-
- s= buf;
- if (title) s+= sprintf(s, "%s%%t|", title);
- vsprintf(s, itemfmt, ap);
-
- return (pupmenu(buf)>=0);
-}
-
-static int confirm(char *title, char *itemfmt, ...)
-{
- va_list ap;
- int ret;
-
- va_start(ap, itemfmt);
- ret= vconfirm(title, itemfmt, ap);
- va_end(ap);
-
- return ret;
-}
-
-int okee(char *str, ...)
-{
- va_list ap;
- int ret;
- char titlestr[256];
-
- sprintf(titlestr, "OK? %%i%d", ICON_HELP);
-
- va_start(ap, str);
- ret= vconfirm(titlestr, str, ap);
- va_end(ap);
-
- return ret;
-}
-
-void notice(char *str, ...)
-{
- va_list ap;
-
- va_start(ap, str);
- vconfirm(NULL, str, ap);
- va_end(ap);
-}
-
-void error(char *fmt, ...)
-{
- va_list ap;
- char nfmt[256];
- char titlestr[256];
-
- sprintf(titlestr, "Error %%i%d", ICON_ERROR);
-
- sprintf(nfmt, "%s", fmt);
-
- va_start(ap, fmt);
- if (G.background || !G.curscreen) {
- vprintf(nfmt, ap);
- printf("\n");
- } else {
- vconfirm(titlestr, nfmt, ap);
- }
- va_end(ap);
-}
-
-void error_libdata(void)
-{
- error(ERROR_LIBDATA_MESSAGE);
-}
-
-int saveover(char *file)
-{
- int len= strlen(file);
-
- if(len==0)
- return 0;
-
- if(BLI_exists(file)==0)
- return 1;
-
- if( file[len-1]=='/' || file[len-1]=='\\' ) {
- error("Cannot overwrite a directory");
- return 0;
- }
-
- return confirm("Save over", file);
-}
-
-/* ****************** EXTRA STUFF **************** */
-
-short button(short *var, short min, short max, char *str)
-{
- uiBlock *block;
- ListBase listb={0, 0};
- short x1,y1;
- short mval[2], ret=0;
-
- if(min>max) min= max;
-
- getmouseco_sc(mval);
-
- if(mval[0]<150) mval[0]=150;
- if(mval[1]<30) mval[1]=30;
- if(mval[0]>G.curscreen->sizex) mval[0]= G.curscreen->sizex-10;
- if(mval[1]>G.curscreen->sizey) mval[1]= G.curscreen->sizey-10;
-
- block= uiNewBlock(&listb, "button", UI_EMBOSS, UI_HELV, G.curscreen->mainwin);
- uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_RET_1|UI_BLOCK_ENTER_OK);
-
- x1=mval[0]-150;
- y1=mval[1]-20;
-
- uiDefButS(block, NUM, 0, str, (short)(x1+5),(short)(y1+10),125,20, var,(float)min,(float)max, 0, 0, "");
- uiDefBut(block, BUT, 32767, "OK", (short)(x1+136),(short)(y1+10),25,20, NULL, 0, 0, 0, 0, "");
-
- uiBoundsBlock(block, 5);
-
- ret= uiDoBlocks(&listb, 0, 0);
-
- if(ret==UI_RETURN_OK) return 1;
- return 0;
-}
-
-short sbutton(char *var, float min, float max, char *str)
-{
- uiBlock *block;
- ListBase listb={0, 0};
- short x1,y1;
- short mval[2], ret=0;
-
- if(min>max) min= max;
-
- getmouseco_sc(mval);
-
- if(mval[0]<250) mval[0]=250;
- if(mval[1]<30) mval[1]=30;
- if(mval[0]>G.curscreen->sizex) mval[0]= G.curscreen->sizex-10;
- if(mval[1]>G.curscreen->sizey) mval[1]= G.curscreen->sizey-10;
-
- block= uiNewBlock(&listb, "button", UI_EMBOSS, UI_HELV, G.curscreen->mainwin);
- uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_RET_1|UI_BLOCK_ENTER_OK);
-
- x1=mval[0]-250;
- y1=mval[1]-20;
-
- uiDefButC(block, TEX, 32766, str, x1+5,y1+10,225,20, var,(float)min,(float)max, 0, 0, "");
- uiDefBut(block, BUT, 32767, "OK", x1+236,y1+10,25,20, NULL, 0, 0, 0, 0, "");
-
- uiBoundsBlock(block, 5);
-
- mainqenter_ext(BUT_ACTIVATE, 32766, 0); /* note, button id '32766' is asking for errors some day! */
- ret= uiDoBlocks(&listb, 0, 0);
-
- if(ret==UI_RETURN_OK) return 1;
- return 0;
-
-}
-
-short fbutton(float *var, float min, float max, float a1, float a2, char *str)
-{
- uiBlock *block;
- ListBase listb={0, 0};
- short x1,y1;
- short mval[2], ret=0;
-
- if(min>max) min= max;
-
- getmouseco_sc(mval);
-
- if(mval[0]<150) mval[0]=150;
- if(mval[1]<30) mval[1]=30;
- if(mval[0]>G.curscreen->sizex) mval[0]= G.curscreen->sizex-10;
- if(mval[1]>G.curscreen->sizey) mval[1]= G.curscreen->sizey-10;
-
- block= uiNewBlock(&listb, "button", UI_EMBOSS, UI_HELV, G.curscreen->mainwin);
- uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_RET_1);
-
- x1=mval[0]-150;
- y1=mval[1]-20;
-
- uiDefButF(block, NUM, 0, str,(short)(x1+5),(short)(y1+10),125,20, var, min, max, a1, a2, "");
- uiDefBut(block, BUT, 32767, "OK",(short)(x1+136),(short)(y1+10), 35, 20, NULL, 0, 0, 0, 0, "");
-
- uiBoundsBlock(block, 2);
-
- ret= uiDoBlocks(&listb, 0, 0);
-
- if(ret==UI_RETURN_OK) return 1;
- return 0;
-}
-
-int movetolayer_buts(unsigned int *lay, char *title)
-{
- uiBlock *block;
- ListBase listb={0, 0};
- int dx, dy, a, x1, y1, sizex=160, sizey=30;
- short pivot[2], mval[2], ret=0;
-
- if(G.vd->localview) {
- error("Not in localview ");
- return ret;
- }
-
- getmouseco_sc(mval);
-
- pivot[0]= CLAMPIS(mval[0], (sizex+10), G.curscreen->sizex-30);
- pivot[1]= CLAMPIS(mval[1], (sizey/2)+10, G.curscreen->sizey-(sizey/2)-10);
-
- if (pivot[0]!=mval[0] || pivot[1]!=mval[1])
- warp_pointer(pivot[0], pivot[1]);
-
- mywinset(G.curscreen->mainwin);
-
- x1= pivot[0]-sizex+10;
- y1= pivot[1]-sizey/2;
-
- block= uiNewBlock(&listb, "button", UI_EMBOSS, UI_HELV, G.curscreen->mainwin);
- uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_NUMSELECT|UI_BLOCK_ENTER_OK);
-
- dx= (sizex-5)/12;
- dy= sizey/2;
-
- if(title)
- uiDefBut(block, LABEL, 0, title, (short)(x1), (short)y1+30, sizex, 20, NULL, 1, 0, 0, 0, "");
-
- /* buttons have 0 as return event, to prevent menu to close on hotkeys */
- uiBlockBeginAlign(block);
- for(a=0; a<5; a++)
- uiDefButBitI(block, TOGR, 1<<a, 0, "",(short)(x1+a*dx),(short)(y1+dy),(short)dx,(short)dy, (int *)lay, 0, 0, 0, 0, "");
- for(a=0; a<5; a++)
- uiDefButBitI(block, TOGR, 1<<(a+10), 0, "",(short)(x1+a*dx),(short)y1,(short)dx,(short)dy, (int *)lay, 0, 0, 0, 0, "");
- x1+= 5;
-
- uiBlockBeginAlign(block);
- for(a=5; a<10; a++)
- uiDefButBitI(block, TOGR, 1<<a, 0, "",(short)(x1+a*dx),(short)(y1+dy),(short)dx,(short)dy, (int *)lay, 0, 0, 0, 0, "");
- for(a=5; a<10; a++)
- uiDefButBitI(block, TOGR, 1<<(a+10), 0, "",(short)(x1+a*dx),(short)y1,(short)dx,(short)dy, (int *)lay, 0, 0, 0, 0, "");
- uiBlockEndAlign(block);
-
- x1-= 5;
- uiDefBut(block, BUT, 32767, "OK", (short)(x1+10*dx+10), (short)y1, (short)(3*dx), (short)(2*dy), NULL, 0, 0, 0, 0, "");
-
- uiBoundsBlock(block, 2);
-
- ret= uiDoBlocks(&listb, 0, 0);
-
- if(ret==UI_RETURN_OK) return 1;
- return 0;
-}
-
-/* armature or bone */
-int movetolayer_short_buts(short *lay, char *title)
-{
- uiBlock *block;
- ListBase listb={0, 0};
- int dx, dy, a, x1, y1, sizex=120, sizey=30;
- short pivot[2], mval[2], ret=0;
-
- getmouseco_sc(mval);
-
- pivot[0]= CLAMPIS(mval[0], (sizex+10), G.curscreen->sizex-30);
- pivot[1]= CLAMPIS(mval[1], (sizey/2)+10, G.curscreen->sizey-(sizey/2)-10);
-
- if (pivot[0]!=mval[0] || pivot[1]!=mval[1])
- warp_pointer(pivot[0], pivot[1]);
-
- mywinset(G.curscreen->mainwin);
-
- x1= pivot[0]-sizex+10;
- y1= pivot[1]-sizey/2;
-
- block= uiNewBlock(&listb, "button", UI_EMBOSS, UI_HELV, G.curscreen->mainwin);
- uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_NUMSELECT|UI_BLOCK_ENTER_OK);
-
- dx= (sizex-5)/10;
- dy= sizey/2;
-
- if(title)
- uiDefBut(block, LABEL, 0, title, (short)(x1), (short)y1+30, sizex, 20, NULL, 1, 0, 0, 0, "");
-
- /* buttons have 0 as return event, to prevent menu to close on hotkeys */
- uiBlockBeginAlign(block);
- for(a=0; a<8; a++)
- uiDefButBitS(block, TOGR, 1<<a, 0, "",(short)(x1+a*dx),(short)(y1+dy),(short)dx,(short)dy, lay, 0, 0, 0, 0, "");
- for(a=0; a<8; a++)
- uiDefButBitS(block, TOGR, 1<<(a+8), 0, "",(short)(x1+a*dx),(short)y1,(short)dx,(short)dy, lay, 0, 0, 0, 0, "");
-
- uiBlockEndAlign(block);
-
- x1-= 5;
- uiDefBut(block, BUT, 32767, "OK", (short)(x1+8*dx+10), (short)y1, (short)(3*dx), (short)(2*dy), NULL, 0, 0, 0, 0, "");
-
- uiBoundsBlock(block, 2);
-
- ret= uiDoBlocks(&listb, 0, 0);
-
- if(ret==UI_RETURN_OK) return 1;
- return 0;
-}
-
-
-/* ********************** CLEVER_NUMBUTS ******************** */
-
-#define MAXNUMBUTS 120
-#define MAXNUMBUTROWS 8
-
-VarStruct numbuts[MAXNUMBUTS];
-void *numbpoin[MAXNUMBUTS];
-int numbdata[MAXNUMBUTS];
-
-void draw_numbuts_tip(char *str, int x1, int y1, int x2, int y2)
-{
- static char *last=0; /* avoid ugly updates! */
- int temp;
-
- if(str==last) return;
- last= str;
- if(str==0) return;
-
- glColor3ub(160, 160, 160); /* MGREY */
- glRecti(x1+4, y2-36, x2-4, y2-16);
-
- cpack(0x0);
-
- temp= 0;
- while( BIF_GetStringWidth(G.fonts, str+temp, (U.transopts & USER_TR_BUTTONS))>(x2 - x1-24)) temp++;
- glRasterPos2i(x1+16, y2-30);
- BIF_DrawString(G.fonts, str+temp, (U.transopts & USER_TR_BUTTONS));
-}
-
-int do_clever_numbuts(char *name, int tot, int winevent)
-{
- ListBase listb= {NULL, NULL};
- uiBlock *block;
- VarStruct *varstr;
- int a, sizex, sizey, x1, y2, width, colunms=1, xi=0, yi=0;
- short mval[2], event;
-
- /* Clear all events so tooltips work, this is not ideal and
- only needed because calls from the menu still have some events
- left over when do_clever_numbuts is called.
- Calls from keyshortcuts do not have this problem.*/
- ScrArea *sa;
- BWinEvent temp_bevt;
- for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- if(sa->win) {
- while( bwin_qread( sa->win, &temp_bevt ) ) {}
- }
- if(sa->headwin) {
- while( bwin_qread( sa->headwin, &temp_bevt ) ) {}
- }
- }
- /* Done clearing events */
-
- if(tot<=0 || tot>MAXNUMBUTS) return 0;
-
- /* if we have too many buttons then have more then 1 column */
- colunms= (int)ceil((double)tot / (double)MAXNUMBUTROWS);
-
- getmouseco_sc(mval);
-
- /* size */
- sizex= 175;
- sizey= 30+20*(MIN2(MAXNUMBUTROWS, tot)+1);
- width= (sizex*colunms)+60;
-
- /* center */
- if(mval[0]<width/2) mval[0]=width/2;
- if(mval[1]<sizey/2) mval[1]=sizey/2;
- if(mval[0]>G.curscreen->sizex -width/2) mval[0]= G.curscreen->sizex -width/2;
- if(mval[1]>G.curscreen->sizey -sizey/2) mval[1]= G.curscreen->sizey -sizey/2;
-
- mywinset(G.curscreen->mainwin);
-
- x1= mval[0]-width/2;
- y2= mval[1]+sizey/2;
-
- block= uiNewBlock(&listb, "numbuts", UI_EMBOSS, UI_HELV, G.curscreen->mainwin);
- uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_RET_1|UI_BLOCK_ENTER_OK);
-
- /* WATCH IT: TEX BUTTON EXCEPTION */
- /* WARNING: ONLY A SINGLE BIT-BUTTON POSSIBLE: WE WORK AT COPIED DATA! */
-
- BIF_ThemeColor(TH_MENU_TEXT); /* makes text readable on dark theme */
-
- uiDefBut(block, LABEL, 0, name, (short)(x1+15), (short)(y2-35), (short)(width-60), 19, 0, 1.0, 0.0, 0, 0, "");
-
- /*
- if(name[0]=='A' && name[7]=='O') {
- y2 -= 20;
- uiDefBut(block, LABEL, 0, "Rotations in degrees!", (short)(x1+15), (short)(y2-35), (short)(sizex-60), 19, 0, 0.0, 0.0, 0, 0, "");
- }*/
-
- uiBlockBeginAlign(block);
- varstr= &numbuts[0];
- for(a=0; a<tot; a++, varstr++) {
-
- if(varstr->type==TEX) {
- uiDefBut(block, TEX, 0, varstr->name,(short)((x1+15) + (sizex*xi)),(short)(y2-55- 20*yi),(short)(sizex), 19, numbpoin[a], varstr->min, varstr->max, 0, 0, varstr->tip);
- } else if(varstr->type==COL) {
- uiDefButF(block, COL, 0, "",(short)((x1+15) + (sizex*xi)),(short)(y2-55- 20*yi),(short)(sizex), 19, numbpoin[a], varstr->min, varstr->max, 0, 0, "");
- } else {
- if(varstr->type==LABEL) {/* dont include the label when rounding the buttons */
- uiBlockEndAlign(block);
-
- /* using the tip for the name, this is incorrect lets us get around the 16 char limit of name */
- /* Changed from the line below to use the tip since the tip isnt used for a label */
- uiDefBut(block, varstr->type, 0, varstr->tip,(short)((x1+15) + (sizex*xi)),(short)(y2-55-20*yi), (short)(sizex), 19, &(numbdata[a]), varstr->min, varstr->max, 100, 0, "");
- } else {
- uiDefBut(block, varstr->type, 0, varstr->name,(short)((x1+15) + (sizex*xi)),(short)(y2-55-20*yi), (short)(sizex), 19, &(numbdata[a]), varstr->min, varstr->max, 100, 0, varstr->tip);
- }
-
- if(varstr->type==LABEL)
- uiBlockBeginAlign(block);
- }
-
- /* move to the next column */
- yi++;
- if (yi>=MAXNUMBUTROWS) {
- yi=0;
- xi++;
- uiBlockEndAlign(block);
- uiBlockBeginAlign(block);
- }
- }
- uiBlockEndAlign(block);
-
- uiDefBut(block, BUT, 4000, "OK", (short)(x1+width-40),(short)(y2-35-20*MIN2(MAXNUMBUTROWS,a)), 25, (short)(sizey-50), 0, 0, 0, 0, 0, "OK: Assign Values");
-
- uiBoundsBlock(block, 5);
-
- event= uiDoBlocks(&listb, 0, 0);
-
- areawinset(curarea->win);
-
- if(event & UI_RETURN_OK) {
-
- varstr= &numbuts[0];
- for(a=0; a<tot; a++, varstr++) {
- if(varstr->type==TEX);
- else if ELEM( (varstr->type & BUTPOIN), FLO, INT ) memcpy(numbpoin[a], numbdata+a, 4);
- else if((varstr->type & BUTPOIN)==SHO ) *((short *)(numbpoin[a]))= *( (short *)(numbdata+a));
- }
-
- if(winevent) {
- ScrArea *sa;
-
- sa= G.curscreen->areabase.first;
- while(sa) {
- if(sa->spacetype==curarea->spacetype) addqueue(sa->win, winevent, 1);
- sa= sa->next;
- }
- }
-
- return 1;
- }
- return 0;
-}
-
-void add_numbut(int nr, int type, char *str, float min, float max, void *poin, char *tip)
-{
- int tip_max = sizeof(numbuts[nr].tip);
- int name_max = sizeof(numbuts[nr].name);
-
- if(nr >= MAXNUMBUTS || (nr < 0)) return;
-
- numbuts[nr].type= type;
-
- numbuts[nr].min= min;
- numbuts[nr].max= max;
-
- if (type==LABEL) {
- /* evil use it tooltip for the label string to get around the 16 char limit of "name" */
- if (str) {
- strncpy(numbuts[nr].tip, str, tip_max);
- numbuts[nr].tip[tip_max-1] = 0;
- } else {
- strcpy(numbuts[nr].tip, "");
- }
- } else {
- /* for all other types */
- if (str) {
- strncpy(numbuts[nr].name, str, name_max);
- numbuts[nr].name[name_max-1] = 0;
- } else {
- strcpy(numbuts[nr].name, "");
- }
- if (tip) {
- strncpy(numbuts[nr].tip, tip, tip_max);
- numbuts[nr].tip[tip_max-1] = 0;
- } else {
- strcpy(numbuts[nr].tip, "");
- }
- }
-
- /*WATCH: TEX BUTTON EXCEPTION */
-
- numbpoin[nr]= poin;
-
- if ELEM( (type & BUTPOIN), FLO, INT ) memcpy(numbdata+nr, poin, 4);
- if((type & BUTPOIN)==SHO ) *((short *)(numbdata+nr))= *( (short *)poin);
-
- /* if( strncmp(numbuts[nr].name, "Rot", 3)==0 ) {
- float *fp;
-
- fp= (float *)(numbdata+nr);
- fp[0]= 180.0*fp[0]/M_PI;
- } */
-
-}
-
-void clever_numbuts(void)
-{
-
- if(curarea->spacetype==SPACE_VIEW3D) {
- // panel now
- }
- else if(curarea->spacetype==SPACE_NLA){
- // panel now
- }
- else if(curarea->spacetype==SPACE_IPO) {
- // panel now
- }
- else if(curarea->spacetype==SPACE_SEQ) {
- // panel now
- }
- else if(curarea->spacetype==SPACE_IMAGE) {
- // panel now
- }
- else if(curarea->spacetype==SPACE_IMASEL) {
- clever_numbuts_imasel();
- }
- else if(curarea->spacetype==SPACE_OOPS) {
- clever_numbuts_oops();
- }
- else if(curarea->spacetype==SPACE_ACTION){
- // in its own queue
- }
- else if(curarea->spacetype==SPACE_FILE) {
- clever_numbuts_filesel();
- }
-}
-
-
-void replace_names_but(void)
-{
- Image *ima= G.main->image.first;
- short len, tot=0;
- char old[64], new[64], temp[80];
-
- strcpy(old, "/");
- strcpy(new, "/");
-
- add_numbut(0, TEX, "Old:", 0, 63, old, 0);
- add_numbut(1, TEX, "New:", 0, 63, new, 0);
-
- if (do_clever_numbuts("Replace image name", 2, REDRAW) ) {
-
- len= strlen(old);
-
- while(ima) {
-
- if(strncmp(old, ima->name, len)==0) {
-
- strcpy(temp, new);
- strcat(temp, ima->name+len);
- BLI_strncpy(ima->name, temp, sizeof(ima->name));
-
- BKE_image_signal(ima, NULL, IMA_SIGNAL_FREE);
-
- tot++;
- }
-
- ima= ima->id.next;
- }
-
- notice("Replaced %d names", tot);
- }
-
-}
-
-
-/* ********************** NEW TOOLBOX ********************** */
-
-ListBase tb_listb= {NULL, NULL};
-
-#define TB_TAB 256
-#define TB_ALT 512
-#define TB_CTRL 1024
-#define TB_PAD 2048
-#define TB_SHIFT 4096
-
-typedef struct TBitem {
- int icon;
- char *name;
- int retval;
- void *poin;
-} TBitem;
-
-static void tb_do_hotkey(void *arg, int event)
-{
- unsigned short i, key=0;
- unsigned short qual[] = { 0,0,0,0 };
-
- if(event & TB_CTRL) {
- qual[0] = LEFTCTRLKEY;
- event &= ~TB_CTRL;
- }
- if(event & TB_ALT) {
- qual[1] = LEFTALTKEY;
- event &= ~TB_ALT;
- }
- if(event & TB_SHIFT) {
- qual[2] = LEFTSHIFTKEY;
- event &= ~TB_SHIFT;
- }
-
- if(event & TB_TAB) key= TABKEY;
- else if(event & TB_PAD) {
- event &= ~TB_PAD;
- switch(event) {
- case '-': key= PADMINUS; break;
- case '+': key= PADPLUSKEY; break;
- case '0': key= PAD0; break;
- case '5': key= PAD5; break;
- case '/': key= PADSLASHKEY; break;
- case '.': key= PADPERIOD; break;
- case '*': key= PADASTERKEY; break;
- case 'h': key= HOMEKEY; break;
- case 'u': key= PAGEUPKEY; break;
- case 'd': key= PAGEDOWNKEY; break;
- }
- }
- else asciitoraw(event, &key, &qual[3]);
-
- for (i=0;i<4;i++)
- {
- if(qual[i]) mainqenter(qual[i], 1);
- }
- mainqenter(key, 1);
- mainqenter(key, 0);
- mainqenter(EXECUTE, 1);
-
- for (i=0;i<4;i++)
- {
- if(qual[i]) mainqenter(qual[i], 0);
- }
-}
-
-/* *************Select ********** */
-
-static TBitem tb_object_select_layer1_5[]= {
-{ 0, "1", 1, NULL},
-{ 0, "2", 2, NULL},
-{ 0, "3", 3, NULL},
-{ 0, "4", 4, NULL},
-{ 0, "5", 5, NULL},
-{ -1, "", 0, do_view3d_select_object_layermenu}};
-
-static TBitem tb_object_select_layer6_10[]= {
-{ 0, "6", 6, NULL},
-{ 0, "7", 7, NULL},
-{ 0, "8", 8, NULL},
-{ 0, "9", 9, NULL},
-{ 0, "10", 10, NULL},
-{ -1, "", 0, do_view3d_select_object_layermenu}};
-
-static TBitem tb_object_select_layer11_15[]= {
-{ 0, "11", 11, NULL},
-{ 0, "12", 12, NULL},
-{ 0, "13", 13, NULL},
-{ 0, "14", 14, NULL},
-{ 0, "15", 15, NULL},
-{ -1, "", 0, do_view3d_select_object_layermenu}};
-
-static TBitem tb_object_select_layer16_20[]= {
-{ 0, "16", 16, NULL},
-{ 0, "17", 17, NULL},
-{ 0, "18", 18, NULL},
-{ 0, "19", 19, NULL},
-{ 0, "20", 20, NULL},
-{ -1, "", 0, do_view3d_select_object_layermenu}};
-
-static TBitem tb_object_select_layer[]= {
-{ 0, "Layers 1-5", 0, tb_object_select_layer1_5},
-{ 0, "Layers 6-10", 0, tb_object_select_layer6_10},
-{ 0, "Layers 11-15", 0, tb_object_select_layer11_15},
-{ 0, "Layers 16-20", 0, tb_object_select_layer16_20},
-{ -1, "", 0, tb_do_hotkey}};
-
-static TBitem tb_object_select_type[]= {
-{ 0, "Mesh", 1, NULL},
-{ 0, "Curve", 2, NULL},
-{ 0, "Surface", 3, NULL},
-{ 0, "Meta", 4, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Armature", 5, NULL},
-{ 0, "Lattice", 6, NULL},
-{ 0, "Text", 7, NULL},
-{ 0, "Empty", 8, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Camera", 9, NULL},
-{ 0, "Lamp", 10, NULL},
-{ -1, "", 0, do_view3d_select_object_typemenu}};
-
-static TBitem tb_object_select_linked[]= {
-{ 0, "Object Ipo|Shift L, 1", 1, NULL},
-{ 0, "ObData|Shift L, 2", 2, NULL},
-{ 0, "Material|Shift L, 3", 3, NULL},
-{ 0, "Texture|Shift L, 4", 4, NULL},
-{ -1, "", 0, do_view3d_select_object_linkedmenu}};
-
-static TBitem tb_object_select_grouped[]= {
-{ 0, "Children|Shift G, 1", 1, NULL},
-{ 0, "Immediate Children|Shift G, 2", 2, NULL},
-{ 0, "Parent|Shift G, 3", 3, NULL},
-{ 0, "Siblings (Shared Parent)|Shift G, 4", 4, NULL},
-{ 0, "Objects of Same Type|Shift G, 5", 5, NULL},
-{ 0, "Objects on Shared Layers|Shift G, 6", 6, NULL},
-{ 0, "Objects in Same Group|Shift G, 7", 7, NULL},
-{ 0, "Object Hooks|Shift G, 8", 8, NULL},
-{ 0, "Object PassIndex|Shift G, 9", 9, NULL},
-{ -1, "", 0, do_view3d_select_object_groupedmenu}};
-
-static TBitem tb_object_select[]= {
-{ 0, "Border Select|B", 0, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Select/Deselect All|A", 1, NULL},
-{ 0, "Inverse", 2, NULL},
-{ 0, "Select All by Layer", 0, tb_object_select_layer},
-{ 0, "Select All by Type", 0, tb_object_select_type},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Linked", 0, tb_object_select_linked},
-{ 0, "Grouped", 0, tb_object_select_grouped},
-{ -1, "", 0, do_view3d_select_objectmenu}};
-
-static TBitem tb_face_select[]= {
-{ 0, "Border Select|B", 0, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Select/Deselect All|A", 2, NULL},
-{ 0, "Inverse", 3, NULL},
-{ 0, "Same UV", 4, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Linked Faces|Ctrl L", 5, NULL},
-{ -1, "", 0, do_view3d_select_faceselmenu}};
-
-static TBitem tb_mesh_select[]= {
-{ 0, "Border Select|B", 0, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Select/Deselect All|A", 2, NULL},
-{ 0, "Inverse|Ctrl I", 3, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Random...", 5, NULL},
-{ 0, "Non-Manifold|Shift Ctrl Alt M", 9, NULL},
-{ 0, "Sharp Edges|Shift Ctrl Alt S", 14, NULL},
-{ 0, "Linked Flat Faces|Shift Ctrl Alt F", 15, NULL},
-{ 0, "Triangles|Shift Ctrl Alt 3", 11, NULL},
-{ 0, "Quads|Shift Ctrl Alt 4", 12, NULL},
-{ 0, "Non-Triangles/Quads|Shift Ctrl Alt 5", 13, NULL},
-{ 0, "Similar to Selection|Shift G", 21, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "More|Ctrl NumPad +", 7, NULL},
-{ 0, "Less|Ctrl NumPad -", 8, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Linked Vertices|Ctrl L", 4, NULL},
-{ 0, "Vertex Path|W Alt 7", 16, NULL},
-{ 0, "Edge Loop|Ctrl E 6", 17, NULL},
-{ 0, "Edge Ring|Ctrl E 7", 18, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Loop to Region|Ctrl E 8", 19, NULL},
-{ 0, "Region to Loop|Ctrl E 9", 20, NULL},
-{ -1, "", 0, do_view3d_select_meshmenu}};
-
-
-static TBitem tb_curve_select[]= {
-{ 0, "Border Select|B", 0, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "(De)select All|A", 2, NULL},
-{ 0, "Inverse", 3, NULL},
-{ 0, "Random...", 13, NULL},
-{ 0, "Every Nth", 14, NULL},
-{ 0, "Row|Shift R", 5, NULL}, /* shouldn't be visible in case of bezier curves*/
-{ 0, "SEPR", 0, NULL},
-{ 0, "(De)select First", 7, NULL},
-{ 0, "(De)select Last", 8, NULL},
-{ 0, "Select Next", 11, NULL},
-{ 0, "Select Previous", 12, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "More|Ctrl NumPad +", 9, NULL},
-{ 0, "Less|Ctrl NumPad -", 10, NULL},
-{ -1, "", 0, do_view3d_select_curvemenu}};
-
-static TBitem tb_mball_select[]= {
-{ 0, "Border Select|B", 0, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "(De)select All|A", 2, NULL},
-{ 0, "Inverse", 3, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Random...", 4, NULL},
-{ -1, "", 0, do_view3d_select_metaballmenu}};
-
-static TBitem tb__select[]= {
-{ 0, "Border Select|B", 'b', NULL},
-{ 0, "(De)select All|A", 'a', NULL},
-{ -1, "", 0, tb_do_hotkey}};
-
-
-/* *************Edit ********** */
-
-static TBitem tb_edit[]= {
-{ 0, "Exit Editmode|Tab", TB_TAB, NULL},
-{ -1, "", 0, tb_do_hotkey}};
-
-static TBitem tb_curve_edit_seg[]= {
-{ 0, "Subdivide|W, 1", 0, NULL},
-{ 0, "Switch Direction|W, 2", 1, NULL},
-{ -1, "", 0, do_view3d_edit_curve_segmentsmenu}};
-
-static TBitem tb_curve_edit_cv[]= {
-{ 0, "Tilt|T", 't', NULL},
-{ 0, "Clear Tilt|Alt T", TB_ALT|'t', NULL},
-{ 0, "Separate|P", 'p', NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Automatic|Shift H", 'H', NULL},
-{ 0, "Toggle Free/Aligned|H", 'h', NULL},
-{ 0, "Vector|V", 'v', NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Make Vertex Parent|Ctrl P", TB_CTRL|'p', NULL},
-{ 0, "Add Hook|Ctrl H", TB_CTRL|'h', NULL},
-{ -1, "", 0, tb_do_hotkey}};
-
-
-static TBitem tb_curve_edit[]= {
-{ 0, "Exit Editmode|Tab", TB_TAB, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Extrude|E", 'e', NULL},
-{ 0, "Duplicate|Shift D", 'D', NULL},
-{ 0, "Make Segment|F", 'f', NULL},
-{ 0, "Toggle Cyclic|C", 'c', NULL},
-{ 0, "Delete...|X", 'x', NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Control Points", 0, tb_curve_edit_cv},
-{ 0, "Segments", 0, tb_curve_edit_seg},
-{ -1, "", 0, tb_do_hotkey}};
-
-
-static TBitem tb_mesh_edit_vertex[]= {
-{ 0, "Merge...|Alt M", 5, NULL},
-{ 0, "Rip|V", 7, NULL},
-{ 0, "Split|Y", 4, NULL},
-{ 0, "Separate|P", 3, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Smooth|W, Alt 1", 2, NULL},
-{ 0, "Remove Doubles|W, 6", 1, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Make Vertex Parent|Ctrl P", 0, NULL},
-{ 0, "Add Hook|Ctrl H", 6, NULL},
-{ -1, "", 0, do_view3d_edit_mesh_verticesmenu}};
-
-static TBitem tb_mesh_edit_edge[]= {
-{ 0, "Make Edge/Face|F", 5, NULL},
-{ 0, "Collapse|Alt M", 14, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Bevel|W, Alt 2", 6, NULL},
-{ 0, "Loop Subdivide|Ctrl R", 4, NULL},
-{ 0, "Knife Subdivide...|Shift K", 3, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Subdivide|W, 1", 2, NULL},
-{ 0, "Subdivide Fractal|W, 2", 1, NULL},
-{ 0, "Subdivide Smooth|W, 3", 0, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Mark Seam|Ctrl E", 7, NULL},
-{ 0, "Clear Seam|Ctrl E", 8, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Crease SubSurf|Shift E", 9, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Rotate Edge CW|Ctrl E", 10, NULL},
-{ 0, "Rotate Edge CCW|Ctrl E", 11, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Slide Edge|Ctrl E", 12, NULL},
-{ 0, "Delete Edge Loop|X", 13, NULL},
-{ -1, "", 0, do_view3d_edit_mesh_edgesmenu}};
-
-static TBitem tb_mesh_edit_face[]= {
-{ 0, "Make Edge/Face|F", 5, NULL},
-{ 0, "Fill|Shift F", 0, NULL},
-{ 0, "Beautify Fill|Alt F", 1, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Convert to Triangles|Ctrl T", 2, NULL},
-{ 0, "Convert to Quads|Alt J", 3, NULL},
-{ 0, "Flip Triangle Edges|Ctrl Shift F", 4, NULL},
-{ 0, "Set Smooth|Ctrl F, 3", 6, NULL},
-{ 0, "Set Solid|Ctrl F, 4", 7, NULL},
-{ -1, "", 0, do_view3d_edit_mesh_facesmenu}};
-
-
-static TBitem tb_mesh_edit_normal[]= {
-{ 0, "Recalculate Outside|Ctrl N", 2, NULL},
-{ 0, "Recalculate Inside|Ctrl Shift N", 1, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Flip|Ctrl F, 1", 0, NULL},
-{ -1, "", 0, do_view3d_edit_mesh_normalsmenu}};
-
-static TBitem tb_mesh_edit[]= {
-{ 0, "Exit Editmode|Tab", TB_TAB, NULL},
-{ 0, "Undo|Ctrl Z", 'u', NULL},
-{ 0, "Redo|Ctrl Shift Z", 'U', NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Extrude|E", 'e', NULL},
-{ 0, "Duplicate|Shift D", 'D', NULL},
-{ 0, "Delete...|X", 'x', NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Vertices", 0, tb_mesh_edit_vertex},
-{ 0, "Edges", 0, tb_mesh_edit_edge},
-{ 0, "Faces", 0, tb_mesh_edit_face},
-{ 0, "Normals", 0, tb_mesh_edit_normal},
-{ -1, "", 0, tb_do_hotkey}};
-
-
-static TBitem tb_object_ipo[]= {
-{ 0, "Show/Hide", 'k', NULL},
-{ 0, "Select Next", TB_PAD|'u', NULL},
-{ 0, "Select Prev", TB_PAD|'d', NULL},
-{ -1, "", 0, tb_do_hotkey}};
-
-
-static TBitem tb_object_edit[]= {
-{ 0, "Enter Editmode|Tab", TB_TAB, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Duplicate|Shift D", 'D', NULL},
-{ 0, "Duplicate Linked|Alt D", TB_ALT|'d', NULL},
-{ 0, "Delete|X", 'x', NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Object Keys", 0, tb_object_ipo},
-{ -1, "", 0, tb_do_hotkey}};
-
-
-/* ************* Type ********** */
-
-static TBitem tb_obdata_hide[]= {
-{ 0, "Show Hidden|Alt H", TB_ALT|'h', NULL},
-{ 0, "Hide Selected|H", 'h', NULL},
-{ 0, "Hide Deselected|Shift H", 'H', NULL},
-{ -1, "", 0, tb_do_hotkey}};
-
-static void tb_do_mesh(void *arg, int event){
- switch(event) {
- case 1: common_insertkey(); break;
- case 2: G.f ^= G_DRAWEDGES; break;
- case 3: G.f ^= G_DRAWFACES; break;
- case 4: G.f ^= G_DRAWNORMALS; break;
- case 5: flip_subdivison(-1); break;
- }
- addqueue(curarea->win, REDRAW, 1);
-}
-
-static TBitem tb_mesh[]= {
-{ 0, "Insert Keyframe|I", 1, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Show/Hide Edges", 2, NULL},
-{ 0, "Show/Hide Faces", 3, NULL},
-{ 0, "Show/Hide Normals", 4, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Subdivision Surface", 5, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Show/Hide Vertices", 0, tb_obdata_hide},
-{ -1, "", 0, tb_do_mesh}};
-
-static TBitem tb_curve_hide[]= {
-{ 0, "Show Hidden|Alt H", 10, NULL},
-{ 0, "Hide Selected|Alt Ctrl H", 11, NULL},
-{ -1, "", 0, do_view3d_edit_curve_showhidemenu}};
-
-
-static TBitem tb_curve[]= {
-{ 0, "Insert Keyframe|I", 'i', NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Show/Hide Points", 0, tb_curve_hide},
-{ -1, "", 0, tb_do_hotkey}};
-
-static TBitem tb_obdata[]= {
-{ 0, "Duplicate|Shift D", 'D', NULL},
-{ 0, "Delete|X", 'x', NULL},
-{ -1, "", 0, tb_do_hotkey}};
-
-static TBitem tb_object_parent[]= {
-{ 0, "Make Parent...|Ctrl P", TB_CTRL|'p', NULL},
-{ 0, "Clear Parent...|Alt P", TB_ALT|'p', NULL},
-{ -1, "", 0, tb_do_hotkey}};
-
-static TBitem tb_object_track[]= {
-{ 0, "Make Track|Ctrl T", TB_CTRL|'t', NULL},
-{ 0, "Clear Track|Alt T", TB_ALT|'t', NULL},
-{ -1, "", 0, tb_do_hotkey}};
-
-static TBitem tb_object[]= {
-{ 0, "Insert Keyframe|I", 'i', NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Make Links...|Ctrl L", TB_CTRL|'l', NULL},
-{ 0, "Make Single User...|U", 'u', NULL},
-{ 0, "Copy Attributes...|Ctrl C", TB_CTRL|'c', NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Parent", 0, tb_object_parent},
-{ 0, "Track", 0, tb_object_track},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Boolean Operation|W", 'w', NULL},
-{ 0, "Join Objects...|Ctrl J", TB_CTRL|'j', NULL},
-{ 0, "Convert Object Type...|Alt C", TB_ALT|'c', NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Move to Layer...|M", 'm', NULL},
-{ -1, "", 0, tb_do_hotkey}};
-
-
-/* *************VIEW ********** */
-
-static void tb_do_view_dt(void *arg, int event){
- G.vd->drawtype= event;
- addqueue(curarea->win, REDRAW, 1);
-}
-
-static TBitem tb_view_dt[]= {
-{ ICON_BBOX, "Bounding Box", 1, NULL},
-{ ICON_WIRE, "Wireframe|Z", 2, NULL},
-{ ICON_SOLID, "Solid|Z", 3, NULL},
-{ ICON_SMOOTH, "Shaded|Shift Z", 4, NULL},
-{ ICON_POTATO, "Textured|Alt Z", 5, NULL},
-{ -1, "", 0, tb_do_view_dt}};
-
-static TBitem tb_view_alignview[]= {
-{ 0, "Center View to Cursor|C", 'c', NULL},
-{ 0, "Align Active Camera to View|Ctrl Alt NumPad 0",
-TB_CTRL|TB_ALT|TB_PAD|'0', NULL},
-{ 0, "Align View to Selected|NumPad *", TB_PAD|'*', NULL},
-{ -1, "", 0, tb_do_hotkey}};
-
-static TBitem tb_view[]= {
-{ 0, "Viewport Shading", 0, tb_view_dt},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Ortho/Perspective|NumPad 5", TB_PAD|'5', NULL},
-{ 0, "Local/Global View|NumPad /", TB_PAD|'/', NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Align View", 0, tb_view_alignview},
-{ 0, "SEPR", 0, NULL},
-{ 0, "View Selected|NumPad .", TB_PAD|'.', NULL},
-{ 0, "View All|Home", TB_PAD|'h', NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Play Back Animation|Alt A", TB_ALT|'a', NULL},
-{ 0, "Camera Fly Mode|Shift F", TB_SHIFT|'f', NULL},
-{ -1, "", 0, tb_do_hotkey}};
-
-
-/* *************TRANSFORM ********** */
-
-static TBitem tb_transform_moveaxis[]= {
-{ 0, "X Global|G, X", 0, NULL},
-{ 0, "Y Global|G, Y", 1, NULL},
-{ 0, "Z Global|G, Z", 2, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "X Local|G, X, X", 3, NULL},
-{ 0, "Y Local|G, Y, Y", 4, NULL},
-{ 0, "Z Local|G, Z, Z", 5, NULL},
-{ -1, "", 0, do_view3d_transform_moveaxismenu}};
-
-static TBitem tb_transform_rotateaxis[]= {
-{ 0, "X Global|R, X", 0, NULL},
-{ 0, "Y Global|R, Y", 1, NULL},
-{ 0, "Z Global|R, Z", 2, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "X Local|R, X, X", 3, NULL},
-{ 0, "Y Local|R, Y, Y", 4, NULL},
-{ 0, "Z Local|R, Z, Z", 5, NULL},
-{ -1, "", 0, do_view3d_transform_rotateaxismenu}};
-
-static TBitem tb_transform_scaleaxis[]= {
-{ 0, "X Global|S, X", 0, NULL},
-{ 0, "Y Global|S, Y", 1, NULL},
-{ 0, "Z Global|S, Z", 2, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "X Local|S, X, X", 3, NULL},
-{ 0, "Y Local|S, Y, Y", 4, NULL},
-{ 0, "Z Local|S, Z, Z", 5, NULL},
-{ -1, "", 0, do_view3d_transform_scaleaxismenu}};
-
-static void tb_do_transform_clearapply(void *arg, int event)
-{
- Object *ob;
- ob= OBACT;
-
- switch(event)
- {
- case 0: /* clear location */
- clear_object('g');
- break;
- case 1: /* clear rotation */
- clear_object('r');
- break;
- case 2: /* clear scale */
- clear_object('s');
- break;
- case 3: /* apply scale/rotation */
- apply_object();
- break;
- case 4: /* apply deformation */
- object_apply_deform(ob);
- break;
- case 5: /* make duplicates real */
- if (ob->transflag & OB_DUPLI) make_duplilist_real();
- else error("The active object does not have dupliverts");
- break;
- }
-}
-
-static TBitem tb_transform_clearapply[]= {
-{ 0, "Clear Location|Alt G", 0, NULL},
-{ 0, "Clear Rotation|Alt R", 1, NULL},
-{ 0, "Clear Scale|Alt S", 2, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Apply Scale/Rotation|Ctrl A", 3, NULL},
-{ 0, "Apply Deformation|Shift Ctrl A", 4, NULL},
-{ 0, "Make Duplicates Real|Shift Ctrl A", 5, NULL},
-{ -1, "", 0, tb_do_transform_clearapply}};
-
-static TBitem tb_transform_snap[]= {
-{ 0, "Selection -> Grid|Shift S, 1", 1, NULL},
-{ 0, "Selection -> Cursor|Shift S, 2", 2, NULL},
-{ 0, "Cursor -> Grid|Shift S, 3", 3, NULL},
-{ 0, "Cursor -> Selection|Shift S, 4", 4, NULL},
-{ 0, "Selection -> Center|Shift S, 5", 5, NULL},
-{ -1, "", 0, do_view3d_edit_snapmenu}};
-
-static void tb_do_transform(void *arg, int event)
-{
- switch(event)
- {
- case 0: /* Grab/move */
- initTransform(TFM_TRANSLATION, CTX_NONE);
- Transform();
- break;
- case 1: /* Rotate */
- initTransform(TFM_ROTATION, CTX_NONE);
- Transform();
- break;
- case 2: /* Scale */
- initTransform(TFM_RESIZE,CTX_NONE);
- Transform();
- break;
- case 3: /* transform properties */
- add_blockhandler(curarea, VIEW3D_HANDLER_OBJECT, UI_PNL_UNSTOW);
- break;
- case 4: /* snap */
- snapmenu();
- break;
- case 5: /* Shrink/Fatten Along Normals */
- initTransform(TFM_SHRINKFATTEN, CTX_NONE);
- Transform();
- break;
- case 6: /* Shear */
- initTransform(TFM_SHEAR, CTX_NONE);
- Transform();
- break;
- case 7: /* Warp */
- initTransform(TFM_WARP, CTX_NONE);
- Transform();
- break;
- case 8: /* proportional edit (toggle) */
- if(G.scene->proportional) G.scene->proportional= 0;
- else G.scene->proportional= 1;
- break;
- case 10:
- docenter(0);
- break;
- case 11:
- docenter_new();
- break;
- case 12:
- docenter_cursor();
- break;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static TBitem tb_transform_object_mirror[]= {
-{ 0, "X Local|Ctrl M, 1", 1, NULL},
-{ 0, "Y Local|Ctrl M, 2", 2, NULL},
-{ 0, "Z Local|Ctrl M, 3", 3, NULL},
-{ -1, "", 0, do_view3d_object_mirrormenu}};
-
-static TBitem tb_transform[]= {
-{ 0, "Grab/Move|G", 0, NULL},
-{ 0, "Grab/Move on Axis| ", 0, tb_transform_moveaxis},
-{ 0, "Rotate|R", 1, NULL},
-{ 0, "Rotate on Axis", 0, tb_transform_rotateaxis},
-{ 0, "Scale|S", 2, NULL},
-{ 0, "Scale on Axis", 0, tb_transform_scaleaxis},
-{ 0, "SEPR", 0, NULL},
-{ 0, "ObData to Center", 10, NULL},
-{ 0, "Center New", 11, NULL},
-{ 0, "Center Cursor", 12, NULL},
-{ 0, "SEPR", 0, NULL},
-{ ICON_MENU_PANEL, "Properties|N", 3, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Mirror", 0, tb_transform_object_mirror},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Snap", 0, tb_transform_snap},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Clear/Apply", 0, tb_transform_clearapply},
-{ -1, "", 0, tb_do_transform}};
-
-static TBitem tb_transform_edit_mirror[]= {
-{ 0, "X Global|Ctrl M, 1", 1, NULL},
-{ 0, "Y Global|Ctrl M, 2", 2, NULL},
-{ 0, "Z Global|Ctrl M, 3", 3, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "X Local|Ctrl M, 4", 4, NULL},
-{ 0, "Y Local|Ctrl M, 5", 5, NULL},
-{ 0, "Z Local|Ctrl M, 6", 6, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "X View|Ctrl M, 7", 7, NULL},
-{ 0, "Y View|Ctrl M, 8", 8, NULL},
-{ 0, "Z View|Ctrl M, 9", 9, NULL},
-{ -1, "", 0, do_view3d_edit_mirrormenu}};
-
-static TBitem tb_transform_editmode1[]= {
-{ 0, "Grab/Move|G", 0, NULL},
-{ 0, "Grab/Move on Axis| ", 0, tb_transform_moveaxis},
-{ 0, "Rotate|R", 1, NULL},
-{ 0, "Rotate on Axis", 0, tb_transform_rotateaxis},
-{ 0, "Scale|S", 2, NULL},
-{ 0, "Scale on Axis", 0, tb_transform_scaleaxis},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Shrink/Fatten|Alt S", 5, NULL},
-{ 0, "Shear|Ctrl S", 6, NULL},
-{ 0, "Warp|Shift W", 7, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "ObData to Center", 10, NULL},
-{ 0, "SEPR", 0, NULL},
-{ ICON_MENU_PANEL, "Properties|N", 3, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Mirror", 0, tb_transform_edit_mirror},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Snap", 0, tb_transform_snap},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Proportional Edit|O", 8, NULL},
-{ -1, "", 0, tb_do_transform}};
-
-
-static TBitem tb_transform_editmode2[]= {
-{ 0, "Grab/Move|G", 0, NULL},
-{ 0, "Grab/Move on Axis| ", 0, tb_transform_moveaxis},
-{ 0, "Rotate|R", 1, NULL},
-{ 0, "Rotate on Axis", 0, tb_transform_rotateaxis},
-{ 0, "Scale|S", 2, NULL},
-{ 0, "Scale on Axis", 0, tb_transform_scaleaxis},
-{ 0, "SEPR", 0, NULL},
-{ ICON_MENU_PANEL, "Properties|N", 3, NULL},
-{ 0, "Snap", 0, tb_transform_snap},
-{ -1, "", 0, tb_do_transform}};
-
-
-/* *************ADD ********** */
-
-static TBitem addmenu_curve[]= {
-{ 0, "Bezier Curve", 0, NULL},
-{ 0, "Bezier Circle", 1, NULL},
-{ 0, "NURBS Curve", 2, NULL},
-{ 0, "NURBS Circle", 3, NULL},
-{ 0, "Path", 4, NULL},
-{ -1, "", 0, do_info_add_curvemenu}};
-
-static TBitem addmenu_surf[]= {
-{ 0, "NURBS Curve", 0, NULL},
-{ 0, "NURBS Circle", 1, NULL},
-{ 0, "NURBS Surface", 2, NULL},
-{ 0, "NURBS Tube", 3, NULL},
-{ 0, "NURBS Sphere", 4, NULL},
-{ 0, "NURBS Donut", 5, NULL},
-{ -1, "", 0, do_info_add_surfacemenu}};
-
-static TBitem addmenu_meta[]= {
-{ 0, "Meta Ball", 0, NULL},
-{ 0, "Meta Tube", 1, NULL},
-{ 0, "Meta Plane", 2, NULL},
-{ 0, "Meta Ellipsoid", 3, NULL},
-{ 0, "Meta Cube", 4, NULL},
-{ -1, "", 0, do_info_add_metamenu}};
-
-static TBitem addmenu_lamp[]= {
-{ 0, "Lamp", 0, NULL},
-{ 0, "Sun", 1, NULL},
-{ 0, "Spot", 2, NULL},
-{ 0, "Hemi", 3, NULL},
-{ 0, "Area", 4, NULL},
-{ -1, "", 0, do_info_add_lampmenu}};
-
-static TBitem addmenu_YF_lamp[]= {
-{ 0, "Lamp", 0, NULL},
-{ 0, "Sun", 1, NULL},
-{ 0, "Spot", 2, NULL},
-{ 0, "Hemi", 3, NULL},
-{ 0, "Area", 4, NULL},
-{ 0, "Photon", 5, NULL},
-{ -1, "", 0, do_info_add_lampmenu}};
-
-
-static TBitem addmenu_armature[]= {
-{ 0, "Bone", 8, NULL},
-{ -1, "", 0, do_info_addmenu}};
-
-/* dynamic items */
-#define TB_ADD_MESH 0
-#define TB_ADD_GROUP 7
-#define TB_ADD_LAMP 10
-
-static TBitem tb_add[]= {
-{ 0, "Mesh", 0, NULL},
-{ 0, "Curve", 1, addmenu_curve},
-{ 0, "Surface", 2, addmenu_surf},
-{ 0, "Meta", 3, addmenu_meta},
-{ 0, "Text", 4, NULL},
-{ 0, "Empty", 5, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Group", 10, NULL},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Camera", 6, NULL},
-{ 0, "Lamp", 7, addmenu_lamp},
-{ 0, "SEPR", 0, NULL},
-{ 0, "Armature", 8, NULL},
-{ 0, "Lattice", 9, NULL},
-{ -1, "", 0, do_info_addmenu}};
-
-static TBitem tb_empty[]= {
-{ 0, "Nothing...", 0, NULL},
-{ -1, "", 0, NULL}};
-
-
-/* *************RENDER ********** */
-
-static void tb_do_render(void *arg, int event){
- switch(event)
- {
- case 1: /* set render border */
- set_render_border();
- break;
- case 2: /* render */
- BIF_do_render(0);
- break;
- case 3: /* render anim */
- BIF_do_render(1);
- break;
- case 4: /* passepartout */
- {
- Camera *ca= NULL;
- if(G.vd->camera==NULL) return;
-
- if(G.vd->camera->type==OB_CAMERA)
- ca= G.vd->camera->data;
- else return;
-
- if (ca && (ca->flag & CAM_SHOWPASSEPARTOUT))
- ca->flag &= ~CAM_SHOWPASSEPARTOUT;
- else
- ca->flag |= CAM_SHOWPASSEPARTOUT;
- allqueue(REDRAWVIEW3D, 0);
- }
- break;
- case 5: /*preview render */
- toggle_blockhandler(curarea, VIEW3D_HANDLER_PREVIEW, 0);
- scrarea_queue_winredraw(curarea);
- break;
- }
-}
-
-static TBitem tb_render[]= {
- { 0, "Passepartout", 4, NULL},
- { 0, "Set Border|Shift B", 1, NULL},
- { 0, "SEPR", 0, NULL},
- { 0, "Render|F12", 2, NULL},
- { 0, "Anim|Ctrl F12", 3, NULL},
- { 0, "Preview|Shift P", 5, NULL},
- { -1, "", 0, tb_do_render}};
-
-/* ************************* NODES *********************** */
-
-
-/* dynamic items */
-
-static TBitem tb_node_addsh[]= {
- { 0, "Input", 1, NULL},
- { 0, "Output", 2, NULL},
- { 0, "Color", 3, NULL},
- { 0, "Vector", 4, NULL},
- { 0, "Convertor", 5, NULL},
- { 0, "Group", 6, NULL},
- { -1, "", 0, NULL}};
-
-static TBitem tb_node_addcomp[]= {
- { 0, "Input", 1, NULL},
- { 0, "Output", 2, NULL},
- { 0, "Color", 3, NULL},
- { 0, "Vector", 4, NULL},
- { 0, "Filter", 5, NULL},
- { 0, "Convertor", 6, NULL},
- { 0, "Matte", 7, NULL},
- { 0, "Distort", 8, NULL},
- { 0, "Group", 9, NULL},
- { -1, "", 0, NULL}};
-
-/* do_node_addmenu() in header_node.c, prototype in BSE_headerbuttons.h */
-
-/* dynamic toolbox sublevel */
-static TBitem *node_add_sublevel(ListBase *storage, bNodeTree *ntree, int nodeclass)
-{
- static TBitem _addmenu[]= { { 0, " ", 0, NULL}, { -1, "", 0, NULL}};
- Link *link;
- TBitem *addmenu;
- int tot= 0, a;
-
- if(ntree) {
- if(nodeclass==NODE_CLASS_GROUP) {
- bNodeTree *ngroup= G.main->nodetree.first;
- for(; ngroup; ngroup= ngroup->id.next)
- if(ngroup->type==ntree->type)
- tot++;
- }
- else {
- bNodeType *ntype = ntree->alltypes.first;
- while(ntype) {
- if(ntype->nclass == nodeclass) {
- tot++;
- }
- ntype= ntype->next;
- }
- }
- }
- if(tot==0) {
- return _addmenu;
- }
-
- link= MEM_callocN(sizeof(Link) + sizeof(TBitem)*(tot+1), "types menu");
- BLI_addtail(storage, link);
- addmenu= (TBitem *)(link+1);
-
- if(nodeclass==NODE_CLASS_GROUP) {
- bNodeTree *ngroup= G.main->nodetree.first;
- for(tot=0, a=0; ngroup; ngroup= ngroup->id.next, tot++) {
- if(ngroup->type==ntree->type) {
- addmenu[a].name= ngroup->id.name+2;
- addmenu[a].retval= NODE_GROUP_MENU+tot; /* so we can use BLI_findlink() */
- a++;
- }
- }
- }
- else {
- bNodeType *ntype= ntree->alltypes.first;
- for(a=0; ntype; ntype= ntype->next) {
- if( ntype->nclass == nodeclass ) {
- addmenu[a].name= ntype->name;
- addmenu[a].retval= ntype->type;
- a++;
- }
- }
- }
-
- addmenu[a].icon= -1; /* end signal */
- addmenu[a].name= "";
- addmenu[a].retval= a;
- addmenu[a].poin= do_node_addmenu;
-
- return addmenu;
-}
-
-
-static TBitem tb_node_node[]= {
- { 0, "Duplicate|Shift D", TB_SHIFT|'d', NULL},
- { 0, "Delete|X", 'x', NULL},
- { 0, "SEPR", 0, NULL},
- { 0, "Make Group|Ctrl G", TB_CTRL|'g', NULL},
- { 0, "Ungroup|Alt G", TB_ALT|'g', NULL},
- { 0, "Edit Group|Tab", TB_TAB, NULL},
- { 0, "SEPR", 0, NULL},
- { 0, "Hide/Unhide|H", 'h', NULL},
- { 0, "SEPR", 0, NULL},
- { 0, "Read Saved Render Results|R", 'r', NULL},
- { 0, "Show Cyclic Dependencies|C", 'c', NULL},
- { -1, "", 0, tb_do_hotkey}};
-
-static TBitem tb_node_select[]= {
- { 0, "Select/Deselect All|A", 'a', NULL},
- { 0, "Border Select|B", 'b', NULL},
- { -1, "", 0, tb_do_hotkey}};
-
-static TBitem tb_node_transform[]= {
- { 0, "Grab/Move|G", 'g', NULL},
- { -1, "", 0, tb_do_hotkey}};
-
-static TBitem tb_node_view[]= {
- { 0, "Zoom In|NumPad +", TB_PAD|'+', NULL},
- { 0, "Zoom Out|NumPad -", TB_PAD|'-', NULL},
- { 0, "View All|Home", TB_PAD|'h', NULL},
- { -1, "", 0, tb_do_hotkey}};
-
-
-/* *********************************************** */
-
-static uiBlock *tb_makemenu(void *arg)
-{
- static int counter=0;
- TBitem *item= arg, *itemt;
- uiBlock *block;
- int xco= 0, yco= 0;
- char str[10];
-
- if(arg==NULL) return NULL;
-
- sprintf(str, "tb %d", counter++);
- block= uiNewBlock(&tb_listb, str, UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetCol(block, TH_MENU_ITEM);
-
- // last item has do_menu func, has to be stored in each button
- itemt= item;
- while(itemt->icon != -1) itemt++;
- uiBlockSetButmFunc(block, itemt->poin, NULL);
-
- // now make the buttons
- while(item->icon != -1) {
-
- if(strcmp(item->name, "SEPR")==0) {
- uiDefBut(block, SEPR, 0, "", xco, yco-=6, 50, 6, NULL, 0.0, 0.0, 0, 0, "");
- }
- else if(item->icon) {
- uiDefIconTextBut(block, BUTM, 1, item->icon, item->name, xco, yco-=20, 80, 19, NULL, 0.0, 0.0, 0, item->retval, "");
- }
- else if(item->poin) {
- uiDefIconTextBlockBut(block, tb_makemenu, item->poin, ICON_RIGHTARROW_THIN, item->name, 0, yco-=20, 80, 19, "");
- }
- else {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, item->name, xco, yco-=20, 80, 19, NULL, 0.0, 0.0, 0, item->retval, "");
- }
-
- if(yco <= -600) {
- yco = 0;
- xco += 80;
- }
-
- item++;
- }
-
- uiTextBoundsBlock(block, 60);
-
- /* direction is also set in the function that calls this */
- if(U.uiflag & USER_PLAINMENUS)
- uiBlockSetDirection(block, UI_RIGHT);
- else
- uiBlockSetDirection(block, UI_RIGHT|UI_CENTER);
-
- return block;
-}
-
-static int tb_mainx= 1234, tb_mainy= 0;
-static void store_main(void *arg1, void *arg2)
-{
- tb_mainx= (long)arg1;
- tb_mainy= (long)arg2;
-}
-
-static void do_group_addmenu(void *arg, int event)
-{
- Object *ob;
-
- if(event<0) return;
-
- add_object_draw(OB_EMPTY);
- ob= OBACT;
-
- ob->dup_group= BLI_findlink(&G.main->group, event);
- if(ob->dup_group) {
- id_us_plus((ID *)ob->dup_group);
- ob->transflag |= OB_DUPLIGROUP;
- DAG_scene_sort(G.scene);
- }
-}
-
-/* helper for create group menu */
-static void tag_groups_for_toolbox(void)
-{
- Group *group;
- GroupObject *go;
-
- for(group= G.main->group.first; group; group= group->id.next)
- group->id.flag |= LIB_DOIT;
-
- for(group= G.main->group.first; group; group= group->id.next) {
- if(group->id.flag & LIB_DOIT)
- for(go= group->gobject.first; go; go= go->next)
- if(go->ob && go->ob->dup_group)
- go->ob->dup_group->id.flag &= ~LIB_DOIT;
- }
-}
-
-/* helper for create group menu */
-/* note that group id.flag was set */
-static int count_group_libs(void)
-{
- Group *group;
- Library *lib;
- int tot= 0;
-
- for(lib= G.main->library.first; lib; lib= lib->id.next)
- lib->id.flag |= LIB_DOIT;
-
- for(group= G.main->group.first; group; group= group->id.next) {
- if(group->id.flag & LIB_DOIT) {
- if(group->id.lib && (group->id.lib->id.flag & LIB_DOIT)) {
- group->id.lib->id.flag &= ~LIB_DOIT;
- tot++;
- }
- }
- }
- return tot;
-}
-
-/* dynamic toolbox sublevel */
-static TBitem *create_group_sublevel(ListBase *storage, Library *lib)
-{
- static TBitem addmenu[]= { { 0, "No Groups", 0, NULL}, { -1, "", 0, NULL}};
- Link *link;
- TBitem *groupmenu, *gm;
- Group *group;
- int a;
- int tot= BLI_countlist(&G.main->group);
-
- if(tot==0) {
- return addmenu;
- }
-
- /* build menu, we insert a Link before the array of TBitems */
- link= MEM_callocN(sizeof(Link) + sizeof(TBitem)*(tot+1), "group menu lib");
- BLI_addtail(storage, link);
- gm= groupmenu= (TBitem *)(link+1);
- for(a=0, group= G.main->group.first; group; group= group->id.next, a++) {
- if(group->id.lib==lib && (group->id.flag & LIB_DOIT)) {
- gm->name= group->id.name+2;
- gm->retval= a;
- gm++;
- }
- }
- gm->icon= -1; /* end signal */
- gm->name= "";
- gm->retval= a;
- gm->poin= do_group_addmenu;
-
- return groupmenu;
-}
-
-static TBitem *create_group_all_sublevels(ListBase *storage)
-{
- Library *lib;
- Group *group;
- Link *link;
- TBitem *groupmenu, *gm;
- int a;
- int totlevel= 0;
- int totlocal= 0;
-
- /* we add totlevel + local groups entries */
-
- /* let's skip group-in-group */
- tag_groups_for_toolbox();
-
- /* this call checks for skipped group-in-groups */
- totlevel= count_group_libs();
-
- for(group= G.main->group.first; group; group= group->id.next)
- if(group->id.flag & LIB_DOIT)
- if(group->id.lib==NULL)
- totlocal++;
-
- if(totlocal+totlevel==0)
- return create_group_sublevel(storage, NULL);
-
- /* build menu, we insert a Link before the array of TBitems */
- link= MEM_callocN(sizeof(Link) + sizeof(TBitem)*(totlocal+totlevel+1), "group menu");
- BLI_addtail(storage, link);
- gm= groupmenu= (TBitem *)(link+1);
-
- /* first all levels. libs with groups are not tagged */
- for(lib= G.main->library.first; lib; lib= lib->id.next) {
- if(!(lib->id.flag & LIB_DOIT)) {
- char *str;
- /* do some tricks to get .blend file name without extension */
- link= MEM_callocN(sizeof(Link) + 128, "string");
- BLI_addtail(storage, link);
- str= (char *)(link+1);
- BLI_strncpy(str, BLI_last_slash(lib->filename)+1, 128);
- if(strlen(str)>6) str[strlen(str)-6]= 0;
- gm->name= str;
- gm->retval= -1;
- gm->poin= create_group_sublevel(storage, lib);
- gm++;
- }
- }
- /* remaining groups */
- for(a=0, group= G.main->group.first; group; group= group->id.next, a++) {
- if(group->id.lib==NULL && (group->id.flag & LIB_DOIT)) {
- gm->name= group->id.name+2;
- gm->retval= a;
- gm++;
- }
- }
- gm->icon= -1; /* end signal */
- gm->name= "";
- gm->retval= a;
- gm->poin= do_group_addmenu;
-
- return groupmenu;
-}
-
-static TBitem *create_mesh_sublevel(ListBase *storage)
-{
- Link *link;
- TBitem *meshmenu, *mm;
- int totmenu= 10, totpymenu=0, a=0;
-
- /* Python Menu */
- BPyMenu *pym;
-
- /* count the python menu items*/
- for (pym = BPyMenuTable[PYMENU_ADDMESH]; pym; pym = pym->next, totpymenu++) {}
- if (totpymenu) totmenu += totpymenu+1; /* add 1 for the seperator */
-
- link= MEM_callocN(sizeof(Link) + sizeof(TBitem)*(totmenu+1), "mesh menu");
- BLI_addtail(storage, link);
- mm= meshmenu= (TBitem *)(link+1);
-
- mm->icon = 0; mm->retval= a; mm->name = "Plane"; mm++; a++;
- mm->icon = 0; mm->retval= a; mm->name = "Cube"; mm++; a++;
- mm->icon = 0; mm->retval= a; mm->name = "Circle"; mm++; a++;
- mm->icon = 0; mm->retval= a; mm->name = "UVsphere"; mm++; a++;
- mm->icon = 0; mm->retval= a; mm->name = "Icosphere"; mm++; a++;
- mm->icon = 0; mm->retval= a; mm->name = "Cylinder"; mm++; a++; a++;
- mm->icon = 0; mm->retval= a; mm->name = "Cone"; mm++; a++;
- mm->icon = 0; mm->retval= 0; mm->name = "SEPR"; mm++;
- mm->icon = 0; mm->retval= a; mm->name = "Grid"; mm++; a++;
- mm->icon = 0; mm->retval= a; mm->name = "Monkey"; mm++; a++;
- /* a == 10 */
-
- if (totpymenu) {
- int i=0;
- mm->icon = 0; mm->retval= 0; mm->name = "SEPR"; mm++;
-
- /* note that we account for the 10 previous entries with i+4: */
- for (pym = BPyMenuTable[PYMENU_ADDMESH]; pym; pym = pym->next, i++) {
- mm->icon = ICON_PYTHON;
- mm->retval= i+20;
- mm->name = pym->name;
- mm++; a++;
- }
- }
-
- /* terminate the menu */
- mm->icon= -1; mm->retval= a; mm->name= ""; mm->poin= do_info_add_meshmenu;
-
- return meshmenu;
-}
-
-
-
-void toolbox_n(void)
-{
- uiBlock *block;
- uiBut *but;
- ListBase storage= {NULL, NULL};
- TBitem *menu1=NULL, *menu2=NULL, *menu3=NULL;
- TBitem *menu4=NULL, *menu5=NULL, *menu6=NULL;
- TBitem *menu7=NULL;
- int dx=0;
- short event, mval[2], tot=0;
- char *str1=NULL, *str2=NULL, *str3=NULL, *str4=NULL, *str5=NULL, *str6=NULL, *str7=NULL;
-
- /* temporal too... when this flag is (was) saved, it should initialize OK */
- if(tb_mainx==1234) {
- if(U.uiflag & USER_PLAINMENUS) {
- tb_mainx= -32;
- tb_mainy= -5;
- } else {
- tb_mainx= 0;
- tb_mainy= -5;
- }
- }
-
- mywinset(G.curscreen->mainwin); // we go to screenspace
-
- block= uiNewBlock(&tb_listb, "toolbox", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
- uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_RET_1);
- uiBlockSetCol(block, TH_MENU_ITEM);
-
- /* select context for main items */
- if(curarea->spacetype==SPACE_VIEW3D) {
-
- /* dynamic menu entries */
- tb_add[TB_ADD_GROUP].poin= create_group_all_sublevels(&storage);
- tb_add[TB_ADD_MESH].poin= create_mesh_sublevel(&storage);
-
- /* static */
- if (G.scene->r.renderer==R_YAFRAY)
- tb_add[TB_ADD_LAMP].poin= addmenu_YF_lamp;
- else
- tb_add[TB_ADD_LAMP].poin= addmenu_lamp;
-
- if(U.uiflag & USER_PLAINMENUS) {
- menu1= tb_add; str1= "Add";
- menu2= tb_object_edit; str2= "Edit";
- menu3= tb_object_select; str3= "Select";
- menu4= tb_transform; str4= "Transform";
- menu5= tb_object; str5= "Object";
- menu6= tb_view; str6= "View";
- menu7= tb_render; str7= "Render";
-
- dx= 96;
- tot= 7;
- } else {
- /* 3x2 layout menu */
- menu1= tb_object; str1= "Object";
- menu2= tb_add; str2= "Add";
- menu3= tb_object_select; str3= "Select";
- menu4= tb_object_edit; str4= "Edit";
- menu5= tb_transform; str5= "Transform";
- menu6= tb_view; str6= "View";
-
- dx= 64;
- tot= 6;
- }
-
- if(G.obedit) {
- if(U.uiflag & USER_PLAINMENUS) {
- switch(G.obedit->type){
- case OB_MESH:
- menu1= create_mesh_sublevel(&storage);
- menu2= tb_mesh_edit;
- menu3= tb_mesh_select;
- menu4= tb_transform_editmode1;
- menu5= tb_mesh; str5= "Mesh";
- break;
- case OB_CURVE:
- menu1= addmenu_curve;
- menu2= tb_curve_edit;
- menu3= tb_curve_select;
- menu4= tb_transform_editmode1;
- menu5= tb_curve; str5= "Curve";
- break;
- case OB_SURF:
- menu1= addmenu_surf;
- menu2= tb_curve_edit;
- menu3= tb_curve_select;
- menu4= tb_transform_editmode1;
- menu5= tb_curve; str5= "Surface";
- break;
- case OB_MBALL:
- menu1= addmenu_meta;
- menu2= tb_edit;
- menu3= tb_mball_select;
- menu4= tb_transform_editmode2;
- menu5= tb_obdata; str5= "Meta";
- break;
- case OB_ARMATURE:
- menu1= addmenu_armature;
- menu2= tb_edit;
- menu3= tb__select;
- menu4= tb_transform_editmode2;
- menu5= tb_obdata;str5= "Armature";
- break;
- case OB_LATTICE:
- menu1= tb_empty;
- menu2= tb_edit;
- menu3= tb__select;
- menu4= tb_transform_editmode1;
- menu5= tb_empty;str5= "Lattice";
- break;
- }
- } else {
- if(G.obedit->type==OB_MESH) {
- menu1= tb_mesh; str1= "Mesh";
- menu2= create_mesh_sublevel(&storage);
- menu3= tb_mesh_select;
- menu4= tb_mesh_edit;
- menu5= tb_transform_editmode1;
- }
- else if(G.obedit->type==OB_CURVE) {
- menu1= tb_curve; str1= "Curve";
- menu2= addmenu_curve;
- menu3= tb_curve_select;
- menu4= tb_curve_edit;
- menu5= tb_transform_editmode1;
- }
- else if(G.obedit->type==OB_SURF) {
- menu1= tb_curve; str1= "Surface";
- menu2= addmenu_surf;
- menu3= tb_curve_select;
- menu4= tb_curve_edit;
- menu5= tb_transform_editmode1;
- }
- else if(G.obedit->type==OB_MBALL) {
- menu1= tb_obdata; str1= "Meta";
- menu2= addmenu_meta;
- menu3= tb__select;
- menu4= tb_edit;
- menu5= tb_transform_editmode2;
- }
- else if(G.obedit->type==OB_ARMATURE) {
- menu1= tb_obdata;str1= "Armature";
- menu2= addmenu_armature;
- menu3= tb__select;
- menu4= tb_edit;
- menu5= tb_transform_editmode2;
- }
- else if(G.obedit->type==OB_LATTICE) {
- menu1= tb_empty;str1= "Lattice";
- menu2= tb_empty;
- menu3= tb__select;
- menu4= tb_edit;
- menu5= tb_transform_editmode1;
- }
- }
- }
- else if (FACESEL_PAINT_TEST) {
- menu3 = tb_face_select;
- }
- }
- else if(curarea->spacetype==SPACE_NODE) {
- SpaceNode *snode= curarea->spacedata.first;
-
- if(snode->treetype==NTREE_COMPOSIT)
- menu1= tb_node_addcomp;
- else
- menu1= tb_node_addsh;
- str1= "Add";
- menu2= tb_node_node; str2= "Node";
- menu3= tb_node_select; str3= "Select";
- menu4= tb_node_transform; str4= "Transform";
- menu5= tb_node_view; str5= "View";
-
- if(snode->treetype==NTREE_SHADER) {
- menu1[0].poin= node_add_sublevel(&storage, snode->nodetree, NODE_CLASS_INPUT);
- menu1[1].poin= node_add_sublevel(&storage, snode->nodetree, NODE_CLASS_OUTPUT);
- menu1[2].poin= node_add_sublevel(&storage, snode->nodetree, NODE_CLASS_OP_COLOR);
- menu1[3].poin= node_add_sublevel(&storage, snode->nodetree, NODE_CLASS_OP_VECTOR);
- menu1[4].poin= node_add_sublevel(&storage, snode->nodetree, NODE_CLASS_CONVERTOR);
- menu1[5].poin= node_add_sublevel(&storage, snode->nodetree, NODE_CLASS_GROUP);
- }
- else if(snode->treetype==NTREE_COMPOSIT) {
- menu1[0].poin= node_add_sublevel(&storage, snode->nodetree, NODE_CLASS_INPUT);
- menu1[1].poin= node_add_sublevel(&storage, snode->nodetree, NODE_CLASS_OUTPUT);
- menu1[2].poin= node_add_sublevel(&storage, snode->nodetree, NODE_CLASS_OP_COLOR);
- menu1[3].poin= node_add_sublevel(&storage, snode->nodetree, NODE_CLASS_OP_VECTOR);
- menu1[4].poin= node_add_sublevel(&storage, snode->nodetree, NODE_CLASS_OP_FILTER);
- menu1[5].poin= node_add_sublevel(&storage, snode->nodetree, NODE_CLASS_CONVERTOR);
- menu1[6].poin= node_add_sublevel(&storage, snode->nodetree, NODE_CLASS_MATTE);
- menu1[7].poin= node_add_sublevel(&storage, snode->nodetree, NODE_CLASS_DISTORT);
- menu1[8].poin= node_add_sublevel(&storage, snode->nodetree, NODE_CLASS_GROUP);
-
- }
-
- dx= 96;
- tot= 5;
-
- }
-
- getmouseco_sc(mval);
-
- /* create the main buttons menu */
- if(tot==6) {
-
- /* check if it fits */
- if(mval[0]-1.5*dx+tb_mainx < 6) mval[0]= 6 + 1.5*dx -tb_mainx;
- else if(mval[0]+1.5*dx+tb_mainx > G.curscreen->sizex-6)
- mval[0]= G.curscreen->sizex-6-1.5*dx-tb_mainx;
-
- if(mval[1]-20+tb_mainy < 6) mval[1]= 6+20 -tb_mainy;
- else if(mval[1]+20+tb_mainy > G.curscreen->sizey-6)
- mval[1]= G.curscreen->sizey-6-20-tb_mainy;
-
- but=uiDefBlockBut(block, tb_makemenu, menu1, str1, mval[0]-(1.5*dx)+tb_mainx,mval[1]+tb_mainy, dx, 19, "");
- uiButSetFlag(but, UI_MAKE_TOP|UI_MAKE_RIGHT);
- uiButSetFunc(but, store_main, (void *)(long)dx, (void *)(long)-5);
-
- but=uiDefBlockBut(block, tb_makemenu, menu2, str2, mval[0]-(0.5*dx)+tb_mainx,mval[1]+tb_mainy, dx, 19, "");
- uiButSetFlag(but, UI_MAKE_TOP);
- uiButSetFunc(but, store_main, (void *)(long)0, (void *)(long)-5);
-
- but=uiDefBlockBut(block, tb_makemenu, menu3, str3, mval[0]+(0.5*dx)+tb_mainx,mval[1]+tb_mainy, dx, 19, "");
- uiButSetFlag(but, UI_MAKE_TOP|UI_MAKE_LEFT);
- uiButSetFunc(but, store_main, (void *)(long)-dx, (void *)(long)-5);
-
- but=uiDefBlockBut(block, tb_makemenu, menu4, str4, mval[0]-(1.5*dx)+tb_mainx,mval[1]+tb_mainy-20, dx, 19, "");
- uiButSetFlag(but, UI_MAKE_DOWN|UI_MAKE_RIGHT);
- uiButSetFunc(but, store_main, (void *)(long)dx, (void *)(long)5);
-
- but=uiDefBlockBut(block, tb_makemenu, menu5, str5, mval[0]-(0.5*dx)+tb_mainx,mval[1]+tb_mainy-20, dx, 19, "");
- uiButSetFlag(but, UI_MAKE_DOWN);
- uiButSetFunc(but, store_main, (void *)(long)0, (void *)(long)5);
-
- but=uiDefBlockBut(block, tb_makemenu, menu6, str6, mval[0]+(0.5*dx)+tb_mainx,mval[1]+tb_mainy-20, dx, 19, "");
- uiButSetFlag(but, UI_MAKE_DOWN|UI_MAKE_LEFT);
- uiButSetFunc(but, store_main, (void *)(long)-dx, (void *)(long)5);
- } else if (tot==5 || tot==7) {
- /* check if it fits, dubious */
- if(mval[0]-0.25*dx+tb_mainx < 6) mval[0]= 6 + 0.25*dx -tb_mainx;
- else if(mval[0]+0.25*dx+tb_mainx > G.curscreen->sizex-6)
- mval[0]= G.curscreen->sizex-6-0.25*dx-tb_mainx;
-
- if(mval[1]-20+tb_mainy < 6) mval[1]= 6+20 -tb_mainy;
- else if(mval[1]+20+tb_mainy > G.curscreen->sizey-6)
- mval[1]= G.curscreen->sizey-6-20-tb_mainy;
-
- but=uiDefIconTextBlockBut(block, tb_makemenu, menu1, ICON_RIGHTARROW_THIN, str1, mval[0]+tb_mainx,mval[1]+tb_mainy, dx, 19, "");
- uiButSetFlag(but, UI_MAKE_RIGHT);
- uiButSetFunc(but, store_main, (void *)-32, (void *)-5);
-
- but=uiDefIconTextBlockBut(block, tb_makemenu, menu2, ICON_RIGHTARROW_THIN, str2, mval[0]+tb_mainx,mval[1]+tb_mainy-20, dx, 19, "");
- uiButSetFlag(but, UI_MAKE_RIGHT);
- uiButSetFunc(but, store_main, (void *)-32, (void *)15);
-
- but=uiDefIconTextBlockBut(block, tb_makemenu, menu3, ICON_RIGHTARROW_THIN, str3, mval[0]+tb_mainx,mval[1]+tb_mainy-40, dx, 19, "");
- uiButSetFlag(but, UI_MAKE_RIGHT);
- uiButSetFunc(but, store_main, (void *)-32, (void *)35);
-
- but=uiDefIconTextBlockBut(block, tb_makemenu, menu4, ICON_RIGHTARROW_THIN, str4, mval[0]+tb_mainx,mval[1]+tb_mainy-60, dx, 19, "");
- uiButSetFlag(but, UI_MAKE_RIGHT);
- uiButSetFunc(but, store_main, (void *)-32, (void *)55);
-
- but=uiDefIconTextBlockBut(block, tb_makemenu, menu5, ICON_RIGHTARROW_THIN, str5, mval[0]+tb_mainx,mval[1]+tb_mainy-80, dx, 19, "");
- uiButSetFlag(but, UI_MAKE_RIGHT);
- uiButSetFunc(but, store_main, (void *)-32, (void *)75);
-
- if(tot>5) {
- but=uiDefIconTextBlockBut(block, tb_makemenu, menu6, ICON_RIGHTARROW_THIN, str6, mval[0]+tb_mainx,mval[1]+tb_mainy-100, dx, 19, "");
- uiButSetFlag(but, UI_MAKE_RIGHT);
- uiButSetFunc(but, store_main, (void *)-32, (void *)95);
- }
- if(tot>6) {
- but=uiDefIconTextBlockBut(block, tb_makemenu, menu7, ICON_RIGHTARROW_THIN, str7, mval[0]+tb_mainx,mval[1]+tb_mainy-120, dx, 19, "");
- uiButSetFlag(but, UI_MAKE_RIGHT);
- uiButSetFunc(but, store_main, (void *)-32, (void *)105);
- }
- }
-
- uiBoundsBlock(block, 2);
- event= uiDoBlocks(&tb_listb, 0, 1);
-
- /* free all dynamic entries... */
- BLI_freelistN(&storage);
-
- mywinset(curarea->win);
-}
-
-void toolbox_n_add(void)
-{
- reset_toolbox();
- toolbox_n();
-}
-
-void reset_toolbox(void)
-{
- if(U.uiflag & USER_PLAINMENUS) {
- tb_mainx= -32;
- tb_mainy= -5;
- } else {
- tb_mainx= 0;
- tb_mainy= -5;
- }
-}
diff --git a/source/blender/src/transform.c b/source/blender/src/transform.c
deleted file mode 100644
index 632af9e269b..00000000000
--- a/source/blender/src/transform.c
+++ /dev/null
@@ -1,4115 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef WIN32
-#include <unistd.h>
-#else
-#include <io.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_armature_types.h"
-#include "DNA_action_types.h" /* for some special action-editor settings */
-#include "DNA_constraint_types.h"
-#include "DNA_ipo_types.h" /* some silly ipo flag */
-#include "DNA_listBase.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h" /* PET modes */
-#include "DNA_screen_types.h" /* area dimensions */
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_space_types.h"
-
-#include "BIF_editview.h" /* arrows_move_cursor */
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-#include "BIF_mywindow.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_space.h" /* undo */
-#include "BIF_toets.h" /* persptoetsen */
-#include "BIF_mywindow.h" /* warp_pointer */
-#include "BIF_toolbox.h" /* notice */
-#include "BIF_editmesh.h"
-#include "BIF_editsima.h"
-#include "BIF_editparticle.h"
-#include "BIF_drawimage.h" /* uvco_to_areaco_noclip */
-#include "BIF_editaction.h"
-
-#include "BKE_action.h" /* get_action_frame */
-#include "BKE_constraint.h"
-#include "BKE_global.h"
-#include "BKE_utildefines.h"
-#include "BKE_bad_level_calls.h"/* popmenu and error */
-#include "BKE_particle.h"
-
-#include "BSE_drawipo.h"
-#include "BSE_editnla_types.h" /* for NLAWIDTH */
-#include "BSE_editaction_types.h"
-#include "BSE_time.h"
-#include "BSE_view.h"
-
-#include "BLI_arithb.h"
-#include "BLI_blenlib.h"
-#include "BLI_editVert.h"
-
-#include "PIL_time.h" /* sleep */
-
-#include "blendef.h"
-
-#include "mydevice.h"
-
-#include "transform.h"
-
-/* GLOBAL VARIABLE THAT SHOULD MOVED TO SCREEN MEMBER OR SOMETHING */
-TransInfo Trans = {TFM_INIT, 0}; // enforce init on first usage
-
-/******************************** Helper functions ************************************/
-
-/* GLOBAL Wrapper Fonctions */
-
-void BIF_drawSnap()
-{
- drawSnapping(&Trans);
-}
-
-/* ************************** Dashed help line **************************** */
-
-
-/* bad frontbuffer call... because it is used in transform after force_draw() */
-static void helpline(TransInfo *t, float *vec)
-{
- float vecrot[3], cent[2];
- short mval[2];
-
- VECCOPY(vecrot, vec);
- if(t->flag & T_EDIT) {
- Object *ob=G.obedit;
- if(ob) Mat4MulVecfl(ob->obmat, vecrot);
- }
- else if(t->flag & T_POSE) {
- Object *ob=t->poseobj;
- if(ob) Mat4MulVecfl(ob->obmat, vecrot);
- }
-
- getmouseco_areawin(mval);
- projectFloatView(t, vecrot, cent); // no overflow in extreme cases
- if(cent[0]!=IS_CLIPPED) {
- persp(PERSP_WIN);
-
- glDrawBuffer(GL_FRONT);
-
- BIF_ThemeColor(TH_WIRE);
-
- setlinestyle(3);
- glBegin(GL_LINE_STRIP);
- glVertex2sv(mval);
- glVertex2fv(cent);
- glEnd();
- setlinestyle(0);
-
- persp(PERSP_VIEW);
- bglFlush(); // flush display for frontbuffer
- glDrawBuffer(GL_BACK);
- }
-}
-/* ************************** INPUT FROM MOUSE *************************** */
-
-float InputScaleRatio(TransInfo *t, short mval[2]) {
- float ratio, dx, dy;
- if(t->flag & T_SHIFT_MOD) {
- /* calculate ratio for shiftkey pos, and for total, and blend these for precision */
- dx = (float)(t->center2d[0] - t->shiftmval[0]);
- dy = (float)(t->center2d[1] - t->shiftmval[1]);
- ratio = (float)sqrt( dx*dx + dy*dy)/t->fac;
-
- dx= (float)(t->center2d[0] - mval[0]);
- dy= (float)(t->center2d[1] - mval[1]);
- ratio+= 0.1f*(float)(sqrt( dx*dx + dy*dy)/t->fac -ratio);
- }
- else {
- dx = (float)(t->center2d[0] - mval[0]);
- dy = (float)(t->center2d[1] - mval[1]);
- ratio = (float)sqrt( dx*dx + dy*dy)/t->fac;
- }
- return ratio;
-}
-
-float InputHorizontalRatio(TransInfo *t, short mval[2]) {
- float x, pad;
-
- pad = curarea->winx / 10;
-
- if (t->flag & T_SHIFT_MOD) {
- /* deal with Shift key by adding motion / 10 to motion before shift press */
- x = t->shiftmval[0] + (float)(mval[0] - t->shiftmval[0]) / 10.0f;
- }
- else {
- x = mval[0];
- }
- return (x - pad) / (curarea->winx - 2 * pad);
-}
-
-float InputHorizontalAbsolute(TransInfo *t, short mval[2]) {
- float vec[3];
- if(t->flag & T_SHIFT_MOD) {
- float dvec[3];
- /* calculate the main translation and the precise one separate */
- convertViewVec(t, dvec, (short)(mval[0] - t->shiftmval[0]), (short)(mval[1] - t->shiftmval[1]));
- VecMulf(dvec, 0.1f);
- convertViewVec(t, t->vec, (short)(t->shiftmval[0] - t->imval[0]), (short)(t->shiftmval[1] - t->imval[1]));
- VecAddf(t->vec, t->vec, dvec);
- }
- else {
- convertViewVec(t, t->vec, (short)(mval[0] - t->imval[0]), (short)(mval[1] - t->imval[1]));
- }
- Projf(vec, t->vec, t->viewinv[0]);
- return Inpf(t->viewinv[0], vec) * 2.0f;
-}
-
-float InputVerticalRatio(TransInfo *t, short mval[2]) {
- float y, pad;
-
- pad = curarea->winy / 10;
-
- if (t->flag & T_SHIFT_MOD) {
- /* deal with Shift key by adding motion / 10 to motion before shift press */
- y = t->shiftmval[1] + (float)(mval[1] - t->shiftmval[1]) / 10.0f;
- }
- else {
- y = mval[0];
- }
- return (y - pad) / (curarea->winy - 2 * pad);
-}
-
-float InputVerticalAbsolute(TransInfo *t, short mval[2]) {
- float vec[3];
- if(t->flag & T_SHIFT_MOD) {
- float dvec[3];
- /* calculate the main translation and the precise one separate */
- convertViewVec(t, dvec, (short)(mval[0] - t->shiftmval[0]), (short)(mval[1] - t->shiftmval[1]));
- VecMulf(dvec, 0.1f);
- convertViewVec(t, t->vec, (short)(t->shiftmval[0] - t->imval[0]), (short)(t->shiftmval[1] - t->imval[1]));
- VecAddf(t->vec, t->vec, dvec);
- }
- else {
- convertViewVec(t, t->vec, (short)(mval[0] - t->imval[0]), (short)(mval[1] - t->imval[1]));
- }
- Projf(vec, t->vec, t->viewinv[1]);
- return Inpf(t->viewinv[1], vec) * 2.0f;
-}
-
-/* ************************** SPACE DEPENDANT CODE **************************** */
-
-void setTransformViewMatrices(TransInfo *t)
-{
- if(t->spacetype==SPACE_VIEW3D) {
- Mat4CpyMat4(t->viewmat, G.vd->viewmat);
- Mat4CpyMat4(t->viewinv, G.vd->viewinv);
- Mat4CpyMat4(t->persmat, G.vd->persmat);
- Mat4CpyMat4(t->persinv, G.vd->persinv);
- t->persp= G.vd->persp;
- }
- else {
- Mat4One(t->viewmat);
- Mat4One(t->viewinv);
- Mat4One(t->persmat);
- Mat4One(t->persinv);
- t->persp = 0; // ortho
- }
-
- calculateCenter2D(t);
-
-}
-
-void convertViewVec(TransInfo *t, float *vec, short dx, short dy)
-{
- if (t->spacetype==SPACE_VIEW3D) {
- window_to_3d(vec, dx, dy);
- }
- else if(t->spacetype==SPACE_IMAGE) {
- float divx, divy, aspx, aspy;
-
- transform_aspect_ratio_tface_uv(&aspx, &aspy);
-
- divx= G.v2d->mask.xmax-G.v2d->mask.xmin;
- divy= G.v2d->mask.ymax-G.v2d->mask.ymin;
-
- vec[0]= aspx*(G.v2d->cur.xmax-G.v2d->cur.xmin)*(dx)/divx;
- vec[1]= aspy*(G.v2d->cur.ymax-G.v2d->cur.ymin)*(dy)/divy;
- vec[2]= 0.0f;
- }
- else if(t->spacetype==SPACE_IPO) {
- float divx, divy;
-
- divx= G.v2d->mask.xmax-G.v2d->mask.xmin;
- divy= G.v2d->mask.ymax-G.v2d->mask.ymin;
-
- vec[0]= (G.v2d->cur.xmax-G.v2d->cur.xmin)*(dx) / (divx);
- vec[1]= (G.v2d->cur.ymax-G.v2d->cur.ymin)*(dy) / (divy);
- vec[2]= 0.0f;
- }
-}
-
-void projectIntView(TransInfo *t, float *vec, int *adr)
-{
- if (t->spacetype==SPACE_VIEW3D)
- project_int(vec, adr);
- else if(t->spacetype==SPACE_IMAGE) {
- float aspx, aspy, v[2];
-
- transform_aspect_ratio_tface_uv(&aspx, &aspy);
- v[0]= vec[0]/aspx;
- v[1]= vec[1]/aspy;
-
- uvco_to_areaco_noclip(v, adr);
- }
- else if(t->spacetype==SPACE_IPO) {
- short out[2] = {0.0f, 0.0f};
-
- ipoco_to_areaco(G.v2d, vec, out);
- adr[0]= out[0];
- adr[1]= out[1];
- }
-}
-
-void projectFloatView(TransInfo *t, float *vec, float *adr)
-{
- if (t->spacetype==SPACE_VIEW3D)
- project_float(vec, adr);
- else if(t->spacetype==SPACE_IMAGE) {
- int a[2];
-
- projectIntView(t, vec, a);
- adr[0]= a[0];
- adr[1]= a[1];
- }
- else if(t->spacetype==SPACE_IPO) {
- int a[2];
-
- projectIntView(t, vec, a);
- adr[0]= a[0];
- adr[1]= a[1];
- }
-}
-
-void convertVecToDisplayNum(float *vec, float *num)
-{
- TransInfo *t= BIF_GetTransInfo();
-
- VECCOPY(num, vec);
-
- if ((t->spacetype==SPACE_IMAGE) && (t->mode==TFM_TRANSLATION)) {
- float aspx, aspy;
-
- if((G.sima->flag & SI_COORDFLOATS)==0) {
- int width, height;
- transform_width_height_tface_uv(&width, &height);
-
- num[0] *= width;
- num[1] *= height;
- }
-
- transform_aspect_ratio_tface_uv(&aspx, &aspy);
- num[0] /= aspx;
- num[1] /= aspy;
- }
-}
-
-void convertDisplayNumToVec(float *num, float *vec)
-{
- TransInfo *t= BIF_GetTransInfo();
-
- VECCOPY(vec, num);
-
- if ((t->spacetype==SPACE_IMAGE) && (t->mode==TFM_TRANSLATION)) {
- float aspx, aspy;
-
- if((G.sima->flag & SI_COORDFLOATS)==0) {
- int width, height;
- transform_width_height_tface_uv(&width, &height);
-
- vec[0] /= width;
- vec[1] /= height;
- }
-
- transform_aspect_ratio_tface_uv(&aspx, &aspy);
- vec[0] *= aspx;
- vec[1] *= aspy;
- }
-}
-
-static void viewRedrawForce(TransInfo *t)
-{
- if (t->spacetype == SPACE_VIEW3D)
- force_draw(0);
- else if (t->spacetype==SPACE_IMAGE) {
- if (G.sima->lock) force_draw_plus(SPACE_VIEW3D, 0);
- else force_draw(0);
- }
- else if (t->spacetype == SPACE_ACTION) {
- if (G.saction->lock) {
- short context;
-
- /* we ignore the pointer this function returns (not needed) */
- get_action_context(&context);
-
- if (context == ACTCONT_ACTION)
- force_draw_plus(SPACE_VIEW3D, 0);
- else if (context == ACTCONT_SHAPEKEY)
- force_draw_all(0);
- else
- force_draw(0);
- }
- else {
- force_draw(0);
- }
- }
- else if (t->spacetype == SPACE_NLA) {
- if (G.snla->lock)
- force_draw_all(0);
- else
- force_draw(0);
- }
- else if (t->spacetype == SPACE_IPO) {
- /* update realtime */
- if (G.sipo->lock) {
- if (G.sipo->blocktype==ID_MA || G.sipo->blocktype==ID_TE)
- force_draw_plus(SPACE_BUTS, 0);
- else if (G.sipo->blocktype==ID_CA)
- force_draw_plus(SPACE_VIEW3D, 0);
- else if (G.sipo->blocktype==ID_KE)
- force_draw_plus(SPACE_VIEW3D, 0);
- else if (G.sipo->blocktype==ID_PO)
- force_draw_plus(SPACE_VIEW3D, 0);
- else if (G.sipo->blocktype==ID_OB)
- force_draw_plus(SPACE_VIEW3D, 0);
- else if (G.sipo->blocktype==ID_SEQ)
- force_draw_plus(SPACE_SEQ, 0);
- else
- force_draw(0);
- }
- else {
- force_draw(0);
- }
- }
-}
-
-static void viewRedrawPost(TransInfo *t)
-{
- if(t->spacetype==SPACE_VIEW3D) {
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWVIEW3D, 0);
- }
- else if(t->spacetype==SPACE_IMAGE) {
- allqueue(REDRAWIMAGE, 0);
- allqueue(REDRAWVIEW3D, 0);
- }
- else if(ELEM3(t->spacetype, SPACE_ACTION, SPACE_NLA, SPACE_IPO)) {
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWIPO, 0);
- allqueue(REDRAWTIME, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- }
-
- scrarea_queue_headredraw(curarea);
-}
-
-/* ************************** TRANSFORMATIONS **************************** */
-
-void BIF_selectOrientation() {
- short val;
- val= pupmenu("Orientation%t|Global|Local|Normal|View");
- if(val>0) {
- if(val==1) G.vd->twmode= V3D_MANIP_GLOBAL;
- else if(val==2) G.vd->twmode= V3D_MANIP_LOCAL;
- else if(val==3) G.vd->twmode= V3D_MANIP_NORMAL;
- else if(val==4) G.vd->twmode= V3D_MANIP_VIEW;
- }
-}
-
-static void view_editmove(unsigned short event)
-{
- int refresh = 0;
- /* Regular: Zoom in */
- /* Shift: Scroll up */
- /* Ctrl: Scroll right */
- /* Alt-Shift: Rotate up */
- /* Alt-Ctrl: Rotate right */
-
- /* only work in 3D window for now
- * In the end, will have to send to event to a 2D window handler instead
- */
- if (Trans.flag & T_2D_EDIT)
- return;
-
- switch(event) {
- case WHEELUPMOUSE:
-
- if( G.qual & LR_SHIFTKEY ) {
- if( G.qual & LR_ALTKEY ) {
- G.qual &= ~LR_SHIFTKEY;
- persptoetsen(PAD2);
- G.qual |= LR_SHIFTKEY;
- } else {
- persptoetsen(PAD2);
- }
- } else if( G.qual & LR_CTRLKEY ) {
- if( G.qual & LR_ALTKEY ) {
- G.qual &= ~LR_CTRLKEY;
- persptoetsen(PAD4);
- G.qual |= LR_CTRLKEY;
- } else {
- persptoetsen(PAD4);
- }
- } else if(U.uiflag & USER_WHEELZOOMDIR)
- persptoetsen(PADMINUS);
- else
- persptoetsen(PADPLUSKEY);
-
- refresh = 1;
- break;
- case WHEELDOWNMOUSE:
- if( G.qual & LR_SHIFTKEY ) {
- if( G.qual & LR_ALTKEY ) {
- G.qual &= ~LR_SHIFTKEY;
- persptoetsen(PAD8);
- G.qual |= LR_SHIFTKEY;
- } else {
- persptoetsen(PAD8);
- }
- } else if( G.qual & LR_CTRLKEY ) {
- if( G.qual & LR_ALTKEY ) {
- G.qual &= ~LR_CTRLKEY;
- persptoetsen(PAD6);
- G.qual |= LR_CTRLKEY;
- } else {
- persptoetsen(PAD6);
- }
- } else if(U.uiflag & USER_WHEELZOOMDIR)
- persptoetsen(PADPLUSKEY);
- else
- persptoetsen(PADMINUS);
-
- refresh = 1;
- break;
- }
-
- if (refresh)
- setTransformViewMatrices(&Trans);
-}
-
-void checkFirstTime() {
- if(Trans.mode==TFM_INIT) {
- memset(&Trans, 0, sizeof(TransInfo));
- Trans.propsize = 1.0;
- }
-}
-
-static char *transform_to_undostr(TransInfo *t)
-{
- switch (t->mode) {
- case TFM_TRANSLATION:
- return "Translate";
- case TFM_ROTATION:
- return "Rotate";
- case TFM_RESIZE:
- return "Scale";
- case TFM_TOSPHERE:
- return "To Sphere";
- case TFM_SHEAR:
- return "Shear";
- case TFM_WARP:
- return "Warp";
- case TFM_SHRINKFATTEN:
- return "Shrink/Fatten";
- case TFM_TILT:
- return "Tilt";
- case TFM_TRACKBALL:
- return "Trackball";
- case TFM_PUSHPULL:
- return "Push/Pull";
- case TFM_CREASE:
- return "Crease";
- case TFM_BONESIZE:
- return "Bone Width";
- case TFM_BONE_ENVELOPE:
- return "Bone Envelope";
- case TFM_TIME_TRANSLATE:
- return "Translate Anim. Data";
- case TFM_TIME_SCALE:
- return "Scale Anim. Data";
- case TFM_TIME_SLIDE:
- return "Time Slide";
- case TFM_BAKE_TIME:
- return "Key Time";
- }
- return "Transform";
-}
-
-/* ************************************************* */
-
-static void transformEvent(unsigned short event, short val) {
- float mati[3][3] = {{1.0f, 0.0f, 0.0f}, {0.0f, 1.0f, 0.0f}, {0.0f, 0.0f, 1.0f}};
- char cmode = constraintModeToChar(&Trans);
-
- if (val) {
- switch (event){
- /* enforce redraw of transform when modifiers are used */
- case LEFTCTRLKEY:
- case RIGHTCTRLKEY:
- Trans.redraw = 1;
- break;
- case LEFTSHIFTKEY:
- case RIGHTSHIFTKEY:
- /* shift is modifier for higher resolution transform, works nice to store this mouse position */
- getmouseco_areawin(Trans.shiftmval);
- Trans.flag |= T_SHIFT_MOD;
- Trans.redraw = 1;
- break;
-
- case SPACEKEY:
- if ((Trans.spacetype==SPACE_VIEW3D) && (G.qual & LR_ALTKEY)) {
- short mval[2];
-
- getmouseco_sc(mval);
- BIF_selectOrientation();
- calc_manipulator_stats(curarea);
- Mat3CpyMat4(Trans.spacemtx, G.vd->twmat);
- warp_pointer(mval[0], mval[1]);
- }
- else {
- Trans.state = TRANS_CONFIRM;
- }
- break;
-
-
- case MIDDLEMOUSE:
- if ((Trans.flag & T_NO_CONSTRAINT)==0) {
- /* exception for switching to dolly, or trackball, in camera view */
- if (Trans.flag & T_CAMERA) {
- if (Trans.mode==TFM_TRANSLATION)
- setLocalConstraint(&Trans, (CON_AXIS2), "along local Z");
- else if (Trans.mode==TFM_ROTATION) {
- restoreTransObjects(&Trans);
- initTrackball(&Trans);
- }
- }
- else {
- Trans.flag |= T_MMB_PRESSED;
- if (Trans.con.mode & CON_APPLY) {
- stopConstraint(&Trans);
- }
- else {
- if (G.qual & LR_CTRLKEY) {
- initSelectConstraint(&Trans, Trans.spacemtx);
- }
- else {
- /* bit hackish... but it prevents mmb select to print the orientation from menu */
- strcpy(Trans.spacename, "global");
- initSelectConstraint(&Trans, mati);
- }
- postSelectConstraint(&Trans);
- }
- }
- Trans.redraw = 1;
- }
- break;
- case ESCKEY:
- case RIGHTMOUSE:
- Trans.state = TRANS_CANCEL;
- break;
- case LEFTMOUSE:
- case PADENTER:
- case RETKEY:
- Trans.state = TRANS_CONFIRM;
- break;
- case GKEY:
- /* only switch when... */
- if( ELEM3(Trans.mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL) ) {
- restoreTransObjects(&Trans);
- initTranslation(&Trans);
- Trans.redraw = 1;
- }
- break;
- case SKEY:
- /* only switch when... */
- if( ELEM3(Trans.mode, TFM_ROTATION, TFM_TRANSLATION, TFM_TRACKBALL) ) {
- restoreTransObjects(&Trans);
- initResize(&Trans);
- Trans.redraw = 1;
- }
- break;
- case RKEY:
- /* only switch when... */
- if( ELEM4(Trans.mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) {
-
- if (Trans.mode == TFM_ROTATION) {
- restoreTransObjects(&Trans);
- initTrackball(&Trans);
- }
- else {
- restoreTransObjects(&Trans);
- initRotation(&Trans);
- }
- Trans.redraw = 1;
- }
- break;
- case CKEY:
- if (G.qual & LR_ALTKEY) {
- Trans.flag ^= T_PROP_CONNECTED;
- sort_trans_data_dist(&Trans);
- calculatePropRatio(&Trans);
- Trans.redraw= 1;
- }
- else {
- stopConstraint(&Trans);
- Trans.redraw = 1;
- }
- break;
- case XKEY:
- if ((Trans.flag & T_NO_CONSTRAINT)==0) {
- if (cmode == 'X') {
- if (Trans.flag & T_2D_EDIT) {
- stopConstraint(&Trans);
- }
- else {
- if (Trans.con.mode & CON_USER) {
- stopConstraint(&Trans);
- }
- else {
- if (G.qual == 0)
- setUserConstraint(&Trans, (CON_AXIS0), "along %s X");
- else if (G.qual == LR_SHIFTKEY)
- setUserConstraint(&Trans, (CON_AXIS1|CON_AXIS2), "locking %s X");
- }
- }
- }
- else {
- if (Trans.flag & T_2D_EDIT) {
- setConstraint(&Trans, mati, (CON_AXIS0), "along X axis");
- }
- else {
- if (G.qual == 0)
- setConstraint(&Trans, mati, (CON_AXIS0), "along global X");
- else if (G.qual == LR_SHIFTKEY)
- setConstraint(&Trans, mati, (CON_AXIS1|CON_AXIS2), "locking global X");
- }
- }
- Trans.redraw = 1;
- }
- break;
- case YKEY:
- if ((Trans.flag & T_NO_CONSTRAINT)==0) {
- if (cmode == 'Y') {
- if (Trans.flag & T_2D_EDIT) {
- stopConstraint(&Trans);
- }
- else {
- if (Trans.con.mode & CON_USER) {
- stopConstraint(&Trans);
- }
- else {
- if (G.qual == 0)
- setUserConstraint(&Trans, (CON_AXIS1), "along %s Y");
- else if (G.qual == LR_SHIFTKEY)
- setUserConstraint(&Trans, (CON_AXIS0|CON_AXIS2), "locking %s Y");
- }
- }
- }
- else {
- if (Trans.flag & T_2D_EDIT) {
- setConstraint(&Trans, mati, (CON_AXIS1), "along Y axis");
- }
- else {
- if (G.qual == 0)
- setConstraint(&Trans, mati, (CON_AXIS1), "along global Y");
- else if (G.qual == LR_SHIFTKEY)
- setConstraint(&Trans, mati, (CON_AXIS0|CON_AXIS2), "locking global Y");
- }
- }
- Trans.redraw = 1;
- }
- break;
- case ZKEY:
- if ((Trans.flag & T_NO_CONSTRAINT)==0) {
- if (cmode == 'Z') {
- if (Trans.con.mode & CON_USER) {
- stopConstraint(&Trans);
- }
- else {
- if (G.qual == 0)
- setUserConstraint(&Trans, (CON_AXIS2), "along %s Z");
- else if ((G.qual == LR_SHIFTKEY) && ((Trans.flag & T_2D_EDIT)==0))
- setUserConstraint(&Trans, (CON_AXIS0|CON_AXIS1), "locking %s Z");
- }
- }
- else if ((Trans.flag & T_2D_EDIT)==0) {
- if (G.qual == 0)
- setConstraint(&Trans, mati, (CON_AXIS2), "along global Z");
- else if (G.qual == LR_SHIFTKEY)
- setConstraint(&Trans, mati, (CON_AXIS0|CON_AXIS1), "locking global Z");
- }
- Trans.redraw = 1;
- }
- break;
- case OKEY:
- if (Trans.flag & T_PROP_EDIT && G.qual==LR_SHIFTKEY) {
- G.scene->prop_mode = (G.scene->prop_mode+1)%6;
- calculatePropRatio(&Trans);
- Trans.redraw= 1;
- }
- break;
- case PADPLUSKEY:
- if(G.qual & LR_ALTKEY && Trans.flag & T_PROP_EDIT) {
- Trans.propsize*= 1.1f;
- calculatePropRatio(&Trans);
- }
- Trans.redraw= 1;
- break;
- case PAGEUPKEY:
- case WHEELDOWNMOUSE:
- if (Trans.flag & T_AUTOIK) {
- transform_autoik_update(&Trans, 1);
- }
- else if(Trans.flag & T_PROP_EDIT) {
- Trans.propsize*= 1.1f;
- calculatePropRatio(&Trans);
- }
- else view_editmove(event);
- Trans.redraw= 1;
- break;
- case PADMINUS:
- if(G.qual & LR_ALTKEY && Trans.flag & T_PROP_EDIT) {
- Trans.propsize*= 0.90909090f;
- calculatePropRatio(&Trans);
- }
- Trans.redraw= 1;
- break;
- case PAGEDOWNKEY:
- case WHEELUPMOUSE:
- if (Trans.flag & T_AUTOIK) {
- transform_autoik_update(&Trans, -1);
- }
- else if (Trans.flag & T_PROP_EDIT) {
- Trans.propsize*= 0.90909090f;
- calculatePropRatio(&Trans);
- }
- else view_editmove(event);
- Trans.redraw= 1;
- break;
- }
-
- // Numerical input events
- Trans.redraw |= handleNumInput(&(Trans.num), event);
-
- // Snapping events
- Trans.redraw |= handleSnapping(&Trans, event);
-
- arrows_move_cursor(event);
- }
- else {
- switch (event){
- /* no redraw on release modifier keys! this makes sure you can assign the 'grid' still
- after releasing modifer key */
- case MIDDLEMOUSE:
- if ((Trans.flag & T_NO_CONSTRAINT)==0) {
- Trans.flag &= ~T_MMB_PRESSED;
- postSelectConstraint(&Trans);
- Trans.redraw = 1;
- }
- break;
- case LEFTMOUSE:
- case RIGHTMOUSE:
- if (Trans.context & CTX_TWEAK)
- Trans.state = TRANS_CONFIRM;
- break;
- case LEFTSHIFTKEY:
- case RIGHTSHIFTKEY:
- /* shift is modifier for higher resolution transform */
- Trans.flag &= ~T_SHIFT_MOD;
- break;
- }
- }
-
- // Per transform event, if present
- if (Trans.handleEvent)
- Trans.redraw |= Trans.handleEvent(&Trans, event, val);
-}
-
-int calculateTransformCenter(int centerMode, float *vec)
-{
- int success = 1;
- checkFirstTime();
-
- Trans.state = TRANS_RUNNING;
-
- Trans.context = CTX_NONE;
-
- Trans.mode = TFM_DUMMY;
-
- initTrans(&Trans); // internal data, mouse, vectors
-
- createTransData(&Trans); // make TransData structs from selection
-
- Trans.around = centerMode; // override userdefined mode
-
- if (Trans.total == 0) {
- success = 0;
- }
- else {
- success = 1;
-
- calculateCenter(&Trans);
-
- // Copy center from constraint center. Transform center can be local
- VECCOPY(vec, Trans.con.center);
- }
-
- postTrans(&Trans);
-
- /* aftertrans does insert ipos and action channels, and clears base flags, doesnt read transdata */
- special_aftertrans_update(&Trans);
-
- return success;
-}
-
-void initTransform(int mode, int context) {
- /* added initialize, for external calls to set stuff in TransInfo, like undo string */
- checkFirstTime();
-
- Trans.state = TRANS_RUNNING;
-
- Trans.context = context;
-
- Trans.mode = mode;
-
- initTrans(&Trans); // internal data, mouse, vectors
-
- if(Trans.spacetype==SPACE_VIEW3D) {
- calc_manipulator_stats(curarea);
- Mat3CpyMat4(Trans.spacemtx, G.vd->twmat);
- }
- else
- Mat3One(Trans.spacemtx);
-
- createTransData(&Trans); // make TransData structs from selection
-
- initSnapping(&Trans); // Initialize snapping data AFTER mode flags
-
- if (Trans.total == 0) {
- postTrans(&Trans);
- return;
- }
-
- /* EVIL! posemode code can switch translation to rotate when 1 bone is selected. will be removed (ton) */
- /* EVIL2: we gave as argument also texture space context bit... was cleared */
- /* EVIL3: extend mode for animation editors also switches modes... but is best way to avoid duplicate code */
- mode = Trans.mode;
-
- calculatePropRatio(&Trans);
- calculateCenter(&Trans);
-
- switch (mode) {
- case TFM_TRANSLATION:
- initTranslation(&Trans);
- break;
- case TFM_ROTATION:
- initRotation(&Trans);
- break;
- case TFM_RESIZE:
- initResize(&Trans);
- break;
- case TFM_TOSPHERE:
- initToSphere(&Trans);
- break;
- case TFM_SHEAR:
- initShear(&Trans);
- break;
- case TFM_WARP:
- initWarp(&Trans);
- break;
- case TFM_SHRINKFATTEN:
- initShrinkFatten(&Trans);
- break;
- case TFM_TILT:
- initTilt(&Trans);
- break;
- case TFM_CURVE_SHRINKFATTEN:
- initCurveShrinkFatten(&Trans);
- break;
- case TFM_TRACKBALL:
- initTrackball(&Trans);
- break;
- case TFM_PUSHPULL:
- initPushPull(&Trans);
- break;
- case TFM_CREASE:
- initCrease(&Trans);
- break;
- case TFM_BONESIZE:
- { /* used for both B-Bone width (bonesize) as for deform-dist (envelope) */
- bArmature *arm= Trans.poseobj->data;
- if(arm->drawtype==ARM_ENVELOPE)
- initBoneEnvelope(&Trans);
- else
- initBoneSize(&Trans);
- }
- break;
- case TFM_BONE_ENVELOPE:
- initBoneEnvelope(&Trans);
- break;
- case TFM_BONE_ROLL:
- initBoneRoll(&Trans);
- break;
- case TFM_TIME_TRANSLATE:
- initTimeTranslate(&Trans);
- break;
- case TFM_TIME_SLIDE:
- initTimeSlide(&Trans);
- break;
- case TFM_TIME_SCALE:
- initTimeScale(&Trans);
- break;
- case TFM_TIME_EXTEND:
- /* now that transdata has been made, do like for TFM_TIME_TRANSLATE */
- initTimeTranslate(&Trans);
- break;
- case TFM_BAKE_TIME:
- initBakeTime(&Trans);
- break;
- }
-}
-
-void Transform()
-{
- short pmval[2] = {0, 0}, mval[2], val;
- unsigned short event;
-
- if(Trans.total==0) return; // added, can happen now! (ton)
-
- // Emptying event queue
- while( qtest() ) {
- event= extern_qread(&val);
- }
-
- Trans.redraw = 1; /* initial draw */
-
- while (Trans.state == TRANS_RUNNING) {
-
- getmouseco_areawin(mval);
-
- if (mval[0] != pmval[0] || mval[1] != pmval[1]) {
- if (Trans.flag & T_MMB_PRESSED)
- Trans.con.mode |= CON_SELECT;
- Trans.redraw = 1;
- }
- if (Trans.redraw) {
- pmval[0] = mval[0];
- pmval[1] = mval[1];
-
- selectConstraint(&Trans);
- if (Trans.transform) {
- Trans.transform(&Trans, mval); // calls recalcData()
- }
- Trans.redraw = 0;
- }
-
- /* essential for idling subloop */
- if( qtest()==0) PIL_sleep_ms(2);
-
- while( qtest() ) {
- event= extern_qread(&val);
- transformEvent(event, val);
- }
- }
-
-
- /* handle restoring objects */
- if(Trans.state == TRANS_CANCEL)
- restoreTransObjects(&Trans); // calls recalcData()
-
- /* free data */
- postTrans(&Trans);
-
- /* aftertrans does insert ipos and action channels, and clears base flags, doesnt read transdata */
- special_aftertrans_update(&Trans);
-
- /* send events out for redraws */
- viewRedrawPost(&Trans);
-
- /* Undo as last, certainly after special_trans_update! */
- if(Trans.state == TRANS_CANCEL) {
- if(Trans.undostr) BIF_undo_push(Trans.undostr);
- }
- else {
- if(Trans.undostr) BIF_undo_push(Trans.undostr);
- else BIF_undo_push(transform_to_undostr(&Trans));
- }
- Trans.undostr= NULL;
-
-}
-
-/* ************************** Manipulator init and main **************************** */
-
-void initManipulator(int mode)
-{
- Trans.state = TRANS_RUNNING;
-
- Trans.context = CTX_NONE;
-
- Trans.mode = mode;
-
- /* automatic switch to scaling bone envelopes */
- if(mode==TFM_RESIZE && G.obedit && G.obedit->type==OB_ARMATURE) {
- bArmature *arm= G.obedit->data;
- if(arm->drawtype==ARM_ENVELOPE)
- mode= TFM_BONE_ENVELOPE;
- }
-
- initTrans(&Trans); // internal data, mouse, vectors
-
- G.moving |= G_TRANSFORM_MANIP; // signal to draw manipuls while transform
- createTransData(&Trans); // make TransData structs from selection
-
- if (Trans.total == 0)
- return;
-
- initSnapping(&Trans); // Initialize snapping data AFTER mode flags
-
- /* EVIL! posemode code can switch translation to rotate when 1 bone is selected. will be removed (ton) */
- /* EVIL2: we gave as argument also texture space context bit... was cleared */
- mode = Trans.mode;
-
- calculatePropRatio(&Trans);
- calculateCenter(&Trans);
-
- switch (mode) {
- case TFM_TRANSLATION:
- initTranslation(&Trans);
- break;
- case TFM_ROTATION:
- initRotation(&Trans);
- break;
- case TFM_RESIZE:
- initResize(&Trans);
- break;
- case TFM_TRACKBALL:
- initTrackball(&Trans);
- break;
- }
-
- Trans.flag |= T_USES_MANIPULATOR;
-}
-
-void ManipulatorTransform()
-{
- int mouse_moved = 0;
- short pmval[2] = {0, 0}, mval[2], val;
- unsigned short event;
-
- if (Trans.total == 0)
- return;
-
- Trans.redraw = 1; /* initial draw */
-
- while (Trans.state == TRANS_RUNNING) {
-
- getmouseco_areawin(mval);
-
- if (mval[0] != pmval[0] || mval[1] != pmval[1]) {
- Trans.redraw = 1;
- }
- if (Trans.redraw) {
- pmval[0] = mval[0];
- pmval[1] = mval[1];
-
- //selectConstraint(&Trans); needed?
- if (Trans.transform) {
- Trans.transform(&Trans, mval);
- }
- Trans.redraw = 0;
- }
-
- /* essential for idling subloop */
- if( qtest()==0) PIL_sleep_ms(2);
-
- while( qtest() ) {
- event= extern_qread(&val);
-
- switch (event){
- case MOUSEX:
- case MOUSEY:
- mouse_moved = 1;
- break;
- /* enforce redraw of transform when modifiers are used */
- case LEFTCTRLKEY:
- case RIGHTCTRLKEY:
- if(val) Trans.redraw = 1;
- break;
- case LEFTSHIFTKEY:
- case RIGHTSHIFTKEY:
- /* shift is modifier for higher resolution transform, works nice to store this mouse position */
- if(val) {
- getmouseco_areawin(Trans.shiftmval);
- Trans.flag |= T_SHIFT_MOD;
- Trans.redraw = 1;
- }
- else Trans.flag &= ~T_SHIFT_MOD;
- break;
-
- case ESCKEY:
- case RIGHTMOUSE:
- Trans.state = TRANS_CANCEL;
- break;
- case LEFTMOUSE:
- if(mouse_moved==0 && val==0) break;
- // else we pass on event to next, which cancels
- case SPACEKEY:
- case PADENTER:
- case RETKEY:
- Trans.state = TRANS_CONFIRM;
- break;
- }
- if(val) {
- switch(event) {
- case WHEELDOWNMOUSE:
- case PADPLUSKEY:
- if(Trans.flag & T_PROP_EDIT) {
- Trans.propsize*= 1.1f;
- calculatePropRatio(&Trans);
- Trans.redraw= 1;
- }
- break;
- case WHEELUPMOUSE:
- case PADMINUS:
- if(Trans.flag & T_PROP_EDIT) {
- Trans.propsize*= 0.90909090f;
- calculatePropRatio(&Trans);
- Trans.redraw= 1;
- }
- break;
- }
- }
- }
- }
-
- if(Trans.state == TRANS_CANCEL) {
- restoreTransObjects(&Trans);
- }
-
- /* free data, reset vars */
- postTrans(&Trans);
-
- /* aftertrans does insert ipos and action channels, and clears base flags */
- special_aftertrans_update(&Trans);
-
- /* send events out for redraws */
- viewRedrawPost(&Trans);
-
- if(Trans.state != TRANS_CANCEL) {
- BIF_undo_push(transform_to_undostr(&Trans));
- }
-
-}
-
-/* ************************** TRANSFORM LOCKS **************************** */
-
-static void protectedTransBits(short protectflag, float *vec)
-{
- if(protectflag & OB_LOCK_LOCX)
- vec[0]= 0.0f;
- if(protectflag & OB_LOCK_LOCY)
- vec[1]= 0.0f;
- if(protectflag & OB_LOCK_LOCZ)
- vec[2]= 0.0f;
-}
-
-static void protectedSizeBits(short protectflag, float *size)
-{
- if(protectflag & OB_LOCK_SCALEX)
- size[0]= 1.0f;
- if(protectflag & OB_LOCK_SCALEY)
- size[1]= 1.0f;
- if(protectflag & OB_LOCK_SCALEZ)
- size[2]= 1.0f;
-}
-
-static void protectedRotateBits(short protectflag, float *eul, float *oldeul)
-{
- if(protectflag & OB_LOCK_ROTX)
- eul[0]= oldeul[0];
- if(protectflag & OB_LOCK_ROTY)
- eul[1]= oldeul[1];
- if(protectflag & OB_LOCK_ROTZ)
- eul[2]= oldeul[2];
-}
-
-static void protectedQuaternionBits(short protectflag, float *quat, float *oldquat)
-{
- /* quaternions get limited with euler... */
- /* this function only does the delta rotation */
-
- if(protectflag) {
- float eul[3], oldeul[3], quat1[4];
-
- QUATCOPY(quat1, quat);
- QuatToEul(quat, eul);
- QuatToEul(oldquat, oldeul);
-
- if(protectflag & OB_LOCK_ROTX)
- eul[0]= oldeul[0];
- if(protectflag & OB_LOCK_ROTY)
- eul[1]= oldeul[1];
- if(protectflag & OB_LOCK_ROTZ)
- eul[2]= oldeul[2];
-
- EulToQuat(eul, quat);
- /* quaternions flip w sign to accumulate rotations correctly */
- if( (quat1[0]<0.0f && quat[0]>0.0f) || (quat1[0]>0.0f && quat[0]<0.0f) ) {
- QuatMulf(quat, -1.0f);
- }
- }
-}
-
-/* ******************* TRANSFORM LIMITS ********************** */
-
-static void constraintTransLim(TransInfo *t, TransData *td)
-{
- if (td->con) {
- bConstraintTypeInfo *cti= get_constraint_typeinfo(CONSTRAINT_TYPE_LOCLIMIT);
- bConstraintOb cob;
- bConstraint *con;
-
- /* Make a temporary bConstraintOb for using these limit constraints
- * - they only care that cob->matrix is correctly set ;-)
- * - current space should be local
- */
- memset(&cob, 0, sizeof(bConstraintOb));
- Mat4One(cob.matrix);
- if (td->tdi) {
- TransDataIpokey *tdi= td->tdi;
- cob.matrix[3][0]= tdi->locx[0];
- cob.matrix[3][1]= tdi->locy[0];
- cob.matrix[3][2]= tdi->locz[0];
- }
- else {
- VECCOPY(cob.matrix[3], td->loc);
- }
-
- /* Evaluate valid constraints */
- for (con= td->con; con; con= con->next) {
- /* we're only interested in Limit-Location constraints */
- if (con->type == CONSTRAINT_TYPE_LOCLIMIT) {
- bLocLimitConstraint *data= con->data;
- float tmat[4][4];
-
- /* only use it if it's tagged for this purpose */
- if ((data->flag2 & LIMIT_TRANSFORM)==0)
- continue;
-
- /* do space conversions */
- if (con->ownspace == CONSTRAINT_SPACE_WORLD) {
- /* just multiply by td->mtx (this should be ok) */
- Mat4CpyMat4(tmat, cob.matrix);
- Mat4MulMat34(cob.matrix, td->mtx, tmat); // checkme
- }
- else if (con->ownspace != CONSTRAINT_SPACE_LOCAL) {
- /* skip... incompatable spacetype */
- continue;
- }
-
- /* do constraint */
- cti->evaluate_constraint(con, &cob, NULL);
-
- /* convert spaces again */
- if (con->ownspace == CONSTRAINT_SPACE_WORLD) {
- /* just multiply by td->mtx (this should be ok) */
- Mat4CpyMat4(tmat, cob.matrix);
- Mat4MulMat34(cob.matrix, td->smtx, tmat); // checkme
- }
- }
- }
-
- /* copy results from cob->matrix */
- if (td->tdi) {
- TransDataIpokey *tdi= td->tdi;
- tdi->locx[0]= cob.matrix[3][0];
- tdi->locy[0]= cob.matrix[3][1];
- tdi->locz[0]= cob.matrix[3][2];
- }
- else {
- VECCOPY(td->loc, cob.matrix[3]);
- }
- }
-}
-
-/* ************************** WARP *************************** */
-
-void initWarp(TransInfo *t)
-{
- float max[3], min[3];
- int i;
-
- t->mode = TFM_WARP;
- t->transform = Warp;
-
- t->idx_max = 0;
- t->num.idx_max = 0;
- t->snap[0] = 0.0f;
- t->snap[1] = 5.0f;
- t->snap[2] = 1.0f;
-
- t->flag |= T_NO_CONSTRAINT;
-
-/* warp is done fully in view space */
- calculateCenterCursor(t);
- t->fac = (float)(t->center2d[0] - t->imval[0]);
-
- /* we need min/max in view space */
- for(i = 0; i < t->total; i++) {
- float center[3];
- VECCOPY(center, t->data[i].center);
- Mat3MulVecfl(t->data[i].mtx, center);
- Mat4MulVecfl(t->viewmat, center);
- VecSubf(center, center, t->viewmat[3]);
- if (i)
- MinMax3(min, max, center);
- else {
- VECCOPY(max, center);
- VECCOPY(min, center);
- }
- }
-
- t->center[0]= (min[0]+max[0])/2.0f;
- t->center[1]= (min[1]+max[1])/2.0f;
- t->center[2]= (min[2]+max[2])/2.0f;
-
- if (max[0] == min[0]) max[0] += 0.1; /* not optimal, but flipping is better than invalid garbage (i.e. division by zero!) */
- t->val= (max[0]-min[0])/2.0f; /* t->val is X dimension projected boundbox */
-}
-
-int Warp(TransInfo *t, short mval[2])
-{
- TransData *td = t->data;
- float vec[3], circumfac, dist, phi0, co, si, *curs, cursor[3], gcursor[3];
- int i;
- char str[50];
-
- curs= give_cursor();
- /*
- * gcursor is the one used for helpline.
- * It has to be in the same space as the drawing loop
- * (that means it needs to be in the object's space when in edit mode and
- * in global space in object mode)
- *
- * cursor is used for calculations.
- * It needs to be in view space, but we need to take object's offset
- * into account if in Edit mode.
- */
- VECCOPY(cursor, curs);
- VECCOPY(gcursor, cursor);
- if (t->flag & T_EDIT) {
- VecSubf(cursor, cursor, G.obedit->obmat[3]);
- VecSubf(gcursor, gcursor, G.obedit->obmat[3]);
- Mat3MulVecfl(t->data->smtx, gcursor);
- }
- Mat4MulVecfl(t->viewmat, cursor);
- VecSubf(cursor, cursor, t->viewmat[3]);
-
- /* amount of degrees for warp */
- circumfac= 360.0f * InputHorizontalRatio(t, mval);
-
- snapGrid(t, &circumfac);
- applyNumInput(&t->num, &circumfac);
-
- /* header print for NumInput */
- if (hasNumInput(&t->num)) {
- char c[20];
-
- outputNumInput(&(t->num), c);
-
- sprintf(str, "Warp: %s", c);
- }
- else {
- /* default header print */
- sprintf(str, "Warp: %.3f", circumfac);
- }
-
- circumfac*= (float)(-M_PI/360.0);
-
- for(i = 0; i < t->total; i++, td++) {
- float loc[3];
- if (td->flag & TD_NOACTION)
- break;
-
- if (td->flag & TD_SKIP)
- continue;
-
- /* translate point to center, rotate in such a way that outline==distance */
- VECCOPY(vec, td->iloc);
- Mat3MulVecfl(td->mtx, vec);
- Mat4MulVecfl(t->viewmat, vec);
- VecSubf(vec, vec, t->viewmat[3]);
-
- dist= vec[0]-cursor[0];
-
- /* t->val is X dimension projected boundbox */
- phi0= (circumfac*dist/t->val);
-
- vec[1]= (vec[1]-cursor[1]);
-
- co= (float)cos(phi0);
- si= (float)sin(phi0);
- loc[0]= -si*vec[1]+cursor[0];
- loc[1]= co*vec[1]+cursor[1];
- loc[2]= vec[2];
-
- Mat4MulVecfl(t->viewinv, loc);
- VecSubf(loc, loc, t->viewinv[3]);
- Mat3MulVecfl(td->smtx, loc);
-
- VecSubf(loc, loc, td->iloc);
- VecMulf(loc, td->factor);
- VecAddf(td->loc, td->iloc, loc);
- }
-
- recalcData(t);
-
- headerprint(str);
-
- viewRedrawForce(t);
-
- helpline(t, gcursor);
-
- return 1;
-}
-
-/* ************************** SHEAR *************************** */
-
-void initShear(TransInfo *t)
-{
- t->mode = TFM_SHEAR;
- t->transform = Shear;
- t->handleEvent = handleEventShear;
-
- t->idx_max = 0;
- t->num.idx_max = 0;
- t->snap[0] = 0.0f;
- t->snap[1] = 0.1f;
- t->snap[2] = t->snap[1] * 0.1f;
-
- t->flag |= T_NO_CONSTRAINT;
-}
-
-int handleEventShear(TransInfo *t, unsigned short event, short val)
-{
- int status = 0;
-
- if (event == MIDDLEMOUSE && val)
- {
- // Use customData pointer to signal Shear direction
- if (t->customData == 0)
- t->customData = (void*)1;
- else
- t->customData = 0;
-
- status = 1;
- }
-
- return status;
-}
-
-
-int Shear(TransInfo *t, short mval[2])
-{
- TransData *td = t->data;
- float vec[3];
- float smat[3][3], tmat[3][3], totmat[3][3], persmat[3][3], persinv[3][3];
- float value;
- int i;
- char str[50];
-
- Mat3CpyMat4(persmat, t->viewmat);
- Mat3Inv(persinv, persmat);
-
- // Custom data signals shear direction
- if (t->customData == 0)
- value = 0.05f * InputHorizontalAbsolute(t, mval);
- else
- value = 0.05f * InputVerticalAbsolute(t, mval);
-
- snapGrid(t, &value);
-
- applyNumInput(&t->num, &value);
-
- /* header print for NumInput */
- if (hasNumInput(&t->num)) {
- char c[20];
-
- outputNumInput(&(t->num), c);
-
- sprintf(str, "Shear: %s %s", c, t->proptext);
- }
- else {
- /* default header print */
- sprintf(str, "Shear: %.3f %s", value, t->proptext);
- }
-
- Mat3One(smat);
-
- // Custom data signals shear direction
- if (t->customData == 0)
- smat[1][0] = value;
- else
- smat[0][1] = value;
-
- Mat3MulMat3(tmat, smat, persmat);
- Mat3MulMat3(totmat, persinv, tmat);
-
- for(i = 0 ; i < t->total; i++, td++) {
- if (td->flag & TD_NOACTION)
- break;
-
- if (td->flag & TD_SKIP)
- continue;
-
- if (G.obedit) {
- float mat3[3][3];
- Mat3MulMat3(mat3, totmat, td->mtx);
- Mat3MulMat3(tmat, td->smtx, mat3);
- }
- else {
- Mat3CpyMat3(tmat, totmat);
- }
- VecSubf(vec, td->center, t->center);
-
- Mat3MulVecfl(tmat, vec);
-
- VecAddf(vec, vec, t->center);
- VecSubf(vec, vec, td->center);
-
- VecMulf(vec, td->factor);
-
- VecAddf(td->loc, td->iloc, vec);
- }
-
- recalcData(t);
-
- headerprint(str);
-
- viewRedrawForce(t);
-
- helpline (t, t->center);
-
- return 1;
-}
-
-/* ************************** RESIZE *************************** */
-
-void initResize(TransInfo *t)
-{
- t->mode = TFM_RESIZE;
- t->transform = Resize;
-
- t->flag |= T_NULL_ONE;
- t->num.flag |= NUM_NULL_ONE;
- t->num.flag |= NUM_AFFECT_ALL;
- if (!G.obedit) {
- t->flag |= T_NO_ZERO;
- t->num.flag |= NUM_NO_ZERO;
- }
-
- t->idx_max = 2;
- t->num.idx_max = 2;
- t->snap[0] = 0.0f;
- t->snap[1] = 0.1f;
- t->snap[2] = t->snap[1] * 0.1f;
-
- t->fac = (float)sqrt(
- (
- ((float)(t->center2d[1] - t->imval[1]))*((float)(t->center2d[1] - t->imval[1]))
- +
- ((float)(t->center2d[0] - t->imval[0]))*((float)(t->center2d[0] - t->imval[0]))
- ) );
-
- if(t->fac==0.0f) t->fac= 1.0f; // prevent Inf
-}
-
-static void headerResize(TransInfo *t, float vec[3], char *str) {
- char tvec[60];
- if (hasNumInput(&t->num)) {
- outputNumInput(&(t->num), tvec);
- }
- else {
- sprintf(&tvec[0], "%.4f", vec[0]);
- sprintf(&tvec[20], "%.4f", vec[1]);
- sprintf(&tvec[40], "%.4f", vec[2]);
- }
-
- if (t->con.mode & CON_APPLY) {
- switch(t->num.idx_max) {
- case 0:
- sprintf(str, "Scale: %s%s %s", &tvec[0], t->con.text, t->proptext);
- break;
- case 1:
- sprintf(str, "Scale: %s : %s%s %s", &tvec[0], &tvec[20], t->con.text, t->proptext);
- break;
- case 2:
- sprintf(str, "Scale: %s : %s : %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext);
- }
- }
- else {
- if (t->flag & T_2D_EDIT)
- sprintf(str, "Scale X: %s Y: %s%s %s", &tvec[0], &tvec[20], t->con.text, t->proptext);
- else
- sprintf(str, "Scale X: %s Y: %s Z: %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext);
- }
-}
-
-#define SIGN(a) (a<-FLT_EPSILON?1:a>FLT_EPSILON?2:3)
-#define VECSIGNFLIP(a, b) ((SIGN(a[0]) & SIGN(b[0]))==0 || (SIGN(a[1]) & SIGN(b[1]))==0 || (SIGN(a[2]) & SIGN(b[2]))==0)
-
-/* smat is reference matrix, only scaled */
-static void TransMat3ToSize( float mat[][3], float smat[][3], float *size)
-{
- float vec[3];
-
- VecCopyf(vec, mat[0]);
- size[0]= Normalize(vec);
- VecCopyf(vec, mat[1]);
- size[1]= Normalize(vec);
- VecCopyf(vec, mat[2]);
- size[2]= Normalize(vec);
-
- /* first tried with dotproduct... but the sign flip is crucial */
- if( VECSIGNFLIP(mat[0], smat[0]) ) size[0]= -size[0];
- if( VECSIGNFLIP(mat[1], smat[1]) ) size[1]= -size[1];
- if( VECSIGNFLIP(mat[2], smat[2]) ) size[2]= -size[2];
-}
-
-
-static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) {
- float tmat[3][3], smat[3][3], center[3];
- float vec[3];
-
- if (t->flag & T_EDIT) {
- Mat3MulMat3(smat, mat, td->mtx);
- Mat3MulMat3(tmat, td->smtx, smat);
- }
- else {
- Mat3CpyMat3(tmat, mat);
- }
-
- if (t->con.applySize) {
- t->con.applySize(t, td, tmat);
- }
-
- /* local constraint shouldn't alter center */
- if (t->around == V3D_LOCAL) {
- if (t->flag & T_OBJECT) {
- VECCOPY(center, td->center);
- }
- else if (t->flag & T_EDIT) {
-
- if(G.vd->around==V3D_LOCAL && (G.scene->selectmode & SCE_SELECT_FACE)) {
- VECCOPY(center, td->center);
- }
- else {
- VECCOPY(center, t->center);
- }
- }
- else {
- VECCOPY(center, t->center);
- }
- }
- else {
- VECCOPY(center, t->center);
- }
-
- if (td->ext) {
- float fsize[3];
-
- if (t->flag & (T_OBJECT|T_TEXTURE|T_POSE)) {
- float obsizemat[3][3];
- // Reorient the size mat to fit the oriented object.
- Mat3MulMat3(obsizemat, tmat, td->axismtx);
- //printmatrix3("obsizemat", obsizemat);
- TransMat3ToSize(obsizemat, td->axismtx, fsize);
- //printvecf("fsize", fsize);
- }
- else {
- Mat3ToSize(tmat, fsize);
- }
-
- protectedSizeBits(td->protectflag, fsize);
-
- if ((t->flag & T_V3D_ALIGN)==0) { // align mode doesn't resize objects itself
- /* handle ipokeys? */
- if(td->tdi) {
- TransDataIpokey *tdi= td->tdi;
- /* calculate delta size (equal for size and dsize) */
-
- vec[0]= (tdi->oldsize[0])*(fsize[0] -1.0f) * td->factor;
- vec[1]= (tdi->oldsize[1])*(fsize[1] -1.0f) * td->factor;
- vec[2]= (tdi->oldsize[2])*(fsize[2] -1.0f) * td->factor;
-
- add_tdi_poin(tdi->sizex, tdi->oldsize, vec[0]);
- add_tdi_poin(tdi->sizey, tdi->oldsize+1, vec[1]);
- add_tdi_poin(tdi->sizez, tdi->oldsize+2, vec[2]);
-
- }
- else if((td->flag & TD_SINGLESIZE) && !(t->con.mode & CON_APPLY)){
- /* scale val and reset size */
- *td->val = td->ival * fsize[0] * td->factor;
-
- td->ext->size[0] = td->ext->isize[0];
- td->ext->size[1] = td->ext->isize[1];
- td->ext->size[2] = td->ext->isize[2];
- }
- else {
- /* Reset val if SINGLESIZE but using a constraint */
- if (td->flag & TD_SINGLESIZE)
- *td->val = td->ival;
-
- td->ext->size[0] = td->ext->isize[0] * (fsize[0]) * td->factor;
- td->ext->size[1] = td->ext->isize[1] * (fsize[1]) * td->factor;
- td->ext->size[2] = td->ext->isize[2] * (fsize[2]) * td->factor;
- }
- }
- }
- /* For individual element center, Editmode need to use iloc */
- if (t->flag & T_POINTS)
- VecSubf(vec, td->iloc, center);
- else
- VecSubf(vec, td->center, center);
-
- Mat3MulVecfl(tmat, vec);
-
- VecAddf(vec, vec, center);
- if (t->flag & T_POINTS)
- VecSubf(vec, vec, td->iloc);
- else
- VecSubf(vec, vec, td->center);
-
- VecMulf(vec, td->factor);
-
- if (t->flag & T_OBJECT) {
- Mat3MulVecfl(td->smtx, vec);
- }
-
- protectedTransBits(td->protectflag, vec);
-
- if(td->tdi) {
- TransDataIpokey *tdi= td->tdi;
- add_tdi_poin(tdi->locx, tdi->oldloc, vec[0]);
- add_tdi_poin(tdi->locy, tdi->oldloc+1, vec[1]);
- add_tdi_poin(tdi->locz, tdi->oldloc+2, vec[2]);
- }
- else VecAddf(td->loc, td->iloc, vec);
-}
-
-int Resize(TransInfo *t, short mval[2])
-{
- TransData *td;
- float size[3], mat[3][3];
- float ratio;
- int i;
- char str[200];
-
- /* for manipulator, center handle, the scaling can't be done relative to center */
- if( (t->flag & T_USES_MANIPULATOR) && t->con.mode==0) {
- ratio = 1.0f - ((t->imval[0] - mval[0]) + (t->imval[1] - mval[1]))/100.0f;
- }
- else {
- ratio = InputScaleRatio(t, mval);
-
- /* flip scale, but not for manipulator center handle */
- if ((t->center2d[0] - mval[0]) * (t->center2d[0] - t->imval[0]) +
- (t->center2d[1] - mval[1]) * (t->center2d[1] - t->imval[1]) < 0)
- ratio *= -1.0f;
- }
-
- size[0] = size[1] = size[2] = ratio;
-
- snapGrid(t, size);
-
- if (hasNumInput(&t->num)) {
- applyNumInput(&t->num, size);
- constraintNumInput(t, size);
- }
-
- SizeToMat3(size, mat);
-
- if (t->con.applySize) {
- t->con.applySize(t, NULL, mat);
- }
-
- Mat3CpyMat3(t->mat, mat); // used in manipulator
-
- headerResize(t, size, str);
-
- for(i = 0, td=t->data; i < t->total; i++, td++) {
- if (td->flag & TD_NOACTION)
- break;
-
- if (td->flag & TD_SKIP)
- continue;
-
- ElementResize(t, td, mat);
- }
-
- /* evil hack - redo resize if cliping needed */
- if (t->flag & T_CLIP_UV && clipUVTransform(t, size, 1)) {
- SizeToMat3(size, mat);
-
- if (t->con.applySize)
- t->con.applySize(t, NULL, mat);
-
- for(i = 0, td=t->data; i < t->total; i++, td++)
- ElementResize(t, td, mat);
- }
-
- recalcData(t);
-
- headerprint(str);
-
- viewRedrawForce(t);
-
- if(!(t->flag & T_USES_MANIPULATOR)) helpline (t, t->center);
-
- return 1;
-}
-
-/* ************************** TOSPHERE *************************** */
-
-void initToSphere(TransInfo *t)
-{
- TransData *td = t->data;
- int i;
-
- t->mode = TFM_TOSPHERE;
- t->transform = ToSphere;
-
- t->idx_max = 0;
- t->num.idx_max = 0;
- t->snap[0] = 0.0f;
- t->snap[1] = 0.1f;
- t->snap[2] = t->snap[1] * 0.1f;
-
- t->num.flag |= NUM_NULL_ONE | NUM_NO_NEGATIVE;
- t->flag |= T_NO_CONSTRAINT;
-
- // Calculate average radius
- for(i = 0 ; i < t->total; i++, td++) {
- t->val += VecLenf(t->center, td->iloc);
- }
-
- t->val /= (float)t->total;
-}
-
-int ToSphere(TransInfo *t, short mval[2])
-{
- float vec[3];
- float ratio, radius;
- int i;
- char str[64];
- TransData *td = t->data;
-
- ratio = InputHorizontalRatio(t, mval);
-
- snapGrid(t, &ratio);
-
- applyNumInput(&t->num, &ratio);
-
- if (ratio < 0)
- ratio = 0.0f;
- else if (ratio > 1)
- ratio = 1.0f;
-
- /* header print for NumInput */
- if (hasNumInput(&t->num)) {
- char c[20];
-
- outputNumInput(&(t->num), c);
-
- sprintf(str, "To Sphere: %s %s", c, t->proptext);
- }
- else {
- /* default header print */
- sprintf(str, "To Sphere: %.4f %s", ratio, t->proptext);
- }
-
-
- for(i = 0 ; i < t->total; i++, td++) {
- float tratio;
- if (td->flag & TD_NOACTION)
- break;
-
- if (td->flag & TD_SKIP)
- continue;
-
- VecSubf(vec, td->iloc, t->center);
-
- radius = Normalize(vec);
-
- tratio = ratio * td->factor;
-
- VecMulf(vec, radius * (1.0f - tratio) + t->val * tratio);
-
- VecAddf(td->loc, t->center, vec);
- }
-
-
- recalcData(t);
-
- headerprint(str);
-
- viewRedrawForce(t);
-
- return 1;
-}
-
-/* ************************** ROTATION *************************** */
-
-
-void initRotation(TransInfo *t)
-{
- t->mode = TFM_ROTATION;
- t->transform = Rotation;
-
- t->idx_max = 0;
- t->num.idx_max = 0;
- t->snap[0] = 0.0f;
- t->snap[1] = (float)((5.0/180)*M_PI);
- t->snap[2] = t->snap[1] * 0.2f;
- t->fac = 0;
-
- if (t->flag & T_2D_EDIT)
- t->flag |= T_NO_CONSTRAINT;
-}
-
-static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3]) {
- float vec[3], totmat[3][3], smat[3][3];
- float eul[3], fmat[3][3], quat[4];
-
- if (t->flag & T_POINTS) {
- Mat3MulMat3(totmat, mat, td->mtx);
- Mat3MulMat3(smat, td->smtx, totmat);
-
- VecSubf(vec, td->iloc, t->center);
- Mat3MulVecfl(smat, vec);
-
- VecAddf(td->loc, vec, t->center);
-
- VecSubf(vec,td->loc,td->iloc);
- protectedTransBits(td->protectflag, vec);
- VecAddf(td->loc, td->iloc, vec);
-
- if(td->flag & TD_USEQUAT) {
- Mat3MulSerie(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0);
- Mat3ToQuat(fmat, quat); // Actual transform
-
- if(td->ext->quat){
- QuatMul(td->ext->quat, quat, td->ext->iquat);
-
- /* is there a reason not to have this here? -jahka */
- protectedQuaternionBits(td->protectflag, td->ext->quat, td->ext->iquat);
- }
- }
- }
- /**
- * HACK WARNING
- *
- * This is some VERY ugly special case to deal with pose mode.
- *
- * The problem is that mtx and smtx include each bone orientation.
- *
- * That is needed to rotate each bone properly, HOWEVER, to calculate
- * the translation component, we only need the actual armature object's
- * matrix (and inverse). That is not all though. Once the proper translation
- * has been computed, it has to be converted back into the bone's space.
- */
- else if (t->flag & T_POSE) {
- float pmtx[3][3], imtx[3][3];
-
- // Extract and invert armature object matrix
- Mat3CpyMat4(pmtx, t->poseobj->obmat);
- Mat3Inv(imtx, pmtx);
-
- VecSubf(vec, td->center, t->center);
-
- Mat3MulVecfl(pmtx, vec); // To Global space
- Mat3MulVecfl(mat, vec); // Applying rotation
- Mat3MulVecfl(imtx, vec); // To Local space
-
- VecAddf(vec, vec, t->center);
- /* vec now is the location where the object has to be */
-
- VecSubf(vec, vec, td->center); // Translation needed from the initial location
-
- Mat3MulVecfl(pmtx, vec); // To Global space
- Mat3MulVecfl(td->smtx, vec);// To Pose space
-
- protectedTransBits(td->protectflag, vec);
-
- VecAddf(td->loc, td->iloc, vec);
-
- /* rotation */
- if ((t->flag & T_V3D_ALIGN)==0) { // align mode doesn't rotate objects itself
- Mat3MulSerie(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0);
-
- Mat3ToQuat(fmat, quat); // Actual transform
-
- QuatMul(td->ext->quat, quat, td->ext->iquat);
- /* this function works on end result */
- protectedQuaternionBits(td->protectflag, td->ext->quat, td->ext->iquat);
- }
- }
- else {
- /* translation */
-
- VecSubf(vec, td->center, t->center);
- Mat3MulVecfl(mat, vec);
- VecAddf(vec, vec, t->center);
- /* vec now is the location where the object has to be */
- VecSubf(vec, vec, td->center);
- Mat3MulVecfl(td->smtx, vec);
-
- protectedTransBits(td->protectflag, vec);
-
- if(td->tdi) {
- TransDataIpokey *tdi= td->tdi;
- add_tdi_poin(tdi->locx, tdi->oldloc, vec[0]);
- add_tdi_poin(tdi->locy, tdi->oldloc+1, vec[1]);
- add_tdi_poin(tdi->locz, tdi->oldloc+2, vec[2]);
- }
- else VecAddf(td->loc, td->iloc, vec);
-
- /* rotation */
- if ((t->flag & T_V3D_ALIGN)==0) { // align mode doesn't rotate objects itself
-
- if(td->flag & TD_USEQUAT) {
- Mat3MulSerie(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0);
- Mat3ToQuat(fmat, quat); // Actual transform
-
- QuatMul(td->ext->quat, quat, td->ext->iquat);
- /* this function works on end result */
- protectedQuaternionBits(td->protectflag, td->ext->quat, td->ext->iquat);
- }
- else {
- float obmat[3][3];
-
- /* are there ipo keys? */
- if(td->tdi) {
- TransDataIpokey *tdi= td->tdi;
- float rot[3];
-
- /* calculate the total rotatation in eulers */
- VecAddf(eul, td->ext->irot, td->ext->drot);
- EulToMat3(eul, obmat);
- /* mat = transform, obmat = object rotation */
- Mat3MulMat3(fmat, mat, obmat);
-
- Mat3ToCompatibleEul(fmat, eul, td->ext->irot);
-
- /* correct back for delta rot */
- if(tdi->flag & TOB_IPODROT) {
- VecSubf(rot, eul, td->ext->irot);
- }
- else {
- VecSubf(rot, eul, td->ext->drot);
- }
-
- VecMulf(rot, (float)(9.0/M_PI_2));
- VecSubf(rot, rot, tdi->oldrot);
-
- protectedRotateBits(td->protectflag, rot, tdi->oldrot);
-
- add_tdi_poin(tdi->rotx, tdi->oldrot, rot[0]);
- add_tdi_poin(tdi->roty, tdi->oldrot+1, rot[1]);
- add_tdi_poin(tdi->rotz, tdi->oldrot+2, rot[2]);
- }
- else {
- Mat3MulMat3(totmat, mat, td->mtx);
- Mat3MulMat3(smat, td->smtx, totmat);
-
- /* calculate the total rotatation in eulers */
- VecAddf(eul, td->ext->irot, td->ext->drot); /* we have to correct for delta rot */
- EulToMat3(eul, obmat);
- /* mat = transform, obmat = object rotation */
- Mat3MulMat3(fmat, smat, obmat);
-
- Mat3ToCompatibleEul(fmat, eul, td->ext->irot);
-
- /* correct back for delta rot */
- VecSubf(eul, eul, td->ext->drot);
-
- /* and apply */
- protectedRotateBits(td->protectflag, eul, td->ext->irot);
- VECCOPY(td->ext->rot, eul);
- }
- }
- }
- }
-}
-
-static void applyRotation(TransInfo *t, float angle, float axis[3])
-{
- TransData *td = t->data;
- float mat[3][3], center[3];
- int i;
-
- /* saving original center */
- if (t->around == V3D_LOCAL) {
- VECCOPY(center, t->center);
- }
- else {
- center[0] = center[1] = center[2] = 0.0f;
- }
-
- VecRotToMat3(axis, angle, mat);
-
- for(i = 0 ; i < t->total; i++, td++) {
-
- if (td->flag & TD_NOACTION)
- break;
-
- if (td->flag & TD_SKIP)
- continue;
-
- /* local constraint shouldn't alter center */
- if (t->around == V3D_LOCAL) {
- if (t->flag & (T_OBJECT|T_POSE)) {
- VECCOPY(t->center, td->center);
- }
- else {
- if(G.vd->around==V3D_LOCAL && (G.scene->selectmode & SCE_SELECT_FACE)) {
- VECCOPY(t->center, td->center);
- }
- }
- }
-
- if (t->con.applyRot) {
- t->con.applyRot(t, td, axis);
- VecRotToMat3(axis, angle * td->factor, mat);
- }
- else if (t->flag & T_PROP_EDIT) {
- VecRotToMat3(axis, angle * td->factor, mat);
- }
-
- ElementRotation(t, td, mat);
- }
-
- /* restoring original center */
- if (t->around == V3D_LOCAL) {
- VECCOPY(t->center, center);
- }
-}
-
-int Rotation(TransInfo *t, short mval[2])
-{
- char str[64];
-
- float final;
-
- int dx2 = t->center2d[0] - mval[0];
- int dy2 = t->center2d[1] - mval[1];
- double B = sqrt(dx2*dx2+dy2*dy2);
-
- int dx1 = t->center2d[0] - t->imval[0];
- int dy1 = t->center2d[1] - t->imval[1];
- double A = sqrt(dx1*dx1+dy1*dy1);
-
- int dx3 = mval[0] - t->imval[0];
- int dy3 = mval[1] - t->imval[1];
- /* use doubles here, to make sure a "1.0" (no rotation) doesnt become 9.999999e-01, which gives 0.02 for acos */
- double deler= ((double)((dx1*dx1+dy1*dy1)+(dx2*dx2+dy2*dy2)-(dx3*dx3+dy3*dy3) ))
- / (2.0 * (A*B?A*B:1.0));
- /* (A*B?A*B:1.0f) this takes care of potential divide by zero errors */
-
- float dphi;
-
- float axis[3];
- float mat[3][3];
-
- VECCOPY(axis, t->viewinv[2]);
- VecMulf(axis, -1.0f);
- Normalize(axis);
-
- dphi = saacos((float)deler);
- if( (dx1*dy2-dx2*dy1)>0.0 ) dphi= -dphi;
-
- if(G.qual & LR_SHIFTKEY) t->fac += dphi/30.0f;
- else t->fac += dphi;
-
- /*
- clamping angle between -2 PI and 2 PI (not sure if useful so commented out - theeth)
- if (t->fac >= 2 * M_PI)
- t->fac -= 2 * M_PI;
- else if (t->fac <= -2 * M_PI)
- t->fac -= -2 * M_PI;
- */
-
- final = t->fac;
-
- snapGrid(t, &final);
-
- t->imval[0] = mval[0];
- t->imval[1] = mval[1];
-
- if (t->con.applyRot) {
- t->con.applyRot(t, NULL, axis);
- }
-
- applySnapping(t, &final);
-
- if (hasNumInput(&t->num)) {
- char c[20];
-
- applyNumInput(&t->num, &final);
-
- outputNumInput(&(t->num), c);
-
- sprintf(str, "Rot: %s %s", &c[0], t->proptext);
-
- /* Clamp between -180 and 180 */
- while (final >= 180.0)
- final -= 360.0;
-
- while (final <= -180.0)
- final += 360.0;
-
- final *= (float)(M_PI / 180.0);
- }
- else {
- sprintf(str, "Rot: %.2f%s %s", 180.0*final/M_PI, t->con.text, t->proptext);
- }
-
- VecRotToMat3(axis, final, mat);
-
- t->val = final; // used in manipulator
- Mat3CpyMat3(t->mat, mat); // used in manipulator
-
- applyRotation(t, final, axis);
-
- recalcData(t);
-
- headerprint(str);
-
- viewRedrawForce(t);
-
- if(!(t->flag & T_USES_MANIPULATOR)) helpline (t, t->center);
-
- return 1;
-}
-
-
-/* ************************** TRACKBALL *************************** */
-
-void initTrackball(TransInfo *t)
-{
- t->mode = TFM_TRACKBALL;
- t->transform = Trackball;
-
- t->idx_max = 1;
- t->num.idx_max = 1;
- t->snap[0] = 0.0f;
- t->snap[1] = (float)((5.0/180)*M_PI);
- t->snap[2] = t->snap[1] * 0.2f;
- t->fac = 0;
-
- t->flag |= T_NO_CONSTRAINT;
-}
-
-static void applyTrackball(TransInfo *t, float axis1[3], float axis2[3], float angles[2])
-{
- TransData *td = t->data;
- float mat[3][3], smat[3][3], totmat[3][3];
- float center[3];
- int i;
-
- VecRotToMat3(axis1, angles[0], smat);
- VecRotToMat3(axis2, angles[1], totmat);
-
- Mat3MulMat3(mat, smat, totmat);
-
- for(i = 0 ; i < t->total; i++, td++) {
- if (td->flag & TD_NOACTION)
- break;
-
- if (td->flag & TD_SKIP)
- continue;
-
- VECCOPY(center, t->center);
-
- if (t->around == V3D_LOCAL) {
- /* local-mode shouldn't change center */
- if (t->flag & (T_OBJECT|T_POSE)) {
- VECCOPY(t->center, td->center);
- }
- else {
- if(G.vd->around==V3D_LOCAL && (G.scene->selectmode & SCE_SELECT_FACE)) {
- VECCOPY(t->center, td->center);
- }
- }
- }
-
- if (t->flag & T_PROP_EDIT) {
- VecRotToMat3(axis1, td->factor * angles[0], smat);
- VecRotToMat3(axis2, td->factor * angles[1], totmat);
-
- Mat3MulMat3(mat, smat, totmat);
- }
-
- ElementRotation(t, td, mat);
-
- VECCOPY(t->center, center);
- }
-}
-
-int Trackball(TransInfo *t, short mval[2])
-{
- char str[128];
- float axis1[3], axis2[3];
- float mat[3][3], totmat[3][3], smat[3][3];
- float phi[2];
-
- VECCOPY(axis1, t->persinv[0]);
- VECCOPY(axis2, t->persinv[1]);
- Normalize(axis1);
- Normalize(axis2);
-
- /* factore has to become setting or so */
- phi[0]= 0.01f*(float)( t->imval[1] - mval[1] );
- phi[1]= 0.01f*(float)( mval[0] - t->imval[0] );
-
- //if(G.qual & LR_SHIFTKEY) t->fac += dphi/30.0f;
- //else t->fac += dphi;
-
- snapGrid(t, phi);
-
- if (hasNumInput(&t->num)) {
- char c[40];
-
- applyNumInput(&t->num, phi);
-
- outputNumInput(&(t->num), c);
-
- sprintf(str, "Trackball: %s %s %s", &c[0], &c[20], t->proptext);
-
- phi[0] *= (float)(M_PI / 180.0);
- phi[1] *= (float)(M_PI / 180.0);
- }
- else {
- sprintf(str, "Trackball: %.2f %.2f %s", 180.0*phi[0]/M_PI, 180.0*phi[1]/M_PI, t->proptext);
- }
-
- VecRotToMat3(axis1, phi[0], smat);
- VecRotToMat3(axis2, phi[1], totmat);
-
- Mat3MulMat3(mat, smat, totmat);
-
- Mat3CpyMat3(t->mat, mat); // used in manipulator
-
- applyTrackball(t, axis1, axis2, phi);
-
- recalcData(t);
-
- headerprint(str);
-
- viewRedrawForce(t);
-
- if(!(t->flag & T_USES_MANIPULATOR)) helpline (t, t->center);
-
- return 1;
-}
-
-/* ************************** TRANSLATION *************************** */
-
-void initTranslation(TransInfo *t)
-{
- t->mode = TFM_TRANSLATION;
- t->transform = Translation;
-
- t->idx_max = (t->flag & T_2D_EDIT)? 1: 2;
- t->num.flag = 0;
- t->num.idx_max = t->idx_max;
-
-
- if(t->spacetype == SPACE_VIEW3D) {
- /* initgrabz() defines a factor for perspective depth correction, used in window_to_3d() */
- if(t->flag & (T_EDIT|T_POSE)) {
- Object *ob= G.obedit?G.obedit:t->poseobj;
- float vec[3];
-
- VECCOPY(vec, t->center);
- Mat4MulVecfl(ob->obmat, vec);
- initgrabz(vec[0], vec[1], vec[2]);
- }
- else {
- initgrabz(t->center[0], t->center[1], t->center[2]);
- }
-
- t->snap[0] = 0.0f;
- t->snap[1] = G.vd->gridview * 1.0f;
- t->snap[2] = t->snap[1] * 0.1f;
- }
- else if(t->spacetype == SPACE_IMAGE) {
- t->snap[0] = 0.0f;
- t->snap[1] = 0.125f;
- t->snap[2] = 0.0625f;
- }
- else {
- t->snap[0] = 0.0f;
- t->snap[1] = t->snap[2] = 1.0f;
- }
-}
-
-static void headerTranslation(TransInfo *t, float vec[3], char *str) {
- char tvec[60];
- char distvec[20];
- char autoik[20];
- float dvec[3];
- float dist;
-
- convertVecToDisplayNum(vec, dvec);
-
- if (hasNumInput(&t->num)) {
- outputNumInput(&(t->num), tvec);
- dist = VecLength(t->num.val);
- }
- else {
- dist = VecLength(vec);
- sprintf(&tvec[0], "%.4f", dvec[0]);
- sprintf(&tvec[20], "%.4f", dvec[1]);
- sprintf(&tvec[40], "%.4f", dvec[2]);
- }
-
- if( dist > 1e10 || dist < -1e10 ) /* prevent string buffer overflow */
- sprintf(distvec, "%.4e", dist);
- else
- sprintf(distvec, "%.4f", dist);
-
- if(t->flag & T_AUTOIK) {
- short chainlen= G.scene->toolsettings->autoik_chainlen;
-
- if(chainlen)
- sprintf(autoik, "AutoIK-Len: %d", chainlen);
- else
- strcpy(autoik, "");
- }
- else
- strcpy(autoik, "");
-
- if (t->con.mode & CON_APPLY) {
- switch(t->num.idx_max) {
- case 0:
- sprintf(str, "D: %s (%s)%s %s %s", &tvec[0], distvec, t->con.text, t->proptext, &autoik[0]);
- break;
- case 1:
- sprintf(str, "D: %s D: %s (%s)%s %s %s", &tvec[0], &tvec[20], distvec, t->con.text, t->proptext, &autoik[0]);
- break;
- case 2:
- sprintf(str, "D: %s D: %s D: %s (%s)%s %s %s", &tvec[0], &tvec[20], &tvec[40], distvec, t->con.text, t->proptext, &autoik[0]);
- }
- }
- else {
- if(t->flag & T_2D_EDIT)
- sprintf(str, "Dx: %s Dy: %s (%s)%s %s", &tvec[0], &tvec[20], distvec, t->con.text, t->proptext);
- else
- sprintf(str, "Dx: %s Dy: %s Dz: %s (%s)%s %s %s", &tvec[0], &tvec[20], &tvec[40], distvec, t->con.text, t->proptext, &autoik[0]);
- }
-}
-
-static void applyTranslation(TransInfo *t, float vec[3]) {
- TransData *td = t->data;
- float tvec[3];
- int i;
-
- for(i = 0 ; i < t->total; i++, td++) {
- if (td->flag & TD_NOACTION)
- break;
-
- if (td->flag & TD_SKIP)
- continue;
-
- if (t->con.applyVec) {
- float pvec[3];
- t->con.applyVec(t, td, vec, tvec, pvec);
- }
- else {
- VECCOPY(tvec, vec);
- }
-
- Mat3MulVecfl(td->smtx, tvec);
- VecMulf(tvec, td->factor);
-
- protectedTransBits(td->protectflag, tvec);
-
- /* transdata ipokey */
- if(td->tdi) {
- TransDataIpokey *tdi= td->tdi;
- add_tdi_poin(tdi->locx, tdi->oldloc, tvec[0]);
- add_tdi_poin(tdi->locy, tdi->oldloc+1, tvec[1]);
- add_tdi_poin(tdi->locz, tdi->oldloc+2, tvec[2]);
- }
- else VecAddf(td->loc, td->iloc, tvec);
-
- constraintTransLim(t, td);
- }
-}
-
-/* uses t->vec to store actual translation in */
-int Translation(TransInfo *t, short mval[2])
-{
- float tvec[3];
- char str[250];
-
- if(t->flag & T_SHIFT_MOD) {
- float dvec[3];
- /* calculate the main translation and the precise one separate */
- convertViewVec(t, dvec, (short)(mval[0] - t->shiftmval[0]), (short)(mval[1] - t->shiftmval[1]));
- VecMulf(dvec, 0.1f);
- convertViewVec(t, t->vec, (short)(t->shiftmval[0] - t->imval[0]), (short)(t->shiftmval[1] - t->imval[1]));
- VecAddf(t->vec, t->vec, dvec);
- }
- else convertViewVec(t, t->vec, (short)(mval[0] - t->imval[0]), (short)(mval[1] - t->imval[1]));
-
- if (t->con.mode & CON_APPLY) {
- float pvec[3] = {0.0f, 0.0f, 0.0f};
- applySnapping(t, t->vec);
- t->con.applyVec(t, NULL, t->vec, tvec, pvec);
- VECCOPY(t->vec, tvec);
- headerTranslation(t, pvec, str);
- }
- else {
- snapGrid(t, t->vec);
- applyNumInput(&t->num, t->vec);
- applySnapping(t, t->vec);
- headerTranslation(t, t->vec, str);
- }
-
- applyTranslation(t, t->vec);
-
- /* evil hack - redo translation if cliiping needeed */
- if (t->flag & T_CLIP_UV && clipUVTransform(t, t->vec, 0))
- applyTranslation(t, t->vec);
-
- recalcData(t);
-
- headerprint(str);
-
- viewRedrawForce(t);
-
- drawSnapping(t);
-
- return 1;
-}
-
-/* ************************** SHRINK/FATTEN *************************** */
-
-void initShrinkFatten(TransInfo *t)
-{
- // If not in mesh edit mode, fallback to Resize
- if (G.obedit==NULL || G.obedit->type != OB_MESH) {
- initResize(t);
- }
- else {
- t->mode = TFM_SHRINKFATTEN;
- t->transform = ShrinkFatten;
-
- t->idx_max = 0;
- t->num.idx_max = 0;
- t->snap[0] = 0.0f;
- t->snap[1] = 1.0f;
- t->snap[2] = t->snap[1] * 0.1f;
-
- t->flag |= T_NO_CONSTRAINT;
- }
-}
-
-
-
-int ShrinkFatten(TransInfo *t, short mval[2])
-{
- float vec[3];
- float distance;
- int i;
- char str[64];
- TransData *td = t->data;
-
- distance = -InputVerticalAbsolute(t, mval);
-
- snapGrid(t, &distance);
-
- applyNumInput(&t->num, &distance);
-
- /* header print for NumInput */
- if (hasNumInput(&t->num)) {
- char c[20];
-
- outputNumInput(&(t->num), c);
-
- sprintf(str, "Shrink/Fatten: %s %s", c, t->proptext);
- }
- else {
- /* default header print */
- sprintf(str, "Shrink/Fatten: %.4f %s", distance, t->proptext);
- }
-
-
- for(i = 0 ; i < t->total; i++, td++) {
- if (td->flag & TD_NOACTION)
- break;
-
- if (td->flag & TD_SKIP)
- continue;
-
- VECCOPY(vec, td->axismtx[2]);
- VecMulf(vec, distance);
- VecMulf(vec, td->factor);
-
- VecAddf(td->loc, td->iloc, vec);
- }
-
- recalcData(t);
-
- headerprint(str);
-
- viewRedrawForce(t);
-
- return 1;
-}
-
-/* ************************** TILT *************************** */
-
-void initTilt(TransInfo *t)
-{
- t->mode = TFM_TILT;
- t->transform = Tilt;
-
- t->idx_max = 0;
- t->num.idx_max = 0;
- t->snap[0] = 0.0f;
- t->snap[1] = (float)((5.0/180)*M_PI);
- t->snap[2] = t->snap[1] * 0.2f;
- t->fac = 0;
-
- t->flag |= T_NO_CONSTRAINT;
-}
-
-
-
-int Tilt(TransInfo *t, short mval[2])
-{
- TransData *td = t->data;
- int i;
- char str[50];
-
- float final;
-
- int dx2 = t->center2d[0] - mval[0];
- int dy2 = t->center2d[1] - mval[1];
- float B = (float)sqrt(dx2*dx2+dy2*dy2);
-
- int dx1 = t->center2d[0] - t->imval[0];
- int dy1 = t->center2d[1] - t->imval[1];
- float A = (float)sqrt(dx1*dx1+dy1*dy1);
-
- int dx3 = mval[0] - t->imval[0];
- int dy3 = mval[1] - t->imval[1];
-
- float deler= ((dx1*dx1+dy1*dy1)+(dx2*dx2+dy2*dy2)-(dx3*dx3+dy3*dy3))
- / (2 * A * B);
-
- float dphi;
-
- dphi = saacos(deler);
- if( (dx1*dy2-dx2*dy1)>0.0 ) dphi= -dphi;
-
- if(G.qual & LR_SHIFTKEY) t->fac += dphi/30.0f;
- else t->fac += dphi;
-
- final = t->fac;
-
- snapGrid(t, &final);
-
- t->imval[0] = mval[0];
- t->imval[1] = mval[1];
-
- if (hasNumInput(&t->num)) {
- char c[20];
-
- applyNumInput(&t->num, &final);
-
- outputNumInput(&(t->num), c);
-
- sprintf(str, "Tilt: %s %s", &c[0], t->proptext);
-
- final *= (float)(M_PI / 180.0);
- }
- else {
- sprintf(str, "Tilt: %.2f %s", 180.0*final/M_PI, t->proptext);
- }
-
- for(i = 0 ; i < t->total; i++, td++) {
- if (td->flag & TD_NOACTION)
- break;
-
- if (td->flag & TD_SKIP)
- continue;
-
- if (td->val) {
- *td->val = td->ival + final * td->factor;
- }
- }
-
- recalcData(t);
-
- headerprint(str);
-
- viewRedrawForce(t);
-
- helpline (t, t->center);
-
- return 1;
-}
-
-
-/* ******************** Curve Shrink/Fatten *************** */
-
-int CurveShrinkFatten(TransInfo *t, short mval[2])
-{
- TransData *td = t->data;
- float ratio;
- int i;
- char str[50];
-
- if(t->flag & T_SHIFT_MOD) {
- /* calculate ratio for shiftkey pos, and for total, and blend these for precision */
- float dx= (float)(t->center2d[0] - t->shiftmval[0]);
- float dy= (float)(t->center2d[1] - t->shiftmval[1]);
- ratio = (float)sqrt( dx*dx + dy*dy)/t->fac;
-
- dx= (float)(t->center2d[0] - mval[0]);
- dy= (float)(t->center2d[1] - mval[1]);
- ratio+= 0.1f*(float)(sqrt( dx*dx + dy*dy)/t->fac -ratio);
-
- }
- else {
- float dx= (float)(t->center2d[0] - mval[0]);
- float dy= (float)(t->center2d[1] - mval[1]);
- ratio = (float)sqrt( dx*dx + dy*dy)/t->fac;
- }
-
- snapGrid(t, &ratio);
-
- applyNumInput(&t->num, &ratio);
-
- /* header print for NumInput */
- if (hasNumInput(&t->num)) {
- char c[20];
-
- outputNumInput(&(t->num), c);
- sprintf(str, "Shrink/Fatten: %s", c);
- }
- else {
- sprintf(str, "Shrink/Fatten: %3f", ratio);
- }
-
- for(i = 0 ; i < t->total; i++, td++) {
- if (td->flag & TD_NOACTION)
- break;
-
- if (td->flag & TD_SKIP)
- continue;
-
- if(td->val) {
- //*td->val= ratio;
- *td->val= td->ival*ratio;
- if (*td->val <= 0.0f) *td->val = 0.0001f;
- }
- }
-
- recalcData(t);
-
- headerprint(str);
-
- viewRedrawForce(t);
-
- if(!(t->flag & T_USES_MANIPULATOR)) helpline (t, t->center);
-
- return 1;
-}
-
-void initCurveShrinkFatten(TransInfo *t)
-{
- t->mode = TFM_CURVE_SHRINKFATTEN;
- t->transform = CurveShrinkFatten;
-
- t->idx_max = 0;
- t->num.idx_max = 0;
- t->snap[0] = 0.0f;
- t->snap[1] = 0.1f;
- t->snap[2] = t->snap[1] * 0.1f;
-
- t->flag |= T_NO_CONSTRAINT;
-
- t->fac = (float)sqrt( (
- ((float)(t->center2d[1] - t->imval[1]))*((float)(t->center2d[1] - t->imval[1]))
- +
- ((float)(t->center2d[0] - t->imval[0]))*((float)(t->center2d[0] - t->imval[0]))
- ) );
-}
-
-/* ************************** PUSH/PULL *************************** */
-
-void initPushPull(TransInfo *t)
-{
- t->mode = TFM_PUSHPULL;
- t->transform = PushPull;
-
- t->idx_max = 0;
- t->num.idx_max = 0;
- t->snap[0] = 0.0f;
- t->snap[1] = 1.0f;
- t->snap[2] = t->snap[1] * 0.1f;
-}
-
-
-int PushPull(TransInfo *t, short mval[2])
-{
- float vec[3], axis[3];
- float distance;
- int i;
- char str[128];
- TransData *td = t->data;
-
- distance = InputVerticalAbsolute(t, mval);
-
- snapGrid(t, &distance);
-
- applyNumInput(&t->num, &distance);
-
- /* header print for NumInput */
- if (hasNumInput(&t->num)) {
- char c[20];
-
- outputNumInput(&(t->num), c);
-
- sprintf(str, "Push/Pull: %s%s %s", c, t->con.text, t->proptext);
- }
- else {
- /* default header print */
- sprintf(str, "Push/Pull: %.4f%s %s", distance, t->con.text, t->proptext);
- }
-
- if (t->con.applyRot && t->con.mode & CON_APPLY) {
- t->con.applyRot(t, NULL, axis);
- }
-
- for(i = 0 ; i < t->total; i++, td++) {
- if (td->flag & TD_NOACTION)
- break;
-
- if (td->flag & TD_SKIP)
- continue;
-
- VecSubf(vec, t->center, td->center);
- if (t->con.applyRot && t->con.mode & CON_APPLY) {
- t->con.applyRot(t, td, axis);
- if (isLockConstraint(t)) {
- float dvec[3];
- Projf(dvec, vec, axis);
- VecSubf(vec, vec, dvec);
- }
- else {
- Projf(vec, vec, axis);
- }
- }
- Normalize(vec);
- VecMulf(vec, distance);
- VecMulf(vec, td->factor);
-
- VecAddf(td->loc, td->iloc, vec);
- }
-
- recalcData(t);
-
- headerprint(str);
-
- viewRedrawForce(t);
-
- return 1;
-}
-
-/* ************************** CREASE *************************** */
-
-void initCrease(TransInfo *t)
-{
- t->mode = TFM_CREASE;
- t->transform = Crease;
-
- t->idx_max = 0;
- t->num.idx_max = 0;
- t->snap[0] = 0.0f;
- t->snap[1] = 0.1f;
- t->snap[2] = t->snap[1] * 0.1f;
-
- t->flag |= T_NO_CONSTRAINT;
-
- t->fac = (float)sqrt(
- (
- ((float)(t->center2d[1] - t->imval[1]))*((float)(t->center2d[1] - t->imval[1]))
- +
- ((float)(t->center2d[0] - t->imval[0]))*((float)(t->center2d[0] - t->imval[0]))
- ) );
-
- if(t->fac==0.0f) t->fac= 1.0f; // prevent Inf
-}
-
-int Crease(TransInfo *t, short mval[2])
-{
- TransData *td = t->data;
- float crease;
- int i;
- char str[50];
-
-
- if(t->flag & T_SHIFT_MOD) {
- /* calculate ratio for shiftkey pos, and for total, and blend these for precision */
- float dx= (float)(t->center2d[0] - t->shiftmval[0]);
- float dy= (float)(t->center2d[1] - t->shiftmval[1]);
- crease = (float)sqrt( dx*dx + dy*dy)/t->fac;
-
- dx= (float)(t->center2d[0] - mval[0]);
- dy= (float)(t->center2d[1] - mval[1]);
- crease+= 0.1f*(float)(sqrt( dx*dx + dy*dy)/t->fac -crease);
-
- }
- else {
- float dx= (float)(t->center2d[0] - mval[0]);
- float dy= (float)(t->center2d[1] - mval[1]);
- crease = (float)sqrt( dx*dx + dy*dy)/t->fac;
- }
-
- crease -= 1.0f;
- if (crease > 1.0f) crease = 1.0f;
-
- snapGrid(t, &crease);
-
- applyNumInput(&t->num, &crease);
-
- /* header print for NumInput */
- if (hasNumInput(&t->num)) {
- char c[20];
-
- outputNumInput(&(t->num), c);
-
- if (crease >= 0.0f)
- sprintf(str, "Crease: +%s %s", c, t->proptext);
- else
- sprintf(str, "Crease: %s %s", c, t->proptext);
- }
- else {
- /* default header print */
- if (crease >= 0.0f)
- sprintf(str, "Crease: +%.3f %s", crease, t->proptext);
- else
- sprintf(str, "Crease: %.3f %s", crease, t->proptext);
- }
-
- for(i = 0 ; i < t->total; i++, td++) {
- if (td->flag & TD_NOACTION)
- break;
-
- if (td->flag & TD_SKIP)
- continue;
-
- if (td->val) {
- *td->val = td->ival + crease * td->factor;
- if (*td->val < 0.0f) *td->val = 0.0f;
- if (*td->val > 1.0f) *td->val = 1.0f;
- }
- }
-
- recalcData(t);
-
- headerprint(str);
-
- viewRedrawForce(t);
-
- helpline (t, t->center);
-
- return 1;
-}
-
-/* ******************** EditBone (B-bone) width scaling *************** */
-
-void initBoneSize(TransInfo *t)
-{
- t->mode = TFM_BONESIZE;
- t->transform = BoneSize;
-
- t->idx_max = 2;
- t->num.idx_max = 2;
- t->num.flag |= NUM_NULL_ONE;
- t->snap[0] = 0.0f;
- t->snap[1] = 0.1f;
- t->snap[2] = t->snap[1] * 0.1f;
-
- t->fac = (float)sqrt( (
- ((float)(t->center2d[1] - t->imval[1]))*((float)(t->center2d[1] - t->imval[1]))
- +
- ((float)(t->center2d[0] - t->imval[0]))*((float)(t->center2d[0] - t->imval[0]))
- ) );
-
- if(t->fac==0.0f) t->fac= 1.0f; // prevent Inf
-}
-
-static void headerBoneSize(TransInfo *t, float vec[3], char *str) {
- char tvec[60];
- if (hasNumInput(&t->num)) {
- outputNumInput(&(t->num), tvec);
- }
- else {
- sprintf(&tvec[0], "%.4f", vec[0]);
- sprintf(&tvec[20], "%.4f", vec[1]);
- sprintf(&tvec[40], "%.4f", vec[2]);
- }
-
- /* hmm... perhaps the y-axis values don't need to be shown? */
- if (t->con.mode & CON_APPLY) {
- if (t->num.idx_max == 0)
- sprintf(str, "ScaleB: %s%s %s", &tvec[0], t->con.text, t->proptext);
- else
- sprintf(str, "ScaleB: %s : %s : %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext);
- }
- else {
- sprintf(str, "ScaleB X: %s Y: %s Z: %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext);
- }
-}
-
-static void ElementBoneSize(TransInfo *t, TransData *td, float mat[3][3])
-{
- float tmat[3][3], smat[3][3], oldy;
- float sizemat[3][3];
-
- Mat3MulMat3(smat, mat, td->mtx);
- Mat3MulMat3(tmat, td->smtx, smat);
-
- if (t->con.applySize) {
- t->con.applySize(t, td, tmat);
- }
-
- /* we've tucked the scale in loc */
- oldy= td->iloc[1];
- SizeToMat3(td->iloc, sizemat);
- Mat3MulMat3(tmat, tmat, sizemat);
- Mat3ToSize(tmat, td->loc);
- td->loc[1]= oldy;
-}
-
-int BoneSize(TransInfo *t, short mval[2])
-{
- TransData *td = t->data;
- float size[3], mat[3][3];
- float ratio;
- int i;
- char str[60];
-
- /* for manipulator, center handle, the scaling can't be done relative to center */
- if( (t->flag & T_USES_MANIPULATOR) && t->con.mode==0) {
- ratio = 1.0f - ((t->imval[0] - mval[0]) + (t->imval[1] - mval[1]))/100.0f;
- }
- else {
-
- if(t->flag & T_SHIFT_MOD) {
- /* calculate ratio for shiftkey pos, and for total, and blend these for precision */
- float dx= (float)(t->center2d[0] - t->shiftmval[0]);
- float dy= (float)(t->center2d[1] - t->shiftmval[1]);
- ratio = (float)sqrt( dx*dx + dy*dy)/t->fac;
-
- dx= (float)(t->center2d[0] - mval[0]);
- dy= (float)(t->center2d[1] - mval[1]);
- ratio+= 0.1f*(float)(sqrt( dx*dx + dy*dy)/t->fac -ratio);
-
- }
- else {
- float dx= (float)(t->center2d[0] - mval[0]);
- float dy= (float)(t->center2d[1] - mval[1]);
- ratio = (float)sqrt( dx*dx + dy*dy)/t->fac;
- }
-
- /* flip scale, but not for manipulator center handle */
- if ((t->center2d[0] - mval[0]) * (t->center2d[0] - t->imval[0]) +
- (t->center2d[1] - mval[1]) * (t->center2d[1] - t->imval[1]) < 0)
- ratio *= -1.0f;
- }
-
- size[0] = size[1] = size[2] = ratio;
-
- snapGrid(t, size);
-
- if (hasNumInput(&t->num)) {
- applyNumInput(&t->num, size);
- constraintNumInput(t, size);
- }
-
- SizeToMat3(size, mat);
-
- if (t->con.applySize) {
- t->con.applySize(t, NULL, mat);
- }
-
- Mat3CpyMat3(t->mat, mat); // used in manipulator
-
- headerBoneSize(t, size, str);
-
- for(i = 0 ; i < t->total; i++, td++) {
- if (td->flag & TD_NOACTION)
- break;
-
- if (td->flag & TD_SKIP)
- continue;
-
- ElementBoneSize(t, td, mat);
- }
-
- recalcData(t);
-
- headerprint(str);
-
- viewRedrawForce(t);
-
- if(!(t->flag & T_USES_MANIPULATOR)) helpline (t, t->center);
-
- return 1;
-}
-
-
-/* ******************** EditBone envelope *************** */
-
-void initBoneEnvelope(TransInfo *t)
-{
- t->mode = TFM_BONE_ENVELOPE;
- t->transform = BoneEnvelope;
-
- t->idx_max = 0;
- t->num.idx_max = 0;
- t->snap[0] = 0.0f;
- t->snap[1] = 0.1f;
- t->snap[2] = t->snap[1] * 0.1f;
-
- t->flag |= T_NO_CONSTRAINT;
-
- t->fac = (float)sqrt( (
- ((float)(t->center2d[1] - t->imval[1]))*((float)(t->center2d[1] - t->imval[1]))
- +
- ((float)(t->center2d[0] - t->imval[0]))*((float)(t->center2d[0] - t->imval[0]))
- ) );
-
- if(t->fac==0.0f) t->fac= 1.0f; // prevent Inf
-}
-
-int BoneEnvelope(TransInfo *t, short mval[2])
-{
- TransData *td = t->data;
- float ratio;
- int i;
- char str[50];
-
- if(t->flag & T_SHIFT_MOD) {
- /* calculate ratio for shiftkey pos, and for total, and blend these for precision */
- float dx= (float)(t->center2d[0] - t->shiftmval[0]);
- float dy= (float)(t->center2d[1] - t->shiftmval[1]);
- ratio = (float)sqrt( dx*dx + dy*dy)/t->fac;
-
- dx= (float)(t->center2d[0] - mval[0]);
- dy= (float)(t->center2d[1] - mval[1]);
- ratio+= 0.1f*(float)(sqrt( dx*dx + dy*dy)/t->fac -ratio);
-
- }
- else {
- float dx= (float)(t->center2d[0] - mval[0]);
- float dy= (float)(t->center2d[1] - mval[1]);
- ratio = (float)sqrt( dx*dx + dy*dy)/t->fac;
- }
-
- snapGrid(t, &ratio);
-
- applyNumInput(&t->num, &ratio);
-
- /* header print for NumInput */
- if (hasNumInput(&t->num)) {
- char c[20];
-
- outputNumInput(&(t->num), c);
- sprintf(str, "Envelope: %s", c);
- }
- else {
- sprintf(str, "Envelope: %3f", ratio);
- }
-
- for(i = 0 ; i < t->total; i++, td++) {
- if (td->flag & TD_NOACTION)
- break;
-
- if (td->flag & TD_SKIP)
- continue;
-
- if (td->val) {
- /* if the old/original value was 0.0f, then just use ratio */
- if (td->ival)
- *td->val= td->ival*ratio;
- else
- *td->val= ratio;
- }
- }
-
- recalcData(t);
-
- headerprint(str);
-
- force_draw(0);
-
- if(!(t->flag & T_USES_MANIPULATOR)) helpline (t, t->center);
-
- return 1;
-}
-
-
-/* ******************** EditBone roll *************** */
-
-void initBoneRoll(TransInfo *t)
-{
- t->mode = TFM_BONE_ROLL;
- t->transform = BoneRoll;
-
- t->idx_max = 0;
- t->num.idx_max = 0;
- t->snap[0] = 0.0f;
- t->snap[1] = (float)((5.0/180)*M_PI);
- t->snap[2] = t->snap[1] * 0.2f;
-
- t->fac = 0.0f;
-
- t->flag |= T_NO_CONSTRAINT;
-}
-
-int BoneRoll(TransInfo *t, short mval[2])
-{
- TransData *td = t->data;
- int i;
- char str[50];
-
- float final;
-
- int dx2 = t->center2d[0] - mval[0];
- int dy2 = t->center2d[1] - mval[1];
- double B = sqrt(dx2*dx2+dy2*dy2);
-
- int dx1 = t->center2d[0] - t->imval[0];
- int dy1 = t->center2d[1] - t->imval[1];
- double A = sqrt(dx1*dx1+dy1*dy1);
-
- int dx3 = mval[0] - t->imval[0];
- int dy3 = mval[1] - t->imval[1];
- /* use doubles here, to make sure a "1.0" (no rotation) doesnt become 9.999999e-01, which gives 0.02 for acos */
- double deler= ((double)((dx1*dx1+dy1*dy1)+(dx2*dx2+dy2*dy2)-(dx3*dx3+dy3*dy3) ))
- / (2.0 * (A*B?A*B:1.0));
- /* (A*B?A*B:1.0f) this takes care of potential divide by zero errors */
-
- float dphi;
-
- dphi = saacos((float)deler);
- if( (dx1*dy2-dx2*dy1)>0.0 ) dphi= -dphi;
-
- if(G.qual & LR_SHIFTKEY) t->fac += dphi/30.0f;
- else t->fac += dphi;
-
- final = t->fac;
-
- snapGrid(t, &final);
-
- t->imval[0] = mval[0];
- t->imval[1] = mval[1];
-
- if (hasNumInput(&t->num)) {
- char c[20];
-
- applyNumInput(&t->num, &final);
-
- outputNumInput(&(t->num), c);
-
- sprintf(str, "Roll: %s", &c[0]);
-
- final *= (float)(M_PI / 180.0);
- }
- else {
- sprintf(str, "Roll: %.2f", 180.0*final/M_PI);
- }
-
- /* set roll values */
- for (i = 0; i < t->total; i++, td++) {
- if (td->flag & TD_NOACTION)
- break;
-
- if (td->flag & TD_SKIP)
- continue;
-
- *(td->val) = td->ival - final;
- }
-
- recalcData(t);
-
- headerprint(str);
-
- viewRedrawForce(t);
-
- if(!(t->flag & T_USES_MANIPULATOR)) helpline (t, t->center);
-
- return 1;
-}
-
-/* ************************** BAKE TIME ******************* */
-
-void initBakeTime(TransInfo *t)
-{
- t->idx_max = 0;
- t->num.idx_max = 0;
- t->snap[0] = 0.0f;
- t->snap[1] = 1.0f;
- t->snap[2] = t->snap[1] * 0.1f;
- t->transform = BakeTime;
- t->fac = 0.1f;
-}
-
-int BakeTime(TransInfo *t, short mval[2])
-{
- TransData *td = t->data;
- float time;
- int i;
- char str[50];
-
-
- if(t->flag & T_SHIFT_MOD) {
- /* calculate ratio for shiftkey pos, and for total, and blend these for precision */
- time= (float)(t->center2d[0] - t->shiftmval[0])*t->fac;
- time+= 0.1f*((float)(t->center2d[0]*t->fac - mval[0]) -time);
- }
- else {
- time = (float)(t->center2d[0] - mval[0])*t->fac;
- }
-
- snapGrid(t, &time);
-
- applyNumInput(&t->num, &time);
-
- /* header print for NumInput */
- if (hasNumInput(&t->num)) {
- char c[20];
-
- outputNumInput(&(t->num), c);
-
- if (time >= 0.0f)
- sprintf(str, "Time: +%s %s", c, t->proptext);
- else
- sprintf(str, "Time: %s %s", c, t->proptext);
- }
- else {
- /* default header print */
- if (time >= 0.0f)
- sprintf(str, "Time: +%.3f %s", time, t->proptext);
- else
- sprintf(str, "Time: %.3f %s", time, t->proptext);
- }
-
- for(i = 0 ; i < t->total; i++, td++) {
- if (td->flag & TD_NOACTION)
- break;
-
- if (td->flag & TD_SKIP)
- continue;
-
- if (td->val) {
- *td->val = td->ival + time * td->factor;
- if (td->ext->size && *td->val < *td->ext->size) *td->val = *td->ext->size;
- if (td->ext->quat && *td->val > *td->ext->quat) *td->val = *td->ext->quat;
- }
- }
-
- recalcData(t);
-
- headerprint(str);
-
- viewRedrawForce(t);
-
- helpline (t, t->center);
-
- return 1;
-}
-
-
-/* ************************** MIRROR *************************** */
-
-void Mirror(short mode)
-{
- TransData *td;
- float mati[3][3], matview[3][3], mat[3][3];
- float size[3];
- int i;
-
- Trans.context = CTX_NO_PET;
-
- initTrans(&Trans); // internal data, mouse, vectors
-
- Mat3One(mati);
- Mat3CpyMat4(matview, Trans.viewinv); // t->viewinv was set in initTrans
- Mat3Ortho(matview);
-
- createTransData(&Trans); // make TransData structs from selection
-
- calculatePropRatio(&Trans);
- calculateCenter(&Trans);
-
- initResize(&Trans);
-
- if (Trans.total == 0) {
- postTrans(&Trans);
- return;
- }
-
- size[0] = size[1] = size[2] = 1.0f;
- td = Trans.data;
-
- switch (mode) {
- case 1:
- size[0] = -1.0f;
- setConstraint(&Trans, mati, (CON_AXIS0), "");
- break;
- case 2:
- size[1] = -1.0f;
- setConstraint(&Trans, mati, (CON_AXIS1), "");
- break;
- case 3:
- size[2] = -1.0f;
- setConstraint(&Trans, mati, (CON_AXIS2), "");
- break;
- case 4:
- size[0] = -1.0f;
- setLocalConstraint(&Trans, (CON_AXIS0), "");
- break;
- case 5:
- size[1] = -1.0f;
- setLocalConstraint(&Trans, (CON_AXIS1), "");
- break;
- case 6:
- size[2] = -1.0f;
- setLocalConstraint(&Trans, (CON_AXIS2), "");
- break;
- case 7:
- size[0] = -1.0f;
- setConstraint(&Trans, matview, (CON_AXIS0), "");
- break;
- case 8:
- size[1] = -1.0f;
- setConstraint(&Trans, matview, (CON_AXIS1), "");
- break;
- case 9:
- size[2] = -1.0f;
- setConstraint(&Trans, matview, (CON_AXIS2), "");
- break;
- default:
- return;
- }
-
- SizeToMat3(size, mat);
-
- if (Trans.con.applySize) {
- Trans.con.applySize(&Trans, NULL, mat);
- }
-
- for(i = 0 ; i < Trans.total; i++, td++) {
- if (td->flag & TD_NOACTION)
- break;
-
- if (td->flag & TD_SKIP)
- continue;
-
- ElementResize(&Trans, td, mat);
- }
-
- recalcData(&Trans);
-
- BIF_undo_push("Mirror");
-
- /* free data, reset vars */
- postTrans(&Trans);
-
- /* send events out for redraws */
- viewRedrawPost(&Trans);
-}
-
-/* ************************** ANIM EDITORS - TRANSFORM TOOLS *************************** */
-
-/* ---------------- Special Helpers for Various Settings ------------- */
-
-/* This function returns the snapping 'mode' for Animation Editors only
- * We cannot use the standard snapping due to NLA-strip scaling complexities.
- */
-static short getAnimEdit_SnapMode(TransInfo *t)
-{
- short autosnap= SACTSNAP_OFF;
-
- /* currently, some of these are only for the action editor */
- if (t->spacetype == SPACE_ACTION && G.saction) {
- switch (G.saction->autosnap) {
- case SACTSNAP_OFF:
- if (G.qual == LR_CTRLKEY)
- autosnap= SACTSNAP_STEP;
- else if (G.qual == LR_SHIFTKEY)
- autosnap= SACTSNAP_FRAME;
- else if (G.qual == LR_ALTKEY)
- autosnap= SACTSNAP_MARKER;
- else
- autosnap= SACTSNAP_OFF;
- break;
- case SACTSNAP_STEP:
- autosnap= (G.qual==LR_CTRLKEY)? SACTSNAP_OFF: SACTSNAP_STEP;
- break;
- case SACTSNAP_FRAME:
- autosnap= (G.qual==LR_SHIFTKEY)? SACTSNAP_OFF: SACTSNAP_FRAME;
- break;
- case SACTSNAP_MARKER:
- autosnap= (G.qual==LR_ALTKEY)? SACTSNAP_OFF: SACTSNAP_MARKER;
- break;
- }
- }
- else if (t->spacetype == SPACE_NLA && G.snla) {
- switch (G.snla->autosnap) {
- case SACTSNAP_OFF:
- if (G.qual == LR_CTRLKEY)
- autosnap= SACTSNAP_STEP;
- else if (G.qual == LR_SHIFTKEY)
- autosnap= SACTSNAP_FRAME;
- else if (G.qual == LR_ALTKEY)
- autosnap= SACTSNAP_MARKER;
- else
- autosnap= SACTSNAP_OFF;
- break;
- case SACTSNAP_STEP:
- autosnap= (G.qual==LR_CTRLKEY)? SACTSNAP_OFF: SACTSNAP_STEP;
- break;
- case SACTSNAP_FRAME:
- autosnap= (G.qual==LR_SHIFTKEY)? SACTSNAP_OFF: SACTSNAP_FRAME;
- break;
- case SACTSNAP_MARKER:
- autosnap= (G.qual==LR_ALTKEY)? SACTSNAP_OFF: SACTSNAP_MARKER;
- break;
- }
- }
- else {
- if (G.qual == LR_CTRLKEY)
- autosnap= SACTSNAP_STEP;
- else if (G.qual == LR_SHIFTKEY)
- autosnap= SACTSNAP_FRAME;
- else if (G.qual == LR_ALTKEY)
- autosnap= SACTSNAP_MARKER;
- else
- autosnap= SACTSNAP_OFF;
- }
-
- return autosnap;
-}
-
-/* This function is used for testing if an Animation Editor is displaying
- * its data in frames or seconds (and the data needing to be edited as such).
- * Returns 1 if in seconds, 0 if in frames
- */
-static short getAnimEdit_DrawTime(TransInfo *t)
-{
- short drawtime;
-
- /* currently, some of these are only for the action editor */
- if (t->spacetype == SPACE_ACTION && G.saction) {
- drawtime = (G.saction->flag & SACTION_DRAWTIME)? 1 : 0;
- }
- else if (t->spacetype == SPACE_NLA && G.snla) {
- drawtime = (G.snla->flag & SNLA_DRAWTIME)? 1 : 0;
- }
- else {
- drawtime = 0;
- }
-
- return drawtime;
-}
-
-
-/* This function is used by Animation Editor specific transform functions to do
- * the Snap Keyframe to Nearest Frame/Marker
- */
-static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, Object *ob, short autosnap)
-{
- /* snap key to nearest frame? */
- if (autosnap == SACTSNAP_FRAME) {
- short doTime= getAnimEdit_DrawTime(t);
- double secf= FPS;
- float val;
-
- /* convert frame to nla-action time (if needed) */
- if (ob)
- val= get_action_frame_inv(ob, *(td->val));
- else
- val= *(td->val);
-
- /* do the snapping to nearest frame/second */
- if (doTime)
- val= (float)( floor((val/secf) + 0.5f) * secf );
- else
- val= (float)( floor(val+0.5f) );
-
- /* convert frame out of nla-action time */
- if (ob)
- *(td->val)= get_action_frame(ob, val);
- else
- *(td->val)= val;
- }
- /* snap key to nearest marker? */
- else if (autosnap == SACTSNAP_MARKER) {
- float val;
-
- /* convert frame to nla-action time (if needed) */
- if (ob)
- val= get_action_frame_inv(ob, *(td->val));
- else
- val= *(td->val);
-
- /* snap to nearest marker */
- val= (float)find_nearest_marker_time(val);
-
- /* convert frame out of nla-action time */
- if (ob)
- *(td->val)= get_action_frame(ob, val);
- else
- *(td->val)= val;
- }
-}
-
-/* ----------------- Translation ----------------------- */
-
-void initTimeTranslate(TransInfo *t)
-{
- t->mode = TFM_TIME_TRANSLATE;
- t->transform = TimeTranslate;
-
- /* num-input has max of (n-1) */
- t->idx_max = 0;
- t->num.flag = 0;
- t->num.idx_max = t->idx_max;
-
- /* initialise snap like for everything else */
- t->snap[0] = 0.0f;
- t->snap[1] = t->snap[2] = 1.0f;
-}
-
-static void headerTimeTranslate(TransInfo *t, char *str)
-{
- char tvec[60];
-
- /* if numeric input is active, use results from that, otherwise apply snapping to result */
- if (hasNumInput(&t->num)) {
- outputNumInput(&(t->num), tvec);
- }
- else {
- short autosnap= getAnimEdit_SnapMode(t);
- short doTime = getAnimEdit_DrawTime(t);
- double secf= FPS;
- float val= t->fac;
-
- /* apply snapping + frame->seconds conversions */
- if (autosnap == SACTSNAP_STEP) {
- if (doTime)
- val= floor(val/secf + 0.5f);
- else
- val= floor(val + 0.5f);
- }
- else {
- if (doTime)
- val= val / secf;
- }
-
- sprintf(&tvec[0], "%.4f", val);
- }
-
- sprintf(str, "DeltaX: %s", &tvec[0]);
-}
-
-static void applyTimeTranslate(TransInfo *t, float sval)
-{
- TransData *td = t->data;
- int i;
-
- short doTime= getAnimEdit_DrawTime(t);
- double secf= FPS;
-
- short autosnap= getAnimEdit_SnapMode(t);
-
- float deltax, val;
-
- /* it doesn't matter whether we apply to t->data or t->data2d, but t->data2d is more convenient */
- for (i = 0 ; i < t->total; i++, td++) {
- /* it is assumed that td->ob is a pointer to the object,
- * whose active action is where this keyframe comes from
- */
- Object *ob= td->ob;
-
- /* check if any need to apply nla-scaling */
- if (ob) {
- deltax = t->fac;
-
- if (autosnap == SACTSNAP_STEP) {
- if (doTime)
- deltax= (float)( floor((deltax/secf) + 0.5f) * secf );
- else
- deltax= (float)( floor(deltax + 0.5f) );
- }
-
- val = get_action_frame_inv(ob, td->ival);
- val += deltax;
- *(td->val) = get_action_frame(ob, val);
- }
- else {
- deltax = val = t->fac;
-
- if (autosnap == SACTSNAP_STEP) {
- if (doTime)
- val= (float)( floor((deltax/secf) + 0.5f) * secf );
- else
- val= (float)( floor(val + 0.5f) );
- }
-
- *(td->val) = td->ival + val;
- }
-
- /* apply nearest snapping */
- doAnimEdit_SnapFrame(t, td, ob, autosnap);
- }
-}
-
-int TimeTranslate(TransInfo *t, short mval[2])
-{
- float cval[2], sval[2];
- char str[200];
-
- /* calculate translation amount from mouse movement - in 'time-grid space' */
- areamouseco_to_ipoco(G.v2d, mval, &cval[0], &cval[1]);
- areamouseco_to_ipoco(G.v2d, t->imval, &sval[0], &sval[1]);
-
- /* we only need to calculate effect for time (applyTimeTranslate only needs that) */
- t->fac= cval[0] - sval[0];
-
- /* handle numeric-input stuff */
- t->vec[0] = t->fac;
- applyNumInput(&t->num, &t->vec[0]);
- t->fac = t->vec[0];
- headerTimeTranslate(t, str);
-
- applyTimeTranslate(t, sval[0]);
-
- recalcData(t);
-
- headerprint(str);
-
- viewRedrawForce(t);
-
- return 1;
-}
-
-/* ----------------- Time Slide ----------------------- */
-
-void initTimeSlide(TransInfo *t)
-{
- /* this tool is only really available in the Action Editor... */
- if (t->spacetype == SPACE_ACTION) {
- /* set flag for drawing stuff*/
- G.saction->flag |= SACTION_MOVING;
- }
-
- t->mode = TFM_TIME_SLIDE;
- t->transform = TimeSlide;
- t->flag |= T_FREE_CUSTOMDATA;
-
- /* num-input has max of (n-1) */
- t->idx_max = 0;
- t->num.flag = 0;
- t->num.idx_max = t->idx_max;
-
- /* initialise snap like for everything else */
- t->snap[0] = 0.0f;
- t->snap[1] = t->snap[2] = 1.0f;
-}
-
-static void headerTimeSlide(TransInfo *t, float sval, char *str)
-{
- char tvec[60];
-
- if (hasNumInput(&t->num)) {
- outputNumInput(&(t->num), tvec);
- }
- else {
- float minx= *((float *)(t->customData));
- float maxx= *((float *)(t->customData) + 1);
- float cval= t->fac;
- float val;
-
- val= 2.0*(cval-sval) / (maxx-minx);
- CLAMP(val, -1.0f, 1.0f);
-
- sprintf(&tvec[0], "%.4f", val);
- }
-
- sprintf(str, "TimeSlide: %s", &tvec[0]);
-}
-
-static void applyTimeSlide(TransInfo *t, float sval)
-{
- TransData *td = t->data;
- int i;
-
- float minx= *((float *)(t->customData));
- float maxx= *((float *)(t->customData) + 1);
-
- /* set value for drawing black line */
- if (t->spacetype == SPACE_ACTION) {
- G.saction->timeslide= t->fac;
-
- if (NLA_ACTION_SCALED)
- sval= get_action_frame(OBACT, sval);
- }
-
- /* it doesn't matter whether we apply to t->data or t->data2d, but t->data2d is more convenient */
- for (i = 0 ; i < t->total; i++, td++) {
- /* it is assumed that td->ob is a pointer to the object,
- * whose active action is where this keyframe comes from
- */
- Object *ob= td->ob;
- float cval = t->fac;
-
- /* apply scaling to necessary values */
- if (ob)
- cval= get_action_frame(ob, cval);
-
- /* only apply to data if in range */
- if (sval > minx && sval < maxx) {
- float cvalc= CLAMPIS(cval, minx, maxx);
- float timefac;
-
- /* left half? */
- if (td->ival < sval) {
- timefac= (sval - td->ival) / (sval - minx);
- *(td->val)= cvalc - timefac * (cvalc - minx);
- }
- else {
- timefac= (td->ival - sval) / (maxx - sval);
- *(td->val)= cvalc + timefac * (maxx - cvalc);
- }
- }
- }
-}
-
-int TimeSlide(TransInfo *t, short mval[2])
-{
- float cval[2], sval[2];
- char str[200];
-
- /* calculate mouse co-ordinates */
- areamouseco_to_ipoco(G.v2d, mval, &cval[0], &cval[1]);
- areamouseco_to_ipoco(G.v2d, t->imval, &sval[0], &sval[1]);
-
- /* calculate fake value to work with */
- t->fac= cval[0];
-
- /* handle numeric-input stuff */
- t->vec[0] = t->fac;
- applyNumInput(&t->num, &t->vec[0]);
- t->fac = t->vec[0];
- headerTimeSlide(t, sval[0], str);
-
- applyTimeSlide(t, sval[0]);
-
- recalcData(t);
-
- headerprint(str);
-
- viewRedrawForce(t);
-
- return 1;
-}
-
-/* ----------------- Scaling ----------------------- */
-
-void initTimeScale(TransInfo *t)
-{
- t->mode = TFM_TIME_SCALE;
- t->transform = TimeScale;
-
- t->flag |= T_NULL_ONE;
- t->num.flag |= NUM_NULL_ONE;
-
- /* num-input has max of (n-1) */
- t->idx_max = 0;
- t->num.flag = 0;
- t->num.idx_max = t->idx_max;
-
- /* initialise snap like for everything else */
- t->snap[0] = 0.0f;
- t->snap[1] = t->snap[2] = 1.0f;
-}
-
-static void headerTimeScale(TransInfo *t, char *str) {
- char tvec[60];
-
- if (hasNumInput(&t->num))
- outputNumInput(&(t->num), tvec);
- else
- sprintf(&tvec[0], "%.4f", t->fac);
-
- sprintf(str, "ScaleX: %s", &tvec[0]);
-}
-
-static void applyTimeScale(TransInfo *t) {
- TransData *td = t->data;
- int i;
-
- short autosnap= getAnimEdit_SnapMode(t);
- short doTime= getAnimEdit_DrawTime(t);
- double secf= FPS;
-
-
- for (i = 0 ; i < t->total; i++, td++) {
- /* it is assumed that td->ob is a pointer to the object,
- * whose active action is where this keyframe comes from
- */
- Object *ob= td->ob;
- float startx= CFRA;
- float fac= t->fac;
-
- if (autosnap == SACTSNAP_STEP) {
- if (doTime)
- fac= (float)( floor(fac/secf + 0.5f) * secf );
- else
- fac= (float)( floor(fac + 0.5f) );
- }
-
- /* check if any need to apply nla-scaling */
- if (ob)
- startx= get_action_frame(ob, startx);
-
- /* now, calculate the new value */
- *(td->val) = td->ival - startx;
- *(td->val) *= fac;
- *(td->val) += startx;
-
- /* apply nearest snapping */
- doAnimEdit_SnapFrame(t, td, ob, autosnap);
- }
-}
-
-int TimeScale(TransInfo *t, short mval[2])
-{
- float cval, sval;
- float deltax, startx;
- float width= 0.0f;
- char str[200];
-
- sval= t->imval[0];
- cval= mval[0];
-
- switch (t->spacetype) {
- case SPACE_ACTION:
- width= ACTWIDTH;
- break;
- case SPACE_NLA:
- width= NLAWIDTH;
- break;
- }
-
- /* calculate scaling factor */
- startx= sval-(width/2+(curarea->winrct.xmax-curarea->winrct.xmin)/2);
- deltax= cval-(width/2+(curarea->winrct.xmax-curarea->winrct.xmin)/2);
- t->fac = deltax / startx;
-
- /* handle numeric-input stuff */
- t->vec[0] = t->fac;
- applyNumInput(&t->num, &t->vec[0]);
- t->fac = t->vec[0];
- headerTimeScale(t, str);
-
- applyTimeScale(t);
-
- recalcData(t);
-
- headerprint(str);
-
- viewRedrawForce(t);
-
- return 1;
-}
-
-/* ************************************ */
-
-void BIF_TransformSetUndo(char *str)
-{
- Trans.undostr= str;
-}
-
-
-
diff --git a/source/blender/src/transform_constraints.c b/source/blender/src/transform_constraints.c
deleted file mode 100644
index 99e5123a953..00000000000
--- a/source/blender/src/transform_constraints.c
+++ /dev/null
@@ -1,1046 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef WIN32
-#include <unistd.h>
-#else
-#include <io.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_action_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_effect_types.h"
-#include "DNA_image_types.h"
-#include "DNA_ipo_types.h"
-#include "DNA_key_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_lattice_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_meta_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_view3d_types.h"
-
-#include "BIF_screen.h"
-#include "BIF_resources.h"
-#include "BIF_mywindow.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-
-#include "BKE_global.h"
-#include "BKE_utildefines.h"
-
-#include "BSE_view.h"
-
-#include "BLI_arithb.h"
-
-#include "BDR_drawobject.h" /* drawcircball */
-
-#include "blendef.h"
-
-#include "mydevice.h"
-
-#include "transform.h"
-
-static void drawObjectConstraint(TransInfo *t);
-
-/* ************************** CONSTRAINTS ************************* */
-void constraintNumInput(TransInfo *t, float vec[3])
-{
- int mode = t->con.mode;
- if (mode & CON_APPLY) {
- float nval = (t->flag & T_NULL_ONE)?1.0f:0.0f;
-
- if (getConstraintSpaceDimension(t) == 2) {
- int axis = mode & (CON_AXIS0|CON_AXIS1|CON_AXIS2);
- if (axis == (CON_AXIS0|CON_AXIS1)) {
- vec[2] = nval;
- }
- else if (axis == (CON_AXIS1|CON_AXIS2)) {
- vec[2] = vec[1];
- vec[1] = vec[0];
- vec[0] = nval;
- }
- else if (axis == (CON_AXIS0|CON_AXIS2)) {
- vec[2] = vec[1];
- vec[1] = nval;
- }
- }
- else if (getConstraintSpaceDimension(t) == 1) {
- if (mode & CON_AXIS0) {
- vec[1] = nval;
- vec[2] = nval;
- }
- else if (mode & CON_AXIS1) {
- vec[1] = vec[0];
- vec[0] = nval;
- vec[2] = nval;
- }
- else if (mode & CON_AXIS2) {
- vec[2] = vec[0];
- vec[0] = nval;
- vec[1] = nval;
- }
- }
- }
-}
-
-static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3]) {
- int i = 0;
-
- Mat3MulVecfl(t->con.imtx, vec);
-
- snapGrid(t, vec);
-
- if (t->num.flag & T_NULL_ONE) {
- if (!(t->con.mode & CON_AXIS0))
- vec[0] = 1.0f;
-
- if (!(t->con.mode & CON_AXIS1))
- vec[1] = 1.0f;
-
- if (!(t->con.mode & CON_AXIS2))
- vec[2] = 1.0f;
- }
-
- if (hasNumInput(&t->num)) {
- applyNumInput(&t->num, vec);
- constraintNumInput(t, vec);
- }
-
- if (t->con.mode & CON_AXIS0) {
- pvec[i++] = vec[0];
- }
- if (t->con.mode & CON_AXIS1) {
- pvec[i++] = vec[1];
- }
- if (t->con.mode & CON_AXIS2) {
- pvec[i++] = vec[2];
- }
-
- Mat3MulVecfl(t->con.mtx, vec);
-}
-
-static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3]) {
- float norm[3], vec[3], factor;
-
- if(in[0]==0.0f && in[1]==0.0f && in[2]==0.0f)
- return;
-
- /* For when view is parallel to constraint... will cause NaNs otherwise
- So we take vertical motion in 3D space and apply it to the
- constraint axis. Nice for camera grab + MMB */
- if(1.0f - fabs(Inpf(axis, t->viewinv[2])) < 0.000001f) {
- Projf(vec, in, t->viewinv[1]);
- factor = Inpf(t->viewinv[1], vec) * 2.0f;
- /* since camera distance is quite relative, use quadratic relationship. holding shift can compensate */
- if(factor<0.0f) factor*= -factor;
- else factor*= factor;
-
- VECCOPY(out, axis);
- Normalize(out);
- VecMulf(out, -factor); /* -factor makes move down going backwards */
- }
- else {
- float cb[3], ab[3];
-
- VECCOPY(out, axis);
-
- /* Get view vector on axis to define a plane */
- VecAddf(vec, t->con.center, in);
- getViewVector(vec, norm);
-
- Crossf(vec, norm, axis);
-
- /* Project input vector on the plane passing on axis */
- Projf(vec, in, vec);
- VecSubf(vec, in, vec);
-
- /* intersect the two lines: axis and norm */
- Crossf(cb, vec, norm);
- Crossf(ab, axis, norm);
-
- VecMulf(out, Inpf(cb, ab) / Inpf(ab, ab));
- }
-}
-
-static void planeProjection(TransInfo *t, float in[3], float out[3]) {
- float vec[3], factor, norm[3];
-
- VecAddf(vec, in, t->con.center);
- getViewVector(vec, norm);
-
- VecSubf(vec, out, in);
-
- factor = Inpf(vec, norm);
- if (fabs(factor) <= 0.001) {
- return; /* prevent divide by zero */
- }
- factor = Inpf(vec, vec) / factor;
-
- VECCOPY(vec, norm);
- VecMulf(vec, factor);
-
- VecAddf(out, in, vec);
-}
-
-/*
- * Generic callback for constant spacial constraints applied to linear motion
- *
- * The IN vector in projected into the constrained space and then further
- * projected along the view vector.
- * (in perspective mode, the view vector is relative to the position on screen)
- *
- */
-
-static void applyAxisConstraintVec(TransInfo *t, TransData *td, float in[3], float out[3], float pvec[3])
-{
- VECCOPY(out, in);
- if (!td && t->con.mode & CON_APPLY) {
- Mat3MulVecfl(t->con.pmtx, out);
-
- // With snap, a projection is alright, no need to correct for view alignment
- if ((t->tsnap.status & SNAP_ON) == 0)
- {
- if (getConstraintSpaceDimension(t) == 2) {
- if (out[0] != 0.0f || out[1] != 0.0f || out[2] != 0.0f) {
- planeProjection(t, in, out);
- }
- }
- else if (getConstraintSpaceDimension(t) == 1) {
- float c[3];
-
- if (t->con.mode & CON_AXIS0) {
- VECCOPY(c, t->con.mtx[0]);
- }
- else if (t->con.mode & CON_AXIS1) {
- VECCOPY(c, t->con.mtx[1]);
- }
- else if (t->con.mode & CON_AXIS2) {
- VECCOPY(c, t->con.mtx[2]);
- }
- axisProjection(t, c, in, out);
- }
- }
- postConstraintChecks(t, out, pvec);
- }
-}
-
-/*
- * Generic callback for object based spacial constraints applied to linear motion
- *
- * At first, the following is applied to the first data in the array
- * The IN vector in projected into the constrained space and then further
- * projected along the view vector.
- * (in perspective mode, the view vector is relative to the position on screen)
- *
- * Further down, that vector is mapped to each data's space.
- */
-
-static void applyObjectConstraintVec(TransInfo *t, TransData *td, float in[3], float out[3], float pvec[3])
-{
- VECCOPY(out, in);
- if (t->con.mode & CON_APPLY) {
- if (!td) {
- Mat3MulVecfl(t->con.pmtx, out);
- if (getConstraintSpaceDimension(t) == 2) {
- if (out[0] != 0.0f || out[1] != 0.0f || out[2] != 0.0f) {
- planeProjection(t, in, out);
- }
- }
- else if (getConstraintSpaceDimension(t) == 1) {
- float c[3];
-
- if (t->con.mode & CON_AXIS0) {
- VECCOPY(c, t->con.mtx[0]);
- }
- else if (t->con.mode & CON_AXIS1) {
- VECCOPY(c, t->con.mtx[1]);
- }
- else if (t->con.mode & CON_AXIS2) {
- VECCOPY(c, t->con.mtx[2]);
- }
- axisProjection(t, c, in, out);
- }
- postConstraintChecks(t, out, pvec);
- VECCOPY(out, pvec);
- }
- else {
- int i=0;
-
- out[0] = out[1] = out[2] = 0.0f;
- if (t->con.mode & CON_AXIS0) {
- out[0] = in[i++];
- }
- if (t->con.mode & CON_AXIS1) {
- out[1] = in[i++];
- }
- if (t->con.mode & CON_AXIS2) {
- out[2] = in[i++];
- }
- Mat3MulVecfl(td->axismtx, out);
- }
- }
-}
-
-/*
- * Generic callback for constant spacial constraints applied to resize motion
- *
- *
- */
-
-static void applyAxisConstraintSize(TransInfo *t, TransData *td, float smat[3][3])
-{
- if (!td && t->con.mode & CON_APPLY) {
- float tmat[3][3];
-
- if (!(t->con.mode & CON_AXIS0)) {
- smat[0][0] = 1.0f;
- }
- if (!(t->con.mode & CON_AXIS1)) {
- smat[1][1] = 1.0f;
- }
- if (!(t->con.mode & CON_AXIS2)) {
- smat[2][2] = 1.0f;
- }
-
- Mat3MulMat3(tmat, smat, t->con.imtx);
- Mat3MulMat3(smat, t->con.mtx, tmat);
- }
-}
-
-/*
- * Callback for object based spacial constraints applied to resize motion
- *
- *
- */
-
-static void applyObjectConstraintSize(TransInfo *t, TransData *td, float smat[3][3])
-{
- if (td && t->con.mode & CON_APPLY) {
- float tmat[3][3];
- float imat[3][3];
-
- Mat3Inv(imat, td->axismtx);
-
- if (!(t->con.mode & CON_AXIS0)) {
- smat[0][0] = 1.0f;
- }
- if (!(t->con.mode & CON_AXIS1)) {
- smat[1][1] = 1.0f;
- }
- if (!(t->con.mode & CON_AXIS2)) {
- smat[2][2] = 1.0f;
- }
-
- Mat3MulMat3(tmat, smat, imat);
- Mat3MulMat3(smat, td->axismtx, tmat);
- }
-}
-
-/*
- * Generic callback for constant spacial constraints applied to rotations
- *
- * The rotation axis is copied into VEC.
- *
- * In the case of single axis constraints, the rotation axis is directly the one constrained to.
- * For planar constraints (2 axis), the rotation axis is the normal of the plane.
- *
- * The following only applies when CON_NOFLIP is not set.
- * The vector is then modified to always point away from the screen (in global space)
- * This insures that the rotation is always logically following the mouse.
- * (ie: not doing counterclockwise rotations when the mouse moves clockwise).
- */
-
-static void applyAxisConstraintRot(TransInfo *t, TransData *td, float vec[3])
-{
- if (!td && t->con.mode & CON_APPLY) {
- int mode = t->con.mode & (CON_AXIS0|CON_AXIS1|CON_AXIS2);
-
- switch(mode) {
- case CON_AXIS0:
- case (CON_AXIS1|CON_AXIS2):
- VECCOPY(vec, t->con.mtx[0]);
- break;
- case CON_AXIS1:
- case (CON_AXIS0|CON_AXIS2):
- VECCOPY(vec, t->con.mtx[1]);
- break;
- case CON_AXIS2:
- case (CON_AXIS0|CON_AXIS1):
- VECCOPY(vec, t->con.mtx[2]);
- break;
- }
- if (!(mode & CON_NOFLIP)) {
- if (Inpf(vec, t->viewinv[2]) > 0.0f) {
- VecMulf(vec, -1.0f);
- }
- }
- }
-}
-
-/*
- * Callback for object based spacial constraints applied to rotations
- *
- * The rotation axis is copied into VEC.
- *
- * In the case of single axis constraints, the rotation axis is directly the one constrained to.
- * For planar constraints (2 axis), the rotation axis is the normal of the plane.
- *
- * The following only applies when CON_NOFLIP is not set.
- * The vector is then modified to always point away from the screen (in global space)
- * This insures that the rotation is always logically following the mouse.
- * (ie: not doing counterclockwise rotations when the mouse moves clockwise).
- */
-
-static void applyObjectConstraintRot(TransInfo *t, TransData *td, float vec[3])
-{
- if (td && t->con.mode & CON_APPLY) {
- int mode = t->con.mode & (CON_AXIS0|CON_AXIS1|CON_AXIS2);
-
- switch(mode) {
- case CON_AXIS0:
- case (CON_AXIS1|CON_AXIS2):
- VECCOPY(vec, td->axismtx[0]);
- break;
- case CON_AXIS1:
- case (CON_AXIS0|CON_AXIS2):
- VECCOPY(vec, td->axismtx[1]);
- break;
- case CON_AXIS2:
- case (CON_AXIS0|CON_AXIS1):
- VECCOPY(vec, td->axismtx[2]);
- break;
- }
- if (!(mode & CON_NOFLIP)) {
- if (Inpf(vec, t->viewinv[2]) > 0.0f) {
- VecMulf(vec, -1.0f);
- }
- }
- }
-}
-
-/*--------------------- INTERNAL SETUP CALLS ------------------*/
-
-void setConstraint(TransInfo *t, float space[3][3], int mode, const char text[]) {
- strncpy(t->con.text + 1, text, 48);
- Mat3CpyMat3(t->con.mtx, space);
- t->con.mode = mode;
- getConstraintMatrix(t);
-
- startConstraint(t);
-
- t->con.drawExtra = NULL;
- t->con.applyVec = applyAxisConstraintVec;
- t->con.applySize = applyAxisConstraintSize;
- t->con.applyRot = applyAxisConstraintRot;
- t->redraw = 1;
-}
-
-void setLocalConstraint(TransInfo *t, int mode, const char text[]) {
- if (t->flag & T_EDIT) {
- float obmat[3][3];
- Mat3CpyMat4(obmat, G.obedit->obmat);
- setConstraint(t, obmat, mode|CON_LOCAL, text);
- }
- else {
- if (t->total == 1) {
- setConstraint(t, t->data->axismtx, mode|CON_LOCAL, text);
- }
- else {
- strncpy(t->con.text + 1, text, 48);
- Mat3CpyMat3(t->con.mtx, t->data->axismtx);
- t->con.mode = mode|CON_LOCAL;
- getConstraintMatrix(t);
-
- startConstraint(t);
-
- t->con.drawExtra = drawObjectConstraint;
- t->con.applyVec = applyObjectConstraintVec;
- t->con.applySize = applyObjectConstraintSize;
- t->con.applyRot = applyObjectConstraintRot;
- t->redraw = 1;
- }
- }
-}
-
-/*
- Set the constraint according to the user defined orientation
-
- ftext is a format string passed to sprintf. It will add the name of
- the orientation where %s is (logically).
-*/
-void setUserConstraint(TransInfo *t, int mode, const char ftext[]) {
- char text[40];
- short twmode= (t->spacetype==SPACE_VIEW3D)? G.vd->twmode: V3D_MANIP_GLOBAL;
-
- switch(twmode) {
- case V3D_MANIP_GLOBAL:
- /*
- sprintf(text, ftext, "global");
- Mat3One(mtx);
- setConstraint(t, mtx, mode, text);
- break;
- */
- case V3D_MANIP_LOCAL:
- sprintf(text, ftext, "local");
- setLocalConstraint(t, mode, text);
- break;
- case V3D_MANIP_NORMAL:
- sprintf(text, ftext, "normal");
- setConstraint(t, t->spacemtx, mode, text);
- break;
- case V3D_MANIP_VIEW:
- sprintf(text, ftext, "view");
- setConstraint(t, t->spacemtx, mode, text);
- break;
- }
-
- t->con.mode |= CON_USER;
-}
-
-/*--------------------- EXTERNAL SETUP CALLS ------------------*/
-
-void BIF_setLocalLockConstraint(char axis, char *text) {
- TransInfo *t = BIF_GetTransInfo();
-
- switch (axis) {
- case 'x':
- setLocalConstraint(t, (CON_AXIS1|CON_AXIS2), text);
- break;
- case 'y':
- setLocalConstraint(t, (CON_AXIS0|CON_AXIS2), text);
- break;
- case 'z':
- setLocalConstraint(t, (CON_AXIS0|CON_AXIS1), text);
- break;
- }
-}
-
-void BIF_setLocalAxisConstraint(char axis, char *text) {
- TransInfo *t = BIF_GetTransInfo();
-
- switch (axis) {
- case 'X':
- setLocalConstraint(t, CON_AXIS0, text);
- break;
- case 'Y':
- setLocalConstraint(t, CON_AXIS1, text);
- break;
- case 'Z':
- setLocalConstraint(t, CON_AXIS2, text);
- break;
- }
-}
-
-/* text is optional, for header print */
-void BIF_setSingleAxisConstraint(float vec[3], char *text) {
- TransInfo *t = BIF_GetTransInfo();
- float space[3][3], v[3];
-
- VECCOPY(space[0], vec);
-
- v[0] = vec[2];
- v[1] = vec[0];
- v[2] = vec[1];
-
- Crossf(space[1], vec, v);
- Crossf(space[2], vec, space[1]);
- Mat3Ortho(space);
-
- Mat3CpyMat3(t->con.mtx, space);
- t->con.mode = CON_AXIS0;
-
- getConstraintMatrix(t);
-
- startConstraint(t);
-
- /* start copying with an offset of 1, to reserve a spot for the SPACE char */
- if(text)
- {
- strncpy(t->con.text+1, text, 48); /* 50 in struct */
- }
- else
- {
- t->con.text[1] = '\0'; /* No text */
- }
-
- t->con.drawExtra = NULL;
- t->con.applyVec = applyAxisConstraintVec;
- t->con.applySize = applyAxisConstraintSize;
- t->con.applyRot = applyAxisConstraintRot;
- t->redraw = 1;
-}
-
-void BIF_setDualAxisConstraint(float vec1[3], float vec2[3], char *text) {
- TransInfo *t = BIF_GetTransInfo();
- float space[3][3];
-
- VECCOPY(space[0], vec1);
- VECCOPY(space[1], vec2);
- Crossf(space[2], space[0], space[1]);
- Mat3Ortho(space);
-
- Mat3CpyMat3(t->con.mtx, space);
- t->con.mode = CON_AXIS0|CON_AXIS1;
-
- getConstraintMatrix(t);
-
- startConstraint(t);
-
- /* start copying with an offset of 1, to reserve a spot for the SPACE char */
- if(text)
- {
- strncpy(t->con.text+1, text, 48); /* 50 in struct */
- }
- else
- {
- t->con.text[1] = '\0'; /* No text */
- }
-
- t->con.drawExtra = NULL;
- t->con.applyVec = applyAxisConstraintVec;
- t->con.applySize = applyAxisConstraintSize;
- t->con.applyRot = applyAxisConstraintRot;
- t->redraw = 1;
-}
-
-/*----------------- DRAWING CONSTRAINTS -------------------*/
-
-void BIF_drawConstraint(void)
-{
- TransInfo *t = BIF_GetTransInfo();
- TransCon *tc = &(t->con);
-
- if (t->spacetype!=SPACE_VIEW3D)
- return;
- if (!(tc->mode & CON_APPLY))
- return;
- if (t->flag & T_USES_MANIPULATOR)
- return;
-
- /* nasty exception for Z constraint in camera view */
- if((t->flag & T_OBJECT) && G.vd->camera==OBACT && G.vd->persp>1)
- return;
-
- if (tc->drawExtra) {
- tc->drawExtra(t);
- }
- else {
- if (tc->mode & CON_SELECT) {
- float vec[3];
- short mval[2];
- char col2[3] = {255,255,255};
- getmouseco_areawin(mval);
- convertViewVec(t, vec, (short)(mval[0] - t->con.imval[0]), (short)(mval[1] - t->con.imval[1]));
- VecAddf(vec, vec, tc->center);
-
- drawLine(tc->center, tc->mtx[0], 'x', 0);
- drawLine(tc->center, tc->mtx[1], 'y', 0);
- drawLine(tc->center, tc->mtx[2], 'z', 0);
-
- glColor3ubv((GLubyte *)col2);
-
- glDisable(GL_DEPTH_TEST);
- setlinestyle(1);
- glBegin(GL_LINE_STRIP);
- glVertex3fv(tc->center);
- glVertex3fv(vec);
- glEnd();
- setlinestyle(0);
- if(G.vd->zbuf) glEnable(GL_DEPTH_TEST);
- }
-
- if (tc->mode & CON_AXIS0) {
- drawLine(tc->center, tc->mtx[0], 'x', DRAWLIGHT);
- }
- if (tc->mode & CON_AXIS1) {
- drawLine(tc->center, tc->mtx[1], 'y', DRAWLIGHT);
- }
- if (tc->mode & CON_AXIS2) {
- drawLine(tc->center, tc->mtx[2], 'z', DRAWLIGHT);
- }
- }
-}
-
-/* called from drawview.c, as an extra per-window draw option */
-void BIF_drawPropCircle()
-{
- TransInfo *t = BIF_GetTransInfo();
-
- if (t->flag & T_PROP_EDIT) {
- float tmat[4][4], imat[4][4];
-
- BIF_ThemeColor(TH_GRID);
-
- /* if editmode we need to go into object space */
- if(G.obedit) mymultmatrix(G.obedit->obmat);
-
- mygetmatrix(tmat);
- Mat4Invert(imat, tmat);
-
- set_inverted_drawing(1);
- drawcircball(GL_LINE_LOOP, t->center, t->propsize, imat);
- set_inverted_drawing(0);
-
- /* if editmode we restore */
- if(G.obedit) myloadmatrix(G.vd->viewmat);
- }
-}
-
-void BIF_getPropCenter(float *center)
-{
- TransInfo *t = BIF_GetTransInfo();
-
- if (t && t->flag & T_PROP_EDIT) {
- VECCOPY(center, t->center);
- }
- else
- center[0] = center[1] = center[2] = 0.0f;
-}
-static void drawObjectConstraint(TransInfo *t) {
- int i;
- TransData * td = t->data;
-
- /* Draw the first one lighter because that's the one who controls the others.
- Meaning the transformation is projected on that one and just copied on the others
- constraint space.
- In a nutshell, the object with light axis is controlled by the user and the others follow.
- Without drawing the first light, users have little clue what they are doing.
- */
- if (t->con.mode & CON_AXIS0) {
- drawLine(td->ob->obmat[3], td->axismtx[0], 'x', DRAWLIGHT);
- }
- if (t->con.mode & CON_AXIS1) {
- drawLine(td->ob->obmat[3], td->axismtx[1], 'y', DRAWLIGHT);
- }
- if (t->con.mode & CON_AXIS2) {
- drawLine(td->ob->obmat[3], td->axismtx[2], 'z', DRAWLIGHT);
- }
-
- td++;
-
- for(i=1;i<t->total;i++,td++) {
- if (t->con.mode & CON_AXIS0) {
- drawLine(td->ob->obmat[3], td->axismtx[0], 'x', 0);
- }
- if (t->con.mode & CON_AXIS1) {
- drawLine(td->ob->obmat[3], td->axismtx[1], 'y', 0);
- }
- if (t->con.mode & CON_AXIS2) {
- drawLine(td->ob->obmat[3], td->axismtx[2], 'z', 0);
- }
- }
-}
-
-/*--------------------- START / STOP CONSTRAINTS ---------------------- */
-
-void startConstraint(TransInfo *t) {
- t->con.mode |= CON_APPLY;
- *t->con.text = ' ';
- t->num.idx_max = MIN2(getConstraintSpaceDimension(t) - 1, t->idx_max);
-}
-
-void stopConstraint(TransInfo *t) {
- t->con.mode &= ~(CON_APPLY|CON_SELECT);
- *t->con.text = '\0';
- t->num.idx_max = t->idx_max;
-}
-
-void getConstraintMatrix(TransInfo *t)
-{
- float mat[3][3];
- Mat3Inv(t->con.imtx, t->con.mtx);
- Mat3One(t->con.pmtx);
-
- if (!(t->con.mode & CON_AXIS0)) {
- t->con.pmtx[0][0] =
- t->con.pmtx[0][1] =
- t->con.pmtx[0][2] = 0.0f;
- }
-
- if (!(t->con.mode & CON_AXIS1)) {
- t->con.pmtx[1][0] =
- t->con.pmtx[1][1] =
- t->con.pmtx[1][2] = 0.0f;
- }
-
- if (!(t->con.mode & CON_AXIS2)) {
- t->con.pmtx[2][0] =
- t->con.pmtx[2][1] =
- t->con.pmtx[2][2] = 0.0f;
- }
-
- Mat3MulMat3(mat, t->con.pmtx, t->con.imtx);
- Mat3MulMat3(t->con.pmtx, t->con.mtx, mat);
-}
-
-/*------------------------- MMB Select -------------------------------*/
-
-void initSelectConstraint(TransInfo *t, float mtx[3][3])
-{
- Mat3CpyMat3(t->con.mtx, mtx);
- t->con.mode |= CON_APPLY;
- t->con.mode |= CON_SELECT;
- t->con.mode &= ~CON_LOCAL;
-
- setNearestAxis(t);
- t->con.drawExtra = NULL;
- t->con.applyVec = applyAxisConstraintVec;
- t->con.applySize = applyAxisConstraintSize;
- t->con.applyRot = applyAxisConstraintRot;
-}
-
-void selectConstraint(TransInfo *t) {
- if (t->con.mode & CON_SELECT) {
- setNearestAxis(t);
- startConstraint(t);
- }
-}
-
-void postSelectConstraint(TransInfo *t)
-{
- if (!(t->con.mode & CON_SELECT))
- return;
-
- t->con.mode &= ~CON_AXIS0;
- t->con.mode &= ~CON_AXIS1;
- t->con.mode &= ~CON_AXIS2;
- t->con.mode &= ~CON_SELECT;
-
- setNearestAxis(t);
-
- startConstraint(t);
- t->redraw = 1;
-}
-
-static void setNearestAxis2d(TransInfo *t)
-{
- short mval[2];
- short ival[2];
-
- getmouseco_areawin(mval);
- ival[0]= t->imval[0];
- ival[1]= t->imval[1];
-
- /* no correction needed... just use whichever one is lower */
- if ( abs(mval[0]-ival[0]) < abs(mval[1]-ival[1]) ) {
- t->con.mode |= CON_AXIS1;
- sprintf(t->con.text, " along Y axis");
- }
- else {
- t->con.mode |= CON_AXIS0;
- sprintf(t->con.text, " along X axis");
- }
-}
-
-static void setNearestAxis3d(TransInfo *t)
-{
- float zfac;
- float mvec[3], axis[3], proj[3];
- float len[3];
- int i, icoord[2];
- short coord[2];
-
- /* calculate mouse movement */
- getmouseco_areawin(coord);
- mvec[0] = (float)(coord[0] - t->con.imval[0]);
- mvec[1] = (float)(coord[1] - t->con.imval[1]);
- mvec[2] = 0.0f;
-
- /* we need to correct axis length for the current zoomlevel of view,
- this to prevent projected values to be clipped behind the camera
- and to overflow the short integers.
- The formula used is a bit stupid, just a simplification of the substraction
- of two 2D points 30 pixels apart (that's the last factor in the formula) after
- projecting them with window_to_3d and then get the length of that vector.
- */
- zfac= t->persmat[0][3]*t->center[0]+ t->persmat[1][3]*t->center[1]+ t->persmat[2][3]*t->center[2]+ t->persmat[3][3];
- zfac = VecLength(t->persinv[0]) * 2.0f/curarea->winx * zfac * 30.0f;
-
- for (i = 0; i<3; i++) {
- VECCOPY(axis, t->con.mtx[i]);
-
- VecMulf(axis, zfac);
- /* now we can project to get window coordinate */
- VecAddf(axis, axis, t->con.center);
- projectIntView(t, axis, icoord);
-
- axis[0] = (float)(icoord[0] - t->center2d[0]);
- axis[1] = (float)(icoord[1] - t->center2d[1]);
- axis[2] = 0.0f;
-
- if (Normalize(axis) != 0.0f) {
- Projf(proj, mvec, axis);
- VecSubf(axis, mvec, proj);
- len[i] = Normalize(axis);
- }
- else {
- len[i] = 10000000000.0f;
- }
- }
-
- if (len[0] <= len[1] && len[0] <= len[2]) {
- if (G.qual & LR_SHIFTKEY) {
- t->con.mode |= (CON_AXIS1|CON_AXIS2);
- sprintf(t->con.text, " locking %s X axis", t->spacename);
- }
- else {
- t->con.mode |= CON_AXIS0;
- sprintf(t->con.text, " along %s X axis", t->spacename);
- }
- }
- else if (len[1] <= len[0] && len[1] <= len[2]) {
- if (G.qual & LR_SHIFTKEY) {
- t->con.mode |= (CON_AXIS0|CON_AXIS2);
- sprintf(t->con.text, " locking %s Y axis", t->spacename);
- }
- else {
- t->con.mode |= CON_AXIS1;
- sprintf(t->con.text, " along %s Y axis", t->spacename);
- }
- }
- else if (len[2] <= len[1] && len[2] <= len[0]) {
- if (G.qual & LR_SHIFTKEY) {
- t->con.mode |= (CON_AXIS0|CON_AXIS1);
- sprintf(t->con.text, " locking %s Z axis", t->spacename);
- }
- else {
- t->con.mode |= CON_AXIS2;
- sprintf(t->con.text, " along %s Z axis", t->spacename);
- }
- }
-}
-
-void setNearestAxis(TransInfo *t)
-{
- /* clear any prior constraint flags */
- t->con.mode &= ~CON_AXIS0;
- t->con.mode &= ~CON_AXIS1;
- t->con.mode &= ~CON_AXIS2;
-
- /* constraint setting - depends on spacetype */
- if (t->spacetype == SPACE_VIEW3D) {
- /* 3d-view */
- setNearestAxis3d(t);
- }
- else {
- /* assume that this means a 2D-Editor */
- setNearestAxis2d(t);
- }
-
- getConstraintMatrix(t);
-}
-
-/*-------------- HELPER FUNCTIONS ----------------*/
-
-char constraintModeToChar(TransInfo *t) {
- if ((t->con.mode & CON_APPLY)==0) {
- return '\0';
- }
- switch (t->con.mode & (CON_AXIS0|CON_AXIS1|CON_AXIS2)) {
- case (CON_AXIS0):
- case (CON_AXIS1|CON_AXIS2):
- return 'X';
- case (CON_AXIS1):
- case (CON_AXIS0|CON_AXIS2):
- return 'Y';
- case (CON_AXIS2):
- case (CON_AXIS0|CON_AXIS1):
- return 'Z';
- default:
- return '\0';
- }
-}
-
-
-int isLockConstraint(TransInfo *t) {
- int mode = t->con.mode;
-
- if ( (mode & (CON_AXIS0|CON_AXIS1)) == (CON_AXIS0|CON_AXIS1))
- return 1;
-
- if ( (mode & (CON_AXIS1|CON_AXIS2)) == (CON_AXIS1|CON_AXIS2))
- return 1;
-
- if ( (mode & (CON_AXIS0|CON_AXIS2)) == (CON_AXIS0|CON_AXIS2))
- return 1;
-
- return 0;
-}
-
-/*
- * Returns the dimension of the constraint space.
- *
- * For that reason, the flags always needs to be set to properly evaluate here,
- * even if they aren't actually used in the callback function. (Which could happen
- * for weird constraints not yet designed. Along a path for example.)
- */
-
-int getConstraintSpaceDimension(TransInfo *t)
-{
- int n = 0;
-
- if (t->con.mode & CON_AXIS0)
- n++;
-
- if (t->con.mode & CON_AXIS1)
- n++;
-
- if (t->con.mode & CON_AXIS2)
- n++;
-
- return n;
-/*
- Someone willing to do it criptically could do the following instead:
-
- return t->con & (CON_AXIS0|CON_AXIS1|CON_AXIS2);
-
- Based on the assumptions that the axis flags are one after the other and start at 1
-*/
-}
diff --git a/source/blender/src/transform_conversions.c b/source/blender/src/transform_conversions.c
deleted file mode 100644
index ac13634532b..00000000000
--- a/source/blender/src/transform_conversions.c
+++ /dev/null
@@ -1,3616 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef WIN32
-#include <unistd.h>
-#else
-#include <io.h>
-#endif
-#include <string.h>
-#include <math.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_action_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_effect_types.h"
-#include "DNA_image_types.h"
-#include "DNA_ipo_types.h"
-#include "DNA_key_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_lattice_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_meta_types.h"
-#include "DNA_modifier_types.h"
-#include "DNA_nla_types.h"
-#include "DNA_object_types.h"
-#include "DNA_object_force.h"
-#include "DNA_particle_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_world_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_property_types.h"
-#include "DNA_vfont_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_listBase.h"
-
-#include "BKE_action.h"
-#include "BKE_armature.h"
-#include "BKE_blender.h"
-#include "BKE_curve.h"
-#include "BKE_constraint.h"
-#include "BKE_depsgraph.h"
-#include "BKE_displist.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_effect.h"
-#include "BKE_font.h"
-#include "BKE_global.h"
-#include "BKE_ipo.h"
-#include "BKE_lattice.h"
-#include "BKE_key.h"
-#include "BKE_main.h"
-#include "BKE_mball.h"
-#include "BKE_mesh.h"
-#include "BKE_modifier.h"
-#include "BKE_object.h"
-#include "BKE_particle.h"
-#include "BKE_softbody.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_editaction.h"
-#include "BIF_editview.h"
-#include "BIF_editlattice.h"
-#include "BIF_editconstraint.h"
-#include "BIF_editarmature.h"
-#include "BIF_editmesh.h"
-#include "BIF_editnla.h"
-#include "BIF_editsima.h"
-#include "BIF_editparticle.h"
-#include "BIF_gl.h"
-#include "BIF_poseobject.h"
-#include "BIF_meshtools.h"
-#include "BIF_mywindow.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_toolbox.h"
-
-#include "BSE_view.h"
-#include "BSE_drawipo.h"
-#include "BSE_edit.h"
-#include "BSE_editipo.h"
-#include "BSE_editipo_types.h"
-#include "BSE_editaction_types.h"
-
-#include "BDR_editobject.h" // reset_slowparents()
-#include "BDR_unwrapper.h"
-
-#include "BLI_arithb.h"
-#include "BLI_blenlib.h"
-#include "BLI_editVert.h"
-
-#include "editmesh.h"
-
-#include "blendef.h"
-
-#include "mydevice.h"
-
-extern ListBase editNurb;
-extern ListBase editelems;
-
-#include "transform.h"
-
-/* local function prototype - for Object/Bone Constraints */
-static short constraints_list_needinv(TransInfo *t, ListBase *list);
-
-/* ************************** Functions *************************** */
-
-static void qsort_trans_data(TransInfo *t, TransData *head, TransData *tail) {
- TransData pivot = *head;
- TransData *ihead = head;
- TransData *itail = tail;
- short connected = t->flag & T_PROP_CONNECTED;
-
- while (head < tail)
- {
- if (connected) {
- while ((tail->dist >= pivot.dist) && (head < tail))
- tail--;
- }
- else {
- while ((tail->rdist >= pivot.rdist) && (head < tail))
- tail--;
- }
-
- if (head != tail)
- {
- *head = *tail;
- head++;
- }
-
- if (connected) {
- while ((head->dist <= pivot.dist) && (head < tail))
- head++;
- }
- else {
- while ((head->rdist <= pivot.rdist) && (head < tail))
- head++;
- }
-
- if (head != tail)
- {
- *tail = *head;
- tail--;
- }
- }
-
- *head = pivot;
- if (ihead < head) {
- qsort_trans_data(t, ihead, head-1);
- }
- if (itail > head) {
- qsort_trans_data(t, head+1, itail);
- }
-}
-
-void sort_trans_data_dist(TransInfo *t) {
- TransData *start = t->data;
- int i = 1;
-
- while(i < t->total && start->flag & TD_SELECTED) {
- start++;
- i++;
- }
- qsort_trans_data(t, start, t->data + t->total - 1);
-}
-
-static void sort_trans_data(TransInfo *t)
-{
- TransData *sel, *unsel;
- TransData temp;
- unsel = t->data;
- sel = t->data;
- sel += t->total - 1;
- while (sel > unsel) {
- while (unsel->flag & TD_SELECTED) {
- unsel++;
- if (unsel == sel) {
- return;
- }
- }
- while (!(sel->flag & TD_SELECTED)) {
- sel--;
- if (unsel == sel) {
- return;
- }
- }
- temp = *unsel;
- *unsel = *sel;
- *sel = temp;
- sel--;
- unsel++;
- }
-}
-
-/* distance calculated from not-selected vertex to nearest selected vertex
- warning; this is loops inside loop, has minor N^2 issues, but by sorting list it is OK */
-static void set_prop_dist(TransInfo *t, short with_dist)
-{
- TransData *tob;
- int a;
-
- for(a=0, tob= t->data; a<t->total; a++, tob++) {
-
- tob->rdist= 0.0f; // init, it was mallocced
-
- if((tob->flag & TD_SELECTED)==0) {
- TransData *td;
- int i;
- float dist, vec[3];
-
- tob->rdist = -1.0f; // signal for next loop
-
- for (i = 0, td= t->data; i < t->total; i++, td++) {
- if(td->flag & TD_SELECTED) {
- VecSubf(vec, tob->center, td->center);
- Mat3MulVecfl(tob->mtx, vec);
- dist = Normalize(vec);
- if (tob->rdist == -1.0f) {
- tob->rdist = dist;
- }
- else if (dist < tob->rdist) {
- tob->rdist = dist;
- }
- }
- else break; // by definition transdata has selected items in beginning
- }
- if (with_dist) {
- tob->dist = tob->rdist;
- }
- }
- }
-}
-
-/* ************************** CONVERSIONS ************************* */
-
-/* ********************* texture space ********* */
-
-static void createTransTexspace(TransInfo *t)
-{
- TransData *td;
- Object *ob;
- ID *id;
-
- ob= OBACT;
-
- if (ob==NULL) { // Shouldn't logically happen, but still...
- t->total = 0;
- return;
- }
-
- id= ob->data;
- if(id==NULL || !ELEM3( GS(id->name), ID_ME, ID_CU, ID_MB )) {
- t->total = 0;
- return;
- }
-
- t->total = 1;
- td= t->data= MEM_callocN(sizeof(TransData), "TransTexspace");
- td->ext= t->ext= MEM_callocN(sizeof(TransDataExtension), "TransTexspace");
-
- td->flag= TD_SELECTED;
- VECCOPY(td->center, ob->obmat[3]);
- td->ob = ob;
-
- Mat3CpyMat4(td->mtx, ob->obmat);
- Mat3CpyMat4(td->axismtx, ob->obmat);
- Mat3Ortho(td->axismtx);
- Mat3Inv(td->smtx, td->mtx);
-
- if( GS(id->name)==ID_ME) {
- Mesh *me= ob->data;
- me->texflag &= ~AUTOSPACE;
- td->loc= me->loc;
- td->ext->rot= me->rot;
- td->ext->size= me->size;
- }
- else if( GS(id->name)==ID_CU) {
- Curve *cu= ob->data;
- cu->texflag &= ~CU_AUTOSPACE;
- td->loc= cu->loc;
- td->ext->rot= cu->rot;
- td->ext->size= cu->size;
- }
- else if( GS(id->name)==ID_MB) {
- MetaBall *mb= ob->data;
- mb->texflag &= ~MB_AUTOSPACE;
- td->loc= mb->loc;
- td->ext->rot= mb->rot;
- td->ext->size= mb->size;
- }
-
- VECCOPY(td->iloc, td->loc);
- VECCOPY(td->ext->irot, td->ext->rot);
- VECCOPY(td->ext->isize, td->ext->size);
-}
-
-/* ********************* edge (for crease) ***** */
-
-static void createTransEdge(TransInfo *t) {
- TransData *td = NULL;
- EditMesh *em = G.editMesh;
- EditEdge *eed;
- float mtx[3][3], smtx[3][3];
- int count=0, countsel=0;
- int propmode = t->flag & T_PROP_EDIT;
-
- for(eed= em->edges.first; eed; eed= eed->next) {
- if(eed->h==0) {
- if (eed->f & SELECT) countsel++;
- if (propmode) count++;
- }
- }
-
- if (countsel == 0)
- return;
-
- if(propmode) {
- t->total = count;
- }
- else {
- t->total = countsel;
- }
-
- td= t->data= MEM_callocN(t->total * sizeof(TransData), "TransCrease");
-
- Mat3CpyMat4(mtx, G.obedit->obmat);
- Mat3Inv(smtx, mtx);
-
- for(eed= em->edges.first; eed; eed= eed->next) {
- if(eed->h==0 && (eed->f & SELECT || propmode)) {
- /* need to set center for center calculations */
- VecAddf(td->center, eed->v1->co, eed->v2->co);
- VecMulf(td->center, 0.5f);
-
- td->loc= NULL;
- if (eed->f & SELECT)
- td->flag= TD_SELECTED;
- else
- td->flag= 0;
-
-
- Mat3CpyMat3(td->smtx, smtx);
- Mat3CpyMat3(td->mtx, mtx);
-
- td->ext = NULL;
- td->tdi = NULL;
- td->val = &(eed->crease);
- td->ival = eed->crease;
-
- td++;
- }
- }
-}
-
-/* ********************* pose mode ************* */
-
-static bKinematicConstraint *has_targetless_ik(bPoseChannel *pchan)
-{
- bConstraint *con= pchan->constraints.first;
-
- for(;con; con= con->next) {
- if(con->type==CONSTRAINT_TYPE_KINEMATIC) {
- bKinematicConstraint *data= con->data;
-
- if(data->tar==NULL)
- return data;
- if(data->tar->type==OB_ARMATURE && data->subtarget[0]==0)
- return data;
- }
- }
- return NULL;
-}
-
-static short apply_targetless_ik(Object *ob)
-{
- bPoseChannel *pchan, *parchan, *chanlist[256];
- bKinematicConstraint *data;
- int segcount, apply= 0;
-
- /* now we got a difficult situation... we have to find the
- target-less IK pchans, and apply transformation to the all
- pchans that were in the chain */
-
- for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next) {
- data= has_targetless_ik(pchan);
- if(data && (data->flag & CONSTRAINT_IK_AUTO)) {
-
- /* fill the array with the bones of the chain (armature.c does same, keep it synced) */
- segcount= 0;
-
- /* exclude tip from chain? */
- if(!(data->flag & CONSTRAINT_IK_TIP))
- parchan= pchan->parent;
- else
- parchan= pchan;
-
- /* Find the chain's root & count the segments needed */
- for (; parchan; parchan=parchan->parent){
- chanlist[segcount]= parchan;
- segcount++;
-
- if(segcount==data->rootbone || segcount>255) break; // 255 is weak
- }
- for(;segcount;segcount--) {
- Bone *bone;
- float rmat[4][4], tmat[4][4], imat[4][4];
-
- /* pose_mat(b) = pose_mat(b-1) * offs_bone * channel * constraint * IK */
- /* we put in channel the entire result of rmat= (channel * constraint * IK) */
- /* pose_mat(b) = pose_mat(b-1) * offs_bone * rmat */
- /* rmat = pose_mat(b) * inv( pose_mat(b-1) * offs_bone ) */
-
- parchan= chanlist[segcount-1];
- bone= parchan->bone;
- bone->flag |= BONE_TRANSFORM; /* ensures it gets an auto key inserted */
-
- if(parchan->parent) {
- Bone *parbone= parchan->parent->bone;
- float offs_bone[4][4];
-
- /* offs_bone = yoffs(b-1) + root(b) + bonemat(b) */
- Mat4CpyMat3(offs_bone, bone->bone_mat);
-
- /* The bone's root offset (is in the parent's coordinate system) */
- VECCOPY(offs_bone[3], bone->head);
-
- /* Get the length translation of parent (length along y axis) */
- offs_bone[3][1]+= parbone->length;
-
- /* pose_mat(b-1) * offs_bone */
- if(parchan->bone->flag & BONE_HINGE) {
- /* the rotation of the parent restposition */
- Mat4CpyMat4(rmat, parbone->arm_mat); /* rmat used as temp */
-
- /* the location of actual parent transform */
- VECCOPY(rmat[3], offs_bone[3]);
- offs_bone[3][0]= offs_bone[3][1]= offs_bone[3][2]= 0.0f;
- Mat4MulVecfl(parchan->parent->pose_mat, rmat[3]);
-
- Mat4MulMat4(tmat, offs_bone, rmat);
- }
- else
- Mat4MulMat4(tmat, offs_bone, parchan->parent->pose_mat);
-
- Mat4Invert(imat, tmat);
- }
- else {
- Mat4CpyMat3(tmat, bone->bone_mat);
-
- VECCOPY(tmat[3], bone->head);
- Mat4Invert(imat, tmat);
- }
- /* result matrix */
- Mat4MulMat4(rmat, parchan->pose_mat, imat);
-
- /* apply and decompose, doesn't work for constraints or non-uniform scale well */
- {
- float rmat3[3][3], qmat[3][3], imat[3][3], smat[3][3];
-
- Mat3CpyMat4(rmat3, rmat);
-
- /* quaternion */
- Mat3ToQuat(rmat3, parchan->quat);
-
- /* for size, remove rotation */
- QuatToMat3(parchan->quat, qmat);
- Mat3Inv(imat, qmat);
- Mat3MulMat3(smat, rmat3, imat);
- Mat3ToSize(smat, parchan->size);
-
- VECCOPY(parchan->loc, rmat[3]);
- }
-
- }
-
- apply= 1;
- data->flag &= ~CONSTRAINT_IK_AUTO;
- }
- }
-
- return apply;
-}
-
-static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, TransData *td)
-{
- Bone *bone= pchan->bone;
- float pmat[3][3], omat[3][3];
- float cmat[3][3], tmat[3][3];
- float vec[3];
-
- VECCOPY(vec, pchan->pose_mat[3]);
- VECCOPY(td->center, vec);
-
- td->ob = ob;
- td->flag= TD_SELECTED|TD_USEQUAT;
- if(bone->flag & BONE_HINGE_CHILD_TRANSFORM)
- td->flag |= TD_NOCENTER;
- td->protectflag= pchan->protectflag;
-
- td->loc = pchan->loc;
- VECCOPY(td->iloc, pchan->loc);
-
- td->ext->rot= NULL;
- td->ext->quat= pchan->quat;
- td->ext->size= pchan->size;
-
- QUATCOPY(td->ext->iquat, pchan->quat);
- VECCOPY(td->ext->isize, pchan->size);
-
- /* proper way to get parent transform + own transform + constraints transform */
- Mat3CpyMat4(omat, ob->obmat);
-
- if(pchan->parent) {
- if(pchan->bone->flag & BONE_HINGE)
- Mat3CpyMat4(pmat, pchan->parent->bone->arm_mat);
- else
- Mat3CpyMat4(pmat, pchan->parent->pose_mat);
-
- if (constraints_list_needinv(t, &pchan->constraints)) {
- Mat3CpyMat4(tmat, pchan->constinv);
- Mat3Inv(cmat, tmat);
- Mat3MulSerie(td->mtx, pchan->bone->bone_mat, pmat, cmat, omat, 0,0,0,0); // dang mulserie swaps args
- }
- else
- Mat3MulSerie(td->mtx, pchan->bone->bone_mat, pmat, omat, 0,0,0,0,0); // dang mulserie swaps args
- }
- else {
- if (constraints_list_needinv(t, &pchan->constraints)) {
- Mat3CpyMat4(tmat, pchan->constinv);
- Mat3Inv(cmat, tmat);
- Mat3MulSerie(td->mtx, pchan->bone->bone_mat, cmat, omat, 0, 0,0,0,0); // dang mulserie swaps args
- }
- else
- Mat3MulMat3(td->mtx, omat, pchan->bone->bone_mat); // Mat3MulMat3 has swapped args!
- }
-
- Mat3Inv(td->smtx, td->mtx);
-
- /* for axismat we use bone's own transform */
- Mat3CpyMat4(pmat, pchan->pose_mat);
- Mat3MulMat3(td->axismtx, omat, pmat);
- Mat3Ortho(td->axismtx);
-
- if(t->mode==TFM_BONESIZE) {
- bArmature *arm= t->poseobj->data;
-
- if(arm->drawtype==ARM_ENVELOPE) {
- td->loc= NULL;
- td->val= &bone->dist;
- td->ival= bone->dist;
- }
- else {
- // abusive storage of scale in the loc pointer :)
- td->loc= &bone->xwidth;
- VECCOPY (td->iloc, td->loc);
- td->val= NULL;
- }
- }
-
- /* in this case we can do target-less IK grabbing */
- if(t->mode==TFM_TRANSLATION) {
- bKinematicConstraint *data= has_targetless_ik(pchan);
- if(data) {
- if(data->flag & CONSTRAINT_IK_TIP) {
- VECCOPY(data->grabtarget, pchan->pose_tail);
- }
- else {
- VECCOPY(data->grabtarget, pchan->pose_head);
- }
- td->loc = data->grabtarget;
- VECCOPY(td->iloc, td->loc);
- data->flag |= CONSTRAINT_IK_AUTO;
-
- /* only object matrix correction */
- Mat3CpyMat3 (td->mtx, omat);
- Mat3Inv (td->smtx, td->mtx);
- }
- }
-
- /* store reference to first constraint */
- td->con= pchan->constraints.first;
-}
-
-static void bone_children_clear_transflag(ListBase *lb)
-{
- Bone *bone= lb->first;
-
- for(;bone;bone= bone->next) {
- if((bone->flag & BONE_HINGE) && (bone->flag & BONE_CONNECTED))
- bone->flag |= BONE_HINGE_CHILD_TRANSFORM;
- else
- bone->flag &= ~BONE_TRANSFORM;
-
- bone_children_clear_transflag(&bone->childbase);
- }
-}
-
-/* sets transform flags in the bones, returns total */
-static void set_pose_transflags(TransInfo *t, Object *ob)
-{
- bArmature *arm= ob->data;
- bPoseChannel *pchan;
- Bone *bone;
- int hastranslation;
-
- t->total= 0;
-
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- bone= pchan->bone;
- if(bone->layer & arm->layer) {
- if(bone->flag & BONE_SELECTED)
- bone->flag |= BONE_TRANSFORM;
- else
- bone->flag &= ~BONE_TRANSFORM;
-
- bone->flag &= ~BONE_HINGE_CHILD_TRANSFORM;
- }
- }
-
- /* make sure no bone can be transformed when a parent is transformed */
- /* since pchans are depsgraph sorted, the parents are in beginning of list */
- if(t->mode!=TFM_BONESIZE) {
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- bone= pchan->bone;
- if(bone->flag & BONE_TRANSFORM)
- bone_children_clear_transflag(&bone->childbase);
- }
- }
- /* now count, and check if we have autoIK or have to switch from translate to rotate */
- hastranslation= 0;
-
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- bone= pchan->bone;
- if(bone->flag & BONE_TRANSFORM) {
-
- t->total++;
-
- if(t->mode==TFM_TRANSLATION) {
- if( has_targetless_ik(pchan)==NULL ) {
- if(pchan->parent && (pchan->bone->flag & BONE_CONNECTED)) {
- if(pchan->bone->flag & BONE_HINGE_CHILD_TRANSFORM)
- hastranslation= 1;
- }
- else if((pchan->protectflag & OB_LOCK_LOC)!=OB_LOCK_LOC)
- hastranslation= 1;
- }
- else
- hastranslation= 1;
- }
- }
- }
-
- /* if there are no translatable bones, do rotation */
- if(t->mode==TFM_TRANSLATION && !hastranslation)
- t->mode= TFM_ROTATION;
-}
-
-
-/* -------- Auto-IK ---------- */
-
-/* adjust pose-channel's auto-ik chainlen */
-static void pchan_autoik_adjust (bPoseChannel *pchan, short chainlen)
-{
- bConstraint *con;
-
- /* don't bother to search if no valid constraints */
- if ((pchan->constflag & (PCHAN_HAS_IK|PCHAN_HAS_TARGET))==0)
- return;
-
- /* check if pchan has ik-constraint */
- for (con= pchan->constraints.first; con; con= con->next) {
- if (con->type == CONSTRAINT_TYPE_KINEMATIC) {
- bKinematicConstraint *data= con->data;
-
- /* only accept if a temporary one (for auto-ik) */
- if (data->flag & CONSTRAINT_IK_TEMP) {
- /* chainlen is new chainlen, but is limited by maximum chainlen */
- if ((chainlen==0) || (chainlen > data->max_rootbone))
- data->rootbone= data->max_rootbone;
- else
- data->rootbone= chainlen;
- }
- }
- }
-}
-
-/* change the chain-length of auto-ik */
-void transform_autoik_update (TransInfo *t, short mode)
-{
- short *chainlen= &G.scene->toolsettings->autoik_chainlen;
- bPoseChannel *pchan;
-
- /* mode determines what change to apply to chainlen */
- if (mode == 1) {
- /* mode=1 is from WHEELMOUSEDOWN... increases len */
- (*chainlen)++;
- }
- else if (mode == -1) {
- /* mode==-1 is from WHEELMOUSEUP... decreases len */
- if (*chainlen > 0) (*chainlen)--;
- }
-
- /* sanity checks (don't assume t->poseobj is set, or that it is an armature) */
- if (ELEM(NULL, t->poseobj, t->poseobj->pose))
- return;
-
- /* apply to all pose-channels */
- for (pchan=t->poseobj->pose->chanbase.first; pchan; pchan=pchan->next) {
- pchan_autoik_adjust(pchan, *chainlen);
- }
-}
-
-/* frees temporal IKs */
-static void pose_grab_with_ik_clear(Object *ob)
-{
- bKinematicConstraint *data;
- bPoseChannel *pchan;
- bConstraint *con;
-
- for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- /* clear all temporary lock flags */
- pchan->ikflag &= ~(BONE_IK_NO_XDOF_TEMP|BONE_IK_NO_YDOF_TEMP|BONE_IK_NO_ZDOF_TEMP);
-
- /* remove all temporary IK-constraints added */
- for (con= pchan->constraints.first; con; con= con->next) {
- if (con->type==CONSTRAINT_TYPE_KINEMATIC) {
- data= con->data;
- if (data->flag & CONSTRAINT_IK_TEMP) {
- BLI_remlink(&pchan->constraints, con);
- MEM_freeN(con->data);
- MEM_freeN(con);
- pchan->constflag &= ~(PCHAN_HAS_IK|PCHAN_HAS_TARGET);
- break;
- }
- }
- }
- }
-}
-
-/* adds the IK to pchan - returns if added */
-static short pose_grab_with_ik_add(bPoseChannel *pchan)
-{
- bKinematicConstraint *data;
- bConstraint *con;
-
- /* Sanity check */
- if (pchan == NULL)
- return 0;
-
- /* rule: not if there's already an IK on this channel */
- for (con= pchan->constraints.first; con; con= con->next)
- if (con->type==CONSTRAINT_TYPE_KINEMATIC)
- break;
-
- if (con) {
- /* but, if this is a targetless IK, we make it auto anyway (for the children loop) */
- data= has_targetless_ik(pchan);
- if (data)
- data->flag |= CONSTRAINT_IK_AUTO;
- return 0;
- }
-
- con = add_new_constraint(CONSTRAINT_TYPE_KINEMATIC);
- BLI_addtail(&pchan->constraints, con);
- pchan->constflag |= (PCHAN_HAS_IK|PCHAN_HAS_TARGET); /* for draw, but also for detecting while pose solving */
- data= con->data;
- data->flag= CONSTRAINT_IK_TIP|CONSTRAINT_IK_TEMP|CONSTRAINT_IK_AUTO;
- VECCOPY(data->grabtarget, pchan->pose_tail);
- data->rootbone= 1;
-
- /* we include only a connected chain */
- while ((pchan) && (pchan->bone->flag & BONE_CONNECTED)) {
- /* here, we set ik-settings for bone from pchan->protectflag */
- if (pchan->protectflag & OB_LOCK_ROTX) pchan->ikflag |= BONE_IK_NO_XDOF_TEMP;
- if (pchan->protectflag & OB_LOCK_ROTY) pchan->ikflag |= BONE_IK_NO_YDOF_TEMP;
- if (pchan->protectflag & OB_LOCK_ROTZ) pchan->ikflag |= BONE_IK_NO_ZDOF_TEMP;
-
- /* now we count this pchan as being included */
- data->rootbone++;
- pchan= pchan->parent;
- }
-
- /* make a copy of maximum chain-length */
- data->max_rootbone= data->rootbone;
-
- return 1;
-}
-
-/* bone is a canditate to get IK, but we don't do it if it has children connected */
-static short pose_grab_with_ik_children(bPose *pose, Bone *bone)
-{
- Bone *bonec;
- short wentdeeper=0, added=0;
-
- /* go deeper if children & children are connected */
- for (bonec= bone->childbase.first; bonec; bonec= bonec->next) {
- if (bonec->flag & BONE_CONNECTED) {
- wentdeeper= 1;
- added+= pose_grab_with_ik_children(pose, bonec);
- }
- }
- if (wentdeeper==0) {
- bPoseChannel *pchan= get_pose_channel(pose, bone->name);
- if (pchan)
- added+= pose_grab_with_ik_add(pchan);
- }
-
- return added;
-}
-
-/* main call which adds temporal IK chains */
-static short pose_grab_with_ik(Object *ob)
-{
- bArmature *arm;
- bPoseChannel *pchan, *pchansel= NULL;
- Bone *bonec;
-
- if (ob==NULL || ob->pose==NULL || (ob->flag & OB_POSEMODE)==0)
- return 0;
-
- arm = ob->data;
-
- /* rule: only one Bone */
- for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if (pchan->bone->layer & arm->layer) {
- if (pchan->bone->flag & BONE_SELECTED) {
- if (pchansel)
- break;
- pchansel= pchan;
- }
- }
- }
- if (pchan || pchansel==NULL) return 0;
-
- /* rule: no IK for solitary (unconnected) bone */
- for (bonec=pchansel->bone->childbase.first; bonec; bonec=bonec->next) {
- if (bonec->flag & BONE_CONNECTED) {
- break;
- }
- }
- if ((pchansel->bone->flag & BONE_CONNECTED)==0 && (bonec == NULL)) return 0;
-
- /* rule: if selected Bone is not a root bone, it gets a temporal IK */
- if (pchansel->parent) {
- /* only adds if there's no IK yet */
- return pose_grab_with_ik_add(pchansel);
- }
- else {
- /* rule: go over the children and add IK to the tips */
- return pose_grab_with_ik_children(ob->pose, pchansel->bone);
- }
-}
-
-
-/* only called with pose mode active object now */
-static void createTransPose(TransInfo *t, Object *ob)
-{
- bArmature *arm;
- bPoseChannel *pchan;
- TransData *td;
- TransDataExtension *tdx;
- short ik_on= 0;
- int i;
-
- t->total= 0;
-
- /* check validity of state */
- arm=get_armature (ob);
- if (arm==NULL || ob->pose==NULL) return;
-
- if (arm->flag & ARM_RESTPOS) {
- if(t->mode!=TFM_BONESIZE) {
- notice ("Pose edit not possible while Rest Position is enabled");
- return;
- }
- }
- if (!(ob->lay & G.vd->lay)) return;
-
- /* do we need to add temporal IK chains? */
- if ((arm->flag & ARM_AUTO_IK) && t->mode==TFM_TRANSLATION) {
- ik_on= pose_grab_with_ik(ob);
- if (ik_on) t->flag |= T_AUTOIK;
- }
-
- /* set flags and count total (warning, can change transform to rotate) */
- set_pose_transflags(t, ob);
-
- if(t->total==0) return;
-
- t->flag |= T_POSE;
- t->poseobj= ob; /* we also allow non-active objects to be transformed, in weightpaint */
-
- /* make sure the lock is set OK, unlock can be accidentally saved? */
- ob->pose->flag |= POSE_LOCKED;
- ob->pose->flag &= ~POSE_DO_UNLOCK;
-
- /* init trans data */
- td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransPoseBone");
- tdx = t->ext = MEM_callocN(t->total*sizeof(TransDataExtension), "TransPoseBoneExt");
- for(i=0; i<t->total; i++, td++, tdx++) {
- td->ext= tdx;
- td->tdi = NULL;
- td->val = NULL;
- }
-
- /* use pose channels to fill trans data */
- td= t->data;
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if(pchan->bone->flag & BONE_TRANSFORM) {
- add_pose_transdata(t, pchan, ob, td);
- td++;
- }
- }
-
- if(td != (t->data+t->total)) printf("Bone selection count error\n");
-
- /* initialise initial auto=ik chainlen's? */
- if (ik_on) transform_autoik_update(t, 0);
-}
-
-/* ********************* armature ************** */
-
-static void createTransArmatureVerts(TransInfo *t)
-{
- EditBone *ebo;
- bArmature *arm= G.obedit->data;
- TransData *td;
- float mtx[3][3], smtx[3][3], delta[3], bonemat[3][3];
-
- t->total = 0;
- for (ebo=G.edbo.first;ebo;ebo=ebo->next) {
- if(ebo->layer & arm->layer) {
- if (t->mode==TFM_BONESIZE) {
- if (ebo->flag & BONE_SELECTED)
- t->total++;
- }
- else if (t->mode==TFM_BONE_ROLL) {
- if (ebo->flag & BONE_SELECTED)
- t->total++;
- }
- else {
- if (ebo->flag & BONE_TIPSEL)
- t->total++;
- if (ebo->flag & BONE_ROOTSEL)
- t->total++;
- }
- }
- }
-
- if (!t->total) return;
-
- Mat3CpyMat4(mtx, G.obedit->obmat);
- Mat3Inv(smtx, mtx);
-
- td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransEditBone");
-
- for (ebo=G.edbo.first;ebo;ebo=ebo->next){
- ebo->oldlength= ebo->length; // length==0.0 on extrude, used for scaling radius of bone points
-
- if(ebo->layer & arm->layer) {
- if (t->mode==TFM_BONE_ENVELOPE) {
-
- if (ebo->flag & BONE_ROOTSEL){
- td->val= &ebo->rad_head;
- td->ival= *td->val;
-
- VECCOPY (td->center, ebo->head);
- td->flag= TD_SELECTED;
-
- Mat3CpyMat3(td->smtx, smtx);
- Mat3CpyMat3(td->mtx, mtx);
-
- td->loc = NULL;
- td->ext = NULL;
- td->tdi = NULL;
-
- td++;
- }
- if (ebo->flag & BONE_TIPSEL){
- td->val= &ebo->rad_tail;
- td->ival= *td->val;
- VECCOPY (td->center, ebo->tail);
- td->flag= TD_SELECTED;
-
- Mat3CpyMat3(td->smtx, smtx);
- Mat3CpyMat3(td->mtx, mtx);
-
- td->loc = NULL;
- td->ext = NULL;
- td->tdi = NULL;
-
- td++;
- }
-
- }
- else if (t->mode==TFM_BONESIZE) {
- if (ebo->flag & BONE_SELECTED) {
- if(arm->drawtype==ARM_ENVELOPE) {
- td->loc= NULL;
- td->val= &ebo->dist;
- td->ival= ebo->dist;
- }
- else {
- // abusive storage of scale in the loc pointer :)
- td->loc= &ebo->xwidth;
- VECCOPY (td->iloc, td->loc);
- td->val= NULL;
- }
- VECCOPY (td->center, ebo->head);
- td->flag= TD_SELECTED;
-
- /* use local bone matrix */
- VecSubf(delta, ebo->tail, ebo->head);
- vec_roll_to_mat3(delta, ebo->roll, bonemat);
- Mat3MulMat3(td->mtx, mtx, bonemat);
- Mat3Inv(td->smtx, td->mtx);
-
- Mat3CpyMat3(td->axismtx, td->mtx);
- Mat3Ortho(td->axismtx);
-
- td->ext = NULL;
- td->tdi = NULL;
-
- td++;
- }
- }
- else if (t->mode==TFM_BONE_ROLL) {
- if (ebo->flag & BONE_SELECTED) {
- td->loc= NULL;
- td->val= &(ebo->roll);
- td->ival= ebo->roll;
-
- VECCOPY (td->center, ebo->head);
- td->flag= TD_SELECTED;
-
- td->ext = NULL;
- td->tdi = NULL;
-
- td++;
- }
- }
- else {
- if (ebo->flag & BONE_TIPSEL){
- VECCOPY (td->iloc, ebo->tail);
- VECCOPY (td->center, td->iloc);
- td->loc= ebo->tail;
- td->flag= TD_SELECTED;
-
- Mat3CpyMat3(td->smtx, smtx);
- Mat3CpyMat3(td->mtx, mtx);
-
- td->ext = NULL;
- td->tdi = NULL;
- td->val = NULL;
-
- td++;
- }
- if (ebo->flag & BONE_ROOTSEL){
- VECCOPY (td->iloc, ebo->head);
- VECCOPY (td->center, td->iloc);
- td->loc= ebo->head;
- td->flag= TD_SELECTED;
-
- Mat3CpyMat3(td->smtx, smtx);
- Mat3CpyMat3(td->mtx, mtx);
-
- td->ext = NULL;
- td->tdi = NULL;
- td->val = NULL;
-
- td++;
- }
- }
- }
- }
-}
-
-/* ********************* meta elements ********* */
-
-static void createTransMBallVerts(TransInfo *t)
-{
- MetaElem *ml;
- TransData *td;
- TransDataExtension *tx;
- float mtx[3][3], smtx[3][3];
- int count=0, countsel=0;
- int propmode = t->flag & T_PROP_EDIT;
-
- /* count totals */
- for(ml= editelems.first; ml; ml= ml->next) {
- if(ml->flag & SELECT) countsel++;
- if(propmode) count++;
- }
-
- /* note: in prop mode we need at least 1 selected */
- if (countsel==0) return;
-
- if(propmode) t->total = count;
- else t->total = countsel;
-
- td = t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(MBall EditMode)");
- tx = t->ext = MEM_callocN(t->total*sizeof(TransDataExtension), "MetaElement_TransExtension");
-
- Mat3CpyMat4(mtx, G.obedit->obmat);
- Mat3Inv(smtx, mtx);
-
- for(ml= editelems.first; ml; ml= ml->next) {
- if(propmode || (ml->flag & SELECT)) {
- td->loc= &ml->x;
- VECCOPY(td->iloc, td->loc);
- VECCOPY(td->center, td->loc);
-
- if(ml->flag & SELECT) td->flag= TD_SELECTED | TD_USEQUAT | TD_SINGLESIZE;
- else td->flag= TD_USEQUAT;
-
- Mat3CpyMat3(td->smtx, smtx);
- Mat3CpyMat3(td->mtx, mtx);
-
- td->ext = tx;
- td->tdi = NULL;
-
- /* Radius of MetaElem (mass of MetaElem influence) */
- if(ml->flag & MB_SCALE_RAD){
- td->val = &ml->rad;
- td->ival = ml->rad;
- }
- else{
- td->val = &ml->s;
- td->ival = ml->s;
- }
-
- /* expx/expy/expz determine "shape" of some MetaElem types */
- tx->size = &ml->expx;
- tx->isize[0] = ml->expx;
- tx->isize[1] = ml->expy;
- tx->isize[2] = ml->expz;
-
- /* quat is used for rotation of MetaElem */
- tx->quat = ml->quat;
- QUATCOPY(tx->iquat, ml->quat);
-
- tx->rot = NULL;
-
- td++;
- tx++;
- }
- }
-}
-
-/* ********************* curve/surface ********* */
-
-static void calc_distanceCurveVerts(TransData *head, TransData *tail) {
- TransData *td, *td_near = NULL;
- for (td = head; td<=tail; td++) {
- if (td->flag & TD_SELECTED) {
- td_near = td;
- td->dist = 0.0f;
- }
- else if(td_near) {
- float dist;
- dist = VecLenf(td_near->center, td->center);
- if (dist < (td-1)->dist) {
- td->dist = (td-1)->dist;
- }
- else {
- td->dist = dist;
- }
- }
- else {
- td->dist = MAXFLOAT;
- td->flag |= TD_NOTCONNECTED;
- }
- }
- td_near = NULL;
- for (td = tail; td>=head; td--) {
- if (td->flag & TD_SELECTED) {
- td_near = td;
- td->dist = 0.0f;
- }
- else if(td_near) {
- float dist;
- dist = VecLenf(td_near->center, td->center);
- if (td->flag & TD_NOTCONNECTED || dist < td->dist || (td+1)->dist < td->dist) {
- td->flag &= ~TD_NOTCONNECTED;
- if (dist < (td+1)->dist) {
- td->dist = (td+1)->dist;
- }
- else {
- td->dist = dist;
- }
- }
- }
- }
-}
-
-static void createTransCurveVerts(TransInfo *t)
-{
- TransData *td = NULL;
- Nurb *nu;
- BezTriple *bezt;
- BPoint *bp;
- float mtx[3][3], smtx[3][3];
- int a;
- int count=0, countsel=0;
- int propmode = t->flag & T_PROP_EDIT;
-
- /* count total of vertices, check identical as in 2nd loop for making transdata! */
- for(nu= editNurb.first; nu; nu= nu->next) {
- if((nu->type & 7)==CU_BEZIER) {
- for(a=0, bezt= nu->bezt; a<nu->pntsu; a++, bezt++) {
- if(bezt->hide==0) {
- if (G.f & G_HIDDENHANDLES) {
- if(bezt->f2 & SELECT) countsel+=3;
- if(propmode) count+= 3;
- } else {
- if(bezt->f1 & SELECT) countsel++;
- if(bezt->f2 & SELECT) countsel++;
- if(bezt->f3 & SELECT) countsel++;
- if(propmode) count+= 3;
- }
- }
- }
- }
- else {
- for(a= nu->pntsu*nu->pntsv, bp= nu->bp; a>0; a--, bp++) {
- if(bp->hide==0) {
- if(propmode) count++;
- if(bp->f1 & SELECT) countsel++;
- }
- }
- }
- }
- /* note: in prop mode we need at least 1 selected */
- if (countsel==0) return;
-
- if(propmode) t->total = count;
- else t->total = countsel;
- t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(Curve EditMode)");
-
- Mat3CpyMat4(mtx, G.obedit->obmat);
- Mat3Inv(smtx, mtx);
-
- td = t->data;
- for(nu= editNurb.first; nu; nu= nu->next) {
- if((nu->type & 7)==CU_BEZIER) {
- TransData *head, *tail;
- head = tail = td;
- for(a=0, bezt= nu->bezt; a<nu->pntsu; a++, bezt++) {
- if(bezt->hide==0) {
-
- if( propmode ||
- ((bezt->f2 & SELECT) && (G.f & G_HIDDENHANDLES)) ||
- ((bezt->f1 & SELECT) && (G.f & G_HIDDENHANDLES)==0)
- ) {
- VECCOPY(td->iloc, bezt->vec[0]);
- td->loc= bezt->vec[0];
- VECCOPY(td->center, bezt->vec[1]);
- if (G.f & G_HIDDENHANDLES) {
- if(bezt->f2 & SELECT) td->flag= TD_SELECTED;
- else td->flag= 0;
- } else {
- if(bezt->f1 & SELECT) td->flag= TD_SELECTED;
- else td->flag= 0;
- }
- td->ext = NULL;
- td->tdi = NULL;
- td->val = NULL;
-
- Mat3CpyMat3(td->smtx, smtx);
- Mat3CpyMat3(td->mtx, mtx);
-
- td++;
- count++;
- tail++;
- }
-
- /* This is the Curve Point, the other two are handles */
- if(propmode || (bezt->f2 & SELECT)) {
- VECCOPY(td->iloc, bezt->vec[1]);
- td->loc= bezt->vec[1];
- VECCOPY(td->center, td->loc);
- if(bezt->f2 & SELECT) td->flag= TD_SELECTED;
- else td->flag= 0;
- td->ext = NULL;
- td->tdi = NULL;
-
- if (t->mode==TFM_CURVE_SHRINKFATTEN) { /* || t->mode==TFM_RESIZE) {*/ /* TODO - make points scale */
- td->val = &(bezt->radius);
- td->ival = bezt->radius;
- } else if (t->mode==TFM_TILT) {
- td->val = &(bezt->alfa);
- td->ival = bezt->alfa;
- } else {
- td->val = NULL;
- }
-
- Mat3CpyMat3(td->smtx, smtx);
- Mat3CpyMat3(td->mtx, mtx);
-
- td++;
- count++;
- tail++;
- }
- if( propmode ||
- ((bezt->f1 & SELECT) && (G.f & G_HIDDENHANDLES)) ||
- ((bezt->f3 & SELECT) && (G.f & G_HIDDENHANDLES)==0)
- ) {
- VECCOPY(td->iloc, bezt->vec[2]);
- td->loc= bezt->vec[2];
- VECCOPY(td->center, bezt->vec[1]);
- if (G.f & G_HIDDENHANDLES) {
- if(bezt->f2 & SELECT) td->flag= TD_SELECTED;
- else td->flag= 0;
- } else {
- if(bezt->f3 & SELECT) td->flag= TD_SELECTED;
- else td->flag= 0;
- }
- td->ext = NULL;
- td->tdi = NULL;
- td->val = NULL;
-
- Mat3CpyMat3(td->smtx, smtx);
- Mat3CpyMat3(td->mtx, mtx);
-
- td++;
- count++;
- tail++;
- }
- }
- else if (propmode && head != tail) {
- calc_distanceCurveVerts(head, tail-1);
- head = tail;
- }
- }
- if (propmode && head != tail)
- calc_distanceCurveVerts(head, tail-1);
- }
- else {
- TransData *head, *tail;
- head = tail = td;
- for(a= nu->pntsu*nu->pntsv, bp= nu->bp; a>0; a--, bp++) {
- if(bp->hide==0) {
- if(propmode || (bp->f1 & SELECT)) {
- VECCOPY(td->iloc, bp->vec);
- td->loc= bp->vec;
- VECCOPY(td->center, td->loc);
- if(bp->f1 & SELECT) td->flag= TD_SELECTED;
- else td->flag= 0;
- td->ext = NULL;
- td->tdi = NULL;
-
- if (t->mode==TFM_CURVE_SHRINKFATTEN || t->mode==TFM_RESIZE) {
- td->val = &(bp->radius);
- td->ival = bp->radius;
- } else {
- td->val = &(bp->alfa);
- td->ival = bp->alfa;
- }
-
- Mat3CpyMat3(td->smtx, smtx);
- Mat3CpyMat3(td->mtx, mtx);
-
- td++;
- count++;
- tail++;
- }
- }
- else if (propmode && head != tail) {
- calc_distanceCurveVerts(head, tail-1);
- head = tail;
- }
- }
- if (propmode && head != tail)
- calc_distanceCurveVerts(head, tail-1);
- }
- }
-}
-
-/* ********************* lattice *************** */
-
-static void createTransLatticeVerts(TransInfo *t)
-{
- TransData *td = NULL;
- BPoint *bp;
- float mtx[3][3], smtx[3][3];
- int a;
- int count=0, countsel=0;
- int propmode = t->flag & T_PROP_EDIT;
-
- bp= editLatt->def;
- a= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw;
- while(a--) {
- if(bp->hide==0) {
- if(bp->f1 & SELECT) countsel++;
- if(propmode) count++;
- }
- bp++;
- }
-
- /* note: in prop mode we need at least 1 selected */
- if (countsel==0) return;
-
- if(propmode) t->total = count;
- else t->total = countsel;
- t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(Lattice EditMode)");
-
- Mat3CpyMat4(mtx, G.obedit->obmat);
- Mat3Inv(smtx, mtx);
-
- td = t->data;
- bp= editLatt->def;
- a= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw;
- while(a--) {
- if(propmode || (bp->f1 & SELECT)) {
- if(bp->hide==0) {
- VECCOPY(td->iloc, bp->vec);
- td->loc= bp->vec;
- VECCOPY(td->center, td->loc);
- if(bp->f1 & SELECT) td->flag= TD_SELECTED;
- else td->flag= 0;
- Mat3CpyMat3(td->smtx, smtx);
- Mat3CpyMat3(td->mtx, mtx);
-
- td->ext = NULL;
- td->tdi = NULL;
- td->val = NULL;
-
- td++;
- count++;
- }
- }
- bp++;
- }
-}
-
-/* ******************* particle edit **************** */
-static void createTransParticleVerts(TransInfo *t)
-{
- TransData *td = NULL;
- TransDataExtension *tx;
- Base *base = BASACT;
- Object *ob = OBACT;
- ParticleSystem *psys = PE_get_current(ob);
- ParticleSystemModifierData *psmd = NULL;
- ParticleEditSettings *pset = PE_settings();
- ParticleData *pa = NULL;
- ParticleEdit *edit;
- ParticleEditKey *key;
- float mat[4][4];
- int i,k, totpart, transformparticle;
- int count = 0, hasselected = 0;
- int propmode = t->flag & T_PROP_EDIT;
-
- if(psys==NULL || G.scene->selectmode==SCE_SELECT_PATH) return;
-
- psmd = psys_get_modifier(ob,psys);
-
- edit = psys->edit;
- totpart = psys->totpart;
- base->flag |= BA_HAS_RECALC_DATA;
-
- for(i=0, pa=psys->particles; i<totpart; i++, pa++) {
- pa->flag &= ~PARS_TRANSFORM;
- transformparticle= 0;
-
- if((pa->flag & PARS_HIDE)==0) {
- for(k=0, key=edit->keys[i]; k<pa->totkey; k++, key++) {
- if((key->flag&PEK_HIDE)==0) {
- if(key->flag&PEK_SELECT) {
- hasselected= 1;
- transformparticle= 1;
- }
- else if(propmode)
- transformparticle= 1;
- }
- }
- }
-
- if(transformparticle) {
- count += pa->totkey;
- pa->flag |= PARS_TRANSFORM;
- }
- }
-
- /* note: in prop mode we need at least 1 selected */
- if (hasselected==0) return;
-
- t->total = count;
- td = t->data = MEM_callocN(t->total * sizeof(TransData), "TransObData(Particle Mode)");
-
- if(t->mode == TFM_BAKE_TIME)
- tx = t->ext = MEM_callocN(t->total * sizeof(TransDataExtension), "Particle_TransExtension");
- else
- tx = t->ext = NULL;
-
- Mat4One(mat);
-
- Mat4Invert(ob->imat,ob->obmat);
-
- for(i=0, pa=psys->particles; i<totpart; i++, pa++) {
- TransData *head, *tail;
- head = tail = td;
-
- if(!(pa->flag & PARS_TRANSFORM)) continue;
-
- psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, pa, mat);
-
- for(k=0, key=edit->keys[i]; k<pa->totkey; k++, key++) {
- VECCOPY(key->world_co, key->co);
- Mat4MulVecfl(mat, key->world_co);
- td->loc = key->world_co;
-
- VECCOPY(td->iloc, td->loc);
- VECCOPY(td->center, td->loc);
-
- if(key->flag & PEK_SELECT)
- td->flag |= TD_SELECTED;
- else if(!propmode)
- td->flag |= TD_SKIP;
-
- Mat3One(td->mtx);
- Mat3One(td->smtx);
-
- /* don't allow moving roots */
- if(k==0 && pset->flag & PE_LOCK_FIRST)
- td->protectflag |= OB_LOCK_LOC;
-
- td->ob = ob;
- td->ext = tx;
- td->tdi = NULL;
- if(t->mode == TFM_BAKE_TIME) {
- td->val = key->time;
- td->ival = *(key->time);
- /* abuse size and quat for min/max values */
- td->flag |= TD_NO_EXT;
- if(k==0) tx->size = 0;
- else tx->size = (key - 1)->time;
-
- if(k == pa->totkey - 1) tx->quat = 0;
- else tx->quat = (key + 1)->time;
- }
-
- td++;
- if(tx)
- tx++;
- tail++;
- }
- if (propmode && head != tail)
- calc_distanceCurveVerts(head, tail - 1);
- }
-}
-
-void flushTransParticles(TransInfo *t)
-{
- Object *ob = OBACT;
- ParticleSystem *psys = PE_get_current(ob);
- ParticleSystemModifierData *psmd;
- ParticleData *pa;
- ParticleEditKey *key;
- TransData *td;
- float mat[4][4], imat[4][4], co[3];
- int i, k, propmode = t->flag & T_PROP_EDIT;
-
- psmd = psys_get_modifier(ob, psys);
-
- /* we do transform in world space, so flush world space position
- * back to particle local space */
- td= t->data;
- for(i=0, pa=psys->particles; i<psys->totpart; i++, pa++, td++) {
- if(!(pa->flag & PARS_TRANSFORM)) continue;
-
- psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, pa, mat);
- Mat4Invert(imat,mat);
-
- for(k=0, key=psys->edit->keys[i]; k<pa->totkey; k++, key++) {
- VECCOPY(co, key->world_co);
- Mat4MulVecfl(imat, co);
-
- /* optimization for proportional edit */
- if(!propmode || !FloatCompare(key->co, co, 0.0001f)) {
- VECCOPY(key->co, co);
- pa->flag |= PARS_EDIT_RECALC;
- }
- }
- }
-
- PE_update_object(OBACT, 1);
-}
-
-/* ********************* mesh ****************** */
-
-/* proportional distance based on connectivity */
-#define E_VEC(a) (vectors + (3 * (a)->tmp.l))
-#define E_NEAR(a) (nears[((a)->tmp.l)])
-#define THRESHOLD 0.0001f
-static void editmesh_set_connectivity_distance(int total, float *vectors, EditVert **nears)
-{
- EditMesh *em = G.editMesh;
- EditVert *eve;
- EditEdge *eed;
- int i= 0, done= 1;
-
- /* f2 flag is used for 'selection' */
- /* tmp.l is offset on scratch array */
- for(eve= em->verts.first; eve; eve= eve->next) {
- if(eve->h==0) {
- eve->tmp.l = i++;
-
- if(eve->f & SELECT) {
- eve->f2= 2;
- E_NEAR(eve) = eve;
- E_VEC(eve)[0] = 0.0f;
- E_VEC(eve)[1] = 0.0f;
- E_VEC(eve)[2] = 0.0f;
- }
- else {
- eve->f2 = 0;
- }
- }
- }
-
-
- /* Floodfill routine */
- /*
- At worst this is n*n of complexity where n is number of edges
- Best case would be n if the list is ordered perfectly.
- Estimate is n log n in average (so not too bad)
- */
- while(done) {
- done= 0;
-
- for(eed= em->edges.first; eed; eed= eed->next) {
- if(eed->h==0) {
- EditVert *v1= eed->v1, *v2= eed->v2;
- float *vec2 = E_VEC(v2);
- float *vec1 = E_VEC(v1);
-
- if (v1->f2 + v2->f2 == 4)
- continue;
-
- if (v1->f2) {
- if (v2->f2) {
- float nvec[3];
- float len1 = VecLength(vec1);
- float len2 = VecLength(vec2);
- float lenn;
- /* for v2 if not selected */
- if (v2->f2 != 2) {
- VecSubf(nvec, v2->co, E_NEAR(v1)->co);
- lenn = VecLength(nvec);
- /* 1 < n < 2 */
- if (lenn - len1 > THRESHOLD && len2 - lenn > THRESHOLD) {
- VECCOPY(vec2, nvec);
- E_NEAR(v2) = E_NEAR(v1);
- done = 1;
- }
- /* n < 1 < 2 */
- else if (len2 - len1 > THRESHOLD && len1 - lenn > THRESHOLD) {
- VECCOPY(vec2, vec1);
- E_NEAR(v2) = E_NEAR(v1);
- done = 1;
- }
- }
- /* for v1 if not selected */
- if (v1->f2 != 2) {
- VecSubf(nvec, v1->co, E_NEAR(v2)->co);
- lenn = VecLength(nvec);
- /* 2 < n < 1 */
- if (lenn - len2 > THRESHOLD && len1 - lenn > THRESHOLD) {
- VECCOPY(vec1, nvec);
- E_NEAR(v1) = E_NEAR(v2);
- done = 1;
- }
- /* n < 2 < 1 */
- else if (len1 - len2 > THRESHOLD && len2 - lenn > THRESHOLD) {
- VECCOPY(vec1, vec2);
- E_NEAR(v1) = E_NEAR(v2);
- done = 1;
- }
- }
- }
- else {
- v2->f2 = 1;
- VecSubf(vec2, v2->co, E_NEAR(v1)->co);
- /* 2 < 1 */
- if (VecLength(vec1) - VecLength(vec2) > THRESHOLD) {
- VECCOPY(vec2, vec1);
- }
- E_NEAR(v2) = E_NEAR(v1);
- done = 1;
- }
- }
- else if (v2->f2) {
- v1->f2 = 1;
- VecSubf(vec1, v1->co, E_NEAR(v2)->co);
- /* 2 < 1 */
- if (VecLength(vec2) - VecLength(vec1) > THRESHOLD) {
- VECCOPY(vec1, vec2);
- }
- E_NEAR(v1) = E_NEAR(v2);
- done = 1;
- }
- }
- }
- }
-}
-
-/* loop-in-a-loop I know, but we need it! (ton) */
-static void get_face_center(float *cent, EditVert *eve)
-{
- EditMesh *em = G.editMesh;
- EditFace *efa;
-
- for(efa= em->faces.first; efa; efa= efa->next)
- if(efa->f & SELECT)
- if(efa->v1==eve || efa->v2==eve || efa->v3==eve || efa->v4==eve)
- break;
- if(efa) {
- VECCOPY(cent, efa->cent);
- }
-}
-
-//way to overwrite what data is edited with transform
-//static void VertsToTransData(TransData *td, EditVert *eve, BakeKey *key)
-static void VertsToTransData(TransData *td, EditVert *eve)
-{
- td->flag = 0;
- //if(key)
- // td->loc = key->co;
- //else
- td->loc = eve->co;
-
- VECCOPY(td->center, td->loc);
- if(G.vd->around==V3D_LOCAL && (G.scene->selectmode & SCE_SELECT_FACE))
- get_face_center(td->center, eve);
- VECCOPY(td->iloc, td->loc);
-
- // Setting normals
- VECCOPY(td->axismtx[2], eve->no);
- td->axismtx[0][0] =
- td->axismtx[0][1] =
- td->axismtx[0][2] =
- td->axismtx[1][0] =
- td->axismtx[1][1] =
- td->axismtx[1][2] = 0.0f;
-
- td->ext = NULL;
- td->tdi = NULL;
- td->val = NULL;
- td->tdmir= NULL;
-
-#ifdef WITH_VERSE
- if(eve->vvert) {
- td->verse = (void*)eve->vvert;
- td->flag |= TD_VERSE_VERT;
- }
- else
- td->flag &= ~TD_VERSE_VERT;
-#endif
-}
-
-/* *********************** CrazySpace correction. Now without doing subsurf optimal ****************** */
-
-static void make_vertexcos__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s)
-{
- float *vec = userData;
-
- vec+= 3*index;
- VECCOPY(vec, co);
-}
-
-static int modifiers_disable_subsurf_temporary(Object *ob)
-{
- ModifierData *md;
- int disabled = 0;
-
- for(md=ob->modifiers.first; md; md=md->next)
- if(md->type==eModifierType_Subsurf)
- if(md->mode & eModifierMode_OnCage) {
- md->mode ^= eModifierMode_DisableTemporary;
- disabled= 1;
- }
-
- return disabled;
-}
-
-/* disable subsurf temporal, get mapped cos, and enable it */
-static float *get_crazy_mapped_editverts(void)
-{
- DerivedMesh *dm;
- float *vertexcos;
-
- /* disable subsurf temporal, get mapped cos, and enable it */
- if(modifiers_disable_subsurf_temporary(G.obedit)) {
- /* need to make new derivemesh */
- makeDerivedMesh(G.obedit, CD_MASK_BAREMESH);
- }
-
- /* now get the cage */
- dm= editmesh_get_derived_cage(CD_MASK_BAREMESH);
-
- vertexcos= MEM_mallocN(3*sizeof(float)*G.totvert, "vertexcos map");
- dm->foreachMappedVert(dm, make_vertexcos__mapFunc, vertexcos);
-
- dm->release(dm);
-
- /* set back the flag, no new cage needs to be built, transform does it */
- modifiers_disable_subsurf_temporary(G.obedit);
-
- return vertexcos;
-}
-
-#define TAN_MAKE_VEC(a, b, c) a[0]= b[0] + 0.2f*(b[0]-c[0]); a[1]= b[1] + 0.2f*(b[1]-c[1]); a[2]= b[2] + 0.2f*(b[2]-c[2])
-static void set_crazy_vertex_quat(float *quat, float *v1, float *v2, float *v3, float *def1, float *def2, float *def3)
-{
- float vecu[3], vecv[3];
- float q1[4], q2[4];
-
- TAN_MAKE_VEC(vecu, v1, v2);
- TAN_MAKE_VEC(vecv, v1, v3);
- triatoquat(v1, vecu, vecv, q1);
-
- TAN_MAKE_VEC(vecu, def1, def2);
- TAN_MAKE_VEC(vecv, def1, def3);
- triatoquat(def1, vecu, vecv, q2);
-
- QuatSub(quat, q2, q1);
-}
-#undef TAN_MAKE_VEC
-
-static void set_crazyspace_quats(float *origcos, float *mappedcos, float *quats)
-{
- EditMesh *em = G.editMesh;
- EditVert *eve, *prev;
- EditFace *efa;
- float *v1, *v2, *v3, *v4, *co1, *co2, *co3, *co4;
- long index= 0;
-
- /* two abused locations in vertices */
- for(eve= em->verts.first; eve; eve= eve->next, index++) {
- eve->tmp.p = NULL;
- eve->prev= (EditVert *)index;
- }
-
- /* first store two sets of tangent vectors in vertices, we derive it just from the face-edges */
- for(efa= em->faces.first; efa; efa= efa->next) {
-
- /* retrieve mapped coordinates */
- v1= mappedcos + 3*(long)(efa->v1->prev);
- v2= mappedcos + 3*(long)(efa->v2->prev);
- v3= mappedcos + 3*(long)(efa->v3->prev);
-
- co1= (origcos)? origcos + 3*(long)(efa->v1->prev): efa->v1->co;
- co2= (origcos)? origcos + 3*(long)(efa->v2->prev): efa->v2->co;
- co3= (origcos)? origcos + 3*(long)(efa->v3->prev): efa->v3->co;
-
- if(efa->v2->tmp.p==NULL && efa->v2->f1) {
- set_crazy_vertex_quat(quats, co2, co3, co1, v2, v3, v1);
- efa->v2->tmp.p= (void*)quats;
- quats+= 4;
- }
-
- if(efa->v4) {
- v4= mappedcos + 3*(long)(efa->v4->prev);
- co4= (origcos)? origcos + 3*(long)(efa->v4->prev): efa->v4->co;
-
- if(efa->v1->tmp.p==NULL && efa->v1->f1) {
- set_crazy_vertex_quat(quats, co1, co2, co4, v1, v2, v4);
- efa->v1->tmp.p= (void*)quats;
- quats+= 4;
- }
- if(efa->v3->tmp.p==NULL && efa->v3->f1) {
- set_crazy_vertex_quat(quats, co3, co4, co2, v3, v4, v2);
- efa->v3->tmp.p= (void*)quats;
- quats+= 4;
- }
- if(efa->v4->tmp.p==NULL && efa->v4->f1) {
- set_crazy_vertex_quat(quats, co4, co1, co3, v4, v1, v3);
- efa->v4->tmp.p= (void*)quats;
- quats+= 4;
- }
- }
- else {
- if(efa->v1->tmp.p==NULL && efa->v1->f1) {
- set_crazy_vertex_quat(quats, co1, co2, co3, v1, v2, v3);
- efa->v1->tmp.p= (void*)quats;
- quats+= 4;
- }
- if(efa->v3->tmp.p==NULL && efa->v3->f1) {
- set_crazy_vertex_quat(quats, co3, co1, co2, v3, v1, v2);
- efa->v3->tmp.p= (void*)quats;
- quats+= 4;
- }
- }
- }
-
- /* restore abused prev pointer */
- for(prev= NULL, eve= em->verts.first; eve; prev= eve, eve= eve->next)
- eve->prev= prev;
-
-}
-
-static void createTransEditVerts(TransInfo *t)
-{
- TransData *tob = NULL;
- EditMesh *em = G.editMesh;
- EditVert *eve;
- EditVert **nears = NULL;
- float *vectors = NULL, *mappedcos = NULL, *quats= NULL;
- float mtx[3][3], smtx[3][3], (*defmats)[3][3] = NULL, (*defcos)[3] = NULL;
- int count=0, countsel=0, a, totleft;
- int propmode = t->flag & T_PROP_EDIT;
- int mirror = 0;
-
- if ((t->context & CTX_NO_MIRROR) == 0 || (G.scene->toolsettings->editbutflag & B_MESH_X_MIRROR))
- {
- mirror = 1;
- }
-
- // transform now requires awareness for select mode, so we tag the f1 flags in verts
- if(G.scene->selectmode & SCE_SELECT_VERTEX) {
- for(eve= em->verts.first; eve; eve= eve->next) {
- if(eve->h==0 && (eve->f & SELECT))
- eve->f1= SELECT;
- else
- eve->f1= 0;
- }
- }
- else if(G.scene->selectmode & SCE_SELECT_EDGE) {
- EditEdge *eed;
- for(eve= em->verts.first; eve; eve= eve->next) eve->f1= 0;
- for(eed= em->edges.first; eed; eed= eed->next) {
- if(eed->h==0 && (eed->f & SELECT))
- eed->v1->f1= eed->v2->f1= SELECT;
- }
- }
- else {
- EditFace *efa;
- for(eve= em->verts.first; eve; eve= eve->next) eve->f1= 0;
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->h==0 && (efa->f & SELECT)) {
- efa->v1->f1= efa->v2->f1= efa->v3->f1= SELECT;
- if(efa->v4) efa->v4->f1= SELECT;
- }
- }
- }
-
- /* now we can count */
- for(eve= em->verts.first; eve; eve= eve->next) {
- if(eve->h==0) {
- if(eve->f1) countsel++;
- if(propmode) count++;
- }
- }
-
- /* note: in prop mode we need at least 1 selected */
- if (countsel==0) return;
-
- if(propmode) {
- t->total = count;
-
- /* allocating scratch arrays */
- vectors = (float *)MEM_mallocN(t->total * 3 * sizeof(float), "scratch vectors");
- nears = (EditVert**)MEM_mallocN(t->total * sizeof(EditVert*), "scratch nears");
- }
- else t->total = countsel;
- tob= t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(Mesh EditMode)");
-
- Mat3CpyMat4(mtx, G.obedit->obmat);
- Mat3Inv(smtx, mtx);
-
- if(propmode) editmesh_set_connectivity_distance(t->total, vectors, nears);
-
- /* detect CrazySpace [tm] */
- if(propmode==0) {
- if(modifiers_getCageIndex(G.obedit, NULL)>=0) {
- if(modifiers_isDeformed(G.obedit)) {
- /* check if we can use deform matrices for modifier from the
- start up to stack, they are more accurate than quats */
- totleft= editmesh_get_first_deform_matrices(&defmats, &defcos);
-
- /* if we still have more modifiers, also do crazyspace
- correction with quats, relative to the coordinates after
- the modifiers that support deform matrices (defcos) */
- if(totleft > 0) {
- mappedcos= get_crazy_mapped_editverts();
- quats= MEM_mallocN( (t->total)*sizeof(float)*4, "crazy quats");
- set_crazyspace_quats((float*)defcos, mappedcos, quats);
- if(mappedcos)
- MEM_freeN(mappedcos);
- }
-
- if(defcos)
- MEM_freeN(defcos);
- }
- }
- }
-
- /* find out which half we do */
- if(mirror) {
- for (eve=em->verts.first; eve; eve=eve->next) {
- if(eve->h==0 && eve->f1 && eve->co[0]!=0.0f) {
- if(eve->co[0]<0.0f)
- mirror = -1;
- break;
- }
- }
- }
-
- for (a=0, eve=em->verts.first; eve; eve=eve->next, a++) {
- if(eve->h==0) {
- if(propmode || eve->f1) {
- VertsToTransData(tob, eve);
-
- if(eve->f1) tob->flag |= TD_SELECTED;
- if(propmode) {
- if (eve->f2) {
- float vec[3];
- VECCOPY(vec, E_VEC(eve));
- Mat3MulVecfl(mtx, vec);
- tob->dist= VecLength(vec);
- }
- else {
- tob->flag |= TD_NOTCONNECTED;
- tob->dist = MAXFLOAT;
- }
- }
-
- /* CrazySpace */
- if(defmats || (quats && eve->tmp.p)) {
- float mat[3][3], imat[3][3], qmat[3][3];
-
- /* use both or either quat and defmat correction */
- if(quats && eve->tmp.f) {
- QuatToMat3(eve->tmp.p, qmat);
-
- if(defmats)
- Mat3MulSerie(mat, mtx, qmat, defmats[a],
- NULL, NULL, NULL, NULL, NULL);
- else
- Mat3MulMat3(mat, mtx, qmat);
- }
- else
- Mat3MulMat3(mat, mtx, defmats[a]);
-
- Mat3Inv(imat, mat);
-
- Mat3CpyMat3(tob->smtx, imat);
- Mat3CpyMat3(tob->mtx, mat);
- }
- else {
- Mat3CpyMat3(tob->smtx, smtx);
- Mat3CpyMat3(tob->mtx, mtx);
- }
-
- /* Mirror? */
- if( (mirror>0 && tob->iloc[0]>0.0f) || (mirror<0 && tob->iloc[0]<0.0f)) {
- EditVert *vmir= editmesh_get_x_mirror_vert(G.obedit, tob->iloc); /* initializes octree on first call */
- if(vmir!=eve) tob->tdmir= vmir;
- }
- tob++;
- }
- }
- }
- if (propmode) {
- MEM_freeN(vectors);
- MEM_freeN(nears);
- }
- /* crazy space free */
- if(quats)
- MEM_freeN(quats);
- if(defmats)
- MEM_freeN(defmats);
-}
-
-/* ********************* UV ****************** */
-
-static void UVsToTransData(TransData *td, TransData2D *td2d, float *uv, int selected)
-{
- float aspx, aspy;
-
- transform_aspect_ratio_tface_uv(&aspx, &aspy);
-
- /* uv coords are scaled by aspects. this is needed for rotations and
- proportional editing to be consistent with the stretchted uv coords
- that are displayed. this also means that for display and numinput,
- and when the the uv coords are flushed, these are converted each time */
- td2d->loc[0] = uv[0]*aspx;
- td2d->loc[1] = uv[1]*aspy;
- td2d->loc[2] = 0.0f;
- td2d->loc2d = uv;
-
- td->flag = 0;
- td->loc = td2d->loc;
- VECCOPY(td->center, td->loc);
- VECCOPY(td->iloc, td->loc);
-
- memset(td->axismtx, 0, sizeof(td->axismtx));
- td->axismtx[2][2] = 1.0f;
-
- td->ext= NULL; td->tdi= NULL; td->val= NULL;
-
- if(selected) {
- td->flag |= TD_SELECTED;
- td->dist= 0.0;
- }
- else
- td->dist= MAXFLOAT;
-
- Mat3One(td->mtx);
- Mat3One(td->smtx);
-}
-
-static void createTransUVs(TransInfo *t)
-{
- TransData *td = NULL;
- TransData2D *td2d = NULL;
- MTFace *tf;
- int count=0, countsel=0;
- int propmode = t->flag & T_PROP_EDIT;
-
- EditMesh *em = G.editMesh;
- EditFace *efa;
-
- if(is_uv_tface_editing_allowed()==0) return;
-
- /* count */
- for (efa= em->faces.first; efa; efa= efa->next) {
- tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tf)) {
- if (simaUVSel_Check(efa, tf, 0)) countsel++;
- if (simaUVSel_Check(efa, tf, 1)) countsel++;
- if (simaUVSel_Check(efa, tf, 2)) countsel++;
- if (efa->v4 && simaUVSel_Check(efa, tf, 3)) countsel++;
- if(propmode)
- count += (efa->v4)? 4: 3;
- }
- }
-
- /* note: in prop mode we need at least 1 selected */
- if (countsel==0) return;
-
- t->total= (propmode)? count: countsel;
- t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(UV Editing)");
- /* for each 2d uv coord a 3d vector is allocated, so that they can be
- treated just as if they were 3d verts */
- t->data2d= MEM_callocN(t->total*sizeof(TransData2D), "TransObData2D(UV Editing)");
-
- if(G.sima->flag & SI_CLIP_UV)
- t->flag |= T_CLIP_UV;
-
- td= t->data;
- td2d= t->data2d;
- for (efa= em->faces.first; efa; efa= efa->next) {
- tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (simaFaceDraw_Check(efa, tf)) {
- if(propmode || simaUVSel_Check(efa, tf, 0))
- UVsToTransData(td++, td2d++, tf->uv[0], simaUVSel_Check(efa, tf, 0));
- if(propmode || simaUVSel_Check(efa, tf, 1))
- UVsToTransData(td++, td2d++, tf->uv[1], simaUVSel_Check(efa, tf, 1));
- if(propmode || simaUVSel_Check(efa, tf, 2))
- UVsToTransData(td++, td2d++, tf->uv[2], simaUVSel_Check(efa, tf, 2));
-
- if(efa->v4 && (propmode || simaUVSel_Check(efa, tf, 3)))
- UVsToTransData(td++, td2d++, tf->uv[3], simaUVSel_Check(efa, tf, 3));
- }
- }
-
- if (G.sima->flag & SI_LIVE_UNWRAP)
- unwrap_lscm_live_begin();
-}
-
-void flushTransUVs(TransInfo *t)
-{
- TransData2D *td;
- int a, width, height;
- Object *ob= OBACT;
- EditMesh *em = G.editMesh;
- float aspx, aspy, invx, invy;
-
- transform_aspect_ratio_tface_uv(&aspx, &aspy);
- transform_width_height_tface_uv(&width, &height);
- invx= 1.0f/aspx;
- invy= 1.0f/aspy;
-
- /* flush to 2d vector from internally used 3d vector */
- for(a=0, td= t->data2d; a<t->total; a++, td++) {
- td->loc2d[0]= td->loc[0]*invx;
- td->loc2d[1]= td->loc[1]*invy;
-
- if((G.sima->flag & SI_PIXELSNAP) && (t->state != TRANS_CANCEL)) {
- td->loc2d[0]= floor(width*td->loc2d[0] + 0.5f)/width;
- td->loc2d[1]= floor(height*td->loc2d[1] + 0.5f)/height;
- }
- }
-
- /* always call this, also for cancel (it transforms non-selected vertices...) */
- if((G.sima->flag & SI_BE_SQUARE))
- be_square_tface_uv(em);
-
- /* this is overkill if G.sima->lock is not set, but still needed */
- object_uvs_changed(ob);
-}
-
-int clipUVTransform(TransInfo *t, float *vec, int resize)
-{
- TransData *td;
- int a, clipx=1, clipy=1;
- float aspx, aspy, min[2], max[2];
-
- transform_aspect_ratio_tface_uv(&aspx, &aspy);
- min[0]= min[1]= 0.0f;
- max[0]= aspx; max[1]= aspy;
-
- for(a=0, td= t->data; a<t->total; a++, td++) {
- DO_MINMAX2(td->loc, min, max);
- }
-
- if(resize) {
- if(min[0] < 0.0f && t->center[0] > 0.0f && t->center[0] < aspx*0.5f)
- vec[0] *= t->center[0]/(t->center[0] - min[0]);
- else if(max[0] > aspx && t->center[0] < aspx)
- vec[0] *= (t->center[0] - aspx)/(t->center[0] - max[0]);
- else
- clipx= 0;
-
- if(min[1] < 0.0f && t->center[1] > 0.0f && t->center[1] < aspy*0.5f)
- vec[1] *= t->center[1]/(t->center[1] - min[1]);
- else if(max[1] > aspy && t->center[1] < aspy)
- vec[1] *= (t->center[1] - aspy)/(t->center[1] - max[1]);
- else
- clipy= 0;
- }
- else {
- if(min[0] < 0.0f)
- vec[0] -= min[0];
- else if(max[0] > aspx)
- vec[0] -= max[0]-aspx;
- else
- clipx= 0;
-
- if(min[1] < 0.0f)
- vec[1] -= min[1];
- else if(max[1] > aspy)
- vec[1] -= max[1]-aspy;
- else
- clipy= 0;
- }
-
- return (clipx || clipy);
-}
-
-/* ********************* IPO EDITOR ************************* */
-
-/* for IPO Editor transform - but actual creation of transform structures is not performed here
- * due to bad globals that would need to be imported specially for this
- */
-static void createTransIpoData(TransInfo *t)
-{
- /* in editipo.c due to some globals that are defined in that file... */
- make_ipo_transdata(t);
-}
-
-/* this function is called on recalcData to apply the transforms applied
- * to the transdata on to the actual keyframe data
- */
-void flushTransIpoData(TransInfo *t)
-{
- TransData2D *td;
- int a;
-
- /* flush to 2d vector from internally used 3d vector */
- for (a=0, td= t->data2d; a<t->total; a++, td++) {
- /* we need to unapply the nla-scaling from the time in some situations */
- if (NLA_IPO_SCALED)
- td->loc2d[0]= get_action_frame(OBACT, td->loc[0]);
- else
- td->loc2d[0]= td->loc[0];
-
- /* when the icu that point comes from is a bitflag holder, don't allow adjusting values */
- if ((t->data[a].flag & TD_TIMEONLY)==0)
- td->loc2d[1]= td->loc[1];
- }
-}
-
-/* ********************* ACTION/NLA EDITOR ****************** */
-
-/* This function tests if a point is on the "mouse" side of the cursor/frame-marking */
-static short FrameOnMouseSide(char side, float frame, float cframe)
-{
- /* both sides, so it doesn't matter */
- if (side == 'B') return 1;
-
- /* only on the named side */
- if (side == 'R')
- return (frame >= cframe) ? 1 : 0;
- else
- return (frame <= cframe) ? 1 : 0;
-}
-
-/* fully select selected beztriples, but only include if it's on the right side of cfra */
-static int count_ipo_keys(Ipo *ipo, char side, float cfra)
-{
- IpoCurve *icu;
- BezTriple *bezt;
- int i, count = 0;
-
- if (ipo == NULL)
- return count;
-
- /* only include points that occur on the right side of cfra */
- for (icu= ipo->curve.first; icu; icu= icu->next) {
- for (i=0, bezt=icu->bezt; i < icu->totvert; i++, bezt++) {
- if (bezt->f2 & SELECT) {
- /* fully select the other two keys */
- bezt->f1 |= SELECT;
- bezt->f3 |= SELECT;
-
- /* increment by 3, as there are 3 points (3 * x-coordinates) that need transform */
- if (FrameOnMouseSide(side, bezt->vec[1][0], cfra))
- count += 3;
- }
- }
- }
-
- return count;
-}
-
-/* This function assigns the information to transdata */
-static void TimeToTransData(TransData *td, float *time, Object *ob)
-{
- /* memory is calloc'ed, so that should zero everything nicely for us */
- td->val = time;
- td->ival = *(time);
-
- /* store the Object where this keyframe exists as a keyframe of the
- * active action as td->ob. Usually, this member is only used for constraints
- * drawing
- */
- td->ob= ob;
-}
-
-/* This function advances the address to which td points to, so it must return
- * the new address so that the next time new transform data is added, it doesn't
- * overwrite the existing ones... i.e. td = IpoToTransData(td, ipo, ob, side, cfra);
- *
- * The 'side' argument is needed for the extend mode. 'B' = both sides, 'R'/'L' mean only data
- * on the named side are used.
- */
-static TransData *IpoToTransData(TransData *td, Ipo *ipo, Object *ob, char side, float cfra)
-{
- IpoCurve *icu;
- BezTriple *bezt;
- int i;
-
- if (ipo == NULL)
- return td;
-
- for (icu= ipo->curve.first; icu; icu= icu->next) {
- for (i=0, bezt=icu->bezt; i < icu->totvert; i++, bezt++) {
- /* only add selected keyframes (for now, proportional edit is not enabled) */
- if (BEZSELECTED(bezt)) {
- /* only add if on the right 'side' of the current frame */
- if (FrameOnMouseSide(side, bezt->vec[1][0], cfra)) {
- /* each control point needs to be added separetely */
- TimeToTransData(td, bezt->vec[0], ob);
- td++;
-
- TimeToTransData(td, bezt->vec[1], ob);
- td++;
-
- TimeToTransData(td, bezt->vec[2], ob);
- td++;
- }
- }
- }
- }
-
- return td;
-}
-
-static void createTransActionData(TransInfo *t)
-{
- TransData *td = NULL;
- Object *ob= NULL;
-
- ListBase act_data = {NULL, NULL};
- bActListElem *ale;
- void *data;
- short datatype;
- int filter;
-
- int count=0;
- float cfra;
- char side;
-
- /* determine what type of data we are operating on */
- data = get_action_context(&datatype);
- if (data == NULL) return;
-
- /* filter data */
- filter= (ACTFILTER_VISIBLE | ACTFILTER_FOREDIT | ACTFILTER_IPOKEYS);
- actdata_filter(&act_data, filter, data, datatype);
-
- /* is the action scaled? if so, the it should belong to the active object */
- if (NLA_ACTION_SCALED)
- ob= OBACT;
-
- /* which side of the current frame should be allowed */
- if (t->mode == TFM_TIME_EXTEND) {
- /* only side on which mouse is gets transformed */
- float xmouse, ymouse;
-
- areamouseco_to_ipoco(G.v2d, t->imval, &xmouse, &ymouse);
- side = (xmouse > CFRA) ? 'R' : 'L';
- }
- else {
- /* normal transform - both sides of current frame are considered */
- side = 'B';
- }
-
- /* convert current-frame to action-time (slightly less accurate, espcially under
- * higher scaling ratios, but is faster than converting all points)
- */
- if (ob)
- cfra = get_action_frame(ob, CFRA);
- else
- cfra = CFRA;
-
- /* loop 1: fully select ipo-keys and count how many BezTriples are selected */
- for (ale= act_data.first; ale; ale= ale->next)
- count += count_ipo_keys(ale->key_data, side, cfra);
-
- /* stop if trying to build list if nothing selected */
- if (count == 0) {
- /* cleanup temp list */
- BLI_freelistN(&act_data);
- return;
- }
-
- /* allocate memory for data */
- t->total= count;
- t->data= MEM_callocN(t->total*sizeof(TransData), "TransData(Action Editor)");
- if (t->mode == TFM_TIME_SLIDE)
- t->customData= MEM_callocN(sizeof(float)*2, "TimeSlide Min/Max");
-
- td= t->data;
- /* loop 2: build transdata array */
- for (ale= act_data.first; ale; ale= ale->next) {
- Ipo *ipo= (Ipo *)ale->key_data;
-
- td= IpoToTransData(td, ipo, ob, side, cfra);
- }
-
- /* check if we're supposed to be setting minx/maxx for TimeSlide */
- if (t->mode == TFM_TIME_SLIDE) {
- float min = 0, max = 0;
- int i;
-
- td= (t->data + 1);
- for (i=1; i < count; i+=3, td+=3) {
- if (min > *(td->val)) min= *(td->val);
- if (max < *(td->val)) max= *(td->val);
- }
-
- /* minx/maxx values used by TimeSlide are stored as a
- * calloced 2-float array in t->customData. This gets freed
- * in postTrans (T_FREE_CUSTOMDATA).
- */
- *((float *)(t->customData)) = min;
- *((float *)(t->customData) + 1) = max;
- }
-
- /* cleanup temp list */
- BLI_freelistN(&act_data);
-}
-
-static void createTransNlaData(TransInfo *t)
-{
- Base *base;
- bActionStrip *strip;
- bActionChannel *achan;
- bConstraintChannel *conchan;
-
- TransData *td = NULL;
- int count=0, i;
- float cfra;
- char side;
-
- /* which side of the current frame should be allowed */
- if (t->mode == TFM_TIME_EXTEND) {
- /* only side on which mouse is gets transformed */
- float xmouse, ymouse;
-
- areamouseco_to_ipoco(G.v2d, t->imval, &xmouse, &ymouse);
- side = (xmouse > CFRA) ? 'R' : 'L';
- }
- else {
- /* normal transform - both sides of current frame are considered */
- side = 'B';
- }
-
- /* Ensure that partial selections result in beztriple selections */
- for (base=G.scene->base.first; base; base=base->next) {
- /* Check object ipos */
- i= count_ipo_keys(base->object->ipo, side, CFRA);
- if (i) base->flag |= BA_HAS_RECALC_OB;
- count += i;
-
- /* Check object constraint ipos */
- for (conchan=base->object->constraintChannels.first; conchan; conchan=conchan->next)
- count += count_ipo_keys(conchan->ipo, side, CFRA);
-
- /* skip actions and nlastrips if object is collapsed */
- if (base->object->nlaflag & OB_NLA_COLLAPSED)
- continue;
-
- /* Check action ipos */
- if (base->object->action) {
- /* exclude if strip is selected too */
- for (strip=base->object->nlastrips.first; strip; strip=strip->next) {
- if (strip->flag & ACTSTRIP_SELECT)
- if (strip->act == base->object->action)
- break;
- }
- if (strip==NULL) {
- cfra = get_action_frame(base->object, CFRA);
-
- for (achan=base->object->action->chanbase.first; achan; achan=achan->next) {
- if (EDITABLE_ACHAN(achan)) {
- i= count_ipo_keys(achan->ipo, side, cfra);
- if (i) base->flag |= BA_HAS_RECALC_OB|BA_HAS_RECALC_DATA;
- count += i;
-
- /* Check action constraint ipos */
- if (EXPANDED_ACHAN(achan) && FILTER_CON_ACHAN(achan)) {
- for (conchan=achan->constraintChannels.first; conchan; conchan=conchan->next) {
- if (EDITABLE_CONCHAN(conchan))
- count += count_ipo_keys(conchan->ipo, side, cfra);
- }
- }
- }
- }
- }
- }
-
- /* Check nlastrips */
- for (strip=base->object->nlastrips.first; strip; strip=strip->next) {
- if (strip->flag & ACTSTRIP_SELECT) {
- base->flag |= BA_HAS_RECALC_OB|BA_HAS_RECALC_DATA;
-
- if (FrameOnMouseSide(side, strip->start, CFRA)) count++;
- if (FrameOnMouseSide(side, strip->end, CFRA)) count++;
- }
- }
- }
-
- /* If nothing is selected, bail out */
- if (count == 0)
- return;
-
- /* allocate memory for data */
- t->total= count;
- t->data= MEM_callocN(t->total*sizeof(TransData), "TransData (NLA Editor)");
-
- /* build the transdata structure */
- td= t->data;
- for (base=G.scene->base.first; base; base=base->next) {
- /* Manipulate object ipos */
- /* - no scaling of keyframe times is allowed here */
- td= IpoToTransData(td, base->object->ipo, NULL, side, CFRA);
-
- /* Manipulate object constraint ipos */
- /* - no scaling of keyframe times is allowed here */
- for (conchan=base->object->constraintChannels.first; conchan; conchan=conchan->next)
- td= IpoToTransData(td, conchan->ipo, NULL, side, CFRA);
-
- /* skip actions and nlastrips if object collapsed */
- if (base->object->nlaflag & OB_NLA_COLLAPSED)
- continue;
-
- /* Manipulate action ipos */
- if (base->object->action) {
- /* exclude if strip that active action belongs to is selected too */
- for (strip=base->object->nlastrips.first; strip; strip=strip->next) {
- if (strip->flag & ACTSTRIP_SELECT)
- if (strip->act == base->object->action)
- break;
- }
-
- /* can include if no strip found */
- if (strip==NULL) {
- cfra = get_action_frame(base->object, CFRA);
-
- for (achan=base->object->action->chanbase.first; achan; achan=achan->next) {
- if (EDITABLE_ACHAN(achan)) {
- td= IpoToTransData(td, achan->ipo, base->object, side, cfra);
-
- /* Manipulate action constraint ipos */
- if (EXPANDED_ACHAN(achan) && FILTER_CON_ACHAN(achan)) {
- for (conchan=achan->constraintChannels.first; conchan; conchan=conchan->next) {
- if (EDITABLE_CONCHAN(conchan))
- td= IpoToTransData(td, conchan->ipo, base->object, side, cfra);
- }
- }
- }
- }
- }
- }
-
- /* Manipulate nlastrips */
- for (strip=base->object->nlastrips.first; strip; strip=strip->next) {
- if (strip->flag & ACTSTRIP_SELECT) {
- /* first TransData is the start, second is the end */
- if (FrameOnMouseSide(side, strip->start, CFRA)) {
- td->val = &strip->start;
- td->ival = strip->start;
- td++;
- }
- if (FrameOnMouseSide(side, strip->end, CFRA)) {
- td->val = &strip->end;
- td->ival = strip->end;
- td++;
- }
- }
- }
- }
-}
-
-/* **************** IpoKey stuff, for Object TransData ********** */
-
-/* storage of bezier triple. thats why -3 and +3! */
-static void set_tdi_old(float *old, float *poin)
-{
- old[0]= *(poin);
- old[3]= *(poin-3);
- old[6]= *(poin+3);
-}
-
-/* while transforming */
-void add_tdi_poin(float *poin, float *old, float delta)
-{
- if(poin) {
- poin[0]= old[0]+delta;
- poin[-3]= old[3]+delta;
- poin[3]= old[6]+delta;
- }
-}
-
-/* fill ipokey transdata with old vals and pointers */
-static void ipokey_to_transdata(IpoKey *ik, TransData *td)
-{
- extern int ob_ar[]; // blenkernel ipo.c
- TransDataIpokey *tdi= td->tdi;
- BezTriple *bezt;
- int a, delta= 0;
-
- td->val= NULL; // is read on ESC
-
- for(a=0; a<OB_TOTIPO; a++) {
- if(ik->data[a]) {
- bezt= ik->data[a];
-
- switch( ob_ar[a] ) {
- case OB_LOC_X:
- case OB_DLOC_X:
- tdi->locx= &(bezt->vec[1][1]); break;
- case OB_LOC_Y:
- case OB_DLOC_Y:
- tdi->locy= &(bezt->vec[1][1]); break;
- case OB_LOC_Z:
- case OB_DLOC_Z:
- tdi->locz= &(bezt->vec[1][1]); break;
-
- case OB_DROT_X:
- delta= 1;
- case OB_ROT_X:
- tdi->rotx= &(bezt->vec[1][1]); break;
- case OB_DROT_Y:
- delta= 1;
- case OB_ROT_Y:
- tdi->roty= &(bezt->vec[1][1]); break;
- case OB_DROT_Z:
- delta= 1;
- case OB_ROT_Z:
- tdi->rotz= &(bezt->vec[1][1]); break;
-
- case OB_SIZE_X:
- case OB_DSIZE_X:
- tdi->sizex= &(bezt->vec[1][1]); break;
- case OB_SIZE_Y:
- case OB_DSIZE_Y:
- tdi->sizey= &(bezt->vec[1][1]); break;
- case OB_SIZE_Z:
- case OB_DSIZE_Z:
- tdi->sizez= &(bezt->vec[1][1]); break;
- }
- }
- }
-
- /* oldvals for e.g. undo */
- if(tdi->locx) set_tdi_old(tdi->oldloc, tdi->locx);
- if(tdi->locy) set_tdi_old(tdi->oldloc+1, tdi->locy);
- if(tdi->locz) set_tdi_old(tdi->oldloc+2, tdi->locz);
-
- /* remember, for mapping curves ('1'=10 degrees) */
- if(tdi->rotx) set_tdi_old(tdi->oldrot, tdi->rotx);
- if(tdi->roty) set_tdi_old(tdi->oldrot+1, tdi->roty);
- if(tdi->rotz) set_tdi_old(tdi->oldrot+2, tdi->rotz);
-
- /* this is not allowed to be dsize! */
- if(tdi->sizex) set_tdi_old(tdi->oldsize, tdi->sizex);
- if(tdi->sizey) set_tdi_old(tdi->oldsize+1, tdi->sizey);
- if(tdi->sizez) set_tdi_old(tdi->oldsize+2, tdi->sizez);
-
- tdi->flag= TOB_IPO;
- if(delta) tdi->flag |= TOB_IPODROT;
-}
-
-
-/* *************************** Object Transform data ******************* */
-
-/* Little helper function for ObjectToTransData used to give certain
- * constraints (ChildOf, FollowPath, and others that may be added)
- * inverse corrections for transform, so that they aren't in CrazySpace.
- * These particular constraints benefit from this, but others don't, hence
- * this semi-hack ;-) - Aligorith
- */
-static short constraints_list_needinv(TransInfo *t, ListBase *list)
-{
- bConstraint *con;
-
- /* loop through constraints, checking if there's one of the mentioned
- * constraints needing special crazyspace corrections
- */
- if (list) {
- for (con= list->first; con; con=con->next) {
- /* only consider constraint if it is enabled, and has influence on result */
- if ((con->flag & CONSTRAINT_DISABLE)==0 && (con->enforce!=0.0)) {
- /* (affirmative) returns for specific constraints here... */
- /* constraints that require this regardless */
- if (con->type == CONSTRAINT_TYPE_CHILDOF) return 1;
- if (con->type == CONSTRAINT_TYPE_FOLLOWPATH) return 1;
- if (con->type == CONSTRAINT_TYPE_CLAMPTO) return 1;
-
- /* constraints that require this only under special conditions */
- if (con->type == CONSTRAINT_TYPE_ROTLIKE) {
- /* CopyRot constraint only does this when rotating, and offset is on */
- bRotateLikeConstraint *data = (bRotateLikeConstraint *)con->data;
-
- if ((data->flag & ROTLIKE_OFFSET) && (t->mode == TFM_ROTATION))
- return 1;
- }
- }
- }
- }
-
- /* no appropriate candidates found */
- return 0;
-}
-
-/* transcribe given object into TransData for Transforming */
-static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
-{
- Object *track;
- ListBase fakecons = {NULL, NULL};
- float obmtx[3][3];
- short constinv;
-
- /* axismtx has the real orientation */
- Mat3CpyMat4(td->axismtx, ob->obmat);
- Mat3Ortho(td->axismtx);
-
- td->con= ob->constraints.first;
-
- /* hack: tempolarily disable tracking and/or constraints when getting
- * object matrix, if tracking is on, or if constraints don't need
- * inverse correction to stop it from screwing up space conversion
- * matrix later
- */
- constinv= constraints_list_needinv(t, &ob->constraints);
- if (ob->track || constinv==0) {
- track= ob->track;
- ob->track= NULL;
-
- if (constinv == 0) {
- fakecons.first = ob->constraints.first;
- fakecons.last = ob->constraints.last;
- ob->constraints.first = ob->constraints.last = NULL;
- }
-
- where_is_object(ob);
-
- if (constinv == 0) {
- ob->constraints.first = fakecons.first;
- ob->constraints.last = fakecons.last;
- }
-
- ob->track= track;
- }
- else
- where_is_object(ob);
-
- td->ob = ob;
-
- td->loc = ob->loc;
- VECCOPY(td->iloc, td->loc);
-
- td->ext->rot = ob->rot;
- VECCOPY(td->ext->irot, ob->rot);
- VECCOPY(td->ext->drot, ob->drot);
-
- td->ext->size = ob->size;
- VECCOPY(td->ext->isize, ob->size);
- VECCOPY(td->ext->dsize, ob->dsize);
-
- VECCOPY(td->center, ob->obmat[3]);
-
- /* is there a need to set the global<->data space conversion matrices? */
- if (ob->parent || constinv) {
- float totmat[3][3], obinv[3][3];
-
- /* Get the effect of parenting, and/or certain constraints.
- * NOTE: some Constraints, and also Tracking should never get this
- * done, as it doesn't work well.
- */
- object_to_mat3(ob, obmtx);
- Mat3CpyMat4(totmat, ob->obmat);
- Mat3Inv(obinv, totmat);
- Mat3MulMat3(td->smtx, obmtx, obinv);
- Mat3Inv(td->mtx, td->smtx);
- }
- else {
- /* no conversion to/from dataspace */
- Mat3One(td->smtx);
- Mat3One(td->mtx);
- }
-#ifdef WITH_VERSE
- if(ob->vnode) {
- td->verse = (void*)ob;
- td->flag |= TD_VERSE_OBJECT;
- }
- else
- td->flag &= ~TD_VERSE_OBJECT;
-#endif
-}
-
-
-/* sets flags in Bases to define whether they take part in transform */
-/* it deselects Bases, so we have to call the clear function always after */
-static void set_trans_object_base_flags(TransInfo *t)
-{
- /*
- if Base selected and has parent selected:
- base->flag= BA_WAS_SEL
- */
- Base *base;
-
- /* makes sure base flags and object flags are identical */
- copy_baseflags();
-
- /* handle pending update events, otherwise they got copied below */
- for (base= FIRSTBASE; base; base= base->next) {
- if(base->object->recalc)
- object_handle_update(base->object);
- }
-
- for (base= FIRSTBASE; base; base= base->next) {
- base->flag &= ~BA_WAS_SEL;
-
- if(TESTBASELIB(base)) {
- Object *ob= base->object;
- Object *parsel= ob->parent;
-
- /* if parent selected, deselect */
- while(parsel) {
- if(parsel->flag & SELECT) break;
- parsel= parsel->parent;
- }
-
- if(parsel) {
- base->flag &= ~SELECT;
- base->flag |= BA_WAS_SEL;
- }
- /* used for flush, depgraph will change recalcs if needed :) */
- ob->recalc |= OB_RECALC_OB;
- }
- }
- /* all recalc flags get flushed to all layers, so a layer flip later on works fine */
- DAG_scene_flush_update(G.scene, -1);
-
- /* and we store them temporal in base (only used for transform code) */
- /* this because after doing updates, the object->recalc is cleared */
- for (base= FIRSTBASE; base; base= base->next) {
- if(base->object->recalc & OB_RECALC_OB)
- base->flag |= BA_HAS_RECALC_OB;
- if(base->object->recalc & OB_RECALC_DATA)
- base->flag |= BA_HAS_RECALC_DATA;
- }
-}
-
-static void clear_trans_object_base_flags(void)
-{
- Base *base;
-
- base= FIRSTBASE;
- while(base) {
- if(base->flag & BA_WAS_SEL) base->flag |= SELECT;
- base->flag &= ~(BA_WAS_SEL|BA_HAS_RECALC_OB|BA_HAS_RECALC_DATA|BA_DO_IPO);
-
- base = base->next;
- }
-}
-
-/* auto-keyframing feature - for objects
- * tmode: should be a transform mode
- */
-void autokeyframe_ob_cb_func(Object *ob, int tmode)
-{
- IpoCurve *icu;
- char *actname="";
-
- if (G.flags & G_RECORDKEYS) {
- if (ob->ipoflag & OB_ACTION_OB)
- actname= "Object";
-
- if (U.uiflag & USER_KEYINSERTAVAI) {
- if (ob->ipo || ob->action) {
- ID *id= (ID *)(ob);
-
- if (ob->ipo) {
- icu= ob->ipo->curve.first;
- }
- else {
- bActionChannel *achan;
- achan= get_action_channel(ob->action, actname);
-
- if (achan && achan->ipo)
- icu= achan->ipo->curve.first;
- else
- icu= NULL;
- }
-
- while (icu) {
- icu->flag &= ~IPO_SELECT;
- if (U.uiflag & USER_KEYINSERTNEED)
- insertkey_smarter(id, ID_OB, actname, NULL, icu->adrcode);
- else
- insertkey(id, ID_OB, actname, NULL, icu->adrcode, 0);
- icu= icu->next;
- }
- }
- }
- else if (U.uiflag & USER_KEYINSERTNEED) {
- short doLoc=0, doRot=0, doScale=0;
-
- /* filter the conditions when this happens (assume that curarea->spacetype==SPACE_VIE3D) */
- if (tmode == TFM_TRANSLATION) {
- doLoc = 1;
- }
- else if (tmode == TFM_ROTATION) {
- if (G.vd->around == V3D_ACTIVE) {
- if (ob != OBACT)
- doLoc = 1;
- }
- else if (G.vd->around == V3D_CURSOR)
- doLoc = 1;
-
- if ((G.vd->flag & V3D_ALIGN)==0)
- doRot = 1;
- }
- else if (tmode == TFM_RESIZE) {
- if (G.vd->around == V3D_ACTIVE) {
- if (ob != OBACT)
- doLoc = 1;
- }
- else if (G.vd->around == V3D_CURSOR)
- doLoc = 1;
-
- if ((G.vd->flag & V3D_ALIGN)==0)
- doScale = 1;
- }
-
- if (doLoc) {
- insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_LOC_X);
- insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_LOC_Y);
- insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_LOC_Z);
- }
- if (doRot) {
- insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_ROT_X);
- insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_ROT_Y);
- insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_ROT_Z);
- }
- if (doScale) {
- insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_SIZE_X);
- insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_SIZE_Y);
- insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_SIZE_Z);
- }
- }
- else {
- insertkey(&ob->id, ID_OB, actname, NULL, OB_ROT_X, 0);
- insertkey(&ob->id, ID_OB, actname, NULL, OB_ROT_Y, 0);
- insertkey(&ob->id, ID_OB, actname, NULL, OB_ROT_Z, 0);
-
- insertkey(&ob->id, ID_OB, actname, NULL, OB_LOC_X, 0);
- insertkey(&ob->id, ID_OB, actname, NULL, OB_LOC_Y, 0);
- insertkey(&ob->id, ID_OB, actname, NULL, OB_LOC_Z, 0);
-
- insertkey(&ob->id, ID_OB, actname, NULL, OB_SIZE_X, 0);
- insertkey(&ob->id, ID_OB, actname, NULL, OB_SIZE_Y, 0);
- insertkey(&ob->id, ID_OB, actname, NULL, OB_SIZE_Z, 0);
- }
-
- remake_object_ipos(ob);
- allqueue(REDRAWMARKER, 0);
- }
-}
-
-/* auto-keyframing feature - for poses/pose-channels
- * tmode: should be a transform mode
- * targetless_ik: has targetless ik been done on any channels?
- */
-void autokeyframe_pose_cb_func(Object *ob, int tmode, short targetless_ik)
-{
- bArmature *arm= ob->data;
- bAction *act;
- bPose *pose;
- bPoseChannel *pchan;
- IpoCurve *icu;
-
- pose= ob->pose;
- act= ob->action;
-
- if (G.flags & G_RECORDKEYS) {
- if (!act)
- act= ob->action= add_empty_action("Action");
-
- for (pchan=pose->chanbase.first; pchan; pchan=pchan->next) {
- if (pchan->bone->flag & BONE_TRANSFORM) {
- /* clear any 'unkeyed' flag it may have */
- pchan->bone->flag &= ~BONE_UNKEYED;
-
- /* only insert into available channels? */
- if (U.uiflag & USER_KEYINSERTAVAI) {
- bActionChannel *achan;
-
- for (achan = act->chanbase.first; achan; achan=achan->next){
- if (achan->ipo && !strcmp (achan->name, pchan->name)){
- for (icu = achan->ipo->curve.first; icu; icu=icu->next){
- /* only insert keyframe if needed? */
- if (U.uiflag & USER_KEYINSERTNEED)
- insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, icu->adrcode);
- else
- insertkey(&ob->id, ID_PO, pchan->name, NULL, icu->adrcode, 0);
- }
- break;
- }
- }
- }
- /* only insert keyframe if needed? */
- else if (U.uiflag & USER_KEYINSERTNEED) {
- short doLoc=0, doRot=0, doScale=0;
-
- /* filter the conditions when this happens (assume that curarea->spacetype==SPACE_VIE3D) */
- if (tmode == TFM_TRANSLATION) {
- if (targetless_ik)
- doRot= 1;
- else
- doLoc = 1;
- }
- else if (tmode == TFM_ROTATION) {
- if (ELEM(G.vd->around, V3D_CURSOR, V3D_ACTIVE))
- doLoc = 1;
-
- if ((G.vd->flag & V3D_ALIGN)==0)
- doRot = 1;
- }
- else if (tmode == TFM_RESIZE) {
- if (ELEM(G.vd->around, V3D_CURSOR, V3D_ACTIVE))
- doLoc = 1;
-
- if ((G.vd->flag & V3D_ALIGN)==0)
- doScale = 1;
- }
-
- if (doLoc) {
- insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_LOC_X);
- insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_LOC_Y);
- insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_LOC_Z);
- }
- if (doRot) {
- insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_W);
- insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_X);
- insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_Y);
- insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_Z);
- }
- if (doScale) {
- insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_X);
- insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_Y);
- insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_Z);
- }
- }
- /* insert keyframe in any channel that's appropriate */
- else {
- insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_X, 0);
- insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_Y, 0);
- insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_Z, 0);
-
- insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_W, 0);
- insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_X, 0);
- insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_Y, 0);
- insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_Z, 0);
-
- insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_LOC_X, 0);
- insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_LOC_Y, 0);
- insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_LOC_Z, 0);
- }
- }
- }
-
- remake_action_ipos (act);
- allqueue(REDRAWMARKER, 0);
-
- /* locking can be disabled */
- ob->pose->flag &= ~(POSE_DO_UNLOCK|POSE_LOCKED);
-
- /* do the bone paths */
- if (arm->pathflag & ARM_PATH_ACFRA) {
- //pose_clear_paths(ob);
- pose_recalculate_paths(ob);
- }
-
- }
- else {
- /* tag channels that should have unkeyed data */
- for (pchan=pose->chanbase.first; pchan; pchan=pchan->next) {
- if (pchan->bone->flag & BONE_TRANSFORM) {
- /* tag this channel */
- pchan->bone->flag |= BONE_UNKEYED;
- }
- }
- }
-}
-
-/* very bad call!!! - copied from editnla.c! */
-static void recalc_all_ipos(void)
-{
- Ipo *ipo;
- IpoCurve *icu;
-
- /* Go to each ipo */
- for (ipo=G.main->ipo.first; ipo; ipo=ipo->id.next){
- for (icu = ipo->curve.first; icu; icu=icu->next){
- sort_time_ipocurve(icu);
- testhandles_ipocurve(icu);
- }
- }
-}
-
-/* inserting keys, refresh ipo-keys, softbody, redraw events... (ton) */
-/* note: transdata has been freed already! */
-void special_aftertrans_update(TransInfo *t)
-{
- Object *ob;
- Base *base;
- short redrawipo=0, resetslowpar=1;
- int cancelled= (t->state == TRANS_CANCEL);
-
- if (t->spacetype==SPACE_VIEW3D)
- EM_automerge(1);
-
- if (t->spacetype == SPACE_ACTION) {
- void *data;
- short datatype;
-
- /* determine what type of data we are operating on */
- data = get_action_context(&datatype);
- if (data == NULL) return;
- ob = OBACT;
-
- if (datatype == ACTCONT_ACTION) {
- /* Update the curve */
- /* Depending on the lock status, draw necessary views */
- if (ob) {
- ob->ctime= -1234567.0f;
-
- if(ob->pose || ob_get_key(ob))
- DAG_object_flush_update(G.scene, ob, OB_RECALC);
- else
- DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
- }
-
- remake_action_ipos((bAction *)data);
-
- G.saction->flag &= ~SACTION_MOVING;
- }
- else if (datatype == ACTCONT_SHAPEKEY) {
- /* fix up the Ipocurves and redraw stuff */
- Key *key= (Key *)data;
- if (key->ipo) {
- IpoCurve *icu;
-
- for (icu = key->ipo->curve.first; icu; icu=icu->next) {
- sort_time_ipocurve(icu);
- testhandles_ipocurve(icu);
- }
- }
-
- DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
- }
- }
- else if (t->spacetype == SPACE_NLA) {
- synchronize_action_strips();
-
- /* cleanup */
- for (base=G.scene->base.first; base; base=base->next)
- base->flag &= ~(BA_HAS_RECALC_OB|BA_HAS_RECALC_DATA);
-
- recalc_all_ipos(); // bad
- }
- else if (t->spacetype == SPACE_IPO) {
- // FIXME! is there any code from the old transform_ipo that needs to be added back?
-
- /* resetting slow-parents isn't really necessary when editing sequence ipo's */
- if (G.sipo->blocktype==ID_SEQ)
- resetslowpar= 0;
- }
- else if (G.obedit) {
- if (t->mode==TFM_BONESIZE || t->mode==TFM_BONE_ENVELOPE)
- allqueue(REDRAWBUTSEDIT, 0);
-
- /* table needs to be created for each edit command, since vertices can move etc */
- mesh_octree_table(G.obedit, NULL, 'e');
- }
- else if ((t->flag & T_POSE) && (t->poseobj)) {
- bArmature *arm;
- bPose *pose;
- bPoseChannel *pchan;
- short targetless_ik= 0;
-
- ob= t->poseobj;
- arm= ob->data;
- pose= ob->pose;
-
- /* this signal does one recalc on pose, then unlocks, so ESC or edit will work */
- pose->flag |= POSE_DO_UNLOCK;
-
- /* if target-less IK grabbing, we calculate the pchan transforms and clear flag */
- if (!cancelled && t->mode==TFM_TRANSLATION)
- targetless_ik= apply_targetless_ik(ob);
- else {
- /* not forget to clear the auto flag */
- for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next) {
- bKinematicConstraint *data= has_targetless_ik(pchan);
- if(data) data->flag &= ~CONSTRAINT_IK_AUTO;
- }
- }
-
- if (t->mode==TFM_TRANSLATION)
- pose_grab_with_ik_clear(ob);
-
- /* automatic inserting of keys and unkeyed tagging - only if transform wasn't cancelled (or TFM_DUMMY) */
- if (!cancelled && (t->mode != TFM_DUMMY)) {
- autokeyframe_pose_cb_func(ob, t->mode, targetless_ik);
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- }
- else if (arm->flag & ARM_DELAYDEFORM) {
- /* old optimize trick... this enforces to bypass the depgraph */
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- ob->recalc= 0; // is set on OK position already by recalcData()
- }
- else
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
-
- if (t->mode==TFM_BONESIZE || t->mode==TFM_BONE_ENVELOPE)
- allqueue(REDRAWBUTSEDIT, 0);
-
- }
- else if(G.f & G_PARTICLEEDIT) {
- ;
- }
- else {
- base= FIRSTBASE;
- while (base) {
-
- if(base->flag & BA_DO_IPO) redrawipo= 1;
-
- ob= base->object;
-
- if (modifiers_isSoftbodyEnabled(ob)) ob->softflag |= OB_SB_REDO;
-
- /* Set autokey if necessary */
- if ((!cancelled) && (t->mode != TFM_DUMMY) && (base->flag & SELECT)) {
- autokeyframe_ob_cb_func(ob, t->mode);
- }
-
- base= base->next;
- }
-
- }
-
- clear_trans_object_base_flags();
-
- if (redrawipo) {
- allqueue(REDRAWNLA, 0);
- allqueue(REDRAWACTION, 0);
- allqueue(REDRAWIPO, 0);
- }
-
- if(resetslowpar)
- reset_slowparents();
-
- /* note; should actually only be done for all objects when a lamp is moved... (ton) */
- if(t->spacetype==SPACE_VIEW3D && G.vd->drawtype == OB_SHADED)
- reshadeall_displist();
-}
-
-static void createTransObject(TransInfo *t)
-{
- TransData *td = NULL;
- TransDataExtension *tx;
- Object *ob;
- Base *base;
- IpoKey *ik;
- ListBase elems;
-
- set_trans_object_base_flags(t);
-
- /* count */
- for(base= FIRSTBASE; base; base= base->next) {
- if TESTBASE(base) {
- ob= base->object;
-
- /* store ipo keys? */
- if (ob->id.lib == 0 && ob->ipo && ob->ipo->showkey && (ob->ipoflag & OB_DRAWKEY)) {
- elems.first= elems.last= NULL;
- make_ipokey_transform(ob, &elems, 1); /* '1' only selected keys */
-
- pushdata(&elems, sizeof(ListBase));
-
- for(ik= elems.first; ik; ik= ik->next)
- t->total++;
-
- if(elems.first==NULL)
- t->total++;
- }
- else {
- t->total++;
- }
- }
- }
-
- if(!t->total) {
- /* clear here, main transform function escapes too */
- clear_trans_object_base_flags();
- return;
- }
-
- td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransOb");
- tx = t->ext = MEM_callocN(t->total*sizeof(TransDataExtension), "TransObExtension");
-
- for(base= FIRSTBASE; base; base= base->next) {
- if TESTBASE(base) {
- ob= base->object;
-
- td->flag = TD_SELECTED;
- td->protectflag= ob->protectflag;
- td->ext = tx;
-
- /* select linked objects, but skip them later */
- if (ob->id.lib != 0) {
- td->flag |= TD_SKIP;
- }
-
- /* store ipo keys? */
- if(ob->id.lib == 0 && ob->ipo && ob->ipo->showkey && (ob->ipoflag & OB_DRAWKEY)) {
-
- popfirst(&elems); // bring back pushed listbase
-
- if(elems.first) {
- int cfraont;
- int ipoflag;
-
- base->flag |= BA_DO_IPO+BA_WAS_SEL;
- base->flag &= ~SELECT;
-
- cfraont= CFRA;
- set_no_parent_ipo(1);
- ipoflag= ob->ipoflag;
- ob->ipoflag &= ~OB_OFFS_OB;
-
- /*
- * This is really EVIL code that pushes down Object values
- * (loc, dloc, orig, size, dsize, rot, drot)
- * */
-
- pushdata((void*)ob->loc, 7 * 3 * sizeof(float)); // tsk! tsk!
-
- for(ik= elems.first; ik; ik= ik->next) {
-
- /* weak... this doesn't correct for floating values, giving small errors */
- CFRA= (int)(ik->val/G.scene->r.framelen);
-
- do_ob_ipo(ob);
- ObjectToTransData(t, td, ob); // does where_is_object()
-
- td->flag= TD_SELECTED;
-
- td->tdi= MEM_callocN(sizeof(TransDataIpokey), "TransDataIpokey");
- /* also does tdi->flag and oldvals, needs to be after ob_to_transob()! */
- ipokey_to_transdata(ik, td);
-
- td++;
- tx++;
- if(ik->next) td->ext= tx; // prevent corrupting mem!
- }
- free_ipokey(&elems);
-
- poplast(ob->loc);
- set_no_parent_ipo(0);
-
- CFRA= cfraont;
- ob->ipoflag= ipoflag;
-
- where_is_object(ob); // restore
- }
- else {
- ObjectToTransData(t, td, ob);
- td->tdi = NULL;
- td->val = NULL;
- td++;
- tx++;
- }
- }
- else {
- ObjectToTransData(t, td, ob);
- td->tdi = NULL;
- td->val = NULL;
- td++;
- tx++;
- }
- }
- }
-}
-
-void createTransData(TransInfo *t)
-{
- Object *ob= OBACT;
-
- if (t->context == CTX_TEXTURE) {
- t->flag |= T_TEXTURE;
- createTransTexspace(t);
- }
- else if (t->context == CTX_EDGE) {
- t->ext = NULL;
- t->flag |= T_EDIT;
- createTransEdge(t);
- if(t->data && t->flag & T_PROP_EDIT) {
- sort_trans_data(t); // makes selected become first in array
- set_prop_dist(t, 1);
- sort_trans_data_dist(t);
- }
- }
- else if (t->spacetype == SPACE_IMAGE) {
- t->flag |= T_POINTS|T_2D_EDIT;
- createTransUVs(t);
- if(t->data && (t->flag & T_PROP_EDIT)) {
- sort_trans_data(t); // makes selected become first in array
- set_prop_dist(t, 1);
- sort_trans_data_dist(t);
- }
- }
- else if (t->spacetype == SPACE_ACTION) {
- t->flag |= T_POINTS|T_2D_EDIT;
- createTransActionData(t);
- }
- else if (t->spacetype == SPACE_NLA) {
- t->flag |= T_POINTS|T_2D_EDIT;
- createTransNlaData(t);
- }
- else if (t->spacetype == SPACE_IPO) {
- t->flag |= T_POINTS|T_2D_EDIT;
- createTransIpoData(t);
- if (t->data && (t->flag & T_PROP_EDIT)) {
- sort_trans_data(t); // makes selected become first in array
- set_prop_dist(t, 1);
- sort_trans_data_dist(t);
- }
- }
- else if (G.obedit) {
- t->ext = NULL;
- if (G.obedit->type == OB_MESH) {
- createTransEditVerts(t);
- }
- else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
- createTransCurveVerts(t);
- }
- else if (G.obedit->type==OB_LATTICE) {
- createTransLatticeVerts(t);
- }
- else if (G.obedit->type==OB_MBALL) {
- createTransMBallVerts(t);
- }
- else if (G.obedit->type==OB_ARMATURE) {
- t->flag &= ~T_PROP_EDIT;
- createTransArmatureVerts(t);
- }
- else {
- printf("not done yet! only have mesh surface curve lattice mball armature\n");
- }
-
- if(t->data && t->flag & T_PROP_EDIT) {
- if (ELEM(G.obedit->type, OB_CURVE, OB_MESH)) {
- sort_trans_data(t); // makes selected become first in array
- set_prop_dist(t, 0);
- sort_trans_data_dist(t);
- }
- else {
- sort_trans_data(t); // makes selected become first in array
- set_prop_dist(t, 1);
- sort_trans_data_dist(t);
- }
- }
-
- t->flag |= T_EDIT|T_POINTS;
-
- /* exception... hackish, we want bonesize to use bone orientation matrix (ton) */
- if(t->mode==TFM_BONESIZE) {
- t->flag &= ~(T_EDIT|T_POINTS);
- t->flag |= T_POSE;
- t->poseobj= ob; /* <- tsk tsk, this is going to give issues one day */
- }
- }
- else if (ob && (ob->flag & OB_POSEMODE)) {
- createTransPose(t, OBACT);
- }
- else if (G.f & G_WEIGHTPAINT) {
- /* exception, we look for the one selected armature */
- Base *base;
- for(base=FIRSTBASE; base; base= base->next) {
- if(TESTBASELIB(base)) {
- if(base->object->type==OB_ARMATURE)
- if(base->object->flag & OB_POSEMODE)
- break;
- }
- }
- if(base) {
- createTransPose(t, base->object);
- }
- }
- else if (G.f & G_PARTICLEEDIT && PE_can_edit(PE_get_current(ob))) {
- createTransParticleVerts(t);
-
- if(t->data && t->flag & T_PROP_EDIT) {
- sort_trans_data(t); // makes selected become first in array
- set_prop_dist(t, 1);
- sort_trans_data_dist(t);
- }
-
- t->flag |= T_POINTS;
- }
- else {
- createTransObject(t);
- t->flag |= T_OBJECT;
- }
-
- if((t->flag & T_OBJECT) && G.vd->camera==OBACT && G.vd->persp>1) {
- t->flag |= T_CAMERA;
- }
-
- /* temporal...? */
- G.scene->recalc |= SCE_PRV_CHANGED; /* test for 3d preview */
-}
-
-
-
diff --git a/source/blender/src/transform_generics.c b/source/blender/src/transform_generics.c
deleted file mode 100644
index b24f9bea48d..00000000000
--- a/source/blender/src/transform_generics.c
+++ /dev/null
@@ -1,1061 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <string.h>
-#include <math.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_action_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_lattice_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_modifier_types.h"
-#include "DNA_object_types.h"
-#include "DNA_object_force.h"
-#include "DNA_particle_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_view3d_types.h"
-
-#include "BIF_screen.h"
-#include "BIF_resources.h"
-#include "BIF_mywindow.h"
-#include "BIF_gl.h"
-#include "BIF_editaction.h"
-#include "BIF_editarmature.h"
-#include "BIF_editmesh.h"
-#include "BIF_editnla.h"
-#include "BIF_editsima.h"
-#include "BIF_editparticle.h"
-#include "BIF_meshtools.h"
-#include "BIF_retopo.h"
-
-#include "BSE_editipo.h"
-#include "BSE_editipo_types.h"
-
-#ifdef WITH_VERSE
-#include "BIF_verse.h"
-#endif
-
-#include "BKE_action.h"
-#include "BKE_anim.h"
-#include "BKE_armature.h"
-#include "BKE_curve.h"
-#include "BKE_depsgraph.h"
-#include "BKE_displist.h"
-#include "BKE_depsgraph.h"
-#include "BKE_global.h"
-#include "BKE_group.h"
-#include "BKE_ipo.h"
-#include "BKE_lattice.h"
-#include "BKE_key.h"
-#include "BKE_mesh.h"
-#include "BKE_modifier.h"
-#include "BKE_object.h"
-#include "BKE_utildefines.h"
-
-#ifdef WITH_VERSE
-#include "BKE_verse.h"
-#endif
-
-#include "BSE_view.h"
-#include "BSE_editaction_types.h"
-#include "BDR_unwrapper.h"
-
-#include "BLI_arithb.h"
-#include "BLI_blenlib.h"
-#include "BLI_editVert.h"
-#include "BLI_rand.h"
-
-#include "blendef.h"
-
-#include "mydevice.h"
-
-#include "transform.h"
-
-extern ListBase editNurb;
-extern ListBase editelems;
-
-extern TransInfo Trans; /* From transform.c */
-
-/* ************************** Functions *************************** */
-
-
-void getViewVector(float coord[3], float vec[3])
-{
- TransInfo *t = BIF_GetTransInfo();
-
- if (t->persp)
- {
- float p1[4], p2[4];
-
- VECCOPY(p1, coord);
- p1[3] = 1.0f;
- VECCOPY(p2, p1);
- p2[3] = 1.0f;
- Mat4MulVec4fl(t->viewmat, p2);
-
- p2[0] = 2.0f * p2[0];
- p2[1] = 2.0f * p2[1];
- p2[2] = 2.0f * p2[2];
-
- Mat4MulVec4fl(t->viewinv, p2);
-
- VecSubf(vec, p1, p2);
- }
- else {
- VECCOPY(vec, t->viewinv[2]);
- }
- Normalize(vec);
-}
-
-/* ************************** GENERICS **************************** */
-
-static void clipMirrorModifier(TransInfo *t, Object *ob)
-{
- ModifierData *md= ob->modifiers.first;
- float tolerance[3] = {0.0f, 0.0f, 0.0f};
- int axis = 0;
-
- for (; md; md=md->next) {
- if (md->type==eModifierType_Mirror) {
- MirrorModifierData *mmd = (MirrorModifierData*) md;
-
- if(mmd->flag & MOD_MIR_CLIPPING) {
- axis = 0;
- if(mmd->flag & MOD_MIR_AXIS_X) {
- axis |= 1;
- tolerance[0] = mmd->tolerance;
- }
- if(mmd->flag & MOD_MIR_AXIS_Y) {
- axis |= 2;
- tolerance[1] = mmd->tolerance;
- }
- if(mmd->flag & MOD_MIR_AXIS_Z) {
- axis |= 4;
- tolerance[2] = mmd->tolerance;
- }
- if (axis) {
- float mtx[4][4], imtx[4][4];
- int i;
- TransData *td = t->data;
-
- if (mmd->mirror_ob) {
- float obinv[4][4];
-
- Mat4Invert(obinv, mmd->mirror_ob->obmat);
- Mat4MulMat4(mtx, ob->obmat, obinv);
- Mat4Invert(imtx, mtx);
- }
-
- for(i = 0 ; i < t->total; i++, td++) {
- int clip;
- float loc[3], iloc[3];
-
- if (td->flag & TD_NOACTION)
- break;
- if (td->loc==NULL)
- break;
-
- if (td->flag & TD_SKIP)
- continue;
-
- VecCopyf(loc, td->loc);
- VecCopyf(iloc, td->iloc);
-
- if (mmd->mirror_ob) {
- VecMat4MulVecfl(loc, mtx, loc);
- VecMat4MulVecfl(iloc, mtx, iloc);
- }
-
- clip = 0;
- if(axis & 1) {
- if(fabs(iloc[0])<=tolerance[0] ||
- loc[0]*iloc[0]<0.0f) {
- loc[0]= 0.0f;
- clip = 1;
- }
- }
-
- if(axis & 2) {
- if(fabs(iloc[1])<=tolerance[1] ||
- loc[1]*iloc[1]<0.0f) {
- loc[1]= 0.0f;
- clip = 1;
- }
- }
- if(axis & 4) {
- if(fabs(iloc[2])<=tolerance[2] ||
- loc[2]*iloc[2]<0.0f) {
- loc[2]= 0.0f;
- clip = 1;
- }
- }
- if (clip) {
- if (mmd->mirror_ob) {
- VecMat4MulVecfl(loc, imtx, loc);
- }
- VecCopyf(td->loc, loc);
- }
- }
- }
-
- }
- }
- }
-}
-
-/* assumes G.obedit set to mesh object */
-static void editmesh_apply_to_mirror(TransInfo *t)
-{
- TransData *td = t->data;
- EditVert *eve;
- int i;
-
- for(i = 0 ; i < t->total; i++, td++) {
- if (td->flag & TD_NOACTION)
- break;
- if (td->loc==NULL)
- break;
- if (td->flag & TD_SKIP)
- continue;
-
- eve= td->tdmir;
- if(eve) {
- eve->co[0]= -td->loc[0];
- eve->co[1]= td->loc[1];
- eve->co[2]= td->loc[2];
- }
- }
-}
-
-/* called for updating while transform acts, once per redraw */
-void recalcData(TransInfo *t)
-{
- Base *base;
-#ifdef WITH_VERSE
- struct TransData *td;
-#endif
-
- if (t->spacetype == SPACE_ACTION) {
- Object *ob= OBACT;
- void *data;
- short context;
-
- /* determine what type of data we are operating on */
- data = get_action_context(&context);
- if (data == NULL) return;
-
- if (G.saction->lock) {
- if (context == ACTCONT_ACTION) {
- if(ob) {
- ob->ctime= -1234567.0f;
- if(ob->pose || ob_get_key(ob))
- DAG_object_flush_update(G.scene, ob, OB_RECALC);
- else
- DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
- }
- }
- else if (context == ACTCONT_SHAPEKEY) {
- DAG_object_flush_update(G.scene, OBACT, OB_RECALC_OB|OB_RECALC_DATA);
- }
- }
- }
- else if (t->spacetype == SPACE_NLA) {
- if (G.snla->lock) {
- for (base=G.scene->base.first; base; base=base->next) {
- if (base->flag & BA_HAS_RECALC_OB)
- base->object->recalc |= OB_RECALC_OB;
- if (base->flag & BA_HAS_RECALC_DATA)
- base->object->recalc |= OB_RECALC_DATA;
-
- if (base->object->recalc)
- base->object->ctime= -1234567.0f; // eveil!
- }
-
- DAG_scene_flush_update(G.scene, screen_view3d_layers());
- }
- }
- else if (t->spacetype == SPACE_IPO) {
- EditIpo *ei;
- int dosort = 0;
- int a;
-
- /* do the flush first */
- flushTransIpoData(t);
-
- /* now test if there is a need to re-sort */
- ei= G.sipo->editipo;
- for (a=0; a<G.sipo->totipo; a++, ei++) {
- if (ISPOIN(ei, flag & IPO_VISIBLE, icu)) {
-
- /* watch it: if the time is wrong: do not correct handles */
- if (test_time_ipocurve(ei->icu)) dosort++;
- else testhandles_ipocurve(ei->icu);
- }
- }
-
- /* do resort and other updates? */
- if (dosort) remake_ipo_transdata(t);
- if (G.sipo->showkey) update_ipokey_val();
-
- calc_ipo(G.sipo->ipo, (float)CFRA);
-
- /* update realtime - not working? */
- if (G.sipo->lock) {
- if (G.sipo->blocktype==ID_MA || G.sipo->blocktype==ID_TE) {
- do_ipo(G.sipo->ipo);
- }
- else if(G.sipo->blocktype==ID_CA) {
- do_ipo(G.sipo->ipo);
- }
- else if(G.sipo->blocktype==ID_KE) {
- Object *ob= OBACT;
- if(ob) {
- ob->shapeflag &= ~OB_SHAPE_TEMPLOCK;
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- }
- }
- else if(G.sipo->blocktype==ID_PO) {
- Object *ob= OBACT;
- if(ob && ob->pose) {
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- }
- }
- else if(G.sipo->blocktype==ID_OB) {
- Base *base= FIRSTBASE;
-
- while(base) {
- if(base->object->ipo==G.sipo->ipo) {
- do_ob_ipo(base->object);
- base->object->recalc |= OB_RECALC_OB;
- }
- base= base->next;
- }
- DAG_scene_flush_update(G.scene, screen_view3d_layers());
- }
- }
- }
- else if (G.obedit) {
- if (G.obedit->type == OB_MESH) {
- if(t->spacetype==SPACE_IMAGE) {
- flushTransUVs(t);
- if (G.sima->flag & SI_LIVE_UNWRAP)
- unwrap_lscm_live_re_solve();
- } else {
-
- retopo_do_all();
-
- /* mirror modifier clipping? */
- if(t->state != TRANS_CANCEL)
- clipMirrorModifier(t, G.obedit);
-
- if((t->context & CTX_NO_MIRROR) == 0 && (G.scene->toolsettings->editbutflag & B_MESH_X_MIRROR))
- editmesh_apply_to_mirror(t);
-
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA); /* sets recalc flags */
-
- recalc_editnormals();
- }
- }
- else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
- Nurb *nu= editNurb.first;
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA); /* sets recalc flags */
-
- while(nu) {
- test2DNurb(nu);
- testhandlesNurb(nu); /* test for bezier too */
- nu= nu->next;
- }
-
- retopo_do_all();
- }
- else if(G.obedit->type==OB_ARMATURE){ /* no recalc flag, does pose */
- bArmature *arm= G.obedit->data;
- EditBone *ebo;
-
- /* Ensure all bones are correctly adjusted */
- for (ebo=G.edbo.first; ebo; ebo=ebo->next){
-
- if ((ebo->flag & BONE_CONNECTED) && ebo->parent){
- /* If this bone has a parent tip that has been moved */
- if (ebo->parent->flag & BONE_TIPSEL){
- VECCOPY (ebo->head, ebo->parent->tail);
- if(t->mode==TFM_BONE_ENVELOPE) ebo->rad_head= ebo->parent->rad_tail;
- }
- /* If this bone has a parent tip that has NOT been moved */
- else{
- VECCOPY (ebo->parent->tail, ebo->head);
- if(t->mode==TFM_BONE_ENVELOPE) ebo->parent->rad_tail= ebo->rad_head;
- }
- }
-
- /* on extrude bones, oldlength==0.0f, so we scale radius of points */
- ebo->length= VecLenf(ebo->head, ebo->tail);
- if(ebo->oldlength==0.0f) {
- ebo->rad_head= 0.25f*ebo->length;
- ebo->rad_tail= 0.10f*ebo->length;
- ebo->dist= 0.25f*ebo->length;
- if(ebo->parent) {
- if(ebo->rad_head > ebo->parent->rad_tail)
- ebo->rad_head= ebo->parent->rad_tail;
- }
- }
- else if(t->mode!=TFM_BONE_ENVELOPE) {
- /* if bones change length, lets do that for the deform distance as well */
- ebo->dist*= ebo->length/ebo->oldlength;
- ebo->rad_head*= ebo->length/ebo->oldlength;
- ebo->rad_tail*= ebo->length/ebo->oldlength;
- ebo->oldlength= ebo->length;
- }
- }
- if(arm->flag & ARM_MIRROR_EDIT)
- transform_armature_mirror_update();
-
- }
- else if(G.obedit->type==OB_LATTICE) {
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA); /* sets recalc flags */
-
- if(editLatt->flag & LT_OUTSIDE) outside_lattice(editLatt);
- }
- else {
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA); /* sets recalc flags */
- }
- }
- else if( (t->flag & T_POSE) && t->poseobj) {
- Object *ob= t->poseobj;
- bArmature *arm= ob->data;
-
- /* old optimize trick... this enforces to bypass the depgraph */
- if (!(arm->flag & ARM_DELAYDEFORM)) {
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); /* sets recalc flags */
-
- /* bah, softbody exception... recalcdata doesnt reset */
- for(base= FIRSTBASE; base; base= base->next) {
- if(base->object->recalc & OB_RECALC_DATA)
- if(modifiers_isSoftbodyEnabled(base->object)) {
- base->object->softflag |= OB_SB_REDO;
- }
- }
- }
- else
- where_is_pose(ob);
- }
- else if(G.f & G_PARTICLEEDIT) {
- flushTransParticles(t);
- }
- else {
- for(base= FIRSTBASE; base; base= base->next) {
- Object *ob= base->object;
-
- /* this flag is from depgraph, was stored in nitialize phase, handled in drawview.c */
- if(base->flag & BA_HAS_RECALC_OB)
- ob->recalc |= OB_RECALC_OB;
- if(base->flag & BA_HAS_RECALC_DATA)
- ob->recalc |= OB_RECALC_DATA;
-
- /* thanks to ob->ctime usage, ipos are not called in where_is_object,
- unless we edit ipokeys */
- if(base->flag & BA_DO_IPO) {
- if(ob->ipo) {
- IpoCurve *icu;
-
- ob->ctime= -1234567.0;
-
- icu= ob->ipo->curve.first;
- while(icu) {
- calchandles_ipocurve(icu);
- icu= icu->next;
- }
- }
- }
-
- /* softbody exception */
- if(modifiers_isSoftbodyEnabled(ob)) {
- if(ob->recalc & OB_RECALC_DATA)
- ob->softflag |= OB_SB_REDO;
- }
-
- /* proxy exception */
- if(ob->proxy)
- ob->proxy->recalc |= ob->recalc;
- if(ob->proxy_group)
- group_tag_recalc(ob->proxy_group->dup_group);
- }
- }
-
-#ifdef WITH_VERSE
- for (td = t->data; td < t->data + t->total; td++) {
- if(td->flag & TD_VERSE_VERT) {
- if(td->verse)
- send_versevert_pos((VerseVert*)td->verse);
- }
- else if(td->flag & TD_VERSE_OBJECT)
- if(td->verse) b_verse_send_transformation((Object*)td->verse);
- }
-#endif
-
- /* update shaded drawmode while transform */
- if(t->spacetype==SPACE_VIEW3D && G.vd->drawtype == OB_SHADED)
- reshadeall_displist();
-
-}
-
-void drawLine(float *center, float *dir, char axis, short options)
-{
- extern void make_axis_color(char *col, char *col2, char axis); // drawview.c
- float v1[3], v2[3], v3[3];
- char col[3], col2[3];
-
- //if(G.obedit) mymultmatrix(G.obedit->obmat); // sets opengl viewing
-
- VecCopyf(v3, dir);
- VecMulf(v3, G.vd->far);
-
- VecSubf(v2, center, v3);
- VecAddf(v1, center, v3);
-
- if (options & DRAWLIGHT) {
- col[0] = col[1] = col[2] = 220;
- }
- else {
- BIF_GetThemeColor3ubv(TH_GRID, col);
- }
- make_axis_color(col, col2, axis);
- glColor3ubv((GLubyte *)col2);
-
- setlinestyle(0);
- glBegin(GL_LINE_STRIP);
- glVertex3fv(v1);
- glVertex3fv(v2);
- glEnd();
-
- myloadmatrix(G.vd->viewmat);
-}
-
-void initTrans (TransInfo *t)
-{
- /* moving: is shown in drawobject() (transform color) */
- if(G.obedit || (t->flag & T_POSE) ) G.moving= G_TRANSFORM_EDIT;
- else if(G.f & G_PARTICLEEDIT) G.moving= G_TRANSFORM_PARTICLE;
- else G.moving= G_TRANSFORM_OBJ;
-
- t->data = NULL;
- t->ext = NULL;
-
- t->flag = 0;
- t->num.flag = 0;
-
-
- /* setting PET flag */
- if ((t->context & CTX_NO_PET) == 0 && (G.scene->proportional)) {
- t->flag |= T_PROP_EDIT;
- if(G.scene->proportional==2) t->flag |= T_PROP_CONNECTED; // yes i know, has to become define
- }
-
- getmouseco_areawin(t->imval);
- t->con.imval[0] = t->imval[0];
- t->con.imval[1] = t->imval[1];
-
- t->transform = NULL;
- t->handleEvent = NULL;
- t->customData = NULL;
-
- t->total =
- t->num.idx =
- t->num.idx_max =
- t->num.ctrl[0] =
- t->num.ctrl[1] =
- t->num.ctrl[2] = 0;
-
- t->val = 0.0f;
-
- t->num.val[0] =
- t->num.val[1] =
- t->num.val[2] = 0.0f;
-
- t->vec[0] =
- t->vec[1] =
- t->vec[2] = 0.0f;
-
- t->center[0] =
- t->center[1] =
- t->center[2] = 0.0f;
-
- Mat3One(t->mat);
-
- t->spacetype = curarea->spacetype;
- if(t->spacetype==SPACE_VIEW3D) {
- if(G.vd->flag & V3D_ALIGN) t->flag |= T_V3D_ALIGN;
- t->around = G.vd->around;
- } else if(t->spacetype==SPACE_IMAGE) {
- t->around = G.v2d->around;
- }
- else
- t->around = V3D_CENTER;
-
- setTransformViewMatrices(t);
-}
-
-/* Here I would suggest only TransInfo related issues, like free data & reset vars. Not redraws */
-void postTrans (TransInfo *t)
-{
- TransData *td;
-
- G.moving = 0; // Set moving flag off (display as usual)
-#ifdef WITH_VERSE
-
- for (td = t->data; td < t->data + t->total; td++) {
- if(td->flag & TD_VERSE_VERT) {
- if(td->verse) send_versevert_pos((VerseVert*)td->verse);
- }
- else if(td->flag & TD_VERSE_OBJECT) {
- if(td->verse) {
- struct VNode *vnode;
- vnode = (VNode*)((Object*)td->verse)->vnode;
- ((VObjectData*)vnode->data)->flag |= POS_SEND_READY;
- ((VObjectData*)vnode->data)->flag |= ROT_SEND_READY;
- ((VObjectData*)vnode->data)->flag |= SCALE_SEND_READY;
- b_verse_send_transformation((Object*)td->verse);
- }
- }
- }
-#endif
-
- stopConstraint(t);
-
- /* postTrans can be called when nothing is selected, so data is NULL already */
- if (t->data) {
- int a;
-
- /* since ipokeys are optional on objects, we mallocced them per trans-data */
- for(a=0, td= t->data; a<t->total; a++, td++) {
- if(td->tdi) MEM_freeN(td->tdi);
- }
- MEM_freeN(t->data);
- }
-
- if (t->ext) MEM_freeN(t->ext);
- if (t->data2d) {
- MEM_freeN(t->data2d);
- t->data2d= NULL;
- }
-
- if ((t->flag & T_FREE_CUSTOMDATA) && t->customData != NULL) {
- MEM_freeN(t->customData);
- }
-
- if(t->spacetype==SPACE_IMAGE) {
- if (G.sima->flag & SI_LIVE_UNWRAP)
- unwrap_lscm_live_end(t->state == TRANS_CANCEL);
- }
-}
-
-void applyTransObjects(TransInfo *t)
-{
- TransData *td;
-
- for (td = t->data; td < t->data + t->total; td++) {
- VECCOPY(td->iloc, td->loc);
- if (td->ext->rot) {
- VECCOPY(td->ext->irot, td->ext->rot);
- }
- if (td->ext->size) {
- VECCOPY(td->ext->isize, td->ext->size);
- }
- }
- recalcData(t);
-}
-
-/* helper for below */
-static void restore_ipokey(float *poin, float *old)
-{
- if(poin) {
- poin[0]= old[0];
- poin[-3]= old[3];
- poin[3]= old[6];
- }
-}
-
-static void restoreElement(TransData *td) {
- /* TransData for crease has no loc */
- if (td->loc) {
- VECCOPY(td->loc, td->iloc);
- }
- if (td->val) {
- *td->val = td->ival;
- }
- if (td->ext && (td->flag&TD_NO_EXT)==0) {
- if (td->ext->rot) {
- VECCOPY(td->ext->rot, td->ext->irot);
- }
- if (td->ext->size) {
- VECCOPY(td->ext->size, td->ext->isize);
- }
- if(td->flag & TD_USEQUAT) {
- if (td->ext->quat) {
- QUATCOPY(td->ext->quat, td->ext->iquat);
- }
- }
- }
- if(td->tdi) {
- TransDataIpokey *tdi= td->tdi;
-
- restore_ipokey(tdi->locx, tdi->oldloc);
- restore_ipokey(tdi->locy, tdi->oldloc+1);
- restore_ipokey(tdi->locz, tdi->oldloc+2);
-
- restore_ipokey(tdi->rotx, tdi->oldrot);
- restore_ipokey(tdi->roty, tdi->oldrot+1);
- restore_ipokey(tdi->rotz, tdi->oldrot+2);
-
- restore_ipokey(tdi->sizex, tdi->oldsize);
- restore_ipokey(tdi->sizey, tdi->oldsize+1);
- restore_ipokey(tdi->sizez, tdi->oldsize+2);
- }
-}
-
-void restoreTransObjects(TransInfo *t)
-{
- TransData *td;
-
- for (td = t->data; td < t->data + t->total; td++) {
- restoreElement(td);
-#ifdef WITH_VERSE
- /* position of vertexes and object transformation matrix is sent
- * extra, becuase blender uses synchronous sending of vertexes
- * position as well object trans. matrix and it isn't possible to
- * send it in recalcData sometimes */
- if(td->flag & TD_VERSE_VERT) {
- if(td->verse) {
- ((VerseVert*)td->verse)->flag |= VERT_POS_OBSOLETE;
- }
- }
- else if(td->flag & TD_VERSE_OBJECT)
- if(td->verse) {
- struct VNode *vnode;
- vnode = (VNode*)((Object*)td->verse)->vnode;
- ((VObjectData*)vnode->data)->flag |= POS_SEND_READY;
- ((VObjectData*)vnode->data)->flag |= ROT_SEND_READY;
- ((VObjectData*)vnode->data)->flag |= SCALE_SEND_READY;
- }
-#endif
- }
- recalcData(t);
-}
-
-void calculateCenter2D(TransInfo *t)
-{
- if (t->flag & (T_EDIT|T_POSE)) {
- Object *ob= G.obedit?G.obedit:t->poseobj;
- float vec[3];
-
- VECCOPY(vec, t->center);
- Mat4MulVecfl(ob->obmat, vec);
- projectIntView(t, vec, t->center2d);
- }
- else {
- projectIntView(t, t->center, t->center2d);
- }
-}
-
-void calculateCenterCursor(TransInfo *t)
-{
- float *cursor;
-
- cursor = give_cursor();
- VECCOPY(t->center, cursor);
-
- /* If edit or pose mode, move cursor in local space */
- if (t->flag & (T_EDIT|T_POSE)) {
- Object *ob = G.obedit?G.obedit:t->poseobj;
- float mat[3][3], imat[3][3];
-
- VecSubf(t->center, t->center, ob->obmat[3]);
- Mat3CpyMat4(mat, ob->obmat);
- Mat3Inv(imat, mat);
- Mat3MulVecfl(imat, t->center);
- }
-
- calculateCenter2D(t);
-}
-
-void calculateCenterCursor2D(TransInfo *t)
-{
- float aspx=1.0, aspy=1.0;
-
- if(t->spacetype==SPACE_IMAGE) /* only space supported right now but may change */
- transform_aspect_ratio_tface_uv(&aspx, &aspy);
- if (G.v2d) {
- t->center[0] = G.v2d->cursor[0] * aspx;
- t->center[1] = G.v2d->cursor[1] * aspy;
- }
- calculateCenter2D(t);
-}
-
-void calculateCenterMedian(TransInfo *t)
-{
- float partial[3] = {0.0f, 0.0f, 0.0f};
- int i;
-
- for(i = 0; i < t->total; i++) {
- if (t->data[i].flag & TD_SELECTED) {
- if (!(t->data[i].flag & TD_NOCENTER))
- VecAddf(partial, partial, t->data[i].center);
- }
- else {
- /*
- All the selected elements are at the head of the array
- which means we can stop when it finds unselected data
- */
- break;
- }
- }
- if(i)
- VecMulf(partial, 1.0f / i);
- VECCOPY(t->center, partial);
-
- calculateCenter2D(t);
-}
-
-void calculateCenterBound(TransInfo *t)
-{
- float max[3];
- float min[3];
- int i;
- for(i = 0; i < t->total; i++) {
- if (i) {
- if (t->data[i].flag & TD_SELECTED) {
- if (!(t->data[i].flag & TD_NOCENTER))
- MinMax3(min, max, t->data[i].center);
- }
- else {
- /*
- All the selected elements are at the head of the array
- which means we can stop when it finds unselected data
- */
- break;
- }
- }
- else {
- VECCOPY(max, t->data[i].center);
- VECCOPY(min, t->data[i].center);
- }
- }
- VecAddf(t->center, min, max);
- VecMulf(t->center, 0.5);
-
- calculateCenter2D(t);
-}
-
-void calculateCenter(TransInfo *t)
-{
- switch(t->around) {
- case V3D_CENTER:
- calculateCenterBound(t);
- break;
- case V3D_CENTROID:
- calculateCenterMedian(t);
- break;
- case V3D_CURSOR:
- if(t->spacetype==SPACE_IMAGE)
- calculateCenterCursor2D(t);
- else
- calculateCenterCursor(t);
- break;
- case V3D_LOCAL:
- /* Individual element center uses median center for helpline and such */
- calculateCenterMedian(t);
- break;
- case V3D_ACTIVE:
- /* set median, and if if if... do object center */
-
- /* EDIT MODE ACTIVE EDITMODE ELEMENT */
- if (G.obedit && G.obedit->type == OB_MESH && G.editMesh->selected.last) {
- EM_editselection_center(t->center, G.editMesh->selected.last);
- calculateCenter2D(t);
- break;
- } /* END EDIT MODE ACTIVE ELEMENT */
-
- calculateCenterMedian(t);
- if((t->flag & (T_EDIT|T_POSE))==0) {
- Object *ob= OBACT;
- if(ob) {
- VECCOPY(t->center, ob->obmat[3]);
- projectIntView(t, t->center, t->center2d);
- }
- }
- }
-
- /* setting constraint center */
- VECCOPY(t->con.center, t->center);
- if(t->flag & (T_EDIT|T_POSE)) {
- Object *ob= G.obedit?G.obedit:t->poseobj;
- Mat4MulVecfl(ob->obmat, t->con.center);
- }
-
- /* voor panning from cameraview */
- if(t->flag & T_OBJECT) {
- if( G.vd->camera==OBACT && G.vd->persp>1) {
- float axis[3];
- /* persinv is nasty, use viewinv instead, always right */
- VECCOPY(axis, t->viewinv[2]);
- Normalize(axis);
-
- /* 6.0 = 6 grid units */
- axis[0]= t->center[0]- 6.0f*axis[0];
- axis[1]= t->center[1]- 6.0f*axis[1];
- axis[2]= t->center[2]- 6.0f*axis[2];
-
- projectIntView(t, axis, t->center2d);
-
- /* rotate only needs correct 2d center, grab needs initgrabz() value */
- if(t->mode==TFM_TRANSLATION) {
- VECCOPY(t->center, axis);
- VECCOPY(t->con.center, t->center);
- }
- }
- }
-
- if(t->spacetype==SPACE_VIEW3D)
- initgrabz(t->center[0], t->center[1], t->center[2]);
-}
-
-void calculatePropRatio(TransInfo *t)
-{
- TransData *td = t->data;
- int i;
- float dist;
- short connected = t->flag & T_PROP_CONNECTED;
-
- if (t->flag & T_PROP_EDIT) {
- for(i = 0 ; i < t->total; i++, td++) {
- if (td->flag & TD_SELECTED) {
- td->factor = 1.0f;
- }
- else if ((connected &&
- (td->flag & TD_NOTCONNECTED || td->dist > t->propsize))
- ||
- (connected == 0 &&
- td->rdist > t->propsize)) {
- /*
- The elements are sorted according to their dist member in the array,
- that means we can stop when it finds one element outside of the propsize.
- */
- td->flag |= TD_NOACTION;
- td->factor = 0.0f;
- restoreElement(td);
- }
- else {
- /* Use rdist for falloff calculations, it is the real distance */
- td->flag &= ~TD_NOACTION;
- dist= (t->propsize-td->rdist)/t->propsize;
-
- /*
- * Clamp to positive numbers.
- * Certain corner cases with connectivity and individual centers
- * can give values of rdist larger than propsize.
- */
- if (dist < 0.0f)
- dist = 0.0f;
-
- switch(G.scene->prop_mode) {
- case PROP_SHARP:
- td->factor= dist*dist;
- break;
- case PROP_SMOOTH:
- td->factor= 3.0f*dist*dist - 2.0f*dist*dist*dist;
- break;
- case PROP_ROOT:
- td->factor = (float)sqrt(dist);
- break;
- case PROP_LIN:
- td->factor = dist;
- break;
- case PROP_CONST:
- td->factor = 1.0f;
- break;
- case PROP_SPHERE:
- td->factor = (float)sqrt(2*dist - dist * dist);
- break;
- case PROP_RANDOM:
- BLI_srand( BLI_rand() ); /* random seed */
- td->factor = BLI_frand()*dist;
- break;
- default:
- td->factor = 1;
- }
- }
- }
- switch(G.scene->prop_mode) {
- case PROP_SHARP:
- strcpy(t->proptext, "(Sharp)");
- break;
- case PROP_SMOOTH:
- strcpy(t->proptext, "(Smooth)");
- break;
- case PROP_ROOT:
- strcpy(t->proptext, "(Root)");
- break;
- case PROP_LIN:
- strcpy(t->proptext, "(Linear)");
- break;
- case PROP_CONST:
- strcpy(t->proptext, "(Constant)");
- break;
- case PROP_SPHERE:
- strcpy(t->proptext, "(Sphere)");
- break;
- case PROP_RANDOM:
- strcpy(t->proptext, "(Random)");
- break;
- default:
- strcpy(t->proptext, "");
- }
- }
- else {
- for(i = 0 ; i < t->total; i++, td++) {
- td->factor = 1.0;
- }
- strcpy(t->proptext, "");
- }
-}
-
-TransInfo * BIF_GetTransInfo() {
- return &Trans;
-}
-
diff --git a/source/blender/src/transform_manipulator.c b/source/blender/src/transform_manipulator.c
deleted file mode 100644
index 7a6d4c69442..00000000000
--- a/source/blender/src/transform_manipulator.c
+++ /dev/null
@@ -1,1720 +0,0 @@
-/**
-* $Id:
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2005 Blender Foundation
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef WIN32
-#include <unistd.h>
-#else
-#include <io.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_armature_types.h"
-#include "DNA_action_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_lattice_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meta_types.h"
-#include "DNA_object_types.h"
-#include "DNA_particle_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_space_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_view3d_types.h"
-
-#include "BKE_armature.h"
-#include "BKE_global.h"
-#include "BKE_lattice.h"
-#include "BKE_object.h"
-#include "BKE_particle.h"
-#include "BKE_utildefines.h"
-
-#include "BLI_arithb.h"
-#include "BLI_editVert.h"
-
-#include "BIF_editarmature.h"
-#include "BIF_gl.h"
-#include "BIF_mywindow.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
-#include "BIF_transform.h"
-#include "BIF_editmesh.h"
-#include "BIF_editparticle.h"
-
-#include "BSE_edit.h"
-#include "BSE_view.h"
-#include "BDR_drawobject.h"
-
-#include "blendef.h"
-#include "transform.h"
-
-/* return codes for select, and drawing flags */
-
-#define MAN_TRANS_X 1
-#define MAN_TRANS_Y 2
-#define MAN_TRANS_Z 4
-#define MAN_TRANS_C 7
-
-#define MAN_ROT_X 8
-#define MAN_ROT_Y 16
-#define MAN_ROT_Z 32
-#define MAN_ROT_V 64
-#define MAN_ROT_T 128
-#define MAN_ROT_C 248
-
-#define MAN_SCALE_X 256
-#define MAN_SCALE_Y 512
-#define MAN_SCALE_Z 1024
-#define MAN_SCALE_C 1792
-
-/* color codes */
-
-#define MAN_RGB 0
-#define MAN_GHOST 1
-#define MAN_MOVECOL 2
-
-/* GLOBAL VARIABLE THAT SHOULD MOVED TO SCREEN MEMBER OR SOMETHING */
-extern TransInfo Trans;
-
-
-static int is_mat4_flipped(float mat[][4])
-{
- float vec[3];
-
- Crossf(vec, mat[0], mat[1]);
- if( Inpf(vec, mat[2]) < 0.0 ) return 1;
- return 0;
-}
-
-/* transform widget center calc helper for below */
-static void calc_tw_center(float *co)
-{
- float *twcent= G.scene->twcent;
- float *min= G.scene->twmin;
- float *max= G.scene->twmax;
-
- DO_MINMAX(co, min, max);
- VecAddf(twcent, twcent, co);
-}
-
-static void protectflag_to_drawflags(short protectflag, short *drawflags)
-{
- if(protectflag & OB_LOCK_LOCX)
- *drawflags &= ~MAN_TRANS_X;
- if(protectflag & OB_LOCK_LOCY)
- *drawflags &= ~MAN_TRANS_Y;
- if(protectflag & OB_LOCK_LOCZ)
- *drawflags &= ~MAN_TRANS_Z;
-
- if(protectflag & OB_LOCK_ROTX)
- *drawflags &= ~MAN_ROT_X;
- if(protectflag & OB_LOCK_ROTY)
- *drawflags &= ~MAN_ROT_Y;
- if(protectflag & OB_LOCK_ROTZ)
- *drawflags &= ~MAN_ROT_Z;
-
- if(protectflag & OB_LOCK_SCALEX)
- *drawflags &= ~MAN_SCALE_X;
- if(protectflag & OB_LOCK_SCALEY)
- *drawflags &= ~MAN_SCALE_Y;
- if(protectflag & OB_LOCK_SCALEZ)
- *drawflags &= ~MAN_SCALE_Z;
-}
-
-/* for pose mode */
-static void stats_pose(View3D *v3d, bPoseChannel *pchan, float *normal, float *plane)
-{
- Bone *bone= pchan->bone;
-
- if(bone) {
- if (bone->flag & BONE_TRANSFORM) {
- calc_tw_center(pchan->pose_head);
- protectflag_to_drawflags(pchan->protectflag, &v3d->twdrawflag);
-
- VecAddf(normal, normal, pchan->pose_mat[2]);
- VecAddf(plane, plane, pchan->pose_mat[1]);
- }
- }
-}
-
-/* only counts the parent selection, and tags transform flag */
-/* bad call... should re-use method from transform_conversion once */
-static void count_bone_select(TransInfo *t, bArmature *arm, ListBase *lb, int do_it)
-{
- Bone *bone;
- int do_next;
-
- for(bone= lb->first; bone; bone= bone->next) {
- bone->flag &= ~BONE_TRANSFORM;
- do_next= do_it;
- if(do_it) {
- if(bone->layer & arm->layer) {
- if (bone->flag & BONE_SELECTED) {
- /* We don't let connected children get "grabbed" */
- if ( (t->mode!=TFM_TRANSLATION) || (bone->flag & BONE_CONNECTED)==0 ) {
- bone->flag |= BONE_TRANSFORM;
- t->total++;
- do_next= 0; // no transform on children if one parent bone is selected
- }
- }
- }
- }
- count_bone_select(t, arm, &bone->childbase, do_next);
- }
-}
-
-/* centroid, boundbox, of selection */
-/* returns total items selected */
-int calc_manipulator_stats(ScrArea *sa)
-{
- extern ListBase editNurb;
- TransInfo *t;
- View3D *v3d= sa->spacedata.first;
- Base *base;
- Object *ob= OBACT;
- float normal[3]={0.0, 0.0, 0.0};
- float plane[3]={0.0, 0.0, 0.0};
- int a, totsel=0;
-
- t = BIF_GetTransInfo();
-
- /* transform widget matrix */
- Mat4One(v3d->twmat);
-
- v3d->twdrawflag= 0xFFFF;
-
- /* transform widget centroid/center */
- G.scene->twcent[0]= G.scene->twcent[1]= G.scene->twcent[2]= 0.0f;
- INIT_MINMAX(G.scene->twmin, G.scene->twmax);
-
- if(G.obedit) {
- ob= G.obedit;
- if((ob->lay & G.vd->lay)==0) return 0;
-
- if(G.obedit->type==OB_MESH) {
- EditMesh *em = G.editMesh;
- EditVert *eve;
- float vec[3]= {0,0,0};
- int no_faces= 1;
-
- /* USE LAST SELECTE WITH ACTIVE */
- if (G.vd->around==V3D_ACTIVE && em->selected.last) {
- EM_editselection_center(vec, em->selected.last);
- calc_tw_center(vec);
- totsel= 1;
- if (v3d->twmode == V3D_MANIP_NORMAL) {
- EM_editselection_normal(normal, em->selected.last);
- EM_editselection_plane(plane, em->selected.last);
- } /* NORMAL OPERATION */
- } else {
- if(v3d->twmode == V3D_MANIP_NORMAL) {
- EditFace *efa;
-
- for(efa= em->faces.first; efa; efa= efa->next) {
- if(efa->f & SELECT) {
- no_faces= 0;
- VECADD(normal, normal, efa->n);
- VecSubf(vec, efa->v2->co, efa->v1->co);
- VECADD(plane, plane, vec);
- }
- }
- }
-
- /* do vertices for center, and if still no normal found, use vertex normals */
- for(eve= em->verts.first; eve; eve= eve->next) {
- if(eve->f & SELECT) {
- if(no_faces) VECADD(normal, normal, eve->no);
-
- totsel++;
- calc_tw_center(eve->co);
- }
- }
- /* the edge case... */
- if(no_faces && v3d->twmode == V3D_MANIP_NORMAL) {
- EditEdge *eed;
-
- for(eed= em->edges.first; eed; eed= eed->next) {
- if(eed->f & SELECT) {
- /* ok we got an edge, only use one, and as normal */
- VECCOPY(plane, normal);
- VecSubf(normal, eed->v2->co, eed->v1->co);
- break;
- }
- }
- }
- }
- } /* end editmesh */
- else if (G.obedit->type==OB_ARMATURE){
- bArmature *arm= G.obedit->data;
- EditBone *ebo;
- for (ebo=G.edbo.first;ebo;ebo=ebo->next){
- if(ebo->layer & arm->layer) {
- if (ebo->flag & BONE_TIPSEL) {
- calc_tw_center(ebo->tail);
- totsel++;
- }
- if (ebo->flag & BONE_ROOTSEL) {
- calc_tw_center(ebo->head);
- totsel++;
- }
- }
- }
- }
- else if ELEM3(G.obedit->type, OB_CURVE, OB_SURF, OB_FONT) {
- Nurb *nu;
- BezTriple *bezt;
- BPoint *bp;
-
- nu= editNurb.first;
- while(nu) {
- if((nu->type & 7)==CU_BEZIER) {
- bezt= nu->bezt;
- a= nu->pntsu;
- while(a--) {
- /* exception */
- if( (bezt->f1 & SELECT) + (bezt->f2 & SELECT) + (bezt->f3 & SELECT) > SELECT ) {
- calc_tw_center(bezt->vec[1]);
- totsel++;
- VecSubf(normal, bezt->vec[0], bezt->vec[2]);
- }
- else {
- if(bezt->f1) {
- calc_tw_center(bezt->vec[0]);
- VecSubf(normal, bezt->vec[0], bezt->vec[1]);
- totsel++;
- }
- if(bezt->f2) {
- calc_tw_center(bezt->vec[1]);
- VecSubf(normal, bezt->vec[0], bezt->vec[2]);
- totsel++;
- }
- if(bezt->f3) {
- calc_tw_center(bezt->vec[2]);
- VecSubf(normal, bezt->vec[1], bezt->vec[2]);
- totsel++;
- }
- }
- bezt++;
- }
- }
- else {
- bp= nu->bp;
- a= nu->pntsu*nu->pntsv;
- while(a--) {
- if(bp->f1 & SELECT) {
- calc_tw_center(bp->vec);
- totsel++;
- }
- bp++;
- }
- }
- nu= nu->next;
- }
- }
- else if(G.obedit->type==OB_MBALL) {
- /* editmball.c */
- extern ListBase editelems; /* go away ! */
- MetaElem *ml, *ml_sel=NULL;
-
- ml= editelems.first;
- while(ml) {
- if(ml->flag & SELECT) {
- calc_tw_center(&ml->x);
- ml_sel = ml;
- totsel++;
- }
- ml= ml->next;
- }
- /* normal manipulator */
- if(totsel==1){
- float mat1[4][4];
-
- /* Rotation of MetaElem is stored in quat */
- QuatToMat4(ml_sel->quat, mat1);
-
- /* Translation of MetaElem */
- mat1[3][0]= ml_sel->x;
- mat1[3][1]= ml_sel->y;
- mat1[3][2]= ml_sel->z;
-
- VECCOPY(normal, mat1[2]);
- VECCOPY(plane, mat1[1]);
-
- VecMulf(plane, -1.0);
- }
- }
- else if(G.obedit->type==OB_LATTICE) {
- BPoint *bp;
- bp= editLatt->def;
-
- a= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw;
- while(a--) {
- if(bp->f1 & SELECT) {
- calc_tw_center(bp->vec);
- totsel++;
- }
- bp++;
- }
- }
-
- /* selection center */
- if(totsel) {
- VecMulf(G.scene->twcent, 1.0f/(float)totsel); // centroid!
- Mat4MulVecfl(G.obedit->obmat, G.scene->twcent);
- Mat4MulVecfl(G.obedit->obmat, G.scene->twmin);
- Mat4MulVecfl(G.obedit->obmat, G.scene->twmax);
- }
- }
- else if(ob && (ob->flag & OB_POSEMODE)) {
- bArmature *arm= ob->data;
- bPoseChannel *pchan;
- int mode;
-
- if((ob->lay & G.vd->lay)==0) return 0;
-
- mode= Trans.mode;
- Trans.mode= TFM_ROTATION; // mislead counting bones... bah
-
- /* count total, we use same method as transform will do */
- Trans.total= 0;
- count_bone_select(&Trans, arm, &arm->bonebase, 1);
- totsel= Trans.total;
- if(totsel) {
- /* use channels to get stats */
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- stats_pose(v3d, pchan, normal, plane);
- }
- //VecMulf(normal, -1.0);
- VecMulf(plane, -1.0);
-
- VecMulf(G.scene->twcent, 1.0f/(float)totsel); // centroid!
- Mat4MulVecfl(ob->obmat, G.scene->twcent);
- Mat4MulVecfl(ob->obmat, G.scene->twmin);
- Mat4MulVecfl(ob->obmat, G.scene->twmax);
- }
- /* restore, mode can be TFM_INIT */
- Trans.mode= mode;
- }
- else if(G.f & (G_VERTEXPAINT + G_TEXTUREPAINT + G_WEIGHTPAINT + G_SCULPTMODE)) {
- ;
- }
- else if(G.f & G_PARTICLEEDIT) {
- ParticleSystem *psys=PE_get_current(OBACT);
- ParticleData *pa = psys->particles;
- ParticleEditKey *ek;
- int k;
-
- if(psys->edit){
- for(a=0; a<psys->totpart; a++,pa++){
- if(pa->flag & PARS_HIDE) continue;
- for(k=0, ek=psys->edit->keys[a]; k<pa->totkey; k++,ek++){
- if(ek->flag & PEK_SELECT){
- calc_tw_center(ek->world_co);
- totsel++;
- }
- }
- }
- /* selection center */
- if(totsel)
- VecMulf(G.scene->twcent, 1.0f/(float)totsel); // centroid!
- }
- }
- else {
-
- /* we need the one selected object, if its not active */
- ob= OBACT;
- if(ob && !(ob->flag & SELECT)) ob= NULL;
-
- for(base= G.scene->base.first; base; base= base->next) {
- if TESTBASELIB(base) {
- if(ob==NULL)
- ob= base->object;
- calc_tw_center(base->object->obmat[3]);
- protectflag_to_drawflags(base->object->protectflag, &v3d->twdrawflag);
- totsel++;
- }
- }
-
- /* selection center */
- if(totsel) {
- VecMulf(G.scene->twcent, 1.0f/(float)totsel); // centroid!
- }
- }
-
- /* global, local or normal orientation? */
- if(ob && totsel) {
-
- switch(v3d->twmode) {
- case V3D_MANIP_GLOBAL:
- strcpy(t->spacename, "global");
- break;
-
- case V3D_MANIP_NORMAL:
- if(G.obedit || (ob->flag & OB_POSEMODE)) {
- strcpy(t->spacename, "normal");
- if(normal[0]!=0.0 || normal[1]!=0.0 || normal[2]!=0.0) {
- float imat[3][3], mat[3][3];
-
- /* we need the transpose of the inverse for a normal... */
- Mat3CpyMat4(imat, ob->obmat);
-
- Mat3Inv(mat, imat);
- Mat3Transp(mat);
- Mat3MulVecfl(mat, normal);
- Mat3MulVecfl(mat, plane);
-
- Normalize(normal);
- if(0.0==Normalize(plane)) VECCOPY(plane, mat[1]);
-
- VECCOPY(mat[2], normal);
- Crossf(mat[0], normal, plane);
- Crossf(mat[1], mat[2], mat[0]);
-
- Mat4CpyMat3(v3d->twmat, mat);
- Mat4Ortho(v3d->twmat);
-
- break;
- }
- }
- /* no break we define 'normal' as 'local' in Object mode */
- case V3D_MANIP_LOCAL:
- strcpy(t->spacename, "local");
- Mat4CpyMat4(v3d->twmat, ob->obmat);
- Mat4Ortho(v3d->twmat);
- break;
-
- case V3D_MANIP_VIEW:
- {
- float mat[3][3];
- strcpy(t->spacename, "view");
- Mat3CpyMat4(mat, v3d->viewinv);
- Mat3Ortho(mat);
- Mat4CpyMat3(v3d->twmat, mat);
- }
- break;
- }
-
- }
-
- return totsel;
-}
-
-/* ******************** DRAWING STUFFIES *********** */
-
-static float screen_aligned(float mat[][4])
-{
- float vec[3], size;
-
- VECCOPY(vec, mat[0]);
- size= Normalize(vec);
-
- glTranslatef(mat[3][0], mat[3][1], mat[3][2]);
-
- /* sets view screen aligned */
- glRotatef( -360.0f*saacos(G.vd->viewquat[0])/(float)M_PI, G.vd->viewquat[1], G.vd->viewquat[2], G.vd->viewquat[3]);
-
- return size;
-}
-
-
-/* radring = radius of donut rings
- radhole = radius hole
- start = starting segment (based on nrings)
- end = end segment
- nsides = amount of points in ring
- nrigns = amount of rings
-*/
-static void partial_donut(float radring, float radhole, int start, int end, int nsides, int nrings)
-{
- float theta, phi, theta1;
- float cos_theta, sin_theta;
- float cos_theta1, sin_theta1;
- float ring_delta, side_delta;
- int i, j, docaps= 1;
-
- if(start==0 && end==nrings) docaps= 0;
-
- ring_delta= 2.0f*(float)M_PI/(float)nrings;
- side_delta= 2.0f*(float)M_PI/(float)nsides;
-
- theta= (float)M_PI+0.5f*ring_delta;
- cos_theta= (float)cos(theta);
- sin_theta= (float)sin(theta);
-
- for(i= nrings - 1; i >= 0; i--) {
- theta1= theta + ring_delta;
- cos_theta1= (float)cos(theta1);
- sin_theta1= (float)sin(theta1);
-
- if(docaps && i==start) { // cap
- glBegin(GL_POLYGON);
- phi= 0.0;
- for(j= nsides; j >= 0; j--) {
- float cos_phi, sin_phi, dist;
-
- phi += side_delta;
- cos_phi= (float)cos(phi);
- sin_phi= (float)sin(phi);
- dist= radhole + radring * cos_phi;
-
- glVertex3f(cos_theta1 * dist, -sin_theta1 * dist, radring * sin_phi);
- }
- glEnd();
- }
- if(i>=start && i<=end) {
- glBegin(GL_QUAD_STRIP);
- phi= 0.0;
- for(j= nsides; j >= 0; j--) {
- float cos_phi, sin_phi, dist;
-
- phi += side_delta;
- cos_phi= (float)cos(phi);
- sin_phi= (float)sin(phi);
- dist= radhole + radring * cos_phi;
-
- glVertex3f(cos_theta1 * dist, -sin_theta1 * dist, radring * sin_phi);
- glVertex3f(cos_theta * dist, -sin_theta * dist, radring * sin_phi);
- }
- glEnd();
- }
-
- if(docaps && i==end) { // cap
- glBegin(GL_POLYGON);
- phi= 0.0;
- for(j= nsides; j >= 0; j--) {
- float cos_phi, sin_phi, dist;
-
- phi -= side_delta;
- cos_phi= (float)cos(phi);
- sin_phi= (float)sin(phi);
- dist= radhole + radring * cos_phi;
-
- glVertex3f(cos_theta * dist, -sin_theta * dist, radring * sin_phi);
- }
- glEnd();
- }
-
-
- theta= theta1;
- cos_theta= cos_theta1;
- sin_theta= sin_theta1;
- }
-}
-
-/* three colors can be set;
- grey for ghosting
- moving: in transform theme color
- else the red/green/blue
-*/
-static void manipulator_setcolor(char axis, int colcode)
-{
- float vec[4];
- char col[4];
-
- vec[3]= 0.7f; // alpha set on 0.5, can be glEnabled or not
-
- if(colcode==MAN_GHOST) {
- glColor4ub(0, 0, 0, 70);
- }
- else if(colcode==MAN_MOVECOL) {
- BIF_GetThemeColor3ubv(TH_TRANSFORM, col);
- glColor4ub(col[0], col[1], col[2], 128);
- }
- else {
- switch(axis) {
- case 'c':
- BIF_GetThemeColor3ubv(TH_TRANSFORM, col);
- if(G.vd->twmode == V3D_MANIP_LOCAL) {
- col[0]= col[0]>200?255:col[0]+55;
- col[1]= col[1]>200?255:col[1]+55;
- col[2]= col[2]>200?255:col[2]+55;
- }
- else if(G.vd->twmode == V3D_MANIP_NORMAL) {
- col[0]= col[0]<55?0:col[0]-55;
- col[1]= col[1]<55?0:col[1]-55;
- col[2]= col[2]<55?0:col[2]-55;
- }
- glColor4ub(col[0], col[1], col[2], 128);
- break;
- case 'x':
- glColor4ub(220, 0, 0, 128);
- break;
- case 'y':
- glColor4ub(0, 220, 0, 128);
- break;
- case 'z':
- glColor4ub(30, 30, 220, 128);
- break;
- }
- }
-}
-
-/* viewmatrix should have been set OK, also no shademode! */
-static void draw_manipulator_axes(int colcode, int flagx, int flagy, int flagz)
-{
-
- /* axes */
- if(flagx) {
- manipulator_setcolor('x', colcode);
- if(flagx & MAN_SCALE_X) glLoadName(MAN_SCALE_X);
- else if(flagx & MAN_TRANS_X) glLoadName(MAN_TRANS_X);
- glBegin(GL_LINES);
- glVertex3f(0.2f, 0.0f, 0.0f);
- glVertex3f(1.0f, 0.0f, 0.0f);
- glEnd();
- }
- if(flagy) {
- if(flagy & MAN_SCALE_Y) glLoadName(MAN_SCALE_Y);
- else if(flagy & MAN_TRANS_Y) glLoadName(MAN_TRANS_Y);
- manipulator_setcolor('y', colcode);
- glBegin(GL_LINES);
- glVertex3f(0.0f, 0.2f, 0.0f);
- glVertex3f(0.0f, 1.0f, 0.0f);
- glEnd();
- }
- if(flagz) {
- if(flagz & MAN_SCALE_Z) glLoadName(MAN_SCALE_Z);
- else if(flagz & MAN_TRANS_Z) glLoadName(MAN_TRANS_Z);
- manipulator_setcolor('z', colcode);
- glBegin(GL_LINES);
- glVertex3f(0.0f, 0.0f, 0.2f);
- glVertex3f(0.0f, 0.0f, 1.0f);
- glEnd();
- }
-}
-
-/* only called while G.moving */
-static void draw_manipulator_rotate_ghost(float mat[][4], int drawflags)
-{
- GLUquadricObj *qobj;
- float size, phi, startphi, vec[3], svec[3], matt[4][4], cross[3], tmat[3][3];
- int arcs= (G.rt!=2);
-
- glDisable(GL_DEPTH_TEST);
-
- qobj= gluNewQuadric();
- gluQuadricDrawStyle(qobj, GLU_FILL);
-
- glColor4ub(0,0,0,64);
- glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
-
- /* we need both [4][4] transforms, Trans.mat seems to be premul, not post for mat[][4] */
- Mat4CpyMat4(matt, mat); // to copy the parts outside of [3][3]
- Mat4MulMat34(matt, Trans.mat, mat);
-
- /* Screen aligned view rot circle */
- if(drawflags & MAN_ROT_V) {
-
- /* prepare for screen aligned draw */
- glPushMatrix();
- size= screen_aligned(mat);
-
- vec[0]= (float)(Trans.con.imval[0] - Trans.center2d[0]);
- vec[1]= (float)(Trans.con.imval[1] - Trans.center2d[1]);
- vec[2]= 0.0f;
- Normalize(vec);
-
- startphi= saacos( vec[1] );
- if(vec[0]<0.0) startphi= -startphi;
-
- phi= (float)fmod(180.0*Trans.val/M_PI, 360.0);
- if(phi > 180.0) phi-= 360.0;
- else if(phi<-180.0) phi+= 360.0;
-
- gluPartialDisk(qobj, 0.0, size, 32, 1, 180.0*startphi/M_PI, phi);
-
- glPopMatrix();
- }
- else if(arcs) {
- float imat[3][3], ivmat[3][3];
- /* try to get the start rotation */
-
- svec[0]= (float)(Trans.con.imval[0] - Trans.center2d[0]);
- svec[1]= (float)(Trans.con.imval[1] - Trans.center2d[1]);
- svec[2]= 0.0f;
-
- /* screen aligned vec transform back to manipulator space */
- Mat3CpyMat4(ivmat, G.vd->viewinv);
- Mat3CpyMat4(tmat, mat);
- Mat3Inv(imat, tmat);
- Mat3MulMat3(tmat, imat, ivmat);
-
- Mat3MulVecfl(tmat, svec); // tmat is used further on
- Normalize(svec);
- }
-
- mymultmatrix(mat); // aligns with original widget
-
- /* Z disk */
- if(drawflags & MAN_ROT_Z) {
- if(arcs) {
- /* correct for squeezed arc */
- svec[0]+= tmat[2][0];
- svec[1]+= tmat[2][1];
- Normalize(svec);
-
- startphi= (float)atan2(svec[0], svec[1]);
- }
- else startphi= 0.5f*(float)M_PI;
-
- VECCOPY(vec, mat[0]); // use x axis to detect rotation
- Normalize(vec);
- Normalize(matt[0]);
- phi= saacos( Inpf(vec, matt[0]) );
- if(phi!=0.0) {
- Crossf(cross, vec, matt[0]); // results in z vector
- if(Inpf(cross, mat[2]) > 0.0) phi= -phi;
- gluPartialDisk(qobj, 0.0, 1.0, 32, 1, 180.0*startphi/M_PI, 180.0*(phi)/M_PI);
- }
- }
- /* X disk */
- if(drawflags & MAN_ROT_X) {
- if(arcs) {
- /* correct for squeezed arc */
- svec[1]+= tmat[2][1];
- svec[2]+= tmat[2][2];
- Normalize(svec);
-
- startphi= (float)(M_PI + atan2(svec[2], -svec[1]));
- }
- else startphi= 0.0f;
-
- VECCOPY(vec, mat[1]); // use y axis to detect rotation
- Normalize(vec);
- Normalize(matt[1]);
- phi= saacos( Inpf(vec, matt[1]) );
- if(phi!=0.0) {
- Crossf(cross, vec, matt[1]); // results in x vector
- if(Inpf(cross, mat[0]) > 0.0) phi= -phi;
- glRotatef(90.0, 0.0, 1.0, 0.0);
- gluPartialDisk(qobj, 0.0, 1.0, 32, 1, 180.0*startphi/M_PI, 180.0*phi/M_PI);
- glRotatef(-90.0, 0.0, 1.0, 0.0);
- }
- }
- /* Y circle */
- if(drawflags & MAN_ROT_Y) {
- if(arcs) {
- /* correct for squeezed arc */
- svec[0]+= tmat[2][0];
- svec[2]+= tmat[2][2];
- Normalize(svec);
-
- startphi= (float)(M_PI + atan2(-svec[0], svec[2]));
- }
- else startphi= (float)M_PI;
-
- VECCOPY(vec, mat[2]); // use z axis to detect rotation
- Normalize(vec);
- Normalize(matt[2]);
- phi= saacos( Inpf(vec, matt[2]) );
- if(phi!=0.0) {
- Crossf(cross, vec, matt[2]); // results in y vector
- if(Inpf(cross, mat[1]) > 0.0) phi= -phi;
- glRotatef(-90.0, 1.0, 0.0, 0.0);
- gluPartialDisk(qobj, 0.0, 1.0, 32, 1, 180.0*startphi/M_PI, 180.0*phi/M_PI);
- glRotatef(90.0, 1.0, 0.0, 0.0);
- }
- }
-
- glDisable(GL_BLEND);
- myloadmatrix(G.vd->viewmat);
-}
-
-static void draw_manipulator_rotate(float mat[][4], int moving, int drawflags, int combo)
-{
- GLUquadricObj *qobj;
- double plane[4];
- float size, vec[3], unitmat[4][4];
- float cywid= 0.33f*0.01f*(float)U.tw_handlesize;
- float cusize= cywid*0.65f;
- int arcs= (G.rt!=2);
- int colcode;
-
- if(moving) colcode= MAN_MOVECOL;
- else colcode= MAN_RGB;
-
- /* when called while moving in mixed mode, do not draw when... */
- if((drawflags & MAN_ROT_C)==0) return;
-
- /* Init stuff */
- glDisable(GL_DEPTH_TEST);
- Mat4One(unitmat);
-
- qobj= gluNewQuadric();
- gluQuadricDrawStyle(qobj, GLU_FILL);
-
- /* prepare for screen aligned draw */
- VECCOPY(vec, mat[0]);
- size= Normalize(vec);
- glPushMatrix();
- glTranslatef(mat[3][0], mat[3][1], mat[3][2]);
-
- if(arcs) {
- /* clipplane makes nice handles, calc here because of multmatrix but with translate! */
- VECCOPY(plane, G.vd->viewinv[2]);
- plane[3]= -0.02*size; // clip just a bit more
- glClipPlane(GL_CLIP_PLANE0, plane);
- }
- /* sets view screen aligned */
- glRotatef( -360.0f*saacos(G.vd->viewquat[0])/(float)M_PI, G.vd->viewquat[1], G.vd->viewquat[2], G.vd->viewquat[3]);
-
- /* Screen aligned help circle */
- if(arcs) {
- if((G.f & G_PICKSEL)==0) {
- BIF_ThemeColorShade(TH_BACK, -30);
- drawcircball(GL_LINE_LOOP, unitmat[3], size, unitmat);
- }
- }
- /* Screen aligned view rot circle */
- if(drawflags & MAN_ROT_V) {
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_V);
- BIF_ThemeColor(TH_TRANSFORM);
- drawcircball(GL_LINE_LOOP, unitmat[3], 1.2f*size, unitmat);
-
- if(moving) {
- float vec[3];
- vec[0]= (float)(Trans.imval[0] - Trans.center2d[0]);
- vec[1]= (float)(Trans.imval[1] - Trans.center2d[1]);
- vec[2]= 0.0f;
- Normalize(vec);
- VecMulf(vec, 1.2f*size);
- glBegin(GL_LINES);
- glVertex3f(0.0f, 0.0f, 0.0f);
- glVertex3fv(vec);
- glEnd();
- }
- }
- glPopMatrix();
-
- /* apply the transform delta */
- if(moving) {
- float matt[4][4];
- Mat4CpyMat4(matt, mat); // to copy the parts outside of [3][3]
- Mat4MulMat34(matt, Trans.mat, mat);
- mymultmatrix(matt);
- glFrontFace( is_mat4_flipped(matt)?GL_CW:GL_CCW);
- }
- else {
- glFrontFace( is_mat4_flipped(mat)?GL_CW:GL_CCW);
- mymultmatrix(mat);
- }
-
- /* axes */
- if(arcs==0) {
- if(!(G.f & G_PICKSEL)) {
- if( (combo & V3D_MANIP_SCALE)==0) {
- /* axis */
- glBegin(GL_LINES);
- if( (drawflags & MAN_ROT_X) || (moving && (drawflags & MAN_ROT_Z)) ) {
- manipulator_setcolor('x', colcode);
- glVertex3f(0.2f, 0.0f, 0.0f);
- glVertex3f(1.0f, 0.0f, 0.0f);
- }
- if( (drawflags & MAN_ROT_Y) || (moving && (drawflags & MAN_ROT_X)) ) {
- manipulator_setcolor('y', colcode);
- glVertex3f(0.0f, 0.2f, 0.0f);
- glVertex3f(0.0f, 1.0f, 0.0f);
- }
- if( (drawflags & MAN_ROT_Z) || (moving && (drawflags & MAN_ROT_Y)) ) {
- manipulator_setcolor('z', colcode);
- glVertex3f(0.0f, 0.0f, 0.2f);
- glVertex3f(0.0f, 0.0f, 1.0f);
- }
- glEnd();
- }
- }
- }
-
- if(arcs==0 && moving) {
-
- /* Z circle */
- if(drawflags & MAN_ROT_Z) {
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Z);
- manipulator_setcolor('z', colcode);
- drawcircball(GL_LINE_LOOP, unitmat[3], 1.0, unitmat);
- }
- /* X circle */
- if(drawflags & MAN_ROT_X) {
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_X);
- glRotatef(90.0, 0.0, 1.0, 0.0);
- manipulator_setcolor('x', colcode);
- drawcircball(GL_LINE_LOOP, unitmat[3], 1.0, unitmat);
- glRotatef(-90.0, 0.0, 1.0, 0.0);
- }
- /* Y circle */
- if(drawflags & MAN_ROT_Y) {
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Y);
- glRotatef(-90.0, 1.0, 0.0, 0.0);
- manipulator_setcolor('y', colcode);
- drawcircball(GL_LINE_LOOP, unitmat[3], 1.0, unitmat);
- glRotatef(90.0, 1.0, 0.0, 0.0);
- }
-
- if(arcs) glDisable(GL_CLIP_PLANE0);
- }
- // donut arcs
- if(arcs) {
- glEnable(GL_CLIP_PLANE0);
-
- /* Z circle */
- if(drawflags & MAN_ROT_Z) {
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Z);
- manipulator_setcolor('z', colcode);
- partial_donut(cusize/4.0f, 1.0f, 0, 48, 8, 48);
- }
- /* X circle */
- if(drawflags & MAN_ROT_X) {
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_X);
- glRotatef(90.0, 0.0, 1.0, 0.0);
- manipulator_setcolor('x', colcode);
- partial_donut(cusize/4.0f, 1.0f, 0, 48, 8, 48);
- glRotatef(-90.0, 0.0, 1.0, 0.0);
- }
- /* Y circle */
- if(drawflags & MAN_ROT_Y) {
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Y);
- glRotatef(-90.0, 1.0, 0.0, 0.0);
- manipulator_setcolor('y', colcode);
- partial_donut(cusize/4.0f, 1.0f, 0, 48, 8, 48);
- glRotatef(90.0, 1.0, 0.0, 0.0);
- }
-
- glDisable(GL_CLIP_PLANE0);
- }
-
- if(arcs==0) {
-
- /* Z handle on X axis */
- if(drawflags & MAN_ROT_Z) {
- glPushMatrix();
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Z);
- manipulator_setcolor('z', colcode);
-
- partial_donut(0.7f*cusize, 1.0f, 31, 33, 8, 64);
-
- glPopMatrix();
- }
-
- /* Y handle on X axis */
- if(drawflags & MAN_ROT_Y) {
- glPushMatrix();
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Y);
- manipulator_setcolor('y', colcode);
-
- glRotatef(90.0, 1.0, 0.0, 0.0);
- glRotatef(90.0, 0.0, 0.0, 1.0);
- partial_donut(0.7f*cusize, 1.0f, 31, 33, 8, 64);
-
- glPopMatrix();
- }
-
- /* X handle on Z axis */
- if(drawflags & MAN_ROT_X) {
- glPushMatrix();
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_X);
- manipulator_setcolor('x', colcode);
-
- glRotatef(-90.0, 0.0, 1.0, 0.0);
- glRotatef(90.0, 0.0, 0.0, 1.0);
- partial_donut(0.7f*cusize, 1.0f, 31, 33, 8, 64);
-
- glPopMatrix();
- }
-
- }
-
- /* restore */
- myloadmatrix(G.vd->viewmat);
- gluDeleteQuadric(qobj);
- if(G.vd->zbuf) glEnable(GL_DEPTH_TEST);
-
-}
-
-static void draw_manipulator_scale(float mat[][4], int moving, int drawflags, int combo, int colcode)
-{
- float cywid= 0.25f*0.01f*(float)U.tw_handlesize;
- float cusize= cywid*0.75f, dz;
-
- /* when called while moving in mixed mode, do not draw when... */
- if((drawflags & MAN_SCALE_C)==0) return;
-
- glDisable(GL_DEPTH_TEST);
-
- /* not in combo mode */
- if( (combo & (V3D_MANIP_TRANSLATE|V3D_MANIP_ROTATE))==0) {
- float size, unitmat[4][4];
-
- /* center circle, do not add to selection when shift is pressed (planar constraint) */
- if( (G.f & G_PICKSEL) && (G.qual & LR_SHIFTKEY)==0) glLoadName(MAN_SCALE_C);
-
- manipulator_setcolor('c', colcode);
- glPushMatrix();
- size= screen_aligned(mat);
- Mat4One(unitmat);
- drawcircball(GL_LINE_LOOP, unitmat[3], 0.2f*size, unitmat);
- glPopMatrix();
-
- dz= 1.0;
- }
- else dz= 1.0f-4.0f*cusize;
-
- if(moving) {
- float matt[4][4];
-
- Mat4CpyMat4(matt, mat); // to copy the parts outside of [3][3]
- Mat4MulMat34(matt, Trans.mat, mat);
- mymultmatrix(matt);
- glFrontFace( is_mat4_flipped(matt)?GL_CW:GL_CCW);
- }
- else {
- mymultmatrix(mat);
- glFrontFace( is_mat4_flipped(mat)?GL_CW:GL_CCW);
- }
-
- /* axis */
-
- /* in combo mode, this is always drawn as first type */
- draw_manipulator_axes(colcode, drawflags & MAN_SCALE_X, drawflags & MAN_SCALE_Y, drawflags & MAN_SCALE_Z);
-
- /* Z cube */
- glTranslatef(0.0, 0.0, dz);
- if(drawflags & MAN_SCALE_Z) {
- if(G.f & G_PICKSEL) glLoadName(MAN_SCALE_Z);
- manipulator_setcolor('z', colcode);
- drawsolidcube(cusize);
- }
- /* X cube */
- glTranslatef(dz, 0.0, -dz);
- if(drawflags & MAN_SCALE_X) {
- if(G.f & G_PICKSEL) glLoadName(MAN_SCALE_X);
- manipulator_setcolor('x', colcode);
- drawsolidcube(cusize);
- }
- /* Y cube */
- glTranslatef(-dz, dz, 0.0);
- if(drawflags & MAN_SCALE_Y) {
- if(G.f & G_PICKSEL) glLoadName(MAN_SCALE_Y);
- manipulator_setcolor('y', colcode);
- drawsolidcube(cusize);
- }
-
- /* if shiftkey, center point as last, for selectbuffer order */
- if(G.f & G_PICKSEL) {
- if(G.qual & LR_SHIFTKEY) {
- glTranslatef(0.0, -dz, 0.0);
- glLoadName(MAN_SCALE_C);
- glBegin(GL_POINTS);
- glVertex3f(0.0, 0.0, 0.0);
- glEnd();
- }
- }
-
- /* restore */
- myloadmatrix(G.vd->viewmat);
-
- if(G.vd->zbuf) glEnable(GL_DEPTH_TEST);
- glFrontFace(GL_CCW);
-}
-
-
-static void draw_cone(GLUquadricObj *qobj, float len, float width)
-{
- glTranslatef(0.0, 0.0, -0.5f*len);
- gluCylinder(qobj, width, 0.0, len, 8, 1);
- gluQuadricOrientation(qobj, GLU_INSIDE);
- gluDisk(qobj, 0.0, width, 8, 1);
- gluQuadricOrientation(qobj, GLU_OUTSIDE);
- glTranslatef(0.0, 0.0, 0.5f*len);
-}
-
-static void draw_cylinder(GLUquadricObj *qobj, float len, float width)
-{
-
- width*= 0.8f; // just for beauty
-
- glTranslatef(0.0, 0.0, -0.5f*len);
- gluCylinder(qobj, width, width, len, 8, 1);
- gluQuadricOrientation(qobj, GLU_INSIDE);
- gluDisk(qobj, 0.0, width, 8, 1);
- gluQuadricOrientation(qobj, GLU_OUTSIDE);
- glTranslatef(0.0, 0.0, len);
- gluDisk(qobj, 0.0, width, 8, 1);
- glTranslatef(0.0, 0.0, -0.5f*len);
-}
-
-
-static void draw_manipulator_translate(float mat[][4], int moving, int drawflags, int combo, int colcode)
-{
- GLUquadricObj *qobj;
- float cylen= 0.01f*(float)U.tw_handlesize;
- float cywid= 0.25f*cylen, dz, size;
- float unitmat[4][4];
-
- /* when called while moving in mixed mode, do not draw when... */
- if((drawflags & MAN_TRANS_C)==0) return;
-
- if(moving) glTranslatef(Trans.vec[0], Trans.vec[1], Trans.vec[2]);
- glDisable(GL_DEPTH_TEST);
-
- qobj= gluNewQuadric();
- gluQuadricDrawStyle(qobj, GLU_FILL);
-
- /* center circle, do not add to selection when shift is pressed (planar constraint) */
- if( (G.f & G_PICKSEL) && (G.qual & LR_SHIFTKEY)==0) glLoadName(MAN_TRANS_C);
-
- manipulator_setcolor('c', colcode);
- glPushMatrix();
- size= screen_aligned(mat);
- Mat4One(unitmat);
- drawcircball(GL_LINE_LOOP, unitmat[3], 0.2f*size, unitmat);
- glPopMatrix();
-
- /* and now apply matrix, we move to local matrix drawing */
- mymultmatrix(mat);
-
- /* axis */
- glLoadName(-1);
-
- // translate drawn as last, only axis when no combo with scale, or for ghosting
- if((combo & V3D_MANIP_SCALE)==0 || colcode==MAN_GHOST)
- draw_manipulator_axes(colcode, drawflags & MAN_TRANS_X, drawflags & MAN_TRANS_Y, drawflags & MAN_TRANS_Z);
-
-
- /* offset in combo mode, for rotate a bit more */
- if(combo & (V3D_MANIP_ROTATE)) dz= 1.0f+2.0f*cylen;
- else if(combo & (V3D_MANIP_SCALE)) dz= 1.0f+0.5f*cylen;
- else dz= 1.0f;
-
- /* Z Cone */
- glTranslatef(0.0, 0.0, dz);
- if(drawflags & MAN_TRANS_Z) {
- if(G.f & G_PICKSEL) glLoadName(MAN_TRANS_Z);
- manipulator_setcolor('z', colcode);
- draw_cone(qobj, cylen, cywid);
- }
- /* X Cone */
- glTranslatef(dz, 0.0, -dz);
- if(drawflags & MAN_TRANS_X) {
- if(G.f & G_PICKSEL) glLoadName(MAN_TRANS_X);
- glRotatef(90.0, 0.0, 1.0, 0.0);
- manipulator_setcolor('x', colcode);
- draw_cone(qobj, cylen, cywid);
- glRotatef(-90.0, 0.0, 1.0, 0.0);
- }
- /* Y Cone */
- glTranslatef(-dz, dz, 0.0);
- if(drawflags & MAN_TRANS_Y) {
- if(G.f & G_PICKSEL) glLoadName(MAN_TRANS_Y);
- glRotatef(-90.0, 1.0, 0.0, 0.0);
- manipulator_setcolor('y', colcode);
- draw_cone(qobj, cylen, cywid);
- }
-
- gluDeleteQuadric(qobj);
- myloadmatrix(G.vd->viewmat);
-
- if(G.vd->zbuf) glEnable(GL_DEPTH_TEST);
-
-}
-
-static void draw_manipulator_rotate_cyl(float mat[][4], int moving, int drawflags, int combo, int colcode)
-{
- GLUquadricObj *qobj;
- float size;
- float cylen= 0.01f*(float)U.tw_handlesize;
- float cywid= 0.25f*cylen;
-
- /* when called while moving in mixed mode, do not draw when... */
- if((drawflags & MAN_ROT_C)==0) return;
-
- /* prepare for screen aligned draw */
- glPushMatrix();
- size= screen_aligned(mat);
-
- glDisable(GL_DEPTH_TEST);
-
- qobj= gluNewQuadric();
-
- /* Screen aligned view rot circle */
- if(drawflags & MAN_ROT_V) {
- float unitmat[4][4];
- Mat4One(unitmat);
-
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_V);
- BIF_ThemeColor(TH_TRANSFORM);
- drawcircball(GL_LINE_LOOP, unitmat[3], 1.2f*size, unitmat);
-
- if(moving) {
- float vec[3];
- vec[0]= (float)(Trans.imval[0] - Trans.center2d[0]);
- vec[1]= (float)(Trans.imval[1] - Trans.center2d[1]);
- vec[2]= 0.0f;
- Normalize(vec);
- VecMulf(vec, 1.2f*size);
- glBegin(GL_LINES);
- glVertex3f(0.0, 0.0, 0.0);
- glVertex3fv(vec);
- glEnd();
- }
- }
- glPopMatrix();
-
- /* apply the transform delta */
- if(moving) {
- float matt[4][4];
- Mat4CpyMat4(matt, mat); // to copy the parts outside of [3][3]
- if (Trans.flag & T_USES_MANIPULATOR) {
- Mat4MulMat34(matt, Trans.mat, mat);
- }
- mymultmatrix(matt);
- }
- else {
- mymultmatrix(mat);
- }
-
- glFrontFace( is_mat4_flipped(mat)?GL_CW:GL_CCW);
-
- /* axis */
- if( (G.f & G_PICKSEL)==0 ) {
-
- // only draw axis when combo didn't draw scale axes
- if((combo & V3D_MANIP_SCALE)==0)
- draw_manipulator_axes(colcode, drawflags & MAN_ROT_X, drawflags & MAN_ROT_Y, drawflags & MAN_ROT_Z);
-
- /* only has to be set when not in picking */
- gluQuadricDrawStyle(qobj, GLU_FILL);
- }
-
- /* Z cyl */
- glTranslatef(0.0, 0.0, 1.0);
- if(drawflags & MAN_ROT_Z) {
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Z);
- manipulator_setcolor('z', colcode);
- draw_cylinder(qobj, cylen, cywid);
- }
- /* X cyl */
- glTranslatef(1.0, 0.0, -1.0);
- if(drawflags & MAN_ROT_X) {
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_X);
- glRotatef(90.0, 0.0, 1.0, 0.0);
- manipulator_setcolor('x', colcode);
- draw_cylinder(qobj, cylen, cywid);
- glRotatef(-90.0, 0.0, 1.0, 0.0);
- }
- /* Y cylinder */
- glTranslatef(-1.0, 1.0, 0.0);
- if(drawflags & MAN_ROT_Y) {
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Y);
- glRotatef(-90.0, 1.0, 0.0, 0.0);
- manipulator_setcolor('y', colcode);
- draw_cylinder(qobj, cylen, cywid);
- }
-
- /* restore */
-
- gluDeleteQuadric(qobj);
- myloadmatrix(G.vd->viewmat);
-
- if(G.vd->zbuf) glEnable(GL_DEPTH_TEST);
-
-}
-
-
-/* ********************************************* */
-
-float get_drawsize(View3D *v3d)
-{
- ScrArea *sa = v3d->area;
- float size, vec[3], len1, len2;
-
- /* size calculus, depending ortho/persp settings, like initgrabz() */
- size= v3d->persmat[0][3]*v3d->twmat[3][0]+ v3d->persmat[1][3]*v3d->twmat[3][1]+ v3d->persmat[2][3]*v3d->twmat[3][2]+ v3d->persmat[3][3];
-
- VECCOPY(vec, v3d->persinv[0]);
- len1= Normalize(vec);
- VECCOPY(vec, v3d->persinv[1]);
- len2= Normalize(vec);
-
- size*= 0.01f*(len1>len2?len1:len2);
-
- /* correct for window size to make widgets appear fixed size */
- if(sa->winx > sa->winy) size*= 1000.0f/(float)sa->winx;
- else size*= 1000.0f/(float)sa->winy;
-
- return size;
-}
-
-static float get_manipulator_drawsize(ScrArea *sa)
-{
- View3D *v3d= sa->spacedata.first;
- float size = get_drawsize(v3d);
-
- size*= (float)U.tw_size;
-
- return size;
-}
-
-/* exported to transform_constraints.c */
-/* mat, vec = default orientation and location */
-/* type = transform type */
-/* axis = x, y, z, c */
-/* col: 0 = colored, 1 = moving, 2 = ghost */
-void draw_manipulator_ext(ScrArea *sa, int type, char axis, int col, float vec[3], float mat[][3])
-{
- int drawflags= 0;
- float mat4[4][4];
- int colcode;
-
- Mat4CpyMat3(mat4, mat);
- VECCOPY(mat4[3], vec);
-
- Mat4MulFloat3((float *)mat4, get_manipulator_drawsize(sa));
-
- glEnable(GL_BLEND); // let's do it transparent by default
- if(col==0) colcode= MAN_RGB;
- else if(col==1) colcode= MAN_MOVECOL;
- else colcode= MAN_GHOST;
-
-
- if(type==TFM_ROTATION) {
- if(axis=='x') drawflags= MAN_ROT_X;
- else if(axis=='y') drawflags= MAN_ROT_Y;
- else if(axis=='z') drawflags= MAN_ROT_Z;
- else drawflags= MAN_ROT_C;
-
- draw_manipulator_rotate_cyl(mat4, col, drawflags, V3D_MANIP_ROTATE, colcode);
- }
- else if(type==TFM_RESIZE) {
- if(axis=='x') drawflags= MAN_SCALE_X;
- else if(axis=='y') drawflags= MAN_SCALE_Y;
- else if(axis=='z') drawflags= MAN_SCALE_Z;
- else drawflags= MAN_SCALE_C;
-
- draw_manipulator_scale(mat4, col, drawflags, V3D_MANIP_SCALE, colcode);
- }
- else {
- if(axis=='x') drawflags= MAN_TRANS_X;
- else if(axis=='y') drawflags= MAN_TRANS_Y;
- else if(axis=='z') drawflags= MAN_TRANS_Z;
- else drawflags= MAN_TRANS_C;
-
- draw_manipulator_translate(mat4, 0, drawflags, V3D_MANIP_TRANSLATE, colcode);
- }
-
-
- glDisable(GL_BLEND);
-}
-
-/* main call, does calc centers & orientation too */
-/* uses global G.moving */
-static int drawflags= 0xFFFF; // only for the calls below, belongs in scene...?
-void BIF_draw_manipulator(ScrArea *sa)
-{
- View3D *v3d= sa->spacedata.first;
- int totsel;
-
- if(!(v3d->twflag & V3D_USE_MANIPULATOR)) return;
- if(G.moving && (G.moving & G_TRANSFORM_MANIP)==0) return;
-
- if(G.moving==0) {
- v3d->twflag &= ~V3D_DRAW_MANIPULATOR;
-
- totsel= calc_manipulator_stats(sa);
- if(totsel==0) return;
- drawflags= v3d->twdrawflag; /* set in calc_manipulator_stats */
-
- v3d->twflag |= V3D_DRAW_MANIPULATOR;
-
- /* now we can define center */
- switch(v3d->around) {
- case V3D_CENTER:
- case V3D_ACTIVE:
- v3d->twmat[3][0]= (G.scene->twmin[0] + G.scene->twmax[0])/2.0f;
- v3d->twmat[3][1]= (G.scene->twmin[1] + G.scene->twmax[1])/2.0f;
- v3d->twmat[3][2]= (G.scene->twmin[2] + G.scene->twmax[2])/2.0f;
- if(v3d->around==V3D_ACTIVE && G.obedit==NULL) {
- Object *ob= OBACT;
- if(ob && !(ob->flag & OB_POSEMODE))
- VECCOPY(v3d->twmat[3], ob->obmat[3]);
- }
- break;
- case V3D_LOCAL:
- case V3D_CENTROID:
- VECCOPY(v3d->twmat[3], G.scene->twcent);
- break;
- case V3D_CURSOR:
- VECCOPY(v3d->twmat[3], give_cursor());
- break;
- }
-
- Mat4MulFloat3((float *)v3d->twmat, get_manipulator_drawsize(sa));
- }
-
- if(v3d->twflag & V3D_DRAW_MANIPULATOR) {
-
- if(v3d->twtype & V3D_MANIP_ROTATE) {
-
- /* rotate has special ghosting draw, for pie chart */
- if(G.moving) draw_manipulator_rotate_ghost(v3d->twmat, drawflags);
-
- if(G.moving) glEnable(GL_BLEND);
-
- if(G.rt==3) {
- if(G.moving) draw_manipulator_rotate_cyl(v3d->twmat, 1, drawflags, v3d->twtype, MAN_MOVECOL);
- else draw_manipulator_rotate_cyl(v3d->twmat, 0, drawflags, v3d->twtype, MAN_RGB);
- }
- else
- draw_manipulator_rotate(v3d->twmat, G.moving, drawflags, v3d->twtype);
-
- glDisable(GL_BLEND);
- }
- if(v3d->twtype & V3D_MANIP_SCALE) {
- if(G.moving) {
- glEnable(GL_BLEND);
- draw_manipulator_scale(v3d->twmat, 0, drawflags, v3d->twtype, MAN_GHOST);
- draw_manipulator_scale(v3d->twmat, 1, drawflags, v3d->twtype, MAN_MOVECOL);
- glDisable(GL_BLEND);
- }
- else draw_manipulator_scale(v3d->twmat, 0, drawflags, v3d->twtype, MAN_RGB);
- }
- if(v3d->twtype & V3D_MANIP_TRANSLATE) {
- if(G.moving) {
- glEnable(GL_BLEND);
- draw_manipulator_translate(v3d->twmat, 0, drawflags, v3d->twtype, MAN_GHOST);
- draw_manipulator_translate(v3d->twmat, 1, drawflags, v3d->twtype, MAN_MOVECOL);
- glDisable(GL_BLEND);
- }
- else draw_manipulator_translate(v3d->twmat, 0, drawflags, v3d->twtype, MAN_RGB);
- }
- }
-}
-
-static int manipulator_selectbuf(ScrArea *sa, float hotspot)
-{
- View3D *v3d= sa->spacedata.first;
- rctf rect;
- GLuint buffer[64]; // max 4 items per select, so large enuf
- short hits, mval[2];
-
- G.f |= G_PICKSEL;
-
- getmouseco_areawin(mval);
- rect.xmin= mval[0]-hotspot;
- rect.xmax= mval[0]+hotspot;
- rect.ymin= mval[1]-hotspot;
- rect.ymax= mval[1]+hotspot;
-
- /* get rid of overlay button matrix */
- persp(PERSP_VIEW);
-
- setwinmatrixview3d(sa->winx, sa->winy, &rect);
- Mat4MulMat4(v3d->persmat, v3d->viewmat, sa->winmat);
-
- glSelectBuffer( 64, buffer);
- glRenderMode(GL_SELECT);
- glInitNames(); /* these two calls whatfor? It doesnt work otherwise */
- glPushName(-2);
-
- /* do the drawing */
- if(v3d->twtype & V3D_MANIP_ROTATE) {
- if(G.rt==3) draw_manipulator_rotate_cyl(v3d->twmat, 0, MAN_ROT_C & v3d->twdrawflag, v3d->twtype, MAN_RGB);
- else draw_manipulator_rotate(v3d->twmat, 0, MAN_ROT_C & v3d->twdrawflag, v3d->twtype);
- }
- if(v3d->twtype & V3D_MANIP_SCALE)
- draw_manipulator_scale(v3d->twmat, 0, MAN_SCALE_C & v3d->twdrawflag, v3d->twtype, MAN_RGB);
- if(v3d->twtype & V3D_MANIP_TRANSLATE)
- draw_manipulator_translate(v3d->twmat, 0, MAN_TRANS_C & v3d->twdrawflag, v3d->twtype, MAN_RGB);
-
- glPopName();
- hits= glRenderMode(GL_RENDER);
-
- G.f &= ~G_PICKSEL;
- setwinmatrixview3d(sa->winx, sa->winy, NULL);
- Mat4MulMat4(v3d->persmat, v3d->viewmat, sa->winmat);
-
- persp(PERSP_WIN);
-
- if(hits==1) return buffer[3];
- else if(hits>1) {
- GLuint val, dep, mindep=0, mindeprot=0, minval=0, minvalrot=0;
- int a;
-
- /* we compare the hits in buffer, but value centers highest */
- /* we also store the rotation hits separate (because of arcs) and return hits on other widgets if there are */
-
- for(a=0; a<hits; a++) {
- dep= buffer[4*a + 1];
- val= buffer[4*a + 3];
-
- if(val==MAN_TRANS_C) return MAN_TRANS_C;
- else if(val==MAN_SCALE_C) return MAN_SCALE_C;
- else {
- if(val & MAN_ROT_C) {
- if(minvalrot==0 || dep<mindeprot) {
- mindeprot= dep;
- minvalrot= val;
- }
- }
- else {
- if(minval==0 || dep<mindep) {
- mindep= dep;
- minval= val;
- }
- }
- }
- }
-
- if(minval)
- return minval;
- else
- return minvalrot;
- }
- return 0;
-}
-
-/* return 0; nothing happened */
-int BIF_do_manipulator(ScrArea *sa)
-{
- View3D *v3d= sa->spacedata.first;
- int val;
-
- if(!(v3d->twflag & V3D_USE_MANIPULATOR)) return 0;
- if(!(v3d->twflag & V3D_DRAW_MANIPULATOR)) return 0;
-
- // find the hotspots first test narrow hotspot
- val= manipulator_selectbuf(sa, 0.5f*(float)U.tw_hotspot);
- if(val) {
- checkFirstTime(); // TEMPORARY, check this before doing any transform call.
- // drawflags still global, for drawing call above
- drawflags= manipulator_selectbuf(sa, 0.2f*(float)U.tw_hotspot);
- if(drawflags==0) drawflags= val;
-
- if (drawflags & MAN_TRANS_C) {
- initManipulator(TFM_TRANSLATION);
- switch(drawflags) {
- case MAN_TRANS_C:
- break;
- case MAN_TRANS_X:
- if(G.qual & LR_SHIFTKEY) {
- drawflags= MAN_TRANS_Y|MAN_TRANS_Z;
- BIF_setDualAxisConstraint(v3d->twmat[1], v3d->twmat[2], " Y+Z");
- }
- else
- BIF_setSingleAxisConstraint(v3d->twmat[0], " X");
- break;
- case MAN_TRANS_Y:
- if(G.qual & LR_SHIFTKEY) {
- drawflags= MAN_TRANS_X|MAN_TRANS_Z;
- BIF_setDualAxisConstraint(v3d->twmat[0], v3d->twmat[2], " X+Z");
- }
- else
- BIF_setSingleAxisConstraint(v3d->twmat[1], " Y");
- break;
- case MAN_TRANS_Z:
- if(G.qual & LR_SHIFTKEY) {
- drawflags= MAN_TRANS_X|MAN_TRANS_Y;
- BIF_setDualAxisConstraint(v3d->twmat[0], v3d->twmat[1], " X+Y");
- }
- else
- BIF_setSingleAxisConstraint(v3d->twmat[2], " Z");
- break;
- }
- ManipulatorTransform();
- }
- else if (drawflags & MAN_SCALE_C) {
- initManipulator(TFM_RESIZE);
- switch(drawflags) {
- case MAN_SCALE_X:
- if(G.qual & LR_SHIFTKEY) {
- drawflags= MAN_SCALE_Y|MAN_SCALE_Z;
- BIF_setDualAxisConstraint(v3d->twmat[1], v3d->twmat[2], " Y+Z");
- }
- else
- BIF_setSingleAxisConstraint(v3d->twmat[0], " X");
- break;
- case MAN_SCALE_Y:
- if(G.qual & LR_SHIFTKEY) {
- drawflags= MAN_SCALE_X|MAN_SCALE_Z;
- BIF_setDualAxisConstraint(v3d->twmat[0], v3d->twmat[2], " X+Z");
- }
- else
- BIF_setSingleAxisConstraint(v3d->twmat[1], " Y");
- break;
- case MAN_SCALE_Z:
- if(G.qual & LR_SHIFTKEY) {
- drawflags= MAN_SCALE_X|MAN_SCALE_Y;
- BIF_setDualAxisConstraint(v3d->twmat[0], v3d->twmat[1], " X+Y");
- }
- else
- BIF_setSingleAxisConstraint(v3d->twmat[2], " Z");
- break;
- }
- ManipulatorTransform();
- }
- else if (drawflags == MAN_ROT_T) { /* trackbal need special case, init is different */
- initManipulator(TFM_TRACKBALL);
- ManipulatorTransform();
- }
- else if (drawflags & MAN_ROT_C) {
- initManipulator(TFM_ROTATION);
- switch(drawflags) {
- case MAN_ROT_X:
- BIF_setSingleAxisConstraint(v3d->twmat[0], " X");
- break;
- case MAN_ROT_Y:
- BIF_setSingleAxisConstraint(v3d->twmat[1], " Y");
- break;
- case MAN_ROT_Z:
- BIF_setSingleAxisConstraint(v3d->twmat[2], " Z");
- break;
- }
- ManipulatorTransform();
- }
- }
- /* after transform, restore drawflags */
- drawflags= 0xFFFF;
-
- return val;
-}
-
-
diff --git a/source/blender/src/transform_numinput.c b/source/blender/src/transform_numinput.c
deleted file mode 100644
index 730d25545bd..00000000000
--- a/source/blender/src/transform_numinput.c
+++ /dev/null
@@ -1,247 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <math.h> /* fabs */
-#include <stdio.h> /* for sprintf */
-
-#include "BKE_global.h" /* for G */
-#include "BKE_utildefines.h" /* ABS */
-
-#include "mydevice.h" /* for KEY defines */
-
-#include "transform.h"
-
-/* ************************** Functions *************************** */
-
-/* ************************** NUMINPUT **************************** */
-
-void outputNumInput(NumInput *n, char *str)
-{
- char cur;
- short i, j;
-
- for (j=0; j<=n->idx_max; j++) {
- /* if AFFECTALL and no number typed and cursor not on number, use first number */
- if (n->flag & NUM_AFFECT_ALL && n->idx != j && n->ctrl[j] == 0)
- i = 0;
- else
- i = j;
-
- if (n->idx != i)
- cur = ' ';
- else
- cur = '|';
-
- if( n->val[i] > 1e10 || n->val[i] < -1e10 )
- sprintf(&str[j*20], "%.4e%c", n->val[i], cur);
- else
- switch (n->ctrl[i]) {
- case 0:
- sprintf(&str[j*20], "NONE%c", cur);
- break;
- case 1:
- case -1:
- sprintf(&str[j*20], "%.0f%c", n->val[i], cur);
- break;
- case 10:
- case -10:
- sprintf(&str[j*20], "%.f.%c", n->val[i], cur);
- break;
- case 100:
- case -100:
- sprintf(&str[j*20], "%.1f%c", n->val[i], cur);
- break;
- case 1000:
- case -1000:
- sprintf(&str[j*20], "%.2f%c", n->val[i], cur);
- break;
- case 10000:
- case -10000:
- sprintf(&str[j*20], "%.3f%c", n->val[i], cur);
- break;
- default:
- sprintf(&str[j*20], "%.4e%c", n->val[i], cur);
- }
- }
-}
-
-short hasNumInput(NumInput *n)
-{
- short i;
-
- for (i=0; i<=n->idx_max; i++) {
- if (n->ctrl[i])
- return 1;
- }
-
- return 0;
-}
-
-void applyNumInput(NumInput *n, float *vec)
-{
- short i, j;
- float val[3];
-
- if (hasNumInput(n)) {
- convertDisplayNumToVec(n->val, val);
-
- for (j=0; j<=n->idx_max; j++) {
- /* if AFFECTALL and no number typed and cursor not on number, use first number */
- if (n->flag & NUM_AFFECT_ALL && n->idx != j && n->ctrl[j] == 0)
- i = 0;
- else
- i = j;
-
- if (n->ctrl[i] == 0 && n->flag & NUM_NULL_ONE) {
- vec[j] = 1.0f;
- }
- else if (val[i] == 0.0f && n->flag & NUM_NO_ZERO) {
- vec[j] = 0.0001f;
- }
- else {
- vec[j] = val[i];
- }
- }
- }
-}
-
-char handleNumInput(NumInput *n, unsigned short event)
-{
- float Val = 0;
- short idx = n->idx, idx_max = n->idx_max;
-
- switch (event) {
- case BACKSPACEKEY:
- if (n->ctrl[idx] == 0) {
- n->val[0] =
- n->val[1] =
- n->val[2] = 0.0f;
- n->ctrl[0] =
- n->ctrl[1] =
- n->ctrl[2] = 0;
- }
- else {
- n->val[idx] = 0.0f;
- n->ctrl[idx] = 0;
- }
- break;
- case PERIODKEY:
- case PADPERIOD:
- if (n->flag & NUM_NO_FRACTION)
- break;
-
- switch (n->ctrl[idx])
- {
- case 0:
- case 1:
- n->ctrl[idx] = 10;
- break;
- case -1:
- n->ctrl[idx] = -10;
- }
- break;
- case PADMINUS:
- if(G.qual & LR_ALTKEY)
- break;
- case MINUSKEY:
- if (n->flag & NUM_NO_NEGATIVE)
- break;
-
- if (n->ctrl[idx]) {
- n->ctrl[idx] *= -1;
- n->val[idx] *= -1;
- }
- else
- n->ctrl[idx] = -1;
- break;
- case TABKEY:
- idx++;
- if (idx > idx_max)
- idx = 0;
- n->idx = idx;
- break;
- case PAD9:
- case NINEKEY:
- Val += 1.0f;
- case PAD8:
- case EIGHTKEY:
- Val += 1.0f;
- case PAD7:
- case SEVENKEY:
- Val += 1.0f;
- case PAD6:
- case SIXKEY:
- Val += 1.0f;
- case PAD5:
- case FIVEKEY:
- Val += 1.0f;
- case PAD4:
- case FOURKEY:
- Val += 1.0f;
- case PAD3:
- case THREEKEY:
- Val += 1.0f;
- case PAD2:
- case TWOKEY:
- Val += 1.0f;
- case PAD1:
- case ONEKEY:
- Val += 1.0f;
- case PAD0:
- case ZEROKEY:
- if (!n->ctrl[idx])
- n->ctrl[idx] = 1;
-
- if (fabs(n->val[idx]) > 9999999.0f);
- else if (n->ctrl[idx] == 1) {
- n->val[idx] *= 10;
- n->val[idx] += Val;
- }
- else if (n->ctrl[idx] == -1) {
- n->val[idx] *= 10;
- n->val[idx] -= Val;
- }
- else {
- /* float resolution breaks when over six digits after comma */
- if( ABS(n->ctrl[idx]) < 10000000) {
- n->val[idx] += Val / (float)n->ctrl[idx];
- n->ctrl[idx] *= 10;
- }
- }
- break;
- default:
- return 0;
- }
-
- /* REDRAW SINCE NUMBERS HAVE CHANGED */
- return 1;
-}
diff --git a/source/blender/src/transform_snap.c b/source/blender/src/transform_snap.c
deleted file mode 100644
index 355c150657e..00000000000
--- a/source/blender/src/transform_snap.c
+++ /dev/null
@@ -1,712 +0,0 @@
-/**
- * $Id:
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Martin Poirier
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <math.h>
-#include <stdio.h>
-
-#include "PIL_time.h"
-
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_meshdata_types.h" // Temporary, for snapping to other unselected meshes
-#include "DNA_space_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_view3d_types.h"
-
-#include "BLI_arithb.h"
-#include "BLI_editVert.h"
-
-#include "BDR_drawobject.h"
-
-#include "editmesh.h"
-#include "BIF_editsima.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-#include "BIF_mywindow.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_editsima.h"
-#include "BIF_drawimage.h"
-
-#include "BKE_global.h"
-#include "BKE_utildefines.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_object.h"
-
-#include "BSE_view.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "transform.h"
-#include "mydevice.h" /* for KEY defines */
-#include "blendef.h" /* for selection modes */
-
-/********************* PROTOTYPES ***********************/
-
-void setSnappingCallback(TransInfo *t);
-
-void ApplySnapTranslation(TransInfo *t, float vec[3]);
-void ApplySnapRotation(TransInfo *t, float *vec);
-
-void CalcSnapGrid(TransInfo *t, float *vec);
-void CalcSnapGeometry(TransInfo *t, float *vec);
-
-void TargetSnapMedian(TransInfo *t);
-void TargetSnapCenter(TransInfo *t);
-void TargetSnapClosest(TransInfo *t);
-
-float RotationBetween(TransInfo *t, float p1[3], float p2[3]);
-float TranslationBetween(TransInfo *t, float p1[3], float p2[3]);
-
-// Trickery
-int findNearestVertFromObjects(int *dist, float *loc);
-
-/****************** IMPLEMENTATIONS *********************/
-
-void drawSnapping(TransInfo *t)
-{
- if ((t->tsnap.status & (SNAP_ON|POINT_INIT|TARGET_INIT)) == (SNAP_ON|POINT_INIT|TARGET_INIT) &&
- (G.qual & LR_CTRLKEY)) {
-
- char col[4];
- BIF_GetThemeColor3ubv(TH_TRANSFORM, col);
- glColor4ub(col[0], col[1], col[2], 128);
-
- if (t->spacetype==SPACE_VIEW3D) {
- float unitmat[4][4];
- float size;
-
- glDisable(GL_DEPTH_TEST);
-
- size = get_drawsize(G.vd);
-
- size *= 0.5f * BIF_GetThemeValuef(TH_VERTEX_SIZE);
-
- glPushMatrix();
-
- glTranslatef(t->tsnap.snapPoint[0], t->tsnap.snapPoint[1], t->tsnap.snapPoint[2]);
-
- /* sets view screen aligned */
- glRotatef( -360.0f*saacos(G.vd->viewquat[0])/(float)M_PI, G.vd->viewquat[1], G.vd->viewquat[2], G.vd->viewquat[3]);
-
- Mat4One(unitmat);
- drawcircball(GL_LINE_LOOP, unitmat[3], size, unitmat);
-
- glPopMatrix();
-
- if(G.vd->zbuf) glEnable(GL_DEPTH_TEST);
- } else if (t->spacetype==SPACE_IMAGE) {
- /*This will not draw, and Im nor sure why - campbell */
-
- /*
- float xuser_asp, yuser_asp;
- int wi, hi;
- float w, h;
-
- calc_image_view(G.sima, 'f'); // float
- myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax);
- glLoadIdentity();
-
- aspect_sima(G.sima, &xuser_asp, &yuser_asp);
-
- transform_width_height_tface_uv(&wi, &hi);
- w = (((float)wi)/256.0f)*G.sima->zoom * xuser_asp;
- h = (((float)hi)/256.0f)*G.sima->zoom * yuser_asp;
-
- cpack(0xFFFFFF);
- glTranslatef(t->tsnap.snapPoint[0], t->tsnap.snapPoint[1], 0.0f);
-
- //glRectf(0,0,1,1);
-
- setlinestyle(0);
- cpack(0x0);
- fdrawline(-0.020/w, 0, -0.1/w, 0);
- fdrawline(0.1/w, 0, .020/w, 0);
- fdrawline(0, -0.020/h, 0, -0.1/h);
- fdrawline(0, 0.1/h, 0, 0.020/h);
-
- glTranslatef(-t->tsnap.snapPoint[0], -t->tsnap.snapPoint[1], 0.0f);
- setlinestyle(0);
- */
-
- }
- }
-}
-
-int handleSnapping(TransInfo *t, int event)
-{
- int status = 0;
-
- // Put keyhandling code here
-
- return status;
-}
-
-void applySnapping(TransInfo *t, float *vec)
-{
- if ((t->tsnap.status & SNAP_ON) &&
- (G.qual & LR_CTRLKEY))
- {
- double current = PIL_check_seconds_timer();
-
- // Time base quirky code to go around findnearest slowness
- if (current - t->tsnap.last >= 0.25)
- {
- t->tsnap.calcSnap(t, vec);
- t->tsnap.targetSnap(t);
-
- t->tsnap.last = current;
- }
- if ((t->tsnap.status & (POINT_INIT|TARGET_INIT)) == (POINT_INIT|TARGET_INIT))
- {
- t->tsnap.applySnap(t, vec);
- }
- }
-}
-
-void resetSnapping(TransInfo *t)
-{
- t->tsnap.status = 0;
- t->tsnap.modePoint = 0;
- t->tsnap.modeTarget = 0;
- t->tsnap.last = 0;
- t->tsnap.applySnap = NULL;
-}
-
-void initSnapping(TransInfo *t)
-{
- resetSnapping(t);
-
- if (t->spacetype == SPACE_VIEW3D || t->spacetype == SPACE_IMAGE) { // Only 3D view or UV
- setSnappingCallback(t);
-
- if (t->tsnap.applySnap != NULL && // A snapping function actually exist
- (G.obedit != NULL && G.obedit->type==OB_MESH) && // Temporary limited to edit mode meshes
- (G.scene->snap_flag & SCE_SNAP) && // Only if the snap flag is on
- (t->flag & T_PROP_EDIT) == 0) // No PET, obviously
- {
- t->tsnap.status |= SNAP_ON;
- t->tsnap.modePoint = SNAP_GEO;
- }
- else
- {
- /* Grid if snap is not possible */
- t->tsnap.modePoint = SNAP_GRID;
- }
- }
- else
- {
- /* Always grid outside of 3D view */
- t->tsnap.modePoint = SNAP_GRID;
- }
-}
-
-void setSnappingCallback(TransInfo *t)
-{
- t->tsnap.calcSnap = CalcSnapGeometry;
-
- switch(G.scene->snap_target)
- {
- case SCE_SNAP_TARGET_CLOSEST:
- t->tsnap.modeTarget = SNAP_CLOSEST;
- t->tsnap.targetSnap = TargetSnapClosest;
- break;
- case SCE_SNAP_TARGET_CENTER:
- t->tsnap.modeTarget = SNAP_CENTER;
- t->tsnap.targetSnap = TargetSnapCenter;
- break;
- case SCE_SNAP_TARGET_MEDIAN:
- t->tsnap.modeTarget = SNAP_MEDIAN;
- t->tsnap.targetSnap = TargetSnapMedian;
- break;
- }
-
- switch (t->mode)
- {
- case TFM_TRANSLATION:
- t->tsnap.applySnap = ApplySnapTranslation;
- t->tsnap.distance = TranslationBetween;
- break;
- case TFM_ROTATION:
- t->tsnap.applySnap = ApplySnapRotation;
- t->tsnap.distance = RotationBetween;
-
- // Can't do TARGET_CENTER with rotation, use TARGET_MEDIAN instead
- if (G.scene->snap_target == SCE_SNAP_TARGET_CENTER) {
- t->tsnap.modeTarget = SNAP_MEDIAN;
- t->tsnap.targetSnap = TargetSnapMedian;
- }
- break;
- default:
- t->tsnap.applySnap = NULL;
- break;
- }
-}
-
-/********************** APPLY **************************/
-
-void ApplySnapTranslation(TransInfo *t, float vec[3])
-{
- VecSubf(vec, t->tsnap.snapPoint, t->tsnap.snapTarget);
-}
-
-void ApplySnapRotation(TransInfo *t, float *vec)
-{
- if (t->tsnap.modeTarget == SNAP_CLOSEST) {
- *vec = t->tsnap.dist;
- }
- else {
- *vec = RotationBetween(t, t->tsnap.snapTarget, t->tsnap.snapPoint);
- }
-}
-
-
-/********************** DISTANCE **************************/
-
-float TranslationBetween(TransInfo *t, float p1[3], float p2[3])
-{
- return VecLenf(p1, p2);
-}
-
-float RotationBetween(TransInfo *t, float p1[3], float p2[3])
-{
- float angle, start[3], end[3], center[3];
-
- VECCOPY(center, t->center);
- if(t->flag & (T_EDIT|T_POSE)) {
- Object *ob= G.obedit?G.obedit:t->poseobj;
- Mat4MulVecfl(ob->obmat, center);
- }
-
- VecSubf(start, p1, center);
- VecSubf(end, p2, center);
-
- // Angle around a constraint axis (error prone, will need debug)
- if (t->con.applyRot != NULL && (t->con.mode & CON_APPLY)) {
- float axis[3], tmp[3];
-
- t->con.applyRot(t, NULL, axis);
-
- Projf(tmp, end, axis);
- VecSubf(end, end, tmp);
-
- Projf(tmp, start, axis);
- VecSubf(start, start, tmp);
-
- Normalize(end);
- Normalize(start);
-
- Crossf(tmp, start, end);
-
- if (Inpf(tmp, axis) < 0.0)
- angle = -acos(Inpf(start, end));
- else
- angle = acos(Inpf(start, end));
- }
- else {
- float mtx[3][3];
-
- Mat3CpyMat4(mtx, t->viewmat);
-
- Mat3MulVecfl(mtx, end);
- Mat3MulVecfl(mtx, start);
-
- angle = atan2(start[1],start[0]) - atan2(end[1],end[0]);
- }
-
- if (angle > M_PI) {
- angle = angle - 2 * M_PI;
- }
- else if (angle < -(M_PI)) {
- angle = 2 * M_PI + angle;
- }
-
- return angle;
-}
-
-/********************** CALC **************************/
-
-void CalcSnapGrid(TransInfo *t, float *vec)
-{
- snapGridAction(t, t->tsnap.snapPoint, BIG_GEARS);
-}
-
-void CalcSnapGeometry(TransInfo *t, float *vec)
-{
- if (G.obedit != NULL && G.obedit->type==OB_MESH)
- {
- /*if (G.scene->selectmode & B_SEL_VERT)*/
-
- if (t->spacetype == SPACE_VIEW3D)
- {
- EditVert *nearest=NULL;
- float vec[3];
- int found = 0;
- int dist = 40; // Use a user defined value here
-
- // use findnearestverts in vert mode, others in other modes
- nearest = findnearestvert(&dist, SELECT, 1);
-
- found = findNearestVertFromObjects(&dist, vec);
- if (found == 1)
- {
- VECCOPY(t->tsnap.snapPoint, vec);
-
- t->tsnap.status |= POINT_INIT;
- }
- /* If there's no outside vertex nearer, but there's one in this mesh
- */
- else if (nearest != NULL)
- {
- VECCOPY(t->tsnap.snapPoint, nearest->co);
- Mat4MulVecfl(G.obedit->obmat, t->tsnap.snapPoint);
-
- t->tsnap.status |= POINT_INIT;
- }
- else
- {
- t->tsnap.status &= ~POINT_INIT;
- }
- }
- else if (t->spacetype == SPACE_IMAGE)
- { /* same as above but for UV's */
- MTFace *nearesttf=NULL;
- int face_corner;
-
- find_nearest_uv(&nearesttf, NULL, NULL, &face_corner);
-
- if (nearesttf != NULL)
- {
- VECCOPY2D(t->tsnap.snapPoint, nearesttf->uv[face_corner]);
- //Mat4MulVecfl(G.obedit->obmat, t->tsnap.snapPoint);
-
- t->tsnap.status |= POINT_INIT;
- }
- else
- {
- t->tsnap.status &= ~POINT_INIT;
- }
- }
-
-
- /*
- if (G.scene->selectmode & B_SEL_EDGE)
- {
- EditEdge *nearest=NULL;
- int dist = 50; // Use a user defined value here
-
- // use findnearestverts in vert mode, others in other modes
- nearest = findnearestedge(&dist);
-
- if (nearest != NULL)
- {
- VecAddf(t->tsnap.snapPoint, nearest->v1->co, nearest->v2->co);
-
- VecMulf(t->tsnap.snapPoint, 0.5f);
-
- Mat4MulVecfl(G.obedit->obmat, t->tsnap.snapPoint);
-
- t->tsnap.status |= POINT_INIT;
- }
- else
- {
- t->tsnap.status &= ~POINT_INIT;
- }
- }
- */
- }
-}
-
-/********************** TARGET **************************/
-
-void TargetSnapCenter(TransInfo *t)
-{
- // Only need to calculate once
- if ((t->tsnap.status & TARGET_INIT) == 0)
- {
- VECCOPY(t->tsnap.snapTarget, t->center);
- if(t->flag & (T_EDIT|T_POSE)) {
- Object *ob= G.obedit?G.obedit:t->poseobj;
- Mat4MulVecfl(ob->obmat, t->tsnap.snapTarget);
- }
-
- t->tsnap.status |= TARGET_INIT;
- }
-}
-
-void TargetSnapMedian(TransInfo *t)
-{
- // Only need to calculate once
- if ((t->tsnap.status & TARGET_INIT) == 0)
- {
- TransData *td = NULL;
- int i;
-
- t->tsnap.snapTarget[0] = 0;
- t->tsnap.snapTarget[1] = 0;
- t->tsnap.snapTarget[2] = 0;
-
- for(td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++)
- {
- VecAddf(t->tsnap.snapTarget, t->tsnap.snapTarget, td->iloc);
- }
-
- VecMulf(t->tsnap.snapTarget, 1.0 / t->total);
-
- if(t->flag & (T_EDIT|T_POSE)) {
- Object *ob= G.obedit?G.obedit:t->poseobj;
- Mat4MulVecfl(ob->obmat, t->tsnap.snapTarget);
- }
-
- t->tsnap.status |= TARGET_INIT;
- }
-}
-
-void TargetSnapClosest(TransInfo *t)
-{
- // Only valid if a snap point has been selected
- if (t->tsnap.status & POINT_INIT)
- {
- TransData *closest = NULL, *td = NULL;
-
- // Base case, only one selected item
- if (t->total == 1)
- {
- VECCOPY(t->tsnap.snapTarget, t->data[0].iloc);
-
- if(t->flag & (T_EDIT|T_POSE)) {
- Object *ob= G.obedit?G.obedit:t->poseobj;
- Mat4MulVecfl(ob->obmat, t->tsnap.snapTarget);
- }
-
- t->tsnap.dist = t->tsnap.distance(t, t->tsnap.snapTarget, t->tsnap.snapPoint);
- }
- // More than one selected item
- else
- {
- int i;
- for(td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++)
- {
- float loc[3];
- float dist;
-
- VECCOPY(loc, td->iloc);
-
- if(t->flag & (T_EDIT|T_POSE)) {
- Object *ob= G.obedit?G.obedit:t->poseobj;
- Mat4MulVecfl(ob->obmat, loc);
- }
-
- dist = t->tsnap.distance(t, loc, t->tsnap.snapPoint);
-
- if (closest == NULL || fabs(dist) < fabs(t->tsnap.dist))
- {
- VECCOPY(t->tsnap.snapTarget, loc);
- closest = td;
- t->tsnap.dist = dist;
- }
- }
- }
-
- t->tsnap.status |= TARGET_INIT;
- }
-}
-/*================================================================*/
-
-int findNearestVertFromObjects(int *dist, float *loc) {
- Base *base;
- int retval = 0;
- short mval[2];
-
- getmouseco_areawin(mval);
-
- base= FIRSTBASE;
- for ( base = FIRSTBASE; base != NULL; base = base->next ) {
- if ( TESTBASE(base) && base != BASACT ) {
- Object *ob = base->object;
-
- if (ob->type == OB_MESH) {
- Mesh *me = ob->data;
-
- if (me->totvert > 0) {
- int test = 1;
- int i;
-
- /* If number of vert is more than an arbitrary limit,
- * test against boundbox first
- * */
- if (me->totvert > 16) {
- struct BoundBox *bb = object_get_boundbox(ob);
-
- int minx = 0, miny = 0, maxx = 0, maxy = 0;
- int i;
-
- for (i = 0; i < 8; i++) {
- float gloc[3];
- int sloc[2];
-
- VECCOPY(gloc, bb->vec[i]);
- Mat4MulVecfl(ob->obmat, gloc);
- project_int(gloc, sloc);
-
- if (i == 0) {
- minx = maxx = sloc[0];
- miny = maxy = sloc[1];
- }
- else {
- if (minx > sloc[0]) minx = sloc[0];
- else if (maxx < sloc[0]) maxx = sloc[0];
-
- if (miny > sloc[1]) miny = sloc[1];
- else if (maxy < sloc[1]) maxy = sloc[1];
- }
- }
-
- /* Pad with distance */
-
- minx -= *dist;
- miny -= *dist;
- maxx += *dist;
- maxy += *dist;
-
- if (mval[0] > maxx || mval[0] < minx ||
- mval[1] > maxy || mval[1] < miny) {
-
- test = 0;
- }
- }
-
- if (test == 1) {
- float *verts = mesh_get_mapped_verts_nors(ob);
-
- if (verts != NULL) {
- float *fp;
-
- fp = verts;
- for( i = 0; i < me->totvert; i++, fp += 6) {
- float gloc[3];
- int sloc[2];
- int curdist;
-
- VECCOPY(gloc, fp);
- Mat4MulVecfl(ob->obmat, gloc);
- project_int(gloc, sloc);
-
- sloc[0] -= mval[0];
- sloc[1] -= mval[1];
-
- curdist = abs(sloc[0]) + abs(sloc[1]);
-
- if (curdist < *dist) {
- *dist = curdist;
- retval = 1;
- VECCOPY(loc, gloc);
- }
- }
- }
-
- MEM_freeN(verts);
- }
- }
- }
- }
- }
-
- return retval;
-}
-
-/*================================================================*/
-
-static void applyGrid(TransInfo *t, float *val, int max_index, float fac[3], GearsType action);
-
-
-void snapGridAction(TransInfo *t, float *val, GearsType action) {
- float fac[3];
-
- fac[NO_GEARS] = t->snap[0];
- fac[BIG_GEARS] = t->snap[1];
- fac[SMALL_GEARS] = t->snap[2];
-
- applyGrid(t, val, t->idx_max, fac, action);
-}
-
-
-void snapGrid(TransInfo *t, float *val) {
- int invert;
- GearsType action;
-
- // Only do something if using Snap to Grid
- if (t->tsnap.modePoint != SNAP_GRID)
- return;
-
- if(t->mode==TFM_ROTATION || t->mode==TFM_WARP || t->mode==TFM_TILT || t->mode==TFM_TRACKBALL || t->mode==TFM_BONE_ROLL)
- invert = U.flag & USER_AUTOROTGRID;
- else if(t->mode==TFM_RESIZE || t->mode==TFM_SHEAR || t->mode==TFM_BONESIZE || t->mode==TFM_SHRINKFATTEN || t->mode==TFM_CURVE_SHRINKFATTEN)
- invert = U.flag & USER_AUTOSIZEGRID;
- else
- invert = U.flag & USER_AUTOGRABGRID;
-
- if(invert) {
- action = (G.qual & LR_CTRLKEY) ? NO_GEARS: BIG_GEARS;
- }
- else {
- action = (G.qual & LR_CTRLKEY) ? BIG_GEARS : NO_GEARS;
- }
-
- if (action == BIG_GEARS && (G.qual & LR_SHIFTKEY)) {
- action = SMALL_GEARS;
- }
-
- snapGridAction(t, val, action);
-}
-
-
-static void applyGrid(TransInfo *t, float *val, int max_index, float fac[3], GearsType action)
-{
- int i;
- float asp[3] = {1.0f, 1.0f, 1.0f}; // TODO: Remove hard coded limit here (3)
-
- // Early bailing out if no need to snap
- if (fac[action] == 0.0)
- return;
-
- /* evil hack - snapping needs to be adapted for image aspect ratio */
- if((t->spacetype==SPACE_IMAGE) && (t->mode==TFM_TRANSLATION)) {
- transform_aspect_ratio_tface_uv(asp, asp+1);
- }
-
- for (i=0; i<=max_index; i++) {
- val[i]= fac[action]*asp[i]*(float)floor(val[i]/(fac[action]*asp[i]) +.5);
- }
-}
diff --git a/source/blender/src/unwrapper.c b/source/blender/src/unwrapper.c
deleted file mode 100644
index 5cf5f3dc70b..00000000000
--- a/source/blender/src/unwrapper.c
+++ /dev/null
@@ -1,480 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <string.h>
-#include <stdlib.h>
-#include <math.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-
-#include "BKE_global.h"
-#include "BKE_mesh.h"
-#include "BKE_utildefines.h"
-#include "BKE_customdata.h"
-
-#include "BLI_arithb.h"
-#include "BLI_edgehash.h"
-#include "BLI_editVert.h"
-
-#include "BIF_editsima.h"
-#include "BIF_space.h"
-#include "BIF_screen.h"
-#include "BIF_editmesh.h"
-
-#include "blendef.h"
-#include "mydevice.h"
-
-#include "BDR_unwrapper.h"
-
-#include "PIL_time.h"
-
-#include "parametrizer.h"
-
-/* Set tface seams based on edge data, uses hash table to find seam edges. */
-
-static void hash_add_face(EdgeHash *ehash, MFace *mf)
-{
- BLI_edgehash_insert(ehash, mf->v1, mf->v2, NULL);
- BLI_edgehash_insert(ehash, mf->v2, mf->v3, NULL);
- if(mf->v4) {
- BLI_edgehash_insert(ehash, mf->v3, mf->v4, NULL);
- BLI_edgehash_insert(ehash, mf->v4, mf->v1, NULL);
- }
- else
- BLI_edgehash_insert(ehash, mf->v3, mf->v1, NULL);
-}
-
-void select_linked_tfaces_with_seams(int mode, Mesh *me, unsigned int index)
-{
- MFace *mf;
- int a, doit=1, mark=0;
- char *linkflag;
- EdgeHash *ehash, *seamhash;
- MEdge *med;
-
- ehash= BLI_edgehash_new();
- seamhash = BLI_edgehash_new();
- linkflag= MEM_callocN(sizeof(char)*me->totface, "linkflaguv");
-
- for(med=me->medge, a=0; a < me->totedge; a++, med++)
- if(med->flag & ME_SEAM)
- BLI_edgehash_insert(seamhash, med->v1, med->v2, NULL);
-
- if (mode==0 || mode==1) {
- /* only put face under cursor in array */
- mf= ((MFace*)me->mface) + index;
- hash_add_face(ehash, mf);
- linkflag[index]= 1;
- }
- else {
- /* fill array by selection */
- mf= me->mface;
- for(a=0; a<me->totface; a++, mf++) {
- if(mf->flag & ME_HIDE);
- else if(mf->flag & ME_FACE_SEL) {
- hash_add_face(ehash, mf);
- linkflag[a]= 1;
- }
- }
- }
-
- while(doit) {
- doit= 0;
-
- /* expand selection */
- mf= me->mface;
- for(a=0; a<me->totface; a++, mf++) {
- if(mf->flag & ME_HIDE)
- continue;
-
- if(!linkflag[a]) {
- mark= 0;
-
- if(!BLI_edgehash_haskey(seamhash, mf->v1, mf->v2))
- if(BLI_edgehash_haskey(ehash, mf->v1, mf->v2))
- mark= 1;
- if(!BLI_edgehash_haskey(seamhash, mf->v2, mf->v3))
- if(BLI_edgehash_haskey(ehash, mf->v2, mf->v3))
- mark= 1;
- if(mf->v4) {
- if(!BLI_edgehash_haskey(seamhash, mf->v3, mf->v4))
- if(BLI_edgehash_haskey(ehash, mf->v3, mf->v4))
- mark= 1;
- if(!BLI_edgehash_haskey(seamhash, mf->v4, mf->v1))
- if(BLI_edgehash_haskey(ehash, mf->v4, mf->v1))
- mark= 1;
- }
- else if(!BLI_edgehash_haskey(seamhash, mf->v3, mf->v1))
- if(BLI_edgehash_haskey(ehash, mf->v3, mf->v1))
- mark = 1;
-
- if(mark) {
- linkflag[a]= 1;
- hash_add_face(ehash, mf);
- doit= 1;
- }
- }
- }
-
- }
-
- BLI_edgehash_free(ehash, NULL);
- BLI_edgehash_free(seamhash, NULL);
-
- if(mode==0 || mode==2) {
- for(a=0, mf=me->mface; a<me->totface; a++, mf++)
- if(linkflag[a])
- mf->flag |= ME_FACE_SEL;
- else
- mf->flag &= ~ME_FACE_SEL;
- }
- else if(mode==1) {
- for(a=0, mf=me->mface; a<me->totface; a++, mf++)
- if(linkflag[a] && (mf->flag & ME_FACE_SEL))
- break;
-
- if (a<me->totface) {
- for(a=0, mf=me->mface; a<me->totface; a++, mf++)
- if(linkflag[a])
- mf->flag &= ~ME_FACE_SEL;
- }
- else {
- for(a=0, mf=me->mface; a<me->totface; a++, mf++)
- if(linkflag[a])
- mf->flag |= ME_FACE_SEL;
- }
- }
-
- MEM_freeN(linkflag);
-
- BIF_undo_push("Select linked UV face");
- object_tface_flags_changed(OBACT, 0);
-}
-
-/* Parametrizer */
-ParamHandle *construct_param_handle(EditMesh *em, short implicit, short fill, short sel)
-{
- int a;
- MTFace *tf;
-
- EditFace *efa;
- EditEdge *eed;
- EditVert *ev;
-
- ParamHandle *handle;
-
- handle = param_construct_begin();
-
- /* we need the vert indicies */
- for (ev= em->verts.first, a=0; ev; ev= ev->next, a++)
- ev->tmp.l = a;
-
- for (efa= em->faces.first; efa; efa= efa->next) {
- ParamKey key, vkeys[4];
- ParamBool pin[4], select[4];
- float *co[4];
- float *uv[4];
- int nverts;
-
- if ((efa->h) || (sel && (efa->f & SELECT)==0))
- continue;
-
- tf= (MTFace *)CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-
- if (implicit &&
- !( simaUVSel_Check(efa, tf, 0) ||
- simaUVSel_Check(efa, tf, 1) ||
- simaUVSel_Check(efa, tf, 2) ||
- (efa->v4 && simaUVSel_Check(efa, tf, 3)) )
- ) {
- continue;
- }
-
- key = (ParamKey)efa;
- vkeys[0] = (ParamKey)efa->v1->tmp.l;
- vkeys[1] = (ParamKey)efa->v2->tmp.l;
- vkeys[2] = (ParamKey)efa->v3->tmp.l;
-
- co[0] = efa->v1->co;
- co[1] = efa->v2->co;
- co[2] = efa->v3->co;
-
- uv[0] = tf->uv[0];
- uv[1] = tf->uv[1];
- uv[2] = tf->uv[2];
-
- pin[0] = ((tf->unwrap & TF_PIN1) != 0);
- pin[1] = ((tf->unwrap & TF_PIN2) != 0);
- pin[2] = ((tf->unwrap & TF_PIN3) != 0);
-
- select[0] = ((simaUVSel_Check(efa, tf, 0)) != 0);
- select[1] = ((simaUVSel_Check(efa, tf, 1)) != 0);
- select[2] = ((simaUVSel_Check(efa, tf, 2)) != 0);
-
- if (efa->v4) {
- vkeys[3] = (ParamKey)efa->v4->tmp.l;
- co[3] = efa->v4->co;
- uv[3] = tf->uv[3];
- pin[3] = ((tf->unwrap & TF_PIN4) != 0);
- select[3] = (simaUVSel_Check(efa, tf, 3) != 0);
- nverts = 4;
- }
- else
- nverts = 3;
-
- param_face_add(handle, key, nverts, vkeys, co, uv, pin, select);
- }
-
- if (!implicit) {
- for (eed= em->edges.first; eed; eed= eed->next) {
- if(eed->seam) {
- ParamKey vkeys[2];
- vkeys[0] = (ParamKey)eed->v1->tmp.l;
- vkeys[1] = (ParamKey)eed->v2->tmp.l;
- param_edge_set_seam(handle, vkeys);
- }
- }
- }
-
- param_construct_end(handle, fill, implicit);
-
- return handle;
-}
-
-
-extern int EM_texFaceCheck(void);
-
-void unwrap_lscm(short seamcut)
-{
- EditMesh *em = G.editMesh;
- ParamHandle *handle;
- short abf = G.scene->toolsettings->unwrapper == 1;
- short fillholes = G.scene->toolsettings->uvcalc_flag & 1;
-
- /* add uvs if there not here */
- if (!EM_texFaceCheck()) {
- if (em && em->faces.first)
- EM_add_data_layer(&em->fdata, CD_MTFACE);
-
- if (!EM_texFaceCheck())
- return;
-
- /* select new UV's */
- if ((G.sima==0 || G.sima->flag & SI_SYNC_UVSEL)==0) {
- EditFace *efa;
- MTFace *tf;
- for(efa=em->faces.first; efa; efa=efa->next) {
- tf= (MTFace *)CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- simaFaceSel_Set(efa, tf);
- }
- }
- }
-
- handle = construct_param_handle(em, 0, fillholes, seamcut == 0);
-
- param_lscm_begin(handle, PARAM_FALSE, abf);
- param_lscm_solve(handle);
- param_lscm_end(handle);
-
- param_pack(handle);
-
- param_flush(handle);
-
- param_delete(handle);
-
- if (!seamcut)
- BIF_undo_push("UV unwrap");
-
- object_uvs_changed(OBACT);
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIMAGE, 0);
-}
-
-void minimize_stretch_tface_uv(void)
-{
- EditMesh *em = G.editMesh;
- ParamHandle *handle;
- double lasttime;
- short doit = 1, escape = 0, val, blend = 0;
- unsigned short event = 0;
- short fillholes = G.scene->toolsettings->uvcalc_flag & 1;
-
- if(!EM_texFaceCheck()) return;
-
- handle = construct_param_handle(em, 1, fillholes, 1);
-
- lasttime = PIL_check_seconds_timer();
-
- param_stretch_begin(handle);
-
- while (doit) {
- param_stretch_iter(handle);
-
- while (qtest()) {
- event= extern_qread(&val);
-
- if (val) {
- switch (event) {
- case ESCKEY:
- escape = 1;
- case RETKEY:
- case PADENTER:
- doit = 0;
- break;
- case PADPLUSKEY:
- case WHEELUPMOUSE:
- if (blend < 10) {
- blend++;
- param_stretch_blend(handle, blend*0.1f);
- param_flush(handle);
- lasttime = 0.0f;
- }
- break;
- case PADMINUS:
- case WHEELDOWNMOUSE:
- if (blend > 0) {
- blend--;
- param_stretch_blend(handle, blend*0.1f);
- param_flush(handle);
- lasttime = 0.0f;
- }
- break;
- }
- }
- else if ((event == LEFTMOUSE) || (event == RIGHTMOUSE)) {
- escape = (event == RIGHTMOUSE);
- doit = 0;
- }
- }
-
- if (!doit)
- break;
-
- if (PIL_check_seconds_timer() - lasttime > 0.5) {
- char str[100];
-
- param_flush(handle);
-
- sprintf(str, "Stretch minimize. Blend %.2f.", blend*0.1f);
- headerprint(str);
-
- lasttime = PIL_check_seconds_timer();
- object_uvs_changed(OBACT);
- if(G.sima->lock) force_draw_plus(SPACE_VIEW3D, 0);
- else force_draw(0);
- }
- }
-
- if (escape)
- param_flush_restore(handle);
- else
- param_flush(handle);
-
- param_stretch_end(handle);
-
- param_delete(handle);
-
- BIF_undo_push("UV stretch minimize");
-
- object_uvs_changed(OBACT);
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIMAGE, 0);
-}
-
-void pack_charts_tface_uv(void)
-{
- EditMesh *em = G.editMesh;
- ParamHandle *handle;
-
- if(!EM_texFaceCheck()) return;
-
- handle = construct_param_handle(em, 1, 0, 1);
- param_pack(handle);
- param_flush(handle);
- param_delete(handle);
-
- BIF_undo_push("UV pack charts");
-
- object_uvs_changed(OBACT);
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIMAGE, 0);
-}
-
-/* LSCM live mode */
-
-static ParamHandle *liveHandle = NULL;
-
-void unwrap_lscm_live_begin(void)
-{
- EditMesh *em = G.editMesh;
- short abf = G.scene->toolsettings->unwrapper == 1;
- short fillholes = G.scene->toolsettings->uvcalc_flag & 1;
-
- if(!EM_texFaceCheck()) return;
-
- liveHandle = construct_param_handle(em, 0, fillholes, 1);
-
- param_lscm_begin(liveHandle, PARAM_TRUE, abf);
-}
-
-void unwrap_lscm_live_re_solve(void)
-{
- if (liveHandle) {
- param_lscm_solve(liveHandle);
- param_flush(liveHandle);
- }
-}
-
-void unwrap_lscm_live_end(short cancel)
-{
- if (liveHandle) {
- param_lscm_end(liveHandle);
- if (cancel)
- param_flush_restore(liveHandle);
- param_delete(liveHandle);
- liveHandle = NULL;
- }
-}
-
diff --git a/source/blender/src/verse_common.c b/source/blender/src/verse_common.c
deleted file mode 100644
index d91c09dc2cd..00000000000
--- a/source/blender/src/verse_common.c
+++ /dev/null
@@ -1,298 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Contributor(s): Jiri Hnidek.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#ifdef WITH_VERSE
-
-#include <string.h>
-#include <stdlib.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "mydevice.h"
-
-#include "DNA_object_types.h"
-#include "DNA_mesh_types.h"
-
-#include "BKE_global.h"
-#include "BKE_blender.h"
-
-#include "BIF_verse.h"
-#include "BIF_space.h"
-#include "BIF_interface.h"
-
-extern ListBase session_list;
-extern ListBase server_list;
-
-/*
- * this function creates popup menu with all active VerseSessions
- * it return pointer at selected VerseSession, if no VerseSession
- * is selected, then NULL is returned
- */
-VerseSession *session_menu(void)
-{
- struct VerseSession *session;
- char session_number[10];
- short i=1, num=1;
- char session_address_list[1024]; /* pupmenu business */
-
- session_number[0] = '\0';
- session_address_list[0] = '\0';
-
- strcat(session_address_list, "Session list %t");
-
- session = session_list.first;
-
- while(session){
- strcat(session_address_list, "| ");
- strcat(session_address_list, session->address);
- strcat(session_address_list, " %x");
- sprintf(session_number, "%d", num);
- strcat(session_address_list, session_number);
- num++;
- session = session->next;
- }
-
- printf("session list: %s\n", session_address_list);
- num = pupmenu(session_address_list);
-
- if(num==-1) return NULL;
-
- session = session_list.first;
-
- while(session) {
- if(i==num) return session;
- i++;
- session = session->next;
- }
-
- return NULL;
-}
-
-/*
- * returns name of verse client (it is used as avatar's name)
- */
-char *verse_client_name(void)
-{
- char *client_name;
- char blender_version[5];
- short name_lenght = 14;
-
-#ifndef WIN32
- char *hostname;
- hostname = getenv("HOSTNAME");
- if(hostname) name_lenght += strlen(hostname);
-#endif
-
- client_name = (char*)MEM_mallocN(sizeof(char)*name_lenght, "verse client name");
- client_name[0] = '\0';
-
- strcat(client_name, "blender_");
- blender_version[0] = '\0';
- sprintf(blender_version, "%d", BLENDER_VERSION);
- strcat(client_name, blender_version);
-
-#ifndef WIN32
- /* add at the end of the client name hostname */
- if(hostname) {
- strcat(client_name, ":");
- strcat(client_name, hostname);
- }
-#endif
-
- return client_name;
-}
-
-/*===========================================================
- *
- * functions executed after calling callback functions
- *
- ============================================================*/
-
-/*
- * this function is called, when some tag was changed or new tag was created
- */
-void post_tag_change(VTag *vtag)
-{
- printf("\tnew tag %s was created or changed\n", vtag->name);
-}
-
-/*
- * this function is called, when verse taggroup was created
- */
-void post_taggroup_create(VTagGroup *vtaggroup)
-{
- printf("\tnew taggroup %s was created\n", vtaggroup->name);
-}
-
-/*
- * this function is called after creating of new VerseNode
- */
-void post_node_create(VNode *vnode)
-{
- struct VerseSession *session = vnode->session;
-
- if((session->flag & VERSE_AUTOSUBSCRIBE) && (vnode->owner_id != VN_OWNER_MINE)) {
- if(vnode->type == V_NT_OBJECT) {
- create_object_from_verse_node(vnode);
- }
- else if(vnode->type == V_NT_GEOMETRY) {
- create_mesh_from_geom_node(vnode);;
- }
- }
-
- allqueue(REDRAWOOPS, 0);
-}
-
-/*
- * this function is called after destroying of VerseNode
- */
-void post_node_destroy(VNode *vnode)
-{
- allqueue(REDRAWOOPS, 0);
-
- /* TODO: destroy bindings between vnode and blender data structures */
-}
-
-/*
- * this function is calles after renaming of VerseNode by verse_server
- */
-void post_node_name_set(VNode *vnode)
-{
- /* if VerseNode has coresponding blender data structure, then
- * change ID name of data structure */
- if(vnode->type==V_NT_OBJECT) {
- struct Object *ob;
- ob = (Object*)((VObjectData*)vnode->data)->object;
- if(ob) {
- char *str;
- str = (char*)malloc(sizeof(char)*(strlen(vnode->name)+3));
- str[0] = '\0';
- strcat(str, "OB");
- strcat(str, vnode->name);
- strncpy(ob->id.name, str, 23);
- printf("\tob->id.name: %s\n", ob->id.name);
- free(str);
- }
- }
- else if(vnode->type==V_NT_GEOMETRY) {
- struct Mesh *me;
-
- me = (Mesh*)((VGeomData*)vnode->data)->mesh;
- if(me) {
- char *str;
- str = (char*)malloc(sizeof(char)*(strlen(vnode->name)+3));
- str[0] = '\0';
- strcat(str, "ME");
- strcat(str, vnode->name);
- strncpy(me->id.name, str, 23);
- printf("\tme->id.name: %s\n", me->id.name);
- free(str);
- }
- }
-
- allqueue(REDRAWALL, 0);
-}
-
-/*
- * this function is called after acception connection with verse server
- */
-void post_connect_accept(VerseSession *session)
-{
- VerseServer *server;
-
- G.f |= G_VERSE_CONNECTED;
-
- session->counter = 0;
-
- server = server_list.first;
- while(server) {
- if(strcmp(server->ip, session->address)==0) {
- server->flag = session->flag;
- break;
- }
- server = server->next;
- }
-
- allqueue(REDRAWOOPS, 0);
-}
-
-void post_server_add(void)
-{
- allqueue(REDRAWOOPS, 0);
-}
-
-/*
- * this function is called, when connestion with verse server is ended/terminated/etc.
- */
-void post_connect_terminated(VerseSession *session)
-{
- VerseServer *server;
- server = server_list.first;
- while(server) {
- if(strcmp(server->ip, session->address)==0) {
- server->flag = 0;
- server->session=NULL;
- break;
- }
- server = server->next;
- }
-
- /* if it is last session, then no other will exist ... set Global flag */
- if((session->prev==NULL) && (session->next==NULL))
- G.f &= ~G_VERSE_CONNECTED;
-
- allqueue(REDRAWOOPS, 0);
-}
-
-/*
- * if connection wasn't accepted, then free VerseSession
- * and print warning message with popupmenu
- */
-void post_connect_update(VerseSession *session)
-{
- if(session->flag & VERSE_CONNECTING) {
- session->counter++;
- if(session->counter > MAX_UNCONNECTED_EVENTS) {
- char *str;
- /* popup menu*/
- str = malloc(sizeof(char)*(strlen(session->address)+35));
- str[0]='\0';
- strcat(str, "Error%t|No response from server: ");
- strcat(str, session->address);
- pupmenu(str);
- free(str);
-
- session->flag = 0;
- session->counter = 0;
- session->post_connect_terminated(session);
- free_verse_session(session);
- }
- }
-}
-
-#endif
-
diff --git a/source/blender/src/verse_image.c b/source/blender/src/verse_image.c
deleted file mode 100644
index 9e9b478980e..00000000000
--- a/source/blender/src/verse_image.c
+++ /dev/null
@@ -1,343 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Contributor(s): Jiri Hnidek.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#ifdef WITH_VERSE
-
-#include <string.h>
-
-#include "mydevice.h"
-
-#include "BKE_verse.h"
-#include "BKE_image.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_image_types.h"
-
-#include "IMB_imbuf_types.h"
-#include "IMB_imbuf.h"
-
-#include "BDR_drawmesh.h"
-
-#include "BIF_verse.h"
-#include "BIF_space.h"
-
-/*
- * unsubscribe from verse bitmap
- */
-void unsubscribe_from_bitmap_node(VNode *vnode)
-{
- if(vnode->type != V_NT_BITMAP) return;
-
- /* TODO */
-}
-
-/*
- * upload image to verse server
- */
-void push_image_to_verse_server(VerseSession *session, Image *image)
-{
- ImBuf *ibuf= BKE_image_get_ibuf(image, NULL);
- struct VNode *vnode;
-
- if(!session) return;
-
- if(!(session->flag & VERSE_CONNECTED)) return;
-
- /* create "my" new object VerseNode */
- vnode= create_verse_node(session, -1 , V_NT_BITMAP, VN_OWNER_MINE);
- /* create object data */
- vnode->data = create_bitmap_data();
-
- /* set up name of VerseNode */
- vnode->name = (char*)MEM_mallocN(sizeof(char*)*(strlen(image->id.name)-1), "object node name");
- vnode->name[0] = '\0';
- strcat(vnode->name, image->id.name+2);
-
- /* set up dimension of image */
- if(ibuf) {
- ((VBitmapData*)vnode->data)->width = ibuf->x;
- ((VBitmapData*)vnode->data)->height = ibuf->y;
- }
- else {
- ((VBitmapData*)vnode->data)->width = 0;
- ((VBitmapData*)vnode->data)->height = 0;
- }
- ((VBitmapData*)(vnode->data))->height = 1;
-
- /* set up pointers between Object and VerseNode */
- ((VBitmapData*)vnode->data)->image = (void*)image;
- image->vnode = (void*)vnode;
-
- /* add node to sending queue */
- add_item_to_send_queue(&(session->queue), vnode, VERSE_NODE);
-}
-
-/*
- * synchronize blender image channel (R,G,B,A) with verse bitmap layer
- */
-void sync_blender_image_channel_with_verse_layer(VNode *vnode, VBitmapLayer *vblayer)
-{
- struct Image *image = (Image*)((VBitmapData*)(vnode->data))->image;
- struct ImBuf *ibuf= BKE_image_get_ibuf(image, NULL);
- unsigned char *rect;
- int x, y, height, t_width, i, channel=0;
-
- if(!image) return;
-
- if(!ibuf) return;
-
- rect = (unsigned char*)ibuf->rect;
-
- /* select channel due to verse layer name */
- if(strcmp(vblayer->name,"col_r")==0)
- channel = 0;
- else if(strcmp(vblayer->name,"col_g")==0)
- channel = 1;
- else if(strcmp(vblayer->name, "col_b")==0)
- channel = 2;
- else if(strcmp(vblayer->name,"alpha")==0)
- channel = 3;
-
-#ifdef VERSE_DEBUG_PRINT
- printf(" %s:%d\n", vblayer->name, channel);
-#endif
-
- height = ((VBitmapData*)(vnode->data))->height;
- t_width = ((VBitmapData*)(vnode->data))->t_width;
-
- i = (height-1)*t_width;
-
-#ifdef VERSE_DEBUG_PRINT
- printf("\ti:%d\n", i);
-#endif
-
- if(vblayer->type==VN_B_LAYER_UINT8) {
- unsigned char *vuint8 = (unsigned char*)vblayer->data;
- for(y=height-1; y>=0; y--, i=y*t_width)
- for(x=0; x<ibuf->x; x++, rect+=4, i++)
- rect[channel] = (char)vuint8[i];
- }
-
- allqueue(REDRAWIMAGE, 0);
- allqueue(REDRAWVIEW3D, 0);
-}
-
-/*
- * synchronize blender image with verse image
- */
-void sync_blender_image_with_verse_bitmap_node(VNode *vnode)
-{
- struct VBitmapLayer *vblayer;
-
- vblayer = ((VBitmapData*)(vnode->data))->layers.lb.first;
-
- while(vblayer) {
-#ifdef VERSE_DEBUG_PRINT
- printf("\tsyncing layer:");
-#endif
- sync_blender_image_channel_with_verse_layer(vnode, vblayer);
- vblayer = vblayer->next;
- }
-}
-
-/*
- * This function is called, when some other verse client change dimension of image.
- * It is neccesary to reallocate blender image too, when dimension of verse image
- * is different from blender image.
- */
-void post_bitmap_dimension_set(VNode *vnode)
-{
- struct Image *image = (Image*)((VBitmapData*)(vnode->data))->image;
- struct ImBuf *ibuf= BKE_image_get_ibuf(image, NULL);
-
- if(!image) return;
-
- if(!ibuf) return;
-
- if(vnode->owner_id == VN_OWNER_MINE) {
- if( ((VBitmapData*)vnode->data)->layers.lb.first == NULL ) {
- /* send all verse bitmap layers (RGBA) to verse server */
- printf("\tsending all bitmap layers to verse server\n");
- verse_send_b_layer_create(vnode->id, -1, "col_r", VN_B_LAYER_UINT8);
- verse_send_b_layer_create(vnode->id, -1, "col_g", VN_B_LAYER_UINT8);
- verse_send_b_layer_create(vnode->id, -1, "col_b", VN_B_LAYER_UINT8);
- verse_send_b_layer_create(vnode->id, -1, "alpha", VN_B_LAYER_UINT8);
-
- return;
- }
- }
-
- if((ibuf->x!=((VBitmapData*)vnode->data)->width) || (ibuf->y!=((VBitmapData*)vnode->data)->height)) {
- struct VBitmapLayer *vblayer;
- struct ImBuf *new_ibuf;
-
- /* allocate new ibuf */
- new_ibuf= IMB_allocImBuf(((VBitmapData*)vnode->data)->width,
- ((VBitmapData*)vnode->data)->height, 24, IB_rect, 0);
- /* free old ibuf */
- BKE_image_signal(image, NULL, IMA_SIGNAL_FREE);
- /* set up pointer at new ibuf */
- BKE_image_assign_ibuf(image, ibuf);
-
- /* sync blender image with all verse layers */
- vblayer = ((VBitmapData*)(vnode->data))->layers.lb.first;
- while(vblayer) {
- sync_blender_image_channel_with_verse_layer(vnode, vblayer);
- vblayer = vblayer->next;
- }
- }
-}
-
-/*
- * when blender tries to upload image to verse server, then it is neccessary
- * to push coresponding channel data to verse server, when verse bitmap layer
- * was created
- */
-void post_bitmap_layer_create(VBitmapLayer *vblayer)
-{
- struct VNode *vnode = vblayer->vnode;
- struct Image *image = (Image*)((VBitmapData*)(vnode->data))->image;
- struct ImBuf *ibuf= BKE_image_get_ibuf(image, NULL);
- unsigned char *rect;
- short channel;
-/* VNBTile tile[VN_B_TILE_SIZE*VN_B_TILE_SIZE];
- unsigned int width, t_width, height, t_height, x, y, i, j; */
-
- /* if this application doesn't try to upload this image to verse
- * server then do nothing */
- if(vnode->owner_id != VN_OWNER_MINE) return;
-
- if(!image) return;
-
- if(!ibuf) return;
-
- rect = (unsigned char*)ibuf->rect;
-
- if(strncmp(vblayer->name, "col_r", 5))
- channel = 0;
- else if(strncmp(vblayer->name, "col_g", 5))
- channel = 1;
- else if(strncmp(vblayer->name, "col_b", 5))
- channel = 2;
- else if(strncmp(vblayer->name, "alpha", 5))
- channel = 3;
-
- /* TODO: send all data of channel to verse server */
-}
-
-/*
- * dummy function now
- */
-void post_bitmap_layer_destroy(VBitmapLayer *vblayer)
-{
-}
-
-/*
- * this function is executed, when some image changed tile comes from verse server,
- * it is neccessary to do some crazy transformation here, because blender uses
- * different (very unstandard) image coordinate system (begining of coordinate
- * system is in bottom left corner) ... all other programs (including verse) has
- * begining of image coordinate system in left top corner
- */
-void post_bitmap_tile_set(VBitmapLayer *vblayer, unsigned int xs, unsigned int ys)
-{
- struct VNode *vnode = vblayer->vnode;
- struct Image *image = (Image*)((VBitmapData*)(vnode->data))->image;
- struct ImBuf *ibuf= BKE_image_get_ibuf(image, NULL);
- unsigned char *rect, *i_rect;
- unsigned int x, y, t_width, t_height, height, m_ys, m_y, d, i, j, channel=0;
-
- if(!image) return;
-
- if(!ibuf) return;
-
- /* select channel due to verse layer name */
- if(strcmp(vblayer->name,"color_r")==0)
- channel = 0;
- else if(strcmp(vblayer->name,"color_g")==0)
- channel = 1;
- else if(strcmp(vblayer->name, "color_b")==0)
- channel = 2;
- else if(strcmp(vblayer->name,"transparency")==0)
- channel = 3;
-
- i_rect = rect = (unsigned char*)ibuf->rect;
-
- /* width of verse image including all tiles */
- t_width =((VBitmapData*)vnode->data)->t_width;
- /* height of verse image including all tiles */
- t_height =((VBitmapData*)vnode->data)->t_height;
- /* height of blender image */
- height = ((VBitmapData*)vnode->data)->height;
-
- /* if the bitmap's dimensions are not integer multiples of the tile
- * side length, eight, then d will not be zero (height of "uncomplete
- * tile") */
- d = VN_B_TILE_SIZE - (t_height - height);
- /* mirrored coordination of received tile */
- m_ys = t_height - ys - VN_B_TILE_SIZE;
-
- /* ys and m_ys are y axis, where we will do some changes */
- if(ys + VN_B_TILE_SIZE > height) {
- m_ys = 0;
- ys = ys + d - 1;
- }
- else {
- m_ys = m_ys - VN_B_TILE_SIZE + d;
- ys = ys + VN_B_TILE_SIZE - 1;
- }
-
- /* "index" of blender image */
- j = m_ys*ibuf->x + xs;
- /* index of verse image */
- i = ys*t_width + xs;
-
- /* pointer at image data, that will be changed in following loop */
- rect = i_rect + 4*j;
-
- /* it seems hackish, but I didn't find better solution :-/ */
- if(vblayer->type==VN_B_LAYER_UINT8) {
- unsigned char *vuint8 = (unsigned char*)vblayer->data;
- for(y=ys, m_y = m_ys;
- (m_y<m_ys+VN_B_TILE_SIZE) && (m_y<ibuf->y);
- y--, m_y++, i=y*t_width+xs, j=m_y*ibuf->x+xs, rect=i_rect+4*j)
- for(x=xs; (x<xs+VN_B_TILE_SIZE) && (x<ibuf->x); x++, rect+=4, i++, j++)
- rect[channel] = (char)vuint8[i];
- }
-
- free_realtime_image(image);
-
- /* redraw preview of image ... uncommented, because rendering
- * was computed too often */
-/* BIF_preview_changed(ID_TE); */
- allqueue(REDRAWIMAGE, 0);
- allqueue(REDRAWVIEW3D, 0);
-}
-
-#endif
-
diff --git a/source/blender/src/verse_mesh.c b/source/blender/src/verse_mesh.c
deleted file mode 100644
index 2257eac41f5..00000000000
--- a/source/blender/src/verse_mesh.c
+++ /dev/null
@@ -1,1629 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Contributor(s): Jiri Hnidek.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#ifdef WITH_VERSE
-
-#include <string.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "mydevice.h"
-
-#include "DNA_object_types.h"
-#include "DNA_mesh_types.h"
-
-#include "BLI_dynamiclist.h"
-#include "BLI_blenlib.h"
-#include "BLI_edgehash.h"
-#include "BLI_editVert.h"
-
-#include "BKE_customdata.h"
-#include "BKE_depsgraph.h"
-#include "BKE_global.h"
-#include "BKE_mesh.h"
-#include "BKE_utildefines.h"
-#include "BKE_verse.h"
-
-#include "BIF_verse.h"
-#include "BIF_editmesh.h"
-#include "BIF_space.h"
-#include "BIF_screen.h"
-
-#include "BSE_edit.h"
-
-#include "editmesh.h"
-
-#include "verse.h"
-
-/* prototypes of static functions */
-
-static void mark_changed_face_obsolete(struct VerseFace *vface);
-static void sync_verseface_with_editface(struct VLayer *vlayer, struct VerseFace *vface);
-
-void createVerseVertNL(struct EditVert *ev, struct VNode *vnode, struct VLayer *vlayer);
-static void createAllVerseVerts(struct VNode *vnode, struct VLayer *vlayer);
-void createVerseFaceNL(struct EditFace *efa, struct VNode *vnode, struct VLayer *vlayer);
-static void createAllVerseFaces(struct VNode *vnode, struct VLayer *vlayer);
-
-/*=============================================================================
- *
- * functions handling verse/blender FACES
- *
- *===========================================================================*/
-
-/*
- * create new VerseFace (polygon), due to information about EditFace
- * put VerseFace to queue ... send to verse host (server)
- */
-void createVerseFace(EditFace *efa)
-{
- if(G.editMesh->vnode) {
- struct VLayer *vlayer = find_verse_layer_type((VGeomData*)((VNode*)G.editMesh->vnode)->data, POLYGON_LAYER);
- createVerseFaceNL(efa, (VNode*)G.editMesh->vnode, vlayer);
- }
- else efa->vface = NULL;
-}
-
-/*
- * create new VerseFace (polygon), due to information about EditFace
- * put VerseFace to queue ... send to verse host (server)
- * NL version of function (infomration about verse node and
- * layer is known ... optimalisation)
- */
-void createVerseFaceNL(EditFace *efa, VNode *vnode, VLayer *vlayer)
-{
- struct VerseFace *vface;
-
- vface = (VerseFace*)create_verse_face(vlayer, vlayer->counter, -1, -1, -1, -1);
-
- vface->face = (void*)efa;
- efa->vface = (void*)vface;
-
- vface->flag |= FACE_SEND_READY;
-
- /* EditVert #1 */
- if(efa->v1) {
- if(efa->v1->vvert) {
- vface->vvert0 = (VerseVert*)efa->v1->vvert;
- if(((VerseVert*)efa->v1->vvert)->flag & VERT_RECEIVED) {
- vface->v0 = ((VerseVert*)efa->v1->vvert)->id;
- vface->counter--;
- }
- else
- vface->flag &= ~FACE_SEND_READY;
- }
- }
- else
- vface->counter--;
-
- /* EditVert #2 */
- if(efa->v2) {
- if(efa->v2->vvert) {
- vface->vvert1 = (VerseVert*)efa->v2->vvert;
- if(((VerseVert*)efa->v2->vvert)->flag & VERT_RECEIVED) {
- vface->v1 = ((VerseVert*)efa->v2->vvert)->id;
- vface->counter--;
- }
- else
- vface->flag &= ~FACE_SEND_READY;
- }
- }
- else
- vface->counter--;
- /* EditVert #3 */
- if(efa->v3) {
- if(efa->v3->vvert) {
- vface->vvert2 = (VerseVert*)efa->v3->vvert;
- if(((VerseVert*)efa->v3->vvert)->flag & VERT_RECEIVED) {
- vface->v2 = ((VerseVert*)efa->v3->vvert)->id;
- vface->counter--;
- }
- else
- vface->flag &= ~FACE_SEND_READY;
- }
- }
- else
- vface->counter--;
- /* EditVert #4 */
- if(efa->v4) {
- if(efa->v4->vvert) {
- vface->vvert3 = (VerseVert*)efa->v4->vvert;
- if(((VerseVert*)efa->v4->vvert)->flag & VERT_RECEIVED) {
- vface->v3 = ((VerseVert*)efa->v4->vvert)->id;
- vface->counter--;
- }
- else
- vface->flag &= ~FACE_SEND_READY;
- }
- }
- else
- vface->counter--;
-
- add_item_to_send_queue(&(vlayer->queue), (void*)vface, VERSE_FACE);
-}
-
-/*
- * creates new verse faces, add all of then to queue ... send to verse server
- */
-static void createAllVerseFaces(VNode *vnode, VLayer *vlayer)
-{
- if(G.obedit) {
- struct EditMesh *em;
- struct EditFace *efa;
-
- em = G.editMesh;
-
- efa = em->faces.first;
- /* push all EditFaces to the verse server */
- while(efa){
- createVerseFaceNL(efa, vnode, vlayer);
- efa = efa->next;
- }
- }
-}
-
-/*
- * When verse face is changed during sending/receiving from verse server, then
- * this verse face is marked as obsolete and it will be send again, when it
- * will be received from verse server
- */
-static void mark_changed_face_obsolete(VerseFace *vface)
-{
- struct EditFace *efa = (EditFace*)vface->face;
-
- if(efa) {
- if(vface->vvert0->vertex != efa->v1) vface->flag |= FACE_OBSOLETE;
- if(vface->vvert1->vertex != efa->v2) vface->flag |= FACE_OBSOLETE;
- if(vface->vvert2->vertex != efa->v3) vface->flag |= FACE_OBSOLETE;
- if(vface->vvert3 && (vface->vvert3->vertex != efa->v4)) vface->flag |= FACE_OBSOLETE;
- }
-}
-
-/*
- * this function will sync EditFace and VerseFace and it will send changes to
- * verse server too
- */
-static void sync_verseface_with_editface(VLayer *vlayer, VerseFace *vface)
-{
- struct EditFace *efa = (EditFace*)vface->face;
- int dosend = 0;
-
- /* edit face and probably verse face was deleted */
- if(!efa || (vface->flag & FACE_DELETED)) return;
-
- /* blender nor verse don't support such crazy things */
- if(!(vface->vvert0) || !(vface->vvert1) || !(vface->vvert2)) {
- printf("\tERROR: vface->vvert0: %p, vface->vvert1: %p, vface->vvert2: %p\n", vface->vvert0, vface->vvert1, vface->vvert2);
- return;
- }
-
- /* initialize verse face flag */
- vface->flag |= FACE_SEND_READY;
-
- /* debug print */
-#if 0
- printf("\n");
- if(efa->v4) {
- printf("\tefa->v1,v2,v3,v4->vvert->id: %d, %d, %d, %d\n",
- ((VerseVert*)efa->v1->vvert)->id,
- ((VerseVert*)efa->v2->vvert)->id,
- ((VerseVert*)efa->v3->vvert)->id,
- ((VerseVert*)efa->v4->vvert)->id);
- printf("\tefa->v1,v2,v3,v4->vvert: %p, %p, %p, %p\n",
- efa->v1->vvert,
- efa->v2->vvert,
- efa->v3->vvert,
- efa->v4->vvert);
- }
- else {
- printf("\tefa->v1,v2,v3->vvert->id: %d, %d, %d, NULL\n",
- ((VerseVert*)efa->v1->vvert)->id,
- ((VerseVert*)efa->v2->vvert)->id,
- ((VerseVert*)efa->v3->vvert)->id);
- printf("\tefa->v1,v2,v3,v4->vvert: %p, %p, %p, NULL\n",
- efa->v1->vvert,
- efa->v2->vvert,
- efa->v3->vvert);
- }
- printf("\tvface->vvert0, vvvert1, vvvert2, vvvert3: %p, %p, %p, %p\n",
- vface->vvert0,
- vface->vvert1,
- vface->vvert2,
- vface->vvert3);
-
- printf("\tefa->v1, v2, v3, v4: %p, %p, %p, %p\n",
- efa->v1,
- efa->v2,
- efa->v3,
- efa->v4);
- if(vface->vvert3) {
- printf("\tvface->v0,v1,v2,v3: %d, %d, %d, %d\n",
- vface->v0,
- vface->v1,
- vface->v2,
- vface->v3);
- printf("\tvface->vvert0,vvvert1,vvvert2,vvvert3->vertex: %p, %p, %p, %p\n",
- vface->vvert0->vertex,
- vface->vvert1->vertex,
- vface->vvert2->vertex,
- vface->vvert3->vertex);
- }
- else {
- printf("\tvface->v0,v1,v2,v3: %d, %d, %d, NULL\n",
- vface->v0,
- vface->v1,
- vface->v2);
- printf("\tvface->vvert0,vvvert1,vvvert2->vertex: %p, %p, %p, NULL\n",
- vface->vvert0->vertex,
- vface->vvert1->vertex,
- vface->vvert2->vertex);
- }
-#endif
-
- /* initialize counter of unreceived vertexes */
- vface->counter = 4;
-
- /* 1st vertex */
- if(vface->vvert0->vertex != efa->v1) {
- dosend = 1;
- vface->vvert0->counter--;
- vface->vvert0 = (VerseVert*)efa->v1->vvert;
- vface->v0 = vface->vvert0->id;
- if(vface->vvert0->flag & VERT_RECEIVED)
- vface->counter--;
- else
- vface->flag &= ~FACE_SEND_READY;
- }
- else
- vface->counter--;
-
- /* 2nd vertex */
- if(vface->vvert1->vertex != efa->v2) {
- dosend = 1;
- vface->vvert1->counter--;
- vface->vvert1 = (VerseVert*)efa->v2->vvert;
- vface->v1 = vface->vvert1->id;
- if(vface->vvert1->flag & VERT_RECEIVED)
- vface->counter--;
- else
- vface->flag &= ~FACE_SEND_READY;
- }
- else
- vface->counter--;
-
- /* 3th vertex */
- if(vface->vvert2->vertex != efa->v3) {
- dosend = 1;
- vface->vvert2->counter--;
- vface->vvert2 = (VerseVert*)efa->v3->vvert;
- vface->v2 = vface->vvert2->id;
- if(vface->vvert2->flag & VERT_RECEIVED)
- vface->counter--;
- else
- vface->flag &= ~FACE_SEND_READY;
- }
- else
- vface->counter--;
-
- /* 4th vertex */
- if(vface->vvert3 && ((vface->vvert3->vertex != efa->v4) || (vface->vvert3 && !efa->v4) || (vface->v3 != vface->vvert3->id))) {
- dosend = 1;
- if(efa->v4) {
- vface->vvert3->counter--;
- vface->vvert3 = (VerseVert*)efa->v4->vvert;
- vface->v3 = vface->vvert3->id;
- if(vface->vvert3->flag & VERT_RECEIVED)
- vface->counter--;
- else
- vface->flag &= ~FACE_SEND_READY;
- }
- else {
- vface->vvert3->counter--;
- vface->vvert3 = NULL;
- vface->v3 = -1;
- vface->counter--;
- }
- }
- /* verse face has 4 vertexes now, not 3 vertexes as in past */
- else if(!(vface->vvert3) && efa->v4) {
- dosend = 1;
- vface->vvert3 = (VerseVert*)efa->v4->vvert;
- vface->v3 = vface->vvert3->id;
- if(vface->vvert3->flag & VERT_RECEIVED)
- vface->counter--;
- else
- vface->flag &= ~FACE_SEND_READY;
- }
- else
- vface->counter--;
-
- if(dosend) {
- /* printf("\tsending CHANGED FACE\n");
- printf("\t\tnew: %d %d %d %d\n", vface->v0, vface->v1, vface->v2, vface->v3);*/
- vface->flag |= FACE_CHANGED;
- /* remove verse face from list of received faces */
- BLI_dlist_rem_item(&(vlayer->dl), vface->id);
- /* and add verse face again to sending queue */
- add_item_to_send_queue(&(vlayer->queue), (void*)vface, VERSE_FACE);
- }
-}
-
-/*
- * this function will sync all VerseFaces with coresponding EditFaces,
- * this is useful, when some editmesh tool has changed editface pointers at
- * vertexes (edges), parameter of this function is geometry node
- */
-void sync_all_versefaces_with_editfaces(VNode *vnode)
-{
- struct VLayer *vlayer;
- struct VerseFace *vface, *nvface;
-
- if(vnode->type != V_NT_GEOMETRY) return;
-
- vlayer = find_verse_layer_type((VGeomData*)vnode->data, POLYGON_LAYER);
-
- /* mark changed verse faces in sending queue as obsolete at the first time */
- vface = vlayer->queue.first;
- while(vface) {
- mark_changed_face_obsolete(vface);
- vface = vface->next;
- }
-
- /* send all received and changed verse face again to verse server */
- vface = vlayer->dl.lb.first;
- while(vface) {
- nvface = vface->next;
- sync_verseface_with_editface(vlayer, vface);
- vface = nvface;
- }
-}
-
-/*
- * send delete polygon command to verse server
- */
-void b_verse_send_face_delete(EditFace *efa)
-{
- ((VerseFace*)efa->vface)->face = NULL;
- send_verse_face_delete((VerseFace*)efa->vface);
- efa->vface = NULL;
-}
-
-/*=============================================================================
- *
- * functions handling verse/blender VERTEXES
- *
- *===========================================================================*/
-
-/*
- * this function will sync position of all VerseVerts with EditVerts
- * this function is called after actions: Smooth, Noise and To Sphere,
- * because position of vertexes isn't managed by transform system
- */
-void sync_all_verseverts_with_editverts(VNode *vnode)
-{
- struct VLayer *vlayer;
- struct VerseVert *vvert;
-
- if(vnode->type != V_NT_GEOMETRY) return;
-
- vlayer = find_verse_layer_type((VGeomData*)vnode->data, VERTEX_LAYER);
-
- vvert = vlayer->dl.lb.first;
-
- /* sync all received vertexes */
- while(vvert) {
- send_versevert_pos(vvert);
- vvert = vvert->next;
- }
-
- vvert = vlayer->queue.first;
-
- /* sync all unreceived vertexes (mar pos as obsolete, when
- * actual position was changed) */
- while(vvert) {
- send_versevert_pos(vvert);
- vvert = vvert->next;
- }
-
- verse_callback_update(0);
-}
-
-/*
- * send delete vertex command to verse server
- */
-void b_verse_send_vertex_delete(EditVert *eve)
-{
- ((VerseVert*)eve->vvert)->vertex = NULL;
- send_verse_vertex_delete((VerseVert*)eve->vvert);
- eve->vvert = NULL;
-}
-
-/*
- * send position of verse vertex to verse server
- */
-void send_versevert_pos(VerseVert *vvert)
-{
- /* delete command was sent to verse server ... sending one
- * more position command would create new vertex */
- if ((vvert->flag & VERT_DELETED) | (vvert->flag & VERT_OBSOLETE)) return;
-
- /* don't send position of verse vertex to verse server, because it could create
- * new vertex */
- if(vvert->flag & VERT_RECEIVED) {
- if(vvert->flag & VERT_LOCKED) {
- /* when position of verse vert was sent to verse server
- * and it wasn't received yet, then mark sent position
- * as obsolete ... blender will automaticaly send actual
- * position, when old will be received */
- vvert->flag |= VERT_POS_OBSOLETE;
- }
- else {
- struct EditVert *eve = (EditVert*)vvert->vertex;
- /* send position to verse server, when it is different from actual position */
- if(eve && (eve->co[0]!=vvert->co[0] || eve->co[1]!=vvert->co[1] || eve->co[2]!=vvert->co[2])) {
- /* lock vertex and send its position to verse server,
- * locking of vertex prevents from sending too many
- * informations about vertex position during draging
- * of vertex */
- vvert->flag |= VERT_LOCKED;
- VECCOPY(vvert->co, eve->co);
- send_verse_vertex(vvert);
- }
- }
- }
- else {
- /* we created this vertex and we sent new position to verse server, but "confirmation" command about
- * position of vertex didn't arrived yet, then we can't send new position of vertex ... we only mark
- * position of vertex as obsolete and new position will be sent to verse server, when confirmation
- * command will arive */
- struct EditVert *eve = (EditVert*)vvert->vertex;
- if(eve && (eve->co[0]!=vvert->co[0] || eve->co[1]!=vvert->co[1] || eve->co[2]!=vvert->co[2])) {
- vvert->flag |= VERT_POS_OBSOLETE;
- }
- }
-
- verse_callback_update(0);
-}
-
-/*
- * create new VerseVert due to information about EditVert,
- * put VerseVert to queue ... send to verse host (server)
- */
-void createVerseVert(EditVert *eve)
-{
- if(G.editMesh->vnode) {
- struct VLayer *vlayer = find_verse_layer_type((VGeomData*)((VNode*)G.editMesh->vnode)->data, VERTEX_LAYER);
- createVerseVertNL(eve, (VNode*)G.editMesh->vnode, vlayer);
- }
- else eve->vvert = NULL;
-}
-
-/*
- * create new VerseVert due to information about EditVert,
- * put VerseVert to queue ... send to verse host (server)
- * NL version of function (infomration about verse node and
- * layer is known ... optimalisation)
- */
-void createVerseVertNL(EditVert *eve, VNode *vnode, VLayer *vlayer)
-{
- struct VerseVert *vvert;
-
- vvert = create_verse_vertex(vlayer, vlayer->counter, eve->co[0], eve->co[1], eve->co[2]);
-
- vvert->vertex = (void*)eve;
- eve->vvert = (void*)vvert;
-
- vvert->flag |= VERT_LOCKED;
-
-/* printf("\tsend_versevert_pos: %d create and LOCK \n", vvert->id);*/
-
- /* add vvert to sending queue */
- add_item_to_send_queue(&(vlayer->queue), (void*)vvert, VERSE_VERT);
-}
-
-/*
- * create new verse vertexes due to all vertexes and send all of them to verse server
- */
-static void createAllVerseVerts(VNode *vnode, VLayer *vlayer)
-{
- if(G.obedit) {
- struct EditMesh *em;
- struct EditVert *eve;
-
- em = G.editMesh;
- eve = em->verts.first;
-
- /* push all EditVertexes to the verse server */
- while(eve){
- createVerseVertNL(eve, vnode, vlayer);
- eve = eve->next;
- }
- }
-}
-
-/*
- * unsubscribe from verse geometry layers of verse geometry node
- * and clear bindings between verse node and mesh
- */
-void unsubscribe_from_geom_node(VNode *vnode)
-{
- struct VerseSession *session = vnode->session;
-
- struct VLayer *vlayer = ((VGeomData*)vnode->data)->layers.lb.first;
-
- if(vnode->type != V_NT_GEOMETRY) return;
-
- /* free bindings between verse node and blender mesh*/
- if(((VGeomData*)vnode->data)->mesh) {
- ((Mesh*)((VGeomData*)vnode->data)->mesh)->vnode = NULL;
- ((VGeomData*)vnode->data)->mesh = NULL;
- }
-
- /* free bindings between verse node and blender editmesh */
- if(((VGeomData*)vnode->data)->editmesh) {
- ((EditMesh*)((VGeomData*)vnode->data)->editmesh)->vnode = NULL;
- ((VGeomData*)vnode->data)->editmesh = NULL;
- }
-
- /* free all verse layer data and unsubscribe from all layers */
- while(vlayer) {
- BLI_dlist_reinit(&(vlayer->dl));
- BLI_freelistN(&(vlayer->queue));
- BLI_freelistN(&(vlayer->orphans));
-
- if(session->flag & VERSE_CONNECTED)
- verse_send_g_layer_unsubscribe(vnode->id, vlayer->id);
-
- vlayer = vlayer->next;
- }
-
-}
-
-/* ===================================================================================
- *
- * Function executed after execution of callback functions
- *
- * ===================================================================================*/
-
-/*
- * Actions executed after new VerseLayer is created
- */
-void post_layer_create(struct VLayer *vlayer)
-{
- /* if we are owners of VerseNode, then push geometry to verse server */
- if(vlayer->vnode->owner_id == VN_OWNER_MINE) {
- switch(vlayer->type){
- case VN_G_LAYER_VERTEX_XYZ:
-/* if(vlayer->id==0) createAllVerseVerts(vlayer->vnode, vlayer);
- break;*/
- case VN_G_LAYER_POLYGON_CORNER_UINT32:
-/* if(vlayer->id==1) createAllVerseFaces(vlayer->vnode, vlayer);
- break;*/
- case VN_G_LAYER_VERTEX_UINT32:
- case VN_G_LAYER_VERTEX_REAL:
- case VN_G_LAYER_POLYGON_CORNER_REAL:
- case VN_G_LAYER_POLYGON_FACE_UINT8:
- case VN_G_LAYER_POLYGON_FACE_UINT32:
- case VN_G_LAYER_POLYGON_FACE_REAL:
- break;
- }
- }
- else {
- switch(vlayer->type) {
- case VN_G_LAYER_VERTEX_XYZ:
- case VN_G_LAYER_POLYGON_CORNER_UINT32:
- case VN_G_LAYER_VERTEX_UINT32:
- case VN_G_LAYER_VERTEX_REAL:
- case VN_G_LAYER_POLYGON_CORNER_REAL:
- case VN_G_LAYER_POLYGON_FACE_UINT8:
- case VN_G_LAYER_POLYGON_FACE_UINT32:
- case VN_G_LAYER_POLYGON_FACE_REAL:
- break;
- }
- }
-}
-
-/*
- * Actions after destroying of VerseLayer
- */
-void post_layer_destroy(struct VLayer *vlayer)
-{
-}
-
-/*
- * Actions executed after creating of new VerseVert, when object is in edit
- * mode, and this client didn't create this VerseVert (vvert->vertex is NULL),
- * then new editvert is created
- */
-void post_vertex_create(VerseVert *vvert)
-{
- struct VNode *obj_vnode;
- struct VNode *geom_vnode = vvert->vlayer->vnode;
- struct EditMesh *em=NULL;
-
- if(G.obedit && (((Mesh*)G.obedit->data)->vnode==geom_vnode)) {
- em = (EditMesh*)((VGeomData*)geom_vnode->data)->editmesh;
- }
-
- /* when vert was changed during sending to verse server, then
- * we have to send it to verse server again */
- if(vvert->flag & VERT_POS_OBSOLETE) {
- vvert->flag &= ~VERT_POS_OBSOLETE;
-
- if(em && (vvert->vertex)) {
- struct EditVert *eve = (EditVert*)vvert->vertex;
- VECCOPY(vvert->co, eve->co);
- send_verse_vertex(vvert);
- verse_callback_update(0);
-
- return;
- }
- }
-
- if(em && !(vvert->vertex)) {
- struct EditVert *eve;
-
- /* to prevent never ending loop of sending and receiving
- * vertexes, because addvertlist() sends new vertex to verse
- * server if em->vnode isn't NULL */
- em->vnode = NULL;
- eve = addvertlist(vvert->co, NULL);
- em->vnode = (void*)geom_vnode;
-
- eve->vvert = (void*)vvert;
- vvert->vertex = (void*)eve;
-
- countall();
-
- recalc_editnormals();
- }
-
- if(((VGeomData*)geom_vnode->data)->vlink) {
- obj_vnode = ((VGeomData*)geom_vnode->data)->vlink->source;
- DAG_object_flush_update(G.scene, (Object*)((VObjectData*)obj_vnode->data)->object, OB_RECALC_DATA);
-
- allqueue(REDRAWVIEW3D, 1);
- }
-}
-
-/*
- * Actions executed, when position of VerseVert was changed
- * position of EditVert is changed in edit mode
- */
-void post_vertex_set_xyz(VerseVert *vvert)
-{
- struct VNode *obj_vnode;
- struct VNode *geom_vnode = vvert->vlayer->vnode;
- struct EditVert *eve = NULL;
-
- /* when vert was changed during sending to verse server, then
- * we have to send it to verse server again */
- if(vvert->flag & VERT_POS_OBSOLETE) {
- if(vvert->vertex) {
- vvert->flag &= ~VERT_POS_OBSOLETE;
- vvert->flag |= VERT_LOCKED;
-
- eve = (EditVert*)vvert->vertex;
- VECCOPY(vvert->co, eve->co);
- send_verse_vertex(vvert);
- verse_callback_update(0);
- }
- else {
- printf("\terror: vvert->vertex shouldn't be NULL\n");
- }
-
- return;
- }
-
- /* when shared object is in edit mode, then update editmesh */
- if(G.obedit && (((Mesh*)G.obedit->data)->vnode==geom_vnode)) {
- if(vvert->vertex) {
- eve = (EditVert*)vvert->vertex;
- VECCOPY(eve->co, vvert->co);
- recalc_editnormals();
- }
- else {
- printf("\terror: vvert->vertex shouldn't be NULL\n");
- }
- }
-
- if(((VGeomData*)geom_vnode->data)->vlink) {
- obj_vnode = ((VGeomData*)geom_vnode->data)->vlink->source;
- DAG_object_flush_update(G.scene, (Object*)((VObjectData*)obj_vnode->data)->object, OB_RECALC_DATA);
-
- allqueue(REDRAWVIEW3D, 1);
- }
-}
-
-/*
- * Actions executed after deleting of VerseVert
- */
-void post_vertex_delete(VerseVert *vvert)
-{
- struct VNode *obj_vnode;
- struct VNode *geom_vnode = vvert->vlayer->vnode;
- struct EditMesh *em = NULL;
- struct EditEdge *ed, *edn;
- struct EditVert *eve = NULL;
-
- if(G.obedit && (((Mesh*)G.obedit->data)->vnode==geom_vnode)) {
- em = (EditMesh*)((VGeomData*)geom_vnode->data)->editmesh;
- eve = (EditVert*)vvert->vertex;
- }
-
- if(em && eve) {
- /*printf("\tPOST_VERTEX_DELETE()\n");*/
-
- /* delete all edges needing eve vertex */
- ed = em->edges.first;
- while(ed) {
- edn = ed->next;
- if(ed->v1==eve || ed->v2==eve) {
- remedge(ed);
- free_editedge(ed);
- }
- ed = edn;
- }
-
- eve->vvert = NULL;
- BLI_remlink(&em->verts, eve);
- free_editvert(eve);
- vvert->vertex = NULL;
-
- countall();
-
- recalc_editnormals();
- }
-
- if(((VGeomData*)geom_vnode->data)->vlink) {
- obj_vnode = ((VGeomData*)geom_vnode->data)->vlink->source;
- DAG_object_flush_update(G.scene, (Object*)((VObjectData*)obj_vnode->data)->object, OB_RECALC_DATA);
-
- allqueue(REDRAWVIEW3D, 1);
- }
-}
-
-/*
- * free constraint between VerseVert and EditVert
- */
-void post_vertex_free_constraint(VerseVert *vvert)
-{
- if(vvert->vertex) {
- ((EditVert*)vvert->vertex)->vvert=NULL;
- vvert->vertex=NULL;
- }
-}
-
-/*
- * Action executed after setting up uint8 value of polygon
- */
-void post_polygon_set_uint8(VerseFace *vface)
-{
-}
-
-/*
- * Action executed after creating of new VerseFace
- */
-void post_polygon_create(VerseFace *vface)
-{
- struct VNode *obj_vnode;
- struct VNode *geom_vnode = vface->vlayer->vnode;
- struct EditMesh *em = NULL;
-
- /* if verse face was set as deleted during sending to verse server, then send
- * delete command to verse server now ... we know verse face id */
-/* if(vface->flag & FACE_DELETED) {
- send_verse_face_delete(vface);
- return;
- }*/
-
- if(G.obedit && (((Mesh*)G.obedit->data)->vnode==geom_vnode)) {
- em = (EditMesh*)((VGeomData*)geom_vnode->data)->editmesh;
- }
-
- /* when face was changed during sending to verse server, then
- * we have to send it to verse server again */
- if(vface->flag & FACE_OBSOLETE) {
- vface->flag &= ~FACE_OBSOLETE;
- sync_verseface_with_editface(vface->vlayer, vface);
- return;
- }
-
- if(em && !(vface->face) && (vface->counter==0)) {
- struct VLayer *vlayer;
- struct VerseVert *vvert;
- struct EditFace *efa;
- struct EditVert *eves[4]={NULL, NULL, NULL, NULL};
- uint32 vert_ids[4]={vface->v0, vface->v1, vface->v2, vface->v3};
- int i;
-
- /*printf("\tPOST_POLYGON_CREATE()\n");*/
-
- vlayer = find_verse_layer_type((VGeomData*)geom_vnode->data, VERTEX_LAYER);
-
- for(i=0; i<4; i++) {
- if(vert_ids[i] != -1) {
- vvert = BLI_dlist_find_link(&(vlayer->dl), vert_ids[i]);
- if(vvert) eves[i] = (EditVert*)vvert->vertex;
- }
- }
-
- /* to prevent never ending loop of sending and receiving
- * faces, because addfacelist() sends new face to verse
- * server if em->vnode isn't NULL */
- em->vnode = NULL;
- efa = addfacelist(eves[0], eves[1], eves[2], eves[3], NULL, NULL);
- em->vnode = geom_vnode;
-
- if(efa) {
- efa->vface = vface;
- vface->face = efa;
- }
-
- countall();
-
- recalc_editnormals();
- }
-
- if(((VGeomData*)geom_vnode->data)->vlink) {
- obj_vnode = ((VGeomData*)geom_vnode->data)->vlink->source;
- DAG_object_flush_update(G.scene, (Object*)((VObjectData*)obj_vnode->data)->object, OB_RECALC_DATA);
-
- allqueue(REDRAWVIEW3D, 1);
- }
-}
-
-/*
- * Action executed after changes of VerseFace
- * ... order of vertexes was fliped, etc.
- */
-void post_polygon_set_corner(VerseFace *vface)
-{
- struct VNode *obj_vnode;
- struct VNode *geom_vnode = vface->vlayer->vnode;
- struct EditMesh *em = NULL;
- struct EditFace *efa = NULL;
- struct EditEdge *eed, *eedn;
-
- if(G.obedit && (((Mesh*)G.obedit->data)->vnode==geom_vnode)) {
- em = (EditMesh*)((VGeomData*)geom_vnode->data)->editmesh;
- efa = (EditFace*)vface->face;
- }
-
- if(em && efa) {
-
- /* when face was changed during sending to verse server, then
- * we have to send it to verse server again */
- if(vface->flag & FACE_OBSOLETE) {
- vface->flag &= ~FACE_OBSOLETE;
- sync_verseface_with_editface(vface->vlayer, vface);
- return;
- }
-
- /* mark all edges, which are part of face efa */
- efa->e1->f2 = 1;
- efa->e2->f2 = 1;
- efa->e3->f2 = 1;
- if(efa->e4) efa->e4->f2 = 1;
-
- /* change pointers at EdtitVerts and decrease counters of "old"
- * VerseVertexes reference ... less VerseFaces will need them */
- if(vface->vvert0 != efa->v1->vvert)
- efa->v1 = (EditVert*)vface->vvert0->vertex;
- if(vface->vvert1 != efa->v2->vvert)
- efa->v2 = (EditVert*)vface->vvert1->vertex;
- if(vface->vvert2 != efa->v3->vvert)
- efa->v3 = (EditVert*)vface->vvert2->vertex;
- if(efa->v4) {
- if(!vface->vvert3)
- efa->v4 = NULL;
- else if(vface->vvert3 != efa->v4->vvert)
- efa->v4 = (EditVert*)vface->vvert3->vertex;
- }
-
- /* change pointers at EditEdges */
-
- /* 1st edge */
- eed = findedgelist(efa->v1, efa->v2);
- if(eed) efa->e1 = eed;
- else efa->e1 = addedgelist(efa->v1, efa->v2, NULL);
-
- /* 2nd edge */
- eed = findedgelist(efa->v2, efa->v3);
- if(eed) efa->e2 = eed;
- else efa->e2 = addedgelist(efa->v2, efa->v3, NULL);
-
- if(efa->v4) {
- /* 3th edge */
- eed = findedgelist(efa->v2, efa->v3);
- if(eed) efa->e3 = eed;
- else efa->e3 = addedgelist(efa->v2, efa->v3, NULL);
- /* 4th edge */
- eed = findedgelist(efa->v4, efa->v1);
- if(eed) efa->e4 = eed;
- else efa->e4 = addedgelist(efa->v4, efa->v1, NULL);
- }
- else {
- /* 3th edge */
- eed = findedgelist(efa->v3, efa->v1);
- if(eed) efa->e3 = eed;
- else efa->e3 = addedgelist(efa->v3, efa->v1, NULL);
- /* 4th edge */
- efa->e4 = NULL;
- }
-
- /* unmark needed edges */
- efa = em->faces.first;
- while(efa) {
- efa->e1->f2 = 0;
- efa->e2->f2 = 0;
- efa->e3->f2 = 0;
- if(efa->e4) efa->e4->f2 = 0;
- efa = efa->next;
- }
-
- /* delete all unneeded edges */
- eed = em->edges.first;
- while(eed) {
- eedn = eed->next;
- if(eed->f2) {
- remedge(eed);
- free_editedge(eed);
- }
- eed = eedn;
- }
-
- countall();
-
- recalc_editnormals();
- }
-
- if(((VGeomData*)geom_vnode->data)->vlink) {
- obj_vnode = ((VGeomData*)geom_vnode->data)->vlink->source;
- DAG_object_flush_update(G.scene, (Object*)((VObjectData*)obj_vnode->data)->object, OB_RECALC_DATA);
-
- allqueue(REDRAWVIEW3D, 1);
- }
-}
-
-/*
- * Action executed after deleting of VerseFace
- */
-void post_polygon_delete(VerseFace *vface)
-{
- struct VNode *obj_vnode;
- struct VNode *geom_vnode = vface->vlayer->vnode;
- struct EditMesh *em = NULL;
- struct EditFace *efa = NULL;
- struct EditEdge *eed, *eedn;
-
- if(G.obedit && (((Mesh*)G.obedit->data)->vnode==geom_vnode)) {
- em = (EditMesh*)((VGeomData*)geom_vnode->data)->editmesh;
- efa = (EditFace*)vface->face;
- }
-
- if(em && efa) {
- /*printf("\tPOST_POLYGON_DELETE()\n");*/
-
- /* mark all edges, which are part of face efa */
- efa->e1->f2 = 1;
- efa->e2->f2 = 1;
- efa->e3->f2 = 1;
- if(efa->e4) efa->e4->f2 = 1;
-
- efa->vface = NULL;
- BLI_remlink(&em->faces, efa);
- free_editface(efa);
- vface->face = NULL;
-
- /* following two crazy loops wouldn't be neccessary if verse spec
- * would support edges */
-
- /* unmark needed edges */
- efa = em->faces.first;
- while(efa) {
- efa->e1->f2 = 0;
- efa->e2->f2 = 0;
- efa->e3->f2 = 0;
- if(efa->e4) efa->e4->f2 = 0;
- efa = efa->next;
- }
-
- /* delete all unneeded edges */
- eed = em->edges.first;
- while(eed) {
- eedn = eed->next;
- if(eed->f2) {
- remedge(eed);
- free_editedge(eed);
- }
- eed = eedn;
- }
-
- countall();
- }
-
- if(((VGeomData*)geom_vnode->data)->vlink) {
- obj_vnode = ((VGeomData*)geom_vnode->data)->vlink->source;
- DAG_object_flush_update(G.scene, (Object*)((VObjectData*)obj_vnode->data)->object, OB_RECALC_DATA);
-
- allqueue(REDRAWVIEW3D, 1);
- }
-}
-
-/*
- * free constraint between VerseFace and EditFace
- */
-void post_polygon_free_constraint(VerseFace *vface)
-{
- if(vface->face) {
- ((EditFace*)vface->face)->vface = NULL;
- vface->face = NULL;
- }
-}
-
-/*
- * free constraint between VGeomData, EditMesh and Mesh
- */
-void post_geometry_free_constraint(VNode *vnode)
-{
- if(((VGeomData*)vnode->data)->editmesh) {
- G.editMesh->vnode = NULL;
- ((VGeomData*)vnode->data)->editmesh = NULL;
- }
- if(((VGeomData*)vnode->data)->mesh) {
- ((Mesh*)((VGeomData*)vnode->data)->mesh)->vnode = NULL;
- ((VGeomData*)vnode->data)->mesh = NULL;
- }
-}
-
-/* =========================================================================
- *
- * Functions influencing whole EditMesh or VerseMesh
- *
- * ========================================================================= */
-
-/*
- * free all bindings between EditMesh and "verse mesh" ... it is called between
- * restorng editmesh from undo stack
- */
-void destroy_versemesh(VNode *vnode)
-{
- struct VLayer *vert_vlayer, *face_vlayer;
- struct VerseVert *vvert;
- struct VerseFace *vface;
-
- if(vnode->type != V_NT_GEOMETRY) return;
-
- vert_vlayer = find_verse_layer_type((VGeomData*)vnode->data, VERTEX_LAYER);
- face_vlayer = find_verse_layer_type((VGeomData*)vnode->data, POLYGON_LAYER);
-
-
- /* send delete command to all received verse faces */
- vface = face_vlayer->dl.lb.first;
- while(vface) {
- if(vface->face) ((EditFace*)vface->face)->vface = NULL;
- vface->face = NULL;
- send_verse_face_delete(vface);
- vface = vface->next;
- }
- /* send delete command to all verse faces waiting in orphan list */
- vface = face_vlayer->orphans.first;
- while(vface) {
- if(vface->face) ((EditFace*)vface->face)->vface = NULL;
- vface->face = NULL;
- send_verse_face_delete(vface);
- vface = vface->next;
- }
- /* mark all verse faces waiting in sending queue as deleted,
- * send delete command, when this verse face was changed */
- vface = face_vlayer->queue.first;
- while(vface) {
- if(vface->face) ((EditFace*)vface->face)->vface = NULL;
- vface->face = NULL;
- if(vface->flag & FACE_CHANGED)
- send_verse_face_delete(vface);
- else {
- vface->flag |= FACE_DELETED;
- }
- vface = vface->next;
- }
-
- /* send delete command to all received verse vertexes */
- vvert = vert_vlayer->dl.lb.first;
- while(vvert) {
- if(vvert->vertex) ((EditVert*)vvert->vertex)->vvert = NULL;
- vvert->vertex = NULL;
- send_verse_vertex_delete(vvert);
- vvert = vvert->next;
- }
- /* mark all verse vertexes waiting in sending queue as deleted
- * ... verse vertexes will be deleted, when received */
- vvert = vert_vlayer->queue.first;
- while(vvert) {
- if(vvert->vertex) ((EditVert*)vvert->vertex)->vvert = NULL;
- vvert->vertex = NULL;
- vvert = vvert->next;
- }
-}
-
-/*
- * duplicate geometry verse node, this can be handy, when you duplicate some
- * object or make object single user
- */
-VNode *create_geom_vnode_from_geom_vnode(VNode *vnode)
-{
- struct VNode *n_vnode; /* new verse geometry node */
- struct VGeomData *geom_data; /* new geometry data */
- struct VLayer *n_vert_vlayer, *n_face_vlayer; /* new vertex and polygon layer */
- struct VLayer *vert_vlayer, *face_vlayer;
- struct VerseVert *n_vvert, *vvert;
- struct VerseFace *n_vface, *vface;
- int i;
-
- if(!vnode) return NULL;
-
- if(vnode->type != V_NT_GEOMETRY) return NULL;
-
- /* create new verse node, when no one exist */
- n_vnode= create_verse_node(vnode->session, -1 , V_NT_GEOMETRY, VN_OWNER_MINE);
- /* create new geometry data */
- geom_data = create_geometry_data();
- n_vnode->data = (void*)geom_data;
-
- /* set up name of VerseNode */
- n_vnode->name = (char*)MEM_mallocN(sizeof(char*)*(strlen(vnode->name)-1), "new geom node name");
- n_vnode->name[0] = '\0';
- strcat(n_vnode->name, vnode->name);
-
- /* add node to sending queue */
- add_item_to_send_queue(&(vnode->session->queue), n_vnode, VERSE_NODE);
-
- /* create vertex verse layer */
- n_vert_vlayer = create_verse_layer(n_vnode, 0, "vertex", VN_G_LAYER_VERTEX_XYZ, 0, 0);
- add_item_to_send_queue(&(geom_data->queue), n_vert_vlayer, VERSE_LAYER);
-
- /* create polygon verse layer */
- n_face_vlayer = create_verse_layer(n_vnode, 1, "polygon", VN_G_LAYER_POLYGON_CORNER_UINT32, 0, 0);
- add_item_to_send_queue(&(geom_data->queue), n_face_vlayer, VERSE_LAYER);
-
- /* find vertex layer of old verse node */
- vert_vlayer = find_verse_layer_type((VGeomData*)vnode->data, VERTEX_LAYER);
- /* find polygon layer of old verse node */
- face_vlayer = find_verse_layer_type((VGeomData*)vnode->data, POLYGON_LAYER);
-
- /* duplicate verse vertexes */
- for(i=0, vvert = (VerseVert*)vert_vlayer->dl.lb.first; vvert; vvert = vvert->next, i++) {
- n_vvert = create_verse_vertex(n_vert_vlayer, i, vvert->co[0], vvert->co[1], vvert->co[2]);
- vvert->tmp.vvert = n_vvert;
- add_item_to_send_queue(&(n_vert_vlayer->queue), n_vvert, VERSE_VERT);
- }
-
- /* duplicate verse faces (polyons) */
- for(i=0, vface = (VerseFace*)face_vlayer->dl.lb.first; vface; vface = vface->next, i++) {
- n_vface = create_verse_face(n_face_vlayer, i, -1, -1, -1, -1);
- n_vface->vvert0 = vface->vvert0->tmp.vvert;
- n_vface->vvert1 = vface->vvert1->tmp.vvert;
- n_vface->vvert2 = vface->vvert2->tmp.vvert;
- if(vface->vvert3)
- n_vface->vvert3 = vface->vvert3->tmp.vvert;
- else
- n_vface->vvert3 = NULL;
- add_item_to_send_queue(&(n_face_vlayer->queue), n_vface, VERSE_FACE);
- }
-
- return n_vnode;
-}
-
-/*
- * create new geometry node, make bindings between geometry node and editmesh,
- * make bindings between editverts and verseverts, make bindings between editfaces
- * and versefaces
- */
-VNode *create_geom_vnode_data_from_editmesh(VerseSession *session, EditMesh *em)
-{
- struct VNode *vnode;
- struct Mesh *me;
- struct VGeomData *geom_data;
- struct VLayer *vert_vlayer, *face_vlayer;
-
- if(!session) return NULL;
-
- if(!em) return NULL;
-
- /* some verse geometry node already exists */
- if(em->vnode) return NULL;
-
- /* we will need mesh too (mesh name, creating bindings between verse node, etc.) */
- me = get_mesh(G.obedit);
-
- /* create new verse node, when no one exist */
- vnode = create_verse_node(session, -1 , V_NT_GEOMETRY, VN_OWNER_MINE);
- /* create new geometry data */
- geom_data = create_geometry_data();
- vnode->data = (void*)geom_data;
-
- /* set up name of VerseNode */
- vnode->name = (char*)MEM_mallocN(sizeof(char*)*(strlen(me->id.name)-1), "geom node name");
- vnode->name[0] = '\0';
- strcat(vnode->name, me->id.name+2);
-
- /* set up bindings */
- me->vnode = (void*)vnode;
- em->vnode = (void*)vnode;
- geom_data->mesh = (void*)me;
- geom_data->editmesh = (void*)em;
-
- /* add node to sending queue */
- add_item_to_send_queue(&(session->queue), vnode, VERSE_NODE);
-
- /* create vertex verse layer */
- vert_vlayer = create_verse_layer(vnode, 0, "vertex", VN_G_LAYER_VERTEX_XYZ, 0, 0);
- add_item_to_send_queue(&(geom_data->queue), vert_vlayer, VERSE_LAYER);
-
- /* create polygon verse layer */
- face_vlayer = create_verse_layer(vnode, 1, "polygon", VN_G_LAYER_POLYGON_CORNER_UINT32, 0, 0);
- add_item_to_send_queue(&(geom_data->queue), face_vlayer, VERSE_LAYER);
-
- /* create all verse verts and add them to sending queue */
- createAllVerseVerts(vnode, vert_vlayer);
-
- /* create all verse faces and add tehm to sending queue */
- createAllVerseFaces(vnode, face_vlayer);
-
- return vnode;
-}
-
-/*
- * create new geometry node, make bindings between geometry node and mesh and
- * fill geometry node with new data based at mesh data
- */
-VNode *create_geom_vnode_data_from_mesh(VerseSession *session, Mesh *me)
-{
- struct VNode *vnode;
- struct VGeomData *geom_data;
- struct VLayer *vert_vlayer, *face_vlayer;
- struct VerseVert *vvert, **vverts;
- struct VerseFace *vface;
- struct MVert *mvert;
- struct MFace *mface;
- int i;
-
- if(!session) return NULL;
-
- if(!me) return NULL;
-
- /* some verse geometry node already exists */
- if(me->vnode) return NULL;
-
- /* create new verse node, when no one exist */
- vnode = create_verse_node(session, -1 , V_NT_GEOMETRY, VN_OWNER_MINE);
- /* create new geometry data */
- geom_data = create_geometry_data();
- vnode->data = (void*)geom_data;
-
- /* set up name of VerseNode */
- vnode->name = (char*)MEM_mallocN(sizeof(char*)*(strlen(me->id.name)-1), "geom node name");
- vnode->name[0] = '\0';
- strcat(vnode->name, me->id.name+2);
-
- /* set up bindings */
- me->vnode = (void*)vnode;
- geom_data->mesh = (void*)me;
-
- /* add node to sending queue */
- add_item_to_send_queue(&(session->queue), vnode, VERSE_NODE);
-
- /* create vertex verse layer */
- vert_vlayer = create_verse_layer(vnode, 0, "vertex", VN_G_LAYER_VERTEX_XYZ, 0, 0);
- add_item_to_send_queue(&(geom_data->queue), vert_vlayer, VERSE_LAYER);
-
- /* create polygon verse layer */
- face_vlayer = create_verse_layer(vnode, 1, "polygon", VN_G_LAYER_POLYGON_CORNER_UINT32, 0, 0);
- add_item_to_send_queue(&(geom_data->queue), face_vlayer, VERSE_LAYER);
-
- /* temporary array of VerseVerts */
- vverts = (VerseVert**)MEM_mallocN(sizeof(VerseVert*)*me->totvert,"temp array of vverts");
-
- /* "fill vertex layer with vertexes" and add them to sending queue (send them to verse server) */
- for(i=0, mvert=me->mvert; i<me->totvert; i++, mvert++) {
- vverts[i] = vvert = create_verse_vertex(vert_vlayer, i, mvert->co[0], mvert->co[1], mvert->co[2]);
- add_item_to_send_queue(&(vert_vlayer->queue), vvert, VERSE_VERT);
- }
-
- /* "fill face/polygon layer with faces" and them to sending queue */
- for(i=0, mface = me->mface; i<me->totface; i++, mface++) {
- if(mface->v4) {
- vface = create_verse_face(face_vlayer, i, mface->v1, mface->v2, mface->v3, mface->v4);
- vface->vvert0 = vverts[mface->v1];
- vface->vvert1 = vverts[mface->v2];
- vface->vvert2 = vverts[mface->v3];
- vface->vvert3 = vverts[mface->v4];
- vface->counter = 4;
- }
- else {
- vface = create_verse_face(face_vlayer, i, mface->v1, mface->v2, mface->v3, -1);
- vface->vvert0 = vverts[mface->v1];
- vface->vvert1 = vverts[mface->v2];
- vface->vvert2 = vverts[mface->v3];
- vface->counter = 3;
- }
- add_item_to_send_queue(&(face_vlayer->queue), vface, VERSE_FACE);
- }
-
- MEM_freeN(vverts);
-
- return vnode;
-}
-
-/*
- * creates Mesh from verse geometry node and create bindings
- * between them
- */
-Mesh *create_mesh_from_geom_node(VNode *vnode)
-{
- struct Mesh *me;
-
- if(vnode->type != V_NT_GEOMETRY) return NULL;
-
- /* add new empty mesh*/
- me = add_mesh("Mesh");
- /* set up bindings between mesh and verse node */
- me->vnode = (void*)vnode;
- ((VGeomData*)vnode->data)->mesh = (void*)me;
-
- return me;
-}
-
-/*
- * create mesh from verse mesh
- */
-void create_meshdata_from_geom_node(Mesh *me, VNode *vnode)
-{
- struct VLayer *vert_vlayer, *face_vlayer;
- struct VerseVert *vvert;
- struct VerseFace *vface;
- struct MVert *mvert;
- struct MFace *mface;
- struct EdgeHash *edges;
- int index;
-
- if(!me || !vnode) return;
-
- if(vnode->type != V_NT_GEOMETRY) return;
-
- vert_vlayer = find_verse_layer_type((VGeomData*)vnode->data, VERTEX_LAYER);
- face_vlayer = find_verse_layer_type((VGeomData*)vnode->data, POLYGON_LAYER);
-
- CustomData_free(&me->vdata, me->totvert);
- CustomData_free(&me->edata, me->totedge);
- CustomData_free(&me->fdata, me->totface);
- mesh_update_customdata_pointers(me);
-
- if(me->mselect) {
- MEM_freeN(me->mselect);
- me->mselect = NULL;
- }
-
- me->totvert = vert_vlayer ? vert_vlayer->dl.da.count : 0;
- me->totface = face_vlayer ? face_vlayer->dl.da.count : 0;
- me->totselect = 0;
-
- CustomData_add_layer(&me->vdata, CD_MVERT, CD_CALLOC, NULL, me->totvert);
- CustomData_add_layer(&me->fdata, CD_MFACE, CD_CALLOC, NULL, me->totface);
- mesh_update_customdata_pointers(me);
-
- mvert = me->mvert;
- mface = me->mface;
-
- index = 0;
- vvert = vert_vlayer ? vert_vlayer->dl.lb.first : NULL;
- while(vvert) {
- VECCOPY(mvert->co, vvert->co);
- VECCOPY(mvert->no, vvert->no);
- mvert->flag = 0;
- mvert->mat_nr = 0;
- vvert->tmp.index = index++;
- vvert = vvert->next;
- mvert++;
- }
-
- edges = BLI_edgehash_new();
- vface = face_vlayer ? face_vlayer->dl.lb.first : NULL;
- while(vface) {
- mface->v1 = vface->vvert0->tmp.index;
- mface->v2 = vface->vvert1->tmp.index;
- mface->v3 = vface->vvert2->tmp.index;
-
- if(!BLI_edgehash_haskey(edges, mface->v1, mface->v2))
- BLI_edgehash_insert(edges, mface->v1, mface->v2, NULL);
- if(!BLI_edgehash_haskey(edges, mface->v2, mface->v3))
- BLI_edgehash_insert(edges, mface->v2, mface->v3, NULL);
- if(vface->vvert3) {
- mface->v4 = vface->vvert3->tmp.index;
- if(!BLI_edgehash_haskey(edges, mface->v3, mface->v4))
- BLI_edgehash_insert(edges, mface->v3, mface->v4, NULL);
- if(!BLI_edgehash_haskey(edges, mface->v4, mface->v1))
- BLI_edgehash_insert(edges, mface->v4, mface->v1, NULL);
- } else {
- mface->v4 = 0;
- if(!BLI_edgehash_haskey(edges, mface->v3, mface->v1))
- BLI_edgehash_insert(edges, mface->v3, mface->v1, NULL);
- }
-
- mface->flag = 0;
- mface->pad = 0;
- mface->mat_nr = 0;
- mface->edcode = 0;
-
- /* index 0 isn't allowed at location 3 or 4 */
- test_index_face(mface, NULL, 0, vface->vvert3?4:3);
-/* printf("\t mface: %d, %d, %d, %d\n", mface->v1, mface->v2, mface->v3, mface->v4);*/
-
- vface = vface->next;
- mface++;
- }
-
- me->totedge = BLI_edgehash_size(edges);
-
- if(me->totedge) {
- EdgeHashIterator *i;
- MEdge *medge = me->medge = CustomData_add_layer(&me->edata, CD_MEDGE, CD_CALLOC, NULL, me->totedge);
-
- for(i = BLI_edgehashIterator_new(edges); !BLI_edgehashIterator_isDone(i); BLI_edgehashIterator_step(i), ++medge) {
- BLI_edgehashIterator_getKey(i, (int*)&medge->v1, (int*)&medge->v2);
- medge->crease = medge->pad = medge->flag = 0;
- }
- BLI_edgehashIterator_free(i);
- }
-
- BLI_edgehash_free(edges, NULL);
-
- mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL);
-}
-
-/*
- * Create EditMesh from VerseMesh and keep system in consitant state, this
- * function is called, when edit mode is entered ... edit mesh is generated
- * from verse mesh (not from Mesh: (Mesh*)ob->data)
- */
-void create_edit_mesh_from_geom_node(VNode *vnode)
-{
- struct VLayer *vert_layer, *face_layer;
- struct VerseVert *vvert;
- struct VerseFace *vface;
- struct Mesh *me;
- struct EditVert *eve, *eve0, *eve1, *eve2, *eve3;
- struct EditFace *efa;
- unsigned int keyindex;
-
- if(!(G.obedit && G.obedit->type==OB_MESH)) return;
- me = (Mesh*)G.obedit->data;
- if(vnode!=(VNode*)me->vnode || vnode->type!=V_NT_GEOMETRY) return;
-
- vert_layer = find_verse_layer_type((VGeomData*)vnode->data, VERTEX_LAYER);
- face_layer = find_verse_layer_type((VGeomData*)vnode->data, POLYGON_LAYER);
-
- if(!(vert_layer && face_layer)) return;
-
- waitcursor(1);
-
- /* free old editMesh */
- free_editMesh(G.editMesh);
-
- G.editMesh->vnode = NULL;
-
- vvert = vert_layer->dl.lb.first;
-
- keyindex = 0;
-
- /* create all EditVerts */
- while(vvert) {
- eve = addvertlist(vvert->co, NULL);
-
- eve->f = 0;
- eve->h = 0;
- eve->data = NULL;
- eve->keyindex = keyindex;
- eve->vvert = (void*)vvert;
-
- vvert->vertex = (void*)eve;
-
- keyindex++;
- vvert = vvert->next;
- }
-
- vface = face_layer->dl.lb.first;
-
- /* create all EditFaces and EditEdges */
- while(vface) {
- if(vface->vvert0) eve0= vface->vvert0->vertex;
- else eve0 = NULL;
- if(vface->vvert1) eve1= vface->vvert1->vertex;
- else eve1 = NULL;
- if(vface->vvert2) eve2= vface->vvert2->vertex;
- else eve2 = NULL;
- if(vface->vvert3) eve3= vface->vvert3->vertex;
- else eve3 = NULL;
-
- efa= addfacelist(eve0, eve1, eve2, eve3, NULL, NULL);
- if(efa) {
- efa->f = 0;
- efa->h = 0;
- efa->vface = (void*)vface;
- vface->face = (void*)efa;
- }
- vface = vface->next;
- }
-
- countall();
-
- recalc_editnormals();
-
- G.editMesh->vnode = (void*)vnode;
- ((VGeomData*)vnode->data)->editmesh = (void*)G.editMesh;
-
- waitcursor(0);
-}
-
-/*
- * destroy bindings between EditMesh and VerseMesh and send delete commands
- * for all VerseVerts and VerseFaces to verse server, Verse Node has to be
- * geometry node
- */
-
-void destroy_verse_mesh(VNode *vnode)
-{
- struct VLayer *vert_vlayer, *face_vlayer;
- struct VerseFace *vface;
- struct VerseVert *vvert;
-
- if(vnode->type != V_NT_GEOMETRY) return;
-
- face_vlayer = find_verse_layer_type((VGeomData*)vnode->data, POLYGON_LAYER);
- vface = face_vlayer->dl.lb.first;
-
- while(vface) {
- ((EditFace*)vface->face)->vface = NULL;
- vface->face = NULL;
- vface = vface->next;
- }
-
- vert_vlayer = find_verse_layer_type((VGeomData*)vnode->data, VERTEX_LAYER);
- vvert = vert_vlayer->dl.lb.first;
-
- while(vvert) {
- ((EditVert*)vvert->vertex)->vvert = NULL;
- vvert->vertex = NULL;
- vvert = vvert->next;
- }
-
- destroy_geometry(vnode);
-}
-
-#endif
-
diff --git a/source/blender/src/verse_object.c b/source/blender/src/verse_object.c
deleted file mode 100644
index fc937469d42..00000000000
--- a/source/blender/src/verse_object.c
+++ /dev/null
@@ -1,600 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Contributor(s): Jiri Hnidek.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#ifdef WITH_VERSE
-
-#include <string.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "mydevice.h"
-
-#include "DNA_object_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_image_types.h"
-#include "DNA_listBase.h"
-
-#include "BLI_dynamiclist.h"
-#include "BLI_blenlib.h"
-#include "BLI_editVert.h"
-#include "BLI_arithb.h"
-
-#include "BIF_verse.h"
-#include "BIF_space.h"
-#include "BIF_editmesh.h"
-#include "BIF_drawimage.h"
-#include "BIF_editmode_undo.h"
-#include "BIF_toolbox.h"
-
-#include "BKE_verse.h"
-#include "BKE_global.h"
-#include "BKE_object.h"
-#include "BKE_utildefines.h"
-#include "BKE_depsgraph.h"
-#include "BKE_image.h"
-#include "BKE_library.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_mesh.h"
-#include "BKE_displist.h"
-
-#include "BDR_editobject.h"
-
-#include "verse.h"
-
-/* button callback function, it test object name and send new name to verse server */
-void test_and_send_idbutton_cb(void *obj, void *ob_name)
-{
- struct Object *ob = (Object*)obj;
- char *name= (char*)ob_name;
-
- test_idbutton(name+2);
-
- if(ob->vnode) verse_send_node_name_set(((VNode*)ob->vnode)->id, name+2);
-}
-
-/*
- * duplicate verse object nodes
- */
-void b_verse_duplicate_object(VerseSession *session, Object *ob, Object *n_ob)
-{
- struct VNode *obj_vnode;
-
- if(!session) return;
-
- if(!(session->flag & VERSE_CONNECTED)) return;
-
- /* create "my" new object VerseNode */
- obj_vnode= create_verse_node(session, -1 , V_NT_OBJECT, VN_OWNER_MINE);
- /* create object data */
- obj_vnode->data = create_object_data();
-
- /* set up name of VerseNode */
- obj_vnode->name = (char*)MEM_mallocN(sizeof(char*)*(strlen(n_ob->id.name)-1), "object node name");
- obj_vnode->name[0] = '\0';
- strcat(obj_vnode->name, n_ob->id.name+2);
-
- /* set up object node transformation */
- VECCOPY(((VObjectData*)obj_vnode->data)->pos, n_ob->loc);
- EulToQuat(n_ob->rot, ((VObjectData*)obj_vnode->data)->quat);
- VECCOPY(((VObjectData*)obj_vnode->data)->scale, n_ob->size);
-
- /* set up pointers between Object and VerseNode */
- ((VObjectData*)obj_vnode->data)->object = (void*)n_ob;
- n_ob->vnode = (void*)obj_vnode;
-
- /* add node to sending queue */
- add_item_to_send_queue(&(session->queue), obj_vnode, VERSE_NODE);
-
- if(ob->type==OB_MESH) {
- struct Mesh *me;
- struct VNode *geom_vnode;
- struct VLink *vlink;
-
- /* when current mesh already shared at verse server, then only set up link
- * between object node and geometry node */
- if(ob->data == n_ob->data) {
- geom_vnode = (VNode*)((Mesh*)ob->data)->vnode;
- }
- else {
- geom_vnode = create_geom_vnode_from_geom_vnode((VNode*)((Mesh*)ob->data)->vnode);
- me = (Mesh*)n_ob->data;
- me->vnode = (void*)geom_vnode;
- ((VGeomData*)geom_vnode->data)->mesh = (void*)me;
-
- }
- /* create new link between VereseNodes */
- vlink = create_verse_link(session, obj_vnode, geom_vnode, -1, -1, "geometry");
- /* "send" link to verse server */
- add_item_to_send_queue(&(((VObjectData*)obj_vnode->data)->queue), vlink, VERSE_LINK);
- }
-}
-
-/*
- * temp hack: this function push mesh objects (edit mode only) to verse server
- */
-void b_verse_push_object(VerseSession *session, Object *ob)
-{
- struct VNode *obj_vnode;
-
- if(!session) return;
-
- if(!(session->flag & VERSE_CONNECTED)) return;
-
- /* create "my" new object VerseNode */
- obj_vnode= create_verse_node(session, -1 , V_NT_OBJECT, VN_OWNER_MINE);
- /* create object data */
- obj_vnode->data = create_object_data();
-
- /* set up name of VerseNode */
- obj_vnode->name = (char*)MEM_mallocN(sizeof(char*)*(strlen(ob->id.name)-1), "object node name");
- obj_vnode->name[0] = '\0';
- strcat(obj_vnode->name, ob->id.name+2);
-
- /* set up object node transformation */
- VECCOPY(((VObjectData*)obj_vnode->data)->pos, ob->loc);
- EulToQuat(ob->rot, ((VObjectData*)obj_vnode->data)->quat);
- VECCOPY(((VObjectData*)obj_vnode->data)->scale, ob->size);
-
- /* set up pointers between Object and VerseNode */
- ((VObjectData*)obj_vnode->data)->object = (void*)ob;
- ob->vnode = (void*)obj_vnode;
-
- /* add node to sending queue */
- add_item_to_send_queue(&(session->queue), obj_vnode, VERSE_NODE);
-
- if(ob->type==OB_MESH) {
- struct VNode *geom_vnode;
- struct VLink *vlink;
-
- if(G.obedit)
- geom_vnode = create_geom_vnode_data_from_editmesh(session, G.editMesh);
- else
- geom_vnode = create_geom_vnode_data_from_mesh(session, get_mesh(ob));
-
- if(geom_vnode) {
- /* create new link between VereseNodes */
- vlink = create_verse_link(session, obj_vnode, geom_vnode, -1, -1, "geometry");
- /* send link to verse server */
- add_item_to_send_queue(&(((VObjectData*)obj_vnode->data)->queue), vlink, VERSE_LINK);
- }
- }
-}
-
-/*
- * creates blender object from verse object node and it
- * will create links between them
- */
-Object *create_object_from_verse_node(VNode *vnode)
-{
- struct Object *ob;
-
- if(vnode->type != V_NT_OBJECT) return NULL;
-
- /* create new object*/
- ob = add_object(OB_MESH);
- /* set up bindings between verse node and blender object */
- ob->vnode = (void*)vnode;
- ((VObjectData*)vnode->data)->object = (void*)ob;
- /* set up flags */
- ((VObjectData*)vnode->data)->flag |= POS_RECEIVE_READY;
- ((VObjectData*)vnode->data)->flag |= ROT_RECEIVE_READY;
- ((VObjectData*)vnode->data)->flag |= SCALE_RECEIVE_READY;
- /* copy name from verse node to object */
- if(vnode->name) {
- char *str;
- str = (char*)MEM_mallocN(sizeof(char)*(strlen(vnode->name)+3), "temp object name");
- str[0] = '\0';
- strcat(str, "OB");
- strcat(str, vnode->name);
- strncpy(ob->id.name, str, 23);
- MEM_freeN(str);
- }
- /* subscribe for object transformation */
- verse_send_o_transform_subscribe(vnode->id, 0);
-
- return ob;
-}
-
-/*
- * Create blender object-mesh from verse object node, verse geometry node,
- */
-void b_verse_pop_node(VNode *vnode)
-{
- if((!vnode) || (!(vnode->data))) return;
-
- if(vnode->type==V_NT_OBJECT) {
- struct VNode *geom_node=NULL;
- struct VLink *vlink;
- struct VLayer *vlayer;
- struct Object *ob;
- struct Mesh *me;
-
- if(((VObjectData*)vnode->data)->object) {
- printf("\tError: already subscribed to object node.\n");
- return;
- }
-
- vlink = ((VObjectData*)vnode->data)->links.lb.first;
-
- /* try to find geometry node */
- while(vlink) {
- if(vlink->target && vlink->target->type==V_NT_GEOMETRY){
- geom_node = vlink->target;
- break;
- }
- vlink = vlink->next;
- }
-
- /* we are not interested now in avatars node, etc. (vnodes without
- * links at geometry node) */
- if(!geom_node) return;
-
- /* subscribe to all verse geometry layer */
- vlayer = ((VGeomData*)geom_node->data)->layers.lb.first;
- while(vlayer) {
- verse_send_g_layer_subscribe(geom_node->id, vlayer->id, 0);
- vlayer = vlayer->next;
- }
-
- ob = create_object_from_verse_node(vnode);
-
- me = create_mesh_from_geom_node(geom_node);
-
- /* set up bindings between object and mesh */
- if(ob && me) ob->data = me;
- }
- else if(vnode->type==V_NT_BITMAP) {
- struct VBitmapData *vbitmap;
- struct VBitmapLayer *vblayer;
- float color[] = {0, 0, 0, 1};
-
- vbitmap = (VBitmapData*)vnode->data;
-
- vblayer = vbitmap->layers.lb.first;
-
- while(vblayer) {
- if(!(vblayer->flag & VBLAYER_SUBSCRIBED)) {
- /* 0 means level of subscription (full resolution) */
- verse_send_b_layer_subscribe(vnode->id, vblayer->id, 0);
- vblayer->flag |= VBLAYER_SUBSCRIBED;
- }
- vblayer = vblayer->next;
- }
-
- if(vbitmap->image) {
- printf("\tError: already subscribed to image node.\n");
- return;
- }
-
- vbitmap->image = (void*)BKE_add_image_size(
- vbitmap->width,
- vbitmap->height,
- vnode->name,
- 0,
- color);
- ((Image*)vbitmap->image)->vnode = (void*)vnode;
- sync_blender_image_with_verse_bitmap_node(vnode);
-
- allqueue(REDRAWIMAGE, 0);
- allqueue(REDRAWVIEW3D, 0);
- }
-}
-
-/*
- * this function will unsubscribe object node from transformation, but it will
- * keep all tags and links at other nodes ... user could subscribe to this node
- * again in future
- */
-void unsubscribe_from_obj_node(VNode *vnode)
-{
- struct VerseSession *session = vnode->session;
- struct VLink *vlink;
-
- if(vnode->type != V_NT_OBJECT) return;
-
- /* unsubscribe from receiving changes of transformation matrix */
- if(session->flag & VERSE_CONNECTED)
- verse_send_o_transform_unsubscribe(vnode->id, 0);
-
- /* we have to reinitialize object node transformation */
- ((VObjectData*)vnode->data)->pos[0] = 0.0f;
- ((VObjectData*)vnode->data)->pos[1] = 0.0f;
- ((VObjectData*)vnode->data)->pos[2] = 0.0f;
-
- ((VObjectData*)vnode->data)->quat[0] = 0.0f;
- ((VObjectData*)vnode->data)->quat[1] = 0.0f;
- ((VObjectData*)vnode->data)->quat[2] = 0.0f;
- ((VObjectData*)vnode->data)->quat[3] = 0.0f;
-
- ((VObjectData*)vnode->data)->scale[0] = 0.0f;
- ((VObjectData*)vnode->data)->scale[1] = 0.0f;
- ((VObjectData*)vnode->data)->scale[2] = 0.0f;
-
- /* clear bindings between object and object node */
- if(((VObjectData*)vnode->data)->object) {
- ((Object*)((VObjectData*)vnode->data)->object)->vnode = NULL;
- ((VObjectData*)vnode->data)->object = NULL;
- }
-
- /* unsubscribe from all supported verse nodes */
- vlink = ((VObjectData*)vnode->data)->links.lb.first;
- while(vlink) {
- if(vlink->target->counter==1) {
- switch(vlink->target->type) {
- case V_NT_OBJECT:
- unsubscribe_from_obj_node(vlink->target);
- break;
- case V_NT_GEOMETRY:
- unsubscribe_from_geom_node(vlink->target);
- break;
- case V_NT_BITMAP:
- unsubscribe_from_bitmap_node(vlink->target);
- break;
- default:
- break;
- }
- }
- vlink = vlink->next;
- }
-}
-
-/*
- * when blender Object is deleted, then we have to unsubscribe and free all
- * VerseNode dependent on this object
- */
-void b_verse_delete_object(Object *object)
-{
- struct VNode *vnode;
-
- vnode = (VNode*)object->vnode;
-
- if(vnode) unsubscribe_from_obj_node(vnode);
-}
-
-/*
- * "fake" unsubscribing from object node and all child nodes
- */
-void b_verse_unsubscribe(VNode *vnode)
-{
- struct VLink *vlink = ((VObjectData*)vnode->data)->links.lb.first;
- struct Object *ob = (Object*)((VObjectData*)vnode->data)->object;
-
- if(vnode->type==V_NT_OBJECT) {
- /* exit edit mode */
- if(G.obedit && G.obedit->vnode == (void*)vnode)
- exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR);
-
- /* when some geometry node is child of this object node, then create mesh data */
- while(vlink){
- if(vlink->target->type == V_NT_GEOMETRY) {
- struct Mesh *me;
- me = ((VGeomData*)vlink->target->data)->mesh;
- create_meshdata_from_geom_node(me, vlink->target);
- break;
- }
- vlink = vlink->next;
- }
-
- /* unsubscribe from object transformation and clear bindings between
- * verse object node and object */
- unsubscribe_from_obj_node(vnode);
-
- /* when geometry node was shared with more object nodes, then make
- * data single user */
- if(ob->type == OB_MESH) {
- struct ID *id = ob->data;
- if(id && id->us>1 && id->lib==0) {
- ob->recalc= OB_RECALC_DATA;
- ob->data = copy_mesh(ob->data);
- id->us--;
- id->newid= ob->data;
- }
- }
-
- /* reinitialize object derived mesh */
- makeDerivedMesh(ob, get_viewedit_datamask());
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- }
- else if(vnode->type==V_NT_BITMAP) {
- /* fake ... it isn't impelemented yet ... poke jiri, when needed */
- unsubscribe_from_bitmap_node(vnode);
- }
-
- allqueue(REDRAWVIEW3D, 1);
-}
-
-/*
- * whe VerseLink is created between two nodes, the Object start to point at
- * coresponding data
- */
-void post_link_set(VLink *vlink)
-{
- struct VNode *target, *source;
- struct Object *ob=NULL;
- struct Mesh *me=NULL;
-
- source = vlink->source;
- target = vlink->target;
-
- if(source->type==V_NT_OBJECT && target->type==V_NT_GEOMETRY){
- if(((VObjectData*)source->data)->object)
- ob = (Object*)((VObjectData*)source->data)->object;
- if(((VGeomData*)target->data)->mesh)
- me = (Mesh*)((VGeomData*)target->data)->mesh;
- if(ob && me && ob->data!=me) {
- ob->data = me;
- makeDerivedMesh(ob, get_viewedit_datamask());
- }
- }
-
- allqueue(REDRAWALL, 1);
-}
-
-/*
- * when VerseLink is deleted, then bindings between Object and data should be removed
- */
-void post_link_destroy(VLink *vlink)
-{
- struct VNode *source, *target;
- struct Object *ob;
-
- source = vlink->source;
- target = vlink->target;
-
- if(source->type==V_NT_OBJECT && target->type==V_NT_GEOMETRY) {
- if(((VObjectData*)source->data)->object) {
- ob = (Object*)((VObjectData*)source->data)->object;
- ob->data=NULL;
- }
- }
-
- allqueue(REDRAWALL, 1);
-}
-
-/*
- * update position of blender object
- */
-void post_transform_pos(VNode *vnode)
-{
- struct VObjectData *obj_data = (VObjectData*)vnode->data;
- struct Object *ob = (Object*)obj_data->object;
-
- VECCOPY(ob->loc, obj_data->pos);
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
-
- allqueue(REDRAWVIEW3D, 1);
-}
-
-/*
- * update rotation of blender object
- */
-void post_transform_rot(VNode *vnode)
-{
- struct VObjectData *obj_data = (VObjectData*)vnode->data;
- struct Object *ob = (Object*)obj_data->object;
-
- /* convert quaternion to euler rotation */
- QuatToEul(obj_data->quat, ob->rot);
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
-
- allqueue(REDRAWVIEW3D, 1);
-}
-
-/*
- * update scale of blender object
- */
-void post_transform_scale(VNode *vnode)
-{
- struct VObjectData *obj_data = (VObjectData*)vnode->data;
- struct Object *ob = (Object*)obj_data->object;
-
- VECCOPY(ob->size, obj_data->scale);
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
-
- allqueue(REDRAWVIEW3D, 1);
-}
-
-/*
- * send transformation of Object to verse server
- */
-void b_verse_send_transformation(Object *ob)
-{
- struct VNode *vnode= ob->vnode;
- float quat[4];
-
- if(!vnode) return;
-
- /* if last sent position wasn't received yet, then next change of position
- * can't be send until last send change is received */
- if( ((VObjectData*)vnode->data)->flag & POS_SEND_READY ) {
- if((((VObjectData*)vnode->data)->pos[0]!=ob->loc[0]) ||
- (((VObjectData*)vnode->data)->pos[1]!=ob->loc[1]) ||
- (((VObjectData*)vnode->data)->pos[2]!=ob->loc[2])) {
- VECCOPY(((VObjectData*)vnode->data)->pos, ob->loc);
- send_verse_object_position(vnode);
- }
- }
-
- /* if last sent rotation wasn't received yet, then next change of rotation
- * can't be send until last send change is received */
- if( ((VObjectData*)vnode->data)->flag & ROT_SEND_READY ) {
- EulToQuat(ob->rot, quat);
-
- if((((VObjectData*)vnode->data)->quat[0] != quat[0]) ||
- (((VObjectData*)vnode->data)->quat[1] != quat[1]) ||
- (((VObjectData*)vnode->data)->quat[2] != quat[2]) ||
- (((VObjectData*)vnode->data)->quat[3] != quat[3])) {
- QUATCOPY(((VObjectData*)vnode->data)->quat, quat);
- send_verse_object_rotation(vnode);
- }
- }
-
- /* if last sent object size wasn't received yet, then next change of object size
- * can't be send until last send change is received */
- if( ((VObjectData*)vnode->data)->flag & SCALE_SEND_READY ) {
- if((((VObjectData*)vnode->data)->scale[0]!=ob->size[0]) ||
- (((VObjectData*)vnode->data)->scale[1]!=ob->size[1]) ||
- (((VObjectData*)vnode->data)->scale[2]!=ob->size[2])) {
- VECCOPY(((VObjectData*)vnode->data)->scale, ob->size);
- send_verse_object_scale(vnode);
- }
- }
-
- verse_callback_update(0);
-}
-
-/*
- * free constraint between object VerseNode and blender Object
- */
-void post_object_free_constraint(VNode *vnode)
-{
- if(((VObjectData*)vnode->data)->object) {
- /* free pointer at verse derived mesh */
- struct Object *ob = (Object*)((VObjectData*)vnode->data)->object;
- if(ob) {
- if(ob->derivedFinal) {
- ob->derivedFinal->needsFree = 1;
- ob->derivedFinal->release((DerivedMesh*)ob->derivedFinal);
- ob->derivedFinal = NULL;
- }
- if(ob->derivedDeform) {
- ob->derivedDeform->needsFree = 1;
- ob->derivedDeform->release((DerivedMesh*)ob->derivedDeform);
- ob->derivedDeform = NULL;
- }
- }
- /* free constraint */
- ((Object*)((VObjectData*)vnode->data)->object)->vnode = NULL;
- ((VObjectData*)vnode->data)->object = NULL;
- }
-}
-
-#endif
-
diff --git a/source/blender/src/view.c b/source/blender/src/view.c
deleted file mode 100644
index d23b6f1d8f4..00000000000
--- a/source/blender/src/view.c
+++ /dev/null
@@ -1,1863 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * Trackball math (in calctrackballvec()) Copyright (C) Silicon Graphics, Inc.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <math.h>
-#include <string.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef WIN32
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "DNA_action_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_object_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_space_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_view3d_types.h"
-
-#include "BKE_action.h"
-#include "BKE_anim.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_object.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_editparticle.h"
-#include "BIF_gl.h"
-#include "BIF_previewrender.h"
-#include "BIF_mywindow.h"
-#include "BIF_retopo.h"
-#include "BIF_space.h"
-#include "BIF_screen.h"
-#include "BIF_toolbox.h"
-
-#include "BSE_view.h"
-#include "BSE_edit.h" /* For countall */
-#include "BSE_drawview.h" /* For inner_play_anim_loop */
-
-#include "BDR_drawobject.h" /* For draw_object */
-#include "BDR_editface.h" /* For minmax_tface */
-#include "BDR_sculptmode.h"
-
-#include "mydevice.h"
-#include "blendef.h"
-
-#include "PIL_time.h" /* smoothview */
-
-#define TRACKBALLSIZE (1.1)
-#define BL_NEAR_CLIP 0.001
-
-
-/* local prototypes ----------*/
-void setcameratoview3d(void); /* windows.c & toets.c */
-
-void persp_general(int a)
-{
- /* for all window types, not 3D */
-
- if(a== 0) {
- glPushMatrix();
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glMatrixMode(GL_MODELVIEW);
-
- myortho2(-0.375, ((float)(curarea->winx))-0.375, -0.375, ((float)(curarea->winy))-0.375);
- glLoadIdentity();
- }
- else if(a== 1) {
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
- }
-}
-
-void persp(int a)
-{
- /* only 3D windows */
-
- if(curarea->spacetype!=SPACE_VIEW3D) persp_general(a);
- else if(a == PERSP_STORE) { // only store
- glMatrixMode(GL_PROJECTION);
- mygetmatrix(G.vd->winmat1);
- glMatrixMode(GL_MODELVIEW);
- mygetmatrix(G.vd->viewmat1);
- }
- else if(a== PERSP_WIN) { // only set
- myortho2(-0.375, (float)(curarea->winx)-0.375, -0.375, (float)(curarea->winy)-0.375);
- glLoadIdentity();
- }
- else if(a== PERSP_VIEW) {
- glMatrixMode(GL_PROJECTION);
- myloadmatrix(G.vd->winmat1); // put back
- Mat4CpyMat4(curarea->winmat, G.vd->winmat1); // to be sure?
- glMatrixMode(GL_MODELVIEW);
- myloadmatrix(G.vd->viewmat); // put back
-
- }
-}
-
-
-void initgrabz(float x, float y, float z)
-{
- if(G.vd==NULL) return;
- G.vd->zfac= G.vd->persmat[0][3]*x+ G.vd->persmat[1][3]*y+ G.vd->persmat[2][3]*z+ G.vd->persmat[3][3];
-
- /* if x,y,z is exactly the viewport offset, zfac is 0 and we don't want that
- * (accounting for near zero values)
- * */
- if (G.vd->zfac < 1.e-6f && G.vd->zfac > -1.e-6f) G.vd->zfac = 1.0f;
-
- /* Negative zfac means x, y, z was behind the camera (in perspective).
- * This gives flipped directions, so revert back to ok default case.
- */
- if (G.vd->zfac < 0.0f) G.vd->zfac = 1.0f;
-}
-
-void window_to_3d(float *vec, short mx, short my)
-{
- /* always call initgrabz */
- float dx, dy;
-
- dx= 2.0f*mx*G.vd->zfac/curarea->winx;
- dy= 2.0f*my*G.vd->zfac/curarea->winy;
-
- vec[0]= (G.vd->persinv[0][0]*dx + G.vd->persinv[1][0]*dy);
- vec[1]= (G.vd->persinv[0][1]*dx + G.vd->persinv[1][1]*dy);
- vec[2]= (G.vd->persinv[0][2]*dx + G.vd->persinv[1][2]*dy);
-}
-
-void project_short(float *vec, short *adr) /* clips */
-{
- float fx, fy, vec4[4];
-
- adr[0]= IS_CLIPPED;
-
- if(G.vd->flag & V3D_CLIPPING) {
- if(view3d_test_clipping(G.vd, vec))
- return;
- }
-
- VECCOPY(vec4, vec);
- vec4[3]= 1.0;
- Mat4MulVec4fl(G.vd->persmat, vec4);
-
- if( vec4[3]>BL_NEAR_CLIP ) { /* 0.001 is the NEAR clipping cutoff for picking */
- fx= (curarea->winx/2)*(1 + vec4[0]/vec4[3]);
-
- if( fx>0 && fx<curarea->winx) {
-
- fy= (curarea->winy/2)*(1 + vec4[1]/vec4[3]);
-
- if(fy>0.0 && fy< (float)curarea->winy) {
- adr[0]= floor(fx);
- adr[1]= floor(fy);
- }
- }
- }
-}
-
-void project_int(float *vec, int *adr)
-{
- float fx, fy, vec4[4];
-
- adr[0]= 2140000000.0f;
- VECCOPY(vec4, vec);
- vec4[3]= 1.0;
-
- Mat4MulVec4fl(G.vd->persmat, vec4);
-
- if( vec4[3]>BL_NEAR_CLIP ) { /* 0.001 is the NEAR clipping cutoff for picking */
- fx= (curarea->winx/2)*(1 + vec4[0]/vec4[3]);
-
- if( fx>-2140000000.0f && fx<2140000000.0f) {
- fy= (curarea->winy/2)*(1 + vec4[1]/vec4[3]);
-
- if(fy>-2140000000.0f && fy<2140000000.0f) {
- adr[0]= floor(fx);
- adr[1]= floor(fy);
- }
- }
- }
-}
-
-void project_short_noclip(float *vec, short *adr)
-{
- float fx, fy, vec4[4];
-
- adr[0]= IS_CLIPPED;
- VECCOPY(vec4, vec);
- vec4[3]= 1.0;
-
- Mat4MulVec4fl(G.vd->persmat, vec4);
-
- if( vec4[3]>BL_NEAR_CLIP ) { /* 0.001 is the NEAR clipping cutoff for picking */
- fx= (curarea->winx/2)*(1 + vec4[0]/vec4[3]);
-
- if( fx>-32700 && fx<32700) {
-
- fy= (curarea->winy/2)*(1 + vec4[1]/vec4[3]);
-
- if(fy>-32700.0 && fy<32700.0) {
- adr[0]= floor(fx);
- adr[1]= floor(fy);
- }
- }
- }
-}
-
-void project_float(float *vec, float *adr)
-{
- float vec4[4];
-
- adr[0]= IS_CLIPPED;
- VECCOPY(vec4, vec);
- vec4[3]= 1.0;
-
- Mat4MulVec4fl(G.vd->persmat, vec4);
-
- if( vec4[3]>BL_NEAR_CLIP ) {
- adr[0]= (curarea->winx/2.0)+(curarea->winx/2.0)*vec4[0]/vec4[3];
- adr[1]= (curarea->winy/2.0)+(curarea->winy/2.0)*vec4[1]/vec4[3];
- }
-}
-
-void view3d_get_object_project_mat(ScrArea *area, Object *ob, float pmat[4][4], float vmat[4][4])
-{
- if (area->spacetype!=SPACE_VIEW3D || !area->spacedata.first) {
- Mat4One(pmat);
- Mat4One(vmat);
- } else {
- View3D *vd = area->spacedata.first;
-
- Mat4MulMat4(vmat, ob->obmat, vd->viewmat);
- Mat4MulMat4(pmat, vmat, vd->winmat1);
- Mat4CpyMat4(vmat, ob->obmat);
- }
-}
-
-/* projectmat brings it to window coords, wmat to rotated world space */
-void view3d_project_short_clip(ScrArea *area, float *vec, short *adr, float projmat[4][4], float wmat[4][4])
-{
- View3D *v3d= area->spacedata.first;
- float fx, fy, vec4[4];
-
- adr[0]= IS_CLIPPED;
-
- /* clipplanes in eye space */
- if(v3d->flag & V3D_CLIPPING) {
- VECCOPY(vec4, vec);
- Mat4MulVecfl(wmat, vec4);
- if(view3d_test_clipping(v3d, vec4))
- return;
- }
-
- VECCOPY(vec4, vec);
- vec4[3]= 1.0;
-
- Mat4MulVec4fl(projmat, vec4);
-
- /* clipplanes in window space */
- if( vec4[3]>BL_NEAR_CLIP ) { /* 0.001 is the NEAR clipping cutoff for picking */
- fx= (area->winx/2)*(1 + vec4[0]/vec4[3]);
-
- if( fx>0 && fx<area->winx) {
-
- fy= (area->winy/2)*(1 + vec4[1]/vec4[3]);
-
- if(fy>0.0 && fy< (float)area->winy) {
- adr[0]= floor(fx);
- adr[1]= floor(fy);
- }
- }
- }
-}
-
-void view3d_project_short_noclip(ScrArea *area, float *vec, short *adr, float mat[4][4])
-{
- float fx, fy, vec4[4];
-
- adr[0]= IS_CLIPPED;
-
- VECCOPY(vec4, vec);
- vec4[3]= 1.0;
-
- Mat4MulVec4fl(mat, vec4);
-
- if( vec4[3]>BL_NEAR_CLIP ) { /* 0.001 is the NEAR clipping cutoff for picking */
- fx= (area->winx/2)*(1 + vec4[0]/vec4[3]);
-
- if( fx>-32700 && fx<32700) {
-
- fy= (area->winy/2)*(1 + vec4[1]/vec4[3]);
-
- if(fy>-32700.0 && fy<32700.0) {
- adr[0]= floor(fx);
- adr[1]= floor(fy);
- }
- }
- }
-}
-
-void view3d_project_float(ScrArea *area, float *vec, float *adr, float mat[4][4])
-{
- float vec4[4];
-
- adr[0]= IS_CLIPPED;
- VECCOPY(vec4, vec);
- vec4[3]= 1.0;
-
- Mat4MulVec4fl(mat, vec4);
-
- if( vec4[3]>FLT_EPSILON ) {
- adr[0] = (area->winx/2.0)+(area->winx/2.0)*vec4[0]/vec4[3];
- adr[1] = (area->winy/2.0)+(area->winy/2.0)*vec4[1]/vec4[3];
- } else {
- adr[0] = adr[1] = 0.0;
- }
-}
-
-int boundbox_clip(float obmat[][4], BoundBox *bb)
-{
- /* return 1: draw */
-
- float mat[4][4];
- float vec[4], min, max;
- int a, flag= -1, fl;
-
- if(bb==NULL) return 1;
- if(bb->flag & OB_BB_DISABLED) return 1;
-
- Mat4MulMat4(mat, obmat, G.vd->persmat);
-
- for(a=0; a<8; a++) {
- VECCOPY(vec, bb->vec[a]);
- vec[3]= 1.0;
- Mat4MulVec4fl(mat, vec);
- max= vec[3];
- min= -vec[3];
-
- fl= 0;
- if(vec[0] < min) fl+= 1;
- if(vec[0] > max) fl+= 2;
- if(vec[1] < min) fl+= 4;
- if(vec[1] > max) fl+= 8;
- if(vec[2] < min) fl+= 16;
- if(vec[2] > max) fl+= 32;
-
- flag &= fl;
- if(flag==0) return 1;
- }
-
- return 0;
-
-}
-
-void fdrawline(float x1, float y1, float x2, float y2)
-{
- float v[2];
-
- glBegin(GL_LINE_STRIP);
- v[0] = x1; v[1] = y1;
- glVertex2fv(v);
- v[0] = x2; v[1] = y2;
- glVertex2fv(v);
- glEnd();
-}
-
-void fdrawbox(float x1, float y1, float x2, float y2)
-{
- float v[2];
-
- glBegin(GL_LINE_STRIP);
-
- v[0] = x1; v[1] = y1;
- glVertex2fv(v);
- v[0] = x1; v[1] = y2;
- glVertex2fv(v);
- v[0] = x2; v[1] = y2;
- glVertex2fv(v);
- v[0] = x2; v[1] = y1;
- glVertex2fv(v);
- v[0] = x1; v[1] = y1;
- glVertex2fv(v);
-
- glEnd();
-}
-
-void sdrawline(short x1, short y1, short x2, short y2)
-{
- short v[2];
-
- glBegin(GL_LINE_STRIP);
- v[0] = x1; v[1] = y1;
- glVertex2sv(v);
- v[0] = x2; v[1] = y2;
- glVertex2sv(v);
- glEnd();
-}
-
-void sdrawbox(short x1, short y1, short x2, short y2)
-{
- short v[2];
-
- glBegin(GL_LINE_STRIP);
-
- v[0] = x1; v[1] = y1;
- glVertex2sv(v);
- v[0] = x1; v[1] = y2;
- glVertex2sv(v);
- v[0] = x2; v[1] = y2;
- glVertex2sv(v);
- v[0] = x2; v[1] = y1;
- glVertex2sv(v);
- v[0] = x1; v[1] = y1;
- glVertex2sv(v);
-
- glEnd();
-}
-
-/* the central math in this function was copied from trackball.cpp, sample code from the
- Developers Toolbox series by SGI. */
-
-/* trackball: better one than a full spherical solution */
-
-void calctrackballvecfirst(rcti *area, short *mval, float *vec)
-{
- float x, y, radius, d, z, t;
-
- radius= TRACKBALLSIZE;
-
- /* normalize x and y */
- x= (area->xmax + area->xmin)/2 -mval[0];
- x/= (float)((area->xmax - area->xmin)/2);
- y= (area->ymax + area->ymin)/2 -mval[1];
- y/= (float)((area->ymax - area->ymin)/2);
-
- d = sqrt(x*x + y*y);
- if (d < radius*M_SQRT1_2) /* Inside sphere */
- z = sqrt(radius*radius - d*d);
- else
- { /* On hyperbola */
- t = radius / M_SQRT2;
- z = t*t / d;
- }
-
- vec[0]= x;
- vec[1]= y;
- vec[2]= -z; /* yah yah! */
-
- if( fabs(vec[2])>fabs(vec[1]) && fabs(vec[2])>fabs(vec[0]) ) {
- vec[0]= 0.0;
- vec[1]= 0.0;
- if(vec[2]>0.0) vec[2]= 1.0; else vec[2]= -1.0;
- }
- else if( fabs(vec[1])>fabs(vec[0]) && fabs(vec[1])>fabs(vec[2]) ) {
- vec[0]= 0.0;
- vec[2]= 0.0;
- if(vec[1]>0.0) vec[1]= 1.0; else vec[1]= -1.0;
- }
- else {
- vec[1]= 0.0;
- vec[2]= 0.0;
- if(vec[0]>0.0) vec[0]= 1.0; else vec[0]= -1.0;
- }
-}
-
-void calctrackballvec(rcti *area, short *mval, float *vec)
-{
- float x, y, radius, d, z, t;
-
- radius= TRACKBALLSIZE;
-
- /* x en y normalizeren */
- x= (area->xmax + area->xmin)/2 -mval[0];
- x/= (float)((area->xmax - area->xmin)/4);
- y= (area->ymax + area->ymin)/2 -mval[1];
- y/= (float)((area->ymax - area->ymin)/2);
-
- d = sqrt(x*x + y*y);
- if (d < radius*M_SQRT1_2) /* Inside sphere */
- z = sqrt(radius*radius - d*d);
- else
- { /* On hyperbola */
- t = radius / M_SQRT2;
- z = t*t / d;
- }
-
- vec[0]= x;
- vec[1]= y;
- vec[2]= -z; /* yah yah! */
-
-}
-
-void viewmove(int mode)
-{
- Object *ob = OBACT;
- float firstvec[3], newvec[3], dvec[3];
- float reverse, oldquat[4], q1[4], si, phi, dist0;
- float ofs[3], obofs[3]= {0.0f, 0.0f, 0.0f};
- int firsttime=1;
- short mvalball[2], mval[2], mvalo[2], mval_area[2];
- short use_sel = 0;
- short preview3d_event= 1;
-
- /* 3D window may not be defined */
- if( !G.vd ) {
- fprintf( stderr, "G.vd == NULL in viewmove()\n" );
- return;
- }
-
- /* sometimes this routine is called from headerbuttons */
-
- areawinset(curarea->win);
-
- initgrabz(-G.vd->ofs[0], -G.vd->ofs[1], -G.vd->ofs[2]);
-
- QUATCOPY(oldquat, G.vd->viewquat);
-
- getmouseco_areawin(mval_area); /* for zoom to mouse loc */
- getmouseco_sc(mvalo); /* work with screen coordinates because of trackball function */
- mvalball[0]= mvalo[0]; /* needed for turntable to work */
- mvalball[1]= mvalo[1];
- dist0= G.vd->dist;
-
- calctrackballvec(&curarea->winrct, mvalo, firstvec);
-
- /* cumultime(0); */
-
- if(!G.obedit && (G.f & G_SCULPTMODE) && ob && G.vd->pivot_last) {
- use_sel= 1;
- VecCopyf(ofs, G.vd->ofs);
-
- VecCopyf(obofs,&sculpt_session()->pivot.x);
- Mat4MulVecfl(ob->obmat, obofs);
- obofs[0]= -obofs[0];
- obofs[1]= -obofs[1];
- obofs[2]= -obofs[2];
- }
- else if (ob && (U.uiflag & USER_ORBIT_SELECTION)) {
- use_sel = 1;
-
- VECCOPY(ofs, G.vd->ofs);
-
- /* If there's no selection, obofs is unmodified, so <0,0,0> */
- calculateTransformCenter(V3D_CENTROID, obofs);
- VecMulf(obofs, -1.0f);
- }
- else
- ofs[0] = ofs[1] = ofs[2] = 0.0f;
-
- reverse= 1.0f;
- if (G.vd->persmat[2][1] < 0.0f)
- reverse= -1.0f;
-
- while(TRUE) {
- getmouseco_sc(mval);
-
- // if playanim = alt+A, screenhandlers are for animated UI, python, etc
- if(mval[0]!=mvalo[0] || mval[1]!=mvalo[1] || (G.f & G_PLAYANIM) || do_screenhandlers(G.curscreen)) {
-
- if(firsttime) {
-
- firsttime= 0;
- /* are we translating, rotating or zooming? */
- if(mode==0) {
- if(G.vd->view!=0) scrarea_queue_headredraw(curarea); /*for button */
- G.vd->view= 0;
- }
- if(G.vd->persp==2 && mode!=1 && G.vd->camera) {
- G.vd->persp= 1;
- scrarea_do_windraw(curarea);
- scrarea_queue_headredraw(curarea);
- }
- }
-
- if(mode==0) { /* view rotate */
- if (U.uiflag & USER_AUTOPERSP) G.vd->persp= 1;
-
- if (U.flag & USER_TRACKBALL) mvalball[0]= mval[0];
- mvalball[1]= mval[1];
-
- calctrackballvec(&curarea->winrct, mvalball, newvec);
-
- VecSubf(dvec, newvec, firstvec);
-
- si= sqrt(dvec[0]*dvec[0]+ dvec[1]*dvec[1]+ dvec[2]*dvec[2]);
- si/= (2.0*TRACKBALLSIZE);
-
- if (U.flag & USER_TRACKBALL) {
- Crossf(q1+1, firstvec, newvec);
-
- Normalize(q1+1);
-
- /* Allow for rotation beyond the interval
- * [-pi, pi] */
- while (si > 1.0)
- si -= 2.0;
-
- /* This relation is used instead of
- * phi = asin(si) so that the angle
- * of rotation is linearly proportional
- * to the distance that the mouse is
- * dragged. */
- phi = si * M_PI / 2.0;
-
- si= sin(phi);
- q1[0]= cos(phi);
- q1[1]*= si;
- q1[2]*= si;
- q1[3]*= si;
- QuatMul(G.vd->viewquat, q1, oldquat);
-
- if (use_sel) {
- /* compute the post multiplication quat, to rotate the offset correctly */
- QUATCOPY(q1, oldquat);
- QuatConj(q1);
- QuatMul(q1, q1, G.vd->viewquat);
-
- QuatConj(q1); /* conj == inv for unit quat */
- VECCOPY(G.vd->ofs, ofs);
- VecSubf(G.vd->ofs, G.vd->ofs, obofs);
- QuatMulVecf(q1, G.vd->ofs);
- VecAddf(G.vd->ofs, G.vd->ofs, obofs);
- }
- } else {
- /* New turntable view code by John Aughey */
-
- float m[3][3];
- float m_inv[3][3];
- float xvec[3] = {1,0,0};
- /* Sensitivity will control how fast the viewport rotates. 0.0035 was
- obtained experimentally by looking at viewport rotation sensitivities
- on other modeling programs. */
- /* Perhaps this should be a configurable user parameter. */
- const float sensitivity = 0.0035;
-
- /* Get the 3x3 matrix and its inverse from the quaternion */
- QuatToMat3(G.vd->viewquat, m);
- Mat3Inv(m_inv,m);
-
- /* Determine the direction of the x vector (for rotating up and down) */
- /* This can likely be compuated directly from the quaternion. */
- Mat3MulVecfl(m_inv,xvec);
-
- /* Perform the up/down rotation */
- phi = sensitivity * -(mval[1] - mvalo[1]);
- si = sin(phi);
- q1[0] = cos(phi);
- q1[1] = si * xvec[0];
- q1[2] = si * xvec[1];
- q1[3] = si * xvec[2];
- QuatMul(G.vd->viewquat, G.vd->viewquat, q1);
-
- if (use_sel) {
- QuatConj(q1); /* conj == inv for unit quat */
- VecSubf(G.vd->ofs, G.vd->ofs, obofs);
- QuatMulVecf(q1, G.vd->ofs);
- VecAddf(G.vd->ofs, G.vd->ofs, obofs);
- }
-
- /* Perform the orbital rotation */
- phi = sensitivity * reverse * (mval[0] - mvalo[0]);
- q1[0] = cos(phi);
- q1[1] = q1[2] = 0.0;
- q1[3] = sin(phi);
- QuatMul(G.vd->viewquat, G.vd->viewquat, q1);
-
- if (use_sel) {
- QuatConj(q1);
- VecSubf(G.vd->ofs, G.vd->ofs, obofs);
- QuatMulVecf(q1, G.vd->ofs);
- VecAddf(G.vd->ofs, G.vd->ofs, obofs);
- }
- }
- }
- else if(mode==1) { /* translate */
- if(G.vd->persp==2) {
- float max= (float)MAX2(curarea->winx, curarea->winy);
-
- G.vd->camdx += (mvalo[0]-mval[0])/(max);
- G.vd->camdy += (mvalo[1]-mval[1])/(max);
- CLAMP(G.vd->camdx, -1.0f, 1.0f);
- CLAMP(G.vd->camdy, -1.0f, 1.0f);
- preview3d_event= 0;
- }
- else {
- window_to_3d(dvec, mval[0]-mvalo[0], mval[1]-mvalo[1]);
- VecAddf(G.vd->ofs, G.vd->ofs, dvec);
- }
- }
- else if(mode==2) {
- float zfac=1.0;
- if(U.viewzoom==USER_ZOOM_CONT) {
- // oldstyle zoom
- zfac = 1.0+(float)(mvalo[0]-mval[0]+mvalo[1]-mval[1])/1000.0;
- }
- else if(U.viewzoom==USER_ZOOM_SCALE) {
- int ctr[2], len1, len2;
- // method which zooms based on how far you move the mouse
-
- ctr[0] = (curarea->winrct.xmax + curarea->winrct.xmin)/2;
- ctr[1] = (curarea->winrct.ymax + curarea->winrct.ymin)/2;
-
- len1 = (int)sqrt((ctr[0] - mval[0])*(ctr[0] - mval[0]) + (ctr[1] - mval[1])*(ctr[1] - mval[1])) + 5;
- len2 = (int)sqrt((ctr[0] - mvalo[0])*(ctr[0] - mvalo[0]) + (ctr[1] - mvalo[1])*(ctr[1] - mvalo[1])) + 5;
-
- zfac = dist0 * ((float)len2/len1) / G.vd->dist;
- }
- else { /* USER_ZOOM_DOLLY */
- float len1 = (curarea->winrct.ymax - mval[1]) + 5;
- float len2 = (curarea->winrct.ymax - mvalo[1]) + 5;
- zfac = dist0 * (2.0*((len2/len1)-1.0) + 1.0) / G.vd->dist;
- }
-
- if(zfac != 1.0 && zfac*G.vd->dist > 0.001*G.vd->grid &&
- zfac*G.vd->dist < 10.0*G.vd->far)
- view_zoom_mouseloc(zfac, mval_area);
-
- /* these limits are in toets.c too */
- if(G.vd->dist<0.001*G.vd->grid) G.vd->dist= 0.001*G.vd->grid;
- if(G.vd->dist>10.0*G.vd->far) G.vd->dist=10.0*G.vd->far;
-
- mval[1]= mvalo[1]; /* preserve first value */
- mval[0]= mvalo[0];
-
- if(G.vd->persp==0 || G.vd->persp==2) preview3d_event= 0;
- }
-
- mvalo[0]= mval[0];
- mvalo[1]= mval[1];
-
- if(G.f & G_PLAYANIM) inner_play_anim_loop(0, 0);
- if(G.f & G_SIMULATION) break;
-
- /* If in retopo paint mode, update lines */
- if(retopo_mesh_paint_check() && G.vd->retopo_view_data) {
- G.vd->retopo_view_data->queue_matrix_update= 1;
- retopo_paint_view_update(G.vd);
- }
-
- scrarea_do_windraw(curarea);
- screen_swapbuffers();
- }
- else {
- short val;
- unsigned short event;
- /* we need to empty the queue... when you do this very long it overflows */
- while(qtest()) event= extern_qread(&val);
-
- BIF_wait_for_statechange();
- }
-
- /* this in the end, otherwise get_mbut does not work on a PC... */
- if( !(get_mbut() & (L_MOUSE|M_MOUSE))) break;
- }
-
- if(G.vd->depths) G.vd->depths->damaged= 1;
- retopo_queue_updates(G.vd);
- allqueue(REDRAWVIEW3D, 0);
-
- if(preview3d_event)
- BIF_view3d_previewrender_signal(curarea, PR_DBASE|PR_DISPRECT);
- else
- BIF_view3d_previewrender_signal(curarea, PR_PROJECTED);
-
-}
-
-void view_zoom_mouseloc(float dfac, short *mouseloc)
-{
- if(U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
- short vb[2];
- float dvec[3];
- float tvec[3];
- float tpos[3];
- float new_dist;
-
- /* find the current window width and height */
- vb[0] = G.vd->area->winx;
- vb[1] = G.vd->area->winy;
-
- tpos[0] = -G.vd->ofs[0];
- tpos[1] = -G.vd->ofs[1];
- tpos[2] = -G.vd->ofs[2];
-
- /* Project cursor position into 3D space */
- initgrabz(tpos[0], tpos[1], tpos[2]);
- window_to_3d(dvec, mouseloc[0]-vb[0]/2, mouseloc[1]-vb[1]/2);
-
- /* Calculate view target position for dolly */
- tvec[0] = -(tpos[0] + dvec[0]);
- tvec[1] = -(tpos[1] + dvec[1]);
- tvec[2] = -(tpos[2] + dvec[2]);
-
- /* Offset to target position and dolly */
- new_dist = G.vd->dist * dfac;
-
- VECCOPY(G.vd->ofs, tvec);
- G.vd->dist = new_dist;
-
- /* Calculate final offset */
- dvec[0] = tvec[0] + dvec[0] * dfac;
- dvec[1] = tvec[1] + dvec[1] * dfac;
- dvec[2] = tvec[2] + dvec[2] * dfac;
-
- VECCOPY(G.vd->ofs, dvec);
- } else {
- G.vd->dist *= dfac;
- }
-}
-
-/* Gets the lens and clipping values from a camera of lamp type object */
-void object_view_settings(Object *ob, float *lens, float *clipsta, float *clipend)
-{
- if (!ob) return;
-
- if(ob->type==OB_LAMP ) {
- Lamp *la = ob->data;
- if (lens) {
- float x1, fac;
- fac= cos( M_PI*la->spotsize/360.0);
- x1= saacos(fac);
- *lens= 16.0*fac/sin(x1);
- }
- if (clipsta) *clipsta= la->clipsta;
- if (clipend) *clipend= la->clipend;
- }
- else if(ob->type==OB_CAMERA) {
- Camera *cam= ob->data;
- if (lens) *lens= cam->lens;
- if (clipsta) *clipsta= cam->clipsta;
- if (clipend) *clipend= cam->clipend;
- }
-}
-
-
-int get_view3d_viewplane(int winxi, int winyi, rctf *viewplane, float *clipsta, float *clipend, float *pixsize)
-{
- Camera *cam=NULL;
- float lens, fac, x1, y1, x2, y2;
- float winx= (float)winxi, winy= (float)winyi;
- int orth= 0;
-
- lens= G.vd->lens;
-
- *clipsta= G.vd->near;
- *clipend= G.vd->far;
-
-/*
- * Cant use this since we need the fac and x1 values set
- * if(G.vd->persp==2)
- object_view_settings(G.vd->camera, &lens, &(*clipsta), &(*clipend));*/
-
- if(G.vd->persp==2) {
- if(G.vd->camera) {
- if(G.vd->camera->type==OB_LAMP ) {
- Lamp *la;
-
- la= G.vd->camera->data;
- fac= cos( M_PI*la->spotsize/360.0);
-
- x1= saacos(fac);
- lens= 16.0*fac/sin(x1);
-
- *clipsta= la->clipsta;
- *clipend= la->clipend;
- }
- else if(G.vd->camera->type==OB_CAMERA) {
- cam= G.vd->camera->data;
- lens= cam->lens;
- *clipsta= cam->clipsta;
- *clipend= cam->clipend;
- }
- }
- }
-
- if(G.vd->persp==0) {
- if(winx>winy) x1= -G.vd->dist;
- else x1= -winx*G.vd->dist/winy;
- x2= -x1;
-
- if(winx>winy) y1= -winy*G.vd->dist/winx;
- else y1= -G.vd->dist;
- y2= -y1;
-
- *clipend *= 0.5; // otherwise too extreme low zbuffer quality
- *clipsta= - *clipend;
- orth= 1;
- }
- else {
- /* fac for zoom, also used for camdx */
- if(G.vd->persp==2) {
- fac= (1.41421+( (float)G.vd->camzoom )/50.0);
- fac*= fac;
- }
- else fac= 2.0;
-
- /* viewplane size depends... */
- if(cam && cam->type==CAM_ORTHO) {
- /* ortho_scale == 1 means exact 1 to 1 mapping */
- float dfac= 2.0*cam->ortho_scale/fac;
-
- if(winx>winy) x1= -dfac;
- else x1= -winx*dfac/winy;
- x2= -x1;
-
- if(winx>winy) y1= -winy*dfac/winx;
- else y1= -dfac;
- y2= -y1;
- orth= 1;
- }
- else {
- float dfac;
-
- if(winx>winy) dfac= 64.0/(fac*winx*lens);
- else dfac= 64.0/(fac*winy*lens);
-
- x1= - *clipsta * winx*dfac;
- x2= -x1;
- y1= - *clipsta * winy*dfac;
- y2= -y1;
- orth= 0;
- }
- /* cam view offset */
- if(cam) {
- float dx= 0.5*fac*G.vd->camdx*(x2-x1);
- float dy= 0.5*fac*G.vd->camdy*(y2-y1);
- x1+= dx;
- x2+= dx;
- y1+= dy;
- y2+= dy;
- }
- }
-
- if(pixsize) {
- float viewfac;
-
- if(orth) {
- viewfac= (winx >= winy)? winx: winy;
- *pixsize= 1.0f/viewfac;
- }
- else {
- viewfac= (((winx >= winy)? winx: winy)*lens)/32.0;
- *pixsize= *clipsta/viewfac;
- }
- }
-
- viewplane->xmin= x1;
- viewplane->ymin= y1;
- viewplane->xmax= x2;
- viewplane->ymax= y2;
-
- return orth;
-}
-
-/* important to not set windows active in here, can be renderwin for example */
-void setwinmatrixview3d(int winx, int winy, rctf *rect) /* rect: for picking */
-{
- rctf viewplane;
- float clipsta, clipend, x1, y1, x2, y2;
- int orth;
-
- orth= get_view3d_viewplane(winx, winy, &viewplane, &clipsta, &clipend, NULL);
-// printf("%d %d %f %f %f %f %f %f\n", winx, winy, viewplane.xmin, viewplane.ymin, viewplane.xmax, viewplane.ymax, clipsta, clipend);
- x1= viewplane.xmin;
- y1= viewplane.ymin;
- x2= viewplane.xmax;
- y2= viewplane.ymax;
-
- if(rect) { /* picking */
- rect->xmin/= (float)curarea->winx;
- rect->xmin= x1+rect->xmin*(x2-x1);
- rect->ymin/= (float)curarea->winy;
- rect->ymin= y1+rect->ymin*(y2-y1);
- rect->xmax/= (float)curarea->winx;
- rect->xmax= x1+rect->xmax*(x2-x1);
- rect->ymax/= (float)curarea->winy;
- rect->ymax= y1+rect->ymax*(y2-y1);
-
- if(orth) myortho(rect->xmin, rect->xmax, rect->ymin, rect->ymax, -clipend, clipend);
- else mywindow(rect->xmin, rect->xmax, rect->ymin, rect->ymax, clipsta, clipend);
-
- }
- else {
- if(orth) myortho(x1, x2, y1, y2, clipsta, clipend);
- else mywindow(x1, x2, y1, y2, clipsta, clipend);
- }
-
- /* not sure what this was for? (ton) */
- glMatrixMode(GL_PROJECTION);
- mygetmatrix(curarea->winmat);
- glMatrixMode(GL_MODELVIEW);
-}
-
-void obmat_to_viewmat(Object *ob, short smooth)
-{
- float bmat[4][4];
- float tmat[3][3];
-
- Mat4CpyMat4(bmat, ob->obmat);
- Mat4Ortho(bmat);
- Mat4Invert(G.vd->viewmat, bmat);
-
- /* view quat calculation, needed for add object */
- Mat3CpyMat4(tmat, G.vd->viewmat);
- if (smooth) {
- float new_quat[4];
- if (G.vd->persp==2 && G.vd->camera) {
- /* were from a camera view */
-
- float orig_ofs[3];
- float orig_dist= G.vd->dist;
- float orig_lens= G.vd->lens;
- VECCOPY(orig_ofs, G.vd->ofs);
-
- /* Switch from camera view */
- Mat3ToQuat(tmat, new_quat);
-
- G.vd->persp=1;
- G.vd->dist= 0.0;
-
- view_settings_from_ob(G.vd->camera, G.vd->ofs, NULL, NULL, &G.vd->lens);
- smooth_view(G.vd, orig_ofs, new_quat, &orig_dist, &orig_lens);
-
- G.vd->persp=2; /* just to be polite, not needed */
-
- } else {
- Mat3ToQuat(tmat, new_quat);
- smooth_view(G.vd, NULL, new_quat, NULL, NULL);
- }
- } else {
- Mat3ToQuat(tmat, G.vd->viewquat);
- }
-}
-
-/* dont set windows active in in here, is used by renderwin too */
-void setviewmatrixview3d()
-{
- if(G.vd->persp>=2) { /* obs/camera */
- if(G.vd->camera) {
- where_is_object(G.vd->camera);
- obmat_to_viewmat(G.vd->camera, 0);
- }
- else {
- QuatToMat4(G.vd->viewquat, G.vd->viewmat);
- G.vd->viewmat[3][2]-= G.vd->dist;
- }
- }
- else {
-
- QuatToMat4(G.vd->viewquat, G.vd->viewmat);
- if(G.vd->persp==1) G.vd->viewmat[3][2]-= G.vd->dist;
- if(G.vd->ob_centre) {
- Object *ob= G.vd->ob_centre;
- float vec[3];
-
- VECCOPY(vec, ob->obmat[3]);
- if(ob->type==OB_ARMATURE && G.vd->ob_centre_bone[0]) {
- bPoseChannel *pchan= get_pose_channel(ob->pose, G.vd->ob_centre_bone);
- if(pchan) {
- VECCOPY(vec, pchan->pose_mat[3]);
- Mat4MulVecfl(ob->obmat, vec);
- }
- }
- i_translate(-vec[0], -vec[1], -vec[2], G.vd->viewmat);
- }
- else i_translate(G.vd->ofs[0], G.vd->ofs[1], G.vd->ofs[2], G.vd->viewmat);
- }
-}
-
-void setcameratoview3d(void)
-{
- Object *ob;
- float dvec[3];
-
- ob= G.vd->camera;
- dvec[0]= G.vd->dist*G.vd->viewinv[2][0];
- dvec[1]= G.vd->dist*G.vd->viewinv[2][1];
- dvec[2]= G.vd->dist*G.vd->viewinv[2][2];
- VECCOPY(ob->loc, dvec);
- VecSubf(ob->loc, ob->loc, G.vd->ofs);
- G.vd->viewquat[0]= -G.vd->viewquat[0];
- if (ob->transflag & OB_QUAT) {
- QUATCOPY(ob->quat, G.vd->viewquat);
- } else {
- QuatToEul(G.vd->viewquat, ob->rot);
- }
- G.vd->viewquat[0]= -G.vd->viewquat[0];
-}
-
-/* IGLuint-> GLuint*/
-/* Warning: be sure to account for a negative return value
- * This is an error, "Too many objects in select buffer"
- * and no action should be taken (can crash blender) if this happens
- */
-short view3d_opengl_select(unsigned int *buffer, unsigned int bufsize, short x1, short y1, short x2, short y2)
-{
- rctf rect;
- short mval[2], code, hits;
-
- G.f |= G_PICKSEL;
-
- if(x1==0 && x2==0 && y1==0 && y2==0) {
- getmouseco_areawin(mval);
- rect.xmin= mval[0]-12; // seems to be default value for bones only now
- rect.xmax= mval[0]+12;
- rect.ymin= mval[1]-12;
- rect.ymax= mval[1]+12;
- }
- else {
- rect.xmin= x1;
- rect.xmax= x2;
- rect.ymin= y1;
- rect.ymax= y2;
- }
- /* get rid of overlay button matrix */
- persp(PERSP_VIEW);
- setwinmatrixview3d(curarea->winx, curarea->winy, &rect);
- Mat4MulMat4(G.vd->persmat, G.vd->viewmat, curarea->winmat);
-
- if(G.vd->drawtype > OB_WIRE) {
- G.vd->zbuf= TRUE;
- glEnable(GL_DEPTH_TEST);
- }
-
- if(G.vd->flag & V3D_CLIPPING)
- view3d_set_clipping(G.vd);
-
- glSelectBuffer( bufsize, (GLuint *)buffer);
- glRenderMode(GL_SELECT);
- glInitNames(); /* these two calls whatfor? It doesnt work otherwise */
- glPushName(-1);
- code= 1;
-
- if(G.obedit && G.obedit->type==OB_MBALL) {
- draw_object(BASACT, DRAW_PICKING|DRAW_CONSTCOLOR);
- }
- else if ((G.obedit && G.obedit->type==OB_ARMATURE)) {
- draw_object(BASACT, DRAW_PICKING|DRAW_CONSTCOLOR);
- }
- else {
- Base *base;
-
- G.vd->xray= TRUE; // otherwise it postpones drawing
- for(base= G.scene->base.first; base; base= base->next) {
- if(base->lay & G.vd->lay) {
-
- if (base->object->restrictflag & OB_RESTRICT_SELECT)
- base->selcol= 0;
- else {
- base->selcol= code;
- glLoadName(code);
- draw_object(base, DRAW_PICKING|DRAW_CONSTCOLOR);
-
- /* we draw group-duplicators for selection too */
- if((base->object->transflag & OB_DUPLI) && base->object->dup_group) {
- ListBase *lb;
- DupliObject *dob;
- Base tbase;
-
- tbase.flag= OB_FROMDUPLI;
- lb= object_duplilist(G.scene, base->object);
-
- for(dob= lb->first; dob; dob= dob->next) {
- tbase.object= dob->ob;
- Mat4CpyMat4(dob->ob->obmat, dob->mat);
-
- draw_object(&tbase, DRAW_PICKING|DRAW_CONSTCOLOR);
-
- Mat4CpyMat4(dob->ob->obmat, dob->omat);
- }
- free_object_duplilist(lb);
- }
- code++;
- }
- }
- }
- G.vd->xray= FALSE; // restore
- }
-
- glPopName(); /* see above (pushname) */
- hits= glRenderMode(GL_RENDER);
-
- G.f &= ~G_PICKSEL;
- setwinmatrixview3d(curarea->winx, curarea->winy, NULL);
- Mat4MulMat4(G.vd->persmat, G.vd->viewmat, curarea->winmat);
-
- if(G.vd->drawtype > OB_WIRE) {
- G.vd->zbuf= 0;
- glDisable(GL_DEPTH_TEST);
- }
- persp(PERSP_WIN);
-
- if(G.vd->flag & V3D_CLIPPING)
- view3d_clr_clipping();
-
- if(hits<0) error("Too many objects in select buffer");
-
- return hits;
-}
-
-float *give_cursor()
-{
- if(G.vd && G.vd->localview) return G.vd->cursor;
- else return G.scene->cursor;
-}
-
-unsigned int free_localbit()
-{
- unsigned int lay;
- ScrArea *sa;
- bScreen *sc;
-
- lay= 0;
-
- /* sometimes we loose a localview: when an area is closed */
- /* check all areas: which localviews are in use? */
- sc= G.main->screen.first;
- while(sc) {
- sa= sc->areabase.first;
- while(sa) {
- SpaceLink *sl= sa->spacedata.first;
- while(sl) {
- if(sl->spacetype==SPACE_VIEW3D) {
- View3D *v3d= (View3D*) sl;
- lay |= v3d->lay;
- }
- sl= sl->next;
- }
- sa= sa->next;
- }
- sc= sc->id.next;
- }
-
- if( (lay & 0x01000000)==0) return 0x01000000;
- if( (lay & 0x02000000)==0) return 0x02000000;
- if( (lay & 0x04000000)==0) return 0x04000000;
- if( (lay & 0x08000000)==0) return 0x08000000;
- if( (lay & 0x10000000)==0) return 0x10000000;
- if( (lay & 0x20000000)==0) return 0x20000000;
- if( (lay & 0x40000000)==0) return 0x40000000;
- if( (lay & 0x80000000)==0) return 0x80000000;
-
- return 0;
-}
-
-
-void initlocalview()
-{
- Base *base;
- float size = 0.0, min[3], max[3], afm[3];
- unsigned int locallay;
- int ok=0;
-
- if(G.vd->localvd) return;
-
- min[0]= min[1]= min[2]= 1.0e10;
- max[0]= max[1]= max[2]= -1.0e10;
-
- locallay= free_localbit();
-
- if(locallay==0) {
- error("Sorry, no more than 8 localviews");
- ok= 0;
- }
- else {
- if(G.obedit) {
- minmax_object(G.obedit, min, max);
-
- ok= 1;
-
- BASACT->lay |= locallay;
- G.obedit->lay= BASACT->lay;
- }
- else {
- base= FIRSTBASE;
- while(base) {
- if TESTBASE(base) {
- minmax_object(base->object, min, max);
- base->lay |= locallay;
- base->object->lay= base->lay;
- ok= 1;
- }
- base= base->next;
- }
- }
-
- afm[0]= (max[0]-min[0]);
- afm[1]= (max[1]-min[1]);
- afm[2]= (max[2]-min[2]);
- size= 0.7*MAX3(afm[0], afm[1], afm[2]);
- if(size<=0.01) size= 0.01;
- }
-
- if(ok) {
- G.vd->localvd= MEM_mallocN(sizeof(View3D), "localview");
- memcpy(G.vd->localvd, G.vd, sizeof(View3D));
-
- G.vd->ofs[0]= -(min[0]+max[0])/2.0;
- G.vd->ofs[1]= -(min[1]+max[1])/2.0;
- G.vd->ofs[2]= -(min[2]+max[2])/2.0;
-
- G.vd->dist= size;
-
- // correction for window aspect ratio
- if(curarea->winy>2 && curarea->winx>2) {
- size= (float)curarea->winx/(float)curarea->winy;
- if(size<1.0) size= 1.0/size;
- G.vd->dist*= size;
- }
-
- if (G.vd->persp>1) G.vd->persp= 1;
- if (G.vd->near> 0.1) G.vd->near= 0.1;
-
- G.vd->cursor[0]= -G.vd->ofs[0];
- G.vd->cursor[1]= -G.vd->ofs[1];
- G.vd->cursor[2]= -G.vd->ofs[2];
-
- G.vd->lay= locallay;
-
- countall();
- scrarea_queue_winredraw(curarea);
- }
- else {
- /* clear flags */
- base= FIRSTBASE;
- while(base) {
- if( base->lay & locallay ) {
- base->lay-= locallay;
- if(base->lay==0) base->lay= G.vd->layact;
- if(base->object != G.obedit) base->flag |= SELECT;
- base->object->lay= base->lay;
- }
- base= base->next;
- }
- scrarea_queue_headredraw(curarea);
-
- G.vd->localview= 0;
- }
- BIF_view3d_previewrender_signal(curarea, PR_DBASE|PR_DISPRECT);
-}
-
-void centerview() /* like a localview without local! */
-{
- Object *ob= OBACT;
- float size, min[3], max[3], afm[3];
- int ok=0;
-
- /* SMOOTHVIEW */
- float new_ofs[3];
- float new_dist;
-
-
- min[0]= min[1]= min[2]= 1.0e10;
- max[0]= max[1]= max[2]= -1.0e10;
-
- if (G.f & G_WEIGHTPAINT) {
- /* hardcoded exception, we look for the one selected armature */
- /* this is weak code this way, we should make a generic active/selection callback interface once... */
- Base *base;
- for(base=FIRSTBASE; base; base= base->next) {
- if(TESTBASELIB(base)) {
- if(base->object->type==OB_ARMATURE)
- if(base->object->flag & OB_POSEMODE)
- break;
- }
- }
- if(base)
- ob= base->object;
- }
-
-
- if(G.obedit) {
- ok = minmax_verts(min, max); /* only selected */
- }
- else if(ob && (ob->flag & OB_POSEMODE)) {
- if(ob->pose) {
- bArmature *arm= ob->data;
- bPoseChannel *pchan;
- float vec[3];
-
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if(pchan->bone->flag & BONE_SELECTED) {
- if(pchan->bone->layer & arm->layer) {
- ok= 1;
- VECCOPY(vec, pchan->pose_head);
- Mat4MulVecfl(ob->obmat, vec);
- DO_MINMAX(vec, min, max);
- VECCOPY(vec, pchan->pose_tail);
- Mat4MulVecfl(ob->obmat, vec);
- DO_MINMAX(vec, min, max);
- }
- }
- }
- }
- }
- else if (FACESEL_PAINT_TEST) {
- ok= minmax_tface(min, max);
- }
- else if (G.f & G_PARTICLEEDIT) {
- ok= PE_minmax(min, max);
- }
- else {
- Base *base= FIRSTBASE;
- while(base) {
- if TESTBASE(base) {
- minmax_object(base->object, min, max);
- /* account for duplis */
- minmax_object_duplis(base->object, min, max);
-
- ok= 1;
- }
- base= base->next;
- }
- }
-
- if(ok==0) return;
-
- afm[0]= (max[0]-min[0]);
- afm[1]= (max[1]-min[1]);
- afm[2]= (max[2]-min[2]);
- size= 0.7*MAX3(afm[0], afm[1], afm[2]);
-
- if(size <= G.vd->near*1.5) size= G.vd->near*1.5;
-
- new_ofs[0]= -(min[0]+max[0])/2.0;
- new_ofs[1]= -(min[1]+max[1])/2.0;
- new_ofs[2]= -(min[2]+max[2])/2.0;
-
- new_dist = size;
-
- /* correction for window aspect ratio */
- if(curarea->winy>2 && curarea->winx>2) {
- size= (float)curarea->winx/(float)curarea->winy;
- if(size<1.0) size= 1.0/size;
- new_dist*= size;
- }
-
- G.vd->cursor[0]= -new_ofs[0];
- G.vd->cursor[1]= -new_ofs[1];
- G.vd->cursor[2]= -new_ofs[2];
-
- if (G.vd->persp==2 && G.vd->camera) {
- float orig_lens= G.vd->lens;
-
- G.vd->persp=1;
- G.vd->dist= 0.0;
- view_settings_from_ob(G.vd->camera, G.vd->ofs, NULL, NULL, &G.vd->lens);
- smooth_view(G.vd, new_ofs, NULL, &new_dist, &orig_lens);
- } else {
- if(G.vd->persp>=2)
- G.vd->persp= 1;
-
- smooth_view(G.vd, new_ofs, NULL, &new_dist, NULL);
- }
- scrarea_queue_winredraw(curarea);
- BIF_view3d_previewrender_signal(curarea, PR_DBASE|PR_DISPRECT);
-
-}
-
-
-void restore_localviewdata(View3D *vd)
-{
- if(vd->localvd==0) return;
-
- VECCOPY(vd->ofs, vd->localvd->ofs);
- vd->dist= vd->localvd->dist;
- vd->persp= vd->localvd->persp;
- vd->view= vd->localvd->view;
- vd->near= vd->localvd->near;
- vd->far= vd->localvd->far;
- vd->lay= vd->localvd->lay;
- vd->layact= vd->localvd->layact;
- vd->drawtype= vd->localvd->drawtype;
- vd->camera= vd->localvd->camera;
- QUATCOPY(vd->viewquat, vd->localvd->viewquat);
-
-}
-
-void endlocalview(ScrArea *sa)
-{
- View3D *v3d;
- struct Base *base;
- unsigned int locallay;
-
- if(sa->spacetype!=SPACE_VIEW3D) return;
- v3d= sa->spacedata.first;
-
- if(v3d->localvd) {
-
- locallay= v3d->lay & 0xFF000000;
-
- restore_localviewdata(v3d);
-
- MEM_freeN(v3d->localvd);
- v3d->localvd= 0;
- v3d->localview= 0;
-
- /* for when in other window the layers have changed */
- if(v3d->scenelock) v3d->lay= G.scene->lay;
-
- base= FIRSTBASE;
- while(base) {
- if( base->lay & locallay ) {
- base->lay-= locallay;
- if(base->lay==0) base->lay= v3d->layact;
- if(base->object != G.obedit) {
- base->flag |= SELECT;
- base->object->flag |= SELECT;
- }
- base->object->lay= base->lay;
- }
- base= base->next;
- }
-
- countall();
- allqueue(REDRAWVIEW3D, 0); /* because of select */
- allqueue(REDRAWOOPS, 0); /* because of select */
- BIF_view3d_previewrender_signal(curarea, PR_DBASE|PR_DISPRECT);
- }
-}
-
-void view3d_home(int center)
-{
- Base *base;
- float size, min[3], max[3], afm[3];
- int ok= 1, onedone=0;
-
- if(center) {
- min[0]= min[1]= min[2]= 0.0;
- max[0]= max[1]= max[2]= 0.0;
- }
- else {
- min[0]= min[1]= min[2]= 1.0e10;
- max[0]= max[1]= max[2]= -1.0e10;
- }
-
- for(base= FIRSTBASE; base; base= base->next) {
- if(base->lay & G.vd->lay) {
- onedone= 1;
- minmax_object(base->object, min, max);
- }
- }
- if(!onedone) return;
-
- afm[0]= (max[0]-min[0]);
- afm[1]= (max[1]-min[1]);
- afm[2]= (max[2]-min[2]);
- size= 0.7*MAX3(afm[0], afm[1], afm[2]);
- if(size==0.0) ok= 0;
-
- if(ok) {
- float new_dist;
- float new_ofs[3];
-
- new_dist = size;
- new_ofs[0]= -(min[0]+max[0])/2.0;
- new_ofs[1]= -(min[1]+max[1])/2.0;
- new_ofs[2]= -(min[2]+max[2])/2.0;
-
- // correction for window aspect ratio
- if(curarea->winy>2 && curarea->winx>2) {
- size= (float)curarea->winx/(float)curarea->winy;
- if(size<1.0) size= 1.0/size;
- new_dist*= size;
- }
-
- if (G.vd->persp==2 && G.vd->camera) {
- /* switch out of camera view */
- float orig_lens= G.vd->lens;
-
- G.vd->persp=1;
- G.vd->dist= 0.0;
- view_settings_from_ob(G.vd->camera, G.vd->ofs, NULL, NULL, &G.vd->lens);
- smooth_view(G.vd, new_ofs, NULL, &new_dist, &orig_lens);
-
- } else {
- if(G.vd->persp>=2) G.vd->persp= 1;
- smooth_view(G.vd, new_ofs, NULL, &new_dist, NULL);
- }
- scrarea_queue_winredraw(curarea);
- }
- BIF_view3d_previewrender_signal(curarea, PR_DBASE|PR_DISPRECT);
-
-}
-
-
-void view3d_align_axis_to_vector(View3D *v3d, int axisidx, float vec[3])
-{
- float alignaxis[3] = {0.0, 0.0, 0.0};
- float norm[3], axis[3], angle, new_quat[4];
-
- if(axisidx > 0) alignaxis[axisidx-1]= 1.0;
- else alignaxis[-axisidx-1]= -1.0;
-
- VECCOPY(norm, vec);
- Normalize(norm);
-
- angle= acos(Inpf(alignaxis, norm));
- Crossf(axis, alignaxis, norm);
- VecRotToQuat(axis, -angle, new_quat);
-
- v3d->view= 0;
-
- if (v3d->persp==2 && v3d->camera) {
- /* switch out of camera view */
- float orig_ofs[3];
- float orig_dist= v3d->dist;
- float orig_lens= v3d->lens;
-
- VECCOPY(orig_ofs, v3d->ofs);
- G.vd->persp=1;
- G.vd->dist= 0.0;
- view_settings_from_ob(v3d->camera, v3d->ofs, NULL, NULL, &v3d->lens);
- smooth_view(G.vd, orig_ofs, new_quat, &orig_dist, &orig_lens);
- } else {
- if (v3d->persp>=2) v3d->persp= 1; /* switch out of camera mode */
- smooth_view(v3d, NULL, new_quat, NULL, NULL);
- }
-}
-
-
-
-/* SMOOTHVIEW */
-void smooth_view(View3D *v3d, float *ofs, float *quat, float *dist, float *lens)
-{
- /* View Animation enabled */
- if (U.smooth_viewtx) {
- int i;
- char changed = 0;
- float step = 0.0, step_inv;
- float orig_dist;
- float orig_lens;
- float orig_quat[4];
- float orig_ofs[3];
-
- double time_allowed, time_current, time_start;
-
- /* if there is no difference, return */
- changed = 0; /* zero means no difference */
- if (dist) {
- if ((*dist) != v3d->dist)
- changed = 1;
- }
-
- if (lens) {
- if ((*lens) != v3d->lens)
- changed = 1;
- }
-
- if (!changed && ofs) {
- if ((ofs[0]!=v3d->ofs[0]) ||
- (ofs[1]!=v3d->ofs[1]) ||
- (ofs[2]!=v3d->ofs[2]) )
- changed = 1;
- }
-
- if (!changed && quat ) {
- if ((quat[0]!=v3d->viewquat[0]) ||
- (quat[1]!=v3d->viewquat[1]) ||
- (quat[2]!=v3d->viewquat[2]) ||
- (quat[3]!=v3d->viewquat[3]) )
- changed = 1;
- }
-
- /* The new view is different from teh old one
- * so animate the view */
- if (changed) {
-
- /* store original values */
- VECCOPY(orig_ofs, v3d->ofs);
- QUATCOPY(orig_quat, v3d->viewquat);
- orig_dist = v3d->dist;
- orig_lens = v3d->lens;
-
- time_allowed= (float)U.smooth_viewtx / 1000.0;
- time_current = time_start = PIL_check_seconds_timer();
-
- /* if this is view rotation only
- * we can decrease the time allowed by
- * the angle between quats
- * this means small rotations wont lag */
- if (quat && !ofs && !dist) {
- float vec1[3], vec2[3];
- VECCOPY(vec1, quat);
- VECCOPY(vec2, v3d->viewquat);
- Normalize(vec1);
- Normalize(vec2);
- /* scale the time allowed by the rotation */
- time_allowed *= NormalizedVecAngle2(vec1, vec2)/(M_PI/2);
- }
-
- while (time_start + time_allowed > time_current) {
-
- step = (float)((time_current-time_start) / time_allowed);
-
- /* ease in/out */
- if (step < 0.5) step = pow(step*2, 2)/2;
- else step = 1-(pow(2*(1-step) ,2)/2);
-
- step_inv = 1-step;
-
- if (ofs)
- for (i=0; i<3; i++)
- v3d->ofs[i] = ofs[i]*step + orig_ofs[i]*step_inv;
-
-
- if (quat)
- QuatInterpol(v3d->viewquat, orig_quat, quat, step);
-
- if (dist)
- v3d->dist = ((*dist)*step) + (orig_dist*step_inv);
-
- if (lens)
- v3d->lens = ((*lens)*step) + (orig_lens*step_inv);
-
- /*redraw the view*/
- scrarea_do_windraw(curarea);
- screen_swapbuffers();
-
- time_current= PIL_check_seconds_timer();
- }
- }
- }
-
- /* set these values even if animation is enabled because flaot
- * error will make then not quite accurate */
- if (ofs)
- VECCOPY(v3d->ofs, ofs);
- if (quat)
- QUATCOPY(v3d->viewquat, quat);
- if (dist)
- v3d->dist = *dist;
- if (lens)
- v3d->lens = *lens;
-
-}
-
-
-
-/* Gets the view trasnformation from a camera
- * currently dosnt take camzoom into account
- *
- * The dist is not modified for this function, if NULL its assimed zero
- * */
-void view_settings_from_ob(Object *ob, float *ofs, float *quat, float *dist, float *lens)
-{
- float bmat[4][4];
- float imat[4][4];
- float tmat[3][3];
-
- if (!ob) return;
-
- /* Offset */
- if (ofs) {
- where_is_object(ob);
- VECCOPY(ofs, ob->obmat[3]);
- VecMulf(ofs, -1.0f); /*flip the vector*/
- }
-
- /* Quat */
- if (quat) {
- Mat4CpyMat4(bmat, ob->obmat);
- Mat4Ortho(bmat);
- Mat4Invert(imat, bmat);
- Mat3CpyMat4(tmat, imat);
- Mat3ToQuat(tmat, quat);
- }
-
- if (dist) {
- float vec[3];
- Mat3CpyMat4(tmat, ob->obmat);
-
- vec[0]= vec[1] = 0.0;
- vec[2]= -(*dist);
- Mat3MulVecfl(tmat, vec);
- VecSubf(ofs, ofs, vec);
- }
-
- /* Lens */
- if (lens)
- object_view_settings(ob, lens, NULL, NULL);
-}
-
-/* For use with smooth view
- *
- * the current view is unchanged, blend between the current view and the
- * camera view
- * */
-void smooth_view_to_camera(View3D *v3d)
-{
- if (!U.smooth_viewtx || !v3d->camera || G.vd->persp != 2) {
- return;
- } else {
- Object *ob = v3d->camera;
-
- float orig_ofs[3];
- float orig_dist=v3d->dist;
- float orig_lens=v3d->lens;
- float new_dist=0.0;
- float new_lens=35.0;
- float new_quat[4];
- float new_ofs[3];
-
- VECCOPY(orig_ofs, v3d->ofs);
-
- view_settings_from_ob(ob, new_ofs, new_quat, NULL, &new_lens);
-
- G.vd->persp=1;
- smooth_view(v3d, new_ofs, new_quat, &new_dist, &new_lens);
- VECCOPY(v3d->ofs, orig_ofs);
- v3d->lens= orig_lens;
- v3d->dist = orig_dist; /* restore the dist */
-
- v3d->camera = ob;
- v3d->persp=2;
- }
-}
diff --git a/source/blender/src/vpaint.c b/source/blender/src/vpaint.c
deleted file mode 100644
index 4e1c6cd59a6..00000000000
--- a/source/blender/src/vpaint.c
+++ /dev/null
@@ -1,1621 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <math.h>
-#include <string.h>
-
-#ifdef WIN32
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "IMB_imbuf.h"
-#include "IMB_imbuf_types.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "MTC_matrixops.h"
-
-#include "DNA_action_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_brush_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_modifier_types.h"
-#include "DNA_object_types.h"
-#include "DNA_object_force.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_userdef_types.h"
-
-#include "BKE_armature.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_customdata.h"
-#include "BKE_depsgraph.h"
-#include "BKE_deform.h"
-#include "BKE_displist.h"
-#include "BKE_global.h"
-#include "BKE_mesh.h"
-#include "BKE_modifier.h"
-#include "BKE_object.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_editview.h"
-#include "BIF_graphics.h"
-#include "BIF_glutil.h"
-#include "BIF_gl.h"
-#include "BIF_interface.h"
-#include "BIF_meshtools.h"
-#include "BIF_mywindow.h"
-#include "BIF_space.h"
-#include "BIF_screen.h"
-#include "BIF_toolbox.h"
-
-#include "BDR_vpaint.h"
-#include "BDR_editobject.h"
-
-#include "BSE_drawview.h"
-#include "BSE_trans_types.h"
-#include "BSE_view.h"
-
-#include "multires.h"
-#include "mydevice.h"
-#include "blendef.h"
-
-#include "BIF_editdeform.h"
-
- /* Gvp.mode */
-#define VP_MIX 0
-#define VP_ADD 1
-#define VP_SUB 2
-#define VP_MUL 3
-#define VP_BLUR 4
-#define VP_LIGHTEN 5
-#define VP_DARKEN 6
-
-#define MAXINDEX 512000
-
-VPaint Gvp= {1.0, 1.0, 1.0, 0.2, 25.0, 1.0, 1.0, 0, VP_AREA+VP_SOFT+VP_SPRAY, 0};
-VPaint Gwp= {1.0, 1.0, 1.0, 1.0, 25.0, 1.0, 1.0, 0, VP_AREA+VP_SOFT, 0};
-
-static int *get_indexarray(void)
-{
- return MEM_mallocN(sizeof(int)*MAXINDEX + 2, "vertexpaint");
-}
-
-void free_vertexpaint()
-{
-
- if(Gvp.vpaint_prev) MEM_freeN(Gvp.vpaint_prev);
- Gvp.vpaint_prev= NULL;
-
- mesh_octree_table(NULL, NULL, 'e');
-}
-
-/* in contradiction to cpack drawing colors, the MCOL colors (vpaint colors) are per byte!
- so not endian sensitive. Mcol = ABGR!!! so be cautious with cpack calls */
-
-unsigned int rgba_to_mcol(float r, float g, float b, float a)
-{
- int ir, ig, ib, ia;
- unsigned int col;
- char *cp;
-
- ir= floor(255.0*r);
- if(ir<0) ir= 0; else if(ir>255) ir= 255;
- ig= floor(255.0*g);
- if(ig<0) ig= 0; else if(ig>255) ig= 255;
- ib= floor(255.0*b);
- if(ib<0) ib= 0; else if(ib>255) ib= 255;
- ia= floor(255.0*a);
- if(ia<0) ia= 0; else if(ia>255) ia= 255;
-
- cp= (char *)&col;
- cp[0]= ia;
- cp[1]= ib;
- cp[2]= ig;
- cp[3]= ir;
-
- return col;
-
-}
-
-static unsigned int vpaint_get_current_col(VPaint *vp)
-{
- return rgba_to_mcol(vp->r, vp->g, vp->b, 1.0f);
-}
-
-void do_shared_vertexcol(Mesh *me)
-{
- /* if no mcol: do not do */
- /* if tface: only the involved faces, otherwise all */
- MFace *mface;
- MTFace *tface;
- int a;
- short *scolmain, *scol;
- char *mcol;
-
- if(me->mcol==0 || me->totvert==0 || me->totface==0) return;
-
- scolmain= MEM_callocN(4*sizeof(short)*me->totvert, "colmain");
-
- tface= me->mtface;
- mface= me->mface;
- mcol= (char *)me->mcol;
- for(a=me->totface; a>0; a--, mface++, mcol+=16) {
- if((tface && tface->mode & TF_SHAREDCOL) || (G.f & G_FACESELECT)==0) {
- scol= scolmain+4*mface->v1;
- scol[0]++; scol[1]+= mcol[1]; scol[2]+= mcol[2]; scol[3]+= mcol[3];
- scol= scolmain+4*mface->v2;
- scol[0]++; scol[1]+= mcol[5]; scol[2]+= mcol[6]; scol[3]+= mcol[7];
- scol= scolmain+4*mface->v3;
- scol[0]++; scol[1]+= mcol[9]; scol[2]+= mcol[10]; scol[3]+= mcol[11];
- if(mface->v4) {
- scol= scolmain+4*mface->v4;
- scol[0]++; scol[1]+= mcol[13]; scol[2]+= mcol[14]; scol[3]+= mcol[15];
- }
- }
- if(tface) tface++;
- }
-
- a= me->totvert;
- scol= scolmain;
- while(a--) {
- if(scol[0]>1) {
- scol[1]/= scol[0];
- scol[2]/= scol[0];
- scol[3]/= scol[0];
- }
- scol+= 4;
- }
-
- tface= me->mtface;
- mface= me->mface;
- mcol= (char *)me->mcol;
- for(a=me->totface; a>0; a--, mface++, mcol+=16) {
- if((tface && tface->mode & TF_SHAREDCOL) || (G.f & G_FACESELECT)==0) {
- scol= scolmain+4*mface->v1;
- mcol[1]= scol[1]; mcol[2]= scol[2]; mcol[3]= scol[3];
- scol= scolmain+4*mface->v2;
- mcol[5]= scol[1]; mcol[6]= scol[2]; mcol[7]= scol[3];
- scol= scolmain+4*mface->v3;
- mcol[9]= scol[1]; mcol[10]= scol[2]; mcol[11]= scol[3];
- if(mface->v4) {
- scol= scolmain+4*mface->v4;
- mcol[13]= scol[1]; mcol[14]= scol[2]; mcol[15]= scol[3];
- }
- }
- if(tface) tface++;
- }
-
- MEM_freeN(scolmain);
-}
-
-void make_vertexcol(int shade) /* single ob */
-{
- Object *ob;
- Mesh *me;
-
- if(G.obedit) {
- error("Unable to perform function in Edit Mode");
- return;
- }
-
- ob= OBACT;
- if(!ob || ob->id.lib) return;
- me= get_mesh(ob);
- if(me==0) return;
-
- /* copies from shadedisplist to mcol */
- if(!me->mcol) {
- CustomData_add_layer(&me->fdata, CD_MCOL, CD_CALLOC, NULL, me->totface);
- mesh_update_customdata_pointers(me);
- }
-
- if(shade)
- shadeMeshMCol(ob, me);
- else
- memset(me->mcol, 255, 4*sizeof(MCol)*me->totface);
-
- if (me->mr) multires_load_cols(me);
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
-
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static void copy_vpaint_prev(VPaint *vp, unsigned int *mcol, int tot)
-{
- if(vp->vpaint_prev) {
- MEM_freeN(vp->vpaint_prev);
- vp->vpaint_prev= NULL;
- }
- vp->tot= tot;
-
- if(mcol==NULL || tot==0) return;
-
- vp->vpaint_prev= MEM_mallocN(4*sizeof(int)*tot, "vpaint_prev");
- memcpy(vp->vpaint_prev, mcol, 4*sizeof(int)*tot);
-
-}
-
-static void copy_wpaint_prev (VPaint *vp, MDeformVert *dverts, int dcount)
-{
- if (vp->wpaint_prev) {
- free_dverts(vp->wpaint_prev, vp->tot);
- vp->wpaint_prev= NULL;
- }
-
- if(dverts && dcount) {
-
- vp->wpaint_prev = MEM_mallocN (sizeof(MDeformVert)*dcount, "wpaint prev");
- vp->tot = dcount;
- copy_dverts (vp->wpaint_prev, dverts, dcount);
- }
-}
-
-
-void clear_vpaint()
-{
- Mesh *me;
- Object *ob;
- unsigned int *to, paintcol;
- int a;
-
- if((G.f & G_VERTEXPAINT)==0) return;
-
- ob= OBACT;
- me= get_mesh(ob);
- if(!ob || ob->id.lib) return;
-
- if(me==0 || me->mcol==0 || me->totface==0) return;
-
- paintcol= vpaint_get_current_col(&Gvp);
-
- to= (unsigned int *)me->mcol;
- a= 4*me->totface;
- while(a--) {
- *to= paintcol;
- to++;
- }
- BIF_undo_push("Clear vertex colors");
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
-
- allqueue(REDRAWVIEW3D, 0);
-}
-
-void clear_vpaint_selectedfaces()
-{
- Mesh *me;
- MFace *mf;
- Object *ob;
- unsigned int paintcol, *mcol;
- int i;
-
- ob= OBACT;
- me= get_mesh(ob);
- if(me==0 || me->totface==0) return;
-
- if(!me->mcol)
- make_vertexcol(0);
-
- paintcol= vpaint_get_current_col(&Gvp);
-
- mf = me->mface;
- mcol = (unsigned int*)me->mcol;
- for (i = 0; i < me->totface; i++, mf++, mcol+=4) {
- if (mf->flag & ME_FACE_SEL) {
- mcol[0] = paintcol;
- mcol[1] = paintcol;
- mcol[2] = paintcol;
- mcol[3] = paintcol;
- }
- }
-
- BIF_undo_push("Clear vertex colors");
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
-}
-
-
-/* fills in the selected faces with the current weight and vertex group */
-void clear_wpaint_selectedfaces()
-{
- extern float editbutvweight;
- float paintweight= editbutvweight;
- Mesh *me;
- MFace *mface;
- Object *ob;
- MDeformWeight *dw, *uw;
- int *indexar;
- int index, vgroup;
- unsigned int faceverts[5]={0,0,0,0,0};
- unsigned char i;
- int vgroup_mirror= -1;
-
- ob= OBACT;
- me= ob->data;
- if(me==0 || me->totface==0 || me->dvert==0 || !me->mface) return;
-
- indexar= get_indexarray();
- for(index=0, mface=me->mface; index<me->totface; index++, mface++) {
- if((mface->flag & ME_FACE_SEL)==0)
- indexar[index]= 0;
- else
- indexar[index]= index+1;
- }
-
- vgroup= ob->actdef-1;
-
- /* directly copied from weight_paint, should probaby split into a seperate function */
- /* if mirror painting, find the other group */
- if(Gwp.flag & VP_MIRROR_X) {
- bDeformGroup *defgroup= BLI_findlink(&ob->defbase, ob->actdef-1);
- if(defgroup) {
- bDeformGroup *curdef;
- int actdef= 0;
- char name[32];
-
- BLI_strncpy(name, defgroup->name, 32);
- bone_flip_name(name, 0); /* 0 = don't strip off number extensions */
-
- for (curdef = ob->defbase.first; curdef; curdef=curdef->next, actdef++)
- if (!strcmp(curdef->name, name))
- break;
- if(curdef==NULL) {
- int olddef= ob->actdef; /* tsk, add_defgroup sets the active defgroup */
- curdef= add_defgroup_name (ob, name);
- ob->actdef= olddef;
- }
-
- if(curdef && curdef!=defgroup)
- vgroup_mirror= actdef;
- }
- }
- /* end copy from weight_paint*/
-
- copy_wpaint_prev(&Gwp, me->dvert, me->totvert);
-
- for(index=0; index<me->totface; index++) {
- if(indexar[index] && indexar[index]<=me->totface) {
- mface= me->mface + (indexar[index]-1);
- /* just so we can loop through the verts */
- faceverts[0]= mface->v1;
- faceverts[1]= mface->v2;
- faceverts[2]= mface->v3;
- faceverts[3]= mface->v4;
- for (i=0; i<3 || faceverts[i]; i++) {
- if(!((me->dvert+faceverts[i])->flag)) {
- dw= verify_defweight(me->dvert+faceverts[i], vgroup);
- if(dw) {
- uw= verify_defweight(Gwp.wpaint_prev+faceverts[i], vgroup);
- uw->weight= dw->weight; /* set the undio weight */
- dw->weight= paintweight;
-
- if(Gwp.flag & VP_MIRROR_X) { /* x mirror painting */
- int j= mesh_get_x_mirror_vert(ob, faceverts[i]);
- if(j>=0) {
- /* copy, not paint again */
- if(vgroup_mirror != -1) {
- dw= verify_defweight(me->dvert+j, vgroup_mirror);
- uw= verify_defweight(Gwp.wpaint_prev+j, vgroup_mirror);
- } else {
- dw= verify_defweight(me->dvert+j, vgroup);
- uw= verify_defweight(Gwp.wpaint_prev+j, vgroup);
- }
- uw->weight= dw->weight; /* set the undo weight */
- dw->weight= paintweight;
- }
- }
- }
- (me->dvert+faceverts[i])->flag= 1;
- }
- }
- }
- }
-
- index=0;
- while (index<me->totvert) {
- (me->dvert+index)->flag= 0;
- index++;
- }
-
- MEM_freeN(indexar);
- copy_wpaint_prev(&Gwp, NULL, 0);
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- BIF_undo_push("Set vertex weight");
- allqueue(REDRAWVIEW3D, 0);
-}
-
-
-void vpaint_dogamma()
-{
- Mesh *me;
- Object *ob;
- float igam, fac;
- int a, temp;
- char *cp, gamtab[256];
-
- if((G.f & G_VERTEXPAINT)==0) return;
-
- ob= OBACT;
- me= get_mesh(ob);
- if(me==0 || me->mcol==0 || me->totface==0) return;
-
- igam= 1.0/Gvp.gamma;
- for(a=0; a<256; a++) {
-
- fac= ((float)a)/255.0;
- fac= Gvp.mul*pow( fac, igam);
-
- temp= 255.9*fac;
-
- if(temp<=0) gamtab[a]= 0;
- else if(temp>=255) gamtab[a]= 255;
- else gamtab[a]= temp;
- }
-
- a= 4*me->totface;
- cp= (char *)me->mcol;
- while(a--) {
-
- cp[1]= gamtab[ cp[1] ];
- cp[2]= gamtab[ cp[2] ];
- cp[3]= gamtab[ cp[3] ];
-
- cp+= 4;
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-/* used for both 3d view and image window */
-void sample_vpaint() /* frontbuf */
-{
- unsigned int col;
- int x, y;
- short mval[2];
- char *cp;
-
- getmouseco_areawin(mval);
- x= mval[0]; y= mval[1];
-
- if(x<0 || y<0) return;
- if(x>=curarea->winx || y>=curarea->winy) return;
-
- x+= curarea->winrct.xmin;
- y+= curarea->winrct.ymin;
-
- glReadBuffer(GL_FRONT);
- glReadPixels(x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &col);
- glReadBuffer(GL_BACK);
-
- cp = (char *)&col;
-
- if(G.f & (G_VERTEXPAINT|G_WEIGHTPAINT)) {
- Gvp.r= cp[0]/255.0f;
- Gvp.g= cp[1]/255.0f;
- Gvp.b= cp[2]/255.0f;
- }
- else {
- Brush *brush= G.scene->toolsettings->imapaint.brush;
-
- if(brush) {
- brush->rgb[0]= cp[0]/255.0f;
- brush->rgb[1]= cp[1]/255.0f;
- brush->rgb[2]= cp[2]/255.0f;
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIMAGE, 0);
- }
- }
-
- allqueue(REDRAWBUTSEDIT, 0);
- addqueue(curarea->win, REDRAW, 1); /* needed for when panel is open... */
-}
-
-static unsigned int mcol_blend(unsigned int col1, unsigned int col2, int fac)
-{
- char *cp1, *cp2, *cp;
- int mfac;
- unsigned int col=0;
-
- if(fac==0) return col1;
- if(fac>=255) return col2;
-
- mfac= 255-fac;
-
- cp1= (char *)&col1;
- cp2= (char *)&col2;
- cp= (char *)&col;
-
- cp[0]= 255;
- cp[1]= (mfac*cp1[1]+fac*cp2[1])>>8;
- cp[2]= (mfac*cp1[2]+fac*cp2[2])>>8;
- cp[3]= (mfac*cp1[3]+fac*cp2[3])>>8;
-
- return col;
-}
-
-static unsigned int mcol_add(unsigned int col1, unsigned int col2, int fac)
-{
- char *cp1, *cp2, *cp;
- int temp;
- unsigned int col=0;
-
- if(fac==0) return col1;
-
- cp1= (char *)&col1;
- cp2= (char *)&col2;
- cp= (char *)&col;
-
- cp[0]= 255;
- temp= cp1[1] + ((fac*cp2[1])>>8);
- if(temp>254) cp[1]= 255; else cp[1]= temp;
- temp= cp1[2] + ((fac*cp2[2])>>8);
- if(temp>254) cp[2]= 255; else cp[2]= temp;
- temp= cp1[3] + ((fac*cp2[3])>>8);
- if(temp>254) cp[3]= 255; else cp[3]= temp;
-
- return col;
-}
-
-static unsigned int mcol_sub(unsigned int col1, unsigned int col2, int fac)
-{
- char *cp1, *cp2, *cp;
- int temp;
- unsigned int col=0;
-
- if(fac==0) return col1;
-
- cp1= (char *)&col1;
- cp2= (char *)&col2;
- cp= (char *)&col;
-
- cp[0]= 255;
- temp= cp1[1] - ((fac*cp2[1])>>8);
- if(temp<0) cp[1]= 0; else cp[1]= temp;
- temp= cp1[2] - ((fac*cp2[2])>>8);
- if(temp<0) cp[2]= 0; else cp[2]= temp;
- temp= cp1[3] - ((fac*cp2[3])>>8);
- if(temp<0) cp[3]= 0; else cp[3]= temp;
-
- return col;
-}
-
-static unsigned int mcol_mul(unsigned int col1, unsigned int col2, int fac)
-{
- char *cp1, *cp2, *cp;
- int mfac;
- unsigned int col=0;
-
- if(fac==0) return col1;
-
- mfac= 255-fac;
-
- cp1= (char *)&col1;
- cp2= (char *)&col2;
- cp= (char *)&col;
-
- /* first mul, then blend the fac */
- cp[0]= 255;
- cp[1]= (mfac*cp1[1] + fac*((cp2[1]*cp1[1])>>8) )>>8;
- cp[2]= (mfac*cp1[2] + fac*((cp2[2]*cp1[2])>>8) )>>8;
- cp[3]= (mfac*cp1[3] + fac*((cp2[3]*cp1[3])>>8) )>>8;
-
-
- return col;
-}
-
-static unsigned int mcol_lighten(unsigned int col1, unsigned int col2, int fac)
-{
- char *cp1, *cp2, *cp;
- int mfac;
- unsigned int col=0;
-
- if(fac==0) return col1;
- if(fac>=255) return col2;
-
- mfac= 255-fac;
-
- cp1= (char *)&col1;
- cp2= (char *)&col2;
- cp= (char *)&col;
-
- /* See if are lighter, if so mix, else dont do anything.
- if the paint col is darker then the original, then ignore */
- if (cp1[1]+cp1[2]+cp1[3] > cp2[1]+cp2[2]+cp2[3])
- return col1;
-
- cp[0]= 255;
- cp[1]= (mfac*cp1[1]+fac*cp2[1])>>8;
- cp[2]= (mfac*cp1[2]+fac*cp2[2])>>8;
- cp[3]= (mfac*cp1[3]+fac*cp2[3])>>8;
-
- return col;
-}
-
-static unsigned int mcol_darken(unsigned int col1, unsigned int col2, int fac)
-{
- char *cp1, *cp2, *cp;
- int mfac;
- unsigned int col=0;
-
- if(fac==0) return col1;
- if(fac>=255) return col2;
-
- mfac= 255-fac;
-
- cp1= (char *)&col1;
- cp2= (char *)&col2;
- cp= (char *)&col;
-
- /* See if were darker, if so mix, else dont do anything.
- if the paint col is brighter then the original, then ignore */
- if (cp1[1]+cp1[2]+cp1[3] < cp2[1]+cp2[2]+cp2[3])
- return col1;
-
- cp[0]= 255;
- cp[1]= (mfac*cp1[1]+fac*cp2[1])>>8;
- cp[2]= (mfac*cp1[2]+fac*cp2[2])>>8;
- cp[3]= (mfac*cp1[3]+fac*cp2[3])>>8;
- return col;
-}
-
-static void vpaint_blend( unsigned int *col, unsigned int *colorig, unsigned int paintcol, int alpha)
-{
-
- if(Gvp.mode==VP_MIX || Gvp.mode==VP_BLUR) *col= mcol_blend( *col, paintcol, alpha);
- else if(Gvp.mode==VP_ADD) *col= mcol_add( *col, paintcol, alpha);
- else if(Gvp.mode==VP_SUB) *col= mcol_sub( *col, paintcol, alpha);
- else if(Gvp.mode==VP_MUL) *col= mcol_mul( *col, paintcol, alpha);
- else if(Gvp.mode==VP_LIGHTEN) *col= mcol_lighten( *col, paintcol, alpha);
- else if(Gvp.mode==VP_DARKEN) *col= mcol_darken( *col, paintcol, alpha);
-
- /* if no spray, clip color adding with colorig & orig alpha */
- if((Gvp.flag & VP_SPRAY)==0) {
- unsigned int testcol=0, a;
- char *cp, *ct, *co;
-
- alpha= (int)(255.0*Gvp.a);
-
- if(Gvp.mode==VP_MIX || Gvp.mode==VP_BLUR) testcol= mcol_blend( *colorig, paintcol, alpha);
- else if(Gvp.mode==VP_ADD) testcol= mcol_add( *colorig, paintcol, alpha);
- else if(Gvp.mode==VP_SUB) testcol= mcol_sub( *colorig, paintcol, alpha);
- else if(Gvp.mode==VP_MUL) testcol= mcol_mul( *colorig, paintcol, alpha);
- else if(Gvp.mode==VP_LIGHTEN) testcol= mcol_lighten( *colorig, paintcol, alpha);
- else if(Gvp.mode==VP_DARKEN) testcol= mcol_darken( *colorig, paintcol, alpha);
-
- cp= (char *)col;
- ct= (char *)&testcol;
- co= (char *)colorig;
-
- for(a=0; a<4; a++) {
- if( ct[a]<co[a] ) {
- if( cp[a]<ct[a] ) cp[a]= ct[a];
- else if( cp[a]>co[a] ) cp[a]= co[a];
- }
- else {
- if( cp[a]<co[a] ) cp[a]= co[a];
- else if( cp[a]>ct[a] ) cp[a]= ct[a];
- }
- }
- }
-}
-
-
-static int sample_backbuf_area(VPaint *vp, int *indexar, int totface, int x, int y, float size)
-{
- unsigned int *rt;
- struct ImBuf *ibuf;
- int x1, y1, x2, y2, a, tot=0, index;
-
- if(totface>=MAXINDEX) return 0;
-
- if(size>64.0) size= 64.0;
-
- x1= x-size;
- x2= x+size;
- CLAMP(x1, 0, curarea->winx-1);
- CLAMP(x2, 0, curarea->winx-1);
- y1= y-size;
- y2= y+size;
- CLAMP(y1, 0, curarea->winy-1);
- CLAMP(y2, 0, curarea->winy-1);
-#ifdef __APPLE__
- glReadBuffer(GL_AUX0);
-#endif
-
- if(x1>=x2 || y1>=y2) return 0;
-
- ibuf = IMB_allocImBuf(2*size + 4, 2*size + 4, 32, IB_rect, 0);
- glReadPixels(x1+curarea->winrct.xmin, y1+curarea->winrct.ymin, x2-x1+1, y2-y1+1, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
- glReadBuffer(GL_BACK);
-
- if(G.order==B_ENDIAN) {
- IMB_convert_rgba_to_abgr(ibuf);
- }
-
- rt= ibuf->rect;
- size= (y2-y1)*(x2-x1);
- if(size<=0) return 0;
-
- memset(indexar, 0, sizeof(int)*totface+2); /* plus 2! first element is total */
-
- while(size--) {
-
- if(*rt) {
- index= framebuffer_to_index(*rt);
- if(index>0 && index<=totface)
- indexar[index] = 1;
- }
-
- rt++;
- }
-
- for(a=1; a<=totface; a++) {
- if(indexar[a]) indexar[tot++]= a;
- }
-
- IMB_freeImBuf(ibuf);
-
- return tot;
-}
-
-static int calc_vp_alpha_dl(VPaint *vp, float vpimat[][3], float *vert_nor, short *mval)
-{
- float fac, dx, dy;
- int alpha;
- short vertco[2];
-
- if(vp->flag & VP_SOFT) {
- project_short_noclip(vert_nor, vertco);
- dx= mval[0]-vertco[0];
- dy= mval[1]-vertco[1];
-
- fac= sqrt(dx*dx + dy*dy);
- if(fac > vp->size) return 0;
- if(vp->flag & VP_HARD)
- alpha= 255;
- else
- alpha= 255.0*vp->a*(1.0-fac/vp->size);
- }
- else {
- alpha= 255.0*vp->a;
- }
-
- if(vp->flag & VP_NORMALS) {
- float *no= vert_nor+3;
-
- /* transpose ! */
- fac= vpimat[2][0]*no[0]+vpimat[2][1]*no[1]+vpimat[2][2]*no[2];
- if(fac>0.0) {
- dx= vpimat[0][0]*no[0]+vpimat[0][1]*no[1]+vpimat[0][2]*no[2];
- dy= vpimat[1][0]*no[0]+vpimat[1][1]*no[1]+vpimat[1][2]*no[2];
-
- alpha*= fac/sqrt(dx*dx + dy*dy + fac*fac);
- }
- else return 0;
- }
-
- return alpha;
-}
-
-static void wpaint_blend(MDeformWeight *dw, MDeformWeight *uw, float alpha, float paintval)
-{
-
- if(dw==NULL || uw==NULL) return;
-
- if(Gwp.mode==VP_MIX || Gwp.mode==VP_BLUR)
- dw->weight = paintval*alpha + dw->weight*(1.0-alpha);
- else if(Gwp.mode==VP_ADD)
- dw->weight += paintval*alpha;
- else if(Gwp.mode==VP_SUB)
- dw->weight -= paintval*alpha;
- else if(Gwp.mode==VP_MUL)
- /* first mul, then blend the fac */
- dw->weight = ((1.0-alpha) + alpha*paintval)*dw->weight;
- else if(Gwp.mode==VP_LIGHTEN) {
- if (dw->weight < paintval)
- dw->weight = paintval*alpha + dw->weight*(1.0-alpha);
- } else if(Gwp.mode==VP_DARKEN) {
- if (dw->weight > paintval)
- dw->weight = paintval*alpha + dw->weight*(1.0-alpha);
- }
- CLAMP(dw->weight, 0.0f, 1.0f);
-
- /* if no spray, clip result with orig weight & orig alpha */
- if((Gwp.flag & VP_SPRAY)==0) {
- float testw=0.0f;
-
- alpha= Gwp.a;
- if(Gwp.mode==VP_MIX || Gwp.mode==VP_BLUR)
- testw = paintval*alpha + uw->weight*(1.0-alpha);
- else if(Gwp.mode==VP_ADD)
- testw = uw->weight + paintval*alpha;
- else if(Gwp.mode==VP_SUB)
- testw = uw->weight - paintval*alpha;
- else if(Gwp.mode==VP_MUL)
- /* first mul, then blend the fac */
- testw = ((1.0-alpha) + alpha*paintval)*uw->weight;
- else if(Gwp.mode==VP_LIGHTEN) {
- if (uw->weight < paintval)
- testw = paintval*alpha + uw->weight*(1.0-alpha);
- else
- testw = uw->weight;
- } else if(Gwp.mode==VP_DARKEN) {
- if (uw->weight > paintval)
- testw = paintval*alpha + uw->weight*(1.0-alpha);
- else
- testw = uw->weight;
- }
- CLAMP(testw, 0.0f, 1.0f);
-
- if( testw<uw->weight ) {
- if(dw->weight < testw) dw->weight= testw;
- else if(dw->weight > uw->weight) dw->weight= uw->weight;
- }
- else {
- if(dw->weight > testw) dw->weight= testw;
- else if(dw->weight < uw->weight) dw->weight= uw->weight;
- }
- }
-
-}
-
-/* ----------------------------------------------------- */
-
-/* used for 3d view, on active object, assumes me->dvert exists */
-/* if mode==1: */
-/* samples cursor location, and gives menu with vertex groups to activate */
-/* else */
-/* sets editbutvweight to the closest weight value to vertex */
-/* note: we cant sample frontbuf, weight colors are interpolated too unpredictable */
-static void sample_wpaint(int mode)
-{
- Object *ob= OBACT;
- Mesh *me= get_mesh(ob);
- int index;
- short mval[2], sco[2];
-
- if (!me) return;
-
- getmouseco_areawin(mval);
- index= sample_backbuf(mval[0], mval[1]);
-
- if(index && index<=me->totface) {
- MFace *mface;
-
- mface= ((MFace *)me->mface) + index-1;
-
- if(mode==1) { /* sampe which groups are in here */
- MDeformVert *dv;
- int a, totgroup;
-
- totgroup= BLI_countlist(&ob->defbase);
- if(totgroup) {
- int totmenu=0;
- int *groups=MEM_callocN(totgroup*sizeof(int), "groups");
-
- dv= me->dvert+mface->v1;
- for(a=0; a<dv->totweight; a++) {
- if (dv->dw[a].def_nr<totgroup)
- groups[dv->dw[a].def_nr]= 1;
- }
- dv= me->dvert+mface->v2;
- for(a=0; a<dv->totweight; a++) {
- if (dv->dw[a].def_nr<totgroup)
- groups[dv->dw[a].def_nr]= 1;
- }
- dv= me->dvert+mface->v3;
- for(a=0; a<dv->totweight; a++) {
- if (dv->dw[a].def_nr<totgroup)
- groups[dv->dw[a].def_nr]= 1;
- }
- if(mface->v4) {
- dv= me->dvert+mface->v4;
- for(a=0; a<dv->totweight; a++) {
- if (dv->dw[a].def_nr<totgroup)
- groups[dv->dw[a].def_nr]= 1;
- }
- }
- for(a=0; a<totgroup; a++)
- if(groups[a]) totmenu++;
-
- if(totmenu==0) {
- notice("No Vertex Group Selected");
- }
- else {
- bDeformGroup *dg;
- short val;
- char item[40], *str= MEM_mallocN(40*totmenu+40, "menu");
-
- strcpy(str, "Vertex Groups %t");
- for(a=0, dg=ob->defbase.first; dg && a<totgroup; a++, dg= dg->next) {
- if(groups[a]) {
- sprintf(item, "|%s %%x%d", dg->name, a);
- strcat(str, item);
- }
- }
-
- val= pupmenu(str);
- if(val>=0) {
- ob->actdef= val+1;
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWOOPS, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- }
- MEM_freeN(str);
- }
- MEM_freeN(groups);
- }
- else notice("No Vertex Groups in Object");
- }
- else {
- DerivedMesh *dm;
- MDeformWeight *dw;
- extern float editbutvweight;
- float w1, w2, w3, w4, co[3], fac;
-
- dm = mesh_get_derived_final(ob, CD_MASK_BAREMESH);
- if(dm->getVertCo==NULL) {
- notice("Not supported yet");
- }
- else {
- /* calc 3 or 4 corner weights */
- dm->getVertCo(dm, mface->v1, co);
- project_short_noclip(co, sco);
- w1= ((mval[0]-sco[0])*(mval[0]-sco[0]) + (mval[1]-sco[1])*(mval[1]-sco[1]));
-
- dm->getVertCo(dm, mface->v2, co);
- project_short_noclip(co, sco);
- w2= ((mval[0]-sco[0])*(mval[0]-sco[0]) + (mval[1]-sco[1])*(mval[1]-sco[1]));
-
- dm->getVertCo(dm, mface->v3, co);
- project_short_noclip(co, sco);
- w3= ((mval[0]-sco[0])*(mval[0]-sco[0]) + (mval[1]-sco[1])*(mval[1]-sco[1]));
-
- if(mface->v4) {
- dm->getVertCo(dm, mface->v4, co);
- project_short_noclip(co, sco);
- w4= ((mval[0]-sco[0])*(mval[0]-sco[0]) + (mval[1]-sco[1])*(mval[1]-sco[1]));
- }
- else w4= 1.0e10;
-
- fac= MIN4(w1, w2, w3, w4);
- if(w1==fac) {
- dw= get_defweight(me->dvert+mface->v1, ob->actdef-1);
- if(dw) editbutvweight= dw->weight; else editbutvweight= 0.0f;
- }
- else if(w2==fac) {
- dw= get_defweight(me->dvert+mface->v2, ob->actdef-1);
- if(dw) editbutvweight= dw->weight; else editbutvweight= 0.0f;
- }
- else if(w3==fac) {
- dw= get_defweight(me->dvert+mface->v3, ob->actdef-1);
- if(dw) editbutvweight= dw->weight; else editbutvweight= 0.0f;
- }
- else if(w4==fac) {
- if(mface->v4) {
- dw= get_defweight(me->dvert+mface->v4, ob->actdef-1);
- if(dw) editbutvweight= dw->weight; else editbutvweight= 0.0f;
- }
- }
- }
- dm->release(dm);
- }
-
- }
- allqueue(REDRAWBUTSEDIT, 0);
-
-}
-
-static void do_weight_paint_vertex(Object *ob, int index, int alpha, float paintweight, int vgroup_mirror)
-{
- Mesh *me= ob->data;
- MDeformWeight *dw, *uw;
- int vgroup= ob->actdef-1;
-
- if(Gwp.flag & VP_ONLYVGROUP) {
- dw= get_defweight(me->dvert+index, vgroup);
- uw= get_defweight(Gwp.wpaint_prev+index, vgroup);
- }
- else {
- dw= verify_defweight(me->dvert+index, vgroup);
- uw= verify_defweight(Gwp.wpaint_prev+index, vgroup);
- }
- if(dw==NULL || uw==NULL)
- return;
-
- wpaint_blend(dw, uw, (float)alpha/255.0, paintweight);
-
- if(Gwp.flag & VP_MIRROR_X) { /* x mirror painting */
- int j= mesh_get_x_mirror_vert(ob, index);
- if(j>=0) {
- /* copy, not paint again */
- if(vgroup_mirror != -1)
- uw= verify_defweight(me->dvert+j, vgroup_mirror);
- else
- uw= verify_defweight(me->dvert+j, vgroup);
-
- uw->weight= dw->weight;
- }
- }
-}
-
-void weight_paint(void)
-{
- extern float editbutvweight;
- Object *ob;
- Mesh *me;
- MFace *mface;
- float mat[4][4], imat[4][4], paintweight, *vertexcosnos;
- float vpimat[3][3];
- int *indexar, index, totindex, alpha, totw;
- int vgroup_mirror= -1;
- short mval[2], mvalo[2], firsttime=1;
-
- if((G.f & G_WEIGHTPAINT)==0) return;
- if(G.obedit) return;
- if(multires_level1_test()) return;
-
- ob= OBACT;
- if(!ob || ob->id.lib) return;
-
- me= get_mesh(ob);
- if(me==NULL || me->totface==0) return;
-
- /* if nothing was added yet, we make dverts and a vertex deform group */
- if (!me->dvert)
- create_dverts(&me->id);
-
- if(G.qual & LR_CTRLKEY) {
- sample_wpaint(0);
- return;
- }
- if(G.qual & LR_SHIFTKEY) {
- sample_wpaint(1);
- return;
- }
-
- /* ALLOCATIONS! no return after this line */
- /* painting on subsurfs should give correct points too, this returns me->totvert amount */
- vertexcosnos= mesh_get_mapped_verts_nors(ob);
- indexar= get_indexarray();
- copy_wpaint_prev(&Gwp, me->dvert, me->totvert);
-
- /* this happens on a Bone select, when no vgroup existed yet */
- if(ob->actdef<=0) {
- Object *modob;
- if((modob = modifiers_isDeformedByArmature(ob))) {
- bPoseChannel *pchan;
- for(pchan= modob->pose->chanbase.first; pchan; pchan= pchan->next)
- if(pchan->bone->flag & SELECT)
- break;
- if(pchan) {
- bDeformGroup *dg= get_named_vertexgroup(ob, pchan->name);
- if(dg==NULL)
- dg= add_defgroup_name(ob, pchan->name); /* sets actdef */
- else
- ob->actdef= get_defgroup_num(ob, dg);
- allqueue(REDRAWBUTSEDIT, 0);
- }
- }
- }
- if(ob->defbase.first==NULL) {
- add_defgroup(ob);
- allqueue(REDRAWBUTSEDIT, 0);
- }
-
- if(ob->lay & G.vd->lay); else error("Active object is not in this layer");
-
- persp(PERSP_VIEW);
- /* imat for normals */
- Mat4MulMat4(mat, ob->obmat, G.vd->viewmat);
- Mat4Invert(imat, mat);
- Mat3CpyMat4(vpimat, imat);
-
- /* load projection matrix */
- mymultmatrix(ob->obmat);
- mygetsingmatrix(mat);
- myloadmatrix(G.vd->viewmat);
-
- getmouseco_areawin(mvalo);
-
- getmouseco_areawin(mval);
- mvalo[0]= mval[0];
- mvalo[1]= mval[1];
-
- /* if mirror painting, find the other group */
- if(Gwp.flag & VP_MIRROR_X) {
- bDeformGroup *defgroup= BLI_findlink(&ob->defbase, ob->actdef-1);
- if(defgroup) {
- bDeformGroup *curdef;
- int actdef= 0;
- char name[32];
-
- BLI_strncpy(name, defgroup->name, 32);
- bone_flip_name(name, 0); /* 0 = don't strip off number extensions */
-
- for (curdef = ob->defbase.first; curdef; curdef=curdef->next, actdef++)
- if (!strcmp(curdef->name, name))
- break;
- if(curdef==NULL) {
- int olddef= ob->actdef; /* tsk, add_defgroup sets the active defgroup */
- curdef= add_defgroup_name (ob, name);
- ob->actdef= olddef;
- }
-
- if(curdef && curdef!=defgroup)
- vgroup_mirror= actdef;
- }
- }
-
- while (get_mbut() & L_MOUSE) {
- getmouseco_areawin(mval);
-
- if(firsttime || mval[0]!=mvalo[0] || mval[1]!=mvalo[1]) {
- firsttime= 0;
-
- /* which faces are involved */
- if(Gwp.flag & VP_AREA) {
- totindex= sample_backbuf_area(&Gwp, indexar, me->totface, mval[0], mval[1], Gwp.size);
- }
- else {
- indexar[0]= sample_backbuf(mval[0], mval[1]);
- if(indexar[0]) totindex= 1;
- else totindex= 0;
- }
-
- MTC_Mat4SwapMat4(G.vd->persmat, mat);
-
- if(Gwp.flag & VP_COLINDEX) {
- for(index=0; index<totindex; index++) {
- if(indexar[index] && indexar[index]<=me->totface) {
-
- mface= ((MFace *)me->mface) + (indexar[index]-1);
-
- if(mface->mat_nr!=ob->actcol-1) {
- indexar[index]= 0;
- }
- }
- }
- }
-
- if((G.f & G_FACESELECT) && me->mface) {
- for(index=0; index<totindex; index++) {
- if(indexar[index] && indexar[index]<=me->totface) {
-
- mface= ((MFace *)me->mface) + (indexar[index]-1);
-
- if((mface->flag & ME_FACE_SEL)==0) {
- indexar[index]= 0;
- }
- }
- }
- }
-
- /* make sure each vertex gets treated only once */
- /* and calculate filter weight */
- totw= 0;
- if(Gwp.mode==VP_BLUR)
- paintweight= 0.0f;
- else
- paintweight= editbutvweight;
-
- for(index=0; index<totindex; index++) {
- if(indexar[index] && indexar[index]<=me->totface) {
- mface= me->mface + (indexar[index]-1);
-
- (me->dvert+mface->v1)->flag= 1;
- (me->dvert+mface->v2)->flag= 1;
- (me->dvert+mface->v3)->flag= 1;
- if(mface->v4) (me->dvert+mface->v4)->flag= 1;
-
- if(Gwp.mode==VP_BLUR) {
- MDeformWeight *dw, *(*dw_func)(MDeformVert *, int) = verify_defweight;
-
- if(Gwp.flag & VP_ONLYVGROUP)
- dw_func= get_defweight;
-
- dw= dw_func(me->dvert+mface->v1, ob->actdef-1);
- if(dw) {paintweight+= dw->weight; totw++;}
- dw= dw_func(me->dvert+mface->v2, ob->actdef-1);
- if(dw) {paintweight+= dw->weight; totw++;}
- dw= dw_func(me->dvert+mface->v3, ob->actdef-1);
- if(dw) {paintweight+= dw->weight; totw++;}
- if(mface->v4) {
- dw= dw_func(me->dvert+mface->v4, ob->actdef-1);
- if(dw) {paintweight+= dw->weight; totw++;}
- }
- }
- }
- }
-
- if(Gwp.mode==VP_BLUR)
- paintweight/= (float)totw;
-
- for(index=0; index<totindex; index++) {
-
- if(indexar[index] && indexar[index]<=me->totface) {
- mface= me->mface + (indexar[index]-1);
-
- if((me->dvert+mface->v1)->flag) {
- alpha= calc_vp_alpha_dl(&Gwp, vpimat, vertexcosnos+6*mface->v1, mval);
- if(alpha) {
- do_weight_paint_vertex(ob, mface->v1, alpha, paintweight, vgroup_mirror);
- }
- (me->dvert+mface->v1)->flag= 0;
- }
-
- if((me->dvert+mface->v2)->flag) {
- alpha= calc_vp_alpha_dl(&Gwp, vpimat, vertexcosnos+6*mface->v2, mval);
- if(alpha) {
- do_weight_paint_vertex(ob, mface->v2, alpha, paintweight, vgroup_mirror);
- }
- (me->dvert+mface->v2)->flag= 0;
- }
-
- if((me->dvert+mface->v3)->flag) {
- alpha= calc_vp_alpha_dl(&Gwp, vpimat, vertexcosnos+6*mface->v3, mval);
- if(alpha) {
- do_weight_paint_vertex(ob, mface->v3, alpha, paintweight, vgroup_mirror);
- }
- (me->dvert+mface->v3)->flag= 0;
- }
-
- if((me->dvert+mface->v4)->flag) {
- if(mface->v4) {
- alpha= calc_vp_alpha_dl(&Gwp, vpimat, vertexcosnos+6*mface->v4, mval);
- if(alpha) {
- do_weight_paint_vertex(ob, mface->v4, alpha, paintweight, vgroup_mirror);
- }
- (me->dvert+mface->v4)->flag= 0;
- }
- }
- }
- }
-
- MTC_Mat4SwapMat4(G.vd->persmat, mat);
-
- }
- else BIF_wait_for_statechange();
-
- if(mval[0]!=mvalo[0] || mval[1]!=mvalo[1]) {
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- scrarea_do_windraw(curarea);
-
- if(Gwp.flag & (VP_AREA|VP_SOFT)) {
- /* draw circle in backbuf! */
- persp(PERSP_WIN);
- fdrawXORcirc((float)mval[0], (float)mval[1], Gwp.size);
- persp(PERSP_VIEW);
- }
-
- screen_swapbuffers();
- backdrawview3d(0);
-
- mvalo[0]= mval[0];
- mvalo[1]= mval[1];
- }
- }
-
- if(vertexcosnos)
- MEM_freeN(vertexcosnos);
- MEM_freeN(indexar);
- copy_wpaint_prev(&Gwp, NULL, 0);
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- /* this flag is event for softbody to refresh weightpaint values */
- if(ob->soft) ob->softflag |= OB_SB_REDO;
-
- BIF_undo_push("Weight Paint");
- allqueue(REDRAWVIEW3D, 0);
-}
-
-void vertex_paint()
-{
- Object *ob;
- Mesh *me;
- MFace *mface;
- float mat[4][4], imat[4][4], *vertexcosnos;
- float vpimat[3][3];
- unsigned int paintcol=0, *mcol, *mcolorig, fcol1, fcol2;
- int *indexar, index, alpha, totindex;
- short mval[2], mvalo[2], firsttime=1;
-
- if((G.f & G_VERTEXPAINT)==0) return;
- if(G.obedit) return;
-
- ob= OBACT;
- if(!ob || ob->id.lib) return;
-
- me= get_mesh(ob);
- if(me==NULL || me->totface==0) return;
- if(ob->lay & G.vd->lay); else error("Active object is not in this layer");
-
- if(me->mcol==NULL) make_vertexcol(1);
-
- if(me->mcol==NULL) return;
-
- /* ALLOCATIONS! No return after his line */
-
- /* painting on subsurfs should give correct points too, this returns me->totvert amount */
- vertexcosnos= mesh_get_mapped_verts_nors(ob);
- indexar= get_indexarray();
- copy_vpaint_prev(&Gvp, (unsigned int *)me->mcol, me->totface);
-
- /* opengl/matrix stuff */
- persp(PERSP_VIEW);
- /* imat for normals */
- Mat4MulMat4(mat, ob->obmat, G.vd->viewmat);
- Mat4Invert(imat, mat);
- Mat3CpyMat4(vpimat, imat);
-
- /* load projection matrix */
- mymultmatrix(ob->obmat);
- mygetsingmatrix(mat);
- myloadmatrix(G.vd->viewmat);
-
- paintcol= vpaint_get_current_col(&Gvp);
-
- getmouseco_areawin(mvalo);
-
- getmouseco_areawin(mval);
- mvalo[0]= mval[0];
- mvalo[1]= mval[1];
-
- while (get_mbut() & L_MOUSE) {
- getmouseco_areawin(mval);
-
- if(firsttime || mval[0]!=mvalo[0] || mval[1]!=mvalo[1]) {
-
- firsttime= 0;
-
- /* which faces are involved */
- if(Gvp.flag & VP_AREA) {
- totindex= sample_backbuf_area(&Gvp, indexar, me->totface, mval[0], mval[1], Gvp.size);
- }
- else {
- indexar[0]= sample_backbuf(mval[0], mval[1]);
- if(indexar[0]) totindex= 1;
- else totindex= 0;
- }
-
- MTC_Mat4SwapMat4(G.vd->persmat, mat);
-
- if(Gvp.flag & VP_COLINDEX) {
- for(index=0; index<totindex; index++) {
- if(indexar[index] && indexar[index]<=me->totface) {
-
- mface= ((MFace *)me->mface) + (indexar[index]-1);
-
- if(mface->mat_nr!=ob->actcol-1) {
- indexar[index]= 0;
- }
- }
- }
- }
- if((G.f & G_FACESELECT) && me->mface) {
- for(index=0; index<totindex; index++) {
- if(indexar[index] && indexar[index]<=me->totface) {
- mface= ((MFace *)me->mface) + (indexar[index]-1);
-
- if((mface->flag & ME_FACE_SEL)==0)
- indexar[index]= 0;
- }
- }
- }
-
- for(index=0; index<totindex; index++) {
-
- if(indexar[index] && indexar[index]<=me->totface) {
-
- mface= ((MFace *)me->mface) + (indexar[index]-1);
- mcol= ( (unsigned int *)me->mcol) + 4*(indexar[index]-1);
- mcolorig= ( (unsigned int *)Gvp.vpaint_prev) + 4*(indexar[index]-1);
-
- if(Gvp.mode==VP_BLUR) {
- fcol1= mcol_blend( mcol[0], mcol[1], 128);
- if(mface->v4) {
- fcol2= mcol_blend( mcol[2], mcol[3], 128);
- paintcol= mcol_blend( fcol1, fcol2, 128);
- }
- else {
- paintcol= mcol_blend( mcol[2], fcol1, 170);
- }
-
- }
-
- alpha= calc_vp_alpha_dl(&Gvp, vpimat, vertexcosnos+6*mface->v1, mval);
- if(alpha) vpaint_blend( mcol, mcolorig, paintcol, alpha);
-
- alpha= calc_vp_alpha_dl(&Gvp, vpimat, vertexcosnos+6*mface->v2, mval);
- if(alpha) vpaint_blend( mcol+1, mcolorig+1, paintcol, alpha);
-
- alpha= calc_vp_alpha_dl(&Gvp, vpimat, vertexcosnos+6*mface->v3, mval);
- if(alpha) vpaint_blend( mcol+2, mcolorig+2, paintcol, alpha);
-
- if(mface->v4) {
- alpha= calc_vp_alpha_dl(&Gvp, vpimat, vertexcosnos+6*mface->v4, mval);
- if(alpha) vpaint_blend( mcol+3, mcolorig+3, paintcol, alpha);
- }
- }
- }
-
- MTC_Mat4SwapMat4(G.vd->persmat, mat);
-
- do_shared_vertexcol(me);
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- scrarea_do_windraw(curarea);
-
- if(Gvp.flag & (VP_AREA|VP_SOFT)) {
- /* draw circle in backbuf! */
- persp(PERSP_WIN);
- fdrawXORcirc((float)mval[0], (float)mval[1], Gvp.size);
- persp(PERSP_VIEW);
- }
- screen_swapbuffers();
- backdrawview3d(0);
-
- mvalo[0]= mval[0];
- mvalo[1]= mval[1];
- }
- else BIF_wait_for_statechange();
- }
-
- if(vertexcosnos)
- MEM_freeN(vertexcosnos);
- MEM_freeN(indexar);
-
- /* frees prev buffer */
- copy_vpaint_prev(&Gvp, NULL, 0);
-
- BIF_undo_push("Vertex Paint");
-
- allqueue(REDRAWVIEW3D, 0);
-}
-
-void set_wpaint(void) /* toggle */
-{
- Object *ob;
- Mesh *me;
-
- scrarea_queue_headredraw(curarea);
- ob= OBACT;
- if(!ob || ob->id.lib) return;
- me= get_mesh(ob);
-
- if(me && me->totface>=MAXINDEX) {
- error("Maximum number of faces: %d", MAXINDEX-1);
- G.f &= ~G_WEIGHTPAINT;
- return;
- }
-
- if(G.f & G_WEIGHTPAINT) G.f &= ~G_WEIGHTPAINT;
- else G.f |= G_WEIGHTPAINT;
-
- allqueue(REDRAWVIEW3D, 1); /* including header */
- allqueue(REDRAWBUTSEDIT, 0);
-
- /* Weightpaint works by overriding colors in mesh,
- * so need to make sure we recalc on enter and
- * exit (exit needs doing regardless because we
- * should redeform).
- */
- if (me) {
- DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
- }
-
- if(G.f & G_WEIGHTPAINT) {
- Object *par;
-
- setcursor_space(SPACE_VIEW3D, CURSOR_VPAINT);
-
- mesh_octree_table(ob, NULL, 's');
-
- /* verify if active weight group is also active bone */
- par= modifiers_isDeformedByArmature(ob);
- if(par && (par->flag & OB_POSEMODE)) {
- bPoseChannel *pchan;
- for(pchan= par->pose->chanbase.first; pchan; pchan= pchan->next)
- if(pchan->bone->flag & BONE_ACTIVE)
- break;
- if(pchan)
- vertexgroup_select_by_name(ob, pchan->name);
- }
- }
- else {
- if(!(G.f & G_FACESELECT))
- setcursor_space(SPACE_VIEW3D, CURSOR_STD);
-
- mesh_octree_table(ob, NULL, 'e');
- }
-}
-
-
-void set_vpaint(void) /* toggle */
-{
- Object *ob;
- Mesh *me;
-
- scrarea_queue_headredraw(curarea);
- ob= OBACT;
- if(!ob || object_data_is_libdata(ob)) {
- G.f &= ~G_VERTEXPAINT;
- return;
- }
-
- me= get_mesh(ob);
-
- if(me && me->totface>=MAXINDEX) {
- error("Maximum number of faces: %d", MAXINDEX-1);
- G.f &= ~G_VERTEXPAINT;
- return;
- }
-
- if(me && me->mcol==NULL) make_vertexcol(1);
-
- if(G.f & G_VERTEXPAINT){
- G.f &= ~G_VERTEXPAINT;
- }
- else {
- G.f |= G_VERTEXPAINT;
- /* Turn off weight painting */
- if (G.f & G_WEIGHTPAINT)
- set_wpaint();
- }
-
- allqueue(REDRAWVIEW3D, 1); /* including header */
- allqueue(REDRAWBUTSEDIT, 0);
-
- if (me)
- /* update modifier stack for mapping requirements */
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
-
- if(G.f & G_VERTEXPAINT) {
- setcursor_space(SPACE_VIEW3D, CURSOR_VPAINT);
- }
- else {
- if((G.f & G_FACESELECT)==0) setcursor_space(SPACE_VIEW3D, CURSOR_STD);
- }
-}
-
diff --git a/source/blender/src/winlay.h b/source/blender/src/winlay.h
deleted file mode 100644
index 2fdc2c70ac3..00000000000
--- a/source/blender/src/winlay.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-/* Abstract window operations */
-
-struct BCursor;
-
-typedef struct _Window Window;
-typedef void (*WindowHandlerFP) (Window *win, void *user_data, short evt, short val, char ascii);
-
-Window* window_open (char *title, int x, int y, int width, int height, int start_maximized);
-void window_set_handler (Window *win, WindowHandlerFP handler, void *user_data);
-void window_destroy (Window *win);
-
-void window_set_timer (Window *win, int delay_ms, int event);
-
-void window_make_active (Window *win);
-void window_swap_buffers (Window *win);
-
-#if 0
-//#ifdef _WIN32 // FULLSCREEN
-void window_toggle_fullscreen(Window *win, int fullscreen);
-#endif
-
-void window_raise (Window *win);
-void window_lower (Window *win);
-
-short window_get_qual (Window *win);
-short window_get_mbut (Window *win);
-void window_get_mouse (Window *win, short *mval);
-
-float window_get_pressure(Window *win);
-void window_get_tilt(Window *win, float *xtilt, float *ytilt);
-short window_get_activedevice(Window *win);
-
-void window_get_position (Window *win, int *posx_r, int *poxy_r);
-
-void window_get_size (Window *win, int *width_r, int *height_r);
-void window_set_size (Window *win, int width, int height);
-
-char* window_get_title (Window *win);
-void window_set_title (Window *win, char *title);
-
-void window_set_cursor (Window *win, int cursor);
-void window_set_custom_cursor (Window *win, unsigned char mask[16][2],
- unsigned char bitmap[16][2], int hotx, int hoty );
-void window_set_custom_cursor_ex (Window *win, struct BCursor *cursor, int useBig);
-
-void window_warp_pointer (Window *win, int x, int y);
-
-void window_queue_redraw (Window *win);
-
- /* Global windowing operations */
-
-Window* winlay_get_active_window(void);
-
-void winlay_process_events (int wait_for_event);
-
-void winlay_get_screensize (int *width_r, int *height_r);
diff --git a/source/blender/src/writeavicodec.c b/source/blender/src/writeavicodec.c
deleted file mode 100644
index 6ee42d7807a..00000000000
--- a/source/blender/src/writeavicodec.c
+++ /dev/null
@@ -1,835 +0,0 @@
-/**
- * Functions for writing windows avi-format files.
- *
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#if defined(_WIN32) && !defined(FREE_WINDOWS)
-
-#define INC_OLE2
-#include <windows.h>
-#undef rad1
-#undef rad2
-
-#include <windowsx.h>
-#include <memory.h>
-#include <mmsystem.h>
-#include <vfw.h>
-
-#include <string.h>
-
-#include "MEM_guardedalloc.h"
-#include "BLI_blenlib.h"
-#include "DNA_userdef_types.h"
-#include "DNA_scene_types.h"
-
-#include "BKE_global.h"
-#include "BKE_scene.h"
-#include "BKE_writeavi.h"
-
-#include "BIF_toolbox.h"
-
-// this defines the compression type for
-// the output video stream
-
-AVICOMPRESSOPTIONS opts;
-
-static int sframe;
-static PAVIFILE pfile = NULL;
-static int avifileinitdone = 0;
-static PAVISTREAM psUncompressed = NULL, psCompressed = NULL;
-
-// function definitions
-static void init_bmi(BITMAPINFOHEADER *bmi,int rectx, int recty );
-static void opts_to_acd(AviCodecData *acd);
-static void acd_to_opts(AviCodecData *acd);
-static void free_opts_data();
-static int open_avi_codec_file(char * name,RenderData *rd,int rectx, int recty );
-
-///////////////////////////////////////////////////////////////////////////
-//
-// silly default parameters
-//
-///////////////////////////////////////////////////////////////////////////
-
-#define DEFAULT_WIDTH 240
-#define DEFAULT_HEIGHT 120
-#define DEFAULT_LENGTH 100
-#define DEFAULT_SIZE 6
-#define DEFAULT_COLOR RGB(255,0,0)
-#define XSPEED 7
-#define YSPEED 5
-
-///////////////////////////////////////////////////////////////////////////
-//
-// useful macros
-//
-///////////////////////////////////////////////////////////////////////////
-
-#define ALIGNULONG(i) ((i+3)&(~3)) /* ULONG aligned ! */
-#define WIDTHBYTES(i) ((unsigned)((i+31)&(~31))/8) /* ULONG aligned ! */
-#define DIBWIDTHBYTES(bi) (int)WIDTHBYTES((int)(bi).biWidth * (int)(bi).biBitCount)
-#define DIBPTR(lpbi) ((LPBYTE)(lpbi) + \
- (int)(lpbi)->biSize + \
- (int)(lpbi)->biClrUsed * sizeof(RGBQUAD) )
-
-///////////////////////////////////////////////////////////////////////////
-//
-// custom video stream instance structure
-//
-///////////////////////////////////////////////////////////////////////////
-
-typedef struct {
-
- //
- // The Vtbl must come first
- //
- IAVIStreamVtbl * lpvtbl;
-
- //
- // private ball instance data
- //
- ULONG ulRefCount;
-
- DWORD fccType; // is this audio/video
-
- int width; // size in pixels of each frame
- int height;
- int length; // length in frames of the pretend AVI movie
- int size;
- COLORREF color; // ball color
-
-} AVIBALL, * PAVIBALL;
-
-///////////////////////////////////////////////////////////////////////////
-//
-// custom stream methods
-//
-///////////////////////////////////////////////////////////////////////////
-
-HRESULT STDMETHODCALLTYPE AVIBallQueryInterface(PAVISTREAM ps, REFIID riid, LPVOID * ppvObj);
-HRESULT STDMETHODCALLTYPE AVIBallCreate (PAVISTREAM ps, LONG lParam1, LONG lParam2);
-ULONG STDMETHODCALLTYPE AVIBallAddRef (PAVISTREAM ps);
-ULONG STDMETHODCALLTYPE AVIBallRelease (PAVISTREAM ps);
-HRESULT STDMETHODCALLTYPE AVIBallInfo (PAVISTREAM ps, AVISTREAMINFOW * psi, LONG lSize);
-LONG STDMETHODCALLTYPE AVIBallFindSample (PAVISTREAM ps, LONG lPos, LONG lFlags);
-HRESULT STDMETHODCALLTYPE AVIBallReadFormat (PAVISTREAM ps, LONG lPos, LPVOID lpFormat, LONG *lpcbFormat);
-HRESULT STDMETHODCALLTYPE AVIBallSetFormat (PAVISTREAM ps, LONG lPos, LPVOID lpFormat, LONG cbFormat);
-HRESULT STDMETHODCALLTYPE AVIBallRead (PAVISTREAM ps, LONG lStart, LONG lSamples, LPVOID lpBuffer, LONG cbBuffer, LONG * plBytes,LONG * plSamples);
-HRESULT STDMETHODCALLTYPE AVIBallWrite (PAVISTREAM ps, LONG lStart, LONG lSamples, LPVOID lpBuffer, LONG cbBuffer, DWORD dwFlags, LONG *plSampWritten, LONG *plBytesWritten);
-HRESULT STDMETHODCALLTYPE AVIBallDelete (PAVISTREAM ps, LONG lStart, LONG lSamples);
-HRESULT STDMETHODCALLTYPE AVIBallReadData (PAVISTREAM ps, DWORD fcc, LPVOID lp,LONG *lpcb);
-HRESULT STDMETHODCALLTYPE AVIBallWriteData (PAVISTREAM ps, DWORD fcc, LPVOID lp,LONG cb);
-
-IAVIStreamVtbl AVIBallHandler = {
- AVIBallQueryInterface,
- AVIBallAddRef,
- AVIBallRelease,
- AVIBallCreate,
- AVIBallInfo,
- AVIBallFindSample,
- AVIBallReadFormat,
- AVIBallSetFormat,
- AVIBallRead,
- AVIBallWrite,
- AVIBallDelete,
- AVIBallReadData,
- AVIBallWriteData
-};
-
-
-//
-// This is the function an application would call to create a PAVISTREAM to
-// reference the ball. Then the standard AVIStream function calls can be
-// used to work with this stream.
-//
-PAVISTREAM WINAPI NewBall(void)
-{
- static AVIBALL ball;
- PAVIBALL pball = &ball;
-
- //
- // Fill the function table
- //
- pball->lpvtbl = &AVIBallHandler;
-
- //
- // Call our own create code to create a new instance (calls AVIBallCreate)
- // For now, don't use any lParams.
- //
- pball->lpvtbl->Create((PAVISTREAM) pball, 0, 0);
-
- return (PAVISTREAM) pball;
-}
-
-///////////////////////////////////////////////////////////////////////////
-//
-// This function is called to initialize an instance of the bouncing ball.
-//
-// When called, we look at the information possibly passed in <lParam1>,
-// if any, and use it to determine the length of movie they want. (Not
-// supported by NewBall right now, but it could be).
-//
-///////////////////////////////////////////////////////////////////////////
-HRESULT STDMETHODCALLTYPE AVIBallCreate(PAVISTREAM ps, LONG lParam1, LONG lParam2)
-{
- PAVIBALL pball = (PAVIBALL) ps;
-
- //
- // what type of data are we? (audio/video/other stream)
- //
- pball->fccType = streamtypeVIDEO;
-
- //
- // We define lParam1 as being the length of movie they want us to pretend
- // to be.
- //
- if (lParam1)
- pball->length = (int) lParam1;
- else
- pball->length = DEFAULT_LENGTH;
-
- switch (pball->fccType) {
-
- case streamtypeVIDEO:
- pball->color = DEFAULT_COLOR;
- pball->width = DEFAULT_WIDTH;
- pball->height = DEFAULT_HEIGHT;
- pball->size = DEFAULT_SIZE;
- pball->ulRefCount = 1; // note that we are opened once
- return AVIERR_OK; // success
-
- case streamtypeAUDIO:
- return ResultFromScode(AVIERR_UNSUPPORTED); // we don't do audio
-
- default:
- return ResultFromScode(AVIERR_UNSUPPORTED); // or anything else
- }
-}
-
-
-//
-// Increment our reference count
-//
-ULONG STDMETHODCALLTYPE AVIBallAddRef(PAVISTREAM ps)
-{
- PAVIBALL pball = (PAVIBALL) ps;
- return (++pball->ulRefCount);
-}
-
-
-//
-// Decrement our reference count
-//
-ULONG STDMETHODCALLTYPE AVIBallRelease(PAVISTREAM ps)
-{
- PAVIBALL pball = (PAVIBALL) ps;
- if (--pball->ulRefCount)
- return pball->ulRefCount;
-
- // Free any data we're keeping around - like our private structure
- GlobalFreePtr(pball);
-
- return 0;
-}
-
-
-//
-// Fills an AVISTREAMINFO structure
-//
-HRESULT STDMETHODCALLTYPE AVIBallInfo(PAVISTREAM ps, AVISTREAMINFOW * psi, LONG lSize)
-{
- PAVIBALL pball = (PAVIBALL) ps;
-
- if (lSize < sizeof(AVISTREAMINFO))
- return ResultFromScode(AVIERR_BUFFERTOOSMALL);
-
- _fmemset(psi, 0, (int)lSize);
-
- // Fill out a stream header with information about us.
- psi->fccType = pball->fccType;
- psi->fccHandler = mmioFOURCC('B','a','l','l');
- psi->dwScale = 1;
- psi->dwRate = 15;
- psi->dwLength = pball->length;
- psi->dwSuggestedBufferSize = pball->height * ALIGNULONG(pball->width);
- psi->rcFrame.right = pball->width;
- psi->rcFrame.bottom = pball->height;
- CopyMemory((PVOID)psi->szName,
- (PVOID)L"Bouncing ball video",
- sizeof(L"Bouncing ball video"));
-
- return AVIERR_OK;
-}
-
-///////////////////////////////////////////////////////////////////////////
-//
-// AVIBallReadFormat: needs to return the format of our data.
-//
-///////////////////////////////////////////////////////////////////////////
-HRESULT STDMETHODCALLTYPE AVIBallReadFormat (PAVISTREAM ps, LONG lPos,LPVOID lpFormat,LONG *lpcbFormat)
-{
- PAVIBALL pball = (PAVIBALL) ps;
- LPBITMAPINFO lpbi = (LPBITMAPINFO) lpFormat;
-
- if (lpFormat == NULL || *lpcbFormat == 0) {
- *lpcbFormat = sizeof(BITMAPINFOHEADER);
- return AVIERR_OK;
- }
-
- if (*lpcbFormat < sizeof(BITMAPINFOHEADER))
- return ResultFromScode(AVIERR_BUFFERTOOSMALL);
-
- // This is a relatively silly example: we build up our
- // format from scratch every time.
-
- /*
- lpbi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
- lpbi->bmiHeader.biCompression = BI_RGB;
- lpbi->bmiHeader.biWidth = pball->width;
- lpbi->bmiHeader.biHeight = pball->height;
- lpbi->bmiHeader.biBitCount = 8;
- lpbi->bmiHeader.biPlanes = 1;
- lpbi->bmiHeader.biClrUsed = 2;
- lpbi->bmiHeader.biSizeImage = pball->height * DIBWIDTHBYTES(lpbi->bmiHeader);
- */
-
- //init_bmi(&lpbi->bmiHeader);
-
- memset(&lpbi->bmiHeader, 0, sizeof(BITMAPINFOHEADER));
- lpbi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
- lpbi->bmiHeader.biWidth = pball->width;
- lpbi->bmiHeader.biHeight = pball->height;
- lpbi->bmiHeader.biPlanes = 1;
- lpbi->bmiHeader.biBitCount = 24;
- lpbi->bmiHeader.biSizeImage = pball->width * pball->height * sizeof(RGBTRIPLE);
-
- /*
- lpbi->bmiColors[0].rgbRed = 0;
- lpbi->bmiColors[0].rgbGreen = 0;
- lpbi->bmiColors[0].rgbBlue = 0;
- lpbi->bmiColors[1].rgbRed = GetRValue(pball->color);
- lpbi->bmiColors[1].rgbGreen = GetGValue(pball->color);
- lpbi->bmiColors[1].rgbBlue = GetBValue(pball->color);
- */
-
- *lpcbFormat = sizeof(BITMAPINFOHEADER);
-
- return AVIERR_OK;
-}
-
-///////////////////////////////////////////////////////////////////////////
-//
-// AVIBallRead: needs to return the data for a particular frame.
-//
-///////////////////////////////////////////////////////////////////////////
-HRESULT STDMETHODCALLTYPE AVIBallRead (PAVISTREAM ps, LONG lStart,LONG lSamples,LPVOID lpBuffer,LONG cbBuffer,LONG * plBytes,LONG * plSamples)
-{
- PAVIBALL pball = (PAVIBALL) ps;
- LONG lSize = pball->height * ALIGNULONG(pball->width); // size of frame
- // in bytes
- int x, y;
- HPSTR hp = lpBuffer;
- int xPos, yPos;
-
- // Reject out of range values
- if (lStart < 0 || lStart >= pball->length)
- return ResultFromScode(AVIERR_BADPARAM);
-
- // Did they just want to know the size of our data?
- if (lpBuffer == NULL || cbBuffer == 0)
- goto exit;
-
- // Will our frame fit in the buffer passed?
- if (lSize > cbBuffer)
- return ResultFromScode(AVIERR_BUFFERTOOSMALL);
-
- // Figure out the position of the ball.
- // It just bounces back and forth.
-
- xPos = 5 + XSPEED * (int) lStart; // x = x0 + vt
- xPos = xPos % ((pball->width - pball->size) * 2); // limit to 2xwidth
- if (xPos > (pball->width - pball->size)) // reflect if
- xPos = 2 * (pball->width - pball->size) - xPos; // needed
-
- yPos = 5 + YSPEED * (int) lStart;
- yPos = yPos % ((pball->height - pball->size) * 2);
- if (yPos > (pball->height - pball->size))
- yPos = 2 * (pball->height - pball->size) - yPos;
-
- //
- // Build a DIB from scratch by writing in 1's where the ball is, 0's
- // where it isn't.
- //
- // Notice that we just build it in the buffer we've been passed.
- //
- // This is pretty ugly, I have to admit.
- //
- for (y = 0; y < pball->height; y++)
- {
- if (y >= yPos && y < yPos + pball->size)
- {
- for (x = 0; x < pball->width; x++)
- {
- *hp++ = (BYTE) ((x >= xPos && x < xPos + pball->size) ? 1 : 0);
- }
- }
- else
- {
- for (x = 0; x < pball->width; x++)
- {
- *hp++ = 0;
- }
- }
-
- hp += pball->width - ALIGNULONG(pball->width);
- }
-
-exit:
- // We always return exactly one frame
- if (plSamples)
- *plSamples = 1;
-
- // Return the size of our frame
- if (plBytes)
- *plBytes = lSize;
-
- return AVIERR_OK;
-}
-
-
-HRESULT STDMETHODCALLTYPE AVIBallQueryInterface(PAVISTREAM ps, REFIID riid, LPVOID * ppvObj)
-{
- PAVIBALL pball = (PAVIBALL) ps;
-
- // We support the Unknown interface (everybody does) and our Stream
- // interface.
-
- if (_fmemcmp(riid, &IID_IUnknown, sizeof(GUID)) == 0)
- *ppvObj = (LPVOID)pball;
-
- else if (_fmemcmp(riid, &IID_IAVIStream, sizeof(GUID)) == 0)
- *ppvObj = (LPVOID)pball;
-
- else {
- *ppvObj = NULL;
- return ResultFromScode(E_NOINTERFACE);
- }
-
- AVIBallAddRef(ps);
-
- return AVIERR_OK;
-}
-
-LONG STDMETHODCALLTYPE AVIBallFindSample (PAVISTREAM ps, LONG lPos, LONG lFlags)
-{
- // The only format change is frame 0
- if ((lFlags & FIND_TYPE) == FIND_FORMAT) {
- if ((lFlags & FIND_DIR) == FIND_NEXT && lPos > 0)
- return -1; // no more format changes
- else
- return 0;
-
- // FIND_KEY and FIND_ANY always return the same position because
- // every frame is non-empty and a key frame
- } else
- return lPos;
-}
-
-HRESULT STDMETHODCALLTYPE AVIBallReadData (PAVISTREAM ps, DWORD fcc, LPVOID lp, LONG *lpcb)
-{
- return ResultFromScode(AVIERR_UNSUPPORTED);
-}
-
-HRESULT STDMETHODCALLTYPE AVIBallSetFormat (PAVISTREAM ps, LONG lPos, LPVOID lpFormat, LONG cbFormat)
-{
- return ResultFromScode(AVIERR_UNSUPPORTED);
-}
-
-HRESULT STDMETHODCALLTYPE AVIBallWriteData (PAVISTREAM ps, DWORD fcc, LPVOID lp, LONG cb)
-{
- return ResultFromScode(AVIERR_UNSUPPORTED);
-}
-
-HRESULT STDMETHODCALLTYPE AVIBallWrite (PAVISTREAM ps, LONG lStart, LONG lSamples, LPVOID lpBuffer, LONG cbBuffer, DWORD dwFlags, LONG *plSampWritten, LONG *plBytesWritten)
-{
- return ResultFromScode(AVIERR_UNSUPPORTED);
-}
-
-HRESULT STDMETHODCALLTYPE AVIBallDelete (PAVISTREAM ps, LONG lStart, LONG lSamples)
-{
- return ResultFromScode(AVIERR_UNSUPPORTED);
-}
-
-
-//////////////////////////////////////
-static void init_bmi(BITMAPINFOHEADER *bmi,int rectx, int recty )
-{
- memset(bmi, 0, sizeof(BITMAPINFOHEADER));
- bmi->biSize = sizeof(BITMAPINFOHEADER);
- bmi->biWidth = rectx;
- bmi->biHeight = recty;
- bmi->biPlanes = 1;
- bmi->biBitCount = 24;
- bmi->biSizeImage = bmi->biWidth * bmi->biHeight * sizeof(RGBTRIPLE);
-}
-
-
-static void opts_to_acd(AviCodecData *acd)
-{
- HIC hic;
- ICINFO icinfo;
-
- acd->fccType = opts.fccType;
- acd->fccHandler = opts.fccHandler;
- acd->dwKeyFrameEvery = opts.dwKeyFrameEvery;
- acd->dwQuality = opts.dwQuality;
- acd->dwBytesPerSecond = opts.dwBytesPerSecond;
- acd->dwFlags = opts.dwFlags;
- acd->dwInterleaveEvery = opts.dwInterleaveEvery;
- acd->cbFormat = opts.cbFormat;
- acd->cbParms = opts.cbParms;
-
- if (opts.lpFormat && opts.cbFormat) {
- acd->lpFormat = MEM_mallocN(opts.cbFormat, "avi.lpFormat");
- memcpy(acd->lpFormat, opts.lpFormat, opts.cbFormat);
- }
-
- if (opts.lpParms && opts.cbParms) {
- acd->lpParms = MEM_mallocN(opts.cbParms, "avi.lpParms");
- memcpy(acd->lpParms, opts.lpParms, opts.cbParms);
- }
-
- if ((hic=ICOpen(ICTYPE_VIDEO,acd->fccHandler,ICMODE_QUERY))!=NULL) {
- icinfo.dwSize=sizeof(ICINFO);
- if (ICGetInfo(hic,&icinfo,sizeof(ICINFO))) {
- WideCharToMultiByte(CP_ACP,0,icinfo.szDescription,-1,acd->avicodecname,128,NULL,NULL);
- } else
- sprintf(acd->avicodecname, "undefined");
- if (ICClose(hic)!=ICERR_OK)
-;// return 0;
- } else {
- sprintf(acd->avicodecname, "Full Frames (Uncompressed)"); //heh, nasty
- }
-}
-
-
-static void acd_to_opts(AviCodecData *acd)
-{
- memset(&opts, 0, sizeof(opts));
- if (acd) {
- opts.fccType = acd->fccType;
- opts.fccHandler = acd->fccHandler;
- opts.dwKeyFrameEvery = acd->dwKeyFrameEvery;
- opts.dwQuality = acd->dwQuality;
- opts.dwBytesPerSecond = acd->dwBytesPerSecond;
- opts.dwFlags = acd->dwFlags;
- opts.dwInterleaveEvery = acd->dwInterleaveEvery;
- opts.cbFormat = acd->cbFormat;
- opts.cbParms = acd->cbParms;
-
- if (acd->lpFormat && acd->cbFormat) {
- opts.lpFormat = MEM_mallocN(opts.cbFormat, "opts lpFormat");
- memcpy(opts.lpFormat, acd->lpFormat, opts.cbFormat);
- }
-
- if (acd->lpParms && acd->cbParms) {
- opts.lpParms = MEM_mallocN(opts.cbParms, "opts.cbParms");
- memcpy(opts.lpParms, acd->lpParms, opts.cbParms);
- }
- }
-}
-
-static void free_opts_data()
-{
- if (opts.lpFormat) {
- MEM_freeN(opts.lpFormat);
- opts.lpFormat = NULL;
- }
- if (opts.lpParms) {
- MEM_freeN(opts.lpParms);
- opts.lpParms = NULL;
- }
-}
-
-static int open_avi_codec_file(char * name,RenderData *rd,int rectx, int recty )
-{
- HRESULT hr;
- WORD wVer;
- BITMAPINFOHEADER bmi;
- AVISTREAMINFO strhdr;
- int ret_val = 0;
-
- wVer = HIWORD(VideoForWindowsVersion());
- if (wVer < 0x010a){
- // this is probably an obsolete check...
- ret_val = 1;
- } else {
- AVIFileInit();
- avifileinitdone++;
-
- hr = AVIFileOpen(&pfile, // returned file pointer
- name, // file name
- OF_WRITE | OF_CREATE, // mode to open file with
- NULL); // use handler determined
-
- if (hr != AVIERR_OK) {
- ret_val = 1;
- } else {
- // initialize the BITMAPINFOHEADER
- init_bmi(&bmi,rectx,recty);
- // and associate a stream with the input images
- memset(&strhdr, 0, sizeof(strhdr));
- strhdr.fccType = streamtypeVIDEO; // stream type
- if (G.scene->r.avicodecdata) {
- strhdr.fccHandler = G.scene->r.avicodecdata->fccHandler;
- }
- strhdr.dwScale = 1;
- strhdr.dwRate = rd->frs_sec;
- strhdr.dwSuggestedBufferSize = bmi.biSizeImage;
- SetRect(&strhdr.rcFrame, 0, 0, // rectangle for stream
- (int) bmi.biWidth,
- (int) bmi.biHeight);
-
- // And create the stream
- hr = AVIFileCreateStream(
- pfile, // file pointer
- &psUncompressed,// returned stream pointer
- &strhdr); // stream header
-
- if (hr != AVIERR_OK) {
- ret_val = 1;
- } else {
- acd_to_opts(G.scene->r.avicodecdata);
- }
- }
- }
-
- return(ret_val);
-}
-
-
-void end_avi_codec(void)
-{
- free_opts_data();
-
- if (psUncompressed) {
- AVIStreamClose(psUncompressed);
- psUncompressed = NULL;
- }
-
- if (psCompressed) {
- AVIStreamClose(psCompressed);
- psCompressed = NULL;
- }
-
- if (pfile) {
- AVIFileClose(pfile);
- pfile = NULL;
- }
-
- if (avifileinitdone > 0) {
- AVIFileExit();
- avifileinitdone--;
- }
-}
-
-
-void start_avi_codec(RenderData *rd,int rectx, int recty )
-{
- HRESULT hr;
- BITMAPINFOHEADER bmi;
- char name[2048];
- char bakname[2048];
-
- makeavistring(rd,name);
- sframe = (G.scene->r.sfra);
-
- strcpy(bakname, name);
- strcat(bakname, ".bak");
-
- if (BLI_exists(name)) {
- BLI_move(name, bakname);
- }
-
- // initialize the BITMAPINFOHEADER
- init_bmi(&bmi,rectx,recty);
-
- if (open_avi_codec_file(name,rd,rectx,recty)) {
- error("Can not open file %s", name);
- G.afbreek = 1;
- } else {
- // now create a compressed stream from the uncompressed
- // stream and the compression options
- hr = AVIMakeCompressedStream(
- &psCompressed, // returned stream pointer
- psUncompressed, // uncompressed stream
- &opts, // compression options
- NULL); // Unknown...
- if (hr != AVIERR_OK) {
- error("Codec is locked or not supported.");
- G.afbreek = 1;
- } else {
- hr = AVIStreamSetFormat(psCompressed, 0,
- &bmi, // stream format
- bmi.biSize + // format size
- bmi.biClrUsed * sizeof(RGBQUAD)); // plus size of colormap
- if (hr != AVIERR_OK) {
- printf("AVIStreamSetFormat() failed .. may be bad image dimensions? \n");
- error("Codec refuses format.");
- G.afbreek = 1;
- }
- }
- }
-
- if (G.afbreek != 1) {
- printf("Created win avi: %s\n", name);
- if (BLI_exists(bakname)) {
- BLI_delete(bakname, 0, 0);
- }
- } else {
- // close the darn thing and remove it.
- end_avi_codec();
- if (BLI_exists(name)) {
- BLI_delete(name, 0, 0);
- }
- if (BLI_exists(bakname)) {
- BLI_move(bakname, name);
- }
- }
-}
-
-
-void append_avi_codec(int frame,int *pixels,int rectx, int recty)
-{
- HRESULT hr;
- BITMAPINFOHEADER bmi;
- RGBTRIPLE *buffer, *to;
- int x, y ,pad, align =2;
- unsigned char *from;
-
- if (psCompressed) {
- // initialize the BITMAPINFOHEADER
- init_bmi(&bmi, rectx, recty);
-
- //windows wants bitmap rows aligned
- pad = (rectx*3) - align*((rectx*3)/align);
- if (pad) {
- pad = align - pad;
- }
-
- // copy pixels
- buffer = MEM_mallocN(bmi.biSizeImage + pad * recty, "append_win_avi");
- to = buffer;
- from = (unsigned char *) pixels;
- for (y = recty; y > 0 ; y--) {
- for (x = rectx; x > 0 ; x--) {
- to->rgbtRed = from[0];
- to->rgbtGreen = from[1];
- to->rgbtBlue = from[2];
- to++; from += 4;
- }
- (unsigned char *)to += pad;
- }
-
- hr = AVIStreamWrite(
- psCompressed, // stream pointer
- frame - sframe, // frame number
- 1, // number to write
- (LPBYTE) buffer,// pointer to data
- bmi.biSizeImage + pad * recty, // size of this frame
- AVIIF_KEYFRAME, // flags....
- NULL,
- NULL);
-
- MEM_freeN(buffer);
-
- if (hr != AVIERR_OK) {
- G.afbreek = 1;
- } else {
- printf ("added frame %3d (frame %3d in avi): ", frame, frame-sframe);
- }
- }
-}
-
-
-int get_avicodec_settings(void)
-{
- int ret_val = 0;
- AVICOMPRESSOPTIONS *aopts[1] = {&opts};
- AviCodecData *acd = G.scene->r.avicodecdata;
- static PAVISTREAM psdummy;
- UINT uiFlags;
-
- acd_to_opts(G.scene->r.avicodecdata);
-
- psdummy = NewBall();
-
- if(U.uiflag & USER_ALLWINCODECS)
- uiFlags = ICMF_CHOOSE_ALLCOMPRESSORS;
- else
- uiFlags = ICMF_CHOOSE_KEYFRAME | ICMF_CHOOSE_DATARATE;
-
- if (psdummy == NULL) {
- ret_val = 1;
- } else {
- if (!AVISaveOptions(NULL,
- uiFlags,
-// ICMF_CHOOSE_KEYFRAME | ICMF_CHOOSE_DATARATE,
-// ICMF_CHOOSE_ALLCOMPRESSORS,
- 1,
- &psdummy,
- (LPAVICOMPRESSOPTIONS *) &aopts))
- {
- ret_val = 1;
- } else {
- if (acd) {
- free_avicodecdata(acd);
- } else {
- acd = G.scene->r.avicodecdata = MEM_callocN(sizeof(AviCodecData), "AviCodecData");
- }
-
- opts_to_acd(acd);
-
- AVISaveOptionsFree(1, aopts);
- memset(&opts, 0, sizeof(opts));
- }
- }
-
- return(ret_val);
-}
-
-#endif // _WIN32
diff --git a/source/blender/src/writeimage.c b/source/blender/src/writeimage.c
deleted file mode 100644
index 50d69fcdc76..00000000000
--- a/source/blender/src/writeimage.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#include <string.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "IMB_imbuf.h"
-#include "IMB_imbuf_types.h" // ImBuf{}
-
-#include "BLI_blenlib.h"
-
-#include "DNA_scene_types.h"
-#include "DNA_space_types.h"
-#include "DNA_texture_types.h" // EnvMap{}
-#include "DNA_image_types.h" // Image{}
-
-#include "BKE_global.h" // struct G
-#include "BKE_image.h"
-#include "BKE_utildefines.h" // ELEM
-
-#include "BIF_screen.h" // waitcursor
-#include "BIF_toolbox.h"
-#include "BIF_writeimage.h"
-
-#include "BSE_filesel.h"
-
-#include "RE_pipeline.h"
-
-/* ------------------------------------------------------------------------- */
-
-
-void BIF_save_envmap(EnvMap *env, char *str)
-{
- ImBuf *ibuf;
-/* extern rectcpy(); */
- int dx;
-
- /* all interactive stuff is handled in buttons.c */
- if(env->cube[0]==NULL) return;
-
- dx= env->cube[0]->x;
- ibuf= IMB_allocImBuf(3*dx, 2*dx, 24, IB_rect, 0);
-
- IMB_rectcpy(ibuf, env->cube[0], 0, 0, 0, 0, dx, dx);
- IMB_rectcpy(ibuf, env->cube[1], dx, 0, 0, 0, dx, dx);
- IMB_rectcpy(ibuf, env->cube[2], 2*dx, 0, 0, 0, dx, dx);
- IMB_rectcpy(ibuf, env->cube[3], 0, dx, 0, 0, dx, dx);
- IMB_rectcpy(ibuf, env->cube[4], dx, dx, 0, 0, dx, dx);
- IMB_rectcpy(ibuf, env->cube[5], 2*dx, dx, 0, 0, dx, dx);
-
- BKE_write_ibuf(ibuf, str, G.scene->r.imtype, G.scene->r.subimtype, G.scene->r.quality);
- IMB_freeImBuf(ibuf);
-}
-
-
-#define FTOCHAR(val) val<=0.0f?255: 255-(val>=255.0f?255: (char)(val))
-
-/* callback for fileselect to save rendered image, renderresult was checked to exist */
-static void save_rendered_image_cb_real(char *name, int confirm)
-{
- char str[FILE_MAXDIR+FILE_MAXFILE];
- int overwrite;
-
- if(BLI_testextensie(name,".blend")) {
- error("Wrong filename");
- return;
- }
-
- /* BKE_add_image_extension() checks for if extension was already set */
- if(G.scene->r.scemode & R_EXTENSION)
- if(strlen(name)<FILE_MAXDIR+FILE_MAXFILE-5)
- BKE_add_image_extension(name, G.scene->r.imtype);
-
- strcpy(str, name);
- BLI_convertstringcode(str, G.sce, G.scene->r.cfra);
-
- if (confirm)
- overwrite = saveover(str);
- else
- overwrite = 1;
-
- if(overwrite) {
- if(G.scene->r.imtype==R_MULTILAYER) {
- RenderResult *rr= RE_GetResult(RE_GetRender(G.scene->id.name));
- if(rr)
- RE_WriteRenderResult(rr, str, G.scene->r.quality);
- }
- else {
- RenderResult rres;
- ImBuf *ibuf;
-
- RE_GetResultImage(RE_GetRender(G.scene->id.name), &rres);
-
- waitcursor(1); /* from screen.c */
-
- ibuf= IMB_allocImBuf(rres.rectx, rres.recty, G.scene->r.planes, 0, 0);
- ibuf->rect= (unsigned int *)rres.rect32;
- ibuf->rect_float= rres.rectf;
- ibuf->zbuf_float= rres.rectz;
-
- /* float factor for random dither, imbuf takes care of it */
- ibuf->dither= G.scene->r.dither_intensity;
-
- BKE_write_ibuf(ibuf, str, G.scene->r.imtype, G.scene->r.subimtype, G.scene->r.quality);
- IMB_freeImBuf(ibuf); /* imbuf knows rects are not part of ibuf */
- }
-
- strcpy(G.ima, name);
-
- waitcursor(0);
- }
-}
-
-
-void save_image_filesel_str(char *str)
-{
- switch(G.scene->r.imtype) {
- case R_RADHDR:
- strcpy(str, "Save Radiance HDR");
- break;
- case R_FFMPEG:
- case R_PNG:
- strcpy(str, "Save PNG");
- break;
-#ifdef WITH_DDS
- case R_DDS:
- strcpy(str, "Save DDS");
- break;
-#endif
- case R_BMP:
- strcpy(str, "Save BMP");
- break;
- case R_TIFF:
- if (G.have_libtiff)
- strcpy(str, "Save TIFF");
- break;
-#ifdef WITH_OPENEXR
- case R_OPENEXR:
- strcpy(str, "Save OpenEXR");
- break;
-#endif
- case R_CINEON:
- strcpy(str, "Save Cineon");
- break;
- case R_DPX:
- strcpy(str, "Save DPX");
- break;
- case R_RAWTGA:
- strcpy(str, "Save Raw Targa");
- break;
- case R_IRIS:
- strcpy(str, "Save IRIS");
- break;
- case R_IRIZ:
- strcpy(str, "Save IRIS");
- break;
- case R_HAMX:
- strcpy(str, "Save HAMX");
- break;
- case R_TARGA:
- strcpy(str, "Save Targa");
- break;
- case R_MULTILAYER:
- strcpy(str, "Save Multi Layer EXR");
- break;
- /* default we save jpeg, also for all movie formats */
- case R_JPEG90:
- case R_MOVIE:
- case R_AVICODEC:
- case R_AVIRAW:
- case R_AVIJPEG:
- default:
- strcpy(str, "Save JPEG");
- break;
- }
-}
-
-static void save_rendered_image_cb(char *name)
-{
- save_rendered_image_cb_real(name, 1);
-}
-
-/* no fileselect, no confirm */
-void BIF_save_rendered_image(char *name)
-{
- save_rendered_image_cb_real(name, 0);
-}
-
-/* calls fileselect */
-void BIF_save_rendered_image_fs(void)
-{
- RenderResult rres;
-
- RE_GetResultImage(RE_GetRender(G.scene->id.name), &rres);
-
- if(!rres.rectf && !rres.rect32) {
- error("No image rendered");
- }
- else {
- char dir[FILE_MAXDIR * 2], str[FILE_MAXFILE * 2];
-
- if(G.ima[0]==0) {
- strcpy(dir, G.sce);
- BLI_splitdirstring(dir, str);
- strcpy(G.ima, dir);
- }
-
- save_image_filesel_str(str);
- activate_fileselect(FILE_SPECIAL, str, G.ima, save_rendered_image_cb);
- }
-}
-
-
diff --git a/source/blender/src/writemovie.c b/source/blender/src/writemovie.c
deleted file mode 100644
index 4be739dd5d1..00000000000
--- a/source/blender/src/writemovie.c
+++ /dev/null
@@ -1,502 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-//#ifdef __sgi
-#if 0
-
-#include <unistd.h>
-#include <movie.h>
-#include <cdaudio.h>
-#include <dmedia/cl.h>
-#include <dmedia/cl_cosmo.h>
-#include <sys/file.h> /* flock */
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-
-#include "IMB_imbuf_types.h"
-#include "IMB_imbuf.h"
-
-#include "BKE_global.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_gl.h"
-#include "BIF_writemovie.h"
-#include "BIF_toolbox.h"
-
-#include "render.h"
-
-#define error(str) {perror(str) ; error("%s", str); G.afbreek= 1;}
-#define QUIT(str) {error(str); return;}
-
-#define DIR_UP 1
-#define DIR_DOWN 2
-#define DIR_BOTH (DIR_UP | DIR_DOWN)
-
-#define MAXQUAL R.r.quality
-#define MINQUAL 30
-
-
-/* globals */
-
-static CL_Handle compr, soft_compr;
-static MVid movie, image;
-static DMparams *movie_params, *image_params;
-static int compr_params[64];
-static int myindex, qualindex, qualnow, mv_outx, mv_outy, numfields= 2;
-static char *comp_buf;
-static int sfra, efra, first = TRUE, maxbufsize;
-static int ntsc = FALSE;
-
-#define FIRST_IMAGE "FIRST_IMAGE"
-#define BLENDER_FIRST_IMAGE "BLENDER_1ST_IMG"
-
-
-static void report_flock(void)
-{
- static int flock_reported = FALSE;
-
- if (flock_reported) return;
- flock_reported = TRUE;
-
- error("WriteMovie: couldn't flock() moviefile. Ignoring.");
-}
-
-
-static void make_movie_name(char *string)
-{
- int len;
- char txt[64];
-
- if (string==0) return;
-
- strcpy(string, G.scene->r.pic);
- BLI_convertstringcode(string, G.sce, G.scene->r.cfra);
- len= strlen(string);
-
- BLI_make_existing_file(string);
-
- if (BLI_strcasecmp(string + len - 3, ".mv")) {
- sprintf(txt, "%04d_%04d.mv", sfra, efra);
- strcat(string, txt);
- }
-}
-
-static int my_Compress(uint * rect, int *bufsize)
-{
- int err = 0;
-
- compr_params[qualindex] = qualnow;
- clSetParams(compr, compr_params, myindex);
-
- while (clCompress(compr, numfields, rect, bufsize, comp_buf) != numfields) {
- if (compr == soft_compr) {
- error("clCompress (software)");
- return 1;
- }
-
- /* hardware opnieuw initialiseren */
- clCloseCompressor(compr);
- clOpenCompressor(CL_JPEG_COSMO, &compr);
-
- qualnow--;
- compr_params[qualindex] = qualnow;
- clSetParams(compr, compr_params, myindex);
- printf("retrying at quality %d\n", qualnow);
-
- err= TRUE;
- }
-
- return (err);
-}
-
-static void set_sfra_efra(void)
-{
- sfra = (G.scene->r.sfra);
- efra = (G.scene->r.efra);
-}
-
-static void open_compressor(void)
-{
- int cosmo = FAILURE;
-
- /* initialiseren van de compressor */
-
- if (clOpenCompressor(CL_JPEG_SOFTWARE, &soft_compr) != SUCCESS) QUIT("clOpenCompressor");
-
- if (G.scene->r.mode & R_COSMO) {
- cosmo = clOpenCompressor(CL_JPEG_COSMO, &compr);
- if (cosmo != SUCCESS && first) error("warning: using software compression");
- first = FALSE;
- }
-
- if (cosmo != SUCCESS) compr = soft_compr;
-
- myindex = 0;
-
- compr_params[myindex++]= CL_IMAGE_WIDTH;
- compr_params[myindex++]= mv_outx;
-
- compr_params[myindex++]= CL_IMAGE_HEIGHT;
- compr_params[myindex++]= mv_outy / numfields;
-
- compr_params[myindex++]= CL_JPEG_QUALITY_FACTOR;
- qualindex = myindex;
- compr_params[myindex++]= R.r.quality;
-
- compr_params[myindex++]= CL_ORIGINAL_FORMAT;
- compr_params[myindex++]= CL_RGBX;
-
- compr_params[myindex++]= CL_ORIENTATION;
- compr_params[myindex++]= CL_TOP_DOWN;
-
- compr_params[myindex++]= CL_INTERNAL_FORMAT;
- compr_params[myindex++]= CL_YUV422;
-
- /* this parameter must be set for non-queueing mode */
- compr_params[myindex++]= CL_ENABLE_IMAGEINFO;
- compr_params[myindex++]= 1;
-
- /* enable stream headers */
- compr_params[myindex++]= CL_STREAM_HEADERS;
- compr_params[myindex++]= TRUE;
-
- clSetParams(compr, compr_params, myindex);
- if (compr != soft_compr) clSetParams(soft_compr, compr_params, myindex);
-
- maxbufsize = 2 * clGetParam(compr, CL_COMPRESSED_BUFFER_SIZE);
- comp_buf = MEM_mallocN(maxbufsize, "cosmo_buffer");
-}
-
-static void close_compressor(void)
-{
- MEM_freeN(comp_buf);
- comp_buf = 0;
-
- clCloseCompressor(compr);
- if (soft_compr != compr) clCloseCompressor(soft_compr);
-}
-
-void end_movie(void)
-{
-}
-
-static void new_movie(int fd)
-{
- char string[120];
-
- if (dmParamsCreate(&movie_params) != DM_SUCCESS) QUIT("dmParamsCreate");
- if (dmParamsCreate(&image_params) != DM_SUCCESS) QUIT("dmParamsCreate");
-
- if (mvSetMovieDefaults(movie_params, MV_FORMAT_SGI_3) != DM_SUCCESS) QUIT("mvSetMovieDefaults");
- if (dmSetImageDefaults(image_params, mv_outx, mv_outy, DM_PACKING_RGBX) != DM_SUCCESS) QUIT("dmSetImageDefaults");
-
- mvAddUserParam(BLENDER_FIRST_IMAGE);
- sprintf(string, "%04d", sfra);
- dmParamsSetString(image_params, BLENDER_FIRST_IMAGE, string);
-
- if (ntsc) dmParamsSetFloat(image_params, DM_IMAGE_RATE, 29.97);
- else dmParamsSetFloat(image_params, DM_IMAGE_RATE, 25.0);
-
- if (numfields == 2) {
- if (ntsc) dmParamsSetEnum(image_params, DM_IMAGE_INTERLACING, DM_IMAGE_INTERLACED_ODD);
- else dmParamsSetEnum(image_params, DM_IMAGE_INTERLACING, DM_IMAGE_INTERLACED_EVEN);
- } else dmParamsSetEnum(image_params, DM_IMAGE_INTERLACING, DM_IMAGE_NONINTERLACED);
-
- dmParamsSetEnum(image_params, DM_IMAGE_ORIENTATION, DM_TOP_TO_BOTTOM);
- dmParamsSetString(image_params, DM_IMAGE_COMPRESSION, DM_IMAGE_JPEG);
-
- if (mvCreateFD(fd, movie_params, NULL, &movie) != DM_SUCCESS) QUIT("mvCreateFile");
- if (mvAddTrack(movie, DM_IMAGE, image_params, NULL, &image)) QUIT("mvAddTrack");;
- if (mvSetLoopMode(movie, MV_LOOP_CONTINUOUSLY) != DM_SUCCESS) QUIT("mvSetMovieDefaults");
-
- if (mvWrite(movie) != DM_SUCCESS) QUIT("mvWrite");
- if (mvClose(movie) != DM_SUCCESS) QUIT("mvClose");
-
- dmParamsDestroy(image_params);
- dmParamsDestroy(movie_params);
-}
-
-
-void start_movie(void)
-{
- char name[FILE_MAXDIR+FILE_MAXFILE];
- char bak[sizeof(name) + 4];
- int fd;
-
- first = TRUE;
-
- set_sfra_efra();
-
- /* naam bedenken voor de movie */
- make_movie_name(name);
-
- ntsc = FALSE;
-
- switch (R.recty) {
- case 480: case 360: case 240: case 120:
- ntsc = TRUE;
- }
-
- if (ntsc) {
- switch (R.rectx) {
- case 360: case 320: case 720: case 640:
- mv_outx = R.rectx;
- break;
- default:
- if (R.rectx <= 320) mv_outx = 320;
- else if (R.rectx <= 640) mv_outx = 640;
- else mv_outx = 720;
- }
- } else {
- switch (R.rectx) {
- case 360: case 384: case 720: case 768:
- mv_outx = R.rectx;
- break;
- default:
- if (R.rectx < 384) mv_outx = 384;
- else mv_outx = 768;
- }
- }
-
- if (ntsc) {
- if (R.recty <= 240) {
- mv_outy = 240;
- numfields = 1;
- } else {
- mv_outy = 480;
- numfields = 2;
- }
- } else {
- if (R.recty <= 288) {
- mv_outy = 288;
- numfields = 1;
- } else {
- mv_outy = 576;
- numfields = 2;
- }
- }
-
- qualnow = R.r.quality;
-
- fd = open(name, O_BINARY|O_RDWR);
- if (fd != -1) {
- if (flock(fd, LOCK_EX) == -1) report_flock();
-
- if (mvOpenFD(fd, &movie) == DM_SUCCESS) {
- if (mvFindTrackByMedium(movie, DM_IMAGE, &image) == DM_SUCCESS) {
- if (mvGetImageWidth(image) == mv_outx) {
- if (mvGetImageHeight(image) == mv_outy) {
- mvClose(movie);
- close(fd);
- return;
- }
- }
- }
- strcpy(bak, name);
- strcat(bak, ".bak");
- BLI_rename(name, bak);
- mvClose(movie);
- }
-
- close(fd);
- }
- fd = open(name, O_BINARY|O_RDWR | O_CREAT | O_EXCL, 0664);
- if (fd != -1) {
- if (flock(fd, LOCK_EX) == -1) report_flock();
- new_movie(fd);
- printf("Created movie: %s\n", name);
- close(fd);
- }
-}
-
-void append_movie(int cfra)
-{
- ImBuf *ibuf, *tbuf;
- int err, ofsx, ofsy, bufsize, rate, lastqual, qualstep, direction, first_image, num_images;
- char name[FILE_MAXDIR+FILE_MAXFILE];
- const char *string;
- int fd;
- float col[4] = {0.0,0.0,0.0,0.0};
-
- set_sfra_efra();
- make_movie_name(name);
- open_compressor();
-
- rate = 1024 * R.r.maximsize;
-
- /* veranderd: kopie van rectot maken */
- ibuf= IMB_allocImBuf(R.rectx, R.recty, 32, IB_rect, 0);
- memcpy(ibuf->rect, R.rectot, 4*R.rectx*R.recty);
-
- if (ibuf->x != mv_outx || ibuf->y != mv_outy) {
- tbuf = IMB_allocImBuf(mv_outx, mv_outy, 32, IB_rect, 0);
- IMB_rectfill(tbuf,col);
-
- ofsx = (tbuf->x - ibuf->x) / 2;
- ofsy = (tbuf->y - ibuf->y) / 2;
- if (numfields == 2) ofsy &= ~1;
-
- IMB_rectcpy(tbuf, ibuf, ofsx, ofsy, 0, 0, ibuf->x, ibuf->y);
- IMB_freeImBuf(ibuf);
- strcpy(tbuf->name, ibuf->name);
- ibuf = tbuf;
- }
- IMB_convert_rgba_to_abgr(ibuf);
-
- if (numfields == 2) {
- if (ntsc) {
- IMB_rectcpy(ibuf, ibuf, 0, 0, 0, 1, ibuf->x, ibuf->y);
- IMB_flipy(ibuf);
- IMB_de_interlace(ibuf);
- if (ntsc) IMB_rectcpy(ibuf, ibuf, 0, 0, 0, 1, ibuf->x, ibuf->y);
- } else {
- IMB_flipy(ibuf);
- IMB_rectcpy(ibuf, ibuf, 0, 0, 0, 1, ibuf->x, ibuf->y);
- IMB_de_interlace(ibuf);
- }
- }
- else {
- /* kleine movies anders op de kop */
- IMB_flipy(ibuf);
- }
-
- if (rate == 0) {
- qualnow = R.r.quality;
- my_Compress(ibuf->rect, &bufsize);
- } else {
- qualstep = 4;
- direction = 0;
-
- do {
- if (qualnow > MAXQUAL) qualnow = MAXQUAL;
- if (qualnow < MINQUAL) qualnow = MINQUAL;
-
- compr_params[qualindex] = qualnow;
- clSetParams(compr, compr_params, myindex);
-
- lastqual = qualnow;
- err = my_Compress(ibuf->rect, &bufsize);
-
- printf(" tried quality: %d, size %d\n", qualnow, bufsize);
-
- if (bufsize < 0.9 * rate) {
- if (err) {
- /* forget about this frame, retry next frame at old quality settting */
- qualnow = lastqual;
- break;
- }
- if (qualnow == MAXQUAL) break;
- direction |= DIR_UP;
- if (direction == DIR_BOTH) qualstep /= 2;
- qualnow += qualstep;
- } else if (bufsize > 1.1 * rate) {
- if (qualnow == MINQUAL) break;
- direction |= DIR_DOWN;
- if (direction == DIR_BOTH) qualstep /= 2;
- qualnow -= qualstep;
- } else break;
-
- if (qualstep == 0) {
- /* this was the last iteration. Make sure that the buffer isn't to big */
- if (bufsize < 1.1 * rate) break;
- else qualnow--;
- }
- } while (1);
-
- printf("used quality: %d\n", qualnow);
-
- if (bufsize < rate) qualnow++;
- else qualnow--;
-
- }
-
- fd = open(name, O_BINARY|O_RDWR);
-
- if (fd != -1) {
- if (flock(fd, LOCK_EX) == -1) report_flock();
- if (mvOpenFD(fd, &movie) == DM_SUCCESS){
- if (mvFindTrackByMedium(movie, DM_IMAGE, &image) == DM_SUCCESS) {
- image_params = mvGetParams(image);
-
- first_image = 1;
-
- string = dmParamsGetString(image_params, FIRST_IMAGE);
- if (string) {
- first_image = atoi(string);
- }
- string = dmParamsGetString(image_params, BLENDER_FIRST_IMAGE);
- if (string) {
- first_image = atoi(string);
- }
-
- num_images = mvGetTrackLength(image);
-
- if (cfra >= first_image && cfra <= (first_image + num_images - 1)) {
- if (mvDeleteFrames(image, cfra - first_image, 1) != DM_SUCCESS) {
- mvDestroyMovie(movie);
- error("mvDeleteFrames");
- G.afbreek = 1;
- }
- }
-
- if (G.afbreek != 1) {
- if (mvInsertCompressedImage(image, cfra - first_image, bufsize, comp_buf) == DM_SUCCESS) {
- printf("added frame %3d (frame %3d in movie): length %6d: ", cfra, cfra - first_image + 1, bufsize);
- mvClose(movie);
- } else {
- mvDestroyMovie(movie);
- error("mvInsertCompressedImage");
- G.afbreek = 1;
- }
- }
- } else {
- mvDestroyMovie(movie);
- error("mvFindTrackByMedium");
- G.afbreek = 1;
- }
- }else {
- error("mvOpenFD");
- G.afbreek = 1;
- }
- close(fd);
- } else {
- error("open movie");
- G.afbreek = 1;
- }
-
- IMB_freeImBuf(ibuf);
-
- close_compressor();
-}
-
-#endif /* __sgi */
diff --git a/source/blender/python/Makefile b/source/blender/windowmanager/Makefile
index 149e40092f3..ad574aa0d4c 100644
--- a/source/blender/python/Makefile
+++ b/source/blender/windowmanager/Makefile
@@ -1,15 +1,12 @@
#
-# $Id$
+# $Id: Makefile
#
-# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
+# ***** 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. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
+# 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
@@ -20,18 +17,18 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+# The Original Code is Copyright (C) Blender Foundation.
# All rights reserved.
#
# The Original Code is: all of this file.
#
# Contributor(s): none yet.
#
-# ***** END GPL/BL DUAL LICENSE BLOCK *****
+# ***** END GPL LICENSE BLOCK *****
#
# Bounces make to subdirectories.
-SOURCEDIR = source/blender/python
-DIRS = api2_2x
+SOURCEDIR = source/blender/windowmanager
+DIRS = intern
include nan_subdirs.mk
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
new file mode 100644
index 00000000000..880bee6d53c
--- /dev/null
+++ b/source/blender/windowmanager/WM_api.h
@@ -0,0 +1,77 @@
+/**
+ * $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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2007 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+#ifndef WM_API_H
+#define WM_API_H
+
+/* dna-savable wmStructs here */
+#include "DNA_windowmanager_types.h"
+
+struct bContext;
+struct wmEvent;
+struct wmEventHandler;
+
+ /* general API */
+void WM_setprefsize (int stax, int stay, int sizx, int sizy);
+
+void WM_init (struct bContext *C);
+void WM_exit (struct bContext *C);
+void WM_main (struct bContext *C);
+
+ /* files */
+int WM_read_homefile (struct bContext *C, int from_memory);
+int WM_write_homefile (struct bContext *C, struct wmOperator *op);
+void WM_read_file (struct bContext *C, char *name);
+void WM_write_file (struct bContext *C, char *target);
+void WM_read_autosavefile(struct bContext *C);
+void WM_write_autosave (struct bContext *C);
+
+ /* mouse cursors */
+void WM_init_cursor_data (void);
+void WM_set_cursor (struct bContext *C, int curs);
+
+ /* keymap and handlers */
+void WM_keymap_set_item (ListBase *lb, char *idname, short type,
+ short val, int modifier, short keymodifier);
+void WM_keymap_verify_item(ListBase *lb, char *idname, short type,
+ short val, int modifier, short keymodifier);
+struct wmEventHandler *WM_event_add_keymap_handler(ListBase *keymap, ListBase *handlers);
+struct wmEventHandler *WM_event_add_modal_keymap_handler(ListBase *keymap, ListBase *handlers, wmOperator *op);
+
+ /* operator api, default callbacks */
+ /* confirm menu + exec */
+int WM_operator_confirm (struct bContext *C, struct wmOperator *op, struct wmEvent *event);
+ /* context checks */
+int WM_operator_winactive (struct bContext *C);
+
+ /* operator api */
+wmOperatorType *WM_operatortype_find(const char *idname);
+void WM_operator_register(wmWindowManager *wm, wmOperator *ot);
+
+
+#endif /* WM_API_H */
+
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
new file mode 100644
index 00000000000..c3a1662c1e1
--- /dev/null
+++ b/source/blender/windowmanager/WM_types.h
@@ -0,0 +1,70 @@
+/**
+ * $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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2007 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+#ifndef WM_TYPES_H
+#define WM_TYPES_H
+
+/* exported types for WM */
+
+/* ************** wmOperatorType ************************ */
+
+/* flag */
+#define OPTYPE_REGISTER 1
+
+/* ************** wmKeyMap ************************ */
+
+/* modifier */
+#define KM_SHIFT 1
+#define KM_CTRL 2
+#define KM_ALT 4
+#define KM_OSKEY 8
+ /* means modifier should be pressed 2nd */
+#define KM_SHIFT2 16
+#define KM_CTRL2 32
+#define KM_ALT2 64
+#define KM_OSKEY2 128
+
+/* val */
+#define KM_PRESS 2
+#define KM_RELEASE 1
+
+
+/* ************** custom wmEvent data ************** */
+
+#define DEV_STYLUS 1
+#define DEV_ERASER 2
+
+typedef struct wmTabletData {
+ int Active; /* 0=None, 1=Stylus, 2=Eraser */
+ float Pressure; /* range 0.0 (not touching) to 1.0 (full pressure) */
+ float Xtilt; /* range 0.0 (upright) to 1.0 (tilted fully against the tablet surface) */
+ float Ytilt; /* as above */
+} wmTabletData;
+
+
+#endif /* WM_TYPES_H */
+
diff --git a/source/blender/python/api2_2x/Makefile b/source/blender/windowmanager/intern/Makefile
index 4ea06a324f5..3eb4ef7a028 100644
--- a/source/blender/python/api2_2x/Makefile
+++ b/source/blender/windowmanager/intern/Makefile
@@ -1,15 +1,12 @@
#
# $Id: Makefile 11904 2007-08-31 16:16:33Z sirdude $
#
-# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
+# ***** 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. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
+# 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
@@ -27,38 +24,75 @@
#
# Contributor(s): none yet.
#
-# ***** END GPL/BL DUAL LICENSE BLOCK *****
+# ***** END GPL LICENSE BLOCK *****
#
#
-LIBNAME = python
-DIR = $(OCGDIR)/blender/python
-
-CSRCS ?= $(wildcard *.c) $(wildcard ../*.c)
+LIBNAME = windowmanager
+DIR = $(OCGDIR)/blender/$(LIBNAME)
include nan_compile.mk
CFLAGS += $(LEVEL_1_C_WARNINGS)
-ifeq ($(WITH_FFMPEG), true)
- CPPFLAGS += -DWITH_FFMPEG
-endif
+# OpenGL and Python
+CPPFLAGS += $(OGL_CPPFLAGS)
+CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION)
-CPPFLAGS += -I$(OPENGL_HEADERS)
-CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
+# PreProcessor stuff
+
+CPPFLAGS += -I$(NAN_GHOST)/include
+CPPFLAGS += -I$(NAN_BMFONT)/include
+CPPFLAGS += -I$(NAN_ELBEEM)/include
+CPPFLAGS += -I$(NAN_SOUNDSYSTEM)/include $(NAN_SDLCFLAGS)
+
+# modules
+CPPFLAGS += -I../../editors/include
+CPPFLAGS += -I../../python
CPPFLAGS += -I../../makesdna
-CPPFLAGS += -I../../blenkernel
CPPFLAGS += -I../../blenlib
+CPPFLAGS += -I../../blenkernel
+CPPFLAGS += -I../../nodes
+CPPFLAGS += -I../../imbuf
CPPFLAGS += -I../../blenloader
-CPPFLAGS += -I../../include
CPPFLAGS += -I../../render/extern/include
+CPPFLAGS += -I../../ftfont
CPPFLAGS += -I../../radiosity/extern/include
-CPPFLAGS += -I$(NAN_BMFONT)/include
-CPPFLAGS += -I../../imbuf
-CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION)
+CPPFLAGS += -I../../../kernel/gen_system
+
+# path to the guarded memory allocator
+CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
+CPPFLAGS += -I$(NAN_MEMUTIL)/include
+
+ifeq ($(INTERNATIONAL), true)
+ CPPFLAGS += -DINTERNATIONAL
+endif
+
+ifeq ($(WITH_VERSE), true)
+ CPPFLAGS += -DWITH_VERSE
+ CPPFLAGS += -I$(NAN_VERSE)/include
+ # print some other debug information
+ ifeq ($(VERSE_DEBUG_PRINT), true)
+ CPPFLAGS += -DVERSE_DEBUG_PRINT
+ endif
+endif
+
+ifeq ($(WITH_QUICKTIME),true)
+ CPPFLAGS += -I../quicktime
+ CPPFLAGS += -DWITH_QUICKTIME
+endif
+
+ifeq ($(OS),linux)
+ ifeq ($(CPU),alpha)
+ CPPFLAGS += -I$(NAN_MESA)/include
+ endif
+ ifeq ($(CPU),i386)
+ CPPFLAGS += -I$(NAN_MESA)/include
+ endif
+ ifeq ($(CPU),powerpc)
+ CPPFLAGS += -I/usr/src/MesaCVS/include
+ endif
+endif
-# We'll just add a little duct tape to fix things here ...
-.PHONY: clean
-clean::
- @rm -f $(OCGDIR)/blender/BPY_*.o
- @rm -f $(OCGDIR)/blender/BPY_*.d
+# path to our own headerfiles
+CPPFLAGS += -I..
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c
new file mode 100644
index 00000000000..1576f4b3a40
--- /dev/null
+++ b/source/blender/windowmanager/intern/wm.c
@@ -0,0 +1,164 @@
+/**
+ * $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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2007 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "DNA_windowmanager_types.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_blenlib.h"
+
+#include "BKE_blender.h"
+#include "BKE_global.h"
+#include "BKE_library.h"
+#include "BKE_main.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+#include "wm_window.h"
+#include "wm_event_system.h"
+#include "wm_event_types.h"
+
+/* ****************************************************** */
+#define MAX_OP_REGISTERED 32
+
+/* all operations get registered in the windowmanager here */
+/* called on event handling by event_system.c */
+void WM_operator_register(wmWindowManager *wm, wmOperator *op)
+{
+ wmOperator *opc= MEM_mallocN(sizeof(wmOperator), "operator registry");
+ int tot;
+
+ *opc= *op;
+ BLI_addtail(&wm->operators, opc);
+
+ tot= BLI_countlist(&wm->operators);
+
+ while(tot>MAX_OP_REGISTERED) {
+ wmOperator *opt= wm->operators.first;
+ BLI_remlink(&wm->operators, opt);
+ MEM_freeN(opt);
+ tot--;
+ }
+}
+
+/* **************** standard keymap for WM ********************** */
+
+/* default keymap for windows and screens, only call once per WM */
+static void wm_window_keymap(wmWindowManager *wm)
+{
+ /* note, this doesn't replace existing keymap items */
+ WM_keymap_verify_item(&wm->windowkeymap, "WM_OT_window_duplicate", AKEY, KM_PRESS, 0, 0);
+ WM_keymap_verify_item(&wm->windowkeymap, "WM_OT_save_homefile", UKEY, KM_PRESS, KM_CTRL, 0);
+}
+
+/* ****************************************** */
+
+void wm_check(bContext *C)
+{
+
+ /* wm context */
+ if(C->wm==NULL) C->wm= G.main->wm.first;
+ if(C->wm==NULL) return;
+ if(C->wm->windows.first==NULL) return;
+
+ /* case: no open windows at all, for old file reads */
+ wm_window_add_ghostwindows(C->wm);
+
+ if(C->window==NULL) C->window= C->wm->windrawable;
+
+ if(C->wm->initialized==0) {
+ wm_window_keymap(C->wm);
+ C->wm->initialized= 1;
+ }
+}
+
+/* on startup, it adds all data, for matching */
+void wm_add_default(bContext *C)
+{
+ wmWindowManager *wm= alloc_libblock(&G.main->wm, ID_WM, "WinMan");
+ wmWindow *win;
+
+ C->wm= wm;
+
+ win= wm_window_new(C, C->screen);
+ wm->windrawable= win;
+ C->window= win;
+}
+
+
+/* context is allowed to be NULL, do net free wm itself (library.c) */
+void wm_close_and_free(bContext *C, wmWindowManager *wm)
+{
+ wmWindow *win;
+
+ while((win= wm->windows.first)) {
+ BLI_remlink(&wm->windows, win);
+ wm_window_free(C, win);
+ }
+
+ BLI_freelistN(&wm->operators);
+ BLI_freelistN(&wm->windowkeymap);
+ BLI_freelistN(&wm->screenkeymap);
+
+ if(C && C->wm==wm) C->wm= NULL;
+}
+
+void wm_close_and_free_all(bContext *C, ListBase *wmlist)
+{
+ wmWindowManager *wm;
+
+ while((wm=wmlist->first)) {
+ wm_close_and_free(C, wm);
+ BLI_remlink(wmlist, wm);
+ MEM_freeN(wm);
+ }
+}
+
+void WM_main(bContext *C)
+{
+ while(1) {
+
+ /* get events from ghost, handle window events, add to window queues */
+ /* WM_init has assigned to ghost the bContext already */
+ wm_window_process_events(1);
+
+ /* per window, all events to the window, screen, area and region handlers */
+ wm_event_do_handlers(C);
+
+ }
+}
+
+/* While (local_event) {
+Update controller stack if active changed ()
+Match event to an action()
+Process_event()
+Do_notifications()
+Do_draw_updates()
+}
+*/
+
diff --git a/source/blender/windowmanager/intern/wm_apple.c b/source/blender/windowmanager/intern/wm_apple.c
new file mode 100644
index 00000000000..e04457fc515
--- /dev/null
+++ b/source/blender/windowmanager/intern/wm_apple.c
@@ -0,0 +1,138 @@
+/**
+ * $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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2007 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifdef __APPLE__
+
+#include "BKE_global.h"
+#include "WM_api.h"
+
+#include <OpenGL/OpenGL.h>
+#define __CARBONSOUND__
+/* XXX BIG WARNING: carbon.h can not be included in blender code, it conflicts with struct ID */
+#define ID ID_
+#include <Carbon/Carbon.h>
+
+
+/* To avoid killing small end comps, we want to allow
+blender to start maximised if all the followings are true :
+- Renderer is OpenGL capable
+- Hardware acceleration
+- VRAM > 16 Mo
+
+ We will bail out if VRAM is less than 8Mo
+ */
+/* bad global, used in wm_window.c to open windows */
+int macPrefState = 0;
+
+static int checkAppleVideoCard(void)
+{
+ CGLRendererInfoObj rend;
+ long theErr;
+ unsigned long display_mask;
+ long nrend;
+ int j;
+ long value;
+ long maxvram = 0; /* we get always more than 1 renderer, check one, at least, has 8 Mo */
+
+ display_mask = CGDisplayIDToOpenGLDisplayMask (CGMainDisplayID() );
+
+ theErr = CGLQueryRendererInfo( display_mask, &rend, &nrend);
+ if (theErr == 0) {
+ theErr = CGLDescribeRenderer (rend, 0, kCGLRPRendererCount, &nrend);
+ if (theErr == 0) {
+ for (j = 0; j < nrend; j++) {
+ theErr = CGLDescribeRenderer (rend, j, kCGLRPVideoMemory, &value);
+ if (value > maxvram)
+ maxvram = value;
+ if ((theErr == 0) && (value >= 20000000)) {
+ theErr = CGLDescribeRenderer (rend, j, kCGLRPAccelerated, &value);
+ if ((theErr == 0) && (value != 0)) {
+ theErr = CGLDescribeRenderer (rend, j, kCGLRPCompliant, &value);
+ if ((theErr == 0) && (value != 0)) {
+ /*fprintf(stderr,"make it big\n");*/
+ CGLDestroyRendererInfo (rend);
+ macPrefState = 8;
+ return 1;
+ }
+ }
+ }
+ }
+ }
+ }
+ if (maxvram < 7500000 ) { /* put a standard alert and quit*/
+ SInt16 junkHit;
+ char inError[] = "* Not enough VRAM ";
+ char inText[] = "* blender needs at least 8Mb ";
+ inError[0] = 16;
+ inText[0] = 28;
+
+ fprintf(stderr, " vram is %li . not enough, aborting\n", maxvram);
+ StandardAlert ( kAlertStopAlert, (ConstStr255Param) &inError, (ConstStr255Param)&inText,NULL,&junkHit);
+ abort();
+ }
+CGLDestroyRendererInfo (rend);
+return 0;
+}
+
+static void getMacAvailableBounds(short *top, short *left, short *bottom, short *right)
+{
+ Rect outAvailableRect;
+
+ GetAvailableWindowPositioningBounds ( GetMainDevice(), &outAvailableRect);
+
+ *top = outAvailableRect.top;
+ *left = outAvailableRect.left;
+ *bottom = outAvailableRect.bottom;
+ *right = outAvailableRect.right;
+}
+
+
+void wm_set_apple_prefsize(int scr_x, int scr_y)
+{
+
+ /* first let us check if we are hardware accelerated and with VRAM > 16 Mo */
+
+ if (checkAppleVideoCard()) {
+ short top, left, bottom, right;
+
+ getMacAvailableBounds(&top, &left, &bottom, &right);
+ WM_setprefsize(left +10,scr_y - bottom +10,right-left -20,bottom - 64);
+ G.windowstate= 0;
+
+ } else {
+
+ /* 40 + 684 + (headers) 22 + 22 = 768, the powerbook screen height */
+ WM_setprefsize(120, 40, 850, 684);
+ G.windowstate= 0;
+ }
+}
+
+
+#endif /* __APPLE__ */
+
+
diff --git a/source/blender/src/cursors.c b/source/blender/windowmanager/intern/wm_cursors.c
index ea10d2e9b3e..8c86070ca61 100644
--- a/source/blender/src/cursors.c
+++ b/source/blender/windowmanager/intern/wm_cursors.c
@@ -1,15 +1,12 @@
/**
-* $Id$
+* $Id: wm_cursors.c
*
-* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
+* ***** 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. The Blender
-* Foundation also sells licenses for use in proprietary software under
-* the Blender License. See http://www.blender.org/BL/ for information
-* about this.
+* 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
@@ -20,35 +17,117 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
-* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+* The Original Code is Copyright (C) 2005-2007 Blender Foundation
* All rights reserved.
*
* The Original Code is: all of this file.
*
-* Contributor(s): none yet.
+* Contributor(s): Matt Ebb
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include <stdio.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "GHOST_C-api.h"
#include "DNA_listBase.h"
#include "DNA_userdef_types.h"
-#include "BIF_cursors.h"
-#include "BIF_resources.h"
-#include "BIF_graphics.h"
-#include "BIF_screen.h"
+#include "BKE_global.h"
-#include "winlay.h"
+#include "WM_api.h"
+#include "wm_cursors.h"
+/* XXX this still is mess from old code */
+
+
+
+/* Some simple ghost <-> blender conversions */
+static GHOST_TStandardCursor convert_cursor(int curs)
+{
+ switch(curs) {
+ default:
+ case CURSOR_STD: return GHOST_kStandardCursorDefault;
+ case CURSOR_FACESEL: return GHOST_kStandardCursorRightArrow;
+ case CURSOR_WAIT: return GHOST_kStandardCursorWait;
+ case CURSOR_EDIT: return GHOST_kStandardCursorCrosshair;
+ case CURSOR_HELP: return GHOST_kStandardCursorHelp;
+ case CURSOR_X_MOVE: return GHOST_kStandardCursorLeftRight;
+ case CURSOR_Y_MOVE: return GHOST_kStandardCursorUpDown;
+ case CURSOR_PENCIL: return GHOST_kStandardCursorPencil;
+ }
+}
+
+void window_set_custom_cursor(wmWindow *win, unsigned char mask[16][2],
+ unsigned char bitmap[16][2], int hotx, int hoty)
+{
+ GHOST_SetCustomCursorShape(win->ghostwin, bitmap, mask, hotx, hoty);
+}
+
+static void window_set_custom_cursor_ex(wmWindow *win, BCursor *cursor, int useBig)
+{
+ if (useBig) {
+ GHOST_SetCustomCursorShapeEx(win->ghostwin,
+ (GHOST_TUns8 *)cursor->big_bm, (GHOST_TUns8 *)cursor->big_mask,
+ cursor->big_sizex,cursor->big_sizey,
+ cursor->big_hotx,cursor->big_hoty,
+ cursor->fg_color, cursor->bg_color);
+ } else {
+ GHOST_SetCustomCursorShapeEx(win->ghostwin,
+ (GHOST_TUns8 *)cursor->small_bm, (GHOST_TUns8 *)cursor->small_mask,
+ cursor->small_sizex,cursor->small_sizey,
+ cursor->small_hotx,cursor->small_hoty,
+ cursor->fg_color, cursor->bg_color);
+ }
+}
+
+
+/* Cursor Globals */
+static BCursor *BlenderCursor[BC_NUMCURSORS]; /*Points to static BCursor Structs */
+static short CurrentCursor=-1, LastCursor=-1;
+
+void WM_set_cursor(bContext *C, int curs)
+{
+ wmWindow *win= C->window;
+
+ if (win==NULL) return; /* Can't set custom cursor before Window init */
+ win->cursor= curs;
+
+ if (curs==CURSOR_NONE) {
+ GHOST_SetCursorVisibility(win->ghostwin, 0);
+ return;
+ }
+
+ GHOST_SetCursorVisibility(win->ghostwin, 1);
+
+ /* detect if we use system cursor or Blender cursor */
+ if(curs>=BC_GHOST_CURSORS) {
+ GHOST_SetCursorShape(win->ghostwin, convert_cursor(curs));
+ return;
+ }
+
+ if ((curs<LASTCURSOR)||(curs>=BC_NUMCURSORS)) return;
+
+
+ LastCursor=CurrentCursor;
+ CurrentCursor=curs;
+
+ if (curs==LASTCURSOR) curs=LastCursor;
+
+ if (curs==SYSCURSOR) { /* System default Cursor */
+ GHOST_SetCursorShape(win->ghostwin, convert_cursor(CURSOR_STD));
+ }
+ else if ( (U.curssize==0) || (BlenderCursor[curs]->big_bm == NULL) ) {
+ window_set_custom_cursor_ex(win, BlenderCursor[curs], 0);
+ }
+ else {
+ window_set_custom_cursor_ex(win, BlenderCursor[curs], 1);
+ }
+}
/* ******************************************************************
-Cursor Description:
+Custom Cursor Description:
Each bit represents a pixel, so 1 byte = 8 pixels,
the bytes go Left to Right. Top to bottom
@@ -81,55 +160,15 @@ It will copy its output to the console when you press 'Do it'.
*/
/* Because defining a cursor mixes declarations and executable code
- each cursor needs it's own scoping block or it would be split up
- over several hundred lines of code. To enforce/document this better
- I define 2 pretty braindead macros so it's obvious what the extra "[]"
- are for */
+each cursor needs it's own scoping block or it would be split up
+over several hundred lines of code. To enforce/document this better
+I define 2 pretty braindead macros so it's obvious what the extra "[]"
+are for */
#define BEGIN_CURSOR_BLOCK {
#define END_CURSOR_BLOCK }
-/* Cursor Globals */
-static BCursor *BlenderCursor[BC_NUMCURSORS]; /*Points to static BCursor Structs */
-static short CurrentCursor=-1, LastCursor=-1;
-
-short GetBlenderCursor(void) {
- return CurrentCursor;
-}
-
-void SetBlenderCursor(short curs){
- Window *win;
-
- if ((curs<LASTCURSOR)||(curs>=BC_NUMCURSORS)) return;
-
- win=winlay_get_active_window();
-
- if (win==NULL) return; /* Can't set custom cursor before Window init */
-
- LastCursor=CurrentCursor;
- CurrentCursor=curs;
-
- if (curs==LASTCURSOR) curs=LastCursor;
-
- if (curs==SYSCURSOR) { /* System default Cursor */
- window_set_cursor(win, CURSOR_STD);
- //set_cursor(CURSOR_STD);
- }
- else if ( (U.curssize==0) || (BlenderCursor[curs]->big_bm == NULL) ) {
- window_set_custom_cursor_ex(win, BlenderCursor[curs], 0);
- }
- else {
- window_set_custom_cursor_ex(win, BlenderCursor[curs], 1);
- }
-}
-
-/* unused no prototypes
-short GetCurrentCursor(void){
- return(CurrentCursor);
-}
-*/
-
-void InitCursorData(void){
+void WM_init_cursor_data(void){
/********************** NW_ARROW Cursor **************************/
BEGIN_CURSOR_BLOCK
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
new file mode 100644
index 00000000000..782c1325e2f
--- /dev/null
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -0,0 +1,470 @@
+/**
+ * $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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2007 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "DNA_listBase.h"
+#include "DNA_screen_types.h"
+#include "DNA_windowmanager_types.h"
+#include "DNA_userdef_types.h" /* U.flag & TWOBUTTONMOUSE */
+
+#include "MEM_guardedalloc.h"
+
+#include "GHOST_C-api.h"
+
+#include "BLI_blenlib.h"
+
+#include "BKE_blender.h"
+#include "BKE_global.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+#include "wm.h"
+#include "wm_window.h"
+#include "wm_event_system.h"
+#include "wm_event_types.h"
+
+/* ************ event management ************** */
+
+static void wm_event_add(wmWindow *win, wmEvent *event_to_add)
+{
+ wmEvent *event= MEM_callocN(sizeof(wmEvent), "event");
+
+ *event= *event_to_add;
+ BLI_addtail(&win->queue, event);
+}
+
+wmEvent *wm_event_next(wmWindow *win)
+{
+ wmEvent *event= win->queue.first;
+
+ if(event) BLI_remlink(&win->queue, event);
+ return event;
+}
+
+static void wm_event_free(wmEvent *event)
+{
+ if(event->customdata) MEM_freeN(event->customdata);
+ MEM_freeN(event);
+}
+
+void wm_event_free_all(wmWindow *win)
+{
+ wmEvent *event;
+
+ while((event= win->queue.first)) {
+ BLI_remlink(&win->queue, event);
+ wm_event_free(event);
+ }
+}
+
+/* ********************* handlers *************** */
+
+void wm_event_free_handlers(ListBase *lb)
+{
+ wmEventHandler *handler;
+
+ for(handler= lb->first; handler; handler= handler->next) {
+ if(handler->op)
+ MEM_freeN(handler->op);
+ }
+ BLI_freelistN(lb);
+}
+
+static int wm_eventmatch(wmEvent *winevent, wmKeymapItem *km)
+{
+ if(winevent->type!=km->type) return 0;
+
+ if(km->val) /* KM_PRESS, KM_RELEASE */
+ if(winevent->val!=km->val-1) return 0;
+
+ if(winevent->shift!=km->shift) return 0;
+ if(winevent->ctrl!=km->ctrl) return 0;
+ if(winevent->alt!=km->alt) return 0;
+ if(winevent->oskey!=km->oskey) return 0;
+ if(winevent->keymodifier!=km->keymodifier) return 0;
+
+ /* optional boundbox */
+
+ return 1;
+}
+
+static int wm_handler_operator_call(bContext *C, wmEventHandler *handler, wmEvent *event)
+{
+ int retval= 0;
+
+ /* derived, modal or blocking operator */
+ if(handler->op) {
+ if( handler->op->type->poll(C)) {
+ if(handler->op->type->interactive)
+ retval= handler->op->type->interactive(C, handler->op, event);
+ else
+ printf("wm_handler_operator_call error\n");
+ }
+ }
+ else {
+ wmOperatorType *ot= WM_operatortype_find(event->keymap_idname);
+ if(ot) {
+ if(ot->poll(C)) {
+ /* operator on stack, register or new modal handle malloc-copies */
+ wmOperator op;
+
+ memset(&op, 0, sizeof(wmOperator));
+ op.type= ot;
+
+ if(op.type->interactive)
+ retval= op.type->interactive(C, &op, event);
+ else if(&op.type->exec)
+ retval= op.type->exec(C, &op);
+
+ if( ot->flag & OPTYPE_REGISTER)
+ WM_operator_register(C->wm, &op);
+ }
+ }
+ }
+ if(retval)
+ return WM_HANDLER_BREAK;
+
+ return WM_HANDLER_CONTINUE;
+}
+
+static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
+{
+ wmEventHandler *handler;
+ int action= WM_HANDLER_CONTINUE;
+
+ if(handlers==NULL) return action;
+
+ for(handler= handlers->first; handler; handler= handler->next) {
+ if(handler->keymap) {
+ wmKeymapItem *km;
+
+ for(km= handler->keymap->first; km; km= km->next) {
+ if(wm_eventmatch(event, km)) {
+
+ if(event->type!=MOUSEMOVE)
+ printf("handle evt %d win %d op %s\n", event->type, C->window->winid, km->idname);
+
+ event->keymap_idname= km->idname; /* weak, but allows interactive callback to not use rawkey */
+
+ action= wm_handler_operator_call(C, handler, event);
+ }
+ }
+ if(action==WM_HANDLER_BREAK)
+ break;
+ }
+ /* modal+blocking handler */
+ if(handler->flag & WM_HANDLER_BLOCKING)
+ action= WM_HANDLER_BREAK;
+ }
+ return action;
+}
+
+static int wm_event_inside_i(wmEvent *event, rcti *rect)
+{
+ return BLI_in_rcti(rect, event->x, event->y);
+}
+//static int wm_event_inside_f(wmEvent *event, rctf *rect)
+//{
+// return BLI_in_rctf(rect, (float)event->x, (float)event->y);
+//}
+
+/* called in main loop */
+/* goes over entire hierarchy: events -> window -> screen -> area -> region */
+void wm_event_do_handlers(bContext *C)
+{
+ wmWindow *win;
+
+ for(win= C->wm->windows.first; win; win= win->next) {
+ wmEvent *event;
+
+ /* MVC demands to not draw in event handlers... for now we leave it */
+ /* it also updates context (win, screen) */
+ wm_window_make_drawable(C, win);
+
+ if( C->screen==NULL )
+ wm_event_free_all(C->window);
+
+ while( (event=wm_event_next(C->window)) ) {
+ int action= wm_handlers_do(C, event, &C->window->handlers);
+
+ if(action==WM_HANDLER_CONTINUE)
+ action= wm_handlers_do(C, event, &C->screen->handlers);
+
+ if(action==WM_HANDLER_CONTINUE) {
+ ScrArea *sa= C->screen->areabase.first;
+
+ for(; sa; sa= sa->next) {
+ if(wm_event_inside_i(event, &sa->winrct)) {
+
+ C->curarea= sa;
+ action= wm_handlers_do(C, event, &sa->handlers);
+ if(action==WM_HANDLER_CONTINUE) {
+ ARegion *ar= sa->regionbase.first;
+
+ for(; ar; ar= ar->next) {
+ if(wm_event_inside_i(event, &ar->winrct)) {
+ C->region= ar;
+ action= wm_handlers_do(C, event, &ar->handlers);
+ if(action==WM_HANDLER_BREAK)
+ break;
+ }
+ }
+ }
+ if(action==WM_HANDLER_BREAK)
+ break;
+ }
+ }
+ }
+ wm_event_free(event);
+ }
+ }
+}
+
+/* lets not expose struct outside wm? */
+void WM_event_set_handler_flag(wmEventHandler *handler, int flag)
+{
+ handler->flag= flag;
+}
+
+wmEventHandler *WM_event_add_modal_keymap_handler(ListBase *keymap, ListBase *handlers, wmOperator *op)
+{
+ /* debug test; operator not in registry */
+ if(op->type->flag & OPTYPE_REGISTER) {
+ printf("error: handler (%s) cannot be modal, was registered\n", op->type->idname);
+ }
+ else {
+ wmEventHandler *handler= MEM_callocN(sizeof(wmEventHandler), "event handler");
+ wmOperator *opc= MEM_mallocN(sizeof(wmOperator), "operator modal");
+
+ BLI_addtail(handlers, handler);
+ handler->keymap= keymap;
+ *opc= *op;
+ handler->op= opc;
+
+ return handler;
+ }
+ return NULL;
+}
+
+wmEventHandler *WM_event_add_keymap_handler(ListBase *keymap, ListBase *handlers)
+{
+ wmEventHandler *handler= MEM_callocN(sizeof(wmEventHandler), "event handler");
+
+ BLI_addtail(handlers, handler);
+ handler->keymap= keymap;
+
+ return handler;
+}
+
+/* ********************* ghost stuff *************** */
+
+static int convert_key(GHOST_TKey key)
+{
+ if (key>=GHOST_kKeyA && key<=GHOST_kKeyZ) {
+ return (AKEY + ((int) key - GHOST_kKeyA));
+ } else if (key>=GHOST_kKey0 && key<=GHOST_kKey9) {
+ return (ZEROKEY + ((int) key - GHOST_kKey0));
+ } else if (key>=GHOST_kKeyNumpad0 && key<=GHOST_kKeyNumpad9) {
+ return (PAD0 + ((int) key - GHOST_kKeyNumpad0));
+ } else if (key>=GHOST_kKeyF1 && key<=GHOST_kKeyF12) {
+ return (F1KEY + ((int) key - GHOST_kKeyF1));
+ } else {
+ switch (key) {
+ case GHOST_kKeyBackSpace: return BACKSPACEKEY;
+ case GHOST_kKeyTab: return TABKEY;
+ case GHOST_kKeyLinefeed: return LINEFEEDKEY;
+ case GHOST_kKeyClear: return 0;
+ case GHOST_kKeyEnter: return RETKEY;
+
+ case GHOST_kKeyEsc: return ESCKEY;
+ case GHOST_kKeySpace: return SPACEKEY;
+ case GHOST_kKeyQuote: return QUOTEKEY;
+ case GHOST_kKeyComma: return COMMAKEY;
+ case GHOST_kKeyMinus: return MINUSKEY;
+ case GHOST_kKeyPeriod: return PERIODKEY;
+ case GHOST_kKeySlash: return SLASHKEY;
+
+ case GHOST_kKeySemicolon: return SEMICOLONKEY;
+ case GHOST_kKeyEqual: return EQUALKEY;
+
+ case GHOST_kKeyLeftBracket: return LEFTBRACKETKEY;
+ case GHOST_kKeyRightBracket: return RIGHTBRACKETKEY;
+ case GHOST_kKeyBackslash: return BACKSLASHKEY;
+ case GHOST_kKeyAccentGrave: return ACCENTGRAVEKEY;
+
+ case GHOST_kKeyLeftShift: return LEFTSHIFTKEY;
+ case GHOST_kKeyRightShift: return RIGHTSHIFTKEY;
+ case GHOST_kKeyLeftControl: return LEFTCTRLKEY;
+ case GHOST_kKeyRightControl: return RIGHTCTRLKEY;
+ case GHOST_kKeyCommand: return COMMANDKEY;
+ case GHOST_kKeyLeftAlt: return LEFTALTKEY;
+ case GHOST_kKeyRightAlt: return RIGHTALTKEY;
+
+ case GHOST_kKeyCapsLock: return CAPSLOCKKEY;
+ case GHOST_kKeyNumLock: return 0;
+ case GHOST_kKeyScrollLock: return 0;
+
+ case GHOST_kKeyLeftArrow: return LEFTARROWKEY;
+ case GHOST_kKeyRightArrow: return RIGHTARROWKEY;
+ case GHOST_kKeyUpArrow: return UPARROWKEY;
+ case GHOST_kKeyDownArrow: return DOWNARROWKEY;
+
+ case GHOST_kKeyPrintScreen: return 0;
+ case GHOST_kKeyPause: return PAUSEKEY;
+
+ case GHOST_kKeyInsert: return INSERTKEY;
+ case GHOST_kKeyDelete: return DELKEY;
+ case GHOST_kKeyHome: return HOMEKEY;
+ case GHOST_kKeyEnd: return ENDKEY;
+ case GHOST_kKeyUpPage: return PAGEUPKEY;
+ case GHOST_kKeyDownPage: return PAGEDOWNKEY;
+
+ case GHOST_kKeyNumpadPeriod: return PADPERIOD;
+ case GHOST_kKeyNumpadEnter: return PADENTER;
+ case GHOST_kKeyNumpadPlus: return PADPLUSKEY;
+ case GHOST_kKeyNumpadMinus: return PADMINUS;
+ case GHOST_kKeyNumpadAsterisk: return PADASTERKEY;
+ case GHOST_kKeyNumpadSlash: return PADSLASHKEY;
+
+ case GHOST_kKeyGrLess: return GRLESSKEY;
+
+ default:
+ return UNKNOWNKEY; /* GHOST_kKeyUnknown */
+ }
+ }
+}
+
+/* adds customdata to event */
+static void update_tablet_data(wmWindow *win, wmEvent *event)
+{
+ const GHOST_TabletData *td= GHOST_GetTabletData(win->ghostwin);
+
+ /* if there's tablet data from an active tablet device then add it */
+ if ((td != NULL) && td->Active) {
+ struct wmTabletData *wmtab= MEM_mallocN(sizeof(wmTabletData), "customdata tablet");
+
+ wmtab->Active = td->Active;
+ wmtab->Pressure = td->Pressure;
+ wmtab->Xtilt = td->Xtilt;
+ wmtab->Ytilt = td->Ytilt;
+
+ event->custom= EVT_TABLET;
+ event->customdata= wmtab;
+ }
+}
+
+
+/* windows store own event queues, no bContext here */
+void wm_event_add_ghostevent(wmWindow *win, int type, void *customdata)
+{
+ wmEvent event, *evt= win->eventstate;
+
+ /* initialize and copy state (only mouse x y and modifiers) */
+ event= *evt;
+
+ switch (type) {
+ /* mouse move */
+ case GHOST_kEventCursorMove: {
+ if(win->active) {
+ GHOST_TEventCursorData *cd= customdata;
+ int cx, cy;
+
+ GHOST_ScreenToClient(win->ghostwin, cd->x, cd->y, &cx, &cy);
+
+ event.type= MOUSEMOVE;
+ event.x= evt->x= cx;
+ event.y= evt->y= (win->sizey-1) - cy;
+
+ update_tablet_data(win, &event);
+ wm_event_add(win, &event);
+ }
+ break;
+ }
+ /* mouse button */
+ case GHOST_kEventButtonDown:
+ case GHOST_kEventButtonUp: {
+ GHOST_TEventButtonData *bd= customdata;
+ event.val= (type==GHOST_kEventButtonDown);
+
+ if (bd->button == GHOST_kButtonMaskLeft)
+ event.type= LEFTMOUSE;
+ else if (bd->button == GHOST_kButtonMaskRight)
+ event.type= RIGHTMOUSE;
+ else
+ event.type= MIDDLEMOUSE;
+
+ update_tablet_data(win, &event);
+ wm_event_add(win, &event);
+
+ break;
+ }
+ /* keyboard */
+ case GHOST_kEventKeyDown:
+ case GHOST_kEventKeyUp: {
+ GHOST_TEventKeyData *kd= customdata;
+ event.type= convert_key(kd->key);
+ event.ascii= kd->ascii;
+ event.val= (type==GHOST_kEventKeyDown);
+
+ /* modifiers */
+ if (event.type==LEFTSHIFTKEY || event.type==RIGHTSHIFTKEY) {
+ event.shift= evt->shift= event.val;
+ } else if (event.type==LEFTCTRLKEY || event.type==RIGHTCTRLKEY) {
+ event.ctrl= evt->ctrl= event.val;
+ } else if (event.type==LEFTALTKEY || event.type==RIGHTALTKEY) {
+ event.alt= evt->alt= event.val;
+ } else if (event.type==COMMANDKEY) {
+ event.oskey= evt->oskey= event.val;
+ }
+
+ wm_event_add(win, &event);
+
+ break;
+ }
+
+ case GHOST_kEventWheel: {
+ GHOST_TEventWheelData* wheelData = customdata;
+
+ if (wheelData->z > 0)
+ event.type= WHEELUPMOUSE;
+ else
+ event.type= WHEELDOWNMOUSE;
+
+ event.val= wheelData->z; /* currently -1 or +1, see ghost for improvements here... */
+ wm_event_add(win, &event);
+
+ break;
+ }
+ case GHOST_kEventUnknown:
+ case GHOST_kNumEventTypes:
+ break;
+ }
+}
+
diff --git a/source/blender/src/usiblender.c b/source/blender/windowmanager/intern/wm_files.c
index 2bf2d5d9ae9..20539e15bc0 100644
--- a/source/blender/src/usiblender.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -1,15 +1,12 @@
/**
- * $Id$
+ * $Id: wm_files.c
*
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
+ * ***** 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
+ * 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
@@ -23,17 +20,14 @@
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
- * The Original Code is: all of this file.
+ * Contributor(s): Blender Foundation 2007
*
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ * ***** END GPL LICENSE BLOCK *****
*/
/* placed up here because of crappy
* winsock stuff.
*/
-#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -48,39 +42,33 @@
#else
#include <unistd.h> /* getpid */
#endif
+
#include "MEM_guardedalloc.h"
#include "MEM_CacheLimiterC-Api.h"
-#include "BMF_Api.h"
#include "BIF_language.h"
#ifdef INTERNATIONAL
#include "FTF_Api.h"
#endif
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
#include "BLI_linklist.h"
-#include "IMB_imbuf_types.h"
-#include "IMB_imbuf.h"
-
#include "DNA_object_types.h"
#include "DNA_space_types.h"
#include "DNA_userdef_types.h"
#include "DNA_sound_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
+#include "DNA_windowmanager_types.h"
#include "BKE_blender.h"
-#include "BKE_curve.h"
-#include "BKE_displist.h"
#include "BKE_DerivedMesh.h"
#include "BKE_exotic.h"
#include "BKE_font.h"
#include "BKE_global.h"
+#include "BKE_library.h"
#include "BKE_main.h"
-#include "BKE_mball.h"
-#include "BKE_node.h"
#include "BKE_packedFile.h"
#include "BKE_texture.h"
#include "BKE_utildefines.h"
@@ -89,81 +77,46 @@
#include "BKE_verse.h"
#endif
-#include "BLI_vfontdata.h"
-
#include "BIF_fsmenu.h"
-#include "BIF_gl.h"
#include "BIF_interface.h"
-#include "BIF_usiblender.h"
-#include "BIF_drawtext.h"
-#include "BIF_editaction.h"
-#include "BIF_editarmature.h"
-#include "BIF_editlattice.h"
-#include "BIF_editfont.h"
-#include "BIF_editmesh.h"
-#include "BIF_editmode_undo.h"
+#include "BIF_usiblender.h" /* XXX */
+
#include "BIF_editsound.h"
+#include "BIF_editmode_undo.h"
#include "BIF_filelist.h"
-#include "BIF_poseobject.h"
-#include "BIF_previewrender.h"
-#include "BIF_renderwin.h"
#include "BIF_resources.h"
#include "BIF_screen.h"
#include "BIF_space.h"
#include "BIF_toolbox.h"
-#include "BIF_cursors.h"
#ifdef WITH_VERSE
#include "BIF_verse.h"
#endif
-
-#include "BSE_drawview.h"
-#include "BSE_edit.h"
-#include "BSE_editipo.h"
-#include "BSE_filesel.h"
-#include "BSE_headerbuttons.h"
-#include "BSE_node.h"
+#include "BDR_editobject.h"
#include "BLO_readfile.h"
#include "BLO_writefile.h"
-#include "BDR_drawobject.h"
-#include "BDR_editobject.h"
-#include "BDR_editcurve.h"
-#include "BDR_imagepaint.h"
-#include "BDR_vpaint.h"
-
-#include "BPY_extern.h"
-
-#include "blendef.h"
-
-#include "RE_pipeline.h" /* RE_ free stuff */
+// XXX #include "BPY_extern.h"
-#include "radio.h"
#include "datatoc.h"
-#include "SYS_System.h"
-
-#include "PIL_time.h"
+#include "WM_api.h"
+#include "wm.h"
/***/
/* define for setting colors in theme below */
#define SETCOL(col, r, g, b, a) col[0]=r; col[1]=g; col[2]= b; col[3]= a;
-/* patching UserDef struct, set globals for UI stuff */
-static void init_userdef_file(void)
+/* patching UserDef struct and Themes */
+static void init_userdef_themes(void)
{
- BIF_InitTheme(); // sets default again
-
- mainwindow_set_filename_to_title(""); // empty string re-initializes title to "Blender"
- countall();
- G.save_over = 0; // start with save preference untitled.blend
+// XXX BIF_InitTheme(); // sets default again
- /* disable autoplay in .B.blend... */
- G.fileflags &= ~G_FILE_AUTOPLAY;
+// countall();
/* the UserDef struct is not corrected with do_versions() .... ugh! */
if(U.wheellinescroll == 0) U.wheellinescroll = 3;
@@ -183,7 +136,7 @@ static void init_userdef_file(void)
}
if (U.savetime <= 0) {
U.savetime = 1;
- error(".B.blend is buggy, please consider removing it.\n");
+// XXX error(".B.blend is buggy, please consider removing it.\n");
}
/* transform widget settings */
if(U.tw_hotspot==0) {
@@ -401,39 +354,119 @@ static void init_userdef_file(void)
MEM_CacheLimiter_set_maximum(U.memcachelimit * 1024 * 1024);
- reset_autosave();
-
-#ifdef INTERNATIONAL
- read_languagefile();
-#endif
-
- refresh_interface_font();
+ /* funny name, but it is GE stuff, moves userdef stuff to engine */
+// XXX space_set_commmandline_options();
+ /* this timer uses U */
+// XXX reset_autosave();
#ifdef WITH_VERSE
if(strlen(U.versemaster)<1) {
- strcpy(U.versemaster, "master.uni-verse.org");
+ strcpy(U.versemaster, "master.uni-verse.org");
}
if(strlen(U.verseuser)<1) {
- char *name = verse_client_name();
- strcpy(U.verseuser, name);
- MEM_freeN(name);
+ char *name = verse_client_name();
+ strcpy(U.verseuser, name);
+ MEM_freeN(name);
}
#endif
}
-#ifdef WITH_VERSE
-extern ListBase session_list;
-#endif
+/* To be able to read files without windows closing, opening, moving
+ we try to prepare for worst case:
+ - active window gets active screen from file
+ - restoring the screens from non-active windows
+ Best case is all screens match, in that case they get assigned to proper window
+*/
+static void wm_window_match_init(bContext *C, ListBase *wmlist)
+{
+ wmWindowManager *wm= G.main->wm.first;
+ wmWindow *win;
+
+ *wmlist= G.main->wm;
+ G.main->wm.first= G.main->wm.last= NULL;
+
+return;
+ if(wm==NULL) return;
+ if(G.fileflags & G_FILE_NO_UI) return;
+
+ /* we take apart the used screens from non-active window */
+ for(win= wm->windows.first; win; win= win->next) {
+ BLI_strncpy(win->screenname, win->screen->id.name, MAX_ID_NAME);
+ if(win!=C->window) {
+ BLI_remlink(&G.main->screen, win->screen);
+ //BLI_addtail(screenbase, win->screen);
+ }
+ }
+}
-void BIF_read_file(char *name)
+/* match old WM with new, 4 cases:
+ 1- no current wm, no read wm: make new default
+ 2- no current wm, but read wm: that's OK, do nothing
+ 3- current wm, but not in file: try match screen names
+ 4- current wm, and wm in file: try match ghostwin
+
+*/
+static void wm_window_match_do(bContext *C, ListBase *wmlist)
{
- extern short winqueue_break; /* editscreen.c */
- int retval;
+ wmWindowManager *oldwm, *wm;
+ wmWindow *oldwin, *win;
+
+ /* cases 1 and 2 */
+ if(wmlist->first==NULL) {
+ if(G.main->wm.first); /* nothing todo */
+ else
+ wm_add_default(C);
+ }
+ else {
+ /* cases 3 and 4 */
+
+ /* we've read file without wm... */
+ if(G.main->wm.first==NULL) {
+ /* match oldwm to new dbase, only old files */
+
+ for(wm= wmlist->first; wm; wm= wm->id.next) {
+ for(win= wm->windows.first; win; win= win->next) {
+ win->screen= (bScreen *)find_id("SR", win->screenname);
+ if(win->screen->winid==0) {
+ if(win->screen==NULL)
+ win->screen= C->screen; /* active screen */
+
+ win->screen->winid= win->winid;
+ }
+ }
+ }
+ /* XXX still solve, case where multiple windows open */
+
+ G.main->wm= *wmlist;
+ }
+ else {
+ /* what if old was 3, and loaded 1? */
+ /* this code could move to setup_appdata */
+ oldwm= wmlist->first;
+ wm= G.main->wm.first;
+ /* only first wm in list has ghostwins */
+ for(win= wm->windows.first; win; win= win->next) {
+ for(oldwin= oldwm->windows.first; oldwin; oldwin= oldwin->next) {
+
+ if(oldwin->winid == win->winid ) {
+ win->ghostwin= oldwin->ghostwin;
+ oldwin->ghostwin= NULL;
+ }
+ }
+ }
+ wm_close_and_free_all(C, wmlist);
+ }
+ }
+}
+
#ifdef WITH_VERSE
+static void verse_unsub(void)
+{
+ extern ListBase session_list;
struct VerseSession *session;
struct VNode *vnode;
-
+
session = session_list.first;
while(session) {
vnode = session->nodes.lb.first;
@@ -453,34 +486,51 @@ void BIF_read_file(char *name)
}
session = session->next;
}
+}
#endif
- /* first try to read exotic file formats... */
+void WM_read_file(bContext *C, char *name)
+{
+ int retval;
+
+#ifdef WITH_VERSE
+ verse_unsub(); /* bad call here (ton) */
+#endif
+
+ /* first try to append data from exotic file formats... */
/* it throws error box when file doesnt exist and returns -1 */
retval= BKE_read_exotic(name);
+ /* we didn't succeed, now try to read Blender file */
if (retval== 0) {
- /* we didn't succeed, now try to read Blender file */
- retval= BKE_read_file(name, NULL);
+ ListBase wmbase;
- mainwindow_set_filename_to_title(G.main->name);
- countall();
- sound_initialize_sounds();
+ /* put aside screens to match with persistant windows later */
+ wm_window_match_init(C, &wmbase);
+
+ retval= BKE_read_file(C, name, NULL);
- winqueue_break= 1; /* leave queues everywhere */
+ /* match the read WM with current WM */
+ wm_window_match_do(C, &wmbase);
+
+// XXX mainwindow_set_filename_to_title(G.main->name);
+// countall(); <-- will be listener
+// XXX sound_initialize_sounds();
- if(retval==2) init_userdef_file(); // in case a userdef is read from regular .blend
+// winqueue_break= 1; /* leave queues everywhere */
+
+ if(retval==2) init_userdef_themes(); // in case a userdef is read from regular .blend
if (retval!=0) G.relbase_valid = 1;
- undo_editmode_clear();
+// XXX undo_editmode_clear();
BKE_reset_undo();
- BKE_write_undo("original"); /* save current state */
+ BKE_write_undo(C, "original"); /* save current state */
- refresh_interface_font();
+// refresh_interface_font();
}
- else if(retval==1)
- BIF_undo_push("Import file");
+// else if(retval==1)
+// XXX BIF_undo_push("Import file");
}
static void outliner_242_patch(void)
@@ -494,7 +544,7 @@ static void outliner_242_patch(void)
SpaceOops *soops= (SpaceOops *)sl;
if(soops->type!=SO_OUTLINER) {
soops->type= SO_OUTLINER;
- init_v2d_oops(sa, soops);
+// XXX init_v2d_oops(sa, soops);
}
}
}
@@ -502,51 +552,58 @@ static void outliner_242_patch(void)
G.fileflags |= G_FILE_GAME_MAT;
}
-/* only here settings for fullscreen */
-int BIF_read_homefile(int from_memory)
+/* called on startup, (context entirely filled with NULLs) */
+/* or called for 'Erase All' */
+int WM_read_homefile(bContext *C, int from_memory)
{
+ ListBase wmbase;
char tstr[FILE_MAXDIR+FILE_MAXFILE], scestr[FILE_MAXDIR];
char *home= BLI_gethome();
int success;
- struct TmpFont *tf;
BLI_clean(home);
-
- tf= G.ttfdata.first;
- while(tf)
- {
- freePackedFile(tf->pf);
- tf->pf = NULL;
- tf->vfont = NULL;
- tf= tf->next;
- }
- BLI_freelistN(&G.ttfdata);
+
+ free_ttfont(); /* still weird... what does it here? */
G.relbase_valid = 0;
if (!from_memory) BLI_make_file_string(G.sce, tstr, home, ".B.blend");
- strcpy(scestr, G.sce); /* temporal store */
+ strcpy(scestr, G.sce); /* temporary store */
/* prevent loading no UI */
G.fileflags &= ~G_FILE_NO_UI;
+ /* put aside screens to match with persistant windows later */
+ wm_window_match_init(C, &wmbase);
+
if (!from_memory && BLI_exists(tstr)) {
- success = BKE_read_file(tstr, NULL);
+ success = BKE_read_file(C, tstr, NULL);
} else {
- success = BKE_read_file_from_memory(datatoc_B_blend, datatoc_B_blend_size, NULL);
+ success = BKE_read_file_from_memory(C, datatoc_B_blend, datatoc_B_blend_size, NULL);
/* outliner patch for 2.42 .b.blend */
outliner_242_patch();
}
+
+ /* match the read WM with current WM */
+ wm_window_match_do(C, &wmbase);
+
+ strcpy(G.sce, scestr); /* restore */
- BLI_clean(scestr);
- strcpy(G.sce, scestr);
-
- space_set_commmandline_options();
+ init_userdef_themes();
- init_userdef_file();
+ /* XXX */
+ G.save_over = 0; // start with save preference untitled.blend
+ G.fileflags &= ~G_FILE_AUTOPLAY; /* disable autoplay in .B.blend... */
+// mainwindow_set_filename_to_title(""); // empty string re-initializes title to "Blender"
- undo_editmode_clear();
+#ifdef INTERNATIONAL
+// XXX read_languagefile();
+#endif
+
+// refresh_interface_font();
+
+// undo_editmode_clear();
BKE_reset_undo();
- BKE_write_undo("original"); /* save current state */
+ BKE_write_undo(C, "original"); /* save current state */
return success;
}
@@ -579,7 +636,7 @@ static void get_autosave_location(char buf[FILE_MAXDIR+FILE_MAXFILE])
BLI_make_file_string("/", buf, U.tempdir, pidstr);
}
-void BIF_read_autosavefile(void)
+void WM_read_autosavefile(bContext *C)
{
char tstr[FILE_MAX], scestr[FILE_MAX];
int save_over;
@@ -589,23 +646,13 @@ void BIF_read_autosavefile(void)
get_autosave_location(tstr);
save_over = G.save_over;
- BKE_read_file(tstr, NULL);
+ BKE_read_file(C, tstr, NULL);
G.save_over = save_over;
BLI_strncpy(G.sce, scestr, FILE_MAX);
}
-/* free strings of open recent files */
-static void free_openrecent(void)
-{
- struct RecentFile *recent;
-
- for(recent = G.recent_files.first; recent; recent=recent->next)
- MEM_freeN(recent->filename);
-
- BLI_freelistN(&(G.recent_files));
-}
-static void readBlog(void)
+void read_Blog(void)
{
char name[FILE_MAX], filename[FILE_MAX];
LinkNode *l, *lines;
@@ -656,19 +703,19 @@ static void readBlog(void)
tmps[2]='\\';
tmps[3]=0;
- fsmenu_insert_entry(tmps, 0, 0);
+// XX fsmenu_insert_entry(tmps, 0, 0);
}
}
/* Adding Desktop and My Documents */
- fsmenu_append_separator();
+// XXX fsmenu_append_separator();
SHGetSpecialFolderPath(0, folder, CSIDL_PERSONAL, 0);
- fsmenu_insert_entry(folder, 0, 0);
+// XXX fsmenu_insert_entry(folder, 0, 0);
SHGetSpecialFolderPath(0, folder, CSIDL_DESKTOPDIRECTORY, 0);
- fsmenu_insert_entry(folder, 0, 0);
+// XXX fsmenu_insert_entry(folder, 0, 0);
- fsmenu_append_separator();
+// XXX fsmenu_append_separator();
}
#endif
@@ -679,16 +726,16 @@ static void readBlog(void)
char *line= l->link;
if (!BLI_streq(line, "")) {
- fsmenu_insert_entry(line, 0, 1);
+// XXX fsmenu_insert_entry(line, 0, 1);
}
}
- fsmenu_append_separator();
+// XXX fsmenu_append_separator();
/* add last saved file */
BLI_split_dirfile(G.sce, name, filename); /* G.sce shouldn't be relative */
- fsmenu_insert_entry(name, 0, 0);
+// XXX fsmenu_insert_entry(name, 0, 0);
BLI_free_file_lines(lines);
}
@@ -749,8 +796,8 @@ static void do_history(char *name)
sprintf(tempname1, "%s%d", name, hisnr-1);
sprintf(tempname2, "%s%d", name, hisnr);
- if(BLI_rename(tempname1, tempname2))
- error("Unable to make version backup");
+// if(BLI_rename(tempname1, tempname2))
+// XXX error("Unable to make version backup");
hisnr--;
}
@@ -758,11 +805,11 @@ static void do_history(char *name)
/* is needed when hisnr==1 */
sprintf(tempname1, "%s%d", name, hisnr);
- if(BLI_rename(name, tempname1))
- error("Unable to make version backup");
+// if(BLI_rename(name, tempname1))
+// XXX error("Unable to make version backup");
}
-void BIF_write_file(char *target)
+void WM_write_file(bContext *C, char *target)
{
Library *li;
int writeflags, len;
@@ -773,16 +820,16 @@ void BIF_write_file(char *target)
if (len == 0) return;
if (len >= FILE_MAX) {
- error("Path too long, cannot save");
+// XXX error("Path too long, cannot save");
return;
}
/* send the OnSave event */
- if (G.f & G_DOSCRIPTLINKS) BPY_do_pyscript(&G.scene->id, SCRIPT_ONSAVE);
+// XXX if (G.f & G_DOSCRIPTLINKS) BPY_do_pyscript(&C->scene->id, SCRIPT_ONSAVE);
for (li= G.main->library.first; li; li= li->id.next) {
if (BLI_streq(li->name, target)) {
- error("Cannot overwrite used library");
+// XXX error("Cannot overwrite used library");
return;
}
}
@@ -794,18 +841,18 @@ void BIF_write_file(char *target)
}
if (BLI_exists(di)) {
- if(!saveover(di))
- return;
+// XXX if(!saveover(di))
+// XXX return;
}
if(G.obedit) {
- exit_editmode(0); /* 0 = no free data */
+// XXX exit_editmode(0); /* 0 = no free data */
}
if (G.fileflags & G_AUTOPACK) {
packAll();
}
- waitcursor(1); // exit_editmode sets cursor too
+// XXX waitcursor(1); // exit_editmode sets cursor too
do_history(di);
@@ -814,24 +861,25 @@ void BIF_write_file(char *target)
if(U.flag & USER_FILECOMPRESS)
writeflags |= G_FILE_COMPRESS;
- if (BLO_write_file(di, writeflags, &err)) {
+ if (BLO_write_file(C, di, writeflags, &err)) {
strcpy(G.sce, di);
G.relbase_valid = 1;
strcpy(G.main->name, di); /* is guaranteed current file */
- mainwindow_set_filename_to_title(G.main->name);
+// XXX mainwindow_set_filename_to_title(G.main->name);
G.save_over = 1;
writeBlog();
} else {
- error("%s", err);
+// XXX error("%s", err);
}
- waitcursor(0);
+// XXX waitcursor(0);
}
-void BIF_write_homefile(void)
+/* operator entry */
+int WM_write_homefile(bContext *C, wmOperator *op)
{
char *err, tstr[FILE_MAXDIR+FILE_MAXFILE];
int write_flags;
@@ -840,10 +888,12 @@ void BIF_write_homefile(void)
/* force save as regular blend file */
write_flags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_LOCK | G_FILE_SIGN);
- BLO_write_file(tstr, write_flags, &err);
+ BLO_write_file(C, tstr, write_flags, &err);
+
+ return 1;
}
-void BIF_write_autosave(void)
+void WM_write_autosave(bContext *C)
{
char *err, tstr[FILE_MAXDIR+FILE_MAXFILE];
int write_flags;
@@ -852,11 +902,11 @@ void BIF_write_autosave(void)
/* force save as regular blend file */
write_flags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_LOCK | G_FILE_SIGN);
- BLO_write_file(tstr, write_flags, &err);
+ BLO_write_file(C, tstr, write_flags, &err);
}
/* if global undo; remove tempsave, otherwise rename */
-static void delete_autosave(void)
+void delete_autosave(void)
{
char tstr[FILE_MAXDIR+FILE_MAXFILE];
@@ -873,178 +923,7 @@ static void delete_autosave(void)
/***/
-static void initbuttons(void)
-{
- uiDefFont(UI_HELVB,
- BMF_GetFont(BMF_kHelveticaBold14),
- BMF_GetFont(BMF_kHelveticaBold12),
- BMF_GetFont(BMF_kHelveticaBold10),
- BMF_GetFont(BMF_kHelveticaBold8));
- uiDefFont(UI_HELV,
- BMF_GetFont(BMF_kHelvetica12),
- BMF_GetFont(BMF_kHelvetica12),
- BMF_GetFont(BMF_kHelvetica10),
- BMF_GetFont(BMF_kHelveticaBold8));
-
- glClearColor(.7f, .7f, .6f, 0.0);
-
- G.font= BMF_GetFont(BMF_kHelvetica12);
- G.fonts= BMF_GetFont(BMF_kHelvetica10);
- G.fontss= BMF_GetFont(BMF_kHelveticaBold8);
-
- clear_matcopybuf();
-
- glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
-}
-
-
-static void sound_init_listener(void)
-{
- G.listener = MEM_callocN(sizeof(bSoundListener), "soundlistener");
- G.listener->gain = 1.0;
- G.listener->dopplerfactor = 1.0;
- G.listener->dopplervelocity = 340.29f;
-}
-
-void BIF_init(void)
-{
-
- initscreen(); /* for (visuele) speed, this first, then setscreen */
- initbuttons();
- InitCursorData();
- sound_init_listener();
- init_node_butfuncs();
-
- BIF_preview_init_dbase();
- BIF_read_homefile(0);
-
- BIF_resources_init(); /* after homefile, to dynamically load an icon file based on theme settings */
-
- BIF_filelist_init_icons();
-
- init_gl_stuff(); /* drawview.c, after homefile */
- readBlog();
- BLI_strncpy(G.lib, G.sce, FILE_MAX);
-}
-
-/***/
-
-extern ListBase editNurb;
-extern ListBase editelems;
-void exit_usiblender(void)
-{
- struct TmpFont *tf;
- tf= G.ttfdata.first;
- while(tf)
- {
- freePackedFile(tf->pf);
- tf->pf= NULL;
- tf->vfont= NULL;
- tf= tf->next;
- }
- BLI_freelistN(&G.ttfdata);
-#ifdef WITH_VERSE
- end_all_verse_sessions();
-#endif
- free_openrecent();
- freeAllRad();
- BKE_freecubetable();
- if (G.background == 0)
- sound_end_all_sounds();
- if(G.obedit) {
- if(G.obedit->type==OB_FONT) {
- free_editText();
- }
- else if(G.obedit->type==OB_MBALL) BLI_freelistN(&editelems);
- free_editMesh(G.editMesh);
- }
-
- free_editLatt();
- free_editArmature();
- free_posebuf();
-
- /* before free_blender so py's gc happens while library still exists */
- /* needed at least for a rare sigsegv that can happen in pydrivers */
- BPY_end_python();
-
- fastshade_free_render(); /* shaded view */
- free_blender(); /* blender.c, does entire library */
- free_matcopybuf();
- free_ipocopybuf();
- free_actcopybuf();
- free_vertexpaint();
- free_imagepaint();
-
- /* editnurb can remain to exist outside editmode */
- freeNurblist(&editNurb);
-
- fsmenu_free();
-
-#ifdef INTERNATIONAL
- free_languagemenu();
-#endif
-
- RE_FreeAllRender();
-
- free_txt_data();
-
- sound_exit_audio();
- if(G.listener) MEM_freeN(G.listener);
-
-
- libtiff_exit();
-
-#ifdef WITH_QUICKTIME
- quicktime_exit();
-#endif
-
- if (!G.background) {
- BIF_resources_free();
-
- BIF_filelist_free_icons();
-
- BIF_close_render_display();
- mainwindow_close();
- }
-
-#ifdef INTERNATIONAL
- FTF_End();
-#endif
-
- if (copybuf) MEM_freeN(copybuf);
- if (copybufinfo) MEM_freeN(copybufinfo);
-
- /* undo free stuff */
- undo_editmode_clear();
-
- BKE_undo_save_quit(); // saves quit.blend if global undo is on
- BKE_reset_undo();
-
- BLI_freelistN(&U.themes);
- BIF_preview_free_dbase();
-
- if(totblock!=0) {
- printf("Error Totblock: %d\n",totblock);
- MEM_printmemlist();
- }
- delete_autosave();
-
- printf("\nBlender quit\n");
-
-#ifdef WIN32
- /* ask user to press enter when in debug mode */
- if(G.f & G_DEBUG) {
- printf("press enter key to exit...\n\n");
- getchar();
- }
-#endif
-
-
- SYS_DeleteSystem(SYS_GetSystem());
-
- exit(G.afbreek==1);
-}
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
new file mode 100644
index 00000000000..029c16cee49
--- /dev/null
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -0,0 +1,302 @@
+/**
+ * $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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2007 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "MEM_guardedalloc.h"
+#include "MEM_CacheLimiterC-Api.h"
+
+#include "IMB_imbuf_types.h"
+#include "IMB_imbuf.h"
+
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_sound_types.h"
+#include "DNA_userdef_types.h"
+#include "DNA_windowmanager_types.h"
+
+#include "BKE_blender.h"
+#include "BKE_curve.h"
+#include "BKE_displist.h"
+#include "BKE_DerivedMesh.h"
+#include "BKE_font.h"
+#include "BKE_global.h"
+#include "BKE_library.h"
+#include "BKE_mball.h"
+#include "BKE_utildefines.h"
+#include "BKE_packedFile.h"
+
+#include "BMF_Api.h"
+#include "BIF_language.h"
+#ifdef INTERNATIONAL
+#include "FTF_Api.h"
+#endif
+
+#include "BLI_blenlib.h"
+
+#include "BIF_cursors.h"
+#include "BIF_drawtext.h"
+#include "BIF_editaction.h"
+#include "BIF_editarmature.h"
+#include "BIF_editlattice.h"
+#include "BIF_editfont.h"
+#include "BIF_editmesh.h"
+#include "BIF_editmode_undo.h"
+#include "BIF_editsound.h"
+#include "BIF_filelist.h"
+#include "BIF_fsmenu.h"
+#include "BIF_interface.h"
+#include "BIF_gl.h"
+#include "BIF_poseobject.h"
+#include "BIF_previewrender.h"
+#include "BIF_resources.h"
+#include "BIF_usiblender.h" /* XXX */
+
+#include "BSE_drawview.h"
+#include "BSE_edit.h"
+#include "BSE_editipo.h"
+#include "BSE_filesel.h"
+#include "BSE_headerbuttons.h"
+#include "BSE_node.h"
+
+#include "BDR_drawobject.h"
+#include "BDR_editobject.h"
+#include "BDR_editcurve.h"
+#include "BDR_imagepaint.h"
+#include "BDR_vpaint.h"
+
+#include "RE_pipeline.h" /* RE_ free stuff */
+
+#include "radio.h"
+
+#include "BPY_extern.h"
+
+#include "SYS_System.h"
+
+#include "WM_api.h"
+#include "wm.h"
+#include "wm_files.h"
+#include "wm_window.h"
+
+static void initbuttons(void)
+{
+// uiDefFont(UI_HELVB,
+// BMF_GetFont(BMF_kHelveticaBold14),
+// BMF_GetFont(BMF_kHelveticaBold12),
+// BMF_GetFont(BMF_kHelveticaBold10),
+// BMF_GetFont(BMF_kHelveticaBold8));
+// uiDefFont(UI_HELV,
+// BMF_GetFont(BMF_kHelvetica12),
+// BMF_GetFont(BMF_kHelvetica12),
+// BMF_GetFont(BMF_kHelvetica10),
+// BMF_GetFont(BMF_kHelveticaBold8));
+
+// glClearColor(.7f, .7f, .6f, 0.0);
+
+ G.font= BMF_GetFont(BMF_kHelvetica12);
+ G.fonts= BMF_GetFont(BMF_kHelvetica10);
+ G.fontss= BMF_GetFont(BMF_kHelveticaBold8);
+
+// clear_matcopybuf(); /* XXX */
+
+// glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
+}
+
+/* XXX */
+static void sound_init_listener(void)
+{
+ G.listener = MEM_callocN(sizeof(bSoundListener), "soundlistener");
+ G.listener->gain = 1.0;
+ G.listener->dopplerfactor = 1.0;
+ G.listener->dopplervelocity = 340.29f;
+}
+
+/* only called once, for startup */
+void WM_init(bContext *C)
+{
+
+ wm_ghost_init(C); /* note: it assigns C to ghost! */
+ wm_operatortype_init();
+
+ set_free_windowmanager_cb(wm_close_and_free); /* library.c */
+
+ /* get the default database, plus a wm */
+ WM_read_homefile(C, 0);
+
+ wm_check(C); /* opens window(s), checks keymaps */
+
+// initscreen(); /* for (visual) speed, this first, then setscreen */
+ initbuttons();
+// InitCursorData();
+ sound_init_listener();
+// init_node_butfuncs();
+
+// XXX BIF_preview_init_dbase();
+
+
+// XXX BIF_resources_init(); /* after homefile, to dynamically load an icon file based on theme settings */
+
+// XXX BIF_filelist_init_icons();
+
+// init_gl_stuff(); /* drawview.c, after homefile */
+ read_Blog();
+ BLI_strncpy(G.lib, G.sce, FILE_MAX);
+}
+
+/* free strings of open recent files */
+static void free_openrecent(void)
+{
+ struct RecentFile *recent;
+
+ for(recent = G.recent_files.first; recent; recent=recent->next)
+ MEM_freeN(recent->filename);
+
+ BLI_freelistN(&(G.recent_files));
+}
+
+
+/* bad stuff*/
+
+extern ListBase editNurb;
+extern ListBase editelems;
+extern wchar_t *copybuf;
+extern wchar_t *copybufinfo;
+
+/* called in creator.c even... tsk, split this! */
+void WM_exit(bContext *C)
+{
+ wm_operatortype_free();
+
+ free_ttfont(); /* bke_font.h */
+
+#ifdef WITH_VERSE
+ end_all_verse_sessions();
+#endif
+ free_openrecent();
+
+ freeAllRad();
+ BKE_freecubetable();
+
+// if (G.background == 0)
+// sound_end_all_sounds();
+
+ if(G.obedit) {
+ if(G.obedit->type==OB_FONT) {
+// free_editText();
+ }
+// else if(G.obedit->type==OB_MBALL) BLI_freelistN(&editelems);
+// free_editMesh(G.editMesh);
+ }
+
+// free_editLatt();
+// free_editArmature();
+// free_posebuf();
+
+ /* before free_blender so py's gc happens while library still exists */
+ /* needed at least for a rare sigsegv that can happen in pydrivers */
+// BPY_end_python();
+
+// fastshade_free_render(); /* shaded view */
+ free_blender(); /* blender.c, does entire library */
+// free_matcopybuf();
+// free_ipocopybuf();
+// free_actcopybuf();
+// free_vertexpaint();
+// free_imagepaint();
+
+ /* editnurb can remain to exist outside editmode */
+ freeNurblist(&editNurb);
+
+// fsmenu_free();
+
+#ifdef INTERNATIONAL
+// free_languagemenu();
+#endif
+
+ RE_FreeAllRender();
+
+// free_txt_data();
+
+// sound_exit_audio();
+ if(G.listener) MEM_freeN(G.listener);
+
+
+ libtiff_exit();
+
+#ifdef WITH_QUICKTIME
+ quicktime_exit();
+#endif
+
+ if (!G.background) {
+// XXX BIF_resources_free();
+
+// XXX BIF_filelist_free_icons();
+ }
+
+#ifdef INTERNATIONAL
+ FTF_End();
+#endif
+
+// if (copybuf) MEM_freeN(copybuf);
+// if (copybufinfo) MEM_freeN(copybufinfo);
+
+ /* undo free stuff */
+// undo_editmode_clear();
+
+ BKE_undo_save_quit(); // saves quit.blend if global undo is on
+ BKE_reset_undo();
+
+ BLI_freelistN(&U.themes);
+// XXX BIF_preview_free_dbase();
+
+ MEM_freeN(C);
+
+ if(totblock!=0) {
+ printf("Error Totblock: %d\n",totblock);
+ MEM_printmemlist();
+ }
+// delete_autosave();
+
+ printf("\nBlender quit\n");
+
+#ifdef WIN32
+ /* ask user to press enter when in debug mode */
+ if(G.f & G_DEBUG) {
+ printf("press enter key to exit...\n\n");
+ getchar();
+ }
+#endif
+
+
+ SYS_DeleteSystem(SYS_GetSystem());
+
+ exit(G.afbreek==1);
+}
+
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
new file mode 100644
index 00000000000..da340e35d79
--- /dev/null
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -0,0 +1,112 @@
+/**
+ * $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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2007 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <string.h>
+
+#include "DNA_windowmanager_types.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_blenlib.h"
+
+#include "BKE_blender.h"
+#include "BKE_global.h"
+#include "BKE_library.h"
+#include "BKE_main.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+#include "wm_window.h"
+#include "wm_event_system.h"
+#include "wm_event_types.h"
+
+/* ***************** generic call, exported **************** */
+
+static void keymap_set(wmKeymapItem *km, short type, short val, int modifier, short keymodifier)
+{
+ km->type= type;
+ km->val= val;
+ km->keymodifier= keymodifier;
+
+ if(modifier & KM_SHIFT)
+ km->shift= 1;
+ else if(modifier & KM_SHIFT2)
+ km->shift= 2;
+ if(modifier & KM_CTRL)
+ km->ctrl= 1;
+ else if(modifier & KM_CTRL2)
+ km->ctrl= 2;
+ if(modifier & KM_ALT)
+ km->alt= 1;
+ else if(modifier & KM_ALT2)
+ km->alt= 2;
+ if(modifier & KM_OSKEY)
+ km->oskey= 1;
+ else if(modifier & KM_OSKEY2)
+ km->oskey= 2;
+}
+
+/* if item was added, then replace */
+void WM_keymap_verify_item(ListBase *lb, char *idname, short type, short val, int modifier, short keymodifier)
+{
+ wmKeymapItem *km;
+
+ /* if item was added, then bail out */
+ for(km= lb->first; km; km= km->next)
+ if(strncmp(km->idname, idname, OP_MAX_TYPENAME)==0)
+ break;
+ if(km==NULL) {
+ km= MEM_callocN(sizeof(wmKeymapItem), "keymap entry");
+
+ BLI_addtail(lb, km);
+ BLI_strncpy(km->idname, idname, OP_MAX_TYPENAME);
+
+ keymap_set(km, type, val, modifier, keymodifier);
+ }
+
+}
+
+/* if item was added, then replace */
+void WM_keymap_set_item(ListBase *lb, char *idname, short type, short val, int modifier, short keymodifier)
+{
+ wmKeymapItem *km;
+
+ for(km= lb->first; km; km= km->next)
+ if(strncmp(km->idname, idname, OP_MAX_TYPENAME)==0)
+ break;
+ if(km==NULL) {
+ km= MEM_callocN(sizeof(wmKeymapItem), "keymap entry");
+
+ BLI_addtail(lb, km);
+ BLI_strncpy(km->idname, idname, OP_MAX_TYPENAME);
+ }
+ keymap_set(km, type, val, modifier, keymodifier);
+}
+
+
+
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
new file mode 100644
index 00000000000..d3216d20725
--- /dev/null
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -0,0 +1,125 @@
+/**
+ * $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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2007 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <string.h>
+
+#include "DNA_windowmanager_types.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_blenlib.h"
+
+#include "BKE_blender.h"
+#include "BKE_global.h"
+#include "BKE_library.h"
+#include "BKE_main.h"
+
+#include "BIF_toolbox.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+#include "wm_window.h"
+#include "wm_event_system.h"
+
+static ListBase global_ops= {NULL, NULL};
+
+/* ************ operator API, exported ********** */
+
+wmOperatorType *WM_operatortype_find(const char *idname)
+{
+ wmOperatorType *ot;
+
+ for(ot= global_ops.first; ot; ot= ot->next) {
+ if(strncmp(ot->idname, idname, OP_MAX_TYPENAME)==0)
+ return ot;
+ }
+ return NULL;
+}
+
+/* ************ default ops, exported *********** */
+
+int WM_operator_confirm(bContext *C, wmOperator *op, wmEvent *event)
+{
+// if(okee(op->type->name)) {
+// return op->type->exec(C, op);
+// }
+ return 0;
+}
+int WM_operator_winactive(bContext *C)
+{
+ if(C->window==NULL) return 0;
+ return 1;
+}
+
+/* ************ window / screen operator definitions ************** */
+
+static void WM_OT_window_duplicate(wmOperatorType *ot)
+{
+ ot->name= "Duplicate Window";
+ ot->idname= "WM_OT_window_duplicate";
+
+ ot->interactive= NULL; //WM_operator_confirm;
+ ot->exec= wm_window_duplicate_op;
+ ot->poll= WM_operator_winactive;
+}
+
+static void WM_OT_save_homefile(wmOperatorType *ot)
+{
+ ot->name= "Save User Settings";
+ ot->idname= "WM_OT_save_homefile";
+
+ ot->interactive= NULL; //WM_operator_confirm;
+ ot->exec= WM_write_homefile;
+ ot->poll= WM_operator_winactive;
+
+ ot->flag= OPTYPE_REGISTER;
+}
+
+
+
+#define ADD_OPTYPE(opfunc) ot= MEM_callocN(sizeof(wmOperatorType), "operatortype"); \
+ opfunc(ot); \
+ BLI_addtail(&global_ops, ot)
+
+
+/* called on initialize WM_exit() */
+void wm_operatortype_free(void)
+{
+ BLI_freelistN(&global_ops);
+}
+
+/* called on initialize WM_init() */
+void wm_operatortype_init(void)
+{
+ wmOperatorType *ot;
+
+ ADD_OPTYPE(WM_OT_window_duplicate);
+ ADD_OPTYPE(WM_OT_save_homefile);
+}
+
+
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
new file mode 100644
index 00000000000..4a6a3c572d3
--- /dev/null
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -0,0 +1,491 @@
+/**
+ * $Id: wm_window.c
+ *
+ * ***** 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2007 Blender Foundation but based
+ * on ghostwinlay.c (C) 2001-2002 by NaN Holding BV
+ * All rights reserved.
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "DNA_listBase.h"
+#include "DNA_screen_types.h"
+#include "DNA_windowmanager_types.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "GHOST_C-api.h"
+
+#include "BLI_blenlib.h"
+
+#include "BKE_blender.h"
+#include "BKE_global.h"
+#include "BKE_utildefines.h"
+
+#include "BIF_gl.h"
+
+#include "WM_api.h"
+#include "wm.h"
+#include "wm_window.h"
+#include "wm_event_system.h"
+
+/* the global to talk to ghost */
+GHOST_SystemHandle g_system= NULL;
+
+/* set by commandline */
+static int prefsizx= 0, prefsizy= 0, prefstax= 0, prefstay= 0;
+
+
+/* ******** win open & close ************ */
+
+
+static void wm_get_screensize(int *width_r, int *height_r)
+{
+ unsigned int uiwidth;
+ unsigned int uiheight;
+
+ GHOST_GetMainDisplayDimensions(g_system, &uiwidth, &uiheight);
+ *width_r= uiwidth;
+ *height_r= uiheight;
+}
+
+static void wm_ghostwindow_destroy(wmWindow *win)
+{
+
+ if (win->timer) {
+ GHOST_RemoveTimer(g_system, (GHOST_TimerTaskHandle)win->timer);
+ win->timer= NULL;
+ }
+
+ if(win->ghostwin) {
+ GHOST_DisposeWindow(g_system, win->ghostwin);
+ win->ghostwin= NULL;
+ }
+}
+
+/* including window itself */
+void wm_window_free(bContext *C, wmWindow *win)
+{
+
+ /* update context */
+ if(C) {
+ if(C->wm->windrawable==win)
+ C->wm->windrawable= NULL;
+ if(C->wm->winactive==win)
+ C->wm->winactive= NULL;
+ if(C->window==win)
+ C->window= NULL;
+ if(C->screen==win->screen)
+ C->screen= NULL;
+ }
+ /* XXX free screens */
+
+ if(win->eventstate) MEM_freeN(win->eventstate);
+
+ BLI_freelistN(&win->queue);
+ wm_event_free_handlers(&win->handlers);
+
+ wm_event_free_all(win);
+ wm_ghostwindow_destroy(win);
+
+ MEM_freeN(win);
+}
+
+static int find_free_winid(wmWindowManager *wm)
+{
+ wmWindow *win;
+ int id= 0;
+
+ for(win= wm->windows.first; win; win= win->next)
+ if(id <= win->winid)
+ id= win->winid+1;
+
+ return id;
+}
+
+/* dont change context itself */
+wmWindow *wm_window_new(bContext *C, bScreen *screen)
+{
+ wmWindow *win= MEM_callocN(sizeof(wmWindow), "window");
+
+ BLI_addtail(&C->wm->windows, win);
+ win->winid= find_free_winid(C->wm);
+
+ win->screen= screen;
+ return win;
+}
+
+/* part of wm_window.c api */
+wmWindow *wm_window_copy(bContext *C, wmWindow *winorig)
+{
+ wmWindow *win= wm_window_new(C, winorig->screen); /* XXX need copy */
+
+ win->posx= winorig->posx+10;
+ win->posy= winorig->posy;
+ win->sizex= winorig->sizex;
+ win->sizey= winorig->sizey;
+
+ return win;
+}
+
+/* operator callback */
+int wm_window_duplicate_op(bContext *C, wmOperator *op)
+{
+
+ wm_window_copy(C, C->window);
+ wm_check(C);
+
+ return 1;
+}
+
+/* this is event from ghost */
+static void wm_window_close(bContext *C, wmWindow *win)
+{
+ BLI_remlink(&C->wm->windows, win);
+ wm_window_free(C, win);
+
+ if(C->wm->windows.first==NULL)
+ WM_exit(C);
+}
+
+static void wm_window_open(wmWindowManager *wm, char *title, wmWindow *win)
+{
+ GHOST_WindowHandle ghostwin;
+ GHOST_TWindowState inital_state;
+ int scr_w, scr_h, posy;
+
+ wm_get_screensize(&scr_w, &scr_h);
+ posy= (scr_h - win->posy - win->sizey);
+
+ if (win->windowstate == G_WINDOWSTATE_FULLSCREEN)
+ inital_state = GHOST_kWindowStateFullScreen;
+ else if (win->windowstate == G_WINDOWSTATE_BORDER)
+ inital_state = GHOST_kWindowStateMaximized;
+ else
+ inital_state = GHOST_kWindowStateNormal;
+
+#ifdef __APPLE__
+ {
+ extern int macPrefState; /* creator.c */
+ inital_state += macPrefState;
+ }
+#endif
+
+ ghostwin= GHOST_CreateWindow(g_system, title,
+ win->posx, posy, win->sizex, win->sizey,
+ inital_state,
+ GHOST_kDrawingContextTypeOpenGL,
+ 0 /* no stereo */);
+
+ if (ghostwin) {
+
+ win->ghostwin= ghostwin;
+ GHOST_SetWindowUserData(ghostwin, win); /* pointer back */
+
+ if(win->eventstate==NULL)
+ win->eventstate= MEM_callocN(sizeof(wmEvent), "window event state");
+
+ /* add keymap handler (1 for all keys in map!) */
+ WM_event_add_keymap_handler(&wm->windowkeymap, &win->handlers);
+
+ /* until screens get drawn, make it nice grey */
+ glClearColor(.55, .55, .55, 0.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+ wm_window_swap_buffers(win);
+ }
+
+
+}
+
+/* for wmWindows without ghostwin, open these and clear */
+void wm_window_add_ghostwindows(wmWindowManager *wm)
+{
+ wmWindow *win;
+
+ /* no commandline prefsize? then we set this */
+ if (!prefsizx) {
+ wm_get_screensize(&prefsizx, &prefsizy);
+
+#ifdef __APPLE__
+ extern void wm_set_apple_prefsize(int, int); /* wm_apple.c */
+
+ wm_set_apple_prefsize(prefsizx, prefsizy);
+#else
+ prefstax= 0;
+ prefstay= 0;
+
+#endif
+ }
+
+ for(win= wm->windows.first; win; win= win->next) {
+ if(win->ghostwin==NULL) {
+ if(win->sizex==0) {
+ win->posx= prefstax;
+ win->posy= prefstay;
+ win->sizex= prefsizx;
+ win->sizey= prefsizy;
+ win->windowstate= G.windowstate;
+ }
+ wm_window_open(wm, "Blender", win);
+ }
+ }
+}
+
+/* ************ events *************** */
+
+static int query_qual(char qual)
+{
+ GHOST_TModifierKeyMask left, right;
+ int val= 0;
+
+ if (qual=='s') {
+ left= GHOST_kModifierKeyLeftShift;
+ right= GHOST_kModifierKeyRightShift;
+ } else if (qual=='c') {
+ left= GHOST_kModifierKeyLeftControl;
+ right= GHOST_kModifierKeyRightControl;
+ } else if (qual=='C') {
+ left= right= GHOST_kModifierKeyCommand;
+ } else {
+ left= GHOST_kModifierKeyLeftAlt;
+ right= GHOST_kModifierKeyRightAlt;
+ }
+
+ GHOST_GetModifierKeyState(g_system, left, &val);
+ if (!val)
+ GHOST_GetModifierKeyState(g_system, right, &val);
+
+ return val;
+}
+
+void wm_window_make_drawable(bContext *C, wmWindow *win)
+{
+ if (win != C->window && win->ghostwin) {
+// win->lmbut= 0; /* keeps hanging when mousepressed while other window opened */
+
+ C->wm->windrawable= win;
+ C->window= win;
+ C->screen= win->screen;
+
+ GHOST_ActivateWindowDrawingContext(win->ghostwin);
+ }
+}
+
+/* called by ghost, here we handle events for windows themselves or send to event system */
+int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
+{
+ bContext *C= private;
+ GHOST_TEventType type= GHOST_GetEventType(evt);
+
+ if (type == GHOST_kEventQuit) {
+ WM_exit(C);
+ } else {
+ GHOST_WindowHandle ghostwin= GHOST_GetEventWindow(evt);
+ GHOST_TEventDataPtr data= GHOST_GetEventData(evt);
+ wmWindow *win;
+
+ if (!ghostwin) {
+ // XXX - should be checked, why are we getting an event here, and
+ // what is it?
+
+ return 1;
+ } else if (!GHOST_ValidWindow(g_system, ghostwin)) {
+ // XXX - should be checked, why are we getting an event here, and
+ // what is it?
+
+ return 1;
+ } else {
+ win= GHOST_GetWindowUserData(ghostwin);
+ }
+
+ switch(type) {
+ case GHOST_kEventWindowDeactivate:
+ win->active= 0; /* XXX */
+ break;
+ case GHOST_kEventWindowActivate:
+ {
+ GHOST_TEventKeyData kdata;
+ int cx, cy, wx, wy;
+
+ C->wm->winactive= win; /* no context change! c->window is drawable, or for area queues */
+
+ win->active= 1;
+// window_handle(win, INPUTCHANGE, win->active);
+
+ /* bad ghost support for modifier keys... */
+ kdata.ascii= 0;
+ if (win->eventstate->shift && !query_qual('s')) {
+ kdata.key= GHOST_kKeyLeftShift;
+ wm_event_add_ghostevent(win, GHOST_kEventKeyUp, &kdata);
+ }
+ if (win->eventstate->ctrl && !query_qual('c')) {
+ kdata.key= GHOST_kKeyLeftControl;
+ wm_event_add_ghostevent(win, GHOST_kEventKeyUp, &kdata);
+ }
+ if (win->eventstate->alt && !query_qual('a')) {
+ kdata.key= GHOST_kKeyLeftAlt;
+ wm_event_add_ghostevent(win, GHOST_kEventKeyUp, &kdata);
+ }
+ if (win->eventstate->oskey && !query_qual('C')) {
+ kdata.key= GHOST_kKeyCommand;
+ wm_event_add_ghostevent(win, GHOST_kEventKeyUp, &kdata);
+ }
+
+ /* entering window, update mouse pos. but no event */
+ GHOST_GetCursorPosition(g_system, &wx, &wy);
+
+ GHOST_ScreenToClient(win->ghostwin, wx, wy, &cx, &cy);
+ win->eventstate->x= cx;
+ win->eventstate->y= (win->sizey-1) - cy;
+
+ break;
+ }
+ case GHOST_kEventWindowClose: {
+ wm_window_close(C, win);
+ break;
+ }
+ case GHOST_kEventWindowUpdate: {
+// window_handle(win, REDRAW, 1);
+ break;
+ }
+ case GHOST_kEventWindowSize: {
+ GHOST_RectangleHandle client_rect;
+ int l, t, r, b, scr_w, scr_h;
+
+ /* was GetClientBounds, doesnt work (at least osx) */
+ client_rect= GHOST_GetWindowBounds(win->ghostwin);
+ GHOST_GetRectangle(client_rect, &l, &t, &r, &b);
+
+ GHOST_DisposeRectangle(client_rect);
+
+ wm_get_screensize(&scr_w, &scr_h);
+ win->sizex= r-l;
+ win->sizey= b-t;
+ win->posx= l;
+ win->posy= scr_h - t - win->sizey;
+#ifdef __APPLE__
+ win->posy-= 24; /* gutter... see ghost, bad stuff */
+#endif
+
+// window_handle(win, RESHAPE, 1);
+ break;
+ }
+ default:
+ wm_event_add_ghostevent(win, type, data);
+ break;
+ }
+
+ }
+ return 1;
+}
+
+void wm_window_process_events(int wait_for_event)
+{
+ GHOST_ProcessEvents(g_system, wait_for_event);
+ GHOST_DispatchEvents(g_system);
+}
+
+/* **************** init ********************** */
+
+void wm_ghost_init(bContext *C)
+{
+ if (!g_system) {
+ GHOST_EventConsumerHandle consumer= GHOST_CreateEventConsumer(ghost_event_proc, C);
+
+ g_system= GHOST_CreateSystem();
+ GHOST_AddEventConsumer(g_system, consumer);
+ }
+}
+
+/* **************** timer ********************** */
+
+static void window_timer_proc(GHOST_TimerTaskHandle timer, GHOST_TUns64 time)
+{
+ wmWindow *win= GHOST_GetTimerTaskUserData(timer);
+
+ wm_event_add_ghostevent(win, win->timer_event, NULL);
+}
+
+void wm_window_set_timer(wmWindow *win, int delay_ms, int event)
+{
+ if (win->timer) GHOST_RemoveTimer(g_system, win->timer);
+
+ win->timer_event= event;
+ win->timer= GHOST_InstallTimer(g_system, delay_ms, delay_ms, window_timer_proc, win);
+}
+
+/* ************************************ */
+
+void wm_window_set_title(wmWindow *win, char *title)
+{
+ GHOST_SetTitle(win->ghostwin, title);
+}
+
+void wm_window_get_position(wmWindow *win, int *posx_r, int *posy_r)
+{
+ *posx_r= win->posx;
+ *posy_r= win->posy;
+}
+
+void wm_window_get_size(wmWindow *win, int *width_r, int *height_r)
+{
+ *width_r= win->sizex;
+ *height_r= win->sizey;
+}
+
+void wm_window_set_size(wmWindow *win, int width, int height)
+{
+ GHOST_SetClientSize(win->ghostwin, width, height);
+}
+
+void wm_window_lower(wmWindow *win)
+{
+ GHOST_SetWindowOrder(win->ghostwin, GHOST_kWindowOrderBottom);
+}
+
+void wm_window_raise(wmWindow *win)
+{
+ GHOST_SetWindowOrder(win->ghostwin, GHOST_kWindowOrderTop);
+#ifdef _WIN32
+// markdirty_all(); /* to avoid redraw errors in fullscreen mode (aphex) */
+#endif
+}
+
+void wm_window_swap_buffers(wmWindow *win)
+{
+ GHOST_SwapWindowBuffers(win->ghostwin);
+}
+
+/* ******************* exported api ***************** */
+
+
+/* called whem no ghost system was initialized */
+void WM_setprefsize(int stax, int stay, int sizx, int sizy)
+{
+ prefstax= stax;
+ prefstay= stay;
+ prefsizx= sizx;
+ prefsizy= sizy;
+}
+
diff --git a/source/blender/windowmanager/wm.h b/source/blender/windowmanager/wm.h
new file mode 100644
index 00000000000..0450adc1268
--- /dev/null
+++ b/source/blender/windowmanager/wm.h
@@ -0,0 +1,43 @@
+/**
+ * $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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2007 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+#ifndef WM_H
+#define WM_H
+
+extern void wm_close_and_free(bContext *C, wmWindowManager *);
+extern void wm_close_and_free_all(bContext *C, ListBase *);
+
+extern void wm_add_default(bContext *C);
+extern void wm_check(bContext *C);
+
+/* wm_operator.c, for init/exit */
+void wm_operatortype_free(void);
+void wm_operatortype_init(void);
+
+
+#endif /* WM_H */
+
diff --git a/source/blender/windowmanager/wm_cursors.h b/source/blender/windowmanager/wm_cursors.h
new file mode 100644
index 00000000000..f185ac791fe
--- /dev/null
+++ b/source/blender/windowmanager/wm_cursors.h
@@ -0,0 +1,115 @@
+/**
+ * $Id: BIF_cursors.h 7739 2006-06-15 14:22:59Z broken $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+
+
+#ifndef WM_CURSORS_H
+#define WM_CURSORS_H
+
+#define BC_GHOST_CURSORS 1000
+
+/* old cursors */
+enum {
+ CURSOR_FACESEL=BC_GHOST_CURSORS,
+ CURSOR_WAIT,
+ CURSOR_EDIT,
+ CURSOR_X_MOVE,
+ CURSOR_Y_MOVE,
+ CURSOR_HELP,
+ CURSOR_STD,
+ CURSOR_NONE,
+ CURSOR_PENCIL,
+};
+
+
+//typedef struct BCursor_s BCursor;
+typedef struct BCursor {
+
+ char *small_bm;
+ char *small_mask;
+
+ char small_sizex;
+ char small_sizey;
+ char small_hotx;
+ char small_hoty;
+
+ char *big_bm;
+ char *big_mask;
+
+ char big_sizex;
+ char big_sizey;
+ char big_hotx;
+ char big_hoty;
+
+ char fg_color;
+ char bg_color;
+
+} BCursor;
+
+#define LASTCURSOR -2
+#define SYSCURSOR -1
+enum {
+ BC_NW_ARROWCURSOR=0,
+ BC_NS_ARROWCURSOR,
+ BC_EW_ARROWCURSOR,
+ BC_WAITCURSOR,
+ BC_CROSSCURSOR,
+ BC_EDITCROSSCURSOR,
+ BC_BOXSELCURSOR,
+ BC_KNIFECURSOR,
+ BC_VLOOPCURSOR,
+ BC_TEXTEDITCURSOR,
+ BC_PAINTBRUSHCURSOR,
+ BC_HANDCURSOR,
+ BC_NSEW_SCROLLCURSOR,
+ BC_NS_SCROLLCURSOR,
+ BC_EW_SCROLLCURSOR,
+ BC_EYEDROPPER_CURSOR,
+/* --- ALWAYS LAST ----- */
+ BC_NUMCURSORS,
+};
+
+
+enum {
+ BC_BLACK=0,
+ BC_WHITE,
+ BC_RED,
+ BC_BLUE,
+ BC_GREEN,
+ BC_YELLOW
+};
+
+#define SMALL_CURSOR 0
+#define BIG_CURSOR 1
+
+#endif /* WM_CURSORS_H */
+
diff --git a/source/blender/windowmanager/wm_event_system.h b/source/blender/windowmanager/wm_event_system.h
new file mode 100644
index 00000000000..9b918ce3cf6
--- /dev/null
+++ b/source/blender/windowmanager/wm_event_system.h
@@ -0,0 +1,97 @@
+/**
+ * $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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2007 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+#ifndef WM_EVENT_SYSTEM_H
+#define WM_EVENT_SYSTEM_H
+
+/* return value of handler-operator call */
+#define WM_HANDLER_CONTINUE 0
+#define WM_HANDLER_BREAK 1
+
+
+/* each event should have full modifier state */
+/* event comes from eventmanager and from keymap */
+typedef struct wmEvent {
+ struct wmEvent *next, *prev;
+
+ short type; /* event code itself (short, is also in keymap) */
+ short val; /* press, release, scrollvalue */
+ short x, y; /* mouse pointer position */
+ short unicode; /* future, ghost? */
+ char ascii; /* from ghost */
+ char pad1;
+
+ /* modifier states */
+ short shift, ctrl, alt, oskey; /* oskey is apple or windowskey, value denotes order of pressed */
+ short keymodifier; /* rawkey modifier */
+
+ /* keymap item, set by handler (weak?) */
+ const char *keymap_idname;
+
+ /* custom data */
+ short custom; /* custom data type, stylus, 6dof, see wm_event_types.h */
+ void *customdata; /* ascii, unicode, mouse coords, angles, vectors, dragdrop info */
+
+} wmEvent;
+
+/* wmKeyMap is in DNA_windowmanager.h, it's savable */
+
+typedef struct wmEventHandler {
+ struct wmEventHandler *next, *prev;
+
+ int type, flag; /* type default=0, rest is custom */
+
+ ListBase *keymap; /* pointer to builtin/custom keymaps */
+
+ rctf boundbox; /* float, in bContext space (window, area, region) */
+
+ wmOperator *op; /* for derived handlers */
+
+} wmEventHandler;
+
+/* handler flag */
+ /* after this handler all others are ignored */
+#define WM_HANDLER_BLOCKING 1
+
+/* custom types for handlers, for signalling, freeing */
+enum {
+ WM_HANDLER_DEFAULT,
+ WM_HANDLER_TRANSFORM
+};
+
+
+void wm_event_free_all (wmWindow *win);
+wmEvent *wm_event_next (wmWindow *win);
+void wm_event_free_handlers (ListBase *lb);
+
+/* goes over entire hierarchy: events -> window -> screen -> area -> region */
+void wm_event_do_handlers(bContext *C);
+
+void wm_event_add_ghostevent(wmWindow *win, int type, void *customdata);
+
+#endif /* WM_EVENT_SYSTEM_H */
+
diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h
new file mode 100644
index 00000000000..25d1e7c9c41
--- /dev/null
+++ b/source/blender/windowmanager/wm_event_types.h
@@ -0,0 +1,255 @@
+/*
+ * $Id: wm_event_types.h
+ *
+ * ***** 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/*
+ * These define have its origin at sgi, where all device defines were written down in device.h.
+ * Blender copied the conventions quite some, and expanded it with internal new defines (ton)
+ *
+ */
+
+
+#ifndef WM_EVENT_TYPES_H
+#define WM_EVENT_TYPES_H
+
+/* custom data type */
+#define EVT_TABLET 1
+
+/* MOUSE : 0x00x */
+#define LEFTMOUSE 0x001
+#define MIDDLEMOUSE 0x002
+#define RIGHTMOUSE 0x003
+#define MOUSEMOVE 0x004
+ /* only use if you want user option switch possible */
+#define ACTIONMOUSE 0x005
+#define SELECTMOUSE 0x006
+
+#define WHEELUPMOUSE 0x00a
+#define WHEELDOWNMOUSE 0x00b
+
+
+/* SYSTEM : 0x01x */
+#define KEYBD 0x010 /* keyboard */
+#define RAWKEYBD 0x011 /* raw keyboard for keyboard manager */
+#define REDRAW 0x012 /* used by port manager to signal redraws */
+#define INPUTCHANGE 0x013 /* input connected or disconnected */
+#define QFULL 0x014 /* queue was filled */
+#define WINFREEZE 0x015 /* user wants process in this win to shut up */
+#define WINTHAW 0x016 /* user wants process in this win to go again */
+#define WINCLOSE 0x017 /* window close */
+#define WINQUIT 0x018 /* signal from user that app is to go away */
+#define Q_FIRSTTIME 0x019 /* on startup */
+
+/* standard keyboard */
+
+#define AKEY 'a'
+#define BKEY 'b'
+#define CKEY 'c'
+#define DKEY 'd'
+#define EKEY 'e'
+#define FKEY 'f'
+#define GKEY 'g'
+#define HKEY 'h'
+#define IKEY 'i'
+#define JKEY 'j'
+#define KKEY 'k'
+#define LKEY 'l'
+#define MKEY 'm'
+#define NKEY 'n'
+#define OKEY 'o'
+#define PKEY 'p'
+#define QKEY 'q'
+#define RKEY 'r'
+#define SKEY 's'
+#define TKEY 't'
+#define UKEY 'u'
+#define VKEY 'v'
+#define WKEY 'w'
+#define XKEY 'x'
+#define YKEY 'y'
+#define ZKEY 'z'
+
+#define ZEROKEY '0'
+#define ONEKEY '1'
+#define TWOKEY '2'
+#define THREEKEY '3'
+#define FOURKEY '4'
+#define FIVEKEY '5'
+#define SIXKEY '6'
+#define SEVENKEY '7'
+#define EIGHTKEY '8'
+#define NINEKEY '9'
+
+#define CAPSLOCKKEY 211
+
+#define LEFTCTRLKEY 212
+#define LEFTALTKEY 213
+#define RIGHTALTKEY 214
+#define RIGHTCTRLKEY 215
+#define RIGHTSHIFTKEY 216
+#define LEFTSHIFTKEY 217
+
+#define ESCKEY 218
+#define TABKEY 219
+#define RETKEY 220
+#define SPACEKEY 221
+#define LINEFEEDKEY 222
+#define BACKSPACEKEY 223
+#define DELKEY 224
+#define SEMICOLONKEY 225
+#define PERIODKEY 226
+#define COMMAKEY 227
+#define QUOTEKEY 228
+#define ACCENTGRAVEKEY 229
+#define MINUSKEY 230
+#define SLASHKEY 232
+#define BACKSLASHKEY 233
+#define EQUALKEY 234
+#define LEFTBRACKETKEY 235
+#define RIGHTBRACKETKEY 236
+
+#define LEFTARROWKEY 137
+#define DOWNARROWKEY 138
+#define RIGHTARROWKEY 139
+#define UPARROWKEY 140
+
+#define PAD0 150
+#define PAD1 151
+#define PAD2 152
+#define PAD3 153
+#define PAD4 154
+#define PAD5 155
+#define PAD6 156
+#define PAD7 157
+#define PAD8 158
+#define PAD9 159
+
+
+#define PADPERIOD 199
+#define PADSLASHKEY 161
+#define PADASTERKEY 160
+
+
+#define PADMINUS 162
+#define PADENTER 163
+#define PADPLUSKEY 164
+
+
+#define F1KEY 300
+#define F2KEY 301
+#define F3KEY 302
+#define F4KEY 303
+#define F5KEY 304
+#define F6KEY 305
+#define F7KEY 306
+#define F8KEY 307
+#define F9KEY 308
+#define F10KEY 309
+#define F11KEY 310
+#define F12KEY 311
+
+#define PAUSEKEY 165
+#define INSERTKEY 166
+#define HOMEKEY 167
+#define PAGEUPKEY 168
+#define PAGEDOWNKEY 169
+#define ENDKEY 170
+
+#define UNKNOWNKEY 171
+#define COMMANDKEY 172
+#define GRLESSKEY 173
+
+/* used as fake leftmouse events, special handled in interface.c */
+#define BUT_ACTIVATE 200
+#define BUT_NEXT 201
+#define BUT_PREV 202
+
+/* **************** BLENDER QUEUE EVENTS ********************* */
+
+#define CHANGED 0x4000
+#define DRAWEDGES 0x4001
+#define AFTERQUEUE 0x4002
+#define BACKBUFDRAW 0x4003
+#define EXECUTE 0x4004
+#define IGNORE_REDRAW 0x4005
+#define LOAD_FILE 0x4006
+#define RESHAPE 0x4007
+#define UI_BUT_EVENT 0x4008
+#define AUTOSAVE_FILE 0x4009
+#define UNDOPUSH 0x400A
+
+/* REDRAWVIEW3D has to be the first one (lowest number) for buttons! */
+#define REDRAWVIEW3D 0x4010
+#define REDRAWVIEWCAM 0x4011
+#define REDRAWVIEW3D_Z 0x4012
+
+#define REDRAWALL 0x4013
+#define REDRAWHEADERS 0x4014
+
+#define REDRAWBUTSHEAD 0x4015
+#define REDRAWBUTSALL 0x4016
+
+#define REDRAWBUTSSCENE 0x4017
+#define REDRAWBUTSOBJECT 0x4018
+#define REDRAWBUTSEDIT 0x4019
+#define REDRAWBUTSSCRIPT 0x401A
+#define REDRAWBUTSLOGIC 0x401B
+#define REDRAWBUTSSHADING 0x401C
+#define REDRAWBUTSGAME 0x401D
+#define REDRAWBUTSEFFECTS 0x401D
+
+#define REDRAWINFO 0x4021
+#define RENDERPREVIEW 0x4022
+#define REDRAWIPO 0x4023
+#define REDRAWDATASELECT 0x4024
+#define REDRAWSEQ 0x4025
+#define REDRAWIMAGE 0x4026
+#define REDRAWOOPS 0x4027
+#define REDRAWIMASEL 0x4028
+#define AFTERIMASELIMA 0x4029
+#define AFTERIMASELGET 0x402A
+#define AFTERIMAWRITE 0x402B
+#define IMALEFTMOUSE 0x402C
+#define AFTERPIBREAD 0x402D
+#define REDRAWTEXT 0x402E
+#define REDRAWSOUND 0x402F
+#define REDRAWACTION 0x4030
+#define REDRAWNLA 0x4031
+#define REDRAWSCRIPT 0x4032
+#define REDRAWTIME 0x4033
+#define REDRAWBUTSCONSTRAINT 0x4034
+#define ONLOAD_SCRIPT 0x4035
+#define SCREEN_HANDLER 0x4036
+#define REDRAWANIM 0x4037
+#define REDRAWNODE 0x4038
+#define RECALC_COMPOSITE 0x4039
+#define REDRAWMARKER 0x4040 /* all views that display markers */
+#define REDRAWVIEW3D_IMAGE 0x4041
+
+#endif /* WM_EVENT_TYPES_H */
+
diff --git a/source/blender/windowmanager/wm_files.h b/source/blender/windowmanager/wm_files.h
new file mode 100644
index 00000000000..3f54c388091
--- /dev/null
+++ b/source/blender/windowmanager/wm_files.h
@@ -0,0 +1,36 @@
+/**
+ * $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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2007 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+#ifndef WM_FILES_H
+#define WM_FILES_H
+
+extern void read_Blog(void);
+extern void delete_autosave(void);
+
+
+#endif /* WM_FILES_H */
+
diff --git a/source/blender/windowmanager/wm_window.h b/source/blender/windowmanager/wm_window.h
new file mode 100644
index 00000000000..3565bceac52
--- /dev/null
+++ b/source/blender/windowmanager/wm_window.h
@@ -0,0 +1,59 @@
+/**
+ * $Id: wm_window.h
+ *
+ * ***** 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2007 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef WM_WINDOW_H
+#define WM_WINDOW_H
+
+struct bScreen;
+
+/* *************** internal api ************** */
+void wm_ghost_init (bContext *C);
+
+wmWindow *wm_window_new (bContext *C, struct bScreen *screen);
+void wm_window_free (bContext *C, wmWindow *win);
+void wm_window_add_ghostwindows (wmWindowManager *wm);
+void wm_window_process_events (int wait_for_event);
+
+void wm_window_make_drawable(bContext *C, wmWindow *win);
+
+void wm_window_raise (wmWindow *win);
+void wm_window_lower (wmWindow *win);
+void wm_window_set_size (wmWindow *win, int width, int height);
+void wm_window_get_size (wmWindow *win, int *width_r, int *height_r);
+void wm_window_get_position (wmWindow *win, int *posx_r, int *posy_r);
+void wm_window_set_title (wmWindow *win, char *title);
+void wm_window_swap_buffers (wmWindow *win);
+
+wmWindow *wm_window_copy (bContext *C, wmWindow *winorig);
+
+/* *************** window operators ************** */
+int wm_window_duplicate_op (bContext *C, wmOperator *op);
+
+
+#endif /* WM_WINDOW_H */
+